From f0083e3d4eb49e11fd7e37532dc64a6e6f5d4039 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 26 Apr 2005 20:59:47 -0700 Subject: added initial files. --- Makefile | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ klibc/Makefile | 3 ++ logging.c | 52 ++++++++++++++++++++ udev.c | 83 +++++++++++++++++++++++++++++++ udev.h | 41 ++++++++++++++++ 5 files changed, 331 insertions(+) create mode 100644 Makefile create mode 100644 klibc/Makefile create mode 100644 logging.c create mode 100644 udev.c create mode 100644 udev.h diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..c73ee42a3e --- /dev/null +++ b/Makefile @@ -0,0 +1,152 @@ +# Makefile for diethotplug +# +# Copyright (C) 2000,2001 Greg Kroah-Hartman +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# Set the following to `true' to make a debuggable build. +# Leave this set to `false' for production use. +DEBUG = false + + +ROOT = udev +#PREFIX = diet +VERSION = 0.01 +INSTALL_DIR = /usr/local/bin +RELEASE_NAME = $(PREFIX)$(ROOT)-$(VERSION) + + +# Comment out this line to build with something other +# than the local version of klibc +#KLIBC = true + +# If you are running a cross compiler, you may want to set this +# to something more interesting, like "arm-linux-". I you want +# to compile vs uClibc, that can be done here as well. +CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- +CC = $(CROSS)gcc +AR = $(CROSS)ar +STRIP = $(CROSS)strip + + +# code taken from uClibc to determine the current arch +ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ + -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/ppc/powerpc/g'} + +# code taken from uClibc to determine the gcc include dir +GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} + +# code taken from uClibc to determine the libgcc.a filename +GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) + +# use '-Os' optimization if available, else use -O2 +OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ + then echo "-Os"; else echo "-O2" ; fi} + +WARNINGS := -Wall -Wshadow -Wstrict-prototypes + +# Some nice architecture specific optimizations +ifeq ($(strip $(TARGET_ARCH)),arm) + OPTIMIZATION+=-fstrict-aliasing +endif +ifeq ($(strip $(TARGET_ARCH)),i386) + OPTIMIZATION+=-march=i386 + OPTIMIZATION += ${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc \ + /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi} + OPTIMIZATION += ${shell if $(CC) -malign-functions=0 -malign-jumps=0 -S -o /dev/null -xc \ + /dev/null >/dev/null 2>&1; then echo "-malign-functions=0 -malign-jumps=0"; fi} + CFLAGS+=-pipe +else + CFLAGS+=-pipe +endif + +# if DEBUG is enabled, then we do not strip or optimize +ifeq ($(strip $(DEBUG)),true) + CFLAGS += $(WARNINGS) -O1 -g -DDEBUG -D_GNU_SOURCE + LDFLAGS += -Wl,-warn-common + STRIPCMD = /bin/true -Since_we_are_debugging +else + CFLAGS += $(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE + LDFLAGS += -s -Wl,-warn-common + STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment +endif + +# If we are using our version of klibc, then we need to build and link it. +# Otherwise, use glibc and link statically. +ifeq ($(strip $(KLIBC)),true) + KLIBC_DIR = klibc + INCLUDE_DIR := $(KLIBC_DIR)/include + # arch specific objects + ARCH_LIB_OBJS = \ + $(KLIBC_DIR)/bin-$(ARCH)/start.o \ + $(KLIBC_DIR)/bin-$(ARCH)/klibc.a + + LIB_OBJS = $(GCC_LIB) + + LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) + CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(GCCINCDIR) + LDFLAGS = --static --nostdlib -nostartfiles +else + LIBC = + CFLAGS += -I$(GCCINCDIR) + LIB_OBJS = -lc + LDFLAGS = --static +endif + +all: $(LIBC) $(ROOT) + +$(ARCH_LIB_OBJS) : + $(MAKE) -C klibc + +OBJS = udev.o \ + logging.o + + +# header files automatically generated +GEN_HEADERS = udev_version.h + +# Rules on how to create the generated header files +udev_version.h: + @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ + + +$(ROOT): $(GEN_HEADERS) $(OBJS) + $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $(ROOT) + +clean: + -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ + | xargs rm -f + -rm -f core $(ROOT) $(GEN_HEADERS) + $(MAKE) -C klibc clean + +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS ) +DISTDIR := $(RELEASE_NAME) +srcdir = . +release: $(DISTFILES) clean +# @echo $(DISTFILES) + @-rm -rf $(DISTDIR) + @mkdir $(DISTDIR) + @-chmod 777 $(DISTDIR) + @for file in $(DISTFILES); do \ + if test -d $$file; then \ + mkdir $(DISTDIR)/$$file; \ + else \ + cp -p $$file $(DISTDIR)/$$file; \ + fi; \ + done + @tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz + @rm -rf $(DISTDIR) + @echo "Built $(RELEASE_NAME).tar.gz" diff --git a/klibc/Makefile b/klibc/Makefile new file mode 100644 index 0000000000..288a862707 --- /dev/null +++ b/klibc/Makefile @@ -0,0 +1,3 @@ + +clean: + @echo "all clean" diff --git a/logging.c b/logging.c new file mode 100644 index 0000000000..e074b1562c --- /dev/null +++ b/logging.c @@ -0,0 +1,52 @@ +/* + * logging.c + * + * Simple logging functions that can be compiled away into nothing. + * + * Copyright (C) 2001-2003 Greg Kroah-Hartman + * + * 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 02139, USA. + * + */ + +#include +#include +#include "udev.h" + +#ifdef DEBUG + +static int logging_init = 0; + +static void init_logging (void) +{ + openlog ("udev", 0, LOG_DAEMON); + logging_init = 1; +} + +/** + * log_message - sends a message to the logging facility + */ +int log_message (int level, const char *format, ...) +{ + va_list args; + + if (!logging_init) + init_logging(); + va_start (args, format); + vsyslog (level, format, args); + va_end (args); + return 1; +} + +#endif diff --git a/udev.c b/udev.c new file mode 100644 index 0000000000..1ac1c98507 --- /dev/null +++ b/udev.c @@ -0,0 +1,83 @@ +/* + * udev.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include "udev.h" +#include "udev_version.h" + + +static char *get_action(void) +{ + char *action; + + action = getenv("ACTION"); + return action; +} + + +/* yeah this should be dynamically allocated... */ +static char device[255]; + +static char *get_device(void) +{ + char *temp; + + temp = getenv("DEVPATH"); + if (temp == NULL) + return NULL; + strcpy(device, SYSFS_ROOT); + strcat(device, temp); + + return device; +} + + +int main(int argc, char *argv[]) +{ + char *subsystem; + char *action; + char *dev; + + if (argc != 2) { + dbg ("unknown number of arguments"); + return 1; + } + + subsystem = argv[1]; + + action = get_action(); + if (!action) { + dbg ("no action?"); + return 1; + } + + dev = get_device(); + if (!dev) { + dbg ("no device?"); + return 1; + } + + return 0; +} + diff --git a/udev.h b/udev.h new file mode 100644 index 0000000000..ef7175ea3a --- /dev/null +++ b/udev.h @@ -0,0 +1,41 @@ +/* + * udev.h + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * 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 02139, USA. + * + */ + +#ifndef UDEV_H +#define UDEV_H + + +#ifdef DEBUG +#include + #define dbg(format, arg...) do { log_message (LOG_DEBUG, __FUNCTION__ ": " format, ## arg); } while (0) +#else + #define dbg(format, arg...) do { } while (0) +#endif + + +/* Lots of constants that should be in a config file sometime */ +#define SYSFS_ROOT "/sys" +#define MKNOD "/bin/mknod" + + +#endif + -- cgit v1.2.3-54-g00ecf From a507a0157240640b4fbf096577a3c2d9729511dd Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Apr 2003 20:04:38 -0700 Subject: [PATCH] enabled debugging. --- Makefile | 2 +- udev.h | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c73ee42a3e..c31f61d840 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ # Set the following to `true' to make a debuggable build. # Leave this set to `false' for production use. -DEBUG = false +DEBUG = true ROOT = udev diff --git a/udev.h b/udev.h index ef7175ea3a..83004bb791 100644 --- a/udev.h +++ b/udev.h @@ -26,7 +26,10 @@ #ifdef DEBUG #include - #define dbg(format, arg...) do { log_message (LOG_DEBUG, __FUNCTION__ ": " format, ## arg); } while (0) +#define dbg(format, arg...) \ + do { \ + log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + } while (0) #else #define dbg(format, arg...) do { } while (0) #endif @@ -37,5 +40,8 @@ #define MKNOD "/bin/mknod" +extern int log_message (int level, const char *format, ...); + + #endif -- cgit v1.2.3-54-g00ecf From 0c63f1190f78bb47596c9a17df84b8dc091b0e0d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Apr 2003 20:09:14 -0700 Subject: [PATCH] added initial documentation and gpl license --- COPYING | 340 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ChangeLog | 1 + docs/overview | 123 +++++++++++++++++++++ 3 files changed, 464 insertions(+) create mode 100644 COPYING create mode 100644 ChangeLog create mode 100644 docs/overview diff --git a/COPYING b/COPYING new file mode 100644 index 0000000000..5b6e7c66c2 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000000..6a7969d298 --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ +0.1 - initial release diff --git a/docs/overview b/docs/overview new file mode 100644 index 0000000000..6528b058c2 --- /dev/null +++ b/docs/overview @@ -0,0 +1,123 @@ + +Instead of heading in on another "proposal" document, I thought I'd send out +this email describing ideas I've had about udev - thanks to the comments I've +received. The idea is starting to mushroom a bit and I'd like to get people's +comments before I go further down the path. + +As I see it, we've got a couple goals for udev: + +1) dynamic replacement for /dev +2) device naming +3) API to access info about current system devices + +I'd like to split these goals into separate subsystems: + +1) udev - dynamic replacement for /dev +2) namedev - device naming +3) libsysfs - a standard library for accessing device information on the +system. + +Udev +------ + +Udev will be responsible for responding to /sbin/hotplug on device events. It +will receive the device class information along with device's sysfs +directory. Udev will call the name_device function from the naming device +subsystem with that information and receive a unique device name in return. +Udev will then query sysfs through the libsysfs for specific device +information required for creating the /dev node like major and minor number. +Once it has the important information, udev will create a /dev entry for the +device, add the device to the in memory table of current devices, and send +notification of the successful event. On a remove call, udev will remove the +/dev entry, remove the device from the in memory table, and send +notification. + +Udev will consist of a command udev - to be called from /sbin/hotplug. It will +require the in memory dynamic database/table for keeping track of current +system devices, and a library of routines for accessing that database/table. +Udev will not care about "how" devices are named, that will be separated into +the device naming subsystem. It's presented a common device naming API by the +device naming subsystem to use for naming devices. + +namedev +---------- + +From comments Martin has made, I've decided to push out the device naming part +of udev into its own "subsystem". The reason is to make this as flexible and +pluggable as possible. The device naming subsystem, or namedev, will present +a standard interface for udev to call for naming a particular device. Under +that interface, system administrators can plug in their own methods for +device naming. + +We would provide a default naming scheme. The first prototype implementation +could simply take the sysfs directory passed in with the device name +function, query sysfs for the major and minor numbers, and then look up in a +static device name mapping file the name of the device. The static device +naming file could look just like devices.txt in the Linux kernel's +Documentation directory. Obviously, this isn't a great implementation because +eventually we'd like major an minor numbers to be dynamic. + +The default naming scheme in the future would have a set of policies to go +through, these were given to me by Greg. The device naming subsystem would +get the sysfs directory of the to be named device and would use the following +information in order to map the device's name: + +1) Label info - like SCSI's UUID +2) Bus Device Number +3) Topology on Bus +4) Kernel Name - DEFAULT + +System administrators could use the default naming system or enterprise +computing environments could plug in their Universal Unique Identifier (UUID) +policies. The idea is to make the device naming as flexible and pluggable as +possible. + +The device naming subsystem would require accessing sysfs for device +information. It will receive the device's sysfs directory in the call from +udev and use it to get more information to determine naming. The namedev +subsystem will include a standard naming API for udev to use. The default +naming scheme will include a set of functions and a static device naming +file, which will reside in /etc or /var. + +libsysfs +-------- + +Greg may object, but I believe there's a need for a common API to access +device information in sysfs. The device naming subsystem and the udev +subsystem need to take the sysfs directory path and query device information. +Instead of copying code so each one will have to readdir, etc., I've decided +to split out the sysfs calls into a separate library that will sit atop +sysfs. Sysfs callbacks aren't standard across devices, I beleive this is +another reason for creating a common and standard library interface for +querying device information. + +Another reason for libsysfs is it satisfies requirements the LTC RAS team has +for getting current system device information. Rather than keeping tons of +information in udev's in memory database, or even querying that database for +the sysfs directory that will require storing extra reference info in memory, +I've decided the RAS requirements can be fulfilled with a library atop sysfs. +Sysfs contains devices currently on the system. + +Applications like the Error Log Analysis piece, for example, can query the +sysfs library for device information. ELA gets specific information in an +error message thanks to the dev_* and soon to be proposed netdev_* macros. +One goal of the ELA is to gather as much information about an erroring device +so service engineers and administrators can diagnose the problem. The ELA +will get an error message with the bus id and driver name of the device. It +will then need to query sysfs for other VPD information. + +I've used syfs in the name of libsysfs for a reason, I believe sysfs will be +the device tree to use in the future. Until all VPD info is in sysfs, the +library could also make use of /proc, sginfo, and other sources for device +information under the covers so ELA and other applications don' t need to all +have that knowledge. + + +I'd like to know what everyone thinks about my proposal to split this all up +into three separate subsystems. All comments are welcome. + +Thanks, + +Dan + + -- cgit v1.2.3-54-g00ecf From a2fd2ff38a20d70cdc4487ea43a74da9604c3b54 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Apr 2003 10:53:25 -0700 Subject: [PATCH] added stupid test script for debugging. --- test | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test diff --git a/test b/test new file mode 100644 index 0000000000..9cab4a6db7 --- /dev/null +++ b/test @@ -0,0 +1,5 @@ +#!/bin/sh +export ACTION=add +export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.2/ttyUSB7 + +./udev tty -- cgit v1.2.3-54-g00ecf From 85511f02466297b7dca07c3fe5491230f3f06d14 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Apr 2003 10:53:46 -0700 Subject: [PATCH] Creating nodes actually works. --- udev.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- udev.h | 11 ++++ 2 files changed, 208 insertions(+), 10 deletions(-) diff --git a/udev.c b/udev.c index 1ac1c98507..971ac10809 100644 --- a/udev.c +++ b/udev.c @@ -23,6 +23,11 @@ #include #include +#include +#include +#include +#include + #include "udev.h" #include "udev_version.h" @@ -36,11 +41,9 @@ static char *get_action(void) } -/* yeah this should be dynamically allocated... */ -static char device[255]; - static char *get_device(void) { + static char device[255]; char *temp; temp = getenv("DEVPATH"); @@ -52,32 +55,216 @@ static char *get_device(void) return device; } +/* + * Right now the major/minor of a device is stored in a file called + * "dev" in sysfs. + * The number is stored as: + * MMmm + * MM is the major + * mm is the minor + * The value is in hex. + * Yes, this will probably change when we go to a bigger major/minor + * range, and will have to be changed at that time. + */ +static int get_major_minor (char *dev, int *major, int *minor) +{ + char filename[255]; + char line[20]; + char temp[3]; + int fd; + int retval = 0; + + /* add the dev file to the directory and see if it's present */ + strncpy(filename, dev, sizeof(filename)); + strncat(filename, DEV_FILE, sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd < 0) { + dbg("Can't open %s", filename); + return -ENODEV; + } + + /* get the major/minor */ + retval = read(fd, line, sizeof(line)); + if (retval < 0) { + dbg("read error on %s", dev); + goto exit; + } + + temp[0] = line[0]; + temp[1] = line[1]; + temp[2] = 0x00; + *major = (int)strtol(&temp[0], NULL, 16); + + temp[0] = line[2]; + temp[1] = line[3]; + temp[2] = 0x00; + *minor = (int)strtol(&temp[0], NULL, 16); + + dbg("found major = %d, minor = %d", *major, *minor); + + retval = 0; +exit: + close(fd); + return retval; +} + +/* + * Here would go a call to the naming deamon, to get the name we want to have + * for this device. But for now, let's just default to whatever the kernel is + * calling the device as that will keep the "old-style" naming policy + */ +static char *get_name(char *dev, int major, int minor) +{ + static char name[100]; + char *temp; + + temp = strrchr(dev, '/'); + if (temp == NULL) + return NULL; + strncpy(name, &temp[1], sizeof(name)); + + dbg("name is %s", name); + + return &name[0]; +} + +/* + * Again, this will live in the naming deamon + */ +static int get_mode(char *name, char *dev, int major, int minor) +{ + /* just default everyone to rw for the world! */ + return 0666; +} + +/* + * We also want to add some permissions here, and possibly some symlinks + */ +static int create_node(char *name, char type, int major, int minor, int mode) +{ + char *argv[7]; + char mode_string[100]; + char type_string[3]; + char major_string[20]; + char minor_string[20]; + char filename[255]; + int retval = 0; + + strncpy(filename, UDEV_ROOT, sizeof(filename)); + strncat(filename, name, sizeof(filename)); + + snprintf(mode_string, sizeof(mode_string), "--mode=%#o", mode); + snprintf(type_string, sizeof(type_string), "%c", type); + snprintf(major_string, sizeof(major_string), "%d", major); + snprintf(minor_string, sizeof(minor_string), "%d", minor); + + argv[0] = MKNOD; + argv[1] = mode_string; + argv[2] = filename; + argv[3] = type_string; + argv[4] = major_string; + argv[5] = minor_string; + argv[6] = NULL; + dbg ("executing %s %s %s %s %s %s", + argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); + switch (fork()) { + case 0: + /* we are the child, so lets run the program */ + execv (MKNOD, argv); + exit(0); + break; + case (-1): + dbg ("fork failed."); + retval = -EFAULT; + break; + default: + break; + } + return retval; +} + +static int remove_node(char *name) +{ + return 0; +} + +static int do_it(char *action, char *name, char type, int major, int minor, int mode) +{ + if (strcmp(action, "add") == 0) + return create_node(name, type, major, minor, mode); + + if (strcmp(action, "remove") == 0) + return remove_node(name); + + dbg("Unknown action: %s", action); + return -EINVAL; +} int main(int argc, char *argv[]) { char *subsystem; char *action; - char *dev; + char *device; + char *name; + char type; + int major; + int minor; + int mode; + int retval = -EINVAL; if (argc != 2) { dbg ("unknown number of arguments"); - return 1; + goto exit; } + /* for now, the block layer is the only place where block devices are */ subsystem = argv[1]; + if (strcmp(subsystem, "block") == 0) + type = 'b'; + else + type = 'c'; action = get_action(); if (!action) { dbg ("no action?"); - return 1; + goto exit; } - dev = get_device(); - if (!dev) { + device = get_device(); + if (!device) { dbg ("no device?"); - return 1; + goto exit; } + dbg("looking at %s", device); - return 0; + retval = get_major_minor(device, &major, &minor); + if (retval) { + dbg ("get_major_minor failed"); + goto exit; + } + + name = get_name(device, major, minor); + if (name == NULL) { + dbg ("get_name failed"); + retval = -ENODEV; + goto exit; + } + + mode = get_mode(name, device, major, minor); + if (mode < 0) { + dbg ("get_mode failed"); + retval = -EINVAL; + goto exit; + } + + retval = do_it(action, name, type, major, minor, mode); + if (retval) { + dbg ("do_it failed"); + goto exit; + } + + retval = 0; +exit: + return retval; } diff --git a/udev.h b/udev.h index 83004bb791..458d1d9c37 100644 --- a/udev.h +++ b/udev.h @@ -36,10 +36,21 @@ /* Lots of constants that should be in a config file sometime */ + +/* Location of sysfs mount */ #define SYSFS_ROOT "/sys" + +/* Where udev should create its device nodes, trailing / needed */ +#define UDEV_ROOT "/home/greg/linux/udev/" + +/* device file in sysfs that contains major/minor number, leading / needed */ +#define DEV_FILE "/dev" + +/* Binaries that udev calls to do stuff */ #define MKNOD "/bin/mknod" + extern int log_message (int level, const char *format, ...); -- cgit v1.2.3-54-g00ecf From 3f4967a1fbb4270b0577cca7d6a6d43a880875a5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Apr 2003 11:02:32 -0700 Subject: [PATCH] restructure code to be able to actually get remove_node() to work. --- udev.c | 77 +++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/udev.c b/udev.c index 971ac10809..4bb41a8696 100644 --- a/udev.c +++ b/udev.c @@ -183,21 +183,43 @@ static int create_node(char *name, char type, int major, int minor, int mode) return retval; } -static int remove_node(char *name) +static int add_node(char *device, char type) { - return 0; -} + char *name; + int major; + int minor; + int mode; + int retval = -EINVAL; -static int do_it(char *action, char *name, char type, int major, int minor, int mode) -{ - if (strcmp(action, "add") == 0) - return create_node(name, type, major, minor, mode); + retval = get_major_minor(device, &major, &minor); + if (retval) { + dbg ("get_major_minor failed"); + goto exit; + } - if (strcmp(action, "remove") == 0) - return remove_node(name); + name = get_name(device, major, minor); + if (name == NULL) { + dbg ("get_name failed"); + retval = -ENODEV; + goto exit; + } - dbg("Unknown action: %s", action); - return -EINVAL; + mode = get_mode(name, device, major, minor); + if (mode < 0) { + dbg ("get_mode failed"); + retval = -EINVAL; + goto exit; + } + + return create_node(name, type, major, minor, mode); + +exit: + return retval; +} + +static int remove_node(char *device) +{ + return 0; } int main(int argc, char *argv[]) @@ -205,11 +227,7 @@ int main(int argc, char *argv[]) char *subsystem; char *action; char *device; - char *name; char type; - int major; - int minor; - int mode; int retval = -EINVAL; if (argc != 2) { @@ -237,31 +255,14 @@ int main(int argc, char *argv[]) } dbg("looking at %s", device); - retval = get_major_minor(device, &major, &minor); - if (retval) { - dbg ("get_major_minor failed"); - goto exit; - } - - name = get_name(device, major, minor); - if (name == NULL) { - dbg ("get_name failed"); - retval = -ENODEV; - goto exit; - } + if (strcmp(action, "add") == 0) + return add_node(device, type); - mode = get_mode(name, device, major, minor); - if (mode < 0) { - dbg ("get_mode failed"); - retval = -EINVAL; - goto exit; - } + if (strcmp(action, "remove") == 0) + return remove_node(device); - retval = do_it(action, name, type, major, minor, mode); - if (retval) { - dbg ("do_it failed"); - goto exit; - } + dbg("Unknown action: %s", action); + return -EINVAL; retval = 0; exit: -- cgit v1.2.3-54-g00ecf From 8b16416dce3d5feab0827668e1184301a19074a8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Apr 2003 11:16:34 -0700 Subject: [PATCH] remove now works! --- test | 5 +++-- udev.c | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/test b/test index 9cab4a6db7..730f0a446a 100644 --- a/test +++ b/test @@ -1,5 +1,6 @@ #!/bin/sh -export ACTION=add -export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.2/ttyUSB7 +#export ACTION=add +export ACTION=remove +export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.1/ttyUSB7 ./udev tty diff --git a/udev.c b/udev.c index 4bb41a8696..5aa9b43d43 100644 --- a/udev.c +++ b/udev.c @@ -183,7 +183,21 @@ static int create_node(char *name, char type, int major, int minor, int mode) return retval; } -static int add_node(char *device, char type) +/* + * We also want to clean up any symlinks that were created in create_node() + */ +static int delete_node(char *name) +{ + char filename[255]; + + strncpy(filename, UDEV_ROOT, sizeof(filename)); + strncat(filename, name, sizeof(filename)); + + dbg("unlinking %s", filename); + return unlink(filename); +} + +static int add_device(char *device, char type) { char *name; int major; @@ -217,9 +231,22 @@ exit: return retval; } -static int remove_node(char *device) +static int remove_device(char *device) { - return 0; + char *name; + int retval = 0; + + name = get_name(device, 0, 0); + if (name == NULL) { + dbg ("get_name failed"); + retval = -ENODEV; + goto exit; + } + + return delete_node(name); + +exit: + return retval; } int main(int argc, char *argv[]) @@ -256,10 +283,10 @@ int main(int argc, char *argv[]) dbg("looking at %s", device); if (strcmp(action, "add") == 0) - return add_node(device, type); + return add_device(device, type); if (strcmp(action, "remove") == 0) - return remove_node(device); + return remove_device(device); dbg("Unknown action: %s", action); return -EINVAL; -- cgit v1.2.3-54-g00ecf From 1e7a3f9e1101c148bd52640715db14e4c76b4996 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Apr 2003 11:25:55 -0700 Subject: [PATCH] cleaned up the makefile a bit. --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c31f61d840..803a2db569 100644 --- a/Makefile +++ b/Makefile @@ -22,10 +22,9 @@ DEBUG = true ROOT = udev -#PREFIX = diet VERSION = 0.01 INSTALL_DIR = /usr/local/bin -RELEASE_NAME = $(PREFIX)$(ROOT)-$(VERSION) +RELEASE_NAME = $(ROOT)-$(VERSION) # Comment out this line to build with something other -- cgit v1.2.3-54-g00ecf From 1c8c0f62121ea0069f12af252384f66178fc7b07 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Apr 2003 11:38:33 -0700 Subject: [PATCH] updated the documentation. --- docs/overview | 159 ++++++++++++++++++++++++---------------------------------- 1 file changed, 66 insertions(+), 93 deletions(-) diff --git a/docs/overview b/docs/overview index 6528b058c2..350d53ee70 100644 --- a/docs/overview +++ b/docs/overview @@ -1,123 +1,96 @@ -Instead of heading in on another "proposal" document, I thought I'd send out -this email describing ideas I've had about udev - thanks to the comments I've -received. The idea is starting to mushroom a bit and I'd like to get people's -comments before I go further down the path. - -As I see it, we've got a couple goals for udev: +We've got a couple goals for udev: 1) dynamic replacement for /dev 2) device naming 3) API to access info about current system devices -I'd like to split these goals into separate subsystems: +Splitting these goals into separate subsystems: 1) udev - dynamic replacement for /dev 2) namedev - device naming -3) libsysfs - a standard library for accessing device information on the -system. +3) libsysfs - a standard library for accessing device information on the + system. Udev ------ -Udev will be responsible for responding to /sbin/hotplug on device events. It -will receive the device class information along with device's sysfs -directory. Udev will call the name_device function from the naming device -subsystem with that information and receive a unique device name in return. -Udev will then query sysfs through the libsysfs for specific device -information required for creating the /dev node like major and minor number. -Once it has the important information, udev will create a /dev entry for the -device, add the device to the in memory table of current devices, and send -notification of the successful event. On a remove call, udev will remove the -/dev entry, remove the device from the in memory table, and send -notification. - -Udev will consist of a command udev - to be called from /sbin/hotplug. It will -require the in memory dynamic database/table for keeping track of current -system devices, and a library of routines for accessing that database/table. -Udev will not care about "how" devices are named, that will be separated into -the device naming subsystem. It's presented a common device naming API by the -device naming subsystem to use for naming devices. +Udev will be responsible for responding to /sbin/hotplug on device +events. It will receive the device class information along with +device's sysfs directory. Udev will call the name_device function from +the naming device subsystem with that information and receive a unique +device name in return. Udev will then query sysfs through the libsysfs +for specific device information required for creating the /dev node like +major and minor number. Once it has the important information, udev +will create a /dev entry for the device, add the device to the in memory +table of current devices, and send notification of the successful event +through a D-BUS message. On a remove call, udev will remove the /dev +entry, remove the device from the in memory table, and send +notification. + +Udev will consist of a command udev - to be called from /sbin/hotplug. +It will require the in memory dynamic database/table for keeping track +of current system devices, and a library of routines for accessing that +database/table. Udev will not care about "how" devices are named, that +will be separated into the device naming subsystem. It's presented a +common device naming API by the device naming subsystem to use for +naming devices. + + namedev ---------- -From comments Martin has made, I've decided to push out the device naming part -of udev into its own "subsystem". The reason is to make this as flexible and -pluggable as possible. The device naming subsystem, or namedev, will present -a standard interface for udev to call for naming a particular device. Under -that interface, system administrators can plug in their own methods for -device naming. - -We would provide a default naming scheme. The first prototype implementation -could simply take the sysfs directory passed in with the device name -function, query sysfs for the major and minor numbers, and then look up in a -static device name mapping file the name of the device. The static device -naming file could look just like devices.txt in the Linux kernel's -Documentation directory. Obviously, this isn't a great implementation because -eventually we'd like major an minor numbers to be dynamic. - -The default naming scheme in the future would have a set of policies to go -through, these were given to me by Greg. The device naming subsystem would -get the sysfs directory of the to be named device and would use the following -information in order to map the device's name: +From comments people have made, the device naming part of udev has been +pushed into its own "subsystem". The reason is to make this as flexible +and pluggable as possible. The device naming subsystem, or namedev, will +present a standard interface for udev to call for naming a particular +device. Under that interface, system administrators can plug in their +own methods for device naming. + +We would provide a default naming scheme. The first prototype +implementation could simply take the sysfs directory passed in with the +device name function, query sysfs for the major and minor numbers, and +then look up in a static device name mapping file the name of the +device. The static device naming file could look just like devices.txt +in the Linux kernel's Documentation directory. Obviously, this isn't a +great implementation because eventually we'd like major an minor numbers +to be dynamic. + +The default naming scheme in the future would have a set of policies to +go through in order to determine the name of the device. The device +naming subsystem would get the sysfs directory of the to be named device +and would use the following information in order to map the device's +name: 1) Label info - like SCSI's UUID 2) Bus Device Number 3) Topology on Bus 4) Kernel Name - DEFAULT -System administrators could use the default naming system or enterprise -computing environments could plug in their Universal Unique Identifier (UUID) -policies. The idea is to make the device naming as flexible and pluggable as -possible. +System administrators could use the default naming system or enterprise +computing environments could plug in their Universal Unique Identifier +(UUID) policies. The idea is to make the device naming as flexible and +pluggable as possible. + +The device naming subsystem would require accessing sysfs for device +information. It will receive the device's sysfs directory in the call +from udev and use it to get more information to determine naming. The +namedev subsystem will include a standard naming API for udev to use. +The default naming scheme will include a set of functions and a static +device naming file, which will reside in /etc or /var. + -The device naming subsystem would require accessing sysfs for device -information. It will receive the device's sysfs directory in the call from -udev and use it to get more information to determine naming. The namedev -subsystem will include a standard naming API for udev to use. The default -naming scheme will include a set of functions and a static device naming -file, which will reside in /etc or /var. libsysfs -------- -Greg may object, but I believe there's a need for a common API to access -device information in sysfs. The device naming subsystem and the udev -subsystem need to take the sysfs directory path and query device information. -Instead of copying code so each one will have to readdir, etc., I've decided -to split out the sysfs calls into a separate library that will sit atop -sysfs. Sysfs callbacks aren't standard across devices, I beleive this is -another reason for creating a common and standard library interface for +There is a need for a common API to access device information in sysfs. +The device naming subsystem and the udev subsystem need to take the +sysfs directory path and query device information. Instead of copying +code so each one will have to readdir, etc., splitting this logic of +sysfs calls into a separate library that will sit atop sysfs makes more +sense. Sysfs callbacks aren't standard across devices, so this is +another reason for creating a common and standard library interface for querying device information. -Another reason for libsysfs is it satisfies requirements the LTC RAS team has -for getting current system device information. Rather than keeping tons of -information in udev's in memory database, or even querying that database for -the sysfs directory that will require storing extra reference info in memory, -I've decided the RAS requirements can be fulfilled with a library atop sysfs. -Sysfs contains devices currently on the system. - -Applications like the Error Log Analysis piece, for example, can query the -sysfs library for device information. ELA gets specific information in an -error message thanks to the dev_* and soon to be proposed netdev_* macros. -One goal of the ELA is to gather as much information about an erroring device -so service engineers and administrators can diagnose the problem. The ELA -will get an error message with the bus id and driver name of the device. It -will then need to query sysfs for other VPD information. - -I've used syfs in the name of libsysfs for a reason, I believe sysfs will be -the device tree to use in the future. Until all VPD info is in sysfs, the -library could also make use of /proc, sginfo, and other sources for device -information under the covers so ELA and other applications don' t need to all -have that knowledge. - - -I'd like to know what everyone thinks about my proposal to split this all up -into three separate subsystems. All comments are welcome. - -Thanks, - -Dan - - -- cgit v1.2.3-54-g00ecf From d2ce1817117daa9523b1572523f1e7684bae779f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Apr 2003 15:56:20 -0700 Subject: [PATCH] added more documentation in README and TODO files. --- ChangeLog | 3 ++- Makefile | 2 +- README | 39 +++++++++++++++++++++++++++++++++++++++ TODO | 6 ++++++ 4 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 README create mode 100644 TODO diff --git a/ChangeLog b/ChangeLog index 6a7969d298..f8b5da0f1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1 +1,2 @@ -0.1 - initial release +0.1 - Added a bit of documentation to the README and TODO files. +0.01 - initial release diff --git a/Makefile b/Makefile index 803a2db569..4e0ca6b3cf 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 0.01 +VERSION = 0.1 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/README b/README new file mode 100644 index 0000000000..1a46a3c1ee --- /dev/null +++ b/README @@ -0,0 +1,39 @@ + +udev - a userspace implementation of devfs + +For more information on the design, and structure of this project, see the +files in the docs/ directory. + +To use: + +- Edit the udev.h file and replace the following variables with values + that make sense for your system: + #define SYSFS_ROOT "/sys" + #define UDEV_ROOT "/home/greg/linux/udev/" + #define DEV_FILE "/dev" + #define MKNOD "/bin/mknod" + The only value most people will have to change is the UDEV_ROOT + variable, as I doubt you really want device nodes to be created in my + home directory :) + +- Run make to build the project. + +- Make sure sysfs is mounted. + +- Point /proc/sys/kernel/hotplug at the location of the udev binary that + is created. Then plug some block devices in, or other types of + devices that create dev files in sysfs. An easy way to do this, + without any hardware is to use the scsi_debug module to create virtual + scsi devices. + +- Watch as the nodes get created and removed. + + +Yes this is a really rough first cut, I know. It's mostly a proof of +concept that this can actually work. See the TODO file for a list of +things left to be done. + +Any comment/questions/concerns please let me know. + +greg k-h +greg@kroah.com diff --git a/TODO b/TODO new file mode 100644 index 0000000000..1f776b9142 --- /dev/null +++ b/TODO @@ -0,0 +1,6 @@ +- use mknod(2) and not execute mknod(1) +- add klibc to the build process (or make it easier to do) to get + smaller binary +- make program work like design says it should (three parts, not 1) +- add hooks to call D-BUS when new node is created or removed +- lots of other stuff... -- cgit v1.2.3-54-g00ecf From 5776bbd73be13c4f595cf5fdc0c27770518de2af Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 16 Jul 2003 20:17:20 -0700 Subject: [PATCH] fix up the test to actually work... --- test | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test b/test index 730f0a446a..40613d48af 100644 --- a/test +++ b/test @@ -1,6 +1,8 @@ #!/bin/sh -#export ACTION=add -export ACTION=remove +export ACTION=add +#export ACTION=remove export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.1/ttyUSB7 +export DEVPATH=/class/tty/ttyUSB0 + ./udev tty -- cgit v1.2.3-54-g00ecf From f0952f66e634c9da1639662079e74e60da4027ef Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 16 Jul 2003 20:17:41 -0700 Subject: [PATCH] pick a better default UDEV_ROOT --- udev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.h b/udev.h index 458d1d9c37..f4f4f11f2d 100644 --- a/udev.h +++ b/udev.h @@ -41,7 +41,7 @@ #define SYSFS_ROOT "/sys" /* Where udev should create its device nodes, trailing / needed */ -#define UDEV_ROOT "/home/greg/linux/udev/" +#define UDEV_ROOT "/udev/" /* device file in sysfs that contains major/minor number, leading / needed */ #define DEV_FILE "/dev" -- cgit v1.2.3-54-g00ecf From af815f882dc196b1357f5be81cb00c8fe9c60670 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 16 Jul 2003 20:18:06 -0700 Subject: [PATCH] sleep for 2 seconds to give the kernel a chance to actually create the files we need. --- udev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/udev.c b/udev.c index 5aa9b43d43..de6b6565f2 100644 --- a/udev.c +++ b/udev.c @@ -262,6 +262,11 @@ int main(int argc, char *argv[]) goto exit; } + /* sleep for a second or two to give the kernel a chance to + * create the dev file + */ + sleep(2); + /* for now, the block layer is the only place where block devices are */ subsystem = argv[1]; if (strcmp(subsystem, "block") == 0) -- cgit v1.2.3-54-g00ecf From 2232cac825e4f8b53273d16154309278cf639e3c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 17 Jul 2003 01:24:51 -0700 Subject: [PATCH] Initial namedev parsing of config files .permission parsing works, .config needs more work. --- Makefile | 3 +- list.h | 444 ++++++++++++++++++++++++++++++++++++++++++++++++++++ namedev.c | 345 ++++++++++++++++++++++++++++++++++++++++ namedev.config | 21 +++ namedev.h | 34 ++++ namedev.permissions | 4 + udev.c | 3 + udev.h | 2 - 8 files changed, 853 insertions(+), 3 deletions(-) create mode 100644 list.h create mode 100644 namedev.c create mode 100644 namedev.config create mode 100644 namedev.h create mode 100644 namedev.permissions diff --git a/Makefile b/Makefile index 4e0ca6b3cf..0013d06793 100644 --- a/Makefile +++ b/Makefile @@ -110,7 +110,8 @@ $(ARCH_LIB_OBJS) : $(MAKE) -C klibc OBJS = udev.o \ - logging.o + logging.o \ + namedev.o # header files automatically generated diff --git a/list.h b/list.h new file mode 100644 index 0000000000..07d474888e --- /dev/null +++ b/list.h @@ -0,0 +1,444 @@ +/* + * Copied from the Linux kernel source tree, version 2.6.0-test1. + * + * Licensed under the GPL v2 as per the whole kernel source tree. + * + * Ripped out the rcu stuff, as it's not needed. + */ + +#ifndef _LINUX_LIST_H +#define _LINUX_LIST_H + +//#include +/** + * container_of - cast a member of a structure out to the containing structure + * + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +//#include +static inline void prefetch(const void *x) {;} + +//#include + +/* + * These are non-NULL pointers that will result in page faults + * under normal circumstances, used to verify that nobody uses + * non-initialized list entries. + */ +#define LIST_POISON1 ((void *) 0x00100100) +#define LIST_POISON2 ((void *) 0x00200200) + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head * prev, struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is + * in an undefined state. + */ +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(struct list_head *head) +{ + return head->next == head; +} + +static inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static inline void list_splice(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next, prefetch(pos->next); pos != (head); \ + pos = pos->next, prefetch(pos->next)) + +/** + * __list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + * + * This variant differs from list_for_each() in that it's the + * simplest possible list iteration code, no prefetching is done. + * Use this for code that knows the list to be very short (empty + * or 1 entry) most of the time. + */ +#define __list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \ + pos = pos->prev, prefetch(pos->prev)) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + prefetch(pos->member.next); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member), \ + prefetch(pos->member.next)) + +/** + * list_for_each_entry_reverse - iterate backwards over list of given type. + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member), \ + prefetch(pos->member.prev); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member), \ + prefetch(pos->member.prev)) + + +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +/* + * Double linked lists with a single pointer list head. + * Mostly useful for hash tables where the two pointer list head is + * too wasteful. + * You lose the ability to access the tail in O(1). + */ + +struct hlist_head { + struct hlist_node *first; +}; + +struct hlist_node { + struct hlist_node *next, **pprev; +}; + +#define HLIST_HEAD_INIT { .first = NULL } +#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } +#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) +#define INIT_HLIST_NODE(ptr) ((ptr)->next = NULL, (ptr)->pprev = NULL) + +static __inline__ int hlist_unhashed(struct hlist_node *h) +{ + return !h->pprev; +} + +static __inline__ int hlist_empty(struct hlist_head *h) +{ + return !h->first; +} + +static __inline__ void __hlist_del(struct hlist_node *n) +{ + struct hlist_node *next = n->next; + struct hlist_node **pprev = n->pprev; + *pprev = next; + if (next) + next->pprev = pprev; +} + +static __inline__ void hlist_del(struct hlist_node *n) +{ + __hlist_del(n); + n->next = LIST_POISON1; + n->pprev = LIST_POISON2; +} + +static __inline__ void hlist_del_init(struct hlist_node *n) +{ + if (n->pprev) { + __hlist_del(n); + INIT_HLIST_NODE(n); + } +} + +static __inline__ void hlist_add_head(struct hlist_node *n, struct hlist_head *h) +{ + struct hlist_node *first = h->first; + n->next = first; + if (first) + first->pprev = &n->next; + h->first = n; + n->pprev = &h->first; +} + +/* next must be != NULL */ +static __inline__ void hlist_add_before(struct hlist_node *n, struct hlist_node *next) +{ + n->pprev = next->pprev; + n->next = next; + next->pprev = &n->next; + *(n->pprev) = n; +} + +static __inline__ void hlist_add_after(struct hlist_node *n, + struct hlist_node *next) +{ + next->next = n->next; + *(next->pprev) = n; + n->next = next; +} + +#define hlist_entry(ptr, type, member) container_of(ptr,type,member) + +/* Cannot easily do prefetch unfortunately */ +#define hlist_for_each(pos, head) \ + for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ + pos = pos->next) + +#define hlist_for_each_safe(pos, n, head) \ + for (pos = (head)->first; n = pos ? pos->next : 0, pos; \ + pos = n) + +/** + * hlist_for_each_entry - iterate over list of given type + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @head: the head for your list. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry(tpos, pos, head, member) \ + for (pos = (head)->first; \ + pos && ({ prefetch(pos->next); 1;}) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_continue(tpos, pos, member) \ + for (pos = (pos)->next; \ + pos && ({ prefetch(pos->next); 1;}) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_from - iterate over a hlist continuing from existing point + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_from(tpos, pos, member) \ + for (; pos && ({ prefetch(pos->next); 1;}) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = pos->next) + +/** + * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @tpos: the type * to use as a loop counter. + * @pos: the &struct hlist_node to use as a loop counter. + * @n: another &struct hlist_node to use as temporary storage + * @head: the head for your list. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ + for (pos = (head)->first; \ + pos && ({ n = pos->next; 1; }) && \ + ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ + pos = n) + +#endif diff --git a/namedev.c b/namedev.c new file mode 100644 index 0000000000..ee122cf075 --- /dev/null +++ b/namedev.c @@ -0,0 +1,345 @@ +/* + * namedev.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "list.h" +#include "udev.h" +#include "udev_version.h" +#include "namedev.h" + +#define TYPE_LABEL "LABEL" +#define TYPE_NUMBER "NUMBER" +#define TYPE_TOPOLOGY "TOPOLOGY" +#define TYPE_REPLACE "REPLACE" + +enum config_type { + KERNEL_NAME = 0, /* must be 0 to let memset() default to this value */ + LABEL = 1, + NUMBER = 2, + TOPOLOGY = 3, + REPLACE = 4, +}; + +#define BUS_SIZE 30 +#define FILE_SIZE 50 +#define VALUE_SIZE 100 +#define ID_SIZE 50 +#define PLACE_SIZE 50 +#define NAME_SIZE 100 +#define OWNER_SIZE 30 +#define GROUP_SIZE 30 + + +struct config_device { + struct list_head node; + + enum config_type type; + + char bus[BUS_SIZE]; + char sysfs_file[FILE_SIZE]; + char sysfs_value[VALUE_SIZE]; + char id[ID_SIZE]; + char place[PLACE_SIZE]; + char kernel_name[NAME_SIZE]; + + /* what to set the device to */ + int mode; + char name[NAME_SIZE]; + char owner[OWNER_SIZE]; + char group[GROUP_SIZE]; +}; + + +static LIST_HEAD(config_device_list); + +#define copy_var(a, b, var) \ + if (b->var) \ + b->var = a->var; + +#define copy_string(a, b, var) \ + if (strlen(b->var)) \ + strcpy(b->var, a->var); + +static int add_dev(struct config_device *new_dev) +{ + struct list_head *tmp; + struct config_device *tmp_dev; + + /* loop through the whole list of devices to see if we already have + * this one... */ + list_for_each(tmp, &config_device_list) { + struct config_device *dev = list_entry(tmp, struct config_device, node); + if (strcmp(dev->name, new_dev->name) == 0) { + /* the same, copy the new info into this structure */ + copy_var(new_dev, dev, type); + copy_var(new_dev, dev, mode); + copy_string(new_dev, dev, bus); + copy_string(new_dev, dev, sysfs_file); + copy_string(new_dev, dev, sysfs_value); + copy_string(new_dev, dev, id); + copy_string(new_dev, dev, place); + copy_string(new_dev, dev, kernel_name); + copy_string(new_dev, dev, owner); + copy_string(new_dev, dev, group); + return 0; + } + } + + /* not found, lets create a new structure, and add it to the list */ + tmp_dev = malloc(sizeof(*tmp_dev)); + if (!tmp_dev) + return -ENOMEM; + memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); + list_add(&tmp_dev->node, &config_device_list); + return 0; +} + +static int get_value(const char *left, char **orig_string, char **ret_string) +{ + char *temp; + char *string = *orig_string; + + /* eat any whitespace */ + while (isspace(*string)) + ++string; + + /* split based on '=' */ + temp = strsep(&string, "="); + if (strcasecmp(temp, left) == 0) { + /* got it, now strip off the '"' */ + while (isspace(*string)) + ++string; + if (*string == '"') + ++string; + temp = strsep(&string, "\""); + *ret_string = temp; + *orig_string = string; + return 0; + } + return -ENODEV; +} + + +static int namedev_init_config(void) +{ + char filename[255]; + char line[255]; + char *temp; + char *temp2; + char *temp3; + FILE *fd; + int retval = 0; + struct config_device dev; + + strcpy(filename, NAMEDEV_CONFIG_ROOT NAMEDEV_CONFIG_FILE); + dbg("opening %s to read as permissions config", filename); + fd = fopen(filename, "r"); + if (fd == NULL) { + dbg("Can't open %s", filename); + return -ENODEV; + } + + /* loop through the whole file */ + while (1) { + /* get a line */ + temp = fgets(line, sizeof(line), fd); + if (temp == NULL) + break; + + dbg("read %s", temp); + + /* eat the whitespace at the beginning of the line */ + while (isspace(*temp)) + ++temp; + + /* no more line? */ + if (*temp == 0x00) + continue; + + /* see if this is a comment */ + if (*temp == COMMENT_CHARACTER) + continue; + + memset(&dev, 0x00, sizeof(dev)); + + /* parse the line */ + temp2 = strsep(&temp, ","); + if (strcasecmp(temp2, TYPE_LABEL) == 0) { + /* label type */ + dev.type = LABEL; + + /* BUS="bus" */ + retval = get_value("BUS", &temp, &temp3); + if (retval) + continue; + strcpy(dev.bus, temp3); + dbg("LABEL name = %s, bus = %s", dev.name, dev.bus); + } + + if (strcasecmp(temp2, TYPE_NUMBER) == 0) { + /* number type */ + dev.type = NUMBER; + + /* BUS="bus" */ + retval = get_value("BUS", &temp, &temp3); + if (retval) + continue; + strcpy(dev.bus, temp3); + dbg("NUMBER name = %s, bus = %s", dev.name, dev.bus); + } + + if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { + /* number type */ + dev.type = TOPOLOGY; + + /* BUS="bus" */ + retval = get_value("BUS", &temp, &temp3); + if (retval) + continue; + strcpy(dev.bus, temp3); + dbg("TOPOLOGY name = %s, bus = %s", dev.name, dev.bus); + } + + if (strcasecmp(temp2, TYPE_REPLACE) == 0) { + /* number type */ + dev.type = REPLACE; + + /* KERNEL="kernel_name" */ + retval = get_value("KERNEL", &temp, &temp3); + if (retval) + continue; + strcpy(dev.kernel_name, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + continue; + strcpy(dev.name, temp3); + dbg("REPLACE name = %s, kernel_name = %s", dev.name, dev.kernel_name); + } + + retval = add_dev(&dev); + if (retval) { + dbg("add_dev returned with error %d", retval); + goto exit; + } + } + +exit: + fclose(fd); + return retval; +} + + +static int namedev_init_permissions(void) +{ + char filename[255]; + char line[255]; + char *temp; + char *temp2; + FILE *fd; + int retval = 0; + struct config_device dev; + + strcpy(filename, NAMEDEV_CONFIG_ROOT NAMEDEV_CONFIG_PERMISSION_FILE); + dbg("opening %s to read as permissions config", filename); + fd = fopen(filename, "r"); + if (fd == NULL) { + dbg("Can't open %s", filename); + return -ENODEV; + } + + /* loop through the whole file */ + while (1) { + /* get a line */ + temp = fgets(line, sizeof(line), fd); + if (temp == NULL) + break; + + dbg("read %s", temp); + + /* eat the whitespace at the beginning of the line */ + while (isspace(*temp)) + ++temp; + + /* no more line? */ + if (*temp == 0x00) + continue; + + /* see if this is a comment */ + if (*temp == COMMENT_CHARACTER) + continue; + + memset(&dev, 0x00, sizeof(dev)); + + /* parse the line */ + temp2 = strsep(&temp, ":"); + strncpy(dev.name, temp2, sizeof(dev.name)); + + temp2 = strsep(&temp, ":"); + strncpy(dev.owner, temp2, sizeof(dev.owner)); + + temp2 = strsep(&temp, ":"); + strncpy(dev.group, temp2, sizeof(dev.owner)); + + dev.mode = strtol(temp, NULL, 8); + + dbg("name = %s, owner = %s, group = %s, mode = %x", dev.name, dev.owner, dev.group, dev.mode); + retval = add_dev(&dev); + if (retval) { + dbg("add_dev returned with error %d", retval); + goto exit; + } + } + +exit: + fclose(fd); + return retval; +} + + + +int namedev_init(void) +{ + int retval; + + retval = namedev_init_config(); + if (retval) + return retval; + + retval = namedev_init_permissions(); + if (retval) + return retval; + + return retval; +} + diff --git a/namedev.config b/namedev.config new file mode 100644 index 0000000000..a26562342c --- /dev/null +++ b/namedev.config @@ -0,0 +1,21 @@ +# USB Epson printer to be called lp_epson +LABEL, BUS="usb", serial="HXOLL0012202323480", NAME="lp_epson" + +# USB HP printer to be called lp_hp +LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_hp" + +# sound card with PCI bus id 00:0b.0 to be the first sound card +NUMBER, BUS="pci", id="00:0b.0", NAME="dsp" + +# sound card with PCI bus id 00:07.1 to be the second sound card +NUMBER, BUS="pci", id="00:07.1", NAME="dsp1" + +# USB mouse plugged into the third port of the first hub to be called mouse0 +TOPOLOGY, BUS="usb", place="1.3", NAME="mouse0" + +# USB tablet plugged into the second port of the second hub to be called mouse1 +TOPOLOGY, BUS="usb", place="2.2", NAME="mouse1" + +# ttyUSB1 should always be called visor +REPLACE, KERNEL="ttyUSB1", NAME="visor" + diff --git a/namedev.h b/namedev.h new file mode 100644 index 0000000000..0089b4d240 --- /dev/null +++ b/namedev.h @@ -0,0 +1,34 @@ +/* + * namedev.h + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * 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 02139, USA. + * + */ + +#ifndef NAMEDEV_H +#define NAMEDEV_H + +/* namedev config files */ +#define COMMENT_CHARACTER '#' +#define NAMEDEV_CONFIG_ROOT "/home/greg/src/udev/" +#define NAMEDEV_CONFIG_PERMISSION_FILE "namedev.permissions" +#define NAMEDEV_CONFIG_FILE "namedev.config" + +extern int namedev_init(void); + +#endif diff --git a/namedev.permissions b/namedev.permissions new file mode 100644 index 0000000000..6148a15e49 --- /dev/null +++ b/namedev.permissions @@ -0,0 +1,4 @@ +#name:user:group:mode +ttyUSB0:root:uucp:0666 +ttyUSB1:root:uucp:0666 + diff --git a/udev.c b/udev.c index de6b6565f2..bf170d1651 100644 --- a/udev.c +++ b/udev.c @@ -30,6 +30,7 @@ #include "udev.h" #include "udev_version.h" +#include "namedev.h" static char *get_action(void) @@ -262,6 +263,8 @@ int main(int argc, char *argv[]) goto exit; } + namedev_init(); + /* sleep for a second or two to give the kernel a chance to * create the dev file */ diff --git a/udev.h b/udev.h index f4f4f11f2d..fb35cad49a 100644 --- a/udev.h +++ b/udev.h @@ -49,8 +49,6 @@ /* Binaries that udev calls to do stuff */ #define MKNOD "/bin/mknod" - - extern int log_message (int level, const char *format, ...); -- cgit v1.2.3-54-g00ecf From fe3004330107036de22c067f7ba49d6770596072 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 17 Jul 2003 01:49:00 -0700 Subject: [PATCH] added klibc makefile --- Makefile.klibc | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 Makefile.klibc diff --git a/Makefile.klibc b/Makefile.klibc new file mode 100644 index 0000000000..d196d6f547 --- /dev/null +++ b/Makefile.klibc @@ -0,0 +1,158 @@ +# Makefile for diethotplug +# +# Copyright (C) 2000,2001 Greg Kroah-Hartman +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +# Set the following to `true' to make a debuggable build. +# Leave this set to `false' for production use. +DEBUG = true + + +ROOT = udev +VERSION = 0.1 +INSTALL_DIR = /usr/local/bin +RELEASE_NAME = $(ROOT)-$(VERSION) + + +# Comment out this line to build with something other +# than the local version of klibc +KLIBC = true + +# If you are running a cross compiler, you may want to set this +# to something more interesting, like "arm-linux-". I you want +# to compile vs uClibc, that can be done here as well. +CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- +CC = $(CROSS)gcc +AR = $(CROSS)ar +STRIP = $(CROSS)strip + + +# code taken from uClibc to determine the current arch +ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ + -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/ppc/powerpc/g'} + +# code taken from uClibc to determine the gcc include dir +GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} + +# code taken from uClibc to determine the libgcc.a filename +GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) + +# use '-Os' optimization if available, else use -O2 +OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ + then echo "-Os"; else echo "-O2" ; fi} + +WARNINGS := -Wall -Wshadow -Wstrict-prototypes + +# Some nice architecture specific optimizations +ifeq ($(strip $(TARGET_ARCH)),arm) + OPTIMIZATION+=-fstrict-aliasing +endif +ifeq ($(strip $(TARGET_ARCH)),i386) + OPTIMIZATION+=-march=i386 + OPTIMIZATION += ${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc \ + /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi} + OPTIMIZATION += ${shell if $(CC) -malign-functions=0 -malign-jumps=0 -S -o /dev/null -xc \ + /dev/null >/dev/null 2>&1; then echo "-malign-functions=0 -malign-jumps=0"; fi} + CFLAGS+=-pipe +else + CFLAGS+=-pipe +endif + +# if DEBUG is enabled, then we do not strip or optimize +ifeq ($(strip $(DEBUG)),true) + CFLAGS += $(WARNINGS) -O1 -g -DDEBUG -D_GNU_SOURCE + LDFLAGS += -Wl,-warn-common + STRIPCMD = /bin/true -Since_we_are_debugging +else + CFLAGS += $(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE + LDFLAGS += -s -Wl,-warn-common + STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment +endif + +# If we are using our version of klibc, then we need to build and link it. +# Otherwise, use glibc and link statically. +ifeq ($(strip $(KLIBC)),true) + KLIBC_DIR = /home/greg/src/klibc/klibc/klibc + INCLUDE_DIR := $(KLIBC_DIR)/include + # arch specific objects + LIBGCC = $(shell $(CC) --print-libgcc) + ARCH_LIB_OBJS = \ + $(KLIBC_DIR)/libc.a \ +# $(KLIBC_DIR)/crt0.o \ +# $(LIBGCC) +# $(KLIBC_DIR)/bin-$(ARCH)/start.o \ +# $(KLIBC_DIR)/bin-$(ARCH)/klibc.a + +# LIB_OBJS = $(GCC_LIB) + + LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) + CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/bits32 -I/home/greg/linux/linux-2.5/include -I$(GCCINCDIR) + LDFLAGS = +# LDFLAGS = --static --nostdlib -nostartfiles +else + LIBC = + CFLAGS += -I$(GCCINCDIR) + LIB_OBJS = -lc + LDFLAGS = --static +endif + +all: $(LIBC) $(ROOT) + +$(ARCH_LIB_OBJS) : + $(MAKE) -C klibc + +OBJS = udev.o \ + logging.o \ + namedev.o + + +# header files automatically generated +GEN_HEADERS = udev_version.h + +# Rules on how to create the generated header files +udev_version.h: + @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ + + +$(ROOT): $(GEN_HEADERS) $(OBJS) +# $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(LD) $(LDFLAGS) -o $(ROOT) $(KLIBC_DIR)/crt0.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $(ROOT) + +clean: + -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ + | xargs rm -f + -rm -f core $(ROOT) $(GEN_HEADERS) + $(MAKE) -C klibc clean + +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS ) +DISTDIR := $(RELEASE_NAME) +srcdir = . +release: $(DISTFILES) clean +# @echo $(DISTFILES) + @-rm -rf $(DISTDIR) + @mkdir $(DISTDIR) + @-chmod 777 $(DISTDIR) + @for file in $(DISTFILES); do \ + if test -d $$file; then \ + mkdir $(DISTDIR)/$$file; \ + else \ + cp -p $$file $(DISTDIR)/$$file; \ + fi; \ + done + @tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz + @rm -rf $(DISTDIR) + @echo "Built $(RELEASE_NAME).tar.gz" -- cgit v1.2.3-54-g00ecf From 032abea6fb9f0203dc22d46a1f48326b7da8182c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 18 Jul 2003 07:45:35 -0700 Subject: [PATCH] make log_message spit out warnings so I don't have --- udev.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev.h b/udev.h index fb35cad49a..af1b6bbb8d 100644 --- a/udev.h +++ b/udev.h @@ -49,7 +49,8 @@ /* Binaries that udev calls to do stuff */ #define MKNOD "/bin/mknod" -extern int log_message (int level, const char *format, ...); +extern int log_message (int level, const char *format, ...) + __attribute__ ((format (printf, 2, 3))); #endif -- cgit v1.2.3-54-g00ecf From 3cc78d26379acfbfc68d178b9ee58e9f7e75a725 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 18 Jul 2003 07:45:48 -0700 Subject: [PATCH] more permission tests --- namedev.permissions | 2 ++ 1 file changed, 2 insertions(+) diff --git a/namedev.permissions b/namedev.permissions index 6148a15e49..7f87fc9b0e 100644 --- a/namedev.permissions +++ b/namedev.permissions @@ -1,4 +1,6 @@ #name:user:group:mode ttyUSB0:root:uucp:0666 ttyUSB1:root:uucp:0666 +visor:root:uucp:0666 +dsp1:::0666 -- cgit v1.2.3-54-g00ecf From 469c7cff3b1432aa7a8786c08ee9a64caec2ba27 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 18 Jul 2003 07:46:17 -0700 Subject: [PATCH] namedev config files are fully parsed. now to do something with the data... --- namedev.c | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 136 insertions(+), 16 deletions(-) diff --git a/namedev.c b/namedev.c index ee122cf075..0271ba55a2 100644 --- a/namedev.c +++ b/namedev.c @@ -80,13 +80,51 @@ struct config_device { static LIST_HEAD(config_device_list); +static void dump_dev(struct config_device *dev) +{ + switch (dev->type) { + case KERNEL_NAME: + dbg("KERNEL name ='%s'" + " owner = '%s', group = '%s', mode = '%d'", + dev->name, + dev->owner, dev->group, dev->mode); + break; + case LABEL: + dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" + " owner = '%s', group = '%s', mode = '%d'", + dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value, + dev->owner, dev->group, dev->mode); + break; + case NUMBER: + dbg("NUMBER name = '%s', bus = '%s', id = '%s'" + " owner = '%s', group = '%s', mode = '%d'", + dev->name, dev->bus, dev->id, + dev->owner, dev->group, dev->mode); + break; + case TOPOLOGY: + dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'" + " owner = '%s', group = '%s', mode = '%d'", + dev->name, dev->bus, dev->place, + dev->owner, dev->group, dev->mode); + break; + case REPLACE: + dbg("REPLACE name = %s, kernel_name = %s" + " owner = '%s', group = '%s', mode = '%d'", + dev->name, dev->kernel_name, + dev->owner, dev->group, dev->mode); + break; + default: + dbg("Unknown type of device!"); + } +} + #define copy_var(a, b, var) \ if (b->var) \ - b->var = a->var; + a->var = b->var; #define copy_string(a, b, var) \ if (strlen(b->var)) \ - strcpy(b->var, a->var); + strcpy(a->var, b->var); static int add_dev(struct config_device *new_dev) { @@ -99,16 +137,16 @@ static int add_dev(struct config_device *new_dev) struct config_device *dev = list_entry(tmp, struct config_device, node); if (strcmp(dev->name, new_dev->name) == 0) { /* the same, copy the new info into this structure */ - copy_var(new_dev, dev, type); - copy_var(new_dev, dev, mode); - copy_string(new_dev, dev, bus); - copy_string(new_dev, dev, sysfs_file); - copy_string(new_dev, dev, sysfs_value); - copy_string(new_dev, dev, id); - copy_string(new_dev, dev, place); - copy_string(new_dev, dev, kernel_name); - copy_string(new_dev, dev, owner); - copy_string(new_dev, dev, group); + copy_var(dev, new_dev, type); + copy_var(dev, new_dev, mode); + copy_string(dev, new_dev, bus); + copy_string(dev, new_dev, sysfs_file); + copy_string(dev, new_dev, sysfs_value); + copy_string(dev, new_dev, id); + copy_string(dev, new_dev, place); + copy_string(dev, new_dev, kernel_name); + copy_string(dev, new_dev, owner); + copy_string(dev, new_dev, group); return 0; } } @@ -119,9 +157,20 @@ static int add_dev(struct config_device *new_dev) return -ENOMEM; memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); list_add(&tmp_dev->node, &config_device_list); + //dump_dev(tmp_dev); return 0; } +static void dump_dev_list(void) +{ + struct list_head *tmp; + + list_for_each(tmp, &config_device_list) { + struct config_device *dev = list_entry(tmp, struct config_device, node); + dump_dev(dev); + } +} + static int get_value(const char *left, char **orig_string, char **ret_string) { char *temp; @@ -147,6 +196,30 @@ static int get_value(const char *left, char **orig_string, char **ret_string) return -ENODEV; } +static int get_pair(char **orig_string, char **left, char **right) +{ + char *temp; + char *string = *orig_string; + + /* eat any whitespace */ + while (isspace(*string)) + ++string; + + /* split based on '=' */ + temp = strsep(&string, "="); + *left = temp; + + /* take the right side and strip off the '"' */ + while (isspace(*string)) + ++string; + if (*string == '"') + ++string; + temp = strsep(&string, "\""); + *right = temp; + *orig_string = string; + + return 0; +} static int namedev_init_config(void) { @@ -188,7 +261,7 @@ static int namedev_init_config(void) if (*temp == COMMENT_CHARACTER) continue; - memset(&dev, 0x00, sizeof(dev)); + memset(&dev, 0x00, sizeof(struct config_device)); /* parse the line */ temp2 = strsep(&temp, ","); @@ -201,7 +274,23 @@ static int namedev_init_config(void) if (retval) continue; strcpy(dev.bus, temp3); - dbg("LABEL name = %s, bus = %s", dev.name, dev.bus); + + /* file="value" */ + temp2 = strsep(&temp, ","); + retval = get_pair(&temp, &temp2, &temp3); + if (retval) + continue; + strcpy(dev.sysfs_file, temp2); + strcpy(dev.sysfs_value, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + continue; + strcpy(dev.name, temp3); + + dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'", dev.name, dev.bus, dev.sysfs_file, dev.sysfs_value); } if (strcasecmp(temp2, TYPE_NUMBER) == 0) { @@ -213,7 +302,22 @@ static int namedev_init_config(void) if (retval) continue; strcpy(dev.bus, temp3); - dbg("NUMBER name = %s, bus = %s", dev.name, dev.bus); + + /* ID="id" */ + temp2 = strsep(&temp, ","); + retval = get_value("id", &temp, &temp3); + if (retval) + continue; + strcpy(dev.id, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + continue; + strcpy(dev.name, temp3); + + dbg("NUMBER name = '%s', bus = '%s', id = '%s'", dev.name, dev.bus, dev.id); } if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { @@ -225,7 +329,22 @@ static int namedev_init_config(void) if (retval) continue; strcpy(dev.bus, temp3); - dbg("TOPOLOGY name = %s, bus = %s", dev.name, dev.bus); + + /* PLACE="place" */ + temp2 = strsep(&temp, ","); + retval = get_value("place", &temp, &temp3); + if (retval) + continue; + strcpy(dev.place, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + continue; + strcpy(dev.name, temp3); + + dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'", dev.name, dev.bus, dev.place); } if (strcasecmp(temp2, TYPE_REPLACE) == 0) { @@ -340,6 +459,7 @@ int namedev_init(void) if (retval) return retval; + dump_dev_list(); return retval; } -- cgit v1.2.3-54-g00ecf From 070f54223f66490e9d25719c495e074f77da8985 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 18 Jul 2003 20:08:00 -0700 Subject: [PATCH] added libsysfs code from sysutils-0.1.1-071803 release --- libsysfs/LGPL | 441 ++++++++++++++++++++++++++++++++++++++++++ libsysfs/Makefile | 44 +++++ libsysfs/libsysfs.h | 162 ++++++++++++++++ libsysfs/sysfs.h | 49 +++++ libsysfs/sysfs_bus.c | 301 +++++++++++++++++++++++++++++ libsysfs/sysfs_class.c | 273 ++++++++++++++++++++++++++ libsysfs/sysfs_device.c | 199 +++++++++++++++++++ libsysfs/sysfs_dir.c | 496 ++++++++++++++++++++++++++++++++++++++++++++++++ libsysfs/sysfs_driver.c | 89 +++++++++ libsysfs/sysfs_utils.c | 156 +++++++++++++++ 10 files changed, 2210 insertions(+) create mode 100644 libsysfs/LGPL create mode 100644 libsysfs/Makefile create mode 100644 libsysfs/libsysfs.h create mode 100644 libsysfs/sysfs.h create mode 100644 libsysfs/sysfs_bus.c create mode 100644 libsysfs/sysfs_class.c create mode 100644 libsysfs/sysfs_device.c create mode 100644 libsysfs/sysfs_dir.c create mode 100644 libsysfs/sysfs_driver.c create mode 100644 libsysfs/sysfs_utils.c diff --git a/libsysfs/LGPL b/libsysfs/LGPL new file mode 100644 index 0000000000..e00a829bb6 --- /dev/null +++ b/libsysfs/LGPL @@ -0,0 +1,441 @@ + + GNU Lesser Public License + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + [This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your freedom to + share and change it. By contrast, the GNU General Public Licenses are + intended to guarantee your freedom to share and change free software--to + make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some specially + designated software packages--typically libraries--of the Free Software + Foundation and other authors who decide to use it. You can use it too, but + we suggest you first think carefully about whether this license or the + ordinary General Public License is the better strategy to use in any + particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, not + price. Our General Public Licenses are designed to make sure that you have + the freedom to distribute copies of free software (and charge for this + service if you wish); that you receive source code or can get it if you + want it; that you can change the software and use pieces of it in new free + programs; and that you are informed that you can do these things. + + To protect your rights, we need to make restrictions that forbid + distributors to deny you these rights or to ask you to surrender these + rights. These restrictions translate to certain responsibilities for you + if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis or + for a fee, you must give the recipients all the rights that we gave you. + You must make sure that they, too, receive or can get the source code. If + you link other code with the library, you must provide complete object + files to the recipients, so that they can relink them with the library + after making changes to the library and recompiling it. And you must show + them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the + library, and (2) we offer you this license, which gives you legal + permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that there is + no warranty for the free library. Also, if the library is modified by + someone else and passed on, the recipients should know that what they have + is not the original version, so that the original author's reputation will + not be affected by problems that might be introduced by others. + + Finally, software patents pose a constant threat to the existence of any + free program. We wish to make sure that a company cannot effectively + restrict the users of a free program by obtaining a restrictive license + from a patent holder. Therefore, we insist that any patent license + obtained for a version of the library must be consistent with the full + freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the ordinary + GNU General Public License. This license, the GNU Lesser General Public + License, applies to certain designated libraries, and is quite different + from the ordinary General Public License. We use this license for certain + libraries in order to permit linking those libraries into non-free + programs. + + When a program is linked with a library, whether statically or using a + shared library, the combination of the two is legally speaking a combined + work, a derivative of the original library. The ordinary General Public + License therefore permits such linking only if the entire combination fits + its criteria of freedom. The Lesser General Public License permits more + lax criteria for linking other code with the library. + + We call this license the "Lesser" General Public License because it does + Less to protect the user's freedom than the ordinary General Public + License. It also provides other free software developers Less of an + advantage over competing non-free programs. These disadvantages are the + reason we use the ordinary General Public License for many libraries. + However, the Lesser license provides advantages in certain special + circumstances. + + For example, on rare occasions, there may be a special need to encourage + the widest possible use of a certain library, so that it becomes a + de-facto standard. To achieve this, non-free programs must be allowed to + use the library. A more frequent case is that a free library does the same + job as widely used non-free libraries. In this case, there is little to + gain by limiting the free library to free software only, so we use the + Lesser General Public License. + + In other cases, permission to use a particular library in non-free + programs enables a greater number of people to use a large body of free + software. For example, permission to use the GNU C Library in non-free + programs enables many more people to use the whole GNU operating system, + as well as its variant, the GNU/Linux operating system. + + Although the Lesser General Public License is Less protective of the + users' freedom, it does ensure that the user of a program that is linked + with the Library has the freedom and the wherewithal to run that program + using a modified version of the Library. + + The precise terms and conditions for copying, distribution and + modification follow. Pay close attention to the difference between a "work + based on the library" and a "work that uses the library". The former + contains code derived from the library, whereas the latter must be + combined with the library in order to run. + + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other program + which contains a notice placed by the copyright holder or other authorized + party saying it may be distributed under the terms of this Lesser General + Public License (also called "this License"). Each licensee is addressed as + "you". + + A "library" means a collection of software functions and/or data prepared + so as to be conveniently linked with application programs (which use some + of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work which + has been distributed under these terms. A "work based on the Library" + means either the Library or any derivative work under copyright law: that + is to say, a work containing the Library or a portion of it, either + verbatim or with modifications and/or translated straightforwardly into + another language. (Hereinafter, translation is included without limitation + in the term "modification".) + + "Source code" for a work means the preferred form of the work for making + modifications to it. For a library, complete source code means all the + source code for all modules it contains, plus any associated interface + definition files, plus the scripts used to control compilation and + installation of the library. + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of running a + program using the Library is not restricted, and output from such a + program is covered only if its contents constitute a work based on the + Library (independent of the use of the Library in a tool for writing it). + Whether that is true depends on what the Library does and what the program + that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's complete + source code as you receive it, in any medium, provided that you + conspicuously and appropriately publish on each copy an appropriate + copyright notice and disclaimer of warranty; keep intact all the notices + that refer to this License and to the absence of any warranty; and + distribute a copy of this License along with the Library. + + You may charge a fee for the physical act of transferring a copy, and you + may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Library or any portion of it, + thus forming a work based on the Library, and copy and distribute such + modifications or work under the terms of Section 1 above, provided that + you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices stating + that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no charge to + all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a table + of data to be supplied by an application program that uses the facility, + other than as an argument passed when the facility is invoked, then you + must make a good faith effort to ensure that, in the event an + application does not supply such function or table, the facility still + operates, and performs whatever part of its purpose remains meaningful. + + (For example, a function in a library to compute square roots has a + purpose that is entirely well-defined independent of the application. + Therefore, Subsection 2d requires that any application-supplied function + or table used by this function must be optional: if the application does + not supply it, the square root function must still compute square + roots.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Library, and + can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based on + the Library, the distribution of the whole must be on the terms of this + License, whose permissions for other licensees extend to the entire + whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Library. + + In addition, mere aggregation of another work not based on the Library + with the Library (or with a work based on the Library) on a volume of a + storage or distribution medium does not bring the other work under the + scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public + License instead of this License to a given copy of the Library. To do + this, you must alter all the notices that refer to this License, so that + they refer to the ordinary GNU General Public License, version 2, instead + of to this License. (If a newer version than version 2 of the ordinary GNU + General Public License has appeared, then you can specify that version + instead if you wish.) Do not make any other change in these notices. + + Once this change is made in a given copy, it is irreversible for that + copy, so the ordinary GNU General Public License applies to all subsequent + copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of the + Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or derivative of + it, under Section 2) in object code or executable form under the terms of + Sections 1 and 2 above provided that you accompany it with the complete + corresponding machine-readable source code, which must be distributed + under the terms of Sections 1 and 2 above on a medium customarily used for + software interchange. + + If distribution of object code is made by offering access to copy from a + designated place, then offering equivalent access to copy the source code + from the same place satisfies the requirement to distribute the source + code, even though third parties are not compelled to copy the source along + with the object code. + + 5. A program that contains no derivative of any portion of the Library, + but is designed to work with the Library by being compiled or linked with + it, is called a "work that uses the Library". Such a work, in isolation, + is not a derivative work of the Library, and therefore falls outside the + scope of this License. + + However, linking a "work that uses the Library" with the Library creates + an executable that is a derivative of the Library (because it contains + portions of the Library), rather than a "work that uses the library". The + executable is therefore covered by this License. Section 6 states terms + for distribution of such executables. + + When a "work that uses the Library" uses material from a header file that + is part of the Library, the object code for the work may be a derivative + work of the Library even though the source code is not. Whether this is + true is especially significant if the work can be linked without the + Library, or if the work is itself a library. The threshold for this to be + true is not precisely defined by law. + + If such an object file uses only numerical parameters, data structure + layouts and accessors, and small macros and small inline functions (ten + lines or less in length), then the use of the object file is unrestricted, + regardless of whether it is legally a derivative work. (Executables + containing this object code plus portions of the Library will still fall + under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may distribute + the object code for the work under the terms of Section 6. Any executables + containing that work also fall under Section 6, whether or not they are + linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or link a + "work that uses the Library" with the Library to produce a work containing + portions of the Library, and distribute that work under terms of your + choice, provided that the terms permit modification of the work for the + customer's own use and reverse engineering for debugging such + modifications. + + You must give prominent notice with each copy of the work that the Library + is used in it and that the Library and its use are covered by this + License. You must supply a copy of this License. If the work during + execution displays copyright notices, you must include the copyright + notice for the Library among them, as well as a reference directing the + user to the copy of this License. Also, you must do one of these things: + + a) Accompany the work with the complete corresponding machine-readable + source code for the Library including whatever changes were used in the + work (which must be distributed under Sections 1 and 2 above); and, if + the work is an executable linked with the Library, with the complete + machine-readable "work that uses the Library", as object code and/or + source code, so that the user can modify the Library and then relink to + produce a modified executable containing the modified Library. (It is + understood that the user who changes the contents of definitions files + in the Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the Library. + A suitable mechanism is one that (1) uses at run time a copy of the + library already present on the user's computer system, rather than + copying library functions into the executable, and (2) will operate + properly with a modified version of the library, if the user installs + one, as long as the modified version is interface-compatible with the + version that the work was made with. + + c) Accompany the work with a written offer, valid for at least three + years, to give the same user the materials specified in Subsection 6a, + above, for a charge no more than the cost of performing this + distribution. + + d) If distribution of the work is made by offering access to copy from a + designated place, offer equivalent access to copy the above specified + materials from the same place. + + e) Verify that the user has already received a copy of these materials + or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the Library" + must include any data and utility programs needed for reproducing the + executable from it. However, as a special exception, the materials to be + distributed need not include anything that is normally distributed (in + either source or binary form) with the major components (compiler, kernel, + and so on) of the operating system on which the executable runs, unless + that component itself accompanies the executable. + + It may happen that this requirement contradicts the license restrictions + of other proprietary libraries that do not normally accompany the + operating system. Such a contradiction means you cannot use both them and + the Library together in an executable that you distribute. + + 7. You may place library facilities that are a work based on the Library + side-by-side in a single library together with other library facilities + not covered by this License, and distribute such a combined library, + provided that the separate distribution of the work based on the Library + and of the other library facilities is otherwise permitted, and provided + that you do these two things: + + a) Accompany the combined library with a copy of the same work based on + the Library, uncombined with any other library facilities. This must be + distributed under the terms of the Sections above. + + b) Give prominent notice with the combined library of the fact that part + of it is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute the + Library except as expressly provided under this License. Any attempt + otherwise to copy, modify, sublicense, link with, or distribute the + Library is void, and will automatically terminate your rights under this + License. However, parties who have received copies, or rights, from you + under this License will not have their licenses terminated so long as such + parties remain in full compliance. + + 9. You are not required to accept this License, since you have not signed + it. However, nothing else grants you permission to modify or distribute + the Library or its derivative works. These actions are prohibited by law + if you do not accept this License. Therefore, by modifying or distributing + the Library (or any work based on the Library), you indicate your + acceptance of this License to do so, and all its terms and conditions for + copying, distributing or modifying the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the + Library), the recipient automatically receives a license from the original + licensor to copy, distribute, link with or modify the Library subject to + these terms and conditions. You may not impose any further restrictions on + the recipients' exercise of the rights granted herein. You are not + responsible for enforcing compliance by third parties with this License. + + 11. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot distribute + so as to satisfy simultaneously your obligations under this License and + any other pertinent obligations, then as a consequence you may not + distribute the Library at all. For example, if a patent license would not + permit royalty-free redistribution of the Library by all those who receive + copies directly or indirectly through you, then the only way you could + satisfy both it and this License would be to refrain entirely from + distribution of the Library. + + If any portion of this section is held invalid or unenforceable under any + particular circumstance, the balance of the section is intended to apply, + and the section as a whole is intended to apply in other circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any such + claims; this section has the sole purpose of protecting the integrity of + the free software distribution system which is implemented by public + license practices. Many people have made generous contributions to the + wide range of software distributed through that system in reliance on + consistent application of that system; it is up to the author/donor to + decide if he or she is willing to distribute software through any other + system and a licensee cannot impose that choice. + + This section is intended to make thoroughly clear what is believed to be a + consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in certain + countries either by patents or by copyrighted interfaces, the original + copyright holder who places the Library under this License may add an + explicit geographical distribution limitation excluding those countries, + so that distribution is permitted only in or among countries not thus + excluded. In such case, this License incorporates the limitation as if + written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new versions + of the Lesser General Public License from time to time. Such new versions + will be similar in spirit to the present version, but may differ in detail + to address new problems or concerns. + + Each version is given a distinguishing version number. If the Library + specifies a version number of this License which applies to it and "any + later version", you have the option of following the terms and conditions + either of that version or of any later version published by the Free + Software Foundation. If the Library does not specify a license version + number, you may choose any version ever published by the Free Software + Foundation. + + 14. If you wish to incorporate parts of the Library into other free + programs whose distribution conditions are incompatible with these, write + to the author to ask for permission. For software which is copyrighted by + the Free Software Foundation, write to the Free Software Foundation; we + sometimes make exceptions for this. Our decision will be guided by the two + goals of preserving the free status of all derivatives of our free + software and of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY + FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN + OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES + PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED + OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS + TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE + LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, + REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING + WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR + REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, + INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES + ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT + LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES + SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE + WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + diff --git a/libsysfs/Makefile b/libsysfs/Makefile new file mode 100644 index 0000000000..cf07a842b6 --- /dev/null +++ b/libsysfs/Makefile @@ -0,0 +1,44 @@ +# Makefile for libsysfs.a +# Copyright (c) International Business Machines Corp., 2003 + +CC=gcc + +H_INCLUDE=../include +LIB_INCLUDE=. +OBJS=sysfs_bus.o sysfs_class.o sysfs_device.o sysfs_dir.o sysfs_driver.o \ + sysfs_utils.o + +# Install directory + +# Options +CFLAGS=-O2 -Wall -ansi -g + +# sysfs library +LIBSYSFS=libsysfs.a + +RM=rm -f + +libsysfs.a: $(OBJS) + ar cru $(LIBSYSFS) $(OBJS) + ranlib $(LIBSYSFS) + +sysfs_bus.o: sysfs_bus.c + $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_bus.c + +sysfs_class.o: sysfs_class.c + $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_class.c + +sysfs_device.o: sysfs_device.c + $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_device.c + +sysfs_dir.o: sysfs_dir.c + $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_dir.c + +sysfs_driver.o: sysfs_driver.c + $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_driver.c + +sysfs_utils.o: sysfs_utils.c + $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_utils.c + +clean: + $(RM) *.o *~ core $(LIBSYSFS) diff --git a/libsysfs/libsysfs.h b/libsysfs/libsysfs.h new file mode 100644 index 0000000000..01143954e7 --- /dev/null +++ b/libsysfs/libsysfs.h @@ -0,0 +1,162 @@ +/* + * libsysfs.h + * + * Header Definitions for libsysfs + * + * Copyright (C) 2003 International Business Machines, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef _LIBSYSFS_H_ +#define _LIBSYSFS_H_ + +#include + +/* + * Generic #defines go here.. + */ +#define SYSFS_FSTYPE_NAME "sysfs" +#define SYSFS_PROC_MNTS "/proc/mounts" +#define SYSFS_BUS_DIR "/bus" +#define SYSFS_CLASS_DIR "/class" +#define SYSFS_DEVICES_DIR "/devices" +#define SYSFS_DEVICES_NAME "devices" +#define SYSFS_DRIVERS_DIR "/drivers" +#define SYSFS_DRIVERS_NAME "drivers" +#define SYSFS_NAME_ATTRIBUTE "name" + +#define SYSFS_PATH_MAX 255 +#define SYSFS_NAME_LEN 50 +#define SYSFS_BUS_ID_SIZE 20 + +#define SYSFS_METHOD_SHOW 0x01 /* attr can be read by user */ +#define SYSFS_METHOD_STORE 0x02 /* attr can be changed by user */ + +struct sysfs_attribute { + struct sysfs_attribute *next; + char path[SYSFS_PATH_MAX]; + char *value; + unsigned short len; /* value length */ + unsigned short method; /* show and store */ +}; + +struct sysfs_dlink { + struct sysfs_dlink *next; + char name[SYSFS_NAME_LEN]; + struct sysfs_directory *target; +}; + +struct sysfs_directory { + struct sysfs_directory *next; + char path[SYSFS_PATH_MAX]; + struct sysfs_directory *subdirs; + struct sysfs_dlink *links; + struct sysfs_attribute *attributes; +}; + +struct sysfs_driver { + struct sysfs_driver *next; + char name[SYSFS_NAME_LEN]; + struct sysfs_directory *directory; + struct sysfs_device *device; +}; + +struct sysfs_device { + struct sysfs_device *next; + char name[SYSFS_NAME_LEN]; + char bus_id[SYSFS_NAME_LEN]; + struct sysfs_driver *driver; + struct sysfs_directory *directory; + struct sysfs_device *parent; + struct sysfs_device *children; +}; + +struct sysfs_bus { + struct sysfs_bus *next; + char name[SYSFS_NAME_LEN]; + struct sysfs_directory *directory; + struct sysfs_driver *drivers; + struct sysfs_device *devices; +}; + +struct sysfs_class_device { + struct sysfs_class_device *next; + char name[SYSFS_NAME_LEN]; + struct sysfs_directory *directory; + struct sysfs_device *sysdevice; /* NULL if virtual */ + struct sysfs_driver *driver; /* NULL if not implemented */ +}; + +struct sysfs_class { + struct sysfs_class *next; + char name[SYSFS_NAME_LEN]; + struct sysfs_directory *directory; + struct sysfs_class_device *devices; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Function Prototypes + */ +extern int sysfs_get_mnt_path(char *mnt_path, size_t len); +extern int sysfs_get_name_from_path(const char *path, char *name, size_t len); +extern int sysfs_get_link(const char *path, char *target, size_t len); + +/* sysfs directory and file access */ +extern void sysfs_close_attribute(struct sysfs_attribute *sysattr); +extern struct sysfs_attribute *sysfs_open_attribute(const char *path); +extern int sysfs_read_attribute(struct sysfs_attribute *sysattr); +extern int sysfs_read_attribute_value(const char *attrpath, char *value, + size_t vsize); +extern char *sysfs_get_value_from_attributes(struct sysfs_attribute *attr, + const char * name); +extern void sysfs_close_directory(struct sysfs_directory *sysdir); +extern struct sysfs_directory *sysfs_open_directory(const char *path); +extern int sysfs_read_directory(struct sysfs_directory *sysdir); +extern void sysfs_close_dlink(struct sysfs_dlink *dlink); +extern struct sysfs_dlink *sysfs_open_dlink(const char *linkpath); +extern int sysfs_read_dlinks(struct sysfs_dlink *dlink); + +/* sysfs driver access */ +extern void sysfs_close_driver(struct sysfs_driver *driver); +extern struct sysfs_driver *sysfs_open_driver(const char *path); + +/* generic sysfs device access */ +extern void sysfs_close_device(struct sysfs_device *dev); +extern void sysfs_close_device_tree(struct sysfs_device *dev); +extern struct sysfs_device *sysfs_open_device(const char *path); +extern struct sysfs_device *sysfs_open_device_tree(const char *path); +extern struct sysfs_attribute *sysfs_get_device_attr + (struct sysfs_device *dev, const char *name); + +/* generic sysfs bus access */ +extern void sysfs_close_bus(struct sysfs_bus *bus); +extern struct sysfs_bus *sysfs_open_bus(const char *name); + +/* generic sysfs class access */ +extern void sysfs_close_class_device(struct sysfs_class_device *dev); +extern struct sysfs_class_device *sysfs_open_class_device(const char *path); +extern void sysfs_close_class(struct sysfs_class *cls); +extern struct sysfs_class *sysfs_open_class(const char *name); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBSYSFS_H_ */ diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h new file mode 100644 index 0000000000..eb2a002958 --- /dev/null +++ b/libsysfs/sysfs.h @@ -0,0 +1,49 @@ +/* + * sysfs.h + * + * Internal Header Definitions for libsysfs + * + * Copyright (C) 2003 International Business Machines, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef _SYSFS_H_ +#define _SYSFS_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* external library functions */ +extern int lstat(const char *file_name, struct stat *buf); +extern int readlink(const char *path, char *buf, size_t bufsize); +extern int getpagesize(void); +extern int isascii(int c); + +/* Debugging */ +#ifdef DEBUG +#define dprintf(format, arg...) fprintf(stderr, format, ## arg) +#else +#define dprintf(format, arg...) do { } while (0) +#endif + +#endif /* _SYSFS_H_ */ diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c new file mode 100644 index 0000000000..b2e2b2dd71 --- /dev/null +++ b/libsysfs/sysfs_bus.c @@ -0,0 +1,301 @@ +/* + * sysfs_bus.c + * + * Generic bus utility functions for libsysfs + * + * Copyright (C) 2003 International Business Machines, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#include "libsysfs.h" +#include "sysfs.h" + +/** + * sysfs_close_bus: close single bus + * @bus: bus structure + */ +void sysfs_close_bus(struct sysfs_bus *bus) +{ + struct sysfs_device *curdev = NULL, *nextdev = NULL; + struct sysfs_driver *curdrv = NULL, *nextdrv = NULL; + + if (bus != NULL) { + if (bus->directory != NULL) + sysfs_close_directory(bus->directory); + for (curdev = bus->devices; curdev != NULL; + curdev = nextdev) { + nextdev = curdev->next; + sysfs_close_device(curdev); + } + for (curdrv = bus->drivers; curdrv != NULL; + curdrv = nextdrv) { + nextdrv = curdrv->next; + sysfs_close_driver(curdrv); + } + free(bus); + } +} + +/** + * alloc_bus: mallocs new bus structure + * returns sysfs_bus_bus struct or NULL + */ +static struct sysfs_bus *alloc_bus(void) +{ + return (struct sysfs_bus *)calloc(1, sizeof(struct sysfs_bus)); +} + +/** + * open_bus_dir: opens up sysfs bus directory + * returns sysfs_directory struct with success and NULL with error + */ +static struct sysfs_directory *open_bus_dir(const char *name) +{ + struct sysfs_directory *busdir = NULL, *cur = NULL, *next = NULL; + char buspath[SYSFS_PATH_MAX]; + + if (name == NULL) { + errno = EINVAL; + return NULL; + } + + memset(buspath, 0, SYSFS_PATH_MAX); + if ((sysfs_get_mnt_path(buspath, SYSFS_PATH_MAX)) != 0) { + dprintf(stderr, "Sysfs not supported on this system\n"); + return NULL; + } + + strcat(buspath, SYSFS_BUS_DIR); + strcat(buspath, "/"); + strcat(buspath, name); + busdir = sysfs_open_directory(buspath); + if (busdir == NULL) { + errno = EINVAL; + dprintf(stderr,"Bus %s not supported on this system\n", + name); + return NULL; + } + if ((sysfs_read_directory(busdir)) != 0) { + dprintf(stderr, "Error reading %s bus dir %s\n", name, + buspath); + sysfs_close_directory(busdir); + return NULL; + } + /* read in devices and drivers subdirs */ + for (cur = busdir->subdirs; cur != NULL; cur = next) { + next = cur->next; + if ((sysfs_read_directory(cur)) != 0) + continue; + } + + return busdir; +} + +/** + * add_dev_to_bus: adds a bus device to bus device list + * @bus: bus to add the device + * @dev: device to add + */ +static void add_dev_to_bus(struct sysfs_bus *bus, struct sysfs_device *dev) +{ + if (bus != NULL && dev != NULL) { + dev->next = bus->devices; + bus->devices = dev; + } +} + +/** + * add_driver_to_bus: adds a bus driver to bus driver list + * @bus: bus to add driver to + * @driver: driver to add + */ +static void add_driver_to_bus(struct sysfs_bus *bus, + struct sysfs_driver *driver) +{ + if (bus != NULL && driver != NULL) { + driver->next = bus->drivers; + bus->drivers = driver; + } +} + +/** + * get_all_bus_devices: gets all devices for bus + * @bus: bus to get devices for + * returns 0 with success and -1 with failure + */ +static int get_all_bus_devices(struct sysfs_bus *bus) +{ + struct sysfs_device *bdev = NULL; + struct sysfs_directory *cur = NULL; + struct sysfs_dlink *curl = NULL, *nextl = NULL; + char dirname[SYSFS_NAME_LEN]; + + if (bus == NULL || bus->directory == NULL) { + errno = EINVAL; + return -1; + } + for (cur = bus->directory->subdirs; cur != NULL; cur = cur->next) { + memset(dirname, 0, SYSFS_NAME_LEN); + if ((sysfs_get_name_from_path(cur->path, dirname, + SYSFS_NAME_LEN)) != 0) + continue; + if (strcmp(dirname, SYSFS_DEVICES_NAME) != 0) + continue; + for (curl = cur->links; curl != NULL; curl = nextl) { + nextl = curl->next; + bdev = sysfs_open_device(curl->target->path); + if (bdev == NULL) { + dprintf(stderr, "Error opening device at %s\n", + curl->target->path); + continue; + } + add_dev_to_bus(bus, bdev); + } + } + + return 0; +} + +/** + * get_all_bus_drivers: get all pci drivers + * @bus: pci bus to add drivers to + * returns 0 with success and -1 with error + */ +static int get_all_bus_drivers(struct sysfs_bus *bus) +{ + struct sysfs_driver *driver = NULL; + struct sysfs_directory *cur = NULL, *next = NULL; + struct sysfs_directory *cursub = NULL, *nextsub = NULL; + char dirname[SYSFS_NAME_LEN]; + + if (bus == NULL || bus->directory == NULL) { + errno = EINVAL; + return -1; + } + for (cur = bus->directory->subdirs; cur != NULL; cur = next) { + next = cur->next; + memset(dirname, 0, SYSFS_NAME_LEN); + if ((sysfs_get_name_from_path(cur->path, dirname, + SYSFS_NAME_LEN)) != 0) + continue; + if (strcmp(dirname, SYSFS_DRIVERS_NAME) != 0) + continue; + for (cursub = cur->subdirs; cursub != NULL; cursub = nextsub) { + nextsub = cursub->next; + driver = sysfs_open_driver(cursub->path); + if (driver == NULL) { + dprintf(stderr, "Error opening driver at %s\n", + cursub->path); + continue; + } + add_driver_to_bus(bus, driver); + } + } + + return 0; +} + +/** + * match_bus_device_to_driver: returns 1 if device is bound to driver + * @driver: driver to match + * @busid: busid of device to match + * returns 1 if found and 0 if not found + */ +static int match_bus_device_to_driver(struct sysfs_driver *driver, char *busid) +{ + struct sysfs_dlink *cur = NULL, *next = NULL; + int found = 0; + + if (driver == NULL || driver->directory == NULL || busid == NULL) { + errno = EINVAL; + return found; + } + for (cur = driver->directory->links; cur != NULL && found == 0; + cur = next) { + next = cur->next; + if ((strcmp(cur->name, busid)) == 0) + found++; + } + return found; +} + +/** + * link_bus_devices_to_drivers: goes through and links devices to drivers + * @bus: bus to link + */ +static void link_bus_devices_to_drivers(struct sysfs_bus *bus) +{ + struct sysfs_device *dev = NULL, *nextdev = NULL; + struct sysfs_driver *drv = NULL, *nextdrv = NULL; + + if (bus != NULL && bus->devices != NULL && bus->drivers != NULL) { + for (dev = bus->devices; dev != NULL; dev = nextdev) { + nextdev = dev->next; + + for (drv = bus->drivers; drv != NULL; drv = nextdrv) { + nextdrv = drv->next; + if ((match_bus_device_to_driver(drv, + dev->bus_id)) != 0) { + dev->driver = drv; + drv->device = dev; + } + } + } + } +} + +/** + * sysfs_open_bus: opens specific bus and all its devices on system + * returns sysfs_bus structure with success or NULL with error. + */ +struct sysfs_bus *sysfs_open_bus(const char *name) +{ + struct sysfs_bus *bus = NULL; + struct sysfs_directory *busdir = NULL; + + if (name == NULL) { + errno = EINVAL; + return NULL; + } + + bus = alloc_bus(); + if (bus == NULL) { + perror("malloc"); + return NULL; + } + strcpy(bus->name, name); + busdir = open_bus_dir(name); + if (busdir == NULL) { + dprintf(stderr,"Invalid bus, %s not supported on this system\n", + name); + sysfs_close_bus(bus); + return NULL; + } + bus->directory = busdir; + if ((get_all_bus_devices(bus)) != 0) { + dprintf(stderr, "Error reading %s bus devices\n", name); + sysfs_close_bus(bus); + return NULL; + } + if ((get_all_bus_drivers(bus)) != 0) { + dprintf(stderr, "Error reading %s bus drivers\n", name); + sysfs_close_bus(bus); + return NULL; + } + link_bus_devices_to_drivers(bus); + + return bus; +} diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c new file mode 100644 index 0000000000..9d7d8b2227 --- /dev/null +++ b/libsysfs/sysfs_class.c @@ -0,0 +1,273 @@ +/* + * sysfs_class.c + * + * Generic class utility functions for libsysfs + * + * Copyright (C) 2003 International Business Machines, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#include "libsysfs.h" +#include "sysfs.h" + +/** + * sysfs_close_class_device: closes a single class device. + * @dev: class device to close. + */ +void sysfs_close_class_device(struct sysfs_class_device *dev) +{ + if (dev != NULL) { + if (dev->directory != NULL) + sysfs_close_directory(dev->directory); + if (dev->sysdevice != NULL) + sysfs_close_device(dev->sysdevice); + if (dev->driver != NULL) + sysfs_close_driver(dev->driver); + free(dev); + } +} + +/** + * sysfs_close_class: close single class + * @class: class structure + */ +void sysfs_close_class(struct sysfs_class *cls) +{ + struct sysfs_class_device *cur = NULL, *next = NULL; + + if (cls != NULL) { + if (cls->directory != NULL) + sysfs_close_directory(cls->directory); + for (cur = cls->devices; cur != NULL; cur = next) { + next = cur->next; + sysfs_close_class_device(cur); + } + free(cls); + } +} + +/** + * alloc_class_device: mallocs and initializes new class device struct. + * returns sysfs_class_device or NULL. + */ +static struct sysfs_class_device *alloc_class_device(void) +{ + return (struct sysfs_class_device *) + calloc(1, sizeof(struct sysfs_class_device)); +} + +/** + * alloc_class: mallocs new class structure + * returns sysfs_class struct or NULL + */ +static struct sysfs_class *alloc_class(void) +{ + return (struct sysfs_class *)calloc(1, sizeof(struct sysfs_class)); +} + +/** + * open_class_dir: opens up sysfs class directory + * returns sysfs_directory struct with success and NULL with error + */ +static struct sysfs_directory *open_class_dir(const char *name) +{ + struct sysfs_directory *classdir = NULL; + char classpath[SYSFS_PATH_MAX]; + + if (name == NULL) { + errno = EINVAL; + return NULL; + } + + memset(classpath, 0, SYSFS_PATH_MAX); + if ((sysfs_get_mnt_path(classpath, SYSFS_PATH_MAX)) != 0) { + dprintf(stderr, "Sysfs not supported on this system\n"); + return NULL; + } + + strcat(classpath, SYSFS_CLASS_DIR); + strcat(classpath, "/"); + strcat(classpath, name); + classdir = sysfs_open_directory(classpath); + if (classdir == NULL) { + errno = EINVAL; + dprintf(stderr,"Class %s not supported on this system\n", + name); + return NULL; + } + if ((sysfs_read_directory(classdir)) != 0) { + dprintf(stderr, "Error reading %s class dir %s\n", name, + classpath); + sysfs_close_directory(classdir); + return NULL; + } + + return classdir; +} + +/** + * sysfs_open_class_device: Opens and populates class device + * @path: path to class device. + * returns struct sysfs_class_device with success and NULL with error. + */ +struct sysfs_class_device *sysfs_open_class_device(const char *path) +{ + struct sysfs_class_device *cdev = NULL; + struct sysfs_directory *dir = NULL, *cur = NULL; + struct sysfs_dlink *curl = NULL; + struct sysfs_device *sdev = NULL; + struct sysfs_driver *drv = NULL; + char temp[SYSFS_NAME_LEN]; + + if (path == NULL) { + errno = EINVAL; + return NULL; + } + cdev = alloc_class_device(); + if (cdev == NULL) { + perror("malloc"); + return NULL; + } + memset(temp, 0, SYSFS_NAME_LEN); + if ((sysfs_get_name_from_path(path, temp, SYSFS_NAME_LEN)) != 0) { + errno = EINVAL; + dprintf(stderr, "Invalid class device path %s\n", path); + sysfs_close_class_device(cdev); + return NULL; + } + strcpy(cdev->name, temp); + + dir = sysfs_open_directory(path); + if (dir == NULL) { + dprintf(stderr, "Error opening class device at %s\n", path); + sysfs_close_class_device(cdev); + return NULL; + } + if ((sysfs_read_directory(dir)) != 0) { + dprintf(stderr, "Error reading class device at %s\n", path); + sysfs_close_directory(dir); + sysfs_close_class_device(cdev); + return NULL; + } + cdev->directory = dir; + + cur = cdev->directory->subdirs; + while(cur != NULL) { + sysfs_read_directory(cur); + cur = cur->next; + } + /* get driver and device, if implemented */ + curl = cdev->directory->links; + while (curl != NULL) { + if (strncmp(curl->name, SYSFS_DEVICES_NAME, 6) == 0) { + sdev = sysfs_open_device(curl->target->path); + if (sdev != NULL) { + cdev->sysdevice = sdev; + if (cdev->driver != NULL) + sdev->driver = cdev->driver; + } + } else if (strncmp(curl->name, SYSFS_DRIVERS_NAME, 6) == 0) { + drv = sysfs_open_driver(curl->target->path); + if (drv != NULL) { + cdev->driver = drv; + if (cdev->sysdevice != NULL) + drv->device = cdev->sysdevice; + } + } + curl = curl->next; + } + return cdev; +} + +/** + * add_dev_to_class: adds a class device to class list + * @class: class to add the device + * @dev: device to add + */ +static void add_dev_to_class(struct sysfs_class *cls, + struct sysfs_class_device *dev) +{ + if (cls != NULL && dev != NULL) { + dev->next = cls->devices; + cls->devices = dev; + } +} + +/** + * get_all_class_devices: gets all devices for class + * @class: class to get devices for + * returns 0 with success and -1 with failure + */ +static int get_all_class_devices(struct sysfs_class *cls) +{ + struct sysfs_class_device *dev = NULL; + struct sysfs_directory *cur = NULL, *next = NULL; + + if (cls == NULL || cls->directory == NULL) { + errno = EINVAL; + return -1; + } + for (cur = cls->directory->subdirs; cur != NULL; cur = next) { + next = cur->next; + dev = sysfs_open_class_device(cur->path); + if (dev == NULL) { + dprintf(stderr, "Error opening device at %s\n", + cur->path); + continue; + } + add_dev_to_class(cls, dev); + } + + return 0; +} + +/** + * sysfs_open_class: opens specific class and all its devices on system + * returns sysfs_class structure with success or NULL with error. + */ +struct sysfs_class *sysfs_open_class(const char *name) +{ + struct sysfs_class *cls = NULL; + struct sysfs_directory *classdir = NULL; + + if (name == NULL) { + errno = EINVAL; + return NULL; + } + + cls = alloc_class(); + if (cls == NULL) { + perror("malloc"); + return NULL; + } + strcpy(cls->name, name); + classdir = open_class_dir(name); + if (classdir == NULL) { + dprintf(stderr, + "Invalid class, %s not supported on this system\n", + name); + sysfs_close_class(cls); + return NULL; + } + cls->directory = classdir; + if ((get_all_class_devices(cls)) != 0) { + dprintf(stderr, "Error reading %s class devices\n", name); + sysfs_close_class(cls); + return NULL; + } + + return cls; +} diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c new file mode 100644 index 0000000000..185b5cf378 --- /dev/null +++ b/libsysfs/sysfs_device.c @@ -0,0 +1,199 @@ +/* + * sysfs_device.c + * + * Generic device utility functions for libsysfs + * + * Copyright (C) 2003 International Business Machines, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#include "libsysfs.h" +#include "sysfs.h" + +/** + * sysfs_close_device: closes and cleans up a device + * @dev = device to clean up + */ +void sysfs_close_device(struct sysfs_device *dev) +{ + if (dev != NULL) { + dev->next = NULL; + dev->driver = NULL; + if (dev->directory != NULL) + sysfs_close_directory(dev->directory); + dev->children = NULL; + free(dev); + } +} + +/** + * alloc_device: allocates and initializes device structure + * returns struct sysfs_device + */ +static struct sysfs_device *alloc_device(void) +{ + return (struct sysfs_device *)calloc(1, sizeof(struct sysfs_device)); +} + +/** + * sysfs_get_device_attr: searches dev's attributes by name + * @dev: device to look through + * @name: attribute name to get + * returns sysfs_attribute reference with success or NULL with error. + */ +struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, + const char *name) +{ + struct sysfs_attribute *cur = NULL; + char attrname[SYSFS_NAME_LEN]; + + if (dev == NULL || dev->directory == NULL || name == NULL) { + errno = EINVAL; + return NULL; + } + for (cur = dev->directory->attributes; cur != NULL; cur = cur->next) { + if ((sysfs_get_name_from_path(cur->path, attrname, + SYSFS_NAME_LEN)) != 0) + continue; + if (strcmp(name, attrname) != 0) + continue; + + return cur; + } + + return NULL; +} + +/** + * sysfs_open_device: opens and populates device structure + * @path: path to device, this is the /sys/devices/ path + * returns sysfs_device structure with success or NULL with error + */ +struct sysfs_device *sysfs_open_device(const char *path) +{ + struct sysfs_device *dev = NULL; + struct sysfs_directory *sdir = NULL; + char *p = NULL; + + if (path == NULL) { + errno = EINVAL; + return NULL; + } + dev = alloc_device(); + if (dev == NULL) { + dprintf(stderr, "Error allocating device at %s\n", path); + return NULL; + } + sdir = sysfs_open_directory(path); + if (sdir == NULL) { + dprintf(stderr, "Invalid device at %s\n", path); + errno = EINVAL; + sysfs_close_device(dev); + return NULL; + } + if ((sysfs_read_directory(sdir)) != 0) { + dprintf(stderr, "Error reading device directory at %s\n", path); + sysfs_close_directory(sdir); + sysfs_close_device(dev); + return NULL; + } + dev->directory = sdir; + sysfs_get_name_from_path(sdir->path, dev->bus_id, SYSFS_NAME_LEN); + /* get device name */ + p = sysfs_get_value_from_attributes(sdir->attributes, + SYSFS_NAME_ATTRIBUTE); + if (p != NULL) { + strncpy(dev->name, p, SYSFS_NAME_LEN); + p = dev->name + strlen(dev->name) - 1; + if ((strlen(dev->name) > 0) && *p == '\n') + *p = '\0'; + } + + return dev; +} + +/** + * sysfs_close_device_tree: closes every device in the supplied tree, + * closing children only. + * @devroot: device root of tree. + */ +void sysfs_close_device_tree(struct sysfs_device *devroot) +{ + if (devroot != NULL) { + if (devroot->children != NULL) { + struct sysfs_device *child = NULL, *next = NULL; + + for (child = devroot->children; child != NULL; + child = next) { + next = child->next; + sysfs_close_device_tree(child); + } + } + sysfs_close_device(devroot); + } +} + +/** + * add_device_child_to_parent: adds child device to parent + * @parent: parent device. + * @child: child device to add. + */ +static void add_device_child_to_parent(struct sysfs_device *parent, + struct sysfs_device *child) +{ + if (parent != NULL && child != NULL) { + child->next = parent->children; + parent->children = child; + child->parent = parent; + } +} + +/** + * sysfs_open_device_tree: opens root device and all of its children, + * creating a tree of devices. Only opens children. + * @path: sysfs path to devices + * returns struct sysfs_device and its children with success or NULL with + * error. + */ +struct sysfs_device *sysfs_open_device_tree(const char *path) +{ + struct sysfs_device *rootdev = NULL, *new = NULL; + struct sysfs_directory *cur = NULL; + + if (path == NULL) { + errno = EINVAL; + return NULL; + } + rootdev = sysfs_open_device(path); + if (rootdev == NULL) { + dprintf(stderr, "Error opening root device at %s\n", path); + return NULL; + } + cur = rootdev->directory->subdirs; + while (cur != NULL) { + new = sysfs_open_device_tree(cur->path); + if (new == NULL) { + dprintf(stderr, "Error opening device tree at %s\n", + cur->path); + sysfs_close_device_tree(rootdev); + return NULL; + } + add_device_child_to_parent(rootdev, new); + cur = cur->next; + } + + return rootdev; +} diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c new file mode 100644 index 0000000000..a83c81f493 --- /dev/null +++ b/libsysfs/sysfs_dir.c @@ -0,0 +1,496 @@ +/* + * syfs_dir.c + * + * Directory utility functions for libsysfs + * + * Copyright (C) 2003 International Business Machines, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#include "libsysfs.h" +#include "sysfs.h" + +/** + * sysfs_close_attribute: closes and cleans up attribute + * @sysattr: attribute to close. + */ +void sysfs_close_attribute(struct sysfs_attribute *sysattr) +{ + if (sysattr != NULL) { + if (sysattr->value != NULL) + free(sysattr->value); + free(sysattr); + } +} + +/** + * alloc_attribute: allocates and initializes attribute structure + * returns struct sysfs_attribute with success and NULL with error. + */ +static struct sysfs_attribute *alloc_attribute(void) +{ + return (struct sysfs_attribute *) + calloc(1, sizeof(struct sysfs_attribute)); +} + +/** + * sysfs_open_attribute: creates sysfs_attribute structure + * @path: path to attribute. + * returns sysfs_attribute struct with success and NULL with error. + */ +struct sysfs_attribute *sysfs_open_attribute(const char *path) +{ + struct sysfs_attribute *sysattr = NULL; + struct stat fileinfo; + + if (path == NULL) { + errno = EINVAL; + return NULL; + } + sysattr = alloc_attribute(); + if (sysattr == NULL) { + dprintf(stderr, "Error allocating attribute at %s\n", path); + return NULL; + } + strncpy(sysattr->path, path, sizeof(sysattr->path)); + if ((stat(sysattr->path, &fileinfo)) != 0) { + perror("stat"); + sysattr->method = 0; + } else { + if (fileinfo.st_mode & S_IRUSR) + sysattr->method |= SYSFS_METHOD_SHOW; + if (fileinfo.st_mode & S_IWUSR) + sysattr->method |= SYSFS_METHOD_STORE; + } + + return sysattr; +} + +/** + * sysfs_read_attribute: reads value from attribute + * @sysattr: attribute to read + * returns 0 with success and -1 with error. + */ +int sysfs_read_attribute(struct sysfs_attribute *sysattr) +{ + char *fbuf = NULL; + char *vbuf = NULL; + size_t length = 0; + int pgsize = 0; + int fd; + + if (sysattr == NULL) { + errno = EINVAL; + return -1; + } + if (!(sysattr->method & SYSFS_METHOD_SHOW)) { + dprintf (stderr, "Show method not supported for attribute %s\n", + sysattr->path); + return -1; + } + pgsize = getpagesize(); + fbuf = (char *)calloc(1, pgsize+1); + if (fbuf == NULL) { + perror("calloc"); + return -1; + } + if ((fd = open(sysattr->path, O_RDONLY)) < 0) { + dprintf (stderr, "Error reading attribute %s\n", sysattr->path); + free(fbuf); + return -1; + } + length = read(fd, fbuf, pgsize); + if (length < 0) { + dprintf (stderr, "Error reading from attribute %s\n", + sysattr->path); + close(fd); + free(fbuf); + return -1; + } + sysattr->len = length; + close(fd); + vbuf = (char *)realloc(fbuf, length+1); + if (vbuf == NULL) { + perror("realloc"); + free(fbuf); + return -1; + } + sysattr->value = vbuf; + + return 0; +} + +/** + * sysfs_read_attribute_value: given path to attribute, return its value. + * values can be up to a pagesize, if buffer is smaller the value will + * be truncated. + * @attrpath: sysfs path to attribute + * @value: buffer to put value + * @vsize: size of value buffer + * returns 0 with success and -1 with error. + */ +int sysfs_read_attribute_value(const char *attrpath, char *value, size_t vsize) +{ + struct sysfs_attribute *attr = NULL; + size_t length = 0; + + if (attrpath == NULL || value == NULL) { + errno = EINVAL; + return -1; + } + + attr = sysfs_open_attribute(attrpath); + if (attr == NULL) { + dprintf(stderr, "Invalid attribute path %s\n", attrpath); + errno = EINVAL; + return -1; + } + if((sysfs_read_attribute(attr)) != 0 || attr->value == NULL) { + dprintf(stderr, "Error reading from attribute %s\n", attrpath); + sysfs_close_attribute(attr); + return -1; + } + length = strlen(attr->value); + if (length > vsize) + dprintf(stderr, + "Value length %d is larger than supplied buffer %d\n", + length, vsize); + strncpy(value, attr->value, vsize); + sysfs_close_attribute(attr); + + return 0; +} + +/** + * sysfs_get_value_from_attrbutes: given a linked list of attributes and an + * attribute name, return its value + * @attr: attribute to search + * @name: name to look for + * returns char * value - could be NULL + */ +char *sysfs_get_value_from_attributes(struct sysfs_attribute *attr, + const char *name) +{ + struct sysfs_attribute *cur = NULL; + char tmpname[SYSFS_NAME_LEN]; + + if (attr == NULL || name == NULL) { + errno = EINVAL; + return NULL; + } + cur = attr; + while (cur != NULL) { + memset(tmpname, 0, SYSFS_NAME_LEN); + if ((sysfs_get_name_from_path(cur->path, tmpname, + SYSFS_NAME_LEN)) != 0) { + cur = cur->next; + continue; + } + if (strcmp(tmpname, name) == 0) + return cur->value; + cur = cur->next; + } + return NULL; +} + +/** + * add_subdir_to_dir: adds subdirectory to directory's subdirs + * @sysdir: directory to add subdir to + * @subdir: subdirectory to add. + */ +static void add_subdir_to_dir(struct sysfs_directory *sysdir, + struct sysfs_directory *subdir) +{ + if (sysdir != NULL && subdir != NULL) { + subdir->next = sysdir->subdirs; + sysdir->subdirs = subdir; + } +} + +/** + * add_attr_to_dir: adds attribute to directory's attributes + * @sysdir: directory to add attribute to + * @sysattr: attribute to add. + */ +static void add_attr_to_dir(struct sysfs_directory *sysdir, + struct sysfs_attribute *sysattr) +{ + if (sysdir != NULL && sysattr != NULL) { + sysattr->next = sysdir->attributes; + sysdir->attributes = sysattr; + } +} + +/** + * sysfs_close_dlink: closes and cleans up directory link. + * @dlink: directory link to close. + */ +void sysfs_close_dlink(struct sysfs_dlink *dlink) +{ + if (dlink != NULL) { + dlink->next = NULL; + if (dlink->target != NULL) + sysfs_close_directory(dlink->target); + free(dlink); + } +} + +/** + * add_dlink_to_dir: adds directory link to directory's links list. + * @sysdir: directory to add it to. + * @dlink: link to add. + */ +static void add_dlink_to_dir(struct sysfs_directory *sysdir, + struct sysfs_dlink *dlink) +{ + if (sysdir != NULL && dlink != NULL) { + dlink->next = sysdir->links; + sysdir->links = dlink; + } +} + +/** + * sysfs_close_directory: closes directory, cleans up attributes and links + * @sysdir: sysfs_directory to close + */ +void sysfs_close_directory(struct sysfs_directory *sysdir) +{ + struct sysfs_directory *sdir = NULL, *dnext = NULL; + struct sysfs_dlink *dlink = NULL, *nextl = NULL; + struct sysfs_attribute *attr = NULL, *anext = NULL; + + if (sysdir != NULL) { + if (sysdir->subdirs != NULL) { + for (sdir = sysdir->subdirs; sdir != NULL; + sdir = dnext) { + dnext = sdir->next; + sysfs_close_directory(sdir); + } + } + if (sysdir->links != NULL) { + for (dlink = sysdir->links; dlink != NULL; + dlink = nextl) { + nextl = dlink->next; + sysfs_close_dlink(dlink); + } + } + if (sysdir->attributes != NULL) { + for (attr = sysdir->attributes; attr != NULL; + attr = anext) { + anext = attr->next; + /* sysfs_close_attribute(attr); */ + if (attr->value != NULL) + free(attr->value); + free(attr); + } + } + free(sysdir); + } +} + +/** + * alloc_directory: allocates and initializes directory structure + * returns struct sysfs_directory with success or NULL with error. + */ +static struct sysfs_directory *alloc_directory(void) +{ + return (struct sysfs_directory *) + calloc(1, sizeof(struct sysfs_directory)); +} + +/** + * alloc_dlink: allocates and initializes directory link structure + * returns struct sysfs_dlink with success or NULL with error. + */ +static struct sysfs_dlink *alloc_dlink(void) +{ + return (struct sysfs_dlink *)calloc(1, sizeof(struct sysfs_dlink)); +} + +/** + * sysfs_open_directory: opens a sysfs directory, creates dir struct, and + * returns. + * @path: path of directory to open. + * returns: struct sysfs_directory * with success and NULL on error. + */ +struct sysfs_directory *sysfs_open_directory(const char *path) +{ + struct sysfs_directory *sdir = NULL; + + if (path == NULL) { + errno = EINVAL; + return NULL; + } + sdir = alloc_directory(); + if (sdir == NULL) { + dprintf(stderr, "Error allocating directory %s\n", path); + return NULL; + } + strncpy(sdir->path, path, sizeof(sdir->path)); + + return sdir; +} + +/** + * sysfs_open_dlink: opens a sysfs directory link, creates struct, and returns + * @path: path of link to open. + * returns: struct sysfs_dlink * with success and NULL on error. + */ +struct sysfs_dlink *sysfs_open_dlink(const char *linkpath) +{ + struct sysfs_dlink *dlink = NULL; + struct sysfs_directory *tdir = NULL; + char name[SYSFS_NAME_LEN]; + char target[SYSFS_PATH_MAX]; + + if (linkpath == NULL) { + errno = EINVAL; + return NULL; + } + + memset(name, 0, SYSFS_NAME_LEN); + memset(target, 0, SYSFS_PATH_MAX); + if ((sysfs_get_name_from_path(linkpath, name, SYSFS_NAME_LEN)) != 0 + || (sysfs_get_link(linkpath, target, SYSFS_PATH_MAX)) != 0) { + errno = EINVAL; + dprintf(stderr, "Invalid link path %s\n", linkpath); + return NULL; + } + dlink = alloc_dlink(); + if (dlink == NULL) { + dprintf(stderr, + "Error allocating directory link %s\n", linkpath); + return NULL; + } + strcpy(dlink->name, name); + tdir = sysfs_open_directory(target); + if (tdir == NULL) { + dprintf(stderr, "Invalid directory link target %s\n", target); + sysfs_close_dlink(dlink); + return NULL; + } + dlink->target = tdir; + + return dlink; +} + +/** + * sysfs_read_directory: grabs attributes, links, and subdirectories + * @sysdir: sysfs directory to open + * returns 0 with success and -1 with error. + */ +int sysfs_read_directory(struct sysfs_directory *sysdir) +{ + DIR *dir = NULL; + struct dirent *dirent = NULL; + struct stat astats; + struct sysfs_attribute *attr = NULL; + struct sysfs_directory *subdir = NULL; + struct sysfs_dlink *dlink = NULL; + char file_path[SYSFS_PATH_MAX]; + int retval = 0; + + if (sysdir == NULL) { + errno = EINVAL; + return -1; + } + dir = opendir(sysdir->path); + if (dir == NULL) { + perror("opendir"); + return -1; + } + while(((dirent = readdir(dir)) != NULL) && retval == 0) { + if (0 == strcmp(dirent->d_name, ".")) + continue; + if (0 == strcmp(dirent->d_name, "..")) + continue; + memset(file_path, 0, SYSFS_PATH_MAX); + strncpy(file_path, sysdir->path, sizeof(file_path)); + strncat(file_path, "/", sizeof(file_path)); + strncat(file_path, dirent->d_name, sizeof(file_path)); + if ((lstat(file_path, &astats)) != 0) { + perror("stat"); + continue; + } + if (S_ISREG(astats.st_mode)) { + attr = sysfs_open_attribute(file_path); + if (attr == NULL) { + dprintf (stderr, "Error opening attribute %s\n", + file_path); + retval = -1; + break; + } + if (attr->method & SYSFS_METHOD_SHOW) { + if ((sysfs_read_attribute(attr)) != 0) { + dprintf (stderr, + "Error reading attribute %s\n", + file_path); + sysfs_close_attribute(attr); + continue; + } + } + add_attr_to_dir(sysdir, attr); + } else if (S_ISDIR(astats.st_mode)) { + subdir = sysfs_open_directory(file_path); + if (subdir == NULL) { + dprintf (stderr, "Error opening directory %s\n", + file_path); + retval = -1; + break; + } + add_subdir_to_dir(sysdir, subdir); + } else if (S_ISLNK(astats.st_mode)) { + dlink = sysfs_open_dlink(file_path); + if (dlink == NULL) { + dprintf(stderr, "Error opening link %s\n", + file_path); + retval = -1; + break; + } + add_dlink_to_dir(sysdir, dlink); + } + } + closedir(dir); + return(retval); +} + +/** + * sysfs_read_dlinks: reads a directory link's target directory. Can + * supply a linked list of links. + * @dlink: directory link to read. + * returns 0 with success or -1 with error. + */ +int sysfs_read_dlinks(struct sysfs_dlink *dlink) +{ + struct sysfs_dlink *cur = NULL; + + if (dlink == NULL || dlink->target == NULL) { + errno = EINVAL; + return -1; + } + cur = dlink; + while (cur != NULL) { + if ((sysfs_read_directory(cur->target)) != 0) { + dprintf(stderr, + "Error reading directory link target %s\n", + dlink->name); + return -1; + } + cur = cur->next; + } + + return 0; +} diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c new file mode 100644 index 0000000000..6813c85f14 --- /dev/null +++ b/libsysfs/sysfs_driver.c @@ -0,0 +1,89 @@ +/* + * sysfs_driver.c + * + * Driver utility functions for libsysfs + * + * Copyright (C) 2003 International Business Machines, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#include "libsysfs.h" +#include "sysfs.h" + +/** + * sysfs_close_driver: closes and cleans up driver structure + * @driver: driver to close + */ +void sysfs_close_driver(struct sysfs_driver *driver) +{ + if (driver != NULL) { + if (driver->directory != NULL) + sysfs_close_directory(driver->directory); + free(driver); + } +} + +/** + * alloc_driver: allocates and initializes driver + * returns struct sysfs_driver with success and NULL with error. + */ +static struct sysfs_driver *alloc_driver(void) +{ + return (struct sysfs_driver *)calloc(1, sizeof(struct sysfs_driver)); +} + +/** + * sysfs_open_driver: opens and initializes driver structure + * @path: path to driver directory + * returns struct sysfs_driver with success and NULL with error + */ +struct sysfs_driver *sysfs_open_driver(const char *path) +{ + struct sysfs_driver *driver = NULL; + struct sysfs_directory *sdir = NULL; + char devname[SYSFS_NAME_LEN]; + + if (path == NULL) { + errno = EINVAL; + return NULL; + } + sdir = sysfs_open_directory(path); + if (sdir == NULL) { + dprintf (stderr, "Error opening directory %s\n", path); + return NULL; + } + if ((sysfs_read_directory(sdir)) != 0) { + dprintf (stderr, "Error reading directory %s\n", path); + sysfs_close_directory(sdir); + return NULL; + } + driver = alloc_driver(); + if (driver == NULL) { + dprintf(stderr, "Error allocating driver at %s\n", path); + sysfs_close_directory(sdir); + return NULL; + } + if ((sysfs_get_name_from_path(path, devname, SYSFS_NAME_LEN)) != 0) { + dprintf (stderr, "Error reading directory %s\n", path); + sysfs_close_directory(sdir); + free(driver); + return NULL; + } + strncpy(driver->name, devname, sizeof(driver->name)); + driver->directory = sdir; + + return driver; +} diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c new file mode 100644 index 0000000000..a2410abe69 --- /dev/null +++ b/libsysfs/sysfs_utils.c @@ -0,0 +1,156 @@ +/* + * syfs_utils.c + * + * System utility functions for libsysfs + * + * Copyright (C) 2003 International Business Machines, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#include "libsysfs.h" +#include "sysfs.h" + +/** + * sysfs_get_mnt_path: Gets the mount point for specified filesystem. + * @fs_type: filesystem type to retrieve mount point + * @mnt_path: place to put the retrieved mount path + * @len: size of mnt_path + * returns 0 with success and -1 with error. + */ +static int sysfs_get_fs_mnt_path(const char *fs_type, char *mnt_path, + size_t len) +{ + FILE *mnt; + struct mntent *mntent; + int ret = 0; + size_t dirlen = 0; + + /* check arg */ + if (fs_type == NULL || mnt_path == NULL) { + errno = EINVAL; + return -1; + } + + if ((mnt = setmntent(SYSFS_PROC_MNTS, "r")) == NULL) { + dprintf(stderr, "Error getting mount information\n"); + return -1; + } + while (ret == 0 && dirlen == 0 && (mntent = getmntent(mnt)) != NULL) { + if (strcmp(mntent->mnt_type, fs_type) == 0) { + dirlen = strlen(mntent->mnt_dir); + if (dirlen <= (len - 1)) { + strcpy(mnt_path, mntent->mnt_dir); + } else { + dprintf(stderr, + "Error - mount path too long\n"); + ret = -1; + } + } + } + endmntent(mnt); + if (dirlen == 0 && ret == 0) { + dprintf(stderr, "Filesystem %s not found!\n", fs_type); + errno = EINVAL; + ret = -1; + } + return ret; +} + +/* + * sysfs_get_mnt_path: Gets the sysfs mount point. + * @mnt_path: place to put "sysfs" mount point + * @len: size of mnt_path + * returns 0 with success and -1 with error. + */ +int sysfs_get_mnt_path(char *mnt_path, size_t len) +{ + int ret = -1; + + if (mnt_path != NULL) + ret = sysfs_get_fs_mnt_path(SYSFS_FSTYPE_NAME, mnt_path, len); + else + errno = EINVAL; + + return ret; +} + +/** + * sysfs_get_name_from_path: returns last name from a "/" delimited path + * @path: path to get name from + * @name: where to put name + * @len: size of name + */ +int sysfs_get_name_from_path(const char *path, char *name, size_t len) +{ + char *n = NULL; + + if (path == NULL || name == NULL) { + errno = EINVAL; + return -1; + } + n = strrchr(path, '/'); + if (n == NULL) { + errno = EINVAL; + return -1; + } + n++; + strncpy(name, n, len); + + return 0; +} + +/** + * sysfs_get_link: returns link source + * @path: symbolic link's path + * @target: where to put name + * @len: size of name + */ +int sysfs_get_link(const char *path, char *target, size_t len) +{ + char devdir[SYSFS_PATH_MAX]; + char linkpath[SYSFS_PATH_MAX]; + char *d = NULL; + + if (path == NULL || target == NULL) { + errno = EINVAL; + return -1; + } + + memset(devdir, 0, SYSFS_PATH_MAX); + memset(linkpath, 0, SYSFS_PATH_MAX); + + if ((sysfs_get_mnt_path(devdir, SYSFS_PATH_MAX)) != 0) { + dprintf(stderr, "Sysfs not supported on this system\n"); + return -1; + } + + if ((readlink(path, linkpath, SYSFS_PATH_MAX)) < 0) { + return -1; + } + + d = linkpath; + + /* getting rid of leading "../.." */ + while (*d == '/' || *d == '.') + d++; + + d--; + + strcat(devdir, d); + strncpy(target, devdir, len); + + return 0; +} -- cgit v1.2.3-54-g00ecf From 28972fe8a9a314761aacd16bf19f89dbaf5a9282 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 18 Jul 2003 22:43:45 -0700 Subject: [PATCH] added libsysfs to the build. --- Makefile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0013d06793..7cca002c99 100644 --- a/Makefile +++ b/Makefile @@ -104,6 +104,8 @@ else LDFLAGS = --static endif +LIB=libsysfs + all: $(LIBC) $(ROOT) $(ARCH_LIB_OBJS) : @@ -113,6 +115,10 @@ OBJS = udev.o \ logging.o \ namedev.o +LIBSYSFS = libsysfs/libsysfs.a + +libsysfs/libsysfs.a: + $(MAKE) -C libsysfs # header files automatically generated GEN_HEADERS = udev_version.h @@ -122,8 +128,9 @@ udev_version.h: @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ -$(ROOT): $(GEN_HEADERS) $(OBJS) - $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(ROOT): $(GEN_HEADERS) $(OBJS) $(LIBSYSFS) + $(MAKE) -C libsysfs + $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) -lsysfs $(LIB_OBJS) -L$(LIB) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) clean: @@ -131,6 +138,7 @@ clean: | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(MAKE) -C klibc clean + $(MAKE) -C libsysfs clean DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS ) DISTDIR := $(RELEASE_NAME) -- cgit v1.2.3-54-g00ecf From 185a35a403cc37b3943bc68aa61745ff2b6ed17b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 18 Jul 2003 22:48:28 -0700 Subject: [PATCH] add initial libsysfs support... needs lots more cleanup, but is much nicer than doing this by hand... --- namedev.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- namedev.h | 1 + udev.c | 18 ++++++---- udev.h | 13 ++++++++ 4 files changed, 129 insertions(+), 15 deletions(-) diff --git a/namedev.c b/namedev.c index 0271ba55a2..b8a21a25ae 100644 --- a/namedev.c +++ b/namedev.c @@ -34,6 +34,7 @@ #include "udev.h" #include "udev_version.h" #include "namedev.h" +#include "libsysfs/libsysfs.h" #define TYPE_LABEL "LABEL" #define TYPE_NUMBER "NUMBER" @@ -53,9 +54,6 @@ enum config_type { #define VALUE_SIZE 100 #define ID_SIZE 50 #define PLACE_SIZE 50 -#define NAME_SIZE 100 -#define OWNER_SIZE 30 -#define GROUP_SIZE 30 struct config_device { @@ -80,36 +78,38 @@ struct config_device { static LIST_HEAD(config_device_list); +static char sysfs_path[SYSFS_PATH_MAX]; + static void dump_dev(struct config_device *dev) { switch (dev->type) { case KERNEL_NAME: dbg("KERNEL name ='%s'" - " owner = '%s', group = '%s', mode = '%d'", + " owner = '%s', group = '%s', mode = '%#o'", dev->name, dev->owner, dev->group, dev->mode); break; case LABEL: dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" - " owner = '%s', group = '%s', mode = '%d'", + " owner = '%s', group = '%s', mode = '%#o'", dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value, dev->owner, dev->group, dev->mode); break; case NUMBER: dbg("NUMBER name = '%s', bus = '%s', id = '%s'" - " owner = '%s', group = '%s', mode = '%d'", + " owner = '%s', group = '%s', mode = '%#o'", dev->name, dev->bus, dev->id, dev->owner, dev->group, dev->mode); break; case TOPOLOGY: dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'" - " owner = '%s', group = '%s', mode = '%d'", + " owner = '%s', group = '%s', mode = '%#o'", dev->name, dev->bus, dev->place, dev->owner, dev->group, dev->mode); break; case REPLACE: dbg("REPLACE name = %s, kernel_name = %s" - " owner = '%s', group = '%s', mode = '%d'", + " owner = '%s', group = '%s', mode = '%#o'", dev->name, dev->kernel_name, dev->owner, dev->group, dev->mode); break; @@ -432,7 +432,7 @@ static int namedev_init_permissions(void) dev.mode = strtol(temp, NULL, 8); - dbg("name = %s, owner = %s, group = %s, mode = %x", dev.name, dev.owner, dev.group, dev.mode); + dbg("name = %s, owner = %s, group = %s, mode = %#o", dev.name, dev.owner, dev.group, dev.mode); retval = add_dev(&dev); if (retval) { dbg("add_dev returned with error %d", retval); @@ -446,10 +446,103 @@ exit: } +static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor) +{ + char temp[3]; + int retval = 0; + + char *dev; + + dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev"); + if (dev == NULL) + return -ENODEV; + + dbg("dev = %s", dev); + + temp[0] = dev[0]; + temp[1] = dev[1]; + temp[2] = 0x00; + *major = (int)strtol(&temp[0], NULL, 16); + + temp[0] = dev[2]; + temp[1] = dev[3]; + temp[2] = 0x00; + *minor = (int)strtol(&temp[0], NULL, 16); + + dbg("found major = %d, minor = %d", *major, *minor); + + retval = 0; + return retval; +} + +static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *attr) +{ + struct list_head *tmp; + int retval = 0; + + retval = get_major_minor(class_dev, &attr->major, &attr->minor); + if (retval) { + dbg ("get_major_minor failed"); + goto exit; + } + + list_for_each(tmp, &config_device_list) { + struct config_device *dev = list_entry(tmp, struct config_device, node); + if (strcmp(dev->name, class_dev->name) == 0) { + attr->mode = dev->mode; + strcpy(attr->owner, dev->owner); + strcpy(attr->group, dev->group); + /* FIXME put the proper name here!!! */ + strcpy(attr->name, dev->name); + dbg("%s - owner = %s, group = %s, mode = %#o", dev->name, dev->owner, dev->group, dev->mode); + goto exit; + } + } + attr->mode = 0666; + attr->owner[0] = 0x00; + attr->group[0] = 0x00; + strcpy(attr->name, class_dev->name); +exit: + return retval; +} + +int namedev_name_device(char *device_name, struct device_attr *attr) +{ + char dev_path[SYSFS_PATH_MAX]; + struct sysfs_class_device *class_dev; + int retval; + + strcpy(dev_path, sysfs_path); + strcat(dev_path, device_name); + + dbg("looking at %s", dev_path); + + /* open up the sysfs class device for this thing... */ + class_dev = sysfs_open_class_device(dev_path); + if (class_dev == NULL) { + dbg ("sysfs_open_class_device failed"); + return -ENODEV; + } + dbg("class_dev->name = %s", class_dev->name); + + retval = get_attr(class_dev, attr); + if (retval) { + dbg ("get_attr failed"); + goto exit; + } +exit: + sysfs_close_class_device(class_dev); + return retval; +} int namedev_init(void) { int retval; + + retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); + if (retval) + return retval; + dbg("sysfs_path = %s", sysfs_path); retval = namedev_init_config(); if (retval) @@ -463,3 +556,4 @@ int namedev_init(void) return retval; } + diff --git a/namedev.h b/namedev.h index 0089b4d240..1fe5860015 100644 --- a/namedev.h +++ b/namedev.h @@ -30,5 +30,6 @@ #define NAMEDEV_CONFIG_FILE "namedev.config" extern int namedev_init(void); +extern int namedev_name_device(char *device_name, struct device_attr *attr); #endif diff --git a/udev.c b/udev.c index bf170d1651..dc5f5b8d89 100644 --- a/udev.c +++ b/udev.c @@ -50,7 +50,8 @@ static char *get_device(void) temp = getenv("DEVPATH"); if (temp == NULL) return NULL; - strcpy(device, SYSFS_ROOT); + strcpy(device, ""); +// strcpy(device, SYSFS_ROOT); strcat(device, temp); return device; @@ -198,14 +199,14 @@ static int delete_node(char *name) return unlink(filename); } -static int add_device(char *device, char type) +static int add_device(char *device, char type, struct device_attr *attr) { char *name; int major; int minor; int mode; int retval = -EINVAL; - +#if 0 retval = get_major_minor(device, &major, &minor); if (retval) { dbg ("get_major_minor failed"); @@ -225,8 +226,8 @@ static int add_device(char *device, char type) retval = -EINVAL; goto exit; } - - return create_node(name, type, major, minor, mode); +#endif + return create_node(attr->name, type, attr->major, attr->minor, attr->mode); exit: return retval; @@ -252,6 +253,7 @@ exit: int main(int argc, char *argv[]) { + struct device_attr attr; char *subsystem; char *action; char *device; @@ -290,8 +292,12 @@ int main(int argc, char *argv[]) } dbg("looking at %s", device); + retval = namedev_name_device(device, &attr); + if (retval) + return retval; + if (strcmp(action, "add") == 0) - return add_device(device, type); + return add_device(device, type, &attr); if (strcmp(action, "remove") == 0) return remove_device(device); diff --git a/udev.h b/udev.h index af1b6bbb8d..c82dbebded 100644 --- a/udev.h +++ b/udev.h @@ -52,6 +52,19 @@ extern int log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); +#define NAME_SIZE 100 +#define OWNER_SIZE 30 +#define GROUP_SIZE 30 + +struct device_attr { + int major; + int minor; + int mode; + char name[NAME_SIZE]; + char owner[OWNER_SIZE]; + char group[GROUP_SIZE]; +}; + #endif -- cgit v1.2.3-54-g00ecf From fa41b24051d9ac53cba45c0bb78623d4c0a5e5d6 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 18 Jul 2003 22:48:49 -0700 Subject: [PATCH] update the tests to handle block devices too. --- namedev.permissions | 2 +- test | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/namedev.permissions b/namedev.permissions index 7f87fc9b0e..66d8af1f7a 100644 --- a/namedev.permissions +++ b/namedev.permissions @@ -1,5 +1,5 @@ #name:user:group:mode -ttyUSB0:root:uucp:0666 +ttyUSB0:root:uucp:0660 ttyUSB1:root:uucp:0666 visor:root:uucp:0666 dsp1:::0666 diff --git a/test b/test index 40613d48af..f5e808b557 100644 --- a/test +++ b/test @@ -3,6 +3,8 @@ export ACTION=add #export ACTION=remove export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.1/ttyUSB7 export DEVPATH=/class/tty/ttyUSB0 +export DEVPATH=/block/hda -./udev tty +./udev block +#./udev tty -- cgit v1.2.3-54-g00ecf From 19dc5d4ce15ad387031ec4e78dc615a9eb07dc08 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 19 Jul 2003 05:06:55 -0700 Subject: [PATCH] Clean up the namedev interface a bit, making the code smaller... --- namedev.c | 72 ++++---------------------- namedev.h | 4 +- udev.c | 169 ++++++++++++++++++++++++++++++++------------------------------ udev.h | 4 +- 4 files changed, 99 insertions(+), 150 deletions(-) diff --git a/namedev.c b/namedev.c index b8a21a25ae..b6d9a7f8e2 100644 --- a/namedev.c +++ b/namedev.c @@ -78,8 +78,6 @@ struct config_device { static LIST_HEAD(config_device_list); -static char sysfs_path[SYSFS_PATH_MAX]; - static void dump_dev(struct config_device *dev) { switch (dev->type) { @@ -445,47 +443,18 @@ exit: return retval; } - -static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor) +static int get_default_mode(struct sysfs_class_device *class_dev) { - char temp[3]; - int retval = 0; - - char *dev; - - dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev"); - if (dev == NULL) - return -ENODEV; - - dbg("dev = %s", dev); - - temp[0] = dev[0]; - temp[1] = dev[1]; - temp[2] = 0x00; - *major = (int)strtol(&temp[0], NULL, 16); - - temp[0] = dev[2]; - temp[1] = dev[3]; - temp[2] = 0x00; - *minor = (int)strtol(&temp[0], NULL, 16); - - dbg("found major = %d, minor = %d", *major, *minor); - - retval = 0; - return retval; + /* just default everyone to rw for the world! */ + return 0666; } + static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *attr) { struct list_head *tmp; int retval = 0; - retval = get_major_minor(class_dev, &attr->major, &attr->minor); - if (retval) { - dbg ("get_major_minor failed"); - goto exit; - } - list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); if (strcmp(dev->name, class_dev->name) == 0) { @@ -498,7 +467,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at goto exit; } } - attr->mode = 0666; + attr->mode = get_default_mode(class_dev); attr->owner[0] = 0x00; attr->group[0] = 0x00; strcpy(attr->name, class_dev->name); @@ -506,32 +475,14 @@ exit: return retval; } -int namedev_name_device(char *device_name, struct device_attr *attr) +int namedev_name_device(struct sysfs_class_device *class_dev, struct device_attr *attr) { - char dev_path[SYSFS_PATH_MAX]; - struct sysfs_class_device *class_dev; int retval; - strcpy(dev_path, sysfs_path); - strcat(dev_path, device_name); - - dbg("looking at %s", dev_path); - - /* open up the sysfs class device for this thing... */ - class_dev = sysfs_open_class_device(dev_path); - if (class_dev == NULL) { - dbg ("sysfs_open_class_device failed"); - return -ENODEV; - } - dbg("class_dev->name = %s", class_dev->name); - retval = get_attr(class_dev, attr); - if (retval) { - dbg ("get_attr failed"); - goto exit; - } -exit: - sysfs_close_class_device(class_dev); + if (retval) + dbg("get_attr failed"); + return retval; } @@ -539,11 +490,6 @@ int namedev_init(void) { int retval; - retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); - if (retval) - return retval; - dbg("sysfs_path = %s", sysfs_path); - retval = namedev_init_config(); if (retval) return retval; diff --git a/namedev.h b/namedev.h index 1fe5860015..0e3a819952 100644 --- a/namedev.h +++ b/namedev.h @@ -23,6 +23,8 @@ #ifndef NAMEDEV_H #define NAMEDEV_H +struct sysfs_class_device; + /* namedev config files */ #define COMMENT_CHARACTER '#' #define NAMEDEV_CONFIG_ROOT "/home/greg/src/udev/" @@ -30,6 +32,6 @@ #define NAMEDEV_CONFIG_FILE "namedev.config" extern int namedev_init(void); -extern int namedev_name_device(char *device_name, struct device_attr *attr); +extern int namedev_name_device(struct sysfs_class_device *class_dev, struct device_attr *attr); #endif diff --git a/udev.c b/udev.c index dc5f5b8d89..b3e18ff9da 100644 --- a/udev.c +++ b/udev.c @@ -31,8 +31,11 @@ #include "udev.h" #include "udev_version.h" #include "namedev.h" +#include "libsysfs/libsysfs.h" +static char sysfs_path[SYSFS_PATH_MAX]; + static char *get_action(void) { char *action; @@ -44,16 +47,9 @@ static char *get_action(void) static char *get_device(void) { - static char device[255]; - char *temp; - - temp = getenv("DEVPATH"); - if (temp == NULL) - return NULL; - strcpy(device, ""); -// strcpy(device, SYSFS_ROOT); - strcat(device, temp); + char *device; + device = getenv("DEVPATH"); return device; } @@ -68,45 +64,32 @@ static char *get_device(void) * Yes, this will probably change when we go to a bigger major/minor * range, and will have to be changed at that time. */ -static int get_major_minor (char *dev, int *major, int *minor) +static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor) { - char filename[255]; - char line[20]; char temp[3]; - int fd; int retval = 0; - /* add the dev file to the directory and see if it's present */ - strncpy(filename, dev, sizeof(filename)); - strncat(filename, DEV_FILE, sizeof(filename)); - fd = open(filename, O_RDONLY); - if (fd < 0) { - dbg("Can't open %s", filename); + char *dev; + + dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev"); + if (dev == NULL) return -ENODEV; - } - /* get the major/minor */ - retval = read(fd, line, sizeof(line)); - if (retval < 0) { - dbg("read error on %s", dev); - goto exit; - } + dbg("dev = %s", dev); - temp[0] = line[0]; - temp[1] = line[1]; + temp[0] = dev[0]; + temp[1] = dev[1]; temp[2] = 0x00; *major = (int)strtol(&temp[0], NULL, 16); - temp[0] = line[2]; - temp[1] = line[3]; + temp[0] = dev[2]; + temp[1] = dev[3]; temp[2] = 0x00; *minor = (int)strtol(&temp[0], NULL, 16); dbg("found major = %d, minor = %d", *major, *minor); retval = 0; -exit: - close(fd); return retval; } @@ -130,15 +113,6 @@ static char *get_name(char *dev, int major, int minor) return &name[0]; } -/* - * Again, this will live in the naming deamon - */ -static int get_mode(char *name, char *dev, int major, int minor) -{ - /* just default everyone to rw for the world! */ - return 0666; -} - /* * We also want to add some permissions here, and possibly some symlinks */ @@ -199,35 +173,61 @@ static int delete_node(char *name) return unlink(filename); } -static int add_device(char *device, char type, struct device_attr *attr) +struct sysfs_class_device *get_class_dev(char *device_name) { - char *name; + char dev_path[SYSFS_PATH_MAX]; + struct sysfs_class_device *class_dev; + + strcpy(dev_path, sysfs_path); + strcat(dev_path, device_name); + + dbg("looking at %s", dev_path); + + /* open up the sysfs class device for this thing... */ + class_dev = sysfs_open_class_device(dev_path); + if (class_dev == NULL) { + dbg ("sysfs_open_class_device failed"); + return NULL; + } + dbg("class_dev->name = %s", class_dev->name); + + return class_dev; +} + +static int add_device(char *device, char *subsystem) +{ + struct sysfs_class_device *class_dev; + struct device_attr attr; + //char *name; int major; int minor; - int mode; + char type; + //int mode; int retval = -EINVAL; -#if 0 - retval = get_major_minor(device, &major, &minor); + + /* for now, the block layer is the only place where block devices are */ + if (strcmp(subsystem, "block") == 0) + type = 'b'; + else + type = 'c'; + + class_dev = get_class_dev(device); + if (class_dev == NULL) + goto exit; + + retval = namedev_name_device(class_dev, &attr); + if (retval) + return retval; + + retval = get_major_minor(class_dev, &major, &minor); if (retval) { dbg ("get_major_minor failed"); goto exit; } - name = get_name(device, major, minor); - if (name == NULL) { - dbg ("get_name failed"); - retval = -ENODEV; - goto exit; - } + sysfs_close_class_device(class_dev); - mode = get_mode(name, device, major, minor); - if (mode < 0) { - dbg ("get_mode failed"); - retval = -EINVAL; - goto exit; - } -#endif - return create_node(attr->name, type, attr->major, attr->minor, attr->mode); + return create_node(attr.name, type, major, minor, attr.mode); exit: return retval; @@ -250,14 +250,20 @@ static int remove_device(char *device) exit: return retval; } + +static int udev_init(void) +{ + int retval; + + retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); + dbg("sysfs_path = %s", sysfs_path); + return retval; +} int main(int argc, char *argv[]) { - struct device_attr attr; - char *subsystem; char *action; char *device; - char type; int retval = -EINVAL; if (argc != 2) { @@ -265,19 +271,27 @@ int main(int argc, char *argv[]) goto exit; } - namedev_init(); + device = get_device(); + if (!device) { + dbg ("no device?"); + goto exit; + } + dbg("looking at %s", device); + /* we only care about class devices and block stuff */ + if (!strstr(device, "class") && + !strstr(device, "block")) { + dbg("not block or class"); + goto exit; + } + /* sleep for a second or two to give the kernel a chance to * create the dev file */ - sleep(2); + sleep(1); - /* for now, the block layer is the only place where block devices are */ - subsystem = argv[1]; - if (strcmp(subsystem, "block") == 0) - type = 'b'; - else - type = 'c'; + udev_init(); + namedev_init(); action = get_action(); if (!action) { @@ -285,19 +299,8 @@ int main(int argc, char *argv[]) goto exit; } - device = get_device(); - if (!device) { - dbg ("no device?"); - goto exit; - } - dbg("looking at %s", device); - - retval = namedev_name_device(device, &attr); - if (retval) - return retval; - if (strcmp(action, "add") == 0) - return add_device(device, type, &attr); + return add_device(device, argv[1]); if (strcmp(action, "remove") == 0) return remove_device(device); diff --git a/udev.h b/udev.h index c82dbebded..56eb0d7edb 100644 --- a/udev.h +++ b/udev.h @@ -57,12 +57,10 @@ extern int log_message (int level, const char *format, ...) #define GROUP_SIZE 30 struct device_attr { - int major; - int minor; - int mode; char name[NAME_SIZE]; char owner[OWNER_SIZE]; char group[GROUP_SIZE]; + int mode; }; -- cgit v1.2.3-54-g00ecf From ea733a2f00174c3a39c8eb783e330b6a69abd67c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 20 Jul 2003 20:48:48 -0700 Subject: [PATCH] split udev main logic into udev-add and udev-remove. --- Makefile | 2 + udev-add.c | 200 +++++++++++++++++++++++++++++++++++++++++++++++++ udev-remove.c | 88 ++++++++++++++++++++++ udev.c | 234 ++++------------------------------------------------------ udev.h | 2 + 5 files changed, 306 insertions(+), 220 deletions(-) create mode 100644 udev-add.c create mode 100644 udev-remove.c diff --git a/Makefile b/Makefile index 7cca002c99..989eb403bf 100644 --- a/Makefile +++ b/Makefile @@ -112,6 +112,8 @@ $(ARCH_LIB_OBJS) : $(MAKE) -C klibc OBJS = udev.o \ + udev-add.o \ + udev-remove.o \ logging.o \ namedev.o diff --git a/udev-add.c b/udev-add.c new file mode 100644 index 0000000000..45ffbf81b5 --- /dev/null +++ b/udev-add.c @@ -0,0 +1,200 @@ +/* + * udev-add.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_version.h" +#include "namedev.h" +#include "libsysfs/libsysfs.h" + + +static char sysfs_path[SYSFS_PATH_MAX]; + +/* + * Right now the major/minor of a device is stored in a file called + * "dev" in sysfs. + * The number is stored as: + * MMmm + * MM is the major + * mm is the minor + * The value is in hex. + * Yes, this will probably change when we go to a bigger major/minor + * range, and will have to be changed at that time. + */ +static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor) +{ + char temp[3]; + int retval = 0; + + char *dev; + + dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev"); + if (dev == NULL) + return -ENODEV; + + dbg("dev = %s", dev); + + temp[0] = dev[0]; + temp[1] = dev[1]; + temp[2] = 0x00; + *major = (int)strtol(&temp[0], NULL, 16); + + temp[0] = dev[2]; + temp[1] = dev[3]; + temp[2] = 0x00; + *minor = (int)strtol(&temp[0], NULL, 16); + + dbg("found major = %d, minor = %d", *major, *minor); + + retval = 0; + return retval; +} + +/* + * We also want to add some permissions here, and possibly some symlinks + */ +static int create_node(char *name, char type, int major, int minor, int mode) +{ + char *argv[7]; + char mode_string[100]; + char type_string[3]; + char major_string[20]; + char minor_string[20]; + char filename[255]; + int retval = 0; + + strncpy(filename, UDEV_ROOT, sizeof(filename)); + strncat(filename, name, sizeof(filename)); + + snprintf(mode_string, sizeof(mode_string), "--mode=%#o", mode); + snprintf(type_string, sizeof(type_string), "%c", type); + snprintf(major_string, sizeof(major_string), "%d", major); + snprintf(minor_string, sizeof(minor_string), "%d", minor); + + argv[0] = MKNOD; + argv[1] = mode_string; + argv[2] = filename; + argv[3] = type_string; + argv[4] = major_string; + argv[5] = minor_string; + argv[6] = NULL; + dbg ("executing %s %s %s %s %s %s", + argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); + switch (fork()) { + case 0: + /* we are the child, so lets run the program */ + execv (MKNOD, argv); + exit(0); + break; + case (-1): + dbg ("fork failed."); + retval = -EFAULT; + break; + default: + break; + } + return retval; +} + +struct sysfs_class_device *get_class_dev(char *device_name) +{ + char dev_path[SYSFS_PATH_MAX]; + struct sysfs_class_device *class_dev; + + strcpy(dev_path, sysfs_path); + strcat(dev_path, device_name); + + dbg("looking at %s", dev_path); + + /* open up the sysfs class device for this thing... */ + class_dev = sysfs_open_class_device(dev_path); + if (class_dev == NULL) { + dbg ("sysfs_open_class_device failed"); + return NULL; + } + dbg("class_dev->name = %s", class_dev->name); + + return class_dev; +} + +static int udev_init(void) +{ + int retval; + + retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); + dbg("sysfs_path = %s", sysfs_path); + return retval; +} + +int udev_add_device(char *device, char *subsystem) +{ + struct sysfs_class_device *class_dev; + struct device_attr attr; + //char *name; + int major; + int minor; + char type; + //int mode; + int retval = -EINVAL; + + /* sleep for a second or two to give the kernel a chance to + * create the dev file + */ + sleep(1); + + udev_init(); + + /* for now, the block layer is the only place where block devices are */ + if (strcmp(subsystem, "block") == 0) + type = 'b'; + else + type = 'c'; + + class_dev = get_class_dev(device); + if (class_dev == NULL) + goto exit; + + retval = namedev_name_device(class_dev, &attr); + if (retval) + return retval; + + retval = get_major_minor(class_dev, &major, &minor); + if (retval) { + dbg ("get_major_minor failed"); + goto exit; + } + + sysfs_close_class_device(class_dev); + + return create_node(attr.name, type, major, minor, attr.mode); + +exit: + return retval; +} + diff --git a/udev-remove.c b/udev-remove.c new file mode 100644 index 0000000000..cd917af193 --- /dev/null +++ b/udev-remove.c @@ -0,0 +1,88 @@ +/* + * udev-remove.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_version.h" +#include "namedev.h" +#include "libsysfs/libsysfs.h" + + +/* + * Here would go a call to the naming deamon, to get the name we want to have + * for this device. But for now, let's just default to whatever the kernel is + * calling the device as that will keep the "old-style" naming policy + */ +static char *get_name(char *dev, int major, int minor) +{ + static char name[100]; + char *temp; + + temp = strrchr(dev, '/'); + if (temp == NULL) + return NULL; + strncpy(name, &temp[1], sizeof(name)); + + dbg("name is %s", name); + + return &name[0]; +} + +/* + * We also want to clean up any symlinks that were created in create_node() + */ +static int delete_node(char *name) +{ + char filename[255]; + + strncpy(filename, UDEV_ROOT, sizeof(filename)); + strncat(filename, name, sizeof(filename)); + + dbg("unlinking %s", filename); + return unlink(filename); +} + +int udev_remove_device(char *device, char *subsystem) +{ + char *name; + int retval = 0; + + name = get_name(device, 0, 0); + if (name == NULL) { + dbg ("get_name failed"); + retval = -ENODEV; + goto exit; + } + + return delete_node(name); + +exit: + return retval; +} + diff --git a/udev.c b/udev.c index b3e18ff9da..74572625af 100644 --- a/udev.c +++ b/udev.c @@ -34,8 +34,6 @@ #include "libsysfs/libsysfs.h" -static char sysfs_path[SYSFS_PATH_MAX]; - static char *get_action(void) { char *action; @@ -53,217 +51,11 @@ static char *get_device(void) return device; } -/* - * Right now the major/minor of a device is stored in a file called - * "dev" in sysfs. - * The number is stored as: - * MMmm - * MM is the major - * mm is the minor - * The value is in hex. - * Yes, this will probably change when we go to a bigger major/minor - * range, and will have to be changed at that time. - */ -static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor) -{ - char temp[3]; - int retval = 0; - - char *dev; - - dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev"); - if (dev == NULL) - return -ENODEV; - - dbg("dev = %s", dev); - - temp[0] = dev[0]; - temp[1] = dev[1]; - temp[2] = 0x00; - *major = (int)strtol(&temp[0], NULL, 16); - - temp[0] = dev[2]; - temp[1] = dev[3]; - temp[2] = 0x00; - *minor = (int)strtol(&temp[0], NULL, 16); - - dbg("found major = %d, minor = %d", *major, *minor); - - retval = 0; - return retval; -} - -/* - * Here would go a call to the naming deamon, to get the name we want to have - * for this device. But for now, let's just default to whatever the kernel is - * calling the device as that will keep the "old-style" naming policy - */ -static char *get_name(char *dev, int major, int minor) -{ - static char name[100]; - char *temp; - - temp = strrchr(dev, '/'); - if (temp == NULL) - return NULL; - strncpy(name, &temp[1], sizeof(name)); - - dbg("name is %s", name); - - return &name[0]; -} - -/* - * We also want to add some permissions here, and possibly some symlinks - */ -static int create_node(char *name, char type, int major, int minor, int mode) -{ - char *argv[7]; - char mode_string[100]; - char type_string[3]; - char major_string[20]; - char minor_string[20]; - char filename[255]; - int retval = 0; - - strncpy(filename, UDEV_ROOT, sizeof(filename)); - strncat(filename, name, sizeof(filename)); - - snprintf(mode_string, sizeof(mode_string), "--mode=%#o", mode); - snprintf(type_string, sizeof(type_string), "%c", type); - snprintf(major_string, sizeof(major_string), "%d", major); - snprintf(minor_string, sizeof(minor_string), "%d", minor); - - argv[0] = MKNOD; - argv[1] = mode_string; - argv[2] = filename; - argv[3] = type_string; - argv[4] = major_string; - argv[5] = minor_string; - argv[6] = NULL; - dbg ("executing %s %s %s %s %s %s", - argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); - switch (fork()) { - case 0: - /* we are the child, so lets run the program */ - execv (MKNOD, argv); - exit(0); - break; - case (-1): - dbg ("fork failed."); - retval = -EFAULT; - break; - default: - break; - } - return retval; -} - -/* - * We also want to clean up any symlinks that were created in create_node() - */ -static int delete_node(char *name) -{ - char filename[255]; - - strncpy(filename, UDEV_ROOT, sizeof(filename)); - strncat(filename, name, sizeof(filename)); - - dbg("unlinking %s", filename); - return unlink(filename); -} - -struct sysfs_class_device *get_class_dev(char *device_name) -{ - char dev_path[SYSFS_PATH_MAX]; - struct sysfs_class_device *class_dev; - - strcpy(dev_path, sysfs_path); - strcat(dev_path, device_name); - - dbg("looking at %s", dev_path); - - /* open up the sysfs class device for this thing... */ - class_dev = sysfs_open_class_device(dev_path); - if (class_dev == NULL) { - dbg ("sysfs_open_class_device failed"); - return NULL; - } - dbg("class_dev->name = %s", class_dev->name); - - return class_dev; -} - -static int add_device(char *device, char *subsystem) -{ - struct sysfs_class_device *class_dev; - struct device_attr attr; - //char *name; - int major; - int minor; - char type; - //int mode; - int retval = -EINVAL; - - /* for now, the block layer is the only place where block devices are */ - if (strcmp(subsystem, "block") == 0) - type = 'b'; - else - type = 'c'; - - class_dev = get_class_dev(device); - if (class_dev == NULL) - goto exit; - - retval = namedev_name_device(class_dev, &attr); - if (retval) - return retval; - - retval = get_major_minor(class_dev, &major, &minor); - if (retval) { - dbg ("get_major_minor failed"); - goto exit; - } - - sysfs_close_class_device(class_dev); - - return create_node(attr.name, type, major, minor, attr.mode); - -exit: - return retval; -} - -static int remove_device(char *device) -{ - char *name; - int retval = 0; - - name = get_name(device, 0, 0); - if (name == NULL) { - dbg ("get_name failed"); - retval = -ENODEV; - goto exit; - } - - return delete_node(name); - -exit: - return retval; -} - -static int udev_init(void) -{ - int retval; - - retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); - dbg("sysfs_path = %s", sysfs_path); - return retval; -} - int main(int argc, char *argv[]) { char *action; char *device; + char *subsystem; int retval = -EINVAL; if (argc != 2) { @@ -271,6 +63,8 @@ int main(int argc, char *argv[]) goto exit; } + subsystem = argv[1]; + device = get_device(); if (!device) { dbg ("no device?"); @@ -284,14 +78,12 @@ int main(int argc, char *argv[]) dbg("not block or class"); goto exit; } - - /* sleep for a second or two to give the kernel a chance to - * create the dev file - */ - sleep(1); - udev_init(); - namedev_init(); + /* but we don't care about net class devices */ + if (strcmp(subsystem, "net") == 0) { + dbg("don't care about net devices"); + goto exit; + } action = get_action(); if (!action) { @@ -299,16 +91,18 @@ int main(int argc, char *argv[]) goto exit; } + /* initialize the naming deamon */ + namedev_init(); + if (strcmp(action, "add") == 0) - return add_device(device, argv[1]); + return udev_add_device(device, argv[1]); if (strcmp(action, "remove") == 0) - return remove_device(device); + return udev_remove_device(device, argv[1]); dbg("Unknown action: %s", action); - return -EINVAL; + retval = -EINVAL; - retval = 0; exit: return retval; } diff --git a/udev.h b/udev.h index 56eb0d7edb..59c374365e 100644 --- a/udev.h +++ b/udev.h @@ -63,6 +63,8 @@ struct device_attr { int mode; }; +extern int udev_add_device(char *device, char *subsystem); +extern int udev_remove_device(char *device, char *subsystem); #endif -- cgit v1.2.3-54-g00ecf From 405f634279bb31c4aa3bc70a2139ff638f2659b8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 23 Jul 2003 18:55:55 -0400 Subject: [PATCH] split the tests up into different files. --- test | 10 ---------- test.block | 10 ++++++++++ test.tty | 10 ++++++++++ 3 files changed, 20 insertions(+), 10 deletions(-) delete mode 100644 test create mode 100644 test.block create mode 100644 test.tty diff --git a/test b/test deleted file mode 100644 index f5e808b557..0000000000 --- a/test +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -export ACTION=add -#export ACTION=remove -export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.1/ttyUSB7 -export DEVPATH=/class/tty/ttyUSB0 -export DEVPATH=/block/hda - - -./udev block -#./udev tty diff --git a/test.block b/test.block new file mode 100644 index 0000000000..f5e808b557 --- /dev/null +++ b/test.block @@ -0,0 +1,10 @@ +#!/bin/sh +export ACTION=add +#export ACTION=remove +export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.1/ttyUSB7 +export DEVPATH=/class/tty/ttyUSB0 +export DEVPATH=/block/hda + + +./udev block +#./udev tty diff --git a/test.tty b/test.tty new file mode 100644 index 0000000000..2d64f07d3e --- /dev/null +++ b/test.tty @@ -0,0 +1,10 @@ +#!/bin/sh +export ACTION=add +#export ACTION=remove +export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.1/ttyUSB7 +export DEVPATH=/class/tty/ttyUSB0 +#export DEVPATH=/block/hda + + +#./udev block +./udev tty -- cgit v1.2.3-54-g00ecf From b4c1dcf91277425371f7be4b9f8d28ef5d1e8910 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 23 Jul 2003 18:56:14 -0400 Subject: [PATCH] block test --- test.block | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test.block b/test.block index f5e808b557..675fbc057a 100644 --- a/test.block +++ b/test.block @@ -1,10 +1,8 @@ #!/bin/sh export ACTION=add #export ACTION=remove -export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.1/ttyUSB7 -export DEVPATH=/class/tty/ttyUSB0 + export DEVPATH=/block/hda ./udev block -#./udev tty -- cgit v1.2.3-54-g00ecf From cb32ac946fe3606fa5bfeb0b26589a3b0f2e0c45 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 23 Jul 2003 18:56:56 -0400 Subject: [PATCH] make struct config_device contain a struct device_attr instead of duplicating the mess. --- namedev.c | 101 ++++++++++++++++++++------------------------------------------ namedev.h | 34 +++++++++++++++++++++ 2 files changed, 67 insertions(+), 68 deletions(-) diff --git a/namedev.c b/namedev.c index b6d9a7f8e2..8b7edb7fb1 100644 --- a/namedev.c +++ b/namedev.c @@ -41,41 +41,6 @@ #define TYPE_TOPOLOGY "TOPOLOGY" #define TYPE_REPLACE "REPLACE" -enum config_type { - KERNEL_NAME = 0, /* must be 0 to let memset() default to this value */ - LABEL = 1, - NUMBER = 2, - TOPOLOGY = 3, - REPLACE = 4, -}; - -#define BUS_SIZE 30 -#define FILE_SIZE 50 -#define VALUE_SIZE 100 -#define ID_SIZE 50 -#define PLACE_SIZE 50 - - -struct config_device { - struct list_head node; - - enum config_type type; - - char bus[BUS_SIZE]; - char sysfs_file[FILE_SIZE]; - char sysfs_value[VALUE_SIZE]; - char id[ID_SIZE]; - char place[PLACE_SIZE]; - char kernel_name[NAME_SIZE]; - - /* what to set the device to */ - int mode; - char name[NAME_SIZE]; - char owner[OWNER_SIZE]; - char group[GROUP_SIZE]; -}; - - static LIST_HEAD(config_device_list); static void dump_dev(struct config_device *dev) @@ -84,32 +49,32 @@ static void dump_dev(struct config_device *dev) case KERNEL_NAME: dbg("KERNEL name ='%s'" " owner = '%s', group = '%s', mode = '%#o'", - dev->name, - dev->owner, dev->group, dev->mode); + dev->attr.name, + dev->attr.owner, dev->attr.group, dev->attr.mode); break; case LABEL: dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" " owner = '%s', group = '%s', mode = '%#o'", - dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value, - dev->owner, dev->group, dev->mode); + dev->attr.name, dev->bus, dev->sysfs_file, dev->sysfs_value, + dev->attr.owner, dev->attr.group, dev->attr.mode); break; case NUMBER: dbg("NUMBER name = '%s', bus = '%s', id = '%s'" " owner = '%s', group = '%s', mode = '%#o'", - dev->name, dev->bus, dev->id, - dev->owner, dev->group, dev->mode); + dev->attr.name, dev->bus, dev->id, + dev->attr.owner, dev->attr.group, dev->attr.mode); break; case TOPOLOGY: dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'" " owner = '%s', group = '%s', mode = '%#o'", - dev->name, dev->bus, dev->place, - dev->owner, dev->group, dev->mode); + dev->attr.name, dev->bus, dev->place, + dev->attr.owner, dev->attr.group, dev->attr.mode); break; case REPLACE: dbg("REPLACE name = %s, kernel_name = %s" " owner = '%s', group = '%s', mode = '%#o'", - dev->name, dev->kernel_name, - dev->owner, dev->group, dev->mode); + dev->attr.name, dev->kernel_name, + dev->attr.owner, dev->attr.group, dev->attr.mode); break; default: dbg("Unknown type of device!"); @@ -133,18 +98,18 @@ static int add_dev(struct config_device *new_dev) * this one... */ list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); - if (strcmp(dev->name, new_dev->name) == 0) { + if (strcmp(dev->attr.name, new_dev->attr.name) == 0) { /* the same, copy the new info into this structure */ copy_var(dev, new_dev, type); - copy_var(dev, new_dev, mode); + copy_var(dev, new_dev, attr.mode); copy_string(dev, new_dev, bus); copy_string(dev, new_dev, sysfs_file); copy_string(dev, new_dev, sysfs_value); copy_string(dev, new_dev, id); copy_string(dev, new_dev, place); copy_string(dev, new_dev, kernel_name); - copy_string(dev, new_dev, owner); - copy_string(dev, new_dev, group); + copy_string(dev, new_dev, attr.owner); + copy_string(dev, new_dev, attr.group); return 0; } } @@ -286,9 +251,9 @@ static int namedev_init_config(void) retval = get_value("NAME", &temp, &temp3); if (retval) continue; - strcpy(dev.name, temp3); + strcpy(dev.attr.name, temp3); - dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'", dev.name, dev.bus, dev.sysfs_file, dev.sysfs_value); + dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'", dev.attr.name, dev.bus, dev.sysfs_file, dev.sysfs_value); } if (strcasecmp(temp2, TYPE_NUMBER) == 0) { @@ -313,9 +278,9 @@ static int namedev_init_config(void) retval = get_value("NAME", &temp, &temp3); if (retval) continue; - strcpy(dev.name, temp3); + strcpy(dev.attr.name, temp3); - dbg("NUMBER name = '%s', bus = '%s', id = '%s'", dev.name, dev.bus, dev.id); + dbg("NUMBER name = '%s', bus = '%s', id = '%s'", dev.attr.name, dev.bus, dev.id); } if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { @@ -340,9 +305,9 @@ static int namedev_init_config(void) retval = get_value("NAME", &temp, &temp3); if (retval) continue; - strcpy(dev.name, temp3); + strcpy(dev.attr.name, temp3); - dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'", dev.name, dev.bus, dev.place); + dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'", dev.attr.name, dev.bus, dev.place); } if (strcasecmp(temp2, TYPE_REPLACE) == 0) { @@ -360,8 +325,8 @@ static int namedev_init_config(void) retval = get_value("NAME", &temp, &temp3); if (retval) continue; - strcpy(dev.name, temp3); - dbg("REPLACE name = %s, kernel_name = %s", dev.name, dev.kernel_name); + strcpy(dev.attr.name, temp3); + dbg("REPLACE name = %s, kernel_name = %s", dev.attr.name, dev.kernel_name); } retval = add_dev(&dev); @@ -420,17 +385,17 @@ static int namedev_init_permissions(void) /* parse the line */ temp2 = strsep(&temp, ":"); - strncpy(dev.name, temp2, sizeof(dev.name)); + strncpy(dev.attr.name, temp2, sizeof(dev.attr.name)); temp2 = strsep(&temp, ":"); - strncpy(dev.owner, temp2, sizeof(dev.owner)); + strncpy(dev.attr.owner, temp2, sizeof(dev.attr.owner)); temp2 = strsep(&temp, ":"); - strncpy(dev.group, temp2, sizeof(dev.owner)); + strncpy(dev.attr.group, temp2, sizeof(dev.attr.owner)); - dev.mode = strtol(temp, NULL, 8); + dev.attr.mode = strtol(temp, NULL, 8); - dbg("name = %s, owner = %s, group = %s, mode = %#o", dev.name, dev.owner, dev.group, dev.mode); + dbg("name = %s, owner = %s, group = %s, mode = %#o", dev.attr.name, dev.attr.owner, dev.attr.group, dev.attr.mode); retval = add_dev(&dev); if (retval) { dbg("add_dev returned with error %d", retval); @@ -457,13 +422,13 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); - if (strcmp(dev->name, class_dev->name) == 0) { - attr->mode = dev->mode; - strcpy(attr->owner, dev->owner); - strcpy(attr->group, dev->group); + if (strcmp(dev->attr.name, class_dev->name) == 0) { + attr->mode = dev->attr.mode; + strcpy(attr->owner, dev->attr.owner); + strcpy(attr->group, dev->attr.group); /* FIXME put the proper name here!!! */ - strcpy(attr->name, dev->name); - dbg("%s - owner = %s, group = %s, mode = %#o", dev->name, dev->owner, dev->group, dev->mode); + strcpy(attr->name, dev->attr.name); + dbg("%s - owner = %s, group = %s, mode = %#o", dev->attr.name, dev->attr.owner, dev->attr.group, dev->attr.mode); goto exit; } } diff --git a/namedev.h b/namedev.h index 0e3a819952..9d612dfe0c 100644 --- a/namedev.h +++ b/namedev.h @@ -23,6 +23,8 @@ #ifndef NAMEDEV_H #define NAMEDEV_H +#include "list.h" + struct sysfs_class_device; /* namedev config files */ @@ -31,6 +33,38 @@ struct sysfs_class_device; #define NAMEDEV_CONFIG_PERMISSION_FILE "namedev.permissions" #define NAMEDEV_CONFIG_FILE "namedev.config" +enum config_type { + KERNEL_NAME = 0, /* must be 0 to let memset() default to this value */ + LABEL = 1, + NUMBER = 2, + TOPOLOGY = 3, + REPLACE = 4, +}; + +#define BUS_SIZE 30 +#define FILE_SIZE 50 +#define VALUE_SIZE 100 +#define ID_SIZE 50 +#define PLACE_SIZE 50 + + +struct config_device { + struct list_head node; + + enum config_type type; + + char bus[BUS_SIZE]; + char sysfs_file[FILE_SIZE]; + char sysfs_value[VALUE_SIZE]; + char id[ID_SIZE]; + char place[PLACE_SIZE]; + char kernel_name[NAME_SIZE]; + + /* what to set the device to */ + struct device_attr attr; +}; + + extern int namedev_init(void); extern int namedev_name_device(struct sysfs_class_device *class_dev, struct device_attr *attr); -- cgit v1.2.3-54-g00ecf From c18d70b4474ef226f06e97bd50dd1c10c494b540 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 23 Jul 2003 22:08:16 -0400 Subject: [PATCH] got REPLACE to work properly. --- namedev.c | 39 +++++++++++++++++++++++++++++++++------ namedev.config | 1 + 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/namedev.c b/namedev.c index 8b7edb7fb1..e1958b5d9f 100644 --- a/namedev.c +++ b/namedev.c @@ -419,18 +419,45 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at { struct list_head *tmp; int retval = 0; + int found; list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); - if (strcmp(dev->attr.name, class_dev->name) == 0) { + switch (dev->type) { + case LABEL: + dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" + " owner = '%s', group = '%s', mode = '%#o'", + dev->attr.name, dev->bus, dev->sysfs_file, dev->sysfs_value, + dev->attr.owner, dev->attr.group, dev->attr.mode); + break; + case NUMBER: + dbg("NUMBER name = '%s', bus = '%s', id = '%s'" + " owner = '%s', group = '%s', mode = '%#o'", + dev->attr.name, dev->bus, dev->id, + dev->attr.owner, dev->attr.group, dev->attr.mode); + break; + case TOPOLOGY: + dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'" + " owner = '%s', group = '%s', mode = '%#o'", + dev->attr.name, dev->bus, dev->place, + dev->attr.owner, dev->attr.group, dev->attr.mode); + break; + case REPLACE: + if (strcmp(dev->kernel_name, class_dev->name) != 0) + continue; + strcpy(attr->name, dev->attr.name); attr->mode = dev->attr.mode; strcpy(attr->owner, dev->attr.owner); strcpy(attr->group, dev->attr.group); - /* FIXME put the proper name here!!! */ - strcpy(attr->name, dev->attr.name); - dbg("%s - owner = %s, group = %s, mode = %#o", dev->attr.name, dev->attr.owner, dev->attr.group, dev->attr.mode); - goto exit; - } + dbg("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->kernel_name, attr->name, + dev->attr.owner, dev->attr.group, dev->attr.mode); + return retval; + break; + default: + dbg("Unknown type of device!"); + break; + } } attr->mode = get_default_mode(class_dev); attr->owner[0] = 0x00; diff --git a/namedev.config b/namedev.config index a26562342c..de7a56119e 100644 --- a/namedev.config +++ b/namedev.config @@ -18,4 +18,5 @@ TOPOLOGY, BUS="usb", place="2.2", NAME="mouse1" # ttyUSB1 should always be called visor REPLACE, KERNEL="ttyUSB1", NAME="visor" +REPLACE, KERNEL="ttyUSB0", NAME="pl2303" -- cgit v1.2.3-54-g00ecf From 20051a5be96f731291705d6dce5bf3de7567d6a3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 23 Jul 2003 23:20:58 -0400 Subject: [PATCH] added topology support. --- namedev.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/namedev.c b/namedev.c index e1958b5d9f..b0f1f281b1 100644 --- a/namedev.c +++ b/namedev.c @@ -421,6 +421,8 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at int retval = 0; int found; + dbg("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path); + dbg("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); switch (dev->type) { @@ -437,11 +439,37 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at dev->attr.owner, dev->attr.group, dev->attr.mode); break; case TOPOLOGY: - dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'" - " owner = '%s', group = '%s', mode = '%#o'", - dev->attr.name, dev->bus, dev->place, + { + char path[SYSFS_PATH_MAX]; + char *temp; + + found = 0; + strcpy(path, class_dev->sysdevice->directory->path); + temp = strrchr(path, '/'); + dbg("TOPOLOGY path = '%s'", path); + dbg("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); + if (strstr(temp, dev->place) != NULL) { + found = 1; + } else { + *temp = 0x00; + temp = strrchr(path, '/'); + dbg("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); + if (strstr(temp, dev->place) != NULL) + found = 1; + } + if (!found) + continue; + + strcpy(attr->name, dev->attr.name); + attr->mode = dev->attr.mode; + strcpy(attr->owner, dev->attr.owner); + strcpy(attr->group, dev->attr.group); + dbg("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->place, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); + return retval; break; + } case REPLACE: if (strcmp(dev->kernel_name, class_dev->name) != 0) continue; @@ -463,7 +491,6 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at attr->owner[0] = 0x00; attr->group[0] = 0x00; strcpy(attr->name, class_dev->name); -exit: return retval; } -- cgit v1.2.3-54-g00ecf From 8a6fbab6dd2ae52f4bf7edc25077948cc5f15a7d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 23 Jul 2003 23:37:27 -0400 Subject: [PATCH] add NUMBER support (basically same logic as TOPOLOGY, perhaps we should merge this...) --- namedev.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/namedev.c b/namedev.c index b0f1f281b1..d5f83c5bc2 100644 --- a/namedev.c +++ b/namedev.c @@ -433,11 +433,37 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at dev->attr.owner, dev->attr.group, dev->attr.mode); break; case NUMBER: - dbg("NUMBER name = '%s', bus = '%s', id = '%s'" - " owner = '%s', group = '%s', mode = '%#o'", - dev->attr.name, dev->bus, dev->id, + { + char path[SYSFS_PATH_MAX]; + char *temp; + + found = 0; + strcpy(path, class_dev->sysdevice->directory->path); + temp = strrchr(path, '/'); + dbg("NUMBER path = '%s'", path); + dbg("NUMBER temp = '%s' id = '%s'", temp, dev->id); + if (strstr(temp, dev->id) != NULL) { + found = 1; + } else { + *temp = 0x00; + temp = strrchr(path, '/'); + dbg("TOPOLOGY temp = '%s' id = '%s'", temp, dev->id); + if (strstr(temp, dev->id) != NULL) + found = 1; + } + if (!found) + continue; + + strcpy(attr->name, dev->attr.name); + attr->mode = dev->attr.mode; + strcpy(attr->owner, dev->attr.owner); + strcpy(attr->group, dev->attr.group); + dbg("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->id, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); + return retval; break; + } case TOPOLOGY: { char path[SYSFS_PATH_MAX]; -- cgit v1.2.3-54-g00ecf From fa39f0990a563c89cf65baaf400552de3ba49ac6 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 23 Jul 2003 23:37:43 -0400 Subject: [PATCH] test config file changes... --- namedev.config | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/namedev.config b/namedev.config index de7a56119e..abff870103 100644 --- a/namedev.config +++ b/namedev.config @@ -13,10 +13,11 @@ NUMBER, BUS="pci", id="00:07.1", NAME="dsp1" # USB mouse plugged into the third port of the first hub to be called mouse0 TOPOLOGY, BUS="usb", place="1.3", NAME="mouse0" -# USB tablet plugged into the second port of the second hub to be called mouse1 -TOPOLOGY, BUS="usb", place="2.2", NAME="mouse1" +# USB tablet plugged into the third port of the second hub to be called mouse1 +TOPOLOGY, BUS="usb", place="2.3", NAME="mouse1" +TOPOLOGY, BUS="usb", place="2.4", NAME="mouse2" # ttyUSB1 should always be called visor REPLACE, KERNEL="ttyUSB1", NAME="visor" -REPLACE, KERNEL="ttyUSB0", NAME="pl2303" +#REPLACE, KERNEL="ttyUSB0", NAME="pl2303" -- cgit v1.2.3-54-g00ecf From 03e64c8f8cc426d80db00291821cd6b645f20e05 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 24 Jul 2003 10:27:06 -0400 Subject: [PATCH] start working on label support, and fix some segfaults for block devices. --- namedev.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 87 insertions(+), 5 deletions(-) diff --git a/namedev.c b/namedev.c index d5f83c5bc2..b8243682a7 100644 --- a/namedev.c +++ b/namedev.c @@ -421,23 +421,101 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at int retval = 0; int found; - dbg("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path); - dbg("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); + if (class_dev->sysdevice) { + dbg("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path); + dbg("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); + } else { + dbg("class_dev->name = '%s'", class_dev->name); + } list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); switch (dev->type) { case LABEL: - dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" + { + char *temp; + + dbg("LABEL: match file '%s' with value '%s'", dev->sysfs_file, dev->sysfs_value); + /* try to find the attribute in the class device directory */ + temp = sysfs_get_value_from_attributes(class_dev->directory->attributes, dev->sysfs_file); + if (temp) + goto label_found; + + /* look in the class device device directory if present */ + if (class_dev->sysdevice) { + temp = sysfs_get_value_from_attributes(class_dev->sysdevice->directory->attributes, dev->sysfs_file); + if (temp) + goto label_found; + } + + /* bah, let's go backwards up a level to see if the device is there, + * as block partitions don't point to the physical device. Need to fix that + * up in the kernel... + */ + if (strstr(class_dev->directory->path, "block")) { + dbg("looking at block device..."); + if (isdigit(class_dev->directory->path[strlen(class_dev->directory->path)-1])) { + char path[SYSFS_PATH_MAX]; + struct sysfs_class_device *class_dev_parent; + + dbg("really is a partition..."); + strcpy(path, class_dev->directory->path); + temp = strrchr(path, '/'); + *temp = 0x00; + dbg("looking for a class device at '%s'", path); + class_dev_parent = sysfs_open_class_device(path); + if (class_dev_parent == NULL) { + dbg ("sysfs_open_class_device failed"); + continue; + } + dbg("class_dev_parent->name = %s", class_dev_parent->name); + + /* try to find the attribute in the class device directory */ + temp = sysfs_get_value_from_attributes(class_dev_parent->directory->attributes, dev->sysfs_file); + if (temp) { + //sysfs_close_class_device(class_dev_parent); + goto label_found; + } + + /* look in the class device device directory if present */ + if (class_dev_parent->sysdevice) { + temp = sysfs_get_value_from_attributes(class_dev_parent->sysdevice->directory->attributes, dev->sysfs_file); + if (temp) { + // sysfs_close_class_device(class_dev_parent); + goto label_found; + } + } + + } + } + continue; + +label_found: + dbg("file '%s' found with value '%s'", dev->sysfs_file, temp); + if (strcmp(dev->sysfs_value, temp) != 0) + continue; + + strcpy(attr->name, dev->attr.name); + attr->mode = dev->attr.mode; + strcpy(attr->owner, dev->attr.owner); + strcpy(attr->group, dev->attr.group); + dbg("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->sysfs_file, dev->sysfs_value, attr->name, + dev->attr.owner, dev->attr.group, dev->attr.mode); + return retval; +dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" " owner = '%s', group = '%s', mode = '%#o'", dev->attr.name, dev->bus, dev->sysfs_file, dev->sysfs_value, dev->attr.owner, dev->attr.group, dev->attr.mode); break; + } case NUMBER: { char path[SYSFS_PATH_MAX]; char *temp; - found = 0; + found = 0; + if (!class_dev->sysdevice) + continue; strcpy(path, class_dev->sysdevice->directory->path); temp = strrchr(path, '/'); dbg("NUMBER path = '%s'", path); @@ -469,6 +547,8 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at char path[SYSFS_PATH_MAX]; char *temp; + if (!class_dev->sysdevice) + continue; found = 0; strcpy(path, class_dev->sysdevice->directory->path); temp = strrchr(path, '/'); @@ -508,8 +588,10 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at dev->attr.owner, dev->attr.group, dev->attr.mode); return retval; break; + case KERNEL_NAME: + break; default: - dbg("Unknown type of device!"); + dbg("Unknown type of device '%d'", dev->type); break; } } -- cgit v1.2.3-54-g00ecf From cee360d32efd8392f7e342dcaeda1de50a2c1bcf Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 24 Jul 2003 19:59:52 -0400 Subject: [PATCH] added 0.2 change log info. --- ChangeLog | 11 +++++++++-- Makefile | 2 +- README | 4 +--- TODO | 2 ++ 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8b5da0f1d..a0bd85174b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,2 +1,9 @@ -0.1 - Added a bit of documentation to the README and TODO files. -0.01 - initial release +0.2 - added namedev + now used a snapshot of libsysfs. + Can now handle the 5 different naming schemes. + Was released based on my OLS 2003 presentation. + Lots still left to do, but it kinda works better... + +0.1 - Added a bit of documentation to the README and TODO files. + +0.01 - initial release diff --git a/Makefile b/Makefile index 989eb403bf..b1adf3456c 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 0.1 +VERSION = 0.2 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/README b/README index 1a46a3c1ee..07fa162bbd 100644 --- a/README +++ b/README @@ -8,9 +8,7 @@ To use: - Edit the udev.h file and replace the following variables with values that make sense for your system: - #define SYSFS_ROOT "/sys" - #define UDEV_ROOT "/home/greg/linux/udev/" - #define DEV_FILE "/dev" + #define UDEV_ROOT "/udev/" #define MKNOD "/bin/mknod" The only value most people will have to change is the UDEV_ROOT variable, as I doubt you really want device nodes to be created in my diff --git a/TODO b/TODO index 1f776b9142..0bcaf2cc24 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,8 @@ - use mknod(2) and not execute mknod(1) - add klibc to the build process (or make it easier to do) to get smaller binary +- document the config file format (it will change over time...) +- persistant naming database backend - make program work like design says it should (three parts, not 1) - add hooks to call D-BUS when new node is created or removed - lots of other stuff... -- cgit v1.2.3-54-g00ecf From ea70388c3c21b6da592a859013b8e6aa071f6512 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 24 Jul 2003 20:00:17 -0400 Subject: [PATCH] removed unneeded stuff from udev.h --- udev.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/udev.h b/udev.h index 59c374365e..3c3c3d5de7 100644 --- a/udev.h +++ b/udev.h @@ -37,15 +37,9 @@ /* Lots of constants that should be in a config file sometime */ -/* Location of sysfs mount */ -#define SYSFS_ROOT "/sys" - /* Where udev should create its device nodes, trailing / needed */ #define UDEV_ROOT "/udev/" -/* device file in sysfs that contains major/minor number, leading / needed */ -#define DEV_FILE "/dev" - /* Binaries that udev calls to do stuff */ #define MKNOD "/bin/mknod" -- cgit v1.2.3-54-g00ecf From 08daec117c109d53df85c07d250bdd9ce7a9f263 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 24 Jul 2003 20:00:32 -0400 Subject: [PATCH] more test stuff... --- namedev.config | 3 +++ test.block | 2 ++ 2 files changed, 5 insertions(+) diff --git a/namedev.config b/namedev.config index abff870103..a0c6f9d1e8 100644 --- a/namedev.config +++ b/namedev.config @@ -1,3 +1,6 @@ +# My usb camera... +LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera" + # USB Epson printer to be called lp_epson LABEL, BUS="usb", serial="HXOLL0012202323480", NAME="lp_epson" diff --git a/test.block b/test.block index 675fbc057a..3e198fe4b6 100644 --- a/test.block +++ b/test.block @@ -3,6 +3,8 @@ export ACTION=add #export ACTION=remove export DEVPATH=/block/hda +export DEVPATH=/block/sda/sda1 +export DEVPATH=/block/sda ./udev block -- cgit v1.2.3-54-g00ecf From 615e05f84a36b948959a01c58738f00109f9de0a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 25 Jul 2003 07:01:48 -0400 Subject: [PATCH] oops, everything was getting created as 000 mode, try to fix this up, --- namedev.c | 65 +++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 40 insertions(+), 25 deletions(-) diff --git a/namedev.c b/namedev.c index b8243682a7..d8dba345d1 100644 --- a/namedev.c +++ b/namedev.c @@ -421,6 +421,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at int retval = 0; int found; + attr->mode = -1; if (class_dev->sysdevice) { dbg("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path); dbg("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); @@ -488,24 +489,28 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at } } continue; - + label_found: - dbg("file '%s' found with value '%s'", dev->sysfs_file, temp); + temp[strlen(temp)-1] = 0x00; + dbg("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, temp, dev->sysfs_value); if (strcmp(dev->sysfs_value, temp) != 0) continue; strcpy(attr->name, dev->attr.name); - attr->mode = dev->attr.mode; - strcpy(attr->owner, dev->attr.owner); - strcpy(attr->group, dev->attr.group); + if (isdigit(class_dev->directory->path[strlen(class_dev->directory->path)-1])) { + temp[0] = class_dev->directory->path[strlen(class_dev->directory->path)-1]; + temp[1] = 0x00; + strcat(attr->name, temp); + } + if (dev->attr.mode != 0) { + attr->mode = dev->attr.mode; + strcpy(attr->owner, dev->attr.owner); + strcpy(attr->group, dev->attr.group); + } dbg("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->sysfs_file, dev->sysfs_value, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); - return retval; -dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" - " owner = '%s', group = '%s', mode = '%#o'", - dev->attr.name, dev->bus, dev->sysfs_file, dev->sysfs_value, - dev->attr.owner, dev->attr.group, dev->attr.mode); + goto done; break; } case NUMBER: @@ -533,13 +538,15 @@ dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" continue; strcpy(attr->name, dev->attr.name); - attr->mode = dev->attr.mode; - strcpy(attr->owner, dev->attr.owner); - strcpy(attr->group, dev->attr.group); + if (dev->attr.mode != 0) { + attr->mode = dev->attr.mode; + strcpy(attr->owner, dev->attr.owner); + strcpy(attr->group, dev->attr.group); + } dbg("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->id, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); - return retval; + goto done; break; } case TOPOLOGY: @@ -567,26 +574,30 @@ dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" continue; strcpy(attr->name, dev->attr.name); - attr->mode = dev->attr.mode; - strcpy(attr->owner, dev->attr.owner); - strcpy(attr->group, dev->attr.group); + if (dev->attr.mode != 0) { + attr->mode = dev->attr.mode; + strcpy(attr->owner, dev->attr.owner); + strcpy(attr->group, dev->attr.group); + } dbg("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->place, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); - return retval; + goto done; break; } case REPLACE: if (strcmp(dev->kernel_name, class_dev->name) != 0) continue; strcpy(attr->name, dev->attr.name); - attr->mode = dev->attr.mode; - strcpy(attr->owner, dev->attr.owner); - strcpy(attr->group, dev->attr.group); + if (dev->attr.mode != 0) { + attr->mode = dev->attr.mode; + strcpy(attr->owner, dev->attr.owner); + strcpy(attr->group, dev->attr.group); + } dbg("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->kernel_name, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); - return retval; + goto done; break; case KERNEL_NAME: break; @@ -595,10 +606,14 @@ dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" break; } } - attr->mode = get_default_mode(class_dev); - attr->owner[0] = 0x00; - attr->group[0] = 0x00; strcpy(attr->name, class_dev->name); + +done: + if (attr->mode == -1) { + attr->mode = get_default_mode(class_dev); + attr->owner[0] = 0x00; + attr->group[0] = 0x00; + } return retval; } -- cgit v1.2.3-54-g00ecf From ea256f901e30927591874ee3eb5b92e1ce5a5db1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 4 Aug 2003 21:20:19 -0700 Subject: [PATCH] handle new major:minor format of dev files that showed up in 2.6.0-test2-bk3 or so. --- udev-add.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/udev-add.c b/udev-add.c index 45ffbf81b5..54af7e4d77 100644 --- a/udev-add.c +++ b/udev-add.c @@ -49,30 +49,23 @@ static char sysfs_path[SYSFS_PATH_MAX]; */ static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor) { - char temp[3]; - int retval = 0; + int retval = -ENODEV; char *dev; dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev"); if (dev == NULL) - return -ENODEV; + goto exit; dbg("dev = %s", dev); - temp[0] = dev[0]; - temp[1] = dev[1]; - temp[2] = 0x00; - *major = (int)strtol(&temp[0], NULL, 16); - - temp[0] = dev[2]; - temp[1] = dev[3]; - temp[2] = 0x00; - *minor = (int)strtol(&temp[0], NULL, 16); + if (sscanf(dev, "%u:%u", major, minor) != 2) + goto exit; dbg("found major = %d, minor = %d", *major, *minor); retval = 0; +exit: return retval; } -- cgit v1.2.3-54-g00ecf From 0abf54fc09030f404f5c7d724a0f30d3e875e980 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 4 Aug 2003 21:39:33 -0700 Subject: [PATCH] remove mknod callout Patch from "Guo, Min" --- udev-add.c | 47 +++++++++++++---------------------------------- 1 file changed, 13 insertions(+), 34 deletions(-) diff --git a/udev-add.c b/udev-add.c index 54af7e4d77..adbeb92425 100644 --- a/udev-add.c +++ b/udev-add.c @@ -74,45 +74,24 @@ exit: */ static int create_node(char *name, char type, int major, int minor, int mode) { - char *argv[7]; - char mode_string[100]; - char type_string[3]; - char major_string[20]; - char minor_string[20]; char filename[255]; int retval = 0; - strncpy(filename, UDEV_ROOT, sizeof(filename)); strncat(filename, name, sizeof(filename)); - - snprintf(mode_string, sizeof(mode_string), "--mode=%#o", mode); - snprintf(type_string, sizeof(type_string), "%c", type); - snprintf(major_string, sizeof(major_string), "%d", major); - snprintf(minor_string, sizeof(minor_string), "%d", minor); - - argv[0] = MKNOD; - argv[1] = mode_string; - argv[2] = filename; - argv[3] = type_string; - argv[4] = major_string; - argv[5] = minor_string; - argv[6] = NULL; - dbg ("executing %s %s %s %s %s %s", - argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]); - switch (fork()) { - case 0: - /* we are the child, so lets run the program */ - execv (MKNOD, argv); - exit(0); - break; - case (-1): - dbg ("fork failed."); - retval = -EFAULT; - break; - default: - break; - } + if (type == 'b') { + mode |= S_IFBLK; + } else if ((type == 'c') || (type == 'u')){ + mode |= S_IFCHR; + } else if ( type == 'p') { + mode |= S_IFIFO; + } else { + dbg("unknown node type %c\n", type); + return -1; + } + + retval = mknod(filename,mode,makedev(major,minor)); return retval; + } struct sysfs_class_device *get_class_dev(char *device_name) -- cgit v1.2.3-54-g00ecf From 1331c889c33a91f098fa7257488046e81241225c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 4 Aug 2003 21:59:50 -0700 Subject: [PATCH] cleanup the mknod code a bit. --- udev-add.c | 29 ++++++++++++++++++----------- udev.h | 3 --- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/udev-add.c b/udev-add.c index adbeb92425..10df31458d 100644 --- a/udev-add.c +++ b/udev-add.c @@ -78,20 +78,27 @@ static int create_node(char *name, char type, int major, int minor, int mode) int retval = 0; strncpy(filename, UDEV_ROOT, sizeof(filename)); strncat(filename, name, sizeof(filename)); - if (type == 'b') { - mode |= S_IFBLK; - } else if ((type == 'c') || (type == 'u')){ - mode |= S_IFCHR; - } else if ( type == 'p') { - mode |= S_IFIFO; - } else { - dbg("unknown node type %c\n", type); - return -1; - } + switch (type) { + case 'b': + mode |= S_IFBLK; + break; + case 'c': + case 'u': + mode |= S_IFCHR; + break; + case 'p': + mode |= S_IFIFO; + break; + default: + dbg("unknown node type %c\n", type); + return -EINVAL; + } retval = mknod(filename,mode,makedev(major,minor)); + if (retval) + dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", + filename, mode, major, minor, strerror(errno)); return retval; - } struct sysfs_class_device *get_class_dev(char *device_name) diff --git a/udev.h b/udev.h index 3c3c3d5de7..590a8ed039 100644 --- a/udev.h +++ b/udev.h @@ -40,9 +40,6 @@ /* Where udev should create its device nodes, trailing / needed */ #define UDEV_ROOT "/udev/" -/* Binaries that udev calls to do stuff */ -#define MKNOD "/bin/mknod" - extern int log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -- cgit v1.2.3-54-g00ecf From 63dde9f8eb9a204771be7cc3219d53ee7a0d5ffb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 4 Aug 2003 22:13:35 -0700 Subject: [PATCH] minor cleanups. --- udev-add.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/udev-add.c b/udev-add.c index 10df31458d..586815e2c7 100644 --- a/udev-add.c +++ b/udev-add.c @@ -34,8 +34,6 @@ #include "libsysfs/libsysfs.h" -static char sysfs_path[SYSFS_PATH_MAX]; - /* * Right now the major/minor of a device is stored in a file called * "dev" in sysfs. @@ -103,8 +101,18 @@ static int create_node(char *name, char type, int major, int minor, int mode) struct sysfs_class_device *get_class_dev(char *device_name) { + char sysfs_path[SYSFS_PATH_MAX]; char dev_path[SYSFS_PATH_MAX]; - struct sysfs_class_device *class_dev; + int retval; + struct sysfs_class_device *class_dev = NULL; + + + retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); + dbg("sysfs_path = %s", sysfs_path); + if (retval) { + dbg("sysfs_get_mnt_path failed"); + goto exit; + } strcpy(dev_path, sysfs_path); strcat(dev_path, device_name); @@ -115,46 +123,34 @@ struct sysfs_class_device *get_class_dev(char *device_name) class_dev = sysfs_open_class_device(dev_path); if (class_dev == NULL) { dbg ("sysfs_open_class_device failed"); - return NULL; + goto exit; } dbg("class_dev->name = %s", class_dev->name); +exit: return class_dev; } -static int udev_init(void) -{ - int retval; - - retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); - dbg("sysfs_path = %s", sysfs_path); - return retval; -} - int udev_add_device(char *device, char *subsystem) { struct sysfs_class_device *class_dev; struct device_attr attr; - //char *name; int major; int minor; char type; - //int mode; int retval = -EINVAL; - /* sleep for a second or two to give the kernel a chance to - * create the dev file - */ - sleep(1); - - udev_init(); - /* for now, the block layer is the only place where block devices are */ if (strcmp(subsystem, "block") == 0) type = 'b'; else type = 'c'; + /* sleep for a second or two to give the kernel a chance to + * create the dev file + */ + sleep(1); + class_dev = get_class_dev(device); if (class_dev == NULL) goto exit; -- cgit v1.2.3-54-g00ecf From b137e367bb833ca82b396622997f512f5c856a41 Mon Sep 17 00:00:00 2001 From: "lethal@linux-sh.org" Date: Tue, 5 Aug 2003 01:10:01 -0700 Subject: [PATCH] udev/libsysfs cross compile fixes I noticed that libsysfs doesn't inherently grab cross compilation arguments that are set in the top-level Makefile, so I've come up with the following patch to fix this. With the patch, I can succesfully cross compile for other architectures (such as sh) by doing 'make ARCH=sh CROSS=sh-linux-' in the top-level directory. --- Makefile | 2 ++ libsysfs/Makefile | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b1adf3456c..a7bb01d247 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,9 @@ CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- CC = $(CROSS)gcc AR = $(CROSS)ar STRIP = $(CROSS)strip +RANLIB = $(CROSS)ranlib +export CROSS CC AR STRIP RANLIB # code taken from uClibc to determine the current arch ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ diff --git a/libsysfs/Makefile b/libsysfs/Makefile index cf07a842b6..79cc533959 100644 --- a/libsysfs/Makefile +++ b/libsysfs/Makefile @@ -1,8 +1,6 @@ # Makefile for libsysfs.a # Copyright (c) International Business Machines Corp., 2003 -CC=gcc - H_INCLUDE=../include LIB_INCLUDE=. OBJS=sysfs_bus.o sysfs_class.o sysfs_device.o sysfs_dir.o sysfs_driver.o \ @@ -19,8 +17,8 @@ LIBSYSFS=libsysfs.a RM=rm -f libsysfs.a: $(OBJS) - ar cru $(LIBSYSFS) $(OBJS) - ranlib $(LIBSYSFS) + $(AR) cru $(LIBSYSFS) $(OBJS) + $(RANLIB) $(LIBSYSFS) sysfs_bus.o: sysfs_bus.c $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_bus.c -- cgit v1.2.3-54-g00ecf From 3660f0b8ab54c79141a06b55ea617d7724042eae Mon Sep 17 00:00:00 2001 From: "lethal@linux-sh.org" Date: Tue, 5 Aug 2003 01:17:07 -0700 Subject: [PATCH] udev spec file Here's a relatively rudimentary patch that addes udev.spec. With this, you can rpm -ta the tarball and generate rpms. I've also attached the ones I build on my RH 7.3 host incase they are of interest to you. --- udev.spec | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 udev.spec diff --git a/udev.spec b/udev.spec new file mode 100644 index 0000000000..2a64fb31c2 --- /dev/null +++ b/udev.spec @@ -0,0 +1,36 @@ +Summary: A userspace implementation of devfs +Name: udev +Version: 0.2 +Release: 1 +License: GPL +Group: Utilities/System +Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.gz +ExclusiveOS: Linux +BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root + +%description +udev is a implementation of devfs in userspace using sysfs and +/sbin/hotplug. It requires a 2.5/2.6 kernel to run properly. + +%prep +%setup + +%build +make + +%install +mkdir -p $RPM_BUILD_ROOT/sbin +install -m 755 %{name} $RPM_BUILD_ROOT/sbin + +%clean +rm -fr $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%attr(755,root,root)/sbin/%{name} +%attr(-,root,root) %doc COPYING README TODO ChangeLog + +%changelog +* Mon Jul 28 2003 Paul Mundt +- Initial spec file for udev-0.2. + -- cgit v1.2.3-54-g00ecf From e09292061689b59da68f05eb7a74e353c283078f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 5 Aug 2003 01:18:46 -0700 Subject: [PATCH] added my name to the .spec file. --- udev.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/udev.spec b/udev.spec index 2a64fb31c2..fe6ca84cc3 100644 --- a/udev.spec +++ b/udev.spec @@ -6,6 +6,7 @@ License: GPL Group: Utilities/System Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.gz ExclusiveOS: Linux +Vendor: Greg Kroah-Hartman BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root %description -- cgit v1.2.3-54-g00ecf From 5ac4a56b39fed9d95850161864befe612b1a538e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 5 Aug 2003 01:26:59 -0700 Subject: [PATCH] Added tdb code from latest cvs version in the samba tree --- tdb/Makefile | 29 + tdb/README | 167 +++++ tdb/spinlock.c | 430 ++++++++++++ tdb/spinlock.h | 55 ++ tdb/tdb.c | 2043 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ tdb/tdb.h | 144 ++++ tdb/tdb.magic | 10 + tdb/tdbback.c | 201 ++++++ tdb/tdbback.h | 23 + tdb/tdbbackup.c | 137 ++++ tdb/tdbdump.c | 89 +++ tdb/tdbtest.c | 263 +++++++ tdb/tdbtool.c | 547 +++++++++++++++ tdb/tdbtorture.c | 226 ++++++ tdb/tdbutil.c | 830 ++++++++++++++++++++++ tdb/tdbutil.h | 37 + 16 files changed, 5231 insertions(+) create mode 100644 tdb/Makefile create mode 100644 tdb/README create mode 100644 tdb/spinlock.c create mode 100644 tdb/spinlock.h create mode 100644 tdb/tdb.c create mode 100644 tdb/tdb.h create mode 100644 tdb/tdb.magic create mode 100644 tdb/tdbback.c create mode 100644 tdb/tdbback.h create mode 100644 tdb/tdbbackup.c create mode 100644 tdb/tdbdump.c create mode 100644 tdb/tdbtest.c create mode 100644 tdb/tdbtool.c create mode 100644 tdb/tdbtorture.c create mode 100644 tdb/tdbutil.c create mode 100644 tdb/tdbutil.h diff --git a/tdb/Makefile b/tdb/Makefile new file mode 100644 index 0000000000..59fbb079bd --- /dev/null +++ b/tdb/Makefile @@ -0,0 +1,29 @@ +# +# Makefile for tdb directory +# + +CFLAGS = -DSTANDALONE -DTDB_DEBUG -g -DHAVE_MMAP=1 +CC = gcc + +PROGS = tdbtest tdbtool tdbtorture +TDB_OBJ = tdb.o spinlock.o + +default: $(PROGS) + +tdbtest: tdbtest.o $(TDB_OBJ) + $(CC) $(CFLAGS) -o tdbtest tdbtest.o $(TDB_OBJ) -lgdbm + +tdbtool: tdbtool.o $(TDB_OBJ) + $(CC) $(CFLAGS) -o tdbtool tdbtool.o $(TDB_OBJ) + +tdbtorture: tdbtorture.o $(TDB_OBJ) + $(CC) $(CFLAGS) -o tdbtorture tdbtorture.o $(TDB_OBJ) + +tdbdump: tdbdump.o $(TDB_OBJ) + $(CC) $(CFLAGS) -o tdbdump tdbdump.o $(TDB_OBJ) + +tdbbackup: tdbbackup.o $(TDB_OBJ) + $(CC) $(CFLAGS) -o tdbbackup tdbbackup.o $(TDB_OBJ) + +clean: + rm -f $(PROGS) *.o *~ *% core test.db test.tdb test.gdbm diff --git a/tdb/README b/tdb/README new file mode 100644 index 0000000000..fac3eacb4d --- /dev/null +++ b/tdb/README @@ -0,0 +1,167 @@ +tdb - a trivial database system +tridge@linuxcare.com December 1999 +================================== + +This is a simple database API. It was inspired by the realisation that +in Samba we have several ad-hoc bits of code that essentially +implement small databases for sharing structures between parts of +Samba. As I was about to add another I realised that a generic +database module was called for to replace all the ad-hoc bits. + +I based the interface on gdbm. I couldn't use gdbm as we need to be +able to have multiple writers to the databases at one time. + +Compilation +----------- + +add HAVE_MMAP=1 to use mmap instead of read/write +add TDB_DEBUG=1 for verbose debug info +add NOLOCK=1 to disable locking code + +Testing +------- + +Compile tdbtest.c and link with gdbm for testing. tdbtest will perform +identical operations via tdb and gdbm then make sure the result is the +same + +Also included is tdbtool, which allows simple database manipulation +on the commandline. + +tdbtest and tdbtool are not built as part of Samba, but are included +for completeness. + +Interface +--------- + +The interface is very similar to gdbm except for the following: + +- different open interface. The tdb_open call is more similar to a + traditional open() +- no tdbm_reorganise() function +- no tdbm_sync() function. No operations are cached in the library anyway +- added a tdb_traverse() function for traversing the whole database + +A general rule for using tdb is that the caller frees any returned +TDB_DATA structures. Just call free(p.dptr) to free a TDB_DATA +return value called p. This is the same as gdbm. + +here is a full list of tdb functions with brief descriptions. + + +---------------------------------------------------------------------- +TDB_CONTEXT *tdb_open(char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode) + + open the database, creating it if necessary + + The open_flags and mode are passed straight to the open call on the database + file. A flags value of O_WRONLY is invalid + + The hash size is advisory, use zero for a default value. + + return is NULL on error + + possible tdb_flags are: + TDB_CLEAR_IF_FIRST - clear database if we are the only one with it open + TDB_INTERNAL - don't use a file, instaed store the data in + memory. The filename is ignored in this case. + TDB_NOLOCK - don't do any locking + TDB_NOMMAP - don't use mmap + +---------------------------------------------------------------------- +char *tdb_error(TDB_CONTEXT *tdb); + + return a error string for the last tdb error + +---------------------------------------------------------------------- +int tdb_close(TDB_CONTEXT *tdb); + + close a database + +---------------------------------------------------------------------- +int tdb_update(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf); + + update an entry in place - this only works if the new data size + is <= the old data size and the key exists. + on failure return -1 + +---------------------------------------------------------------------- +TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key); + + fetch an entry in the database given a key + if the return value has a null dptr then a error occurred + + caller must free the resulting data + +---------------------------------------------------------------------- +int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key); + + check if an entry in the database exists + + note that 1 is returned if the key is found and 0 is returned if not found + this doesn't match the conventions in the rest of this module, but is + compatible with gdbm + +---------------------------------------------------------------------- +int tdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb, + TDB_DATA key, TDB_DATA dbuf, void *state), void *state); + + traverse the entire database - calling fn(tdb, key, data, state) on each + element. + + return -1 on error or the record count traversed + + if fn is NULL then it is not called + + a non-zero return value from fn() indicates that the traversal should stop + +---------------------------------------------------------------------- +TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb); + + find the first entry in the database and return its key + + the caller must free the returned data + +---------------------------------------------------------------------- +TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key); + + find the next entry in the database, returning its key + + the caller must free the returned data + +---------------------------------------------------------------------- +int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key); + + delete an entry in the database given a key + +---------------------------------------------------------------------- +int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); + + store an element in the database, replacing any existing element + with the same key + + If flag==TDB_INSERT then don't overwrite an existing entry + If flag==TDB_MODIFY then don't create a new entry + + return 0 on success, -1 on failure + +---------------------------------------------------------------------- +int tdb_writelock(TDB_CONTEXT *tdb); + + lock the database. If we already have it locked then don't do anything + +---------------------------------------------------------------------- +int tdb_writeunlock(TDB_CONTEXT *tdb); + unlock the database + +---------------------------------------------------------------------- +int tdb_lockchain(TDB_CONTEXT *tdb, TDB_DATA key); + + lock one hash chain. This is meant to be used to reduce locking + contention - it cannot guarantee how many records will be locked + +---------------------------------------------------------------------- +int tdb_unlockchain(TDB_CONTEXT *tdb, TDB_DATA key); + + unlock one hash chain diff --git a/tdb/spinlock.c b/tdb/spinlock.c new file mode 100644 index 0000000000..2370ce3bdd --- /dev/null +++ b/tdb/spinlock.c @@ -0,0 +1,430 @@ +/* + Unix SMB/CIFS implementation. + Samba database functions + Copyright (C) Anton Blanchard 2001 + + 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; either version 2 of the License, or + (at your option) any later version. + + 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 02139, USA. +*/ +#if HAVE_CONFIG_H +#include +#endif + +#if STANDALONE +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tdb.h" +#include "spinlock.h" + +#define DEBUG +#else +#include "includes.h" +#endif + +#ifdef USE_SPINLOCKS + +/* + * ARCH SPECIFIC + */ + +#if defined(SPARC_SPINLOCKS) + +static inline int __spin_trylock(spinlock_t *lock) +{ + unsigned int result; + + asm volatile("ldstub [%1], %0" + : "=r" (result) + : "r" (lock) + : "memory"); + + return (result == 0) ? 0 : EBUSY; +} + +static inline void __spin_unlock(spinlock_t *lock) +{ + asm volatile("":::"memory"); + *lock = 0; +} + +static inline void __spin_lock_init(spinlock_t *lock) +{ + *lock = 0; +} + +static inline int __spin_is_locked(spinlock_t *lock) +{ + return (*lock != 0); +} + +#elif defined(POWERPC_SPINLOCKS) + +static inline int __spin_trylock(spinlock_t *lock) +{ + unsigned int result; + + __asm__ __volatile__( +"1: lwarx %0,0,%1\n\ + cmpwi 0,%0,0\n\ + li %0,0\n\ + bne- 2f\n\ + li %0,1\n\ + stwcx. %0,0,%1\n\ + bne- 1b\n\ + isync\n\ +2:" : "=&r"(result) + : "r"(lock) + : "cr0", "memory"); + + return (result == 1) ? 0 : EBUSY; +} + +static inline void __spin_unlock(spinlock_t *lock) +{ + asm volatile("eieio":::"memory"); + *lock = 0; +} + +static inline void __spin_lock_init(spinlock_t *lock) +{ + *lock = 0; +} + +static inline int __spin_is_locked(spinlock_t *lock) +{ + return (*lock != 0); +} + +#elif defined(INTEL_SPINLOCKS) + +static inline int __spin_trylock(spinlock_t *lock) +{ + int oldval; + + asm volatile("xchgl %0,%1" + : "=r" (oldval), "=m" (*lock) + : "0" (0) + : "memory"); + + return oldval > 0 ? 0 : EBUSY; +} + +static inline void __spin_unlock(spinlock_t *lock) +{ + asm volatile("":::"memory"); + *lock = 1; +} + +static inline void __spin_lock_init(spinlock_t *lock) +{ + *lock = 1; +} + +static inline int __spin_is_locked(spinlock_t *lock) +{ + return (*lock != 1); +} + +#elif defined(MIPS_SPINLOCKS) + +static inline unsigned int load_linked(unsigned long addr) +{ + unsigned int res; + + __asm__ __volatile__("ll\t%0,(%1)" + : "=r" (res) + : "r" (addr)); + + return res; +} + +static inline unsigned int store_conditional(unsigned long addr, unsigned int value) +{ + unsigned int res; + + __asm__ __volatile__("sc\t%0,(%2)" + : "=r" (res) + : "0" (value), "r" (addr)); + return res; +} + +static inline int __spin_trylock(spinlock_t *lock) +{ + unsigned int mw; + + do { + mw = load_linked(lock); + if (mw) + return EBUSY; + } while (!store_conditional(lock, 1)); + + asm volatile("":::"memory"); + + return 0; +} + +static inline void __spin_unlock(spinlock_t *lock) +{ + asm volatile("":::"memory"); + *lock = 0; +} + +static inline void __spin_lock_init(spinlock_t *lock) +{ + *lock = 0; +} + +static inline int __spin_is_locked(spinlock_t *lock) +{ + return (*lock != 0); +} + +#else +#error Need to implement spinlock code in spinlock.c +#endif + +/* + * OS SPECIFIC + */ + +static void yield_cpu(void) +{ + struct timespec tm; + +#ifdef USE_SCHED_YIELD + sched_yield(); +#else + /* Linux will busy loop for delays < 2ms on real time tasks */ + tm.tv_sec = 0; + tm.tv_nsec = 2000000L + 1; + nanosleep(&tm, NULL); +#endif +} + +static int this_is_smp(void) +{ + return 0; +} + +/* + * GENERIC + */ + +static int smp_machine = 0; + +static inline void __spin_lock(spinlock_t *lock) +{ + int ntries = 0; + + while(__spin_trylock(lock)) { + while(__spin_is_locked(lock)) { + if (smp_machine && ntries++ < MAX_BUSY_LOOPS) + continue; + yield_cpu(); + } + } +} + +static void __read_lock(tdb_rwlock_t *rwlock) +{ + int ntries = 0; + + while(1) { + __spin_lock(&rwlock->lock); + + if (!(rwlock->count & RWLOCK_BIAS)) { + rwlock->count++; + __spin_unlock(&rwlock->lock); + return; + } + + __spin_unlock(&rwlock->lock); + + while(rwlock->count & RWLOCK_BIAS) { + if (smp_machine && ntries++ < MAX_BUSY_LOOPS) + continue; + yield_cpu(); + } + } +} + +static void __write_lock(tdb_rwlock_t *rwlock) +{ + int ntries = 0; + + while(1) { + __spin_lock(&rwlock->lock); + + if (rwlock->count == 0) { + rwlock->count |= RWLOCK_BIAS; + __spin_unlock(&rwlock->lock); + return; + } + + __spin_unlock(&rwlock->lock); + + while(rwlock->count != 0) { + if (smp_machine && ntries++ < MAX_BUSY_LOOPS) + continue; + yield_cpu(); + } + } +} + +static void __write_unlock(tdb_rwlock_t *rwlock) +{ + __spin_lock(&rwlock->lock); + +#ifdef DEBUG + if (!(rwlock->count & RWLOCK_BIAS)) + fprintf(stderr, "bug: write_unlock\n"); +#endif + + rwlock->count &= ~RWLOCK_BIAS; + __spin_unlock(&rwlock->lock); +} + +static void __read_unlock(tdb_rwlock_t *rwlock) +{ + __spin_lock(&rwlock->lock); + +#ifdef DEBUG + if (!rwlock->count) + fprintf(stderr, "bug: read_unlock\n"); + + if (rwlock->count & RWLOCK_BIAS) + fprintf(stderr, "bug: read_unlock\n"); +#endif + + rwlock->count--; + __spin_unlock(&rwlock->lock); +} + +/* TDB SPECIFIC */ + +/* lock a list in the database. list -1 is the alloc list */ +int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type) +{ + tdb_rwlock_t *rwlocks; + + if (!tdb->map_ptr) return -1; + rwlocks = (tdb_rwlock_t *)((char *)tdb->map_ptr + tdb->header.rwlocks); + + switch(rw_type) { + case F_RDLCK: + __read_lock(&rwlocks[list+1]); + break; + + case F_WRLCK: + __write_lock(&rwlocks[list+1]); + break; + + default: + return TDB_ERRCODE(TDB_ERR_LOCK, -1); + } + return 0; +} + +/* unlock the database. */ +int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type) +{ + tdb_rwlock_t *rwlocks; + + if (!tdb->map_ptr) return -1; + rwlocks = (tdb_rwlock_t *)((char *)tdb->map_ptr + tdb->header.rwlocks); + + switch(rw_type) { + case F_RDLCK: + __read_unlock(&rwlocks[list+1]); + break; + + case F_WRLCK: + __write_unlock(&rwlocks[list+1]); + break; + + default: + return TDB_ERRCODE(TDB_ERR_LOCK, -1); + } + + return 0; +} + +int tdb_create_rwlocks(int fd, unsigned int hash_size) +{ + unsigned size, i; + tdb_rwlock_t *rwlocks; + + size = (hash_size + 1) * sizeof(tdb_rwlock_t); + rwlocks = malloc(size); + if (!rwlocks) + return -1; + + for(i = 0; i < hash_size+1; i++) { + __spin_lock_init(&rwlocks[i].lock); + rwlocks[i].count = 0; + } + + /* Write it out (appending to end) */ + if (write(fd, rwlocks, size) != size) { + free(rwlocks); + return -1; + } + smp_machine = this_is_smp(); + free(rwlocks); + return 0; +} + +int tdb_clear_spinlocks(TDB_CONTEXT *tdb) +{ + tdb_rwlock_t *rwlocks; + unsigned i; + + if (tdb->header.rwlocks == 0) return 0; + if (!tdb->map_ptr) return -1; + + /* We're mmapped here */ + rwlocks = (tdb_rwlock_t *)((char *)tdb->map_ptr + tdb->header.rwlocks); + for(i = 0; i < tdb->header.hash_size+1; i++) { + __spin_lock_init(&rwlocks[i].lock); + rwlocks[i].count = 0; + } + return 0; +} +#else +int tdb_create_rwlocks(int fd, unsigned int hash_size) { return 0; } +int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type) { return -1; } +int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type) { return -1; } + +/* Non-spinlock version: remove spinlock pointer */ +int tdb_clear_spinlocks(TDB_CONTEXT *tdb) +{ + tdb_off off = (tdb_off)((char *)&tdb->header.rwlocks + - (char *)&tdb->header); + + tdb->header.rwlocks = 0; + if (lseek(tdb->fd, off, SEEK_SET) != off + || write(tdb->fd, (void *)&tdb->header.rwlocks, + sizeof(tdb->header.rwlocks)) + != sizeof(tdb->header.rwlocks)) + return -1; + return 0; +} +#endif diff --git a/tdb/spinlock.h b/tdb/spinlock.h new file mode 100644 index 0000000000..8b0e833ff5 --- /dev/null +++ b/tdb/spinlock.h @@ -0,0 +1,55 @@ +#ifndef __SPINLOCK_H__ +#define __SPINLOCK_H__ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "tdb.h" + +#ifdef USE_SPINLOCKS + +#define RWLOCK_BIAS 0x1000UL + +/* OS SPECIFIC */ +#define MAX_BUSY_LOOPS 1000 +#undef USE_SCHED_YIELD + +/* ARCH SPECIFIC */ +/* We should make sure these are padded to a cache line */ +#if defined(SPARC_SPINLOCKS) +typedef volatile char spinlock_t; +#elif defined(POWERPC_SPINLOCKS) +typedef volatile unsigned long spinlock_t; +#elif defined(INTEL_SPINLOCKS) +typedef volatile int spinlock_t; +#elif defined(MIPS_SPINLOCKS) +typedef volatile unsigned long spinlock_t; +#else +#error Need to implement spinlock code in spinlock.h +#endif + +typedef struct { + spinlock_t lock; + volatile int count; +} tdb_rwlock_t; + +int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type); +int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type); +int tdb_create_rwlocks(int fd, unsigned int hash_size); +int tdb_clear_spinlocks(TDB_CONTEXT *tdb); + +#else /* !USE_SPINLOCKS */ +#if 0 +#define tdb_create_rwlocks(fd, hash_size) 0 +#define tdb_spinlock(tdb, list, rw_type) (-1) +#define tdb_spinunlock(tdb, list, rw_type) (-1) +#else +int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type); +int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type); +int tdb_create_rwlocks(int fd, unsigned int hash_size); +#endif +int tdb_clear_spinlocks(TDB_CONTEXT *tdb); +#endif + +#endif diff --git a/tdb/tdb.c b/tdb/tdb.c new file mode 100644 index 0000000000..34681ea78f --- /dev/null +++ b/tdb/tdb.c @@ -0,0 +1,2043 @@ + /* + Unix SMB/CIFS implementation. + Samba database functions + Copyright (C) Andrew Tridgell 1999-2000 + Copyright (C) Luke Kenneth Casson Leighton 2000 + Copyright (C) Paul `Rusty' Russell 2000 + Copyright (C) Jeremy Allison 2000-2003 + + 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; either version 2 of the License, or + (at your option) any later version. + + 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 02139, USA. +*/ + + +/* NOTE: If you use tdbs under valgrind, and in particular if you run + * tdbtorture, you may get spurious "uninitialized value" warnings. I + * think this is because valgrind doesn't understand that the mmap'd + * area may be written to by other processes. Memory can, from the + * point of view of the grinded process, spontaneously become + * initialized. + * + * I can think of a few solutions. [mbp 20030311] + * + * 1 - Write suppressions for Valgrind so that it doesn't complain + * about this. Probably the most reasonable but people need to + * remember to use them. + * + * 2 - Use IO not mmap when running under valgrind. Not so nice. + * + * 3 - Use the special valgrind macros to mark memory as valid at the + * right time. Probably too hard -- the process just doesn't know. + */ + +#ifdef STANDALONE +#if HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tdb.h" +#include "spinlock.h" +#else +#include "includes.h" +#endif + +#define TDB_MAGIC_FOOD "TDB file\n" +#define TDB_VERSION (0x26011967 + 6) +#define TDB_MAGIC (0x26011999U) +#define TDB_FREE_MAGIC (~TDB_MAGIC) +#define TDB_DEAD_MAGIC (0xFEE1DEAD) +#define TDB_ALIGNMENT 4 +#define MIN_REC_SIZE (2*sizeof(struct list_struct) + TDB_ALIGNMENT) +#define DEFAULT_HASH_SIZE 131 +#define TDB_PAGE_SIZE 0x2000 +#define FREELIST_TOP (sizeof(struct tdb_header)) +#define TDB_ALIGN(x,a) (((x) + (a)-1) & ~((a)-1)) +#define TDB_BYTEREV(x) (((((x)&0xff)<<24)|((x)&0xFF00)<<8)|(((x)>>8)&0xFF00)|((x)>>24)) +#define TDB_DEAD(r) ((r)->magic == TDB_DEAD_MAGIC) +#define TDB_BAD_MAGIC(r) ((r)->magic != TDB_MAGIC && !TDB_DEAD(r)) +#define TDB_HASH_TOP(hash) (FREELIST_TOP + (BUCKET(hash)+1)*sizeof(tdb_off)) + +/* NB assumes there is a local variable called "tdb" that is the + * current context, also takes doubly-parenthesized print-style + * argument. */ +#define TDB_LOG(x) (tdb->log_fn?((tdb->log_fn x),0) : 0) + +/* lock offsets */ +#define GLOBAL_LOCK 0 +#define ACTIVE_LOCK 4 + +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif + +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +/* free memory if the pointer is valid and zero the pointer */ +#ifndef SAFE_FREE +#define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0) +#endif + +#define BUCKET(hash) ((hash) % tdb->header.hash_size) +TDB_DATA tdb_null; + +/* all contexts, to ensure no double-opens (fcntl locks don't nest!) */ +static TDB_CONTEXT *tdbs = NULL; + +static int tdb_munmap(TDB_CONTEXT *tdb) +{ + if (tdb->flags & TDB_INTERNAL) + return 0; + +#ifdef HAVE_MMAP + if (tdb->map_ptr) { + int ret = munmap(tdb->map_ptr, tdb->map_size); + if (ret != 0) + return ret; + } +#endif + tdb->map_ptr = NULL; + return 0; +} + +static void tdb_mmap(TDB_CONTEXT *tdb) +{ + if (tdb->flags & TDB_INTERNAL) + return; + +#ifdef HAVE_MMAP + if (!(tdb->flags & TDB_NOMMAP)) { + tdb->map_ptr = mmap(NULL, tdb->map_size, + PROT_READ|(tdb->read_only? 0:PROT_WRITE), + MAP_SHARED|MAP_FILE, tdb->fd, 0); + + /* + * NB. When mmap fails it returns MAP_FAILED *NOT* NULL !!!! + */ + + if (tdb->map_ptr == MAP_FAILED) { + tdb->map_ptr = NULL; + TDB_LOG((tdb, 2, "tdb_mmap failed for size %d (%s)\n", + tdb->map_size, strerror(errno))); + } + } else { + tdb->map_ptr = NULL; + } +#else + tdb->map_ptr = NULL; +#endif +} + +/* Endian conversion: we only ever deal with 4 byte quantities */ +static void *convert(void *buf, u32 size) +{ + u32 i, *p = buf; + for (i = 0; i < size / 4; i++) + p[i] = TDB_BYTEREV(p[i]); + return buf; +} +#define DOCONV() (tdb->flags & TDB_CONVERT) +#define CONVERT(x) (DOCONV() ? convert(&x, sizeof(x)) : &x) + +/* the body of the database is made of one list_struct for the free space + plus a separate data list for each hash value */ +struct list_struct { + tdb_off next; /* offset of the next record in the list */ + tdb_len rec_len; /* total byte length of record */ + tdb_len key_len; /* byte length of key */ + tdb_len data_len; /* byte length of data */ + u32 full_hash; /* the full 32 bit hash of the key */ + u32 magic; /* try to catch errors */ + /* the following union is implied: + union { + char record[rec_len]; + struct { + char key[key_len]; + char data[data_len]; + } + u32 totalsize; (tailer) + } + */ +}; + +/*************************************************************** + Allow a caller to set a "alarm" flag that tdb can check to abort + a blocking lock on SIGALRM. +***************************************************************/ + +static sig_atomic_t *palarm_fired; + +void tdb_set_lock_alarm(sig_atomic_t *palarm) +{ + palarm_fired = palarm; +} + +/* a byte range locking function - return 0 on success + this functions locks/unlocks 1 byte at the specified offset. + + On error, errno is also set so that errors are passed back properly + through tdb_open(). */ +static int tdb_brlock(TDB_CONTEXT *tdb, tdb_off offset, + int rw_type, int lck_type, int probe) +{ + struct flock fl; + int ret; + + if (tdb->flags & TDB_NOLOCK) + return 0; + if ((rw_type == F_WRLCK) && (tdb->read_only)) { + errno = EACCES; + return -1; + } + + fl.l_type = rw_type; + fl.l_whence = SEEK_SET; + fl.l_start = offset; + fl.l_len = 1; + fl.l_pid = 0; + + do { + ret = fcntl(tdb->fd,lck_type,&fl); + if (ret == -1 && errno == EINTR && palarm_fired && *palarm_fired) + break; + } while (ret == -1 && errno == EINTR); + + if (ret == -1) { + if (!probe && lck_type != F_SETLK) { + /* Ensure error code is set for log fun to examine. */ + if (errno == EINTR && palarm_fired && *palarm_fired) + tdb->ecode = TDB_ERR_LOCK_TIMEOUT; + else + tdb->ecode = TDB_ERR_LOCK; + TDB_LOG((tdb, 5,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d lck_type=%d\n", + tdb->fd, offset, rw_type, lck_type)); + } + /* Was it an alarm timeout ? */ + if (errno == EINTR && palarm_fired && *palarm_fired) + return TDB_ERRCODE(TDB_ERR_LOCK_TIMEOUT, -1); + /* Otherwise - generic lock error. */ + /* errno set by fcntl */ + return TDB_ERRCODE(TDB_ERR_LOCK, -1); + } + return 0; +} + +/* lock a list in the database. list -1 is the alloc list */ +static int tdb_lock(TDB_CONTEXT *tdb, int list, int ltype) +{ + if (list < -1 || list >= (int)tdb->header.hash_size) { + TDB_LOG((tdb, 0,"tdb_lock: invalid list %d for ltype=%d\n", + list, ltype)); + return -1; + } + if (tdb->flags & TDB_NOLOCK) + return 0; + + /* Since fcntl locks don't nest, we do a lock for the first one, + and simply bump the count for future ones */ + if (tdb->locked[list+1].count == 0) { + if (!tdb->read_only && tdb->header.rwlocks) { + if (tdb_spinlock(tdb, list, ltype)) { + TDB_LOG((tdb, 0, "tdb_lock spinlock failed on list ltype=%d\n", + list, ltype)); + return -1; + } + } else if (tdb_brlock(tdb,FREELIST_TOP+4*list,ltype,F_SETLKW, 0)) { + TDB_LOG((tdb, 0,"tdb_lock failed on list %d ltype=%d (%s)\n", + list, ltype, strerror(errno))); + return -1; + } + tdb->locked[list+1].ltype = ltype; + } + tdb->locked[list+1].count++; + return 0; +} + +/* unlock the database: returns void because it's too late for errors. */ + /* changed to return int it may be interesting to know there + has been an error --simo */ +static int tdb_unlock(TDB_CONTEXT *tdb, int list, int ltype) +{ + int ret = -1; + + if (tdb->flags & TDB_NOLOCK) + return 0; + + /* Sanity checks */ + if (list < -1 || list >= (int)tdb->header.hash_size) { + TDB_LOG((tdb, 0, "tdb_unlock: list %d invalid (%d)\n", list, tdb->header.hash_size)); + return ret; + } + + if (tdb->locked[list+1].count==0) { + TDB_LOG((tdb, 0, "tdb_unlock: count is 0\n")); + return ret; + } + + if (tdb->locked[list+1].count == 1) { + /* Down to last nested lock: unlock underneath */ + if (!tdb->read_only && tdb->header.rwlocks) { + ret = tdb_spinunlock(tdb, list, ltype); + } else { + ret = tdb_brlock(tdb, FREELIST_TOP+4*list, F_UNLCK, F_SETLKW, 0); + } + } else { + ret = 0; + } + tdb->locked[list+1].count--; + + if (ret) + TDB_LOG((tdb, 0,"tdb_unlock: An error occurred unlocking!\n")); + return ret; +} + +/* This is based on the hash algorithm from gdbm */ +static u32 tdb_hash(TDB_DATA *key) +{ + u32 value; /* Used to compute the hash value. */ + u32 i; /* Used to cycle through random values. */ + + /* Set the initial value from the key size. */ + for (value = 0x238F13AF * key->dsize, i=0; i < key->dsize; i++) + value = (value + (key->dptr[i] << (i*5 % 24))); + + return (1103515243 * value + 12345); +} + +/* check for an out of bounds access - if it is out of bounds then + see if the database has been expanded by someone else and expand + if necessary + note that "len" is the minimum length needed for the db +*/ +static int tdb_oob(TDB_CONTEXT *tdb, tdb_off len, int probe) +{ + struct stat st; + if (len <= tdb->map_size) + return 0; + if (tdb->flags & TDB_INTERNAL) { + if (!probe) { + /* Ensure ecode is set for log fn. */ + tdb->ecode = TDB_ERR_IO; + TDB_LOG((tdb, 0,"tdb_oob len %d beyond internal malloc size %d\n", + (int)len, (int)tdb->map_size)); + } + return TDB_ERRCODE(TDB_ERR_IO, -1); + } + + if (fstat(tdb->fd, &st) == -1) + return TDB_ERRCODE(TDB_ERR_IO, -1); + + if (st.st_size < (size_t)len) { + if (!probe) { + /* Ensure ecode is set for log fn. */ + tdb->ecode = TDB_ERR_IO; + TDB_LOG((tdb, 0,"tdb_oob len %d beyond eof at %d\n", + (int)len, (int)st.st_size)); + } + return TDB_ERRCODE(TDB_ERR_IO, -1); + } + + /* Unmap, update size, remap */ + if (tdb_munmap(tdb) == -1) + return TDB_ERRCODE(TDB_ERR_IO, -1); + tdb->map_size = st.st_size; + tdb_mmap(tdb); + return 0; +} + +/* write a lump of data at a specified offset */ +static int tdb_write(TDB_CONTEXT *tdb, tdb_off off, void *buf, tdb_len len) +{ + if (tdb_oob(tdb, off + len, 0) != 0) + return -1; + + if (tdb->map_ptr) + memcpy(off + (char *)tdb->map_ptr, buf, len); +#ifdef HAVE_PWRITE + else if (pwrite(tdb->fd, buf, len, off) != (ssize_t)len) { +#else + else if (lseek(tdb->fd, off, SEEK_SET) != off + || write(tdb->fd, buf, len) != (ssize_t)len) { +#endif + /* Ensure ecode is set for log fn. */ + tdb->ecode = TDB_ERR_IO; + TDB_LOG((tdb, 0,"tdb_write failed at %d len=%d (%s)\n", + off, len, strerror(errno))); + return TDB_ERRCODE(TDB_ERR_IO, -1); + } + return 0; +} + +/* read a lump of data at a specified offset, maybe convert */ +static int tdb_read(TDB_CONTEXT *tdb,tdb_off off,void *buf,tdb_len len,int cv) +{ + if (tdb_oob(tdb, off + len, 0) != 0) + return -1; + + if (tdb->map_ptr) + memcpy(buf, off + (char *)tdb->map_ptr, len); +#ifdef HAVE_PREAD + else if (pread(tdb->fd, buf, len, off) != (ssize_t)len) { +#else + else if (lseek(tdb->fd, off, SEEK_SET) != off + || read(tdb->fd, buf, len) != (ssize_t)len) { +#endif + /* Ensure ecode is set for log fn. */ + tdb->ecode = TDB_ERR_IO; + TDB_LOG((tdb, 0,"tdb_read failed at %d len=%d (%s)\n", + off, len, strerror(errno))); + return TDB_ERRCODE(TDB_ERR_IO, -1); + } + if (cv) + convert(buf, len); + return 0; +} + +/* read a lump of data, allocating the space for it */ +static char *tdb_alloc_read(TDB_CONTEXT *tdb, tdb_off offset, tdb_len len) +{ + char *buf; + + if (!(buf = malloc(len))) { + /* Ensure ecode is set for log fn. */ + tdb->ecode = TDB_ERR_OOM; + TDB_LOG((tdb, 0,"tdb_alloc_read malloc failed len=%d (%s)\n", + len, strerror(errno))); + return TDB_ERRCODE(TDB_ERR_OOM, buf); + } + if (tdb_read(tdb, offset, buf, len, 0) == -1) { + SAFE_FREE(buf); + return NULL; + } + return buf; +} + +/* read/write a tdb_off */ +static int ofs_read(TDB_CONTEXT *tdb, tdb_off offset, tdb_off *d) +{ + return tdb_read(tdb, offset, (char*)d, sizeof(*d), DOCONV()); +} +static int ofs_write(TDB_CONTEXT *tdb, tdb_off offset, tdb_off *d) +{ + tdb_off off = *d; + return tdb_write(tdb, offset, CONVERT(off), sizeof(*d)); +} + +/* read/write a record */ +static int rec_read(TDB_CONTEXT *tdb, tdb_off offset, struct list_struct *rec) +{ + if (tdb_read(tdb, offset, rec, sizeof(*rec),DOCONV()) == -1) + return -1; + if (TDB_BAD_MAGIC(rec)) { + /* Ensure ecode is set for log fn. */ + tdb->ecode = TDB_ERR_CORRUPT; + TDB_LOG((tdb, 0,"rec_read bad magic 0x%x at offset=%d\n", rec->magic, offset)); + return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); + } + return tdb_oob(tdb, rec->next+sizeof(*rec), 0); +} +static int rec_write(TDB_CONTEXT *tdb, tdb_off offset, struct list_struct *rec) +{ + struct list_struct r = *rec; + return tdb_write(tdb, offset, CONVERT(r), sizeof(r)); +} + +/* read a freelist record and check for simple errors */ +static int rec_free_read(TDB_CONTEXT *tdb, tdb_off off, struct list_struct *rec) +{ + if (tdb_read(tdb, off, rec, sizeof(*rec),DOCONV()) == -1) + return -1; + + if (rec->magic == TDB_MAGIC) { + /* this happens when a app is showdown while deleting a record - we should + not completely fail when this happens */ + TDB_LOG((tdb, 0,"rec_free_read non-free magic at offset=%d - fixing\n", + rec->magic, off)); + rec->magic = TDB_FREE_MAGIC; + if (tdb_write(tdb, off, rec, sizeof(*rec)) == -1) + return -1; + } + + if (rec->magic != TDB_FREE_MAGIC) { + /* Ensure ecode is set for log fn. */ + tdb->ecode = TDB_ERR_CORRUPT; + TDB_LOG((tdb, 0,"rec_free_read bad magic 0x%x at offset=%d\n", + rec->magic, off)); + return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); + } + if (tdb_oob(tdb, rec->next+sizeof(*rec), 0) != 0) + return -1; + return 0; +} + +/* update a record tailer (must hold allocation lock) */ +static int update_tailer(TDB_CONTEXT *tdb, tdb_off offset, + const struct list_struct *rec) +{ + tdb_off totalsize; + + /* Offset of tailer from record header */ + totalsize = sizeof(*rec) + rec->rec_len; + return ofs_write(tdb, offset + totalsize - sizeof(tdb_off), + &totalsize); +} + +static tdb_off tdb_dump_record(TDB_CONTEXT *tdb, tdb_off offset) +{ + struct list_struct rec; + tdb_off tailer_ofs, tailer; + + if (tdb_read(tdb, offset, (char *)&rec, sizeof(rec), DOCONV()) == -1) { + printf("ERROR: failed to read record at %u\n", offset); + return 0; + } + + printf(" rec: offset=%u next=%d rec_len=%d key_len=%d data_len=%d full_hash=0x%x magic=0x%x\n", + offset, rec.next, rec.rec_len, rec.key_len, rec.data_len, rec.full_hash, rec.magic); + + tailer_ofs = offset + sizeof(rec) + rec.rec_len - sizeof(tdb_off); + if (ofs_read(tdb, tailer_ofs, &tailer) == -1) { + printf("ERROR: failed to read tailer at %u\n", tailer_ofs); + return rec.next; + } + + if (tailer != rec.rec_len + sizeof(rec)) { + printf("ERROR: tailer does not match record! tailer=%u totalsize=%u\n", + (unsigned)tailer, (unsigned)(rec.rec_len + sizeof(rec))); + } + return rec.next; +} + +static int tdb_dump_chain(TDB_CONTEXT *tdb, int i) +{ + tdb_off rec_ptr, top; + + top = TDB_HASH_TOP(i); + + if (tdb_lock(tdb, i, F_WRLCK) != 0) + return -1; + + if (ofs_read(tdb, top, &rec_ptr) == -1) + return tdb_unlock(tdb, i, F_WRLCK); + + if (rec_ptr) + printf("hash=%d\n", i); + + while (rec_ptr) { + rec_ptr = tdb_dump_record(tdb, rec_ptr); + } + + return tdb_unlock(tdb, i, F_WRLCK); +} + +void tdb_dump_all(TDB_CONTEXT *tdb) +{ + int i; + for (i=0;iheader.hash_size;i++) { + tdb_dump_chain(tdb, i); + } + printf("freelist:\n"); + tdb_dump_chain(tdb, -1); +} + +int tdb_printfreelist(TDB_CONTEXT *tdb) +{ + int ret; + long total_free = 0; + tdb_off offset, rec_ptr; + struct list_struct rec; + + if ((ret = tdb_lock(tdb, -1, F_WRLCK)) != 0) + return ret; + + offset = FREELIST_TOP; + + /* read in the freelist top */ + if (ofs_read(tdb, offset, &rec_ptr) == -1) { + tdb_unlock(tdb, -1, F_WRLCK); + return 0; + } + + printf("freelist top=[0x%08x]\n", rec_ptr ); + while (rec_ptr) { + if (tdb_read(tdb, rec_ptr, (char *)&rec, sizeof(rec), DOCONV()) == -1) { + tdb_unlock(tdb, -1, F_WRLCK); + return -1; + } + + if (rec.magic != TDB_FREE_MAGIC) { + printf("bad magic 0x%08x in free list\n", rec.magic); + tdb_unlock(tdb, -1, F_WRLCK); + return -1; + } + + printf("entry offset=[0x%08x], rec.rec_len = [0x%08x (%d)]\n", rec.next, rec.rec_len, rec.rec_len ); + total_free += rec.rec_len; + + /* move to the next record */ + rec_ptr = rec.next; + } + printf("total rec_len = [0x%08x (%d)]\n", (int)total_free, + (int)total_free); + + return tdb_unlock(tdb, -1, F_WRLCK); +} + +/* Remove an element from the freelist. Must have alloc lock. */ +static int remove_from_freelist(TDB_CONTEXT *tdb, tdb_off off, tdb_off next) +{ + tdb_off last_ptr, i; + + /* read in the freelist top */ + last_ptr = FREELIST_TOP; + while (ofs_read(tdb, last_ptr, &i) != -1 && i != 0) { + if (i == off) { + /* We've found it! */ + return ofs_write(tdb, last_ptr, &next); + } + /* Follow chain (next offset is at start of record) */ + last_ptr = i; + } + TDB_LOG((tdb, 0,"remove_from_freelist: not on list at off=%d\n", off)); + return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); +} + +/* Add an element into the freelist. Merge adjacent records if + neccessary. */ +static int tdb_free(TDB_CONTEXT *tdb, tdb_off offset, struct list_struct *rec) +{ + tdb_off right, left; + + /* Allocation and tailer lock */ + if (tdb_lock(tdb, -1, F_WRLCK) != 0) + return -1; + + /* set an initial tailer, so if we fail we don't leave a bogus record */ + if (update_tailer(tdb, offset, rec) != 0) { + TDB_LOG((tdb, 0, "tdb_free: upfate_tailer failed!\n")); + goto fail; + } + + /* Look right first (I'm an Australian, dammit) */ + right = offset + sizeof(*rec) + rec->rec_len; + if (right + sizeof(*rec) <= tdb->map_size) { + struct list_struct r; + + if (tdb_read(tdb, right, &r, sizeof(r), DOCONV()) == -1) { + TDB_LOG((tdb, 0, "tdb_free: right read failed at %u\n", right)); + goto left; + } + + /* If it's free, expand to include it. */ + if (r.magic == TDB_FREE_MAGIC) { + if (remove_from_freelist(tdb, right, r.next) == -1) { + TDB_LOG((tdb, 0, "tdb_free: right free failed at %u\n", right)); + goto left; + } + rec->rec_len += sizeof(r) + r.rec_len; + } + } + +left: + /* Look left */ + left = offset - sizeof(tdb_off); + if (left > TDB_HASH_TOP(tdb->header.hash_size-1)) { + struct list_struct l; + tdb_off leftsize; + + /* Read in tailer and jump back to header */ + if (ofs_read(tdb, left, &leftsize) == -1) { + TDB_LOG((tdb, 0, "tdb_free: left offset read failed at %u\n", left)); + goto update; + } + left = offset - leftsize; + + /* Now read in record */ + if (tdb_read(tdb, left, &l, sizeof(l), DOCONV()) == -1) { + TDB_LOG((tdb, 0, "tdb_free: left read failed at %u (%u)\n", left, leftsize)); + goto update; + } + + /* If it's free, expand to include it. */ + if (l.magic == TDB_FREE_MAGIC) { + if (remove_from_freelist(tdb, left, l.next) == -1) { + TDB_LOG((tdb, 0, "tdb_free: left free failed at %u\n", left)); + goto update; + } else { + offset = left; + rec->rec_len += leftsize; + } + } + } + +update: + if (update_tailer(tdb, offset, rec) == -1) { + TDB_LOG((tdb, 0, "tdb_free: update_tailer failed at %u\n", offset)); + goto fail; + } + + /* Now, prepend to free list */ + rec->magic = TDB_FREE_MAGIC; + + if (ofs_read(tdb, FREELIST_TOP, &rec->next) == -1 || + rec_write(tdb, offset, rec) == -1 || + ofs_write(tdb, FREELIST_TOP, &offset) == -1) { + TDB_LOG((tdb, 0, "tdb_free record write failed at offset=%d\n", offset)); + goto fail; + } + + /* And we're done. */ + tdb_unlock(tdb, -1, F_WRLCK); + return 0; + + fail: + tdb_unlock(tdb, -1, F_WRLCK); + return -1; +} + + +/* expand a file. we prefer to use ftruncate, as that is what posix + says to use for mmap expansion */ +static int expand_file(TDB_CONTEXT *tdb, tdb_off size, tdb_off addition) +{ + char buf[1024]; +#if HAVE_FTRUNCATE_EXTEND + if (ftruncate(tdb->fd, size+addition) != 0) { + TDB_LOG((tdb, 0, "expand_file ftruncate to %d failed (%s)\n", + size+addition, strerror(errno))); + return -1; + } +#else + char b = 0; + +#ifdef HAVE_PWRITE + if (pwrite(tdb->fd, &b, 1, (size+addition) - 1) != 1) { +#else + if (lseek(tdb->fd, (size+addition) - 1, SEEK_SET) != (size+addition) - 1 || + write(tdb->fd, &b, 1) != 1) { +#endif + TDB_LOG((tdb, 0, "expand_file to %d failed (%s)\n", + size+addition, strerror(errno))); + return -1; + } +#endif + + /* now fill the file with something. This ensures that the file isn't sparse, which would be + very bad if we ran out of disk. This must be done with write, not via mmap */ + memset(buf, 0x42, sizeof(buf)); + while (addition) { + int n = addition>sizeof(buf)?sizeof(buf):addition; +#ifdef HAVE_PWRITE + int ret = pwrite(tdb->fd, buf, n, size); +#else + int ret; + if (lseek(tdb->fd, size, SEEK_SET) != size) + return -1; + ret = write(tdb->fd, buf, n); +#endif + if (ret != n) { + TDB_LOG((tdb, 0, "expand_file write of %d failed (%s)\n", + n, strerror(errno))); + return -1; + } + addition -= n; + size += n; + } + return 0; +} + + +/* expand the database at least size bytes by expanding the underlying + file and doing the mmap again if necessary */ +static int tdb_expand(TDB_CONTEXT *tdb, tdb_off size) +{ + struct list_struct rec; + tdb_off offset; + + if (tdb_lock(tdb, -1, F_WRLCK) == -1) { + TDB_LOG((tdb, 0, "lock failed in tdb_expand\n")); + return -1; + } + + /* must know about any previous expansions by another process */ + tdb_oob(tdb, tdb->map_size + 1, 1); + + /* always make room for at least 10 more records, and round + the database up to a multiple of TDB_PAGE_SIZE */ + size = TDB_ALIGN(tdb->map_size + size*10, TDB_PAGE_SIZE) - tdb->map_size; + + if (!(tdb->flags & TDB_INTERNAL)) + tdb_munmap(tdb); + + /* + * We must ensure the file is unmapped before doing this + * to ensure consistency with systems like OpenBSD where + * writes and mmaps are not consistent. + */ + + /* expand the file itself */ + if (!(tdb->flags & TDB_INTERNAL)) { + if (expand_file(tdb, tdb->map_size, size) != 0) + goto fail; + } + + tdb->map_size += size; + + if (tdb->flags & TDB_INTERNAL) + tdb->map_ptr = realloc(tdb->map_ptr, tdb->map_size); + else { + /* + * We must ensure the file is remapped before adding the space + * to ensure consistency with systems like OpenBSD where + * writes and mmaps are not consistent. + */ + + /* We're ok if the mmap fails as we'll fallback to read/write */ + tdb_mmap(tdb); + } + + /* form a new freelist record */ + memset(&rec,'\0',sizeof(rec)); + rec.rec_len = size - sizeof(rec); + + /* link it into the free list */ + offset = tdb->map_size - size; + if (tdb_free(tdb, offset, &rec) == -1) + goto fail; + + tdb_unlock(tdb, -1, F_WRLCK); + return 0; + fail: + tdb_unlock(tdb, -1, F_WRLCK); + return -1; +} + +/* allocate some space from the free list. The offset returned points + to a unconnected list_struct within the database with room for at + least length bytes of total data + + 0 is returned if the space could not be allocated + */ +static tdb_off tdb_allocate(TDB_CONTEXT *tdb, tdb_len length, + struct list_struct *rec) +{ + tdb_off rec_ptr, last_ptr, newrec_ptr; + struct list_struct newrec; + + if (tdb_lock(tdb, -1, F_WRLCK) == -1) + return 0; + + /* Extra bytes required for tailer */ + length += sizeof(tdb_off); + + again: + last_ptr = FREELIST_TOP; + + /* read in the freelist top */ + if (ofs_read(tdb, FREELIST_TOP, &rec_ptr) == -1) + goto fail; + + /* keep looking until we find a freelist record big enough */ + while (rec_ptr) { + if (rec_free_read(tdb, rec_ptr, rec) == -1) + goto fail; + + if (rec->rec_len >= length) { + /* found it - now possibly split it up */ + if (rec->rec_len > length + MIN_REC_SIZE) { + /* Length of left piece */ + length = TDB_ALIGN(length, TDB_ALIGNMENT); + + /* Right piece to go on free list */ + newrec.rec_len = rec->rec_len + - (sizeof(*rec) + length); + newrec_ptr = rec_ptr + sizeof(*rec) + length; + + /* And left record is shortened */ + rec->rec_len = length; + } else + newrec_ptr = 0; + + /* Remove allocated record from the free list */ + if (ofs_write(tdb, last_ptr, &rec->next) == -1) + goto fail; + + /* Update header: do this before we drop alloc + lock, otherwise tdb_free() might try to + merge with us, thinking we're free. + (Thanks Jeremy Allison). */ + rec->magic = TDB_MAGIC; + if (rec_write(tdb, rec_ptr, rec) == -1) + goto fail; + + /* Did we create new block? */ + if (newrec_ptr) { + /* Update allocated record tailer (we + shortened it). */ + if (update_tailer(tdb, rec_ptr, rec) == -1) + goto fail; + + /* Free new record */ + if (tdb_free(tdb, newrec_ptr, &newrec) == -1) + goto fail; + } + + /* all done - return the new record offset */ + tdb_unlock(tdb, -1, F_WRLCK); + return rec_ptr; + } + /* move to the next record */ + last_ptr = rec_ptr; + rec_ptr = rec->next; + } + /* we didn't find enough space. See if we can expand the + database and if we can then try again */ + if (tdb_expand(tdb, length + sizeof(*rec)) == 0) + goto again; + fail: + tdb_unlock(tdb, -1, F_WRLCK); + return 0; +} + +/* initialise a new database with a specified hash size */ +static int tdb_new_database(TDB_CONTEXT *tdb, int hash_size) +{ + struct tdb_header *newdb; + int size, ret = -1; + + /* We make it up in memory, then write it out if not internal */ + size = sizeof(struct tdb_header) + (hash_size+1)*sizeof(tdb_off); + if (!(newdb = calloc(size, 1))) + return TDB_ERRCODE(TDB_ERR_OOM, -1); + + /* Fill in the header */ + newdb->version = TDB_VERSION; + newdb->hash_size = hash_size; +#ifdef USE_SPINLOCKS + newdb->rwlocks = size; +#endif + if (tdb->flags & TDB_INTERNAL) { + tdb->map_size = size; + tdb->map_ptr = (char *)newdb; + memcpy(&tdb->header, newdb, sizeof(tdb->header)); + /* Convert the `ondisk' version if asked. */ + CONVERT(*newdb); + return 0; + } + if (lseek(tdb->fd, 0, SEEK_SET) == -1) + goto fail; + + if (ftruncate(tdb->fd, 0) == -1) + goto fail; + + /* This creates an endian-converted header, as if read from disk */ + CONVERT(*newdb); + memcpy(&tdb->header, newdb, sizeof(tdb->header)); + /* Don't endian-convert the magic food! */ + memcpy(newdb->magic_food, TDB_MAGIC_FOOD, strlen(TDB_MAGIC_FOOD)+1); + if (write(tdb->fd, newdb, size) != size) + ret = -1; + else + ret = tdb_create_rwlocks(tdb->fd, hash_size); + + fail: + SAFE_FREE(newdb); + return ret; +} + +/* Returns 0 on fail. On success, return offset of record, and fills + in rec */ +static tdb_off tdb_find(TDB_CONTEXT *tdb, TDB_DATA key, u32 hash, + struct list_struct *r) +{ + tdb_off rec_ptr; + + /* read in the hash top */ + if (ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) + return 0; + + /* keep looking until we find the right record */ + while (rec_ptr) { + if (rec_read(tdb, rec_ptr, r) == -1) + return 0; + + if (!TDB_DEAD(r) && hash==r->full_hash && key.dsize==r->key_len) { + char *k; + /* a very likely hit - read the key */ + k = tdb_alloc_read(tdb, rec_ptr + sizeof(*r), + r->key_len); + if (!k) + return 0; + + if (memcmp(key.dptr, k, key.dsize) == 0) { + SAFE_FREE(k); + return rec_ptr; + } + SAFE_FREE(k); + } + rec_ptr = r->next; + } + return TDB_ERRCODE(TDB_ERR_NOEXIST, 0); +} + +/* If they do lockkeys, check that this hash is one they locked */ +static int tdb_keylocked(TDB_CONTEXT *tdb, u32 hash) +{ + u32 i; + if (!tdb->lockedkeys) + return 1; + for (i = 0; i < tdb->lockedkeys[0]; i++) + if (tdb->lockedkeys[i+1] == hash) + return 1; + return TDB_ERRCODE(TDB_ERR_NOLOCK, 0); +} + +/* As tdb_find, but if you succeed, keep the lock */ +static tdb_off tdb_find_lock(TDB_CONTEXT *tdb, TDB_DATA key, int locktype, + struct list_struct *rec) +{ + u32 hash, rec_ptr; + + hash = tdb_hash(&key); + if (!tdb_keylocked(tdb, hash)) + return 0; + if (tdb_lock(tdb, BUCKET(hash), locktype) == -1) + return 0; + if (!(rec_ptr = tdb_find(tdb, key, hash, rec))) + tdb_unlock(tdb, BUCKET(hash), locktype); + return rec_ptr; +} + +enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb) +{ + return tdb->ecode; +} + +static struct tdb_errname { + enum TDB_ERROR ecode; const char *estring; +} emap[] = { {TDB_SUCCESS, "Success"}, + {TDB_ERR_CORRUPT, "Corrupt database"}, + {TDB_ERR_IO, "IO Error"}, + {TDB_ERR_LOCK, "Locking error"}, + {TDB_ERR_OOM, "Out of memory"}, + {TDB_ERR_EXISTS, "Record exists"}, + {TDB_ERR_NOLOCK, "Lock exists on other keys"}, + {TDB_ERR_NOEXIST, "Record does not exist"} }; + +/* Error string for the last tdb error */ +const char *tdb_errorstr(TDB_CONTEXT *tdb) +{ + u32 i; + for (i = 0; i < sizeof(emap) / sizeof(struct tdb_errname); i++) + if (tdb->ecode == emap[i].ecode) + return emap[i].estring; + return "Invalid error code"; +} + +/* update an entry in place - this only works if the new data size + is <= the old data size and the key exists. + on failure return -1. +*/ + +static int tdb_update(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf) +{ + struct list_struct rec; + tdb_off rec_ptr; + + /* find entry */ + if (!(rec_ptr = tdb_find(tdb, key, tdb_hash(&key), &rec))) + return -1; + + /* must be long enough key, data and tailer */ + if (rec.rec_len < key.dsize + dbuf.dsize + sizeof(tdb_off)) { + tdb->ecode = TDB_SUCCESS; /* Not really an error */ + return -1; + } + + if (tdb_write(tdb, rec_ptr + sizeof(rec) + rec.key_len, + dbuf.dptr, dbuf.dsize) == -1) + return -1; + + if (dbuf.dsize != rec.data_len) { + /* update size */ + rec.data_len = dbuf.dsize; + return rec_write(tdb, rec_ptr, &rec); + } + + return 0; +} + +/* find an entry in the database given a key */ +/* If an entry doesn't exist tdb_err will be set to + * TDB_ERR_NOEXIST. If a key has no data attached + * tdb_err will not be set. Both will return a + * zero pptr and zero dsize. + */ + +TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key) +{ + tdb_off rec_ptr; + struct list_struct rec; + TDB_DATA ret; + + /* find which hash bucket it is in */ + if (!(rec_ptr = tdb_find_lock(tdb,key,F_RDLCK,&rec))) + return tdb_null; + + if (rec.data_len) + ret.dptr = tdb_alloc_read(tdb, rec_ptr + sizeof(rec) + rec.key_len, + rec.data_len); + else + ret.dptr = NULL; + ret.dsize = rec.data_len; + tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK); + return ret; +} + +/* check if an entry in the database exists + + note that 1 is returned if the key is found and 0 is returned if not found + this doesn't match the conventions in the rest of this module, but is + compatible with gdbm +*/ +int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key) +{ + struct list_struct rec; + + if (tdb_find_lock(tdb, key, F_RDLCK, &rec) == 0) + return 0; + tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK); + return 1; +} + +/* record lock stops delete underneath */ +static int lock_record(TDB_CONTEXT *tdb, tdb_off off) +{ + return off ? tdb_brlock(tdb, off, F_RDLCK, F_SETLKW, 0) : 0; +} +/* + Write locks override our own fcntl readlocks, so check it here. + Note this is meant to be F_SETLK, *not* F_SETLKW, as it's not + an error to fail to get the lock here. +*/ + +static int write_lock_record(TDB_CONTEXT *tdb, tdb_off off) +{ + struct tdb_traverse_lock *i; + for (i = &tdb->travlocks; i; i = i->next) + if (i->off == off) + return -1; + return tdb_brlock(tdb, off, F_WRLCK, F_SETLK, 1); +} + +/* + Note this is meant to be F_SETLK, *not* F_SETLKW, as it's not + an error to fail to get the lock here. +*/ + +static int write_unlock_record(TDB_CONTEXT *tdb, tdb_off off) +{ + return tdb_brlock(tdb, off, F_UNLCK, F_SETLK, 0); +} +/* fcntl locks don't stack: avoid unlocking someone else's */ +static int unlock_record(TDB_CONTEXT *tdb, tdb_off off) +{ + struct tdb_traverse_lock *i; + u32 count = 0; + + if (off == 0) + return 0; + for (i = &tdb->travlocks; i; i = i->next) + if (i->off == off) + count++; + return (count == 1 ? tdb_brlock(tdb, off, F_UNLCK, F_SETLKW, 0) : 0); +} + +/* actually delete an entry in the database given the offset */ +static int do_delete(TDB_CONTEXT *tdb, tdb_off rec_ptr, struct list_struct*rec) +{ + tdb_off last_ptr, i; + struct list_struct lastrec; + + if (tdb->read_only) return -1; + + if (write_lock_record(tdb, rec_ptr) == -1) { + /* Someone traversing here: mark it as dead */ + rec->magic = TDB_DEAD_MAGIC; + return rec_write(tdb, rec_ptr, rec); + } + if (write_unlock_record(tdb, rec_ptr) != 0) + return -1; + + /* find previous record in hash chain */ + if (ofs_read(tdb, TDB_HASH_TOP(rec->full_hash), &i) == -1) + return -1; + for (last_ptr = 0; i != rec_ptr; last_ptr = i, i = lastrec.next) + if (rec_read(tdb, i, &lastrec) == -1) + return -1; + + /* unlink it: next ptr is at start of record. */ + if (last_ptr == 0) + last_ptr = TDB_HASH_TOP(rec->full_hash); + if (ofs_write(tdb, last_ptr, &rec->next) == -1) + return -1; + + /* recover the space */ + if (tdb_free(tdb, rec_ptr, rec) == -1) + return -1; + return 0; +} + +/* Uses traverse lock: 0 = finish, -1 = error, other = record offset */ +static int tdb_next_lock(TDB_CONTEXT *tdb, struct tdb_traverse_lock *tlock, + struct list_struct *rec) +{ + int want_next = (tlock->off != 0); + + /* No traversal allows if you've called tdb_lockkeys() */ + if (tdb->lockedkeys) + return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); + + /* Lock each chain from the start one. */ + for (; tlock->hash < tdb->header.hash_size; tlock->hash++) { + if (tdb_lock(tdb, tlock->hash, F_WRLCK) == -1) + return -1; + + /* No previous record? Start at top of chain. */ + if (!tlock->off) { + if (ofs_read(tdb, TDB_HASH_TOP(tlock->hash), + &tlock->off) == -1) + goto fail; + } else { + /* Otherwise unlock the previous record. */ + if (unlock_record(tdb, tlock->off) != 0) + goto fail; + } + + if (want_next) { + /* We have offset of old record: grab next */ + if (rec_read(tdb, tlock->off, rec) == -1) + goto fail; + tlock->off = rec->next; + } + + /* Iterate through chain */ + while( tlock->off) { + tdb_off current; + if (rec_read(tdb, tlock->off, rec) == -1) + goto fail; + if (!TDB_DEAD(rec)) { + /* Woohoo: we found one! */ + if (lock_record(tdb, tlock->off) != 0) + goto fail; + return tlock->off; + } + /* Try to clean dead ones from old traverses */ + current = tlock->off; + tlock->off = rec->next; + if (!tdb->read_only && + do_delete(tdb, current, rec) != 0) + goto fail; + } + tdb_unlock(tdb, tlock->hash, F_WRLCK); + want_next = 0; + } + /* We finished iteration without finding anything */ + return TDB_ERRCODE(TDB_SUCCESS, 0); + + fail: + tlock->off = 0; + if (tdb_unlock(tdb, tlock->hash, F_WRLCK) != 0) + TDB_LOG((tdb, 0, "tdb_next_lock: On error unlock failed!\n")); + return -1; +} + +/* traverse the entire database - calling fn(tdb, key, data) on each element. + return -1 on error or the record count traversed + if fn is NULL then it is not called + a non-zero return value from fn() indicates that the traversal should stop + */ +int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *state) +{ + TDB_DATA key, dbuf; + struct list_struct rec; + struct tdb_traverse_lock tl = { NULL, 0, 0 }; + int ret, count = 0; + + /* This was in the initializaton, above, but the IRIX compiler + * did not like it. crh + */ + tl.next = tdb->travlocks.next; + + /* fcntl locks don't stack: beware traverse inside traverse */ + tdb->travlocks.next = &tl; + + /* tdb_next_lock places locks on the record returned, and its chain */ + while ((ret = tdb_next_lock(tdb, &tl, &rec)) > 0) { + count++; + /* now read the full record */ + key.dptr = tdb_alloc_read(tdb, tl.off + sizeof(rec), + rec.key_len + rec.data_len); + if (!key.dptr) { + ret = -1; + if (tdb_unlock(tdb, tl.hash, F_WRLCK) != 0) + goto out; + if (unlock_record(tdb, tl.off) != 0) + TDB_LOG((tdb, 0, "tdb_traverse: key.dptr == NULL and unlock_record failed!\n")); + goto out; + } + key.dsize = rec.key_len; + dbuf.dptr = key.dptr + rec.key_len; + dbuf.dsize = rec.data_len; + + /* Drop chain lock, call out */ + if (tdb_unlock(tdb, tl.hash, F_WRLCK) != 0) { + ret = -1; + goto out; + } + if (fn && fn(tdb, key, dbuf, state)) { + /* They want us to terminate traversal */ + ret = count; + if (unlock_record(tdb, tl.off) != 0) { + TDB_LOG((tdb, 0, "tdb_traverse: unlock_record failed!\n"));; + ret = -1; + } + tdb->travlocks.next = tl.next; + SAFE_FREE(key.dptr); + return count; + } + SAFE_FREE(key.dptr); + } +out: + tdb->travlocks.next = tl.next; + if (ret < 0) + return -1; + else + return count; +} + +/* find the first entry in the database and return its key */ +TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb) +{ + TDB_DATA key; + struct list_struct rec; + + /* release any old lock */ + if (unlock_record(tdb, tdb->travlocks.off) != 0) + return tdb_null; + tdb->travlocks.off = tdb->travlocks.hash = 0; + + if (tdb_next_lock(tdb, &tdb->travlocks, &rec) <= 0) + return tdb_null; + /* now read the key */ + key.dsize = rec.key_len; + key.dptr =tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec),key.dsize); + if (tdb_unlock(tdb, BUCKET(tdb->travlocks.hash), F_WRLCK) != 0) + TDB_LOG((tdb, 0, "tdb_firstkey: error occurred while tdb_unlocking!\n")); + return key; +} + +/* find the next entry in the database, returning its key */ +TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA oldkey) +{ + u32 oldhash; + TDB_DATA key = tdb_null; + struct list_struct rec; + char *k = NULL; + + /* Is locked key the old key? If so, traverse will be reliable. */ + if (tdb->travlocks.off) { + if (tdb_lock(tdb,tdb->travlocks.hash,F_WRLCK)) + return tdb_null; + if (rec_read(tdb, tdb->travlocks.off, &rec) == -1 + || !(k = tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec), + rec.key_len)) + || memcmp(k, oldkey.dptr, oldkey.dsize) != 0) { + /* No, it wasn't: unlock it and start from scratch */ + if (unlock_record(tdb, tdb->travlocks.off) != 0) + return tdb_null; + if (tdb_unlock(tdb, tdb->travlocks.hash, F_WRLCK) != 0) + return tdb_null; + tdb->travlocks.off = 0; + } + + SAFE_FREE(k); + } + + if (!tdb->travlocks.off) { + /* No previous element: do normal find, and lock record */ + tdb->travlocks.off = tdb_find_lock(tdb, oldkey, F_WRLCK, &rec); + if (!tdb->travlocks.off) + return tdb_null; + tdb->travlocks.hash = BUCKET(rec.full_hash); + if (lock_record(tdb, tdb->travlocks.off) != 0) { + TDB_LOG((tdb, 0, "tdb_nextkey: lock_record failed (%s)!\n", strerror(errno))); + return tdb_null; + } + } + oldhash = tdb->travlocks.hash; + + /* Grab next record: locks chain and returned record, + unlocks old record */ + if (tdb_next_lock(tdb, &tdb->travlocks, &rec) > 0) { + key.dsize = rec.key_len; + key.dptr = tdb_alloc_read(tdb, tdb->travlocks.off+sizeof(rec), + key.dsize); + /* Unlock the chain of this new record */ + if (tdb_unlock(tdb, tdb->travlocks.hash, F_WRLCK) != 0) + TDB_LOG((tdb, 0, "tdb_nextkey: WARNING tdb_unlock failed!\n")); + } + /* Unlock the chain of old record */ + if (tdb_unlock(tdb, BUCKET(oldhash), F_WRLCK) != 0) + TDB_LOG((tdb, 0, "tdb_nextkey: WARNING tdb_unlock failed!\n")); + return key; +} + +/* delete an entry in the database given a key */ +int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key) +{ + tdb_off rec_ptr; + struct list_struct rec; + int ret; + + if (!(rec_ptr = tdb_find_lock(tdb, key, F_WRLCK, &rec))) + return -1; + ret = do_delete(tdb, rec_ptr, &rec); + if (tdb_unlock(tdb, BUCKET(rec.full_hash), F_WRLCK) != 0) + TDB_LOG((tdb, 0, "tdb_delete: WARNING tdb_unlock failed!\n")); + return ret; +} + +/* store an element in the database, replacing any existing element + with the same key + + return 0 on success, -1 on failure +*/ +int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag) +{ + struct list_struct rec; + u32 hash; + tdb_off rec_ptr; + char *p = NULL; + int ret = 0; + + /* find which hash bucket it is in */ + hash = tdb_hash(&key); + if (!tdb_keylocked(tdb, hash)) + return -1; + if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1) + return -1; + + /* check for it existing, on insert. */ + if (flag == TDB_INSERT) { + if (tdb_exists(tdb, key)) { + tdb->ecode = TDB_ERR_EXISTS; + goto fail; + } + } else { + /* first try in-place update, on modify or replace. */ + if (tdb_update(tdb, key, dbuf) == 0) + goto out; + if (flag == TDB_MODIFY && tdb->ecode == TDB_ERR_NOEXIST) + goto fail; + } + /* reset the error code potentially set by the tdb_update() */ + tdb->ecode = TDB_SUCCESS; + + /* delete any existing record - if it doesn't exist we don't + care. Doing this first reduces fragmentation, and avoids + coalescing with `allocated' block before it's updated. */ + if (flag != TDB_INSERT) + tdb_delete(tdb, key); + + /* Copy key+value *before* allocating free space in case malloc + fails and we are left with a dead spot in the tdb. */ + + if (!(p = (char *)malloc(key.dsize + dbuf.dsize))) { + tdb->ecode = TDB_ERR_OOM; + goto fail; + } + + memcpy(p, key.dptr, key.dsize); + if (dbuf.dsize) + memcpy(p+key.dsize, dbuf.dptr, dbuf.dsize); + + /* now we're into insert / modify / replace of a record which + * we know could not be optimised by an in-place store (for + * various reasons). */ + if (!(rec_ptr = tdb_allocate(tdb, key.dsize + dbuf.dsize, &rec))) + goto fail; + + /* Read hash top into next ptr */ + if (ofs_read(tdb, TDB_HASH_TOP(hash), &rec.next) == -1) + goto fail; + + rec.key_len = key.dsize; + rec.data_len = dbuf.dsize; + rec.full_hash = hash; + rec.magic = TDB_MAGIC; + + /* write out and point the top of the hash chain at it */ + if (rec_write(tdb, rec_ptr, &rec) == -1 + || tdb_write(tdb, rec_ptr+sizeof(rec), p, key.dsize+dbuf.dsize)==-1 + || ofs_write(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) { + /* Need to tdb_unallocate() here */ + goto fail; + } + out: + SAFE_FREE(p); + tdb_unlock(tdb, BUCKET(hash), F_WRLCK); + return ret; +fail: + ret = -1; + goto out; +} + +/* Attempt to append data to an entry in place - this only works if the new data size + is <= the old data size and the key exists. + on failure return -1. Record must be locked before calling. +*/ +static int tdb_append_inplace(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf) +{ + struct list_struct rec; + tdb_off rec_ptr; + + /* find entry */ + if (!(rec_ptr = tdb_find(tdb, key, tdb_hash(&key), &rec))) + return -1; + + /* Append of 0 is always ok. */ + if (new_dbuf.dsize == 0) + return 0; + + /* must be long enough for key, old data + new data and tailer */ + if (rec.rec_len < key.dsize + rec.data_len + new_dbuf.dsize + sizeof(tdb_off)) { + /* No room. */ + tdb->ecode = TDB_SUCCESS; /* Not really an error */ + return -1; + } + + if (tdb_write(tdb, rec_ptr + sizeof(rec) + rec.key_len + rec.data_len, + new_dbuf.dptr, new_dbuf.dsize) == -1) + return -1; + + /* update size */ + rec.data_len += new_dbuf.dsize; + return rec_write(tdb, rec_ptr, &rec); +} + +/* Append to an entry. Create if not exist. */ + +int tdb_append(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf) +{ + struct list_struct rec; + u32 hash; + tdb_off rec_ptr; + char *p = NULL; + int ret = 0; + size_t new_data_size = 0; + + /* find which hash bucket it is in */ + hash = tdb_hash(&key); + if (!tdb_keylocked(tdb, hash)) + return -1; + if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1) + return -1; + + /* first try in-place. */ + if (tdb_append_inplace(tdb, key, new_dbuf) == 0) + goto out; + + /* reset the error code potentially set by the tdb_append_inplace() */ + tdb->ecode = TDB_SUCCESS; + + /* find entry */ + if (!(rec_ptr = tdb_find(tdb, key, hash, &rec))) { + if (tdb->ecode != TDB_ERR_NOEXIST) + goto fail; + + /* Not found - create. */ + + ret = tdb_store(tdb, key, new_dbuf, TDB_INSERT); + goto out; + } + + new_data_size = rec.data_len + new_dbuf.dsize; + + /* Copy key+old_value+value *before* allocating free space in case malloc + fails and we are left with a dead spot in the tdb. */ + + if (!(p = (char *)malloc(key.dsize + new_data_size))) { + tdb->ecode = TDB_ERR_OOM; + goto fail; + } + + /* Copy the key in place. */ + memcpy(p, key.dptr, key.dsize); + + /* Now read the old data into place. */ + if (rec.data_len && + tdb_read(tdb, rec_ptr + sizeof(rec) + rec.key_len, p + key.dsize, rec.data_len, 0) == -1) + goto fail; + + /* Finally append the new data. */ + if (new_dbuf.dsize) + memcpy(p+key.dsize+rec.data_len, new_dbuf.dptr, new_dbuf.dsize); + + /* delete any existing record - if it doesn't exist we don't + care. Doing this first reduces fragmentation, and avoids + coalescing with `allocated' block before it's updated. */ + + tdb_delete(tdb, key); + + if (!(rec_ptr = tdb_allocate(tdb, key.dsize + new_data_size, &rec))) + goto fail; + + /* Read hash top into next ptr */ + if (ofs_read(tdb, TDB_HASH_TOP(hash), &rec.next) == -1) + goto fail; + + rec.key_len = key.dsize; + rec.data_len = new_data_size; + rec.full_hash = hash; + rec.magic = TDB_MAGIC; + + /* write out and point the top of the hash chain at it */ + if (rec_write(tdb, rec_ptr, &rec) == -1 + || tdb_write(tdb, rec_ptr+sizeof(rec), p, key.dsize+new_data_size)==-1 + || ofs_write(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) { + /* Need to tdb_unallocate() here */ + goto fail; + } + + out: + SAFE_FREE(p); + tdb_unlock(tdb, BUCKET(hash), F_WRLCK); + return ret; + +fail: + ret = -1; + goto out; +} + +static int tdb_already_open(dev_t device, + ino_t ino) +{ + TDB_CONTEXT *i; + + for (i = tdbs; i; i = i->next) { + if (i->device == device && i->inode == ino) { + return 1; + } + } + + return 0; +} + +/* open the database, creating it if necessary + + The open_flags and mode are passed straight to the open call on the + database file. A flags value of O_WRONLY is invalid. The hash size + is advisory, use zero for a default value. + + Return is NULL on error, in which case errno is also set. Don't + try to call tdb_error or tdb_errname, just do strerror(errno). + + @param name may be NULL for internal databases. */ +TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode) +{ + return tdb_open_ex(name, hash_size, tdb_flags, open_flags, mode, NULL); +} + + +TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode, + tdb_log_func log_fn) +{ + TDB_CONTEXT *tdb; + struct stat st; + int rev = 0, locked; + unsigned char *vp; + u32 vertest; + + if (!(tdb = calloc(1, sizeof *tdb))) { + /* Can't log this */ + errno = ENOMEM; + goto fail; + } + tdb->fd = -1; + tdb->name = NULL; + tdb->map_ptr = NULL; + tdb->lockedkeys = NULL; + tdb->flags = tdb_flags; + tdb->open_flags = open_flags; + tdb->log_fn = log_fn; + + if ((open_flags & O_ACCMODE) == O_WRONLY) { + TDB_LOG((tdb, 0, "tdb_open_ex: can't open tdb %s write-only\n", + name)); + errno = EINVAL; + goto fail; + } + + if (hash_size == 0) + hash_size = DEFAULT_HASH_SIZE; + if ((open_flags & O_ACCMODE) == O_RDONLY) { + tdb->read_only = 1; + /* read only databases don't do locking or clear if first */ + tdb->flags |= TDB_NOLOCK; + tdb->flags &= ~TDB_CLEAR_IF_FIRST; + } + + /* internal databases don't mmap or lock, and start off cleared */ + if (tdb->flags & TDB_INTERNAL) { + tdb->flags |= (TDB_NOLOCK | TDB_NOMMAP); + tdb->flags &= ~TDB_CLEAR_IF_FIRST; + if (tdb_new_database(tdb, hash_size) != 0) { + TDB_LOG((tdb, 0, "tdb_open_ex: tdb_new_database failed!")); + goto fail; + } + goto internal; + } + + if ((tdb->fd = open(name, open_flags, mode)) == -1) { + TDB_LOG((tdb, 5, "tdb_open_ex: could not open file %s: %s\n", + name, strerror(errno))); + goto fail; /* errno set by open(2) */ + } + + /* ensure there is only one process initialising at once */ + if (tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0) == -1) { + TDB_LOG((tdb, 0, "tdb_open_ex: failed to get global lock on %s: %s\n", + name, strerror(errno))); + goto fail; /* errno set by tdb_brlock */ + } + + /* we need to zero database if we are the only one with it open */ + if ((locked = (tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0) == 0)) + && (tdb_flags & TDB_CLEAR_IF_FIRST)) { + open_flags |= O_CREAT; + if (ftruncate(tdb->fd, 0) == -1) { + TDB_LOG((tdb, 0, "tdb_open_ex: " + "failed to truncate %s: %s\n", + name, strerror(errno))); + goto fail; /* errno set by ftruncate */ + } + } + + if (read(tdb->fd, &tdb->header, sizeof(tdb->header)) != sizeof(tdb->header) + || strcmp(tdb->header.magic_food, TDB_MAGIC_FOOD) != 0 + || (tdb->header.version != TDB_VERSION + && !(rev = (tdb->header.version==TDB_BYTEREV(TDB_VERSION))))) { + /* its not a valid database - possibly initialise it */ + if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) { + errno = EIO; /* ie bad format or something */ + goto fail; + } + rev = (tdb->flags & TDB_CONVERT); + } + vp = (unsigned char *)&tdb->header.version; + vertest = (((u32)vp[0]) << 24) | (((u32)vp[1]) << 16) | + (((u32)vp[2]) << 8) | (u32)vp[3]; + tdb->flags |= (vertest==TDB_VERSION) ? TDB_BIGENDIAN : 0; + if (!rev) + tdb->flags &= ~TDB_CONVERT; + else { + tdb->flags |= TDB_CONVERT; + convert(&tdb->header, sizeof(tdb->header)); + } + if (fstat(tdb->fd, &st) == -1) + goto fail; + + /* Is it already in the open list? If so, fail. */ + if (tdb_already_open(st.st_dev, st.st_ino)) { + TDB_LOG((tdb, 2, "tdb_open_ex: " + "%s (%d,%d) is already open in this process\n", + name, st.st_dev, st.st_ino)); + errno = EBUSY; + goto fail; + } + + if (!(tdb->name = (char *)strdup(name))) { + errno = ENOMEM; + goto fail; + } + + tdb->map_size = st.st_size; + tdb->device = st.st_dev; + tdb->inode = st.st_ino; + tdb->locked = calloc(tdb->header.hash_size+1, sizeof(tdb->locked[0])); + if (!tdb->locked) { + TDB_LOG((tdb, 2, "tdb_open_ex: " + "failed to allocate lock structure for %s\n", + name)); + errno = ENOMEM; + goto fail; + } + tdb_mmap(tdb); + if (locked) { + if (!tdb->read_only) + if (tdb_clear_spinlocks(tdb) != 0) { + TDB_LOG((tdb, 0, "tdb_open_ex: " + "failed to clear spinlock\n")); + goto fail; + } + if (tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0) == -1) { + TDB_LOG((tdb, 0, "tdb_open_ex: " + "failed to take ACTIVE_LOCK on %s: %s\n", + name, strerror(errno))); + goto fail; + } + } + /* leave this lock in place to indicate it's in use */ + if (tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1) + goto fail; + + internal: + /* Internal (memory-only) databases skip all the code above to + * do with disk files, and resume here by releasing their + * global lock and hooking into the active list. */ + if (tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0) == -1) + goto fail; + tdb->next = tdbs; + tdbs = tdb; + return tdb; + + fail: + { int save_errno = errno; + + if (!tdb) + return NULL; + + if (tdb->map_ptr) { + if (tdb->flags & TDB_INTERNAL) + SAFE_FREE(tdb->map_ptr); + else + tdb_munmap(tdb); + } + SAFE_FREE(tdb->name); + if (tdb->fd != -1) + if (close(tdb->fd) != 0) + TDB_LOG((tdb, 5, "tdb_open_ex: failed to close tdb->fd on error!\n")); + SAFE_FREE(tdb->locked); + SAFE_FREE(tdb); + errno = save_errno; + return NULL; + } +} + +/** + * Close a database. + * + * @returns -1 for error; 0 for success. + **/ +int tdb_close(TDB_CONTEXT *tdb) +{ + TDB_CONTEXT **i; + int ret = 0; + + if (tdb->map_ptr) { + if (tdb->flags & TDB_INTERNAL) + SAFE_FREE(tdb->map_ptr); + else + tdb_munmap(tdb); + } + SAFE_FREE(tdb->name); + if (tdb->fd != -1) + ret = close(tdb->fd); + SAFE_FREE(tdb->locked); + SAFE_FREE(tdb->lockedkeys); + + /* Remove from contexts list */ + for (i = &tdbs; *i; i = &(*i)->next) { + if (*i == tdb) { + *i = tdb->next; + break; + } + } + + memset(tdb, 0, sizeof(*tdb)); + SAFE_FREE(tdb); + + return ret; +} + +/* lock/unlock entire database */ +int tdb_lockall(TDB_CONTEXT *tdb) +{ + u32 i; + + /* There are no locks on read-only dbs */ + if (tdb->read_only) + return TDB_ERRCODE(TDB_ERR_LOCK, -1); + if (tdb->lockedkeys) + return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); + for (i = 0; i < tdb->header.hash_size; i++) + if (tdb_lock(tdb, i, F_WRLCK)) + break; + + /* If error, release locks we have... */ + if (i < tdb->header.hash_size) { + u32 j; + + for ( j = 0; j < i; j++) + tdb_unlock(tdb, j, F_WRLCK); + return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); + } + + return 0; +} +void tdb_unlockall(TDB_CONTEXT *tdb) +{ + u32 i; + for (i=0; i < tdb->header.hash_size; i++) + tdb_unlock(tdb, i, F_WRLCK); +} + +int tdb_lockkeys(TDB_CONTEXT *tdb, u32 number, TDB_DATA keys[]) +{ + u32 i, j, hash; + + /* Can't lock more keys if already locked */ + if (tdb->lockedkeys) + return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); + if (!(tdb->lockedkeys = malloc(sizeof(u32) * (number+1)))) + return TDB_ERRCODE(TDB_ERR_OOM, -1); + /* First number in array is # keys */ + tdb->lockedkeys[0] = number; + + /* Insertion sort by bucket */ + for (i = 0; i < number; i++) { + hash = tdb_hash(&keys[i]); + for (j = 0; j < i && BUCKET(tdb->lockedkeys[j+1]) < BUCKET(hash); j++); + memmove(&tdb->lockedkeys[j+2], &tdb->lockedkeys[j+1], sizeof(u32) * (i-j)); + tdb->lockedkeys[j+1] = hash; + } + /* Finally, lock in order */ + for (i = 0; i < number; i++) + if (tdb_lock(tdb, i, F_WRLCK)) + break; + + /* If error, release locks we have... */ + if (i < number) { + for ( j = 0; j < i; j++) + tdb_unlock(tdb, j, F_WRLCK); + SAFE_FREE(tdb->lockedkeys); + return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); + } + return 0; +} + +/* Unlock the keys previously locked by tdb_lockkeys() */ +void tdb_unlockkeys(TDB_CONTEXT *tdb) +{ + u32 i; + if (!tdb->lockedkeys) + return; + for (i = 0; i < tdb->lockedkeys[0]; i++) + tdb_unlock(tdb, tdb->lockedkeys[i+1], F_WRLCK); + SAFE_FREE(tdb->lockedkeys); +} + +/* lock/unlock one hash chain. This is meant to be used to reduce + contention - it cannot guarantee how many records will be locked */ +int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key) +{ + return tdb_lock(tdb, BUCKET(tdb_hash(&key)), F_WRLCK); +} + +int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key) +{ + return tdb_unlock(tdb, BUCKET(tdb_hash(&key)), F_WRLCK); +} + +int tdb_chainlock_read(TDB_CONTEXT *tdb, TDB_DATA key) +{ + return tdb_lock(tdb, BUCKET(tdb_hash(&key)), F_RDLCK); +} + +int tdb_chainunlock_read(TDB_CONTEXT *tdb, TDB_DATA key) +{ + return tdb_unlock(tdb, BUCKET(tdb_hash(&key)), F_RDLCK); +} + + +/* register a loging function */ +void tdb_logging_function(TDB_CONTEXT *tdb, void (*fn)(TDB_CONTEXT *, int , const char *, ...)) +{ + tdb->log_fn = fn; +} + + +/* reopen a tdb - this is used after a fork to ensure that we have an independent + seek pointer from our parent and to re-establish locks */ +int tdb_reopen(TDB_CONTEXT *tdb) +{ + struct stat st; + + if (tdb_munmap(tdb) != 0) { + TDB_LOG((tdb, 0, "tdb_reopen: munmap failed (%s)\n", strerror(errno))); + goto fail; + } + if (close(tdb->fd) != 0) + TDB_LOG((tdb, 0, "tdb_reopen: WARNING closing tdb->fd failed!\n")); + tdb->fd = open(tdb->name, tdb->open_flags & ~(O_CREAT|O_TRUNC), 0); + if (tdb->fd == -1) { + TDB_LOG((tdb, 0, "tdb_reopen: open failed (%s)\n", strerror(errno))); + goto fail; + } + if (fstat(tdb->fd, &st) != 0) { + TDB_LOG((tdb, 0, "tdb_reopen: fstat failed (%s)\n", strerror(errno))); + goto fail; + } + if (st.st_ino != tdb->inode || st.st_dev != tdb->device) { + TDB_LOG((tdb, 0, "tdb_reopen: file dev/inode has changed!\n")); + goto fail; + } + tdb_mmap(tdb); + if (tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1) { + TDB_LOG((tdb, 0, "tdb_reopen: failed to obtain active lock\n")); + goto fail; + } + + return 0; + +fail: + tdb_close(tdb); + return -1; +} + +/* reopen all tdb's */ +int tdb_reopen_all(void) +{ + TDB_CONTEXT *tdb; + + for (tdb=tdbs; tdb; tdb = tdb->next) { + if (tdb_reopen(tdb) != 0) return -1; + } + + return 0; +} diff --git a/tdb/tdb.h b/tdb/tdb.h new file mode 100644 index 0000000000..6f3b1ff756 --- /dev/null +++ b/tdb/tdb.h @@ -0,0 +1,144 @@ +#ifndef __TDB_H__ +#define __TDB_H__ + +/* + Unix SMB/CIFS implementation. + Samba database functions + Copyright (C) Andrew Tridgell 1999 + + 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; either version 2 of the License, or + (at your option) any later version. + + 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 02139, USA. +*/ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* flags to tdb_store() */ +#define TDB_REPLACE 1 +#define TDB_INSERT 2 +#define TDB_MODIFY 3 + +/* flags for tdb_open() */ +#define TDB_DEFAULT 0 /* just a readability place holder */ +#define TDB_CLEAR_IF_FIRST 1 +#define TDB_INTERNAL 2 /* don't store on disk */ +#define TDB_NOLOCK 4 /* don't do any locking */ +#define TDB_NOMMAP 8 /* don't use mmap */ +#define TDB_CONVERT 16 /* convert endian (internal use) */ +#define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */ + +#define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret) + +/* error codes */ +enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK, + TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOEXIST, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT }; + +#ifndef u32 +#define u32 unsigned +#endif + +typedef struct { + char *dptr; + size_t dsize; +} TDB_DATA; + +typedef u32 tdb_len; +typedef u32 tdb_off; + +/* this is stored at the front of every database */ +struct tdb_header { + char magic_food[32]; /* for /etc/magic */ + u32 version; /* version of the code */ + u32 hash_size; /* number of hash entries */ + tdb_off rwlocks; + tdb_off reserved[31]; +}; + +struct tdb_lock_type { + u32 count; + u32 ltype; +}; + +struct tdb_traverse_lock { + struct tdb_traverse_lock *next; + u32 off; + u32 hash; +}; + +/* this is the context structure that is returned from a db open */ +typedef struct tdb_context { + char *name; /* the name of the database */ + void *map_ptr; /* where it is currently mapped */ + int fd; /* open file descriptor for the database */ + tdb_len map_size; /* how much space has been mapped */ + int read_only; /* opened read-only */ + struct tdb_lock_type *locked; /* array of chain locks */ + enum TDB_ERROR ecode; /* error code for last tdb error */ + struct tdb_header header; /* a cached copy of the header */ + u32 flags; /* the flags passed to tdb_open */ + u32 *lockedkeys; /* array of locked keys: first is #keys */ + struct tdb_traverse_lock travlocks; /* current traversal locks */ + struct tdb_context *next; /* all tdbs to avoid multiple opens */ + dev_t device; /* uniquely identifies this tdb */ + ino_t inode; /* uniquely identifies this tdb */ + void (*log_fn)(struct tdb_context *tdb, int level, const char *, ...); /* logging function */ + int open_flags; /* flags used in the open - needed by reopen */ +} TDB_CONTEXT; + +typedef int (*tdb_traverse_func)(TDB_CONTEXT *, TDB_DATA, TDB_DATA, void *); +typedef void (*tdb_log_func)(TDB_CONTEXT *, int , const char *, ...); + +TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode); +TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode, + tdb_log_func log_fn); + +int tdb_reopen(TDB_CONTEXT *tdb); +int tdb_reopen_all(void); +void tdb_logging_function(TDB_CONTEXT *tdb, tdb_log_func); +enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb); +const char *tdb_errorstr(TDB_CONTEXT *tdb); +TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key); +int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key); +int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); +int tdb_append(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf); +int tdb_close(TDB_CONTEXT *tdb); +TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb); +TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key); +int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *state); +int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key); +int tdb_lockkeys(TDB_CONTEXT *tdb, u32 number, TDB_DATA keys[]); +void tdb_unlockkeys(TDB_CONTEXT *tdb); +int tdb_lockall(TDB_CONTEXT *tdb); +void tdb_unlockall(TDB_CONTEXT *tdb); + +/* Low level locking functions: use with care */ +void tdb_set_lock_alarm(sig_atomic_t *palarm); +int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key); +int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key); + +/* Debug functions. Not used in production. */ +void tdb_dump_all(TDB_CONTEXT *tdb); +int tdb_printfreelist(TDB_CONTEXT *tdb); + +extern TDB_DATA tdb_null; + +#ifdef __cplusplus +} +#endif + +#endif /* tdb.h */ diff --git a/tdb/tdb.magic b/tdb/tdb.magic new file mode 100644 index 0000000000..f5619e7327 --- /dev/null +++ b/tdb/tdb.magic @@ -0,0 +1,10 @@ +# Magic file(1) information about tdb files. +# +# Install this into /etc/magic or the corresponding location for your +# system, or pass as a -m argument to file(1). + +# You may use and redistribute this file without restriction. + +0 string TDB\ file TDB database +>32 lelong =0x2601196D version 6, little-endian +>>36 lelong x hash size %d bytes diff --git a/tdb/tdbback.c b/tdb/tdbback.c new file mode 100644 index 0000000000..744cface55 --- /dev/null +++ b/tdb/tdbback.c @@ -0,0 +1,201 @@ +/* + Unix SMB/CIFS implementation. + low level tdb backup and restore utility + Copyright (C) Andrew Tridgell 2002 + + 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; either version 2 of the License, or + (at your option) any later version. + + 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 02139, USA. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tdb.h" + +static int failed; + +char *add_suffix(const char *name, const char *suffix) +{ + char *ret; + int len = strlen(name) + strlen(suffix) + 1; + ret = malloc(len); + if (!ret) { + fprintf(stderr,"Out of memory!\n"); + exit(1); + } + strncpy(ret, name, len); + strncat(ret, suffix, len); + return ret; +} + +static int copy_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) +{ + TDB_CONTEXT *tdb_new = (TDB_CONTEXT *)state; + + if (tdb_store(tdb_new, key, dbuf, TDB_INSERT) != 0) { + fprintf(stderr,"Failed to insert into %s\n", tdb_new->name); + failed = 1; + return 1; + } + return 0; +} + + +static int test_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) +{ + return 0; +} + +/* + carefully backup a tdb, validating the contents and + only doing the backup if its OK + this function is also used for restore +*/ +int backup_tdb(const char *old_name, const char *new_name) +{ + TDB_CONTEXT *tdb; + TDB_CONTEXT *tdb_new; + char *tmp_name; + struct stat st; + int count1, count2; + + tmp_name = add_suffix(new_name, ".tmp"); + + /* stat the old tdb to find its permissions */ + if (stat(old_name, &st) != 0) { + perror(old_name); + return 1; + } + + /* open the old tdb */ + tdb = tdb_open(old_name, 0, 0, O_RDWR, 0); + if (!tdb) { + printf("Failed to open %s\n", old_name); + return 1; + } + + /* create the new tdb */ + unlink(tmp_name); + tdb_new = tdb_open(tmp_name, tdb->header.hash_size, + TDB_DEFAULT, O_RDWR|O_CREAT|O_EXCL, + st.st_mode & 0777); + if (!tdb_new) { + perror(tmp_name); + free(tmp_name); + return 1; + } + + /* lock the old tdb */ + if (tdb_lockall(tdb) != 0) { + fprintf(stderr,"Failed to lock %s\n", old_name); + tdb_close(tdb); + tdb_close(tdb_new); + unlink(tmp_name); + free(tmp_name); + return 1; + } + + failed = 0; + + /* traverse and copy */ + count1 = tdb_traverse(tdb, copy_fn, (void *)tdb_new); + if (count1 < 0 || failed) { + fprintf(stderr,"failed to copy %s\n", old_name); + tdb_close(tdb); + tdb_close(tdb_new); + unlink(tmp_name); + free(tmp_name); + return 1; + } + + /* close the old tdb */ + tdb_close(tdb); + + /* close the new tdb and re-open read-only */ + tdb_close(tdb_new); + tdb_new = tdb_open(tmp_name, 0, TDB_DEFAULT, O_RDONLY, 0); + if (!tdb_new) { + fprintf(stderr,"failed to reopen %s\n", tmp_name); + unlink(tmp_name); + perror(tmp_name); + free(tmp_name); + return 1; + } + + /* traverse the new tdb to confirm */ + count2 = tdb_traverse(tdb_new, test_fn, 0); + if (count2 != count1) { + fprintf(stderr,"failed to copy %s\n", old_name); + tdb_close(tdb_new); + unlink(tmp_name); + free(tmp_name); + return 1; + } + + /* make sure the new tdb has reached stable storage */ + fsync(tdb_new->fd); + + /* close the new tdb and rename it to .bak */ + tdb_close(tdb_new); + unlink(new_name); + if (rename(tmp_name, new_name) != 0) { + perror(new_name); + free(tmp_name); + return 1; + } + + free(tmp_name); + + return 0; +} + + + +/* + verify a tdb and if it is corrupt then restore from *.bak +*/ +int verify_tdb(const char *fname, const char *bak_name) +{ + TDB_CONTEXT *tdb; + int count = -1; + + /* open the tdb */ + tdb = tdb_open(fname, 0, 0, O_RDONLY, 0); + + /* traverse the tdb, then close it */ + if (tdb) { + count = tdb_traverse(tdb, test_fn, NULL); + tdb_close(tdb); + } + + /* count is < 0 means an error */ + if (count < 0) { + printf("restoring %s\n", fname); + return backup_tdb(bak_name, fname); + } + + printf("%s : %d records\n", fname, count); + + return 0; +} diff --git a/tdb/tdbback.h b/tdb/tdbback.h new file mode 100644 index 0000000000..7ebeaa494d --- /dev/null +++ b/tdb/tdbback.h @@ -0,0 +1,23 @@ +/* + Unix SMB/CIFS implementation. + low level tdb backup and restore utility + Copyright (C) Andrew Tridgell 2002 + + 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; either version 2 of the License, or + (at your option) any later version. + + 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 02139, USA. +*/ + +char *add_suffix(const char *name, const char *suffix); +int backup_tdb(const char *old_name, const char *new_name); +int verify_tdb(const char *fname, const char *bak_name); diff --git a/tdb/tdbbackup.c b/tdb/tdbbackup.c new file mode 100644 index 0000000000..0eaf6b6c0b --- /dev/null +++ b/tdb/tdbbackup.c @@ -0,0 +1,137 @@ +/* + Unix SMB/CIFS implementation. + low level tdb backup and restore utility + Copyright (C) Andrew Tridgell 2002 + + 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; either version 2 of the License, or + (at your option) any later version. + + 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 02139, USA. +*/ + +/* + + This program is meant for backup/restore of tdb databases. Typical usage would be: + tdbbackup *.tdb + when Samba shuts down cleanly, which will make a backup of all the local databases + to *.bak files. Then on Samba startup you would use: + tdbbackup -v *.tdb + and this will check the databases for corruption and if corruption is detected then + the backup will be restored. + + You may also like to do a backup on a regular basis while Samba is + running, perhaps using cron. + + The reason this program is needed is to cope with power failures + while Samba is running. A power failure could lead to database + corruption and Samba will then not start correctly. + + Note that many of the databases in Samba are transient and thus + don't need to be backed up, so you can optimise the above a little + by only running the backup on the critical databases. + + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tdb.h" +#include "tdbback.h" + +/* + see if one file is newer than another +*/ +static int file_newer(const char *fname1, const char *fname2) +{ + struct stat st1, st2; + if (stat(fname1, &st1) != 0) { + return 0; + } + if (stat(fname2, &st2) != 0) { + return 1; + } + return (st1.st_mtime > st2.st_mtime); +} + +static void usage(void) +{ + printf("Usage: tdbbackup [options] \n\n"); + printf(" -h this help message\n"); + printf(" -s suffix set the backup suffix\n"); + printf(" -v verify mode (restore if corrupt)\n"); +} + + + int main(int argc, char *argv[]) +{ + int i; + int ret = 0; + int c; + int verify = 0; + const char *suffix = ".bak"; + extern int optind; + extern char *optarg; + + while ((c = getopt(argc, argv, "vhs:")) != -1) { + switch (c) { + case 'h': + usage(); + exit(0); + case 'v': + verify = 1; + break; + case 's': + suffix = optarg; + break; + } + } + + argc -= optind; + argv += optind; + + if (argc < 1) { + usage(); + exit(1); + } + + for (i=0; i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tdb.h" + +static void print_data(TDB_DATA d) +{ + unsigned char *p = d.dptr; + int len = d.dsize; + while (len--) { + if (isprint(*p) && !strchr("\"\\", *p)) { + fputc(*p, stdout); + } else { + printf("\\%02X", *p); + } + p++; + } +} + +static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) +{ + printf("{\n"); + printf("key = \""); + print_data(key); + printf("\"\n"); + printf("data = \""); + print_data(dbuf); + printf("\"\n"); + printf("}\n"); + return 0; +} + +static int dump_tdb(const char *fname) +{ + TDB_CONTEXT *tdb; + + tdb = tdb_open(fname, 0, 0, O_RDONLY, 0); + if (!tdb) { + printf("Failed to open %s\n", fname); + return 1; + } + + tdb_traverse(tdb, traverse_fn, NULL); + return 0; +} + + int main(int argc, char *argv[]) +{ + char *fname; + + if (argc < 2) { + printf("Usage: tdbdump \n"); + exit(1); + } + + fname = argv[1]; + + return dump_tdb(fname); +} diff --git a/tdb/tdbtest.c b/tdb/tdbtest.c new file mode 100644 index 0000000000..89295a3291 --- /dev/null +++ b/tdb/tdbtest.c @@ -0,0 +1,263 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tdb.h" +#include + +/* a test program for tdb - the trivial database */ + + + +#define DELETE_PROB 7 +#define STORE_PROB 5 + +static TDB_CONTEXT *db; +static GDBM_FILE gdbm; + +struct timeval tp1,tp2; + +static void start_timer(void) +{ + gettimeofday(&tp1,NULL); +} + +static double end_timer(void) +{ + gettimeofday(&tp2,NULL); + return((tp2.tv_sec - tp1.tv_sec) + + (tp2.tv_usec - tp1.tv_usec)*1.0e-6); +} + +static void fatal(char *why) +{ + perror(why); + exit(1); +} + +static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + vfprintf(stdout, format, ap); + va_end(ap); + fflush(stdout); +} + +static void compare_db(void) +{ + TDB_DATA d, key, nextkey; + datum gd, gkey, gnextkey; + + key = tdb_firstkey(db); + while (key.dptr) { + d = tdb_fetch(db, key); + gkey.dptr = key.dptr; + gkey.dsize = key.dsize; + + gd = gdbm_fetch(gdbm, gkey); + + if (!gd.dptr) fatal("key not in gdbm"); + if (gd.dsize != d.dsize) fatal("data sizes differ"); + if (memcmp(gd.dptr, d.dptr, d.dsize)) { + fatal("data differs"); + } + + nextkey = tdb_nextkey(db, key); + free(key.dptr); + free(d.dptr); + free(gd.dptr); + key = nextkey; + } + + gkey = gdbm_firstkey(gdbm); + while (gkey.dptr) { + gd = gdbm_fetch(gdbm, gkey); + key.dptr = gkey.dptr; + key.dsize = gkey.dsize; + + d = tdb_fetch(db, key); + + if (!d.dptr) fatal("key not in db"); + if (d.dsize != gd.dsize) fatal("data sizes differ"); + if (memcmp(d.dptr, gd.dptr, gd.dsize)) { + fatal("data differs"); + } + + gnextkey = gdbm_nextkey(gdbm, gkey); + free(gkey.dptr); + free(gd.dptr); + free(d.dptr); + gkey = gnextkey; + } +} + +static char *randbuf(int len) +{ + char *buf; + int i; + buf = (char *)malloc(len+1); + + for (i=0;i +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tdb.h" + +/* a tdb tool for manipulating a tdb database */ + +#define FSTRING_LEN 256 +typedef char fstring[FSTRING_LEN]; + +typedef struct connections_key { + pid_t pid; + int cnum; + fstring name; +} connections_key; + +typedef struct connections_data { + int magic; + pid_t pid; + int cnum; + uid_t uid; + gid_t gid; + char name[24]; + char addr[24]; + char machine[128]; + time_t start; +} connections_data; + +static TDB_CONTEXT *tdb; + +static int print_rec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state); + +static void print_asc(unsigned char *buf,int len) +{ + int i; + + /* We're probably printing ASCII strings so don't try to display + the trailing NULL character. */ + + if (buf[len - 1] == 0) + len--; + + for (i=0;i8) printf(" "); + while (n--) printf(" "); + + n = i%16; + if (n > 8) n = 8; + print_asc(&buf[i-(i%16)],n); printf(" "); + n = (i%16) - n; + if (n>0) print_asc(&buf[i-n],n); + printf("\n"); + } +} + +static void help(void) +{ + printf("\n" +"tdbtool: \n" +" create dbname : create a database\n" +" open dbname : open an existing database\n" +" erase : erase the database\n" +" dump : dump the database as strings\n" +" insert key data : insert a record\n" +" move key file : move a record to a destination tdb\n" +" store key data : store a record (replace)\n" +" show key : show a record by key\n" +" delete key : delete a record by key\n" +" list : print the database hash table and freelist\n" +" free : print the database freelist\n" +" 1 | first : print the first record\n" +" n | next : print the next record\n" +" q | quit : terminate\n" +" \\n : repeat 'next' command\n" +"\n"); +} + +static void terror(char *why) +{ + printf("%s\n", why); +} + +static char *get_token(int startover) +{ + static char tmp[1024]; + static char *cont = NULL; + char *insert, *start; + char *k = strtok(NULL, " "); + + if (!k) + return NULL; + + if (startover) + start = tmp; + else + start = cont; + + strcpy(start, k); + insert = start + strlen(start) - 1; + while (*insert == '\\') { + *insert++ = ' '; + k = strtok(NULL, " "); + if (!k) + break; + strcpy(insert, k); + insert = start + strlen(start) - 1; + } + + /* Get ready for next call */ + cont = start + strlen(start) + 1; + return start; +} + +static void create_tdb(void) +{ + char *tok = get_token(1); + if (!tok) { + help(); + return; + } + if (tdb) tdb_close(tdb); + tdb = tdb_open(tok, 0, TDB_CLEAR_IF_FIRST, + O_RDWR | O_CREAT | O_TRUNC, 0600); + if (!tdb) { + printf("Could not create %s: %s\n", tok, strerror(errno)); + } +} + +static void open_tdb(void) +{ + char *tok = get_token(1); + if (!tok) { + help(); + return; + } + if (tdb) tdb_close(tdb); + tdb = tdb_open(tok, 0, 0, O_RDWR, 0600); + if (!tdb) { + printf("Could not open %s: %s\n", tok, strerror(errno)); + } +} + +static void insert_tdb(void) +{ + char *k = get_token(1); + char *d = get_token(0); + TDB_DATA key, dbuf; + + if (!k || !d) { + help(); + return; + } + + key.dptr = k; + key.dsize = strlen(k)+1; + dbuf.dptr = d; + dbuf.dsize = strlen(d)+1; + + if (tdb_store(tdb, key, dbuf, TDB_INSERT) == -1) { + terror("insert failed"); + } +} + +static void store_tdb(void) +{ + char *k = get_token(1); + char *d = get_token(0); + TDB_DATA key, dbuf; + + if (!k || !d) { + help(); + return; + } + + key.dptr = k; + key.dsize = strlen(k)+1; + dbuf.dptr = d; + dbuf.dsize = strlen(d)+1; + + printf("Storing key:\n"); + print_rec(tdb, key, dbuf, NULL); + + if (tdb_store(tdb, key, dbuf, TDB_REPLACE) == -1) { + terror("store failed"); + } +} + +static void show_tdb(void) +{ + char *k = get_token(1); + TDB_DATA key, dbuf; + + if (!k) { + help(); + return; + } + + key.dptr = k; + key.dsize = strlen(k)+1; + + dbuf = tdb_fetch(tdb, key); + if (!dbuf.dptr) { + /* maybe it is non-NULL terminated key? */ + key.dsize = strlen(k); + dbuf = tdb_fetch(tdb, key); + + if ( !dbuf.dptr ) { + terror("fetch failed"); + return; + } + } + + /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */ + print_rec(tdb, key, dbuf, NULL); + + free( dbuf.dptr ); + + return; +} + +static void delete_tdb(void) +{ + char *k = get_token(1); + TDB_DATA key; + + if (!k) { + help(); + return; + } + + key.dptr = k; + key.dsize = strlen(k)+1; + + if (tdb_delete(tdb, key) != 0) { + terror("delete failed"); + } +} + +static void move_rec(void) +{ + char *k = get_token(1); + char *file = get_token(0); + TDB_DATA key, dbuf; + TDB_CONTEXT *dst_tdb; + + if (!k) { + help(); + return; + } + + if ( !file ) { + terror("need destination tdb name"); + return; + } + + key.dptr = k; + key.dsize = strlen(k)+1; + + dbuf = tdb_fetch(tdb, key); + if (!dbuf.dptr) { + /* maybe it is non-NULL terminated key? */ + key.dsize = strlen(k); + dbuf = tdb_fetch(tdb, key); + + if ( !dbuf.dptr ) { + terror("fetch failed"); + return; + } + } + + print_rec(tdb, key, dbuf, NULL); + + dst_tdb = tdb_open(file, 0, 0, O_RDWR, 0600); + if ( !dst_tdb ) { + terror("unable to open destination tdb"); + return; + } + + if ( tdb_store( dst_tdb, key, dbuf, TDB_REPLACE ) == -1 ) { + terror("failed to move record"); + } + else + printf("record moved\n"); + + tdb_close( dst_tdb ); + + return; +} + +#if 0 +static int print_conn_key(TDB_DATA key) +{ + printf( "pid =%5d ", ((connections_key*)key.dptr)->pid); + printf( "cnum =%10d ", ((connections_key*)key.dptr)->cnum); + printf( "name =[%s]\n", ((connections_key*)key.dptr)->name); + return 0; +} + +static int print_conn_data(TDB_DATA dbuf) +{ + printf( "pid =%5d ", ((connections_data*)dbuf.dptr)->pid); + printf( "cnum =%10d ", ((connections_data*)dbuf.dptr)->cnum); + printf( "name =[%s]\n", ((connections_data*)dbuf.dptr)->name); + + printf( "uid =%5d ", ((connections_data*)dbuf.dptr)->uid); + printf( "addr =[%s]\n", ((connections_data*)dbuf.dptr)->addr); + printf( "gid =%5d ", ((connections_data*)dbuf.dptr)->gid); + printf( "machine=[%s]\n", ((connections_data*)dbuf.dptr)->machine); + printf( "start = %s\n", ctime(&((connections_data*)dbuf.dptr)->start)); + return 0; +} +#endif + +static int print_rec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state) +{ +#if 0 + print_conn_key(key); + print_conn_data(dbuf); + return 0; +#else + printf("\nkey %d bytes\n", key.dsize); + print_asc(key.dptr, key.dsize); + printf("\ndata %d bytes\n", dbuf.dsize); + print_data(dbuf.dptr, dbuf.dsize); + return 0; +#endif +} + +static int print_key(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state) +{ + print_asc(key.dptr, key.dsize); + printf("\n"); + return 0; +} + +static int total_bytes; + +static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state) +{ + total_bytes += dbuf.dsize; + return 0; +} + +static void info_tdb(void) +{ + int count; + total_bytes = 0; + if ((count = tdb_traverse(tdb, traverse_fn, NULL) == -1)) + printf("Error = %s\n", tdb_errorstr(tdb)); + else + printf("%d records totalling %d bytes\n", count, total_bytes); +} + +static char *tdb_getline(char *prompt) +{ + static char line[1024]; + char *p; + fputs(prompt, stdout); + line[0] = 0; + p = fgets(line, sizeof(line)-1, stdin); + if (p) p = strchr(p, '\n'); + if (p) *p = 0; + return p?line:NULL; +} + +static int do_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, + void *state) +{ + return tdb_delete(the_tdb, key); +} + +static void first_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey) +{ + TDB_DATA dbuf; + *pkey = tdb_firstkey(the_tdb); + + dbuf = tdb_fetch(the_tdb, *pkey); + if (!dbuf.dptr) terror("fetch failed"); + else { + /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */ + print_rec(the_tdb, *pkey, dbuf, NULL); + } +} + +static void next_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey) +{ + TDB_DATA dbuf; + *pkey = tdb_nextkey(the_tdb, *pkey); + + dbuf = tdb_fetch(the_tdb, *pkey); + if (!dbuf.dptr) + terror("fetch failed"); + else + /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */ + print_rec(the_tdb, *pkey, dbuf, NULL); +} + +int main(int argc, char *argv[]) +{ + int bIterate = 0; + char *line; + char *tok; + TDB_DATA iterate_kbuf; + + if (argv[1]) { + static char tmp[1024]; + sprintf(tmp, "open %s", argv[1]); + tok=strtok(tmp," "); + open_tdb(); + } + + while ((line = tdb_getline("tdb> "))) { + + /* Shell command */ + + if (line[0] == '!') { + system(line + 1); + continue; + } + + if ((tok = strtok(line," "))==NULL) { + if (bIterate) + next_record(tdb, &iterate_kbuf); + continue; + } + if (strcmp(tok,"create") == 0) { + bIterate = 0; + create_tdb(); + continue; + } else if (strcmp(tok,"open") == 0) { + open_tdb(); + continue; + } else if ((strcmp(tok, "q") == 0) || + (strcmp(tok, "quit") == 0)) { + break; + } + + /* all the rest require a open database */ + if (!tdb) { + bIterate = 0; + terror("database not open"); + help(); + continue; + } + + if (strcmp(tok,"insert") == 0) { + bIterate = 0; + insert_tdb(); + } else if (strcmp(tok,"store") == 0) { + bIterate = 0; + store_tdb(); + } else if (strcmp(tok,"show") == 0) { + bIterate = 0; + show_tdb(); + } else if (strcmp(tok,"erase") == 0) { + bIterate = 0; + tdb_traverse(tdb, do_delete_fn, NULL); + } else if (strcmp(tok,"delete") == 0) { + bIterate = 0; + delete_tdb(); + } else if (strcmp(tok,"dump") == 0) { + bIterate = 0; + tdb_traverse(tdb, print_rec, NULL); + } else if (strcmp(tok,"move") == 0) { + bIterate = 0; + move_rec(); + } else if (strcmp(tok,"list") == 0) { + tdb_dump_all(tdb); + } else if (strcmp(tok, "free") == 0) { + tdb_printfreelist(tdb); + } else if (strcmp(tok,"info") == 0) { + info_tdb(); + } else if ( (strcmp(tok, "1") == 0) || + (strcmp(tok, "first") == 0)) { + bIterate = 1; + first_record(tdb, &iterate_kbuf); + } else if ((strcmp(tok, "n") == 0) || + (strcmp(tok, "next") == 0)) { + next_record(tdb, &iterate_kbuf); + } else if ((strcmp(tok, "keys") == 0)) { + bIterate = 0; + tdb_traverse(tdb, print_key, NULL); + } else { + help(); + } + } + + if (tdb) tdb_close(tdb); + + return 0; +} diff --git a/tdb/tdbtorture.c b/tdb/tdbtorture.c new file mode 100644 index 0000000000..e27bbff990 --- /dev/null +++ b/tdb/tdbtorture.c @@ -0,0 +1,226 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "tdb.h" + +/* this tests tdb by doing lots of ops from several simultaneous + writers - that stresses the locking code. Build with TDB_DEBUG=1 + for best effect */ + + + +#define REOPEN_PROB 30 +#define DELETE_PROB 8 +#define STORE_PROB 4 +#define APPEND_PROB 6 +#define LOCKSTORE_PROB 0 +#define TRAVERSE_PROB 20 +#define CULL_PROB 100 +#define KEYLEN 3 +#define DATALEN 100 +#define LOCKLEN 20 + +static TDB_CONTEXT *db; + +static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + vfprintf(stdout, format, ap); + va_end(ap); + fflush(stdout); +#if 0 + { + char *ptr; + asprintf(&ptr,"xterm -e gdb /proc/%d/exe %d", getpid(), getpid()); + system(ptr); + free(ptr); + } +#endif +} + +static void fatal(char *why) +{ + perror(why); + exit(1); +} + +static char *randbuf(int len) +{ + char *buf; + int i; + buf = (char *)malloc(len+1); + + for (i=0;i + +/* these are little tdb utility functions that are meant to make + dealing with a tdb database a little less cumbersome in Samba */ + +static SIG_ATOMIC_T gotalarm; + +/*************************************************************** + Signal function to tell us we timed out. +****************************************************************/ + +static void gotalarm_sig(void) +{ + gotalarm = 1; +} + +/*************************************************************** + Make a TDB_DATA and keep the const warning in one place +****************************************************************/ + +static TDB_DATA make_tdb_data(const char *dptr, size_t dsize) +{ + TDB_DATA ret; + ret.dptr = dptr; + ret.dsize = dsize; + return ret; +} + +/**************************************************************************** + Lock a chain with timeout (in seconds). +****************************************************************************/ + +static int tdb_chainlock_with_timeout_internal( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout, int rw_type) +{ + /* Allow tdb_chainlock to be interrupted by an alarm. */ + int ret; + gotalarm = 0; + tdb_set_lock_alarm(&gotalarm); + + if (timeout) { + CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig); + alarm(timeout); + } + + if (rw_type == F_RDLCK) + ret = tdb_chainlock_read(tdb, key); + else + ret = tdb_chainlock(tdb, key); + + if (timeout) { + alarm(0); + CatchSignal(SIGALRM, SIGNAL_CAST SIG_IGN); + if (gotalarm) { + DEBUG(0,("tdb_chainlock_with_timeout_internal: alarm (%u) timed out for key %s in tdb %s\n", + timeout, key.dptr, tdb->name )); + /* TODO: If we time out waiting for a lock, it might + * be nice to use F_GETLK to get the pid of the + * process currently holding the lock and print that + * as part of the debugging message. -- mbp */ + return -1; + } + } + + return ret; +} + +/**************************************************************************** + Write lock a chain. Return -1 if timeout or lock failed. +****************************************************************************/ + +int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout) +{ + return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_WRLCK); +} + +/**************************************************************************** + Lock a chain by string. Return -1 if timeout or lock failed. +****************************************************************************/ + +int tdb_lock_bystring(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) +{ + TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); + + return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_WRLCK); +} + +/**************************************************************************** + Unlock a chain by string. +****************************************************************************/ + +void tdb_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval) +{ + TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); + + tdb_chainunlock(tdb, key); +} + +/**************************************************************************** + Read lock a chain by string. Return -1 if timeout or lock failed. +****************************************************************************/ + +int tdb_read_lock_bystring(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) +{ + TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); + + return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_RDLCK); +} + +/**************************************************************************** + Read unlock a chain by string. +****************************************************************************/ + +void tdb_read_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval) +{ + TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); + + tdb_chainunlock_read(tdb, key); +} + + +/**************************************************************************** + Fetch a int32 value by a arbitrary blob key, return -1 if not found. + Output is int32 in native byte order. +****************************************************************************/ + +int32 tdb_fetch_int32_byblob(TDB_CONTEXT *tdb, const char *keyval, size_t len) +{ + TDB_DATA key = make_tdb_data(keyval, len); + TDB_DATA data; + int32 ret; + + data = tdb_fetch(tdb, key); + if (!data.dptr || data.dsize != sizeof(int32)) { + SAFE_FREE(data.dptr); + return -1; + } + + ret = IVAL(data.dptr,0); + SAFE_FREE(data.dptr); + return ret; +} + +/**************************************************************************** + Fetch a int32 value by string key, return -1 if not found. + Output is int32 in native byte order. +****************************************************************************/ + +int32 tdb_fetch_int32(TDB_CONTEXT *tdb, const char *keystr) +{ + return tdb_fetch_int32_byblob(tdb, keystr, strlen(keystr) + 1); +} + +/**************************************************************************** + Store a int32 value by an arbitary blob key, return 0 on success, -1 on failure. + Input is int32 in native byte order. Output in tdb is in little-endian. +****************************************************************************/ + +int tdb_store_int32_byblob(TDB_CONTEXT *tdb, const char *keystr, size_t len, int32 v) +{ + TDB_DATA key = make_tdb_data(keystr, len); + TDB_DATA data; + int32 v_store; + + SIVAL(&v_store,0,v); + data.dptr = (void *)&v_store; + data.dsize = sizeof(int32); + + return tdb_store(tdb, key, data, TDB_REPLACE); +} + +/**************************************************************************** + Store a int32 value by string key, return 0 on success, -1 on failure. + Input is int32 in native byte order. Output in tdb is in little-endian. +****************************************************************************/ + +int tdb_store_int32(TDB_CONTEXT *tdb, const char *keystr, int32 v) +{ + return tdb_store_int32_byblob(tdb, keystr, strlen(keystr) + 1, v); +} + +/**************************************************************************** + Fetch a uint32 value by a arbitrary blob key, return -1 if not found. + Output is uint32 in native byte order. +****************************************************************************/ + +BOOL tdb_fetch_uint32_byblob(TDB_CONTEXT *tdb, const char *keyval, size_t len, uint32 *value) +{ + TDB_DATA key = make_tdb_data(keyval, len); + TDB_DATA data; + + data = tdb_fetch(tdb, key); + if (!data.dptr || data.dsize != sizeof(uint32)) { + SAFE_FREE(data.dptr); + return False; + } + + *value = IVAL(data.dptr,0); + SAFE_FREE(data.dptr); + return True; +} + +/**************************************************************************** + Fetch a uint32 value by string key, return -1 if not found. + Output is uint32 in native byte order. +****************************************************************************/ + +BOOL tdb_fetch_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 *value) +{ + return tdb_fetch_uint32_byblob(tdb, keystr, strlen(keystr) + 1, value); +} + +/**************************************************************************** + Store a uint32 value by an arbitary blob key, return 0 on success, -1 on failure. + Input is uint32 in native byte order. Output in tdb is in little-endian. +****************************************************************************/ + +BOOL tdb_store_uint32_byblob(TDB_CONTEXT *tdb, const char *keystr, size_t len, uint32 value) +{ + TDB_DATA key = make_tdb_data(keystr, len); + TDB_DATA data; + uint32 v_store; + BOOL ret = True; + + SIVAL(&v_store, 0, value); + data.dptr = (void *)&v_store; + data.dsize = sizeof(uint32); + + if (tdb_store(tdb, key, data, TDB_REPLACE) == -1) + ret = False; + + return ret; +} + +/**************************************************************************** + Store a uint32 value by string key, return 0 on success, -1 on failure. + Input is uint32 in native byte order. Output in tdb is in little-endian. +****************************************************************************/ + +BOOL tdb_store_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 value) +{ + return tdb_store_uint32_byblob(tdb, keystr, strlen(keystr) + 1, value); +} +/**************************************************************************** + Store a buffer by a null terminated string key. Return 0 on success, -1 + on failure. +****************************************************************************/ + +int tdb_store_bystring(TDB_CONTEXT *tdb, const char *keystr, TDB_DATA data, int flags) +{ + TDB_DATA key = make_tdb_data(keystr, strlen(keystr)+1); + + return tdb_store(tdb, key, data, flags); +} + +/**************************************************************************** + Fetch a buffer using a null terminated string key. Don't forget to call + free() on the result dptr. +****************************************************************************/ + +TDB_DATA tdb_fetch_bystring(TDB_CONTEXT *tdb, const char *keystr) +{ + TDB_DATA key = make_tdb_data(keystr, strlen(keystr)+1); + + return tdb_fetch(tdb, key); +} + +/**************************************************************************** + Delete an entry using a null terminated string key. +****************************************************************************/ + +int tdb_delete_bystring(TDB_CONTEXT *tdb, const char *keystr) +{ + TDB_DATA key = make_tdb_data(keystr, strlen(keystr)+1); + + return tdb_delete(tdb, key); +} + +/**************************************************************************** + Atomic integer change. Returns old value. To create, set initial value in *oldval. +****************************************************************************/ + +int32 tdb_change_int32_atomic(TDB_CONTEXT *tdb, const char *keystr, int32 *oldval, int32 change_val) +{ + int32 val; + int32 ret = -1; + + if (tdb_lock_bystring(tdb, keystr,0) == -1) + return -1; + + if ((val = tdb_fetch_int32(tdb, keystr)) == -1) { + /* The lookup failed */ + if (tdb_error(tdb) != TDB_ERR_NOEXIST) { + /* but not because it didn't exist */ + goto err_out; + } + + /* Start with 'old' value */ + val = *oldval; + + } else { + /* It worked, set return value (oldval) to tdb data */ + *oldval = val; + } + + /* Increment value for storage and return next time */ + val += change_val; + + if (tdb_store_int32(tdb, keystr, val) == -1) + goto err_out; + + ret = 0; + + err_out: + + tdb_unlock_bystring(tdb, keystr); + return ret; +} + +/**************************************************************************** + Atomic unsigned integer change. Returns old value. To create, set initial value in *oldval. +****************************************************************************/ + +BOOL tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldval, uint32 change_val) +{ + uint32 val; + BOOL ret = False; + + if (tdb_lock_bystring(tdb, keystr,0) == -1) + return False; + + if (!tdb_fetch_uint32(tdb, keystr, &val)) { + /* It failed */ + if (tdb_error(tdb) != TDB_ERR_NOEXIST) { + /* and not because it didn't exist */ + goto err_out; + } + + /* Start with 'old' value */ + val = *oldval; + + } else { + /* it worked, set return value (oldval) to tdb data */ + *oldval = val; + + } + + /* get a new value to store */ + val += change_val; + + if (!tdb_store_uint32(tdb, keystr, val)) + goto err_out; + + ret = True; + + err_out: + + tdb_unlock_bystring(tdb, keystr); + return ret; +} + +/**************************************************************************** + Useful pair of routines for packing/unpacking data consisting of + integers and strings. +****************************************************************************/ + +size_t tdb_pack(char *buf, int bufsize, const char *fmt, ...) +{ + va_list ap; + uint8 bt; + uint16 w; + uint32 d; + int i; + void *p; + int len; + char *s; + char c; + char *buf0 = buf; + const char *fmt0 = fmt; + int bufsize0 = bufsize; + + va_start(ap, fmt); + + while (*fmt) { + switch ((c = *fmt++)) { + case 'b': /* unsigned 8-bit integer */ + len = 1; + bt = (uint8)va_arg(ap, int); + if (bufsize && bufsize >= len) + SSVAL(buf, 0, bt); + break; + case 'w': /* unsigned 16-bit integer */ + len = 2; + w = (uint16)va_arg(ap, int); + if (bufsize && bufsize >= len) + SSVAL(buf, 0, w); + break; + case 'd': /* signed 32-bit integer (standard int in most systems) */ + len = 4; + d = va_arg(ap, uint32); + if (bufsize && bufsize >= len) + SIVAL(buf, 0, d); + break; + case 'p': /* pointer */ + len = 4; + p = va_arg(ap, void *); + d = p?1:0; + if (bufsize && bufsize >= len) + SIVAL(buf, 0, d); + break; + case 'P': /* null-terminated string */ + s = va_arg(ap,char *); + w = strlen(s); + len = w + 1; + if (bufsize && bufsize >= len) + memcpy(buf, s, len); + break; + case 'f': /* null-terminated string */ + s = va_arg(ap,char *); + w = strlen(s); + len = w + 1; + if (bufsize && bufsize >= len) + memcpy(buf, s, len); + break; + case 'B': /* fixed-length string */ + i = va_arg(ap, int); + s = va_arg(ap, char *); + len = 4+i; + if (bufsize && bufsize >= len) { + SIVAL(buf, 0, i); + memcpy(buf+4, s, i); + } + break; + default: + DEBUG(0,("Unknown tdb_pack format %c in %s\n", + c, fmt)); + len = 0; + break; + } + + buf += len; + if (bufsize) + bufsize -= len; + if (bufsize < 0) + bufsize = 0; + } + + va_end(ap); + + DEBUG(18,("tdb_pack(%s, %d) -> %d\n", + fmt0, bufsize0, (int)PTR_DIFF(buf, buf0))); + + return PTR_DIFF(buf, buf0); +} + +/**************************************************************************** + Useful pair of routines for packing/unpacking data consisting of + integers and strings. +****************************************************************************/ + +int tdb_unpack(char *buf, int bufsize, const char *fmt, ...) +{ + va_list ap; + uint8 *bt; + uint16 *w; + uint32 *d; + int len; + int *i; + void **p; + char *s, **b; + char c; + char *buf0 = buf; + const char *fmt0 = fmt; + int bufsize0 = bufsize; + + va_start(ap, fmt); + + while (*fmt) { + switch ((c=*fmt++)) { + case 'b': + len = 1; + bt = va_arg(ap, uint8 *); + if (bufsize < len) + goto no_space; + *bt = SVAL(buf, 0); + break; + case 'w': + len = 2; + w = va_arg(ap, uint16 *); + if (bufsize < len) + goto no_space; + *w = SVAL(buf, 0); + break; + case 'd': + len = 4; + d = va_arg(ap, uint32 *); + if (bufsize < len) + goto no_space; + *d = IVAL(buf, 0); + break; + case 'p': + len = 4; + p = va_arg(ap, void **); + if (bufsize < len) + goto no_space; + *p = (void *)IVAL(buf, 0); + break; + case 'P': + s = va_arg(ap,char *); + len = strlen(buf) + 1; + if (bufsize < len || len > sizeof(pstring)) + goto no_space; + memcpy(s, buf, len); + break; + case 'f': + s = va_arg(ap,char *); + len = strlen(buf) + 1; + if (bufsize < len || len > sizeof(fstring)) + goto no_space; + memcpy(s, buf, len); + break; + case 'B': + i = va_arg(ap, int *); + b = va_arg(ap, char **); + len = 4; + if (bufsize < len) + goto no_space; + *i = IVAL(buf, 0); + if (! *i) { + *b = NULL; + break; + } + len += *i; + if (bufsize < len) + goto no_space; + *b = (char *)malloc(*i); + if (! *b) + goto no_space; + memcpy(*b, buf+4, *i); + break; + default: + DEBUG(0,("Unknown tdb_unpack format %c in %s\n", + c, fmt)); + + len = 0; + break; + } + + buf += len; + bufsize -= len; + } + + va_end(ap); + + DEBUG(18,("tdb_unpack(%s, %d) -> %d\n", + fmt0, bufsize0, (int)PTR_DIFF(buf, buf0))); + + return PTR_DIFF(buf, buf0); + + no_space: + return -1; +} + + +/** + * Pack SID passed by pointer + * + * @param pack_buf pointer to buffer which is to be filled with packed data + * @param bufsize size of packing buffer + * @param sid pointer to sid to be packed + * + * @return length of the packed representation of the whole structure + **/ +size_t tdb_sid_pack(char* pack_buf, int bufsize, DOM_SID* sid) +{ + int idx; + size_t len = 0; + + if (!sid || !pack_buf) return -1; + + len += tdb_pack(pack_buf + len, bufsize - len, "bb", sid->sid_rev_num, + sid->num_auths); + + for (idx = 0; idx < 6; idx++) { + len += tdb_pack(pack_buf + len, bufsize - len, "b", sid->id_auth[idx]); + } + + for (idx = 0; idx < MAXSUBAUTHS; idx++) { + len += tdb_pack(pack_buf + len, bufsize - len, "d", sid->sub_auths[idx]); + } + + return len; +} + + +/** + * Unpack SID into a pointer + * + * @param pack_buf pointer to buffer with packed representation + * @param bufsize size of the buffer + * @param sid pointer to sid structure to be filled with unpacked data + * + * @return size of structure unpacked from buffer + **/ +size_t tdb_sid_unpack(char* pack_buf, int bufsize, DOM_SID* sid) +{ + int idx, len = 0; + + if (!sid || !pack_buf) return -1; + + len += tdb_unpack(pack_buf + len, bufsize - len, "bb", + &sid->sid_rev_num, &sid->num_auths); + + for (idx = 0; idx < 6; idx++) { + len += tdb_unpack(pack_buf + len, bufsize - len, "b", &sid->id_auth[idx]); + } + + for (idx = 0; idx < MAXSUBAUTHS; idx++) { + len += tdb_unpack(pack_buf + len, bufsize - len, "d", &sid->sub_auths[idx]); + } + + return len; +} + + +/** + * Pack TRUSTED_DOM_PASS passed by pointer + * + * @param pack_buf pointer to buffer which is to be filled with packed data + * @param bufsize size of the buffer + * @param pass pointer to trusted domain password to be packed + * + * @return length of the packed representation of the whole structure + **/ +size_t tdb_trusted_dom_pass_pack(char* pack_buf, int bufsize, TRUSTED_DOM_PASS* pass) +{ + int idx, len = 0; + + if (!pack_buf || !pass) return -1; + + /* packing unicode domain name and password */ + len += tdb_pack(pack_buf + len, bufsize - len, "d", pass->uni_name_len); + + for (idx = 0; idx < 32; idx++) + len += tdb_pack(pack_buf + len, bufsize - len, "w", pass->uni_name[idx]); + + len += tdb_pack(pack_buf + len, bufsize - len, "dPd", pass->pass_len, + pass->pass, pass->mod_time); + + /* packing SID structure */ + len += tdb_sid_pack(pack_buf + len, bufsize - len, &pass->domain_sid); + + return len; +} + + +/** + * Unpack TRUSTED_DOM_PASS passed by pointer + * + * @param pack_buf pointer to buffer with packed representation + * @param bufsize size of the buffer + * @param pass pointer to trusted domain password to be filled with unpacked data + * + * @return size of structure unpacked from buffer + **/ +size_t tdb_trusted_dom_pass_unpack(char* pack_buf, int bufsize, TRUSTED_DOM_PASS* pass) +{ + int idx, len = 0; + + if (!pack_buf || !pass) return -1; + + /* unpack unicode domain name and plaintext password */ + len += tdb_unpack(pack_buf, bufsize - len, "d", &pass->uni_name_len); + + for (idx = 0; idx < 32; idx++) + len += tdb_unpack(pack_buf + len, bufsize - len, "w", &pass->uni_name[idx]); + + len += tdb_unpack(pack_buf + len, bufsize - len, "dPd", &pass->pass_len, &pass->pass, + &pass->mod_time); + + /* unpack domain sid */ + len += tdb_sid_unpack(pack_buf + len, bufsize - len, &pass->domain_sid); + + return len; +} + + +/**************************************************************************** + Log tdb messages via DEBUG(). +****************************************************************************/ + +static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...) +{ + va_list ap; + char *ptr = NULL; + + va_start(ap, format); + vasprintf(&ptr, format, ap); + va_end(ap); + + if (!ptr || !*ptr) + return; + + DEBUG(level, ("tdb(%s): %s", tdb->name ? tdb->name : "unnamed", ptr)); + SAFE_FREE(ptr); +} + +/**************************************************************************** + Like tdb_open() but also setup a logging function that redirects to + the samba DEBUG() system. +****************************************************************************/ + +TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags, + int open_flags, mode_t mode) +{ + TDB_CONTEXT *tdb; + + if (!lp_use_mmap()) + tdb_flags |= TDB_NOMMAP; + + tdb = tdb_open_ex(name, hash_size, tdb_flags, + open_flags, mode, tdb_log); + if (!tdb) + return NULL; + + return tdb; +} + + +/**************************************************************************** + Allow tdb_delete to be used as a tdb_traversal_fn. +****************************************************************************/ + +int tdb_traverse_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, + void *state) +{ + return tdb_delete(the_tdb, key); +} + + + +/** + * Search across the whole tdb for keys that match the given pattern + * return the result as a list of keys + * + * @param tdb pointer to opened tdb file context + * @param pattern searching pattern used by fnmatch(3) functions + * + * @return list of keys found by looking up with given pattern + **/ +TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT *tdb, const char* pattern) +{ + TDB_DATA key, next; + TDB_LIST_NODE *list = NULL; + TDB_LIST_NODE *rec = NULL; + TDB_LIST_NODE *tmp = NULL; + + for (key = tdb_firstkey(tdb); key.dptr; key = next) { + /* duplicate key string to ensure null-termination */ + char *key_str = (char*) strndup(key.dptr, key.dsize); + if (!key_str) { + DEBUG(0, ("tdb_search_keys: strndup() failed!\n")); + smb_panic("strndup failed!\n"); + } + + DEBUG(18, ("checking %s for match to pattern %s\n", key_str, pattern)); + + next = tdb_nextkey(tdb, key); + + /* do the pattern checking */ + if (fnmatch(pattern, key_str, 0) == 0) { + rec = (TDB_LIST_NODE*) malloc(sizeof(*rec)); + ZERO_STRUCTP(rec); + + rec->node_key = key; + + DLIST_ADD_END(list, rec, tmp); + + DEBUG(18, ("checking %s matched pattern %s\n", key_str, pattern)); + } else { + free(key.dptr); + } + + /* free duplicated key string */ + free(key_str); + } + + return list; + +}; + + +/** + * Free the list returned by tdb_search_keys + * + * @param node list of results found by tdb_search_keys + **/ +void tdb_search_list_free(TDB_LIST_NODE* node) +{ + TDB_LIST_NODE *next_node; + + while (node) { + next_node = node->next; + SAFE_FREE(node->node_key.dptr); + SAFE_FREE(node); + node = next_node; + }; +}; + + diff --git a/tdb/tdbutil.h b/tdb/tdbutil.h new file mode 100644 index 0000000000..01473446a1 --- /dev/null +++ b/tdb/tdbutil.h @@ -0,0 +1,37 @@ +/* + Unix SMB/CIFS implementation. + tdb utility functions + Copyright (C) Andrew Tridgell 1999 + + 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; either version 2 of the License, or + (at your option) any later version. + + 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 02139, USA. +*/ + +#ifndef __TDBUTIL_H__ +#define __TDBUTIL_H__ + + +/* single node of a list returned by tdb_search_keys */ +typedef struct keys_node +{ + struct keys_node *prev, *next; + TDB_DATA node_key; +} TDB_LIST_NODE; + + +TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT*, const char*); +void tdb_search_list_free(TDB_LIST_NODE*); + + +#endif /* __TDBUTIL_H__ */ -- cgit v1.2.3-54-g00ecf From 8e41d35d7675b7d47db3e27da4e1fd508d772c32 Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Tue, 5 Aug 2003 23:57:23 -0700 Subject: [PATCH] udevdb prototype Here's an "idea" of what I had in mind for udevdb. Let me preface the code with a few remarks: 1) I was expecting to write this udevdb for udev to keep track of devices. I was planning an external package that depends upon udev to provide an external API to the udevdb database. The calls for the interface would be read only access. Not sure how you want to do packaging, if having a separate package is ok or having it included in udev. 2) I created it as it is because udev isn't a daemon. So, the open database call doesn't take any parameters. My plan was to create a udevdb_init function that took arguments for initializing the db to start, where you could specify in memory only or a file location. This can all be filled in. 3) I hacked the Makefile to get it to work. Not sure how you'd want that in the future. 4) This assumes TDB has been installed elsewhere, you would need to edit your Makefile and point it to the header and library locations. How do you want to do TDB in udev? Do you want to just reference it and make udev dependent on that package being installed. Or should we do what samba does and include a limited tdb version in udev? 5) Again, I hacked udev into your existing code. In the future, I'd probably make a function around the filling out the udevice before calling the store command. Didn't know if you wanted to change your add device function to use struct udevice rather than having everything separate. 6) Not sure what we should include in the udevice structure that's stored by udev. I made a stab at a first shot - we can add and remove of course, this was a first pass. I've come to realize - with you including libsysfs in udev, the "external" interface that references udevdb could make use of getting information from through libsysfs from sysfs and doesn't need to be in udevdb. 7) I could write a namedevdb for namedev's device management if you wanted. --- namedev.h | 1 + udev-add.c | 23 +++ udev-remove.c | 4 +- udevdb.c | 591 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udevdb.h | 41 ++++ 5 files changed, 659 insertions(+), 1 deletion(-) create mode 100644 udevdb.c create mode 100644 udevdb.h diff --git a/namedev.h b/namedev.h index 9d612dfe0c..d986a2376d 100644 --- a/namedev.h +++ b/namedev.h @@ -23,6 +23,7 @@ #ifndef NAMEDEV_H #define NAMEDEV_H +#include "udev.h" #include "list.h" struct sysfs_class_device; diff --git a/udev-add.c b/udev-add.c index 586815e2c7..5bd934acd0 100644 --- a/udev-add.c +++ b/udev-add.c @@ -31,6 +31,7 @@ #include "udev.h" #include "udev_version.h" #include "namedev.h" +#include "udevdb.h" #include "libsysfs/libsysfs.h" @@ -164,9 +165,31 @@ int udev_add_device(char *device, char *subsystem) dbg ("get_major_minor failed"); goto exit; } + memset(&dbdev, 0, sizeof(dbdev)); + strncpy(dbdev.name, attr.name, NAME_SIZE); + strncpy(dbdev.sysfs_path, class_dev->sysdevice->directory->path, + PATH_SIZE); + strncpy(dbdev.class_dev_name, class_dev->name, NAME_SIZE); + if ((sysfs_get_name_from_path(subsystem, dbdev.class_name, NAME_SIZE)) + != 0) + strcpy(dbdev.class_name, "unkown"); + strncpy(dbdev.bus_id, class_dev->sysdevice->bus_id, ID_SIZE); + strcpy(dbdev.bus_name, "unknown"); + if (class_dev->driver != NULL) + strncpy(dbdev.driver, class_dev->driver->name, NAME_SIZE); + else + strcpy(dbdev.driver, "unkown"); + dbdev.type = type; + dbdev.major = major; + dbdev.minor = minor; + dbdev.mode = attr.mode; sysfs_close_class_device(class_dev); + retval = udevdb_add_udevice(&dbdev); + if (retval != 0) + goto exit; + return create_node(attr.name, type, major, minor, attr.mode); exit: diff --git a/udev-remove.c b/udev-remove.c index cd917af193..29063efb0d 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -31,6 +31,7 @@ #include "udev.h" #include "udev_version.h" #include "namedev.h" +#include "udevdb.h" #include "libsysfs/libsysfs.h" @@ -80,9 +81,10 @@ int udev_remove_device(char *device, char *subsystem) goto exit; } + udevdb_delete_udevice(name); + return delete_node(name); exit: return retval; } - diff --git a/udevdb.c b/udevdb.c new file mode 100644 index 0000000000..b200f2f6ed --- /dev/null +++ b/udevdb.c @@ -0,0 +1,591 @@ +/* + * udev database library + */ +#include +#include +#include +#include +#include +#include + +#include "udevdb.h" +#include "tdb.h" + +static TDB_CONTEXT *busdb; +static TDB_CONTEXT *classdb; +static TDB_CONTEXT *namedb; + +/** + * busdb_record - bus and id are keys to look up name of device + */ +struct busdb_record { + char name[NAME_SIZE]; +}; + +/** + * classdb_record - class name and class device name used as keys to find + * device name. + */ +struct classdb_record { + char name[NAME_SIZE]; +}; + +/** + * namedb_record - device name is key, remaining udevice info stored here. + */ +struct namedb_record { + char sysfs_path[PATH_SIZE]; + char class_dev_name[NAME_SIZE]; + char class_name[NAME_SIZE]; + char bus[BUS_SIZE]; + char id[ID_SIZE]; + char driver[NAME_SIZE]; + char type; + int major; + int minor; + int mode; +}; + +/** + * busdb_close: close busdb database + */ +static void busdb_close(void) +{ + if (busdb != NULL) { + tdb_close(busdb); + busdb = NULL; + } +} + +/** + * classdb_close: close classdb database + */ +static void classdb_close(void) +{ + if (classdb != NULL) { + tdb_close(classdb); + classdb = NULL; + } +} + +/** + * namedb_close: close name database + */ +static void namedb_close(void) +{ + if (namedb != NULL) { + tdb_close(namedb); + namedb = NULL; + } +} + +/** + * busdb_open: open busdb's database + */ +static int busdb_open(void) +{ + busdb = tdb_open(BUS_DB, 0, 0, O_RDWR | O_CREAT, 0644); + if (busdb == NULL) + return -1; + return 0; +} + +/** + * classdb_open: open classdb's database + */ +static int classdb_open(void) +{ + classdb = tdb_open(CLASS_DB, 0, 0, O_RDWR | O_CREAT, 0644); + if (classdb == NULL) + return -1; + return 0; +} + +/** + * namedb_open: open name database + */ +static int namedb_open(void) +{ + namedb = tdb_open(NAME_DB, 0, 0, O_RDWR | O_CREAT, 0644); + if (namedb == NULL) + return -1; + return 0; +} + +/** + * busdb_fetch + */ +static struct busdb_record *busdb_fetch(const char *bus, const char *id) +{ + TDB_DATA key, data; + char keystr[BUS_SIZE+ID_SIZE+2]; + struct busdb_record *rec = NULL; + + if (bus == NULL || id == NULL) + return NULL; + if (strlen(bus) >= BUS_SIZE || strlen(id) >= ID_SIZE) + return NULL; + + if ((busdb_open()) != 0) + return NULL; + + memset(keystr, 0, (BUS_SIZE+ID_SIZE+2)); + strcpy(keystr, bus); + strcat(keystr, UDEVDB_DEL); + strcat(keystr, id); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + data = tdb_fetch(busdb, key); + busdb_close(); + if (data.dptr == NULL || data.dsize == 0) + return NULL; + + rec = (struct busdb_record *)malloc(sizeof(struct busdb_record)); + if (rec == NULL) { + free(data.dptr); + return NULL; + } + + memcpy(rec, data.dptr, sizeof(struct busdb_record)); + free(data.dptr); + + return rec; +} + +/** + * classdb_fetch + */ +static struct classdb_record *classdb_fetch(const char *cls, + const char *cls_dev) +{ + TDB_DATA key, data; + char keystr[NAME_SIZE+NAME_SIZE+2]; + struct classdb_record *rec = NULL; + + if (cls == NULL || cls_dev == NULL) + return NULL; + if (strlen(cls) >= NAME_SIZE || strlen(cls_dev) >= NAME_SIZE) + return NULL; + + if ((classdb_open()) != 0) + return NULL; + + memset(keystr, 0, (NAME_SIZE+NAME_SIZE+2)); + strcpy(keystr, cls); + strcat(keystr, UDEVDB_DEL); + strcat(keystr, cls_dev); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + data = tdb_fetch(classdb, key); + classdb_close(); + if (data.dptr == NULL || data.dsize == 0) + return NULL; + + rec = (struct classdb_record *)malloc(sizeof(struct classdb_record)); + if (rec == NULL) { + free(data.dptr); + return NULL; + } + + memcpy(rec, data.dptr, sizeof(struct classdb_record)); + free(data.dptr); + + return rec; +} + +/** + * namedb_fetch + */ +static struct namedb_record *namedb_fetch(const char *name) +{ + TDB_DATA key, data; + char nm_keystr[NAME_SIZE]; + struct namedb_record *nrec = NULL; + + if (name == NULL) + return NULL; + if (strlen(name) >= NAME_SIZE) + return NULL; + + if ((namedb_open()) != 0) + return NULL; + + memset(nm_keystr, 0, NAME_SIZE); + strcpy(nm_keystr, name); + + key.dptr = (void *)nm_keystr; + key.dsize = strlen(nm_keystr) + 1; + + data = tdb_fetch(namedb, key); + namedb_close(); + + if (data.dptr == NULL || data.dsize == 0) + return NULL; + + nrec = (struct namedb_record *)malloc(sizeof(struct namedb_record)); + if (nrec == NULL) { + free(data.dptr); + return NULL; + } + + memcpy(nrec, data.dptr, sizeof(struct namedb_record)); + free(data.dptr); + + return nrec; +} + +/** + * busdb_store + */ +static int busdb_store(const struct udevice *dev) +{ + TDB_DATA key, data; + char keystr[BUS_SIZE+ID_SIZE+2]; + struct busdb_record rec; + int retval = 0; + + if (dev == NULL) + return -1; + + if ((retval = busdb_open()) != 0) + return -1; + + memset(keystr, 0, (BUS_SIZE+ID_SIZE+2)); + strcpy(keystr, dev->bus_name); + strcat(keystr, UDEVDB_DEL); + strcat(keystr, dev->bus_id); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + strcpy(rec.name, dev->name); + + data.dptr = (void *) &rec; + data.dsize = sizeof(rec); + + retval = tdb_store(busdb, key, data, TDB_REPLACE); + + busdb_close(); + return retval; +} + +/** + * classdb_store + */ +static int classdb_store(const struct udevice *dev) +{ + TDB_DATA key, data; + char keystr[NAME_SIZE+NAME_SIZE+2]; + struct classdb_record rec; + int retval = 0; + + if (dev == NULL) + return -1; + + if ((retval = classdb_open()) != 0) + return -1; + + memset(keystr, 0, (NAME_SIZE+NAME_SIZE+2)); + strcpy(keystr, dev->class_name); + strcat(keystr, UDEVDB_DEL); + strcat(keystr, dev->class_dev_name); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + strcpy(rec.name, dev->name); + + data.dptr = (void *) &rec; + data.dsize = sizeof(rec); + + retval = tdb_store(classdb, key, data, TDB_REPLACE); + + classdb_close(); + return retval; +} + +/** + * namedb_store + */ +static int namedb_store(const struct udevice *dev) +{ + TDB_DATA key, data; + char keystr[NAME_SIZE]; + struct namedb_record rec; + int retval = 0; + + if (dev == NULL) + return -1; + + if ((retval = namedb_open()) != 0) + return -1; + + memset(keystr, 0, NAME_SIZE); + strcpy(keystr, dev->name); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + strcpy(rec.sysfs_path, dev->sysfs_path); + strcpy(rec.bus, dev->bus_name); + strcpy(rec.id, dev->bus_id); + strcpy(rec.class_dev_name, dev->class_dev_name); + strcpy(rec.class_name, dev->class_name); + strcpy(rec.driver, dev->driver); + rec.type = dev->type; + rec.major = dev->major; + rec.minor = dev->minor; + rec.mode = dev->mode; + + data.dptr = (void *) &rec; + data.dsize = sizeof(rec); + + retval = tdb_store(namedb, key, data, TDB_REPLACE); + + namedb_close(); + return retval; +} + +/** + * busdb_delete + */ +static int busdb_delete(const char *bus, const char *id) +{ + TDB_DATA key; + char keystr[BUS_SIZE+ID_SIZE+2]; + int retval = 0; + + if (bus == NULL || id == NULL) + return -1; + if (strlen(bus) >= BUS_SIZE || strlen(id) >= ID_SIZE) + return -1; + + if ((busdb_open()) != 0) + return -1; + + memset(keystr, 0, (BUS_SIZE+ID_SIZE+2)); + strcpy(keystr, bus); + strcat(keystr, UDEVDB_DEL); + strcat(keystr, id); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + retval = tdb_delete(busdb, key); + busdb_close(); + + return retval; +} + +/** + * classdb_delete + */ +static int classdb_delete(const char *cls, const char *cls_dev) +{ + TDB_DATA key; + char keystr[NAME_SIZE+NAME_SIZE+2]; + int retval = 0; + + if (cls == NULL || cls_dev == NULL) + return -1; + if (strlen(cls) >= NAME_SIZE || strlen(cls_dev) >= NAME_SIZE) + return -1; + + if ((classdb_open()) != 0) + return -1; + + memset(keystr, 0, (NAME_SIZE+NAME_SIZE+2)); + strcpy(keystr, cls); + strcat(keystr, UDEVDB_DEL); + strcat(keystr, cls_dev); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + retval = tdb_delete(classdb, key); + classdb_close(); + + return retval; +} + +/** + * namedb_delete + */ +static int namedb_delete(const char *name) +{ + TDB_DATA key; + char keystr[NAME_SIZE]; + int retval = 0; + + if (name == NULL) + return -1; + if (strlen(name) >= NAME_SIZE) + return -1; + + if ((namedb_open()) != 0) + return -1; + + memset(keystr, 0, NAME_SIZE); + strcpy(keystr, name); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + retval = tdb_delete(namedb, key); + namedb_close(); + + return retval; +} + +/** + * namedb_exists + */ +static int namedb_exists(const char *name) +{ + TDB_DATA key; + char keystr[NAME_SIZE]; + int retval = 0; + + if (name == NULL) + return retval; + if (strlen(name) >= NAME_SIZE) + return retval; + + if ((namedb_open()) != 0) + return retval; + + memset(keystr, 0, NAME_SIZE); + strcpy(keystr, name); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + retval = tdb_exists(namedb, key); + namedb_close(); + + return retval; +} + +/** + * udevdb_delete_udevice + */ +int udevdb_delete_udevice(const char *name) +{ + struct namedb_record *nrec = NULL; + + if (name == NULL) + return -1; + + nrec = namedb_fetch(name); + if (nrec == NULL) + return -1; + + busdb_delete(nrec->bus, nrec->id); + classdb_delete(nrec->class_name, nrec->class_dev_name); + namedb_delete(name); + free(nrec); + + return 0; +} + +/** + * udevdb_add_udevice: adds udevice to database + */ +int udevdb_add_udevice(const struct udevice *dev) +{ + if (dev == NULL) + return -1; + + if ((busdb_store(dev)) != 0) + return -1; + if ((classdb_store(dev)) != 0) + return -1; + if ((namedb_store(dev)) != 0) + return -1; + + return 0; +} + +/** + * udevdb_get_device: grab's device by name + */ +struct udevice *udevdb_get_udevice(const char *name) +{ + struct namedb_record *nrec = NULL; + struct udevice *dev = NULL; + + if (name == NULL) + return NULL; + + nrec = namedb_fetch(name); + if (nrec == NULL) + return NULL; + + dev = (struct udevice *)malloc(sizeof(struct udevice)); + if (dev == NULL) { + free(nrec); + return NULL; + } + + strcpy(dev->name, name); + strcpy(dev->sysfs_path, nrec->sysfs_path); + strcpy(dev->class_dev_name, nrec->class_dev_name); + strcpy(dev->class_name, nrec->class_name); + strcpy(dev->bus_name, nrec->bus); + strcpy(dev->bus_id, nrec->id); + dev->type = nrec->type; + dev->major = nrec->major; + dev->minor = nrec->minor; + dev->mode = nrec->mode; + + free(nrec); + + return dev; +} + +/** + * udevdb_get_device_by_bus + */ +struct udevice *udevdb_get_udevice_by_bus(const char *bus, const char *id) +{ + struct busdb_record *brec = NULL; + struct udevice *dev = NULL; + + if (bus == NULL || id == NULL) + return NULL; + + brec = busdb_fetch(bus, id); + if (brec == NULL) + return NULL; + + dev = udevdb_get_udevice(brec->name); + free(brec); + + return dev; +} + +/** + * udevdb_get_udevice_by_class + */ +struct udevice *udevdb_get_udevice_by_class(const char *cls, + const char *cls_dev) +{ + struct classdb_record *crec = NULL; + struct udevice *dev = NULL; + + if (cls == NULL || cls_dev == NULL) + return NULL; + + crec = classdb_fetch(cls, cls_dev); + if (crec == NULL) + return NULL; + + dev = udevdb_get_udevice(crec->name); + free(crec); + + return dev; +} diff --git a/udevdb.h b/udevdb.h new file mode 100644 index 0000000000..d2c4a5320e --- /dev/null +++ b/udevdb.h @@ -0,0 +1,41 @@ +/* + * udevdb header file + */ +#ifndef _UDEVDB_H_ +#define _UDEVDB_H_ + +#include "namedev.h" +#include "udev.h" + +#define BUS_DB "/home/stekloff/src/udev-0.2/busdb.tdb" +#define CLASS_DB "/home/stekloff/src/udev-0.2/classdb.tdb" +#define NAME_DB "/home/stekloff/src/udev-0.2/namedb.tdb" + +#define PATH_SIZE 256 + +#define UDEVDB_DEL "#" + +struct udevice { + char name[NAME_SIZE]; + char sysfs_path[PATH_SIZE]; + char class_dev_name[NAME_SIZE]; + char class_name[NAME_SIZE]; + char bus_id[NAME_SIZE]; + char bus_name[NAME_SIZE]; + char driver[NAME_SIZE]; + char type; + int major; + int minor; + int mode; +}; + +/* Function Prototypes */ +extern int udevdb_delete_udevice(const char *name); +extern int udevdb_add_udevice(const struct udevice *dev); +extern struct udevice *udevdb_get_udevice(const char *name); +extern struct udevice *udevdb_get_udevice_by_bus(const char *bus, + const char *id); +extern struct udevice *udevdb_get_udevice_by_class(const char *cls, + const char *cls_dev); + +#endif /* _UDEVDB_H_ */ -- cgit v1.2.3-54-g00ecf From a2822451e27dbc576343834e76d5382d5112ac24 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 6 Aug 2003 00:03:30 -0700 Subject: [PATCH] merge tdb into the build process. --- Makefile | 15 +++++++++++---- udev-add.c | 1 + udevdb.c | 3 ++- udevdb.h | 6 +++--- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index a7bb01d247..3f9fef49d5 100644 --- a/Makefile +++ b/Makefile @@ -113,17 +113,23 @@ all: $(LIBC) $(ROOT) $(ARCH_LIB_OBJS) : $(MAKE) -C klibc +LIBSYSFS = libsysfs/libsysfs.a +TDB = tdb/tdb.o tdb/spinlock.o + OBJS = udev.o \ udev-add.o \ udev-remove.o \ + udevdb.o \ logging.o \ - namedev.o - -LIBSYSFS = libsysfs/libsysfs.a + namedev.o \ + $(TDB) libsysfs/libsysfs.a: $(MAKE) -C libsysfs +tdb/tdb.o: + $(MAKE) -C tdb + # header files automatically generated GEN_HEADERS = udev_version.h @@ -132,7 +138,7 @@ udev_version.h: @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ -$(ROOT): $(GEN_HEADERS) $(OBJS) $(LIBSYSFS) +$(ROOT): $(GEN_HEADERS) $(OBJS) $(LIBSYSFS) $(TDB) $(MAKE) -C libsysfs $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) -lsysfs $(LIB_OBJS) -L$(LIB) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) @@ -143,6 +149,7 @@ clean: -rm -f core $(ROOT) $(GEN_HEADERS) $(MAKE) -C klibc clean $(MAKE) -C libsysfs clean + $(MAKE) -C tdb clean DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS ) DISTDIR := $(RELEASE_NAME) diff --git a/udev-add.c b/udev-add.c index 5bd934acd0..c8aa2f70c9 100644 --- a/udev-add.c +++ b/udev-add.c @@ -136,6 +136,7 @@ int udev_add_device(char *device, char *subsystem) { struct sysfs_class_device *class_dev; struct device_attr attr; + struct udevice dbdev; int major; int minor; char type; diff --git a/udevdb.c b/udevdb.c index b200f2f6ed..b976fd50ef 100644 --- a/udevdb.c +++ b/udevdb.c @@ -7,9 +7,10 @@ #include #include #include +#include #include "udevdb.h" -#include "tdb.h" +#include "tdb/tdb.h" static TDB_CONTEXT *busdb; static TDB_CONTEXT *classdb; diff --git a/udevdb.h b/udevdb.h index d2c4a5320e..fed52bc46a 100644 --- a/udevdb.h +++ b/udevdb.h @@ -7,9 +7,9 @@ #include "namedev.h" #include "udev.h" -#define BUS_DB "/home/stekloff/src/udev-0.2/busdb.tdb" -#define CLASS_DB "/home/stekloff/src/udev-0.2/classdb.tdb" -#define NAME_DB "/home/stekloff/src/udev-0.2/namedb.tdb" +#define BUS_DB "/home/greg/src/udev/busdb.tdb" +#define CLASS_DB "/home/greg/src/udev/classdb.tdb" +#define NAME_DB "/home/greg/src/udev/namedb.tdb" #define PATH_SIZE 256 -- cgit v1.2.3-54-g00ecf From 99bec174973b08343a0daefe35bbcdc1f263f192 Mon Sep 17 00:00:00 2001 From: "lethal@linux-sh.org" Date: Mon, 11 Aug 2003 21:28:08 -0700 Subject: [PATCH] Fix TDB cross compilation The merge of tdb ended up breaking the ability to cross compile again, here's a bk patch that yanks CC out of the tdb Makefile, and in turn falls back on the exported CC value from the top-level Makefile which correctly sets it based off of the CROSS value. --- tdb/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/tdb/Makefile b/tdb/Makefile index 59fbb079bd..06e31fcc7f 100644 --- a/tdb/Makefile +++ b/tdb/Makefile @@ -3,7 +3,6 @@ # CFLAGS = -DSTANDALONE -DTDB_DEBUG -g -DHAVE_MMAP=1 -CC = gcc PROGS = tdbtest tdbtool tdbtorture TDB_OBJ = tdb.o spinlock.o -- cgit v1.2.3-54-g00ecf From e436917d9c7a157d62510fee9a4f80c1f3f77abf Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Wed, 24 Sep 2003 20:56:17 -0700 Subject: [PATCH] print udev pid makes debugging easier. --- logging.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/logging.c b/logging.c index e074b1562c..1ca3aed1a9 100644 --- a/logging.c +++ b/logging.c @@ -21,16 +21,22 @@ */ #include +#include +#include +#include #include #include "udev.h" #ifdef DEBUG static int logging_init = 0; +static unsigned char udev_logname[42]; static void init_logging (void) { - openlog ("udev", 0, LOG_DAEMON); + snprintf(udev_logname,42,"udev[%d]", getpid()); + + openlog (udev_logname, 0, LOG_DAEMON); logging_init = 1; } -- cgit v1.2.3-54-g00ecf From dca0297941cd27117c23ea868caa82710a58948c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 8 Oct 2003 06:09:57 -0700 Subject: [PATCH] do not build the tdb binary programs, only the objects. Now it's not necessary to have gdbm to build properly. --- tdb/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tdb/Makefile b/tdb/Makefile index 06e31fcc7f..021cb35c95 100644 --- a/tdb/Makefile +++ b/tdb/Makefile @@ -7,7 +7,9 @@ CFLAGS = -DSTANDALONE -DTDB_DEBUG -g -DHAVE_MMAP=1 PROGS = tdbtest tdbtool tdbtorture TDB_OBJ = tdb.o spinlock.o -default: $(PROGS) +default: $(TDB_OBJ) + +progs: $(PROGS) tdbtest: tdbtest.o $(TDB_OBJ) $(CC) $(CFLAGS) -o tdbtest tdbtest.o $(TDB_OBJ) -lgdbm -- cgit v1.2.3-54-g00ecf From 149f210617e812922831e329c347095115585783 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 14 Oct 2003 23:20:18 -0700 Subject: [PATCH] clean up some debugging stuff in namedev.c --- namedev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index d8dba345d1..782b73d0b9 100644 --- a/namedev.c +++ b/namedev.c @@ -21,6 +21,8 @@ * */ +#undef DEBUG + #include #include #include @@ -530,7 +532,7 @@ label_found: } else { *temp = 0x00; temp = strrchr(path, '/'); - dbg("TOPOLOGY temp = '%s' id = '%s'", temp, dev->id); + dbg("NUMBERY temp = '%s' id = '%s'", temp, dev->id); if (strstr(temp, dev->id) != NULL) found = 1; } -- cgit v1.2.3-54-g00ecf From dbfc520c605dee3244dbbfd563e908901324689b Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Tue, 14 Oct 2003 23:20:53 -0700 Subject: [PATCH] udevdb patch This patch: 1) removes the three database files for just one udevdb.tdb file. 2) adds udevdb_init() and udevdb_exit() functions 3) initializes database now in main() in udev.c. Please look it over. --- udev.c | 21 ++++++-- udevdb.c | 177 +++++++++++++++------------------------------------------------ udevdb.h | 10 ++-- 3 files changed, 63 insertions(+), 145 deletions(-) diff --git a/udev.c b/udev.c index 74572625af..6e7ac25175 100644 --- a/udev.c +++ b/udev.c @@ -31,6 +31,7 @@ #include "udev.h" #include "udev_version.h" #include "namedev.h" +#include "udevdb.h" #include "libsysfs/libsysfs.h" @@ -91,17 +92,27 @@ int main(int argc, char *argv[]) goto exit; } + /* initialize udev database */ + retval = udevdb_init(UDEVDB_DEFAULT); + if (retval != 0) { + dbg("Unable to initialize database."); + goto exit; + } + /* initialize the naming deamon */ namedev_init(); if (strcmp(action, "add") == 0) - return udev_add_device(device, argv[1]); + retval = udev_add_device(device, argv[1]); - if (strcmp(action, "remove") == 0) - return udev_remove_device(device, argv[1]); + else if (strcmp(action, "remove") == 0) + retval = udev_remove_device(device, argv[1]); - dbg("Unknown action: %s", action); - retval = -EINVAL; + else { + dbg("Unknown action: %s", action); + retval = -EINVAL; + } + udevdb_exit(); exit: return retval; diff --git a/udevdb.c b/udevdb.c index b976fd50ef..c2e90be32f 100644 --- a/udevdb.c +++ b/udevdb.c @@ -12,9 +12,7 @@ #include "udevdb.h" #include "tdb/tdb.h" -static TDB_CONTEXT *busdb; -static TDB_CONTEXT *classdb; -static TDB_CONTEXT *namedb; +static TDB_CONTEXT *udevdb; /** * busdb_record - bus and id are keys to look up name of device @@ -48,67 +46,25 @@ struct namedb_record { }; /** - * busdb_close: close busdb database + * udevdb_close: close udev database */ -static void busdb_close(void) +static void udevdb_close(void) { - if (busdb != NULL) { - tdb_close(busdb); - busdb = NULL; + if (udevdb != NULL) { + tdb_close(udevdb); + udevdb = NULL; } } /** - * classdb_close: close classdb database + * udevdb_open: opens udev's database + * @method: database can either be in memory - UDEVDB_INTERNAL - or + * written to a file with UDEVDB_DEFAULT. */ -static void classdb_close(void) +static int udevdb_open(int method) { - if (classdb != NULL) { - tdb_close(classdb); - classdb = NULL; - } -} - -/** - * namedb_close: close name database - */ -static void namedb_close(void) -{ - if (namedb != NULL) { - tdb_close(namedb); - namedb = NULL; - } -} - -/** - * busdb_open: open busdb's database - */ -static int busdb_open(void) -{ - busdb = tdb_open(BUS_DB, 0, 0, O_RDWR | O_CREAT, 0644); - if (busdb == NULL) - return -1; - return 0; -} - -/** - * classdb_open: open classdb's database - */ -static int classdb_open(void) -{ - classdb = tdb_open(CLASS_DB, 0, 0, O_RDWR | O_CREAT, 0644); - if (classdb == NULL) - return -1; - return 0; -} - -/** - * namedb_open: open name database - */ -static int namedb_open(void) -{ - namedb = tdb_open(NAME_DB, 0, 0, O_RDWR | O_CREAT, 0644); - if (namedb == NULL) + udevdb = tdb_open(UDEVDB, 0, method, O_RDWR | O_CREAT, 0644); + if (udevdb == NULL) return -1; return 0; } @@ -127,9 +83,6 @@ static struct busdb_record *busdb_fetch(const char *bus, const char *id) if (strlen(bus) >= BUS_SIZE || strlen(id) >= ID_SIZE) return NULL; - if ((busdb_open()) != 0) - return NULL; - memset(keystr, 0, (BUS_SIZE+ID_SIZE+2)); strcpy(keystr, bus); strcat(keystr, UDEVDB_DEL); @@ -138,8 +91,7 @@ static struct busdb_record *busdb_fetch(const char *bus, const char *id) key.dptr = (void *)keystr; key.dsize = strlen(keystr) + 1; - data = tdb_fetch(busdb, key); - busdb_close(); + data = tdb_fetch(udevdb, key); if (data.dptr == NULL || data.dsize == 0) return NULL; @@ -170,9 +122,6 @@ static struct classdb_record *classdb_fetch(const char *cls, if (strlen(cls) >= NAME_SIZE || strlen(cls_dev) >= NAME_SIZE) return NULL; - if ((classdb_open()) != 0) - return NULL; - memset(keystr, 0, (NAME_SIZE+NAME_SIZE+2)); strcpy(keystr, cls); strcat(keystr, UDEVDB_DEL); @@ -181,8 +130,7 @@ static struct classdb_record *classdb_fetch(const char *cls, key.dptr = (void *)keystr; key.dsize = strlen(keystr) + 1; - data = tdb_fetch(classdb, key); - classdb_close(); + data = tdb_fetch(udevdb, key); if (data.dptr == NULL || data.dsize == 0) return NULL; @@ -212,18 +160,13 @@ static struct namedb_record *namedb_fetch(const char *name) if (strlen(name) >= NAME_SIZE) return NULL; - if ((namedb_open()) != 0) - return NULL; - memset(nm_keystr, 0, NAME_SIZE); strcpy(nm_keystr, name); key.dptr = (void *)nm_keystr; key.dsize = strlen(nm_keystr) + 1; - data = tdb_fetch(namedb, key); - namedb_close(); - + data = tdb_fetch(udevdb, key); if (data.dptr == NULL || data.dsize == 0) return NULL; @@ -252,9 +195,6 @@ static int busdb_store(const struct udevice *dev) if (dev == NULL) return -1; - if ((retval = busdb_open()) != 0) - return -1; - memset(keystr, 0, (BUS_SIZE+ID_SIZE+2)); strcpy(keystr, dev->bus_name); strcat(keystr, UDEVDB_DEL); @@ -268,9 +208,7 @@ static int busdb_store(const struct udevice *dev) data.dptr = (void *) &rec; data.dsize = sizeof(rec); - retval = tdb_store(busdb, key, data, TDB_REPLACE); - - busdb_close(); + retval = tdb_store(udevdb, key, data, TDB_REPLACE); return retval; } @@ -287,9 +225,6 @@ static int classdb_store(const struct udevice *dev) if (dev == NULL) return -1; - if ((retval = classdb_open()) != 0) - return -1; - memset(keystr, 0, (NAME_SIZE+NAME_SIZE+2)); strcpy(keystr, dev->class_name); strcat(keystr, UDEVDB_DEL); @@ -303,9 +238,7 @@ static int classdb_store(const struct udevice *dev) data.dptr = (void *) &rec; data.dsize = sizeof(rec); - retval = tdb_store(classdb, key, data, TDB_REPLACE); - - classdb_close(); + retval = tdb_store(udevdb, key, data, TDB_REPLACE); return retval; } @@ -322,9 +255,6 @@ static int namedb_store(const struct udevice *dev) if (dev == NULL) return -1; - if ((retval = namedb_open()) != 0) - return -1; - memset(keystr, 0, NAME_SIZE); strcpy(keystr, dev->name); @@ -345,9 +275,7 @@ static int namedb_store(const struct udevice *dev) data.dptr = (void *) &rec; data.dsize = sizeof(rec); - retval = tdb_store(namedb, key, data, TDB_REPLACE); - - namedb_close(); + retval = tdb_store(udevdb, key, data, TDB_REPLACE); return retval; } @@ -365,9 +293,6 @@ static int busdb_delete(const char *bus, const char *id) if (strlen(bus) >= BUS_SIZE || strlen(id) >= ID_SIZE) return -1; - if ((busdb_open()) != 0) - return -1; - memset(keystr, 0, (BUS_SIZE+ID_SIZE+2)); strcpy(keystr, bus); strcat(keystr, UDEVDB_DEL); @@ -376,9 +301,7 @@ static int busdb_delete(const char *bus, const char *id) key.dptr = (void *)keystr; key.dsize = strlen(keystr) + 1; - retval = tdb_delete(busdb, key); - busdb_close(); - + retval = tdb_delete(udevdb, key); return retval; } @@ -396,9 +319,6 @@ static int classdb_delete(const char *cls, const char *cls_dev) if (strlen(cls) >= NAME_SIZE || strlen(cls_dev) >= NAME_SIZE) return -1; - if ((classdb_open()) != 0) - return -1; - memset(keystr, 0, (NAME_SIZE+NAME_SIZE+2)); strcpy(keystr, cls); strcat(keystr, UDEVDB_DEL); @@ -407,9 +327,7 @@ static int classdb_delete(const char *cls, const char *cls_dev) key.dptr = (void *)keystr; key.dsize = strlen(keystr) + 1; - retval = tdb_delete(classdb, key); - classdb_close(); - + retval = tdb_delete(udevdb, key); return retval; } @@ -427,47 +345,13 @@ static int namedb_delete(const char *name) if (strlen(name) >= NAME_SIZE) return -1; - if ((namedb_open()) != 0) - return -1; - - memset(keystr, 0, NAME_SIZE); - strcpy(keystr, name); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - retval = tdb_delete(namedb, key); - namedb_close(); - - return retval; -} - -/** - * namedb_exists - */ -static int namedb_exists(const char *name) -{ - TDB_DATA key; - char keystr[NAME_SIZE]; - int retval = 0; - - if (name == NULL) - return retval; - if (strlen(name) >= NAME_SIZE) - return retval; - - if ((namedb_open()) != 0) - return retval; - memset(keystr, 0, NAME_SIZE); strcpy(keystr, name); key.dptr = (void *)keystr; key.dsize = strlen(keystr) + 1; - retval = tdb_exists(namedb, key); - namedb_close(); - + retval = tdb_delete(udevdb, key); return retval; } @@ -590,3 +474,22 @@ struct udevice *udevdb_get_udevice_by_class(const char *cls, return dev; } + +/** + * udevdb_exit: closes database + */ +void udevdb_exit(void) +{ + udevdb_close(); +} + +/** + * udevdb_init: initializes database + */ +int udevdb_init(int init_flag) +{ + if (init_flag != UDEVDB_DEFAULT && init_flag != UDEVDB_INTERNAL) + return -1; + + return udevdb_open(init_flag); +} diff --git a/udevdb.h b/udevdb.h index fed52bc46a..a9ba2f93b4 100644 --- a/udevdb.h +++ b/udevdb.h @@ -7,14 +7,16 @@ #include "namedev.h" #include "udev.h" -#define BUS_DB "/home/greg/src/udev/busdb.tdb" -#define CLASS_DB "/home/greg/src/udev/classdb.tdb" -#define NAME_DB "/home/greg/src/udev/namedb.tdb" +#define UDEVDB "/home/greg/src/udev/udevdb.tdb" #define PATH_SIZE 256 #define UDEVDB_DEL "#" +/* Udevdb initialization flags */ +#define UDEVDB_DEFAULT 0 /* Defaults database to use file */ +#define UDEVDB_INTERNAL 1 /* Don't store db on disk, use in memory */ + struct udevice { char name[NAME_SIZE]; char sysfs_path[PATH_SIZE]; @@ -30,6 +32,8 @@ struct udevice { }; /* Function Prototypes */ +extern void udevdb_exit(void); +extern int udevdb_init(int init_flag); extern int udevdb_delete_udevice(const char *name); extern int udevdb_add_udevice(const struct udevice *dev); extern struct udevice *udevdb_get_udevice(const char *name); -- cgit v1.2.3-54-g00ecf From c27e69116d3ef0ea069a3c5146009ced08a0238b Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Tue, 14 Oct 2003 23:32:17 -0700 Subject: [PATCH] add callout config type to udev This patch adds a callout config type to udev, so external programs can be called to get serial numbers or id's that are not available as a sysfs attribute. --- namedev.c | 132 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ namedev.h | 2 + udev.c | 8 +++- udev.h | 2 + 4 files changed, 143 insertions(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 782b73d0b9..abed8685c8 100644 --- a/namedev.c +++ b/namedev.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "list.h" #include "udev.h" @@ -42,6 +43,7 @@ #define TYPE_NUMBER "NUMBER" #define TYPE_TOPOLOGY "TOPOLOGY" #define TYPE_REPLACE "REPLACE" +#define TYPE_CALLOUT "CALLOUT" static LIST_HEAD(config_device_list); @@ -78,6 +80,12 @@ static void dump_dev(struct config_device *dev) dev->attr.name, dev->kernel_name, dev->attr.owner, dev->attr.group, dev->attr.mode); break; + case CALLOUT: + dbg("CALLOUT name = '%s', program ='%s', bus = '%s', id = '%s'" + " owner = '%s', group = '%s', mode = '%#o'", + dev->attr.name, dev->exec_program, dev->bus, dev->id, + dev->attr.owner, dev->attr.group, dev->attr.mode); + break; default: dbg("Unknown type of device!"); } @@ -330,6 +338,38 @@ static int namedev_init_config(void) strcpy(dev.attr.name, temp3); dbg("REPLACE name = %s, kernel_name = %s", dev.attr.name, dev.kernel_name); } + if (strcasecmp(temp2, TYPE_CALLOUT) == 0) { + /* number type */ + dev.type = CALLOUT; + + /* PROGRAM="executable" */ + retval = get_value("PROGRAM", &temp, &temp3); + if (retval) + continue; + strcpy(dev.exec_program, temp3); + + /* BUS="bus" */ + temp2 = strsep(&temp, ","); + retval = get_value("BUS", &temp, &temp3); + if (retval) + continue; + strcpy(dev.bus, temp3); + + /* ID="id" */ + temp2 = strsep(&temp, ","); + retval = get_value("ID", &temp, &temp3); + if (retval) + continue; + strcpy(dev.id, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + continue; + strcpy(dev.attr.name, temp3); + dbg("CALLOUT name = %s, program = %s", dev.attr.name, dev.exec_program); + } retval = add_dev(&dev); if (retval) { @@ -417,6 +457,78 @@ static int get_default_mode(struct sysfs_class_device *class_dev) } +static int exec_callout(struct config_device *dev, char *value, int len) +{ + int retval; + int res; + int status; + int fds[2]; + pid_t pid; + int value_set = 0; + char buffer[256]; + + dbg("callout to %s\n", dev->exec_program); + retval = pipe(fds); + if (retval != 0) { + dbg("pipe failed"); + return -1; + } + pid = fork(); + if (pid == -1) { + dbg("fork failed"); + return -1; + } + + if (pid == 0) { + /* + * child + */ + close(STDOUT_FILENO); + dup(fds[1]); /* dup write side of pipe to STDOUT */ + retval = execve(dev->exec_program, main_argv, main_envp); + if (retval != 0) { + dbg("child execve failed"); + exit(1); + } + return -1; /* avoid compiler warning */ + } else { + /* + * Parent reads from fds[0]. + */ + close(fds[1]); + retval = 0; + while (1) { + res = read(fds[0], buffer, sizeof(buffer) - 1); + if (res <= 0) + break; + buffer[res] = '\0'; + if (res > len) { + dbg("callout len %d too short\n", len); + retval = -1; + } + if (value_set) { + dbg("callout value already set"); + retval = -1; + } else { + value_set = 1; + strncpy(value, buffer, len); + } + } + close(fds[0]); + res = wait(&status); + if (res < 0) { + dbg("wait failed result %d", res); + retval = -1; + } + + if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { + dbg("callout program status 0x%x", status); + retval = -1; + } + } + return retval; +} + static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *attr) { struct list_head *tmp; @@ -587,6 +699,26 @@ label_found: goto done; break; } + case CALLOUT: + { + char value[ID_SIZE]; + + if (exec_callout(dev, value, sizeof(value))) + continue; + if (strncmp(value, dev->id, sizeof(value)) != 0) + continue; + strcpy(attr->name, dev->attr.name); + if (dev->attr.mode != 0) { + attr->mode = dev->attr.mode; + strcpy(attr->owner, dev->attr.owner); + strcpy(attr->group, dev->attr.group); + } + dbg("device callout '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->id, attr->name, + dev->attr.owner, dev->attr.group, dev->attr.mode); + goto done; + break; + } case REPLACE: if (strcmp(dev->kernel_name, class_dev->name) != 0) continue; diff --git a/namedev.h b/namedev.h index d986a2376d..1f535c4c8b 100644 --- a/namedev.h +++ b/namedev.h @@ -40,6 +40,7 @@ enum config_type { NUMBER = 2, TOPOLOGY = 3, REPLACE = 4, + CALLOUT = 5, }; #define BUS_SIZE 30 @@ -60,6 +61,7 @@ struct config_device { char id[ID_SIZE]; char place[PLACE_SIZE]; char kernel_name[NAME_SIZE]; + char exec_program[FILE_SIZE]; /* what to set the device to */ struct device_attr attr; diff --git a/udev.c b/udev.c index 6e7ac25175..0aba8c4bf9 100644 --- a/udev.c +++ b/udev.c @@ -52,13 +52,19 @@ static char *get_device(void) return device; } -int main(int argc, char *argv[]) +char **main_argv; +char **main_envp; + +int main(int argc, char **argv, char **envp) { char *action; char *device; char *subsystem; int retval = -EINVAL; + main_argv = argv; + main_envp = envp; + if (argc != 2) { dbg ("unknown number of arguments"); goto exit; diff --git a/udev.h b/udev.h index 590a8ed039..e9fc2e46eb 100644 --- a/udev.h +++ b/udev.h @@ -57,5 +57,7 @@ struct device_attr { extern int udev_add_device(char *device, char *subsystem); extern int udev_remove_device(char *device, char *subsystem); +extern char **main_argv; +extern char **main_envp; #endif -- cgit v1.2.3-54-g00ecf From 6739707df53097ac378f8ff2f0aa694257e31da1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 15 Oct 2003 23:50:13 -0700 Subject: [PATCH] put config files and database in /etc/udev by default Can be overridden on the makefile line. --- Makefile | 14 +++++++++++--- namedev.h | 1 - udev.h | 16 ++++++++++++---- udevdb.c | 14 +++++++++++--- udevdb.h | 5 +---- 5 files changed, 35 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 3f9fef49d5..92b3dc7465 100644 --- a/Makefile +++ b/Makefile @@ -22,10 +22,16 @@ DEBUG = true ROOT = udev -VERSION = 0.2 +VERSION = 003 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) +# override this to make udev look in a different location for it's config files +PREFIX = +CONFIG_DIR = $(PREFIX)/etc/udev/ + +# place to put our device nodes +UDEV_DIR = /udev/ # Comment out this line to build with something other # than the local version of klibc @@ -135,7 +141,9 @@ GEN_HEADERS = udev_version.h # Rules on how to create the generated header files udev_version.h: - @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ + @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ + @echo \#define UDEV_CONFIG_DIR \"$(CONFIG_DIR)\" >> $@ + @echo \#define UDEV_ROOT \"$(UDEV_DIR)\" >> $@ $(ROOT): $(GEN_HEADERS) $(OBJS) $(LIBSYSFS) $(TDB) @@ -151,7 +159,7 @@ clean: $(MAKE) -C libsysfs clean $(MAKE) -C tdb clean -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS ) +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v ".tdb" ) DISTDIR := $(RELEASE_NAME) srcdir = . release: $(DISTFILES) clean diff --git a/namedev.h b/namedev.h index 1f535c4c8b..567756c827 100644 --- a/namedev.h +++ b/namedev.h @@ -30,7 +30,6 @@ struct sysfs_class_device; /* namedev config files */ #define COMMENT_CHARACTER '#' -#define NAMEDEV_CONFIG_ROOT "/home/greg/src/udev/" #define NAMEDEV_CONFIG_PERMISSION_FILE "namedev.permissions" #define NAMEDEV_CONFIG_FILE "namedev.config" diff --git a/udev.h b/udev.h index e9fc2e46eb..33cb89af55 100644 --- a/udev.h +++ b/udev.h @@ -34,15 +34,23 @@ #define dbg(format, arg...) do { } while (0) #endif +/* Parser needs it's own debugging statement, we usually don't care about this at all */ +#ifdef DEBUG_PARSER +#define dbg_parse(format, arg...) \ + do { \ + log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + } while (0) +#else + #define dbg_parse(format, arg...) do { } while (0) +#endif -/* Lots of constants that should be in a config file sometime */ - -/* Where udev should create its device nodes, trailing / needed */ -#define UDEV_ROOT "/udev/" extern int log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); + +/* Lots of constants that should be in a config file sometime */ + #define NAME_SIZE 100 #define OWNER_SIZE 30 #define GROUP_SIZE 30 diff --git a/udevdb.c b/udevdb.c index c2e90be32f..db5bb73de9 100644 --- a/udevdb.c +++ b/udevdb.c @@ -9,6 +9,9 @@ #include #include +#include "udev_version.h" +#include "udev.h" +#include "namedev.h" #include "udevdb.h" #include "tdb/tdb.h" @@ -63,9 +66,14 @@ static void udevdb_close(void) */ static int udevdb_open(int method) { - udevdb = tdb_open(UDEVDB, 0, method, O_RDWR | O_CREAT, 0644); - if (udevdb == NULL) - return -1; + udevdb = tdb_open(UDEV_CONFIG_DIR UDEV_DB, 0, method, O_RDWR | O_CREAT, 0644); + if (udevdb == NULL) { + if (method == UDEVDB_INTERNAL) + dbg("Unable to initialize in-memory database"); + else + dbg("Unable to initialize database at %s", UDEV_CONFIG_DIR UDEV_DB); + return -EINVAL; + } return 0; } diff --git a/udevdb.h b/udevdb.h index a9ba2f93b4..089af2972b 100644 --- a/udevdb.h +++ b/udevdb.h @@ -4,10 +4,7 @@ #ifndef _UDEVDB_H_ #define _UDEVDB_H_ -#include "namedev.h" -#include "udev.h" - -#define UDEVDB "/home/greg/src/udev/udevdb.tdb" +#define UDEV_DB "udevdb.tdb" #define PATH_SIZE 256 -- cgit v1.2.3-54-g00ecf From 5ef7b7992a5c8ea26c2a16a251bf93526b52559b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 15 Oct 2003 23:50:50 -0700 Subject: [PATCH] add dbg_parse() to cut down on parse file debugging statements Can be turned on by hand in the namedev.c file. --- namedev.c | 90 +++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/namedev.c b/namedev.c index abed8685c8..6f69959346 100644 --- a/namedev.c +++ b/namedev.c @@ -21,7 +21,8 @@ * */ -#undef DEBUG +/* define this to enable parsing debugging */ +/* #define DEBUG_PARSER */ #include #include @@ -51,43 +52,43 @@ static void dump_dev(struct config_device *dev) { switch (dev->type) { case KERNEL_NAME: - dbg("KERNEL name ='%s'" + dbg_parse("KERNEL name ='%s'" " owner = '%s', group = '%s', mode = '%#o'", dev->attr.name, dev->attr.owner, dev->attr.group, dev->attr.mode); break; case LABEL: - dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" + dbg_parse("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" " owner = '%s', group = '%s', mode = '%#o'", dev->attr.name, dev->bus, dev->sysfs_file, dev->sysfs_value, dev->attr.owner, dev->attr.group, dev->attr.mode); break; case NUMBER: - dbg("NUMBER name = '%s', bus = '%s', id = '%s'" + dbg_parse("NUMBER name = '%s', bus = '%s', id = '%s'" " owner = '%s', group = '%s', mode = '%#o'", dev->attr.name, dev->bus, dev->id, dev->attr.owner, dev->attr.group, dev->attr.mode); break; case TOPOLOGY: - dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'" + dbg_parse("TOPOLOGY name = '%s', bus = '%s', place = '%s'" " owner = '%s', group = '%s', mode = '%#o'", dev->attr.name, dev->bus, dev->place, dev->attr.owner, dev->attr.group, dev->attr.mode); break; case REPLACE: - dbg("REPLACE name = %s, kernel_name = %s" + dbg_parse("REPLACE name = %s, kernel_name = %s" " owner = '%s', group = '%s', mode = '%#o'", dev->attr.name, dev->kernel_name, dev->attr.owner, dev->attr.group, dev->attr.mode); break; case CALLOUT: - dbg("CALLOUT name = '%s', program ='%s', bus = '%s', id = '%s'" + dbg_parse("CALLOUT name = '%s', program ='%s', bus = '%s', id = '%s'" " owner = '%s', group = '%s', mode = '%#o'", dev->attr.name, dev->exec_program, dev->bus, dev->id, dev->attr.owner, dev->attr.group, dev->attr.mode); break; default: - dbg("Unknown type of device!"); + dbg_parse("Unknown type of device!"); } } @@ -205,7 +206,7 @@ static int namedev_init_config(void) int retval = 0; struct config_device dev; - strcpy(filename, NAMEDEV_CONFIG_ROOT NAMEDEV_CONFIG_FILE); + strcpy(filename, UDEV_CONFIG_DIR NAMEDEV_CONFIG_FILE); dbg("opening %s to read as permissions config", filename); fd = fopen(filename, "r"); if (fd == NULL) { @@ -220,7 +221,7 @@ static int namedev_init_config(void) if (temp == NULL) break; - dbg("read %s", temp); + dbg_parse("read %s", temp); /* eat the whitespace at the beginning of the line */ while (isspace(*temp)) @@ -263,7 +264,10 @@ static int namedev_init_config(void) continue; strcpy(dev.attr.name, temp3); - dbg("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'", dev.attr.name, dev.bus, dev.sysfs_file, dev.sysfs_value); + dbg_parse("LABEL name = '%s', bus = '%s', " + "sysfs_file = '%s', sysfs_value = '%s'", + dev.attr.name, dev.bus, dev.sysfs_file, + dev.sysfs_value); } if (strcasecmp(temp2, TYPE_NUMBER) == 0) { @@ -290,7 +294,8 @@ static int namedev_init_config(void) continue; strcpy(dev.attr.name, temp3); - dbg("NUMBER name = '%s', bus = '%s', id = '%s'", dev.attr.name, dev.bus, dev.id); + dbg_parse("NUMBER name = '%s', bus = '%s', id = '%s'", + dev.attr.name, dev.bus, dev.id); } if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { @@ -317,7 +322,8 @@ static int namedev_init_config(void) continue; strcpy(dev.attr.name, temp3); - dbg("TOPOLOGY name = '%s', bus = '%s', place = '%s'", dev.attr.name, dev.bus, dev.place); + dbg_parse("TOPOLOGY name = '%s', bus = '%s', place = '%s'", + dev.attr.name, dev.bus, dev.place); } if (strcasecmp(temp2, TYPE_REPLACE) == 0) { @@ -336,7 +342,8 @@ static int namedev_init_config(void) if (retval) continue; strcpy(dev.attr.name, temp3); - dbg("REPLACE name = %s, kernel_name = %s", dev.attr.name, dev.kernel_name); + dbg_parse("REPLACE name = %s, kernel_name = %s", + dev.attr.name, dev.kernel_name); } if (strcasecmp(temp2, TYPE_CALLOUT) == 0) { /* number type */ @@ -368,7 +375,8 @@ static int namedev_init_config(void) if (retval) continue; strcpy(dev.attr.name, temp3); - dbg("CALLOUT name = %s, program = %s", dev.attr.name, dev.exec_program); + dbg_parse("CALLOUT name = %s, program = %s", + dev.attr.name, dev.exec_program); } retval = add_dev(&dev); @@ -394,7 +402,7 @@ static int namedev_init_permissions(void) int retval = 0; struct config_device dev; - strcpy(filename, NAMEDEV_CONFIG_ROOT NAMEDEV_CONFIG_PERMISSION_FILE); + strcpy(filename, UDEV_CONFIG_DIR NAMEDEV_CONFIG_PERMISSION_FILE); dbg("opening %s to read as permissions config", filename); fd = fopen(filename, "r"); if (fd == NULL) { @@ -409,7 +417,7 @@ static int namedev_init_permissions(void) if (temp == NULL) break; - dbg("read %s", temp); + dbg_parse("read %s", temp); /* eat the whitespace at the beginning of the line */ while (isspace(*temp)) @@ -437,7 +445,8 @@ static int namedev_init_permissions(void) dev.attr.mode = strtol(temp, NULL, 8); - dbg("name = %s, owner = %s, group = %s, mode = %#o", dev.attr.name, dev.attr.owner, dev.attr.group, dev.attr.mode); + dbg_parse("name = %s, owner = %s, group = %s, mode = %#o", + dev.attr.name, dev.attr.owner, dev.attr.group, dev.attr.mode); retval = add_dev(&dev); if (retval) { dbg("add_dev returned with error %d", retval); @@ -537,10 +546,10 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at attr->mode = -1; if (class_dev->sysdevice) { - dbg("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path); - dbg("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); + dbg_parse("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path); + dbg_parse("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); } else { - dbg("class_dev->name = '%s'", class_dev->name); + dbg_parse("class_dev->name = '%s'", class_dev->name); } list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); @@ -549,7 +558,8 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at { char *temp; - dbg("LABEL: match file '%s' with value '%s'", dev->sysfs_file, dev->sysfs_value); + dbg_parse("LABEL: match file '%s' with value '%s'", + dev->sysfs_file, dev->sysfs_value); /* try to find the attribute in the class device directory */ temp = sysfs_get_value_from_attributes(class_dev->directory->attributes, dev->sysfs_file); if (temp) @@ -567,22 +577,22 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at * up in the kernel... */ if (strstr(class_dev->directory->path, "block")) { - dbg("looking at block device..."); + dbg_parse("looking at block device..."); if (isdigit(class_dev->directory->path[strlen(class_dev->directory->path)-1])) { char path[SYSFS_PATH_MAX]; struct sysfs_class_device *class_dev_parent; - dbg("really is a partition..."); + dbg_parse("really is a partition..."); strcpy(path, class_dev->directory->path); temp = strrchr(path, '/'); *temp = 0x00; - dbg("looking for a class device at '%s'", path); + dbg_parse("looking for a class device at '%s'", path); class_dev_parent = sysfs_open_class_device(path); if (class_dev_parent == NULL) { - dbg ("sysfs_open_class_device failed"); + dbg("sysfs_open_class_device at '%s' failed", path); continue; } - dbg("class_dev_parent->name = %s", class_dev_parent->name); + dbg_parse("class_dev_parent->name = %s", class_dev_parent->name); /* try to find the attribute in the class device directory */ temp = sysfs_get_value_from_attributes(class_dev_parent->directory->attributes, dev->sysfs_file); @@ -606,7 +616,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at label_found: temp[strlen(temp)-1] = 0x00; - dbg("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, temp, dev->sysfs_value); + dbg_parse("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, temp, dev->sysfs_value); if (strcmp(dev->sysfs_value, temp) != 0) continue; @@ -621,7 +631,7 @@ label_found: strcpy(attr->owner, dev->attr.owner); strcpy(attr->group, dev->attr.group); } - dbg("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dbg_parse("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->sysfs_file, dev->sysfs_value, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); goto done; @@ -637,14 +647,14 @@ label_found: continue; strcpy(path, class_dev->sysdevice->directory->path); temp = strrchr(path, '/'); - dbg("NUMBER path = '%s'", path); - dbg("NUMBER temp = '%s' id = '%s'", temp, dev->id); + dbg_parse("NUMBER path = '%s'", path); + dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); if (strstr(temp, dev->id) != NULL) { found = 1; } else { *temp = 0x00; temp = strrchr(path, '/'); - dbg("NUMBERY temp = '%s' id = '%s'", temp, dev->id); + dbg_parse("NUMBERY temp = '%s' id = '%s'", temp, dev->id); if (strstr(temp, dev->id) != NULL) found = 1; } @@ -657,7 +667,7 @@ label_found: strcpy(attr->owner, dev->attr.owner); strcpy(attr->group, dev->attr.group); } - dbg("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dbg_parse("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->id, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); goto done; @@ -673,14 +683,14 @@ label_found: found = 0; strcpy(path, class_dev->sysdevice->directory->path); temp = strrchr(path, '/'); - dbg("TOPOLOGY path = '%s'", path); - dbg("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); + dbg_parse("TOPOLOGY path = '%s'", path); + dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); if (strstr(temp, dev->place) != NULL) { found = 1; } else { *temp = 0x00; temp = strrchr(path, '/'); - dbg("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); + dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); if (strstr(temp, dev->place) != NULL) found = 1; } @@ -693,7 +703,7 @@ label_found: strcpy(attr->owner, dev->attr.owner); strcpy(attr->group, dev->attr.group); } - dbg("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dbg_parse("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->place, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); goto done; @@ -713,7 +723,7 @@ label_found: strcpy(attr->owner, dev->attr.owner); strcpy(attr->group, dev->attr.group); } - dbg("device callout '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dbg_parse("device callout '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->id, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); goto done; @@ -728,7 +738,7 @@ label_found: strcpy(attr->owner, dev->attr.owner); strcpy(attr->group, dev->attr.group); } - dbg("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dbg_parse("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->kernel_name, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); goto done; @@ -736,7 +746,7 @@ label_found: case KERNEL_NAME: break; default: - dbg("Unknown type of device '%d'", dev->type); + dbg_parse("Unknown type of device '%d'", dev->type); break; } } -- cgit v1.2.3-54-g00ecf From 8479066ec7dd5824a3fe5bf08bb5f9d2e14d8837 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 15 Oct 2003 23:51:11 -0700 Subject: [PATCH] tell the user what mknod() we are trying to do. --- udev-add.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev-add.c b/udev-add.c index c8aa2f70c9..48979393a5 100644 --- a/udev-add.c +++ b/udev-add.c @@ -93,6 +93,7 @@ static int create_node(char *name, char type, int major, int minor, int mode) return -EINVAL; } + dbg("mknod(%s, %#o, %u, %u)", filename, mode, major, minor); retval = mknod(filename,mode,makedev(major,minor)); if (retval) dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", -- cgit v1.2.3-54-g00ecf From 2e5a8b99f89f30ee06b39da7dee024a7361b9886 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 15 Oct 2003 23:51:27 -0700 Subject: [PATCH] add version to debug log on startup. --- udev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev.c b/udev.c index 0aba8c4bf9..a398477118 100644 --- a/udev.c +++ b/udev.c @@ -65,6 +65,8 @@ int main(int argc, char **argv, char **envp) main_argv = argv; main_envp = envp; + dbg("version %s", UDEV_VERSION); + if (argc != 2) { dbg ("unknown number of arguments"); goto exit; -- cgit v1.2.3-54-g00ecf From 9f53b06a8da90b88c02f943502ea3cfdf8801087 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 16 Oct 2003 21:18:40 -0700 Subject: [PATCH] added install target for makefile so people don't have to do it by hand anymore. --- Makefile | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 92b3dc7465..fabb81b2c3 100644 --- a/Makefile +++ b/Makefile @@ -27,11 +27,23 @@ INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) # override this to make udev look in a different location for it's config files -PREFIX = -CONFIG_DIR = $(PREFIX)/etc/udev/ +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +mandir = ${prefix}/usr/share/man +hotplugdir = ${etcdir}/hotplug.d/default +configdir = ${etcdir}/udev/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + # place to put our device nodes -UDEV_DIR = /udev/ +udevdir = ${prefix}/udev/ # Comment out this line to build with something other # than the local version of klibc @@ -142,8 +154,8 @@ GEN_HEADERS = udev_version.h # Rules on how to create the generated header files udev_version.h: @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ - @echo \#define UDEV_CONFIG_DIR \"$(CONFIG_DIR)\" >> $@ - @echo \#define UDEV_ROOT \"$(UDEV_DIR)\" >> $@ + @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ + @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ $(ROOT): $(GEN_HEADERS) $(OBJS) $(LIBSYSFS) $(TDB) @@ -159,7 +171,7 @@ clean: $(MAKE) -C libsysfs clean $(MAKE) -C tdb clean -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v ".tdb" ) +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v ".tdb" | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . release: $(DISTFILES) clean @@ -177,3 +189,14 @@ release: $(DISTFILES) clean @tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz @rm -rf $(DISTDIR) @echo "Built $(RELEASE_NAME).tar.gz" + + +install: all + $(INSTALL) -d $(udevdir) + $(INSTALL) -d $(configdir) + $(INSTALL) -d $(hotplugdir) + $(INSTALL_PROGRAM) -D $(ROOT) $(sbindir)/$(ROOT) + $(INSTALL_DATA) -D udev.8 $(mandir)/man8/udev.8 + $(INSTALL_DATA) namedev.config $(configdir) + $(INSTALL_DATA) namedev.permissions $(configdir) + - ln -s $(sbindir)/$(ROOT) $(hotplugdir)/udev.hotplug -- cgit v1.2.3-54-g00ecf From 6785820d3889863e4c34428d582726b0572a261a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 00:19:04 -0700 Subject: [PATCH] added uninstall support --- Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Makefile b/Makefile index fabb81b2c3..5523a48609 100644 --- a/Makefile +++ b/Makefile @@ -200,3 +200,15 @@ install: all $(INSTALL_DATA) namedev.config $(configdir) $(INSTALL_DATA) namedev.permissions $(configdir) - ln -s $(sbindir)/$(ROOT) $(hotplugdir)/udev.hotplug + +uninstall: + - rm $(hotplugdir)/udev.hotplug + - rm $(configdir)/namedev.permissions + - rm $(configdir)/namedev.config + - rm $(mandir)/man8/udev.8 + - rm $(sbindir)/$(ROOT) + - rmdir $(hotplugdir) + - rmdir $(configdir) + - rmdir $(udevdir) + + -- cgit v1.2.3-54-g00ecf From 04db8c9e06986f0406f4f7cd9a2245e35dd5db9f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 00:29:17 -0700 Subject: [PATCH] add udev man page (basically just a place holder for now.) --- udev.8 | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 udev.8 diff --git a/udev.8 b/udev.8 new file mode 100644 index 0000000000..e44855ba16 --- /dev/null +++ b/udev.8 @@ -0,0 +1,26 @@ +.TH UDEV 8 "October 2003" "" "Linux Programmer's Manual" +.SH NAME +udev \- Linux dynamic device naming support +.SH SYNOPSIS +.B udev +.SH "DESCRIPTION" +.B udev +is a wonderful program whose man page has not been written yet. +.SH "FILES" +.nf +.ft B +.ft +/sbin/udev udev program +/etc/udev/* udev config and database files +/etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program +.fi +.LP +.SH "SEE ALSO" +.BR hotplug "(8)" +.PP +The +.I http://linux-hotplug.sourceforge.net/ +web site. +.SH AUTHORS +udev was developed by Greg Kroah-Hartman with much help from +Dan Stekloff and many others. -- cgit v1.2.3-54-g00ecf From fc1c2fd8b1815d7fa8f31cd858f553c557065c39 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 00:44:14 -0700 Subject: [PATCH] updated the TODO list. --- TODO | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 0bcaf2cc24..b05ad0c51b 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,29 @@ -- use mknod(2) and not execute mknod(1) +This is a short list of things that needs to be done. They are in no specific +order. I will gladly accept patches for any of these items, or any other stuff +people offer up. + + Greg Kroah-Hartman + + +- more documentation (can never have too much.) +- document the config file format (it will change over time...) +- add proper man page - add klibc to the build process (or make it easier to do) to get smaller binary -- document the config file format (it will change over time...) -- persistant naming database backend +- import latest libsysfs and convert udev to use it. +- On remove, look up the device in the database (now that we have one) and + delete what was created, not what the kernel is calling the device. +- add symlink generation and removal support +- better partition support (it's a hack right now, maybe new libsysfs changes + can help out a lot here.) +- allow database to be queried by other programs +- split program into two pieces (daemon and helper that sends events to it). + This will allow us to keep track of sequences, and lots of other needed + stuff. +- keep track of current permissions on devices when daemon shuts down. +- better permission handling +- create kernel name to devfs name config file so that all of the devfs users + will have an upgrade path. - make program work like design says it should (three parts, not 1) - add hooks to call D-BUS when new node is created or removed - lots of other stuff... -- cgit v1.2.3-54-g00ecf From bf3ca56fd4685a52ae66ed6ee05ec4705130b9fe Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 01:39:19 -0700 Subject: [PATCH] Updatd the README --- README | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/README b/README index 07fa162bbd..ed25a733ab 100644 --- a/README +++ b/README @@ -6,32 +6,47 @@ files in the docs/ directory. To use: -- Edit the udev.h file and replace the following variables with values - that make sense for your system: - #define UDEV_ROOT "/udev/" - #define MKNOD "/bin/mknod" - The only value most people will have to change is the UDEV_ROOT - variable, as I doubt you really want device nodes to be created in my - home directory :) +- You must be running a 2.6 version of the Linux kernel. -- Run make to build the project. +- Make sure sysfs is mounted. udev will figure out where sysfs is mounted, but + the traditional place for it is at /sys. You can mount it by hand by running: + mount -t sysfs none /sys -- Make sure sysfs is mounted. +- Make sure you have the latest version of the linux-hotplug scripts. They are + available at linux-hotplug.sf.net or from your local kernel.org mirror at: + kernel.org/pub/linux/utils/kernel/hotplug/ + They are required in order for udev to work properly. -- Point /proc/sys/kernel/hotplug at the location of the udev binary that - is created. Then plug some block devices in, or other types of - devices that create dev files in sysfs. An easy way to do this, - without any hardware is to use the scsi_debug module to create virtual - scsi devices. + If for some reason you do not install the hotplug scripts, you must tell the + kernel to point the hotplug binary at wherever you install udev at. This can + be done by: + echo "/sbin/udev" > /proc/sys/kernel/hotplug -- Watch as the nodes get created and removed. +- Build the project: + make +- Install the project: + make install -Yes this is a really rough first cut, I know. It's mostly a proof of -concept that this can actually work. See the TODO file for a list of + This will put the udev binary in /sbin, create the /udev and /etc/udev + directories, and place the udev configuration files in /etc/udev. You + will probably want to edit the namedev.* files to create custom naming + rules. More info on how the config files are set up are contained in + comments in the files, and is located in the documentation. + +- Add and remove devices from the system and marvel as nodes are created + and removed in /udev/ based on the device types. + +- If you later get sick of it, uninstall it: + make uninstall + + +Things are still quite rough, and it's a bit beyond proof of concept +code. Help is very much appreciated, see the TODO file for a list of things left to be done. Any comment/questions/concerns please let me know. greg k-h greg@kroah.com + -- cgit v1.2.3-54-g00ecf From cd74c8e2022977ab560b40bedafa4e09abcb26aa Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 01:39:29 -0700 Subject: [PATCH] TODO updates --- TODO | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index b05ad0c51b..89fe6679d4 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,8 @@ This is a short list of things that needs to be done. They are in no specific order. I will gladly accept patches for any of these items, or any other stuff people offer up. - Greg Kroah-Hartman +greg k-h +greg@kroah.com - more documentation (can never have too much.) @@ -24,6 +25,7 @@ people offer up. - better permission handling - create kernel name to devfs name config file so that all of the devfs users will have an upgrade path. -- make program work like design says it should (three parts, not 1) +- do early boot logic (putting udev into initramfs, handle pivot-root, + etc.) - add hooks to call D-BUS when new node is created or removed - lots of other stuff... -- cgit v1.2.3-54-g00ecf From c9e6dc553b218d06170863f17f4c82c77ca28f81 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 01:39:47 -0700 Subject: [PATCH] Add AUTHORS and INSTALL files. --- AUTHORS | 4 ++++ INSTALL | 1 + 2 files changed, 5 insertions(+) create mode 100644 AUTHORS create mode 100644 INSTALL diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000000..f15b702f34 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,4 @@ +Greg Kroah-Hartman +Dan Stekloff + +Your name should go here, just sent patches... diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000000..cc877be1a0 --- /dev/null +++ b/INSTALL @@ -0,0 +1 @@ +Read the README file for how to install udev. -- cgit v1.2.3-54-g00ecf From 8dfc8dbe013124f06df74bad4e8e648348b1db39 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 01:40:02 -0700 Subject: [PATCH] copyright updates. --- Makefile | 4 ++-- udevdb.c | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5523a48609..c426a881e6 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ -# Makefile for diethotplug +# Makefile for udev # -# Copyright (C) 2000,2001 Greg Kroah-Hartman +# Copyright (C) 2003 Greg Kroah-Hartman # # 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 diff --git a/udevdb.c b/udevdb.c index db5bb73de9..fb34ca61d3 100644 --- a/udevdb.c +++ b/udevdb.c @@ -1,3 +1,26 @@ +/* + * udevdb.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003 IBM Corp. + * + * 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 02139, USA. + * + */ + /* * udev database library */ -- cgit v1.2.3-54-g00ecf From 4846106645b4df43791f918155b3bcec655e0e4f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 05:05:04 -0700 Subject: [PATCH] removed AUTHORS and INSTALL files as they were pretty pointless. --- AUTHORS | 4 ---- INSTALL | 1 - 2 files changed, 5 deletions(-) delete mode 100644 AUTHORS delete mode 100644 INSTALL diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index f15b702f34..0000000000 --- a/AUTHORS +++ /dev/null @@ -1,4 +0,0 @@ -Greg Kroah-Hartman -Dan Stekloff - -Your name should go here, just sent patches... diff --git a/INSTALL b/INSTALL deleted file mode 100644 index cc877be1a0..0000000000 --- a/INSTALL +++ /dev/null @@ -1 +0,0 @@ -Read the README file for how to install udev. -- cgit v1.2.3-54-g00ecf From b1830e7984e86c5765a67a3aae4b63e1c48155b6 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 05:55:24 -0700 Subject: [PATCH] Add FAQ for udev --- FAQ | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 FAQ diff --git a/FAQ b/FAQ new file mode 100644 index 0000000000..c082a5bec4 --- /dev/null +++ b/FAQ @@ -0,0 +1,75 @@ +Frequently Asked Questions about udev + + +Q: What's this udev thing, and what is it trying to do? +A: Read the OLS 2003 paper about udev, available in the docs/ directory, + and at: + + There is also a udev presentation given at OLS 2003 available at: + + +Q: How is udev related to devfs? +A: udev works entirely in userspace, using /sbin/hotplug calls that the + kernel makes whenever a device is added or removed from the kernel. All + naming policy, and permission control is done in userspace. devfs + operated from within the kernel. + +Q: Why was devfs marked OBSOLETE if udev is not finished yet? +A: To quote Al Viro (Linux VFS kernel maintainer): + - it was determined that the same thing could be done in userspace + - devfs had been shoved into the tree in hope that its quality will + catch up + - devfs was found to have fixable and unfixable bugs + - the former had stayed around for many months with maintainer + claiming that everything works fine + - the latter had stayed, period. + - the devfs maintainer/author disappeared and stoped maintaining + the code. + +Q: But udev will not automatically load a driver if a /dev node is opened + when it is not present like devfs will do. +A: If you really require this functionality, then use devfs. It is still + present in the kernel. + +Q: But I really like the devfs naming scheme, will udev do that? +A: Yes, udev can create /dev nodes using the devfs naming policy. A + configuration file needs to be created to map the kernel default names + to the devfs names. Such a configuration file would be gladly added to + the udev package if it is provided by anyone who can create such a + mapping. + +Q: What kinds of devices does udev create nodes for? +A: All devices that are shown in sysfs will work with udev. If more + support is added for devices to the kernel, udev will automatically + start working for them. All block devices are currently supported, and + almost all major char devices are supported. Kernel developers are + working on adding support for all char devices at this time. See the + linux-kernel mailing list for patches and status of these patches. + +Q: Will udev remove the limit on the number of anonymous devices? +A: udev is entirely in userspace. If the kernel supports a greater number + of anonymous devices, udev will support it. + +Q: Will udev support symlinks? +A: Yes, patches are gladly accepted to add this functionality. + +Q: How will udev support changes to device permissions? +A: On shutdown, udev will save the state of existing device permissions to + its database, and then used the on the next boot time. + +Q: How will udev handle the /dev filesystem? +A: /dev can be a ramfs, or a backing filesystem. udev does not care what + kind of filesystem it runs on. + +Q: How will udev handle devices found before init runs? +A: udev will be placed in initramfs and run for every device that is found. + Work to get this implemented is still underway. + +Q: I have other questions about udev, where do I ask them? +A: The linux-hotplug-devel mailing list is the proper place for it. The + address for it is linux-hotplug-devel@lists.sourceforge.net + Information on joining can be found at + + Archives of the mailing list can be found at: + + -- cgit v1.2.3-54-g00ecf From d3069ca3b71160cd7e89b3ff9d411ce2d7971610 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 06:12:52 -0700 Subject: [PATCH] fix makefile release rule to not drop tdb.h file. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c426a881e6..493cd08450 100644 --- a/Makefile +++ b/Makefile @@ -171,7 +171,7 @@ clean: $(MAKE) -C libsysfs clean $(MAKE) -C tdb clean -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v ".tdb" | sort ) +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . release: $(DISTFILES) clean -- cgit v1.2.3-54-g00ecf From 221204964609fec81f50a6c411f276c88f412755 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 06:14:02 -0700 Subject: [PATCH] update the spec file for the new version and install process. Spec file still does not install all of the proper files. --- udev.spec | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/udev.spec b/udev.spec index fe6ca84cc3..07b608ed6d 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 0.2 +Version: 003 Release: 1 License: GPL Group: Utilities/System @@ -11,7 +11,7 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root %description udev is a implementation of devfs in userspace using sysfs and -/sbin/hotplug. It requires a 2.5/2.6 kernel to run properly. +/sbin/hotplug. It requires a 2.6 kernel to run properly. %prep %setup @@ -20,8 +20,7 @@ udev is a implementation of devfs in userspace using sysfs and make %install -mkdir -p $RPM_BUILD_ROOT/sbin -install -m 755 %{name} $RPM_BUILD_ROOT/sbin +make prefix=$RPM_BUILD_ROOT install %clean rm -fr $RPM_BUILD_ROOT -- cgit v1.2.3-54-g00ecf From 22b000237951ce98b2ab77540e4bf2e6b1e91582 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 06:32:01 -0700 Subject: [PATCH] update changelog for 003 release --- ChangeLog | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 104 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index a0bd85174b..fa72db5c20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,106 @@ -0.2 - added namedev - now used a snapshot of libsysfs. - Can now handle the 5 different naming schemes. - Was released based on my OLS 2003 presentation. - Lots still left to do, but it kinda works better... +Summary of changes from v0.2 to v003 +============================================ + +Daniel E. F. Stekloff: + o udevdb patch + o udevdb prototype + +Greg Kroah-Hartman: + o update the spec file for the new version and install process + o fix makefile release rule to not drop tdb.h file + o Add FAQ for udev + o removed AUTHORS and INSTALL files as they were pretty pointless + o copyright updates + o Add AUTHORS and INSTALL files + o TODO updates + o Updatd the README + o updated the TODO list + o add udev man page (basically just a place holder for now.) + o added uninstall support + o added install target for makefile so people don't have to do it by hand anymore + o add version to debug log on startup + o tell the user what mknod() we are trying to do + o add dbg_parse() to cut down on parse file debugging statements + o put config files and database in /etc/udev by default + o add ols 2003 udev paper to docs/ + o clean up some debugging stuff in namedev.c + o do not build the tdb binary programs, only the objects + o merge tdb into the build process + o Added tdb code from latest cvs version in the samba tree + o added my name to the .spec file + o minor cleanups + o cleanup the mknod code a bit + o remove mknod callout + o handle new major:minor format of dev files that showed up in 2.6.0-test2-bk3 or so + o oops, everything was getting created as 000 mode, try to fix this up, but fail... + o more test stuff + +Olaf Hering: + o print udev pid + +Patrick Mansfield: + o add callout config type to udev + +Paul Mundt: + o Fix TDB cross compilation + o udev spec file + o udev/libsysfs cross compile fixes + + +Summary of changes from v0.1 to v0.2 +============================================ + +Greg Kroah-Hartman: + o more test stuff + o removed unneeded stuff from udev.h + o added 0.2 change log info + o start working on label support, and fix some segfaults for block devices + o test config file changes + o add NUMBER support (basically same logic as TOPOLOGY, perhaps we should + merge this...) + o added topology support + o got REPLACE to work properly + o make struct config_device contain a struct device_attr instead of + duplicating the mess + o block test + o split the tests up into different files + o split udev main logic into udev-add and udev-remove + o Clean up the namedev interface a bit, making the code smaller + o bk: update ignore list + o update the tests to handle block devices too + o add initial libsysfs support + o added libsysfs to the build + o added libsysfs code from sysutils-0.1.1-071803 release + o namedev config files are fully parsed + o more permission tests + o make log_message spit out warnings so I don't have to spend forever + chasing down stupid bugs that aren't there... + o added klibc makefile + o Initial namedev parsing of config files + o sleep for 2 seconds to give the kernel a chance to actually create the + files we need + o pick a better default UDEV_ROOT + o fix up the test to actually work + o added more documentation in README and TODO files + + +Summary of changes up to v0.1 +============================================ + +Greg Kroah-Hartman: + o added more documentation in README and TODO files + o updated the documentation + o cleaned up the makefile a bit + o remove now works! + o restructure code to be able to actually get remove_node() to work + o Creating nodes actually works + o added stupid test script for debugging + o added initial documentation and gpl license + o enabled debugging + o updated ignore list + o added initial files + o fixed up config + o Initial repository create + o BitKeeper file /home/greg/src/udev/udev/ChangeSet -0.1 - Added a bit of documentation to the README and TODO files. -0.01 - initial release -- cgit v1.2.3-54-g00ecf From 1c596cc0a5357105a80ab07f0ebbe2eb330b2c28 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 19:26:07 -0700 Subject: [PATCH] fix segfaults when dealing with partitions. --- udev-add.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/udev-add.c b/udev-add.c index 48979393a5..6060bcf5f7 100644 --- a/udev-add.c +++ b/udev-add.c @@ -169,13 +169,13 @@ int udev_add_device(char *device, char *subsystem) } memset(&dbdev, 0, sizeof(dbdev)); strncpy(dbdev.name, attr.name, NAME_SIZE); - strncpy(dbdev.sysfs_path, class_dev->sysdevice->directory->path, - PATH_SIZE); + if (class_dev->sysdevice) { + strncpy(dbdev.sysfs_path, class_dev->sysdevice->directory->path, PATH_SIZE); + strncpy(dbdev.bus_id, class_dev->sysdevice->bus_id, ID_SIZE); + } strncpy(dbdev.class_dev_name, class_dev->name, NAME_SIZE); - if ((sysfs_get_name_from_path(subsystem, dbdev.class_name, NAME_SIZE)) - != 0) + if ((sysfs_get_name_from_path(subsystem, dbdev.class_name, NAME_SIZE)) != 0) strcpy(dbdev.class_name, "unkown"); - strncpy(dbdev.bus_id, class_dev->sysdevice->bus_id, ID_SIZE); strcpy(dbdev.bus_name, "unknown"); if (class_dev->driver != NULL) strncpy(dbdev.driver, class_dev->driver->name, NAME_SIZE); -- cgit v1.2.3-54-g00ecf From ca9998602336f67eb2590819eecf416977885e2a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 23:32:17 -0700 Subject: [PATCH] got "remove of named devices" working. database code still needs some major cleanup. --- udev-add.c | 29 +++---------- udev-remove.c | 5 +++ udevdb.c | 130 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- udevdb.h | 5 ++- 4 files changed, 134 insertions(+), 35 deletions(-) diff --git a/udev-add.c b/udev-add.c index 6060bcf5f7..116ab2b448 100644 --- a/udev-add.c +++ b/udev-add.c @@ -137,7 +137,6 @@ int udev_add_device(char *device, char *subsystem) { struct sysfs_class_device *class_dev; struct device_attr attr; - struct udevice dbdev; int major; int minor; char type; @@ -164,33 +163,17 @@ int udev_add_device(char *device, char *subsystem) retval = get_major_minor(class_dev, &major, &minor); if (retval) { - dbg ("get_major_minor failed"); + dbg("get_major_minor failed"); goto exit; } - memset(&dbdev, 0, sizeof(dbdev)); - strncpy(dbdev.name, attr.name, NAME_SIZE); - if (class_dev->sysdevice) { - strncpy(dbdev.sysfs_path, class_dev->sysdevice->directory->path, PATH_SIZE); - strncpy(dbdev.bus_id, class_dev->sysdevice->bus_id, ID_SIZE); - } - strncpy(dbdev.class_dev_name, class_dev->name, NAME_SIZE); - if ((sysfs_get_name_from_path(subsystem, dbdev.class_name, NAME_SIZE)) != 0) - strcpy(dbdev.class_name, "unkown"); - strcpy(dbdev.bus_name, "unknown"); - if (class_dev->driver != NULL) - strncpy(dbdev.driver, class_dev->driver->name, NAME_SIZE); - else - strcpy(dbdev.driver, "unkown"); - dbdev.type = type; - dbdev.major = major; - dbdev.minor = minor; - dbdev.mode = attr.mode; - sysfs_close_class_device(class_dev); + retval = udevdb_add_device(device, class_dev, attr.name, type, major, minor, attr.mode); - retval = udevdb_add_udevice(&dbdev); if (retval != 0) - goto exit; + dbg("udevdb_add_device failed, but we are going to try to create the node anyway. " + "But remove might not work properly for this device."); + + sysfs_close_class_device(class_dev); return create_node(attr.name, type, major, minor, attr.mode); diff --git a/udev-remove.c b/udev-remove.c index 29063efb0d..9862a6f201 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -45,6 +45,11 @@ static char *get_name(char *dev, int major, int minor) static char name[100]; char *temp; + temp = udevdb_get_udevice_by_sysfs(dev); + dbg("udevdb_get_udevice_by_sysfs returned %s", temp); + if (temp != NULL) + return temp; + temp = strrchr(dev, '/'); if (temp == NULL) return NULL; diff --git a/udevdb.c b/udevdb.c index fb34ca61d3..05bd72a5d9 100644 --- a/udevdb.c +++ b/udevdb.c @@ -37,6 +37,7 @@ #include "namedev.h" #include "udevdb.h" #include "tdb/tdb.h" +#include "libsysfs/libsysfs.h" static TDB_CONTEXT *udevdb; @@ -55,11 +56,15 @@ struct classdb_record { char name[NAME_SIZE]; }; +struct sysfsdb_record { + char name[PATH_SIZE]; +}; + /** * namedb_record - device name is key, remaining udevice info stored here. */ struct namedb_record { - char sysfs_path[PATH_SIZE]; + char sysfs_dev_path[PATH_SIZE]; char class_dev_name[NAME_SIZE]; char class_name[NAME_SIZE]; char bus[BUS_SIZE]; @@ -177,6 +182,41 @@ static struct classdb_record *classdb_fetch(const char *cls, return rec; } +static struct sysfsdb_record *sysfsdb_fetch(const char *path) +{ + TDB_DATA key, data; + char keystr[PATH_SIZE+2]; + struct sysfsdb_record *rec = NULL; + + if (strlen(path) >= PATH_SIZE) + return NULL; + + memset(keystr, 0, sizeof(keystr)); + strcpy(keystr, path); + + dbg("keystr = %s", keystr); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + data = tdb_fetch(udevdb, key); + if (data.dptr == NULL || data.dsize == 0) { + dbg("tdb_fetch did not work :("); + return NULL; + } + + rec = (struct sysfsdb_record *)malloc(sizeof(struct sysfsdb_record)); + if (rec == NULL) { + free(data.dptr); + return NULL; + } + + memcpy(rec, data.dptr, sizeof(struct sysfsdb_record)); + free(data.dptr); + + return rec; +} + /** * namedb_fetch */ @@ -273,6 +313,32 @@ static int classdb_store(const struct udevice *dev) return retval; } +static int sysfs_store(const char *path, const struct udevice *dev) +{ + TDB_DATA key, data; + char keystr[PATH_SIZE+2]; + struct sysfsdb_record rec; + int retval = 0; + + if (dev == NULL) + return -ENODEV; + + memset(keystr, 0, sizeof(keystr)); + strcpy(keystr, path); + dbg("keystr = %s", keystr); + + key.dptr = (void *)keystr; + key.dsize = strlen(keystr) + 1; + + strcpy(rec.name, dev->name); + + data.dptr = (void *) &rec; + data.dsize = sizeof(rec); + + retval = tdb_store(udevdb, key, data, TDB_REPLACE); + return retval; +} + /** * namedb_store */ @@ -292,7 +358,7 @@ static int namedb_store(const struct udevice *dev) key.dptr = (void *)keystr; key.dsize = strlen(keystr) + 1; - strcpy(rec.sysfs_path, dev->sysfs_path); + strcpy(rec.sysfs_dev_path, dev->sysfs_dev_path); strcpy(rec.bus, dev->bus_name); strcpy(rec.id, dev->bus_id); strcpy(rec.class_dev_name, dev->class_dev_name); @@ -409,18 +475,41 @@ int udevdb_delete_udevice(const char *name) } /** - * udevdb_add_udevice: adds udevice to database + * udevdb_add_device: adds class device to database */ -int udevdb_add_udevice(const struct udevice *dev) +int udevdb_add_device(const char *device, const struct sysfs_class_device *class_dev, const char *name, char type, int major, int minor, int mode) { - if (dev == NULL) - return -1; + struct udevice dbdev; + + if (class_dev == NULL) + return -ENODEV; - if ((busdb_store(dev)) != 0) + memset(&dbdev, 0, sizeof(dbdev)); + strncpy(dbdev.name, name, NAME_SIZE); + if (class_dev->sysdevice) { + strncpy(dbdev.sysfs_dev_path, class_dev->sysdevice->directory->path, PATH_SIZE); + strncpy(dbdev.bus_id, class_dev->sysdevice->bus_id, ID_SIZE); + } + strncpy(dbdev.class_dev_name, class_dev->name, NAME_SIZE); +// if ((sysfs_get_name_from_path(subsystem, dbdev.class_name, NAME_SIZE)) != 0) +// strcpy(dbdev.class_name, "unknown"); + strcpy(dbdev.bus_name, "unknown"); + if (class_dev->driver != NULL) + strncpy(dbdev.driver, class_dev->driver->name, NAME_SIZE); + else + strcpy(dbdev.driver, "unknown"); + dbdev.type = type; + dbdev.major = major; + dbdev.minor = minor; + dbdev.mode = mode; + + if ((busdb_store(&dbdev)) != 0) return -1; - if ((classdb_store(dev)) != 0) + if ((classdb_store(&dbdev)) != 0) return -1; - if ((namedb_store(dev)) != 0) + if ((sysfs_store(device, &dbdev)) != 0) + return -1; + if ((namedb_store(&dbdev)) != 0) return -1; return 0; @@ -448,7 +537,7 @@ struct udevice *udevdb_get_udevice(const char *name) } strcpy(dev->name, name); - strcpy(dev->sysfs_path, nrec->sysfs_path); + strcpy(dev->sysfs_dev_path, nrec->sysfs_dev_path); strcpy(dev->class_dev_name, nrec->class_dev_name); strcpy(dev->class_name, nrec->class_name); strcpy(dev->bus_name, nrec->bus); @@ -506,6 +595,27 @@ struct udevice *udevdb_get_udevice_by_class(const char *cls, return dev; } + +char *udevdb_get_udevice_by_sysfs(const char *path) +{ + struct sysfsdb_record *crec = NULL; +// struct udevice *dev = NULL; + + if (path == NULL) + return NULL; + + crec = sysfsdb_fetch(path); + if (crec == NULL) + return NULL; + + // FIXME leak!!! + return crec->name; +// dev = udevdb_get_udevice(crec->name); +// free(crec); +// +// return dev; +} + /** * udevdb_exit: closes database */ diff --git a/udevdb.h b/udevdb.h index 089af2972b..8e72eded02 100644 --- a/udevdb.h +++ b/udevdb.h @@ -16,7 +16,7 @@ struct udevice { char name[NAME_SIZE]; - char sysfs_path[PATH_SIZE]; + char sysfs_dev_path[PATH_SIZE]; char class_dev_name[NAME_SIZE]; char class_name[NAME_SIZE]; char bus_id[NAME_SIZE]; @@ -32,11 +32,12 @@ struct udevice { extern void udevdb_exit(void); extern int udevdb_init(int init_flag); extern int udevdb_delete_udevice(const char *name); -extern int udevdb_add_udevice(const struct udevice *dev); +extern int udevdb_add_device(const char *device, const struct sysfs_class_device *class_dev, const char *name, char type, int major, int minor, int mode); extern struct udevice *udevdb_get_udevice(const char *name); extern struct udevice *udevdb_get_udevice_by_bus(const char *bus, const char *id); extern struct udevice *udevdb_get_udevice_by_class(const char *cls, const char *cls_dev); +extern char *udevdb_get_udevice_by_sysfs(const char *path); #endif /* _UDEVDB_H_ */ -- cgit v1.2.3-54-g00ecf From 45dbc61ebe869c8f6da744e05353aa5316fe9b30 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 23:33:28 -0700 Subject: [PATCH] change the version to 003-bk to keep things sane with people using the bk tree. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 493cd08450..5cefb12ebf 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 003 +VERSION = 003-bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) -- cgit v1.2.3-54-g00ecf From bbab56baedd3e2f75d8a606d97d54c7a4d01d454 Mon Sep 17 00:00:00 2001 From: "rml@tech9.net" Date: Fri, 17 Oct 2003 23:34:19 -0700 Subject: [PATCH] udev spec file bits Some spec file changes. Primarily, this makes the thing build without a build root if so desired (i.e. build right out of /usr/src/redhat and the standard file system). It should still build from a build root, too. Also: - Add some Prereqs - Pass RPM_OPT_FLAGS to make so we build with the RPM build policy (i.e., optimizations, architecture, etc.) - Specify the exact files in %files to make sure we install everything properly and avoid a warning --- udev.spec | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/udev.spec b/udev.spec index 07b608ed6d..1bfaabaf86 100644 --- a/udev.spec +++ b/udev.spec @@ -8,29 +8,41 @@ Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.t ExclusiveOS: Linux Vendor: Greg Kroah-Hartman BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root +Prereq: /bin/sh, fileutils, hotplug %description udev is a implementation of devfs in userspace using sysfs and /sbin/hotplug. It requires a 2.6 kernel to run properly. %prep -%setup +%setup -q %build -make +make CC="gcc $RPM_OPT_FLAGS" %install make prefix=$RPM_BUILD_ROOT install %clean -rm -fr $RPM_BUILD_ROOT +rm -rf $RPM_BUILD_ROOT %files -%defattr(-,root,root) -%attr(755,root,root)/sbin/%{name} -%attr(-,root,root) %doc COPYING README TODO ChangeLog +%defattr(0644,root,root) +%doc COPYING README TODO ChangeLog +%attr(755,root,root) /sbin/udev +%attr(755,root,root) /udev/ +%attr(755,root,root) /etc/udev/ +%attr(0644,root,root) /etc/udev/namedev.config +%attr(0644,root,root) /etc/udev/namedev.permissions +%attr(0644,root,root) %{_mandir}/man8/udev.8* %changelog +* Fri Oct 17 2003 Robert Love +- Make work without a build root +- Correctly install the right files +- Pass the RPM_OPT_FLAGS to gcc so we can build per the build policy +- Put some prereqs in + * Mon Jul 28 2003 Paul Mundt - Initial spec file for udev-0.2. -- cgit v1.2.3-54-g00ecf From 410e08dd08166c0745e30768fe1a1cdbe5180720 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 23:39:26 -0700 Subject: [PATCH] ok, rpm likes the "_" character instead of "-" better... --- Makefile | 2 +- udev.spec | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5cefb12ebf..535e5b9293 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 003-bk +VERSION = 003_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 1bfaabaf86..affa7ea867 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 003 +Version: 003_bk Release: 1 License: GPL Group: Utilities/System @@ -32,6 +32,7 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /sbin/udev %attr(755,root,root) /udev/ %attr(755,root,root) /etc/udev/ +#%attr(755,root,root) /etc/hotplug.d/default/udev.hotplug %attr(0644,root,root) /etc/udev/namedev.config %attr(0644,root,root) /etc/udev/namedev.permissions %attr(0644,root,root) %{_mandir}/man8/udev.8* -- cgit v1.2.3-54-g00ecf From 577aade748378e9b01d50d6ceb93c9c949d24228 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 17 Oct 2003 23:54:07 -0700 Subject: [PATCH] test.block changes. --- test.block | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test.block b/test.block index 3e198fe4b6..f12c6f735c 100644 --- a/test.block +++ b/test.block @@ -4,7 +4,7 @@ export ACTION=add export DEVPATH=/block/hda export DEVPATH=/block/sda/sda1 -export DEVPATH=/block/sda +#export DEVPATH=/block/sda ./udev block -- cgit v1.2.3-54-g00ecf From 5892ceb540405861e51db3832d4f5cbab123056f Mon Sep 17 00:00:00 2001 From: "rml@mvista.com" Date: Fri, 17 Oct 2003 23:54:14 -0700 Subject: [PATCH] udev: cool test scripts This patch changes test.tty and test.block to add/remove each tty and block device, respectively, on the system. Great way to populate/unpopulate udev rapidly. Its just a simple for loop over the sysfs entries. --- test.block | 18 ++++++++++-------- test.tty | 18 ++++++++++-------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/test.block b/test.block index f12c6f735c..f6011a2221 100644 --- a/test.block +++ b/test.block @@ -1,10 +1,12 @@ -#!/bin/sh -export ACTION=add -#export ACTION=remove +#! /bin/sh +# +# test.block - run udev(8) on each block device in /sys/block -export DEVPATH=/block/hda -export DEVPATH=/block/sda/sda1 -#export DEVPATH=/block/sda +SYSFSDIR=/sys # change this for a nonstand sysfs mount point +BIN=./udev # location of your udev binary +export ACTION=add # 'add' or 'remove' - -./udev block +for i in ${SYSFSDIR}/block/*; do + export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + $BIN block +done diff --git a/test.tty b/test.tty index 2d64f07d3e..ec8b1d0404 100644 --- a/test.tty +++ b/test.tty @@ -1,10 +1,12 @@ -#!/bin/sh -export ACTION=add -#export ACTION=remove -export DEVPATH=/devices/pci0/00:09.0/usb1/1-1/1-1.1/ttyUSB7 -export DEVPATH=/class/tty/ttyUSB0 -#export DEVPATH=/block/hda +#! /bin/sh +# +# test.tty - run udev(8) on each tty device in /sys/class/tty +SYSFSDIR=/sys # change this for a nonstand sysfs mount point +BIN=./udev # location of your udev binary +export ACTION=add # 'add' or 'remove' -#./udev block -./udev tty +for i in ${SYSFSDIR}/class/tty/*; do + export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + $BIN tty +done -- cgit v1.2.3-54-g00ecf From 88449f27e7870cfb713e4a7c2dde90b5032cb402 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 18 Oct 2003 00:11:13 -0700 Subject: [PATCH] spec file changes. --- udev.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/udev.spec b/udev.spec index affa7ea867..ffb643c57a 100644 --- a/udev.spec +++ b/udev.spec @@ -32,7 +32,6 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /sbin/udev %attr(755,root,root) /udev/ %attr(755,root,root) /etc/udev/ -#%attr(755,root,root) /etc/hotplug.d/default/udev.hotplug %attr(0644,root,root) /etc/udev/namedev.config %attr(0644,root,root) /etc/udev/namedev.permissions %attr(0644,root,root) %{_mandir}/man8/udev.8* -- cgit v1.2.3-54-g00ecf From 8634e6d111730b6c95a8b846ddbadafb147b4a34 Mon Sep 17 00:00:00 2001 From: "rml@tech9.net" Date: Sat, 18 Oct 2003 00:12:16 -0700 Subject: [PATCH] udev spec file symlink support > Hm, I would also like to add the /etc/hotplug.d/default/udev.hotplug > symlink, but rpm doesn't seem to like symlinks in the %files section. > Anyone know how to do this properly? The problem is that the symlink is left dangling to an absolute location in the build root, which won't exist on the installer's system. RPM 4.0 and on catches this. Attached patch fixes it up and makes it work. --- udev.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udev.spec b/udev.spec index ffb643c57a..59b06a0d16 100644 --- a/udev.spec +++ b/udev.spec @@ -22,6 +22,8 @@ make CC="gcc $RPM_OPT_FLAGS" %install make prefix=$RPM_BUILD_ROOT install +rm -f ${RPM_BUILD_ROOT}/etc/hotplug.d/default/udev.hotplug +ln -s /sbin/udev ${RPM_BUILD_ROOT}/etc/hotplug.d/default/udev.hotplug %clean rm -rf $RPM_BUILD_ROOT @@ -34,6 +36,7 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/udev/ %attr(0644,root,root) /etc/udev/namedev.config %attr(0644,root,root) /etc/udev/namedev.permissions +%attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(0644,root,root) %{_mandir}/man8/udev.8* %changelog @@ -42,6 +45,7 @@ rm -rf $RPM_BUILD_ROOT - Correctly install the right files - Pass the RPM_OPT_FLAGS to gcc so we can build per the build policy - Put some prereqs in +- Install the hotplug symlink to udev * Mon Jul 28 2003 Paul Mundt - Initial spec file for udev-0.2. -- cgit v1.2.3-54-g00ecf From fd14ee04ef9834516cd3b6ae4d07a3e4156e232e Mon Sep 17 00:00:00 2001 From: "rml@tech9.net" Date: Sat, 18 Oct 2003 01:18:04 -0700 Subject: [PATCH] udev: cool test scripts again > But the test.block script doesn't catch any partitions on the block > devices :) Never happy! [19:07:52]root@phantasy:~/src/udev/udev# ./test.block [19:13:37]root@phantasy:~/src/udev/udev# ls /udev/hd* ls: /udev/hd*: No such file or directory [19:13:42]root@phantasy:~/src/udev/udev# ./test.block [19:13:53]root@phantasy:~/src/udev/udev# ls /udev/hd* /udev/hda /udev/hda2 /udev/hda4 /udev/hda6 /udev/hdd /udev/hda1 /udev/hda3 /udev/hda5 /udev/hdc test.block now recurses /sys/block, looking for partitions. Should add all drives and all partitions. --- test.block | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test.block b/test.block index f6011a2221..781560dee1 100644 --- a/test.block +++ b/test.block @@ -7,6 +7,16 @@ BIN=./udev # location of your udev binary export ACTION=add # 'add' or 'remove' for i in ${SYSFSDIR}/block/*; do + # add each drive export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` $BIN block + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH="/"`echo $j | \ + cut --delimiter='/' --fields=3-` + $BIN block + fi + done done -- cgit v1.2.3-54-g00ecf From d7e954a4ef664cd65fbb34cb23ca57dc1bb89ea0 Mon Sep 17 00:00:00 2001 From: "rml@tech9.net" Date: Sun, 19 Oct 2003 21:55:43 -0700 Subject: [PATCH] udev: trivial trivialities Yah yah, really trivial stuff... - get_class_device() doesn't need to be exported; it should be static - white space cleanup --- udev-add.c | 2 +- udevdb.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/udev-add.c b/udev-add.c index 116ab2b448..05f2aa3e9d 100644 --- a/udev-add.c +++ b/udev-add.c @@ -101,7 +101,7 @@ static int create_node(char *name, char type, int major, int minor, int mode) return retval; } -struct sysfs_class_device *get_class_dev(char *device_name) +static struct sysfs_class_device *get_class_dev(char *device_name) { char sysfs_path[SYSFS_PATH_MAX]; char dev_path[SYSFS_PATH_MAX]; diff --git a/udevdb.c b/udevdb.c index 05bd72a5d9..fa26de46d5 100644 --- a/udevdb.c +++ b/udevdb.c @@ -130,13 +130,13 @@ static struct busdb_record *busdb_fetch(const char *bus, const char *id) data = tdb_fetch(udevdb, key); if (data.dptr == NULL || data.dsize == 0) return NULL; - + rec = (struct busdb_record *)malloc(sizeof(struct busdb_record)); if (rec == NULL) { free(data.dptr); return NULL; } - + memcpy(rec, data.dptr, sizeof(struct busdb_record)); free(data.dptr); -- cgit v1.2.3-54-g00ecf From c2405f502cae4a634a25674306cffefb85df9ebb Mon Sep 17 00:00:00 2001 From: "rml@tech9.net" Date: Sun, 19 Oct 2003 21:56:21 -0700 Subject: [PATCH] udev: mode should be mode_t Unix file modes should be stored in a mode_t, not a standard type. At the moment it is actually unsigned, in fact, not a signed integer. Attached patch does an s/int mode/mode_t mode/ and cleans up the results. --- namedev.c | 12 +++++++----- udev-add.c | 4 ++-- udev.h | 2 +- udevdb.c | 2 +- udevdb.h | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/namedev.c b/namedev.c index 6f69959346..ac05fd88e4 100644 --- a/namedev.c +++ b/namedev.c @@ -446,7 +446,8 @@ static int namedev_init_permissions(void) dev.attr.mode = strtol(temp, NULL, 8); dbg_parse("name = %s, owner = %s, group = %s, mode = %#o", - dev.attr.name, dev.attr.owner, dev.attr.group, dev.attr.mode); + dev.attr.name, dev.attr.owner, dev.attr.group, + dev.attr.mode); retval = add_dev(&dev); if (retval) { dbg("add_dev returned with error %d", retval); @@ -459,7 +460,7 @@ exit: return retval; } -static int get_default_mode(struct sysfs_class_device *class_dev) +static mode_t get_default_mode(struct sysfs_class_device *class_dev) { /* just default everyone to rw for the world! */ return 0666; @@ -544,7 +545,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at int retval = 0; int found; - attr->mode = -1; + attr->mode = 0; if (class_dev->sysdevice) { dbg_parse("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path); dbg_parse("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); @@ -751,9 +752,10 @@ label_found: } } strcpy(attr->name, class_dev->name); - + done: - if (attr->mode == -1) { + /* mode was never set above */ + if (!attr->mode) { attr->mode = get_default_mode(class_dev); attr->owner[0] = 0x00; attr->group[0] = 0x00; diff --git a/udev-add.c b/udev-add.c index 05f2aa3e9d..d158c41b1d 100644 --- a/udev-add.c +++ b/udev-add.c @@ -71,7 +71,7 @@ exit: /* * We also want to add some permissions here, and possibly some symlinks */ -static int create_node(char *name, char type, int major, int minor, int mode) +static int create_node(char *name, char type, int major, int minor, mode_t mode) { char filename[255]; int retval = 0; @@ -94,7 +94,7 @@ static int create_node(char *name, char type, int major, int minor, int mode) } dbg("mknod(%s, %#o, %u, %u)", filename, mode, major, minor); - retval = mknod(filename,mode,makedev(major,minor)); + retval = mknod(filename, mode, makedev(major, minor)); if (retval) dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", filename, mode, major, minor, strerror(errno)); diff --git a/udev.h b/udev.h index 33cb89af55..af575c2b17 100644 --- a/udev.h +++ b/udev.h @@ -59,7 +59,7 @@ struct device_attr { char name[NAME_SIZE]; char owner[OWNER_SIZE]; char group[GROUP_SIZE]; - int mode; + mode_t mode; }; extern int udev_add_device(char *device, char *subsystem); diff --git a/udevdb.c b/udevdb.c index fa26de46d5..678ddd9603 100644 --- a/udevdb.c +++ b/udevdb.c @@ -73,7 +73,7 @@ struct namedb_record { char type; int major; int minor; - int mode; + mode_t mode; }; /** diff --git a/udevdb.h b/udevdb.h index 8e72eded02..656613b593 100644 --- a/udevdb.h +++ b/udevdb.h @@ -25,7 +25,7 @@ struct udevice { char type; int major; int minor; - int mode; + mode_t mode; }; /* Function Prototypes */ -- cgit v1.2.3-54-g00ecf From d3db5e5e405b81ae094a5b0fab53d37b2356514c Mon Sep 17 00:00:00 2001 From: "lkml001@vrfy.org" Date: Sun, 19 Oct 2003 21:59:45 -0700 Subject: [PATCH] man page update --- udev.8 | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/udev.8 b/udev.8 index e44855ba16..771ecfa454 100644 --- a/udev.8 +++ b/udev.8 @@ -1,11 +1,67 @@ -.TH UDEV 8 "October 2003" "" "Linux Programmer's Manual" +.TH UDEV 8 "October 2003" "" "Linux Administrator's Manual" .SH NAME -udev \- Linux dynamic device naming support +udev \- Linux configurable dynamic device naming support .SH SYNOPSIS .B udev .SH "DESCRIPTION" .B udev -is a wonderful program whose man page has not been written yet. +creates or removes device node files usually located in the /dev directory. +As part of the +.B hotplug +subsystem, +.B udev +is exectuted if a kernel device is added or removed from the system. +.P +On device creation, +.B udev +reads the sysfs directory of the given device, to collect device attributes +like label, serial number or bus device number. +These attributes are passed as a key to the namedev subsystem +to receive a unique name for device file creation. +namedev maintains a database for devices present on the system. +.P +On device removal, +.B udev +queries the namedev database for the name of the device file to delete. +.P +namedev expects its configuration at +.I /etc/udev/namedev.config. +The file consists of a set of lines. All empty lines and +lines beginning with a '#' will be ignored. +.br +Every line defines the mapping between device attributes and the name of +the device file. It starts with a keyword defining the method for +overriding the default kernel naming scheme, followed by a list +of keys and ends with the definition of the filename for the device. +.TP +.B LABEL +device label or serial number, like USB serial number, SCSI UUID or +file system label +.TP +.B NUMBER +device number on the bus, like PCI bus id +.TP +.B TOPOLOGY +device position on bus, like physical port of USB device +.TP +.B REPLACE +string replacement of the kernel device name +.P +If no matching configuration is found, the default kernel device name is used. +.SH "EXAMPLE" +.nf +# USB printer to be called lp_color +LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_color" + +# sound card with PCI bus id 00:0b.0 to be called dsp +NUMBER, BUS="pci", id="00:0b.0", NAME="dsp" + +# USB mouse at third port of the second hub to be called mouse1 +TOPOLOGY, BUS="usb", place="2.3", NAME="mouse1" + +# ttyUSB1 should always be called pda +REPLACE, KERNEL="ttyUSB1", NAME="pda" +.fi .SH "FILES" .nf .ft B @@ -16,7 +72,7 @@ is a wonderful program whose man page has not been written yet. .fi .LP .SH "SEE ALSO" -.BR hotplug "(8)" +.B hotplug (8) .PP The .I http://linux-hotplug.sourceforge.net/ -- cgit v1.2.3-54-g00ecf From 05fdfe68e2a628ceabf41f32300bf9f7578a29c5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 20 Oct 2003 17:58:23 -0700 Subject: [PATCH] add BUS= bug to TODO list so it will not get forgotten. Thanks to reg@dwf.com for pointing this out to me. --- TODO | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TODO b/TODO index 89fe6679d4..3c1581705b 100644 --- a/TODO +++ b/TODO @@ -29,3 +29,8 @@ greg@kroah.com etc.) - add hooks to call D-BUS when new node is created or removed - lots of other stuff... +- actually use the BUS= value to determine where the LABEL rule should look + (right now it's ignored, and we only look in the current sysfs directory.) + This is needed, for example, to look at the usb device's serial number of a + usb-storage device, instead of the scsi device's sysfs directory for the + serial number. -- cgit v1.2.3-54-g00ecf From a9ce0a410e7ef573f2f1f48ea793829d3cec389f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 20 Oct 2003 20:28:42 -0700 Subject: [PATCH] more database work. Now we only store the info we really need right now. Also delete the record after the device is gone, and fix up a memory leak. --- udev-remove.c | 17 ++-- udevdb.c | 305 ++++++---------------------------------------------------- udevdb.h | 7 +- 3 files changed, 40 insertions(+), 289 deletions(-) diff --git a/udev-remove.c b/udev-remove.c index 9862a6f201..430f1c901e 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -36,27 +36,25 @@ /* - * Here would go a call to the naming deamon, to get the name we want to have - * for this device. But for now, let's just default to whatever the kernel is - * calling the device as that will keep the "old-style" naming policy + * Look up the sysfs path in the database to see if we have named this device + * something different from the kernel name. If we have, us it. If not, use + * the default kernel name for lack of anything else to know to do. */ static char *get_name(char *dev, int major, int minor) { static char name[100]; char *temp; - temp = udevdb_get_udevice_by_sysfs(dev); - dbg("udevdb_get_udevice_by_sysfs returned %s", temp); - if (temp != NULL) - return temp; - + if (udevdb_get_dev(dev, &name[0], sizeof(name)) == 0) + goto exit; + temp = strrchr(dev, '/'); if (temp == NULL) return NULL; strncpy(name, &temp[1], sizeof(name)); +exit: dbg("name is %s", name); - return &name[0]; } @@ -87,6 +85,7 @@ int udev_remove_device(char *device, char *subsystem) } udevdb_delete_udevice(name); + udevdb_delete_dev(device); return delete_node(name); diff --git a/udevdb.c b/udevdb.c index 678ddd9603..e4330f5320 100644 --- a/udevdb.c +++ b/udevdb.c @@ -41,21 +41,6 @@ static TDB_CONTEXT *udevdb; -/** - * busdb_record - bus and id are keys to look up name of device - */ -struct busdb_record { - char name[NAME_SIZE]; -}; - -/** - * classdb_record - class name and class device name used as keys to find - * device name. - */ -struct classdb_record { - char name[NAME_SIZE]; -}; - struct sysfsdb_record { char name[PATH_SIZE]; }; @@ -67,9 +52,7 @@ struct namedb_record { char sysfs_dev_path[PATH_SIZE]; char class_dev_name[NAME_SIZE]; char class_name[NAME_SIZE]; - char bus[BUS_SIZE]; char id[ID_SIZE]; - char driver[NAME_SIZE]; char type; int major; int minor; @@ -105,83 +88,6 @@ static int udevdb_open(int method) return 0; } -/** - * busdb_fetch - */ -static struct busdb_record *busdb_fetch(const char *bus, const char *id) -{ - TDB_DATA key, data; - char keystr[BUS_SIZE+ID_SIZE+2]; - struct busdb_record *rec = NULL; - - if (bus == NULL || id == NULL) - return NULL; - if (strlen(bus) >= BUS_SIZE || strlen(id) >= ID_SIZE) - return NULL; - - memset(keystr, 0, (BUS_SIZE+ID_SIZE+2)); - strcpy(keystr, bus); - strcat(keystr, UDEVDB_DEL); - strcat(keystr, id); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - data = tdb_fetch(udevdb, key); - if (data.dptr == NULL || data.dsize == 0) - return NULL; - - rec = (struct busdb_record *)malloc(sizeof(struct busdb_record)); - if (rec == NULL) { - free(data.dptr); - return NULL; - } - - memcpy(rec, data.dptr, sizeof(struct busdb_record)); - free(data.dptr); - - return rec; -} - -/** - * classdb_fetch - */ -static struct classdb_record *classdb_fetch(const char *cls, - const char *cls_dev) -{ - TDB_DATA key, data; - char keystr[NAME_SIZE+NAME_SIZE+2]; - struct classdb_record *rec = NULL; - - if (cls == NULL || cls_dev == NULL) - return NULL; - if (strlen(cls) >= NAME_SIZE || strlen(cls_dev) >= NAME_SIZE) - return NULL; - - memset(keystr, 0, (NAME_SIZE+NAME_SIZE+2)); - strcpy(keystr, cls); - strcat(keystr, UDEVDB_DEL); - strcat(keystr, cls_dev); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - data = tdb_fetch(udevdb, key); - if (data.dptr == NULL || data.dsize == 0) - return NULL; - - rec = (struct classdb_record *)malloc(sizeof(struct classdb_record)); - if (rec == NULL) { - free(data.dptr); - return NULL; - } - - memcpy(rec, data.dptr, sizeof(struct classdb_record)); - free(data.dptr); - - return rec; -} - static struct sysfsdb_record *sysfsdb_fetch(const char *path) { TDB_DATA key, data; @@ -253,66 +159,6 @@ static struct namedb_record *namedb_fetch(const char *name) return nrec; } -/** - * busdb_store - */ -static int busdb_store(const struct udevice *dev) -{ - TDB_DATA key, data; - char keystr[BUS_SIZE+ID_SIZE+2]; - struct busdb_record rec; - int retval = 0; - - if (dev == NULL) - return -1; - - memset(keystr, 0, (BUS_SIZE+ID_SIZE+2)); - strcpy(keystr, dev->bus_name); - strcat(keystr, UDEVDB_DEL); - strcat(keystr, dev->bus_id); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - strcpy(rec.name, dev->name); - - data.dptr = (void *) &rec; - data.dsize = sizeof(rec); - - retval = tdb_store(udevdb, key, data, TDB_REPLACE); - return retval; -} - -/** - * classdb_store - */ -static int classdb_store(const struct udevice *dev) -{ - TDB_DATA key, data; - char keystr[NAME_SIZE+NAME_SIZE+2]; - struct classdb_record rec; - int retval = 0; - - if (dev == NULL) - return -1; - - memset(keystr, 0, (NAME_SIZE+NAME_SIZE+2)); - strcpy(keystr, dev->class_name); - strcat(keystr, UDEVDB_DEL); - strcat(keystr, dev->class_dev_name); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - strcpy(rec.name, dev->name); - - data.dptr = (void *) &rec; - data.dsize = sizeof(rec); - - retval = tdb_store(udevdb, key, data, TDB_REPLACE); - return retval; -} - static int sysfs_store(const char *path, const struct udevice *dev) { TDB_DATA key, data; @@ -325,7 +171,6 @@ static int sysfs_store(const char *path, const struct udevice *dev) memset(keystr, 0, sizeof(keystr)); strcpy(keystr, path); - dbg("keystr = %s", keystr); key.dptr = (void *)keystr; key.dsize = strlen(keystr) + 1; @@ -359,11 +204,9 @@ static int namedb_store(const struct udevice *dev) key.dsize = strlen(keystr) + 1; strcpy(rec.sysfs_dev_path, dev->sysfs_dev_path); - strcpy(rec.bus, dev->bus_name); strcpy(rec.id, dev->bus_id); strcpy(rec.class_dev_name, dev->class_dev_name); strcpy(rec.class_name, dev->class_name); - strcpy(rec.driver, dev->driver); rec.type = dev->type; rec.major = dev->major; rec.minor = dev->minor; @@ -376,58 +219,6 @@ static int namedb_store(const struct udevice *dev) return retval; } -/** - * busdb_delete - */ -static int busdb_delete(const char *bus, const char *id) -{ - TDB_DATA key; - char keystr[BUS_SIZE+ID_SIZE+2]; - int retval = 0; - - if (bus == NULL || id == NULL) - return -1; - if (strlen(bus) >= BUS_SIZE || strlen(id) >= ID_SIZE) - return -1; - - memset(keystr, 0, (BUS_SIZE+ID_SIZE+2)); - strcpy(keystr, bus); - strcat(keystr, UDEVDB_DEL); - strcat(keystr, id); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - retval = tdb_delete(udevdb, key); - return retval; -} - -/** - * classdb_delete - */ -static int classdb_delete(const char *cls, const char *cls_dev) -{ - TDB_DATA key; - char keystr[NAME_SIZE+NAME_SIZE+2]; - int retval = 0; - - if (cls == NULL || cls_dev == NULL) - return -1; - if (strlen(cls) >= NAME_SIZE || strlen(cls_dev) >= NAME_SIZE) - return -1; - - memset(keystr, 0, (NAME_SIZE+NAME_SIZE+2)); - strcpy(keystr, cls); - strcat(keystr, UDEVDB_DEL); - strcat(keystr, cls_dev); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - retval = tdb_delete(udevdb, key); - return retval; -} - /** * namedb_delete */ @@ -452,6 +243,20 @@ static int namedb_delete(const char *name) return retval; } +static int sysfs_delete(const char *path) +{ + TDB_DATA key; + char keystr[PATH_SIZE]; + + memset(keystr, 0, sizeof(keystr)); + strcpy(keystr, path); + + key.dptr = keystr; + key.dsize = strlen(keystr) + 1; + + return tdb_delete(udevdb, key); +} + /** * udevdb_delete_udevice */ @@ -466,8 +271,6 @@ int udevdb_delete_udevice(const char *name) if (nrec == NULL) return -1; - busdb_delete(nrec->bus, nrec->id); - classdb_delete(nrec->class_name, nrec->class_dev_name); namedb_delete(name); free(nrec); @@ -493,24 +296,15 @@ int udevdb_add_device(const char *device, const struct sysfs_class_device *class strncpy(dbdev.class_dev_name, class_dev->name, NAME_SIZE); // if ((sysfs_get_name_from_path(subsystem, dbdev.class_name, NAME_SIZE)) != 0) // strcpy(dbdev.class_name, "unknown"); - strcpy(dbdev.bus_name, "unknown"); - if (class_dev->driver != NULL) - strncpy(dbdev.driver, class_dev->driver->name, NAME_SIZE); - else - strcpy(dbdev.driver, "unknown"); dbdev.type = type; dbdev.major = major; dbdev.minor = minor; dbdev.mode = mode; - if ((busdb_store(&dbdev)) != 0) - return -1; - if ((classdb_store(&dbdev)) != 0) - return -1; if ((sysfs_store(device, &dbdev)) != 0) return -1; - if ((namedb_store(&dbdev)) != 0) - return -1; +// if ((namedb_store(&dbdev)) != 0) +// return -1; return 0; } @@ -540,7 +334,6 @@ struct udevice *udevdb_get_udevice(const char *name) strcpy(dev->sysfs_dev_path, nrec->sysfs_dev_path); strcpy(dev->class_dev_name, nrec->class_dev_name); strcpy(dev->class_name, nrec->class_name); - strcpy(dev->bus_name, nrec->bus); strcpy(dev->bus_id, nrec->id); dev->type = nrec->type; dev->major = nrec->major; @@ -552,68 +345,30 @@ struct udevice *udevdb_get_udevice(const char *name) return dev; } -/** - * udevdb_get_device_by_bus - */ -struct udevice *udevdb_get_udevice_by_bus(const char *bus, const char *id) +int udevdb_get_dev(const char *path, char *name, size_t name_size) { - struct busdb_record *brec = NULL; - struct udevice *dev = NULL; - - if (bus == NULL || id == NULL) - return NULL; - - brec = busdb_fetch(bus, id); - if (brec == NULL) - return NULL; - - dev = udevdb_get_udevice(brec->name); - free(brec); - - return dev; -} - -/** - * udevdb_get_udevice_by_class - */ -struct udevice *udevdb_get_udevice_by_class(const char *cls, - const char *cls_dev) -{ - struct classdb_record *crec = NULL; - struct udevice *dev = NULL; + struct sysfsdb_record *rec = NULL; - if (cls == NULL || cls_dev == NULL) - return NULL; + if ((path == NULL) || (name == NULL) || (name_size < 1)) + return -EINVAL; - crec = classdb_fetch(cls, cls_dev); - if (crec == NULL) - return NULL; + rec = sysfsdb_fetch(path); + if (rec == NULL) + return -ENODEV; - dev = udevdb_get_udevice(crec->name); - free(crec); + if (strlen(rec->name) >= name_size) + return -EINVAL; - return dev; + strncpy(name, rec->name, name_size); + return 0; } - -char *udevdb_get_udevice_by_sysfs(const char *path) +int udevdb_delete_dev(const char *path) { - struct sysfsdb_record *crec = NULL; -// struct udevice *dev = NULL; - if (path == NULL) - return NULL; - - crec = sysfsdb_fetch(path); - if (crec == NULL) - return NULL; + return -EINVAL; - // FIXME leak!!! - return crec->name; -// dev = udevdb_get_udevice(crec->name); -// free(crec); -// -// return dev; + return sysfs_delete(path); } /** diff --git a/udevdb.h b/udevdb.h index 656613b593..57a27bc17f 100644 --- a/udevdb.h +++ b/udevdb.h @@ -21,7 +21,6 @@ struct udevice { char class_name[NAME_SIZE]; char bus_id[NAME_SIZE]; char bus_name[NAME_SIZE]; - char driver[NAME_SIZE]; char type; int major; int minor; @@ -34,10 +33,8 @@ extern int udevdb_init(int init_flag); extern int udevdb_delete_udevice(const char *name); extern int udevdb_add_device(const char *device, const struct sysfs_class_device *class_dev, const char *name, char type, int major, int minor, int mode); extern struct udevice *udevdb_get_udevice(const char *name); -extern struct udevice *udevdb_get_udevice_by_bus(const char *bus, - const char *id); -extern struct udevice *udevdb_get_udevice_by_class(const char *cls, - const char *cls_dev); extern char *udevdb_get_udevice_by_sysfs(const char *path); +extern int udevdb_get_dev(const char *path, char *name, size_t name_size); +extern int udevdb_delete_dev(const char *path); #endif /* _UDEVDB_H_ */ -- cgit v1.2.3-54-g00ecf From 727d1ba5bee517fb8df940b31280a13035552386 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 20 Oct 2003 20:31:24 -0700 Subject: [PATCH] fix comment about how the "dev" file is made up. --- udev-add.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/udev-add.c b/udev-add.c index d158c41b1d..aa93a0c018 100644 --- a/udev-add.c +++ b/udev-add.c @@ -39,12 +39,10 @@ * Right now the major/minor of a device is stored in a file called * "dev" in sysfs. * The number is stored as: - * MMmm + * MM:mm * MM is the major * mm is the minor - * The value is in hex. - * Yes, this will probably change when we go to a bigger major/minor - * range, and will have to be changed at that time. + * The value is in decimal. */ static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor) { -- cgit v1.2.3-54-g00ecf From 29fd7e679beba83a9c79df82374b5e51453a3831 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 20 Oct 2003 21:03:15 -0700 Subject: [PATCH] don't sleep if 'dev' file is already present on device add. instead sleep for up to 10 seconds waiting for it to show up. --- udev-add.c | 57 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/udev-add.c b/udev-add.c index aa93a0c018..85bcbf6c18 100644 --- a/udev-add.c +++ b/udev-add.c @@ -34,6 +34,7 @@ #include "udevdb.h" #include "libsysfs/libsysfs.h" +static char sysfs_path[SYSFS_PATH_MAX]; /* * Right now the major/minor of a device is stored in a file called @@ -101,19 +102,9 @@ static int create_node(char *name, char type, int major, int minor, mode_t mode) static struct sysfs_class_device *get_class_dev(char *device_name) { - char sysfs_path[SYSFS_PATH_MAX]; char dev_path[SYSFS_PATH_MAX]; - int retval; struct sysfs_class_device *class_dev = NULL; - - retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); - dbg("sysfs_path = %s", sysfs_path); - if (retval) { - dbg("sysfs_get_mnt_path failed"); - goto exit; - } - strcpy(dev_path, sysfs_path); strcat(dev_path, device_name); @@ -131,6 +122,38 @@ exit: return class_dev; } +/* wait for the "dev" file to show up in the directory in sysfs. + * If it doesn't happen in about 10 seconds, give up. + */ +#define SECONDS_TO_WAIT_FOR_DEV 10 +int sleep_for_dev(char *device) +{ + char filename[SYSFS_PATH_MAX + 6]; + struct stat buf; + int loop = 0; + int retval = -ENODEV; + + strcpy(filename, sysfs_path); + strcat(filename, device); + strcat(filename, "/dev"); + + while (loop < SECONDS_TO_WAIT_FOR_DEV) { + dbg("looking for %s", filename); + retval = stat(filename, &buf); + if (retval == 0) { + retval = 0; + goto exit; + } + + /* sleep for a second or two to give the kernel a chance to + * create the dev file */ + sleep(1); + } + retval = -ENODEV; +exit: + return retval; +} + int udev_add_device(char *device, char *subsystem) { struct sysfs_class_device *class_dev; @@ -146,10 +169,16 @@ int udev_add_device(char *device, char *subsystem) else type = 'c'; - /* sleep for a second or two to give the kernel a chance to - * create the dev file - */ - sleep(1); + retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); + dbg("sysfs_path = %s", sysfs_path); + if (retval) { + dbg("sysfs_get_mnt_path failed"); + goto exit; + } + + retval = sleep_for_dev(device); + if (retval) + goto exit; class_dev = get_class_dev(device); if (class_dev == NULL) -- cgit v1.2.3-54-g00ecf From c8c47999ff59b0235b217fbab4cba0c86b0fd075 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 20 Oct 2003 22:45:46 -0700 Subject: [PATCH] Changed test.block and test.tty to take ACTION from the command line. --- test.block | 10 +++++++++- test.tty | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/test.block b/test.block index 781560dee1..622a66037f 100644 --- a/test.block +++ b/test.block @@ -2,9 +2,17 @@ # # test.block - run udev(8) on each block device in /sys/block +if [ $# = "0" ] ; then + echo + echo "usage: $0 " + echo "where is \"add\" or \"remove\"" + echo + exit 1 +fi + SYSFSDIR=/sys # change this for a nonstand sysfs mount point BIN=./udev # location of your udev binary -export ACTION=add # 'add' or 'remove' +export ACTION=$1 # 'add' or 'remove' for i in ${SYSFSDIR}/block/*; do # add each drive diff --git a/test.tty b/test.tty index ec8b1d0404..d5e2d6715d 100644 --- a/test.tty +++ b/test.tty @@ -2,9 +2,17 @@ # # test.tty - run udev(8) on each tty device in /sys/class/tty +if [ $# = "0" ] ; then + echo + echo "usage: $0 " + echo "where is \"add\" or \"remove\"" + echo + exit 1 +fi + SYSFSDIR=/sys # change this for a nonstand sysfs mount point BIN=./udev # location of your udev binary -export ACTION=add # 'add' or 'remove' +export ACTION=$1 # 'add' or 'remove' for i in ${SYSFSDIR}/class/tty/*; do export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` -- cgit v1.2.3-54-g00ecf From 5840bc63e2029d22682d8de77dc8fcc4da1b436c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 20 Oct 2003 22:48:44 -0700 Subject: [PATCH] major database cleanups Now we standardise on a struct udevice to pass around, and store in the database. This cleaned up the database code a lot. --- udev-add.c | 57 +++++----- udev-remove.c | 12 ++- udev.h | 15 ++- udevdb.c | 335 +++++++--------------------------------------------------- udevdb.h | 25 +---- 5 files changed, 96 insertions(+), 348 deletions(-) diff --git a/udev-add.c b/udev-add.c index 85bcbf6c18..7906638a7f 100644 --- a/udev-add.c +++ b/udev-add.c @@ -70,33 +70,37 @@ exit: /* * We also want to add some permissions here, and possibly some symlinks */ -static int create_node(char *name, char type, int major, int minor, mode_t mode) +static int create_node(struct udevice *dev) { char filename[255]; int retval = 0; + strncpy(filename, UDEV_ROOT, sizeof(filename)); - strncat(filename, name, sizeof(filename)); - switch (type) { + strncat(filename, dev->name, sizeof(filename)); + + switch (dev->type) { case 'b': - mode |= S_IFBLK; + dev->mode |= S_IFBLK; break; case 'c': case 'u': - mode |= S_IFCHR; + dev->mode |= S_IFCHR; break; case 'p': - mode |= S_IFIFO; + dev->mode |= S_IFIFO; break; default: - dbg("unknown node type %c\n", type); + dbg("unknown node type %c\n", dev->type); return -EINVAL; } - dbg("mknod(%s, %#o, %u, %u)", filename, mode, major, minor); - retval = mknod(filename, mode, makedev(major, minor)); + dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor); + retval = mknod(filename, dev->mode, makedev(dev->major, dev->minor)); if (retval) dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", - filename, mode, major, minor, strerror(errno)); + filename, dev->mode, dev->major, dev->minor, strerror(errno)); + + // FIXME set the ownership of the node return retval; } @@ -126,7 +130,7 @@ exit: * If it doesn't happen in about 10 seconds, give up. */ #define SECONDS_TO_WAIT_FOR_DEV 10 -int sleep_for_dev(char *device) +int sleep_for_dev(char *path) { char filename[SYSFS_PATH_MAX + 6]; struct stat buf; @@ -134,7 +138,7 @@ int sleep_for_dev(char *device) int retval = -ENODEV; strcpy(filename, sysfs_path); - strcat(filename, device); + strcat(filename, path); strcat(filename, "/dev"); while (loop < SECONDS_TO_WAIT_FOR_DEV) { @@ -154,20 +158,18 @@ exit: return retval; } -int udev_add_device(char *device, char *subsystem) +int udev_add_device(char *path, char *subsystem) { struct sysfs_class_device *class_dev; + struct udevice dev; struct device_attr attr; - int major; - int minor; - char type; int retval = -EINVAL; /* for now, the block layer is the only place where block devices are */ if (strcmp(subsystem, "block") == 0) - type = 'b'; + dev.type = 'b'; else - type = 'c'; + dev.type = 'c'; retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); dbg("sysfs_path = %s", sysfs_path); @@ -176,11 +178,11 @@ int udev_add_device(char *device, char *subsystem) goto exit; } - retval = sleep_for_dev(device); + retval = sleep_for_dev(path); if (retval) goto exit; - class_dev = get_class_dev(device); + class_dev = get_class_dev(path); if (class_dev == NULL) goto exit; @@ -188,21 +190,26 @@ int udev_add_device(char *device, char *subsystem) if (retval) return retval; - retval = get_major_minor(class_dev, &major, &minor); + retval = get_major_minor(class_dev, &dev.major, &dev.minor); if (retval) { dbg("get_major_minor failed"); goto exit; } - retval = udevdb_add_device(device, class_dev, attr.name, type, major, minor, attr.mode); - + strcpy(dev.name, attr.name); + strcpy(dev.owner, attr.owner); + strcpy(dev.group, attr.group); + dev.mode = attr.mode; + + retval = udevdb_add_dev(path, &dev); if (retval != 0) - dbg("udevdb_add_device failed, but we are going to try to create the node anyway. " + dbg("udevdb_add_dev failed, but we are going to try to create the node anyway. " "But remove might not work properly for this device."); sysfs_close_class_device(class_dev); - return create_node(attr.name, type, major, minor, attr.mode); + dbg("name = %s", dev.name); + retval = create_node(&dev); exit: return retval; diff --git a/udev-remove.c b/udev-remove.c index 430f1c901e..c61a948fa0 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -40,15 +40,20 @@ * something different from the kernel name. If we have, us it. If not, use * the default kernel name for lack of anything else to know to do. */ -static char *get_name(char *dev, int major, int minor) +static char *get_name(char *path, int major, int minor) { static char name[100]; + struct udevice *dev; char *temp; - if (udevdb_get_dev(dev, &name[0], sizeof(name)) == 0) + dev = udevdb_get_dev(path); + if (dev != NULL) { + strcpy(name, dev->name); goto exit; + } - temp = strrchr(dev, '/'); + dbg("%s not found in database, falling back on default name", path); + temp = strrchr(path, '/'); if (temp == NULL) return NULL; strncpy(name, &temp[1], sizeof(name)); @@ -84,7 +89,6 @@ int udev_remove_device(char *device, char *subsystem) goto exit; } - udevdb_delete_udevice(name); udevdb_delete_dev(device); return delete_node(name); diff --git a/udev.h b/udev.h index af575c2b17..6d7017ff51 100644 --- a/udev.h +++ b/udev.h @@ -23,6 +23,7 @@ #ifndef UDEV_H #define UDEV_H +#include "libsysfs/libsysfs.h" #ifdef DEBUG #include @@ -62,8 +63,18 @@ struct device_attr { mode_t mode; }; -extern int udev_add_device(char *device, char *subsystem); -extern int udev_remove_device(char *device, char *subsystem); +struct udevice { + char name[NAME_SIZE]; + char owner[OWNER_SIZE]; + char group[GROUP_SIZE]; + char type; + int major; + int minor; + mode_t mode; +}; + +extern int udev_add_device(char *path, char *subsystem); +extern int udev_remove_device(char *path, char *subsystem); extern char **main_argv; extern char **main_envp; diff --git a/udevdb.c b/udevdb.c index e4330f5320..b75bf8048f 100644 --- a/udevdb.c +++ b/udevdb.c @@ -41,212 +41,58 @@ static TDB_CONTEXT *udevdb; -struct sysfsdb_record { - char name[PATH_SIZE]; -}; -/** - * namedb_record - device name is key, remaining udevice info stored here. - */ -struct namedb_record { - char sysfs_dev_path[PATH_SIZE]; - char class_dev_name[NAME_SIZE]; - char class_name[NAME_SIZE]; - char id[ID_SIZE]; - char type; - int major; - int minor; - mode_t mode; -}; - -/** - * udevdb_close: close udev database - */ -static void udevdb_close(void) -{ - if (udevdb != NULL) { - tdb_close(udevdb); - udevdb = NULL; - } -} - -/** - * udevdb_open: opens udev's database - * @method: database can either be in memory - UDEVDB_INTERNAL - or - * written to a file with UDEVDB_DEFAULT. - */ -static int udevdb_open(int method) -{ - udevdb = tdb_open(UDEV_CONFIG_DIR UDEV_DB, 0, method, O_RDWR | O_CREAT, 0644); - if (udevdb == NULL) { - if (method == UDEVDB_INTERNAL) - dbg("Unable to initialize in-memory database"); - else - dbg("Unable to initialize database at %s", UDEV_CONFIG_DIR UDEV_DB); - return -EINVAL; - } - return 0; -} - -static struct sysfsdb_record *sysfsdb_fetch(const char *path) +int udevdb_add_dev(const char *path, const struct udevice *dev) { TDB_DATA key, data; - char keystr[PATH_SIZE+2]; - struct sysfsdb_record *rec = NULL; + char keystr[SYSFS_PATH_MAX]; - if (strlen(path) >= PATH_SIZE) - return NULL; + if ((path == NULL) || (dev == NULL)) + return -ENODEV; - memset(keystr, 0, sizeof(keystr)); + memset(keystr, 0, NAME_SIZE); strcpy(keystr, path); - - dbg("keystr = %s", keystr); - - key.dptr = (void *)keystr; + key.dptr = keystr; key.dsize = strlen(keystr) + 1; - - data = tdb_fetch(udevdb, key); - if (data.dptr == NULL || data.dsize == 0) { - dbg("tdb_fetch did not work :("); - return NULL; - } - rec = (struct sysfsdb_record *)malloc(sizeof(struct sysfsdb_record)); - if (rec == NULL) { - free(data.dptr); - return NULL; - } + data.dptr = (void *)dev; + data.dsize = sizeof(*dev); - memcpy(rec, data.dptr, sizeof(struct sysfsdb_record)); - free(data.dptr); - - return rec; + return tdb_store(udevdb, key, data, TDB_REPLACE); } -/** - * namedb_fetch - */ -static struct namedb_record *namedb_fetch(const char *name) +struct udevice *udevdb_get_dev(const char *path) { TDB_DATA key, data; - char nm_keystr[NAME_SIZE]; - struct namedb_record *nrec = NULL; + struct udevice *dev; - if (name == NULL) - return NULL; - if (strlen(name) >= NAME_SIZE) + if (path == NULL) return NULL; - memset(nm_keystr, 0, NAME_SIZE); - strcpy(nm_keystr, name); - - key.dptr = (void *)nm_keystr; - key.dsize = strlen(nm_keystr) + 1; + key.dptr = (void *)path; + key.dsize = strlen(path) + 1; data = tdb_fetch(udevdb, key); if (data.dptr == NULL || data.dsize == 0) return NULL; - nrec = (struct namedb_record *)malloc(sizeof(struct namedb_record)); - if (nrec == NULL) { - free(data.dptr); - return NULL; - } - - memcpy(nrec, data.dptr, sizeof(struct namedb_record)); - free(data.dptr); - - return nrec; -} - -static int sysfs_store(const char *path, const struct udevice *dev) -{ - TDB_DATA key, data; - char keystr[PATH_SIZE+2]; - struct sysfsdb_record rec; - int retval = 0; - - if (dev == NULL) - return -ENODEV; - - memset(keystr, 0, sizeof(keystr)); - strcpy(keystr, path); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - strcpy(rec.name, dev->name); - - data.dptr = (void *) &rec; - data.dsize = sizeof(rec); - - retval = tdb_store(udevdb, key, data, TDB_REPLACE); - return retval; -} - -/** - * namedb_store - */ -static int namedb_store(const struct udevice *dev) -{ - TDB_DATA key, data; - char keystr[NAME_SIZE]; - struct namedb_record rec; - int retval = 0; - + dev = malloc(sizeof(*dev)); if (dev == NULL) - return -1; - - memset(keystr, 0, NAME_SIZE); - strcpy(keystr, dev->name); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - strcpy(rec.sysfs_dev_path, dev->sysfs_dev_path); - strcpy(rec.id, dev->bus_id); - strcpy(rec.class_dev_name, dev->class_dev_name); - strcpy(rec.class_name, dev->class_name); - rec.type = dev->type; - rec.major = dev->major; - rec.minor = dev->minor; - rec.mode = dev->mode; - - data.dptr = (void *) &rec; - data.dsize = sizeof(rec); + goto exit; - retval = tdb_store(udevdb, key, data, TDB_REPLACE); - return retval; + memcpy(dev, data.dptr, sizeof(*dev)); +exit: + free(data.dptr); + return dev; } -/** - * namedb_delete - */ -static int namedb_delete(const char *name) +int udevdb_delete_dev(const char *path) { TDB_DATA key; - char keystr[NAME_SIZE]; - int retval = 0; - - if (name == NULL) - return -1; - if (strlen(name) >= NAME_SIZE) - return -1; - - memset(keystr, 0, NAME_SIZE); - strcpy(keystr, name); - - key.dptr = (void *)keystr; - key.dsize = strlen(keystr) + 1; - - retval = tdb_delete(udevdb, key); - return retval; -} + char keystr[SYSFS_PATH_MAX]; -static int sysfs_delete(const char *path) -{ - TDB_DATA key; - char keystr[PATH_SIZE]; + if (path == NULL) + return -EINVAL; memset(keystr, 0, sizeof(keystr)); strcpy(keystr, path); @@ -257,135 +103,34 @@ static int sysfs_delete(const char *path) return tdb_delete(udevdb, key); } -/** - * udevdb_delete_udevice - */ -int udevdb_delete_udevice(const char *name) -{ - struct namedb_record *nrec = NULL; - - if (name == NULL) - return -1; - - nrec = namedb_fetch(name); - if (nrec == NULL) - return -1; - - namedb_delete(name); - free(nrec); - - return 0; -} - -/** - * udevdb_add_device: adds class device to database - */ -int udevdb_add_device(const char *device, const struct sysfs_class_device *class_dev, const char *name, char type, int major, int minor, int mode) -{ - struct udevice dbdev; - - if (class_dev == NULL) - return -ENODEV; - - memset(&dbdev, 0, sizeof(dbdev)); - strncpy(dbdev.name, name, NAME_SIZE); - if (class_dev->sysdevice) { - strncpy(dbdev.sysfs_dev_path, class_dev->sysdevice->directory->path, PATH_SIZE); - strncpy(dbdev.bus_id, class_dev->sysdevice->bus_id, ID_SIZE); - } - strncpy(dbdev.class_dev_name, class_dev->name, NAME_SIZE); -// if ((sysfs_get_name_from_path(subsystem, dbdev.class_name, NAME_SIZE)) != 0) -// strcpy(dbdev.class_name, "unknown"); - dbdev.type = type; - dbdev.major = major; - dbdev.minor = minor; - dbdev.mode = mode; - - if ((sysfs_store(device, &dbdev)) != 0) - return -1; -// if ((namedb_store(&dbdev)) != 0) -// return -1; - - return 0; -} - -/** - * udevdb_get_device: grab's device by name - */ -struct udevice *udevdb_get_udevice(const char *name) -{ - struct namedb_record *nrec = NULL; - struct udevice *dev = NULL; - - if (name == NULL) - return NULL; - - nrec = namedb_fetch(name); - if (nrec == NULL) - return NULL; - - dev = (struct udevice *)malloc(sizeof(struct udevice)); - if (dev == NULL) { - free(nrec); - return NULL; - } - - strcpy(dev->name, name); - strcpy(dev->sysfs_dev_path, nrec->sysfs_dev_path); - strcpy(dev->class_dev_name, nrec->class_dev_name); - strcpy(dev->class_name, nrec->class_name); - strcpy(dev->bus_id, nrec->id); - dev->type = nrec->type; - dev->major = nrec->major; - dev->minor = nrec->minor; - dev->mode = nrec->mode; - - free(nrec); - - return dev; -} - -int udevdb_get_dev(const char *path, char *name, size_t name_size) -{ - struct sysfsdb_record *rec = NULL; - - if ((path == NULL) || (name == NULL) || (name_size < 1)) - return -EINVAL; - - rec = sysfsdb_fetch(path); - if (rec == NULL) - return -ENODEV; - - if (strlen(rec->name) >= name_size) - return -EINVAL; - - strncpy(name, rec->name, name_size); - return 0; -} - -int udevdb_delete_dev(const char *path) -{ - if (path == NULL) - return -EINVAL; - - return sysfs_delete(path); -} - /** * udevdb_exit: closes database */ void udevdb_exit(void) { - udevdb_close(); + if (udevdb != NULL) { + tdb_close(udevdb); + udevdb = NULL; + } } /** * udevdb_init: initializes database + * @init_flag: database can either be in memory - UDEVDB_INTERNAL - or + * written to a file with UDEVDB_DEFAULT. */ int udevdb_init(int init_flag) { if (init_flag != UDEVDB_DEFAULT && init_flag != UDEVDB_INTERNAL) - return -1; + return -EINVAL; - return udevdb_open(init_flag); + udevdb = tdb_open(UDEV_CONFIG_DIR UDEV_DB, 0, init_flag, O_RDWR | O_CREAT, 0644); + if (udevdb == NULL) { + if (init_flag == UDEVDB_INTERNAL) + dbg("Unable to initialize in-memory database"); + else + dbg("Unable to initialize database at %s", UDEV_CONFIG_DIR UDEV_DB); + return -EINVAL; + } + return 0; } diff --git a/udevdb.h b/udevdb.h index 57a27bc17f..12f6648369 100644 --- a/udevdb.h +++ b/udevdb.h @@ -6,35 +6,16 @@ #define UDEV_DB "udevdb.tdb" -#define PATH_SIZE 256 - -#define UDEVDB_DEL "#" - /* Udevdb initialization flags */ #define UDEVDB_DEFAULT 0 /* Defaults database to use file */ #define UDEVDB_INTERNAL 1 /* Don't store db on disk, use in memory */ -struct udevice { - char name[NAME_SIZE]; - char sysfs_dev_path[PATH_SIZE]; - char class_dev_name[NAME_SIZE]; - char class_name[NAME_SIZE]; - char bus_id[NAME_SIZE]; - char bus_name[NAME_SIZE]; - char type; - int major; - int minor; - mode_t mode; -}; - /* Function Prototypes */ extern void udevdb_exit(void); extern int udevdb_init(int init_flag); -extern int udevdb_delete_udevice(const char *name); -extern int udevdb_add_device(const char *device, const struct sysfs_class_device *class_dev, const char *name, char type, int major, int minor, int mode); -extern struct udevice *udevdb_get_udevice(const char *name); -extern char *udevdb_get_udevice_by_sysfs(const char *path); -extern int udevdb_get_dev(const char *path, char *name, size_t name_size); + +extern int udevdb_add_dev(const char *path, const struct udevice *dev); +extern struct udevice *udevdb_get_dev(const char *path); extern int udevdb_delete_dev(const char *path); #endif /* _UDEVDB_H_ */ -- cgit v1.2.3-54-g00ecf From 3370fb2152d5c812ed4a48b9108a97b446713c9d Mon Sep 17 00:00:00 2001 From: "lkml001@vrfy.org" Date: Mon, 20 Oct 2003 23:33:54 -0700 Subject: [PATCH] man file update changes: o CALLOUT method included o required keys for every match method listed o keywords changed to uppercase in EXAMPLE --- udev.8 | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/udev.8 b/udev.8 index 771ecfa454..efb02cc618 100644 --- a/udev.8 +++ b/udev.8 @@ -29,38 +29,55 @@ namedev expects its configuration at The file consists of a set of lines. All empty lines and lines beginning with a '#' will be ignored. .br -Every line defines the mapping between device attributes and the name of -the device file. It starts with a keyword defining the method for -overriding the default kernel naming scheme, followed by a list -of keys and ends with the definition of the filename for the device. +Every line defines the mapping between device attributes and the device file +name. It starts with a keyword defining the method used to match, followed by +one ore more keys to compare, optional ownwership and permission settings and +the filename for the device. If no matching configuration is found, +the default kernel device name is used. +.P +.I method, key,[key,...] [owner,] [group,] [mode,] name .TP .B LABEL device label or serial number, like USB serial number, SCSI UUID or file system label +.br +keys: \fBBUS\fP, \fIsysfs_attribute\fP .TP .B NUMBER device number on the bus, like PCI bus id +.br +keys: \fBBUS\fP, \fBID\fP .TP .B TOPOLOGY device position on bus, like physical port of USB device +.br +keys: \fBBUS\fP, \fBPLACE\fP .TP .B REPLACE string replacement of the kernel device name -.P -If no matching configuration is found, the default kernel device name is used. +.br +key: \fBKERNEL_NAME\fP +.TP +.B CALLOUT +calling external program, that returns a string to match +.br +keys: \fBBUS\fP, \fBPROGRAM\fP, \fBID\fP .SH "EXAMPLE" .nf # USB printer to be called lp_color LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_color" # sound card with PCI bus id 00:0b.0 to be called dsp -NUMBER, BUS="pci", id="00:0b.0", NAME="dsp" +NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" # USB mouse at third port of the second hub to be called mouse1 -TOPOLOGY, BUS="usb", place="2.3", NAME="mouse1" +TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" # ttyUSB1 should always be called pda REPLACE, KERNEL="ttyUSB1", NAME="pda" + +# if /sbin/dev_id returns "V0815" device will be called dev0815 +CALLOUT, PROGRAM="/sbin/dev_id", BUS="pci", ID="V0815", NAME="dev0815" .fi .SH "FILES" .nf -- cgit v1.2.3-54-g00ecf From fe3fe3b29ffbc7d0ce7dca6a371da31d8b3ff7f8 Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Tue, 21 Oct 2003 01:19:14 -0700 Subject: [PATCH] new version of libsysfs patch Here's the patch applying the latest libsysfs. - adds the latest libsysfs code to udev * new code includes dlist implementation, a generic linked list implementation. Needed our own because LGPL * rearranged structures * provided more functions for accessing directory and attributes - gets rid of ->directory->path references in namedev.c - replaces sysfs_get_value_from_attributes with sysfs_get_classdev_attr --- libsysfs/Makefile | 9 +- libsysfs/dlist.c | 343 +++++++++++++++++++++++++++++ libsysfs/dlist.h | 195 +++++++++++++++++ libsysfs/libsysfs.h | 198 ++++++++++++----- libsysfs/sysfs.h | 2 +- libsysfs/sysfs_bus.c | 412 ++++++++++++++++++++++++++--------- libsysfs/sysfs_class.c | 402 ++++++++++++++++++++++++++++------ libsysfs/sysfs_device.c | 487 ++++++++++++++++++++++++++++++++++------- libsysfs/sysfs_dir.c | 566 +++++++++++++++++++++++++++++++++--------------- libsysfs/sysfs_driver.c | 304 ++++++++++++++++++++++++-- libsysfs/sysfs_utils.c | 163 ++++++++++++-- namedev.c | 56 ++--- 12 files changed, 2599 insertions(+), 538 deletions(-) create mode 100644 libsysfs/dlist.c create mode 100644 libsysfs/dlist.h diff --git a/libsysfs/Makefile b/libsysfs/Makefile index 79cc533959..b82acbdbf2 100644 --- a/libsysfs/Makefile +++ b/libsysfs/Makefile @@ -1,15 +1,15 @@ # Makefile for libsysfs.a # Copyright (c) International Business Machines Corp., 2003 -H_INCLUDE=../include +H_INCLUDE=. LIB_INCLUDE=. OBJS=sysfs_bus.o sysfs_class.o sysfs_device.o sysfs_dir.o sysfs_driver.o \ - sysfs_utils.o + sysfs_utils.o dlist.o # Install directory # Options -CFLAGS=-O2 -Wall -ansi -g +CFLAGS=-O2 -Wall -g # sysfs library LIBSYSFS=libsysfs.a @@ -38,5 +38,8 @@ sysfs_driver.o: sysfs_driver.c sysfs_utils.o: sysfs_utils.c $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_utils.c +dlist.o: dlist.c + $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c dlist.c + clean: $(RM) *.o *~ core $(LIBSYSFS) diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c new file mode 100644 index 0000000000..6dfcf726ba --- /dev/null +++ b/libsysfs/dlist.c @@ -0,0 +1,343 @@ +/* + * dlist.c + * + * Copyright (C) 2003 Eric J Bohm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021110307 USA + * + */ + + +/* Double linked list implementation. + + * You allocate the data and give dlist the pointer. + * If your data is complex set the dlist->del_func to a an appropriate + * delete function. Otherwise dlist will just use free. + +*/ +#include "dlist.h" + +/* + * Return pointer to node at marker. + * else null if no nodes. + */ + +inline void *dlist_mark(Dlist *list) +{ + if(list->marker!=NULL) + return(list->marker->data); + else + return(NULL); +} + +/* + * Set marker to start. + */ + +inline void dlist_start(Dlist *list) +{ + list->marker=list->head; +} + +/* + * Set marker to end. + */ + +inline void dlist_end(Dlist *list) +{ + list->marker=list->head; +} + +/* internal use function + * quickie inline to consolidate the marker movement logic + * in one place + * + * when direction true it moves marker after + * when direction false it moves marker before. + * return pointer to data at new marker + * if nowhere to move the marker in desired direction return null + */ +inline void *_dlist_mark_move(Dlist *list,int direction) +{ + if(direction) + { + if( list->marker->next!=NULL) + list->marker=list->marker->next; + else + return(NULL); + } + else + { + if( list->marker->prev!=NULL) + list->marker=list->marker->prev; + else + return(NULL); + } + if(list->marker!=list->head) + return(list->marker->data); + else + return(NULL); +} + +/* + * Create new linked list to store nodes of datasize. + * return null if list cannot be created. + */ +Dlist *dlist_new(size_t datasize) +{ + Dlist *list=NULL; + if((list=malloc(sizeof(Dlist)))) + { + list->marker=NULL; + list->count=0L; + list->data_size=datasize; + list->del_func=free; + list->head=&(list->headnode); + list->head->prev=NULL; + list->head->next=NULL; + list->head->data=NULL; + } + return(list); +} + +/* + * Create new linked list to store nodes of datasize set list + * data node delete function to the passed in del_func + * return null if list cannot be created. + */ +Dlist *dlist_new_with_delete(size_t datasize,void (*del_func)(void*)) +{ + Dlist *list=NULL; + list=dlist_new(datasize); + if(list!=NULL) + list->del_func=del_func; + return(list); +} + + +/* + * remove marker node from list + * call data_delete function on data if registered. + * otherwise call free. + * when direction true it moves marker after + * when direction false it moves marker before. + * free marker node + * return nothing. + */ +void dlist_delete(Dlist *list,int direction) +{ + if((list->marker != list->head)&&(list->marker!=NULL)) + { + DL_node *corpse; + corpse=list->marker; + _dlist_mark_move(list,direction); + if(list->head->next==corpse) + list->head->next=corpse->next; + if(list->head->prev==corpse) + list->head->prev=corpse->prev; + if(corpse->prev!=NULL) //should be impossible + corpse->prev->next=corpse->next; + if(corpse->next!=NULL) //should be impossible + corpse->next->prev=corpse->prev; + list->del_func(corpse->data); + list->count--; + free(corpse); + } +} + +/* + * Insert node containing data at marker. + * If direction true it inserts after. + * If direction false it inserts before. + * move marker to inserted node + * return pointer to inserted node + */ +void *dlist_insert(Dlist *list,void *data,int direction) +{ + DL_node *new_node=NULL; + if(list==NULL || data==NULL) + return(NULL); + if(list->marker==NULL) //in case the marker ends up unset + list->marker=list->head; + if((new_node=malloc(sizeof(DL_node)))) + { + new_node->data=data; + new_node->prev=NULL; + new_node->next=NULL; + list->count++; + if(list->head->next==NULL) //no l + { + list->head->next=list->head->prev=new_node; + new_node->prev=list->head; + new_node->next=list->head; + } + else if(direction) + { + new_node->next=list->marker->next; + new_node->prev=list->marker; + list->marker->next->prev=new_node; + list->marker->next=new_node; + } + else + { + new_node->prev=list->marker->prev; + new_node->next=list->marker; + list->marker->prev->next=new_node; + list->marker->prev=new_node; + } + list->marker=new_node; + } + else + { + return(NULL); + } + return(list->marker->data); +} + +/* + * Remove DL_node from list without deallocating data. + * if marker == killme . + * when direction true it moves marker after + * when direction false it moves marker before. + * to previous if there is no next. + */ +void *_dlist_remove(Dlist *list,DL_node *killme,int direction) +{ + if(killme!=NULL) + { + void *killer_data=killme->data; + // take care of head and marker pointers. + if(list->marker==killme) + _dlist_mark_move(list,direction); + if(killme ==list->head->next) + list->head->next=killme->next; + if(killme==list->head->prev) + list->head->prev=killme->prev; + // remove from list + if(killme->prev !=NULL) + killme->prev->next=killme->next; + if(killme->next !=NULL) + killme->next->prev=killme->prev; + list->count--; + free(killme); + return(killer_data); + } + else + return (NULL); +} + + +/* + * Insert node containing data after end. + */ +void dlist_push(Dlist *list,void *data) +{ + list->marker=list->head->prev; + dlist_insert(list,data,1); +} + +/* + * Insert node containing data at start. + */ + +void dlist_unshift(Dlist *list,void *data) + +{ + list->marker=list->head->next; + dlist_insert(list,data,0); +} + + +/* + * Remove end node from list. + * Return pointer to data in removed node. + * Null if no nodes. + */ + +void *dlist_pop(Dlist *list) +{ + return(_dlist_remove(list,list->head->prev,0)); +} + +/* + * Remove start node from list. + * Return pointer to data in removed node. + * Null if no nodes. + */ + +void *dlist_shift(Dlist *list) +{ + return(_dlist_remove(list,list->head->next,1)); +} + + +/* + * destroy the list freeing all memory + */ + + +void dlist_destroy(Dlist *list) +{ + if(list !=NULL) + { + dlist_start(list); + dlist_next(list); + while (dlist_mark(list)) { + dlist_delete(list,1); + } + free(list); + } +} + +/** + * Return void pointer to list_data element matching comp function criteria + * else null + * Does not move the marker. + */ + +void *dlist_find_custom(struct dlist *list, void *target, int (*comp)(void *, void *)) +{ + /* test the comp function on each node */ + struct dl_node *nodepointer; + dlist_for_each_nomark(list,nodepointer) + if(comp(target,nodepointer->data)) + return(nodepointer->data); + return(NULL); +} + +/** + * Apply the node_operation function to each data node in the list + */ +void dlist_transform(struct dlist *list, void (*node_operation)(void *)) +{ + struct dl_node *nodepointer; + dlist_for_each_nomark(list,nodepointer) + node_operation(nodepointer->data); +} + +/** + * insert new into list in sorted order + * sorter function in form int sorter(new,ith) + * must return 1 for when new should go before ith + * else 0 + * return pointer to inserted node + * NOTE: assumes list is already sorted + */ +void *dlist_insert_sorted(struct dlist *list, void *new, int (*sorter)(void *, void *)) +{ + for(dlist_start(list),dlist_next(list); \ + list->marker!=list->head && !sorter(new,list->marker->data);dlist_next(list)); + return(dlist_insert_before(list,new)); +} diff --git a/libsysfs/dlist.h b/libsysfs/dlist.h new file mode 100644 index 0000000000..5da79f9ba2 --- /dev/null +++ b/libsysfs/dlist.h @@ -0,0 +1,195 @@ +/* + * dlist.h + * + * Copyright (C) 2003 Eric J Bohm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef _DLIST_H_ +#define _DLIST_H_ + +/* Double linked list header. + +* navigate your list with DLIST_PREV and DLIST_NEXT. These are macros +* so function call overhead is minimized. + +* Supports perl style push, pop, shift, unshift list semantics. + +* You allocate the data and give dlist the pointer. If your data is +* complex set the dlist->del_func to a an appropriate delete using +* dlist_new_with_delete. Your delete function must match +(void * )(del(void *) +*Otherwise dlist will just use free. + +* NOTE: The small amount of pain involved in doing that allows us to +* avoid copy in copy out semantics. + +* Dlist uses an internal mark pointer to keep track of where you are +* in the list. + +* insert and delete take a directional parameter. Where direction +* corresponds to the direction in which you want the list to go. +* true direction corresponded to progressing forward in the last +* false to regressing in the list. +* so a dlist_insert(yourlist,item,1) will insert it after the mark +* so a dlist_insert(yourlist,item,0) will insert it before the mark +* any insert will move the mark to the new node regardless of the direction. + +* Just use the dlist_(insert|delete)_(before|after) macros if you do not want +* to think about it. + +*/ +#include +typedef struct dl_node { + struct dl_node *prev; + struct dl_node *next; + void *data; +} DL_node; + +typedef struct dlist { + DL_node *marker; + unsigned long count; + size_t data_size; + void (*del_func)(void *); + DL_node headnode; + DL_node *head; +} Dlist; + +Dlist *dlist_new(size_t datasize); +Dlist *dlist_new_with_delete(size_t datasize,void (*del_func)(void*)); +void *_dlist_mark_move(Dlist *list,int direction); +void *dlist_mark(Dlist *); +void dlist_start(Dlist *); +void dlist_end(Dlist *); + +void *dlist_insert(Dlist *,void *,int) ; + +void *dlist_insert_sorted(struct dlist *list, void *new, int (*sorter)(void *, void *)); + +void dlist_delete(Dlist *,int); + +void dlist_push(Dlist *,void *); + +void dlist_unshift(Dlist *,void *); + +void *dlist_pop(Dlist *); + +void *dlist_shift(Dlist *); + +void dlist_destroy(Dlist *); + +void *dlist_find_custom(struct dlist *list, void *target, int (*comp)(void *, void *)); +void dlist_transform(struct dlist *list, void (*node_operation)(void *)); + + +/* + * _dlist_remove is for internal use only + * _dlist_mark_move is for internal use only + */ +void *_dlist_remove(struct dlist *,struct dl_node *,int ); + +#define dlist_prev(A) _dlist_mark_move((A),0) +#define dlist_next(A) _dlist_mark_move((A),1) + +#define dlist_insert_before(A,B) dlist_insert((A),(B),0) +#define dlist_insert_after(A,B) dlist_insert((A),(B),1) + +#define dlist_delete_before(A) dlist_delete((A),0) +#define dlist_delete_after(A) dlist_delete((A),1) + +/** + * provide for loop header which iterates the mark from start to end + * list: the dlist pointer, use dlist_mark(list) to get iterator + */ +#define dlist_for_each(list) \ + for(dlist_start(list),dlist_next(list); \ + (list)->marker!=(list)->head;dlist_next(list)) + +/** + * provide for loop header which iterates the mark from end to start + * list: the dlist pointer, use dlist_mark(list) to get iterator + */ +#define dlist_for_each_rev(list) \ + for(dlist_end(list),dlist_prev(list); \ + (list)->marker!=(list)->head;dlist_prev(list)) + +/** + * provide for loop header which iterates through the list without moving mark + * list: the dlist_pointer + * iterator: dl_node pointer to iterate + */ +#define dlist_for_each_nomark(list,iterator) \ + for((iterator)=(list)->head->next; (iterator)!=(list)->head; \ + (iterator)=(iterator)->next) + +/** + * provide for loop header which iterates through the list without moving mark + * in reverse + * list: the dlist_pointer + * iterator: dl_node pointer to iterate + */ +#define dlist_for_each_nomark_rev(list,iterator) \ + for((iterator)=(list)->head->prev; (iterator)!=(list)->head; \ + (iterator)=(iterator)->prev) +/** + * provide for loop header which iterates through the list providing a + * data iterator + * list: the dlist pointer + * data_iterator: the pointer of type datatype to iterate + * datatype: actual type of the contents in the dl_node->data + */ + +#define dlist_for_each_data(list,data_iterator,datatype) \ + for(dlist_start(list), (data_iterator)=(datatype *) dlist_next(list); \ + (list)->marker!=(list)->head;(data_iterator)=(datatype *) dlist_next(list)) + +/** + * provide for loop header which iterates through the list providing a + * data iterator in reverse + * list: the dlist pointer + * data_iterator: the pointer of type datatype to iterate + * datatype: actual type of the contents in the dl_node->data + */ +#define dlist_for_each_data_rev(list,data_iterator,datatype) \ + for(dlist_end(list), (data_iterator)=(datatype *) dlist_prev(list); \ + (list)->marker!=(list)->head;(data_iterator)=(datatype *) dlist_prev(list)) + +/** + * provide for loop header which iterates through the list providing a + * data iterator without moving the mark + * list: the dlist pointer + * iterator: the dl_node pointer to iterate + * data_iterator: the pointer of type datatype to iterate + * datatype: actual type of the contents in the dl_node->data + */ + +#define dlist_for_each_data_nomark(list,iterator,data_iterator,datatype) \ + for((iterator)=(list)->head->next, (data_iterator)=(datatype *) (iterator)->data; \ + (iterator)!=(list)->head;(iterator)=(iterator)->next,(data_iterator)=(datatype *) (iterator)) + +/** + * provide for loop header which iterates through the list providing a + * data iterator in reverse without moving the mark + * list: the dlist pointer + * iterator: the dl_node pointer to iterate + * data_iterator: the pointer of type datatype to iterate + * datatype: actual type of the contents in the dl_node->data + */ +#define dlist_for_each_data_nomark_rev(list,iterator, data_iterator,datatype) \ + for((iterator)=(list)->head->prev, (data_iterator)=(datatype *) (iterator)->data; \ + (iterator)!=(list)->head;(iterator)=(iterator)->prev,(data_iterator)=(datatype *) (iterator)) + +#endif /* _DLIST_H_ */ diff --git a/libsysfs/libsysfs.h b/libsysfs/libsysfs.h index 01143954e7..ccb9898cb5 100644 --- a/libsysfs/libsysfs.h +++ b/libsysfs/libsysfs.h @@ -3,7 +3,7 @@ * * Header Definitions for libsysfs * - * Copyright (C) 2003 International Business Machines, Inc. + * Copyright (C) IBM Corp. 2003 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +24,7 @@ #define _LIBSYSFS_H_ #include +#include "dlist.h" /* * Generic #defines go here.. @@ -32,11 +33,17 @@ #define SYSFS_PROC_MNTS "/proc/mounts" #define SYSFS_BUS_DIR "/bus" #define SYSFS_CLASS_DIR "/class" +#define SYSFS_BLOCK_DIR "/block" #define SYSFS_DEVICES_DIR "/devices" #define SYSFS_DEVICES_NAME "devices" #define SYSFS_DRIVERS_DIR "/drivers" #define SYSFS_DRIVERS_NAME "drivers" #define SYSFS_NAME_ATTRIBUTE "name" +#define SYSFS_UNKNOWN "unknown" + +/* Some "block" subsystem specific #defines */ +#define SYSFS_QUEUE_NAME "queue" +#define SYSFS_IOSCHED_NAME "iosched" #define SYSFS_PATH_MAX 255 #define SYSFS_NAME_LEN 50 @@ -46,65 +53,84 @@ #define SYSFS_METHOD_STORE 0x02 /* attr can be changed by user */ struct sysfs_attribute { - struct sysfs_attribute *next; - char path[SYSFS_PATH_MAX]; - char *value; + unsigned char *value; unsigned short len; /* value length */ unsigned short method; /* show and store */ + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; }; -struct sysfs_dlink { - struct sysfs_dlink *next; - char name[SYSFS_NAME_LEN]; - struct sysfs_directory *target; +struct sysfs_link { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + unsigned char target[SYSFS_PATH_MAX]; }; struct sysfs_directory { - struct sysfs_directory *next; - char path[SYSFS_PATH_MAX]; - struct sysfs_directory *subdirs; - struct sysfs_dlink *links; - struct sysfs_attribute *attributes; + struct dlist *subdirs; + struct dlist *links; + struct dlist *attributes; + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; }; struct sysfs_driver { - struct sysfs_driver *next; - char name[SYSFS_NAME_LEN]; - struct sysfs_directory *directory; - struct sysfs_device *device; + struct dlist *devices; + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* for internal use only */ + struct sysfs_directory *directory; }; struct sysfs_device { - struct sysfs_device *next; - char name[SYSFS_NAME_LEN]; - char bus_id[SYSFS_NAME_LEN]; - struct sysfs_driver *driver; + struct sysfs_device *parent; + struct dlist *children; + unsigned char name[SYSFS_NAME_LEN]; + unsigned char bus_id[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + unsigned char driver_name[SYSFS_NAME_LEN]; + + /* for internal use only */ + struct sysfs_directory *directory; +}; + +struct sysfs_root_device { + struct dlist *devices; + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* for internal use only */ struct sysfs_directory *directory; - struct sysfs_device *parent; - struct sysfs_device *children; }; struct sysfs_bus { - struct sysfs_bus *next; - char name[SYSFS_NAME_LEN]; - struct sysfs_directory *directory; - struct sysfs_driver *drivers; - struct sysfs_device *devices; + struct dlist *drivers; + struct dlist *devices; + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* internal use only */ + struct sysfs_directory *directory; }; struct sysfs_class_device { - struct sysfs_class_device *next; - char name[SYSFS_NAME_LEN]; - struct sysfs_directory *directory; struct sysfs_device *sysdevice; /* NULL if virtual */ struct sysfs_driver *driver; /* NULL if not implemented */ + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* for internal use only */ + struct sysfs_directory *directory; }; struct sysfs_class { - struct sysfs_class *next; - char name[SYSFS_NAME_LEN]; - struct sysfs_directory *directory; - struct sysfs_class_device *devices; + struct dlist *devices; + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* for internal use only */ + struct sysfs_directory *directory; }; #ifdef __cplusplus @@ -114,46 +140,108 @@ extern "C" { /* * Function Prototypes */ -extern int sysfs_get_mnt_path(char *mnt_path, size_t len); -extern int sysfs_get_name_from_path(const char *path, char *name, size_t len); -extern int sysfs_get_link(const char *path, char *target, size_t len); +extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); +extern int sysfs_get_name_from_path(const unsigned char *path, + unsigned char *name, size_t len); +extern int sysfs_get_link(const unsigned char *path, unsigned char *target, + size_t len); +extern struct dlist *sysfs_open_subsystem_list(unsigned char *name); +extern struct dlist *sysfs_open_bus_devices_list(unsigned char *name); +extern void sysfs_close_list(struct dlist *list); /* sysfs directory and file access */ extern void sysfs_close_attribute(struct sysfs_attribute *sysattr); -extern struct sysfs_attribute *sysfs_open_attribute(const char *path); +extern struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path); extern int sysfs_read_attribute(struct sysfs_attribute *sysattr); -extern int sysfs_read_attribute_value(const char *attrpath, char *value, - size_t vsize); -extern char *sysfs_get_value_from_attributes(struct sysfs_attribute *attr, - const char * name); +extern int sysfs_read_attribute_value(const unsigned char *attrpath, + unsigned char *value, size_t vsize); +extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, + const unsigned char *new_value, size_t len); +extern unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, + const unsigned char * name); extern void sysfs_close_directory(struct sysfs_directory *sysdir); -extern struct sysfs_directory *sysfs_open_directory(const char *path); +extern struct sysfs_directory *sysfs_open_directory(const unsigned char *path); extern int sysfs_read_directory(struct sysfs_directory *sysdir); -extern void sysfs_close_dlink(struct sysfs_dlink *dlink); -extern struct sysfs_dlink *sysfs_open_dlink(const char *linkpath); -extern int sysfs_read_dlinks(struct sysfs_dlink *dlink); +extern int sysfs_read_all_subdirs(struct sysfs_directory *sysdir); +extern struct sysfs_directory *sysfs_get_subdirectory + (struct sysfs_directory *dir, unsigned char *subname); +extern void sysfs_close_link(struct sysfs_link *ln); +extern struct sysfs_link *sysfs_open_link(const unsigned char *lnpath); +extern struct sysfs_link *sysfs_get_directory_link(struct sysfs_directory *dir, + unsigned char *linkname); +extern struct sysfs_link *sysfs_get_subdirectory_link + (struct sysfs_directory *dir, unsigned char *linkname); +extern struct sysfs_attribute *sysfs_get_directory_attribute + (struct sysfs_directory *dir, unsigned char *attrname); /* sysfs driver access */ extern void sysfs_close_driver(struct sysfs_driver *driver); -extern struct sysfs_driver *sysfs_open_driver(const char *path); +extern struct sysfs_driver *sysfs_open_driver(const unsigned char *path); +extern struct sysfs_attribute *sysfs_get_driver_attr + (struct sysfs_driver *drv, const unsigned char *name); +extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); +extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); +extern void sysfs_close_driver_by_name(struct sysfs_driver *driver); +extern struct sysfs_driver *sysfs_open_driver_by_name + (const unsigned char *drv_name, const unsigned char *bus, size_t bsize); +extern int sysfs_write_driver_attr(unsigned char *drv, unsigned char *attrib, + unsigned char *value, size_t len); +extern int sysfs_read_driver_attr(unsigned char *drv, unsigned char *attrib, + unsigned char *value, size_t len); /* generic sysfs device access */ +extern void sysfs_close_root_device(struct sysfs_root_device *root); +extern struct sysfs_root_device *sysfs_open_root_device + (const unsigned char *name); extern void sysfs_close_device(struct sysfs_device *dev); -extern void sysfs_close_device_tree(struct sysfs_device *dev); -extern struct sysfs_device *sysfs_open_device(const char *path); -extern struct sysfs_device *sysfs_open_device_tree(const char *path); +extern struct sysfs_device *sysfs_open_device(const unsigned char *path); extern struct sysfs_attribute *sysfs_get_device_attr - (struct sysfs_device *dev, const char *name); + (struct sysfs_device *dev, const unsigned char *name); +extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); +extern struct sysfs_device *sysfs_open_device_by_id + (const unsigned char *bus_id, const unsigned char *bus, size_t bsize); +extern int sysfs_write_device_attr(unsigned char *dev, unsigned char *attrib, + unsigned char *value, size_t len); +extern int sysfs_read_device_attr(unsigned char *dev, unsigned char *attrib, + unsigned char *value, size_t len); /* generic sysfs bus access */ extern void sysfs_close_bus(struct sysfs_bus *bus); -extern struct sysfs_bus *sysfs_open_bus(const char *name); +extern struct sysfs_bus *sysfs_open_bus(const unsigned char *name); +extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, + unsigned char *id); +extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, + unsigned char *drvname); +extern struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus); +extern struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, + unsigned char *attrname); +extern struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, + unsigned char *dev_id); +extern int sysfs_find_device_bus(const unsigned char *dev_id, + unsigned char *busname, size_t bsize); +extern int sysfs_find_driver_bus(const unsigned char *driver, + unsigned char *busname, size_t bsize); /* generic sysfs class access */ extern void sysfs_close_class_device(struct sysfs_class_device *dev); -extern struct sysfs_class_device *sysfs_open_class_device(const char *path); +extern struct sysfs_class_device *sysfs_open_class_device + (const unsigned char *path); extern void sysfs_close_class(struct sysfs_class *cls); -extern struct sysfs_class *sysfs_open_class(const char *name); +extern struct sysfs_class *sysfs_open_class(const unsigned char *name); +extern struct sysfs_class_device *sysfs_get_class_device + (struct sysfs_class *class, unsigned char *name); +extern struct sysfs_class_device *sysfs_open_class_device_by_name + (const unsigned char *class, unsigned char *name); +extern struct dlist *sysfs_get_classdev_attributes + (struct sysfs_class_device *cdev); +extern int sysfs_find_device_class(const unsigned char *bus_id, + unsigned char *classname, size_t bsize); +extern struct sysfs_attribute *sysfs_get_classdev_attr + (struct sysfs_class_device *clsdev, const unsigned char *name); +extern int sysfs_write_classdev_attr(unsigned char *dev, unsigned char *attrib, + unsigned char *value, size_t len); +extern int sysfs_read_classdev_attr(unsigned char *dev, unsigned char *attrib, + unsigned char *value, size_t len); #ifdef __cplusplus } diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index eb2a002958..00599954fd 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -3,7 +3,7 @@ * * Internal Header Definitions for libsysfs * - * Copyright (C) 2003 International Business Machines, Inc. + * Copyright (C) IBM Corp. 2003 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index b2e2b2dd71..19fc275d84 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -3,7 +3,7 @@ * * Generic bus utility functions for libsysfs * - * Copyright (C) 2003 International Business Machines, Inc. + * Copyright (C) IBM Corp. 2003 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,28 +23,62 @@ #include "libsysfs.h" #include "sysfs.h" +static void sysfs_close_dev(void *dev) +{ + sysfs_close_device((struct sysfs_device *)dev); +} + +static void sysfs_close_drv(void *drv) +{ + sysfs_close_driver((struct sysfs_driver *)drv); +} + +/* + * compares devices' bus ids. + * @a: device id looking for + * @b: sysfs_device comparing being compared + * returns 1 if a==b->bus_id or 0 not equal + */ +static int bus_device_id_equal(void *a, void *b) +{ + if (a == NULL || b == NULL) + return 0; + + if (strcmp(((unsigned char *)a), ((struct sysfs_device *)b)->bus_id) + == 0) + return 1; + return 0; +} + +/* + * compares drivers' names. + * @a: driver name looking for + * @b: sysfs_driver comparing being compared + * returns 1 if a==b->name or 0 not equal + */ +static int bus_driver_name_equal(void *a, void *b) +{ + if (a == NULL || b == NULL) + return 0; + + if (strcmp(((unsigned char *)a), ((struct sysfs_driver *)b)->name) == 0) + return 1; + return 0; +} + /** * sysfs_close_bus: close single bus * @bus: bus structure */ void sysfs_close_bus(struct sysfs_bus *bus) { - struct sysfs_device *curdev = NULL, *nextdev = NULL; - struct sysfs_driver *curdrv = NULL, *nextdrv = NULL; - if (bus != NULL) { if (bus->directory != NULL) sysfs_close_directory(bus->directory); - for (curdev = bus->devices; curdev != NULL; - curdev = nextdev) { - nextdev = curdev->next; - sysfs_close_device(curdev); - } - for (curdrv = bus->drivers; curdrv != NULL; - curdrv = nextdrv) { - nextdrv = curdrv->next; - sysfs_close_driver(curdrv); - } + if (bus->devices) + dlist_destroy(bus->devices); + if (bus->drivers) + dlist_destroy(bus->drivers); free(bus); } } @@ -62,10 +96,10 @@ static struct sysfs_bus *alloc_bus(void) * open_bus_dir: opens up sysfs bus directory * returns sysfs_directory struct with success and NULL with error */ -static struct sysfs_directory *open_bus_dir(const char *name) +static struct sysfs_directory *open_bus_dir(const unsigned char *name) { - struct sysfs_directory *busdir = NULL, *cur = NULL, *next = NULL; - char buspath[SYSFS_PATH_MAX]; + struct sysfs_directory *busdir = NULL; + unsigned char buspath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; @@ -74,7 +108,7 @@ static struct sysfs_directory *open_bus_dir(const char *name) memset(buspath, 0, SYSFS_PATH_MAX); if ((sysfs_get_mnt_path(buspath, SYSFS_PATH_MAX)) != 0) { - dprintf(stderr, "Sysfs not supported on this system\n"); + dprintf("Sysfs not supported on this system\n"); return NULL; } @@ -84,53 +118,22 @@ static struct sysfs_directory *open_bus_dir(const char *name) busdir = sysfs_open_directory(buspath); if (busdir == NULL) { errno = EINVAL; - dprintf(stderr,"Bus %s not supported on this system\n", + dprintf("Bus %s not supported on this system\n", name); return NULL; } if ((sysfs_read_directory(busdir)) != 0) { - dprintf(stderr, "Error reading %s bus dir %s\n", name, + dprintf("Error reading %s bus dir %s\n", name, buspath); sysfs_close_directory(busdir); return NULL; } /* read in devices and drivers subdirs */ - for (cur = busdir->subdirs; cur != NULL; cur = next) { - next = cur->next; - if ((sysfs_read_directory(cur)) != 0) - continue; - } + sysfs_read_all_subdirs(busdir); return busdir; } -/** - * add_dev_to_bus: adds a bus device to bus device list - * @bus: bus to add the device - * @dev: device to add - */ -static void add_dev_to_bus(struct sysfs_bus *bus, struct sysfs_device *dev) -{ - if (bus != NULL && dev != NULL) { - dev->next = bus->devices; - bus->devices = dev; - } -} - -/** - * add_driver_to_bus: adds a bus driver to bus driver list - * @bus: bus to add driver to - * @driver: driver to add - */ -static void add_driver_to_bus(struct sysfs_bus *bus, - struct sysfs_driver *driver) -{ - if (bus != NULL && driver != NULL) { - driver->next = bus->drivers; - bus->drivers = driver; - } -} - /** * get_all_bus_devices: gets all devices for bus * @bus: bus to get devices for @@ -140,29 +143,33 @@ static int get_all_bus_devices(struct sysfs_bus *bus) { struct sysfs_device *bdev = NULL; struct sysfs_directory *cur = NULL; - struct sysfs_dlink *curl = NULL, *nextl = NULL; - char dirname[SYSFS_NAME_LEN]; + struct sysfs_link *curl = NULL; if (bus == NULL || bus->directory == NULL) { errno = EINVAL; return -1; } - for (cur = bus->directory->subdirs; cur != NULL; cur = cur->next) { - memset(dirname, 0, SYSFS_NAME_LEN); - if ((sysfs_get_name_from_path(cur->path, dirname, - SYSFS_NAME_LEN)) != 0) + if (bus->directory->subdirs == NULL) + return 0; + + dlist_for_each_data(bus->directory->subdirs, cur, + struct sysfs_directory) { + if (strcmp(cur->name, SYSFS_DEVICES_NAME) != 0) continue; - if (strcmp(dirname, SYSFS_DEVICES_NAME) != 0) + if (cur->links == NULL) continue; - for (curl = cur->links; curl != NULL; curl = nextl) { - nextl = curl->next; - bdev = sysfs_open_device(curl->target->path); + dlist_for_each_data(cur->links, curl, struct sysfs_link) { + bdev = sysfs_open_device(curl->target); if (bdev == NULL) { - dprintf(stderr, "Error opening device at %s\n", - curl->target->path); + dprintf("Error opening device at %s\n", + curl->target); continue; } - add_dev_to_bus(bus, bdev); + if (bus->devices == NULL) + bus->devices = dlist_new_with_delete + (sizeof(struct sysfs_device), + sysfs_close_dev); + dlist_unshift(bus->devices, bdev); } } @@ -177,31 +184,35 @@ static int get_all_bus_devices(struct sysfs_bus *bus) static int get_all_bus_drivers(struct sysfs_bus *bus) { struct sysfs_driver *driver = NULL; - struct sysfs_directory *cur = NULL, *next = NULL; - struct sysfs_directory *cursub = NULL, *nextsub = NULL; - char dirname[SYSFS_NAME_LEN]; + struct sysfs_directory *cur = NULL; + struct sysfs_directory *cursub = NULL; if (bus == NULL || bus->directory == NULL) { errno = EINVAL; return -1; } - for (cur = bus->directory->subdirs; cur != NULL; cur = next) { - next = cur->next; - memset(dirname, 0, SYSFS_NAME_LEN); - if ((sysfs_get_name_from_path(cur->path, dirname, - SYSFS_NAME_LEN)) != 0) + if (bus->directory->subdirs == NULL) + return 0; + + dlist_for_each_data(bus->directory->subdirs, cur, + struct sysfs_directory) { + if (strcmp(cur->name, SYSFS_DRIVERS_NAME) != 0) continue; - if (strcmp(dirname, SYSFS_DRIVERS_NAME) != 0) + if (cur->subdirs == NULL) continue; - for (cursub = cur->subdirs; cursub != NULL; cursub = nextsub) { - nextsub = cursub->next; + dlist_for_each_data(cur->subdirs, cursub, + struct sysfs_directory) { driver = sysfs_open_driver(cursub->path); if (driver == NULL) { - dprintf(stderr, "Error opening driver at %s\n", + dprintf("Error opening driver at %s\n", cursub->path); continue; } - add_driver_to_bus(bus, driver); + if (bus->drivers == NULL) + bus->drivers = dlist_new_with_delete + (sizeof(struct sysfs_driver), + sysfs_close_drv); + dlist_unshift(bus->drivers, driver); } } @@ -214,20 +225,22 @@ static int get_all_bus_drivers(struct sysfs_bus *bus) * @busid: busid of device to match * returns 1 if found and 0 if not found */ -static int match_bus_device_to_driver(struct sysfs_driver *driver, char *busid) +static int match_bus_device_to_driver(struct sysfs_driver *driver, + unsigned char *busid) { - struct sysfs_dlink *cur = NULL, *next = NULL; + struct sysfs_link *cur = NULL; int found = 0; if (driver == NULL || driver->directory == NULL || busid == NULL) { errno = EINVAL; return found; } - for (cur = driver->directory->links; cur != NULL && found == 0; - cur = next) { - next = cur->next; - if ((strcmp(cur->name, busid)) == 0) - found++; + if (driver->directory->links != NULL) { + dlist_for_each_data(driver->directory->links, cur, + struct sysfs_link) { + if ((strcmp(cur->name, busid)) == 0) + found++; + } } return found; } @@ -238,19 +251,22 @@ static int match_bus_device_to_driver(struct sysfs_driver *driver, char *busid) */ static void link_bus_devices_to_drivers(struct sysfs_bus *bus) { - struct sysfs_device *dev = NULL, *nextdev = NULL; - struct sysfs_driver *drv = NULL, *nextdrv = NULL; + struct sysfs_device *dev = NULL; + struct sysfs_driver *drv = NULL; if (bus != NULL && bus->devices != NULL && bus->drivers != NULL) { - for (dev = bus->devices; dev != NULL; dev = nextdev) { - nextdev = dev->next; - - for (drv = bus->drivers; drv != NULL; drv = nextdrv) { - nextdrv = drv->next; + dlist_for_each_data(bus->devices, dev, struct sysfs_device) { + dlist_for_each_data(bus->drivers, drv, + struct sysfs_driver) { if ((match_bus_device_to_driver(drv, - dev->bus_id)) != 0) { - dev->driver = drv; - drv->device = dev; + dev->bus_id)) != 0) { + strncpy(dev->driver_name, drv->name, + SYSFS_NAME_LEN); + if (drv->devices == NULL) + drv->devices = dlist_new + (sizeof(struct + sysfs_device)); + dlist_unshift(drv->devices, dev); } } } @@ -261,7 +277,7 @@ static void link_bus_devices_to_drivers(struct sysfs_bus *bus) * sysfs_open_bus: opens specific bus and all its devices on system * returns sysfs_bus structure with success or NULL with error. */ -struct sysfs_bus *sysfs_open_bus(const char *name) +struct sysfs_bus *sysfs_open_bus(const unsigned char *name) { struct sysfs_bus *bus = NULL; struct sysfs_directory *busdir = NULL; @@ -273,25 +289,26 @@ struct sysfs_bus *sysfs_open_bus(const char *name) bus = alloc_bus(); if (bus == NULL) { - perror("malloc"); + dprintf("calloc failed\n"); return NULL; } strcpy(bus->name, name); busdir = open_bus_dir(name); if (busdir == NULL) { - dprintf(stderr,"Invalid bus, %s not supported on this system\n", + dprintf("Invalid bus, %s not supported on this system\n", name); sysfs_close_bus(bus); return NULL; } + strcpy(bus->path, busdir->path); bus->directory = busdir; if ((get_all_bus_devices(bus)) != 0) { - dprintf(stderr, "Error reading %s bus devices\n", name); + dprintf("Error reading %s bus devices\n", name); sysfs_close_bus(bus); return NULL; } if ((get_all_bus_drivers(bus)) != 0) { - dprintf(stderr, "Error reading %s bus drivers\n", name); + dprintf("Error reading %s bus drivers\n", name); sysfs_close_bus(bus); return NULL; } @@ -299,3 +316,198 @@ struct sysfs_bus *sysfs_open_bus(const char *name) return bus; } + +/** + * sysfs_get_bus_device: Get specific device on bus using device's id + * @bus: bus to find device on + * @id: bus_id for device + * returns struct sysfs_device reference or NULL if not found. + */ +struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, + unsigned char *id) +{ + if (bus == NULL || id == NULL) { + errno = EINVAL; + return NULL; + } + + return (struct sysfs_device *)dlist_find_custom(bus->devices, id, + bus_device_id_equal); +} + +/** + * sysfs_get_bus_driver: Get specific driver on bus using driver name + * @bus: bus to find driver on + * @drvname: name of driver + * returns struct sysfs_driver reference or NULL if not found. + */ +struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, + unsigned char *drvname) +{ + if (bus == NULL || drvname == NULL) { + errno = EINVAL; + return NULL; + } + + return (struct sysfs_driver *)dlist_find_custom(bus->drivers, drvname, + bus_driver_name_equal); +} + +/** + * sysfs_get_bus_attributes: returns bus' dlist of attributes + * @bus: bus to get attributes for. + * returns dlist of attributes or NULL if there aren't any. + */ +struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) +{ + if (bus == NULL || bus->directory == NULL) + return NULL; + return bus->directory->attributes; +} + +/** + * sysfs_get_bus_attribute: gets a specific bus attribute, if buses had + * attributes. + * @bus: bus to retrieve attribute from + * @attrname: attribute name to retrieve + * returns reference to sysfs_attribute if found or NULL if not found + */ +struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, + unsigned char *attrname) +{ + if (bus == NULL || bus->directory == NULL || attrname == NULL) { + errno = EINVAL; + return NULL; + } + return sysfs_get_directory_attribute(bus->directory, attrname); +} + +/** + * sysfs_open_bus_device: locates a device on a bus and returns it. Device + * must be closed using sysfs_close_device. + * @busname: Name of bus to search + * @dev_id: Id of device on bus. + * returns sysfs_device if found or NULL if not. + */ +struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, + unsigned char *dev_id) +{ + struct sysfs_device *rdev = NULL; + char path[SYSFS_PATH_MAX]; + + if (busname == NULL || dev_id == NULL) { + errno = EINVAL; + return NULL; + } + + memset(path, 0, SYSFS_PATH_MAX); + if (sysfs_get_mnt_path(path, SYSFS_PATH_MAX) != 0) { + dprintf("Error getting sysfs mount point\n"); + return NULL; + } + + strcat(path, SYSFS_BUS_DIR); + strcat(path, "/"); + strcat(path, busname); + strcat(path, SYSFS_DEVICES_DIR); + strcat(path, "/"); + strcat(path, dev_id); + + rdev = sysfs_open_device(path); + if (rdev == NULL) { + dprintf("Error getting device %s on bus %s\n", + dev_id, busname); + return NULL; + } + + return rdev; +} + +/** + * sysfs_find_device_bus: locates the bus a device is on. + * @dev_id: device id. + * @busname: buffer to copy name to + * @bsize: buffer size + * returns 0 with success or -1 with error + */ +int sysfs_find_device_bus(const unsigned char *dev_id, unsigned char *busname, + size_t bsize) +{ + unsigned char subsys[SYSFS_NAME_LEN], *bus = NULL, *curdev = NULL; + struct dlist *buslist = NULL, *device_list = NULL; + + if (dev_id == NULL || busname == NULL) { + errno = EINVAL; + return -1; + } + + strcpy(subsys, SYSFS_BUS_DIR); /* subsys = /bus */ + buslist = sysfs_open_subsystem_list(subsys); + if (buslist != NULL) { + dlist_for_each_data(buslist, bus, char) { + device_list = sysfs_open_bus_devices_list(bus); + if (device_list != NULL) { + dlist_for_each_data(device_list, + curdev, char) { + if (strcmp(dev_id, curdev) == 0) { + strncpy(busname, + bus, bsize); + sysfs_close_list(device_list); + sysfs_close_list(buslist); + return 0; + } + } + sysfs_close_list(device_list); + } + } + sysfs_close_list(buslist); + } + return -1; +} + +/** + * sysfs_find_driver_bus: locates the bus the driver is on. + * @driver: name of the driver to locate + * @busname: buffer to copy name to + * @bsize: buffer size + * returns 0 with success, -1 with error + */ +int sysfs_find_driver_bus(const unsigned char *driver, unsigned char *busname, + size_t bsize) +{ + unsigned char subsys[SYSFS_PATH_MAX], *bus = NULL, *curdrv = NULL; + struct dlist *buslist = NULL, *drivers = NULL; + + if (driver == NULL || busname == NULL) { + errno = EINVAL; + return -1; + } + + memset(subsys, 0, SYSFS_PATH_MAX); + strcpy(subsys, SYSFS_BUS_DIR); + buslist = sysfs_open_subsystem_list(subsys); + if (buslist != NULL) { + dlist_for_each_data(buslist, bus, char) { + memset(subsys, 0, SYSFS_PATH_MAX); + strcpy(subsys, SYSFS_BUS_DIR); + strcat(subsys, "/"); + strcat(subsys, bus); + strcat(subsys, SYSFS_DRIVERS_DIR); + drivers = sysfs_open_subsystem_list(subsys); + if (drivers != NULL) { + dlist_for_each_data(drivers, curdrv, char) { + if (strcmp(driver, curdrv) == 0) { + strncpy(busname, bus, bsize); + sysfs_close_list(drivers); + sysfs_close_list(buslist); + return 0; + } + } + sysfs_close_list(drivers); + } + } + sysfs_close_list(buslist); + } + return -1; +} + diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index 9d7d8b2227..cb6ca9d00d 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -3,7 +3,7 @@ * * Generic class utility functions for libsysfs * - * Copyright (C) 2003 International Business Machines, Inc. + * Copyright (C) IBM Corp. 2003 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,6 +23,28 @@ #include "libsysfs.h" #include "sysfs.h" +void sysfs_close_cls_dev(void *dev) +{ + sysfs_close_class_device((struct sysfs_class_device *)dev); +} + +/** + * class_name_equal: compares class_devices' name + * @a: class_name looking for + * @b: sysfs_class_device being compared + */ +static int class_name_equal(void *a, void *b) +{ + if (a == NULL || b == NULL) + return 0; + + if (strcmp(((unsigned char *)a), ((struct sysfs_class_device *)b)->name) + == 0) + return 1; + + return 0; +} + /** * sysfs_close_class_device: closes a single class device. * @dev: class device to close. @@ -46,15 +68,11 @@ void sysfs_close_class_device(struct sysfs_class_device *dev) */ void sysfs_close_class(struct sysfs_class *cls) { - struct sysfs_class_device *cur = NULL, *next = NULL; - if (cls != NULL) { if (cls->directory != NULL) sysfs_close_directory(cls->directory); - for (cur = cls->devices; cur != NULL; cur = next) { - next = cur->next; - sysfs_close_class_device(cur); - } + if (cls->devices != NULL) + dlist_destroy(cls->devices); free(cls); } } @@ -82,10 +100,10 @@ static struct sysfs_class *alloc_class(void) * open_class_dir: opens up sysfs class directory * returns sysfs_directory struct with success and NULL with error */ -static struct sysfs_directory *open_class_dir(const char *name) +static struct sysfs_directory *open_class_dir(const unsigned char *name) { struct sysfs_directory *classdir = NULL; - char classpath[SYSFS_PATH_MAX]; + unsigned char classpath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; @@ -94,7 +112,7 @@ static struct sysfs_directory *open_class_dir(const char *name) memset(classpath, 0, SYSFS_PATH_MAX); if ((sysfs_get_mnt_path(classpath, SYSFS_PATH_MAX)) != 0) { - dprintf(stderr, "Sysfs not supported on this system\n"); + dprintf("Sysfs not supported on this system\n"); return NULL; } @@ -104,13 +122,11 @@ static struct sysfs_directory *open_class_dir(const char *name) classdir = sysfs_open_directory(classpath); if (classdir == NULL) { errno = EINVAL; - dprintf(stderr,"Class %s not supported on this system\n", - name); + dprintf("Class %s not supported on this system\n", name); return NULL; } if ((sysfs_read_directory(classdir)) != 0) { - dprintf(stderr, "Error reading %s class dir %s\n", name, - classpath); + dprintf("Error reading %s class dir %s\n", name, classpath); sysfs_close_directory(classdir); return NULL; } @@ -123,14 +139,13 @@ static struct sysfs_directory *open_class_dir(const char *name) * @path: path to class device. * returns struct sysfs_class_device with success and NULL with error. */ -struct sysfs_class_device *sysfs_open_class_device(const char *path) +struct sysfs_class_device *sysfs_open_class_device(const unsigned char *path) { struct sysfs_class_device *cdev = NULL; - struct sysfs_directory *dir = NULL, *cur = NULL; - struct sysfs_dlink *curl = NULL; + struct sysfs_directory *dir = NULL; + struct sysfs_link *curl = NULL; struct sysfs_device *sdev = NULL; struct sysfs_driver *drv = NULL; - char temp[SYSFS_NAME_LEN]; if (path == NULL) { errno = EINVAL; @@ -138,74 +153,69 @@ struct sysfs_class_device *sysfs_open_class_device(const char *path) } cdev = alloc_class_device(); if (cdev == NULL) { - perror("malloc"); + dprintf("calloc failed\n"); return NULL; } - memset(temp, 0, SYSFS_NAME_LEN); - if ((sysfs_get_name_from_path(path, temp, SYSFS_NAME_LEN)) != 0) { + if ((sysfs_get_name_from_path(path, cdev->name, SYSFS_NAME_LEN)) != 0) { errno = EINVAL; - dprintf(stderr, "Invalid class device path %s\n", path); + dprintf("Invalid class device path %s\n", path); sysfs_close_class_device(cdev); return NULL; } - strcpy(cdev->name, temp); dir = sysfs_open_directory(path); if (dir == NULL) { - dprintf(stderr, "Error opening class device at %s\n", path); + dprintf("Error opening class device at %s\n", path); sysfs_close_class_device(cdev); return NULL; } if ((sysfs_read_directory(dir)) != 0) { - dprintf(stderr, "Error reading class device at %s\n", path); + dprintf("Error reading class device at %s\n", path); sysfs_close_directory(dir); sysfs_close_class_device(cdev); return NULL; } + sysfs_read_all_subdirs(dir); cdev->directory = dir; + strcpy(cdev->path, dir->path); - cur = cdev->directory->subdirs; - while(cur != NULL) { - sysfs_read_directory(cur); - cur = cur->next; - } /* get driver and device, if implemented */ - curl = cdev->directory->links; - while (curl != NULL) { - if (strncmp(curl->name, SYSFS_DEVICES_NAME, 6) == 0) { - sdev = sysfs_open_device(curl->target->path); - if (sdev != NULL) { - cdev->sysdevice = sdev; - if (cdev->driver != NULL) - sdev->driver = cdev->driver; - } - } else if (strncmp(curl->name, SYSFS_DRIVERS_NAME, 6) == 0) { - drv = sysfs_open_driver(curl->target->path); - if (drv != NULL) { - cdev->driver = drv; - if (cdev->sysdevice != NULL) - drv->device = cdev->sysdevice; + if (cdev->directory->links != NULL) { + dlist_for_each_data(cdev->directory->links, curl, + struct sysfs_link) { + if (strncmp(curl->name, SYSFS_DEVICES_NAME, 6) == 0) { + sdev = sysfs_open_device(curl->target); + if (sdev != NULL) { + cdev->sysdevice = sdev; + if (cdev->driver != NULL) + strncpy(sdev->driver_name, + cdev->driver->name, + SYSFS_NAME_LEN); + } + } else if (strncmp(curl->name, + SYSFS_DRIVERS_NAME, 6) == 0) { + drv = sysfs_open_driver(curl->target); + if (drv != NULL) { + cdev->driver = drv; + if (cdev->sysdevice != NULL) { + strncpy(cdev->sysdevice->name, + drv->name, + SYSFS_NAME_LEN); + if (drv->devices == NULL) + drv->devices = + dlist_new + (sizeof(struct + sysfs_device)); + dlist_unshift(drv->devices, + cdev->sysdevice); + } + } } } - curl = curl->next; } return cdev; } -/** - * add_dev_to_class: adds a class device to class list - * @class: class to add the device - * @dev: device to add - */ -static void add_dev_to_class(struct sysfs_class *cls, - struct sysfs_class_device *dev) -{ - if (cls != NULL && dev != NULL) { - dev->next = cls->devices; - cls->devices = dev; - } -} - /** * get_all_class_devices: gets all devices for class * @class: class to get devices for @@ -214,23 +224,27 @@ static void add_dev_to_class(struct sysfs_class *cls, static int get_all_class_devices(struct sysfs_class *cls) { struct sysfs_class_device *dev = NULL; - struct sysfs_directory *cur = NULL, *next = NULL; + struct sysfs_directory *cur = NULL; if (cls == NULL || cls->directory == NULL) { errno = EINVAL; return -1; } - for (cur = cls->directory->subdirs; cur != NULL; cur = next) { - next = cur->next; + if (cls->directory->subdirs == NULL) + return 0; + dlist_for_each_data(cls->directory->subdirs, cur, + struct sysfs_directory) { dev = sysfs_open_class_device(cur->path); if (dev == NULL) { - dprintf(stderr, "Error opening device at %s\n", - cur->path); + dprintf("Error opening device at %s\n", cur->path); continue; } - add_dev_to_class(cls, dev); + if (cls->devices == NULL) + cls->devices = dlist_new_with_delete + (sizeof(struct sysfs_class_device), + sysfs_close_cls_dev); + dlist_unshift(cls->devices, dev); } - return 0; } @@ -238,7 +252,7 @@ static int get_all_class_devices(struct sysfs_class *cls) * sysfs_open_class: opens specific class and all its devices on system * returns sysfs_class structure with success or NULL with error. */ -struct sysfs_class *sysfs_open_class(const char *name) +struct sysfs_class *sysfs_open_class(const unsigned char *name) { struct sysfs_class *cls = NULL; struct sysfs_directory *classdir = NULL; @@ -250,24 +264,268 @@ struct sysfs_class *sysfs_open_class(const char *name) cls = alloc_class(); if (cls == NULL) { - perror("malloc"); + dprintf("calloc failed\n"); return NULL; } strcpy(cls->name, name); classdir = open_class_dir(name); if (classdir == NULL) { - dprintf(stderr, - "Invalid class, %s not supported on this system\n", + dprintf("Invalid class, %s not supported on this system\n", name); sysfs_close_class(cls); return NULL; } cls->directory = classdir; + strcpy(cls->path, classdir->path); if ((get_all_class_devices(cls)) != 0) { - dprintf(stderr, "Error reading %s class devices\n", name); + dprintf("Error reading %s class devices\n", name); sysfs_close_class(cls); return NULL; } return cls; } + +/** + * sysfs_get_class_device: Get specific class device using the device's id + * @class: class to find device on + * @name: class name of the device + */ +struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *class, + unsigned char *name) +{ + if (class == NULL || name == NULL) { + errno = EINVAL; + return NULL; + } + + return (struct sysfs_class_device *)dlist_find_custom(class->devices, + name, class_name_equal); +} + +/** + * sysfs_open_class_device_by_name: Locates a specific class_device and returns it. + * Class_device must be closed using sysfs_close_class_device + * @classname: Class to search + * @name: name of the class_device + */ +struct sysfs_class_device *sysfs_open_class_device_by_name + (const unsigned char *classname, unsigned char *name) +{ + struct sysfs_class *class = NULL; + struct sysfs_class_device *cdev = NULL, *rcdev = NULL; + + if (classname == NULL || name == NULL) { + errno = EINVAL; + return NULL; + } + + class = sysfs_open_class(classname); + if (class == NULL) { + dprintf("Error opening class %s\n", classname); + return NULL; + } + + cdev = sysfs_get_class_device(class, name); + if (cdev == NULL) { + dprintf("Error getting class device %s from class %s\n", + name, classname); + sysfs_close_class(class); + return NULL; + } + + rcdev = sysfs_open_class_device(cdev->directory->path); + if (rcdev == NULL) { + dprintf("Error getting class device %s from class %s\n", + name, classname); + sysfs_close_class(class); + return NULL; + } + sysfs_close_class(class); + + return rcdev; +} + +/** + * sysfs_get_classdev_attributes: returns a dlist of attributes for + * the requested class_device + * @cdev: sysfs_class_dev for which attributes are needed + * returns a dlist of attributes if exists, NULL otherwise + */ +struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev) +{ + if (cdev == NULL || cdev->directory == NULL) + return NULL; + + return (cdev->directory->attributes); +} + +/** + * sysfs_find_device_class: locates the device the device is on + * @bus_id: device to look for + * @classname: buffer to copy class name to + * @bsize: size of buffer + * returns 0 with success and -1 with error + */ +int sysfs_find_device_class(const unsigned char *bus_id, + unsigned char *classname, size_t bsize) +{ + unsigned char class[SYSFS_NAME_LEN], clspath[SYSFS_NAME_LEN]; + unsigned char *cls = NULL, *clsdev = NULL; + struct dlist *clslist = NULL, *clsdev_list = NULL; + + if (bus_id == NULL || classname == NULL) { + errno = EINVAL; + return -1; + } + + strcpy(class, SYSFS_CLASS_DIR); + clslist = sysfs_open_subsystem_list(class); + if (clslist != NULL) { + dlist_for_each_data(clslist, cls, char) { + memset(clspath, 0, SYSFS_NAME_LEN); + strcpy(clspath, SYSFS_CLASS_DIR); + strcat(clspath, "/"); + strcat(clspath, cls); + clsdev_list = sysfs_open_subsystem_list(clspath); + if (clsdev_list != NULL) { + dlist_for_each_data(clsdev_list, + clsdev, char) { + if (strcmp(bus_id, clsdev) == 0) { + strncpy(classname, + cls, bsize); + sysfs_close_list(clsdev_list); + sysfs_close_list(clslist); + return 0; + } + } + sysfs_close_list(clsdev_list); + } + } + sysfs_close_list(clslist); + } + return -1; +} + +/** + * sysfs_get_classdev_attr: searches class device's attributes by name + * @clsdev: class device to look through + * @name: attribute name to get + * returns sysfs_attribute reference with success or NULL with error + */ +struct sysfs_attribute *sysfs_get_classdev_attr + (struct sysfs_class_device *clsdev, const unsigned char *name) +{ + struct sysfs_attribute *cur = NULL; + + if (clsdev == NULL || clsdev->directory == NULL || + clsdev->directory->attributes == NULL || name == NULL) { + errno = EINVAL; + return NULL; + } + + cur = sysfs_get_directory_attribute(clsdev->directory, + (unsigned char *)name); + if (cur != NULL) + return cur; + + return NULL; +} + +/** + * sysfs_write_classdev_attr: modify writable attribute value for the given + * class device + * @dev: class device name for which the attribute has to be changed + * @attrib: attribute to change + * @value: value to change to + * @len: size of buffer at "value" + * Returns 0 on success and -1 on error + */ +int sysfs_write_classdev_attr(unsigned char *dev, unsigned char *attrib, + unsigned char *value, size_t len) +{ + struct sysfs_class_device *clsdev = NULL; + struct sysfs_attribute *attribute = NULL; + unsigned char class_name[SYSFS_NAME_LEN]; + + if (dev == NULL || attrib == NULL || value == NULL) { + errno = EINVAL; + return -1; + } + + memset(class_name, 0, SYSFS_NAME_LEN); + if ((sysfs_find_device_class(dev, + class_name, SYSFS_NAME_LEN)) < 0) { + dprintf("Class device %s not found\n", dev); + return -1; + } + clsdev = sysfs_open_class_device_by_name(class_name, dev); + if (clsdev == NULL) { + dprintf("Error opening %s in class %s\n", dev, class_name); + return -1; + } + attribute = sysfs_get_directory_attribute(clsdev->directory, attrib); + if (attribute == NULL) { + dprintf("Attribute %s not defined for device %s on class %s\n", + attrib, dev, class_name); + sysfs_close_class_device(clsdev); + return -1; + } + if ((sysfs_write_attribute(attribute, value, len)) < 0) { + dprintf("Error setting %s to %s\n", attrib, value); + sysfs_close_class_device(clsdev); + return -1; + } + sysfs_close_class_device(clsdev); + return 0; +} + +/** + * sysfs_read_classdev_attr: read an attribute for a given class device + * @dev: class device name for which the attribute has to be read + * @attrib: attribute to read + * @value: buffer to return value to user + * @len: size of buffer at "value" + * Returns 0 on success and -1 on error + */ +int sysfs_read_classdev_attr(unsigned char *dev, unsigned char *attrib, + unsigned char *value, size_t len) +{ + struct sysfs_class_device *clsdev = NULL; + struct sysfs_attribute *attribute = NULL; + unsigned char class_name[SYSFS_NAME_LEN]; + + if (dev == NULL || attrib == NULL || value == NULL) { + errno = EINVAL; + return -1; + } + + memset(class_name, 0, SYSFS_NAME_LEN); + if ((sysfs_find_device_class(dev, + class_name, SYSFS_NAME_LEN)) < 0) { + dprintf("Class device %s not found\n", dev); + return -1; + } + clsdev = sysfs_open_class_device_by_name(class_name, dev); + if (clsdev == NULL) { + dprintf("Error opening %s in class %s\n", dev, class_name); + return -1; + } + attribute = sysfs_get_directory_attribute(clsdev->directory, attrib); + if (attribute == NULL) { + dprintf("Attribute %s not defined for device %s on class %s\n", + attrib, dev, class_name); + sysfs_close_class_device(clsdev); + return -1; + } + if (attribute->len > len) { + dprintf("Value length %d is greater that suppled buffer %d\n", + attribute->len, len); + sysfs_close_class_device(clsdev); + return -1; + } + strncpy(value, attribute->value, attribute->len); + value[(attribute->len)+1] = 0; + sysfs_close_class_device(clsdev); + return 0; +} diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 185b5cf378..89704dcd80 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -3,7 +3,7 @@ * * Generic device utility functions for libsysfs * - * Copyright (C) 2003 International Business Machines, Inc. + * Copyright (C) IBM Corp. 2003 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,6 +23,42 @@ #include "libsysfs.h" #include "sysfs.h" +/** + * sysfs_close_device_tree: closes every device in the supplied tree, + * closing children only. + * @devroot: device root of tree. + */ +static void sysfs_close_device_tree(struct sysfs_device *devroot) +{ + if (devroot != NULL) { + if (devroot->children != NULL) { + struct sysfs_device *child = NULL; + + dlist_for_each_data(devroot->children, child, + struct sysfs_device) { + sysfs_close_device_tree(child); + } + } + sysfs_close_device(devroot); + } +} + +/** + * sysfs_del_device: routine for dlist integration + */ +static void sysfs_del_device(void *dev) +{ + sysfs_close_device((struct sysfs_device *)dev); +} + +/** + * sysfs_close_dev_tree: routine for dlist integration + */ +static void sysfs_close_dev_tree(void *dev) +{ + sysfs_close_device_tree((struct sysfs_device *)dev); +} + /** * sysfs_close_device: closes and cleans up a device * @dev = device to clean up @@ -30,11 +66,10 @@ void sysfs_close_device(struct sysfs_device *dev) { if (dev != NULL) { - dev->next = NULL; - dev->driver = NULL; if (dev->directory != NULL) sysfs_close_directory(dev->directory); - dev->children = NULL; + if (dev->children != NULL && dev->children->count == 0) + dlist_destroy(dev->children); free(dev); } } @@ -55,24 +90,20 @@ static struct sysfs_device *alloc_device(void) * returns sysfs_attribute reference with success or NULL with error. */ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, - const char *name) + const unsigned char *name) { struct sysfs_attribute *cur = NULL; - char attrname[SYSFS_NAME_LEN]; - if (dev == NULL || dev->directory == NULL || name == NULL) { + if (dev == NULL || dev->directory == NULL + || dev->directory->attributes == NULL || name == NULL) { errno = EINVAL; return NULL; } - for (cur = dev->directory->attributes; cur != NULL; cur = cur->next) { - if ((sysfs_get_name_from_path(cur->path, attrname, - SYSFS_NAME_LEN)) != 0) - continue; - if (strcmp(name, attrname) != 0) - continue; - + + cur = sysfs_get_directory_attribute(dev->directory, + (unsigned char *)name); + if (cur != NULL) return cur; - } return NULL; } @@ -82,11 +113,10 @@ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, * @path: path to device, this is the /sys/devices/ path * returns sysfs_device structure with success or NULL with error */ -struct sysfs_device *sysfs_open_device(const char *path) +struct sysfs_device *sysfs_open_device(const unsigned char *path) { struct sysfs_device *dev = NULL; struct sysfs_directory *sdir = NULL; - char *p = NULL; if (path == NULL) { errno = EINVAL; @@ -94,106 +124,415 @@ struct sysfs_device *sysfs_open_device(const char *path) } dev = alloc_device(); if (dev == NULL) { - dprintf(stderr, "Error allocating device at %s\n", path); + dprintf("Error allocating device at %s\n", path); return NULL; } sdir = sysfs_open_directory(path); if (sdir == NULL) { - dprintf(stderr, "Invalid device at %s\n", path); + dprintf("Invalid device at %s\n", path); errno = EINVAL; sysfs_close_device(dev); return NULL; } if ((sysfs_read_directory(sdir)) != 0) { - dprintf(stderr, "Error reading device directory at %s\n", path); + dprintf("Error reading device directory at %s\n", path); sysfs_close_directory(sdir); sysfs_close_device(dev); return NULL; } dev->directory = sdir; - sysfs_get_name_from_path(sdir->path, dev->bus_id, SYSFS_NAME_LEN); - /* get device name */ - p = sysfs_get_value_from_attributes(sdir->attributes, - SYSFS_NAME_ATTRIBUTE); - if (p != NULL) { - strncpy(dev->name, p, SYSFS_NAME_LEN); - p = dev->name + strlen(dev->name) - 1; - if ((strlen(dev->name) > 0) && *p == '\n') - *p = '\0'; - } + strcpy(dev->bus_id, sdir->name); + strcpy(dev->path, sdir->path); + + /* + * The "name" attribute no longer exists... return the device's + * sysfs representation instead, in the "dev->name" field, which + * implies that the dev->name and dev->bus_id contain same data. + */ + strncpy(dev->name, sdir->name, SYSFS_NAME_LEN); return dev; } /** - * sysfs_close_device_tree: closes every device in the supplied tree, - * closing children only. - * @devroot: device root of tree. + * sysfs_open_device_tree: opens root device and all of its children, + * creating a tree of devices. Only opens children. + * @path: sysfs path to devices + * returns struct sysfs_device and its children with success or NULL with + * error. */ -void sysfs_close_device_tree(struct sysfs_device *devroot) +static struct sysfs_device *sysfs_open_device_tree(const unsigned char *path) { - if (devroot != NULL) { - if (devroot->children != NULL) { - struct sysfs_device *child = NULL, *next = NULL; - - for (child = devroot->children; child != NULL; - child = next) { - next = child->next; - sysfs_close_device_tree(child); + struct sysfs_device *rootdev = NULL, *new = NULL; + struct sysfs_directory *cur = NULL; + + if (path == NULL) { + errno = EINVAL; + return NULL; + } + rootdev = sysfs_open_device(path); + if (rootdev == NULL) { + dprintf("Error opening root device at %s\n", path); + return NULL; + } + if (rootdev->directory->subdirs != NULL) { + dlist_for_each_data(rootdev->directory->subdirs, cur, + struct sysfs_directory) { + new = sysfs_open_device_tree(cur->path); + if (new == NULL) { + dprintf("Error opening device tree at %s\n", + cur->path); + sysfs_close_device_tree(rootdev); + return NULL; } + if (rootdev->children == NULL) + rootdev->children = dlist_new_with_delete + (sizeof(struct sysfs_device), + sysfs_del_device); + dlist_unshift(rootdev->children, new); } - sysfs_close_device(devroot); } + + return rootdev; } /** - * add_device_child_to_parent: adds child device to parent - * @parent: parent device. - * @child: child device to add. + * sysfs_close_root_device: closes root and all devices + * @root: root device to close */ -static void add_device_child_to_parent(struct sysfs_device *parent, - struct sysfs_device *child) +void sysfs_close_root_device(struct sysfs_root_device *root) { - if (parent != NULL && child != NULL) { - child->next = parent->children; - parent->children = child; - child->parent = parent; + if (root != NULL) { + if (root->devices != NULL) + dlist_destroy(root->devices); + if (root->directory != NULL) + sysfs_close_directory(root->directory); + free(root); } } /** - * sysfs_open_device_tree: opens root device and all of its children, - * creating a tree of devices. Only opens children. - * @path: sysfs path to devices - * returns struct sysfs_device and its children with success or NULL with - * error. + * open_root_device_dir: opens up sysfs_directory for specific root dev + * @name: name of root + * returns struct sysfs_directory with success and NULL with error */ -struct sysfs_device *sysfs_open_device_tree(const char *path) +static struct sysfs_directory *open_root_device_dir(const unsigned char *name) { - struct sysfs_device *rootdev = NULL, *new = NULL; + struct sysfs_directory *rdir = NULL; + unsigned char rootpath[SYSFS_PATH_MAX]; + + if (name == NULL) { + errno = EINVAL; + return NULL; + } + + memset(rootpath, 0, SYSFS_PATH_MAX); + if (sysfs_get_mnt_path(rootpath, SYSFS_PATH_MAX) != 0) { + dprintf ("Sysfs not supported on this system\n"); + return NULL; + } + + strcat(rootpath, SYSFS_DEVICES_DIR); + strcat(rootpath, "/"); + strcat(rootpath, name); + rdir = sysfs_open_directory(rootpath); + if (rdir == NULL) { + errno = EINVAL; + dprintf ("Root device %s not supported on this system\n", + name); + return NULL; + } + if (sysfs_read_directory(rdir) != 0) { + dprintf ("Error reading %s root device at dir %s\n", name, + rootpath); + sysfs_close_directory(rdir); + return NULL; + } + + return rdir; +} + +/** + * get_all_root_devices: opens up all the devices under this root device + * @root: root device to open devices for + * returns 0 with success and -1 with error + */ +static int get_all_root_devices(struct sysfs_root_device *root) +{ + struct sysfs_device *dev = NULL; struct sysfs_directory *cur = NULL; - if (path == NULL) { + if (root == NULL || root->directory == NULL) { + errno = EINVAL; + return -1; + } + if (root->directory->subdirs == NULL) + return 0; + + dlist_for_each_data(root->directory->subdirs, cur, + struct sysfs_directory) { + dev = sysfs_open_device_tree(cur->path); + if (dev == NULL) { + dprintf ("Error opening device at %s\n", cur->path); + continue; + } + if (root->devices == NULL) + root->devices = dlist_new_with_delete + (sizeof(struct sysfs_device), + sysfs_close_dev_tree); + dlist_unshift(root->devices, dev); + } + + return 0; +} + +/** + * sysfs_open_root_device: opens sysfs devices root and all of its + * devices. + * @name: name of /sys/devices/root to open + * returns struct sysfs_root_device if success and NULL with error + */ +struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) +{ + struct sysfs_root_device *root = NULL; + struct sysfs_directory *rootdir = NULL; + + if (name == NULL) { errno = EINVAL; return NULL; } - rootdev = sysfs_open_device(path); - if (rootdev == NULL) { - dprintf(stderr, "Error opening root device at %s\n", path); + + root = (struct sysfs_root_device *)calloc + (1, sizeof(struct sysfs_root_device)); + if (root == NULL) { + dprintf("calloc failure\n"); + return NULL; + } + rootdir = open_root_device_dir(name); + if (rootdir == NULL) { + dprintf ("Invalid root device, %s not supported\n", name); + sysfs_close_root_device(root); + return NULL; + } + strcpy(root->path, rootdir->path); + root->directory = rootdir; + if (get_all_root_devices(root) != 0) { + dprintf ("Error retrieving devices for root %s\n", name); + sysfs_close_root_device(root); + return NULL; + } + + return root; +} + +/** + * sysfs_get_device_attributes: returns a dlist of attributes corresponding to + * the specific device + * @device: struct sysfs_device * for which attributes are to be returned + */ +struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) +{ + if (device == NULL || device->directory == NULL) + return NULL; + + return (device->directory->attributes); +} + +/** + * sysfs_open_device_by_id: open a device by id (use the "bus" subsystem) + * @bus_id: bus_id of the device to open - has to be the "bus_id" in + * /sys/bus/xxx/devices + * @bus: bus the device belongs to + * @bsize: size of the bus buffer + * returns struct sysfs_device if found, NULL otherwise + * NOTE: + * 1. Use sysfs_close_device to close the device + * 2. Bus the device is on must be supplied + * Use sysfs_find_device_bus to get the bus name + */ +struct sysfs_device *sysfs_open_device_by_id(const unsigned char *bus_id, + const unsigned char *bus, size_t bsize) +{ + char sysfs_path[SYSFS_PATH_MAX], device_path[SYSFS_PATH_MAX]; + struct sysfs_device *device = NULL; + + if (bus_id == NULL || bus == NULL) { + errno = EINVAL; + return NULL; + } + memset(sysfs_path, 0, SYSFS_PATH_MAX); + if ((sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting sysfs mount path\n"); + return NULL; + } + strcat(sysfs_path, SYSFS_BUS_DIR); + strcat(sysfs_path, "/"); + strncat(sysfs_path, bus, bsize); + strcat(sysfs_path, SYSFS_DEVICES_DIR); + strcat(sysfs_path, "/"); + strcat(sysfs_path, bus_id); + + /* devices under /sys/bus/xxx/devices are links to devices subsystem */ + if ((sysfs_get_link(sysfs_path, device_path, SYSFS_PATH_MAX)) < 0) { + dprintf("Error getting device path\n"); + return NULL; + } + + device = sysfs_open_device(device_path); + if (device == NULL) { + dprintf("Error opening device %s\n", bus_id); return NULL; } - cur = rootdev->directory->subdirs; - while (cur != NULL) { - new = sysfs_open_device_tree(cur->path); - if (new == NULL) { - dprintf(stderr, "Error opening device tree at %s\n", - cur->path); - sysfs_close_device_tree(rootdev); - return NULL; + + return device; +} + +/** + * get_device_absolute_path: looks up the bus the device is on, gets + * absolute path to the device + * @device: device for which path is needed + * @path: buffer to store absolute path + * @psize: size of "path" + * Returns 0 on success -1 on failure + */ +static int get_device_absolute_path(const unsigned char *device, + unsigned char *path, size_t psize) +{ + unsigned char bus_name[SYSFS_NAME_LEN], bus_path[SYSFS_PATH_MAX]; + + if (device == NULL || path == NULL) { + errno = EINVAL; + return -1; + } + + memset(bus_name, 0, SYSFS_NAME_LEN); + memset(bus_path, 0, SYSFS_NAME_LEN); + if ((sysfs_find_device_bus(device, bus_name, SYSFS_NAME_LEN)) != 0) { + dprintf("Device %s not found\n", device); + return -1; + } + if (sysfs_get_mnt_path(bus_path, SYSFS_PATH_MAX) != 0) { + dprintf ("Sysfs not supported on this system\n"); + return -1; + } + strcat(bus_path, SYSFS_BUS_DIR); + strcat(bus_path, "/"); + strcat(bus_path, bus_name); + strcat(bus_path, SYSFS_DEVICES_DIR); + strcat(bus_path, "/"); + strcat(bus_path, device); + /* + * We now are at /sys/bus/"bus_name"/devices/"device" which is a link. + * Now read this link to reach to the device. + */ + if ((sysfs_get_link(bus_path, path, SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting to device %s\n", device); + return -1; + } + return 0; +} + +/** + * sysfs_write_device_attr: modify a "writable" attribute for the given device + * @dev: device bus_id for which attribute has to be changed + * @attrib: attribute to change + * @value: value to change to + * @len: "value" length to write + * Returns 0 on success -1 on error + */ +int sysfs_write_device_attr(unsigned char *dev, unsigned char *attrib, + unsigned char *value, size_t len) +{ + struct sysfs_attribute *attribute = NULL; + unsigned char devpath[SYSFS_PATH_MAX]; + + if (dev == NULL || attrib == NULL || value == NULL) { + errno = EINVAL; + return -1; + } + + memset(devpath, 0, SYSFS_PATH_MAX); + if ((get_device_absolute_path(dev, devpath, SYSFS_PATH_MAX)) != 0) { + dprintf("Error finding absolute path to device %s\n", dev); + return -1; + } + strcat(devpath, "/"); + strcat(devpath, attrib); + attribute = sysfs_open_attribute(devpath); + if (attribute == NULL) { + dprintf("Attribute %s could not be retrieved for device %s\n", + attrib, dev); + return -1; + } + if (attribute->method & SYSFS_METHOD_SHOW) { + if ((sysfs_read_attribute(attribute)) != 0) { + dprintf("Error reading attribute %s for device %s\n", + attrib, dev); + sysfs_close_attribute(attribute); + return -1; } - add_device_child_to_parent(rootdev, new); - cur = cur->next; } + if ((sysfs_write_attribute(attribute, value, len)) < 0) { + dprintf("Error setting %s to %s\n", attrib, value); + sysfs_close_attribute(attribute); + return -1; + } + sysfs_close_attribute(attribute); + return 0; +} - return rootdev; +/** + * sysfs_read_device_attr: read an attribute of the given device + * @dev: device bus_id for which attribute has to be changed + * @attrib: attribute to read + * @value: buffer to return value in + * @len: size of buffer available + * Returns 0 on success -1 on error + */ +int sysfs_read_device_attr(unsigned char *dev, unsigned char *attrib, + unsigned char *value, size_t len) +{ + struct sysfs_attribute *attribute = NULL; + unsigned char devpath[SYSFS_PATH_MAX]; + + if (dev == NULL || attrib == NULL || value == NULL) { + errno = EINVAL; + return -1; + } + + memset(devpath, 0, SYSFS_PATH_MAX); + if ((get_device_absolute_path(dev, devpath, SYSFS_PATH_MAX)) != 0) { + dprintf("Error finding absolute path to device %s\n", dev); + return -1; + } + strcat(devpath, "/"); + strcat(devpath, attrib); + attribute = sysfs_open_attribute(devpath); + if (attribute == NULL) { + dprintf("Error opening attribute %s for device %s\n", + attrib, dev); + return -1; + } + if (!(attribute->method & SYSFS_METHOD_SHOW)) { + dprintf("Show method not supported for attribute %s\n", + attrib); + sysfs_close_attribute(attribute); + return -1; + } + if ((sysfs_read_attribute(attribute)) != 0) { + dprintf("Error reading attribute %s for device %s\n", + attrib, dev); + sysfs_close_attribute(attribute); + return -1; + } + if (attribute->len > len) { + dprintf("Value length %d is larger than supplied buffer %d\n", + attribute->len, len); + sysfs_close_attribute(attribute); + return -1; + } + strncpy(value, attribute->value, attribute->len); + value[(attribute->len)+1] = 0; + sysfs_close_attribute(attribute); + return 0; } diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index a83c81f493..ff2edf4615 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -3,7 +3,7 @@ * * Directory utility functions for libsysfs * - * Copyright (C) 2003 International Business Machines, Inc. + * Copyright (C) IBM Corp. 2003 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,6 +23,81 @@ #include "libsysfs.h" #include "sysfs.h" +/** + * sysfs_del_attribute: routine for dlist integration + */ +static void sysfs_del_attribute(void *attr) +{ + sysfs_close_attribute((struct sysfs_attribute *)attr); +} + +/** + * sysfs_del_link: routine for dlist integration + */ +static void sysfs_del_link(void *ln) +{ + sysfs_close_link((struct sysfs_link *)ln); +} + +/** + * sysfs_del_dir: routine for dlist integration + */ +static void sysfs_del_directory(void *dir) +{ + sysfs_close_directory((struct sysfs_directory *)dir); +} + +/** + * dir_attribute_name_equal: compares dir attributes by name + * @a: attribute name for comparison + * @b: sysfs_attribute to be compared. + * returns 1 if a==b->name or 0 if not equal + */ +static int dir_attribute_name_equal(void *a, void *b) +{ + if (a == NULL || b == NULL) + return 0; + + if (strcmp(((unsigned char *)a), ((struct sysfs_attribute *)b)->name) + == 0) + return 1; + return 0; +} + +/** + * dir_link_name_equal: compares dir links by name + * @a: link name for comparison + * @b: sysfs_link to be compared. + * returns 1 if a==b->name or 0 if not equal + */ +static int dir_link_name_equal(void *a, void *b) +{ + if (a == NULL || b == NULL) + return 0; + + if (strcmp(((unsigned char *)a), ((struct sysfs_link *)b)->name) + == 0) + return 1; + return 0; +} + +/** + * dir_subdir_name_equal: compares subdirs by name + * @a: name of subdirectory to compare + * @b: sysfs_directory subdirectory to be compared + * returns 1 if a==b->name or 0 if not equal + */ +static int dir_subdir_name_equal(void *a, void *b) +{ + if (a == NULL || b == NULL) + return 0; + + if (strcmp(((unsigned char *)a), ((struct sysfs_directory *)b)->name) + == 0) + return 1; + return 0; +} + /** * sysfs_close_attribute: closes and cleans up attribute * @sysattr: attribute to close. @@ -51,7 +126,7 @@ static struct sysfs_attribute *alloc_attribute(void) * @path: path to attribute. * returns sysfs_attribute struct with success and NULL with error. */ -struct sysfs_attribute *sysfs_open_attribute(const char *path) +struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path) { struct sysfs_attribute *sysattr = NULL; struct stat fileinfo; @@ -62,13 +137,22 @@ struct sysfs_attribute *sysfs_open_attribute(const char *path) } sysattr = alloc_attribute(); if (sysattr == NULL) { - dprintf(stderr, "Error allocating attribute at %s\n", path); + dprintf("Error allocating attribute at %s\n", path); + return NULL; + } + if (sysfs_get_name_from_path(path, sysattr->name, SYSFS_NAME_LEN) + != 0) { + dprintf("Error retrieving attribute name from path: %s\n", + path); + sysfs_close_attribute(sysattr); return NULL; } strncpy(sysattr->path, path, sizeof(sysattr->path)); if ((stat(sysattr->path, &fileinfo)) != 0) { - perror("stat"); + dprintf("Stat failed: No such attribute?\n"); sysattr->method = 0; + free(sysattr); + sysattr = NULL; } else { if (fileinfo.st_mode & S_IRUSR) sysattr->method |= SYSFS_METHOD_SHOW; @@ -79,6 +163,87 @@ struct sysfs_attribute *sysfs_open_attribute(const char *path) return sysattr; } +/** + * sysfs_write_attribute: write value to the attribute + * @sysattr: attribute to write + * @new_value: value to write + * @len: length of "new_value" + * returns 0 with success and -1 with error. + */ +int sysfs_write_attribute(struct sysfs_attribute *sysattr, + const unsigned char *new_value, size_t len) +{ + int fd; + int length; + + if (sysattr == NULL || new_value == NULL || len == 0) { + errno = EINVAL; + return -1; + } + + if (!(sysattr->method & SYSFS_METHOD_STORE)) { + dprintf ("Store method not supported for attribute %s\n", + sysattr->path); + return -1; + } + if (sysattr->method & SYSFS_METHOD_SHOW) { + if ((strncmp(sysattr->value, new_value, sysattr->len)) == 0) { + dprintf("Attribute %s already has the requested value %s\n", + sysattr->name, new_value); + return 0; + } + } + /* + * open O_WRONLY since some attributes have no "read" but only + * "write" permission + */ + if ((fd = open(sysattr->path, O_WRONLY)) < 0) { + dprintf("Error reading attribute %s\n", sysattr->path); + return -1; + } + + length = write(fd, new_value, len); + if (length < 0) { + dprintf("Error writing to the attribute %s - invalid value?\n", + sysattr->name); + close(fd); + return -1; + } else if (length != len) { + dprintf("Could not write %d bytes to attribute %s\n", + len, sysattr->name); + /* + * since we could not write user supplied number of bytes, + * restore the old value if one available + */ + if (sysattr->method & SYSFS_METHOD_SHOW) { + length = write(fd, sysattr->value, sysattr->len); + close(fd); + return -1; + } + } + + /* + * Validate length that has been copied. Alloc appropriate area + * in sysfs_attribute. Verify first if the attribute supports reading + * (show method). If it does not, do not bother + */ + if (sysattr->method & SYSFS_METHOD_SHOW) { + if (length != sysattr->len) { + sysattr->value = (char *)realloc(sysattr->value, + length); + sysattr->len = length; + strncpy(sysattr->value, new_value, length); + } else { + /*"length" of the new value is same as old one */ + strncpy(sysattr->value, new_value, length); + } + } + + close(fd); + return 0; +} + + /** * sysfs_read_attribute: reads value from attribute * @sysattr: attribute to read @@ -86,8 +251,8 @@ struct sysfs_attribute *sysfs_open_attribute(const char *path) */ int sysfs_read_attribute(struct sysfs_attribute *sysattr) { - char *fbuf = NULL; - char *vbuf = NULL; + unsigned char *fbuf = NULL; + unsigned char *vbuf = NULL; size_t length = 0; int pgsize = 0; int fd; @@ -97,34 +262,33 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) return -1; } if (!(sysattr->method & SYSFS_METHOD_SHOW)) { - dprintf (stderr, "Show method not supported for attribute %s\n", + dprintf("Show method not supported for attribute %s\n", sysattr->path); return -1; } pgsize = getpagesize(); - fbuf = (char *)calloc(1, pgsize+1); + fbuf = (unsigned char *)calloc(1, pgsize+1); if (fbuf == NULL) { - perror("calloc"); + dprintf("calloc failed\n"); return -1; } if ((fd = open(sysattr->path, O_RDONLY)) < 0) { - dprintf (stderr, "Error reading attribute %s\n", sysattr->path); + dprintf("Error reading attribute %s\n", sysattr->path); free(fbuf); return -1; } length = read(fd, fbuf, pgsize); if (length < 0) { - dprintf (stderr, "Error reading from attribute %s\n", - sysattr->path); + dprintf("Error reading from attribute %s\n", sysattr->path); close(fd); free(fbuf); return -1; } sysattr->len = length; close(fd); - vbuf = (char *)realloc(fbuf, length+1); + vbuf = (unsigned char *)realloc(fbuf, length+1); if (vbuf == NULL) { - perror("realloc"); + dprintf("realloc failed\n"); free(fbuf); return -1; } @@ -142,7 +306,8 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) * @vsize: size of value buffer * returns 0 with success and -1 with error. */ -int sysfs_read_attribute_value(const char *attrpath, char *value, size_t vsize) +int sysfs_read_attribute_value(const unsigned char *attrpath, + unsigned char *value, size_t vsize) { struct sysfs_attribute *attr = NULL; size_t length = 0; @@ -154,19 +319,18 @@ int sysfs_read_attribute_value(const char *attrpath, char *value, size_t vsize) attr = sysfs_open_attribute(attrpath); if (attr == NULL) { - dprintf(stderr, "Invalid attribute path %s\n", attrpath); + dprintf("Invalid attribute path %s\n", attrpath); errno = EINVAL; return -1; } if((sysfs_read_attribute(attr)) != 0 || attr->value == NULL) { - dprintf(stderr, "Error reading from attribute %s\n", attrpath); + dprintf("Error reading from attribute %s\n", attrpath); sysfs_close_attribute(attr); return -1; } length = strlen(attr->value); if (length > vsize) - dprintf(stderr, - "Value length %d is larger than supplied buffer %d\n", + dprintf("Value length %d is larger than supplied buffer %d\n", length, vsize); strncpy(value, attr->value, vsize); sysfs_close_attribute(attr); @@ -179,87 +343,32 @@ int sysfs_read_attribute_value(const char *attrpath, char *value, size_t vsize) * attribute name, return its value * @attr: attribute to search * @name: name to look for - * returns char * value - could be NULL + * returns unsigned char * value - could be NULL */ -char *sysfs_get_value_from_attributes(struct sysfs_attribute *attr, - const char *name) +unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, + const unsigned char *name) { struct sysfs_attribute *cur = NULL; - char tmpname[SYSFS_NAME_LEN]; if (attr == NULL || name == NULL) { errno = EINVAL; return NULL; - } - cur = attr; - while (cur != NULL) { - memset(tmpname, 0, SYSFS_NAME_LEN); - if ((sysfs_get_name_from_path(cur->path, tmpname, - SYSFS_NAME_LEN)) != 0) { - cur = cur->next; - continue; - } - if (strcmp(tmpname, name) == 0) + } + dlist_for_each_data(attr, cur, struct sysfs_attribute) { + if (strcmp(cur->name, name) == 0) return cur->value; - cur = cur->next; } return NULL; } /** - * add_subdir_to_dir: adds subdirectory to directory's subdirs - * @sysdir: directory to add subdir to - * @subdir: subdirectory to add. + * sysfs_close_link: closes and cleans up link. + * @ln: link to close. */ -static void add_subdir_to_dir(struct sysfs_directory *sysdir, - struct sysfs_directory *subdir) +void sysfs_close_link(struct sysfs_link *ln) { - if (sysdir != NULL && subdir != NULL) { - subdir->next = sysdir->subdirs; - sysdir->subdirs = subdir; - } -} - -/** - * add_attr_to_dir: adds attribute to directory's attributes - * @sysdir: directory to add attribute to - * @sysattr: attribute to add. - */ -static void add_attr_to_dir(struct sysfs_directory *sysdir, - struct sysfs_attribute *sysattr) -{ - if (sysdir != NULL && sysattr != NULL) { - sysattr->next = sysdir->attributes; - sysdir->attributes = sysattr; - } -} - -/** - * sysfs_close_dlink: closes and cleans up directory link. - * @dlink: directory link to close. - */ -void sysfs_close_dlink(struct sysfs_dlink *dlink) -{ - if (dlink != NULL) { - dlink->next = NULL; - if (dlink->target != NULL) - sysfs_close_directory(dlink->target); - free(dlink); - } -} - -/** - * add_dlink_to_dir: adds directory link to directory's links list. - * @sysdir: directory to add it to. - * @dlink: link to add. - */ -static void add_dlink_to_dir(struct sysfs_directory *sysdir, - struct sysfs_dlink *dlink) -{ - if (sysdir != NULL && dlink != NULL) { - dlink->next = sysdir->links; - sysdir->links = dlink; - } + if (ln != NULL) + free(ln); } /** @@ -268,35 +377,13 @@ static void add_dlink_to_dir(struct sysfs_directory *sysdir, */ void sysfs_close_directory(struct sysfs_directory *sysdir) { - struct sysfs_directory *sdir = NULL, *dnext = NULL; - struct sysfs_dlink *dlink = NULL, *nextl = NULL; - struct sysfs_attribute *attr = NULL, *anext = NULL; - if (sysdir != NULL) { - if (sysdir->subdirs != NULL) { - for (sdir = sysdir->subdirs; sdir != NULL; - sdir = dnext) { - dnext = sdir->next; - sysfs_close_directory(sdir); - } - } - if (sysdir->links != NULL) { - for (dlink = sysdir->links; dlink != NULL; - dlink = nextl) { - nextl = dlink->next; - sysfs_close_dlink(dlink); - } - } - if (sysdir->attributes != NULL) { - for (attr = sysdir->attributes; attr != NULL; - attr = anext) { - anext = attr->next; - /* sysfs_close_attribute(attr); */ - if (attr->value != NULL) - free(attr->value); - free(attr); - } - } + if (sysdir->subdirs != NULL) + dlist_destroy(sysdir->subdirs); + if (sysdir->links != NULL) + dlist_destroy(sysdir->links); + if (sysdir->attributes != NULL) + dlist_destroy(sysdir->attributes); free(sysdir); } } @@ -312,12 +399,35 @@ static struct sysfs_directory *alloc_directory(void) } /** - * alloc_dlink: allocates and initializes directory link structure - * returns struct sysfs_dlink with success or NULL with error. + * alloc_link: allocates and initializes link structure + * returns struct sysfs_link with success or NULL with error. + */ +static struct sysfs_link *alloc_link(void) +{ + return (struct sysfs_link *)calloc(1, sizeof(struct sysfs_link)); +} + +/** + * sysfs_read_all_subdirs: calls sysfs_read_directory for all subdirs + * @sysdir: directory whose subdirs need reading. + * returns 0 with success and -1 with error. */ -static struct sysfs_dlink *alloc_dlink(void) +int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) { - return (struct sysfs_dlink *)calloc(1, sizeof(struct sysfs_dlink)); + struct sysfs_directory *cursub = NULL; + + if (sysdir == NULL) { + errno = EINVAL; + return -1; + } + if (sysdir->subdirs == NULL) + return 0; + dlist_for_each_data(sysdir->subdirs, cursub, struct sysfs_directory) { + if (sysfs_read_directory(cursub) != 0) + dprintf ("Error reading subdirectory %s\n", + cursub->name); + } + return 0; } /** @@ -326,7 +436,7 @@ static struct sysfs_dlink *alloc_dlink(void) * @path: path of directory to open. * returns: struct sysfs_directory * with success and NULL on error. */ -struct sysfs_directory *sysfs_open_directory(const char *path) +struct sysfs_directory *sysfs_open_directory(const unsigned char *path) { struct sysfs_directory *sdir = NULL; @@ -336,7 +446,12 @@ struct sysfs_directory *sysfs_open_directory(const char *path) } sdir = alloc_directory(); if (sdir == NULL) { - dprintf(stderr, "Error allocating directory %s\n", path); + dprintf("Error allocating directory %s\n", path); + return NULL; + } + if (sysfs_get_name_from_path(path, sdir->name, SYSFS_NAME_LEN) != 0) { + dprintf("Error getting directory name from path: %s\n", path); + sysfs_close_directory(sdir); return NULL; } strncpy(sdir->path, path, sizeof(sdir->path)); @@ -345,46 +460,33 @@ struct sysfs_directory *sysfs_open_directory(const char *path) } /** - * sysfs_open_dlink: opens a sysfs directory link, creates struct, and returns + * sysfs_open_link: opens a sysfs link, creates struct, and returns * @path: path of link to open. - * returns: struct sysfs_dlink * with success and NULL on error. + * returns: struct sysfs_link * with success and NULL on error. */ -struct sysfs_dlink *sysfs_open_dlink(const char *linkpath) +struct sysfs_link *sysfs_open_link(const unsigned char *linkpath) { - struct sysfs_dlink *dlink = NULL; - struct sysfs_directory *tdir = NULL; - char name[SYSFS_NAME_LEN]; - char target[SYSFS_PATH_MAX]; + struct sysfs_link *ln = NULL; - if (linkpath == NULL) { + if (linkpath == NULL || strlen(linkpath) > SYSFS_PATH_MAX) { errno = EINVAL; return NULL; } - memset(name, 0, SYSFS_NAME_LEN); - memset(target, 0, SYSFS_PATH_MAX); - if ((sysfs_get_name_from_path(linkpath, name, SYSFS_NAME_LEN)) != 0 - || (sysfs_get_link(linkpath, target, SYSFS_PATH_MAX)) != 0) { - errno = EINVAL; - dprintf(stderr, "Invalid link path %s\n", linkpath); + ln = alloc_link(); + if (ln == NULL) { + dprintf("Error allocating link %s\n", linkpath); return NULL; } - dlink = alloc_dlink(); - if (dlink == NULL) { - dprintf(stderr, - "Error allocating directory link %s\n", linkpath); + strcpy(ln->path, linkpath); + if ((sysfs_get_name_from_path(linkpath, ln->name, SYSFS_NAME_LEN)) != 0 + || (sysfs_get_link(linkpath, ln->target, SYSFS_PATH_MAX)) != 0) { + errno = EINVAL; + dprintf("Invalid link path %s\n", linkpath); return NULL; } - strcpy(dlink->name, name); - tdir = sysfs_open_directory(target); - if (tdir == NULL) { - dprintf(stderr, "Invalid directory link target %s\n", target); - sysfs_close_dlink(dlink); - return NULL; - } - dlink->target = tdir; - return dlink; + return ln; } /** @@ -399,8 +501,8 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) struct stat astats; struct sysfs_attribute *attr = NULL; struct sysfs_directory *subdir = NULL; - struct sysfs_dlink *dlink = NULL; - char file_path[SYSFS_PATH_MAX]; + struct sysfs_link *ln = NULL; + unsigned char file_path[SYSFS_PATH_MAX]; int retval = 0; if (sysdir == NULL) { @@ -409,7 +511,7 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) } dir = opendir(sysdir->path); if (dir == NULL) { - perror("opendir"); + dprintf("Error opening directory %s\n", sysdir->path); return -1; } while(((dirent = readdir(dir)) != NULL) && retval == 0) { @@ -422,45 +524,57 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) strncat(file_path, "/", sizeof(file_path)); strncat(file_path, dirent->d_name, sizeof(file_path)); if ((lstat(file_path, &astats)) != 0) { - perror("stat"); + dprintf("stat failed\n"); continue; } if (S_ISREG(astats.st_mode)) { attr = sysfs_open_attribute(file_path); if (attr == NULL) { - dprintf (stderr, "Error opening attribute %s\n", + dprintf("Error opening attribute %s\n", file_path); retval = -1; break; } if (attr->method & SYSFS_METHOD_SHOW) { if ((sysfs_read_attribute(attr)) != 0) { - dprintf (stderr, - "Error reading attribute %s\n", + dprintf("Error reading attribute %s\n", file_path); sysfs_close_attribute(attr); continue; } } - add_attr_to_dir(sysdir, attr); + + if (sysdir->attributes == NULL) { + sysdir->attributes = dlist_new_with_delete + (sizeof(struct sysfs_attribute), + sysfs_del_attribute); + } + dlist_unshift(sysdir->attributes, attr); } else if (S_ISDIR(astats.st_mode)) { subdir = sysfs_open_directory(file_path); if (subdir == NULL) { - dprintf (stderr, "Error opening directory %s\n", + dprintf("Error opening directory %s\n", file_path); retval = -1; break; } - add_subdir_to_dir(sysdir, subdir); + if (sysdir->subdirs == NULL) + sysdir->subdirs = dlist_new_with_delete + (sizeof(struct sysfs_directory), + sysfs_del_directory); + dlist_unshift(sysdir->subdirs, subdir); } else if (S_ISLNK(astats.st_mode)) { - dlink = sysfs_open_dlink(file_path); - if (dlink == NULL) { - dprintf(stderr, "Error opening link %s\n", - file_path); + ln = sysfs_open_link(file_path); + if (ln == NULL) { + dprintf("Error opening link %s\n", file_path); retval = -1; break; } - add_dlink_to_dir(sysdir, dlink); + if (sysdir->links == NULL) + sysdir->links = dlist_new_with_delete + (sizeof(struct sysfs_link), + sysfs_del_link); + dlist_unshift(sysdir->links, ln); } } closedir(dir); @@ -468,29 +582,123 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) } /** - * sysfs_read_dlinks: reads a directory link's target directory. Can - * supply a linked list of links. - * @dlink: directory link to read. - * returns 0 with success or -1 with error. + * sysfs_get_directory_attribute: retrieves attribute attrname + * @dir: directory to retrieve attribute from + * @attrname: name of attribute to look for + * returns sysfs_attribute if found and NULL if not found */ -int sysfs_read_dlinks(struct sysfs_dlink *dlink) +struct sysfs_attribute *sysfs_get_directory_attribute + (struct sysfs_directory *dir, unsigned char *attrname) { - struct sysfs_dlink *cur = NULL; + struct sysfs_directory *sdir = NULL; + struct sysfs_attribute *attr = NULL; + + if (dir == NULL || attrname == NULL) { + errno = EINVAL; + return NULL; + } + + attr = (struct sysfs_attribute *)dlist_find_custom(dir->attributes, + attrname, dir_attribute_name_equal); + if (attr != NULL) + return attr; + + if (dir->subdirs != NULL) { + dlist_for_each_data(dir->subdirs, sdir, + struct sysfs_directory) { + if (sdir->attributes == NULL) + continue; + attr = sysfs_get_directory_attribute(sdir, attrname); + if (attr != NULL) + return attr; + } + } + return NULL; +} - if (dlink == NULL || dlink->target == NULL) { +/** + * sysfs_get_directory_link: retrieves link from one directory list + * @dir: directory to retrieve link from + * @linkname: name of link to look for + * returns reference to sysfs_link if found and NULL if not found + */ +struct sysfs_link *sysfs_get_directory_link + (struct sysfs_directory *dir, unsigned char *linkname) +{ + if (dir == NULL || linkname == NULL) { errno = EINVAL; - return -1; + return NULL; } - cur = dlink; - while (cur != NULL) { - if ((sysfs_read_directory(cur->target)) != 0) { - dprintf(stderr, - "Error reading directory link target %s\n", - dlink->name); - return -1; + return (struct sysfs_link *)dlist_find_custom(dir->links, + linkname, dir_link_name_equal); +} + +/** + * sysfs_get_subdirectory: retrieves subdirectory by name. + * @dir: directory to search for subdirectory. + * @subname: subdirectory name to get. + * returns reference to subdirectory or NULL if not found + */ +struct sysfs_directory *sysfs_get_subdirectory(struct sysfs_directory *dir, + unsigned char *subname) +{ + struct sysfs_directory *sub = NULL, *cursub = NULL; + + if (dir == NULL || dir->subdirs == NULL || subname == NULL) { + errno = EINVAL; + return NULL; + } + sub = (struct sysfs_directory *)dlist_find_custom(dir->subdirs, + subname, dir_subdir_name_equal); + if (sub != NULL) + return sub; + + if (dir->subdirs != NULL) { + dlist_for_each_data(dir->subdirs, cursub, + struct sysfs_directory) { + if (cursub->subdirs == NULL) + continue; + sub = sysfs_get_subdirectory(cursub, subname); + if (sub != NULL) + return sub; } - cur = cur->next; } - - return 0; + return NULL; +} + +/** + * sysfs_get_subdirectory_link: looks through all subdirs for specific link. + * @dir: directory and subdirectories to search for link. + * @linkname: link name to get. + * returns reference to link or NULL if not found + */ +struct sysfs_link *sysfs_get_subdirectory_link(struct sysfs_directory *dir, + unsigned char *linkname) +{ + struct sysfs_directory *cursub = NULL; + struct sysfs_link *ln = NULL; + + if (dir == NULL || dir->links == NULL || linkname == NULL) { + errno = EINVAL; + return NULL; + } + + ln = sysfs_get_directory_link(dir, linkname); + if (ln != NULL) + return ln; + + if (dir->subdirs == NULL) + return NULL; + + if (dir->subdirs != NULL) { + dlist_for_each_data(dir->subdirs, cursub, + struct sysfs_directory) { + if (cursub->subdirs == NULL) + continue; + ln = sysfs_get_subdirectory_link(cursub, linkname); + if (ln != NULL) + return ln; + } + } + return NULL; } diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index 6813c85f14..f8e842c65c 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -3,7 +3,7 @@ * * Driver utility functions for libsysfs * - * Copyright (C) 2003 International Business Machines, Inc. + * Copyright (C) IBM Corp. 2003 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,19 +23,46 @@ #include "libsysfs.h" #include "sysfs.h" +static void sysfs_close_driver_by_name_dev(void *device) +{ + sysfs_close_device((struct sysfs_device *)device); +} + /** * sysfs_close_driver: closes and cleans up driver structure + * NOTE: This routine does not deallocate devices list * @driver: driver to close */ void sysfs_close_driver(struct sysfs_driver *driver) { if (driver != NULL) { + if (driver->devices != NULL) { + dlist_for_each(driver->devices) + dlist_shift(driver->devices); + free(driver->devices); + driver->devices = NULL; + } if (driver->directory != NULL) sysfs_close_directory(driver->directory); free(driver); } } +/** + * sysfs_close_driver_by_name: closes driver and deletes device lists too + * @driver: driver to close + */ +void sysfs_close_driver_by_name(struct sysfs_driver *driver) +{ + if (driver != NULL) { + if (driver->devices != NULL) + dlist_destroy(driver->devices); + if (driver->directory != NULL) + sysfs_close_directory(driver->directory); + free(driver); + } +} + /** * alloc_driver: allocates and initializes driver * returns struct sysfs_driver with success and NULL with error. @@ -50,11 +77,10 @@ static struct sysfs_driver *alloc_driver(void) * @path: path to driver directory * returns struct sysfs_driver with success and NULL with error */ -struct sysfs_driver *sysfs_open_driver(const char *path) +struct sysfs_driver *sysfs_open_driver(const unsigned char *path) { struct sysfs_driver *driver = NULL; struct sysfs_directory *sdir = NULL; - char devname[SYSFS_NAME_LEN]; if (path == NULL) { errno = EINVAL; @@ -62,28 +88,280 @@ struct sysfs_driver *sysfs_open_driver(const char *path) } sdir = sysfs_open_directory(path); if (sdir == NULL) { - dprintf (stderr, "Error opening directory %s\n", path); + dprintf("Error opening directory %s\n", path); return NULL; } if ((sysfs_read_directory(sdir)) != 0) { - dprintf (stderr, "Error reading directory %s\n", path); + dprintf("Error reading directory %s\n", path); sysfs_close_directory(sdir); return NULL; } driver = alloc_driver(); if (driver == NULL) { - dprintf(stderr, "Error allocating driver at %s\n", path); + dprintf("Error allocating driver at %s\n", path); sysfs_close_directory(sdir); return NULL; } - if ((sysfs_get_name_from_path(path, devname, SYSFS_NAME_LEN)) != 0) { - dprintf (stderr, "Error reading directory %s\n", path); - sysfs_close_directory(sdir); - free(driver); - return NULL; - } - strncpy(driver->name, devname, sizeof(driver->name)); + strcpy(driver->name, sdir->name); driver->directory = sdir; + strcpy(driver->path, sdir->path); return driver; } + +/** + * sysfs_get_driver_attributes: gets list of attributes for the given driver + * @driver: sysfs_driver for which attributes are required + * returns a dlist of attributes corresponding to the driver if present + * NULL otherwise + */ +struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) +{ + if (driver == NULL || driver->directory == NULL) + return NULL; + + return(driver->directory->attributes); +} + +/** + * sysfs_get_driver_attr: searches driver's attributes by name + * @drv: driver to look through + * @name: attribute name to get + * returns sysfs_attribute reference on success or NULL with error + */ +struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, + const unsigned char *name) +{ + struct sysfs_attribute *cur = NULL; + + if (drv == NULL || drv->directory == NULL + || drv->directory->attributes == NULL || name == NULL) { + errno = EINVAL; + return NULL; + } + + cur = sysfs_get_directory_attribute(drv->directory, + (unsigned char *)name); + if (cur != NULL) + return cur; + + return NULL; +} + +/** + * sysfs_get_driver_links: gets list of links from the given driver + * @driver: sysfs_driver for which links list is required + * returns a dlist of links corresponding to the driver if present + * NULL otherwise + */ +struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver) +{ + if (driver == NULL || driver->directory == NULL) + return NULL; + + return(driver->directory->links); +} + +/** + * sysfs_open_driver_by_name: open a driver by name and return the bus + * the driver is on. + * @drv_name: driver to open + * @bus: the driver bus + * @bsize: size of bus buffer + * returns struct sysfs_driver if found, NULL otherwise + * NOTE: + * 1. Need to call sysfs_close_driver_by_name to free up memory + * 2. Bus the driver is registered with must be supplied. + * Use sysfs_find_driver_bus() to obtain the bus name + */ +struct sysfs_driver *sysfs_open_driver_by_name(const unsigned char *drv_name, + const unsigned char *bus, size_t bsize) +{ + struct sysfs_driver *driver = NULL; + struct sysfs_device *device = NULL; + struct sysfs_link *curlink = NULL; + unsigned char path[SYSFS_PATH_MAX]; + + if (drv_name == NULL || bus == NULL) { + errno = EINVAL; + return NULL; + } + + memset(path, 0, SYSFS_PATH_MAX); + if (sysfs_get_mnt_path(path, SYSFS_PATH_MAX) != 0) { + dprintf("Error getting sysfs mount path\n"); + return NULL; + } + strcat(path, SYSFS_BUS_DIR); + strcat(path, "/"); + strcat(path, bus); + strcat(path, SYSFS_DRIVERS_DIR); + strcat(path, "/"); + strcat(path, drv_name); + driver = sysfs_open_driver(path); + if (driver == NULL) { + dprintf("Could not open driver %s\n", drv_name); + return NULL; + } + if (driver->directory->links != NULL) { + dlist_for_each_data(driver->directory->links, curlink, + struct sysfs_link) { + device = sysfs_open_device(curlink->target); + if (device == NULL) { + dprintf("Error opening device at %s\n", + curlink->target); + sysfs_close_driver_by_name(driver); + return NULL; + } + strcpy(device->driver_name, drv_name); + if (driver->devices == NULL) + driver->devices = dlist_new_with_delete + (sizeof(struct sysfs_device), + sysfs_close_driver_by_name_dev); + dlist_unshift(driver->devices, device); + } + } + return driver; +} + +/** + * get_driver_path: looks up the bus the driver is on and builds path to + * the driver. + * @drv: driver to look for + * @path: buffer to return path to driver + * @psize: size of "path" + * Returns 0 on success and -1 on error + */ +static int get_driver_path(const unsigned char *drv, + unsigned char *path, size_t psize) +{ + unsigned char bus_name[SYSFS_NAME_LEN]; + + if (drv == NULL || path == NULL) { + errno = EINVAL; + return -1; + } + memset(bus_name, 0, SYSFS_NAME_LEN); + memset(path, 0, SYSFS_PATH_MAX); + if ((sysfs_find_driver_bus(drv, bus_name, SYSFS_NAME_LEN)) < 0) { + dprintf("Driver %s not found\n", drv); + return -1; + } + if (sysfs_get_mnt_path(path, SYSFS_PATH_MAX) != 0) { + dprintf("Error getting sysfs mount path\n"); + return -1; + } + strcat(path, SYSFS_BUS_DIR); + strcat(path, "/"); + strcat(path, bus_name); + strcat(path, SYSFS_DRIVERS_DIR); + strcat(path, "/"); + strcat(path, drv); + fprintf(stdout, "get_driver_path %s\n", path); + return 0; +} + +/** + * sysfs_write_driver_attr: modify "writable" driver attribute + * @drv: driver whose attribute has to be modified + * @attrib: Attribute to be modified + * @value: Value to change to + * Returns 0 on success -1 on failure + */ +int sysfs_write_driver_attr(unsigned char *drv, unsigned char *attrib, + unsigned char *value, size_t len) +{ + struct sysfs_attribute *attribute = NULL; + unsigned char path[SYSFS_PATH_MAX]; + + if (drv == NULL || attrib == NULL || value == NULL) { + errno = EINVAL; + return -1; + } + + memset(path, 0, SYSFS_PATH_MAX); + if ((get_driver_path(drv, path, SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting to driver %s\n", drv); + return -1; + } + strcat(path, "/"); + strcat(path, attrib); + attribute = sysfs_open_attribute(path); + if (attribute == NULL) { + dprintf("Attribute %s could not be retrieved for driver %s\n", + attrib, drv); + return -1; + } + if (attribute->method & SYSFS_METHOD_SHOW) { + if ((sysfs_read_attribute(attribute)) != 0) { + dprintf("Error reading attribute %s for driver %s\n", + attrib, drv); + sysfs_close_attribute(attribute); + return -1; + } + } + if ((sysfs_write_attribute(attribute, value, len)) < 0) { + dprintf("Error setting %s to %s\n", attrib, value); + sysfs_close_attribute(attribute); + return -1; + } + sysfs_close_attribute(attribute); + return 0; +} + +/** + * sysfs_read_driver_attr: read the user supplied driver attribute + * @drv: driver whose attribute has to be read + * @attrib: Attribute to be read + * @value: Buffer to return the read value + * @len: Length of the buffer "value" + * Returns 0 on success -1 on failure + */ +int sysfs_read_driver_attr(unsigned char *drv, unsigned char *attrib, + unsigned char *value, size_t len) +{ + struct sysfs_attribute *attribute = NULL; + unsigned char path[SYSFS_PATH_MAX]; + + if (drv == NULL || attrib == NULL || value == NULL) { + errno = EINVAL; + return -1; + } + + memset(path, 0, SYSFS_NAME_LEN); + if ((get_driver_path(drv, path, SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting to driver %s\n", drv); + return -1; + } + strcat(path, "/"); + strcat(path, attrib); + attribute = sysfs_open_attribute(path); + if (attribute == NULL) { + dprintf("Error opening attribute %s for driver %s\n", + attrib, drv); + return -1; + } + if (!(attribute->method & SYSFS_METHOD_SHOW)) { + dprintf("Show method not supported for attribute %s\n", + attrib); + sysfs_close_attribute(attribute); + return -1; + } + if ((sysfs_read_attribute(attribute)) != 0) { + dprintf("Error reading attribute %s for driver %s\n", + attrib, drv); + sysfs_close_attribute(attribute); + return -1; + } + if (attribute->len > len) { + dprintf("Value length %d is larger than supplied buffer %d\n", + attribute->len, len); + sysfs_close_attribute(attribute); + return -1; + } + strncpy(value, attribute->value, attribute->len); + value[(attribute->len)+1] = 0; + sysfs_close_attribute(attribute); + return 0; +} + diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index a2410abe69..4475342433 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -3,7 +3,7 @@ * * System utility functions for libsysfs * - * Copyright (C) 2003 International Business Machines, Inc. + * Copyright (C) IBM Corp. 2003 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,8 +30,8 @@ * @len: size of mnt_path * returns 0 with success and -1 with error. */ -static int sysfs_get_fs_mnt_path(const char *fs_type, char *mnt_path, - size_t len) +static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, + unsigned char *mnt_path, size_t len) { FILE *mnt; struct mntent *mntent; @@ -45,7 +45,7 @@ static int sysfs_get_fs_mnt_path(const char *fs_type, char *mnt_path, } if ((mnt = setmntent(SYSFS_PROC_MNTS, "r")) == NULL) { - dprintf(stderr, "Error getting mount information\n"); + dprintf("Error getting mount information\n"); return -1; } while (ret == 0 && dirlen == 0 && (mntent = getmntent(mnt)) != NULL) { @@ -54,15 +54,14 @@ static int sysfs_get_fs_mnt_path(const char *fs_type, char *mnt_path, if (dirlen <= (len - 1)) { strcpy(mnt_path, mntent->mnt_dir); } else { - dprintf(stderr, - "Error - mount path too long\n"); + dprintf("Error - mount path too long\n"); ret = -1; } } } endmntent(mnt); if (dirlen == 0 && ret == 0) { - dprintf(stderr, "Filesystem %s not found!\n", fs_type); + dprintf("Filesystem %s not found!\n", fs_type); errno = EINVAL; ret = -1; } @@ -75,7 +74,7 @@ static int sysfs_get_fs_mnt_path(const char *fs_type, char *mnt_path, * @len: size of mnt_path * returns 0 with success and -1 with error. */ -int sysfs_get_mnt_path(char *mnt_path, size_t len) +int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len) { int ret = -1; @@ -93,9 +92,10 @@ int sysfs_get_mnt_path(char *mnt_path, size_t len) * @name: where to put name * @len: size of name */ -int sysfs_get_name_from_path(const char *path, char *name, size_t len) +int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, + size_t len) { - char *n = NULL; + unsigned char *n = NULL; if (path == NULL || name == NULL) { errno = EINVAL; @@ -118,11 +118,11 @@ int sysfs_get_name_from_path(const char *path, char *name, size_t len) * @target: where to put name * @len: size of name */ -int sysfs_get_link(const char *path, char *target, size_t len) +int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) { - char devdir[SYSFS_PATH_MAX]; - char linkpath[SYSFS_PATH_MAX]; - char *d = NULL; + unsigned char devdir[SYSFS_PATH_MAX]; + unsigned char linkpath[SYSFS_PATH_MAX]; + unsigned char *d = NULL; if (path == NULL || target == NULL) { errno = EINVAL; @@ -133,7 +133,7 @@ int sysfs_get_link(const char *path, char *target, size_t len) memset(linkpath, 0, SYSFS_PATH_MAX); if ((sysfs_get_mnt_path(devdir, SYSFS_PATH_MAX)) != 0) { - dprintf(stderr, "Sysfs not supported on this system\n"); + dprintf("Sysfs not supported on this system\n"); return -1; } @@ -154,3 +154,136 @@ int sysfs_get_link(const char *path, char *target, size_t len) return 0; } + + +/** + * sysfs_del_name: free function for sysfs_open_subsystem_list + * @name: memory area to be freed + */ +void sysfs_del_name(void *name) +{ + free(name); +} + + +/** + * sysfs_close_list: generic list free routine + * @list: dlist to free + * Returns nothing + */ +void sysfs_close_list(struct dlist *list) +{ + if (list != NULL) + dlist_destroy(list); +} + +/** + * sysfs_open_subsystem_list: gets a list of all supported "name" subsystem + * details from the system + * @name: name of the subsystem, eg., "bus", "class", "devices" + * Returns a dlist of supported names or NULL if subsystem not supported + */ +struct dlist *sysfs_open_subsystem_list(unsigned char *name) +{ + unsigned char sysfs_path[SYSFS_PATH_MAX], *subsys_name = NULL; + struct sysfs_directory *dir = NULL, *cur = NULL; + struct dlist *list = NULL; + + if (name == NULL) + return NULL; + + if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) { + dprintf("Error getting sysfs mount point\n"); + return NULL; + } + + strcat(sysfs_path, name); + dir = sysfs_open_directory(sysfs_path); + if (dir == NULL) { + dprintf("Error opening sysfs_directory at %s\n", sysfs_path); + return NULL; + } + + if (sysfs_read_directory(dir) != 0) { + dprintf("Error reading sysfs_directory at %s\n", sysfs_path); + sysfs_close_directory(dir); + return NULL; + } + + if (dir->subdirs != NULL) { + list = dlist_new_with_delete(SYSFS_NAME_LEN, + sysfs_del_name); + if (list == NULL) { + dprintf("Error creating list\n"); + sysfs_close_directory(dir); + return NULL; + } + + dlist_for_each_data(dir->subdirs, cur, + struct sysfs_directory) { + subsys_name = (char *)calloc(1, SYSFS_NAME_LEN); + strcpy(subsys_name, cur->name); + dlist_unshift(list, subsys_name); + } + } + sysfs_close_directory(dir); + return list; +} + + +/** + * sysfs_open_bus_devices_list: gets a list of all devices on "name" bus + * @name: name of the subsystem, eg., "pci", "scsi", "usb" + * Returns a dlist of supported names or NULL if subsystem not supported + */ +struct dlist *sysfs_open_bus_devices_list(unsigned char *name) +{ + unsigned char sysfs_path[SYSFS_PATH_MAX], *device_name = NULL; + struct sysfs_directory *dir = NULL; + struct sysfs_link *cur = NULL; + struct dlist *list = NULL; + + if (name == NULL) + return NULL; + + if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) { + dprintf("Error getting sysfs mount point\n"); + return NULL; + } + + strcat(sysfs_path, SYSFS_BUS_DIR); + strcat(sysfs_path, "/"); + strcat(sysfs_path, name); + strcat(sysfs_path, SYSFS_DEVICES_DIR); + dir = sysfs_open_directory(sysfs_path); + if (dir == NULL) { + dprintf("Error opening sysfs_directory at %s\n", sysfs_path); + return NULL; + } + + if (sysfs_read_directory(dir) != 0) { + dprintf("Error reading sysfs_directory at %s\n", sysfs_path); + sysfs_close_directory(dir); + return NULL; + } + + if (dir->links != NULL) { + list = dlist_new_with_delete(SYSFS_NAME_LEN, + sysfs_del_name); + if (list == NULL) { + dprintf("Error creating list\n"); + sysfs_close_directory(dir); + return NULL; + } + + dlist_for_each_data(dir->links, cur, + struct sysfs_link) { + device_name = (char *)calloc(1, SYSFS_NAME_LEN); + strcpy(device_name, cur->name); + dlist_unshift(list, device_name); + } + } + sysfs_close_directory(dir); + return list; +} + diff --git a/namedev.c b/namedev.c index ac05fd88e4..c21a5be7ad 100644 --- a/namedev.c +++ b/namedev.c @@ -547,7 +547,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at attr->mode = 0; if (class_dev->sysdevice) { - dbg_parse("class_dev->sysdevice->directory->path = '%s'", class_dev->sysdevice->directory->path); + dbg_parse("class_dev->sysdevice->path = '%s'", class_dev->sysdevice->path); dbg_parse("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); } else { dbg_parse("class_dev->name = '%s'", class_dev->name); @@ -557,19 +557,21 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at switch (dev->type) { case LABEL: { - char *temp; + struct sysfs_attribute *tmpattr = NULL; + struct sysfs_class_device *class_dev_parent = NULL; + char *temp = NULL; dbg_parse("LABEL: match file '%s' with value '%s'", dev->sysfs_file, dev->sysfs_value); /* try to find the attribute in the class device directory */ - temp = sysfs_get_value_from_attributes(class_dev->directory->attributes, dev->sysfs_file); - if (temp) + tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); + if (tmpattr) goto label_found; /* look in the class device device directory if present */ if (class_dev->sysdevice) { - temp = sysfs_get_value_from_attributes(class_dev->sysdevice->directory->attributes, dev->sysfs_file); - if (temp) + tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); + if (tmpattr) goto label_found; } @@ -577,14 +579,13 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at * as block partitions don't point to the physical device. Need to fix that * up in the kernel... */ - if (strstr(class_dev->directory->path, "block")) { + if (strstr(class_dev->path, "block")) { dbg_parse("looking at block device..."); - if (isdigit(class_dev->directory->path[strlen(class_dev->directory->path)-1])) { + if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { char path[SYSFS_PATH_MAX]; - struct sysfs_class_device *class_dev_parent; dbg_parse("really is a partition..."); - strcpy(path, class_dev->directory->path); + strcpy(path, class_dev->path); temp = strrchr(path, '/'); *temp = 0x00; dbg_parse("looking for a class device at '%s'", path); @@ -596,35 +597,36 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at dbg_parse("class_dev_parent->name = %s", class_dev_parent->name); /* try to find the attribute in the class device directory */ - temp = sysfs_get_value_from_attributes(class_dev_parent->directory->attributes, dev->sysfs_file); - if (temp) { - //sysfs_close_class_device(class_dev_parent); + tmpattr = sysfs_get_classdev_attr(class_dev_parent, dev->sysfs_file); + if (tmpattr) goto label_found; - } /* look in the class device device directory if present */ if (class_dev_parent->sysdevice) { - temp = sysfs_get_value_from_attributes(class_dev_parent->sysdevice->directory->attributes, dev->sysfs_file); - if (temp) { - // sysfs_close_class_device(class_dev_parent); + tmpattr = sysfs_get_classdev_attr(class_dev_parent, dev->sysfs_file); + if (tmpattr) goto label_found; - } } } } + if (class_dev_parent) + sysfs_close_class_device(class_dev_parent); + continue; label_found: - temp[strlen(temp)-1] = 0x00; - dbg_parse("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, temp, dev->sysfs_value); - if (strcmp(dev->sysfs_value, temp) != 0) + tmpattr->value[strlen(tmpattr->value)-1] = 0x00; + dbg_parse("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value); + if (strcmp(dev->sysfs_value, tmpattr->value) != 0) { + if (class_dev_parent) + sysfs_close_class_device(class_dev_parent); continue; + } strcpy(attr->name, dev->attr.name); - if (isdigit(class_dev->directory->path[strlen(class_dev->directory->path)-1])) { - temp[0] = class_dev->directory->path[strlen(class_dev->directory->path)-1]; - temp[1] = 0x00; + if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { + temp = &class_dev->path[strlen(class_dev->path)-1]; strcat(attr->name, temp); } if (dev->attr.mode != 0) { @@ -635,6 +637,8 @@ label_found: dbg_parse("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->sysfs_file, dev->sysfs_value, attr->name, dev->attr.owner, dev->attr.group, dev->attr.mode); + if (class_dev_parent) + sysfs_close_class_device(class_dev_parent); goto done; break; } @@ -646,7 +650,7 @@ label_found: found = 0; if (!class_dev->sysdevice) continue; - strcpy(path, class_dev->sysdevice->directory->path); + strcpy(path, class_dev->sysdevice->path); temp = strrchr(path, '/'); dbg_parse("NUMBER path = '%s'", path); dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); @@ -682,7 +686,7 @@ label_found: if (!class_dev->sysdevice) continue; found = 0; - strcpy(path, class_dev->sysdevice->directory->path); + strcpy(path, class_dev->sysdevice->path); temp = strrchr(path, '/'); dbg_parse("TOPOLOGY path = '%s'", path); dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); -- cgit v1.2.3-54-g00ecf From 97d8c0156724590066be15076f58e0fe6638f77e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 21 Oct 2003 17:08:45 -0700 Subject: [PATCH] 004 release --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 535e5b9293..7f8e689b93 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 003_bk +VERSION = 004 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 59b06a0d16..ada10a883e 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 003_bk +Version: 004 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From d4e52dd0d95c21ccda50310404be4b5a540cc498 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 21 Oct 2003 17:09:52 -0700 Subject: [PATCH] 004 changelog entrys --- ChangeLog | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa72db5c20..b57cd72eaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +Summary of changes from v003 to v004 +============================================ + +Daniel E. F. Stekloff: + o new version of libsysfs patch + +Greg Kroah-Hartman: + o 004 release + o major database cleanups + o Changed test.block and test.tty to take ACTION from the command line + o don't sleep if 'dev' file is already present on device add + o fix comment about how the "dev" file is made up + o more database work. Now we only store the info we really need right now + o add BUS= bug to TODO list so it will not get forgotten + o spec file changes + o test.block changes + o ok, rpm likes the "_" character instead of "-" better + o change the version to 003-bk to keep things sane with people using the bk tree + o got "remove of named devices" working + o fix segfaults when dealing with partitions + o update changelog for 003 release TAG: v003 + +Kay Sievers: + o man file update + o man page update + +Robert Love: + o udev: mode should be mode_t + o udev: trivial trivialities + o udev: cool test scripts again + o udev spec file symlink support + o udev: cool test scripts + o udev spec file bits + + Summary of changes from v0.2 to v003 ============================================ @@ -102,5 +137,3 @@ Greg Kroah-Hartman: o fixed up config o Initial repository create o BitKeeper file /home/greg/src/udev/udev/ChangeSet - - -- cgit v1.2.3-54-g00ecf From c056c5141b16fe95485eeb233fe8b90954686a60 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 21 Oct 2003 20:19:09 -0700 Subject: [PATCH] make config files, sysfs root, and udev root configurable from config variables This will make running tests a lot simpler. --- namedev.c | 16 +++++------- namedev.h | 3 --- udev-add.c | 11 +------- udev-remove.c | 2 +- udev.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++------------ udev.h | 13 +++++++++- udevdb.c | 4 +-- udevdb.h | 2 -- 8 files changed, 88 insertions(+), 45 deletions(-) diff --git a/namedev.c b/namedev.c index c21a5be7ad..f2842ce436 100644 --- a/namedev.c +++ b/namedev.c @@ -197,7 +197,6 @@ static int get_pair(char **orig_string, char **left, char **right) static int namedev_init_config(void) { - char filename[255]; char line[255]; char *temp; char *temp2; @@ -206,11 +205,10 @@ static int namedev_init_config(void) int retval = 0; struct config_device dev; - strcpy(filename, UDEV_CONFIG_DIR NAMEDEV_CONFIG_FILE); - dbg("opening %s to read as permissions config", filename); - fd = fopen(filename, "r"); + dbg("opening %s to read as permissions config", udev_config_filename); + fd = fopen(udev_config_filename, "r"); if (fd == NULL) { - dbg("Can't open %s", filename); + dbg("Can't open %s", udev_config_filename); return -ENODEV; } @@ -394,7 +392,6 @@ exit: static int namedev_init_permissions(void) { - char filename[255]; char line[255]; char *temp; char *temp2; @@ -402,11 +399,10 @@ static int namedev_init_permissions(void) int retval = 0; struct config_device dev; - strcpy(filename, UDEV_CONFIG_DIR NAMEDEV_CONFIG_PERMISSION_FILE); - dbg("opening %s to read as permissions config", filename); - fd = fopen(filename, "r"); + dbg("opening %s to read as permissions config", udev_config_permission_filename); + fd = fopen(udev_config_permission_filename, "r"); if (fd == NULL) { - dbg("Can't open %s", filename); + dbg("Can't open %s", udev_config_permission_filename); return -ENODEV; } diff --git a/namedev.h b/namedev.h index 567756c827..d5aaae202c 100644 --- a/namedev.h +++ b/namedev.h @@ -28,10 +28,7 @@ struct sysfs_class_device; -/* namedev config files */ #define COMMENT_CHARACTER '#' -#define NAMEDEV_CONFIG_PERMISSION_FILE "namedev.permissions" -#define NAMEDEV_CONFIG_FILE "namedev.config" enum config_type { KERNEL_NAME = 0, /* must be 0 to let memset() default to this value */ diff --git a/udev-add.c b/udev-add.c index 7906638a7f..d9d7cab103 100644 --- a/udev-add.c +++ b/udev-add.c @@ -34,8 +34,6 @@ #include "udevdb.h" #include "libsysfs/libsysfs.h" -static char sysfs_path[SYSFS_PATH_MAX]; - /* * Right now the major/minor of a device is stored in a file called * "dev" in sysfs. @@ -75,7 +73,7 @@ static int create_node(struct udevice *dev) char filename[255]; int retval = 0; - strncpy(filename, UDEV_ROOT, sizeof(filename)); + strncpy(filename, udev_root, sizeof(filename)); strncat(filename, dev->name, sizeof(filename)); switch (dev->type) { @@ -171,13 +169,6 @@ int udev_add_device(char *path, char *subsystem) else dev.type = 'c'; - retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); - dbg("sysfs_path = %s", sysfs_path); - if (retval) { - dbg("sysfs_get_mnt_path failed"); - goto exit; - } - retval = sleep_for_dev(path); if (retval) goto exit; diff --git a/udev-remove.c b/udev-remove.c index c61a948fa0..666928f318 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -70,7 +70,7 @@ static int delete_node(char *name) { char filename[255]; - strncpy(filename, UDEV_ROOT, sizeof(filename)); + strncpy(filename, udev_root, sizeof(filename)); strncat(filename, name, sizeof(filename)); dbg("unlinking %s", filename); diff --git a/udev.c b/udev.c index a398477118..8d650c2561 100644 --- a/udev.c +++ b/udev.c @@ -34,8 +34,19 @@ #include "udevdb.h" #include "libsysfs/libsysfs.h" +/* global variables */ +char **main_argv; +char **main_envp; + +char sysfs_path[SYSFS_PATH_MAX]; +char *udev_config_dir; +char *udev_root; +char udev_db_filename[PATH_MAX+NAME_MAX]; +char udev_config_permission_filename[PATH_MAX+NAME_MAX]; +char udev_config_filename[PATH_MAX+NAME_MAX]; + -static char *get_action(void) +static inline char *get_action(void) { char *action; @@ -43,22 +54,60 @@ static char *get_action(void) return action; } +static inline char *get_devpath(void) +{ + char *devpath; + + devpath = getenv("DEVPATH"); + return devpath; +} -static char *get_device(void) +static inline char *get_seqnum(void) { - char *device; + char *seqnum; - device = getenv("DEVPATH"); - return device; + seqnum = getenv("SEQNUM"); + return seqnum; } -char **main_argv; -char **main_envp; +static void get_dirs(void) +{ + char *udev_test; + char *temp; + int retval; + + udev_test = getenv("UDEV_TEST"); + if (udev_test == NULL) { + /* normal operation, use the compiled in defaults */ + udev_config_dir = UDEV_CONFIG_DIR; + udev_root = UDEV_ROOT; + retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); + dbg("sysfs_path = %s", sysfs_path); + if (retval) + dbg("sysfs_get_mnt_path failed"); + + } else { + /* hm testing is happening, use the specified values */ + temp = getenv("UDEV_SYSFS_PATH"); + strncpy(sysfs_path, temp, sizeof(sysfs_path)); + udev_config_dir = getenv("UDEV_CONFIG_DIR"); + udev_root = getenv("UDEV_ROOT"); + } + + strncpy(udev_db_filename, udev_config_dir, sizeof(udev_db_filename)); + strncat(udev_db_filename, UDEV_DB, sizeof(udev_db_filename)); + + strncpy(udev_config_filename, udev_config_dir, sizeof(udev_config_filename)); + strncat(udev_config_filename, NAMEDEV_CONFIG_FILE, sizeof(udev_config_filename)); + + strncpy(udev_config_permission_filename, udev_config_dir, sizeof(udev_config_permission_filename)); + strncat(udev_config_permission_filename, NAMEDEV_CONFIG_PERMISSION_FILE, sizeof(udev_config_permission_filename)); +} int main(int argc, char **argv, char **envp) { char *action; - char *device; + char *devpath; char *subsystem; int retval = -EINVAL; @@ -74,16 +123,16 @@ int main(int argc, char **argv, char **envp) subsystem = argv[1]; - device = get_device(); - if (!device) { - dbg ("no device?"); + devpath = get_devpath(); + if (!devpath) { + dbg ("no devpath?"); goto exit; } - dbg("looking at %s", device); + dbg("looking at %s", devpath); /* we only care about class devices and block stuff */ - if (!strstr(device, "class") && - !strstr(device, "block")) { + if (!strstr(devpath, "class") && + !strstr(devpath, "block")) { dbg("not block or class"); goto exit; } @@ -101,6 +150,7 @@ int main(int argc, char **argv, char **envp) } /* initialize udev database */ + get_dirs(); retval = udevdb_init(UDEVDB_DEFAULT); if (retval != 0) { dbg("Unable to initialize database."); @@ -111,10 +161,10 @@ int main(int argc, char **argv, char **envp) namedev_init(); if (strcmp(action, "add") == 0) - retval = udev_add_device(device, argv[1]); + retval = udev_add_device(devpath, subsystem); else if (strcmp(action, "remove") == 0) - retval = udev_remove_device(device, argv[1]); + retval = udev_remove_device(devpath, subsystem); else { dbg("Unknown action: %s", action); diff --git a/udev.h b/udev.h index 6d7017ff51..4c8914f1e2 100644 --- a/udev.h +++ b/udev.h @@ -24,6 +24,7 @@ #define UDEV_H #include "libsysfs/libsysfs.h" +#include #ifdef DEBUG #include @@ -50,7 +51,10 @@ extern int log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -/* Lots of constants that should be in a config file sometime */ +/* filenames for the config and database files */ +#define UDEV_DB "udevdb.tdb" +#define NAMEDEV_CONFIG_PERMISSION_FILE "namedev.permissions" +#define NAMEDEV_CONFIG_FILE "namedev.config" #define NAME_SIZE 100 #define OWNER_SIZE 30 @@ -78,5 +82,12 @@ extern int udev_remove_device(char *path, char *subsystem); extern char **main_argv; extern char **main_envp; +extern char sysfs_path[SYSFS_PATH_MAX]; +extern char *udev_config_dir; +extern char *udev_root; +extern char udev_db_filename[PATH_MAX+NAME_MAX]; +extern char udev_config_permission_filename[PATH_MAX+NAME_MAX]; +extern char udev_config_filename[PATH_MAX+NAME_MAX]; + #endif diff --git a/udevdb.c b/udevdb.c index b75bf8048f..ec67a07962 100644 --- a/udevdb.c +++ b/udevdb.c @@ -124,12 +124,12 @@ int udevdb_init(int init_flag) if (init_flag != UDEVDB_DEFAULT && init_flag != UDEVDB_INTERNAL) return -EINVAL; - udevdb = tdb_open(UDEV_CONFIG_DIR UDEV_DB, 0, init_flag, O_RDWR | O_CREAT, 0644); + udevdb = tdb_open(udev_db_filename, 0, init_flag, O_RDWR | O_CREAT, 0644); if (udevdb == NULL) { if (init_flag == UDEVDB_INTERNAL) dbg("Unable to initialize in-memory database"); else - dbg("Unable to initialize database at %s", UDEV_CONFIG_DIR UDEV_DB); + dbg("Unable to initialize database at %s", udev_db_filename); return -EINVAL; } return 0; diff --git a/udevdb.h b/udevdb.h index 12f6648369..9935e80e9c 100644 --- a/udevdb.h +++ b/udevdb.h @@ -4,8 +4,6 @@ #ifndef _UDEVDB_H_ #define _UDEVDB_H_ -#define UDEV_DB "udevdb.tdb" - /* Udevdb initialization flags */ #define UDEVDB_DEFAULT 0 /* Defaults database to use file */ #define UDEVDB_INTERNAL 1 /* Don't store db on disk, use in memory */ -- cgit v1.2.3-54-g00ecf From ada26cf593614bc26fe836e489bc8d7a31c53bc6 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 21 Oct 2003 20:20:03 -0700 Subject: [PATCH] change version to 004_bk --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7f8e689b93..2cc0c2a680 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 004 +VERSION = 004_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index ada10a883e..fd6b488aeb 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 004 +Version: 004_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 5b52fccb5950e26a30cd4bc44932fec45ce44227 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 21 Oct 2003 21:40:53 -0700 Subject: [PATCH] Fix bug causing udev to sleep forever waiting for dev file to show up. Now we will timeout properly. --- udev-add.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev-add.c b/udev-add.c index d9d7cab103..2b27855553 100644 --- a/udev-add.c +++ b/udev-add.c @@ -150,6 +150,7 @@ int sleep_for_dev(char *path) /* sleep for a second or two to give the kernel a chance to * create the dev file */ sleep(1); + ++loop; } retval = -ENODEV; exit: -- cgit v1.2.3-54-g00ecf From c2f17c9ea8a90d1c12158b947b3f8096404afe33 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 21 Oct 2003 21:41:35 -0700 Subject: [PATCH] more overrides of config info with env variables if in test mode. --- udev.c | 55 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/udev.c b/udev.c index 8d650c2561..ed42862c00 100644 --- a/udev.c +++ b/udev.c @@ -39,8 +39,8 @@ char **main_argv; char **main_envp; char sysfs_path[SYSFS_PATH_MAX]; -char *udev_config_dir; -char *udev_root; +char *udev_config_dir = UDEV_CONFIG_DIR; +char *udev_root = UDEV_ROOT; char udev_db_filename[PATH_MAX+NAME_MAX]; char udev_config_permission_filename[PATH_MAX+NAME_MAX]; char udev_config_filename[PATH_MAX+NAME_MAX]; @@ -72,36 +72,49 @@ static inline char *get_seqnum(void) static void get_dirs(void) { - char *udev_test; char *temp; + char *udev_db = UDEV_DB; + char *udev_config = NAMEDEV_CONFIG_FILE; + char *udev_permission = NAMEDEV_CONFIG_PERMISSION_FILE; int retval; - udev_test = getenv("UDEV_TEST"); - if (udev_test == NULL) { - /* normal operation, use the compiled in defaults */ - udev_config_dir = UDEV_CONFIG_DIR; - udev_root = UDEV_ROOT; - retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); - dbg("sysfs_path = %s", sysfs_path); - if (retval) - dbg("sysfs_get_mnt_path failed"); - - } else { - /* hm testing is happening, use the specified values */ + retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); + if (retval) + dbg("sysfs_get_mnt_path failed"); + + /* see if we should try to override any of the default values */ + temp = getenv("UDEV_TEST"); + if (temp != NULL) { + /* hm testing is happening, use the specified values, if they are present */ temp = getenv("UDEV_SYSFS_PATH"); - strncpy(sysfs_path, temp, sizeof(sysfs_path)); - udev_config_dir = getenv("UDEV_CONFIG_DIR"); - udev_root = getenv("UDEV_ROOT"); + if (temp) + strncpy(sysfs_path, temp, sizeof(sysfs_path)); + temp = getenv("UDEV_CONFIG_DIR"); + if (temp) + udev_config_dir = temp; + temp = getenv("UDEV_ROOT"); + if (temp) + udev_root = temp; + temp = getenv("UDEV_DB"); + if (temp) + udev_db = temp; + temp = getenv("UDEV_CONFIG_FILE"); + if (temp) + udev_config = temp; + temp = getenv("UDEV_PERMISSION_FILE"); + if (temp) + udev_permission = temp; } + dbg("sysfs_path = %s", sysfs_path); strncpy(udev_db_filename, udev_config_dir, sizeof(udev_db_filename)); - strncat(udev_db_filename, UDEV_DB, sizeof(udev_db_filename)); + strncat(udev_db_filename, udev_db, sizeof(udev_db_filename)); strncpy(udev_config_filename, udev_config_dir, sizeof(udev_config_filename)); - strncat(udev_config_filename, NAMEDEV_CONFIG_FILE, sizeof(udev_config_filename)); + strncat(udev_config_filename, udev_config, sizeof(udev_config_filename)); strncpy(udev_config_permission_filename, udev_config_dir, sizeof(udev_config_permission_filename)); - strncat(udev_config_permission_filename, NAMEDEV_CONFIG_PERMISSION_FILE, sizeof(udev_config_permission_filename)); + strncat(udev_config_permission_filename, udev_permission, sizeof(udev_config_permission_filename)); } int main(int argc, char **argv, char **envp) -- cgit v1.2.3-54-g00ecf From 6089318cd42a403b9816e7f5fc578f6888920b74 Mon Sep 17 00:00:00 2001 From: "rml@tech9.net" Date: Tue, 21 Oct 2003 21:45:19 -0700 Subject: [PATCH] udev: another canidate for static Another one of those "trivial patches so everything must be good" sleep_for_dev() isn't exported or defined in a header, so it can be marked 'static' --- udev-add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev-add.c b/udev-add.c index 2b27855553..7d0bdadcb7 100644 --- a/udev-add.c +++ b/udev-add.c @@ -128,7 +128,7 @@ exit: * If it doesn't happen in about 10 seconds, give up. */ #define SECONDS_TO_WAIT_FOR_DEV 10 -int sleep_for_dev(char *path) +static int sleep_for_dev(char *path) { char filename[SYSFS_PATH_MAX + 6]; struct stat buf; -- cgit v1.2.3-54-g00ecf From eb13ff87074f0a8dec135e4cb476585fe29bf49b Mon Sep 17 00:00:00 2001 From: "kay@vrfy.org" Date: Tue, 21 Oct 2003 21:46:00 -0700 Subject: [PATCH] man page update here a new patch for the man page: o namdev.permissions added o corrected a few typos o corrected text for config line format. owner, group mode are only in namedev.permissions (don't know what i was dreaming, while i wrote this :)) --- udev.8 | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/udev.8 b/udev.8 index efb02cc618..8865a7905a 100644 --- a/udev.8 +++ b/udev.8 @@ -2,28 +2,30 @@ .SH NAME udev \- Linux configurable dynamic device naming support .SH SYNOPSIS -.B udev +.BI udev " hotplug-subsystem" .SH "DESCRIPTION" .B udev creates or removes device node files usually located in the /dev directory. +Its goal is to provide a dynamic device directory that contains only the files +for devices that are actually present. +.P As part of the .B hotplug subsystem, .B udev -is exectuted if a kernel device is added or removed from the system. -.P +is executed if a kernel device is added or removed from the system. On device creation, .B udev -reads the sysfs directory of the given device, to collect device attributes +reads the sysfs directory of the given device to collect device attributes like label, serial number or bus device number. These attributes are passed as a key to the namedev subsystem to receive a unique name for device file creation. namedev maintains a database for devices present on the system. -.P +.br On device removal, .B udev -queries the namedev database for the name of the device file to delete. -.P +queries the namedev database for the name of the device file to be deleted. +.SH "CONFIGURATION" namedev expects its configuration at .I /etc/udev/namedev.config. The file consists of a set of lines. All empty lines and @@ -31,11 +33,16 @@ lines beginning with a '#' will be ignored. .br Every line defines the mapping between device attributes and the device file name. It starts with a keyword defining the method used to match, followed by -one ore more keys to compare, optional ownwership and permission settings and -the filename for the device. If no matching configuration is found, -the default kernel device name is used. +one ore more keys to compare and the filename for the device. If no matching +configuration is found, the default kernel device name is used. .P -.I method, key,[key,...] [owner,] [group,] [mode,] name +The line format is: +.RS +.sp +.I method, key,[key,...] name +.sp +.RE +where valid methods with corresponding keys are: .TP .B LABEL device label or serial number, like USB serial number, SCSI UUID or @@ -62,7 +69,9 @@ key: \fBKERNEL_NAME\fP calling external program, that returns a string to match .br keys: \fBBUS\fP, \fBPROGRAM\fP, \fBID\fP -.SH "EXAMPLE" +.P +A sample \fInamedev.conf\fP might look like this: +.sp .nf # USB printer to be called lp_color LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_color" @@ -79,6 +88,22 @@ REPLACE, KERNEL="ttyUSB1", NAME="pda" # if /sbin/dev_id returns "V0815" device will be called dev0815 CALLOUT, PROGRAM="/sbin/dev_id", BUS="pci", ID="V0815", NAME="dev0815" .fi +.P +Permissions and ownership for the created device files may specified at +.I /etc/udev/namedev.permissions. +The file consists of a set of lines. All empty lines and +lines beginning with a '#' will be ignored. +.br +Every line lists a device name followed by owner, group and permission mode. All values are separated by colons. +.sp +A sample \fInamedev.permissions\fP might look like this: +.sp +.nf +#name:user:group:mode +ttyUSB1:root:uucp:0666 +dsp1:::0666 +.fi + .SH "FILES" .nf .ft B @@ -89,7 +114,7 @@ CALLOUT, PROGRAM="/sbin/dev_id", BUS="pci", ID="V0815", NAME="dev0815" .fi .LP .SH "SEE ALSO" -.B hotplug (8) +.BR hotplug (8) .PP The .I http://linux-hotplug.sourceforge.net/ -- cgit v1.2.3-54-g00ecf From 116176b0bde45832d212b60e8d7bcb5d87f5ce46 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 21 Oct 2003 21:47:50 -0700 Subject: [PATCH] fix dbg line in namedev.c Thanks to Kay Sievers for pointing this out. --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index f2842ce436..3b0a0caf48 100644 --- a/namedev.c +++ b/namedev.c @@ -205,7 +205,7 @@ static int namedev_init_config(void) int retval = 0; struct config_device dev; - dbg("opening %s to read as permissions config", udev_config_filename); + dbg("opening %s to read as config", udev_config_filename); fd = fopen(udev_config_filename, "r"); if (fd == NULL) { dbg("Can't open %s", udev_config_filename); -- cgit v1.2.3-54-g00ecf From c2ec26b92809193a5126d34299abfe8df7877c0c Mon Sep 17 00:00:00 2001 From: "kay@vrfy.org" Date: Tue, 21 Oct 2003 21:48:11 -0700 Subject: [PATCH] namedev.c comments + debug patch and a patch for namdev.c comments + debug o correct 'device device' o correct permission file to config file --- namedev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 3b0a0caf48..d049349f22 100644 --- a/namedev.c +++ b/namedev.c @@ -564,7 +564,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at if (tmpattr) goto label_found; - /* look in the class device device directory if present */ + /* look in the class device directory if present */ if (class_dev->sysdevice) { tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); if (tmpattr) @@ -597,7 +597,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *at if (tmpattr) goto label_found; - /* look in the class device device directory if present */ + /* look in the class device directory if present */ if (class_dev_parent->sysdevice) { tmpattr = sysfs_get_classdev_attr(class_dev_parent, dev->sysfs_file); if (tmpattr) -- cgit v1.2.3-54-g00ecf From 7bfd1a56436684ab1bc0d8e3661d6df81d3c82ef Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 00:18:49 -0700 Subject: [PATCH] more warning flags to the build. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2cc0c2a680..6710ede1b9 100644 --- a/Makefile +++ b/Makefile @@ -74,7 +74,8 @@ GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ then echo "-Os"; else echo "-O2" ; fi} -WARNINGS := -Wall -Wshadow -Wstrict-prototypes +# add -Wredundant-decls when libsysfs gets cleaned up +WARNINGS := -Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations # Some nice architecture specific optimizations ifeq ($(strip $(TARGET_ARCH)),arm) -- cgit v1.2.3-54-g00ecf From d41120879358f783eb1a457f340c1a4b538a9410 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 21 Oct 2003 22:08:03 -0700 Subject: [PATCH] rename namedev.permissions and namedev.config to udev.permissions and udev.config the namedev name didn't really make much sense anymore... --- Makefile | 8 ++++---- namedev.config | 26 -------------------------- namedev.permissions | 6 ------ udev.8 | 18 +++++++++--------- udev.c | 4 ++-- udev.config | 26 ++++++++++++++++++++++++++ udev.h | 6 +++--- udev.permissions | 6 ++++++ udev.spec | 4 ++-- 9 files changed, 52 insertions(+), 52 deletions(-) delete mode 100644 namedev.config delete mode 100644 namedev.permissions create mode 100644 udev.config create mode 100644 udev.permissions diff --git a/Makefile b/Makefile index 6710ede1b9..a5c00b7191 100644 --- a/Makefile +++ b/Makefile @@ -198,14 +198,14 @@ install: all $(INSTALL) -d $(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(sbindir)/$(ROOT) $(INSTALL_DATA) -D udev.8 $(mandir)/man8/udev.8 - $(INSTALL_DATA) namedev.config $(configdir) - $(INSTALL_DATA) namedev.permissions $(configdir) + $(INSTALL_DATA) udev.config $(configdir) + $(INSTALL_DATA) udev.permissions $(configdir) - ln -s $(sbindir)/$(ROOT) $(hotplugdir)/udev.hotplug uninstall: - rm $(hotplugdir)/udev.hotplug - - rm $(configdir)/namedev.permissions - - rm $(configdir)/namedev.config + - rm $(configdir)/udev.permissions + - rm $(configdir)/udev.config - rm $(mandir)/man8/udev.8 - rm $(sbindir)/$(ROOT) - rmdir $(hotplugdir) diff --git a/namedev.config b/namedev.config deleted file mode 100644 index a0c6f9d1e8..0000000000 --- a/namedev.config +++ /dev/null @@ -1,26 +0,0 @@ -# My usb camera... -LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera" - -# USB Epson printer to be called lp_epson -LABEL, BUS="usb", serial="HXOLL0012202323480", NAME="lp_epson" - -# USB HP printer to be called lp_hp -LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_hp" - -# sound card with PCI bus id 00:0b.0 to be the first sound card -NUMBER, BUS="pci", id="00:0b.0", NAME="dsp" - -# sound card with PCI bus id 00:07.1 to be the second sound card -NUMBER, BUS="pci", id="00:07.1", NAME="dsp1" - -# USB mouse plugged into the third port of the first hub to be called mouse0 -TOPOLOGY, BUS="usb", place="1.3", NAME="mouse0" - -# USB tablet plugged into the third port of the second hub to be called mouse1 -TOPOLOGY, BUS="usb", place="2.3", NAME="mouse1" -TOPOLOGY, BUS="usb", place="2.4", NAME="mouse2" - -# ttyUSB1 should always be called visor -REPLACE, KERNEL="ttyUSB1", NAME="visor" -#REPLACE, KERNEL="ttyUSB0", NAME="pl2303" - diff --git a/namedev.permissions b/namedev.permissions deleted file mode 100644 index 66d8af1f7a..0000000000 --- a/namedev.permissions +++ /dev/null @@ -1,6 +0,0 @@ -#name:user:group:mode -ttyUSB0:root:uucp:0660 -ttyUSB1:root:uucp:0666 -visor:root:uucp:0666 -dsp1:::0666 - diff --git a/udev.8 b/udev.8 index 8865a7905a..42239c824d 100644 --- a/udev.8 +++ b/udev.8 @@ -18,16 +18,16 @@ On device creation, .B udev reads the sysfs directory of the given device to collect device attributes like label, serial number or bus device number. -These attributes are passed as a key to the namedev subsystem -to receive a unique name for device file creation. -namedev maintains a database for devices present on the system. +These attributes are treated as a key +to determine a unique name for device file creation. +udev maintains a database for devices present on the system. .br On device removal, .B udev -queries the namedev database for the name of the device file to be deleted. +queries the internal database for the name of the device file to be deleted. .SH "CONFIGURATION" -namedev expects its configuration at -.I /etc/udev/namedev.config. +udev expects its configuration at +.I /etc/udev/udev.config. The file consists of a set of lines. All empty lines and lines beginning with a '#' will be ignored. .br @@ -70,7 +70,7 @@ calling external program, that returns a string to match .br keys: \fBBUS\fP, \fBPROGRAM\fP, \fBID\fP .P -A sample \fInamedev.conf\fP might look like this: +A sample \fIudev.conf\fP might look like this: .sp .nf # USB printer to be called lp_color @@ -90,13 +90,13 @@ CALLOUT, PROGRAM="/sbin/dev_id", BUS="pci", ID="V0815", NAME="dev0815" .fi .P Permissions and ownership for the created device files may specified at -.I /etc/udev/namedev.permissions. +.I /etc/udev/udev.permissions. The file consists of a set of lines. All empty lines and lines beginning with a '#' will be ignored. .br Every line lists a device name followed by owner, group and permission mode. All values are separated by colons. .sp -A sample \fInamedev.permissions\fP might look like this: +A sample \fIudev.permissions\fP might look like this: .sp .nf #name:user:group:mode diff --git a/udev.c b/udev.c index ed42862c00..8746b9a810 100644 --- a/udev.c +++ b/udev.c @@ -74,8 +74,8 @@ static void get_dirs(void) { char *temp; char *udev_db = UDEV_DB; - char *udev_config = NAMEDEV_CONFIG_FILE; - char *udev_permission = NAMEDEV_CONFIG_PERMISSION_FILE; + char *udev_config = UDEV_CONFIG_FILE; + char *udev_permission = UDEV_CONFIG_PERMISSION_FILE; int retval; retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); diff --git a/udev.config b/udev.config new file mode 100644 index 0000000000..a0c6f9d1e8 --- /dev/null +++ b/udev.config @@ -0,0 +1,26 @@ +# My usb camera... +LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera" + +# USB Epson printer to be called lp_epson +LABEL, BUS="usb", serial="HXOLL0012202323480", NAME="lp_epson" + +# USB HP printer to be called lp_hp +LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_hp" + +# sound card with PCI bus id 00:0b.0 to be the first sound card +NUMBER, BUS="pci", id="00:0b.0", NAME="dsp" + +# sound card with PCI bus id 00:07.1 to be the second sound card +NUMBER, BUS="pci", id="00:07.1", NAME="dsp1" + +# USB mouse plugged into the third port of the first hub to be called mouse0 +TOPOLOGY, BUS="usb", place="1.3", NAME="mouse0" + +# USB tablet plugged into the third port of the second hub to be called mouse1 +TOPOLOGY, BUS="usb", place="2.3", NAME="mouse1" +TOPOLOGY, BUS="usb", place="2.4", NAME="mouse2" + +# ttyUSB1 should always be called visor +REPLACE, KERNEL="ttyUSB1", NAME="visor" +#REPLACE, KERNEL="ttyUSB0", NAME="pl2303" + diff --git a/udev.h b/udev.h index 4c8914f1e2..1f6e981cc2 100644 --- a/udev.h +++ b/udev.h @@ -52,9 +52,9 @@ extern int log_message (int level, const char *format, ...) /* filenames for the config and database files */ -#define UDEV_DB "udevdb.tdb" -#define NAMEDEV_CONFIG_PERMISSION_FILE "namedev.permissions" -#define NAMEDEV_CONFIG_FILE "namedev.config" +#define UDEV_DB "udev.tdb" +#define UDEV_CONFIG_PERMISSION_FILE "udev.permissions" +#define UDEV_CONFIG_FILE "udev.config" #define NAME_SIZE 100 #define OWNER_SIZE 30 diff --git a/udev.permissions b/udev.permissions new file mode 100644 index 0000000000..66d8af1f7a --- /dev/null +++ b/udev.permissions @@ -0,0 +1,6 @@ +#name:user:group:mode +ttyUSB0:root:uucp:0660 +ttyUSB1:root:uucp:0666 +visor:root:uucp:0666 +dsp1:::0666 + diff --git a/udev.spec b/udev.spec index fd6b488aeb..ffdfb2470d 100644 --- a/udev.spec +++ b/udev.spec @@ -34,8 +34,8 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /sbin/udev %attr(755,root,root) /udev/ %attr(755,root,root) /etc/udev/ -%attr(0644,root,root) /etc/udev/namedev.config -%attr(0644,root,root) /etc/udev/namedev.permissions +%attr(0644,root,root) /etc/udev/udev.config +%attr(0644,root,root) /etc/udev/udev.permissions %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(0644,root,root) %{_mandir}/man8/udev.8* -- cgit v1.2.3-54-g00ecf From 9d496c74f3a6b1963727b515126e87e64abe046c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 21 Oct 2003 22:28:32 -0700 Subject: [PATCH] got rid of struct device_attr namedev.c is still a mess, that's up next after testing... --- namedev.c | 156 ++++++++++++++++++++++++++++++------------------------------- namedev.h | 7 ++- udev-add.c | 11 ++--- udev.h | 7 --- 4 files changed, 88 insertions(+), 93 deletions(-) diff --git a/namedev.c b/namedev.c index d049349f22..6ed2415cdd 100644 --- a/namedev.c +++ b/namedev.c @@ -22,7 +22,7 @@ */ /* define this to enable parsing debugging */ -/* #define DEBUG_PARSER */ +#define DEBUG_PARSER #include #include @@ -54,38 +54,38 @@ static void dump_dev(struct config_device *dev) case KERNEL_NAME: dbg_parse("KERNEL name ='%s'" " owner = '%s', group = '%s', mode = '%#o'", - dev->attr.name, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->name, + dev->owner, dev->group, dev->mode); break; case LABEL: dbg_parse("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" " owner = '%s', group = '%s', mode = '%#o'", - dev->attr.name, dev->bus, dev->sysfs_file, dev->sysfs_value, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value, + dev->owner, dev->group, dev->mode); break; case NUMBER: dbg_parse("NUMBER name = '%s', bus = '%s', id = '%s'" " owner = '%s', group = '%s', mode = '%#o'", - dev->attr.name, dev->bus, dev->id, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->name, dev->bus, dev->id, + dev->owner, dev->group, dev->mode); break; case TOPOLOGY: dbg_parse("TOPOLOGY name = '%s', bus = '%s', place = '%s'" " owner = '%s', group = '%s', mode = '%#o'", - dev->attr.name, dev->bus, dev->place, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->name, dev->bus, dev->place, + dev->owner, dev->group, dev->mode); break; case REPLACE: dbg_parse("REPLACE name = %s, kernel_name = %s" " owner = '%s', group = '%s', mode = '%#o'", - dev->attr.name, dev->kernel_name, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->name, dev->kernel_name, + dev->owner, dev->group, dev->mode); break; case CALLOUT: dbg_parse("CALLOUT name = '%s', program ='%s', bus = '%s', id = '%s'" " owner = '%s', group = '%s', mode = '%#o'", - dev->attr.name, dev->exec_program, dev->bus, dev->id, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->name, dev->exec_program, dev->bus, dev->id, + dev->owner, dev->group, dev->mode); break; default: dbg_parse("Unknown type of device!"); @@ -109,18 +109,18 @@ static int add_dev(struct config_device *new_dev) * this one... */ list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); - if (strcmp(dev->attr.name, new_dev->attr.name) == 0) { + if (strcmp(dev->name, new_dev->name) == 0) { /* the same, copy the new info into this structure */ copy_var(dev, new_dev, type); - copy_var(dev, new_dev, attr.mode); + copy_var(dev, new_dev, mode); copy_string(dev, new_dev, bus); copy_string(dev, new_dev, sysfs_file); copy_string(dev, new_dev, sysfs_value); copy_string(dev, new_dev, id); copy_string(dev, new_dev, place); copy_string(dev, new_dev, kernel_name); - copy_string(dev, new_dev, attr.owner); - copy_string(dev, new_dev, attr.group); + copy_string(dev, new_dev, owner); + copy_string(dev, new_dev, group); return 0; } } @@ -260,11 +260,11 @@ static int namedev_init_config(void) retval = get_value("NAME", &temp, &temp3); if (retval) continue; - strcpy(dev.attr.name, temp3); + strcpy(dev.name, temp3); dbg_parse("LABEL name = '%s', bus = '%s', " "sysfs_file = '%s', sysfs_value = '%s'", - dev.attr.name, dev.bus, dev.sysfs_file, + dev.name, dev.bus, dev.sysfs_file, dev.sysfs_value); } @@ -290,10 +290,10 @@ static int namedev_init_config(void) retval = get_value("NAME", &temp, &temp3); if (retval) continue; - strcpy(dev.attr.name, temp3); + strcpy(dev.name, temp3); dbg_parse("NUMBER name = '%s', bus = '%s', id = '%s'", - dev.attr.name, dev.bus, dev.id); + dev.name, dev.bus, dev.id); } if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { @@ -318,10 +318,10 @@ static int namedev_init_config(void) retval = get_value("NAME", &temp, &temp3); if (retval) continue; - strcpy(dev.attr.name, temp3); + strcpy(dev.name, temp3); dbg_parse("TOPOLOGY name = '%s', bus = '%s', place = '%s'", - dev.attr.name, dev.bus, dev.place); + dev.name, dev.bus, dev.place); } if (strcasecmp(temp2, TYPE_REPLACE) == 0) { @@ -339,9 +339,9 @@ static int namedev_init_config(void) retval = get_value("NAME", &temp, &temp3); if (retval) continue; - strcpy(dev.attr.name, temp3); + strcpy(dev.name, temp3); dbg_parse("REPLACE name = %s, kernel_name = %s", - dev.attr.name, dev.kernel_name); + dev.name, dev.kernel_name); } if (strcasecmp(temp2, TYPE_CALLOUT) == 0) { /* number type */ @@ -372,9 +372,9 @@ static int namedev_init_config(void) retval = get_value("NAME", &temp, &temp3); if (retval) continue; - strcpy(dev.attr.name, temp3); + strcpy(dev.name, temp3); dbg_parse("CALLOUT name = %s, program = %s", - dev.attr.name, dev.exec_program); + dev.name, dev.exec_program); } retval = add_dev(&dev); @@ -431,19 +431,19 @@ static int namedev_init_permissions(void) /* parse the line */ temp2 = strsep(&temp, ":"); - strncpy(dev.attr.name, temp2, sizeof(dev.attr.name)); + strncpy(dev.name, temp2, sizeof(dev.name)); temp2 = strsep(&temp, ":"); - strncpy(dev.attr.owner, temp2, sizeof(dev.attr.owner)); + strncpy(dev.owner, temp2, sizeof(dev.owner)); temp2 = strsep(&temp, ":"); - strncpy(dev.attr.group, temp2, sizeof(dev.attr.owner)); + strncpy(dev.group, temp2, sizeof(dev.owner)); - dev.attr.mode = strtol(temp, NULL, 8); + dev.mode = strtol(temp, NULL, 8); dbg_parse("name = %s, owner = %s, group = %s, mode = %#o", - dev.attr.name, dev.attr.owner, dev.attr.group, - dev.attr.mode); + dev.name, dev.owner, dev.group, + dev.mode); retval = add_dev(&dev); if (retval) { dbg("add_dev returned with error %d", retval); @@ -535,13 +535,13 @@ static int exec_callout(struct config_device *dev, char *value, int len) return retval; } -static int get_attr(struct sysfs_class_device *class_dev, struct device_attr *attr) +static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) { struct list_head *tmp; int retval = 0; int found; - attr->mode = 0; + udev->mode = 0; if (class_dev->sysdevice) { dbg_parse("class_dev->sysdevice->path = '%s'", class_dev->sysdevice->path); dbg_parse("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); @@ -620,19 +620,19 @@ label_found: continue; } - strcpy(attr->name, dev->attr.name); + strcpy(udev->name, dev->name); if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { temp = &class_dev->path[strlen(class_dev->path)-1]; - strcat(attr->name, temp); + strcat(udev->name, temp); } - if (dev->attr.mode != 0) { - attr->mode = dev->attr.mode; - strcpy(attr->owner, dev->attr.owner); - strcpy(attr->group, dev->attr.group); + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); } dbg_parse("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->sysfs_file, dev->sysfs_value, attr->name, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->sysfs_file, dev->sysfs_value, udev->name, + dev->owner, dev->group, dev->mode); if (class_dev_parent) sysfs_close_class_device(class_dev_parent); goto done; @@ -662,15 +662,15 @@ label_found: if (!found) continue; - strcpy(attr->name, dev->attr.name); - if (dev->attr.mode != 0) { - attr->mode = dev->attr.mode; - strcpy(attr->owner, dev->attr.owner); - strcpy(attr->group, dev->attr.group); + strcpy(udev->name, dev->name); + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); } dbg_parse("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->id, attr->name, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->id, udev->name, + dev->owner, dev->group, dev->mode); goto done; break; } @@ -698,15 +698,15 @@ label_found: if (!found) continue; - strcpy(attr->name, dev->attr.name); - if (dev->attr.mode != 0) { - attr->mode = dev->attr.mode; - strcpy(attr->owner, dev->attr.owner); - strcpy(attr->group, dev->attr.group); + strcpy(udev->name, dev->name); + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); } dbg_parse("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->place, attr->name, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->place, udev->name, + dev->owner, dev->group, dev->mode); goto done; break; } @@ -718,30 +718,30 @@ label_found: continue; if (strncmp(value, dev->id, sizeof(value)) != 0) continue; - strcpy(attr->name, dev->attr.name); - if (dev->attr.mode != 0) { - attr->mode = dev->attr.mode; - strcpy(attr->owner, dev->attr.owner); - strcpy(attr->group, dev->attr.group); + strcpy(udev->name, dev->name); + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); } dbg_parse("device callout '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->id, attr->name, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->id, udev->name, + dev->owner, dev->group, dev->mode); goto done; break; } case REPLACE: if (strcmp(dev->kernel_name, class_dev->name) != 0) continue; - strcpy(attr->name, dev->attr.name); - if (dev->attr.mode != 0) { - attr->mode = dev->attr.mode; - strcpy(attr->owner, dev->attr.owner); - strcpy(attr->group, dev->attr.group); + strcpy(udev->name, dev->name); + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); } dbg_parse("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->kernel_name, attr->name, - dev->attr.owner, dev->attr.group, dev->attr.mode); + dev->kernel_name, udev->name, + dev->owner, dev->group, dev->mode); goto done; break; case KERNEL_NAME: @@ -751,23 +751,23 @@ label_found: break; } } - strcpy(attr->name, class_dev->name); + strcpy(udev->name, class_dev->name); done: /* mode was never set above */ - if (!attr->mode) { - attr->mode = get_default_mode(class_dev); - attr->owner[0] = 0x00; - attr->group[0] = 0x00; + if (!udev->mode) { + udev->mode = get_default_mode(class_dev); + udev->owner[0] = 0x00; + udev->group[0] = 0x00; } return retval; } -int namedev_name_device(struct sysfs_class_device *class_dev, struct device_attr *attr) +int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev) { int retval; - retval = get_attr(class_dev, attr); + retval = get_attr(class_dev, dev); if (retval) dbg("get_attr failed"); diff --git a/namedev.h b/namedev.h index d5aaae202c..56e6a96c03 100644 --- a/namedev.h +++ b/namedev.h @@ -60,11 +60,14 @@ struct config_device { char exec_program[FILE_SIZE]; /* what to set the device to */ - struct device_attr attr; + char name[NAME_SIZE]; + char owner[OWNER_SIZE]; + char group[GROUP_SIZE]; + mode_t mode; }; extern int namedev_init(void); -extern int namedev_name_device(struct sysfs_class_device *class_dev, struct device_attr *attr); +extern int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev); #endif diff --git a/udev-add.c b/udev-add.c index 7d0bdadcb7..3b0e4ddf0e 100644 --- a/udev-add.c +++ b/udev-add.c @@ -161,7 +161,6 @@ int udev_add_device(char *path, char *subsystem) { struct sysfs_class_device *class_dev; struct udevice dev; - struct device_attr attr; int retval = -EINVAL; /* for now, the block layer is the only place where block devices are */ @@ -178,7 +177,7 @@ int udev_add_device(char *path, char *subsystem) if (class_dev == NULL) goto exit; - retval = namedev_name_device(class_dev, &attr); + retval = namedev_name_device(class_dev, &dev); if (retval) return retval; @@ -188,10 +187,10 @@ int udev_add_device(char *path, char *subsystem) goto exit; } - strcpy(dev.name, attr.name); - strcpy(dev.owner, attr.owner); - strcpy(dev.group, attr.group); - dev.mode = attr.mode; +// strcpy(dev.name, attr.name); +// strcpy(dev.owner, attr.owner); +// strcpy(dev.group, attr.group); +// dev.mode = attr.mode; retval = udevdb_add_dev(path, &dev); if (retval != 0) diff --git a/udev.h b/udev.h index 1f6e981cc2..cdf1af4fc2 100644 --- a/udev.h +++ b/udev.h @@ -60,13 +60,6 @@ extern int log_message (int level, const char *format, ...) #define OWNER_SIZE 30 #define GROUP_SIZE 30 -struct device_attr { - char name[NAME_SIZE]; - char owner[OWNER_SIZE]; - char group[GROUP_SIZE]; - mode_t mode; -}; - struct udevice { char name[NAME_SIZE]; char owner[OWNER_SIZE]; -- cgit v1.2.3-54-g00ecf From 64455bfc69aa4c9a79bdfa9face9c4ecbdb5a8ed Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 01:12:40 -0700 Subject: [PATCH] fix LABEL bug for device files (not class files.) --- namedev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 6ed2415cdd..22ec6ace24 100644 --- a/namedev.c +++ b/namedev.c @@ -566,7 +566,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) /* look in the class device directory if present */ if (class_dev->sysdevice) { - tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); + tmpattr = sysfs_get_device_attr(class_dev->sysdevice, dev->sysfs_file); if (tmpattr) goto label_found; } @@ -599,7 +599,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) /* look in the class device directory if present */ if (class_dev_parent->sysdevice) { - tmpattr = sysfs_get_classdev_attr(class_dev_parent, dev->sysfs_file); + tmpattr = sysfs_get_device_attr(class_dev_parent->sysdevice, dev->sysfs_file); if (tmpattr) goto label_found; } -- cgit v1.2.3-54-g00ecf From 562e8810163ace28ec6683b494e26bd173a81f58 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 01:14:59 -0700 Subject: [PATCH] regression tests starting to be added. --- test/label_test | 14 ++++++++++++++ test/label_test.config | 3 +++ test/sys/block/sda/dev | 1 + test/sys/block/sda/queue/iosched/antic_expire | 1 + test/sys/block/sda/queue/iosched/read_batch_expire | 1 + test/sys/block/sda/queue/iosched/read_expire | 1 + test/sys/block/sda/queue/iosched/write_batch_expire | 1 + test/sys/block/sda/queue/iosched/write_expire | 1 + test/sys/block/sda/queue/nr_requests | 1 + test/sys/block/sda/range | 1 + test/sys/block/sda/sda1/dev | 1 + test/sys/block/sda/sda1/size | 1 + test/sys/block/sda/sda1/start | 1 + test/sys/block/sda/sda1/stat | 1 + test/sys/block/sda/sda2/dev | 1 + test/sys/block/sda/sda2/size | 1 + test/sys/block/sda/sda2/start | 1 + test/sys/block/sda/sda2/stat | 1 + test/sys/block/sda/sda3/dev | 1 + test/sys/block/sda/sda3/size | 1 + test/sys/block/sda/sda3/start | 1 + test/sys/block/sda/sda3/stat | 1 + test/sys/block/sda/sda4/dev | 1 + test/sys/block/sda/sda4/size | 1 + test/sys/block/sda/sda4/start | 1 + test/sys/block/sda/sda4/stat | 1 + test/sys/block/sda/size | 1 + test/sys/block/sda/stat | 1 + .../sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/class | 1 + .../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/device | 1 + .../0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked | 1 + .../0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model | 1 + .../0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online | 1 + .../0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth | 1 + .../pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev | 1 + .../0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level | 1 + .../0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type | 1 + .../0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/irq | 1 + .../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/resource | 7 +++++++ .../pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_device | 1 + .../pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_vendor | 1 + .../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/vendor | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/class | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/device | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/irq | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/resource | 12 ++++++++++++ test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_device | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/vendor | 1 + 50 files changed, 82 insertions(+) create mode 100644 test/label_test create mode 100644 test/label_test.config create mode 100644 test/sys/block/sda/dev create mode 100644 test/sys/block/sda/queue/iosched/antic_expire create mode 100644 test/sys/block/sda/queue/iosched/read_batch_expire create mode 100644 test/sys/block/sda/queue/iosched/read_expire create mode 100644 test/sys/block/sda/queue/iosched/write_batch_expire create mode 100644 test/sys/block/sda/queue/iosched/write_expire create mode 100644 test/sys/block/sda/queue/nr_requests create mode 100644 test/sys/block/sda/range create mode 100644 test/sys/block/sda/sda1/dev create mode 100644 test/sys/block/sda/sda1/size create mode 100644 test/sys/block/sda/sda1/start create mode 100644 test/sys/block/sda/sda1/stat create mode 100644 test/sys/block/sda/sda2/dev create mode 100644 test/sys/block/sda/sda2/size create mode 100644 test/sys/block/sda/sda2/start create mode 100644 test/sys/block/sda/sda2/stat create mode 100644 test/sys/block/sda/sda3/dev create mode 100644 test/sys/block/sda/sda3/size create mode 100644 test/sys/block/sda/sda3/start create mode 100644 test/sys/block/sda/sda3/stat create mode 100644 test/sys/block/sda/sda4/dev create mode 100644 test/sys/block/sda/sda4/size create mode 100644 test/sys/block/sda/sda4/start create mode 100644 test/sys/block/sda/sda4/stat create mode 100644 test/sys/block/sda/size create mode 100644 test/sys/block/sda/stat create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/vendor diff --git a/test/label_test b/test/label_test new file mode 100644 index 0000000000..f2208cbbdd --- /dev/null +++ b/test/label_test @@ -0,0 +1,14 @@ +#!/bin/bash + +export UDEV_TEST=yes +export UDEV_SYSFS_PATH=$PWD/sys/ +export UDEV_CONFIG_DIR=$PWD/ +export UDEV_ROOT=$PWD/udev/ +export UDEV_DB=udev.tdb +export UDEV_CONFIG_FILE=label_test.config +export UDEV_PERMISSION_FILE=udev.permissions + +export DEVPATH=block/sda +export ACTION=add + +../udev block diff --git a/test/label_test.config b/test/label_test.config new file mode 100644 index 0000000000..b317537bb6 --- /dev/null +++ b/test/label_test.config @@ -0,0 +1,3 @@ +# LABEL test +LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk" + diff --git a/test/sys/block/sda/dev b/test/sys/block/sda/dev new file mode 100644 index 0000000000..fae0a50572 --- /dev/null +++ b/test/sys/block/sda/dev @@ -0,0 +1 @@ +8:0 diff --git a/test/sys/block/sda/queue/iosched/antic_expire b/test/sys/block/sda/queue/iosched/antic_expire new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/block/sda/queue/iosched/antic_expire @@ -0,0 +1 @@ +6 diff --git a/test/sys/block/sda/queue/iosched/read_batch_expire b/test/sys/block/sda/queue/iosched/read_batch_expire new file mode 100644 index 0000000000..08839f6bb2 --- /dev/null +++ b/test/sys/block/sda/queue/iosched/read_batch_expire @@ -0,0 +1 @@ +200 diff --git a/test/sys/block/sda/queue/iosched/read_expire b/test/sys/block/sda/queue/iosched/read_expire new file mode 100644 index 0000000000..e373ee695f --- /dev/null +++ b/test/sys/block/sda/queue/iosched/read_expire @@ -0,0 +1 @@ +50 diff --git a/test/sys/block/sda/queue/iosched/write_batch_expire b/test/sys/block/sda/queue/iosched/write_batch_expire new file mode 100644 index 0000000000..e373ee695f --- /dev/null +++ b/test/sys/block/sda/queue/iosched/write_batch_expire @@ -0,0 +1 @@ +50 diff --git a/test/sys/block/sda/queue/iosched/write_expire b/test/sys/block/sda/queue/iosched/write_expire new file mode 100644 index 0000000000..08839f6bb2 --- /dev/null +++ b/test/sys/block/sda/queue/iosched/write_expire @@ -0,0 +1 @@ +200 diff --git a/test/sys/block/sda/queue/nr_requests b/test/sys/block/sda/queue/nr_requests new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/block/sda/queue/nr_requests @@ -0,0 +1 @@ +128 diff --git a/test/sys/block/sda/range b/test/sys/block/sda/range new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/block/sda/range @@ -0,0 +1 @@ +16 diff --git a/test/sys/block/sda/sda1/dev b/test/sys/block/sda/sda1/dev new file mode 100644 index 0000000000..92c4b9b088 --- /dev/null +++ b/test/sys/block/sda/sda1/dev @@ -0,0 +1 @@ +8:1 diff --git a/test/sys/block/sda/sda1/size b/test/sys/block/sda/sda1/size new file mode 100644 index 0000000000..f00a59241e --- /dev/null +++ b/test/sys/block/sda/sda1/size @@ -0,0 +1 @@ +1060227 diff --git a/test/sys/block/sda/sda1/start b/test/sys/block/sda/sda1/start new file mode 100644 index 0000000000..4b9026d8e2 --- /dev/null +++ b/test/sys/block/sda/sda1/start @@ -0,0 +1 @@ +63 diff --git a/test/sys/block/sda/sda1/stat b/test/sys/block/sda/sda1/stat new file mode 100644 index 0000000000..199ce7330b --- /dev/null +++ b/test/sys/block/sda/sda1/stat @@ -0,0 +1 @@ + 50 400 103 824 diff --git a/test/sys/block/sda/sda2/dev b/test/sys/block/sda/sda2/dev new file mode 100644 index 0000000000..9799a2674a --- /dev/null +++ b/test/sys/block/sda/sda2/dev @@ -0,0 +1 @@ +8:2 diff --git a/test/sys/block/sda/sda2/size b/test/sys/block/sda/sda2/size new file mode 100644 index 0000000000..80483ab968 --- /dev/null +++ b/test/sys/block/sda/sda2/size @@ -0,0 +1 @@ +112455 diff --git a/test/sys/block/sda/sda2/start b/test/sys/block/sda/sda2/start new file mode 100644 index 0000000000..3a4bf076fc --- /dev/null +++ b/test/sys/block/sda/sda2/start @@ -0,0 +1 @@ +1060290 diff --git a/test/sys/block/sda/sda2/stat b/test/sys/block/sda/sda2/stat new file mode 100644 index 0000000000..c06b749cd1 --- /dev/null +++ b/test/sys/block/sda/sda2/stat @@ -0,0 +1 @@ + 342 500 15 30 diff --git a/test/sys/block/sda/sda3/dev b/test/sys/block/sda/sda3/dev new file mode 100644 index 0000000000..44ccff41b0 --- /dev/null +++ b/test/sys/block/sda/sda3/dev @@ -0,0 +1 @@ +8:3 diff --git a/test/sys/block/sda/sda3/size b/test/sys/block/sda/sda3/size new file mode 100644 index 0000000000..1373b38f8d --- /dev/null +++ b/test/sys/block/sda/sda3/size @@ -0,0 +1 @@ +20482875 diff --git a/test/sys/block/sda/sda3/start b/test/sys/block/sda/sda3/start new file mode 100644 index 0000000000..cab5c33336 --- /dev/null +++ b/test/sys/block/sda/sda3/start @@ -0,0 +1 @@ +1172745 diff --git a/test/sys/block/sda/sda3/stat b/test/sys/block/sda/sda3/stat new file mode 100644 index 0000000000..82fb1463a1 --- /dev/null +++ b/test/sys/block/sda/sda3/stat @@ -0,0 +1 @@ + 415052 6872874 669740 5357920 diff --git a/test/sys/block/sda/sda4/dev b/test/sys/block/sda/sda4/dev new file mode 100644 index 0000000000..aab3fc56e1 --- /dev/null +++ b/test/sys/block/sda/sda4/dev @@ -0,0 +1 @@ +8:4 diff --git a/test/sys/block/sda/sda4/size b/test/sys/block/sda/sda4/size new file mode 100644 index 0000000000..062619c44b --- /dev/null +++ b/test/sys/block/sda/sda4/size @@ -0,0 +1 @@ +49432005 diff --git a/test/sys/block/sda/sda4/start b/test/sys/block/sda/sda4/start new file mode 100644 index 0000000000..b65020c801 --- /dev/null +++ b/test/sys/block/sda/sda4/start @@ -0,0 +1 @@ +21655620 diff --git a/test/sys/block/sda/sda4/stat b/test/sys/block/sda/sda4/stat new file mode 100644 index 0000000000..3e7b7ad75c --- /dev/null +++ b/test/sys/block/sda/sda4/stat @@ -0,0 +1 @@ + 642730 9095506 275223 2201728 diff --git a/test/sys/block/sda/size b/test/sys/block/sda/size new file mode 100644 index 0000000000..88da032f61 --- /dev/null +++ b/test/sys/block/sda/size @@ -0,0 +1 @@ +71096640 diff --git a/test/sys/block/sda/stat b/test/sys/block/sda/stat new file mode 100644 index 0000000000..b93c7d4ac4 --- /dev/null +++ b/test/sys/block/sda/stat @@ -0,0 +1 @@ + 1043906 19157 16008400 4313104 317001 625161 7560502 48785829 0 3846686 53153390 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/class b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/class new file mode 100644 index 0000000000..145a550829 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/class @@ -0,0 +1 @@ +0x010000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/device new file mode 100644 index 0000000000..c271a13ff6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/device @@ -0,0 +1 @@ +0x008f diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model new file mode 100644 index 0000000000..392039b199 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model @@ -0,0 +1 @@ +ST336605LW !# diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth @@ -0,0 +1 @@ +32 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev new file mode 100644 index 0000000000..65dd514497 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev @@ -0,0 +1 @@ +B245 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor new file mode 100644 index 0000000000..d87b2a5c0b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor @@ -0,0 +1 @@ +IBM-ESXS diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/irq b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/irq new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/irq @@ -0,0 +1 @@ +22 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/resource b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/resource new file mode 100644 index 0000000000..2a3d654b9a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/resource @@ -0,0 +1,7 @@ +0x0000000000007400 0x00000000000074ff 0x0000000000000101 +0x0000000080a11000 0x0000000080a11fff 0x0000000000000204 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000080a40000 0x0000000080a5ffff 0x0000000000007200 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_device new file mode 100644 index 0000000000..8419b39dd6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_device @@ -0,0 +1 @@ +0x0205 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_vendor new file mode 100644 index 0000000000..7369ccd585 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_vendor @@ -0,0 +1 @@ +0x1014 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/vendor new file mode 100644 index 0000000000..a5d57044c8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/vendor @@ -0,0 +1 @@ +0x9005 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/class b/test/sys/devices/pci0000:00/0000:00:1e.0/class new file mode 100644 index 0000000000..8b40e6a7b7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/class @@ -0,0 +1 @@ +0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/device b/test/sys/devices/pci0000:00/0000:00:1e.0/device new file mode 100644 index 0000000000..9fe3927fbb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/device @@ -0,0 +1 @@ +0x244e diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/irq b/test/sys/devices/pci0000:00/0000:00:1e.0/irq new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/irq @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/resource b/test/sys/devices/pci0000:00/0000:00:1e.0/resource new file mode 100644 index 0000000000..f8f56abf32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/resource @@ -0,0 +1,12 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_device new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_device @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_vendor new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_vendor @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/vendor @@ -0,0 +1 @@ +0x8086 -- cgit v1.2.3-54-g00ecf From daf0bafa81db60954e20ff7199c8a24ae00d2b67 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 01:15:20 -0700 Subject: [PATCH] hm, makefile bug with so many files... will fix later... --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a5c00b7191..c7d0391473 100644 --- a/Makefile +++ b/Makefile @@ -172,7 +172,7 @@ clean: $(MAKE) -C libsysfs clean $(MAKE) -C tdb clean -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | sort ) +#DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . release: $(DISTFILES) clean -- cgit v1.2.3-54-g00ecf From 6c0eae77a1443c51a0c089f4d4053ffff13666f5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 01:32:07 -0700 Subject: [PATCH] makefile fix for now. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c7d0391473..ea0dc10c28 100644 --- a/Makefile +++ b/Makefile @@ -172,7 +172,7 @@ clean: $(MAKE) -C libsysfs clean $(MAKE) -C tdb clean -#DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | sort ) +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . release: $(DISTFILES) clean -- cgit v1.2.3-54-g00ecf From a41a0e28c2ba0abf99b5e7ea17645ae0e4f05758 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 18:37:40 -0700 Subject: [PATCH] added klibc version 0.82 (cvs tree) to the udev tree. Not hooked up to the build yet. --- klibc/MCONFIG | 41 + klibc/Makefile | 7 +- klibc/README | 16 + klibc/klibc/CAVEATS | 51 + klibc/klibc/LICENSE | 73 + klibc/klibc/MCONFIG | 49 + klibc/klibc/Makefile | 135 + klibc/klibc/README | 57 + klibc/klibc/SOCKETCALLS | 21 + klibc/klibc/SYSCALLS | 146 + klibc/klibc/__shared_init.c | 56 + klibc/klibc/__signal.c | 22 + klibc/klibc/__static_init.c | 40 + klibc/klibc/abort.c | 19 + klibc/klibc/alarm.c | 29 + klibc/klibc/arch/README | 67 + klibc/klibc/arch/alpha/MCONFIG | 17 + klibc/klibc/arch/alpha/Makefile.inc | 93 + klibc/klibc/arch/alpha/README-gcc | 23 + klibc/klibc/arch/alpha/crt0.S | 21 + klibc/klibc/arch/alpha/divide.c | 57 + klibc/klibc/arch/alpha/include/klibc/archsetjmp.h | 33 + klibc/klibc/arch/alpha/include/klibc/archsys.h | 53 + klibc/klibc/arch/alpha/include/machine/asm.h | 44 + klibc/klibc/arch/alpha/pipe.c | 28 + klibc/klibc/arch/alpha/setjmp.S | 77 + klibc/klibc/arch/arm/MCONFIG | 26 + klibc/klibc/arch/arm/Makefile.inc | 31 + klibc/klibc/arch/arm/crt0.S | 25 + klibc/klibc/arch/arm/include/klibc/archsetjmp.h | 14 + klibc/klibc/arch/arm/include/klibc/archsys.h | 12 + klibc/klibc/arch/arm/setjmp-arm.S | 40 + klibc/klibc/arch/arm/setjmp-thumb.S | 58 + klibc/klibc/arch/cris/MCONFIG | 11 + klibc/klibc/arch/cris/Makefile.inc | 10 + klibc/klibc/arch/cris/include/klibc/archsys.h | 12 + klibc/klibc/arch/i386/MCONFIG | 32 + klibc/klibc/arch/i386/Makefile.inc | 27 + klibc/klibc/arch/i386/crt0.S | 33 + klibc/klibc/arch/i386/exits.S | 45 + klibc/klibc/arch/i386/include/klibc/archsetjmp.h | 19 + klibc/klibc/arch/i386/include/klibc/archsys.h | 96 + klibc/klibc/arch/i386/include/klibc/diverr.h | 16 + klibc/klibc/arch/i386/libgcc/__ashldi3.S | 29 + klibc/klibc/arch/i386/libgcc/__ashrdi3.S | 29 + klibc/klibc/arch/i386/libgcc/__lshrdi3.S | 29 + klibc/klibc/arch/i386/libgcc/__muldi3.S | 34 + klibc/klibc/arch/i386/libgcc/__negdi2.S | 21 + klibc/klibc/arch/i386/setjmp.S | 58 + klibc/klibc/arch/i386/socketcall.S | 38 + klibc/klibc/arch/ia64/MCONFIG | 11 + klibc/klibc/arch/ia64/Makefile.inc | 10 + klibc/klibc/arch/ia64/include/klibc/archsys.h | 12 + klibc/klibc/arch/m68k/MCONFIG | 11 + klibc/klibc/arch/m68k/Makefile.inc | 10 + klibc/klibc/arch/m68k/include/klibc/archsys.h | 12 + klibc/klibc/arch/mips/MCONFIG | 18 + klibc/klibc/arch/mips/Makefile.inc | 24 + klibc/klibc/arch/mips/crt0.S | 25 + klibc/klibc/arch/mips/include/klibc/archsetjmp.h | 39 + klibc/klibc/arch/mips/include/klibc/archsys.h | 12 + klibc/klibc/arch/mips/include/machine/asm.h | 11 + klibc/klibc/arch/mips/include/sgidefs.h | 20 + klibc/klibc/arch/mips/pipe.S | 16 + klibc/klibc/arch/mips/setjmp.S | 82 + klibc/klibc/arch/mips/vfork.S | 19 + klibc/klibc/arch/mips64/MCONFIG | 11 + klibc/klibc/arch/mips64/Makefile.inc | 10 + klibc/klibc/arch/mips64/include/klibc/archsys.h | 12 + klibc/klibc/arch/parisc/MCONFIG | 11 + klibc/klibc/arch/parisc/Makefile.inc | 10 + klibc/klibc/arch/parisc/include/klibc/archsys.h | 12 + klibc/klibc/arch/ppc/MCONFIG | 11 + klibc/klibc/arch/ppc/Makefile.inc | 15 + klibc/klibc/arch/ppc/crt0.S | 29 + klibc/klibc/arch/ppc/include/klibc/archsetjmp.h | 36 + klibc/klibc/arch/ppc/include/klibc/archsys.h | 55 + klibc/klibc/arch/ppc/setjmp.S | 35 + klibc/klibc/arch/ppc64/MCONFIG | 11 + klibc/klibc/arch/ppc64/Makefile.inc | 10 + klibc/klibc/arch/ppc64/crt0.S | 38 + klibc/klibc/arch/ppc64/include/klibc/archsys.h | 52 + klibc/klibc/arch/s390/MCONFIG | 13 + klibc/klibc/arch/s390/Makefile.inc | 16 + klibc/klibc/arch/s390/crt0.S | 25 + klibc/klibc/arch/s390/include/klibc/archsetjmp.h | 15 + klibc/klibc/arch/s390/include/klibc/archsys.h | 41 + klibc/klibc/arch/s390/setjmp.S | 32 + klibc/klibc/arch/s390x/MCONFIG | 13 + klibc/klibc/arch/s390x/Makefile.inc | 16 + klibc/klibc/arch/s390x/crt0.S | 21 + klibc/klibc/arch/s390x/include/klibc/archsetjmp.h | 15 + klibc/klibc/arch/s390x/include/klibc/archsys.h | 41 + klibc/klibc/arch/s390x/setjmp.S | 36 + klibc/klibc/arch/sh/MCONFIG | 19 + klibc/klibc/arch/sh/Makefile.inc | 14 + klibc/klibc/arch/sh/crt0.S | 28 + klibc/klibc/arch/sh/include/klibc/archsetjmp.h | 22 + klibc/klibc/arch/sh/include/klibc/archsys.h | 12 + klibc/klibc/arch/sh/setjmp.S | 65 + klibc/klibc/arch/sparc/MCONFIG | 18 + klibc/klibc/arch/sparc/Makefile.inc | 44 + klibc/klibc/arch/sparc/crt0.S | 2 + klibc/klibc/arch/sparc/crt0i.S | 100 + klibc/klibc/arch/sparc/divrem.m4 | 276 ++ klibc/klibc/arch/sparc/include/klibc/archsetjmp.h | 16 + klibc/klibc/arch/sparc/include/klibc/archsys.h | 65 + klibc/klibc/arch/sparc/include/machine/asm.h | 192 + klibc/klibc/arch/sparc/include/machine/frame.h | 138 + klibc/klibc/arch/sparc/include/machine/trap.h | 141 + klibc/klibc/arch/sparc/setjmp.S | 38 + klibc/klibc/arch/sparc/smul.S | 160 + klibc/klibc/arch/sparc/umul.S | 193 + klibc/klibc/arch/sparc64/MCONFIG | 21 + klibc/klibc/arch/sparc64/Makefile.inc | 13 + klibc/klibc/arch/sparc64/crt0.S | 2 + .../klibc/arch/sparc64/include/klibc/archsetjmp.h | 16 + klibc/klibc/arch/sparc64/include/klibc/archsys.h | 157 + klibc/klibc/arch/sparc64/setjmp.S | 55 + klibc/klibc/arch/x86_64/MCONFIG | 16 + klibc/klibc/arch/x86_64/Makefile.inc | 16 + klibc/klibc/arch/x86_64/crt0.S | 22 + klibc/klibc/arch/x86_64/exits.S | 35 + klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h | 21 + klibc/klibc/arch/x86_64/include/klibc/archsys.h | 32 + klibc/klibc/arch/x86_64/setjmp.S | 54 + klibc/klibc/assert.c | 13 + klibc/klibc/atexit.c | 10 + klibc/klibc/atexit.h | 19 + klibc/klibc/atoi.c | 3 + klibc/klibc/atol.c | 3 + klibc/klibc/atoll.c | 3 + klibc/klibc/atox.c | 14 + klibc/klibc/brk.c | 24 + klibc/klibc/bsd_signal.c | 11 + klibc/klibc/calloc.c | 21 + klibc/klibc/closelog.c | 18 + klibc/klibc/creat.c | 12 + klibc/klibc/ctypes.c | 281 ++ klibc/klibc/exec_l.c | 57 + klibc/klibc/execl.c | 8 + klibc/klibc/execle.c | 8 + klibc/klibc/execlp.c | 8 + klibc/klibc/execlpe.c | 8 + klibc/klibc/execv.c | 13 + klibc/klibc/execvp.c | 13 + klibc/klibc/execvpe.c | 73 + klibc/klibc/exitc.c | 36 + klibc/klibc/fdatasync.c | 15 + klibc/klibc/fgetc.c | 20 + klibc/klibc/fgets.c | 33 + klibc/klibc/fopen.c | 46 + klibc/klibc/fork.c | 29 + klibc/klibc/fprintf.c | 19 + klibc/klibc/fputc.c | 14 + klibc/klibc/fputs.c | 15 + klibc/klibc/fread.c | 35 + klibc/klibc/fread2.c | 13 + klibc/klibc/fwrite.c | 35 + klibc/klibc/fwrite2.c | 13 + klibc/klibc/getcwd.c | 15 + klibc/klibc/getdomainname.c | 25 + klibc/klibc/getenv.c | 22 + klibc/klibc/gethostname.c | 25 + klibc/klibc/getopt.c | 74 + klibc/klibc/getpriority.c | 25 + klibc/klibc/globals.c | 10 + klibc/klibc/include/alloca.h | 13 + klibc/klibc/include/arpa/inet.h | 24 + klibc/klibc/include/assert.h | 22 + klibc/klibc/include/bits32/bitsize/limits.h | 14 + klibc/klibc/include/bits32/bitsize/stddef.h | 18 + klibc/klibc/include/bits32/bitsize/stdint.h | 34 + klibc/klibc/include/bits32/bitsize/stdintconst.h | 18 + klibc/klibc/include/bits32/bitsize/stdintlimits.h | 22 + klibc/klibc/include/bits64/bitsize/limits.h | 14 + klibc/klibc/include/bits64/bitsize/stddef.h | 13 + klibc/klibc/include/bits64/bitsize/stdint.h | 36 + klibc/klibc/include/bits64/bitsize/stdintconst.h | 18 + klibc/klibc/include/bits64/bitsize/stdintlimits.h | 22 + klibc/klibc/include/ctype.h | 117 + klibc/klibc/include/dirent.h | 20 + klibc/klibc/include/elf.h | 12 + klibc/klibc/include/endian.h | 41 + klibc/klibc/include/errno.h | 8 + klibc/klibc/include/fcntl.h | 11 + klibc/klibc/include/grp.h | 13 + klibc/klibc/include/inttypes.h | 226 ++ klibc/klibc/include/klibc/compiler.h | 61 + klibc/klibc/include/klibc/diverr.h | 16 + klibc/klibc/include/klibc/extern.h | 14 + klibc/klibc/include/limits.h | 40 + klibc/klibc/include/net/if.h | 1 + klibc/klibc/include/net/if_arp.h | 1 + klibc/klibc/include/net/if_ether.h | 1 + klibc/klibc/include/net/if_packet.h | 1 + klibc/klibc/include/netinet/in.h | 33 + klibc/klibc/include/netinet/in6.h | 10 + klibc/klibc/include/netinet/ip.h | 13 + klibc/klibc/include/netinet/tcp.h | 11 + klibc/klibc/include/netinet/udp.h | 19 + klibc/klibc/include/poll.h | 16 + klibc/klibc/include/sched.h | 23 + klibc/klibc/include/setjmp.h | 43 + klibc/klibc/include/signal.h | 72 + klibc/klibc/include/stdarg.h | 14 + klibc/klibc/include/stddef.h | 24 + klibc/klibc/include/stdint.h | 113 + klibc/klibc/include/stdio.h | 109 + klibc/klibc/include/stdlib.h | 94 + klibc/klibc/include/string.h | 37 + klibc/klibc/include/sys/dirent.h | 13 + klibc/klibc/include/sys/fsuid.h | 14 + klibc/klibc/include/sys/ioctl.h | 14 + klibc/klibc/include/sys/klog.h | 24 + klibc/klibc/include/sys/mman.h | 21 + klibc/klibc/include/sys/module.h | 158 + klibc/klibc/include/sys/mount.h | 55 + klibc/klibc/include/sys/param.h | 11 + klibc/klibc/include/sys/reboot.h | 25 + klibc/klibc/include/sys/resource.h | 15 + klibc/klibc/include/sys/select.h | 13 + klibc/klibc/include/sys/socket.h | 50 + klibc/klibc/include/sys/socketcalls.h | 28 + klibc/klibc/include/sys/stat.h | 23 + klibc/klibc/include/sys/syscall.h | 15 + klibc/klibc/include/sys/time.h | 16 + klibc/klibc/include/sys/times.h | 14 + klibc/klibc/include/sys/types.h | 127 + klibc/klibc/include/sys/uio.h | 15 + klibc/klibc/include/sys/utime.h | 10 + klibc/klibc/include/sys/utsname.h | 23 + klibc/klibc/include/sys/vfs.h | 14 + klibc/klibc/include/sys/wait.h | 19 + klibc/klibc/include/syslog.h | 53 + klibc/klibc/include/termios.h | 86 + klibc/klibc/include/time.h | 14 + klibc/klibc/include/unistd.h | 111 + klibc/klibc/include/utime.h | 15 + klibc/klibc/inet/bindresvport.c | 48 + klibc/klibc/inet/inet_addr.c | 14 + klibc/klibc/inet/inet_aton.c | 23 + klibc/klibc/inet/inet_ntoa.c | 19 + klibc/klibc/inet/inet_ntop.c | 52 + klibc/klibc/inet/inet_pton.c | 74 + klibc/klibc/interp.S | 11 + klibc/klibc/isatty.c | 21 + klibc/klibc/libgcc/__divdi3.c | 29 + klibc/klibc/libgcc/__divsi3.c | 29 + klibc/klibc/libgcc/__moddi3.c | 29 + klibc/klibc/libgcc/__modsi3.c | 29 + klibc/klibc/libgcc/__udivdi3.c | 13 + klibc/klibc/libgcc/__udivmoddi4.c | 32 + klibc/klibc/libgcc/__udivmodsi4.c | 32 + klibc/klibc/libgcc/__udivsi3.c | 13 + klibc/klibc/libgcc/__umoddi3.c | 16 + klibc/klibc/libgcc/__umodsi3.c | 16 + klibc/klibc/llseek.c | 34 + klibc/klibc/lrand48.c | 42 + klibc/klibc/makeerrlist.pl | 80 + klibc/klibc/malloc.c | 192 + klibc/klibc/malloc.h | 51 + klibc/klibc/memccpy.c | 23 + klibc/klibc/memchr.c | 18 + klibc/klibc/memcmp.c | 19 + klibc/klibc/memcpy.c | 29 + klibc/klibc/memmem.c | 44 + klibc/klibc/memmove.c | 34 + klibc/klibc/memset.c | 30 + klibc/klibc/memswap.c | 23 + klibc/klibc/mmap.c | 51 + klibc/klibc/nice.c | 22 + klibc/klibc/onexit.c | 39 + klibc/klibc/pause.c | 21 + klibc/klibc/perror.c | 12 + klibc/klibc/printf.c | 19 + klibc/klibc/pty.c | 31 + klibc/klibc/puts.c | 13 + klibc/klibc/qsort.c | 42 + klibc/klibc/raise.c | 11 + klibc/klibc/readdir.c | 66 + klibc/klibc/realloc.c | 49 + klibc/klibc/reboot.c | 15 + klibc/klibc/recv.c | 11 + klibc/klibc/sbrk.c | 23 + klibc/klibc/seed48.c | 19 + klibc/klibc/select.c | 9 + klibc/klibc/send.c | 11 + klibc/klibc/setegid.c | 10 + klibc/klibc/setenv.c | 124 + klibc/klibc/seteuid.c | 10 + klibc/klibc/setpgrp.c | 10 + klibc/klibc/setresgid.c | 29 + klibc/klibc/setresuid.c | 30 + klibc/klibc/sha1hash.c | 317 ++ klibc/klibc/sigaction.c | 19 + klibc/klibc/siglist.c | 115 + klibc/klibc/siglongjmp.c | 16 + klibc/klibc/signal.c | 11 + klibc/klibc/sigpending.c | 19 + klibc/klibc/sigprocmask.c | 19 + klibc/klibc/sigsuspend.c | 19 + klibc/klibc/sleep.c | 20 + klibc/klibc/snprintf.c | 16 + klibc/klibc/socketcalls.pl | 71 + klibc/klibc/socketcommon.h | 25 + klibc/klibc/sprintf.c | 18 + klibc/klibc/srand48.c | 16 + klibc/klibc/sscanf.c | 17 + klibc/klibc/strcat.c | 11 + klibc/klibc/strchr.c | 16 + klibc/klibc/strcmp.c | 20 + klibc/klibc/strcpy.c | 20 + klibc/klibc/strdup.c | 17 + klibc/klibc/strerror.c | 25 + klibc/klibc/strlen.c | 14 + klibc/klibc/strncat.c | 11 + klibc/klibc/strncmp.c | 20 + klibc/klibc/strncpy.c | 22 + klibc/klibc/strntoimax.c | 13 + klibc/klibc/strntoumax.c | 75 + klibc/klibc/strrchr.c | 18 + klibc/klibc/strsep.c | 21 + klibc/klibc/strspn.c | 67 + klibc/klibc/strstr.c | 10 + klibc/klibc/strtoimax.c | 3 + klibc/klibc/strtok.c | 16 + klibc/klibc/strtol.c | 3 + klibc/klibc/strtoll.c | 3 + klibc/klibc/strtoul.c | 3 + klibc/klibc/strtoull.c | 3 + klibc/klibc/strtoumax.c | 3 + klibc/klibc/strtox.c | 13 + klibc/klibc/syscalls.pl | 81 + klibc/klibc/syscommon.h | 29 + klibc/klibc/syslog.c | 74 + klibc/klibc/system.c | 61 + klibc/klibc/tests/getenvtest.c | 26 + klibc/klibc/tests/getopttest.c | 31 + klibc/klibc/tests/hello.c | 7 + klibc/klibc/tests/idtest.c | 14 + klibc/klibc/tests/malloctest.c | 4145 ++++++++++++++++++++ klibc/klibc/tests/memstrtest.c | 29 + klibc/klibc/tests/microhello.c | 9 + klibc/klibc/tests/minihello.c | 7 + klibc/klibc/tests/minips.c | 452 +++ klibc/klibc/tests/nfs_no_rpc.c | 538 +++ klibc/klibc/tests/setjmptest.c | 36 + klibc/klibc/tests/testrand48.c | 19 + klibc/klibc/tests/testvsnp.c | 115 + klibc/klibc/time.c | 27 + klibc/klibc/umount.c | 12 + klibc/klibc/unsetenv.c | 40 + klibc/klibc/usleep.c | 15 + klibc/klibc/utime.c | 30 + klibc/klibc/vfprintf.c | 26 + klibc/klibc/vprintf.c | 11 + klibc/klibc/vsnprintf.c | 433 ++ klibc/klibc/vsprintf.c | 11 + klibc/klibc/vsscanf.c | 365 ++ klibc/klibc/wait.c | 12 + klibc/klibc/wait3.c | 12 + klibc/klibc/waitpid.c | 12 + klibc/version | 1 + 364 files changed, 18233 insertions(+), 2 deletions(-) create mode 100644 klibc/MCONFIG create mode 100644 klibc/README create mode 100644 klibc/klibc/CAVEATS create mode 100644 klibc/klibc/LICENSE create mode 100644 klibc/klibc/MCONFIG create mode 100644 klibc/klibc/Makefile create mode 100644 klibc/klibc/README create mode 100644 klibc/klibc/SOCKETCALLS create mode 100644 klibc/klibc/SYSCALLS create mode 100644 klibc/klibc/__shared_init.c create mode 100644 klibc/klibc/__signal.c create mode 100644 klibc/klibc/__static_init.c create mode 100644 klibc/klibc/abort.c create mode 100644 klibc/klibc/alarm.c create mode 100644 klibc/klibc/arch/README create mode 100644 klibc/klibc/arch/alpha/MCONFIG create mode 100644 klibc/klibc/arch/alpha/Makefile.inc create mode 100644 klibc/klibc/arch/alpha/README-gcc create mode 100644 klibc/klibc/arch/alpha/crt0.S create mode 100644 klibc/klibc/arch/alpha/divide.c create mode 100644 klibc/klibc/arch/alpha/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/alpha/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/alpha/include/machine/asm.h create mode 100644 klibc/klibc/arch/alpha/pipe.c create mode 100644 klibc/klibc/arch/alpha/setjmp.S create mode 100644 klibc/klibc/arch/arm/MCONFIG create mode 100644 klibc/klibc/arch/arm/Makefile.inc create mode 100644 klibc/klibc/arch/arm/crt0.S create mode 100644 klibc/klibc/arch/arm/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/arm/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/arm/setjmp-arm.S create mode 100644 klibc/klibc/arch/arm/setjmp-thumb.S create mode 100644 klibc/klibc/arch/cris/MCONFIG create mode 100644 klibc/klibc/arch/cris/Makefile.inc create mode 100644 klibc/klibc/arch/cris/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/i386/MCONFIG create mode 100644 klibc/klibc/arch/i386/Makefile.inc create mode 100644 klibc/klibc/arch/i386/crt0.S create mode 100644 klibc/klibc/arch/i386/exits.S create mode 100644 klibc/klibc/arch/i386/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/i386/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/i386/include/klibc/diverr.h create mode 100644 klibc/klibc/arch/i386/libgcc/__ashldi3.S create mode 100644 klibc/klibc/arch/i386/libgcc/__ashrdi3.S create mode 100644 klibc/klibc/arch/i386/libgcc/__lshrdi3.S create mode 100644 klibc/klibc/arch/i386/libgcc/__muldi3.S create mode 100644 klibc/klibc/arch/i386/libgcc/__negdi2.S create mode 100644 klibc/klibc/arch/i386/setjmp.S create mode 100644 klibc/klibc/arch/i386/socketcall.S create mode 100644 klibc/klibc/arch/ia64/MCONFIG create mode 100644 klibc/klibc/arch/ia64/Makefile.inc create mode 100644 klibc/klibc/arch/ia64/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/m68k/MCONFIG create mode 100644 klibc/klibc/arch/m68k/Makefile.inc create mode 100644 klibc/klibc/arch/m68k/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/mips/MCONFIG create mode 100644 klibc/klibc/arch/mips/Makefile.inc create mode 100644 klibc/klibc/arch/mips/crt0.S create mode 100644 klibc/klibc/arch/mips/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/mips/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/mips/include/machine/asm.h create mode 100644 klibc/klibc/arch/mips/include/sgidefs.h create mode 100644 klibc/klibc/arch/mips/pipe.S create mode 100644 klibc/klibc/arch/mips/setjmp.S create mode 100644 klibc/klibc/arch/mips/vfork.S create mode 100644 klibc/klibc/arch/mips64/MCONFIG create mode 100644 klibc/klibc/arch/mips64/Makefile.inc create mode 100644 klibc/klibc/arch/mips64/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/parisc/MCONFIG create mode 100644 klibc/klibc/arch/parisc/Makefile.inc create mode 100644 klibc/klibc/arch/parisc/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/ppc/MCONFIG create mode 100644 klibc/klibc/arch/ppc/Makefile.inc create mode 100644 klibc/klibc/arch/ppc/crt0.S create mode 100644 klibc/klibc/arch/ppc/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/ppc/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/ppc/setjmp.S create mode 100644 klibc/klibc/arch/ppc64/MCONFIG create mode 100644 klibc/klibc/arch/ppc64/Makefile.inc create mode 100644 klibc/klibc/arch/ppc64/crt0.S create mode 100644 klibc/klibc/arch/ppc64/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/s390/MCONFIG create mode 100644 klibc/klibc/arch/s390/Makefile.inc create mode 100644 klibc/klibc/arch/s390/crt0.S create mode 100644 klibc/klibc/arch/s390/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/s390/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/s390/setjmp.S create mode 100644 klibc/klibc/arch/s390x/MCONFIG create mode 100644 klibc/klibc/arch/s390x/Makefile.inc create mode 100644 klibc/klibc/arch/s390x/crt0.S create mode 100644 klibc/klibc/arch/s390x/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/s390x/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/s390x/setjmp.S create mode 100644 klibc/klibc/arch/sh/MCONFIG create mode 100644 klibc/klibc/arch/sh/Makefile.inc create mode 100644 klibc/klibc/arch/sh/crt0.S create mode 100644 klibc/klibc/arch/sh/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/sh/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/sh/setjmp.S create mode 100644 klibc/klibc/arch/sparc/MCONFIG create mode 100644 klibc/klibc/arch/sparc/Makefile.inc create mode 100644 klibc/klibc/arch/sparc/crt0.S create mode 100644 klibc/klibc/arch/sparc/crt0i.S create mode 100644 klibc/klibc/arch/sparc/divrem.m4 create mode 100644 klibc/klibc/arch/sparc/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/sparc/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/sparc/include/machine/asm.h create mode 100644 klibc/klibc/arch/sparc/include/machine/frame.h create mode 100644 klibc/klibc/arch/sparc/include/machine/trap.h create mode 100644 klibc/klibc/arch/sparc/setjmp.S create mode 100644 klibc/klibc/arch/sparc/smul.S create mode 100644 klibc/klibc/arch/sparc/umul.S create mode 100644 klibc/klibc/arch/sparc64/MCONFIG create mode 100644 klibc/klibc/arch/sparc64/Makefile.inc create mode 100644 klibc/klibc/arch/sparc64/crt0.S create mode 100644 klibc/klibc/arch/sparc64/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/sparc64/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/sparc64/setjmp.S create mode 100644 klibc/klibc/arch/x86_64/MCONFIG create mode 100644 klibc/klibc/arch/x86_64/Makefile.inc create mode 100644 klibc/klibc/arch/x86_64/crt0.S create mode 100644 klibc/klibc/arch/x86_64/exits.S create mode 100644 klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/x86_64/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/x86_64/setjmp.S create mode 100644 klibc/klibc/assert.c create mode 100644 klibc/klibc/atexit.c create mode 100644 klibc/klibc/atexit.h create mode 100644 klibc/klibc/atoi.c create mode 100644 klibc/klibc/atol.c create mode 100644 klibc/klibc/atoll.c create mode 100644 klibc/klibc/atox.c create mode 100644 klibc/klibc/brk.c create mode 100644 klibc/klibc/bsd_signal.c create mode 100644 klibc/klibc/calloc.c create mode 100644 klibc/klibc/closelog.c create mode 100644 klibc/klibc/creat.c create mode 100644 klibc/klibc/ctypes.c create mode 100644 klibc/klibc/exec_l.c create mode 100644 klibc/klibc/execl.c create mode 100644 klibc/klibc/execle.c create mode 100644 klibc/klibc/execlp.c create mode 100644 klibc/klibc/execlpe.c create mode 100644 klibc/klibc/execv.c create mode 100644 klibc/klibc/execvp.c create mode 100644 klibc/klibc/execvpe.c create mode 100644 klibc/klibc/exitc.c create mode 100644 klibc/klibc/fdatasync.c create mode 100644 klibc/klibc/fgetc.c create mode 100644 klibc/klibc/fgets.c create mode 100644 klibc/klibc/fopen.c create mode 100644 klibc/klibc/fork.c create mode 100644 klibc/klibc/fprintf.c create mode 100644 klibc/klibc/fputc.c create mode 100644 klibc/klibc/fputs.c create mode 100644 klibc/klibc/fread.c create mode 100644 klibc/klibc/fread2.c create mode 100644 klibc/klibc/fwrite.c create mode 100644 klibc/klibc/fwrite2.c create mode 100644 klibc/klibc/getcwd.c create mode 100644 klibc/klibc/getdomainname.c create mode 100644 klibc/klibc/getenv.c create mode 100644 klibc/klibc/gethostname.c create mode 100644 klibc/klibc/getopt.c create mode 100644 klibc/klibc/getpriority.c create mode 100644 klibc/klibc/globals.c create mode 100644 klibc/klibc/include/alloca.h create mode 100644 klibc/klibc/include/arpa/inet.h create mode 100644 klibc/klibc/include/assert.h create mode 100644 klibc/klibc/include/bits32/bitsize/limits.h create mode 100644 klibc/klibc/include/bits32/bitsize/stddef.h create mode 100644 klibc/klibc/include/bits32/bitsize/stdint.h create mode 100644 klibc/klibc/include/bits32/bitsize/stdintconst.h create mode 100644 klibc/klibc/include/bits32/bitsize/stdintlimits.h create mode 100644 klibc/klibc/include/bits64/bitsize/limits.h create mode 100644 klibc/klibc/include/bits64/bitsize/stddef.h create mode 100644 klibc/klibc/include/bits64/bitsize/stdint.h create mode 100644 klibc/klibc/include/bits64/bitsize/stdintconst.h create mode 100644 klibc/klibc/include/bits64/bitsize/stdintlimits.h create mode 100644 klibc/klibc/include/ctype.h create mode 100644 klibc/klibc/include/dirent.h create mode 100644 klibc/klibc/include/elf.h create mode 100644 klibc/klibc/include/endian.h create mode 100644 klibc/klibc/include/errno.h create mode 100644 klibc/klibc/include/fcntl.h create mode 100644 klibc/klibc/include/grp.h create mode 100644 klibc/klibc/include/inttypes.h create mode 100644 klibc/klibc/include/klibc/compiler.h create mode 100644 klibc/klibc/include/klibc/diverr.h create mode 100644 klibc/klibc/include/klibc/extern.h create mode 100644 klibc/klibc/include/limits.h create mode 100644 klibc/klibc/include/net/if.h create mode 100644 klibc/klibc/include/net/if_arp.h create mode 100644 klibc/klibc/include/net/if_ether.h create mode 100644 klibc/klibc/include/net/if_packet.h create mode 100644 klibc/klibc/include/netinet/in.h create mode 100644 klibc/klibc/include/netinet/in6.h create mode 100644 klibc/klibc/include/netinet/ip.h create mode 100644 klibc/klibc/include/netinet/tcp.h create mode 100644 klibc/klibc/include/netinet/udp.h create mode 100644 klibc/klibc/include/poll.h create mode 100644 klibc/klibc/include/sched.h create mode 100644 klibc/klibc/include/setjmp.h create mode 100644 klibc/klibc/include/signal.h create mode 100644 klibc/klibc/include/stdarg.h create mode 100644 klibc/klibc/include/stddef.h create mode 100644 klibc/klibc/include/stdint.h create mode 100644 klibc/klibc/include/stdio.h create mode 100644 klibc/klibc/include/stdlib.h create mode 100644 klibc/klibc/include/string.h create mode 100644 klibc/klibc/include/sys/dirent.h create mode 100644 klibc/klibc/include/sys/fsuid.h create mode 100644 klibc/klibc/include/sys/ioctl.h create mode 100644 klibc/klibc/include/sys/klog.h create mode 100644 klibc/klibc/include/sys/mman.h create mode 100644 klibc/klibc/include/sys/module.h create mode 100644 klibc/klibc/include/sys/mount.h create mode 100644 klibc/klibc/include/sys/param.h create mode 100644 klibc/klibc/include/sys/reboot.h create mode 100644 klibc/klibc/include/sys/resource.h create mode 100644 klibc/klibc/include/sys/select.h create mode 100644 klibc/klibc/include/sys/socket.h create mode 100644 klibc/klibc/include/sys/socketcalls.h create mode 100644 klibc/klibc/include/sys/stat.h create mode 100644 klibc/klibc/include/sys/syscall.h create mode 100644 klibc/klibc/include/sys/time.h create mode 100644 klibc/klibc/include/sys/times.h create mode 100644 klibc/klibc/include/sys/types.h create mode 100644 klibc/klibc/include/sys/uio.h create mode 100644 klibc/klibc/include/sys/utime.h create mode 100644 klibc/klibc/include/sys/utsname.h create mode 100644 klibc/klibc/include/sys/vfs.h create mode 100644 klibc/klibc/include/sys/wait.h create mode 100644 klibc/klibc/include/syslog.h create mode 100644 klibc/klibc/include/termios.h create mode 100644 klibc/klibc/include/time.h create mode 100644 klibc/klibc/include/unistd.h create mode 100644 klibc/klibc/include/utime.h create mode 100644 klibc/klibc/inet/bindresvport.c create mode 100644 klibc/klibc/inet/inet_addr.c create mode 100644 klibc/klibc/inet/inet_aton.c create mode 100644 klibc/klibc/inet/inet_ntoa.c create mode 100644 klibc/klibc/inet/inet_ntop.c create mode 100644 klibc/klibc/inet/inet_pton.c create mode 100644 klibc/klibc/interp.S create mode 100644 klibc/klibc/isatty.c create mode 100644 klibc/klibc/libgcc/__divdi3.c create mode 100644 klibc/klibc/libgcc/__divsi3.c create mode 100644 klibc/klibc/libgcc/__moddi3.c create mode 100644 klibc/klibc/libgcc/__modsi3.c create mode 100644 klibc/klibc/libgcc/__udivdi3.c create mode 100644 klibc/klibc/libgcc/__udivmoddi4.c create mode 100644 klibc/klibc/libgcc/__udivmodsi4.c create mode 100644 klibc/klibc/libgcc/__udivsi3.c create mode 100644 klibc/klibc/libgcc/__umoddi3.c create mode 100644 klibc/klibc/libgcc/__umodsi3.c create mode 100644 klibc/klibc/llseek.c create mode 100644 klibc/klibc/lrand48.c create mode 100644 klibc/klibc/makeerrlist.pl create mode 100644 klibc/klibc/malloc.c create mode 100644 klibc/klibc/malloc.h create mode 100644 klibc/klibc/memccpy.c create mode 100644 klibc/klibc/memchr.c create mode 100644 klibc/klibc/memcmp.c create mode 100644 klibc/klibc/memcpy.c create mode 100644 klibc/klibc/memmem.c create mode 100644 klibc/klibc/memmove.c create mode 100644 klibc/klibc/memset.c create mode 100644 klibc/klibc/memswap.c create mode 100644 klibc/klibc/mmap.c create mode 100644 klibc/klibc/nice.c create mode 100644 klibc/klibc/onexit.c create mode 100644 klibc/klibc/pause.c create mode 100644 klibc/klibc/perror.c create mode 100644 klibc/klibc/printf.c create mode 100644 klibc/klibc/pty.c create mode 100644 klibc/klibc/puts.c create mode 100644 klibc/klibc/qsort.c create mode 100644 klibc/klibc/raise.c create mode 100644 klibc/klibc/readdir.c create mode 100644 klibc/klibc/realloc.c create mode 100644 klibc/klibc/reboot.c create mode 100644 klibc/klibc/recv.c create mode 100644 klibc/klibc/sbrk.c create mode 100644 klibc/klibc/seed48.c create mode 100644 klibc/klibc/select.c create mode 100644 klibc/klibc/send.c create mode 100644 klibc/klibc/setegid.c create mode 100644 klibc/klibc/setenv.c create mode 100644 klibc/klibc/seteuid.c create mode 100644 klibc/klibc/setpgrp.c create mode 100644 klibc/klibc/setresgid.c create mode 100644 klibc/klibc/setresuid.c create mode 100644 klibc/klibc/sha1hash.c create mode 100644 klibc/klibc/sigaction.c create mode 100644 klibc/klibc/siglist.c create mode 100644 klibc/klibc/siglongjmp.c create mode 100644 klibc/klibc/signal.c create mode 100644 klibc/klibc/sigpending.c create mode 100644 klibc/klibc/sigprocmask.c create mode 100644 klibc/klibc/sigsuspend.c create mode 100644 klibc/klibc/sleep.c create mode 100644 klibc/klibc/snprintf.c create mode 100644 klibc/klibc/socketcalls.pl create mode 100644 klibc/klibc/socketcommon.h create mode 100644 klibc/klibc/sprintf.c create mode 100644 klibc/klibc/srand48.c create mode 100644 klibc/klibc/sscanf.c create mode 100644 klibc/klibc/strcat.c create mode 100644 klibc/klibc/strchr.c create mode 100644 klibc/klibc/strcmp.c create mode 100644 klibc/klibc/strcpy.c create mode 100644 klibc/klibc/strdup.c create mode 100644 klibc/klibc/strerror.c create mode 100644 klibc/klibc/strlen.c create mode 100644 klibc/klibc/strncat.c create mode 100644 klibc/klibc/strncmp.c create mode 100644 klibc/klibc/strncpy.c create mode 100644 klibc/klibc/strntoimax.c create mode 100644 klibc/klibc/strntoumax.c create mode 100644 klibc/klibc/strrchr.c create mode 100644 klibc/klibc/strsep.c create mode 100644 klibc/klibc/strspn.c create mode 100644 klibc/klibc/strstr.c create mode 100644 klibc/klibc/strtoimax.c create mode 100644 klibc/klibc/strtok.c create mode 100644 klibc/klibc/strtol.c create mode 100644 klibc/klibc/strtoll.c create mode 100644 klibc/klibc/strtoul.c create mode 100644 klibc/klibc/strtoull.c create mode 100644 klibc/klibc/strtoumax.c create mode 100644 klibc/klibc/strtox.c create mode 100644 klibc/klibc/syscalls.pl create mode 100644 klibc/klibc/syscommon.h create mode 100644 klibc/klibc/syslog.c create mode 100644 klibc/klibc/system.c create mode 100644 klibc/klibc/tests/getenvtest.c create mode 100644 klibc/klibc/tests/getopttest.c create mode 100644 klibc/klibc/tests/hello.c create mode 100644 klibc/klibc/tests/idtest.c create mode 100644 klibc/klibc/tests/malloctest.c create mode 100644 klibc/klibc/tests/memstrtest.c create mode 100644 klibc/klibc/tests/microhello.c create mode 100644 klibc/klibc/tests/minihello.c create mode 100644 klibc/klibc/tests/minips.c create mode 100644 klibc/klibc/tests/nfs_no_rpc.c create mode 100644 klibc/klibc/tests/setjmptest.c create mode 100644 klibc/klibc/tests/testrand48.c create mode 100644 klibc/klibc/tests/testvsnp.c create mode 100644 klibc/klibc/time.c create mode 100644 klibc/klibc/umount.c create mode 100644 klibc/klibc/unsetenv.c create mode 100644 klibc/klibc/usleep.c create mode 100644 klibc/klibc/utime.c create mode 100644 klibc/klibc/vfprintf.c create mode 100644 klibc/klibc/vprintf.c create mode 100644 klibc/klibc/vsnprintf.c create mode 100644 klibc/klibc/vsprintf.c create mode 100644 klibc/klibc/vsscanf.c create mode 100644 klibc/klibc/wait.c create mode 100644 klibc/klibc/wait3.c create mode 100644 klibc/klibc/waitpid.c create mode 100644 klibc/version diff --git a/klibc/MCONFIG b/klibc/MCONFIG new file mode 100644 index 0000000000..ed7755b382 --- /dev/null +++ b/klibc/MCONFIG @@ -0,0 +1,41 @@ +# -*- makefile -*- +# +# Makefile configuration, without explicit rules +# + +ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) +CROSS = +CC = $(CROSS)gcc +LD = $(CROSS)ld +KLIBSRC = $(SRCROOT)/klibc +REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include -I$(KLIBSRC) \ + -I$(KLIBSRC)/arch/$(ARCH)/include \ + -I$(KLIBSRC)/include/bits$(BITSIZE) \ + -D__KLIBC__ -DBITSIZE=$(BITSIZE) -I$(KLIBSRC)/include \ + -I$(SRCROOT)/linux/include +LDFLAGS = +AR = $(CROSS)ar +RANLIB = $(CROSS)ranlib +NM = $(CROSS)nm +PERL = perl +STRIP = $(CROSS)strip --strip-all -R .comment -R .note + +HOST_CC = gcc +HOST_LDFLAGS = -s +HOST_LIBS = + +CRT0 = $(KLIBSRC)/crt0.o +KLIBC = $(KLIBSRC)/libc.a +LIBGCC = $(shell $(CC) --print-libgcc) + +# +# This indicates the location of the final version of the shared library. +# THIS MUST BE AN ABSOLUTE PATH WITH NO FINAL SLASH. +# Leave this empty to make it the root. +# +SHLIBDIR = /lib + +# +# Include arch-specific rule fragments +# +include $(KLIBSRC)/arch/$(ARCH)/MCONFIG diff --git a/klibc/Makefile b/klibc/Makefile index 288a862707..5f9a7d6a6e 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -1,3 +1,6 @@ +SUBDIRS = klibc -clean: - @echo "all clean" +all: + +%: + @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done diff --git a/klibc/README b/klibc/README new file mode 100644 index 0000000000..577de2b704 --- /dev/null +++ b/klibc/README @@ -0,0 +1,16 @@ +Please see klibc/README for how to set up the tree before building. + +klibc is archived at: + + ftp://ftp.zytor.com/pub/linux/libs/klibc/ + +There is a mailing list for klibc and early-userspace issues at: + + http://www.zytor.com/mailman/listinfo/klibc/ + +There is also a cvsweb repository at: + + http://www.zytor.com/cvsweb.cgi/klibc/ + +There is no direct public CVS access yet, however. + diff --git a/klibc/klibc/CAVEATS b/klibc/klibc/CAVEATS new file mode 100644 index 0000000000..c7131ac367 --- /dev/null +++ b/klibc/klibc/CAVEATS @@ -0,0 +1,51 @@ + ------------------------------------------------- + Please note the following caveats to using klibc: + ------------------------------------------------- + +optimization: +------------- + +Compiling with -O0 is not supported. It may or may not work; please +use -O1 if you want to do maximize debuggability. + +Compiling with -O0 is more likely to work on gcc 3. + + +setjmp()/longjmp(): +------------------- + +setjmp() and longjmp() *do not* save signal state. sigsetjmp() and +siglongjmp() *do* save the signal mask -- regardless of the value of +the extra argument. + +The standards actually state that if you pass longjmp() a final value +of zero the library should change that to a 1! Presumably the reason +is so people who write broken code can get away with writing +longjmp(buf); or something equally bad. If you pass longjmp() a final +value of 0 you get what you deserve -- setjmp() will happily return 0. + + +stdio: +------ + +Only a small subset of the stdio functions are implemented. Those +that are implemented do not buffer, although they *do* trap EINTR or +short read/writes and iterate. + +_fread() and _fwrite(), which take only one size argument (like +read/write), but do handle EINTR/short return are also available. + + +namespaces: +----------- + +klibc frequently includes headers in other headers in a way that +exposes more symbols than POSIX says they should. "Live with it." + + +theading: +--------- + +klibc is not thread-safe. Consequently, clone() or any of the +pthreads functions are not included. + diff --git a/klibc/klibc/LICENSE b/klibc/klibc/LICENSE new file mode 100644 index 0000000000..b512ff96bc --- /dev/null +++ b/klibc/klibc/LICENSE @@ -0,0 +1,73 @@ +This license applies to all files in directory and its subdirectories, +unless otherwise noted in individual files. + + +Some files are derived from files derived from the include/ directory +of the Linux kernel, and are licensed under the terms of the GNU +General Public License, version 2, as released by the Free Software +Foundation, Inc.; incorporated herein by reference. + + ----- + +Some files are derived from files copyrighted by the Regents of The +University of California, and are available under the following +license: + +Note: The advertising clause in the license appearing on BSD Unix +files was officially rescinded by the Director of the Office of +Technology Licensing of the University of California on July 22 +1999. He states that clause 3 is "hereby deleted in its entirety." + + * Copyright (c) + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + + ----- + +For all remaining files, the following license applies: + + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * Any copyright notice(s) and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/klibc/klibc/MCONFIG b/klibc/klibc/MCONFIG new file mode 100644 index 0000000000..a46a98a9dd --- /dev/null +++ b/klibc/klibc/MCONFIG @@ -0,0 +1,49 @@ +# -*- makefile -*- +# +# Makefile configuration, without explicit rules +# + +SRCROOT = .. +include ../MCONFIG + +WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline +CFLAGS = -Wp,-MD,$(dir $*).$(notdir $*).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) + +SOFLAGS = -fPIC + +.SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss + +.c.o: + $(CC) $(CFLAGS) -c -o $@ $< + +.c.i: + $(CC) $(CFLAGS) -E -o $@ $< + +.c.s: + $(CC) $(CFLAGS) -S -o $@ $< + +.S.o: + $(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $< + +.S.s: + $(CC) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $< + +.S.lo: + $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -c -o $@ $< + +.S.ls: + $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -E -o $@ $< + +.s.o: + $(CC) $(CFLAGS) -x assembler -c -o $@ $< + +.ls.lo: + $(CC) $(CFLAGS) $(SOFLAGS) -x assembler -c -o $@ $< + +.c.lo: + $(CC) $(CFLAGS) $(SOFLAGS) -c -o $@ $< + +.c.ls: + $(CC) $(CFLAGS) $(SOFLAGS) -S -o $@ $< + + diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile new file mode 100644 index 0000000000..470a276ded --- /dev/null +++ b/klibc/klibc/Makefile @@ -0,0 +1,135 @@ +# +# Makefile +# +# Main makefile +# + +# Include configuration rules +include MCONFIG + +TESTS = $(patsubst %.c,%,$(wildcard tests/*.c)) \ + $(patsubst %.c,%.shared,$(wildcard tests/*.c)) +LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ + vsscanf.o sscanf.o ctypes.o \ + strntoumax.o strntoimax.o \ + atoi.o atol.o atoll.o \ + strtol.o strtoll.o strtoul.o strtoull.o \ + strtoimax.o strtoumax.o \ + globals.o exitc.o atexit.o onexit.o \ + execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \ + fork.o wait.o wait3.o waitpid.o system.o setpgrp.o \ + printf.o vprintf.o fprintf.o vfprintf.o perror.o \ + fopen.o fread.o fread2.o fgetc.o fgets.o \ + fwrite.o fwrite2.o fputc.o fputs.o puts.o \ + sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \ + __signal.o signal.o bsd_signal.o siglist.o siglongjmp.o \ + sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ + brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ + memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ + memmove.o \ + strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o \ + strncat.o strstr.o strncmp.o strncpy.o strrchr.o strspn.o \ + strsep.o strtok.o \ + gethostname.o getdomainname.o getcwd.o \ + seteuid.o setegid.o setresuid.o setresgid.o \ + getenv.o setenv.o unsetenv.o getopt.o readdir.o \ + syslog.o closelog.o pty.o isatty.o reboot.o \ + time.o utime.o fdatasync.o llseek.o select.o nice.o getpriority.o \ + qsort.o lrand48.o srand48.o seed48.o \ + inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ + inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ + send.o recv.o +SOLIB = libc.so +SOHASH = klibc.so + +CRT0 = crt0.o +LIB = libc.a + +#all: tests $(CRT0) $(LIB) $(SOLIB) klibc.so +all: $(CRT0) $(LIB) $(SOLIB) klibc.so + +# Add any architecture-specific rules +include arch/$(ARCH)/Makefile.inc + +tests: $(TESTS) + +tests/%.o : tests/%.c + $(CC) $(CFLAGS) -c -o $@ $< + +tests/% : tests/%.o $(LIB) $(CRT0) + $(LD) $(LDFLAGS) -o $@ $(CRT0) $< $(LIB) $(LIBGCC) + cp $@ $@.stripped + $(STRIP) $@.stripped + +tests/%.shared : tests/%.o interp.o $(SOLIB) + $(LD) $(LDFLAGS) -o $@ -e main interp.o tests/$*.o -R $(SOLIB) $(LIBGCC) + cp $@ $@.stripped + $(STRIP) $@.stripped + +$(LIB): __static_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/static.obj socketcalls/static.obj + rm -f $(LIB) + $(AR) cq $(LIB) __static_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/*.o socketcalls/*.o + $(RANLIB) $(LIB) + +$(SOLIB): $(CRT0) __shared_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/static.obj socketcalls/static.obj + $(LD) $(LDFLAGS) $(SHAREDFLAGS) -o $@ \ + $(CRT0) __shared_init.o $(LIBOBJS) $(ARCHOBJS) \ + syscalls/*.o socketcalls/*.o \ + $(LIBGCC) + +sha1hash: sha1hash.c + $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ $< + +$(SOLIB).hash: $(SOLIB) sha1hash + $(NM) $(SOLIB) | \ + egrep '^[0-9a-fA-F]+ [ADRTW] ' | sort | ./sha1hash > $@ + +$(SOHASH): $(SOLIB) $(SOLIB).hash + cp -f $(SOLIB) $@ + $(STRIP) $@ + rm -f klibc-??????????????????????.so + ln -f $@ klibc-`cat $(SOLIB).hash`.so + +interp.o: interp.S $(SOLIB).hash + $(CC) $(CFLAGS) -D__ASSEMBLY__ -DLIBDIR=\"$(SHLIBDIR)\" \ + -DSOHASH=\"`cat $(SOLIB).hash`\" \ + -c -o $@ $< + +crt0.o: arch/$(ARCH)/crt0.o + cp arch/$(ARCH)/crt0.o . + +syscalls.dir: SYSCALLS syscalls.pl syscommon.h + rm -rf syscalls + mkdir syscalls + $(PERL) syscalls.pl $(ARCH) SYSCALLS + touch $@ + +socketcalls.dir: SOCKETCALLS socketcalls.pl socketcommon.h + rm -rf socketcalls + mkdir socketcalls + $(PERL) socketcalls.pl $(ARCH) SOCKETCALLS + touch $@ + +%/static.obj: %.dir + $(MAKE) objects-$(basename $(notdir $@)) DIR=$* + +STATIC = $(addsuffix .o,$(basename $(wildcard $(DIR)/*.[cS]))) + +objects-static: $(STATIC) + touch $(DIR)/static.obj + +clean: archclean + find . -type f -a \( -name \*.[isoa] -o -name \*.l[iso] \) -print0 | xargs -0rt rm -f + rm -f *.a *.so *.hash *.syms *.stripped + rm -f $(TESTS) tests/*.stripped + rm -rf syscalls syscalls.dir + rm -rf socketcalls socketcalls.dir + rm -f sha1hash + +spotless: clean + find . \( -name \*~ -o -name '.*.d' \) -not -type d -print0 | \ + xargs -0rt rm -f + +ifneq ($(wildcard $(DIR)/.*.d),) +include $(wildcard $(DIR)/.*.d) +endif diff --git a/klibc/klibc/README b/klibc/klibc/README new file mode 100644 index 0000000000..7d5751804f --- /dev/null +++ b/klibc/klibc/README @@ -0,0 +1,57 @@ +This is klibc, what is intended to be a minimalistic libc subset for +use with initramfs. It is deliberately written for small size, +minimal entaglement and portability, not speed. It is definitely a +work in progress, and a lot of things are still missing. + + +The build procedure is not very polished yet, but it should work like +this: + +a) In the source root directory (the directory above the one in which + this file is found) create a symlink called "linux" pointing to a + reasonably recent Linux kernel tree (2.4 or 2.5 should be OK.) + This tree must have the include/asm symlink set up for the + architecture you're compiling for, and include/linux/autoconf.h + must exist. The easiest way to make sure of all of these is to do + a "make config" or any of its variants on the kernel tree is + question, followed by a "make dep". + +b) If you're cross-compiling, change ARCH in the main MCONFIG file to + the appropriate architecture, and set CROSS to your toolchain + prefix. + + IMPORTANT: if you're on a 64-bit machine with a 32-bit userland + (ia64, mips64, ppc64 sparc64, s390x or x86_64), and you want to + build the 32-bit version: you need to set ARCH to the 32-bit + architecture as well as set up the linux/include/asm symlink to + point to the 32-bit architecture. Building the 32-bit architecture + usually (but not always) produces smaller binaries, and is likely + to be better tested. + + If you are on ARM, and want to build a thumb version of the library + (this is supported), change OPTFLAGS in arch/arm/MCONFIG to build + thumb code. + + The following is the last known status of various architectures: + + Known to work: alpha arm i386 s390 s390x sparc sparc64 x86_64* + Works static, not shared: mips* arm-thumb sh* + Need crt0.S updates: ppc + Missing setjmp: ppc64 + Need porting work: cris ia64 m68k mips64 parisc + + x86_64: requires a kernel header patch (to be created) + mips, sh: linker problem; might work with fixed linker + + Shared library support for sparc/sparc64 requires binutils 2.13.90.0.4. + + Note that even the "known to work" ones likely have bugs. Please + report them if you run into them. + +c) Type "make" and pray... + +d) Try the test programs in the tests/ directory. They should run... + +Contact me at for more info. + + -hpa diff --git a/klibc/klibc/SOCKETCALLS b/klibc/klibc/SOCKETCALLS new file mode 100644 index 0000000000..1ab4e367a2 --- /dev/null +++ b/klibc/klibc/SOCKETCALLS @@ -0,0 +1,21 @@ +# -*- fundamental -*- +# +# These are calls that are invoked via the socketcall mechanism +# +int socket(int, int, int) +int bind(int, struct sockaddr *, int) +int connect(int, struct sockaddr *, socklen_t) +int listen(int, int) +int accept(int, struct sockaddr *, socklen_t *) +int getsockname(int, struct sockaddr *, socklen_t *) +int getpeername(int, struct sockaddr *, socklen_t *) +int socketpair(int, int, int, int *) +# int send(int, const void *, size_t, unsigned int) +int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t) +# int recv(int, void *, size_t, unsigned int) +int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) +int shutdown(int, int) +int setsockopt(int, int, int, const void *, socklen_t) +int getsockopt(int, int, int, void *, socklen_t *) +int sendmsg(int, const struct msghdr *, unsigned int) +int recvmsg(int, struct msghdr *, unsigned int) diff --git a/klibc/klibc/SYSCALLS b/klibc/klibc/SYSCALLS new file mode 100644 index 0000000000..1ec94acec6 --- /dev/null +++ b/klibc/klibc/SYSCALLS @@ -0,0 +1,146 @@ +# -*- fundamental -*- +# +# This is a list of system calls we invoke "directly". These +# are generated into syscall stubs in their own C files, so the +# linker can do its job properly. +# +# The full description of a line is: +# [<[!]arch,...>] type sysname[@systype][::funcname](args) +# + +# +# Process-related syscalls +# + pid_t vfork() + pid_t vfork@forkish() + pid_t getpid() + pid_t getxpid@dual0::getpid() +int setpgid(pid_t, pid_t) +pid_t getpgid(pid_t) + pid_t getppid() + pid_t getxpid@dual1::getppid() + pid_t getpgrp() +pid_t setsid() +pid_t getsid(pid_t) +pid_t wait4(pid_t, int *, int, struct rusage *) +int execve(const char *, char * const *, char * const *) +int setpriority(int, int, int) +int sched_setscheduler(pid_t, int, const struct sched_param *) +int sched_yield() + +# +# User and group IDs +# +int setuid(uid_t) +int setgid(gid_t) + uid_t getuid() + uid_t getxuid@dual0::getuid() + gid_t getgid() + gid_t getxgid@dual0::getgid() + uid_t geteuid() + uid_t getxuid@dual1::geteuid() + gid_t getegid() + uid_t getxgid@dual1::getegid() +int getgroups(int, gid_t *) +int setgroups(size_t, const gid_t *) +int setreuid(uid_t, uid_t) +int setregid(gid_t, gid_t) +int setfsuid(uid_t) +int setfsgid(gid_t) + +# +# Filesystem-related system calls +# +int mount(const char *, const char *, const char *, unsigned long, const void *) + int umount2(const char *, int) + int umount::umount2(const char *, int) + int pivot_root(const char *, const char *) +int sync() +int statfs(const char *, struct statfs *) +int fstatfs(int, struct statfs *) +int swapon(const char *, int) +int swapoff(const char *) + +# +# Inode-related system calls +# +int access(const char *, int) +int link(const char *, const char *) +int unlink(const char *) +int chdir(const char *) +int rename(const char *, const char *) +int mknod(const char *, mode_t, dev_t) +int chmod(const char *, mode_t) +int mkdir(const char *, mode_t) +int rmdir(const char *) + int pipe(int *) +mode_t umask(mode_t) +int chroot(const char *) +int symlink(const char *, const char *) +int readlink(const char *, char *, size_t) +int stat(const char *, struct stat *) +int lstat(const char *, struct stat *) +int fstat(int, struct stat *) +int getdents(unsigned int, struct dirent *, unsigned int) +int chown(const char *, uid_t, gid_t) +int fchown(int, uid_t, gid_t) +int lchown(const char *, uid_t, gid_t) + +# +# I/O operations +# +ssize_t read(int, void *, size_t) +ssize_t write(int, const void *, size_t) +int open(const char *, int, mode_t) +int close(int) +off_t lseek(int, off_t, int) +int dup(int) +int dup2(int, int) +int fcntl(int, int, long) +int ioctl(int, int, void *) +int flock(int, int) +int poll(struct pollfd *, nfds_t, long) +int fsync(int) +int readv(int, const struct iovec *, int) +int writev(int, const struct iovec *, int) + +# +# Signal operations +# +int kill(pid_t, int) +int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) +int rt_sigsuspend(const sigset_t *, size_t) +int rt_sigpending(sigset_t *, size_t) +int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t) +int getitimer(int, struct itimerval *) +int setitimer(int, const struct itimerval *, struct itimerval *) + +# +# Time-related system calls +# +clock_t times(struct tms *) +int gettimeofday(struct timeval *, struct timezone *) +int settimeofday(const struct timeval *, const struct timezone *) +int nanosleep(const struct timespec *, struct timespec *) + +# +# Memory +# +void * brk::__brk(void *) +int munmap(void *, size_t) +void * mremap(void *, size_t, size_t, unsigned long) +int msync(const void *, size_t, int) +int mprotect(const void *, size_t, int) + +# +# System stuff +# +int uname(struct utsname *) +int setdomainname(const char *, size_t) +int sethostname(const char *, size_t) +int init_module(const char *, struct module *) +void * create_module(const char *, size_t) +int delete_module(const char *) +int query_module(const char *, int, void *, size_t, size_t) +int reboot::__reboot(int, int, int, void *) +int syslog::klogctl(int, char *, int) diff --git a/klibc/klibc/__shared_init.c b/klibc/klibc/__shared_init.c new file mode 100644 index 0000000000..63e3f4644e --- /dev/null +++ b/klibc/klibc/__shared_init.c @@ -0,0 +1,56 @@ +/* + * __shared_init.c + * + * This function takes the raw data block set up by the ELF loader + * in the kernel and parses it. It is invoked by crt0.S which makes + * any necessary adjustments and passes calls this function using + * the standard C calling convention. + * + * The arguments are: + * uintptr_t *elfdata -- The ELF loader data block; usually from the stack. + * Basically a pointer to argc. + * void (*onexit)(void) -- Function to install into onexit + */ + +#include +#include +#include +#include +#include + +char **environ; + +__noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void)) +{ + int argc; + char **argv, **envp, **envend; + struct auxentry { + uintptr_t type; + uintptr_t v; + } *auxentry; + typedef int (*main_t)(int, char **, char **); + main_t main_ptr = NULL; + + (void)onexit; /* For now, we ignore this... */ + + argc = (int)*elfdata++; + argv = (char **)elfdata; + envp = argv+(argc+1); + + /* The auxillary entry vector is after all the environment vars */ + for ( envend = envp ; *envend ; envend++ ); + auxentry = (struct auxentry *)(envend+1); + + while ( auxentry->type ) { + if ( auxentry->type == AT_ENTRY ) { + main_ptr = (main_t)(auxentry->v); + break; + } + auxentry++; + } + + environ = envp; + exit(main_ptr(argc, argv, envp)); +} + + diff --git a/klibc/klibc/__signal.c b/klibc/klibc/__signal.c new file mode 100644 index 0000000000..b5081d386b --- /dev/null +++ b/klibc/klibc/__signal.c @@ -0,0 +1,22 @@ +/* + * __signal.c + */ + +#include + +__sighandler_t __signal(int signum, __sighandler_t handler, int flags) +{ + struct sigaction sa; + + sa.sa_handler = handler; + sa.sa_flags = flags; + sigemptyset(&sa.sa_mask); + + if ( sigaction(signum, &sa, &sa) ) { + return (__sighandler_t)SIG_ERR; + } else { + return (__sighandler_t)sa.sa_handler; + } +} + + diff --git a/klibc/klibc/__static_init.c b/klibc/klibc/__static_init.c new file mode 100644 index 0000000000..dcb8d01856 --- /dev/null +++ b/klibc/klibc/__static_init.c @@ -0,0 +1,40 @@ +/* + * __static_init.c + * + * This function takes the raw data block set up by the ELF loader + * in the kernel and parses it. It is invoked by crt0.S which makes + * any necessary adjustments and passes calls this function using + * the standard C calling convention. + * + * The arguments are: + * uintptr_t *elfdata -- The ELF loader data block; usually from the stack. + * Basically a pointer to argc. + * void (*onexit)(void) -- Function to install into onexit + */ + +#include +#include +#include +#include +#include + +char **environ; + +extern int main(int, char **, char **); + +__noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void)) +{ + int argc; + char **argv, **envp; + + (void)onexit; /* For now, we ignore this... */ + + argc = (int)*elfdata++; + argv = (char **)elfdata; + envp = argv+(argc+1); + + environ = envp; + exit(main(argc, argv, envp)); +} + + diff --git a/klibc/klibc/abort.c b/klibc/klibc/abort.c new file mode 100644 index 0000000000..9280d9861b --- /dev/null +++ b/klibc/klibc/abort.c @@ -0,0 +1,19 @@ +/* + * abort.c + */ + +#include +#include +#include + +void abort(void) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, SIGABRT); + sigprocmask(SIG_UNBLOCK, &set, NULL); + raise(SIGABRT); + _exit(255); /* raise() should have killed us */ +} + diff --git a/klibc/klibc/alarm.c b/klibc/klibc/alarm.c new file mode 100644 index 0000000000..ca7bb37f92 --- /dev/null +++ b/klibc/klibc/alarm.c @@ -0,0 +1,29 @@ +/* + * alarm.c + */ + +#include +#include + +#ifdef __NR_alarm + +_syscall1(unsigned int,alarm,unsigned int,seconds); + +#else + +/* Emulate alarm() via setitimer() */ + +unsigned int alarm(unsigned int seconds) +{ + struct itimerval iv; + + iv.it_interval.tv_sec = iv.it_interval.tv_usec = 0; + iv.it_value.tv_sec = seconds; + iv.it_value.tv_usec = 0; + + setitimer(ITIMER_REAL, &iv, &iv); + + return iv.it_value.tv_sec + (iv.it_value.tv_usec ? 1 : 0); +} + +#endif diff --git a/klibc/klibc/arch/README b/klibc/klibc/arch/README new file mode 100644 index 0000000000..eceb23de4b --- /dev/null +++ b/klibc/klibc/arch/README @@ -0,0 +1,67 @@ +To port klibc to a new architecture, you need: + +a) A directory structure + +Each archtecture has an arch/ directory, which should include an +MCONFIG and a Makefile.inc file. + +b) Startup code (arch/*/crt0.S) + +The crt0.S assembly routine typically corresponds to the following +pseudo-C code. In addition, each architecture needs any support +routines that gcc-generated code expects to find in the system library +-- Alpha, for example, needs divide subroutines. + +The "getenvtest" test program is a very good test for proper crt0.S +functionality. + + +extern __noreturn __libc_init(void *, void *); + +__noreturn _start(void) +{ + void *elf_data = get_elf_data_address(); /* Usually the stack address */ + void *atexit_ptr = get_atexit_ptr(); /* Usually in a register */ + + /* Some architectures need this for debugging to work */ + setup_null_stack_frame_if_necessary(); + + __libc_init(elf_data, atexit_ptr); +} + + +c) A setenv implementation (arch/*/setjmp.S, arch/*/include/klibc/archsetjmp.h) + +On most (but not all!) architectures, this entails creating a setjmp +buffer big enough to hold all callee-saved registers, plus the stack +pointer and the return address. In setjmp.S you have: + +* A "setjmp" function that writes out the callee-saved registers, the + stack pointer and the return address to the buffer pointed to by the + first argument, and then returns zero normally. + + On some architectures you need to take some kind of action to make + sure the contents of the stack is actually manifest in memory and + not cached in the CPU. In some cases (e.g. on SPARC) this will + automatically spill the registers onto the stack; then they don't + need to be spilled into the jmp_buf. + +* A "longjmp" function that read back these same registers from the + jmp_buf pointed to by the first argument, and returns the second + argument *to the address specified in the jmp_buf*. + + On some architectures you need to take some kind of action to flush + any cached stack data or return stack. + + +d) Any support functions needed by gcc, *unless* they are in libgcc + *and* libgcc is usable for klibc on your particular platform. If + libgcc isn't usable for klibc (on MIPS, for example, libgcc is + compiled in a way that is not compatible with klibc) there are + reasonably good clones of most of the libgcc functions in the libgcc + directory. To use them, add them to ARCHOBJS in + arch/*/Makefile.inc. + + +e) A link location for the shared klibc. This should be specified in + SHAREDFLAGS in arch/*/MCONFIG. diff --git a/klibc/klibc/arch/alpha/MCONFIG b/klibc/klibc/arch/alpha/MCONFIG new file mode 100644 index 0000000000..5987ed5841 --- /dev/null +++ b/klibc/klibc/arch/alpha/MCONFIG @@ -0,0 +1,17 @@ +# -*- makefile -*- +# +# arch/alpha/MCONFIG +# +# Build configuration for this architecture +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 64 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 7 GB - normal binaries start at 4.5 GB, and the stack is below +# the binary. +SHAREDFLAGS = -Ttext 0x1c0000200 + diff --git a/klibc/klibc/arch/alpha/Makefile.inc b/klibc/klibc/arch/alpha/Makefile.inc new file mode 100644 index 0000000000..2a1100f962 --- /dev/null +++ b/klibc/klibc/arch/alpha/Makefile.inc @@ -0,0 +1,93 @@ +# -*- makefile -*- +# +# arch/alpha/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +# Special CFLAGS for the divide code +DIVCFLAGS = $(REQFLAGS) \ + -O3 -fomit-frame-pointer -fcall-saved-1 -fcall-saved-2 \ + -fcall-saved-3 -fcall-saved-4 -fcall-saved-5 -fcall-saved-6 \ + -fcall-saved-7 -fcall-saved-8 -fcall-saved-15 -fcall-saved-16 \ + -fcall-saved-17 -fcall-saved-18 -fcall-saved-19 -fcall-saved-20 \ + -fcall-saved-21 -fcall-saved-22 -ffixed-23 -fcall-saved-24 \ + -ffixed-25 -ffixed-27 + +ARCHOBJS = \ + arch/$(ARCH)/__divqu.o \ + arch/$(ARCH)/__remqu.o \ + arch/$(ARCH)/__divq.o \ + arch/$(ARCH)/__remq.o \ + arch/$(ARCH)/__divlu.o \ + arch/$(ARCH)/__remlu.o \ + arch/$(ARCH)/__divl.o \ + arch/$(ARCH)/__reml.o \ + arch/$(ARCH)/pipe.o \ + arch/$(ARCH)/setjmp.o + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + +arch/$(ARCH)/%.s: arch/$(ARCH)/%.ss + sed -e 's/\$$0\b/$$27/g' -e 's/\$$24\b/$$99/g' \ + -e 's/\$$16\b/$$24/g' -e 's/\$$17\b/$$25/g' \ + -e 's/\$$26\b/$$23/g' -e 's/\$$99\b/$$16/g' < $< > $@ + +arch/$(ARCH)/%.ls: arch/$(ARCH)/%.lss + sed -e 's/\$$0\b/$$27/g' -e 's/\$$24\b/$$99/g' \ + -e 's/\$$16\b/$$24/g' -e 's/\$$17\b/$$25/g' \ + -e 's/\$$26\b/$$23/g' -e 's/\$$99\b/$$16/g' < $< > $@ + +arch/$(ARCH)/__divqu.ss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=0 -DBITS=64 -DNAME=__divqu -S -o $@ $< + +arch/$(ARCH)/__remqu.ss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=1 -DBITS=64 -DNAME=__remqu -S -o $@ $< + +arch/$(ARCH)/__divq.ss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=0 -DBITS=64 -DNAME=__divq -S -o $@ $< + +arch/$(ARCH)/__remq.ss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=1 -DBITS=64 -DNAME=__remq -S -o $@ $< + +arch/$(ARCH)/__divlu.ss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=0 -DBITS=32 -DNAME=__divlu -S -o $@ $< + +arch/$(ARCH)/__remlu.ss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=1 -DBITS=32 -DNAME=__remlu -S -o $@ $< + +arch/$(ARCH)/__divl.ss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=0 -DBITS=32 -DNAME=__divl -S -o $@ $< + +arch/$(ARCH)/__reml.ss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=1 -DBITS=32 -DNAME=__reml -S -o $@ $< + +arch/$(ARCH)/__divqu.lss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=0 -DBITS=64 -DNAME=__divqu -S -o $@ $< + +arch/$(ARCH)/__remqu.lss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=1 -DBITS=64 -DNAME=__remqu -S -o $@ $< + +arch/$(ARCH)/__divq.lss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=0 -DBITS=64 -DNAME=__divq -S -o $@ $< + +arch/$(ARCH)/__remq.lss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=1 -DBITS=64 -DNAME=__remq -S -o $@ $< + +arch/$(ARCH)/__divlu.lss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=0 -DBITS=32 -DNAME=__divlu -S -o $@ $< + +arch/$(ARCH)/__remlu.lss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=1 -DBITS=32 -DNAME=__remlu -S -o $@ $< + +arch/$(ARCH)/__divl.lss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=0 -DBITS=32 -DNAME=__divl -S -o $@ $< + +arch/$(ARCH)/__reml.lss: arch/$(ARCH)/divide.c + $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=1 -DBITS=32 -DNAME=__reml -S -o $@ $< + +archclean: + rm -f arch/$(ARCH)/*.ss arch/$(ARCH)/*.lss + diff --git a/klibc/klibc/arch/alpha/README-gcc b/klibc/klibc/arch/alpha/README-gcc new file mode 100644 index 0000000000..9aaba72837 --- /dev/null +++ b/klibc/klibc/arch/alpha/README-gcc @@ -0,0 +1,23 @@ + The current Alpha chips don't provide hardware for integer + division. The C compiler expects the functions + + __divqu: 64-bit unsigned long divide + __remqu: 64-bit unsigned long remainder + __divq/__remq: signed 64-bit + __divlu/__remlu: unsigned 32-bit + __divl/__reml: signed 32-bit + + These are not normal C functions: instead of the normal calling + sequence, these expect their arguments in registers t10 and t11, and + return the result in t12 (aka pv). Register AT may be clobbered + (assembly temporary), anything else must be saved. + + Furthermore, the return address is in t9 instead of ra. + + Normal function Divide functions + --------------- ---------------- + v0 ($0) t12/pv ($27) + a0 ($16) t10 ($24) + a1 ($17) t11 ($25) + ra ($26) t9 ($23) + diff --git a/klibc/klibc/arch/alpha/crt0.S b/klibc/klibc/arch/alpha/crt0.S new file mode 100644 index 0000000000..6c2958117d --- /dev/null +++ b/klibc/klibc/arch/alpha/crt0.S @@ -0,0 +1,21 @@ +# +# arch/alpha/crt0.S +# + + .text + .type __start,@function + .ent __start, 0 + .globl __start +__start: + .frame $30, 0, $26, 0 + mov $31, $15 + br $29, 1f +1: ldgp $29, 0($29) + .prologue 0 + + lda $16, 0($30) # ELF data structure + lda $17, 0($0) # atexit pointer + + jsr $26, __libc_init + + .size __start,.-__start diff --git a/klibc/klibc/arch/alpha/divide.c b/klibc/klibc/arch/alpha/divide.c new file mode 100644 index 0000000000..49d77cd5dc --- /dev/null +++ b/klibc/klibc/arch/alpha/divide.c @@ -0,0 +1,57 @@ +#include +#include +#include + +#if BITS == 64 +typedef uint64_t uint; +typedef int64_t sint; +#else +typedef uint32_t uint; +typedef int32_t sint; +#endif + +#ifdef SIGNED +typedef sint xint; +#else +typedef uint xint; +#endif + +xint NAME (uint num, uint den) +{ + uint quot = 0, qbit = 1; + int minus = 0; + xint v; + + if ( den == 0 ) { + /* This is really $16, but $16 and $24 are exchanged by a script */ + register unsigned long cause asm("$24") = GEN_INTDIV; + asm volatile("call_pal %0" :: "i" (PAL_gentrap), "r" (cause)); + return 0; /* If trap returns... */ + } + +#if SIGNED + if ( (sint)(num^den) < 0 ) + minus = 1; + if ( (sint)num < 0 ) num = -num; + if ( (sint)den < 0 ) den = -den; +#endif + + /* Left-justify denominator and count shift */ + while ( (sint)den >= 0 ) { + den <<= 1; + qbit <<= 1; + } + + while ( qbit ) { + if ( den <= num ) { + num -= den; + quot += qbit; + } + den >>= 1; + qbit >>= 1; + } + + v = (xint)(REM ? num : quot); + if ( minus ) v = -v; + return v; +} diff --git a/klibc/klibc/arch/alpha/include/klibc/archsetjmp.h b/klibc/klibc/arch/alpha/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..9dc570a6f5 --- /dev/null +++ b/klibc/klibc/arch/alpha/include/klibc/archsetjmp.h @@ -0,0 +1,33 @@ +/* + * arch/alpha/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __s0; + unsigned long __s1; + unsigned long __s2; + unsigned long __s3; + unsigned long __s4; + unsigned long __s5; + unsigned long __fp; + unsigned long __ra; + unsigned long __gp; + unsigned long __sp; + + unsigned long __f2; + unsigned long __f3; + unsigned long __f4; + unsigned long __f5; + unsigned long __f6; + unsigned long __f7; + unsigned long __f8; + unsigned long __f9; +}; + +/* Must be an array so it will decay to a pointer when a function is called */ +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/klibc/arch/alpha/include/klibc/archsys.h b/klibc/klibc/arch/alpha/include/klibc/archsys.h new file mode 100644 index 0000000000..16ed658987 --- /dev/null +++ b/klibc/klibc/arch/alpha/include/klibc/archsys.h @@ -0,0 +1,53 @@ +/* + * arch/alpha/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* Alpha has some bizarre Tru64-derived system calls which return two + different values in $0 and $20(!), respectively. The standard + macros can't deal with these; even the ones that give the right + return value have the wrong clobbers. */ + +#define _syscall0_dual0(type, name) \ +type name(void) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_19 __asm__("$19"); \ + register long _sc_20 __asm__("$20"); \ + \ + _sc_0 = __NR_##name; \ + __asm__("callsys" \ + : "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \ + : "0"(_sc_0) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; (void)(_sc_20); \ + } \ + _syscall_return(type); \ +} + +#define _syscall0_dual1(type, name) \ +type name(void) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_19 __asm__("$19"); \ + register long _sc_20 __asm__("$20"); \ + \ + _sc_0 = __NR_##name; \ + __asm__("callsys" \ + : "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \ + : "0"(_sc_0) \ + : _syscall_clobbers); \ + _sc_ret = _sc_20, _sc_err = _sc_19; (void)(_sc_0); \ + } \ + _syscall_return(type); \ +} + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/alpha/include/machine/asm.h b/klibc/klibc/arch/alpha/include/machine/asm.h new file mode 100644 index 0000000000..e22db90412 --- /dev/null +++ b/klibc/klibc/arch/alpha/include/machine/asm.h @@ -0,0 +1,44 @@ +/* + * machine/asm.h + */ + +#ifndef _MACHINE_ASM_H +#define _MACHINE_ASM_H + +/* Standard aliases for Alpha register names */ + +#define v0 $0 +#define t0 $1 +#define t1 $2 +#define t2 $3 +#define t3 $4 +#define t4 $5 +#define t5 $6 +#define t6 $7 +#define t7 $8 +#define s0 $9 +#define s1 $10 +#define s2 $11 +#define s3 $12 +#define s4 $13 +#define s5 $14 +#define fp $15 +#define a0 $16 +#define a1 $17 +#define a2 $18 +#define a3 $19 +#define a4 $20 +#define a5 $21 +#define t8 $22 +#define t9 $23 +#define t10 $24 +#define t11 $25 +#define ra $26 +#define t12 $27 /* t12 and pv are both used for $27 */ +#define pv $27 /* t12 and pv are both used for $27 */ +#define at $28 +#define gp $29 +#define sp $30 +#define zero $31 + +#endif /* _MACHINE_ASM_H */ diff --git a/klibc/klibc/arch/alpha/pipe.c b/klibc/klibc/arch/alpha/pipe.c new file mode 100644 index 0000000000..5aee9edbab --- /dev/null +++ b/klibc/klibc/arch/alpha/pipe.c @@ -0,0 +1,28 @@ +#include +#include + +/* pipe() on alpha returns both file descriptors in registers -- + $0 and $20 respectively. This is unlike any other system call, + as far as I can tell. */ + +int pipe(int *fds) +{ + register long sc_0 __asm__("$0"); + register long sc_19 __asm__("$19"); + register long sc_20 __asm__("$20"); + + sc_0 = __NR_pipe; + asm volatile("callsys" : "=r" (sc_0), "=r" (sc_19), "=r" (sc_20) + : "0" (sc_0) + : _syscall_clobbers); + + if ( sc_19 ) { + errno = sc_19; + return -1; + } + + fds[0] = sc_0; + fds[1] = sc_20; + + return 0; +} diff --git a/klibc/klibc/arch/alpha/setjmp.S b/klibc/klibc/arch/alpha/setjmp.S new file mode 100644 index 0000000000..e1ad642539 --- /dev/null +++ b/klibc/klibc/arch/alpha/setjmp.S @@ -0,0 +1,77 @@ +# +# setjmp.S +# + +# +# The jmp_buf looks like: +# +# s0..5 +# fp +# ra +# gp +# sp +# + +#include + + .text + .align 3 + .type setjmp,@function + .ent setjmp, 0 + .globl setjmp +setjmp: + lda v0, 0(zero) + stq s0, 0(a0) + stq s1, 8(a0) + stq s2, 16(a0) + stq s3, 24(a0) + stq s4, 32(a0) + stq s5, 40(a0) + stq fp, 48(a0) + stq ra, 56(a0) + stq gp, 64(a0) + stq sp, 72(a0) + stt f2, 80(a0) + stt f3, 88(a0) + stt f4, 96(a0) + stt f5, 104(a0) + stt f6, 112(a0) + stt f7, 120(a0) + stt f8, 128(a0) + stt f9, 136(a0) + ret zero,(ra),1 + + .size setjmp,.-setjmp + .end setjmp + + .type longjmp,@function + .ent longjmp, 0 + .globl longjmp +longjmp: + mov a1, v0 + ldq s0, 0(a0) + ldq s1, 8(a0) + ldq s2, 16(a0) + ldq s3, 24(a0) + ldq s4, 32(a0) + ldq s5, 40(a0) + ldq fp, 48(a0) + ldq ra, 56(a0) + ldq gp, 64(a0) + ldq sp, 72(a0) + ldt f2, 80(a0) + ldt f3, 88(a0) + ldt f4, 96(a0) + ldt f5, 104(a0) + ldt f6, 112(a0) + ldt f7, 120(a0) + ldt f8, 128(a0) + ldt f9, 136(a0) + /* We're bound to get a mispredict here, but at least give us + a chance to get the return stack back in sync... */ + ret zero,(ra),1 + + .size longjmp,.-longjmp + .end longjmp + + diff --git a/klibc/klibc/arch/arm/MCONFIG b/klibc/klibc/arch/arm/MCONFIG new file mode 100644 index 0000000000..6fbea32903 --- /dev/null +++ b/klibc/klibc/arch/arm/MCONFIG @@ -0,0 +1,26 @@ +# -*- makefile -*- +# +# arch/arm/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +THUMB = n +CPU_ARCH := armv4 +CPU_TUNE := strongarm + +OPTFLAGS = -Os -fomit-frame-pointer -march=$(CPU_ARCH) -mtune=$(CPU_TUNE) +BITSIZE = 32 + +ifeq ($(THUMB),y) +CPU_ARCH := $(CPU_ARCH)t +OPTFLAGS += -mthumb +LDFLAGS += --thumb-entry _start +endif + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +SHAREDFLAGS = -Ttext 0x01000200 diff --git a/klibc/klibc/arch/arm/Makefile.inc b/klibc/klibc/arch/arm/Makefile.inc new file mode 100644 index 0000000000..3ec8c051b2 --- /dev/null +++ b/klibc/klibc/arch/arm/Makefile.inc @@ -0,0 +1,31 @@ +# -*- makefile -*- +# +# arch/arm/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + libgcc/__divsi3.o \ + libgcc/__modsi3.o \ + libgcc/__udivsi3.o \ + libgcc/__umodsi3.o \ + libgcc/__udivmodsi4.o \ + libgcc/__divdi3.o \ + libgcc/__moddi3.o \ + libgcc/__udivdi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmoddi4.o + +ifeq ($(THUMB),y) +ARCHOBJS += arch/arm/setjmp-thumb.o +LIBGCC = +else +ARCHOBJS += arch/arm/setjmp-arm.o +endif + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + +archclean: diff --git a/klibc/klibc/arch/arm/crt0.S b/klibc/klibc/arch/arm/crt0.S new file mode 100644 index 0000000000..8cd3640c30 --- /dev/null +++ b/klibc/klibc/arch/arm/crt0.S @@ -0,0 +1,25 @@ +# +# arch/arm/crt0.S +# +# void _start(void) +# { +# /* Divine up argc, argv, and envp */ +# environ = envp; +# exit(main(argc, argv, envp)); +# } +# + + .text + .align 4 + .type _start,#function + .globl _start + +#ifdef __thumb__ + .thumb_func +#endif + +_start: mov r0, sp + mov r1, #0 + bl __libc_init + + .size _start,.-_start diff --git a/klibc/klibc/arch/arm/include/klibc/archsetjmp.h b/klibc/klibc/arch/arm/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..c956b50a90 --- /dev/null +++ b/klibc/klibc/arch/arm/include/klibc/archsetjmp.h @@ -0,0 +1,14 @@ +/* + * arch/i386/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned int regs[10]; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/arm/include/klibc/archsys.h b/klibc/klibc/arch/arm/include/klibc/archsys.h new file mode 100644 index 0000000000..1a77e53a65 --- /dev/null +++ b/klibc/klibc/arch/arm/include/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/arm/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/arm/setjmp-arm.S b/klibc/klibc/arch/arm/setjmp-arm.S new file mode 100644 index 0000000000..bcb30b4221 --- /dev/null +++ b/klibc/klibc/arch/arm/setjmp-arm.S @@ -0,0 +1,40 @@ +# +# arch/arm/setjmp.S +# +# setjmp/longjmp for the ARM architecture +# + +# +# The jmp_buf is assumed to contain the following, in order: +# r4 +# r5 +# r6 +# r7 +# r8 +# r9 +# r10 +# fp +# sp +# lr +# + + .text + .align 4 + .globl setjmp + .type setjmp, #function +setjmp: + stmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} + mov r0, #0 + mov pc, lr + .size setjmp,.-setjmp + + .text + .align 4 + .globl longjmp + .type longjmp, #function +longjmp: + ldmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} + movs r0, r1 + moveq r0, #1 + mov pc, lr + .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/arm/setjmp-thumb.S b/klibc/klibc/arch/arm/setjmp-thumb.S new file mode 100644 index 0000000000..b581c5f7ad --- /dev/null +++ b/klibc/klibc/arch/arm/setjmp-thumb.S @@ -0,0 +1,58 @@ +# +# arch/arm/setjmp-thumb.S +# +# setjmp/longjmp for the ARM/thumb architecture +# + +# +# The jmp_buf is assumed to contain the following, in order: +# lr +# r4 +# r5 +# r6 +# r7 +# r8 +# r9 +# r10 +# fp +# sp +# + + .text + .align 4 + .globl setjmp + .type setjmp, #function + .thumb_func +setjmp: + mov r3, lr + stmia r0!, {r3, r4, r5, r6, r7} + mov r3, r8 + mov r4, r9 + mov r5, r10 + mov r6, fp + mov r7, sp + stmia r0!, {r3, r4, r5, r6, r7} + mov r0, #0 + mov pc, lr + .size setjmp,.-setjmp + + .text + .align 4 + .globl longjmp + .type longjmp, #function + .thumb_func +longjmp: + mov r2, r0 + add r0, #5*4 + ldmia r0!, {r3, r4, r5, r6, r7} + mov r8, r3 + mov r9, r4 + mov r10, r5 + mov fp, r6 + mov sp, r7 + ldmia r2!, {r3, r4, r5, r6, r7} + mov r0, r1 + bne 1f + mov r0, #1 +1: mov pc, r3 + .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/cris/MCONFIG b/klibc/klibc/arch/cris/MCONFIG new file mode 100644 index 0000000000..27809ebbe7 --- /dev/null +++ b/klibc/klibc/arch/cris/MCONFIG @@ -0,0 +1,11 @@ +# -*- makefile -*- +# +# arch/cris/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 32 diff --git a/klibc/klibc/arch/cris/Makefile.inc b/klibc/klibc/arch/cris/Makefile.inc new file mode 100644 index 0000000000..41183fd64b --- /dev/null +++ b/klibc/klibc/arch/cris/Makefile.inc @@ -0,0 +1,10 @@ +# -*- makefile -*- +# +# arch/cris/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +archclean: diff --git a/klibc/klibc/arch/cris/include/klibc/archsys.h b/klibc/klibc/arch/cris/include/klibc/archsys.h new file mode 100644 index 0000000000..dfdc70a6de --- /dev/null +++ b/klibc/klibc/arch/cris/include/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/cris/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/i386/MCONFIG b/klibc/klibc/arch/i386/MCONFIG new file mode 100644 index 0000000000..367ee89773 --- /dev/null +++ b/klibc/klibc/arch/i386/MCONFIG @@ -0,0 +1,32 @@ +# -*- makefile -*- +# +# arch/i386/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +# Comment this out to compile with register parameter passing +# This doesn't work right now because gcc 3.2 (at least) calls +# libgcc with the default calling convention instead of forcing +# them to be cdecl +# REGPARM = -mregparm=3 -DREGPARM + +gcc_major := $(shell $(CC) -v 2>&1 | awk '/gcc version/{print int($$3)}') + +OPTFLAGS = $(REGPARM) -march=i386 -Os + +ifeq ($(gcc_major),3) +OPTFLAGS += -falign-functions=0 -falign-jumps=0 -falign-loops=0 +else +OPTFLAGS += -malign-functions=0 -malign-jumps=0 -malign-loops=0 +endif + +BITSIZE = 32 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 96 MB - normal binaries start at 128 MB +SHAREDFLAGS = -Ttext 0x06000200 diff --git a/klibc/klibc/arch/i386/Makefile.inc b/klibc/klibc/arch/i386/Makefile.inc new file mode 100644 index 0000000000..171248a796 --- /dev/null +++ b/klibc/klibc/arch/i386/Makefile.inc @@ -0,0 +1,27 @@ +# -*- makefile -*- +# +# arch/i386/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + arch/$(ARCH)/exits.o \ + arch/$(ARCH)/socketcall.o \ + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/libgcc/__ashldi3.o \ + arch/$(ARCH)/libgcc/__ashrdi3.o \ + arch/$(ARCH)/libgcc/__lshrdi3.o \ + arch/$(ARCH)/libgcc/__muldi3.o \ + arch/$(ARCH)/libgcc/__negdi2.o \ + libgcc/__divdi3.o \ + libgcc/__moddi3.o \ + libgcc/__udivdi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmoddi4.o + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + +archclean: diff --git a/klibc/klibc/arch/i386/crt0.S b/klibc/klibc/arch/i386/crt0.S new file mode 100644 index 0000000000..1c82eda513 --- /dev/null +++ b/klibc/klibc/arch/i386/crt0.S @@ -0,0 +1,33 @@ +# +# arch/i386/crt0.S +# +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. +# + + .text + .align 4 + .type _start,@function + .globl _start +_start: + # Save the address of the ELF argument array + movl %esp,%eax # Address of ELF arguments + # Set up a faux stack frame for the benefit of gdb + xorl %ebp,%ebp + push %ebp # Keep gdb from getting confused + push %ebp # Keep gdb from getting confused + # Push the arguments and called __libc_init() +#ifndef REGPARM + push %edx # atexit() function + push %eax # ELF array +#endif + call __libc_init + # If __libc_init returns, problem... + ud2 + hlt + + .size _start, .-_start + diff --git a/klibc/klibc/arch/i386/exits.S b/klibc/klibc/arch/i386/exits.S new file mode 100644 index 0000000000..59ff563ad8 --- /dev/null +++ b/klibc/klibc/arch/i386/exits.S @@ -0,0 +1,45 @@ +# +# exit and _exit get included in *every* program, and gcc generates +# horrible code for them. Yes, this only saves a few bytes, but +# it does it in every program. +# + +#include + + .data + .align 4 + .globl __exit_handler + .type __exit_handler,@object +__exit_handler: + .long _exit + .size __exit_handler,4 + + .text + .align 4 + .globl exit + .type exit,@function +exit: + jmp *(__exit_handler) + .size exit,.-exit + + /* No need to save any registers... we're exiting! */ + .text + .align 4 + .globl _exit + .type _exit,@function +_exit: +#ifdef REGPARM + movl %eax,%ebx +#else + popl %ebx + popl %ebx +#endif +#if __NR_exit == 1 + xorl %eax,%eax + incl %eax +#else + movl $__NR_exit,%eax +#endif + int $0x80 + hlt + .size _exit,.-exit diff --git a/klibc/klibc/arch/i386/include/klibc/archsetjmp.h b/klibc/klibc/arch/i386/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..db04314b8c --- /dev/null +++ b/klibc/klibc/arch/i386/include/klibc/archsetjmp.h @@ -0,0 +1,19 @@ +/* + * arch/i386/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned int __ebx; + unsigned int __esp; + unsigned int __ebp; + unsigned int __esi; + unsigned int __edi; + unsigned int __eip; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/i386/include/klibc/archsys.h b/klibc/klibc/arch/i386/include/klibc/archsys.h new file mode 100644 index 0000000000..e21487b256 --- /dev/null +++ b/klibc/klibc/arch/i386/include/klibc/archsys.h @@ -0,0 +1,96 @@ +/* + * arch/i386/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* + * If we're compiling i386 in PIC mode, we need to treat %ebx + * specially. Most of these are copied from the equivalent file in + * newlib and were written by Werner Almesberger. + */ +#if defined(__PIC__) + +/* _syscall0() is the same as non-PIC */ + +#undef _syscall1 +#define _syscall1(type,name,type1,arg1) \ +type name(type1 arg1) \ +{ \ +long __res; \ +__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##name),"r" ((long)(arg1))); \ +__syscall_return(type,__res); \ +} + +#undef _syscall2 +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name(type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2))); \ +__syscall_return(type,__res); \ +} + +#undef _syscall3 +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name(type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3))); \ +__syscall_return(type,__res); \ +} + +#undef _syscall4 +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ +long __res; \ +__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4))); \ +__syscall_return(type,__res); \ +} + +#undef _syscall5 +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ + : "=a" (__res) \ + : "0" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ +__syscall_return(type,__res); \ +} + +#undef _syscall6 +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ +long __res; \ +__asm__ __volatile__ ("push %%ebx; pushl %%ebp; movl %2,%%ebx; " \ + "movl %%eax,%%ebp; movl %1,%%eax; int $0x80; " \ + "pop %%ebp ; pop %%ebx" \ + : "=a" (__res) \ + : "i" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \ + "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ + "a" ((long)(arg6))); \ +__syscall_return(type,__res); \ +} + +#endif /* __PIC__ */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/i386/include/klibc/diverr.h b/klibc/klibc/arch/i386/include/klibc/diverr.h new file mode 100644 index 0000000000..410aba06d3 --- /dev/null +++ b/klibc/klibc/arch/i386/include/klibc/diverr.h @@ -0,0 +1,16 @@ +/* + * arch/i386/include/klibc/diverr.h + */ + +#ifndef _KLIBC_DIVERR_H +#define _KLIBC_DIVERR_H + +#include + +static __inline__ void +__divide_error(void) +{ + asm volatile("divl %0" :: "rm" (0) : "eax", "edx"); +} + +#endif /* _KLIBC_DIVERR_H */ diff --git a/klibc/klibc/arch/i386/libgcc/__ashldi3.S b/klibc/klibc/arch/i386/libgcc/__ashldi3.S new file mode 100644 index 0000000000..80ed4be3cf --- /dev/null +++ b/klibc/klibc/arch/i386/libgcc/__ashldi3.S @@ -0,0 +1,29 @@ +/* + * arch/i386/libgcc/__ashldi3.S + * + * 64-bit shl + */ + .text + .align 4 + .globl __ashldi3 + .type __ashldi3,@function +__ashldi3: +#ifndef REGPARM + movl 4(%esp),%eax + movl 8(%esp),%edx + movb 12(%esp),%cl +#endif + cmpb $32,%cl + jae 1f + + shldl %cl,%eax,%edx + shl %cl,%eax + ret + +1: + xorl %edx,%edx + shl %cl,%eax + xchgl %edx,%eax + ret + + .size __ashldi3,.-__ashldi3 diff --git a/klibc/klibc/arch/i386/libgcc/__ashrdi3.S b/klibc/klibc/arch/i386/libgcc/__ashrdi3.S new file mode 100644 index 0000000000..ba43f9022a --- /dev/null +++ b/klibc/klibc/arch/i386/libgcc/__ashrdi3.S @@ -0,0 +1,29 @@ +/* + * arch/i386/libgcc/__ashrdi3.S + * + * 64-bit sar + */ + .text + .align 4 + .globl __ashrdi3 + .type __ashrdi3,@function +__ashrdi3: +#ifndef REGPARM + movl 4(%esp),%eax + movl 8(%esp),%edx + movb 12(%esp),%cl +#endif + cmpb $32,%cl + jae 1f + + shrdl %cl,%edx,%eax + sarl %cl,%edx + ret + +1: + sarl %cl,%edx + movl %edx,%eax + cdq + ret + + .size __ashrdi3,.-__ashrdi3 diff --git a/klibc/klibc/arch/i386/libgcc/__lshrdi3.S b/klibc/klibc/arch/i386/libgcc/__lshrdi3.S new file mode 100644 index 0000000000..6e521ace2c --- /dev/null +++ b/klibc/klibc/arch/i386/libgcc/__lshrdi3.S @@ -0,0 +1,29 @@ +/* + * arch/i386/libgcc/__lshrdi3.S + * + * 64-bit shr + */ + .text + .align 4 + .globl __lshrdi3 + .type __lshrdi3,@function +__lshrdi3: +#ifndef REGPARM + movl 4(%esp),%eax + movl 8(%esp),%edx + movb 12(%esp),%cl +#endif + cmpb $32,%cl + jae 1f + + shrdl %cl,%edx,%eax + shrl %cl,%edx + ret + +1: + shrl %cl,%edx + xorl %eax,%eax + xchgl %edx,%eax + ret + + .size __lshrdi3,.-__lshrdi3 diff --git a/klibc/klibc/arch/i386/libgcc/__muldi3.S b/klibc/klibc/arch/i386/libgcc/__muldi3.S new file mode 100644 index 0000000000..c164588b16 --- /dev/null +++ b/klibc/klibc/arch/i386/libgcc/__muldi3.S @@ -0,0 +1,34 @@ +/* + * arch/i386/libgcc/__muldi3.S + * + * 64*64 = 64 bit unsigned multiplication + */ + + .text + .align 4 + .globl __muldi3 + .type __muldi3,@function +__muldi3: + push %esi +#ifndef REGPARM + movl 8(%esp),%eax + movl %eax,%esi + movl 16(%esp),%ecx + mull %ecx + imull 12(%esp),%ecx + imull 20(%esp),%esi + addl %ecx,%edx + addl %esi,%edx +#else + movl %eax,%esi + push %edx + mull %ecx + imull 8(%esp),%esi + addl %esi,%edx + pop %esi + imull %esi,%ecx + addl %ecx,%edx +#endif + pop %esi + ret + .size __muldi3,.-__muldi3 diff --git a/klibc/klibc/arch/i386/libgcc/__negdi2.S b/klibc/klibc/arch/i386/libgcc/__negdi2.S new file mode 100644 index 0000000000..6c95cb235c --- /dev/null +++ b/klibc/klibc/arch/i386/libgcc/__negdi2.S @@ -0,0 +1,21 @@ +/* + * arch/i386/libgcc/__negdi2.S + * + * 64-bit negation + */ + + .text + .align 4 + .globl __negdi2 + .type __negdi2,@function +__negdi2: +#ifndef REGPARM + movl 4(%esp),%eax + movl 8(%esp),%edx +#endif + negl %edx + negl %eax + sbbl $0,%edx + ret + + .size __negdi2,.-__negdi2 diff --git a/klibc/klibc/arch/i386/setjmp.S b/klibc/klibc/arch/i386/setjmp.S new file mode 100644 index 0000000000..bea900c519 --- /dev/null +++ b/klibc/klibc/arch/i386/setjmp.S @@ -0,0 +1,58 @@ +# +# arch/i386/setjmp.S +# +# setjmp/longjmp for the i386 architecture +# + +# +# The jmp_buf is assumed to contain the following, in order: +# %ebx +# %esp +# %ebp +# %esi +# %edi +# +# + + .text + .align 4 + .globl setjmp + .type setjmp, @function +setjmp: +#ifdef REGPARM + movl %eax,%edx +#else + movl 4(%esp),%edx +#endif + popl %ecx # Return address, and adjust the stack + xorl %eax,%eax # Return value + movl %ebx,(%edx) + movl %esp,4(%edx) # Post-return %esp! + pushl %ecx # Make the call/return stack happy + movl %ebp,8(%edx) + movl %esi,12(%edx) + movl %edi,16(%edx) + movl %ecx,20(%edx) # Return address + ret + + .size setjmp,.-setjmp + + .text + .align 4 + .globl longjmp + .type longjmp, @function +longjmp: +#ifdef REGPARM + xchgl %eax,%edx +#else + movl 4(%esp),%edx # jmp_ptr address + movl 8(%esp),%eax # Return value +#endif + movl (%edx),%ebx + movl 4(%edx),%esp + movl 8(%edx),%ebp + movl 12(%edx),%esi + movl 16(%edx),%edi + jmp *20(%edx) + + .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/i386/socketcall.S b/klibc/klibc/arch/i386/socketcall.S new file mode 100644 index 0000000000..6bac1e6913 --- /dev/null +++ b/klibc/klibc/arch/i386/socketcall.S @@ -0,0 +1,38 @@ +# +# socketcall.S +# +# On i386, the main (only?) user of socketcall(2), the memory array +# socketcall(2) needs is conveniently already assembled for us on +# the stack. Capitalize on that to make a common socketcall stub. +# + +#include + +#ifdef __i386__ + + .text + .align 4 + .globl __socketcall_common + .type __socketcall_common, @function + +__socketcall_common: + pushl %ebx + movzbl %al,%ebx # The socketcall number is passed in in %al + leal 8(%esp),%ecx # Argument pointer + movl $__NR_socketcall, %eax + int $0x80 + cmpl $-125,%eax # Error return? + popl %ebx + jb 1f + neg %eax + movl %eax,errno + xorl %eax,%eax + decl %eax # Return = -1 +1: + ret + + .size __socketcall_common,.-__socketcall_common + +#endif + + diff --git a/klibc/klibc/arch/ia64/MCONFIG b/klibc/klibc/arch/ia64/MCONFIG new file mode 100644 index 0000000000..631a478e4f --- /dev/null +++ b/klibc/klibc/arch/ia64/MCONFIG @@ -0,0 +1,11 @@ +# -*- makefile -*- +# +# arch/ia64/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 64 diff --git a/klibc/klibc/arch/ia64/Makefile.inc b/klibc/klibc/arch/ia64/Makefile.inc new file mode 100644 index 0000000000..1fb364f92e --- /dev/null +++ b/klibc/klibc/arch/ia64/Makefile.inc @@ -0,0 +1,10 @@ +# -*- makefile -*- +# +# arch/ia64/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +archclean: diff --git a/klibc/klibc/arch/ia64/include/klibc/archsys.h b/klibc/klibc/arch/ia64/include/klibc/archsys.h new file mode 100644 index 0000000000..ef5940ac25 --- /dev/null +++ b/klibc/klibc/arch/ia64/include/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/ia64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/m68k/MCONFIG b/klibc/klibc/arch/m68k/MCONFIG new file mode 100644 index 0000000000..2ba69b3178 --- /dev/null +++ b/klibc/klibc/arch/m68k/MCONFIG @@ -0,0 +1,11 @@ +# -*- makefile -*- +# +# arch/m68k/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 32 diff --git a/klibc/klibc/arch/m68k/Makefile.inc b/klibc/klibc/arch/m68k/Makefile.inc new file mode 100644 index 0000000000..9abec14db1 --- /dev/null +++ b/klibc/klibc/arch/m68k/Makefile.inc @@ -0,0 +1,10 @@ +# -*- makefile -*- +# +# arch/m68k/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +archclean: diff --git a/klibc/klibc/arch/m68k/include/klibc/archsys.h b/klibc/klibc/arch/m68k/include/klibc/archsys.h new file mode 100644 index 0000000000..8f6bed8e94 --- /dev/null +++ b/klibc/klibc/arch/m68k/include/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/m68k/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/mips/MCONFIG b/klibc/klibc/arch/mips/MCONFIG new file mode 100644 index 0000000000..52b518461f --- /dev/null +++ b/klibc/klibc/arch/mips/MCONFIG @@ -0,0 +1,18 @@ +# -*- makefile -*- +# +# arch/mips/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHREQFLAGS = -fno-pic -mno-abicalls +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 32 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 2 MB -- the normal starting point for text is 4 MB. +SHAREDFLAGS = -Ttext 0x00200200 diff --git a/klibc/klibc/arch/mips/Makefile.inc b/klibc/klibc/arch/mips/Makefile.inc new file mode 100644 index 0000000000..09a2d2f736 --- /dev/null +++ b/klibc/klibc/arch/mips/Makefile.inc @@ -0,0 +1,24 @@ +# -*- makefile -*- +# +# arch/mips/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + arch/$(ARCH)/pipe.o \ + arch/$(ARCH)/vfork.o \ + arch/$(ARCH)/setjmp.o \ + libgcc/__divdi3.o \ + libgcc/__moddi3.o \ + libgcc/__udivdi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmoddi4.o + + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + + +archclean: diff --git a/klibc/klibc/arch/mips/crt0.S b/klibc/klibc/arch/mips/crt0.S new file mode 100644 index 0000000000..42d9dd5e38 --- /dev/null +++ b/klibc/klibc/arch/mips/crt0.S @@ -0,0 +1,25 @@ +# +# arch/mips/crt0.S +# +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. +# + +#include + +NESTED(__start, 32, sp) + subu sp, 32 + sw zero, 16(sp) + + lui gp, %hi(_gp) # Initialize gp + addiu gp, gp, _gp + + addiu a0, sp, 32 # Pointer to ELF entry structure + move a1, v0 # Kernel-provided atexit() pointer + + jal __libc_init + + END(__start) diff --git a/klibc/klibc/arch/mips/include/klibc/archsetjmp.h b/klibc/klibc/arch/mips/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..40e5be2736 --- /dev/null +++ b/klibc/klibc/arch/mips/include/klibc/archsetjmp.h @@ -0,0 +1,39 @@ +/* + * arch/mips/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __s0; + unsigned long __s1; + unsigned long __s2; + unsigned long __s3; + unsigned long __s4; + unsigned long __s5; + unsigned long __s6; + unsigned long __s7; + unsigned long __gp; + unsigned long __sp; + unsigned long __s8; + unsigned long __ra; + unsigned long __f20; + unsigned long __f21; + unsigned long __f22; + unsigned long __f23; + unsigned long __f24; + unsigned long __f25; + unsigned long __f26; + unsigned long __f27; + unsigned long __f28; + unsigned long __f29; + unsigned long __f30; + unsigned long __f31; + unsigned long __fcr31; + unsigned long __unused; +} __attribute__((aligned(8))); + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/klibc/arch/mips/include/klibc/archsys.h b/klibc/klibc/arch/mips/include/klibc/archsys.h new file mode 100644 index 0000000000..f696cdfaa7 --- /dev/null +++ b/klibc/klibc/arch/mips/include/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/mips/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/mips/include/machine/asm.h b/klibc/klibc/arch/mips/include/machine/asm.h new file mode 100644 index 0000000000..e5239a6cef --- /dev/null +++ b/klibc/klibc/arch/mips/include/machine/asm.h @@ -0,0 +1,11 @@ +/* + * arch/mips/include/machine/asm.h + */ + +#ifndef _MACHINE_ASM_H +#define _MACHINE_ASM_H + +#include +#include + +#endif /* _MACHINE_ASM_H */ diff --git a/klibc/klibc/arch/mips/include/sgidefs.h b/klibc/klibc/arch/mips/include/sgidefs.h new file mode 100644 index 0000000000..eb103ace2c --- /dev/null +++ b/klibc/klibc/arch/mips/include/sgidefs.h @@ -0,0 +1,20 @@ +/* + * arch/mips/include/sgidefs.h + */ + +/* Some ABI constants */ + +#ifndef _SGIDEFS_H +#define _SGIDEFS_H + +#define _MIPS_ISA_MIPS1 1 +#define _MIPS_ISA_MIPS2 2 +#define _MIPS_ISA_MIPS3 3 +#define _MIPS_ISA_MIPS4 4 +#define _MIPS_ISA_MIPS5 5 + +#define _MIPS_SIM_ABI32 1 +#define _MIPS_SIM_NABI32 2 +#define _MIPS_SIM_ABI64 3 + +#endif /* _SGIDEFS_H */ diff --git a/klibc/klibc/arch/mips/pipe.S b/klibc/klibc/arch/mips/pipe.S new file mode 100644 index 0000000000..d79f614025 --- /dev/null +++ b/klibc/klibc/arch/mips/pipe.S @@ -0,0 +1,16 @@ +#include +#include +#include + +LEAF(pipe) + li v0, __NR_pipe + syscall + bnez a3, 1f + sw v0, (a0) + sw v1, (a1) + li v0, 0 + b 2f +1: sw v0, errno + li v0, -1 +2: jr ra + END(pipe) diff --git a/klibc/klibc/arch/mips/setjmp.S b/klibc/klibc/arch/mips/setjmp.S new file mode 100644 index 0000000000..4d293757ec --- /dev/null +++ b/klibc/klibc/arch/mips/setjmp.S @@ -0,0 +1,82 @@ +# +# arch/mips/setjmp.S +# +# setjmp/longjmp for the MIPS architecture +# +# The jmp_buf is assumed to contain the following, in order: +# s0..s7 +# gp +# sp +# s8 +# ra +# f20..f31 +# fcr31 +# + +#include + +LEAF(setjmp) + sw s0, 0(a0) + sw s1, 4(a0) + sw s2, 8(a0) + sw s3, 12(a0) + sw s4, 16(a0) + sw s5, 20(a0) + sw s6, 24(a0) + sw s7, 28(a0) + sw gp, 32(a0) + sw sp, 36(a0) + sw s8, 40(a0) + sw ra, 44(a0) + cfc1 t0,$31 + swc1 $f20,48(a0) + swc1 $f21,52(a0) + swc1 $f22,56(a0) + swc1 $f23,60(a0) + swc1 $f24,64(a0) + swc1 $f25,68(a0) + swc1 $f26,72(a0) + swc1 $f27,76(a0) + swc1 $f28,80(a0) + swc1 $f29,84(a0) + swc1 $f30,88(a0) + swc1 $f31,92(a0) + sw t0,96(a0) + move v0,zero + jr ra + + END(setjmp) + +LEAF(longjmp) + lw s0, 0(a0) + lw s1, 4(a0) + lw s2, 8(a0) + lw s3, 12(a0) + lw s4, 16(a0) + lw s5, 20(a0) + lw s6, 24(a0) + lw s7, 28(a0) + lw gp, 32(a0) + lw sp, 36(a0) + lw s8, 40(a0) + lw ra, 44(a0) + lw t0, 96(a0) + lwc1 $f20,48(a0) + lwc1 $f21,52(a0) + lwc1 $f22,56(a0) + lwc1 $f23,60(a0) + lwc1 $f24,64(a0) + lwc1 $f25,68(a0) + lwc1 $f26,72(a0) + lwc1 $f27,76(a0) + lwc1 $f28,80(a0) + lwc1 $f29,84(a0) + lwc1 $f30,88(a0) + lwc1 $f31,92(a0) + ctc1 t0,$31 + move v0,a1 + jr ra + + END(longjmp) + + \ No newline at end of file diff --git a/klibc/klibc/arch/mips/vfork.S b/klibc/klibc/arch/mips/vfork.S new file mode 100644 index 0000000000..aca8083aa4 --- /dev/null +++ b/klibc/klibc/arch/mips/vfork.S @@ -0,0 +1,19 @@ +#include +#include +#include + +#define CLONE_VM 0x00000100 +#define CLONE_VFORK 0x00004000 +#define SIGCHLD 18 + +LEAF(vfork) + li a0, CLONE_VFORK | CLONE_VM | SIGCHLD + li a1, 0 + li v0, __NR_clone + syscall + bnez a3, 1f + b 2f +1: sw v0, errno + li v0, -1 +2: jr ra + END(vfork) diff --git a/klibc/klibc/arch/mips64/MCONFIG b/klibc/klibc/arch/mips64/MCONFIG new file mode 100644 index 0000000000..6a817e54b6 --- /dev/null +++ b/klibc/klibc/arch/mips64/MCONFIG @@ -0,0 +1,11 @@ +# -*- makefile -*- +# +# arch/mips64/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 64 diff --git a/klibc/klibc/arch/mips64/Makefile.inc b/klibc/klibc/arch/mips64/Makefile.inc new file mode 100644 index 0000000000..4a9529adca --- /dev/null +++ b/klibc/klibc/arch/mips64/Makefile.inc @@ -0,0 +1,10 @@ +# -*- makefile -*- +# +# arch/mips64/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +archclean: diff --git a/klibc/klibc/arch/mips64/include/klibc/archsys.h b/klibc/klibc/arch/mips64/include/klibc/archsys.h new file mode 100644 index 0000000000..81e5106e16 --- /dev/null +++ b/klibc/klibc/arch/mips64/include/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/mips64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/parisc/MCONFIG b/klibc/klibc/arch/parisc/MCONFIG new file mode 100644 index 0000000000..93a31707c6 --- /dev/null +++ b/klibc/klibc/arch/parisc/MCONFIG @@ -0,0 +1,11 @@ +# -*- makefile -*- +# +# arch/parisc/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 32 diff --git a/klibc/klibc/arch/parisc/Makefile.inc b/klibc/klibc/arch/parisc/Makefile.inc new file mode 100644 index 0000000000..f7a983da7f --- /dev/null +++ b/klibc/klibc/arch/parisc/Makefile.inc @@ -0,0 +1,10 @@ +# -*- makefile -*- +# +# arch/parisc/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +archclean: diff --git a/klibc/klibc/arch/parisc/include/klibc/archsys.h b/klibc/klibc/arch/parisc/include/klibc/archsys.h new file mode 100644 index 0000000000..5013ba8794 --- /dev/null +++ b/klibc/klibc/arch/parisc/include/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/parisc/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/ppc/MCONFIG b/klibc/klibc/arch/ppc/MCONFIG new file mode 100644 index 0000000000..fcb0992150 --- /dev/null +++ b/klibc/klibc/arch/ppc/MCONFIG @@ -0,0 +1,11 @@ +# -*- makefile -*- +# +# arch/ppc/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 32 diff --git a/klibc/klibc/arch/ppc/Makefile.inc b/klibc/klibc/arch/ppc/Makefile.inc new file mode 100644 index 0000000000..6e87a48d6b --- /dev/null +++ b/klibc/klibc/arch/ppc/Makefile.inc @@ -0,0 +1,15 @@ +# -*- makefile -*- +# +# arch/ppc/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + arch/$(ARCH)/setjmp.o + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + +archclean: diff --git a/klibc/klibc/arch/ppc/crt0.S b/klibc/klibc/arch/ppc/crt0.S new file mode 100644 index 0000000000..f7274b07dd --- /dev/null +++ b/klibc/klibc/arch/ppc/crt0.S @@ -0,0 +1,29 @@ +# +# arch/ppc/crt0.S +# +# void _start(void) +# { +# /* Divine up argc, argv, and envp */ +# environ = envp; +# exit(main(argc, argv, envp)); +# } +# + + .text + .align 4 + .type _start,@function + .globl _start +_start: + lwz 3,0(1) + addi 4,1,4 + addi 5,1,8 + slwi 0,3,2 + add 5,5,0 + li 0,0 + stwu 0,-16(1) + lis 9,environ@ha + stw 5,environ@l(9) + bl main + bl exit + + .size _start,.-_start diff --git a/klibc/klibc/arch/ppc/include/klibc/archsetjmp.h b/klibc/klibc/arch/ppc/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..53e2fccc3b --- /dev/null +++ b/klibc/klibc/arch/ppc/include/klibc/archsetjmp.h @@ -0,0 +1,36 @@ +/* + * arch/ppc/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __r2; + unsigned long __sp; + unsigned long __lr; + unsigned long __cr; + unsigned long __r13; + unsigned long __r14; + unsigned long __r15; + unsigned long __r16; + unsigned long __r17; + unsigned long __r18; + unsigned long __r19; + unsigned long __r20; + unsigned long __r21; + unsigned long __r22; + unsigned long __r23; + unsigned long __r24; + unsigned long __r25; + unsigned long __r26; + unsigned long __r27; + unsigned long __r28; + unsigned long __r29; + unsigned long __r30; + unsigned long __r31; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/ppc/include/klibc/archsys.h b/klibc/klibc/arch/ppc/include/klibc/archsys.h new file mode 100644 index 0000000000..33a5ff3236 --- /dev/null +++ b/klibc/klibc/arch/ppc/include/klibc/archsys.h @@ -0,0 +1,55 @@ +/* + * arch/ppc/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* PowerPC seems to lack _syscall6() in its headers */ +/* This seems to work on both 32- and 64-bit ppc */ + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ + unsigned long __sc_ret, __sc_err; \ + { \ + register unsigned long __sc_0 __asm__ ("r0"); \ + register unsigned long __sc_3 __asm__ ("r3"); \ + register unsigned long __sc_4 __asm__ ("r4"); \ + register unsigned long __sc_5 __asm__ ("r5"); \ + register unsigned long __sc_6 __asm__ ("r6"); \ + register unsigned long __sc_7 __asm__ ("r7"); \ + register unsigned long __sc_8 __asm__ ("r8"); \ + \ + __sc_3 = (unsigned long) (arg1); \ + __sc_4 = (unsigned long) (arg2); \ + __sc_5 = (unsigned long) (arg3); \ + __sc_6 = (unsigned long) (arg4); \ + __sc_7 = (unsigned long) (arg5); \ + __sc_8 = (unsigned long) (arg6); \ + __sc_0 = __NR_##name; \ + __asm__ __volatile__ \ + ("sc \n\t" \ + "mfcr %1 " \ + : "=&r" (__sc_3), "=&r" (__sc_0) \ + : "0" (__sc_3), "1" (__sc_0), \ + "r" (__sc_4), \ + "r" (__sc_5), \ + "r" (__sc_6), \ + "r" (__sc_7), \ + "r" (__sc_8) \ + : __syscall_clobbers); \ + __sc_ret = __sc_3; \ + __sc_err = __sc_0; \ + } \ + __syscall_return (type); \ +} + +#endif /* _syscall6() missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/ppc/setjmp.S b/klibc/klibc/arch/ppc/setjmp.S new file mode 100644 index 0000000000..1c50301707 --- /dev/null +++ b/klibc/klibc/arch/ppc/setjmp.S @@ -0,0 +1,35 @@ +# +# arch/ppc/setjmp.S +# +# Basic setjmp/longjmp implementation +# This file was derived from the equivalent file in NetBSD +# + + .text + .align 4 + .type setjmp,@function + .globl setjmp +setjmp: + mflr %r11 /* save return address */ + mfcr %r12 /* save condition register */ + mr %r10,%r1 /* save stack pointer */ + mr %r9,%r2 /* save GPR2 (not needed) */ + stmw %r9,0(%r3) /* save r9..r31 */ + li %r3,0 /* indicate success */ + blr /* return */ + + .size setjmp,.-setjmp + + .type longjmp,@function + .globl longjmp +longjmp: + lmw %r9,0(%r3) /* save r9..r31 */ + mtlr %r11 /* restore LR */ + mtcr %r12 /* restore CR */ + mr %r2,%r9 /* restore GPR2 (not needed) */ + mr %r1,%r10 /* restore stack */ + mr %r3,%r4 /* get return value */ + blr /* return */ + + .size longjmp,.-longjmp + \ No newline at end of file diff --git a/klibc/klibc/arch/ppc64/MCONFIG b/klibc/klibc/arch/ppc64/MCONFIG new file mode 100644 index 0000000000..6997693e99 --- /dev/null +++ b/klibc/klibc/arch/ppc64/MCONFIG @@ -0,0 +1,11 @@ +# -*- makefile -*- +# +# arch/ppc64/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 64 diff --git a/klibc/klibc/arch/ppc64/Makefile.inc b/klibc/klibc/arch/ppc64/Makefile.inc new file mode 100644 index 0000000000..434d0aad96 --- /dev/null +++ b/klibc/klibc/arch/ppc64/Makefile.inc @@ -0,0 +1,10 @@ +# -*- makefile -*- +# +# arch/ppc64/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +archclean: diff --git a/klibc/klibc/arch/ppc64/crt0.S b/klibc/klibc/arch/ppc64/crt0.S new file mode 100644 index 0000000000..2f352e8045 --- /dev/null +++ b/klibc/klibc/arch/ppc64/crt0.S @@ -0,0 +1,38 @@ +# +# arch/ppc64/crt0.S +# +# void _start(void) +# { +# /* Divine up argc, argv, and envp */ +# environ = envp; +# exit(main(argc, argv, envp)); +# } +# + + .section ".toc","aw" +.LC0: .tc environ[TC],environ + + .section ".opd","aw" + .align 3 + .globl _start +_start: + .quad ._start + .quad .TOC.@tocbase, 0 + + .text + .globl ._start + .type ._start,@function +._start: + ld 3,0(1) + ld 4,8(1) + ld 5,16(1) + li 0,0 + stdu 0,-64(1) + ld 9,.LC0@toc(2) + std 5,0(9) + bl .main + nop + bl .exit + nop + + .size _start,.-_start diff --git a/klibc/klibc/arch/ppc64/include/klibc/archsys.h b/klibc/klibc/arch/ppc64/include/klibc/archsys.h new file mode 100644 index 0000000000..4f81fee00d --- /dev/null +++ b/klibc/klibc/arch/ppc64/include/klibc/archsys.h @@ -0,0 +1,52 @@ +/* + * arch/ppc64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ + unsigned long __sc_ret, __sc_err; \ + { \ + register unsigned long __sc_0 __asm__ ("r0"); \ + register unsigned long __sc_3 __asm__ ("r3"); \ + register unsigned long __sc_4 __asm__ ("r4"); \ + register unsigned long __sc_5 __asm__ ("r5"); \ + register unsigned long __sc_6 __asm__ ("r6"); \ + register unsigned long __sc_7 __asm__ ("r7"); \ + register unsigned long __sc_8 __asm__ ("r8"); \ + \ + __sc_3 = (unsigned long) (arg1); \ + __sc_4 = (unsigned long) (arg2); \ + __sc_5 = (unsigned long) (arg3); \ + __sc_6 = (unsigned long) (arg4); \ + __sc_7 = (unsigned long) (arg5); \ + __sc_8 = (unsigned long) (arg6); \ + __sc_0 = __NR_##name; \ + __asm__ __volatile__ \ + ("sc \n\t" \ + "mfcr %1 " \ + : "=&r" (__sc_3), "=&r" (__sc_0) \ + : "0" (__sc_3), "1" (__sc_0), \ + "r" (__sc_4), \ + "r" (__sc_5), \ + "r" (__sc_6), \ + "r" (__sc_7), \ + "r" (__sc_8) \ + : __syscall_clobbers); \ + __sc_ret = __sc_3; \ + __sc_err = __sc_0; \ + } \ + __syscall_return (type); \ +} + +#endif /* _syscall6() missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/s390/MCONFIG b/klibc/klibc/arch/s390/MCONFIG new file mode 100644 index 0000000000..e32c33faa1 --- /dev/null +++ b/klibc/klibc/arch/s390/MCONFIG @@ -0,0 +1,13 @@ +# -*- makefile -*- +# +# arch/s390/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 32 + +SHAREDFLAGS = -Ttext 0x40000200 diff --git a/klibc/klibc/arch/s390/Makefile.inc b/klibc/klibc/arch/s390/Makefile.inc new file mode 100644 index 0000000000..45aa551695 --- /dev/null +++ b/klibc/klibc/arch/s390/Makefile.inc @@ -0,0 +1,16 @@ +# -*- makefile -*- +# +# arch/s390/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + arch/$(ARCH)/setjmp.o + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + + +archclean: diff --git a/klibc/klibc/arch/s390/crt0.S b/klibc/klibc/arch/s390/crt0.S new file mode 100644 index 0000000000..49c3e7ebc7 --- /dev/null +++ b/klibc/klibc/arch/s390/crt0.S @@ -0,0 +1,25 @@ +# +# arch/s390/crt0.S +# +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. +# + .text + .align 4 + .type _start,@function + .globl _start +_start: + lr %r2,%r15 + lhi %r3,0 + ahi %r15,-96 + bras %r1,.L0 +.L0: + l %r1,.L1-.L0(%r1) + br %r1 +.L1: + .long __libc_init + + .size _start,.-_start diff --git a/klibc/klibc/arch/s390/include/klibc/archsetjmp.h b/klibc/klibc/arch/s390/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..11a641ed5a --- /dev/null +++ b/klibc/klibc/arch/s390/include/klibc/archsetjmp.h @@ -0,0 +1,15 @@ +/* + * arch/s390/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + uint32_t __gregs[10]; /* general registers r6-r15 */ + uint64_t __fpregs[2]; /* fp registers f4 and f6 */ +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/s390/include/klibc/archsys.h b/klibc/klibc/arch/s390/include/klibc/archsys.h new file mode 100644 index 0000000000..1cd0948f3c --- /dev/null +++ b/klibc/klibc/arch/s390/include/klibc/archsys.h @@ -0,0 +1,41 @@ +/* + * arch/s390/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* S/390 only has five syscall parameters, and uses a structure for + 6-argument syscalls. */ + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,\ + type4,arg4,type5,arg5,type6,arg6) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ + type5 arg5, type6 arg6) { \ + unsigned long __arg[6] = { \ + (unsigned long) arg1, \ + (unsigned long) arg2, \ + (unsigned long) arg3, \ + (unsigned long) arg4, \ + (unsigned long) arg5, \ + (unsigned long) arg6 \ + }; \ + register void *__argp asm("2") = &__arg; \ + long __res; \ + __asm__ __volatile__ ( \ + " svc %b1\n" \ + " lr %0,2" \ + : "=d" (__res) \ + : "i" (__NR_##name), \ + "d" (__argp) \ + : _svc_clobber); \ + __syscall_return(type, __res); \ +} + +#endif /* _syscall6() missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/s390/setjmp.S b/klibc/klibc/arch/s390/setjmp.S new file mode 100644 index 0000000000..97132680ae --- /dev/null +++ b/klibc/klibc/arch/s390/setjmp.S @@ -0,0 +1,32 @@ +# +# arch/s390/setjmp.S +# +# setjmp/longjmp for the s390 architecture +# + + .text + .align 4 + .globl setjmp + .type setjmp, @function +setjmp: + stm %r6,%r15,0(%r2) # save all general registers + std %f4,40(%r2) # save fp registers f4 and f6 + std %f6,48(%r2) + lhi %r2,0 # return 0 + br %r14 + + .size setjmp,.-setjmp + + .text + .align 4 + .globl longjmp + .type longjmp, @function +longjmp: + lr %r1,%r2 # jmp_buf + lr %r2,%r3 # return value + ld %f6,48(%r1) # restore all saved registers + ld %f4,40(%r1) + lm %r6,%r15,0(%r1) + br %r14 # return to restored address + + .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/s390x/MCONFIG b/klibc/klibc/arch/s390x/MCONFIG new file mode 100644 index 0000000000..1c8232bed5 --- /dev/null +++ b/klibc/klibc/arch/s390x/MCONFIG @@ -0,0 +1,13 @@ +# -*- makefile -*- +# +# arch/s390x/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 64 + +SHAREDFLAGS = -Ttext 0x40000200 diff --git a/klibc/klibc/arch/s390x/Makefile.inc b/klibc/klibc/arch/s390x/Makefile.inc new file mode 100644 index 0000000000..eff8f951ac --- /dev/null +++ b/klibc/klibc/arch/s390x/Makefile.inc @@ -0,0 +1,16 @@ +# -*- makefile -*- +# +# arch/s390x/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + arch/$(ARCH)/setjmp.o + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + + +archclean: diff --git a/klibc/klibc/arch/s390x/crt0.S b/klibc/klibc/arch/s390x/crt0.S new file mode 100644 index 0000000000..de35664904 --- /dev/null +++ b/klibc/klibc/arch/s390x/crt0.S @@ -0,0 +1,21 @@ +# +# arch/s390/crt0.S +# +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. +# + + .text + .align 4 + .type _start,@function + .globl _start +_start: + lgr %r2,%r15 + lghi %r3,0 + aghi %r15,-160 + jg __libc_init + + .size _start,.-_start diff --git a/klibc/klibc/arch/s390x/include/klibc/archsetjmp.h b/klibc/klibc/arch/s390x/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..dd3ed0d47c --- /dev/null +++ b/klibc/klibc/arch/s390x/include/klibc/archsetjmp.h @@ -0,0 +1,15 @@ +/* + * arch/s390x/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + uint64_t __gregs[10]; /* general registers r6-r15 */ + uint64_t __fpregs[4]; /* fp registers f1, f3, f5, f7 */ +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/s390x/include/klibc/archsys.h b/klibc/klibc/arch/s390x/include/klibc/archsys.h new file mode 100644 index 0000000000..15f7113bb4 --- /dev/null +++ b/klibc/klibc/arch/s390x/include/klibc/archsys.h @@ -0,0 +1,41 @@ +/* + * arch/s390x/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* S/390X only has five syscall parameters, and uses a structure for + 6-argument syscalls. */ + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,\ + type4,arg4,type5,arg5,type6,arg6) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ + type5 arg5, type6 arg6) { \ + unsigned long __arg[6] = { \ + (unsigned long) arg1, \ + (unsigned long) arg2, \ + (unsigned long) arg3, \ + (unsigned long) arg4, \ + (unsigned long) arg5, \ + (unsigned long) arg6 \ + }; \ + register void *__argp asm("2") = &__arg; \ + long __res; \ + __asm__ __volatile__ ( \ + " svc %b1\n" \ + " lgr %0,2" \ + : "=d" (__res) \ + : "i" (__NR_##name), \ + "d" (__argp) \ + : _svc_clobber); \ + __syscall_return(type, __res); \ +} + +#endif /* _syscall6() missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/s390x/setjmp.S b/klibc/klibc/arch/s390x/setjmp.S new file mode 100644 index 0000000000..251c57d43a --- /dev/null +++ b/klibc/klibc/arch/s390x/setjmp.S @@ -0,0 +1,36 @@ +# +# arch/s390x/setjmp.S +# +# setjmp/longjmp for the s390x architecture +# + + .text + .align 4 + .globl setjmp + .type setjmp, @function +setjmp: + stmg %r6,%r15,0(%r2) # save all general registers + std %f1,80(%r2) # save fp registers f4 and f6 + std %f3,88(%r2) + std %f5,96(%r2) + std %f7,104(%r2) + lghi %r2,0 # return 0 + br %r14 + + .size setjmp,.-setjmp + + .text + .align 4 + .globl longjmp + .type longjmp, @function +longjmp: + lgr %r1,%r2 # jmp_buf + lgr %r2,%r3 # return value + ld %f7,104(%r1) # restore all saved registers + ld %f5,96(%r1) + ld %f3,88(%r1) + ld %f1,80(%r1) + lmg %r6,%r15,0(%r1) + br %r14 # return to restored address + + .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/sh/MCONFIG b/klibc/klibc/arch/sh/MCONFIG new file mode 100644 index 0000000000..6cd4e5c839 --- /dev/null +++ b/klibc/klibc/arch/sh/MCONFIG @@ -0,0 +1,19 @@ +# -*- makefile -*- +# +# arch/sh/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHREGFLAGS = -m4 -mno-implicit-fp +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 32 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 2 MB -- the normal starting point for text is 4 MB. +SHAREDFLAGS = -Ttext 0x00200200 + diff --git a/klibc/klibc/arch/sh/Makefile.inc b/klibc/klibc/arch/sh/Makefile.inc new file mode 100644 index 0000000000..16d7ea1e18 --- /dev/null +++ b/klibc/klibc/arch/sh/Makefile.inc @@ -0,0 +1,14 @@ +# -*- makefile -*- +# +# arch/sh/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = arch/sh/setjmp.o + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + +archclean: diff --git a/klibc/klibc/arch/sh/crt0.S b/klibc/klibc/arch/sh/crt0.S new file mode 100644 index 0000000000..c9938a5612 --- /dev/null +++ b/klibc/klibc/arch/sh/crt0.S @@ -0,0 +1,28 @@ +# +# arch/sh/crt0.S +# +# void _start(void) +# { +# /* Divine up argc, argv, and envp */ +# environ = envp; +# exit(main(argc, argv, envp)); +# } +# + + .text + .align 2 + .type _start,#function + .globl _start + +_start: + mov r15, r4 + mov #0, r5 + mov.l 1f, r0 + + jsr @r0 + nop + + .align 2 +1: .long __libc_init + + .size _start,.-_start diff --git a/klibc/klibc/arch/sh/include/klibc/archsetjmp.h b/klibc/klibc/arch/sh/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..28dd932fbc --- /dev/null +++ b/klibc/klibc/arch/sh/include/klibc/archsetjmp.h @@ -0,0 +1,22 @@ +/* + * arch/sh/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long r11; + unsigned long r12; + unsigned long r13; + unsigned long r14; + unsigned long r15; + unsigned long pr; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/klibc/arch/sh/include/klibc/archsys.h b/klibc/klibc/arch/sh/include/klibc/archsys.h new file mode 100644 index 0000000000..5f8050a536 --- /dev/null +++ b/klibc/klibc/arch/sh/include/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/sh/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/sh/setjmp.S b/klibc/klibc/arch/sh/setjmp.S new file mode 100644 index 0000000000..63f760283f --- /dev/null +++ b/klibc/klibc/arch/sh/setjmp.S @@ -0,0 +1,65 @@ +# +# arch/sh/setjmp.S +# +# setjmp/longjmp for the SuperH architecture +# + +# +# The jmp_buf is assumed to contain the following, in order: +# +# r8 +# r9 +# r10 +# r11 +# r12 +# r13 +# r14 +# r15 +# pr +# + + .text + .align 2 + + .globl setjmp + .type setjmp, #function + +setjmp: + add #(9*4), r4 + sts.l pr, @-r4 + mov.l r15, @-r4 + mov.l r14, @-r4 + mov.l r13, @-r4 + mov.l r12, @-r4 + mov.l r11, @-r4 + mov.l r10, @-r4 + mov.l r9, @-r4 + mov.l r8, @-r4 + rts + mov #0, r0 + + .size setjmp,.-setjmp + + .align 2 + .globl longjmp + .type setjmp, #function + +longjmp: + mov.l @r4+, r8 + mov.l @r4+, r9 + mov.l @r4+, r10 + mov.l @r4+, r11 + mov.l @r4+, r12 + mov.l @r4+, r13 + mov.l @r4+, r14 + mov.l @r4+, r15 + lds.l @r4+, pr + mov r5, r0 + tst r0, r0 + bf 1f + mov #1, r0 ! in case val==0 +1: rts + nop + + .size longjmp,.-longjmp + diff --git a/klibc/klibc/arch/sparc/MCONFIG b/klibc/klibc/arch/sparc/MCONFIG new file mode 100644 index 0000000000..cb94f46c00 --- /dev/null +++ b/klibc/klibc/arch/sparc/MCONFIG @@ -0,0 +1,18 @@ +# -*- makefile -*- +# +# arch/sparc/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 32 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# Normal binaries start at 64K; the linker wants 64K alignment, +# and call instructions have a 30-bit signed offset, << 2. +SHAREDFLAGS = -Ttext 0x40000100 diff --git a/klibc/klibc/arch/sparc/Makefile.inc b/klibc/klibc/arch/sparc/Makefile.inc new file mode 100644 index 0000000000..0186810aca --- /dev/null +++ b/klibc/klibc/arch/sparc/Makefile.inc @@ -0,0 +1,44 @@ +# -*- makefile -*- +# +# arch/sparc/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + arch/$(ARCH)/sdiv.o \ + arch/$(ARCH)/udiv.o \ + arch/$(ARCH)/srem.o \ + arch/$(ARCH)/urem.o \ + arch/$(ARCH)/smul.o \ + arch/$(ARCH)/umul.o \ + arch/$(ARCH)/setjmp.o + +arch/$(ARCH)/sdiv.S: arch/$(ARCH)/divrem.m4 + @echo 'building $@ from $^' + @(echo "define(NAME,\`.div')define(OP,\`div')define(S,\`true')"; \ + cat $^) | m4 > $@ + @chmod 444 $@ + +arch/$(ARCH)/udiv.S: arch/$(ARCH)/divrem.m4 + @echo 'building $@ from $^' + @(echo "define(NAME,\`.udiv')define(OP,\`div')define(S,\`false')"; \ + cat $^) | m4 > $@ + @chmod 444 $@ + +arch/$(ARCH)/srem.S: arch/$(ARCH)/divrem.m4 + @echo 'building $@ from $^' + @(echo "define(NAME,\`.rem')define(OP,\`rem')define(S,\`true')"; \ + cat $^) | m4 > $@ + @chmod 444 $@ + +arch/$(ARCH)/urem.S: arch/$(ARCH)/divrem.m4 + @echo 'building $@ from $^' + @(echo "define(NAME,\`.urem')define(OP,\`rem')define(S,\`false')"; \ + cat $^) | m4 > $@ + @chmod 444 $@ + +archclean: + rm -f arch/$(ARCH)/?div.S arch/$(ARCH)/?rem.S diff --git a/klibc/klibc/arch/sparc/crt0.S b/klibc/klibc/arch/sparc/crt0.S new file mode 100644 index 0000000000..148cb4b4e9 --- /dev/null +++ b/klibc/klibc/arch/sparc/crt0.S @@ -0,0 +1,2 @@ +#define TARGET_PTR_SIZE 32 +#include "arch/sparc/crt0i.S" diff --git a/klibc/klibc/arch/sparc/crt0i.S b/klibc/klibc/arch/sparc/crt0i.S new file mode 100644 index 0000000000..97652a3090 --- /dev/null +++ b/klibc/klibc/arch/sparc/crt0i.S @@ -0,0 +1,100 @@ +! This file derived from the equivalent in newlib +! +! C run time start off + +! This file supports: +! +! - both 32bit pointer and 64bit pointer environments (at compile time) +! - an imposed stack bias (of 2047) (at run time) +! - medium/low and medium/anywhere code models (at run time) + +! Initial stack setup: +! +! bottom of stack (higher memory address) +! ... +! text of environment strings +! text of argument strings +! envp[envc] = 0 (4/8 bytes) +! ... +! env[0] (4/8 bytes) +! argv[argc] = 0 (4/8 bytes) +! ... +! argv[0] (4/8 bytes) +! argc (4/8 bytes) +! register save area (64 bits by 16 registers = 128 bytes) +! top of stack (%sp) + +! Stack Bias: +! +! It is the responsibility of the o/s to set this up. +! We handle both a 0 and 2047 value for the stack bias. + +! Medium/Anywhere code model support: +! +! In this model %g4 points to the start of the data segment. +! The text segment can go anywhere, but %g4 points to the *data* segment. +! It is up to the compiler/linker to get this right. +! +! Since this model is statically linked the start of the data segment +! is known at link time. Eg: +! +! sethi %hh(data_start), %g1 +! sethi %lm(data_start), %g4 +! or %g1, %hm(data_start), %g1 +! or %g4, %lo(data_start), %g4 +! sllx %g1, 32, %g1 +! or %g4, %g1, %g4 +! +! FIXME: For now we just assume 0. + +! FIXME: if %g1 contains a non-zero value, atexit() should be invoked +! with this value. + + + .text + .align 4 + .globl _start + .type _start, @function +_start: + clr %fp + +! We use %g4 even if the code model is Medium/Low (simplifies the code). + + clr %g4 ! Medium/Anywhere base reg + +! If there is a stack bias in effect, account for it in %g5. Then always +! add %g5 to stack references below. This way the code can be used with +! or without an imposed bias. + + andcc %sp, 1, %g5 + bz,a .LNoBias + nop + mov 2047, %g5 +.LNoBias: + add %sp, %g5, %g5 + +! On entry, the kernel leaves room for one register frame, but +! the C API wants more free space. Thus, we need to drop the stack +! pointer additionally. + +#if TARGET_PTR_SIZE == 32 + sub %sp, 32, %sp ! make room for incoming arguments +#else /* TARGET_PTR_SIZE == 64 */ + sub %sp, 64, %sp ! make room for incoming arguments +#endif + +! Set up pointers to the ELF data structure (argc, argv, ...) +! Pass as the first argument to __libc_init +#if TARGET_PTR_SIZE == 32 + add %g5, 0x40, %o0 +#else /* TARGET_PTR_SIZE == 64 */ + add %g5, 0x80, %o0 +#endif + + call __libc_init + mov %g1, %o1 ! This is the "atexit" pointer; + ! pass as the second argument to __libc_init + +! If __libc_init returns, something is hosed. Try an illegal insn. +! If that does not work, the o/s is hosed more than we are. + .long 0 diff --git a/klibc/klibc/arch/sparc/divrem.m4 b/klibc/klibc/arch/sparc/divrem.m4 new file mode 100644 index 0000000000..aa4171dd88 --- /dev/null +++ b/klibc/klibc/arch/sparc/divrem.m4 @@ -0,0 +1,276 @@ +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Header: divrem.m4,v 1.4 92/06/25 13:23:57 torek Exp + * $NetBSD: divrem.m4,v 1.4 1997/10/09 10:07:54 lukem Exp $ + */ + +/* + * Division and remainder, from Appendix E of the Sparc Version 8 + * Architecture Manual, with fixes from Gordon Irlam. + */ + +#if defined(LIBC_SCCS) && !defined(lint) + .asciz "@(#)divrem.m4 8.1 (Berkeley) 6/4/93" +#endif /* LIBC_SCCS and not lint */ + +/* + * Input: dividend and divisor in %o0 and %o1 respectively. + * + * m4 parameters: + * NAME name of function to generate + * OP OP=div => %o0 / %o1; OP=rem => %o0 % %o1 + * S S=true => signed; S=false => unsigned + * + * Algorithm parameters: + * N how many bits per iteration we try to get (4) + * WORDSIZE total number of bits (32) + * + * Derived constants: + * TWOSUPN 2^N, for label generation (m4 exponentiation currently broken) + * TOPBITS number of bits in the top `decade' of a number + * + * Important variables: + * Q the partial quotient under development (initially 0) + * R the remainder so far, initially the dividend + * ITER number of main division loop iterations required; + * equal to ceil(log2(quotient) / N). Note that this + * is the log base (2^N) of the quotient. + * V the current comparand, initially divisor*2^(ITER*N-1) + * + * Cost: + * Current estimate for non-large dividend is + * ceil(log2(quotient) / N) * (10 + 7N/2) + C + * A large dividend is one greater than 2^(31-TOPBITS) and takes a + * different path, as the upper bits of the quotient must be developed + * one bit at a time. + */ + +define(N, `4') +define(TWOSUPN, `16') +define(WORDSIZE, `32') +define(TOPBITS, eval(WORDSIZE - N*((WORDSIZE-1)/N))) + +define(dividend, `%o0') +define(divisor, `%o1') +define(Q, `%o2') +define(R, `%o3') +define(ITER, `%o4') +define(V, `%o5') + +/* m4 reminder: ifelse(a,b,c,d) => if a is b, then c, else d */ +define(T, `%g1') +define(SC, `%g7') +ifelse(S, `true', `define(SIGN, `%g6')') + +/* + * This is the recursive definition for developing quotient digits. + * + * Parameters: + * $1 the current depth, 1 <= $1 <= N + * $2 the current accumulation of quotient bits + * N max depth + * + * We add a new bit to $2 and either recurse or insert the bits in + * the quotient. R, Q, and V are inputs and outputs as defined above; + * the condition codes are expected to reflect the input R, and are + * modified to reflect the output R. + */ +define(DEVELOP_QUOTIENT_BITS, +` ! depth $1, accumulated bits $2 + bl L.$1.eval(TWOSUPN+$2) + srl V,1,V + ! remainder is positive + subcc R,V,R + ifelse($1, N, + ` b 9f + add Q, ($2*2+1), Q + ', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2+1)')') +L.$1.eval(TWOSUPN+$2): + ! remainder is negative + addcc R,V,R + ifelse($1, N, + ` b 9f + add Q, ($2*2-1), Q + ', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2-1)')') + ifelse($1, 1, `9:')') + +#include +#include + +FUNC(NAME) +ifelse(S, `true', +` ! compute sign of result; if neither is negative, no problem + orcc divisor, dividend, %g0 ! either negative? + bge 2f ! no, go do the divide + ifelse(OP, `div', + `xor divisor, dividend, SIGN', + `mov dividend, SIGN') ! compute sign in any case + tst divisor + bge 1f + tst dividend + ! divisor is definitely negative; dividend might also be negative + bge 2f ! if dividend not negative... + neg divisor ! in any case, make divisor nonneg +1: ! dividend is negative, divisor is nonnegative + neg dividend ! make dividend nonnegative +2: +') + ! Ready to divide. Compute size of quotient; scale comparand. + orcc divisor, %g0, V + bnz 1f + mov dividend, R + + ! Divide by zero trap. If it returns, return 0 (about as + ! wrong as possible, but that is what SunOS does...). + t ST_DIV0 + retl + clr %o0 + +1: + cmp R, V ! if divisor exceeds dividend, done + blu Lgot_result ! (and algorithm fails otherwise) + clr Q + sethi %hi(1 << (WORDSIZE - TOPBITS - 1)), T + cmp R, T + blu Lnot_really_big + clr ITER + + ! `Here the dividend is >= 2^(31-N) or so. We must be careful here, + ! as our usual N-at-a-shot divide step will cause overflow and havoc. + ! The number of bits in the result here is N*ITER+SC, where SC <= N. + ! Compute ITER in an unorthodox manner: know we need to shift V into + ! the top decade: so do not even bother to compare to R.' + 1: + cmp V, T + bgeu 3f + mov 1, SC + sll V, N, V + b 1b + inc ITER + + ! Now compute SC. + 2: addcc V, V, V + bcc Lnot_too_big + inc SC + + ! We get here if the divisor overflowed while shifting. + ! This means that R has the high-order bit set. + ! Restore V and subtract from R. + sll T, TOPBITS, T ! high order bit + srl V, 1, V ! rest of V + add V, T, V + b Ldo_single_div + dec SC + + Lnot_too_big: + 3: cmp V, R + blu 2b + nop + be Ldo_single_div + nop + /* NB: these are commented out in the V8-Sparc manual as well */ + /* (I do not understand this) */ + ! V > R: went too far: back up 1 step + ! srl V, 1, V + ! dec SC + ! do single-bit divide steps + ! + ! We have to be careful here. We know that R >= V, so we can do the + ! first divide step without thinking. BUT, the others are conditional, + ! and are only done if R >= 0. Because both R and V may have the high- + ! order bit set in the first step, just falling into the regular + ! division loop will mess up the first time around. + ! So we unroll slightly... + Ldo_single_div: + deccc SC + bl Lend_regular_divide + nop + sub R, V, R + mov 1, Q + b Lend_single_divloop + nop + Lsingle_divloop: + sll Q, 1, Q + bl 1f + srl V, 1, V + ! R >= 0 + sub R, V, R + b 2f + inc Q + 1: ! R < 0 + add R, V, R + dec Q + 2: + Lend_single_divloop: + deccc SC + bge Lsingle_divloop + tst R + b,a Lend_regular_divide + +Lnot_really_big: +1: + sll V, N, V + cmp V, R + bleu 1b + inccc ITER + be Lgot_result + dec ITER + + tst R ! set up for initial iteration +Ldivloop: + sll Q, N, Q + DEVELOP_QUOTIENT_BITS(1, 0) +Lend_regular_divide: + deccc ITER + bge Ldivloop + tst R + bl,a Lgot_result + ! non-restoring fixup here (one instruction only!) +ifelse(OP, `div', +` dec Q +', ` add R, divisor, R +') + +Lgot_result: +ifelse(S, `true', +` ! check to see if answer should be < 0 + tst SIGN + bl,a 1f + ifelse(OP, `div', `neg Q', `neg R') +1:') + retl + ifelse(OP, `div', `mov Q, %o0', `mov R, %o0') diff --git a/klibc/klibc/arch/sparc/include/klibc/archsetjmp.h b/klibc/klibc/arch/sparc/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..92c1c74c9d --- /dev/null +++ b/klibc/klibc/arch/sparc/include/klibc/archsetjmp.h @@ -0,0 +1,16 @@ +/* + * arch/sparc/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __sp; + unsigned long __fp; + unsigned long __pc; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/sparc/include/klibc/archsys.h b/klibc/klibc/arch/sparc/include/klibc/archsys.h new file mode 100644 index 0000000000..fe6e68df8a --- /dev/null +++ b/klibc/klibc/arch/sparc/include/klibc/archsys.h @@ -0,0 +1,65 @@ +/* + * arch/sparc/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* fork and vfork return the "other process" pid in %o0 and an + "is child" flag in %o1... */ + +#define _syscall0_forkish(type,name) \ +type name(void) \ +{ \ +register long __g1 __asm__ ("g1") = __NR_##name; \ +register unsigned long __o0 __asm__ ("o0"); \ +register unsigned long __o1 __asm__ ("o1"); \ +__asm__ __volatile__ ("t 0x10\n\t" \ + "bcc 1f\n\t" \ + "mov %%o0, %0\n\t" \ + "sub %%g0, %%o0, %0\n\t" \ + "1:\n\t" \ + : "=r" (__o0), "=r" (__o1)\ + : "r" (__g1) \ + : "cc"); \ +if ((unsigned long)__o0 < (unsigned long)-255) \ + return (type)(__o0 & (__o1-1)); \ +errno = (int)-__o0; \ +return -1; \ +} + +/* SPARC seems to lack _syscall6() in its headers */ + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ +long __res; \ +register long __g1 __asm__ ("g1") = __NR_##name; \ +register long __o0 __asm__ ("o0") = (long)(arg1); \ +register long __o1 __asm__ ("o1") = (long)(arg2); \ +register long __o2 __asm__ ("o2") = (long)(arg3); \ +register long __o3 __asm__ ("o3") = (long)(arg4); \ +register long __o4 __asm__ ("o4") = (long)(arg5); \ +register long __o5 __asm__ ("o5") = (long)(arg6); \ +__asm__ __volatile__ ("t 0x10\n\t" \ + "bcc 1f\n\t" \ + "mov %%o0, %0\n\t" \ + "sub %%g0, %%o0, %0\n\t" \ + "1:\n\t" \ + : "=r" (__res), "=&r" (__o0) \ + : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__o5), "r" (__g1) \ + : "cc"); \ +if (__res < -255 || __res>=0) \ +return (type) __res; \ +errno = -__res; \ +return (type)-1; \ +} + +#endif /* _syscall6 missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/sparc/include/machine/asm.h b/klibc/klibc/arch/sparc/include/machine/asm.h new file mode 100644 index 0000000000..b622bd8cf1 --- /dev/null +++ b/klibc/klibc/arch/sparc/include/machine/asm.h @@ -0,0 +1,192 @@ +/* $NetBSD: asm.h,v 1.14 2002/07/20 08:37:30 mrg Exp $ */ + +/* + * Copyright (c) 1994 Allen Briggs + * All rights reserved. + * + * Gleaned from locore.s and sun3 asm.h which had the following copyrights: + * locore.s: + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1990 The Regents of the University of California. + * sun3/include/asm.h: + * Copyright (c) 1993 Adam Glass + * Copyright (c) 1990 The Regents of the University of California. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _ASM_H_ +#define _ASM_H_ + +/* Pull in CCFSZ, CC64FSZ, and BIAS from frame.h */ +#ifndef _LOCORE +#define _LOCORE +#endif +#include + +#ifdef __ELF__ +#define _C_LABEL(name) name +#else +#ifdef __STDC__ +#define _C_LABEL(name) _ ## name +#else +#define _C_LABEL(name) _/**/name +#endif +#endif +#define _ASM_LABEL(name) name + +#ifdef PIC +/* + * PIC_PROLOGUE() is akin to the compiler generated function prologue for + * PIC code. It leaves the address of the Global Offset Table in DEST, + * clobbering register TMP in the process. + * + * We can use two code sequences. We can read the %pc or use the call + * instruction that saves the pc in %o7. Call requires the branch unit and + * IEU1, and clobbers %o7 which needs to be restored. This instruction + * sequence takes about 4 cycles due to instruction interdependence. Reading + * the pc takes 4 cycles to dispatch and is always dispatched alone. That + * sequence takes 7 cycles. + */ +#ifdef __arch64__ +#define PIC_PROLOGUE(dest,tmp) \ + mov %o7, tmp; \ + sethi %hi(_GLOBAL_OFFSET_TABLE_-4),dest; \ + call 0f; \ + or dest,%lo(_GLOBAL_OFFSET_TABLE_+4),dest; \ +0: \ + add dest,%o7,dest; \ + mov tmp, %o7 +#else +#define PIC_PROLOGUE(dest,tmp) \ + mov %o7,tmp; 3: call 4f; nop; 4: \ + sethi %hi(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ + or dest,%lo(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ + add dest,%o7,dest; mov tmp,%o7 +#endif + +/* + * PICCY_SET() does the equivalent of a `set var, %dest' instruction in + * a PIC-like way, but without involving the Global Offset Table. This + * only works for VARs defined in the same file *and* in the text segment. + */ +#ifdef __arch64__ +#define PICCY_SET(var,dest,tmp) \ + 3: rd %pc, tmp; add tmp,(var-3b),dest +#else +#define PICCY_SET(var,dest,tmp) \ + mov %o7,tmp; 3: call 4f; nop; 4: \ + add %o7,(var-3b),dest; mov tmp,%o7 +#endif +#else +#define PIC_PROLOGUE(dest,tmp) +#define PICCY_OFFSET(var,dest,tmp) +#endif + +#define FTYPE(x) .type x,@function +#define OTYPE(x) .type x,@object + +#define _ENTRY(name) \ + .align 4; .globl name; .proc 1; FTYPE(name); name: + +#ifdef GPROF +/* see _MCOUNT_ENTRY in profile.h */ +#ifdef __ELF__ +#ifdef __arch64__ +#define _PROF_PROLOGUE \ + .data; .align 8; 1: .uaword 0; .uaword 0; \ + .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call _mcount; \ + or %o0,%lo(1b),%o0; restore +#else +#define _PROF_PROLOGUE \ + .data; .align 4; 1: .long 0; \ + .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call _mcount; \ + or %o0,%lo(1b),%o0; restore +#endif +#else +#ifdef __arch64__ +#define _PROF_PROLOGUE \ + .data; .align 8; 1: .uaword 0; .uaword 0; \ + .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call mcount; \ + or %o0,%lo(1b),%o0; restore +#else +#define _PROF_PROLOGUE \ + .data; .align 4; 1: .long 0; \ + .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \ + or %o0,%lo(1b),%o0; restore +#endif +#endif +#else +#define _PROF_PROLOGUE +#endif + +#define ENTRY(name) _ENTRY(_C_LABEL(name)); _PROF_PROLOGUE +#define ENTRY_NOPROFILE(name) _ENTRY(_C_LABEL(name)) +#define ASENTRY(name) _ENTRY(_ASM_LABEL(name)); _PROF_PROLOGUE +#define FUNC(name) ASENTRY(name) +#define RODATA(name) .align 4; .text; .globl _C_LABEL(name); \ + OTYPE(_C_LABEL(name)); _C_LABEL(name): + + +#define ASMSTR .asciz + +#define RCSID(name) .asciz name + +#ifdef __ELF__ +#define WEAK_ALIAS(alias,sym) \ + .weak alias; \ + alias = sym +#endif + +/* + * WARN_REFERENCES: create a warning if the specified symbol is referenced. + */ +#ifdef __ELF__ +#ifdef __STDC__ +#define WARN_REFERENCES(_sym,_msg) \ + .section .gnu.warning. ## _sym ; .ascii _msg ; .text +#else +#define WARN_REFERENCES(_sym,_msg) \ + .section .gnu.warning./**/_sym ; .ascii _msg ; .text +#endif /* __STDC__ */ +#else +#ifdef __STDC__ +#define __STRING(x) #x +#define WARN_REFERENCES(sym,msg) \ + .stabs msg ## ,30,0,0,0 ; \ + .stabs __STRING(_ ## sym) ## ,1,0,0,0 +#else +#define __STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs __STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ +#endif /* __ELF__ */ + +#endif /* _ASM_H_ */ diff --git a/klibc/klibc/arch/sparc/include/machine/frame.h b/klibc/klibc/arch/sparc/include/machine/frame.h new file mode 100644 index 0000000000..b09175c7f4 --- /dev/null +++ b/klibc/klibc/arch/sparc/include/machine/frame.h @@ -0,0 +1,138 @@ +/* $NetBSD: frame.h,v 1.4 2001/12/04 00:05:05 darrenr Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)frame.h 8.1 (Berkeley) 6/11/93 + */ + +#if defined(_KERNEL_OPT) +#include "opt_sparc_arch.h" +#endif + +/* + * Sparc stack frame format. + * + * Note that the contents of each stack frame may be held only in + * machine register windows. In order to get an accurate picture + * of the frame, you must first force the kernel to write any such + * windows to the stack. + */ +#ifndef _LOCORE +#ifndef SUN4U +struct frame { + int32_t fr_local[8]; /* space to save locals (%l0..%l7) */ + int32_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ + struct frame *fr_fp; /* space to save frame pointer (%i6) */ + int32_t fr_pc; /* space to save return pc (%i7) */ + /* + * SunOS reserves another 8 words here; this is pointless + * but we do it for compatibility. + */ + int32_t fr_xxx; /* `structure return pointer' (unused) */ + int32_t fr_argd[6]; /* `arg dump area' (lunacy) */ + int32_t fr_argx[1]; /* arg extension (args 7..n; variable size) */ +}; +#else +struct frame32 { + int32_t fr_local[8]; /* space to save locals (%l0..%l7) */ + int32_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ + u_int32_t fr_fp; /* space to save frame pointer (%i6) */ + u_int32_t fr_pc; /* space to save return pc (%i7) */ + /* + * SunOS reserves another 8 words here; this is pointless + * but we do it for compatibility. + */ + int32_t fr_xxx; /* `structure return pointer' (unused) */ + int32_t fr_argd[6]; /* `arg dump area' (lunacy) */ + int32_t fr_argx[1]; /* arg extension (args 7..n; variable size) */ +}; +#endif +#endif + +/* + * CCFSZ (C Compiler Frame SiZe) is the size of a stack frame required if + * a function is to call C code. It should be just 64, but Sun defined + * their frame with space to hold arguments 0 through 5 (plus some junk), + * and varargs routines (such as kprintf) demand this, and gcc uses this + * area at times anyway. + */ +#define CCFSZ 96 + +/* + * Sparc v9 stack frame format. + * + * Note that the contents of each stack frame may be held only in + * machine register windows. In order to get an accurate picture + * of the frame, you must first force the kernel to write any such + * windows to the stack. + * + * V9 frames have an odd bias, so you can tall a v9 frame from + * a v8 frame by testing the stack pointer's lsb. + */ +#if !defined(_LOCORE) && !defined(_LIBC) +struct frame64 { + int64_t fr_local[8]; /* space to save locals (%l0..%l7) */ + int64_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ + u_int64_t fr_fp; /* space to save frame pointer (%i6) */ + u_int64_t fr_pc; /* space to save return pc (%i7) */ + /* + * SVR4 reserves a bunch of extra stuff. + */ + int64_t fr_argd[6]; /* `register save area' (lunacy) */ + int64_t fr_argx[0]; /* arg extension (args 7..n; variable size) */ +}; + +#define v9next_frame(f) ((struct frame64*)(f->fr_fp+BIAS)) +#endif + +/* + * CC64FSZ (C Compiler 64-bit Frame SiZe) is the size of a stack frame used + * by the compiler in 64-bit mode. It is (16)*8; space for 8 ins, 8 outs. + */ +#define CC64FSZ 176 + +/* + * v9 stacks all have a bias of 2047 added to the %sp and %fp, so you can easily + * detect it by testing the register for an odd value. Why 2K-1 I don't know. + */ +#define BIAS (2048-1) + diff --git a/klibc/klibc/arch/sparc/include/machine/trap.h b/klibc/klibc/arch/sparc/include/machine/trap.h new file mode 100644 index 0000000000..42c3ef6ae2 --- /dev/null +++ b/klibc/klibc/arch/sparc/include/machine/trap.h @@ -0,0 +1,141 @@ +/* $NetBSD: trap.h,v 1.11 1999/01/20 00:15:08 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)trap.h 8.1 (Berkeley) 6/11/93 + */ +/* + * Sun4m support by Aaron Brown, Harvard University. + * Changes Copyright (c) 1995 The President and Fellows of Harvard College. + * All rights reserved. + */ + +#ifndef _MACHINE_TRAP_H +#define _MACHINE_TRAP_H + +/* trap vec (pri) description */ +#define T_RESET 0x00 /* (1) not actually vectored; jumps to 0 */ +#define T_TEXTFAULT 0x01 /* (2) address fault during instr fetch */ +#define T_ILLINST 0x02 /* (3) illegal instruction */ +#define T_PRIVINST 0x03 /* (4) privileged instruction */ +#define T_FPDISABLED 0x04 /* (5) fp instr while fp disabled */ +#define T_WINOF 0x05 /* (6) register window overflow */ +#define T_WINUF 0x06 /* (7) register window underflow */ +#define T_ALIGN 0x07 /* (8) address not properly aligned */ +#define T_FPE 0x08 /* (9) floating point exception */ +#define T_DATAFAULT 0x09 /* (10) address fault during data fetch */ +#define T_TAGOF 0x0a /* (11) tag overflow */ +/* 0x0b unused */ +/* 0x0c unused */ +/* 0x0d unused */ +/* 0x0e unused */ +/* 0x0f unused */ +/* 0x10 unused */ +#define T_L1INT 0x11 /* (27) level 1 interrupt */ +#define T_L2INT 0x12 /* (26) level 2 interrupt */ +#define T_L3INT 0x13 /* (25) level 3 interrupt */ +#define T_L4INT 0x14 /* (24) level 4 interrupt */ +#define T_L5INT 0x15 /* (23) level 5 interrupt */ +#define T_L6INT 0x16 /* (22) level 6 interrupt */ +#define T_L7INT 0x17 /* (21) level 7 interrupt */ +#define T_L8INT 0x18 /* (20) level 8 interrupt */ +#define T_L9INT 0x19 /* (19) level 9 interrupt */ +#define T_L10INT 0x1a /* (18) level 10 interrupt */ +#define T_L11INT 0x1b /* (17) level 11 interrupt */ +#define T_L12INT 0x1c /* (16) level 12 interrupt */ +#define T_L13INT 0x1d /* (15) level 13 interrupt */ +#define T_L14INT 0x1e /* (14) level 14 interrupt */ +#define T_L15INT 0x1f /* (13) level 15 interrupt */ +/* 0x20 unused */ +/* through 0x23 unused */ +#define T_CPDISABLED 0x24 /* (5) coprocessor instr while disabled */ +#define T_UNIMPLFLUSH 0x25 /* Unimplemented FLUSH */ +/* through 0x27 unused */ +#define T_CPEXCEPTION 0x28 /* (9) coprocessor exception */ +/* 0x29 unused */ +#define T_IDIV0 0x2a /* divide by zero (from hw [su]div instr) */ +#define T_STOREBUFFAULT 0x2b /* SuperSPARC: Store buffer copy-back fault */ +/* 0x2c unused */ +/* through 0x7f unused */ + +/* beginning of `user' vectors (from trap instructions) - all priority 12 */ +#define T_SUN_SYSCALL 0x80 /* system call */ +#define T_BREAKPOINT 0x81 /* breakpoint `instruction' */ +#define T_DIV0 0x82 /* division routine was handed 0 */ +#define T_FLUSHWIN 0x83 /* flush windows */ +#define T_CLEANWIN 0x84 /* provide clean windows */ +#define T_RANGECHECK 0x85 /* ? */ +#define T_FIXALIGN 0x86 /* fix up unaligned accesses */ +#define T_INTOF 0x87 /* integer overflow ? */ +#define T_SVR4_SYSCALL 0x88 /* SVR4 system call */ +#define T_BSD_SYSCALL 0x89 /* BSD system call */ +#define T_KGDB_EXEC 0x8a /* for kernel gdb */ + +/* 0x8b..0xff are currently unallocated, except the following */ +#define T_SVR4_GETCC 0xa0 +#define T_SVR4_SETCC 0xa1 +#define T_SVR4_GETPSR 0xa2 +#define T_SVR4_SETPSR 0xa3 +#define T_SVR4_GETHRTIME 0xa4 +#define T_SVR4_GETHRVTIME 0xa5 +#define T_SVR4_GETHRESTIME 0xa7 + + +#ifdef _KERNEL /* pseudo traps for locore.s */ +#define T_RWRET -1 /* need first user window for trap return */ +#define T_AST -2 /* no-op, just needed reschedule or profile */ +#endif + +/* flags to system call (flags in %g1 along with syscall number) */ +#define SYSCALL_G2RFLAG 0x400 /* on success, return to %g2 rather than npc */ +#define SYSCALL_G7RFLAG 0x800 /* use %g7 as above (deprecated) */ + +/* + * `software trap' macros to keep people happy (sparc v8 manual says not + * to set the upper bits). + */ +#define ST_BREAKPOINT (T_BREAKPOINT & 0x7f) +#define ST_DIV0 (T_DIV0 & 0x7f) +#define ST_FLUSHWIN (T_FLUSHWIN & 0x7f) +#define ST_SYSCALL (T_SUN_SYSCALL & 0x7f) + +#endif /* _MACHINE_TRAP_H_ */ diff --git a/klibc/klibc/arch/sparc/setjmp.S b/klibc/klibc/arch/sparc/setjmp.S new file mode 100644 index 0000000000..f41ee2bf12 --- /dev/null +++ b/klibc/klibc/arch/sparc/setjmp.S @@ -0,0 +1,38 @@ +! +! setjmp.S +! +! Basic setjmp/longjmp +! +! This code was based on the equivalent code in NetBSD +! + +#include +#include + +! +! The jmp_buf contains the following entries: +! sp +! fp +! pc +! +ENTRY(setjmp) + st %sp,[%o0+0] ! Callers stack pointer + st %o7,[%o0+4] ! Return pc + st %fp,[%o0+8] ! Frame pointer + retl ! Return + clr %o0 ! ...0 + +ENTRY(longjmp) + sub %sp, 64, %sp ! set up a local stack frame +0: + t ST_FLUSHWIN ! flush register windows out to memory + ! + ! We restore the saved stack pointer to %fp, then issue + ! a restore instruction which will reload the register + ! window from the stack. + ! + ld [%o0+4], %o7 /* restore return pc */ + ld [%o0+0], %fp /* and stack pointer */ + + retl ! success, return %g6 + restore %o1, 0, %o0 diff --git a/klibc/klibc/arch/sparc/smul.S b/klibc/klibc/arch/sparc/smul.S new file mode 100644 index 0000000000..0eb218bbe8 --- /dev/null +++ b/klibc/klibc/arch/sparc/smul.S @@ -0,0 +1,160 @@ +/* $NetBSD: mul.S,v 1.3 1997/07/16 14:37:42 christos Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Header: mul.s,v 1.5 92/06/25 13:24:03 torek Exp + */ + +#include +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 + .asciz "@(#)mul.s 8.1 (Berkeley) 6/4/93" +#else + RCSID("$NetBSD: mul.S,v 1.3 1997/07/16 14:37:42 christos Exp $") +#endif +#endif /* LIBC_SCCS and not lint */ + +/* + * Signed multiply, from Appendix E of the Sparc Version 8 + * Architecture Manual. + * + * Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the upper 32 bits of + * the 64-bit product). + * + * This code optimizes short (less than 13-bit) multiplies. + */ + +FUNC(.mul) + mov %o0, %y ! multiplier -> Y + andncc %o0, 0xfff, %g0 ! test bits 12..31 + be Lmul_shortway ! if zero, can do it the short way + andcc %g0, %g0, %o4 ! zero the partial product and clear N and V + + /* + * Long multiply. 32 steps, followed by a final shift step. + */ + mulscc %o4, %o1, %o4 ! 1 + mulscc %o4, %o1, %o4 ! 2 + mulscc %o4, %o1, %o4 ! 3 + mulscc %o4, %o1, %o4 ! 4 + mulscc %o4, %o1, %o4 ! 5 + mulscc %o4, %o1, %o4 ! 6 + mulscc %o4, %o1, %o4 ! 7 + mulscc %o4, %o1, %o4 ! 8 + mulscc %o4, %o1, %o4 ! 9 + mulscc %o4, %o1, %o4 ! 10 + mulscc %o4, %o1, %o4 ! 11 + mulscc %o4, %o1, %o4 ! 12 + mulscc %o4, %o1, %o4 ! 13 + mulscc %o4, %o1, %o4 ! 14 + mulscc %o4, %o1, %o4 ! 15 + mulscc %o4, %o1, %o4 ! 16 + mulscc %o4, %o1, %o4 ! 17 + mulscc %o4, %o1, %o4 ! 18 + mulscc %o4, %o1, %o4 ! 19 + mulscc %o4, %o1, %o4 ! 20 + mulscc %o4, %o1, %o4 ! 21 + mulscc %o4, %o1, %o4 ! 22 + mulscc %o4, %o1, %o4 ! 23 + mulscc %o4, %o1, %o4 ! 24 + mulscc %o4, %o1, %o4 ! 25 + mulscc %o4, %o1, %o4 ! 26 + mulscc %o4, %o1, %o4 ! 27 + mulscc %o4, %o1, %o4 ! 28 + mulscc %o4, %o1, %o4 ! 29 + mulscc %o4, %o1, %o4 ! 30 + mulscc %o4, %o1, %o4 ! 31 + mulscc %o4, %o1, %o4 ! 32 + mulscc %o4, %g0, %o4 ! final shift + + ! If %o0 was negative, the result is + ! (%o0 * %o1) + (%o1 << 32)) + ! We fix that here. + + tst %o0 + bge 1f + rd %y, %o0 + + ! %o0 was indeed negative; fix upper 32 bits of result by subtracting + ! %o1 (i.e., return %o4 - %o1 in %o1). + retl + sub %o4, %o1, %o1 + +1: + retl + mov %o4, %o1 + +Lmul_shortway: + /* + * Short multiply. 12 steps, followed by a final shift step. + * The resulting bits are off by 12 and (32-12) = 20 bit positions, + * but there is no problem with %o0 being negative (unlike above). + */ + mulscc %o4, %o1, %o4 ! 1 + mulscc %o4, %o1, %o4 ! 2 + mulscc %o4, %o1, %o4 ! 3 + mulscc %o4, %o1, %o4 ! 4 + mulscc %o4, %o1, %o4 ! 5 + mulscc %o4, %o1, %o4 ! 6 + mulscc %o4, %o1, %o4 ! 7 + mulscc %o4, %o1, %o4 ! 8 + mulscc %o4, %o1, %o4 ! 9 + mulscc %o4, %o1, %o4 ! 10 + mulscc %o4, %o1, %o4 ! 11 + mulscc %o4, %o1, %o4 ! 12 + mulscc %o4, %g0, %o4 ! final shift + + /* + * %o4 has 20 of the bits that should be in the low part of the + * result; %y has the bottom 12 (as %y's top 12). That is: + * + * %o4 %y + * +----------------+----------------+ + * | -12- | -20- | -12- | -20- | + * +------(---------+------)---------+ + * --hi-- ----low-part---- + * + * The upper 12 bits of %o4 should be sign-extended to form the + * high part of the product (i.e., highpart = %o4 >> 20). + */ + + rd %y, %o5 + sll %o4, 12, %o0 ! shift middle bits left 12 + srl %o5, 20, %o5 ! shift low bits right 20, zero fill at left + or %o5, %o0, %o0 ! construct low part of result + retl + sra %o4, 20, %o1 ! ... and extract high part of result diff --git a/klibc/klibc/arch/sparc/umul.S b/klibc/klibc/arch/sparc/umul.S new file mode 100644 index 0000000000..6a7193d217 --- /dev/null +++ b/klibc/klibc/arch/sparc/umul.S @@ -0,0 +1,193 @@ +/* $NetBSD: umul.S,v 1.3 1997/07/16 14:37:44 christos Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * from: Header: umul.s,v 1.4 92/06/25 13:24:05 torek Exp + */ + +#include +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 + .asciz "@(#)umul.s 8.1 (Berkeley) 6/4/93" +#else + RCSID("$NetBSD: umul.S,v 1.3 1997/07/16 14:37:44 christos Exp $") +#endif +#endif /* LIBC_SCCS and not lint */ + +/* + * Unsigned multiply. Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the + * upper 32 bits of the 64-bit product). + * + * This code optimizes short (less than 13-bit) multiplies. Short + * multiplies require 25 instruction cycles, and long ones require + * 45 instruction cycles. + * + * On return, overflow has occurred (%o1 is not zero) if and only if + * the Z condition code is clear, allowing, e.g., the following: + * + * call .umul + * nop + * bnz overflow (or tnz) + */ + +FUNC(.umul) + or %o0, %o1, %o4 + mov %o0, %y ! multiplier -> Y + andncc %o4, 0xfff, %g0 ! test bits 12..31 of *both* args + be Lmul_shortway ! if zero, can do it the short way + andcc %g0, %g0, %o4 ! zero the partial product and clear N and V + + /* + * Long multiply. 32 steps, followed by a final shift step. + */ + mulscc %o4, %o1, %o4 ! 1 + mulscc %o4, %o1, %o4 ! 2 + mulscc %o4, %o1, %o4 ! 3 + mulscc %o4, %o1, %o4 ! 4 + mulscc %o4, %o1, %o4 ! 5 + mulscc %o4, %o1, %o4 ! 6 + mulscc %o4, %o1, %o4 ! 7 + mulscc %o4, %o1, %o4 ! 8 + mulscc %o4, %o1, %o4 ! 9 + mulscc %o4, %o1, %o4 ! 10 + mulscc %o4, %o1, %o4 ! 11 + mulscc %o4, %o1, %o4 ! 12 + mulscc %o4, %o1, %o4 ! 13 + mulscc %o4, %o1, %o4 ! 14 + mulscc %o4, %o1, %o4 ! 15 + mulscc %o4, %o1, %o4 ! 16 + mulscc %o4, %o1, %o4 ! 17 + mulscc %o4, %o1, %o4 ! 18 + mulscc %o4, %o1, %o4 ! 19 + mulscc %o4, %o1, %o4 ! 20 + mulscc %o4, %o1, %o4 ! 21 + mulscc %o4, %o1, %o4 ! 22 + mulscc %o4, %o1, %o4 ! 23 + mulscc %o4, %o1, %o4 ! 24 + mulscc %o4, %o1, %o4 ! 25 + mulscc %o4, %o1, %o4 ! 26 + mulscc %o4, %o1, %o4 ! 27 + mulscc %o4, %o1, %o4 ! 28 + mulscc %o4, %o1, %o4 ! 29 + mulscc %o4, %o1, %o4 ! 30 + mulscc %o4, %o1, %o4 ! 31 + mulscc %o4, %o1, %o4 ! 32 + mulscc %o4, %g0, %o4 ! final shift + + + /* + * Normally, with the shift-and-add approach, if both numbers are + * positive you get the correct result. WIth 32-bit two's-complement + * numbers, -x is represented as + * + * x 32 + * ( 2 - ------ ) mod 2 * 2 + * 32 + * 2 + * + * (the `mod 2' subtracts 1 from 1.bbbb). To avoid lots of 2^32s, + * we can treat this as if the radix point were just to the left + * of the sign bit (multiply by 2^32), and get + * + * -x = (2 - x) mod 2 + * + * Then, ignoring the `mod 2's for convenience: + * + * x * y = xy + * -x * y = 2y - xy + * x * -y = 2x - xy + * -x * -y = 4 - 2x - 2y + xy + * + * For signed multiplies, we subtract (x << 32) from the partial + * product to fix this problem for negative multipliers (see mul.s). + * Because of the way the shift into the partial product is calculated + * (N xor V), this term is automatically removed for the multiplicand, + * so we don't have to adjust. + * + * But for unsigned multiplies, the high order bit wasn't a sign bit, + * and the correction is wrong. So for unsigned multiplies where the + * high order bit is one, we end up with xy - (y << 32). To fix it + * we add y << 32. + */ + tst %o1 + bl,a 1f ! if %o1 < 0 (high order bit = 1), + add %o4, %o0, %o4 ! %o4 += %o0 (add y to upper half) +1: rd %y, %o0 ! get lower half of product + retl + addcc %o4, %g0, %o1 ! put upper half in place and set Z for %o1==0 + +Lmul_shortway: + /* + * Short multiply. 12 steps, followed by a final shift step. + * The resulting bits are off by 12 and (32-12) = 20 bit positions, + * but there is no problem with %o0 being negative (unlike above), + * and overflow is impossible (the answer is at most 24 bits long). + */ + mulscc %o4, %o1, %o4 ! 1 + mulscc %o4, %o1, %o4 ! 2 + mulscc %o4, %o1, %o4 ! 3 + mulscc %o4, %o1, %o4 ! 4 + mulscc %o4, %o1, %o4 ! 5 + mulscc %o4, %o1, %o4 ! 6 + mulscc %o4, %o1, %o4 ! 7 + mulscc %o4, %o1, %o4 ! 8 + mulscc %o4, %o1, %o4 ! 9 + mulscc %o4, %o1, %o4 ! 10 + mulscc %o4, %o1, %o4 ! 11 + mulscc %o4, %o1, %o4 ! 12 + mulscc %o4, %g0, %o4 ! final shift + + /* + * %o4 has 20 of the bits that should be in the result; %y has + * the bottom 12 (as %y's top 12). That is: + * + * %o4 %y + * +----------------+----------------+ + * | -12- | -20- | -12- | -20- | + * +------(---------+------)---------+ + * -----result----- + * + * The 12 bits of %o4 left of the `result' area are all zero; + * in fact, all top 20 bits of %o4 are zero. + */ + + rd %y, %o5 + sll %o4, 12, %o0 ! shift middle bits left 12 + srl %o5, 20, %o5 ! shift low bits right 20 + or %o5, %o0, %o0 + retl + addcc %g0, %g0, %o1 ! %o1 = zero, and set Z diff --git a/klibc/klibc/arch/sparc64/MCONFIG b/klibc/klibc/arch/sparc64/MCONFIG new file mode 100644 index 0000000000..d490c63643 --- /dev/null +++ b/klibc/klibc/arch/sparc64/MCONFIG @@ -0,0 +1,21 @@ +# -*- makefile -*- +# +# arch/sparc64/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHREQFLAGS = -m64 -mptr64 +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 64 + +LDFLAGS = -m elf64_sparc + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# Normal binaries start at 1 MB; the linker wants 1 MB alignment, +# and call instructions have a 30-bit signed offset, << 2. +SHAREDFLAGS = -Ttext 0x80000200 diff --git a/klibc/klibc/arch/sparc64/Makefile.inc b/klibc/klibc/arch/sparc64/Makefile.inc new file mode 100644 index 0000000000..d59f9878e9 --- /dev/null +++ b/klibc/klibc/arch/sparc64/Makefile.inc @@ -0,0 +1,13 @@ +# -*- makefile -*- +# +# arch/sparc64/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + arch/$(ARCH)/setjmp.o + +archclean: diff --git a/klibc/klibc/arch/sparc64/crt0.S b/klibc/klibc/arch/sparc64/crt0.S new file mode 100644 index 0000000000..23af82ecc4 --- /dev/null +++ b/klibc/klibc/arch/sparc64/crt0.S @@ -0,0 +1,2 @@ +#define TARGET_PTR_SIZE 64 +#include "arch/sparc/crt0i.S" diff --git a/klibc/klibc/arch/sparc64/include/klibc/archsetjmp.h b/klibc/klibc/arch/sparc64/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..022a31e542 --- /dev/null +++ b/klibc/klibc/arch/sparc64/include/klibc/archsetjmp.h @@ -0,0 +1,16 @@ +/* + * arch/sparc64/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __sp; + unsigned long __fp; + unsigned long __pc; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/sparc64/include/klibc/archsys.h b/klibc/klibc/arch/sparc64/include/klibc/archsys.h new file mode 100644 index 0000000000..651e4f7f09 --- /dev/null +++ b/klibc/klibc/arch/sparc64/include/klibc/archsys.h @@ -0,0 +1,157 @@ +/* + * arch/sparc64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* The Linux 2.5.31 SPARC64 syscall macros are just plain broken */ + +#undef _syscall0 +#undef _syscall1 +#undef _syscall2 +#undef _syscall3 +#undef _syscall4 +#undef _syscall5 +#undef _syscall6 + +#define _syscall0(type,name) \ +type name (void) \ +{ \ + register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ + register unsigned long __ret __asm__("o0"); \ + __asm__ __volatile__ ("t 0x6d\n\t" \ + "bcs,a %%xcc, 1f\n\t" \ + " st %0,%1\n\t" \ + "1:" \ + "movcs %%xcc,-1,%0\n" \ + : "=&r" (__ret), "+m" (errno) \ + : "r" (__g1) \ + : "cc"); \ + return (type) __ret; \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name (type1 arg1) \ +{ \ + register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ + register unsigned long __ret __asm__("o0"); \ + type1 __o0 = (arg1); \ + __asm__ __volatile__ ("t 0x6d\n\t" \ + "bcs,a %%xcc, 1f\n\t" \ + " st %0,%1\n\t" \ + "1:" \ + "movcs %%xcc,-1,%0\n" \ + : "=&r" (__ret), "+m" (errno) \ + : "0" (__o0), "r" (__g1) \ + : "cc"); \ + return (type) __ret; \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name (type1 arg1,type2 arg2) \ +{ \ + register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ + register unsigned long __ret __asm__("o0"); \ + type1 __o0 = (arg1); \ + register type2 __o1 __asm__ ("o1") = (arg2); \ + __asm__ __volatile__ ("t 0x6d\n\t" \ + "bcs,a %%xcc, 1f\n\t" \ + " st %0,%1\n\t" \ + "1:" \ + "movcs %%xcc,-1,%0\n" \ + : "=&r" (__ret), "+m" (errno) \ + : "0" (__o0), "r" (__o1), "r" (__g1) \ + : "cc"); \ + return (type) __ret; \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name (type1 arg1,type2 arg2,type3 arg3) \ +{ \ + register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ + register unsigned long __ret __asm__("o0"); \ + type1 __o0 = (arg1); \ + register type2 __o1 __asm__ ("o1") = (arg2); \ + register type3 __o2 __asm__ ("o2") = (arg3); \ + __asm__ __volatile__ ("t 0x6d\n\t" \ + "bcs,a %%xcc, 1f\n\t" \ + " st %0,%1\n\t" \ + "1:" \ + "movcs %%xcc,-1,%0\n" \ + : "=&r" (__ret), "+m" (errno) \ + : "0" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \ + : "cc"); \ + return (type) __ret; \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ +{ \ + register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ + register unsigned long __ret __asm__("o0"); \ + type1 __o0 = (arg1); \ + register type2 __o1 __asm__ ("o1") = (arg2); \ + register type3 __o2 __asm__ ("o2") = (arg3); \ + register type4 __o3 __asm__ ("o3") = (arg4); \ + __asm__ __volatile__ ("t 0x6d\n\t" \ + "bcs,a %%xcc, 1f\n\t" \ + " st %0,%1\n\t" \ + "1:" \ + "movcs %%xcc,-1,%0\n" \ + : "=&r" (__ret), "+m" (errno) \ + : "0" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \ + : "cc"); \ + return (type) __ret; \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,\ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ + register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ + register unsigned long __ret __asm__("o0"); \ + type1 __o0 = (arg1); \ + register type2 __o1 __asm__ ("o1") = (arg2); \ + register type3 __o2 __asm__ ("o2") = (arg3); \ + register type4 __o3 __asm__ ("o3") = (arg4); \ + register type5 __o4 __asm__ ("o4") = (arg5); \ + __asm__ __volatile__ ("t 0x6d\n\t" \ + "bcs,a %%xcc, 1f\n\t" \ + " st %0,%1\n\t" \ + "1:" \ + "movcs %%xcc,-1,%0\n" \ + : "=&r" (__ret), "+m" (errno) \ + : "0" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), \ + "r" (__g1) \ + : "cc"); \ + return (type) __ret; \ +} + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ + register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ + register unsigned long __ret __asm__("o0"); \ + type1 __o0 = (arg1); \ + register type2 __o1 __asm__ ("o1") = (arg2); \ + register type3 __o2 __asm__ ("o2") = (arg3); \ + register type4 __o3 __asm__ ("o3") = (arg4); \ + register type5 __o4 __asm__ ("o4") = (arg5); \ + register type6 __o5 __asm__ ("o5") = (arg6); \ + __asm__ __volatile__ ("t 0x6d\n\t" \ + "bcs,a %%xcc, 1f\n\t" \ + " st %0,%1\n\t" \ + "1:" \ + "movcs %%xcc,-1,%0\n" \ + : "=&r" (__ret), "+m" (errno) \ + : "0" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), \ + "r" (__o5), "r" (__g1) \ + : "cc"); \ + return (type) __ret; \ +} + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/sparc64/setjmp.S b/klibc/klibc/arch/sparc64/setjmp.S new file mode 100644 index 0000000000..b04d47faab --- /dev/null +++ b/klibc/klibc/arch/sparc64/setjmp.S @@ -0,0 +1,55 @@ +! +! setjmp.S +! +! Basic setjmp/longjmp +! +! This code was based on the equivalent code in NetBSD +! + +! +! The jmp_buf contains the following entries: +! sp +! fp +! pc +! + .text + .align 4 + .global setjmp + .type setjmp, @function +setjmp: + stx %sp,[%o0+0] ! Callers stack pointer + stx %o7,[%o0+8] ! Return pc + stx %fp,[%o0+16] ! Frame pointer + retl ! Return + clr %o0 ! ...0 + + .size setjmp,.-setjmp + + + .globl longjmp + .type longjmp, @function +longjmp: + mov %o1, %g4 ! save return value + mov %o0, %g1 ! save target + ldx [%g1+16],%g5 ! get callers frame +1: + cmp %fp, %g5 ! compare against desired frame + bl,a 1b ! if below... + restore ! pop frame and loop + be,a 2f ! if there... + ldx [%g1+0],%o2 ! fetch return %sp + +.Lbotch: + unimp 0 ! ... error ... + +2: + cmp %o2, %sp ! %sp must not decrease + bl .Lbotch + nop + mov %o2, %sp ! it is OK, put it in place + + ldx [%g1+8],%o3 ! fetch %pc + jmp %o3 + 8 ! if sucess... + mov %g4,%o0 ! return %g4 + + .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/x86_64/MCONFIG b/klibc/klibc/arch/x86_64/MCONFIG new file mode 100644 index 0000000000..ecb14ccb70 --- /dev/null +++ b/klibc/klibc/arch/x86_64/MCONFIG @@ -0,0 +1,16 @@ +# -*- makefile -*- +# +# arch/x86-64/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# +# Blatantly copied and modified from i386 version by Mats Petersson, AMD. +# + +ARCHREQFLAGS = -m64 +OPTFLAGS = -Os -fomit-frame-pointer -falign-functions=0 -falign-jumps=0 -falign-loops=0 +BITSIZE = 64 +LDFLAGS = -m elf_x86_64 + diff --git a/klibc/klibc/arch/x86_64/Makefile.inc b/klibc/klibc/arch/x86_64/Makefile.inc new file mode 100644 index 0000000000..c84443f4e1 --- /dev/null +++ b/klibc/klibc/arch/x86_64/Makefile.inc @@ -0,0 +1,16 @@ +# -*- makefile -*- +# +# arch/x86_64/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + arch/$(ARCH)/exits.o \ + arch/$(ARCH)/setjmp.o + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + +archclean: diff --git a/klibc/klibc/arch/x86_64/crt0.S b/klibc/klibc/arch/x86_64/crt0.S new file mode 100644 index 0000000000..c562708d0f --- /dev/null +++ b/klibc/klibc/arch/x86_64/crt0.S @@ -0,0 +1,22 @@ +# +# arch/x86_64/crt0.S +# +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. +# + + .text + .align 4 + .type _start,@function + .globl _start +_start: + movq %rsp,%rdi # Offset of the ELF data structure + movq %rdx,%rsi # The atexit() pointer (if any) + call __libc_init + # We should never get here... + hlt + + .size _start,.-_start diff --git a/klibc/klibc/arch/x86_64/exits.S b/klibc/klibc/arch/x86_64/exits.S new file mode 100644 index 0000000000..618f4fb585 --- /dev/null +++ b/klibc/klibc/arch/x86_64/exits.S @@ -0,0 +1,35 @@ +# +# exit and _exit get included in *every* program, and gcc generates +# horrible code for them. Yes, this only saves a few bytes, but +# it does it in every program. +# + +#include + + .data + .align 8 + .globl __exit_handler + .type __exit_handler,@object +__exit_handler: + .quad _exit + .size __exit_handler,8 + + .text + .align 8 + .globl exit + .type exit,@function +exit: + jmp *(__exit_handler) + .size exit,.-exit + + /* No need to save any registers... we're exiting! */ + .text + .align 4 + .globl _exit + .type _exit,@function +_exit: + movl $__NR_exit,%eax + /* The argument is already in %rdi */ + syscall + .size _exit,.-exit + diff --git a/klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h b/klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..90d0a0d263 --- /dev/null +++ b/klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h @@ -0,0 +1,21 @@ +/* + * arch/x86_64/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __rbx; + unsigned long __rsp; + unsigned long __rbp; + unsigned long __r12; + unsigned long __r13; + unsigned long __r14; + unsigned long __r15; + unsigned long __rip; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/x86_64/include/klibc/archsys.h b/klibc/klibc/arch/x86_64/include/klibc/archsys.h new file mode 100644 index 0000000000..3bd8b0a5d9 --- /dev/null +++ b/klibc/klibc/arch/x86_64/include/klibc/archsys.h @@ -0,0 +1,32 @@ +/* + * arch/x86_64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* x86-64 seems to miss _syscall6() from its headers */ + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ +long __res; \ +register type4 __r10 asm("%r10") = arg4; \ +register type5 __r8 asm("%r8") = arg5; \ +register type6 __r9 asm("%r9") = arg6; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ + "d" (arg3),"r" (__r10),"r" (__r8), "r" (__r9) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#endif /* _syscall6 missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/x86_64/setjmp.S b/klibc/klibc/arch/x86_64/setjmp.S new file mode 100644 index 0000000000..45f547b404 --- /dev/null +++ b/klibc/klibc/arch/x86_64/setjmp.S @@ -0,0 +1,54 @@ +# +# arch/x86_64/setjmp.S +# +# setjmp/longjmp for the x86-64 architecture +# + +# +# The jmp_buf is assumed to contain the following, in order: +# %rbx +# %rsp (post-return) +# %rbp +# %r12 +# %r13 +# %r14 +# %r15 +# +# + + .text + .align 4 + .globl setjmp + .type setjmp, @function +setjmp: + pop %rsi # Return address, and adjust the stack + xorl %eax,%eax # Return value + movq %rbx,(%rdi) + movq %rsp,8(%rdi) # Post-return %rsp! + push %rsi # Make the call/return stack happy + movq %rbp,16(%rdi) + movq %r12,24(%rdi) + movq %r13,32(%rdi) + movq %r14,40(%rdi) + movq %r15,48(%rdi) + movq %rsi,56(%rdi) # Return address + ret + + .size setjmp,.-setjmp + + .text + .align 4 + .globl longjmp + .type longjmp, @function +longjmp: + movl %esi,%eax # Return value (int) + movq (%rdi),%rbx + movq 8(%rdi),%rsp + movq 16(%rdi),%rbp + movq 24(%rdi),%r12 + movq 32(%rdi),%r13 + movq 40(%rdi),%r14 + movq 48(%rdi),%r15 + jmp *56(%rdi) + + .size longjmp,.-longjmp diff --git a/klibc/klibc/assert.c b/klibc/klibc/assert.c new file mode 100644 index 0000000000..6d3ff238c9 --- /dev/null +++ b/klibc/klibc/assert.c @@ -0,0 +1,13 @@ +/* + * assert.c + */ + +#include +#include +#include + +void __assert_fail(const char *expr, const char *file, unsigned int line) +{ + printf("Assertion %s failed, file %s, line %u\n", expr, file, line); + abort(); +} diff --git a/klibc/klibc/atexit.c b/klibc/klibc/atexit.c new file mode 100644 index 0000000000..078dd8b211 --- /dev/null +++ b/klibc/klibc/atexit.c @@ -0,0 +1,10 @@ +/* + * atexit.c + */ + +#include + +int atexit(void (*fctn)(void)) +{ + return on_exit((void (*)(int, void *))fctn, NULL); +} diff --git a/klibc/klibc/atexit.h b/klibc/klibc/atexit.h new file mode 100644 index 0000000000..a60d641e23 --- /dev/null +++ b/klibc/klibc/atexit.h @@ -0,0 +1,19 @@ +/* + * atexit.h + * + * atexit()/on_exit() internal definitions + */ + +#ifndef ATEXIT_H +#define ATEXIT_H + +struct atexit { + void (*fctn)(int, void *); + void *arg; /* on_exit() parameter */ + struct atexit *next; +}; + +extern struct atexit *__atexit_list; + +#endif /* ATEXIT_H */ + diff --git a/klibc/klibc/atoi.c b/klibc/klibc/atoi.c new file mode 100644 index 0000000000..a6ec0bf778 --- /dev/null +++ b/klibc/klibc/atoi.c @@ -0,0 +1,3 @@ +#define TYPE int +#define NAME atoi +#include "atox.c" diff --git a/klibc/klibc/atol.c b/klibc/klibc/atol.c new file mode 100644 index 0000000000..e65484e7f1 --- /dev/null +++ b/klibc/klibc/atol.c @@ -0,0 +1,3 @@ +#define TYPE long +#define NAME atol +#include "atox.c" diff --git a/klibc/klibc/atoll.c b/klibc/klibc/atoll.c new file mode 100644 index 0000000000..25df79e1bf --- /dev/null +++ b/klibc/klibc/atoll.c @@ -0,0 +1,3 @@ +#define TYPE long long +#define NAME atoll +#include "atox.c" diff --git a/klibc/klibc/atox.c b/klibc/klibc/atox.c new file mode 100644 index 0000000000..56f8d93b40 --- /dev/null +++ b/klibc/klibc/atox.c @@ -0,0 +1,14 @@ +/* + * atox.c + * + * atoi(), atol(), atoll() + */ + +#include +#include +#include + +TYPE NAME (const char *nptr) +{ + return (TYPE) strntoumax(nptr, (char **)NULL, 10, ~(size_t)0); +} diff --git a/klibc/klibc/brk.c b/klibc/klibc/brk.c new file mode 100644 index 0000000000..0a08c4e1c5 --- /dev/null +++ b/klibc/klibc/brk.c @@ -0,0 +1,24 @@ +/* brk.c - Change data segment size */ + +/* Written 2000 by Werner Almesberger */ + + +#include +#include +#include + +char *__current_brk; /* Common with sbrk.c */ + +/* + * The Linux brk() isn't what most people expect, so we call the + * system call __brk() and provide a wrapper. + */ +int brk(void *end_data_segment) +{ + char *new_brk; + + new_brk = __brk(end_data_segment); + if (new_brk != end_data_segment) return -1; + __current_brk = new_brk; + return 0; +} diff --git a/klibc/klibc/bsd_signal.c b/klibc/klibc/bsd_signal.c new file mode 100644 index 0000000000..9acc867a36 --- /dev/null +++ b/klibc/klibc/bsd_signal.c @@ -0,0 +1,11 @@ +/* + * bsd_signal.c + */ + +#include + +__sighandler_t bsd_signal(int signum, __sighandler_t handler) +{ + /* BSD signal() semantics */ + return __signal(signum, handler, SA_RESTART); +} diff --git a/klibc/klibc/calloc.c b/klibc/klibc/calloc.c new file mode 100644 index 0000000000..228a1b70e4 --- /dev/null +++ b/klibc/klibc/calloc.c @@ -0,0 +1,21 @@ +/* + * calloc.c + */ + +#include +#include + +/* FIXME: This should look for multiplication overflow */ + +void *calloc(size_t nmemb, size_t size) +{ + void *ptr; + + size *= nmemb; + ptr = malloc(size); + if ( ptr ) + memset(ptr, 0, size); + + return ptr; +} + diff --git a/klibc/klibc/closelog.c b/klibc/klibc/closelog.c new file mode 100644 index 0000000000..2359d4f92b --- /dev/null +++ b/klibc/klibc/closelog.c @@ -0,0 +1,18 @@ +/* + * closelog.c + */ + +#include +#include + +extern int __syslog_fd; + +void closelog(void) +{ + int logfd = __syslog_fd; + + if ( logfd != -1 ) { + close(logfd); + __syslog_fd = -1; + } +} diff --git a/klibc/klibc/creat.c b/klibc/klibc/creat.c new file mode 100644 index 0000000000..9bd22172d4 --- /dev/null +++ b/klibc/klibc/creat.c @@ -0,0 +1,12 @@ +/* + * creat.c + */ + +#include +#include +#include + +int creat(const char *pathname, mode_t mode) +{ + return open(pathname, O_CREAT|O_WRONLY|O_TRUNC, mode); +} diff --git a/klibc/klibc/ctypes.c b/klibc/klibc/ctypes.c new file mode 100644 index 0000000000..a9398b8071 --- /dev/null +++ b/klibc/klibc/ctypes.c @@ -0,0 +1,281 @@ +/* + * ctypes.c + * + * This is the array that defines classes. + * This assumes ISO 8859-1. + */ + +#include + +const unsigned char __ctypes[257] = { + 0, /* EOF */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + __ctype_space, /* BS */ + __ctype_space, /* TAB */ + __ctype_space, /* LF */ + __ctype_space, /* VT */ + __ctype_space, /* FF */ + __ctype_space, /* CR */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + + __ctype_space|__ctype_print, /* space */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ + __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ + __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ + __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ + __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ + __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_upper|__ctype_print, /* G-Z */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ + __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ + __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ + __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ + __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ + __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_lower|__ctype_print, /* g-z */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + 0, /* control character */ + + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + 0, /* control character */ + + __ctype_space|__ctype_print, /* NBSP */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_punct, /* punctuation */ + + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_upper|__ctype_print, /* upper accented */ + __ctype_lower|__ctype_print, /* lower accented */ + + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ + __ctype_lower|__ctype_print, /* lower accented */ +}; diff --git a/klibc/klibc/exec_l.c b/klibc/klibc/exec_l.c new file mode 100644 index 0000000000..cdae11e981 --- /dev/null +++ b/klibc/klibc/exec_l.c @@ -0,0 +1,57 @@ +/* + * exec_l.c + * + * Common implementation of execl() execle() execlp() + */ + +#include +#include +#include + +int NAME (const char *path, const char *arg0, ...) +{ + va_list ap, cap; + int argc = 1, rv; + const char **argv, **argp; + const char *arg; +#if EXEC_E + char * const * envp; +#else +#define envp environ +#endif + + va_start(ap, arg0); + va_copy(cap, ap); + + /* Count the number of arguments */ + do { + arg = va_arg(cap, const char *); + argc++; + } while ( arg ); + + va_end(cap); + + /* Allocate memory for the pointer array */ + argp = argv = alloca(argc*sizeof(const char *)); + if ( !argv ) { + va_end(ap); + return -1; + } + + /* Copy the list into an array */ + *argp++ = arg0; + do { + *argp++ = arg = va_arg(ap, const char *); + } while ( arg ); + +#if EXEC_E + /* execle() takes one more argument for the environment pointer */ + envp = va_arg(ap, char * const *); +#endif + + rv = (EXEC_P ? execvpe : execve)(path, (char * const *)argv, envp); + + va_end(ap); + + return rv; +} diff --git a/klibc/klibc/execl.c b/klibc/klibc/execl.c new file mode 100644 index 0000000000..4581113ba5 --- /dev/null +++ b/klibc/klibc/execl.c @@ -0,0 +1,8 @@ +/* + * execl.c + */ + +#define NAME execl +#define EXEC_P 0 +#define EXEC_E 0 +#include "exec_l.c" diff --git a/klibc/klibc/execle.c b/klibc/klibc/execle.c new file mode 100644 index 0000000000..b073988835 --- /dev/null +++ b/klibc/klibc/execle.c @@ -0,0 +1,8 @@ +/* + * execle.c + */ + +#define NAME execle +#define EXEC_P 0 +#define EXEC_E 1 +#include "exec_l.c" diff --git a/klibc/klibc/execlp.c b/klibc/klibc/execlp.c new file mode 100644 index 0000000000..65c9aa4a7a --- /dev/null +++ b/klibc/klibc/execlp.c @@ -0,0 +1,8 @@ +/* + * execlp.c + */ + +#define NAME execlp +#define EXEC_P 1 +#define EXEC_E 0 +#include "exec_l.c" diff --git a/klibc/klibc/execlpe.c b/klibc/klibc/execlpe.c new file mode 100644 index 0000000000..fef972fcb3 --- /dev/null +++ b/klibc/klibc/execlpe.c @@ -0,0 +1,8 @@ +/* + * execlpe.c + */ + +#define NAME execlpe +#define EXEC_P 1 +#define EXEC_E 1 +#include "exec_l.c" diff --git a/klibc/klibc/execv.c b/klibc/klibc/execv.c new file mode 100644 index 0000000000..9856b76d87 --- /dev/null +++ b/klibc/klibc/execv.c @@ -0,0 +1,13 @@ +/* + * execv.c + */ + +#include +#include + +int execv(const char *path, char * const * argv) +{ + return execve(path, argv, environ); +} + + diff --git a/klibc/klibc/execvp.c b/klibc/klibc/execvp.c new file mode 100644 index 0000000000..b1065ee47e --- /dev/null +++ b/klibc/klibc/execvp.c @@ -0,0 +1,13 @@ +/* + * execvp.c + */ + +#include +#include + +int execvp(const char *path, char * const * argv) +{ + return execvpe(path, argv, environ); +} + + diff --git a/klibc/klibc/execvpe.c b/klibc/klibc/execvpe.c new file mode 100644 index 0000000000..afd791ab43 --- /dev/null +++ b/klibc/klibc/execvpe.c @@ -0,0 +1,73 @@ +/* + * execvpe.c + * + * execvpe() function (from which we build execlp, execlpe, execvp). + * + * This version of execvpe() will *not* spawn /bin/sh if the command + * return ENOEXEC. That's what #! is for, folks! + * + * Since execlpe() and execvpe() aren't in POSIX, nor in glibc, + * I have followed QNX precedent in the implementation of the PATH: + * the PATH that is used is the one in the current environment, not + * in the new environment. + */ + +#include +#include +#include +#include +#include + +#define DEFAULT_PATH "/bin:/usr/bin:." + +int execvpe(const char *file, char * const *argv, char * const *envp) +{ + char path[PATH_MAX]; + const char *searchpath, *esp; + size_t prefixlen, filelen, totallen; + + if ( strchr(file, '/') ) /* Specific path */ + return execve(file, argv, envp); + + filelen = strlen(file); + + searchpath = getenv("PATH"); + if ( !searchpath ) + searchpath = DEFAULT_PATH; + + errno = ENOENT; /* Default errno, if execve() doesn't change it */ + + do { + esp = strchr(searchpath, ':'); + if ( esp ) + prefixlen = esp-searchpath; + else + prefixlen = strlen(searchpath); + + if ( prefixlen == 0 || searchpath[prefixlen-1] == '/' ) { + totallen = prefixlen+filelen; + if ( totallen >= PATH_MAX ) + continue; + memcpy(path, searchpath, prefixlen); + memcpy(path+prefixlen, file, filelen); + } else { + totallen = prefixlen+filelen+1; + if ( totallen >= PATH_MAX ) + continue; + memcpy(path, searchpath, prefixlen); + path[prefixlen] = '/'; + memcpy(path+prefixlen+1, file, filelen); + } + path[totallen] = '\0'; + + execve(path, argv, envp); + if ( errno == E2BIG || errno == ENOEXEC || + errno == ENOMEM || errno == ETXTBSY ) + break; /* Report this as an error, no more search */ + + searchpath = esp+1; + } while ( esp ); + + return -1; +} + diff --git a/klibc/klibc/exitc.c b/klibc/klibc/exitc.c new file mode 100644 index 0000000000..6e5d78979d --- /dev/null +++ b/klibc/klibc/exitc.c @@ -0,0 +1,36 @@ +/* + * exit.c + * + * Note: all programs need exit(), since it's invoked from + * crt0.o. Therefore there is no point in breaking apart + * exit() and _exit(). + */ + +#include +#include +#include + +/* We have an assembly version for i386 and x86-64 */ + +#if !defined(__i386__) && !defined(__x86_64__) + +#define __NR___exit __NR_exit + +/* Syscalls can't return void... */ +static inline _syscall1(int,__exit,int,rv); + +/* This allows atexit/on_exit to install a hook */ +__noreturn (*__exit_handler)(int) = _exit; + +__noreturn exit(int rv) +{ + __exit_handler(rv); +} + +__noreturn _exit(int rv) +{ + __exit(rv); + for(;;); +} + +#endif diff --git a/klibc/klibc/fdatasync.c b/klibc/klibc/fdatasync.c new file mode 100644 index 0000000000..53079b09d6 --- /dev/null +++ b/klibc/klibc/fdatasync.c @@ -0,0 +1,15 @@ +/* + * fdatasync.c + * + * Some systems don't have this (alpha?) ... this is really a bug, + * but mimic using fsync() + */ + +#include +#include + +#ifndef __NR_fdatasync +#define __NR_fdatasync __NR_fsync +#endif + +_syscall1(int,fdatasync,int,fd); diff --git a/klibc/klibc/fgetc.c b/klibc/klibc/fgetc.c new file mode 100644 index 0000000000..83eee16f61 --- /dev/null +++ b/klibc/klibc/fgetc.c @@ -0,0 +1,20 @@ +/* + * fgetc.c + * + * Extremely slow fgetc implementation, using _fread(). If people + * actually need character-oriented input to be fast, we may actually + * have to implement buffering. Sigh. + */ + +#include +#include +#include +#include + +int fgetc(FILE *f) +{ + unsigned char ch; + + return (_fread(&ch, 1, f) == 1) ? (int)ch : EOF; +} + diff --git a/klibc/klibc/fgets.c b/klibc/klibc/fgets.c new file mode 100644 index 0000000000..88a145a63f --- /dev/null +++ b/klibc/klibc/fgets.c @@ -0,0 +1,33 @@ +/* + * fgets.c + * + * This will be very slow due to the implementation of getc(), + * but we can't afford to drain characters we don't need from + * the input. + */ + +#include + +char *fgets(char *s, int n, FILE *f) +{ + int ch; + char *p = s; + + while ( n > 1 ) { + ch = getc(f); + if ( ch == EOF ) { + *p = '\0'; + return NULL; + } + *p++ = ch; + if ( ch == '\n' ) + break; + } + if ( n ) + *p = '\0'; + + return s; +} + + + diff --git a/klibc/klibc/fopen.c b/klibc/klibc/fopen.c new file mode 100644 index 0000000000..5c84184809 --- /dev/null +++ b/klibc/klibc/fopen.c @@ -0,0 +1,46 @@ +/* + * fopen.c + */ + +#include +#include +#include + +/* This depends on O_RDONLY == 0, O_WRONLY == 1, O_RDWR == 2 */ + + +FILE *fopen(const char *file, const char *mode) +{ + int flags = O_RDONLY; + int plus = 0; + int fd; + + while ( *mode ) { + switch ( *mode ) { + case 'r': + flags = O_RDONLY; + break; + case 'w': + flags = O_WRONLY|O_CREAT|O_TRUNC; + break; + case 'a': + flags = O_WRONLY|O_CREAT|O_APPEND; + break; + case '+': + plus = 1; + break; + } + mode++; + } + + if ( plus ) { + flags = (flags & ~(O_RDONLY|O_WRONLY)) | O_RDWR; + } + + fd = open(file, flags, 0666); + + if ( fd < 0 ) + return NULL; + else + return fdopen(fd, mode); +} diff --git a/klibc/klibc/fork.c b/klibc/klibc/fork.c new file mode 100644 index 0000000000..d7e4db89a1 --- /dev/null +++ b/klibc/klibc/fork.c @@ -0,0 +1,29 @@ +/* + * fork.c + * + * This is normally just a syscall stub, but at least one system + * doesn't have sys_fork, only sys_clone... + */ + +#include +#include +#include + +#ifdef __NR_fork + +#ifdef _syscall0_forkish +_syscall0_forkish(pid_t,fork); +#else +_syscall0(pid_t,fork); +#endif + +#else /* __NR_fork */ + +static inline _syscall2(pid_t,clone,unsigned long,flags,void *,newsp); + +pid_t fork(void) +{ + return clone(SIGCHLD, 0); +} + +#endif /* __NR_fork */ diff --git a/klibc/klibc/fprintf.c b/klibc/klibc/fprintf.c new file mode 100644 index 0000000000..df3823eac3 --- /dev/null +++ b/klibc/klibc/fprintf.c @@ -0,0 +1,19 @@ +/* + * fprintf.c + */ + +#include +#include + +#define BUFFER_SIZE 16384 + +int fprintf(FILE *file, const char *format, ...) +{ + va_list ap; + int rv; + + va_start(ap, format); + rv = vfprintf(file, format, ap); + va_end(ap); + return rv; +} diff --git a/klibc/klibc/fputc.c b/klibc/klibc/fputc.c new file mode 100644 index 0000000000..61aff1644b --- /dev/null +++ b/klibc/klibc/fputc.c @@ -0,0 +1,14 @@ +/* + * fputc.c + * + * gcc "printf decompilation" expects this to exist... + */ + +#include + +int fputc(int c, FILE *f) +{ + unsigned char ch = c; + + return _fwrite(&ch, 1, f) == 1 ? ch : EOF; +} diff --git a/klibc/klibc/fputs.c b/klibc/klibc/fputs.c new file mode 100644 index 0000000000..4b68f96886 --- /dev/null +++ b/klibc/klibc/fputs.c @@ -0,0 +1,15 @@ +/* + * fputs.c + * + * This isn't quite fputs() in the stdio sense, since we don't + * have stdio, but it takes a file descriptor argument instead + * of the FILE *. + */ + +#include +#include + +int fputs(const char *s, FILE *file) +{ + return _fwrite(s, strlen(s), file); +} diff --git a/klibc/klibc/fread.c b/klibc/klibc/fread.c new file mode 100644 index 0000000000..8f7dba9c19 --- /dev/null +++ b/klibc/klibc/fread.c @@ -0,0 +1,35 @@ +/* + * fread.c + */ + +#include +#include +#include + +size_t _fread(void *buf, size_t count, FILE *f) +{ + size_t bytes = 0; + ssize_t rv; + char *p = buf; + + while ( count ) { + rv = read(fileno(f), p, count); + if ( rv == -1 ) { + if ( errno == EINTR ) + continue; + else + break; + } else if ( rv == 0 ) { + break; + } + + p += rv; + bytes += rv; + count -= rv; + } + + return bytes; +} + + + diff --git a/klibc/klibc/fread2.c b/klibc/klibc/fread2.c new file mode 100644 index 0000000000..9e5ac81fc2 --- /dev/null +++ b/klibc/klibc/fread2.c @@ -0,0 +1,13 @@ +/* + * fread2.c + * + * The actual fread() function as a non-inline + */ + +#define __NO_FREAD_FWRITE_INLINES +#include + +size_t fread(void *ptr, size_t size, size_t nmemb, FILE *f) +{ + return _fread(ptr, size*nmemb, f)/size; +} diff --git a/klibc/klibc/fwrite.c b/klibc/klibc/fwrite.c new file mode 100644 index 0000000000..0a73188c67 --- /dev/null +++ b/klibc/klibc/fwrite.c @@ -0,0 +1,35 @@ +/* + * fwrite.c + */ + +#include +#include +#include + +size_t _fwrite(const void *buf, size_t count, FILE *f) +{ + size_t bytes = 0; + ssize_t rv; + const char *p = buf; + + while ( count ) { + rv = write(fileno(f), p, count); + if ( rv == -1 ) { + if ( errno == EINTR ) + continue; + else + break; + } else if ( rv == 0 ) { + break; + } + + p += rv; + bytes += rv; + count -= rv; + } + + return bytes; +} + + + diff --git a/klibc/klibc/fwrite2.c b/klibc/klibc/fwrite2.c new file mode 100644 index 0000000000..82ec832be4 --- /dev/null +++ b/klibc/klibc/fwrite2.c @@ -0,0 +1,13 @@ +/* + * fwrite2.c + * + * The actual fwrite() function as a non-inline + */ + +#define __NO_FREAD_FWRITE_INLINES +#include + +size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *f) +{ + return _fwrite(ptr, size*nmemb, f)/size; +} diff --git a/klibc/klibc/getcwd.c b/klibc/klibc/getcwd.c new file mode 100644 index 0000000000..350ec69a63 --- /dev/null +++ b/klibc/klibc/getcwd.c @@ -0,0 +1,15 @@ +/* + * getcwd.c + */ + +#include +#include + +#define __NR___getcwd __NR_getcwd +static inline _syscall2(int,__getcwd,char *,buf,size_t,size); + +char *getcwd(char *buf, size_t size) +{ + return ( __getcwd(buf, size) < 0 ) ? NULL : buf; +} + diff --git a/klibc/klibc/getdomainname.c b/klibc/klibc/getdomainname.c new file mode 100644 index 0000000000..4cd68a3cb5 --- /dev/null +++ b/klibc/klibc/getdomainname.c @@ -0,0 +1,25 @@ +/* + * getdomainname.c + */ + +#include +#include +#include +#include + +int getdomainname(char *name, size_t len) +{ + struct utsname un; + + if ( !uname(&un) ) + return -1; + + if ( len < strlen(un.domainname)+1 ) { + errno = EINVAL; + return -1; + } + + strcpy(name, un.domainname); + + return 0; +} diff --git a/klibc/klibc/getenv.c b/klibc/klibc/getenv.c new file mode 100644 index 0000000000..84fc94c00e --- /dev/null +++ b/klibc/klibc/getenv.c @@ -0,0 +1,22 @@ +/* + * getenv.c + */ + +#include +#include +#include + +char *getenv(const char *name) +{ + char **p, *q; + int len = strlen(name); + + for ( p = environ ; (q = *p) ; p++ ) { + if ( !strncmp(name, q, len) && q[len] == '=' ) { + return q+(len+1); + } + } + + return NULL; +} + diff --git a/klibc/klibc/gethostname.c b/klibc/klibc/gethostname.c new file mode 100644 index 0000000000..6c5062e816 --- /dev/null +++ b/klibc/klibc/gethostname.c @@ -0,0 +1,25 @@ +/* + * gethostname.c + */ + +#include +#include +#include +#include + +int gethostname(char *name, size_t len) +{ + struct utsname un; + + if ( !uname(&un) ) + return -1; + + if ( len < strlen(un.nodename)+1 ) { + errno = EINVAL; + return -1; + } + + strcpy(name, un.nodename); + + return 0; +} diff --git a/klibc/klibc/getopt.c b/klibc/klibc/getopt.c new file mode 100644 index 0000000000..5a992dcdd7 --- /dev/null +++ b/klibc/klibc/getopt.c @@ -0,0 +1,74 @@ +/* + * getopt.c + * + * Simple POSIX getopt(), no GNU extensions... + */ + +#include +#include +#include + +char *optarg; +int optind = 1; +int opterr, optopt; +static const char *__optptr; + +int getopt(int argc, char * const *argv, const char *optstring) +{ + const char *carg = argv[optind]; + const char *osptr; + int opt; + + /* We don't actually need argc */ + (void)argc; + + /* First, eliminate all non-option cases */ + + if ( !carg || carg[0] != '-' || !carg[1] ) { + return -1; + } + + if ( carg[1] == '-' && !carg[2] ) { + optind++; + return -1; + } + + if ( (uintptr_t)(__optptr-carg) > (uintptr_t)strlen(carg) ) + __optptr = carg+1; /* Someone frobbed optind, change to new opt. */ + + opt = *__optptr++; + + if ( opt != ':' && (osptr = strchr(optstring, opt)) ) { + if ( osptr[1] == ':' ) { + if ( *__optptr ) { + /* Argument-taking option with attached argument */ + optarg = (char *)__optptr; + optind++; + } else { + /* Argument-taking option with non-attached argument */ + if ( argv[optind+1] ) { + optarg = (char *)argv[optind+1]; + optind += 2; + } else { + /* Missing argument */ + return (optstring[0] == ':') ? ':' : '?'; + } + } + return opt; + } else { + /* Non-argument-taking option */ + /* __optptr will remember the exact position to resume at */ + if ( ! *__optptr ) + optind++; + return opt; + } + } else { + /* Unknown option */ + optopt = opt; + if ( ! *__optptr ) + optind++; + return '?'; + } +} + + diff --git a/klibc/klibc/getpriority.c b/klibc/klibc/getpriority.c new file mode 100644 index 0000000000..d6db2cc6b9 --- /dev/null +++ b/klibc/klibc/getpriority.c @@ -0,0 +1,25 @@ +/* + * getpriority.c + * + * Needs to do some post-syscall mangling to distinguish error returns... + * but only on some platforms. Sigh. + */ + +#include +#include +#include +#include + +#define __NR__getpriority __NR_getpriority + +static inline _syscall2(int,_getpriority,int,which,int,who); + +int getpriority(int which, int who) +{ +#if defined(__alpha__) || defined(__ia64__) + return _getpriority(which, who); +#else + int rv = _getpriority(which, who); + return ( rv < 0 ) ? rv : 20-rv; +#endif +} diff --git a/klibc/klibc/globals.c b/klibc/klibc/globals.c new file mode 100644 index 0000000000..72ae91fbad --- /dev/null +++ b/klibc/klibc/globals.c @@ -0,0 +1,10 @@ +/* + * globals.c + * + * These have to be defined somewhere... + */ +#include +#include + +int errno; +char **environ; diff --git a/klibc/klibc/include/alloca.h b/klibc/klibc/include/alloca.h new file mode 100644 index 0000000000..41a4d94d44 --- /dev/null +++ b/klibc/klibc/include/alloca.h @@ -0,0 +1,13 @@ +/* + * alloca.h + * + * Just call the builtin alloca() function + */ + +#ifndef _ALLOCA_H +#define _ALLOCA_H + +#define alloca(size) __builtin_alloca(size) + +#endif /* _ALLOCA_H */ + diff --git a/klibc/klibc/include/arpa/inet.h b/klibc/klibc/include/arpa/inet.h new file mode 100644 index 0000000000..043b148e17 --- /dev/null +++ b/klibc/klibc/include/arpa/inet.h @@ -0,0 +1,24 @@ +/* + * arpa/inet.h + */ + +#ifndef _ARPA_INET_H +#define _ARPA_INET_H + +#include +#include +#include +#include +#include + +__extern uint32_t inet_addr(const char *); +__extern int inet_aton(const char *, struct in_addr *); +__extern char *inet_ntoa(struct in_addr); +__extern int inet_pton(int, const char *, void *); +__extern const char *inet_ntop(int, const void *, char *, size_t); +__extern unsigned int inet_nsap_addr(const char *, unsigned char *, int); +__extern char *inet_nsap_ntoa(int, const unsigned char *, char *); + +#endif /* _ARPA_INET_H */ + + diff --git a/klibc/klibc/include/assert.h b/klibc/klibc/include/assert.h new file mode 100644 index 0000000000..58cc37c487 --- /dev/null +++ b/klibc/klibc/include/assert.h @@ -0,0 +1,22 @@ +/* + * assert.h + */ + +#ifndef _ASSERT_H +#define _ASSERT_H + +#ifdef NDEBUG + +#define assert(x) ((void)(x)) + +#else + +extern void __assert_fail(const char *, const char *, + unsigned int); + +#define assert(x) ((x) ? (void)0 : __assert_fail(#x, __FILE__, __LINE__)) + +#endif + +#endif /* _ASSERT_H */ + diff --git a/klibc/klibc/include/bits32/bitsize/limits.h b/klibc/klibc/include/bits32/bitsize/limits.h new file mode 100644 index 0000000000..f90e524b2b --- /dev/null +++ b/klibc/klibc/include/bits32/bitsize/limits.h @@ -0,0 +1,14 @@ +/* + * bits32/limits.h + */ + +#ifndef _BITSIZE_LIMITS_H +#define _BITSIZE_LIMITS_H + +#define LONG_BIT 32 + +#define LONG_MIN (-2147483647L-1) +#define LONG_MAX 2147483647L +#define ULONG_MAX 4294967295UL + +#endif /* _BITSIZE_LIMITS_H */ diff --git a/klibc/klibc/include/bits32/bitsize/stddef.h b/klibc/klibc/include/bits32/bitsize/stddef.h new file mode 100644 index 0000000000..bf6e695ed3 --- /dev/null +++ b/klibc/klibc/include/bits32/bitsize/stddef.h @@ -0,0 +1,18 @@ +/* + * bits32/stddef.h + */ + +#ifndef _BITSIZE_STDDEF_H +#define _BITSIZE_STDDEF_H + +#define _SIZE_T +#if (defined(__s390__) || defined(__hppa__) || defined(__cris__)) +typedef unsigned long size_t; +#else +typedef unsigned int size_t; +#endif + +#define _PTRDIFF_T +typedef signed int ptrdiff_t; + +#endif /* _BITSIZE_STDDEF_H */ diff --git a/klibc/klibc/include/bits32/bitsize/stdint.h b/klibc/klibc/include/bits32/bitsize/stdint.h new file mode 100644 index 0000000000..40b464961c --- /dev/null +++ b/klibc/klibc/include/bits32/bitsize/stdint.h @@ -0,0 +1,34 @@ +/* + * bits32/stdint.h + */ + +#ifndef _BITSIZE_STDINT_H +#define _BITSIZE_STDINT_H + +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long long int int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; + +typedef int int_fast16_t; +typedef int int_fast32_t; + +typedef unsigned int uint_fast16_t; +typedef unsigned int uint_fast32_t; + +typedef int intptr_t; +typedef unsigned int uintptr_t; + +#define __INT64_C(c) c ## LL +#define __UINT64_C(c) c ## ULL + +#define __PRI64_RANK "ll" +#define __PRIFAST_RANK "" +#define __PRIPTR_RANK "" + +#endif /* _BITSIZE_STDINT_H */ diff --git a/klibc/klibc/include/bits32/bitsize/stdintconst.h b/klibc/klibc/include/bits32/bitsize/stdintconst.h new file mode 100644 index 0000000000..8157dd06e0 --- /dev/null +++ b/klibc/klibc/include/bits32/bitsize/stdintconst.h @@ -0,0 +1,18 @@ +/* + * bits32/stdintconst.h + */ + +#ifndef _BITSIZE_STDINTCONST_H +#define _BITSIZE_STDINTCONST_H + +#define INT_FAST16_C(c) INT32_C(c) +#define INT_FAST32_C(c) INT32_C(c) + +#define UINT_FAST16_C(c) UINT32_C(c) +#define UINT_FAST32_C(c) UINT32_C(c) + +#define INTPTR_C(c) INT32_C(c) +#define UINTPTR_C(c) UINT32_C(c) +#define PTRDIFF_C(c) INT32_C(c) + +#endif /* _BITSIZE_STDINTCONST_H */ diff --git a/klibc/klibc/include/bits32/bitsize/stdintlimits.h b/klibc/klibc/include/bits32/bitsize/stdintlimits.h new file mode 100644 index 0000000000..b44fe01186 --- /dev/null +++ b/klibc/klibc/include/bits32/bitsize/stdintlimits.h @@ -0,0 +1,22 @@ +/* + * bits32/stdintlimits.h + */ + +#ifndef _BITSIZE_STDINTLIMITS_H +#define _BITSIZE_STDINTLIMITS_H + +#define INT_FAST16_MIN INT32_MIN +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST16_MAX INT32_MAX +#define INT_FAST32_MAX INT32_MAX +#define UINT_FAST16_MAX UINT32_MAX +#define UINT_FAST32_MAX UINT32_MAX + +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX + +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX + +#endif /* _BITSIZE_STDINTLIMITS_H */ diff --git a/klibc/klibc/include/bits64/bitsize/limits.h b/klibc/klibc/include/bits64/bitsize/limits.h new file mode 100644 index 0000000000..7b20da085b --- /dev/null +++ b/klibc/klibc/include/bits64/bitsize/limits.h @@ -0,0 +1,14 @@ +/* + * bits64/limits.h + */ + +#ifndef _BITSIZE_LIMITS_H +#define _BITSIZE_LIMITS_H + +#define LONG_BIT 64 + +#define LONG_MIN (-9223372036854775807L-1) +#define LONG_MAX 9223372036854775807L +#define ULONG_MAX 18446744073709551615UL + +#endif /* _BITSIZE_LIMITS_H */ diff --git a/klibc/klibc/include/bits64/bitsize/stddef.h b/klibc/klibc/include/bits64/bitsize/stddef.h new file mode 100644 index 0000000000..3e72621862 --- /dev/null +++ b/klibc/klibc/include/bits64/bitsize/stddef.h @@ -0,0 +1,13 @@ +/* + * bits64/stddef.h + */ + +#ifndef _BITSIZE_STDDEF_H +#define _BITSIZE_STDDEF_H + +#define _SIZE_T +typedef unsigned long size_t; +#define _PTRDIFF_T +typedef signed long ptrdiff_t; + +#endif /* _BITSIZE_STDDEF_H */ diff --git a/klibc/klibc/include/bits64/bitsize/stdint.h b/klibc/klibc/include/bits64/bitsize/stdint.h new file mode 100644 index 0000000000..f569f526b6 --- /dev/null +++ b/klibc/klibc/include/bits64/bitsize/stdint.h @@ -0,0 +1,36 @@ +/* + * bits64/stdint.h + */ + +#ifndef _BITSIZE_STDINT_H +#define _BITSIZE_STDINT_H + +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long long int int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long int uint64_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; + +typedef long int intptr_t; +typedef unsigned long int uintptr_t; + +#define __INT64_C(c) c ## L +#define __UINT64_C(c) c ## UL + +#define __PRI64_RANK "l" +#define __PRIFAST_RANK "l" +#define __PRIPTR_RANK "l" + +#endif /* _BITSIZE_STDINT_H */ + + diff --git a/klibc/klibc/include/bits64/bitsize/stdintconst.h b/klibc/klibc/include/bits64/bitsize/stdintconst.h new file mode 100644 index 0000000000..65f2db0501 --- /dev/null +++ b/klibc/klibc/include/bits64/bitsize/stdintconst.h @@ -0,0 +1,18 @@ +/* + * bits64/stdintconst.h + */ + +#ifndef _BITSIZE_STDINTCONST_H +#define _BITSIZE_STDINTCONST_H + +#define INT_FAST16_C(c) INT64_C(c) +#define INT_FAST32_C(c) INT64_C(c) + +#define UINT_FAST16_C(c) UINT64_C(c) +#define UINT_FAST32_C(c) UINT64_C(c) + +#define INTPTR_C(c) INT64_C(c) +#define UINTPTR_C(c) UINT64_C(c) +#define PTRDIFF_C(c) INT64_C(c) + +#endif /* _BITSIZE_STDINTCONST_H */ diff --git a/klibc/klibc/include/bits64/bitsize/stdintlimits.h b/klibc/klibc/include/bits64/bitsize/stdintlimits.h new file mode 100644 index 0000000000..d110d17d2d --- /dev/null +++ b/klibc/klibc/include/bits64/bitsize/stdintlimits.h @@ -0,0 +1,22 @@ +/* + * bits64/stdintlimits.h + */ + +#ifndef _BITSIZE_STDINTLIMITS_H +#define _BITSIZE_STDINTLIMITS_H + +#define INT_FAST16_MIN INT64_MIN +#define INT_FAST32_MIN INT64_MIN +#define INT_FAST16_MAX INT64_MAX +#define INT_FAST32_MAX INT64_MAX +#define UINT_FAST16_MAX UINT64_MAX +#define UINT_FAST32_MAX UINT64_MAX + +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX + +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX + +#endif /* _BITSIZE_STDINTLIMITS_H */ diff --git a/klibc/klibc/include/ctype.h b/klibc/klibc/include/ctype.h new file mode 100644 index 0000000000..2cb90a45d3 --- /dev/null +++ b/klibc/klibc/include/ctype.h @@ -0,0 +1,117 @@ +/* + * ctype.h + * + * This assumes ISO 8859-1, being a reasonable superset of ASCII. + */ + +#ifndef _CTYPE_H +#define _CTYPE_H + +#ifndef __CTYPE_NO_INLINE +# define __ctype_inline extern __inline__ +#else +# define __ctype_inline +#endif + +/* + * This relies on the following definitions: + * + * cntrl = !print + * alpha = upper|lower + * graph = punct|alpha|digit + * blank = '\t' || ' ' (per POSIX requirement) + */ +enum { + __ctype_upper = (1 << 0), + __ctype_lower = (1 << 1), + __ctype_digit = (1 << 2), + __ctype_xdigit = (1 << 3), + __ctype_space = (1 << 4), + __ctype_print = (1 << 5), + __ctype_punct = (1 << 6) +}; + +extern const unsigned char __ctypes[]; + +__ctype_inline int isalnum(int __c) +{ + return __ctypes[__c+1] & + (__ctype_upper|__ctype_lower|__ctype_digit); +} + +__ctype_inline int isalpha(int __c) +{ + return __ctypes[__c+1] & + (__ctype_upper|__ctype_lower); +} + +__ctype_inline int isascii(int __c) +{ + return !(__c & ~0x7f); +} + +__ctype_inline int isblank(int __c) +{ + return (__c == '\t') || (__c == ' '); +} + +__ctype_inline int iscntrl(int __c) +{ + return (__c >= 0) && !(__ctypes[__c+1] & __ctype_print); +} + +__ctype_inline int isdigit(int __c) +{ + return __ctypes[__c+1] & __ctype_digit; +} + +__ctype_inline int isgraph(int __c) +{ + return __ctypes[__c+1] & + (__ctype_upper|__ctype_lower|__ctype_digit|__ctype_punct); +} + +__ctype_inline int islower(int __c) +{ + return __ctypes[__c+1] & __ctype_lower; +} + +__ctype_inline int isprint(int __c) +{ + return __ctypes[__c+1] & __ctype_print; +} + +__ctype_inline int ispunct(int __c) +{ + return __ctypes[__c+1] & __ctype_punct; +} + +__ctype_inline int isspace(int __c) +{ + return __ctypes[__c+1] & __ctype_space; +} + +__ctype_inline int isupper(int __c) +{ + return __ctypes[__c+1] & __ctype_upper; +} + +__ctype_inline int isxdigit(int __c) +{ + return __ctypes[__c+1] & __ctype_xdigit; +} + +#define _toupper(__c) ((__c) & ~0x20) +#define _tolower(__c) ((__c) | 0x20) + +__ctype_inline int toupper(int __c) +{ + return islower(__c) ? _toupper(__c) : __c; +} + +__ctype_inline int tolower(int __c) +{ + return isupper(__c) ? _tolower(__c) : __c; +} + +#endif /* _CTYPE_H */ diff --git a/klibc/klibc/include/dirent.h b/klibc/klibc/include/dirent.h new file mode 100644 index 0000000000..10dd138ee5 --- /dev/null +++ b/klibc/klibc/include/dirent.h @@ -0,0 +1,20 @@ +/* + * dirent.h + */ + +#ifndef _DIRENT_H +#define _DIRENT_H + +#include +#include + +#ifndef __IO_DIR_DEFINED +struct _IO_dir; +#endif +typedef struct _IO_dir DIR; + +__extern DIR *opendir(const char *); +__extern struct dirent *readdir(DIR *); +__extern int closedir(DIR *); + +#endif /* _DIRENT_H */ diff --git a/klibc/klibc/include/elf.h b/klibc/klibc/include/elf.h new file mode 100644 index 0000000000..bd0f3e7f9b --- /dev/null +++ b/klibc/klibc/include/elf.h @@ -0,0 +1,12 @@ +/* + * elf.h + */ + +#ifndef _ELF_H +#define _ELF_H + +#include +#include + +#endif /* _ELF_H */ + diff --git a/klibc/klibc/include/endian.h b/klibc/klibc/include/endian.h new file mode 100644 index 0000000000..10dbbd8a89 --- /dev/null +++ b/klibc/klibc/include/endian.h @@ -0,0 +1,41 @@ +/* + * endian.h + */ + +#ifndef _ENDIAN_H +#define _ENDIAN_H + +#include + +/* Linux' asm/byteorder.h defines either __LITTLE_ENDIAN or + __BIG_ENDIAN, but the glibc/BSD-ish macros expect both to be + defined with __BYTE_ORDER defining which is actually used... */ + +#if defined(__LITTLE_ENDIAN) +# undef __LITTLE_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __LITTLE_ENDIAN +#elif defined(__BIG_ENDIAN) +# undef __BIG_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __BIG_ENDIAN +#elif defined(__PDP_ENDIAN) +# undef __PDP_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __PDP_ENDIAN +#else +# error "Unknown byte order!" +#endif + +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define BIG_ENDIAN __BIG_ENDIAN +#define PDP_ENDIAN __PDP_ENDIAN +#define BYTE_ORDER __BYTE_ORDER + +#endif /* _ENDIAN_H */ diff --git a/klibc/klibc/include/errno.h b/klibc/klibc/include/errno.h new file mode 100644 index 0000000000..b2e666504d --- /dev/null +++ b/klibc/klibc/include/errno.h @@ -0,0 +1,8 @@ +/* + * errno.h + */ + +#include +#include + +__extern int errno; diff --git a/klibc/klibc/include/fcntl.h b/klibc/klibc/include/fcntl.h new file mode 100644 index 0000000000..e90959c7e9 --- /dev/null +++ b/klibc/klibc/include/fcntl.h @@ -0,0 +1,11 @@ +/* + * fcntl.h + */ + +#ifndef _FCNTL_H +#define _FCNTL_H + +#include +#include + +#endif /* _FCNTL_H */ diff --git a/klibc/klibc/include/grp.h b/klibc/klibc/include/grp.h new file mode 100644 index 0000000000..03ceb31560 --- /dev/null +++ b/klibc/klibc/include/grp.h @@ -0,0 +1,13 @@ +/* + * grp.h + */ + +#ifndef _GRP_H +#define _GRP_H + +#include +#include + +__extern int setgroups(size_t, const gid_t *); + +#endif /* _GRP_H */ diff --git a/klibc/klibc/include/inttypes.h b/klibc/klibc/include/inttypes.h new file mode 100644 index 0000000000..e00fa63160 --- /dev/null +++ b/klibc/klibc/include/inttypes.h @@ -0,0 +1,226 @@ +/* + * inttypes.h + */ + +#ifndef _INTTYPES_H +#define _INTTYPES_H + +#include +#include +#include + +static __inline__ intmax_t imaxabs(intmax_t __n) +{ + return (__n < (intmax_t)0) ? -__n : __n; +} + +__extern intmax_t strtoimax(const char *, char **, int); +__extern uintmax_t strtoumax(const char *, char **, int); + +/* extensions */ +__extern intmax_t strntoimax(const char *, char **, int, size_t); +__extern uintmax_t strntoumax(const char *, char **, int, size_t); + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) + +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 __PRI64_RANK "d" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "d" +#define PRIdLEAST64 __PRI64_RANK "d" + +#define PRIdFAST8 "d" +#define PRIdFAST16 __PRIFAST_RANK "d" +#define PRIdFAST32 __PRIFAST_RANK "d" +#define PRIdFAST64 __PRI64_RANK "d" + +#define PRIdMAX __PRI64_RANK "d" +#define PRIdPTR __PRIPTR_RANK "d" + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 __PRI64_RANK "i" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "i" +#define PRIiLEAST64 __PRI64_RANK "i" + +#define PRIiFAST8 "i" +#define PRIiFAST16 __PRIFAST_RANK "i" +#define PRIiFAST32 __PRIFAST_RANK "i" +#define PRIiFAST64 __PRI64_RANK "i" + +#define PRIiMAX __PRI64_RANK "i" +#define PRIiPTR __PRIPTR_RANK "i" + +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 __PRI64_RANK "o" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "o" +#define PRIoLEAST64 __PRI64_RANK "o" + +#define PRIoFAST8 "o" +#define PRIoFAST16 __PRIFAST_RANK "o" +#define PRIoFAST32 __PRIFAST_RANK "o" +#define PRIoFAST64 __PRI64_RANK "o" + +#define PRIoMAX __PRI64_RANK "o" +#define PRIoPTR __PRIPTR_RANK "o" + +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 __PRI64_RANK "u" + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "u" +#define PRIuLEAST64 __PRI64_RANK "u" + +#define PRIuFAST8 "u" +#define PRIuFAST16 __PRIFAST_RANK "u" +#define PRIuFAST32 __PRIFAST_RANK "u" +#define PRIuFAST64 __PRI64_RANK "u" + +#define PRIuMAX __PRI64_RANK "u" +#define PRIuPTR __PRIPTR_RANK "u" + +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 __PRI64_RANK "x" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "x" +#define PRIxLEAST64 __PRI64_RANK "x" + +#define PRIxFAST8 "x" +#define PRIxFAST16 __PRIFAST_RANK "x" +#define PRIxFAST32 __PRIFAST_RANK "x" +#define PRIxFAST64 __PRI64_RANK "x" + +#define PRIxMAX __PRI64_RANK "x" +#define PRIxPTR __PRIPTR_RANK "x" + +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 __PRI64_RANK "X" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "X" +#define PRIXLEAST64 __PRI64_RANK "X" + +#define PRIXFAST8 "X" +#define PRIXFAST16 __PRIFAST_RANK "X" +#define PRIXFAST32 __PRIFAST_RANK "X" +#define PRIXFAST64 __PRI64_RANK "X" + +#define PRIXMAX __PRI64_RANK "X" +#define PRIXPTR __PRIPTR_RANK "X" + +#define SCNd8 "hhd" +#define SCNd16 "hd" +#define SCNd32 "d" +#define SCNd64 __PRI64_RANK "d" + +#define SCNdLEAST8 "hhd" +#define SCNdLEAST16 "hd" +#define SCNdLEAST32 "d" +#define SCNdLEAST64 __PRI64_RANK "d" + +#define SCNdFAST8 "hhd" +#define SCNdFAST16 __PRIFAST_RANK "d" +#define SCNdFAST32 __PRIFAST_RANK "d" +#define SCNdFAST64 __PRI64_RANK "d" + +#define SCNdMAX __PRI64_RANK "d" +#define SCNdPTR __PRIPTR_RANK "d" + +#define SCNi8 "hhi" +#define SCNi16 "hi" +#define SCNi32 "i" +#define SCNi64 __PRI64_RANK "i" + +#define SCNiLEAST8 "hhi" +#define SCNiLEAST16 "hi" +#define SCNiLEAST32 "i" +#define SCNiLEAST64 __PRI64_RANK "i" + +#define SCNiFAST8 "hhi" +#define SCNiFAST16 __PRIFAST_RANK "i" +#define SCNiFAST32 __PRIFAST_RANK "i" +#define SCNiFAST64 __PRI64_RANK "i" + +#define SCNiMAX __PRI64_RANK "i" +#define SCNiPTR __PRIPTR_RANK "i" + +#define SCNo8 "hho" +#define SCNo16 "ho" +#define SCNo32 "o" +#define SCNo64 __PRI64_RANK "o" + +#define SCNoLEAST8 "hho" +#define SCNoLEAST16 "ho" +#define SCNoLEAST32 "o" +#define SCNoLEAST64 __PRI64_RANK "o" + +#define SCNoFAST8 "hho" +#define SCNoFAST16 __PRIFAST_RANK "o" +#define SCNoFAST32 __PRIFAST_RANK "o" +#define SCNoFAST64 __PRI64_RANK "o" + +#define SCNoMAX __PRI64_RANK "o" +#define SCNoPTR __PRIPTR_RANK "o" + +#define SCNu8 "hhu" +#define SCNu16 "hu" +#define SCNu32 "u" +#define SCNu64 __PRI64_RANK "u" + +#define SCNuLEAST8 "hhu" +#define SCNuLEAST16 "hu" +#define SCNuLEAST32 "u" +#define SCNuLEAST64 __PRI64_RANK "u" + +#define SCNuFAST8 "hhu" +#define SCNuFAST16 __PRIFAST_RANK "u" +#define SCNuFAST32 __PRIFAST_RANK "u" +#define SCNuFAST64 __PRI64_RANK "u" + +#define SCNuMAX __PRI64_RANK "u" +#define SCNuPTR __PRIPTR_RANK "u" + +#define SCNx8 "hhx" +#define SCNx16 "hx" +#define SCNx32 "x" +#define SCNx64 __PRI64_RANK "x" + +#define SCNxLEAST8 "hhx" +#define SCNxLEAST16 "hx" +#define SCNxLEAST32 "x" +#define SCNxLEAST64 __PRI64_RANK "x" + +#define SCNxFAST8 "hhx" +#define SCNxFAST16 __PRIFAST_RANK "x" +#define SCNxFAST32 __PRIFAST_RANK "x" +#define SCNxFAST64 __PRI64_RANK "x" + +#define SCNxMAX __PRI64_RANK "x" +#define SCNxPTR __PRIPTR_RANK "x" + +#endif + +#endif /* _INTTYPES_H */ diff --git a/klibc/klibc/include/klibc/compiler.h b/klibc/klibc/include/klibc/compiler.h new file mode 100644 index 0000000000..5c284b206c --- /dev/null +++ b/klibc/klibc/include/klibc/compiler.h @@ -0,0 +1,61 @@ +/* + * klibc/compiler.h + * + * Various compiler features + */ + +#ifndef _KLIBC_COMPILER_H +#define _KLIBC_COMPILER_H + +/* Specific calling conventions */ +#ifdef __i386__ +# ifdef __GNUC__ +# define __cdecl __attribute__((cdecl,regparm(0))) +# else + /* Most other C compilers have __cdecl as a keyword */ +# endif +#endif + +/* How to declare a function that *must* be inlined */ +#ifdef __GNUC__ +# if __GNUC_MAJOR__ >= 3 +# define __must_inline static __inline__ __attribute__((always_inline)) +# else +# define __must_inline extern __inline__ +# endif +#else +# define __must_inline inline /* Just hope this works... */ +#endif + +/* How to declare a function that does not return */ +#ifdef __GNUC__ +# define __noreturn void __attribute__((noreturn)) +#else +# define __noreturn void +#endif + +/* How to declare a "constant" function (a function in the + mathematical sense) */ +#ifdef __GNUC__ +# define __constfunc __attribute__((const)) +#else +# define __constfunc +#endif + +/* Format attribute */ +#ifdef __GNUC__ +# define __formatfunc(t,f,a) __attribute__((format(t,f,a))) +#else +# define __formatfunc(t,f,a) +#endif + +/* likely/unlikely */ +#if defined(__GNUC__) && (__GNUC_MAJOR__ > 2 || (__GNUC_MAJOR__ == 2 && __GNUC_MINOR__ >= 95)) +# define __likely(x) __builtin_expect((x), 1) +# define __unlikely(x) __builtin_expect((x), 0) +#else +# define __likely(x) (x) +# define __unlikely(x) (x) +#endif + +#endif diff --git a/klibc/klibc/include/klibc/diverr.h b/klibc/klibc/include/klibc/diverr.h new file mode 100644 index 0000000000..4d8c8d36c2 --- /dev/null +++ b/klibc/klibc/include/klibc/diverr.h @@ -0,0 +1,16 @@ +/* + * klibc/diverr.h + */ + +#ifndef _KLIBC_DIVERR_H +#define _KLIBC_DIVERR_H + +#include + +static __inline__ void +__divide_error(void) +{ + raise(SIGFPE); +} + +#endif /* _KLIBC_DIVERR_H */ diff --git a/klibc/klibc/include/klibc/extern.h b/klibc/klibc/include/klibc/extern.h new file mode 100644 index 0000000000..f9c3467211 --- /dev/null +++ b/klibc/klibc/include/klibc/extern.h @@ -0,0 +1,14 @@ +/* + * klibc/extern.h + */ + +#ifndef _KLIBC_EXTERN_H +#define _KLIBC_EXTERN_H + +#ifdef __cplusplus +#define __extern extern "C" +#else +#define __extern extern +#endif + +#endif /* _KLIBC_EXTERN_H */ diff --git a/klibc/klibc/include/limits.h b/klibc/klibc/include/limits.h new file mode 100644 index 0000000000..f1532e5323 --- /dev/null +++ b/klibc/klibc/include/limits.h @@ -0,0 +1,40 @@ +/* + * limits.h + */ + +#ifndef _LIMITS_H +#define _LIMITS_H + +#define CHAR_BIT 8 +#define SHRT_BIT 16 +#define INT_BIT 32 +#define LONGLONG_BIT 64 + +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 +#define UCHAR_MAX 255 + +#ifdef __CHAR_UNSIGNED__ +# define CHAR_MIN 0 +# define CHAR_MAX UCHAR_MAX +#else +# define CHAR_MIN SCHAR_MIN +# define CHAR_MAX SCHAR_MAX +#endif + +#define SHRT_MIN (-32768) +#define SHRT_MAX 32767 +#define USHRT_MAX 65535 + +#define INT_MIN (-2147483647-1) +#define INT_MAX 2147483647 +#define UINT_MAX 4294967295U + +#define LONGLONG_MIN (-9223372036854775807LL-1) +#define LONGLONG_MAX 9223372036854775807LL +#define ULONGLONG_MAX 18446744073709551615ULL + +#include +#include + +#endif /* _LIMITS_H */ diff --git a/klibc/klibc/include/net/if.h b/klibc/klibc/include/net/if.h new file mode 100644 index 0000000000..1aa8e7b90c --- /dev/null +++ b/klibc/klibc/include/net/if.h @@ -0,0 +1 @@ +#include diff --git a/klibc/klibc/include/net/if_arp.h b/klibc/klibc/include/net/if_arp.h new file mode 100644 index 0000000000..a25f1b4759 --- /dev/null +++ b/klibc/klibc/include/net/if_arp.h @@ -0,0 +1 @@ +#include diff --git a/klibc/klibc/include/net/if_ether.h b/klibc/klibc/include/net/if_ether.h new file mode 100644 index 0000000000..060ef22070 --- /dev/null +++ b/klibc/klibc/include/net/if_ether.h @@ -0,0 +1 @@ +#include diff --git a/klibc/klibc/include/net/if_packet.h b/klibc/klibc/include/net/if_packet.h new file mode 100644 index 0000000000..b5e8e0e11f --- /dev/null +++ b/klibc/klibc/include/net/if_packet.h @@ -0,0 +1 @@ +#include diff --git a/klibc/klibc/include/netinet/in.h b/klibc/klibc/include/netinet/in.h new file mode 100644 index 0000000000..92dc843bb1 --- /dev/null +++ b/klibc/klibc/include/netinet/in.h @@ -0,0 +1,33 @@ +/* + * netinet/in.h + */ + +#ifndef _NETINET_IN_H +#define _NETINET_IN_H + +/* added this include by Mats Petersson */ +#include + +#include +#include +#include /* Must be included *before* */ +#include + +#ifndef htons +# define htons(x) __cpu_to_be16(x) +#endif +#ifndef ntohs +# define ntohs(x) __be16_to_cpu(x) +#endif +#ifndef htonl +# define htonl(x) __cpu_to_be32(x) +#endif +#ifndef ntohl +# define ntohl(x) __be32_to_cpu(x) +#endif + +#define IPPORT_RESERVED 1024 + +__extern int bindresvport (int sd, struct sockaddr_in *sin); + +#endif /* _NETINET_IN_H */ diff --git a/klibc/klibc/include/netinet/in6.h b/klibc/klibc/include/netinet/in6.h new file mode 100644 index 0000000000..46584ca627 --- /dev/null +++ b/klibc/klibc/include/netinet/in6.h @@ -0,0 +1,10 @@ +/* + * netinet/in6.h + */ + +#ifndef _NETINET_IN6_H +#define _NETINET_IN6_H + +#include + +#endif /* _NETINET_IN6_H */ diff --git a/klibc/klibc/include/netinet/ip.h b/klibc/klibc/include/netinet/ip.h new file mode 100644 index 0000000000..8aecbe66a3 --- /dev/null +++ b/klibc/klibc/include/netinet/ip.h @@ -0,0 +1,13 @@ +/* + * netinet/ip.h + */ + +#ifndef _NETINET_IP_H +#define _NETINET_IP_H + +#include +#include + +#define IP_DF 0x4000 /* Flag: "Don't Fragment" */ + +#endif /* _NETINET_IP_H */ diff --git a/klibc/klibc/include/netinet/tcp.h b/klibc/klibc/include/netinet/tcp.h new file mode 100644 index 0000000000..bb5d307e98 --- /dev/null +++ b/klibc/klibc/include/netinet/tcp.h @@ -0,0 +1,11 @@ +/* + * netinet/tcp.h + */ + +#ifndef _NETINET_TCP_H +#define _NETINET_TCP_H + +#include /* Include *before* linux/tcp.h */ +#include + +#endif /* _NETINET_TCP_H */ diff --git a/klibc/klibc/include/netinet/udp.h b/klibc/klibc/include/netinet/udp.h new file mode 100644 index 0000000000..b809b4ee6e --- /dev/null +++ b/klibc/klibc/include/netinet/udp.h @@ -0,0 +1,19 @@ +/* + * netinet/udp.h + */ + +#ifndef _NETINET_UDP_H +#define _NETINET_UDP_H + +/* + * We would include linux/udp.h, but it brings in too much other stuff + */ + +struct udphdr { + __u16 source; + __u16 dest; + __u16 len; + __u16 check; +}; + +#endif /* _NETINET_UDP_H */ diff --git a/klibc/klibc/include/poll.h b/klibc/klibc/include/poll.h new file mode 100644 index 0000000000..8710d92ebd --- /dev/null +++ b/klibc/klibc/include/poll.h @@ -0,0 +1,16 @@ +/* + * poll.h + */ + +#ifndef _POLL_H +#define _POLL_H + +#include +#include + +/* POSIX specifies "int" for the timeout, Linux seems to use long... */ + +typedef unsigned int nfds_t; +__extern int poll(struct pollfd *, nfds_t, long); + +#endif /* _POLL_H */ diff --git a/klibc/klibc/include/sched.h b/klibc/klibc/include/sched.h new file mode 100644 index 0000000000..5e6103965f --- /dev/null +++ b/klibc/klibc/include/sched.h @@ -0,0 +1,23 @@ +/* + * sched.h + */ + +#ifndef _SCHED_H +#define _SCHED_H + +#include + +/* linux/sched.h is unusable; put the declarations we need here... */ + +#define SCHED_NORMAL 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 + +struct sched_param { + int sched_priority; +}; + +__extern int sched_setschedule(pid_t, int, const struct sched_param *); +__extern int sched_yield(void); + +#endif /* _SCHED_H */ diff --git a/klibc/klibc/include/setjmp.h b/klibc/klibc/include/setjmp.h new file mode 100644 index 0000000000..b504eb6d08 --- /dev/null +++ b/klibc/klibc/include/setjmp.h @@ -0,0 +1,43 @@ +/* + * setjmp.h + */ + +#ifndef _SETJMP_H +#define _SETJMP_H + +#include +#include +#include +#include + +#include + +__extern int setjmp(jmp_buf); +__extern __noreturn longjmp(jmp_buf, int); + +/* + Whose bright idea was it to add unrelated functionality to just about + the only function in the standard C library (setjmp) which cannot be + wrapped by an ordinary function wrapper? Anyway, the damage is done, + and therefore, this wrapper *must* be inline. However, gcc will + complain if this is an inline function for unknown reason, and + therefore sigsetjmp() needs to be a macro. +*/ + +struct __sigjmp_buf { + jmp_buf __jmpbuf; + sigset_t __sigs; +}; + +typedef struct __sigjmp_buf sigjmp_buf[1]; + +#define sigsetjmp(__env, __save) \ +({ \ + struct __sigjmp_buf *__e = (__env); \ + sigprocmask(0, NULL, &__e->__sigs); \ + setjmp(__e->__jmpbuf); \ +}) + +__extern __noreturn siglongjmp(sigjmp_buf, int); + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/include/signal.h b/klibc/klibc/include/signal.h new file mode 100644 index 0000000000..ffd2beba43 --- /dev/null +++ b/klibc/klibc/include/signal.h @@ -0,0 +1,72 @@ +/* + * signal.h + */ + +#ifndef _SIGNAL_H +#define _SIGNAL_H + +#include +#include /* For memset() */ +#include /* For LONG_BIT */ +#include +#include + +/* Some architectures don't define these */ +#ifndef SA_RESETHAND +# define SA_RESETHAND SA_ONESHOT +#endif +#ifndef SA_NODEFER +# define SA_NODEFER SA_NOMASK +#endif +#ifndef NSIG +# define NSIG _NSIG +#endif + +__extern const char * const sys_siglist[]; + +/* This assumes sigset_t is either an unsigned long or an array of such, + and that _NSIG_BPW in the kernel is always LONG_BIT */ + +static __inline__ int sigemptyset(sigset_t *__set) +{ + memset(__set, 0, sizeof *__set); + return 0; +} +static __inline__ int sigfillset(sigset_t *__set) +{ + memset(__set, ~0, sizeof *__set); + return 0; +} +static __inline__ int sigaddset(sigset_t *__set, int __signum) +{ + unsigned long *__lset = (unsigned long *)__set; + __lset[__signum/LONG_BIT] |= 1UL << (__signum%LONG_BIT); + return 0; +} +static __inline__ int sigdelset(sigset_t *__set, int __signum) +{ + unsigned long *__lset = (unsigned long *)__set; + __lset[__signum/LONG_BIT] &= ~(1UL << (__signum%LONG_BIT)); + return 0; +} +static __inline__ int sigismember(sigset_t *__set, int __signum) +{ + unsigned long *__lset = (unsigned long *)__set; + return (int)((__lset[__signum/LONG_BIT] >> (__signum%LONG_BIT)) & 1); +} + +__extern __sighandler_t __signal(int, __sighandler_t, int); +__extern __sighandler_t signal(int, __sighandler_t); +__extern __sighandler_t bsd_signal(int, __sighandler_t); +__extern int sigaction(int, const struct sigaction *, struct sigaction *); +__extern int sigprocmask(int, const sigset_t *, sigset_t *); +__extern int sigpending(sigset_t *); +__extern int sigsuspend(const sigset_t *); +__extern int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t); +__extern int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t); +__extern int rt_sigpending(sigset_t *, size_t); +__extern int rt_sigsuspend(const sigset_t *, size_t); +__extern int raise(int); +__extern int kill(pid_t, int); + +#endif /* _SIGNAL_H */ diff --git a/klibc/klibc/include/stdarg.h b/klibc/klibc/include/stdarg.h new file mode 100644 index 0000000000..cc324b825d --- /dev/null +++ b/klibc/klibc/include/stdarg.h @@ -0,0 +1,14 @@ +/* + * stdarg.h + * + * This is just a wrapper for the gcc one, but defines va_copy() + * even if gcc doesn't. + */ + +/* Note: the _STDARG_H macro belongs to the gcc header... */ +#include_next + +/* Older gcc considers this an extension, so it's double underbar only */ +#ifndef va_copy +#define va_copy(d,s) __va_copy(d,s) +#endif diff --git a/klibc/klibc/include/stddef.h b/klibc/klibc/include/stddef.h new file mode 100644 index 0000000000..900c147cd8 --- /dev/null +++ b/klibc/klibc/include/stddef.h @@ -0,0 +1,24 @@ +/* + * stddef.h + */ + +#ifndef _STDDEF_H +#define _STDDEF_H + +#ifndef __KLIBC__ +# define __KLIBC__ 1 +#endif + +#include + +#undef NULL +#ifdef __cplusplus +# define NULL 0 +#else +# define NULL ((void *)0) +#endif + +#undef offsetof +#define offsetof(t,m) ((size_t)&((t *)0->m)) + +#endif /* _STDDEF_H */ diff --git a/klibc/klibc/include/stdint.h b/klibc/klibc/include/stdint.h new file mode 100644 index 0000000000..2022a30fd7 --- /dev/null +++ b/klibc/klibc/include/stdint.h @@ -0,0 +1,113 @@ +/* + * stdint.h + */ + +#ifndef _STDINT_H +#define _STDINT_H + +#include + +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; + +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +typedef int8_t int_fast8_t; +typedef int64_t int_fast64_t; + +typedef uint8_t uint_fast8_t; +typedef uint64_t uint_fast64_t; + +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) + +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647-1) +#define INT64_MIN (__INT64_C(-9223372036854775807)-1) + +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (__INT64_C(9223372036854775807)) + +#define UINT8_MAX (255U) +#define UINT16_MAX (65535U) +#define UINT32_MAX (4294967295U) +#define UINT64_MAX (__UINT64_C(18446744073709551615)) + +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN + +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX + +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST64_MIN INT64_MIN + +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST64_MAX INT64_MAX + +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST64_MAX UINT64_MAX + +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +#include + +#endif + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) + +#define INT8_C(c) c +#define INT16_C(c) c +#define INT32_C(c) c +#define INT64_C(c) __INT64_C(c) + +#define UINT8_C(c) c ## U +#define UINT16_C(c) c ## U +#define UINT32_C(c) c ## U +#define UINT64_C(c) __UINT64_C(c) + +#define INT_LEAST8_C(c) INT8_C(c) +#define INT_LEAST16_C(c) INT16_C(c) +#define INT_LEAST32_C(c) INT32_C(c) +#define INT_LEAST64_C(c) INT64_C(c) + +#define UINT_LEAST8_C(c) UINT8_C(c) +#define UINT_LEAST16_C(c) UINT16_C(c) +#define UINT_LEAST32_C(c) UINT32_C(c) +#define UINT_LEAST64_C(c) UINT64_C(c) + +#define INT_FAST8_C(c) INT8_C(c) +#define INT_FAST64_C(c) INT64_C(c) + +#define UINT_FAST8_C(c) UINT8_C(c) +#define UINT_FAST64_C(c) UINT64_C(c) + +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) + +#include + +#endif + +#endif /* _STDINT_H */ diff --git a/klibc/klibc/include/stdio.h b/klibc/klibc/include/stdio.h new file mode 100644 index 0000000000..5e621af5f1 --- /dev/null +++ b/klibc/klibc/include/stdio.h @@ -0,0 +1,109 @@ +/* + * stdio.h + */ + +#ifndef _STDIO_H +#define _STDIO_H + +#include +#include +#include +#include + +/* This structure doesn't really exist, but it gives us something + to define FILE * with */ +struct _IO_file; +typedef struct _IO_file FILE; + +#define stdin ((FILE *)0) +#define stdout ((FILE *)1) +#define stderr ((FILE *)2) + +#ifndef EOF +# define EOF (-1) +#endif + +#ifndef BUFSIZ +# define BUFSIZ 4096 +#endif + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +static __inline__ int fileno(FILE *__f) +{ + /* This should really be intptr_t, but size_t should be the same size */ + return (int)(size_t)__f; +} + +static __inline__ FILE * __create_file(int __fd) +{ + return (FILE *)(size_t)__fd; +} + +__extern FILE *fopen(const char *, const char *); + +static __inline__ FILE *fdopen(int __fd, const char *__m) +{ + (void)__m; return __create_file(__fd); +} +static __inline__ int fclose(FILE *__f) +{ + extern int close(int); + return close(fileno(__f)); +} +static __inline__ int fseek(FILE *__f, off_t __o, int __w) +{ + extern off_t lseek(int, off_t, int); + return (lseek(fileno(__f), __o, __w) == (off_t)-1) ? -1 : 0; +} +static __inline__ off_t ftell(FILE *__f) +{ + extern off_t lseek(int, off_t, int); + return lseek(fileno(__f), 0, SEEK_CUR); +} + +__extern int fputs(const char *, FILE *); +__extern int puts(const char *); +__extern int fputc(int, FILE *); +#define putc(c,f) fputc((c),(f)) +#define putchar(c) fputc((c),stdout) + +__extern int fgetc(FILE *); +__extern char * fgets(char *, int, FILE *); +#define getc(f) fgetc(f) + +__extern size_t _fread(void *, size_t, FILE *); +__extern size_t _fwrite(const void *, size_t, FILE *); + +#ifndef __NO_FREAD_FWRITE_INLINES +static __inline__ size_t +fread(void *__p, size_t __s, size_t __n, FILE *__f) +{ + return _fread(__p, __s*__n, __f)/__s; +} +static __inline__ size_t +fwrite(void *__p, size_t __s, size_t __n, FILE *__f) +{ + return _fwrite(__p, __s*__n, __f)/__s; +} +#endif + +__extern int printf(const char *, ...); +__extern int vprintf(const char *, va_list); +__extern int fprintf(FILE *, const char *, ...); +__extern int vfprintf(FILE *, const char *, va_list); +__extern int sprintf(char *, const char *, ...); +__extern int vsprintf(char *, const char *, va_list); +__extern int snprintf(char *, size_t n, const char *, ...); +__extern int vsnprintf(char *, size_t n, const char *, va_list); + +__extern int sscanf(const char *, const char *, ...); +__extern int vsscanf(const char *, const char *, va_list); + +__extern void perror(const char *); + +__extern int rename(const char *, const char *); + +#endif /* _STDIO_H */ diff --git a/klibc/klibc/include/stdlib.h b/klibc/klibc/include/stdlib.h new file mode 100644 index 0000000000..38dd1624a5 --- /dev/null +++ b/klibc/klibc/include/stdlib.h @@ -0,0 +1,94 @@ +/* + * stdlib.h + */ + +#ifndef _STDLIB_H +#define _STDLIB_H + +#include +#include +#include + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +static __inline__ __noreturn _Exit(int __n) { + __extern __noreturn _exit(int); + _exit(__n); + for(;;); /* Some gcc versions are stupid */ +} +__extern __noreturn abort(void); +static __inline__ int abs(int __n) { + return (__n < 0) ? -__n : __n; +} +__extern int atexit(void (*)(void)); +__extern int on_exit(void (*)(int, void *), void *); +__extern int atoi(const char *); +__extern long atol(const char *); +__extern long long atoll(const char *); +__extern __noreturn exit(int); +__extern void free(void *); +static __inline__ long labs(long __n) { + return (__n < 0L) ? -__n : __n; +} + +static __inline__ long long llabs(long long __n) { + return (__n < 0LL) ? -__n : __n; +} + +#if defined(__GNUC__) && __GNUC_MAJOR__ >= 3 +# define __attribute_malloc __attribute__((malloc)) +#else +# define __attribute_malloc +#endif + +__extern __attribute_malloc void *malloc(size_t); +__extern __attribute_malloc void *calloc(size_t, size_t); +__extern void *realloc(void *, size_t); +__extern long strtol(const char *, char **, int); +__extern long long strtoll(const char *, char **, int); +__extern unsigned long strtoul(const char *, char **, int); +__extern unsigned long long strtoull(const char *, char **, int); + +__extern char *getenv(const char *); +__extern int putenv(const char *); +__extern int setenv(const char *, const char *, int); +__extern int unsetenv(const char *); + +__extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); + + +__extern long jrand48(unsigned short *); +__extern long mrand48(void); +__extern long nrand48(unsigned short *); +__extern long lrand48(void); +__extern unsigned short *seed48(const unsigned short *); +__extern void srand48(long); + +#define RAND_MAX 0x7fffffff +static __inline__ int rand(void) { + return (int)lrand48(); +} +static __inline__ void srand(unsigned int __s) { + srand48(__s); +} +static __inline__ long random(void) +{ + return lrand48(); +} +static __inline__ void srandom(unsigned int __s) +{ + srand48(__s); +} + +/* Basic PTY functions. These only work if devpts is mounted! */ + +static __inline__ int grantpt(int __fd) +{ + (void)__fd; + return 0; /* devpts does this all for us! */ +} +__extern int unlockpt(int); +__extern char *ptsname(int); + +#endif /* _STDLIB_H */ diff --git a/klibc/klibc/include/string.h b/klibc/klibc/include/string.h new file mode 100644 index 0000000000..bce69284ec --- /dev/null +++ b/klibc/klibc/include/string.h @@ -0,0 +1,37 @@ +/* + * string.h + */ + +#ifndef _STRING_H +#define _STRING_H + +#include +#include + +__extern void *memccpy(void *, const void *, int, size_t); +__extern void *memchr(const void *, int, size_t); +__extern int memcmp(const void *, const void *, size_t); +__extern void *memcpy(void *, const void *, size_t); +__extern void *memmove(void *, const void *, size_t); +__extern void *memset(void *, int, size_t); +__extern void *memmem(const void *, size_t, const void *, size_t); +__extern void memswap(void *, void *, size_t); +__extern char *strcat(char *, const char *); +__extern char *strchr(const char *, int); +__extern int strcmp(const char *, const char *); +__extern char *strcpy(char *, const char *); +__extern size_t strcspn(const char *, const char *); +__extern char *strdup(const char *); +__extern char *strerror(int); +__extern size_t strlen(const char *); +__extern char *strncat(char *, const char *, size_t); +__extern int strncmp(const char *, const char *, size_t); +__extern char *strncpy(char *, const char *, size_t); +__extern char *strpbrk(const char *, const char *); +__extern char *strrchr(const char *, int); +__extern char *strsep(char **, const char *); +__extern size_t strspn(const char *, const char *); +__extern char *strstr(const char *, const char *); +__extern char *strtok(char *, const char *); + +#endif /* _STRING_H */ diff --git a/klibc/klibc/include/sys/dirent.h b/klibc/klibc/include/sys/dirent.h new file mode 100644 index 0000000000..0700f4b561 --- /dev/null +++ b/klibc/klibc/include/sys/dirent.h @@ -0,0 +1,13 @@ +/* + * sys/dirent.h + */ + +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H + +#include +#include + +__extern int getdents(unsigned int, struct dirent *, unsigned int); + +#endif /* _SYS_DIRENT_H */ diff --git a/klibc/klibc/include/sys/fsuid.h b/klibc/klibc/include/sys/fsuid.h new file mode 100644 index 0000000000..823486b776 --- /dev/null +++ b/klibc/klibc/include/sys/fsuid.h @@ -0,0 +1,14 @@ +/* + * sys/fsuid.h + */ + +#ifndef _SYS_FSUID_H +#define _SYS_FSUID_H + +#include +#include + +__extern int setfsuid(uid_t); +__extern int setfsgid(gid_t); + +#endif /* _SYS_FSUID_H */ diff --git a/klibc/klibc/include/sys/ioctl.h b/klibc/klibc/include/sys/ioctl.h new file mode 100644 index 0000000000..b0cee4c02c --- /dev/null +++ b/klibc/klibc/include/sys/ioctl.h @@ -0,0 +1,14 @@ +/* + * sys/ioctl.h + */ + +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + +#include +#include +#include + +__extern int ioctl(int, int, void *); + +#endif /* _SYS_IOCTL_H */ diff --git a/klibc/klibc/include/sys/klog.h b/klibc/klibc/include/sys/klog.h new file mode 100644 index 0000000000..0fc5f5d945 --- /dev/null +++ b/klibc/klibc/include/sys/klog.h @@ -0,0 +1,24 @@ +/* + * sys/klog.h + */ + +#ifndef _SYS_KLOG_H +#define _SYS_KLOG_H + +#include + +#define KLOG_CLOSE 0 +#define KLOG_OPEN 1 +#define KLOG_READ 2 +#define KLOG_READ_ALL 3 +#define KLOG_READ_CLEAR 4 +#define KLOG_CLEAR 5 +#define KLOG_DISABLE 6 +#define KLOG_ENABLE 7 +#define KLOG_SETLEVEL 8 +#define KLOG_UNREADSIZE 9 +#define KLOG_WRITE 10 + +__extern int klogctl(int, char *, int); + +#endif /* _SYS_KLOG_H */ diff --git a/klibc/klibc/include/sys/mman.h b/klibc/klibc/include/sys/mman.h new file mode 100644 index 0000000000..3d8a2f63c2 --- /dev/null +++ b/klibc/klibc/include/sys/mman.h @@ -0,0 +1,21 @@ +/* + * sys/mman.h + */ + +#ifndef _SYS_MMAN_H +#define _SYS_MMAN_H + +#include +#include +#include +#include /* For PAGE_SIZE */ + +#define MAP_FAILED ((void *)-1) + +__extern void *mmap(void *, size_t, int, int, int, off_t); +__extern int munmap(void *, size_t); +__extern void *mremap(void *, size_t, size_t, unsigned long); +__extern int msync(const void *, size_t, int); +__extern int mprotect(const void *, size_t, int); + +#endif /* _SYS_MMAN_H */ diff --git a/klibc/klibc/include/sys/module.h b/klibc/klibc/include/sys/module.h new file mode 100644 index 0000000000..96b3b59945 --- /dev/null +++ b/klibc/klibc/include/sys/module.h @@ -0,0 +1,158 @@ +/* + * sys/module.h + * + * This is a bastardized version of linux/module.h, since the latter + * doesn't have __KERNEL__ guards where it needs them... + */ + +#ifndef _SYS_MODULE_H +#define _SYS_MODULE_H + +/* + * Dynamic loading of modules into the kernel. + * + * Rewritten by Richard Henderson Dec 1996 + */ + +#include + +/* Don't need to bring in all of uaccess.h just for this decl. */ +struct exception_table_entry; + +/* Used by get_kernel_syms, which is obsolete. */ +struct kernel_sym +{ + unsigned long value; + char name[60]; /* should have been 64-sizeof(long); oh well */ +}; + +struct module_symbol +{ + unsigned long value; + const char *name; +}; + +struct module_ref +{ + struct module *dep; /* "parent" pointer */ + struct module *ref; /* "child" pointer */ + struct module_ref *next_ref; +}; + +/* TBD */ +struct module_persist; + +struct module +{ + unsigned long size_of_struct; /* == sizeof(module) */ + struct module *next; + const char *name; + unsigned long size; + + union + { + atomic_t usecount; + long pad; + } uc; /* Needs to keep its size - so says rth */ + + unsigned long flags; /* AUTOCLEAN et al */ + + unsigned nsyms; + unsigned ndeps; + + struct module_symbol *syms; + struct module_ref *deps; + struct module_ref *refs; + int (*init)(void); + void (*cleanup)(void); + const struct exception_table_entry *ex_table_start; + const struct exception_table_entry *ex_table_end; +#ifdef __alpha__ + unsigned long gp; +#endif + /* Members past this point are extensions to the basic + module support and are optional. Use mod_member_present() + to examine them. */ + const struct module_persist *persist_start; + const struct module_persist *persist_end; + int (*can_unload)(void); + int runsize; /* In modutils, not currently used */ + const char *kallsyms_start; /* All symbols for kernel debugging */ + const char *kallsyms_end; + const char *archdata_start; /* arch specific data for module */ + const char *archdata_end; + const char *kernel_data; /* Reserved for kernel internal use */ +}; + +struct module_info +{ + unsigned long addr; + unsigned long size; + unsigned long flags; + long usecount; +}; + +/* Bits of module.flags. */ + +#define MOD_UNINITIALIZED 0 +#define MOD_RUNNING 1 +#define MOD_DELETED 2 +#define MOD_AUTOCLEAN 4 +#define MOD_VISITED 8 +#define MOD_USED_ONCE 16 +#define MOD_JUST_FREED 32 +#define MOD_INITIALIZING 64 + +/* Values for query_module's which. */ + +#define QM_MODULES 1 +#define QM_DEPS 2 +#define QM_REFS 3 +#define QM_SYMBOLS 4 +#define QM_INFO 5 + +/* Can the module be queried? */ +#define MOD_CAN_QUERY(mod) (((mod)->flags & (MOD_RUNNING | MOD_INITIALIZING)) && !((mod)->flags & MOD_DELETED)) + +/* When struct module is extended, we must test whether the new member + is present in the header received from insmod before we can use it. + This function returns true if the member is present. */ + +#define mod_member_present(mod,member) \ + ((unsigned long)(&((struct module *)0L)->member + 1) \ + <= (mod)->size_of_struct) + +/* + * Ditto for archdata. Assumes mod->archdata_start and mod->archdata_end + * are validated elsewhere. + */ +#define mod_archdata_member_present(mod, type, member) \ + (((unsigned long)(&((type *)0L)->member) + \ + sizeof(((type *)0L)->member)) <= \ + ((mod)->archdata_end - (mod)->archdata_start)) + + +/* Check if an address p with number of entries n is within the body of module m */ +#define mod_bound(p, n, m) ((unsigned long)(p) >= ((unsigned long)(m) + ((m)->size_of_struct)) && \ + (unsigned long)((p)+(n)) <= (unsigned long)(m) + (m)->size) + +/* Backwards compatibility definition. */ + +#define GET_USE_COUNT(module) (atomic_read(&(module)->uc.usecount)) + +/* Poke the use count of a module. */ + +#define __MOD_INC_USE_COUNT(mod) \ + (atomic_inc(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED|MOD_USED_ONCE) +#define __MOD_DEC_USE_COUNT(mod) \ + (atomic_dec(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED) +#define __MOD_IN_USE(mod) \ + (mod_member_present((mod), can_unload) && (mod)->can_unload \ + ? (mod)->can_unload() : atomic_read(&(mod)->uc.usecount)) + +/* Indirect stringification. */ + +#define __MODULE_STRING_1(x) #x +#define __MODULE_STRING(x) __MODULE_STRING_1(x) + +#endif /* _SYS_MODULE_H */ diff --git a/klibc/klibc/include/sys/mount.h b/klibc/klibc/include/sys/mount.h new file mode 100644 index 0000000000..313c90ec0e --- /dev/null +++ b/klibc/klibc/include/sys/mount.h @@ -0,0 +1,55 @@ +/* + * sys/mount.h + */ + +#ifndef _SYS_MOUNT_H +#define _SYS_MOUNT_H + +#include + +/* + * These are the fs-independent mount-flags: up to 32 flags are supported + */ +#define MS_RDONLY 1 /* Mount read-only */ +#define MS_NOSUID 2 /* Ignore suid and sgid bits */ +#define MS_NODEV 4 /* Disallow access to device special files */ +#define MS_NOEXEC 8 /* Disallow program execution */ +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ +#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ +#define MS_NOATIME 1024 /* Do not update access times. */ +#define MS_NODIRATIME 2048 /* Do not update directory access times */ +#define MS_BIND 4096 +#define MS_MOVE 8192 +#define MS_REC 16384 +#define MS_VERBOSE 32768 +#define MS_NOUSER (1<<31) + +/* + * Superblock flags that can be altered by MS_REMOUNT + */ +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|MS_NODIRATIME) + +/* + * Old magic mount flag and mask + */ +#define MS_MGC_VAL 0xC0ED0000 +#define MS_MGC_MSK 0xffff0000 + +/* + * umount2() flags + */ +#define MNT_FORCE 1 + +/* + * Prototypes + */ +__extern int mount(const char *, const char *, + const char *, unsigned long, + const void *); +__extern int umount(const char *); +__extern int umount2(const char *, int); +__extern int pivot_root(const char *, const char *); + +#endif /* _SYS_MOUNT_H */ diff --git a/klibc/klibc/include/sys/param.h b/klibc/klibc/include/sys/param.h new file mode 100644 index 0000000000..63a0661f43 --- /dev/null +++ b/klibc/klibc/include/sys/param.h @@ -0,0 +1,11 @@ +/* + * sys/param.h + */ + +#ifndef _SYS_PARAM_H +#define _SYS_PARAM_H + +#include +#include + +#endif /* _SYS_PARAM_H */ diff --git a/klibc/klibc/include/sys/reboot.h b/klibc/klibc/include/sys/reboot.h new file mode 100644 index 0000000000..eaf56610d7 --- /dev/null +++ b/klibc/klibc/include/sys/reboot.h @@ -0,0 +1,25 @@ +/* + * sys/reboot.h + */ + +#ifndef _SYS_REBOOT_H +#define _SYS_REBOOT_H + +#include +#include + +/* glibc names these constants differently; allow both versions */ + +#define RB_AUTOBOOT LINUX_REBOOT_CMD_RESTART +#define RB_HALT_SYSTEM LINUX_REBOOT_CMD_HALT +#define RB_ENABLE_CAD LINUX_REBOOT_CMD_CAD_ON +#define RB_DISABLE_CAD LINUX_REBOOT_CMD_CAD_OFF +#define RB_POWER_OFF LINUX_REBOOT_CMD_POWER_OFF + +/* glibc-ish one-argument version */ +__extern int reboot(int); + +/* Native four-argument system call */ +__extern int __reboot(int, int, int, void *); + +#endif /* _SYS_REBOOT_H */ diff --git a/klibc/klibc/include/sys/resource.h b/klibc/klibc/include/sys/resource.h new file mode 100644 index 0000000000..ef14bde9f6 --- /dev/null +++ b/klibc/klibc/include/sys/resource.h @@ -0,0 +1,15 @@ +/* + * sys/resource.h + */ + +#ifndef _SYS_RESOURCE_H +#define _SYS_RESOURCE_H + +#include +#include /* MUST be included before linux/resource.h */ +#include + +__extern int getpriority(int, int); +__extern int setpriority(int, int, int); + +#endif /* _SYS_RESOURCE_H */ diff --git a/klibc/klibc/include/sys/select.h b/klibc/klibc/include/sys/select.h new file mode 100644 index 0000000000..7caf8c931b --- /dev/null +++ b/klibc/klibc/include/sys/select.h @@ -0,0 +1,13 @@ +/* + * sys/select.h + */ + +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H + +#include +#include + +__extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + +#endif /* _SYS_SELECT_H */ diff --git a/klibc/klibc/include/sys/socket.h b/klibc/klibc/include/sys/socket.h new file mode 100644 index 0000000000..cbc2b89591 --- /dev/null +++ b/klibc/klibc/include/sys/socket.h @@ -0,0 +1,50 @@ +/* + * sys/socket.h + */ + +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H + +#include +#include +#include + +/* For some reason these may be protected by __KERNEL__ in asm/socket.h */ +#ifndef SOCK_STREAM +# define SOCK_STREAM 1 +# define SOCK_DGRAM 2 +# define SOCK_RAW 3 +# define SOCK_RDM 4 +# define SOCK_SEQPACKET 5 +# define SOCK_PACKET 10 +#endif + +#ifdef __i386__ +# define __socketcall __extern __cdecl +#else +# define __socketcall __extern +#endif + +typedef int socklen_t; + +__socketcall int socket(int, int, int); +__socketcall int bind(int, struct sockaddr *, int); +__socketcall int connect(int, struct sockaddr *, socklen_t); +__socketcall int listen(int, int); +__socketcall int accept(int, struct sockaddr *, socklen_t *); +__socketcall int getsockname(int, struct sockaddr *, socklen_t *); +__socketcall int getpeername(int, struct sockaddr *, socklen_t *); +__socketcall int socketpair(int, int, int, int *); +__extern int send(int, const void *, size_t, unsigned int); +__socketcall int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); +__extern int recv(int, void *, size_t, unsigned int); +__socketcall int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *); +__socketcall int shutdown(int, int); +__socketcall int setsockopt(int, int, int, const void *, socklen_t); +__socketcall int getsockopt(int, int, int, void *, socklen_t *); +__socketcall int sendmsg(int, const struct msghdr *, unsigned int); +__socketcall int recvmsg(int, struct msghdr *, unsigned int); + +#undef __socketcall + +#endif /* _SYS_SOCKET_H */ diff --git a/klibc/klibc/include/sys/socketcalls.h b/klibc/klibc/include/sys/socketcalls.h new file mode 100644 index 0000000000..dac9f9aab6 --- /dev/null +++ b/klibc/klibc/include/sys/socketcalls.h @@ -0,0 +1,28 @@ +/* + * sys/socketcalls.h + */ + +#ifndef _SYS_SOCKETCALLS_H +#define _SYS_SOCKETCALLS_H + +/* socketcalls by number, since isn't usable for assembly */ + +#define SYS_SOCKET 1 /* sys_socket(2) */ +#define SYS_BIND 2 /* sys_bind(2) */ +#define SYS_CONNECT 3 /* sys_connect(2) */ +#define SYS_LISTEN 4 /* sys_listen(2) */ +#define SYS_ACCEPT 5 /* sys_accept(2) */ +#define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */ +#define SYS_GETPEERNAME 7 /* sys_getpeername(2) */ +#define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */ +#define SYS_SEND 9 /* sys_send(2) */ +#define SYS_RECV 10 /* sys_recv(2) */ +#define SYS_SENDTO 11 /* sys_sendto(2) */ +#define SYS_RECVFROM 12 /* sys_recvfrom(2) */ +#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ +#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ +#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ +#define SYS_SENDMSG 16 /* sys_sendmsg(2) */ +#define SYS_RECVMSG 17 /* sys_recvmsg(2) */ + +#endif /* _SYS_SOCKETCALLS_H */ diff --git a/klibc/klibc/include/sys/stat.h b/klibc/klibc/include/sys/stat.h new file mode 100644 index 0000000000..f7bb5aacc5 --- /dev/null +++ b/klibc/klibc/include/sys/stat.h @@ -0,0 +1,23 @@ +/* + * sys/stat.h + */ + +#ifndef _SYS_STAT_H +#define _SYS_STAT_H + +#include +#include +#include +#include + +__extern int stat(const char *, struct stat *); +__extern int fstat(int, struct stat *); +__extern int lstat(const char *, struct stat *); +__extern mode_t umask(mode_t); +__extern int mknod(const char *, mode_t, dev_t); +static __inline__ int mkfifo(const char *__p, mode_t __m) +{ + return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0); +} + +#endif /* _SYS_STAT_H */ diff --git a/klibc/klibc/include/sys/syscall.h b/klibc/klibc/include/sys/syscall.h new file mode 100644 index 0000000000..907c7f9b9a --- /dev/null +++ b/klibc/klibc/include/sys/syscall.h @@ -0,0 +1,15 @@ +/* + * sys/syscall.h + * + * Generic system call interface macros + */ +#ifndef _SYS_SYSCALL_H +#define _SYS_SYSCALL_H + +#include +#include + +/* Many architectures have incomplete or defective syscall macros */ +#include + +#endif /* _SYS_SYSCALL_H */ diff --git a/klibc/klibc/include/sys/time.h b/klibc/klibc/include/sys/time.h new file mode 100644 index 0000000000..4eccf824a4 --- /dev/null +++ b/klibc/klibc/include/sys/time.h @@ -0,0 +1,16 @@ +/* + * sys/time.h + */ + +#ifndef _SYS_TIME_H +#define _SYS_TIME_H + +#include +#include + +__extern int gettimeofday(struct timeval *, struct timezone *); +__extern int settimeofday(const struct timeval *, const struct timezone *); +__extern int getitimer(int, struct itimerval *); +__extern int setitimer(int, const struct itimerval *, struct itimerval *); + +#endif /* _SYS_TIME_H */ diff --git a/klibc/klibc/include/sys/times.h b/klibc/klibc/include/sys/times.h new file mode 100644 index 0000000000..657f9c4b1c --- /dev/null +++ b/klibc/klibc/include/sys/times.h @@ -0,0 +1,14 @@ +/* + * sys/times.h + */ + +#ifndef _SYS_TIMES_H +#define _SYS_TIMES_H + +#include + +__extern clock_t times(struct tms *); +__extern int gettimeofday(struct timeval *, struct timezone *); +__extern int settimeofday(const struct timeval *, const struct timezone *); + +#endif /* _SYS_TIMES_H */ diff --git a/klibc/klibc/include/sys/types.h b/klibc/klibc/include/sys/types.h new file mode 100644 index 0000000000..a25873cc4b --- /dev/null +++ b/klibc/klibc/include/sys/types.h @@ -0,0 +1,127 @@ +/* + * sys/types.h + * + * This is a bastardized version of linux/types.h, since that file + * is broken w.r.t. definitions. + */ + +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +#include +#include + +#define _SSIZE_T +typedef ptrdiff_t ssize_t; + +#include +#include + +/* Keeps linux/types.h from getting included elsewhere */ +#define _LINUX_TYPES_H + +typedef __kernel_fd_set fd_set; +typedef uint32_t dev_t; +typedef __kernel_ino_t ino_t; +typedef __kernel_mode_t mode_t; +typedef __kernel_nlink_t nlink_t; +typedef __kernel_off_t off_t; +typedef __kernel_pid_t pid_t; +typedef __kernel_daddr_t daddr_t; +typedef __kernel_key_t key_t; +typedef __kernel_suseconds_t suseconds_t; +typedef __kernel_timer_t timer_t; + +typedef __kernel_uid32_t uid_t; +typedef __kernel_gid32_t gid_t; + +typedef __kernel_loff_t loff_t; + +/* + * The following typedefs are also protected by individual ifdefs for + * historical reasons: + */ +#ifndef _SIZE_T +#define _SIZE_T +typedef __kernel_size_t size_t; +#endif + +#ifndef _SSIZE_T +#define _SSIZE_T +typedef __kernel_ssize_t ssize_t; +#endif + +#ifndef _PTRDIFF_T +#define _PTRDIFF_T +typedef __kernel_ptrdiff_t ptrdiff_t; +#endif + +#ifndef _TIME_T +#define _TIME_T +typedef __kernel_time_t time_t; +#endif + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef __kernel_clock_t clock_t; +#endif + +#ifndef _CADDR_T +#define _CADDR_T +typedef __kernel_caddr_t caddr_t; +#endif + +/* bsd */ +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; + +/* sysv */ +typedef unsigned char unchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; + +#ifndef __BIT_TYPES_DEFINED__ +#define __BIT_TYPES_DEFINED__ + +typedef __u8 u_int8_t; +typedef __u16 u_int16_t; +typedef __u32 u_int32_t; +typedef __u64 u_int64_t; + +#endif /* !(__BIT_TYPES_DEFINED__) */ + +/* + * transition to 64-bit sector_t, possibly making it an option... + */ +#undef BLK_64BIT_SECTOR + +#ifdef BLK_64BIT_SECTOR +typedef u64 sector_t; +#else +typedef unsigned long sector_t; +#endif + +/* + * The type of an index into the pagecache. Use a #define so asm/types.h + * can override it. + */ +#ifndef pgoff_t +#define pgoff_t unsigned long +#endif + +/* + * Below are truly Linux-specific types that should never collide with + * any application/library that wants linux/types.h. + */ + +struct ustat { + __kernel_daddr_t f_tfree; + __kernel_ino_t f_tinode; + char f_fname[6]; + char f_fpack[6]; +}; + +#endif diff --git a/klibc/klibc/include/sys/uio.h b/klibc/klibc/include/sys/uio.h new file mode 100644 index 0000000000..fc2525d11a --- /dev/null +++ b/klibc/klibc/include/sys/uio.h @@ -0,0 +1,15 @@ +/* + * sys/uio.h + */ + +#ifndef _SYS_UIO_H +#define _SYS_UIO_H + +#include +#include +#include + +__extern int readv(int, const struct iovec *, int); +__extern int writev(int, const struct iovec *, int); + +#endif /* _SYS_UIO_H */ diff --git a/klibc/klibc/include/sys/utime.h b/klibc/klibc/include/sys/utime.h new file mode 100644 index 0000000000..d1d635d242 --- /dev/null +++ b/klibc/klibc/include/sys/utime.h @@ -0,0 +1,10 @@ +/* + * sys/utime.h + */ + +#ifndef _SYS_UTIME_H +#define _SYS_UTIME_H + +#include + +#endif /* _SYS_UTIME_H */ diff --git a/klibc/klibc/include/sys/utsname.h b/klibc/klibc/include/sys/utsname.h new file mode 100644 index 0000000000..f2990f5711 --- /dev/null +++ b/klibc/klibc/include/sys/utsname.h @@ -0,0 +1,23 @@ +/* + * sys/utsname.h + */ + +#ifndef _SYS_UTSNAME_H +#define _SYS_UTSNAME_H + +#include + +#define SYS_NMLN 65 + +struct utsname { + char sysname[SYS_NMLN]; + char nodename[SYS_NMLN]; + char release[SYS_NMLN]; + char version[SYS_NMLN]; + char machine[SYS_NMLN]; + char domainname[SYS_NMLN]; +}; + +__extern int uname(struct utsname *); + +#endif /* _SYS_UTSNAME_H */ diff --git a/klibc/klibc/include/sys/vfs.h b/klibc/klibc/include/sys/vfs.h new file mode 100644 index 0000000000..8c1577c4bf --- /dev/null +++ b/klibc/klibc/include/sys/vfs.h @@ -0,0 +1,14 @@ +/* + * sys/vfs.h + */ + +#ifndef _SYS_VFS_H +#define _SYS_VFS_H + +#include +#include + +__extern int statfs(const char *, struct statfs *); +__extern int fstatfs(int, struct statfs *); + +#endif /* _SYS_VFS_H */ diff --git a/klibc/klibc/include/sys/wait.h b/klibc/klibc/include/sys/wait.h new file mode 100644 index 0000000000..cad6989bf7 --- /dev/null +++ b/klibc/klibc/include/sys/wait.h @@ -0,0 +1,19 @@ +/* + * sys/wait.h + */ + +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H + +#include +#include +#include + +#include + +__extern pid_t wait(int *); +__extern pid_t waitpid(pid_t, int *, int); +__extern pid_t wait3(int *, int, struct rusage *); +__extern pid_t wait4(pid_t, int *, int, struct rusage *); + +#endif /* _SYS_WAIT_H */ diff --git a/klibc/klibc/include/syslog.h b/klibc/klibc/include/syslog.h new file mode 100644 index 0000000000..b6c0acfea1 --- /dev/null +++ b/klibc/klibc/include/syslog.h @@ -0,0 +1,53 @@ +/* + * syslog.h + */ + +#ifndef _SYSLOG_H +#define _SYSLOG_H + +#include + +/* Alert levels */ +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_PRIMASK 7 +#define LOG_PRI(x) ((x) & LOG_PRIMASK) + + +/* Facilities; not actually used */ +#define LOG_KERN 0000 +#define LOG_USER 0010 +#define LOG_MAIL 0020 +#define LOG_DAEMON 0030 +#define LOG_AUTH 0040 +#define LOG_SYSLOG 0050 +#define LOG_LPR 0060 +#define LOG_NEWS 0070 +#define LOG_UUCP 0100 +#define LOG_CRON 0110 +#define LOG_AUTHPRIV 0120 +#define LOG_FTP 0130 +#define LOG_LOCAL0 0200 +#define LOG_LOCAL1 0210 +#define LOG_LOCAL2 0220 +#define LOG_LOCAL3 0230 +#define LOG_LOCAL4 0240 +#define LOG_LOCAL5 0250 +#define LOG_LOCAL6 0260 +#define LOG_LOCAL7 0270 + +#define LOG_FACMASK 01770 +#define LOG_FAC(x) (((x) >> 3) & (LOG_FACMASK >> 3)) + +__extern void openlog(const char *, int, int); +__extern void syslog(int, const char *, ...); +__extern void closelog(void); + +#endif /* _SYSLOG_H */ diff --git a/klibc/klibc/include/termios.h b/klibc/klibc/include/termios.h new file mode 100644 index 0000000000..08a5e56855 --- /dev/null +++ b/klibc/klibc/include/termios.h @@ -0,0 +1,86 @@ +/* + * termios.h + */ + +#ifndef _TERMIOS_H +#define _TERMIOS_H + +#include +#include +#include +#include +#include + +/* Redefine these so the magic constants == the ioctl number to use. */ +#undef TCSANOW +#undef TCSADRAIN +#undef TCSAFLUSH +#define TCSANOW TCSETS +#define TCSADRAIN TCSETSW +#define TCSAFLUSH TCSETSF + +static __inline__ int tcgetattr(int __fd, struct termios *__s) +{ + return ioctl(__fd, TCGETS, __s); +} + +static __inline__ int tcsetattr(int __fd, int __opt, const struct termios *__s) +{ + return ioctl(__fd, __opt, (void *)__s); +} + +static __inline__ int tcflow(int __fd, int __action) +{ + return ioctl(__fd, TCXONC, (void *)(intptr_t)__action); +} + +static __inline__ int tcflush(int __fd, int __queue) +{ + return ioctl(__fd, TCFLSH, (void *)(intptr_t)__queue); +} + +static __inline__ pid_t tcgetpgrp(int __fd) +{ + pid_t __p; + return ioctl(__fd, TIOCGPGRP, &__p) ? (pid_t)-1 : __p; +} + +static __inline__ pid_t tcgetsid(int __fd) +{ + pid_t __p; + return ioctl(__fd, TIOCGSID, &__p) ? (pid_t)-1 : __p; +} + +static __inline__ int tcsendbreak(int __fd, int __duration) +{ + return ioctl(__fd, TCSBRKP, (void *)(uintptr_t)__duration); +} + +static __inline__ int tcsetpgrp(int __fd, pid_t __p) +{ + return ioctl(__fd, TIOCSPGRP, &__p); +} + +static __inline__ speed_t cfgetospeed(const struct termios *__s) +{ + return (speed_t)(__s->c_cflag & CBAUD); +} + +static __inline__ speed_t cfgetispeed(const struct termios *__s) +{ + return (speed_t)(__s->c_cflag & CBAUD); +} + +static __inline__ int cfsetospeed(struct termios *__s, speed_t __v) +{ + __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); + return 0; +} + +static __inline__ int cfsetispeed(struct termios *__s, speed_t __v) +{ + __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); + return 0; +} + +#endif /* _TERMIOS_H */ diff --git a/klibc/klibc/include/time.h b/klibc/klibc/include/time.h new file mode 100644 index 0000000000..c69c231ec8 --- /dev/null +++ b/klibc/klibc/include/time.h @@ -0,0 +1,14 @@ +/* + * time.h + */ + +#ifndef _TIME_H +#define _TIME_H + +#include +#include + +__extern time_t time(time_t *); +__extern int nanosleep(const struct timespec *, struct timespec *); + +#endif /* _TIME_H */ diff --git a/klibc/klibc/include/unistd.h b/klibc/klibc/include/unistd.h new file mode 100644 index 0000000000..a9b434c16b --- /dev/null +++ b/klibc/klibc/include/unistd.h @@ -0,0 +1,111 @@ +/* + * unistd.h + */ + +#ifndef _UNISTD_H +#define _UNISTD_H + +#include +#include +#include +#include +#include + +__extern char **environ; +__extern __noreturn _exit(int); + +__extern pid_t fork(void); +__extern pid_t vfork(void); +__extern pid_t getpid(void); +__extern int setpgid(pid_t, pid_t); +__extern pid_t getppid(void); +__extern pid_t getpgrp(void); +__extern int setpgrp(void); +__extern pid_t setsid(void); +__extern pid_t getsid(pid_t); +__extern int execv(const char *, char * const *); +__extern int execvp(const char *, char * const *); +__extern int execve(const char *, char * const *, char * const *); +__extern int execvpe(const char *, char * const *, char * const *); +__extern int execl(const char *, const char *, ...); +__extern int execlp(const char *, const char *, ...); +__extern int execle(const char *, const char *, ...); +__extern int execlpe(const char *, const char *, ...); + +__extern int setuid(uid_t); +__extern uid_t getuid(void); +__extern int seteuid(uid_t); +__extern uid_t geteuid(void); +__extern int setgid(gid_t); +__extern gid_t getgid(void); +__extern int setegid(gid_t); +__extern gid_t getegid(void); +__extern int getgroups(int, gid_t *); +__extern int setgroups(size_t, const gid_t *); +__extern int setreuid(uid_t, uid_t); +__extern int setregid(gid_t, gid_t); +__extern int setresuid(uid_t, uid_t, uid_t); +__extern int setresgid(gid_t, gid_t, gid_t); +__extern int getfsuid(uid_t); +__extern int setfsuid(uid_t); + +__extern int access(const char *, int); +__extern int link(const char *, const char *); +__extern int unlink(const char *); +__extern int chdir(const char *); +__extern int chmod(const char *, mode_t); +__extern int mkdir(const char *, mode_t); +__extern int rmdir(const char *); +__extern int pipe(int *); +__extern int chroot(const char *); +__extern int symlink(const char *, const char *); +__extern int readlink(const char *, char *, size_t); +__extern int chown(const char *, uid_t, gid_t); +__extern int fchown(int, uid_t, gid_t); +__extern int lchown(const char *, uid_t, gid_t); +__extern char *getcwd(char *, size_t); + +__extern int sync(void); + +__extern ssize_t read(int, void *, size_t); +__extern ssize_t write(int, const void *, size_t); +#ifndef __IN_SYS_COMMON +__extern int open(const char *, int, ...); +#endif +__extern int close(int); +__extern off_t lseek(int, off_t, int); +__extern loff_t llseek(int, loff_t, int); +__extern int dup(int); +__extern int dup2(int, int); +__extern int fcntl(int, int, long); +__extern int ioctl(int, int, void *); +__extern int flock(int, int); +__extern int fsync(int); +__extern int fdatasync(int); + +__extern int pause(void); +__extern unsigned int alarm(unsigned int); +__extern unsigned int sleep(unsigned int); +__extern void usleep(unsigned long); + +__extern int gethostname(char *, size_t); +__extern int sethostname(const char *, size_t); +__extern int getdomainname(char *, size_t); +__extern int setdomainname(const char *, size_t); + +__extern void *__brk(void *); +__extern int brk(void *); +__extern void *sbrk(ptrdiff_t); + +__extern int getopt(int, char * const *, const char *); +__extern char *optarg; +__extern int optind, opterr, optopt; + +__extern int isatty(int); + +/* Standard file descriptor numbers. */ +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +#endif /* _UNISTD_H */ diff --git a/klibc/klibc/include/utime.h b/klibc/klibc/include/utime.h new file mode 100644 index 0000000000..3dfa03a14a --- /dev/null +++ b/klibc/klibc/include/utime.h @@ -0,0 +1,15 @@ +/* + * utime.h + */ + +#ifndef _UTIME_H +#define _UTIME_H + +#include +#include +#include + +__extern int utime(const char *, const struct utimbuf *); + +#endif /* _UTIME_H */ + diff --git a/klibc/klibc/inet/bindresvport.c b/klibc/klibc/inet/bindresvport.c new file mode 100644 index 0000000000..b5f327bb33 --- /dev/null +++ b/klibc/klibc/inet/bindresvport.c @@ -0,0 +1,48 @@ +/* + * inet/bindresvport.c + */ + +#include +#include +#include +#include +#include +#include + +#define START_PORT 600 +#define END_PORT (IPPORT_RESERVED - 1) +#define NUM_PORTS (END_PORT - START_PORT) + +int bindresvport(int sd, struct sockaddr_in *sin) +{ + struct sockaddr_in me; + static short port; + int ret = 0; + int i; + + if (sin == NULL) { + sin = &me; + memset(sin, 0, sizeof(me)); + sin->sin_port = AF_INET; + } + else if (sin->sin_family != AF_INET) { + errno = EPFNOSUPPORT; + ret = -1; + goto bail; + } + + if (port == 0) { + port = START_PORT + (getpid() % NUM_PORTS); + } + + for (i = 0; i < NUM_PORTS; i++, port++) { + sin->sin_port = htons(port); + if ((ret = bind(sd, sin, sizeof(*sin))) != -1) + break; + if (port == END_PORT) + port = START_PORT; + } + + bail: + return ret; +} diff --git a/klibc/klibc/inet/inet_addr.c b/klibc/klibc/inet/inet_addr.c new file mode 100644 index 0000000000..e04a4d0214 --- /dev/null +++ b/klibc/klibc/inet/inet_addr.c @@ -0,0 +1,14 @@ +/* + * inet/inet_addr.c + */ + +#include +#include + +uint32_t inet_addr(const char *str) +{ + struct in_addr a; + int rv = inet_aton(str, &a); + + return rv ? INADDR_NONE : a.s_addr; +} diff --git a/klibc/klibc/inet/inet_aton.c b/klibc/klibc/inet/inet_aton.c new file mode 100644 index 0000000000..e581b492ad --- /dev/null +++ b/klibc/klibc/inet/inet_aton.c @@ -0,0 +1,23 @@ +/* + * inet/inet_aton.c + */ + +#include +#include + +int inet_aton(const char *str, struct in_addr *addr) +{ + union { + uint8_t b[4]; + uint32_t l; + } a; + + if ( sscanf(str, "%hhu.%hhu.%hhu.%hhu", &a.b[0], &a.b[1], &a.b[2], &a.b[3]) == 4 ) { + addr->s_addr = a.l; /* Always in network byte order */ + return 1; + } else { + return 0; + } +} + + diff --git a/klibc/klibc/inet/inet_ntoa.c b/klibc/klibc/inet/inet_ntoa.c new file mode 100644 index 0000000000..5340aa622a --- /dev/null +++ b/klibc/klibc/inet/inet_ntoa.c @@ -0,0 +1,19 @@ +/* + * inet/inet_ntoa.c + */ + +#include +#include + +char *inet_ntoa(struct in_addr addr) +{ + static char name[16]; + union { + uint8_t b[4]; + uint32_t l; + } a; + a.l = addr.s_addr; + + sprintf(name, "%u.%u.%u.%u", a.b[0], a.b[1], a.b[2], a.b[3]); + return name; +} diff --git a/klibc/klibc/inet/inet_ntop.c b/klibc/klibc/inet/inet_ntop.c new file mode 100644 index 0000000000..377bab7bf2 --- /dev/null +++ b/klibc/klibc/inet/inet_ntop.c @@ -0,0 +1,52 @@ +/* + * inet/inet_ntop.c + */ + +#include +#include +#include +#include +#include + +const char *inet_ntop(int af, const void *cp, char *buf, size_t len) +{ + size_t xlen; + + switch ( af ) { + case AF_INET: + { + union { + uint8_t b[4]; + uint32_t l; + } a; + a.l = ((const struct in_addr *)cp)->s_addr; + + xlen = snprintf(buf, len, "%u.%u.%u.%u", a.b[0], a.b[1], a.b[2], a.b[3]); + } + break; + + case AF_INET6: + { + const struct in6_addr *s = (const struct in6_addr *)cp; + + xlen = snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x", + ntohs(s->s6_addr16[0]), ntohs(s->s6_addr16[1]), + ntohs(s->s6_addr16[2]), ntohs(s->s6_addr16[3]), + ntohs(s->s6_addr16[4]), ntohs(s->s6_addr16[5]), + ntohs(s->s6_addr16[6]), ntohs(s->s6_addr16[7])); + } + break; + + default: + errno = EAFNOSUPPORT; + return NULL; + } + + if ( xlen > len ) { + errno = ENOSPC; + return NULL; + } + + return buf; +} + diff --git a/klibc/klibc/inet/inet_pton.c b/klibc/klibc/inet/inet_pton.c new file mode 100644 index 0000000000..6c14b3cfb6 --- /dev/null +++ b/klibc/klibc/inet/inet_pton.c @@ -0,0 +1,74 @@ +/* + * inet/inet_pton.c + */ + +#include +#include +#include +#include +#include +#include +#include + +static inline int hexval(int ch) +{ + if ( ch >= '0' && ch <= '9' ) { + return ch-'0'; + } else if ( ch >= 'A' && ch <= 'F' ) { + return ch-'A'+10; + } else if ( ch >= 'a' && ch <= 'f' ) { + return ch-'a'+10; + } else { + return -1; + } +} + +int inet_pton(int af, const char *src, void *dst) +{ + switch ( af ) { + case AF_INET: + return inet_aton(src, (struct in_addr *)dst); + + case AF_INET6: + { + struct in6_addr *d = (struct in6_addr *)dst; + int colons = 0, dcolons = 0; + int i; + const char *p; + + /* A double colon will increment colons by 2, dcolons by 1 */ + for ( p = dst ; *p ; p++ ) { + if ( p[0] == ':' ) { + colons++; + if ( p[1] == ':' ) + dcolons++; + } else if ( !isxdigit(*p) ) + return 0; /* Not a valid address */ + } + + if ( colons > 7 || dcolons > 1 || (!dcolons && colons != 7) ) + return 0; /* Not a valid address */ + + memset(d, 0, sizeof(struct in6_addr)); + + i = 0; + for ( p = dst ; *p ; p++ ) { + if ( *p == ':' ) { + if ( p[1] == ':' ) { + i += (8-colons); + } else { + i++; + } + } else { + d->s6_addr16[i] = htons((ntohs(d->s6_addr16[i]) << 4) + hexval(*p)); + } + } + + return 1; + } + + default: + errno = EAFNOSUPPORT; + return -1; + } +} diff --git a/klibc/klibc/interp.S b/klibc/klibc/interp.S new file mode 100644 index 0000000000..303943697b --- /dev/null +++ b/klibc/klibc/interp.S @@ -0,0 +1,11 @@ +# +# This is a hack to generate the .intrp section, which then +# ld turns into an PT_INTERP header. +# + + .section ".interp","a" + .ascii LIBDIR + .ascii "/klibc-" + .ascii SOHASH + .ascii ".so" + .byte 0 diff --git a/klibc/klibc/isatty.c b/klibc/klibc/isatty.c new file mode 100644 index 0000000000..ff5e1ff748 --- /dev/null +++ b/klibc/klibc/isatty.c @@ -0,0 +1,21 @@ +/* + * isatty.c + */ + +#include +#include +#include + +int isatty(int fd) +{ + int old_errno = errno; + int istty; + pid_t dummy; + + /* All ttys support TIOCGPGRP */ + istty = !ioctl(fd, TIOCGPGRP, &dummy); + errno = old_errno; + + return istty; +} + diff --git a/klibc/klibc/libgcc/__divdi3.c b/klibc/klibc/libgcc/__divdi3.c new file mode 100644 index 0000000000..be13caed7e --- /dev/null +++ b/klibc/klibc/libgcc/__divdi3.c @@ -0,0 +1,29 @@ +/* + * arch/i386/libgcc/__divdi3.c + */ + +#include +#include + +extern uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem); + +int64_t __divdi3(int64_t num, int64_t den) +{ + int minus = 0; + int64_t v; + + if ( num < 0 ) { + num = -num; + minus = 1; + } + if ( den < 0 ) { + den = -den; + minus ^= 1; + } + + v = __udivmoddi4(num, den, NULL); + if ( minus ) + v = -v; + + return v; +} diff --git a/klibc/klibc/libgcc/__divsi3.c b/klibc/klibc/libgcc/__divsi3.c new file mode 100644 index 0000000000..24a7e044c8 --- /dev/null +++ b/klibc/klibc/libgcc/__divsi3.c @@ -0,0 +1,29 @@ +/* + * libgcc/__divsi3.c + */ + +#include +#include + +extern uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem); + +int32_t __divsi3(int32_t num, int32_t den) +{ + int minus = 0; + int32_t v; + + if ( num < 0 ) { + num = -num; + minus = 1; + } + if ( den < 0 ) { + den = -den; + minus ^= 1; + } + + v = __udivmodsi4(num, den, NULL); + if ( minus ) + v = -v; + + return v; +} diff --git a/klibc/klibc/libgcc/__moddi3.c b/klibc/klibc/libgcc/__moddi3.c new file mode 100644 index 0000000000..3e613654e4 --- /dev/null +++ b/klibc/klibc/libgcc/__moddi3.c @@ -0,0 +1,29 @@ +/* + * arch/i386/libgcc/__moddi3.c + */ + +#include +#include + +extern uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem); + +int64_t __moddi3(int64_t num, int64_t den) +{ + int minus = 0; + int64_t v; + + if ( num < 0 ) { + num = -num; + minus = 1; + } + if ( den < 0 ) { + den = -den; + minus ^= 1; + } + + (void) __udivmoddi4(num, den, &v); + if ( minus ) + v = -v; + + return v; +} diff --git a/klibc/klibc/libgcc/__modsi3.c b/klibc/klibc/libgcc/__modsi3.c new file mode 100644 index 0000000000..cf62b8b556 --- /dev/null +++ b/klibc/klibc/libgcc/__modsi3.c @@ -0,0 +1,29 @@ +/* + * libgcc/__modsi3.c + */ + +#include +#include + +extern uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem); + +int32_t __modsi3(int32_t num, int32_t den) +{ + int minus = 0; + int32_t v; + + if ( num < 0 ) { + num = -num; + minus = 1; + } + if ( den < 0 ) { + den = -den; + minus ^= 1; + } + + (void) __udivmodsi4(num, den, &v); + if ( minus ) + v = -v; + + return v; +} diff --git a/klibc/klibc/libgcc/__udivdi3.c b/klibc/klibc/libgcc/__udivdi3.c new file mode 100644 index 0000000000..901ce2aea6 --- /dev/null +++ b/klibc/klibc/libgcc/__udivdi3.c @@ -0,0 +1,13 @@ +/* + * arch/i386/libgcc/__divdi3.c + */ + +#include +#include + +extern uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem); + +uint64_t __udivdi3(uint64_t num, uint64_t den) +{ + return __udivmoddi4(num, den, NULL); +} diff --git a/klibc/klibc/libgcc/__udivmoddi4.c b/klibc/klibc/libgcc/__udivmoddi4.c new file mode 100644 index 0000000000..1c456543be --- /dev/null +++ b/klibc/klibc/libgcc/__udivmoddi4.c @@ -0,0 +1,32 @@ +#include +#include + +uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem_p) +{ + uint64_t quot = 0, qbit = 1; + + if ( den == 0 ) { + __divide_error(); + return 0; /* If trap returns... */ + } + + /* Left-justify denominator and count shift */ + while ( (int64_t)den >= 0 ) { + den <<= 1; + qbit <<= 1; + } + + while ( qbit ) { + if ( den <= num ) { + num -= den; + quot += qbit; + } + den >>= 1; + qbit >>= 1; + } + + if ( rem_p ) + *rem_p = num; + + return quot; +} diff --git a/klibc/klibc/libgcc/__udivmodsi4.c b/klibc/klibc/libgcc/__udivmodsi4.c new file mode 100644 index 0000000000..61f6bef0a4 --- /dev/null +++ b/klibc/klibc/libgcc/__udivmodsi4.c @@ -0,0 +1,32 @@ +#include +#include + +uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem_p) +{ + uint32_t quot = 0, qbit = 1; + + if ( den == 0 ) { + __divide_error(); + return 0; /* If trap returns... */ + } + + /* Left-justify denominator and count shift */ + while ( (int32_t)den >= 0 ) { + den <<= 1; + qbit <<= 1; + } + + while ( qbit ) { + if ( den <= num ) { + num -= den; + quot += qbit; + } + den >>= 1; + qbit >>= 1; + } + + if ( rem_p ) + *rem_p = num; + + return quot; +} diff --git a/klibc/klibc/libgcc/__udivsi3.c b/klibc/klibc/libgcc/__udivsi3.c new file mode 100644 index 0000000000..cba6f8f03d --- /dev/null +++ b/klibc/klibc/libgcc/__udivsi3.c @@ -0,0 +1,13 @@ +/* + * libgcc/__divsi3.c + */ + +#include +#include + +extern uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem); + +uint32_t __udivsi3(uint32_t num, uint32_t den) +{ + return __udivmodsi4(num, den, NULL); +} diff --git a/klibc/klibc/libgcc/__umoddi3.c b/klibc/klibc/libgcc/__umoddi3.c new file mode 100644 index 0000000000..c007d4859f --- /dev/null +++ b/klibc/klibc/libgcc/__umoddi3.c @@ -0,0 +1,16 @@ +/* + * arch/i386/libgcc/__umoddi3.c + */ + +#include +#include + +extern uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem); + +uint64_t __umoddi3(uint64_t num, uint64_t den) +{ + uint64_t v; + + (void) __udivmoddi4(num, den, &v); + return v; +} diff --git a/klibc/klibc/libgcc/__umodsi3.c b/klibc/klibc/libgcc/__umodsi3.c new file mode 100644 index 0000000000..e3db972c4e --- /dev/null +++ b/klibc/klibc/libgcc/__umodsi3.c @@ -0,0 +1,16 @@ +/* + * libgcc/__umodsi3.c + */ + +#include +#include + +extern uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem); + +uint32_t __umodsi3(uint32_t num, uint32_t den) +{ + uint32_t v; + + (void) __udivmodsi4(num, den, &v); + return v; +} diff --git a/klibc/klibc/llseek.c b/klibc/klibc/llseek.c new file mode 100644 index 0000000000..fdffc16e2c --- /dev/null +++ b/klibc/klibc/llseek.c @@ -0,0 +1,34 @@ +/* + * llseek.c + * + * On 32-bit platforms, we need llseek() as well as lseek() to be + * able to handle large disks + */ + +#include +#include + +#if BITSIZE == 32 + +static inline _syscall5(int, _llseek, int, fd, unsigned long, hi, unsigned long, lo, loff_t *,res, int, whence); + +loff_t llseek(int fd, loff_t offset, int whence) +{ + loff_t result; + int rv; + + rv = _llseek(fd, (unsigned long)(offset >> 32), + (unsigned long)offset, &result, whence); + + return rv ? (loff_t)-1 : result; +} + +#else + +loff_t llseek(int fd, loff_t offset, int whence) +{ + return lseek(fd, offset, whence); +} + +#endif + diff --git a/klibc/klibc/lrand48.c b/klibc/klibc/lrand48.c new file mode 100644 index 0000000000..4d05de2e89 --- /dev/null +++ b/klibc/klibc/lrand48.c @@ -0,0 +1,42 @@ +/* + * lrand48.c + */ + +#include +#include + +unsigned short __rand48_seed[3]; + +long jrand48(unsigned short xsubi[3]) +{ + uint64_t x; + + /* The xsubi[] array is littleendian by spec */ + x = (uint64_t)xsubi[0] + + ((uint64_t)xsubi[1] << 16) + + ((uint64_t)xsubi[2] << 32); + + x = (0x5deece66dULL * x) + 0xb; + + xsubi[0] = (unsigned short)x; + xsubi[1] = (unsigned short)(x >> 16); + xsubi[2] = (unsigned short)(x >> 32); + + return (long)(int32_t)(x >> 16); +} + +long mrand48(void) +{ + return jrand48(__rand48_seed); +} + +long nrand48(unsigned short xsubi[3]) +{ + return (long)((uint32_t)jrand48(xsubi) >> 1); +} + +long lrand48(void) +{ + return (long)((uint32_t)(mrand48() >> 1)); +} + diff --git a/klibc/klibc/makeerrlist.pl b/klibc/klibc/makeerrlist.pl new file mode 100644 index 0000000000..121ed1f46b --- /dev/null +++ b/klibc/klibc/makeerrlist.pl @@ -0,0 +1,80 @@ +#!/usr/bin/perl +# +# This creates sys_errlist from through somewhat +# heuristic matching. It presumes the relevant entries are of the form +# #define Exxxx /* comment */ +# + +use FileHandle; + +%errors = (); +%errmsg = (); +$maxerr = -1; +$rootdir = 'linux/include/'; # Must have trailing / + +sub parse_file($) { + my($file) = @_; + my($fh) = new FileHandle; + my($line, $error, $msg); + my($kernelonly) = 0; + + $file = $rootdir.$file; + + print STDERR "opening $file\n"; + + if ( !($fh->open("< ".$file)) ) { + die "$0: cannot open $file\n"; + } + + while ( defined($line = <$fh>) ) { + if ( $kernelonly ) { + if ( $line =~ /^\#\s*endif/ ) { + $kernelonly--; + } elsif ( $line =~ /^\#\sif/ ) { + $kernelonly++; + } + } else { + if ( $line =~ /^\#\s*define\s+([A-Z0-9_]+)\s+([0-9]+)\s*\/\*\s*(.*\S)\s*\*\// ) { + $error = $1; + $errno = $2+0; + $msg = $3; + print STDERR "$error ($errno) => \"$msg\"\n"; + $errors{$errno} = $error; + $errmsg{$errno} = $msg; + $maxerr = $errno if ( $errno > $maxerr ); + } elsif ( $line =~ /^\#\s*include\s+[\<\"](.*)[\>\"]/ ) { + parse_file($1); + } elsif ( $line =~ /^\#\s*ifdef\s+__KERNEL__/ ) { + $kernelonly++; + } + } + } + close($fh); + print STDERR "closing $file\n"; +} + +parse_file('linux/errno.h'); + +($type) = @ARGV; + +if ( $type eq '-errlist' ) { + print "#include \n"; + printf "const int sys_nerr = %d;\n", $maxerr+1; + printf "const char * const sys_errlist[%d] = {\n", $maxerr+1; + foreach $e ( sort(keys(%errors)) ) { + printf " [%s] = \"%s\",\n", $errors{$e}, $errmsg{$e}; + } + print "};\n"; +} elsif ( $type eq '-errnos' ) { + print "#include \n"; + printf "const int sys_nerr = %d;\n", $maxerr+1; + printf "const char * const sys_errlist[%d] = {\n", $maxerr+1; + foreach $e ( sort(keys(%errors)) ) { + printf " [%s] = \"%s\",\n", $errors{$e}, $errors{$e}; + } + print "};\n"; +} elsif ( $type eq '-maxerr' ) { + print $maxerr, "\n"; +} + + diff --git a/klibc/klibc/malloc.c b/klibc/klibc/malloc.c new file mode 100644 index 0000000000..20a2350d71 --- /dev/null +++ b/klibc/klibc/malloc.c @@ -0,0 +1,192 @@ +/* + * malloc.c + * + * Very simple linked-list based malloc()/free(). + */ + +#include +#include +#include "malloc.h" + +struct free_arena_header __malloc_head = +{ + { + ARENA_TYPE_HEAD, + 0, + &__malloc_head, + &__malloc_head, + }, + &__malloc_head, + &__malloc_head +}; + +static void *__malloc_from_block(struct free_arena_header *fp, size_t size) +{ + size_t fsize; + struct free_arena_header *nfp, *na; + + fsize = fp->a.size; + + /* We need the 2* to account for the larger requirements of a free block */ + if ( fsize >= size+2*sizeof(struct arena_header) ) { + /* Bigger block than required -- split block */ + nfp = (struct free_arena_header *)((char *)fp + size); + na = fp->a.next; + + nfp->a.type = ARENA_TYPE_FREE; + nfp->a.size = fsize-size; + fp->a.type = ARENA_TYPE_USED; + fp->a.size = size; + + /* Insert into all-block chain */ + nfp->a.prev = fp; + nfp->a.next = na; + na->a.prev = nfp; + fp->a.next = nfp; + + /* Replace current block on free chain */ + nfp->next_free = fp->next_free; + nfp->prev_free = fp->prev_free; + fp->next_free->prev_free = nfp; + fp->prev_free->next_free = nfp; + } else { + /* Allocate the whole block */ + fp->a.type = ARENA_TYPE_USED; + + /* Remove from free chain */ + fp->next_free->prev_free = fp->prev_free; + fp->prev_free->next_free = fp->next_free; + } + + return (void *)(&fp->a + 1); +} + +static struct free_arena_header * +__free_block(struct free_arena_header *ah) +{ + struct free_arena_header *pah, *nah; + + pah = ah->a.prev; + nah = ah->a.next; + if ( pah->a.type == ARENA_TYPE_FREE && + (char *)pah+pah->a.size == (char *)ah ) { + /* Coalesce into the previous block */ + pah->a.size += ah->a.size; + pah->a.next = nah; + nah->a.prev = pah; + +#ifdef DEBUG_MALLOC + ah->a.type = ARENA_TYPE_DEAD; +#endif + + ah = pah; + pah = ah->a.prev; + } else { + /* Need to add this block to the free chain */ + ah->a.type = ARENA_TYPE_FREE; + + ah->next_free = __malloc_head.next_free; + ah->prev_free = &__malloc_head; + __malloc_head.next_free = ah; + ah->next_free->prev_free = ah; + } + + /* In either of the previous cases, we might be able to merge + with the subsequent block... */ + if ( nah->a.type == ARENA_TYPE_FREE && + (char *)ah+ah->a.size == (char *)nah ) { + ah->a.size += nah->a.size; + + /* Remove the old block from the chains */ + nah->next_free->prev_free = nah->prev_free; + nah->prev_free->next_free = nah->next_free; + ah->a.next = nah->a.next; + nah->a.next->a.prev = ah; + +#ifdef DEBUG_MALLOC + nah->a.type = ARENA_TYPE_DEAD; +#endif + } + + /* Return the block that contains the called block */ + return ah; +} + +void *malloc(size_t size) +{ + struct free_arena_header *fp; + struct free_arena_header *pah; + size_t fsize; + + if ( size == 0 ) + return NULL; + + /* Add the obligatory arena header, and round up */ + size = (size+2*sizeof(struct arena_header)-1) & ARENA_SIZE_MASK; + + for ( fp = __malloc_head.next_free ; fp->a.type != ARENA_TYPE_HEAD ; + fp = fp->next_free ) { + if ( fp->a.size >= size ) { + /* Found fit -- allocate out of this block */ + return __malloc_from_block(fp, size); + } + } + + /* Nothing found... need to request a block from the kernel */ + fsize = (size+MALLOC_CHUNK_MASK) & ~MALLOC_CHUNK_MASK; + fp = (struct free_arena_header *) + mmap(NULL, fsize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); + + if ( fp == (struct free_arena_header *)MAP_FAILED ) { + return NULL; /* Failed to get a block */ + } + + /* Insert the block into the management chains. We need to set + up the size and the main block list pointer, the rest of + the work is logically identical to free(). */ + fp->a.type = ARENA_TYPE_FREE; + fp->a.size = fsize; + + /* We need to insert this into the main block list in the proper + place -- this list is required to be sorted. Since we most likely + get memory assignments in ascending order, search backwards for + the proper place. */ + for ( pah = __malloc_head.a.prev ; pah->a.type != ARENA_TYPE_HEAD ; + pah = pah->a.prev ) { + if ( pah < fp ) + break; + } + + /* Now pah points to the node that should be the predecessor of + the new node */ + fp->a.next = pah->a.next; + fp->a.prev = pah; + pah->a.next = fp; + fp->a.next->a.prev = fp; + + + /* Insert into the free chain and coalesce with adjacent blocks */ + fp = __free_block(fp); + + /* Now we can allocate from this block */ + return __malloc_from_block(fp, size); +} + +void free(void *ptr) +{ + struct free_arena_header *ah; + + if ( !ptr ) + return; + + ah = (struct free_arena_header *) + ((struct arena_header *)ptr - 1); + +#ifdef DEBUG_MALLOC + assert( ah->a.type == ARENA_TYPE_USED ); +#endif + + __free_block(ah); + + /* Here we could insert code to return memory to the system. */ +} diff --git a/klibc/klibc/malloc.h b/klibc/klibc/malloc.h new file mode 100644 index 0000000000..e053f71401 --- /dev/null +++ b/klibc/klibc/malloc.h @@ -0,0 +1,51 @@ +/* + * malloc.h + * + * Internals for the memory allocator + */ + +#include +#include + +/* + * This is the minimum chunk size we will ask the kernel for; this should + * be a multiple of the page size on all architectures. + */ +#define MALLOC_CHUNK_SIZE 65536 +#define MALLOC_CHUNK_MASK (MALLOC_CHUNK_SIZE-1) + +/* + * This structure should be a power of two. This becomes the + * alignment unit. + */ +struct free_arena_header; + +struct arena_header { + size_t type; + size_t size; /* Also gives the location of the next entry */ + struct free_arena_header *next, *prev; +}; + +#ifdef DEBUG_MALLOC +#define ARENA_TYPE_USED 0x64e69c70 +#define ARENA_TYPE_FREE 0x012d610a +#define ARENA_TYPE_HEAD 0x971676b5 +#define ARENA_TYPE_DEAD 0xeeeeeeee +#else +#define ARENA_TYPE_USED 0 +#define ARENA_TYPE_FREE 1 +#define ARENA_TYPE_HEAD 2 +#endif + +#define ARENA_SIZE_MASK (~(sizeof(struct arena_header)-1)) + +/* + * This structure should be no more than twice the size of the + * previous structure. + */ +struct free_arena_header { + struct arena_header a; + struct free_arena_header *next_free, *prev_free; +}; + +extern struct free_arena_header __malloc_head; diff --git a/klibc/klibc/memccpy.c b/klibc/klibc/memccpy.c new file mode 100644 index 0000000000..22f68deaad --- /dev/null +++ b/klibc/klibc/memccpy.c @@ -0,0 +1,23 @@ +/* + * memccpy.c + * + * memccpy() + */ + +#include +#include + +void *memccpy(void *dst, const void *src, int c, size_t n) +{ + char *q = dst; + const char *p = src; + char ch; + + while ( n-- ) { + *q++ = ch = *p++; + if ( ch == (char)c ) + return q; + } + + return NULL; /* No instance of "c" found */ +} diff --git a/klibc/klibc/memchr.c b/klibc/klibc/memchr.c new file mode 100644 index 0000000000..c5c5fa2963 --- /dev/null +++ b/klibc/klibc/memchr.c @@ -0,0 +1,18 @@ +/* + * memchr.c + */ + +#include +#include + +void *memchr(const void *s, int c, size_t n) +{ + const unsigned char *sp = s; + + while ( n-- ) { + if ( *sp == (unsigned char)c ) + return (void *)sp; + } + + return NULL; +} diff --git a/klibc/klibc/memcmp.c b/klibc/klibc/memcmp.c new file mode 100644 index 0000000000..f6bc17286f --- /dev/null +++ b/klibc/klibc/memcmp.c @@ -0,0 +1,19 @@ +/* + * memcmp.c + */ + +#include + +int memcmp(const void *s1, const void *s2, size_t n) +{ + const unsigned char *c1 = s1, *c2 = s2; + int d = 0; + + while ( n-- ) { + d = (int)*c1++ - (int)*c2++; + if ( d ) + break; + } + + return d; +} diff --git a/klibc/klibc/memcpy.c b/klibc/klibc/memcpy.c new file mode 100644 index 0000000000..b9171c300d --- /dev/null +++ b/klibc/klibc/memcpy.c @@ -0,0 +1,29 @@ +/* + * memcpy.c + */ + +#include +#include + +void *memcpy(void *dst, const void *src, size_t n) +{ + const char *p = src; + char *q = dst; +#if defined(__i386__) + size_t nl = n >> 2; + asm volatile("cld ; rep ; movsl ; movl %3,%0 ; rep ; movsb" + : "+c" (nl), "+S" (p), "+D" (q) + : "r" (n & 3)); +#elif defined(__x86_64__) + size_t nq = n >> 3; + asm volatile("cld ; rep ; movsq ; movl %3,%%ecx ; rep ; movsb" + : "+c" (nq), "+S" (p), "+D" (q) + : "r" ((uint32_t)(n & 7))); +#else + while ( n-- ) { + *q++ = *p++; + } +#endif + + return dst; +} diff --git a/klibc/klibc/memmem.c b/klibc/klibc/memmem.c new file mode 100644 index 0000000000..0f59938ffb --- /dev/null +++ b/klibc/klibc/memmem.c @@ -0,0 +1,44 @@ +/* + * memmem.c + * + * Find a byte string inside a longer byte string + * + * This uses the "Not So Naive" algorithm, a very simple but + * usually effective algorithm, see: + * + * http://www-igm.univ-mlv.fr/~lecroq/string/ + */ + +#include + +void *memmem(const void *haystack, size_t n, const void *needle, size_t m) +{ + const unsigned char *y = (const unsigned char *)haystack; + const unsigned char *x = (const unsigned char *)needle; + + size_t j, k, l; + + if ( m > n ) + return NULL; + + if ( x[0] == x[1] ) { + k = 2; + l = 1; + } else { + k = 1; + l = 2; + } + + j = 0; + while ( j <= n-m ) { + if (x[1] != y[j+1]) { + j += k; + } else { + if ( !memcmp(x+2, y+j+2, m-2) && x[0] == y[j] ) + return (void *)&y[j]; + j += l; + } + } + + return NULL; +} diff --git a/klibc/klibc/memmove.c b/klibc/klibc/memmove.c new file mode 100644 index 0000000000..c1f042af39 --- /dev/null +++ b/klibc/klibc/memmove.c @@ -0,0 +1,34 @@ +/* + * memmove.c + */ + +#include + +void *memmove(void *dst, const void *src, size_t n) +{ + const char *p = src; + char *q = dst; +#if defined(__i386__) || defined(__x86_64__) + if ( q < p ) { + asm volatile("cld ; rep ; movsb" : "+c" (n), "+S" (p), "+D" (q)); + } else { + p += (n-1); + q += (n-1); + asm volatile("std ; rep ; movsb" : "+c" (n), "+S" (p), "+D" (q)); + } +#else + if ( q < p ) { + while ( n-- ) { + *q++ = *p++; + } + } else { + p += n; + q += n; + while ( n-- ) { + *--q = *--p; + } + } +#endif + + return dst; +} diff --git a/klibc/klibc/memset.c b/klibc/klibc/memset.c new file mode 100644 index 0000000000..522cc59a1e --- /dev/null +++ b/klibc/klibc/memset.c @@ -0,0 +1,30 @@ +/* + * memset.c + */ + +#include +#include + +void *memset(void *dst, int c, size_t n) +{ + char *q = dst; + +#if defined(__i386__) + size_t nl = n >> 2; + asm volatile("cld ; rep ; stosl ; movl %3,%0 ; rep ; stosb" + : "+c" (nl), "+D" (q) + : "a" ((unsigned char)c * 0x01010101U), "r" (n & 3)); +#elif defined(__x86_64__) + size_t nq = n >> 3; + asm volatile("cld ; rep ; stosq ; movl %3,%%ecx ; rep ; stosb" + : "+c" (nq), "+D" (q) + : "a" ((unsigned char)c * 0x0101010101010101U), + "r" ((uint32_t)n & 7)); +#else + while ( n-- ) { + *q++ = c; + } +#endif + + return dst; +} diff --git a/klibc/klibc/memswap.c b/klibc/klibc/memswap.c new file mode 100644 index 0000000000..10440e3499 --- /dev/null +++ b/klibc/klibc/memswap.c @@ -0,0 +1,23 @@ +/* + * memswap() + * + * Swaps the contents of two nonoverlapping memory areas. + * This really could be done faster... + */ + +#include + +void memswap(void *m1, void *m2, size_t n) +{ + char *p = m1; + char *q = m2; + char tmp; + + while ( n-- ) { + tmp = *p; + *p = *q; + *q = tmp; + + p++; q++; + } +} diff --git a/klibc/klibc/mmap.c b/klibc/klibc/mmap.c new file mode 100644 index 0000000000..3d28cba601 --- /dev/null +++ b/klibc/klibc/mmap.c @@ -0,0 +1,51 @@ +/* + * mmap.c + */ + +#include +#include +#include +#include +#include /* For PAGE_SHIFT */ + +#if defined(__sparc__) +# define MMAP2_SHIFT 12 /* Fixed by syscall definition */ +#else +# define MMAP2_SHIFT PAGE_SHIFT +#endif +#define MMAP2_MASK ((1UL << MMAP2_SHIFT)-1) + +/* + * Prefer mmap2() over mmap(), except on the architectures listed + */ + +#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) + +/* This architecture uses mmap2() */ + +static inline _syscall6(void *,mmap2,void *,start,size_t,length,int,prot,int,flags,int,fd,off_t,offset); + +/* The Linux mmap2() system call takes a page offset as the offset argument. + We need to make sure we have the proper conversion in place. */ + +void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) +{ + if ( offset & MMAP2_MASK ) { + errno = EINVAL; + return MAP_FAILED; + } + + return mmap2(start, length, prot, flags, fd, (size_t)offset >> MMAP2_SHIFT); +} + +#else + +/* This architecture uses a plain mmap() system call */ +/* Only use this for architectures where mmap() is a real 6-argument system call! */ + +_syscall6(void *,mmap,void *,start,size_t,length,int,prot,int,flags,int,fd,off_t,offset) + +#endif + + + diff --git a/klibc/klibc/nice.c b/klibc/klibc/nice.c new file mode 100644 index 0000000000..f0d97a3cd0 --- /dev/null +++ b/klibc/klibc/nice.c @@ -0,0 +1,22 @@ +/* + * nice.c + */ + +#include +#include +#include +#include + +#ifdef __NR_nice + +_syscall1(int,nice,int,inc); + +#else + +int nice(int inc) +{ + pid_t me = getpid(); + return setpriority(me, PRIO_PROCESS, getpriority(me, PRIO_PROCESS)+inc); +} + +#endif diff --git a/klibc/klibc/onexit.c b/klibc/klibc/onexit.c new file mode 100644 index 0000000000..70a9c01f61 --- /dev/null +++ b/klibc/klibc/onexit.c @@ -0,0 +1,39 @@ +/* + * onexit.c + */ + +#include +#include +#include "atexit.h" + +extern __noreturn (*__exit_handler)(int); +static struct atexit *__atexit_list; + +static __noreturn on_exit_exit(int rv) +{ + struct atexit *ap; + + for ( ap = __atexit_list ; ap ; ap = ap->next ) { + ap->fctn(rv, ap->arg); /* This assumes extra args are harmless */ + } + + _exit(rv); +} + +int on_exit(void (*fctn)(int, void *), void *arg) +{ + struct atexit *as = malloc(sizeof(struct atexit)); + + if ( !as ) + return -1; + + as->fctn = fctn; + as->arg = arg; + + as->next = __atexit_list; + __atexit_list = as; + + __exit_handler = on_exit_exit; + + return 0; +} diff --git a/klibc/klibc/pause.c b/klibc/klibc/pause.c new file mode 100644 index 0000000000..5748728472 --- /dev/null +++ b/klibc/klibc/pause.c @@ -0,0 +1,21 @@ +/* + * pause.c + */ + +#include +#include +#include +#include + +#ifdef __NR_pause + +_syscall0(int,pause); + +#else + +int pause(void) +{ + return select(0,NULL,NULL,NULL,NULL); +} + +#endif diff --git a/klibc/klibc/perror.c b/klibc/klibc/perror.c new file mode 100644 index 0000000000..45585cd577 --- /dev/null +++ b/klibc/klibc/perror.c @@ -0,0 +1,12 @@ +/* + * perror.c + */ + +#include +#include +#include + +void perror(const char *s) +{ + fprintf(stderr, "%s: error %d\n", s, errno); +} diff --git a/klibc/klibc/printf.c b/klibc/klibc/printf.c new file mode 100644 index 0000000000..34237592d6 --- /dev/null +++ b/klibc/klibc/printf.c @@ -0,0 +1,19 @@ +/* + * printf.c + */ + +#include +#include + +#define BUFFER_SIZE 16384 + +int printf(const char *format, ...) +{ + va_list ap; + int rv; + + va_start(ap, format); + rv = vfprintf(stdout, format, ap); + va_end(ap); + return rv; +} diff --git a/klibc/klibc/pty.c b/klibc/klibc/pty.c new file mode 100644 index 0000000000..5907ca2ff5 --- /dev/null +++ b/klibc/klibc/pty.c @@ -0,0 +1,31 @@ +/* + * pty.c + * + * Basic Unix98 PTY functionality; assumes devpts + */ + +#include +#include +#include +#include +#include + +char *ptsname(int fd) +{ + static char buffer[32]; /* Big enough to hold even a 64-bit pts no */ + unsigned int ptyno; + + if ( ioctl(fd, TIOCGPTN, &ptyno) ) + return NULL; + + snprintf(buffer, sizeof buffer, "/dev/pts/%u", ptyno); + + return buffer; +} + +int unlockpt(int fd) +{ + int unlock = 0; + + return ioctl(fd, TIOCSPTLCK, &unlock); +} diff --git a/klibc/klibc/puts.c b/klibc/klibc/puts.c new file mode 100644 index 0000000000..ecebf275da --- /dev/null +++ b/klibc/klibc/puts.c @@ -0,0 +1,13 @@ +/* + * puts.c + */ + +#include + +int puts(const char *s) +{ + if ( fputs(s, stdout) < 0 ) + return -1; + + return _fwrite("\n", 1, stdout); +} diff --git a/klibc/klibc/qsort.c b/klibc/klibc/qsort.c new file mode 100644 index 0000000000..e2197ea2ae --- /dev/null +++ b/klibc/klibc/qsort.c @@ -0,0 +1,42 @@ +/* + * qsort.c + * + * This is actually combsort. It's an O(n log n) algorithm with + * simplicity/small code size being its main virtue. + */ + +#include +#include + +static inline size_t newgap(size_t gap) +{ + gap = (gap*10)/13; + if ( gap == 9 || gap == 10 ) + gap = 11; + + if ( gap < 1 ) + gap = 1; + return gap; +} + +void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) +{ + size_t gap = nmemb; + size_t i, j; + void *p1, *p2; + int swapped; + + do { + gap = newgap(gap); + swapped = 0; + + for ( i = 0, p1 = base ; i < nmemb-gap ; i++, (char *)p1 += size ) { + j = i+gap; + if ( compar(p1, p2 = (char *)base+j*size) > 0 ) { + memswap(p1, p2, size); + swapped = 1; + } + } + } while ( gap > 1 || swapped ); +} + diff --git a/klibc/klibc/raise.c b/klibc/klibc/raise.c new file mode 100644 index 0000000000..dcbb9c9c6c --- /dev/null +++ b/klibc/klibc/raise.c @@ -0,0 +1,11 @@ +/* + * raise.c + */ + +#include +#include + +int raise(int signal) +{ + return kill(getpid(), signal); +} diff --git a/klibc/klibc/readdir.c b/klibc/klibc/readdir.c new file mode 100644 index 0000000000..bb216a1951 --- /dev/null +++ b/klibc/klibc/readdir.c @@ -0,0 +1,66 @@ +/* + * opendir/readdir/closedir + */ + +#include +#include +#include +#include +#include + +#define __IO_DIR_DEFINED +struct _IO_dir { + int fd; + size_t bytes_left; + struct dirent *next; + struct dirent buffer[15]; /* 15 times max dirent size =~ 4K */ +}; + +#include + +DIR *opendir(const char *name) +{ + DIR *dp = malloc(sizeof(DIR)); + + if ( !dp ) + return NULL; + + dp->fd = open(name, O_DIRECTORY|O_RDONLY); + + if ( dp->fd < 0 ) { + free(dp); + return NULL; + } + + dp->bytes_left = 0; + + return dp; +} + +struct dirent *readdir(DIR *dir) +{ + struct dirent *dent; + int rv; + + if ( !dir->bytes_left ) { + rv = getdents(dir->fd, dir->buffer, sizeof(dir->buffer)); + if ( rv <= 0 ) + return NULL; + dir->bytes_left = rv; + dir->next = dir->buffer; + } + + dent = dir->next; + ((char *)dir->next) += dent->d_reclen; + dir->bytes_left -= dent->d_reclen; + + return dent; +} + +int closedir(DIR *dir) +{ + int rv; + rv = close(dir->fd); + free(dir); + return rv; +} diff --git a/klibc/klibc/realloc.c b/klibc/klibc/realloc.c new file mode 100644 index 0000000000..577c2001a5 --- /dev/null +++ b/klibc/klibc/realloc.c @@ -0,0 +1,49 @@ +/* + * realloc.c + */ + +#include +#include + +#include "malloc.h" + +/* FIXME: This is cheesy, it should be fixed later */ + +void *realloc(void *ptr, size_t size) +{ + struct free_arena_header *ah; + void *newptr; + size_t oldsize; + + if ( !ptr ) + return malloc(size); + + if ( size == 0 ) { + free(ptr); + return NULL; + } + + /* Add the obligatory arena header, and round up */ + size = (size+2*sizeof(struct arena_header)-1) & ARENA_SIZE_MASK; + + ah = (struct free_arena_header *) + ((struct arena_header *)ptr - 1); + + if ( ah->a.size >= size && size >= (ah->a.size >> 2) ) { + /* This field is a good size already. */ + return ptr; + } else { + /* Make me a new block. This is kind of bogus; we should + be checking the adjacent blocks to see if we can do an + in-place adjustment... fix that later. */ + + oldsize = ah->a.size - sizeof(struct arena_header); + + newptr = malloc(size); + memcpy(newptr, ptr, (size < oldsize) ? size : oldsize); + free(ptr); + + return newptr; + } +} + diff --git a/klibc/klibc/reboot.c b/klibc/klibc/reboot.c new file mode 100644 index 0000000000..772c85910e --- /dev/null +++ b/klibc/klibc/reboot.c @@ -0,0 +1,15 @@ +/* + * reboot.c + */ + +#include +#include +#include + +/* This provides the one-argument glibc-ish version of reboot. + The full four-argument system call is available as __reboot(). */ + +int reboot(int flag) +{ + return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, flag, NULL); +} diff --git a/klibc/klibc/recv.c b/klibc/klibc/recv.c new file mode 100644 index 0000000000..4d30610cee --- /dev/null +++ b/klibc/klibc/recv.c @@ -0,0 +1,11 @@ +/* + * recv.c + */ + +#include +#include + +int recv(int s, void *buf, size_t len, unsigned int flags) +{ + return recvfrom(s, buf, len, flags, NULL, 0); +} diff --git a/klibc/klibc/sbrk.c b/klibc/klibc/sbrk.c new file mode 100644 index 0000000000..03ab3c14bb --- /dev/null +++ b/klibc/klibc/sbrk.c @@ -0,0 +1,23 @@ +/* sbrk.c - Change data segment size */ + +/* Written 2000 by Werner Almesberger */ + +#include +#include +#include + +char *__current_brk; /* Common with brk.c */ + +void *sbrk(ptrdiff_t increment) +{ + char *old_brk, *new_brk; + + if (!__current_brk) + __current_brk = __brk(NULL); + new_brk = __brk(__current_brk+increment); + if (new_brk != __current_brk+increment) + return (void *) -1; + old_brk = __current_brk; + __current_brk = new_brk; + return old_brk; +} diff --git a/klibc/klibc/seed48.c b/klibc/klibc/seed48.c new file mode 100644 index 0000000000..f8353c8715 --- /dev/null +++ b/klibc/klibc/seed48.c @@ -0,0 +1,19 @@ +/* + * seed48.c + */ + +#include +#include +#include + +extern unsigned short __rand48_seed[3]; + +unsigned short *seed48(const unsigned short xsubi[3]) +{ + static unsigned short oldseed[3]; + memcpy(oldseed, __rand48_seed, sizeof __rand48_seed); + memcpy(__rand48_seed, xsubi, sizeof __rand48_seed); + + return oldseed; +} + diff --git a/klibc/klibc/select.c b/klibc/klibc/select.c new file mode 100644 index 0000000000..2404bb1e64 --- /dev/null +++ b/klibc/klibc/select.c @@ -0,0 +1,9 @@ +#include +#include + +#ifdef __NR__newselect +#undef __NR_select +#define __NR_select __NR__newselect +#endif + +_syscall5(int,select,int,a0,fd_set *,a1,fd_set *,a2,fd_set *,a3,struct timeval *,a4); diff --git a/klibc/klibc/send.c b/klibc/klibc/send.c new file mode 100644 index 0000000000..8c53d0f764 --- /dev/null +++ b/klibc/klibc/send.c @@ -0,0 +1,11 @@ +/* + * send.c + */ + +#include +#include + +int send(int s, const void *buf, size_t len, unsigned int flags) +{ + return sendto(s, buf, len, flags, NULL, 0); +} diff --git a/klibc/klibc/setegid.c b/klibc/klibc/setegid.c new file mode 100644 index 0000000000..09f2416e43 --- /dev/null +++ b/klibc/klibc/setegid.c @@ -0,0 +1,10 @@ +/* + * setegid.c + */ + +#include + +int setegid(gid_t egid) +{ + return setregid(-1, egid); +} diff --git a/klibc/klibc/setenv.c b/klibc/klibc/setenv.c new file mode 100644 index 0000000000..d1118ff3ed --- /dev/null +++ b/klibc/klibc/setenv.c @@ -0,0 +1,124 @@ +/* + * setenv.c + */ + +#include +#include +#include +#include + +/* Initialized to zero, meaning "not malloc'd" */ +static size_t __environ_size; + +/* str should be a duplicated version of the input string; + len is the length of the key including the = sign */ +static int _putenv(char *str, size_t len, int overwrite) +{ + char **p, *q; + char **newenv; + size_t n; + + n = 1; /* Include space for final NULL */ + for ( p = environ ; (q = *p) ; p++ ) { + n++; + if ( !strncmp(q,str,len) ) { + if ( overwrite ) + free(str); + else + *p = str; /* Memory leak... */ + return 0; + } + } + + /* Need to extend the environment */ + if ( n < __environ_size ) { + p[1] = NULL; + *p = str; + return 0; + } else { + if ( __environ_size ) { + newenv = realloc(environ, (__environ_size << 1)*sizeof(char *)); + if ( !newenv ) + return -1; + + __environ_size <<= 1; + } else { + /* Make a reasonable guess how much more space we need */ + size_t newsize = n+32; + newenv = malloc(newsize*sizeof(char *)); + if ( !newenv ) + return -1; + + memcpy(newenv, environ, n*sizeof(char *)); + __environ_size = newsize; + } + newenv[n+1] = NULL; + newenv[n] = str; + environ = newenv; + } + return 0; +} + +int putenv(const char *str) +{ + char *s; + const char *e, *z; + size_t len; + + if ( !str ) { + errno = EINVAL; + return -1; + } + + len = 0; e = NULL; + for ( z = str ; *z ; z++ ) { + len++; + if ( *z == '=' ) + e = z; + } + + if ( !e ) { + errno = EINVAL; + return -1; + } + + s = strdup(str); + if ( !s ) + return -1; + + return _putenv(s, len, 1); +} + +int setenv(const char *name, const char *val, int overwrite) +{ + const char *z; + char *s; + size_t l1, l2; + + if ( !name || !name[0] ) { + errno = EINVAL; + return -1; + } + + l1 = 0; + for ( z = name ; *z ; z++ ) { + l1++; + if ( *z == '=' ) { + errno = EINVAL; + return -1; + } + } + + l2 = strlen(val); + + s = malloc(l1+l2+2); + if ( !s ) + return -1; + + memcpy(s, name, l1); + s[l1] = '='; + memcpy(s+l1+1, val, l2); + s[l1+l2+1] = '\0'; + + return _putenv(s, l1+1, overwrite); +} diff --git a/klibc/klibc/seteuid.c b/klibc/klibc/seteuid.c new file mode 100644 index 0000000000..6d1ac3922a --- /dev/null +++ b/klibc/klibc/seteuid.c @@ -0,0 +1,10 @@ +/* + * seteuid.c + */ + +#include + +int seteuid(uid_t euid) +{ + return setreuid(-1, euid); +} diff --git a/klibc/klibc/setpgrp.c b/klibc/klibc/setpgrp.c new file mode 100644 index 0000000000..001dd0435d --- /dev/null +++ b/klibc/klibc/setpgrp.c @@ -0,0 +1,10 @@ +/* + * setpgrp.c + */ + +#include + +int setpgrp(void) +{ + return setpgid(0,0); +} diff --git a/klibc/klibc/setresgid.c b/klibc/klibc/setresgid.c new file mode 100644 index 0000000000..f1a8c6b45c --- /dev/null +++ b/klibc/klibc/setresgid.c @@ -0,0 +1,29 @@ +/* + * setresgid.c + */ + +#include +#include + +#ifdef __NR_setresgid + +_syscall3(int,setresgid,gid_t,a0,gid_t,a1,gid_t,a2); + +#elif defined(__NR_setresgid32) + +static inline _syscall3(int,setresgid32,gid_t,a0,gid_t,a1,gid_t,a2); + +int setresgid(gid_t a0, gid_t a1, gid_t a2) +{ + if ( sizeof(gid_t) == sizeof(uint32_t) ) { + return setresgid32(a0,a1,a2); + } else { + uint32_t x0 = (a0 == (gid_t)-1) ? (uint32_t)-1 : a0; + uint32_t x1 = (a1 == (gid_t)-1) ? (uint32_t)-1 : a1; + uint32_t x2 = (a2 == (gid_t)-1) ? (uint32_t)-1 : a2; + + return setresgid32(x0,x1,x2); + } +} + +#endif diff --git a/klibc/klibc/setresuid.c b/klibc/klibc/setresuid.c new file mode 100644 index 0000000000..a587acbae3 --- /dev/null +++ b/klibc/klibc/setresuid.c @@ -0,0 +1,30 @@ +/* + * setresuid.c + */ + +#include +#include + +#ifdef __NR_setresuid + +_syscall3(int,setresuid,uid_t,a0,uid_t,a1,uid_t,a2); + +#elif defined(__NR_setresuid32) + +static inline _syscall3(int,setresuid32,uid_t,a0,uid_t,a1,uid_t,a2); + +int setresuid(uid_t a0, uid_t a1, uid_t a2) +{ + if ( sizeof(uid_t) == sizeof(uint32_t) ) { + return setresuid32(a0,a1,a2); + } else { + uint32_t x0 = (a0 == (uid_t)-1) ? (uint32_t)-1 : a0; + uint32_t x1 = (a1 == (uid_t)-1) ? (uint32_t)-1 : a1; + uint32_t x2 = (a2 == (uid_t)-1) ? (uint32_t)-1 : a2; + + return setresuid32(x0,x1,x2); + } +} + +#endif + diff --git a/klibc/klibc/sha1hash.c b/klibc/klibc/sha1hash.c new file mode 100644 index 0000000000..600d51248c --- /dev/null +++ b/klibc/klibc/sha1hash.c @@ -0,0 +1,317 @@ +/* +SHA-1 in C +By Steve Reid +100% Public Domain + +----------------- +Modified 7/98 +By James H. Brown +Still 100% Public Domain + +Corrected a problem which generated improper hash values on 16 bit machines +Routine SHA1Update changed from + void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int +len) +to + void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned +long len) + +The 'len' parameter was declared an int which works fine on 32 bit machines. +However, on 16 bit machines an int is too small for the shifts being done +against +it. This caused the hash function to generate incorrect values if len was +greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update(). + +Since the file IO in main() reads 16K at a time, any file 8K or larger would +be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million +"a"s). + +I also changed the declaration of variables i & j in SHA1Update to +unsigned long from unsigned int for the same reason. + +These changes should make no difference to any 32 bit implementations since +an +int and a long are the same size in those environments. + +-- +I also corrected a few compiler warnings generated by Borland C. +1. Added #include for exit() prototype +2. Removed unused variable 'j' in SHA1Final +3. Changed exit(0) to return(0) at end of main. + +ALL changes I made can be located by searching for comments containing 'JHB' +----------------- +Modified 8/98 +By Steve Reid +Still 100% public domain + +1- Removed #include and used return() instead of exit() +2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall) +3- Changed email address from steve@edmweb.com to sreid@sea-to-sky.net + +----------------- +Modified 4/01 +By Saul Kravitz +Still 100% PD +Modified to run on Compaq Alpha hardware. + +----------------- +Modified 2/03 +By H. Peter Anvin +Still 100% PD +Modified to run on any hardware with and +Changed the driver program + +*/ + +/* +Test Vectors (from FIPS PUB 180-1) +"abc" + A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D +"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" + 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 +A million repetitions of "a" + 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F +*/ + +/* #define SHA1HANDSOFF */ + +#include +#include +#include +#include /* For htonl/ntohl/htons/ntohs */ + +/* #include */ /* prototype for exit() - JHB */ +/* Using return() instead of exit() - SWR */ + +typedef struct { + uint32_t state[5]; + uint32_t count[2]; + unsigned char buffer[64]; +} SHA1_CTX; + +void SHA1Transform(uint32_t state[5], unsigned char buffer[64]); +void SHA1Init(SHA1_CTX* context); +void SHA1Update(SHA1_CTX* context, unsigned char* data, uint32_t len); /* +JHB */ +void SHA1Final(unsigned char digest[20], SHA1_CTX* context); + +#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) + +/* blk0() and blk() perform the initial expand. */ +/* I got the idea of expanding during the round function from SSLeay */ +#define blk0(i) (block->l[i] = ntohl(block->l[i])) +#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ + ^block->l[(i+2)&15]^block->l[i&15],1)) + +/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ +#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); +#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); +#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); + + +#ifdef VERBOSE /* SAK */ +void SHAPrintContext(SHA1_CTX *context, char *msg){ + printf("%s (%d,%d) %x %x %x %x %x\n", + msg, + context->count[0], context->count[1], + context->state[0], + context->state[1], + context->state[2], + context->state[3], + context->state[4]); +} +#endif + +/* Hash a single 512-bit block. This is the core of the algorithm. */ + +void SHA1Transform(uint32_t state[5], unsigned char buffer[64]) +{ +uint32_t a, b, c, d, e; +typedef union { + unsigned char c[64]; + uint32_t l[16]; +} CHAR64LONG16; +CHAR64LONG16* block; +#ifdef SHA1HANDSOFF +static unsigned char workspace[64]; + block = (CHAR64LONG16*)workspace; + memcpy(block, buffer, 64); +#else + block = (CHAR64LONG16*)buffer; +#endif + /* Copy context->state[] to working vars */ + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + /* 4 rounds of 20 operations each. Loop unrolled. */ + R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); + R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); + R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); + R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); + R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); + R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); + R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); + R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); + R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); + R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); + R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); + R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); + R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); + R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); + R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); + R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); + R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); + R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); + R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); + R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); + /* Add the working vars back into context.state[] */ + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + /* Wipe variables */ + a = b = c = d = e = 0; +} + + +/* SHA1Init - Initialize new context */ + +void SHA1Init(SHA1_CTX* context) +{ + /* SHA1 initialization constants */ + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; + context->state[4] = 0xC3D2E1F0; + context->count[0] = context->count[1] = 0; +} + + +/* Run your data through this. */ + +void SHA1Update(SHA1_CTX* context, unsigned char* data, uint32_t len) /* +JHB */ +{ +uint32_t i, j; /* JHB */ + +#ifdef VERBOSE + SHAPrintContext(context, "before"); +#endif + j = (context->count[0] >> 3) & 63; + if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; + context->count[1] += (len >> 29); + if ((j + len) > 63) { + memcpy(&context->buffer[j], data, (i = 64-j)); + SHA1Transform(context->state, context->buffer); + for ( ; i + 63 < len; i += 64) { + SHA1Transform(context->state, &data[i]); + } + j = 0; + } + else i = 0; + memcpy(&context->buffer[j], &data[i], len - i); +#ifdef VERBOSE + SHAPrintContext(context, "after "); +#endif +} + + +/* Add padding and return the message digest. */ + +void SHA1Final(unsigned char digest[20], SHA1_CTX* context) +{ +uint32_t i; /* JHB */ +unsigned char finalcount[8]; + + for (i = 0; i < 8; i++) { + finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] + >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ + } + SHA1Update(context, (unsigned char *)"\200", 1); + while ((context->count[0] & 504) != 448) { + SHA1Update(context, (unsigned char *)"\0", 1); + } + SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() +*/ + for (i = 0; i < 20; i++) { + digest[i] = (unsigned char) + ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); + } + /* Wipe variables */ + i = 0; /* JHB */ + memset(context->buffer, 0, 64); + memset(context->state, 0, 20); + memset(context->count, 0, 8); + memset(finalcount, 0, 8); /* SWR */ +#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */ + SHA1Transform(context->state, context->buffer); +#endif +} + +/*************************************************************/ + +/* This is not quite the MIME base64 algorithm: it uses _ instead of /, + and instead of padding the output with = characters we just make the + output shorter. */ +char *mybase64(uint8_t digest[20]) +{ + static const char charz[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_"; + uint8_t input[21]; + static char output[28]; + int i, j; + uint8_t *p; + char *q; + uint32_t bv; + + memcpy(input, digest, 20); + input[20] = 0; /* Pad to multiple of 3 bytes */ + + p = input; q = output; + for ( i = 0 ; i < 7 ; i++ ) { + bv = (p[0] << 16) | (p[1] << 8) | p[2]; + p += 3; + for ( j = 0 ; j < 4 ; j++ ) { + *q++ = charz[(bv >> 18) & 0x3f]; + bv <<= 6; + } + } + *--q = '\0'; /* The last character is not significant */ + return output; +} + +int main(int argc, char** argv) +{ + int i, j; + SHA1_CTX context; + uint8_t digest[20], buffer[16384]; + FILE* file; + + if (argc < 2) { + file = stdin; + } + else { + if (!(file = fopen(argv[1], "rb"))) { + fputs("Unable to open file.", stderr); + return(-1); + } + } + SHA1Init(&context); + while (!feof(file)) { /* note: what if ferror(file) */ + i = fread(buffer, 1, 16384, file); + SHA1Update(&context, buffer, i); + } + SHA1Final(digest, &context); + fclose(file); + + puts(mybase64(digest)); + + return 0; +} diff --git a/klibc/klibc/sigaction.c b/klibc/klibc/sigaction.c new file mode 100644 index 0000000000..ebd34710f1 --- /dev/null +++ b/klibc/klibc/sigaction.c @@ -0,0 +1,19 @@ +/* + * sigaction.c + */ + +#include +#include + +#ifdef __NR_sigaction + +_syscall3(int,sigaction,int,sig,const struct sigaction *,act,struct sigaction *,oact); + +#else + +int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) +{ + return rt_sigaction(sig, act, oact, sizeof(sigset_t)); +} + +#endif diff --git a/klibc/klibc/siglist.c b/klibc/klibc/siglist.c new file mode 100644 index 0000000000..dce7355079 --- /dev/null +++ b/klibc/klibc/siglist.c @@ -0,0 +1,115 @@ +/* + * siglist.h + * + * Construct the signal list + */ + +#include +#include + +const char * const sys_siglist[NSIG] = { +#ifdef SIGABRT + [SIGABRT] = "Aborted", +#endif +#ifdef SIGALRM + [SIGALRM] = "Alarm clock", +#endif +#ifdef SIGBUS + [SIGBUS] = "Bus error", +#endif +#ifdef SIGCHLD + [SIGCHLD] = "Child exited", +#endif +#if defined(SIGCLD) && (SIGCHLD != SIGCLD) + [SIGCLD] = "Child exited", +#endif +#ifdef SIGEMT + [SIGEMT] = "Emulation trap", +#endif +#ifdef SIGFPE + [SIGFPE] = "Floating point exception", +#endif +#ifdef SIGHUP + [SIGHUP] = "Hangup", +#endif +#ifdef SIGILL + [SIGILL] = "Illegal instruction", +#endif + /* SIGINFO == SIGPWR */ +#ifdef SIGINT + [SIGINT] = "Interrupt", +#endif +#ifdef SIGIO + [SIGIO] = "I/O possible", +#endif +#if defined(SIGIOT) && (SIGIOT != SIGABRT) + [SIGIOT] = "I/O trap", +#endif +#ifdef SIGKILL + [SIGKILL] = "Killed", +#endif +#if defined(SIGLOST) && (SIGLOST != SIGIO) && (SIGLOST != SIGPWR) + [SIGLOST] = "Lock lost", +#endif +#ifdef SIGPIPE + [SIGPIPE] = "Broken pipe", +#endif +#if defined(SIGPOLL) && (SIGPOLL != SIGIO) + [SIGPOLL] = "Pollable event", +#endif +#ifdef SIGPROF + [SIGPROF] = "Profiling timer expired", +#endif +#ifdef SIGPWR + [SIGPWR] = "Power failure", +#endif +#ifdef SIGQUIT + [SIGQUIT] = "Quit", +#endif + /* SIGRESERVE == SIGUNUSED */ +#ifdef SIGSEGV + [SIGSEGV] = "Segment violation", +#endif +#ifdef SIGSTKFLT + [SIGSTKFLT] = "Stack fault", +#endif +#ifdef SIGSTOP + [SIGSTOP] = "Stopped (signal)", +#endif +#ifdef SIGSYS + [SIGSYS] = "Bad system call", +#endif +#ifdef SIGTERM + [SIGTERM] = "Terminated", +#endif +#ifdef SIGTSTP + [SIGTSTP] = "Stopped", +#endif +#ifdef SIGTTIN + [SIGTTIN] = "Stopped (tty input)", +#endif +#ifdef SIGTTOU + [SIGTTOU] = "Stopped (tty output)", +#endif +#ifdef SIGURG + [SIGURG] = "Urgent I/O condition", +#endif +#ifdef SIGUSR1 + [SIGUSR1] = "User signal 1", +#endif +#ifdef SIGUSR2 + [SIGUSR2] = "User signal 2", +#endif +#ifdef SIGVTALRM + [SIGVTALRM] = "Virtual timer expired", +#endif +#ifdef SIGWINCH + [SIGWINCH] = "Window size changed", +#endif +#ifdef SIGXCPU + [SIGXCPU] = "CPU time limit exceeded", +#endif +#ifdef SIGXFSZ + [SIGXFSZ] = "File size limit exceeded", +#endif +}; diff --git a/klibc/klibc/siglongjmp.c b/klibc/klibc/siglongjmp.c new file mode 100644 index 0000000000..2ba1239b6b --- /dev/null +++ b/klibc/klibc/siglongjmp.c @@ -0,0 +1,16 @@ +/* + * siglongjmp.c + * + * sigsetjmp() is a macro, by necessity (it's either that or write + * it in assembly), but siglongjmp() is a normal function. + */ + +#include +#include + +__noreturn siglongjmp(sigjmp_buf buf, int retval) +{ + sigprocmask(SIG_SETMASK, &buf->__sigs, NULL); + longjmp(buf->__jmpbuf, retval); +} + diff --git a/klibc/klibc/signal.c b/klibc/klibc/signal.c new file mode 100644 index 0000000000..982d0c659d --- /dev/null +++ b/klibc/klibc/signal.c @@ -0,0 +1,11 @@ +/* + * signal.c + */ + +#include + +__sighandler_t signal(int signum, __sighandler_t handler) +{ + /* Linux/SysV signal() semantics */ + return __signal(signum, handler, SA_RESETHAND); +} diff --git a/klibc/klibc/sigpending.c b/klibc/klibc/sigpending.c new file mode 100644 index 0000000000..afbcf3cf34 --- /dev/null +++ b/klibc/klibc/sigpending.c @@ -0,0 +1,19 @@ +/* + * sigpending.c + */ + +#include +#include + +#ifdef __NR_sigpending + +_syscall1(int,sigpending,sigset_t *,set); + +#else + +int sigpending(sigset_t *set) +{ + return rt_sigpending(set, sizeof(sigset_t)); +} + +#endif diff --git a/klibc/klibc/sigprocmask.c b/klibc/klibc/sigprocmask.c new file mode 100644 index 0000000000..3a90f67732 --- /dev/null +++ b/klibc/klibc/sigprocmask.c @@ -0,0 +1,19 @@ +/* + * sigprocmask.c + */ + +#include +#include + +#ifdef __NR_sigprocmask + +_syscall3(int,sigprocmask,int,how,const sigset_t *,set,sigset_t *,oset); + +#else + +int sigprocmask(int how, const sigset_t *set, sigset_t *oset) +{ + return rt_sigprocmask(how, set, oset, sizeof(sigset_t)); +} + +#endif diff --git a/klibc/klibc/sigsuspend.c b/klibc/klibc/sigsuspend.c new file mode 100644 index 0000000000..85cdea20ca --- /dev/null +++ b/klibc/klibc/sigsuspend.c @@ -0,0 +1,19 @@ +/* + * sigsuspend.c + */ + +#include +#include + +#ifdef __NR_sigsuspend + +_syscall1(int,sigsuspend,const sigset_t *,mask); + +#else + +int sigsuspend(const sigset_t *mask) +{ + return rt_sigsuspend(mask, sizeof *mask); +} + +#endif diff --git a/klibc/klibc/sleep.c b/klibc/klibc/sleep.c new file mode 100644 index 0000000000..eb3777e8a6 --- /dev/null +++ b/klibc/klibc/sleep.c @@ -0,0 +1,20 @@ +/* + * sleep.c + */ + +#include +#include + +unsigned int sleep(unsigned int seconds) +{ + struct timespec ts; + + ts.tv_sec = seconds; + ts.tv_nsec = 0; + if ( !nanosleep(&ts,&ts) ) + return 0; + else if ( errno == EINTR ) + return ts.tv_sec; + else + return -1; +} diff --git a/klibc/klibc/snprintf.c b/klibc/klibc/snprintf.c new file mode 100644 index 0000000000..c642851b2f --- /dev/null +++ b/klibc/klibc/snprintf.c @@ -0,0 +1,16 @@ +/* + * snprintf.c + */ + +#include + +int snprintf(char *buffer, size_t n, const char *format, ...) +{ + va_list ap; + int rv; + + va_start(ap, format); + rv = vsnprintf(buffer, n, format, ap); + va_end(ap); + return rv; +} diff --git a/klibc/klibc/socketcalls.pl b/klibc/klibc/socketcalls.pl new file mode 100644 index 0000000000..cf4daf6036 --- /dev/null +++ b/klibc/klibc/socketcalls.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl +($arch, $file) = @ARGV; + +if (!open(FILE, "< $file")) { + print STDERR "$file: $!\n"; + exit(1); +} + +while ( defined($line = ) ) { + chomp $line; + $line =~ s/\s*\#.*$//; # Strip comments and trailing blanks + next unless $line; + + if ( $line =~ /^\s*(.*)\s+([_a-zA-Z][_a-zA-Z0-9]+)\s*\((.*)\)$/ ) { + $type = $1; + $name = $2; + $argv = $3; + + @args = split(/\s*\,\s*/, $argv); + @cargs = (); + + $i = 0; + for $arg ( @args ) { + push(@cargs, "$arg a".$i++); + } + $nargs = $i; + + if ( $arch eq 'i386' ) { + open(OUT, "> socketcalls/${name}.S") + or die "$0: Cannot open socketcalls/${name}.S\n"; + + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.text\n"; + print OUT "\t.align 4\n"; + print OUT "\t.globl ${name}\n"; + print OUT "\t.type ${name},\@function\n"; + print OUT "${name}:\n"; + print OUT "\tmovb \$SYS_\U${name}\E,%al\n"; + print OUT "\tjmp __socketcall_common\n"; + print OUT "\t.size ${name},.-${name}\n"; + } else { + open(OUT, "> socketcalls/${name}.c") + or die "$0: Cannot open socketcalls/${name}.c\n"; + print OUT "#include \"socketcommon.h\"\n\n"; + + print OUT "#ifdef __NR_$name\n\n"; + print OUT "_syscall", scalar(@args), "(", $type, ',', $name; + $i = 0; + foreach $arg ( @args ) { + print OUT ",", $arg, ",a",$i++; + } + print OUT ");\n"; + print OUT "\n#else\n\n"; + + print OUT "$type $name (", join(', ', @cargs), ")\n"; + print OUT "{\n"; + print OUT " unsigned long args[$nargs];\n"; + for ( $i = 0 ; $i < $nargs ; $i++ ) { + print OUT " args[$i] = (unsigned long)a$i;\n"; + } + print OUT " return ($type) socketcall(SYS_\U${name}\E, args);\n"; + print OUT "}\n"; + print OUT "\n#endif\n"; + } + close(OUT); + } else { + print STDERR "$file:$.: Could not parse input\n"; + exit(1); + } +} diff --git a/klibc/klibc/socketcommon.h b/klibc/klibc/socketcommon.h new file mode 100644 index 0000000000..7a5acaadaf --- /dev/null +++ b/klibc/klibc/socketcommon.h @@ -0,0 +1,25 @@ +/* + * socketcommon.h + * + * Common header file for socketcall stubs + */ + +#define __IN_SYS_COMMON +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Some architectures have socketcall(), some have real syscalls, + * and some have both, but the syscall version is always preferred. + * Look for __NR_ to probe for the existence of a syscall. + */ + +#ifdef __NR_socketcall +static inline _syscall2(int,socketcall,int,call,unsigned long *,args); +#endif diff --git a/klibc/klibc/sprintf.c b/klibc/klibc/sprintf.c new file mode 100644 index 0000000000..31f28af005 --- /dev/null +++ b/klibc/klibc/sprintf.c @@ -0,0 +1,18 @@ +/* + * sprintf.c + */ + +#include +#include + +int sprintf(char *buffer, const char *format, ...) +{ + va_list ap; + int rv; + + va_start(ap, format); + rv = vsnprintf(buffer, ~(size_t)0, format, ap); + va_end(ap); + + return rv; +} diff --git a/klibc/klibc/srand48.c b/klibc/klibc/srand48.c new file mode 100644 index 0000000000..a3df16d95c --- /dev/null +++ b/klibc/klibc/srand48.c @@ -0,0 +1,16 @@ +/* + * srand48.c + */ + +#include +#include + +extern unsigned short __rand48_seed[3]; + + +void srand48(long seedval) +{ + __rand48_seed[0] = 0x330e; + __rand48_seed[1] = (unsigned short)seedval; + __rand48_seed[2] = (unsigned short)((uint32_t)seedval >> 16); +} diff --git a/klibc/klibc/sscanf.c b/klibc/klibc/sscanf.c new file mode 100644 index 0000000000..81aab9e05b --- /dev/null +++ b/klibc/klibc/sscanf.c @@ -0,0 +1,17 @@ +/* + * sscanf() + */ + +#include + +int sscanf(const char *str, const char *format, ...) +{ + va_list ap; + int rv; + + va_start(ap, format); + rv = vsscanf(str, format, ap); + va_end(ap); + + return rv; +} diff --git a/klibc/klibc/strcat.c b/klibc/klibc/strcat.c new file mode 100644 index 0000000000..a5f9477866 --- /dev/null +++ b/klibc/klibc/strcat.c @@ -0,0 +1,11 @@ +/* + * strcat.c + */ + +#include + +char *strcat(char *dst, const char *src) +{ + strcpy(strchr(dst, '\0'), src); + return dst; +} diff --git a/klibc/klibc/strchr.c b/klibc/klibc/strchr.c new file mode 100644 index 0000000000..192f83600c --- /dev/null +++ b/klibc/klibc/strchr.c @@ -0,0 +1,16 @@ +/* + * strchr.c + */ + +#include + +char *strchr(const char *s, int c) +{ + while ( *s != (char)c ) { + if ( ! *s ) + return NULL; + s++; + } + + return (char *)s; +} diff --git a/klibc/klibc/strcmp.c b/klibc/klibc/strcmp.c new file mode 100644 index 0000000000..f44774f443 --- /dev/null +++ b/klibc/klibc/strcmp.c @@ -0,0 +1,20 @@ +/* + * strcmp.c + */ + +#include + +int strcmp(const char *s1, const char *s2) +{ + const unsigned char *c1 = s1, *c2 = s2; + unsigned char ch; + int d = 0; + + while ( 1 ) { + d = (int)(ch = *c1++) - (int)*c2++; + if ( d || !ch ) + break; + } + + return d; +} diff --git a/klibc/klibc/strcpy.c b/klibc/klibc/strcpy.c new file mode 100644 index 0000000000..8372eba50b --- /dev/null +++ b/klibc/klibc/strcpy.c @@ -0,0 +1,20 @@ +/* + * strcpy.c + * + * strcpy() + */ + +#include + +char *strcpy(char *dst, const char *src) +{ + char *q = dst; + const char *p = src; + char ch; + + do { + *q++ = ch = *p++; + } while ( ch ); + + return dst; +} diff --git a/klibc/klibc/strdup.c b/klibc/klibc/strdup.c new file mode 100644 index 0000000000..eb170c2645 --- /dev/null +++ b/klibc/klibc/strdup.c @@ -0,0 +1,17 @@ +/* + * strdup.c + */ + +#include +#include + +char *strdup(const char *s) +{ + int l = strlen(s)+1; + char *d = malloc(l); + + if ( d ) + memcpy(d, s, l); + + return d; +} diff --git a/klibc/klibc/strerror.c b/klibc/klibc/strerror.c new file mode 100644 index 0000000000..754a30693c --- /dev/null +++ b/klibc/klibc/strerror.c @@ -0,0 +1,25 @@ +/* + * strerror.c + */ + +#include + +char *strerror(int errnum) +{ + static char message[32] = "error "; /* enough for error 2^63-1 */ + + char numbuf[32]; + char *p; + int len; + + p = numbuf+sizeof numbuf; + *--p = '\0'; + + do { + *--p = (errnum % 10) + '0'; + errnum /= 10; + } while ( errnum ); + + return (char *)memcpy(message+6, p, (numbuf+sizeof numbuf)-p); +} + diff --git a/klibc/klibc/strlen.c b/klibc/klibc/strlen.c new file mode 100644 index 0000000000..4d773f9a05 --- /dev/null +++ b/klibc/klibc/strlen.c @@ -0,0 +1,14 @@ +/* + * strlen() + */ + +#include + +size_t strlen(const char *s) +{ + const char *ss = s; + while ( *ss ) + ss++; + return ss-s; +} + diff --git a/klibc/klibc/strncat.c b/klibc/klibc/strncat.c new file mode 100644 index 0000000000..99d957594c --- /dev/null +++ b/klibc/klibc/strncat.c @@ -0,0 +1,11 @@ +/* + * strncat.c + */ + +#include + +char *strncat(char *dst, const char *src, size_t n) +{ + strncpy(strchr(dst, '\0'), src, n); + return dst; +} diff --git a/klibc/klibc/strncmp.c b/klibc/klibc/strncmp.c new file mode 100644 index 0000000000..98a41c3773 --- /dev/null +++ b/klibc/klibc/strncmp.c @@ -0,0 +1,20 @@ +/* + * strncmp.c + */ + +#include + +int strncmp(const char *s1, const char *s2, size_t n) +{ + const unsigned char *c1 = s1, *c2 = s2; + unsigned char ch; + int d = 0; + + while ( n-- ) { + d = (int)*c2++ - (int)(ch = *c1++); + if ( d || !ch ) + break; + } + + return d; +} diff --git a/klibc/klibc/strncpy.c b/klibc/klibc/strncpy.c new file mode 100644 index 0000000000..a8fe45fcbb --- /dev/null +++ b/klibc/klibc/strncpy.c @@ -0,0 +1,22 @@ +/* + * strncpy.c + * + * strncpy() + */ + +#include + +char *strncpy(char *dst, const char *src, size_t n) +{ + char *q = dst; + const char *p = src; + char ch; + + while ( n-- ) { + *q++ = ch = *p++; + if ( !ch ) + break; + } + + return dst; +} diff --git a/klibc/klibc/strntoimax.c b/klibc/klibc/strntoimax.c new file mode 100644 index 0000000000..f53a266dba --- /dev/null +++ b/klibc/klibc/strntoimax.c @@ -0,0 +1,13 @@ +/* + * strntoimax.c + * + * strntoimax() + */ + +#include +#include + +intmax_t strntoimax(const char *nptr, char **endptr, int base, size_t n) +{ + return (intmax_t) strntoumax(nptr, endptr, base, n); +} diff --git a/klibc/klibc/strntoumax.c b/klibc/klibc/strntoumax.c new file mode 100644 index 0000000000..4e30637d2c --- /dev/null +++ b/klibc/klibc/strntoumax.c @@ -0,0 +1,75 @@ +/* + * strntoumax.c + * + * The strntoumax() function and associated + */ + +#include +#include +#include + +static inline int digitval(int ch) +{ + if ( ch >= '0' && ch <= '9' ) { + return ch-'0'; + } else if ( ch >= 'A' && ch <= 'Z' ) { + return ch-'A'+10; + } else if ( ch >= 'a' && ch <= 'z' ) { + return ch-'a'+10; + } else { + return -1; + } +} + +uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n) +{ + int minus = 0; + uintmax_t v = 0; + int d; + + while ( n && isspace((unsigned char)*nptr) ) { + nptr++; + n--; + } + + /* Single optional + or - */ + if ( n && *nptr == '-' ) { + minus = 1; + nptr++; + n--; + } else if ( n && *nptr == '+' ) { + nptr++; + } + + if ( base == 0 ) { + if ( n >= 2 && nptr[0] == '0' && + (nptr[1] == 'x' || nptr[1] == 'X') ) { + n -= 2; + nptr += 2; + base = 16; + } else if ( n >= 1 && nptr[0] == '0' ) { + n--; + nptr++; + base = 8; + } else { + base = 10; + } + } else if ( base == 16 ) { + if ( n >= 2 && nptr[0] == '0' && + (nptr[1] == 'x' || nptr[1] == 'X') ) { + n -= 2; + nptr += 2; + } + } + + while ( n && (d = digitval(*nptr)) >= 0 && d < base ) { + v = v*base + d; + n--; + nptr++; + } + + if ( endptr ) + *endptr = (char *)nptr; + + return minus ? -v : v; +} diff --git a/klibc/klibc/strrchr.c b/klibc/klibc/strrchr.c new file mode 100644 index 0000000000..3b42464059 --- /dev/null +++ b/klibc/klibc/strrchr.c @@ -0,0 +1,18 @@ +/* + * strrchr.c + */ + +#include + +char *strrchr(const char *s, int c) +{ + const char *found = NULL; + + while ( *s ) { + if ( *s == (char) c ) + found = s; + s++; + } + + return (char *)found; +} diff --git a/klibc/klibc/strsep.c b/klibc/klibc/strsep.c new file mode 100644 index 0000000000..58a7a07773 --- /dev/null +++ b/klibc/klibc/strsep.c @@ -0,0 +1,21 @@ +/* + * strsep.c + */ + +#include + +char *strsep(char **stringp, const char *delim) +{ + char *s = *stringp; + char *e; + + if ( !s ) + return NULL; + + e = strpbrk(s, delim); + if (e) + *e++ = '\0'; + + *stringp = e; + return s; +} diff --git a/klibc/klibc/strspn.c b/klibc/klibc/strspn.c new file mode 100644 index 0000000000..856a964197 --- /dev/null +++ b/klibc/klibc/strspn.c @@ -0,0 +1,67 @@ +/* + * strspn, strcspn + */ + +#include +#include +#include +#include + +#ifndef LONG_BIT +#define LONG_BIT (CHAR_BIT*sizeof(long)) +#endif + +static inline void +set_bit(unsigned long *bitmap, unsigned int bit) +{ + bitmap[bit/LONG_BIT] |= 1UL << (bit%LONG_BIT); +} + +static inline int +test_bit(unsigned long *bitmap, unsigned int bit) +{ + return (int)(bitmap[bit/LONG_BIT] >> (bit%LONG_BIT)) & 1; +} + +static size_t +strxspn(const char *s, const char *map, int parity) +{ + unsigned long matchmap[((1 << CHAR_BIT)+LONG_BIT-1)/LONG_BIT]; + size_t n = 0; + + /* Create bitmap */ + memset(matchmap, 0, sizeof matchmap); + while ( *map ) + set_bit(matchmap, (unsigned char) *map++); + + /* Make sure the null character never matches */ + if ( parity ) + set_bit(matchmap, 0); + + /* Calculate span length */ + while ( test_bit(matchmap, (unsigned char) *s++)^parity ) + n++; + + return n; +} + +size_t +strspn(const char *s, const char *accept) +{ + return strxspn(s, accept, 0); +} + +size_t +strcspn(const char *s, const char *reject) +{ + return strxspn(s, reject, 1); +} + +char * +strpbrk(const char *s, const char *accept) +{ + const char *ss = s+strxspn(s, accept, 1); + + return *ss ? (char *)ss : NULL; +} + diff --git a/klibc/klibc/strstr.c b/klibc/klibc/strstr.c new file mode 100644 index 0000000000..10222dfd30 --- /dev/null +++ b/klibc/klibc/strstr.c @@ -0,0 +1,10 @@ +/* + * strstr.c + */ + +#include + +char *strstr(const char *haystack, const char *needle) +{ + return (char *)memmem(haystack, strlen(haystack), needle, strlen(needle)); +} diff --git a/klibc/klibc/strtoimax.c b/klibc/klibc/strtoimax.c new file mode 100644 index 0000000000..0cdd088e51 --- /dev/null +++ b/klibc/klibc/strtoimax.c @@ -0,0 +1,3 @@ +#define TYPE intmax_t +#define NAME strtoimax +#include "strtox.c" diff --git a/klibc/klibc/strtok.c b/klibc/klibc/strtok.c new file mode 100644 index 0000000000..6e84f1dff3 --- /dev/null +++ b/klibc/klibc/strtok.c @@ -0,0 +1,16 @@ +/* + * strtok.c + */ + +#include + +char *strtok(char *s, const char *delim) +{ + static char *holder; + + if ( s ) + holder = s; + + return strsep(&holder, delim); +} + diff --git a/klibc/klibc/strtol.c b/klibc/klibc/strtol.c new file mode 100644 index 0000000000..9efc8b9e4a --- /dev/null +++ b/klibc/klibc/strtol.c @@ -0,0 +1,3 @@ +#define TYPE signed long +#define NAME strtol +#include "strtox.c" diff --git a/klibc/klibc/strtoll.c b/klibc/klibc/strtoll.c new file mode 100644 index 0000000000..a9428c7f14 --- /dev/null +++ b/klibc/klibc/strtoll.c @@ -0,0 +1,3 @@ +#define TYPE signed long long +#define NAME strtoll +#include "strtox.c" diff --git a/klibc/klibc/strtoul.c b/klibc/klibc/strtoul.c new file mode 100644 index 0000000000..3189aaa7ce --- /dev/null +++ b/klibc/klibc/strtoul.c @@ -0,0 +1,3 @@ +#define TYPE unsigned long +#define NAME strtoul +#include "strtox.c" diff --git a/klibc/klibc/strtoull.c b/klibc/klibc/strtoull.c new file mode 100644 index 0000000000..83c14e9128 --- /dev/null +++ b/klibc/klibc/strtoull.c @@ -0,0 +1,3 @@ +#define TYPE unsigned long long +#define NAME strtoull +#include "strtox.c" diff --git a/klibc/klibc/strtoumax.c b/klibc/klibc/strtoumax.c new file mode 100644 index 0000000000..a3797105e8 --- /dev/null +++ b/klibc/klibc/strtoumax.c @@ -0,0 +1,3 @@ +#define TYPE uintmax_t +#define NAME strtoumax +#include "strtox.c" diff --git a/klibc/klibc/strtox.c b/klibc/klibc/strtox.c new file mode 100644 index 0000000000..7c228b6fa4 --- /dev/null +++ b/klibc/klibc/strtox.c @@ -0,0 +1,13 @@ +/* + * strtox.c + * + * strto...() functions, by macro definition + */ + +#include +#include + +TYPE NAME (const char *nptr, char **endptr, int base) +{ + return (TYPE) strntoumax(nptr, endptr, base, ~(size_t)0); +} diff --git a/klibc/klibc/syscalls.pl b/klibc/klibc/syscalls.pl new file mode 100644 index 0000000000..b530a9b8c7 --- /dev/null +++ b/klibc/klibc/syscalls.pl @@ -0,0 +1,81 @@ +#!/usr/bin/perl +($arch, $file) = @ARGV; + +if (!open(FILE, "< $file")) { + print STDERR "$file: $!\n"; + exit(1); +} + +while ( defined($line = ) ) { + chomp $line; + $line =~ s/\s*\#.*$//; # Strip comments and trailing blanks + next unless $line; + + if ( $line =~ /^\s*(\<[^\>]+\>\s+|)([^\(\<\>]+[^\@\:A-Za-z0-9_])([A-Za-z0-9_]+)(|\@[A-Za-z0-9_]+)(|\:\:[A-Za-z0-9_]+)\s*\(([^\:\)]*)\)\s*$/ ) { + $archs = $1; + $type = $2; + $sname = $3; + $stype = $4; + $fname = $5; + $argv = $6; + + $doit = 1; + if ( $archs ne '' ) { + die "$0: Internal error" + unless ( $archs =~ /^\<(|\!)([^\>\!]+)\>/ ); + $not = $1; + $list = $2; + + $doit = ($not eq '') ? 0 : 1; + + @list = split(/,/, $list); + foreach $a ( @list ) { + if ( $a eq $arch ) { + $doit = ($not eq '') ? 1 : 0; + last; + } + } + } + next if ( ! $doit ); + + $type =~ s/\s*$//; + + $stype =~ s/^\@/_/; + + if ( $fname eq '' ) { + $fname = $sname; + } else { + $fname =~ s/^\:\://; + } + + @args = split(/\s*\,\s*/, $argv); + + open(OUT, "> syscalls/${fname}.c") + or die "$0: Cannot open syscalls/${fname}.c\n"; + + if ( $fname eq "rt_sigaction") { + print OUT "#ifdef __x86_64__\n\n"; + print OUT "struct sigaction;\n\n"; + print OUT "#endif\n\n" + } + + print OUT "#include \"syscommon.h\"\n\n"; + + if ( $fname ne $sname ) { + print OUT "#undef __NR_${fname}\n"; + print OUT "#define __NR_${fname} __NR_${sname}\n\n"; + } + + print OUT "_syscall", scalar(@args), $stype, "(", $type, ',', $fname; + + $i = 0; + foreach $arg ( @args ) { + print OUT ",", $arg, ",a",$i++; + } + print OUT ");\n"; + close(OUT); + } else { + print STDERR "$file:$.: Could not parse input\n"; + exit(1); + } +} diff --git a/klibc/klibc/syscommon.h b/klibc/klibc/syscommon.h new file mode 100644 index 0000000000..224e240e38 --- /dev/null +++ b/klibc/klibc/syscommon.h @@ -0,0 +1,29 @@ +/* + * syscommon.h + * + * Common header file for system call stubs + */ + +#define __IN_SYS_COMMON +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/klibc/klibc/syslog.c b/klibc/klibc/syslog.c new file mode 100644 index 0000000000..b031d4f0e7 --- /dev/null +++ b/klibc/klibc/syslog.c @@ -0,0 +1,74 @@ +/* + * syslog.c + * + * Issue syslog messages via the kernel printk queue. + */ + +#include +#include +#include +#include +#include +#include + +/* Maximum size for a kernel message */ +#define BUFLEN 1024 + +/* Logging node */ +#define LOGDEV "/dev/kmsg" + +/* Max length of ID string */ +#define MAXID 31 + +int __syslog_fd = -1; +static char id[MAXID+1]; + +void openlog(const char *ident, int option, int facility) +{ + int fd; + + (void)option; (void)facility; /* Unused */ + + if ( __syslog_fd == -1 ) { + __syslog_fd = fd = open(LOGDEV, O_WRONLY); + if ( fd == -1 ) + return; + fcntl(fd, F_SETFD, (long)FD_CLOEXEC); + } + + strncpy(id, ident?ident:"", MAXID); + id[MAXID] = '\0'; /* Make sure it's null-terminated */ +} + +void syslog(int prio, const char *format, ...) +{ + va_list ap; + char buf[BUFLEN]; + int rv, len; + int fd; + + if ( __syslog_fd == -1 ) + openlog(NULL, 0, 0); + + fd = __syslog_fd; + if ( fd == -1 ) + fd = 2; /* Failed to open log, write to stderr */ + + buf[0] = '<'; + buf[1] = LOG_PRI(prio)+'0'; + buf[2] = '>'; + len = 3; + + if ( *id ) + len += sprintf(buf+3, "%s: ", id); + + va_start(ap, format); + rv = vsnprintf(buf+len, BUFLEN-len, format, ap); + va_end(ap); + + len += rv; + if ( len > BUFLEN-1 ) len = BUFLEN-1; + buf[len] = '\n'; + + write(fd, buf, len+1); +} diff --git a/klibc/klibc/system.c b/klibc/klibc/system.c new file mode 100644 index 0000000000..643bf5e1cc --- /dev/null +++ b/klibc/klibc/system.c @@ -0,0 +1,61 @@ +/* + * system.c + * + * The system() function. If this turns out to actually be *used*, + * we may want to try to detect the very simple cases (no shell magic) + * and handle them internally, instead of requiring that /bin/sh be + * present. + */ + +#include +#include +#include +#include +#include + +int system(const char *string) +{ + pid_t pid; + struct sigaction ignore, old_int, old_quit; + sigset_t masked, oldmask; + static const char *argv[] = { "/bin/sh", "-c", NULL, NULL }; + int status; + + /* Block SIGCHLD and ignore SIGINT and SIGQUIT */ + /* Do this before the fork() to avoid races */ + + ignore.sa_handler = SIG_IGN; + sigemptyset(&ignore.sa_mask); + ignore.sa_flags = 0; + sigaction(SIGINT, &ignore, &old_int); + sigaction(SIGQUIT, &ignore, &old_quit); + + sigemptyset(&masked); + sigaddset(&masked, SIGCHLD); + sigprocmask(SIG_BLOCK, &masked, &oldmask); + + pid = fork(); + + if ( pid < 0 ) + return -1; + else if ( pid == 0 ) { + sigaction(SIGINT, &old_int, NULL); + sigaction(SIGQUIT, &old_quit, NULL); + sigprocmask(SIG_SETMASK, &oldmask, NULL); + + argv[2] = string; + + execve(argv[0], (char * const *)argv, (char * const *)environ); + _exit(127); + } + + /* else... */ + + waitpid(pid, &status, 0); + + sigaction(SIGINT, &old_int, NULL); + sigaction(SIGQUIT, &old_quit, NULL); + sigprocmask(SIG_SETMASK, &oldmask, NULL); + + return status; +} diff --git a/klibc/klibc/tests/getenvtest.c b/klibc/klibc/tests/getenvtest.c new file mode 100644 index 0000000000..07cac0cef7 --- /dev/null +++ b/klibc/klibc/tests/getenvtest.c @@ -0,0 +1,26 @@ +#include +#include +#include + +int main(int argc, char *argv[], char *envp[]) +{ + int i; + + /* Verify envp == environ */ + printf("Verifying envp == environ... %s\n", + (envp == environ) ? "ok" : "ERROR"); + + /* Test argc/argv */ + printf("argc = %d, argv = %p\n", argc, argv); + for ( i = 0 ; i < argc ; i++ ) { + printf("argv[%2d] = %s\n", i, argv[i]); + } + + /* Test environ */ + printf("PATH = %s\n", getenv("PATH")); + printf("HOME = %s\n", getenv("HOME")); + printf("TERM = %s\n", getenv("TERM")); + printf("USER = %s\n", getenv("USER")); + + return 0; +} diff --git a/klibc/klibc/tests/getopttest.c b/klibc/klibc/tests/getopttest.c new file mode 100644 index 0000000000..90ceaa2c58 --- /dev/null +++ b/klibc/klibc/tests/getopttest.c @@ -0,0 +1,31 @@ +/* + * getopttest.c + * + * Simple test for getopt, set the environment variable GETOPTTEST + * to give the argument string to getopt() + */ + +#include +#include +#include + +int main(int argc, char * const *argv) +{ + const char *parser; + char showchar[] = "\'?\'"; + int c; + + parser = getenv("GETOPTTEST"); + if ( !parser ) parser = "abzf:o:"; + + do { + c = getopt(argc, argv, parser); + showchar[1] = c; + printf("c = %s, optind = %d (%s), optarg = \"%s\", optopt = \'%c\'\n", + (c == EOF) ? "EOF" : showchar, + optind, argv[optind], optarg, optopt); + } while ( c != -1 ); + + return 0; +} + diff --git a/klibc/klibc/tests/hello.c b/klibc/klibc/tests/hello.c new file mode 100644 index 0000000000..20457af153 --- /dev/null +++ b/klibc/klibc/tests/hello.c @@ -0,0 +1,7 @@ +#include + +int main(void) +{ + printf("Hello, World!\n"); + return 0; +} diff --git a/klibc/klibc/tests/idtest.c b/klibc/klibc/tests/idtest.c new file mode 100644 index 0000000000..c3c44479c5 --- /dev/null +++ b/klibc/klibc/tests/idtest.c @@ -0,0 +1,14 @@ +#include +#include + +int main(void) +{ + printf("pid = %u\n", getpid()); + printf("ppid = %u\n", getppid()); + printf("uid = %u\n", getuid()); + printf("euid = %u\n", geteuid()); + printf("gid = %u\n", getgid()); + printf("egid = %u\n", getegid()); + sleep(10); + return 0; +} diff --git a/klibc/klibc/tests/malloctest.c b/klibc/klibc/tests/malloctest.c new file mode 100644 index 0000000000..64e8e79851 --- /dev/null +++ b/klibc/klibc/tests/malloctest.c @@ -0,0 +1,4145 @@ +#include +#include +#include + +#define NCYCLES 4096 + +int sizes[NCYCLES] = { + 11986, + 277806, + 2659, + 46, + 0, + 775553, + 1991, + 21, + 7638, + 250197, + 155828, + 5777, + 9, + 315006, + 900788, + 0, + 24893, + 119996, + 72299, + 171266, + 357, + 560, + 368, + 22952, + 54058, + 12638, + 39155, + 2738, + 217563, + 26853, + 47, + 75, + 1167, + 16917, + 1899, + 2905, + 9337, + 62243, + 14214, + 270523, + 4024, + 21, + 32, + 14892, + 625144, + 13, + 21700, + 8804, + 254147, + 0, + 6, + 836004, + 1718, + 2289, + 15554, + 412857, + 185097, + 806709, + 64, + 18602, + 17064, + 1779, + 78153, + 170600, + 199100, + 546528, + 0, + 21, + 20609, + 16514, + 548196, + 311446, + 53484, + 0, + 551, + 22225, + 24, + 153989, + 457309, + 526833, + 227979, + 757167, + 429560, + 0, + 835, + 1702, + 475275, + 798416, + 753, + 0, + 11126, + 145779, + 2006, + 0, + 8182, + 0, + 569432, + 9671, + 36, + 5523, + 407325, + 0, + 65, + 9293, + 0, + 6793, + 468701, + 73, + 0, + 186236, + 0, + 328405, + 125616, + 508013, + 380519, + 599518, + 83, + 151973, + 466906, + 9029, + 159725, + 1316, + 1, + 911532, + 1508, + 19050, + 972850, + 126, + 439377, + 29, + 37928, + 149628, + 54, + 130248, + 2, + 143, + 0, + 716873, + 3327, + 5, + 116131, + 5124, + 559621, + 2886, + 534, + 186432, + 441, + 7348, + 10331, + 1, + 260935, + 7, + 4370, + 405415, + 2, + 84518, + 1970, + 1, + 281910, + 46, + 274, + 2273, + 370565, + 4190, + 820641, + 577970, + 32809, + 974893, + 398067, + 380698, + 4, + 25978, + 153, + 882668, + 312365, + 9523, + 156421, + 0, + 268143, + 6, + 2, + 42987, + 212, + 12303, + 6723, + 1179, + 0, + 120924, + 3877, + 330421, + 310445, + 39264, + 8, + 85380, + 464716, + 0, + 33657, + 6285, + 0, + 4491, + 229, + 50, + 373197, + 6029, + 19, + 86884, + 243745, + 335656, + 90945, + 38973, + 572950, + 164129, + 0, + 3, + 17, + 13579, + 4448, + 47, + 3, + 132966, + 726249, + 498503, + 256, + 0, + 25841, + 0, + 7, + 945380, + 11872, + 69, + 3799, + 77223, + 1914, + 73, + 810968, + 10223, + 257918, + 184252, + 350, + 8101, + 725, + 9, + 2, + 2089, + 175, + 247, + 185964, + 36517, + 3723, + 313465, + 209, + 1300, + 128071, + 7425, + 2436, + 62, + 13753, + 9514, + 41, + 409141, + 46643, + 20866, + 15664, + 388548, + 84692, + 9549, + 610, + 7213, + 14, + 14930, + 244719, + 4748, + 41682, + 401098, + 102506, + 176535, + 0, + 5133, + 548, + 5234, + 56, + 11101, + 87638, + 336579, + 291705, + 640250, + 768165, + 370, + 2809, + 3, + 0, + 445122, + 47190, + 24885, + 143556, + 84, + 504726, + 610020, + 40355, + 902230, + 4360, + 1747, + 3496, + 489501, + 19, + 801601, + 62189, + 48, + 2645, + 320601, + 27304, + 17740, + 344, + 10, + 991, + 925503, + 0, + 315, + 251, + 3611, + 1756, + 683, + 165, + 380132, + 181101, + 453041, + 892056, + 67191, + 252592, + 32407, + 56242, + 8, + 297173, + 542903, + 830334, + 585236, + 422555, + 44769, + 0, + 68, + 4143, + 38754, + 73539, + 44579, + 94001, + 428537, + 38554, + 106612, + 0, + 182987, + 831731, + 3605, + 752851, + 52, + 72, + 120872, + 963754, + 31, + 764, + 240592, + 99101, + 328538, + 440325, + 12211, + 151282, + 353436, + 2991, + 40710, + 5212, + 5106, + 139122, + 148915, + 498505, + 1366, + 516, + 29190, + 17, + 224208, + 40, + 89, + 19190, + 8, + 25377, + 10029, + 720, + 97963, + 0, + 614, + 244567, + 2113, + 903675, + 8388, + 6, + 390705, + 325006, + 284272, + 108086, + 17, + 2628, + 952530, + 20474, + 898276, + 138661, + 3883, + 903, + 569993, + 376918, + 5849, + 103404, + 794499, + 35388, + 5, + 0, + 961626, + 27415, + 1927, + 92036, + 46241, + 35978, + 7426, + 399884, + 29490, + 252655, + 675971, + 3509, + 54170, + 170790, + 831341, + 134579, + 0, + 790422, + 35, + 930830, + 97394, + 20265, + 670, + 38497, + 1759, + 71209, + 93, + 736, + 11, + 886, + 1961, + 7, + 210607, + 62226, + 186736, + 1518, + 5, + 5, + 13, + 66989, + 442321, + 0, + 607939, + 11253, + 210875, + 495530, + 2, + 221136, + 377663, + 372, + 200658, + 18591, + 129783, + 803411, + 867506, + 757446, + 48836, + 34, + 200, + 114983, + 7287, + 22849, + 226669, + 13, + 0, + 20164, + 7828, + 39, + 49448, + 26740, + 185566, + 9927, + 36192, + 91068, + 338368, + 926, + 27746, + 534794, + 936132, + 2922, + 5, + 183162, + 256846, + 242551, + 134318, + 212959, + 167162, + 470, + 477045, + 532116, + 483794, + 733, + 5335, + 83074, + 4686, + 9567, + 1, + 195100, + 40354, + 87338, + 369, + 800, + 0, + 194504, + 469051, + 363532, + 850574, + 5085, + 167027, + 794511, + 124320, + 303231, + 132195, + 13225, + 46333, + 4313, + 89, + 799, + 51482, + 0, + 26, + 12659, + 1045, + 23621, + 0, + 74926, + 490979, + 6, + 3188, + 9448, + 174730, + 38982, + 102317, + 189621, + 853, + 29227, + 43374, + 423, + 420951, + 686, + 128, + 31291, + 0, + 402819, + 663143, + 55903, + 142, + 2, + 331584, + 197164, + 7, + 671983, + 53, + 5020, + 9782, + 123, + 743407, + 1276, + 1115, + 1169, + 122752, + 824690, + 292030, + 2094, + 144626, + 0, + 297278, + 440, + 742, + 95879, + 17682, + 10654, + 31, + 22183, + 746, + 0, + 0, + 11185, + 28, + 394987, + 36, + 474, + 243749, + 1431, + 56702, + 76, + 15619, + 33071, + 12181, + 158647, + 261786, + 1, + 119783, + 48816, + 6278, + 4121, + 61122, + 69, + 48790, + 345335, + 275917, + 964393, + 424, + 586433, + 20519, + 18156, + 756400, + 27736, + 458706, + 1, + 3286, + 929624, + 1883, + 2, + 1086, + 439501, + 552, + 157132, + 5565, + 105061, + 8199, + 23, + 178797, + 0, + 130644, + 1, + 6952, + 754, + 500, + 647683, + 0, + 959079, + 622561, + 1131, + 559783, + 6862, + 175420, + 408671, + 463461, + 55908, + 606496, + 169, + 49060, + 247, + 953, + 333030, + 0, + 23399, + 29193, + 9303, + 15, + 515402, + 34961, + 365856, + 633043, + 173, + 556089, + 1809, + 12215, + 14, + 316, + 20642, + 9, + 15, + 190391, + 951463, + 25059, + 13654, + 385040, + 4272, + 929033, + 208813, + 35166, + 42849, + 662648, + 254811, + 4230, + 812459, + 681, + 390168, + 5381, + 4662, + 173257, + 478863, + 103, + 89332, + 0, + 0, + 589484, + 19369, + 94, + 9, + 639917, + 1110, + 393, + 101040, + 911, + 152899, + 0, + 2, + 0, + 0, + 335691, + 43694, + 62273, + 200121, + 2250, + 621004, + 149918, + 41063, + 218229, + 0, + 497924, + 16832, + 587071, + 0, + 0, + 729918, + 2, + 808513, + 9417, + 718, + 0, + 2769, + 28704, + 1335, + 734726, + 219157, + 786230, + 981004, + 350788, + 884529, + 0, + 87872, + 34647, + 85469, + 4524, + 339838, + 38228, + 0, + 4151, + 1145, + 0, + 351, + 167956, + 810075, + 689, + 251212, + 583068, + 2929, + 189456, + 2089, + 48749, + 278952, + 77134, + 0, + 0, + 45595, + 281829, + 969602, + 43999, + 69824, + 856982, + 61732, + 336, + 25488, + 213, + 46683, + 1909, + 174097, + 57930, + 91466, + 828418, + 95740, + 378828, + 128065, + 68068, + 0, + 13312, + 26006, + 6760, + 51, + 276081, + 640068, + 634985, + 7131, + 784882, + 790126, + 628585, + 205824, + 764965, + 17793, + 3159, + 649924, + 0, + 37383, + 9919, + 353, + 0, + 149003, + 620629, + 95928, + 2560, + 504343, + 1000, + 32, + 43836, + 407031, + 207, + 800894, + 3222, + 51028, + 7, + 6, + 22010, + 0, + 21174, + 12893, + 824932, + 7305, + 70, + 624258, + 372139, + 21504, + 387996, + 418931, + 914268, + 576, + 0, + 0, + 618224, + 787516, + 133014, + 422, + 383124, + 656318, + 4420, + 6082, + 244813, + 38585, + 3200, + 1, + 2, + 11882, + 113, + 45581, + 13121, + 95475, + 807219, + 8195, + 995116, + 13, + 2146, + 369925, + 60103, + 25, + 125165, + 51300, + 4894, + 173261, + 74186, + 1044, + 122992, + 1243, + 21703, + 26294, + 197, + 333825, + 426872, + 719580, + 3598, + 106, + 0, + 9932, + 61509, + 146, + 721428, + 964781, + 319850, + 573802, + 7458, + 317889, + 0, + 133086, + 87836, + 60496, + 304249, + 1565, + 27, + 42, + 899324, + 189637, + 8648, + 104570, + 901598, + 447765, + 24, + 108, + 120127, + 828626, + 8, + 899514, + 28, + 13, + 7576, + 163390, + 1625, + 3023, + 155175, + 2, + 391, + 1, + 493073, + 398, + 210771, + 26266, + 287999, + 38255, + 249666, + 598202, + 119601, + 216933, + 91205, + 0, + 7247, + 77077, + 565383, + 29102, + 253641, + 48855, + 19722, + 463536, + 40182, + 65393, + 829444, + 598402, + 1590, + 798, + 467, + 834847, + 3007, + 13711, + 0, + 195, + 101662, + 255749, + 129201, + 11965, + 1781, + 13349, + 3100, + 718066, + 99, + 712450, + 888215, + 42503, + 43171, + 494946, + 0, + 2175, + 12387, + 25662, + 78, + 739030, + 0, + 19, + 427526, + 4275, + 5583, + 0, + 2447, + 132398, + 26437, + 3873, + 440035, + 21, + 6, + 35432, + 41523, + 7179, + 712703, + 428868, + 2793, + 6, + 286277, + 1882, + 95116, + 2959, + 86, + 115425, + 81386, + 59836, + 37, + 247598, + 34732, + 249, + 500110, + 5589, + 40319, + 575, + 12145, + 385829, + 565600, + 582150, + 92, + 223209, + 0, + 910, + 1048, + 47329, + 90944, + 235, + 8739, + 686685, + 1753, + 126, + 434, + 609477, + 25021, + 6610, + 52675, + 4, + 717846, + 150864, + 418583, + 17751, + 513794, + 181362, + 329556, + 10426, + 717019, + 457, + 616, + 388984, + 17, + 8338, + 59531, + 32, + 99565, + 376146, + 134578, + 966, + 0, + 0, + 174, + 2105, + 555, + 8990, + 298, + 169932, + 247281, + 240918, + 298655, + 158743, + 15994, + 95708, + 51, + 2985, + 4294, + 731934, + 185640, + 1483, + 87, + 742033, + 9, + 1345, + 3680, + 133530, + 9355, + 800111, + 28508, + 0, + 369, + 31681, + 24, + 8237, + 313380, + 4732, + 275423, + 951592, + 0, + 41381, + 225515, + 393004, + 526, + 187, + 19515, + 6006, + 28923, + 310151, + 2390, + 374, + 0, + 19142, + 72, + 114, + 193305, + 24035, + 397067, + 18, + 14839, + 3473, + 164, + 104622, + 378958, + 2218, + 0, + 89053, + 105183, + 312265, + 82146, + 147210, + 3419, + 5178, + 34948, + 46836, + 41319, + 842825, + 595972, + 0, + 249625, + 325, + 608, + 372328, + 119634, + 7504, + 920214, + 7302, + 444532, + 359213, + 27265, + 1755, + 48, + 126799, + 651270, + 818220, + 799493, + 724024, + 64047, + 73699, + 206999, + 209, + 1581, + 0, + 42937, + 301144, + 73416, + 0, + 242058, + 29660, + 3, + 34709, + 162719, + 2863, + 3992, + 5212, + 151814, + 3092, + 198001, + 44331, + 36, + 407, + 364771, + 1349, + 502772, + 214726, + 607, + 388583, + 137660, + 337124, + 13279, + 10549, + 943075, + 164068, + 19157, + 38443, + 26351, + 0, + 67167, + 735, + 46486, + 130305, + 232330, + 744, + 882337, + 2, + 69275, + 126354, + 9370, + 2845, + 299, + 38988, + 37834, + 0, + 306433, + 9139, + 237132, + 0, + 500, + 13462, + 373684, + 107453, + 381924, + 347915, + 4329, + 1668, + 3960, + 370661, + 3614, + 636048, + 0, + 487449, + 64925, + 333894, + 11, + 52192, + 531200, + 155554, + 461, + 1547, + 994361, + 11955, + 321056, + 37425, + 14249, + 69151, + 621862, + 174, + 79607, + 34, + 77577, + 13723, + 267550, + 13801, + 698, + 12, + 171556, + 57354, + 676845, + 0, + 24965, + 908955, + 570483, + 0, + 296387, + 983966, + 85012, + 130298, + 151946, + 384474, + 731455, + 150699, + 772, + 216131, + 346, + 130935, + 3472, + 18, + 426045, + 677262, + 808, + 17030, + 5188, + 0, + 491153, + 67299, + 19, + 60342, + 69, + 0, + 76478, + 95763, + 0, + 28778, + 147869, + 335927, + 27846, + 2163, + 22750, + 162, + 23, + 11391, + 469099, + 5852, + 63, + 0, + 0, + 22193, + 165, + 489007, + 9249, + 12477, + 2841, + 223532, + 13877, + 173, + 3570, + 45477, + 233073, + 23296, + 64377, + 4910, + 8, + 76246, + 411147, + 287411, + 10450, + 3667, + 1, + 500933, + 31363, + 257, + 1705, + 6036, + 49934, + 13738, + 13485, + 61608, + 561978, + 76493, + 16377, + 1817, + 0, + 235600, + 0, + 16347, + 680478, + 5115, + 895607, + 138270, + 369912, + 53110, + 0, + 647083, + 85, + 458681, + 163227, + 52767, + 196, + 267719, + 14047, + 147293, + 814457, + 174896, + 0, + 34138, + 36, + 21575, + 3, + 0, + 0, + 38391, + 2597, + 2, + 1433, + 3807, + 36476, + 287, + 141530, + 29389, + 495655, + 30014, + 0, + 550766, + 11958, + 348, + 226760, + 15, + 251353, + 675788, + 518308, + 215, + 81987, + 409862, + 559596, + 114283, + 4925, + 0, + 17, + 14221, + 0, + 162, + 766370, + 4898, + 998, + 493, + 138418, + 265159, + 12152, + 5229, + 1204, + 1814, + 432530, + 2889, + 144, + 1149, + 35886, + 636931, + 6640, + 1508, + 414118, + 858, + 20039, + 17398, + 3, + 5094, + 6, + 13996, + 6754, + 362, + 451487, + 11471, + 7896, + 330009, + 244269, + 99928, + 0, + 14311, + 9949, + 15251, + 283923, + 123754, + 188360, + 93902, + 854384, + 548001, + 531788, + 26298, + 328479, + 941, + 246535, + 106320, + 28769, + 440, + 4, + 61262, + 55615, + 170, + 989327, + 692534, + 8063, + 445842, + 4434, + 255349, + 117781, + 6, + 9249, + 136216, + 38165, + 307012, + 12, + 2341, + 18062, + 371882, + 662154, + 12623, + 176847, + 332220, + 590935, + 33682, + 0, + 121374, + 67, + 46841, + 495890, + 640, + 19, + 14737, + 11032, + 17, + 5993, + 302562, + 827710, + 165346, + 49607, + 87863, + 308513, + 735300, + 1914, + 2900, + 207308, + 9068, + 83494, + 179, + 417, + 41605, + 74681, + 652171, + 4013, + 29811, + 13966, + 8136, + 78, + 61182, + 674187, + 0, + 331121, + 0, + 18559, + 386, + 77, + 348439, + 975358, + 18, + 33700, + 47396, + 204751, + 2350, + 26503, + 0, + 83653, + 446, + 10844, + 485, + 9241, + 88347, + 232419, + 936900, + 43250, + 2, + 26112, + 811955, + 20723, + 102069, + 42255, + 8431, + 119508, + 4080, + 13565, + 12, + 46110, + 62096, + 638777, + 44025, + 152985, + 13362, + 3, + 12331, + 193337, + 56419, + 14593, + 3837, + 282314, + 403454, + 48589, + 135, + 18350, + 2160, + 90, + 918216, + 7083, + 105534, + 742826, + 399028, + 1470, + 23770, + 480, + 677884, + 340472, + 107406, + 0, + 5002, + 445, + 748948, + 534012, + 592464, + 6539, + 819632, + 3138, + 4, + 39397, + 229683, + 12204, + 2439, + 65131, + 817226, + 22596, + 0, + 1046, + 94638, + 0, + 95403, + 1230, + 790056, + 19976, + 43085, + 14251, + 139187, + 20232, + 693, + 3058, + 27654, + 65690, + 40948, + 15001, + 21089, + 14425, + 322459, + 13571, + 228154, + 536814, + 761221, + 28030, + 2322, + 921, + 1, + 1137, + 187815, + 8, + 34911, + 4527, + 15, + 46, + 78801, + 0, + 73605, + 44, + 28233, + 1370, + 73409, + 198159, + 66586, + 3, + 2576, + 15, + 35460, + 263237, + 44997, + 2873, + 240, + 1781, + 269, + 46, + 272778, + 28404, + 8232, + 417073, + 234591, + 9, + 720349, + 1176, + 16195, + 0, + 9705, + 0, + 14, + 947048, + 163, + 76288, + 1115, + 267020, + 3416, + 414217, + 441004, + 95131, + 765002, + 6196, + 9069, + 27017, + 137039, + 65247, + 266489, + 484945, + 187008, + 45405, + 5700, + 9, + 7751, + 12, + 294, + 3093, + 6350, + 103303, + 6045, + 252345, + 140207, + 22390, + 234867, + 443326, + 1, + 0, + 89972, + 8637, + 427150, + 22146, + 0, + 310432, + 390333, + 10461, + 1632, + 31403, + 908653, + 0, + 6543, + 163479, + 67608, + 195543, + 315889, + 822964, + 383536, + 954954, + 1619, + 241, + 96053, + 104556, + 767302, + 2469, + 12, + 164330, + 78, + 141, + 170519, + 268214, + 53338, + 48342, + 721, + 58980, + 4345, + 1, + 856265, + 87289, + 57219, + 775679, + 123992, + 695804, + 113025, + 832, + 117420, + 16634, + 352, + 24729, + 14973, + 25622, + 131290, + 0, + 22, + 87740, + 5917, + 533, + 2934, + 34261, + 9174, + 0, + 1656, + 764587, + 54652, + 35597, + 36389, + 577889, + 63957, + 26808, + 34556, + 56, + 15641, + 137, + 1, + 3, + 11724, + 197397, + 39027, + 87902, + 320, + 791479, + 7, + 487864, + 0, + 433, + 25733, + 6956, + 15407, + 312557, + 526302, + 383019, + 340215, + 96, + 276158, + 6493, + 135613, + 2000, + 1218, + 930, + 276808, + 273249, + 8896, + 397, + 735095, + 20648, + 2079, + 5349, + 205, + 356313, + 841954, + 8255, + 266874, + 0, + 965, + 287993, + 1549, + 207833, + 75, + 178180, + 39072, + 0, + 43254, + 3847, + 227, + 2712, + 161043, + 463264, + 74720, + 795789, + 12, + 6812, + 202804, + 29379, + 64241, + 132121, + 790622, + 493588, + 0, + 48, + 147352, + 925197, + 38149, + 18380, + 0, + 270280, + 633, + 3373, + 31294, + 7830, + 0, + 0, + 11371, + 56143, + 5393, + 74724, + 495109, + 0, + 18993, + 21524, + 0, + 53889, + 400509, + 204563, + 0, + 11625, + 9635, + 0, + 1678, + 12096, + 59, + 817112, + 10002, + 128209, + 11593, + 17313, + 15200, + 106796, + 261401, + 707077, + 0, + 314030, + 798591, + 14175, + 5668, + 2766, + 0, + 566, + 5543, + 24112, + 154482, + 5642, + 0, + 38410, + 3, + 4, + 700724, + 25024, + 5, + 407, + 564150, + 672, + 143, + 2049, + 574708, + 65858, + 213412, + 3797, + 511, + 30907, + 1212, + 765, + 2127, + 481, + 130048, + 113816, + 39861, + 153169, + 503378, + 523944, + 111, + 55083, + 698, + 275, + 3, + 3195, + 1657, + 0, + 317881, + 6672, + 543, + 153011, + 77240, + 9338, + 889850, + 29518, + 872485, + 181927, + 376086, + 266, + 409, + 4, + 14856, + 31943, + 2448, + 8, + 75, + 383097, + 294366, + 0, + 173084, + 753160, + 66457, + 725783, + 51, + 127651, + 1073, + 12598, + 140080, + 0, + 296375, + 581720, + 217346, + 8272, + 2051, + 185390, + 520645, + 1260, + 13873, + 168040, + 19690, + 103347, + 295011, + 548404, + 48, + 4, + 916417, + 1948, + 621365, + 263245, + 2792, + 86803, + 181193, + 558081, + 50907, + 442770, + 51448, + 340276, + 1346, + 607, + 459627, + 0, + 30, + 73298, + 15389, + 12264, + 2719, + 2936, + 143043, + 209970, + 0, + 42, + 6657, + 317419, + 0, + 32622, + 524000, + 0, + 310331, + 303778, + 268710, + 9, + 10410, + 25343, + 949506, + 784353, + 3861, + 46823, + 251292, + 75008, + 269798, + 87731, + 112813, + 571679, + 385, + 3, + 2811, + 36025, + 9243, + 935128, + 906, + 10688, + 25, + 86757, + 307, + 55, + 22, + 2, + 61, + 620426, + 484530, + 633806, + 0, + 1342, + 9293, + 992181, + 503, + 195433, + 46150, + 893091, + 3207, + 2865, + 72894, + 830299, + 355, + 327479, + 0, + 35573, + 3068, + 15699, + 31187, + 55378, + 416067, + 91721, + 159, + 0, + 255139, + 2104, + 19, + 606757, + 323, + 902659, + 365655, + 400, + 903, + 408, + 385, + 21774, + 701290, + 234426, + 17020, + 950, + 0, + 0, + 429, + 1245, + 405871, + 1097, + 280634, + 74, + 158233, + 1583, + 180333, + 42114, + 575973, + 539327, + 59252, + 121928, + 165, + 148501, + 55757, + 7494, + 127728, + 7832, + 68504, + 619770, + 70995, + 312816, + 7307, + 38265, + 46248, + 363304, + 269442, + 77112, + 448331, + 910442, + 474418, + 152752, + 752, + 104912, + 408492, + 691709, + 632381, + 48519, + 20524, + 344294, + 14670, + 0, + 21607, + 81162, + 181458, + 0, + 908322, + 7261, + 10888, + 58054, + 1788, + 970933, + 5925, + 121553, + 36152, + 588267, + 23615, + 1850, + 30728, + 3599, + 1319, + 6027, + 0, + 32141, + 984156, + 436781, + 15003, + 621407, + 9412, + 562911, + 189740, + 377895, + 656800, + 197, + 14413, + 99382, + 384, + 11480, + 0, + 86118, + 881961, + 1905, + 82061, + 4140, + 741153, + 26, + 687, + 12251, + 10945, + 209267, + 220602, + 135881, + 6, + 237945, + 158, + 5, + 76303, + 81344, + 986042, + 956063, + 30282, + 186055, + 357802, + 12492, + 577476, + 838, + 0, + 11, + 117602, + 0, + 187928, + 96860, + 4268, + 3478, + 818264, + 1649, + 17175, + 272, + 158951, + 440987, + 677594, + 14935, + 37953, + 0, + 198, + 160404, + 12, + 287803, + 2386, + 10, + 271663, + 319152, + 361322, + 68370, + 428, + 182707, + 387429, + 1152, + 360065, + 25218, + 2790, + 42228, + 13, + 110942, + 452491, + 1, + 665638, + 2308, + 1196, + 87306, + 66, + 219, + 0, + 130736, + 334, + 605, + 5979, + 2681, + 0, + 123463, + 11219, + 283681, + 19269, + 553, + 6217, + 130965, + 714409, + 242, + 674833, + 237581, + 133284, + 683, + 1758, + 278193, + 518726, + 44, + 420361, + 325228, + 14955, + 10, + 11994, + 64157, + 1937, + 20214, + 848, + 27804, + 151341, + 79236, + 316393, + 158883, + 1196, + 334, + 22797, + 185955, + 13857, + 397357, + 7948, + 6038, + 0, + 2621, + 16, + 155267, + 44809, + 9171, + 21328, + 12212, + 40200, + 2600, + 439, + 804014, + 10938, + 96135, + 43696, + 158715, + 4, + 284558, + 191, + 270254, + 7923, + 880603, + 21032, + 107700, + 172, + 700823, + 5613, + 78816, + 258290, + 214398, + 821856, + 295325, + 0, + 1, + 23559, + 63895, + 21249, + 717490, + 956952, + 944819, + 793, + 356, + 757716, + 111773, + 394826, + 25665, + 4358, + 640216, + 1152, + 37175, + 150192, + 106071, + 28992, + 67, + 1685, + 134242, + 2, + 102045, + 1457, + 419589, + 6789, + 677, + 94675, + 11300, + 2595, + 8, + 926535, + 265194, + 0, + 886048, + 246242, + 1494, + 191, + 169985, + 649765, + 0, + 201, + 1069, + 679163, + 16627, + 274639, + 84438, + 3, + 1301, + 247496, + 5879, + 710904, + 403652, + 958241, + 361, + 139732, + 6042, + 15985, + 2378, + 267031, + 223767, + 9656, + 241717, + 33863, + 14314, + 205697, + 1274, + 168000, + 621777, + 837913, + 89654, + 659829, + 69, + 503884, + 432717, + 70443, + 110891, + 19655, + 132432, + 620401, + 428, + 0, + 425662, + 0, + 0, + 0, + 194489, + 7601, + 26870, + 0, + 63, + 594, + 12278, + 582479, + 213723, + 424489, + 96446, + 990664, + 46966, + 44137, + 829810, + 104, + 19707, + 16, + 0, + 2499, + 167075, + 140972, + 249283, + 6620, + 68368, + 856414, + 9255, + 14315, + 0, + 11432, + 24329, + 216463, + 299556, + 818401, + 246607, + 697733, + 229, + 144, + 389394, + 664634, + 0, + 19393, + 657903, + 52912, + 952177, + 536931, + 187271, + 17687, + 970155, + 232571, + 234016, + 159980, + 13510, + 32952, + 0, + 0, + 24132, + 18806, + 15624, + 28364, + 472126, + 626978, + 599, + 112843, + 502933, + 915660, + 63920, + 0, + 84, + 10899, + 904823, + 126, + 469132, + 590052, + 195831, + 443113, + 294149, + 15944, + 2271, + 282974, + 211, + 0, + 22934, + 82283, + 49973, + 41707, + 87530, + 0, + 910528, + 0, + 36029, + 423337, + 817512, + 223671, + 27800, + 398847, + 198528, + 1, + 560679, + 518270, + 23033, + 501059, + 0, + 3909, + 272062, + 261581, + 187, + 52043, + 334, + 24354, + 3947, + 8549, + 37863, + 328851, + 963771, + 1, + 3930, + 82416, + 6, + 2943, + 122101, + 82577, + 85, + 89540, + 5135, + 109236, + 18297, + 1, + 177371, + 4541, + 769577, + 178, + 417, + 960566, + 33803, + 911651, + 248160, + 153725, + 43981, + 809174, + 116, + 486900, + 4842, + 148490, + 131534, + 4347, + 239949, + 984096, + 749756, + 429499, + 2794, + 78209, + 18812, + 21111, + 490, + 328042, + 12, + 132119, + 505103, + 353148, + 0, + 373656, + 951244, + 491, + 355778, + 30620, + 317, + 60175, + 220, + 214496, + 41249, + 5169, + 78367, + 506804, + 0, + 1368, + 407, + 295126, + 1288, + 86, + 97614, + 61640, + 244723, + 3, + 0, + 869827, + 527246, + 52, + 107036, + 240739, + 780281, + 113084, + 62009, + 740343, + 483201, + 8649, + 16419, + 1, + 801574, + 95524, + 326126, + 26912, + 877040, + 10262, + 5895, + 0, + 132633, + 59171, + 306347, + 702701, + 196245, + 12642, + 32723, + 24608, + 30287, + 45775, + 18281, + 7587, + 144532, + 5, + 35, + 99862, + 215127, + 170875, + 61461, + 77790, + 5, + 0, + 129358, + 0, + 105084, + 21399, + 42233, + 85397, + 480654, + 555988, + 89575, + 42346, + 20004, + 11102, + 21321, + 185, + 379267, + 849147, + 121514, + 3388, + 33662, + 12, + 164898, + 226, + 274, + 385003, + 365052, + 693376, + 41245, + 9010, + 41594, + 89835, + 10490, + 272, + 128437, + 0, + 122648, + 277, + 116505, + 38372, + 4, + 1376, + 0, + 46317, + 139368, + 36398, + 193899, + 30632, + 26371, + 7548, + 367643, + 954849, + 25889, + 36567, + 176, + 140631, + 4690, + 975031, + 80965, + 500471, + 8442, + 43, + 27758, + 301501, + 3797, + 80, + 384440, + 928477, + 4960, + 24566, + 33245, + 14638, + 228354, + 54347, + 861285, + 12841, + 2, + 157402, + 646747, + 53763, + 1, + 214732, + 49471, + 49757, + 998, + 201135, + 566, + 73512, + 194240, + 391773, + 21510, + 13, + 829894, + 783200, + 565329, + 2101, + 12, + 191043, + 1621, + 18443, + 279, + 294135, + 526503, + 729735, + 4639, + 444138, + 5835, + 12372, + 46362, + 1543, + 870907, + 83262, + 0, + 38331, + 95, + 1194, + 909, + 8053, + 453066, + 845561, + 411, + 3229, + 1, + 158, + 1431, + 835137, + 21774, + 7298, + 148388, + 224649, + 379318, + 520138, + 39781, + 172130, + 362634, + 487495, + 51957, + 158, + 1770, + 7, + 18010, + 1063, + 171484, + 19924, + 279867, + 469956, + 189785, + 0, + 814, + 60580, + 944349, + 18743, + 553235, + 0, + 95475, + 99, + 0, + 5, + 42623, + 178418, + 398940, + 5700, + 69023, + 5786, + 0, + 10531, + 551, + 86308, + 63451, + 32704, + 176903, + 0, + 251689, + 11589, + 25711, + 43437, + 1431, + 304, + 52965, + 34816, + 268688, + 47756, + 825323, + 122608, + 81246, + 69974, + 360515, + 99973, + 143015, + 5063, + 4499, + 34459, + 171982, + 677943, + 489082, + 257515, + 3765, + 5, + 7416, + 602206, + 74122, + 3, + 686204, + 5493, + 28901, + 11349, + 549668, + 257082, + 82000, + 17031, + 1517, + 7442, + 937160, + 722, + 0, + 72952, + 377192, + 438266, + 555, + 31436, + 284, + 56390, + 0, + 585856, + 27635, + 519344, + 126131, + 360273, + 845073, + 0, + 191965, + 55652, + 23, + 112773, + 639025, + 84749, + 0, + 330822, + 7173, + 126217, + 871, + 112112, + 0, + 664, + 530474, + 1, + 379564, + 172617, + 647308, + 0, + 356, + 17, + 84345, + 457, + 0, + 8, + 6, + 136602, + 634424, + 0, + 177298, + 100726, + 91661, + 383792, + 1665, + 43583, + 15775, + 4083, + 4277, + 345749, + 969599, + 65804, + 19327, + 0, + 352514, + 4225, + 9, + 103767, + 0, + 0, + 148436, + 850, + 33, + 2146, + 20153, + 50, + 9063, + 50329, + 348379, + 2569, + 83697, + 37073, + 715486, + 629, + 4753, + 442, + 259203, + 287223, + 48625, + 9, + 70184, + 45946, + 144947, + 0, + 60285, + 28640, + 7626, + 134159, + 33, + 12452, + 150566, + 348293, + 124426, + 353952, + 11, + 22, + 776742, + 29072, + 132168, + 254533, + 319957, + 1602, + 1659, + 209341, + 32847, + 92392, + 753005, + 1392, + 10271, + 28557, + 6717, + 941745, + 0, + 0, + 0, + 78645, + 45320, + 11193, + 1448, + 130626, + 377907, + 795535, + 24285, + 26094, + 266691, + 64449, + 77400, + 191410, + 1, + 1346, + 25224, + 489637, + 47052, + 248592, + 76689, + 0, + 7722, + 47285, + 3152, + 285577, + 0, + 149366, + 264346, + 1, + 208602, + 320459, + 131771, + 1421, + 350, + 723283, + 714934, + 0, + 566439, + 11656, + 34189, + 125484, + 943273, + 15, + 7789, + 0, + 7427, + 464278, + 680924, + 651102, + 87794, + 39640, + 838644, + 964500, + 1, + 1765, + 272604, + 10, + 837347, + 44845, + 130, + 163357, + 4150, + 403331, + 839132, + 44876, + 272792, + 592527, + 57225, + 128826, + 2915, + 2, + 3570, + 2410, + 199, + 171358, + 5931, + 53620, + 55299, + 1868, + 24123, + 165, + 346513, + 16527, + 133, + 517412, + 195700, + 730365, + 896209, + 152760, + 24577, + 65, + 8218, + 349642, + 901345, + 5127, + 5102, + 238318, + 955, + 631921, + 12218, + 55101, + 930381, + 219503, + 469237, + 132, + 16701, + 494, + 199729, + 0, + 32139, + 314, + 172, + 2947, + 106997, + 4871, + 236, + 6146, + 1843, + 128, + 0, + 254240, + 2964, + 14825, + 60624, + 2108, + 286953, + 654931, + 0, + 0, + 396587, + 19852, + 70311, + 363561, + 282, + 17966, + 924254, + 104173, + 130816, + 179096, + 105466, + 136, + 618261, + 358433, + 25587, + 49357, + 102, + 133746, + 620776, + 17084, + 406881, + 802675, + 349, + 69, + 8761, + 278482, + 16336, + 128, + 160096, + 25857, + 280, + 39639, + 726299, + 293905, + 4621, + 41, + 649, + 3655, + 269286, + 578026, + 0, + 11156, + 1, + 744858, + 531, + 48155, + 28435, + 7991, + 447, + 10201, + 379341, + 0, + 5773, + 0, + 295, + 228592, + 331155, + 104089, + 628069, + 29693, + 22, + 13, + 0, + 0, + 554349, + 6082, + 238, + 23, + 151873, + 805937, + 0, + 194076, + 6450, + 3, + 128322, + 69149, + 95511, + 86, + 844368, + 415964, + 51985, + 308686, + 553403, + 624943, + 365800, + 4, + 120263, + 91239, + 195248, + 58010, + 19, + 415112, + 136806, + 42, + 571848, + 55306, + 29454, + 3, + 144926, + 189, + 0, + 161943, + 592155, + 10930, + 279297, + 56932, + 957430, + 10244, + 190296, + 807209, + 781, + 1466, + 235055, + 33, + 196, + 58280, + 436, + 408649, + 221, + 711143, + 10495, + 2441, + 275720, + 2, + 15391, + 132107, + 102610, + 688549, + 237142, + 3041, + 14, + 308623, + 0, + 0, + 287, + 295147, + 61443, + 229, + 207, + 2051, + 64, + 13479, + 55656, + 570134, + 50387, + 225869, + 20615, + 258465, + 64932, + 112461, + 164521, + 907269, + 758563, + 22901, + 0, + 7944, + 48, + 154921, + 2784, + 548608, + 0, + 12524, + 142556, + 0, + 13882, + 507227, + 316598, + 987551, + 0, + 894687, + 1964, + 364, + 10316, + 440269, + 9, + 776723, + 72288, + 54604, + 185101, + 142, + 362, + 11679, + 77, + 79, + 529321, + 364, + 42387, + 0, + 570879, + 417503, + 604871, + 578806, + 1102, + 66584, + 615440, + 146744, + 19441, + 170478, + 144069, + 36170, + 145376, + 842283, + 193612, + 3, + 359429, + 368596, + 0, + 11064, + 7726, + 229410, + 63569, + 67402, + 91, + 203201, + 213513, + 0, + 704479, + 1325, + 0, + 385154, + 13, + 806763, + 197132, + 6183, + 45760, + 99377, + 0, + 972077, + 4043, + 195700, + 34229, + 0, + 154027, + 633, + 6, + 32142, + 0, + 29, + 620842, + 14099, + 495465, + 26937, + 0, + 0, + 432, + 227704, + 0, + 63, + 0, + 19, + 863491, + 20, + 1, + 160713, + 24607, + 85800, + 3566, + 37854, + 81913, + 121573, + 816, + 20, + 133253, + 692231, + 4869, + 255175, + 15028, + 9383, + 542877, + 4608, + 369610, + 243635, + 385285, + 391565, + 286009, + 0, + 61685, + 416318, + 208, + 67019, + 788416, + 88, + 165056, + 0, + 439589, + 160, + 105528, + 152, + 160624, + 865, + 390229, + 714086, + 6007, + 30229, + 481306, + 173266, + 1135, + 2266, + 8, + 59, + 104722, + 647885, + 579471, + 21309, + 230834, + 140278, + 31858, + 3288, + 36011, + 151387, + 594217, + 22439, + 418638, + 76859, + 29363, + 154809, + 275533, + 39, + 472996, + 22076, + 7481, + 155705, + 10406, + 214779, + 223, + 1312, + 16391, + 17203, + 55605, + 44579, + 69332, + 303, + 19217, + 26288, + 126212, + 316, + 98, + 114, + 37382, + 137591, + 439749, + 12972, + 54, + 154879, + 0, + 102680, + 7639, + 309119, + 263550, + 766, + 1124, + 56, + 686608, + 123767, + 518054, + 18, + 672385, + 3161, + 53791, + 26769, + 451670, + 61, + 148245, + 2713, + 96725, + 4794, + 33247, + 297946, + 33380, + 0, + 20034, + 5647, + 17227, + 76444, + 0, + 21011, + 675, + 13226, + 1027, + 990842, + 124459, + 34406, + 53, + 69540, + 134, + 0, + 168521, + 6, + 4075, + 1137, + 63740, + 220, + 10434, + 1171, + 28950, + 0, + 79680, + 993269, + 355622, + 15, + 0, + 1452, + 21667, + 22208, + 494484, + 33984, + 691308, + 10, + 693686, + 196, + 9, + 70676, + 157660, + 775, + 165, + 468432, + 1083, + 515154, + 778344, + 70241, + 42, + 40931, + 277125, + 43837, + 301881, + 1332, + 56712, + 9013, + 1299, + 7564, + 31092, + 1975, + 113517, + 833295, + 245021, + 36503, + 23586, + 149327, + 89175, + 10512, + 484348, + 187793, + 954609, + 53199, + 792175, + 126, + 12369, + 405, + 0, + 6614, + 322857, + 166, + 571874, + 60839, + 180975, + 146722, + 411565, + 1536, + 1, + 11, + 116230, + 60514, + 9003, + 2325, + 43763, + 63, + 355553, + 0, + 389876, + 14672, + 11526, + 160209, + 65, + 10283, + 966, + 10, + 58333, + 129920, + 2850, + 83346, + 0, + 14, + 295819, + 679550, + 143928, + 29489, + 82324, + 36558, + 267118, + 143313, + 90107, + 12789, + 951, + 0, + 187619, + 295317, + 82, + 41326, + 309682, + 907327, + 809358, + 324, + 139157, + 12, + 78366, + 671811, + 354, + 131, + 70525, + 35830, + 281018, + 91456, + 92523, + 54874, + 48273, + 2423, + 0, + 81, + 361314, + 374811, + 394758, + 15350, + 795, + 3, + 16779, + 796684, + 477556, + 73927, + 26643, + 119281, + 62692, + 17039, + 454778, + 952, + 48973, + 19529, + 151, + 239121, + 93509, + 254702, + 1307, + 10029, + 7973, + 546706, + 806644, + 680517, + 223, + 0, + 2, + 0, + 402421, + 619193, + 15685, + 2, + 939715, + 519198, + 0, + 444312, + 23204, + 35669, + 32467, + 0, + 799725, + 5883, + 2217, + 32292, + 355557, + 22179, + 1066, + 15704, + 610, + 37819, + 403626, + 83101, + 10989, + 311607, + 43394, + 72576, + 335450, + 85964, + 73734, + 105142, + 38292, + 0, + 181516, + 33959, + 611797, + 221838, + 5931, + 7666, + 1044, + 477173, + 13591, + 405, + 521, + 190653, + 184191, + 0, + 215, + 847195, + 22782, + 11912, + 27345, + 2572, + 0, + 566350, + 7, + 52302, + 26641, + 587826, + 127, + 2, + 44449, + 153198, + 14, + 926, + 285, + 0, + 938196, + 52255, + 9153, + 807, + 12548, + 358324, + 18521, + 104956, + 42738, + 116, + 135772, + 189554, + 38, + 54, + 36, + 89768, + 17170, + 75, + 34502, + 45489, + 172796, + 971810, + 16153, + 499280, + 1, + 879663, + 53830, + 186, + 539, + 242059, + 268, + 402, + 2732, + 68057, + 18463, + 198560, + 10068, + 591753, + 6116, + 699280, + 1, + 0, + 114258, + 277, + 149, + 283821, + 352561, + 88172, + 684476, + 3450, + 87, + 99936, + 3155, + 72983, + 31619, + 8832, + 58666, + 0, + 59023, + 306091, + 352150, + 255063, + 992708, + 23, + 4896, + 18165, + 424401, + 227613, + 5175, + 347, + 139846, + 11962, + 714, + 3501, + 82367, + 11110, + 10, + 12874, + 0, + 0, + 222712, + 169, + 123281, + 0, + 268149, + 101, + 17446, + 4262, + 489, + 0, + 30, + 0, + 277235, + 28, + 71, + 23, + 61219, + 953631, + 477548, + 662491, + 273, + 44787, + 4130, + 14483, + 470571, + 735977, + 406648, + 815898, + 5985, + 462696, + 937510, + 9, + 0, + 111727, + 93, + 331435, + 336402, + 78690, + 49, + 0, + 87422, + 1242, + 0, + 8783, + 8540, + 314, + 33411, + 805718, + 247, + 6870, + 523743, + 8323, + 612593, + 430, + 354048, + 264913, + 83, + 114063, + 202825, + 35202, + 32823, + 185554, + 85760, + 45159, + 5971, + 267733, + 4545, + 116, + 6910, + 24833, + 218, + 922362, + 221735, + 740, + 7112, + 31, + 15739, + 523589, + 4, + 95996, + 936, + 823951, + 0, + 88, + 160, + 375419, + 663627, + 3741, + 22896, + 114326, + 415962, + 880100, + 6222, + 18650, + 35524, + 195076, + 506, + 451640, + 541336, + 70903, + 3946, + 1, + 61765, + 1, + 2696, + 753129, + 289, + 225234, + 378692, + 1703, + 6751, + 1, + 820, + 7677, + 589, + 12412, + 317, + 69, + 226031, + 134523, + 318253, + 66677, + 111025, + 96, + 0, + 96, + 523528, + 1017, + 0, + 258740, + 420947, + 4600, + 400684, + 12174, + 11770, + 52, + 5959, + 82658, + 531787, + 202, + 548430, + 964, + 1054, + 34, + 96897, + 25445, + 47609, + 386052, + 97004, + 1935, + 30074, + 13458, + 494105, + 54, + 65575, + 594698, + 2340, + 20259, + 84, + 2774, + 534, + 972534, + 115057, + 0, + 11379, + 0, + 271, + 266305, + 132595, + 2, + 773561, + 52365, + 3585, + 351, + 148206, + 778964, + 149379, + 596, + 284914, + 2900, + 35596, + 1547, + 212027, + 8100, + 12248, + 3013, + 1814, + 183415, + 273633, + 15812, + 0, + 966680, + 14830, + 134309, + 0, + 416450, + 206611, + 816, + 82258, + 9873, + 3155, + 53485, + 779805, + 107690, + 254475, + 102504, + 72495, + 17301, + 472130, + 6895, + 245420, + 7299, + 110508, + 27776, + 246134, + 0, + 330853, + 0, + 271767, + 61886, + 24123, + 309681, + 58325, + 608865, + 20666, + 87349, + 229228, + 246, + 457768, + 5374, + 69643, + 148, + 618375, + 45236, + 352565, + 133904, + 152, + 10688, + 18, + 0, + 276036, + 493281, + 11156, + 12566, + 5762, + 113, + 24179, + 98, + 327, + 893, + 209180, + 140805, + 0, + 2341, + 66309, + 30305, + 630559, + 3682, + 152767, + 265822, + 142868, + 1535, + 728603, + 69081, + 353151, + 237995, + 1075, + 925071, + 86, + 6748, + 0, + 684186, + 735, + 13793, + 4790, + 73175, + 69677, + 367627, + 238650, + 303543, + 1, + 26059, + 21392, + 10, + 288609, + 0, + 76345, + 158496, + 7000, + 1865, + 20385, + 0, + 54213, + 9948, + 102667, + 6963, + 71, + 555744, + 5626, + 2512, + 1124, + 7171, + 628, + 29225, + 321687, + 61519, + 4, + 8352, + 9156, +}; + +char *pointers[NCYCLES]; + +int main(void) +{ + int r, i, j, sp, sq; + char *p, *q, *ep, *eq; + int ok; + int err = 0; + + for ( r = 0 ; r < 4 ; r++ ) { + for ( i = 0 ; i < NCYCLES ; i++ ) { + pointers[i] = p = malloc(sp = sizes[i]); + ep = p+sp; + ok = 1; + for ( j = 0 ; j < i ; j++ ) { + q = pointers[j]; + sq = sizes[j]; + eq = q+sq; + + if ( (p < q && ep > q) || (p >= q && p < eq) ) { + ok = 0; + err = 1; + break; + } + } + printf("Allocated %6d bytes at %p, ok = %d\n", sp, p, ok); + + if ( p ) + memset(p, 0xee, sp); /* Poison this memory */ + } + + for ( i = 0 ; i < NCYCLES ; i++ ) { + free(pointers[i]); + printf("Freed %6d bytes at %p\n", sizes[i], pointers[i]); + } + } + + return err; +} + diff --git a/klibc/klibc/tests/memstrtest.c b/klibc/klibc/tests/memstrtest.c new file mode 100644 index 0000000000..14d5173cb2 --- /dev/null +++ b/klibc/klibc/tests/memstrtest.c @@ -0,0 +1,29 @@ +#include +#include +#include + +int main(void) +{ + unsigned char t1[256], t2[256]; + int i; + int r; + + for(i = 0; i < sizeof(t1); i++) + t1[i] = t2[i] = (unsigned char)i; + + r = memcmp(t1, t2, sizeof(t1)); + printf("memcmp r = %d\n", r); + r = memcmp(t1, t2, sizeof(t1)/2); + printf("memcmp r = %d\n", r); + t1[255] = 0; + r = memcmp(t1, t2, sizeof(t1)); + printf("memcmp r = %d\n", r); + + for (i = 0; i < sizeof(t1); i++) + t1[i] = 0xaa; + memset(t2, 0xaa, sizeof(t2)); + r = memcmp(t1, t2, sizeof(t1)); + printf("memcmp r = %d\n", r); + return 0; +} + diff --git a/klibc/klibc/tests/microhello.c b/klibc/klibc/tests/microhello.c new file mode 100644 index 0000000000..e57cd05a50 --- /dev/null +++ b/klibc/klibc/tests/microhello.c @@ -0,0 +1,9 @@ +#include +#include + +int main(void) +{ + const char hello[] = "Hello, World!\n"; + _fwrite(hello, sizeof hello-1, stdout); + return 0; +} diff --git a/klibc/klibc/tests/minihello.c b/klibc/klibc/tests/minihello.c new file mode 100644 index 0000000000..7698e0666b --- /dev/null +++ b/klibc/klibc/tests/minihello.c @@ -0,0 +1,7 @@ +#include + +int main(void) +{ + fputs("Hello, World!\n", stdout); + return 0; +} diff --git a/klibc/klibc/tests/minips.c b/klibc/klibc/tests/minips.c new file mode 100644 index 0000000000..c599150858 --- /dev/null +++ b/klibc/klibc/tests/minips.c @@ -0,0 +1,452 @@ +/* + * Copyright 1998 by Albert Cahalan; all rights reserved. + * This file may be used subject to the terms and conditions of the + * GNU Library General Public License Version 2, or any later version + * at your option, as published by the Free Software Foundation. + * 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 Library General Public License for more details. + */ + +/* This is a minimal /bin/ps, designed to be smaller than the old ps + * while still supporting some of the more important features of the + * new ps. (for total size, note that this ps does not need libproc) + * It is suitable for Linux-on-a-floppy systems only. + * + * Maintainers: do not compile or install for normal systems. + * Anyone needing this will want to tweak their compiler anyway. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include /* HZ */ +#include /* PAGE_SIZE */ + +static int P_euid; +static int P_pid; +static char P_cmd[16]; +static char P_state; +static int P_ppid, P_pgrp, P_session, P_tty, P_tpgid; +static unsigned long P_flags, P_min_flt, P_cmin_flt, P_maj_flt, P_cmaj_flt, P_utime, P_stime; +static long P_cutime, P_cstime, P_priority, P_nice, P_timeout, P_it_real_value; +static unsigned long P_start_time, P_vsize; +static long P_rss; +static unsigned long P_rss_rlim, P_start_code, P_end_code, P_start_stack, P_kstk_esp, P_kstk_eip; +static unsigned P_signal, P_blocked, P_sigignore, P_sigcatch; +static unsigned long P_wchan, P_nswap, P_cnswap; + + +#if 0 +static int screen_cols = 80; +static int w_count; +#endif + +static int want_one_pid; +static const char *want_one_command; +static int select_notty; +static int select_all; + +static int ps_format; +static int old_h_option; + +/* we only pretend to support this */ +static int show_args; /* implicit with -f and all BSD options */ +static int bsd_c_option; /* this option overrides the above */ + +static int ps_argc; /* global argc */ +static char **ps_argv; /* global argv */ +static int thisarg; /* index into ps_argv */ +static char *flagptr; /* current location in ps_argv[thisarg] */ + + +#ifndef PAGE_SIZE +#warning PAGE_SIZE not defined, assuming it is 4096 +#define PAGE_SIZE 4096 +#endif + +#ifndef HZ +#warning HZ not defined, assuming it is 100 +#define HZ 100 +#endif + + + +static void usage(void){ + fprintf(stderr, + "-C select by command name (minimal ps only accepts one)\n" + "-p select by process ID (minimal ps only accepts one)\n" + "-e all processes (same as ax)\n" + "a all processes w/ tty, including other users\n" + "x processes w/o controlling ttys\n" + "-f full format\n" + "-j,j job control format\n" + "v virtual memory format\n" + "-l,l long format\n" + "u user-oriented format\n" + "-o user-defined format (limited support, only \"ps -o pid=\")\n" + "h no header\n" +/* + "-A all processes (same as ax)\n" + "c true command name\n" + "-w,w wide output\n" +*/ + ); + exit(1); +} + +/* + * Return the next argument, or call the usage function. + * This handles both: -oFOO -o FOO + */ +static const char *get_opt_arg(void){ + const char *ret; + ret = flagptr+1; /* assume argument is part of ps_argv[thisarg] */ + if(*ret) return ret; + if(++thisarg >= ps_argc) usage(); /* there is nothing left */ + /* argument is the new ps_argv[thisarg] */ + ret = ps_argv[thisarg]; + if(!ret || !*ret) usage(); + return ret; +} + + +/* return the PID, or 0 if nothing good */ +static void parse_pid(const char *str){ + char *endp; + int num; + if(!str) goto bad; + num = strtol(str, &endp, 0); + if(*endp != '\0') goto bad; + if(num<1) goto bad; + if(want_one_pid) goto bad; + want_one_pid = num; + return; +bad: + usage(); +} + +/***************** parse SysV options, including Unix98 *****************/ +static void parse_sysv_option(void){ + do{ + switch(*flagptr){ + /**** selection ****/ + case 'C': /* end */ + if(want_one_command) usage(); + want_one_command = get_opt_arg(); + return; /* can't have any more options */ + case 'p': /* end */ + parse_pid(get_opt_arg()); + return; /* can't have any more options */ + case 'A': + case 'e': + select_all++; + select_notty++; +case 'w': /* here for now, since the real one is not used */ + break; + /**** output format ****/ + case 'f': + show_args = 1; + /* FALL THROUGH */ + case 'j': + case 'l': + if(ps_format) usage(); + ps_format = *flagptr; + break; + case 'o': /* end */ + /* We only support a limited form: "ps -o pid=" (yes, just "pid=") */ + if(strcmp(get_opt_arg(),"pid=")) usage(); + if(ps_format) usage(); + ps_format = 'o'; + old_h_option++; + return; /* can't have any more options */ + /**** other stuff ****/ +#if 0 + case 'w': + w_count++; + break; +#endif + default: + usage(); + } /* switch */ + }while(*++flagptr); +} + +/************************* parse BSD options **********************/ +static void parse_bsd_option(void){ + do{ + switch(*flagptr){ + /**** selection ****/ + case 'a': + select_all++; + break; + case 'x': + select_notty++; + break; + case 'p': /* end */ + parse_pid(get_opt_arg()); + return; /* can't have any more options */ + /**** output format ****/ + case 'j': + case 'l': + case 'u': + case 'v': + if(ps_format) usage(); + ps_format = 0x80 | *flagptr; /* use 0x80 to tell BSD from SysV */ + break; + /**** other stuff ****/ + case 'c': + bsd_c_option++; +#if 0 + break; +#endif + case 'w': +#if 0 + w_count++; +#endif + break; + case 'h': + old_h_option++; + break; + default: + usage(); + } /* switch */ + }while(*++flagptr); +} + +#if 0 +/* not used yet */ +static void choose_dimensions(void){ + struct winsize ws; + char *columns; + /* screen_cols is 80 by default */ + if(ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col>30) screen_cols = ws.ws_col; + columns = getenv("COLUMNS"); + if(columns && *columns){ + long t; + char *endptr; + t = strtol(columns, &endptr, 0); + if(!*endptr && (t>30) && (t<(long)999999999)) screen_cols = (int)t; + } + if(w_count && (screen_cols<132)) screen_cols=132; + if(w_count>1) screen_cols=999999999; +} +#endif + +static void arg_parse(int argc, char *argv[]){ + int sel = 0; /* to verify option sanity */ + ps_argc = argc; + ps_argv = argv; + thisarg = 0; + /**** iterate over the args ****/ + while(++thisarg < ps_argc){ + flagptr = ps_argv[thisarg]; + switch(*flagptr){ + case '0' ... '9': + show_args = 1; + parse_pid(flagptr); + break; + case '-': + flagptr++; + parse_sysv_option(); + break; + default: + show_args = 1; + parse_bsd_option(); + break; + } + } + /**** sanity check and clean-up ****/ + if(want_one_pid) sel++; + if(want_one_command) sel++; + if(select_notty || select_all) sel++; + if(sel>1 || select_notty>1 || select_all>1 || bsd_c_option>1 || old_h_option>1) usage(); + if(bsd_c_option) show_args = 0; +} + +/* return 1 if it works, or 0 for failure */ +static int stat2proc(int pid) { + char buf[800]; /* about 40 fields, 64-bit decimal is about 20 chars */ + int num; + int fd; + char* tmp; + struct stat sb; /* stat() used to get EUID */ + snprintf(buf, 32, "/proc/%d/stat", pid); + if ( (fd = open(buf, O_RDONLY, 0) ) == -1 ) return 0; + num = read(fd, buf, sizeof buf - 1); + fstat(fd, &sb); + P_euid = sb.st_uid; + close(fd); + if(num<80) return 0; + buf[num] = '\0'; + tmp = strrchr(buf, ')'); /* split into "PID (cmd" and "" */ + *tmp = '\0'; /* replace trailing ')' with NUL */ + /* parse these two strings separately, skipping the leading "(". */ + memset(P_cmd, 0, sizeof P_cmd); /* clear */ + sscanf(buf, "%d (%15c", &P_pid, P_cmd); /* comm[16] in kernel */ + num = sscanf(tmp + 2, /* skip space after ')' too */ + "%c " + "%d %d %d %d %d " + "%lu %lu %lu %lu %lu %lu %lu " + "%ld %ld %ld %ld %ld %ld " + "%lu %lu " + "%ld " + "%lu %lu %lu %lu %lu %lu " + "%u %u %u %u " /* no use for RT signals */ + "%lu %lu %lu", + &P_state, + &P_ppid, &P_pgrp, &P_session, &P_tty, &P_tpgid, + &P_flags, &P_min_flt, &P_cmin_flt, &P_maj_flt, &P_cmaj_flt, &P_utime, &P_stime, + &P_cutime, &P_cstime, &P_priority, &P_nice, &P_timeout, &P_it_real_value, + &P_start_time, &P_vsize, + &P_rss, + &P_rss_rlim, &P_start_code, &P_end_code, &P_start_stack, &P_kstk_esp, &P_kstk_eip, + &P_signal, &P_blocked, &P_sigignore, &P_sigcatch, + &P_wchan, &P_nswap, &P_cnswap + ); +/* fprintf(stderr, "stat2proc converted %d fields.\n",num); */ + P_vsize /= 1024; + P_rss *= (PAGE_SIZE/1024); + if(num < 30) return 0; + if(P_pid != pid) return 0; + return 1; +} + +static const char *do_time(unsigned long t){ + int hh,mm,ss; + static char buf[32]; + int cnt = 0; + t /= HZ; + ss = t%60; + t /= 60; + mm = t%60; + t /= 60; + hh = t%24; + t /= 24; + if(t) cnt = snprintf(buf, sizeof buf, "%d-", (int)t); + snprintf(cnt + buf, sizeof(buf)-cnt, "%02d:%02d:%02d", hh, mm, ss); + return buf; +} + +static void print_proc(void){ + char tty[16]; + snprintf(tty, sizeof tty, "%3d,%-3d", (P_tty>>8)&0xff, P_tty&0xff); + switch(ps_format){ + case 0: + printf("%5d %s %s", P_pid, tty, do_time(P_utime+P_stime)); + break; + case 'o': + printf("%d\n", P_pid); + return; /* don't want the command */ + case 'l': + printf( + "%03x %c %5d %5d %5d - %3d %3d - " + "%5ld %06x %s %s", + (unsigned)P_flags&0x777, P_state, P_euid, P_pid, P_ppid, + (int)P_priority, (int)P_nice, P_vsize/(PAGE_SIZE/1024), + (unsigned)(P_wchan&0xffffff), tty, do_time(P_utime+P_stime) + ); + break; + case 'f': + printf( + "%5d %5d %5d - - %s %s", + P_euid, P_pid, P_ppid, tty, do_time(P_utime+P_stime) + ); + break; + case 'j': + printf( + "%5d %5d %5d %s %s", + P_pid, P_pgrp, P_session, tty, do_time(P_utime+P_stime) + ); + break; + case 'u'|0x80: + printf( + "%5d %5d - - %5ld %5ld %s %c - %s", + P_euid, P_pid, P_vsize, P_rss, tty, P_state, + do_time(P_utime+P_stime) + ); + break; + case 'v'|0x80: + printf( + "%5d %s %c %s %6d - - %5d -", + P_pid, tty, P_state, do_time(P_utime+P_stime), (int)P_maj_flt, + (int)P_rss + ); + break; + case 'j'|0x80: + printf( + "%5d %5d %5d %5d %s %5d %c %5d %s", + P_ppid, P_pid, P_pgrp, P_session, tty, P_tpgid, P_state, P_euid, do_time(P_utime+P_stime) + ); + break; + case 'l'|0x80: + printf( + "%03x %5d %5d %5d %3d %3d " + "%5ld %4ld %06x %c %s %s", + (unsigned)P_flags&0x777, P_euid, P_pid, P_ppid, (int)P_priority, (int)P_nice, + P_vsize, P_rss, (unsigned)(P_wchan&0xffffff), P_state, tty, do_time(P_utime+P_stime) + ); + break; + default: + } + if(show_args) printf(" [%s]\n", P_cmd); + else printf(" %s\n", P_cmd); +} + + +int main(int argc, char *argv[]){ + arg_parse(argc, argv); +#if 0 + choose_dimensions(); +#endif + if(!old_h_option){ + const char *head; + switch(ps_format){ + default: /* can't happen */ + case 0: head = " PID TTY TIME CMD"; break; + case 'l': head = " F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD"; break; + case 'f': head = " UID PID PPID C STIME TTY TIME CMD"; break; + case 'j': head = " PID PGID SID TTY TIME CMD"; break; + case 'u'|0x80: head = " UID PID %CPU %MEM VSZ RSS TTY S START TIME COMMAND"; break; + case 'v'|0x80: head = " PID TTY S TIME MAJFL TRS DRS RSS %MEM COMMAND"; break; + case 'j'|0x80: head = " PPID PID PGID SID TTY TPGID S UID TIME COMMAND"; break; + case 'l'|0x80: head = " F UID PID PPID PRI NI VSZ RSS WCHAN S TTY TIME COMMAND"; break; + } + printf("%s\n",head); + } + if(want_one_pid){ + if(stat2proc(want_one_pid)) print_proc(); + else exit(1); + }else{ + struct dirent *ent; /* dirent handle */ + DIR *dir; + int ouruid; + int found_a_proc; + found_a_proc = 0; + ouruid = getuid(); + dir = opendir("/proc"); + while(( ent = readdir(dir) )){ + if(*ent->d_name<'0' || *ent->d_name>'9') continue; + if(!stat2proc(atoi(ent->d_name))) continue; + if(want_one_command){ + if(strcmp(want_one_command,P_cmd)) continue; + }else{ + if(!select_notty && P_tty==-1) continue; + if(!select_all && P_euid!=ouruid) continue; + } + found_a_proc++; + print_proc(); + } + closedir(dir); + exit(!found_a_proc); + } + return 0; +} diff --git a/klibc/klibc/tests/nfs_no_rpc.c b/klibc/klibc/tests/nfs_no_rpc.c new file mode 100644 index 0000000000..11b9f61fea --- /dev/null +++ b/klibc/klibc/tests/nfs_no_rpc.c @@ -0,0 +1,538 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Default path we try to mount. "%s" gets replaced by our IP address */ +#define NFS_ROOT "/tftpboot/%s" +#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 +#define NFS_MAXPATHLEN 1024 +#define NFS_MNT_PROGRAM 100005 +#define NFS_MNT_PORT 627 +#define NFS_PROGRAM 100003 +#define NFS_PORT 2049 +#define NFS2_VERSION 2 +#define NFS3_VERSION 3 +#define NFS_MNT_PROGRAM 100005 +#define NFS_MNT_VERSION 1 +#define NFS_MNT3_VERSION 3 +#define MNTPROC_MNT 1 +#define MOUNTPROC3_MNT 1 +#define RPC_PMAP_PROGRAM 100000 +#define RPC_PMAP_VERSION 2 +#define RPC_PMAP_PORT 111 + +#define NFS2_FHSIZE 32 +#define NFS3_FHSIZE 64 + +#define RPC_VERSION 2 + +enum rpc_msg_type { + RPC_CALL = 0, + RPC_REPLY = 1 +}; + +enum rpc_auth_flavor { + RPC_AUTH_NULL = 0, + RPC_AUTH_UNIX = 1, + RPC_AUTH_SHORT = 2, + RPC_AUTH_DES = 3, + RPC_AUTH_KRB = 4, +}; + +enum rpc_reply_stat { + RPC_MSG_ACCEPTED = 0, + RPC_MSG_DENIED = 1 +}; + +#define NFS_MAXFHSIZE 64 +struct nfs_fh { + unsigned short size; + unsigned char data[NFS_MAXFHSIZE]; +}; + +struct nfs2_fh { + char data[NFS2_FHSIZE]; +}; + +#define NFS_MOUNT_VERSION 4 + +struct nfs_mount_data { + int version; + int fd; + struct nfs2_fh old_root; + int flags; + int rsize; + int wsize; + int timeo; + int retrans; + int acregmin; + int acregmax; + int acdirmin; + int acdirmax; + struct sockaddr_in addr; + char hostname[256]; + int namlen; + unsigned int bsize; + struct nfs_fh root; +}; + +#define NFS_MOUNT_SOFT 0x0001 /* 1 */ +#define NFS_MOUNT_INTR 0x0002 /* 1 */ +#define NFS_MOUNT_SECURE 0x0004 /* 1 */ +#define NFS_MOUNT_POSIX 0x0008 /* 1 */ +#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ +#define NFS_MOUNT_NOAC 0x0020 /* 1 */ +#define NFS_MOUNT_TCP 0x0040 /* 2 */ +#define NFS_MOUNT_VER3 0x0080 /* 3 */ +#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ +#define NFS_MOUNT_NONLM 0x0200 /* 3 */ +#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ +#define NFS_MOUNT_FLAGMASK 0xFFFF + +static char nfs_root_name[256]; +static u_int32_t root_server_addr; +static char root_server_path[256]; + +/* Address of NFS server */ +static u_int32_t servaddr; + +/* Name of directory to mount */ +static char nfs_path[NFS_MAXPATHLEN]; + +/* NFS-related data */ +static struct nfs_mount_data nfs_data = { + .version = NFS_MOUNT_VERSION, + .flags = NFS_MOUNT_NONLM, /* No lockd in nfs root yet */ + .rsize = NFS_DEF_FILE_IO_BUFFER_SIZE, + .wsize = NFS_DEF_FILE_IO_BUFFER_SIZE, + .bsize = 0, + .timeo = 7, + .retrans = 3, + .acregmin = 3, + .acregmax = 60, + .acdirmin = 30, + .acdirmax = 60, +}; +static int nfs_port = -1; +static int mount_port; + +/*************************************************************************** + + Parsing of options + + ***************************************************************************/ + +/* + * The following integer options are recognized + */ +static struct nfs_int_opts { + const char *name; + int *val; +} root_int_opts[] = { + { "port", &nfs_port }, + { "rsize", &nfs_data.rsize }, + { "wsize", &nfs_data.wsize }, + { "timeo", &nfs_data.timeo }, + { "retrans", &nfs_data.retrans }, + { "acregmin", &nfs_data.acregmin }, + { "acregmax", &nfs_data.acregmax }, + { "acdirmin", &nfs_data.acdirmin }, + { "acdirmax", &nfs_data.acdirmax }, + { NULL, NULL } +}; + +/* + * And now the flag options + */ +static struct nfs_bool_opts { + const char *name; + int and_mask; + int or_mask; +} root_bool_opts[] = { + { "soft", ~NFS_MOUNT_SOFT, NFS_MOUNT_SOFT }, + { "hard", ~NFS_MOUNT_SOFT, 0 }, + { "intr", ~NFS_MOUNT_INTR, NFS_MOUNT_INTR }, + { "nointr", ~NFS_MOUNT_INTR, 0 }, + { "posix", ~NFS_MOUNT_POSIX, NFS_MOUNT_POSIX }, + { "noposix", ~NFS_MOUNT_POSIX, 0 }, + { "cto", ~NFS_MOUNT_NOCTO, 0 }, + { "nocto", ~NFS_MOUNT_NOCTO, NFS_MOUNT_NOCTO }, + { "ac", ~NFS_MOUNT_NOAC, 0 }, + { "noac", ~NFS_MOUNT_NOAC, NFS_MOUNT_NOAC }, + { "lock", ~NFS_MOUNT_NONLM, 0 }, + { "nolock", ~NFS_MOUNT_NONLM, NFS_MOUNT_NONLM }, +#ifdef CONFIG_NFS_V3 + { "v2", ~NFS_MOUNT_VER3, 0 }, + { "v3", ~NFS_MOUNT_VER3, NFS_MOUNT_VER3 }, +#endif + { "udp", ~NFS_MOUNT_TCP, 0 }, + { "tcp", ~NFS_MOUNT_TCP, NFS_MOUNT_TCP }, + { "broken_suid",~NFS_MOUNT_BROKEN_SUID, NFS_MOUNT_BROKEN_SUID }, + { NULL, 0, 0 } +}; +/* + * Parse option string. + */ +static void root_nfs_parse(char *name, char *buf) +{ + char *options, *val, *cp; + + if ((options = strchr(name, ','))) { + *options++ = 0; + cp = strtok(options, ","); + while (cp) { + if ((val = strchr(cp, '='))) { + struct nfs_int_opts *opts = root_int_opts; + *val++ = '\0'; + while (opts->name && strcmp(opts->name, cp)) + opts++; + if (opts->name) + *(opts->val) = (int) strtoul(val, NULL, 10); + } else { + struct nfs_bool_opts *opts = root_bool_opts; + while (opts->name && strcmp(opts->name, cp)) + opts++; + if (opts->name) { + nfs_data.flags &= opts->and_mask; + nfs_data.flags |= opts->or_mask; + } + } + cp = strtok(NULL, ","); + } + } + if (name[0] && strcmp(name, "default")) { + strncpy(buf, name, NFS_MAXPATHLEN-1); + buf[NFS_MAXPATHLEN-1] = 0; + } +} + +/* + * Prepare the NFS data structure and parse all options. + */ +static int root_nfs_name(char *name) +{ + char buf[NFS_MAXPATHLEN]; + struct utsname uname_buf; + + /* Set some default values */ + strcpy(buf, NFS_ROOT); + + /* Process options received from the remote server */ + root_nfs_parse(root_server_path, buf); + + /* Override them by options set on kernel command-line */ + root_nfs_parse(name, buf); + + uname(&uname_buf); + if (strlen(buf) + strlen(uname_buf.nodename) > NFS_MAXPATHLEN) { + printf("nfsroot: Pathname for remote directory too long.\n"); + return -1; + } + sprintf(nfs_path, buf, uname_buf.nodename); + + return 1; +} + +/*************************************************************************** + + Routines to actually mount the root directory + + ***************************************************************************/ + +/* + * Construct sockaddr_in from address and port number. + */ +static inline void +set_sockaddr(struct sockaddr_in *sin, u_int32_t addr, u_int16_t port) +{ + memset(sin, 0, sizeof(*sin)); + sin->sin_family = AF_INET; + sin->sin_addr.s_addr = addr; + sin->sin_port = port; +} + +/* + * Extremely crude RPC-over-UDP call. We get an already encoded request + * to pass, we do that and put the reply into buffer. That (and callers + * below - getport, getfh2 and getfh3) should be replaced with proper + * librpc use. Now, if we only had one that wasn't bloated as a dead + * gnu that had lied for a while under the sun... + */ + +static u_int32_t XID; +static int flag; +static void timeout(int n) +{ + (void)n; + flag = 1; +} +static int do_call(struct sockaddr_in *sin, u_int32_t msg[], u_int32_t rmsg[], + u_int32_t len, u_int32_t rlen) +{ + struct sockaddr_in from; + int slen = sizeof(struct sockaddr_in); + struct timeval tv = {1, 0}; + int n; + int fd; + + signal(SIGALRM, timeout); + fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); + if (fd < 0) + goto Esocket; + setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (void*)&tv, sizeof(tv)); + len *= 4; + if (sendto(fd, msg, len, 0, (struct sockaddr *)sin, slen)!=(int)len) + goto Esend; + setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void*)&tv, sizeof(tv)); + alarm(0); + flag = 0; + alarm(5); + rlen *= 4; + do { + slen = sizeof(from); + n = recvfrom(fd, rmsg, rlen, 0, (struct sockaddr*)&from, &slen); + if (flag || n < 0) + goto Erecv; + } while (memcmp(&from, sin, sizeof(from)) || rmsg[0] != msg[0]); + + if (n < 6*4 || n % 4 || ntohl(rmsg[1]) != 1 || rmsg[2] || + rmsg[3] || rmsg[4] || rmsg[5]) + goto Einval; + alarm(0); + close(fd); + return n / 4 - 6; + +Esend: printf("rpc: write failed\n"); + goto out; +Erecv: printf("rpc: read failed\n"); + goto out; +Einval: printf("rpc: invalid response\n"); + goto out; +Esocket:printf("rpc: can't create socket\n"); + return -1; +out: + alarm(0); + close(fd); + return -1; +} + +enum { + PMAP_GETPORT = 3 +}; + +static void do_header(u_int32_t msg[], u_int32_t prog, u_int32_t vers, u_int32_t proc) +{ + msg[0] = XID++; + msg[1] = htonl(RPC_CALL); + msg[2] = htonl(RPC_VERSION); + msg[3] = htonl(prog); + msg[4] = htonl(vers); + msg[5] = htonl(proc); + msg[6] = htonl(RPC_AUTH_NULL); + msg[7] = htonl(0); + msg[8] = htonl(RPC_AUTH_NULL); + msg[9] = htonl(0); +} + +static int getport(u_int32_t prog, u_int32_t vers, u_int32_t prot) +{ + struct sockaddr_in sin; + unsigned msg[14]; + unsigned rmsg[7]; + int n; + set_sockaddr(&sin, servaddr, htons(RPC_PMAP_PORT)); + do_header(msg, RPC_PMAP_PROGRAM, RPC_PMAP_VERSION, PMAP_GETPORT); + msg[10] = htonl(prog); + msg[11] = htonl(vers); + msg[12] = htonl(prot); + msg[13] = htonl(0); + n = do_call(&sin, msg, rmsg, 14, 7); + if (n <= 0) + return -1; + else + return ntohl(rmsg[6]); +} + +static int getfh2(void) +{ + struct sockaddr_in sin; + unsigned msg[10+1+256/4]; + unsigned rmsg[6 + 1 + NFS2_FHSIZE/4]; + int n; + int len = strlen(nfs_path); + set_sockaddr(&sin, servaddr, mount_port); + + if (len > 255) { + printf("nfsroot: pathname is too long"); + return -1; + } + memset(msg, 0, sizeof(msg)); + do_header(msg, NFS_MNT_PROGRAM, NFS_MNT_VERSION, MNTPROC_MNT); + msg[10] = htonl(len); + strcpy((char*)&msg[11], nfs_path); + n = do_call(&sin, msg, rmsg, 11 + (len + 3)/4, 7 + NFS2_FHSIZE/4); + if (n < 0) + return -1; + if (n != NFS2_FHSIZE/4 + 1) + goto Esize; + if (rmsg[6]) { + printf("nfsroot: mountd returned an error (%d)",htonl(rmsg[6])); + return -1; + } + nfs_data.root.size = NFS2_FHSIZE; + memcpy(nfs_data.root.data, &rmsg[7], NFS2_FHSIZE); + return 0; +Esize: + printf("nfsroot: bad fhandle size"); + return -1; +} + +static int getfh3(void) +{ + struct sockaddr_in sin; + unsigned msg[10+1+256/4]; + unsigned rmsg[6 + 1 + 1 + NFS3_FHSIZE/4]; + int n; + int len = strlen(nfs_path); + int size; + set_sockaddr(&sin, servaddr, mount_port); + + if (len > 255) { + printf("nfsroot: pathname is too long"); + return -1; + } + memset(msg, 0, sizeof(msg)); + do_header(msg, NFS_MNT_PROGRAM, NFS_MNT3_VERSION, MOUNTPROC3_MNT); + msg[10] = htonl(len); + strcpy((char*)&msg[11], nfs_path); + n = do_call(&sin, msg, rmsg, 11 + (len + 3)/4, 8 + NFS3_FHSIZE/4); + if (n < 0) + return -1; + if (n <= 2) + goto Esize; + if (rmsg[6]) { + printf("nfsroot: mountd returned an error (%d)",htonl(rmsg[6])); + return -1; + } + size = ntohl(rmsg[7]); + if (size > NFS3_FHSIZE || n != 2 + size/4) + goto Esize; + nfs_data.root.size = size; + memcpy(nfs_data.root.data, &rmsg[8], size); + return 0; +Esize: + printf("nfsroot: bad fhandle size"); + return -1; +} + +/* + * Use portmapper to find mountd and nfsd port numbers if not overriden + * by the user. Use defaults if portmapper is not available. + * XXX: Is there any nfs server with no portmapper? + */ +static int root_nfs_ports(void) +{ + int port; + int nfsd_ver, mountd_ver; + int proto; + + if (nfs_data.flags & NFS_MOUNT_VER3) { + nfsd_ver = NFS3_VERSION; + mountd_ver = NFS_MNT3_VERSION; + } else { + nfsd_ver = NFS2_VERSION; + mountd_ver = NFS_MNT_VERSION; + } + + proto = (nfs_data.flags & NFS_MOUNT_TCP) ? IPPROTO_TCP : IPPROTO_UDP; + + if (nfs_port < 0) { + if ((port = getport(NFS_PROGRAM, nfsd_ver, proto)) < 0) { + printf("nfsroot: Unable to get nfsd port " + "number from server, using default\n"); + port = NFS_PORT; + } + nfs_port = htons(port); + printf("nfsroot: Portmapper on server returned %d " + "as nfsd port\n", port); + } + + if ((port = getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { + printf("nfsroot: Unable to get mountd port " + "number from server, using default\n"); + port = NFS_MNT_PORT; + } + mount_port = htons(port); + printf("nfsroot: mountd port is %d\n", port); + + return 0; +} + +int main(void) +{ + unsigned char *p; + struct timeval tv; + char *s; + + /* FIX: use getopt() instead of this */ + + s = getenv("root_server_addr"); + if (s) + root_server_addr = strtoul(s, NULL, 10); + s = getenv("root_server_path"); + if (s) + strncpy(root_server_path, s, 255); + s = getenv("nfs_root_name"); + if (s) + strncpy(nfs_root_name, s, 255); + + /* + * Decode the root directory path name and NFS options from + * the kernel command line. This has to go here in order to + * be able to use the client IP address for the remote root + * directory (necessary for pure RARP booting). + */ + if (root_nfs_name(nfs_root_name) < 0) + return 0; + if ((servaddr = root_server_addr) == INADDR_NONE) { + printf("nfsroot: No NFS server available, giving up.\n"); + return 0; + } + + p = (char *) &servaddr; + sprintf(nfs_data.hostname, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); + +#ifdef NFSROOT_DEBUG + printf("nfsroot: Mounting %s on server %s as root\n", + nfs_path, nfs_data.hostname); + printf("nfsroot: rsize = %d, wsize = %d, timeo = %d, retrans = %d\n", + nfs_data.rsize, nfs_data.wsize, nfs_data.timeo, nfs_data.retrans); + printf("nfsroot: acreg (min,max) = (%d,%d), acdir (min,max) = (%d,%d)\n", + nfs_data.acregmin, nfs_data.acregmax, + nfs_data.acdirmin, nfs_data.acdirmax); + printf("nfsroot: nfsd port = %d, mountd port = %d, flags = %08x\n", + nfs_port, mount_port, nfs_data.flags); +#endif + + gettimeofday(&tv, NULL); + XID = (tv.tv_sec << 15) ^ tv.tv_usec; + + if (root_nfs_ports() < 0) + return 0; + if (nfs_data.flags & NFS_MOUNT_VER3) { + if (getfh3()) + return 0; + } else { + if (getfh2()) + return 0; + } + set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, nfs_port); + return mount("/dev/root", "/mnt", "nfs", 0, &nfs_data) == 0; +} diff --git a/klibc/klibc/tests/setjmptest.c b/klibc/klibc/tests/setjmptest.c new file mode 100644 index 0000000000..a199eedab8 --- /dev/null +++ b/klibc/klibc/tests/setjmptest.c @@ -0,0 +1,36 @@ +/* + * setjmptest.c + */ + +#include +#include + +static jmp_buf buf; + +void do_stuff(int v) +{ + printf("setjmp returned %d\n", v); + longjmp(buf, v+1); +} + +void recurse(int ctr, int v) +{ + if ( ctr-- ) { + recurse(ctr, v); + } else { + do_stuff(v); + } + _fwrite(".", 1, stdout); +} + +int main(void) +{ + int v; + + v = setjmp(buf); + + if ( v < 256 ) + recurse(v,v); + + return 0; +} diff --git a/klibc/klibc/tests/testrand48.c b/klibc/klibc/tests/testrand48.c new file mode 100644 index 0000000000..bf046b6bda --- /dev/null +++ b/klibc/klibc/tests/testrand48.c @@ -0,0 +1,19 @@ +#include +#include + +int main(void) +{ + unsigned short seed1[] = { 0x1234, 0x5678, 0x9abc }; + unsigned short *oldseed; + + oldseed = seed48(seed1); + printf("Initial seed: %#06x %#06x %#06x\n", + oldseed[0], oldseed[1], oldseed[2]); + + printf("lrand48() = %ld\n", lrand48()); + + seed48(seed1); + printf("mrand48() = %ld\n", mrand48()); + + return 1; +} diff --git a/klibc/klibc/tests/testvsnp.c b/klibc/klibc/tests/testvsnp.c new file mode 100644 index 0000000000..c86e8b30fb --- /dev/null +++ b/klibc/klibc/tests/testvsnp.c @@ -0,0 +1,115 @@ +#include +#include +#include +#include +#include +#include + +int main(void) +{ + int r, i; + char buffer[512]; + + r = snprintf(buffer, 512, "Hello, %d", 37); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %'d", 37373737); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %'x", 0xdeadbeef); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %'#X", 0xdeadbeef); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %'#llo", 0123456701234567ULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + /* Make sure overflow works correctly */ + memset(buffer, '\xff', 512); + r = snprintf(buffer, 16, "Hello, %'#llo", 0123456701234567ULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + for ( i = 16 ; i < 512 ; i++ ) + assert ( buffer[i] == '\xff' ); + + r = snprintf(buffer, 512, "Hello, %'#40.20llo", 0123456701234567ULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %'#-40.20llo", 0123456701234567ULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %'#*.*llo", 40, 20, 0123456701234567ULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %'#*.*llo", -40, 20, 0123456701234567ULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %'#*.*llo", -40, -20, 0123456701234567ULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %'#*.*llx", -40, -20, 0123456701234567ULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %p", &buffer); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %P", &buffer); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %20p", &buffer); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %-20p", &buffer); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 512, "Hello, %-20p", NULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 20, "Hello, %'-20p", NULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 15, "Hello, %'-20p", NULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 3, "Hello, %'-20p", NULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + /* This shouldn't change buffer in any way! */ + r = snprintf(buffer, 0, "Hello, %'-20p", NULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + for ( i = -30 ; i <= 30 ; i++ ) { + r = snprintf(buffer, 40, "Hello, %'*p", i, NULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + } + + r = snprintf(buffer, 40, "Hello, %'-20s", "String"); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 40, "Hello, %'20s", "String"); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 40, "Hello, %'020s", "String"); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 40, "Hello, %'-20s", NULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 40, "Hello, %'20s", NULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 40, "Hello, %'020s", NULL); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 40, "Hello, %'-20c", '*'); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 40, "Hello, %'20c", '*'); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + r = snprintf(buffer, 40, "Hello, %'020c", '*'); + printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); + + return 0; +} + diff --git a/klibc/klibc/time.c b/klibc/klibc/time.c new file mode 100644 index 0000000000..8f6e89738d --- /dev/null +++ b/klibc/klibc/time.c @@ -0,0 +1,27 @@ +/* + * time.c + */ + +#include +#include +#include + +#ifdef __NR_time + +_syscall1(time_t,time,time_t *,t); + +#else + +time_t time(time_t *t) +{ + struct timeval tv; + + gettimeofday(&tv, NULL); + + if ( t ) + *t = (time_t)tv.tv_sec; + + return (time_t)tv.tv_sec; +} + +#endif diff --git a/klibc/klibc/umount.c b/klibc/klibc/umount.c new file mode 100644 index 0000000000..9a8e62a779 --- /dev/null +++ b/klibc/klibc/umount.c @@ -0,0 +1,12 @@ +/* + * umount.c + * + * Single-argument form of umount + */ + +#include + +int umount(const char *dir) +{ + return umount2(dir, 0); +} diff --git a/klibc/klibc/unsetenv.c b/klibc/klibc/unsetenv.c new file mode 100644 index 0000000000..5f39f3d8f9 --- /dev/null +++ b/klibc/klibc/unsetenv.c @@ -0,0 +1,40 @@ +/* + * unsetenv.c + */ + +#include +#include +#include +#include + +int unsetenv(const char *name) +{ + size_t len; + char **p, *q; + const char *z; + + if ( !name || !name[0] ) { + errno = EINVAL; + return -1; + } + + len = 0; + for ( z = name ; *z ; z++ ) { + len++; + if ( *z == '=' ) { + errno = EINVAL; + return -1; + } + } + + for ( p = environ ; (q = *p) ; p++ ) { + if ( !strncmp(name,q,len) && q[len] == '=' ) + break; + } + + for ( ; (q = *p) ; p++ ) { + p[0] = p[1]; + } + + return 0; +} diff --git a/klibc/klibc/usleep.c b/klibc/klibc/usleep.c new file mode 100644 index 0000000000..b63352eebf --- /dev/null +++ b/klibc/klibc/usleep.c @@ -0,0 +1,15 @@ +/* + * usleep.c + */ + +#include +#include + +void usleep(unsigned long usec) +{ + struct timespec ts; + + ts.tv_sec = usec/1000000UL; + ts.tv_nsec = (usec%1000000UL) * 1000; + while ( nanosleep(&ts,&ts) == -1 && errno == EINTR ); +} diff --git a/klibc/klibc/utime.c b/klibc/klibc/utime.c new file mode 100644 index 0000000000..a00b589629 --- /dev/null +++ b/klibc/klibc/utime.c @@ -0,0 +1,30 @@ +/* + * utime.c + */ + +#include +#include +#include +#include + +#ifdef __NR_utime + +_syscall2(int,utime,const char *,filename,const struct utimbuf *,buf); + +#else + +static inline _syscall2(int,utimes,const char *,filename, const struct timeval *,tvp); + +int utime(const char *filename, const struct utimbuf *buf) +{ + struct timeval tvp[2]; + + tvp[0].tv_sec = buf->actime; + tvp[0].tv_usec = 0; + tvp[1].tv_sec = buf->modtime; + tvp[1].tv_usec = 0; + + return utimes(filename, tvp); +} + +#endif diff --git a/klibc/klibc/vfprintf.c b/klibc/klibc/vfprintf.c new file mode 100644 index 0000000000..39cf9838f6 --- /dev/null +++ b/klibc/klibc/vfprintf.c @@ -0,0 +1,26 @@ +/* + * vfprintf.c + */ + +#include +#include +#include +#include + +#define BUFFER_SIZE 32768 + +int vfprintf(FILE *file, const char *format, va_list ap) +{ + int rv; + char buffer[BUFFER_SIZE]; + + rv = vsnprintf(buffer, BUFFER_SIZE, format, ap); + + if ( rv < 0 ) + return rv; + + if ( rv > BUFFER_SIZE-1 ) + rv = BUFFER_SIZE-1; + + return _fwrite(buffer, rv, file); +} diff --git a/klibc/klibc/vprintf.c b/klibc/klibc/vprintf.c new file mode 100644 index 0000000000..7d6066586f --- /dev/null +++ b/klibc/klibc/vprintf.c @@ -0,0 +1,11 @@ +/* + * vprintf.c + */ + +#include +#include + +int vprintf(const char *format, va_list ap) +{ + return vfprintf(stdout, format, ap); +} diff --git a/klibc/klibc/vsnprintf.c b/klibc/klibc/vsnprintf.c new file mode 100644 index 0000000000..5cb9331954 --- /dev/null +++ b/klibc/klibc/vsnprintf.c @@ -0,0 +1,433 @@ +/* + * vsnprintf.c + * + * vsnprintf(), from which the rest of the printf() + * family is built + */ + +#include +#include +#include +#include +#include +#include + +enum flags { + FL_ZERO = 0x01, /* Zero modifier */ + FL_MINUS = 0x02, /* Minus modifier */ + FL_PLUS = 0x04, /* Plus modifier */ + FL_TICK = 0x08, /* ' modifier */ + FL_SPACE = 0x10, /* Space modifier */ + FL_HASH = 0x20, /* # modifier */ + FL_SIGNED = 0x40, /* Number is signed */ + FL_UPPER = 0x80 /* Upper case digits */ +}; + +/* These may have to be adjusted on certain implementations */ +enum ranks { + rank_char = -2, + rank_short = -1, + rank_int = 0, + rank_long = 1, + rank_longlong = 2 +}; + +#define MIN_RANK rank_char +#define MAX_RANK rank_longlong + +#define INTMAX_RANK rank_longlong +#define SIZE_T_RANK rank_long +#define PTRDIFF_T_RANK rank_long + +#define EMIT(x) ({ if (o nchars ) { + while ( width > nchars ) { + EMIT(' '); + width--; + } + } + + /* Emit nondigits */ + if ( minus ) + EMIT('-'); + else if ( flags & FL_PLUS ) + EMIT('+'); + else if ( flags & FL_SPACE ) + EMIT(' '); + + if ( (flags & FL_HASH) && base == 16 ) { + EMIT('0'); + EMIT((flags & FL_UPPER) ? 'X' : 'x'); + } + + /* Emit zero padding */ + if ( (flags & (FL_MINUS|FL_ZERO)) == FL_ZERO && width > ndigits ) { + while ( width > nchars ) { + EMIT('0'); + width--; + } + } + + /* Generate the number. This is done from right to left. */ + q += ndigits; /* Advance the pointer to end of number */ + o += ndigits; + qq = q; oo = o; /* Temporary values */ + + b4tick = tickskip; + while ( ndigits > 0 ) { + if ( !b4tick-- ) { + qq--; oo--; ndigits--; + if ( oo < n ) *qq = '_'; + b4tick = tickskip-1; + } + qq--; oo--; ndigits--; + if ( oo < n ) *qq = digits[val%base]; + val /= base; + } + + /* Emit late space padding */ + while ( (flags & FL_MINUS) && width > nchars ) { + EMIT(' '); + width--; + } + + return o; +} + + +int vsnprintf(char *buffer, size_t n, const char *format, va_list ap) +{ + const char *p = format; + char ch; + char *q = buffer; + size_t o = 0; /* Number of characters output */ + uintmax_t val = 0; + int rank = rank_int; /* Default rank */ + int width = 0; + int prec = -1; + int base; + size_t sz; + enum flags flags = 0; + enum { + st_normal, /* Ground state */ + st_flags, /* Special flags */ + st_width, /* Field width */ + st_prec, /* Field precision */ + st_modifiers /* Length or conversion modifiers */ + } state = st_normal; + const char *sarg; /* %s string argument */ + char carg; /* %c char argument */ + int slen; /* String length */ + + while ( (ch = *p++) ) { + switch ( state ) { + case st_normal: + if ( ch == '%' ) { + state = st_flags; + flags = 0; rank = rank_int; width = 0; prec = -1; + } else { + EMIT(ch); + } + break; + + case st_flags: + switch ( ch ) { + case '-': + flags |= FL_MINUS; + break; + case '+': + flags |= FL_PLUS; + break; + case '\'': + flags |= FL_TICK; + break; + case ' ': + flags |= FL_SPACE; + break; + case '#': + flags |= FL_HASH; + break; + case '0': + flags |= FL_ZERO; + break; + default: + state = st_width; + p--; /* Process this character again */ + break; + } + break; + + case st_width: + if ( ch >= '0' && ch <= '9' ) { + width = width*10+(ch-'0'); + } else if ( ch == '*' ) { + width = va_arg(ap, int); + if ( width < 0 ) { + width = -width; + flags |= FL_MINUS; + } + } else if ( ch == '.' ) { + prec = 0; /* Precision given */ + state = st_prec; + } else { + state = st_modifiers; + p--; /* Process this character again */ + } + break; + + case st_prec: + if ( ch >= '0' && ch <= '9' ) { + prec = prec*10+(ch-'0'); + } else if ( ch == '*' ) { + prec = va_arg(ap, int); + if ( prec < 0 ) + prec = -1; + } else { + state = st_modifiers; + p--; /* Process this character again */ + } + break; + + case st_modifiers: + switch ( ch ) { + /* Length modifiers - nonterminal sequences */ + case 'h': + rank--; /* Shorter rank */ + break; + case 'l': + rank++; /* Longer rank */ + break; + case 'j': + rank = INTMAX_RANK; + break; + case 'z': + rank = SIZE_T_RANK; + break; + case 't': + rank = PTRDIFF_T_RANK; + break; + case 'L': + case 'q': + rank += 2; + break; + default: + /* Output modifiers - terminal sequences */ + state = st_normal; /* Next state will be normal */ + if ( rank < MIN_RANK ) /* Canonicalize rank */ + rank = MIN_RANK; + else if ( rank > MAX_RANK ) + rank = MAX_RANK; + + switch ( ch ) { + case 'P': /* Upper case pointer */ + flags |= FL_UPPER; + /* fall through */ + case 'p': /* Pointer */ + base = 16; + prec = (CHAR_BIT*sizeof(void *)+3)/4; + flags |= FL_HASH; + val = (uintmax_t)(uintptr_t)va_arg(ap, void *); + goto is_integer; + + case 'd': /* Signed decimal output */ + case 'i': + base = 10; + flags |= FL_SIGNED; + switch (rank) { + case rank_char: + /* Yes, all these casts are needed... */ + val = (uintmax_t)(intmax_t)(signed char)va_arg(ap, signed int); + break; + case rank_short: + val = (uintmax_t)(intmax_t)(signed short)va_arg(ap, signed int); + break; + case rank_int: + val = (uintmax_t)(intmax_t)va_arg(ap, signed int); + break; + case rank_long: + val = (uintmax_t)(intmax_t)va_arg(ap, signed long); + break; + case rank_longlong: + val = (uintmax_t)(intmax_t)va_arg(ap, signed long long); + break; + } + goto is_integer; + case 'o': /* Octal */ + base = 8; + goto is_unsigned; + case 'u': /* Unsigned decimal */ + base = 10; + goto is_unsigned; + case 'X': /* Upper case hexadecimal */ + flags |= FL_UPPER; + /* fall through */ + case 'x': /* Hexadecimal */ + base = 16; + goto is_unsigned; + + is_unsigned: + switch (rank) { + case rank_char: + val = (uintmax_t)(unsigned char)va_arg(ap, unsigned int); + break; + case rank_short: + val = (uintmax_t)(unsigned short)va_arg(ap, unsigned int); + break; + case rank_int: + val = (uintmax_t)va_arg(ap, unsigned int); + break; + case rank_long: + val = (uintmax_t)va_arg(ap, unsigned long); + break; + case rank_longlong: + val = (uintmax_t)va_arg(ap, unsigned long long); + break; + } + /* fall through */ + + is_integer: + sz = format_int(q, (o prec ) + slen = prec; + + if ( width > slen && !(flags & FL_MINUS) ) { + char pad = (flags & FL_ZERO) ? '0' : ' '; + while ( width > slen ) { + EMIT(pad); + width--; + } + } + for ( i = slen ; i ; i-- ) { + sch = *sarg++; + EMIT(sch); + } + if ( width > slen && (flags & FL_MINUS) ) { + while ( width > slen ) { + EMIT(' '); + width--; + } + } + } + break; + + case 'n': /* Output the number of characters written */ + { + switch (rank) { + case rank_char: + *va_arg(ap, signed char *) = o; + break; + case rank_short: + *va_arg(ap, signed short *) = o; + break; + case rank_int: + *va_arg(ap, signed int *) = o; + break; + case rank_long: + *va_arg(ap, signed long *) = o; + break; + case rank_longlong: + *va_arg(ap, signed long long *) = o; + break; + } + } + break; + + default: /* Anything else, including % */ + EMIT(ch); + break; + } + } + } + } + + /* Null-terminate the string */ + if ( o0 ) + buffer[n-1] = '\0'; /* Overflow - terminate at end of buffer */ + + return o; +} diff --git a/klibc/klibc/vsprintf.c b/klibc/klibc/vsprintf.c new file mode 100644 index 0000000000..4a6100e70c --- /dev/null +++ b/klibc/klibc/vsprintf.c @@ -0,0 +1,11 @@ +/* + * vsprintf.c + */ + +#include +#include + +int vsprintf(char *buffer, const char *format, va_list ap) +{ + return vsnprintf(buffer, ~(size_t)0, format, ap); +} diff --git a/klibc/klibc/vsscanf.c b/klibc/klibc/vsscanf.c new file mode 100644 index 0000000000..12a82b2747 --- /dev/null +++ b/klibc/klibc/vsscanf.c @@ -0,0 +1,365 @@ +/* + * vsscanf.c + * + * vsscanf(), from which the rest of the scanf() + * family is built + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifndef LONG_BIT +#define LONG_BIT (CHAR_BIT*sizeof(long)) +#endif + +enum flags { + FL_SPLAT = 0x01, /* Drop the value, do not assign */ + FL_INV = 0x02, /* Character-set with inverse */ + FL_WIDTH = 0x04, /* Field width specified */ + FL_MINUS = 0x08, /* Negative number */ +}; + +enum ranks { + rank_char = -2, + rank_short = -1, + rank_int = 0, + rank_long = 1, + rank_longlong = 2, + rank_ptr = INT_MAX /* Special value used for pointers */ +}; + +#define MIN_RANK rank_char +#define MAX_RANK rank_longlong + +#define INTMAX_RANK rank_longlong +#define SIZE_T_RANK rank_long +#define PTRDIFF_T_RANK rank_long + +enum bail { + bail_none = 0, /* No error condition */ + bail_eof, /* Hit EOF */ + bail_err /* Conversion mismatch */ +}; + +static inline const char * +skipspace(const char *p) +{ + while ( isspace((unsigned char)*p) ) p++; + return p; +} + +#undef set_bit +static inline void +set_bit(unsigned long *bitmap, unsigned int bit) +{ + bitmap[bit/LONG_BIT] |= 1UL << (bit%LONG_BIT); +} + +#undef test_bit +static inline int +test_bit(unsigned long *bitmap, unsigned int bit) +{ + return (int)(bitmap[bit/LONG_BIT] >> (bit%LONG_BIT)) & 1; +} + +int vsscanf(const char *buffer, const char *format, va_list ap) +{ + const char *p = format; + char ch; + const char *q = buffer; + const char *qq; + uintmax_t val = 0; + int rank = rank_int; /* Default rank */ + unsigned int width = UINT_MAX; + int base; + enum flags flags = 0; + enum { + st_normal, /* Ground state */ + st_flags, /* Special flags */ + st_width, /* Field width */ + st_modifiers, /* Length or conversion modifiers */ + st_match_init, /* Initial state of %[ sequence */ + st_match, /* Main state of %[ sequence */ + st_match_range, /* After - in a %[ sequence */ + } state = st_normal; + char *sarg = NULL; /* %s %c or %[ string argument */ + enum bail bail = bail_none; + int sign; + int converted = 0; /* Successful conversions */ + unsigned long matchmap[((1 << CHAR_BIT)+(LONG_BIT-1))/LONG_BIT]; + int matchinv = 0; /* Is match map inverted? */ + unsigned char range_start = 0; + + while ( (ch = *p++) && !bail ) { + switch ( state ) { + case st_normal: + if ( ch == '%' ) { + state = st_flags; + flags = 0; rank = rank_int; width = UINT_MAX; + } else if ( isspace((unsigned char)ch) ) { + q = skipspace(q); + } else { + if ( *q == ch ) + q++; + else + bail = bail_err; /* Match failure */ + } + break; + + case st_flags: + switch ( ch ) { + case '*': + flags |= FL_SPLAT; + break; + case '0' ... '9': + width = (ch-'0'); + state = st_width; + flags |= FL_WIDTH; + break; + default: + state = st_modifiers; + p--; /* Process this character again */ + break; + } + break; + + case st_width: + if ( ch >= '0' && ch <= '9' ) { + width = width*10+(ch-'0'); + } else { + state = st_modifiers; + p--; /* Process this character again */ + } + break; + + case st_modifiers: + switch ( ch ) { + /* Length modifiers - nonterminal sequences */ + case 'h': + rank--; /* Shorter rank */ + break; + case 'l': + rank++; /* Longer rank */ + break; + case 'j': + rank = INTMAX_RANK; + break; + case 'z': + rank = SIZE_T_RANK; + break; + case 't': + rank = PTRDIFF_T_RANK; + break; + case 'L': + case 'q': + rank = rank_longlong; /* long double/long long */ + break; + + default: + /* Output modifiers - terminal sequences */ + state = st_normal; /* Next state will be normal */ + if ( rank < MIN_RANK ) /* Canonicalize rank */ + rank = MIN_RANK; + else if ( rank > MAX_RANK ) + rank = MAX_RANK; + + switch ( ch ) { + case 'P': /* Upper case pointer */ + case 'p': /* Pointer */ +#if 0 /* Enable this to allow null pointers by name */ + q = skipspace(q); + if ( !isdigit((unsigned char)*q) ) { + static const char * const nullnames[] = + { "null", "nul", "nil", "(null)", "(nul)", "(nil)", 0 }; + const char * const *np; + + /* Check to see if it's a null pointer by name */ + for ( np = nullnames ; *np ; np++ ) { + if ( !strncasecmp(q, *np, strlen(*np)) ) { + val = (uintmax_t)((void *)NULL); + goto set_integer; + } + } + /* Failure */ + bail = bail_err; + break; + } + /* else */ +#endif + rank = rank_ptr; + base = 0; sign = 0; + goto scan_int; + + case 'i': /* Base-independent integer */ + base = 0; sign = 1; + goto scan_int; + + case 'd': /* Decimal integer */ + base = 10; sign = 1; + goto scan_int; + + case 'o': /* Octal integer */ + base = 8; sign = 0; + goto scan_int; + + case 'u': /* Unsigned decimal integer */ + base = 10; sign = 0; + goto scan_int; + + case 'x': /* Hexadecimal integer */ + case 'X': + base = 16; sign = 0; + goto scan_int; + + case 'n': /* Number of characters consumed */ + val = (q-buffer); + goto set_integer; + + scan_int: + q = skipspace(q); + if ( !*q ) { + bail = bail_eof; + break; + } + val = strntoumax(q, (char **)&qq, base, width); + if ( qq == q ) { + bail = bail_err; + break; + } + q = qq; + converted++; + /* fall through */ + + set_integer: + if ( !(flags & FL_SPLAT) ) { + switch(rank) { + case rank_char: + *va_arg(ap, unsigned char *) = (unsigned char)val; + break; + case rank_short: + *va_arg(ap, unsigned short *) = (unsigned short)val; + break; + case rank_int: + *va_arg(ap, unsigned int *) = (unsigned int)val; + break; + case rank_long: + *va_arg(ap, unsigned long *) = (unsigned long)val; + break; + case rank_longlong: + *va_arg(ap, unsigned long long *) = (unsigned long long)val; + break; + case rank_ptr: + *va_arg(ap, void **) = (void *)(uintptr_t)val; + break; + } + } + break; + + case 'c': /* Character */ + width = (flags & FL_WIDTH) ? width : 1; /* Default width == 1 */ + sarg = va_arg(ap, char *); + while ( width-- ) { + if ( !*q ) { + bail = bail_eof; + break; + } + *sarg++ = *q++; + } + if ( !bail ) + converted++; + break; + + case 's': /* String */ + { + char *sp; + sp = sarg = va_arg(ap, char *); + while ( width-- && *q && !isspace((unsigned char)*q) ) { + *sp++ = *q++; + } + if ( sarg != sp ) { + *sp = '\0'; /* Terminate output */ + converted++; + } else { + bail = bail_eof; + } + } + break; + + case '[': /* Character range */ + sarg = va_arg(ap, char *); + state = st_match_init; + matchinv = 0; + memset(matchmap, 0, sizeof matchmap); + break; + + case '%': /* %% sequence */ + if ( *q == '%' ) + q++; + else + bail = bail_err; + break; + + default: /* Anything else */ + bail = bail_err; /* Unknown sequence */ + break; + } + } + break; + + case st_match_init: /* Initial state for %[ match */ + if ( ch == '^' && !(flags & FL_INV) ) { + matchinv = 1; + } else { + set_bit(matchmap, (unsigned char)ch); + state = st_match; + } + break; + + case st_match: /* Main state for %[ match */ + if ( ch == ']' ) { + goto match_run; + } else if ( ch == '-' ) { + range_start = (unsigned char)ch; + state = st_match_range; + } else { + set_bit(matchmap, (unsigned char)ch); + } + break; + + case st_match_range: /* %[ match after - */ + if ( ch == ']' ) { + set_bit(matchmap, (unsigned char)'-'); /* - was last character */ + goto match_run; + } else { + int i; + for ( i = range_start ; i < (unsigned char)ch ; i++ ) + set_bit(matchmap, i); + state = st_match; + } + break; + + match_run: /* Match expression finished */ + qq = q; + while ( width && *q && test_bit(matchmap, (unsigned char)*q)^matchinv ) { + *sarg++ = *q++; + } + if ( q != qq ) { + *sarg = '\0'; + converted++; + } else { + bail = *q ? bail_err : bail_eof; + } + break; + } + } + + if ( bail == bail_eof && !converted ) + converted = -1; /* Return EOF (-1) */ + + return converted; +} diff --git a/klibc/klibc/wait.c b/klibc/klibc/wait.c new file mode 100644 index 0000000000..5e0bbe29c5 --- /dev/null +++ b/klibc/klibc/wait.c @@ -0,0 +1,12 @@ +/* + * wait.c + */ + +#include +#include +#include + +pid_t wait(int *status) +{ + return wait4((pid_t)-1, status, 0, NULL); +} diff --git a/klibc/klibc/wait3.c b/klibc/klibc/wait3.c new file mode 100644 index 0000000000..48840ad155 --- /dev/null +++ b/klibc/klibc/wait3.c @@ -0,0 +1,12 @@ +/* + * wait3.c + */ + +#include +#include +#include + +pid_t wait3(int *status, int options, struct rusage *rusage) +{ + return wait4((pid_t)-1, status, options, rusage); +} diff --git a/klibc/klibc/waitpid.c b/klibc/klibc/waitpid.c new file mode 100644 index 0000000000..f7c5cbfbc0 --- /dev/null +++ b/klibc/klibc/waitpid.c @@ -0,0 +1,12 @@ +/* + * waitpid.c + */ + +#include +#include +#include + +pid_t waitpid(pid_t pid, int *status, int options) +{ + return wait4(pid, status, options, NULL); +} diff --git a/klibc/version b/klibc/version new file mode 100644 index 0000000000..e6e9cf41cc --- /dev/null +++ b/klibc/version @@ -0,0 +1 @@ +0.82 -- cgit v1.2.3-54-g00ecf From bf0314e326319354c857a7e9150460ec239fb07d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 19:38:10 -0700 Subject: [PATCH] make libsysfs build cleanly --- libsysfs/Makefile | 45 ----- libsysfs/dlist.c | 1 + libsysfs/dlist.h | 1 - tdb/tdbtest.c | 263 -------------------------- tdb/tdbtool.c | 547 ------------------------------------------------------ tdb/tdbtorture.c | 226 ---------------------- 6 files changed, 1 insertion(+), 1082 deletions(-) delete mode 100644 libsysfs/Makefile delete mode 100644 tdb/tdbtest.c delete mode 100644 tdb/tdbtool.c delete mode 100644 tdb/tdbtorture.c diff --git a/libsysfs/Makefile b/libsysfs/Makefile deleted file mode 100644 index b82acbdbf2..0000000000 --- a/libsysfs/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# Makefile for libsysfs.a -# Copyright (c) International Business Machines Corp., 2003 - -H_INCLUDE=. -LIB_INCLUDE=. -OBJS=sysfs_bus.o sysfs_class.o sysfs_device.o sysfs_dir.o sysfs_driver.o \ - sysfs_utils.o dlist.o - -# Install directory - -# Options -CFLAGS=-O2 -Wall -g - -# sysfs library -LIBSYSFS=libsysfs.a - -RM=rm -f - -libsysfs.a: $(OBJS) - $(AR) cru $(LIBSYSFS) $(OBJS) - $(RANLIB) $(LIBSYSFS) - -sysfs_bus.o: sysfs_bus.c - $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_bus.c - -sysfs_class.o: sysfs_class.c - $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_class.c - -sysfs_device.o: sysfs_device.c - $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_device.c - -sysfs_dir.o: sysfs_dir.c - $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_dir.c - -sysfs_driver.o: sysfs_driver.c - $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_driver.c - -sysfs_utils.o: sysfs_utils.c - $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c sysfs_utils.c - -dlist.o: dlist.c - $(CC) -I$(H_INCLUDE) -I$(LIB_INCLUDE) $(CFLAGS) -c dlist.c - -clean: - $(RM) *.o *~ core $(LIBSYSFS) diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c index 6dfcf726ba..a94ab1f854 100644 --- a/libsysfs/dlist.c +++ b/libsysfs/dlist.c @@ -27,6 +27,7 @@ * delete function. Otherwise dlist will just use free. */ +#include #include "dlist.h" /* diff --git a/libsysfs/dlist.h b/libsysfs/dlist.h index 5da79f9ba2..83f67e8d44 100644 --- a/libsysfs/dlist.h +++ b/libsysfs/dlist.h @@ -52,7 +52,6 @@ * to think about it. */ -#include typedef struct dl_node { struct dl_node *prev; struct dl_node *next; diff --git a/tdb/tdbtest.c b/tdb/tdbtest.c deleted file mode 100644 index 89295a3291..0000000000 --- a/tdb/tdbtest.c +++ /dev/null @@ -1,263 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tdb.h" -#include - -/* a test program for tdb - the trivial database */ - - - -#define DELETE_PROB 7 -#define STORE_PROB 5 - -static TDB_CONTEXT *db; -static GDBM_FILE gdbm; - -struct timeval tp1,tp2; - -static void start_timer(void) -{ - gettimeofday(&tp1,NULL); -} - -static double end_timer(void) -{ - gettimeofday(&tp2,NULL); - return((tp2.tv_sec - tp1.tv_sec) + - (tp2.tv_usec - tp1.tv_usec)*1.0e-6); -} - -static void fatal(char *why) -{ - perror(why); - exit(1); -} - -static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - vfprintf(stdout, format, ap); - va_end(ap); - fflush(stdout); -} - -static void compare_db(void) -{ - TDB_DATA d, key, nextkey; - datum gd, gkey, gnextkey; - - key = tdb_firstkey(db); - while (key.dptr) { - d = tdb_fetch(db, key); - gkey.dptr = key.dptr; - gkey.dsize = key.dsize; - - gd = gdbm_fetch(gdbm, gkey); - - if (!gd.dptr) fatal("key not in gdbm"); - if (gd.dsize != d.dsize) fatal("data sizes differ"); - if (memcmp(gd.dptr, d.dptr, d.dsize)) { - fatal("data differs"); - } - - nextkey = tdb_nextkey(db, key); - free(key.dptr); - free(d.dptr); - free(gd.dptr); - key = nextkey; - } - - gkey = gdbm_firstkey(gdbm); - while (gkey.dptr) { - gd = gdbm_fetch(gdbm, gkey); - key.dptr = gkey.dptr; - key.dsize = gkey.dsize; - - d = tdb_fetch(db, key); - - if (!d.dptr) fatal("key not in db"); - if (d.dsize != gd.dsize) fatal("data sizes differ"); - if (memcmp(d.dptr, gd.dptr, gd.dsize)) { - fatal("data differs"); - } - - gnextkey = gdbm_nextkey(gdbm, gkey); - free(gkey.dptr); - free(gd.dptr); - free(d.dptr); - gkey = gnextkey; - } -} - -static char *randbuf(int len) -{ - char *buf; - int i; - buf = (char *)malloc(len+1); - - for (i=0;i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tdb.h" - -/* a tdb tool for manipulating a tdb database */ - -#define FSTRING_LEN 256 -typedef char fstring[FSTRING_LEN]; - -typedef struct connections_key { - pid_t pid; - int cnum; - fstring name; -} connections_key; - -typedef struct connections_data { - int magic; - pid_t pid; - int cnum; - uid_t uid; - gid_t gid; - char name[24]; - char addr[24]; - char machine[128]; - time_t start; -} connections_data; - -static TDB_CONTEXT *tdb; - -static int print_rec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state); - -static void print_asc(unsigned char *buf,int len) -{ - int i; - - /* We're probably printing ASCII strings so don't try to display - the trailing NULL character. */ - - if (buf[len - 1] == 0) - len--; - - for (i=0;i8) printf(" "); - while (n--) printf(" "); - - n = i%16; - if (n > 8) n = 8; - print_asc(&buf[i-(i%16)],n); printf(" "); - n = (i%16) - n; - if (n>0) print_asc(&buf[i-n],n); - printf("\n"); - } -} - -static void help(void) -{ - printf("\n" -"tdbtool: \n" -" create dbname : create a database\n" -" open dbname : open an existing database\n" -" erase : erase the database\n" -" dump : dump the database as strings\n" -" insert key data : insert a record\n" -" move key file : move a record to a destination tdb\n" -" store key data : store a record (replace)\n" -" show key : show a record by key\n" -" delete key : delete a record by key\n" -" list : print the database hash table and freelist\n" -" free : print the database freelist\n" -" 1 | first : print the first record\n" -" n | next : print the next record\n" -" q | quit : terminate\n" -" \\n : repeat 'next' command\n" -"\n"); -} - -static void terror(char *why) -{ - printf("%s\n", why); -} - -static char *get_token(int startover) -{ - static char tmp[1024]; - static char *cont = NULL; - char *insert, *start; - char *k = strtok(NULL, " "); - - if (!k) - return NULL; - - if (startover) - start = tmp; - else - start = cont; - - strcpy(start, k); - insert = start + strlen(start) - 1; - while (*insert == '\\') { - *insert++ = ' '; - k = strtok(NULL, " "); - if (!k) - break; - strcpy(insert, k); - insert = start + strlen(start) - 1; - } - - /* Get ready for next call */ - cont = start + strlen(start) + 1; - return start; -} - -static void create_tdb(void) -{ - char *tok = get_token(1); - if (!tok) { - help(); - return; - } - if (tdb) tdb_close(tdb); - tdb = tdb_open(tok, 0, TDB_CLEAR_IF_FIRST, - O_RDWR | O_CREAT | O_TRUNC, 0600); - if (!tdb) { - printf("Could not create %s: %s\n", tok, strerror(errno)); - } -} - -static void open_tdb(void) -{ - char *tok = get_token(1); - if (!tok) { - help(); - return; - } - if (tdb) tdb_close(tdb); - tdb = tdb_open(tok, 0, 0, O_RDWR, 0600); - if (!tdb) { - printf("Could not open %s: %s\n", tok, strerror(errno)); - } -} - -static void insert_tdb(void) -{ - char *k = get_token(1); - char *d = get_token(0); - TDB_DATA key, dbuf; - - if (!k || !d) { - help(); - return; - } - - key.dptr = k; - key.dsize = strlen(k)+1; - dbuf.dptr = d; - dbuf.dsize = strlen(d)+1; - - if (tdb_store(tdb, key, dbuf, TDB_INSERT) == -1) { - terror("insert failed"); - } -} - -static void store_tdb(void) -{ - char *k = get_token(1); - char *d = get_token(0); - TDB_DATA key, dbuf; - - if (!k || !d) { - help(); - return; - } - - key.dptr = k; - key.dsize = strlen(k)+1; - dbuf.dptr = d; - dbuf.dsize = strlen(d)+1; - - printf("Storing key:\n"); - print_rec(tdb, key, dbuf, NULL); - - if (tdb_store(tdb, key, dbuf, TDB_REPLACE) == -1) { - terror("store failed"); - } -} - -static void show_tdb(void) -{ - char *k = get_token(1); - TDB_DATA key, dbuf; - - if (!k) { - help(); - return; - } - - key.dptr = k; - key.dsize = strlen(k)+1; - - dbuf = tdb_fetch(tdb, key); - if (!dbuf.dptr) { - /* maybe it is non-NULL terminated key? */ - key.dsize = strlen(k); - dbuf = tdb_fetch(tdb, key); - - if ( !dbuf.dptr ) { - terror("fetch failed"); - return; - } - } - - /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */ - print_rec(tdb, key, dbuf, NULL); - - free( dbuf.dptr ); - - return; -} - -static void delete_tdb(void) -{ - char *k = get_token(1); - TDB_DATA key; - - if (!k) { - help(); - return; - } - - key.dptr = k; - key.dsize = strlen(k)+1; - - if (tdb_delete(tdb, key) != 0) { - terror("delete failed"); - } -} - -static void move_rec(void) -{ - char *k = get_token(1); - char *file = get_token(0); - TDB_DATA key, dbuf; - TDB_CONTEXT *dst_tdb; - - if (!k) { - help(); - return; - } - - if ( !file ) { - terror("need destination tdb name"); - return; - } - - key.dptr = k; - key.dsize = strlen(k)+1; - - dbuf = tdb_fetch(tdb, key); - if (!dbuf.dptr) { - /* maybe it is non-NULL terminated key? */ - key.dsize = strlen(k); - dbuf = tdb_fetch(tdb, key); - - if ( !dbuf.dptr ) { - terror("fetch failed"); - return; - } - } - - print_rec(tdb, key, dbuf, NULL); - - dst_tdb = tdb_open(file, 0, 0, O_RDWR, 0600); - if ( !dst_tdb ) { - terror("unable to open destination tdb"); - return; - } - - if ( tdb_store( dst_tdb, key, dbuf, TDB_REPLACE ) == -1 ) { - terror("failed to move record"); - } - else - printf("record moved\n"); - - tdb_close( dst_tdb ); - - return; -} - -#if 0 -static int print_conn_key(TDB_DATA key) -{ - printf( "pid =%5d ", ((connections_key*)key.dptr)->pid); - printf( "cnum =%10d ", ((connections_key*)key.dptr)->cnum); - printf( "name =[%s]\n", ((connections_key*)key.dptr)->name); - return 0; -} - -static int print_conn_data(TDB_DATA dbuf) -{ - printf( "pid =%5d ", ((connections_data*)dbuf.dptr)->pid); - printf( "cnum =%10d ", ((connections_data*)dbuf.dptr)->cnum); - printf( "name =[%s]\n", ((connections_data*)dbuf.dptr)->name); - - printf( "uid =%5d ", ((connections_data*)dbuf.dptr)->uid); - printf( "addr =[%s]\n", ((connections_data*)dbuf.dptr)->addr); - printf( "gid =%5d ", ((connections_data*)dbuf.dptr)->gid); - printf( "machine=[%s]\n", ((connections_data*)dbuf.dptr)->machine); - printf( "start = %s\n", ctime(&((connections_data*)dbuf.dptr)->start)); - return 0; -} -#endif - -static int print_rec(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state) -{ -#if 0 - print_conn_key(key); - print_conn_data(dbuf); - return 0; -#else - printf("\nkey %d bytes\n", key.dsize); - print_asc(key.dptr, key.dsize); - printf("\ndata %d bytes\n", dbuf.dsize); - print_data(dbuf.dptr, dbuf.dsize); - return 0; -#endif -} - -static int print_key(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state) -{ - print_asc(key.dptr, key.dsize); - printf("\n"); - return 0; -} - -static int total_bytes; - -static int traverse_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, void *state) -{ - total_bytes += dbuf.dsize; - return 0; -} - -static void info_tdb(void) -{ - int count; - total_bytes = 0; - if ((count = tdb_traverse(tdb, traverse_fn, NULL) == -1)) - printf("Error = %s\n", tdb_errorstr(tdb)); - else - printf("%d records totalling %d bytes\n", count, total_bytes); -} - -static char *tdb_getline(char *prompt) -{ - static char line[1024]; - char *p; - fputs(prompt, stdout); - line[0] = 0; - p = fgets(line, sizeof(line)-1, stdin); - if (p) p = strchr(p, '\n'); - if (p) *p = 0; - return p?line:NULL; -} - -static int do_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, - void *state) -{ - return tdb_delete(the_tdb, key); -} - -static void first_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey) -{ - TDB_DATA dbuf; - *pkey = tdb_firstkey(the_tdb); - - dbuf = tdb_fetch(the_tdb, *pkey); - if (!dbuf.dptr) terror("fetch failed"); - else { - /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */ - print_rec(the_tdb, *pkey, dbuf, NULL); - } -} - -static void next_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey) -{ - TDB_DATA dbuf; - *pkey = tdb_nextkey(the_tdb, *pkey); - - dbuf = tdb_fetch(the_tdb, *pkey); - if (!dbuf.dptr) - terror("fetch failed"); - else - /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */ - print_rec(the_tdb, *pkey, dbuf, NULL); -} - -int main(int argc, char *argv[]) -{ - int bIterate = 0; - char *line; - char *tok; - TDB_DATA iterate_kbuf; - - if (argv[1]) { - static char tmp[1024]; - sprintf(tmp, "open %s", argv[1]); - tok=strtok(tmp," "); - open_tdb(); - } - - while ((line = tdb_getline("tdb> "))) { - - /* Shell command */ - - if (line[0] == '!') { - system(line + 1); - continue; - } - - if ((tok = strtok(line," "))==NULL) { - if (bIterate) - next_record(tdb, &iterate_kbuf); - continue; - } - if (strcmp(tok,"create") == 0) { - bIterate = 0; - create_tdb(); - continue; - } else if (strcmp(tok,"open") == 0) { - open_tdb(); - continue; - } else if ((strcmp(tok, "q") == 0) || - (strcmp(tok, "quit") == 0)) { - break; - } - - /* all the rest require a open database */ - if (!tdb) { - bIterate = 0; - terror("database not open"); - help(); - continue; - } - - if (strcmp(tok,"insert") == 0) { - bIterate = 0; - insert_tdb(); - } else if (strcmp(tok,"store") == 0) { - bIterate = 0; - store_tdb(); - } else if (strcmp(tok,"show") == 0) { - bIterate = 0; - show_tdb(); - } else if (strcmp(tok,"erase") == 0) { - bIterate = 0; - tdb_traverse(tdb, do_delete_fn, NULL); - } else if (strcmp(tok,"delete") == 0) { - bIterate = 0; - delete_tdb(); - } else if (strcmp(tok,"dump") == 0) { - bIterate = 0; - tdb_traverse(tdb, print_rec, NULL); - } else if (strcmp(tok,"move") == 0) { - bIterate = 0; - move_rec(); - } else if (strcmp(tok,"list") == 0) { - tdb_dump_all(tdb); - } else if (strcmp(tok, "free") == 0) { - tdb_printfreelist(tdb); - } else if (strcmp(tok,"info") == 0) { - info_tdb(); - } else if ( (strcmp(tok, "1") == 0) || - (strcmp(tok, "first") == 0)) { - bIterate = 1; - first_record(tdb, &iterate_kbuf); - } else if ((strcmp(tok, "n") == 0) || - (strcmp(tok, "next") == 0)) { - next_record(tdb, &iterate_kbuf); - } else if ((strcmp(tok, "keys") == 0)) { - bIterate = 0; - tdb_traverse(tdb, print_key, NULL); - } else { - help(); - } - } - - if (tdb) tdb_close(tdb); - - return 0; -} diff --git a/tdb/tdbtorture.c b/tdb/tdbtorture.c deleted file mode 100644 index e27bbff990..0000000000 --- a/tdb/tdbtorture.c +++ /dev/null @@ -1,226 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tdb.h" - -/* this tests tdb by doing lots of ops from several simultaneous - writers - that stresses the locking code. Build with TDB_DEBUG=1 - for best effect */ - - - -#define REOPEN_PROB 30 -#define DELETE_PROB 8 -#define STORE_PROB 4 -#define APPEND_PROB 6 -#define LOCKSTORE_PROB 0 -#define TRAVERSE_PROB 20 -#define CULL_PROB 100 -#define KEYLEN 3 -#define DATALEN 100 -#define LOCKLEN 20 - -static TDB_CONTEXT *db; - -static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - vfprintf(stdout, format, ap); - va_end(ap); - fflush(stdout); -#if 0 - { - char *ptr; - asprintf(&ptr,"xterm -e gdb /proc/%d/exe %d", getpid(), getpid()); - system(ptr); - free(ptr); - } -#endif -} - -static void fatal(char *why) -{ - perror(why); - exit(1); -} - -static char *randbuf(int len) -{ - char *buf; - int i; - buf = (char *)malloc(len+1); - - for (i=0;i Date: Wed, 22 Oct 2003 19:38:59 -0700 Subject: [PATCH] make libsysfs spit debug messages to the same place as the rest of udev. --- libsysfs/sysfs.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 00599954fd..e39b7413cb 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -41,9 +41,17 @@ extern int isascii(int c); /* Debugging */ #ifdef DEBUG -#define dprintf(format, arg...) fprintf(stderr, format, ## arg) +#include +#define dprintf(format, arg...) \ + do { \ + log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + } while (0) #else #define dprintf(format, arg...) do { } while (0) #endif +extern int log_message (int level, const char *format, ...) + __attribute__ ((format (printf, 2, 3))); + + #endif /* _SYSFS_H_ */ -- cgit v1.2.3-54-g00ecf From aa04c7f0cf40d07a25cc3186c8d786cf9014f531 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 19:39:28 -0700 Subject: [PATCH] tweak tdb to build within udev better. --- tdb/spinlock.c | 8 +++++++- tdb/tdb.c | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tdb/spinlock.c b/tdb/spinlock.c index 2370ce3bdd..4b17b1d943 100644 --- a/tdb/spinlock.c +++ b/tdb/spinlock.c @@ -17,11 +17,17 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +/* udev defines */ +#define STANDALONE +#define TDB_DEBUG +#define HAVE_MMAP 1 + + #if HAVE_CONFIG_H #include #endif -#if STANDALONE +#ifdef STANDALONE #include #include #include diff --git a/tdb/tdb.c b/tdb/tdb.c index 34681ea78f..772602ed5b 100644 --- a/tdb/tdb.c +++ b/tdb/tdb.c @@ -41,6 +41,12 @@ * right time. Probably too hard -- the process just doesn't know. */ +/* udev defines */ +#define STANDALONE +#define TDB_DEBUG +#define HAVE_MMAP 1 + + #ifdef STANDALONE #if HAVE_CONFIG_H #include -- cgit v1.2.3-54-g00ecf From 32ff5bca1517932b1e14caddd8d19fb29ef693ba Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 19:39:54 -0700 Subject: [PATCH] udev-add build cleanups for other libc versions. --- udev-add.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev-add.c b/udev-add.c index 3b0e4ddf0e..8c63214a46 100644 --- a/udev-add.c +++ b/udev-add.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "udev.h" #include "udev_version.h" -- cgit v1.2.3-54-g00ecf From 1c386a909af69bc5b53eb03fedead725f5fc8331 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 22:39:59 -0700 Subject: [PATCH] udev build tweaks to tdb's spinlock code --- tdb/spinlock.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tdb/spinlock.c b/tdb/spinlock.c index 4b17b1d943..9bf42adfcf 100644 --- a/tdb/spinlock.c +++ b/tdb/spinlock.c @@ -21,7 +21,7 @@ #define STANDALONE #define TDB_DEBUG #define HAVE_MMAP 1 - +#include "../udev.h" #if HAVE_CONFIG_H #include @@ -40,7 +40,6 @@ #include "tdb.h" #include "spinlock.h" -#define DEBUG #else #include "includes.h" #endif @@ -299,10 +298,8 @@ static void __write_unlock(tdb_rwlock_t *rwlock) { __spin_lock(&rwlock->lock); -#ifdef DEBUG if (!(rwlock->count & RWLOCK_BIAS)) - fprintf(stderr, "bug: write_unlock\n"); -#endif + dbg("bug: write_unlock"); rwlock->count &= ~RWLOCK_BIAS; __spin_unlock(&rwlock->lock); @@ -312,13 +309,11 @@ static void __read_unlock(tdb_rwlock_t *rwlock) { __spin_lock(&rwlock->lock); -#ifdef DEBUG if (!rwlock->count) - fprintf(stderr, "bug: read_unlock\n"); + dbg("bug: read_unlock"); if (rwlock->count & RWLOCK_BIAS) - fprintf(stderr, "bug: read_unlock\n"); -#endif + dbg("bug: read_unlock"); rwlock->count--; __spin_unlock(&rwlock->lock); -- cgit v1.2.3-54-g00ecf From 5c75a3ecd1852abaf4d9ee67a37ee56b0cf0a6d3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 19:40:52 -0700 Subject: [PATCH] build tdb and libsysfs from the same makefile as udev. This fixes problem of libsysfs and tdb getting build with different gcc options as the rest of udev. --- Makefile | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index ea0dc10c28..6b2c39993c 100644 --- a/Makefile +++ b/Makefile @@ -125,15 +125,21 @@ else LDFLAGS = --static endif -LIB=libsysfs - all: $(LIBC) $(ROOT) $(ARCH_LIB_OBJS) : $(MAKE) -C klibc -LIBSYSFS = libsysfs/libsysfs.a -TDB = tdb/tdb.o tdb/spinlock.o +TDB = tdb/tdb.o \ + tdb/spinlock.o + +SYSFS = libsysfs/sysfs_bus.o \ + libsysfs/sysfs_class.o \ + libsysfs/sysfs_device.o \ + libsysfs/sysfs_dir.o \ + libsysfs/sysfs_driver.o \ + libsysfs/sysfs_utils.o \ + libsysfs/dlist.o OBJS = udev.o \ udev-add.o \ @@ -141,14 +147,9 @@ OBJS = udev.o \ udevdb.o \ logging.o \ namedev.o \ + $(SYSFS) \ $(TDB) -libsysfs/libsysfs.a: - $(MAKE) -C libsysfs - -tdb/tdb.o: - $(MAKE) -C tdb - # header files automatically generated GEN_HEADERS = udev_version.h @@ -159,9 +160,8 @@ udev_version.h: @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ -$(ROOT): $(GEN_HEADERS) $(OBJS) $(LIBSYSFS) $(TDB) - $(MAKE) -C libsysfs - $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) -lsysfs $(LIB_OBJS) -L$(LIB) $(ARCH_LIB_OBJS) +$(ROOT): $(GEN_HEADERS) $(OBJS) + $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) clean: @@ -169,8 +169,6 @@ clean: | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(MAKE) -C klibc clean - $(MAKE) -C libsysfs clean - $(MAKE) -C tdb clean DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort ) DISTDIR := $(RELEASE_NAME) -- cgit v1.2.3-54-g00ecf From bb27dd9b6d6ace3594e0e2d94c7642c40db0003e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 22:30:50 -0700 Subject: [PATCH] klibc makefile changes. --- Makefile.klibc | 53 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/Makefile.klibc b/Makefile.klibc index d196d6f547..d679ba900b 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -1,6 +1,6 @@ -# Makefile for diethotplug +# Makefile for udev # -# Copyright (C) 2000,2001 Greg Kroah-Hartman +# Copyright (C) 2003 Greg Kroah-Hartman # # 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 @@ -22,10 +22,28 @@ DEBUG = true ROOT = udev -VERSION = 0.1 +VERSION = 004_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) +# override this to make udev look in a different location for it's config files +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +mandir = ${prefix}/usr/share/man +hotplugdir = ${etcdir}/hotplug.d/default +configdir = ${etcdir}/udev/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + + +# place to put our device nodes +udevdir = ${prefix}/udev/ # Comment out this line to build with something other # than the local version of klibc @@ -38,7 +56,9 @@ CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- CC = $(CROSS)gcc AR = $(CROSS)ar STRIP = $(CROSS)strip +RANLIB = $(CROSS)ranlib +export CROSS CC AR STRIP RANLIB # code taken from uClibc to determine the current arch ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ @@ -54,7 +74,8 @@ GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ then echo "-Os"; else echo "-O2" ; fi} -WARNINGS := -Wall -Wshadow -Wstrict-prototypes +# add -Wredundant-decls when libsysfs gets cleaned up +WARNINGS := -Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations # Some nice architecture specific optimizations ifeq ($(strip $(TARGET_ARCH)),arm) @@ -109,22 +130,38 @@ else LDFLAGS = --static endif +LIB=libsysfs + all: $(LIBC) $(ROOT) $(ARCH_LIB_OBJS) : $(MAKE) -C klibc +LIBSYSFS = libsysfs/libsysfs.a +TDB = tdb/tdb.o tdb/spinlock.o + OBJS = udev.o \ + udev-add.o \ + udev-remove.o \ + udevdb.o \ logging.o \ - namedev.o + namedev.o \ + $(TDB) + +libsysfs/libsysfs.a: + $(MAKE) -C libsysfs +tdb/tdb.o: + $(MAKE) -C tdb # header files automatically generated GEN_HEADERS = udev_version.h # Rules on how to create the generated header files udev_version.h: - @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ + @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ + @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ + @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ $(ROOT): $(GEN_HEADERS) $(OBJS) @@ -137,8 +174,10 @@ clean: | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(MAKE) -C klibc clean + $(MAKE) -C libsysfs clean + $(MAKE) -C tdb clean -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS ) +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . release: $(DISTFILES) clean -- cgit v1.2.3-54-g00ecf From c8ba857171bd09a0019d3182fe989c6cf06d98d2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 23:46:19 -0700 Subject: [PATCH] libsysfs does not need mntent.h in it's header file. --- libsysfs/sysfs.h | 1 - 1 file changed, 1 deletion(-) diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index e39b7413cb..3186c37a16 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3-54-g00ecf From 1e959a4b05f93bf31d0603a027b50cb148ef7e90 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 23:48:55 -0700 Subject: [PATCH] klibc specific tweaks --- Makefile.klibc | 48 ++++++++++++++------------------------------ klibc.c | 33 ++++++++++++++++++++++++++++++ klibc/klibc/include/signal.h | 2 ++ libsysfs/sysfs_dir.c | 4 ++++ libsysfs/sysfs_utils.c | 8 ++++++++ namedev.c | 2 ++ udev-add.c | 9 ++++++++- 7 files changed, 72 insertions(+), 34 deletions(-) create mode 100644 klibc.c diff --git a/Makefile.klibc b/Makefile.klibc index d679ba900b..ccc862dd8b 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -106,7 +106,7 @@ endif # If we are using our version of klibc, then we need to build and link it. # Otherwise, use glibc and link statically. ifeq ($(strip $(KLIBC)),true) - KLIBC_DIR = /home/greg/src/klibc/klibc/klibc + KLIBC_DIR = klibc/klibc INCLUDE_DIR := $(KLIBC_DIR)/include # arch specific objects LIBGCC = $(shell $(CC) --print-libgcc) @@ -120,7 +120,7 @@ ifeq ($(strip $(KLIBC)),true) # LIB_OBJS = $(GCC_LIB) LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) - CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/bits32 -I/home/greg/linux/linux-2.5/include -I$(GCCINCDIR) + CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/bits32 -I/home/greg/linux/linux-2.5/include -I$(GCCINCDIR) -D__KLIBC__ LDFLAGS = # LDFLAGS = --static --nostdlib -nostartfiles else @@ -130,15 +130,21 @@ else LDFLAGS = --static endif -LIB=libsysfs - all: $(LIBC) $(ROOT) $(ARCH_LIB_OBJS) : $(MAKE) -C klibc -LIBSYSFS = libsysfs/libsysfs.a -TDB = tdb/tdb.o tdb/spinlock.o +TDB = tdb/tdb.o \ + tdb/spinlock.o + +SYSFS = libsysfs/sysfs_bus.o \ + libsysfs/sysfs_class.o \ + libsysfs/sysfs_device.o \ + libsysfs/sysfs_dir.o \ + libsysfs/sysfs_driver.o \ + libsysfs/sysfs_utils.o \ + libsysfs/dlist.o OBJS = udev.o \ udev-add.o \ @@ -146,14 +152,10 @@ OBJS = udev.o \ udevdb.o \ logging.o \ namedev.o \ + klibc.o \ + $(SYSFS) \ $(TDB) -libsysfs/libsysfs.a: - $(MAKE) -C libsysfs - -tdb/tdb.o: - $(MAKE) -C tdb - # header files automatically generated GEN_HEADERS = udev_version.h @@ -165,7 +167,7 @@ udev_version.h: $(ROOT): $(GEN_HEADERS) $(OBJS) -# $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(LD) $(LDFLAGS) -o $(ROOT) $(KLIBC_DIR)/crt0.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) @@ -174,24 +176,4 @@ clean: | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(MAKE) -C klibc clean - $(MAKE) -C libsysfs clean - $(MAKE) -C tdb clean -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort ) -DISTDIR := $(RELEASE_NAME) -srcdir = . -release: $(DISTFILES) clean -# @echo $(DISTFILES) - @-rm -rf $(DISTDIR) - @mkdir $(DISTDIR) - @-chmod 777 $(DISTDIR) - @for file in $(DISTFILES); do \ - if test -d $$file; then \ - mkdir $(DISTDIR)/$$file; \ - else \ - cp -p $$file $(DISTDIR)/$$file; \ - fi; \ - done - @tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz - @rm -rf $(DISTDIR) - @echo "Built $(RELEASE_NAME).tar.gz" diff --git a/klibc.c b/klibc.c new file mode 100644 index 0000000000..a5d5d5948a --- /dev/null +++ b/klibc.c @@ -0,0 +1,33 @@ + +#ifdef __KLIBC__ + +#include +#include +#include + +char *strerror(int errnum) +{ + return "some error"; +} + +int strcasecmp(const char *s1, const char *s2) +{ + char *n1; + char *n2; + int retval; + int i; + + n1 = strdup(s1); + n2 = strdup(s2); + + for (i = 0; i < strlen(n1); ++i) + n1[i] = toupper(n1[i]); + for (i = 0; i < strlen(n2); ++i) + n2[i] = toupper(n2[i]); + retval = strcmp(n1, n2); + free(n1); + free(n2); + return retval; +} + +#endif diff --git a/klibc/klibc/include/signal.h b/klibc/klibc/include/signal.h index ffd2beba43..e383755b20 100644 --- a/klibc/klibc/include/signal.h +++ b/klibc/klibc/include/signal.h @@ -22,6 +22,8 @@ # define NSIG _NSIG #endif +typedef int sig_atomic_t; + __extern const char * const sys_siglist[]; /* This assumes sigset_t is either an unsigned long or an array of such, diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index ff2edf4615..e983d0eff4 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -266,7 +266,11 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) sysattr->path); return -1; } +#ifdef __KLIBC__ + pgsize = 0x4000; +#else pgsize = getpagesize(); +#endif fbuf = (unsigned char *)calloc(1, pgsize+1); if (fbuf == NULL) { dprintf("calloc failed\n"); diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 4475342433..f1303cacb3 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -22,6 +22,9 @@ */ #include "libsysfs.h" #include "sysfs.h" +#ifndef __KLIBC__ +#include +#endif /** * sysfs_get_mnt_path: Gets the mount point for specified filesystem. @@ -33,6 +36,10 @@ static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, unsigned char *mnt_path, size_t len) { +#ifdef __KLIBC__ + strcpy(mnt_path, "/sys"); + return 0; +#else FILE *mnt; struct mntent *mntent; int ret = 0; @@ -66,6 +73,7 @@ static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, ret = -1; } return ret; +#endif } /* diff --git a/namedev.c b/namedev.c index 22ec6ace24..6d88b5d47a 100644 --- a/namedev.c +++ b/namedev.c @@ -527,10 +527,12 @@ static int exec_callout(struct config_device *dev, char *value, int len) retval = -1; } +#ifndef __KLIBC__ if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { dbg("callout program status 0x%x", status); retval = -1; } +#endif } return retval; } diff --git a/udev-add.c b/udev-add.c index 8c63214a46..7a89076add 100644 --- a/udev-add.c +++ b/udev-add.c @@ -73,10 +73,17 @@ static int create_node(struct udevice *dev) { char filename[255]; int retval = 0; + dev_t res; strncpy(filename, udev_root, sizeof(filename)); strncat(filename, dev->name, sizeof(filename)); +#ifdef __KLIBC__ + res = (dev->major << 8) | (dev->minor); +#else + res = makedev(dev->major, dev->minor); +#endif + switch (dev->type) { case 'b': dev->mode |= S_IFBLK; @@ -94,7 +101,7 @@ static int create_node(struct udevice *dev) } dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor); - retval = mknod(filename, dev->mode, makedev(dev->major, dev->minor)); + retval = mknod(filename, dev->mode, res); if (retval) dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", filename, dev->mode, dev->major, dev->minor, strerror(errno)); -- cgit v1.2.3-54-g00ecf From 1861680616736c7be1b014173e0cc0d5054b710a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 22 Oct 2003 23:59:44 -0700 Subject: [PATCH] add ftruncate to klibc. probably got it wrong too... --- klibc/klibc/SYSCALLS | 1 + 1 file changed, 1 insertion(+) diff --git a/klibc/klibc/SYSCALLS b/klibc/klibc/SYSCALLS index 1ec94acec6..802f8a1711 100644 --- a/klibc/klibc/SYSCALLS +++ b/klibc/klibc/SYSCALLS @@ -103,6 +103,7 @@ int poll(struct pollfd *, nfds_t, long) int fsync(int) int readv(int, const struct iovec *, int) int writev(int, const struct iovec *, int) +int ftruncate(int, off_t) # # Signal operations -- cgit v1.2.3-54-g00ecf From 606bce83da8edaa63d249a15c2d7439856526249 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 23 Oct 2003 00:12:41 -0700 Subject: [PATCH] added vsyslog support to klibc. --- klibc/klibc/include/syslog.h | 2 ++ klibc/klibc/syslog.c | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/klibc/klibc/include/syslog.h b/klibc/klibc/include/syslog.h index b6c0acfea1..a58ef05674 100644 --- a/klibc/klibc/include/syslog.h +++ b/klibc/klibc/include/syslog.h @@ -6,6 +6,7 @@ #define _SYSLOG_H #include +#include /* Alert levels */ #define LOG_EMERG 0 @@ -49,5 +50,6 @@ __extern void openlog(const char *, int, int); __extern void syslog(int, const char *, ...); __extern void closelog(void); +__extern void vsyslog(int, const char *format, va_list ap); #endif /* _SYSLOG_H */ diff --git a/klibc/klibc/syslog.c b/klibc/klibc/syslog.c index b031d4f0e7..d40d8633d1 100644 --- a/klibc/klibc/syslog.c +++ b/klibc/klibc/syslog.c @@ -40,9 +40,8 @@ void openlog(const char *ident, int option, int facility) id[MAXID] = '\0'; /* Make sure it's null-terminated */ } -void syslog(int prio, const char *format, ...) +void vsyslog(int prio, const char *format, va_list ap) { - va_list ap; char buf[BUFLEN]; int rv, len; int fd; @@ -62,9 +61,7 @@ void syslog(int prio, const char *format, ...) if ( *id ) len += sprintf(buf+3, "%s: ", id); - va_start(ap, format); rv = vsnprintf(buf+len, BUFLEN-len, format, ap); - va_end(ap); len += rv; if ( len > BUFLEN-1 ) len = BUFLEN-1; @@ -72,3 +69,12 @@ void syslog(int prio, const char *format, ...) write(fd, buf, len+1); } + +void syslog(int prio, const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + vsyslog(prio, format, ap); + va_end(ap); +} -- cgit v1.2.3-54-g00ecf From 6c5c770ac62791fd514f3eee9e7a5a831eef8d32 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 23 Oct 2003 00:12:58 -0700 Subject: [PATCH] turn off debugging in namedev --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 6d88b5d47a..99542dc4d6 100644 --- a/namedev.c +++ b/namedev.c @@ -22,7 +22,7 @@ */ /* define this to enable parsing debugging */ -#define DEBUG_PARSER +/* #define DEBUG_PARSER */ #include #include -- cgit v1.2.3-54-g00ecf From 9c516bec0df7aeb43bc78ce214b3ac515818de7a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 23 Oct 2003 00:13:16 -0700 Subject: [PATCH] turn off debugging if we are building with klibc --- Makefile.klibc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.klibc b/Makefile.klibc index ccc862dd8b..b901170544 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -18,7 +18,7 @@ # Set the following to `true' to make a debuggable build. # Leave this set to `false' for production use. -DEBUG = true +DEBUG = false ROOT = udev -- cgit v1.2.3-54-g00ecf From a34ea8f598af378dcd63528b6328d1bff7fab0f1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 23 Oct 2003 00:19:18 -0700 Subject: [PATCH] added README info for how to build using klibc. --- README | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README b/README index ed25a733ab..655a30051e 100644 --- a/README +++ b/README @@ -45,8 +45,14 @@ Things are still quite rough, and it's a bit beyond proof of concept code. Help is very much appreciated, see the TODO file for a list of things left to be done. +If you want to build using klibc, use the Makefile.klibc file: + make clean + make -f Makefile.klibc +and marvel at the tiny binary you just created :) + Any comment/questions/concerns please let me know. greg k-h greg@kroah.com + -- cgit v1.2.3-54-g00ecf From c332cfc72da865f3c9f5e34867fc3ac1b0bf0154 Mon Sep 17 00:00:00 2001 From: "rml@tech9.net" Date: Thu, 23 Oct 2003 00:50:27 -0700 Subject: [PATCH] udev: sleep_for_dev() bits OK, I fixed that bug you hinted at earlier in my previous sleep_for_dev() patch. I am sure you fixed it, but here we go nonetheless, just in case. I actually changed it up a bit. It is probably faster to count down from SECONDS_TO_WAIT_FOR_DEV than count up. I also made the lone 'path' argument const, since it can be. Some other misc. bits, too. --- udev-add.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/udev-add.c b/udev-add.c index 7a89076add..d237834c68 100644 --- a/udev-add.c +++ b/udev-add.c @@ -139,26 +139,24 @@ exit: static int sleep_for_dev(char *path) { char filename[SYSFS_PATH_MAX + 6]; - struct stat buf; - int loop = 0; - int retval = -ENODEV; + int loop = SECONDS_TO_WAIT_FOR_DEV; + int retval; strcpy(filename, sysfs_path); strcat(filename, path); strcat(filename, "/dev"); - while (loop < SECONDS_TO_WAIT_FOR_DEV) { + while (loop--) { + struct stat buf; + dbg("looking for %s", filename); retval = stat(filename, &buf); - if (retval == 0) { - retval = 0; + if (!retval) goto exit; - } /* sleep for a second or two to give the kernel a chance to * create the dev file */ sleep(1); - ++loop; } retval = -ENODEV; exit: -- cgit v1.2.3-54-g00ecf From c94705b5648499c58b32099dc3a303b64e1de603 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 23 Oct 2003 01:04:09 -0700 Subject: [PATCH] get 'make release' to work properly again. --- Makefile | 1 + Makefile.klibc | 2 +- klibc.c | 33 --------------------------------- klibc_fixups.c | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+), 34 deletions(-) delete mode 100644 klibc.c create mode 100644 klibc_fixups.c diff --git a/Makefile b/Makefile index 6b2c39993c..96037e486d 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,7 @@ OBJS = udev.o \ udevdb.o \ logging.o \ namedev.o \ + klibc_fixups.o \ $(SYSFS) \ $(TDB) diff --git a/Makefile.klibc b/Makefile.klibc index b901170544..aca73adb53 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -152,7 +152,7 @@ OBJS = udev.o \ udevdb.o \ logging.o \ namedev.o \ - klibc.o \ + klibc_fixups.o \ $(SYSFS) \ $(TDB) diff --git a/klibc.c b/klibc.c deleted file mode 100644 index a5d5d5948a..0000000000 --- a/klibc.c +++ /dev/null @@ -1,33 +0,0 @@ - -#ifdef __KLIBC__ - -#include -#include -#include - -char *strerror(int errnum) -{ - return "some error"; -} - -int strcasecmp(const char *s1, const char *s2) -{ - char *n1; - char *n2; - int retval; - int i; - - n1 = strdup(s1); - n2 = strdup(s2); - - for (i = 0; i < strlen(n1); ++i) - n1[i] = toupper(n1[i]); - for (i = 0; i < strlen(n2); ++i) - n2[i] = toupper(n2[i]); - retval = strcmp(n1, n2); - free(n1); - free(n2); - return retval; -} - -#endif diff --git a/klibc_fixups.c b/klibc_fixups.c new file mode 100644 index 0000000000..a5d5d5948a --- /dev/null +++ b/klibc_fixups.c @@ -0,0 +1,33 @@ + +#ifdef __KLIBC__ + +#include +#include +#include + +char *strerror(int errnum) +{ + return "some error"; +} + +int strcasecmp(const char *s1, const char *s2) +{ + char *n1; + char *n2; + int retval; + int i; + + n1 = strdup(s1); + n2 = strdup(s2); + + for (i = 0; i < strlen(n1); ++i) + n1[i] = toupper(n1[i]); + for (i = 0; i < strlen(n2); ++i) + n2[i] = toupper(n2[i]); + retval = strcmp(n1, n2); + free(n1); + free(n2); + return retval; +} + +#endif -- cgit v1.2.3-54-g00ecf From 0fba212217eba2fee944583a54ef66f532459fc0 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 23 Oct 2003 01:04:30 -0700 Subject: [PATCH] add klibc linux symlink info to the README --- README | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README b/README index 655a30051e..6fa3a28b36 100644 --- a/README +++ b/README @@ -46,8 +46,10 @@ code. Help is very much appreciated, see the TODO file for a list of things left to be done. If you want to build using klibc, use the Makefile.klibc file: - make clean - make -f Makefile.klibc + - read the klibc/klibc/klibc/README file for how to set up the linux + symlink properly. + - make clean + - make -f Makefile.klibc and marvel at the tiny binary you just created :) Any comment/questions/concerns please let me know. @@ -56,3 +58,4 @@ greg k-h greg@kroah.com + -- cgit v1.2.3-54-g00ecf From e1b579406db58dc4ced1bec6339f7647c4fd69ea Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 23 Oct 2003 01:08:58 -0700 Subject: [PATCH] 005 release --- ChangeLog | 47 +++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- Makefile.klibc | 2 +- README | 2 +- udev.spec | 2 +- 5 files changed, 51 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index b57cd72eaf..b8fdf91c23 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,50 @@ +Summary of changes from v004 to v005 +============================================ + +: + o namedev.c comments + debug patch + o man page update + +Greg Kroah-Hartman: + o ignore the klibc/linux symlink + o add klibc linux symlink info to the README + o get 'make release' to work properly again + o added README info for how to build using klibc + o turn off debugging if we are building with klibc + o turn off debugging in namedev + o added vsyslog support to klibc + o add ftruncate to klibc + o klibc specific tweaks + o libsysfs does not need mntent.h in it's header file + o udev build tweaks to tdb's spinlock code + o klibc makefile changes + o build tdb and libsysfs from the same makefile as udev + o udev-add build cleanups for other libc versions + o tweak tdb to build within udev better + o make libsysfs spit debug messages to the same place as the rest of udev + o make libsysfs build cleanly + o updated bk ignore list + o added klibc version 0.82 (cvs tree) to the udev tree + o makefile fix for now + o Merge greg@bucket:/home/greg/src/udev into kroah.com:/home/greg/src/udev + o hm, makefile bug with so many files... will fix later + o regression tests starting to be added + o fix LABEL bug for device files (not class files.) + o more warning flags to the build + o got rid of struct device_attr + o rename namedev.permissions and namedev.config to udev.permissions and udev.config + o fix dbg line in namedev.c + o more overrides of config info with env variables if in test mode + o Fix bug causing udev to sleep forever waiting for dev file to show up + o change version to 004_bk + o make config files, sysfs root, and udev root configurable from config variables + o 004 changelog entrys TAG: v004 + +Robert Love: + o udev: sleep_for_dev() bits + o udev: another canidate for static + + Summary of changes from v003 to v004 ============================================ diff --git a/Makefile b/Makefile index 96037e486d..82ea0bc309 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 004_bk +VERSION = 005 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/Makefile.klibc b/Makefile.klibc index aca73adb53..f8f3955676 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -22,7 +22,7 @@ DEBUG = false ROOT = udev -VERSION = 004_bk +VERSION = 005 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/README b/README index 6fa3a28b36..fffa793987 100644 --- a/README +++ b/README @@ -46,7 +46,7 @@ code. Help is very much appreciated, see the TODO file for a list of things left to be done. If you want to build using klibc, use the Makefile.klibc file: - - read the klibc/klibc/klibc/README file for how to set up the linux + - read the klibc/klibc/README file for how to set up the linux symlink properly. - make clean - make -f Makefile.klibc diff --git a/udev.spec b/udev.spec index ffdfb2470d..4489065051 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 004_bk +Version: 005 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 6ea7aa72dd894e723aef8881bd55766914cb07ed Mon Sep 17 00:00:00 2001 From: "lethal@linux-sh.org" Date: Fri, 24 Oct 2003 23:37:17 -0700 Subject: [PATCH] Fixup path for kernel includes when building with klibc. Fixup path for kernel includes when building with klibc. klibc expects the symlink klibc/linux to point to a relatively up to date tree, use -Iklibc/linux/include to make linux/ and asm/ includes resolve properly, as these won't exist in the regular klibc/klibc/include location. --- Makefile.klibc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.klibc b/Makefile.klibc index f8f3955676..f7c3dbd844 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -120,7 +120,7 @@ ifeq ($(strip $(KLIBC)),true) # LIB_OBJS = $(GCC_LIB) LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) - CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/bits32 -I/home/greg/linux/linux-2.5/include -I$(GCCINCDIR) -D__KLIBC__ + CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/bits32 -I$(GCCINCDIR) -Iklibc/linux/include -D__KLIBC__ LDFLAGS = # LDFLAGS = --static --nostdlib -nostartfiles else -- cgit v1.2.3-54-g00ecf From 38ebdcac033c88e01d75ca1f4a18893fb6d2de2e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 25 Oct 2003 00:20:51 -0700 Subject: [PATCH] klibc build fixes Still can't seem to build both klibc and glibc versions from same makefile :( --- Makefile.klibc | 60 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/Makefile.klibc b/Makefile.klibc index f7c3dbd844..808217e121 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -18,7 +18,7 @@ # Set the following to `true' to make a debuggable build. # Leave this set to `false' for production use. -DEBUG = false +DEBUG = true ROOT = udev @@ -112,18 +112,18 @@ ifeq ($(strip $(KLIBC)),true) LIBGCC = $(shell $(CC) --print-libgcc) ARCH_LIB_OBJS = \ $(KLIBC_DIR)/libc.a \ -# $(KLIBC_DIR)/crt0.o \ -# $(LIBGCC) -# $(KLIBC_DIR)/bin-$(ARCH)/start.o \ -# $(KLIBC_DIR)/bin-$(ARCH)/klibc.a + $(LIBGCC) -# LIB_OBJS = $(GCC_LIB) + CRT0 = $(KLIBC_DIR)/crt0.o LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/bits32 -I$(GCCINCDIR) -Iklibc/linux/include -D__KLIBC__ - LDFLAGS = -# LDFLAGS = --static --nostdlib -nostartfiles + LIB_OBJS = + LDFLAGS = --static --nostdlib -nostartfiles else +# ARCH_LIB_OBJS = /usr/lib/libc.a + LIBGCC = $(shell $(CC) --print-libgcc) + CRT0 = /usr/lib/crt1.o /usr/lib/crti.o LIBC = CFLAGS += -I$(GCCINCDIR) LIB_OBJS = -lc @@ -167,8 +167,7 @@ udev_version.h: $(ROOT): $(GEN_HEADERS) $(OBJS) - $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(LD) $(LDFLAGS) -o $(ROOT) $(KLIBC_DIR)/crt0.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(LIBGCC) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) clean: @@ -177,3 +176,44 @@ clean: -rm -f core $(ROOT) $(GEN_HEADERS) $(MAKE) -C klibc clean +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort ) +DISTDIR := $(RELEASE_NAME) +srcdir = . +release: $(DISTFILES) clean +# @echo $(DISTFILES) + @-rm -rf $(DISTDIR) + @mkdir $(DISTDIR) + @-chmod 777 $(DISTDIR) + @for file in $(DISTFILES); do \ + if test -d $$file; then \ + mkdir $(DISTDIR)/$$file; \ + else \ + cp -p $$file $(DISTDIR)/$$file; \ + fi; \ + done + @tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz + @rm -rf $(DISTDIR) + @echo "Built $(RELEASE_NAME).tar.gz" + + +install: all + $(INSTALL) -d $(udevdir) + $(INSTALL) -d $(configdir) + $(INSTALL) -d $(hotplugdir) + $(INSTALL_PROGRAM) -D $(ROOT) $(sbindir)/$(ROOT) + $(INSTALL_DATA) -D udev.8 $(mandir)/man8/udev.8 + $(INSTALL_DATA) udev.config $(configdir) + $(INSTALL_DATA) udev.permissions $(configdir) + - ln -s $(sbindir)/$(ROOT) $(hotplugdir)/udev.hotplug + +uninstall: + - rm $(hotplugdir)/udev.hotplug + - rm $(configdir)/udev.permissions + - rm $(configdir)/udev.config + - rm $(mandir)/man8/udev.8 + - rm $(sbindir)/$(ROOT) + - rmdir $(hotplugdir) + - rmdir $(configdir) + - rmdir $(udevdir) + + -- cgit v1.2.3-54-g00ecf From 2d5b68864f8beeaa89b3d026c6de9a97d70eeb04 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 25 Oct 2003 00:21:18 -0700 Subject: [PATCH] pull some klibc stuff into the make Makefile to try to stay in sync. --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 82ea0bc309..8d7122858b 100644 --- a/Makefile +++ b/Makefile @@ -106,19 +106,22 @@ endif # If we are using our version of klibc, then we need to build and link it. # Otherwise, use glibc and link statically. ifeq ($(strip $(KLIBC)),true) - KLIBC_DIR = klibc + KLIBC_DIR = klibc/klibc INCLUDE_DIR := $(KLIBC_DIR)/include # arch specific objects + LIBGCC = $(shell $(CC) --print-libgcc) ARCH_LIB_OBJS = \ - $(KLIBC_DIR)/bin-$(ARCH)/start.o \ - $(KLIBC_DIR)/bin-$(ARCH)/klibc.a + $(KLIBC_DIR)/libc.a \ + $(LIBGCC) - LIB_OBJS = $(GCC_LIB) + CRT0 = $(KLIBC_DIR)/crt0.o LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) - CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(GCCINCDIR) + CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/bits32 -I$(GCCINCDIR) -Iklibc/linux/include -D__KLIBC__ + LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles else + CRT0 = LIBC = CFLAGS += -I$(GCCINCDIR) LIB_OBJS = -lc -- cgit v1.2.3-54-g00ecf From 8b94dcd0671b038754af7683eccea5b32ccb955d Mon Sep 17 00:00:00 2001 From: "rml@tech9.net" Date: Wed, 29 Oct 2003 22:14:24 -0800 Subject: [PATCH] udev init script I integrated udev with Fedora Core. The main piece is simply building /udev on boot, since we don't have an initramfs yet. We should also clear out /udev on shutdown, for /udev directories mounted on persistent media. The attached script goes in /etc/init.d Then do "chkconfig --add udev" And the rest is handled automatically. I made it for Fedora but it will probably work, with little change, on any Linux system. Right now it only does sysfs-based discovery of block and tty devices, since those are the only types of devices I have on my system. There is a TODO in the script where we would add the other device types. --- etc/init.d/udev | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 etc/init.d/udev diff --git a/etc/init.d/udev b/etc/init.d/udev new file mode 100644 index 0000000000..99f06c2963 --- /dev/null +++ b/etc/init.d/udev @@ -0,0 +1,68 @@ +#! /bin/bash +# +# random init script to setup /udev +# +# chkconfig: 2345 20 80 +# description: manage user-space device nodes in /udev + +. /etc/rc.d/init.d/functions + +udev_dir=/udev +sysfs_dir=/sys +bin=/sbin/udev + +case "$1" in + start) + if [ ! -d $udev_dir ]; then + mkdir $udev_dir + fi + if [ ! -d $sysfs_dir ]; then + exit 1 + fi + # propogate /udev from /sys - we only need this while we do not + # have initramfs and an early user-space with which to do early + # device bring up + action "Creating initial udev device nodes: " /bin/true + export ACTION=add + # add tty devices + for i in ${sysfs_dir}/class/tty/*; do + export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + $bin tty + done + # add block devices and their partitions + for i in ${sysfs_dir}/block/*; do + export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + $bin block + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH="/"`echo $j | \ + cut --delimiter='/' --fields=3-` + $bin block + fi + done + done + # TODO: add other device classes + ;; + stop) + # be careful + if [ $udev_dir -a "$udev_dir" != "/" ]; then + # clear out /udev + rm -rf ${udev_dir}/* + fi + ;; + status) + if [ -d $udev_dir ]; then + echo "the udev device node directory exists" + else + echo "the udev device node directory does not exist" + fi + ;; + restart|reload) + # nothing to do here + ;; + *) + echo "Usage: $0 {start|stop|status}" + exit 1 +esac + +exit 0 -- cgit v1.2.3-54-g00ecf From 8519ed1a5bfbbe084c941c4b443c7289adec313b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 29 Oct 2003 22:26:23 -0800 Subject: [PATCH] version number to 005_bk --- Makefile | 2 +- Makefile.klibc | 2 +- udev.spec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8d7122858b..586db488bc 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 005 +VERSION = 005_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/Makefile.klibc b/Makefile.klibc index 808217e121..df1e55b436 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 005 +VERSION = 005_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 4489065051..fcfb1cc75b 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 005 +Version: 005_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 4360a56d7f1d888fdef481018a168c0dade937b9 Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Wed, 29 Oct 2003 22:26:35 -0800 Subject: [PATCH] DESTDIR for udev --- Makefile | 17 +++++++++-------- udev.spec | 6 ++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 586db488bc..01536f6986 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ VERSION = 005_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) +DESTDIR = # override this to make udev look in a different location for it's config files prefix = exec_prefix = ${prefix} @@ -195,14 +196,14 @@ release: $(DISTFILES) clean install: all - $(INSTALL) -d $(udevdir) - $(INSTALL) -d $(configdir) - $(INSTALL) -d $(hotplugdir) - $(INSTALL_PROGRAM) -D $(ROOT) $(sbindir)/$(ROOT) - $(INSTALL_DATA) -D udev.8 $(mandir)/man8/udev.8 - $(INSTALL_DATA) udev.config $(configdir) - $(INSTALL_DATA) udev.permissions $(configdir) - - ln -s $(sbindir)/$(ROOT) $(hotplugdir)/udev.hotplug + $(INSTALL) -d $(DESTDIR)$(udevdir) + $(INSTALL) -d $(DESTDIR)$(configdir) + $(INSTALL) -d $(DESTDIR)$(hotplugdir) + $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) + $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 + $(INSTALL_DATA) udev.config $(DESTDIR)$(configdir) + $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir) + - ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug uninstall: - rm $(hotplugdir)/udev.hotplug diff --git a/udev.spec b/udev.spec index fcfb1cc75b..c6ebefc998 100644 --- a/udev.spec +++ b/udev.spec @@ -7,7 +7,7 @@ Group: Utilities/System Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.gz ExclusiveOS: Linux Vendor: Greg Kroah-Hartman -BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Prereq: /bin/sh, fileutils, hotplug %description @@ -21,9 +21,7 @@ udev is a implementation of devfs in userspace using sysfs and make CC="gcc $RPM_OPT_FLAGS" %install -make prefix=$RPM_BUILD_ROOT install -rm -f ${RPM_BUILD_ROOT}/etc/hotplug.d/default/udev.hotplug -ln -s /sbin/udev ${RPM_BUILD_ROOT}/etc/hotplug.d/default/udev.hotplug +make DESTDIR=$RPM_BUILD_ROOT install %clean rm -rf $RPM_BUILD_ROOT -- cgit v1.2.3-54-g00ecf From b80d82bced57930d6a79487a413418eb9d01344c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 30 Oct 2003 00:59:16 -0800 Subject: [PATCH] Remove a few items from the TODO list that are already done. --- TODO | 6 ------ 1 file changed, 6 deletions(-) diff --git a/TODO b/TODO index 3c1581705b..927f964a0b 100644 --- a/TODO +++ b/TODO @@ -8,12 +8,6 @@ greg@kroah.com - more documentation (can never have too much.) - document the config file format (it will change over time...) -- add proper man page -- add klibc to the build process (or make it easier to do) to get - smaller binary -- import latest libsysfs and convert udev to use it. -- On remove, look up the device in the database (now that we have one) and - delete what was created, not what the kernel is calling the device. - add symlink generation and removal support - better partition support (it's a hack right now, maybe new libsysfs changes can help out a lot here.) -- cgit v1.2.3-54-g00ecf From ebc180a2b79913557f7872dbfe12f922f1fdf0e1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 03:33:44 -0800 Subject: [PATCH] add prototype for ftruncate to klibc --- klibc/klibc/include/unistd.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/klibc/klibc/include/unistd.h b/klibc/klibc/include/unistd.h index a9b434c16b..3c51c497a7 100644 --- a/klibc/klibc/include/unistd.h +++ b/klibc/klibc/include/unistd.h @@ -103,6 +103,8 @@ __extern int optind, opterr, optopt; __extern int isatty(int); +__extern int ftruncate(int, off_t); + /* Standard file descriptor numbers. */ #define STDIN_FILENO 0 #define STDOUT_FILENO 1 -- cgit v1.2.3-54-g00ecf From c19a6b304cd7a727da9758853134b557f5f40705 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 12 Nov 2003 03:47:57 -0800 Subject: [PATCH] add uid/gid to nodes set uid/gid of node specified in udev.permissions only numeric id's are supported cause we can't resolve with klibc or libc before real /etc is mounted --- udev-add.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/udev-add.c b/udev-add.c index d237834c68..eb1c0fb676 100644 --- a/udev-add.c +++ b/udev-add.c @@ -67,7 +67,8 @@ exit: } /* - * We also want to add some permissions here, and possibly some symlinks + * we possibly want to add some symlinks here + * only numeric owner/group id's are supported */ static int create_node(struct udevice *dev) { @@ -106,7 +107,35 @@ static int create_node(struct udevice *dev) dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", filename, dev->mode, dev->major, dev->minor, strerror(errno)); - // FIXME set the ownership of the node + uid_t uid = 0; + gid_t gid = 0; + + if (*dev->owner) { + char *endptr; + unsigned long id = strtoul(dev->owner, &endptr, 10); + if (*endptr == 0x00) + uid = (uid_t) id; + else + dbg("only numeric owner id supported: %s", dev->owner); + } + + if (*dev->group) { + char *endptr; + unsigned long id = strtoul(dev->group, &endptr, 10); + if (*endptr == 0x00) + gid = (gid_t) id; + else + dbg("only numeric group id supported: %s", dev->group); + } + + if (uid || gid) { + dbg("chown(%s, %u, %u)", filename, uid, gid); + retval = chown(filename, uid, gid); + if (retval) + dbg("chown(%s, %u, %u) failed with error '%s'", filename, + uid, gid, strerror(errno)); + } + return retval; } -- cgit v1.2.3-54-g00ecf From 218eae87273e6b1d401ac67f94d648c9f39a30fa Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 12 Nov 2003 03:48:01 -0800 Subject: [PATCH] add support for subdirs support subdirectory creation/removal for NAME="/devfs/is/crazy/video0" create parent subdirs for device node if needed remove subdirs when last node is removed --- udev-add.c | 26 ++++++++++++++++++++++++++ udev-remove.c | 35 ++++++++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/udev-add.c b/udev-add.c index eb1c0fb676..9c54602405 100644 --- a/udev-add.c +++ b/udev-add.c @@ -101,6 +101,32 @@ static int create_node(struct udevice *dev) return -EINVAL; } + /* create subdirectories if requested */ + if (strchr(dev->name, '/')) { + char path[255]; + char *pos; + struct stat stats; + + strncpy(path, filename, sizeof(path)); + pos = strchr(path+1, '/'); + while (1) { + pos = strchr(pos+1, '/'); + if (pos == NULL) + break; + *pos = 0x00; + if (stat(path, &stats)) { + retval = mkdir(path, 0755); + if (retval) { + dbg("mkdir(%s) failed with error '%s'", + path, strerror(errno)); + return retval; + } + dbg("created %s", path); + } + *pos = '/'; + } + } + dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor); retval = mknod(filename, dev->mode, res); if (retval) diff --git a/udev-remove.c b/udev-remove.c index 666928f318..1cf5d5134d 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -69,12 +69,45 @@ exit: static int delete_node(char *name) { char filename[255]; + int retval; strncpy(filename, udev_root, sizeof(filename)); strncat(filename, name, sizeof(filename)); dbg("unlinking %s", filename); - return unlink(filename); + retval = unlink(filename); + if (retval) { + dbg("unlink(%s) failed with error '%s'", + filename, strerror(errno)); + return retval; + } + + /* remove subdirectories */ + if (strchr(name, '/')) { + char *pos; + + pos = strrchr(filename, '/'); + while (1) { + *pos = 0x00; + pos = strrchr(filename, '/'); + + /* don't remove the last one */ + if ((pos == filename) || (pos == NULL)) + break; + + /* remove if empty */ + retval = rmdir(filename); + if (retval) { + if (errno == ENOTEMPTY) + return 0; + dbg("rmdir(%s) failed with error '%s'", + filename, strerror(errno)); + break; + } + dbg("removed %s", filename); + } + } + return retval; } int udev_remove_device(char *device, char *subsystem) -- cgit v1.2.3-54-g00ecf From da86c7f02ffbe8c315598fb2c525dc4c3fb5dcae Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 12 Nov 2003 03:48:04 -0800 Subject: [PATCH] more manpage tweaks man page style fixes present the tiny udev in bold font :) --- udev.8 | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/udev.8 b/udev.8 index 42239c824d..79b74bf659 100644 --- a/udev.8 +++ b/udev.8 @@ -20,13 +20,15 @@ reads the sysfs directory of the given device to collect device attributes like label, serial number or bus device number. These attributes are treated as a key to determine a unique name for device file creation. -udev maintains a database for devices present on the system. +.B udev +maintains a database for devices present on the system. .br On device removal, .B udev queries the internal database for the name of the device file to be deleted. .SH "CONFIGURATION" -udev expects its configuration at +.B udev +expects its configuration at .I /etc/udev/udev.config. The file consists of a set of lines. All empty lines and lines beginning with a '#' will be ignored. @@ -85,8 +87,8 @@ TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" # ttyUSB1 should always be called pda REPLACE, KERNEL="ttyUSB1", NAME="pda" -# if /sbin/dev_id returns "V0815" device will be called dev0815 -CALLOUT, PROGRAM="/sbin/dev_id", BUS="pci", ID="V0815", NAME="dev0815" +# if /sbin/scsi_id returns "OEM 0815" device will be called disk1 +CALLOUT, PROGRAM="/sbin/scsi_id" BUS="scsi", ID="OEM 0815" NAME="disk1" .fi .P Permissions and ownership for the created device files may specified at @@ -120,5 +122,6 @@ The .I http://linux-hotplug.sourceforge.net/ web site. .SH AUTHORS -udev was developed by Greg Kroah-Hartman with much help from +.B udev +was developed by Greg Kroah-Hartman with much help from Dan Stekloff and many others. -- cgit v1.2.3-54-g00ecf From e308ebb70f9d1e389577c2a8829cf2d210cd6a19 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 03:50:33 -0800 Subject: [PATCH] fix udev-add.c to build properly with older versions of gcc. --- udev-add.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/udev-add.c b/udev-add.c index 9c54602405..d20e96ee72 100644 --- a/udev-add.c +++ b/udev-add.c @@ -74,6 +74,8 @@ static int create_node(struct udevice *dev) { char filename[255]; int retval = 0; + uid_t uid = 0; + gid_t gid = 0; dev_t res; strncpy(filename, udev_root, sizeof(filename)); @@ -133,9 +135,6 @@ static int create_node(struct udevice *dev) dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", filename, dev->mode, dev->major, dev->minor, strerror(errno)); - uid_t uid = 0; - gid_t gid = 0; - if (*dev->owner) { char *endptr; unsigned long id = strtoul(dev->owner, &endptr, 10); -- cgit v1.2.3-54-g00ecf From 8d8172514d8c29cd5b2c51a0825268b823eb8294 Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Wed, 12 Nov 2003 05:37:24 -0800 Subject: [PATCH] patch for libsysfs sysfs directory handling Here's a quick patch to: 1) Add an environment variable "SYSFS_PATH" that libsysfs will check for when getting mount point before searching system's sysfs mount point. 2) A quick fix to sysfs_get_link where the bug was. I have tested this out with libsysfs and with udev. I couldn't test with klibc because I haven't got the tree to build with klibc without my changes either. I made the link but get an error finding linux/linits.h. I will figure that out. Please have a look at the patch. If it's agreeable, please test it. I really want to add some generic path manipulation functions for the sysfs_get_link error, rather than my patch's hack. But, I haven't had time yet to do that. You really sounded like you needed this for testing, so I'm sending it out to you. I should probably add a function to set the env variable(?). --- libsysfs/libsysfs.h | 1 + libsysfs/sysfs_utils.c | 42 +++++++++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/libsysfs/libsysfs.h b/libsysfs/libsysfs.h index ccb9898cb5..b3ffc467d0 100644 --- a/libsysfs/libsysfs.h +++ b/libsysfs/libsysfs.h @@ -40,6 +40,7 @@ #define SYSFS_DRIVERS_NAME "drivers" #define SYSFS_NAME_ATTRIBUTE "name" #define SYSFS_UNKNOWN "unknown" +#define SYSFS_PATH_ENV "SYSFS_PATH" /* Some "block" subsystem specific #defines */ #define SYSFS_QUEUE_NAME "queue" diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index f1303cacb3..3e50bc6120 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -84,12 +84,18 @@ static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, */ int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len) { - int ret = -1; + char *sysfs_path = NULL; + int ret = 0; - if (mnt_path != NULL) - ret = sysfs_get_fs_mnt_path(SYSFS_FSTYPE_NAME, mnt_path, len); - else + if (mnt_path == NULL) { errno = EINVAL; + return -1; + } + sysfs_path = getenv(SYSFS_PATH_ENV); + if (sysfs_path != NULL) + strncpy(mnt_path, sysfs_path, len); + else + ret = sysfs_get_fs_mnt_path(SYSFS_FSTYPE_NAME, mnt_path, len); return ret; } @@ -130,7 +136,8 @@ int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) { unsigned char devdir[SYSFS_PATH_MAX]; unsigned char linkpath[SYSFS_PATH_MAX]; - unsigned char *d = NULL; + unsigned char *d = NULL, *s = NULL; + int slashes = 0, count = 0; if (path == NULL || target == NULL) { errno = EINVAL; @@ -139,12 +146,8 @@ int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) memset(devdir, 0, SYSFS_PATH_MAX); memset(linkpath, 0, SYSFS_PATH_MAX); + strncpy(devdir, path, SYSFS_PATH_MAX); - if ((sysfs_get_mnt_path(devdir, SYSFS_PATH_MAX)) != 0) { - dprintf("Sysfs not supported on this system\n"); - return -1; - } - if ((readlink(path, linkpath, SYSFS_PATH_MAX)) < 0) { return -1; } @@ -152,12 +155,25 @@ int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) d = linkpath; /* getting rid of leading "../.." */ - while (*d == '/' || *d == '.') + while (*d == '/' || *d == '.') { + if (*d == '/') + slashes++; d++; + } d--; - - strcat(devdir, d); + + s = &devdir[strlen(devdir)-1]; + while (s != NULL && count != (slashes+1)) { + s--; + if (*s == '/') + count++; + } + + if (s == NULL) + return -1; + + strncpy(s, d, (SYSFS_PATH_MAX-strlen(devdir))); strncpy(target, devdir, len); return 0; -- cgit v1.2.3-54-g00ecf From dc5cecf659aac8686bb7db1d047456fdef281ab1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 07:17:33 -0800 Subject: [PATCH] fix bug in klibc's isspace function. --- klibc/klibc/include/ctype.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/klibc/klibc/include/ctype.h b/klibc/klibc/include/ctype.h index 2cb90a45d3..e1a25f3693 100644 --- a/klibc/klibc/include/ctype.h +++ b/klibc/klibc/include/ctype.h @@ -88,7 +88,7 @@ __ctype_inline int ispunct(int __c) __ctype_inline int isspace(int __c) { - return __ctypes[__c+1] & __ctype_space; + return __ctypes[__c] & __ctype_space; } __ctype_inline int isupper(int __c) -- cgit v1.2.3-54-g00ecf From e40fec176bcdd0b4e763cf85817a7e5c8e1c6c14 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 07:23:39 -0800 Subject: [PATCH] change UDEV_SYSFS_PATH environment variable due to libsysfs change. --- test/label_test | 2 +- udev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/label_test b/test/label_test index f2208cbbdd..f06c416130 100644 --- a/test/label_test +++ b/test/label_test @@ -1,7 +1,7 @@ #!/bin/bash export UDEV_TEST=yes -export UDEV_SYSFS_PATH=$PWD/sys/ +export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_DIR=$PWD/ export UDEV_ROOT=$PWD/udev/ export UDEV_DB=udev.tdb diff --git a/udev.c b/udev.c index 8746b9a810..56dab1f832 100644 --- a/udev.c +++ b/udev.c @@ -86,7 +86,7 @@ static void get_dirs(void) temp = getenv("UDEV_TEST"); if (temp != NULL) { /* hm testing is happening, use the specified values, if they are present */ - temp = getenv("UDEV_SYSFS_PATH"); + temp = getenv("SYSFS_PATH"); if (temp) strncpy(sysfs_path, temp, sizeof(sysfs_path)); temp = getenv("UDEV_CONFIG_DIR"); -- cgit v1.2.3-54-g00ecf From 139d41e988bae66de1732be74adc09bc5791370d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 07:30:20 -0800 Subject: [PATCH] add more sysfs test tree files. --- test/sys/class/mem/full/dev | 1 + test/sys/class/mem/kmem/dev | 1 + test/sys/class/mem/kmsg/dev | 1 + test/sys/class/mem/mem/dev | 1 + test/sys/class/mem/null/dev | 1 + test/sys/class/mem/port/dev | 1 + test/sys/class/mem/random/dev | 1 + test/sys/class/mem/urandom/dev | 1 + test/sys/class/mem/zero/dev | 1 + test/sys/class/misc/psaux/dev | 1 + test/sys/class/misc/rtc/dev | 1 + test/sys/class/misc/uinput/dev | 1 + test/sys/class/tty/console/dev | 1 + test/sys/class/tty/ptmx/dev | 1 + test/sys/class/tty/tty/dev | 1 + test/sys/class/tty/tty0/dev | 1 + test/sys/class/tty/tty1/dev | 1 + test/sys/class/tty/tty10/dev | 1 + test/sys/class/tty/tty11/dev | 1 + test/sys/class/tty/tty12/dev | 1 + test/sys/class/tty/tty13/dev | 1 + test/sys/class/tty/tty14/dev | 1 + test/sys/class/tty/tty15/dev | 1 + test/sys/class/tty/tty16/dev | 1 + test/sys/class/tty/tty17/dev | 1 + test/sys/class/tty/tty18/dev | 1 + test/sys/class/tty/tty19/dev | 1 + test/sys/class/tty/tty2/dev | 1 + test/sys/class/tty/tty20/dev | 1 + test/sys/class/tty/tty21/dev | 1 + test/sys/class/tty/tty22/dev | 1 + test/sys/class/tty/tty23/dev | 1 + test/sys/class/tty/tty24/dev | 1 + test/sys/class/tty/tty25/dev | 1 + test/sys/class/tty/tty26/dev | 1 + test/sys/class/tty/tty27/dev | 1 + test/sys/class/tty/tty28/dev | 1 + test/sys/class/tty/tty29/dev | 1 + test/sys/class/tty/tty3/dev | 1 + test/sys/class/tty/tty30/dev | 1 + test/sys/class/tty/tty31/dev | 1 + test/sys/class/tty/tty32/dev | 1 + test/sys/class/tty/tty33/dev | 1 + test/sys/class/tty/tty34/dev | 1 + test/sys/class/tty/tty35/dev | 1 + test/sys/class/tty/tty36/dev | 1 + test/sys/class/tty/tty37/dev | 1 + test/sys/class/tty/tty38/dev | 1 + test/sys/class/tty/tty39/dev | 1 + test/sys/class/tty/tty4/dev | 1 + test/sys/class/tty/tty40/dev | 1 + test/sys/class/tty/tty41/dev | 1 + test/sys/class/tty/tty42/dev | 1 + test/sys/class/tty/tty43/dev | 1 + test/sys/class/tty/tty44/dev | 1 + test/sys/class/tty/tty45/dev | 1 + test/sys/class/tty/tty46/dev | 1 + test/sys/class/tty/tty47/dev | 1 + test/sys/class/tty/tty48/dev | 1 + test/sys/class/tty/tty49/dev | 1 + test/sys/class/tty/tty5/dev | 1 + test/sys/class/tty/tty50/dev | 1 + test/sys/class/tty/tty51/dev | 1 + test/sys/class/tty/tty52/dev | 1 + test/sys/class/tty/tty53/dev | 1 + test/sys/class/tty/tty54/dev | 1 + test/sys/class/tty/tty55/dev | 1 + test/sys/class/tty/tty56/dev | 1 + test/sys/class/tty/tty57/dev | 1 + test/sys/class/tty/tty58/dev | 1 + test/sys/class/tty/tty59/dev | 1 + test/sys/class/tty/tty6/dev | 1 + test/sys/class/tty/tty60/dev | 1 + test/sys/class/tty/tty61/dev | 1 + test/sys/class/tty/tty62/dev | 1 + test/sys/class/tty/tty63/dev | 1 + test/sys/class/tty/tty7/dev | 1 + test/sys/class/tty/tty8/dev | 1 + test/sys/class/tty/tty9/dev | 1 + test/sys/class/tty/ttyS0/dev | 1 + test/sys/class/tty/ttyS1/dev | 1 + test/sys/class/tty/ttyS2/dev | 1 + test/sys/class/tty/ttyS3/dev | 1 + test/sys/class/tty/ttyS4/dev | 1 + test/sys/class/tty/ttyS5/dev | 1 + test/sys/class/tty/ttyS6/dev | 1 + test/sys/class/tty/ttyS7/dev | 1 + test/sys/class/tty/ttyUSB0/dev | 1 + test/sys/devices/pci0000:00/0000:00:09.0/class | 1 + test/sys/devices/pci0000:00/0000:00:09.0/detach_state | 1 + test/sys/devices/pci0000:00/0000:00:09.0/device | 1 + test/sys/devices/pci0000:00/0000:00:09.0/irq | 1 + test/sys/devices/pci0000:00/0000:00:09.0/pools | 7 +++++++ test/sys/devices/pci0000:00/0000:00:09.0/power/state | 1 + test/sys/devices/pci0000:00/0000:00:09.0/resource | 7 +++++++ test/sys/devices/pci0000:00/0000:00:09.0/subsystem_device | 1 + test/sys/devices/pci0000:00/0000:00:09.0/subsystem_vendor | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bAlternateSetting | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceClass | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber | 1 + .../pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol | 1 + .../pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass | 1 + .../sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bNumEndpoints | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/iInterface | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/power/state | 1 + .../pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bAlternateSetting | 1 + .../pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass | 1 + .../pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber | 1 + .../pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceProtocol | 1 + .../pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceSubClass | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/iInterface | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/power/state | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-1/bConfigurationValue | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceProtocol | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceSubClass | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumConfigurations | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumInterfaces | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idProduct | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idVendor | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/power/state | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/speed | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state | 1 + .../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/power/state | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bConfigurationValue | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceClass | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceProtocol | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceSubClass | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bMaxPower | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumConfigurations | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumInterfaces | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bcdDevice | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bmAttributes | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/idProduct | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/idVendor | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/manufacturer | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/power/state | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/product | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/serial | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/speed | 1 + test/sys/devices/pci0000:00/0000:00:09.0/vendor | 1 + 149 files changed, 161 insertions(+) create mode 100644 test/sys/class/mem/full/dev create mode 100644 test/sys/class/mem/kmem/dev create mode 100644 test/sys/class/mem/kmsg/dev create mode 100644 test/sys/class/mem/mem/dev create mode 100644 test/sys/class/mem/null/dev create mode 100644 test/sys/class/mem/port/dev create mode 100644 test/sys/class/mem/random/dev create mode 100644 test/sys/class/mem/urandom/dev create mode 100644 test/sys/class/mem/zero/dev create mode 100644 test/sys/class/misc/psaux/dev create mode 100644 test/sys/class/misc/rtc/dev create mode 100644 test/sys/class/misc/uinput/dev create mode 100644 test/sys/class/tty/console/dev create mode 100644 test/sys/class/tty/ptmx/dev create mode 100644 test/sys/class/tty/tty/dev create mode 100644 test/sys/class/tty/tty0/dev create mode 100644 test/sys/class/tty/tty1/dev create mode 100644 test/sys/class/tty/tty10/dev create mode 100644 test/sys/class/tty/tty11/dev create mode 100644 test/sys/class/tty/tty12/dev create mode 100644 test/sys/class/tty/tty13/dev create mode 100644 test/sys/class/tty/tty14/dev create mode 100644 test/sys/class/tty/tty15/dev create mode 100644 test/sys/class/tty/tty16/dev create mode 100644 test/sys/class/tty/tty17/dev create mode 100644 test/sys/class/tty/tty18/dev create mode 100644 test/sys/class/tty/tty19/dev create mode 100644 test/sys/class/tty/tty2/dev create mode 100644 test/sys/class/tty/tty20/dev create mode 100644 test/sys/class/tty/tty21/dev create mode 100644 test/sys/class/tty/tty22/dev create mode 100644 test/sys/class/tty/tty23/dev create mode 100644 test/sys/class/tty/tty24/dev create mode 100644 test/sys/class/tty/tty25/dev create mode 100644 test/sys/class/tty/tty26/dev create mode 100644 test/sys/class/tty/tty27/dev create mode 100644 test/sys/class/tty/tty28/dev create mode 100644 test/sys/class/tty/tty29/dev create mode 100644 test/sys/class/tty/tty3/dev create mode 100644 test/sys/class/tty/tty30/dev create mode 100644 test/sys/class/tty/tty31/dev create mode 100644 test/sys/class/tty/tty32/dev create mode 100644 test/sys/class/tty/tty33/dev create mode 100644 test/sys/class/tty/tty34/dev create mode 100644 test/sys/class/tty/tty35/dev create mode 100644 test/sys/class/tty/tty36/dev create mode 100644 test/sys/class/tty/tty37/dev create mode 100644 test/sys/class/tty/tty38/dev create mode 100644 test/sys/class/tty/tty39/dev create mode 100644 test/sys/class/tty/tty4/dev create mode 100644 test/sys/class/tty/tty40/dev create mode 100644 test/sys/class/tty/tty41/dev create mode 100644 test/sys/class/tty/tty42/dev create mode 100644 test/sys/class/tty/tty43/dev create mode 100644 test/sys/class/tty/tty44/dev create mode 100644 test/sys/class/tty/tty45/dev create mode 100644 test/sys/class/tty/tty46/dev create mode 100644 test/sys/class/tty/tty47/dev create mode 100644 test/sys/class/tty/tty48/dev create mode 100644 test/sys/class/tty/tty49/dev create mode 100644 test/sys/class/tty/tty5/dev create mode 100644 test/sys/class/tty/tty50/dev create mode 100644 test/sys/class/tty/tty51/dev create mode 100644 test/sys/class/tty/tty52/dev create mode 100644 test/sys/class/tty/tty53/dev create mode 100644 test/sys/class/tty/tty54/dev create mode 100644 test/sys/class/tty/tty55/dev create mode 100644 test/sys/class/tty/tty56/dev create mode 100644 test/sys/class/tty/tty57/dev create mode 100644 test/sys/class/tty/tty58/dev create mode 100644 test/sys/class/tty/tty59/dev create mode 100644 test/sys/class/tty/tty6/dev create mode 100644 test/sys/class/tty/tty60/dev create mode 100644 test/sys/class/tty/tty61/dev create mode 100644 test/sys/class/tty/tty62/dev create mode 100644 test/sys/class/tty/tty63/dev create mode 100644 test/sys/class/tty/tty7/dev create mode 100644 test/sys/class/tty/tty8/dev create mode 100644 test/sys/class/tty/tty9/dev create mode 100644 test/sys/class/tty/ttyS0/dev create mode 100644 test/sys/class/tty/ttyS1/dev create mode 100644 test/sys/class/tty/ttyS2/dev create mode 100644 test/sys/class/tty/ttyS3/dev create mode 100644 test/sys/class/tty/ttyS4/dev create mode 100644 test/sys/class/tty/ttyS5/dev create mode 100644 test/sys/class/tty/ttyS6/dev create mode 100644 test/sys/class/tty/ttyS7/dev create mode 100644 test/sys/class/tty/ttyUSB0/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/detach_state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/pools create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/power/state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/iInterface create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/power/state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/iInterface create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/power/state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/power/state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/speed create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/power/state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/power/state create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/product create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/serial create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/speed create mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/vendor diff --git a/test/sys/class/mem/full/dev b/test/sys/class/mem/full/dev new file mode 100644 index 0000000000..4dc588f930 --- /dev/null +++ b/test/sys/class/mem/full/dev @@ -0,0 +1 @@ +1:7 diff --git a/test/sys/class/mem/kmem/dev b/test/sys/class/mem/kmem/dev new file mode 100644 index 0000000000..c7bc405e0f --- /dev/null +++ b/test/sys/class/mem/kmem/dev @@ -0,0 +1 @@ +1:2 diff --git a/test/sys/class/mem/kmsg/dev b/test/sys/class/mem/kmsg/dev new file mode 100644 index 0000000000..59effa12a9 --- /dev/null +++ b/test/sys/class/mem/kmsg/dev @@ -0,0 +1 @@ +1:11 diff --git a/test/sys/class/mem/mem/dev b/test/sys/class/mem/mem/dev new file mode 100644 index 0000000000..a72b75e75e --- /dev/null +++ b/test/sys/class/mem/mem/dev @@ -0,0 +1 @@ +1:1 diff --git a/test/sys/class/mem/null/dev b/test/sys/class/mem/null/dev new file mode 100644 index 0000000000..d9812edfef --- /dev/null +++ b/test/sys/class/mem/null/dev @@ -0,0 +1 @@ +1:3 diff --git a/test/sys/class/mem/port/dev b/test/sys/class/mem/port/dev new file mode 100644 index 0000000000..ab11afd2ec --- /dev/null +++ b/test/sys/class/mem/port/dev @@ -0,0 +1 @@ +1:4 diff --git a/test/sys/class/mem/random/dev b/test/sys/class/mem/random/dev new file mode 100644 index 0000000000..2b7b905849 --- /dev/null +++ b/test/sys/class/mem/random/dev @@ -0,0 +1 @@ +1:8 diff --git a/test/sys/class/mem/urandom/dev b/test/sys/class/mem/urandom/dev new file mode 100644 index 0000000000..0695af03c5 --- /dev/null +++ b/test/sys/class/mem/urandom/dev @@ -0,0 +1 @@ +1:9 diff --git a/test/sys/class/mem/zero/dev b/test/sys/class/mem/zero/dev new file mode 100644 index 0000000000..0acbea55a4 --- /dev/null +++ b/test/sys/class/mem/zero/dev @@ -0,0 +1 @@ +1:5 diff --git a/test/sys/class/misc/psaux/dev b/test/sys/class/misc/psaux/dev new file mode 100644 index 0000000000..48ace1eca2 --- /dev/null +++ b/test/sys/class/misc/psaux/dev @@ -0,0 +1 @@ +10:1 diff --git a/test/sys/class/misc/rtc/dev b/test/sys/class/misc/rtc/dev new file mode 100644 index 0000000000..64e028a296 --- /dev/null +++ b/test/sys/class/misc/rtc/dev @@ -0,0 +1 @@ +10:135 diff --git a/test/sys/class/misc/uinput/dev b/test/sys/class/misc/uinput/dev new file mode 100644 index 0000000000..a47be0d551 --- /dev/null +++ b/test/sys/class/misc/uinput/dev @@ -0,0 +1 @@ +10:223 diff --git a/test/sys/class/tty/console/dev b/test/sys/class/tty/console/dev new file mode 100644 index 0000000000..99eb99cd27 --- /dev/null +++ b/test/sys/class/tty/console/dev @@ -0,0 +1 @@ +5:1 diff --git a/test/sys/class/tty/ptmx/dev b/test/sys/class/tty/ptmx/dev new file mode 100644 index 0000000000..b1df63ebd3 --- /dev/null +++ b/test/sys/class/tty/ptmx/dev @@ -0,0 +1 @@ +5:2 diff --git a/test/sys/class/tty/tty/dev b/test/sys/class/tty/tty/dev new file mode 100644 index 0000000000..97f5a222f0 --- /dev/null +++ b/test/sys/class/tty/tty/dev @@ -0,0 +1 @@ +5:0 diff --git a/test/sys/class/tty/tty0/dev b/test/sys/class/tty/tty0/dev new file mode 100644 index 0000000000..192d8b739c --- /dev/null +++ b/test/sys/class/tty/tty0/dev @@ -0,0 +1 @@ +4:0 diff --git a/test/sys/class/tty/tty1/dev b/test/sys/class/tty/tty1/dev new file mode 100644 index 0000000000..71275a262f --- /dev/null +++ b/test/sys/class/tty/tty1/dev @@ -0,0 +1 @@ +4:1 diff --git a/test/sys/class/tty/tty10/dev b/test/sys/class/tty/tty10/dev new file mode 100644 index 0000000000..eb477d040f --- /dev/null +++ b/test/sys/class/tty/tty10/dev @@ -0,0 +1 @@ +4:10 diff --git a/test/sys/class/tty/tty11/dev b/test/sys/class/tty/tty11/dev new file mode 100644 index 0000000000..685b194273 --- /dev/null +++ b/test/sys/class/tty/tty11/dev @@ -0,0 +1 @@ +4:11 diff --git a/test/sys/class/tty/tty12/dev b/test/sys/class/tty/tty12/dev new file mode 100644 index 0000000000..47b68a96a5 --- /dev/null +++ b/test/sys/class/tty/tty12/dev @@ -0,0 +1 @@ +4:12 diff --git a/test/sys/class/tty/tty13/dev b/test/sys/class/tty/tty13/dev new file mode 100644 index 0000000000..86e31456d2 --- /dev/null +++ b/test/sys/class/tty/tty13/dev @@ -0,0 +1 @@ +4:13 diff --git a/test/sys/class/tty/tty14/dev b/test/sys/class/tty/tty14/dev new file mode 100644 index 0000000000..9fa8103ff8 --- /dev/null +++ b/test/sys/class/tty/tty14/dev @@ -0,0 +1 @@ +4:14 diff --git a/test/sys/class/tty/tty15/dev b/test/sys/class/tty/tty15/dev new file mode 100644 index 0000000000..3f601b851f --- /dev/null +++ b/test/sys/class/tty/tty15/dev @@ -0,0 +1 @@ +4:15 diff --git a/test/sys/class/tty/tty16/dev b/test/sys/class/tty/tty16/dev new file mode 100644 index 0000000000..0310e8064a --- /dev/null +++ b/test/sys/class/tty/tty16/dev @@ -0,0 +1 @@ +4:16 diff --git a/test/sys/class/tty/tty17/dev b/test/sys/class/tty/tty17/dev new file mode 100644 index 0000000000..19360464d0 --- /dev/null +++ b/test/sys/class/tty/tty17/dev @@ -0,0 +1 @@ +4:17 diff --git a/test/sys/class/tty/tty18/dev b/test/sys/class/tty/tty18/dev new file mode 100644 index 0000000000..8710c48f12 --- /dev/null +++ b/test/sys/class/tty/tty18/dev @@ -0,0 +1 @@ +4:18 diff --git a/test/sys/class/tty/tty19/dev b/test/sys/class/tty/tty19/dev new file mode 100644 index 0000000000..5fac93ed2f --- /dev/null +++ b/test/sys/class/tty/tty19/dev @@ -0,0 +1 @@ +4:19 diff --git a/test/sys/class/tty/tty2/dev b/test/sys/class/tty/tty2/dev new file mode 100644 index 0000000000..ac0836d7ca --- /dev/null +++ b/test/sys/class/tty/tty2/dev @@ -0,0 +1 @@ +4:2 diff --git a/test/sys/class/tty/tty20/dev b/test/sys/class/tty/tty20/dev new file mode 100644 index 0000000000..3db4a84c87 --- /dev/null +++ b/test/sys/class/tty/tty20/dev @@ -0,0 +1 @@ +4:20 diff --git a/test/sys/class/tty/tty21/dev b/test/sys/class/tty/tty21/dev new file mode 100644 index 0000000000..f86a02508c --- /dev/null +++ b/test/sys/class/tty/tty21/dev @@ -0,0 +1 @@ +4:21 diff --git a/test/sys/class/tty/tty22/dev b/test/sys/class/tty/tty22/dev new file mode 100644 index 0000000000..b27a240d1a --- /dev/null +++ b/test/sys/class/tty/tty22/dev @@ -0,0 +1 @@ +4:22 diff --git a/test/sys/class/tty/tty23/dev b/test/sys/class/tty/tty23/dev new file mode 100644 index 0000000000..9359bfa71d --- /dev/null +++ b/test/sys/class/tty/tty23/dev @@ -0,0 +1 @@ +4:23 diff --git a/test/sys/class/tty/tty24/dev b/test/sys/class/tty/tty24/dev new file mode 100644 index 0000000000..9cd85c8a81 --- /dev/null +++ b/test/sys/class/tty/tty24/dev @@ -0,0 +1 @@ +4:24 diff --git a/test/sys/class/tty/tty25/dev b/test/sys/class/tty/tty25/dev new file mode 100644 index 0000000000..f9d8c9c059 --- /dev/null +++ b/test/sys/class/tty/tty25/dev @@ -0,0 +1 @@ +4:25 diff --git a/test/sys/class/tty/tty26/dev b/test/sys/class/tty/tty26/dev new file mode 100644 index 0000000000..210b637b97 --- /dev/null +++ b/test/sys/class/tty/tty26/dev @@ -0,0 +1 @@ +4:26 diff --git a/test/sys/class/tty/tty27/dev b/test/sys/class/tty/tty27/dev new file mode 100644 index 0000000000..de59b627a5 --- /dev/null +++ b/test/sys/class/tty/tty27/dev @@ -0,0 +1 @@ +4:27 diff --git a/test/sys/class/tty/tty28/dev b/test/sys/class/tty/tty28/dev new file mode 100644 index 0000000000..023871c676 --- /dev/null +++ b/test/sys/class/tty/tty28/dev @@ -0,0 +1 @@ +4:28 diff --git a/test/sys/class/tty/tty29/dev b/test/sys/class/tty/tty29/dev new file mode 100644 index 0000000000..2edd7c58af --- /dev/null +++ b/test/sys/class/tty/tty29/dev @@ -0,0 +1 @@ +4:29 diff --git a/test/sys/class/tty/tty3/dev b/test/sys/class/tty/tty3/dev new file mode 100644 index 0000000000..c8142884a4 --- /dev/null +++ b/test/sys/class/tty/tty3/dev @@ -0,0 +1 @@ +4:3 diff --git a/test/sys/class/tty/tty30/dev b/test/sys/class/tty/tty30/dev new file mode 100644 index 0000000000..63f0e669b8 --- /dev/null +++ b/test/sys/class/tty/tty30/dev @@ -0,0 +1 @@ +4:30 diff --git a/test/sys/class/tty/tty31/dev b/test/sys/class/tty/tty31/dev new file mode 100644 index 0000000000..77a50eeff5 --- /dev/null +++ b/test/sys/class/tty/tty31/dev @@ -0,0 +1 @@ +4:31 diff --git a/test/sys/class/tty/tty32/dev b/test/sys/class/tty/tty32/dev new file mode 100644 index 0000000000..ae38a8dcd7 --- /dev/null +++ b/test/sys/class/tty/tty32/dev @@ -0,0 +1 @@ +4:32 diff --git a/test/sys/class/tty/tty33/dev b/test/sys/class/tty/tty33/dev new file mode 100644 index 0000000000..9307b44cd0 --- /dev/null +++ b/test/sys/class/tty/tty33/dev @@ -0,0 +1 @@ +4:33 diff --git a/test/sys/class/tty/tty34/dev b/test/sys/class/tty/tty34/dev new file mode 100644 index 0000000000..be00cbe67c --- /dev/null +++ b/test/sys/class/tty/tty34/dev @@ -0,0 +1 @@ +4:34 diff --git a/test/sys/class/tty/tty35/dev b/test/sys/class/tty/tty35/dev new file mode 100644 index 0000000000..4e5e85cb70 --- /dev/null +++ b/test/sys/class/tty/tty35/dev @@ -0,0 +1 @@ +4:35 diff --git a/test/sys/class/tty/tty36/dev b/test/sys/class/tty/tty36/dev new file mode 100644 index 0000000000..4e5407ef59 --- /dev/null +++ b/test/sys/class/tty/tty36/dev @@ -0,0 +1 @@ +4:36 diff --git a/test/sys/class/tty/tty37/dev b/test/sys/class/tty/tty37/dev new file mode 100644 index 0000000000..765acf2d2c --- /dev/null +++ b/test/sys/class/tty/tty37/dev @@ -0,0 +1 @@ +4:37 diff --git a/test/sys/class/tty/tty38/dev b/test/sys/class/tty/tty38/dev new file mode 100644 index 0000000000..1532b15793 --- /dev/null +++ b/test/sys/class/tty/tty38/dev @@ -0,0 +1 @@ +4:38 diff --git a/test/sys/class/tty/tty39/dev b/test/sys/class/tty/tty39/dev new file mode 100644 index 0000000000..fac383d3df --- /dev/null +++ b/test/sys/class/tty/tty39/dev @@ -0,0 +1 @@ +4:39 diff --git a/test/sys/class/tty/tty4/dev b/test/sys/class/tty/tty4/dev new file mode 100644 index 0000000000..7f407b5d25 --- /dev/null +++ b/test/sys/class/tty/tty4/dev @@ -0,0 +1 @@ +4:4 diff --git a/test/sys/class/tty/tty40/dev b/test/sys/class/tty/tty40/dev new file mode 100644 index 0000000000..d7246138ac --- /dev/null +++ b/test/sys/class/tty/tty40/dev @@ -0,0 +1 @@ +4:40 diff --git a/test/sys/class/tty/tty41/dev b/test/sys/class/tty/tty41/dev new file mode 100644 index 0000000000..0d974303d5 --- /dev/null +++ b/test/sys/class/tty/tty41/dev @@ -0,0 +1 @@ +4:41 diff --git a/test/sys/class/tty/tty42/dev b/test/sys/class/tty/tty42/dev new file mode 100644 index 0000000000..4019d23bfa --- /dev/null +++ b/test/sys/class/tty/tty42/dev @@ -0,0 +1 @@ +4:42 diff --git a/test/sys/class/tty/tty43/dev b/test/sys/class/tty/tty43/dev new file mode 100644 index 0000000000..4b6c086540 --- /dev/null +++ b/test/sys/class/tty/tty43/dev @@ -0,0 +1 @@ +4:43 diff --git a/test/sys/class/tty/tty44/dev b/test/sys/class/tty/tty44/dev new file mode 100644 index 0000000000..9c2357463f --- /dev/null +++ b/test/sys/class/tty/tty44/dev @@ -0,0 +1 @@ +4:44 diff --git a/test/sys/class/tty/tty45/dev b/test/sys/class/tty/tty45/dev new file mode 100644 index 0000000000..23437be177 --- /dev/null +++ b/test/sys/class/tty/tty45/dev @@ -0,0 +1 @@ +4:45 diff --git a/test/sys/class/tty/tty46/dev b/test/sys/class/tty/tty46/dev new file mode 100644 index 0000000000..816feaf47d --- /dev/null +++ b/test/sys/class/tty/tty46/dev @@ -0,0 +1 @@ +4:46 diff --git a/test/sys/class/tty/tty47/dev b/test/sys/class/tty/tty47/dev new file mode 100644 index 0000000000..d2534e707d --- /dev/null +++ b/test/sys/class/tty/tty47/dev @@ -0,0 +1 @@ +4:47 diff --git a/test/sys/class/tty/tty48/dev b/test/sys/class/tty/tty48/dev new file mode 100644 index 0000000000..4003c709df --- /dev/null +++ b/test/sys/class/tty/tty48/dev @@ -0,0 +1 @@ +4:48 diff --git a/test/sys/class/tty/tty49/dev b/test/sys/class/tty/tty49/dev new file mode 100644 index 0000000000..64dc806057 --- /dev/null +++ b/test/sys/class/tty/tty49/dev @@ -0,0 +1 @@ +4:49 diff --git a/test/sys/class/tty/tty5/dev b/test/sys/class/tty/tty5/dev new file mode 100644 index 0000000000..1553222302 --- /dev/null +++ b/test/sys/class/tty/tty5/dev @@ -0,0 +1 @@ +4:5 diff --git a/test/sys/class/tty/tty50/dev b/test/sys/class/tty/tty50/dev new file mode 100644 index 0000000000..71e681bc39 --- /dev/null +++ b/test/sys/class/tty/tty50/dev @@ -0,0 +1 @@ +4:50 diff --git a/test/sys/class/tty/tty51/dev b/test/sys/class/tty/tty51/dev new file mode 100644 index 0000000000..1f8c4b6976 --- /dev/null +++ b/test/sys/class/tty/tty51/dev @@ -0,0 +1 @@ +4:51 diff --git a/test/sys/class/tty/tty52/dev b/test/sys/class/tty/tty52/dev new file mode 100644 index 0000000000..344e8c93f9 --- /dev/null +++ b/test/sys/class/tty/tty52/dev @@ -0,0 +1 @@ +4:52 diff --git a/test/sys/class/tty/tty53/dev b/test/sys/class/tty/tty53/dev new file mode 100644 index 0000000000..c4b80fb134 --- /dev/null +++ b/test/sys/class/tty/tty53/dev @@ -0,0 +1 @@ +4:53 diff --git a/test/sys/class/tty/tty54/dev b/test/sys/class/tty/tty54/dev new file mode 100644 index 0000000000..ba56c5e44c --- /dev/null +++ b/test/sys/class/tty/tty54/dev @@ -0,0 +1 @@ +4:54 diff --git a/test/sys/class/tty/tty55/dev b/test/sys/class/tty/tty55/dev new file mode 100644 index 0000000000..540bf11253 --- /dev/null +++ b/test/sys/class/tty/tty55/dev @@ -0,0 +1 @@ +4:55 diff --git a/test/sys/class/tty/tty56/dev b/test/sys/class/tty/tty56/dev new file mode 100644 index 0000000000..ee03fba97d --- /dev/null +++ b/test/sys/class/tty/tty56/dev @@ -0,0 +1 @@ +4:56 diff --git a/test/sys/class/tty/tty57/dev b/test/sys/class/tty/tty57/dev new file mode 100644 index 0000000000..664d8ec646 --- /dev/null +++ b/test/sys/class/tty/tty57/dev @@ -0,0 +1 @@ +4:57 diff --git a/test/sys/class/tty/tty58/dev b/test/sys/class/tty/tty58/dev new file mode 100644 index 0000000000..ffc6c0b62c --- /dev/null +++ b/test/sys/class/tty/tty58/dev @@ -0,0 +1 @@ +4:58 diff --git a/test/sys/class/tty/tty59/dev b/test/sys/class/tty/tty59/dev new file mode 100644 index 0000000000..c48309e7f0 --- /dev/null +++ b/test/sys/class/tty/tty59/dev @@ -0,0 +1 @@ +4:59 diff --git a/test/sys/class/tty/tty6/dev b/test/sys/class/tty/tty6/dev new file mode 100644 index 0000000000..cd94e0d09d --- /dev/null +++ b/test/sys/class/tty/tty6/dev @@ -0,0 +1 @@ +4:6 diff --git a/test/sys/class/tty/tty60/dev b/test/sys/class/tty/tty60/dev new file mode 100644 index 0000000000..37d25eab02 --- /dev/null +++ b/test/sys/class/tty/tty60/dev @@ -0,0 +1 @@ +4:60 diff --git a/test/sys/class/tty/tty61/dev b/test/sys/class/tty/tty61/dev new file mode 100644 index 0000000000..599df60bfd --- /dev/null +++ b/test/sys/class/tty/tty61/dev @@ -0,0 +1 @@ +4:61 diff --git a/test/sys/class/tty/tty62/dev b/test/sys/class/tty/tty62/dev new file mode 100644 index 0000000000..49fc9a0af5 --- /dev/null +++ b/test/sys/class/tty/tty62/dev @@ -0,0 +1 @@ +4:62 diff --git a/test/sys/class/tty/tty63/dev b/test/sys/class/tty/tty63/dev new file mode 100644 index 0000000000..d11e9d2a82 --- /dev/null +++ b/test/sys/class/tty/tty63/dev @@ -0,0 +1 @@ +4:63 diff --git a/test/sys/class/tty/tty7/dev b/test/sys/class/tty/tty7/dev new file mode 100644 index 0000000000..9410476660 --- /dev/null +++ b/test/sys/class/tty/tty7/dev @@ -0,0 +1 @@ +4:7 diff --git a/test/sys/class/tty/tty8/dev b/test/sys/class/tty/tty8/dev new file mode 100644 index 0000000000..a79f74ba39 --- /dev/null +++ b/test/sys/class/tty/tty8/dev @@ -0,0 +1 @@ +4:8 diff --git a/test/sys/class/tty/tty9/dev b/test/sys/class/tty/tty9/dev new file mode 100644 index 0000000000..62ada4bbe9 --- /dev/null +++ b/test/sys/class/tty/tty9/dev @@ -0,0 +1 @@ +4:9 diff --git a/test/sys/class/tty/ttyS0/dev b/test/sys/class/tty/ttyS0/dev new file mode 100644 index 0000000000..9f6b667886 --- /dev/null +++ b/test/sys/class/tty/ttyS0/dev @@ -0,0 +1 @@ +4:64 diff --git a/test/sys/class/tty/ttyS1/dev b/test/sys/class/tty/ttyS1/dev new file mode 100644 index 0000000000..db3f8ecdcd --- /dev/null +++ b/test/sys/class/tty/ttyS1/dev @@ -0,0 +1 @@ +4:65 diff --git a/test/sys/class/tty/ttyS2/dev b/test/sys/class/tty/ttyS2/dev new file mode 100644 index 0000000000..cef5d02fd9 --- /dev/null +++ b/test/sys/class/tty/ttyS2/dev @@ -0,0 +1 @@ +4:66 diff --git a/test/sys/class/tty/ttyS3/dev b/test/sys/class/tty/ttyS3/dev new file mode 100644 index 0000000000..3077006e7a --- /dev/null +++ b/test/sys/class/tty/ttyS3/dev @@ -0,0 +1 @@ +4:67 diff --git a/test/sys/class/tty/ttyS4/dev b/test/sys/class/tty/ttyS4/dev new file mode 100644 index 0000000000..26cd2d8c86 --- /dev/null +++ b/test/sys/class/tty/ttyS4/dev @@ -0,0 +1 @@ +4:68 diff --git a/test/sys/class/tty/ttyS5/dev b/test/sys/class/tty/ttyS5/dev new file mode 100644 index 0000000000..189b73bb6e --- /dev/null +++ b/test/sys/class/tty/ttyS5/dev @@ -0,0 +1 @@ +4:69 diff --git a/test/sys/class/tty/ttyS6/dev b/test/sys/class/tty/ttyS6/dev new file mode 100644 index 0000000000..f40a113a2a --- /dev/null +++ b/test/sys/class/tty/ttyS6/dev @@ -0,0 +1 @@ +4:70 diff --git a/test/sys/class/tty/ttyS7/dev b/test/sys/class/tty/ttyS7/dev new file mode 100644 index 0000000000..ec1b8ff559 --- /dev/null +++ b/test/sys/class/tty/ttyS7/dev @@ -0,0 +1 @@ +4:71 diff --git a/test/sys/class/tty/ttyUSB0/dev b/test/sys/class/tty/ttyUSB0/dev new file mode 100644 index 0000000000..5c0bba8170 --- /dev/null +++ b/test/sys/class/tty/ttyUSB0/dev @@ -0,0 +1 @@ +188:0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/class b/test/sys/devices/pci0000:00/0000:00:09.0/class new file mode 100644 index 0000000000..a9a8817576 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/class @@ -0,0 +1 @@ +0x0c0310 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/detach_state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/detach_state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/device b/test/sys/devices/pci0000:00/0000:00:09.0/device new file mode 100644 index 0000000000..90e151e254 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/device @@ -0,0 +1 @@ +0x0035 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/irq b/test/sys/devices/pci0000:00/0000:00:09.0/irq new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/irq @@ -0,0 +1 @@ +9 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/pools b/test/sys/devices/pci0000:00/0000:00:09.0/pools new file mode 100644 index 0000000000..7da8ce818d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/pools @@ -0,0 +1,7 @@ +poolinfo - 0.1 +ohci_ed 1 64 64 1 +ohci_td 1 64 64 1 +buffer-2048 0 0 2048 0 +buffer-512 0 0 512 0 +buffer-128 0 0 128 0 +buffer-32 1 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/power/state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/power/state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/resource b/test/sys/devices/pci0000:00/0000:00:09.0/resource new file mode 100644 index 0000000000..e7c459f811 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/resource @@ -0,0 +1,7 @@ +0x0000000017100000 0x0000000017100fff 0x0000000000000200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_device new file mode 100644 index 0000000000..db5e9bccd0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_device @@ -0,0 +1 @@ +0x11a3 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_vendor new file mode 100644 index 0000000000..3dc3deeb2b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_vendor @@ -0,0 +1 @@ +0x10cf diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bNumEndpoints new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bNumEndpoints @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/iInterface b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/iInterface new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/iInterface @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/power/state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/power/state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/iInterface b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/iInterface new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/iInterface @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/power/state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/power/state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower new file mode 100644 index 0000000000..d579c4bb6d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower @@ -0,0 +1 @@ + 50mA diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice new file mode 100644 index 0000000000..635047563b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice @@ -0,0 +1 @@ +0001 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes new file mode 100644 index 0000000000..0042f6c56d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes @@ -0,0 +1 @@ +a0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idProduct b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idProduct new file mode 100644 index 0000000000..9142bb40c2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idProduct @@ -0,0 +1 @@ +2008 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idVendor b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idVendor new file mode 100644 index 0000000000..6ffae177b7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idVendor @@ -0,0 +1 @@ +0557 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/power/state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/power/state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/speed b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/speed new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/speed @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/power/state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/power/state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bMaxPower b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bMaxPower new file mode 100644 index 0000000000..ca2ea0dab5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bMaxPower @@ -0,0 +1 @@ + 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bcdDevice b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bcdDevice new file mode 100644 index 0000000000..ff5c1613f9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bcdDevice @@ -0,0 +1 @@ +0206 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bmAttributes b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bmAttributes new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bmAttributes @@ -0,0 +1 @@ +40 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idProduct b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idProduct new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idProduct @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idVendor b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idVendor new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idVendor @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/manufacturer b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/manufacturer new file mode 100644 index 0000000000..7ea94cede0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/manufacturer @@ -0,0 +1 @@ +Linux 2.6.0-test9-bk16 ohci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/power/state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/power/state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/product b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/product new file mode 100644 index 0000000000..a1c773affb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/product @@ -0,0 +1 @@ +OHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/serial b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/serial new file mode 100644 index 0000000000..1b7fda31c4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/serial @@ -0,0 +1 @@ +0000:00:09.0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/speed b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/speed new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/speed @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/vendor b/test/sys/devices/pci0000:00/0000:00:09.0/vendor new file mode 100644 index 0000000000..fcfa779f23 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/vendor @@ -0,0 +1 @@ +0x1033 -- cgit v1.2.3-54-g00ecf From 75ff8da8ab2e7362ec489fe5280fe5c84fe42741 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 07:32:29 -0800 Subject: [PATCH] add replace test --- test/replace_test | 14 ++++++++++++++ test/replace_test.config | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 test/replace_test create mode 100644 test/replace_test.config diff --git a/test/replace_test b/test/replace_test new file mode 100644 index 0000000000..3aa8d5a8c9 --- /dev/null +++ b/test/replace_test @@ -0,0 +1,14 @@ +#!/bin/bash + +export UDEV_TEST=yes +export SYSFS_PATH=$PWD/sys/ +export UDEV_CONFIG_DIR=$PWD/ +export UDEV_ROOT=$PWD/udev/ +export UDEV_DB=udev.tdb +export UDEV_CONFIG_FILE=replace_test.config +export UDEV_PERMISSION_FILE=udev.permissions + +export DEVPATH=class/tty/ttyUSB0 +export ACTION=add + +../udev tty diff --git a/test/replace_test.config b/test/replace_test.config new file mode 100644 index 0000000000..8fbfd18100 --- /dev/null +++ b/test/replace_test.config @@ -0,0 +1,3 @@ +# REPLACE test +REPLACE, KERNEL="ttyUSB0", NAME="visor" + -- cgit v1.2.3-54-g00ecf From 07b80e6d55ebeca61c7c4dba880517bb1a32ff81 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 07:44:56 -0800 Subject: [PATCH] add debug line for REPLACE call. --- namedev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/namedev.c b/namedev.c index 99542dc4d6..c277cec28f 100644 --- a/namedev.c +++ b/namedev.c @@ -733,6 +733,8 @@ label_found: break; } case REPLACE: + dbg_parse("REPLACE: replace name '%s' with '%s'", + dev->kernel_name, dev->name); if (strcmp(dev->kernel_name, class_dev->name) != 0) continue; strcpy(udev->name, dev->name); -- cgit v1.2.3-54-g00ecf From 120d45d0a1565a1e4432616df3117ff474c0b249 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 08:26:08 -0800 Subject: [PATCH] split REPLACE and CALLOUT into separate functions Finally starting to process this in priority order, not config file order. --- namedev.c | 112 ++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 72 insertions(+), 40 deletions(-) diff --git a/namedev.c b/namedev.c index c277cec28f..70236caca2 100644 --- a/namedev.c +++ b/namedev.c @@ -22,7 +22,7 @@ */ /* define this to enable parsing debugging */ -/* #define DEBUG_PARSER */ +#define DEBUG_PARSER #include #include @@ -537,6 +537,65 @@ static int exec_callout(struct config_device *dev, char *value, int len) return retval; } +static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev) +{ + struct config_device *dev; + struct list_head *tmp; + char value[ID_SIZE]; + + list_for_each(tmp, &config_device_list) { + dev = list_entry(tmp, struct config_device, node); + if (dev->type != CALLOUT) + continue; + + if (exec_callout(dev, value, sizeof(value))) + continue; + if (strncmp(value, dev->id, sizeof(value)) != 0) + continue; + strcpy(udev->name, dev->name); + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); + } + dbg_parse("device callout '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->id, udev->name, + dev->owner, dev->group, dev->mode); + return 0; + } + return -ENODEV; +} + +static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev) +{ + struct config_device *dev; + struct list_head *tmp; + + list_for_each(tmp, &config_device_list) { + dev = list_entry(tmp, struct config_device, node); + if (dev->type != REPLACE) + continue; + + dbg_parse("REPLACE: replace name '%s' with '%s'", + dev->kernel_name, dev->name); + if (strcmp(dev->kernel_name, class_dev->name) != 0) + continue; + + strcpy(udev->name, dev->name); + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); + } + dbg_parse("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->kernel_name, udev->name, + dev->owner, dev->group, dev->mode); + + return 0; + } + return -ENODEV; +} + static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) { struct list_head *tmp; @@ -712,49 +771,22 @@ label_found: goto done; break; } - case CALLOUT: - { - char value[ID_SIZE]; - - if (exec_callout(dev, value, sizeof(value))) - continue; - if (strncmp(value, dev->id, sizeof(value)) != 0) - continue; - strcpy(udev->name, dev->name); - if (dev->mode != 0) { - udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); - } - dbg_parse("device callout '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->id, udev->name, - dev->owner, dev->group, dev->mode); - goto done; - break; - } - case REPLACE: - dbg_parse("REPLACE: replace name '%s' with '%s'", - dev->kernel_name, dev->name); - if (strcmp(dev->kernel_name, class_dev->name) != 0) - continue; - strcpy(udev->name, dev->name); - if (dev->mode != 0) { - udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); - } - dbg_parse("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->kernel_name, udev->name, - dev->owner, dev->group, dev->mode); - goto done; - break; case KERNEL_NAME: - break; default: - dbg_parse("Unknown type of device '%d'", dev->type); break; } } + + /* rules are looked at in priority order */ + + retval = do_callout(class_dev, udev); + if (retval == 0) + goto done; + + retval = do_replace(class_dev, udev); + if (retval == 0) + goto done; + strcpy(udev->name, class_dev->name); done: @@ -764,7 +796,7 @@ done: udev->owner[0] = 0x00; udev->group[0] = 0x00; } - return retval; + return 0; } int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev) -- cgit v1.2.3-54-g00ecf From 4c7f03c33f0bb38aac8d699c440b12e715ac7bc2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 08:35:40 -0800 Subject: [PATCH] updated label test script (tests for partitions now.) --- test/label_test | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/label_test b/test/label_test index f06c416130..faa516fdce 100644 --- a/test/label_test +++ b/test/label_test @@ -8,7 +8,13 @@ export UDEV_DB=udev.tdb export UDEV_CONFIG_FILE=label_test.config export UDEV_PERMISSION_FILE=udev.permissions -export DEVPATH=block/sda export ACTION=add +export DEVPATH=block/sda ../udev block + +export DEVPATH=block/sda/sda3 + +../udev block + + -- cgit v1.2.3-54-g00ecf From 7bd22a78a1a75857330031db44c68d07b049e809 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 17:38:14 -0800 Subject: [PATCH] clean up the way we find the sysdevice for a block device for namedev. --- namedev.c | 93 +++++++++++++++++++++++++++++---------------------------------- 1 file changed, 43 insertions(+), 50 deletions(-) diff --git a/namedev.c b/namedev.c index 70236caca2..2176e8ba71 100644 --- a/namedev.c +++ b/namedev.c @@ -599,13 +599,47 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) { struct list_head *tmp; + struct sysfs_device *sysfs_device = NULL; + struct sysfs_class_device *class_dev_parent = NULL; int retval = 0; int found; + char *temp = NULL; udev->mode = 0; + + /* find the sysfs_device for this class device */ if (class_dev->sysdevice) { - dbg_parse("class_dev->sysdevice->path = '%s'", class_dev->sysdevice->path); - dbg_parse("class_dev->sysdevice->bus_id = '%s'", class_dev->sysdevice->bus_id); + sysfs_device = class_dev->sysdevice; + } else { + /* bah, let's go backwards up a level to see if the device is there, + * as block partitions don't point to the physical device. Need to fix that + * up in the kernel... + */ + if (strstr(class_dev->path, "block")) { + dbg_parse("looking at block device..."); + if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { + char path[SYSFS_PATH_MAX]; + + dbg_parse("really is a partition..."); + strcpy(path, class_dev->path); + temp = strrchr(path, '/'); + *temp = 0x00; + dbg_parse("looking for a class device at '%s'", path); + class_dev_parent = sysfs_open_class_device(path); + if (class_dev_parent == NULL) { + dbg("sysfs_open_class_device at '%s' failed", path); + } else { + dbg_parse("class_dev_parent->name = %s", class_dev_parent->name); + if (class_dev_parent->sysdevice) + sysfs_device = class_dev_parent->sysdevice; + } + } + } + } + + if (sysfs_device) { + dbg_parse("sysfs_device->path = '%s'", sysfs_device->path); + dbg_parse("sysfs_device->bus_id = '%s'", sysfs_device->bus_id); } else { dbg_parse("class_dev->name = '%s'", class_dev->name); } @@ -615,8 +649,6 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) case LABEL: { struct sysfs_attribute *tmpattr = NULL; - struct sysfs_class_device *class_dev_parent = NULL; - char *temp = NULL; dbg_parse("LABEL: match file '%s' with value '%s'", dev->sysfs_file, dev->sysfs_value); @@ -626,60 +658,19 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) goto label_found; /* look in the class device directory if present */ - if (class_dev->sysdevice) { - tmpattr = sysfs_get_device_attr(class_dev->sysdevice, dev->sysfs_file); + if (sysfs_device) { + tmpattr = sysfs_get_device_attr(sysfs_device, dev->sysfs_file); if (tmpattr) goto label_found; } - /* bah, let's go backwards up a level to see if the device is there, - * as block partitions don't point to the physical device. Need to fix that - * up in the kernel... - */ - if (strstr(class_dev->path, "block")) { - dbg_parse("looking at block device..."); - if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { - char path[SYSFS_PATH_MAX]; - - dbg_parse("really is a partition..."); - strcpy(path, class_dev->path); - temp = strrchr(path, '/'); - *temp = 0x00; - dbg_parse("looking for a class device at '%s'", path); - class_dev_parent = sysfs_open_class_device(path); - if (class_dev_parent == NULL) { - dbg("sysfs_open_class_device at '%s' failed", path); - continue; - } - dbg_parse("class_dev_parent->name = %s", class_dev_parent->name); - - /* try to find the attribute in the class device directory */ - tmpattr = sysfs_get_classdev_attr(class_dev_parent, dev->sysfs_file); - if (tmpattr) - goto label_found; - - /* look in the class device directory if present */ - if (class_dev_parent->sysdevice) { - tmpattr = sysfs_get_device_attr(class_dev_parent->sysdevice, dev->sysfs_file); - if (tmpattr) - goto label_found; - } - - } - } - if (class_dev_parent) - sysfs_close_class_device(class_dev_parent); - continue; label_found: tmpattr->value[strlen(tmpattr->value)-1] = 0x00; dbg_parse("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value); - if (strcmp(dev->sysfs_value, tmpattr->value) != 0) { - if (class_dev_parent) - sysfs_close_class_device(class_dev_parent); + if (strcmp(dev->sysfs_value, tmpattr->value) != 0) continue; - } strcpy(udev->name, dev->name); if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { @@ -694,8 +685,6 @@ label_found: dbg_parse("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->sysfs_file, dev->sysfs_value, udev->name, dev->owner, dev->group, dev->mode); - if (class_dev_parent) - sysfs_close_class_device(class_dev_parent); goto done; break; } @@ -796,6 +785,10 @@ done: udev->owner[0] = 0x00; udev->group[0] = 0x00; } + + if (class_dev_parent) + sysfs_close_class_device(class_dev_parent); + return 0; } -- cgit v1.2.3-54-g00ecf From 8a0c11d360a5c07f200cb421c5a4291dd00d5a09 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 17:56:26 -0800 Subject: [PATCH] fix bug where NUMBER and TOPOLOGY would not work for partitions. --- namedev.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/namedev.c b/namedev.c index 2176e8ba71..140d50079f 100644 --- a/namedev.c +++ b/namedev.c @@ -608,6 +608,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) udev->mode = 0; /* find the sysfs_device for this class device */ + /* Wouldn't it really be nice if libsysfs could do this for us? */ if (class_dev->sysdevice) { sysfs_device = class_dev->sysdevice; } else { @@ -691,12 +692,11 @@ label_found: case NUMBER: { char path[SYSFS_PATH_MAX]; - char *temp; found = 0; - if (!class_dev->sysdevice) + if (!sysfs_device) continue; - strcpy(path, class_dev->sysdevice->path); + strcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg_parse("NUMBER path = '%s'", path); dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); @@ -727,12 +727,11 @@ label_found: case TOPOLOGY: { char path[SYSFS_PATH_MAX]; - char *temp; - if (!class_dev->sysdevice) + if (!sysfs_device) continue; found = 0; - strcpy(path, class_dev->sysdevice->path); + strcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg_parse("TOPOLOGY path = '%s'", path); dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); -- cgit v1.2.3-54-g00ecf From 8c51bbfe5f159d79b365a50a20218f616d6b67b5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 18:08:19 -0800 Subject: [PATCH] move TOPOLOGY rule to it's own function. --- namedev.c | 91 ++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 55 insertions(+), 36 deletions(-) diff --git a/namedev.c b/namedev.c index 140d50079f..7c2db150be 100644 --- a/namedev.c +++ b/namedev.c @@ -566,6 +566,55 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev return -ENODEV; } +static int do_topology(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +{ + struct config_device *dev; + struct list_head *tmp; + char path[SYSFS_PATH_MAX]; + int found; + char *temp = NULL; + + /* we have to have a sysfs device for TOPOLOGY to work */ + if (!sysfs_device) + return -ENODEV; + + list_for_each(tmp, &config_device_list) { + dev = list_entry(tmp, struct config_device, node); + if (dev->type != TOPOLOGY) + continue; + + found = 0; + strcpy(path, sysfs_device->path); + temp = strrchr(path, '/'); + dbg_parse("TOPOLOGY path = '%s'", path); + dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); + if (strstr(temp, dev->place) != NULL) { + found = 1; + } else { + *temp = 0x00; + temp = strrchr(path, '/'); + dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); + if (strstr(temp, dev->place) != NULL) + found = 1; + } + if (!found) + continue; + + strcpy(udev->name, dev->name); + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); + } + dbg_parse("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->place, udev->name, + dev->owner, dev->group, dev->mode); + + return 0; + } + return -ENODEV; +} + static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev) { struct config_device *dev; @@ -696,7 +745,8 @@ label_found: found = 0; if (!sysfs_device) continue; - strcpy(path, sysfs_device->path); + s + rcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg_parse("NUMBER path = '%s'", path); dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); @@ -724,41 +774,6 @@ label_found: goto done; break; } - case TOPOLOGY: - { - char path[SYSFS_PATH_MAX]; - - if (!sysfs_device) - continue; - found = 0; - strcpy(path, sysfs_device->path); - temp = strrchr(path, '/'); - dbg_parse("TOPOLOGY path = '%s'", path); - dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); - if (strstr(temp, dev->place) != NULL) { - found = 1; - } else { - *temp = 0x00; - temp = strrchr(path, '/'); - dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); - if (strstr(temp, dev->place) != NULL) - found = 1; - } - if (!found) - continue; - - strcpy(udev->name, dev->name); - if (dev->mode != 0) { - udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); - } - dbg_parse("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->place, udev->name, - dev->owner, dev->group, dev->mode); - goto done; - break; - } case KERNEL_NAME: default: break; @@ -771,6 +786,10 @@ label_found: if (retval == 0) goto done; + retval = do_topology(class_dev, udev, sysfs_device); + if (retval == 0) + goto done; + retval = do_replace(class_dev, udev); if (retval == 0) goto done; -- cgit v1.2.3-54-g00ecf From a38c862f88b4794ba6bb2b6ef256100dd26b86bb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Nov 2003 18:08:40 -0800 Subject: [PATCH] add TOPO regression test. --- test/topo_test | 20 ++++++++++++++++++++ test/topo_test.config | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 test/topo_test create mode 100644 test/topo_test.config diff --git a/test/topo_test b/test/topo_test new file mode 100644 index 0000000000..5a557e909d --- /dev/null +++ b/test/topo_test @@ -0,0 +1,20 @@ +#!/bin/bash + +export UDEV_TEST=yes +export SYSFS_PATH=$PWD/sys/ +export UDEV_CONFIG_DIR=$PWD/ +export UDEV_ROOT=$PWD/udev/ +export UDEV_DB=udev.tdb +export UDEV_CONFIG_FILE=topo_test.config +export UDEV_PERMISSION_FILE=udev.permissions + +export ACTION=add +export DEVPATH=block/sda + +../udev block + +export DEVPATH=block/sda/sda3 + +../udev block + + diff --git a/test/topo_test.config b/test/topo_test.config new file mode 100644 index 0000000000..d7ae92b080 --- /dev/null +++ b/test/topo_test.config @@ -0,0 +1,3 @@ +# TOPO test +TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="first_disk" + -- cgit v1.2.3-54-g00ecf From ca1cc0fe7489c40a137ece43a65e65765678e89d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 13 Nov 2003 05:52:08 -0800 Subject: [PATCH] splig LABEL and NUMBER into separate functions. Now items are processed in priority order, fixing that bug. --- namedev.c | 198 ++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 109 insertions(+), 89 deletions(-) diff --git a/namedev.c b/namedev.c index 7c2db150be..d806d25edf 100644 --- a/namedev.c +++ b/namedev.c @@ -566,6 +566,107 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev return -ENODEV; } +static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +{ + struct sysfs_attribute *tmpattr = NULL; + struct config_device *dev; + struct list_head *tmp; + char *temp = NULL; + + list_for_each(tmp, &config_device_list) { + dev = list_entry(tmp, struct config_device, node); + if (dev->type != LABEL) + continue; + + dbg_parse("LABEL: match file '%s' with value '%s'", + dev->sysfs_file, dev->sysfs_value); + /* try to find the attribute in the class device directory */ + tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); + if (tmpattr) + goto label_found; + + /* look in the class device directory if present */ + if (sysfs_device) { + tmpattr = sysfs_get_device_attr(sysfs_device, dev->sysfs_file); + if (tmpattr) + goto label_found; + } + + continue; + +label_found: + tmpattr->value[strlen(tmpattr->value)-1] = 0x00; + dbg_parse("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value); + if (strcmp(dev->sysfs_value, tmpattr->value) != 0) + continue; + + strcpy(udev->name, dev->name); + if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { + temp = &class_dev->path[strlen(class_dev->path)-1]; + strcat(udev->name, temp); + } + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); + } + dbg_parse("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->sysfs_file, dev->sysfs_value, udev->name, + dev->owner, dev->group, dev->mode); + + return 0; + } + return -ENODEV; +} + +static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +{ + struct config_device *dev; + struct list_head *tmp; + char path[SYSFS_PATH_MAX]; + int found; + char *temp = NULL; + + /* we have to have a sysfs device for NUMBER to work */ + if (!sysfs_device) + return -ENODEV; + + list_for_each(tmp, &config_device_list) { + dev = list_entry(tmp, struct config_device, node); + if (dev->type != NUMBER) + continue; + + found = 0; + strcpy(path, sysfs_device->path); + temp = strrchr(path, '/'); + dbg_parse("NUMBER path = '%s'", path); + dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); + if (strstr(temp, dev->id) != NULL) { + found = 1; + } else { + *temp = 0x00; + temp = strrchr(path, '/'); + dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); + if (strstr(temp, dev->id) != NULL) + found = 1; + } + if (!found) + continue; + strcpy(udev->name, dev->name); + if (dev->mode != 0) { + udev->mode = dev->mode; + strcpy(udev->owner, dev->owner); + strcpy(udev->group, dev->group); + } + dbg_parse("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", + dev->id, udev->name, + dev->owner, dev->group, dev->mode); + return 0; + } + return -ENODEV; +} + + static int do_topology(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { struct config_device *dev; @@ -647,11 +748,9 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) { - struct list_head *tmp; struct sysfs_device *sysfs_device = NULL; struct sysfs_class_device *class_dev_parent = NULL; int retval = 0; - int found; char *temp = NULL; udev->mode = 0; @@ -693,99 +792,20 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) } else { dbg_parse("class_dev->name = '%s'", class_dev->name); } - list_for_each(tmp, &config_device_list) { - struct config_device *dev = list_entry(tmp, struct config_device, node); - switch (dev->type) { - case LABEL: - { - struct sysfs_attribute *tmpattr = NULL; - - dbg_parse("LABEL: match file '%s' with value '%s'", - dev->sysfs_file, dev->sysfs_value); - /* try to find the attribute in the class device directory */ - tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); - if (tmpattr) - goto label_found; - - /* look in the class device directory if present */ - if (sysfs_device) { - tmpattr = sysfs_get_device_attr(sysfs_device, dev->sysfs_file); - if (tmpattr) - goto label_found; - } - - continue; - -label_found: - tmpattr->value[strlen(tmpattr->value)-1] = 0x00; - dbg_parse("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value); - if (strcmp(dev->sysfs_value, tmpattr->value) != 0) - continue; - - strcpy(udev->name, dev->name); - if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { - temp = &class_dev->path[strlen(class_dev->path)-1]; - strcat(udev->name, temp); - } - if (dev->mode != 0) { - udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); - } - dbg_parse("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->sysfs_file, dev->sysfs_value, udev->name, - dev->owner, dev->group, dev->mode); - goto done; - break; - } - case NUMBER: - { - char path[SYSFS_PATH_MAX]; - - found = 0; - if (!sysfs_device) - continue; - s - rcpy(path, sysfs_device->path); - temp = strrchr(path, '/'); - dbg_parse("NUMBER path = '%s'", path); - dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); - if (strstr(temp, dev->id) != NULL) { - found = 1; - } else { - *temp = 0x00; - temp = strrchr(path, '/'); - dbg_parse("NUMBERY temp = '%s' id = '%s'", temp, dev->id); - if (strstr(temp, dev->id) != NULL) - found = 1; - } - if (!found) - continue; - - strcpy(udev->name, dev->name); - if (dev->mode != 0) { - udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); - } - dbg_parse("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->id, udev->name, - dev->owner, dev->group, dev->mode); - goto done; - break; - } - case KERNEL_NAME: - default: - break; - } - } /* rules are looked at in priority order */ - retval = do_callout(class_dev, udev); if (retval == 0) goto done; + retval = do_label(class_dev, udev, sysfs_device); + if (retval == 0) + goto done; + + retval = do_number(class_dev, udev, sysfs_device); + if (retval == 0) + goto done; + retval = do_topology(class_dev, udev, sysfs_device); if (retval == 0) goto done; -- cgit v1.2.3-54-g00ecf From 20ff86bd7111221e8709c614c5e3969950293664 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 13 Nov 2003 06:24:09 -0800 Subject: [PATCH] trailing whitespace cleanups. --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index d806d25edf..d76d03b490 100644 --- a/namedev.c +++ b/namedev.c @@ -684,7 +684,7 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude if (dev->type != TOPOLOGY) continue; - found = 0; + found = 0; strcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg_parse("TOPOLOGY path = '%s'", path); -- cgit v1.2.3-54-g00ecf From 04a091d47e32d6480b99424e41db093b013dfaf5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 13 Nov 2003 06:30:57 -0800 Subject: [PATCH] Add multipath "extra" program from Christophe Varoqui, --- extras/multipath/AUTHOR | 1 + extras/multipath/COPYING | 483 +++++++++++++++++ extras/multipath/ChangeLog | 3 + extras/multipath/Makefile | 34 ++ extras/multipath/README | 82 +++ extras/multipath/VERSION | 1 + extras/multipath/main.c | 741 +++++++++++++++++++++++++ extras/multipath/main.h | 111 ++++ extras/multipath/sg_err.c | 1197 +++++++++++++++++++++++++++++++++++++++++ extras/multipath/sg_err.h | 162 ++++++ extras/multipath/sg_include.h | 44 ++ 11 files changed, 2859 insertions(+) create mode 100644 extras/multipath/AUTHOR create mode 100644 extras/multipath/COPYING create mode 100644 extras/multipath/ChangeLog create mode 100644 extras/multipath/Makefile create mode 100644 extras/multipath/README create mode 100644 extras/multipath/VERSION create mode 100644 extras/multipath/main.c create mode 100644 extras/multipath/main.h create mode 100644 extras/multipath/sg_err.c create mode 100644 extras/multipath/sg_err.h create mode 100644 extras/multipath/sg_include.h diff --git a/extras/multipath/AUTHOR b/extras/multipath/AUTHOR new file mode 100644 index 0000000000..4e8eeef5c8 --- /dev/null +++ b/extras/multipath/AUTHOR @@ -0,0 +1 @@ +Christophe Varoqui, diff --git a/extras/multipath/COPYING b/extras/multipath/COPYING new file mode 100644 index 0000000000..9e31bbf0b3 --- /dev/null +++ b/extras/multipath/COPYING @@ -0,0 +1,483 @@ + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog new file mode 100644 index 0000000000..f3014cf01e --- /dev/null +++ b/extras/multipath/ChangeLog @@ -0,0 +1,3 @@ +2003-09-18 Christophe Varoqui + * multipath 0.0.1 released. + * Initial release. diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile new file mode 100644 index 0000000000..0835d7a2c6 --- /dev/null +++ b/extras/multipath/Makefile @@ -0,0 +1,34 @@ +# Makefile +# +# Copyright (C) 2003 Christophe Varoqui, + +EXEC = multipath + +prefix = /usr/local +exec_prefix = ${prefix} +bindir = ${exec_prefix}/bin + +CC = gcc +CFLAGS = -g -O2 -Wall -Wunused -Wstrict-prototypes +LDFLAGS = -lsysfs -ldevmapper + +OBJS = main.o sg_err.o + +all: $(EXEC) + strip $(EXEC) + @echo "" + @echo "Make complete" + +$(EXEC): $(OBJS) + $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) + +clean: + rm -f core *.o $(EXEC) + +install: + install -d $(bindir) + install -m 755 $(EXEC) $(bindir)/ + +# Code dependencies +main.o: main.c main.h sg_err.h sg_include.h +sg_err.o: sg_err.c sg_err.h sg_include.h diff --git a/extras/multipath/README b/extras/multipath/README new file mode 100644 index 0000000000..6a5637de4b --- /dev/null +++ b/extras/multipath/README @@ -0,0 +1,82 @@ +Dependancies : +============== + +o libdevmapper : comes with device-mapper-XXXX.tar.gz + See www.sistina.com +o libsysfs : comes with sysutils + See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ + +How it works : +============== + +Fill the all_paths array. Each path store this info : + +struct path { + char dev[FILE_NAME_SIZE]; + char sg_dev[FILE_NAME_SIZE]; + struct scsi_idlun scsi_id; + struct sg_id sg_id; + int state; + char wwid[WWID_SIZE]; +}; + +scsi_id, sg_dev and sg_id are only really useful for 2.4 +kernels, for which SG cmnds must go through sg devs. +In 2.5+ we have the nice opportunity to send SG cmnds +through SCSI bdevs. + +For 2.4 compat, we pivot on idlun tupple to map sg devs +to SCSI bdevs. + +2.4 does not do device enumeration, so we must scan a +defined number of sg devs and scsi bdevs. Good enough. +In 2.5+, we rely on libsysfs (sysutils) to access to +sysfs device enums. + +the wwid is retrieved by a switch fonction. Only White +Listed HW can filled this field. For now only +StorageWorks HW is White Listed. (See notes) + +When all_paths is filled, we coalesce the paths and store +the result in mp array. Each mp is a struct like this : + +struct multipath { + char wwid[WWID_SIZE]; + int npaths; + int pindex[MAX_MP_PATHS]; +}; + +When mp is filled, the device maps are fed to the kernel +through libdevmapper. Stale paths (failed TUR) are +discarded. + +Notes : +======= + +o make sure you have enough /dev/sg* nodes + (/dev/MAKEDEV if necesary) + +o path coalescing relies on a path unique id being found. + This unique id, lacking a standard method, is vendor + specific. A switch function (get_unique_id) is present + and an example function is provided for storageworks + arrays (get_storageworks_wwid). Feel free to enrich + with hardware you have at hand :) + +o Something goes wrong with sd.o, qla2200 & dm-mod + refcounting : I can't unload these modules after exec. + +o The kernel does NOT manage properly ghosts paths + with StorageWorks HW. Seems nobody cares after a load + of posts to linux-scsi. + +o 2.4.21 version of DM does not like even segment size. + if you enconter pbs with this, upgrade DM. + +Credits : +========= + +o Heavy cut'n paste from sg_utils. Thanks goes to D. + Gilbert. +o Light cut'n paste from dmsetup. Thanks Joe Thornber. +o Greg KH for the nice sysfs API. diff --git a/extras/multipath/VERSION b/extras/multipath/VERSION new file mode 100644 index 0000000000..bbdeab6222 --- /dev/null +++ b/extras/multipath/VERSION @@ -0,0 +1 @@ +0.0.5 diff --git a/extras/multipath/main.c b/extras/multipath/main.c new file mode 100644 index 0000000000..0ed74c52a9 --- /dev/null +++ b/extras/multipath/main.c @@ -0,0 +1,741 @@ +/* + * Soft: Description here... + * + * Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $ + * + * Author: Copyright (C) 2003 Christophe Varoqui + * + * 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. + * + * 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; either version + * 2 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "main.h" + +static int +do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, + void *resp, int mx_resp_len, int noisy) +{ + int res; + unsigned char inqCmdBlk[INQUIRY_CMDLEN] = + { INQUIRY_CMD, 0, 0, 0, 0, 0 }; + unsigned char sense_b[SENSE_BUFF_LEN]; + struct sg_io_hdr io_hdr; + + if (cmddt) + inqCmdBlk[1] |= 2; + if (evpd) + inqCmdBlk[1] |= 1; + inqCmdBlk[2] = (unsigned char) pg_op; + inqCmdBlk[4] = (unsigned char) mx_resp_len; + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (inqCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_b); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = mx_resp_len; + io_hdr.dxferp = resp; + io_hdr.cmdp = inqCmdBlk; + io_hdr.sbp = sense_b; + io_hdr.timeout = DEF_TIMEOUT; + + if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) { + perror("SG_IO (inquiry) error"); + return -1; + } + res = sg_err_category3(&io_hdr); + switch (res) { + case SG_ERR_CAT_CLEAN: + case SG_ERR_CAT_RECOVERED: + return 0; + default: + return -1; + } +} + +static int +do_tur(int fd) +{ + unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; + struct sg_io_hdr io_hdr; + unsigned char sense_buffer[32]; + + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (turCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_buffer); + io_hdr.dxfer_direction = SG_DXFER_NONE; + io_hdr.cmdp = turCmdBlk; + io_hdr.sbp = sense_buffer; + io_hdr.timeout = 20000; + io_hdr.pack_id = 0; + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + close(fd); + return 0; + } + if (io_hdr.info & SG_INFO_OK_MASK) { + return 0; + } + return 1; +} + +static void +sprint_wwid(char * buff, const char * str) +{ + int i; + const char *p; + char *cursor; + unsigned char c; + + p = str; + cursor = buff; + for (i = 0; i <= WWID_SIZE / 2 - 1; i++) { + c = *p++; + sprintf(cursor, "%.2x", (int) (unsigned char) c); + cursor += 2; + } + buff[WWID_SIZE - 1] = '\0'; +} + +static int +get_lun_strings(int fd, struct path * mypath) +{ + char buff[36]; + + if (0 == do_inq(fd, 0, 0, 0, buff, 36, 1)) { + memcpy(mypath->vendor_id, &buff[8], 8); + memcpy(mypath->product_id, &buff[16], 16); + memcpy(mypath->rev, &buff[32], 4); + return 1; + } + return 0; +} + +/* +static int +get_serial (int fd, char * str) +{ + char buff[MX_ALLOC_LEN + 1]; + int len; + + if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { + len = buff[3]; + if (len > 0) { + memcpy(str, buff + 4, len); + buff[len] = '\0'; + } + return 1; + } + return 0; +} +*/ + +/* hardware vendor specifics : add support for new models below */ +static int +get_storageworks_wwid(int fd, char *str) +{ + char buff[64]; + + if (0 == do_inq(fd, 0, 1, 0x83, buff, sizeof (buff), 1)) { + sprint_wwid(str, &buff[8]); + return 1; + } + return 0; +} + +/* White list switch */ +static int +get_unique_id(int fd, struct path * mypath) +{ + if (strncmp(mypath->product_id, "HSV110 (C)COMPAQ", 16) == 0 || + strncmp(mypath->product_id, "HSG80 ", 16) == 0) { + get_storageworks_wwid(fd, mypath->wwid); + return 0; + } + + return 1; +} + +static void +basename(char * str1, char * str2) +{ + char *p = str1 + (strlen(str1) - 1); + + while (*--p != '/') + continue; + strcpy(str2, ++p); +} + +static int +get_all_paths_sysfs(struct env * conf, struct path * all_paths) +{ + int k=0; + int sg_fd; + struct sysfs_directory * sdir; + struct sysfs_directory * devp; + struct sysfs_dlink * linkp; + char buff[FILE_NAME_SIZE]; + + char block_path[FILE_NAME_SIZE]; + + sprintf(block_path, "%s/block", conf->sysfs_path); + sdir = sysfs_open_directory(block_path); + sysfs_read_directory(sdir); + devp = sdir->subdirs; + while (devp != NULL) { + sysfs_read_directory(devp); + linkp = devp->links; + while (linkp != NULL) { + if (!strncmp(linkp->name, "device", 6)) + break; + linkp = linkp->next; + } + if (linkp == NULL) { + devp = devp->next; + continue; + } + + basename(devp->path, buff); + sprintf(all_paths[k].sg_dev, "/dev/%s", buff); + strcpy(all_paths[k].dev, all_paths[k].sg_dev); + if ((sg_fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) { + devp = devp->next; + continue; + } + get_lun_strings(sg_fd, &all_paths[k]); + get_unique_id(sg_fd, &all_paths[k]); + all_paths[k].state = do_tur(sg_fd); + close(sg_fd); + basename(linkp->target->path, buff); + sscanf(buff, "%i:%i:%i:%i", + &all_paths[k].sg_id.host_no, + &all_paths[k].sg_id.channel, + &all_paths[k].sg_id.scsi_id, + &all_paths[k].sg_id.lun); + k++; + devp = devp->next; + } + sysfs_close_directory(sdir); + + return 0; +} + +static int +get_all_paths_nosysfs(struct env * conf, struct path * all_paths, + struct scsi_dev * all_scsi_ids) +{ + int k, i, sg_fd; + char buff[FILE_NAME_SIZE]; + char file_name[FILE_NAME_SIZE]; + + for (k = 0; k < conf->max_devs; k++) { + strcpy(file_name, "/dev/sg"); + sprintf(buff, "%d", k); + strncat(file_name, buff, FILE_NAME_SIZE); + strcpy(all_paths[k].sg_dev, file_name); + if ((sg_fd = open(file_name, O_RDONLY)) < 0) + continue; + get_lun_strings(sg_fd, &all_paths[k]); + get_unique_id(sg_fd, &all_paths[k]); + all_paths[k].state = do_tur(sg_fd); + if (0 > ioctl(sg_fd, SG_GET_SCSI_ID, &(all_paths[k].sg_id))) + printf("device %s failed on sg ioctl, skip\n", + file_name); + + close(sg_fd); + + for (i = 0; i < conf->max_devs; i++) { + if ((all_paths[k].sg_id.host_no == + all_scsi_ids[i].host_no) + && (all_paths[k].sg_id.scsi_id == + (all_scsi_ids[i].scsi_id.dev_id & 0xff)) + && (all_paths[k].sg_id.lun == + ((all_scsi_ids[i].scsi_id.dev_id >> 8) & 0xff)) + && (all_paths[k].sg_id.channel == + ((all_scsi_ids[i].scsi_id. + dev_id >> 16) & 0xff))) { + strcpy(all_paths[k].dev, all_scsi_ids[i].dev); + break; + } + } + } + return 0; +} + +static int +get_all_scsi_ids(struct env * conf, struct scsi_dev * all_scsi_ids) +{ + int k, big, little, res, host_no, fd; + char buff[64]; + char fname[FILE_NAME_SIZE]; + struct scsi_idlun my_scsi_id; + + for (k = 0; k < conf->max_devs; k++) { + strcpy(fname, "/dev/sd"); + if (k < 26) { + buff[0] = 'a' + (char) k; + buff[1] = '\0'; + strcat(fname, buff); + } else if (k <= 255) { /* assumes sequence goes x,y,z,aa,ab,ac etc */ + big = k / 26; + little = k - (26 * big); + big = big - 1; + + buff[0] = 'a' + (char) big; + buff[1] = 'a' + (char) little; + buff[2] = '\0'; + strcat(fname, buff); + } else + strcat(fname, "xxxx"); + + if ((fd = open(fname, O_RDONLY)) < 0) + continue; + + res = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &my_scsi_id); + if (res < 0) { + close(fd); + printf("Could not get scsi idlun\n"); + continue; + } + + res = ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &host_no); + if (res < 0) { + close(fd); + printf("Could not get host_no\n"); + continue; + } + + close(fd); + + strcpy(all_scsi_ids[k].dev, fname); + all_scsi_ids[k].scsi_id = my_scsi_id; + all_scsi_ids[k].host_no = host_no; + } + return 0; +} + +/* print_path style */ +#define ALL 0 +#define NOWWID 1 + +static void +print_path(struct path * all_paths, int k, int style) +{ + if (style != NOWWID) + printf("%s ", all_paths[k].wwid); + else + printf(" \\_"); + printf("(%i %i %i %i) ", + all_paths[k].sg_id.host_no, + all_paths[k].sg_id.channel, + all_paths[k].sg_id.scsi_id, all_paths[k].sg_id.lun); + printf("%s ", all_paths[k].sg_dev); + printf("op:%i ", all_paths[k].state); + printf("%s ", all_paths[k].dev); + printf("[%.16s]\n", all_paths[k].product_id); +} + +static void +print_all_path(struct env * conf, struct path * all_paths) +{ + int k; + char empty_buff[WWID_SIZE]; + + memset(empty_buff, 0, WWID_SIZE); + for (k = 0; k < conf->max_devs; k++) { + if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) + continue; + print_path(all_paths, k, ALL); + } +} + +static void +print_all_mp(struct path * all_paths, struct multipath * mp, int nmp) +{ + int k, i; + + for (k = 0; k <= nmp; k++) { + printf("%s\n", mp[k].wwid); + for (i = 0; i <= mp[k].npaths; i++) + print_path(all_paths, PINDEX(k,i), NOWWID); + } +} + +static int +coalesce_paths(struct env * conf, struct multipath * mp, + struct path * all_paths) +{ + int k, i, nmp, np, already_done; + char empty_buff[WWID_SIZE]; + + nmp = -1; + already_done = 0; + memset(empty_buff, 0, WWID_SIZE); + + for (k = 0; k < conf->max_devs - 1; k++) { + /* skip this path if no unique id has been found */ + if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) + continue; + np = 0; + + for (i = 0; i <= nmp; i++) { + if (0 == strcmp(mp[i].wwid, all_paths[k].wwid)) + already_done = 1; + } + + if (already_done) { + already_done = 0; + continue; + } + + nmp++; + strcpy(mp[nmp].wwid, all_paths[k].wwid); + PINDEX(nmp,np) = k; + + for (i = k + 1; i < conf->max_devs; i++) { + if (0 == strcmp(all_paths[k].wwid, all_paths[i].wwid)) { + np++; + PINDEX(nmp,np) = i; + mp[nmp].npaths = np; + } + } + } + return nmp; +} + +static long +get_disk_size (struct env * conf, char * dev) { + long size; + int fd; + char attr_path[FILE_NAME_SIZE]; + char buff[FILE_NAME_SIZE]; + char basedev[FILE_NAME_SIZE]; + + if(conf->with_sysfs) { + basename(dev, basedev); + sprintf(attr_path, "%s/block/%s/size", + conf->sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, buff, + FILE_NAME_SIZE * sizeof(char))) + return -1; + size = atoi(buff); + return size; + } else { + if ((fd = open(dev, O_RDONLY)) < 0) + return -1; + if(!ioctl(fd, BLKGETSIZE, &size)) + return size; + } + return -1; +} + +static int +make_dm_node(char * str) +{ + int r = 0; + dev_t dev; + char buff[FILE_NAME_SIZE]; + int major, minor; + struct dm_names * names; + unsigned next = 0; + struct dm_task *dmt; + + if (!(dmt = dm_task_create(DM_DEVICE_LIST))) + return 0; + + if (!dm_task_run(dmt)) + goto out; + + if (!(names = dm_task_get_names(dmt))) + goto out; + + if (!names->dev) { + r = 1; + goto out; + } + + do { + if (0 == strcmp(names->name, str)) + break; + next = names->next; + names = (void *) names + next; + } while (next); + + major = (int) MAJOR(names->dev); + minor = (int) MINOR(names->dev); + + dev = major << sizeof(dev_t); + dev = dev | minor; + sprintf(buff, "/dev/mapper/%s", str); + unlink(buff); + mknod(buff, 0600 | S_IFBLK, dev); + + out: + dm_task_destroy(dmt); + return r; + +} + +/* future use ? +static int +del_map(char * str) { + struct dm_task *dmt; + + if (!(dmt = dm_task_create(DM_DEVICE_REMOVE))) + return 0; + if (!dm_task_set_name(dmt, str)) + goto delout; + if (!dm_task_run(dmt)) + goto delout; + + printf("Deleted device map : %s\n", str); + + delout: + dm_task_destroy(dmt); + return 1; +} +*/ + +static int +add_map(struct env * conf, struct path * all_paths, + struct multipath * mp, int index, int op) +{ + char params[255]; + char * params_p; + struct dm_task *dmt; + int i, np; + long size = -1; + + if (!(dmt = dm_task_create(op))) + return 0; + + if (!dm_task_set_name(dmt, mp[index].wwid)) + goto addout; + params_p = ¶ms[0]; + + np = 0; + for (i=0; i<=mp[index].npaths; i++) { + if ((1 == all_paths[PINDEX(index,i)].state) && + (0 == all_paths[PINDEX(index,i)].sg_id.scsi_type)) + np++; + } + if (np == 0) + goto addout; + params_p += sprintf(params_p, "%i 32", np); + + for (i=0; i<=mp[index].npaths; i++) { + if (( 0 == all_paths[PINDEX(index,i)].state) || + (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type)) + continue; + if (size < 0) + size = get_disk_size(conf, all_paths[PINDEX(index,0)].dev); + params_p += sprintf(params_p, " %s %i", + all_paths[PINDEX(index,i)].dev, 0); + } + + if (size < 0) + goto addout; + + if (!conf->quiet) { + if (op == DM_DEVICE_RELOAD) + printf("U|"); + if (op == DM_DEVICE_CREATE) + printf("N|"); + printf("%s : 0 %li %s %s\n", + mp[index].wwid, size, DM_TARGET, params); + } + + if (!dm_task_add_target(dmt, 0, size, DM_TARGET, params)) + goto addout; + + if (!dm_task_run(dmt)) + goto addout; + + + make_dm_node(mp[index].wwid); + + addout: + dm_task_destroy(dmt); + return 1; +} + +/* +static int +get_table(const char * str) +{ + int r = 0; + struct dm_task *dmt; + void *next = NULL; + uint64_t start, length; + char *target_type = NULL; + char *params; + + if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) + return 0; + + if (!dm_task_set_name(dmt, str)) + goto out; + + if (!dm_task_run(dmt)) + goto out; + + do { + next = dm_get_next_target(dmt, next, &start, &length, + &target_type, ¶ms); + if (target_type) { + printf("%" PRIu64 " %" PRIu64 " %s %s\n", + start, length, target_type, params); + } + } while (next); + + r = 1; + + out: + dm_task_destroy(dmt); + return r; + +} +*/ + +static int +map_present(char * str) +{ + int r = 0; + struct dm_task *dmt; + struct dm_names *names; + unsigned next = 0; + + if (!(dmt = dm_task_create(DM_DEVICE_LIST))) + return 0; + + if (!dm_task_run(dmt)) + goto out; + + if (!(names = dm_task_get_names(dmt))) + goto out; + + if (!names->dev) { + goto out; + } + + do { + if (0 == strcmp(names->name, str)) + r = 1; + next = names->next; + names = (void *) names + next; + } while (next); + + out: + dm_task_destroy(dmt); + return r; +} + +static void +usage(char * progname) +{ + fprintf(stderr, VERSION_STRING); + fprintf(stderr, "Usage: %s [-v|-q] [-d] [-m max_devs]\n", progname); + fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n"); + fprintf(stderr, "\t-q\t\tquiet, no output at all\n"); + fprintf(stderr, "\t-d\t\tdry run, do not create or update devmaps\n"); + fprintf(stderr, "\t-m max_devs\tscan {max_devs} devices at most\n"); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + struct multipath * mp; + struct path * all_paths; + struct scsi_dev * all_scsi_ids; + struct env conf; + int i, k, nmp; + + /* Default behaviour */ + conf.max_devs = MAX_DEVS; + conf.dry_run = 0; /* 1 == Do not Create/Update devmaps */ + conf.verbose = 0; /* 1 == Print all_paths and mp */ + conf.quiet = 0; /* 1 == Do not even print devmaps */ + conf.with_sysfs = 0; /* Default to compat / suboptimal behaviour */ + + /* kindly provided by libsysfs */ + if (0 == sysfs_get_mnt_path(conf.sysfs_path, FILE_NAME_SIZE)) + conf.with_sysfs = 1; + + for (i = 1; i < argc; ++i) { + if (0 == strcmp("-v", argv[i])) { + if (conf.quiet == 1) + usage(argv[0]); + conf.verbose = 1; + } else if (0 == strcmp("-m", argv[i])) { + conf.max_devs = atoi(argv[++i]); + if (conf.max_devs < 2) + usage(argv[0]); + } else if (0 == strcmp("-q", argv[i])) { + if (conf.verbose == 1) + usage(argv[0]); + conf.quiet = 1; + } else if (0 == strcmp("-d", argv[i])) + conf.dry_run = 1; + else if (*argv[i] == '-') { + fprintf(stderr, "Unknown switch: %s\n", argv[i]); + usage(argv[0]); + } else if (*argv[i] != '-') { + fprintf(stderr, "Unknown argument\n"); + usage(argv[0]); + } + + } + + /* dynamic allocations */ + mp = malloc(conf.max_devs * sizeof(struct multipath)); + all_paths = malloc(conf.max_devs * sizeof(struct path)); + all_scsi_ids = malloc(conf.max_devs * sizeof(struct scsi_dev)); + if (mp == NULL || all_paths == NULL || all_scsi_ids == NULL) + exit(1); + + if (!conf.with_sysfs) { + get_all_scsi_ids(&conf, all_scsi_ids); + get_all_paths_nosysfs(&conf, all_paths, all_scsi_ids); + } else { + get_all_paths_sysfs(&conf, all_paths); + } + nmp = coalesce_paths(&conf, mp, all_paths); + + if (conf.verbose) { + print_all_path(&conf, all_paths); + printf("\n"); + print_all_mp(all_paths, mp, nmp); + printf("\n"); + } + + if (conf.dry_run) + exit(0); + + for (k=0; k<=nmp; k++) { + if (map_present(mp[k].wwid)) { + add_map(&conf, all_paths, mp, k, DM_DEVICE_RELOAD); + } else { + add_map(&conf, all_paths, mp, k, DM_DEVICE_CREATE); + } + } + exit(0); +} diff --git a/extras/multipath/main.h b/extras/multipath/main.h new file mode 100644 index 0000000000..43a24ac7bc --- /dev/null +++ b/extras/multipath/main.h @@ -0,0 +1,111 @@ +/* + * Soft: Description here... + * + * Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $ + * + * Author: Copyright (C) 2003 Christophe Varoqui + * + * 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. + * + * 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; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _MAIN_H +#define _MAIN_H + +/* local includes */ +#include "sg_include.h" +#include "sg_err.h" + +/* global defs */ +#define WWID_SIZE 33 +#define MAX_DEVS 128 +#define MAX_MP MAX_DEVS / 2 +#define MAX_MP_PATHS MAX_DEVS / 4 +#define FILE_NAME_SIZE 256 +#define INQUIRY_CMDLEN 6 +#define INQUIRY_CMD 0x12 +#define SENSE_BUFF_LEN 32 +#define DEF_TIMEOUT 60000 +#define EBUFF_SZ 256 +#define TUR_CMD_LEN 6 +#define MX_ALLOC_LEN 255 +#define BLKGETSIZE _IO(0x12,96) +#define DM_TARGET "striped" + +#define PINDEX(x,y) mp[(x)].pindex[(y)] + +/* global types */ +struct scsi_idlun { + int dev_id; + int host_unique_id; + int host_no; +}; + +struct sg_id { + int host_no; + int channel; + int scsi_id; + int lun; + int scsi_type; + short h_cmd_per_lun; + short d_queue_depth; + int unused1; + int unused2; +}; + +struct scsi_dev { + char dev[FILE_NAME_SIZE]; + struct scsi_idlun scsi_id; + int host_no; +}; + +struct path { + char dev[FILE_NAME_SIZE]; + char sg_dev[FILE_NAME_SIZE]; + struct scsi_idlun scsi_id; + struct sg_id sg_id; + int state; + char wwid[WWID_SIZE]; + char vendor_id[8]; + char product_id[16]; + char rev[4]; +}; + +struct multipath { + char wwid[WWID_SIZE]; + int npaths; + int pindex[MAX_MP_PATHS]; +}; + +struct env { + int max_devs; + int verbose; + int quiet; + int dry_run; + int with_sysfs; + char sysfs_path[FILE_NAME_SIZE]; +}; + +/* Build version */ +#define PROG "multipath" + +#define VERSION_CODE 0x000005 +#define DATE_CODE 0x120903 + +#define MULTIPATH_VERSION(version) \ + (version >> 16) & 0xFF, \ + (version >> 8) & 0xFF, \ + version & 0xFF + +#define VERSION_STRING PROG" v%d.%d.%d (%.2d/%.2d, 20%.2d)\n", \ + MULTIPATH_VERSION(VERSION_CODE), \ + MULTIPATH_VERSION(DATE_CODE) + +#endif diff --git a/extras/multipath/sg_err.c b/extras/multipath/sg_err.c new file mode 100644 index 0000000000..8a332cd8c6 --- /dev/null +++ b/extras/multipath/sg_err.c @@ -0,0 +1,1197 @@ +#include +#include +#include +#include "sg_include.h" +#include "sg_err.h" + + +/* This file is a huge cut, paste and hack from linux/drivers/scsi/constant.c +* which I guess was written by: +* Copyright (C) 1993, 1994, 1995 Eric Youngdale + +* The rest of this is: +* Copyright (C) 1999 - 2003 D. Gilbert +* +* 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; either version 2, or (at your option) +* any later version. +* +* ASCII values for a number of symbolic constants, printing functions, etc. +* +* Some of the tables have been updated for SCSI 2. +* Additions for SCSI 3+ (SPC-3 T10/1416-D Rev 12 18 March 2003) +* +* Version 0.91 (20030529) +* sense key specific field (bytes 15-17) decoding [Trent Piepho] +*/ + +#define OUTP stderr + +static const unsigned char scsi_command_size[8] = { 6, 10, 10, 12, + 16, 12, 10, 10 }; + +#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7] + +static const char unknown[] = "UNKNOWN"; + +static const char * group_0_commands[] = { +/* 00-03 */ "Test Unit Ready", "Rezero Unit", unknown, "Request Sense", +/* 04-07 */ "Format Unit", "Read Block Limits", unknown, "Reasssign Blocks", +/* 08-0d */ "Read (6)", unknown, "Write (6)", "Seek (6)", unknown, unknown, +/* 0e-12 */ unknown, "Read Reverse", "Write Filemarks", "Space", "Inquiry", +/* 13-16 */ "Verify", "Recover Buffered Data", "Mode Select", "Reserve", +/* 17-1b */ "Release", "Copy", "Erase", "Mode Sense", "Start/Stop Unit", +/* 1c-1d */ "Receive Diagnostic", "Send Diagnostic", +/* 1e-1f */ "Prevent/Allow Medium Removal", unknown, +}; + + +static const char *group_1_commands[] = { +/* 20-23 */ unknown, unknown, unknown, "Read Format capacities", +/* 24-28 */ "Set window", "Read Capacity", + unknown, unknown, "Read (10)", +/* 29-2d */ "Read Generation", "Write (10)", "Seek (10)", "Erase", + "Read updated block", +/* 2e-31 */ "Write Verify","Verify", "Search High", "Search Equal", +/* 32-34 */ "Search Low", "Set Limits", "Prefetch or Read Position", +/* 35-37 */ "Synchronize Cache","Lock/Unlock Cache", "Read Defect Data", +/* 38-3c */ "Medium Scan", "Compare", "Copy Verify", "Write Buffer", + "Read Buffer", +/* 3d-3f */ "Update Block", "Read Long", "Write Long", +}; + +static const char *group_2_commands[] = { +/* 40-41 */ "Change Definition", "Write Same", +/* 42-48 */ "Read sub-channel", "Read TOC", "Read header", + "Play audio (10)", "Get configuration", "Play audio msf", + "Play audio track/index", +/* 49-4f */ "Play track relative (10)", "Get event status notification", + "Pause/resume", "Log Select", "Log Sense", "Stop play/scan", + unknown, +/* 50-55 */ "Xdwrite", "Xpwrite, Read disk info", "Xdread, Read track info", + "Reserve track", "Send OPC onfo", "Mode Select (10)", +/* 56-5b */ "Reserve (10)", "Release (10)", "Repair track", "Read master cue", + "Mode Sense (10)", "Close track/session", +/* 5c-5f */ "Read buffer capacity", "Send cue sheet", "Persistent reserve in", + "Persistent reserve out", +}; + +/* The following are 16 byte commands in group 4 */ +static const char *group_4_commands[] = { +/* 80-84 */ "Xdwrite (16)", "Rebuild (16)", "Regenerate (16)", "Extended copy", + "Receive copy results", +/* 85-89 */ "Memory Export In (16)", "Access control in", "Access control out", + "Read (16)", "Memory Export Out (16)", +/* 8a-8f */ "Write (16)", unknown, "Read attributes", "Write attributes", + "Write and verify (16)", "Verify (16)", +/* 90-94 */ "Pre-fetch (16)", "Synchronize cache (16)", + "Lock/unlock cache (16)", "Write same (16)", unknown, +/* 95-99 */ unknown, unknown, unknown, unknown, unknown, +/* 9a-9f */ unknown, unknown, unknown, unknown, "Service action in", + "Service action out", +}; + +/* The following are 12 byte commands in group 5 */ +static const char *group_5_commands[] = { +/* a0-a5 */ "Report luns", "Blank", "Send event", "Maintenance (in)", + "Maintenance (out)", "Move medium/play audio(12)", +/* a6-a9 */ "Exchange medium", "Move medium attached", "Read(12)", + "Play track relative(12)", +/* aa-ae */ "Write(12)", unknown, "Erase(12), Get Performance", + "Read DVD structure", "Write and verify(12)", +/* af-b1 */ "Verify(12)", "Search data high(12)", "Search data equal(12)", +/* b2-b4 */ "Search data low(12)", "Set limits(12)", + "Read element status attached", +/* b5-b6 */ "Request volume element address", "Send volume tag, set streaming", +/* b7-b9 */ "Read defect data(12)", "Read element status", "Read CD msf", +/* ba-bc */ "Redundancy group (in), Scan", + "Redundancy group (out), Set cd-rom speed", "Spare (in), Play cd", +/* bd-bf */ "Spare (out), Mechanism status", "Volume set (in), Read cd", + "Volume set (out), Send DVD structure", +}; + + +#define group(opcode) (((opcode) >> 5) & 7) + +#define RESERVED_GROUP 0 +#define VENDOR_GROUP 1 + +static const char **commands[] = { + group_0_commands, group_1_commands, group_2_commands, + (const char **) RESERVED_GROUP, group_4_commands, + group_5_commands, (const char **) VENDOR_GROUP, + (const char **) VENDOR_GROUP +}; + +static const char reserved[] = "RESERVED"; +static const char vendor[] = "VENDOR SPECIFIC"; + +static void print_opcode(int opcode) { + const char **table = commands[ group(opcode) ]; + + switch ((unsigned long) table) { + case RESERVED_GROUP: + fprintf(OUTP, "%s(0x%02x)", reserved, opcode); + break; + case VENDOR_GROUP: + fprintf(OUTP, "%s(0x%02x)", vendor, opcode); + break; + default: + fprintf(OUTP, "%s",table[opcode & 0x1f]); + break; + } +} + +void sg_print_command (const unsigned char * command) { + int k, s; + print_opcode(command[0]); + fprintf(OUTP, " ["); + for (k = 0, s = COMMAND_SIZE(command[0]); k < s; ++k) + fprintf(OUTP, "%02x ", command[k]); + fprintf(OUTP, "]\n"); +} + +void sg_print_status(int masked_status) +{ + int scsi_status = (masked_status << 1) & 0x7e; + + sg_print_scsi_status(scsi_status); +} + +void sg_print_scsi_status(int scsi_status) +{ + const char * ccp; + + scsi_status &= 0x7e; /* sanitize as much as possible */ + switch (scsi_status) { + case 0: ccp = "Good"; break; + case 0x2: ccp = "Check Condition"; break; + case 0x4: ccp = "Condition Met"; break; + case 0x8: ccp = "Busy"; break; + case 0x10: ccp = "Intermediate"; break; + case 0x14: ccp = "Intermediate-Condition Met"; break; + case 0x18: ccp = "Reservation Conflict"; break; + case 0x22: ccp = "Command Terminated (obsolete)"; break; + case 0x28: ccp = "Task set Full"; break; + case 0x30: ccp = "ACA Active"; break; + case 0x40: ccp = "Task Aborted"; break; + default: ccp = "Unknown status"; break; + } + fprintf(OUTP, "%s ", ccp); +} + +/* In brackets is the related SCSI document (see www.t10.org) with the */ +/* peripheral device type after the colon */ +/* No programmatic use is made of these flags currently */ +#define D 0x0001 /* DIRECT ACCESS DEVICE (disk) [SBC-2: 0] */ +#define T 0x0002 /* SEQUENTIAL ACCESS DEVICE (tape) [SSC: 1] */ +#define L 0x0004 /* PRINTER DEVICE [SSC: 2] */ +#define P 0x0008 /* PROCESSOR DEVICE [SPC-2: 3] */ +#define W 0x0010 /* WRITE ONCE READ MULTIPLE DEVICE [SBC-2: 4] */ +#define R 0x0020 /* CD/DVD DEVICE [MMC-2: 5] */ +#define S 0x0040 /* SCANNER DEVICE [SCSI-2 (obsolete): 6] */ +#define O 0x0080 /* OPTICAL MEMORY DEVICE [SBC-2: 7] */ +#define M 0x0100 /* MEDIA CHANGER DEVICE [SMC-2: 8] */ +#define C 0x0200 /* COMMUNICATION DEVICE [SCSI-2 (obsolete): 9] */ +#define A 0x0400 /* ARRAY STORAGE [SCC-2: 12] */ +#define E 0x0800 /* ENCLOSURE SERVICES DEVICE [SES: 13] */ +#define B 0x1000 /* SIMPLIFIED DIRECT ACCESS DEVICE [RBC: 14] */ +#define K 0x2000 /* OPTICAL CARD READER/WRITER DEVICE [OCRW: 15] */ + +#define SC_ALL_DEVS ( D|T|L|P|W|R|S|O|M|C|A|E|B|K ) + +/* oft used strings are encoded using ASCII codes 0x1 to 0x1f . */ +/* This is to save space. This encoding should be UTF-8 and */ +/* UTF-16 friendly. */ +#define SC_AUDIO_PLAY_OPERATION "\x1" +#define SC_LOGICAL_UNIT "\x2" +#define SC_NOT_READY "\x3" +#define SC_OPERATION "\x4" +#define SC_IN_PROGRESS "\x5" +#define SC_HARDWARE_IF "\x6" +#define SC_CONTROLLER_IF "\x7" +#define SC_DATA_CHANNEL_IF "\x8" +#define SC_SERVO_IF "\x9" +#define SC_SPINDLE_IF "\xa" +#define SC_FIRMWARE_IF "\xb" +#define SC_RECOVERED_DATA "\xc" +#define SC_ERROR_RATE_TOO_HIGH "\xd" +#define SC_TIMES_TOO_HIGH "\xe" + + +struct error_info{ + unsigned char code1, code2; + unsigned short int devices; + const char * text; +}; + +struct error_info2{ + unsigned char code1, code2_min, code2_max; + unsigned short int devices; + const char * text; +}; + +static struct error_info2 additional2[] = +{ + {0x40,0x00,0x7f,D,"Ram failure (%x)"}, + {0x40,0x80,0xff,D|T|L|P|W|R|S|O|M|C,"Diagnostic failure on component (%x)"}, + {0x41,0x00,0xff,D,"Data path failure (%x)"}, + {0x42,0x00,0xff,D,"Power-on or self-test failure (%x)"}, + {0, 0, 0, 0, NULL} +}; + +static struct error_info additional[] = +{ + {0x00,0x00,SC_ALL_DEVS,"No additional sense information"}, + {0x00,0x01,T,"Filemark detected"}, + {0x00,0x02,T|S,"End-of-partition/medium detected"}, + {0x00,0x03,T,"Setmark detected"}, + {0x00,0x04,T|S,"Beginning-of-partition/medium detected"}, + {0x00,0x05,T|L|S,"End-of-data detected"}, + {0x00,0x06,SC_ALL_DEVS,"I/O process terminated"}, + {0x00,0x11,R,SC_AUDIO_PLAY_OPERATION SC_IN_PROGRESS}, + {0x00,0x12,R,SC_AUDIO_PLAY_OPERATION "paused"}, + {0x00,0x13,R,SC_AUDIO_PLAY_OPERATION "successfully completed"}, + {0x00,0x14,R,SC_AUDIO_PLAY_OPERATION "stopped due to error"}, + {0x00,0x15,R,"No current audio status to return"}, + {0x00,0x16,SC_ALL_DEVS,SC_OPERATION SC_IN_PROGRESS}, + {0x00,0x17,D|T|L|W|R|S|O|M|A|E|B|K,"Cleaning requested"}, + {0x00,0x18,T,"Erase" SC_OPERATION SC_IN_PROGRESS}, + {0x00,0x19,T,"Locate" SC_OPERATION SC_IN_PROGRESS}, + {0x00,0x1a,T,"Rewind" SC_OPERATION SC_IN_PROGRESS}, + {0x00,0x1b,T,"Set capacity" SC_OPERATION SC_IN_PROGRESS}, + {0x00,0x1c,T,"Verify" SC_OPERATION SC_IN_PROGRESS}, + {0x01,0x00,D|W|O|B|K,"No index/sector signal"}, + {0x02,0x00,D|W|R|O|M|B|K,"No seek complete"}, + {0x03,0x00,D|T|L|W|S|O|B|K,"Peripheral device write fault"}, + {0x03,0x01,T,"No write current"}, + {0x03,0x02,T,"Excessive write errors"}, + {0x04,0x00,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY "cause not reportable"}, + {0x04,0x01,SC_ALL_DEVS,SC_LOGICAL_UNIT "is" SC_IN_PROGRESS + "of becoming ready"}, + {0x04,0x02,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY + "initializing cmd. required"}, + {0x04,0x03,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY + "manual intervention required"}, + {0x04,0x04,D|T|L|R|O|B,SC_LOGICAL_UNIT SC_NOT_READY "format" SC_IN_PROGRESS}, + {0x04,0x05,D|T|W|O|M|C|A|B|K,SC_LOGICAL_UNIT SC_NOT_READY + "rebuild" SC_IN_PROGRESS}, + {0x04,0x06,D|T|W|O|M|C|A|B|K,SC_LOGICAL_UNIT SC_NOT_READY + "recalculation" SC_IN_PROGRESS}, + {0x04,0x07,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY + SC_OPERATION SC_IN_PROGRESS}, + {0x04,0x08,R,SC_LOGICAL_UNIT SC_NOT_READY "long write" SC_IN_PROGRESS}, + {0x04,0x09,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY "self-test" + SC_IN_PROGRESS}, + {0x04,0x0a,SC_ALL_DEVS,SC_LOGICAL_UNIT + "not accessible, asymmetric access state transition"}, + {0x04,0x0b,SC_ALL_DEVS,SC_LOGICAL_UNIT + "not accessible, target port in standby state"}, + {0x04,0x0c,SC_ALL_DEVS,SC_LOGICAL_UNIT + "not accessible, target port in unavailable state"}, + {0x04,0x10,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY + "auxiliary memory not accessible"}, + {0x05,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,SC_LOGICAL_UNIT + "does not respond to selection"}, + {0x06,0x00,D|W|R|O|M|B|K,"No reference position found"}, + {0x07,0x00,D|T|L|W|R|S|O|M|B|K,"Multiple peripheral devices selected"}, + {0x08,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,SC_LOGICAL_UNIT "communication failure"}, + {0x08,0x01,D|T|L|W|R|S|O|M|C|A|E|B|K,SC_LOGICAL_UNIT + "communication time-out"}, + {0x08,0x02,D|T|L|W|R|S|O|M|C|A|E|B|K,SC_LOGICAL_UNIT + "communication parity error"}, + {0x08,0x03,D|T|R|O|M|B|K,SC_LOGICAL_UNIT + "communication CRC error (Ultra-DMA/32)"}, + {0x08,0x04,D|T|L|P|W|R|S|O|C|K,"Unreachable copy target"}, + {0x09,0x00,D|T|W|R|O|B,"Track following error"}, + {0x09,0x01,W|R|O|K,"Tracking servo failure"}, + {0x09,0x02,W|R|O|K,"Focus servo failure"}, + {0x09,0x03,W|R|O,"Spindle servo failure"}, + {0x09,0x04,D|T|W|R|O|B,"Head select fault"}, + {0x0A,0x00,SC_ALL_DEVS,"Error log overflow"}, + {0x0B,0x00,SC_ALL_DEVS,"Warning"}, + {0x0B,0x01,SC_ALL_DEVS,"Warning - specified temperature exceeded"}, + {0x0B,0x02,SC_ALL_DEVS,"Warning - enclosure degraded"}, + {0x0C,0x00,T|R|S,"Write error"}, + {0x0C,0x01,K,"Write error - recovered with auto reallocation"}, + {0x0C,0x02,D|W|O|B|K,"Write error - auto reallocation failed"}, + {0x0C,0x03,D|W|O|B|K,"Write error - recommend reassignment"}, + {0x0C,0x04,D|T|W|O|B,"Compression check miscompare error"}, + {0x0C,0x05,D|T|W|O|B,"Data expansion occurred during compression"}, + {0x0C,0x06,D|T|W|O|B,"Block not compressible"}, + {0x0C,0x07,R,"Write error - recovery needed"}, + {0x0C,0x08,R,"Write error - recovery failed"}, + {0x0C,0x09,R,"Write error - loss of streaming"}, + {0x0C,0x0A,R,"Write error - padding blocks added"}, + {0x0C,0x0B,D|T|W|R|O|M|B,"Auxiliary memory write error"}, + {0x0C,0x0C,SC_ALL_DEVS,"Write error - unexpected unsolicited data"}, + {0x0C,0x0D,SC_ALL_DEVS,"Write error - not enough unsolicited data"}, + {0x0D,0x00,D|T|L|P|W|R|S|O|C|A|K, + "Error detected by third party temporary initiator"}, + {0x0D,0x01,D|T|L|P|W|R|S|O|C|A|K, "Third party device failure"}, + {0x0D,0x02,D|T|L|P|W|R|S|O|C|A|K, "Copy target device not reachable"}, + {0x0D,0x03,D|T|L|P|W|R|S|O|C|A|K, "Incorrect copy target device"}, + {0x0D,0x04,D|T|L|P|W|R|S|O|C|A|K, "Copy target device underrun"}, + {0x0D,0x05,D|T|L|P|W|R|S|O|C|A|K, "Copy target device overrun"}, + {0x10,0x00,D|W|O|B|K,"Id CRC or ECC error"}, + {0x11,0x00,D|T|W|R|S|O|B|K,"Unrecovered read error"}, + {0x11,0x01,D|T|W|R|S|O|B|K,"Read retries exhausted"}, + {0x11,0x02,D|T|W|R|S|O|B|K,"Error too long to correct"}, + {0x11,0x03,D|T|W|S|O|B|K,"Multiple read errors"}, + {0x11,0x04,D|W|O|B|K,"Unrecovered read error - auto reallocate failed"}, + {0x11,0x05,W|R|O|B,"L-EC uncorrectable error"}, + {0x11,0x06,W|R|O|B,"CIRC unrecovered error"}, + {0x11,0x07,W|O|B,"Data re-synchronization error"}, + {0x11,0x08,T,"Incomplete block read"}, + {0x11,0x09,T,"No gap found"}, + {0x11,0x0A,D|T|O|B|K,"Miscorrected error"}, + {0x11,0x0B,D|W|O|B|K,"Unrecovered read error - recommend reassignment"}, + {0x11,0x0C,D|W|O|B|K,"Unrecovered read error - recommend rewrite the data"}, + {0x11,0x0D,D|T|W|R|O|B,"De-compression CRC error"}, + {0x11,0x0E,D|T|W|R|O|B,"Cannot decompress using declared algorithm"}, + {0x11,0x0F,R,"Error reading UPC/EAN number"}, + {0x11,0x10,R,"Error reading ISRC number"}, + {0x11,0x11,R,"Read error - loss of streaming"}, + {0x11,0x12,D|T|W|R|O|M|B,"Auxiliary memory read error"}, + {0x11,0x13,SC_ALL_DEVS,"Read error - failed retransmission request"}, + {0x12,0x00,D|W|O|B|K,"Address mark not found for id field"}, + {0x13,0x00,D|W|O|B|K,"Address mark not found for data field"}, + {0x14,0x00,D|T|L|W|R|S|O|B|K,"Recorded entity not found"}, + {0x14,0x01,D|T|W|R|O|B|K,"Record not found"}, + {0x14,0x02,T,"Filemark or setmark not found"}, + {0x14,0x03,T,"End-of-data not found"}, + {0x14,0x04,T,"Block sequence error"}, + {0x14,0x05,D|T|W|O|B|K,"Record not found - recommend reassignment"}, + {0x14,0x06,D|T|W|O|B|K,"Record not found - data auto-reallocated"}, + {0x14,0x07,T,"Locate" SC_OPERATION " failure"}, + {0x15,0x00,D|T|L|W|R|S|O|M|B|K,"Random positioning error"}, + {0x15,0x01,D|T|L|W|R|S|O|M|B|K,"Mechanical positioning error"}, + {0x15,0x02,D|T|W|R|O|B|K,"Positioning error detected by read of medium"}, + {0x16,0x00,D|W|O|B|K,"Data synchronization mark error"}, + {0x16,0x01,D|W|O|B|K,"Data sync error - data rewritten"}, + {0x16,0x02,D|W|O|B|K,"Data sync error - recommend rewrite"}, + {0x16,0x03,D|W|O|B|K,"Data sync error - data auto-reallocated"}, + {0x16,0x04,D|W|O|B|K,"Data sync error - recommend reassignment"}, + {0x17,0x00,D|T|W|R|S|O|B|K,SC_RECOVERED_DATA + "with no error correction applied"}, + {0x17,0x01,D|T|W|R|S|O|B|K,SC_RECOVERED_DATA "with retries"}, + {0x17,0x02,D|T|W|R|O|B|K,SC_RECOVERED_DATA "with positive head offset"}, + {0x17,0x03,D|T|W|R|O|B|K,SC_RECOVERED_DATA "with negative head offset"}, + {0x17,0x04,W|R|O|B,SC_RECOVERED_DATA "with retries and/or circ applied"}, + {0x17,0x05,D|W|R|O|B|K,SC_RECOVERED_DATA "using previous sector id"}, + {0x17,0x06,D|W|O|B|K,SC_RECOVERED_DATA "without ecc - data auto-reallocated"}, + {0x17,0x07,D|W|R|O|B|K,SC_RECOVERED_DATA + "without ecc - recommend reassignment"}, + {0x17,0x08,D|W|R|O|B|K,SC_RECOVERED_DATA "without ecc - recommend rewrite"}, + {0x17,0x09,D|W|R|O|B|K,SC_RECOVERED_DATA "without ecc - data rewritten"}, + {0x18,0x00,D|T|W|R|O|B|K,SC_RECOVERED_DATA "with error correction applied"}, + {0x18,0x01,D|W|R|O|B|K,SC_RECOVERED_DATA + "with error corr. & retries applied"}, + {0x18,0x02,D|W|R|O|B|K,SC_RECOVERED_DATA "- data auto-reallocated"}, + {0x18,0x03,R,SC_RECOVERED_DATA "with CIRC"}, + {0x18,0x04,R,SC_RECOVERED_DATA "with L-EC"}, + {0x18,0x05,D|W|R|O|B|K,SC_RECOVERED_DATA "- recommend reassignment"}, + {0x18,0x06,D|W|R|O|B|K,SC_RECOVERED_DATA "- recommend rewrite"}, + {0x18,0x07,D|W|O|B|K,SC_RECOVERED_DATA "with ecc - data rewritten"}, + {0x18,0x08,R,SC_RECOVERED_DATA "with linking"}, + {0x19,0x00,D|O|K,"Defect list error"}, + {0x19,0x01,D|O|K,"Defect list not available"}, + {0x19,0x02,D|O|K,"Defect list error in primary list"}, + {0x19,0x03,D|O|K,"Defect list error in grown list"}, + {0x1A,0x00,SC_ALL_DEVS,"Parameter list length error"}, + {0x1B,0x00,SC_ALL_DEVS,"Synchronous data transfer error"}, + {0x1C,0x00,D|O|B|K,"Defect list not found"}, + {0x1C,0x01,D|O|B|K,"Primary defect list not found"}, + {0x1C,0x02,D|O|B|K,"Grown defect list not found"}, + {0x1D,0x00,D|T|W|R|O|B|K,"Miscompare during verify" SC_OPERATION}, + {0x1E,0x00,D|W|O|B|K,"Recovered id with ecc correction"}, + {0x1F,0x00,D|O|K,"Partial defect list transfer"}, + {0x20,0x00,SC_ALL_DEVS,"Invalid command" SC_OPERATION " code"}, + {0x20,0x01,D|T|P|W|R|O|M|A|E|B|K, + "Access denied - initiator pending-enrolled"}, + {0x20,0x02,D|T|P|W|R|O|M|A|E|B|K,"Access denied - no access rights"}, + {0x20,0x03,D|T|P|W|R|O|M|A|E|B|K,"Access denied - no mgmt id key"}, + {0x20,0x04,T,"Illegal command while in write capable state"}, + {0x20,0x05,T,"Obsolete"}, + {0x20,0x06,T,"Illegal command while in explicit address mode"}, + {0x20,0x07,T,"Illegal command while in implicit address mode"}, + {0x20,0x08,D|T|P|W|R|O|M|A|E|B|K,"Access denied - enrollment conflict"}, + {0x20,0x09,D|T|P|W|R|O|M|A|E|B|K,"Access denied - invalid LU identifier"}, + {0x20,0x0A,D|T|P|W|R|O|M|A|E|B|K,"Access denied - invalid proxy token"}, + {0x20,0x0B,D|T|P|W|R|O|M|A|E|B|K,"Access denied - ACL LUN conflict"}, + {0x21,0x00,D|T|W|R|O|M|B|K,"Logical block address out of range"}, + {0x21,0x01,D|T|W|R|O|M|B|K,"Invalid element address"}, + {0x21,0x02,R,"Invalid address for write"}, + {0x22,0x00,D,"Illegal function (use 20 00,24 00,or 26 00)"}, + {0x24,0x00,SC_ALL_DEVS,"Invalid field in cdb"}, + {0x24,0x01,SC_ALL_DEVS,"CDB decryption error"}, + {0x25,0x00,SC_ALL_DEVS,SC_LOGICAL_UNIT "not supported"}, + {0x26,0x00,SC_ALL_DEVS,"Invalid field in parameter list"}, + {0x26,0x01,SC_ALL_DEVS,"Parameter not supported"}, + {0x26,0x02,SC_ALL_DEVS,"Parameter value invalid"}, + {0x26,0x03,D|T|L|P|W|R|S|O|M|C|A|E|K,"Threshold parameters not supported"}, + {0x26,0x04,SC_ALL_DEVS,"Invalid release of persistent reservation"}, + {0x26,0x05,D|T|L|P|W|R|S|O|M|C|A|B|K,"Data decryption error"}, + {0x26,0x06,D|T|L|P|W|R|S|O|C|K,"Too many target descriptors"}, + {0x26,0x07,D|T|L|P|W|R|S|O|C|K,"Unsupported target descriptor type code"}, + {0x26,0x08,D|T|L|P|W|R|S|O|C|K,"Too many segment descriptors"}, + {0x26,0x09,D|T|L|P|W|R|S|O|C|K,"Unsupported segment descriptor type code"}, + {0x26,0x0A,D|T|L|P|W|R|S|O|C|K,"Unexpected inexact segment"}, + {0x26,0x0B,D|T|L|P|W|R|S|O|C|K,"Inline data length exceeded"}, + {0x26,0x0C,D|T|L|P|W|R|S|O|C|K, + "Invalid" SC_OPERATION " for copy source or destination"}, + {0x26,0x0D,D|T|L|P|W|R|S|O|C|K,"Copy segment granularity violation"}, + {0x27,0x00,D|T|W|R|O|B|K,"Write protected"}, + {0x27,0x01,D|T|W|R|O|B|K,"Hardware write protected"}, + {0x27,0x02,D|T|W|R|O|B|K,SC_LOGICAL_UNIT "software write protected"}, + {0x27,0x03,T|R,"Associated write protect"}, + {0x27,0x04,T|R,"Persistent write protect"}, + {0x27,0x05,T|R,"Permanent write protect"}, + {0x27,0x06,R,"Conditional write protect"}, + {0x28,0x00,SC_ALL_DEVS,"Not ready to ready change, medium may have changed"}, + {0x28,0x01,D|T|W|R|O|M|B,"Import or export element accessed"}, + {0x29,0x00,SC_ALL_DEVS,"Power on, reset, or bus device reset occurred"}, + {0x29,0x01,SC_ALL_DEVS,"Power on occurred"}, + {0x29,0x02,SC_ALL_DEVS,"Scsi bus reset occurred"}, + {0x29,0x03,SC_ALL_DEVS,"Bus device reset function occurred"}, + {0x29,0x04,SC_ALL_DEVS,"Device internal reset"}, + {0x29,0x05,SC_ALL_DEVS,"Transceiver mode changed to single-ended"}, + {0x29,0x06,SC_ALL_DEVS,"Transceiver mode changed to lvd"}, + {0x29,0x07,SC_ALL_DEVS,"I_T nexus loss occurred"}, + {0x2A,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,"Parameters changed"}, + {0x2A,0x01,D|T|L|W|R|S|O|M|C|A|E|B|K,"Mode parameters changed"}, + {0x2A,0x02,D|T|L|W|R|S|O|M|C|A|E|K,"Log parameters changed"}, + {0x2A,0x03,D|T|L|P|W|R|S|O|M|C|A|E|K,"Reservations preempted"}, + {0x2A,0x04,D|T|L|P|W|R|S|O|M|C|A|E,"Reservations released"}, + {0x2A,0x05,D|T|L|P|W|R|S|O|M|C|A|E,"Registrations preempted"}, + {0x2A,0x06,SC_ALL_DEVS,"Asymmetric access state changed"}, + {0x2A,0x07,SC_ALL_DEVS,"Implicit asymmetric access state transition failed"}, + {0x2B,0x00,D|T|L|P|W|R|S|O|C|K, + "Copy cannot execute since host cannot disconnect"}, + {0x2C,0x00,SC_ALL_DEVS,"Command sequence error"}, + {0x2C,0x01,S,"Too many windows specified"}, + {0x2C,0x02,S,"Invalid combination of windows specified"}, + {0x2C,0x03,R,"Current program area is not empty"}, + {0x2C,0x04,R,"Current program area is empty"}, + {0x2C,0x05,B,"Illegal power condition request"}, + {0x2C,0x06,R,"Persistent prevent conflict"}, + {0x2C,0x07,SC_ALL_DEVS,"Previous busy status"}, + {0x2C,0x08,SC_ALL_DEVS,"Previous task set full status"}, + {0x2C,0x09,D|T|L|P|W|R|S|O|M|E|B|K,"Previous reservation conflict status"}, + {0x2D,0x00,T,"Overwrite error on update in place"}, + {0x2F,0x00,SC_ALL_DEVS,"Commands cleared by another initiator"}, + {0x30,0x00,D|T|W|R|O|M|B|K,"Incompatible medium installed"}, + {0x30,0x01,D|T|W|R|O|B|K,"Cannot read medium - unknown format"}, + {0x30,0x02,D|T|W|R|O|B|K,"Cannot read medium - incompatible format"}, + {0x30,0x03,D|T|R|K,"Cleaning cartridge installed"}, + {0x30,0x04,D|T|W|R|O|B|K,"Cannot write medium - unknown format"}, + {0x30,0x05,D|T|W|R|O|B|K,"Cannot write medium - incompatible format"}, + {0x30,0x06,D|T|W|R|O|B,"Cannot format medium - incompatible medium"}, + {0x30,0x07,D|T|L|W|R|S|O|M|A|E|B|K,"Cleaning failure"}, + {0x30,0x08,R,"Cannot write - application code mismatch"}, + {0x30,0x09,R,"Current session not fixated for append"}, + {0x30,0x10,R,"Medium not formatted"}, /* should ascq be 0xa ?? */ + {0x31,0x00,D|T|W|R|O|B|K,"Medium format corrupted"}, + {0x31,0x01,D|L|R|O|B,"Format command failed"}, + {0x31,0x02,R,"Zoned formatting failed due to spare linking"}, + {0x32,0x00,D|W|O|B|K,"No defect spare location available"}, + {0x32,0x01,D|W|O|B|K,"Defect list update failure"}, + {0x33,0x00,T,"Tape length error"}, + {0x34,0x00,SC_ALL_DEVS,"Enclosure failure"}, + {0x35,0x00,SC_ALL_DEVS,"Enclosure services failure"}, + {0x35,0x01,SC_ALL_DEVS,"Unsupported enclosure function"}, + {0x35,0x02,SC_ALL_DEVS,"Enclosure services unavailable"}, + {0x35,0x03,SC_ALL_DEVS,"Enclosure services transfer failure"}, + {0x35,0x04,SC_ALL_DEVS,"Enclosure services transfer refused"}, + {0x36,0x00,L,"Ribbon,ink,or toner failure"}, + {0x37,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,"Rounded parameter"}, + {0x38,0x00,B,"Event status notification"}, + {0x38,0x02,B,"Esn - power management class event"}, + {0x38,0x04,B,"Esn - media class event"}, + {0x38,0x06,B,"Esn - device busy class event"}, + {0x39,0x00,D|T|L|W|R|S|O|M|C|A|E|K,"Saving parameters not supported"}, + {0x3A,0x00,D|T|L|W|R|S|O|M|B|K,"Medium not present"}, + {0x3A,0x01,D|T|W|R|O|M|B|K,"Medium not present - tray closed"}, + {0x3A,0x02,D|T|W|R|O|M|B|K,"Medium not present - tray open"}, + {0x3A,0x03,D|T|W|R|O|M|B,"Medium not present - loadable"}, + {0x3A,0x04,D|T|W|R|O|M|B, + "Medium not present - medium auxiliary memory accessible"}, + {0x3B,0x00,T|L,"Sequential positioning error"}, + {0x3B,0x01,T,"Tape position error at beginning-of-medium"}, + {0x3B,0x02,T,"Tape position error at end-of-medium"}, + {0x3B,0x03,L,"Tape or electronic vertical forms unit " SC_NOT_READY}, + {0x3B,0x04,L,"Slew failure"}, + {0x3B,0x05,L,"Paper jam"}, + {0x3B,0x06,L,"Failed to sense top-of-form"}, + {0x3B,0x07,L,"Failed to sense bottom-of-form"}, + {0x3B,0x08,T,"Reposition error"}, + {0x3B,0x09,S,"Read past end of medium"}, + {0x3B,0x0A,S,"Read past beginning of medium"}, + {0x3B,0x0B,S,"Position past end of medium"}, + {0x3B,0x0C,T|S,"Position past beginning of medium"}, + {0x3B,0x0D,D|T|W|R|O|M|B|K,"Medium destination element full"}, + {0x3B,0x0E,D|T|W|R|O|M|B|K,"Medium source element empty"}, + {0x3B,0x0F,R,"End of medium reached"}, + {0x3B,0x11,D|T|W|R|O|M|B|K,"Medium magazine not accessible"}, + {0x3B,0x12,D|T|W|R|O|M|B|K,"Medium magazine removed"}, + {0x3B,0x13,D|T|W|R|O|M|B|K,"Medium magazine inserted"}, + {0x3B,0x14,D|T|W|R|O|M|B|K,"Medium magazine locked"}, + {0x3B,0x15,D|T|W|R|O|M|B|K,"Medium magazine unlocked"}, + {0x3B,0x16,R,"Mechanical positioning or changer error"}, + {0x3D,0x00,D|T|L|P|W|R|S|O|M|C|A|E|K,"Invalid bits in identify message"}, + {0x3E,0x00,SC_ALL_DEVS,SC_LOGICAL_UNIT "has not self-configured yet"}, + {0x3E,0x01,SC_ALL_DEVS,SC_LOGICAL_UNIT "failure"}, + {0x3E,0x02,SC_ALL_DEVS,"Timeout on logical unit"}, + {0x3E,0x03,SC_ALL_DEVS,SC_LOGICAL_UNIT "failed self-test"}, + {0x3E,0x04,SC_ALL_DEVS,SC_LOGICAL_UNIT "unable to update self-test log"}, + {0x3F,0x00,SC_ALL_DEVS,"Target operating conditions have changed"}, + {0x3F,0x01,SC_ALL_DEVS,"Microcode has been changed"}, + {0x3F,0x02,D|T|L|P|W|R|S|O|M|C|B|K,"Changed operating definition"}, + {0x3F,0x03,SC_ALL_DEVS,"Inquiry data has changed"}, + {0x3F,0x04,D|T|W|R|O|M|C|A|E|B|K,"Component device attached"}, + {0x3F,0x05,D|T|W|R|O|M|C|A|E|B|K,"Device identifier changed"}, + {0x3F,0x06,D|T|W|R|O|M|C|A|E|B,"Redundancy group created or modified"}, + {0x3F,0x07,D|T|W|R|O|M|C|A|E|B,"Redundancy group deleted"}, + {0x3F,0x08,D|T|W|R|O|M|C|A|E|B,"Spare created or modified"}, + {0x3F,0x09,D|T|W|R|O|M|C|A|E|B,"Spare deleted"}, + {0x3F,0x0A,D|T|W|R|O|M|C|A|E|B|K,"Volume set created or modified"}, + {0x3F,0x0B,D|T|W|R|O|M|C|A|E|B|K,"Volume set deleted"}, + {0x3F,0x0C,D|T|W|R|O|M|C|A|E|B|K,"Volume set deassigned"}, + {0x3F,0x0D,D|T|W|R|O|M|C|A|E|B|K,"Volume set reassigned"}, + {0x3F,0x0E,D|T|L|P|W|R|S|O|M|C|A|E,"Reported luns data has changed"}, + {0x3F,0x10,D|T|W|R|O|M|B,"Medium loadable"}, + {0x3F,0x11,D|T|W|R|O|M|B,"Medium auxiliary memory accessible"}, + {0x40,0x00,D,"Ram failure (should use 40 nn)"}, + /* + * FIXME(eric) - need a way to represent wildcards here. + */ + {0x40,0x00,SC_ALL_DEVS,"Diagnostic failure on component nn (80h-ffh)"}, + {0x41,0x00,D,"Data path failure (should use 40 nn)"}, + {0x42,0x00,D,"Power-on or self-test failure (should use 40 nn)"}, + {0x43,0x00,SC_ALL_DEVS,"Message error"}, + {0x44,0x00,SC_ALL_DEVS,"Internal target failure"}, + {0x45,0x00,SC_ALL_DEVS,"Select or reselect failure"}, + {0x46,0x00,D|T|L|P|W|R|S|O|M|C|B|K,"Unsuccessful soft reset"}, + {0x47,0x00,SC_ALL_DEVS,"Scsi parity error"}, + {0x47,0x01,SC_ALL_DEVS,"Data phase CRC error detected"}, + {0x47,0x02,SC_ALL_DEVS,"Scsi parity error detected during st data phase"}, + {0x47,0x03,SC_ALL_DEVS,"Information unit CRC error detected"}, + {0x47,0x04,SC_ALL_DEVS,"Asynchronous information protection error detected"}, + {0x47,0x05,SC_ALL_DEVS,"Protocol service CRC error"}, + {0x48,0x00,SC_ALL_DEVS,"Initiator detected error message received"}, + {0x49,0x00,SC_ALL_DEVS,"Invalid message error"}, + {0x4A,0x00,SC_ALL_DEVS,"Command phase error"}, + {0x4B,0x00,SC_ALL_DEVS,"Data phase error"}, + {0x4C,0x00,SC_ALL_DEVS,SC_LOGICAL_UNIT "failed self-configuration"}, + /* + * FIXME(eric) - need a way to represent wildcards here. + */ + {0x4D,0x00,SC_ALL_DEVS,"Tagged overlapped commands (nn = queue tag)"}, + {0x4E,0x00,SC_ALL_DEVS,"Overlapped commands attempted"}, + {0x50,0x00,T,"Write append error"}, + {0x50,0x01,T,"Write append position error"}, + {0x50,0x02,T,"Position error related to timing"}, + {0x51,0x00,T|R|O,"Erase failure"}, + {0x52,0x00,T,"Cartridge fault"}, + {0x53,0x00,D|T|L|W|R|S|O|M|B|K,"Media load or eject failed"}, + {0x53,0x01,T,"Unload tape failure"}, + {0x53,0x02,D|T|W|R|O|M|B|K,"Medium removal prevented"}, + {0x54,0x00,P,"Scsi to host system interface failure"}, + {0x55,0x00,P,"System resource failure"}, + {0x55,0x01,D|O|B|K,"System buffer full"}, + {0x55,0x02,D|T|L|P|W|R|S|O|M|A|E|K,"Insufficient reservation resources"}, + {0x55,0x03,D|T|L|P|W|R|S|O|M|C|A|E,"Insufficient resources"}, + {0x55,0x04,D|T|L|P|W|R|S|O|M|A|E,"Insufficient registration resources"}, + {0x55,0x05,D|T|P|W|R|O|M|A|E|B|K,"Insufficient access control resources"}, + {0x55,0x06,D|T|W|R|O|M|B,"Auxiliary memory out of space"}, + {0x57,0x00,R,"Unable to recover table-of-contents"}, + {0x58,0x00,O,"Generation does not exist"}, + {0x59,0x00,O,"Updated block read"}, + {0x5A,0x00,D|T|L|P|W|R|S|O|M|B|K,"Operator request or state change input"}, + {0x5A,0x01,D|T|W|R|O|M|B|K,"Operator medium removal request"}, + {0x5A,0x02,D|T|W|R|O|A|B|K,"Operator selected write protect"}, + {0x5A,0x03,D|T|W|R|O|A|B|K,"Operator selected write permit"}, + {0x5B,0x00,D|T|L|P|W|R|S|O|M|K,"Log exception"}, + {0x5B,0x01,D|T|L|P|W|R|S|O|M|K,"Threshold condition met"}, + {0x5B,0x02,D|T|L|P|W|R|S|O|M|K,"Log counter at maximum"}, + {0x5B,0x03,D|T|L|P|W|R|S|O|M|K,"Log list codes exhausted"}, + {0x5C,0x00,D|O,"Rpl status change"}, + {0x5C,0x01,D|O,"Spindles synchronized"}, + {0x5C,0x02,D|O,"Spindles not synchronized"}, + {0x5D,0x00,SC_ALL_DEVS,"Failure prediction threshold exceeded"}, + {0x5D,0x01,R|B,"Media failure prediction threshold exceeded"}, + {0x5D,0x02,R,SC_LOGICAL_UNIT "failure prediction threshold exceeded"}, + {0x5D,0x03,R,"spare area exhaustion prediction threshold exceeded"}, + /* large series of "impending failure" messages */ + {0x5D,0x10,D|B,SC_HARDWARE_IF "general hard drive failure"}, + {0x5D,0x11,D|B,SC_HARDWARE_IF "drive" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x12,D|B,SC_HARDWARE_IF "data" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x13,D|B,SC_HARDWARE_IF "seek" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x14,D|B,SC_HARDWARE_IF "too many block reassigns"}, + {0x5D,0x15,D|B,SC_HARDWARE_IF "access" SC_TIMES_TOO_HIGH }, + {0x5D,0x16,D|B,SC_HARDWARE_IF "start unit" SC_TIMES_TOO_HIGH }, + {0x5D,0x17,D|B,SC_HARDWARE_IF "channel parametrics"}, + {0x5D,0x18,D|B,SC_HARDWARE_IF "controller detected"}, + {0x5D,0x19,D|B,SC_HARDWARE_IF "throughput performance"}, + {0x5D,0x1A,D|B,SC_HARDWARE_IF "seek time performance"}, + {0x5D,0x1B,D|B,SC_HARDWARE_IF "spin-up retry count"}, + {0x5D,0x1C,D|B,SC_HARDWARE_IF "drive calibration retry count"}, + {0x5D,0x20,D|B,SC_CONTROLLER_IF "general hard drive failure"}, + {0x5D,0x21,D|B,SC_CONTROLLER_IF "drive" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x22,D|B,SC_CONTROLLER_IF "data" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x23,D|B,SC_CONTROLLER_IF "seek" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x24,D|B,SC_CONTROLLER_IF "too many block reassigns"}, + {0x5D,0x25,D|B,SC_CONTROLLER_IF "access" SC_TIMES_TOO_HIGH }, + {0x5D,0x26,D|B,SC_CONTROLLER_IF "start unit" SC_TIMES_TOO_HIGH }, + {0x5D,0x27,D|B,SC_CONTROLLER_IF "channel parametrics"}, + {0x5D,0x28,D|B,SC_CONTROLLER_IF "controller detected"}, + {0x5D,0x29,D|B,SC_CONTROLLER_IF "throughput performance"}, + {0x5D,0x2A,D|B,SC_CONTROLLER_IF "seek time performance"}, + {0x5D,0x2B,D|B,SC_CONTROLLER_IF "spin-up retry count"}, + {0x5D,0x2C,D|B,SC_CONTROLLER_IF "drive calibration retry count"}, + {0x5D,0x30,D|B,SC_DATA_CHANNEL_IF "general hard drive failure"}, + {0x5D,0x31,D|B,SC_DATA_CHANNEL_IF "drive" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x32,D|B,SC_DATA_CHANNEL_IF "data" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x33,D|B,SC_DATA_CHANNEL_IF "seek" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x34,D|B,SC_DATA_CHANNEL_IF "too many block reassigns"}, + {0x5D,0x35,D|B,SC_DATA_CHANNEL_IF "access" SC_TIMES_TOO_HIGH }, + {0x5D,0x36,D|B,SC_DATA_CHANNEL_IF "start unit" SC_TIMES_TOO_HIGH }, + {0x5D,0x37,D|B,SC_DATA_CHANNEL_IF "channel parametrics"}, + {0x5D,0x38,D|B,SC_DATA_CHANNEL_IF "controller detected"}, + {0x5D,0x39,D|B,SC_DATA_CHANNEL_IF "throughput performance"}, + {0x5D,0x3A,D|B,SC_DATA_CHANNEL_IF "seek time performance"}, + {0x5D,0x3B,D|B,SC_DATA_CHANNEL_IF "spin-up retry count"}, + {0x5D,0x3C,D|B,SC_DATA_CHANNEL_IF "drive calibration retry count"}, + {0x5D,0x40,D|B,SC_SERVO_IF "general hard drive failure"}, + {0x5D,0x41,D|B,SC_SERVO_IF "drive" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x42,D|B,SC_SERVO_IF "data" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x43,D|B,SC_SERVO_IF "seek" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x44,D|B,SC_SERVO_IF "too many block reassigns"}, + {0x5D,0x45,D|B,SC_SERVO_IF "access" SC_TIMES_TOO_HIGH }, + {0x5D,0x46,D|B,SC_SERVO_IF "start unit" SC_TIMES_TOO_HIGH }, + {0x5D,0x47,D|B,SC_SERVO_IF "channel parametrics"}, + {0x5D,0x48,D|B,SC_SERVO_IF "controller detected"}, + {0x5D,0x49,D|B,SC_SERVO_IF "throughput performance"}, + {0x5D,0x4A,D|B,SC_SERVO_IF "seek time performance"}, + {0x5D,0x4B,D|B,SC_SERVO_IF "spin-up retry count"}, + {0x5D,0x4C,D|B,SC_SERVO_IF "drive calibration retry count"}, + {0x5D,0x50,D|B,SC_SPINDLE_IF "general hard drive failure"}, + {0x5D,0x51,D|B,SC_SPINDLE_IF "drive" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x52,D|B,SC_SPINDLE_IF "data" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x53,D|B,SC_SPINDLE_IF "seek" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x54,D|B,SC_SPINDLE_IF "too many block reassigns"}, + {0x5D,0x55,D|B,SC_SPINDLE_IF "access" SC_TIMES_TOO_HIGH }, + {0x5D,0x56,D|B,SC_SPINDLE_IF "start unit" SC_TIMES_TOO_HIGH }, + {0x5D,0x57,D|B,SC_SPINDLE_IF "channel parametrics"}, + {0x5D,0x58,D|B,SC_SPINDLE_IF "controller detected"}, + {0x5D,0x59,D|B,SC_SPINDLE_IF "throughput performance"}, + {0x5D,0x5A,D|B,SC_SPINDLE_IF "seek time performance"}, + {0x5D,0x5B,D|B,SC_SPINDLE_IF "spin-up retry count"}, + {0x5D,0x5C,D|B,SC_SPINDLE_IF "drive calibration retry count"}, + {0x5D,0x60,D|B,SC_FIRMWARE_IF "general hard drive failure"}, + {0x5D,0x61,D|B,SC_FIRMWARE_IF "drive" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x62,D|B,SC_FIRMWARE_IF "data" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x63,D|B,SC_FIRMWARE_IF "seek" SC_ERROR_RATE_TOO_HIGH }, + {0x5D,0x64,D|B,SC_FIRMWARE_IF "too many block reassigns"}, + {0x5D,0x65,D|B,SC_FIRMWARE_IF "access" SC_TIMES_TOO_HIGH }, + {0x5D,0x66,D|B,SC_FIRMWARE_IF "start unit" SC_TIMES_TOO_HIGH }, + {0x5D,0x67,D|B,SC_FIRMWARE_IF "channel parametrics"}, + {0x5D,0x68,D|B,SC_FIRMWARE_IF "controller detected"}, + {0x5D,0x69,D|B,SC_FIRMWARE_IF "throughput performance"}, + {0x5D,0x6A,D|B,SC_FIRMWARE_IF "seek time performance"}, + {0x5D,0x6B,D|B,SC_FIRMWARE_IF "spin-up retry count"}, + {0x5D,0x6C,D|B,SC_FIRMWARE_IF "drive calibration retry count"}, + {0x5D,0xFF,SC_ALL_DEVS,"Failure prediction threshold exceeded (false)"}, + {0x5E,0x00,D|T|L|P|W|R|S|O|C|A|K,"Low power condition on"}, + {0x5E,0x01,D|T|L|P|W|R|S|O|C|A|K,"Idle condition activated by timer"}, + {0x5E,0x02,D|T|L|P|W|R|S|O|C|A|K,"Standby condition activated by timer"}, + {0x5E,0x03,D|T|L|P|W|R|S|O|C|A|K,"Idle condition activated by command"}, + {0x5E,0x04,D|T|L|P|W|R|S|O|C|A|K,"Standby condition activated by command"}, + {0x5E,0x41,B,"Power state change to active"}, + {0x5E,0x42,B,"Power state change to idle"}, + {0x5E,0x43,B,"Power state change to standby"}, + {0x5E,0x45,B,"Power state change to sleep"}, + {0x5E,0x47,B|K,"Power state change to device control"}, + {0x60,0x00,S,"Lamp failure"}, + {0x61,0x00,S,"Video acquisition error"}, + {0x61,0x01,S,"Unable to acquire video"}, + {0x61,0x02,S,"Out of focus"}, + {0x62,0x00,S,"Scan head positioning error"}, + {0x63,0x00,R,"End of user area encountered on this track"}, + {0x63,0x01,R,"Packet does not fit in available space"}, + {0x64,0x00,R,"Illegal mode for this track"}, + {0x64,0x01,R,"Invalid packet size"}, + {0x65,0x00,SC_ALL_DEVS,"Voltage fault"}, + {0x66,0x00,S,"Automatic document feeder cover up"}, + {0x66,0x01,S,"Automatic document feeder lift up"}, + {0x66,0x02,S,"Document jam in automatic document feeder"}, + {0x66,0x03,S,"Document miss feed automatic in document feeder"}, + {0x67,0x00,A,"Configuration failure"}, + {0x67,0x01,A,"Configuration of incapable logical units failed"}, + {0x67,0x02,A,"Add logical unit failed"}, + {0x67,0x03,A,"Modification of logical unit failed"}, + {0x67,0x04,A,"Exchange of logical unit failed"}, + {0x67,0x05,A,"Remove of logical unit failed"}, + {0x67,0x06,A,"Attachment of logical unit failed"}, + {0x67,0x07,A,"Creation of logical unit failed"}, + {0x67,0x08,A,"Assign failure occurred"}, + {0x67,0x09,A,"Multiply assigned logical unit"}, + {0x67,0x0A,SC_ALL_DEVS,"Set target port groups command failed"}, + {0x68,0x00,A,SC_LOGICAL_UNIT "not configured"}, + {0x69,0x00,A,"Data loss on logical unit"}, + {0x69,0x01,A,"Multiple logical unit failures"}, + {0x69,0x02,A,"Parity/data mismatch"}, + {0x6A,0x00,A,"Informational,refer to log"}, + {0x6B,0x00,A,"State change has occurred"}, + {0x6B,0x01,A,"Redundancy level got better"}, + {0x6B,0x02,A,"Redundancy level got worse"}, + {0x6C,0x00,A,"Rebuild failure occurred"}, + {0x6D,0x00,A,"Recalculate failure occurred"}, + {0x6E,0x00,A,"Command to logical unit failed"}, + {0x6F,0x00,R,"Copy protection key exchange failure - authentication failure"}, + {0x6F,0x01,R,"Copy protection key exchange failure - key not present"}, + {0x6F,0x02,R,"Copy protection key exchange failure - key not established"}, + {0x6F,0x03,R,"Read of scrambled sector without authentication"}, + {0x6F,0x04,R,"Media region code is mismatched to logical unit region"}, + {0x6F,0x05,R,"Drive region must be permanent/region reset count error"}, + /* + * FIXME(eric) - need a way to represent wildcards here. + */ + {0x70,0x00,T,"Decompression exception short algorithm id of nn"}, + {0x71,0x00,T,"Decompression exception long algorithm id"}, + {0x72,0x00,R,"Session fixation error"}, + {0x72,0x01,R,"Session fixation error writing lead-in"}, + {0x72,0x02,R,"Session fixation error writing lead-out"}, + {0x72,0x03,R,"Session fixation error - incomplete track in session"}, + {0x72,0x04,R,"Empty or partially written reserved track"}, + {0x72,0x05,R,"No more track reservations allowed"}, + {0x73,0x00,R,"Cd control error"}, + {0x73,0x01,R,"Power calibration area almost full"}, + {0x73,0x02,R,"Power calibration area is full"}, + {0x73,0x03,R,"Power calibration area error"}, + {0x73,0x04,R,"Program memory area update failure"}, + {0x73,0x05,R,"Program memory area is full"}, + {0x73,0x06,R,"RMA/PMA is full"}, + {0, 0, 0, NULL} +}; + +static const char * sc_oft_used[0x1f] = { + "umulig", /* index 0x0 should be impossible */ + "Audio play operation ", + "Logical unit ", + "not ready, ", + " operation", + " in progress ", + "Hardware impending failure ", + "Controller impending failure ", + "Data channel impending failure ", /* index 0x8 */ + "Servo impending failure ", + "Spindle impending failure ", + "Firmware impending failure ", + "Recovered data ", + " error rate too high", + " times too high", +}; + +static const char *snstext[] = { + "No Sense", /* There is no sense information */ + "Recovered Error", /* The last command completed successfully + but used error correction */ + "Not Ready", /* The addressed target is not ready */ + "Medium Error", /* Data error detected on the medium */ + "Hardware Error", /* Controller or device failure */ + "Illegal Request", + "Unit Attention", /* Removable medium was changed, or + the target has been reset */ + "Data Protect", /* Access to the data is blocked */ + "Blank Check", /* Reached unexpected written or unwritten + region of the medium */ + "Key=9", /* Vendor specific */ + "Copy Aborted", /* COPY or COMPARE was aborted */ + "Aborted Command", /* The target aborted the command */ + "Equal", /* SEARCH DATA found data equal (obsolete) */ + "Volume Overflow", /* Medium full with still data to be written */ + "Miscompare", /* Source data and data on the medium + do not agree */ + "Key=15" /* Reserved */ +}; + +static +void sg_print_asc_ascq(unsigned char asc, unsigned char ascq) +{ + int k, j; + char obuff[256]; + const char * ccp; + const char * oup; + char c; + int found = 0; + + for (k=0; additional[k].text; k++) { + if (additional[k].code1 == asc && + additional[k].code2 == ascq) { + found = 1; + ccp = additional[k].text; + for (j = 0; *ccp && (j < sizeof(obuff)); ++ccp) { + c = *ccp; + if ((c < 0x20) && (c > 0)) { + oup = sc_oft_used[(int)c]; + if (oup) { + strcpy(obuff + j, oup); + j += strlen(oup); + } + else { + strcpy(obuff + j, "???"); + j += 3; + } + } + else + obuff[j++] = c; + } + if (j < sizeof(obuff)) + obuff[j] = '\0'; + else + obuff[sizeof(obuff) - 1] = '\0'; + fprintf(OUTP, "Additional sense: %s\n", obuff); + } + } + if (found) + return; + + for(k=0; additional2[k].text; k++) { + if ((additional2[k].code1 == asc) && + (ascq >= additional2[k].code2_min) && + (ascq <= additional2[k].code2_max)) { + found = 1; + fprintf(OUTP, "Additional sense: "); + fprintf(OUTP, additional2[k].text, ascq); + fprintf(OUTP, "\n"); + } + } + if (! found) + fprintf(OUTP, "ASC=%2x ASCQ=%2x\n", asc, ascq); +} + +/* Print sense information */ +void sg_print_sense(const char * leadin, const unsigned char * sense_buffer, + int sb_len) +{ + int k, s; + int sense_key, sense_class, valid, code; + int descriptor_format = 0; + const char * error = NULL; + + if (sb_len < 1) { + fprintf(OUTP, "sense buffer empty\n"); + return; + } + sense_class = (sense_buffer[0] >> 4) & 0x07; + code = sense_buffer[0] & 0xf; + valid = sense_buffer[0] & 0x80; + if (leadin) + fprintf(OUTP, "%s: ", leadin); + + if (sense_class == 7) { /* extended sense data */ + s = sense_buffer[7] + 8; + if(s > sb_len) /* device has more available which we ignore */ + s = sb_len; + + switch (code) { + case 0x0: + error = "Current"; /* error concerns current command */ + break; + case 0x1: + error = "Deferred"; /* error concerns some earlier command */ + /* e.g., an earlier write to disk cache succeeded, but + now the disk discovers that it cannot write the data */ + break; + case 0x2: + descriptor_format = 1; + error = "Descriptor current"; + /* new descriptor sense format */ + break; + case 0x3: + descriptor_format = 1; + error = "Descriptor deferred"; + /* new descriptor sense format (deferred report) */ + break; + default: + error = "Invalid"; + } + sense_key = sense_buffer[ descriptor_format ? 1 : 2 ] & 0xf; + fprintf(OUTP, "%s, Sense key: %s\n", error, snstext[sense_key]); + + if (descriptor_format) + sg_print_asc_ascq(sense_buffer[2], sense_buffer[3]); + else { + if (!valid) + fprintf(OUTP, "[valid=0] "); + fprintf(OUTP, "Info fld=0x%x, ", (int)((sense_buffer[3] << 24) | + (sense_buffer[4] << 16) | (sense_buffer[5] << 8) | + sense_buffer[6])); + + if (sense_buffer[2] & 0x80) + fprintf(OUTP, "FMK "); /* current command has read a filemark */ + if (sense_buffer[2] & 0x40) + fprintf(OUTP, "EOM "); /* end-of-medium condition exists */ + if (sense_buffer[2] & 0x20) + fprintf(OUTP, "ILI "); /* incorrect block length requested */ + + if (s > 13) { + if (sense_buffer[12] || sense_buffer[13]) + sg_print_asc_ascq(sense_buffer[12], sense_buffer[13]); + } + if (sense_key == 5 && s >= 18 && (sense_buffer[15]&0x80)) { + fprintf(OUTP, "Sense Key Specific: Error in %s byte %d", + (sense_buffer[15]&0x40)?"Command":"Data", + (sense_buffer[16]<<8)|sense_buffer[17]); + if(sense_buffer[15]&0x08) { + fprintf(OUTP, " bit %d\n", sense_buffer[15]&0x07); + } else { + fprintf(OUTP, "\n"); + } + } + } + + } else { /* non-extended sense data */ + + /* + * Standard says: + * sense_buffer[0] & 0200 : address valid + * sense_buffer[0] & 0177 : vendor-specific error code + * sense_buffer[1] & 0340 : vendor-specific + * sense_buffer[1..3] : 21-bit logical block address + */ + + if (sb_len < 4) { + fprintf(OUTP, "sense buffer too short (4 byte minimum)\n"); + return; + } + if (leadin) + fprintf(OUTP, "%s: ", leadin); + if (sense_buffer[0] < 15) + fprintf(OUTP, + "old sense: key %s\n", snstext[sense_buffer[0] & 0x0f]); + else + fprintf(OUTP, "sns = %2x %2x\n", sense_buffer[0], sense_buffer[2]); + + fprintf(OUTP, "Non-extended sense class %d code 0x%0x ", + sense_class, code); + s = 4; + } + + fprintf(OUTP, "Raw sense data (in hex):\n "); + for (k = 0; k < s; ++k) { + if ((k > 0) && (0 == (k % 24))) + fprintf(OUTP, "\n "); + fprintf(OUTP, "%02x ", sense_buffer[k]); + } + fprintf(OUTP, "\n"); +} + +static const char * hostbyte_table[]={ +"DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET", +"DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", +"DID_PASSTHROUGH", "DID_SOFT_ERROR", NULL}; + +void sg_print_host_status(int host_status) +{ static int maxcode=0; + int i; + + if(! maxcode) { + for(i = 0; hostbyte_table[i]; i++) ; + maxcode = i-1; + } + fprintf(OUTP, "Host_status=0x%02x", host_status); + if(host_status > maxcode) { + fprintf(OUTP, "is invalid "); + return; + } + fprintf(OUTP, "(%s) ",hostbyte_table[host_status]); +} + +static const char * driverbyte_table[]={ +"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", +"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE", NULL}; + +static const char * driversuggest_table[]={"SUGGEST_OK", +"SUGGEST_RETRY", "SUGGEST_ABORT", "SUGGEST_REMAP", "SUGGEST_DIE", +unknown,unknown,unknown, "SUGGEST_SENSE",NULL}; + + +void sg_print_driver_status(int driver_status) +{ + static int driver_max =0 , suggest_max=0; + int i; + int dr = driver_status & SG_ERR_DRIVER_MASK; + int su = (driver_status & SG_ERR_SUGGEST_MASK) >> 4; + + if(! driver_max) { + for(i = 0; driverbyte_table[i]; i++) ; + driver_max = i; + for(i = 0; driversuggest_table[i]; i++) ; + suggest_max = i; + } + fprintf(OUTP, "Driver_status=0x%02x",driver_status); + fprintf(OUTP, " (%s,%s) ", + dr < driver_max ? driverbyte_table[dr]:"invalid", + su < suggest_max ? driversuggest_table[su]:"invalid"); +} + +static int sg_sense_print(const char * leadin, int scsi_status, + int host_status, int driver_status, + const unsigned char * sense_buffer, int sb_len) +{ + int done_leadin = 0; + int done_sense = 0; + + scsi_status &= 0x7e; /*sanity */ + if ((0 == scsi_status) && (0 == host_status) && + (0 == driver_status)) + return 1; /* No problems */ + if (0 != scsi_status) { + if (leadin) + fprintf(OUTP, "%s: ", leadin); + done_leadin = 1; + fprintf(OUTP, "scsi status: "); + sg_print_scsi_status(scsi_status); + fprintf(OUTP, "\n"); + if (sense_buffer && ((scsi_status == SCSI_CHECK_CONDITION) || + (scsi_status == SCSI_COMMAND_TERMINATED))) { + sg_print_sense(0, sense_buffer, sb_len); + done_sense = 1; + } + } + if (0 != host_status) { + if (leadin && (! done_leadin)) + fprintf(OUTP, "%s: ", leadin); + if (done_leadin) + fprintf(OUTP, "plus...: "); + else + done_leadin = 1; + sg_print_host_status(host_status); + fprintf(OUTP, "\n"); + } + if (0 != driver_status) { + if (leadin && (! done_leadin)) + fprintf(OUTP, "%s: ", leadin); + if (done_leadin) + fprintf(OUTP, "plus...: "); + else + done_leadin = 1; + sg_print_driver_status(driver_status); + fprintf(OUTP, "\n"); + if (sense_buffer && (! done_sense) && + (SG_ERR_DRIVER_SENSE == (0xf & driver_status))) + sg_print_sense(0, sense_buffer, sb_len); + } + return 0; +} + +#ifdef SG_IO +int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp) +{ + return sg_sense_print(leadin, hp->status, hp->host_status, + hp->driver_status, hp->sbp, hp->sb_len_wr); +} +#endif + +int sg_chk_n_print(const char * leadin, int masked_status, + int host_status, int driver_status, + const unsigned char * sense_buffer, int sb_len) +{ + int scsi_status = (masked_status << 1) & 0x7e; + + return sg_sense_print(leadin, scsi_status, host_status, driver_status, + sense_buffer, sb_len); +} + +#ifdef SG_IO +int sg_err_category3(struct sg_io_hdr * hp) +{ + return sg_err_category_new(hp->status, hp->host_status, + hp->driver_status, hp->sbp, hp->sb_len_wr); +} +#endif + +int sg_err_category(int masked_status, int host_status, + int driver_status, const unsigned char * sense_buffer, + int sb_len) +{ + int scsi_status = (masked_status << 1) & 0x7e; + + return sg_err_category_new(scsi_status, host_status, driver_status, + sense_buffer, sb_len); +} + +int sg_err_category_new(int scsi_status, int host_status, int driver_status, + const unsigned char * sense_buffer, int sb_len) +{ + scsi_status &= 0x7e; + if ((0 == scsi_status) && (0 == host_status) && + (0 == driver_status)) + return SG_ERR_CAT_CLEAN; + if ((SCSI_CHECK_CONDITION == scsi_status) || + (SCSI_COMMAND_TERMINATED == scsi_status) || + (SG_ERR_DRIVER_SENSE == (0xf & driver_status))) { + if (sense_buffer && (sb_len > 2)) { + int sense_key; + unsigned char asc; + + if (sense_buffer[0] & 0x2) { + sense_key = sense_buffer[1] & 0xf; + asc = sense_buffer[2]; + } + else { + sense_key = sense_buffer[2] & 0xf; + asc = (sb_len > 12) ? sense_buffer[12] : 0; + } + + if(RECOVERED_ERROR == sense_key) + return SG_ERR_CAT_RECOVERED; + else if (UNIT_ATTENTION == sense_key) { + if (0x28 == asc) + return SG_ERR_CAT_MEDIA_CHANGED; + if (0x29 == asc) + return SG_ERR_CAT_RESET; + } + } + return SG_ERR_CAT_SENSE; + } + if (0 != host_status) { + if ((SG_ERR_DID_NO_CONNECT == host_status) || + (SG_ERR_DID_BUS_BUSY == host_status) || + (SG_ERR_DID_TIME_OUT == host_status)) + return SG_ERR_CAT_TIMEOUT; + } + if (0 != driver_status) { + if (SG_ERR_DRIVER_TIMEOUT == driver_status) + return SG_ERR_CAT_TIMEOUT; + } + return SG_ERR_CAT_OTHER; +} + +int sg_get_command_size(unsigned char opcode) +{ + return COMMAND_SIZE(opcode); +} + +void sg_get_command_name(unsigned char opcode, int buff_len, char * buff) +{ + const char **table = commands[ group(opcode) ]; + + if ((NULL == buff) || (buff_len < 1)) + return; + + switch ((unsigned long) table) { + case RESERVED_GROUP: + strncpy(buff, reserved, buff_len); + break; + case VENDOR_GROUP: + strncpy(buff, vendor, buff_len); + break; + default: + strncpy(buff, table[opcode & 0x1f], buff_len); + break; + } +} diff --git a/extras/multipath/sg_err.h b/extras/multipath/sg_err.h new file mode 100644 index 0000000000..ef57b5ce38 --- /dev/null +++ b/extras/multipath/sg_err.h @@ -0,0 +1,162 @@ +#ifndef SG_ERR_H +#define SG_ERR_H + +/* Feel free to copy and modify this GPL-ed code into your applications. */ + +/* Version 0.90 (20030519) +*/ + + +/* Some of the following error/status codes are exchanged between the + various layers of the SCSI sub-system in Linux and should never + reach the user. They are placed here for completeness. What appears + here is copied from drivers/scsi/scsi.h which is not visible in + the user space. */ + +#ifndef SCSI_CHECK_CONDITION +/* Following are the "true" SCSI status codes. Linux has traditionally + used a 1 bit right and masked version of these. So now CHECK_CONDITION + and friends (in ) are deprecated. */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_CONDITION_MET 0x4 +#define SCSI_BUSY 0x8 +#define SCSI_IMMEDIATE 0x10 +#define SCSI_IMMEDIATE_CONDITION_MET 0x14 +#define SCSI_RESERVATION_CONFLICT 0x18 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SCSI_TASK_SET_FULL 0x28 +#define SCSI_ACA_ACTIVE 0x30 +#define SCSI_TASK_ABORTED 0x40 +#endif + +/* The following are 'host_status' codes */ +#ifndef DID_OK +#define DID_OK 0x00 +#endif +#ifndef DID_NO_CONNECT +#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ +#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ +#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ +#define DID_BAD_TARGET 0x04 /* Bad target (id?) */ +#define DID_ABORT 0x05 /* Told to abort for some other reason */ +#define DID_PARITY 0x06 /* Parity error (on SCSI bus) */ +#define DID_ERROR 0x07 /* Internal error */ +#define DID_RESET 0x08 /* Reset by somebody */ +#define DID_BAD_INTR 0x09 /* Received an unexpected interrupt */ +#define DID_PASSTHROUGH 0x0a /* Force command past mid-level */ +#define DID_SOFT_ERROR 0x0b /* The low-level driver wants a retry */ +#endif + +/* These defines are to isolate applictaions from kernel define changes */ +#define SG_ERR_DID_OK DID_OK +#define SG_ERR_DID_NO_CONNECT DID_NO_CONNECT +#define SG_ERR_DID_BUS_BUSY DID_BUS_BUSY +#define SG_ERR_DID_TIME_OUT DID_TIME_OUT +#define SG_ERR_DID_BAD_TARGET DID_BAD_TARGET +#define SG_ERR_DID_ABORT DID_ABORT +#define SG_ERR_DID_PARITY DID_PARITY +#define SG_ERR_DID_ERROR DID_ERROR +#define SG_ERR_DID_RESET DID_RESET +#define SG_ERR_DID_BAD_INTR DID_BAD_INTR +#define SG_ERR_DID_PASSTHROUGH DID_PASSTHROUGH +#define SG_ERR_DID_SOFT_ERROR DID_SOFT_ERROR + +/* The following are 'driver_status' codes */ +#ifndef DRIVER_OK +#define DRIVER_OK 0x00 +#endif +#ifndef DRIVER_BUSY +#define DRIVER_BUSY 0x01 +#define DRIVER_SOFT 0x02 +#define DRIVER_MEDIA 0x03 +#define DRIVER_ERROR 0x04 +#define DRIVER_INVALID 0x05 +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_HARD 0x07 +#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ + +/* Following "suggests" are "or-ed" with one of previous 8 entries */ +#define SUGGEST_RETRY 0x10 +#define SUGGEST_ABORT 0x20 +#define SUGGEST_REMAP 0x30 +#define SUGGEST_DIE 0x40 +#define SUGGEST_SENSE 0x80 +#define SUGGEST_IS_OK 0xff +#endif +#ifndef DRIVER_MASK +#define DRIVER_MASK 0x0f +#endif +#ifndef SUGGEST_MASK +#define SUGGEST_MASK 0xf0 +#endif + +/* These defines are to isolate applictaions from kernel define changes */ +#define SG_ERR_DRIVER_OK DRIVER_OK +#define SG_ERR_DRIVER_BUSY DRIVER_BUSY +#define SG_ERR_DRIVER_SOFT DRIVER_SOFT +#define SG_ERR_DRIVER_MEDIA DRIVER_MEDIA +#define SG_ERR_DRIVER_ERROR DRIVER_ERROR +#define SG_ERR_DRIVER_INVALID DRIVER_INVALID +#define SG_ERR_DRIVER_TIMEOUT DRIVER_TIMEOUT +#define SG_ERR_DRIVER_HARD DRIVER_HARD +#define SG_ERR_DRIVER_SENSE DRIVER_SENSE +#define SG_ERR_SUGGEST_RETRY SUGGEST_RETRY +#define SG_ERR_SUGGEST_ABORT SUGGEST_ABORT +#define SG_ERR_SUGGEST_REMAP SUGGEST_REMAP +#define SG_ERR_SUGGEST_DIE SUGGEST_DIE +#define SG_ERR_SUGGEST_SENSE SUGGEST_SENSE +#define SG_ERR_SUGGEST_IS_OK SUGGEST_IS_OK +#define SG_ERR_DRIVER_MASK DRIVER_MASK +#define SG_ERR_SUGGEST_MASK SUGGEST_MASK + + + +/* The following "print" functions send ACSII to stdout */ +extern void sg_print_command(const unsigned char * command); +extern void sg_print_sense(const char * leadin, + const unsigned char * sense_buffer, int sb_len); +extern void sg_print_status(int masked_status); +extern void sg_print_scsi_status(int scsi_status); +extern void sg_print_host_status(int host_status); +extern void sg_print_driver_status(int driver_status); + +/* sg_chk_n_print() returns 1 quietly if there are no errors/warnings + else it prints to standard output and returns 0. */ +extern int sg_chk_n_print(const char * leadin, int masked_status, + int host_status, int driver_status, + const unsigned char * sense_buffer, int sb_len); + +/* The following function declaration is for the sg version 3 driver. + Only version 3 sg_err.c defines it. */ +struct sg_io_hdr; +extern int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp); + + +/* The following "category" function returns one of the following */ +#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ +#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ +#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ +#define SG_ERR_CAT_TIMEOUT 3 +#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_SENSE 98 /* Something else is in the sense buffer */ +#define SG_ERR_CAT_OTHER 99 /* Some other error/warning has occurred */ + +extern int sg_err_category(int masked_status, int host_status, + int driver_status, const unsigned char * sense_buffer, + int sb_len); + +extern int sg_err_category_new(int scsi_status, int host_status, + int driver_status, const unsigned char * sense_buffer, + int sb_len); + +/* The following function declaration is for the sg version 3 driver. + Only version 3 sg_err.c defines it. */ +extern int sg_err_category3(struct sg_io_hdr * hp); + +/* Returns length of SCSI command given the opcode (first byte) */ +extern int sg_get_command_size(unsigned char opcode); + +extern void sg_get_command_name(unsigned char opcode, int buff_len, + char * buff); + +#endif diff --git a/extras/multipath/sg_include.h b/extras/multipath/sg_include.h new file mode 100644 index 0000000000..6b6dd6f372 --- /dev/null +++ b/extras/multipath/sg_include.h @@ -0,0 +1,44 @@ +#ifdef SG_KERNEL_INCLUDES + #define __user + typedef unsigned char u8; + #include "/usr/src/linux/include/scsi/sg.h" + #include "/usr/src/linux/include/scsi/scsi.h" +#else + #ifdef SG_TRICK_GNU_INCLUDES + #include + #include + #else + #include + #include + #endif +#endif + +/* + Getting the correct include files for the sg interface can be an ordeal. + In a perfect world, one would just write: + #include + #include + This would include the files found in the /usr/include/scsi directory. + Those files are maintained with the GNU library which may or may not + agree with the kernel and version of sg driver that is running. Any + many cases this will not matter. However in some it might, for example + glibc 2.1's include files match the sg driver found in the lk 2.2 + series. Hence if glibc 2.1 is used with lk 2.4 then the additional + sg v3 interface will not be visible. + If this is a problem then defining SG_KERNEL_INCLUDES will access the + kernel supplied header files (assuming they are in the normal place). + The GNU library maintainers and various kernel people don't like + this approach (but it does work). + The technique selected by defining SG_TRICK_GNU_INCLUDES worked (and + was used) prior to glibc 2.2 . Prior to that version /usr/include/linux + was a symbolic link to /usr/src/linux/include/linux . + + There are other approaches if this include "mixup" causes pain. These + would involve include files being copied or symbolic links being + introduced. + + Sorry about the inconvenience. Typically neither SG_KERNEL_INCLUDES + nor SG_TRICK_GNU_INCLUDES is defined. + + dpg 20010415, 20030522 +*/ -- cgit v1.2.3-54-g00ecf From c521693b54956c1f2dd0c0947c819b8570f6edaa Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 13 Nov 2003 06:34:36 -0800 Subject: [PATCH] add scsi_id "extra" program from Patrick Mansfield --- extras/scsi_id/COPYING | 340 +++++++++++++++++ extras/scsi_id/Makefile | 51 +++ extras/scsi_id/README | 19 + extras/scsi_id/TODO | 16 + extras/scsi_id/VERSION | 1 + extras/scsi_id/scsi.h | 96 +++++ extras/scsi_id/scsi_id.c | 827 ++++++++++++++++++++++++++++++++++++++++++ extras/scsi_id/scsi_id.config | 40 ++ extras/scsi_id/scsi_id.h | 42 +++ extras/scsi_id/scsi_serial.c | 735 +++++++++++++++++++++++++++++++++++++ 10 files changed, 2167 insertions(+) create mode 100644 extras/scsi_id/COPYING create mode 100644 extras/scsi_id/Makefile create mode 100644 extras/scsi_id/README create mode 100644 extras/scsi_id/TODO create mode 100644 extras/scsi_id/VERSION create mode 100644 extras/scsi_id/scsi.h create mode 100644 extras/scsi_id/scsi_id.c create mode 100644 extras/scsi_id/scsi_id.config create mode 100644 extras/scsi_id/scsi_id.h create mode 100644 extras/scsi_id/scsi_serial.c diff --git a/extras/scsi_id/COPYING b/extras/scsi_id/COPYING new file mode 100644 index 0000000000..60549be514 --- /dev/null +++ b/extras/scsi_id/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + 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; either version 2 of the License, or + (at your option) any later version. + + 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile new file mode 100644 index 0000000000..5ad2bcf3e1 --- /dev/null +++ b/extras/scsi_id/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2003 IBM +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +VERSION=0.1 + +prefix = +sbindir = ${prefix}/sbin + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 + +CFLAGS=-DVERSION=\"$(VERSION)\" $(DEBUG) -Wall + +PROG=scsi_id + +LIBSYSFS=-lsysfs +STRIP=-s +LDFLAGS=$(STRIP) --static + +OBJS= scsi_id.o \ + scsi_serial.o \ + +all: $(PROG) + +install: all + $(INSTALL_PROGRAM) -D $(PROG) $(sbindir)/$(PROG) + +uninstall: + -rm $(sbindir)/$(PROG) + +$(OBJS): scsi_id.h scsi.h + +clean: + rm -f $(PROG) $(OBJS) + +$(PROG): $(OBJS) + $(CC) $(OBJS) $(LDFLAGS) $(LIBSYSFS) -o $(PROG) diff --git a/extras/scsi_id/README b/extras/scsi_id/README new file mode 100644 index 0000000000..b13cf1e50a --- /dev/null +++ b/extras/scsi_id/README @@ -0,0 +1,19 @@ +scsi_id - generate a SCSI unique identifier for a given SCSI device + +Primarily for use with udev callout config entries. This could also be +used by a multi-path configuration tool that requires SCSI id's. + +Requires: + +- Linux kernel 2.6 + +- libsysfs + +No man page yet. + +libsysfs 0_2_0 was not installing libsysfs.h or dlist.h, manually copy +those files to /usr/include/sys before compiling. + +Build via make and make install. + +Please send questions, comments or patches to patmans@us.ibm.com. diff --git a/extras/scsi_id/TODO b/extras/scsi_id/TODO new file mode 100644 index 0000000000..ba52101431 --- /dev/null +++ b/extras/scsi_id/TODO @@ -0,0 +1,16 @@ +- Investigate shrinking build size: use klibc or uClibc, or copy whatever + udev does + +- write a man page + +- send in kernel patch for REQ_BLOCK_PC, to always set sd and sr set + retries (scmd->allowed) to <= 1 + +- Pull SG_IO code into one .c file. + +- implement callout to device specific serial id code. The "-c prog" is + not implemented. + + This needs an implementation of a device specific callout before it can + be completed. Someone with hardware requiring this needs to send in a + patch. diff --git a/extras/scsi_id/VERSION b/extras/scsi_id/VERSION new file mode 100644 index 0000000000..49d59571fb --- /dev/null +++ b/extras/scsi_id/VERSION @@ -0,0 +1 @@ +0.1 diff --git a/extras/scsi_id/scsi.h b/extras/scsi_id/scsi.h new file mode 100644 index 0000000000..780e001576 --- /dev/null +++ b/extras/scsi_id/scsi.h @@ -0,0 +1,96 @@ +/* + * scsi.h + * + * General scsi and linux scsi specific defines and structs. + * + * Copyright (C) IBM Corp. 2003 + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#include + +struct scsi_ioctl_command { + unsigned int inlen; /* excluding scsi command length */ + unsigned int outlen; + unsigned char data[1]; + /* on input, scsi command starts here then opt. data */ +}; + +/* + * Default 5 second timeout + */ +#define DEF_TIMEOUT 5000 + +#define SENSE_BUFF_LEN 32 + +/* + * SCSI INQUIRY vendor and model (really product) lengths. + */ +#define VENDOR_LENGTH 8 +#define MODEL_LENGTH 16 + +#define INQUIRY_CMD 0x12 +#define INQUIRY_CMDLEN 6 + +/* + * INQUIRY VPD page 0x83 identifier descriptor related values. Reference the + * SCSI Primary Commands specification for details. + */ + +/* + * id type values of id descriptors. These are assumed to fit in 4 bits. + */ +#define SCSI_ID_VENDOR_SPECIFIC 0 +#define SCSI_ID_T10_VENDOR 1 +#define SCSI_ID_EUI_64 2 +#define SCSI_ID_NAA 3 + +/* + * Supported NAA values. These fit in 4 bits, so the "don't care" value + * cannot conflict with real values. + */ +#define SCSI_ID_NAA_DONT_CARE 0xff +#define SCSI_ID_NAA_IEEE_REG 5 +#define SCSI_ID_NAA_IEEE_REG_EXTENDED 6 + +/* + * Supported Code Set values. + */ +#define SCSI_ID_BINARY 1 +#define SCSI_ID_ASCII 2 + +struct scsi_id_search_values { + u_char id_type; + u_char naa_type; + u_char code_set; +}; + +/* + * Following are the "true" SCSI status codes. Linux has traditionally + * used a 1 bit right and masked version of these. So now CHECK_CONDITION + * and friends (in ) are deprecated. + */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_CONDITION_MET 0x4 +#define SCSI_BUSY 0x8 +#define SCSI_IMMEDIATE 0x10 +#define SCSI_IMMEDIATE_CONDITION_MET 0x14 +#define SCSI_RESERVATION_CONFLICT 0x18 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SCSI_TASK_SET_FULL 0x28 +#define SCSI_ACA_ACTIVE 0x30 +#define SCSI_TASK_ABORTED 0x40 diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c new file mode 100644 index 0000000000..d34d9284e5 --- /dev/null +++ b/extras/scsi_id/scsi_id.c @@ -0,0 +1,827 @@ +/* + * scsi_id.c + * + * Main section of the scsi_id program + * + * Copyright (C) IBM Corp. 2003 + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "scsi_id.h" + +#ifndef VERSION +#warning No version +#define VERSION "unknown" +#endif + +/* + * temporary names for mknod. + */ +#define TMP_DIR "/tmp" +#define TMP_PREFIX "scsi" + +#define CONFIG_FILE "/etc/scsi_id.config" + +#define MAX_NAME_LEN 72 + +#define MAX_SERIAL_LEN 128 + +static const char short_options[] = "bc:d:ef:gip:s:vV"; +static const struct option long_options[] = { + {"broken", no_argument, NULL, 'b'}, /* also per dev */ + {"callout", required_argument, NULL, 'c'}, /* also per dev */ + {"device", required_argument, NULL, 'd'}, + {"stderr", no_argument, NULL, 'e'}, + {"file", required_argument, NULL, 'f'}, + {"good", no_argument, NULL, 'g'}, /* also per dev */ + {"busid", no_argument, NULL, 'i'}, /* also per dev */ + {"page", required_argument, NULL, 'p'}, /* also per dev */ + {"devpath", required_argument, NULL, 's'}, + {"verbose", no_argument, NULL, 'v'}, + {"version", no_argument, NULL, 'V'}, + {0, 0, 0, 0} +}; +/* + * Just duplicate per dev options. + */ +static const char dev_short_options[] = "bc:gp:"; +static const struct option dev_long_options[] = { + {"broken", no_argument, NULL, 'b'}, /* also per dev */ + {"callout", required_argument, NULL, 'c'}, /* also per dev */ + {"good", no_argument, NULL, 'g'}, /* also per dev */ + {"page", required_argument, NULL, 'p'}, /* also per dev */ + {0, 0, 0, 0} +}; + +char sysfs_mnt_path[SYSFS_PATH_MAX]; + +static int all_good; +static char *default_callout; +static int dev_specified; +static int sys_specified; +static char config_file[MAX_NAME_LEN] = CONFIG_FILE; +static int display_bus_id; +static int default_page_code; +static int use_stderr; +static int debug; +static int hotplug_mode; + +void log_message (int level, const char *format, ...) +{ + va_list args; + + if (!debug && level == LOG_DEBUG) + return; + + va_start (args, format); + if (!hotplug_mode || use_stderr) { + vfprintf(stderr, format, args); + } else { + static int logging_init = 0; + if (!logging_init) { + openlog ("scsi_id", LOG_PID, LOG_DAEMON); + logging_init = 1; + } + + vsyslog(level, format, args); + } + va_end (args); + return; +} + +static int sysfs_get_actual_dev(const char *sysfs_path, char *dev, int len) +{ + dprintf("%s\n", sysfs_path); + strncpy(dev, sysfs_path, len); + strncat(dev, "/device", len); + if (sysfs_get_link(dev, dev, len)) { + if (!hotplug_mode) + log_message(LOG_WARNING, "%s: %s\n", dev, + strerror(errno)); + return -1; + } + return 0; +} + +/* + * sysfs_is_bus: Given the sysfs_path to a device, return 1 if sysfs_path + * is on bus, 0 if not on bus, and < 0 on error + */ +static int sysfs_is_bus(const char *sysfs_path, const char *bus) +{ + char bus_dev_name[SYSFS_PATH_MAX]; + char bus_id[SYSFS_NAME_LEN]; + struct stat stat_buf; + ino_t dev_inode; + + dprintf("%s\n", sysfs_path); + + if (sysfs_get_name_from_path(sysfs_path, bus_id, SYSFS_NAME_LEN)) + return -1; + + snprintf(bus_dev_name, MAX_NAME_LEN, "%s/%s/%s/%s/%s", sysfs_mnt_path, + SYSFS_BUS_DIR, bus, SYSFS_DEVICES_NAME, bus_id); + + if (stat(sysfs_path, &stat_buf)) + return -1; + dev_inode = stat_buf.st_ino; + + if (stat(bus_dev_name, &stat_buf)) { + if (errno == ENOENT) + return 0; + else + return -1; + } + if (dev_inode == stat_buf.st_ino) + return 1; + else + return 0; +} + +static int get_major_minor(const char *devpath, int *major, int *minor) +{ + struct sysfs_class_device *class_dev; + char dev_value[SYSFS_NAME_LEN]; + char *dev; + + dprintf("%s\n", devpath); + class_dev = sysfs_open_class_device(devpath); + if (!class_dev) { + log_message(LOG_WARNING, "open class %s failed: %s\n", devpath, + strerror(errno)); + return -1; + } + + dev = sysfs_get_attr(class_dev, "dev"); + if (dev) + strncpy(dev_value, dev, SYSFS_NAME_LEN); + sysfs_close_class_device(class_dev); + if (!dev) { + /* + * XXX This happens a lot, since sg has no dev attr. + * Someday change this back to a LOG_WARNING. + */ + log_message(LOG_DEBUG, "%s could not get dev attribute: %s\n", + devpath, strerror(errno)); + return -1; + } + dev = NULL; + + dprintf("dev %s", dev_value); /* dev_value has a trailing \n */ + if (sscanf(dev_value, "%u:%u", major, minor) != 2) { + log_message(LOG_WARNING, "%s: invalid dev major/minor\n", + devpath); + return -1; + } + + return 0; +} + +static int create_tmp_dev(const char *devpath, char *tmpdev, int dev_type) +{ + int major, minor; + + dprintf("(%s)\n", devpath); + + if (get_major_minor(devpath, &major, &minor)) + return -1; + snprintf(tmpdev, MAX_NAME_LEN, "%s/%s-maj%d-min%d-%u", + TMP_DIR, TMP_PREFIX, major, minor, getpid()); + + dprintf("tmpdev '%s'\n", tmpdev); + + if (mknod(tmpdev, 0600 | dev_type, makedev(major, minor))) { + log_message(LOG_WARNING, "mknod failed: %s\n", strerror(errno)); + return -1; + } + return 0; +} + +static int has_sysfs_prefix(const char *path, const char *prefix) +{ + char match[MAX_NAME_LEN]; + + strncpy(match, sysfs_mnt_path, MAX_NAME_LEN); + strncat(match, prefix, MAX_NAME_LEN); + if (strncmp(path, match, strlen(match)) == 0) + return 1; + else + return 0; +} + +/* + * get_value: + * + * buf points to an '=' followed by a quoted string ("foo") or a string ending + * with a space or ','. + * + * Return a pointer to the NUL terminated string, returns NULL if no + * matches. + */ +static char *get_value(char **buffer) +{ + static char *quote_string = "\"\n"; + static char *comma_string = ",\n"; + char *val; + char *end; + + if (**buffer == '"') { + /* + * skip leading quote, terminate when quote seen + */ + (*buffer)++; + end = quote_string; + } else { + end = comma_string; + } + val = strsep(buffer, end); + if (val && end == quote_string) + /* + * skip trailing quote + */ + (*buffer)++; + + while (isspace(**buffer)) + (*buffer)++; + + return val; +} + +static int argc_count(char *opts) +{ + int i = 0; + while (*opts != '\0') + if (*opts++ == ' ') + i++; + return i; +} + +/* + * get_file_options: + * + * If vendor == NULL, find a line in the config file with only "OPTIONS="; + * if vendor and model are set find the first OPTIONS line in the config + * file that matches. Set argc and argv to match the OPTIONS string. + * + * vendor and model can end in '\n'. + */ +static int get_file_options(char *vendor, char *model, int *argc, + char ***newargv) +{ + char buffer[256]; + FILE *fd; + char *buf; + char *str1; + char *vendor_in, *model_in, *options_in; /* read in from file */ + int lineno; + int c; + int retval = 0; + static char *prog_string = "arg0"; + + dprintf("vendor='%s'; model='%s'\n", vendor, model); + fd = fopen(config_file, "r"); + if (fd == NULL) { + dprintf("can't open %s\n", config_file); + if (errno == ENOENT) { + return 1; + } else { + log_message(LOG_WARNING, "can't open %s: %s\n", + config_file, strerror(errno)); + return -1; + } + } + + *newargv = NULL; + lineno = 0; + + while (1) { + vendor_in = model_in = options_in = NULL; + + buf = fgets(buffer, sizeof(buffer), fd); + if (buf == NULL) + break; + lineno++; + + while (isspace(*buf)) + buf++; + + if (*buf == '\0') + /* + * blank or all whitespace line + */ + continue; + + if (*buf == '#') + /* + * comment line + */ + continue; + +#ifdef LOTS + dprintf("lineno %d: '%s'\n", lineno, buf); +#endif + str1 = strsep(&buf, "="); + if (str1 && strcasecmp(str1, "VENDOR") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + vendor_in = str1; + + str1 = strsep(&buf, "="); + if (str1 && strcasecmp(str1, "MODEL") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + model_in = str1; + str1 = strsep(&buf, "="); + } + } + + if (str1 && strcasecmp(str1, "OPTIONS") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + options_in = str1; + } + dprintf("config file line %d:" + " vendor '%s'; model '%s'; options '%s'\n", + lineno, vendor_in, model_in, options_in); + /* + * Only allow: [vendor=foo[,model=bar]]options=stuff + */ + if (!options_in || (!vendor_in && model_in)) { + log_message(LOG_WARNING, + "Error parsing config file line %d '%s'\n", + lineno, buffer); + retval = -1; + break; + } + if (vendor == NULL) { + if (vendor_in == NULL) { + dprintf("matched global option\n"); + break; + } + } else if ((vendor_in && strncmp(vendor, vendor_in, + strlen(vendor_in)) == 0) && + (!model_in || (strncmp(model, model_in, + strlen(model_in)) == 0))) { + /* + * Matched vendor and optionally model. + * + * Note: a short vendor_in or model_in can + * give a partial match (that is FOO + * matches FOOBAR). + */ + dprintf("matched vendor/model\n"); + break; + } else { + dprintf("no match\n"); + } + } + + if (retval == 0) { + if (vendor_in != NULL || model_in != NULL || + options_in != NULL) { + /* + * Something matched. Allocate newargv, and store + * values found in options_in. + */ + c = argc_count(options_in) + 2; + *newargv = calloc(c, sizeof(**newargv)); + if (!*newargv) { + log_message(LOG_WARNING, + "Can't allocate memory\n"); + retval = -1; + } else { + *argc = c; + c = 0; + (*newargv)[c] = prog_string; /* nothing */ + for (c = 1; c < *argc; c++) + (*newargv)[c] = strsep(&options_in, " "); + } + } else { + /* + * No matches. + */ + retval = 1; + } + } + fclose(fd); + return retval; +} + +static int set_options(int argc, char **argv, const char *short_opts, + const struct option *long_opts, char *target, + char *maj_min_dev) +{ + int option; + int option_ind; + + /* + * optind is a global extern used by getopt_long. Since we can + * call set_options twice (once for command line, and once for + * config file) we have to reset this back to 0. + */ + optind = 0; + while (1) { + option = getopt_long(argc, argv, short_options, long_options, + &option_ind); + if (option == -1) + break; + + if (optarg) + dprintf("option '%c' arg '%s'\n", option, optarg); + else + dprintf("option '%c'\n", option); + + switch (option) { + case 'b': + all_good = 0; + break; + + case 'c': + default_callout = optarg; + break; + + case 'd': + dev_specified = 1; + strncpy(maj_min_dev, optarg, MAX_NAME_LEN); + break; + + case 'e': + use_stderr = 1; + break; + + case 'f': + strncpy(config_file, optarg, MAX_NAME_LEN); + break; + + case 'g': + all_good = 1; + break; + + case 'i': + display_bus_id = 1; + break; + + case 'p': + if (strcmp(optarg, "0x80") == 0) { + default_page_code = 0x80; + } else if (strcmp(optarg, "0x83") == 0) { + default_page_code = 0x83; + } else { + log_message(LOG_WARNING, + "Unknown page code '%s'\n", optarg); + return -1; + } + break; + + case 's': + sys_specified = 1; + strncpy(target, sysfs_mnt_path, MAX_NAME_LEN); + strncat(target, optarg, MAX_NAME_LEN); + break; + + case 'v': + debug++; + break; + + case 'V': + log_message(LOG_WARNING, "scsi_id version: %s\n", + VERSION); + exit(0); + break; + + default: + log_message(LOG_WARNING, + "Unknown or bad option '%c' (0x%x)\n", + option, option); + return -1; + } + } + return 0; +} + +static int per_dev_options(struct sysfs_class_device *scsi_dev, int *good_bad, + int *page_code, char *callout) +{ + int retval; + int newargc; + char **newargv = NULL; + char *vendor; + char *model; + int option; + int option_ind; + + + *good_bad = all_good; + *page_code = default_page_code; + if (default_callout && (callout != default_callout)) + strncpy(callout, default_callout, MAX_NAME_LEN); + else + callout[0] = '\0'; + + vendor = sysfs_get_attr(scsi_dev, "vendor"); + if (!vendor) { + log_message(LOG_WARNING, "%s: no vendor attribute\n", + scsi_dev->name); + return -1; + } + + model = sysfs_get_attr(scsi_dev, "model"); + if (!vendor) { + log_message(LOG_WARNING, "%s: no model attribute\n", + scsi_dev->name); + return -1; + } + + retval = get_file_options(vendor, model, &newargc, &newargv); + + optind = 0; /* global extern, reset to 0 */ + while (retval == 0) { + option = getopt_long(newargc, newargv, dev_short_options, + dev_long_options, &option_ind); + if (option == -1) + break; + + if (optarg) + dprintf("option '%c' arg '%s'\n", option, optarg); + else + dprintf("option '%c'\n", option); + + switch (option) { + case 'b': + *good_bad = 0; + break; + + case 'c': + strncpy(callout, default_callout, MAX_NAME_LEN); + break; + + case 'g': + *good_bad = 1; + break; + + case 'p': + if (strcmp(optarg, "0x80") == 0) { + *page_code = 0x80; + } else if (strcmp(optarg, "0x83") == 0) { + *page_code = 0x83; + } else { + log_message(LOG_WARNING, + "Unknown page code '%s'\n", optarg); + retval = -1; + } + break; + + default: + log_message(LOG_WARNING, + "Unknown or bad option '%c' (0x%x)\n", + option, option); + retval = -1; + break; + } + } + + if (newargv) + free(newargv); + return retval; +} + +/* + * scsi_id: try to get an id, if one is found, printf it to stdout. + * returns a value passed to exit() - 0 if printed an id, else 1. This + * could be expanded, for example, if we want to report a failure like no + * memory etc. return 2, and return 1 for expected cases (like broken + * device found) that do not print an id. + */ +static int scsi_id(const char *target_path, char *maj_min_dev) +{ + int retval; + int dev_type = 0; + char full_dev_path[MAX_NAME_LEN]; + char serial[MAX_SERIAL_LEN]; + struct sysfs_class_device *scsi_dev; /* of scsi_device full_dev_path */ + int good_dev; + int page_code; + char callout[MAX_NAME_LEN]; + + dprintf("target_path %s\n", target_path); + + /* + * Ugly: depend on the sysfs path to tell us whether this is a + * block or char device. This should probably be encoded in the + * "dev" along with the major/minor. + */ + if (has_sysfs_prefix(target_path, "/block")) { + dev_type = S_IFBLK; + } else if (has_sysfs_prefix(target_path, "/class")) { + dev_type = S_IFCHR; + } else { + if (!hotplug_mode) { + log_message(LOG_WARNING, + "Non block or class device '%s'\n", + target_path); + return 1; + } else { + /* + * Expected in some cases. + */ + dprintf("Non block or class device\n"); + return 0; + } + } + + if (sysfs_get_actual_dev(target_path, full_dev_path, MAX_NAME_LEN)) + return 1; + + dprintf("full_dev_path %s\n", full_dev_path); + + /* + * Allow only scsi devices (those that have a matching device + * under /bus/scsi/devices). + * + * Other block devices can support SG IO, but only ide-cd does, so + * for now, don't bother with anything else. + */ + retval = sysfs_is_bus(full_dev_path, "scsi"); + if (retval == 0) { + if (hotplug_mode) + /* + * Expected in some cases. + */ + dprintf("%s is not a scsi device\n", target_path); + else + log_message(LOG_WARNING, "%s is not a scsi device\n", + target_path); + return 1; + } else if (retval < 0) { + log_message(LOG_WARNING, "sysfs_is_bus failed: %s\n", + strerror(errno)); + return 1; + } + + /* + * mknod a temp dev to communicate with the device. + */ + if (!dev_specified && create_tmp_dev(target_path, maj_min_dev, + dev_type)) { + dprintf("create_tmp_dev failed\n"); + return 1; + } + + scsi_dev = sysfs_open_class_device(full_dev_path); + if (!scsi_dev) { + log_message(LOG_WARNING, "open class %s failed: %s\n", + full_dev_path, strerror(errno)); + return 1; + } + + /* + * Get any per device (vendor + model) options from the config + * file. + */ + retval = per_dev_options(scsi_dev, &good_dev, &page_code, callout); + dprintf("per dev options: good %d; page code 0x%x; callout '%s'\n", + good_dev, page_code, callout); + + if (!good_dev) { + retval = 1; + } else if (callout[0] != '\0') { + /* + * exec vendor callout, pass it only the "name" to be used + * for error messages, and the dev to open. + * + * This won't work if we need to pass on the original + * command line (when not hotplug mode) since the option + * parsing and per dev parsing modify the argv's. + * + * XXX Not implemented yet. And not fully tested ;-) + */ + retval = 1; + } else if (scsi_get_serial(scsi_dev, maj_min_dev, page_code, + serial, MAX_SERIAL_LEN)) { + retval = 1; + } else { + retval = 0; + } + if (!retval) { + if (display_bus_id) + printf("%s ", scsi_dev->name); + printf("%s", serial); + if (!hotplug_mode) + printf("\n"); + dprintf("%s\n", serial); + retval = 0; + } + fflush(stdout); + sysfs_close_class_device(scsi_dev); + + if (!dev_specified) + unlink(maj_min_dev); + + return retval; +} + +int main(int argc, char **argv) +{ + int retval; + char *devpath; + char target_path[MAX_NAME_LEN]; + char maj_min_dev[MAX_NAME_LEN]; + int newargc; + char **newargv; + + if (getenv("DEBUG")) + debug++; + + if ((argc == 2) && (argv[1][0] != '-')) { + hotplug_mode = 1; + dprintf("hotplug assumed\n"); + } + + dprintf("argc is %d\n", argc); + if (sysfs_get_mnt_path(sysfs_mnt_path, MAX_NAME_LEN)) { + log_message(LOG_WARNING, "sysfs_get_mnt_path failed: %s\n", + strerror(errno)); + exit(1); + } + + if (hotplug_mode) { + /* + * There is a kernel race creating attributes, if called + * directly, uncomment the sleep. + */ + /* sleep(1); */ + + devpath = getenv("DEVPATH"); + if (!devpath) { + log_message(LOG_WARNING, "DEVPATH is not set\n"); + exit(1); + } + sys_specified = 1; + + strncpy(target_path, sysfs_mnt_path, MAX_NAME_LEN); + strncat(target_path, devpath, MAX_NAME_LEN); + } else { + if (set_options(argc, argv, short_options, long_options, + target_path, maj_min_dev) < 0) + exit(1); + } + + /* + * Override any command line options set via the config file. This + * is the only way to set options when in hotplug mode. + */ + newargv = NULL; + retval = get_file_options(NULL, NULL, &newargc, &newargv); + if (retval < 0) { + exit(1); + } else if (newargv && (retval == 0)) { + if (set_options(newargc, newargv, short_options, long_options, + target_path, maj_min_dev) < 0) + exit(1); + free(newargv); + } + + if (!sys_specified) { + log_message(LOG_WARNING, "-s must be specified\n"); + exit(1); + } + + retval = scsi_id(target_path, maj_min_dev); + exit(retval); +} diff --git a/extras/scsi_id/scsi_id.config b/extras/scsi_id/scsi_id.config new file mode 100644 index 0000000000..4fdb89e28a --- /dev/null +++ b/extras/scsi_id/scsi_id.config @@ -0,0 +1,40 @@ +# +# Informational and example scsi_id.config file for use with scsi_id. +# + +# General syntax is: +# +# lower or upper case has no affect on the left side. Quotes (") are +# required if you need spaces in values. Model is the same as the SCSI +# INQUIRY product identification field. Per the SCSI INQUIRY, the vendor +# is limited to 8 bytes, model to 16 bytes. +# +# The first maching line found is used. Short matches match longer ones, +# if you do not want such a match space fill the extra bytes. If no model +# is specified, only the vendor string need match. +# +# The "option" line is searched when scsi_id first starts up (for use with +# hotplug during boot). +# +# options= +# +# vendor=string[,model=string],options= + +# +# If you normally don't need id's, black list everyone: +# +options=-b + +# +# Then white list devices on your system that have correct and useful id's: +# +vendor=someone, model=nicedrive, options=-g + +# If you have all good devices on your system use, mark all as good: + +## options=-g + +# Then black list any offenders. Missing entries here could be dangerous +# if you rely on the id for naming or multi-path configuration! + +## vendor=ELBONIA, model=borken, options=-b diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h new file mode 100644 index 0000000000..8be492b75a --- /dev/null +++ b/extras/scsi_id/scsi_id.h @@ -0,0 +1,42 @@ +/* + * scsi_id.h + * + * General defines and such for scsi_id + * + * Copyright (C) IBM Corp. 2003 + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#define dprintf(format, arg...) \ + log_message(LOG_DEBUG, "%s: " format, __FUNCTION__, ## arg) + +#define MAX_NAME_LEN 72 +#define OFFSET (2 * sizeof(unsigned int)) + +static inline char *sysfs_get_attr(struct sysfs_class_device *dev, + const char *attr) +{ + return sysfs_get_value_from_attributes(dev->directory->attributes, + attr); +} + +extern int scsi_get_serial (struct sysfs_class_device *scsi_dev, + const char *devname, int page_code, char *serial, + int len); +extern void log_message (int level, const char *format, ...) + __attribute__ ((format (printf, 2, 3))); + diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c new file mode 100644 index 0000000000..302429c0d4 --- /dev/null +++ b/extras/scsi_id/scsi_serial.c @@ -0,0 +1,735 @@ +/* + * scsi_serial.c + * + * Code related to requesting and getting an id from a scsi device + * + * Copyright (C) IBM Corp. 2003 + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "scsi_id.h" +#include "scsi.h" + +/* + * A priority based list of id, naa, and binary/ascii for the identifier + * descriptor in VPD page 0x83. + * + * Brute force search for a match starting with the first value in the + * following id_search_list. This is not a performance issue, since there + * is normally one or some small number of descriptors. + */ +static const struct scsi_id_search_values id_search_list[] = { + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_ASCII }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_ASCII }, + /* + * Devices already exist using NAA values that are now marked + * reserved. These should not conflict with other values, or it is + * a bug in the device. As long as we find the IEEE extended one + * first, we really don't care what other ones are used. Using + * don't care here means that a device that returns multiple + * non-IEEE descriptors in a random order will get different + * names. + */ + { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, +}; + +static const char hex_str[]="0123456789abcdef"; + +/* + * XXX maybe move all these to an sg_io.c file. + * + * From here ... + */ + +/* + * Values returned in the result/status, only the ones used by the code + * are used here. + */ + +#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ + +#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ +#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ + +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ + +/* The following "category" function returns one of the following */ +#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ +#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ +#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ +#define SG_ERR_CAT_TIMEOUT 3 +#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ +#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ + +static int sg_err_category_new(int scsi_status, int msg_status, int + host_status, int driver_status, const + unsigned char *sense_buffer, int sb_len) +{ + scsi_status &= 0x7e; + + /* + * XXX change to return only two values - failed or OK. + */ + + /* + * checks msg_status + */ + if (!scsi_status && !msg_status && !host_status && !driver_status) + return SG_ERR_CAT_CLEAN; + + if ((scsi_status == SCSI_CHECK_CONDITION) || + (scsi_status == SCSI_COMMAND_TERMINATED) || + ((driver_status & 0xf) == DRIVER_SENSE)) { + if (sense_buffer && (sb_len > 2)) { + int sense_key; + unsigned char asc; + + if (sense_buffer[0] & 0x2) { + sense_key = sense_buffer[1] & 0xf; + asc = sense_buffer[2]; + } else { + sense_key = sense_buffer[2] & 0xf; + asc = (sb_len > 12) ? sense_buffer[12] : 0; + } + + if (sense_key == RECOVERED_ERROR) + return SG_ERR_CAT_RECOVERED; + else if (sense_key == UNIT_ATTENTION) { + if (0x28 == asc) + return SG_ERR_CAT_MEDIA_CHANGED; + if (0x29 == asc) + return SG_ERR_CAT_RESET; + } + } + return SG_ERR_CAT_SENSE; + } + if (!host_status) { + if ((host_status == DID_NO_CONNECT) || + (host_status == DID_BUS_BUSY) || + (host_status == DID_TIME_OUT)) + return SG_ERR_CAT_TIMEOUT; + } + if (!driver_status) { + if (driver_status == DRIVER_TIMEOUT) + return SG_ERR_CAT_TIMEOUT; + } + return SG_ERR_CAT_OTHER; +} + +static int sg_err_category3(struct sg_io_hdr *hp) +{ + return sg_err_category_new(hp->status, hp->msg_status, + hp->host_status, hp->driver_status, + hp->sbp, hp->sb_len_wr); +} + +static int scsi_dump_sense(struct sysfs_class_device *scsi_dev, + struct sg_io_hdr *io) +{ + unsigned char *sense_buffer; + int s; + int sb_len; + int code; + int sense_class; + int sense_key; + int descriptor_format; + int asc, ascq; +#ifdef DUMP_SENSE + char out_buffer[256]; + int i, j; +#endif + + /* + * Figure out and print the sense key, asc and ascq. + * + * If you want to suppress these for a particular drive model, add + * a black list entry in the scsi_id config file. + * + * XXX We probably need to: lookup the sense/asc/ascq in a retry + * table, and if found return 1 (after dumping the sense, asc, and + * ascq). So, if/when we get something like a power on/reset, + * we'll retry the command. + */ + + dprintf("got check condition\n"); + + sb_len = io->sb_len_wr; + if (sb_len < 1) { + log_message(LOG_WARNING, "%s: sense buffer empty\n", + scsi_dev->name); + return -1; + } + + sense_buffer = io->sbp; + sense_class = (sense_buffer[0] >> 4) & 0x07; + code = sense_buffer[0] & 0xf; + + if (sense_class == 7) { + /* + * extended sense data. + */ + s = sense_buffer[7] + 8; + if (sb_len < s) { + log_message(LOG_WARNING, + "%s: sense buffer too small %d bytes," + " %d bytes too short\n", scsi_dev->name, + sb_len, s - sb_len); + return -1; + } + if ((code == 0x0) || (code == 0x1)) { + descriptor_format = 0; + sense_key = sense_buffer[2] & 0xf; + if (s < 14) { + /* + * Possible? + */ + log_message(LOG_WARNING, "%s: sense result too" + " small %d bytes\n", + scsi_dev->name, s); + return -1; + } + asc = sense_buffer[12]; + ascq = sense_buffer[13]; + } else if ((code == 0x2) || (code == 0x3)) { + descriptor_format = 1; + sense_key = sense_buffer[1] & 0xf; + asc = sense_buffer[2]; + ascq = sense_buffer[3]; + } else { + log_message(LOG_WARNING, + "%s: invalid sense code 0x%x\n", + scsi_dev->name, code); + return -1; + } + log_message(LOG_WARNING, + "%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", + scsi_dev->name, sense_key, asc, ascq); + } else { + if (sb_len < 4) { + log_message(LOG_WARNING, + "%s: sense buffer too small %d bytes, %d bytes too short\n", + scsi_dev->name, sb_len, 4 - sb_len); + return -1; + } + + if (sense_buffer[0] < 15) + log_message(LOG_WARNING, "%s: old sense key: 0x%x\n", + scsi_dev->name, sense_buffer[0] & 0x0f); + else + log_message(LOG_WARNING, "%s: sense = %2x %2x\n", + scsi_dev->name, sense_buffer[0], + sense_buffer[2]); + log_message(LOG_WARNING, + "%s: non-extended sense class %d code 0x%0x ", + scsi_dev->name, sense_class, code); + + } + +#ifdef DUMP_SENSE + for (i = 0, j = 0; (i < s) && (j < 254); i++) { + dprintf("i %d, j %d\n", i, j); + out_buffer[j++] = hex_str[(sense_buffer[i] & 0xf0) >> 4]; + out_buffer[j++] = hex_str[sense_buffer[i] & 0x0f]; + out_buffer[j++] = ' '; + } + out_buffer[j] = '\0'; + log_message(LOG_WARNING, "%s: sense dump:\n", scsi_dev->name); + log_message(LOG_WARNING, "%s: %s\n", scsi_dev->name, out_buffer); + +#endif + return -1; +} + +static int scsi_dump(struct sysfs_class_device *scsi_dev, struct sg_io_hdr *io) +{ + if (!io->status && !io->host_status && !io->msg_status && + !io->driver_status) { + /* + * Impossible, should not be called. + */ + log_message(LOG_WARNING, "%s: called with no error\n", + __FUNCTION__); + return -1; + } + + log_message(LOG_WARNING, "%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", + scsi_dev->name, io->driver_status, io->host_status, + io->msg_status, io->status); + if (io->status == SCSI_CHECK_CONDITION) + return scsi_dump_sense(scsi_dev, io); + else + return -1; +} + +static int scsi_inquiry(struct sysfs_class_device *scsi_dev, int fd, + unsigned char evpd, unsigned char page, unsigned + char *buf, unsigned int buflen) +{ + unsigned char inq_cmd[INQUIRY_CMDLEN] = + { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; + unsigned char sense[SENSE_BUFF_LEN]; + struct sg_io_hdr io_hdr; + int retval; + unsigned char *inq; + unsigned char *buffer; + int retry = 3; /* rather random */ + + if (buflen > 255) { + log_message(LOG_WARNING, "buflen %d too long\n", buflen); + return -1; + } + inq = malloc(OFFSET + sizeof (inq_cmd) + 512); + memset(inq, 0, OFFSET + sizeof (inq_cmd) + 512); + buffer = inq + OFFSET; + +resend: + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof(inq_cmd); + io_hdr.mx_sb_len = sizeof(sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = buflen; + io_hdr.dxferp = buffer; + io_hdr.cmdp = inq_cmd; + io_hdr.sbp = sense; + io_hdr.timeout = DEF_TIMEOUT; + + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + log_message(LOG_WARNING, "%s ioctl failed: %s\n", + scsi_dev->name, strerror(errno)); + return -1; + } + + retval = sg_err_category3(&io_hdr); + + switch (retval) { + case SG_ERR_CAT_CLEAN: + case SG_ERR_CAT_RECOVERED: + retval = 0; + break; + + default: + retval = scsi_dump(scsi_dev, &io_hdr); + } + + if (!retval) { + retval = buflen; + memcpy(buf, buffer, retval); + } else if (retval > 0) { + if (--retry > 0) { + dprintf("%s: Retrying ...\n", scsi_dev->name); + goto resend; + } + retval = -1; + } + + free(inq); + return retval; +} + +/* + * XXX maybe move all these to an sg_io.c file. + * + * Ending here. + */ + +int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, + char *buffer, int len) +{ + int retval; + char *vendor; + + memset(buffer, 0, len); + retval = scsi_inquiry(scsi_dev, fd, 1, 0x0, buffer, len); + if (retval < 0) + return 1; + + if (buffer[1] != 0) { + log_message(LOG_WARNING, "%s: page 0 not available.\n", + scsi_dev->name); + return 1; + } + if (buffer[3] > len) { + log_message(LOG_WARNING, "%s: page 0 buffer too long %d", + scsi_dev->name, buffer[3]); + return 1; + } + + /* + * Following check is based on code once included in the 2.5.x + * kernel. + * + * Some ill behaved devices return the standard inquiry here + * rather than the evpd data, snoop the data to verify. + */ + if (buffer[3] > MODEL_LENGTH) { + /* + * If the vendor id appears in the page assume the page is + * invalid. + */ + vendor = sysfs_get_attr(scsi_dev, "vendor"); + if (!vendor) { + log_message(LOG_WARNING, "%s: no vendor attribute\n", + scsi_dev->name); + return 1; + } + if (!strncmp(&buffer[VENDOR_LENGTH], vendor, VENDOR_LENGTH)) { + log_message(LOG_WARNING, "%s invalid page0 data\n", + scsi_dev->name); + return 1; + } + } + return 0; +} + +/* + * The caller checks that serial is long enough to include the vendor + + * model. + */ +static int prepend_vendor_model(struct sysfs_class_device *scsi_dev, + char *serial) +{ + char *attr; + int ind; + + attr = sysfs_get_attr(scsi_dev, "vendor"); + if (!attr) { + log_message(LOG_WARNING, "%s: no vendor attribute\n", + scsi_dev->name); + return 1; + } + strncpy(serial, attr, VENDOR_LENGTH); + ind = strlen(serial) - 1; + /* + * Remove sysfs added newlines. + */ + if (serial[ind] == '\n') + serial[ind] = '\0'; + + attr = sysfs_get_attr(scsi_dev, "model"); + if (!attr) { + log_message(LOG_WARNING, "%s: no model attribute\n", + scsi_dev->name); + return 1; + } + strncat(serial, attr, MODEL_LENGTH); + ind = strlen(serial) - 1; + if (serial[ind] == '\n') + serial[ind] = '\0'; + else + ind++; + + /* + * This is not a complete check, since we are using strncat/cpy + * above, ind will never be too large. + */ + if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { + log_message(LOG_WARNING, "%s: expected length %d, got length %d\n", + scsi_dev->name, (VENDOR_LENGTH + MODEL_LENGTH), + ind); + return 1; + } + return ind; +} + +/** + * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill + * serial number. + **/ +static int check_fill_0x83_id(struct sysfs_class_device *scsi_dev, + char *page_83, + const struct scsi_id_search_values *id_search, + char *serial, int max_len) +{ + int i, j, len; + + /* + * ASSOCIATION must be with the device (value 0) + */ + if ((page_83[1] & 0x30) != 0) + return 1; + + if ((page_83[1] & 0x0f) != id_search->id_type) + return 1; + + /* + * Possibly check NAA sub-type. + */ + if ((id_search->naa_type != SCSI_ID_NAA_DONT_CARE) && + (id_search->naa_type != (page_83[4] & 0xf0) >> 4)) + return 1; + + /* + * Check for matching code set - ASCII or BINARY. + */ + if ((page_83[0] & 0x0f) != id_search->code_set) + return 1; + + /* + * page_83[3]: identifier length + */ + len = page_83[3]; + if ((page_83[0] & 0x0f) != SCSI_ID_ASCII) + /* + * If not ASCII, use two bytes for each binary value. + */ + len *= 2; + + /* + * Add one byte for the NUL termination, and one for the id_type. + */ + len += 2; + if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) + len += VENDOR_LENGTH + MODEL_LENGTH; + + if (max_len < len) { + log_message(LOG_WARNING, "%s: length %d too short - need %d\n", + scsi_dev->name, max_len, len); + return 1; + } + + serial[0] = hex_str[id_search->id_type]; + + /* + * Prepend the vendor and model before the id since if it is not + * unique across all vendors and models. + */ + if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) + if (prepend_vendor_model(scsi_dev, &serial[1]) < 0) { + dprintf("prepend failed\n"); + return 1; + } + + i = 4; /* offset to the start of the identifier */ + j = strlen(serial); + if ((page_83[0] & 0x0f) == SCSI_ID_ASCII) { + /* + * ASCII descriptor. + */ + while (i < (4 + page_83[3])) + serial[j++] = page_83[i++]; + } else { + /* + * Binary descriptor, convert to ASCII, using two bytes of + * ASCII for each byte in the page_83. + */ + while (i < (4 + page_83[3])) { + serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; + serial[j++] = hex_str[page_83[i] & 0x0f]; + i++; + } + } + return 0; +} + +static int do_scsi_page83_inquiry(struct sysfs_class_device *scsi_dev, int fd, + char *serial, int len) +{ + int retval; + int id_ind, j; + unsigned char page_83[256]; + + memset(page_83, 0, 256); + retval = scsi_inquiry(scsi_dev, fd, 1, 0x83, page_83, 255); + if (retval < 0) + return 1; + + if (page_83[1] != 0x83) { + log_message(LOG_WARNING, "%s: Invalid page 0x83\n", + scsi_dev->name); + return 1; + } + + /* + * Search for a match in the prioritized id_search_list. + */ + for (id_ind = 0; + id_ind < sizeof(id_search_list)/sizeof(id_search_list[0]); + id_ind++) { + /* + * Examine each descriptor returned. There is normally only + * one or a small number of descriptors. + */ + for (j = 4; j <= page_83[3] + 3; + j += page_83[j + 3] + 4) { + retval = check_fill_0x83_id(scsi_dev, &page_83[j], + &id_search_list[id_ind], + serial, len); + dprintf("%s id desc %d/%d/%d\n", scsi_dev->name, + id_search_list[id_ind].id_type, + id_search_list[id_ind].naa_type, + id_search_list[id_ind].code_set); + if (!retval) { + dprintf(" used\n"); + return retval; + } else if (retval < 0) { + dprintf(" failed\n"); + return retval; + } else { + dprintf(" not used\n"); + } + } + } + return 1; +} + +int do_scsi_page80_inquiry(struct sysfs_class_device *scsi_dev, int fd, + char *serial, int max_len) +{ + int retval; + int ser_ind; + int i; + int len; + unsigned char buf[256]; + + memset(buf, 0, 256); + retval = scsi_inquiry(scsi_dev, fd, 1, 0x80, buf, 255); + if (retval < 0) + return retval; + + if (buf[1] != 0x80) { + log_message(LOG_WARNING, "%s: Invalid page 0x80\n", + scsi_dev->name); + return 1; + } + + len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; + if (max_len < len) { + log_message(LOG_WARNING, "%s: length %d too short - need %d\n", + scsi_dev->name, max_len, len); + return 1; + } + /* + * Prepend 'S' to avoid unlikely collision with page 0x83 vendor + * specific type where we prepend '0' + vendor + model. + */ + serial[0] = 'S'; + ser_ind = prepend_vendor_model(scsi_dev, &serial[1]); + if (ser_ind < 0) + return 1; + len = buf[3]; + for (i = 4; i < len + 4; i++, ser_ind++) + serial[ser_ind] = buf[i]; + return 0; +} + +int scsi_get_serial (struct sysfs_class_device *scsi_dev, const char *devname, + int page_code, char *serial, int len) +{ + unsigned char page0[256]; + int fd; + int ind; + int retval; + + if (len > 255) { + } + memset(serial, 0, len); + dprintf("opening %s\n", devname); + fd = open(devname, O_RDONLY); + if (fd < 0) { + log_message(LOG_WARNING, "%s cannot open %s: %s\n", + scsi_dev->name, devname, strerror(errno)); + return 1; + } + + if (page_code == 0x80) { + if (do_scsi_page80_inquiry(scsi_dev, fd, serial, len)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } else if (page_code == 0x83) { + if (do_scsi_page83_inquiry(scsi_dev, fd, serial, len)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } else if (page_code != 0x00) { + log_message(LOG_WARNING, "%s unsupported page code 0x%d\n", + scsi_dev->name, page_code); + return 1; + } + + /* + * Get page 0, the page of the pages. By default, try from best to + * worst of supported pages: 0x83 then 0x80. + */ + if (do_scsi_page0_inquiry(scsi_dev, fd, page0, 255)) { + /* + * Don't try anything else. Black list if a specific page + * should be used for this vendor+model, or maybe have an + * optional fall-back to page 0x80 or page 0x83. + */ + retval = 1; + goto completed; + } + + dprintf("%s: Checking page0\n", scsi_dev->name); + + for (ind = 4; ind <= page0[3] + 3; ind++) + if (page0[ind] == 0x83) + if (!do_scsi_page83_inquiry(scsi_dev, fd, serial, + len)) { + /* + * Success + */ + retval = 0; + goto completed; + } + + for (ind = 4; ind <= page0[3] + 3; ind++) + if (page0[ind] == 0x80) + if (!do_scsi_page80_inquiry(scsi_dev, fd, serial, + len)) { + /* + * Success + */ + retval = 0; + goto completed; + } + retval = 1; +completed: + if (close(fd) < 0) + log_message(LOG_WARNING, "close failed: %s", strerror(errno)); + return retval; +} -- cgit v1.2.3-54-g00ecf From 30defadd3fbef99628a16dcd7c4a2964982deac2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 13 Nov 2003 20:08:10 -0800 Subject: [PATCH] get the major/minor number before we name the device. Will come in handy later... --- udev-add.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/udev-add.c b/udev-add.c index d20e96ee72..6f0e3bf105 100644 --- a/udev-add.c +++ b/udev-add.c @@ -44,7 +44,7 @@ * mm is the minor * The value is in decimal. */ -static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor) +static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) { int retval = -ENODEV; @@ -56,10 +56,10 @@ static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int dbg("dev = %s", dev); - if (sscanf(dev, "%u:%u", major, minor) != 2) + if (sscanf(dev, "%u:%u", &udev->major, &udev->minor) != 2) goto exit; - dbg("found major = %d, minor = %d", *major, *minor); + dbg("found major = %d, minor = %d", udev->major, udev->minor); retval = 0; exit: @@ -219,7 +219,7 @@ exit: int udev_add_device(char *path, char *subsystem) { - struct sysfs_class_device *class_dev; + struct sysfs_class_device *class_dev = NULL; struct udevice dev; int retval = -EINVAL; @@ -237,32 +237,28 @@ int udev_add_device(char *path, char *subsystem) if (class_dev == NULL) goto exit; - retval = namedev_name_device(class_dev, &dev); - if (retval) - return retval; - - retval = get_major_minor(class_dev, &dev.major, &dev.minor); + retval = get_major_minor(class_dev, &dev); if (retval) { dbg("get_major_minor failed"); goto exit; } -// strcpy(dev.name, attr.name); -// strcpy(dev.owner, attr.owner); -// strcpy(dev.group, attr.group); -// dev.mode = attr.mode; - + retval = namedev_name_device(class_dev, &dev); + if (retval) + goto exit; + retval = udevdb_add_dev(path, &dev); if (retval != 0) dbg("udevdb_add_dev failed, but we are going to try to create the node anyway. " "But remove might not work properly for this device."); - sysfs_close_class_device(class_dev); - dbg("name = %s", dev.name); retval = create_node(&dev); exit: + if (class_dev) + sysfs_close_class_device(class_dev); + return retval; } -- cgit v1.2.3-54-g00ecf From 98b88dbf704a1376ee4c79051086089adde5d626 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 18 Nov 2003 00:59:27 -0800 Subject: [PATCH] implement printf-like placeholder support for NAME > Problem is, if you use the LABEL rule to match a device, like a SCSI > vendor, then all of the partitions, as well as the main block device, > will end up with the same name. That's why I added the "add the number" > hack to the LABEL rule. > > So yes, your patch is correct in that we shouldn't always be adding the > number to any match for LABEL (like for char devices), but if we do > that, then we break partitions. Your '%' patch fixes this, but I'd just > like to extend it a bit. Let me see what I can come up with... Oh, I see. Do you mean something like this: LABEL, BUS="usb", model="Creative Labs WebCam 3", NAME="webcam%n-%M:%m-test" results in: "webcam0-81:0-test" Nov 15 16:51:53 pim udev[16193]: get_class_dev: looking at /sys/class/video4linux/video0 Nov 15 16:51:53 pim udev[16193]: get_class_dev: class_dev->name = video0 Nov 15 16:51:53 pim udev[16193]: get_major_minor: dev = 81:0 Nov 15 16:51:53 pim udev[16193]: get_major_minor: found major = 81, minor = 0 Nov 15 16:51:53 pim udev[16193]: udev_add_device: name = webcam0-81:0-test Nov 15 16:51:53 pim udev[16193]: create_node: mknod(/udev/webcam0-81:0-test, 020666, 81, 0) implement printf-like placeholder support for NAME %n-kernel number, %M-major number, %m-minor number --- namedev.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/namedev.c b/namedev.c index d76d03b490..f6be43ef51 100644 --- a/namedev.c +++ b/namedev.c @@ -817,6 +817,37 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) strcpy(udev->name, class_dev->name); done: + /* substitute placeholder in NAME */ + while (1) { + pos = strchr(udev->name, '%'); + if (pos) { + strcpy(name, pos+2); + *pos = 0x00; + switch (pos[1]) { + case 'n': + dig = class_dev->name + strlen(class_dev->name); + while (isdigit(*(dig-1))) + dig--; + strcat(udev->name, dig); + dbg_parse("kernel number appended: %s", dig); + break; + case 'm': + sprintf(pos, "%u", udev->minor); + dbg_parse("minor number appended: %u", udev->minor); + break; + case 'M': + sprintf(pos, "%u", udev->major); + dbg_parse("major number appended: %u", udev->major); + break; + default: + dbg_parse("unknown substitution type: %%%c", pos[1]); + break; + } + strcat(udev->name, name); + } else + break; + } + /* mode was never set above */ if (!udev->mode) { udev->mode = get_default_mode(class_dev); -- cgit v1.2.3-54-g00ecf From 7408a7fbb5885033d266b4b31c3abeb695820da3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 18 Nov 2003 01:07:21 -0800 Subject: [PATCH] fix up printf-like functionality due to previous changes. --- namedev.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/namedev.c b/namedev.c index f6be43ef51..6444dd0feb 100644 --- a/namedev.c +++ b/namedev.c @@ -601,10 +601,6 @@ label_found: continue; strcpy(udev->name, dev->name); - if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { - temp = &class_dev->path[strlen(class_dev->path)-1]; - strcat(udev->name, temp); - } if (dev->mode != 0) { udev->mode = dev->mode; strcpy(udev->owner, dev->owner); @@ -819,7 +815,9 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) done: /* substitute placeholder in NAME */ while (1) { - pos = strchr(udev->name, '%'); + char *pos = strchr(udev->name, '%'); + char *dig; + char name[NAME_SIZE]; if (pos) { strcpy(name, pos+2); *pos = 0x00; -- cgit v1.2.3-54-g00ecf From f54b927e8b926e23d1c9b811a1f4d17552c43389 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 18 Nov 2003 01:07:49 -0800 Subject: [PATCH] add printf option to label test to verify it works. --- test/label_test.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/label_test.config b/test/label_test.config index b317537bb6..a6d1c1cb3e 100644 --- a/test/label_test.config +++ b/test/label_test.config @@ -1,3 +1,3 @@ # LABEL test -LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk" +LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n" -- cgit v1.2.3-54-g00ecf From e366a459613ce9ff5c5155e93f3f09827dbb3815 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 18 Nov 2003 01:09:58 -0800 Subject: [PATCH] add demo config file. --- udev.config.demo | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 udev.config.demo diff --git a/udev.config.demo b/udev.config.demo new file mode 100644 index 0000000000..5cbde13ef4 --- /dev/null +++ b/udev.config.demo @@ -0,0 +1,9 @@ +# USB camera from Fuji to be named "camera" +LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera" + +# USB device plugged into the fourth port of the second hub to be called gps_device +TOPOLOGY, BUS="usb", place="2.4", NAME="gps_device" + +# ttyUSB1 should always be called visor +REPLACE, KERNEL="ttyUSB1", NAME="visor" + -- cgit v1.2.3-54-g00ecf From 85f3a7c3e0fbda61dde22d89a0dd74b49cc58d07 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 18 Nov 2003 01:12:31 -0800 Subject: [PATCH] add some documentation of the modifiers to the default config file. --- udev.config | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/udev.config b/udev.config index a0c6f9d1e8..324c11e55f 100644 --- a/udev.config +++ b/udev.config @@ -1,5 +1,13 @@ +# There are a number of modifiers that are allowed to be used in the NAME field. +# They provide the following subsitutions: +# %n - the "kernel number" of the device. +# for example, 'sda3' has a "kernel number" of '3' +# %M - the kernel major number for the device +# %m - the kernel minor number for the device +# + # My usb camera... -LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera" +LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera%n" # USB Epson printer to be called lp_epson LABEL, BUS="usb", serial="HXOLL0012202323480", NAME="lp_epson" -- cgit v1.2.3-54-g00ecf From fb2e1c4d6a03ee17978f4802572d1283885e3976 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 18 Nov 2003 01:15:11 -0800 Subject: [PATCH] updated demo config file. --- udev.config.demo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.config.demo b/udev.config.demo index 5cbde13ef4..6426ce2090 100644 --- a/udev.config.demo +++ b/udev.config.demo @@ -1,5 +1,5 @@ # USB camera from Fuji to be named "camera" -LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera" +LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera%n" # USB device plugged into the fourth port of the second hub to be called gps_device TOPOLOGY, BUS="usb", place="2.4", NAME="gps_device" -- cgit v1.2.3-54-g00ecf From 5e6e29fd355c037c73e00fa1be4043dcf441c537 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 18 Nov 2003 01:22:02 -0800 Subject: [PATCH] change debug level on printf values for now. --- namedev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/namedev.c b/namedev.c index 6444dd0feb..dc56432e67 100644 --- a/namedev.c +++ b/namedev.c @@ -827,18 +827,18 @@ done: while (isdigit(*(dig-1))) dig--; strcat(udev->name, dig); - dbg_parse("kernel number appended: %s", dig); + dbg("kernel number appended: %s", dig); break; case 'm': sprintf(pos, "%u", udev->minor); - dbg_parse("minor number appended: %u", udev->minor); + dbg("minor number appended: %u", udev->minor); break; case 'M': sprintf(pos, "%u", udev->major); - dbg_parse("major number appended: %u", udev->major); + dbg("major number appended: %u", udev->major); break; default: - dbg_parse("unknown substitution type: %%%c", pos[1]); + dbg("unknown substitution type: %%%c", pos[1]); break; } strcat(udev->name, name); -- cgit v1.2.3-54-g00ecf From 54e3a5d3ae475fadcac950d28bf69b8359212b9e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 18 Nov 2003 21:35:44 -0800 Subject: [PATCH] change release target in makefile. --- Makefile | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 01536f6986..f39fe22461 100644 --- a/Makefile +++ b/Makefile @@ -178,7 +178,19 @@ clean: DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . -release: $(DISTFILES) clean +release: clean + @echo "--------------------------cut here------------------------" + @echo "cd .." + @echo "rm -rf $(DISTDIR)" + @echo "mkdir $(DISTDIR)" + @echo "chmod 777 $(DISTDIR)" + @echo "cp -avr udev/* $(DISTDIR)" + @echo "tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz" + @echo "rm -rf $(DISTDIR)" + @echo "--------------------------cut here------------------------" + + +small_release: $(DISTFILES) clean # @echo $(DISTFILES) @-rm -rf $(DISTDIR) @mkdir $(DISTDIR) -- cgit v1.2.3-54-g00ecf From ae2859df40ef80d15dff39fadd470a8541bab857 Mon Sep 17 00:00:00 2001 From: "arnd@arndb.de" Date: Tue, 18 Nov 2003 21:36:10 -0800 Subject: [PATCH] add bus id modifier On Tuesday 18 November 2003 02:14, Greg KH wrote: > On Mon, Nov 17, 2003 at 06:33:32PM +0100, Arnd Bergmann wrote: > > That would at least be part of the solution I'm looking for. How about > > extra format characters for bus_id and for the result of a callout > > program? > > Sure, I can see the use for that. Want to send a patch? :) > Take a look at the current bk tree (which has moved to > bk://linuxusb.bkbits.net/udev/ ) I've made finding that device a lot > easier now, and it works for all rule types. Great, just what I was missing. I didn't see the any link to the bk repository. Here's the patch for the bus_id. I'll need to think about the handling of callout results a bit more. --- namedev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/namedev.c b/namedev.c index dc56432e67..5970ef0590 100644 --- a/namedev.c +++ b/namedev.c @@ -822,6 +822,13 @@ done: strcpy(name, pos+2); *pos = 0x00; switch (pos[1]) { + case 'b': + if (!sysfs_device) + break; + strcat(udev->name, sysfs_device->bus_id); + dbg("bus_id appended: %s", + sysfs_device->bus_id); + break; case 'n': dig = class_dev->name + strlen(class_dev->name); while (isdigit(*(dig-1))) -- cgit v1.2.3-54-g00ecf From 70033702cda3b13150426cd176a31713d48394d9 Mon Sep 17 00:00:00 2001 From: "arnd@arndb.de" Date: Tue, 18 Nov 2003 21:39:30 -0800 Subject: [PATCH] more robust config file parsing in namedev.c After getting a number of different crashes for udev reading broken udev.config files, I decided to try to make the parser a little more robust. The behaviour is changed to stop reading the configuration file and logging the broken entry instead of silently ignoring it (is that good? It's easy to just print and continue). All strcpy()'s to a fixed length string are now implicitly limited to the bounds of the target string. I kept the -ENODEV return code for now, not sure if there should be different ones. --- namedev.c | 159 +++++++++++++++++++++++++++++++------------------------------- udev.h | 6 +++ 2 files changed, 86 insertions(+), 79 deletions(-) diff --git a/namedev.c b/namedev.c index 5970ef0590..a9d66bcad7 100644 --- a/namedev.c +++ b/namedev.c @@ -144,37 +144,15 @@ static void dump_dev_list(void) dump_dev(dev); } } - -static int get_value(const char *left, char **orig_string, char **ret_string) -{ - char *temp; - char *string = *orig_string; - - /* eat any whitespace */ - while (isspace(*string)) - ++string; - - /* split based on '=' */ - temp = strsep(&string, "="); - if (strcasecmp(temp, left) == 0) { - /* got it, now strip off the '"' */ - while (isspace(*string)) - ++string; - if (*string == '"') - ++string; - temp = strsep(&string, "\""); - *ret_string = temp; - *orig_string = string; - return 0; - } - return -ENODEV; -} static int get_pair(char **orig_string, char **left, char **right) { char *temp; char *string = *orig_string; + if (!string) + return -ENODEV; + /* eat any whitespace */ while (isspace(*string)) ++string; @@ -182,22 +160,43 @@ static int get_pair(char **orig_string, char **left, char **right) /* split based on '=' */ temp = strsep(&string, "="); *left = temp; + if (!string) + return -ENODEV; /* take the right side and strip off the '"' */ while (isspace(*string)) ++string; if (*string == '"') ++string; + else + return -ENODEV; + temp = strsep(&string, "\""); + if (!string || *temp == '\0') + return -ENODEV; *right = temp; *orig_string = string; return 0; } +static int get_value(const char *left, char **orig_string, char **ret_string) +{ + int retval; + char *left_string; + + retval = get_pair(orig_string, &left_string, ret_string); + if (retval) + return retval; + if (strcasecmp(left_string, left) != 0) + return -ENODEV; + return 0; +} + static int namedev_init_config(void) { char line[255]; + int lineno; char *temp; char *temp2; char *temp3; @@ -213,11 +212,13 @@ static int namedev_init_config(void) } /* loop through the whole file */ + lineno = 0; while (1) { /* get a line */ temp = fgets(line, sizeof(line), fd); if (temp == NULL) - break; + goto exit; + lineno++; dbg_parse("read %s", temp); @@ -244,23 +245,23 @@ static int namedev_init_config(void) /* BUS="bus" */ retval = get_value("BUS", &temp, &temp3); if (retval) - continue; - strcpy(dev.bus, temp3); + break; + strfieldcpy(dev.bus, temp3); /* file="value" */ temp2 = strsep(&temp, ","); retval = get_pair(&temp, &temp2, &temp3); if (retval) - continue; - strcpy(dev.sysfs_file, temp2); - strcpy(dev.sysfs_value, temp3); + break; + strfieldcpy(dev.sysfs_file, temp2); + strfieldcpy(dev.sysfs_value, temp3); /* NAME="new_name" */ temp2 = strsep(&temp, ","); retval = get_value("NAME", &temp, &temp3); if (retval) - continue; - strcpy(dev.name, temp3); + break; + strfieldcpy(dev.name, temp3); dbg_parse("LABEL name = '%s', bus = '%s', " "sysfs_file = '%s', sysfs_value = '%s'", @@ -275,22 +276,22 @@ static int namedev_init_config(void) /* BUS="bus" */ retval = get_value("BUS", &temp, &temp3); if (retval) - continue; - strcpy(dev.bus, temp3); + break; + strfieldcpy(dev.bus, temp3); /* ID="id" */ temp2 = strsep(&temp, ","); retval = get_value("id", &temp, &temp3); if (retval) - continue; - strcpy(dev.id, temp3); + break; + strfieldcpy(dev.id, temp3); /* NAME="new_name" */ temp2 = strsep(&temp, ","); retval = get_value("NAME", &temp, &temp3); if (retval) - continue; - strcpy(dev.name, temp3); + break; + strfieldcpy(dev.name, temp3); dbg_parse("NUMBER name = '%s', bus = '%s', id = '%s'", dev.name, dev.bus, dev.id); @@ -303,22 +304,22 @@ static int namedev_init_config(void) /* BUS="bus" */ retval = get_value("BUS", &temp, &temp3); if (retval) - continue; - strcpy(dev.bus, temp3); + break; + strfieldcpy(dev.bus, temp3); /* PLACE="place" */ temp2 = strsep(&temp, ","); retval = get_value("place", &temp, &temp3); if (retval) - continue; - strcpy(dev.place, temp3); + break; + strfieldcpy(dev.place, temp3); /* NAME="new_name" */ temp2 = strsep(&temp, ","); retval = get_value("NAME", &temp, &temp3); if (retval) - continue; - strcpy(dev.name, temp3); + break; + strfieldcpy(dev.name, temp3); dbg_parse("TOPOLOGY name = '%s', bus = '%s', place = '%s'", dev.name, dev.bus, dev.place); @@ -331,15 +332,15 @@ static int namedev_init_config(void) /* KERNEL="kernel_name" */ retval = get_value("KERNEL", &temp, &temp3); if (retval) - continue; - strcpy(dev.kernel_name, temp3); + break; + strfieldcpy(dev.kernel_name, temp3); /* NAME="new_name" */ temp2 = strsep(&temp, ","); retval = get_value("NAME", &temp, &temp3); if (retval) - continue; - strcpy(dev.name, temp3); + break; + strfieldcpy(dev.name, temp3); dbg_parse("REPLACE name = %s, kernel_name = %s", dev.name, dev.kernel_name); } @@ -350,29 +351,29 @@ static int namedev_init_config(void) /* PROGRAM="executable" */ retval = get_value("PROGRAM", &temp, &temp3); if (retval) - continue; - strcpy(dev.exec_program, temp3); + break; + strfieldcpy(dev.exec_program, temp3); /* BUS="bus" */ temp2 = strsep(&temp, ","); retval = get_value("BUS", &temp, &temp3); if (retval) - continue; - strcpy(dev.bus, temp3); + break; + strfieldcpy(dev.bus, temp3); /* ID="id" */ temp2 = strsep(&temp, ","); retval = get_value("ID", &temp, &temp3); if (retval) - continue; - strcpy(dev.id, temp3); + break; + strfieldcpy(dev.id, temp3); /* NAME="new_name" */ temp2 = strsep(&temp, ","); retval = get_value("NAME", &temp, &temp3); if (retval) - continue; - strcpy(dev.name, temp3); + break; + strfieldcpy(dev.name, temp3); dbg_parse("CALLOUT name = %s, program = %s", dev.name, dev.exec_program); } @@ -383,7 +384,8 @@ static int namedev_init_config(void) goto exit; } } - + dbg_parse("%s:%d:%Zd: error parsing ``%s''", udev_config_filename, + lineno, temp - line, temp); exit: fclose(fd); return retval; @@ -552,11 +554,11 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev continue; if (strncmp(value, dev->id, sizeof(value)) != 0) continue; - strcpy(udev->name, dev->name); + strfieldcpy(udev->name, dev->name); if (dev->mode != 0) { udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); + strfieldcpy(udev->owner, dev->owner); + strfieldcpy(udev->group, dev->group); } dbg_parse("device callout '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->id, udev->name, @@ -571,7 +573,6 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_attribute *tmpattr = NULL; struct config_device *dev; struct list_head *tmp; - char *temp = NULL; list_for_each(tmp, &config_device_list) { dev = list_entry(tmp, struct config_device, node); @@ -600,11 +601,11 @@ label_found: if (strcmp(dev->sysfs_value, tmpattr->value) != 0) continue; - strcpy(udev->name, dev->name); + strfieldcpy(udev->name, dev->name); if (dev->mode != 0) { udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); + strfieldcpy(udev->owner, dev->owner); + strfieldcpy(udev->group, dev->group); } dbg_parse("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->sysfs_file, dev->sysfs_value, udev->name, @@ -633,7 +634,7 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, continue; found = 0; - strcpy(path, sysfs_device->path); + strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg_parse("NUMBER path = '%s'", path); dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); @@ -648,11 +649,11 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, } if (!found) continue; - strcpy(udev->name, dev->name); + strfieldcpy(udev->name, dev->name); if (dev->mode != 0) { udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); + strfieldcpy(udev->owner, dev->owner); + strfieldcpy(udev->group, dev->group); } dbg_parse("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->id, udev->name, @@ -681,7 +682,7 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude continue; found = 0; - strcpy(path, sysfs_device->path); + strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg_parse("TOPOLOGY path = '%s'", path); dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); @@ -697,11 +698,11 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude if (!found) continue; - strcpy(udev->name, dev->name); + strfieldcpy(udev->name, dev->name); if (dev->mode != 0) { udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); + strfieldcpy(udev->owner, dev->owner); + strfieldcpy(udev->group, dev->group); } dbg_parse("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->place, udev->name, @@ -727,11 +728,11 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev if (strcmp(dev->kernel_name, class_dev->name) != 0) continue; - strcpy(udev->name, dev->name); + strfieldcpy(udev->name, dev->name); if (dev->mode != 0) { udev->mode = dev->mode; - strcpy(udev->owner, dev->owner); - strcpy(udev->group, dev->group); + strfieldcpy(udev->owner, dev->owner); + strfieldcpy(udev->group, dev->group); } dbg_parse("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o", dev->kernel_name, udev->name, @@ -766,7 +767,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) char path[SYSFS_PATH_MAX]; dbg_parse("really is a partition..."); - strcpy(path, class_dev->path); + strfieldcpy(path, class_dev->path); temp = strrchr(path, '/'); *temp = 0x00; dbg_parse("looking for a class device at '%s'", path); @@ -810,7 +811,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) if (retval == 0) goto done; - strcpy(udev->name, class_dev->name); + strfieldcpy(udev->name, class_dev->name); done: /* substitute placeholder in NAME */ @@ -819,7 +820,7 @@ done: char *dig; char name[NAME_SIZE]; if (pos) { - strcpy(name, pos+2); + strfieldcpy(name, pos+2); *pos = 0x00; switch (pos[1]) { case 'b': diff --git a/udev.h b/udev.h index cdf1af4fc2..904948d67a 100644 --- a/udev.h +++ b/udev.h @@ -70,6 +70,12 @@ struct udevice { mode_t mode; }; +#define strfieldcpy(to, from) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + strncpy(to, from, sizeof(to)-1); \ +} while (0) + extern int udev_add_device(char *path, char *subsystem); extern int udev_remove_device(char *path, char *subsystem); -- cgit v1.2.3-54-g00ecf From baa936855ece1b8ce0343c7c38b7d12b0a34455c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 18 Nov 2003 21:45:46 -0800 Subject: [PATCH] fix make install rule for when the udev symlink is already there. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index f39fe22461..cd539eeb74 100644 --- a/Makefile +++ b/Makefile @@ -215,6 +215,7 @@ install: all $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) udev.config $(DESTDIR)$(configdir) $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir) + - rm $(DESTDIR)$(hotplugdir)/udev.hotplug - ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug uninstall: -- cgit v1.2.3-54-g00ecf From c34c7c5018a4023d39f6ea4c778218e0d3e0f035 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 18 Nov 2003 22:48:46 -0800 Subject: [PATCH] add some documentation for the %b modifier to the default config file. --- udev.config | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev.config b/udev.config index 324c11e55f..8d77099ca8 100644 --- a/udev.config +++ b/udev.config @@ -4,6 +4,7 @@ # for example, 'sda3' has a "kernel number" of '3' # %M - the kernel major number for the device # %m - the kernel minor number for the device +# %b - the bus id for the device # # My usb camera... @@ -30,5 +31,5 @@ TOPOLOGY, BUS="usb", place="2.4", NAME="mouse2" # ttyUSB1 should always be called visor REPLACE, KERNEL="ttyUSB1", NAME="visor" -#REPLACE, KERNEL="ttyUSB0", NAME="pl2303" +REPLACE, KERNEL="ttyUSB0", NAME="pl2303" -- cgit v1.2.3-54-g00ecf From a43180955a49a6838f7ce564db3cc1d10f36b8fb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 00:27:38 -0800 Subject: [PATCH] turn DEBUG_PARSER off by default. --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index a9d66bcad7..ccc675064d 100644 --- a/namedev.c +++ b/namedev.c @@ -22,7 +22,7 @@ */ /* define this to enable parsing debugging */ -#define DEBUG_PARSER +/* #define DEBUG_PARSER */ #include #include -- cgit v1.2.3-54-g00ecf From 1ac5204774c4080d16f308ac3077db0dae8d221c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 00:39:43 -0800 Subject: [PATCH] add remove actions to the test scripts --- test/label_test | 13 +++++++++++++ test/replace_test | 7 +++++++ test/topo_test | 12 ++++++++++++ test/topo_test.config | 2 +- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/test/label_test b/test/label_test index faa516fdce..0bf89226cb 100644 --- a/test/label_test +++ b/test/label_test @@ -12,9 +12,22 @@ export ACTION=add export DEVPATH=block/sda ../udev block +ls udev export DEVPATH=block/sda/sda3 ../udev block +ls udev + +export ACTION=remove +export DEVPATH=block/sda + +../udev block +ls udev + +export DEVPATH=block/sda/sda3 + +../udev block +ls udev diff --git a/test/replace_test b/test/replace_test index 3aa8d5a8c9..0caa4dfb3d 100644 --- a/test/replace_test +++ b/test/replace_test @@ -12,3 +12,10 @@ export DEVPATH=class/tty/ttyUSB0 export ACTION=add ../udev tty +ls udev + +export ACTION=remove +../udev tty +ls udev + + diff --git a/test/topo_test b/test/topo_test index 5a557e909d..2a19c8b5f8 100644 --- a/test/topo_test +++ b/test/topo_test @@ -12,9 +12,21 @@ export ACTION=add export DEVPATH=block/sda ../udev block +ls udev export DEVPATH=block/sda/sda3 ../udev block +ls udev +export ACTION=remove +export DEVPATH=block/sda + +../udev block +ls udev + +export DEVPATH=block/sda/sda3 + +../udev block +ls udev diff --git a/test/topo_test.config b/test/topo_test.config index d7ae92b080..72f03ee0b2 100644 --- a/test/topo_test.config +++ b/test/topo_test.config @@ -1,3 +1,3 @@ # TOPO test -TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="first_disk" +TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="first_disk%n" -- cgit v1.2.3-54-g00ecf From 17f73597fe88d60da3d105907dc45f753be42912 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 00:40:39 -0800 Subject: [PATCH] move the test.block and test.tty scripts to the test/ directory --- test.block | 30 ------------------------------ test.tty | 20 -------------------- test/test.block | 30 ++++++++++++++++++++++++++++++ test/test.tty | 20 ++++++++++++++++++++ 4 files changed, 50 insertions(+), 50 deletions(-) delete mode 100644 test.block delete mode 100644 test.tty create mode 100644 test/test.block create mode 100644 test/test.tty diff --git a/test.block b/test.block deleted file mode 100644 index 622a66037f..0000000000 --- a/test.block +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh -# -# test.block - run udev(8) on each block device in /sys/block - -if [ $# = "0" ] ; then - echo - echo "usage: $0 " - echo "where is \"add\" or \"remove\"" - echo - exit 1 -fi - -SYSFSDIR=/sys # change this for a nonstand sysfs mount point -BIN=./udev # location of your udev binary -export ACTION=$1 # 'add' or 'remove' - -for i in ${SYSFSDIR}/block/*; do - # add each drive - export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` - $BIN block - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH="/"`echo $j | \ - cut --delimiter='/' --fields=3-` - $BIN block - fi - done -done diff --git a/test.tty b/test.tty deleted file mode 100644 index d5e2d6715d..0000000000 --- a/test.tty +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/sh -# -# test.tty - run udev(8) on each tty device in /sys/class/tty - -if [ $# = "0" ] ; then - echo - echo "usage: $0 " - echo "where is \"add\" or \"remove\"" - echo - exit 1 -fi - -SYSFSDIR=/sys # change this for a nonstand sysfs mount point -BIN=./udev # location of your udev binary -export ACTION=$1 # 'add' or 'remove' - -for i in ${SYSFSDIR}/class/tty/*; do - export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` - $BIN tty -done diff --git a/test/test.block b/test/test.block new file mode 100644 index 0000000000..622a66037f --- /dev/null +++ b/test/test.block @@ -0,0 +1,30 @@ +#! /bin/sh +# +# test.block - run udev(8) on each block device in /sys/block + +if [ $# = "0" ] ; then + echo + echo "usage: $0 " + echo "where is \"add\" or \"remove\"" + echo + exit 1 +fi + +SYSFSDIR=/sys # change this for a nonstand sysfs mount point +BIN=./udev # location of your udev binary +export ACTION=$1 # 'add' or 'remove' + +for i in ${SYSFSDIR}/block/*; do + # add each drive + export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + $BIN block + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH="/"`echo $j | \ + cut --delimiter='/' --fields=3-` + $BIN block + fi + done +done diff --git a/test/test.tty b/test/test.tty new file mode 100644 index 0000000000..d5e2d6715d --- /dev/null +++ b/test/test.tty @@ -0,0 +1,20 @@ +#! /bin/sh +# +# test.tty - run udev(8) on each tty device in /sys/class/tty + +if [ $# = "0" ] ; then + echo + echo "usage: $0 " + echo "where is \"add\" or \"remove\"" + echo + exit 1 +fi + +SYSFSDIR=/sys # change this for a nonstand sysfs mount point +BIN=./udev # location of your udev binary +export ACTION=$1 # 'add' or 'remove' + +for i in ${SYSFSDIR}/class/tty/*; do + export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + $BIN tty +done -- cgit v1.2.3-54-g00ecf From 8e5d5925254ea60ce487ba8660d99c7a50481ea6 Mon Sep 17 00:00:00 2001 From: "chris_friesen@sympatico.ca" Date: Wed, 19 Nov 2003 02:39:39 -0800 Subject: [PATCH] faster test scripts I've attached a patch against 005 for both the block and tty scripts. I didn't bother running udev backgrounded, since as you say, the new code runs a lot faster. --- test/test.block | 5 ++--- test/test.tty | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/test/test.block b/test/test.block index 622a66037f..b806a42aac 100644 --- a/test/test.block +++ b/test/test.block @@ -16,14 +16,13 @@ export ACTION=$1 # 'add' or 'remove' for i in ${SYSFSDIR}/block/*; do # add each drive - export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + export DEVPATH=${i#${SYSFSDIR}} $BIN block # add each partition, on each device for j in $i/*; do if [ -f $j/dev ]; then - export DEVPATH="/"`echo $j | \ - cut --delimiter='/' --fields=3-` + export DEVPATH=${j#${SYSFSDIR}} $BIN block fi done diff --git a/test/test.tty b/test/test.tty index d5e2d6715d..42f46a2e7c 100644 --- a/test/test.tty +++ b/test/test.tty @@ -15,6 +15,6 @@ BIN=./udev # location of your udev binary export ACTION=$1 # 'add' or 'remove' for i in ${SYSFSDIR}/class/tty/*; do - export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + export DEVPATH=${i#${SYSFSDIR}} $BIN tty done -- cgit v1.2.3-54-g00ecf From cd55637f42c5be117b0495746625e095059f4b5a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 02:48:57 -0800 Subject: [PATCH] update the TODO list with more items that people can easily do. --- TODO | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/TODO b/TODO index 927f964a0b..4f5db9a982 100644 --- a/TODO +++ b/TODO @@ -6,6 +6,12 @@ greg k-h greg@kroah.com +- add modifiers and more documentation about the config file to the man + page. +- add ability to capture CALLOUT result and use it in a device name. +- fix kernel name logic to handle devices like sdaj and such. +- make real test harness and have the tests be automated (instead of + relying on me knowing what the proper files should be created.) - more documentation (can never have too much.) - document the config file format (it will change over time...) - add symlink generation and removal support -- cgit v1.2.3-54-g00ecf From db7a38df63130fedcb937961886eff1c93c98139 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 02:49:29 -0800 Subject: [PATCH] add dumb test for all of the different modifiers. --- test/modifier_test | 32 ++++++++++++++++++++++++++++++++ test/modifier_test.config | 3 +++ 2 files changed, 35 insertions(+) create mode 100644 test/modifier_test create mode 100644 test/modifier_test.config diff --git a/test/modifier_test b/test/modifier_test new file mode 100644 index 0000000000..3dcd4454fc --- /dev/null +++ b/test/modifier_test @@ -0,0 +1,32 @@ +#!/bin/bash + +export UDEV_TEST=yes +export SYSFS_PATH=$PWD/sys/ +export UDEV_CONFIG_DIR=$PWD/ +export UDEV_ROOT=$PWD/udev/ +export UDEV_DB=udev.tdb +export UDEV_CONFIG_FILE=modifier_test.config +export UDEV_PERMISSION_FILE=udev.permissions + +export ACTION=add +export DEVPATH=block/sda + +../udev block +ls udev + +export DEVPATH=block/sda/sda3 + +../udev block +ls udev + +export ACTION=remove +export DEVPATH=block/sda + +../udev block +ls udev + +export DEVPATH=block/sda/sda3 + +../udev block +ls udev + diff --git a/test/modifier_test.config b/test/modifier_test.config new file mode 100644 index 0000000000..f63e02c3ac --- /dev/null +++ b/test/modifier_test.config @@ -0,0 +1,3 @@ +# TOPO test +TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" + -- cgit v1.2.3-54-g00ecf From 4b710f033e86c72dbcae345564257f3ecce9941b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 19 Nov 2003 06:18:54 -0800 Subject: [PATCH] man page with included placeholder list mention the printf-like support for string substitution in the NAME field --- udev.8 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/udev.8 b/udev.8 index 79b74bf659..0dacde0f5c 100644 --- a/udev.8 +++ b/udev.8 @@ -72,6 +72,23 @@ calling external program, that returns a string to match .br keys: \fBBUS\fP, \fBPROGRAM\fP, \fBID\fP .P +The name field supports simple printf-like string subtitution: +.RS +.TP +.B %n +the "kernel number" of the device +for example, 'sda3' has a "kernel number" of '3' +.TP +.B %M +the kernel major number for the device +.TP +.B %m +the kernel minor number for the device +.TP +.B %b +the bus id for the device +.RE +.P A sample \fIudev.conf\fP might look like this: .sp .nf @@ -89,6 +106,9 @@ REPLACE, KERNEL="ttyUSB1", NAME="pda" # if /sbin/scsi_id returns "OEM 0815" device will be called disk1 CALLOUT, PROGRAM="/sbin/scsi_id" BUS="scsi", ID="OEM 0815" NAME="disk1" + +# USB webcams to be called webcam0, webcam1, ... +LABEL, BUS="usb", model="WebCam Version 3", NAME="webcam%n" .fi .P Permissions and ownership for the created device files may specified at -- cgit v1.2.3-54-g00ecf From 09e52d51264080fab7062a1b4a405e526f299bc7 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 19 Nov 2003 06:19:06 -0800 Subject: [PATCH] apply permissions.conf support for wildcard and default name Permissions given in udev.permissions are not applied if no METHOD from udev.config is found. I've added do_kernelname() to scan for known permissions if we only use the default method. Simple support for wildcards is also added: #name:user:group:mode hdb*:2702:2702:0660 results in: drwxr-xr-x 2 root root 240 Nov 19 03:45 . drwxr-xr-x 23 root root 528 Nov 17 03:36 .. brw-r--r-- 1 root root 3, 0 Nov 19 03:45 hda brw-r--r-- 1 root root 3, 1 Nov 19 03:45 hda1 brw-r--r-- 1 root root 3, 2 Nov 19 03:45 hda2 brw-r--r-- 1 root root 3, 4 Nov 19 03:45 hda4 brw-r----- 1 kay kay 3, 64 Nov 19 03:45 hdb brw-r----- 1 kay kay 3, 65 Nov 19 03:45 hdb1 brw-r--r-- 1 root root 22, 0 Nov 19 03:45 hdc crw-r--r-- 1 root root 81, 0 Nov 19 03:34 webcam0 --- namedev.c | 78 +++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 22 deletions(-) diff --git a/namedev.c b/namedev.c index ccc675064d..223fd6de1d 100644 --- a/namedev.c +++ b/namedev.c @@ -105,24 +105,30 @@ static int add_dev(struct config_device *new_dev) struct list_head *tmp; struct config_device *tmp_dev; - /* loop through the whole list of devices to see if we already have - * this one... */ + /* update the values if we already have the device */ list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); - if (strcmp(dev->name, new_dev->name) == 0) { - /* the same, copy the new info into this structure */ - copy_var(dev, new_dev, type); - copy_var(dev, new_dev, mode); - copy_string(dev, new_dev, bus); - copy_string(dev, new_dev, sysfs_file); - copy_string(dev, new_dev, sysfs_value); - copy_string(dev, new_dev, id); - copy_string(dev, new_dev, place); - copy_string(dev, new_dev, kernel_name); - copy_string(dev, new_dev, owner); - copy_string(dev, new_dev, group); - return 0; + int len = strlen(new_dev->name); + if (new_dev->name[len-1] == '*') { + len--; + if (strncmp(dev->name, new_dev->name, len)) + continue; + } else { + if (strcmp(dev->name, new_dev->name)) + continue; } + /* the same, copy the new info into this structure */ + copy_var(dev, new_dev, type); + copy_var(dev, new_dev, mode); + copy_string(dev, new_dev, bus); + copy_string(dev, new_dev, sysfs_file); + copy_string(dev, new_dev, sysfs_value); + copy_string(dev, new_dev, id); + copy_string(dev, new_dev, place); + copy_string(dev, new_dev, kernel_name); + copy_string(dev, new_dev, owner); + copy_string(dev, new_dev, group); + return 0; } /* not found, lets create a new structure, and add it to the list */ @@ -743,6 +749,32 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev return -ENODEV; } +static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice *udev) +{ + struct config_device *dev; + struct list_head *tmp; + + strfieldcpy(udev->name, class_dev->name); + list_for_each(tmp, &config_device_list) { + dev = list_entry(tmp, struct config_device, node); + int len = strlen(dev->name); + if (dev->name[len-1] == '*') { + len--; + if (strncmp(dev->name, class_dev->name, len)) + continue; + } else { + if (strcmp(dev->name, class_dev->name)) + continue; + } + if (dev->mode != 0) { + dbg_parse("found permissions from config for '%s'", class_dev->name); + udev->mode = dev->mode; + strfieldcpy(udev->owner, dev->owner); + strfieldcpy(udev->group, dev->group); + } + } +} + static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) { struct sysfs_device *sysfs_device = NULL; @@ -793,27 +825,28 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) /* rules are looked at in priority order */ retval = do_callout(class_dev, udev); if (retval == 0) - goto done; + goto found; retval = do_label(class_dev, udev, sysfs_device); if (retval == 0) - goto done; + goto found; retval = do_number(class_dev, udev, sysfs_device); if (retval == 0) - goto done; + goto found; retval = do_topology(class_dev, udev, sysfs_device); if (retval == 0) - goto done; + goto found; retval = do_replace(class_dev, udev); if (retval == 0) - goto done; + goto found; - strfieldcpy(udev->name, class_dev->name); + do_kernelname(class_dev, udev); + goto done; -done: +found: /* substitute placeholder in NAME */ while (1) { char *pos = strchr(udev->name, '%'); @@ -854,6 +887,7 @@ done: break; } +done: /* mode was never set above */ if (!udev->mode) { udev->mode = get_default_mode(class_dev); -- cgit v1.2.3-54-g00ecf From a1b8786ae64c3bfeb92def5a7c11ed0aa1915358 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 06:38:18 -0800 Subject: [PATCH] fix namedev.c to build with older version of gcc. --- namedev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 223fd6de1d..9a556cb83d 100644 --- a/namedev.c +++ b/namedev.c @@ -753,11 +753,12 @@ static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice * { struct config_device *dev; struct list_head *tmp; + int len; strfieldcpy(udev->name, class_dev->name); list_for_each(tmp, &config_device_list) { dev = list_entry(tmp, struct config_device, node); - int len = strlen(dev->name); + len = strlen(dev->name); if (dev->name[len-1] == '*') { len--; if (strncmp(dev->name, class_dev->name, len)) -- cgit v1.2.3-54-g00ecf From 3258c8288784e94094dc491e8b280238d62b3e5c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 06:38:45 -0800 Subject: [PATCH] add real udev.permissions file to test directory. --- test/udev.permissions | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 test/udev.permissions diff --git a/test/udev.permissions b/test/udev.permissions new file mode 100644 index 0000000000..d14082ac05 --- /dev/null +++ b/test/udev.permissions @@ -0,0 +1,6 @@ +#name:user:group:mode +ttyUSB0:root:uucp:0660 +ttyUSB1:root:uucp:0666 +visor:500:500:0666 +dsp1:::0666 + -- cgit v1.2.3-54-g00ecf From 5bd1061cd67dea7ebc5a061365335b394f37b122 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 09:23:24 -0800 Subject: [PATCH] fix permissions to work properly now. Forgot about umask in mknod... --- udev-add.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/udev-add.c b/udev-add.c index 6f0e3bf105..7ba873a8d4 100644 --- a/udev-add.c +++ b/udev-add.c @@ -135,6 +135,12 @@ static int create_node(struct udevice *dev) dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", filename, dev->mode, dev->major, dev->minor, strerror(errno)); + dbg("chmod(%s, %#o)", filename, dev->mode); + retval = chmod(filename, dev->mode); + if (retval) + dbg("chmod(%s, %#o) failed with error '%s'", + filename, dev->mode, strerror(errno)); + if (*dev->owner) { char *endptr; unsigned long id = strtoul(dev->owner, &endptr, 10); -- cgit v1.2.3-54-g00ecf From d6d413dab79ed03e0531f90fb42a85baacd6e9b5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 09:24:56 -0800 Subject: [PATCH] tweak replace_test --- test/replace_test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/replace_test b/test/replace_test index 0caa4dfb3d..c8e54f8f8d 100644 --- a/test/replace_test +++ b/test/replace_test @@ -12,10 +12,10 @@ export DEVPATH=class/tty/ttyUSB0 export ACTION=add ../udev tty -ls udev +ls -l udev export ACTION=remove ../udev tty -ls udev +ls -l udev -- cgit v1.2.3-54-g00ecf From 4d595658c7fb5402e48c1fafc8926c600c330585 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 09:25:19 -0800 Subject: [PATCH] add another line to udev.permissions in the proper format. --- udev.permissions | 1 + 1 file changed, 1 insertion(+) diff --git a/udev.permissions b/udev.permissions index 66d8af1f7a..7de9bc16e4 100644 --- a/udev.permissions +++ b/udev.permissions @@ -1,6 +1,7 @@ #name:user:group:mode ttyUSB0:root:uucp:0660 ttyUSB1:root:uucp:0666 +pl2303:500:500:0666 visor:root:uucp:0666 dsp1:::0666 -- cgit v1.2.3-54-g00ecf From b981d07a19fdd9fc382a42bda98f19b857f8a36f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 09:34:53 -0800 Subject: [PATCH] v006 changelog --- ChangeLog | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/ChangeLog b/ChangeLog index b8fdf91c23..c1cf43bdc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,78 @@ +Summary of changes from v005 to v006 +============================================ + +: + o faster test scripts + +Arnd Bergmann: + o more robust config file parsing in namedev.c + o add bus id modifier + +Daniel E. F. Stekloff: + o patch for libsysfs sysfs directory handling + +Greg Kroah-Hartman: + o add another line to udev.permissions in the proper format + o tweak replace_test + o fix permissions to work properly now + o add real udev.permissions file to test directory + o fix namedev.c to build with older version of gcc + o add dumb test for all of the different modifiers + o update the TODO list with more items that people can easily do + o move the test.block and test.tty scripts to the test/ directory + o add remove actions to the test scripts + o turn DEBUG_PARSER off by default + o add some documentation for the %b modifier to the default config file + o fix make install rule for when the udev symlink is already there + o change release target in makefile + o change debug level on printf values for now + o updated demo config file + o add some documentation of the modifiers to the default config file + o add demo config file + o updated bk ignore list for klibc generated files + o add printf option to label test to verify it works + o fix up printf-like functionality due to previous changes + o get the major/minor number before we name the device + o add scsi_id "extra" program from Patrick Mansfield + o Add multipath "extra" program from Christophe Varoqui, + o trailing whitespace cleanups + o splig LABEL and NUMBER into separate functions + o add TOPO regression test + o move TOPOLOGY rule to it's own function + o fix bug where NUMBER and TOPOLOGY would not work for partitions + o clean up the way we find the sysdevice for a block device for namedev + o updated label test script (tests for partitions now.) + o split REPLACE and CALLOUT into separate functions + o add debug line for REPLACE call + o add replace test + o add more sysfs test tree files + o change UDEV_SYSFS_PATH environment variable due to libsysfs change + o fix bug in klibc's isspace function + o fix udev-add.c to build properly with older versions of gcc + o add prototype for ftruncate to klibc + o Remove a few items from the TODO list that are already done + o version number to 005_bk + o pull some klibc stuff into the make Makefile to try to stay in sync + o klibc build fixes + +Kay Sievers: + o apply permissions.conf support for wildcard and default name + o man page with included placeholder list + o implement printf-like placeholder support for NAME + o more manpage tweaks + o add support for subdirs + o add uid/gid to nodes + +Olaf Hering: + o DESTDIR for udev + +Paul Mundt: + o Fixup path for kernel includes when building with klibc + +Robert Love: + o udev init script + + Summary of changes from v004 to v005 ============================================ @@ -184,3 +259,4 @@ Greg Kroah-Hartman: o fixed up config o Initial repository create o BitKeeper file /home/greg/src/udev/udev/ChangeSet + -- cgit v1.2.3-54-g00ecf From 378fe59875327bc4f51e38724ab7406edd36aa16 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Nov 2003 09:35:52 -0800 Subject: [PATCH] v006 --- Makefile | 2 +- Makefile.klibc | 2 +- udev.spec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cd539eeb74..91ad58bc3b 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 005_bk +VERSION = 006 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/Makefile.klibc b/Makefile.klibc index df1e55b436..faf6521045 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 005_bk +VERSION = 006 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index c6ebefc998..f342fbb1a8 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 005_bk +Version: 006 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 95d3e90130681bd4a35f79bf0591b08390bea6bb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 20 Nov 2003 18:35:01 -0800 Subject: [PATCH] change to 006_bk version --- Makefile | 2 +- Makefile.klibc | 2 +- udev.spec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 91ad58bc3b..fa29c8859b 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 006 +VERSION = 006_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/Makefile.klibc b/Makefile.klibc index faf6521045..e0961df718 100644 --- a/Makefile.klibc +++ b/Makefile.klibc @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 006 +VERSION = 006_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index f342fbb1a8..4da7e8808f 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 006 +Version: 006_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From d0a4a110b719faafb07aa6e7a2bd5a131e8af38f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 20 Nov 2003 18:36:55 -0800 Subject: [PATCH] man page with udev.permissions wildcard here is the permissions wildcard text for the man page. --- udev.8 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/udev.8 b/udev.8 index 0dacde0f5c..e46caaf322 100644 --- a/udev.8 +++ b/udev.8 @@ -116,13 +116,16 @@ Permissions and ownership for the created device files may specified at The file consists of a set of lines. All empty lines and lines beginning with a '#' will be ignored. .br -Every line lists a device name followed by owner, group and permission mode. All values are separated by colons. +Every line lists a device name followed by numeric owner, group and permission +mode. All values are separated by colons. The name field may end with a +wildcard to apply the values to a whole class of devices. .sp A sample \fIudev.permissions\fP might look like this: .sp .nf #name:user:group:mode -ttyUSB1:root:uucp:0666 +ttyUSB1:0:8:0660 +video*:500:500:0660 dsp1:::0666 .fi -- cgit v1.2.3-54-g00ecf From 8f43a65e4f0b545d705cc4cf9f31fa336b0cf8f3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 20 Nov 2003 18:37:01 -0800 Subject: [PATCH] namedev.c whitespace + debug text cleanup here is mainly a whitespace cleanup for namedev.c. I changed the dbg_parse() output a bit for better readability: current: Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1' Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1.1' id='00:07.1' Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1' id='00:07.1' Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1' Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1.1' id='00:0b.0' Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1' id='00:0b.0' Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1' Nov 19 19:00:59 pim udev[25582]: do_number: NUMBER temp='/2-1.1' id='2-1.1' Nov 19 19:00:59 pim udev[25582]: do_number: device id '2-1.1' becomes 'webcam%n' - owner='', group ='', mode=0 becomes: Nov 19 19:23:40 pim udev[26091]: do_number: search '00:07.1' in '/2-1.1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1' Nov 19 19:23:40 pim udev[26091]: do_number: search '00:07.1' in '/2-1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1' Nov 19 19:23:40 pim udev[26091]: do_number: search '00:0b.0' in '/2-1.1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1' Nov 19 19:23:40 pim udev[26091]: do_number: search '00:0b.0' in '/2-1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1' Nov 19 19:23:40 pim udev[26091]: do_number: search '2-1.1' in '/2-1.1', path='/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1.1' Nov 19 19:23:40 pim udev[26091]: do_number: found id '2-1.1', 'video0' becomes 'webcam%n' - owner='', group ='', mode=0 --- namedev.c | 172 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 84 insertions(+), 88 deletions(-) diff --git a/namedev.c b/namedev.c index 9a556cb83d..41480d50c0 100644 --- a/namedev.c +++ b/namedev.c @@ -52,43 +52,42 @@ static void dump_dev(struct config_device *dev) { switch (dev->type) { case KERNEL_NAME: - dbg_parse("KERNEL name ='%s'" - " owner = '%s', group = '%s', mode = '%#o'", - dev->name, - dev->owner, dev->group, dev->mode); + dbg_parse("KERNEL name='%s' ," + "owner='%s', group='%s', mode=%#o", + dev->name, dev->owner, dev->group, dev->mode); break; case LABEL: - dbg_parse("LABEL name = '%s', bus = '%s', sysfs_file = '%s', sysfs_value = '%s'" - " owner = '%s', group = '%s', mode = '%#o'", - dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value, - dev->owner, dev->group, dev->mode); + dbg_parse("LABEL name='%s', bus='%s', sysfs_file='%s', sysfs_value='%s', " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value, + dev->owner, dev->group, dev->mode); break; case NUMBER: - dbg_parse("NUMBER name = '%s', bus = '%s', id = '%s'" - " owner = '%s', group = '%s', mode = '%#o'", - dev->name, dev->bus, dev->id, - dev->owner, dev->group, dev->mode); + dbg_parse("NUMBER name='%s', bus='%s', id='%s', " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->bus, dev->id, + dev->owner, dev->group, dev->mode); break; case TOPOLOGY: - dbg_parse("TOPOLOGY name = '%s', bus = '%s', place = '%s'" - " owner = '%s', group = '%s', mode = '%#o'", - dev->name, dev->bus, dev->place, - dev->owner, dev->group, dev->mode); + dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s', " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->bus, dev->place, + dev->owner, dev->group, dev->mode); break; case REPLACE: - dbg_parse("REPLACE name = %s, kernel_name = %s" - " owner = '%s', group = '%s', mode = '%#o'", - dev->name, dev->kernel_name, - dev->owner, dev->group, dev->mode); + dbg_parse("REPLACE name=%s, kernel_name=%s, " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->kernel_name, + dev->owner, dev->group, dev->mode); break; case CALLOUT: - dbg_parse("CALLOUT name = '%s', program ='%s', bus = '%s', id = '%s'" - " owner = '%s', group = '%s', mode = '%#o'", - dev->name, dev->exec_program, dev->bus, dev->id, - dev->owner, dev->group, dev->mode); + dbg_parse("CALLOUT name='%s', program='%s', bus='%s', id='%s', " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->exec_program, dev->bus, dev->id, + dev->owner, dev->group, dev->mode); break; default: - dbg_parse("Unknown type of device!"); + dbg_parse("unknown type of method"); } } @@ -131,7 +130,7 @@ static int add_dev(struct config_device *new_dev) return 0; } - /* not found, lets create a new structure, and add it to the list */ + /* not found, add new structure to the device list */ tmp_dev = malloc(sizeof(*tmp_dev)); if (!tmp_dev) return -ENOMEM; @@ -213,7 +212,7 @@ static int namedev_init_config(void) dbg("opening %s to read as config", udev_config_filename); fd = fopen(udev_config_filename, "r"); if (fd == NULL) { - dbg("Can't open %s", udev_config_filename); + dbg("can't open %s", udev_config_filename); return -ENODEV; } @@ -232,7 +231,7 @@ static int namedev_init_config(void) while (isspace(*temp)) ++temp; - /* no more line? */ + /* empty line? */ if (*temp == 0x00) continue; @@ -269,10 +268,10 @@ static int namedev_init_config(void) break; strfieldcpy(dev.name, temp3); - dbg_parse("LABEL name = '%s', bus = '%s', " - "sysfs_file = '%s', sysfs_value = '%s'", - dev.name, dev.bus, dev.sysfs_file, - dev.sysfs_value); + dbg_parse("LABEL name='%s', bus='%s', " + "sysfs_file='%s', sysfs_value='%s'", + dev.name, dev.bus, dev.sysfs_file, + dev.sysfs_value); } if (strcasecmp(temp2, TYPE_NUMBER) == 0) { @@ -299,8 +298,8 @@ static int namedev_init_config(void) break; strfieldcpy(dev.name, temp3); - dbg_parse("NUMBER name = '%s', bus = '%s', id = '%s'", - dev.name, dev.bus, dev.id); + dbg_parse("NUMBER name='%s', bus='%s', id='%s'", + dev.name, dev.bus, dev.id); } if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { @@ -327,8 +326,8 @@ static int namedev_init_config(void) break; strfieldcpy(dev.name, temp3); - dbg_parse("TOPOLOGY name = '%s', bus = '%s', place = '%s'", - dev.name, dev.bus, dev.place); + dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s'", + dev.name, dev.bus, dev.place); } if (strcasecmp(temp2, TYPE_REPLACE) == 0) { @@ -347,8 +346,8 @@ static int namedev_init_config(void) if (retval) break; strfieldcpy(dev.name, temp3); - dbg_parse("REPLACE name = %s, kernel_name = %s", - dev.name, dev.kernel_name); + dbg_parse("REPLACE name='%s', kernel_name='%s'", + dev.name, dev.kernel_name); } if (strcasecmp(temp2, TYPE_CALLOUT) == 0) { /* number type */ @@ -380,8 +379,8 @@ static int namedev_init_config(void) if (retval) break; strfieldcpy(dev.name, temp3); - dbg_parse("CALLOUT name = %s, program = %s", - dev.name, dev.exec_program); + dbg_parse("CALLOUT name='%s', program='%s'", + dev.name, dev.exec_program); } retval = add_dev(&dev); @@ -390,7 +389,7 @@ static int namedev_init_config(void) goto exit; } } - dbg_parse("%s:%d:%Zd: error parsing ``%s''", udev_config_filename, + dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, lineno, temp - line, temp); exit: fclose(fd); @@ -410,7 +409,7 @@ static int namedev_init_permissions(void) dbg("opening %s to read as permissions config", udev_config_permission_filename); fd = fopen(udev_config_permission_filename, "r"); if (fd == NULL) { - dbg("Can't open %s", udev_config_permission_filename); + dbg("can't open %s", udev_config_permission_filename); return -ENODEV; } @@ -427,7 +426,7 @@ static int namedev_init_permissions(void) while (isspace(*temp)) ++temp; - /* no more line? */ + /* empty line? */ if (*temp == 0x00) continue; @@ -449,9 +448,9 @@ static int namedev_init_permissions(void) dev.mode = strtol(temp, NULL, 8); - dbg_parse("name = %s, owner = %s, group = %s, mode = %#o", - dev.name, dev.owner, dev.group, - dev.mode); + dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", + dev.name, dev.owner, dev.group, + dev.mode); retval = add_dev(&dev); if (retval) { dbg("add_dev returned with error %d", retval); @@ -481,7 +480,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) int value_set = 0; char buffer[256]; - dbg("callout to %s\n", dev->exec_program); + dbg("callout to '%s'", dev->exec_program); retval = pipe(fds); if (retval != 0) { dbg("pipe failed"); @@ -494,9 +493,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) } if (pid == 0) { - /* - * child - */ + /* child */ close(STDOUT_FILENO); dup(fds[1]); /* dup write side of pipe to STDOUT */ retval = execve(dev->exec_program, main_argv, main_envp); @@ -506,9 +503,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) } return -1; /* avoid compiler warning */ } else { - /* - * Parent reads from fds[0]. - */ + /* parent reads from fds[0] */ close(fds[1]); retval = 0; while (1) { @@ -566,9 +561,10 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("device callout '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->id, udev->name, - dev->owner, dev->group, dev->mode); + dbg_parse("callout returned matching value '%s', '%s' becomes '%s'" + " - owner='%s', group='%s', mode =%#o", + dev->id, class_dev->name, udev->name, + dev->owner, dev->group, dev->mode); return 0; } return -ENODEV; @@ -585,8 +581,7 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, if (dev->type != LABEL) continue; - dbg_parse("LABEL: match file '%s' with value '%s'", - dev->sysfs_file, dev->sysfs_value); + dbg_parse("look for device attribute '%s'", dev->sysfs_file); /* try to find the attribute in the class device directory */ tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); if (tmpattr) @@ -603,7 +598,8 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, label_found: tmpattr->value[strlen(tmpattr->value)-1] = 0x00; - dbg_parse("file '%s' found with value '%s' compare with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value); + dbg_parse("compare attribute '%s' value '%s' with '%s'", + dev->sysfs_file, tmpattr->value, dev->sysfs_value); if (strcmp(dev->sysfs_value, tmpattr->value) != 0) continue; @@ -613,9 +609,10 @@ label_found: strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("file '%s' with value '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->sysfs_file, dev->sysfs_value, udev->name, - dev->owner, dev->group, dev->mode); + dbg_parse("found matching attribute '%s', '%s' becomes '%s' " + "- owner='%s', group='%s', mode=%#o", + dev->sysfs_file, class_dev->name, udev->name, + dev->owner, dev->group, dev->mode); return 0; } @@ -642,14 +639,13 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, found = 0; strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); - dbg_parse("NUMBER path = '%s'", path); - dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); + dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path); if (strstr(temp, dev->id) != NULL) { found = 1; } else { *temp = 0x00; temp = strrchr(path, '/'); - dbg_parse("NUMBER temp = '%s' id = '%s'", temp, dev->id); + dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path); if (strstr(temp, dev->id) != NULL) found = 1; } @@ -661,9 +657,10 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("device id '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->id, udev->name, - dev->owner, dev->group, dev->mode); + dbg_parse("found matching id '%s', '%s' becomes '%s'" + " - owner='%s', group ='%s', mode=%#o", + dev->id, class_dev->name, udev->name, + dev->owner, dev->group, dev->mode); return 0; } return -ENODEV; @@ -690,14 +687,13 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude found = 0; strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); - dbg_parse("TOPOLOGY path = '%s'", path); - dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); + dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path); if (strstr(temp, dev->place) != NULL) { found = 1; } else { *temp = 0x00; temp = strrchr(path, '/'); - dbg_parse("TOPOLOGY temp = '%s' place = '%s'", temp, dev->place); + dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path); if (strstr(temp, dev->place) != NULL) found = 1; } @@ -710,10 +706,10 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("device at '%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->place, udev->name, - dev->owner, dev->group, dev->mode); - + dbg_parse("found matching place '%s', '%s' becomes '%s'" + " - owner='%s', group ='%s', mode=%#o", + dev->place, class_dev->name, udev->name, + dev->owner, dev->group, dev->mode); return 0; } return -ENODEV; @@ -729,7 +725,7 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev if (dev->type != REPLACE) continue; - dbg_parse("REPLACE: replace name '%s' with '%s'", + dbg_parse("compare name '%s' with '%s'", dev->kernel_name, dev->name); if (strcmp(dev->kernel_name, class_dev->name) != 0) continue; @@ -740,9 +736,9 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("'%s' becomes '%s' - owner = %s, group = %s, mode = %#o", - dev->kernel_name, udev->name, - dev->owner, dev->group, dev->mode); + dbg_parse("found name, '%s' becomes '%s' - owner='%s', group='%s', mode = %#o", + dev->kernel_name, udev->name, + dev->owner, dev->group, dev->mode); return 0; } @@ -768,7 +764,7 @@ static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice * continue; } if (dev->mode != 0) { - dbg_parse("found permissions from config for '%s'", class_dev->name); + dbg_parse("found permissions for '%s'", class_dev->name); udev->mode = dev->mode; strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); @@ -808,7 +804,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) if (class_dev_parent == NULL) { dbg("sysfs_open_class_device at '%s' failed", path); } else { - dbg_parse("class_dev_parent->name = %s", class_dev_parent->name); + dbg_parse("class_dev_parent->name=%s", class_dev_parent->name); if (class_dev_parent->sysdevice) sysfs_device = class_dev_parent->sysdevice; } @@ -817,8 +813,8 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) } if (sysfs_device) { - dbg_parse("sysfs_device->path = '%s'", sysfs_device->path); - dbg_parse("sysfs_device->bus_id = '%s'", sysfs_device->bus_id); + dbg_parse("sysfs_device->path='%s'", sysfs_device->path); + dbg_parse("sysfs_device->bus_id='%s'", sysfs_device->bus_id); } else { dbg_parse("class_dev->name = '%s'", class_dev->name); } @@ -861,7 +857,7 @@ found: if (!sysfs_device) break; strcat(udev->name, sysfs_device->bus_id); - dbg("bus_id appended: %s", + dbg("bus_id inserted: %s", sysfs_device->bus_id); break; case 'n': @@ -869,18 +865,18 @@ found: while (isdigit(*(dig-1))) dig--; strcat(udev->name, dig); - dbg("kernel number appended: %s", dig); + dbg("substitute kernel number '%s'", dig); break; case 'm': sprintf(pos, "%u", udev->minor); - dbg("minor number appended: %u", udev->minor); + dbg("substitute minor number '%u'", udev->minor); break; case 'M': sprintf(pos, "%u", udev->major); - dbg("major number appended: %u", udev->major); + dbg("substitute major number '%u'", udev->major); break; default: - dbg("unknown substitution type: %%%c", pos[1]); + dbg("unknown substitution type '%%%c'", pos[1]); break; } strcat(udev->name, name); -- cgit v1.2.3-54-g00ecf From cb08e0f2531f910fcd46a24b2fa0eb8049165b02 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 21 Nov 2003 06:47:29 -0800 Subject: [PATCH] namedev.c - change order of fields in CALLOUT I want to bring the CALLOUT field ordering in line with the other methods, cause the current parsing relies on the ordering it's good to have it like the others. The BUS= is now the first expected field. Also made the last two remaining field names to uppercase and the man page callout example is updated. --- namedev.c | 16 ++++++++-------- udev.8 | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/namedev.c b/namedev.c index 41480d50c0..7c8761088f 100644 --- a/namedev.c +++ b/namedev.c @@ -286,7 +286,7 @@ static int namedev_init_config(void) /* ID="id" */ temp2 = strsep(&temp, ","); - retval = get_value("id", &temp, &temp3); + retval = get_value("ID", &temp, &temp3); if (retval) break; strfieldcpy(dev.id, temp3); @@ -314,7 +314,7 @@ static int namedev_init_config(void) /* PLACE="place" */ temp2 = strsep(&temp, ","); - retval = get_value("place", &temp, &temp3); + retval = get_value("PLACE", &temp, &temp3); if (retval) break; strfieldcpy(dev.place, temp3); @@ -353,18 +353,18 @@ static int namedev_init_config(void) /* number type */ dev.type = CALLOUT; - /* PROGRAM="executable" */ - retval = get_value("PROGRAM", &temp, &temp3); + /* BUS="bus" */ + retval = get_value("BUS", &temp, &temp3); if (retval) break; - strfieldcpy(dev.exec_program, temp3); + strfieldcpy(dev.bus, temp3); - /* BUS="bus" */ + /* PROGRAM="executable" */ temp2 = strsep(&temp, ","); - retval = get_value("BUS", &temp, &temp3); + retval = get_value("PROGRAM", &temp, &temp3); if (retval) break; - strfieldcpy(dev.bus, temp3); + strfieldcpy(dev.exec_program, temp3); /* ID="id" */ temp2 = strsep(&temp, ","); diff --git a/udev.8 b/udev.8 index e46caaf322..079d15f4d1 100644 --- a/udev.8 +++ b/udev.8 @@ -105,7 +105,7 @@ TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" REPLACE, KERNEL="ttyUSB1", NAME="pda" # if /sbin/scsi_id returns "OEM 0815" device will be called disk1 -CALLOUT, PROGRAM="/sbin/scsi_id" BUS="scsi", ID="OEM 0815" NAME="disk1" +CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1" # USB webcams to be called webcam0, webcam1, ... LABEL, BUS="usb", model="WebCam Version 3", NAME="webcam%n" -- cgit v1.2.3-54-g00ecf From bc434511310a5bbbc5fe3783a9204b204ef05500 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 21 Nov 2003 06:48:01 -0800 Subject: [PATCH] support arguments in callout exec here is argument support for CALLOUT exec: CALLOUT, PROGRAM="/bin/echo -n xxx", BUS="usb", ID="xxx", NAME="webcam%n" results in: Nov 20 02:35:20 pim udev[30422]: get_major_minor: found major = 81, minor = 0 Nov 20 02:35:20 pim udev[30422]: exec_callout: callout to /bin/echo -n xxx Nov 20 02:35:20 pim udev[30422]: exec_callout: callout returned 'xxx' Nov 20 02:35:20 pim udev[30422]: get_attr: kernel number appended: 0 The feature is really nice, but the maximum argument count is hard coded to 8. --- namedev.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 7c8761088f..bed328f646 100644 --- a/namedev.c +++ b/namedev.c @@ -45,6 +45,7 @@ #define TYPE_TOPOLOGY "TOPOLOGY" #define TYPE_REPLACE "REPLACE" #define TYPE_CALLOUT "CALLOUT" +#define CALLOUT_MAXARG 8 static LIST_HEAD(config_device_list); @@ -479,6 +480,9 @@ static int exec_callout(struct config_device *dev, char *value, int len) pid_t pid; int value_set = 0; char buffer[256]; + char *arg; + char *args[CALLOUT_MAXARG]; + int i; dbg("callout to '%s'", dev->exec_program); retval = pipe(fds); @@ -496,7 +500,22 @@ static int exec_callout(struct config_device *dev, char *value, int len) /* child */ close(STDOUT_FILENO); dup(fds[1]); /* dup write side of pipe to STDOUT */ - retval = execve(dev->exec_program, main_argv, main_envp); + if (strchr(dev->exec_program, ' ')) { + /* callout with arguments */ + arg = dev->exec_program; + for (i=0; i < CALLOUT_MAXARG-1; i++) { + args[i] = strsep(&arg, " "); + if (args[i] == NULL) + break; + } + if (args[i]) { + dbg("to many args - %d", i); + args[i] = NULL; + } + retval = execve(args[0], args, main_envp); + } else { + retval = execve(dev->exec_program, main_argv, main_envp); + } if (retval != 0) { dbg("child execve failed"); exit(1); @@ -523,6 +542,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) strncpy(value, buffer, len); } } + dbg("callout returned '%s'", value); close(fds[0]); res = wait(&status); if (res < 0) { -- cgit v1.2.3-54-g00ecf From 75d0730c84ffd6602fe903f66c31cf639890c0f6 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 22 Nov 2003 18:18:53 -0800 Subject: [PATCH] added debian's version of udev.permissions. Hm, should probably move all of the config file stuff to a new directory soon... --- udev.permissions | 2 +- udev.permissions.debian | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 udev.permissions.debian diff --git a/udev.permissions b/udev.permissions index 7de9bc16e4..e87b4ddc67 100644 --- a/udev.permissions +++ b/udev.permissions @@ -4,4 +4,4 @@ ttyUSB1:root:uucp:0666 pl2303:500:500:0666 visor:root:uucp:0666 dsp1:::0666 - +camera*:500:500:0666 diff --git a/udev.permissions.debian b/udev.permissions.debian new file mode 100644 index 0000000000..a5e40f89e2 --- /dev/null +++ b/udev.permissions.debian @@ -0,0 +1,89 @@ +# name:user:group:mode + +# character devices + +ttyACM*:root:dialout:0660 +ttyUSB*:root:dialout:0660 +ttyI*:root:dialout:0660 +ttyS*:root:dialout:0660 +ttySC*:root:dialout:0660 +ttyB*:root:dialout:0660 +ttyC*:root:dialout:0660 +ttyD*:root:dialout:0660 +ttyE*:root:dialout:0660 +ttyH*:root:dialout:0660 +ttyI*:root:dialout:0660 +ttyL*:root:dialout:0660 +ttyM*:root:dialout:0660 +ttyP*:root:dialout:0660 +ttyR*:root:dialout:0660 +ttyV*:root:dialout:0660 +ttyW*:root:dialout:0660 +ttyX*:root:dialout:0660 +tts/*:root:dialout:0660 +ippp*:root:dialout:0660 +isdn*:root:dialout:0660 +isdnctrl*:root:dialout:0660 +capi*:root:dialout:0660 +dcbri*:root:dialout:0660 +ircomm*:root:dialout:0660 + +admmidi*:root:audio:660 +adsp*:root:audio:660 +aload*:root:audio:660 +amidi*:root:audio:660 +amixer*:root:audio:660 +audio*:root:audio:660 +dmfm*:root:audio:660 +dsp*:root:audio:660 +audio*:root:audio:660 +mixer*:root:audio:660 +music:root:audio:660 +sequencer*:root:audio:660 +snd/*:root:audio:660 +sound/*:root:audio:660 + +lp*:root:lp:0660 +parport*:root:lp:0660 +irlpt*:root:lp:0660 +usblp*:root:lp:0660 +usb/lp*:root:lp:0660 + +js:root:root:644 +djs:root:root:644 +input/*:root:root:644 + +dri/card*:root:root:666 + +fb/*:root:video:0620 +agpgart:root:video:0660 +video*:root:video:0660 +radio*:root:video:0660 +vbi*:root:video:0660 +vtx*:root:video:0660 + +# block devices + +floppy*:root:floppy:660 +floppy/*:root:floppy:660 + +ram*:root:disk:660 +raw/*:root:disk:660 + +hd*:root:disk:660 +sd*:root:disk:660 +dasd*:root:disk:660 +ataraid*:root:disk:660 +loop*:root:disk:660 +md*:root:disk:660 + +sr*:root:cdrom:660 +scd*:root:cdrom:660 +sr*:root:cdrom:660 + +ht*:root:tape:0660 +nht*:root:tape:0660 +pt*:root:tape:0660 +npt*:root:tape:0660 +st*:root:tape:0660 +nst*:root:tape:0660 -- cgit v1.2.3-54-g00ecf From a367f04ee0a45a9ad342e04532c73eb0cc179793 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 23 Nov 2003 05:47:28 -0800 Subject: [PATCH] add udev-test perl script from Kay Sievers which blows away my puny shell scripts. --- test/udev-test.pl | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 test/udev-test.pl diff --git a/test/udev-test.pl b/test/udev-test.pl new file mode 100644 index 0000000000..9a54b6192a --- /dev/null +++ b/test/udev-test.pl @@ -0,0 +1,164 @@ +#!/usr/bin/perl + +# udev-test +# +# Provides automated testing of the udev binary. +# The whole test is self contained in this file, except the matching sysfs tree. +# Simply extend the @tests array, to add a new test variant. +# +# Every test is driven by its own temporary config file. +# This program prepares the environment, creates the config and calls udev. +# +# udev reads the config, looks at the provided sysfs and +# first creates and then removes the device node. +# After creation and removal the result is checked against the +# expected value and the result is printed. +# +# happy testing, +# Kay Sievers , 2003 + + +use warnings; +use strict; + +my $PWD = `pwd`; +chomp($PWD); + +my $sysfs = "sys/"; +my $udev_bin = "../udev"; +my $udev_root = "udev-root/"; # !!! directory will be removed !!! +my $udev_db = "udev.tdb"; +my $perm = "udev.permissions"; +my $conf_tmp = "udev-test.config"; + + +my @tests = ( + { + desc => "label test of scsi disc", + subsys => "block", + devpath => "block/sda", + expected => "boot_disk" , + conf => < "label test of scsi partition", + subsys => "block", + devpath => "block/sda/sda1", + expected => "boot_disk1" , + conf => < "replace kernel name", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor" , + conf => < "place on bus of scsi partition", + subsys => "block", + devpath => "block/sda/sda3", + expected => "first_disk3" , + conf => < "test NAME substitution chars", + subsys => "block", + devpath => "block/sda/sda3", + expected => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , + conf => < "callout result subtitution, only last should match", + subsys => "block", + devpath => "block/sda/sda3", + expected => "special-device-3" , + conf => <$conf_tmp" || die "unable to create config file: $conf_tmp"; + print CONF $$config; + close CONF; + + $ENV{ACTION} = $action; + system("$udev_bin $subsys"); +} + + +# prepare +system("rm -rf $udev_root"); +mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; + +# test +my $error; +print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; + +foreach my $config (@tests) { + $config->{conf} =~ m/^([A-Z]*).*/; + my $method = $1; + + print "TEST: $config->{desc}\n"; + print "method \'$method\' for \'$config->{devpath}\' expecting node \'$config->{expected}\'\n"; + + udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); + if (-e "$PWD/$udev_root$config->{expected}") { + print "add: ok "; + } else { + print "add: error\n"; + system("tree $udev_root"); + print "\n"; + $error++; +# next; + } + + udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf}); + if (-e "$PWD/$udev_root$config->{expected}") { + print "remove: error\n\n"; + system("tree $udev_root"); + $error++; + } else { + print "remove: ok\n\n"; + } +} + +print "$error errors occured\n\n"; + +# cleanup +system("rm -rf $udev_root"); +unlink($conf_tmp); +unlink($udev_db); + -- cgit v1.2.3-54-g00ecf From ed839137305753796486b9d4570e68d04748d497 Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Sun, 23 Nov 2003 05:58:21 -0800 Subject: [PATCH] static klibc udev does not link against crt0.o On Wed, Nov 19, Greg KH wrote: > > I did 'make KLIBC=true' in the current bk tree. > > try 'make -f Makefile.klibc' in the current tree. For some reason I > couldn't figure out how to have Makefile work for both KLIBC=true and > KLIBC=false. But I didn't try too hard :) I dont understand that. please do rm -f Makefile.klibc; apply this patch and tell me what fails. works for me. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index fa29c8859b..fc5c9b1792 100644 --- a/Makefile +++ b/Makefile @@ -166,7 +166,7 @@ udev_version.h: $(ROOT): $(GEN_HEADERS) $(OBJS) - $(CC) $(LDFLAGS) -o $(ROOT) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(CC) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) clean: @@ -215,7 +215,7 @@ install: all $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) udev.config $(DESTDIR)$(configdir) $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir) - - rm $(DESTDIR)$(hotplugdir)/udev.hotplug + - rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug - ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug uninstall: -- cgit v1.2.3-54-g00ecf From 388e2a6a47296697a34f3482b9442df92169c4ac Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 23 Nov 2003 05:59:07 -0800 Subject: [PATCH] remove Makefile.klibc --- Makefile.klibc | 219 --------------------------------------------------------- 1 file changed, 219 deletions(-) delete mode 100644 Makefile.klibc diff --git a/Makefile.klibc b/Makefile.klibc deleted file mode 100644 index e0961df718..0000000000 --- a/Makefile.klibc +++ /dev/null @@ -1,219 +0,0 @@ -# Makefile for udev -# -# Copyright (C) 2003 Greg Kroah-Hartman -# -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -# Set the following to `true' to make a debuggable build. -# Leave this set to `false' for production use. -DEBUG = true - - -ROOT = udev -VERSION = 006_bk -INSTALL_DIR = /usr/local/bin -RELEASE_NAME = $(ROOT)-$(VERSION) - -# override this to make udev look in a different location for it's config files -prefix = -exec_prefix = ${prefix} -etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -mandir = ${prefix}/usr/share/man -hotplugdir = ${etcdir}/hotplug.d/default -configdir = ${etcdir}/udev/ -srcdir = . - -INSTALL = /usr/bin/install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} - - -# place to put our device nodes -udevdir = ${prefix}/udev/ - -# Comment out this line to build with something other -# than the local version of klibc -KLIBC = true - -# If you are running a cross compiler, you may want to set this -# to something more interesting, like "arm-linux-". I you want -# to compile vs uClibc, that can be done here as well. -CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- -CC = $(CROSS)gcc -AR = $(CROSS)ar -STRIP = $(CROSS)strip -RANLIB = $(CROSS)ranlib - -export CROSS CC AR STRIP RANLIB - -# code taken from uClibc to determine the current arch -ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ - -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/ppc/powerpc/g'} - -# code taken from uClibc to determine the gcc include dir -GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} - -# code taken from uClibc to determine the libgcc.a filename -GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) - -# use '-Os' optimization if available, else use -O2 -OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ - then echo "-Os"; else echo "-O2" ; fi} - -# add -Wredundant-decls when libsysfs gets cleaned up -WARNINGS := -Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations - -# Some nice architecture specific optimizations -ifeq ($(strip $(TARGET_ARCH)),arm) - OPTIMIZATION+=-fstrict-aliasing -endif -ifeq ($(strip $(TARGET_ARCH)),i386) - OPTIMIZATION+=-march=i386 - OPTIMIZATION += ${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc \ - /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi} - OPTIMIZATION += ${shell if $(CC) -malign-functions=0 -malign-jumps=0 -S -o /dev/null -xc \ - /dev/null >/dev/null 2>&1; then echo "-malign-functions=0 -malign-jumps=0"; fi} - CFLAGS+=-pipe -else - CFLAGS+=-pipe -endif - -# if DEBUG is enabled, then we do not strip or optimize -ifeq ($(strip $(DEBUG)),true) - CFLAGS += $(WARNINGS) -O1 -g -DDEBUG -D_GNU_SOURCE - LDFLAGS += -Wl,-warn-common - STRIPCMD = /bin/true -Since_we_are_debugging -else - CFLAGS += $(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE - LDFLAGS += -s -Wl,-warn-common - STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment -endif - -# If we are using our version of klibc, then we need to build and link it. -# Otherwise, use glibc and link statically. -ifeq ($(strip $(KLIBC)),true) - KLIBC_DIR = klibc/klibc - INCLUDE_DIR := $(KLIBC_DIR)/include - # arch specific objects - LIBGCC = $(shell $(CC) --print-libgcc) - ARCH_LIB_OBJS = \ - $(KLIBC_DIR)/libc.a \ - $(LIBGCC) - - - CRT0 = $(KLIBC_DIR)/crt0.o - LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) - CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/bits32 -I$(GCCINCDIR) -Iklibc/linux/include -D__KLIBC__ - LIB_OBJS = - LDFLAGS = --static --nostdlib -nostartfiles -else -# ARCH_LIB_OBJS = /usr/lib/libc.a - LIBGCC = $(shell $(CC) --print-libgcc) - CRT0 = /usr/lib/crt1.o /usr/lib/crti.o - LIBC = - CFLAGS += -I$(GCCINCDIR) - LIB_OBJS = -lc - LDFLAGS = --static -endif - -all: $(LIBC) $(ROOT) - -$(ARCH_LIB_OBJS) : - $(MAKE) -C klibc - -TDB = tdb/tdb.o \ - tdb/spinlock.o - -SYSFS = libsysfs/sysfs_bus.o \ - libsysfs/sysfs_class.o \ - libsysfs/sysfs_device.o \ - libsysfs/sysfs_dir.o \ - libsysfs/sysfs_driver.o \ - libsysfs/sysfs_utils.o \ - libsysfs/dlist.o - -OBJS = udev.o \ - udev-add.o \ - udev-remove.o \ - udevdb.o \ - logging.o \ - namedev.o \ - klibc_fixups.o \ - $(SYSFS) \ - $(TDB) - -# header files automatically generated -GEN_HEADERS = udev_version.h - -# Rules on how to create the generated header files -udev_version.h: - @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ - @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ - @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ - - -$(ROOT): $(GEN_HEADERS) $(OBJS) - $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(LIBGCC) $(ARCH_LIB_OBJS) - $(STRIPCMD) $(ROOT) - -clean: - -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ - | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) - $(MAKE) -C klibc clean - -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort ) -DISTDIR := $(RELEASE_NAME) -srcdir = . -release: $(DISTFILES) clean -# @echo $(DISTFILES) - @-rm -rf $(DISTDIR) - @mkdir $(DISTDIR) - @-chmod 777 $(DISTDIR) - @for file in $(DISTFILES); do \ - if test -d $$file; then \ - mkdir $(DISTDIR)/$$file; \ - else \ - cp -p $$file $(DISTDIR)/$$file; \ - fi; \ - done - @tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz - @rm -rf $(DISTDIR) - @echo "Built $(RELEASE_NAME).tar.gz" - - -install: all - $(INSTALL) -d $(udevdir) - $(INSTALL) -d $(configdir) - $(INSTALL) -d $(hotplugdir) - $(INSTALL_PROGRAM) -D $(ROOT) $(sbindir)/$(ROOT) - $(INSTALL_DATA) -D udev.8 $(mandir)/man8/udev.8 - $(INSTALL_DATA) udev.config $(configdir) - $(INSTALL_DATA) udev.permissions $(configdir) - - ln -s $(sbindir)/$(ROOT) $(hotplugdir)/udev.hotplug - -uninstall: - - rm $(hotplugdir)/udev.hotplug - - rm $(configdir)/udev.permissions - - rm $(configdir)/udev.config - - rm $(mandir)/man8/udev.8 - - rm $(sbindir)/$(ROOT) - - rmdir $(hotplugdir) - - rmdir $(configdir) - - rmdir $(udevdir) - - -- cgit v1.2.3-54-g00ecf From 04a81cac0aab2ab6a54ddc661dd57be7d5b1595a Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Sun, 23 Nov 2003 18:35:03 -0800 Subject: [PATCH] fix segfault in parsing bad udev.permissions file --- namedev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/namedev.c b/namedev.c index bed328f646..24b9bc01ac 100644 --- a/namedev.c +++ b/namedev.c @@ -439,12 +439,24 @@ static int namedev_init_permissions(void) /* parse the line */ temp2 = strsep(&temp, ":"); + if (!temp2) { + dbg("cannot parse line: %s", line); + continue; + } strncpy(dev.name, temp2, sizeof(dev.name)); temp2 = strsep(&temp, ":"); + if (!temp2) { + dbg("cannot parse line: %s", line); + continue; + } strncpy(dev.owner, temp2, sizeof(dev.owner)); temp2 = strsep(&temp, ":"); + if (!temp2) { + dbg("cannot parse line: %s", line); + continue; + } strncpy(dev.group, temp2, sizeof(dev.owner)); dev.mode = strtol(temp, NULL, 8); -- cgit v1.2.3-54-g00ecf From 2023350eece60db60d30e387cfb644df09b9e8b6 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 23 Nov 2003 20:44:41 -0800 Subject: [PATCH] add getgrnam and getpwnam to klibc_fixups files. Hopefully the klibc_fixups code will not be needed eventually. --- klibc_fixups.c | 4 +++- klibc_fixups.h | 42 ++++++++++++++++++++++++++++++++++++++++++ namedev.c | 1 + 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 klibc_fixups.h diff --git a/klibc_fixups.c b/klibc_fixups.c index a5d5d5948a..c12c90fd1c 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -4,6 +4,8 @@ #include #include #include +#include +#include "klibc_fixups.h" char *strerror(int errnum) { @@ -29,5 +31,5 @@ int strcasecmp(const char *s1, const char *s2) free(n2); return retval; } - + #endif diff --git a/klibc_fixups.h b/klibc_fixups.h new file mode 100644 index 0000000000..21a23e7762 --- /dev/null +++ b/klibc_fixups.h @@ -0,0 +1,42 @@ +#ifdef __KLIBC__ + +#ifndef KLIBC_FIXUPS_H +#define KLIBC_FIXUPS_H + + +extern char *strerror(int errnum); + +extern int strcasecmp(const char *s1, const char *s2); + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; + +static inline struct group *getgrnam(const char *name) +{ + return NULL; +} + + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* user password */ + uid_t pw_uid; /* user id */ + gid_t pw_gid; /* group id */ + char *pw_gecos; /* real name */ + char *pw_dir; /* home directory */ + char *pw_shell; /* shell program */ +}; + +static inline struct passwd *getpwnam(const char *name) +{ + return NULL; +} + + +#endif + +#endif diff --git a/namedev.c b/namedev.c index 24b9bc01ac..3b19aaf909 100644 --- a/namedev.c +++ b/namedev.c @@ -39,6 +39,7 @@ #include "udev_version.h" #include "namedev.h" #include "libsysfs/libsysfs.h" +#include "klibc_fixups.h" #define TYPE_LABEL "LABEL" #define TYPE_NUMBER "NUMBER" -- cgit v1.2.3-54-g00ecf From 10950dfe84c064da2fde8d812c0c90cfba836d16 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 23 Nov 2003 20:56:18 -0800 Subject: [PATCH] add support for string group and string user names in udev.permissions. This only works if you are using glibc. Patch based on patch from Marco d'Itri --- udev-add.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/udev-add.c b/udev-add.c index 7ba873a8d4..634a515c96 100644 --- a/udev-add.c +++ b/udev-add.c @@ -28,12 +28,18 @@ #include #include #include +#include +#include +#ifndef __KLIBC__ +#include +#endif #include "udev.h" #include "udev_version.h" #include "namedev.h" #include "udevdb.h" #include "libsysfs/libsysfs.h" +#include "klibc_fixups.h" /* * Right now the major/minor of a device is stored in a file called @@ -146,8 +152,13 @@ static int create_node(struct udevice *dev) unsigned long id = strtoul(dev->owner, &endptr, 10); if (*endptr == 0x00) uid = (uid_t) id; - else - dbg("only numeric owner id supported: %s", dev->owner); + else { + struct passwd *pw = getpwnam(dev->owner); + if (!pw) + dbg("user unknown: %s", dev->owner); + else + uid = pw->pw_uid; + } } if (*dev->group) { @@ -155,8 +166,13 @@ static int create_node(struct udevice *dev) unsigned long id = strtoul(dev->group, &endptr, 10); if (*endptr == 0x00) gid = (gid_t) id; - else - dbg("only numeric group id supported: %s", dev->group); + else { + struct group *gr = getgrnam(dev->group); + if (!gr) + dbg("group unknown: %s", dev->group); + else + gid = gr->gr_gid; + } } if (uid || gid) { -- cgit v1.2.3-54-g00ecf From 6a670d61bce2f9cc6df23af0d594e764fb2e573b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 23 Nov 2003 20:56:52 -0800 Subject: [PATCH] only build klibc_fixups.c if we are actually using klibc. --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index fc5c9b1792..a2f904a745 100644 --- a/Makefile +++ b/Makefile @@ -151,10 +151,13 @@ OBJS = udev.o \ udevdb.o \ logging.o \ namedev.o \ - klibc_fixups.o \ $(SYSFS) \ $(TDB) +ifeq ($(strip $(KLIBC)),true) + OBJS += klibc_fixups.o +endif + # header files automatically generated GEN_HEADERS = udev_version.h -- cgit v1.2.3-54-g00ecf From 53dc383ee90b6699b85f2843247389f5adeb8d50 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 23 Nov 2003 21:14:10 -0800 Subject: [PATCH] more namedev whitespace cleanups attached is the last whitespace cleanup and debug text corrections. --- namedev.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/namedev.c b/namedev.c index 3b19aaf909..a010979052 100644 --- a/namedev.c +++ b/namedev.c @@ -83,9 +83,9 @@ static void dump_dev(struct config_device *dev) dev->owner, dev->group, dev->mode); break; case CALLOUT: - dbg_parse("CALLOUT name='%s', program='%s', bus='%s', id='%s', " + dbg_parse("CALLOUT name='%s', bus='%s', program='%s', id='%s', " "owner='%s', group='%s', mode=%#o", - dev->name, dev->exec_program, dev->bus, dev->id, + dev->name, dev->bus, dev->exec_program, dev->id, dev->owner, dev->group, dev->mode); break; default: @@ -271,8 +271,8 @@ static int namedev_init_config(void) strfieldcpy(dev.name, temp3); dbg_parse("LABEL name='%s', bus='%s', " - "sysfs_file='%s', sysfs_value='%s'", - dev.name, dev.bus, dev.sysfs_file, + "sysfs_file='%s', sysfs_value='%s'", + dev.name, dev.bus, dev.sysfs_file, dev.sysfs_value); } @@ -417,7 +417,6 @@ static int namedev_init_permissions(void) /* loop through the whole file */ while (1) { - /* get a line */ temp = fgets(line, sizeof(line), fd); if (temp == NULL) break; @@ -522,7 +521,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) break; } if (args[i]) { - dbg("to many args - %d", i); + dbg("too many args - %d", i); args[i] = NULL; } retval = execve(args[0], args, main_envp); @@ -882,6 +881,7 @@ found: char *pos = strchr(udev->name, '%'); char *dig; char name[NAME_SIZE]; + if (pos) { strfieldcpy(name, pos+2); *pos = 0x00; @@ -890,8 +890,7 @@ found: if (!sysfs_device) break; strcat(udev->name, sysfs_device->bus_id); - dbg("bus_id inserted: %s", - sysfs_device->bus_id); + dbg("substitute bus_id '%s'", sysfs_device->bus_id); break; case 'n': dig = class_dev->name + strlen(class_dev->name); @@ -957,5 +956,3 @@ int namedev_init(void) dump_dev_list(); return retval; } - - -- cgit v1.2.3-54-g00ecf From c124eafa238b34a2e79100d3eb1fb143b7e8cb8b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 23 Nov 2003 21:14:33 -0800 Subject: [PATCH] - format char for CALLOUT output here is a patch for inserting the callout output into NAME=. ID= supports the usual wildcard to compare with the output. I've moved all wildcard matching to a function cause this was the third occurrence. Also attached is the last whitespace cleanup and debug text corrections. The callout patch depends on the whitespace patch. CALLOUT, BUS="usb", PROGRAM="/bin/echo -n return", ID="ret*", NAME="webcam-%c-" results in: Nov 21 17:33:51 pim udev[20399]: get_major_minor: found major = 81, minor = 0 Nov 21 17:33:51 pim udev[20399]: exec_callout: callout to '/bin/echo -n return' Nov 21 17:33:51 pim udev[20399]: exec_callout: callout returned 'return' Nov 21 17:33:51 pim udev[20399]: get_attr: substitute callout output 'return' Nov 21 17:33:51 pim udev[20399]: udev_add_device: name = webcam-return- Nov 21 17:33:51 pim udev[20399]: create_node: mknod(/udev/webcam-return-, 020660, 81, 0) --- namedev.c | 53 ++++++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/namedev.c b/namedev.c index a010979052..cf9e92635e 100644 --- a/namedev.c +++ b/namedev.c @@ -50,6 +50,19 @@ static LIST_HEAD(config_device_list); +/* s2 may end with '*' to match everything */ +static int strncmp_wildcard(char *s1, char *s2, int max) +{ + int len = strlen(s2); + if (len > max) + len = max; + if (s2[len-1] == '*') + len--; + else + len = max; + return strncmp(s1, s2, len); +} + static void dump_dev(struct config_device *dev) { switch (dev->type) { @@ -109,16 +122,8 @@ static int add_dev(struct config_device *new_dev) /* update the values if we already have the device */ list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); - int len = strlen(new_dev->name); - if (new_dev->name[len-1] == '*') { - len--; - if (strncmp(dev->name, new_dev->name, len)) - continue; - } else { - if (strcmp(dev->name, new_dev->name)) - continue; - } - /* the same, copy the new info into this structure */ + if (strncmp_wildcard(dev->name, new_dev->name, sizeof(dev->name))) + continue; copy_var(dev, new_dev, type); copy_var(dev, new_dev, mode); copy_string(dev, new_dev, bus); @@ -572,20 +577,18 @@ static int exec_callout(struct config_device *dev, char *value, int len) return retval; } -static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev) +static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev, char *value, int len) { struct config_device *dev; struct list_head *tmp; - char value[ID_SIZE]; list_for_each(tmp, &config_device_list) { dev = list_entry(tmp, struct config_device, node); if (dev->type != CALLOUT) continue; - - if (exec_callout(dev, value, sizeof(value))) + if (exec_callout(dev, value, len)) continue; - if (strncmp(value, dev->id, sizeof(value)) != 0) + if (strncmp_wildcard(value, dev->id, len) != 0) continue; strfieldcpy(udev->name, dev->name); if (dev->mode != 0) { @@ -784,17 +787,12 @@ static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice * int len; strfieldcpy(udev->name, class_dev->name); + /* look for permissions */ list_for_each(tmp, &config_device_list) { dev = list_entry(tmp, struct config_device, node); len = strlen(dev->name); - if (dev->name[len-1] == '*') { - len--; - if (strncmp(dev->name, class_dev->name, len)) - continue; - } else { - if (strcmp(dev->name, class_dev->name)) - continue; - } + if (strncmp_wildcard(class_dev->name, dev->name, sizeof(dev->name))) + continue; if (dev->mode != 0) { dbg_parse("found permissions for '%s'", class_dev->name); udev->mode = dev->mode; @@ -810,6 +808,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) struct sysfs_class_device *class_dev_parent = NULL; int retval = 0; char *temp = NULL; + char value[ID_SIZE]; udev->mode = 0; @@ -852,7 +851,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) } /* rules are looked at in priority order */ - retval = do_callout(class_dev, udev); + retval = do_callout(class_dev, udev, value, sizeof(value)); if (retval == 0) goto found; @@ -896,7 +895,7 @@ found: dig = class_dev->name + strlen(class_dev->name); while (isdigit(*(dig-1))) dig--; - strcat(udev->name, dig); + strcat(pos, dig); dbg("substitute kernel number '%s'", dig); break; case 'm': @@ -907,6 +906,10 @@ found: sprintf(pos, "%u", udev->major); dbg("substitute major number '%u'", udev->major); break; + case 'c': + strcat(pos, value); + dbg("substitute callout output '%s'", value); + break; default: dbg("unknown substitution type '%%%c'", pos[1]); break; -- cgit v1.2.3-54-g00ecf From e5fbfe0a13e11c08ed72b67fa4e72a93bcd5de37 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 23 Nov 2003 21:17:34 -0800 Subject: [PATCH] tweak udev-test.pl to report '0' errors if that's what happened. --- test/udev-test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 9a54b6192a..613aa792d4 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -124,7 +124,7 @@ system("rm -rf $udev_root"); mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; # test -my $error; +my $error = 0; print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; foreach my $config (@tests) { -- cgit v1.2.3-54-g00ecf From f3b04a2e0a041aa5546284c5bfc2022ab3e8b15f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 23 Nov 2003 22:25:13 -0800 Subject: [PATCH] added ability to put format specifiers in the CALLOUT program string. --- namedev.c | 118 ++++++++++++++++++++++++++++++++---------------------- test/udev-test.pl | 9 +++++ udev-add.c | 2 + udev.h | 6 +++ 4 files changed, 88 insertions(+), 47 deletions(-) diff --git a/namedev.c b/namedev.c index cf9e92635e..e640b93c3d 100644 --- a/namedev.c +++ b/namedev.c @@ -487,6 +487,66 @@ static mode_t get_default_mode(struct sysfs_class_device *class_dev) return 0666; } +static void build_kernel_number(struct sysfs_class_device *class_dev, struct udevice *udev) +{ + char *dig; + + /* FIXME, figure out how to handle stuff like sdaj which will not work right now. */ + dig = class_dev->name + strlen(class_dev->name); + while (isdigit(*(dig-1))) + dig--; + strfieldcpy(udev->kernel_number, dig); + dbg("kernel_number = %s", udev->kernel_number); +} + +static void apply_format(struct udevice *udev, unsigned char *string) +{ + char name[NAME_SIZE]; + char *pos; + + while (1) { + pos = strchr(string, '%'); + + if (pos) { + strfieldcpy(name, pos+2); + *pos = 0x00; + switch (pos[1]) { + case 'b': + if (strlen(udev->bus_id) == 0) + break; + strcat(string, udev->bus_id); + dbg("substitute bus_id '%s'", udev->bus_id); + break; + case 'n': + if (strlen(udev->kernel_number) == 0) + break; + strcat(pos, udev->kernel_number); + dbg("substitute kernel number '%s'", udev->kernel_number); + break; + case 'm': + sprintf(pos, "%u", udev->minor); + dbg("substitute minor number '%u'", udev->minor); + break; + case 'M': + sprintf(pos, "%u", udev->major); + dbg("substitute major number '%u'", udev->major); + break; + case 'c': + if (strlen(udev->callout_value) == 0) + break; + strcat(pos, udev->callout_value); + dbg("substitute callout output '%s'", udev->callout_value); + break; + default: + dbg("unknown substitution type '%%%c'", pos[1]); + break; + } + strcat(string, name); + } else + break; + } +} + static int exec_callout(struct config_device *dev, char *value, int len) { @@ -577,7 +637,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) return retval; } -static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev, char *value, int len) +static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev) { struct config_device *dev; struct list_head *tmp; @@ -586,9 +646,12 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev dev = list_entry(tmp, struct config_device, node); if (dev->type != CALLOUT) continue; - if (exec_callout(dev, value, len)) + + /* substitute anything that needs to be in the program name */ + apply_format(udev, dev->exec_program); + if (exec_callout(dev, udev->callout_value, NAME_SIZE)) continue; - if (strncmp_wildcard(value, dev->id, len) != 0) + if (strncmp_wildcard(udev->callout_value, dev->id, NAME_SIZE) != 0) continue; strfieldcpy(udev->name, dev->name); if (dev->mode != 0) { @@ -808,7 +871,6 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) struct sysfs_class_device *class_dev_parent = NULL; int retval = 0; char *temp = NULL; - char value[ID_SIZE]; udev->mode = 0; @@ -846,12 +908,15 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) if (sysfs_device) { dbg_parse("sysfs_device->path='%s'", sysfs_device->path); dbg_parse("sysfs_device->bus_id='%s'", sysfs_device->bus_id); + strfieldcpy(udev->bus_id, sysfs_device->bus_id); } else { dbg_parse("class_dev->name = '%s'", class_dev->name); } + build_kernel_number(class_dev, udev); + /* rules are looked at in priority order */ - retval = do_callout(class_dev, udev, value, sizeof(value)); + retval = do_callout(class_dev, udev); if (retval == 0) goto found; @@ -876,48 +941,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) found: /* substitute placeholder in NAME */ - while (1) { - char *pos = strchr(udev->name, '%'); - char *dig; - char name[NAME_SIZE]; - - if (pos) { - strfieldcpy(name, pos+2); - *pos = 0x00; - switch (pos[1]) { - case 'b': - if (!sysfs_device) - break; - strcat(udev->name, sysfs_device->bus_id); - dbg("substitute bus_id '%s'", sysfs_device->bus_id); - break; - case 'n': - dig = class_dev->name + strlen(class_dev->name); - while (isdigit(*(dig-1))) - dig--; - strcat(pos, dig); - dbg("substitute kernel number '%s'", dig); - break; - case 'm': - sprintf(pos, "%u", udev->minor); - dbg("substitute minor number '%u'", udev->minor); - break; - case 'M': - sprintf(pos, "%u", udev->major); - dbg("substitute major number '%u'", udev->major); - break; - case 'c': - strcat(pos, value); - dbg("substitute callout output '%s'", value); - break; - default: - dbg("unknown substitution type '%%%c'", pos[1]); - break; - } - strcat(udev->name, name); - } else - break; - } + apply_format(udev, udev->name); done: /* mode was never set above */ diff --git a/test/udev-test.pl b/test/udev-test.pl index 613aa792d4..02f8ff6319 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -90,6 +90,15 @@ CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n special-device", ID="special--*", NAM CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n special-device", ID="special-device-", NAME="%c-3-%n" CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n special-device", ID="special-devic", NAME="%c-4-%n" CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n special-device", ID="special-*", NAME="%c-%n" +EOF + }, + { + desc => "callout program subtitution", + subsys => "block", + devpath => "block/sda/sda3", + expected => "test-0:0:0:0" , + conf => < Date: Sun, 23 Nov 2003 23:39:39 -0800 Subject: [PATCH] updated the man page with the latest format specifier changes. --- udev.8 | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/udev.8 b/udev.8 index 079d15f4d1..e9470838b4 100644 --- a/udev.8 +++ b/udev.8 @@ -46,6 +46,11 @@ The line format is: .RE where valid methods with corresponding keys are: .TP +.B CALLOUT +calling external program, that returns a string to match +.br +keys: \fBBUS\fP, \fBPROGRAM\fP, \fBID\fP +.TP .B LABEL device label or serial number, like USB serial number, SCSI UUID or file system label @@ -66,13 +71,23 @@ keys: \fBBUS\fP, \fBPLACE\fP string replacement of the kernel device name .br key: \fBKERNEL_NAME\fP -.TP +.P +The methods are applied in the following order: .B CALLOUT -calling external program, that returns a string to match -.br -keys: \fBBUS\fP, \fBPROGRAM\fP, \fBID\fP +, +.B LABEL +, +.B NUMBER +, +.B TOPOLOGY +, +.B REPLACE .P -The name field supports simple printf-like string subtitution: +The +.B NAME +and +.B PROGRAM +fields support simple printf-like string subtitution: .RS .TP .B %n @@ -87,11 +102,17 @@ the kernel minor number for the device .TP .B %b the bus id for the device +.TP +.B %c +the CALLOUT program return value (this does not work within the PROGRAM field for the obvious reason.) .RE .P A sample \fIudev.conf\fP might look like this: .sp .nf +# if /sbin/scsi_id returns "OEM 0815" device will be called disk1 +CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1" + # USB printer to be called lp_color LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_color" @@ -104,9 +125,6 @@ TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" # ttyUSB1 should always be called pda REPLACE, KERNEL="ttyUSB1", NAME="pda" -# if /sbin/scsi_id returns "OEM 0815" device will be called disk1 -CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1" - # USB webcams to be called webcam0, webcam1, ... LABEL, BUS="usb", model="WebCam Version 3", NAME="webcam%n" .fi @@ -119,6 +137,8 @@ lines beginning with a '#' will be ignored. Every line lists a device name followed by numeric owner, group and permission mode. All values are separated by colons. The name field may end with a wildcard to apply the values to a whole class of devices. +.br +If udev was built using glibc, string owner and group names may be used. .sp A sample \fIudev.permissions\fP might look like this: .sp @@ -128,6 +148,11 @@ ttyUSB1:0:8:0660 video*:500:500:0660 dsp1:::0666 .fi +.P +If +.B +udev +was built using glibc, string owner and group names may be used. .SH "FILES" .nf -- cgit v1.2.3-54-g00ecf From a86d6f567289ab546ebb06629f2d9b25555e0414 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 23 Nov 2003 23:39:59 -0800 Subject: [PATCH] update default config file with a CALLOUT rule, and more documentation. --- udev.config | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/udev.config b/udev.config index 8d77099ca8..3eb688a3a0 100644 --- a/udev.config +++ b/udev.config @@ -1,13 +1,18 @@ -# There are a number of modifiers that are allowed to be used in the NAME field. +# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields. # They provide the following subsitutions: # %n - the "kernel number" of the device. # for example, 'sda3' has a "kernel number" of '3' # %M - the kernel major number for the device # %m - the kernel minor number for the device # %b - the bus id for the device +# %c - the return value for the CALLOUT program (note, this doesn't work within +# the PROGRAM field for the obvious reason.) # -# My usb camera... +# Looking for scsi bus id 42:0:0:1 +CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" + +# A usb camera. LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera%n" # USB Epson printer to be called lp_epson -- cgit v1.2.3-54-g00ecf From f02763a95be342d169c8e194a78337cc7b74c9d8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 24 Nov 2003 00:03:10 -0800 Subject: [PATCH] v007 Changelog --- ChangeLog | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ChangeLog b/ChangeLog index c1cf43bdc7..efaf86669a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +Summary of changes from v006 to v007 +============================================ + +: + o fix segfault in parsing bad udev.permissions file + +Greg Kroah-Hartman: + o update default config file with a CALLOUT rule, and more documentation + o updated the man page with the latest format specifier changes + o added ability to put format specifiers in the CALLOUT program string + o tweak udev-test.pl to report '0' errors if that's what happened + o only build klibc_fixups.c if we are actually using klibc + o add support for string group and string user names in udev.permissions + o add getgrnam and getpwnam to klibc_fixups files + o remove Makefile.klibc + o add udev-test perl script from Kay Sievers which blows away my puny shell scripts + o added debian's version of udev.permissions + o change to 006_bk version + +Kay Sievers: + o format char for CALLOUT output + o more namedev whitespace cleanups + o support arguments in callout exec + o namedev.c - change order of fields in CALLOUT + o namedev.c whitespace + debug text cleanup + o man page with udev.permissions wildcard + +Olaf Hering: + o static klibc udev does not link against crt0.o + Summary of changes from v005 to v006 ============================================ -- cgit v1.2.3-54-g00ecf From 44132eca4e36e9c9976b72eb9c14e3b8ce5c0e10 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 24 Nov 2003 00:03:24 -0800 Subject: [PATCH] v007 release --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a2f904a745..376881f068 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 006_bk +VERSION = 007 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 4da7e8808f..399c34f8b3 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 006_bk +Version: 007 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 58a16d607ba79b03640e67679d0c54527b00111b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 24 Nov 2003 05:38:01 -0800 Subject: [PATCH] 007_bk version change to Makefile. --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 376881f068..af181fe24a 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = true ROOT = udev -VERSION = 007 +VERSION = 007_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 399c34f8b3..0c30d613b7 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 007 +Version: 007_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From f8f00338a15409f685fc51184862bca5988aee21 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 24 Nov 2003 05:44:01 -0800 Subject: [PATCH] udev-test.pl - tweaks I found two missing characters and optimized $PWD. --- test/udev-test.pl | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 02f8ff6319..e4a4ddcda8 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -21,9 +21,7 @@ use warnings; use strict; -my $PWD = `pwd`; -chomp($PWD); - +my $PWD = $ENV{PWD}; my $sysfs = "sys/"; my $udev_bin = "../udev"; my $udev_root = "udev-root/"; # !!! directory will be removed !!! @@ -80,7 +78,7 @@ TOPOLOGY, BUS="scsi", PLACE="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:b EOF }, { - desc => "callout result subtitution, only last should match", + desc => "callout result substitution, only last should match", subsys => "block", devpath => "block/sda/sda3", expected => "special-device-3" , @@ -93,7 +91,7 @@ CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n special-device", ID="special-*", NAME EOF }, { - desc => "callout program subtitution", + desc => "callout program substitution", subsys => "block", devpath => "block/sda/sda3", expected => "test-0:0:0:0" , @@ -151,7 +149,6 @@ foreach my $config (@tests) { system("tree $udev_root"); print "\n"; $error++; -# next; } udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf}); -- cgit v1.2.3-54-g00ecf From 89f38d18cef11f5fabd7ec73be1839491cf95cbc Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 24 Nov 2003 06:13:05 -0800 Subject: [PATCH] fix the test.block and test.tty scripts due to their moveing. Also add a test.all script. --- test/test.all | 41 +++++++++++++++++++++++++++++++++++++++++ test/test.block | 2 +- test/test.tty | 2 +- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 test/test.all diff --git a/test/test.all b/test/test.all new file mode 100644 index 0000000000..527569bd43 --- /dev/null +++ b/test/test.all @@ -0,0 +1,41 @@ +#! /bin/sh +# +# test.block - run udev(8) on each block device in /sys/block + +if [ $# = "0" ] ; then + echo + echo "usage: $0 " + echo "where is \"add\" or \"remove\"" + echo + exit 1 +fi + +SYSFSDIR=/sys # change this for a nonstand sysfs mount point +BIN=../udev # location of your udev binary +export ACTION=$1 # 'add' or 'remove' + +# do the block devices first +for i in ${SYSFSDIR}/block/*; do + # add each drive + export DEVPATH=${i#${SYSFSDIR}} + $BIN block + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${SYSFSDIR}} + $BIN block + fi + done +done + +# now all the devices in the class directories +for i in ${SYSFSDIR}/class/*; do + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${SYSFSDIR}} + CLASS=`echo ${i#${SYSFSDIR}} | cut --delimiter='/' --fields=3-` + $BIN $CLASS + fi + done +done diff --git a/test/test.block b/test/test.block index b806a42aac..294c47c0be 100644 --- a/test/test.block +++ b/test/test.block @@ -11,7 +11,7 @@ if [ $# = "0" ] ; then fi SYSFSDIR=/sys # change this for a nonstand sysfs mount point -BIN=./udev # location of your udev binary +BIN=../udev # location of your udev binary export ACTION=$1 # 'add' or 'remove' for i in ${SYSFSDIR}/block/*; do diff --git a/test/test.tty b/test/test.tty index 42f46a2e7c..b89ad5a6d8 100644 --- a/test/test.tty +++ b/test/test.tty @@ -11,7 +11,7 @@ if [ $# = "0" ] ; then fi SYSFSDIR=/sys # change this for a nonstand sysfs mount point -BIN=./udev # location of your udev binary +BIN=../udev # location of your udev binary export ACTION=$1 # 'add' or 'remove' for i in ${SYSFSDIR}/class/tty/*; do -- cgit v1.2.3-54-g00ecf From 7e1b28e8faad308523a22a78930c47e5cf9cb6cf Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 24 Nov 2003 06:19:44 -0800 Subject: [PATCH] fix udev init.d script to handle all class devices in sysfs. --- etc/init.d/udev | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/etc/init.d/udev b/etc/init.d/udev index 99f06c2963..5c09afd205 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -24,24 +24,31 @@ case "$1" in # device bring up action "Creating initial udev device nodes: " /bin/true export ACTION=add - # add tty devices - for i in ${sysfs_dir}/class/tty/*; do - export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` - $bin tty - done # add block devices and their partitions for i in ${sysfs_dir}/block/*; do - export DEVPATH="/"`echo $i | cut --delimiter='/' --fields=3-` + # add each drive + export DEVPATH=${i#${sysfs_dir}} $bin block + + # add each partition, on each device for j in $i/*; do if [ -f $j/dev ]; then - export DEVPATH="/"`echo $j | \ - cut --delimiter='/' --fields=3-` + export DEVPATH=${j#${sysfs_dir}} $bin block fi done done - # TODO: add other device classes + # all other device classes + for i in ${sysfs_dir}/class/*; do + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${sysfs_dir}} + CLASS=`echo ${i#${sysfs_dir}} | \ + cut --delimiter='/' --fields=3-` + $bin $CLASS + fi + done + done ;; stop) # be careful -- cgit v1.2.3-54-g00ecf From 02cbdf5eb9af4af5c3f612990ac3250bdd2135c7 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 24 Nov 2003 21:57:33 -0800 Subject: [PATCH] sync up with the 0.84 version of klibc --- klibc/klibc/Makefile | 1 + klibc/klibc/README | 8 +- klibc/klibc/SYSCALLS | 6 +- klibc/klibc/arch/alpha/include/klibc/archsignal.h | 13 + klibc/klibc/arch/arm/include/klibc/archsignal.h | 13 + klibc/klibc/arch/cris/include/klibc/archsignal.h | 13 + klibc/klibc/arch/i386/include/klibc/archsignal.h | 13 + klibc/klibc/arch/ia64/Makefile.inc | 6 + klibc/klibc/arch/ia64/crt0.S | 27 ++ klibc/klibc/arch/ia64/include/klibc/archsetjmp.h | 17 + klibc/klibc/arch/ia64/include/klibc/archsignal.h | 33 ++ klibc/klibc/arch/ia64/include/klibc/archsys.h | 208 ++++++++++++- klibc/klibc/arch/ia64/setjmp.S | 341 +++++++++++++++++++++ klibc/klibc/arch/ia64/vfork.S | 41 +++ klibc/klibc/arch/m68k/include/klibc/archsignal.h | 13 + klibc/klibc/arch/mips/include/klibc/archsignal.h | 13 + klibc/klibc/arch/mips64/include/klibc/archsignal.h | 13 + klibc/klibc/arch/parisc/include/klibc/archsignal.h | 13 + klibc/klibc/arch/ppc/include/klibc/archsignal.h | 13 + klibc/klibc/arch/ppc64/include/klibc/archsignal.h | 13 + klibc/klibc/arch/s390/include/klibc/archsignal.h | 13 + klibc/klibc/arch/s390x/include/klibc/archsignal.h | 13 + klibc/klibc/arch/sh/include/klibc/archsignal.h | 13 + klibc/klibc/arch/sparc/include/klibc/archsignal.h | 13 + .../klibc/arch/sparc64/include/klibc/archsignal.h | 13 + klibc/klibc/arch/x86_64/include/klibc/archsignal.h | 13 + klibc/klibc/ctypes.c | 3 + klibc/klibc/include/ctype.h | 7 +- klibc/klibc/include/signal.h | 4 +- klibc/klibc/include/string.h | 3 + klibc/klibc/include/syslog.h | 4 +- klibc/klibc/include/unistd.h | 3 +- klibc/klibc/strcasecmp.c | 25 ++ klibc/klibc/strncasecmp.c | 24 ++ klibc/klibc/strndup.c | 17 + klibc/klibc/syslog.c | 2 +- 36 files changed, 970 insertions(+), 18 deletions(-) create mode 100644 klibc/klibc/arch/alpha/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/arm/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/cris/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/i386/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/ia64/crt0.S create mode 100644 klibc/klibc/arch/ia64/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/ia64/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/ia64/setjmp.S create mode 100644 klibc/klibc/arch/ia64/vfork.S create mode 100644 klibc/klibc/arch/m68k/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/mips/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/mips64/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/parisc/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/ppc/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/ppc64/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/s390/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/s390x/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/sh/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/sparc/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/sparc64/include/klibc/archsignal.h create mode 100644 klibc/klibc/arch/x86_64/include/klibc/archsignal.h create mode 100644 klibc/klibc/strcasecmp.c create mode 100644 klibc/klibc/strncasecmp.c create mode 100644 klibc/klibc/strndup.c diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index 470a276ded..e1d63381c1 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -27,6 +27,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ memmove.o \ + strcasecmp.o strncasecmp.o strndup.o strerror.o \ strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o \ strncat.o strstr.o strncmp.o strncpy.o strrchr.o strspn.o \ strsep.o strtok.o \ diff --git a/klibc/klibc/README b/klibc/klibc/README index 7d5751804f..ce0ad7ba6a 100644 --- a/klibc/klibc/README +++ b/klibc/klibc/README @@ -34,11 +34,11 @@ b) If you're cross-compiling, change ARCH in the main MCONFIG file to The following is the last known status of various architectures: - Known to work: alpha arm i386 s390 s390x sparc sparc64 x86_64* + Known to work: alpha arm ia64 i386 s390 s390x sparc + sparc64 x86_64* Works static, not shared: mips* arm-thumb sh* - Need crt0.S updates: ppc - Missing setjmp: ppc64 - Need porting work: cris ia64 m68k mips64 parisc + Might work: ppc ppc64 + Need porting work: cris m68k mips64 parisc x86_64: requires a kernel header patch (to be created) mips, sh: linker problem; might work with fixed linker diff --git a/klibc/klibc/SYSCALLS b/klibc/klibc/SYSCALLS index 802f8a1711..92dff963b3 100644 --- a/klibc/klibc/SYSCALLS +++ b/klibc/klibc/SYSCALLS @@ -11,7 +11,7 @@ # # Process-related syscalls # - pid_t vfork() + pid_t vfork() pid_t vfork@forkish() pid_t getpid() pid_t getxpid@dual0::getpid() @@ -140,8 +140,8 @@ int uname(struct utsname *) int setdomainname(const char *, size_t) int sethostname(const char *, size_t) int init_module(const char *, struct module *) -void * create_module(const char *, size_t) + void * create_module(const char *, size_t) int delete_module(const char *) -int query_module(const char *, int, void *, size_t, size_t) + int query_module(const char *, int, void *, size_t, size_t) int reboot::__reboot(int, int, int, void *) int syslog::klogctl(int, char *, int) diff --git a/klibc/klibc/arch/alpha/include/klibc/archsignal.h b/klibc/klibc/arch/alpha/include/klibc/archsignal.h new file mode 100644 index 0000000000..b870a05131 --- /dev/null +++ b/klibc/klibc/arch/alpha/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/alpha/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/arm/include/klibc/archsignal.h b/klibc/klibc/arch/arm/include/klibc/archsignal.h new file mode 100644 index 0000000000..77685e62f0 --- /dev/null +++ b/klibc/klibc/arch/arm/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/arm/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/cris/include/klibc/archsignal.h b/klibc/klibc/arch/cris/include/klibc/archsignal.h new file mode 100644 index 0000000000..73b2e196c9 --- /dev/null +++ b/klibc/klibc/arch/cris/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/cris/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/i386/include/klibc/archsignal.h b/klibc/klibc/arch/i386/include/klibc/archsignal.h new file mode 100644 index 0000000000..caea8d8b3d --- /dev/null +++ b/klibc/klibc/arch/i386/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/i386/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +typedef int sig_atomic_t; + +#endif diff --git a/klibc/klibc/arch/ia64/Makefile.inc b/klibc/klibc/arch/ia64/Makefile.inc index 1fb364f92e..edf43459f8 100644 --- a/klibc/klibc/arch/ia64/Makefile.inc +++ b/klibc/klibc/arch/ia64/Makefile.inc @@ -7,4 +7,10 @@ # accordingly. # +ARCHOBJS = \ + arch/$(ARCH)/vfork.o \ + arch/$(ARCH)/setjmp.o + +ARCHSOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS)) + archclean: diff --git a/klibc/klibc/arch/ia64/crt0.S b/klibc/klibc/arch/ia64/crt0.S new file mode 100644 index 0000000000..4b128154e8 --- /dev/null +++ b/klibc/klibc/arch/ia64/crt0.S @@ -0,0 +1,27 @@ + +#include + + .align 32 + .global _start + + .proc _start + .type _start,@function +_start: + .prologue + .save rp, r0 + + alloc r2 = ar.pfs,0,0,2,0 + movl r3 = FPSR_DEFAULT + ;; + adds out0= 16,sp /* argc pointer */ + movl gp = @gprel(0f) +0: mov r9 = ip + ;; + sub gp = r9, gp /* back-compute gp value */ + + .body + br.call.sptk.few rp = __libc_init + ;; + break 0 /* break miserably if we ever return */ + + .endp _start diff --git a/klibc/klibc/arch/ia64/include/klibc/archsetjmp.h b/klibc/klibc/arch/ia64/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..bd639c0b00 --- /dev/null +++ b/klibc/klibc/arch/ia64/include/klibc/archsetjmp.h @@ -0,0 +1,17 @@ +/* + * arch/ia64/include/klibc/archsetjmp.h + * + * Code borrowed from the FreeBSD kernel. + * + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +/* User code must not depend on the internal representation of jmp_buf. */ +#define _JBLEN 0x200 + +/* guaranteed 128-bit alignment! */ +typedef char jmp_buf[_JBLEN] __attribute__ ((aligned (16))); + +#endif diff --git a/klibc/klibc/arch/ia64/include/klibc/archsignal.h b/klibc/klibc/arch/ia64/include/klibc/archsignal.h new file mode 100644 index 0000000000..9ab0ed744c --- /dev/null +++ b/klibc/klibc/arch/ia64/include/klibc/archsignal.h @@ -0,0 +1,33 @@ +/* + * arch/ia64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions. + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +#define _NSIG 64 +#define _NSIG_BPW 64 +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +struct sigaction { + union { + __sighandler_t _sa_handler; + void (*_sa_sigaction)(int, struct siginfo *, void *); + } _u; + sigset_t sa_mask; + int sa_flags; +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +typedef int sig_atomic_t; + +#endif diff --git a/klibc/klibc/arch/ia64/include/klibc/archsys.h b/klibc/klibc/arch/ia64/include/klibc/archsys.h index ef5940ac25..fe331acf55 100644 --- a/klibc/klibc/arch/ia64/include/klibc/archsys.h +++ b/klibc/klibc/arch/ia64/include/klibc/archsys.h @@ -7,6 +7,212 @@ #ifndef _KLIBC_ARCHSYS_H #define _KLIBC_ARCHSYS_H -/* No special syscall definitions for this architecture */ +#define __IA64_BREAK "break 0x100000;;\n\t" + +#define _syscall0(type,name) \ +type \ +name (void) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15) \ + : "2" (_r15) ASM_ARGS_0 \ + : "memory" ASM_CLOBBERS_0); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return _retval; \ +} + +#define _syscall1(type,name,type1,arg1) \ +type \ +name (type1 arg1) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_1(arg1); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_1 \ + : "2" (_r15) ASM_ARGS_1 \ + : "memory" ASM_CLOBBERS_1); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return _retval; \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type \ +name (type1 arg1, type2 arg2) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_2(arg1, arg2); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_2 \ + : "2" (_r15) ASM_ARGS_2 \ + : "memory" ASM_CLOBBERS_2); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return _retval; \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type \ +name (type1 arg1, type2 arg2, type3 arg3) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_3(arg1, arg2, arg3); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_3 \ + : "2" (_r15) ASM_ARGS_3 \ + : "memory" ASM_CLOBBERS_3); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return _retval; \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type \ +name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_4(arg1, arg2, arg3, arg4); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_4 \ + : "2" (_r15) ASM_ARGS_4 \ + : "memory" ASM_CLOBBERS_4); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return _retval; \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ +type \ +name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_5(arg1, arg2, arg3, arg4, arg5); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_5 \ + : "2" (_r15) ASM_ARGS_5 \ + : "memory" ASM_CLOBBERS_5); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return _retval; \ +} + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ +type \ +name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_6 \ + : "2" (_r15) ASM_ARGS_6 \ + : "memory" ASM_CLOBBERS_6); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return _retval; \ +} + + +#define LOAD_ARGS_0() do { } while (0) +#define LOAD_ARGS_1(out0) \ + register long _out0 asm ("out0") = (long) (out0); \ + LOAD_ARGS_0 () +#define LOAD_ARGS_2(out0, out1) \ + register long _out1 asm ("out1") = (long) (out1); \ + LOAD_ARGS_1 (out0) +#define LOAD_ARGS_3(out0, out1, out2) \ + register long _out2 asm ("out2") = (long) (out2); \ + LOAD_ARGS_2 (out0, out1) +#define LOAD_ARGS_4(out0, out1, out2, out3) \ + register long _out3 asm ("out3") = (long) (out3); \ + LOAD_ARGS_3 (out0, out1, out2) +#define LOAD_ARGS_5(out0, out1, out2, out3, out4) \ + register long _out4 asm ("out4") = (long) (out4); \ + LOAD_ARGS_4 (out0, out1, out2, out3) +#define LOAD_ARGS_6(out0, out1, out2, out3, out4, out5) \ + register long _out5 asm ("out5") = (long) (out5); \ + LOAD_ARGS_5 (out0, out1, out2, out3, out4) + +#define ASM_OUTARGS_1 "=r" (_out0) +#define ASM_OUTARGS_2 ASM_OUTARGS_1, "=r" (_out1) +#define ASM_OUTARGS_3 ASM_OUTARGS_2, "=r" (_out2) +#define ASM_OUTARGS_4 ASM_OUTARGS_3, "=r" (_out3) +#define ASM_OUTARGS_5 ASM_OUTARGS_4, "=r" (_out4) +#define ASM_OUTARGS_6 ASM_OUTARGS_5, "=r" (_out5) + +#define ASM_ARGS_0 +#define ASM_ARGS_1 ASM_ARGS_0, "3" (_out0) +#define ASM_ARGS_2 ASM_ARGS_1, "4" (_out1) +#define ASM_ARGS_3 ASM_ARGS_2, "5" (_out2) +#define ASM_ARGS_4 ASM_ARGS_3, "6" (_out3) +#define ASM_ARGS_5 ASM_ARGS_4, "7" (_out4) +#define ASM_ARGS_6 ASM_ARGS_5, "8" (_out5) + +#define ASM_CLOBBERS_0 ASM_CLOBBERS_1, "out0" +#define ASM_CLOBBERS_1 ASM_CLOBBERS_2, "out1" +#define ASM_CLOBBERS_2 ASM_CLOBBERS_3, "out2" +#define ASM_CLOBBERS_3 ASM_CLOBBERS_4, "out3" +#define ASM_CLOBBERS_4 ASM_CLOBBERS_5, "out4" +#define ASM_CLOBBERS_5 ASM_CLOBBERS_6, "out5" +#define ASM_CLOBBERS_6 , "out6", "out7", \ + /* Non-stacked integer registers, minus r8, r10, r15. */ \ + "r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \ + "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \ + "r28", "r29", "r30", "r31", \ + /* Predicate registers. */ \ + "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \ + /* Non-rotating fp registers. */ \ + "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ + /* Branch registers. */ \ + "b6", "b7" #endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/ia64/setjmp.S b/klibc/klibc/arch/ia64/setjmp.S new file mode 100644 index 0000000000..50f91dc1d6 --- /dev/null +++ b/klibc/klibc/arch/ia64/setjmp.S @@ -0,0 +1,341 @@ +/* + * IA-64 specific setjmp/longjmp routines + * + * Inspired by setjmp.s from the FreeBSD kernel. + */ + +#define J_UNAT 0 +#define J_NATS 0x8 +#define J_PFS 0x10 +#define J_BSP 0x18 +#define J_RNAT 0x20 +#define J_PREDS 0x28 +#define J_LC 0x30 +#define J_R4 0x38 +#define J_R5 0x40 +#define J_R6 0x48 +#define J_R7 0x50 +#define J_SP 0x58 +#define J_F2 0x60 +#define J_F3 0x70 +#define J_F4 0x80 +#define J_F5 0x90 +#define J_F16 0xa0 +#define J_F17 0xb0 +#define J_F18 0xc0 +#define J_F19 0xd0 +#define J_F20 0xe0 +#define J_F21 0xf0 +#define J_F22 0x100 +#define J_F23 0x110 +#define J_F24 0x120 +#define J_F25 0x130 +#define J_F26 0x140 +#define J_F27 0x150 +#define J_F28 0x160 +#define J_F29 0x170 +#define J_F30 0x180 +#define J_F31 0x190 +#define J_FPSR 0x1a0 +#define J_B0 0x1a8 +#define J_B1 0x1b0 +#define J_B2 0x1b8 +#define J_B3 0x1c0 +#define J_B4 0x1c8 +#define J_B5 0x1d0 +#define J_SIGMASK 0x1d8 +#define J_SIGSET 0x1e0 +#define J_GP 0x1f0 + +// int setjmp(struct jmp_buffer *) +// +// Setup a non-local goto. +// +// Description: +// +// SetJump stores the current register set in the area pointed to +// by "save". It returns zero. Subsequent calls to "LongJump" will +// restore the registers and return non-zero to the same location. +// +// On entry, r32 contains the pointer to the jmp_buffer +// + .align 32 + .global setjmp +setjmp: + // + // Make sure buffer is aligned at 16byte boundary + // + add r10 = -0x10,r0 ;; // mask the lower 4 bits + and r32 = r32, r10;; + add r32 = 0x10, r32;; // move to next 16 byte boundary + + add r10 = J_PREDS, r32 // skip Unats & pfs save area + add r11 = J_BSP, r32 + // + // save immediate context + // + mov r2 = ar.bsp // save backing store pointer + mov r3 = pr // save predicates + flushrs + ;; + // + // save user Unat register + // + mov r16 = ar.lc // save loop count register + mov r14 = ar.unat // save user Unat register + + st8 [r10] = r3, J_LC-J_PREDS + st8 [r11] = r2, J_R4-J_BSP + ;; + st8 [r10] = r16, J_R5-J_LC + st8 [r32] = r14, J_NATS // Note: Unat at the + // beginning of the save area + mov r15 = ar.pfs + ;; + // + // save preserved general registers & NaT's + // + st8.spill [r11] = r4, J_R6-J_R4 + ;; + st8.spill [r10] = r5, J_R7-J_R5 + ;; + st8.spill [r11] = r6, J_SP-J_R6 + ;; + st8.spill [r10] = r7, J_F3-J_R7 + ;; + st8.spill [r11] = sp, J_F2-J_SP + ;; + // + // save spilled Unat and pfs registers + // + mov r2 = ar.unat // save Unat register after spill + ;; + st8 [r32] = r2, J_PFS-J_NATS // save unat for spilled regs + ;; + st8 [r32] = r15 // save pfs + // + // save floating registers + // + stf.spill [r11] = f2, J_F4-J_F2 + stf.spill [r10] = f3, J_F5-J_F3 + ;; + stf.spill [r11] = f4, J_F16-J_F4 + stf.spill [r10] = f5, J_F17-J_F5 + ;; + stf.spill [r11] = f16, J_F18-J_F16 + stf.spill [r10] = f17, J_F19-J_F17 + ;; + stf.spill [r11] = f18, J_F20-J_F18 + stf.spill [r10] = f19, J_F21-J_F19 + ;; + stf.spill [r11] = f20, J_F22-J_F20 + stf.spill [r10] = f21, J_F23-J_F21 + ;; + stf.spill [r11] = f22, J_F24-J_F22 + stf.spill [r10] = f23, J_F25-J_F23 + ;; + stf.spill [r11] = f24, J_F26-J_F24 + stf.spill [r10] = f25, J_F27-J_F25 + ;; + stf.spill [r11] = f26, J_F28-J_F26 + stf.spill [r10] = f27, J_F29-J_F27 + ;; + stf.spill [r11] = f28, J_F30-J_F28 + stf.spill [r10] = f29, J_F31-J_F29 + ;; + stf.spill [r11] = f30, J_FPSR-J_F30 + stf.spill [r10] = f31, J_B0-J_F31 // size of f31 + fpsr + // + // save FPSR register & branch registers + // + mov r2 = ar.fpsr // save fpsr register + mov r3 = b0 + ;; + st8 [r11] = r2, J_B1-J_FPSR + st8 [r10] = r3, J_B2-J_B0 + mov r2 = b1 + mov r3 = b2 + ;; + st8 [r11] = r2, J_B3-J_B1 + st8 [r10] = r3, J_B4-J_B2 + mov r2 = b3 + mov r3 = b4 + ;; + st8 [r11] = r2, J_B5-J_B3 + st8 [r10] = r3 + mov r2 = b5 + ;; + st8 [r11] = r2 + ;; + // + // return + // + mov r8 = r0 // return 0 from setjmp + mov ar.unat = r14 // restore unat + br.ret.sptk b0 + .endp setjmp + +// +// void longjmp(struct jmp_buffer *, int val) +// +// Perform a non-local goto. +// +// Description: +// +// LongJump initializes the register set to the values saved by a +// previous 'SetJump' and jumps to the return location saved by that +// 'SetJump'. This has the effect of unwinding the stack and returning +// for a second time to the 'SetJump'. +// + + .align 32 + .global longjmp +longjmp: + // + // Make sure buffer is aligned at 16byte boundary + // + add r10 = -0x10,r0 ;; // mask the lower 4 bits + and r32 = r32, r10;; + add r32 = 0x10, r32;; // move to next 16 byte boundary + + // + // caching the return value as we do invala in the end + // + mov r8 = r33 // return value + + // + // get immediate context + // + mov r14 = ar.rsc // get user RSC conf + add r10 = J_PFS, r32 // get address of pfs + add r11 = J_NATS, r32 + ;; + ld8 r15 = [r10], J_BSP-J_PFS // get pfs + ld8 r2 = [r11], J_LC-J_NATS // get unat for spilled regs + ;; + mov ar.unat = r2 + ;; + ld8 r16 = [r10], J_PREDS-J_BSP // get backing store pointer + mov ar.rsc = r0 // put RSE in enforced lazy + mov ar.pfs = r15 + ;; + + // + // while returning from longjmp the BSPSTORE and BSP needs to be + // same and discard all the registers allocated after we did + // setjmp. Also, we need to generate the RNAT register since we + // did not flushed the RSE on setjmp. + // + mov r17 = ar.bspstore // get current BSPSTORE + ;; + cmp.ltu p6,p7 = r17, r16 // is it less than BSP of +(p6) br.spnt.few .flush_rse + mov r19 = ar.rnat // get current RNAT + ;; + loadrs // invalidate dirty regs + br.sptk.many .restore_rnat // restore RNAT + +.flush_rse: + flushrs + ;; + mov r19 = ar.rnat // get current RNAT + mov r17 = r16 // current BSPSTORE + ;; +.restore_rnat: + // + // check if RNAT is saved between saved BSP and curr BSPSTORE + // + mov r18 = 0x3f + ;; + dep r18 = r18,r16,3,6 // get RNAT address + ;; + cmp.ltu p8,p9 = r18, r17 // RNAT saved on RSE + ;; +(p8) ld8 r19 = [r18] // get RNAT from RSE + ;; + mov ar.bspstore = r16 // set new BSPSTORE + ;; + mov ar.rnat = r19 // restore RNAT + mov ar.rsc = r14 // restore RSC conf + + + ld8 r3 = [r11], J_R4-J_LC // get lc register + ld8 r2 = [r10], J_R5-J_PREDS // get predicates + ;; + mov pr = r2, -1 + mov ar.lc = r3 + // + // restore preserved general registers & NaT's + // + ld8.fill r4 = [r11], J_R6-J_R4 + ;; + ld8.fill r5 = [r10], J_R7-J_R5 + ld8.fill r6 = [r11], J_SP-J_R6 + ;; + ld8.fill r7 = [r10], J_F2-J_R7 + ld8.fill sp = [r11], J_F3-J_SP + ;; + // + // restore floating registers + // + ldf.fill f2 = [r10], J_F4-J_F2 + ldf.fill f3 = [r11], J_F5-J_F3 + ;; + ldf.fill f4 = [r10], J_F16-J_F4 + ldf.fill f5 = [r11], J_F17-J_F5 + ;; + ldf.fill f16 = [r10], J_F18-J_F16 + ldf.fill f17 = [r11], J_F19-J_F17 + ;; + ldf.fill f18 = [r10], J_F20-J_F18 + ldf.fill f19 = [r11], J_F21-J_F19 + ;; + ldf.fill f20 = [r10], J_F22-J_F20 + ldf.fill f21 = [r11], J_F23-J_F21 + ;; + ldf.fill f22 = [r10], J_F24-J_F22 + ldf.fill f23 = [r11], J_F25-J_F23 + ;; + ldf.fill f24 = [r10], J_F26-J_F24 + ldf.fill f25 = [r11], J_F27-J_F25 + ;; + ldf.fill f26 = [r10], J_F28-J_F26 + ldf.fill f27 = [r11], J_F29-J_F27 + ;; + ldf.fill f28 = [r10], J_F30-J_F28 + ldf.fill f29 = [r11], J_F31-J_F29 + ;; + ldf.fill f30 = [r10], J_FPSR-J_F30 + ldf.fill f31 = [r11], J_B0-J_F31 ;; + + // + // restore branch registers and fpsr + // + ld8 r16 = [r10], J_B1-J_FPSR // get fpsr + ld8 r17 = [r11], J_B2-J_B0 // get return pointer + ;; + mov ar.fpsr = r16 + mov b0 = r17 + ld8 r2 = [r10], J_B3-J_B1 + ld8 r3 = [r11], J_B4-J_B2 + ;; + mov b1 = r2 + mov b2 = r3 + ld8 r2 = [r10], J_B5-J_B3 + ld8 r3 = [r11] + ;; + mov b3 = r2 + mov b4 = r3 + ld8 r2 = [r10] + ld8 r21 = [r32] // get user unat + ;; + mov b5 = r2 + mov ar.unat = r21 + + // + // invalidate ALAT + // + invala ;; + + br.ret.sptk b0 + .endp longjmp diff --git a/klibc/klibc/arch/ia64/vfork.S b/klibc/klibc/arch/ia64/vfork.S new file mode 100644 index 0000000000..0354fa9ef7 --- /dev/null +++ b/klibc/klibc/arch/ia64/vfork.S @@ -0,0 +1,41 @@ +/* + * ia64 specific vfork syscall + * + * Written By: Martin Hicks + * + */ + +/* This syscall is a special case of the clone syscall */ +#include +#include +#include + +/* These are redefined here because linux/sched.h isn't safe for + * inclusion in asm. + */ +#define CLONE_VM 0x00000100 /* set if VM shared between processes */ +#define CLONE_VFORK 0x00004000 /* set if parent wants the child to wake it up on exit */ + +/* pid_t vfork(void) */ +/* Implemented as clone(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ + + .proc vfork + .global vfork +vfork: + alloc r2=ar.pfs,0,0,2,0 + mov r15=__NR_clone + mov out0=CLONE_VM|CLONE_VFORK|SIGCHLD + mov out1=0 + ;; + __IA64_BREAK // Do the syscall + + addl r15=0,r1 + cmp.eq p7,p6 = -1,r10 + ;; + ld8 r14=[r15] + ;; +(p7) st4 [r14]=r8 + ;; +(p7) mov r8=-1 + br.ret.sptk.many b0 + .endp diff --git a/klibc/klibc/arch/m68k/include/klibc/archsignal.h b/klibc/klibc/arch/m68k/include/klibc/archsignal.h new file mode 100644 index 0000000000..714527f6b0 --- /dev/null +++ b/klibc/klibc/arch/m68k/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/m68k/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/mips/include/klibc/archsignal.h b/klibc/klibc/arch/mips/include/klibc/archsignal.h new file mode 100644 index 0000000000..3b72908636 --- /dev/null +++ b/klibc/klibc/arch/mips/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/mips/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/mips64/include/klibc/archsignal.h b/klibc/klibc/arch/mips64/include/klibc/archsignal.h new file mode 100644 index 0000000000..56b0fd323e --- /dev/null +++ b/klibc/klibc/arch/mips64/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/mips64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/parisc/include/klibc/archsignal.h b/klibc/klibc/arch/parisc/include/klibc/archsignal.h new file mode 100644 index 0000000000..511d774b2d --- /dev/null +++ b/klibc/klibc/arch/parisc/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/parisc/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/ppc/include/klibc/archsignal.h b/klibc/klibc/arch/ppc/include/klibc/archsignal.h new file mode 100644 index 0000000000..567a547ef9 --- /dev/null +++ b/klibc/klibc/arch/ppc/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/ppc/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/ppc64/include/klibc/archsignal.h b/klibc/klibc/arch/ppc64/include/klibc/archsignal.h new file mode 100644 index 0000000000..8452f6e4bc --- /dev/null +++ b/klibc/klibc/arch/ppc64/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/ppc64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/s390/include/klibc/archsignal.h b/klibc/klibc/arch/s390/include/klibc/archsignal.h new file mode 100644 index 0000000000..1f8de28b4b --- /dev/null +++ b/klibc/klibc/arch/s390/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/s390/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/s390x/include/klibc/archsignal.h b/klibc/klibc/arch/s390x/include/klibc/archsignal.h new file mode 100644 index 0000000000..08c9a0073a --- /dev/null +++ b/klibc/klibc/arch/s390x/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/s390x/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/sh/include/klibc/archsignal.h b/klibc/klibc/arch/sh/include/klibc/archsignal.h new file mode 100644 index 0000000000..6c4e5976ad --- /dev/null +++ b/klibc/klibc/arch/sh/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/sh/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/sparc/include/klibc/archsignal.h b/klibc/klibc/arch/sparc/include/klibc/archsignal.h new file mode 100644 index 0000000000..6af3709033 --- /dev/null +++ b/klibc/klibc/arch/sparc/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/sparc/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/sparc64/include/klibc/archsignal.h b/klibc/klibc/arch/sparc64/include/klibc/archsignal.h new file mode 100644 index 0000000000..f81bd668bb --- /dev/null +++ b/klibc/klibc/arch/sparc64/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/sparc64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/arch/x86_64/include/klibc/archsignal.h b/klibc/klibc/arch/x86_64/include/klibc/archsignal.h new file mode 100644 index 0000000000..74e82e1dd0 --- /dev/null +++ b/klibc/klibc/arch/x86_64/include/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/x86_64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/klibc/ctypes.c b/klibc/klibc/ctypes.c index a9398b8071..c7adc9882c 100644 --- a/klibc/klibc/ctypes.c +++ b/klibc/klibc/ctypes.c @@ -9,6 +9,8 @@ const unsigned char __ctypes[257] = { 0, /* EOF */ + + 0, /* control character */ 0, /* control character */ 0, /* control character */ 0, /* control character */ @@ -23,6 +25,7 @@ const unsigned char __ctypes[257] = { __ctype_space, /* FF */ __ctype_space, /* CR */ 0, /* control character */ + 0, /* control character */ 0, /* control character */ 0, /* control character */ diff --git a/klibc/klibc/include/ctype.h b/klibc/klibc/include/ctype.h index e1a25f3693..3f5cfad558 100644 --- a/klibc/klibc/include/ctype.h +++ b/klibc/klibc/include/ctype.h @@ -88,7 +88,7 @@ __ctype_inline int ispunct(int __c) __ctype_inline int isspace(int __c) { - return __ctypes[__c] & __ctype_space; + return __ctypes[__c+1] & __ctype_space; } __ctype_inline int isupper(int __c) @@ -101,8 +101,9 @@ __ctype_inline int isxdigit(int __c) return __ctypes[__c+1] & __ctype_xdigit; } -#define _toupper(__c) ((__c) & ~0x20) -#define _tolower(__c) ((__c) | 0x20) +/* Note: this is decimal, not hex, to avoid accidental promotion to unsigned */ +#define _toupper(__c) ((__c) & ~32) +#define _tolower(__c) ((__c) | 32) __ctype_inline int toupper(int __c) { diff --git a/klibc/klibc/include/signal.h b/klibc/klibc/include/signal.h index e383755b20..62c5083dc0 100644 --- a/klibc/klibc/include/signal.h +++ b/klibc/klibc/include/signal.h @@ -11,6 +11,8 @@ #include #include +#include + /* Some architectures don't define these */ #ifndef SA_RESETHAND # define SA_RESETHAND SA_ONESHOT @@ -22,8 +24,6 @@ # define NSIG _NSIG #endif -typedef int sig_atomic_t; - __extern const char * const sys_siglist[]; /* This assumes sigset_t is either an unsigned long or an array of such, diff --git a/klibc/klibc/include/string.h b/klibc/klibc/include/string.h index bce69284ec..1debb55af0 100644 --- a/klibc/klibc/include/string.h +++ b/klibc/klibc/include/string.h @@ -16,12 +16,15 @@ __extern void *memmove(void *, const void *, size_t); __extern void *memset(void *, int, size_t); __extern void *memmem(const void *, size_t, const void *, size_t); __extern void memswap(void *, void *, size_t); +__extern int strcasecmp(const char *, const char *); +__extern int strncasecmp(const char *, const char *, size_t); __extern char *strcat(char *, const char *); __extern char *strchr(const char *, int); __extern int strcmp(const char *, const char *); __extern char *strcpy(char *, const char *); __extern size_t strcspn(const char *, const char *); __extern char *strdup(const char *); +__extern char *strndup(const char *, size_t); __extern char *strerror(int); __extern size_t strlen(const char *); __extern char *strncat(char *, const char *, size_t); diff --git a/klibc/klibc/include/syslog.h b/klibc/klibc/include/syslog.h index a58ef05674..551527a042 100644 --- a/klibc/klibc/include/syslog.h +++ b/klibc/klibc/include/syslog.h @@ -5,8 +5,8 @@ #ifndef _SYSLOG_H #define _SYSLOG_H +#include #include -#include /* Alert levels */ #define LOG_EMERG 0 @@ -49,7 +49,7 @@ __extern void openlog(const char *, int, int); __extern void syslog(int, const char *, ...); +__extern void vsyslog(int, const char *, va_list); __extern void closelog(void); -__extern void vsyslog(int, const char *format, va_list ap); #endif /* _SYSLOG_H */ diff --git a/klibc/klibc/include/unistd.h b/klibc/klibc/include/unistd.h index 3c51c497a7..36c486f49d 100644 --- a/klibc/klibc/include/unistd.h +++ b/klibc/klibc/include/unistd.h @@ -82,6 +82,7 @@ __extern int ioctl(int, int, void *); __extern int flock(int, int); __extern int fsync(int); __extern int fdatasync(int); +__extern int ftruncate(int, off_t); __extern int pause(void); __extern unsigned int alarm(unsigned int); @@ -103,8 +104,6 @@ __extern int optind, opterr, optopt; __extern int isatty(int); -__extern int ftruncate(int, off_t); - /* Standard file descriptor numbers. */ #define STDIN_FILENO 0 #define STDOUT_FILENO 1 diff --git a/klibc/klibc/strcasecmp.c b/klibc/klibc/strcasecmp.c new file mode 100644 index 0000000000..e583491b35 --- /dev/null +++ b/klibc/klibc/strcasecmp.c @@ -0,0 +1,25 @@ +/* + * strcasecmp.c + * + */ + +#include +#include + +int strcasecmp(const char *s1, const char *s2) +{ + char *n1, *n2; + int i, retval; + + n1 = strdup(s1); + n2 = strdup(s2); + + for (i = 0; i < strlen(n1); i++) + n1[i] = toupper(n1[i]); + for (i = 0; i < strlen(n2); i++) + n2[i] = toupper(n2[i]); + retval = strcmp(n1, n2); + free(n1); + free(n2); + return retval; +} diff --git a/klibc/klibc/strncasecmp.c b/klibc/klibc/strncasecmp.c new file mode 100644 index 0000000000..542493de0f --- /dev/null +++ b/klibc/klibc/strncasecmp.c @@ -0,0 +1,24 @@ +/* + * strncasecmp.c + */ + +#include +#include + +int strncasecmp(const char *s1, const char *s2, size_t n) +{ + char *n1, *n2; + int i, retval; + + n1 = strndup(s1, n); + n2 = strndup(s2, n); + + for (i = 0; i < strlen(n1); i++) + n1[i] = toupper(n1[i]); + for (i = 0; i < strlen(n2); i++) + n2[i] = toupper(n2[i]); + retval = strcmp(n1, n2); + free(n1); + free(n2); + return retval; +} diff --git a/klibc/klibc/strndup.c b/klibc/klibc/strndup.c new file mode 100644 index 0000000000..1b44e6f99a --- /dev/null +++ b/klibc/klibc/strndup.c @@ -0,0 +1,17 @@ +/* + * strndup.c + */ + +#include +#include + +char *strndup(const char *s, size_t n) +{ + int l = n > strlen(s) ? strlen(s)+1 : n+1; + char *d = malloc(l); + + if (d) + memcpy(d, s, l); + d[n] = '\0'; + return d; +} diff --git a/klibc/klibc/syslog.c b/klibc/klibc/syslog.c index d40d8633d1..10a2dce405 100644 --- a/klibc/klibc/syslog.c +++ b/klibc/klibc/syslog.c @@ -60,7 +60,7 @@ void vsyslog(int prio, const char *format, va_list ap) if ( *id ) len += sprintf(buf+3, "%s: ", id); - + rv = vsnprintf(buf+len, BUFLEN-len, format, ap); len += rv; -- cgit v1.2.3-54-g00ecf From fee6f4150d0d5fbfc1ba74130bac1ae21ce69c81 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 24 Nov 2003 21:59:03 -0800 Subject: [PATCH] get rid of functions in klibc_fixups that are now in klibc --- klibc_fixups.c | 25 ------------------------- klibc_fixups.h | 4 ---- 2 files changed, 29 deletions(-) diff --git a/klibc_fixups.c b/klibc_fixups.c index c12c90fd1c..a99166811c 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -7,29 +7,4 @@ #include #include "klibc_fixups.h" -char *strerror(int errnum) -{ - return "some error"; -} - -int strcasecmp(const char *s1, const char *s2) -{ - char *n1; - char *n2; - int retval; - int i; - - n1 = strdup(s1); - n2 = strdup(s2); - - for (i = 0; i < strlen(n1); ++i) - n1[i] = toupper(n1[i]); - for (i = 0; i < strlen(n2); ++i) - n2[i] = toupper(n2[i]); - retval = strcmp(n1, n2); - free(n1); - free(n2); - return retval; -} - #endif diff --git a/klibc_fixups.h b/klibc_fixups.h index 21a23e7762..a89638ead4 100644 --- a/klibc_fixups.h +++ b/klibc_fixups.h @@ -4,10 +4,6 @@ #define KLIBC_FIXUPS_H -extern char *strerror(int errnum); - -extern int strcasecmp(const char *s1, const char *s2); - struct group { char *gr_name; /* group name */ char *gr_passwd; /* group password */ -- cgit v1.2.3-54-g00ecf From 74894b53f8f9f4de6f269a5c0c0f8ea03baa1587 Mon Sep 17 00:00:00 2001 From: "arnd@arndb.de" Date: Mon, 24 Nov 2003 22:10:23 -0800 Subject: [PATCH] klibc makefile fixes --- Makefile | 10 +++++++--- tdb/tdb.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index af181fe24a..d0c00aa88c 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,7 @@ udevdir = ${prefix}/udev/ # to compile vs uClibc, that can be done here as well. CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- CC = $(CROSS)gcc +LD = $(CROSS)gcc AR = $(CROSS)ar STRIP = $(CROSS)strip RANLIB = $(CROSS)ranlib @@ -109,6 +110,7 @@ endif ifeq ($(strip $(KLIBC)),true) KLIBC_DIR = klibc/klibc INCLUDE_DIR := $(KLIBC_DIR)/include + include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG # arch specific objects LIBGCC = $(shell $(CC) --print-libgcc) ARCH_LIB_OBJS = \ @@ -117,8 +119,10 @@ ifeq ($(strip $(KLIBC)),true) CRT0 = $(KLIBC_DIR)/crt0.o - LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) - CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(INCLUDE_DIR)/bits32 -I$(GCCINCDIR) -Iklibc/linux/include -D__KLIBC__ + LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) + CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(KLIBC_DIR)/arch/$(ARCH)/include \ + -I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -Iklibc/linux/include \ + -D__KLIBC__ LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles else @@ -169,7 +173,7 @@ udev_version.h: $(ROOT): $(GEN_HEADERS) $(OBJS) - $(CC) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) clean: diff --git a/tdb/tdb.h b/tdb/tdb.h index 6f3b1ff756..e236b31af5 100644 --- a/tdb/tdb.h +++ b/tdb/tdb.h @@ -25,6 +25,7 @@ extern "C" { #endif +#include /* flags to tdb_store() */ #define TDB_REPLACE 1 -- cgit v1.2.3-54-g00ecf From f7b4eca455c7dbf850d984892756f22dbd9ddc3d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 24 Nov 2003 22:27:17 -0800 Subject: [PATCH] overall whitespace + debug text conditioning 01-overall-whitespace+debug-text-conditioning.diff o cleanup whitespace o clarify a few comments o enclose all printed debug string values in '' --- logging.c | 14 +++++++------- namedev.c | 30 +++++++++++++++--------------- namedev.h | 3 +-- udev-add.c | 22 ++++++++++------------ udev-remove.c | 8 ++++---- udev.c | 11 +++++------ udev.h | 1 - udevdb.c | 14 +++++++------- udevdb.h | 6 +++--- 9 files changed, 52 insertions(+), 57 deletions(-) diff --git a/logging.c b/logging.c index 1ca3aed1a9..4815f39fdc 100644 --- a/logging.c +++ b/logging.c @@ -32,26 +32,26 @@ static int logging_init = 0; static unsigned char udev_logname[42]; -static void init_logging (void) +static void init_logging(void) { - snprintf(udev_logname,42,"udev[%d]", getpid()); + snprintf(udev_logname, 42,"udev[%d]", getpid()); - openlog (udev_logname, 0, LOG_DAEMON); + openlog(udev_logname, 0, LOG_DAEMON); logging_init = 1; } /** * log_message - sends a message to the logging facility */ -int log_message (int level, const char *format, ...) +int log_message(int level, const char *format, ...) { va_list args; if (!logging_init) init_logging(); - va_start (args, format); - vsyslog (level, format, args); - va_end (args); + va_start(args, format); + vsyslog(level, format, args); + va_end(args); return 1; } diff --git a/namedev.c b/namedev.c index e640b93c3d..21815b694a 100644 --- a/namedev.c +++ b/namedev.c @@ -216,10 +216,10 @@ static int namedev_init_config(void) int retval = 0; struct config_device dev; - dbg("opening %s to read as config", udev_config_filename); + dbg("opening '%s' to read as config", udev_config_filename); fd = fopen(udev_config_filename, "r"); if (fd == NULL) { - dbg("can't open %s", udev_config_filename); + dbg("can't open '%s'", udev_config_filename); return -ENODEV; } @@ -232,7 +232,7 @@ static int namedev_init_config(void) goto exit; lineno++; - dbg_parse("read %s", temp); + dbg_parse("read '%s'", temp); /* eat the whitespace at the beginning of the line */ while (isspace(*temp)) @@ -413,10 +413,10 @@ static int namedev_init_permissions(void) int retval = 0; struct config_device dev; - dbg("opening %s to read as permissions config", udev_config_permission_filename); + dbg("opening '%s' to read as permissions config", udev_config_permission_filename); fd = fopen(udev_config_permission_filename, "r"); if (fd == NULL) { - dbg("can't open %s", udev_config_permission_filename); + dbg("can't open '%s'", udev_config_permission_filename); return -ENODEV; } @@ -426,7 +426,7 @@ static int namedev_init_permissions(void) if (temp == NULL) break; - dbg_parse("read %s", temp); + dbg_parse("read '%s'", temp); /* eat the whitespace at the beginning of the line */ while (isspace(*temp)) @@ -445,21 +445,21 @@ static int namedev_init_permissions(void) /* parse the line */ temp2 = strsep(&temp, ":"); if (!temp2) { - dbg("cannot parse line: %s", line); + dbg("cannot parse line '%s'", line); continue; } strncpy(dev.name, temp2, sizeof(dev.name)); temp2 = strsep(&temp, ":"); if (!temp2) { - dbg("cannot parse line: %s", line); + dbg("cannot parse line '%s'", line); continue; } strncpy(dev.owner, temp2, sizeof(dev.owner)); temp2 = strsep(&temp, ":"); if (!temp2) { - dbg("cannot parse line: %s", line); + dbg("cannot parse line '%s'", line); continue; } strncpy(dev.group, temp2, sizeof(dev.owner)); @@ -496,7 +496,7 @@ static void build_kernel_number(struct sysfs_class_device *class_dev, struct ude while (isdigit(*(dig-1))) dig--; strfieldcpy(udev->kernel_number, dig); - dbg("kernel_number = %s", udev->kernel_number); + dbg("kernel_number='%s'", udev->kernel_number); } static void apply_format(struct udevice *udev, unsigned char *string) @@ -608,7 +608,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) break; buffer[res] = '\0'; if (res > len) { - dbg("callout len %d too short\n", len); + dbg("callout len %d too short", len); retval = -1; } if (value_set) { @@ -660,7 +660,7 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev strfieldcpy(udev->group, dev->group); } dbg_parse("callout returned matching value '%s', '%s' becomes '%s'" - " - owner='%s', group='%s', mode =%#o", + " - owner='%s', group='%s', mode=%#o", dev->id, class_dev->name, udev->name, dev->owner, dev->group, dev->mode); return 0; @@ -884,11 +884,11 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) * up in the kernel... */ if (strstr(class_dev->path, "block")) { - dbg_parse("looking at block device..."); + dbg_parse("looking at block device"); if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { char path[SYSFS_PATH_MAX]; - dbg_parse("really is a partition..."); + dbg_parse("really is a partition"); strfieldcpy(path, class_dev->path); temp = strrchr(path, '/'); *temp = 0x00; @@ -897,7 +897,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) if (class_dev_parent == NULL) { dbg("sysfs_open_class_device at '%s' failed", path); } else { - dbg_parse("class_dev_parent->name=%s", class_dev_parent->name); + dbg_parse("class_dev_parent->name='%s'", class_dev_parent->name); if (class_dev_parent->sysdevice) sysfs_device = class_dev_parent->sysdevice; } diff --git a/namedev.h b/namedev.h index 56e6a96c03..5ea843e9b7 100644 --- a/namedev.h +++ b/namedev.h @@ -50,7 +50,6 @@ struct config_device { struct list_head node; enum config_type type; - char bus[BUS_SIZE]; char sysfs_file[FILE_SIZE]; char sysfs_value[VALUE_SIZE]; @@ -58,7 +57,7 @@ struct config_device { char place[PLACE_SIZE]; char kernel_name[NAME_SIZE]; char exec_program[FILE_SIZE]; - + /* what to set the device to */ char name[NAME_SIZE]; char owner[OWNER_SIZE]; diff --git a/udev-add.c b/udev-add.c index 068fd46f27..a71d435e32 100644 --- a/udev-add.c +++ b/udev-add.c @@ -60,12 +60,12 @@ static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice if (dev == NULL) goto exit; - dbg("dev = %s", dev); + dbg("dev='%s'", dev); if (sscanf(dev, "%u:%u", &udev->major, &udev->minor) != 2) goto exit; - dbg("found major = %d, minor = %d", udev->major, udev->minor); + dbg("found major=%d, minor=%d", udev->major, udev->minor); retval = 0; exit: @@ -129,7 +129,7 @@ static int create_node(struct udevice *dev) path, strerror(errno)); return retval; } - dbg("created %s", path); + dbg("created '%s'", path); } *pos = '/'; } @@ -155,7 +155,7 @@ static int create_node(struct udevice *dev) else { struct passwd *pw = getpwnam(dev->owner); if (!pw) - dbg("user unknown: %s", dev->owner); + dbg("user unknown '%s'", dev->owner); else uid = pw->pw_uid; } @@ -169,7 +169,7 @@ static int create_node(struct udevice *dev) else { struct group *gr = getgrnam(dev->group); if (!gr) - dbg("group unknown: %s", dev->group); + dbg("group unknown '%s'", dev->group); else gid = gr->gr_gid; } @@ -194,7 +194,7 @@ static struct sysfs_class_device *get_class_dev(char *device_name) strcpy(dev_path, sysfs_path); strcat(dev_path, device_name); - dbg("looking at %s", dev_path); + dbg("looking at '%s'", dev_path); /* open up the sysfs class device for this thing... */ class_dev = sysfs_open_class_device(dev_path); @@ -202,7 +202,7 @@ static struct sysfs_class_device *get_class_dev(char *device_name) dbg ("sysfs_open_class_device failed"); goto exit; } - dbg("class_dev->name = %s", class_dev->name); + dbg("class_dev->name='%s'", class_dev->name); exit: return class_dev; @@ -225,13 +225,12 @@ static int sleep_for_dev(char *path) while (loop--) { struct stat buf; - dbg("looking for %s", filename); + dbg("looking for '%s'", filename); retval = stat(filename, &buf); if (!retval) goto exit; - /* sleep for a second or two to give the kernel a chance to - * create the dev file */ + /* sleep to give the kernel a chance to create the dev file */ sleep(1); } retval = -ENODEV; @@ -276,7 +275,7 @@ int udev_add_device(char *path, char *subsystem) dbg("udevdb_add_dev failed, but we are going to try to create the node anyway. " "But remove might not work properly for this device."); - dbg("name = %s", dev.name); + dbg("name='%s'", dev.name); retval = create_node(&dev); exit: @@ -285,4 +284,3 @@ exit: return retval; } - diff --git a/udev-remove.c b/udev-remove.c index 1cf5d5134d..0f14a3d685 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -52,14 +52,14 @@ static char *get_name(char *path, int major, int minor) goto exit; } - dbg("%s not found in database, falling back on default name", path); + dbg("'%s' not found in database, falling back on default name", path); temp = strrchr(path, '/'); if (temp == NULL) return NULL; strncpy(name, &temp[1], sizeof(name)); exit: - dbg("name is %s", name); + dbg("name is '%s'", name); return &name[0]; } @@ -74,7 +74,7 @@ static int delete_node(char *name) strncpy(filename, udev_root, sizeof(filename)); strncat(filename, name, sizeof(filename)); - dbg("unlinking %s", filename); + dbg("unlinking '%s'", filename); retval = unlink(filename); if (retval) { dbg("unlink(%s) failed with error '%s'", @@ -104,7 +104,7 @@ static int delete_node(char *name) filename, strerror(errno)); break; } - dbg("removed %s", filename); + dbg("removed '%s'", filename); } } return retval; diff --git a/udev.c b/udev.c index 56dab1f832..a562bc27be 100644 --- a/udev.c +++ b/udev.c @@ -105,7 +105,7 @@ static void get_dirs(void) if (temp) udev_permission = temp; } - dbg("sysfs_path = %s", sysfs_path); + dbg("sysfs_path='%s'", sysfs_path); strncpy(udev_db_filename, udev_config_dir, sizeof(udev_db_filename)); strncat(udev_db_filename, udev_db, sizeof(udev_db_filename)); @@ -141,12 +141,12 @@ int main(int argc, char **argv, char **envp) dbg ("no devpath?"); goto exit; } - dbg("looking at %s", devpath); + dbg("looking at '%s'", devpath); /* we only care about class devices and block stuff */ if (!strstr(devpath, "class") && !strstr(devpath, "block")) { - dbg("not block or class"); + dbg("not a block or class device"); goto exit; } @@ -166,7 +166,7 @@ int main(int argc, char **argv, char **envp) get_dirs(); retval = udevdb_init(UDEVDB_DEFAULT); if (retval != 0) { - dbg("Unable to initialize database."); + dbg("unable to initialize database"); goto exit; } @@ -180,7 +180,7 @@ int main(int argc, char **argv, char **envp) retval = udev_remove_device(devpath, subsystem); else { - dbg("Unknown action: %s", action); + dbg("unknown action '%s'", action); retval = -EINVAL; } udevdb_exit(); @@ -188,4 +188,3 @@ int main(int argc, char **argv, char **envp) exit: return retval; } - diff --git a/udev.h b/udev.h index 6798f13666..8e35cb708f 100644 --- a/udev.h +++ b/udev.h @@ -95,4 +95,3 @@ extern char udev_config_permission_filename[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; #endif - diff --git a/udevdb.c b/udevdb.c index ec67a07962..e0bd39e84b 100644 --- a/udevdb.c +++ b/udevdb.c @@ -54,7 +54,7 @@ int udevdb_add_dev(const char *path, const struct udevice *dev) strcpy(keystr, path); key.dptr = keystr; key.dsize = strlen(keystr) + 1; - + data.dptr = (void *)dev; data.dsize = sizeof(*dev); @@ -79,7 +79,7 @@ struct udevice *udevdb_get_dev(const char *path) dev = malloc(sizeof(*dev)); if (dev == NULL) goto exit; - + memcpy(dev, data.dptr, sizeof(*dev)); exit: free(data.dptr); @@ -99,7 +99,7 @@ int udevdb_delete_dev(const char *path) key.dptr = keystr; key.dsize = strlen(keystr) + 1; - + return tdb_delete(udevdb, key); } @@ -116,8 +116,8 @@ void udevdb_exit(void) /** * udevdb_init: initializes database - * @init_flag: database can either be in memory - UDEVDB_INTERNAL - or - * written to a file with UDEVDB_DEFAULT. + * @init_flag: UDEVDB_INTERNAL - database stays in memory + * UDEVDB_DEFAULT - database is written to a file */ int udevdb_init(int init_flag) { @@ -127,9 +127,9 @@ int udevdb_init(int init_flag) udevdb = tdb_open(udev_db_filename, 0, init_flag, O_RDWR | O_CREAT, 0644); if (udevdb == NULL) { if (init_flag == UDEVDB_INTERNAL) - dbg("Unable to initialize in-memory database"); + dbg("unable to initialize in-memory database"); else - dbg("Unable to initialize database at %s", udev_db_filename); + dbg("unable to initialize database at '%s'", udev_db_filename); return -EINVAL; } return 0; diff --git a/udevdb.h b/udevdb.h index 9935e80e9c..97e1f9bc40 100644 --- a/udevdb.h +++ b/udevdb.h @@ -5,10 +5,10 @@ #define _UDEVDB_H_ /* Udevdb initialization flags */ -#define UDEVDB_DEFAULT 0 /* Defaults database to use file */ -#define UDEVDB_INTERNAL 1 /* Don't store db on disk, use in memory */ +#define UDEVDB_DEFAULT 0 /* defaults database to use file */ +#define UDEVDB_INTERNAL 1 /* don't store db on disk, use in memory */ -/* Function Prototypes */ +/* function prototypes */ extern void udevdb_exit(void); extern int udevdb_init(int init_flag); -- cgit v1.2.3-54-g00ecf From 6968d494d76ea0e6e326e23948d2428b53faccf8 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 24 Nov 2003 22:27:20 -0800 Subject: [PATCH] namedev.c strcat tweak 02-namedev.c-strcat-tweak.diff o cat the substitution to the already known end of the string instead of searching it another time --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 21815b694a..83852f9df2 100644 --- a/namedev.c +++ b/namedev.c @@ -514,7 +514,7 @@ static void apply_format(struct udevice *udev, unsigned char *string) case 'b': if (strlen(udev->bus_id) == 0) break; - strcat(string, udev->bus_id); + strcat(pos, udev->bus_id); dbg("substitute bus_id '%s'", udev->bus_id); break; case 'n': -- cgit v1.2.3-54-g00ecf From 5499d319057de0ca6407e07ef99069610633f56f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 24 Nov 2003 22:27:23 -0800 Subject: [PATCH] udev-test.pl add subdir test 03-udev-test.pl-add-subdir-test.diff o duplicate existing test and change it to explicitely test the subdir handling --- test/udev-test.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index e4a4ddcda8..2835489238 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -57,6 +57,15 @@ EOF expected => "visor" , conf => < "subdirectory handling", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "sub/direct/ory/visor" , + conf => < Date: Mon, 24 Nov 2003 22:27:25 -0800 Subject: [PATCH] udev.8 tweak numeric id text 04-udev.8-tweak-numeric-id-text.diff o change "return value" to "returned string" o add textual owner/group example for udev.permissions o mention klibc compile as special case for udev.permissions o remove duplicated numeric owner clause --- udev.8 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/udev.8 b/udev.8 index e9470838b4..1500b3b424 100644 --- a/udev.8 +++ b/udev.8 @@ -104,7 +104,8 @@ the kernel minor number for the device the bus id for the device .TP .B %c -the CALLOUT program return value (this does not work within the PROGRAM field for the obvious reason.) +the CALLOUT program returned string +(this does not work within the PROGRAM field for the obvious reason.) .RE .P A sample \fIudev.conf\fP might look like this: @@ -134,26 +135,25 @@ Permissions and ownership for the created device files may specified at The file consists of a set of lines. All empty lines and lines beginning with a '#' will be ignored. .br -Every line lists a device name followed by numeric owner, group and permission +Every line lists a device name followed by owner, group and permission mode. All values are separated by colons. The name field may end with a wildcard to apply the values to a whole class of devices. .br -If udev was built using glibc, string owner and group names may be used. +If +.B udev +was built using klibc or is used before the user database is accessible (e.g. +.B initrd +), only numeric owner and group values may be used. .sp A sample \fIudev.permissions\fP might look like this: .sp .nf #name:user:group:mode +input/*:root:root:644 ttyUSB1:0:8:0660 -video*:500:500:0660 +video*:root:video:0660 dsp1:::0666 .fi -.P -If -.B -udev -was built using glibc, string owner and group names may be used. - .SH "FILES" .nf .ft B -- cgit v1.2.3-54-g00ecf From 49d72e43487164194263d2c80dd27a4627f2169c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 24 Nov 2003 23:14:44 -0800 Subject: [PATCH] changed the default location of the database to /udev/.udev.tdb to be LSB compliant Finally the Debian people can get off my back... --- udev.c | 2 +- udev.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udev.c b/udev.c index a562bc27be..094905ecc2 100644 --- a/udev.c +++ b/udev.c @@ -107,7 +107,7 @@ static void get_dirs(void) } dbg("sysfs_path='%s'", sysfs_path); - strncpy(udev_db_filename, udev_config_dir, sizeof(udev_db_filename)); + strncpy(udev_db_filename, udev_root, sizeof(udev_db_filename)); strncat(udev_db_filename, udev_db, sizeof(udev_db_filename)); strncpy(udev_config_filename, udev_config_dir, sizeof(udev_config_filename)); diff --git a/udev.h b/udev.h index 8e35cb708f..8994307469 100644 --- a/udev.h +++ b/udev.h @@ -52,7 +52,7 @@ extern int log_message (int level, const char *format, ...) /* filenames for the config and database files */ -#define UDEV_DB "udev.tdb" +#define UDEV_DB ".udev.tdb" #define UDEV_CONFIG_PERMISSION_FILE "udev.permissions" #define UDEV_CONFIG_FILE "udev.config" -- cgit v1.2.3-54-g00ecf From befd83cc4ee33f6a557b531d4a1be13472ec67cd Mon Sep 17 00:00:00 2001 From: "azarah@nosferatu.za.org" Date: Mon, 24 Nov 2003 23:25:06 -0800 Subject: [PATCH] more config file parsing robustness udev kept on segfaulting when it was in use, and not having the time (and building it with DEBUG=true showing nothing), I have not tracked it until tonight. Seems like I made a type-o, and forgotten the ':' between one line's group and permission parameters. Attached patch should stop the segfault, and warn at that at least. --- namedev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/namedev.c b/namedev.c index 83852f9df2..391da7efca 100644 --- a/namedev.c +++ b/namedev.c @@ -464,6 +464,10 @@ static int namedev_init_permissions(void) } strncpy(dev.group, temp2, sizeof(dev.owner)); + if (!temp) { + dbg("cannot parse line: %s", line); + continue; + } dev.mode = strtol(temp, NULL, 8); dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", -- cgit v1.2.3-54-g00ecf From 5c6f0f141d43703fe84b8c0ddcebf9b79001daf9 Mon Sep 17 00:00:00 2001 From: "arnd@arndb.de" Date: Mon, 24 Nov 2003 23:41:40 -0800 Subject: [PATCH] Add format modifier for devfs like naming On Monday 24 November 2003 01:29, Greg KH wrote: > I think with the ability to capture the output of the CALLOUT rule, > combined with the ability to put format modifiers in the CALLOUT program > string, we now have everything in place to emulate the existing devfs > naming scheme. Anyone want to verify this or not? I would prefer to have the ability of creating partition nodes in devfs style built-in to udev. Devfs used to call the whole disk e.g. "/dev/dasd/0123/disk" and the partitions "/dev/dasd/0123/part[1-3]". This can obviously be done with a CALLOUT rule, but its common enough to make it a format modifier. AFAIK, this scheme has been used for ide, scsi and dasd disks, which is about 99% of all disks ever connected to Linux. --- namedev.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/namedev.c b/namedev.c index 391da7efca..d183a36329 100644 --- a/namedev.c +++ b/namedev.c @@ -527,6 +527,15 @@ static void apply_format(struct udevice *udev, unsigned char *string) strcat(pos, udev->kernel_number); dbg("substitute kernel number '%s'", udev->kernel_number); break; + case 'D': + if (strlen(udev->kernel_number) == 0) { + strcat(pos, "disk"); + break; + } + strcat(pos, "part"); + strcat(pos, udev->kernel_number); + dbg("substitute kernel number '%s'", udev->kernel_number); + break; case 'm': sprintf(pos, "%u", udev->minor); dbg("substitute minor number '%u'", udev->minor); -- cgit v1.2.3-54-g00ecf From 36043f8418c8a0e8decb090c1ea22092fe9c976a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 24 Nov 2003 23:45:38 -0800 Subject: [PATCH] add test and documentation for new %D devfs format modifier --- test/udev-test.pl | 22 ++++++++++++++++++++-- udev.8 | 5 +++++ udev.config | 3 +++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 2835489238..ee2f4e691e 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -25,7 +25,7 @@ my $PWD = $ENV{PWD}; my $sysfs = "sys/"; my $udev_bin = "../udev"; my $udev_root = "udev-root/"; # !!! directory will be removed !!! -my $udev_db = "udev.tdb"; +my $udev_db = ".udev.tdb"; my $perm = "udev.permissions"; my $conf_tmp = "udev-test.config"; @@ -106,6 +106,24 @@ EOF expected => "test-0:0:0:0" , conf => < "devfs disk naming substitution", + subsys => "block", + devpath => "block/sda", + expected => "lun0/disk" , + conf => < "devfs disk naming substitution", + subsys => "block", + devpath => "block/sda/sda2", + expected => "lun0/part2" , + conf => < Date: Mon, 24 Nov 2003 23:47:43 -0800 Subject: [PATCH] libsysfs changes for sysfsutils 0.3.0 Here's the patch to up the library to the sysfsutils-0_3_0 level. The following changes: 1) adds class name to sysfs_class_device structure 2) adds bus to sysfs_device 3) gets rid of code that made assumptions as to bus addresses being unique across buses, which isn't the case. I still owe you: 1) change getpagesize->sysconf. This is in the CVS tree and part of other changes we're currently testing. Patch will follow. 2) you need a function to get a sysfs_class_device's parent. We hadn't considered class devices to have parents, the one example of a multilevel is the block class. We will add this function and send the patch to you. --- libsysfs/libsysfs.h | 36 +++---- libsysfs/sysfs_bus.c | 46 +------- libsysfs/sysfs_class.c | 275 +++++++++++++++++++++--------------------------- libsysfs/sysfs_device.c | 269 +++++++++++++++++++++++----------------------- libsysfs/sysfs_driver.c | 167 +++++++++-------------------- libsysfs/sysfs_utils.c | 40 +++++-- 6 files changed, 351 insertions(+), 482 deletions(-) diff --git a/libsysfs/libsysfs.h b/libsysfs/libsysfs.h index b3ffc467d0..f7e989e242 100644 --- a/libsysfs/libsysfs.h +++ b/libsysfs/libsysfs.h @@ -32,8 +32,11 @@ #define SYSFS_FSTYPE_NAME "sysfs" #define SYSFS_PROC_MNTS "/proc/mounts" #define SYSFS_BUS_DIR "/bus" +#define SYSFS_BUS_NAME "bus" #define SYSFS_CLASS_DIR "/class" +#define SYSFS_CLASS_NAME "class" #define SYSFS_BLOCK_DIR "/block" +#define SYSFS_BLOCK_NAME "block" #define SYSFS_DEVICES_DIR "/devices" #define SYSFS_DEVICES_NAME "devices" #define SYSFS_DRIVERS_DIR "/drivers" @@ -42,10 +45,6 @@ #define SYSFS_UNKNOWN "unknown" #define SYSFS_PATH_ENV "SYSFS_PATH" -/* Some "block" subsystem specific #defines */ -#define SYSFS_QUEUE_NAME "queue" -#define SYSFS_IOSCHED_NAME "iosched" - #define SYSFS_PATH_MAX 255 #define SYSFS_NAME_LEN 50 #define SYSFS_BUS_ID_SIZE 20 @@ -89,8 +88,9 @@ struct sysfs_device { struct dlist *children; unsigned char name[SYSFS_NAME_LEN]; unsigned char bus_id[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + unsigned char bus[SYSFS_NAME_LEN]; unsigned char driver_name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; /* for internal use only */ struct sysfs_directory *directory; @@ -119,6 +119,7 @@ struct sysfs_class_device { struct sysfs_device *sysdevice; /* NULL if virtual */ struct sysfs_driver *driver; /* NULL if not implemented */ unsigned char name[SYSFS_NAME_LEN]; + unsigned char classname[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; /* for internal use only */ @@ -185,10 +186,8 @@ extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); extern void sysfs_close_driver_by_name(struct sysfs_driver *driver); extern struct sysfs_driver *sysfs_open_driver_by_name (const unsigned char *drv_name, const unsigned char *bus, size_t bsize); -extern int sysfs_write_driver_attr(unsigned char *drv, unsigned char *attrib, - unsigned char *value, size_t len); -extern int sysfs_read_driver_attr(unsigned char *drv, unsigned char *attrib, - unsigned char *value, size_t len); +extern struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, + const unsigned char *drv, const unsigned char *attrib); /* generic sysfs device access */ extern void sysfs_close_root_device(struct sysfs_root_device *root); @@ -201,10 +200,8 @@ extern struct sysfs_attribute *sysfs_get_device_attr extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); extern struct sysfs_device *sysfs_open_device_by_id (const unsigned char *bus_id, const unsigned char *bus, size_t bsize); -extern int sysfs_write_device_attr(unsigned char *dev, unsigned char *attrib, - unsigned char *value, size_t len); -extern int sysfs_read_device_attr(unsigned char *dev, unsigned char *attrib, - unsigned char *value, size_t len); +extern struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, + const unsigned char *bus_id, const unsigned char *attrib); /* generic sysfs bus access */ extern void sysfs_close_bus(struct sysfs_bus *bus); @@ -218,8 +215,6 @@ extern struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, unsigned char *attrname); extern struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, unsigned char *dev_id); -extern int sysfs_find_device_bus(const unsigned char *dev_id, - unsigned char *busname, size_t bsize); extern int sysfs_find_driver_bus(const unsigned char *driver, unsigned char *busname, size_t bsize); @@ -232,17 +227,14 @@ extern struct sysfs_class *sysfs_open_class(const unsigned char *name); extern struct sysfs_class_device *sysfs_get_class_device (struct sysfs_class *class, unsigned char *name); extern struct sysfs_class_device *sysfs_open_class_device_by_name - (const unsigned char *class, unsigned char *name); + (const unsigned char *class, const unsigned char *name); extern struct dlist *sysfs_get_classdev_attributes (struct sysfs_class_device *cdev); -extern int sysfs_find_device_class(const unsigned char *bus_id, - unsigned char *classname, size_t bsize); extern struct sysfs_attribute *sysfs_get_classdev_attr (struct sysfs_class_device *clsdev, const unsigned char *name); -extern int sysfs_write_classdev_attr(unsigned char *dev, unsigned char *attrib, - unsigned char *value, size_t len); -extern int sysfs_read_classdev_attr(unsigned char *dev, unsigned char *attrib, - unsigned char *value, size_t len); +extern struct sysfs_attribute *sysfs_open_classdev_attr + (const unsigned char *classname, const unsigned char *dev, + const unsigned char *attrib); #ifdef __cplusplus } diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index 19fc275d84..3111154cbc 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -25,12 +25,12 @@ static void sysfs_close_dev(void *dev) { - sysfs_close_device((struct sysfs_device *)dev); + sysfs_close_device((struct sysfs_device *)dev); } static void sysfs_close_drv(void *drv) { - sysfs_close_driver((struct sysfs_driver *)drv); + sysfs_close_driver((struct sysfs_driver *)drv); } /* @@ -423,48 +423,6 @@ struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, return rdev; } -/** - * sysfs_find_device_bus: locates the bus a device is on. - * @dev_id: device id. - * @busname: buffer to copy name to - * @bsize: buffer size - * returns 0 with success or -1 with error - */ -int sysfs_find_device_bus(const unsigned char *dev_id, unsigned char *busname, - size_t bsize) -{ - unsigned char subsys[SYSFS_NAME_LEN], *bus = NULL, *curdev = NULL; - struct dlist *buslist = NULL, *device_list = NULL; - - if (dev_id == NULL || busname == NULL) { - errno = EINVAL; - return -1; - } - - strcpy(subsys, SYSFS_BUS_DIR); /* subsys = /bus */ - buslist = sysfs_open_subsystem_list(subsys); - if (buslist != NULL) { - dlist_for_each_data(buslist, bus, char) { - device_list = sysfs_open_bus_devices_list(bus); - if (device_list != NULL) { - dlist_for_each_data(device_list, - curdev, char) { - if (strcmp(dev_id, curdev) == 0) { - strncpy(busname, - bus, bsize); - sysfs_close_list(device_list); - sysfs_close_list(buslist); - return 0; - } - } - sysfs_close_list(device_list); - } - } - sysfs_close_list(buslist); - } - return -1; -} - /** * sysfs_find_driver_bus: locates the bus the driver is on. * @driver: name of the driver to locate diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index cb6ca9d00d..a0273565d5 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -23,7 +23,7 @@ #include "libsysfs.h" #include "sysfs.h" -void sysfs_close_cls_dev(void *dev) +static void sysfs_close_cls_dev(void *dev) { sysfs_close_class_device((struct sysfs_class_device *)dev); } @@ -116,9 +116,17 @@ static struct sysfs_directory *open_class_dir(const unsigned char *name) return NULL; } - strcat(classpath, SYSFS_CLASS_DIR); - strcat(classpath, "/"); - strcat(classpath, name); + /* + * We shall now treat "block" also as a class. Hence, check here + * if "name" is "block" and proceed accordingly + */ + if (strcmp(name, SYSFS_BLOCK_NAME) == 0) { + strcat(classpath, SYSFS_BLOCK_DIR); + } else { + strcat(classpath, SYSFS_CLASS_DIR); + strcat(classpath, "/"); + strcat(classpath, name); + } classdir = sysfs_open_directory(classpath); if (classdir == NULL) { errno = EINVAL; @@ -134,6 +142,39 @@ static struct sysfs_directory *open_class_dir(const unsigned char *name) return classdir; } +/** + * set_classdev_classname: Grabs classname from path + * @cdev: class device to set + * Returns nothing + */ +static void set_classdev_classname(struct sysfs_class_device *cdev) +{ + unsigned char *c = NULL, *e = NULL; + int count = 0; + + c = strstr(cdev->path, SYSFS_CLASS_DIR); + if (c == NULL) + c = strstr(cdev->path, SYSFS_BLOCK_DIR); + else { + c++; + while (c != NULL && *c != '/') + c++; + } + + if (c == NULL) + strcpy(cdev->classname, SYSFS_UNKNOWN); + + else { + c++; + e = c; + while (e != NULL && *e != '/' && *e != '\0') { + e++; + count++; + } + strncpy(cdev->classname, c, count); + } +} + /** * sysfs_open_class_device: Opens and populates class device * @path: path to class device. @@ -178,6 +219,7 @@ struct sysfs_class_device *sysfs_open_class_device(const unsigned char *path) sysfs_read_all_subdirs(dir); cdev->directory = dir; strcpy(cdev->path, dir->path); + set_classdev_classname(cdev); /* get driver and device, if implemented */ if (cdev->directory->links != NULL) { @@ -303,47 +345,73 @@ struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *class, name, class_name_equal); } +/** + * get_classdev_path: given the class and a device in the class, return the + * absolute path to the device + * @classname: name of the class + * @clsdev: the class device + * @path: buffer to return path + * @psize: size of "path" + * Returns 0 on SUCCESS or -1 on error + */ +static int get_classdev_path(const unsigned char *classname, + const unsigned char *clsdev, unsigned char *path, size_t len) +{ + if (classname == NULL || clsdev == NULL || path == NULL) { + errno = EINVAL; + return -1; + } + if (sysfs_get_mnt_path(path, len) != 0) { + dprintf("Error getting sysfs mount path\n"); + return -1; + } + if (strcmp(classname, SYSFS_BLOCK_NAME) == 0) { + strcat(path, SYSFS_BLOCK_DIR); + } else { + strcat(path, SYSFS_CLASS_DIR); + strcat(path, "/"); + strcat(path, classname); + } + strcat(path, "/"); + strcat(path, clsdev); + return 0; +} + /** * sysfs_open_class_device_by_name: Locates a specific class_device and returns it. * Class_device must be closed using sysfs_close_class_device * @classname: Class to search * @name: name of the class_device + * + * NOTE: + * Call sysfs_close_class_device() to close the class device */ struct sysfs_class_device *sysfs_open_class_device_by_name - (const unsigned char *classname, unsigned char *name) + (const unsigned char *classname, const unsigned char *name) { - struct sysfs_class *class = NULL; - struct sysfs_class_device *cdev = NULL, *rcdev = NULL; + unsigned char devpath[SYSFS_PATH_MAX]; + struct sysfs_class_device *cdev = NULL; if (classname == NULL || name == NULL) { errno = EINVAL; return NULL; } - class = sysfs_open_class(classname); - if (class == NULL) { - dprintf("Error opening class %s\n", classname); + memset(devpath, 0, SYSFS_PATH_MAX); + if ((get_classdev_path(classname, name, devpath, + SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting to device %s on class %s\n", + name, classname); return NULL; } - - cdev = sysfs_get_class_device(class, name); + + cdev = sysfs_open_class_device(devpath); if (cdev == NULL) { dprintf("Error getting class device %s from class %s\n", name, classname); - sysfs_close_class(class); - return NULL; - } - - rcdev = sysfs_open_class_device(cdev->directory->path); - if (rcdev == NULL) { - dprintf("Error getting class device %s from class %s\n", - name, classname); - sysfs_close_class(class); return NULL; } - sysfs_close_class(class); - - return rcdev; + return cdev; } /** @@ -360,53 +428,6 @@ struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev) return (cdev->directory->attributes); } -/** - * sysfs_find_device_class: locates the device the device is on - * @bus_id: device to look for - * @classname: buffer to copy class name to - * @bsize: size of buffer - * returns 0 with success and -1 with error - */ -int sysfs_find_device_class(const unsigned char *bus_id, - unsigned char *classname, size_t bsize) -{ - unsigned char class[SYSFS_NAME_LEN], clspath[SYSFS_NAME_LEN]; - unsigned char *cls = NULL, *clsdev = NULL; - struct dlist *clslist = NULL, *clsdev_list = NULL; - - if (bus_id == NULL || classname == NULL) { - errno = EINVAL; - return -1; - } - - strcpy(class, SYSFS_CLASS_DIR); - clslist = sysfs_open_subsystem_list(class); - if (clslist != NULL) { - dlist_for_each_data(clslist, cls, char) { - memset(clspath, 0, SYSFS_NAME_LEN); - strcpy(clspath, SYSFS_CLASS_DIR); - strcat(clspath, "/"); - strcat(clspath, cls); - clsdev_list = sysfs_open_subsystem_list(clspath); - if (clsdev_list != NULL) { - dlist_for_each_data(clsdev_list, - clsdev, char) { - if (strcmp(bus_id, clsdev) == 0) { - strncpy(classname, - cls, bsize); - sysfs_close_list(clsdev_list); - sysfs_close_list(clslist); - return 0; - } - } - sysfs_close_list(clsdev_list); - } - } - sysfs_close_list(clslist); - } - return -1; -} - /** * sysfs_get_classdev_attr: searches class device's attributes by name * @clsdev: class device to look through @@ -433,99 +454,45 @@ struct sysfs_attribute *sysfs_get_classdev_attr } /** - * sysfs_write_classdev_attr: modify writable attribute value for the given - * class device - * @dev: class device name for which the attribute has to be changed - * @attrib: attribute to change - * @value: value to change to - * @len: size of buffer at "value" - * Returns 0 on success and -1 on error - */ -int sysfs_write_classdev_attr(unsigned char *dev, unsigned char *attrib, - unsigned char *value, size_t len) -{ - struct sysfs_class_device *clsdev = NULL; - struct sysfs_attribute *attribute = NULL; - unsigned char class_name[SYSFS_NAME_LEN]; - - if (dev == NULL || attrib == NULL || value == NULL) { - errno = EINVAL; - return -1; - } - - memset(class_name, 0, SYSFS_NAME_LEN); - if ((sysfs_find_device_class(dev, - class_name, SYSFS_NAME_LEN)) < 0) { - dprintf("Class device %s not found\n", dev); - return -1; - } - clsdev = sysfs_open_class_device_by_name(class_name, dev); - if (clsdev == NULL) { - dprintf("Error opening %s in class %s\n", dev, class_name); - return -1; - } - attribute = sysfs_get_directory_attribute(clsdev->directory, attrib); - if (attribute == NULL) { - dprintf("Attribute %s not defined for device %s on class %s\n", - attrib, dev, class_name); - sysfs_close_class_device(clsdev); - return -1; - } - if ((sysfs_write_attribute(attribute, value, len)) < 0) { - dprintf("Error setting %s to %s\n", attrib, value); - sysfs_close_class_device(clsdev); - return -1; - } - sysfs_close_class_device(clsdev); - return 0; -} - -/** - * sysfs_read_classdev_attr: read an attribute for a given class device + * sysfs_open_classdev_attr: read an attribute for a given class device + * @classname: name of the class on which to look * @dev: class device name for which the attribute has to be read * @attrib: attribute to read - * @value: buffer to return value to user - * @len: size of buffer at "value" - * Returns 0 on success and -1 on error + * Returns sysfs_attribute * on SUCCESS and NULL on error + * + * NOTE: + * A call to sysfs_close_attribute() is required to close the + * attribute returned and to free memory */ -int sysfs_read_classdev_attr(unsigned char *dev, unsigned char *attrib, - unsigned char *value, size_t len) +struct sysfs_attribute *sysfs_open_classdev_attr(const unsigned char *classname, + const unsigned char *dev, const unsigned char *attrib) { - struct sysfs_class_device *clsdev = NULL; struct sysfs_attribute *attribute = NULL; - unsigned char class_name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; - if (dev == NULL || attrib == NULL || value == NULL) { + if (classname == NULL || dev == NULL || attrib == NULL) { errno = EINVAL; - return -1; - } - - memset(class_name, 0, SYSFS_NAME_LEN); - if ((sysfs_find_device_class(dev, - class_name, SYSFS_NAME_LEN)) < 0) { - dprintf("Class device %s not found\n", dev); - return -1; + return NULL; } - clsdev = sysfs_open_class_device_by_name(class_name, dev); - if (clsdev == NULL) { - dprintf("Error opening %s in class %s\n", dev, class_name); - return -1; + memset(path, 0, SYSFS_PATH_MAX); + if ((get_classdev_path(classname, dev, path, SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting to device %s on class %s\n", + dev, classname); + return NULL; } - attribute = sysfs_get_directory_attribute(clsdev->directory, attrib); + strcat(path, "/"); + strcat(path, attrib); + attribute = sysfs_open_attribute(path); if (attribute == NULL) { - dprintf("Attribute %s not defined for device %s on class %s\n", - attrib, dev, class_name); - sysfs_close_class_device(clsdev); - return -1; + dprintf("Error opening attribute %s on class device %s\n", + attrib, dev); + return NULL; } - if (attribute->len > len) { - dprintf("Value length %d is greater that suppled buffer %d\n", - attribute->len, len); - sysfs_close_class_device(clsdev); - return -1; + if ((sysfs_read_attribute(attribute)) != 0) { + dprintf("Error reading attribute %s for class device %s\n", + attrib, dev); + sysfs_close_attribute(attribute); + return NULL; } - strncpy(value, attribute->value, attribute->len); - value[(attribute->len)+1] = 0; - sysfs_close_class_device(clsdev); - return 0; + return attribute; } diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 89704dcd80..fbd046f229 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -23,6 +23,77 @@ #include "libsysfs.h" #include "sysfs.h" +static int confirm_device_bus(struct sysfs_device *dev, + unsigned char *busname, unsigned char *bus_id) +{ + struct sysfs_link *devlink = NULL; + unsigned char devpath[SYSFS_PATH_MAX]; + int result = 0; + + if (busname == NULL || bus_id == NULL) + return -1; + + if (sysfs_get_mnt_path(devpath, SYSFS_PATH_MAX) != 0) + return -1; + + strcat(devpath, SYSFS_BUS_DIR); + strcat(devpath, "/"); + strcat(devpath, busname); + strcat(devpath, SYSFS_DEVICES_DIR); + strcat(devpath, "/"); + strcat(devpath, bus_id); + + devlink = sysfs_open_link(devpath); + if (devlink == NULL) + return -1; + + if (strcmp(devlink->target, dev->path) == 0) + result++; + sysfs_close_link(devlink); + return result; +} + +/** + * get_device_bus: retrieves the bus name the device is on, checks path to + * bus' link to make sure it has correct device. + * @dev: device to get busname. + * returns 0 with success and -1 with error. + */ +static int get_device_bus(struct sysfs_device *dev) +{ + unsigned char subsys[SYSFS_NAME_LEN], *bus = NULL, *curdev = NULL; + struct dlist *buslist = NULL, *device_list = NULL; + + if (dev == NULL) { + errno = EINVAL; + return -1; + } + + strcpy(subsys, SYSFS_BUS_DIR); /* subsys = /bus */ + buslist = sysfs_open_subsystem_list(subsys); + if (buslist != NULL) { + dlist_for_each_data(buslist, bus, char) { + device_list = sysfs_open_bus_devices_list(bus); + if (device_list != NULL) { + dlist_for_each_data(device_list, + curdev, char) { + if (strcmp(dev->bus_id, curdev) == 0 + && confirm_device_bus(dev, bus, + curdev) > 0) { + strcpy(dev->bus, bus); + sysfs_close_list(device_list); + sysfs_close_list(buslist); + return 0; + } + } + sysfs_close_list(device_list); + } + } + sysfs_close_list(buslist); + } + return -1; +} + /** * sysfs_close_device_tree: closes every device in the supplied tree, * closing children only. @@ -150,6 +221,9 @@ struct sysfs_device *sysfs_open_device(const unsigned char *path) * implies that the dev->name and dev->bus_id contain same data. */ strncpy(dev->name, sdir->name, SYSFS_NAME_LEN); + + if (get_device_bus(dev) != 0) + strcpy(dev->bus, SYSFS_UNKNOWN); return dev; } @@ -338,55 +412,6 @@ struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) return (device->directory->attributes); } -/** - * sysfs_open_device_by_id: open a device by id (use the "bus" subsystem) - * @bus_id: bus_id of the device to open - has to be the "bus_id" in - * /sys/bus/xxx/devices - * @bus: bus the device belongs to - * @bsize: size of the bus buffer - * returns struct sysfs_device if found, NULL otherwise - * NOTE: - * 1. Use sysfs_close_device to close the device - * 2. Bus the device is on must be supplied - * Use sysfs_find_device_bus to get the bus name - */ -struct sysfs_device *sysfs_open_device_by_id(const unsigned char *bus_id, - const unsigned char *bus, size_t bsize) -{ - char sysfs_path[SYSFS_PATH_MAX], device_path[SYSFS_PATH_MAX]; - struct sysfs_device *device = NULL; - - if (bus_id == NULL || bus == NULL) { - errno = EINVAL; - return NULL; - } - memset(sysfs_path, 0, SYSFS_PATH_MAX); - if ((sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX)) != 0) { - dprintf("Error getting sysfs mount path\n"); - return NULL; - } - strcat(sysfs_path, SYSFS_BUS_DIR); - strcat(sysfs_path, "/"); - strncat(sysfs_path, bus, bsize); - strcat(sysfs_path, SYSFS_DEVICES_DIR); - strcat(sysfs_path, "/"); - strcat(sysfs_path, bus_id); - - /* devices under /sys/bus/xxx/devices are links to devices subsystem */ - if ((sysfs_get_link(sysfs_path, device_path, SYSFS_PATH_MAX)) < 0) { - dprintf("Error getting device path\n"); - return NULL; - } - - device = sysfs_open_device(device_path); - if (device == NULL) { - dprintf("Error opening device %s\n", bus_id); - return NULL; - } - - return device; -} - /** * get_device_absolute_path: looks up the bus the device is on, gets * absolute path to the device @@ -395,29 +420,24 @@ struct sysfs_device *sysfs_open_device_by_id(const unsigned char *bus_id, * @psize: size of "path" * Returns 0 on success -1 on failure */ -static int get_device_absolute_path(const unsigned char *device, - unsigned char *path, size_t psize) +static int get_device_absolute_path(const unsigned char *device, + const unsigned char *bus, unsigned char *path, size_t psize) { - unsigned char bus_name[SYSFS_NAME_LEN], bus_path[SYSFS_PATH_MAX]; + unsigned char bus_path[SYSFS_NAME_LEN]; if (device == NULL || path == NULL) { errno = EINVAL; return -1; } - memset(bus_name, 0, SYSFS_NAME_LEN); memset(bus_path, 0, SYSFS_NAME_LEN); - if ((sysfs_find_device_bus(device, bus_name, SYSFS_NAME_LEN)) != 0) { - dprintf("Device %s not found\n", device); - return -1; - } if (sysfs_get_mnt_path(bus_path, SYSFS_PATH_MAX) != 0) { dprintf ("Sysfs not supported on this system\n"); return -1; } strcat(bus_path, SYSFS_BUS_DIR); strcat(bus_path, "/"); - strcat(bus_path, bus_name); + strcat(bus_path, bus); strcat(bus_path, SYSFS_DEVICES_DIR); strcat(bus_path, "/"); strcat(bus_path, device); @@ -433,106 +453,85 @@ static int get_device_absolute_path(const unsigned char *device, } /** - * sysfs_write_device_attr: modify a "writable" attribute for the given device - * @dev: device bus_id for which attribute has to be changed - * @attrib: attribute to change - * @value: value to change to - * @len: "value" length to write - * Returns 0 on success -1 on error - */ -int sysfs_write_device_attr(unsigned char *dev, unsigned char *attrib, - unsigned char *value, size_t len) + * sysfs_open_device_by_id: open a device by id (use the "bus" subsystem) + * @bus_id: bus_id of the device to open - has to be the "bus_id" in + * /sys/bus/xxx/devices + * @bus: bus the device belongs to + * @bsize: size of the bus buffer + * returns struct sysfs_device if found, NULL otherwise + * NOTE: + * 1. Use sysfs_close_device to close the device + * 2. Bus the device is on must be supplied + * Use sysfs_find_device_bus to get the bus name + */ +struct sysfs_device *sysfs_open_device_by_id(const unsigned char *bus_id, + const unsigned char *bus, size_t bsize) { - struct sysfs_attribute *attribute = NULL; - unsigned char devpath[SYSFS_PATH_MAX]; + char sysfs_path[SYSFS_PATH_MAX]; + struct sysfs_device *device = NULL; - if (dev == NULL || attrib == NULL || value == NULL) { + if (bus_id == NULL || bus == NULL) { errno = EINVAL; - return -1; - } - - memset(devpath, 0, SYSFS_PATH_MAX); - if ((get_device_absolute_path(dev, devpath, SYSFS_PATH_MAX)) != 0) { - dprintf("Error finding absolute path to device %s\n", dev); - return -1; - } - strcat(devpath, "/"); - strcat(devpath, attrib); - attribute = sysfs_open_attribute(devpath); - if (attribute == NULL) { - dprintf("Attribute %s could not be retrieved for device %s\n", - attrib, dev); - return -1; + return NULL; } - if (attribute->method & SYSFS_METHOD_SHOW) { - if ((sysfs_read_attribute(attribute)) != 0) { - dprintf("Error reading attribute %s for device %s\n", - attrib, dev); - sysfs_close_attribute(attribute); - return -1; - } + memset(sysfs_path, 0, SYSFS_PATH_MAX); + if ((get_device_absolute_path(bus_id, bus, sysfs_path, + SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting to device %s\n", bus_id); + return NULL; } - if ((sysfs_write_attribute(attribute, value, len)) < 0) { - dprintf("Error setting %s to %s\n", attrib, value); - sysfs_close_attribute(attribute); - return -1; + + device = sysfs_open_device(sysfs_path); + if (device == NULL) { + dprintf("Error opening device %s\n", bus_id); + return NULL; } - sysfs_close_attribute(attribute); - return 0; + + return device; } -/** - * sysfs_read_device_attr: read an attribute of the given device - * @dev: device bus_id for which attribute has to be changed - * @attrib: attribute to read - * @value: buffer to return value in - * @len: size of buffer available - * Returns 0 on success -1 on error - */ -int sysfs_read_device_attr(unsigned char *dev, unsigned char *attrib, - unsigned char *value, size_t len) +/* + * sysfs_open_device_attr: open the given device's attribute + * @bus: Bus on which to look + * @dev_id: device for which attribute is required + * @attrname: name of the attribute to look for + * Returns struct sysfs_attribute on success and NULL on failure + * + * NOTE: + * A call to sysfs_close_attribute() is required to close + * the attribute returned and free memory. + */ +struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, + const unsigned char *bus_id, const unsigned char *attrib) { struct sysfs_attribute *attribute = NULL; unsigned char devpath[SYSFS_PATH_MAX]; - - if (dev == NULL || attrib == NULL || value == NULL) { + + if (bus == NULL || bus_id == NULL || attrib == NULL) { errno = EINVAL; - return -1; + return NULL; } - + memset(devpath, 0, SYSFS_PATH_MAX); - if ((get_device_absolute_path(dev, devpath, SYSFS_PATH_MAX)) != 0) { - dprintf("Error finding absolute path to device %s\n", dev); - return -1; + if ((get_device_absolute_path(bus_id, bus, devpath, + SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting to device %s\n", bus_id); + return NULL; } strcat(devpath, "/"); strcat(devpath, attrib); attribute = sysfs_open_attribute(devpath); if (attribute == NULL) { dprintf("Error opening attribute %s for device %s\n", - attrib, dev); - return -1; - } - if (!(attribute->method & SYSFS_METHOD_SHOW)) { - dprintf("Show method not supported for attribute %s\n", - attrib); - sysfs_close_attribute(attribute); - return -1; + attrib, bus_id); + return NULL; } if ((sysfs_read_attribute(attribute)) != 0) { dprintf("Error reading attribute %s for device %s\n", - attrib, dev); + attrib, bus_id); sysfs_close_attribute(attribute); - return -1; - } - if (attribute->len > len) { - dprintf("Value length %d is larger than supplied buffer %d\n", - attribute->len, len); - sysfs_close_attribute(attribute); - return -1; + return NULL; } - strncpy(value, attribute->value, attribute->len); - value[(attribute->len)+1] = 0; - sysfs_close_attribute(attribute); - return 0; + return attribute; } + diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index f8e842c65c..0011177e99 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -162,6 +162,35 @@ struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver) return(driver->directory->links); } +/** + * get_driver_path: looks up the bus the driver is on and builds path to + * the driver. + * @bus: bus on which to search + * @drv: driver to look for + * @path: buffer to return path to driver + * @psize: size of "path" + * Returns 0 on success and -1 on error + */ +static int get_driver_path(const unsigned char *bus, const unsigned char *drv, + unsigned char *path, size_t psize) +{ + if (bus == NULL || drv == NULL || path == NULL) { + errno = EINVAL; + return -1; + } + if (sysfs_get_mnt_path(path, psize) != 0) { + dprintf("Error getting sysfs mount path\n"); + return -1; + } + strcat(path, SYSFS_BUS_DIR); + strcat(path, "/"); + strcat(path, bus); + strcat(path, SYSFS_DRIVERS_DIR); + strcat(path, "/"); + strcat(path, drv); + return 0; +} + /** * sysfs_open_driver_by_name: open a driver by name and return the bus * the driver is on. @@ -188,16 +217,10 @@ struct sysfs_driver *sysfs_open_driver_by_name(const unsigned char *drv_name, } memset(path, 0, SYSFS_PATH_MAX); - if (sysfs_get_mnt_path(path, SYSFS_PATH_MAX) != 0) { - dprintf("Error getting sysfs mount path\n"); + if (get_driver_path(bus, drv_name, path, SYSFS_PATH_MAX) != 0) { + dprintf("Error getting to driver %s\n", drv_name); return NULL; } - strcat(path, SYSFS_BUS_DIR); - strcat(path, "/"); - strcat(path, bus); - strcat(path, SYSFS_DRIVERS_DIR); - strcat(path, "/"); - strcat(path, drv_name); driver = sysfs_open_driver(path); if (driver == NULL) { dprintf("Could not open driver %s\n", drv_name); @@ -224,114 +247,33 @@ struct sysfs_driver *sysfs_open_driver_by_name(const unsigned char *drv_name, return driver; } -/** - * get_driver_path: looks up the bus the driver is on and builds path to - * the driver. - * @drv: driver to look for - * @path: buffer to return path to driver - * @psize: size of "path" - * Returns 0 on success and -1 on error - */ -static int get_driver_path(const unsigned char *drv, - unsigned char *path, size_t psize) -{ - unsigned char bus_name[SYSFS_NAME_LEN]; - - if (drv == NULL || path == NULL) { - errno = EINVAL; - return -1; - } - memset(bus_name, 0, SYSFS_NAME_LEN); - memset(path, 0, SYSFS_PATH_MAX); - if ((sysfs_find_driver_bus(drv, bus_name, SYSFS_NAME_LEN)) < 0) { - dprintf("Driver %s not found\n", drv); - return -1; - } - if (sysfs_get_mnt_path(path, SYSFS_PATH_MAX) != 0) { - dprintf("Error getting sysfs mount path\n"); - return -1; - } - strcat(path, SYSFS_BUS_DIR); - strcat(path, "/"); - strcat(path, bus_name); - strcat(path, SYSFS_DRIVERS_DIR); - strcat(path, "/"); - strcat(path, drv); - fprintf(stdout, "get_driver_path %s\n", path); - return 0; -} - -/** - * sysfs_write_driver_attr: modify "writable" driver attribute - * @drv: driver whose attribute has to be modified - * @attrib: Attribute to be modified - * @value: Value to change to - * Returns 0 on success -1 on failure - */ -int sysfs_write_driver_attr(unsigned char *drv, unsigned char *attrib, - unsigned char *value, size_t len) -{ - struct sysfs_attribute *attribute = NULL; - unsigned char path[SYSFS_PATH_MAX]; - - if (drv == NULL || attrib == NULL || value == NULL) { - errno = EINVAL; - return -1; - } - - memset(path, 0, SYSFS_PATH_MAX); - if ((get_driver_path(drv, path, SYSFS_PATH_MAX)) != 0) { - dprintf("Error getting to driver %s\n", drv); - return -1; - } - strcat(path, "/"); - strcat(path, attrib); - attribute = sysfs_open_attribute(path); - if (attribute == NULL) { - dprintf("Attribute %s could not be retrieved for driver %s\n", - attrib, drv); - return -1; - } - if (attribute->method & SYSFS_METHOD_SHOW) { - if ((sysfs_read_attribute(attribute)) != 0) { - dprintf("Error reading attribute %s for driver %s\n", - attrib, drv); - sysfs_close_attribute(attribute); - return -1; - } - } - if ((sysfs_write_attribute(attribute, value, len)) < 0) { - dprintf("Error setting %s to %s\n", attrib, value); - sysfs_close_attribute(attribute); - return -1; - } - sysfs_close_attribute(attribute); - return 0; -} /** - * sysfs_read_driver_attr: read the user supplied driver attribute + * sysfs_open_driver_attr: read the user supplied driver attribute + * @bus: bus on which to look * @drv: driver whose attribute has to be read * @attrib: Attribute to be read - * @value: Buffer to return the read value - * @len: Length of the buffer "value" - * Returns 0 on success -1 on failure + * Returns struct sysfs_attribute on success and NULL on failure + * + * NOTE: + * A call to sysfs_close_attribute() is required to close the + * attribute returned and to free memory */ -int sysfs_read_driver_attr(unsigned char *drv, unsigned char *attrib, - unsigned char *value, size_t len) +struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, + const unsigned char *drv, const unsigned char *attrib) { struct sysfs_attribute *attribute = NULL; unsigned char path[SYSFS_PATH_MAX]; - if (drv == NULL || attrib == NULL || value == NULL) { + if (bus == NULL || drv == NULL || attrib == NULL) { errno = EINVAL; - return -1; + return NULL; } memset(path, 0, SYSFS_NAME_LEN); - if ((get_driver_path(drv, path, SYSFS_PATH_MAX)) != 0) { + if ((get_driver_path(bus, drv, path, SYSFS_PATH_MAX)) != 0) { dprintf("Error getting to driver %s\n", drv); - return -1; + return NULL; } strcat(path, "/"); strcat(path, attrib); @@ -339,29 +281,14 @@ int sysfs_read_driver_attr(unsigned char *drv, unsigned char *attrib, if (attribute == NULL) { dprintf("Error opening attribute %s for driver %s\n", attrib, drv); - return -1; - } - if (!(attribute->method & SYSFS_METHOD_SHOW)) { - dprintf("Show method not supported for attribute %s\n", - attrib); - sysfs_close_attribute(attribute); - return -1; + return NULL; } if ((sysfs_read_attribute(attribute)) != 0) { dprintf("Error reading attribute %s for driver %s\n", attrib, drv); sysfs_close_attribute(attribute); - return -1; - } - if (attribute->len > len) { - dprintf("Value length %d is larger than supplied buffer %d\n", - attribute->len, len); - sysfs_close_attribute(attribute); - return -1; + return NULL; } - strncpy(value, attribute->value, attribute->len); - value[(attribute->len)+1] = 0; - sysfs_close_attribute(attribute); - return 0; + return attribute; } diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 3e50bc6120..4e96051c78 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -92,7 +92,7 @@ int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len) return -1; } sysfs_path = getenv(SYSFS_PATH_ENV); - if (sysfs_path != NULL) + if (sysfs_path != NULL) strncpy(mnt_path, sysfs_path, len); else ret = sysfs_get_fs_mnt_path(SYSFS_FSTYPE_NAME, mnt_path, len); @@ -109,13 +109,19 @@ int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len) int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, size_t len) { + unsigned char tmp[SYSFS_PATH_MAX]; unsigned char *n = NULL; if (path == NULL || name == NULL) { errno = EINVAL; return -1; } - n = strrchr(path, '/'); + memset(tmp, 0, SYSFS_PATH_MAX); + strcpy(tmp, path); + n = &tmp[strlen(tmp)-1]; + if (strncmp(n, "/", 1) == 0) + *n = '\0'; + n = strrchr(tmp, '/'); if (n == NULL) { errno = EINVAL; return -1; @@ -169,10 +175,7 @@ int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) if (*s == '/') count++; } - - if (s == NULL) - return -1; - + strncpy(s, d, (SYSFS_PATH_MAX-strlen(devdir))); strncpy(target, devdir, len); @@ -184,7 +187,7 @@ int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) * sysfs_del_name: free function for sysfs_open_subsystem_list * @name: memory area to be freed */ -void sysfs_del_name(void *name) +static void sysfs_del_name(void *name) { free(name); } @@ -210,8 +213,10 @@ void sysfs_close_list(struct dlist *list) struct dlist *sysfs_open_subsystem_list(unsigned char *name) { unsigned char sysfs_path[SYSFS_PATH_MAX], *subsys_name = NULL; + unsigned char *c = NULL; struct sysfs_directory *dir = NULL, *cur = NULL; struct dlist *list = NULL; + struct stat astats; if (name == NULL) return NULL; @@ -251,6 +256,27 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) } } sysfs_close_directory(dir); + /* + * We are now considering "block" as a "class". Hence, if the subsys + * name requested here is "class", verify if "block" is supported on + * this system and return the same. + */ + if (strcmp(name, SYSFS_CLASS_DIR) == 0) { + c = strstr(sysfs_path, SYSFS_CLASS_NAME); + if (c == NULL) + goto out; + strcpy(c, SYSFS_BLOCK_NAME); + if ((lstat(sysfs_path, &astats)) != 0) { + dprintf("stat() failed\n"); + goto out; + } + if (S_ISDIR(astats.st_mode)) { + subsys_name = (char *)calloc(1, SYSFS_NAME_LEN); + strcpy(subsys_name, SYSFS_BLOCK_NAME); + dlist_unshift(list, subsys_name); + } + } +out: return list; } -- cgit v1.2.3-54-g00ecf From b376d32cb462455053061d2cf3da3ac640fd37ee Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Wed, 26 Nov 2003 17:31:59 -0800 Subject: [PATCH] quick fix for libsysfs bus There seems to be a mismatch in udev and in libsysfs as to what to expect if the mnt point has a slash on the end or not. If I use the included patch, it breaks something in udev. If I patch sysfs_get_mnt_path I break udev as well because what you're expecting. I need to sit down and go through the library and creaate a rule as to trailing slashes. Adding the env brought this to light. --- libsysfs/sysfs_device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index fbd046f229..2a5353e6f7 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -28,6 +28,7 @@ static int confirm_device_bus(struct sysfs_device *dev, { struct sysfs_link *devlink = NULL; unsigned char devpath[SYSFS_PATH_MAX]; + unsigned char *s = NULL; int result = 0; if (busname == NULL || bus_id == NULL) @@ -36,6 +37,9 @@ static int confirm_device_bus(struct sysfs_device *dev, if (sysfs_get_mnt_path(devpath, SYSFS_PATH_MAX) != 0) return -1; + s = &devpath[strlen(devpath)-1]; + if (strncmp(s, "/", 1) == 0) + *s = '\0'; strcat(devpath, SYSFS_BUS_DIR); strcat(devpath, "/"); strcat(devpath, busname); -- cgit v1.2.3-54-g00ecf From 137af0cc47a387b91f1216e7a888db54257d51e3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 26 Nov 2003 17:45:05 -0800 Subject: [PATCH] fix problem where we were not looking at the BUS value. --- namedev.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/namedev.c b/namedev.c index d183a36329..d45a827083 100644 --- a/namedev.c +++ b/namedev.c @@ -124,6 +124,8 @@ static int add_dev(struct config_device *new_dev) struct config_device *dev = list_entry(tmp, struct config_device, node); if (strncmp_wildcard(dev->name, new_dev->name, sizeof(dev->name))) continue; + if (strncmp(dev->bus, new_dev->bus, sizeof(dev->name))) + continue; copy_var(dev, new_dev, type); copy_var(dev, new_dev, mode); copy_string(dev, new_dev, bus); @@ -132,6 +134,7 @@ static int add_dev(struct config_device *new_dev) copy_string(dev, new_dev, id); copy_string(dev, new_dev, place); copy_string(dev, new_dev, kernel_name); + copy_string(dev, new_dev, exec_program); copy_string(dev, new_dev, owner); copy_string(dev, new_dev, group); return 0; @@ -650,7 +653,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) return retval; } -static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev) +static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { struct config_device *dev; struct list_head *tmp; @@ -660,6 +663,12 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev if (dev->type != CALLOUT) continue; + if (sysfs_device) { + dbg_parse("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + if (strcasecmp(dev->bus, sysfs_device->bus) != 0) + continue; + } + /* substitute anything that needs to be in the program name */ apply_format(udev, dev->exec_program); if (exec_callout(dev, udev->callout_value, NAME_SIZE)) @@ -692,6 +701,12 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, if (dev->type != LABEL) continue; + if (sysfs_device) { + dbg_parse("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + if (strcasecmp(dev->bus, sysfs_device->bus) != 0) + continue; + } + dbg_parse("look for device attribute '%s'", dev->sysfs_file); /* try to find the attribute in the class device directory */ tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); @@ -747,6 +762,10 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, if (dev->type != NUMBER) continue; + dbg_parse("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + if (strcasecmp(dev->bus, sysfs_device->bus) != 0) + continue; + found = 0; strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); @@ -795,6 +814,10 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude if (dev->type != TOPOLOGY) continue; + dbg_parse("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + if (strcasecmp(dev->bus, sysfs_device->bus) != 0) + continue; + found = 0; strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); @@ -826,7 +849,7 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude return -ENODEV; } -static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev) +static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { struct config_device *dev; struct list_head *tmp; @@ -921,6 +944,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) if (sysfs_device) { dbg_parse("sysfs_device->path='%s'", sysfs_device->path); dbg_parse("sysfs_device->bus_id='%s'", sysfs_device->bus_id); + dbg_parse("sysfs_device->bus='%s'", sysfs_device->bus); strfieldcpy(udev->bus_id, sysfs_device->bus_id); } else { dbg_parse("class_dev->name = '%s'", class_dev->name); @@ -929,7 +953,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) build_kernel_number(class_dev, udev); /* rules are looked at in priority order */ - retval = do_callout(class_dev, udev); + retval = do_callout(class_dev, udev, sysfs_device); if (retval == 0) goto found; @@ -945,7 +969,7 @@ static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) if (retval == 0) goto found; - retval = do_replace(class_dev, udev); + retval = do_replace(class_dev, udev, sysfs_device); if (retval == 0) goto found; -- cgit v1.2.3-54-g00ecf From 772558f4e9e981ca8f68026457589784028c730b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 26 Nov 2003 17:45:26 -0800 Subject: [PATCH] add test for checking the BUS value. --- test/udev-test.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index ee2f4e691e..3f48de8f3e 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -124,6 +124,17 @@ EOF expected => "lun0/part2" , conf => < "callout bus type", + subsys => "block", + devpath => "block/sda", + expected => "scsi-0:0:0:0" , + conf => < Date: Mon, 1 Dec 2003 23:50:09 -0800 Subject: [PATCH] fix udev parallel builds with klibc I can't build udev with make -j9. Here's a patch to fix it. --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index d0c00aa88c..6c8b311f4e 100644 --- a/Makefile +++ b/Makefile @@ -133,9 +133,13 @@ else LDFLAGS = --static endif -all: $(LIBC) $(ROOT) +all: $(ROOT) -$(ARCH_LIB_OBJS) : +$(ROOT): $(LIBC) + +$(ARCH_LIB_OBJS) : $(CRT0) + +$(CRT0): $(MAKE) -C klibc TDB = tdb/tdb.o \ @@ -171,8 +175,9 @@ udev_version.h: @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ +$(OBJS): $(GEN_HEADERS) -$(ROOT): $(GEN_HEADERS) $(OBJS) +$(ROOT): $(OBJS) $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) -- cgit v1.2.3-54-g00ecf From 359618cd6ed05adcad97380f51790198ff653f87 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Tue, 2 Dec 2003 00:16:32 -0800 Subject: [PATCH] udev-007/extras/multipath update here is a clean-up patch : * removes sg_err.[ch] deps * makes sure the core code play nice with klibc * port the sysfs calls to dlist helpers * links against udev's sysfs (need libsysfs.a & dlist.a) * finally define DM_TARGET as "multipath" as Joe posted the code today (not tested yet) * push version forward (do you want it in sync with udev version?) libdevmapper doesn't play well with klibc, so I wasn't able to produce a static binary yet. Help needed here ... as I don't want to fall back to merge libdevmapper code in the core. It compiles here and doesn't segfault. --- extras/multipath/Makefile | 11 +++++------ extras/multipath/main.c | 43 +++++++++++++++++++++++++------------------ extras/multipath/main.h | 17 +++++++++++++---- extras/multipath/sg_include.h | 1 - 4 files changed, 43 insertions(+), 29 deletions(-) diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index 0835d7a2c6..9e0ce124c6 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -9,10 +9,10 @@ exec_prefix = ${prefix} bindir = ${exec_prefix}/bin CC = gcc -CFLAGS = -g -O2 -Wall -Wunused -Wstrict-prototypes -LDFLAGS = -lsysfs -ldevmapper +CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc -I../../klibc/klibc/include -I../../klibc/klibc/include/bits32 -I/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/include -I../../klibc/linux/include -I../../libsysfs -I. +LDFLAGS = -lsysfs -ldevmapper -ldlist -OBJS = main.o sg_err.o +OBJS = main.o all: $(EXEC) strip $(EXEC) @@ -20,7 +20,7 @@ all: $(EXEC) @echo "Make complete" $(EXEC): $(OBJS) - $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) + $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) $(CFLAGS) clean: rm -f core *.o $(EXEC) @@ -30,5 +30,4 @@ install: install -m 755 $(EXEC) $(bindir)/ # Code dependencies -main.o: main.c main.h sg_err.h sg_include.h -sg_err.o: sg_err.c sg_err.h sg_include.h +main.o: main.c main.h sg_include.h diff --git a/extras/multipath/main.c b/extras/multipath/main.c index 0ed74c52a9..b5ab664433 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -34,7 +33,6 @@ static int do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, void *resp, int mx_resp_len, int noisy) { - int res; unsigned char inqCmdBlk[INQUIRY_CMDLEN] = { INQUIRY_CMD, 0, 0, 0, 0, 0 }; unsigned char sense_b[SENSE_BUFF_LEN]; @@ -61,14 +59,27 @@ do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, perror("SG_IO (inquiry) error"); return -1; } - res = sg_err_category3(&io_hdr); - switch (res) { - case SG_ERR_CAT_CLEAN: - case SG_ERR_CAT_RECOVERED: + + /* treat SG_ERR here to get rid of sg_err.[ch] */ + io_hdr.status &= 0x7e; + if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && + (0 == io_hdr.driver_status)) return 0; - default: - return -1; + if ((SCSI_CHECK_CONDITION == io_hdr.status) || + (SCSI_COMMAND_TERMINATED == io_hdr.status) || + (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) { + if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) { + int sense_key; + unsigned char * sense_buffer = io_hdr.sbp; + if (sense_buffer[0] & 0x2) + sense_key = sense_buffer[1] & 0xf; + else + sense_key = sense_buffer[2] & 0xf; + if(RECOVERED_ERROR == sense_key) + return 0; + } } + return -1; } static int @@ -191,7 +202,7 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) int sg_fd; struct sysfs_directory * sdir; struct sysfs_directory * devp; - struct sysfs_dlink * linkp; + struct sysfs_link * linkp; char buff[FILE_NAME_SIZE]; char block_path[FILE_NAME_SIZE]; @@ -199,17 +210,15 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) sprintf(block_path, "%s/block", conf->sysfs_path); sdir = sysfs_open_directory(block_path); sysfs_read_directory(sdir); - devp = sdir->subdirs; - while (devp != NULL) { + dlist_for_each_data(sdir->subdirs, devp, struct sysfs_directory) { sysfs_read_directory(devp); - linkp = devp->links; - while (linkp != NULL) { + if(devp->links == NULL) + continue; + dlist_for_each_data(devp->links, linkp, struct sysfs_link) { if (!strncmp(linkp->name, "device", 6)) break; - linkp = linkp->next; } if (linkp == NULL) { - devp = devp->next; continue; } @@ -217,21 +226,19 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) sprintf(all_paths[k].sg_dev, "/dev/%s", buff); strcpy(all_paths[k].dev, all_paths[k].sg_dev); if ((sg_fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) { - devp = devp->next; continue; } get_lun_strings(sg_fd, &all_paths[k]); get_unique_id(sg_fd, &all_paths[k]); all_paths[k].state = do_tur(sg_fd); close(sg_fd); - basename(linkp->target->path, buff); + basename(linkp->target, buff); sscanf(buff, "%i:%i:%i:%i", &all_paths[k].sg_id.host_no, &all_paths[k].sg_id.channel, &all_paths[k].sg_id.scsi_id, &all_paths[k].sg_id.lun); k++; - devp = devp->next; } sysfs_close_directory(sdir); diff --git a/extras/multipath/main.h b/extras/multipath/main.h index 43a24ac7bc..019cb843a8 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -21,7 +21,16 @@ /* local includes */ #include "sg_include.h" -#include "sg_err.h" + +/* exerpt from "sg_err.h" */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SG_ERR_DRIVER_SENSE 0x08 + +/* exerpt from "scsi.h" */ +#define RECOVERED_ERROR 0x01 +#define SCSI_IOCTL_GET_IDLUN 0x5382 +#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 /* global defs */ #define WWID_SIZE 33 @@ -37,7 +46,7 @@ #define TUR_CMD_LEN 6 #define MX_ALLOC_LEN 255 #define BLKGETSIZE _IO(0x12,96) -#define DM_TARGET "striped" +#define DM_TARGET "multipath" #define PINDEX(x,y) mp[(x)].pindex[(y)] @@ -96,8 +105,8 @@ struct env { /* Build version */ #define PROG "multipath" -#define VERSION_CODE 0x000005 -#define DATE_CODE 0x120903 +#define VERSION_CODE 0x000006 +#define DATE_CODE 0x271103 #define MULTIPATH_VERSION(version) \ (version >> 16) & 0xFF, \ diff --git a/extras/multipath/sg_include.h b/extras/multipath/sg_include.h index 6b6dd6f372..460506826e 100644 --- a/extras/multipath/sg_include.h +++ b/extras/multipath/sg_include.h @@ -9,7 +9,6 @@ #include #else #include - #include #endif #endif -- cgit v1.2.3-54-g00ecf From c076a2bde406e617ebfeda6b921d1db89eb1a9f6 Mon Sep 17 00:00:00 2001 From: "arnd@arndb.de" Date: Tue, 2 Dec 2003 00:26:46 -0800 Subject: [PATCH] Build failure - missing linux/limits.h include? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Tuesday 25 November 2003 00:12, Chris Larson wrote: > udev fails to compile here unless I'm doing a KLIBC build. The reason > appears to be that the normal limits.h in the gcc inc dir doesn't pull > in linux/limits.h, whereas the limits.h out in the klibc include dirs > does. I'd think it'd be best to add a #include to > udev.h directly, since it uses PATH_MAX. No, don't include kernel headers directly if you can avoid it. The problem you are referring to seems to be with old tool chains, I have the same symptom with my s390 gcc-2.95/glibc-2.1.3. Including instead of seems to fix it. --- udev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.h b/udev.h index 8994307469..0c1951ad78 100644 --- a/udev.h +++ b/udev.h @@ -24,7 +24,7 @@ #define UDEV_H #include "libsysfs/libsysfs.h" -#include +#include #ifdef DEBUG #include -- cgit v1.2.3-54-g00ecf From bfd8a5d0f7361b6cb396eee7cdd686138ecd2066 Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Tue, 2 Dec 2003 00:44:48 -0800 Subject: [PATCH] ARCH detection for ppc I'm not sure why ppc is converted to powerpc, it breaks at least $(ARCH) in klibc. gcc -dumpmachine powerpc-suse-linux --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6c8b311f4e..d8d2ec0d7b 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ export CROSS CC AR STRIP RANLIB # code taken from uClibc to determine the current arch ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ - -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/ppc/powerpc/g'} + -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/powerpc/ppc/g'} # code taken from uClibc to determine the gcc include dir GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} -- cgit v1.2.3-54-g00ecf From bc1530c65c282e27eb60de797291ca45c2d8cda2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Dec 2003 00:47:52 -0800 Subject: [PATCH] Cset exclude: dsteklof@us.ibm.com|ChangeSet|20031126173159|56255 --- libsysfs/sysfs_device.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 2a5353e6f7..fbd046f229 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -28,7 +28,6 @@ static int confirm_device_bus(struct sysfs_device *dev, { struct sysfs_link *devlink = NULL; unsigned char devpath[SYSFS_PATH_MAX]; - unsigned char *s = NULL; int result = 0; if (busname == NULL || bus_id == NULL) @@ -37,9 +36,6 @@ static int confirm_device_bus(struct sysfs_device *dev, if (sysfs_get_mnt_path(devpath, SYSFS_PATH_MAX) != 0) return -1; - s = &devpath[strlen(devpath)-1]; - if (strncmp(s, "/", 1) == 0) - *s = '\0'; strcat(devpath, SYSFS_BUS_DIR); strcat(devpath, "/"); strcat(devpath, busname); -- cgit v1.2.3-54-g00ecf From edcd336477880368915245a4b7ddd1bca5940b30 Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Tue, 2 Dec 2003 00:48:01 -0800 Subject: [PATCH] another patch for path problem The quick patch I sent you yesterday fixes it in one location, but there are other points in the library that calls sysfs_get_mnt_path. We need to address all the areas in the library where paths are used. The following patch is a band-aid until we can get a proper path management in the library. --- libsysfs/libsysfs.h | 1 + libsysfs/sysfs_bus.c | 20 ++++++++++++++------ libsysfs/sysfs_class.c | 13 +++++++++---- libsysfs/sysfs_device.c | 13 ++++++++++--- libsysfs/sysfs_driver.c | 4 +++- libsysfs/sysfs_utils.c | 23 ++++++++++++++++++++++- 6 files changed, 59 insertions(+), 15 deletions(-) diff --git a/libsysfs/libsysfs.h b/libsysfs/libsysfs.h index f7e989e242..6d8e58de21 100644 --- a/libsysfs/libsysfs.h +++ b/libsysfs/libsysfs.h @@ -142,6 +142,7 @@ extern "C" { /* * Function Prototypes */ +extern int sysfs_trailing_slash(unsigned char *path); extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); extern int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, size_t len); diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index 3111154cbc..639acef4ee 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -112,7 +112,10 @@ static struct sysfs_directory *open_bus_dir(const unsigned char *name) return NULL; } - strcat(buspath, SYSFS_BUS_DIR); + if (sysfs_trailing_slash(buspath) == 0) + strcat(buspath, "/"); + + strcat(buspath, SYSFS_BUS_NAME); strcat(buspath, "/"); strcat(buspath, name); busdir = sysfs_open_directory(buspath); @@ -406,10 +409,13 @@ struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, return NULL; } - strcat(path, SYSFS_BUS_DIR); + if (sysfs_trailing_slash(path) == 0) + strcat(path, "/"); + strcat(path, SYSFS_BUS_NAME); strcat(path, "/"); strcat(path, busname); - strcat(path, SYSFS_DEVICES_DIR); + strcat(path, "/"); + strcat(path, SYSFS_DEVICES_NAME); strcat(path, "/"); strcat(path, dev_id); @@ -442,15 +448,17 @@ int sysfs_find_driver_bus(const unsigned char *driver, unsigned char *busname, } memset(subsys, 0, SYSFS_PATH_MAX); - strcpy(subsys, SYSFS_BUS_DIR); + strcpy(subsys, SYSFS_BUS_NAME); buslist = sysfs_open_subsystem_list(subsys); if (buslist != NULL) { dlist_for_each_data(buslist, bus, char) { memset(subsys, 0, SYSFS_PATH_MAX); - strcpy(subsys, SYSFS_BUS_DIR); + strcat(subsys, "/"); + strcpy(subsys, SYSFS_BUS_NAME); strcat(subsys, "/"); strcat(subsys, bus); - strcat(subsys, SYSFS_DRIVERS_DIR); + strcat(subsys, "/"); + strcat(subsys, SYSFS_DRIVERS_NAME); drivers = sysfs_open_subsystem_list(subsys); if (drivers != NULL) { dlist_for_each_data(drivers, curdrv, char) { diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index a0273565d5..54f22eee24 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -116,14 +116,16 @@ static struct sysfs_directory *open_class_dir(const unsigned char *name) return NULL; } + if (sysfs_trailing_slash(classpath) == 0) + strcat(classpath, "/"); /* * We shall now treat "block" also as a class. Hence, check here * if "name" is "block" and proceed accordingly */ if (strcmp(name, SYSFS_BLOCK_NAME) == 0) { - strcat(classpath, SYSFS_BLOCK_DIR); + strcat(classpath, SYSFS_BLOCK_NAME); } else { - strcat(classpath, SYSFS_CLASS_DIR); + strcat(classpath, SYSFS_CLASS_NAME); strcat(classpath, "/"); strcat(classpath, name); } @@ -365,10 +367,13 @@ static int get_classdev_path(const unsigned char *classname, dprintf("Error getting sysfs mount path\n"); return -1; } + if (sysfs_trailing_slash(path) == 0) + strcat(path, "/"); + if (strcmp(classname, SYSFS_BLOCK_NAME) == 0) { - strcat(path, SYSFS_BLOCK_DIR); + strcat(path, SYSFS_BLOCK_NAME); } else { - strcat(path, SYSFS_CLASS_DIR); + strcat(path, SYSFS_CLASS_NAME); strcat(path, "/"); strcat(path, classname); } diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index fbd046f229..323a43dac1 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -36,7 +36,9 @@ static int confirm_device_bus(struct sysfs_device *dev, if (sysfs_get_mnt_path(devpath, SYSFS_PATH_MAX) != 0) return -1; - strcat(devpath, SYSFS_BUS_DIR); + if (sysfs_trailing_slash(devpath) == 0) + strcat(devpath, "/"); + strcat(devpath, SYSFS_BUS_NAME); strcat(devpath, "/"); strcat(devpath, busname); strcat(devpath, SYSFS_DEVICES_DIR); @@ -306,7 +308,10 @@ static struct sysfs_directory *open_root_device_dir(const unsigned char *name) return NULL; } - strcat(rootpath, SYSFS_DEVICES_DIR); + if (sysfs_trailing_slash(rootpath) == 0) + strcat(rootpath, "/"); + + strcat(rootpath, SYSFS_DEVICES_NAME); strcat(rootpath, "/"); strcat(rootpath, name); rdir = sysfs_open_directory(rootpath); @@ -435,7 +440,9 @@ static int get_device_absolute_path(const unsigned char *device, dprintf ("Sysfs not supported on this system\n"); return -1; } - strcat(bus_path, SYSFS_BUS_DIR); + if (sysfs_trailing_slash(bus_path) == 0) + strcat(bus_path, "/"); + strcat(bus_path, SYSFS_BUS_NAME); strcat(bus_path, "/"); strcat(bus_path, bus); strcat(bus_path, SYSFS_DEVICES_DIR); diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index 0011177e99..1877dbce0b 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -182,7 +182,9 @@ static int get_driver_path(const unsigned char *bus, const unsigned char *drv, dprintf("Error getting sysfs mount path\n"); return -1; } - strcat(path, SYSFS_BUS_DIR); + if (sysfs_trailing_slash(path) == 0) + strcat(path, "/"); + strcat(path, SYSFS_BUS_NAME); strcat(path, "/"); strcat(path, bus); strcat(path, SYSFS_DRIVERS_DIR); diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 4e96051c78..627e618dce 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -76,6 +76,23 @@ static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, #endif } +/* + * sysfs_trailing_slash: checks if there's a trailing slash to path + * @path: path to check + * returns 1 if true and 0 if not + */ +int sysfs_trailing_slash(unsigned char *path) +{ + unsigned char *s = NULL; + + if (path == NULL) + return 0; + s = &path[strlen(path)-1]; + if (strncmp(s, "/", 1) == 0) + return 1; + return 0; +} + /* * sysfs_get_mnt_path: Gets the sysfs mount point. * @mnt_path: place to put "sysfs" mount point @@ -226,6 +243,8 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) return NULL; } + if (sysfs_trailing_slash(sysfs_path) == 0) + strcat(sysfs_path, "/"); strcat(sysfs_path, name); dir = sysfs_open_directory(sysfs_path); if (dir == NULL) { @@ -301,7 +320,9 @@ struct dlist *sysfs_open_bus_devices_list(unsigned char *name) return NULL; } - strcat(sysfs_path, SYSFS_BUS_DIR); + if (sysfs_trailing_slash(sysfs_path) == 0) + strcat(sysfs_path, "/"); + strcat(sysfs_path, SYSFS_BUS_NAME); strcat(sysfs_path, "/"); strcat(sysfs_path, name); strcat(sysfs_path, SYSFS_DEVICES_DIR); -- cgit v1.2.3-54-g00ecf From 7f2ea6a38223b02d38406baf1843f4ee1349abcf Mon Sep 17 00:00:00 2001 From: "mort@wildopensource.com" Date: Tue, 2 Dec 2003 00:59:36 -0800 Subject: [PATCH] Add -nodefaultlibs while compiling against klibc This patch adds -nodefaultlibs to LDFLAGS when compiling udev against klibc. This fixes the warning that I was getting when using $(LD)=gcc in the versions after Makefile.klibc disappeared. The problem was that it was still including a "-lc" in the call to the linker. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d8d2ec0d7b..67d38c0412 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ ifeq ($(strip $(KLIBC)),true) -I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -Iklibc/linux/include \ -D__KLIBC__ LIB_OBJS = - LDFLAGS = --static --nostdlib -nostartfiles + LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs else CRT0 = LIBC = -- cgit v1.2.3-54-g00ecf From 8cf7ebe8cdf9cb39ca9a60e23c735ab62cd15928 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Dec 2003 17:45:19 -0800 Subject: [PATCH] operate on the rules in the order they are in the config file (within the rule type) --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index d45a827083..0abd4b8041 100644 --- a/namedev.c +++ b/namedev.c @@ -145,7 +145,7 @@ static int add_dev(struct config_device *new_dev) if (!tmp_dev) return -ENOMEM; memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); - list_add(&tmp_dev->node, &config_device_list); + list_add_tail(&tmp_dev->node, &config_device_list); //dump_dev(tmp_dev); return 0; } -- cgit v1.2.3-54-g00ecf From 0db6d4cc61523ee7f3f627f807c01f86ee2d36ab Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Dec 2003 17:52:26 -0800 Subject: [PATCH] catch replace device by wildcard catch device name by wildcard to support a whole class of devices by just one config line like: REPLACE, KERNEL="tty*", NAME="vc/%n" --- namedev.c | 4 ++-- test/udev-test.pl | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 0abd4b8041..ea64f3404f 100644 --- a/namedev.c +++ b/namedev.c @@ -860,8 +860,8 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev continue; dbg_parse("compare name '%s' with '%s'", - dev->kernel_name, dev->name); - if (strcmp(dev->kernel_name, class_dev->name) != 0) + dev->kernel_name, class_dev->name); + if (strncmp_wildcard(class_dev->name, dev->kernel_name, NAME_SIZE) != 0) continue; strfieldcpy(udev->name, dev->name); diff --git a/test/udev-test.pl b/test/udev-test.pl index 3f48de8f3e..8b967c353c 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -48,6 +48,15 @@ EOF expected => "boot_disk1" , conf => < "catch device by wildcard", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor/0" , + conf => < Date: Tue, 2 Dec 2003 17:55:00 -0800 Subject: [PATCH] add devfs like tty rules as an example in the default config file. --- udev.config | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/udev.config b/udev.config index 7e67d3a3b4..44fdb2561d 100644 --- a/udev.config +++ b/udev.config @@ -41,3 +41,9 @@ TOPOLOGY, BUS="usb", place="2.4", NAME="mouse2" REPLACE, KERNEL="ttyUSB1", NAME="visor" REPLACE, KERNEL="ttyUSB0", NAME="pl2303" +# a devfs like way to name some tty devices +#REPLACE, KERNEL="tty", NAME="tty" +#REPLACE, KERNEL="ttyS*", NAME="tts/%n" +#REPLACE, KERNEL="tty*", NAME="vc/%n" + + -- cgit v1.2.3-54-g00ecf From 5c6f0fb0dcd999b96097b38311df439a85b6b799 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Dec 2003 18:18:21 -0800 Subject: [PATCH] rename namedev's get_attr() to be main namedev_name_device() as that's what it really is. --- namedev.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/namedev.c b/namedev.c index ea64f3404f..deb1d929e0 100644 --- a/namedev.c +++ b/namedev.c @@ -796,7 +796,6 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, return -ENODEV; } - static int do_topology(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { struct config_device *dev; @@ -901,7 +900,7 @@ static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice * } } -static int get_attr(struct sysfs_class_device *class_dev, struct udevice *udev) +int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) { struct sysfs_device *sysfs_device = NULL; struct sysfs_class_device *class_dev_parent = NULL; @@ -994,17 +993,6 @@ done: return 0; } -int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev) -{ - int retval; - - retval = get_attr(class_dev, dev); - if (retval) - dbg("get_attr failed"); - - return retval; -} - int namedev_init(void) { int retval; -- cgit v1.2.3-54-g00ecf From 19feb35100f602d2e9e4148d9e22548dae5a01d3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Dec 2003 18:38:30 -0800 Subject: [PATCH] split out the namedev config parsing logic to namedev_parse.c --- Makefile | 1 + namedev.c | 473 +++++--------------------------------------------------- namedev.h | 13 ++ namedev_parse.c | 420 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 475 insertions(+), 432 deletions(-) create mode 100644 namedev_parse.c diff --git a/Makefile b/Makefile index 67d38c0412..7aacb79de2 100644 --- a/Makefile +++ b/Makefile @@ -159,6 +159,7 @@ OBJS = udev.o \ udevdb.o \ logging.o \ namedev.o \ + namedev_parse.o \ $(SYSFS) \ $(TDB) diff --git a/namedev.c b/namedev.c index deb1d929e0..86685f8393 100644 --- a/namedev.c +++ b/namedev.c @@ -21,9 +21,6 @@ * */ -/* define this to enable parsing debugging */ -/* #define DEBUG_PARSER */ - #include #include #include @@ -41,14 +38,7 @@ #include "libsysfs/libsysfs.h" #include "klibc_fixups.h" -#define TYPE_LABEL "LABEL" -#define TYPE_NUMBER "NUMBER" -#define TYPE_TOPOLOGY "TOPOLOGY" -#define TYPE_REPLACE "REPLACE" -#define TYPE_CALLOUT "CALLOUT" -#define CALLOUT_MAXARG 8 - -static LIST_HEAD(config_device_list); +LIST_HEAD(config_device_list); /* s2 may end with '*' to match everything */ static int strncmp_wildcard(char *s1, char *s2, int max) @@ -63,49 +53,6 @@ static int strncmp_wildcard(char *s1, char *s2, int max) return strncmp(s1, s2, len); } -static void dump_dev(struct config_device *dev) -{ - switch (dev->type) { - case KERNEL_NAME: - dbg_parse("KERNEL name='%s' ," - "owner='%s', group='%s', mode=%#o", - dev->name, dev->owner, dev->group, dev->mode); - break; - case LABEL: - dbg_parse("LABEL name='%s', bus='%s', sysfs_file='%s', sysfs_value='%s', " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value, - dev->owner, dev->group, dev->mode); - break; - case NUMBER: - dbg_parse("NUMBER name='%s', bus='%s', id='%s', " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->bus, dev->id, - dev->owner, dev->group, dev->mode); - break; - case TOPOLOGY: - dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s', " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->bus, dev->place, - dev->owner, dev->group, dev->mode); - break; - case REPLACE: - dbg_parse("REPLACE name=%s, kernel_name=%s, " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->kernel_name, - dev->owner, dev->group, dev->mode); - break; - case CALLOUT: - dbg_parse("CALLOUT name='%s', bus='%s', program='%s', id='%s', " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->bus, dev->exec_program, dev->id, - dev->owner, dev->group, dev->mode); - break; - default: - dbg_parse("unknown type of method"); - } -} - #define copy_var(a, b, var) \ if (b->var) \ a->var = b->var; @@ -114,7 +61,7 @@ static void dump_dev(struct config_device *dev) if (strlen(b->var)) \ strcpy(a->var, b->var); -static int add_dev(struct config_device *new_dev) +int add_config_dev(struct config_device *new_dev) { struct list_head *tmp; struct config_device *tmp_dev; @@ -146,348 +93,10 @@ static int add_dev(struct config_device *new_dev) return -ENOMEM; memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); list_add_tail(&tmp_dev->node, &config_device_list); - //dump_dev(tmp_dev); - return 0; -} - -static void dump_dev_list(void) -{ - struct list_head *tmp; - - list_for_each(tmp, &config_device_list) { - struct config_device *dev = list_entry(tmp, struct config_device, node); - dump_dev(dev); - } -} - -static int get_pair(char **orig_string, char **left, char **right) -{ - char *temp; - char *string = *orig_string; - - if (!string) - return -ENODEV; - - /* eat any whitespace */ - while (isspace(*string)) - ++string; - - /* split based on '=' */ - temp = strsep(&string, "="); - *left = temp; - if (!string) - return -ENODEV; - - /* take the right side and strip off the '"' */ - while (isspace(*string)) - ++string; - if (*string == '"') - ++string; - else - return -ENODEV; - - temp = strsep(&string, "\""); - if (!string || *temp == '\0') - return -ENODEV; - *right = temp; - *orig_string = string; - + //dump_config_dev(tmp_dev); return 0; } -static int get_value(const char *left, char **orig_string, char **ret_string) -{ - int retval; - char *left_string; - - retval = get_pair(orig_string, &left_string, ret_string); - if (retval) - return retval; - if (strcasecmp(left_string, left) != 0) - return -ENODEV; - return 0; -} - -static int namedev_init_config(void) -{ - char line[255]; - int lineno; - char *temp; - char *temp2; - char *temp3; - FILE *fd; - int retval = 0; - struct config_device dev; - - dbg("opening '%s' to read as config", udev_config_filename); - fd = fopen(udev_config_filename, "r"); - if (fd == NULL) { - dbg("can't open '%s'", udev_config_filename); - return -ENODEV; - } - - /* loop through the whole file */ - lineno = 0; - while (1) { - /* get a line */ - temp = fgets(line, sizeof(line), fd); - if (temp == NULL) - goto exit; - lineno++; - - dbg_parse("read '%s'", temp); - - /* eat the whitespace at the beginning of the line */ - while (isspace(*temp)) - ++temp; - - /* empty line? */ - if (*temp == 0x00) - continue; - - /* see if this is a comment */ - if (*temp == COMMENT_CHARACTER) - continue; - - memset(&dev, 0x00, sizeof(struct config_device)); - - /* parse the line */ - temp2 = strsep(&temp, ","); - if (strcasecmp(temp2, TYPE_LABEL) == 0) { - /* label type */ - dev.type = LABEL; - - /* BUS="bus" */ - retval = get_value("BUS", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.bus, temp3); - - /* file="value" */ - temp2 = strsep(&temp, ","); - retval = get_pair(&temp, &temp2, &temp3); - if (retval) - break; - strfieldcpy(dev.sysfs_file, temp2); - strfieldcpy(dev.sysfs_value, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.name, temp3); - - dbg_parse("LABEL name='%s', bus='%s', " - "sysfs_file='%s', sysfs_value='%s'", - dev.name, dev.bus, dev.sysfs_file, - dev.sysfs_value); - } - - if (strcasecmp(temp2, TYPE_NUMBER) == 0) { - /* number type */ - dev.type = NUMBER; - - /* BUS="bus" */ - retval = get_value("BUS", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.bus, temp3); - - /* ID="id" */ - temp2 = strsep(&temp, ","); - retval = get_value("ID", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.id, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.name, temp3); - - dbg_parse("NUMBER name='%s', bus='%s', id='%s'", - dev.name, dev.bus, dev.id); - } - - if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { - /* number type */ - dev.type = TOPOLOGY; - - /* BUS="bus" */ - retval = get_value("BUS", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.bus, temp3); - - /* PLACE="place" */ - temp2 = strsep(&temp, ","); - retval = get_value("PLACE", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.place, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.name, temp3); - - dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s'", - dev.name, dev.bus, dev.place); - } - - if (strcasecmp(temp2, TYPE_REPLACE) == 0) { - /* number type */ - dev.type = REPLACE; - - /* KERNEL="kernel_name" */ - retval = get_value("KERNEL", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.kernel_name, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.name, temp3); - dbg_parse("REPLACE name='%s', kernel_name='%s'", - dev.name, dev.kernel_name); - } - if (strcasecmp(temp2, TYPE_CALLOUT) == 0) { - /* number type */ - dev.type = CALLOUT; - - /* BUS="bus" */ - retval = get_value("BUS", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.bus, temp3); - - /* PROGRAM="executable" */ - temp2 = strsep(&temp, ","); - retval = get_value("PROGRAM", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.exec_program, temp3); - - /* ID="id" */ - temp2 = strsep(&temp, ","); - retval = get_value("ID", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.id, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.name, temp3); - dbg_parse("CALLOUT name='%s', program='%s'", - dev.name, dev.exec_program); - } - - retval = add_dev(&dev); - if (retval) { - dbg("add_dev returned with error %d", retval); - goto exit; - } - } - dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, - lineno, temp - line, temp); -exit: - fclose(fd); - return retval; -} - - -static int namedev_init_permissions(void) -{ - char line[255]; - char *temp; - char *temp2; - FILE *fd; - int retval = 0; - struct config_device dev; - - dbg("opening '%s' to read as permissions config", udev_config_permission_filename); - fd = fopen(udev_config_permission_filename, "r"); - if (fd == NULL) { - dbg("can't open '%s'", udev_config_permission_filename); - return -ENODEV; - } - - /* loop through the whole file */ - while (1) { - temp = fgets(line, sizeof(line), fd); - if (temp == NULL) - break; - - dbg_parse("read '%s'", temp); - - /* eat the whitespace at the beginning of the line */ - while (isspace(*temp)) - ++temp; - - /* empty line? */ - if (*temp == 0x00) - continue; - - /* see if this is a comment */ - if (*temp == COMMENT_CHARACTER) - continue; - - memset(&dev, 0x00, sizeof(dev)); - - /* parse the line */ - temp2 = strsep(&temp, ":"); - if (!temp2) { - dbg("cannot parse line '%s'", line); - continue; - } - strncpy(dev.name, temp2, sizeof(dev.name)); - - temp2 = strsep(&temp, ":"); - if (!temp2) { - dbg("cannot parse line '%s'", line); - continue; - } - strncpy(dev.owner, temp2, sizeof(dev.owner)); - - temp2 = strsep(&temp, ":"); - if (!temp2) { - dbg("cannot parse line '%s'", line); - continue; - } - strncpy(dev.group, temp2, sizeof(dev.owner)); - - if (!temp) { - dbg("cannot parse line: %s", line); - continue; - } - dev.mode = strtol(temp, NULL, 8); - - dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", - dev.name, dev.owner, dev.group, - dev.mode); - retval = add_dev(&dev); - if (retval) { - dbg("add_dev returned with error %d", retval); - goto exit; - } - } - -exit: - fclose(fd); - return retval; -} - static mode_t get_default_mode(struct sysfs_class_device *class_dev) { /* just default everyone to rw for the world! */ @@ -664,7 +273,7 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev continue; if (sysfs_device) { - dbg_parse("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcasecmp(dev->bus, sysfs_device->bus) != 0) continue; } @@ -681,10 +290,10 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("callout returned matching value '%s', '%s' becomes '%s'" - " - owner='%s', group='%s', mode=%#o", - dev->id, class_dev->name, udev->name, - dev->owner, dev->group, dev->mode); + dbg("callout returned matching value '%s', '%s' becomes '%s'" + " - owner='%s', group='%s', mode=%#o", + dev->id, class_dev->name, udev->name, + dev->owner, dev->group, dev->mode); return 0; } return -ENODEV; @@ -702,12 +311,12 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, continue; if (sysfs_device) { - dbg_parse("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcasecmp(dev->bus, sysfs_device->bus) != 0) continue; } - dbg_parse("look for device attribute '%s'", dev->sysfs_file); + dbg("look for device attribute '%s'", dev->sysfs_file); /* try to find the attribute in the class device directory */ tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); if (tmpattr) @@ -724,7 +333,7 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, label_found: tmpattr->value[strlen(tmpattr->value)-1] = 0x00; - dbg_parse("compare attribute '%s' value '%s' with '%s'", + dbg("compare attribute '%s' value '%s' with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value); if (strcmp(dev->sysfs_value, tmpattr->value) != 0) continue; @@ -735,7 +344,7 @@ label_found: strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("found matching attribute '%s', '%s' becomes '%s' " + dbg("found matching attribute '%s', '%s' becomes '%s' " "- owner='%s', group='%s', mode=%#o", dev->sysfs_file, class_dev->name, udev->name, dev->owner, dev->group, dev->mode); @@ -762,20 +371,20 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, if (dev->type != NUMBER) continue; - dbg_parse("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcasecmp(dev->bus, sysfs_device->bus) != 0) continue; found = 0; strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); - dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path); + dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); if (strstr(temp, dev->id) != NULL) { found = 1; } else { *temp = 0x00; temp = strrchr(path, '/'); - dbg_parse("search '%s' in '%s', path='%s'", dev->id, temp, path); + dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); if (strstr(temp, dev->id) != NULL) found = 1; } @@ -787,10 +396,10 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("found matching id '%s', '%s' becomes '%s'" - " - owner='%s', group ='%s', mode=%#o", - dev->id, class_dev->name, udev->name, - dev->owner, dev->group, dev->mode); + dbg("found matching id '%s', '%s' becomes '%s'" + " - owner='%s', group ='%s', mode=%#o", + dev->id, class_dev->name, udev->name, + dev->owner, dev->group, dev->mode); return 0; } return -ENODEV; @@ -813,20 +422,20 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude if (dev->type != TOPOLOGY) continue; - dbg_parse("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcasecmp(dev->bus, sysfs_device->bus) != 0) continue; found = 0; strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); - dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path); + dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); if (strstr(temp, dev->place) != NULL) { found = 1; } else { *temp = 0x00; temp = strrchr(path, '/'); - dbg_parse("search '%s' in '%s', path='%s'", dev->place, temp, path); + dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); if (strstr(temp, dev->place) != NULL) found = 1; } @@ -839,10 +448,10 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("found matching place '%s', '%s' becomes '%s'" - " - owner='%s', group ='%s', mode=%#o", - dev->place, class_dev->name, udev->name, - dev->owner, dev->group, dev->mode); + dbg("found matching place '%s', '%s' becomes '%s'" + " - owner='%s', group ='%s', mode=%#o", + dev->place, class_dev->name, udev->name, + dev->owner, dev->group, dev->mode); return 0; } return -ENODEV; @@ -858,8 +467,7 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev if (dev->type != REPLACE) continue; - dbg_parse("compare name '%s' with '%s'", - dev->kernel_name, class_dev->name); + dbg("compare name '%s' with '%s'", dev->kernel_name, class_dev->name); if (strncmp_wildcard(class_dev->name, dev->kernel_name, NAME_SIZE) != 0) continue; @@ -869,9 +477,10 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); } - dbg_parse("found name, '%s' becomes '%s' - owner='%s', group='%s', mode = %#o", - dev->kernel_name, udev->name, - dev->owner, dev->group, dev->mode); + dbg("found name, '%s' becomes '%s'" + " - owner='%s', group='%s', mode = %#o", + dev->kernel_name, udev->name, + dev->owner, dev->group, dev->mode); return 0; } @@ -892,7 +501,7 @@ static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice * if (strncmp_wildcard(class_dev->name, dev->name, sizeof(dev->name))) continue; if (dev->mode != 0) { - dbg_parse("found permissions for '%s'", class_dev->name); + dbg("found permissions for '%s'", class_dev->name); udev->mode = dev->mode; strfieldcpy(udev->owner, dev->owner); strfieldcpy(udev->group, dev->group); @@ -919,20 +528,20 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud * up in the kernel... */ if (strstr(class_dev->path, "block")) { - dbg_parse("looking at block device"); + dbg("looking at block device"); if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { char path[SYSFS_PATH_MAX]; - dbg_parse("really is a partition"); + dbg("really is a partition"); strfieldcpy(path, class_dev->path); temp = strrchr(path, '/'); *temp = 0x00; - dbg_parse("looking for a class device at '%s'", path); + dbg("looking for a class device at '%s'", path); class_dev_parent = sysfs_open_class_device(path); if (class_dev_parent == NULL) { dbg("sysfs_open_class_device at '%s' failed", path); } else { - dbg_parse("class_dev_parent->name='%s'", class_dev_parent->name); + dbg("class_dev_parent->name='%s'", class_dev_parent->name); if (class_dev_parent->sysdevice) sysfs_device = class_dev_parent->sysdevice; } @@ -941,12 +550,12 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } if (sysfs_device) { - dbg_parse("sysfs_device->path='%s'", sysfs_device->path); - dbg_parse("sysfs_device->bus_id='%s'", sysfs_device->bus_id); - dbg_parse("sysfs_device->bus='%s'", sysfs_device->bus); + dbg("sysfs_device->path='%s'", sysfs_device->path); + dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); + dbg("sysfs_device->bus='%s'", sysfs_device->bus); strfieldcpy(udev->bus_id, sysfs_device->bus_id); } else { - dbg_parse("class_dev->name = '%s'", class_dev->name); + dbg("class_dev->name = '%s'", class_dev->name); } build_kernel_number(class_dev, udev); @@ -1005,6 +614,6 @@ int namedev_init(void) if (retval) return retval; - dump_dev_list(); + dump_config_dev_list(); return retval; } diff --git a/namedev.h b/namedev.h index 5ea843e9b7..1405d07e04 100644 --- a/namedev.h +++ b/namedev.h @@ -45,6 +45,12 @@ enum config_type { #define ID_SIZE 50 #define PLACE_SIZE 50 +#define TYPE_LABEL "LABEL" +#define TYPE_NUMBER "NUMBER" +#define TYPE_TOPOLOGY "TOPOLOGY" +#define TYPE_REPLACE "REPLACE" +#define TYPE_CALLOUT "CALLOUT" +#define CALLOUT_MAXARG 8 struct config_device { struct list_head node; @@ -65,8 +71,15 @@ struct config_device { mode_t mode; }; +extern struct list_head config_device_list; extern int namedev_init(void); extern int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev); +extern int namedev_init_permissions(void); +extern int namedev_init_config(void); + +extern int add_config_dev(struct config_device *new_dev); +extern void dump_config_dev(struct config_device *dev); +extern void dump_config_dev_list(void); #endif diff --git a/namedev_parse.c b/namedev_parse.c new file mode 100644 index 0000000000..a752b33050 --- /dev/null +++ b/namedev_parse.c @@ -0,0 +1,420 @@ +/* + * namedev_parse.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * + * 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 02139, USA. + * + */ + +/* define this to enable parsing debugging */ +/* #define DEBUG_PARSER */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "namedev.h" + +static int get_pair(char **orig_string, char **left, char **right) +{ + char *temp; + char *string = *orig_string; + + if (!string) + return -ENODEV; + + /* eat any whitespace */ + while (isspace(*string)) + ++string; + + /* split based on '=' */ + temp = strsep(&string, "="); + *left = temp; + if (!string) + return -ENODEV; + + /* take the right side and strip off the '"' */ + while (isspace(*string)) + ++string; + if (*string == '"') + ++string; + else + return -ENODEV; + + temp = strsep(&string, "\""); + if (!string || *temp == '\0') + return -ENODEV; + *right = temp; + *orig_string = string; + + return 0; +} + +static int get_value(const char *left, char **orig_string, char **ret_string) +{ + int retval; + char *left_string; + + retval = get_pair(orig_string, &left_string, ret_string); + if (retval) + return retval; + if (strcasecmp(left_string, left) != 0) + return -ENODEV; + return 0; +} + +void dump_config_dev(struct config_device *dev) +{ + switch (dev->type) { + case KERNEL_NAME: + dbg_parse("KERNEL name='%s' ," + "owner='%s', group='%s', mode=%#o", + dev->name, dev->owner, dev->group, dev->mode); + break; + case LABEL: + dbg_parse("LABEL name='%s', bus='%s', sysfs_file='%s', sysfs_value='%s', " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value, + dev->owner, dev->group, dev->mode); + break; + case NUMBER: + dbg_parse("NUMBER name='%s', bus='%s', id='%s', " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->bus, dev->id, + dev->owner, dev->group, dev->mode); + break; + case TOPOLOGY: + dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s', " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->bus, dev->place, + dev->owner, dev->group, dev->mode); + break; + case REPLACE: + dbg_parse("REPLACE name=%s, kernel_name=%s, " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->kernel_name, + dev->owner, dev->group, dev->mode); + break; + case CALLOUT: + dbg_parse("CALLOUT name='%s', bus='%s', program='%s', id='%s', " + "owner='%s', group='%s', mode=%#o", + dev->name, dev->bus, dev->exec_program, dev->id, + dev->owner, dev->group, dev->mode); + break; + default: + dbg_parse("unknown type of method"); + } +} + +void dump_config_dev_list(void) +{ + struct list_head *tmp; + + list_for_each(tmp, &config_device_list) { + struct config_device *dev = list_entry(tmp, struct config_device, node); + dump_config_dev(dev); + } +} + +int namedev_init_config(void) +{ + char line[255]; + int lineno; + char *temp; + char *temp2; + char *temp3; + FILE *fd; + int retval = 0; + struct config_device dev; + + dbg("opening '%s' to read as config", udev_config_filename); + fd = fopen(udev_config_filename, "r"); + if (fd == NULL) { + dbg("can't open '%s'", udev_config_filename); + return -ENODEV; + } + + /* loop through the whole file */ + lineno = 0; + while (1) { + /* get a line */ + temp = fgets(line, sizeof(line), fd); + if (temp == NULL) + goto exit; + lineno++; + + dbg_parse("read '%s'", temp); + + /* eat the whitespace at the beginning of the line */ + while (isspace(*temp)) + ++temp; + + /* empty line? */ + if (*temp == 0x00) + continue; + + /* see if this is a comment */ + if (*temp == COMMENT_CHARACTER) + continue; + + memset(&dev, 0x00, sizeof(struct config_device)); + + /* parse the line */ + temp2 = strsep(&temp, ","); + if (strcasecmp(temp2, TYPE_LABEL) == 0) { + /* label type */ + dev.type = LABEL; + + /* BUS="bus" */ + retval = get_value("BUS", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.bus, temp3); + + /* file="value" */ + temp2 = strsep(&temp, ","); + retval = get_pair(&temp, &temp2, &temp3); + if (retval) + break; + strfieldcpy(dev.sysfs_file, temp2); + strfieldcpy(dev.sysfs_value, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.name, temp3); + + dbg_parse("LABEL name='%s', bus='%s', " + "sysfs_file='%s', sysfs_value='%s'", + dev.name, dev.bus, dev.sysfs_file, + dev.sysfs_value); + } + + if (strcasecmp(temp2, TYPE_NUMBER) == 0) { + /* number type */ + dev.type = NUMBER; + + /* BUS="bus" */ + retval = get_value("BUS", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.bus, temp3); + + /* ID="id" */ + temp2 = strsep(&temp, ","); + retval = get_value("ID", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.id, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.name, temp3); + + dbg_parse("NUMBER name='%s', bus='%s', id='%s'", + dev.name, dev.bus, dev.id); + } + + if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { + /* number type */ + dev.type = TOPOLOGY; + + /* BUS="bus" */ + retval = get_value("BUS", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.bus, temp3); + + /* PLACE="place" */ + temp2 = strsep(&temp, ","); + retval = get_value("PLACE", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.place, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.name, temp3); + + dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s'", + dev.name, dev.bus, dev.place); + } + + if (strcasecmp(temp2, TYPE_REPLACE) == 0) { + /* number type */ + dev.type = REPLACE; + + /* KERNEL="kernel_name" */ + retval = get_value("KERNEL", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.kernel_name, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.name, temp3); + dbg_parse("REPLACE name='%s', kernel_name='%s'", + dev.name, dev.kernel_name); + } + if (strcasecmp(temp2, TYPE_CALLOUT) == 0) { + /* number type */ + dev.type = CALLOUT; + + /* BUS="bus" */ + retval = get_value("BUS", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.bus, temp3); + + /* PROGRAM="executable" */ + temp2 = strsep(&temp, ","); + retval = get_value("PROGRAM", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.exec_program, temp3); + + /* ID="id" */ + temp2 = strsep(&temp, ","); + retval = get_value("ID", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.id, temp3); + + /* NAME="new_name" */ + temp2 = strsep(&temp, ","); + retval = get_value("NAME", &temp, &temp3); + if (retval) + break; + strfieldcpy(dev.name, temp3); + dbg_parse("CALLOUT name='%s', program='%s'", + dev.name, dev.exec_program); + } + + retval = add_config_dev(&dev); + if (retval) { + dbg("add_config_dev returned with error %d", retval); + goto exit; + } + } + dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, + lineno, temp - line, temp); +exit: + fclose(fd); + return retval; +} + + +int namedev_init_permissions(void) +{ + char line[255]; + char *temp; + char *temp2; + FILE *fd; + int retval = 0; + struct config_device dev; + + dbg("opening '%s' to read as permissions config", udev_config_permission_filename); + fd = fopen(udev_config_permission_filename, "r"); + if (fd == NULL) { + dbg("can't open '%s'", udev_config_permission_filename); + return -ENODEV; + } + + /* loop through the whole file */ + while (1) { + temp = fgets(line, sizeof(line), fd); + if (temp == NULL) + break; + + dbg_parse("read '%s'", temp); + + /* eat the whitespace at the beginning of the line */ + while (isspace(*temp)) + ++temp; + + /* empty line? */ + if (*temp == 0x00) + continue; + + /* see if this is a comment */ + if (*temp == COMMENT_CHARACTER) + continue; + + memset(&dev, 0x00, sizeof(dev)); + + /* parse the line */ + temp2 = strsep(&temp, ":"); + if (!temp2) { + dbg("cannot parse line '%s'", line); + continue; + } + strncpy(dev.name, temp2, sizeof(dev.name)); + + temp2 = strsep(&temp, ":"); + if (!temp2) { + dbg("cannot parse line '%s'", line); + continue; + } + strncpy(dev.owner, temp2, sizeof(dev.owner)); + + temp2 = strsep(&temp, ":"); + if (!temp2) { + dbg("cannot parse line '%s'", line); + continue; + } + strncpy(dev.group, temp2, sizeof(dev.owner)); + + if (!temp) { + dbg("cannot parse line: %s", line); + continue; + } + dev.mode = strtol(temp, NULL, 8); + + dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", + dev.name, dev.owner, dev.group, + dev.mode); + retval = add_config_dev(&dev); + if (retval) { + dbg("add_config_dev returned with error %d", retval); + goto exit; + } + } + +exit: + fclose(fd); + return retval; +} + + -- cgit v1.2.3-54-g00ecf From 29b82deb7e8d7634792bd50be1377bae170a8acb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Dec 2003 18:41:29 -0800 Subject: [PATCH] turn debugging messages off by default. it's a bit noisy for the masses... --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7aacb79de2..340ca87f2a 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ # Set the following to `true' to make a debuggable build. # Leave this set to `false' for production use. -DEBUG = true +DEBUG = false ROOT = udev -- cgit v1.2.3-54-g00ecf From e8bacccab296d6b75c4c9f43cb4e71007aff5b8a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 01:08:46 -0800 Subject: [PATCH] add support for a main udev config file, udev.conf. the older udev.config file is now called udev.rules. This allows us to better control configuration values, and move away from the environment variables. --- Makefile | 7 +- namedev.c | 2 +- namedev.h | 5 +- namedev_parse.c | 24 +++--- test/label_test.config | 3 - test/label_test.rules | 3 + test/modifier_test.config | 3 - test/modifier_test.rules | 3 + test/replace_test.config | 3 - test/replace_test.rules | 3 + test/topo_test.config | 3 - test/topo_test.rules | 3 + udev.c | 60 +++----------- udev.conf | 23 ++++++ udev.config | 49 ------------ udev.config.demo | 9 --- udev.h | 17 ++-- udev.rules | 49 ++++++++++++ udev.rules.demo | 9 +++ udev.spec | 6 +- udev_config.c | 195 ++++++++++++++++++++++++++++++++++++++++++++++ 21 files changed, 335 insertions(+), 144 deletions(-) delete mode 100644 test/label_test.config create mode 100644 test/label_test.rules delete mode 100644 test/modifier_test.config create mode 100644 test/modifier_test.rules delete mode 100644 test/replace_test.config create mode 100644 test/replace_test.rules delete mode 100644 test/topo_test.config create mode 100644 test/topo_test.rules create mode 100644 udev.conf delete mode 100644 udev.config delete mode 100644 udev.config.demo create mode 100644 udev.rules create mode 100644 udev.rules.demo create mode 100644 udev_config.c diff --git a/Makefile b/Makefile index 340ca87f2a..d95aedc1a3 100644 --- a/Makefile +++ b/Makefile @@ -154,6 +154,7 @@ SYSFS = libsysfs/sysfs_bus.o \ libsysfs/dlist.o OBJS = udev.o \ + udev_config.o \ udev-add.o \ udev-remove.o \ udevdb.o \ @@ -226,7 +227,8 @@ install: all $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 - $(INSTALL_DATA) udev.config $(DESTDIR)$(configdir) + $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir) + $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir) $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir) - rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug - ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug @@ -234,7 +236,8 @@ install: all uninstall: - rm $(hotplugdir)/udev.hotplug - rm $(configdir)/udev.permissions - - rm $(configdir)/udev.config + - rm $(configdir)/udev.rules + - rm $(configdir)/udev.conf - rm $(mandir)/man8/udev.8 - rm $(sbindir)/$(ROOT) - rmdir $(hotplugdir) diff --git a/namedev.c b/namedev.c index 86685f8393..a81721a9cf 100644 --- a/namedev.c +++ b/namedev.c @@ -606,7 +606,7 @@ int namedev_init(void) { int retval; - retval = namedev_init_config(); + retval = namedev_init_rules(); if (retval) return retval; diff --git a/namedev.h b/namedev.h index 1405d07e04..94fdf4ac91 100644 --- a/namedev.h +++ b/namedev.h @@ -28,7 +28,6 @@ struct sysfs_class_device; -#define COMMENT_CHARACTER '#' enum config_type { KERNEL_NAME = 0, /* must be 0 to let memset() default to this value */ @@ -76,10 +75,12 @@ extern struct list_head config_device_list; extern int namedev_init(void); extern int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev); extern int namedev_init_permissions(void); -extern int namedev_init_config(void); +extern int namedev_init_rules(void); extern int add_config_dev(struct config_device *new_dev); extern void dump_config_dev(struct config_device *dev); extern void dump_config_dev_list(void); +extern int get_pair(char **orig_string, char **left, char **right); + #endif diff --git a/namedev_parse.c b/namedev_parse.c index a752b33050..bd23867e18 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -36,7 +36,7 @@ #include "udev.h" #include "namedev.h" -static int get_pair(char **orig_string, char **left, char **right) +int get_pair(char **orig_string, char **left, char **right) { char *temp; char *string = *orig_string; @@ -137,7 +137,7 @@ void dump_config_dev_list(void) } } -int namedev_init_config(void) +int namedev_init_rules(void) { char line[255]; int lineno; @@ -148,10 +148,11 @@ int namedev_init_config(void) int retval = 0; struct config_device dev; - dbg("opening '%s' to read as config", udev_config_filename); - fd = fopen(udev_config_filename, "r"); - if (fd == NULL) { - dbg("can't open '%s'", udev_config_filename); + fd = fopen(udev_rules_filename, "r"); + if (fd != NULL) { + dbg("reading '%s' as rules file", udev_rules_filename); + } else { + dbg("can't open '%s' as a rules file", udev_rules_filename); return -ENODEV; } @@ -328,7 +329,7 @@ int namedev_init_config(void) goto exit; } } - dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, + dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_rules_filename, lineno, temp - line, temp); exit: fclose(fd); @@ -345,10 +346,11 @@ int namedev_init_permissions(void) int retval = 0; struct config_device dev; - dbg("opening '%s' to read as permissions config", udev_config_permission_filename); - fd = fopen(udev_config_permission_filename, "r"); - if (fd == NULL) { - dbg("can't open '%s'", udev_config_permission_filename); + fd = fopen(udev_permission_filename, "r"); + if (fd != NULL) { + dbg("reading '%s' as permissions file", udev_permission_filename); + } else { + dbg("can't open '%s' as permissions file", udev_permission_filename); return -ENODEV; } diff --git a/test/label_test.config b/test/label_test.config deleted file mode 100644 index a6d1c1cb3e..0000000000 --- a/test/label_test.config +++ /dev/null @@ -1,3 +0,0 @@ -# LABEL test -LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n" - diff --git a/test/label_test.rules b/test/label_test.rules new file mode 100644 index 0000000000..a6d1c1cb3e --- /dev/null +++ b/test/label_test.rules @@ -0,0 +1,3 @@ +# LABEL test +LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n" + diff --git a/test/modifier_test.config b/test/modifier_test.config deleted file mode 100644 index f63e02c3ac..0000000000 --- a/test/modifier_test.config +++ /dev/null @@ -1,3 +0,0 @@ -# TOPO test -TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" - diff --git a/test/modifier_test.rules b/test/modifier_test.rules new file mode 100644 index 0000000000..f63e02c3ac --- /dev/null +++ b/test/modifier_test.rules @@ -0,0 +1,3 @@ +# TOPO test +TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" + diff --git a/test/replace_test.config b/test/replace_test.config deleted file mode 100644 index 8fbfd18100..0000000000 --- a/test/replace_test.config +++ /dev/null @@ -1,3 +0,0 @@ -# REPLACE test -REPLACE, KERNEL="ttyUSB0", NAME="visor" - diff --git a/test/replace_test.rules b/test/replace_test.rules new file mode 100644 index 0000000000..8fbfd18100 --- /dev/null +++ b/test/replace_test.rules @@ -0,0 +1,3 @@ +# REPLACE test +REPLACE, KERNEL="ttyUSB0", NAME="visor" + diff --git a/test/topo_test.config b/test/topo_test.config deleted file mode 100644 index 72f03ee0b2..0000000000 --- a/test/topo_test.config +++ /dev/null @@ -1,3 +0,0 @@ -# TOPO test -TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="first_disk%n" - diff --git a/test/topo_test.rules b/test/topo_test.rules new file mode 100644 index 0000000000..72f03ee0b2 --- /dev/null +++ b/test/topo_test.rules @@ -0,0 +1,3 @@ +# TOPO test +TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="first_disk%n" + diff --git a/udev.c b/udev.c index 094905ecc2..272afbab6e 100644 --- a/udev.c +++ b/udev.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "udev.h" #include "udev_version.h" @@ -39,11 +40,13 @@ char **main_argv; char **main_envp; char sysfs_path[SYSFS_PATH_MAX]; -char *udev_config_dir = UDEV_CONFIG_DIR; -char *udev_root = UDEV_ROOT; +char udev_config_dir[PATH_MAX]; +char udev_root[PATH_MAX]; char udev_db_filename[PATH_MAX+NAME_MAX]; -char udev_config_permission_filename[PATH_MAX+NAME_MAX]; +char udev_permission_filename[PATH_MAX+NAME_MAX]; +char udev_rules_filename[PATH_MAX+NAME_MAX]; char udev_config_filename[PATH_MAX+NAME_MAX]; +char default_mode_str[NAME_MAX]; static inline char *get_action(void) @@ -70,53 +73,6 @@ static inline char *get_seqnum(void) return seqnum; } -static void get_dirs(void) -{ - char *temp; - char *udev_db = UDEV_DB; - char *udev_config = UDEV_CONFIG_FILE; - char *udev_permission = UDEV_CONFIG_PERMISSION_FILE; - int retval; - - retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); - if (retval) - dbg("sysfs_get_mnt_path failed"); - - /* see if we should try to override any of the default values */ - temp = getenv("UDEV_TEST"); - if (temp != NULL) { - /* hm testing is happening, use the specified values, if they are present */ - temp = getenv("SYSFS_PATH"); - if (temp) - strncpy(sysfs_path, temp, sizeof(sysfs_path)); - temp = getenv("UDEV_CONFIG_DIR"); - if (temp) - udev_config_dir = temp; - temp = getenv("UDEV_ROOT"); - if (temp) - udev_root = temp; - temp = getenv("UDEV_DB"); - if (temp) - udev_db = temp; - temp = getenv("UDEV_CONFIG_FILE"); - if (temp) - udev_config = temp; - temp = getenv("UDEV_PERMISSION_FILE"); - if (temp) - udev_permission = temp; - } - dbg("sysfs_path='%s'", sysfs_path); - - strncpy(udev_db_filename, udev_root, sizeof(udev_db_filename)); - strncat(udev_db_filename, udev_db, sizeof(udev_db_filename)); - - strncpy(udev_config_filename, udev_config_dir, sizeof(udev_config_filename)); - strncat(udev_config_filename, udev_config, sizeof(udev_config_filename)); - - strncpy(udev_config_permission_filename, udev_config_dir, sizeof(udev_config_permission_filename)); - strncat(udev_config_permission_filename, udev_permission, sizeof(udev_config_permission_filename)); -} - int main(int argc, char **argv, char **envp) { char *action; @@ -162,8 +118,10 @@ int main(int argc, char **argv, char **envp) goto exit; } + /* initialize our configuration */ + udev_init_config(); + /* initialize udev database */ - get_dirs(); retval = udevdb_init(UDEVDB_DEFAULT); if (retval != 0) { dbg("unable to initialize database"); diff --git a/udev.conf b/udev.conf new file mode 100644 index 0000000000..aadaea8a24 --- /dev/null +++ b/udev.conf @@ -0,0 +1,23 @@ +# udev.conf +# The main config file for udev +# +# This file can be used to override some of udev's default values +# for where it looks for files, and where it places device nodes. + + +# udev_root - where in the filesystem to place the device nodes +udev_root="/udev/" + +# udev_db - The name and location of the udev database. +udev_db="/udev/.udev.tdb" + +# udev_rules - The name and location of the udev rules file +udev_rules="/etc/udev/udev.rules" + +# udev_permissions - The name and location of the udev permission file +udev_permissions="/etc/udev/udev.permissions" + +# default_mode - set the default mode for all nodes that have no +# explicit match in the permissions file +default_mode="0666" + diff --git a/udev.config b/udev.config deleted file mode 100644 index 44fdb2561d..0000000000 --- a/udev.config +++ /dev/null @@ -1,49 +0,0 @@ -# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields. -# They provide the following subsitutions: -# %n - the "kernel number" of the device. -# for example, 'sda3' has a "kernel number" of '3' -# %M - the kernel major number for the device -# %m - the kernel minor number for the device -# %b - the bus id for the device -# %c - the return value for the CALLOUT program (note, this doesn't work within -# the PROGRAM field for the obvious reason.) -# %D - use the devfs style disk name for this device. -# For partitions, this will result in 'part%n' -# If this is not a partition, it will result in 'disk' -# - -# Looking for scsi bus id 42:0:0:1 -CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" - -# A usb camera. -LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera%n" - -# USB Epson printer to be called lp_epson -LABEL, BUS="usb", serial="HXOLL0012202323480", NAME="lp_epson" - -# USB HP printer to be called lp_hp -LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_hp" - -# sound card with PCI bus id 00:0b.0 to be the first sound card -NUMBER, BUS="pci", id="00:0b.0", NAME="dsp" - -# sound card with PCI bus id 00:07.1 to be the second sound card -NUMBER, BUS="pci", id="00:07.1", NAME="dsp1" - -# USB mouse plugged into the third port of the first hub to be called mouse0 -TOPOLOGY, BUS="usb", place="1.3", NAME="mouse0" - -# USB tablet plugged into the third port of the second hub to be called mouse1 -TOPOLOGY, BUS="usb", place="2.3", NAME="mouse1" -TOPOLOGY, BUS="usb", place="2.4", NAME="mouse2" - -# ttyUSB1 should always be called visor -REPLACE, KERNEL="ttyUSB1", NAME="visor" -REPLACE, KERNEL="ttyUSB0", NAME="pl2303" - -# a devfs like way to name some tty devices -#REPLACE, KERNEL="tty", NAME="tty" -#REPLACE, KERNEL="ttyS*", NAME="tts/%n" -#REPLACE, KERNEL="tty*", NAME="vc/%n" - - diff --git a/udev.config.demo b/udev.config.demo deleted file mode 100644 index 6426ce2090..0000000000 --- a/udev.config.demo +++ /dev/null @@ -1,9 +0,0 @@ -# USB camera from Fuji to be named "camera" -LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera%n" - -# USB device plugged into the fourth port of the second hub to be called gps_device -TOPOLOGY, BUS="usb", place="2.4", NAME="gps_device" - -# ttyUSB1 should always be called visor -REPLACE, KERNEL="ttyUSB1", NAME="visor" - diff --git a/udev.h b/udev.h index 0c1951ad78..4acbb61391 100644 --- a/udev.h +++ b/udev.h @@ -51,10 +51,13 @@ extern int log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -/* filenames for the config and database files */ +/* default filenames for the config and database files */ +#define UDEV_CONFIG_FILE "udev.conf" #define UDEV_DB ".udev.tdb" -#define UDEV_CONFIG_PERMISSION_FILE "udev.permissions" -#define UDEV_CONFIG_FILE "udev.config" +#define UDEV_RULES_FILE "udev.rules" +#define UDEV_PERMISSION_FILE "udev.permissions" + +#define COMMENT_CHARACTER '#' #define NAME_SIZE 100 #define OWNER_SIZE 30 @@ -84,14 +87,16 @@ do { \ extern int udev_add_device(char *path, char *subsystem); extern int udev_remove_device(char *path, char *subsystem); +extern void udev_init_config(void); extern char **main_argv; extern char **main_envp; extern char sysfs_path[SYSFS_PATH_MAX]; -extern char *udev_config_dir; -extern char *udev_root; +extern char udev_config_dir[PATH_MAX]; +extern char udev_root[PATH_MAX]; extern char udev_db_filename[PATH_MAX+NAME_MAX]; -extern char udev_config_permission_filename[PATH_MAX+NAME_MAX]; +extern char udev_permission_filename[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; +extern char udev_rules_filename[PATH_MAX+NAME_MAX]; #endif diff --git a/udev.rules b/udev.rules new file mode 100644 index 0000000000..44fdb2561d --- /dev/null +++ b/udev.rules @@ -0,0 +1,49 @@ +# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields. +# They provide the following subsitutions: +# %n - the "kernel number" of the device. +# for example, 'sda3' has a "kernel number" of '3' +# %M - the kernel major number for the device +# %m - the kernel minor number for the device +# %b - the bus id for the device +# %c - the return value for the CALLOUT program (note, this doesn't work within +# the PROGRAM field for the obvious reason.) +# %D - use the devfs style disk name for this device. +# For partitions, this will result in 'part%n' +# If this is not a partition, it will result in 'disk' +# + +# Looking for scsi bus id 42:0:0:1 +CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" + +# A usb camera. +LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera%n" + +# USB Epson printer to be called lp_epson +LABEL, BUS="usb", serial="HXOLL0012202323480", NAME="lp_epson" + +# USB HP printer to be called lp_hp +LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_hp" + +# sound card with PCI bus id 00:0b.0 to be the first sound card +NUMBER, BUS="pci", id="00:0b.0", NAME="dsp" + +# sound card with PCI bus id 00:07.1 to be the second sound card +NUMBER, BUS="pci", id="00:07.1", NAME="dsp1" + +# USB mouse plugged into the third port of the first hub to be called mouse0 +TOPOLOGY, BUS="usb", place="1.3", NAME="mouse0" + +# USB tablet plugged into the third port of the second hub to be called mouse1 +TOPOLOGY, BUS="usb", place="2.3", NAME="mouse1" +TOPOLOGY, BUS="usb", place="2.4", NAME="mouse2" + +# ttyUSB1 should always be called visor +REPLACE, KERNEL="ttyUSB1", NAME="visor" +REPLACE, KERNEL="ttyUSB0", NAME="pl2303" + +# a devfs like way to name some tty devices +#REPLACE, KERNEL="tty", NAME="tty" +#REPLACE, KERNEL="ttyS*", NAME="tts/%n" +#REPLACE, KERNEL="tty*", NAME="vc/%n" + + diff --git a/udev.rules.demo b/udev.rules.demo new file mode 100644 index 0000000000..6426ce2090 --- /dev/null +++ b/udev.rules.demo @@ -0,0 +1,9 @@ +# USB camera from Fuji to be named "camera" +LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera%n" + +# USB device plugged into the fourth port of the second hub to be called gps_device +TOPOLOGY, BUS="usb", place="2.4", NAME="gps_device" + +# ttyUSB1 should always be called visor +REPLACE, KERNEL="ttyUSB1", NAME="visor" + diff --git a/udev.spec b/udev.spec index 0c30d613b7..8cc424cacb 100644 --- a/udev.spec +++ b/udev.spec @@ -32,12 +32,16 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /sbin/udev %attr(755,root,root) /udev/ %attr(755,root,root) /etc/udev/ -%attr(0644,root,root) /etc/udev/udev.config +%attr(0644,root,root) /etc/udev/udev.conf +%attr(0644,root,root) /etc/udev/udev.rules %attr(0644,root,root) /etc/udev/udev.permissions %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(0644,root,root) %{_mandir}/man8/udev.8* %changelog +* Tue Nov 2 2003 Greg Kroah-Hartman +- changes due to config file name changes + * Fri Oct 17 2003 Robert Love - Make work without a build root - Correctly install the right files diff --git a/udev_config.c b/udev_config.c new file mode 100644 index 0000000000..262108dff7 --- /dev/null +++ b/udev_config.c @@ -0,0 +1,195 @@ +/* + * udev_config.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * + * 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 02139, USA. + * + */ + +/* define this to enable parsing debugging */ +/* #define DEBUG_PARSER */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_version.h" +#include "namedev.h" +#include "libsysfs/libsysfs.h" + +/* global variables */ +char sysfs_path[SYSFS_PATH_MAX]; +char udev_config_dir[PATH_MAX]; +char udev_root[PATH_MAX]; +char udev_db_filename[PATH_MAX+NAME_MAX]; +char udev_permission_filename[PATH_MAX+NAME_MAX]; +char udev_rules_filename[PATH_MAX+NAME_MAX]; +char udev_config_filename[PATH_MAX+NAME_MAX]; +char default_mode_str[NAME_MAX]; + + +static void init_variables(void) +{ + strfieldcpy(udev_root, UDEV_ROOT); + strfieldcpy(udev_config_dir, UDEV_CONFIG_DIR); +} + +#define set_var(_name, _var) \ + if (strcasecmp(variable, _name) == 0) { \ + dbg_parse("%s = '%s'", _name, value); \ + strncpy(_var, value, sizeof(_var)); \ + } + +static int parse_config_file(void) +{ + char line[255]; + char *temp; + char *variable; + char *value; + FILE *fd; + int lineno = 0; + int retval = 0; + + fd = fopen(udev_config_filename, "r"); + if (fd != NULL) { + dbg("reading '%s' as config file", udev_config_filename); + } else { + dbg("can't open '%s' as config file", udev_config_filename); + return -ENODEV; + } + + /* loop through the whole file */ + while (1) { + /* get a line */ + temp = fgets(line, sizeof(line), fd); + if (temp == NULL) + goto exit; + lineno++; + + dbg_parse("read '%s'", temp); + + /* eat the whitespace at the beginning of the line */ + while (isspace(*temp)) + ++temp; + + /* empty line? */ + if (*temp == 0x00) + continue; + + /* see if this is a comment */ + if (*temp == COMMENT_CHARACTER) + continue; + + retval = get_pair(&temp, &variable, &value); + if (retval) + break; + + dbg_parse("variable = '%s', value = '%s'", variable, value); + + set_var("udev_root", udev_root); + set_var("udev_db", udev_db_filename); + set_var("udev_rules", udev_rules_filename); + set_var("udev_permissions", udev_permission_filename); + set_var("default_mode", default_mode_str); + } + dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, + lineno, temp - line, temp); +exit: + fclose(fd); + return retval; +} + +static void get_dirs(void) +{ + char *temp; + char *udev_db = UDEV_DB; + char *udev_config = UDEV_CONFIG_FILE; + char *udev_rules = UDEV_RULES_FILE; + char *udev_permission = UDEV_PERMISSION_FILE; + int retval; + + retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); + if (retval) + dbg("sysfs_get_mnt_path failed"); + + /* see if we should try to override any of the default values */ + temp = getenv("UDEV_TEST"); + if (temp != NULL) { + /* hm testing is happening, use the specified values, if they are present */ + temp = getenv("SYSFS_PATH"); + if (temp) + strfieldcpy(sysfs_path, temp); + temp = getenv("UDEV_CONFIG_DIR"); + if (temp) + strfieldcpy(udev_config_dir, temp); + temp = getenv("UDEV_ROOT"); + if (temp) + strfieldcpy(udev_root, temp); + temp = getenv("UDEV_DB"); + if (temp) + udev_db = temp; + temp = getenv("UDEV_CONFIG_FILE"); + if (temp) + udev_config = temp; + temp = getenv("UDEV_RULES_FILE"); + if (temp) + udev_rules = temp; + temp = getenv("UDEV_PERMISSION_FILE"); + if (temp) + udev_permission = temp; + } + dbg("sysfs_path='%s'", sysfs_path); + + strncpy(udev_db_filename, udev_root, sizeof(udev_db_filename)); + strncat(udev_db_filename, udev_db, sizeof(udev_db_filename)); + + strncpy(udev_config_filename, udev_config_dir, sizeof(udev_config_filename)); + strncat(udev_config_filename, udev_config, sizeof(udev_config_filename)); + + strncpy(udev_rules_filename, udev_config_dir, sizeof(udev_permission_filename)); + strncat(udev_rules_filename, udev_rules, sizeof(udev_permission_filename)); + + strncpy(udev_permission_filename, udev_config_dir, sizeof(udev_permission_filename)); + strncat(udev_permission_filename, udev_permission, sizeof(udev_permission_filename)); + + dbg_parse("udev_root = %s", udev_root); + dbg_parse("udev_config_filename = %s", udev_config_filename); + dbg_parse("udev_db_filename = %s", udev_db_filename); + dbg_parse("udev_rules_filename = %s", udev_rules_filename); + dbg_parse("udev_permission_filename = %s", udev_permission_filename); + parse_config_file(); + + dbg_parse("udev_root = %s", udev_root); + dbg_parse("udev_config_filename = %s", udev_config_filename); + dbg_parse("udev_db_filename = %s", udev_db_filename); + dbg_parse("udev_rules_filename = %s", udev_rules_filename); + dbg_parse("udev_permission_filename = %s", udev_permission_filename); +} + +void udev_init_config(void) +{ + init_variables(); + get_dirs(); +} + + -- cgit v1.2.3-54-g00ecf From fd9594b61fb5ac4106731c087af614940b066df4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 01:09:05 -0800 Subject: [PATCH] fix up the tests to support the rules file name change --- test/label_test | 1 + test/modifier_test | 1 + test/replace_test | 1 + test/topo_test | 1 + test/udev-test.pl | 2 +- 5 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/label_test b/test/label_test index 0bf89226cb..b0a605cdac 100644 --- a/test/label_test +++ b/test/label_test @@ -6,6 +6,7 @@ export UDEV_CONFIG_DIR=$PWD/ export UDEV_ROOT=$PWD/udev/ export UDEV_DB=udev.tdb export UDEV_CONFIG_FILE=label_test.config +export UDEV_RULES_FILE=label_test.rules export UDEV_PERMISSION_FILE=udev.permissions export ACTION=add diff --git a/test/modifier_test b/test/modifier_test index 3dcd4454fc..a028d20e4d 100644 --- a/test/modifier_test +++ b/test/modifier_test @@ -6,6 +6,7 @@ export UDEV_CONFIG_DIR=$PWD/ export UDEV_ROOT=$PWD/udev/ export UDEV_DB=udev.tdb export UDEV_CONFIG_FILE=modifier_test.config +export UDEV_RULES_FILE=modifier_test.rules export UDEV_PERMISSION_FILE=udev.permissions export ACTION=add diff --git a/test/replace_test b/test/replace_test index c8e54f8f8d..aae07b48ac 100644 --- a/test/replace_test +++ b/test/replace_test @@ -6,6 +6,7 @@ export UDEV_CONFIG_DIR=$PWD/ export UDEV_ROOT=$PWD/udev/ export UDEV_DB=udev.tdb export UDEV_CONFIG_FILE=replace_test.config +export UDEV_RULES_FILE=replace_test.rules export UDEV_PERMISSION_FILE=udev.permissions export DEVPATH=class/tty/ttyUSB0 diff --git a/test/topo_test b/test/topo_test index 2a19c8b5f8..71121f478e 100644 --- a/test/topo_test +++ b/test/topo_test @@ -6,6 +6,7 @@ export UDEV_CONFIG_DIR=$PWD/ export UDEV_ROOT=$PWD/udev/ export UDEV_DB=udev.tdb export UDEV_CONFIG_FILE=topo_test.config +export UDEV_RULES_FILE=topo_test.rules export UDEV_PERMISSION_FILE=udev.permissions export ACTION=add diff --git a/test/udev-test.pl b/test/udev-test.pl index 8b967c353c..8af09a027b 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -161,7 +161,7 @@ sub udev { my ($action, $subsys, $devpath, $config) = @_; $ENV{DEVPATH} = $devpath; - $ENV{UDEV_CONFIG_FILE} = $conf_tmp; + $ENV{UDEV_RULES_FILE} = $conf_tmp; # create temporary config open CONF, ">$conf_tmp" || die "unable to create config file: $conf_tmp"; -- cgit v1.2.3-54-g00ecf From 4865de442901cefebb7be889aa61233d8777b413 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 01:09:48 -0800 Subject: [PATCH] Update the man page to show the new config file, it's format, and how to use it. wow, update the docs to keep in line with reality, what a concept... --- udev.8 | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 11 deletions(-) diff --git a/udev.8 b/udev.8 index 22c4586daa..fd1b6dd228 100644 --- a/udev.8 +++ b/udev.8 @@ -27,16 +27,73 @@ On device removal, .B udev queries the internal database for the name of the device file to be deleted. .SH "CONFIGURATION" +All udev configuration files consist of a set of lines of text. All empty +lines, and lines beginning with a '#' will be ignored. +.P + .B udev -expects its configuration at -.I /etc/udev/udev.config. -The file consists of a set of lines. All empty lines and -lines beginning with a '#' will be ignored. +expects its main configuration file at +.I /etc/udev/udev.conf. +The file consists of a set of variables and values that allow the user to +override default udev values. The current set of variables that can be +overridden in this file is: +.TP +.B udev_root +This is the where in the filesystem to place the device nodes. The default +value for this is +.I /udev/ +.TP +.B udev_db +The name and location of the udev database. The default value for this is +.I /udev/.udev.tdb +.TP +.B udev_rules +This is the location of the udev rules file. The default value for this is +.I /etc/udev/udev.rules +.TP +.B udev_permissions +This is the location of the udev permission file. The default value for this is +.I /etc/udev/udev.permissions +.TP +.B default_mode +This is the default mode for all nodes that have no explicit match in the +permissions file. The default value for this is +.I 0666 .br -Every line defines the mapping between device attributes and the device file -name. It starts with a keyword defining the method used to match, followed by -one ore more keys to compare and the filename for the device. If no matching -configuration is found, the default kernel device name is used. +.P +A sample \fIudev.conf\fP might look like this: +.sp +.nf +# udev_root - where in the filesystem to place the device nodes +udev_root="/udev/" + +# udev_db - The name and location of the udev database. +udev_db="/udev/.udev.tdb" + +# udev_rules - The name and location of the udev rules file +udev_rules="/etc/udev/udev.rules" + +# udev_permissions - The name and location of the udev permission file +udev_permissions="/etc/udev/udev.permissions" + +# default_mode - set the default mode for all nodes that have no +# explicit match in the permissions file +default_mode="0666" +.fi +.P +The rules for udev to use when naming devices may specified at +.I /etc/udev/udev.rules +or specified by the +.I udev_rules +value in the +.I /etc/udev/udev.conf +file. +.P +Every line in the rules file define the mapping between device attributes and +the device file name. It starts with a keyword defining the method used to +match, followed by one ore more keys to compare and the filename for the +device. If no matching configuration is found, the default kernel device name +is used. .P The line format is: .RS @@ -113,7 +170,7 @@ For partitions, this will result in 'part%n' If this is not a partition, it will result in 'disk' .RE .P -A sample \fIudev.conf\fP might look like this: +A sample \fIudev.rules\fP might look like this: .sp .nf # if /sbin/scsi_id returns "OEM 0815" device will be called disk1 @@ -136,7 +193,12 @@ LABEL, BUS="usb", model="WebCam Version 3", NAME="webcam%n" .fi .P Permissions and ownership for the created device files may specified at -.I /etc/udev/udev.permissions. +.I /etc/udev/udev.permissions +or specified by the +.I udev_permission +value in the +.I /etc/udev/udev.conf +file. The file consists of a set of lines. All empty lines and lines beginning with a '#' will be ignored. .br @@ -164,7 +226,7 @@ dsp1:::0666 .ft B .ft /sbin/udev udev program -/etc/udev/* udev config and database files +/etc/udev/* udev config files /etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program .fi .LP -- cgit v1.2.3-54-g00ecf From 9f1da3613897346b6a45e1f7a706d2315bc0f420 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 3 Dec 2003 06:22:53 -0800 Subject: [PATCH] pattern matching for namedev As promised yesterday, here is a patch to implement a more advanced pattern matching instead of the simple '*'. We can remove the "tty"="tty" line from udev.rules now and replace "tty*" by "tty[0-9]*" to catch only the vc's. implement pattern matching in namedev '*' - to match zero or more chars '?' - to match exactly one char '[]' - character classes with ranges '[0-9]'and negation [!A] --- namedev.c | 67 +++++++++++++++++++++++++++++++++++++++++++------------ test/udev-test.pl | 26 +++++++++++++++++++-- 2 files changed, 77 insertions(+), 16 deletions(-) diff --git a/namedev.c b/namedev.c index a81721a9cf..b9e099413b 100644 --- a/namedev.c +++ b/namedev.c @@ -40,17 +40,56 @@ LIST_HEAD(config_device_list); -/* s2 may end with '*' to match everything */ -static int strncmp_wildcard(char *s1, char *s2, int max) +/* compare string with pattern (supports * ? [0-9] [!A-Z]) */ +static int strcmp_pattern(const char *p, const char *s) { - int len = strlen(s2); - if (len > max) - len = max; - if (s2[len-1] == '*') - len--; - else - len = max; - return strncmp(s1, s2, len); + if (*s == '\0') { + while (*p == '*') + p++; + return (*p != '\0'); + } + switch (*p) { + case '[': + { + int not = 0; + p++; + if (*p == '!') { + not = 1; + p++; + } + while (*p && (*p != ']')) { + int match = 0; + if (p[1] == '-') { + if ((*s >= *p) && (*s <= p[2])) + match = 1; + p += 3; + } else { + match = (*p == *s); + p++; + } + if (match ^ not) { + while (*p && (*p != ']')) + p++; + return strcmp_pattern(p+1, s+1); + } + } + } + break; + case '*': + if (strcmp_pattern(p, s+1)) + return strcmp_pattern(p+1, s); + return 0; + case '\0': + if (*s == '\0') { + return 0; + } + break; + default: + if ((*p == *s) || (*p == '?')) + return strcmp_pattern(p+1, s+1); + break; + } + return 1; } #define copy_var(a, b, var) \ @@ -69,7 +108,7 @@ int add_config_dev(struct config_device *new_dev) /* update the values if we already have the device */ list_for_each(tmp, &config_device_list) { struct config_device *dev = list_entry(tmp, struct config_device, node); - if (strncmp_wildcard(dev->name, new_dev->name, sizeof(dev->name))) + if (strcmp_pattern(new_dev->name, dev->name)) continue; if (strncmp(dev->bus, new_dev->bus, sizeof(dev->name))) continue; @@ -282,7 +321,7 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev apply_format(udev, dev->exec_program); if (exec_callout(dev, udev->callout_value, NAME_SIZE)) continue; - if (strncmp_wildcard(udev->callout_value, dev->id, NAME_SIZE) != 0) + if (strcmp_pattern(dev->id, udev->callout_value) != 0) continue; strfieldcpy(udev->name, dev->name); if (dev->mode != 0) { @@ -468,7 +507,7 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev continue; dbg("compare name '%s' with '%s'", dev->kernel_name, class_dev->name); - if (strncmp_wildcard(class_dev->name, dev->kernel_name, NAME_SIZE) != 0) + if (strcmp_pattern(dev->kernel_name, class_dev->name) != 0) continue; strfieldcpy(udev->name, dev->name); @@ -498,7 +537,7 @@ static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice * list_for_each(tmp, &config_device_list) { dev = list_entry(tmp, struct config_device, node); len = strlen(dev->name); - if (strncmp_wildcard(class_dev->name, dev->name, sizeof(dev->name))) + if (strcmp_pattern(dev->name, class_dev->name)) continue; if (dev->mode != 0) { dbg("found permissions for '%s'", class_dev->name); diff --git a/test/udev-test.pl b/test/udev-test.pl index 8af09a027b..47190f6e5d 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -51,12 +51,34 @@ LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n" EOF }, { - desc => "catch device by wildcard", + desc => "catch device by *", subsys => "tty", devpath => "class/tty/ttyUSB0", expected => "visor/0" , conf => < "catch device by ?", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor/0" , + conf => < "catch device by character class", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor/0" , + conf => < "callout result substitution", subsys => "block", devpath => "block/sda/sda3", expected => "special-device-3" , -- cgit v1.2.3-54-g00ecf From 3836a3c49a72b9ee0b092725628f30839f100c4f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 08:13:11 -0800 Subject: [PATCH] get rid of the majority of the debug environment variables. Now there are only 3 valid environment test variables. The rest can be specified with the config file. --- Makefile | 6 +++++- namedev_parse.c | 6 +++--- test/label_test.rules | 3 --- test/modifier_test.rules | 3 --- test/replace_test.rules | 3 --- test/topo_test.rules | 3 --- udev.c | 10 ---------- udev.h | 10 +--------- udev_config.c | 50 ++++++++++++------------------------------------ 9 files changed, 21 insertions(+), 73 deletions(-) delete mode 100644 test/label_test.rules delete mode 100644 test/modifier_test.rules delete mode 100644 test/replace_test.rules delete mode 100644 test/topo_test.rules diff --git a/Makefile b/Makefile index d95aedc1a3..98f2a1f434 100644 --- a/Makefile +++ b/Makefile @@ -174,8 +174,12 @@ GEN_HEADERS = udev_version.h # Rules on how to create the generated header files udev_version.h: @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ - @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ + @echo \#define UDEV_DB \"$(udevdir)\.udev.tdb\" >> $@ + @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ + @echo \#define UDEV_CONFIG_FILE \"$(configdir)\udev.conf\" >> $@ + @echo \#define UDEV_RULES_FILE \"$(configdir)\udev.rules\" >> $@ + @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ $(OBJS): $(GEN_HEADERS) diff --git a/namedev_parse.c b/namedev_parse.c index bd23867e18..a6a7d4b62e 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -346,11 +346,11 @@ int namedev_init_permissions(void) int retval = 0; struct config_device dev; - fd = fopen(udev_permission_filename, "r"); + fd = fopen(udev_permissions_filename, "r"); if (fd != NULL) { - dbg("reading '%s' as permissions file", udev_permission_filename); + dbg("reading '%s' as permissions file", udev_permissions_filename); } else { - dbg("can't open '%s' as permissions file", udev_permission_filename); + dbg("can't open '%s' as permissions file", udev_permissions_filename); return -ENODEV; } diff --git a/test/label_test.rules b/test/label_test.rules deleted file mode 100644 index a6d1c1cb3e..0000000000 --- a/test/label_test.rules +++ /dev/null @@ -1,3 +0,0 @@ -# LABEL test -LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n" - diff --git a/test/modifier_test.rules b/test/modifier_test.rules deleted file mode 100644 index f63e02c3ac..0000000000 --- a/test/modifier_test.rules +++ /dev/null @@ -1,3 +0,0 @@ -# TOPO test -TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" - diff --git a/test/replace_test.rules b/test/replace_test.rules deleted file mode 100644 index 8fbfd18100..0000000000 --- a/test/replace_test.rules +++ /dev/null @@ -1,3 +0,0 @@ -# REPLACE test -REPLACE, KERNEL="ttyUSB0", NAME="visor" - diff --git a/test/topo_test.rules b/test/topo_test.rules deleted file mode 100644 index 72f03ee0b2..0000000000 --- a/test/topo_test.rules +++ /dev/null @@ -1,3 +0,0 @@ -# TOPO test -TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="first_disk%n" - diff --git a/udev.c b/udev.c index 272afbab6e..bf18a568ea 100644 --- a/udev.c +++ b/udev.c @@ -39,16 +39,6 @@ char **main_argv; char **main_envp; -char sysfs_path[SYSFS_PATH_MAX]; -char udev_config_dir[PATH_MAX]; -char udev_root[PATH_MAX]; -char udev_db_filename[PATH_MAX+NAME_MAX]; -char udev_permission_filename[PATH_MAX+NAME_MAX]; -char udev_rules_filename[PATH_MAX+NAME_MAX]; -char udev_config_filename[PATH_MAX+NAME_MAX]; -char default_mode_str[NAME_MAX]; - - static inline char *get_action(void) { char *action; diff --git a/udev.h b/udev.h index 4acbb61391..1a899bb40a 100644 --- a/udev.h +++ b/udev.h @@ -50,13 +50,6 @@ extern int log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); - -/* default filenames for the config and database files */ -#define UDEV_CONFIG_FILE "udev.conf" -#define UDEV_DB ".udev.tdb" -#define UDEV_RULES_FILE "udev.rules" -#define UDEV_PERMISSION_FILE "udev.permissions" - #define COMMENT_CHARACTER '#' #define NAME_SIZE 100 @@ -92,10 +85,9 @@ extern void udev_init_config(void); extern char **main_argv; extern char **main_envp; extern char sysfs_path[SYSFS_PATH_MAX]; -extern char udev_config_dir[PATH_MAX]; extern char udev_root[PATH_MAX]; extern char udev_db_filename[PATH_MAX+NAME_MAX]; -extern char udev_permission_filename[PATH_MAX+NAME_MAX]; +extern char udev_permissions_filename[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; diff --git a/udev_config.c b/udev_config.c index 262108dff7..074bd7b35b 100644 --- a/udev_config.c +++ b/udev_config.c @@ -39,10 +39,9 @@ /* global variables */ char sysfs_path[SYSFS_PATH_MAX]; -char udev_config_dir[PATH_MAX]; char udev_root[PATH_MAX]; char udev_db_filename[PATH_MAX+NAME_MAX]; -char udev_permission_filename[PATH_MAX+NAME_MAX]; +char udev_permissions_filename[PATH_MAX+NAME_MAX]; char udev_rules_filename[PATH_MAX+NAME_MAX]; char udev_config_filename[PATH_MAX+NAME_MAX]; char default_mode_str[NAME_MAX]; @@ -50,8 +49,14 @@ char default_mode_str[NAME_MAX]; static void init_variables(void) { + /* fill up the defaults. + * If any config values are specified, they will + * override these values. */ strfieldcpy(udev_root, UDEV_ROOT); - strfieldcpy(udev_config_dir, UDEV_CONFIG_DIR); + strfieldcpy(udev_db_filename, UDEV_DB); + strfieldcpy(udev_config_filename, UDEV_CONFIG_FILE); + strfieldcpy(udev_rules_filename, UDEV_RULES_FILE); + strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE); } #define set_var(_name, _var) \ @@ -109,7 +114,7 @@ static int parse_config_file(void) set_var("udev_root", udev_root); set_var("udev_db", udev_db_filename); set_var("udev_rules", udev_rules_filename); - set_var("udev_permissions", udev_permission_filename); + set_var("udev_permissions", udev_permissions_filename); set_var("default_mode", default_mode_str); } dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, @@ -122,10 +127,6 @@ exit: static void get_dirs(void) { char *temp; - char *udev_db = UDEV_DB; - char *udev_config = UDEV_CONFIG_FILE; - char *udev_rules = UDEV_RULES_FILE; - char *udev_permission = UDEV_PERMISSION_FILE; int retval; retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); @@ -139,51 +140,24 @@ static void get_dirs(void) temp = getenv("SYSFS_PATH"); if (temp) strfieldcpy(sysfs_path, temp); - temp = getenv("UDEV_CONFIG_DIR"); - if (temp) - strfieldcpy(udev_config_dir, temp); - temp = getenv("UDEV_ROOT"); - if (temp) - strfieldcpy(udev_root, temp); - temp = getenv("UDEV_DB"); - if (temp) - udev_db = temp; temp = getenv("UDEV_CONFIG_FILE"); if (temp) - udev_config = temp; - temp = getenv("UDEV_RULES_FILE"); - if (temp) - udev_rules = temp; - temp = getenv("UDEV_PERMISSION_FILE"); - if (temp) - udev_permission = temp; + strfieldcpy(udev_config_filename, temp); } dbg("sysfs_path='%s'", sysfs_path); - strncpy(udev_db_filename, udev_root, sizeof(udev_db_filename)); - strncat(udev_db_filename, udev_db, sizeof(udev_db_filename)); - - strncpy(udev_config_filename, udev_config_dir, sizeof(udev_config_filename)); - strncat(udev_config_filename, udev_config, sizeof(udev_config_filename)); - - strncpy(udev_rules_filename, udev_config_dir, sizeof(udev_permission_filename)); - strncat(udev_rules_filename, udev_rules, sizeof(udev_permission_filename)); - - strncpy(udev_permission_filename, udev_config_dir, sizeof(udev_permission_filename)); - strncat(udev_permission_filename, udev_permission, sizeof(udev_permission_filename)); - dbg_parse("udev_root = %s", udev_root); dbg_parse("udev_config_filename = %s", udev_config_filename); dbg_parse("udev_db_filename = %s", udev_db_filename); dbg_parse("udev_rules_filename = %s", udev_rules_filename); - dbg_parse("udev_permission_filename = %s", udev_permission_filename); + dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); parse_config_file(); dbg_parse("udev_root = %s", udev_root); dbg_parse("udev_config_filename = %s", udev_config_filename); dbg_parse("udev_db_filename = %s", udev_db_filename); dbg_parse("udev_rules_filename = %s", udev_rules_filename); - dbg_parse("udev_permission_filename = %s", udev_permission_filename); + dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); } void udev_init_config(void) -- cgit v1.2.3-54-g00ecf From 72ffa78debb1f96488b5e13d3151486563b460e7 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 08:13:53 -0800 Subject: [PATCH] fix up the tests to work without all of the environ variables. --- test/label_test | 23 +++++++++++++++++------ test/modifier_test | 23 +++++++++++++++++------ test/replace_test | 24 +++++++++++++++++------- test/topo_test | 23 +++++++++++++++++------ test/udev-test.pl | 18 ++++++++++++------ 5 files changed, 80 insertions(+), 31 deletions(-) diff --git a/test/label_test b/test/label_test index b0a605cdac..c333937434 100644 --- a/test/label_test +++ b/test/label_test @@ -1,13 +1,22 @@ #!/bin/bash +RULES=label_test.rules +CONFIG=label_test.conf + export UDEV_TEST=yes export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_DIR=$PWD/ -export UDEV_ROOT=$PWD/udev/ -export UDEV_DB=udev.tdb -export UDEV_CONFIG_FILE=label_test.config -export UDEV_RULES_FILE=label_test.rules -export UDEV_PERMISSION_FILE=udev.permissions +export UDEV_CONFIG_FILE=$PWD/$CONFIG + +cat > $RULES << EOF +LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n" +EOF + +cat > $CONFIG << EOF +udev_root="$PWD/udev/" +udev_db="$PWD/udev/.udev.tdb" +udev_rules="$PWD/$RULES" +udev_permissions="$PWD/udev.permissions" +EOF export ACTION=add export DEVPATH=block/sda @@ -32,3 +41,5 @@ export DEVPATH=block/sda/sda3 ls udev +rm $RULES +rm $CONFIG diff --git a/test/modifier_test b/test/modifier_test index a028d20e4d..bbe072e58c 100644 --- a/test/modifier_test +++ b/test/modifier_test @@ -1,13 +1,22 @@ #!/bin/bash +RULES=modifier_test.rules +CONFIG=modifier_test.conf + export UDEV_TEST=yes export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_DIR=$PWD/ -export UDEV_ROOT=$PWD/udev/ -export UDEV_DB=udev.tdb -export UDEV_CONFIG_FILE=modifier_test.config -export UDEV_RULES_FILE=modifier_test.rules -export UDEV_PERMISSION_FILE=udev.permissions +export UDEV_CONFIG_FILE=$PWD/$CONFIG + +cat > $RULES << EOF +TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" +EOF + +cat > $CONFIG << EOF +udev_root="$PWD/udev/" +udev_db="$PWD/udev/.udev.tdb" +udev_rules="$PWD/$RULES" +udev_permissions="$PWD/udev.permissions" +EOF export ACTION=add export DEVPATH=block/sda @@ -31,3 +40,5 @@ export DEVPATH=block/sda/sda3 ../udev block ls udev +rm $RULES +rm $CONFIG diff --git a/test/replace_test b/test/replace_test index aae07b48ac..375c8dced3 100644 --- a/test/replace_test +++ b/test/replace_test @@ -1,13 +1,22 @@ #!/bin/bash +RULES=replace_test.rules +CONFIG=replace_test.conf + export UDEV_TEST=yes export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_DIR=$PWD/ -export UDEV_ROOT=$PWD/udev/ -export UDEV_DB=udev.tdb -export UDEV_CONFIG_FILE=replace_test.config -export UDEV_RULES_FILE=replace_test.rules -export UDEV_PERMISSION_FILE=udev.permissions +export UDEV_CONFIG_FILE=$PWD/$CONFIG + +cat > $RULES << EOF +REPLACE, KERNEL="ttyUSB0", NAME="visor" +EOF + +cat > $CONFIG << EOF +udev_root="$PWD/udev/" +udev_db="$PWD/udev/.udev.tdb" +udev_rules="$PWD/$RULES" +udev_permissions="$PWD/udev.permissions" +EOF export DEVPATH=class/tty/ttyUSB0 export ACTION=add @@ -19,4 +28,5 @@ export ACTION=remove ../udev tty ls -l udev - +rm $RULES +rm $CONFIG diff --git a/test/topo_test b/test/topo_test index 71121f478e..9225685c8c 100644 --- a/test/topo_test +++ b/test/topo_test @@ -1,13 +1,22 @@ #!/bin/bash +RULES=replace_test.rules +CONFIG=replace_test.conf + export UDEV_TEST=yes export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_DIR=$PWD/ -export UDEV_ROOT=$PWD/udev/ -export UDEV_DB=udev.tdb -export UDEV_CONFIG_FILE=topo_test.config -export UDEV_RULES_FILE=topo_test.rules -export UDEV_PERMISSION_FILE=udev.permissions +export UDEV_CONFIG_FILE=$PWD/$CONFIG + +cat > $RULES << EOF +TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="first_disk%n" +EOF + +cat > $CONFIG << EOF +udev_root="$PWD/udev/" +udev_db="$PWD/udev/.udev.tdb" +udev_rules="$PWD/$RULES" +udev_permissions="$PWD/udev.permissions" +EOF export ACTION=add export DEVPATH=block/sda @@ -31,3 +40,5 @@ export DEVPATH=block/sda/sda3 ../udev block ls udev +rm $RULES +rm $CONFIG diff --git a/test/udev-test.pl b/test/udev-test.pl index 47190f6e5d..97f75edc94 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -27,7 +27,8 @@ my $udev_bin = "../udev"; my $udev_root = "udev-root/"; # !!! directory will be removed !!! my $udev_db = ".udev.tdb"; my $perm = "udev.permissions"; -my $conf_tmp = "udev-test.config"; +my $main_conf = "udev-test.conf"; +my $conf_tmp = "udev-test.rules"; my @tests = ( @@ -173,17 +174,13 @@ EOF # set env $ENV{UDEV_TEST} = "yes"; $ENV{SYSFS_PATH} = $sysfs; -$ENV{UDEV_CONFIG_DIR} = "./"; -$ENV{UDEV_ROOT} = $udev_root; -$ENV{UDEV_DB} = $udev_db; -$ENV{UDEV_PERMISSION_FILE} = $perm; +$ENV{UDEV_CONFIG_FILE} = $main_conf; sub udev { my ($action, $subsys, $devpath, $config) = @_; $ENV{DEVPATH} = $devpath; - $ENV{UDEV_RULES_FILE} = $conf_tmp; # create temporary config open CONF, ">$conf_tmp" || die "unable to create config file: $conf_tmp"; @@ -203,6 +200,14 @@ mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; my $error = 0; print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; +# create initial config file +open CONF, ">$main_conf" || die "unable to create config file: $main_conf"; +print CONF "udev_root=\"$udev_root\"\n"; +print CONF "udev_db=\"$udev_db\"\n"; +print CONF "udev_rules=\"$conf_tmp\"\n"; +print CONF "udev_permissions=\"$perm\"\n"; +close CONF; + foreach my $config (@tests) { $config->{conf} =~ m/^([A-Z]*).*/; my $method = $1; @@ -236,4 +241,5 @@ print "$error errors occured\n\n"; unlink($udev_db); system("rm -rf $udev_root"); unlink($conf_tmp); +unlink($main_conf); -- cgit v1.2.3-54-g00ecf From 5ec0b542163c3630b196ce676d717c8d1d8c0317 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 08:18:14 -0800 Subject: [PATCH] remove some items off of the TODO list, as they are now done. --- TODO | 6 ------ 1 file changed, 6 deletions(-) diff --git a/TODO b/TODO index 4f5db9a982..d5cc9194e6 100644 --- a/TODO +++ b/TODO @@ -6,14 +6,8 @@ greg k-h greg@kroah.com -- add modifiers and more documentation about the config file to the man - page. -- add ability to capture CALLOUT result and use it in a device name. - fix kernel name logic to handle devices like sdaj and such. -- make real test harness and have the tests be automated (instead of - relying on me knowing what the proper files should be created.) - more documentation (can never have too much.) -- document the config file format (it will change over time...) - add symlink generation and removal support - better partition support (it's a hack right now, maybe new libsysfs changes can help out a lot here.) -- cgit v1.2.3-54-g00ecf From 356816abf60ca6a36d4e10e8ccd33fa9b1cd10a1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 17:37:29 -0800 Subject: [PATCH] show permissions and groups in the label_test --- test/label_test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/label_test b/test/label_test index c333937434..fb3fa2359f 100644 --- a/test/label_test +++ b/test/label_test @@ -22,23 +22,23 @@ export ACTION=add export DEVPATH=block/sda ../udev block -ls udev +ls -l udev export DEVPATH=block/sda/sda3 ../udev block -ls udev +ls -l udev export ACTION=remove export DEVPATH=block/sda ../udev block -ls udev +ls -l udev export DEVPATH=block/sda/sda3 ../udev block -ls udev +ls -l udev rm $RULES -- cgit v1.2.3-54-g00ecf From 8957102244524980f5008dcaf4cbf271a5254531 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 17:41:02 -0800 Subject: [PATCH] add support for the default_mode variable, as it is documented... --- namedev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index b9e099413b..f4c263f5bc 100644 --- a/namedev.c +++ b/namedev.c @@ -138,8 +138,12 @@ int add_config_dev(struct config_device *new_dev) static mode_t get_default_mode(struct sysfs_class_device *class_dev) { - /* just default everyone to rw for the world! */ - return 0666; + mode_t mode = 0600; /* default to owner rw only */ + + if (strlen(default_mode_str) != 0) { + mode = strtol(default_mode_str, NULL, 8); + } + return mode; } static void build_kernel_number(struct sysfs_class_device *class_dev, struct udevice *udev) -- cgit v1.2.3-54-g00ecf From 206d3623c6454b6f34002d0d27e9aa2d00e4de06 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 18:30:49 -0800 Subject: [PATCH] enable default_mode ability to actually build --- udev.h | 1 + 1 file changed, 1 insertion(+) diff --git a/udev.h b/udev.h index 1a899bb40a..01db449481 100644 --- a/udev.h +++ b/udev.h @@ -90,5 +90,6 @@ extern char udev_db_filename[PATH_MAX+NAME_MAX]; extern char udev_permissions_filename[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; +extern char default_mode_str[NAME_MAX]; #endif -- cgit v1.2.3-54-g00ecf From 61219c756ad0ad622decaf81b92a558ba2a1bc59 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 18:33:58 -0800 Subject: [PATCH] fix permission handling logic Now we can handle wildcards properly within the permission file. --- namedev.c | 129 ++++++++++++++++++++++++-------------------------- namedev.h | 10 +++- namedev_parse.c | 57 ++++++++++++---------- test/udev.permissions | 2 +- 4 files changed, 103 insertions(+), 95 deletions(-) diff --git a/namedev.c b/namedev.c index f4c263f5bc..4e0476c6e3 100644 --- a/namedev.c +++ b/namedev.c @@ -39,6 +39,7 @@ #include "klibc_fixups.h" LIST_HEAD(config_device_list); +LIST_HEAD(perm_device_list); /* compare string with pattern (supports * ? [0-9] [!A-Z]) */ static int strcmp_pattern(const char *p, const char *s) @@ -113,7 +114,6 @@ int add_config_dev(struct config_device *new_dev) if (strncmp(dev->bus, new_dev->bus, sizeof(dev->name))) continue; copy_var(dev, new_dev, type); - copy_var(dev, new_dev, mode); copy_string(dev, new_dev, bus); copy_string(dev, new_dev, sysfs_file); copy_string(dev, new_dev, sysfs_value); @@ -121,8 +121,6 @@ int add_config_dev(struct config_device *new_dev) copy_string(dev, new_dev, place); copy_string(dev, new_dev, kernel_name); copy_string(dev, new_dev, exec_program); - copy_string(dev, new_dev, owner); - copy_string(dev, new_dev, group); return 0; } @@ -136,6 +134,46 @@ int add_config_dev(struct config_device *new_dev) return 0; } +int add_perm_dev(struct perm_device *new_dev) +{ + struct list_head *tmp; + struct perm_device *tmp_dev; + + /* update the values if we already have the device */ + list_for_each(tmp, &perm_device_list) { + struct perm_device *dev = list_entry(tmp, struct perm_device, node); + if (strcmp_pattern(new_dev->name, dev->name)) + continue; + copy_var(dev, new_dev, mode); + copy_string(dev, new_dev, owner); + copy_string(dev, new_dev, group); + return 0; + } + + /* not found, add new structure to the perm list */ + tmp_dev = malloc(sizeof(*tmp_dev)); + if (!tmp_dev) + return -ENOMEM; + memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); + list_add_tail(&tmp_dev->node, &perm_device_list); + //dump_perm_dev(tmp_dev); + return 0; +} + +static struct perm_device *find_perm(char *name) +{ + struct list_head *tmp; + struct perm_device *perm = NULL; + + list_for_each(tmp, &perm_device_list) { + perm = list_entry(tmp, struct perm_device, node); + if (strcmp_pattern(perm->name, name)) + continue; + return perm; + } + return NULL; +} + static mode_t get_default_mode(struct sysfs_class_device *class_dev) { mode_t mode = 0600; /* default to owner rw only */ @@ -328,15 +366,8 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev if (strcmp_pattern(dev->id, udev->callout_value) != 0) continue; strfieldcpy(udev->name, dev->name); - if (dev->mode != 0) { - udev->mode = dev->mode; - strfieldcpy(udev->owner, dev->owner); - strfieldcpy(udev->group, dev->group); - } - dbg("callout returned matching value '%s', '%s' becomes '%s'" - " - owner='%s', group='%s', mode=%#o", - dev->id, class_dev->name, udev->name, - dev->owner, dev->group, dev->mode); + dbg("callout returned matching value '%s', '%s' becomes '%s'", + dev->id, class_dev->name, udev->name); return 0; } return -ENODEV; @@ -382,15 +413,8 @@ label_found: continue; strfieldcpy(udev->name, dev->name); - if (dev->mode != 0) { - udev->mode = dev->mode; - strfieldcpy(udev->owner, dev->owner); - strfieldcpy(udev->group, dev->group); - } - dbg("found matching attribute '%s', '%s' becomes '%s' " - "- owner='%s', group='%s', mode=%#o", - dev->sysfs_file, class_dev->name, udev->name, - dev->owner, dev->group, dev->mode); + dbg("found matching attribute '%s', '%s' becomes '%s' ", + dev->sysfs_file, class_dev->name, udev->name); return 0; } @@ -434,15 +458,8 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, if (!found) continue; strfieldcpy(udev->name, dev->name); - if (dev->mode != 0) { - udev->mode = dev->mode; - strfieldcpy(udev->owner, dev->owner); - strfieldcpy(udev->group, dev->group); - } - dbg("found matching id '%s', '%s' becomes '%s'" - " - owner='%s', group ='%s', mode=%#o", - dev->id, class_dev->name, udev->name, - dev->owner, dev->group, dev->mode); + dbg("found matching id '%s', '%s' becomes '%s'", + dev->id, class_dev->name, udev->name); return 0; } return -ENODEV; @@ -486,15 +503,8 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude continue; strfieldcpy(udev->name, dev->name); - if (dev->mode != 0) { - udev->mode = dev->mode; - strfieldcpy(udev->owner, dev->owner); - strfieldcpy(udev->group, dev->group); - } - dbg("found matching place '%s', '%s' becomes '%s'" - " - owner='%s', group ='%s', mode=%#o", - dev->place, class_dev->name, udev->name, - dev->owner, dev->group, dev->mode); + dbg("found matching place '%s', '%s' becomes '%s'", + dev->place, class_dev->name, udev->name); return 0; } return -ENODEV; @@ -515,15 +525,7 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev continue; strfieldcpy(udev->name, dev->name); - if (dev->mode != 0) { - udev->mode = dev->mode; - strfieldcpy(udev->owner, dev->owner); - strfieldcpy(udev->group, dev->group); - } - dbg("found name, '%s' becomes '%s'" - " - owner='%s', group='%s', mode = %#o", - dev->kernel_name, udev->name, - dev->owner, dev->group, dev->mode); + dbg("found name, '%s' becomes '%s'", dev->kernel_name, udev->name); return 0; } @@ -532,24 +534,8 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice *udev) { - struct config_device *dev; - struct list_head *tmp; - int len; - + /* heh, this is pretty simple... */ strfieldcpy(udev->name, class_dev->name); - /* look for permissions */ - list_for_each(tmp, &config_device_list) { - dev = list_entry(tmp, struct config_device, node); - len = strlen(dev->name); - if (strcmp_pattern(dev->name, class_dev->name)) - continue; - if (dev->mode != 0) { - dbg("found permissions for '%s'", class_dev->name); - udev->mode = dev->mode; - strfieldcpy(udev->owner, dev->owner); - strfieldcpy(udev->group, dev->group); - } - } } int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) @@ -558,6 +544,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud struct sysfs_class_device *class_dev_parent = NULL; int retval = 0; char *temp = NULL; + struct perm_device *perm; udev->mode = 0; @@ -632,12 +619,19 @@ found: apply_format(udev, udev->name); done: - /* mode was never set above */ - if (!udev->mode) { + perm = find_perm(udev->name); + if (perm) { + udev->mode = perm->mode; + strfieldcpy(udev->owner, perm->owner); + strfieldcpy(udev->group, perm->group); + } else { + /* no matching perms found :( */ udev->mode = get_default_mode(class_dev); udev->owner[0] = 0x00; udev->group[0] = 0x00; } + dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", + udev->name, udev->owner, udev->group, udev->mode); if (class_dev_parent) sysfs_close_class_device(class_dev_parent); @@ -658,5 +652,6 @@ int namedev_init(void) return retval; dump_config_dev_list(); + dump_perm_dev_list(); return retval; } diff --git a/namedev.h b/namedev.h index 94fdf4ac91..f7b8a67667 100644 --- a/namedev.h +++ b/namedev.h @@ -62,8 +62,12 @@ struct config_device { char place[PLACE_SIZE]; char kernel_name[NAME_SIZE]; char exec_program[FILE_SIZE]; + char name[NAME_SIZE]; +}; + +struct perm_device { + struct list_head node; - /* what to set the device to */ char name[NAME_SIZE]; char owner[OWNER_SIZE]; char group[GROUP_SIZE]; @@ -71,6 +75,7 @@ struct config_device { }; extern struct list_head config_device_list; +extern struct list_head perm_device_list; extern int namedev_init(void); extern int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev); @@ -78,8 +83,11 @@ extern int namedev_init_permissions(void); extern int namedev_init_rules(void); extern int add_config_dev(struct config_device *new_dev); +extern int add_perm_dev(struct perm_device *new_dev); extern void dump_config_dev(struct config_device *dev); extern void dump_config_dev_list(void); +extern void dump_perm_dev(struct perm_device *dev); +extern void dump_perm_dev_list(void); extern int get_pair(char **orig_string, char **left, char **right); diff --git a/namedev_parse.c b/namedev_parse.c index a6a7d4b62e..5cb3a3eb1d 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -88,39 +88,27 @@ void dump_config_dev(struct config_device *dev) { switch (dev->type) { case KERNEL_NAME: - dbg_parse("KERNEL name='%s' ," - "owner='%s', group='%s', mode=%#o", - dev->name, dev->owner, dev->group, dev->mode); + dbg_parse("KERNEL name='%s'", dev->name); break; case LABEL: - dbg_parse("LABEL name='%s', bus='%s', sysfs_file='%s', sysfs_value='%s', " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value, - dev->owner, dev->group, dev->mode); + dbg_parse("LABEL name='%s', bus='%s', sysfs_file='%s', sysfs_value='%s'", + dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value); break; case NUMBER: - dbg_parse("NUMBER name='%s', bus='%s', id='%s', " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->bus, dev->id, - dev->owner, dev->group, dev->mode); + dbg_parse("NUMBER name='%s', bus='%s', id='%s'", + dev->name, dev->bus, dev->id); break; case TOPOLOGY: - dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s', " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->bus, dev->place, - dev->owner, dev->group, dev->mode); + dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s'", + dev->name, dev->bus, dev->place); break; case REPLACE: - dbg_parse("REPLACE name=%s, kernel_name=%s, " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->kernel_name, - dev->owner, dev->group, dev->mode); + dbg_parse("REPLACE name=%s, kernel_name=%s", + dev->name, dev->kernel_name); break; case CALLOUT: - dbg_parse("CALLOUT name='%s', bus='%s', program='%s', id='%s', " - "owner='%s', group='%s', mode=%#o", - dev->name, dev->bus, dev->exec_program, dev->id, - dev->owner, dev->group, dev->mode); + dbg_parse("CALLOUT name='%s', bus='%s', program='%s', id='%s'", + dev->name, dev->bus, dev->exec_program, dev->id); break; default: dbg_parse("unknown type of method"); @@ -136,7 +124,24 @@ void dump_config_dev_list(void) dump_config_dev(dev); } } - + +void dump_perm_dev(struct perm_device *dev) +{ + dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", + dev->name, dev->owner, dev->group, dev->mode); +} + +void dump_perm_dev_list(void) +{ + struct list_head *tmp; + + list_for_each(tmp, &perm_device_list) { + struct perm_device *dev = list_entry(tmp, struct perm_device, node); + dump_perm_dev(dev); + } +} + + int namedev_init_rules(void) { char line[255]; @@ -344,7 +349,7 @@ int namedev_init_permissions(void) char *temp2; FILE *fd; int retval = 0; - struct config_device dev; + struct perm_device dev; fd = fopen(udev_permissions_filename, "r"); if (fd != NULL) { @@ -407,7 +412,7 @@ int namedev_init_permissions(void) dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", dev.name, dev.owner, dev.group, dev.mode); - retval = add_config_dev(&dev); + retval = add_perm_dev(&dev); if (retval) { dbg("add_config_dev returned with error %d", retval); goto exit; diff --git a/test/udev.permissions b/test/udev.permissions index d14082ac05..44ef3d43e5 100644 --- a/test/udev.permissions +++ b/test/udev.permissions @@ -3,4 +3,4 @@ ttyUSB0:root:uucp:0660 ttyUSB1:root:uucp:0666 visor:500:500:0666 dsp1:::0666 - +boot_disk?:::0666 -- cgit v1.2.3-54-g00ecf From 07d7cfd1fa996ea7353410dc73c8a6ef98ff4e7e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 19:26:02 -0800 Subject: [PATCH] update the wildcard documentation in the man page to show the new styles supported. --- udev.8 | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/udev.8 b/udev.8 index fd1b6dd228..c6a9296255 100644 --- a/udev.8 +++ b/udev.8 @@ -199,11 +199,9 @@ or specified by the value in the .I /etc/udev/udev.conf file. -The file consists of a set of lines. All empty lines and -lines beginning with a '#' will be ignored. .br Every line lists a device name followed by owner, group and permission -mode. All values are separated by colons. The name field may end with a +mode. All values are separated by colons. The name field may contain a wildcard to apply the values to a whole class of devices. .br If @@ -221,6 +219,24 @@ ttyUSB1:0:8:0660 video*:root:video:0660 dsp1:::0666 .fi +.P +A number of different fields in the above configuration files support a simple +form of wildcard matching. This form is based on the fnmatch(3) style, and +supports the following fields: +.RS +.TP +.B * +Matches zero, one, or more characters. +.TP +.B ? +Matches any single character, but does not match zero characters. +.TP +.B [ ] +Matches any single character specified within the brackets. For example, the +pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also +supported within this match with the '-' character. For example, to match on +the range of all digits, the pattern [0-9] would be used. +.RE .SH "FILES" .nf .ft B -- cgit v1.2.3-54-g00ecf From fc1f0d43267be8bfc1a4afd79532e081921589e1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 19:27:24 -0800 Subject: [PATCH] Added Kay's name to the man page. --- udev.8 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev.8 b/udev.8 index c6a9296255..bac35b091d 100644 --- a/udev.8 +++ b/udev.8 @@ -255,4 +255,5 @@ web site. .SH AUTHORS .B udev was developed by Greg Kroah-Hartman with much help from -Dan Stekloff and many others. +Dan Stekloff , Kay Sievers , and +many others. -- cgit v1.2.3-54-g00ecf From 9c9fb5f6eb47794dc5516e5b3d162bdc3b4ec7da Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 21:45:20 -0800 Subject: [PATCH] fix some compiler warnings in the tdb code. --- tdb/tdb.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tdb/tdb.h b/tdb/tdb.h index e236b31af5..839d5b1516 100644 --- a/tdb/tdb.h +++ b/tdb/tdb.h @@ -136,6 +136,10 @@ int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key); void tdb_dump_all(TDB_CONTEXT *tdb); int tdb_printfreelist(TDB_CONTEXT *tdb); +/* used only in tdbutil.c */ +int tdb_chainlock_read(TDB_CONTEXT *tdb, TDB_DATA key); +int tdb_chainunlock_read(TDB_CONTEXT *tdb, TDB_DATA key); + extern TDB_DATA tdb_null; #ifdef __cplusplus -- cgit v1.2.3-54-g00ecf From a27170c49a777c132e0f0c81dda72c3c064ba4b7 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 21:51:37 -0800 Subject: [PATCH] fix up some duplicated function compiler warnings in libsysfs --- libsysfs/sysfs.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 3186c37a16..4ea4919351 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -32,12 +32,6 @@ #include #include -/* external library functions */ -extern int lstat(const char *file_name, struct stat *buf); -extern int readlink(const char *path, char *buf, size_t bufsize); -extern int getpagesize(void); -extern int isascii(int c); - /* Debugging */ #ifdef DEBUG #include -- cgit v1.2.3-54-g00ecf From 6ad5f7b40ddcf9786eaae8673e0ca1c40de8c46a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Dec 2003 21:57:12 -0800 Subject: [PATCH] update ChangeLog for v008 --- ChangeLog | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/ChangeLog b/ChangeLog index efaf86669a..ac06290775 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,73 @@ +Summary of changes from v007 to v008 +============================================ + +: + o more config file parsing robustness + +: + o udev-007/extras/multipath update + +Arnd Bergmann: + o Build failure - missing linux/limits.h include? + o Add format modifier for devfs like naming + o klibc makefile fixes + +Daniel E. F. Stekloff: + o another patch for path problem + o quick fix for libsysfs bus + o libsysfs changes for sysfsutils 0.3.0 + +Greg Kroah-Hartman: + o fix up some duplicated function compiler warnings in libsysfs + o fix some compiler warnings in the tdb code + o Added Kay's name to the man page + o update the wildcard documentation in the man page to show the new styles supported + o fix permission handling logic + o enable default_mode ability to actually build + o add support for the default_mode variable, as it is documented + o show permissions and groups in the label_test + o remove some items off of the TODO list, as they are now done + o fix up the tests to work without all of the environ variables + o get rid of the majority of the debug environment variables + o Update the man page to show the new config file, it's format, and how to use it + o fix up the tests to support the rules file name change + o add support for a main udev config file, udev.conf + o turn debugging messages off by default + o split out the namedev config parsing logic to namedev_parse.c + o rename namedev's get_attr() to be main namedev_name_device() as that's what it really is + o add devfs like tty rules as an example in the default config file + o operate on the rules in the order they are in the config file (within the rule type) instead of operating on them backwards. + o Cset exclude: dsteklof@us.ibm.com|ChangeSet|20031126173159|56255 + o add test for checking the BUS value + o fix problem where we were not looking at the BUS value + o add scsi and pci bus links in the test sysfs tree + o add test and documentation for new %D devfs format modifier + o changed the default location of the database to /udev/.udev.tdb to be LSB compliant + o get rid of functions in klibc_fixups that are now in klibc + o sync up with the 0.84 version of klibc + o fix udev init.d script to handle all class devices in sysfs + o fix the test.block and test.tty scripts due to their moveing. Also add a test.all script + o 007_bk version change to Makefile + +Kay Sievers: + o pattern matching for namedev + o catch replace device by wildcard + o udev.8 tweak numeric id text + o udev-test.pl add subdir test + o namedev.c strcat tweak + o overall whitespace + debug text conditioning + o udev-test.pl - tweaks + +Martin Hicks: + o Add -nodefaultlibs while compiling against klibc + +Olaf Hering: + o ARCH detection for ppc + +Patrick Mansfield: + o fix udev parallel builds with klibc + + Summary of changes from v006 to v007 ============================================ -- cgit v1.2.3-54-g00ecf From c9feb4d9f274614ef3600851fc5368cd01349960 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 4 Dec 2003 18:01:29 -0800 Subject: [PATCH] v008 release --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 98f2a1f434..5c66db4697 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = false ROOT = udev -VERSION = 007_bk +VERSION = 008 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 8cc424cacb..4833a20761 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 007_bk +Version: 008 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From da146a3e36a2ee8ca25729983e6a8bf91ae3fc17 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 4 Dec 2003 19:21:10 -0800 Subject: [PATCH] 008_bk mark --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5c66db4697..c6f322c880 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = false ROOT = udev -VERSION = 008 +VERSION = 008_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 4833a20761..a005b12dfa 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 008 +Version: 008_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 28d6536a0fff341bb3e307ad1abc30df57635f30 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 4 Dec 2003 19:21:27 -0800 Subject: [PATCH] a bug in linefeed removal While I was adding pattern match to the LABEL method i hit a bug. We modify a string returned from libsysfs, so with every iteration is is truncated by one char: Dec 4 02:27:16 pim udev[23307]: do_label: dev->bus='scsi' sysfs_device->bus='scsi' Dec 4 02:27:16 pim udev[23307]: do_label: look for device attribute 'vendor' Dec 4 02:27:16 pim udev[23307]: do_label: xxx 'IBM-ESXS ' Dec 4 02:27:16 pim udev[23307]: do_label: compare attribute 'vendor' value 'IBM-ESX' with '?IBM-ESXS' Dec 4 02:27:16 pim udev[23307]: do_label: dev->bus='scsi' sysfs_device->bus='scsi' Dec 4 02:27:16 pim udev[23307]: do_label: look for device attribute 'vendor' Dec 4 02:27:16 pim udev[23307]: do_label: xxx 'IBM-ESX' Dec 4 02:27:16 pim udev[23307]: do_label: compare attribute 'vendor' value 'IBM-ES' with 'IBM-ESXS?' Dec 4 02:27:16 pim udev[23307]: do_label: dev->bus='scsi' sysfs_device->bus='scsi' Dec 4 02:27:16 pim udev[23307]: do_label: look for device attribute 'vendor' Dec 4 02:27:16 pim udev[23307]: do_label: xxx 'IBM-ES' Dec 4 02:27:16 pim udev[23307]: do_label: compare attribute 'vendor' value 'IBM-E' with 'IBM-ES??' Dec 4 02:27:16 pim udev[23307]: do_label: dev->bus='scsi' sysfs_device->bus='scsi' Dec 4 02:27:16 pim udev[23307]: do_label: look for device attribute 'vendor' Dec 4 02:27:16 pim udev[23307]: do_label: xxx 'IBM-E' Dec 4 02:27:16 pim udev[23307]: do_label: compare attribute 'vendor' value 'IBM-' with 'IBM-ESXSS' I changed the behavior to remove only the line feed. 03-bug-in-linefeed-removal.diff remove only the line feed from string not every last char --- namedev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/namedev.c b/namedev.c index 4e0476c6e3..ea75bc5d8f 100644 --- a/namedev.c +++ b/namedev.c @@ -378,6 +378,7 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_attribute *tmpattr = NULL; struct config_device *dev; struct list_head *tmp; + char *c; list_for_each(tmp, &config_device_list) { dev = list_entry(tmp, struct config_device, node); @@ -406,7 +407,9 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, continue; label_found: - tmpattr->value[strlen(tmpattr->value)-1] = 0x00; + c = tmpattr->value + strlen(tmpattr->value)-1; + if (*c == '\n') + *c = 0x00; dbg("compare attribute '%s' value '%s' with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value); if (strcmp(dev->sysfs_value, tmpattr->value) != 0) @@ -578,7 +581,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } } } - + if (sysfs_device) { dbg("sysfs_device->path='%s'", sysfs_device->path); dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); @@ -642,7 +645,7 @@ done: int namedev_init(void) { int retval; - + retval = namedev_init_rules(); if (retval) return retval; -- cgit v1.2.3-54-g00ecf From 83be97ba211c4f69e7fd9f16f57ca7210a116a7d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 4 Dec 2003 19:21:31 -0800 Subject: [PATCH] pattern match for label method switch LABEL search to pattern match add a test for pattern match in LABEL remove useless rule from udev.rules --- namedev.c | 2 +- test/udev-test.pl | 12 ++++++++++++ udev.rules | 1 - 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index ea75bc5d8f..1faa253c1e 100644 --- a/namedev.c +++ b/namedev.c @@ -412,7 +412,7 @@ label_found: *c = 0x00; dbg("compare attribute '%s' value '%s' with '%s'", dev->sysfs_file, tmpattr->value, dev->sysfs_value); - if (strcmp(dev->sysfs_value, tmpattr->value) != 0) + if (strcmp_pattern(dev->sysfs_value, tmpattr->value) != 0) continue; strfieldcpy(udev->name, dev->name); diff --git a/test/udev-test.pl b/test/udev-test.pl index 97f75edc94..b1757ee1bb 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -49,6 +49,18 @@ EOF expected => "boot_disk1" , conf => < "label test of pattern match", + subsys => "block", + devpath => "block/sda/sda1", + expected => "boot_disk1" , + conf => < Date: Thu, 4 Dec 2003 19:22:53 -0800 Subject: [PATCH] man page beauty I've never seen any project where the documentation is in sync with the code at this early stage. Nice! So here is the patch to make it extra perfect :) remove random indent to be consistent style is "shell style" s/wildcard/pattern/ mention negation char in character class --- udev.8 | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/udev.8 b/udev.8 index bac35b091d..37b3b625e7 100644 --- a/udev.8 +++ b/udev.8 @@ -27,7 +27,9 @@ On device removal, .B udev queries the internal database for the name of the device file to be deleted. .SH "CONFIGURATION" -All udev configuration files consist of a set of lines of text. All empty +All +.B udev +configuration files consist of a set of lines of text. All empty lines, and lines beginning with a '#' will be ignored. .P @@ -96,11 +98,9 @@ device. If no matching configuration is found, the default kernel device name is used. .P The line format is: -.RS .sp .I method, key,[key,...] name .sp -.RE where valid methods with corresponding keys are: .TP .B CALLOUT @@ -130,22 +130,13 @@ string replacement of the kernel device name key: \fBKERNEL_NAME\fP .P The methods are applied in the following order: -.B CALLOUT -, -.B LABEL -, -.B NUMBER -, -.B TOPOLOGY -, -.B REPLACE +.BR CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "." .P The .B NAME and .B PROGRAM -fields support simple printf-like string subtitution: -.RS +fields support simple printf-like string substitution: .TP .B %n the "kernel number" of the device @@ -168,7 +159,6 @@ the CALLOUT program returned string Use the devfs style disk name for this device. For partitions, this will result in 'part%n' If this is not a partition, it will result in 'disk' -.RE .P A sample \fIudev.rules\fP might look like this: .sp @@ -202,7 +192,7 @@ file. .br Every line lists a device name followed by owner, group and permission mode. All values are separated by colons. The name field may contain a -wildcard to apply the values to a whole class of devices. +pattern to apply the values to a whole class of devices. .br If .B udev @@ -221,9 +211,7 @@ dsp1:::0666 .fi .P A number of different fields in the above configuration files support a simple -form of wildcard matching. This form is based on the fnmatch(3) style, and -supports the following fields: -.RS +form of shell style pattern matching. It supports the following pattern characters: .TP .B * Matches zero, one, or more characters. @@ -235,8 +223,8 @@ Matches any single character, but does not match zero characters. Matches any single character specified within the brackets. For example, the pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also supported within this match with the '-' character. For example, to match on -the range of all digits, the pattern [0-9] would be used. -.RE +the range of all digits, the pattern [0-9] would be used. If the first character +following the '[' is a '!' then any character not enclosed is matched. .SH "FILES" .nf .ft B -- cgit v1.2.3-54-g00ecf From 2bf80b67d1a64f1219bd366cee355e897596b2cf Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Sun, 7 Dec 2003 08:44:59 -0800 Subject: [PATCH] extras/multipath update here is the next update which brings this multipath to the state i'm not ashamed of it being in udev :) * drop a libdevmapper copy in extras/multipath; maybe discussions w/ Sistina folks will bring a better solution in the future. * drop a putchar usage in libdevmapper to compile cleanly with klibc * drop another such usage of my own in main.c * massage the Makefile to compile libdevmapper against klibc * use "ld" to produce the binary rather than "gcc -static" * stop being stupid w/ uneeded major, minor & dev in main.c:dm_mk_node() * reverse to creating striped target for now because the multipath target is more hairy than expected initialy * push the version code to 009 to be in synch w/ udev builds & run here. binary size is 43ko, which is fairly gratifying after all the efforts I've put to compiling it with klibc :) --- extras/multipath/Makefile | 26 +- extras/multipath/libdevmapper/Makefile | 15 + extras/multipath/libdevmapper/ioctl/libdevmapper.c | 1092 ++++++++++++++++++++ extras/multipath/libdevmapper/ioctl/libdm-compat.h | 111 ++ .../multipath/libdevmapper/ioctl/libdm-targets.h | 51 + extras/multipath/libdevmapper/libdevmapper.h | 147 +++ extras/multipath/libdevmapper/libdm-common.c | 382 +++++++ extras/multipath/libdevmapper/libdm-common.h | 38 + extras/multipath/libdevmapper/list.h | 99 ++ extras/multipath/main.c | 16 +- extras/multipath/main.h | 6 +- 11 files changed, 1965 insertions(+), 18 deletions(-) create mode 100644 extras/multipath/libdevmapper/Makefile create mode 100644 extras/multipath/libdevmapper/ioctl/libdevmapper.c create mode 100644 extras/multipath/libdevmapper/ioctl/libdm-compat.h create mode 100644 extras/multipath/libdevmapper/ioctl/libdm-targets.h create mode 100644 extras/multipath/libdevmapper/libdevmapper.h create mode 100644 extras/multipath/libdevmapper/libdm-common.c create mode 100644 extras/multipath/libdevmapper/libdm-common.h create mode 100644 extras/multipath/libdevmapper/list.h diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index 9e0ce124c6..bccf1264f0 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -13,17 +13,35 @@ CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc -I../../klibc LDFLAGS = -lsysfs -ldevmapper -ldlist OBJS = main.o - -all: $(EXEC) - strip $(EXEC) +CRT0 = ../../klibc/klibc/crt0.o +LIB = ../../klibc/klibc/libc.a +LIBGCC = /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/libgcc.a +DMOBJS = libdevmapper/libdm-common.o libdevmapper/ioctl/libdevmapper.o +SYSFSOBJS = ../../libsysfs/dlist.o ../../libsysfs/sysfs_bus.o \ + ../../libsysfs/sysfs_class.o ../../libsysfs/sysfs_device.o \ + ../../libsysfs/sysfs_dir.o ../../libsysfs/sysfs_driver.o \ + ../../libsysfs/sysfs_utils.o + +SUBDIRS = libdevmapper + +recurse: + @for dir in $(SUBDIRS); do\ + $(MAKE) -C $$dir ; \ + done + $(MAKE) $(EXEC) + +all: recurse @echo "" @echo "Make complete" + $(EXEC): $(OBJS) - $(CC) $(OBJS) -o $(EXEC) $(LDFLAGS) $(CFLAGS) + $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC) + strip $(EXEC) clean: rm -f core *.o $(EXEC) + $(MAKE) -C libdevmapper clean install: install -d $(bindir) diff --git a/extras/multipath/libdevmapper/Makefile b/extras/multipath/libdevmapper/Makefile new file mode 100644 index 0000000000..72b39cedf5 --- /dev/null +++ b/extras/multipath/libdevmapper/Makefile @@ -0,0 +1,15 @@ +# Makefile +# +# Copyright (C) 2003 Christophe Varoqui, + +CC = gcc +CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc -I../../../klibc/klibc/include -I../../../klibc/klibc/include/bits32 -I/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/include -I../../../klibc/linux/include -I. -Iioctl + +OBJS = ioctl/libdevmapper.o libdm-common.o + +all: $(OBJS) + @echo "" + @echo "Make complete" + +clean: + rm -f core *.o ioctl/*.o ioctl/*.so diff --git a/extras/multipath/libdevmapper/ioctl/libdevmapper.c b/extras/multipath/libdevmapper/ioctl/libdevmapper.c new file mode 100644 index 0000000000..ac7ba0c86a --- /dev/null +++ b/extras/multipath/libdevmapper/ioctl/libdevmapper.c @@ -0,0 +1,1092 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#include "libdm-targets.h" +#include "libdm-common.h" + +#ifdef DM_COMPAT +# include "libdm-compat.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef linux +# include +# include +# include +#else +# define MAJOR(x) major((x)) +# define MINOR(x) minor((x)) +# define MKDEV(x,y) makedev((x),(y)) +#endif + +/* + * Ensure build compatibility. + * The hard-coded versions here are the highest present + * in the _cmd_data arrays. + */ + +#if !((DM_VERSION_MAJOR == 1 && DM_VERSION_MINOR >= 0) || \ + (DM_VERSION_MAJOR == 4 && DM_VERSION_MINOR >= 0)) +#error The version of dm-ioctl.h included is incompatible. +#endif + +/* dm major version no for running kernel */ +static int _dm_version = DM_VERSION_MAJOR; +static int _log_suppress = 0; + +static int _control_fd = -1; +static int _version_checked = 0; +static int _version_ok = 1; + +/* + * Support both old and new major numbers to ease the transition. + * Clumsy, but only temporary. + */ +#if DM_VERSION_MAJOR == 4 && defined(DM_COMPAT) +const int _dm_compat = 1; +#else +const int _dm_compat = 0; +#endif + + +/* *INDENT-OFF* */ +static struct cmd_data _cmd_data_v4[] = { + {"create", DM_DEV_CREATE, {4, 0, 0}}, + {"reload", DM_TABLE_LOAD, {4, 0, 0}}, + {"remove", DM_DEV_REMOVE, {4, 0, 0}}, + {"remove_all", DM_REMOVE_ALL, {4, 0, 0}}, + {"suspend", DM_DEV_SUSPEND, {4, 0, 0}}, + {"resume", DM_DEV_SUSPEND, {4, 0, 0}}, + {"info", DM_DEV_STATUS, {4, 0, 0}}, + {"deps", DM_TABLE_DEPS, {4, 0, 0}}, + {"rename", DM_DEV_RENAME, {4, 0, 0}}, + {"version", DM_VERSION, {4, 0, 0}}, + {"status", DM_TABLE_STATUS, {4, 0, 0}}, + {"table", DM_TABLE_STATUS, {4, 0, 0}}, + {"waitevent", DM_DEV_WAIT, {4, 0, 0}}, + {"names", DM_LIST_DEVICES, {4, 0, 0}}, + {"clear", DM_TABLE_CLEAR, {4, 0, 0}}, + {"mknodes", DM_DEV_STATUS, {4, 0, 0}}, +}; +/* *INDENT-ON* */ + +#define ALIGNMENT_V1 sizeof(int) +#define ALIGNMENT 8 + +/* FIXME Rejig library to record & use errno instead */ +#ifndef DM_EXISTS_FLAG +# define DM_EXISTS_FLAG 0x00000004 +#endif + +static void *_align(void *ptr, unsigned int a) +{ + register unsigned long agn = --a; + + return (void *) (((unsigned long) ptr + agn) & ~agn); +} + +static int _open_control(void) +{ + char control[PATH_MAX]; + + if (_control_fd != -1) + return 1; + + snprintf(control, sizeof(control), "%s/control", dm_dir()); + + if ((_control_fd = open(control, O_RDWR)) < 0) { + log_error("%s: open failed: %s", control, strerror(errno)); + log_error("Is device-mapper driver missing from kernel?"); + return 0; + } + + return 1; +} + +void dm_task_destroy(struct dm_task *dmt) +{ + struct target *t, *n; + + for (t = dmt->head; t; t = n) { + n = t->next; + free(t->params); + free(t->type); + free(t); + } + + if (dmt->dev_name) + free(dmt->dev_name); + + if (dmt->newname) + free(dmt->newname); + + if (dmt->dmi.v4) + free(dmt->dmi.v4); + + if (dmt->uuid) + free(dmt->uuid); + + free(dmt); +} + +/* + * Protocol Version 1 compatibility functions. + */ + +#ifdef DM_COMPAT + +static int _dm_task_get_driver_version_v1(struct dm_task *dmt, char *version, + size_t size) +{ + unsigned int *v; + + if (!dmt->dmi.v1) { + version[0] = '\0'; + return 0; + } + + v = dmt->dmi.v1->version; + snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]); + return 1; +} + +/* Unmarshall the target info returned from a status call */ +static int _unmarshal_status_v1(struct dm_task *dmt, struct dm_ioctl_v1 *dmi) +{ + char *outbuf = (char *) dmi + dmi->data_start; + char *outptr = outbuf; + int32_t i; + struct dm_target_spec_v1 *spec; + + for (i = 0; i < dmi->target_count; i++) { + spec = (struct dm_target_spec_v1 *) outptr; + + if (!dm_task_add_target(dmt, spec->sector_start, + (uint64_t) spec->length, + spec->target_type, + outptr + sizeof(*spec))) + return 0; + + outptr = outbuf + spec->next; + } + + return 1; +} + +static int _dm_format_dev_v1(char *buf, int bufsize, uint32_t dev_major, + uint32_t dev_minor) +{ + int r; + + if (bufsize < 8) + return 0; + + r = snprintf(buf, bufsize, "%03x:%03x", dev_major, dev_minor); + if (r < 0 || r > bufsize - 1) + return 0; + + return 1; +} + +static int _dm_task_get_info_v1(struct dm_task *dmt, struct dm_info *info) +{ + if (!dmt->dmi.v1) + return 0; + + memset(info, 0, sizeof(*info)); + + info->exists = dmt->dmi.v1->flags & DM_EXISTS_FLAG ? 1 : 0; + if (!info->exists) + return 1; + + info->suspended = dmt->dmi.v1->flags & DM_SUSPEND_FLAG ? 1 : 0; + info->read_only = dmt->dmi.v1->flags & DM_READONLY_FLAG ? 1 : 0; + info->target_count = dmt->dmi.v1->target_count; + info->open_count = dmt->dmi.v1->open_count; + info->event_nr = 0; + info->major = MAJOR(dmt->dmi.v1->dev); + info->minor = MINOR(dmt->dmi.v1->dev); + info->live_table = 1; + info->inactive_table = 0; + + return 1; +} + +static const char *_dm_task_get_name_v1(struct dm_task *dmt) +{ + return (dmt->dmi.v1->name); +} + +static const char *_dm_task_get_uuid_v1(struct dm_task *dmt) +{ + return (dmt->dmi.v1->uuid); +} + +static struct dm_deps *_dm_task_get_deps_v1(struct dm_task *dmt) +{ + log_error("deps version 1 no longer supported by libdevmapper"); + return NULL; +} + +static struct dm_names *_dm_task_get_names_v1(struct dm_task *dmt) +{ + return (struct dm_names *) (((void *) dmt->dmi.v1) + + dmt->dmi.v1->data_start); +} + +static void *_add_target_v1(struct target *t, void *out, void *end) +{ + void *out_sp = out; + struct dm_target_spec_v1 sp; + size_t sp_size = sizeof(struct dm_target_spec_v1); + int len; + const char no_space[] = "Ran out of memory building ioctl parameter"; + + out += sp_size; + if (out >= end) { + log_error(no_space); + return NULL; + } + + sp.status = 0; + sp.sector_start = t->start; + sp.length = t->length; + strncpy(sp.target_type, t->type, sizeof(sp.target_type)); + + len = strlen(t->params); + + if ((out + len + 1) >= end) { + log_error(no_space); + + log_error("t->params= '%s'", t->params); + return NULL; + } + strcpy((char *) out, t->params); + out += len + 1; + + /* align next block */ + out = _align(out, ALIGNMENT_V1); + + sp.next = out - out_sp; + + memcpy(out_sp, &sp, sp_size); + + return out; +} + +static struct dm_ioctl_v1 *_flatten_v1(struct dm_task *dmt) +{ + const size_t min_size = 16 * 1024; + const int (*version)[3]; + + struct dm_ioctl_v1 *dmi; + struct target *t; + size_t len = sizeof(struct dm_ioctl_v1); + void *b, *e; + int count = 0; + + for (t = dmt->head; t; t = t->next) { + len += sizeof(struct dm_target_spec_v1); + len += strlen(t->params) + 1 + ALIGNMENT_V1; + count++; + } + + if (count && dmt->newname) { + log_error("targets and newname are incompatible"); + return NULL; + } + + if (dmt->newname) + len += strlen(dmt->newname) + 1; + + /* + * Give len a minimum size so that we have space to store + * dependencies or status information. + */ + if (len < min_size) + len = min_size; + + if (!(dmi = malloc(len))) + return NULL; + + memset(dmi, 0, len); + + version = &_cmd_data_v1[dmt->type].version; + + dmi->version[0] = (*version)[0]; + dmi->version[1] = (*version)[1]; + dmi->version[2] = (*version)[2]; + + dmi->data_size = len; + dmi->data_start = sizeof(struct dm_ioctl_v1); + + if (dmt->dev_name) + strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); + + if (dmt->type == DM_DEVICE_SUSPEND) + dmi->flags |= DM_SUSPEND_FLAG; + if (dmt->read_only) + dmi->flags |= DM_READONLY_FLAG; + + if (dmt->minor >= 0) { + if (dmt->major <= 0) { + log_error("Missing major number for persistent device"); + return NULL; + } + dmi->flags |= DM_PERSISTENT_DEV_FLAG; + dmi->dev = MKDEV(dmt->major, dmt->minor); + } + + if (dmt->uuid) + strncpy(dmi->uuid, dmt->uuid, sizeof(dmi->uuid)); + + dmi->target_count = count; + + b = (void *) (dmi + 1); + e = (void *) ((char *) dmi + len); + + for (t = dmt->head; t; t = t->next) + if (!(b = _add_target_v1(t, b, e))) + goto bad; + + if (dmt->newname) + strcpy(b, dmt->newname); + + return dmi; + + bad: + free(dmi); + return NULL; +} + +static int _dm_names_v1(struct dm_ioctl_v1 *dmi) +{ + const char *dev_dir = dm_dir(); + int r = 1, len; + const char *name; + struct dirent *dirent; + DIR *d; + struct dm_names *names, *old_names = NULL; + void *end = (void *) dmi + dmi->data_size; + struct stat buf; + char path[PATH_MAX]; + + if (!(d = opendir(dev_dir))) { + log_error("%s: opendir failed: %s", dev_dir, strerror(errno)); + return 0; + } + + names = (struct dm_names *) ((void *) dmi + dmi->data_start); + + names->dev = 0; /* Flags no data */ + + while ((dirent = readdir(d))) { + name = dirent->d_name; + + if (name[0] == '.' || !strcmp(name, "control")) + continue; + + if (old_names) + old_names->next = (uint32_t) ((void *) names - + (void *) old_names); + snprintf(path, sizeof(path), "%s/%s", dev_dir, name); + if (stat(path, &buf)) { + log_error("%s: stat failed: %s", path, strerror(errno)); + continue; + } + if (!S_ISBLK(buf.st_mode)) + continue; + names->dev = (uint64_t) buf.st_rdev; + names->next = 0; + len = strlen(name); + if (((void *) (names + 1) + len + 1) >= end) { + log_error("Insufficient buffer space for device list"); + r = 0; + break; + } + + strcpy(names->name, name); + + old_names = names; + names = _align((void *) ++names + len + 1, ALIGNMENT); + } + + if (closedir(d)) + log_error("%s: closedir failed: %s", dev_dir, strerror(errno)); + + return r; +} + +static int _dm_task_run_v1(struct dm_task *dmt) +{ + struct dm_ioctl_v1 *dmi; + unsigned int command; + + dmi = _flatten_v1(dmt); + if (!dmi) { + log_error("Couldn't create ioctl argument"); + return 0; + } + + if (!_open_control()) + return 0; + + if ((unsigned) dmt->type >= + (sizeof(_cmd_data_v1) / sizeof(*_cmd_data_v1))) { + log_error("Internal error: unknown device-mapper task %d", + dmt->type); + goto bad; + } + + command = _cmd_data_v1[dmt->type].cmd; + + if (dmt->type == DM_DEVICE_TABLE) + dmi->flags |= DM_STATUS_TABLE_FLAG; + + log_debug("dm %s %s %s %s", _cmd_data_v1[dmt->type].name, dmi->name, + dmi->uuid, dmt->newname ? dmt->newname : ""); + if (dmt->type == DM_DEVICE_LIST) { + if (!_dm_names_v1(dmi)) + goto bad; + } else if (ioctl(_control_fd, command, dmi) < 0) { + if (_log_suppress) + log_verbose("device-mapper ioctl cmd %d failed: %s", + _IOC_NR(command), strerror(errno)); + else + log_error("device-mapper ioctl cmd %d failed: %s", + _IOC_NR(command), strerror(errno)); + goto bad; + } + + switch (dmt->type) { + case DM_DEVICE_CREATE: + add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev)); + break; + + case DM_DEVICE_REMOVE: + rm_dev_node(dmt->dev_name); + break; + + case DM_DEVICE_RENAME: + rename_dev_node(dmt->dev_name, dmt->newname); + break; + + case DM_DEVICE_MKNODES: + if (dmi->flags & DM_EXISTS_FLAG) + add_dev_node(dmt->dev_name, MAJOR(dmi->dev), + MINOR(dmi->dev)); + else + rm_dev_node(dmt->dev_name); + break; + + case DM_DEVICE_STATUS: + case DM_DEVICE_TABLE: + if (!_unmarshal_status_v1(dmt, dmi)) + goto bad; + break; + + case DM_DEVICE_SUSPEND: + case DM_DEVICE_RESUME: + dmt->type = DM_DEVICE_INFO; + if (!dm_task_run(dmt)) + goto bad; + free(dmi); /* We'll use what info returned */ + return 1; + } + + dmt->dmi.v1 = dmi; + return 1; + + bad: + free(dmi); + return 0; +} + +#endif + +/* + * Protocol Version 4 functions. + */ + +int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size) +{ + unsigned int *v; + +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_driver_version_v1(dmt, version, size); +#endif + + if (!dmt->dmi.v4) { + version[0] = '\0'; + return 0; + } + + v = dmt->dmi.v4->version; + snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]); + return 1; +} + +static int _check_version(char *version, size_t size, int log_suppress) +{ + struct dm_task *task; + int r; + + if (!(task = dm_task_create(DM_DEVICE_VERSION))) { + log_error("Failed to get device-mapper version"); + version[0] = '\0'; + return 0; + } + + if (log_suppress) + _log_suppress = 1; + + r = dm_task_run(task); + dm_task_get_driver_version(task, version, size); + dm_task_destroy(task); + _log_suppress = 0; + + return r; +} + +/* + * Find out device-mapper's major version number the first time + * this is called and whether or not we support it. + */ +int dm_check_version(void) +{ + char libversion[64], dmversion[64]; + const char *compat = ""; + + if (_version_checked) + return _version_ok; + + _version_checked = 1; + + if (_check_version(dmversion, sizeof(dmversion), _dm_compat)) + return 1; + + if (!_dm_compat) + goto bad; + + log_verbose("device-mapper ioctl protocol version %d failed. " + "Trying protocol version 1.", _dm_version); + _dm_version = 1; + if (_check_version(dmversion, sizeof(dmversion), 0)) { + log_verbose("Using device-mapper ioctl protocol version 1"); + return 1; + } + + compat = "(compat)"; + + dm_get_library_version(libversion, sizeof(libversion)); + + log_error("Incompatible libdevmapper %s%s and kernel driver %s", + libversion, compat, dmversion); + + bad: + _version_ok = 0; + return 0; +} + +void *dm_get_next_target(struct dm_task *dmt, void *next, + uint64_t *start, uint64_t *length, + char **target_type, char **params) +{ + struct target *t = (struct target *) next; + + if (!t) + t = dmt->head; + + if (!t) + return NULL; + + *start = t->start; + *length = t->length; + *target_type = t->type; + *params = t->params; + + return t->next; +} + +/* Unmarshall the target info returned from a status call */ +static int _unmarshal_status(struct dm_task *dmt, struct dm_ioctl *dmi) +{ + char *outbuf = (char *) dmi + dmi->data_start; + char *outptr = outbuf; + uint32_t i; + struct dm_target_spec *spec; + + for (i = 0; i < dmi->target_count; i++) { + spec = (struct dm_target_spec *) outptr; + if (!dm_task_add_target(dmt, spec->sector_start, + spec->length, + spec->target_type, + outptr + sizeof(*spec))) + return 0; + + outptr = outbuf + spec->next; + } + + return 1; +} + +int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, + uint32_t dev_minor) +{ + int r; + +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_format_dev_v1(buf, bufsize, dev_major, dev_minor); +#endif + + if (bufsize < 8) + return 0; + + r = snprintf(buf, bufsize, "%03u:%03u", dev_major, dev_minor); + if (r < 0 || r > bufsize - 1) + return 0; + + return 1; +} + +int dm_task_get_info(struct dm_task *dmt, struct dm_info *info) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_info_v1(dmt, info); +#endif + + if (!dmt->dmi.v4) + return 0; + + memset(info, 0, sizeof(*info)); + + info->exists = dmt->dmi.v4->flags & DM_EXISTS_FLAG ? 1 : 0; + if (!info->exists) + return 1; + + info->suspended = dmt->dmi.v4->flags & DM_SUSPEND_FLAG ? 1 : 0; + info->read_only = dmt->dmi.v4->flags & DM_READONLY_FLAG ? 1 : 0; + info->live_table = dmt->dmi.v4->flags & DM_ACTIVE_PRESENT_FLAG ? 1 : 0; + info->inactive_table = dmt->dmi.v4->flags & DM_INACTIVE_PRESENT_FLAG ? + 1 : 0; + info->target_count = dmt->dmi.v4->target_count; + info->open_count = dmt->dmi.v4->open_count; + info->event_nr = dmt->dmi.v4->event_nr; + info->major = MAJOR(dmt->dmi.v4->dev); + info->minor = MINOR(dmt->dmi.v4->dev); + + return 1; +} + +const char *dm_task_get_name(struct dm_task *dmt) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_name_v1(dmt); +#endif + + return (dmt->dmi.v4->name); +} + +const char *dm_task_get_uuid(struct dm_task *dmt) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_uuid_v1(dmt); +#endif + + return (dmt->dmi.v4->uuid); +} + +struct dm_deps *dm_task_get_deps(struct dm_task *dmt) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_deps_v1(dmt); +#endif + + return (struct dm_deps *) (((void *) dmt->dmi.v4) + + dmt->dmi.v4->data_start); +} + +struct dm_names *dm_task_get_names(struct dm_task *dmt) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_names_v1(dmt); +#endif + + return (struct dm_names *) (((void *) dmt->dmi.v4) + + dmt->dmi.v4->data_start); +} + +int dm_task_set_ro(struct dm_task *dmt) +{ + dmt->read_only = 1; + return 1; +} + +int dm_task_set_newname(struct dm_task *dmt, const char *newname) +{ + if (!(dmt->newname = strdup(newname))) { + log_error("dm_task_set_newname: strdup(%s) failed", newname); + return 0; + } + + return 1; +} + +int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr) +{ + dmt->event_nr = event_nr; + + return 1; +} + +struct target *create_target(uint64_t start, uint64_t len, const char *type, + const char *params) +{ + struct target *t = malloc(sizeof(*t)); + + if (!t) { + log_error("create_target: malloc(%d) failed", sizeof(*t)); + return NULL; + } + + memset(t, 0, sizeof(*t)); + + if (!(t->params = strdup(params))) { + log_error("create_target: strdup(params) failed"); + goto bad; + } + + if (!(t->type = strdup(type))) { + log_error("create_target: strdup(type) failed"); + goto bad; + } + + t->start = start; + t->length = len; + return t; + + bad: + free(t->params); + free(t->type); + free(t); + return NULL; +} + +static void *_add_target(struct target *t, void *out, void *end) +{ + void *out_sp = out; + struct dm_target_spec sp; + size_t sp_size = sizeof(struct dm_target_spec); + int len; + const char no_space[] = "Ran out of memory building ioctl parameter"; + + out += sp_size; + if (out >= end) { + log_error(no_space); + return NULL; + } + + sp.status = 0; + sp.sector_start = t->start; + sp.length = t->length; + strncpy(sp.target_type, t->type, sizeof(sp.target_type)); + + len = strlen(t->params); + + if ((out + len + 1) >= end) { + log_error(no_space); + + log_error("t->params= '%s'", t->params); + return NULL; + } + strcpy((char *) out, t->params); + out += len + 1; + + /* align next block */ + out = _align(out, ALIGNMENT); + + sp.next = out - out_sp; + memcpy(out_sp, &sp, sp_size); + + return out; +} + +static struct dm_ioctl *_flatten(struct dm_task *dmt) +{ + const size_t min_size = 16 * 1024; + const int (*version)[3]; + + struct dm_ioctl *dmi; + struct target *t; + size_t len = sizeof(struct dm_ioctl); + void *b, *e; + int count = 0; + + for (t = dmt->head; t; t = t->next) { + len += sizeof(struct dm_target_spec); + len += strlen(t->params) + 1 + ALIGNMENT; + count++; + } + + if (count && dmt->newname) { + log_error("targets and newname are incompatible"); + return NULL; + } + + if (dmt->newname) + len += strlen(dmt->newname) + 1; + + /* + * Give len a minimum size so that we have space to store + * dependencies or status information. + */ + if (len < min_size) + len = min_size; + + if (!(dmi = malloc(len))) + return NULL; + + memset(dmi, 0, len); + + version = &_cmd_data_v4[dmt->type].version; + + dmi->version[0] = (*version)[0]; + dmi->version[1] = (*version)[1]; + dmi->version[2] = (*version)[2]; + + dmi->data_size = len; + dmi->data_start = sizeof(struct dm_ioctl); + + if (dmt->dev_name) + strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); + + if (dmt->type == DM_DEVICE_SUSPEND) + dmi->flags |= DM_SUSPEND_FLAG; + if (dmt->read_only) + dmi->flags |= DM_READONLY_FLAG; + + if (dmt->minor >= 0) { + if (dmt->major <= 0) { + log_error("Missing major number for persistent device"); + return NULL; + } + dmi->flags |= DM_PERSISTENT_DEV_FLAG; + dmi->dev = MKDEV(dmt->major, dmt->minor); + } + + if (dmt->uuid) + strncpy(dmi->uuid, dmt->uuid, sizeof(dmi->uuid)); + + dmi->target_count = count; + dmi->event_nr = dmt->event_nr; + + b = (void *) (dmi + 1); + e = (void *) ((char *) dmi + len); + + for (t = dmt->head; t; t = t->next) + if (!(b = _add_target(t, b, e))) + goto bad; + + if (dmt->newname) + strcpy(b, dmt->newname); + + return dmi; + + bad: + free(dmi); + return NULL; +} + +static int _create_and_load_v4(struct dm_task *dmt) +{ + struct dm_task *task; + int r; + + /* Use new task struct to create the device */ + if (!(task = dm_task_create(DM_DEVICE_CREATE))) { + log_error("Failed to create device-mapper task struct"); + return 0; + } + + /* Copy across relevant fields */ + if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { + dm_task_destroy(task); + return 0; + } + + if (dmt->uuid && !dm_task_set_uuid(task, dmt->uuid)) { + dm_task_destroy(task); + return 0; + } + + task->major = dmt->major; + task->minor = dmt->minor; + + r = dm_task_run(task); + dm_task_destroy(task); + if (!r) + return r; + + /* Next load the table */ + if (!(task = dm_task_create(DM_DEVICE_RELOAD))) { + log_error("Failed to create device-mapper task struct"); + return 0; + } + + /* Copy across relevant fields */ + if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { + dm_task_destroy(task); + return 0; + } + + task->read_only = dmt->read_only; + task->head = dmt->head; + task->tail = dmt->tail; + + r = dm_task_run(task); + + task->head = NULL; + task->tail = NULL; + dm_task_destroy(task); + if (!r) + return r; + + /* Use the original structure last so the info will be correct */ + dmt->type = DM_DEVICE_RESUME; + dmt->uuid = NULL; + free(dmt->uuid); + + r = dm_task_run(dmt); + + return r; +} + +int dm_task_run(struct dm_task *dmt) +{ + struct dm_ioctl *dmi = NULL; + unsigned int command; + +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_run_v1(dmt); +#endif + + if ((unsigned) dmt->type >= + (sizeof(_cmd_data_v4) / sizeof(*_cmd_data_v4))) { + log_error("Internal error: unknown device-mapper task %d", + dmt->type); + goto bad; + } + + command = _cmd_data_v4[dmt->type].cmd; + + /* Old-style creation had a table supplied */ + if (dmt->type == DM_DEVICE_CREATE && dmt->head) + return _create_and_load_v4(dmt); + + if (!_open_control()) + return 0; + + dmi = _flatten(dmt); + if (!dmi) { + log_error("Couldn't create ioctl argument"); + return 0; + } + + if (dmt->type == DM_DEVICE_TABLE) + dmi->flags |= DM_STATUS_TABLE_FLAG; + + dmi->flags |= DM_EXISTS_FLAG; /* FIXME */ + log_debug("dm %s %s %s %s", _cmd_data_v4[dmt->type].name, dmi->name, + dmi->uuid, dmt->newname ? dmt->newname : ""); + if (ioctl(_control_fd, command, dmi) < 0) { + if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) || + (dmt->type == DM_DEVICE_MKNODES))) { + dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */ + goto ignore_error; + } + if (_log_suppress) + log_verbose("device-mapper ioctl cmd %d failed: %s", + _IOC_NR(command), strerror(errno)); + else + log_error("device-mapper ioctl cmd %d failed: %s", + _IOC_NR(command), strerror(errno)); + goto bad; + } + + ignore_error: + switch (dmt->type) { + case DM_DEVICE_CREATE: + add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev)); + break; + + case DM_DEVICE_REMOVE: + rm_dev_node(dmt->dev_name); + break; + + case DM_DEVICE_RENAME: + rename_dev_node(dmt->dev_name, dmt->newname); + break; + + case DM_DEVICE_MKNODES: + if (dmi->flags & DM_EXISTS_FLAG) + add_dev_node(dmt->dev_name, MAJOR(dmi->dev), + MINOR(dmi->dev)); + else + rm_dev_node(dmt->dev_name); + break; + + case DM_DEVICE_STATUS: + case DM_DEVICE_TABLE: + case DM_DEVICE_WAITEVENT: + if (!_unmarshal_status(dmt, dmi)) + goto bad; + break; + } + + dmt->dmi.v4 = dmi; + return 1; + + bad: + free(dmi); + return 0; +} + +void dm_lib_release(void) +{ + if (_control_fd != -1) { + close(_control_fd); + _control_fd = -1; + } + update_devs(); +} + +void dm_lib_exit(void) +{ + if (_control_fd != -1) { + close(_control_fd); + _control_fd = -1; + } + _version_ok = 1; + _version_checked = 0; +} diff --git a/extras/multipath/libdevmapper/ioctl/libdm-compat.h b/extras/multipath/libdevmapper/ioctl/libdm-compat.h new file mode 100644 index 0000000000..af7a9f1f71 --- /dev/null +++ b/extras/multipath/libdevmapper/ioctl/libdm-compat.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#ifndef _LINUX_LIBDM_COMPAT_H +#define _LINUX_LIBDM_COMPAT_H + +#include +#include +#include +#include + +struct dm_task; +struct dm_info; + +/* + * Old versions of structures for backwards compatibility. + */ + +struct dm_ioctl_v1 { + uint32_t version[3]; /* in/out */ + uint32_t data_size; /* total size of data passed in + * including this struct */ + + uint32_t data_start; /* offset to start of data + * relative to start of this struct */ + + int32_t target_count; /* in/out */ + int32_t open_count; /* out */ + uint32_t flags; /* in/out */ + + __kernel_dev_t dev; /* in/out */ + + char name[DM_NAME_LEN]; /* device name */ + char uuid[DM_UUID_LEN]; /* unique identifier for + * the block device */ +}; + +struct dm_target_spec_v1 { + int32_t status; /* used when reading from kernel only */ + uint64_t sector_start; + uint32_t length; + uint32_t next; + + char target_type[DM_MAX_TYPE_NAME]; + +}; + +struct dm_target_deps_v1 { + uint32_t count; + + __kernel_dev_t dev[0]; /* out */ +}; + +enum { + /* Top level cmds */ + DM_VERSION_CMD_V1 = 0, + DM_REMOVE_ALL_CMD_V1, + + /* device level cmds */ + DM_DEV_CREATE_CMD_V1, + DM_DEV_REMOVE_CMD_V1, + DM_DEV_RELOAD_CMD_V1, + DM_DEV_RENAME_CMD_V1, + DM_DEV_SUSPEND_CMD_V1, + DM_DEV_DEPS_CMD_V1, + DM_DEV_STATUS_CMD_V1, + + /* target level cmds */ + DM_TARGET_STATUS_CMD_V1, + DM_TARGET_WAIT_CMD_V1, +}; + +#define DM_VERSION_V1 _IOWR(DM_IOCTL, DM_VERSION_CMD_V1, struct dm_ioctl) +#define DM_REMOVE_ALL_V1 _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD_V1, struct dm_ioctl) + +#define DM_DEV_CREATE_V1 _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD_V1, struct dm_ioctl) +#define DM_DEV_REMOVE_V1 _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD_V1, struct dm_ioctl) +#define DM_DEV_RELOAD_V1 _IOWR(DM_IOCTL, DM_DEV_RELOAD_CMD_V1, struct dm_ioctl) +#define DM_DEV_SUSPEND_V1 _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD_V1, struct dm_ioctl) +#define DM_DEV_RENAME_V1 _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD_V1, struct dm_ioctl) +#define DM_DEV_DEPS_V1 _IOWR(DM_IOCTL, DM_DEV_DEPS_CMD_V1, struct dm_ioctl) +#define DM_DEV_STATUS_V1 _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD_V1, struct dm_ioctl) + +#define DM_TARGET_STATUS_V1 _IOWR(DM_IOCTL, DM_TARGET_STATUS_CMD_V1, struct dm_ioctl) +#define DM_TARGET_WAIT_V1 _IOWR(DM_IOCTL, DM_TARGET_WAIT_CMD_V1, struct dm_ioctl) + +/* *INDENT-OFF* */ +static struct cmd_data _cmd_data_v1[] = { + { "create", DM_DEV_CREATE_V1, {1, 0, 0} }, + { "reload", DM_DEV_RELOAD_V1, {1, 0, 0} }, + { "remove", DM_DEV_REMOVE_V1, {1, 0, 0} }, + { "remove_all", DM_REMOVE_ALL_V1, {1, 0, 0} }, + { "suspend", DM_DEV_SUSPEND_V1, {1, 0, 0} }, + { "resume", DM_DEV_SUSPEND_V1, {1, 0, 0} }, + { "info", DM_DEV_STATUS_V1, {1, 0, 0} }, + { "deps", DM_DEV_DEPS_V1, {1, 0, 0} }, + { "rename", DM_DEV_RENAME_V1, {1, 0, 0} }, + { "version", DM_VERSION_V1, {1, 0, 0} }, + { "status", DM_TARGET_STATUS_V1, {1, 0, 0} }, + { "table", DM_TARGET_STATUS_V1, {1, 0, 0} }, + { "waitevent", DM_TARGET_WAIT_V1, {1, 0, 0} }, + { "names", 0, {4, 0, 0} }, + { "clear", 0, {4, 0, 0} }, + { "mknodes", 0, {4, 0, 0} }, +}; +/* *INDENT-ON* */ + +#endif diff --git a/extras/multipath/libdevmapper/ioctl/libdm-targets.h b/extras/multipath/libdevmapper/ioctl/libdm-targets.h new file mode 100644 index 0000000000..a8c0e20547 --- /dev/null +++ b/extras/multipath/libdevmapper/ioctl/libdm-targets.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#ifndef LIB_DMTARGETS_H +#define LIB_DMTARGETS_H + +#include + +struct dm_ioctl; +struct dm_ioctl_v1; + +struct target { + uint64_t start; + uint64_t length; + char *type; + char *params; + + struct target *next; +}; + +struct dm_task { + int type; + char *dev_name; + + struct target *head, *tail; + + int read_only; + uint32_t event_nr; + int major; + int minor; + union { + struct dm_ioctl *v4; + struct dm_ioctl_v1 *v1; + } dmi; + char *newname; + + char *uuid; +}; + +struct cmd_data { + const char *name; + const int cmd; + const int version[3]; +}; + +int dm_check_version(void); + +#endif diff --git a/extras/multipath/libdevmapper/libdevmapper.h b/extras/multipath/libdevmapper/libdevmapper.h new file mode 100644 index 0000000000..6549af3641 --- /dev/null +++ b/extras/multipath/libdevmapper/libdevmapper.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#ifndef LIB_DEVICE_MAPPER_H +#define LIB_DEVICE_MAPPER_H + +#include +#include + +#ifdef linux +# include +#endif + +/* + * Since it is quite laborious to build the ioctl + * arguments for the device-mapper people are + * encouraged to use this library. + * + * You will need to build a struct dm_task for + * each ioctl command you want to execute. + */ + +typedef void (*dm_log_fn) (int level, const char *file, int line, + const char *f, ...); + +/* + * The library user may wish to register their own + * logging function, by default errors go to + * stderr. + */ +void dm_log_init(dm_log_fn fn); +void dm_log_init_verbose(int level); + +enum { + DM_DEVICE_CREATE, + DM_DEVICE_RELOAD, + DM_DEVICE_REMOVE, + DM_DEVICE_REMOVE_ALL, + + DM_DEVICE_SUSPEND, + DM_DEVICE_RESUME, + + DM_DEVICE_INFO, + DM_DEVICE_DEPS, + DM_DEVICE_RENAME, + + DM_DEVICE_VERSION, + + DM_DEVICE_STATUS, + DM_DEVICE_TABLE, + DM_DEVICE_WAITEVENT, + + DM_DEVICE_LIST, + + DM_DEVICE_CLEAR, + + DM_DEVICE_MKNODES +}; + +struct dm_task; + +struct dm_task *dm_task_create(int type); +void dm_task_destroy(struct dm_task *dmt); + +int dm_task_set_name(struct dm_task *dmt, const char *name); +int dm_task_set_uuid(struct dm_task *dmt, const char *uuid); + +/* + * Retrieve attributes after an info. + */ +struct dm_info { + int exists; + int suspended; + int live_table; + int inactive_table; + int32_t open_count; + uint32_t event_nr; + uint32_t major; + uint32_t minor; /* minor device number */ + int read_only; /* 0:read-write; 1:read-only */ + + int32_t target_count; +}; + +struct dm_deps { + uint32_t count; + uint32_t filler; + uint64_t device[0]; +}; + +struct dm_names { + uint64_t dev; + uint32_t next; /* Offset to next struct from start of this struct */ + char name[0]; +}; + +int dm_get_library_version(char *version, size_t size); +int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size); +int dm_task_get_info(struct dm_task *dmt, struct dm_info *dmi); +const char *dm_task_get_name(struct dm_task *dmt); +const char *dm_task_get_uuid(struct dm_task *dmt); + +struct dm_deps *dm_task_get_deps(struct dm_task *dmt); +struct dm_names *dm_task_get_names(struct dm_task *dmt); + +int dm_task_set_ro(struct dm_task *dmt); +int dm_task_set_newname(struct dm_task *dmt, const char *newname); +int dm_task_set_minor(struct dm_task *dmt, int minor); +int dm_task_set_major(struct dm_task *dmt, int major); +int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr); + +/* + * Use these to prepare for a create or reload. + */ +int dm_task_add_target(struct dm_task *dmt, + uint64_t start, + uint64_t size, const char *ttype, const char *params); + +/* + * Format major/minor numbers correctly for input to driver + */ +int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, uint32_t dev_minor); + +/* Use this to retrive target information returned from a STATUS call */ +void *dm_get_next_target(struct dm_task *dmt, + void *next, uint64_t *start, uint64_t *length, + char **target_type, char **params); + +/* + * Call this to actually run the ioctl. + */ +int dm_task_run(struct dm_task *dmt); + +/* + * Configure the device-mapper directory + */ +int dm_set_dev_dir(const char *dir); +const char *dm_dir(void); + +/* Release library resources */ +void dm_lib_release(void); +void dm_lib_exit(void); + +#endif /* LIB_DEVICE_MAPPER_H */ diff --git a/extras/multipath/libdevmapper/libdm-common.c b/extras/multipath/libdevmapper/libdm-common.c new file mode 100644 index 0000000000..b0affd1eed --- /dev/null +++ b/extras/multipath/libdevmapper/libdm-common.c @@ -0,0 +1,382 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#include "libdm-targets.h" +#include "libdm-common.h" +#include "list.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEV_DIR "/dev/" + +static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR; + +static int _verbose = 0; + +/* + * Library users can provide their own logging + * function. + */ +static void _default_log(int level, const char *file, int line, + const char *f, ...) +{ + va_list ap; + + if (level > _LOG_WARN && !_verbose) + return; + + va_start(ap, f); + + if (level < _LOG_WARN) + vfprintf(stderr, f, ap); + else + vprintf(f, ap); + + va_end(ap); + + if (level < _LOG_WARN) + fprintf(stderr, "\n"); + else + fprintf(stdout, "\n"); +} + +dm_log_fn _log = _default_log; + +void dm_log_init(dm_log_fn fn) +{ + _log = fn; +} + +void dm_log_init_verbose(int level) +{ + _verbose = level; +} + +static void _build_dev_path(char *buffer, size_t len, const char *dev_name) +{ + /* If there's a /, assume caller knows what they're doing */ + if (strchr(dev_name, '/')) + snprintf(buffer, len, "%s", dev_name); + else + snprintf(buffer, len, "%s/%s", _dm_dir, dev_name); +} + +int dm_get_library_version(char *version, size_t size) +{ + strncpy(version, DM_LIB_VERSION, size); + return 1; +} + +struct dm_task *dm_task_create(int type) +{ + struct dm_task *dmt = malloc(sizeof(*dmt)); + + if (!dm_check_version()) + return NULL; + + if (!dmt) { + log_error("dm_task_create: malloc(%d) failed", sizeof(*dmt)); + return NULL; + } + + memset(dmt, 0, sizeof(*dmt)); + + dmt->type = type; + dmt->minor = -1; + dmt->major = -1; + + return dmt; +} + +int dm_task_set_name(struct dm_task *dmt, const char *name) +{ + char *pos; + char path[PATH_MAX]; + struct stat st1, st2; + + if (dmt->dev_name) { + free(dmt->dev_name); + dmt->dev_name = NULL; + } + + /* If path was supplied, remove it if it points to the same device + * as its last component. + */ + if ((pos = strrchr(name, '/'))) { + snprintf(path, sizeof(path), "%s/%s", _dm_dir, pos + 1); + + if (stat(name, &st1) || stat(path, &st2) || + !(st1.st_dev == st2.st_dev)) { + log_error("dm_task_set_name: Device %s not found", + name); + return 0; + } + + name = pos + 1; + } + + if (!(dmt->dev_name = strdup(name))) { + log_error("dm_task_set_name: strdup(%s) failed", name); + return 0; + } + + return 1; +} + +int dm_task_set_uuid(struct dm_task *dmt, const char *uuid) +{ + if (dmt->uuid) { + free(dmt->uuid); + dmt->uuid = NULL; + } + + if (!(dmt->uuid = strdup(uuid))) { + log_error("dm_task_set_uuid: strdup(%s) failed", uuid); + return 0; + } + + return 1; +} + +int dm_task_set_major(struct dm_task *dmt, int major) +{ + dmt->major = major; + log_debug("Setting major: %d", dmt->major); + + return 1; +} + +int dm_task_set_minor(struct dm_task *dmt, int minor) +{ + dmt->minor = minor; + log_debug("Setting minor: %d", dmt->minor); + + return 1; +} + +int dm_task_add_target(struct dm_task *dmt, uint64_t start, uint64_t size, + const char *ttype, const char *params) +{ + struct target *t = create_target(start, size, ttype, params); + + if (!t) + return 0; + + if (!dmt->head) + dmt->head = dmt->tail = t; + else { + dmt->tail->next = t; + dmt->tail = t; + } + + return 1; +} + +static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor) +{ + char path[PATH_MAX]; + struct stat info; + dev_t dev = MKDEV(major, minor); + + _build_dev_path(path, sizeof(path), dev_name); + + if (stat(path, &info) >= 0) { + if (!S_ISBLK(info.st_mode)) { + log_error("A non-block device file at '%s' " + "is already present", path); + return 0; + } + + if (info.st_rdev == dev) + return 1; + + if (unlink(path) < 0) { + log_error("Unable to unlink device node for '%s'", + dev_name); + return 0; + } + } + + if (mknod(path, S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP, dev) < 0) { + log_error("Unable to make device node for '%s'", dev_name); + return 0; + } + + return 1; +} + +static int _rename_dev_node(const char *old_name, const char *new_name) +{ + char oldpath[PATH_MAX]; + char newpath[PATH_MAX]; + struct stat info; + + _build_dev_path(oldpath, sizeof(oldpath), old_name); + _build_dev_path(newpath, sizeof(newpath), new_name); + + if (stat(newpath, &info) == 0) { + if (!S_ISBLK(info.st_mode)) { + log_error("A non-block device file at '%s' " + "is already present", newpath); + return 0; + } + + if (unlink(newpath) < 0) { + if (errno == EPERM) { + /* devfs, entry has already been renamed */ + return 1; + } + log_error("Unable to unlink device node for '%s'", + new_name); + return 0; + } + } + + if (rename(oldpath, newpath) < 0) { + log_error("Unable to rename device node from '%s' to '%s'", + old_name, new_name); + return 0; + } + + return 1; +} + +static int _rm_dev_node(const char *dev_name) +{ + char path[PATH_MAX]; + struct stat info; + + _build_dev_path(path, sizeof(path), dev_name); + + if (stat(path, &info) < 0) + return 1; + + if (unlink(path) < 0) { + log_error("Unable to unlink device node for '%s'", dev_name); + return 0; + } + + return 1; +} + +typedef enum { + NODE_ADD, + NODE_DEL, + NODE_RENAME +} node_op_t; + +static int _do_node_op(node_op_t type, const char *dev_name, uint32_t major, + uint32_t minor, const char *old_name) +{ + switch (type) { + case NODE_ADD: + return _add_dev_node(dev_name, major, minor); + case NODE_DEL: + return _rm_dev_node(dev_name); + case NODE_RENAME: + return _rename_dev_node(old_name, dev_name); + } + + return 1; +} + +static LIST_INIT(_node_ops); + +struct node_op_parms { + struct list list; + node_op_t type; + char *dev_name; + uint32_t major; + uint32_t minor; + char *old_name; + char names[0]; +}; + +static void _store_str(char **pos, char **ptr, const char *str) +{ + strcpy(*pos, str); + *ptr = *pos; + *pos += strlen(*ptr) + 1; +} + +static int _stack_node_op(node_op_t type, const char *dev_name, uint32_t major, + uint32_t minor, const char *old_name) +{ + struct node_op_parms *nop; + size_t len = strlen(dev_name) + strlen(old_name) + 2; + char *pos; + + if (!(nop = malloc(sizeof(*nop) + len))) { + log_error("Insufficient memory to stack mknod operation"); + return 0; + } + + pos = nop->names; + nop->type = type; + nop->major = major; + nop->minor = minor; + + _store_str(&pos, &nop->dev_name, dev_name); + _store_str(&pos, &nop->old_name, old_name); + + list_add(&_node_ops, &nop->list); + + return 1; +} + +static void _pop_node_ops(void) +{ + struct list *noph, *nopht; + struct node_op_parms *nop; + + list_iterate_safe(noph, nopht, &_node_ops) { + nop = list_item(noph, struct node_op_parms); + _do_node_op(nop->type, nop->dev_name, nop->major, nop->minor, + nop->old_name); + list_del(&nop->list); + free(nop); + } +} + +int add_dev_node(const char *dev_name, uint32_t major, uint32_t minor) +{ + return _stack_node_op(NODE_ADD, dev_name, major, minor, ""); +} + +int rename_dev_node(const char *old_name, const char *new_name) +{ + return _stack_node_op(NODE_RENAME, new_name, 0, 0, old_name); +} + +int rm_dev_node(const char *dev_name) +{ + return _stack_node_op(NODE_DEL, dev_name, 0, 0, ""); +} + +void update_devs(void) +{ + _pop_node_ops(); +} + +int dm_set_dev_dir(const char *dir) +{ + snprintf(_dm_dir, sizeof(_dm_dir), "%s%s", dir, DM_DIR); + return 1; +} + +const char *dm_dir(void) +{ + return _dm_dir; +} diff --git a/extras/multipath/libdevmapper/libdm-common.h b/extras/multipath/libdevmapper/libdm-common.h new file mode 100644 index 0000000000..2b71242861 --- /dev/null +++ b/extras/multipath/libdevmapper/libdm-common.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#ifndef LIB_DMCOMMON_H +#define LIB_DMCOMMON_H + +#include "libdevmapper.h" + +#define _LOG_DEBUG 7 +#define _LOG_INFO 6 +#define _LOG_NOTICE 5 +#define _LOG_WARN 4 +#define _LOG_ERR 3 +#define _LOG_FATAL 2 + +extern dm_log_fn _log; + +#define log_error(msg, x...) _log(_LOG_ERR, __FILE__, __LINE__, msg, ## x) +#define log_print(msg, x...) _log(_LOG_WARN, __FILE__, __LINE__, msg, ## x) +#define log_verbose(msg, x...) _log(_LOG_NOTICE, __FILE__, __LINE__, msg, ## x) +#define log_very_verbose(msg, x...) _log(_LOG_INFO, __FILE__, __LINE__, msg, ## x) +#define log_debug(msg, x...) _log(_LOG_DEBUG, __FILE__, __LINE__, msg, ## x) + +struct target *create_target(uint64_t start, + uint64_t len, + const char *type, const char *params); + +int add_dev_node(const char *dev_name, uint32_t minor, uint32_t major); +int rm_dev_node(const char *dev_name); +int rename_dev_node(const char *old_name, const char *new_name); +void update_devs(void); + +#define DM_LIB_VERSION "1.00.07-ioctl (2003-11-21)" + +#endif diff --git a/extras/multipath/libdevmapper/list.h b/extras/multipath/libdevmapper/list.h new file mode 100644 index 0000000000..df3d32aea8 --- /dev/null +++ b/extras/multipath/libdevmapper/list.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2001 Sistina Software + * + * This file is released under the LGPL. + */ + +#ifndef _LVM_LIST_H +#define _LVM_LIST_H + +#include + +struct list { + struct list *n, *p; +}; + +#define LIST_INIT(name) struct list name = { &(name), &(name) } + +static inline void list_init(struct list *head) +{ + head->n = head->p = head; +} + +static inline void list_add(struct list *head, struct list *elem) +{ + assert(head->n); + + elem->n = head; + elem->p = head->p; + + head->p->n = elem; + head->p = elem; +} + +static inline void list_add_h(struct list *head, struct list *elem) +{ + assert(head->n); + + elem->n = head->n; + elem->p = head; + + head->n->p = elem; + head->n = elem; +} + +static inline void list_del(struct list *elem) +{ + elem->n->p = elem->p; + elem->p->n = elem->n; +} + +static inline int list_empty(struct list *head) +{ + return head->n == head; +} + +static inline int list_end(struct list *head, struct list *elem) +{ + return elem->n == head; +} + +static inline struct list *list_next(struct list *head, struct list *elem) +{ + return (list_end(head, elem) ? NULL : elem->n); +} + +#define list_iterate(v, head) \ + for (v = (head)->n; v != head; v = v->n) + +#define list_uniterate(v, head, start) \ + for (v = (start)->p; v != head; v = v->p) + +#define list_iterate_safe(v, t, head) \ + for (v = (head)->n, t = v->n; v != head; v = t, t = v->n) + +static inline unsigned int list_size(const struct list *head) +{ + unsigned int s = 0; + const struct list *v; + + list_iterate(v, head) + s++; + + return s; +} + +#define list_item(v, t) \ + ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->list)) + +#define list_struct_base(v, t, h) \ + ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->h)) + +/* Given a known element in a known structure, locate another */ +#define struct_field(v, t, e, f) \ + (((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->e))->f) + +/* Given a known element in a known structure, locate the list head */ +#define list_head(v, t, e) struct_field(v, t, e, list) + +#endif diff --git a/extras/multipath/main.c b/extras/multipath/main.c index b5ab664433..f3f92e7eba 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -26,7 +26,7 @@ #include #include #include -#include +#include "libdevmapper/libdevmapper.h" #include "main.h" static int @@ -458,9 +458,7 @@ static int make_dm_node(char * str) { int r = 0; - dev_t dev; char buff[FILE_NAME_SIZE]; - int major, minor; struct dm_names * names; unsigned next = 0; struct dm_task *dmt; @@ -486,14 +484,9 @@ make_dm_node(char * str) names = (void *) names + next; } while (next); - major = (int) MAJOR(names->dev); - minor = (int) MINOR(names->dev); - - dev = major << sizeof(dev_t); - dev = dev | minor; sprintf(buff, "/dev/mapper/%s", str); unlink(buff); - mknod(buff, 0600 | S_IFBLK, dev); + mknod(buff, 0600 | S_IFBLK, names->dev); out: dm_task_destroy(dmt); @@ -729,9 +722,10 @@ main(int argc, char *argv[]) if (conf.verbose) { print_all_path(&conf, all_paths); - printf("\n"); + fprintf(stdout, "\n"); print_all_mp(all_paths, mp, nmp); - printf("\n"); + fprintf(stdout, "\n"); + //printf("\n"); } if (conf.dry_run) diff --git a/extras/multipath/main.h b/extras/multipath/main.h index 019cb843a8..692e5e4595 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -46,7 +46,7 @@ #define TUR_CMD_LEN 6 #define MX_ALLOC_LEN 255 #define BLKGETSIZE _IO(0x12,96) -#define DM_TARGET "multipath" +#define DM_TARGET "striped" #define PINDEX(x,y) mp[(x)].pindex[(y)] @@ -105,8 +105,8 @@ struct env { /* Build version */ #define PROG "multipath" -#define VERSION_CODE 0x000006 -#define DATE_CODE 0x271103 +#define VERSION_CODE 0x000009 +#define DATE_CODE 0x0C0503 #define MULTIPATH_VERSION(version) \ (version >> 16) & 0xFF, \ -- cgit v1.2.3-54-g00ecf From d877515791ae4d625d396cdb3a35903cdbf6fde6 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Sun, 7 Dec 2003 08:48:23 -0800 Subject: [PATCH] more extras/multipath updates * Adds a /var/run/multipath.run handling to avoid simultaneous runs. * Remove a commented-out "printf" --- extras/multipath/main.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/extras/multipath/main.c b/extras/multipath/main.c index f3f92e7eba..9bceb265ba 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -660,9 +660,19 @@ usage(char * progname) exit(1); } +static int +running(char * run) { + struct stat buf; + + if(!stat(run, &buf)) + return 1; + return 0; +} + int main(int argc, char *argv[]) { + char * run = "/var/run/multipath.run"; struct multipath * mp; struct path * all_paths; struct scsi_dev * all_scsi_ids; @@ -705,12 +715,26 @@ main(int argc, char *argv[]) } + if (running(run)) { + if (conf.verbose) { + fprintf(stderr, "Already running.\n"); + fprintf(stderr, "If you know what you do, please "); + fprintf(stderr, "remove %s\n", run); + } + return 1; + } + + if(!open(run, O_CREAT)) + exit(1); + /* dynamic allocations */ mp = malloc(conf.max_devs * sizeof(struct multipath)); all_paths = malloc(conf.max_devs * sizeof(struct path)); all_scsi_ids = malloc(conf.max_devs * sizeof(struct scsi_dev)); - if (mp == NULL || all_paths == NULL || all_scsi_ids == NULL) + if (mp == NULL || all_paths == NULL || all_scsi_ids == NULL) { + unlink(run); exit(1); + } if (!conf.with_sysfs) { get_all_scsi_ids(&conf, all_scsi_ids); @@ -725,11 +749,12 @@ main(int argc, char *argv[]) fprintf(stdout, "\n"); print_all_mp(all_paths, mp, nmp); fprintf(stdout, "\n"); - //printf("\n"); } - if (conf.dry_run) + if (conf.dry_run) { + unlink(run); exit(0); + } for (k=0; k<=nmp; k++) { if (map_present(mp[k].wwid)) { @@ -738,5 +763,6 @@ main(int argc, char *argv[]) add_map(&conf, all_paths, mp, k, DM_DEVICE_CREATE); } } + unlink(run); exit(0); } -- cgit v1.2.3-54-g00ecf From a652254ddba3f77abf63f732c42c3a0136dc03d2 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Sun, 7 Dec 2003 08:50:19 -0800 Subject: [PATCH] yet more extras/multipath * implement a reschedule flag in /var/run. Last thing the prog do before exit is check if a call to multipath was done (but canceled by /var/run/multipath.run check) during its execution. If so restart the main loop. * implement a blacklist of sysfs bdev to not bother with for now (hd, md, dm, sr, scd, ram, raw). This avoid sending SG_IO to unappropiate devices. Compiles & survive "while true;do (./multipath -v &);done" --- extras/multipath/main.c | 47 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/extras/multipath/main.c b/extras/multipath/main.c index 9bceb265ba..bc65899ce1 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -195,6 +195,31 @@ basename(char * str1, char * str2) strcpy(str2, ++p); } +static int +blacklist (char * dev) { + int i; + static struct { + char * headstr; + int lengh; + } blist[] = { + {"cciss", 5}, + {"hd", 2}, + {"md", 2}, + {"dm", 2}, + {"sr", 2}, + {"scd", 3}, + {"ram", 3}, + {"raw", 3}, + {NULL, 0}, + }; + + for (i = 0; blist[i].lengh; i++) { + if (strncmp(dev, blist[i].headstr, blist[i].lengh)) + return 1; + } + return 0; +} + static int get_all_paths_sysfs(struct env * conf, struct path * all_paths) { @@ -211,6 +236,8 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) sdir = sysfs_open_directory(block_path); sysfs_read_directory(sdir); dlist_for_each_data(sdir->subdirs, devp, struct sysfs_directory) { + if (blacklist(devp->name)) + continue; sysfs_read_directory(devp); if(devp->links == NULL) continue; @@ -661,7 +688,7 @@ usage(char * progname) } static int -running(char * run) { +filepresent(char * run) { struct stat buf; if(!stat(run, &buf)) @@ -673,6 +700,7 @@ int main(int argc, char *argv[]) { char * run = "/var/run/multipath.run"; + char * resched = "/var/run/multipath.reschedule"; struct multipath * mp; struct path * all_paths; struct scsi_dev * all_scsi_ids; @@ -715,18 +743,17 @@ main(int argc, char *argv[]) } - if (running(run)) { + if (filepresent(run)) { if (conf.verbose) { fprintf(stderr, "Already running.\n"); fprintf(stderr, "If you know what you do, please "); fprintf(stderr, "remove %s\n", run); } + /* leave a trace that we were called while already running */ + open(resched, O_CREAT); return 1; } - if(!open(run, O_CREAT)) - exit(1); - /* dynamic allocations */ mp = malloc(conf.max_devs * sizeof(struct multipath)); all_paths = malloc(conf.max_devs * sizeof(struct path)); @@ -735,6 +762,9 @@ main(int argc, char *argv[]) unlink(run); exit(1); } +start: + if(!open(run, O_CREAT)) + exit(1); if (!conf.with_sysfs) { get_all_scsi_ids(&conf, all_scsi_ids); @@ -764,5 +794,12 @@ main(int argc, char *argv[]) } } unlink(run); + + /* start again if we were ask to during this process run */ + /* ie. do not loose an event-asked run */ + if (filepresent(resched)) { + unlink(resched); + goto start; + } exit(0); } -- cgit v1.2.3-54-g00ecf From 1bed1db4994aae37f4a11e90dabcd8b4e3592686 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Sun, 7 Dec 2003 08:55:40 -0800 Subject: [PATCH] update udev extras/scsi_id to version 0.2 This patch updates scsi_id under udev from version 0.1 to version 0.2. --- extras/scsi_id/ChangeLog | 64 ++++++++++++++++++++++ extras/scsi_id/Makefile | 24 ++++++--- extras/scsi_id/README | 4 +- extras/scsi_id/TODO | 21 +++----- extras/scsi_id/VERSION | 1 - extras/scsi_id/scsi_id.8 | 118 ++++++++++++++++++++++++++++++++++++++++ extras/scsi_id/scsi_id.c | 124 ++++++++++++++++++++++--------------------- extras/scsi_id/scsi_id.h | 21 +++++++- extras/scsi_id/scsi_serial.c | 34 +++++++++--- 9 files changed, 321 insertions(+), 90 deletions(-) create mode 100644 extras/scsi_id/ChangeLog delete mode 100644 extras/scsi_id/VERSION create mode 100644 extras/scsi_id/scsi_id.8 diff --git a/extras/scsi_id/ChangeLog b/extras/scsi_id/ChangeLog new file mode 100644 index 0000000000..7f2317723d --- /dev/null +++ b/extras/scsi_id/ChangeLog @@ -0,0 +1,64 @@ +2003-dec-05: + * Makefile, scsi_id.8: Add a man page. + +2003-dec-04: + * Makefile: Set and use variables that might be passed down when + built under udev (with or without klibc), don't set LDFLAGS or + STRIP. + +2003-dec-04: + * scsi_id.c, scsi_id.h: Fix a bad bug - when parsing file options, + no space was allocated for the creation of the new argv[] + strings. + +2003-dec-04: + * scsi_id.c: Catch too long a line in the config file. + +2003-dec-02: + * scsi_id.h: Add u8 typedef to avoid ummm scsi.h kernel header + problem when built with klibc. + +2003-dec-02: + * scsi_id.h: Add define of makedev() if built with klibc. + +2003-dec-02: + * scsi_id.c: reset optind to 1 since klibc does not work if it is + reset to zero. + +2003-dec-02: + * scsi_id.c: remove fflush() as it is not needed, and is not + supported by klibc. + +2003-dec-02: + * scsi_serial.c: Make the functions do_scsi_page0_inquiry and + do_scsi_page80_inquiry static. + +2003-dec-01: + * scsi_id.c: Don't use syslog LOG_PID, as it is not supported by + klibc. + +2003-dec-01: + * scsi_id.c, scsi_serial.c: Hack - change include path to libsysfs + if built under klibc. + +2003-dec-01: + * Makefile: Use "override" for CFLAGS so we can pass CFLAGS values + down when built with udev + +2003-dec-01: + * scsi_id.c, Makefile: Use SCSI_ID_VERSION instead of VERSION. + +2003-nov-25: + * scsi_id.c: Remove getopt_long (long option names), as there + is no support for that in klibc. + +2003-nov-17: + * scsi_id.c: Patch from Brian King: check result of setting model, + not vendor in per_dev_options. + +2003-nov-03: + * scsi_id.c, scsi_serial.c: Use new and correct path to libsysfs.h. + +2003-nov-03: + * scsi_id.h: Fix scsi_id.h so var args in marcros works ok with + older gcc. diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 5ad2bcf3e1..ead205682a 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -14,33 +14,45 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -VERSION=0.1 +SCSI_ID_VERSION=0.2 prefix = sbindir = ${prefix}/sbin +mandir = ${prefix}/usr/share/man INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -CFLAGS=-DVERSION=\"$(VERSION)\" $(DEBUG) -Wall +# Note some of the variables used here are set when built under udev, and +# otherwise might not be set. + +override CFLAGS+=-DSCSI_ID_VERSION=\"$(SCSI_ID_VERSION)\" $(DEBUG) -Wall PROG=scsi_id +SYSFS=-lsysfs -LIBSYSFS=-lsysfs -STRIP=-s -LDFLAGS=$(STRIP) --static +# +# Built static and stripped when built with udev. +# +# STRIP=-s +# LDFLAGS=$(STRIP) +LD=$(CC) OBJS= scsi_id.o \ scsi_serial.o \ all: $(PROG) +# XXX use a compressed man page? + install: all $(INSTALL_PROGRAM) -D $(PROG) $(sbindir)/$(PROG) + $(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 uninstall: -rm $(sbindir)/$(PROG) + -rm $(mandir)/man8/scsi_id.8 $(OBJS): scsi_id.h scsi.h @@ -48,4 +60,4 @@ clean: rm -f $(PROG) $(OBJS) $(PROG): $(OBJS) - $(CC) $(OBJS) $(LDFLAGS) $(LIBSYSFS) -o $(PROG) + $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) diff --git a/extras/scsi_id/README b/extras/scsi_id/README index b13cf1e50a..4281c318a2 100644 --- a/extras/scsi_id/README +++ b/extras/scsi_id/README @@ -5,9 +5,9 @@ used by a multi-path configuration tool that requires SCSI id's. Requires: -- Linux kernel 2.6 + - Linux kernel 2.6 -- libsysfs + - libsysfs No man page yet. diff --git a/extras/scsi_id/TODO b/extras/scsi_id/TODO index ba52101431..5d020c276a 100644 --- a/extras/scsi_id/TODO +++ b/extras/scsi_id/TODO @@ -1,16 +1,11 @@ -- Investigate shrinking build size: use klibc or uClibc, or copy whatever - udev does +- add information abou the config file to the man page -- write a man page +- change so non-KLIBC builds under udev don't use /usr/include/sysfs, + but instead use the sysfs included with udev (needs udev change and/or + sysfsutils changes). -- send in kernel patch for REQ_BLOCK_PC, to always set sd and sr set - retries (scmd->allowed) to <= 1 +- do something with callout code - remove or change to a tag? -- Pull SG_IO code into one .c file. - -- implement callout to device specific serial id code. The "-c prog" is - not implemented. - - This needs an implementation of a device specific callout before it can - be completed. Someone with hardware requiring this needs to send in a - patch. + This needs an implementation of a device specific callout or device + specific code (called via some special "tag" or such) before it can be + completed. Someone with such hardware to send in a patch. diff --git a/extras/scsi_id/VERSION b/extras/scsi_id/VERSION deleted file mode 100644 index 49d59571fb..0000000000 --- a/extras/scsi_id/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.1 diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 new file mode 100644 index 0000000000..a4fb881a05 --- /dev/null +++ b/extras/scsi_id/scsi_id.8 @@ -0,0 +1,118 @@ +.TH SCSI_ID 8 "December 2003" "" "Linux Administrator's Manual" +.SH NAME +scsi_id \- retrieve and generate a unique SCSI identifier +.SH SYNOPSIS +.BI scsi_id +[\fIoptions\fP] +.SH "DESCRIPTION" +.B scsi_id +queries a SCSI device via the SCSI INQUIRY vital product data (VPD) page 0x80 or +0x83 and uses the resulting data to generate a value that is unique across +all SCSI devices that properly support page 0x80 or page 0x83. + +If a result is generated it is sent to standard output, and the program +exits with a zero value. If no identifier is output, the program exits +with a non-zero value. + +\fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP +that require a unique SCSI identifier. + +By default all devices are assume black listed, the \fB-g\fP option must +be specified on the command line or in the config file for any useful +behaviour. + +SCSI commands are sent directly to the device via the SG_IO ioctl +interface. + +In order to generate unique values for either page 0x80 or page 0x83, the +serial numbers or world wide names are prefixed as follows. + +Identifiers based on page 0x80 are prefixed by the character 'S', the SCSI +vendor, the SCSI product (model) and then the the serial number returned +by page 0x80. For example: + +.sp +.nf +# scsi_id -p 0x80 -s /block/sdg +SIBM 3542 1T05078453 +.fi +.P + +Identifiers based on page 0x83 are prefixed by the identifier type +followed by the page 0x83 identifier. For example, a device with a NAA +(Name Address Authority) type of 3 (also in this case the page 0x83 +identifier starts with the NAA value of 6): + +.sp +.nf +# /sbin/scsi_id -p 0x83 -s /block/sdg +3600a0b80000b174b000000d63efc5c8c +.fi +.P + + +.SH OPTIONS +.TP +.BI \-b +The default behaviour - treat the device as black listed, and do nothing +unless a white listed device is found in the scsi_id config-file. +.TP +.BI \-d "\| device\^" +Instead +of determining and creating a device node based on a sysfs dev +entry as done for the \fB-s\fP, send SG_IO commands to +\fBdevice\fP, such as \fB/dev/sdc\fP. +.TP +.BI \-e +Send all output to standard error even if +.B scsi_id +is running in hotplug mode. +.TP +.BI \-f "\| config-file" +Read configuration and black/white list entries from +.B config-file +rather than the default +.B /etc/scsi_id.config +file. +.TP +.BI \-g +Treat the device as white listed. The \fB\-g\fP option must be specified +on the command line or in the scsi_id configuration file for +.B scsi_id +to generate any output. +.TP +.BI \-i +Prefix the identification string with the driver model (sysfs) bus id of +the SCSI device. +.TP +.BI \-p "\| 0x80 | 0x83" +Use SCSI INQUIRY VPD page code 0x80 or 0x83. The default behaviour is to +query the available VPD pages, and use page 0x83 if found, else page 0x80 +if found, else nothing. +.TP +.BI \-s "\|sysfs-device" +Generate an id for the +.B sysfs-device. +The sysfs mount point must not be included. For example, use /block/sd, +not /sys/block/sd. +.TP +.BI \-v +Generate verbose debugging output. +.TP +.BI \-V +Display version number and exit. +.RE +.SH "FILES" +.nf +.ft B +.ft +/etc/scsi_id.config configuration and black/white list entries +.fi +.LP +.SH "SEE ALSO" +.BR udev (8) +, especially the CALLOUT method. +.SH AUTHORS +Developed by Patrick Mansfield based on SCSI ID +source included in earlier linux 2.5 kernels, sg_utils source, and SCSI +specifications. diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index d34d9284e5..df18271b48 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -23,7 +23,6 @@ #include #include -#include #include #include #include @@ -33,12 +32,19 @@ #include #include #include -#include +#ifdef __KLIBC__ +/* + * Assume built under udev with KLIBC + */ +#include +#else +#include +#endif #include "scsi_id.h" -#ifndef VERSION +#ifndef SCSI_ID_VERSION #warning No version -#define VERSION "unknown" +#define SCSI_ID_VERSION "unknown" #endif /* @@ -49,36 +55,11 @@ #define CONFIG_FILE "/etc/scsi_id.config" -#define MAX_NAME_LEN 72 - -#define MAX_SERIAL_LEN 128 - static const char short_options[] = "bc:d:ef:gip:s:vV"; -static const struct option long_options[] = { - {"broken", no_argument, NULL, 'b'}, /* also per dev */ - {"callout", required_argument, NULL, 'c'}, /* also per dev */ - {"device", required_argument, NULL, 'd'}, - {"stderr", no_argument, NULL, 'e'}, - {"file", required_argument, NULL, 'f'}, - {"good", no_argument, NULL, 'g'}, /* also per dev */ - {"busid", no_argument, NULL, 'i'}, /* also per dev */ - {"page", required_argument, NULL, 'p'}, /* also per dev */ - {"devpath", required_argument, NULL, 's'}, - {"verbose", no_argument, NULL, 'v'}, - {"version", no_argument, NULL, 'V'}, - {0, 0, 0, 0} -}; /* * Just duplicate per dev options. */ static const char dev_short_options[] = "bc:gp:"; -static const struct option dev_long_options[] = { - {"broken", no_argument, NULL, 'b'}, /* also per dev */ - {"callout", required_argument, NULL, 'c'}, /* also per dev */ - {"good", no_argument, NULL, 'g'}, /* also per dev */ - {"page", required_argument, NULL, 'p'}, /* also per dev */ - {0, 0, 0, 0} -}; char sysfs_mnt_path[SYSFS_PATH_MAX]; @@ -105,8 +86,13 @@ void log_message (int level, const char *format, ...) vfprintf(stderr, format, args); } else { static int logging_init = 0; + static unsigned char logname[32]; if (!logging_init) { - openlog ("scsi_id", LOG_PID, LOG_DAEMON); + /* + * klibc does not have LOG_PID. + */ + snprintf(logname, 32, "scsi_id[%d]", getpid()); + openlog (logname, 0, LOG_DAEMON); logging_init = 1; } @@ -295,7 +281,7 @@ static int argc_count(char *opts) static int get_file_options(char *vendor, char *model, int *argc, char ***newargv) { - char buffer[256]; + char *buffer; FILE *fd; char *buf; char *str1; @@ -303,7 +289,6 @@ static int get_file_options(char *vendor, char *model, int *argc, int lineno; int c; int retval = 0; - static char *prog_string = "arg0"; dprintf("vendor='%s'; model='%s'\n", vendor, model); fd = fopen(config_file, "r"); @@ -318,16 +303,31 @@ static int get_file_options(char *vendor, char *model, int *argc, } } + /* + * Allocate a buffer rather than put it on the stack so we can + * keep it around to parse any options (any allocated newargv + * points into this buffer for its strings). + */ + buffer = malloc(MAX_BUFFER_LEN); + if (!buffer) { + log_message(LOG_WARNING, "Can't allocate memory.\n"); + return -1; + } + *newargv = NULL; lineno = 0; - while (1) { vendor_in = model_in = options_in = NULL; - buf = fgets(buffer, sizeof(buffer), fd); + buf = fgets(buffer, MAX_BUFFER_LEN, fd); if (buf == NULL) break; lineno++; + if (buf[strlen(buffer) - 1] != '\n') { + log_message(LOG_WARNING, + "Config file line %d too long.\n", lineno); + break; + } while (isspace(*buf)) buf++; @@ -419,18 +419,24 @@ static int get_file_options(char *vendor, char *model, int *argc, * Something matched. Allocate newargv, and store * values found in options_in. */ - c = argc_count(options_in) + 2; + strcpy(buffer, options_in); + c = argc_count(buffer) + 2; *newargv = calloc(c, sizeof(**newargv)); if (!*newargv) { log_message(LOG_WARNING, - "Can't allocate memory\n"); + "Can't allocate memory.\n"); retval = -1; } else { *argc = c; c = 0; - (*newargv)[c] = prog_string; /* nothing */ + /* + * argv[0] at 0 is skipped by getopt, but + * store the buffer address there for + * alter freeing. + */ + (*newargv)[c] = buffer; for (c = 1; c < *argc; c++) - (*newargv)[c] = strsep(&options_in, " "); + (*newargv)[c] = strsep(&buffer, " "); } } else { /* @@ -439,26 +445,26 @@ static int get_file_options(char *vendor, char *model, int *argc, retval = 1; } } + if (retval != 0) + free(buffer); fclose(fd); return retval; } static int set_options(int argc, char **argv, const char *short_opts, - const struct option *long_opts, char *target, - char *maj_min_dev) + char *target, char *maj_min_dev) { int option; - int option_ind; /* - * optind is a global extern used by getopt_long. Since we can - * call set_options twice (once for command line, and once for - * config file) we have to reset this back to 0. + * optind is a global extern used by getopt. Since we can call + * set_options twice (once for command line, and once for config + * file) we have to reset this back to 1. [Note glibc handles + * setting this to 0, but klibc does not.] */ - optind = 0; + optind = 1; while (1) { - option = getopt_long(argc, argv, short_options, long_options, - &option_ind); + option = getopt(argc, argv, short_options); if (option == -1) break; @@ -521,7 +527,7 @@ static int set_options(int argc, char **argv, const char *short_opts, case 'V': log_message(LOG_WARNING, "scsi_id version: %s\n", - VERSION); + SCSI_ID_VERSION); exit(0); break; @@ -544,8 +550,6 @@ static int per_dev_options(struct sysfs_class_device *scsi_dev, int *good_bad, char *vendor; char *model; int option; - int option_ind; - *good_bad = all_good; *page_code = default_page_code; @@ -562,7 +566,7 @@ static int per_dev_options(struct sysfs_class_device *scsi_dev, int *good_bad, } model = sysfs_get_attr(scsi_dev, "model"); - if (!vendor) { + if (!model) { log_message(LOG_WARNING, "%s: no model attribute\n", scsi_dev->name); return -1; @@ -570,10 +574,9 @@ static int per_dev_options(struct sysfs_class_device *scsi_dev, int *good_bad, retval = get_file_options(vendor, model, &newargc, &newargv); - optind = 0; /* global extern, reset to 0 */ + optind = 1; /* reset this global extern */ while (retval == 0) { - option = getopt_long(newargc, newargv, dev_short_options, - dev_long_options, &option_ind); + option = getopt(newargc, newargv, dev_short_options); if (option == -1) break; @@ -616,8 +619,10 @@ static int per_dev_options(struct sysfs_class_device *scsi_dev, int *good_bad, } } - if (newargv) + if (newargv) { + free(newargv[0]); free(newargv); + } return retval; } @@ -747,7 +752,6 @@ static int scsi_id(const char *target_path, char *maj_min_dev) dprintf("%s\n", serial); retval = 0; } - fflush(stdout); sysfs_close_class_device(scsi_dev); if (!dev_specified) @@ -797,8 +801,8 @@ int main(int argc, char **argv) strncpy(target_path, sysfs_mnt_path, MAX_NAME_LEN); strncat(target_path, devpath, MAX_NAME_LEN); } else { - if (set_options(argc, argv, short_options, long_options, - target_path, maj_min_dev) < 0) + if (set_options(argc, argv, short_options, target_path, + maj_min_dev) < 0) exit(1); } @@ -811,8 +815,8 @@ int main(int argc, char **argv) if (retval < 0) { exit(1); } else if (newargv && (retval == 0)) { - if (set_options(newargc, newargv, short_options, long_options, - target_path, maj_min_dev) < 0) + if (set_options(newargc, newargv, short_options, target_path, + maj_min_dev) < 0) exit(1); free(newargv); } diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 8be492b75a..eb9498ab71 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -22,11 +22,23 @@ */ #define dprintf(format, arg...) \ - log_message(LOG_DEBUG, "%s: " format, __FUNCTION__, ## arg) + log_message(LOG_DEBUG, "%s: " format, __FUNCTION__ , ## arg) #define MAX_NAME_LEN 72 #define OFFSET (2 * sizeof(unsigned int)) +/* + * MAX_SERIAL_LEN: the maximum length of the serial number, including + * added prefixes such as vendor and product (model) strings. + */ +#define MAX_SERIAL_LEN 128 + +/* + * MAX_BUFFER_LEN: maximum buffer size and line length used while reading + * the config file. + */ +#define MAX_BUFFER_LEN 256 + static inline char *sysfs_get_attr(struct sysfs_class_device *dev, const char *attr) { @@ -40,3 +52,10 @@ extern int scsi_get_serial (struct sysfs_class_device *scsi_dev, extern void log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); +#ifdef __KLIBC__ +#define makedev(major, minor) ((major) << 8) | (minor) +#endif + +#ifndef u8 +typedef unsigned char u8; +#endif diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 302429c0d4..18cd290817 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -31,7 +31,14 @@ #include #include #include -#include +#ifdef __KLIBC__ +/* + * Assume built under udev with KLIBC + */ +#include +#else +#include +#endif #include "scsi_id.h" #include "scsi.h" @@ -348,6 +355,11 @@ resend: retval = scsi_dump(scsi_dev, &io_hdr); } + /* + * XXX where is the length checked? That is, was our request + * buffer long enough? + */ + if (!retval) { retval = buflen; memcpy(buf, buffer, retval); @@ -369,8 +381,8 @@ resend: * Ending here. */ -int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, - char *buffer, int len) +static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, + char *buffer, int len) { int retval; char *vendor; @@ -527,8 +539,10 @@ static int check_fill_0x83_id(struct sysfs_class_device *scsi_dev, serial[0] = hex_str[id_search->id_type]; /* - * Prepend the vendor and model before the id since if it is not - * unique across all vendors and models. + * For SCSI_ID_VENDOR_SPECIFIC prepend the vendor and model before + * the id since it is not unique across all vendors and models, + * this differs from SCSI_ID_T10_VENDOR, where the vendor is + * included in the identifier. */ if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) if (prepend_vendor_model(scsi_dev, &serial[1]) < 0) { @@ -575,6 +589,12 @@ static int do_scsi_page83_inquiry(struct sysfs_class_device *scsi_dev, int fd, scsi_dev->name); return 1; } + + /* + * XXX Some devices (IBM 3542) return all spaces for an identifier if + * the LUN is not actually configured. This leads to identifers of + * the form: "1 ". + */ /* * Search for a match in the prioritized id_search_list. @@ -609,8 +629,8 @@ static int do_scsi_page83_inquiry(struct sysfs_class_device *scsi_dev, int fd, return 1; } -int do_scsi_page80_inquiry(struct sysfs_class_device *scsi_dev, int fd, - char *serial, int max_len) +static int do_scsi_page80_inquiry(struct sysfs_class_device *scsi_dev, int fd, + char *serial, int max_len) { int retval; int ser_ind; -- cgit v1.2.3-54-g00ecf From eadb1bbc2eece84d9aff79bf17e252106c37f355 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Sun, 7 Dec 2003 09:04:49 -0800 Subject: [PATCH] better allow builds of extras programs under udev Here is an improved version of the patch that enables builds of the extras progams for the targets all, clean, install, and uninstall, and passes down the "prefix" for use by install and uninstall. This patch enables building of the "extras" programs using the same build environment as udev (i.e. build with udev's versions of klibc and sysfsutils). For example, build scsi_id and udev via: make EXTRAS=extras/scsi_id Build scsi_id and udev with klibc via: make KLIBC=true EXTRAS=extras/scsi_id --- Makefile | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index c6f322c880..aa1d45bdb7 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,9 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} +# To build any of the extras programs, run with: +# make EXTRAS="extras/a extras/b" +EXTRAS= # place to put our device nodes udevdir = ${prefix}/udev/ @@ -60,7 +63,7 @@ AR = $(CROSS)ar STRIP = $(CROSS)strip RANLIB = $(CROSS)ranlib -export CROSS CC AR STRIP RANLIB +export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS ARCH_LIB_OBJS CRT0 # code taken from uClibc to determine the current arch ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ @@ -108,20 +111,20 @@ endif # If we are using our version of klibc, then we need to build and link it. # Otherwise, use glibc and link statically. ifeq ($(strip $(KLIBC)),true) - KLIBC_DIR = klibc/klibc + KLIBC_BASE = $(PWD)/klibc + KLIBC_DIR = $(KLIBC_BASE)/klibc INCLUDE_DIR := $(KLIBC_DIR)/include + LINUX_INCLUDE_DIR := $(KLIBC_BASE)/linux/include include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG # arch specific objects - LIBGCC = $(shell $(CC) --print-libgcc) ARCH_LIB_OBJS = \ - $(KLIBC_DIR)/libc.a \ - $(LIBGCC) + $(KLIBC_DIR)/libc.a CRT0 = $(KLIBC_DIR)/crt0.o LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(KLIBC_DIR)/arch/$(ARCH)/include \ - -I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -Iklibc/linux/include \ + -I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -I$(LINUX_INCLUDE_DIR) \ -D__KLIBC__ LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs @@ -133,7 +136,14 @@ else LDFLAGS = --static endif +CFLAGS += -I$(PWD)/libsysfs + all: $(ROOT) + @for target in $(EXTRAS) ; do \ + echo $$target ; \ + $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ + -C $$target $@ ; \ + done ; \ $(ROOT): $(LIBC) @@ -145,13 +155,13 @@ $(CRT0): TDB = tdb/tdb.o \ tdb/spinlock.o -SYSFS = libsysfs/sysfs_bus.o \ - libsysfs/sysfs_class.o \ - libsysfs/sysfs_device.o \ - libsysfs/sysfs_dir.o \ - libsysfs/sysfs_driver.o \ - libsysfs/sysfs_utils.o \ - libsysfs/dlist.o +SYSFS = $(PWD)/libsysfs/sysfs_bus.o \ + $(PWD)/libsysfs/sysfs_class.o \ + $(PWD)/libsysfs/sysfs_device.o \ + $(PWD)/libsysfs/sysfs_dir.o \ + $(PWD)/libsysfs/sysfs_driver.o \ + $(PWD)/libsysfs/sysfs_utils.o \ + $(PWD)/libsysfs/dlist.o OBJS = udev.o \ udev_config.o \ @@ -192,6 +202,11 @@ clean: | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(MAKE) -C klibc clean + @for target in $(EXTRAS) ; do \ + echo $$target ; \ + $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ + -C $$target $@ ; \ + done ; \ DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort ) DISTDIR := $(RELEASE_NAME) @@ -236,6 +251,11 @@ install: all $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir) - rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug - ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug + @for target in $(EXTRAS) ; do \ + echo $$target ; \ + $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ + -C $$target $@ ; \ + done ; \ uninstall: - rm $(hotplugdir)/udev.hotplug @@ -247,5 +267,10 @@ uninstall: - rmdir $(hotplugdir) - rmdir $(configdir) - rmdir $(udevdir) + @for target in $(EXTRAS) ; do \ + echo $$target ; \ + $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ + -C $$target $@ ; \ + done ; \ -- cgit v1.2.3-54-g00ecf From 3d150dfb28efbaf0b25f154fb8955c47d606c3d5 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 7 Dec 2003 09:12:07 -0800 Subject: [PATCH] experimental (very simple) SYMLINK creation > > here is a experimental symlink creation patch - for discussion, > > in which direction we should go. > > It is possible now to define SYMLINK= after the NAME= in udev.rules. > > The link is relative to the node, but the path is not optimized now > > if the node and the link are in the same nested directory. > > Only one link is supported, cause i need to sleep now :) > > > > 06-simple-symlink-creation.diff > > simple symlink creation > > reorganized udev-remove to have access to the symlink field > > subdir creation/removal are functions now > > udev-test.pl tests for link creation/removal Here is a new version with relative link target path optimization an better tests in udev-test.pl: LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink" Dec 7 06:48:34 pim udev[13789]: create_node: symlink 'udev-root/1/2/c/d/symlink' to node '1/2/a/b/node' requested Dec 7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c' Dec 7 06:48:34 pim udev[13789]: create_path: created 'udev-root/1/2/c/d' Dec 7 06:48:34 pim udev[13789]: create_node: symlink(../../a/b/node, udev-root/1/2/c/d/symlink) --- namedev.c | 9 +++- namedev.h | 1 + namedev_parse.c | 58 ++++++++++++++++++++----- test/udev-test.pl | 41 +++++++++++++++++- udev-add.c | 99 ++++++++++++++++++++++++++++++------------ udev-remove.c | 127 ++++++++++++++++++++++++++---------------------------- udev.h | 1 + 7 files changed, 229 insertions(+), 107 deletions(-) diff --git a/namedev.c b/namedev.c index 1faa253c1e..fbdb125e4c 100644 --- a/namedev.c +++ b/namedev.c @@ -121,6 +121,7 @@ int add_config_dev(struct config_device *new_dev) copy_string(dev, new_dev, place); copy_string(dev, new_dev, kernel_name); copy_string(dev, new_dev, exec_program); + copy_string(dev, new_dev, symlink); return 0; } @@ -366,6 +367,7 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev if (strcmp_pattern(dev->id, udev->callout_value) != 0) continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("callout returned matching value '%s', '%s' becomes '%s'", dev->id, class_dev->name, udev->name); return 0; @@ -416,6 +418,7 @@ label_found: continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("found matching attribute '%s', '%s' becomes '%s' ", dev->sysfs_file, class_dev->name, udev->name); @@ -461,6 +464,7 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, if (!found) continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("found matching id '%s', '%s' becomes '%s'", dev->id, class_dev->name, udev->name); return 0; @@ -506,6 +510,7 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("found matching place '%s', '%s' becomes '%s'", dev->place, class_dev->name, udev->name); return 0; @@ -528,6 +533,7 @@ static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev continue; strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); dbg("found name, '%s' becomes '%s'", dev->kernel_name, udev->name); return 0; @@ -618,8 +624,9 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud goto done; found: - /* substitute placeholder in NAME */ + /* substitute placeholder */ apply_format(udev, udev->name); + apply_format(udev, udev->symlink); done: perm = find_perm(udev->name); diff --git a/namedev.h b/namedev.h index f7b8a67667..39cf3ae641 100644 --- a/namedev.h +++ b/namedev.h @@ -63,6 +63,7 @@ struct config_device { char kernel_name[NAME_SIZE]; char exec_program[FILE_SIZE]; char name[NAME_SIZE]; + char symlink[NAME_SIZE]; }; struct perm_device { diff --git a/namedev_parse.c b/namedev_parse.c index 5cb3a3eb1d..b5d0d64b9d 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -213,10 +213,16 @@ int namedev_init_rules(void) break; strfieldcpy(dev.name, temp3); + /* SYMLINK="name" */ + temp2 = strsep(&temp, ","); + retval = get_value("SYMLINK", &temp, &temp3); + if (retval == 0) + strfieldcpy(dev.symlink, temp3); + dbg_parse("LABEL name='%s', bus='%s', " - "sysfs_file='%s', sysfs_value='%s'", + "sysfs_file='%s', sysfs_value='%s', symlink='%s'", dev.name, dev.bus, dev.sysfs_file, - dev.sysfs_value); + dev.sysfs_value, dev.symlink); } if (strcasecmp(temp2, TYPE_NUMBER) == 0) { @@ -243,8 +249,14 @@ int namedev_init_rules(void) break; strfieldcpy(dev.name, temp3); - dbg_parse("NUMBER name='%s', bus='%s', id='%s'", - dev.name, dev.bus, dev.id); + /* SYMLINK="name" */ + temp2 = strsep(&temp, ","); + retval = get_value("SYMLINK", &temp, &temp3); + if (retval == 0) + strfieldcpy(dev.symlink, temp3); + + dbg_parse("NUMBER name='%s', bus='%s', id='%s', symlink='%s'", + dev.name, dev.bus, dev.id, dev.symlink); } if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { @@ -271,8 +283,15 @@ int namedev_init_rules(void) break; strfieldcpy(dev.name, temp3); - dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s'", - dev.name, dev.bus, dev.place); + /* SYMLINK="name" */ + temp2 = strsep(&temp, ","); + retval = get_value("SYMLINK", &temp, &temp3); + if (retval == 0) + strfieldcpy(dev.symlink, temp3); + + dbg_parse("TOPOLOGY name='%s', bus='%s', " + "place='%s', symlink='%s'", + dev.name, dev.bus, dev.place, dev.symlink); } if (strcasecmp(temp2, TYPE_REPLACE) == 0) { @@ -291,9 +310,17 @@ int namedev_init_rules(void) if (retval) break; strfieldcpy(dev.name, temp3); - dbg_parse("REPLACE name='%s', kernel_name='%s'", - dev.name, dev.kernel_name); + + /* SYMLINK="name" */ + temp2 = strsep(&temp, ","); + retval = get_value("SYMLINK", &temp, &temp3); + if (retval == 0) + strfieldcpy(dev.symlink, temp3); + + dbg_parse("REPLACE name='%s', kernel_name='%s', symlink='%s'", + dev.name, dev.kernel_name, dev.symlink); } + if (strcasecmp(temp2, TYPE_CALLOUT) == 0) { /* number type */ dev.type = CALLOUT; @@ -324,8 +351,17 @@ int namedev_init_rules(void) if (retval) break; strfieldcpy(dev.name, temp3); - dbg_parse("CALLOUT name='%s', program='%s'", - dev.name, dev.exec_program); + + /* SYMLINK="name" */ + temp2 = strsep(&temp, ","); + retval = get_value("SYMLINK", &temp, &temp3); + if (retval == 0) + strfieldcpy(dev.symlink, temp3); + + dbg_parse("CALLOUT name='%s', bus='%s', program='%s', " + "id='%s', symlink='%s'", + dev.name, dev.bus, dev.exec_program, + dev.id, dev.symlink); } retval = add_config_dev(&dev); @@ -414,7 +450,7 @@ int namedev_init_permissions(void) dev.mode); retval = add_perm_dev(&dev); if (retval) { - dbg("add_config_dev returned with error %d", retval); + dbg("add_perm_dev returned with error %d", retval); goto exit; } } diff --git a/test/udev-test.pl b/test/udev-test.pl index b1757ee1bb..190b7ce4d6 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -39,7 +39,7 @@ my @tests = ( expected => "boot_disk" , conf => < "symlink creation (same directory)", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor0" , + conf => < "symlink creation (relative link back)", + subsys => "block", + devpath => "block/sda/sda2", + expected => "1/2/a/b/symlink" , + conf => < "symlink creation (relative link forward)", + subsys => "block", + devpath => "block/sda/sda2", + expected => "1/2/symlink" , + conf => < "symlink creation (relative link back and forward)", + subsys => "block", + devpath => "block/sda/sda2", + expected => "1/2/c/d/symlink" , + conf => <{subsys}, $config->{devpath}, \$config->{conf}); - if (-e "$PWD/$udev_root$config->{expected}") { + if ((-e "$PWD/$udev_root$config->{expected}") || + (-l "$PWD/$udev_root$config->{expected}")) { print "remove: error\n\n"; system("tree $udev_root"); $error++; diff --git a/udev-add.c b/udev-add.c index a71d435e32..ddf432bbc7 100644 --- a/udev-add.c +++ b/udev-add.c @@ -72,6 +72,34 @@ exit: return retval; } +static int create_path(char *file) +{ + char p[NAME_SIZE]; + char *pos; + int retval; + struct stat stats; + + strncpy(p, file, sizeof(p)); + pos = strchr(p+1, '/'); + while (1) { + pos = strchr(pos+1, '/'); + if (pos == NULL) + break; + *pos = 0x00; + if (stat(p, &stats)) { + retval = mkdir(p, 0755); + if (retval) { + dbg("mkdir(%s) failed with error '%s'", + p, strerror(errno)); + return retval; + } + dbg("created '%s'", p); + } + *pos = '/'; + } + return 0; +} + /* * we possibly want to add some symlinks here * only numeric owner/group id's are supported @@ -79,10 +107,14 @@ exit: static int create_node(struct udevice *dev) { char filename[255]; + char linktarget[255]; int retval = 0; uid_t uid = 0; gid_t gid = 0; dev_t res; + int i; + int tail; + strncpy(filename, udev_root, sizeof(filename)); strncat(filename, dev->name, sizeof(filename)); @@ -109,31 +141,9 @@ static int create_node(struct udevice *dev) return -EINVAL; } - /* create subdirectories if requested */ - if (strchr(dev->name, '/')) { - char path[255]; - char *pos; - struct stat stats; - - strncpy(path, filename, sizeof(path)); - pos = strchr(path+1, '/'); - while (1) { - pos = strchr(pos+1, '/'); - if (pos == NULL) - break; - *pos = 0x00; - if (stat(path, &stats)) { - retval = mkdir(path, 0755); - if (retval) { - dbg("mkdir(%s) failed with error '%s'", - path, strerror(errno)); - return retval; - } - dbg("created '%s'", path); - } - *pos = '/'; - } - } + /* create parent directories if needed */ + if (strrchr(dev->name, '/')) + create_path(filename); dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor); retval = mknod(filename, dev->mode, res); @@ -179,8 +189,43 @@ static int create_node(struct udevice *dev) dbg("chown(%s, %u, %u)", filename, uid, gid); retval = chown(filename, uid, gid); if (retval) - dbg("chown(%s, %u, %u) failed with error '%s'", filename, - uid, gid, strerror(errno)); + dbg("chown(%s, %u, %u) failed with error '%s'", + filename, uid, gid, strerror(errno)); + } + + + /* create symlink if requested */ + if (*dev->symlink) { + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, dev->symlink, sizeof(filename)); + dbg("symlink '%s' to node '%s' requested", filename, dev->name); + if (strrchr(dev->symlink, '/')) + create_path(filename); + + /* optimize relative link */ + linktarget[0] = '\0'; + i = 0; + tail = 0; + while ((dev->name[i] == dev->symlink[i]) && dev->name[i]) { + if (dev->name[i] == '/') + tail = i+1; + i++; + } + while (dev->symlink[i]) { + if (dev->symlink[i] == '/') + strcat(linktarget, "../"); + i++; + } + + if (*linktarget == '\0') + strcpy(linktarget, "./"); + strcat(linktarget, &dev->name[tail]); + + dbg("symlink(%s, %s)", linktarget, filename); + retval = symlink(linktarget, filename); + if (retval) + dbg("symlink(%s, %s) failed with error '%s'", + linktarget, filename, strerror(errno)); } return retval; diff --git a/udev-remove.c b/udev-remove.c index 0f14a3d685..d42ed4be78 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -34,47 +34,43 @@ #include "udevdb.h" #include "libsysfs/libsysfs.h" - -/* - * Look up the sysfs path in the database to see if we have named this device - * something different from the kernel name. If we have, us it. If not, use - * the default kernel name for lack of anything else to know to do. - */ -static char *get_name(char *path, int major, int minor) +static int delete_path(char *path) { - static char name[100]; - struct udevice *dev; - char *temp; + char *pos; + int retval; - dev = udevdb_get_dev(path); - if (dev != NULL) { - strcpy(name, dev->name); - goto exit; + pos = strrchr(path, '/'); + while (1) { + *pos = '\0'; + pos = strrchr(path, '/'); + + /* don't remove the last one */ + if ((pos == path) || (pos == NULL)) + break; + + /* remove if empty */ + retval = rmdir(path); + if (retval) { + if (errno == ENOTEMPTY) + return 0; + dbg("rmdir(%s) failed with error '%s'", + path, strerror(errno)); + break; + } + dbg("removed '%s'", path); } - - dbg("'%s' not found in database, falling back on default name", path); - temp = strrchr(path, '/'); - if (temp == NULL) - return NULL; - strncpy(name, &temp[1], sizeof(name)); - -exit: - dbg("name is '%s'", name); - return &name[0]; + return 0; } -/* - * We also want to clean up any symlinks that were created in create_node() - */ -static int delete_node(char *name) +static int delete_node(struct udevice *dev) { char filename[255]; int retval; strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, name, sizeof(filename)); + strncat(filename, dev->name, sizeof(filename)); - dbg("unlinking '%s'", filename); + dbg("unlinking node '%s'", filename); retval = unlink(filename); if (retval) { dbg("unlink(%s) failed with error '%s'", @@ -83,49 +79,48 @@ static int delete_node(char *name) } /* remove subdirectories */ - if (strchr(name, '/')) { - char *pos; - - pos = strrchr(filename, '/'); - while (1) { - *pos = 0x00; - pos = strrchr(filename, '/'); - - /* don't remove the last one */ - if ((pos == filename) || (pos == NULL)) - break; - - /* remove if empty */ - retval = rmdir(filename); - if (retval) { - if (errno == ENOTEMPTY) - return 0; - dbg("rmdir(%s) failed with error '%s'", - filename, strerror(errno)); - break; - } - dbg("removed '%s'", filename); + if (strchr(dev->name, '/')) + delete_path(filename); + + if (*dev->symlink) { + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, dev->symlink, sizeof(filename)); + dbg("unlinking symlink '%s'", filename); + retval = unlink(filename); + if (retval) { + dbg("unlink(%s) failed with error '%s'", + filename, strerror(errno)); + return retval; + } + if (strchr(dev->symlink, '/')) { + delete_path(filename); } } + return retval; } -int udev_remove_device(char *device, char *subsystem) +/* + * Look up the sysfs path in the database to see if we have named this device + * something different from the kernel name. If we have, us it. If not, use + * the default kernel name for lack of anything else to know to do. + */ +int udev_remove_device(char *path, char *subsystem) { - char *name; - int retval = 0; + char name[100]; + struct udevice *dev; + char *temp; - name = get_name(device, 0, 0); - if (name == NULL) { - dbg ("get_name failed"); - retval = -ENODEV; - goto exit; + dev = udevdb_get_dev(path); + if (dev == NULL) { + dbg("'%s' not found in database, falling back on default name", path); + temp = strrchr(path, '/'); + if (temp == NULL) + return -ENODEV; + strncpy(name, &temp[1], sizeof(name)); } - udevdb_delete_dev(device); - - return delete_node(name); - -exit: - return retval; + dbg("name is '%s'", dev->name); + udevdb_delete_dev(path); + return delete_node(dev); } diff --git a/udev.h b/udev.h index 01db449481..05f6b3c225 100644 --- a/udev.h +++ b/udev.h @@ -64,6 +64,7 @@ struct udevice { int major; int minor; mode_t mode; + char symlink[NAME_SIZE]; /* fields that help us in building strings */ unsigned char bus_id[SYSFS_NAME_LEN]; -- cgit v1.2.3-54-g00ecf From 5aebfbcb62614fc2bf2b1579d62e3fe272c6751a Mon Sep 17 00:00:00 2001 From: "david@fubar.dk" Date: Mon, 8 Dec 2003 09:19:19 -0800 Subject: [PATCH] D-BUS patch for udev-008 Attached is a patch against udev-008 to send out a D-BUS message when a device node is added or removed. Using D-BUS lingo, udev acquires the org.kernel.udev service and sends out a NodeCreated or NodeDeleted signal on the org.kernel.udev.NodeMonitor interface. Each signal carries two parameters: the node in question and the corresponding sysfs path. [Note: the D-BUS concepts of service, interface, object can be a bit confusing at first glance] An example program listening for these messages looks like this #!/usr/bin/python import dbus import gtk def udev_signal_received(dbus_iface, member, service, object_path, message): [filename, sysfs_path] = message.get_args_list() if member=='NodeCreated': print 'Node %s created for %s'%(filename, sysfs_path) elif member=='NodeDeleted': print 'Node %s deleted for %s'%(filename, sysfs_path) def main(): bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) bus.add_signal_receiver(udev_signal_received, 'org.kernel.udev.NodeMonitor', # interface 'org.kernel.udev', # service '/org/kernel/udev/NodeMonitor') # object gtk.mainloop() if __name__ == '__main__': main() and this is the output when hot-plugging some usb-storage. [david@laptop udev-008]$ ~/node_monitor.py Node /udev/sda created for /block/sda Node /udev/sda1 created for /block/sda/sda1 Node /udev/sda1 deleted for /block/sda/sda1 Node /udev/sda deleted for /block/sda The patch requires D-BUS 0.20 or later while the python example program requires D-BUS from CVS as I only recently applied a patch against the python bindings. --- Makefile | 29 ++++++++++++++++++++-- TODO | 1 - udev-add.c | 42 ++++++++++++++++++++++++++++++++ udev-remove.c | 41 +++++++++++++++++++++++++++++++ udev.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ udev.h | 9 +++++++ udev_sysbus_policy.conf | 23 ++++++++++++++++++ 7 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 udev_sysbus_policy.conf diff --git a/Makefile b/Makefile index aa1d45bdb7..c50bd04824 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,10 @@ # Leave this set to `false' for production use. DEBUG = false +# Set the following to `true' to make udev emit a D-BUS signal when a +# new node is created. +USE_DBUS = true + ROOT = udev VERSION = 008_bk @@ -34,6 +38,7 @@ etcdir = ${prefix}/etc sbindir = ${exec_prefix}/sbin mandir = ${prefix}/usr/share/man hotplugdir = ${etcdir}/hotplug.d/default +dbusdir = ${etcdir}/dbus-1/system.d configdir = ${etcdir}/udev/ srcdir = . @@ -138,6 +143,13 @@ endif CFLAGS += -I$(PWD)/libsysfs +ifeq ($(USE_DBUS), true) + CFLAGS += -DUSE_DBUS + CFLAGS += $(shell pkg-config --cflags dbus-1) + LIB_OBJS += $(shell pkg-config --libs-only-l dbus-1) +endif + + all: $(ROOT) @for target in $(EXTRAS) ; do \ echo $$target ; \ @@ -240,7 +252,20 @@ small_release: $(DISTFILES) clean @echo "Built $(RELEASE_NAME).tar.gz" -install: all +ifeq ($(USE_DBUS), true) +install-dbus-policy: + $(INSTALL) -d $(DESTDIR)$(dbusdir) + $(INSTALL_DATA) udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) +uninstall-dbus-policy: + - rm $(DESTDIR)$(dbusdir)/udev_sysbus_policy.conf +else +install-dbus-policy: + - +uninstall-dbus-policy: + - +endif + +install: install-dbus-policy all $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(configdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) @@ -257,7 +282,7 @@ install: all -C $$target $@ ; \ done ; \ -uninstall: +uninstall: uninstall-dbus-policy - rm $(hotplugdir)/udev.hotplug - rm $(configdir)/udev.permissions - rm $(configdir)/udev.rules diff --git a/TODO b/TODO index d5cc9194e6..e227834f36 100644 --- a/TODO +++ b/TODO @@ -21,7 +21,6 @@ greg@kroah.com will have an upgrade path. - do early boot logic (putting udev into initramfs, handle pivot-root, etc.) -- add hooks to call D-BUS when new node is created or removed - lots of other stuff... - actually use the BUS= value to determine where the LABEL rule should look (right now it's ignored, and we only look in the current sysfs directory.) diff --git a/udev-add.c b/udev-add.c index ddf432bbc7..174331fade 100644 --- a/udev-add.c +++ b/udev-add.c @@ -100,6 +100,42 @@ static int create_path(char *file) return 0; } +#ifdef USE_DBUS +/** Send out a signal that a device node is created + * + * @param dev udevice object + * @param path Sysfs path of device + */ +static void sysbus_send_create(struct udevice *dev, const char *path) +{ + char filename[255]; + DBusMessage* message; + DBusMessageIter iter; + + if (sysbus_connection == NULL) + return; + + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, dev->name, sizeof(filename)); + + /* object, interface, member */ + message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", + "org.kernel.udev.NodeMonitor", + "NodeCreated"); + + dbus_message_iter_init(message, &iter); + dbus_message_iter_append_string(&iter, filename); + dbus_message_iter_append_string(&iter, path); + + if ( !dbus_connection_send(sysbus_connection, message, NULL) ) + dbg("error sending d-bus signal"); + + dbus_message_unref(message); + + dbus_connection_flush(sysbus_connection); +} +#endif /* USE_DBUS */ + /* * we possibly want to add some symlinks here * only numeric owner/group id's are supported @@ -323,6 +359,12 @@ int udev_add_device(char *path, char *subsystem) dbg("name='%s'", dev.name); retval = create_node(&dev); +#ifdef USE_DBUS + if (retval == 0) { + sysbus_send_create(&dev, path); + } +#endif /* USE_DBUS */ + exit: if (class_dev) sysfs_close_class_device(class_dev); diff --git a/udev-remove.c b/udev-remove.c index d42ed4be78..307b907c88 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -100,6 +100,42 @@ static int delete_node(struct udevice *dev) return retval; } +#ifdef USE_DBUS +/** Send out a signal that a device node is deleted + * + * @param name Name of the device node, e.g. /udev/sda1 + * @param path Sysfs path of device + */ +static void sysbus_send_remove(const char* name, const char *path) +{ + char filename[255]; + DBusMessage* message; + DBusMessageIter iter; + + if (sysbus_connection == NULL) + return; + + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, name, sizeof(filename)); + + /* object, interface, member */ + message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", + "org.kernel.udev.NodeMonitor", + "NodeDeleted"); + + dbus_message_iter_init(message, &iter); + dbus_message_iter_append_string(&iter, filename); + dbus_message_iter_append_string(&iter, path); + + if ( !dbus_connection_send(sysbus_connection, message, NULL) ) + dbg("error sending d-bus signal"); + + dbus_message_unref(message); + + dbus_connection_flush(sysbus_connection); +} +#endif /* USE_DBUS */ + /* * Look up the sysfs path in the database to see if we have named this device * something different from the kernel name. If we have, us it. If not, use @@ -122,5 +158,10 @@ int udev_remove_device(char *path, char *subsystem) dbg("name is '%s'", dev->name); udevdb_delete_dev(path); + +#ifdef USE_DBUS + sysbus_send_remove(name, device); +#endif /* USE_DBUS */ + return delete_node(dev); } diff --git a/udev.c b/udev.c index bf18a568ea..67b86e5916 100644 --- a/udev.c +++ b/udev.c @@ -63,6 +63,60 @@ static inline char *get_seqnum(void) return seqnum; } +#ifdef USE_DBUS + +/** Global variable for the connection the to system message bus or #NULL + * if we cannot connect or acquire the org.kernel.udev service + */ +DBusConnection* sysbus_connection; + +/** Disconnect from the system message bus */ +static void sysbus_disconnect() +{ + if (sysbus_connection == NULL) + return; + + dbus_connection_disconnect(sysbus_connection); + sysbus_connection = NULL; +} + +/** Connect to the system message bus */ +static void sysbus_connect() +{ + DBusError error; + + /* Connect to a well-known bus instance, the system bus */ + dbus_error_init(&error); + sysbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); + if (sysbus_connection == NULL) { + dbg("cannot connect to system message bus, error %s: %s", + error.name, error.message); + dbus_error_free(&error); + return; + } + + /* Acquire the org.kernel.udev service such that listeners + * know that the message is really from us and not from a + * random attacker. See the file udev_sysbus_policy.conf for + * details. + * + * Note that a service can have multiple owners (though there + * is a concept of a primary owner for reception of messages) + * so no race is introduced if two copies of udev is running + * at the same time. + */ + dbus_bus_acquire_service(sysbus_connection, "org.kernel.udev", 0, + &error); + if (dbus_error_is_set(&error)) { + printf("cannot acquire org.kernel.udev service, error %s: %s'", + error.name, error.message); + sysbus_disconnect(); + return; + } +} + +#endif /* USE_DBUS */ + int main(int argc, char **argv, char **envp) { char *action; @@ -111,6 +165,11 @@ int main(int argc, char **argv, char **envp) /* initialize our configuration */ udev_init_config(); +#ifdef USE_DBUS + /* connect to the system message bus */ + sysbus_connect(); +#endif /* USE_DBUS */ + /* initialize udev database */ retval = udevdb_init(UDEVDB_DEFAULT); if (retval != 0) { @@ -133,6 +192,11 @@ int main(int argc, char **argv, char **envp) } udevdb_exit(); +#ifdef USE_DBUS + /* disconnect from the system message bus */ + sysbus_disconnect(); +#endif /* USE_DBUS */ + exit: return retval; } diff --git a/udev.h b/udev.h index 05f6b3c225..4ea04d5e71 100644 --- a/udev.h +++ b/udev.h @@ -93,4 +93,13 @@ extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; extern char default_mode_str[NAME_MAX]; +#ifdef USE_DBUS + +#define DBUS_API_SUBJECT_TO_CHANGE +#include + +extern DBusConnection* sysbus_connection; + +#endif /* USE_DBUS */ + #endif diff --git a/udev_sysbus_policy.conf b/udev_sysbus_policy.conf new file mode 100644 index 0000000000..b2660e65cf --- /dev/null +++ b/udev_sysbus_policy.conf @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + -- cgit v1.2.3-54-g00ecf From 7ac0feeb6044470569d7ece5d34a76acdb03fc64 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 8 Dec 2003 09:40:40 -0800 Subject: [PATCH] move all of the DBUS logic into one file and remove all of the #ifdef crud from the main code. --- udev-add.c | 44 ++------------------ udev-remove.c | 43 ++------------------ udev.c | 69 +++----------------------------- udev.h | 9 ----- udev_dbus.c | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev_dbus.h | 23 +++++++++++ 6 files changed, 161 insertions(+), 153 deletions(-) create mode 100644 udev_dbus.c create mode 100644 udev_dbus.h diff --git a/udev-add.c b/udev-add.c index 174331fade..8d45b26077 100644 --- a/udev-add.c +++ b/udev-add.c @@ -36,6 +36,7 @@ #include "udev.h" #include "udev_version.h" +#include "udev_dbus.h" #include "namedev.h" #include "udevdb.h" #include "libsysfs/libsysfs.h" @@ -100,42 +101,6 @@ static int create_path(char *file) return 0; } -#ifdef USE_DBUS -/** Send out a signal that a device node is created - * - * @param dev udevice object - * @param path Sysfs path of device - */ -static void sysbus_send_create(struct udevice *dev, const char *path) -{ - char filename[255]; - DBusMessage* message; - DBusMessageIter iter; - - if (sysbus_connection == NULL) - return; - - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, dev->name, sizeof(filename)); - - /* object, interface, member */ - message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", - "org.kernel.udev.NodeMonitor", - "NodeCreated"); - - dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, filename); - dbus_message_iter_append_string(&iter, path); - - if ( !dbus_connection_send(sysbus_connection, message, NULL) ) - dbg("error sending d-bus signal"); - - dbus_message_unref(message); - - dbus_connection_flush(sysbus_connection); -} -#endif /* USE_DBUS */ - /* * we possibly want to add some symlinks here * only numeric owner/group id's are supported @@ -359,11 +324,8 @@ int udev_add_device(char *path, char *subsystem) dbg("name='%s'", dev.name); retval = create_node(&dev); -#ifdef USE_DBUS - if (retval == 0) { - sysbus_send_create(&dev, path); - } -#endif /* USE_DBUS */ + if (retval == 0) + sysbus_send_create(&dev, path); exit: if (class_dev) diff --git a/udev-remove.c b/udev-remove.c index 307b907c88..02c84371a4 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -30,6 +30,7 @@ #include "udev.h" #include "udev_version.h" +#include "udev_dbus.h" #include "namedev.h" #include "udevdb.h" #include "libsysfs/libsysfs.h" @@ -100,42 +101,6 @@ static int delete_node(struct udevice *dev) return retval; } -#ifdef USE_DBUS -/** Send out a signal that a device node is deleted - * - * @param name Name of the device node, e.g. /udev/sda1 - * @param path Sysfs path of device - */ -static void sysbus_send_remove(const char* name, const char *path) -{ - char filename[255]; - DBusMessage* message; - DBusMessageIter iter; - - if (sysbus_connection == NULL) - return; - - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, name, sizeof(filename)); - - /* object, interface, member */ - message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", - "org.kernel.udev.NodeMonitor", - "NodeDeleted"); - - dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, filename); - dbus_message_iter_append_string(&iter, path); - - if ( !dbus_connection_send(sysbus_connection, message, NULL) ) - dbg("error sending d-bus signal"); - - dbus_message_unref(message); - - dbus_connection_flush(sysbus_connection); -} -#endif /* USE_DBUS */ - /* * Look up the sysfs path in the database to see if we have named this device * something different from the kernel name. If we have, us it. If not, use @@ -159,9 +124,7 @@ int udev_remove_device(char *path, char *subsystem) dbg("name is '%s'", dev->name); udevdb_delete_dev(path); -#ifdef USE_DBUS - sysbus_send_remove(name, device); -#endif /* USE_DBUS */ - + sysbus_send_remove(name, path); + return delete_node(dev); } diff --git a/udev.c b/udev.c index 67b86e5916..ac29ec6f44 100644 --- a/udev.c +++ b/udev.c @@ -31,6 +31,7 @@ #include "udev.h" #include "udev_version.h" +#include "udev_dbus.h" #include "namedev.h" #include "udevdb.h" #include "libsysfs/libsysfs.h" @@ -63,60 +64,6 @@ static inline char *get_seqnum(void) return seqnum; } -#ifdef USE_DBUS - -/** Global variable for the connection the to system message bus or #NULL - * if we cannot connect or acquire the org.kernel.udev service - */ -DBusConnection* sysbus_connection; - -/** Disconnect from the system message bus */ -static void sysbus_disconnect() -{ - if (sysbus_connection == NULL) - return; - - dbus_connection_disconnect(sysbus_connection); - sysbus_connection = NULL; -} - -/** Connect to the system message bus */ -static void sysbus_connect() -{ - DBusError error; - - /* Connect to a well-known bus instance, the system bus */ - dbus_error_init(&error); - sysbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); - if (sysbus_connection == NULL) { - dbg("cannot connect to system message bus, error %s: %s", - error.name, error.message); - dbus_error_free(&error); - return; - } - - /* Acquire the org.kernel.udev service such that listeners - * know that the message is really from us and not from a - * random attacker. See the file udev_sysbus_policy.conf for - * details. - * - * Note that a service can have multiple owners (though there - * is a concept of a primary owner for reception of messages) - * so no race is introduced if two copies of udev is running - * at the same time. - */ - dbus_bus_acquire_service(sysbus_connection, "org.kernel.udev", 0, - &error); - if (dbus_error_is_set(&error)) { - printf("cannot acquire org.kernel.udev service, error %s: %s'", - error.name, error.message); - sysbus_disconnect(); - return; - } -} - -#endif /* USE_DBUS */ - int main(int argc, char **argv, char **envp) { char *action; @@ -165,10 +112,8 @@ int main(int argc, char **argv, char **envp) /* initialize our configuration */ udev_init_config(); -#ifdef USE_DBUS - /* connect to the system message bus */ - sysbus_connect(); -#endif /* USE_DBUS */ + /* connect to the system message bus */ + sysbus_connect(); /* initialize udev database */ retval = udevdb_init(UDEVDB_DEFAULT); @@ -192,11 +137,9 @@ int main(int argc, char **argv, char **envp) } udevdb_exit(); -#ifdef USE_DBUS - /* disconnect from the system message bus */ - sysbus_disconnect(); -#endif /* USE_DBUS */ + /* disconnect from the system message bus */ + sysbus_disconnect(); -exit: +exit: return retval; } diff --git a/udev.h b/udev.h index 4ea04d5e71..05f6b3c225 100644 --- a/udev.h +++ b/udev.h @@ -93,13 +93,4 @@ extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; extern char default_mode_str[NAME_MAX]; -#ifdef USE_DBUS - -#define DBUS_API_SUBJECT_TO_CHANGE -#include - -extern DBusConnection* sysbus_connection; - -#endif /* USE_DBUS */ - #endif diff --git a/udev_dbus.c b/udev_dbus.c new file mode 100644 index 0000000000..57685163c5 --- /dev/null +++ b/udev_dbus.c @@ -0,0 +1,126 @@ +#define DBUS_API_SUBJECT_TO_CHANGE +#include + +#include "udev_dbus.h" + + +/** variable for the connection the to system message bus or #NULL + * if we cannot connect or acquire the org.kernel.udev service + */ +static DBusConnection* sysbus_connection; + +/** Disconnect from the system message bus */ +void sysbus_disconnect(void) +{ + if (sysbus_connection == NULL) + return; + + dbus_connection_disconnect(sysbus_connection); + sysbus_connection = NULL; +} + +/** Connect to the system message bus */ +void sysbus_connect(void) +{ + DBusError error; + + /* Connect to a well-known bus instance, the system bus */ + dbus_error_init(&error); + sysbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); + if (sysbus_connection == NULL) { + dbg("cannot connect to system message bus, error %s: %s", + error.name, error.message); + dbus_error_free(&error); + return; + } + + /* Acquire the org.kernel.udev service such that listeners + * know that the message is really from us and not from a + * random attacker. See the file udev_sysbus_policy.conf for + * details. + * + * Note that a service can have multiple owners (though there + * is a concept of a primary owner for reception of messages) + * so no race is introduced if two copies of udev is running + * at the same time. + */ + dbus_bus_acquire_service(sysbus_connection, "org.kernel.udev", 0, + &error); + if (dbus_error_is_set(&error)) { + printf("cannot acquire org.kernel.udev service, error %s: %s'", + error.name, error.message); + sysbus_disconnect(); + return; + } +} + + +/** Send out a signal that a device node is created + * + * @param dev udevice object + * @param path Sysfs path of device + */ +void sysbus_send_create(struct udevice *dev, const char *path) +{ + char filename[255]; + DBusMessage* message; + DBusMessageIter iter; + + if (sysbus_connection == NULL) + return; + + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, dev->name, sizeof(filename)); + + /* object, interface, member */ + message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", + "org.kernel.udev.NodeMonitor", + "NodeCreated"); + + dbus_message_iter_init(message, &iter); + dbus_message_iter_append_string(&iter, filename); + dbus_message_iter_append_string(&iter, path); + + if ( !dbus_connection_send(sysbus_connection, message, NULL) ) + dbg("error sending d-bus signal"); + + dbus_message_unref(message); + + dbus_connection_flush(sysbus_connection); +} + +/** Send out a signal that a device node is deleted + * + * @param name Name of the device node, e.g. /udev/sda1 + * @param path Sysfs path of device + */ +void sysbus_send_remove(const char* name, const char *path) +{ + char filename[255]; + DBusMessage* message; + DBusMessageIter iter; + + if (sysbus_connection == NULL) + return; + + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, name, sizeof(filename)); + + /* object, interface, member */ + message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", + "org.kernel.udev.NodeMonitor", + "NodeDeleted"); + + dbus_message_iter_init(message, &iter); + dbus_message_iter_append_string(&iter, filename); + dbus_message_iter_append_string(&iter, path); + + if ( !dbus_connection_send(sysbus_connection, message, NULL) ) + dbg("error sending d-bus signal"); + + dbus_message_unref(message); + + dbus_connection_flush(sysbus_connection); +} + + diff --git a/udev_dbus.h b/udev_dbus.h new file mode 100644 index 0000000000..afa2046548 --- /dev/null +++ b/udev_dbus.h @@ -0,0 +1,23 @@ +#ifndef UDEV_DBUS_H +#define UDEV_DBUS_H + + +#ifdef USE_DBUS + +extern void sysbus_connect(void); +extern void sysbus_disconnect(void); +extern void sysbus_send_create(struct udevice *dev, const char *path); +extern void sysbus_send_remove(const char* name, const char *path); + +#else + +static inline void sysbus_connect(void) { } +static inline void sysbus_disconnect(void) { } +static inline void sysbus_send_create(struct udevice *dev, const char *path) { } +static inline void sysbus_send_remove(const char* name, const char *path) { } + +#endif /* USE_DBUS */ + + + +#endif -- cgit v1.2.3-54-g00ecf From 8e15f01dc8e25eca49b99e97059dccf793e6c4d4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 8 Dec 2003 18:01:28 -0800 Subject: [PATCH] fix formatting of udev_dbus.c to use tabs. Also get it to build properly now. --- udev_dbus.c | 178 +++++++++++++++++++++++++++++++----------------------------- 1 file changed, 93 insertions(+), 85 deletions(-) diff --git a/udev_dbus.c b/udev_dbus.c index 57685163c5..947a5c1b5d 100644 --- a/udev_dbus.c +++ b/udev_dbus.c @@ -1,6 +1,16 @@ +#include +#include +#include +#include +#include +#include +#include + #define DBUS_API_SUBJECT_TO_CHANGE #include +#include "udev.h" +#include "udev_version.h" #include "udev_dbus.h" @@ -12,46 +22,46 @@ static DBusConnection* sysbus_connection; /** Disconnect from the system message bus */ void sysbus_disconnect(void) { - if (sysbus_connection == NULL) - return; + if (sysbus_connection == NULL) + return; - dbus_connection_disconnect(sysbus_connection); - sysbus_connection = NULL; + dbus_connection_disconnect(sysbus_connection); + sysbus_connection = NULL; } /** Connect to the system message bus */ void sysbus_connect(void) { - DBusError error; - - /* Connect to a well-known bus instance, the system bus */ - dbus_error_init(&error); - sysbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); - if (sysbus_connection == NULL) { - dbg("cannot connect to system message bus, error %s: %s", - error.name, error.message); - dbus_error_free(&error); - return; - } - - /* Acquire the org.kernel.udev service such that listeners - * know that the message is really from us and not from a - * random attacker. See the file udev_sysbus_policy.conf for - * details. - * - * Note that a service can have multiple owners (though there - * is a concept of a primary owner for reception of messages) - * so no race is introduced if two copies of udev is running - * at the same time. - */ - dbus_bus_acquire_service(sysbus_connection, "org.kernel.udev", 0, - &error); - if (dbus_error_is_set(&error)) { - printf("cannot acquire org.kernel.udev service, error %s: %s'", - error.name, error.message); - sysbus_disconnect(); - return; - } + DBusError error; + + /* Connect to a well-known bus instance, the system bus */ + dbus_error_init(&error); + sysbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); + if (sysbus_connection == NULL) { + dbg("cannot connect to system message bus, error %s: %s", + error.name, error.message); + dbus_error_free(&error); + return; + } + + /* Acquire the org.kernel.udev service such that listeners + * know that the message is really from us and not from a + * random attacker. See the file udev_sysbus_policy.conf for + * details. + * + * Note that a service can have multiple owners (though there + * is a concept of a primary owner for reception of messages) + * so no race is introduced if two copies of udev is running + * at the same time. + */ + dbus_bus_acquire_service(sysbus_connection, "org.kernel.udev", 0, + &error); + if (dbus_error_is_set(&error)) { + printf("cannot acquire org.kernel.udev service, error %s: %s'", + error.name, error.message); + sysbus_disconnect(); + return; + } } @@ -62,31 +72,31 @@ void sysbus_connect(void) */ void sysbus_send_create(struct udevice *dev, const char *path) { - char filename[255]; - DBusMessage* message; - DBusMessageIter iter; - - if (sysbus_connection == NULL) - return; - - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, dev->name, sizeof(filename)); - - /* object, interface, member */ - message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", - "org.kernel.udev.NodeMonitor", - "NodeCreated"); - - dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, filename); - dbus_message_iter_append_string(&iter, path); - - if ( !dbus_connection_send(sysbus_connection, message, NULL) ) - dbg("error sending d-bus signal"); - - dbus_message_unref(message); - - dbus_connection_flush(sysbus_connection); + char filename[255]; + DBusMessage* message; + DBusMessageIter iter; + + if (sysbus_connection == NULL) + return; + + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, dev->name, sizeof(filename)); + + /* object, interface, member */ + message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", + "org.kernel.udev.NodeMonitor", + "NodeCreated"); + + dbus_message_iter_init(message, &iter); + dbus_message_iter_append_string(&iter, filename); + dbus_message_iter_append_string(&iter, path); + + if ( !dbus_connection_send(sysbus_connection, message, NULL) ) + dbg("error sending d-bus signal"); + + dbus_message_unref(message); + + dbus_connection_flush(sysbus_connection); } /** Send out a signal that a device node is deleted @@ -96,31 +106,29 @@ void sysbus_send_create(struct udevice *dev, const char *path) */ void sysbus_send_remove(const char* name, const char *path) { - char filename[255]; - DBusMessage* message; - DBusMessageIter iter; - - if (sysbus_connection == NULL) - return; - - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, name, sizeof(filename)); - - /* object, interface, member */ - message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", - "org.kernel.udev.NodeMonitor", - "NodeDeleted"); - - dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, filename); - dbus_message_iter_append_string(&iter, path); - - if ( !dbus_connection_send(sysbus_connection, message, NULL) ) - dbg("error sending d-bus signal"); - - dbus_message_unref(message); - - dbus_connection_flush(sysbus_connection); -} + char filename[255]; + DBusMessage* message; + DBusMessageIter iter; + + if (sysbus_connection == NULL) + return; + + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, name, sizeof(filename)); + + /* object, interface, member */ + message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", + "org.kernel.udev.NodeMonitor", + "NodeDeleted"); + dbus_message_iter_init(message, &iter); + dbus_message_iter_append_string(&iter, filename); + dbus_message_iter_append_string(&iter, path); + if ( !dbus_connection_send(sysbus_connection, message, NULL) ) + dbg("error sending d-bus signal"); + + dbus_message_unref(message); + + dbus_connection_flush(sysbus_connection); +} -- cgit v1.2.3-54-g00ecf From bbd063b5c2aa055a707b472d4e0b1ed297d00674 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 8 Dec 2003 18:01:56 -0800 Subject: [PATCH] change USE_DBUS to DBUS in Makefile, and disable it by default as it's still to hard to build on all systems. --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index c50bd04824..ae9d276721 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = false # Set the following to `true' to make udev emit a D-BUS signal when a # new node is created. -USE_DBUS = true +DBUS = false ROOT = udev @@ -143,13 +143,6 @@ endif CFLAGS += -I$(PWD)/libsysfs -ifeq ($(USE_DBUS), true) - CFLAGS += -DUSE_DBUS - CFLAGS += $(shell pkg-config --cflags dbus-1) - LIB_OBJS += $(shell pkg-config --libs-only-l dbus-1) -endif - - all: $(ROOT) @for target in $(EXTRAS) ; do \ echo $$target ; \ @@ -190,6 +183,13 @@ ifeq ($(strip $(KLIBC)),true) OBJS += klibc_fixups.o endif +ifeq ($(DBUS), true) + CFLAGS += -DUSE_DBUS + CFLAGS += $(shell pkg-config --cflags dbus-1) + LIB_OBJS += $(shell pkg-config --libs-only-l dbus-1) + OBJS += udev_dbus.o +endif + # header files automatically generated GEN_HEADERS = udev_version.h @@ -252,7 +252,7 @@ small_release: $(DISTFILES) clean @echo "Built $(RELEASE_NAME).tar.gz" -ifeq ($(USE_DBUS), true) +ifeq ($(DBUS), true) install-dbus-policy: $(INSTALL) -d $(DESTDIR)$(dbusdir) $(INSTALL_DATA) udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) -- cgit v1.2.3-54-g00ecf From 7d27ce1dc005b3972ab7ed77a86f6333c2f8ee9f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 8 Dec 2003 18:08:52 -0800 Subject: [PATCH] document the different Makefile config options that we have. --- README | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/README b/README index fffa793987..94a397936e 100644 --- a/README +++ b/README @@ -25,6 +25,27 @@ To use: - Build the project: make + Note: + There are a number of different flags that you can use when building + udev. They are as follows: + prefix - set this to the default root that you want udev to be + installed into. This works just like the 'configure --prefix' + script does. Default value is ''. Only override this if you + really know what you are doing. + KLIBC - if set to 'true', udev is built and linked against the included + version of klibc. Default value is 'false'. + DEBUG - if set to 'true', debugging messages will be sent to the syslog + as udev is run. Default value is 'false'. + DBUS - if set to 'true', DBUS messages will be sent everytime udev + creates or removes a device node. This requires that DBUS + development headers and libraries be present on your system to + build properly. Default value is 'false'. + + So, if you want to build udev using klibc with debugging messages, you + would do: + make KLIBC=true DEBUG=true + + - Install the project: make install -- cgit v1.2.3-54-g00ecf From c6c13c31814e9fc7557ca303c331d0cf13664372 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 10 Dec 2003 00:30:43 -0800 Subject: [PATCH] cleanup man & remove symlink comment remove "want symlinks" text from udev-add.c mention SYMLINK in man page man page format cleanup man page example for SYMLINK --- udev-add.c | 9 --------- udev.8 | 59 ++++++++++++++++++++++++++++------------------------------- 2 files changed, 28 insertions(+), 40 deletions(-) diff --git a/udev-add.c b/udev-add.c index 8d45b26077..17b69eadab 100644 --- a/udev-add.c +++ b/udev-add.c @@ -54,18 +54,15 @@ static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) { int retval = -ENODEV; - char *dev; dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev"); if (dev == NULL) goto exit; - dbg("dev='%s'", dev); if (sscanf(dev, "%u:%u", &udev->major, &udev->minor) != 2) goto exit; - dbg("found major=%d, minor=%d", udev->major, udev->minor); retval = 0; @@ -101,10 +98,6 @@ static int create_path(char *file) return 0; } -/* - * we possibly want to add some symlinks here - * only numeric owner/group id's are supported - */ static int create_node(struct udevice *dev) { char filename[255]; @@ -116,7 +109,6 @@ static int create_node(struct udevice *dev) int i; int tail; - strncpy(filename, udev_root, sizeof(filename)); strncat(filename, dev->name, sizeof(filename)); @@ -239,7 +231,6 @@ static struct sysfs_class_device *get_class_dev(char *device_name) strcpy(dev_path, sysfs_path); strcat(dev_path, device_name); - dbg("looking at '%s'", dev_path); /* open up the sysfs class device for this thing... */ diff --git a/udev.8 b/udev.8 index 37b3b625e7..0c461967d2 100644 --- a/udev.8 +++ b/udev.8 @@ -63,7 +63,7 @@ permissions file. The default value for this is .I 0666 .br .P -A sample \fIudev.conf\fP might look like this: +.RI "A sample " udev.conf " might look like this: .sp .nf # udev_root - where in the filesystem to place the device nodes @@ -85,7 +85,7 @@ default_mode="0666" .P The rules for udev to use when naming devices may specified at .I /etc/udev/udev.rules -or specified by the +or specified by the .I udev_rules value in the .I /etc/udev/udev.conf @@ -94,73 +94,73 @@ file. Every line in the rules file define the mapping between device attributes and the device file name. It starts with a keyword defining the method used to match, followed by one ore more keys to compare and the filename for the -device. If no matching configuration is found, the default kernel device name +device. Optional the name for a symlink targeting the node may specified. +.br +If no matching configuration is found, the default kernel device name is used. .P The line format is: .sp -.I method, key,[key,...] name +.I method, key,[key,...] name [, symlink] .sp where valid methods with corresponding keys are: .TP .B CALLOUT calling external program, that returns a string to match .br -keys: \fBBUS\fP, \fBPROGRAM\fP, \fBID\fP +.RB "keys: " BUS ", " PROGRAM ", " ID .TP .B LABEL device label or serial number, like USB serial number, SCSI UUID or file system label .br -keys: \fBBUS\fP, \fIsysfs_attribute\fP +.RB "keys: " BUS ", " +.I sysfs_attribute .TP .B NUMBER device number on the bus, like PCI bus id .br -keys: \fBBUS\fP, \fBID\fP +.RB "keys: " BUS ", " ID .TP .B TOPOLOGY device position on bus, like physical port of USB device .br -keys: \fBBUS\fP, \fBPLACE\fP +.RB "keys: " BUS ", " PLACE .TP .B REPLACE string replacement of the kernel device name .br -key: \fBKERNEL_NAME\fP +.RB "key: " KERNEL_NAME .P The methods are applied in the following order: -.BR CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "." +.BR CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "." .P -The -.B NAME -and -.B PROGRAM +.RB "The " NAME " ," SYMLINK " and " PROGRAM fields support simple printf-like string substitution: .TP .B %n -the "kernel number" of the device +The "kernel number" of the device. for example, 'sda3' has a "kernel number" of '3' .TP .B %M -the kernel major number for the device +The kernel major number for the device. .TP .B %m -the kernel minor number for the device +The kernel minor number for the device. .TP .B %b -the bus id for the device +The bus id for the device. .TP .B %c -the CALLOUT program returned string -(this does not work within the PROGRAM field for the obvious reason.) +The CALLOUT program returned string. +(This does not work within the PROGRAM field for the obvious reason.) .TP .B %D Use the devfs style disk name for this device. For partitions, this will result in 'part%n' -If this is not a partition, it will result in 'disk' +If this is not a partition, it will result in 'disk'. .P -A sample \fIudev.rules\fP might look like this: +.RI "A sample " udev.rules " might look like this:" .sp .nf # if /sbin/scsi_id returns "OEM 0815" device will be called disk1 @@ -178,15 +178,15 @@ TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" # ttyUSB1 should always be called pda REPLACE, KERNEL="ttyUSB1", NAME="pda" -# USB webcams to be called webcam0, webcam1, ... -LABEL, BUS="usb", model="WebCam Version 3", NAME="webcam%n" +# USB webcams with symlinks to be called webcam0, webcam1, ... +LABEL, BUS="usb", model="WebCam Version 3", NAME="video%n", SYMLINK="webcam%n" .fi .P Permissions and ownership for the created device files may specified at .I /etc/udev/udev.permissions -or specified by the +or specified by the .I udev_permission -value in the +value in the .I /etc/udev/udev.conf file. .br @@ -197,10 +197,9 @@ pattern to apply the values to a whole class of devices. If .B udev was built using klibc or is used before the user database is accessible (e.g. -.B initrd -), only numeric owner and group values may be used. +.BR initrd "(4)), only numeric owner and group values may be used." .sp -A sample \fIudev.permissions\fP might look like this: +.RI "A sample " udev.permissions " might look like this:" .sp .nf #name:user:group:mode @@ -227,8 +226,6 @@ the range of all digits, the pattern [0-9] would be used. If the first character following the '[' is a '!' then any character not enclosed is matched. .SH "FILES" .nf -.ft B -.ft /sbin/udev udev program /etc/udev/* udev config files /etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program -- cgit v1.2.3-54-g00ecf From 10a479f5e6df7010a47f1edfab8173de85a34d0d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Dec 2003 00:37:02 -0800 Subject: [PATCH] update the FAQ due to the latest devfs mess on lkml and also due to symlinks now working. --- FAQ | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/FAQ b/FAQ index c082a5bec4..d9aebde0da 100644 --- a/FAQ +++ b/FAQ @@ -31,12 +31,25 @@ Q: But udev will not automatically load a driver if a /dev node is opened A: If you really require this functionality, then use devfs. It is still present in the kernel. -Q: But I really like the devfs naming scheme, will udev do that? +Q: But wait, I really want udev to automatically load drivers when they + are not present but the device node is opened. It's the only reason I + like using devfs. Please make udev do this. +A: No. udev is for managing /dev, not loading kernel drivers. + +Q: Oh come on, pretty please. It can't be that hard to do. +A: Such a functionality isn't needed on a properly configured system. All + devices present on the system should generate hotplug events, loading + the appropriate driver, and udev will notice and create the + appropriate device node. If you don't want to keep all drivers for your + hardware in memory, then use something else to manage your modules + (scripts, modules.conf, etc.) This is not a task for udev. + +Q: I really like the devfs naming scheme, will udev do that? A: Yes, udev can create /dev nodes using the devfs naming policy. A configuration file needs to be created to map the kernel default names - to the devfs names. Such a configuration file would be gladly added to - the udev package if it is provided by anyone who can create such a - mapping. + to the devfs names. See the initial udev.conf.devfs file in the udev + release. It is the start of such a configuration file. If there are + any things missing, please let the udev authors know. Q: What kinds of devices does udev create nodes for? A: All devices that are shown in sysfs will work with udev. If more @@ -51,7 +64,7 @@ A: udev is entirely in userspace. If the kernel supports a greater number of anonymous devices, udev will support it. Q: Will udev support symlinks? -A: Yes, patches are gladly accepted to add this functionality. +A: Yes, It now does. Multiple symlinks per device node too. Q: How will udev support changes to device permissions? A: On shutdown, udev will save the state of existing device permissions to -- cgit v1.2.3-54-g00ecf From 4763256c65859b94ac7a309cbb8f772d5426a08d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 10 Dec 2003 00:47:00 -0800 Subject: [PATCH] allow multiple symlinks Here is a patch to allow the creation of multiple symlinks. The names must be separated by a space character. REPLACE, KERNEL="ttyUSB0", NAME="visor", SYMLINK="first-%n second-%n third-%n" results in: Dec 9 05:28:51 pim udev[12019]: create_node: mknod(udev-root/visor, 020666, 188, 0) Dec 9 05:28:51 pim udev[12019]: create_node: symlink 'udev-root/first-0' to node 'visor' requested Dec 9 05:28:51 pim udev[12019]: create_node: symlink(./visor, udev-root/first-0) Dec 9 05:28:51 pim udev[12019]: create_node: symlink 'udev-root/second-0' to node 'visor' requested Dec 9 05:28:51 pim udev[12019]: create_node: symlink(./visor, udev-root/second-0) Dec 9 05:28:51 pim udev[12019]: create_node: symlink 'udev-root/third-0' to node 'visor' requested Dec 9 05:28:51 pim udev[12019]: create_node: symlink(./visor, udev-root/third-0) --- test/udev-test.pl | 9 ++++++++ udev-add.c | 66 +++++++++++++++++++++++++++++++------------------------ udev-remove.c | 32 +++++++++++++++++---------- 3 files changed, 67 insertions(+), 40 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 190b7ce4d6..39d8450c34 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -215,6 +215,15 @@ EOF expected => "1/2/c/d/symlink" , conf => < "multiple symlinks", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "second-0" , + conf => <symlink) { - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, dev->symlink, sizeof(filename)); - dbg("symlink '%s' to node '%s' requested", filename, dev->name); - if (strrchr(dev->symlink, '/')) - create_path(filename); - - /* optimize relative link */ - linktarget[0] = '\0'; - i = 0; - tail = 0; - while ((dev->name[i] == dev->symlink[i]) && dev->name[i]) { - if (dev->name[i] == '/') - tail = i+1; - i++; - } - while (dev->symlink[i]) { - if (dev->symlink[i] == '/') - strcat(linktarget, "../"); - i++; - } + symlinks = dev->symlink; + while (1) { + linkname = strsep(&symlinks, " "); + if (linkname == NULL) + break; + + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, linkname, sizeof(filename)); + dbg("symlink '%s' to node '%s' requested", filename, dev->name); + if (strrchr(linkname, '/')) + create_path(filename); + + /* optimize relative link */ + linktarget[0] = '\0'; + i = 0; + tail = 0; + while ((dev->name[i] == linkname[i]) && dev->name[i]) { + if (dev->name[i] == '/') + tail = i+1; + i++; + } + while (linkname[i]) { + if (linkname[i] == '/') + strcat(linktarget, "../"); + i++; + } - if (*linktarget == '\0') - strcpy(linktarget, "./"); - strcat(linktarget, &dev->name[tail]); + if (*linktarget == '\0') + strcpy(linktarget, "./"); + strcat(linktarget, &dev->name[tail]); - dbg("symlink(%s, %s)", linktarget, filename); - retval = symlink(linktarget, filename); - if (retval) - dbg("symlink(%s, %s) failed with error '%s'", - linktarget, filename, strerror(errno)); + dbg("symlink(%s, %s)", linktarget, filename); + retval = symlink(linktarget, filename); + if (retval) + dbg("symlink(%s, %s) failed with error '%s'", + linktarget, filename, strerror(errno)); + } } return retval; diff --git a/udev-remove.c b/udev-remove.c index 02c84371a4..0886c23343 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -66,6 +66,8 @@ static int delete_path(char *path) static int delete_node(struct udevice *dev) { char filename[255]; + char *symlinks; + char *linkname; int retval; strncpy(filename, udev_root, sizeof(filename)); @@ -84,17 +86,25 @@ static int delete_node(struct udevice *dev) delete_path(filename); if (*dev->symlink) { - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, dev->symlink, sizeof(filename)); - dbg("unlinking symlink '%s'", filename); - retval = unlink(filename); - if (retval) { - dbg("unlink(%s) failed with error '%s'", - filename, strerror(errno)); - return retval; - } - if (strchr(dev->symlink, '/')) { - delete_path(filename); + symlinks = dev->symlink; + while (1) { + linkname = strsep(&symlinks, " "); + if (linkname == NULL) + break; + + strncpy(filename, udev_root, sizeof(filename)); + strncat(filename, linkname, sizeof(filename)); + + dbg("unlinking symlink '%s'", filename); + retval = unlink(filename); + if (retval) { + dbg("unlink(%s) failed with error '%s'", + filename, strerror(errno)); + return retval; + } + if (strchr(dev->symlink, '/')) { + delete_path(filename); + } } } -- cgit v1.2.3-54-g00ecf From 61f76f5c9c12ec612458f515516b71a23b9410dd Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Wed, 10 Dec 2003 00:50:25 -0800 Subject: [PATCH] more extras/multipath updates * update the Makefiles to autodetect libgcc.a & gcc includes "ulibc-style". Factorisation of udevdirs & others niceties * drop a hint about absent /dev/sd? on failed open() for poor Debian users who don't imagine their favorite distro with only 16 preconfigured SCSI device nodes :) --- extras/multipath/Makefile | 14 ++++++++++---- extras/multipath/libdevmapper/Makefile | 9 ++++++++- extras/multipath/main.c | 15 +++++++++++++-- extras/multipath/main.h | 5 +++++ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index bccf1264f0..89e6f35185 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -6,16 +6,22 @@ EXEC = multipath prefix = /usr/local exec_prefix = ${prefix} -bindir = ${exec_prefix}/bin +bindir = ${exec_prefix}/bin +udevdir = ../.. +klibcdir = $(udevdir)/klibc +sysfsdir = $(udevdir)/libsysfs CC = gcc -CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc -I../../klibc/klibc/include -I../../klibc/klibc/include/bits32 -I/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/include -I../../klibc/linux/include -I../../libsysfs -I. -LDFLAGS = -lsysfs -ldevmapper -ldlist +GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} +CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ + -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ + -I$(GCCINCDIR) -I$(klibcdir)/linux/include -I$(sysfsdir) -I. OBJS = main.o CRT0 = ../../klibc/klibc/crt0.o LIB = ../../klibc/klibc/libc.a -LIBGCC = /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/libgcc.a +LIBGCC := $(shell $(CC) -print-libgcc-file-name ) + DMOBJS = libdevmapper/libdm-common.o libdevmapper/ioctl/libdevmapper.o SYSFSOBJS = ../../libsysfs/dlist.o ../../libsysfs/sysfs_bus.o \ ../../libsysfs/sysfs_class.o ../../libsysfs/sysfs_device.o \ diff --git a/extras/multipath/libdevmapper/Makefile b/extras/multipath/libdevmapper/Makefile index 72b39cedf5..b160075416 100644 --- a/extras/multipath/libdevmapper/Makefile +++ b/extras/multipath/libdevmapper/Makefile @@ -3,7 +3,14 @@ # Copyright (C) 2003 Christophe Varoqui, CC = gcc -CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc -I../../../klibc/klibc/include -I../../../klibc/klibc/include/bits32 -I/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/include -I../../../klibc/linux/include -I. -Iioctl +udevdir = ../../.. +klibcdir = $(udevdir)/klibc + +CC = gcc +GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} +CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ + -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ + -I$(GCCINCDIR) -I$(klibcdir)/linux/include -I. -Iioctl OBJS = ioctl/libdevmapper.o libdm-common.o diff --git a/extras/multipath/main.c b/extras/multipath/main.c index bc65899ce1..e62d763252 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -253,6 +253,9 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) sprintf(all_paths[k].sg_dev, "/dev/%s", buff); strcpy(all_paths[k].dev, all_paths[k].sg_dev); if ((sg_fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) { + if (conf->verbose) + fprintf(stderr, "can't open %s. mknod ?", + all_paths[k].sg_dev); continue; } get_lun_strings(sg_fd, &all_paths[k]); @@ -285,8 +288,12 @@ get_all_paths_nosysfs(struct env * conf, struct path * all_paths, sprintf(buff, "%d", k); strncat(file_name, buff, FILE_NAME_SIZE); strcpy(all_paths[k].sg_dev, file_name); - if ((sg_fd = open(file_name, O_RDONLY)) < 0) + if ((sg_fd = open(file_name, O_RDONLY)) < 0) { + if (conf->verbose) + fprintf(stderr, "can't open %s. mknod ?", + file_name); continue; + } get_lun_strings(sg_fd, &all_paths[k]); get_unique_id(sg_fd, &all_paths[k]); all_paths[k].state = do_tur(sg_fd); @@ -340,8 +347,12 @@ get_all_scsi_ids(struct env * conf, struct scsi_dev * all_scsi_ids) } else strcat(fname, "xxxx"); - if ((fd = open(fname, O_RDONLY)) < 0) + if ((fd = open(fname, O_RDONLY)) < 0) { + if (conf->verbose) + fprintf(stderr, "can't open %s. mknod ?", + fname); continue; + } res = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &my_scsi_id); if (res < 0) { diff --git a/extras/multipath/main.h b/extras/multipath/main.h index 692e5e4595..a1de1d8d2d 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -47,6 +47,11 @@ #define MX_ALLOC_LEN 255 #define BLKGETSIZE _IO(0x12,96) #define DM_TARGET "striped" +/* +#define DM_TARGET "multipath" +#define DM_POLL_INTERVAL 10 +#define DM_PATH_SELECTOR "latency" +*/ #define PINDEX(x,y) mp[(x)].pindex[(y)] -- cgit v1.2.3-54-g00ecf From 197a978ea3e5d68d2ca8059cede2b60f62c497b7 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Wed, 10 Dec 2003 00:52:04 -0800 Subject: [PATCH] and more extras/multipath updates * configure the multipath target with round-robin path selector and conservative default for a start : yes it makes this release the first really useful one. * temporarily disable map creation for single path device due to current restrictive defaults in the kernel target. Sistina should work it out. * correct the strncmp logic in blacklist function. Tested on StorageWorks with 2.6.0-test10-udm1 : xa-s03:~# ./multipath -v 60001fe1000bdad0000903507109004b (1 0 1 1) /dev/sda op:1 /dev/sda [HSG80 ] 60001fe1000bdad000090371312100bf (1 0 1 2) /dev/sdb op:1 /dev/sdb [HSG80 ] 60001fe1000bdad000090371312100c2 (1 0 1 3) /dev/sdc op:1 /dev/sdc [HSG80 ] 60001fe1000bdad00009037131210067 (1 0 2 1) /dev/sdd op:1 /dev/sdd [HSG80 ] 60001fe1000bdad000090371312100b3 (1 0 2 2) /dev/sde op:1 /dev/sde [HSG80 ] 60001fe1000bdad00009035071090024 (1 0 2 3) /dev/sdf op:1 /dev/sdf [HSG80 ] 600508b4000156d700012000000b0000 (1 0 3 1) /dev/sdg op:1 /dev/sdg [HSV110 (C)COMPAQ] 600508b4000156c30001200000210000 (1 0 3 2) /dev/sdh op:1 /dev/sdh [HSV110 (C)COMPAQ] 600508b4000156d700012000000b0000 (1 0 6 1) /dev/sdi op:1 /dev/sdi [HSV110 (C)COMPAQ] 600508b4000156c30001200000210000 (1 0 6 2) /dev/sdj op:1 /dev/sdj [HSV110 (C)COMPAQ] 60001fe1000bdad0000903507109004b \_(1 0 1 1) /dev/sda op:1 /dev/sda [HSG80 ] 60001fe1000bdad000090371312100bf \_(1 0 1 2) /dev/sdb op:1 /dev/sdb [HSG80 ] 60001fe1000bdad000090371312100c2 \_(1 0 1 3) /dev/sdc op:1 /dev/sdc [HSG80 ] 60001fe1000bdad00009037131210067 \_(1 0 2 1) /dev/sdd op:1 /dev/sdd [HSG80 ] 60001fe1000bdad000090371312100b3 \_(1 0 2 2) /dev/sde op:1 /dev/sde [HSG80 ] 60001fe1000bdad00009035071090024 \_(1 0 2 3) /dev/sdf op:1 /dev/sdf [HSG80 ] 600508b4000156d700012000000b0000 \_(1 0 3 1) /dev/sdg op:1 /dev/sdg [HSV110 (C)COMPAQ] \_(1 0 6 1) /dev/sdi op:1 /dev/sdi [HSV110 (C)COMPAQ] 600508b4000156c30001200000210000 \_(1 0 3 2) /dev/sdh op:1 /dev/sdh [HSV110 (C)COMPAQ] \_(1 0 6 2) /dev/sdj op:1 /dev/sdj [HSV110 (C)COMPAQ] N|600508b4000156d700012000000b0000 : 0 4194304 multipath 2 2 10 round-robin 2 /dev/sdg 10 2 1 2 /dev/sdi 10 2 1 2 N|600508b4000156c30001200000210000 : 0 20971520 multipath 2 2 10 round-robin 2 /dev/sdh 10 2 1 2 /dev/sdj 10 2 1 2 xa-s03:~# dmsetup ls 600508b4000156c30001200000210000 (254, 1) 600508b4000156d700012000000b0000 (254, 0) xa-s03:~# ll /dev/mapper/ total 0 brw------- 1 root root 254, 1 Dec 9 22:57 600508b4000156c30001200000210000 brw------- 1 root root 254, 0 Dec 9 22:57 600508b4000156d700012000000b0000 crw------- 1 root root 10, 63 Jul 25 22:48 control xa-s03:~# dd if=/dev/mapper/600508b4000156c30001200000210000 of=/dev/null bs=1M count=500 500+0 records in 500+0 records out 524288000 bytes transferred in 5.662530 seconds (92589003 bytes/sec) gee, that pretty fast :) --- extras/multipath/main.c | 28 ++++++++++++++++++++++++---- extras/multipath/main.h | 5 ----- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/extras/multipath/main.c b/extras/multipath/main.c index e62d763252..6b1c37cd95 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -214,7 +214,7 @@ blacklist (char * dev) { }; for (i = 0; blist[i].lengh; i++) { - if (strncmp(dev, blist[i].headstr, blist[i].lengh)) + if (strncmp(dev, blist[i].headstr, blist[i].lengh) == 0) return 1; } return 0; @@ -562,6 +562,17 @@ add_map(struct env * conf, struct path * all_paths, int i, np; long size = -1; + /* defaults for multipath target */ + int dm_nr_path_args = 2; + int dm_path_test_int = 10; + char * dm_ps_name = "round-robin"; + int dm_ps_nr_args = 2; + int dm_path_failback_int = 10; + int dm_path_nr_fail = 2; + int dm_ps_prio = 1; + int dm_ps_min_io = 2; + + if (!(dmt = dm_task_create(op))) return 0; @@ -577,7 +588,14 @@ add_map(struct env * conf, struct path * all_paths, } if (np == 0) goto addout; - params_p += sprintf(params_p, "%i 32", np); + /* temporarily disable creation of single path maps */ + /* Sistina should modify the target limits */ + if (np < 2) + goto addout; + + params_p += sprintf(params_p, "%i %i %i %s %i", + np, dm_nr_path_args, dm_path_test_int, + dm_ps_name, dm_ps_nr_args); for (i=0; i<=mp[index].npaths; i++) { if (( 0 == all_paths[PINDEX(index,i)].state) || @@ -585,8 +603,10 @@ add_map(struct env * conf, struct path * all_paths, continue; if (size < 0) size = get_disk_size(conf, all_paths[PINDEX(index,0)].dev); - params_p += sprintf(params_p, " %s %i", - all_paths[PINDEX(index,i)].dev, 0); + params_p += sprintf(params_p, " %s %i %i %i %i", + all_paths[PINDEX(index,i)].dev, + dm_path_failback_int, dm_path_nr_fail, + dm_ps_prio, dm_ps_min_io); } if (size < 0) diff --git a/extras/multipath/main.h b/extras/multipath/main.h index a1de1d8d2d..d6dfb14296 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -46,12 +46,7 @@ #define TUR_CMD_LEN 6 #define MX_ALLOC_LEN 255 #define BLKGETSIZE _IO(0x12,96) -#define DM_TARGET "striped" -/* #define DM_TARGET "multipath" -#define DM_POLL_INTERVAL 10 -#define DM_PATH_SELECTOR "latency" -*/ #define PINDEX(x,y) mp[(x)].pindex[(y)] -- cgit v1.2.3-54-g00ecf From 62adf3f7392ca923c3014c921b50f4f16029be42 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Dec 2003 01:02:03 -0800 Subject: [PATCH] Makefile tweaks for the DBUS build. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ae9d276721..51087bc8c6 100644 --- a/Makefile +++ b/Makefile @@ -186,7 +186,7 @@ endif ifeq ($(DBUS), true) CFLAGS += -DUSE_DBUS CFLAGS += $(shell pkg-config --cflags dbus-1) - LIB_OBJS += $(shell pkg-config --libs-only-l dbus-1) + LDFLAGS += $(shell pkg-config --libs dbus-1) OBJS += udev_dbus.o endif -- cgit v1.2.3-54-g00ecf From 197eda9ab08a9d44b831bed19c214a5861e188a5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Dec 2003 01:05:30 -0800 Subject: [PATCH] set default mode to 0600 to be safer. --- udev.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.conf b/udev.conf index aadaea8a24..c3f31a6aa7 100644 --- a/udev.conf +++ b/udev.conf @@ -19,5 +19,5 @@ udev_permissions="/etc/udev/udev.permissions" # default_mode - set the default mode for all nodes that have no # explicit match in the permissions file -default_mode="0666" +default_mode="0600" -- cgit v1.2.3-54-g00ecf From ef3c3df3a34df4ca7db7a490599ee2f8a3871a91 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Dec 2003 01:10:37 -0800 Subject: [PATCH] added a devfs udev config file from Marco d'Itri --- udev.rules.devfs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 udev.rules.devfs diff --git a/udev.rules.devfs b/udev.rules.devfs new file mode 100644 index 0000000000..c62559ba47 --- /dev/null +++ b/udev.rules.devfs @@ -0,0 +1,34 @@ +# These rules are to try to emulate a devfs naming scheme in udev +# if there are any missing rules, please let the udev developers +# know. +# +# There are a number of modifiers that are allowed to be used in the +# a number of the different fields. They provide the following subsitutions: +# %n - the "kernel number" of the device. +# for example, 'sda3' has a "kernel number" of '3' +# %M - the kernel major number for the device +# %m - the kernel minor number for the device +# %b - the bus id for the device +# %c - the return value for the CALLOUT program (note, this doesn't work within +# the PROGRAM field for the obvious reason.) +# %D - use the devfs style disk name for this device. +# For partitions, this will result in 'part%n' +# If this is not a partition, it will result in 'disk' +# + +NUMBER, BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D" +NUMBER, BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%D" +NUMBER, BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%D" +NUMBER, BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D" + +REPLACE, KERNEL="md[0-9]*", NAME="md/%n" + +REPLACE, KERNEL="tty[0-9]*", NAME="vc/%n" +REPLACE, KERNEL="ttyS[0-9]*", NAME="tts/%n" +REPLACE, KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" + +REPLACE, KERNEL="video[0-9]*", NAME="v4l/video%n" +REPLACE, KERNEL="radio[0-9]*", NAME="v4l/radio%n" +REPLACE, KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +REPLACE, KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" + -- cgit v1.2.3-54-g00ecf From babad3ff2ce7769b65474b29d97517e816f89bbd Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Dec 2003 01:14:24 -0800 Subject: [PATCH] add vc support to udev.rules.devfs --- udev.rules.devfs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/udev.rules.devfs b/udev.rules.devfs index c62559ba47..a92896078c 100644 --- a/udev.rules.devfs +++ b/udev.rules.devfs @@ -16,19 +16,28 @@ # If this is not a partition, it will result in 'disk' # +# ide block devices NUMBER, BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D" NUMBER, BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%D" NUMBER, BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%D" NUMBER, BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D" +# md block devices REPLACE, KERNEL="md[0-9]*", NAME="md/%n" +# tty devices REPLACE, KERNEL="tty[0-9]*", NAME="vc/%n" REPLACE, KERNEL="ttyS[0-9]*", NAME="tts/%n" REPLACE, KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" +# vc devices +REPLACE, KERNEL="vcs", NAME="vcc/0" +REPLACE, KERNEL="vcs[0-9]*", NAME="vcc/%n" +REPLACE, KERNEL="vcsa", NAME="vcc/a0" +REPLACE, KERNEL="vcsa[0-9]*", NAME="vcc/a%n" + +# v4l devices REPLACE, KERNEL="video[0-9]*", NAME="v4l/video%n" REPLACE, KERNEL="radio[0-9]*", NAME="v4l/radio%n" REPLACE, KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" REPLACE, KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" - -- cgit v1.2.3-54-g00ecf From 26004fcc665d14220c5b15a15ee4b2dd5d4af314 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 10 Dec 2003 15:40:08 -0800 Subject: [PATCH] man-page mention multiple symlinks As usual, when the stuff gets in the tree - here is a small man page update and a TODO line removal. mention multiple symlinks update example with silly symlink rule :) shorten example line to have less than 80 chars remove "want symlink support" from TODO --- TODO | 1 - udev.8 | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index e227834f36..47275873c8 100644 --- a/TODO +++ b/TODO @@ -8,7 +8,6 @@ greg@kroah.com - fix kernel name logic to handle devices like sdaj and such. - more documentation (can never have too much.) -- add symlink generation and removal support - better partition support (it's a hack right now, maybe new libsysfs changes can help out a lot here.) - allow database to be queried by other programs diff --git a/udev.8 b/udev.8 index 0c461967d2..7b4e17b5c4 100644 --- a/udev.8 +++ b/udev.8 @@ -94,7 +94,7 @@ file. Every line in the rules file define the mapping between device attributes and the device file name. It starts with a keyword defining the method used to match, followed by one ore more keys to compare and the filename for the -device. Optional the name for a symlink targeting the node may specified. +device. One ore more optional symlinks targeting the node may be specified. .br If no matching configuration is found, the default kernel device name is used. @@ -175,11 +175,11 @@ NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" # USB mouse at third port of the second hub to be called mouse1 TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" -# ttyUSB1 should always be called pda -REPLACE, KERNEL="ttyUSB1", NAME="pda" +# ttyUSB1 should always be called pda with two additional symlinks +REPLACE, KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" -# USB webcams with symlinks to be called webcam0, webcam1, ... -LABEL, BUS="usb", model="WebCam Version 3", NAME="video%n", SYMLINK="webcam%n" +# multiple USB webcams with symlinks to be called webcam0, webcam1, ... +LABEL, BUS="usb", model="WebCam V3", NAME="video%n", SYMLINK="webcam%n" .fi .P Permissions and ownership for the created device files may specified at -- cgit v1.2.3-54-g00ecf From 525d07e78e281f5034ee29d2cd5cc144fe320431 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Dec 2003 22:12:30 -0800 Subject: [PATCH] change devfs disk name rule from 'disk' to 'disc' --- namedev.c | 2 +- test/udev-test.pl | 2 +- udev.8 | 2 +- udev.rules | 2 +- udev.rules.devfs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/namedev.c b/namedev.c index fbdb125e4c..75e4d22370 100644 --- a/namedev.c +++ b/namedev.c @@ -223,7 +223,7 @@ static void apply_format(struct udevice *udev, unsigned char *string) break; case 'D': if (strlen(udev->kernel_number) == 0) { - strcat(pos, "disk"); + strcat(pos, "disc"); break; } strcat(pos, "part"); diff --git a/test/udev-test.pl b/test/udev-test.pl index 39d8450c34..3dfbaa2530 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -156,7 +156,7 @@ EOF desc => "devfs disk naming substitution", subsys => "block", devpath => "block/sda", - expected => "lun0/disk" , + expected => "lun0/disc" , conf => < Date: Thu, 11 Dec 2003 08:00:40 -0800 Subject: [PATCH] use udevdir in udev.conf udevdir is a define, but udev.conf has a hardcoded path. Maybe this config file should be generated on the fly, like shown below. --- Makefile | 9 +++++---- udev.conf | 23 ----------------------- udev.conf.in | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+), 27 deletions(-) delete mode 100644 udev.conf create mode 100644 udev.conf.in diff --git a/Makefile b/Makefile index 51087bc8c6..cdee7ac812 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM} EXTRAS= # place to put our device nodes -udevdir = ${prefix}/udev/ +udevdir = ${prefix}/udev # Comment out this line to build with something other # than the local version of klibc @@ -196,8 +196,8 @@ GEN_HEADERS = udev_version.h # Rules on how to create the generated header files udev_version.h: @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ - @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ - @echo \#define UDEV_DB \"$(udevdir)\.udev.tdb\" >> $@ + @echo \#define UDEV_ROOT \"$(udevdir)/\" >> $@ + @echo \#define UDEV_DB \"$(udevdir)/\.udev.tdb\" >> $@ @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)\udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)\udev.rules\" >> $@ @@ -212,7 +212,7 @@ $(ROOT): $(OBJS) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) + -rm -f core $(ROOT) $(GEN_HEADERS) udev.conf $(MAKE) -C klibc clean @for target in $(EXTRAS) ; do \ echo $$target ; \ @@ -271,6 +271,7 @@ install: install-dbus-policy all $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 + sed -e "s-@udevdir@-$(udevdir)-" < udev.conf.in > udev.conf $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir) $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir) $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir) diff --git a/udev.conf b/udev.conf deleted file mode 100644 index c3f31a6aa7..0000000000 --- a/udev.conf +++ /dev/null @@ -1,23 +0,0 @@ -# udev.conf -# The main config file for udev -# -# This file can be used to override some of udev's default values -# for where it looks for files, and where it places device nodes. - - -# udev_root - where in the filesystem to place the device nodes -udev_root="/udev/" - -# udev_db - The name and location of the udev database. -udev_db="/udev/.udev.tdb" - -# udev_rules - The name and location of the udev rules file -udev_rules="/etc/udev/udev.rules" - -# udev_permissions - The name and location of the udev permission file -udev_permissions="/etc/udev/udev.permissions" - -# default_mode - set the default mode for all nodes that have no -# explicit match in the permissions file -default_mode="0600" - diff --git a/udev.conf.in b/udev.conf.in new file mode 100644 index 0000000000..d06b0b0698 --- /dev/null +++ b/udev.conf.in @@ -0,0 +1,23 @@ +# udev.conf +# The main config file for udev +# +# This file can be used to override some of udev's default values +# for where it looks for files, and where it places device nodes. + + +# udev_root - where in the filesystem to place the device nodes +udev_root="@udevdir@/" + +# udev_db - The name and location of the udev database. +udev_db="@udevdir@/.udev.tdb" + +# udev_rules - The name and location of the udev rules file +udev_rules="/etc/udev/udev.rules" + +# udev_permissions - The name and location of the udev permission file +udev_permissions="/etc/udev/udev.permissions" + +# default_mode - set the default mode for all nodes that have no +# explicit match in the permissions file +default_mode="0600" + -- cgit v1.2.3-54-g00ecf From 71896b56ee03a8f31c89263bbf5f4cb7201666be Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 11 Dec 2003 08:12:29 -0800 Subject: [PATCH] tweak the config file generation portion of the Makefile a bit. --- Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index cdee7ac812..9415e1ec97 100644 --- a/Makefile +++ b/Makefile @@ -203,6 +203,14 @@ udev_version.h: @echo \#define UDEV_RULES_FILE \"$(configdir)\udev.rules\" >> $@ @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ +# config files automatically generated +GEN_CONFIGS = udev.conf + +# Rules on how to create the generated config files +udev.conf: + sed -e "s-@udevdir@-$(udevdir)-" < udev.conf.in > $@ + + $(OBJS): $(GEN_HEADERS) $(ROOT): $(OBJS) @@ -212,7 +220,7 @@ $(ROOT): $(OBJS) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) udev.conf + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(MAKE) -C klibc clean @for target in $(EXTRAS) ; do \ echo $$target ; \ @@ -265,13 +273,12 @@ uninstall-dbus-policy: - endif -install: install-dbus-policy all +install: install-dbus-policy all $(GEN_CONFIGS) $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(configdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 - sed -e "s-@udevdir@-$(udevdir)-" < udev.conf.in > udev.conf $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir) $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir) $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir) -- cgit v1.2.3-54-g00ecf From 5d4754f19521568b775ba7a31465d3af192ce382 Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Mon, 15 Dec 2003 21:53:28 -0800 Subject: [PATCH] pre-libsysfs-0.4.0 patch I am sending you a pre-release patch. It's everything that's in our current CVS tree. It adds the functionality you've been looking for. Please play with this before checking it into your tree, I'd like to know if it's ok with you or if you find problems. I have tested this out with test.all and the perl regression test. Let me know what you think. Still need to do more testing for our work and add some more functions related to the changes. I've gone into namedev.c and udev-add.c to make the necessary changes in line with the library. I have not gone and edited any of the "extras". Changes: 1) Libsysfs object structures work more as handles now, their included directories or devices are labeled private. If you need attributes from a sysfs_class_device, call the available function and don't access the directory directly. Same holds true for a sysfs_class_device sysfs_device. Do not access the link directly but call the function sysfs_get_classdev_device() instead. We only populate entries upon request, makes things faster and uses less memory. 2) Added sysfs_get_classdev_parent() as requested. 3) Changed getpagesize to sysconf. 4) Added sysfs_refresh_attributes function for refreshing views of attribute lists. We still need to add refresh for links and subdirs. All udev needs to do is keep calling sysfs_get_classdev_attr() and that will internally call the refresh routine. --- libsysfs/libsysfs.h | 49 ++++-- libsysfs/sysfs_bus.c | 294 +++++++++++++-------------------- libsysfs/sysfs_class.c | 424 ++++++++++++++++++++++++++++++++---------------- libsysfs/sysfs_device.c | 309 ++++++++++++++++++----------------- libsysfs/sysfs_dir.c | 403 ++++++++++++++++++++++++++++++++++++--------- libsysfs/sysfs_driver.c | 287 ++++++++++++++++++++------------ libsysfs/sysfs_utils.c | 73 ++++++++- namedev.c | 25 +-- udev-add.c | 10 +- 9 files changed, 1175 insertions(+), 699 deletions(-) diff --git a/libsysfs/libsysfs.h b/libsysfs/libsysfs.h index 6d8e58de21..aca25772b5 100644 --- a/libsysfs/libsysfs.h +++ b/libsysfs/libsysfs.h @@ -31,15 +31,10 @@ */ #define SYSFS_FSTYPE_NAME "sysfs" #define SYSFS_PROC_MNTS "/proc/mounts" -#define SYSFS_BUS_DIR "/bus" #define SYSFS_BUS_NAME "bus" -#define SYSFS_CLASS_DIR "/class" #define SYSFS_CLASS_NAME "class" -#define SYSFS_BLOCK_DIR "/block" #define SYSFS_BLOCK_NAME "block" -#define SYSFS_DEVICES_DIR "/devices" #define SYSFS_DEVICES_NAME "devices" -#define SYSFS_DRIVERS_DIR "/drivers" #define SYSFS_DRIVERS_NAME "drivers" #define SYSFS_NAME_ATTRIBUTE "name" #define SYSFS_UNKNOWN "unknown" @@ -75,17 +70,15 @@ struct sysfs_directory { }; struct sysfs_driver { - struct dlist *devices; unsigned char name[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; /* for internal use only */ + struct dlist *devices; struct sysfs_directory *directory; }; struct sysfs_device { - struct sysfs_device *parent; - struct dlist *children; unsigned char name[SYSFS_NAME_LEN]; unsigned char bus_id[SYSFS_NAME_LEN]; unsigned char bus[SYSFS_NAME_LEN]; @@ -93,45 +86,48 @@ struct sysfs_device { unsigned char path[SYSFS_PATH_MAX]; /* for internal use only */ + struct sysfs_device *parent; + struct dlist *children; struct sysfs_directory *directory; }; struct sysfs_root_device { - struct dlist *devices; unsigned char name[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; /* for internal use only */ + struct dlist *devices; struct sysfs_directory *directory; }; struct sysfs_bus { - struct dlist *drivers; - struct dlist *devices; unsigned char name[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; /* internal use only */ + struct dlist *drivers; + struct dlist *devices; struct sysfs_directory *directory; }; struct sysfs_class_device { - struct sysfs_device *sysdevice; /* NULL if virtual */ - struct sysfs_driver *driver; /* NULL if not implemented */ unsigned char name[SYSFS_NAME_LEN]; unsigned char classname[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; /* for internal use only */ + struct sysfs_class_device *parent; + struct sysfs_device *sysdevice; /* NULL if virtual */ + struct sysfs_driver *driver; /* NULL if not implemented */ struct sysfs_directory *directory; }; struct sysfs_class { - struct dlist *devices; unsigned char name[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; /* for internal use only */ + struct dlist *devices; struct sysfs_directory *directory; }; @@ -146,6 +142,9 @@ extern int sysfs_trailing_slash(unsigned char *path); extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); extern int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, size_t len); +extern int sysfs_path_is_dir(const unsigned char *path); +extern int sysfs_path_is_link(const unsigned char *path); +extern int sysfs_path_is_file(const unsigned char *path); extern int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len); extern struct dlist *sysfs_open_subsystem_list(unsigned char *name); @@ -162,8 +161,12 @@ extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, const unsigned char *new_value, size_t len); extern unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, const unsigned char * name); +extern int sysfs_refresh_attributes(struct dlist *attrlist); extern void sysfs_close_directory(struct sysfs_directory *sysdir); extern struct sysfs_directory *sysfs_open_directory(const unsigned char *path); +extern int sysfs_read_dir_attributes(struct sysfs_directory *sysdir); +extern int sysfs_read_dir_links(struct sysfs_directory *sysdir); +extern int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir); extern int sysfs_read_directory(struct sysfs_directory *sysdir); extern int sysfs_read_all_subdirs(struct sysfs_directory *sysdir); extern struct sysfs_directory *sysfs_get_subdirectory @@ -183,10 +186,10 @@ extern struct sysfs_driver *sysfs_open_driver(const unsigned char *path); extern struct sysfs_attribute *sysfs_get_driver_attr (struct sysfs_driver *drv, const unsigned char *name); extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); +extern struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver); extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); -extern void sysfs_close_driver_by_name(struct sysfs_driver *driver); -extern struct sysfs_driver *sysfs_open_driver_by_name - (const unsigned char *drv_name, const unsigned char *bus, size_t bsize); +extern struct sysfs_device *sysfs_get_driver_device + (struct sysfs_driver *driver, const unsigned char *name); extern struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, const unsigned char *drv, const unsigned char *attrib); @@ -194,13 +197,14 @@ extern struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, extern void sysfs_close_root_device(struct sysfs_root_device *root); extern struct sysfs_root_device *sysfs_open_root_device (const unsigned char *name); +extern struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root); extern void sysfs_close_device(struct sysfs_device *dev); extern struct sysfs_device *sysfs_open_device(const unsigned char *path); extern struct sysfs_attribute *sysfs_get_device_attr (struct sysfs_device *dev, const unsigned char *name); extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); extern struct sysfs_device *sysfs_open_device_by_id - (const unsigned char *bus_id, const unsigned char *bus, size_t bsize); + (const unsigned char *bus_id, const unsigned char *bus); extern struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, const unsigned char *bus_id, const unsigned char *attrib); @@ -211,6 +215,8 @@ extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, unsigned char *id); extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, unsigned char *drvname); +extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); +extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); extern struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus); extern struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, unsigned char *attrname); @@ -223,8 +229,15 @@ extern int sysfs_find_driver_bus(const unsigned char *driver, extern void sysfs_close_class_device(struct sysfs_class_device *dev); extern struct sysfs_class_device *sysfs_open_class_device (const unsigned char *path); +extern struct sysfs_device *sysfs_get_classdev_device + (struct sysfs_class_device *clsdev); +extern struct sysfs_driver *sysfs_get_classdev_driver + (struct sysfs_class_device *clsdev); +extern struct sysfs_class_device *sysfs_get_classdev_parent + (struct sysfs_class_device *clsdev); extern void sysfs_close_class(struct sysfs_class *cls); extern struct sysfs_class *sysfs_open_class(const unsigned char *name); +extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); extern struct sysfs_class_device *sysfs_get_class_device (struct sysfs_class *class, unsigned char *name); extern struct sysfs_class_device *sysfs_open_class_device_by_name diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index 639acef4ee..3e6c22bbb1 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -93,187 +93,91 @@ static struct sysfs_bus *alloc_bus(void) } /** - * open_bus_dir: opens up sysfs bus directory - * returns sysfs_directory struct with success and NULL with error + * sysfs_get_bus_devices: gets all devices for bus + * @bus: bus to get devices for + * returns dlist of devices with success and NULL with failure */ -static struct sysfs_directory *open_bus_dir(const unsigned char *name) +struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) { - struct sysfs_directory *busdir = NULL; - unsigned char buspath[SYSFS_PATH_MAX]; + struct sysfs_device *bdev = NULL; + struct sysfs_directory *devdir = NULL; + struct sysfs_link *curl = NULL; + unsigned char path[SYSFS_PATH_MAX]; - if (name == NULL) { + if (bus == NULL) { errno = EINVAL; return NULL; } - - memset(buspath, 0, SYSFS_PATH_MAX); - if ((sysfs_get_mnt_path(buspath, SYSFS_PATH_MAX)) != 0) { - dprintf("Sysfs not supported on this system\n"); + memset(path, 0, SYSFS_PATH_MAX); + strcpy(path, bus->path); + strcat(path, "/"); + strcat(path, SYSFS_DEVICES_NAME); + devdir = sysfs_open_directory(path); + if (devdir == NULL) return NULL; - } - if (sysfs_trailing_slash(buspath) == 0) - strcat(buspath, "/"); - - strcat(buspath, SYSFS_BUS_NAME); - strcat(buspath, "/"); - strcat(buspath, name); - busdir = sysfs_open_directory(buspath); - if (busdir == NULL) { - errno = EINVAL; - dprintf("Bus %s not supported on this system\n", - name); + if (sysfs_read_dir_links(devdir) != 0) { + sysfs_close_directory(devdir); return NULL; } - if ((sysfs_read_directory(busdir)) != 0) { - dprintf("Error reading %s bus dir %s\n", name, - buspath); - sysfs_close_directory(busdir); - return NULL; - } - /* read in devices and drivers subdirs */ - sysfs_read_all_subdirs(busdir); - - return busdir; -} - -/** - * get_all_bus_devices: gets all devices for bus - * @bus: bus to get devices for - * returns 0 with success and -1 with failure - */ -static int get_all_bus_devices(struct sysfs_bus *bus) -{ - struct sysfs_device *bdev = NULL; - struct sysfs_directory *cur = NULL; - struct sysfs_link *curl = NULL; - - if (bus == NULL || bus->directory == NULL) { - errno = EINVAL; - return -1; - } - if (bus->directory->subdirs == NULL) - return 0; - dlist_for_each_data(bus->directory->subdirs, cur, - struct sysfs_directory) { - if (strcmp(cur->name, SYSFS_DEVICES_NAME) != 0) + dlist_for_each_data(devdir->links, curl, struct sysfs_link) { + bdev = sysfs_open_device(curl->target); + if (bdev == NULL) { + dprintf("Error opening device at %s\n", curl->target); continue; - if (cur->links == NULL) - continue; - dlist_for_each_data(cur->links, curl, struct sysfs_link) { - bdev = sysfs_open_device(curl->target); - if (bdev == NULL) { - dprintf("Error opening device at %s\n", - curl->target); - continue; - } - if (bus->devices == NULL) - bus->devices = dlist_new_with_delete - (sizeof(struct sysfs_device), - sysfs_close_dev); - dlist_unshift(bus->devices, bdev); } + if (bus->devices == NULL) + bus->devices = dlist_new_with_delete + (sizeof(struct sysfs_device), sysfs_close_dev); + dlist_unshift(bus->devices, bdev); } - - return 0; + sysfs_close_directory(devdir); + + return (bus->devices); } /** - * get_all_bus_drivers: get all pci drivers + * sysfs_get_bus_drivers: get all pci drivers * @bus: pci bus to add drivers to - * returns 0 with success and -1 with error + * returns dlist of drivers with success and NULL with error */ -static int get_all_bus_drivers(struct sysfs_bus *bus) +struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) { struct sysfs_driver *driver = NULL; - struct sysfs_directory *cur = NULL; + struct sysfs_directory *drvdir = NULL; struct sysfs_directory *cursub = NULL; + unsigned char path[SYSFS_PATH_MAX]; - if (bus == NULL || bus->directory == NULL) { + if (bus == NULL) { errno = EINVAL; - return -1; - } - if (bus->directory->subdirs == NULL) - return 0; - - dlist_for_each_data(bus->directory->subdirs, cur, - struct sysfs_directory) { - if (strcmp(cur->name, SYSFS_DRIVERS_NAME) != 0) - continue; - if (cur->subdirs == NULL) - continue; - dlist_for_each_data(cur->subdirs, cursub, - struct sysfs_directory) { - driver = sysfs_open_driver(cursub->path); - if (driver == NULL) { - dprintf("Error opening driver at %s\n", - cursub->path); - continue; - } - if (bus->drivers == NULL) - bus->drivers = dlist_new_with_delete - (sizeof(struct sysfs_driver), - sysfs_close_drv); - dlist_unshift(bus->drivers, driver); - } + return NULL; } - - return 0; -} - -/** - * match_bus_device_to_driver: returns 1 if device is bound to driver - * @driver: driver to match - * @busid: busid of device to match - * returns 1 if found and 0 if not found - */ -static int match_bus_device_to_driver(struct sysfs_driver *driver, - unsigned char *busid) -{ - struct sysfs_link *cur = NULL; - int found = 0; + memset(path, 0, SYSFS_PATH_MAX); + strcpy(path, bus->path); + strcat(path, "/"); + strcat(path, SYSFS_DRIVERS_NAME); + drvdir = sysfs_open_directory(path); + if (drvdir == NULL) + return NULL; - if (driver == NULL || driver->directory == NULL || busid == NULL) { - errno = EINVAL; - return found; - } - if (driver->directory->links != NULL) { - dlist_for_each_data(driver->directory->links, cur, - struct sysfs_link) { - if ((strcmp(cur->name, busid)) == 0) - found++; - } + if (sysfs_read_dir_subdirs(drvdir) != 0) { + sysfs_close_directory(drvdir); + return NULL; } - return found; -} - -/** - * link_bus_devices_to_drivers: goes through and links devices to drivers - * @bus: bus to link - */ -static void link_bus_devices_to_drivers(struct sysfs_bus *bus) -{ - struct sysfs_device *dev = NULL; - struct sysfs_driver *drv = NULL; - - if (bus != NULL && bus->devices != NULL && bus->drivers != NULL) { - dlist_for_each_data(bus->devices, dev, struct sysfs_device) { - dlist_for_each_data(bus->drivers, drv, - struct sysfs_driver) { - if ((match_bus_device_to_driver(drv, - dev->bus_id)) != 0) { - strncpy(dev->driver_name, drv->name, - SYSFS_NAME_LEN); - if (drv->devices == NULL) - drv->devices = dlist_new - (sizeof(struct - sysfs_device)); - dlist_unshift(drv->devices, dev); - } - } + dlist_for_each_data(drvdir->subdirs, cursub, struct sysfs_directory) { + driver = sysfs_open_driver(cursub->path); + if (driver == NULL) { + dprintf("Error opening driver at %s\n", cursub->path); + continue; } + if (bus->drivers == NULL) + bus->drivers = dlist_new_with_delete + (sizeof(struct sysfs_driver), sysfs_close_drv); + dlist_unshift(bus->drivers, driver); } + sysfs_close_directory(drvdir); + return (bus->drivers); } /** @@ -283,39 +187,36 @@ static void link_bus_devices_to_drivers(struct sysfs_bus *bus) struct sysfs_bus *sysfs_open_bus(const unsigned char *name) { struct sysfs_bus *bus = NULL; - struct sysfs_directory *busdir = NULL; + unsigned char buspath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; return NULL; } - bus = alloc_bus(); - if (bus == NULL) { - dprintf("calloc failed\n"); - return NULL; - } - strcpy(bus->name, name); - busdir = open_bus_dir(name); - if (busdir == NULL) { - dprintf("Invalid bus, %s not supported on this system\n", - name); - sysfs_close_bus(bus); + memset(buspath, 0, SYSFS_PATH_MAX); + if ((sysfs_get_mnt_path(buspath, SYSFS_PATH_MAX)) != 0) { + dprintf("Sysfs not supported on this system\n"); return NULL; } - strcpy(bus->path, busdir->path); - bus->directory = busdir; - if ((get_all_bus_devices(bus)) != 0) { - dprintf("Error reading %s bus devices\n", name); - sysfs_close_bus(bus); + + if (sysfs_trailing_slash(buspath) == 0) + strcat(buspath, "/"); + + strcat(buspath, SYSFS_BUS_NAME); + strcat(buspath, "/"); + strcat(buspath, name); + if ((sysfs_path_is_dir(buspath)) != 0) { + dprintf("Invalid path to bus: %s\n", buspath); return NULL; } - if ((get_all_bus_drivers(bus)) != 0) { - dprintf("Error reading %s bus drivers\n", name); - sysfs_close_bus(bus); + bus = alloc_bus(); + if (bus == NULL) { + dprintf("calloc failed\n"); return NULL; } - link_bus_devices_to_drivers(bus); + strcpy(bus->name, name); + strcpy(bus->path, buspath); return bus; } @@ -334,6 +235,12 @@ struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, return NULL; } + if (bus->devices == NULL) { + bus->devices = sysfs_get_bus_devices(bus); + if (bus->devices == NULL) + return NULL; + } + return (struct sysfs_device *)dlist_find_custom(bus->devices, id, bus_device_id_equal); } @@ -352,6 +259,12 @@ struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, return NULL; } + if (bus->drivers == NULL) { + bus->drivers = sysfs_get_bus_drivers(bus); + if (bus->drivers == NULL) + return NULL; + } + return (struct sysfs_driver *)dlist_find_custom(bus->drivers, drvname, bus_driver_name_equal); } @@ -363,8 +276,28 @@ struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, */ struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) { - if (bus == NULL || bus->directory == NULL) + if (bus == NULL) return NULL; + + if (bus->directory == NULL) { + bus->directory = sysfs_open_directory(bus->path); + if (bus->directory == NULL) + return NULL; + } + if (bus->directory->attributes == NULL) { + if ((sysfs_read_dir_attributes(bus->directory)) != 0) + return NULL; + } else { + if ((sysfs_path_is_dir(bus->path)) != 0) { + dprintf("Bus at %s no longer exists\n", bus->path); + return NULL; + } + if ((sysfs_refresh_attributes + (bus->directory->attributes)) != 0) { + dprintf("Error refreshing bus attributes\n"); + return NULL; + } + } return bus->directory->attributes; } @@ -378,10 +311,16 @@ struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, unsigned char *attrname) { - if (bus == NULL || bus->directory == NULL || attrname == NULL) { + struct dlist *attrlist = NULL; + + if (bus == NULL) { errno = EINVAL; return NULL; } + attrlist = sysfs_get_bus_attributes(bus); + if (attrlist == NULL) + return NULL; + return sysfs_get_directory_attribute(bus->directory, attrname); } @@ -408,9 +347,10 @@ struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, dprintf("Error getting sysfs mount point\n"); return NULL; } - + if (sysfs_trailing_slash(path) == 0) strcat(path, "/"); + strcat(path, SYSFS_BUS_NAME); strcat(path, "/"); strcat(path, busname); @@ -448,6 +388,7 @@ int sysfs_find_driver_bus(const unsigned char *driver, unsigned char *busname, } memset(subsys, 0, SYSFS_PATH_MAX); + strcat(subsys, "/"); strcpy(subsys, SYSFS_BUS_NAME); buslist = sysfs_open_subsystem_list(subsys); if (buslist != NULL) { @@ -476,4 +417,3 @@ int sysfs_find_driver_bus(const unsigned char *driver, unsigned char *busname, } return -1; } - diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index 54f22eee24..169600d5fd 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -58,6 +58,8 @@ void sysfs_close_class_device(struct sysfs_class_device *dev) sysfs_close_device(dev->sysdevice); if (dev->driver != NULL) sysfs_close_driver(dev->driver); + if (dev->parent != NULL) + sysfs_close_class_device(dev->parent); free(dev); } } @@ -96,54 +98,6 @@ static struct sysfs_class *alloc_class(void) return (struct sysfs_class *)calloc(1, sizeof(struct sysfs_class)); } -/** - * open_class_dir: opens up sysfs class directory - * returns sysfs_directory struct with success and NULL with error - */ -static struct sysfs_directory *open_class_dir(const unsigned char *name) -{ - struct sysfs_directory *classdir = NULL; - unsigned char classpath[SYSFS_PATH_MAX]; - - if (name == NULL) { - errno = EINVAL; - return NULL; - } - - memset(classpath, 0, SYSFS_PATH_MAX); - if ((sysfs_get_mnt_path(classpath, SYSFS_PATH_MAX)) != 0) { - dprintf("Sysfs not supported on this system\n"); - return NULL; - } - - if (sysfs_trailing_slash(classpath) == 0) - strcat(classpath, "/"); - /* - * We shall now treat "block" also as a class. Hence, check here - * if "name" is "block" and proceed accordingly - */ - if (strcmp(name, SYSFS_BLOCK_NAME) == 0) { - strcat(classpath, SYSFS_BLOCK_NAME); - } else { - strcat(classpath, SYSFS_CLASS_NAME); - strcat(classpath, "/"); - strcat(classpath, name); - } - classdir = sysfs_open_directory(classpath); - if (classdir == NULL) { - errno = EINVAL; - dprintf("Class %s not supported on this system\n", name); - return NULL; - } - if ((sysfs_read_directory(classdir)) != 0) { - dprintf("Error reading %s class dir %s\n", name, classpath); - sysfs_close_directory(classdir); - return NULL; - } - - return classdir; -} - /** * set_classdev_classname: Grabs classname from path * @cdev: class device to set @@ -154,20 +108,18 @@ static void set_classdev_classname(struct sysfs_class_device *cdev) unsigned char *c = NULL, *e = NULL; int count = 0; - c = strstr(cdev->path, SYSFS_CLASS_DIR); - if (c == NULL) - c = strstr(cdev->path, SYSFS_BLOCK_DIR); - else { - c++; - while (c != NULL && *c != '/') - c++; + c = strstr(cdev->path, SYSFS_CLASS_NAME); + if (c == NULL) { + c = strstr(cdev->path, SYSFS_BLOCK_NAME); + } else { + c = strstr(c, "/"); } - if (c == NULL) + if (c == NULL) strcpy(cdev->classname, SYSFS_UNKNOWN); - else { - c++; + if (*c == '/') + c++; e = c; while (e != NULL && *e != '/' && *e != '\0') { e++; @@ -185,15 +137,15 @@ static void set_classdev_classname(struct sysfs_class_device *cdev) struct sysfs_class_device *sysfs_open_class_device(const unsigned char *path) { struct sysfs_class_device *cdev = NULL; - struct sysfs_directory *dir = NULL; - struct sysfs_link *curl = NULL; - struct sysfs_device *sdev = NULL; - struct sysfs_driver *drv = NULL; if (path == NULL) { errno = EINVAL; return NULL; } + if ((sysfs_path_is_dir(path)) != 0) { + dprintf("%s is not a valid path to a class device\n", path); + return NULL; + } cdev = alloc_class_device(); if (cdev == NULL) { dprintf("calloc failed\n"); @@ -201,81 +153,41 @@ struct sysfs_class_device *sysfs_open_class_device(const unsigned char *path) } if ((sysfs_get_name_from_path(path, cdev->name, SYSFS_NAME_LEN)) != 0) { errno = EINVAL; - dprintf("Invalid class device path %s\n", path); + dprintf("Error getting class device name\n"); sysfs_close_class_device(cdev); return NULL; } - dir = sysfs_open_directory(path); - if (dir == NULL) { - dprintf("Error opening class device at %s\n", path); - sysfs_close_class_device(cdev); - return NULL; - } - if ((sysfs_read_directory(dir)) != 0) { - dprintf("Error reading class device at %s\n", path); - sysfs_close_directory(dir); - sysfs_close_class_device(cdev); - return NULL; - } - sysfs_read_all_subdirs(dir); - cdev->directory = dir; - strcpy(cdev->path, dir->path); + strcpy(cdev->path, path); set_classdev_classname(cdev); - /* get driver and device, if implemented */ - if (cdev->directory->links != NULL) { - dlist_for_each_data(cdev->directory->links, curl, - struct sysfs_link) { - if (strncmp(curl->name, SYSFS_DEVICES_NAME, 6) == 0) { - sdev = sysfs_open_device(curl->target); - if (sdev != NULL) { - cdev->sysdevice = sdev; - if (cdev->driver != NULL) - strncpy(sdev->driver_name, - cdev->driver->name, - SYSFS_NAME_LEN); - } - } else if (strncmp(curl->name, - SYSFS_DRIVERS_NAME, 6) == 0) { - drv = sysfs_open_driver(curl->target); - if (drv != NULL) { - cdev->driver = drv; - if (cdev->sysdevice != NULL) { - strncpy(cdev->sysdevice->name, - drv->name, - SYSFS_NAME_LEN); - if (drv->devices == NULL) - drv->devices = - dlist_new - (sizeof(struct - sysfs_device)); - dlist_unshift(drv->devices, - cdev->sysdevice); - } - } - } - } - } return cdev; } /** - * get_all_class_devices: gets all devices for class + * sysfs_get_class_devices: gets all devices for class * @class: class to get devices for - * returns 0 with success and -1 with failure + * returns dlist of class_devices with success and NULL with error */ -static int get_all_class_devices(struct sysfs_class *cls) +struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) { struct sysfs_class_device *dev = NULL; struct sysfs_directory *cur = NULL; - if (cls == NULL || cls->directory == NULL) { + if (cls == NULL) { errno = EINVAL; - return -1; + return NULL; } - if (cls->directory->subdirs == NULL) - return 0; + if (cls->directory == NULL) { + cls->directory = sysfs_open_directory(cls->path); + if (cls->directory == NULL) + return NULL; + } + + if ((sysfs_read_dir_subdirs(cls->directory) != 0) + || cls->directory->subdirs == NULL) + return NULL; + dlist_for_each_data(cls->directory->subdirs, cur, struct sysfs_directory) { dev = sysfs_open_class_device(cur->path); @@ -289,7 +201,7 @@ static int get_all_class_devices(struct sysfs_class *cls) sysfs_close_cls_dev); dlist_unshift(cls->devices, dev); } - return 0; + return cls->devices; } /** @@ -299,34 +211,46 @@ static int get_all_class_devices(struct sysfs_class *cls) struct sysfs_class *sysfs_open_class(const unsigned char *name) { struct sysfs_class *cls = NULL; - struct sysfs_directory *classdir = NULL; + unsigned char classpath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; return NULL; } + memset(classpath, 0, SYSFS_PATH_MAX); + if ((sysfs_get_mnt_path(classpath, SYSFS_PATH_MAX)) != 0) { + dprintf("Sysfs not supported on this system\n"); + return NULL; + } + + if (sysfs_trailing_slash(classpath) == 0) + strcat(classpath, "/"); + + /* + * We shall now treat "block" also as a class. Hence, check here + * if "name" is "block" and proceed accordingly + */ + if (strcmp(name, SYSFS_BLOCK_NAME) == 0) { + strcat(classpath, SYSFS_BLOCK_NAME); + } else { + strcat(classpath, SYSFS_CLASS_NAME); + strcat(classpath, "/"); + strcat(classpath, name); + } + if ((sysfs_path_is_dir(classpath)) != 0) { + dprintf("Class %s not found on the system\n", name); + return NULL; + } + cls = alloc_class(); if (cls == NULL) { dprintf("calloc failed\n"); return NULL; } strcpy(cls->name, name); - classdir = open_class_dir(name); - if (classdir == NULL) { - dprintf("Invalid class, %s not supported on this system\n", - name); - sysfs_close_class(cls); - return NULL; - } - cls->directory = classdir; - strcpy(cls->path, classdir->path); - if ((get_all_class_devices(cls)) != 0) { - dprintf("Error reading %s class devices\n", name); - sysfs_close_class(cls); - return NULL; - } - + strcpy(cls->path, classpath); + return cls; } @@ -338,15 +262,189 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *class, unsigned char *name) { + struct dlist *devlist = NULL; + if (class == NULL || name == NULL) { errno = EINVAL; return NULL; } + if (class->devices == NULL) { + class->devices = sysfs_get_class_devices(class); + if (devlist == NULL) + return NULL; + } return (struct sysfs_class_device *)dlist_find_custom(class->devices, name, class_name_equal); } +/** + * sysfs_get_classdev_device: returns the sysfs_device corresponding to + * sysfs_class_device, if present + * @clsdev: class device whose sysfs_device is required + * Returns sysfs_device on success, NULL on error or if device is not + * implemented + */ +struct sysfs_device *sysfs_get_classdev_device + (struct sysfs_class_device *clsdev) +{ + struct sysfs_link *devlink = NULL; + + if (clsdev == NULL) { + errno = EINVAL; + return NULL; + } + + if (clsdev->sysdevice != NULL) + return (clsdev->sysdevice); + + if (clsdev->directory == NULL) { + clsdev->directory = sysfs_open_directory(clsdev->path); + if (clsdev->directory == NULL) + return NULL; + } + devlink = sysfs_get_directory_link(clsdev->directory, "device"); + if (devlink == NULL) + return NULL; + + clsdev->sysdevice = sysfs_open_device(devlink->target); + if (clsdev->sysdevice == NULL) + return NULL; + if (clsdev->driver != NULL) + strcpy(clsdev->sysdevice->driver_name, clsdev->driver->name); + + return (clsdev->sysdevice); +} + +/** + * sysfs_get_classdev_driver: returns the sysfs_driver corresponding to + * sysfs_class_device, if present + * @clsdev: class device whose sysfs_device is required + * Returns sysfs_driver on success, NULL on error or if driver is not + * implemented + */ +struct sysfs_driver *sysfs_get_classdev_driver + (struct sysfs_class_device *clsdev) +{ + struct sysfs_link *drvlink = NULL; + + if (clsdev == NULL) { + errno = EINVAL; + return NULL; + } + + if (clsdev->driver != NULL) + return (clsdev->driver); + + if (clsdev->directory == NULL) { + clsdev->directory = sysfs_open_directory(clsdev->path); + if (clsdev->directory == NULL) + return NULL; + } + drvlink = sysfs_get_directory_link(clsdev->directory, "driver"); + if (drvlink != NULL) { + clsdev->driver = sysfs_open_driver(drvlink->target); + if (clsdev->driver == NULL) + return NULL; + + } + return (clsdev->driver); +} + +/* + * get_blockdev_parent: Get the parent class device for a "block" subsystem + * device if present + * @clsdev: block subsystem class device whose parent needs to be found + * Returns 0 on success and 1 on error + */ +static int get_blockdev_parent(struct sysfs_class_device *clsdev) +{ + unsigned char parent_path[SYSFS_PATH_MAX], value[256], *c = NULL; + + memset(parent_path, 0, SYSFS_PATH_MAX); + strcpy(parent_path, clsdev->path); + + c = strstr(parent_path, SYSFS_BLOCK_NAME); + if (c == NULL) { + dprintf("Class device %s does not belong to BLOCK subsystem", + clsdev->name); + return 1; + } + + c += strlen(SYSFS_BLOCK_NAME); + if (*c == '/') + c++; + else + goto errout; + + /* validate whether the given class device is a partition or not */ + if ((strncmp(c, clsdev->name, strlen(clsdev->name))) == 0) { + dprintf("%s not a partition\n", clsdev->name); + return 1; + } + c = strchr(c, '/'); + if (c == NULL) + goto errout; + *c = '\0'; + + /* Now validate if the parent has the "dev" attribute */ + memset(value, 0, 256); + strcat(parent_path, "/dev"); + if ((sysfs_read_attribute_value(parent_path, value, 256)) != 0) { + dprintf("Block device %s does not have a parent\n", + clsdev->name); + return 1; + } + + c = strrchr(parent_path, '/'); + if (c == NULL) + goto errout; + + *c = '\0'; + clsdev->parent = sysfs_open_class_device(parent_path); + if (clsdev->parent == NULL) { + dprintf("Error opening the parent class device at %s\n", + parent_path); + return 1; + } + return 0; + +errout: + dprintf("Invalid path %s\n", clsdev->path); + return 1; +} + +/** + * sysfs_get_classdev_parent: Retrieves the parent of a class device. + * eg., when working with hda1, this function can be used to retrieve the + * sysfs_class_device for hda + * + * @clsdev: class device whose parent details are required. + * Returns sysfs_class_device of the parent on success, NULL on failure + */ +struct sysfs_class_device *sysfs_get_classdev_parent + (struct sysfs_class_device *clsdev) +{ + if (clsdev == NULL) { + errno = EINVAL; + return NULL; + } + if (clsdev->parent != NULL) + return (clsdev->parent); + + /* + * As of now, only block devices have a parent child heirarchy in sysfs + * We do not know, if, in the future, more classes will have a similar + * structure. Hence, we now call a specialized function for block and + * later we can add support functions for other subsystems as required. + */ + if (!(strcmp(clsdev->classname, SYSFS_BLOCK_NAME))) { + if ((get_blockdev_parent(clsdev)) == 0) + return (clsdev->parent); + } + return NULL; +} + /** * get_classdev_path: given the class and a device in the class, return the * absolute path to the device @@ -367,6 +465,7 @@ static int get_classdev_path(const unsigned char *classname, dprintf("Error getting sysfs mount path\n"); return -1; } + if (sysfs_trailing_slash(path) == 0) strcat(path, "/"); @@ -427,9 +526,32 @@ struct sysfs_class_device *sysfs_open_class_device_by_name */ struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev) { - if (cdev == NULL || cdev->directory == NULL) + if (cdev == NULL) return NULL; + if (cdev->directory == NULL) { + cdev->directory = sysfs_open_directory(cdev->path); + if (cdev->directory == NULL) + return NULL; + } + if (cdev->directory->attributes == NULL) { + if ((sysfs_read_dir_attributes(cdev->directory)) != 0) { + dprintf("Error reading attributes for directory %s\n", + cdev->directory->path); + return NULL; + } + } else { + if ((sysfs_path_is_dir(cdev->path)) != 0) { + dprintf("Class device at %s no longer exists\n", + cdev->path); + return NULL; + } + if ((sysfs_refresh_attributes + (cdev->directory->attributes)) != 0) { + dprintf("Error refreshing classdev attributes\n"); + return NULL; + } + } return (cdev->directory->attributes); } @@ -443,18 +565,38 @@ struct sysfs_attribute *sysfs_get_classdev_attr (struct sysfs_class_device *clsdev, const unsigned char *name) { struct sysfs_attribute *cur = NULL; - - if (clsdev == NULL || clsdev->directory == NULL || - clsdev->directory->attributes == NULL || name == NULL) { + struct sysfs_directory *sdir = NULL; + struct dlist *attrlist = NULL; + + if (clsdev == NULL || name == NULL) { errno = EINVAL; return NULL; } - + /* + * First, see if it's in the current directory. Then look at + * subdirs since class devices can have subdirs of attributes. + */ + attrlist = sysfs_get_classdev_attributes(clsdev); + if (attrlist == NULL) + return NULL; cur = sysfs_get_directory_attribute(clsdev->directory, (unsigned char *)name); if (cur != NULL) return cur; + if (clsdev->directory->subdirs == NULL) + if ((sysfs_read_dir_subdirs(clsdev->directory)) != 0 || + clsdev->directory->subdirs == NULL) + return NULL; + + dlist_for_each_data(clsdev->directory->subdirs, sdir, + struct sysfs_directory) { + cur = sysfs_get_directory_attribute(sdir, + (unsigned char *)name); + if (cur != NULL) + return cur; + } + return NULL; } diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 323a43dac1..82b54719ff 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -23,38 +23,6 @@ #include "libsysfs.h" #include "sysfs.h" -static int confirm_device_bus(struct sysfs_device *dev, - unsigned char *busname, unsigned char *bus_id) -{ - struct sysfs_link *devlink = NULL; - unsigned char devpath[SYSFS_PATH_MAX]; - int result = 0; - - if (busname == NULL || bus_id == NULL) - return -1; - - if (sysfs_get_mnt_path(devpath, SYSFS_PATH_MAX) != 0) - return -1; - - if (sysfs_trailing_slash(devpath) == 0) - strcat(devpath, "/"); - strcat(devpath, SYSFS_BUS_NAME); - strcat(devpath, "/"); - strcat(devpath, busname); - strcat(devpath, SYSFS_DEVICES_DIR); - strcat(devpath, "/"); - strcat(devpath, bus_id); - - devlink = sysfs_open_link(devpath); - if (devlink == NULL) - return -1; - - if (strcmp(devlink->target, dev->path) == 0) - result++; - sysfs_close_link(devlink); - return result; -} - /** * get_device_bus: retrieves the bus name the device is on, checks path to * bus' link to make sure it has correct device. @@ -63,33 +31,53 @@ static int confirm_device_bus(struct sysfs_device *dev, */ static int get_device_bus(struct sysfs_device *dev) { - unsigned char subsys[SYSFS_NAME_LEN], *bus = NULL, *curdev = NULL; - struct dlist *buslist = NULL, *device_list = NULL; + unsigned char subsys[SYSFS_NAME_LEN], path[SYSFS_PATH_MAX]; + unsigned char target[SYSFS_PATH_MAX], *bus = NULL, *c = NULL; + struct dlist *buslist = NULL; if (dev == NULL) { errno = EINVAL; return -1; } - strcpy(subsys, SYSFS_BUS_DIR); /* subsys = /bus */ + memset(subsys, 0, SYSFS_NAME_LEN); + strcat(subsys, "/"); + strcpy(subsys, SYSFS_BUS_NAME); /* subsys = /bus */ buslist = sysfs_open_subsystem_list(subsys); if (buslist != NULL) { dlist_for_each_data(buslist, bus, char) { - device_list = sysfs_open_bus_devices_list(bus); - if (device_list != NULL) { - dlist_for_each_data(device_list, - curdev, char) { - if (strcmp(dev->bus_id, curdev) == 0 - && confirm_device_bus(dev, bus, - curdev) > 0) { - strcpy(dev->bus, bus); - sysfs_close_list(device_list); - sysfs_close_list(buslist); - return 0; - } - } - sysfs_close_list(device_list); - } + memset(path, 0, SYSFS_PATH_MAX); + strcpy(path, dev->path); + c = strstr(path, "/devices"); + if (c == NULL) { + dprintf("Invalid path to device %s\n", path); + sysfs_close_list(buslist); + return -1; + } + *c = '\0'; + strcat(path, "/"); + strcat(path, SYSFS_BUS_NAME); + strcat(path, "/"); + strcat(path, bus); + strcat(path, "/"); + strcat(path, SYSFS_DEVICES_NAME); + strcat(path, "/"); + strcat(path, dev->bus_id); + if ((sysfs_path_is_link(path)) == 0) { + memset(target, 0, SYSFS_PATH_MAX); + if ((sysfs_get_link(path, target, + SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting link target\n"); + sysfs_close_list(buslist); + return -1; + } + if (!(strncmp(target, dev->path, + SYSFS_PATH_MAX))) { + strcpy(dev->bus, bus); + sysfs_close_list(buslist); + return 0; + } + } } sysfs_close_list(buslist); } @@ -157,28 +145,32 @@ static struct sysfs_device *alloc_device(void) } /** - * sysfs_get_device_attr: searches dev's attributes by name - * @dev: device to look through - * @name: attribute name to get - * returns sysfs_attribute reference with success or NULL with error. + * open_device_dir: opens up sysfs_directory for specific root dev + * @name: name of root + * returns struct sysfs_directory with success and NULL with error */ -struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, - const unsigned char *name) +static struct sysfs_directory *open_device_dir(const unsigned char *path) { - struct sysfs_attribute *cur = NULL; + struct sysfs_directory *rdir = NULL; - if (dev == NULL || dev->directory == NULL - || dev->directory->attributes == NULL || name == NULL) { + if (path == NULL) { errno = EINVAL; return NULL; } - - cur = sysfs_get_directory_attribute(dev->directory, - (unsigned char *)name); - if (cur != NULL) - return cur; - return NULL; + rdir = sysfs_open_directory(path); + if (rdir == NULL) { + errno = EINVAL; + dprintf ("Device %s not supported on this system\n", path); + return NULL; + } + if ((sysfs_read_directory(rdir)) != 0) { + dprintf ("Error reading device at dir %s\n", path); + sysfs_close_directory(rdir); + return NULL; + } + + return rdir; } /** @@ -189,40 +181,34 @@ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, struct sysfs_device *sysfs_open_device(const unsigned char *path) { struct sysfs_device *dev = NULL; - struct sysfs_directory *sdir = NULL; if (path == NULL) { errno = EINVAL; return NULL; } + if ((sysfs_path_is_dir(path)) != 0) { + dprintf("Incorrect path to device: %s\n", path); + return NULL; + } dev = alloc_device(); if (dev == NULL) { dprintf("Error allocating device at %s\n", path); return NULL; } - sdir = sysfs_open_directory(path); - if (sdir == NULL) { - dprintf("Invalid device at %s\n", path); + if ((sysfs_get_name_from_path(path, dev->bus_id, + SYSFS_NAME_LEN)) != 0) { errno = EINVAL; + dprintf("Error getting device bus_id\n"); sysfs_close_device(dev); return NULL; } - if ((sysfs_read_directory(sdir)) != 0) { - dprintf("Error reading device directory at %s\n", path); - sysfs_close_directory(sdir); - sysfs_close_device(dev); - return NULL; - } - dev->directory = sdir; - strcpy(dev->bus_id, sdir->name); - strcpy(dev->path, sdir->path); - + strcpy(dev->path, path); /* * The "name" attribute no longer exists... return the device's * sysfs representation instead, in the "dev->name" field, which * implies that the dev->name and dev->bus_id contain same data. */ - strncpy(dev->name, sdir->name, SYSFS_NAME_LEN); + strncpy(dev->name, dev->bus_id, SYSFS_NAME_LEN); if (get_device_bus(dev) != 0) strcpy(dev->bus, SYSFS_UNKNOWN); @@ -251,6 +237,11 @@ static struct sysfs_device *sysfs_open_device_tree(const unsigned char *path) dprintf("Error opening root device at %s\n", path); return NULL; } + if (rootdev->directory == NULL) { + rootdev->directory = open_device_dir(rootdev->path); + if (rootdev->directory == NULL) + return NULL; + } if (rootdev->directory->subdirs != NULL) { dlist_for_each_data(rootdev->directory->subdirs, cur, struct sysfs_directory) { @@ -288,63 +279,25 @@ void sysfs_close_root_device(struct sysfs_root_device *root) } /** - * open_root_device_dir: opens up sysfs_directory for specific root dev - * @name: name of root - * returns struct sysfs_directory with success and NULL with error - */ -static struct sysfs_directory *open_root_device_dir(const unsigned char *name) -{ - struct sysfs_directory *rdir = NULL; - unsigned char rootpath[SYSFS_PATH_MAX]; - - if (name == NULL) { - errno = EINVAL; - return NULL; - } - - memset(rootpath, 0, SYSFS_PATH_MAX); - if (sysfs_get_mnt_path(rootpath, SYSFS_PATH_MAX) != 0) { - dprintf ("Sysfs not supported on this system\n"); - return NULL; - } - - if (sysfs_trailing_slash(rootpath) == 0) - strcat(rootpath, "/"); - - strcat(rootpath, SYSFS_DEVICES_NAME); - strcat(rootpath, "/"); - strcat(rootpath, name); - rdir = sysfs_open_directory(rootpath); - if (rdir == NULL) { - errno = EINVAL; - dprintf ("Root device %s not supported on this system\n", - name); - return NULL; - } - if (sysfs_read_directory(rdir) != 0) { - dprintf ("Error reading %s root device at dir %s\n", name, - rootpath); - sysfs_close_directory(rdir); - return NULL; - } - - return rdir; -} - -/** - * get_all_root_devices: opens up all the devices under this root device + * sysfs_get_root_devices: opens up all the devices under this root device * @root: root device to open devices for - * returns 0 with success and -1 with error + * returns dlist of devices with success and NULL with error */ -static int get_all_root_devices(struct sysfs_root_device *root) +struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root) { struct sysfs_device *dev = NULL; struct sysfs_directory *cur = NULL; - if (root == NULL || root->directory == NULL) { + if (root == NULL) { errno = EINVAL; - return -1; + return NULL; + } + if (root->directory == NULL) { + root->directory = open_device_dir(root->path); + if (root->directory == NULL) + return NULL; } + if (root->directory->subdirs == NULL) return 0; @@ -362,7 +315,7 @@ static int get_all_root_devices(struct sysfs_root_device *root) dlist_unshift(root->devices, dev); } - return 0; + return root->devices; } /** @@ -374,33 +327,37 @@ static int get_all_root_devices(struct sysfs_root_device *root) struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) { struct sysfs_root_device *root = NULL; - struct sysfs_directory *rootdir = NULL; + unsigned char rootpath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; return NULL; } - root = (struct sysfs_root_device *)calloc - (1, sizeof(struct sysfs_root_device)); - if (root == NULL) { - dprintf("calloc failure\n"); + memset(rootpath, 0, SYSFS_PATH_MAX); + if (sysfs_get_mnt_path(rootpath, SYSFS_PATH_MAX) != 0) { + dprintf ("Sysfs not supported on this system\n"); return NULL; } - rootdir = open_root_device_dir(name); - if (rootdir == NULL) { - dprintf ("Invalid root device, %s not supported\n", name); - sysfs_close_root_device(root); + + if (sysfs_trailing_slash(rootpath) == 0) + strcat(rootpath, "/"); + + strcat(rootpath, SYSFS_DEVICES_NAME); + strcat(rootpath, "/"); + strcat(rootpath, name); + if ((sysfs_path_is_dir(rootpath)) != 0) { + errno = EINVAL; + dprintf("Invalid root device: %s\n", name); return NULL; } - strcpy(root->path, rootdir->path); - root->directory = rootdir; - if (get_all_root_devices(root) != 0) { - dprintf ("Error retrieving devices for root %s\n", name); - sysfs_close_root_device(root); + root = (struct sysfs_root_device *)calloc + (1, sizeof(struct sysfs_root_device)); + if (root == NULL) { + dprintf("calloc failure\n"); return NULL; } - + strcpy(root->path, rootpath); return root; } @@ -411,12 +368,60 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) */ struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) { - if (device == NULL || device->directory == NULL) + if (device == NULL) return NULL; + if (device->directory == NULL) { + device->directory = sysfs_open_directory(device->path); + if (device->directory == NULL) + return NULL; + } + if (device->directory->attributes == NULL) { + if ((sysfs_read_dir_attributes(device->directory)) != 0) + return NULL; + } else { + if ((sysfs_path_is_dir(device->path)) != 0) { + dprintf("Device at %s no longer exists", device->path); + return NULL; + } + if ((sysfs_refresh_attributes + (device->directory->attributes)) != 0) { + dprintf("Error refreshing device attributes\n"); + return NULL; + } + } return (device->directory->attributes); } +/** + * sysfs_get_device_attr: searches dev's attributes by name + * @dev: device to look through + * @name: attribute name to get + * returns sysfs_attribute reference with success or NULL with error. + */ +struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, + const unsigned char *name) +{ + struct sysfs_attribute *cur = NULL; + struct dlist *attrlist = NULL; + + if (dev == NULL || name == NULL) { + errno = EINVAL; + return NULL; + } + + attrlist = sysfs_get_device_attributes(dev); + if (attrlist == NULL) + return NULL; + + cur = sysfs_get_directory_attribute(dev->directory, + (unsigned char *)name); + if (cur != NULL) + return cur; + + return NULL; +} + /** * get_device_absolute_path: looks up the bus the device is on, gets * absolute path to the device @@ -428,24 +433,27 @@ struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) static int get_device_absolute_path(const unsigned char *device, const unsigned char *bus, unsigned char *path, size_t psize) { - unsigned char bus_path[SYSFS_NAME_LEN]; + unsigned char bus_path[SYSFS_PATH_MAX]; if (device == NULL || path == NULL) { errno = EINVAL; return -1; } - memset(bus_path, 0, SYSFS_NAME_LEN); + memset(bus_path, 0, SYSFS_PATH_MAX); if (sysfs_get_mnt_path(bus_path, SYSFS_PATH_MAX) != 0) { dprintf ("Sysfs not supported on this system\n"); return -1; } + if (sysfs_trailing_slash(bus_path) == 0) strcat(bus_path, "/"); + strcat(bus_path, SYSFS_BUS_NAME); strcat(bus_path, "/"); strcat(bus_path, bus); - strcat(bus_path, SYSFS_DEVICES_DIR); + strcat(bus_path, "/"); + strcat(bus_path, SYSFS_DEVICES_NAME); strcat(bus_path, "/"); strcat(bus_path, device); /* @@ -464,7 +472,6 @@ static int get_device_absolute_path(const unsigned char *device, * @bus_id: bus_id of the device to open - has to be the "bus_id" in * /sys/bus/xxx/devices * @bus: bus the device belongs to - * @bsize: size of the bus buffer * returns struct sysfs_device if found, NULL otherwise * NOTE: * 1. Use sysfs_close_device to close the device @@ -472,7 +479,7 @@ static int get_device_absolute_path(const unsigned char *device, * Use sysfs_find_device_bus to get the bus name */ struct sysfs_device *sysfs_open_device_by_id(const unsigned char *bus_id, - const unsigned char *bus, size_t bsize) + const unsigned char *bus) { char sysfs_path[SYSFS_PATH_MAX]; struct sysfs_device *device = NULL; diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index e983d0eff4..ac2ecfcbe1 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -187,6 +187,13 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, return -1; } if (sysattr->method & SYSFS_METHOD_SHOW) { + /* + * read attribute again to see if we can get an updated value + */ + if ((sysfs_read_attribute(sysattr)) != 0) { + dprintf("Error reading attribute\n"); + return -1; + } if ((strncmp(sysattr->value, new_value, sysattr->len)) == 0) { dprintf("Attribute %s already has the requested value %s\n", sysattr->name, new_value); @@ -254,7 +261,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) unsigned char *fbuf = NULL; unsigned char *vbuf = NULL; size_t length = 0; - int pgsize = 0; + long pgsize = 0; int fd; if (sysattr == NULL) { @@ -269,7 +276,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) #ifdef __KLIBC__ pgsize = 0x4000; #else - pgsize = getpagesize(); + pgsize = sysconf(_SC_PAGESIZE); #endif fbuf = (unsigned char *)calloc(1, pgsize+1); if (fbuf == NULL) { @@ -288,6 +295,14 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) free(fbuf); return -1; } + if (sysattr->len > 0) { + if ((sysattr->len == length) && + (!(strncmp(sysattr->value, fbuf, length)))) { + close(fd); + return 0; + } + free(sysattr->value); + } sysattr->len = length; close(fd); vbuf = (unsigned char *)realloc(fbuf, length+1); @@ -389,6 +404,7 @@ void sysfs_close_directory(struct sysfs_directory *sysdir) if (sysdir->attributes != NULL) dlist_destroy(sysdir->attributes); free(sysdir); + sysdir = NULL; } } @@ -424,10 +440,12 @@ int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) errno = EINVAL; return -1; } - if (sysdir->subdirs == NULL) - return 0; + if (sysdir->subdirs == NULL) + if ((sysfs_read_dir_subdirs(sysdir) != 0) + || sysdir->subdirs == NULL) + return 0; dlist_for_each_data(sysdir->subdirs, cursub, struct sysfs_directory) { - if (sysfs_read_directory(cursub) != 0) + if ((sysfs_read_directory(cursub)) != 0) dprintf ("Error reading subdirectory %s\n", cursub->name); } @@ -494,18 +512,131 @@ struct sysfs_link *sysfs_open_link(const unsigned char *linkpath) } /** - * sysfs_read_directory: grabs attributes, links, and subdirectories + * sysfs_refresh_attributes: Refresh attributes list + * @attrlist: list of attributes to refresh + * Returns 0 on success, 1 on failure + */ +int sysfs_refresh_attributes(struct dlist *attrlist) +{ + struct sysfs_attribute *attr = NULL; + + if (attrlist == NULL) { + errno = EINVAL; + return 1; + } + dlist_for_each_data(attrlist, attr, struct sysfs_attribute) { + if (attr->method & SYSFS_METHOD_SHOW) { + if ((sysfs_read_attribute(attr)) != 0) { + dprintf("Error reading attribute %s\n", attr->path); + if ((sysfs_path_is_file(attr->path)) != 0) { + dprintf("Attr %s no longer exists\n", + attr->name); + } + } + } else { + if ((sysfs_path_is_file(attr->path)) != 0) { + dprintf("Attr %s no longer exists\n", + attr->name); + } + } + } + if (attrlist->count == 0) { + dprintf("No attributes in the list, destroying list now\n"); + dlist_destroy(attrlist); + attrlist = NULL; + return 1; + } + return 0; +} + +/** + * add_attribute: open and add attribute at path to given directory + * @sysdir: directory to add attribute to + * @path: path to attribute + * returns 0 with success and -1 with error. + */ +static int add_attribute(struct sysfs_directory *sysdir, + const unsigned char *path) +{ + struct sysfs_attribute *attr = NULL; + + attr = sysfs_open_attribute(path); + if (attr == NULL) { + dprintf("Error opening attribute %s\n", path); + return -1; + } + if (attr->method & SYSFS_METHOD_SHOW) { + if ((sysfs_read_attribute(attr)) != 0) { + dprintf("Error reading attribute %s\n", path); + sysfs_close_attribute(attr); + return 0; + } + } + + if (sysdir->attributes == NULL) { + sysdir->attributes = dlist_new_with_delete + (sizeof(struct sysfs_attribute), sysfs_del_attribute); + } + dlist_unshift(sysdir->attributes, attr); + + return 0; +} + +/** + * add_subdirectory: open and add subdirectory at path to given directory + * @sysdir: directory to add subdir to + * @path: path to subdirectory + * returns 0 with success and -1 with error. + */ +static int add_subdirectory(struct sysfs_directory *sysdir, + const unsigned char *path) +{ + struct sysfs_directory *subdir = NULL; + + subdir = sysfs_open_directory(path); + if (subdir == NULL) { + dprintf("Error opening directory %s\n", path); + return -1; + } + if (sysdir->subdirs == NULL) + sysdir->subdirs = dlist_new_with_delete + (sizeof(struct sysfs_directory), sysfs_del_directory); + dlist_unshift(sysdir->subdirs, subdir); + return 0; +} + +/** + * add_link: open and add link at path to given directory + * @sysdir: directory to add link to + * @path: path to link + * returns 0 with success and -1 with error. + */ +static int add_link(struct sysfs_directory *sysdir, const unsigned char *path) +{ + struct sysfs_link *ln = NULL; + + ln = sysfs_open_link(path); + if (ln == NULL) { + dprintf("Error opening link %s\n", path); + return -1; + } + if (sysdir->links == NULL) + sysdir->links = dlist_new_with_delete + (sizeof(struct sysfs_link), sysfs_del_link); + dlist_unshift(sysdir->links, ln); + return 0; +} + +/** + * sysfs_read_dir_attributes: grabs attributes for the given directory * @sysdir: sysfs directory to open * returns 0 with success and -1 with error. */ -int sysfs_read_directory(struct sysfs_directory *sysdir) +int sysfs_read_dir_attributes(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; struct stat astats; - struct sysfs_attribute *attr = NULL; - struct sysfs_directory *subdir = NULL; - struct sysfs_link *ln = NULL; unsigned char file_path[SYSFS_PATH_MAX]; int retval = 0; @@ -531,54 +662,52 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) dprintf("stat failed\n"); continue; } - if (S_ISREG(astats.st_mode)) { - attr = sysfs_open_attribute(file_path); - if (attr == NULL) { - dprintf("Error opening attribute %s\n", - file_path); - retval = -1; - break; - } - if (attr->method & SYSFS_METHOD_SHOW) { - if ((sysfs_read_attribute(attr)) != 0) { - dprintf("Error reading attribute %s\n", - file_path); - sysfs_close_attribute(attr); - continue; - } - } - - if (sysdir->attributes == NULL) { - sysdir->attributes = dlist_new_with_delete - (sizeof(struct sysfs_attribute), - sysfs_del_attribute); - } - dlist_unshift(sysdir->attributes, attr); - } else if (S_ISDIR(astats.st_mode)) { - subdir = sysfs_open_directory(file_path); - if (subdir == NULL) { - dprintf("Error opening directory %s\n", - file_path); - retval = -1; - break; - } - if (sysdir->subdirs == NULL) - sysdir->subdirs = dlist_new_with_delete - (sizeof(struct sysfs_directory), - sysfs_del_directory); - dlist_unshift(sysdir->subdirs, subdir); - } else if (S_ISLNK(astats.st_mode)) { - ln = sysfs_open_link(file_path); - if (ln == NULL) { - dprintf("Error opening link %s\n", file_path); - retval = -1; + if (S_ISREG(astats.st_mode)) + retval = add_attribute(sysdir, file_path); + } + closedir(dir); + return(retval); +} + +/** + * sysfs_read_dir_links: grabs links in a specific directory + * @sysdir: sysfs directory to read links + * returns 0 with success and -1 with error. + */ +int sysfs_read_dir_links(struct sysfs_directory *sysdir) +{ + DIR *dir = NULL; + struct dirent *dirent = NULL; + struct stat astats; + unsigned char file_path[SYSFS_PATH_MAX]; + int retval = 0; + + if (sysdir == NULL) { + errno = EINVAL; + return -1; + } + dir = opendir(sysdir->path); + if (dir == NULL) { + dprintf("Error opening directory %s\n", sysdir->path); + return -1; + } + while(((dirent = readdir(dir)) != NULL) && retval == 0) { + if (0 == strcmp(dirent->d_name, ".")) + continue; + if (0 == strcmp(dirent->d_name, "..")) + continue; + memset(file_path, 0, SYSFS_PATH_MAX); + strncpy(file_path, sysdir->path, sizeof(file_path)); + strncat(file_path, "/", sizeof(file_path)); + strncat(file_path, dirent->d_name, sizeof(file_path)); + if ((lstat(file_path, &astats)) != 0) { + dprintf("stat failed\n"); + continue; + } + if (S_ISLNK(astats.st_mode)) { + retval = add_link(sysdir, file_path); + if (retval != 0) break; - } - if (sysdir->links == NULL) - sysdir->links = dlist_new_with_delete - (sizeof(struct sysfs_link), - sysfs_del_link); - dlist_unshift(sysdir->links, ln); } } closedir(dir); @@ -586,7 +715,98 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) } /** - * sysfs_get_directory_attribute: retrieves attribute attrname + * sysfs_read_dir_subdirs: grabs subdirs in a specific directory + * @sysdir: sysfs directory to read links + * returns 0 with success and -1 with error. + */ +int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir) +{ + DIR *dir = NULL; + struct dirent *dirent = NULL; + struct stat astats; + unsigned char file_path[SYSFS_PATH_MAX]; + int retval = 0; + + if (sysdir == NULL) { + errno = EINVAL; + return -1; + } + dir = opendir(sysdir->path); + if (dir == NULL) { + dprintf("Error opening directory %s\n", sysdir->path); + return -1; + } + while(((dirent = readdir(dir)) != NULL) && retval == 0) { + if (0 == strcmp(dirent->d_name, ".")) + continue; + if (0 == strcmp(dirent->d_name, "..")) + continue; + memset(file_path, 0, SYSFS_PATH_MAX); + strncpy(file_path, sysdir->path, sizeof(file_path)); + strncat(file_path, "/", sizeof(file_path)); + strncat(file_path, dirent->d_name, sizeof(file_path)); + if ((lstat(file_path, &astats)) != 0) { + dprintf("stat failed\n"); + continue; + } + if (S_ISDIR(astats.st_mode)) + retval = add_subdirectory(sysdir, file_path); + } + closedir(dir); + return(retval); +} + +/** + * sysfs_read_directory: grabs attributes, links, and subdirectories + * @sysdir: sysfs directory to open + * returns 0 with success and -1 with error. + */ +int sysfs_read_directory(struct sysfs_directory *sysdir) +{ + DIR *dir = NULL; + struct dirent *dirent = NULL; + struct stat astats; + unsigned char file_path[SYSFS_PATH_MAX]; + int retval = 0; + + if (sysdir == NULL) { + errno = EINVAL; + return -1; + } + dir = opendir(sysdir->path); + if (dir == NULL) { + dprintf("Error opening directory %s\n", sysdir->path); + return -1; + } + while(((dirent = readdir(dir)) != NULL) && retval == 0) { + if (0 == strcmp(dirent->d_name, ".")) + continue; + if (0 == strcmp(dirent->d_name, "..")) + continue; + memset(file_path, 0, SYSFS_PATH_MAX); + strncpy(file_path, sysdir->path, sizeof(file_path)); + strncat(file_path, "/", sizeof(file_path)); + strncat(file_path, dirent->d_name, sizeof(file_path)); + if ((lstat(file_path, &astats)) != 0) { + dprintf("stat failed\n"); + continue; + } + if (S_ISDIR(astats.st_mode)) + retval = add_subdirectory(sysdir, file_path); + + else if (S_ISLNK(astats.st_mode)) + retval = add_link(sysdir, file_path); + + else if (S_ISREG(astats.st_mode)) + retval = add_attribute(sysdir, file_path); + } + closedir(dir); + return(retval); +} + +/** + * sysfs_get_directory_attribute: retrieves attribute attrname from current + * directory only * @dir: directory to retrieve attribute from * @attrname: name of attribute to look for * returns sysfs_attribute if found and NULL if not found @@ -594,27 +814,38 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) struct sysfs_attribute *sysfs_get_directory_attribute (struct sysfs_directory *dir, unsigned char *attrname) { - struct sysfs_directory *sdir = NULL; struct sysfs_attribute *attr = NULL; + unsigned char new_path[SYSFS_PATH_MAX]; if (dir == NULL || attrname == NULL) { errno = EINVAL; return NULL; } - - attr = (struct sysfs_attribute *)dlist_find_custom(dir->attributes, - attrname, dir_attribute_name_equal); - if (attr != NULL) + + if (dir->attributes == NULL) + if ((sysfs_read_dir_attributes(dir) != 0) + || (dir->attributes == NULL)) + return NULL; + + attr = (struct sysfs_attribute *)dlist_find_custom + (dir->attributes, attrname, dir_attribute_name_equal); + if (attr != NULL) { + /* + * don't read here since we would have read the attribute in + * in the routine that called this routine + */ return attr; - - if (dir->subdirs != NULL) { - dlist_for_each_data(dir->subdirs, sdir, - struct sysfs_directory) { - if (sdir->attributes == NULL) - continue; - attr = sysfs_get_directory_attribute(sdir, attrname); - if (attr != NULL) - return attr; + } else { + memset(new_path, 0, SYSFS_PATH_MAX); + strcpy(new_path, dir->path); + strcat(new_path, "/"); + strcat(new_path, attrname); + if ((sysfs_path_is_file(new_path)) == 0) { + if ((add_attribute(dir, new_path)) == 0) { + attr = (struct sysfs_attribute *)dlist_find_custom + (dir->attributes, attrname, dir_attribute_name_equal); + } + return attr; } } return NULL; @@ -633,6 +864,10 @@ struct sysfs_link *sysfs_get_directory_link errno = EINVAL; return NULL; } + if (dir->links == NULL) + if ((sysfs_read_dir_links(dir) != 0) || (dir->links == NULL)) + return NULL; + return (struct sysfs_link *)dlist_find_custom(dir->links, linkname, dir_link_name_equal); } @@ -648,10 +883,15 @@ struct sysfs_directory *sysfs_get_subdirectory(struct sysfs_directory *dir, { struct sysfs_directory *sub = NULL, *cursub = NULL; - if (dir == NULL || dir->subdirs == NULL || subname == NULL) { + if (dir == NULL || subname == NULL) { errno = EINVAL; return NULL; } + + if (dir->subdirs == NULL) + if (sysfs_read_dir_subdirs(dir) != 0) + return NULL; + sub = (struct sysfs_directory *)dlist_find_custom(dir->subdirs, subname, dir_subdir_name_equal); if (sub != NULL) @@ -660,8 +900,12 @@ struct sysfs_directory *sysfs_get_subdirectory(struct sysfs_directory *dir, if (dir->subdirs != NULL) { dlist_for_each_data(dir->subdirs, cursub, struct sysfs_directory) { - if (cursub->subdirs == NULL) - continue; + if (cursub->subdirs == NULL) { + if (sysfs_read_dir_subdirs(cursub) != 0) + continue; + if (cursub->subdirs == NULL) + continue; + } sub = sysfs_get_subdirectory(cursub, subname); if (sub != NULL) return sub; @@ -682,7 +926,7 @@ struct sysfs_link *sysfs_get_subdirectory_link(struct sysfs_directory *dir, struct sysfs_directory *cursub = NULL; struct sysfs_link *ln = NULL; - if (dir == NULL || dir->links == NULL || linkname == NULL) { + if (dir == NULL || linkname == NULL) { errno = EINVAL; return NULL; } @@ -691,14 +935,13 @@ struct sysfs_link *sysfs_get_subdirectory_link(struct sysfs_directory *dir, if (ln != NULL) return ln; - if (dir->subdirs == NULL) - return NULL; + if (dir->subdirs == NULL) + if (sysfs_read_dir_subdirs(dir) != 0) + return NULL; if (dir->subdirs != NULL) { dlist_for_each_data(dir->subdirs, cursub, struct sysfs_directory) { - if (cursub->subdirs == NULL) - continue; ln = sysfs_get_subdirectory_link(cursub, linkname); if (ln != NULL) return ln; diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index 1877dbce0b..4372b19f10 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -23,36 +23,16 @@ #include "libsysfs.h" #include "sysfs.h" -static void sysfs_close_driver_by_name_dev(void *device) +static void sysfs_close_driver_device(void *device) { sysfs_close_device((struct sysfs_device *)device); } -/** - * sysfs_close_driver: closes and cleans up driver structure - * NOTE: This routine does not deallocate devices list - * @driver: driver to close - */ -void sysfs_close_driver(struct sysfs_driver *driver) -{ - if (driver != NULL) { - if (driver->devices != NULL) { - dlist_for_each(driver->devices) - dlist_shift(driver->devices); - free(driver->devices); - driver->devices = NULL; - } - if (driver->directory != NULL) - sysfs_close_directory(driver->directory); - free(driver); - } -} - /** - * sysfs_close_driver_by_name: closes driver and deletes device lists too + * sysfs_close_driver: closes driver and deletes device lists too * @driver: driver to close */ -void sysfs_close_driver_by_name(struct sysfs_driver *driver) +void sysfs_close_driver(struct sysfs_driver *driver) { if (driver != NULL) { if (driver->devices != NULL) @@ -63,6 +43,51 @@ void sysfs_close_driver_by_name(struct sysfs_driver *driver) } } +/** + * open_driver_dir: Open the sysfs_directory for this driver + * @driver: Driver whose directory to be opened + * Returns 0 on success and 1 on failure + */ +static int open_driver_dir(struct sysfs_driver *driver) +{ + if (driver == NULL) { + errno = EINVAL; + return 1; + } + if (driver->directory == NULL) { + driver->directory = sysfs_open_directory(driver->path); + if (driver->directory == NULL) { + dprintf("Error opening driver directory at %s\n", + driver->path); + return 1; + } + } + return 0; +} + +/** + * read_driver_dir: Read driver directory's subdirs and links + * @driver: Driver to read + * Returns 0 on success and 1 on failure + */ +static int read_driver_dir(struct sysfs_driver *driver) +{ + if (driver == NULL) { + errno = EINVAL; + return 1; + } + if (driver->directory == NULL) { + if ((open_driver_dir(driver)) == 1) + return 1; + } + if ((sysfs_read_directory(driver->directory)) != 0) { + dprintf("Error reading driver directory at %s\n", + driver->path); + return 1; + } + return 0; +} + /** * alloc_driver: allocates and initializes driver * returns struct sysfs_driver with success and NULL with error. @@ -80,31 +105,27 @@ static struct sysfs_driver *alloc_driver(void) struct sysfs_driver *sysfs_open_driver(const unsigned char *path) { struct sysfs_driver *driver = NULL; - struct sysfs_directory *sdir = NULL; if (path == NULL) { errno = EINVAL; return NULL; } - sdir = sysfs_open_directory(path); - if (sdir == NULL) { - dprintf("Error opening directory %s\n", path); - return NULL; - } - if ((sysfs_read_directory(sdir)) != 0) { - dprintf("Error reading directory %s\n", path); - sysfs_close_directory(sdir); + if ((sysfs_path_is_dir(path)) != 0) { + dprintf("Invalid path to driver: %s\n", path); return NULL; } driver = alloc_driver(); if (driver == NULL) { dprintf("Error allocating driver at %s\n", path); - sysfs_close_directory(sdir); return NULL; } - strcpy(driver->name, sdir->name); - driver->directory = sdir; - strcpy(driver->path, sdir->path); + if ((sysfs_get_name_from_path(path, driver->name, + SYSFS_NAME_LEN)) != 0) { + dprintf("Error getting driver name from path\n"); + free(driver); + return NULL; + } + strcpy(driver->path, path); return driver; } @@ -117,9 +138,32 @@ struct sysfs_driver *sysfs_open_driver(const unsigned char *path) */ struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) { - if (driver == NULL || driver->directory == NULL) + if (driver == NULL) { + errno = EINVAL; return NULL; + } + if (driver->directory == NULL) { + if ((open_driver_dir(driver)) == 1) + return NULL; + } + if (driver->directory->attributes == NULL) { + if ((sysfs_read_dir_attributes(driver->directory)) != 0) { + dprintf("Error reading driver attributes\n"); + return NULL; + } + } else { + if ((sysfs_path_is_dir(driver->path)) != 0) { + dprintf("Driver at %s no longer exists\n", + driver->path); + return NULL; + } + if ((sysfs_refresh_attributes + (driver->directory->attributes)) != 0) { + dprintf("Error refreshing driver attributes\n"); + return NULL; + } + } return(driver->directory->attributes); } @@ -133,18 +177,20 @@ struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, const unsigned char *name) { struct sysfs_attribute *cur = NULL; + struct dlist *attrlist = NULL; - if (drv == NULL || drv->directory == NULL - || drv->directory->attributes == NULL || name == NULL) { + if (drv == NULL) { errno = EINVAL; return NULL; } - - cur = sysfs_get_directory_attribute(drv->directory, - (unsigned char *)name); - if (cur != NULL) - return cur; - + + attrlist = sysfs_get_driver_attributes(drv); + if (attrlist != NULL) { + cur = sysfs_get_directory_attribute(drv->directory, + (unsigned char *)name); + if (cur != NULL) + return cur; + } return NULL; } @@ -156,12 +202,95 @@ struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, */ struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver) { - if (driver == NULL || driver->directory == NULL) + if (driver == NULL) { + errno = EINVAL; return NULL; - + } + if (driver->directory == NULL) { + if ((open_driver_dir(driver)) == 1) + return NULL; + if ((read_driver_dir(driver)) != 0) + return NULL; + } return(driver->directory->links); } +/** + * sysfs_get_driver_devices: open up the list of devices this driver supports + * @driver: sysfs_driver for which devices are needed + * Returns dlist of devices on SUCCESS or NULL with ERROR + */ +struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver) +{ + struct sysfs_link *curlink = NULL; + struct sysfs_device *device = NULL; + + if (driver == NULL) { + errno = EINVAL; + return NULL; + } + + if (driver->devices != NULL) + return (driver->devices); + + if (driver->directory == NULL) { + if ((open_driver_dir(driver)) == 1) + return NULL; + if ((read_driver_dir(driver)) != 0) + return NULL; + } + if (driver->directory->links != NULL) { + dlist_for_each_data(driver->directory->links, curlink, + struct sysfs_link) { + device = sysfs_open_device(curlink->target); + if (device == NULL) { + dprintf("Error opening device at %s\n", + curlink->target); + return NULL; + } + strcpy(device->driver_name, driver->name); + if (driver->devices == NULL) + driver->devices = dlist_new_with_delete + (sizeof(struct sysfs_device), + sysfs_close_driver_device); + dlist_unshift(driver->devices, device); + } + } + return (driver->devices); +} + +/** + * sysfs_get_driver_device: looks up a device from a list of driver's devices + * and returns its sysfs_device corresponding to it + * @driver: sysfs_driver on which to search + * @name: name of the device to search + * Returns a sysfs_device if found, NULL otherwise + */ +struct sysfs_device *sysfs_get_driver_device(struct sysfs_driver *driver, + const unsigned char *name) +{ + struct sysfs_device *device = NULL; + struct dlist *devlist = NULL; + + if (driver == NULL || name == NULL) { + errno = EINVAL; + return NULL; + } + + if (driver->devices == NULL) { + devlist = sysfs_get_driver_devices(driver); + if (devlist == NULL) { + dprintf("Error getting driver devices\n"); + return NULL; + } + } + dlist_for_each_data(driver->devices, device, struct sysfs_device) { + if (!(strncmp(device->name, name, SYSFS_NAME_LEN))) + return device; + } + return NULL; +} + /** * get_driver_path: looks up the bus the driver is on and builds path to * the driver. @@ -171,8 +300,8 @@ struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver) * @psize: size of "path" * Returns 0 on success and -1 on error */ -static int get_driver_path(const unsigned char *bus, const unsigned char *drv, - unsigned char *path, size_t psize) +static int get_driver_path(const unsigned char *bus, + const unsigned char *drv, unsigned char *path, size_t psize) { if (bus == NULL || drv == NULL || path == NULL) { errno = EINVAL; @@ -187,69 +316,13 @@ static int get_driver_path(const unsigned char *bus, const unsigned char *drv, strcat(path, SYSFS_BUS_NAME); strcat(path, "/"); strcat(path, bus); - strcat(path, SYSFS_DRIVERS_DIR); + strcat(path, "/"); + strcat(path, SYSFS_DRIVERS_NAME); strcat(path, "/"); strcat(path, drv); return 0; } -/** - * sysfs_open_driver_by_name: open a driver by name and return the bus - * the driver is on. - * @drv_name: driver to open - * @bus: the driver bus - * @bsize: size of bus buffer - * returns struct sysfs_driver if found, NULL otherwise - * NOTE: - * 1. Need to call sysfs_close_driver_by_name to free up memory - * 2. Bus the driver is registered with must be supplied. - * Use sysfs_find_driver_bus() to obtain the bus name - */ -struct sysfs_driver *sysfs_open_driver_by_name(const unsigned char *drv_name, - const unsigned char *bus, size_t bsize) -{ - struct sysfs_driver *driver = NULL; - struct sysfs_device *device = NULL; - struct sysfs_link *curlink = NULL; - unsigned char path[SYSFS_PATH_MAX]; - - if (drv_name == NULL || bus == NULL) { - errno = EINVAL; - return NULL; - } - - memset(path, 0, SYSFS_PATH_MAX); - if (get_driver_path(bus, drv_name, path, SYSFS_PATH_MAX) != 0) { - dprintf("Error getting to driver %s\n", drv_name); - return NULL; - } - driver = sysfs_open_driver(path); - if (driver == NULL) { - dprintf("Could not open driver %s\n", drv_name); - return NULL; - } - if (driver->directory->links != NULL) { - dlist_for_each_data(driver->directory->links, curlink, - struct sysfs_link) { - device = sysfs_open_device(curlink->target); - if (device == NULL) { - dprintf("Error opening device at %s\n", - curlink->target); - sysfs_close_driver_by_name(driver); - return NULL; - } - strcpy(device->driver_name, drv_name); - if (driver->devices == NULL) - driver->devices = dlist_new_with_delete - (sizeof(struct sysfs_device), - sysfs_close_driver_by_name_dev); - dlist_unshift(driver->devices, device); - } - } - return driver; -} - - /** * sysfs_open_driver_attr: read the user supplied driver attribute * @bus: bus on which to look diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 627e618dce..c2ce13433d 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -280,7 +280,7 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) * name requested here is "class", verify if "block" is supported on * this system and return the same. */ - if (strcmp(name, SYSFS_CLASS_DIR) == 0) { + if (strcmp(name, SYSFS_CLASS_NAME) == 0) { c = strstr(sysfs_path, SYSFS_CLASS_NAME); if (c == NULL) goto out; @@ -325,7 +325,8 @@ struct dlist *sysfs_open_bus_devices_list(unsigned char *name) strcat(sysfs_path, SYSFS_BUS_NAME); strcat(sysfs_path, "/"); strcat(sysfs_path, name); - strcat(sysfs_path, SYSFS_DEVICES_DIR); + strcat(sysfs_path, "/"); + strcat(sysfs_path, SYSFS_DEVICES_NAME); dir = sysfs_open_directory(sysfs_path); if (dir == NULL) { dprintf("Error opening sysfs_directory at %s\n", sysfs_path); @@ -358,3 +359,71 @@ struct dlist *sysfs_open_bus_devices_list(unsigned char *name) return list; } +/** + * sysfs_path_is_dir: Check if the path supplied points to a directory + * @path: path to validate + * Returns 0 if path points to dir, 1 otherwise + */ +int sysfs_path_is_dir(const unsigned char *path) +{ + struct stat astats; + + if (path == NULL) { + errno = EINVAL; + return 1; + } + if ((lstat(path, &astats)) != 0) { + dprintf("stat() failed\n"); + return 1; + } + if (S_ISDIR(astats.st_mode)) + return 0; + + return 1; +} + +/** + * sysfs_path_is_link: Check if the path supplied points to a link + * @path: path to validate + * Returns 0 if path points to link, 1 otherwise + */ +int sysfs_path_is_link(const unsigned char *path) +{ + struct stat astats; + + if (path == NULL) { + errno = EINVAL; + return 1; + } + if ((lstat(path, &astats)) != 0) { + dprintf("stat() failed\n"); + return 1; + } + if (S_ISLNK(astats.st_mode)) + return 0; + + return 1; +} + +/** + * sysfs_path_is_file: Check if the path supplied points to a file + * @path: path to validate + * Returns 0 if path points to file, 1 otherwise + */ +int sysfs_path_is_file(const unsigned char *path) +{ + struct stat astats; + + if (path == NULL) { + errno = EINVAL; + return 1; + } + if ((lstat(path, &astats)) != 0) { + dprintf("stat() failed\n"); + return 1; + } + if (S_ISREG(astats.st_mode)) + return 0; + + return 1; +} diff --git a/namedev.c b/namedev.c index 75e4d22370..633a7bf0da 100644 --- a/namedev.c +++ b/namedev.c @@ -552,37 +552,29 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud struct sysfs_device *sysfs_device = NULL; struct sysfs_class_device *class_dev_parent = NULL; int retval = 0; - char *temp = NULL; struct perm_device *perm; udev->mode = 0; /* find the sysfs_device for this class device */ /* Wouldn't it really be nice if libsysfs could do this for us? */ - if (class_dev->sysdevice) { - sysfs_device = class_dev->sysdevice; - } else { + sysfs_device = sysfs_get_classdev_device(class_dev); + if (sysfs_device == NULL) { /* bah, let's go backwards up a level to see if the device is there, * as block partitions don't point to the physical device. Need to fix that * up in the kernel... */ - if (strstr(class_dev->path, "block")) { + if (strcmp(class_dev->classname, SYSFS_BLOCK_NAME) == 0) { dbg("looking at block device"); if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { - char path[SYSFS_PATH_MAX]; - dbg("really is a partition"); - strfieldcpy(path, class_dev->path); - temp = strrchr(path, '/'); - *temp = 0x00; - dbg("looking for a class device at '%s'", path); - class_dev_parent = sysfs_open_class_device(path); + class_dev_parent = sysfs_get_classdev_parent + (class_dev); if (class_dev_parent == NULL) { - dbg("sysfs_open_class_device at '%s' failed", path); + dbg("sysfs_get_classdev_parent for class device '%s' failed", class_dev->name); } else { dbg("class_dev_parent->name='%s'", class_dev_parent->name); - if (class_dev_parent->sysdevice) - sysfs_device = class_dev_parent->sysdevice; + sysfs_device = sysfs_get_classdev_device(class_dev_parent); } } } @@ -643,9 +635,6 @@ done: dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", udev->name, udev->owner, udev->group, udev->mode); - if (class_dev_parent) - sysfs_close_class_device(class_dev_parent); - return 0; } diff --git a/udev-add.c b/udev-add.c index e64a845c7e..33ee633fd8 100644 --- a/udev-add.c +++ b/udev-add.c @@ -54,14 +54,14 @@ static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) { int retval = -ENODEV; - char *dev; + struct sysfs_attribute *attr = NULL; - dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev"); - if (dev == NULL) + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr == NULL) goto exit; - dbg("dev='%s'", dev); + dbg("dev='%s'", attr->value); - if (sscanf(dev, "%u:%u", &udev->major, &udev->minor) != 2) + if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2) goto exit; dbg("found major=%d, minor=%d", udev->major, udev->minor); -- cgit v1.2.3-54-g00ecf From d870b833e9c1f7fb49f0ecf659f53e7f1cf5324e Mon Sep 17 00:00:00 2001 From: "eike-hotplug@sf-tec.de" Date: Mon, 15 Dec 2003 22:22:30 -0800 Subject: [PATCH] add init.d/udev to the spec file add /etc/init.d/udev to the SPEC-File and this way to the RPM --- udev.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/udev.spec b/udev.spec index a005b12dfa..bd455ef2b1 100644 --- a/udev.spec +++ b/udev.spec @@ -36,6 +36,7 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) /etc/udev/udev.rules %attr(0644,root,root) /etc/udev/udev.permissions %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug +%attr(755,root,root) /etc/init.d/udev %attr(0644,root,root) %{_mandir}/man8/udev.8* %changelog -- cgit v1.2.3-54-g00ecf From dbc9b3f3a20520db6fcf791a3663ab943fc193d9 Mon Sep 17 00:00:00 2001 From: "eike-hotplug@sf-tec.de" Date: Mon, 15 Dec 2003 22:22:34 -0800 Subject: [PATCH] add init.d/udev to "make install" adds /etc/init.d/udev to "make install" --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 9415e1ec97..bd9a9035ee 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,7 @@ mandir = ${prefix}/usr/share/man hotplugdir = ${etcdir}/hotplug.d/default dbusdir = ${etcdir}/dbus-1/system.d configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -278,6 +279,7 @@ install: install-dbus-policy all $(GEN_CONFIGS) $(INSTALL) -d $(DESTDIR)$(configdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) + $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir) $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir) -- cgit v1.2.3-54-g00ecf From 5a3ee97760a8882e22435ca6424c54af8d8782be Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 15 Dec 2003 22:25:03 -0800 Subject: [PATCH] Add restart target to the etc/init.d/udev script Change made by Rolf Eike Beer --- etc/init.d/udev | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/etc/init.d/udev b/etc/init.d/udev index 5c09afd205..36ef2dafda 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -64,11 +64,15 @@ case "$1" in echo "the udev device node directory does not exist" fi ;; - restart|reload) + restart) + $0 stop + $0 start + ;; + reload) # nothing to do here ;; *) - echo "Usage: $0 {start|stop|status}" + echo "Usage: $0 {start|stop|status|restart}" exit 1 esac -- cgit v1.2.3-54-g00ecf From 2052464275b50f27cc563aaee24aadd791a9d8ca Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 15 Dec 2003 22:38:18 -0800 Subject: [PATCH] remove '\n' from end of callout return remove possible newline at end of callout output, for easier matching with ID= --- namedev.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/namedev.c b/namedev.c index 633a7bf0da..74a411799b 100644 --- a/namedev.c +++ b/namedev.c @@ -264,7 +264,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) pid_t pid; int value_set = 0; char buffer[256]; - char *arg; + char *pos; char *args[CALLOUT_MAXARG]; int i; @@ -286,9 +286,9 @@ static int exec_callout(struct config_device *dev, char *value, int len) dup(fds[1]); /* dup write side of pipe to STDOUT */ if (strchr(dev->exec_program, ' ')) { /* callout with arguments */ - arg = dev->exec_program; + pos = dev->exec_program; for (i=0; i < CALLOUT_MAXARG-1; i++) { - args[i] = strsep(&arg, " "); + args[i] = strsep(&pos, " "); if (args[i] == NULL) break; } @@ -324,9 +324,12 @@ static int exec_callout(struct config_device *dev, char *value, int len) } else { value_set = 1; strncpy(value, buffer, len); + pos = value + strlen(value)-1; + if (pos[0] == '\n') + pos[0] = '\0'; + dbg("callout returned '%s'", value); } } - dbg("callout returned '%s'", value); close(fds[0]); res = wait(&status); if (res < 0) { -- cgit v1.2.3-54-g00ecf From b1c5e3339deb97f4a30053111b444489a3bc9562 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 15 Dec 2003 22:54:38 -0800 Subject: [PATCH] get part of callout return string Try this patch if you like, to get special parts of the callout output. This beast works now: CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c" The callout returned string is separated by spaces and is addressed by the "len" value of the 'c' format char. Since we support symlinks, this my be useful for other uses of callout too. introduce 'len number' for format chars the first use is 'c'-the callout return to select a part of the output string like: CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME="%1c", SYMLINK="%2c %3c" (note: first part is requested by len=1, len=0 will return the whole string) add a test to udev-test.pl --- namedev.c | 41 ++++++++++++++++++++++++++++++++++++----- test/udev-test.pl | 9 +++++++++ 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/namedev.c b/namedev.c index 74a411799b..212d6bb68d 100644 --- a/namedev.c +++ b/namedev.c @@ -200,15 +200,30 @@ static void build_kernel_number(struct sysfs_class_device *class_dev, struct ude static void apply_format(struct udevice *udev, unsigned char *string) { char name[NAME_SIZE]; + char temp[NAME_SIZE]; + char *tail; char *pos; + char *pos2; + char *pos3; + int num; while (1) { + num = 0; pos = strchr(string, '%'); if (pos) { - strfieldcpy(name, pos+2); - *pos = 0x00; - switch (pos[1]) { + *pos = '\0'; + tail = pos+1; + if (isdigit(tail[0])) { + num = (int) strtoul(&pos[1], &tail, 10); + if (tail == NULL) { + dbg("format parsing error '%s'", pos+1); + break; + } + } + strfieldcpy(name, tail+1); + + switch (tail[0]) { case 'b': if (strlen(udev->bus_id) == 0) break; @@ -241,8 +256,24 @@ static void apply_format(struct udevice *udev, unsigned char *string) case 'c': if (strlen(udev->callout_value) == 0) break; - strcat(pos, udev->callout_value); - dbg("substitute callout output '%s'", udev->callout_value); + if (num) { + /* get part of return string */ + strncpy(temp, udev->callout_value, sizeof(temp)); + pos2 = temp; + while (num) { + num--; + pos3 = strsep(&pos2, " "); + if (pos3 == NULL) { + dbg("requested part of callout string not found"); + break; + } + } + strcat(pos, pos3); + dbg("substitute partial callout output '%s'", pos3); + } else { + strcat(pos, udev->callout_value); + dbg("substitute callout output '%s'", udev->callout_value); + } break; default: dbg("unknown substitution type '%%%c'", pos[1]); diff --git a/test/udev-test.pl b/test/udev-test.pl index 3dfbaa2530..1a35e3da82 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -150,6 +150,15 @@ EOF expected => "test-0:0:0:0" , conf => < "callout program substitution (numbered part of)", + subsys => "block", + devpath => "block/sda/sda3", + expected => "link1" , + conf => < Date: Mon, 15 Dec 2003 23:25:51 -0800 Subject: [PATCH] more extras/multipath changes * Make the HW-specific get_unique_id switch pretty * Prepare to field-test by whitelisting all known fibre array, try to fetch WWID from the standard EVPD 0x83 off 8 for everyone ... we will learn from feedback :) Could you drop a note with the udev-009 release-notes asking for testing this WWID fetching thing ? --- extras/multipath/main.c | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/extras/multipath/main.c b/extras/multipath/main.c index 6b1c37cd95..9402888c58 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -160,8 +160,11 @@ get_serial (int fd, char * str) */ /* hardware vendor specifics : add support for new models below */ + +/* this one get EVPD page 0x83 off 8 */ +/* tested ok with StorageWorks */ static int -get_storageworks_wwid(int fd, char *str) +get_evpd_wwid(int fd, char *str) { char buff[64]; @@ -176,12 +179,39 @@ get_storageworks_wwid(int fd, char *str) static int get_unique_id(int fd, struct path * mypath) { - if (strncmp(mypath->product_id, "HSV110 (C)COMPAQ", 16) == 0 || - strncmp(mypath->product_id, "HSG80 ", 16) == 0) { - get_storageworks_wwid(fd, mypath->wwid); - return 0; - } + int i; + static struct { + char * vendor; + char * product; + int (*getuid) (int fd, char * wwid); + } wlist[] = { + {"COMPAQ ", "HSV110 (C)COMPAQ", &get_evpd_wwid}, + {"COMPAQ ", "MSA1000 ", &get_evpd_wwid}, + {"COMPAQ ", "MSA1000 VOLUME ", &get_evpd_wwid}, + {"DEC ", "HSG80 ", &get_evpd_wwid}, + {"HP ", "HSV100 ", &get_evpd_wwid}, + {"HP ", "A6189A ", &get_evpd_wwid}, + {"HP ", "OPEN- ", &get_evpd_wwid}, + {"DDN ", "SAN DataDirector", &get_evpd_wwid}, + {"FSC ", "CentricStor ", &get_evpd_wwid}, + {"HITACHI ", "DF400 ", &get_evpd_wwid}, + {"HITACHI ", "DF500 ", &get_evpd_wwid}, + {"HITACHI ", "DF600 ", &get_evpd_wwid}, + {"IBM ", "ProFibre 4000R ", &get_evpd_wwid}, + {"SGI ", "TP9100 ", &get_evpd_wwid}, + {"SGI ", "TP9300 ", &get_evpd_wwid}, + {"SGI ", "TP9400 ", &get_evpd_wwid}, + {"SGI ", "TP9500 ", &get_evpd_wwid}, + {NULL, NULL, NULL}, + }; + for (i = 0; wlist[i].vendor; i++) { + if (strncmp(mypath->vendor_id, wlist[i].vendor, 8) == 0 && + strncmp(mypath->product_id, wlist[i].product, 16) == 0) { + wlist[i].getuid(fd, mypath->wwid); + return 0; + } + } return 1; } -- cgit v1.2.3-54-g00ecf From 316c51507724406f2ded06d067f55e867df90b15 Mon Sep 17 00:00:00 2001 From: "rml@ximian.com" Date: Tue, 16 Dec 2003 23:30:15 -0800 Subject: [PATCH] install initscript in udev rpm Attached patch installs the initscript via 'make install' and adds it to the RPM package. The RPM script then runs chkconfig(8) to setup the initscript to run at the appropriate runlevels. --- Makefile | 1 + udev.spec | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Makefile b/Makefile index bd9a9035ee..4a545db9c4 100644 --- a/Makefile +++ b/Makefile @@ -297,6 +297,7 @@ uninstall: uninstall-dbus-policy - rm $(configdir)/udev.permissions - rm $(configdir)/udev.rules - rm $(configdir)/udev.conf + - rm $(initdir)/udev - rm $(mandir)/man8/udev.8 - rm $(sbindir)/$(ROOT) - rmdir $(hotplugdir) diff --git a/udev.spec b/udev.spec index bd455ef2b1..516239bc6d 100644 --- a/udev.spec +++ b/udev.spec @@ -23,6 +23,9 @@ make CC="gcc $RPM_OPT_FLAGS" %install make DESTDIR=$RPM_BUILD_ROOT install +%post +/sbin/chkconfig --add udev + %clean rm -rf $RPM_BUILD_ROOT @@ -40,6 +43,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_mandir}/man8/udev.8* %changelog +* Tue Dec 16 2003 Robert Love +- install the initscript and run chkconfig on it + * Tue Nov 2 2003 Greg Kroah-Hartman - changes due to config file name changes -- cgit v1.2.3-54-g00ecf From 600ee7f73e5381764803725e68a0f953bd2f46fd Mon Sep 17 00:00:00 2001 From: "rml@ximian.com" Date: Tue, 16 Dec 2003 23:31:16 -0800 Subject: [PATCH] remove udev from runlevels on uninstall I guess we should run 'chkconfig --del udev' on removal to clear out the now-stale udev entries, if any. --- udev.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/udev.spec b/udev.spec index 516239bc6d..3f71e1452c 100644 --- a/udev.spec +++ b/udev.spec @@ -26,6 +26,11 @@ make DESTDIR=$RPM_BUILD_ROOT install %post /sbin/chkconfig --add udev +%postun +if [ $1 = 0 ]; then + /sbin/chkconfig --del udev +fi + %clean rm -rf $RPM_BUILD_ROOT -- cgit v1.2.3-54-g00ecf From d94df232423870641132b307d74281f692219730 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 16 Dec 2003 23:36:19 -0800 Subject: [PATCH] don't rely on field order in namedev_parse o change the parsing to get a key from the rule and sort it into our list of known keys instead of expecting a special order o the key to match a sysfs file must be prependend by 'SYSFS_' now to match with the new parsing. (The config must be changed, but it's a bit more descriptive too.) o put names of fields in define's, like the name of the methods o update all tests and the man page --- namedev.h | 10 ++ namedev_parse.c | 285 ++++++++++++++++++++++-------------------------------- test/label_test | 2 +- test/udev-test.pl | 22 ++--- udev.8 | 11 +-- udev.rules.demo | 4 +- 6 files changed, 143 insertions(+), 191 deletions(-) diff --git a/namedev.h b/namedev.h index 39cf3ae641..69c488936d 100644 --- a/namedev.h +++ b/namedev.h @@ -49,6 +49,16 @@ enum config_type { #define TYPE_TOPOLOGY "TOPOLOGY" #define TYPE_REPLACE "REPLACE" #define TYPE_CALLOUT "CALLOUT" + +#define FIELD_BUS "BUS" +#define FIELD_ID "ID" +#define FIELD_SYSFS "SYSFS_" +#define FIELD_PLACE "PLACE" +#define FIELD_PROGRAM "PROGRAM" +#define FIELD_KERNEL "KERNEL" +#define FIELD_NAME "NAME" +#define FIELD_SYMLINK "SYMLINK" + #define CALLOUT_MAXARG 8 struct config_device { diff --git a/namedev_parse.c b/namedev_parse.c index b5d0d64b9d..3578058a76 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -45,7 +45,7 @@ int get_pair(char **orig_string, char **left, char **right) return -ENODEV; /* eat any whitespace */ - while (isspace(*string)) + while (isspace(*string) || *string == ',') ++string; /* split based on '=' */ @@ -71,19 +71,6 @@ int get_pair(char **orig_string, char **left, char **right) return 0; } -static int get_value(const char *left, char **orig_string, char **ret_string) -{ - int retval; - char *left_string; - - retval = get_pair(orig_string, &left_string, ret_string); - if (retval) - return retval; - if (strcasecmp(left_string, left) != 0) - return -ENODEV; - return 0; -} - void dump_config_dev(struct config_device *dev) { switch (dev->type) { @@ -169,13 +156,8 @@ int namedev_init_rules(void) if (temp == NULL) goto exit; lineno++; - dbg_parse("read '%s'", temp); - /* eat the whitespace at the beginning of the line */ - while (isspace(*temp)) - ++temp; - /* empty line? */ if (*temp == 0x00) continue; @@ -184,199 +166,160 @@ int namedev_init_rules(void) if (*temp == COMMENT_CHARACTER) continue; + /* eat the whitespace */ + while (isspace(*temp)) + ++temp; + memset(&dev, 0x00, sizeof(struct config_device)); - /* parse the line */ + /* get the method */ temp2 = strsep(&temp, ","); + if (strcasecmp(temp2, TYPE_LABEL) == 0) { - /* label type */ dev.type = LABEL; - - /* BUS="bus" */ - retval = get_value("BUS", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.bus, temp3); - - /* file="value" */ - temp2 = strsep(&temp, ","); - retval = get_pair(&temp, &temp2, &temp3); - if (retval) - break; - strfieldcpy(dev.sysfs_file, temp2); - strfieldcpy(dev.sysfs_value, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.name, temp3); - - /* SYMLINK="name" */ - temp2 = strsep(&temp, ","); - retval = get_value("SYMLINK", &temp, &temp3); - if (retval == 0) - strfieldcpy(dev.symlink, temp3); - - dbg_parse("LABEL name='%s', bus='%s', " - "sysfs_file='%s', sysfs_value='%s', symlink='%s'", - dev.name, dev.bus, dev.sysfs_file, - dev.sysfs_value, dev.symlink); + goto keys; } if (strcasecmp(temp2, TYPE_NUMBER) == 0) { - /* number type */ dev.type = NUMBER; - - /* BUS="bus" */ - retval = get_value("BUS", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.bus, temp3); - - /* ID="id" */ - temp2 = strsep(&temp, ","); - retval = get_value("ID", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.id, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.name, temp3); - - /* SYMLINK="name" */ - temp2 = strsep(&temp, ","); - retval = get_value("SYMLINK", &temp, &temp3); - if (retval == 0) - strfieldcpy(dev.symlink, temp3); - - dbg_parse("NUMBER name='%s', bus='%s', id='%s', symlink='%s'", - dev.name, dev.bus, dev.id, dev.symlink); + goto keys; } if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { - /* number type */ dev.type = TOPOLOGY; - - /* BUS="bus" */ - retval = get_value("BUS", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.bus, temp3); - - /* PLACE="place" */ - temp2 = strsep(&temp, ","); - retval = get_value("PLACE", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.place, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.name, temp3); - - /* SYMLINK="name" */ - temp2 = strsep(&temp, ","); - retval = get_value("SYMLINK", &temp, &temp3); - if (retval == 0) - strfieldcpy(dev.symlink, temp3); - - dbg_parse("TOPOLOGY name='%s', bus='%s', " - "place='%s', symlink='%s'", - dev.name, dev.bus, dev.place, dev.symlink); + goto keys; } if (strcasecmp(temp2, TYPE_REPLACE) == 0) { - /* number type */ dev.type = REPLACE; - - /* KERNEL="kernel_name" */ - retval = get_value("KERNEL", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.kernel_name, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.name, temp3); - - /* SYMLINK="name" */ - temp2 = strsep(&temp, ","); - retval = get_value("SYMLINK", &temp, &temp3); - if (retval == 0) - strfieldcpy(dev.symlink, temp3); - - dbg_parse("REPLACE name='%s', kernel_name='%s', symlink='%s'", - dev.name, dev.kernel_name, dev.symlink); + goto keys; } if (strcasecmp(temp2, TYPE_CALLOUT) == 0) { - /* number type */ dev.type = CALLOUT; + goto keys; + } - /* BUS="bus" */ - retval = get_value("BUS", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.bus, temp3); - - /* PROGRAM="executable" */ - temp2 = strsep(&temp, ","); - retval = get_value("PROGRAM", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.exec_program, temp3); - - /* ID="id" */ - temp2 = strsep(&temp, ","); - retval = get_value("ID", &temp, &temp3); - if (retval) - break; - strfieldcpy(dev.id, temp3); - - /* NAME="new_name" */ - temp2 = strsep(&temp, ","); - retval = get_value("NAME", &temp, &temp3); + dbg_parse("unknown type of method '%s'", temp2); + goto error; +keys: + /* get all known keys */ + while (1) { + retval = get_pair(&temp, &temp2, &temp3); if (retval) break; - strfieldcpy(dev.name, temp3); - /* SYMLINK="name" */ - temp2 = strsep(&temp, ","); - retval = get_value("SYMLINK", &temp, &temp3); - if (retval == 0) + if (strcasecmp(temp2, FIELD_BUS) == 0) { + strfieldcpy(dev.bus, temp3); + continue; + } + + if (strcasecmp(temp2, FIELD_ID) == 0) { + strfieldcpy(dev.id, temp3); + continue; + } + + if (strcasecmp(temp2, FIELD_PLACE) == 0) { + strfieldcpy(dev.place, temp3); + continue; + } + + if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) { + /* remove prepended 'SYSFS_' */ + strfieldcpy(dev.sysfs_file, temp2 + sizeof(FIELD_SYSFS)-1); + strfieldcpy(dev.sysfs_value, temp3); + continue; + } + + if (strcasecmp(temp2, FIELD_KERNEL) == 0) { + strfieldcpy(dev.kernel_name, temp3); + continue; + } + + if (strcasecmp(temp2, FIELD_PROGRAM) == 0) { + strfieldcpy(dev.exec_program, temp3); + continue; + } + + if (strcasecmp(temp2, FIELD_NAME) == 0) { + strfieldcpy(dev.name, temp3); + continue; + } + + if (strcasecmp(temp2, FIELD_SYMLINK) == 0) { strfieldcpy(dev.symlink, temp3); + continue; + } + dbg_parse("unknown type of field '%s'", temp2); + } + + /* check presence of keys according to method type */ + switch (dev.type) { + case LABEL: + dbg_parse("LABEL name='%s', bus='%s', " + "sysfs_file='%s', sysfs_value='%s', symlink='%s'", + dev.name, dev.bus, dev.sysfs_file, + dev.sysfs_value, dev.symlink); + if ((*dev.name == '\0') || + (*dev.bus == '\0') || + (*dev.sysfs_file == '\0') || + (*dev.sysfs_value == '\0')) + goto error; + break; + case NUMBER: + dbg_parse("NUMBER name='%s', bus='%s', id='%s', symlink='%s'", + dev.name, dev.bus, dev.id, dev.symlink); + if ((*dev.name == '\0') || + (*dev.bus == '\0') || + (*dev.id == '\0')) + goto error; + break; + case TOPOLOGY: + dbg_parse("TOPOLOGY name='%s', bus='%s', " + "place='%s', symlink='%s'", + dev.name, dev.bus, dev.place, dev.symlink); + if ((*dev.name == '\0') || + (*dev.bus == '\0') || + (*dev.place == '\0')) + goto error; + break; + case REPLACE: + dbg_parse("REPLACE name='%s', kernel_name='%s', symlink='%s'", + dev.name, dev.kernel_name, dev.symlink); + if ((*dev.name == '\0') || + (*dev.kernel_name == '\0')) + goto error; + break; + case CALLOUT: dbg_parse("CALLOUT name='%s', bus='%s', program='%s', " "id='%s', symlink='%s'", dev.name, dev.bus, dev.exec_program, dev.id, dev.symlink); + if ((*dev.name == '\0') || + (*dev.bus == '\0') || + (*dev.id == '\0') || + (*dev.exec_program == '\0')) + goto error; + break; + default: + dbg_parse("xxx default method"); + goto error; } retval = add_config_dev(&dev); if (retval) { dbg("add_config_dev returned with error %d", retval); - goto exit; + continue; } } - dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_rules_filename, - lineno, temp - line, temp); +error: + dbg_parse("%s:%d:%Zd: field missing or parse error", udev_rules_filename, + lineno, temp - line); exit: fclose(fd); return retval; -} - +} int namedev_init_permissions(void) { diff --git a/test/label_test b/test/label_test index fb3fa2359f..09ccab366e 100644 --- a/test/label_test +++ b/test/label_test @@ -8,7 +8,7 @@ export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG cat > $RULES << EOF -LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="boot_disk%n" +LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="boot_disk%n" EOF cat > $CONFIG << EOF diff --git a/test/udev-test.pl b/test/udev-test.pl index 1a35e3da82..08b99f041f 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -38,7 +38,7 @@ my @tests = ( devpath => "block/sda", expected => "boot_disk" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "block/sda", expected => "lun0/disc" , conf => < "block/sda/sda2", expected => "lun0/part2" , conf => < "block/sda/sda2", expected => "1/2/a/b/symlink" , conf => < "block/sda/sda2", expected => "1/2/symlink" , conf => < "block/sda/sda2", expected => "1/2/c/d/symlink" , conf => < Date: Tue, 16 Dec 2003 23:39:44 -0800 Subject: [PATCH] some cleanups due to the need for LABEL rules to use "SYSFS_" now. --- udev.8 | 2 +- udev.rules | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/udev.8 b/udev.8 index 08f12908b5..f26beb4b9d 100644 --- a/udev.8 +++ b/udev.8 @@ -178,7 +178,7 @@ TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" REPLACE, KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" # multiple USB webcams with symlinks to be called webcam0, webcam1, ... -LABEL, BUS="usb", model="WebCam V3", NAME="video%n", SYMLINK="webcam%n" +LABEL, BUS="usb", SYSFS_model="WebCam V3", NAME="video%n", SYMLINK="webcam%n" .fi .P Permissions and ownership for the created device files may specified at diff --git a/udev.rules b/udev.rules index e497aed05b..618737ffd8 100644 --- a/udev.rules +++ b/udev.rules @@ -16,26 +16,26 @@ CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" # A usb camera. -LABEL, BUS="usb", vendor="FUJIFILM", NAME="camera%n" +LABEL, BUS="usb", SYSFS_vendor="FUJIFILM", NAME="camera%n" # USB Epson printer to be called lp_epson -LABEL, BUS="usb", serial="HXOLL0012202323480", NAME="lp_epson" +LABEL, BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" # USB HP printer to be called lp_hp -LABEL, BUS="usb", serial="W09090207101241330", NAME="lp_hp" +LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" # sound card with PCI bus id 00:0b.0 to be the first sound card -NUMBER, BUS="pci", id="00:0b.0", NAME="dsp" +NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" # sound card with PCI bus id 00:07.1 to be the second sound card -NUMBER, BUS="pci", id="00:07.1", NAME="dsp1" +NUMBER, BUS="pci", ID="00:07.1", NAME="dsp1" # USB mouse plugged into the third port of the first hub to be called mouse0 -TOPOLOGY, BUS="usb", place="1.3", NAME="mouse0" +TOPOLOGY, BUS="usb", PLACE="1.3", NAME="mouse0" # USB tablet plugged into the third port of the second hub to be called mouse1 -TOPOLOGY, BUS="usb", place="2.3", NAME="mouse1" -TOPOLOGY, BUS="usb", place="2.4", NAME="mouse2" +TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" +TOPOLOGY, BUS="usb", PLACE="2.4", NAME="mouse2" # ttyUSB1 should always be called visor REPLACE, KERNEL="ttyUSB1", NAME="visor" -- cgit v1.2.3-54-g00ecf From 666269480900dd8d099b9e188c16acc9f7f31ee5 Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Tue, 16 Dec 2003 23:41:59 -0800 Subject: [PATCH] dump latest klibc into the udev build tree KLIBC is used as an internal makefile variable, it expands to either true or false right now. udev should use something else than KLIBC to allow build against the latest and greatest klibc version. --- Makefile | 12 ++++++------ README | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 4a545db9c4..3653595b06 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ DEBUG = false # Set the following to `true' to make udev emit a D-BUS signal when a # new node is created. -DBUS = false +USE_DBUS = false ROOT = udev @@ -57,7 +57,7 @@ udevdir = ${prefix}/udev # Comment out this line to build with something other # than the local version of klibc -#KLIBC = true +#USE_KLIBC = true # If you are running a cross compiler, you may want to set this # to something more interesting, like "arm-linux-". I you want @@ -116,7 +116,7 @@ endif # If we are using our version of klibc, then we need to build and link it. # Otherwise, use glibc and link statically. -ifeq ($(strip $(KLIBC)),true) +ifeq ($(strip $(USE_KLIBC)),true) KLIBC_BASE = $(PWD)/klibc KLIBC_DIR = $(KLIBC_BASE)/klibc INCLUDE_DIR := $(KLIBC_DIR)/include @@ -180,11 +180,11 @@ OBJS = udev.o \ $(SYSFS) \ $(TDB) -ifeq ($(strip $(KLIBC)),true) +ifeq ($(strip $(USE_KLIBC)),true) OBJS += klibc_fixups.o endif -ifeq ($(DBUS), true) +ifeq ($(USE_DBUS), true) CFLAGS += -DUSE_DBUS CFLAGS += $(shell pkg-config --cflags dbus-1) LDFLAGS += $(shell pkg-config --libs dbus-1) @@ -261,7 +261,7 @@ small_release: $(DISTFILES) clean @echo "Built $(RELEASE_NAME).tar.gz" -ifeq ($(DBUS), true) +ifeq ($(USE_DBUS), true) install-dbus-policy: $(INSTALL) -d $(DESTDIR)$(dbusdir) $(INSTALL_DATA) udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) diff --git a/README b/README index 94a397936e..dab0ab4197 100644 --- a/README +++ b/README @@ -32,18 +32,18 @@ To use: installed into. This works just like the 'configure --prefix' script does. Default value is ''. Only override this if you really know what you are doing. - KLIBC - if set to 'true', udev is built and linked against the included + USE_KLIBC - if set to 'true', udev is built and linked against the included version of klibc. Default value is 'false'. DEBUG - if set to 'true', debugging messages will be sent to the syslog as udev is run. Default value is 'false'. - DBUS - if set to 'true', DBUS messages will be sent everytime udev + USE_DBUS - if set to 'true', DBUS messages will be sent everytime udev creates or removes a device node. This requires that DBUS development headers and libraries be present on your system to build properly. Default value is 'false'. So, if you want to build udev using klibc with debugging messages, you would do: - make KLIBC=true DEBUG=true + make USE_KLIBC=true DEBUG=true - Install the project: -- cgit v1.2.3-54-g00ecf From 470e365d5338fbdcc8019d790c97ed1229de0196 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 17 Dec 2003 00:04:23 -0800 Subject: [PATCH] update the FAQ with info about bad modprobe events from the devfs scheme... --- FAQ | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/FAQ b/FAQ index d9aebde0da..1f7ceb0dd3 100644 --- a/FAQ +++ b/FAQ @@ -44,6 +44,12 @@ A: Such a functionality isn't needed on a properly configured system. All hardware in memory, then use something else to manage your modules (scripts, modules.conf, etc.) This is not a task for udev. +Q: But I love that feature of devfs, please? +A: The devfs approach caused a lot of spurious modprobe attempts as + programs probed to see if devices were present or not. Every probe + attempt created a process to run modprobe, almost all of which were + spurious. + Q: I really like the devfs naming scheme, will udev do that? A: Yes, udev can create /dev nodes using the devfs naming policy. A configuration file needs to be created to map the kernel default names -- cgit v1.2.3-54-g00ecf From c63a27273bffd268dfedc492399f3be71bad5dd4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 17 Dec 2003 00:04:50 -0800 Subject: [PATCH] add mol permissions to the debian permissions file. Info from Mathieu Segaud --- udev.permissions.debian | 1 + 1 file changed, 1 insertion(+) diff --git a/udev.permissions.debian b/udev.permissions.debian index a5e40f89e2..b4ddacfcdd 100644 --- a/udev.permissions.debian +++ b/udev.permissions.debian @@ -61,6 +61,7 @@ video*:root:video:0660 radio*:root:video:0660 vbi*:root:video:0660 vtx*:root:video:0660 +mol:root:root:0600 # block devices -- cgit v1.2.3-54-g00ecf From 3555a14bae9f372385e4bc01368027cdbc29384c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 17 Dec 2003 00:22:55 -0800 Subject: [PATCH] sync klibc with release 0.95 --- klibc/Makefile | 17 +++ klibc/klibc/Makefile | 9 ++ klibc/klibc/SYSCALLS | 7 +- klibc/klibc/arch/i386/include/klibc/archsignal.h | 2 +- klibc/klibc/arch/ia64/Makefile.inc | 11 +- klibc/klibc/arch/ia64/include/klibc/archsignal.h | 2 - klibc/klibc/arch/ia64/pipe.c | 42 ++++++ klibc/klibc/arch/ppc/Makefile.inc | 8 +- klibc/klibc/arch/ppc/crt0.S | 27 ++-- klibc/klibc/arch/ppc64/Makefile.inc | 5 + klibc/klibc/arch/ppc64/crt0.S | 14 +- klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h | 36 +++++ klibc/klibc/arch/ppc64/setjmp.S | 46 +++++++ klibc/klibc/arch/s390/Makefile.inc | 7 +- klibc/klibc/include/klibc/compiler.h | 7 + klibc/klibc/include/signal.h | 6 + klibc/klibc/include/stdio.h | 5 +- klibc/klibc/include/sys/module.h | 158 ---------------------- klibc/klibc/inet/bindresvport.c | 2 +- klibc/klibc/mmap.c | 2 +- klibc/klibc/strcasecmp.c | 24 ++-- klibc/klibc/strerror.c | 1 - klibc/klibc/strncasecmp.c | 23 ++-- klibc/klibc/strncmp.c | 2 +- klibc/klibc/syscommon.h | 1 - klibc/klibc/tests/memstrtest.c | 4 +- klibc/klibc/tests/minips.c | 1 + klibc/version | 2 +- 28 files changed, 240 insertions(+), 231 deletions(-) create mode 100644 klibc/klibc/arch/ia64/pipe.c create mode 100644 klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h create mode 100644 klibc/klibc/arch/ppc64/setjmp.S delete mode 100644 klibc/klibc/include/sys/module.h diff --git a/klibc/Makefile b/klibc/Makefile index 5f9a7d6a6e..ef5fbabff8 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -1,6 +1,23 @@ +VERSION := $(shell cat version) SUBDIRS = klibc all: +rpmbuild = $(shell which rpmbuild 2>/dev/null || which rpm) + +klibc.spec: klibc.spec.in version + sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@ + +.PHONY: rpm +rpm: klibc.spec + +$(rpmbuild) -bb klibc.spec + %: @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done + +clean: + @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done + +spotless: + @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done + rm -f klibc.spec *~ tags diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index e1d63381c1..5fc481aa8a 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -57,6 +57,12 @@ tests: $(TESTS) tests/%.o : tests/%.c $(CC) $(CFLAGS) -c -o $@ $< +# This particular file uses a bunch of formats gcc don't know of, in order +# to test the full range of our vsnprintf() function. This outputs a bunch +# of useless warnings unless we tell it not to. +tests/testvsnp.o : tests/testvsnp.c + $(CC) $(CFLAGS) -Wno-format -c -o $@ $< + tests/% : tests/%.o $(LIB) $(CRT0) $(LD) $(LDFLAGS) -o $@ $(CRT0) $< $(LIB) $(LIBGCC) cp $@ $@.stripped @@ -131,6 +137,9 @@ spotless: clean find . \( -name \*~ -o -name '.*.d' \) -not -type d -print0 | \ xargs -0rt rm -f +bitsize: + @echo $(BITSIZE) + ifneq ($(wildcard $(DIR)/.*.d),) include $(wildcard $(DIR)/.*.d) endif diff --git a/klibc/klibc/SYSCALLS b/klibc/klibc/SYSCALLS index 92dff963b3..0be1b4425a 100644 --- a/klibc/klibc/SYSCALLS +++ b/klibc/klibc/SYSCALLS @@ -73,7 +73,7 @@ int mknod(const char *, mode_t, dev_t) int chmod(const char *, mode_t) int mkdir(const char *, mode_t) int rmdir(const char *) - int pipe(int *) + int pipe(int *) mode_t umask(mode_t) int chroot(const char *) int symlink(const char *, const char *) @@ -139,9 +139,8 @@ int mprotect(const void *, size_t, int) int uname(struct utsname *) int setdomainname(const char *, size_t) int sethostname(const char *, size_t) -int init_module(const char *, struct module *) - void * create_module(const char *, size_t) -int delete_module(const char *) +long init_module(void *, unsigned long, const char *) +long delete_module(const char *, unsigned int) int query_module(const char *, int, void *, size_t, size_t) int reboot::__reboot(int, int, int, void *) int syslog::klogctl(int, char *, int) diff --git a/klibc/klibc/arch/i386/include/klibc/archsignal.h b/klibc/klibc/arch/i386/include/klibc/archsignal.h index caea8d8b3d..b092ba6d3a 100644 --- a/klibc/klibc/arch/i386/include/klibc/archsignal.h +++ b/klibc/klibc/arch/i386/include/klibc/archsignal.h @@ -8,6 +8,6 @@ #ifndef _KLIBC_ARCHSIGNAL_H #define _KLIBC_ARCHSIGNAL_H -typedef int sig_atomic_t; +/* No special stuff for this architecture */ #endif diff --git a/klibc/klibc/arch/ia64/Makefile.inc b/klibc/klibc/arch/ia64/Makefile.inc index edf43459f8..781448770e 100644 --- a/klibc/klibc/arch/ia64/Makefile.inc +++ b/klibc/klibc/arch/ia64/Makefile.inc @@ -9,7 +9,16 @@ ARCHOBJS = \ arch/$(ARCH)/vfork.o \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/pipe.o \ + libgcc/__divdi3.o \ + libgcc/__divsi3.o \ + libgcc/__udivdi3.o \ + libgcc/__udivsi3.o \ + libgcc/__umodsi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmodsi4.o \ + libgcc/__udivmoddi4.o ARCHSOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS)) diff --git a/klibc/klibc/arch/ia64/include/klibc/archsignal.h b/klibc/klibc/arch/ia64/include/klibc/archsignal.h index 9ab0ed744c..5b01f19bc2 100644 --- a/klibc/klibc/arch/ia64/include/klibc/archsignal.h +++ b/klibc/klibc/arch/ia64/include/klibc/archsignal.h @@ -28,6 +28,4 @@ struct sigaction { #define sa_handler _u._sa_handler #define sa_sigaction _u._sa_sigaction -typedef int sig_atomic_t; - #endif diff --git a/klibc/klibc/arch/ia64/pipe.c b/klibc/klibc/arch/ia64/pipe.c new file mode 100644 index 0000000000..5f5dd05727 --- /dev/null +++ b/klibc/klibc/arch/ia64/pipe.c @@ -0,0 +1,42 @@ +/* + * pipe.c + */ + +#include "syscommon.h" +#include + +#define ASM_CLOBBERS ,"out2", "out3", "out4", "out5", "out6", "out7", \ + /* Non-stacked integer registers, minus r8, r9, r10, r15. */ \ + "r2", "r3", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \ + "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \ + "r28", "r29", "r30", "r31", \ + /* Predicate registers. */ \ + "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \ + /* Non-rotating fp registers. */ \ + "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ + /* Branch registers. */ \ + "b6", "b7" + +int pipe(int *filedes) +{ + register long _r8 asm("r8"); + register long _r9 asm("r9"); + register long _r10 asm("r10"); + register long _r15 asm("r15") = __NR_pipe; + register long _out0 asm ("out0") = (long)filedes; + long _retval; + __asm __volatile (__IA64_BREAK + : "=r" (_r8), "=r" (_r10), "=r" (_r15), + "=r" (_out0) + : "2" (_r15), "3" (_out0) + : "memory" ASM_CLOBBERS); + if (_r10 == -1) { + errno = _r8; + _retval = -1; + } else { + filedes[0] = _r8; + filedes[1] = _r9; + _retval = 0; + } + return _retval; +} diff --git a/klibc/klibc/arch/ppc/Makefile.inc b/klibc/klibc/arch/ppc/Makefile.inc index 6e87a48d6b..3bd2c0643c 100644 --- a/klibc/klibc/arch/ppc/Makefile.inc +++ b/klibc/klibc/arch/ppc/Makefile.inc @@ -8,7 +8,13 @@ # ARCHOBJS = \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + libgcc/__divdi3.o \ + libgcc/__moddi3.o \ + libgcc/__udivdi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmoddi4.o + ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) diff --git a/klibc/klibc/arch/ppc/crt0.S b/klibc/klibc/arch/ppc/crt0.S index f7274b07dd..282f8411e4 100644 --- a/klibc/klibc/arch/ppc/crt0.S +++ b/klibc/klibc/arch/ppc/crt0.S @@ -1,12 +1,5 @@ # # arch/ppc/crt0.S -# -# void _start(void) -# { -# /* Divine up argc, argv, and envp */ -# environ = envp; -# exit(main(argc, argv, envp)); -# } # .text @@ -14,16 +7,14 @@ .type _start,@function .globl _start _start: - lwz 3,0(1) - addi 4,1,4 - addi 5,1,8 - slwi 0,3,2 - add 5,5,0 - li 0,0 - stwu 0,-16(1) - lis 9,environ@ha - stw 5,environ@l(9) - bl main - bl exit + stwu 1,-16(1) + addi 3,1,16 + /* + * the SVR4abippc.pdf specifies r7 as a pointer to + * a termination function pointer. + * It is unused on Linux. + */ + mr 4,7 + bl __libc_init .size _start,.-_start diff --git a/klibc/klibc/arch/ppc64/Makefile.inc b/klibc/klibc/arch/ppc64/Makefile.inc index 434d0aad96..3ab3a8c8e6 100644 --- a/klibc/klibc/arch/ppc64/Makefile.inc +++ b/klibc/klibc/arch/ppc64/Makefile.inc @@ -7,4 +7,9 @@ # accordingly. # +ARCHOBJS = \ + arch/$(ARCH)/setjmp.o + +ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) + archclean: diff --git a/klibc/klibc/arch/ppc64/crt0.S b/klibc/klibc/arch/ppc64/crt0.S index 2f352e8045..872d2a0791 100644 --- a/klibc/klibc/arch/ppc64/crt0.S +++ b/klibc/klibc/arch/ppc64/crt0.S @@ -23,16 +23,10 @@ _start: .globl ._start .type ._start,@function ._start: - ld 3,0(1) - ld 4,8(1) - ld 5,16(1) - li 0,0 - stdu 0,-64(1) - ld 9,.LC0@toc(2) - std 5,0(9) - bl .main - nop - bl .exit + stdu %r1,-32(%r1) + addi %r3,%r1,32 + mr %r4,%r7 /* fini */ + b .__libc_init nop .size _start,.-_start diff --git a/klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h b/klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h new file mode 100644 index 0000000000..006a2e27be --- /dev/null +++ b/klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h @@ -0,0 +1,36 @@ +/* + * arch/ppc64/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __r2; + unsigned long __sp; + unsigned long __lr; + unsigned long __cr; + unsigned long __r13; + unsigned long __r14; + unsigned long __r15; + unsigned long __r16; + unsigned long __r17; + unsigned long __r18; + unsigned long __r19; + unsigned long __r20; + unsigned long __r21; + unsigned long __r22; + unsigned long __r23; + unsigned long __r24; + unsigned long __r25; + unsigned long __r26; + unsigned long __r27; + unsigned long __r28; + unsigned long __r29; + unsigned long __r30; + unsigned long __r31; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/ppc64/setjmp.S b/klibc/klibc/arch/ppc64/setjmp.S new file mode 100644 index 0000000000..1dcc67035e --- /dev/null +++ b/klibc/klibc/arch/ppc64/setjmp.S @@ -0,0 +1,46 @@ +# +# arch/ppc64/setjmp.S +# +# Basic setjmp/longjmp implementation +# This file was derived from the equivalent file in NetBSD +# + + .text + .align 4 + + .section ".opd","aw" +setjmp: + .quad .setjmp,.TOC.@tocbase,0 + .previous + .size setjmp,24 + .type .setjmp,@function + .globl setjmp + .globl .setjmp +.setjmp: + mflr %r11 /* save return address */ + mfcr %r12 /* save condition register */ + mr %r10,%r1 /* save stack pointer */ + mr %r9,%r2 /* save GPR2 (not needed) */ + stmw %r9,0(%r3) /* save r9..r31 */ + li %r3,0 /* indicate success */ + blr /* return */ + + .size .setjmp,.-.setjmp + .section ".opd","aw" +longjmp: + .quad .longjmp,.TOC.@tocbase,0 + .previous + .size longjmp,24 + .type .longjmp,@function + .globl longjmp + .globl .longjmp +.longjmp: + lmw %r9,0(%r3) /* save r9..r31 */ + mtlr %r11 /* restore LR */ + mtcr %r12 /* restore CR */ + mr %r2,%r9 /* restore GPR2 (not needed) */ + mr %r1,%r10 /* restore stack */ + mr %r3,%r4 /* get return value */ + blr /* return */ + + .size .longjmp,.-.longjmp diff --git a/klibc/klibc/arch/s390/Makefile.inc b/klibc/klibc/arch/s390/Makefile.inc index 45aa551695..c50f4f2886 100644 --- a/klibc/klibc/arch/s390/Makefile.inc +++ b/klibc/klibc/arch/s390/Makefile.inc @@ -8,7 +8,12 @@ # ARCHOBJS = \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + libgcc/__divdi3.o \ + libgcc/__moddi3.o \ + libgcc/__udivdi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmoddi4.o ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) diff --git a/klibc/klibc/include/klibc/compiler.h b/klibc/klibc/include/klibc/compiler.h index 5c284b206c..64b8c54158 100644 --- a/klibc/klibc/include/klibc/compiler.h +++ b/klibc/klibc/include/klibc/compiler.h @@ -58,4 +58,11 @@ # define __unlikely(x) (x) #endif +/* Possibly unused function */ +#ifdef __GNUC__ +# define __unusedfunc __attribute__((unused)) +#else +# define __unusedfunc +#endif + #endif diff --git a/klibc/klibc/include/signal.h b/klibc/klibc/include/signal.h index 62c5083dc0..f9eebb2a29 100644 --- a/klibc/klibc/include/signal.h +++ b/klibc/klibc/include/signal.h @@ -13,6 +13,12 @@ #include +/* glibc seems to use sig_atomic_t as "int" pretty much on all architectures. + Do the same, but allow the architecture to override. */ +#ifdef _KLIBC_HAS_ARCH_SIG_ATOMIC_T +typedef int sig_atomic_t; +#endif + /* Some architectures don't define these */ #ifndef SA_RESETHAND # define SA_RESETHAND SA_ONESHOT diff --git a/klibc/klibc/include/stdio.h b/klibc/klibc/include/stdio.h index 5e621af5f1..f57439f018 100644 --- a/klibc/klibc/include/stdio.h +++ b/klibc/klibc/include/stdio.h @@ -78,12 +78,13 @@ __extern size_t _fread(void *, size_t, FILE *); __extern size_t _fwrite(const void *, size_t, FILE *); #ifndef __NO_FREAD_FWRITE_INLINES -static __inline__ size_t +extern __inline__ size_t fread(void *__p, size_t __s, size_t __n, FILE *__f) { return _fread(__p, __s*__n, __f)/__s; } -static __inline__ size_t + +extern __inline__ size_t fwrite(void *__p, size_t __s, size_t __n, FILE *__f) { return _fwrite(__p, __s*__n, __f)/__s; diff --git a/klibc/klibc/include/sys/module.h b/klibc/klibc/include/sys/module.h deleted file mode 100644 index 96b3b59945..0000000000 --- a/klibc/klibc/include/sys/module.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * sys/module.h - * - * This is a bastardized version of linux/module.h, since the latter - * doesn't have __KERNEL__ guards where it needs them... - */ - -#ifndef _SYS_MODULE_H -#define _SYS_MODULE_H - -/* - * Dynamic loading of modules into the kernel. - * - * Rewritten by Richard Henderson Dec 1996 - */ - -#include - -/* Don't need to bring in all of uaccess.h just for this decl. */ -struct exception_table_entry; - -/* Used by get_kernel_syms, which is obsolete. */ -struct kernel_sym -{ - unsigned long value; - char name[60]; /* should have been 64-sizeof(long); oh well */ -}; - -struct module_symbol -{ - unsigned long value; - const char *name; -}; - -struct module_ref -{ - struct module *dep; /* "parent" pointer */ - struct module *ref; /* "child" pointer */ - struct module_ref *next_ref; -}; - -/* TBD */ -struct module_persist; - -struct module -{ - unsigned long size_of_struct; /* == sizeof(module) */ - struct module *next; - const char *name; - unsigned long size; - - union - { - atomic_t usecount; - long pad; - } uc; /* Needs to keep its size - so says rth */ - - unsigned long flags; /* AUTOCLEAN et al */ - - unsigned nsyms; - unsigned ndeps; - - struct module_symbol *syms; - struct module_ref *deps; - struct module_ref *refs; - int (*init)(void); - void (*cleanup)(void); - const struct exception_table_entry *ex_table_start; - const struct exception_table_entry *ex_table_end; -#ifdef __alpha__ - unsigned long gp; -#endif - /* Members past this point are extensions to the basic - module support and are optional. Use mod_member_present() - to examine them. */ - const struct module_persist *persist_start; - const struct module_persist *persist_end; - int (*can_unload)(void); - int runsize; /* In modutils, not currently used */ - const char *kallsyms_start; /* All symbols for kernel debugging */ - const char *kallsyms_end; - const char *archdata_start; /* arch specific data for module */ - const char *archdata_end; - const char *kernel_data; /* Reserved for kernel internal use */ -}; - -struct module_info -{ - unsigned long addr; - unsigned long size; - unsigned long flags; - long usecount; -}; - -/* Bits of module.flags. */ - -#define MOD_UNINITIALIZED 0 -#define MOD_RUNNING 1 -#define MOD_DELETED 2 -#define MOD_AUTOCLEAN 4 -#define MOD_VISITED 8 -#define MOD_USED_ONCE 16 -#define MOD_JUST_FREED 32 -#define MOD_INITIALIZING 64 - -/* Values for query_module's which. */ - -#define QM_MODULES 1 -#define QM_DEPS 2 -#define QM_REFS 3 -#define QM_SYMBOLS 4 -#define QM_INFO 5 - -/* Can the module be queried? */ -#define MOD_CAN_QUERY(mod) (((mod)->flags & (MOD_RUNNING | MOD_INITIALIZING)) && !((mod)->flags & MOD_DELETED)) - -/* When struct module is extended, we must test whether the new member - is present in the header received from insmod before we can use it. - This function returns true if the member is present. */ - -#define mod_member_present(mod,member) \ - ((unsigned long)(&((struct module *)0L)->member + 1) \ - <= (mod)->size_of_struct) - -/* - * Ditto for archdata. Assumes mod->archdata_start and mod->archdata_end - * are validated elsewhere. - */ -#define mod_archdata_member_present(mod, type, member) \ - (((unsigned long)(&((type *)0L)->member) + \ - sizeof(((type *)0L)->member)) <= \ - ((mod)->archdata_end - (mod)->archdata_start)) - - -/* Check if an address p with number of entries n is within the body of module m */ -#define mod_bound(p, n, m) ((unsigned long)(p) >= ((unsigned long)(m) + ((m)->size_of_struct)) && \ - (unsigned long)((p)+(n)) <= (unsigned long)(m) + (m)->size) - -/* Backwards compatibility definition. */ - -#define GET_USE_COUNT(module) (atomic_read(&(module)->uc.usecount)) - -/* Poke the use count of a module. */ - -#define __MOD_INC_USE_COUNT(mod) \ - (atomic_inc(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED|MOD_USED_ONCE) -#define __MOD_DEC_USE_COUNT(mod) \ - (atomic_dec(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED) -#define __MOD_IN_USE(mod) \ - (mod_member_present((mod), can_unload) && (mod)->can_unload \ - ? (mod)->can_unload() : atomic_read(&(mod)->uc.usecount)) - -/* Indirect stringification. */ - -#define __MODULE_STRING_1(x) #x -#define __MODULE_STRING(x) __MODULE_STRING_1(x) - -#endif /* _SYS_MODULE_H */ diff --git a/klibc/klibc/inet/bindresvport.c b/klibc/klibc/inet/bindresvport.c index b5f327bb33..c30054edfd 100644 --- a/klibc/klibc/inet/bindresvport.c +++ b/klibc/klibc/inet/bindresvport.c @@ -37,7 +37,7 @@ int bindresvport(int sd, struct sockaddr_in *sin) for (i = 0; i < NUM_PORTS; i++, port++) { sin->sin_port = htons(port); - if ((ret = bind(sd, sin, sizeof(*sin))) != -1) + if ((ret = bind(sd, (struct sockaddr *)&sin, sizeof(*sin))) != -1) break; if (port == END_PORT) port = START_PORT; diff --git a/klibc/klibc/mmap.c b/klibc/klibc/mmap.c index 3d28cba601..aedf4dceb5 100644 --- a/klibc/klibc/mmap.c +++ b/klibc/klibc/mmap.c @@ -19,7 +19,7 @@ * Prefer mmap2() over mmap(), except on the architectures listed */ -#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) +#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) && !defined(__powerpc64__) /* This architecture uses mmap2() */ diff --git a/klibc/klibc/strcasecmp.c b/klibc/klibc/strcasecmp.c index e583491b35..12aef40d93 100644 --- a/klibc/klibc/strcasecmp.c +++ b/klibc/klibc/strcasecmp.c @@ -1,6 +1,5 @@ /* * strcasecmp.c - * */ #include @@ -8,18 +7,17 @@ int strcasecmp(const char *s1, const char *s2) { - char *n1, *n2; - int i, retval; + const unsigned char *c1 = s1, *c2 = s2; + unsigned char ch; + int d = 0; - n1 = strdup(s1); - n2 = strdup(s2); + while ( 1 ) { + /* toupper() expects an unsigned char (implicitly cast to int) + as input, and returns an int, which is exactly what we want. */ + d = toupper(ch = *c1++) - toupper(*c2++); + if ( d || !ch ) + break; + } - for (i = 0; i < strlen(n1); i++) - n1[i] = toupper(n1[i]); - for (i = 0; i < strlen(n2); i++) - n2[i] = toupper(n2[i]); - retval = strcmp(n1, n2); - free(n1); - free(n2); - return retval; + return d; } diff --git a/klibc/klibc/strerror.c b/klibc/klibc/strerror.c index 754a30693c..62705553a6 100644 --- a/klibc/klibc/strerror.c +++ b/klibc/klibc/strerror.c @@ -10,7 +10,6 @@ char *strerror(int errnum) char numbuf[32]; char *p; - int len; p = numbuf+sizeof numbuf; *--p = '\0'; diff --git a/klibc/klibc/strncasecmp.c b/klibc/klibc/strncasecmp.c index 542493de0f..3309d1a7fe 100644 --- a/klibc/klibc/strncasecmp.c +++ b/klibc/klibc/strncasecmp.c @@ -7,18 +7,17 @@ int strncasecmp(const char *s1, const char *s2, size_t n) { - char *n1, *n2; - int i, retval; + const unsigned char *c1 = s1, *c2 = s2; + unsigned char ch; + int d = 0; - n1 = strndup(s1, n); - n2 = strndup(s2, n); + while ( n-- ) { + /* toupper() expects an unsigned char (implicitly cast to int) + as input, and returns an int, which is exactly what we want. */ + d = toupper(ch = *c1++) - toupper(*c2++); + if ( d || !ch ) + break; + } - for (i = 0; i < strlen(n1); i++) - n1[i] = toupper(n1[i]); - for (i = 0; i < strlen(n2); i++) - n2[i] = toupper(n2[i]); - retval = strcmp(n1, n2); - free(n1); - free(n2); - return retval; + return d; } diff --git a/klibc/klibc/strncmp.c b/klibc/klibc/strncmp.c index 98a41c3773..4dbde1389f 100644 --- a/klibc/klibc/strncmp.c +++ b/klibc/klibc/strncmp.c @@ -11,7 +11,7 @@ int strncmp(const char *s1, const char *s2, size_t n) int d = 0; while ( n-- ) { - d = (int)*c2++ - (int)(ch = *c1++); + d = (int)(ch = *c1++) - (int)*c2++; if ( d || !ch ) break; } diff --git a/klibc/klibc/syscommon.h b/klibc/klibc/syscommon.h index 224e240e38..916d4eb0c0 100644 --- a/klibc/klibc/syscommon.h +++ b/klibc/klibc/syscommon.h @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include diff --git a/klibc/klibc/tests/memstrtest.c b/klibc/klibc/tests/memstrtest.c index 14d5173cb2..70c642c067 100644 --- a/klibc/klibc/tests/memstrtest.c +++ b/klibc/klibc/tests/memstrtest.c @@ -8,7 +8,7 @@ int main(void) int i; int r; - for(i = 0; i < sizeof(t1); i++) + for(i = 0; i < (int)sizeof(t1); i++) t1[i] = t2[i] = (unsigned char)i; r = memcmp(t1, t2, sizeof(t1)); @@ -19,7 +19,7 @@ int main(void) r = memcmp(t1, t2, sizeof(t1)); printf("memcmp r = %d\n", r); - for (i = 0; i < sizeof(t1); i++) + for (i = 0; i < (int)sizeof(t1); i++) t1[i] = 0xaa; memset(t2, 0xaa, sizeof(t2)); r = memcmp(t1, t2, sizeof(t1)); diff --git a/klibc/klibc/tests/minips.c b/klibc/klibc/tests/minips.c index c599150858..20898270f4 100644 --- a/klibc/klibc/tests/minips.c +++ b/klibc/klibc/tests/minips.c @@ -396,6 +396,7 @@ static void print_proc(void){ ); break; default: + break; } if(show_args) printf(" [%s]\n", P_cmd); else printf(" %s\n", P_cmd); diff --git a/klibc/version b/klibc/version index e6e9cf41cc..fd6d73e4a0 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.82 +0.95 -- cgit v1.2.3-54-g00ecf From d546791d3ab1cbf8cb08b27eab1fc09e1c5d04dc Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 17 Dec 2003 00:23:28 -0800 Subject: [PATCH] signal fixes due to klibc update. --- tdb/spinlock.c | 1 + tdb/tdb.c | 1 + tdb/tdb.h | 1 + udevdb.c | 1 + 4 files changed, 4 insertions(+) diff --git a/tdb/spinlock.c b/tdb/spinlock.c index 9bf42adfcf..50cd952c72 100644 --- a/tdb/spinlock.c +++ b/tdb/spinlock.c @@ -28,6 +28,7 @@ #endif #ifdef STANDALONE +#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #include #include diff --git a/tdb/tdb.c b/tdb/tdb.c index 772602ed5b..9ae57a974e 100644 --- a/tdb/tdb.c +++ b/tdb/tdb.c @@ -52,6 +52,7 @@ #include #endif +#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #include #include diff --git a/tdb/tdb.h b/tdb/tdb.h index 839d5b1516..cac172adce 100644 --- a/tdb/tdb.h +++ b/tdb/tdb.h @@ -25,6 +25,7 @@ extern "C" { #endif +#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include /* flags to tdb_store() */ diff --git a/udevdb.c b/udevdb.c index e0bd39e84b..5be3c25151 100644 --- a/udevdb.c +++ b/udevdb.c @@ -24,6 +24,7 @@ /* * udev database library */ +#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #include #include -- cgit v1.2.3-54-g00ecf From 54b72ce91eec6116f14f5fa5abefb2e6210df795 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 17 Dec 2003 00:30:59 -0800 Subject: [PATCH] v009 release --- ChangeLog | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac06290775..cb8fa7f15c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,68 @@ +Summary of changes from v008 to v009 +============================================ + +: + o more extras/multipath changes + o and more extras/multipath updates + o more extras/multipath updates + o yet more extras/multipath + o more extras/multipath updates + o extras/multipath update + +: + o D-BUS patch for udev-008 + +: + o add init.d/udev to "make install" + o add init.d/udev to the spec file + +Kay Sievers: + o don't rely on field order in namedev_parse + o get part of callout return string + o remove '\n' from end of callout return + o man-page mention multiple symlinks + o allow multiple symlinks + o cleanup man & remove symlink comment + o experimental (very simple) SYMLINK creation + o man page beauty + o pattern match for label method + o a bug in linefeed removal + +: + o remove udev from runlevels on uninstall + o install initscript in udev rpm + +Daniel E. F. Stekloff: + o pre-libsysfs-0.4.0 patch + +Greg Kroah-Hartman: + o signal fixes due to klibc update + o sync klibc with release 0.95 + o add mol permissions to the debian permissions file + o update the FAQ with info about bad modprobe events from the devfs scheme + o some cleanups due to the need for LABEL rules to use "SYSFS_" now + o Add restart target to the etc/init.d/udev script + o tweak the config file generation portion of the Makefile a bit + o change devfs disk name rule from 'disk' to 'disc' + o add vc support to udev.rules.devfs + o added a devfs udev config file from Marco d'Itri + o set default mode to 0600 to be safer + o Makefile tweaks for the DBUS build + o update the FAQ due to the latest devfs mess on lkml and also due to symlinks now working + o document the different Makefile config options that we have + o change USE_DBUS to DBUS in Makefile, and disable it by default as it's still to hard to build on all systems + o fix formatting of udev_dbus.c to use tabs. Also get it to build properly now + o move all of the DBUS logic into one file and remove all of the #ifdef crud from the main code + +Olaf Hering: + o dump latest klibc into the udev build tree + o use udevdir in udev.conf + +Patrick Mansfield: + o better allow builds of extras programs under udev + o update udev extras/scsi_id to version 0.2 + + Summary of changes from v007 to v008 ============================================ diff --git a/Makefile b/Makefile index 3653595b06..e599df34ad 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 008_bk +VERSION = 009 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 3f71e1452c..da7743ef6c 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 008_bk +Version: 009 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 9c23ec09a04529b3875fb496ed34765a84199aee Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 17 Dec 2003 00:57:52 -0800 Subject: [PATCH] 009_bk makefile changes. --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e599df34ad..c5c05d615d 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 009 +VERSION = 009_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index da7743ef6c..f8bde13171 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 009 +Version: 009_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 4868e8fba7fda5074fc7d64f4f22236127afc3c8 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 17 Dec 2003 00:58:01 -0800 Subject: [PATCH] trivial cleanup parser changes o use defines in debug strings o replace my 'xxx' debug :) o shorten line in man page example to not to exceed 80 chars when printed --- namedev_parse.c | 12 ++++++------ udev.8 | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index 3578058a76..9cd96a6224 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -257,7 +257,7 @@ keys: /* check presence of keys according to method type */ switch (dev.type) { case LABEL: - dbg_parse("LABEL name='%s', bus='%s', " + dbg_parse(TYPE_LABEL " name='%s', bus='%s', " "sysfs_file='%s', sysfs_value='%s', symlink='%s'", dev.name, dev.bus, dev.sysfs_file, dev.sysfs_value, dev.symlink); @@ -268,7 +268,7 @@ keys: goto error; break; case NUMBER: - dbg_parse("NUMBER name='%s', bus='%s', id='%s', symlink='%s'", + dbg_parse(TYPE_NUMBER "name='%s', bus='%s', id='%s', symlink='%s'", dev.name, dev.bus, dev.id, dev.symlink); if ((*dev.name == '\0') || (*dev.bus == '\0') || @@ -276,7 +276,7 @@ keys: goto error; break; case TOPOLOGY: - dbg_parse("TOPOLOGY name='%s', bus='%s', " + dbg_parse(TYPE_TOPOLOGY "name='%s', bus='%s', " "place='%s', symlink='%s'", dev.name, dev.bus, dev.place, dev.symlink); if ((*dev.name == '\0') || @@ -285,14 +285,14 @@ keys: goto error; break; case REPLACE: - dbg_parse("REPLACE name='%s', kernel_name='%s', symlink='%s'", + dbg_parse(TYPE_REPLACE "name='%s', kernel_name='%s', symlink='%s'", dev.name, dev.kernel_name, dev.symlink); if ((*dev.name == '\0') || (*dev.kernel_name == '\0')) goto error; break; case CALLOUT: - dbg_parse("CALLOUT name='%s', bus='%s', program='%s', " + dbg_parse(TYPE_CALLOUT "name='%s', bus='%s', program='%s', " "id='%s', symlink='%s'", dev.name, dev.bus, dev.exec_program, dev.id, dev.symlink); @@ -303,7 +303,7 @@ keys: goto error; break; default: - dbg_parse("xxx default method"); + dbg_parse("unknown type of method"); goto error; } diff --git a/udev.8 b/udev.8 index f26beb4b9d..c4ee23dcc7 100644 --- a/udev.8 +++ b/udev.8 @@ -178,7 +178,7 @@ TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" REPLACE, KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" # multiple USB webcams with symlinks to be called webcam0, webcam1, ... -LABEL, BUS="usb", SYSFS_model="WebCam V3", NAME="video%n", SYMLINK="webcam%n" +LABEL, BUS="usb", SYSFS_model="XV3", NAME="video%n", SYMLINK="webcam%n" .fi .P Permissions and ownership for the created device files may specified at -- cgit v1.2.3-54-g00ecf From 1b1dbc47a3b1b227273c7ed5074a6376efc7526e Mon Sep 17 00:00:00 2001 From: "dhollis@davehollis.com" Date: Wed, 17 Dec 2003 08:35:00 -0800 Subject: [PATCH] mark config files as such in the rpm spec file Got a nasty surprise after upgrading my RPM. The config files weren't marked as configs and were subsequently replaced! DOH! Fortunately, I didn't have much in there yet but that certainly isn't something others will like going forward. Attached is a simple patch to the spec file so they aren't replaced in the future. The config files included in the RPM should wind up as udev.conf.rpmnew, etc if they are different from what is installed. --- udev.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev.spec b/udev.spec index f8bde13171..2e5a472a52 100644 --- a/udev.spec +++ b/udev.spec @@ -40,9 +40,9 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /sbin/udev %attr(755,root,root) /udev/ %attr(755,root,root) /etc/udev/ -%attr(0644,root,root) /etc/udev/udev.conf -%attr(0644,root,root) /etc/udev/udev.rules -%attr(0644,root,root) /etc/udev/udev.permissions +%config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf +%config(noreplace) %attr(0644,root,root) /etc/udev/udev.rules +%config(noreplace) %attr(0644,root,root) /etc/udev/udev.permissions %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(755,root,root) /etc/init.d/udev %attr(0644,root,root) %{_mandir}/man8/udev.8* -- cgit v1.2.3-54-g00ecf From 093bf8f4d2c44fb1f581dfec0330f3f86473496c Mon Sep 17 00:00:00 2001 From: "Roman.Kagan@itep.ru" Date: Wed, 17 Dec 2003 18:24:05 -0800 Subject: [PATCH] fix comment and whitespace handling in config files. This chunk broke parsing of blank lines and comments with blanks before '#'. Please revert it with the patch below. Roman. --- namedev_parse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index 9cd96a6224..33e0c89e22 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -158,6 +158,10 @@ int namedev_init_rules(void) lineno++; dbg_parse("read '%s'", temp); + /* eat the whitespace */ + while (isspace(*temp)) + ++temp; + /* empty line? */ if (*temp == 0x00) continue; @@ -166,10 +170,6 @@ int namedev_init_rules(void) if (*temp == COMMENT_CHARACTER) continue; - /* eat the whitespace */ - while (isspace(*temp)) - ++temp; - memset(&dev, 0x00, sizeof(struct config_device)); /* get the method */ -- cgit v1.2.3-54-g00ecf From 281ff00a611aa0a71e43dd4355b0caa918d820d2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 17 Dec 2003 18:28:05 -0800 Subject: [PATCH] add tests to catch whitespace and comment config file parsing errors. --- test/udev-test.pl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 08b99f041f..7afbd0d6fc 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -101,6 +101,39 @@ EOF expected => "visor" , conf => < "Handle comment lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor" , + conf => < "Handle comment lines in config file with whitespace (and replace kernel name)", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor" , + conf => < "Handle empty lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor" , + conf => < Date: Wed, 17 Dec 2003 18:32:53 -0800 Subject: [PATCH] Allow build with empty EXTRAS Need to let the shell expand $EXTRAS so it can properly detect an empty list. Without this patch, the build fails whenever $EXTRAS is empty. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c5c05d615d..c2ed659531 100644 --- a/Makefile +++ b/Makefile @@ -145,7 +145,7 @@ endif CFLAGS += -I$(PWD)/libsysfs all: $(ROOT) - @for target in $(EXTRAS) ; do \ + @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ -C $$target $@ ; \ @@ -223,7 +223,7 @@ clean: | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(MAKE) -C klibc clean - @for target in $(EXTRAS) ; do \ + @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ -C $$target $@ ; \ @@ -286,7 +286,7 @@ install: install-dbus-policy all $(GEN_CONFIGS) $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir) - rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug - ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug - @for target in $(EXTRAS) ; do \ + @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ -C $$target $@ ; \ @@ -303,7 +303,7 @@ uninstall: uninstall-dbus-policy - rmdir $(hotplugdir) - rmdir $(configdir) - rmdir $(udevdir) - @for target in $(EXTRAS) ; do \ + @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ -C $$target $@ ; \ -- cgit v1.2.3-54-g00ecf From 77c46e9bd630806cf23741ead3d7551661973847 Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Wed, 17 Dec 2003 18:58:28 -0800 Subject: [PATCH] add libsysfs docs Here's the latest libsysfs doc, you may want to include it in your docs directory. --- docs/libsysfs.txt | 1687 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1687 insertions(+) create mode 100644 docs/libsysfs.txt diff --git a/docs/libsysfs.txt b/docs/libsysfs.txt new file mode 100644 index 0000000000..66156e5607 --- /dev/null +++ b/docs/libsysfs.txt @@ -0,0 +1,1687 @@ + + System Utilities sysfs Library - libsysfs + ========================================= + +Version: 0.4.0 +December 16, 2003 + +Contents +-------- +1. Introduction +2. Requirements +3. Definitions +4. Overview +5. Data Structures + 5.1 Directory and Attribute Data Structures + 5.1.1 Attribute Structure + 5.1.2 Link Structure + 5.1.3 Directory Structure + 5.2 Bus Data Structure + 5.3 Class Data Structures + 5.4 Root Device Data Structure + 5.5 Device Data Structure + 5.6 Driver Data Structure +6. Functions + 6.1 Utility Functions + 6.2 Filesystem Functions + 6.2.1 Attribute Functions + 6.2.2 Directory Link Functions + 6.2.3 Directory Functions + 6.3 Bus Functions + 6.4 Class Functions + 6.5 Device Functions + 6.6 Driver Functions +7. Navigating a dlist +8. Usage +9. Conclusion + + +1. Introduction +--------------- + +Libsysfs' purpose is to provide a consistent and stable interface for +querying system device information exposed through the sysfs filesystem. +The library implements functions for querying filesystem information, +such as reading directories and files. It also contains routines for +working with buses, classes, and the device tree. + + +2. Requirements +--------------- + +The library must satisfy the following requirements: + +- It must provide a stable programming interfaces that applications can + be built upon. + +- It must provide functions to retrieve device Vital Product Data (VPD) + information for Error Log Analysis (ELA) support. ELA will provide + device driver and device bus address information. + +- It must provide access to all system devices and information exposed + by sysfs. + +- It must provide a function to find sysfs' current mount point. + +- It must provide a function for udev to retrieve a device's major and + minor numbers. + + +3. Definitions +-------------- + +- sysfs: Sysfs is a virtual filesystem in 2.5+ Linux kernels that + presents a hierarchical representation of all system physical and + virtual devices. It presents system devices by bus, by class, and + by topology. Callbacks to device drivers are exposed as files in + device directories. Sysfs, for all purposes, is our tree of system + devices. For more information, please see: + + http://www.kernel.org/pub/linux/kernel/people/mochel/doc/ + +- udev: Udev is Greg Kroah-Hartman's User Space implementation of devfs. + Udev creates /dev nodes for devices upon Hotplug events. The Hotplug + event provides udev with a sysfs directory location of the device. Udev + must use that directory to grab device's major and minor number, which it + will use to create the /dev node. For more information, please see: + + http://www.kernel.org/pub/linux/utils/kernel/hotplug/ + + +4. Overview +----------- + +Libsysfs grew from a common need. There are several applications under +development that need access to sysfs and system devices. Udev, on a +hotplug event, must take a sysfs device path and create a /dev node. Our +diagnostic client needs to list all system devices. Finally, our Error +Log Analysis piece is required to retrieve VPD information for a +failing device. We divided to create a single library interface rather +than having these separate applications create their own accesses to +sysfs involving reading directories and files. + +Libsysfs will also provide stability for applications to be built upon. Sysfs +currently doesn't enforce any standards for callback or file names. File +names change depending on bus or class. Sysfs is also changing, it is +currently being developed. Libsysfs will provide a stable interface to +applications while allowing sysfs to change underneath it. + +Like sysfs, the library will provide devices to applications by bus, by +class, and by topology. The library will function similar to directories +and files that lie underneath it. To query a device on a PCI bus, one would +"open" the bus to scan or read devices and "close" the bus when +completed. Besides supplying functions to retrieve devices, the library +will also provide some utility functions like getting sysfs mount point. + + +5. Data Structures +------------------ + +Libsysfs will classify system devices following sysfs' example, dividing +them by bus, class, and devices. The library presents this information +generically. It doesn't, for example, differentiate between PCI and USB +buses. Device attributes are presented with values as they are exposed +by sysfs, the values are not formatted. + +The library will provide standard definitions for working with sysfs +and devices, here's some examples: + +#define SYSFS_FSTYPE_NAME "sysfs" +#define SYSFS_PROC_MNTS "/proc/mounts" +#define SYSFS_BUS_DIR "/bus" +#define SYSFS_BUS_NAME "bus" +#define SYSFS_CLASS_DIR "/class" +#define SYSFS_CLASS_DIR "/class" +#define SYSFS_BLOCK_DIR "/block" +#define SYSFS_BLOCK_NAME "block" +#define SYSFS_DEVICES_DIR "/devices" +#define SYSFS_DEVICES_NAME "devices" +#define SYSFS_DRIVERS_DIR "/drivers" +#define SYSFS_DRIVERS_NAME "drivers" +#define SYSFS_NAME_ATTRIBUTE "name" + +The library uses some definitions to mark maximum size of a sysfs name or +path length: + +#define SYSFS_PATH_MAX 255 +#define SYSFS_NAME_LEN 50 +#define SYSFS_BUS_ID_SIZE 20 + + +NOTE: + As of release 0.4.0 of libsysfs, a number of changes have been made + so that the dlists and "directory" references in all libsysfs's + structures are not populated until such time that it is absolutely + necessary. Hence, these elements may not contain valid data at all + times (as was the case before). + +5.1 Directory and Attribute Data Structures +------------------------------------------- + +The library implements structures to represent sysfs directories, links, +and files. + + +5.1.1 Attribute Structure +------------------------- + +A file in sysfs represents a device or driver attribute. Attributes can be +read only, write only, or read and write. File data can be ASCII and +binary. The library has the following structure to represent files: + +struct sysfs_attribute { + unsigned char *value; + unsigned short len; /* value length */ + unsigned short method; /* show and store */ + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; +}; + +Path represents the file/attribute's full path. Value is used when reading +from or writing to an attribute. "len" is the length of data in "value". +Method is a bitmask for defining if the attribute supports show(read) +and/or store(write). + + +5.1.2 Link Structure +-------------------- + +Symbolic links are used in sysfs to link bus or class views with +particular devices. + +struct sysfs_link { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + unsigned char target[SYSFS_PATH_MAX]; +}; + +Link's name is stored in "name' and it's target stored in "target". Absolute +path to the link is stored in "path". + + +5.1.3 Directory Structure +------------------------- + +The directory structure represents a sysfs directory: + +struct sysfs_directory { + struct dlist *subdirs; + struct dlist *links; + struct dlist *attributes; + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; +}; + +The sysfs_directory structure includes the list of subdirectories, links and +attributes. The "name" and absolute "path" are also stored in the structure. +The sysfs_directory structure is intended for use internal to the library. +Applications needing access to attributes and links from the directory +will need to make appropriate calls (described below) to get the same. + + +5.2 Bus Data Structure +---------------------- + +All buses look similar in sysfs including lists of devices and drivers, +therefore we use the following structure to represent all sysfs buses: + +struct sysfs_bus { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* internal use only */ + struct dlist *drivers; + struct dlist *devices; + struct sysfs_directory *directory; +}; + +The sysfs_bus structure contains the bus "name", while the "path" to bus +directory is also stored. It also contains lists of devices on the bus +and drivers that are registered on it. The bus' directory is represented +by the sysfs_directory structure and it contains references to all the +subdirectories, links, and attributes. The sysfs_directory structure +is for internal use only. The following functions may be used by +applications to retrieve data from the sysfs_directory structure: + +struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) +struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, + unsigned char *attrname) + + +5.3 Class Data Structures +------------------------- + +The library uses two data structures to represent classes in sysfs. Sysfs +classes contains a class directory like "net" or "scsi_host" and then +class devices like "eth0", "lo", or "eth1" for the "net" class. + +struct sysfs_class { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* for internal use only */ + struct dlist *devices; + struct sysfs_directory *directory; +}; + +The sysfs_class represents device classes in sysfs like "net". It contains +the class "name", "path" to the class, a list of class devices and the +directory representation (for internal use only). + +struct sysfs_class_device { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char classname[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* for internal use only */ + struct sysfs_class_device *parent; + struct sysfs_device *sysdevice; /* NULL if virtual */ + struct sysfs_driver *driver; /* NULL if not implemented */ + struct sysfs_directory *directory; +}; + +A class device isn't the same as a sysfs_device, it's specific to the class in +which it belongs. The class device structure contains the name of the class +the class device belongs to, its sysfs_device reference and that device's +driver reference (if any). It also contains the name of the class device +- like "eth0", its parent point (if present) and its sysfs directory +information including links and attributes (for internal use only). +The following function may be used by applications to retrieve data +from the sysfs_directory structure: + +struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev); + + +5.4 Root Device Data Structure +------------------------------ + +Device hierarchies in sysfs are represented under the /sys/devices directory +structure. Sysfs devices typically spawn off from base devices which are +represented by a sysfs_root_device. + +struct sysfs_root_device { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* for internal use only */ + struct dlist *devices; + struct sysfs_directory *directory; +}; + +The sysfs_root_device structure contains a list of "devices" that spawn off it. +The name of the root device as represented under /sys/devices is read into +"name" and the absolute path into "path" and its sysfs_directory information +intended to be used internal to the library. + + +5.5 Device Data Structure +------------------------- + +The sysfs_device structure represents a system device that's exposed +in sysfs under the /sys/devices directory structure. + +struct sysfs_device { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char bus_id[SYSFS_NAME_LEN]; + unsigned char bus[SYSFS_NAME_LEN]; + unsigned char driver_name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* for internal use only */ + struct sysfs_device *parent; + struct dlist *children; + struct sysfs_directory *directory; +}; + +The sysfs_device structure contains a "parent" pointer, a list of child +devices, if any, device's directory, its bus id - which is the name of +device's directory, the bus name on which this device is registered and +its driver name. The device structure also contains the absolute path +to the device and a directory structure, which contains a list of the +device's attributes (for internal use only). The following functions +may be used to obtain information from sysfs_directory structure: + +struct sysfs_attribute *sysfs_get_device_attribute(struct sysfs_device *dev, + const unsigned char *name) +struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) + + +5.6 Driver Data Structure +------------------------- + +The sysfs_driver structure represents a device driver. + +struct sysfs_driver { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* for internal use only */ + struct dlist *devices; + struct sysfs_directory *directory; +}; + +The sysfs_driver structure contains a list of devices that use this driver, +the name of the driver, its path, and its directory information, which +includes the driver's attributes (for internal use only). The following +function may be used to retrieve driver attribute information from the +sysfs_directory structure: + +struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) + + +6. Functions +------------ + +Libsysfs will provide functions to access system devices by bus, by class, +and by device. Functions will act like accessing directories and files, +using "open" and "close". Open returns a structure and close is used +to clean that structure up. + + +6.1 Utility Functions +--------------------- + +The library will provide a few utility functions for working with sysfs. + +------------------------------------------------------------------------------- +Name: sysfs_get_mnt_path + +Description: Function finds the mount path for filesystem type "sysfs". + +Arguments: unsigned char *mnt_path Mount path buffer + size_t len Size of mount path buffer + +Returns: Zero with success. + -1 with error. Errno will be set with error: + - EINVAL for invalid argument, if buffer is NULL. + +Prototype: sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_name_from_path + +Description: Function returns the last directory or file name from the + included path. + +Arguments: const unsigned char *path Path to parse name from + unsigned char *name Buffer to put parsed name into + size_t *len Size of name buffer + +Returns: 0 with success. + -1 on Error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_get_name_from_path(const unsigned char *path, + unsigned char *name, size_t *len) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_link + +Description: Sysfs readlink function, reads the link at supplied path + and returns its target path. + +Arguments: const unsigned char *path Link's path + unsigned char *target Buffer to place link's target path + size_t len Size of target buffer + +Returns: 0 with success + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_get_link(const unsigned char *path, + unsigned char *target, size_t len) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_subsystem_list + +Description: Function returns the list of entries for the given subsystem. If + the argument is "bus", this function will return a list of buses + ("pci", "scsi", etc) supported on the system. + + sysfs_close_list() has to be called to free the list obtained + from this call. + +Arguments: unsigned char *name Subsystem to open, like "bus".. + +Returns: dlist of entries for the subsystem on success + NULL with error indicating the "name" subsystem is invalid. + +Prototype: struct dlist *sysfs_open_subsystem_list(unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_bus_devices_list + +Description: Function returns the list of devices on the given bus. + + sysfs_close_list() has to be called to free the list obtained + from this call. + +Arguments: unsigned char *name Bus name to open "pci"/"scsi"/"usb".. + +Returns: dlist of device names for the given bus on success + NULL with error indicating the bus is not supported. + +Prototype: struct dlist *sysfs_open_bus_devices_list(unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_list + +Description: Closes a given dlist. This can be used as a generic list close + routine. + +Arguments: struct dlist *list List to be closed + +Prototype: void sysfs_close_list(struct dlist *list) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_path_is_dir + +Description: Utility function to verify if a given path is to a directory. + +Arguments: unsigned char *path Path to verify + +Returns: 0 on success, 1 on error + - EINVAL for invalid arguments + +Prototype: int sysfs_path_is_dir(unsigned char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_path_is_file + +Description: Utility function to verify if a given path is to a file. + +Arguments: unsigned char *path Path to verify + +Returns: 0 on success, 1 on error + - EINVAL for invalid arguments + +Prototype: int sysfs_path_is_file(unsigned char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_path_is_link + +Description: Utility function to verify if a given path is to a link. + +Arguments: unsigned char *path Path to verify + +Returns: 0 on success, 1 on error + - EINVAL for invalid arguments + +Prototype: int sysfs_path_is_link(unsigned char *path) +------------------------------------------------------------------------------- + +6.2 Filesystem Functions +------------------------ + +Libsysfs provides a set of functions to open, read, and close directories +and attributes/files in sysfs. These functions mirror their filesystem +function counterparts. + +6.2.1 Attribute Functions +------------------------- + +Along with the usual open, read, and close functions, libsysfs provides +a couple other functions for accessing attribute values. + +------------------------------------------------------------------------------- +Name: sysfs_open_attribute + +Description: Opens up a file in sysfs and creates a sysfs_attribute + structure. File isn't read with this function. + +Arguments: const unsigned char *path File/Attribute's path + +Returns: struct sysfs_attribute * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_open_attribute + (const unsigned char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_attribute + +Description: Cleans up and closes sysfs_attribute structure. + +Arguments: struct sysfs_attribute *sysattr Attribute to close + +Prototype: void sysfs_close_attribute(struct sysfs_attribute *sysattr) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_dir_attributes + +Description: Reads the given sysfs_directory to create a list of attributes. + +Arguments: struct sysfs_directory *sysdir sysfs_directory whose + attributes to read + +Returns: struct dlist * of attributes on success + NULL with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: struct dlist *sysfs_read_dir_attributes + (struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_refresh_attributes + +Description: Given a list of attributes, this function refreshes the values + of attributes in the list. + +Arguments: struct dlist *attrlist list of attributes to refresh + +Returns: 0 with success. + 1 with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: int sysfs_refresh_attributes(struct dlist *attrlist) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_attribute + +Description: Reads the supplied attribute. Since the maximum transfer + from a sysfs attribute is a pagesize, function reads in + up to a page from the file and stores it in the "value" + field in the attribute. + +Arguments: struct sysfs_attribute *sysattr Attribute to read + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_read_attribute(struct sysfs_attribute *sysattr) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_write_attribute + +Description: Writes to the supplied attribute. Function validates if attribute + is writable, and writes the new value to the attribute. Value to + write as well as its length is user supplied. In case the length + written is not equal to the length requested to be written, the + original value is restored and an error is returned. + +Arguments: struct sysfs_attribute *sysattr Attribute to write to + const unsigned char *new_value New value for the attribute + size_t len Length of "new_value" + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_write_attribute(struct sysfs_attribute *sysattr, + const unsigned char *new_value, size_t len) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_attribute_value + +Description: Given a path to a specific attribute, function reads and + returns its value to the supplied value buffer. + +Arguments: const unsigned char *attrpath Attribute path to read + unsigned char *value Buffer to place attribute's value + size_t vsize Size of buffer + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_read_attribute_value(const unsigned char *attrpath, + unsigned char *value, size_t vsize) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_value_from_attributes + +Description: Function takes a single or linked list of sysfs attribute + structures and returns the value of the specified attribute + name. + +Arguments: struct sysfs_attribute *attr + Attribute list to search through + const unsigned char *name Name of attribute to return value + +Returns: unsigned char * attribute value with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: unsigned char *sysfs_get_value_from_attributes + (struct sysfs_attribute *attr, const unsigned char * name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_directory_attribute + +Description: Function walks the list of attributes for the given sysfs + directory and returns the sysfs_attribute structure for + the specified attribute name. + +Arguments: struct sysfs_directory *dir Directory in which to search + unsigned char *attrname Attribute name to look for + +Returns: struct sysfs_attribute on success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_directory_attribute + (struct sysfs_directory *dir, unsigned char *attrname) +------------------------------------------------------------------------------- + + +6.2.2 Link Functions +-------------------- + +Sysfs contains many symbolic links, like bus links to bus devices. Libsysfs +treats links differently than directories due to processing differences. A +link in the /sys/bus/"busname"/devices/ directory indicates a device in the +/sys/devices directory. Through links we give the functionality to know +what is and what isn't a link and the ability to query the links target. + +------------------------------------------------------------------------------- +Name: sysfs_open_link + +Description: Opens a directory link. + +Arguments: const unsigned char *linkpath Path to link + +Returns: struct sysfs_link * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_link *sysfs_open_link + (const unsigned char *linkpath) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_link + +Description: Closes a directory link structure. + +Arguments: struct sysfs_link *ln Link to close + +Prototype: void sysfs_close_link(struct sysfs_link *ln) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_dir_links + +Description: Reads the given sysfs_directory to create a list of links. + +Arguments: struct sysfs_directory *sysdir sysfs_directory whose + links to read + +Returns: struct dlist * of links with success + NULL with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: struct dlist *sysfs_read_dir_links + (struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_directory_link + +Description: Function walks the list of links for the given sysfs directory + and returns the sysfs_link structure for the specified link + name. + +Arguments: struct sysfs_directory *dir Directory in which to search + unsigned char *linkname Link name to look for + +Returns: struct sysfs_link * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_link *sysfs_get_directory_link + (struct sysfs_directory *dir, unsigned char *linkname) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_subdirectory_link + +Description: Function walks the list of links for the given sysfs directory + and its subdirectories returns the sysfs_link structure for + the specified link name. + +Arguments: struct sysfs_directory *dir Directory in which to search + unsigned char *linkname Link name to look for + +Returns: struct sysfs_link * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_link *sysfs_get_subdirectory_link + (struct sysfs_directory *dir, unsigned char *linkname) +------------------------------------------------------------------------------- + + +6.2.3 Directory Functions +------------------------- + +Sysfs directories can represent every directory under sysfs. The structures +keep track of subdirectories, links, and files. Like opendir, readdir, and +closedir, libsysfs provides open, read, and close functions for working with +sysfs directories. Open creates the sysfs_directory structure. Read reads in +its contents - like subdirectories, links, and files. Close cleans it all +up. + +------------------------------------------------------------------------------- +Name: sysfs_open_directory + +Description: Opens a sysfs directory at a specific path + +Arguments: const unsigned char *path Directory path to open + +Returns: struct sysfs_directory * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_directory *sysfs_open_directory + (const unsigned char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_directory + +Description: Closes specific directory, its subdirectories, links, and + files. + +Arguments: struct sysfs_directory *sysdir Directory to close + +Prototype: void sysfs_close_directory(struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_dir_subdirs + +Description: Reads the given sysfs_directory to create a list of subdirs. + +Arguments: struct sysfs_directory *sysdir sysfs_directory whose + subdirs have to be read + +Returns: struct dlist * of links with success + NULL with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: struct dlist *sysfs_read_dir_subdirs + (struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_directory + +Description: Read the supplied directory. Reading fills in the directory's + contents like subdirectories, links, and attributes. + +Arguments: struct sysfs_directory *sysdir Directory to read + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_read_directory(struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_all_subdirs + +Description: Reads all subdirs under a given supplied directory. + +Arguments: struct sysfs_directory *sysdir Directory to read + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_subdirectory + +Description: Function walks the directory tree for the given directory and + returns a sysfs_directory structure for the specified directory + name. + +Arguments: struct sysfs_directory *dir Directory in which to search + unsigned char *subname Name of directory to look for + +Returns: struct sysfs_directory with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments +------------------------------------------------------------------------------- + + +6.3 Bus Functions +----------------- + +The library provides a functions for viewing buses represented in sysfs. +The sysfs_open_bus opens a bus in the /sys/bus directory, such as "pci", +"usb", or "scsi". The open command returns a sysfs_bus structure that +contains a list of the bus' devices. The sysfs_close_bus function is +used to clean up the bus structure. Given a device or a driver, +functions are provided to determine what bus they are on. + +------------------------------------------------------------------------------- +Name: sysfs_open_bus + +Description: Function opens up one of the buses represented in sysfs in + the /sys/bus directory. It returns a sysfs_bus structure + that includes a list of bus devices and drivers. + +Arguments: const unsigned char *name Bus name to open, like "pci"... + +Returns: struct sysfs_bus * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_bus *sysfs_open_bus(const unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_bus + +Description: Function closes up the sysfs_bus structure including its + devices, drivers, and directory. + +Arguments: sysfs_bus *bus Bus structure to close + +Prototype: void sysfs_close_bus(struct sysfs_bus *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_devices + +Description: Function returns a list of devices that are registered with + this bus. + +Arguments: struct sysfs_bus *bus Bus whose devices list to return + +Returns: struct dlist * of sysfs_devices on success + NULL with error. Errno will be sent with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_drivers + +Description: Function returns a list of drivers that are registered with + this bus. + +Arguments: struct sysfs_bus *bus Bus whose drivers list to return + +Returns: struct dlist * of sysfs_drivers on success + NULL with error. Errno will be sent with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_device + +Description: Function takes a sysfs_bus structure(obtained on a successful + return from a sysfs_open_bus() call) and looks for the given + device on this bus. On success, it returns a sysfs_device + structure corresponding to the device. + +Arguments: struct sysfs_bus *bus Bus structure on which to search + unsigned char *id Device to look for + +Returns: struct sysfs_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_get_bus_device + (struct sysfs_bus *bus, unsigned char *id) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_driver + +Description: Function takes a sysfs_bus structure (obtained on a successful + return from a sysfs_open_bus() call) and looks for the given + driver on this bus. On success, it returns a sysfs_driver + structure corresponding to the driver. + +Arguments: struct sysfs_bus *bus Bus structure on which to search + unsigned char *drvname Driver to look for + +Returns: struct sysfs_driver * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_get_bus_driver + (struct sysfs_bus *bus, unsigned char *drvname) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_attributes + +Description: Function takes a sysfs_bus structure and returns a list of + attributes for the bus. + +Arguments: struct sysfs_bus *bus Bus for which attributes are required + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_attribute + +Description: Function takes a sysfs_bus structure and looks for the required + attribute on the bus. On success, it returns a sysfs_attribute + structure corresponding to the given attribute. + +Arguments: struct sysfs_bus *bus Bus structure on which to search + unsigned char *attrname Attribute to look for + +Returns: struct sysfs_attribute * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_bus_attribute + (struct sysfs_bus *bus, unsigned char *attrname) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_bus_device + +Description: Given the name of the bus on which to look for, this function + locates a given device on the bus and returns a sysfs_device + structure corresponding to the requested device. + + NOTE: + 1. The sysfs_device structure obtained upon successful return + from this function has to be closed by calling + sysfs_close_device(). + +Arguments: unsigned char *busname Bus on which to search + unsigned char *dev_id Name of the device to look for + +Returns: struct sysfs_device * on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_open_bus_device + (unsigned char *busname, unsigned char *dev_id) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_find_driver_bus + +Description: Given the name of a driver, this function finds the name of the + bus the driver is on + +Arguments: const unsigned char *driver Name of the driver to look for + unsigned char *busname Buffer to return the bus name + size_t bsize Size of the "busname" buffer + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_find_driver_bus(const unsigned char *driver, + unsigned char *busname, size_t bsize) +------------------------------------------------------------------------------- + + +6.4 Class Functions +------------------- + +Libsysfs provides functions to open sysfs classes and their class devices. +These functions too operate with open and close, close must be called to +clean up the class structures. Given a class device name, functions are +provided to determine what class they belong to. Once a class device +name and the class it belongs to is known, a function to open the +class device is provided. This method can be used when details of +a single class device is required. + +------------------------------------------------------------------------------- +Name: sysfs_open_class + +Description: Function opens up one of the classes represented in sysfs in + the /sys/class directory. It returns a sysfs_class structure + that includes a list of class devices. + +Arguments: const unsigned char *name Class name to open, like "net".. + +Returns: struct sysfs_class * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class *sysfs_open_class(const unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_class + +Description: Function closes up the sysfs_class structure including its + class devices. + +Arguments: sysfs_class *class Class structure to close + +Prototype: void sysfs_close_class(struct sysfs_class *class); +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_class_device_path + +Description: Function opens up one of the class devices represented in + sysfs in sysfs/class/"class"/ directory. It returns a + sysfs_class_device structure. + +Arguments: const unsigned char *path Path to class device + +Returns: struct sysfs_class_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class_device *sysfs_open_class_device_path + (const unsigned char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_class_device + +Description: Function closes up the sysfs_class_device structure. + +Arguments: sysfs_class_device *dev Class device structure to close + +Prototype: void sysfs_close_class_device(struct sysfs_class_device *dev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_class_device + +Description: Function takes a sysfs_class structure(obtained on a successful + return from a sysfs_open_class() call) and looks for the given + device in this class. On success, it returns a sysfs_class_device + structure corresponding to the class device. + +Arguments: struct sysfs_class *class Class on which to search + unsigned_char *name Class device "name" to look for + +Returns: struct sysfs_class_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class_device *sysfs_get_class_device + (struct sysfs_class *class, unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_class_devices + +Description: Function returns a list of class devices for the given class. + +Arguments: struct sysfs_class *cls Class whose class device list + is required + +Returns: struct dlist * of sysfs_class_devices on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_class_device + +Description: Given the name of the class on which to look for, this function + locates a given class device and returns a sysfs_class_device + structure corresponding to the requested class device. + + NOTE: + 1. The sysfs_class_device structure obtained upon successful + return from this function has to be closed by calling + sysfs_close_class_device(). + 2. Class this device belongs to must be known prior to calling + this function. + +Arguments: const unsigned char *classname Class on which to search + unsigned char *name Class device "name" to open + +Returns: struct sysfs_class_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class_device *sysfs_open_class_device + (const unsigned char *classname, unsigned char *class) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_device + +Description: Function returns the sysfs_device reference (if present) for the + given class device. + +Arguments: struct sysfs_class_device *clsdev Class device whose + sysfs_device reference + is required + +Returns: struct sysfs_device * on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_get_classdev_device + (struct sysfs_class_device *clsdev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_driver + +Description: Function returns the sysfs_driver reference (if present) for the + given class device. + +Arguments: struct sysfs_class_device *clsdev Class device whose + sysfs_driver reference + is required + +Returns: struct sysfs_driver * on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_driver *sysfs_get_classdev_driver + (struct sysfs_class_device *clsdev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_parent + +Description: Function returns the sysfs_class_device reference for the parent + (if present) of the given class device. + +Arguments: struct sysfs_class_device *clsdev Class device whose + parent reference + is required + +Returns: struct sysfs_class_device * on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class_device *sysfs_get_classdev_parent + (struct sysfs_class_device *clsdev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_attributes + +Description: Function takes a sysfs_class_device structure and returns a list + of attributes for the class device. + +Arguments: struct sysfs_class_device *cdev Class device for which + attributes are required + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_classdev_attributes + (struct sysfs_class_device *cdev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_attr + +Description: Searches supplied class device's attributes by name and returns + the attribute. + +Arguments: struct sysfs_class_device *clsdev Device to search + const unsigned char *name Attribute name to find + +Returns: struct sysfs_attribute * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_classdev_attr + (struct sysfs_class_device *clsdev, const unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_classdev_attr + +Description: Function takes as arguments, a the name of the class, the class + device name and the name of the required attribute. + + NOTE: + 1. The struct sysfs_attribute * obtained upon successful + return from this function has to be closed by making + a call to sysfs_close_attribute() + +Arguments: unsigned char *classname Class name on which to search + unsigned char *dev Name of the class device + unsigned char *attrib Attribute to open + +Returns: struct sysfs_attribute * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_write_classdev_attr + (const unsigned char *classname, const unsigned char *dev, + const unsigned char *attrib) +------------------------------------------------------------------------------- + + +6.5 Device Functions +-------------------- + +Devices represent everything in sysfs under /sys/devices, which is a +hierarchical view of system devices. Besides the expected open and +close functions, libsysfs provides open and close functions for +root devices. These functions recursively open or close a device +and all of its children. + +------------------------------------------------------------------------------- +Name: sysfs_open_device_path + +Description: Opens up a device at a specific path. It opens the device's + directory, reads the directory, and returns a sysfs_device + structure. + +Arguments: const unsigned char *path Path to device + +Returns: struct sysfs_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_open_device_path + (const unsigned char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_device + +Description: Function closes up the sysfs_device structure. + +Arguments: sysfs_device *dev Device structure to close + +Prototype: void sysfs_close_device(struct sysfs_device *dev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_root_device + +Description: Function opens up one of the root devices represented in sysfs + in the /sys/devices directory. It returns a sysfs_root_device + structure that includes a list of devices in the tree. + +Arguments: const unsigned char *name Name of the root device to open + +Returns: struct sysfs_root_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_open_root_device + (const unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_root_device + +Description: Function closes up the sysfs_root_device structure including the + devices in the root device tree. + +Arguments: sysfs_device *root Root device structure to close + +Prototype: void sysfs_close_root_device(struct sysfs_root_device *root) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_device_parent + +Description: Function returns the sysfs_device reference for the parent + (if present) of the given sysfs_device. + +Arguments: struct sysfs_device *dev sysfs_device whose parent + reference is required + +Returns: struct sysfs_device * on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_get_device_parent + (struct sysfs_device *dev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_root_devices + +Description: Function returns a list of devices under the given root device. + +Arguments: struct sysfs_root_device *root sysfs_root_device whose devices + list is required + +Returns: struct dlist * of sysfs_devices on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_root_devices + (struct sysfs_root_device *root) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_device_attr + +Description: Searches supplied device's attributes by name and returns + the attribute. + +Arguments: struct sysfs_device *dev Device to search + const unsigned char *name Attribute name to find + +Returns: struct sysfs_attribute * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_device_attr + (struct sysfs_device *dev, const unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_device_attributes + +Description: Function takes a sysfs_device structure and returns a list + of attributes for the device. + +Arguments: struct sysfs_device *device Device for which + attributes are required + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_device_attributes + (struct sysfs_device *device) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_device + +Description: Given the name of the bus on which to look for, this function + locates a given device and returns a sysfs_device structure + corresponding to the requested device. + +Arguments: const unsigned char *bus_id Device to look for + const unsigned char *bus Bus on which to search + +Returns: struct sysfs_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_open_device + (const unsigned char *bus_id, const unsigned char *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_device_attr + +Description: Function takes as arguments, the bus on which to search for a + device, and an attribute of the device to open. + + NOTE: + 1. The struct sysfs_attribute * obtained upon successful + return from this function has to be closed by making + a call to sysfs_close_attribute() + +Arguments: unsigned char *bus Bus on which to search + unsigned char *bus_id Device to look for + unsigned char *attrib Name of the attribute to open + +Returns: struct sysfs_attribute * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_open_device_attr + (const unsigned char *bus, const unsigned char *bus_id, + const unsigned char *attrib) +------------------------------------------------------------------------------- + + +6.6 Driver Functions +-------------------- + +Drivers are represented in sysfs under the /sys/bus/xxx/drivers (xxx being +the bus type, such as "pci", "usb, and so on). Functions are provided to +open and close drivers. + +------------------------------------------------------------------------------- +Name: sysfs_open_driver_path + +Description: Opens driver at specific path. + +Arguments: const unsigned char *path Path to driver + +Returns: struct sysfs_driver * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_driver *sysfs_open_driver_path + (const unsigned char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_driver + +Description: Closes and cleans up sysfs_driver structure. + +Arguments: sysfs_driver *driver Driver structure to close + +Prototype: void sysfs_close_driver(struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_devices + +Description: Function returns a list of devices that use this driver. + +Arguments: struct sysfs_driver *driver Driver whose devices list is + required + +Returns: struct dlist * of sysfs_devices on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_driver_devices + (struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_device + +Description: Function returns a sysfs_device reference for the device with + "name" that uses this driver + +Arguments: struct sysfs_driver *driver Driver on which to search + const unsigned char *name Name of the device to look for + +Returns: struct sysfs_device * corresponding to "name" on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_driver_device + (struct sysfs_driver *driver, const unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_attr + +Description: Searches supplied driver's attributes by name and returns + the attribute. + +Arguments: struct sysfs_driver *drv Driver to search + const unsigned char *name Attribute name to find + +Returns: struct sysfs_attribute * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_driver_attr + (struct sysfs_driver *drv, const unsigned char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_attributes + +Description: Function takes a sysfs_driver structure and returns a list + of attributes for the driver. + +Arguments: struct sysfs_driver *driver Driver for which + attributes are required + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_driver_attributes + (struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_driver + +Description: Given the name of the bus on which to look for, this function + locates a given driver and returns a sysfs_driver structure + corresponding to the requested device. + + NOTE: + 1. The sysfs_driver structure obtained upon successful return + from this function has to be closed by calling + sysfs_close_driver_by_name(). + 2. Bus on which to look for this driver should be known prior + to calling this function. Use sysfs_find_driver_bus() + to determine this. + +Arguments: const unsigned char *drv_name Driver to look for + const unsigned char *bus Bus on which to search + size_t bsize Size of "bus" + +Returns: struct sysfs_driver * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_driver *sysfs_open_driver + (const unsigned char *drv_name, + const unsigned char *bus, size_t bsize) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_links + +Description: Function returns a list of links for a given driver + +Arguments: struct sysfs_driver *driver Driver to get links from + +Returns: struct dlist * of links on success + NULL with error + +Prototype: struct dlist *sysfs_get_driver_links + (struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_driver_attr + +Description: Function takes as arguments, the bus the driver is registered + on, the driver name and the name of the attribute to open. + + NOTE: + 1. The struct sysfs_attribute * obtained upon successful + return from this function has to be closed by making + a call to sysfs_close_attribute() + +Arguments: unsigned char *bus Bus on which driver is present + unsigned char *drv Driver to look for + unsigned char *attrib Name of the attribute to open + +Returns: struct sysfs_attribute * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_open_driver_attr + (const unsigned char *bus, const unsigned char *drv, + const unsigned char *attrib) +------------------------------------------------------------------------------- + + +7. Navigating a dlist +--------------------- + +Libsysfs uses (yet another) list implementation thanks to Eric J Bohm. + +Some library functions return a dlist of devices/drivers/attributes, etc. +To navigate the list returned the macro "dlist_for_each_data" is to be used. + +------------------------------------------------------------------------------ +Function/Macro name: dlist_for_each_data + +Description: Walk the given list, returning a known data type/ + structure in each iteration. + +Arguments: struct dlist *list List pointer + data_iterator Data type/structure variable + contained in the list + datatype Data type/structure contained + in the list + +Returns: On each iteration, "data_iterator" will contain a list + element of "datatype" + +Usage example: The function sysfs_get_classdev_attributes() returns a + dlist of attributes. To navigate the list: + + struct sysfs_attribute *attr = NULL; + struct dlist *attrlist = NULL; + . + . + . + attrlist = sysfs_get_classdev_attributes + (struct sysfs_class_device *cdev) + if (attrlist != NULL) { + dlist_for_each_data(attrlist, attr, + struct sysfs_attribute) { + . + . + . + } + } +------------------------------------------------------------------------------- + + +8. Usage +-------- + +Accessing devices through libsysfs is supposed to mirror accessing devices +in the filesystem it represents. Here's a typical order of operation: + + - get sysfs mount point + - "open" sysfs category, ie. bus, class, or device + - work with category + - "close" sysfs category + + +9. Conclusion +------------- + +Libsysfs is meant to provide a stable application programming interface to +sysfs. Applications can depend upon the library to access system devices +and functions exposed through sysfs. -- cgit v1.2.3-54-g00ecf From ff3633bf9d192c46c457cc3819dc27ff2807ed0d Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Wed, 17 Dec 2003 19:05:25 -0800 Subject: [PATCH] fix scsi_id segfault with udev-009 Scsi_id hasn't been changed to use the latest libsysfs changes. The "directory" in the sysfs_class_device is now considered "private" and only should be accessed using functions. Treating the structures as handles lets us only load information when it's needed, reducing caching or stale information and also helping performance. Here's the problem. static inline char *sysfs_get_attr(struct sysfs_class_device *dev, const char *attr) { return sysfs_get_value_from_attributes(dev->directory->attributes, attr); } Please try this quick fix: --- extras/scsi_id/scsi_id.c | 2 +- extras/scsi_id/scsi_id.h | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index df18271b48..3a34643c81 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -133,7 +133,7 @@ static int sysfs_is_bus(const char *sysfs_path, const char *bus) return -1; snprintf(bus_dev_name, MAX_NAME_LEN, "%s/%s/%s/%s/%s", sysfs_mnt_path, - SYSFS_BUS_DIR, bus, SYSFS_DEVICES_NAME, bus_id); + SYSFS_BUS_NAME, bus, SYSFS_DEVICES_NAME, bus_id); if (stat(sysfs_path, &stat_buf)) return -1; diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index eb9498ab71..cb27e88a5f 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -42,8 +42,14 @@ static inline char *sysfs_get_attr(struct sysfs_class_device *dev, const char *attr) { - return sysfs_get_value_from_attributes(dev->directory->attributes, - attr); + struct dlist *attributes = NULL; + + attributes = sysfs_get_classdev_attributes(dev); + + if (attributes == NULL) + return NULL; + + return sysfs_get_value_from_attributes(attributes, attr); } extern int scsi_get_serial (struct sysfs_class_device *scsi_dev, -- cgit v1.2.3-54-g00ecf From a81805b9af899087f3d8367721ac0a51460f692e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 17 Dec 2003 22:33:29 -0800 Subject: [PATCH] bug in udev-remove.c Uups, we have a bug in udev-remove.c. udev segfaults with NULL-pointer, if the device is not in the database: ./test.block: line 29: 4844 Segmentation fault $BIN block Dec 17 22:47:42 pim udev[4882]: udev_remove_device: '/block/sdy' not found in database, falling back on default name Dec 17 22:47:42 pim udev[4882]: udev_remove_device: name is '(null)' --- udev-remove.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udev-remove.c b/udev-remove.c index 0886c23343..dad4a98570 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -118,8 +118,8 @@ static int delete_node(struct udevice *dev) */ int udev_remove_device(char *path, char *subsystem) { - char name[100]; struct udevice *dev; + struct udevice device; char *temp; dev = udevdb_get_dev(path); @@ -128,13 +128,15 @@ int udev_remove_device(char *path, char *subsystem) temp = strrchr(path, '/'); if (temp == NULL) return -ENODEV; - strncpy(name, &temp[1], sizeof(name)); + memset(&device, 0, sizeof(device)); + dev = &device; + strncpy(device.name, &temp[1], sizeof(device.name)); } dbg("name is '%s'", dev->name); udevdb_delete_dev(path); - sysbus_send_remove(name, path); + sysbus_send_remove(dev->name, path); return delete_node(dev); } -- cgit v1.2.3-54-g00ecf From d077e50c927209c4157f2696d15f0d1286ada411 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 17 Dec 2003 22:41:04 -0800 Subject: [PATCH] clean up the stand-alone tests to work properly on other people's machines. --- test/label_test | 3 +++ test/modifier_test | 3 +++ test/replace_test | 3 +++ test/topo_test | 3 +++ 4 files changed, 12 insertions(+) diff --git a/test/label_test b/test/label_test index 09ccab366e..2e05692581 100644 --- a/test/label_test +++ b/test/label_test @@ -18,6 +18,8 @@ udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF +mkdir udev + export ACTION=add export DEVPATH=block/sda @@ -43,3 +45,4 @@ ls -l udev rm $RULES rm $CONFIG +rm -rf udev diff --git a/test/modifier_test b/test/modifier_test index bbe072e58c..9af946e598 100644 --- a/test/modifier_test +++ b/test/modifier_test @@ -18,6 +18,8 @@ udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF +mkdir udev + export ACTION=add export DEVPATH=block/sda @@ -42,3 +44,4 @@ ls udev rm $RULES rm $CONFIG +rm -rf udev diff --git a/test/replace_test b/test/replace_test index 375c8dced3..9ed366e358 100644 --- a/test/replace_test +++ b/test/replace_test @@ -18,6 +18,8 @@ udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF +mkdir udev + export DEVPATH=class/tty/ttyUSB0 export ACTION=add @@ -30,3 +32,4 @@ ls -l udev rm $RULES rm $CONFIG +rm -rf udev diff --git a/test/topo_test b/test/topo_test index 9225685c8c..385f415893 100644 --- a/test/topo_test +++ b/test/topo_test @@ -18,6 +18,8 @@ udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF +mkdir udev + export ACTION=add export DEVPATH=block/sda @@ -42,3 +44,4 @@ ls udev rm $RULES rm $CONFIG +rm -rf udev -- cgit v1.2.3-54-g00ecf From 7ecb8d23f371a38cd918334ee7bf8383f1807ddb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 19 Dec 2003 18:08:39 -0800 Subject: [PATCH] remove unneeded TODO and FIXME entry Thanks to Kay for pointing it out to me. --- TODO | 1 - namedev.c | 1 - 2 files changed, 2 deletions(-) diff --git a/TODO b/TODO index 47275873c8..d0d0bec4d9 100644 --- a/TODO +++ b/TODO @@ -6,7 +6,6 @@ greg k-h greg@kroah.com -- fix kernel name logic to handle devices like sdaj and such. - more documentation (can never have too much.) - better partition support (it's a hack right now, maybe new libsysfs changes can help out a lot here.) diff --git a/namedev.c b/namedev.c index 212d6bb68d..58986e25c2 100644 --- a/namedev.c +++ b/namedev.c @@ -189,7 +189,6 @@ static void build_kernel_number(struct sysfs_class_device *class_dev, struct ude { char *dig; - /* FIXME, figure out how to handle stuff like sdaj which will not work right now. */ dig = class_dev->name + strlen(class_dev->name); while (isdigit(*(dig-1))) dig--; -- cgit v1.2.3-54-g00ecf From a56ef382869bb76ade6d26cd7e8adc983ca3f89e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 19 Dec 2003 18:29:01 -0800 Subject: [PATCH] udev-remove.c cleanups I've moved the malloc out of the udevdb into udev-remove to free the struct after use and not to allocate a different struct in the case the device is not in the data base. I seems a bit easier to read. --- udev-remove.c | 19 ++++++++++++------- udevdb.c | 15 ++++----------- udevdb.h | 2 +- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/udev-remove.c b/udev-remove.c index dad4a98570..6d7e2ad22a 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -119,18 +119,21 @@ static int delete_node(struct udevice *dev) int udev_remove_device(char *path, char *subsystem) { struct udevice *dev; - struct udevice device; char *temp; + int retval; + + dev = malloc(sizeof(*dev)); + if (dev == NULL) + return -ENOMEM; + memset(dev, 0, sizeof(*dev)); - dev = udevdb_get_dev(path); - if (dev == NULL) { + retval = udevdb_get_dev(path, dev); + if (retval) { dbg("'%s' not found in database, falling back on default name", path); temp = strrchr(path, '/'); if (temp == NULL) return -ENODEV; - memset(&device, 0, sizeof(device)); - dev = &device; - strncpy(device.name, &temp[1], sizeof(device.name)); + strncpy(dev->name, &temp[1], sizeof(dev->name)); } dbg("name is '%s'", dev->name); @@ -138,5 +141,7 @@ int udev_remove_device(char *path, char *subsystem) sysbus_send_remove(dev->name, path); - return delete_node(dev); + retval = delete_node(dev); + free(dev); + return retval; } diff --git a/udevdb.c b/udevdb.c index 5be3c25151..bbbeddad47 100644 --- a/udevdb.c +++ b/udevdb.c @@ -62,29 +62,22 @@ int udevdb_add_dev(const char *path, const struct udevice *dev) return tdb_store(udevdb, key, data, TDB_REPLACE); } -struct udevice *udevdb_get_dev(const char *path) +int udevdb_get_dev(const char *path, struct udevice *dev) { TDB_DATA key, data; - struct udevice *dev; if (path == NULL) - return NULL; + return -ENODEV; key.dptr = (void *)path; key.dsize = strlen(path) + 1; data = tdb_fetch(udevdb, key); if (data.dptr == NULL || data.dsize == 0) - return NULL; - - dev = malloc(sizeof(*dev)); - if (dev == NULL) - goto exit; + return -ENODEV; memcpy(dev, data.dptr, sizeof(*dev)); -exit: - free(data.dptr); - return dev; + return 0; } int udevdb_delete_dev(const char *path) diff --git a/udevdb.h b/udevdb.h index 97e1f9bc40..d6c58ae766 100644 --- a/udevdb.h +++ b/udevdb.h @@ -13,7 +13,7 @@ extern void udevdb_exit(void); extern int udevdb_init(int init_flag); extern int udevdb_add_dev(const char *path, const struct udevice *dev); -extern struct udevice *udevdb_get_dev(const char *path); +extern int udevdb_get_dev(const char *path, struct udevice *dev); extern int udevdb_delete_dev(const char *path); #endif /* _UDEVDB_H_ */ -- cgit v1.2.3-54-g00ecf From 7591c18a8f3460d3e7cab85d02915c4b51638b5c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 19 Dec 2003 18:29:05 -0800 Subject: [PATCH] don't overwrite old config on install Here is a patch for the Makefile to look for a already installed config and not to overwrite it. --- Makefile | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index c2ed659531..3e220b47d0 100644 --- a/Makefile +++ b/Makefile @@ -274,18 +274,31 @@ uninstall-dbus-policy: - endif -install: install-dbus-policy all $(GEN_CONFIGS) - $(INSTALL) -d $(DESTDIR)$(udevdir) +install-config: $(GEN_CONFIGS) $(INSTALL) -d $(DESTDIR)$(configdir) + @if [ ! -r $(DESTDIR)$(configdir)udev.conf ]; then \ + echo $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir); \ + $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir); \ + fi + @if [ ! -r $(DESTDIR)$(configdir)udev.rules ]; then \ + echo $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir); \ + $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir); \ + fi + @if [ ! -r $(DESTDIR)$(configdir)udev.permissions ]; then \ + echo $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir); \ + $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir); \ + fi + + + +install: install-config install-dbus-policy all + $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 - $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir) - $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir) - $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir) - rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug - - ln -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug + - ln -f -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ -- cgit v1.2.3-54-g00ecf From bcbe2d8e7d4ccd975e79d0c7defbe1d64d1b129c Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Fri, 19 Dec 2003 18:29:10 -0800 Subject: [PATCH] libsysfs 0.4.0 patch Ananth released sysfsutils 0.4.0 last night, I'm sure you saw the email. Here's a patch with the latest changes from the pre-patch I already gave you. It includes sysfs_get_device_parent(), which you said you needed. I've run your test scripts and I've built scsi_id. Please play around with this and check it out. There are quite a few changes. Please do not access structure pointers, like sysfs_device's parent, directly like dev->parent. Please use the "get" function to retrieve. The functions load things on demand and refresh views under the covers. --- extras/scsi_id/scsi_id.c | 4 +-- libsysfs/libsysfs.h | 17 ++++++---- libsysfs/sysfs_bus.c | 50 +++++++++++++++------------ libsysfs/sysfs_class.c | 80 ++++++++++++++++++++++++------------------- libsysfs/sysfs_device.c | 88 ++++++++++++++++++++++++++++++++++++------------ libsysfs/sysfs_dir.c | 71 +++++++++++++++++--------------------- libsysfs/sysfs_driver.c | 72 ++++++++++++++++++++------------------- libsysfs/sysfs_utils.c | 26 +++++++------- udev-add.c | 4 +-- 9 files changed, 236 insertions(+), 176 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 3a34643c81..6bb41132de 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -158,7 +158,7 @@ static int get_major_minor(const char *devpath, int *major, int *minor) char *dev; dprintf("%s\n", devpath); - class_dev = sysfs_open_class_device(devpath); + class_dev = sysfs_open_class_device_path(devpath); if (!class_dev) { log_message(LOG_WARNING, "open class %s failed: %s\n", devpath, strerror(errno)); @@ -708,7 +708,7 @@ static int scsi_id(const char *target_path, char *maj_min_dev) return 1; } - scsi_dev = sysfs_open_class_device(full_dev_path); + scsi_dev = sysfs_open_class_device_path(full_dev_path); if (!scsi_dev) { log_message(LOG_WARNING, "open class %s failed: %s\n", full_dev_path, strerror(errno)); diff --git a/libsysfs/libsysfs.h b/libsysfs/libsysfs.h index aca25772b5..2ffe1005cc 100644 --- a/libsysfs/libsysfs.h +++ b/libsysfs/libsysfs.h @@ -182,7 +182,9 @@ extern struct sysfs_attribute *sysfs_get_directory_attribute /* sysfs driver access */ extern void sysfs_close_driver(struct sysfs_driver *driver); -extern struct sysfs_driver *sysfs_open_driver(const unsigned char *path); +extern struct sysfs_driver *sysfs_open_driver + (const unsigned char *drv_name, const unsigned char *bus_name); +extern struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path); extern struct sysfs_attribute *sysfs_get_driver_attr (struct sysfs_driver *drv, const unsigned char *name); extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); @@ -199,12 +201,13 @@ extern struct sysfs_root_device *sysfs_open_root_device (const unsigned char *name); extern struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root); extern void sysfs_close_device(struct sysfs_device *dev); -extern struct sysfs_device *sysfs_open_device(const unsigned char *path); +extern struct sysfs_device *sysfs_open_device + (const unsigned char *bus_id, const unsigned char *bus); +extern struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev); +extern struct sysfs_device *sysfs_open_device_path(const unsigned char *path); extern struct sysfs_attribute *sysfs_get_device_attr (struct sysfs_device *dev, const unsigned char *name); extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); -extern struct sysfs_device *sysfs_open_device_by_id - (const unsigned char *bus_id, const unsigned char *bus); extern struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, const unsigned char *bus_id, const unsigned char *attrib); @@ -227,8 +230,10 @@ extern int sysfs_find_driver_bus(const unsigned char *driver, /* generic sysfs class access */ extern void sysfs_close_class_device(struct sysfs_class_device *dev); -extern struct sysfs_class_device *sysfs_open_class_device +extern struct sysfs_class_device *sysfs_open_class_device_path (const unsigned char *path); +extern struct sysfs_class_device *sysfs_open_class_device + (const unsigned char *class, const unsigned char *name); extern struct sysfs_device *sysfs_get_classdev_device (struct sysfs_class_device *clsdev); extern struct sysfs_driver *sysfs_get_classdev_driver @@ -240,8 +245,6 @@ extern struct sysfs_class *sysfs_open_class(const unsigned char *name); extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); extern struct sysfs_class_device *sysfs_get_class_device (struct sysfs_class *class, unsigned char *name); -extern struct sysfs_class_device *sysfs_open_class_device_by_name - (const unsigned char *class, const unsigned char *name); extern struct dlist *sysfs_get_classdev_attributes (struct sysfs_class_device *cdev); extern struct sysfs_attribute *sysfs_get_classdev_attr diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index 3e6c22bbb1..d9da0f84cf 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -121,16 +121,20 @@ struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) return NULL; } - dlist_for_each_data(devdir->links, curl, struct sysfs_link) { - bdev = sysfs_open_device(curl->target); - if (bdev == NULL) { - dprintf("Error opening device at %s\n", curl->target); - continue; + if (devdir->links != 0) { + dlist_for_each_data(devdir->links, curl, struct sysfs_link) { + bdev = sysfs_open_device_path(curl->target); + if (bdev == NULL) { + dprintf("Error opening device at %s\n", + curl->target); + continue; + } + if (bus->devices == NULL) + bus->devices = dlist_new_with_delete + (sizeof(struct sysfs_device), + sysfs_close_dev); + dlist_unshift(bus->devices, bdev); } - if (bus->devices == NULL) - bus->devices = dlist_new_with_delete - (sizeof(struct sysfs_device), sysfs_close_dev); - dlist_unshift(bus->devices, bdev); } sysfs_close_directory(devdir); @@ -165,16 +169,21 @@ struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) sysfs_close_directory(drvdir); return NULL; } - dlist_for_each_data(drvdir->subdirs, cursub, struct sysfs_directory) { - driver = sysfs_open_driver(cursub->path); - if (driver == NULL) { - dprintf("Error opening driver at %s\n", cursub->path); - continue; + if (drvdir->subdirs != NULL) { + dlist_for_each_data(drvdir->subdirs, cursub, + struct sysfs_directory) { + driver = sysfs_open_driver_path(cursub->path); + if (driver == NULL) { + dprintf("Error opening driver at %s\n", + cursub->path); + continue; + } + if (bus->drivers == NULL) + bus->drivers = dlist_new_with_delete + (sizeof(struct sysfs_driver), + sysfs_close_drv); + dlist_unshift(bus->drivers, driver); } - if (bus->drivers == NULL) - bus->drivers = dlist_new_with_delete - (sizeof(struct sysfs_driver), sysfs_close_drv); - dlist_unshift(bus->drivers, driver); } sysfs_close_directory(drvdir); return (bus->drivers); @@ -347,10 +356,9 @@ struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, dprintf("Error getting sysfs mount point\n"); return NULL; } - + if (sysfs_trailing_slash(path) == 0) strcat(path, "/"); - strcat(path, SYSFS_BUS_NAME); strcat(path, "/"); strcat(path, busname); @@ -359,7 +367,7 @@ struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, strcat(path, "/"); strcat(path, dev_id); - rdev = sysfs_open_device(path); + rdev = sysfs_open_device_path(path); if (rdev == NULL) { dprintf("Error getting device %s on bus %s\n", dev_id, busname); diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index 169600d5fd..16eaf6e514 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -130,11 +130,12 @@ static void set_classdev_classname(struct sysfs_class_device *cdev) } /** - * sysfs_open_class_device: Opens and populates class device + * sysfs_open_class_device_path: Opens and populates class device * @path: path to class device. * returns struct sysfs_class_device with success and NULL with error. */ -struct sysfs_class_device *sysfs_open_class_device(const unsigned char *path) +struct sysfs_class_device *sysfs_open_class_device_path + (const unsigned char *path) { struct sysfs_class_device *cdev = NULL; @@ -184,22 +185,24 @@ struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) return NULL; } - if ((sysfs_read_dir_subdirs(cls->directory) != 0) - || cls->directory->subdirs == NULL) + if ((sysfs_read_dir_subdirs(cls->directory)) != 0) return NULL; - dlist_for_each_data(cls->directory->subdirs, cur, - struct sysfs_directory) { - dev = sysfs_open_class_device(cur->path); - if (dev == NULL) { - dprintf("Error opening device at %s\n", cur->path); - continue; - } - if (cls->devices == NULL) - cls->devices = dlist_new_with_delete + if (cls->directory->subdirs != NULL) { + dlist_for_each_data(cls->directory->subdirs, cur, + struct sysfs_directory) { + dev = sysfs_open_class_device_path(cur->path); + if (dev == NULL) { + dprintf("Error opening device at %s\n", + cur->path); + continue; + } + if (cls->devices == NULL) + cls->devices = dlist_new_with_delete (sizeof(struct sysfs_class_device), sysfs_close_cls_dev); - dlist_unshift(cls->devices, dev); + dlist_unshift(cls->devices, dev); + } } return cls->devices; } @@ -223,7 +226,6 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) dprintf("Sysfs not supported on this system\n"); return NULL; } - if (sysfs_trailing_slash(classpath) == 0) strcat(classpath, "/"); @@ -307,7 +309,7 @@ struct sysfs_device *sysfs_get_classdev_device if (devlink == NULL) return NULL; - clsdev->sysdevice = sysfs_open_device(devlink->target); + clsdev->sysdevice = sysfs_open_device_path(devlink->target); if (clsdev->sysdevice == NULL) return NULL; if (clsdev->driver != NULL) @@ -343,7 +345,7 @@ struct sysfs_driver *sysfs_get_classdev_driver } drvlink = sysfs_get_directory_link(clsdev->directory, "driver"); if (drvlink != NULL) { - clsdev->driver = sysfs_open_driver(drvlink->target); + clsdev->driver = sysfs_open_driver_path(drvlink->target); if (clsdev->driver == NULL) return NULL; @@ -401,7 +403,7 @@ static int get_blockdev_parent(struct sysfs_class_device *clsdev) goto errout; *c = '\0'; - clsdev->parent = sysfs_open_class_device(parent_path); + clsdev->parent = sysfs_open_class_device_path(parent_path); if (clsdev->parent == NULL) { dprintf("Error opening the parent class device at %s\n", parent_path); @@ -482,7 +484,7 @@ static int get_classdev_path(const unsigned char *classname, } /** - * sysfs_open_class_device_by_name: Locates a specific class_device and returns it. + * sysfs_open_class_device: Locates a specific class_device and returns it. * Class_device must be closed using sysfs_close_class_device * @classname: Class to search * @name: name of the class_device @@ -490,7 +492,7 @@ static int get_classdev_path(const unsigned char *classname, * NOTE: * Call sysfs_close_class_device() to close the class device */ -struct sysfs_class_device *sysfs_open_class_device_by_name +struct sysfs_class_device *sysfs_open_class_device (const unsigned char *classname, const unsigned char *name) { unsigned char devpath[SYSFS_PATH_MAX]; @@ -509,7 +511,7 @@ struct sysfs_class_device *sysfs_open_class_device_by_name return NULL; } - cdev = sysfs_open_class_device(devpath); + cdev = sysfs_open_class_device_path(devpath); if (cdev == NULL) { dprintf("Error getting class device %s from class %s\n", name, classname); @@ -572,32 +574,41 @@ struct sysfs_attribute *sysfs_get_classdev_attr errno = EINVAL; return NULL; } + /* * First, see if it's in the current directory. Then look at * subdirs since class devices can have subdirs of attributes. */ attrlist = sysfs_get_classdev_attributes(clsdev); - if (attrlist == NULL) - return NULL; - cur = sysfs_get_directory_attribute(clsdev->directory, + if (attrlist != NULL) { + cur = sysfs_get_directory_attribute(clsdev->directory, (unsigned char *)name); - if (cur != NULL) - return cur; + if (cur != NULL) + return cur; + } if (clsdev->directory->subdirs == NULL) if ((sysfs_read_dir_subdirs(clsdev->directory)) != 0 || clsdev->directory->subdirs == NULL) return NULL; - dlist_for_each_data(clsdev->directory->subdirs, sdir, - struct sysfs_directory) { - cur = sysfs_get_directory_attribute(sdir, - (unsigned char *)name); - if (cur != NULL) - return cur; + if (clsdev->directory->subdirs != NULL) { + dlist_for_each_data(clsdev->directory->subdirs, sdir, + struct sysfs_directory) { + if ((sysfs_path_is_dir(sdir->path)) != 0) + continue; + if (sdir->attributes == NULL) { + cur = sysfs_get_directory_attribute(sdir, + (unsigned char *)name); + } else { + if ((sysfs_refresh_attributes + (sdir->attributes)) == 0) + cur = sysfs_get_directory_attribute(sdir, + (unsigned char *)name); + } + } } - - return NULL; + return cur; } /** @@ -643,3 +654,4 @@ struct sysfs_attribute *sysfs_open_classdev_attr(const unsigned char *classname, } return attribute; } + diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 82b54719ff..66d5f9aef7 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -104,14 +104,6 @@ static void sysfs_close_device_tree(struct sysfs_device *devroot) } } -/** - * sysfs_del_device: routine for dlist integration - */ -static void sysfs_del_device(void *dev) -{ - sysfs_close_device((struct sysfs_device *)dev); -} - /** * sysfs_close_dev_tree: routine for dlist integration */ @@ -127,6 +119,8 @@ static void sysfs_close_dev_tree(void *dev) void sysfs_close_device(struct sysfs_device *dev) { if (dev != NULL) { + if (dev->parent != NULL) + sysfs_close_device(dev->parent); if (dev->directory != NULL) sysfs_close_directory(dev->directory); if (dev->children != NULL && dev->children->count == 0) @@ -164,7 +158,7 @@ static struct sysfs_directory *open_device_dir(const unsigned char *path) dprintf ("Device %s not supported on this system\n", path); return NULL; } - if ((sysfs_read_directory(rdir)) != 0) { + if ((sysfs_read_dir_subdirs(rdir)) != 0) { dprintf ("Error reading device at dir %s\n", path); sysfs_close_directory(rdir); return NULL; @@ -174,11 +168,11 @@ static struct sysfs_directory *open_device_dir(const unsigned char *path) } /** - * sysfs_open_device: opens and populates device structure + * sysfs_open_device_path: opens and populates device structure * @path: path to device, this is the /sys/devices/ path * returns sysfs_device structure with success or NULL with error */ -struct sysfs_device *sysfs_open_device(const unsigned char *path) +struct sysfs_device *sysfs_open_device_path(const unsigned char *path) { struct sysfs_device *dev = NULL; @@ -232,7 +226,7 @@ static struct sysfs_device *sysfs_open_device_tree(const unsigned char *path) errno = EINVAL; return NULL; } - rootdev = sysfs_open_device(path); + rootdev = sysfs_open_device_path(path); if (rootdev == NULL) { dprintf("Error opening root device at %s\n", path); return NULL; @@ -255,7 +249,7 @@ static struct sysfs_device *sysfs_open_device_tree(const unsigned char *path) if (rootdev->children == NULL) rootdev->children = dlist_new_with_delete (sizeof(struct sysfs_device), - sysfs_del_device); + sysfs_close_dev_tree); dlist_unshift(rootdev->children, new); } } @@ -342,7 +336,6 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) if (sysfs_trailing_slash(rootpath) == 0) strcat(rootpath, "/"); - strcat(rootpath, SYSFS_DEVICES_NAME); strcat(rootpath, "/"); strcat(rootpath, name); @@ -357,6 +350,7 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) dprintf("calloc failure\n"); return NULL; } + strcpy(root->name, name); strcpy(root->path, rootpath); return root; } @@ -416,10 +410,8 @@ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, cur = sysfs_get_directory_attribute(dev->directory, (unsigned char *)name); - if (cur != NULL) - return cur; - return NULL; + return cur; } /** @@ -445,10 +437,8 @@ static int get_device_absolute_path(const unsigned char *device, dprintf ("Sysfs not supported on this system\n"); return -1; } - if (sysfs_trailing_slash(bus_path) == 0) strcat(bus_path, "/"); - strcat(bus_path, SYSFS_BUS_NAME); strcat(bus_path, "/"); strcat(bus_path, bus); @@ -468,7 +458,7 @@ static int get_device_absolute_path(const unsigned char *device, } /** - * sysfs_open_device_by_id: open a device by id (use the "bus" subsystem) + * sysfs_open_device: open a device by id (use the "bus" subsystem) * @bus_id: bus_id of the device to open - has to be the "bus_id" in * /sys/bus/xxx/devices * @bus: bus the device belongs to @@ -478,7 +468,7 @@ static int get_device_absolute_path(const unsigned char *device, * 2. Bus the device is on must be supplied * Use sysfs_find_device_bus to get the bus name */ -struct sysfs_device *sysfs_open_device_by_id(const unsigned char *bus_id, +struct sysfs_device *sysfs_open_device(const unsigned char *bus_id, const unsigned char *bus) { char sysfs_path[SYSFS_PATH_MAX]; @@ -495,7 +485,7 @@ struct sysfs_device *sysfs_open_device_by_id(const unsigned char *bus_id, return NULL; } - device = sysfs_open_device(sysfs_path); + device = sysfs_open_device_path(sysfs_path); if (device == NULL) { dprintf("Error opening device %s\n", bus_id); return NULL; @@ -504,6 +494,60 @@ struct sysfs_device *sysfs_open_device_by_id(const unsigned char *bus_id, return device; } +/** + * sysfs_get_device_parent: opens up given device's parent and returns a + * reference to its sysfs_device + * @dev: sysfs_device whose parent is requested + * Returns sysfs_device of the parent on success and NULL on failure + */ +struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) +{ + unsigned char ppath[SYSFS_PATH_MAX], *tmp = NULL; + + if (dev == NULL) { + errno = EINVAL; + return NULL; + } + + if (dev->parent != NULL) + return (dev->parent); + + memset(ppath, 0, SYSFS_PATH_MAX); + strcpy(ppath, dev->path); + tmp = strrchr(ppath, '/'); + if (tmp == NULL) { + dprintf("Invalid path to device %s\n", ppath); + return NULL; + } + if (*(tmp +1) == '\0') { + *tmp = '\0'; + tmp = strrchr(tmp, '/'); + if (tmp == NULL) { + dprintf("Invalid path to device %s\n", ppath); + return NULL; + } + } + *tmp = '\0'; + + /* + * All "devices" have the "detach_state" attribute - validate here + */ + strcat(ppath, "/detach_state"); + if ((sysfs_path_is_file(ppath)) != 0) { + dprintf("Device at %s does not have a parent\n", dev->path); + return NULL; + } + tmp = strrchr(ppath, '/'); + *tmp = '\0'; + dev->parent = sysfs_open_device_path(ppath); + if (dev->parent == NULL) { + dprintf("Error opening device %s's parent at %s\n", + dev->bus_id, ppath); + return NULL; + } + return (dev->parent); +} + /* * sysfs_open_device_attr: open the given device's attribute * @bus: Bus on which to look diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index ac2ecfcbe1..7dbee8aba8 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -1,5 +1,5 @@ /* - * syfs_dir.c + * sysfs_dir.c * * Directory utility functions for libsysfs * @@ -147,7 +147,7 @@ struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path) sysfs_close_attribute(sysattr); return NULL; } - strncpy(sysattr->path, path, sizeof(sysattr->path)); + strncpy(sysattr->path, path, SYSFS_PATH_MAX); if ((stat(sysattr->path, &fileinfo)) != 0) { dprintf("Stat failed: No such attribute?\n"); sysattr->method = 0; @@ -260,7 +260,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) { unsigned char *fbuf = NULL; unsigned char *vbuf = NULL; - size_t length = 0; + ssize_t length = 0; long pgsize = 0; int fd; @@ -441,13 +441,15 @@ int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) return -1; } if (sysdir->subdirs == NULL) - if ((sysfs_read_dir_subdirs(sysdir) != 0) - || sysdir->subdirs == NULL) + if ((sysfs_read_dir_subdirs(sysdir)) != 0) return 0; - dlist_for_each_data(sysdir->subdirs, cursub, struct sysfs_directory) { - if ((sysfs_read_directory(cursub)) != 0) - dprintf ("Error reading subdirectory %s\n", - cursub->name); + if (sysdir->subdirs != NULL) { + dlist_for_each_data(sysdir->subdirs, cursub, + struct sysfs_directory) { + if ((sysfs_read_dir_subdirs(cursub)) != 0) + dprintf ("Error reading subdirectory %s\n", + cursub->name); + } } return 0; } @@ -476,7 +478,7 @@ struct sysfs_directory *sysfs_open_directory(const unsigned char *path) sysfs_close_directory(sdir); return NULL; } - strncpy(sdir->path, path, sizeof(sdir->path)); + strncpy(sdir->path, path, SYSFS_PATH_MAX); return sdir; } @@ -527,7 +529,8 @@ int sysfs_refresh_attributes(struct dlist *attrlist) dlist_for_each_data(attrlist, attr, struct sysfs_attribute) { if (attr->method & SYSFS_METHOD_SHOW) { if ((sysfs_read_attribute(attr)) != 0) { - dprintf("Error reading attribute %s\n", attr->path); + dprintf("Error reading attribute %s\n", + attr->path); if ((sysfs_path_is_file(attr->path)) != 0) { dprintf("Attr %s no longer exists\n", attr->name); @@ -540,12 +543,6 @@ int sysfs_refresh_attributes(struct dlist *attrlist) } } } - if (attrlist->count == 0) { - dprintf("No attributes in the list, destroying list now\n"); - dlist_destroy(attrlist); - attrlist = NULL; - return 1; - } return 0; } @@ -655,9 +652,9 @@ int sysfs_read_dir_attributes(struct sysfs_directory *sysdir) if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - strncpy(file_path, sysdir->path, sizeof(file_path)); - strncat(file_path, "/", sizeof(file_path)); - strncat(file_path, dirent->d_name, sizeof(file_path)); + strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); + strcat(file_path, "/"); + strcat(file_path, dirent->d_name); if ((lstat(file_path, &astats)) != 0) { dprintf("stat failed\n"); continue; @@ -697,9 +694,9 @@ int sysfs_read_dir_links(struct sysfs_directory *sysdir) if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - strncpy(file_path, sysdir->path, sizeof(file_path)); - strncat(file_path, "/", sizeof(file_path)); - strncat(file_path, dirent->d_name, sizeof(file_path)); + strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); + strcat(file_path, "/"); + strcat(file_path, dirent->d_name); if ((lstat(file_path, &astats)) != 0) { dprintf("stat failed\n"); continue; @@ -742,9 +739,9 @@ int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir) if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - strncpy(file_path, sysdir->path, sizeof(file_path)); - strncat(file_path, "/", sizeof(file_path)); - strncat(file_path, dirent->d_name, sizeof(file_path)); + strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); + strcat(file_path, "/"); + strcat(file_path, dirent->d_name); if ((lstat(file_path, &astats)) != 0) { dprintf("stat failed\n"); continue; @@ -784,9 +781,9 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - strncpy(file_path, sysdir->path, sizeof(file_path)); - strncat(file_path, "/", sizeof(file_path)); - strncat(file_path, dirent->d_name, sizeof(file_path)); + strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); + strcat(file_path, "/"); + strcat(file_path, dirent->d_name); if ((lstat(file_path, &astats)) != 0) { dprintf("stat failed\n"); continue; @@ -829,26 +826,20 @@ struct sysfs_attribute *sysfs_get_directory_attribute attr = (struct sysfs_attribute *)dlist_find_custom (dir->attributes, attrname, dir_attribute_name_equal); - if (attr != NULL) { - /* - * don't read here since we would have read the attribute in - * in the routine that called this routine - */ - return attr; - } else { + if (attr == NULL) { memset(new_path, 0, SYSFS_PATH_MAX); strcpy(new_path, dir->path); strcat(new_path, "/"); strcat(new_path, attrname); if ((sysfs_path_is_file(new_path)) == 0) { if ((add_attribute(dir, new_path)) == 0) { - attr = (struct sysfs_attribute *)dlist_find_custom - (dir->attributes, attrname, dir_attribute_name_equal); + attr = (struct sysfs_attribute *) + dlist_find_custom(dir->attributes, + attrname, dir_attribute_name_equal); } - return attr; } } - return NULL; + return attr; } /** diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index 4372b19f10..695ca794f1 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -65,29 +65,6 @@ static int open_driver_dir(struct sysfs_driver *driver) return 0; } -/** - * read_driver_dir: Read driver directory's subdirs and links - * @driver: Driver to read - * Returns 0 on success and 1 on failure - */ -static int read_driver_dir(struct sysfs_driver *driver) -{ - if (driver == NULL) { - errno = EINVAL; - return 1; - } - if (driver->directory == NULL) { - if ((open_driver_dir(driver)) == 1) - return 1; - } - if ((sysfs_read_directory(driver->directory)) != 0) { - dprintf("Error reading driver directory at %s\n", - driver->path); - return 1; - } - return 0; -} - /** * alloc_driver: allocates and initializes driver * returns struct sysfs_driver with success and NULL with error. @@ -98,11 +75,11 @@ static struct sysfs_driver *alloc_driver(void) } /** - * sysfs_open_driver: opens and initializes driver structure + * sysfs_open_driver_path: opens and initializes driver structure * @path: path to driver directory * returns struct sysfs_driver with success and NULL with error */ -struct sysfs_driver *sysfs_open_driver(const unsigned char *path) +struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path) { struct sysfs_driver *driver = NULL; @@ -185,13 +162,10 @@ struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, } attrlist = sysfs_get_driver_attributes(drv); - if (attrlist != NULL) { + if (attrlist != NULL) cur = sysfs_get_directory_attribute(drv->directory, (unsigned char *)name); - if (cur != NULL) - return cur; - } - return NULL; + return cur; } /** @@ -209,7 +183,7 @@ struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver) if (driver->directory == NULL) { if ((open_driver_dir(driver)) == 1) return NULL; - if ((read_driver_dir(driver)) != 0) + if ((sysfs_read_dir_links(driver->directory)) != 0) return NULL; } return(driver->directory->links); @@ -236,13 +210,13 @@ struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver) if (driver->directory == NULL) { if ((open_driver_dir(driver)) == 1) return NULL; - if ((read_driver_dir(driver)) != 0) + if ((sysfs_read_dir_links(driver->directory)) != 0) return NULL; } if (driver->directory->links != NULL) { dlist_for_each_data(driver->directory->links, curlink, struct sysfs_link) { - device = sysfs_open_device(curlink->target); + device = sysfs_open_device_path(curlink->target); if (device == NULL) { dprintf("Error opening device at %s\n", curlink->target); @@ -345,7 +319,7 @@ struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, return NULL; } - memset(path, 0, SYSFS_NAME_LEN); + memset(path, 0, SYSFS_PATH_MAX); if ((get_driver_path(bus, drv, path, SYSFS_PATH_MAX)) != 0) { dprintf("Error getting to driver %s\n", drv); return NULL; @@ -367,3 +341,33 @@ struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, return attribute; } +/** + * sysfs_open_driver: open driver by name, given its bus + * @drv_name: Name of the driver + * @bus_name: Name of the bus + * Returns the sysfs_driver reference on success and NULL on failure + */ +struct sysfs_driver *sysfs_open_driver(const unsigned char *drv_name, + const unsigned char *bus_name) +{ + unsigned char path[SYSFS_PATH_MAX]; + struct sysfs_driver *driver = NULL; + + if (drv_name == NULL || bus_name == NULL) { + errno = EINVAL; + return NULL; + } + + memset(path, 0, SYSFS_PATH_MAX); + if ((get_driver_path(bus_name, drv_name, path, SYSFS_PATH_MAX)) != 0) { + dprintf("Error getting to driver %s\n", drv_name); + return NULL; + } + driver = sysfs_open_driver_path(path); + if (driver == NULL) { + dprintf("Error opening driver at %s\n", path); + return NULL; + } + return driver; +} + diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index c2ce13433d..009ae94efa 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -1,5 +1,5 @@ /* - * syfs_utils.c + * sysfs_utils.c * * System utility functions for libsysfs * @@ -135,17 +135,21 @@ int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, } memset(tmp, 0, SYSFS_PATH_MAX); strcpy(tmp, path); - n = &tmp[strlen(tmp)-1]; - if (strncmp(n, "/", 1) == 0) - *n = '\0'; n = strrchr(tmp, '/'); if (n == NULL) { errno = EINVAL; return -1; } + if (*(n+1) == '\0') { + *n = '\0'; + n = strrchr(tmp, '/'); + if (n == NULL) { + errno = EINVAL; + return -1; + } + } n++; strncpy(name, n, len); - return 0; } @@ -233,7 +237,6 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) unsigned char *c = NULL; struct sysfs_directory *dir = NULL, *cur = NULL; struct dlist *list = NULL; - struct stat astats; if (name == NULL) return NULL; @@ -242,7 +245,6 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) dprintf("Error getting sysfs mount point\n"); return NULL; } - if (sysfs_trailing_slash(sysfs_path) == 0) strcat(sysfs_path, "/"); strcat(sysfs_path, name); @@ -252,7 +254,7 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) return NULL; } - if (sysfs_read_directory(dir) != 0) { + if ((sysfs_read_dir_subdirs(dir)) != 0) { dprintf("Error reading sysfs_directory at %s\n", sysfs_path); sysfs_close_directory(dir); return NULL; @@ -285,11 +287,7 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) if (c == NULL) goto out; strcpy(c, SYSFS_BLOCK_NAME); - if ((lstat(sysfs_path, &astats)) != 0) { - dprintf("stat() failed\n"); - goto out; - } - if (S_ISDIR(astats.st_mode)) { + if ((sysfs_path_is_dir(sysfs_path)) == 0) { subsys_name = (char *)calloc(1, SYSFS_NAME_LEN); strcpy(subsys_name, SYSFS_BLOCK_NAME); dlist_unshift(list, subsys_name); @@ -333,7 +331,7 @@ struct dlist *sysfs_open_bus_devices_list(unsigned char *name) return NULL; } - if (sysfs_read_directory(dir) != 0) { + if ((sysfs_read_dir_links(dir)) != 0) { dprintf("Error reading sysfs_directory at %s\n", sysfs_path); sysfs_close_directory(dir); return NULL; diff --git a/udev-add.c b/udev-add.c index 33ee633fd8..ba5c864165 100644 --- a/udev-add.c +++ b/udev-add.c @@ -242,9 +242,9 @@ static struct sysfs_class_device *get_class_dev(char *device_name) dbg("looking at '%s'", dev_path); /* open up the sysfs class device for this thing... */ - class_dev = sysfs_open_class_device(dev_path); + class_dev = sysfs_open_class_device_path(dev_path); if (class_dev == NULL) { - dbg ("sysfs_open_class_device failed"); + dbg ("sysfs_open_class_device_path failed"); goto exit; } dbg("class_dev->name='%s'", class_dev->name); -- cgit v1.2.3-54-g00ecf From dac056aa301def4d45ae63636b4b9c286bac8fa1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 20 Dec 2003 01:05:13 -0800 Subject: [PATCH] try to wait until the proper device file shows up in sysfs. this still isn't working correctly for partitions, so don't think this is the final version... --- namedev.c | 159 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 147 insertions(+), 12 deletions(-) diff --git a/namedev.c b/namedev.c index 58986e25c2..30c276ae1c 100644 --- a/namedev.c +++ b/namedev.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "list.h" #include "udev.h" @@ -284,6 +285,55 @@ static void apply_format(struct udevice *udev, unsigned char *string) } } +static struct bus_file { + char *bus; + char *file; +} bus_files[] = { + { .bus = "scsi", .file = "vendor" }, + { .bus = "usb", .file = "idVendor" }, + {} +}; + +#define SECONDS_TO_WAIT_FOR_FILE 10 +static void wait_for_device_to_initialize(struct sysfs_device *sysfs_device) +{ + /* sleep until we see the file for this specific bus type show up this + * is needed because we can easily out-run the kernel in looking for + * these files before the paticular subsystem has created them in the + * sysfs tree properly. + * + * And people thought that the /sbin/hotplug event system was going to + * be slow, poo on you for arguing that before even testing it... + */ + struct bus_file *b = &bus_files[0]; + struct sysfs_attribute *tmpattr; + int loop; + + while (1) { + if (b->bus == NULL) + break; + if (strcmp(sysfs_device->bus, b->bus) == 0) { + tmpattr = NULL; + loop = SECONDS_TO_WAIT_FOR_FILE; + while (loop--) { + dbg("looking for file '%s' on bus '%s'", b->file, b->bus); + tmpattr = sysfs_get_device_attr(sysfs_device, b->file); + if (tmpattr) { + /* found it! */ + goto exit; + } + /* sleep to give the kernel a chance to create the file */ + sleep(1); + } + dbg("Timed out waiting for '%s' file, continuing on anyway...", b->file); + goto exit; + } + b++; + } + dbg("Did not find bus type '%s' on list of bus_id_files, contact greg@kroah.com", sysfs_device->bus); +exit: + return; /* here to prevent compiler warning... */ +} static int exec_callout(struct config_device *dev, char *value, int len) { @@ -580,19 +630,84 @@ static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice * strfieldcpy(udev->name, class_dev->name); } -int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) +static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_dev) { - struct sysfs_device *sysfs_device = NULL; - struct sysfs_class_device *class_dev_parent = NULL; - int retval = 0; - struct perm_device *perm; + struct sysfs_device *sysfs_device; + struct sysfs_class_device *class_dev_parent; + int loop; + int retval; + char filename[SYSFS_PATH_MAX + 6]; + + /* FIXME!!! */ + /* This is needed here as we can easily out-race the placement of the + * device symlink by the kernel. The call to sleep(1); will be removed + * once libsysfs can be queried for sysfs_get_classdev_device() + * multiple times and have it return the proper information when the + * class device really shows up. For now, we live with the time + * delay... + */ +// sleep(1); + loop = 10; + while (loop--) { + struct stat buf; + + strcpy(filename, class_dev->path); + strcat(filename, "/device"); + dbg("looking for '%s'", filename); + retval = stat(filename, &buf); + if (!retval) + break; +#if 0 + /* bah, let's go backwards up a level to see if the device is there, + * as block partitions don't point to the physical device. Need to fix that + * up in the kernel... + */ + if (strcmp(class_dev->classname, SYSFS_BLOCK_NAME) == 0) { + if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { + char *temp = strrchr(filename, '/'); + if (temp) { + *temp = 0x00; + temp = strrchr(filename, '/'); + if (temp) { + *temp = 0x00; + strcat(filename, "/device"); + dbg("looking for '%s'", filename); + retval = stat(filename, &buf); + if (!retval) + break; + } + } + } + } +#endif +// class_dev_parent = sysfs_get_classdev_parent(class_dev); +// if (class_dev_parent == NULL) { +// dbg("sysfs_get_classdev_parent for class device '%s' failed", class_dev->name); +// } else { +// strcpy(filename, class_dev_parent->path); +// strcat(filename, "/device"); +// dbg("looking for '%s'", filename); +// retval = stat(filename, &buf); +// if (!retval) +// break; +// } +// } +// } + /* sleep to give the kernel a chance to create the device file */ + sleep(1); + } +// retval = -ENODEV; - udev->mode = 0; +// sleep(1); + + loop = 1; /* FIXME put a real value in here for when everything is fixed... */ + while (loop--) { + /* find the sysfs_device for this class device */ + /* Wouldn't it really be nice if libsysfs could do this for us? */ + sysfs_device = sysfs_get_classdev_device(class_dev); + if (sysfs_device != NULL) + goto exit; - /* find the sysfs_device for this class device */ - /* Wouldn't it really be nice if libsysfs could do this for us? */ - sysfs_device = sysfs_get_classdev_device(class_dev); - if (sysfs_device == NULL) { /* bah, let's go backwards up a level to see if the device is there, * as block partitions don't point to the physical device. Need to fix that * up in the kernel... @@ -601,23 +716,43 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud dbg("looking at block device"); if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { dbg("really is a partition"); - class_dev_parent = sysfs_get_classdev_parent - (class_dev); + class_dev_parent = sysfs_get_classdev_parent(class_dev); if (class_dev_parent == NULL) { dbg("sysfs_get_classdev_parent for class device '%s' failed", class_dev->name); } else { dbg("class_dev_parent->name='%s'", class_dev_parent->name); sysfs_device = sysfs_get_classdev_device(class_dev_parent); + if (sysfs_device != NULL) + goto exit; } } } + /* sleep to give the kernel a chance to create the link */ + /* sleep(1); */ + } +// dbg("Timed out waiting for device symlink, continuing on anyway..."); +exit: + return sysfs_device; +} + +int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) +{ + struct sysfs_device *sysfs_device = NULL; + struct sysfs_class_device *class_dev_parent = NULL; + int retval = 0; + struct perm_device *perm; + + udev->mode = 0; + /* find the sysfs_device associated with this class device */ + sysfs_device = get_sysfs_device(class_dev); if (sysfs_device) { dbg("sysfs_device->path='%s'", sysfs_device->path); dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); dbg("sysfs_device->bus='%s'", sysfs_device->bus); strfieldcpy(udev->bus_id, sysfs_device->bus_id); + wait_for_device_to_initialize(sysfs_device); } else { dbg("class_dev->name = '%s'", class_dev->name); } -- cgit v1.2.3-54-g00ecf From 1edbb8d350c3e751d7b9b146eb3873895157791f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 22 Dec 2003 19:07:08 -0800 Subject: [PATCH] Just live with a sleep(1) in namedev for now until libsysfs is fixed up. --- namedev.c | 58 ++++++++++++++++++++++------------------------------------ 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/namedev.c b/namedev.c index 30c276ae1c..05553e69a4 100644 --- a/namedev.c +++ b/namedev.c @@ -635,8 +635,6 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de struct sysfs_device *sysfs_device; struct sysfs_class_device *class_dev_parent; int loop; - int retval; - char filename[SYSFS_PATH_MAX + 6]; /* FIXME!!! */ /* This is needed here as we can easily out-race the placement of the @@ -646,10 +644,17 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de * class device really shows up. For now, we live with the time * delay... */ -// sleep(1); + sleep(1); + +#if 0 /* FIXME + Something like this could also work, but for some reason doesn't, + I also tried just stat() on the device symlink, but that still + has nasty races, I'm probably doing something stupid... :( */ loop = 10; while (loop--) { struct stat buf; + int retval; + char filename[SYSFS_PATH_MAX + 6]; strcpy(filename, class_dev->path); strcat(filename, "/device"); @@ -657,49 +662,30 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de retval = stat(filename, &buf); if (!retval) break; -#if 0 + /* bah, let's go backwards up a level to see if the device is there, * as block partitions don't point to the physical device. Need to fix that * up in the kernel... */ if (strcmp(class_dev->classname, SYSFS_BLOCK_NAME) == 0) { if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { - char *temp = strrchr(filename, '/'); - if (temp) { - *temp = 0x00; - temp = strrchr(filename, '/'); - if (temp) { - *temp = 0x00; - strcat(filename, "/device"); - dbg("looking for '%s'", filename); - retval = stat(filename, &buf); - if (!retval) - break; - } + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent == NULL) { + dbg("sysfs_get_classdev_parent for class device '%s' failed", class_dev->name); + } else { + strcpy(filename, class_dev_parent->path); + strcat(filename, "/device"); + dbg("looking for '%s'", filename); + retval = stat(filename, &buf); + if (!retval) + break; } } } -#endif -// class_dev_parent = sysfs_get_classdev_parent(class_dev); -// if (class_dev_parent == NULL) { -// dbg("sysfs_get_classdev_parent for class device '%s' failed", class_dev->name); -// } else { -// strcpy(filename, class_dev_parent->path); -// strcat(filename, "/device"); -// dbg("looking for '%s'", filename); -// retval = stat(filename, &buf); -// if (!retval) -// break; -// } -// } -// } /* sleep to give the kernel a chance to create the device file */ sleep(1); } -// retval = -ENODEV; - -// sleep(1); - +#endif loop = 1; /* FIXME put a real value in here for when everything is fixed... */ while (loop--) { /* find the sysfs_device for this class device */ @@ -728,10 +714,10 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de } } /* sleep to give the kernel a chance to create the link */ - /* sleep(1); */ + sleep(1); } -// dbg("Timed out waiting for device symlink, continuing on anyway..."); + dbg("Timed out waiting for device symlink, continuing on anyway..."); exit: return sysfs_device; } -- cgit v1.2.3-54-g00ecf From 8c5d34e50856b9bed938cbd4f5648b62df64a04c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 22 Dec 2003 19:10:27 -0800 Subject: [PATCH] trivial make fixes One patch to let bk ignore the created udev.conf. The second to depend on the .h files. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3e220b47d0..5833d4cb94 100644 --- a/Makefile +++ b/Makefile @@ -214,7 +214,7 @@ udev.conf: $(OBJS): $(GEN_HEADERS) -$(ROOT): $(OBJS) +$(ROOT): $(OBJS) udev.h namedev.h $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) -- cgit v1.2.3-54-g00ecf From 3e54036862061d8b81fca6cdd3d24bc9ceb53bc0 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 22 Dec 2003 19:13:19 -0800 Subject: [PATCH] introduce format char 'k' for kernel-name Attached is a patch that introduces the format char 'k' to be replaced with the kernel name. I like to have it in a callout script. I've moved the build_kernel_name() back to namedev_name_device() since we don't expect it growing cause of 'sdaj' :) --- namedev.c | 27 +++++++++++++++------------ udev.h | 1 + 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/namedev.c b/namedev.c index 05553e69a4..5044870d32 100644 --- a/namedev.c +++ b/namedev.c @@ -186,17 +186,6 @@ static mode_t get_default_mode(struct sysfs_class_device *class_dev) return mode; } -static void build_kernel_number(struct sysfs_class_device *class_dev, struct udevice *udev) -{ - char *dig; - - dig = class_dev->name + strlen(class_dev->name); - while (isdigit(*(dig-1))) - dig--; - strfieldcpy(udev->kernel_number, dig); - dbg("kernel_number='%s'", udev->kernel_number); -} - static void apply_format(struct udevice *udev, unsigned char *string) { char name[NAME_SIZE]; @@ -230,6 +219,12 @@ static void apply_format(struct udevice *udev, unsigned char *string) strcat(pos, udev->bus_id); dbg("substitute bus_id '%s'", udev->bus_id); break; + case 'k': + if (strlen(udev->kernel_name) == 0) + break; + strcat(pos, udev->kernel_name); + dbg("substitute kernel name '%s'", udev->kernel_name); + break; case 'n': if (strlen(udev->kernel_number) == 0) break; @@ -728,6 +723,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud struct sysfs_class_device *class_dev_parent = NULL; int retval = 0; struct perm_device *perm; + char *pos; udev->mode = 0; @@ -743,7 +739,14 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud dbg("class_dev->name = '%s'", class_dev->name); } - build_kernel_number(class_dev, udev); + strfieldcpy(udev->kernel_name, class_dev->name); + + /* get kernel number */ + pos = class_dev->name + strlen(class_dev->name); + while (isdigit(*(pos-1))) + pos--; + strfieldcpy(udev->kernel_number, pos); + dbg("kernel_number='%s'", udev->kernel_number); /* rules are looked at in priority order */ retval = do_callout(class_dev, udev, sysfs_device); diff --git a/udev.h b/udev.h index 05f6b3c225..656c1b7d8c 100644 --- a/udev.h +++ b/udev.h @@ -70,6 +70,7 @@ struct udevice { unsigned char bus_id[SYSFS_NAME_LEN]; unsigned char callout_value[NAME_SIZE]; unsigned char kernel_number[NAME_SIZE]; + unsigned char kernel_name[NAME_SIZE]; }; -- cgit v1.2.3-54-g00ecf From 958479a0dead606c6e44490a30a7040773654281 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 22 Dec 2003 19:16:19 -0800 Subject: [PATCH] add any valid device --- namedev.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/namedev.c b/namedev.c index 5044870d32..7c422f7877 100644 --- a/namedev.c +++ b/namedev.c @@ -104,31 +104,10 @@ static int strcmp_pattern(const char *p, const char *s) int add_config_dev(struct config_device *new_dev) { - struct list_head *tmp; struct config_device *tmp_dev; - /* update the values if we already have the device */ - list_for_each(tmp, &config_device_list) { - struct config_device *dev = list_entry(tmp, struct config_device, node); - if (strcmp_pattern(new_dev->name, dev->name)) - continue; - if (strncmp(dev->bus, new_dev->bus, sizeof(dev->name))) - continue; - copy_var(dev, new_dev, type); - copy_string(dev, new_dev, bus); - copy_string(dev, new_dev, sysfs_file); - copy_string(dev, new_dev, sysfs_value); - copy_string(dev, new_dev, id); - copy_string(dev, new_dev, place); - copy_string(dev, new_dev, kernel_name); - copy_string(dev, new_dev, exec_program); - copy_string(dev, new_dev, symlink); - return 0; - } - - /* not found, add new structure to the device list */ tmp_dev = malloc(sizeof(*tmp_dev)); - if (!tmp_dev) + if (tmp_dev == NULL) return -ENOMEM; memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); list_add_tail(&tmp_dev->node, &config_device_list); -- cgit v1.2.3-54-g00ecf From 4af58c70571c5c63edaff20d2032c8eeb59678b6 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 22 Dec 2003 20:34:53 -0800 Subject: [PATCH] experimental CALLOUT script for devfs ide node creation with cd, disc, part Here is a experimental CALLOUT script for udev to create devfs nodes for IDE-devices. Not that I need these, I just wanted to see if it works :) The script is really stupid, no error handling, nothing more than absolutely needed. The rule uses the 'k' format char of the previous patch. The %D is not used, so the user can have disc or disk :) this single line: CALLOUT, BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c" creates the following on my machine with two hard disks, one DVD and a PCMCIA-compact-flash inserted: /udev |-- hda |-- hda1 |-- hda2 |-- hda4 |-- hdb |-- hdb1 |-- hdc |-- hde |-- hde1 `-- ide |-- host0 | |-- bus0 | | |-- target0 | | | `-- lun0 | | | |-- disc -> ../../../../../hda | | | |-- part1 -> ../../../../../hda1 | | | |-- part2 -> ../../../../../hda2 | | | `-- part4 -> ../../../../../hda4 | | `-- target1 | | `-- lun0 | | |-- disc -> ../../../../../hdb | | `-- part1 -> ../../../../../hdb1 | `-- bus1 | `-- target0 | `-- lun0 | `-- cd -> ../../../../../hdc `-- host2 `-- bus0 `-- target0 `-- lun0 |-- disc -> ../../../../../hde `-- part1 -> ../../../../../hde1 --- extras/ide-devfs.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 extras/ide-devfs.sh diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh new file mode 100644 index 0000000000..3409c407eb --- /dev/null +++ b/extras/ide-devfs.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +# udev CALLOUT script +# return devfs-names for ide-devices +# CALLOUT, BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c" + +HOST=${2%\.[0-9]} +TARGET=${2#[0-9]\.} + +if [ -z ${HOST#[13579]} ]; then + HOST=`expr $HOST - 1` + BUS="1" +else + BUS="0" +fi + +if [ -z "$3" ]; then + MEDIA=`cat /proc/ide/$1/media` + if [ "$MEDIA" = "cdrom" ]; then + echo $1 ide/host$HOST/bus$BUS/target$TARGET/lun0/cd + elif [ "$MEDIA" = "disk" ]; then + echo $1 ide/host$HOST/bus$BUS/target$TARGET/lun0/disc + fi +else + echo $1 ide/host$HOST/bus$BUS/target$TARGET/lun0/part$3 +fi + -- cgit v1.2.3-54-g00ecf From 176857119a77aad650412d9fedb568da4b543e07 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Mon, 22 Dec 2003 20:49:22 -0800 Subject: [PATCH] extras multipath update An important one, against stock udev-009 : 2003-12-20 multipath-010 * big ChangeLog update * start to give a little control over target params : introduce cmdline arg -i to control polling interval * cope with hotplug-style calling convention : ie "multipath scsi $DEVPATH" ... to avoid messing with online maps not concerned by an event * example hotplug agent to drop in /etc/hotplug.d/scsi * revert the run & resched patch : unless someone proves me wrong, this was overdesigned * move commented out functions in unused.c * update multipath target params to "udm[23] style" * mp target now supports nr_path == 1, so do we * add gratuitous free() * push version forward --- extras/multipath/ChangeLog | 57 ++++++++++ extras/multipath/main.c | 207 ++++++++++++++----------------------- extras/multipath/main.h | 6 +- extras/multipath/multipath.hotplug | 3 + extras/multipath/unsused.c | 52 ++++++++++ 5 files changed, 194 insertions(+), 131 deletions(-) create mode 100644 extras/multipath/multipath.hotplug create mode 100644 extras/multipath/unsused.c diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index f3014cf01e..f31fbf41dc 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,3 +1,60 @@ +2003-12-20 multipath-010 + * big ChangeLog update + * start to give a little control over target params : + introduce cmdline arg -i to control polling interval + * cope with hotplug-style calling convention : + ie "multipath scsi $DEVPATH" ... to avoid messing with + online maps not concerned by an event + * example hotplug agent to drop in /etc/hotplug.d/scsi + * revert the run & resched patch : unless someone proves me + wrong, this was overdesigned + * move commented out functions in unused.c + * update multipath target params to "udm[23] style" + * mp target now supports nr_path == 1, so do we + * add gratuitous free() + * push version forward +2003-12-15 multipath-009 + * Make the HW-specific get_unique_id switch pretty + * Prepare to field-test by whitelisting all known fibre array, + try to fetch WWID from the standard EVPD 0x83 off 8 for everyone + * configure the multipath target with round-robin path selector and + conservative default for a start (udm1 style) : + yes it makes this release the firstreally useful one. + * temporarily disable map creation for single path device + due to current restrictive defaults in the kernel target. + Sistina should work it out. + * correct the strncmp logic in blacklist function. + * update the Makefiles to autodetect libgcc.a & gcc includes + "ulibc-style". Factorisation of udevdirs & others niceties + * drop a hint about absent /dev/sd? on failed open() + * implement a reschedule flag in /var/run. + Last thing the prog do before exit is check if a call to multipath + was done (but canceled by /var/run/multipath.run check) during its + execution. If so restart themain loop. + * implement a blacklist of sysfs bdev to not bother with for now + (hd,md, dm, sr, scd, ram, raw). + This avoid sending SG_IO to unappropiate devices. + * Adds a /var/run/multipath.run handling to avoid simultaneous runs. + * Remove a commented-out "printf" + * drop a libdevmapper copy in extras/multipath; + maybe discussions w/Sistina folks will bring a better solution in the future. + * drop a putchar usage in libdevmapper to compile cleanly with klibc + * drop another such usage of my own in main.c + * massage the Makefile to compile libdevmapper against klibc + * use "ld" to produce the binary rather than "gcc -static" + * stop being stupid w/ uneeded major, minor & dev in main.c:dm_mk_node() + * reverse to creating striped target for now because the multipath target + is more hairy than expected initialy + * push the version code to 009 to be in synch w/ udev +2003-11-27 multipath-007 + * removes sg_err.[ch] deps + * makes sure the core code play nice with klibc + * port the sysfs calls to dlist helpers + * links against udev's sysfs (need libsysfs.a & dlist.a) + * finally define DM_TARGET as "multipath" as Joe posted the code today (not tested yet) + * push version forward (do you want it in sync with udev version?) +2003-11-19 + * merged in udev-006 tree 2003-09-18 Christophe Varoqui * multipath 0.0.1 released. * Initial release. diff --git a/extras/multipath/main.c b/extras/multipath/main.c index 9402888c58..39b4a9fa93 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -1,5 +1,5 @@ /* - * Soft: Description here... + * Soft: multipath device mapper target autoconfig * * Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $ * @@ -258,38 +258,80 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) struct sysfs_directory * sdir; struct sysfs_directory * devp; struct sysfs_link * linkp; + char refwwid[WWID_SIZE]; + char empty_buff[WWID_SIZE]; char buff[FILE_NAME_SIZE]; + char path[FILE_NAME_SIZE]; + struct path curpath; - char block_path[FILE_NAME_SIZE]; + /* if called from udev, only consider the paths that relate to */ + /* to the device pointed by conf.hotplugdev */ + memset(empty_buff, 0, WWID_SIZE); + memset(refwwid, 0, WWID_SIZE); + if (strncmp("/devices", conf->hotplugdev, 8) == 0) { + sprintf(buff, "%s%s/block", + conf->sysfs_path, conf->hotplugdev); + memset(conf->hotplugdev, 0, FILE_NAME_SIZE); + readlink(buff, conf->hotplugdev, FILE_NAME_SIZE); + basename(conf->hotplugdev, buff); + sprintf(curpath.sg_dev, "/dev/%s", buff); + + if ((sg_fd = open(curpath.sg_dev, O_RDONLY)) < 0) + exit(1); + + get_lun_strings(sg_fd, &curpath); + get_unique_id(sg_fd, &curpath); + strcpy(refwwid, curpath.wwid); + memset(&curpath, 0, sizeof(path)); + } - sprintf(block_path, "%s/block", conf->sysfs_path); - sdir = sysfs_open_directory(block_path); + sprintf(path, "%s/block", conf->sysfs_path); + sdir = sysfs_open_directory(path); sysfs_read_directory(sdir); + dlist_for_each_data(sdir->subdirs, devp, struct sysfs_directory) { if (blacklist(devp->name)) continue; + sysfs_read_directory(devp); + if(devp->links == NULL) continue; + dlist_for_each_data(devp->links, linkp, struct sysfs_link) { if (!strncmp(linkp->name, "device", 6)) break; } + if (linkp == NULL) { continue; } basename(devp->path, buff); - sprintf(all_paths[k].sg_dev, "/dev/%s", buff); - strcpy(all_paths[k].dev, all_paths[k].sg_dev); - if ((sg_fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) { + sprintf(curpath.sg_dev, "/dev/%s", buff); + + if ((sg_fd = open(curpath.sg_dev, O_RDONLY)) < 0) { if (conf->verbose) - fprintf(stderr, "can't open %s. mknod ?", - all_paths[k].sg_dev); + fprintf(stderr, "can't open %s\n", + curpath.sg_dev); continue; } - get_lun_strings(sg_fd, &all_paths[k]); - get_unique_id(sg_fd, &all_paths[k]); + + get_lun_strings(sg_fd, &curpath); + get_unique_id(sg_fd, &curpath); + + if (memcmp(empty_buff, refwwid, WWID_SIZE) != 0 && + strncmp(curpath.wwid, refwwid, WWID_SIZE) != 0) { + memset(&curpath, 0, sizeof(path)); + continue; + } + + strcpy(all_paths[k].sg_dev, curpath.sg_dev); + strcpy(all_paths[k].dev, curpath.sg_dev); + strcpy(all_paths[k].wwid, curpath.wwid); + strcpy(all_paths[k].vendor_id, curpath.vendor_id); + strcpy(all_paths[k].product_id, curpath.product_id); + memset(&curpath, 0, sizeof(path)); all_paths[k].state = do_tur(sg_fd); close(sg_fd); basename(linkp->target, buff); @@ -301,7 +343,6 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) k++; } sysfs_close_directory(sdir); - return 0; } @@ -562,26 +603,6 @@ make_dm_node(char * str) } -/* future use ? -static int -del_map(char * str) { - struct dm_task *dmt; - - if (!(dmt = dm_task_create(DM_DEVICE_REMOVE))) - return 0; - if (!dm_task_set_name(dmt, str)) - goto delout; - if (!dm_task_run(dmt)) - goto delout; - - printf("Deleted device map : %s\n", str); - - delout: - dm_task_destroy(dmt); - return 1; -} -*/ - static int add_map(struct env * conf, struct path * all_paths, struct multipath * mp, int index, int op) @@ -593,15 +614,9 @@ add_map(struct env * conf, struct path * all_paths, long size = -1; /* defaults for multipath target */ - int dm_nr_path_args = 2; - int dm_path_test_int = 10; + int dm_pg_prio = 1; char * dm_ps_name = "round-robin"; - int dm_ps_nr_args = 2; - int dm_path_failback_int = 10; - int dm_path_nr_fail = 2; - int dm_ps_prio = 1; - int dm_ps_min_io = 2; - + int dm_ps_nr_args = 0; if (!(dmt = dm_task_create(op))) return 0; @@ -618,14 +633,13 @@ add_map(struct env * conf, struct path * all_paths, } if (np == 0) goto addout; - /* temporarily disable creation of single path maps */ - /* Sistina should modify the target limits */ - if (np < 2) + + if (np < 1) goto addout; - params_p += sprintf(params_p, "%i %i %i %s %i", - np, dm_nr_path_args, dm_path_test_int, - dm_ps_name, dm_ps_nr_args); + params_p += sprintf(params_p, "%i %i %s %i %i", + conf->dm_path_test_int, dm_pg_prio, + dm_ps_name, np, dm_ps_nr_args); for (i=0; i<=mp[index].npaths; i++) { if (( 0 == all_paths[PINDEX(index,i)].state) || @@ -633,10 +647,8 @@ add_map(struct env * conf, struct path * all_paths, continue; if (size < 0) size = get_disk_size(conf, all_paths[PINDEX(index,0)].dev); - params_p += sprintf(params_p, " %s %i %i %i %i", - all_paths[PINDEX(index,i)].dev, - dm_path_failback_int, dm_path_nr_fail, - dm_ps_prio, dm_ps_min_io); + params_p += sprintf(params_p, " %s", + all_paths[PINDEX(index,i)].dev); } if (size < 0) @@ -665,44 +677,6 @@ add_map(struct env * conf, struct path * all_paths, return 1; } -/* -static int -get_table(const char * str) -{ - int r = 0; - struct dm_task *dmt; - void *next = NULL; - uint64_t start, length; - char *target_type = NULL; - char *params; - - if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) - return 0; - - if (!dm_task_set_name(dmt, str)) - goto out; - - if (!dm_task_run(dmt)) - goto out; - - do { - next = dm_get_next_target(dmt, next, &start, &length, - &target_type, ¶ms); - if (target_type) { - printf("%" PRIu64 " %" PRIu64 " %s %s\n", - start, length, target_type, params); - } - } while (next); - - r = 1; - - out: - dm_task_destroy(dmt); - return r; - -} -*/ - static int map_present(char * str) { @@ -740,28 +714,18 @@ static void usage(char * progname) { fprintf(stderr, VERSION_STRING); - fprintf(stderr, "Usage: %s [-v|-q] [-d] [-m max_devs]\n", progname); - fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n"); - fprintf(stderr, "\t-q\t\tquiet, no output at all\n"); + fprintf(stderr, "Usage: %s [-v|-q] [-d] [-i int] [-m max_devs]\n", progname); fprintf(stderr, "\t-d\t\tdry run, do not create or update devmaps\n"); + fprintf(stderr, "\t-i\t\tmultipath target param : polling interval\n"); fprintf(stderr, "\t-m max_devs\tscan {max_devs} devices at most\n"); + fprintf(stderr, "\t-q\t\tquiet, no output at all\n"); + fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n"); exit(1); } -static int -filepresent(char * run) { - struct stat buf; - - if(!stat(run, &buf)) - return 1; - return 0; -} - int main(int argc, char *argv[]) { - char * run = "/var/run/multipath.run"; - char * resched = "/var/run/multipath.reschedule"; struct multipath * mp; struct path * all_paths; struct scsi_dev * all_scsi_ids; @@ -774,6 +738,7 @@ main(int argc, char *argv[]) conf.verbose = 0; /* 1 == Print all_paths and mp */ conf.quiet = 0; /* 1 == Do not even print devmaps */ conf.with_sysfs = 0; /* Default to compat / suboptimal behaviour */ + conf.dm_path_test_int = 10; /* kindly provided by libsysfs */ if (0 == sysfs_get_mnt_path(conf.sysfs_path, FILE_NAME_SIZE)) @@ -794,6 +759,10 @@ main(int argc, char *argv[]) conf.quiet = 1; } else if (0 == strcmp("-d", argv[i])) conf.dry_run = 1; + else if (0 == strcmp("-i", argv[i])) + conf.dm_path_test_int = atoi(argv[++i]); + else if (0 == strcmp("scsi", argv[i])) + strcpy(conf.hotplugdev, argv[++i]); else if (*argv[i] == '-') { fprintf(stderr, "Unknown switch: %s\n", argv[i]); usage(argv[0]); @@ -804,27 +773,11 @@ main(int argc, char *argv[]) } - if (filepresent(run)) { - if (conf.verbose) { - fprintf(stderr, "Already running.\n"); - fprintf(stderr, "If you know what you do, please "); - fprintf(stderr, "remove %s\n", run); - } - /* leave a trace that we were called while already running */ - open(resched, O_CREAT); - return 1; - } - /* dynamic allocations */ mp = malloc(conf.max_devs * sizeof(struct multipath)); all_paths = malloc(conf.max_devs * sizeof(struct path)); all_scsi_ids = malloc(conf.max_devs * sizeof(struct scsi_dev)); - if (mp == NULL || all_paths == NULL || all_scsi_ids == NULL) { - unlink(run); - exit(1); - } -start: - if(!open(run, O_CREAT)) + if (mp == NULL || all_paths == NULL || all_scsi_ids == NULL) exit(1); if (!conf.with_sysfs) { @@ -842,10 +795,8 @@ start: fprintf(stdout, "\n"); } - if (conf.dry_run) { - unlink(run); + if (conf.dry_run) exit(0); - } for (k=0; k<=nmp; k++) { if (map_present(mp[k].wwid)) { @@ -854,13 +805,11 @@ start: add_map(&conf, all_paths, mp, k, DM_DEVICE_CREATE); } } - unlink(run); - /* start again if we were ask to during this process run */ - /* ie. do not loose an event-asked run */ - if (filepresent(resched)) { - unlink(resched); - goto start; - } + /* free allocs */ + free(mp); + free(all_paths); + free(all_scsi_ids); + exit(0); } diff --git a/extras/multipath/main.h b/extras/multipath/main.h index d6dfb14296..0c5620ff74 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -99,14 +99,16 @@ struct env { int quiet; int dry_run; int with_sysfs; + int dm_path_test_int; char sysfs_path[FILE_NAME_SIZE]; + char hotplugdev[FILE_NAME_SIZE]; }; /* Build version */ #define PROG "multipath" -#define VERSION_CODE 0x000009 -#define DATE_CODE 0x0C0503 +#define VERSION_CODE 0x000010 +#define DATE_CODE 0x0C1503 #define MULTIPATH_VERSION(version) \ (version >> 16) & 0xFF, \ diff --git a/extras/multipath/multipath.hotplug b/extras/multipath/multipath.hotplug new file mode 100644 index 0000000000..db7894cb99 --- /dev/null +++ b/extras/multipath/multipath.hotplug @@ -0,0 +1,3 @@ +. /etc/hotplug/hotplug.functions +sleep 1 +mesg `/root/multipath scsi $DEVPATH` diff --git a/extras/multipath/unsused.c b/extras/multipath/unsused.c new file mode 100644 index 0000000000..ecdd695ac8 --- /dev/null +++ b/extras/multipath/unsused.c @@ -0,0 +1,52 @@ +static int +del_map(char * str) { + struct dm_task *dmt; + + if (!(dmt = dm_task_create(DM_DEVICE_REMOVE))) + return 0; + if (!dm_task_set_name(dmt, str)) + goto delout; + if (!dm_task_run(dmt)) + goto delout; + + printf("Deleted device map : %s\n", str); + + delout: + dm_task_destroy(dmt); + return 1; +} + +get_table(const char * str) +{ + int r = 0; + struct dm_task *dmt; + void *next = NULL; + uint64_t start, length; + char *target_type = NULL; + char *params; + + if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) + return 0; + + if (!dm_task_set_name(dmt, str)) + goto out; + + if (!dm_task_run(dmt)) + goto out; + + do { + next = dm_get_next_target(dmt, next, &start, &length, + &target_type, ¶ms); + if (target_type) { + printf("%" PRIu64 " %" PRIu64 " %s %s\n", + start, length, target_type, params); + } + } while (next); + + r = 1; + + out: + dm_task_destroy(dmt); + return r; + +} -- cgit v1.2.3-54-g00ecf From 4081da7fe560f0ad173a9836589d6839d9dff9df Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Mon, 22 Dec 2003 20:49:48 -0800 Subject: [PATCH] extras multipath update incremental to 20031220, 2003-12-22 multipath-010 * don't print .sg_dev if equal to .dev (2.6) in print_path() * since the kernel code handles defective paths, remove all code to cope with them : * move do_tur() to unused.c * remove .state from path struct * remove .state settings & conditionals * add a cmdline switch to force maps to failover mode, ie 1 path per priority group * add default policies to the whitelist array (spread io == MULTIBUS / io forced to 1 path == FAILOVER) * move get_disk_size() call out of add_map() to coalesce() * comment tricky coalesce() fn * bogus unsused.c file renamed to unused.c --- extras/multipath/ChangeLog | 14 ++++ extras/multipath/main.c | 204 +++++++++++++++++++++++---------------------- extras/multipath/main.h | 8 +- extras/multipath/unsused.c | 52 ------------ extras/multipath/unused.c | 78 +++++++++++++++++ 5 files changed, 202 insertions(+), 154 deletions(-) delete mode 100644 extras/multipath/unsused.c create mode 100644 extras/multipath/unused.c diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index f31fbf41dc..dc29400e0e 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,3 +1,17 @@ +2003-12-22 multipath-010 + * don't print .sg_dev if equal to .dev (2.6) in print_path() + * since the kernel code handles defective paths, remove all + code to cope with them : + * move do_tur() to unused.c + * remove .state from path struct + * remove .state settings & conditionals + * add a cmdline switch to force maps to failover mode, + ie 1 path per priority group + * add default policies to the whitelist array (spread io == + MULTIBUS / io forced to 1 path == FAILOVER) + * move get_disk_size() call out of add_map() to coalesce() + * comment tricky coalesce() fn + * bogus unsused.c file renamed to unused.c 2003-12-20 multipath-010 * big ChangeLog update * start to give a little control over target params : diff --git a/extras/multipath/main.c b/extras/multipath/main.c index 39b4a9fa93..c57cd4fe7e 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -82,32 +82,6 @@ do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, return -1; } -static int -do_tur(int fd) -{ - unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; - struct sg_io_hdr io_hdr; - unsigned char sense_buffer[32]; - - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof (turCmdBlk); - io_hdr.mx_sb_len = sizeof (sense_buffer); - io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; - io_hdr.sbp = sense_buffer; - io_hdr.timeout = 20000; - io_hdr.pack_id = 0; - if (ioctl(fd, SG_IO, &io_hdr) < 0) { - close(fd); - return 0; - } - if (io_hdr.info & SG_INFO_OK_MASK) { - return 0; - } - return 1; -} - static void sprint_wwid(char * buff, const char * str) { @@ -183,32 +157,34 @@ get_unique_id(int fd, struct path * mypath) static struct { char * vendor; char * product; + int iopolicy; int (*getuid) (int fd, char * wwid); } wlist[] = { - {"COMPAQ ", "HSV110 (C)COMPAQ", &get_evpd_wwid}, - {"COMPAQ ", "MSA1000 ", &get_evpd_wwid}, - {"COMPAQ ", "MSA1000 VOLUME ", &get_evpd_wwid}, - {"DEC ", "HSG80 ", &get_evpd_wwid}, - {"HP ", "HSV100 ", &get_evpd_wwid}, - {"HP ", "A6189A ", &get_evpd_wwid}, - {"HP ", "OPEN- ", &get_evpd_wwid}, - {"DDN ", "SAN DataDirector", &get_evpd_wwid}, - {"FSC ", "CentricStor ", &get_evpd_wwid}, - {"HITACHI ", "DF400 ", &get_evpd_wwid}, - {"HITACHI ", "DF500 ", &get_evpd_wwid}, - {"HITACHI ", "DF600 ", &get_evpd_wwid}, - {"IBM ", "ProFibre 4000R ", &get_evpd_wwid}, - {"SGI ", "TP9100 ", &get_evpd_wwid}, - {"SGI ", "TP9300 ", &get_evpd_wwid}, - {"SGI ", "TP9400 ", &get_evpd_wwid}, - {"SGI ", "TP9500 ", &get_evpd_wwid}, - {NULL, NULL, NULL}, + {"COMPAQ ", "HSV110 (C)COMPAQ", MULTIBUS, &get_evpd_wwid}, + {"COMPAQ ", "MSA1000 ", MULTIBUS, &get_evpd_wwid}, + {"COMPAQ ", "MSA1000 VOLUME ", MULTIBUS, &get_evpd_wwid}, + {"DEC ", "HSG80 ", MULTIBUS, &get_evpd_wwid}, + {"HP ", "HSV100 ", MULTIBUS, &get_evpd_wwid}, + {"HP ", "A6189A ", MULTIBUS, &get_evpd_wwid}, + {"HP ", "OPEN- ", MULTIBUS, &get_evpd_wwid}, + {"DDN ", "SAN DataDirector", MULTIBUS, &get_evpd_wwid}, + {"FSC ", "CentricStor ", MULTIBUS, &get_evpd_wwid}, + {"HITACHI ", "DF400 ", MULTIBUS, &get_evpd_wwid}, + {"HITACHI ", "DF500 ", MULTIBUS, &get_evpd_wwid}, + {"HITACHI ", "DF600 ", MULTIBUS, &get_evpd_wwid}, + {"IBM ", "ProFibre 4000R ", MULTIBUS, &get_evpd_wwid}, + {"SGI ", "TP9100 ", MULTIBUS, &get_evpd_wwid}, + {"SGI ", "TP9300 ", MULTIBUS, &get_evpd_wwid}, + {"SGI ", "TP9400 ", MULTIBUS, &get_evpd_wwid}, + {"SGI ", "TP9500 ", MULTIBUS, &get_evpd_wwid}, + {NULL, NULL, 0, NULL}, }; for (i = 0; wlist[i].vendor; i++) { if (strncmp(mypath->vendor_id, wlist[i].vendor, 8) == 0 && strncmp(mypath->product_id, wlist[i].product, 16) == 0) { wlist[i].getuid(fd, mypath->wwid); + mypath->iopolicy = wlist[i].iopolicy; return 0; } } @@ -264,7 +240,7 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) char path[FILE_NAME_SIZE]; struct path curpath; - /* if called from udev, only consider the paths that relate to */ + /* if called from hotplug, only consider the paths that relate to */ /* to the device pointed by conf.hotplugdev */ memset(empty_buff, 0, WWID_SIZE); memset(refwwid, 0, WWID_SIZE); @@ -331,8 +307,11 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) strcpy(all_paths[k].wwid, curpath.wwid); strcpy(all_paths[k].vendor_id, curpath.vendor_id); strcpy(all_paths[k].product_id, curpath.product_id); + all_paths[k].iopolicy = curpath.iopolicy; + + /* done with curpath, zero for reuse */ memset(&curpath, 0, sizeof(path)); - all_paths[k].state = do_tur(sg_fd); + close(sg_fd); basename(linkp->target, buff); sscanf(buff, "%i:%i:%i:%i", @@ -367,7 +346,6 @@ get_all_paths_nosysfs(struct env * conf, struct path * all_paths, } get_lun_strings(sg_fd, &all_paths[k]); get_unique_id(sg_fd, &all_paths[k]); - all_paths[k].state = do_tur(sg_fd); if (0 > ioctl(sg_fd, SG_GET_SCSI_ID, &(all_paths[k].sg_id))) printf("device %s failed on sg ioctl, skip\n", file_name); @@ -406,7 +384,8 @@ get_all_scsi_ids(struct env * conf, struct scsi_dev * all_scsi_ids) buff[0] = 'a' + (char) k; buff[1] = '\0'; strcat(fname, buff); - } else if (k <= 255) { /* assumes sequence goes x,y,z,aa,ab,ac etc */ + } else if (k <= 255) { + /* assumes sequence goes x,y,z,aa,ab,ac etc */ big = k / 26; little = k - (26 * big); big = big - 1; @@ -463,8 +442,8 @@ print_path(struct path * all_paths, int k, int style) all_paths[k].sg_id.host_no, all_paths[k].sg_id.channel, all_paths[k].sg_id.scsi_id, all_paths[k].sg_id.lun); - printf("%s ", all_paths[k].sg_dev); - printf("op:%i ", all_paths[k].state); + if(0 != strcmp(all_paths[k].sg_dev, all_paths[k].dev)) + printf("%s ", all_paths[k].sg_dev); printf("%s ", all_paths[k].dev); printf("[%.16s]\n", all_paths[k].product_id); } @@ -495,6 +474,32 @@ print_all_mp(struct path * all_paths, struct multipath * mp, int nmp) } } +static long +get_disk_size (struct env * conf, char * dev) { + long size; + int fd; + char attr_path[FILE_NAME_SIZE]; + char buff[FILE_NAME_SIZE]; + char basedev[FILE_NAME_SIZE]; + + if(conf->with_sysfs) { + basename(dev, basedev); + sprintf(attr_path, "%s/block/%s/size", + conf->sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, buff, + FILE_NAME_SIZE * sizeof(char))) + return -1; + size = atoi(buff); + return size; + } else { + if ((fd = open(dev, O_RDONLY)) < 0) + return -1; + if(!ioctl(fd, BLKGETSIZE, &size)) + return size; + } + return -1; +} + static int coalesce_paths(struct env * conf, struct multipath * mp, struct path * all_paths) @@ -507,25 +512,31 @@ coalesce_paths(struct env * conf, struct multipath * mp, memset(empty_buff, 0, WWID_SIZE); for (k = 0; k < conf->max_devs - 1; k++) { - /* skip this path if no unique id has been found */ + /* skip this path for some reason */ + + /* 1. if path has no unique id */ if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) continue; - np = 0; + /* 2. mp with this uid already instanciated */ for (i = 0; i <= nmp; i++) { if (0 == strcmp(mp[i].wwid, all_paths[k].wwid)) already_done = 1; } - if (already_done) { already_done = 0; continue; } + /* at this point, we know we really got a new mp */ + np = 0; nmp++; strcpy(mp[nmp].wwid, all_paths[k].wwid); PINDEX(nmp,np) = k; + if (mp[nmp].size == 0) + mp[nmp].size = get_disk_size(conf, all_paths[k].dev); + for (i = k + 1; i < conf->max_devs; i++) { if (0 == strcmp(all_paths[k].wwid, all_paths[i].wwid)) { np++; @@ -537,32 +548,6 @@ coalesce_paths(struct env * conf, struct multipath * mp, return nmp; } -static long -get_disk_size (struct env * conf, char * dev) { - long size; - int fd; - char attr_path[FILE_NAME_SIZE]; - char buff[FILE_NAME_SIZE]; - char basedev[FILE_NAME_SIZE]; - - if(conf->with_sysfs) { - basename(dev, basedev); - sprintf(attr_path, "%s/block/%s/size", - conf->sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, buff, - FILE_NAME_SIZE * sizeof(char))) - return -1; - size = atoi(buff); - return size; - } else { - if ((fd = open(dev, O_RDONLY)) < 0) - return -1; - if(!ioctl(fd, BLKGETSIZE, &size)) - return size; - } - return -1; -} - static int make_dm_node(char * str) { @@ -611,7 +596,6 @@ add_map(struct env * conf, struct path * all_paths, char * params_p; struct dm_task *dmt; int i, np; - long size = -1; /* defaults for multipath target */ int dm_pg_prio = 1; @@ -627,8 +611,7 @@ add_map(struct env * conf, struct path * all_paths, np = 0; for (i=0; i<=mp[index].npaths; i++) { - if ((1 == all_paths[PINDEX(index,i)].state) && - (0 == all_paths[PINDEX(index,i)].sg_id.scsi_type)) + if (0 == all_paths[PINDEX(index,i)].sg_id.scsi_type) np++; } if (np == 0) @@ -637,33 +620,48 @@ add_map(struct env * conf, struct path * all_paths, if (np < 1) goto addout; - params_p += sprintf(params_p, "%i %i %s %i %i", - conf->dm_path_test_int, dm_pg_prio, - dm_ps_name, np, dm_ps_nr_args); - - for (i=0; i<=mp[index].npaths; i++) { - if (( 0 == all_paths[PINDEX(index,i)].state) || - (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type)) - continue; - if (size < 0) - size = get_disk_size(conf, all_paths[PINDEX(index,0)].dev); - params_p += sprintf(params_p, " %s", - all_paths[PINDEX(index,i)].dev); + params_p += sprintf(params_p, "%i", conf->dm_path_test_int); + + if (all_paths[PINDEX(index,0)].iopolicy == MULTIBUS && + !conf->forcedfailover ) { + params_p += sprintf(params_p, " %i %s %i %i", + dm_pg_prio, dm_ps_name, np, dm_ps_nr_args); + + for (i=0; i<=mp[index].npaths; i++) { + if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) + continue; + params_p += sprintf(params_p, " %s", + all_paths[PINDEX(index,i)].dev); + } + } + + if (all_paths[PINDEX(index,0)].iopolicy == FAILOVER || + conf->forcedfailover) { + for (i=0; i<=mp[index].npaths; i++) { + if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) + continue; + params_p += sprintf(params_p, " %i %s ", + dm_pg_prio, dm_ps_name); + params_p += sprintf(params_p, "1 %i", + dm_ps_nr_args); + params_p += sprintf(params_p, " %s", + all_paths[PINDEX(index,i)].dev); + } } - if (size < 0) + if (mp[index].size < 0) goto addout; if (!conf->quiet) { if (op == DM_DEVICE_RELOAD) - printf("U|"); + printf("U:"); if (op == DM_DEVICE_CREATE) - printf("N|"); - printf("%s : 0 %li %s %s\n", - mp[index].wwid, size, DM_TARGET, params); + printf("N:"); + printf("%s:0 %li %s %s\n", + mp[index].wwid, mp[index].size, DM_TARGET, params); } - if (!dm_task_add_target(dmt, 0, size, DM_TARGET, params)) + if (!dm_task_add_target(dmt, 0, mp[index].size, DM_TARGET, params)) goto addout; if (!dm_task_run(dmt)) @@ -714,8 +712,10 @@ static void usage(char * progname) { fprintf(stderr, VERSION_STRING); - fprintf(stderr, "Usage: %s [-v|-q] [-d] [-i int] [-m max_devs]\n", progname); + fprintf(stderr, "Usage: %s [-v|-q] [-d] [-i int] [-m max_devs]\n", + progname); fprintf(stderr, "\t-d\t\tdry run, do not create or update devmaps\n"); + fprintf(stderr, "\t-f\t\tforce maps to failover mode (1 path/pg)\n"); fprintf(stderr, "\t-i\t\tmultipath target param : polling interval\n"); fprintf(stderr, "\t-m max_devs\tscan {max_devs} devices at most\n"); fprintf(stderr, "\t-q\t\tquiet, no output at all\n"); @@ -759,6 +759,8 @@ main(int argc, char *argv[]) conf.quiet = 1; } else if (0 == strcmp("-d", argv[i])) conf.dry_run = 1; + else if (0 == strcmp("-f", argv[i])) + conf.forcedfailover = 1; else if (0 == strcmp("-i", argv[i])) conf.dm_path_test_int = atoi(argv[++i]); else if (0 == strcmp("scsi", argv[i])) diff --git a/extras/multipath/main.h b/extras/multipath/main.h index 0c5620ff74..3941c32e7c 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -48,6 +48,10 @@ #define BLKGETSIZE _IO(0x12,96) #define DM_TARGET "multipath" +/* Storage controlers cpabilities */ +#define FAILOVER 0 +#define MULTIBUS 1 + #define PINDEX(x,y) mp[(x)].pindex[(y)] /* global types */ @@ -80,16 +84,17 @@ struct path { char sg_dev[FILE_NAME_SIZE]; struct scsi_idlun scsi_id; struct sg_id sg_id; - int state; char wwid[WWID_SIZE]; char vendor_id[8]; char product_id[16]; char rev[4]; + int iopolicy; }; struct multipath { char wwid[WWID_SIZE]; int npaths; + long size; int pindex[MAX_MP_PATHS]; }; @@ -98,6 +103,7 @@ struct env { int verbose; int quiet; int dry_run; + int forcedfailover; int with_sysfs; int dm_path_test_int; char sysfs_path[FILE_NAME_SIZE]; diff --git a/extras/multipath/unsused.c b/extras/multipath/unsused.c deleted file mode 100644 index ecdd695ac8..0000000000 --- a/extras/multipath/unsused.c +++ /dev/null @@ -1,52 +0,0 @@ -static int -del_map(char * str) { - struct dm_task *dmt; - - if (!(dmt = dm_task_create(DM_DEVICE_REMOVE))) - return 0; - if (!dm_task_set_name(dmt, str)) - goto delout; - if (!dm_task_run(dmt)) - goto delout; - - printf("Deleted device map : %s\n", str); - - delout: - dm_task_destroy(dmt); - return 1; -} - -get_table(const char * str) -{ - int r = 0; - struct dm_task *dmt; - void *next = NULL; - uint64_t start, length; - char *target_type = NULL; - char *params; - - if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) - return 0; - - if (!dm_task_set_name(dmt, str)) - goto out; - - if (!dm_task_run(dmt)) - goto out; - - do { - next = dm_get_next_target(dmt, next, &start, &length, - &target_type, ¶ms); - if (target_type) { - printf("%" PRIu64 " %" PRIu64 " %s %s\n", - start, length, target_type, params); - } - } while (next); - - r = 1; - - out: - dm_task_destroy(dmt); - return r; - -} diff --git a/extras/multipath/unused.c b/extras/multipath/unused.c new file mode 100644 index 0000000000..33b3e859d1 --- /dev/null +++ b/extras/multipath/unused.c @@ -0,0 +1,78 @@ +static int +do_tur(int fd) +{ + unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; + struct sg_io_hdr io_hdr; + unsigned char sense_buffer[32]; + + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (turCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_buffer); + io_hdr.dxfer_direction = SG_DXFER_NONE; + io_hdr.cmdp = turCmdBlk; + io_hdr.sbp = sense_buffer; + io_hdr.timeout = 20000; + io_hdr.pack_id = 0; + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + close(fd); + return 0; + } + if (io_hdr.info & SG_INFO_OK_MASK) { + return 0; + } + return 1; +} + +static int +del_map(char * str) { + struct dm_task *dmt; + + if (!(dmt = dm_task_create(DM_DEVICE_REMOVE))) + return 0; + if (!dm_task_set_name(dmt, str)) + goto delout; + if (!dm_task_run(dmt)) + goto delout; + + printf("Deleted device map : %s\n", str); + + delout: + dm_task_destroy(dmt); + return 1; +} + +get_table(const char * str) +{ + int r = 0; + struct dm_task *dmt; + void *next = NULL; + uint64_t start, length; + char *target_type = NULL; + char *params; + + if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) + return 0; + + if (!dm_task_set_name(dmt, str)) + goto out; + + if (!dm_task_run(dmt)) + goto out; + + do { + next = dm_get_next_target(dmt, next, &start, &length, + &target_type, ¶ms); + if (target_type) { + printf("%" PRIu64 " %" PRIu64 " %s %s\n", + start, length, target_type, params); + } + } while (next); + + r = 1; + + out: + dm_task_destroy(dmt); + return r; + +} -- cgit v1.2.3-54-g00ecf From 88bca8484d88ce543f40d631ec9048795a725c13 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Mon, 22 Dec 2003 20:52:01 -0800 Subject: [PATCH] extras multipath update incremental to 20031222, 2003-12-22 multipath-010 * introduce dm-simplecmd for RESUME & SUSPEND requests * split add_map() in setup_map() & dm-addmap() * setup_map() correctly submits "SUSPEND-RELOAD-RESUME or CREATE" sequences instead of the bogus "RELOAD or CREATE" --- extras/multipath/ChangeLog | 4 +++ extras/multipath/main.c | 70 ++++++++++++++++++++++++++++++++-------------- 2 files changed, 53 insertions(+), 21 deletions(-) diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index dc29400e0e..ee26e06ac0 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,4 +1,8 @@ 2003-12-22 multipath-010 + * introduce dm-simplecmd for RESUME & SUSPEND requests + * split add_map() in setup_map() & dm-addmap() + * setup_map() correctly submits "SUSPEND-RELOAD-RESUME or CREATE" + sequences instead of the bogus "RELOAD or CREATE" * don't print .sg_dev if equal to .dev (2.6) in print_path() * since the kernel code handles defective paths, remove all code to cope with them : diff --git a/extras/multipath/main.c b/extras/multipath/main.c index c57cd4fe7e..293ee06fbc 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -589,12 +589,50 @@ make_dm_node(char * str) } static int -add_map(struct env * conf, struct path * all_paths, +dm_simplecmd(int task, const char *name) { + int r = 0; + struct dm_task *dmt; + + if (!(dmt = dm_task_create(task))) + return 0; + + if (!dm_task_set_name(dmt, name)) + goto out; + + r = dm_task_run(dmt); + + out: + dm_task_destroy(dmt); + return r; +} + +static int +dm_addmap(int task, const char *name, const char *params, long size) { + struct dm_task *dmt; + + if (!(dmt = dm_task_create(task))) + return 0; + + if (!dm_task_set_name(dmt, name)) + goto addout; + + if (!dm_task_add_target(dmt, 0, size, DM_TARGET, params)) + goto addout; + + if (!dm_task_run(dmt)) + goto addout; + + addout: + dm_task_destroy(dmt); + return 1; +} + +static int +setup_map(struct env * conf, struct path * all_paths, struct multipath * mp, int index, int op) { char params[255]; char * params_p; - struct dm_task *dmt; int i, np; /* defaults for multipath target */ @@ -602,11 +640,6 @@ add_map(struct env * conf, struct path * all_paths, char * dm_ps_name = "round-robin"; int dm_ps_nr_args = 0; - if (!(dmt = dm_task_create(op))) - return 0; - - if (!dm_task_set_name(dmt, mp[index].wwid)) - goto addout; params_p = ¶ms[0]; np = 0; @@ -614,11 +647,9 @@ add_map(struct env * conf, struct path * all_paths, if (0 == all_paths[PINDEX(index,i)].sg_id.scsi_type) np++; } - if (np == 0) - goto addout; if (np < 1) - goto addout; + return 0; params_p += sprintf(params_p, "%i", conf->dm_path_test_int); @@ -650,7 +681,7 @@ add_map(struct env * conf, struct path * all_paths, } if (mp[index].size < 0) - goto addout; + return 0; if (!conf->quiet) { if (op == DM_DEVICE_RELOAD) @@ -661,18 +692,15 @@ add_map(struct env * conf, struct path * all_paths, mp[index].wwid, mp[index].size, DM_TARGET, params); } - if (!dm_task_add_target(dmt, 0, mp[index].size, DM_TARGET, params)) - goto addout; + if (op == DM_DEVICE_RELOAD) + dm_simplecmd(DM_DEVICE_SUSPEND, mp[index].wwid); - if (!dm_task_run(dmt)) - goto addout; + dm_addmap(op, mp[index].wwid, params, mp[index].size); + if (op == DM_DEVICE_RELOAD) + dm_simplecmd(DM_DEVICE_RESUME, mp[index].wwid); make_dm_node(mp[index].wwid); - - addout: - dm_task_destroy(dmt); - return 1; } static int @@ -802,9 +830,9 @@ main(int argc, char *argv[]) for (k=0; k<=nmp; k++) { if (map_present(mp[k].wwid)) { - add_map(&conf, all_paths, mp, k, DM_DEVICE_RELOAD); + setup_map(&conf, all_paths, mp, k, DM_DEVICE_RELOAD); } else { - add_map(&conf, all_paths, mp, k, DM_DEVICE_CREATE); + setup_map(&conf, all_paths, mp, k, DM_DEVICE_CREATE); } } -- cgit v1.2.3-54-g00ecf From 01ff79f58925dd26a717ae78f201d739053b5477 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Mon, 22 Dec 2003 20:53:55 -0800 Subject: [PATCH] extras multipath update incremental to 20031222-2, 2003-12-22 multipath-010 * tweak the install target in Makefile * stop passing fds as argument : this change enable a strict segregation of ugly 2.4 code * sysfs version of get_lun_strings() * be careful about the return of get_unique_id() since errors formerly caught up by if(open()) in the caller fn are now returned by get_unique_id() * send get_serial() in unused.c --- extras/multipath/ChangeLog | 8 +++ extras/multipath/Makefile | 6 +- extras/multipath/main.c | 133 ++++++++++++++++++++++++--------------------- extras/multipath/unused.c | 17 ++++++ 4 files changed, 99 insertions(+), 65 deletions(-) diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index ee26e06ac0..730d6e34a6 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,4 +1,12 @@ 2003-12-22 multipath-010 + * tweak the install target in Makefile + * stop passing fds as argument : this change enable a strict + segregation of ugly 2.4 code + * sysfs version of get_lun_strings() + * be careful about the return of get_unique_id() since errors + formerly caught up by if(open()) in the caller fn are now returned + by get_unique_id() + * send get_serial() in unused.c * introduce dm-simplecmd for RESUME & SUSPEND requests * split add_map() in setup_map() & dm-addmap() * setup_map() correctly submits "SUSPEND-RELOAD-RESUME or CREATE" diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index 89e6f35185..99036a6a00 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -4,9 +4,9 @@ EXEC = multipath -prefix = /usr/local +prefix = exec_prefix = ${prefix} -bindir = ${exec_prefix}/bin +bindir = ${exec_prefix}/sbin udevdir = ../.. klibcdir = $(udevdir)/klibc sysfsdir = $(udevdir)/libsysfs @@ -52,6 +52,8 @@ clean: install: install -d $(bindir) install -m 755 $(EXEC) $(bindir)/ + install -d /etc/hotplug.d/scsi/ + install -m 755 multipath.hotplug /etc/hotplug.d/scsi/ # Code dependencies main.o: main.c main.h sg_include.h diff --git a/extras/multipath/main.c b/extras/multipath/main.c index 293ee06fbc..f62e0f9954 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -100,65 +100,89 @@ sprint_wwid(char * buff, const char * str) buff[WWID_SIZE - 1] = '\0'; } +static void +basename(char * str1, char * str2) +{ + char *p = str1 + (strlen(str1) - 1); + + while (*--p != '/') + continue; + strcpy(str2, ++p); +} + static int -get_lun_strings(int fd, struct path * mypath) +get_lun_strings(struct env * conf, struct path * mypath) { + int fd; char buff[36]; + char attr_path[FILE_NAME_SIZE]; + char basedev[FILE_NAME_SIZE]; - if (0 == do_inq(fd, 0, 0, 0, buff, 36, 1)) { + if(conf->with_sysfs) { + /* sysfs style */ + basename(mypath->sg_dev, basedev); + + sprintf(attr_path, "%s/block/%s/device/vendor", + conf->sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, + mypath->vendor_id, 8)) return 0; + + sprintf(attr_path, "%s/block/%s/device/model", + conf->sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, + mypath->product_id, 16)) return 0; + + sprintf(attr_path, "%s/block/%s/device/rev", + conf->sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, + mypath->rev, 4)) return 0; + } else { + /* ioctl style */ + if ((fd = open(mypath->sg_dev, O_RDONLY)) < 0) + return 0; + if (0 != do_inq(fd, 0, 0, 0, buff, 36, 1)) + return 0; memcpy(mypath->vendor_id, &buff[8], 8); memcpy(mypath->product_id, &buff[16], 16); memcpy(mypath->rev, &buff[32], 4); + close(fd); return 1; } return 0; } -/* -static int -get_serial (int fd, char * str) -{ - char buff[MX_ALLOC_LEN + 1]; - int len; - - if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { - len = buff[3]; - if (len > 0) { - memcpy(str, buff + 4, len); - buff[len] = '\0'; - } - return 1; - } - return 0; -} -*/ - /* hardware vendor specifics : add support for new models below */ /* this one get EVPD page 0x83 off 8 */ /* tested ok with StorageWorks */ static int -get_evpd_wwid(int fd, char *str) +get_evpd_wwid(struct path * mypath) { + int fd; char buff[64]; + if ((fd = open(mypath->sg_dev, O_RDONLY)) < 0) + return 0; + if (0 == do_inq(fd, 0, 1, 0x83, buff, sizeof (buff), 1)) { - sprint_wwid(str, &buff[8]); - return 1; + sprint_wwid(mypath->wwid, &buff[8]); + close(fd); + return 1; /* success */ } - return 0; + close(fd); + return 0; /* not good */ } /* White list switch */ static int -get_unique_id(int fd, struct path * mypath) +get_unique_id(struct path * mypath) { int i; static struct { char * vendor; char * product; int iopolicy; - int (*getuid) (int fd, char * wwid); + int (*getuid) (struct path *); } wlist[] = { {"COMPAQ ", "HSV110 (C)COMPAQ", MULTIBUS, &get_evpd_wwid}, {"COMPAQ ", "MSA1000 ", MULTIBUS, &get_evpd_wwid}, @@ -183,24 +207,14 @@ get_unique_id(int fd, struct path * mypath) for (i = 0; wlist[i].vendor; i++) { if (strncmp(mypath->vendor_id, wlist[i].vendor, 8) == 0 && strncmp(mypath->product_id, wlist[i].product, 16) == 0) { - wlist[i].getuid(fd, mypath->wwid); mypath->iopolicy = wlist[i].iopolicy; - return 0; + if (!wlist[i].getuid(mypath)) + return 0; } } return 1; } -static void -basename(char * str1, char * str2) -{ - char *p = str1 + (strlen(str1) - 1); - - while (*--p != '/') - continue; - strcpy(str2, ++p); -} - static int blacklist (char * dev) { int i; @@ -230,7 +244,6 @@ static int get_all_paths_sysfs(struct env * conf, struct path * all_paths) { int k=0; - int sg_fd; struct sysfs_directory * sdir; struct sysfs_directory * devp; struct sysfs_link * linkp; @@ -252,11 +265,9 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) basename(conf->hotplugdev, buff); sprintf(curpath.sg_dev, "/dev/%s", buff); - if ((sg_fd = open(curpath.sg_dev, O_RDONLY)) < 0) - exit(1); - - get_lun_strings(sg_fd, &curpath); - get_unique_id(sg_fd, &curpath); + get_lun_strings(conf, &curpath); + if (!get_unique_id(&curpath)) + return 0; strcpy(refwwid, curpath.wwid); memset(&curpath, 0, sizeof(path)); } @@ -286,16 +297,12 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) basename(devp->path, buff); sprintf(curpath.sg_dev, "/dev/%s", buff); - if ((sg_fd = open(curpath.sg_dev, O_RDONLY)) < 0) { - if (conf->verbose) - fprintf(stderr, "can't open %s\n", - curpath.sg_dev); + get_lun_strings(conf, &curpath); + if(!get_unique_id(&curpath)) { + memset(&curpath, 0, sizeof(path)); continue; } - get_lun_strings(sg_fd, &curpath); - get_unique_id(sg_fd, &curpath); - if (memcmp(empty_buff, refwwid, WWID_SIZE) != 0 && strncmp(curpath.wwid, refwwid, WWID_SIZE) != 0) { memset(&curpath, 0, sizeof(path)); @@ -312,7 +319,6 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) /* done with curpath, zero for reuse */ memset(&curpath, 0, sizeof(path)); - close(sg_fd); basename(linkp->target, buff); sscanf(buff, "%i:%i:%i:%i", &all_paths[k].sg_id.host_no, @@ -329,7 +335,7 @@ static int get_all_paths_nosysfs(struct env * conf, struct path * all_paths, struct scsi_dev * all_scsi_ids) { - int k, i, sg_fd; + int k, i, fd; char buff[FILE_NAME_SIZE]; char file_name[FILE_NAME_SIZE]; @@ -338,19 +344,19 @@ get_all_paths_nosysfs(struct env * conf, struct path * all_paths, sprintf(buff, "%d", k); strncat(file_name, buff, FILE_NAME_SIZE); strcpy(all_paths[k].sg_dev, file_name); - if ((sg_fd = open(file_name, O_RDONLY)) < 0) { - if (conf->verbose) - fprintf(stderr, "can't open %s. mknod ?", - file_name); + + get_lun_strings(conf, &all_paths[k]); + if (!get_unique_id(&all_paths[k])) continue; - } - get_lun_strings(sg_fd, &all_paths[k]); - get_unique_id(sg_fd, &all_paths[k]); - if (0 > ioctl(sg_fd, SG_GET_SCSI_ID, &(all_paths[k].sg_id))) + + if ((fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) + return 0; + + if (0 > ioctl(fd, SG_GET_SCSI_ID, &(all_paths[k].sg_id))) printf("device %s failed on sg ioctl, skip\n", file_name); - close(sg_fd); + close(fd); for (i = 0; i < conf->max_devs; i++) { if ((all_paths[k].sg_id.host_no == @@ -701,6 +707,7 @@ setup_map(struct env * conf, struct path * all_paths, dm_simplecmd(DM_DEVICE_RESUME, mp[index].wwid); make_dm_node(mp[index].wwid); + return 1; } static int diff --git a/extras/multipath/unused.c b/extras/multipath/unused.c index 33b3e859d1..08144cf717 100644 --- a/extras/multipath/unused.c +++ b/extras/multipath/unused.c @@ -1,3 +1,20 @@ +static int +get_serial (int fd, char * str) +{ + char buff[MX_ALLOC_LEN + 1]; + int len; + + if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { + len = buff[3]; + if (len > 0) { + memcpy(str, buff + 4, len); + buff[len] = '\0'; + } + return 1; + } + return 0; +} + static int do_tur(int fd) { -- cgit v1.2.3-54-g00ecf From f4f3939a6cfc4fa1fb6a1621fdfb0ef174f11e41 Mon Sep 17 00:00:00 2001 From: "ananth@in.ibm.com" Date: Mon, 22 Dec 2003 20:54:51 -0800 Subject: [PATCH] change pgsize In udev-009 and previous releases, for klibc compatibility, the pgsize var in sysfs_read_attribute() (file sysfs_dir.c under libsysfs) is handcoded to 0x4000. Should it not be 4096 bytes (0x1000 in hex) instead of 0x4000 (16k bytes)? --- libsysfs/sysfs_dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index 7dbee8aba8..c159db7af8 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -274,7 +274,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) return -1; } #ifdef __KLIBC__ - pgsize = 0x4000; + pgsize = 0x1000; #else pgsize = sysconf(_SC_PAGESIZE); #endif -- cgit v1.2.3-54-g00ecf From a8b01705c6204c660062cb6abc8fe7dbb8a42197 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 22 Dec 2003 22:31:35 -0800 Subject: [PATCH] add ability to have up to 5 SYSFS_ file/value pairs for the LABEL rule. --- namedev.c | 91 +++++++++++++++++++++++++++++++++------------------------ namedev.h | 10 +++++-- namedev_parse.c | 47 ++++++++++++++++++++++------- 3 files changed, 97 insertions(+), 51 deletions(-) diff --git a/namedev.c b/namedev.c index 7c422f7877..d879fd5590 100644 --- a/namedev.c +++ b/namedev.c @@ -102,19 +102,6 @@ static int strcmp_pattern(const char *p, const char *s) if (strlen(b->var)) \ strcpy(a->var, b->var); -int add_config_dev(struct config_device *new_dev) -{ - struct config_device *tmp_dev; - - tmp_dev = malloc(sizeof(*tmp_dev)); - if (tmp_dev == NULL) - return -ENOMEM; - memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); - list_add_tail(&tmp_dev->node, &config_device_list); - //dump_config_dev(tmp_dev); - return 0; -} - int add_perm_dev(struct perm_device *new_dev) { struct list_head *tmp; @@ -432,12 +419,50 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev return -ENODEV; } -static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +static int match_pair(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair) { struct sysfs_attribute *tmpattr = NULL; + char *c; + + if ((pair == NULL) || (pair->file[0] == '\0') || (pair->value == '\0')) + return -ENODEV; + + dbg("look for device attribute '%s'", pair->file); + /* try to find the attribute in the class device directory */ + tmpattr = sysfs_get_classdev_attr(class_dev, pair->file); + if (tmpattr) + goto label_found; + + /* look in the class device directory if present */ + if (sysfs_device) { + tmpattr = sysfs_get_device_attr(sysfs_device, pair->file); + if (tmpattr) + goto label_found; + } + + return -ENODEV; + +label_found: + c = tmpattr->value + strlen(tmpattr->value)-1; + if (*c == '\n') + *c = 0x00; + dbg("compare attribute '%s' value '%s' with '%s'", + pair->file, tmpattr->value, pair->value); + if (strcmp_pattern(pair->value, tmpattr->value) != 0) + return -ENODEV; + + dbg("found matching attribute '%s' with value '%s'", + pair->file, pair->value); + return 0; +} + +static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +{ + struct sysfs_pair *pair; struct config_device *dev; struct list_head *tmp; - char *c; + int i; + int match; list_for_each(tmp, &config_device_list) { dev = list_entry(tmp, struct config_device, node); @@ -450,34 +475,24 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, continue; } - dbg("look for device attribute '%s'", dev->sysfs_file); - /* try to find the attribute in the class device directory */ - tmpattr = sysfs_get_classdev_attr(class_dev, dev->sysfs_file); - if (tmpattr) - goto label_found; - - /* look in the class device directory if present */ - if (sysfs_device) { - tmpattr = sysfs_get_device_attr(sysfs_device, dev->sysfs_file); - if (tmpattr) - goto label_found; + match = 1; + for (i = 0; i < MAX_SYSFS_PAIRS; ++i) { + pair = &dev->sysfs_pair[i]; + if ((pair->file[0] == '\0') || (pair->value[0] == '\0')) + break; + if (match_pair(class_dev, sysfs_device, pair) != 0) { + match = 0; + break; + } } - - continue; - -label_found: - c = tmpattr->value + strlen(tmpattr->value)-1; - if (*c == '\n') - *c = 0x00; - dbg("compare attribute '%s' value '%s' with '%s'", - dev->sysfs_file, tmpattr->value, dev->sysfs_value); - if (strcmp_pattern(dev->sysfs_value, tmpattr->value) != 0) + if (match == 0) continue; + /* found match */ strfieldcpy(udev->name, dev->name); strfieldcpy(udev->symlink, dev->symlink); - dbg("found matching attribute '%s', '%s' becomes '%s' ", - dev->sysfs_file, class_dev->name, udev->name); + dbg("found matching attribute, '%s' becomes '%s' ", + class_dev->name, udev->name); return 0; } diff --git a/namedev.h b/namedev.h index 69c488936d..1eaf4fee4d 100644 --- a/namedev.h +++ b/namedev.h @@ -60,20 +60,25 @@ enum config_type { #define FIELD_SYMLINK "SYMLINK" #define CALLOUT_MAXARG 8 +#define MAX_SYSFS_PAIRS 5 + +struct sysfs_pair { + char file[FILE_SIZE]; + char value[VALUE_SIZE]; +}; struct config_device { struct list_head node; enum config_type type; char bus[BUS_SIZE]; - char sysfs_file[FILE_SIZE]; - char sysfs_value[VALUE_SIZE]; char id[ID_SIZE]; char place[PLACE_SIZE]; char kernel_name[NAME_SIZE]; char exec_program[FILE_SIZE]; char name[NAME_SIZE]; char symlink[NAME_SIZE]; + struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; }; struct perm_device { @@ -93,7 +98,6 @@ extern int namedev_name_device(struct sysfs_class_device *class_dev, struct udev extern int namedev_init_permissions(void); extern int namedev_init_rules(void); -extern int add_config_dev(struct config_device *new_dev); extern int add_perm_dev(struct perm_device *new_dev); extern void dump_config_dev(struct config_device *dev); extern void dump_config_dev_list(void); diff --git a/namedev_parse.c b/namedev_parse.c index 33e0c89e22..266fa35a19 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -36,6 +36,19 @@ #include "udev.h" #include "namedev.h" +static int add_config_dev(struct config_device *new_dev) +{ + struct config_device *tmp_dev; + + tmp_dev = malloc(sizeof(*tmp_dev)); + if (tmp_dev == NULL) + return -ENOMEM; + memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); + list_add_tail(&tmp_dev->node, &config_device_list); + //dump_config_dev(tmp_dev); + return 0; +} + int get_pair(char **orig_string, char **left, char **right) { char *temp; @@ -78,8 +91,8 @@ void dump_config_dev(struct config_device *dev) dbg_parse("KERNEL name='%s'", dev->name); break; case LABEL: - dbg_parse("LABEL name='%s', bus='%s', sysfs_file='%s', sysfs_value='%s'", - dev->name, dev->bus, dev->sysfs_file, dev->sysfs_value); + dbg_parse("LABEL name='%s', bus='%s', sysfs_file[0]='%s', sysfs_value[0]='%s'", + dev->name, dev->bus, dev->sysfs_pair[0].file, dev->sysfs_pair[0].value); break; case NUMBER: dbg_parse("NUMBER name='%s', bus='%s', id='%s'", @@ -225,9 +238,23 @@ keys: } if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) { - /* remove prepended 'SYSFS_' */ - strfieldcpy(dev.sysfs_file, temp2 + sizeof(FIELD_SYSFS)-1); - strfieldcpy(dev.sysfs_value, temp3); + struct sysfs_pair *pair = &dev.sysfs_pair[0]; + int sysfs_pair_num = 0; + + /* find first unused pair */ + while (pair->file[0] != '\0') { + ++sysfs_pair_num; + if (sysfs_pair_num >= MAX_SYSFS_PAIRS) { + pair = NULL; + break; + } + ++pair; + } + if (pair) { + /* remove prepended 'SYSFS_' */ + strfieldcpy(pair->file, temp2 + sizeof(FIELD_SYSFS)-1); + strfieldcpy(pair->value, temp3); + } continue; } @@ -258,13 +285,13 @@ keys: switch (dev.type) { case LABEL: dbg_parse(TYPE_LABEL " name='%s', bus='%s', " - "sysfs_file='%s', sysfs_value='%s', symlink='%s'", - dev.name, dev.bus, dev.sysfs_file, - dev.sysfs_value, dev.symlink); + "sysfs_file[0]='%s', sysfs_value[0]='%s', symlink='%s'", + dev.name, dev.bus, dev.sysfs_pair[0].file, + dev.sysfs_pair[0].value, dev.symlink); if ((*dev.name == '\0') || (*dev.bus == '\0') || - (*dev.sysfs_file == '\0') || - (*dev.sysfs_value == '\0')) + (*dev.sysfs_pair[0].file == '\0') || + (*dev.sysfs_pair[0].value == '\0')) goto error; break; case NUMBER: -- cgit v1.2.3-54-g00ecf From 358c8c20239a314b4684c54485c526deaf36dd3b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 22 Dec 2003 22:32:06 -0800 Subject: [PATCH] add tests for multi-file LABEL rules. --- test/label_test | 3 ++- test/udev-test.pl | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/test/label_test b/test/label_test index 2e05692581..cf0d2eb09c 100644 --- a/test/label_test +++ b/test/label_test @@ -8,7 +8,8 @@ export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG cat > $RULES << EOF -LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="boot_disk%n" +LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW !#", NAME="boot_diskX%n" +LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW !#", NAME="boot_disk%n" EOF cat > $CONFIG << EOF diff --git a/test/udev-test.pl b/test/udev-test.pl index 7afbd0d6fc..4773954b9c 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -61,6 +61,26 @@ LABEL, BUS="scsi", SYSFS_vendor="?IBM-ESXS", NAME="boot_disk%n-1" LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS?", NAME="boot_disk%n-2" LABEL, BUS="scsi", SYSFS_vendor="IBM-ES??", NAME="boot_disk%n" LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXSS", NAME="boot_disk%n-3" +EOF + }, + { + desc => "label test of multiple sysfs files", + subsys => "block", + devpath => "block/sda/sda1", + expected => "boot_disk1" , + conf => < "label test of max sysfs files", + subsys => "block", + devpath => "block/sda/sda1", + expected => "boot_disk1" , + conf => < Date: Mon, 22 Dec 2003 22:36:10 -0800 Subject: [PATCH] add documentation about the multiple sysfs values that are now allowed for the LABEL rule. --- udev.8 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/udev.8 b/udev.8 index c4ee23dcc7..5e411282ff 100644 --- a/udev.8 +++ b/udev.8 @@ -112,7 +112,8 @@ calling external program, that returns a string to match .TP .B LABEL device label or serial number, like USB serial number, SCSI UUID or -file system label +file system label. Up to 5 different sysfs files can be checked, with +all of the values being required in order to match the rule. .br .RB "keys: " BUS ", " SYSFS_ .TP @@ -168,6 +169,9 @@ CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1" # USB printer to be called lp_color LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_color" +# SCSI disk with a specific vendor and model number is to be called boot +LABEL, BUS="scsi", SYSFS_vendor="IBM", SYSFS_model="ST336", NAME="boot%n" + # sound card with PCI bus id 00:0b.0 to be called dsp NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" -- cgit v1.2.3-54-g00ecf From 170ae44e7d45e5907668cd1eab740a84eb79c70a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 22 Dec 2003 22:40:19 -0800 Subject: [PATCH] add documentation for the new '%k' modifier (kernel name replacement) --- udev.8 | 3 +++ udev.rules | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/udev.8 b/udev.8 index 5e411282ff..f2006c42dc 100644 --- a/udev.8 +++ b/udev.8 @@ -142,6 +142,9 @@ fields support simple printf-like string substitution: The "kernel number" of the device. for example, 'sda3' has a "kernel number" of '3' .TP +.B %k +The "kernel name" for the device. +.TP .B %M The kernel major number for the device. .TP diff --git a/udev.rules b/udev.rules index 618737ffd8..06d5842c2a 100644 --- a/udev.rules +++ b/udev.rules @@ -2,6 +2,7 @@ # They provide the following subsitutions: # %n - the "kernel number" of the device. # for example, 'sda3' has a "kernel number" of '3' +# %k - the kernel name for the device. # %M - the kernel major number for the device # %m - the kernel minor number for the device # %b - the bus id for the device @@ -16,7 +17,7 @@ CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" # A usb camera. -LABEL, BUS="usb", SYSFS_vendor="FUJIFILM", NAME="camera%n" +LABEL, BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" # USB Epson printer to be called lp_epson LABEL, BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" -- cgit v1.2.3-54-g00ecf From ca593541e63b6accd1f8c5f5592ada4b85930576 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 22 Dec 2003 22:45:43 -0800 Subject: [PATCH] fix complier warning in namedev.c --- namedev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/namedev.c b/namedev.c index d879fd5590..c77b0f8ef4 100644 --- a/namedev.c +++ b/namedev.c @@ -714,7 +714,6 @@ exit: int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) { struct sysfs_device *sysfs_device = NULL; - struct sysfs_class_device *class_dev_parent = NULL; int retval = 0; struct perm_device *perm; char *pos; -- cgit v1.2.3-54-g00ecf From 808423c90c113294c09faafafebdf4556a093e80 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 22 Dec 2003 22:47:58 -0800 Subject: [PATCH] small cleanup udev-remove.c Here is a small cleanup. It replaces the malloc in udev-remove.c with a struct, like we do in udev-add.c --- udev-remove.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/udev-remove.c b/udev-remove.c index 6d7e2ad22a..c5de6c823f 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -118,30 +118,26 @@ static int delete_node(struct udevice *dev) */ int udev_remove_device(char *path, char *subsystem) { - struct udevice *dev; + struct udevice dev; char *temp; int retval; - dev = malloc(sizeof(*dev)); - if (dev == NULL) - return -ENOMEM; - memset(dev, 0, sizeof(*dev)); + memset(&dev, 0, sizeof(dev)); - retval = udevdb_get_dev(path, dev); + retval = udevdb_get_dev(path, &dev); if (retval) { dbg("'%s' not found in database, falling back on default name", path); temp = strrchr(path, '/'); if (temp == NULL) return -ENODEV; - strncpy(dev->name, &temp[1], sizeof(dev->name)); + strncpy(dev.name, &temp[1], sizeof(dev.name)); } - dbg("name is '%s'", dev->name); + dbg("name is '%s'", dev.name); udevdb_delete_dev(path); - sysbus_send_remove(dev->name, path); + sysbus_send_remove(dev.name, path); - retval = delete_node(dev); - free(dev); + retval = delete_node(&dev); return retval; } -- cgit v1.2.3-54-g00ecf From 5cac7def788fc6dec19dc8185f9c2c7c7c8d49a2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 22 Dec 2003 23:30:51 -0800 Subject: [PATCH] fix udev-test.pl Here is a small fix for udev-test.pl, to print the METHOD also for the "whitespace config" tests. TEST: Handle comment lines in config file (and replace kernel name) method '' for 'class/tty/ttyUSB0' expecting node 'visor' add: ok remove: ok --- test/udev-test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 4773954b9c..3e7068faa6 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -328,7 +328,7 @@ print CONF "udev_permissions=\"$perm\"\n"; close CONF; foreach my $config (@tests) { - $config->{conf} =~ m/^([A-Z]*).*/; + $config->{conf} =~ m/([A-Z]+)\s*,/; my $method = $1; print "TEST: $config->{desc}\n"; -- cgit v1.2.3-54-g00ecf From 1e5b0d2fc975e6202239b1b97065baab2ce8196e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 23 Dec 2003 00:33:29 -0800 Subject: [PATCH] v010 release --- ChangeLog | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb8fa7f15c..d50e3a5cce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,54 @@ +Summary of changes from v009 to v010 +============================================ + +: + o change pgsize + +: + o extras multipath update + o extras multipath update + o extras multipath update + o extras multipath update + +Kay Sievers: + o fix udev-test.pl + o small cleanup udev-remove.c + o experimental CALLOUT script for devfs ide node creation with cd, disc, part + o add any valid device + o introduce format char 'k' for kernel-name + o trivial make fixes + o don't overwrite old config on install + o udev-remove.c cleanups + o bug in udev-remove.c + o trivial cleanup parser changes + +: + o fix comment and whitespace handling in config files + +Adam Kropelin: + o Allow build with empty EXTRAS + +Daniel E. F. Stekloff: + o libsysfs 0.4.0 patch + o fix scsi_id segfault with udev-009 + o add libsysfs docs + +David T. Hollis: + o mark config files as such in the rpm spec file + +Greg Kroah-Hartman: + o fix complier warning in namedev.c + o add documentation for the new '%k' modifier (kernel name replacement) + o add documentation about the multiple sysfs values that are now allowed for the LABEL rule + o add tests for multi-file LABEL rules + o add ability to have up to 5 SYSFS_ file/value pairs for the LABEL rule + o Just live with a sleep(1) in namedev for now until libsysfs is fixed up + o try to wait until the proper device file shows up in sysfs + o remove unneeded TODO and FIXME entry + o clean up the stand-alone tests to work properly on other people's machines + o add tests to catch whitespace and comment config file parsing errors + + Summary of changes from v008 to v009 ============================================ diff --git a/Makefile b/Makefile index 5833d4cb94..785ad96349 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 009_bk +VERSION = 010 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 2e5a472a52..cdfc23e198 100644 --- a/udev.spec +++ b/udev.spec @@ -1,6 +1,6 @@ Summary: A userspace implementation of devfs Name: udev -Version: 009_bk +Version: 010 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 07562d6ecf64f708a3a20388200ec8bd9c5a3774 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Dec 2003 19:44:19 -0800 Subject: [PATCH] fix long delay for all devices in namedev Now we only sleep if we can't find the device file, and we have a hack to sleep for 1 second if we are on a partition. This will be removed when the libsysfs change gets made... --- namedev.c | 112 +++++++++++++++++++++++++++++--------------------------------- 1 file changed, 53 insertions(+), 59 deletions(-) diff --git a/namedev.c b/namedev.c index c77b0f8ef4..1e600bbe6d 100644 --- a/namedev.c +++ b/namedev.c @@ -624,57 +624,51 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de struct sysfs_device *sysfs_device; struct sysfs_class_device *class_dev_parent; int loop; - - /* FIXME!!! */ - /* This is needed here as we can easily out-race the placement of the - * device symlink by the kernel. The call to sleep(1); will be removed - * once libsysfs can be queried for sysfs_get_classdev_device() - * multiple times and have it return the proper information when the - * class device really shows up. For now, we live with the time - * delay... + char filename[SYSFS_PATH_MAX + 6]; + int retval; + char *temp; + int partition = 0; + + /* Figure out where the device symlink is at. For char devices this will + * always be in the class_dev->path. But for block devices, it's different. + * The main block device will have the device symlink in it's path, but + * all partitions have the symlink in its parent directory. + * But we need to watch out for block devices that do not have parents, yet + * look like a partition (fd0, loop0, etc.) They all do not have a device + * symlink yet. We do sit and spin on waiting for them right now, we should + * possibly have a whitelist for these devices here... */ - sleep(1); + strcpy(filename, class_dev->path); + dbg("filename = %s", filename); + if (strcmp(class_dev->classname, SYSFS_BLOCK_NAME) == 0) { + if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { + temp = strrchr(filename, '/'); + if (temp) { + partition = 1; + *temp = 0x00; + char *temp2 = strrchr(filename, '/'); + dbg("temp2 = %s", temp2); + if (temp2 && (strcmp(temp2, "/block") == 0)) { + /* oops, we have no parent block device, so go back to original directory */ + strcpy(filename, class_dev->path); + partition = 0; + } + } + } + } + strcat(filename, "/device"); -#if 0 /* FIXME - Something like this could also work, but for some reason doesn't, - I also tried just stat() on the device symlink, but that still - has nasty races, I'm probably doing something stupid... :( */ - loop = 10; + loop = 2; while (loop--) { struct stat buf; - int retval; - char filename[SYSFS_PATH_MAX + 6]; - - strcpy(filename, class_dev->path); - strcat(filename, "/device"); dbg("looking for '%s'", filename); retval = stat(filename, &buf); if (!retval) break; - - /* bah, let's go backwards up a level to see if the device is there, - * as block partitions don't point to the physical device. Need to fix that - * up in the kernel... - */ - if (strcmp(class_dev->classname, SYSFS_BLOCK_NAME) == 0) { - if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent == NULL) { - dbg("sysfs_get_classdev_parent for class device '%s' failed", class_dev->name); - } else { - strcpy(filename, class_dev_parent->path); - strcat(filename, "/device"); - dbg("looking for '%s'", filename); - retval = stat(filename, &buf); - if (!retval) - break; - } - } - } /* sleep to give the kernel a chance to create the device file */ sleep(1); } -#endif + loop = 1; /* FIXME put a real value in here for when everything is fixed... */ while (loop--) { /* find the sysfs_device for this class device */ @@ -683,28 +677,28 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de if (sysfs_device != NULL) goto exit; - /* bah, let's go backwards up a level to see if the device is there, - * as block partitions don't point to the physical device. Need to fix that - * up in the kernel... - */ - if (strcmp(class_dev->classname, SYSFS_BLOCK_NAME) == 0) { - dbg("looking at block device"); - if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { - dbg("really is a partition"); - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent == NULL) { - dbg("sysfs_get_classdev_parent for class device '%s' failed", class_dev->name); - } else { - dbg("class_dev_parent->name='%s'", class_dev_parent->name); - sysfs_device = sysfs_get_classdev_device(class_dev_parent); - if (sysfs_device != NULL) - goto exit; - } + /* if it's a partition, we need to get the parent device */ + if (partition) { + /* FIXME HACK HACK HACK HACK + * for some reason partitions need this extra sleep here, in order + * to wait for the device properly. Once the libsysfs code is + * fixed properly, this sleep should go away, and we can just loop above. + */ + sleep(1); + dbg("really is a partition"); + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent == NULL) { + dbg("sysfs_get_classdev_parent for class device '%s' failed", class_dev->name); + } else { + dbg("class_dev_parent->name='%s'", class_dev_parent->name); + sysfs_device = sysfs_get_classdev_device(class_dev_parent); + if (sysfs_device != NULL) + goto exit; } } /* sleep to give the kernel a chance to create the link */ - sleep(1); - + /* FIXME remove comment... + sleep(1); */ } dbg("Timed out waiting for device symlink, continuing on anyway..."); exit: -- cgit v1.2.3-54-g00ecf From 5779dd31f49b41d52d1f08c2eb4239926fa58864 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Dec 2003 21:25:40 -0800 Subject: [PATCH] make udev init script run udev in the background to let startup go much faster --- etc/init.d/udev | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/etc/init.d/udev b/etc/init.d/udev index 36ef2dafda..c540057d21 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -28,13 +28,13 @@ case "$1" in for i in ${sysfs_dir}/block/*; do # add each drive export DEVPATH=${i#${sysfs_dir}} - $bin block + $bin block & # add each partition, on each device for j in $i/*; do if [ -f $j/dev ]; then export DEVPATH=${j#${sysfs_dir}} - $bin block + $bin block & fi done done @@ -45,13 +45,14 @@ case "$1" in export DEVPATH=${j#${sysfs_dir}} CLASS=`echo ${i#${sysfs_dir}} | \ cut --delimiter='/' --fields=3-` - $bin $CLASS + $bin $CLASS & fi done done ;; stop) # be careful + action "Removing udev device nodes: " /bin/true if [ $udev_dir -a "$udev_dir" != "/" ]; then # clear out /udev rm -rf ${udev_dir}/* -- cgit v1.2.3-54-g00ecf From 18c783a7e6acab9590980a54978a129f7b3dca81 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Dec 2003 21:47:14 -0800 Subject: [PATCH] more init script cleanups, the stop target now calls udev to cleanup instead of just removing the whole /udev directory. --- etc/init.d/udev | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/etc/init.d/udev b/etc/init.d/udev index c540057d21..0d26d07083 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -11,20 +11,8 @@ udev_dir=/udev sysfs_dir=/sys bin=/sbin/udev -case "$1" in - start) - if [ ! -d $udev_dir ]; then - mkdir $udev_dir - fi - if [ ! -d $sysfs_dir ]; then - exit 1 - fi - # propogate /udev from /sys - we only need this while we do not - # have initramfs and an early user-space with which to do early - # device bring up - action "Creating initial udev device nodes: " /bin/true - export ACTION=add - # add block devices and their partitions +run_udev () { + # handle block devices and their partitions for i in ${sysfs_dir}/block/*; do # add each drive export DEVPATH=${i#${sysfs_dir}} @@ -49,14 +37,29 @@ case "$1" in fi done done +} + + +case "$1" in + start) + if [ ! -d $udev_dir ]; then + mkdir $udev_dir + fi + if [ ! -d $sysfs_dir ]; then + exit 1 + fi + # propogate /udev from /sys - we only need this while we do not + # have initramfs and an early user-space with which to do early + # device bring up + action "Creating initial udev device nodes: " /bin/true + export ACTION=add + run_udev ;; stop) # be careful action "Removing udev device nodes: " /bin/true - if [ $udev_dir -a "$udev_dir" != "/" ]; then - # clear out /udev - rm -rf ${udev_dir}/* - fi + export ACTION=remove + run_udev ;; status) if [ -d $udev_dir ]; then -- cgit v1.2.3-54-g00ecf From bc64a25fd223d8e0cbc0a4aa2ef8cc03e1d60562 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Dec 2003 21:48:18 -0800 Subject: [PATCH] check for empty line a bit better in the parser. Thanks to Mitch for pointing this out. --- namedev_parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index 266fa35a19..4526203253 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -176,7 +176,7 @@ int namedev_init_rules(void) ++temp; /* empty line? */ - if (*temp == 0x00) + if ((*temp == 0x00) || (*temp == 0x0a)) continue; /* see if this is a comment */ @@ -378,7 +378,7 @@ int namedev_init_permissions(void) ++temp; /* empty line? */ - if (*temp == 0x00) + if ((*temp == 0x00) || (*temp == 0x0a)) continue; /* see if this is a comment */ -- cgit v1.2.3-54-g00ecf From 480763324d812d3d5eb11cbe898a9b358b6fedbf Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Dec 2003 22:51:16 -0800 Subject: [PATCH] add pci to the bus_files list. --- namedev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/namedev.c b/namedev.c index 1e600bbe6d..e474b48e57 100644 --- a/namedev.c +++ b/namedev.c @@ -252,6 +252,7 @@ static struct bus_file { } bus_files[] = { { .bus = "scsi", .file = "vendor" }, { .bus = "usb", .file = "idVendor" }, + { .bus = "pci", .file = "vendor" }, {} }; -- cgit v1.2.3-54-g00ecf From ee15698133ecd754c0d847b6ebb3a533536a42dc Mon Sep 17 00:00:00 2001 From: "mh@nadir.org" Date: Wed, 24 Dec 2003 22:54:39 -0800 Subject: [PATCH] patch udev 009-010 rpm spec file the following problem was introduced with udev 009: [root@claw packages]# rpm -Uvh ~mh/rpm/RPMS/ppc/udev-010-1.ppc.rpm Preparing...########################################### [100%] 1:udev ########################################### [100%] error: unpacking of archive failed on file /usr/share/doc/udev-010/COPYING;3fe8a8e3: cpio: open failed - Permission denied it's because the mode of the directory /usr/share/doc/udev-010/ is 0644. This is with yellodog-3.0. the following patch fixes it: --- udev.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.spec b/udev.spec index cdfc23e198..6530c557c7 100644 --- a/udev.spec +++ b/udev.spec @@ -35,7 +35,7 @@ fi rm -rf $RPM_BUILD_ROOT %files -%defattr(0644,root,root) +%defattr(-,root,root) %doc COPYING README TODO ChangeLog %attr(755,root,root) /sbin/udev %attr(755,root,root) /udev/ -- cgit v1.2.3-54-g00ecf From df496acbee49c5974f9ed42a92cca4a119315643 Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Wed, 24 Dec 2003 22:58:16 -0800 Subject: [PATCH] proper cleanup on udevdb_init() failure Seems like we need the following patch to do proper sysbus cleanup, if udevdb_init() fails. --- udev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev.c b/udev.c index ac29ec6f44..71c5f1fba5 100644 --- a/udev.c +++ b/udev.c @@ -119,7 +119,7 @@ int main(int argc, char **argv, char **envp) retval = udevdb_init(UDEVDB_DEFAULT); if (retval != 0) { dbg("unable to initialize database"); - goto exit; + goto exit_sysbus; } /* initialize the naming deamon */ @@ -137,6 +137,7 @@ int main(int argc, char **argv, char **envp) } udevdb_exit(); +exit_sysbus: /* disconnect from the system message bus */ sysbus_disconnect(); -- cgit v1.2.3-54-g00ecf From 335e433720e8cdb5ca0f9caeb76ab9d525e96260 Mon Sep 17 00:00:00 2001 From: "svetljo@gmx.de" Date: Wed, 24 Dec 2003 23:01:40 -0800 Subject: [PATCH] fix udev sed Makefile usage --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 785ad96349..61abc1f60e 100644 --- a/Makefile +++ b/Makefile @@ -209,7 +209,7 @@ GEN_CONFIGS = udev.conf # Rules on how to create the generated config files udev.conf: - sed -e "s-@udevdir@-$(udevdir)-" < udev.conf.in > $@ + sed -e "s:@udevdir@:$(udevdir):" < udev.conf.in > $@ $(OBJS): $(GEN_HEADERS) -- cgit v1.2.3-54-g00ecf From 0c6758962ba9f1d238962611faca7c2cb2290bfb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Dec 2003 23:38:58 -0800 Subject: [PATCH] added different build options to the rpm udev.spec file. --- udev.spec | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/udev.spec b/udev.spec index 6530c557c7..9f923ef9ab 100644 --- a/udev.spec +++ b/udev.spec @@ -1,3 +1,21 @@ +# if we want to build against the included version of klibc or not. +# 0 - do not use klibc +# 1 - use klibc +# Watch out for where the linux symlink is in the klibc part of the tarball, +# it probably is not where you want it to be. +%define klibc 1 + +# if we want to build DBUS support in or not. +# 0 - no DBUS support +# 1 - DBUS support +%define dbus 0 + +# if we want to enable debugging support in udev. If it is enabled, lots of +# stuff will get sent to the debug syslog. +# 0 - debugging disabled +# 1 - debugging enabled +%define debug 0 + Summary: A userspace implementation of devfs Name: udev Version: 010 @@ -18,7 +36,16 @@ udev is a implementation of devfs in userspace using sysfs and %setup -q %build -make CC="gcc $RPM_OPT_FLAGS" +make CC="gcc $RPM_OPT_FLAGS" \ +%if %{klibc} + USE_KLIBC=true \ +%endif +%if %{dbus} + USE_DBUS=true \ +%endif +%if %{debug} + DEBUG=true \ +%endif %install make DESTDIR=$RPM_BUILD_ROOT install -- cgit v1.2.3-54-g00ecf From fe0a916c31fd597d29adbfb701656c08b462bcbe Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Dec 2003 23:56:29 -0800 Subject: [PATCH] 010_bk stamp --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 61abc1f60e..d2e6fd559d 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 010 +VERSION = 010_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 9f923ef9ab..431dfd8be5 100644 --- a/udev.spec +++ b/udev.spec @@ -18,7 +18,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 010 +Version: 010_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 8ff8bbbaddaa30a7ec60d066652bca2628eaeb69 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Dec 2003 23:56:54 -0800 Subject: [PATCH] add test for callout rule with a device that has no bus. --- test/udev-test.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 3e7068faa6..ea1d8611ef 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -212,6 +212,16 @@ EOF expected => "link1" , conf => < "callout for device with no bus", + subsys => "tty", + devpath => "class/tty/console", + expected => "TTY" , + conf => < Date: Thu, 25 Dec 2003 00:03:56 -0800 Subject: [PATCH] Don't require the BUS value for the CALLOUT rule. --- namedev_parse.c | 1 - 1 file changed, 1 deletion(-) diff --git a/namedev_parse.c b/namedev_parse.c index 4526203253..449aa44eaa 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -324,7 +324,6 @@ keys: dev.name, dev.bus, dev.exec_program, dev.id, dev.symlink); if ((*dev.name == '\0') || - (*dev.bus == '\0') || (*dev.id == '\0') || (*dev.exec_program == '\0')) goto error; -- cgit v1.2.3-54-g00ecf From 1d936fbca0b93dd9cc7a71983ca1a8ea890f181d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 25 Dec 2003 00:05:28 -0800 Subject: [PATCH] If a CALLOUT rule has a BUS id, then we must check to see if the device is on a bus. Thanks to Martin Schlemmer for pointing this out. --- namedev.c | 5 ++++- test/udev-test.pl | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index e474b48e57..de1b206180 100644 --- a/namedev.c +++ b/namedev.c @@ -399,7 +399,10 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev if (dev->type != CALLOUT) continue; - if (sysfs_device) { + if (dev->bus[0] != '\0') { + /* as the user specified a bus, we must match it up */ + if (!sysfs_device) + continue; dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcasecmp(dev->bus, sysfs_device->bus) != 0) continue; diff --git a/test/udev-test.pl b/test/udev-test.pl index ea1d8611ef..9538cba2d1 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -215,13 +215,22 @@ CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", ID="node *", NAME= EOF }, { - desc => "callout for device with no bus", + desc => "invalid callout for device with no bus", subsys => "tty", devpath => "class/tty/console", expected => "TTY" , conf => < "valid callout for device with no bus", + subsys => "tty", + devpath => "class/tty/console", + expected => "foo" , + conf => < Date: Thu, 25 Dec 2003 00:08:55 -0800 Subject: [PATCH] add documentation about the BUS key being optional for the CALLOUT rule. --- udev.8 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/udev.8 b/udev.8 index f2006c42dc..0a0640ad8c 100644 --- a/udev.8 +++ b/udev.8 @@ -106,7 +106,10 @@ The line format is: where valid methods with corresponding keys are: .TP .B CALLOUT -calling external program, that returns a string to match +calling external program, that returns a string to match. The +.BR BUS +key is optional, but if specified, the sysfs device bus must be able to be +detemined by a "device" symlink. .br .RB "keys: " BUS ", " PROGRAM ", " ID .TP -- cgit v1.2.3-54-g00ecf From a7402175da70f53d308450b50dd0c00cb733276e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 25 Dec 2003 00:33:00 -0800 Subject: [PATCH] If a LABEL rule has a BUS id, then we must check to see if the device is on a bus. --- namedev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index de1b206180..813f26b035 100644 --- a/namedev.c +++ b/namedev.c @@ -473,7 +473,10 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, if (dev->type != LABEL) continue; - if (sysfs_device) { + if (dev->bus[0] != '\0') { + /* as the user specified a bus, we must match it up */ + if (!sysfs_device) + continue; dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcasecmp(dev->bus, sysfs_device->bus) != 0) continue; -- cgit v1.2.3-54-g00ecf From 2ae1a0c6f33a2050346269588416e715ed8d4cfa Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 25 Dec 2003 00:33:27 -0800 Subject: [PATCH] Don't require the BUS value for the LABEL rule. --- namedev_parse.c | 1 - 1 file changed, 1 deletion(-) diff --git a/namedev_parse.c b/namedev_parse.c index 449aa44eaa..aec87d2771 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -289,7 +289,6 @@ keys: dev.name, dev.bus, dev.sysfs_pair[0].file, dev.sysfs_pair[0].value, dev.symlink); if ((*dev.name == '\0') || - (*dev.bus == '\0') || (*dev.sysfs_pair[0].file == '\0') || (*dev.sysfs_pair[0].value == '\0')) goto error; -- cgit v1.2.3-54-g00ecf From 64682333bb02d946c179bc729da687f6c85bf9e8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 25 Dec 2003 00:33:56 -0800 Subject: [PATCH] add tests for LABEL rule with a device that has no bus. --- test/udev-test.pl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 9538cba2d1..97c0094921 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -231,6 +231,27 @@ EOF expected => "foo" , conf => < "invalid label for device with no bus", + subsys => "tty", + devpath => "class/tty/console", + expected => "TTY" , + conf => < "valid label for device with no bus", + subsys => "tty", + devpath => "class/tty/console", + expected => "foo" , + conf => < Date: Thu, 25 Dec 2003 00:35:09 -0800 Subject: [PATCH] add documentation about the BUS key being optional for the LABEL rule. --- udev.8 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/udev.8 b/udev.8 index 0a0640ad8c..65af6d00a8 100644 --- a/udev.8 +++ b/udev.8 @@ -116,7 +116,10 @@ detemined by a "device" symlink. .B LABEL device label or serial number, like USB serial number, SCSI UUID or file system label. Up to 5 different sysfs files can be checked, with -all of the values being required in order to match the rule. +all of the values being required in order to match the rule. The +.BR BUS +key is optional, but if specified, the sysfs device bus must be able to be +detemined by a "device" symlink. .br .RB "keys: " BUS ", " SYSFS_ .TP -- cgit v1.2.3-54-g00ecf From d7577c8b90b112f414837a708e5440b91794737b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 25 Dec 2003 00:38:45 -0800 Subject: [PATCH] v011 release --- ChangeLog | 30 ++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d50e3a5cce..fa12f67046 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +Summary of changes from v010 to v011 +============================================ + +: + o proper cleanup on udevdb_init() failure + +: + o patch udev 009-010 rpm spec file + +: + o fix udev sed Makefile usage + +Greg Kroah-Hartman: + o add documentation about the BUS key being optional for the LABEL rule + o add tests for LABEL rule with a device that has no bus + o Don't require the BUS value for the LABEL rule + o If a LABEL rule has a BUS id, then we must check to see if the device is on a bus + o add documentation about the BUS key being optional for the CALLOUT rule + o If a CALLOUT rule has a BUS id, then we must check to see if the device is on a bus + o Don't require the BUS value for the CALLOUT rule + o add test for callout rule with a device that has no bus + o 010_bk stamp + o added different build options to the rpm udev.spec file + o add pci to the bus_files list + o check for empty line a bit better in the parser + o more init script cleanups, the stop target now calls udev to cleanup instead of just removing the whole /udev directory + o make udev init script run udev in the background to let startup go much faster + o fix long delay for all devices in namedev + + Summary of changes from v009 to v010 ============================================ diff --git a/Makefile b/Makefile index d2e6fd559d..4c8c8d7dad 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 010_bk +VERSION = 011 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 431dfd8be5..4283521326 100644 --- a/udev.spec +++ b/udev.spec @@ -18,7 +18,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 010_bk +Version: 011 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 1f99bc3254d8d996408ad712b149d115505c8422 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 30 Dec 2003 00:52:16 -0800 Subject: [PATCH] 011_bk tag --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 4c8c8d7dad..06c564ec57 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 011 +VERSION = 011_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) diff --git a/udev.spec b/udev.spec index 4283521326..a81720e7c4 100644 --- a/udev.spec +++ b/udev.spec @@ -18,7 +18,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 011 +Version: 011_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From e15b5ed5ded18af1329b304fc650a1cbc8123ccc Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 00:54:29 -0800 Subject: [PATCH] small trivial cleanup of latest changes here is a patch for a typo in the man page, a whitespace cleanup and a replace for the magic hex ASCII in char operations. --- namedev_parse.c | 4 ++-- udev.8 | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index aec87d2771..2858a28091 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -176,7 +176,7 @@ int namedev_init_rules(void) ++temp; /* empty line? */ - if ((*temp == 0x00) || (*temp == 0x0a)) + if ((*temp == '\0') || (*temp == '\n')) continue; /* see if this is a comment */ @@ -376,7 +376,7 @@ int namedev_init_permissions(void) ++temp; /* empty line? */ - if ((*temp == 0x00) || (*temp == 0x0a)) + if ((*temp == '\0') || (*temp == '\n')) continue; /* see if this is a comment */ diff --git a/udev.8 b/udev.8 index 65af6d00a8..eb772c9dbe 100644 --- a/udev.8 +++ b/udev.8 @@ -78,7 +78,7 @@ udev_rules="/etc/udev/udev.rules" # udev_permissions - The name and location of the udev permission file udev_permissions="/etc/udev/udev.permissions" -# default_mode - set the default mode for all nodes that have no +# default_mode - set the default mode for all nodes that have no # explicit match in the permissions file default_mode="0666" .fi @@ -106,18 +106,18 @@ The line format is: where valid methods with corresponding keys are: .TP .B CALLOUT -calling external program, that returns a string to match. The -.BR BUS +calling external program, that returns a string to match. The +.B BUS key is optional, but if specified, the sysfs device bus must be able to be -detemined by a "device" symlink. +determined by a "device" symlink. .br .RB "keys: " BUS ", " PROGRAM ", " ID .TP .B LABEL device label or serial number, like USB serial number, SCSI UUID or file system label. Up to 5 different sysfs files can be checked, with -all of the values being required in order to match the rule. The -.BR BUS +all of the values being required in order to match the rule. The +.B BUS key is optional, but if specified, the sysfs device bus must be able to be detemined by a "device" symlink. .br -- cgit v1.2.3-54-g00ecf From 5e22c4df53cf8c8c3868cc9789027a929c4f9a60 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 30 Dec 2003 00:58:31 -0800 Subject: [PATCH] added udev.init script for the Linux From Scratch project. Thanks to Michael Buesch for providing it. --- etc/init.d/udev.init.lfs | 103 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 etc/init.d/udev.init.lfs diff --git a/etc/init.d/udev.init.lfs b/etc/init.d/udev.init.lfs new file mode 100644 index 0000000000..08c81733e1 --- /dev/null +++ b/etc/init.d/udev.init.lfs @@ -0,0 +1,103 @@ +#!/bin/sh +# +# LinuxFromScratch udev init script +# derived from original RedHat udev init script +# 2003 by Michael Buesch +# + +source /etc/sysconfig/rc +source $rc_functions + +udev_dir="/udev" +sysfs_dir="/sys" +bin="/sbin/udev" + +case "$1" in + start) + echo "Creating initial udev device nodes ..." + if [ ! -d $udev_dir ]; then + mkdir $udev_dir + if [ $? -ne 0 ]; then + print_status failure + exit 1 + fi + fi + if [ ! -d $sysfs_dir ]; then + echo "sysfs_dir $sysfs_dir does not exist!" + print_status failure + exit 1 + fi + # propogate /udev from /sys - we only need this while we do not + # have initramfs and an early user-space with which to do early + # device bring up + clean_exit="yes" + export ACTION=add + # add block devices and their partitions + for i in ${sysfs_dir}/block/*; do + # add each drive + export DEVPATH=${i#${sysfs_dir}} + $bin block + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${sysfs_dir}} + $bin block + if [ $? -ne 0 ]; then + echo "Warning: $DEVPATH failed." + clean_exit="no" + fi + fi + done + done + # all other device classes + for i in ${sysfs_dir}/class/*; do + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${sysfs_dir}} + CLASS=`echo ${i#${sysfs_dir}} | \ + cut --delimiter='/' --fields=3-` + $bin $CLASS + if [ $? -ne 0 ]; then + echo "Warning: $DEVPATH failed." + clean_exit="no" + fi + fi + done + done + if [ $clean_exit = "yes" ]; then + print_status success + else + print_status warning + fi + ;; + stop) + echo "Removing udev device nodes ..." + # be careful + if [ $udev_dir -a "$udev_dir" != "/" ]; then + # clear out /udev + rm -rf ${udev_dir}/* + evaluate_retval + fi + ;; + reload) + # nothing to do here + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + status) + if [ -d $udev_dir ]; then + echo "the udev device node directory exists" + else + echo "the udev device node directory does not exist" + fi + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac +exit 0 -- cgit v1.2.3-54-g00ecf From 41e559861b1c018b17f0ad2819fa73f0d98c066a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 30 Dec 2003 01:01:05 -0800 Subject: [PATCH] update the udev.permissions.debian file with new entries. Thanks to Mathieu Segaud for the information --- udev.permissions.debian | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/udev.permissions.debian b/udev.permissions.debian index b4ddacfcdd..294982a824 100644 --- a/udev.permissions.debian +++ b/udev.permissions.debian @@ -1,7 +1,11 @@ # name:user:group:mode -# character devices +# CHARACTER DEVICES +# tty devices +tty:root:tty:0660 +console:root:tty:0600 +ptmx:root:tty:0666 ttyACM*:root:dialout:0660 ttyUSB*:root:dialout:0660 ttyI*:root:dialout:0660 @@ -28,6 +32,20 @@ capi*:root:dialout:0660 dcbri*:root:dialout:0660 ircomm*:root:dialout:0660 +# Memory devices +random:root:root:0666 +urandom:root:root:0444 +mem:root:kmem:0640 +kmem:root:kmem:0640 +port:root:kmem:0640 +full:root:root:0666 +null:root:root:0666 +zero:root:root:0666 + +# Misc devices +nvram:root:root:0660 +rtc:root:root:0660 + admmidi*:root:audio:660 adsp*:root:audio:660 aload*:root:audio:660 @@ -55,7 +73,7 @@ input/*:root:root:644 dri/card*:root:root:666 -fb/*:root:video:0620 +fb*:root:video:0620 agpgart:root:video:0660 video*:root:video:0660 radio*:root:video:0660 @@ -63,7 +81,8 @@ vbi*:root:video:0660 vtx*:root:video:0660 mol:root:root:0600 -# block devices + +# BLOCK DEVICES floppy*:root:floppy:660 floppy/*:root:floppy:660 -- cgit v1.2.3-54-g00ecf From 3c90f15174e30a39e4dc05b5c99c647ef0623973 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 30 Dec 2003 01:02:59 -0800 Subject: [PATCH] udev.permissions.debian - forgot the dm nodes. --- udev.permissions.debian | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev.permissions.debian b/udev.permissions.debian index 294982a824..5df3d0feac 100644 --- a/udev.permissions.debian +++ b/udev.permissions.debian @@ -107,3 +107,5 @@ pt*:root:tape:0660 npt*:root:tape:0660 st*:root:tape:0660 nst*:root:tape:0660 + +dm-*:root:root:0640 -- cgit v1.2.3-54-g00ecf From 2441c20743e62f135d1b52cb3fa47b29d59fbef6 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 01:07:55 -0800 Subject: [PATCH] 'ide' missing in bus_files[] my syslog want's to contact you :) Dec 25 20:37:48 pim udev[2274]: wait_for_device_to_initialize: Did not find bus type 'ide' on list of bus_id_files, contact greg@kroah.com We need to put 'ide' to the bus_files array, don't know which file to use... --- namedev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/namedev.c b/namedev.c index 813f26b035..949c2eedf6 100644 --- a/namedev.c +++ b/namedev.c @@ -252,6 +252,7 @@ static struct bus_file { } bus_files[] = { { .bus = "scsi", .file = "vendor" }, { .bus = "usb", .file = "idVendor" }, + { .bus = "ide", .file = "detach_state" }, { .bus = "pci", .file = "vendor" }, {} }; -- cgit v1.2.3-54-g00ecf From 0529e2ed2eb1ccfd28d2cd33ce759f9c7b9bc0ff Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 01:07:57 -0800 Subject: [PATCH] check for empty symlink string Attached is a patch for udev-add.c to ignore empty symlink string parts. Issue was brought up by ide-devfs.sh with only one symlink returned, while two are expected. --- udev-add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev-add.c b/udev-add.c index ba5c864165..2f72613ea9 100644 --- a/udev-add.c +++ b/udev-add.c @@ -193,7 +193,7 @@ static int create_node(struct udevice *dev) symlinks = dev->symlink; while (1) { linkname = strsep(&symlinks, " "); - if (linkname == NULL) + if (linkname == NULL || linkname[0] == '\0') break; strncpy(filename, udev_root, sizeof(filename)); -- cgit v1.2.3-54-g00ecf From 647c8fc43eb8f3d92ed7142f7c235f3db02f4cfa Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 01:07:59 -0800 Subject: [PATCH] fix for apply_format() fix possible NULL pointer in '%c' callout substitution and cleanup '%D' debug text --- namedev.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/namedev.c b/namedev.c index 949c2eedf6..e69eba657a 100644 --- a/namedev.c +++ b/namedev.c @@ -200,11 +200,12 @@ static void apply_format(struct udevice *udev, unsigned char *string) case 'D': if (strlen(udev->kernel_number) == 0) { strcat(pos, "disc"); + dbg("substitute devfs disc"); break; } strcat(pos, "part"); strcat(pos, udev->kernel_number); - dbg("substitute kernel number '%s'", udev->kernel_number); + dbg("substitute devfs part '%s'", udev->kernel_number); break; case 'm': sprintf(pos, "%u", udev->minor); @@ -229,8 +230,10 @@ static void apply_format(struct udevice *udev, unsigned char *string) break; } } - strcat(pos, pos3); - dbg("substitute partial callout output '%s'", pos3); + if (pos3) { + strcat(pos, pos3); + dbg("substitute partial callout output '%s'", pos3); + } } else { strcat(pos, udev->callout_value); dbg("substitute callout output '%s'", udev->callout_value); -- cgit v1.2.3-54-g00ecf From bbc1c767b21e17a51dbe1b5edb2c379c5fce7e95 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 01:08:00 -0800 Subject: [PATCH] ide-devfs.sh update Attached is a patch for ide-devfs.sh, The script is merged with the one from Martin Schlemmer, and cleaned up by him, to create both types of symlinks with one single rule: CALLOUT, BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c %3c" /udev/ |-- cdroms | `-- cdrom0 -> ../hdc |-- discs | |-- disc0 | | |-- disc -> ../../hda | | |-- part1 -> ../../hda1 | | |-- part2 -> ../../hda2 | | `-- part4 -> ../../hda4 | |-- disc1 | | |-- disc -> ../../hdb | | `-- part1 -> ../../hdb1 | `-- disc2 | |-- disc -> ../../hde | `-- part1 -> ../../hde1 |-- hda |-- hda1 |-- hda2 |-- hda4 |-- hdb |-- hdb1 |-- hdc |-- hde |-- hde1 `-- ide |-- host0 | |-- bus0 | | |-- target0 | | | `-- lun0 | | | |-- disc -> ../../../../../hda | | | |-- part1 -> ../../../../../hda1 | | | |-- part2 -> ../../../../../hda2 | | | `-- part4 -> ../../../../../hda4 | | `-- target1 | | `-- lun0 | | |-- disc -> ../../../../../hdb | | `-- part1 -> ../../../../../hdb1 | `-- bus1 | `-- target0 | `-- lun0 | `-- cd -> ../../../../../hdc `-- host2 `-- bus0 `-- target0 `-- lun0 |-- disc -> ../../../../../hde `-- part1 -> ../../../../../hde1 --- extras/ide-devfs.sh | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 3409c407eb..db96b5d299 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -2,26 +2,46 @@ # udev CALLOUT script # return devfs-names for ide-devices -# CALLOUT, BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c" +# CALLOUT, BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c %3c" -HOST=${2%\.[0-9]} -TARGET=${2#[0-9]\.} +HOST="${2%\.[0-9]}" +TARGET="${2#[0-9]\.}" -if [ -z ${HOST#[13579]} ]; then - HOST=`expr $HOST - 1` +if [ -z "${HOST#[13579]}" ]; then + HOST=`expr ${HOST} - 1` BUS="1" else BUS="0" fi +get_dev_number() { + local x= + local num=0 + local MEDIA= + local DRIVE="${1%[0-9]*}" + + for x in /proc/ide/*/media; do + if [ -e "${x}" ]; then + MEDIA=`cat ${x}` + if [ "${MEDIA}" = "$2" ]; then + num=`expr ${num} + 1` + fi + if [ "${x}" = "/proc/ide/${DRIVE}/media" ]; then + break + fi + fi + done + + echo `expr ${num} - 1` +} + if [ -z "$3" ]; then - MEDIA=`cat /proc/ide/$1/media` - if [ "$MEDIA" = "cdrom" ]; then - echo $1 ide/host$HOST/bus$BUS/target$TARGET/lun0/cd - elif [ "$MEDIA" = "disk" ]; then - echo $1 ide/host$HOST/bus$BUS/target$TARGET/lun0/disc + MEDIA=`cat /proc/ide/${1}/media` + if [ "${MEDIA}" = "cdrom" ]; then + echo ${1} ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` + elif [ "${MEDIA}" = "disk" ]; then + echo $1 ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc fi else - echo $1 ide/host$HOST/bus$BUS/target$TARGET/lun0/part$3 + echo $1 ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/part$3 discs/disc`get_dev_number $1 disk`/part$3 fi - -- cgit v1.2.3-54-g00ecf From f732a97ebe079413524fb992a119b9579bd04136 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 01:08:02 -0800 Subject: [PATCH] extend exec_program[] extend exec_program size to 100 chars cause: PROGRAM="/home/kay/src/udev.kay/extras/ide-devfs.sh %k %b %n" is too long :) --- namedev.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/namedev.h b/namedev.h index 1eaf4fee4d..1ac71069ad 100644 --- a/namedev.h +++ b/namedev.h @@ -43,6 +43,7 @@ enum config_type { #define VALUE_SIZE 100 #define ID_SIZE 50 #define PLACE_SIZE 50 +#define PROGRAM_SIZE 100 #define TYPE_LABEL "LABEL" #define TYPE_NUMBER "NUMBER" @@ -75,7 +76,7 @@ struct config_device { char id[ID_SIZE]; char place[PLACE_SIZE]; char kernel_name[NAME_SIZE]; - char exec_program[FILE_SIZE]; + char exec_program[PROGRAM_SIZE]; char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; -- cgit v1.2.3-54-g00ecf From 8ed89229bc8afed84ad6d587a6df29329bbbf440 Mon Sep 17 00:00:00 2001 From: "azarah@nosferatu.za.org" Date: Tue, 30 Dec 2003 01:18:28 -0800 Subject: [PATCH] Fix udev gcc-2.95.4 compat Two liner to get gcc-2.95.4 to compile udev. --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index e69eba657a..cff338f1a7 100644 --- a/namedev.c +++ b/namedev.c @@ -655,9 +655,9 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { temp = strrchr(filename, '/'); if (temp) { + char *temp2 = strrchr(filename, '/'); partition = 1; *temp = 0x00; - char *temp2 = strrchr(filename, '/'); dbg("temp2 = %s", temp2); if (temp2 && (strcmp(temp2, "/block") == 0)) { /* oops, we have no parent block device, so go back to original directory */ -- cgit v1.2.3-54-g00ecf From d12ecb53cf8c5955135b94e4b671ad28dfb3a7b4 Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Tue, 30 Dec 2003 01:21:06 -0800 Subject: [PATCH] introduce signal handler Here's a patch that adds a signal handler to udev to clean up the environment (close the sysbus and close the database) on kill-signals. --- udev.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/udev.c b/udev.c index 71c5f1fba5..1d66410b6c 100644 --- a/udev.c +++ b/udev.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "udev.h" #include "udev_version.h" @@ -40,6 +41,22 @@ char **main_argv; char **main_envp; +static void sig_handler(int signum) +{ + dbg("caught signal %d", signum); + switch (signum) { + case SIGINT: + case SIGTERM: + case SIGKILL: + sysbus_disconnect(); + udevdb_exit(); + exit(20 + signum); + break; + default: + dbg("unhandled signal"); + } +} + static inline char *get_action(void) { char *action; @@ -70,7 +87,11 @@ int main(int argc, char **argv, char **envp) char *devpath; char *subsystem; int retval = -EINVAL; - + + signal(SIGINT, sig_handler); + signal(SIGTERM, sig_handler); + signal(SIGKILL, sig_handler); + main_argv = argv; main_envp = envp; -- cgit v1.2.3-54-g00ecf From 3fd52a7694d94b57fc5a0dc380673a78683118fe Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 30 Dec 2003 01:29:16 -0800 Subject: [PATCH] move the signal handling registration to after we have initialized enough stuff. --- udev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/udev.c b/udev.c index 1d66410b6c..17eade221e 100644 --- a/udev.c +++ b/udev.c @@ -88,10 +88,6 @@ int main(int argc, char **argv, char **envp) char *subsystem; int retval = -EINVAL; - signal(SIGINT, sig_handler); - signal(SIGTERM, sig_handler); - signal(SIGKILL, sig_handler); - main_argv = argv; main_envp = envp; @@ -143,6 +139,11 @@ int main(int argc, char **argv, char **envp) goto exit_sysbus; } + /* set up a default signal handler for now */ + signal(SIGINT, sig_handler); + signal(SIGTERM, sig_handler); + signal(SIGKILL, sig_handler); + /* initialize the naming deamon */ namedev_init(); -- cgit v1.2.3-54-g00ecf From 13148857cb880c421711db60ad1785ed8e373906 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 01:29:25 -0800 Subject: [PATCH] cleanup namedev_parse debug text I missed a few spaces with my recent change. --- namedev_parse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index 2858a28091..02ffb0a3e7 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -294,7 +294,7 @@ keys: goto error; break; case NUMBER: - dbg_parse(TYPE_NUMBER "name='%s', bus='%s', id='%s', symlink='%s'", + dbg_parse(TYPE_NUMBER " name='%s', bus='%s', id='%s', symlink='%s'", dev.name, dev.bus, dev.id, dev.symlink); if ((*dev.name == '\0') || (*dev.bus == '\0') || @@ -302,7 +302,7 @@ keys: goto error; break; case TOPOLOGY: - dbg_parse(TYPE_TOPOLOGY "name='%s', bus='%s', " + dbg_parse(TYPE_TOPOLOGY " name='%s', bus='%s', " "place='%s', symlink='%s'", dev.name, dev.bus, dev.place, dev.symlink); if ((*dev.name == '\0') || @@ -311,14 +311,14 @@ keys: goto error; break; case REPLACE: - dbg_parse(TYPE_REPLACE "name='%s', kernel_name='%s', symlink='%s'", + dbg_parse(TYPE_REPLACE " name='%s', kernel_name='%s', symlink='%s'", dev.name, dev.kernel_name, dev.symlink); if ((*dev.name == '\0') || (*dev.kernel_name == '\0')) goto error; break; case CALLOUT: - dbg_parse(TYPE_CALLOUT "name='%s', bus='%s', program='%s', " + dbg_parse(TYPE_CALLOUT " name='%s', bus='%s', program='%s', " "id='%s', symlink='%s'", dev.name, dev.bus, dev.exec_program, dev.id, dev.symlink); -- cgit v1.2.3-54-g00ecf From 3f09184b43dfd8b27fb05786a789f392de18bfca Mon Sep 17 00:00:00 2001 From: "azarah@nosferatu.za.org" Date: Tue, 30 Dec 2003 01:33:35 -0800 Subject: [PATCH] make symlink work properly if there is already a file in its place If a file that is not a symlink (node, socket, fifo, etc) already exist where udev need to create a symlink, symlink() fails. This patch basically test for an existing file, and unlink it. --- udev-add.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/udev-add.c b/udev-add.c index 2f72613ea9..802d85b5b0 100644 --- a/udev-add.c +++ b/udev-add.c @@ -100,6 +100,7 @@ static int create_path(char *file) static int create_node(struct udevice *dev) { + struct stat stats; char filename[255]; char linktarget[255]; char *linkname; @@ -221,6 +222,16 @@ static int create_node(struct udevice *dev) strcpy(linktarget, "./"); strcat(linktarget, &dev->name[tail]); + /* unlink existing non-directories to ensure that our symlink + * is created */ + if (lstat(filename, &stats) == 0) { + if ((stats.st_mode & S_IFMT) != S_IFDIR) { + if (unlink(filename)) + dbg("unlink(%s) failed with error '%s'", + filename, strerror(errno)); + } + } + dbg("symlink(%s, %s)", linktarget, filename); retval = symlink(linktarget, filename); if (retval) -- cgit v1.2.3-54-g00ecf From c78cb204bc64bce32e705dead071bd4149b731ac Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 22:25:12 -0800 Subject: [PATCH] depend on all .h files Let the build depend on all header files. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 06c564ec57..9d0ece9c3f 100644 --- a/Makefile +++ b/Makefile @@ -214,7 +214,7 @@ udev.conf: $(OBJS): $(GEN_HEADERS) -$(ROOT): $(OBJS) udev.h namedev.h +$(ROOT): $(OBJS) udev.h namedev.h udev_version.h udev_dbus.h udevdb.h klibc_fixups.h list.h $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) -- cgit v1.2.3-54-g00ecf From f4dc8d11c22ef72567a2e5c56ac9bae82867189b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Dec 2003 22:31:37 -0800 Subject: [PATCH] make udev user callable to query the database Here is a slightly better version that prints the usage if a unknown option is given: kay@pim:~/src/udev.kay$ ./udev -x ./udev: invalid option -- x Usage: [-qrVh] -q arg query database -r print udev root -V print udev version -h print this help text > Here is a patch that makes it possible to call udev with options on the command line. > Valid options are for now: > > -V for the udev version: > kay@pim:~/src/udev.kay$ ./udev -V > udev, version 011_bk > > -r for the udev root: > kay@pim:~/src/udev.kay$ ./udev -r > /udev/ > > -q to query the database with the sysfs path for the name of the node: > kay@pim:~/src/udev.kay$ ./udev -q /class/video4linux/video0 > test/video/webcam0 --- udev.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- udevdb.c | 13 +++++++++ udevdb.h | 1 + 3 files changed, 96 insertions(+), 13 deletions(-) diff --git a/udev.c b/udev.c index 17eade221e..1797e08273 100644 --- a/udev.c +++ b/udev.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "udev.h" #include "udev_version.h" @@ -81,23 +82,70 @@ static inline char *get_seqnum(void) return seqnum; } -int main(int argc, char **argv, char **envp) +static inline int udev_user(int argc, char **argv) { - char *action; - char *devpath; - char *subsystem; + static const char short_options[] = "q:rVh"; + int option; int retval = -EINVAL; + struct udevice dev; - main_argv = argv; - main_envp = envp; + while (1) { + option = getopt(argc, argv, short_options); + if (option == -1) + break; - dbg("version %s", UDEV_VERSION); + dbg("option '%c'", option); + switch (option) { + case 'q': + dbg("udev query: %s\n", optarg); + retval = udevdb_open_ro(); + if (retval != 0) { + printf("unable to open udev database\n"); + return -1; + } + retval = udevdb_get_dev(optarg, &dev); + if (retval == 0) { + printf("%s\n", dev.name); + } else { + printf("device not found in udev database\n"); + } + udevdb_exit(); + return retval; - if (argc != 2) { - dbg ("unknown number of arguments"); - goto exit; + case 'r': + printf("%s\n", udev_root); + return 0; + + case 'V': + printf("udev, version %s\n", UDEV_VERSION); + return 0; + + case 'h': + retval = 0; + case '?': + default: + goto help; + } } +help: + printf("Usage: [-qrVh]\n" + " -q arg query database \n" + " -r print udev root\n" + " -V print udev version\n" + " -h print this help text\n" + "\n"); + + return retval; +} + +static inline int udev_hotplug(int argc, char **argv) +{ + char *action; + char *devpath; + char *subsystem; + int retval = -EINVAL; + subsystem = argv[1]; devpath = get_devpath(); @@ -126,9 +174,6 @@ int main(int argc, char **argv, char **envp) goto exit; } - /* initialize our configuration */ - udev_init_config(); - /* connect to the system message bus */ sysbus_connect(); @@ -166,3 +211,27 @@ exit_sysbus: exit: return retval; } + +int main(int argc, char **argv, char **envp) +{ + main_argv = argv; + main_envp = envp; + int retval; + + dbg("version %s", UDEV_VERSION); + + /* initialize our configuration */ + udev_init_config(); + + if (argc == 2 && argv[1][0] != '-') { + dbg("called by hotplug"); + retval = udev_hotplug(argc, argv); + } else { + dbg("called by user"); + retval = udev_user(argc, argv); + } + + return retval; +} + + diff --git a/udevdb.c b/udevdb.c index bbbeddad47..0f9de661a4 100644 --- a/udevdb.c +++ b/udevdb.c @@ -128,3 +128,16 @@ int udevdb_init(int init_flag) } return 0; } + +/** + * udevdb_init: open database for reading + */ +int udevdb_open_ro(void) +{ + udevdb = tdb_open(udev_db_filename, 0, 0, O_RDONLY, 0); + if (udevdb == NULL) { + dbg("unable to open database at '%s'", udev_db_filename); + return -EINVAL; + } + return 0; +} diff --git a/udevdb.h b/udevdb.h index d6c58ae766..f36a9ca799 100644 --- a/udevdb.h +++ b/udevdb.h @@ -11,6 +11,7 @@ /* function prototypes */ extern void udevdb_exit(void); extern int udevdb_init(int init_flag); +extern int udevdb_open_ro(void); extern int udevdb_add_dev(const char *path, const struct udevice *dev); extern int udevdb_get_dev(const char *path, struct udevice *dev); -- cgit v1.2.3-54-g00ecf From 9107fb88ba7a7b2eb09f01e311cdc2b29d04a123 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Tue, 30 Dec 2003 22:36:17 -0800 Subject: [PATCH] extras multipath update 2003-12-29 multipath-012 * refresh doc * add the uninstall target in Makefile * /sbin/multipath, not /root/multipath in hotplug agent --- extras/multipath/ChangeLog | 3 +++ extras/multipath/Makefile | 4 ++++ extras/multipath/README | 18 ++++++++---------- extras/multipath/multipath.hotplug | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index 730d6e34a6..9296b4db68 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,3 +1,6 @@ +2003-12-29 multipath-012 + * refresh doc + * add the uninstall target in Makefile 2003-12-22 multipath-010 * tweak the install target in Makefile * stop passing fds as argument : this change enable a strict diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index 99036a6a00..3f13532e16 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -55,5 +55,9 @@ install: install -d /etc/hotplug.d/scsi/ install -m 755 multipath.hotplug /etc/hotplug.d/scsi/ +uninstall: + rm /etc/hotplug.d/scsi/multipath.hotplug + rm $(bindir)/$(EXEC) + # Code dependencies main.o: main.c main.h sg_include.h diff --git a/extras/multipath/README b/extras/multipath/README index 6a5637de4b..951c2788bc 100644 --- a/extras/multipath/README +++ b/extras/multipath/README @@ -3,6 +3,7 @@ Dependancies : o libdevmapper : comes with device-mapper-XXXX.tar.gz See www.sistina.com + This lib has been dropped in the multipath tree o libsysfs : comes with sysutils See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ @@ -34,8 +35,9 @@ In 2.5+, we rely on libsysfs (sysutils) to access to sysfs device enums. the wwid is retrieved by a switch fonction. Only White -Listed HW can filled this field. For now only -StorageWorks HW is White Listed. (See notes) +Listed HW can filled this field. For now every FC array +HW listed in kernel's devinfo.c is White Listed, assuming +the WWID is stored is the SCSI-3 standard 0x83 EVPD page. When all_paths is filled, we coalesce the paths and store the result in mp array. Each mp is a struct like this : @@ -47,25 +49,21 @@ struct multipath { }; When mp is filled, the device maps are fed to the kernel -through libdevmapper. Stale paths (failed TUR) are -discarded. +through libdevmapper. Notes : ======= -o make sure you have enough /dev/sg* nodes - (/dev/MAKEDEV if necesary) +o On 2.4, make sure you have enough /dev/sg* nodes + (/dev/MAKEDEV if necesary). Same goes for /dev/sd* o path coalescing relies on a path unique id being found. This unique id, lacking a standard method, is vendor specific. A switch function (get_unique_id) is present and an example function is provided for storageworks - arrays (get_storageworks_wwid). Feel free to enrich + arrays (get_evpd_wwid). Feel free to enrich with hardware you have at hand :) -o Something goes wrong with sd.o, qla2200 & dm-mod - refcounting : I can't unload these modules after exec. - o The kernel does NOT manage properly ghosts paths with StorageWorks HW. Seems nobody cares after a load of posts to linux-scsi. diff --git a/extras/multipath/multipath.hotplug b/extras/multipath/multipath.hotplug index db7894cb99..8d60f4d2c6 100644 --- a/extras/multipath/multipath.hotplug +++ b/extras/multipath/multipath.hotplug @@ -1,3 +1,3 @@ . /etc/hotplug/hotplug.functions sleep 1 -mesg `/root/multipath scsi $DEVPATH` +mesg `/sbin/multipath scsi $DEVPATH` -- cgit v1.2.3-54-g00ecf From b02d14d0a6210ceb76e097a56109abeecdd2b112 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Tue, 30 Dec 2003 22:39:37 -0800 Subject: [PATCH] extras multipath update incremental to 0.0.12-1, * check hotplug event refers to a block device; if not exit early --- extras/multipath/ChangeLog | 1 + extras/multipath/main.c | 6 +++++- extras/multipath/multipath.hotplug | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index 9296b4db68..a780865d3e 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,4 +1,5 @@ 2003-12-29 multipath-012 + * check hotplug event refers to a block device; if not exit early * refresh doc * add the uninstall target in Makefile 2003-12-22 multipath-010 diff --git a/extras/multipath/main.c b/extras/multipath/main.c index f62e0f9954..a8e29e8ba6 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -261,7 +261,11 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) sprintf(buff, "%s%s/block", conf->sysfs_path, conf->hotplugdev); memset(conf->hotplugdev, 0, FILE_NAME_SIZE); - readlink(buff, conf->hotplugdev, FILE_NAME_SIZE); + + /* if called from hotplug but with no block, leave */ + if (0 > readlink(buff, conf->hotplugdev, FILE_NAME_SIZE)) + return 0; + basename(conf->hotplugdev, buff); sprintf(curpath.sg_dev, "/dev/%s", buff); diff --git a/extras/multipath/multipath.hotplug b/extras/multipath/multipath.hotplug index 8d60f4d2c6..9bab619826 100644 --- a/extras/multipath/multipath.hotplug +++ b/extras/multipath/multipath.hotplug @@ -1,3 +1,6 @@ . /etc/hotplug/hotplug.functions + +# wait for sysfs sleep 1 + mesg `/sbin/multipath scsi $DEVPATH` -- cgit v1.2.3-54-g00ecf From 3310f9d0e8a585c4b96d558a34b06b47699586b1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Dec 2003 00:25:01 -0800 Subject: [PATCH] added udev vs devfs supid document to the tree. --- docs/udev_vs_devfs | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 docs/udev_vs_devfs diff --git a/docs/udev_vs_devfs b/docs/udev_vs_devfs new file mode 100644 index 0000000000..5a46231c1f --- /dev/null +++ b/docs/udev_vs_devfs @@ -0,0 +1,190 @@ + udev and devfs - The final word + + December 30, 2003 + Greg Kroah-Hartman + + + +Executive summary for those too lazy to read this whole thing: + I don't care about devfs, and I don't want to talk about it at + all anymore. If you love devfs, fine, I'm not trying to tell + anyone what to do. But you really should be looking into using + udev instead. All further email messages sent to me about devfs + will be gladly ignored. + + +First off, some background. For a description of udev, and what it's +original design goals were, please see the OLS 2003 paper on udev, +available at: + +and the slides for the talk, available at: + +The OLS paper can also be found in the docs/ directory of the udev +tarball, available on kernel.org in the /pub/linux/utils/kernel/hotplug/ +directory. + +In that OLS paper, I described the current situation of a static /dev +and the current problems that a number of people have with it. I also +detailed how devfs tries to solve a number of these problems. In +hindsight, I should have never mentioned the word, devfs, when talking +about udev. I did so only because it seemed like a good place to start +with. Most people understood what devfs is, and what it does. To +compare udev against it, showing how udev was more powerful, and a more +complete solution to the problems people were having, seemed like a +natural comparison to me. + +But no more. I hereby never want to compare devfs and udev again. With +the exception of this message... + +The Problems: + 1) A static /dev is unwieldy and big. It would be nice to only show + the /dev entries for the devices we actually have running in the + system. + 2) We are (well, were) running out of major and minor numbers for + devices. + 3) Users want a way to name devices in a persistent fashion (i.e. "This + disk here, must _always_ be called "boot_disk" no matter where in + the scsi tree I put it", or "This USB camera must always be called + "camera" no matter if I have other USB scsi devices plugged in or + not.") + 4) Userspace programs want to know when devices are created or removed, + and what /dev entry is associated with them. + +The constraints: + 1) No policy in the kernel! + 2) Follow standards (like the LSB) + 3) must be small so embedded devices will use it. + + +So, how does devfs stack up to the above problems and constraints: + Problems: + 1) devfs only shows the dev entries for the devices in the system. + 2) devfs does not handle the need for dynamic major/minor numbers + 3) devfs does not provide a way to name devices in a persistent + fashion. + 4) devfs does provide a deamon that userspace programs can hook into + to listen to see what devices are being created or removed. + Constraints: + 1) devfs forces the devfs naming policy into the kernel. If you + don't like this naming scheme, tough. + 2) devfs does not follow the LSB device naming standard. + 3) devfs is small, and embedded devices use it. However it is + implemented in non-pagable memory. + +Oh yeah, and there are the insolvable race conditions with the devfs +implementation in the kernel, but I'm not going to talk about them right +now, sorry. See the linux-kernel archives if you care about them (and +if you use devfs, you should care...) + +So devfs is 2 for 7, ignoring the kernel races. + +And now for udev: + Problems: + 1) using udev, the /dev tree only is populated for the devices that + are currently present in the system. + 2) udev does not care about the major/minor number schemes. If the + kernel tomorrow switches to randomly assign major and minor numbers + to different devices, it would work just fine (this is exactly + what I am proposing to do in 2.7...) + 3) This is the main reason udev is around. It provides the ability + to name devices in a persistent manner. More on that below. + 4) udev emits D-BUS messages so that any other userspace program + (like HAL) can listen to see what devices are created or removed. + It also allows userspace programs to query it's database to see + what devices are present and what they are currently named as + (providing a pointer into the sysfs tree for that specific device + node.) + Constraints: + 1) udev moves _all_ naming policies out of the kernel and into + userspace. + 2) udev defaults to using the LSB device naming standard. If users + want to deviate away from this standard (for example when naming + some devices in a persistent manner), it is easily possible to do + so. + 3) udev is small (49Kb binary) and is entirely in userspace, which + is swapable, and doesn't have to be running at all times. + +Nice, 7 out of 7 for udev. Makes you think the problems and constraints +were picked by a udev developer, right? No, the problems and +constraints are ones I've seen over the years and so udev, along with +the kernel driver model and sysfs, were created to solve these real +problems. + +So by just looking at the above descriptions, everyone should instantly +realize that udev is far better than devfs and start helping out udev +development, right? Oh, you want more info, ok... + +Back in May 2003 I released a very tiny version of udev that implemented +everything that devfs currently does, in about 6Kb of userspace code: + http://marc.theaimsgroup.com/?l=linux-kernel&m=105003185331553 + +Yes, that's right, 6Kb. So, you are asking, why are you still working +on udev if it did everything devfs did back in May 2003? That's because +just managing static device nodes based on what the kernel calls the +devices is _not_ the primary goal of udev. It's just a tiny side affect +of it's primary goal, the ability to never worry about major/minor +number assignments and provide the ability to achieve persistent device +names if wanted. + +All the people wanting to bring up the udev vs. devfs argument go back +and read the previous paragraph. Yes, all Gentoo users who keep filling +up my inbox with smoking emails, I mean you. + +So, how well does udev solve it's goals: + Prevent users from ever worrying about major/minor numbers + And here you were, not knowing you ever needed to worry about + major/minor numbers in the first place, right? Ah, I see you + haven't plugged in 2 USB printers and tried to figure out which + printer was which /dev entry? Or plugged in 4000 SCSI disks and + tried to figure out how to access that 3642nd disk and what it was + called in /dev. Or plugged in a USB camera and a USB flash drive + and then tried to download the pictures off of the flash drive by + accident? + + As the above scenarios show, both desktop users and big iron users + both need to not worry about which device is assigned to what + major/minor device. + + udev doesn't care what major/minor number is assigned to a device. + It merely takes the numbers that the kernel says it assigned to the + device and creates a device node based on it, which the user can + then use (if you don't understand the whole major/minor to device + node issue, or even what a device node is, trust me, you don't + really want to, go install udev and don't worry about it...) As + stated above, if the kernel decides to start randomly assigning + major numbers to all devices, then udev will still work just fine. + + Provide a persistent device naming solution: + Lots of people want to assign a specific name that they can talk to + a device to, no matter where it is in the system, or what order they + plugged the device in. USB printers, SCSI disks, PCI sound cards, + Firewire disks, USB mice, and lots of other devices all need to be + assigned a name in a consistent manner (udev doesn't handle network + devices, naming them is already a solved solution, using nameif). + udev allows users to create simple rules to describe what device to + name. If users want to call a program running a large database + half-way around the world, asking it what to name this device, it + can. We don't put the naming database into the kernel (like other + Unix variants have), everything is in userspace, and easily + accessible. You can even run a perl script to name your device if + you are that crazy... + + For more information on how to create udev rules to name devices, + please see the udev man page, and look at the example udev rules + that ship with the tarball. + + +So, convinced already why you should use udev instead of devfs? No. +Ok, fine, I'm not forcing you to abandon your bloated, stifling policy, +nonextensible, end of life feature if you don't want to. But please +don't bother me about it either, I don't care about devfs, only about +udev. + +This is my last posting about this topic, all further emails sent to me +about why devfs is wonderful, and why are you making fun of this +wonderful, stable gift from the gods, will be gleefully ignored and +possibly posted in a public place where others can see. + +thanks, + +greg k-h -- cgit v1.2.3-54-g00ecf From 1237229594bf02f63922e481462efe0dae4294e4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Dec 2003 00:28:05 -0800 Subject: [PATCH] minor change to udev_vs_devfs document. --- docs/udev_vs_devfs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/udev_vs_devfs b/docs/udev_vs_devfs index 5a46231c1f..17853f881f 100644 --- a/docs/udev_vs_devfs +++ b/docs/udev_vs_devfs @@ -108,7 +108,9 @@ Nice, 7 out of 7 for udev. Makes you think the problems and constraints were picked by a udev developer, right? No, the problems and constraints are ones I've seen over the years and so udev, along with the kernel driver model and sysfs, were created to solve these real -problems. +problems. I also have had the luxury to see the problems that the +current devfs implementation has, and have taken the time to work out +something that does not have those same problems. So by just looking at the above descriptions, everyone should instantly realize that udev is far better than devfs and start helping out udev -- cgit v1.2.3-54-g00ecf From 5bfabc59c06f28405af3735603f3ce986e9b8b3e Mon Sep 17 00:00:00 2001 From: "rml@ximian.com" Date: Wed, 31 Dec 2003 00:34:49 -0800 Subject: [PATCH] udev spec file update More udev spec file updates. This one from David Zeuthen. Attached patch, against udev-011, makes sure we pass USE_DBUS and also makes sure we install the D-BUS policy file, if the %{dbus} option is set. --- udev.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/udev.spec b/udev.spec index a81720e7c4..9b5ef54cef 100644 --- a/udev.spec +++ b/udev.spec @@ -48,7 +48,10 @@ make CC="gcc $RPM_OPT_FLAGS" \ %endif %install -make DESTDIR=$RPM_BUILD_ROOT install +make DESTDIR=$RPM_BUILD_ROOT install \ +%if %{dbus} + USE_DBUS=true +%endif %post /sbin/chkconfig --add udev @@ -70,6 +73,9 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf %config(noreplace) %attr(0644,root,root) /etc/udev/udev.rules %config(noreplace) %attr(0644,root,root) /etc/udev/udev.permissions +%if %{dbus} + %config(noreplace) %attr(0644,root,root) /etc/dbus-1/system.d/udev_sysbus_policy.conf +%endif %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(755,root,root) /etc/init.d/udev %attr(0644,root,root) %{_mandir}/man8/udev.8* -- cgit v1.2.3-54-g00ecf From 4070d2fea01f3c9ee9b9761b5ec795e2c13b126b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 31 Dec 2003 00:34:51 -0800 Subject: [PATCH] mention user callable udev + options in man page As usual, here is the corresponding man page update and a small text correction. --- udev.8 | 24 ++++++++++++++++++++++++ udev.c | 2 +- udevdb.c | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/udev.8 b/udev.8 index eb772c9dbe..5f497af92a 100644 --- a/udev.8 +++ b/udev.8 @@ -3,6 +3,9 @@ udev \- Linux configurable dynamic device naming support .SH SYNOPSIS .BI udev " hotplug-subsystem" +.br +.B udev +.RI "[-q " sysfs_path "] [-rVh]" .SH "DESCRIPTION" .B udev creates or removes device node files usually located in the /dev directory. @@ -26,6 +29,27 @@ maintains a database for devices present on the system. On device removal, .B udev queries the internal database for the name of the device file to be deleted. +.SH "OPTIONS" +.B udev +normally is called by +.B hotplug +with the subsystem as argument and various environment variables set. +.br +It may also called with the following options: +.TP +.B -V +Print the version information. +.TP +.B -r +Print the the +.B udev +root directory. +.TP +.BI -q " sysfs_path" +Query with the sysfs path as argument for the name of the created device node. +.TP +.B -h +Print help text. .SH "CONFIGURATION" All .B udev diff --git a/udev.c b/udev.c index 1797e08273..0d0a5da207 100644 --- a/udev.c +++ b/udev.c @@ -130,7 +130,7 @@ static inline int udev_user(int argc, char **argv) help: printf("Usage: [-qrVh]\n" - " -q arg query database \n" + " -q query database for the name of the created node\n" " -r print udev root\n" " -V print udev version\n" " -h print this help text\n" diff --git a/udevdb.c b/udevdb.c index 0f9de661a4..ca9e63c97e 100644 --- a/udevdb.c +++ b/udevdb.c @@ -130,7 +130,7 @@ int udevdb_init(int init_flag) } /** - * udevdb_init: open database for reading + * udevdb_open_ro: open database for reading */ int udevdb_open_ro(void) { -- cgit v1.2.3-54-g00ecf From fb43c2b2e8aee09662226cb8ee8cb9ac93f32890 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Dec 2003 19:11:04 -0800 Subject: [PATCH] if using glibc, link dynamically, as no one like 500Kb udev binaries... --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9d0ece9c3f..8b20612de0 100644 --- a/Makefile +++ b/Makefile @@ -114,8 +114,9 @@ else STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment endif -# If we are using our version of klibc, then we need to build and link it. -# Otherwise, use glibc and link statically. +# If we are using our version of klibc, then we need to build, link it, and then +# link udev against it statically. +# Otherwise, use glibc and link dynamically. ifeq ($(strip $(USE_KLIBC)),true) KLIBC_BASE = $(PWD)/klibc KLIBC_DIR = $(KLIBC_BASE)/klibc @@ -139,7 +140,7 @@ else LIBC = CFLAGS += -I$(GCCINCDIR) LIB_OBJS = -lc - LDFLAGS = --static + LDFLAGS = endif CFLAGS += -I$(PWD)/libsysfs -- cgit v1.2.3-54-g00ecf From 9f7fff04ee0b58f22936693649edb7bd1f5ea8bf Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Dec 2003 20:28:15 -0800 Subject: [PATCH] add Gentoo versions of the rules and permissions files. --- etc/udev/udev.permissions.gentoo | 176 +++++++++++++++++++++++++++++++++++++++ etc/udev/udev.rules.gentoo | 97 +++++++++++++++++++++ 2 files changed, 273 insertions(+) create mode 100644 etc/udev/udev.permissions.gentoo create mode 100644 etc/udev/udev.rules.gentoo diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo new file mode 100644 index 0000000000..c2016bc280 --- /dev/null +++ b/etc/udev/udev.permissions.gentoo @@ -0,0 +1,176 @@ +# /etc/udev/udev.permissions: permission/ownership map for udev +# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.permissions,v 1.2 2003/12/26 23:32:44 azarah Exp $ + +# console devices +console:root:tty:0600 +tty[0-9][0-9]*:root:tty:0660 +vc/[0-9]*:root:tty:0660 + +# pty devices +# Set this to 0660 if you only want users belonging to tty group +# to be able to allocate PTYs +ptmx:root:tty:0666 +pty[p-za-e][0-9a-f]*:root:tty:0660 +tty[p-za-e][0-9a-f]*:root:tty:0660 +pty/m*:root:tty:0660 +vc/s*:root:tty:0660 + +# serial+dialup devices +ttyS*:root:tty:0660 +ippp*:root:tty:0660 +isdn*:root:tty:0660 +isdnctrl*:root:tty:0660 +capi*:root:tty:0660 +dcbri*:root:tty:0660 +ircomm*:root:tty:0660 +ttyUSB*:root:usb:0660 +tts/[0-9]*:root:tty:0660 +tts/USB[0-9]*:root:usb:0660 + +# vc devices +vcs:root:root:0600 +vcs[0-9]*:root:root:0600 +vcsa:root:root:0600 +vcsa[0-9]*:root:root:0600 +vcc/*:root:root:0600 + +# floppy devices +fd[01]*:root:floppy:0660 + +# audio devices +dsp*:root:audio:0660 +audio*:root:audio:0660 +midi*:root:audio:0660 +mixer*:root:audio:0660 +sequencer*:root:audio:0660 +sound/*:root:audio:0660 +snd/*:root:audio:0660 +beep:root:audio:0660 +admm*:root:audio:0660 +adsp*:root:audio:0660 +aload*:root:audio:0660 +amidi*:root:audio:0660 +dmfm*:root:audio:0660 +dmmidi*:root:audio:0660 +sndstat:root:audio:0660 + +# optical devices +sr*:root:cdrom:660 +scd*:root:cdrom:660 +pcd*:root:cdrom:0660 +cdrom*:root:cdrom:0660 +dvd:root:cdrom:0660 +rdvd:root:cdrom:0660 +cdroms/*:root:cdrom:0660 + +# pilot/palm devices +pilot:root:uucp:0660 + +# jaz devices +jaz*:root:disk:0660 + +# zip devices +pocketzip*:root:disk:0660 +zip*:root:disk:0660 + +# ls120 devices +ls120:root:disk:0660 +ls120*:root:disk:0660 + +# lp devices +lp*:root:lp:0660 +parport*:root:lp:0660 +irlpt*:root:lp:0660 +usblp*:root:lp:0660 +usb/lp*:root:lp:0660 + +# scanner devices +scanner:root:root:0600 +usb/scanner*:root:root:0600 + +# camera devices +camera*:root:root:0600 +usb/dc2xx*:root:root:0600 +usb/mdc800*:root:root:0600 + +# raw devices +ram*:root:disk:660 +raw/*:root:disk:660 + +# disk devices +hd*:root:disk:660 +sd*:root:disk:660 +dasd*:root:disk:660 +ataraid*:root:disk:660 +loop*:root:disk:660 +md*:root:disk:660 +ide/*/*/*/*/*:root:disk:660 +discs/*/*:root:disk:660 +loop/*:root:disk:660 +md/*:root:disk:660 + +# tape devices +ht*:root:tape:0660 +nht*:root:tape:0660 +pt[0-9]*:root:tape:0660 +npt*:root:tape:0660 +st*:root:tape:0660 +nst*:root:tape:0660 + +# memstick devices +memstick*:root:root:0600 + +# flash devices +flash*:root:root:0600 + +# diskonkey devices +diskonkey*:root:disk:0660 + +# rem_ide devices +microdrive*:root:disk:0660 + +# fb devices +fb:root:root:0600 +fb[0-9]*:root:root:0600 +fb/*:root:root:0600 + +# kbd devices +kbd:root:root:0600 + +# joystick devices +js[0-9]*:root:root:0600 + +# v4l devices +video*:root:video:0660 +radio*:root:video:0660 +winradio*:root:video:0660 +vtx*:root:video:0660 +vbi*:root:video:0660 +video/*:root:video:0660 +vttuner:root:video:0660 +v4l/*:root:video:0660 + +# input devices +input/*:root:root:644 + +# gpm devices +gpmctl:root:root:0700 + +# dri devices +nvidia*:root:video:0660 +3dfx*:root:video:0660 +dri/*:root:video:0660 + +# mainboard devices +apm_bios:root:root:0600 + +# scsi devices +sg*:root:disk:0660 +pg*:root:disk:0660 +cdwriter:root:disk:0660 + +# usb devices +usb/dabusb*:root:usb:0660 +usb/mdc800*:root:usb:0660 +usb/rio500:root:usb:0660 + diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo new file mode 100644 index 0000000000..e752fd0216 --- /dev/null +++ b/etc/udev/udev.rules.gentoo @@ -0,0 +1,97 @@ +# /etc/udev/udev.rules: device naming rules for udev +# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.rules,v 1.1 2003/12/26 23:32:44 azarah Exp $ +# +# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields. +# They provide the following subsitutions: +# %n - the "kernel number" of the device. +# for example, 'sda3' has a "kernel number" of '3' +# %k - the kernel name for the device. +# %M - the kernel major number for the device +# %m - the kernel minor number for the device +# %b - the bus id for the device +# %c - the return value for the CALLOUT program (note, this doesn't work within +# the PROGRAM field for the obvious reason.) +# %D - use the devfs style disk name for this device. +# For partitions, this will result in 'part%n' +# If this is not a partition, it will result in 'disc' +# + +########################################################### +# +# Add your own rules here +# +########################################################### + +# Looking for scsi bus id 42:0:0:1 +CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" + +# A usb camera. +LABEL, BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" + +# USB Epson printer to be called lp_epson +LABEL, BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" + +# USB HP printer to be called lp_hp +LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" + +# sound card with PCI bus id 00:0b.0 to be the first sound card +NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" + +# sound card with PCI bus id 00:07.1 to be the second sound card +NUMBER, BUS="pci", ID="00:07.1", NAME="dsp1" + +# USB mouse plugged into the third port of the first hub to be called mouse0 +TOPOLOGY, BUS="usb", PLACE="1.3", NAME="mouse0" + +# USB tablet plugged into the third port of the second hub to be called mouse1 +TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" +TOPOLOGY, BUS="usb", PLACE="2.4", NAME="mouse2" + +# ttyUSB1 should always be called visor +REPLACE, KERNEL="ttyUSB1", NAME="visor" +REPLACE, KERNEL="ttyUSB0", NAME="pl2303" + + +########################################################### +# +# For devfs similar /dev layout (neater) +# +########################################################### + +# devfs-names for ide-devices (uncomment only one) +# /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names +CALLOUT, BUS="ide", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c %3c" + +# fb devices +REPLACE, KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" + +# loop devices +REPLACE, KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" + +# md block devices +REPLACE, KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" + +# pty devices +REPLACE, KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" +REPLACE, KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" + +# ram devices +REPLACE, KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" + +# tty devices +REPLACE, KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" +REPLACE, KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" +REPLACE, KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" + +# vc devices +REPLACE, KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" +REPLACE, KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" +REPLACE, KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" +REPLACE, KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" + +# v4l devices +REPLACE, KERNEL="video[0-9]*", NAME="v4l/video%n" +REPLACE, KERNEL="radio[0-9]*", NAME="v4l/radio%n" +REPLACE, KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +REPLACE, KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" + -- cgit v1.2.3-54-g00ecf From 6d88260a8be069a65ab52fa924e6d4dc13c4e83c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Dec 2003 20:35:02 -0800 Subject: [PATCH] move the config files to etc/udev to clean up main directory a bit. --- Makefile | 19 +++---- etc/udev/udev.conf.in | 23 ++++++++ etc/udev/udev.permissions | 7 +++ etc/udev/udev.permissions.debian | 111 +++++++++++++++++++++++++++++++++++++++ etc/udev/udev.rules | 49 +++++++++++++++++ etc/udev/udev.rules.devfs | 43 +++++++++++++++ udev.conf.in | 23 -------- udev.permissions | 7 --- udev.permissions.debian | 111 --------------------------------------- udev.rules | 49 ----------------- udev.rules.demo | 9 ---- udev.rules.devfs | 43 --------------- 12 files changed, 243 insertions(+), 251 deletions(-) create mode 100644 etc/udev/udev.conf.in create mode 100644 etc/udev/udev.permissions create mode 100644 etc/udev/udev.permissions.debian create mode 100644 etc/udev/udev.rules create mode 100644 etc/udev/udev.rules.devfs delete mode 100644 udev.conf.in delete mode 100644 udev.permissions delete mode 100644 udev.permissions.debian delete mode 100644 udev.rules delete mode 100644 udev.rules.demo delete mode 100644 udev.rules.devfs diff --git a/Makefile b/Makefile index 8b20612de0..b27f1b92d9 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,7 @@ ROOT = udev VERSION = 011_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) +LOCAL_CFG_DIR = etc/udev DESTDIR = # override this to make udev look in a different location for it's config files @@ -206,11 +207,11 @@ udev_version.h: @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ # config files automatically generated -GEN_CONFIGS = udev.conf +GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf # Rules on how to create the generated config files -udev.conf: - sed -e "s:@udevdir@:$(udevdir):" < udev.conf.in > $@ +$(LOCAL_CFG_DIR)/udev.conf: + sed -e "s:@udevdir@:$(udevdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ $(OBJS): $(GEN_HEADERS) @@ -278,16 +279,16 @@ endif install-config: $(GEN_CONFIGS) $(INSTALL) -d $(DESTDIR)$(configdir) @if [ ! -r $(DESTDIR)$(configdir)udev.conf ]; then \ - echo $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir); \ - $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir); \ + echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ + $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ fi @if [ ! -r $(DESTDIR)$(configdir)udev.rules ]; then \ - echo $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir); \ - $(INSTALL_DATA) udev.rules $(DESTDIR)$(configdir); \ + echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir); \ + $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir); \ fi @if [ ! -r $(DESTDIR)$(configdir)udev.permissions ]; then \ - echo $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir); \ - $(INSTALL_DATA) udev.permissions $(DESTDIR)$(configdir); \ + echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir); \ + $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir); \ fi diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in new file mode 100644 index 0000000000..d06b0b0698 --- /dev/null +++ b/etc/udev/udev.conf.in @@ -0,0 +1,23 @@ +# udev.conf +# The main config file for udev +# +# This file can be used to override some of udev's default values +# for where it looks for files, and where it places device nodes. + + +# udev_root - where in the filesystem to place the device nodes +udev_root="@udevdir@/" + +# udev_db - The name and location of the udev database. +udev_db="@udevdir@/.udev.tdb" + +# udev_rules - The name and location of the udev rules file +udev_rules="/etc/udev/udev.rules" + +# udev_permissions - The name and location of the udev permission file +udev_permissions="/etc/udev/udev.permissions" + +# default_mode - set the default mode for all nodes that have no +# explicit match in the permissions file +default_mode="0600" + diff --git a/etc/udev/udev.permissions b/etc/udev/udev.permissions new file mode 100644 index 0000000000..e87b4ddc67 --- /dev/null +++ b/etc/udev/udev.permissions @@ -0,0 +1,7 @@ +#name:user:group:mode +ttyUSB0:root:uucp:0660 +ttyUSB1:root:uucp:0666 +pl2303:500:500:0666 +visor:root:uucp:0666 +dsp1:::0666 +camera*:500:500:0666 diff --git a/etc/udev/udev.permissions.debian b/etc/udev/udev.permissions.debian new file mode 100644 index 0000000000..5df3d0feac --- /dev/null +++ b/etc/udev/udev.permissions.debian @@ -0,0 +1,111 @@ +# name:user:group:mode + +# CHARACTER DEVICES + +# tty devices +tty:root:tty:0660 +console:root:tty:0600 +ptmx:root:tty:0666 +ttyACM*:root:dialout:0660 +ttyUSB*:root:dialout:0660 +ttyI*:root:dialout:0660 +ttyS*:root:dialout:0660 +ttySC*:root:dialout:0660 +ttyB*:root:dialout:0660 +ttyC*:root:dialout:0660 +ttyD*:root:dialout:0660 +ttyE*:root:dialout:0660 +ttyH*:root:dialout:0660 +ttyI*:root:dialout:0660 +ttyL*:root:dialout:0660 +ttyM*:root:dialout:0660 +ttyP*:root:dialout:0660 +ttyR*:root:dialout:0660 +ttyV*:root:dialout:0660 +ttyW*:root:dialout:0660 +ttyX*:root:dialout:0660 +tts/*:root:dialout:0660 +ippp*:root:dialout:0660 +isdn*:root:dialout:0660 +isdnctrl*:root:dialout:0660 +capi*:root:dialout:0660 +dcbri*:root:dialout:0660 +ircomm*:root:dialout:0660 + +# Memory devices +random:root:root:0666 +urandom:root:root:0444 +mem:root:kmem:0640 +kmem:root:kmem:0640 +port:root:kmem:0640 +full:root:root:0666 +null:root:root:0666 +zero:root:root:0666 + +# Misc devices +nvram:root:root:0660 +rtc:root:root:0660 + +admmidi*:root:audio:660 +adsp*:root:audio:660 +aload*:root:audio:660 +amidi*:root:audio:660 +amixer*:root:audio:660 +audio*:root:audio:660 +dmfm*:root:audio:660 +dsp*:root:audio:660 +audio*:root:audio:660 +mixer*:root:audio:660 +music:root:audio:660 +sequencer*:root:audio:660 +snd/*:root:audio:660 +sound/*:root:audio:660 + +lp*:root:lp:0660 +parport*:root:lp:0660 +irlpt*:root:lp:0660 +usblp*:root:lp:0660 +usb/lp*:root:lp:0660 + +js:root:root:644 +djs:root:root:644 +input/*:root:root:644 + +dri/card*:root:root:666 + +fb*:root:video:0620 +agpgart:root:video:0660 +video*:root:video:0660 +radio*:root:video:0660 +vbi*:root:video:0660 +vtx*:root:video:0660 +mol:root:root:0600 + + +# BLOCK DEVICES + +floppy*:root:floppy:660 +floppy/*:root:floppy:660 + +ram*:root:disk:660 +raw/*:root:disk:660 + +hd*:root:disk:660 +sd*:root:disk:660 +dasd*:root:disk:660 +ataraid*:root:disk:660 +loop*:root:disk:660 +md*:root:disk:660 + +sr*:root:cdrom:660 +scd*:root:cdrom:660 +sr*:root:cdrom:660 + +ht*:root:tape:0660 +nht*:root:tape:0660 +pt*:root:tape:0660 +npt*:root:tape:0660 +st*:root:tape:0660 +nst*:root:tape:0660 + +dm-*:root:root:0640 diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules new file mode 100644 index 0000000000..06d5842c2a --- /dev/null +++ b/etc/udev/udev.rules @@ -0,0 +1,49 @@ +# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields. +# They provide the following subsitutions: +# %n - the "kernel number" of the device. +# for example, 'sda3' has a "kernel number" of '3' +# %k - the kernel name for the device. +# %M - the kernel major number for the device +# %m - the kernel minor number for the device +# %b - the bus id for the device +# %c - the return value for the CALLOUT program (note, this doesn't work within +# the PROGRAM field for the obvious reason.) +# %D - use the devfs style disk name for this device. +# For partitions, this will result in 'part%n' +# If this is not a partition, it will result in 'disc' +# + +# Looking for scsi bus id 42:0:0:1 +CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" + +# A usb camera. +LABEL, BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" + +# USB Epson printer to be called lp_epson +LABEL, BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" + +# USB HP printer to be called lp_hp +LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" + +# sound card with PCI bus id 00:0b.0 to be the first sound card +NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" + +# sound card with PCI bus id 00:07.1 to be the second sound card +NUMBER, BUS="pci", ID="00:07.1", NAME="dsp1" + +# USB mouse plugged into the third port of the first hub to be called mouse0 +TOPOLOGY, BUS="usb", PLACE="1.3", NAME="mouse0" + +# USB tablet plugged into the third port of the second hub to be called mouse1 +TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" +TOPOLOGY, BUS="usb", PLACE="2.4", NAME="mouse2" + +# ttyUSB1 should always be called visor +REPLACE, KERNEL="ttyUSB1", NAME="visor" +REPLACE, KERNEL="ttyUSB0", NAME="pl2303" + +# a devfs like way to name some tty devices +#REPLACE, KERNEL="ttyS*", NAME="tts/%n" +#REPLACE, KERNEL="tty*", NAME="vc/%n" + + diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs new file mode 100644 index 0000000000..0d579a4dd4 --- /dev/null +++ b/etc/udev/udev.rules.devfs @@ -0,0 +1,43 @@ +# These rules are to try to emulate a devfs naming scheme in udev +# if there are any missing rules, please let the udev developers +# know. +# +# There are a number of modifiers that are allowed to be used in the +# a number of the different fields. They provide the following subsitutions: +# %n - the "kernel number" of the device. +# for example, 'sda3' has a "kernel number" of '3' +# %M - the kernel major number for the device +# %m - the kernel minor number for the device +# %b - the bus id for the device +# %c - the return value for the CALLOUT program (note, this doesn't work within +# the PROGRAM field for the obvious reason.) +# %D - use the devfs style disk name for this device. +# For partitions, this will result in 'part%n' +# If this is not a partition, it will result in 'disc' +# + +# ide block devices +NUMBER, BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D" +NUMBER, BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%D" +NUMBER, BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%D" +NUMBER, BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D" + +# md block devices +REPLACE, KERNEL="md[0-9]*", NAME="md/%n" + +# tty devices +REPLACE, KERNEL="tty[0-9]*", NAME="vc/%n" +REPLACE, KERNEL="ttyS[0-9]*", NAME="tts/%n" +REPLACE, KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" + +# vc devices +REPLACE, KERNEL="vcs", NAME="vcc/0" +REPLACE, KERNEL="vcs[0-9]*", NAME="vcc/%n" +REPLACE, KERNEL="vcsa", NAME="vcc/a0" +REPLACE, KERNEL="vcsa[0-9]*", NAME="vcc/a%n" + +# v4l devices +REPLACE, KERNEL="video[0-9]*", NAME="v4l/video%n" +REPLACE, KERNEL="radio[0-9]*", NAME="v4l/radio%n" +REPLACE, KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +REPLACE, KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" diff --git a/udev.conf.in b/udev.conf.in deleted file mode 100644 index d06b0b0698..0000000000 --- a/udev.conf.in +++ /dev/null @@ -1,23 +0,0 @@ -# udev.conf -# The main config file for udev -# -# This file can be used to override some of udev's default values -# for where it looks for files, and where it places device nodes. - - -# udev_root - where in the filesystem to place the device nodes -udev_root="@udevdir@/" - -# udev_db - The name and location of the udev database. -udev_db="@udevdir@/.udev.tdb" - -# udev_rules - The name and location of the udev rules file -udev_rules="/etc/udev/udev.rules" - -# udev_permissions - The name and location of the udev permission file -udev_permissions="/etc/udev/udev.permissions" - -# default_mode - set the default mode for all nodes that have no -# explicit match in the permissions file -default_mode="0600" - diff --git a/udev.permissions b/udev.permissions deleted file mode 100644 index e87b4ddc67..0000000000 --- a/udev.permissions +++ /dev/null @@ -1,7 +0,0 @@ -#name:user:group:mode -ttyUSB0:root:uucp:0660 -ttyUSB1:root:uucp:0666 -pl2303:500:500:0666 -visor:root:uucp:0666 -dsp1:::0666 -camera*:500:500:0666 diff --git a/udev.permissions.debian b/udev.permissions.debian deleted file mode 100644 index 5df3d0feac..0000000000 --- a/udev.permissions.debian +++ /dev/null @@ -1,111 +0,0 @@ -# name:user:group:mode - -# CHARACTER DEVICES - -# tty devices -tty:root:tty:0660 -console:root:tty:0600 -ptmx:root:tty:0666 -ttyACM*:root:dialout:0660 -ttyUSB*:root:dialout:0660 -ttyI*:root:dialout:0660 -ttyS*:root:dialout:0660 -ttySC*:root:dialout:0660 -ttyB*:root:dialout:0660 -ttyC*:root:dialout:0660 -ttyD*:root:dialout:0660 -ttyE*:root:dialout:0660 -ttyH*:root:dialout:0660 -ttyI*:root:dialout:0660 -ttyL*:root:dialout:0660 -ttyM*:root:dialout:0660 -ttyP*:root:dialout:0660 -ttyR*:root:dialout:0660 -ttyV*:root:dialout:0660 -ttyW*:root:dialout:0660 -ttyX*:root:dialout:0660 -tts/*:root:dialout:0660 -ippp*:root:dialout:0660 -isdn*:root:dialout:0660 -isdnctrl*:root:dialout:0660 -capi*:root:dialout:0660 -dcbri*:root:dialout:0660 -ircomm*:root:dialout:0660 - -# Memory devices -random:root:root:0666 -urandom:root:root:0444 -mem:root:kmem:0640 -kmem:root:kmem:0640 -port:root:kmem:0640 -full:root:root:0666 -null:root:root:0666 -zero:root:root:0666 - -# Misc devices -nvram:root:root:0660 -rtc:root:root:0660 - -admmidi*:root:audio:660 -adsp*:root:audio:660 -aload*:root:audio:660 -amidi*:root:audio:660 -amixer*:root:audio:660 -audio*:root:audio:660 -dmfm*:root:audio:660 -dsp*:root:audio:660 -audio*:root:audio:660 -mixer*:root:audio:660 -music:root:audio:660 -sequencer*:root:audio:660 -snd/*:root:audio:660 -sound/*:root:audio:660 - -lp*:root:lp:0660 -parport*:root:lp:0660 -irlpt*:root:lp:0660 -usblp*:root:lp:0660 -usb/lp*:root:lp:0660 - -js:root:root:644 -djs:root:root:644 -input/*:root:root:644 - -dri/card*:root:root:666 - -fb*:root:video:0620 -agpgart:root:video:0660 -video*:root:video:0660 -radio*:root:video:0660 -vbi*:root:video:0660 -vtx*:root:video:0660 -mol:root:root:0600 - - -# BLOCK DEVICES - -floppy*:root:floppy:660 -floppy/*:root:floppy:660 - -ram*:root:disk:660 -raw/*:root:disk:660 - -hd*:root:disk:660 -sd*:root:disk:660 -dasd*:root:disk:660 -ataraid*:root:disk:660 -loop*:root:disk:660 -md*:root:disk:660 - -sr*:root:cdrom:660 -scd*:root:cdrom:660 -sr*:root:cdrom:660 - -ht*:root:tape:0660 -nht*:root:tape:0660 -pt*:root:tape:0660 -npt*:root:tape:0660 -st*:root:tape:0660 -nst*:root:tape:0660 - -dm-*:root:root:0640 diff --git a/udev.rules b/udev.rules deleted file mode 100644 index 06d5842c2a..0000000000 --- a/udev.rules +++ /dev/null @@ -1,49 +0,0 @@ -# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields. -# They provide the following subsitutions: -# %n - the "kernel number" of the device. -# for example, 'sda3' has a "kernel number" of '3' -# %k - the kernel name for the device. -# %M - the kernel major number for the device -# %m - the kernel minor number for the device -# %b - the bus id for the device -# %c - the return value for the CALLOUT program (note, this doesn't work within -# the PROGRAM field for the obvious reason.) -# %D - use the devfs style disk name for this device. -# For partitions, this will result in 'part%n' -# If this is not a partition, it will result in 'disc' -# - -# Looking for scsi bus id 42:0:0:1 -CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" - -# A usb camera. -LABEL, BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" - -# USB Epson printer to be called lp_epson -LABEL, BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" - -# USB HP printer to be called lp_hp -LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" - -# sound card with PCI bus id 00:0b.0 to be the first sound card -NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" - -# sound card with PCI bus id 00:07.1 to be the second sound card -NUMBER, BUS="pci", ID="00:07.1", NAME="dsp1" - -# USB mouse plugged into the third port of the first hub to be called mouse0 -TOPOLOGY, BUS="usb", PLACE="1.3", NAME="mouse0" - -# USB tablet plugged into the third port of the second hub to be called mouse1 -TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" -TOPOLOGY, BUS="usb", PLACE="2.4", NAME="mouse2" - -# ttyUSB1 should always be called visor -REPLACE, KERNEL="ttyUSB1", NAME="visor" -REPLACE, KERNEL="ttyUSB0", NAME="pl2303" - -# a devfs like way to name some tty devices -#REPLACE, KERNEL="ttyS*", NAME="tts/%n" -#REPLACE, KERNEL="tty*", NAME="vc/%n" - - diff --git a/udev.rules.demo b/udev.rules.demo deleted file mode 100644 index 9ea7895791..0000000000 --- a/udev.rules.demo +++ /dev/null @@ -1,9 +0,0 @@ -# USB camera from Fuji to be named "camera" -LABEL, BUS="usb", SYSFS_vendor="FUJIFILM", NAME="camera%n" - -# USB device plugged into the fourth port of the second hub to be called gps_device -TOPOLOGY, BUS="usb", PLACE="2.4", NAME="gps_device" - -# ttyUSB1 should always be called visor -REPLACE, KERNEL="ttyUSB1", NAME="visor" - diff --git a/udev.rules.devfs b/udev.rules.devfs deleted file mode 100644 index 0d579a4dd4..0000000000 --- a/udev.rules.devfs +++ /dev/null @@ -1,43 +0,0 @@ -# These rules are to try to emulate a devfs naming scheme in udev -# if there are any missing rules, please let the udev developers -# know. -# -# There are a number of modifiers that are allowed to be used in the -# a number of the different fields. They provide the following subsitutions: -# %n - the "kernel number" of the device. -# for example, 'sda3' has a "kernel number" of '3' -# %M - the kernel major number for the device -# %m - the kernel minor number for the device -# %b - the bus id for the device -# %c - the return value for the CALLOUT program (note, this doesn't work within -# the PROGRAM field for the obvious reason.) -# %D - use the devfs style disk name for this device. -# For partitions, this will result in 'part%n' -# If this is not a partition, it will result in 'disc' -# - -# ide block devices -NUMBER, BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D" -NUMBER, BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%D" -NUMBER, BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%D" -NUMBER, BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D" - -# md block devices -REPLACE, KERNEL="md[0-9]*", NAME="md/%n" - -# tty devices -REPLACE, KERNEL="tty[0-9]*", NAME="vc/%n" -REPLACE, KERNEL="ttyS[0-9]*", NAME="tts/%n" -REPLACE, KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" - -# vc devices -REPLACE, KERNEL="vcs", NAME="vcc/0" -REPLACE, KERNEL="vcs[0-9]*", NAME="vcc/%n" -REPLACE, KERNEL="vcsa", NAME="vcc/a0" -REPLACE, KERNEL="vcsa[0-9]*", NAME="vcc/a%n" - -# v4l devices -REPLACE, KERNEL="video[0-9]*", NAME="v4l/video%n" -REPLACE, KERNEL="radio[0-9]*", NAME="v4l/radio%n" -REPLACE, KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" -REPLACE, KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" -- cgit v1.2.3-54-g00ecf From 8ccd82e04c28ca49b70a619e3d6e81d67e68ab95 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Dec 2003 20:38:14 -0800 Subject: [PATCH] move the dbus config file to etc/dbus-1/system.d/ --- Makefile | 3 ++- etc/dbus-1/system.d/udev_sysbus_policy.conf | 23 +++++++++++++++++++++++ udev_sysbus_policy.conf | 23 ----------------------- 3 files changed, 25 insertions(+), 24 deletions(-) create mode 100644 etc/dbus-1/system.d/udev_sysbus_policy.conf delete mode 100644 udev_sysbus_policy.conf diff --git a/Makefile b/Makefile index b27f1b92d9..dae0d9a1f9 100644 --- a/Makefile +++ b/Makefile @@ -266,7 +266,8 @@ small_release: $(DISTFILES) clean ifeq ($(USE_DBUS), true) install-dbus-policy: $(INSTALL) -d $(DESTDIR)$(dbusdir) - $(INSTALL_DATA) udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) + $(INSTALL_DATA) etc/dbus-1/system.d/udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) + uninstall-dbus-policy: - rm $(DESTDIR)$(dbusdir)/udev_sysbus_policy.conf else diff --git a/etc/dbus-1/system.d/udev_sysbus_policy.conf b/etc/dbus-1/system.d/udev_sysbus_policy.conf new file mode 100644 index 0000000000..b2660e65cf --- /dev/null +++ b/etc/dbus-1/system.d/udev_sysbus_policy.conf @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/udev_sysbus_policy.conf b/udev_sysbus_policy.conf deleted file mode 100644 index b2660e65cf..0000000000 --- a/udev_sysbus_policy.conf +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - -- cgit v1.2.3-54-g00ecf From 5f7c4c1bb07c4398331b548de366c76c05eed1ff Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Dec 2003 21:22:35 -0800 Subject: [PATCH] minor grammer fixes for the udev_vs_devfs document Thanks to Seemant Kulleen for pointing them out. --- docs/udev_vs_devfs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/udev_vs_devfs b/docs/udev_vs_devfs index 17853f881f..fbf757d437 100644 --- a/docs/udev_vs_devfs +++ b/docs/udev_vs_devfs @@ -13,7 +13,7 @@ Executive summary for those too lazy to read this whole thing: will be gladly ignored. -First off, some background. For a description of udev, and what it's +First off, some background. For a description of udev, and what its original design goals were, please see the OLS 2003 paper on udev, available at: @@ -26,7 +26,7 @@ directory. In that OLS paper, I described the current situation of a static /dev and the current problems that a number of people have with it. I also detailed how devfs tries to solve a number of these problems. In -hindsight, I should have never mentioned the word, devfs, when talking +hindsight, I should have never mentioned the word "devfs" when talking about udev. I did so only because it seemed like a good place to start with. Most people understood what devfs is, and what it does. To compare udev against it, showing how udev was more powerful, and a more @@ -90,7 +90,7 @@ And now for udev: to name devices in a persistent manner. More on that below. 4) udev emits D-BUS messages so that any other userspace program (like HAL) can listen to see what devices are created or removed. - It also allows userspace programs to query it's database to see + It also allows userspace programs to query its database to see what devices are present and what they are currently named as (providing a pointer into the sysfs tree for that specific device node.) @@ -123,8 +123,8 @@ everything that devfs currently does, in about 6Kb of userspace code: Yes, that's right, 6Kb. So, you are asking, why are you still working on udev if it did everything devfs did back in May 2003? That's because just managing static device nodes based on what the kernel calls the -devices is _not_ the primary goal of udev. It's just a tiny side affect -of it's primary goal, the ability to never worry about major/minor +devices is _not_ the primary goal of udev. It's just a tiny side effect +of its primary goal, the ability to never worry about major/minor number assignments and provide the ability to achieve persistent device names if wanted. @@ -132,7 +132,7 @@ All the people wanting to bring up the udev vs. devfs argument go back and read the previous paragraph. Yes, all Gentoo users who keep filling up my inbox with smoking emails, I mean you. -So, how well does udev solve it's goals: +So, how well does udev solve its goals: Prevent users from ever worrying about major/minor numbers And here you were, not knowing you ever needed to worry about major/minor numbers in the first place, right? Ah, I see you -- cgit v1.2.3-54-g00ecf From 8c55357fa7314aee14fe1e8677ba030de97b0998 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Dec 2003 21:46:59 -0800 Subject: [PATCH] v012 release --- ChangeLog | 45 +++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fa12f67046..f626070268 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,48 @@ +Summary of changes from v011 to v012 +============================================ + +: + o make symlink work properly if there is already a file in its place + o Fix udev gcc-2.95.4 compat + +: + o extras multipath update + o extras multipath update + +Kay Sievers: + o mention user callable udev + options in man page + o make udev user callable to query the database + o depend on all .h files + o cleanup namedev_parse debug text + o extend exec_program[] + o ide-devfs.sh update + o fix for apply_format() + o check for empty symlink string + o 'ide' missing in bus_files[] + o small trivial cleanup of latest changes + +: + o introduce signal handler + +: + o udev spec file update + +Greg Kroah-Hartman: + o minor grammer fixes for the udev_vs_devfs document + o move the dbus config file to etc/dbus-1/system.d/ + o move the config files to etc/udev to clean up main directory a bit + o add Gentoo versions of the rules and permissions files + o if using glibc, link dynamically, as no one like 500Kb udev binaries + o minor change to udev_vs_devfs document + o added udev vs devfs supid document to the tree + o move the signal handling registration to after we have initialized enough stuff + o make ide-devfs.sh executable in the tree + o udev.permissions.debian - forgot the dm nodes + o update the udev.permissions.debian file with new entries + o added udev.init script for the Linux From Scratch project + + + Summary of changes from v010 to v011 ============================================ diff --git a/Makefile b/Makefile index dae0d9a1f9..13fc19296c 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 011_bk +VERSION = 012 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 9b5ef54cef..c34b1454f8 100644 --- a/udev.spec +++ b/udev.spec @@ -18,7 +18,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 011_bk +Version: 012 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From e9a8c2e432bc2b419a2bac590d3021f2b736b305 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 3 Jan 2004 05:37:27 -0800 Subject: [PATCH] 012_bk change. --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 13fc19296c..ffd61c0400 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 012 +VERSION = 012_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index c34b1454f8..9e301deb7c 100644 --- a/udev.spec +++ b/udev.spec @@ -18,7 +18,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 012 +Version: 012_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 8eb38ef882192445bd0e012351a6192a2968a76c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 4 Jan 2004 08:08:26 -0800 Subject: [PATCH] add a blacklist of class devices we do not want to look at. Thanks to Kay for the original patch, and the idea. --- udev.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/udev.c b/udev.c index 0d0a5da207..1222b239ef 100644 --- a/udev.c +++ b/udev.c @@ -139,12 +139,20 @@ help: return retval; } +static char *subsystem_blacklist[] = { + "net", + "scsi_host", + "scsi_device", + "", +}; + static inline int udev_hotplug(int argc, char **argv) { char *action; char *devpath; char *subsystem; int retval = -EINVAL; + int i; subsystem = argv[1]; @@ -162,10 +170,14 @@ static inline int udev_hotplug(int argc, char **argv) goto exit; } - /* but we don't care about net class devices */ - if (strcmp(subsystem, "net") == 0) { - dbg("don't care about net devices"); - goto exit; + /* skip blacklisted subsystems */ + i = 0; + while (subsystem_blacklist[i][0] != '\0') { + if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { + dbg("don't care about '%s' devices", subsystem); + goto exit; + } + i++; } action = get_action(); -- cgit v1.2.3-54-g00ecf From 843d1a84b9be2b3e11f26186fee24676f5dc3f53 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 4 Jan 2004 08:18:16 -0800 Subject: [PATCH] replace list_for_each with list_for_each_entry, saving a few lines of code. --- namedev.c | 31 +++++++++---------------------- namedev_parse.c | 12 ++++-------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/namedev.c b/namedev.c index cff338f1a7..e1b57ec350 100644 --- a/namedev.c +++ b/namedev.c @@ -104,12 +104,11 @@ static int strcmp_pattern(const char *p, const char *s) int add_perm_dev(struct perm_device *new_dev) { - struct list_head *tmp; + struct perm_device *dev; struct perm_device *tmp_dev; /* update the values if we already have the device */ - list_for_each(tmp, &perm_device_list) { - struct perm_device *dev = list_entry(tmp, struct perm_device, node); + list_for_each_entry(dev, &perm_device_list, node) { if (strcmp_pattern(new_dev->name, dev->name)) continue; copy_var(dev, new_dev, mode); @@ -130,11 +129,9 @@ int add_perm_dev(struct perm_device *new_dev) static struct perm_device *find_perm(char *name) { - struct list_head *tmp; - struct perm_device *perm = NULL; + struct perm_device *perm; - list_for_each(tmp, &perm_device_list) { - perm = list_entry(tmp, struct perm_device, node); + list_for_each_entry(perm, &perm_device_list, node) { if (strcmp_pattern(perm->name, name)) continue; return perm; @@ -396,10 +393,8 @@ static int exec_callout(struct config_device *dev, char *value, int len) static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { struct config_device *dev; - struct list_head *tmp; - list_for_each(tmp, &config_device_list) { - dev = list_entry(tmp, struct config_device, node); + list_for_each_entry(dev, &config_device_list, node) { if (dev->type != CALLOUT) continue; @@ -468,12 +463,10 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, { struct sysfs_pair *pair; struct config_device *dev; - struct list_head *tmp; int i; int match; - list_for_each(tmp, &config_device_list) { - dev = list_entry(tmp, struct config_device, node); + list_for_each_entry(dev, &config_device_list, node) { if (dev->type != LABEL) continue; @@ -513,7 +506,6 @@ static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { struct config_device *dev; - struct list_head *tmp; char path[SYSFS_PATH_MAX]; int found; char *temp = NULL; @@ -522,8 +514,7 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, if (!sysfs_device) return -ENODEV; - list_for_each(tmp, &config_device_list) { - dev = list_entry(tmp, struct config_device, node); + list_for_each_entry(dev, &config_device_list, node) { if (dev->type != NUMBER) continue; @@ -558,7 +549,6 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, static int do_topology(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { struct config_device *dev; - struct list_head *tmp; char path[SYSFS_PATH_MAX]; int found; char *temp = NULL; @@ -567,8 +557,7 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude if (!sysfs_device) return -ENODEV; - list_for_each(tmp, &config_device_list) { - dev = list_entry(tmp, struct config_device, node); + list_for_each_entry(dev, &config_device_list, node) { if (dev->type != TOPOLOGY) continue; @@ -604,10 +593,8 @@ static int do_topology(struct sysfs_class_device *class_dev, struct udevice *ude static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { struct config_device *dev; - struct list_head *tmp; - list_for_each(tmp, &config_device_list) { - dev = list_entry(tmp, struct config_device, node); + list_for_each_entry(dev, &config_device_list, node) { if (dev->type != REPLACE) continue; diff --git a/namedev_parse.c b/namedev_parse.c index 02ffb0a3e7..de29057a95 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -117,12 +117,10 @@ void dump_config_dev(struct config_device *dev) void dump_config_dev_list(void) { - struct list_head *tmp; + struct config_device *dev; - list_for_each(tmp, &config_device_list) { - struct config_device *dev = list_entry(tmp, struct config_device, node); + list_for_each_entry(dev, &config_device_list, node) dump_config_dev(dev); - } } void dump_perm_dev(struct perm_device *dev) @@ -133,12 +131,10 @@ void dump_perm_dev(struct perm_device *dev) void dump_perm_dev_list(void) { - struct list_head *tmp; + struct perm_device *dev; - list_for_each(tmp, &perm_device_list) { - struct perm_device *dev = list_entry(tmp, struct perm_device, node); + list_for_each_entry(dev, &perm_device_list, node) dump_perm_dev(dev); - } } -- cgit v1.2.3-54-g00ecf From 6a827072275a28798ac4c26ee166b03a145f4174 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 6 Jan 2004 01:11:15 -0800 Subject: [PATCH] add cdrom rule for ide cdrom. Rule came from Kay --- etc/udev/udev.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 06d5842c2a..b206503e15 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -46,4 +46,7 @@ REPLACE, KERNEL="ttyUSB0", NAME="pl2303" #REPLACE, KERNEL="ttyS*", NAME="tts/%n" #REPLACE, KERNEL="tty*", NAME="vc/%n" +# if this is a ide cdrom, name it the default name, and create a symlink to cdrom +CALLOUT, BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", ID="cdrom", NAME="%k", SYMLINK="cdrom" + -- cgit v1.2.3-54-g00ecf From a05b77509e6e3723f3e969eefd1c2a34bad79675 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 6 Jan 2004 01:11:53 -0800 Subject: [PATCH] add silly script that names cdrom drives based on the cd in them. --- extras/name_cdrom.pl | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 extras/name_cdrom.pl diff --git a/extras/name_cdrom.pl b/extras/name_cdrom.pl new file mode 100644 index 0000000000..569b119be7 --- /dev/null +++ b/extras/name_cdrom.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl + +# a horribly funny script that shows how flexible udev can really be +# This is to be executed by udev with the following rules: +# CALLOUT, BUS="ide", PROGRAM="name_cdrom.pl %M %m", ID="good*", NAME="%1c", SYMLINK="cdrom" +# CALLOUT, BUS="scsi", PROGRAM="name_cdrom.pl %M %m", ID="good*", NAME="%1c", SYMLINK="cdrom" +# +# The scsi rule catches USB cdroms and ide-scsi devices. +# + +use CDDB_get qw( get_cddb ); + +my %config; + +$dev_node = "/tmp/cd_foo"; + +# following variables just need to be declared if different from defaults +$config{CDDB_HOST}="freedb.freedb.org"; # set cddb host +$config{CDDB_PORT}=8880; # set cddb port +$config{CDDB_MODE}="cddb"; # set cddb mode: cddb or http +$config{CD_DEVICE}="$dev_node"; # set cd device + +# No user interaction, this is a automated script! +$config{input}=0; + +$major = $ARGV[0]; +$minor = $ARGV[1]; + +# create our temp device node to read the cd info from +if (system("mknod $dev_node b $major $minor")) { + die "bad mknod failed"; + } + +# get it on +my %cd=get_cddb(\%config); + +# remove the dev node we just created +unlink($dev_node); + +# print out our cd name if we have found it +unless(defined $cd{title}) { + print"bad unknown cdrom\n"; +} else { + print "good $cd{artist}_$cd{title}\n"; +} -- cgit v1.2.3-54-g00ecf From c53735efc9720b28676c1b51fbed04dc592236e8 Mon Sep 17 00:00:00 2001 From: "christophe@saout.de" Date: Sat, 10 Jan 2004 00:54:33 -0800 Subject: [PATCH] small cleanup This one is nothing important, just add some quotes to be more consistent with the rest and make sure that the return value is positive (since the error return values are negative). Hmm? --- namedev_parse.c | 2 +- udev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index de29057a95..4b1377dc32 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -103,7 +103,7 @@ void dump_config_dev(struct config_device *dev) dev->name, dev->bus, dev->place); break; case REPLACE: - dbg_parse("REPLACE name=%s, kernel_name=%s", + dbg_parse("REPLACE name='%s', kernel_name='%s'", dev->name, dev->kernel_name); break; case CALLOUT: diff --git a/udev.c b/udev.c index 1222b239ef..bbff89bad5 100644 --- a/udev.c +++ b/udev.c @@ -221,7 +221,7 @@ exit_sysbus: sysbus_disconnect(); exit: - return retval; + return -retval; } int main(int argc, char **argv, char **envp) -- cgit v1.2.3-54-g00ecf From f1db055ab2e349ce22254562faaece66d6a4a873 Mon Sep 17 00:00:00 2001 From: "christophe@saout.de" Date: Sat, 10 Jan 2004 00:55:28 -0800 Subject: [PATCH] add IGNORE rule type On Wed, Dec 31, 2003 at 11:24:53AM -0800, Greg KH wrote: > > There should be a possibility to tell udev not to create a device node. > > > > device-mapper: Usually set up by libdevmapper (or EVMS tools) which > > creates the device node on its own under /dev/mapper/. > > > > With udev a second device is created named /dev/dm- which is not > > really needed. > > Good point. Ok, I'll agree with you. Care to make up a patch for this > kind of feature? Yes, I can try. There was no way to tell not to do anything so I created one. Errors are signalled via negative return values, so I thought that a positive, non-zero one could mean to ignore the device. I don't like it but perhaps you have a better solution. --- etc/udev/udev.rules | 3 ++- etc/udev/udev.rules.devfs | 3 +++ namedev.c | 27 +++++++++++++++++++++++++++ namedev.h | 2 ++ namedev_parse.c | 15 +++++++++++++++ udev.8 | 8 +++++++- udev.c | 3 +++ 7 files changed, 59 insertions(+), 2 deletions(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index b206503e15..c2b50eb90d 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -49,4 +49,5 @@ REPLACE, KERNEL="ttyUSB0", NAME="pl2303" # if this is a ide cdrom, name it the default name, and create a symlink to cdrom CALLOUT, BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", ID="cdrom", NAME="%k", SYMLINK="cdrom" - +# device mapper creates its own device nodes +IGNORE, KERNEL="dm-[0-9]*" diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index 0d579a4dd4..537d655a0e 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -41,3 +41,6 @@ REPLACE, KERNEL="video[0-9]*", NAME="v4l/video%n" REPLACE, KERNEL="radio[0-9]*", NAME="v4l/radio%n" REPLACE, KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" REPLACE, KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" + +# dm devices +IGNORE, KERNEL="dm-[0-9]*" diff --git a/namedev.c b/namedev.c index e1b57ec350..226c1d313f 100644 --- a/namedev.c +++ b/namedev.c @@ -298,6 +298,27 @@ exit: return; /* here to prevent compiler warning... */ } +static int do_ignore(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +{ + struct config_device *dev; + struct list_head *tmp; + + list_for_each(tmp, &config_device_list) { + dev = list_entry(tmp, struct config_device, node); + if (dev->type != IGNORE) + continue; + + dbg("compare name '%s' with '%s'", dev->kernel_name, class_dev->name); + if (strcmp_pattern(dev->kernel_name, class_dev->name) != 0) + continue; + + dbg("found name, '%s' will be ignored", dev->kernel_name); + + return 0; + } + return -ENODEV; +} + static int exec_callout(struct config_device *dev, char *value, int len) { int retval; @@ -734,6 +755,12 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud dbg("kernel_number='%s'", udev->kernel_number); /* rules are looked at in priority order */ + retval = do_ignore(class_dev, udev, sysfs_device); + if (retval == 0) { + dbg("name, '%s' is being ignored", class_dev->name); + return 1; + } + retval = do_callout(class_dev, udev, sysfs_device); if (retval == 0) goto found; diff --git a/namedev.h b/namedev.h index 1ac71069ad..f1e770277b 100644 --- a/namedev.h +++ b/namedev.h @@ -36,6 +36,7 @@ enum config_type { TOPOLOGY = 3, REPLACE = 4, CALLOUT = 5, + IGNORE = 6, }; #define BUS_SIZE 30 @@ -50,6 +51,7 @@ enum config_type { #define TYPE_TOPOLOGY "TOPOLOGY" #define TYPE_REPLACE "REPLACE" #define TYPE_CALLOUT "CALLOUT" +#define TYPE_IGNORE "IGNORE" #define FIELD_BUS "BUS" #define FIELD_ID "ID" diff --git a/namedev_parse.c b/namedev_parse.c index 4b1377dc32..5b5a5b3bc1 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -110,6 +110,10 @@ void dump_config_dev(struct config_device *dev) dbg_parse("CALLOUT name='%s', bus='%s', program='%s', id='%s'", dev->name, dev->bus, dev->exec_program, dev->id); break; + case IGNORE: + dbg_parse("IGNORE name='%s', kernel_name='%s'", + dev->name, dev->kernel_name); + break; default: dbg_parse("unknown type of method"); } @@ -209,6 +213,11 @@ int namedev_init_rules(void) goto keys; } + if (strcasecmp(temp2, TYPE_IGNORE) == 0) { + dev.type = IGNORE; + goto keys; + } + dbg_parse("unknown type of method '%s'", temp2); goto error; keys: @@ -323,6 +332,12 @@ keys: (*dev.exec_program == '\0')) goto error; break; + case IGNORE: + dbg_parse(TYPE_IGNORE "name='%s', kernel_name='%s'", + dev.name, dev.kernel_name); + if ((*dev.kernel_name == '\0')) + goto error; + break; default: dbg_parse("unknown type of method"); goto error; diff --git a/udev.8 b/udev.8 index 5f497af92a..3eb4aecad2 100644 --- a/udev.8 +++ b/udev.8 @@ -161,9 +161,15 @@ device position on bus, like physical port of USB device string replacement of the kernel device name .br .RB "key: " KERNEL +.TP +.B IGNORE +tell udev to not care about creation of this device, e.g. because the +device is already handled by another program +.br +.RB "key: " KERNEL .P The methods are applied in the following order: -.BR CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "." +.BR IGNORE ", " CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "." .P .RB "The " NAME " ," SYMLINK " and " PROGRAM fields support simple printf-like string substitution: diff --git a/udev.c b/udev.c index bbff89bad5..116acf5389 100644 --- a/udev.c +++ b/udev.c @@ -221,6 +221,9 @@ exit_sysbus: sysbus_disconnect(); exit: + if (retval > 0) + retval = 0; + return -retval; } -- cgit v1.2.3-54-g00ecf From bc20530f5017cf56fb55a4d9c04612bfb2664dd1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 10 Jan 2004 00:58:35 -0800 Subject: [PATCH] add a script that tests the IGNORE rule Can't figure out how to test for "nothing" in the udev-test.pl script framework. --- test/ignore_test | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/ignore_test diff --git a/test/ignore_test b/test/ignore_test new file mode 100644 index 0000000000..888fd16ff3 --- /dev/null +++ b/test/ignore_test @@ -0,0 +1,35 @@ +#!/bin/bash + +RULES=ignore_test.rules +CONFIG=ignore_test.conf + +export UDEV_TEST=yes +export SYSFS_PATH=$PWD/sys/ +export UDEV_CONFIG_FILE=$PWD/$CONFIG + +cat > $RULES << EOF +IGNORE, KERNEL="ttyUSB0" +EOF + +cat > $CONFIG << EOF +udev_root="$PWD/udev/" +udev_db="$PWD/udev/.udev.tdb" +udev_rules="$PWD/$RULES" +udev_permissions="$PWD/udev.permissions" +EOF + +mkdir udev + +export DEVPATH=class/tty/ttyUSB0 +export ACTION=add + +../udev tty +ls -l udev + +export ACTION=remove +../udev tty +ls -l udev + +rm $RULES +rm $CONFIG +rm -rf udev -- cgit v1.2.3-54-g00ecf From 512d781263b4f7791ba1e7adde89b813e6c8fdc1 Mon Sep 17 00:00:00 2001 From: "tiggi@infa.abo.fi" Date: Sat, 10 Jan 2004 00:59:55 -0800 Subject: [PATCH] udev 012 old gcc fixup Hello, without this patch: wolf@duel:/tmp/ud/udev-012>gcc -v Reading specs from /usr/lib/gcc-lib/i386-slackware-linux/2.95.3/specs gcc version 2.95.3 20010315 (release) cannot compile udev. --- udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.c b/udev.c index 116acf5389..30921420a0 100644 --- a/udev.c +++ b/udev.c @@ -229,9 +229,9 @@ exit: int main(int argc, char **argv, char **envp) { + int retval; main_argv = argv; main_envp = envp; - int retval; dbg("version %s", UDEV_VERSION); -- cgit v1.2.3-54-g00ecf From 8240b4751473bbfed72e496e9fd36c3ccbf8d41d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 10 Jan 2004 01:02:44 -0800 Subject: [PATCH] added init.d udev script for debian Thanks to Mathieu Segaud for the file. --- etc/init.d/udev.debian | 113 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 etc/init.d/udev.debian diff --git a/etc/init.d/udev.debian b/etc/init.d/udev.debian new file mode 100644 index 0000000000..cf7b0070ad --- /dev/null +++ b/etc/init.d/udev.debian @@ -0,0 +1,113 @@ +#! /bin/bash +# +# random init script to setup /udev +# +# chkconfig: 2345 20 80 +# description: manage user-space device nodes in /udev +# +# 2003-12-23: - some tweaks to run silently on a debian system +# 2003-12-30: - manage creation (and deletion) of /proc/self/fd->fd and +# fd/[0,1,2]->std[in,out,err] links +# - creation and deletion of /proc/kcore->core link +# - creation and deletion of /proc/asound/oss/sndstat->sndstat link + + + +udev_dir=/udev +sysfs_dir=/sys +bin=/sbin/udev + +action () { + if test $2 ; then + echo $1 + else + echo "Assertion $2 failed" + echo "Aborting" + exit 1 + fi +} + +run_udev () { + # handle block devices and their partitions + for i in ${sysfs_dir}/block/*; do + # add each drive + export DEVPATH=${i#${sysfs_dir}} + $bin block & + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${sysfs_dir}} + $bin block & + fi + done + done + # all other device classes + for i in ${sysfs_dir}/class/*; do + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${sysfs_dir}} + CLASS=`echo ${i#${sysfs_dir}} | \ + cut --delimiter='/' --fields=3-` + $bin $CLASS & + fi + done + done +} + + +case "$1" in + start) + if [ ! -d $udev_dir ]; then + mkdir $udev_dir + fi + if [ ! -d $sysfs_dir ]; then + exit 1 + fi + # propogate /udev from /sys - we only need this while we do not + # have initramfs and an early user-space with which to do early + # device bring up + action "Creating initial udev device nodes: " /bin/true + export ACTION=add + run_udev + + # hack to create stdin node + cd /udev && ln -s /proc/self/fd fd + cd /udev && ln -s fd/0 stdin + cd /udev && ln -s fd/1 stdout + cd /udev && ln -s fd/2 stderr + cd /udev && ln -s /proc/kcore core + cd /udev && ln -s /proc/asound/oss/sndstat sndstat + ;; + stop) + # be careful + action "Removing udev device nodes: " /bin/true + export ACTION=remove + run_udev + rm -f /udev/sndstat + rm -f /udev/core + rm -f /udev/stderr + rm -f /udev/stdout + rm -f /udev/stdin + rm -f /udev/fd + ;; + status) + if [ -d $udev_dir ]; then + echo "the udev device node directory exists" + else + echo "the udev device node directory does not exist" + fi + ;; + restart) + $0 stop + $0 start + ;; + reload) + # nothing to do here + ;; + *) + echo "Usage: $0 {start|stop|status|restart}" + exit 1 +esac + +exit 0 -- cgit v1.2.3-54-g00ecf From d6e86b3752dc2603c5811b153a1db0143cac5721 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 10 Jan 2004 01:04:13 -0800 Subject: [PATCH] fix Silly udev script Hey, this is funny. I couldn't resist to give it a try and we need a few changes: - it's %2c otherwise nearly all my CD's are "good", but sure I also have bad ones :) - remove the node first, cause get_cddb() dies and leaves the old one there - remove spaces in name, cause this is our separator /udev/ |-- The_Cure-The_Peel_Sessions |-- cdrom -> ./The_Cure-The_Peel_Sessions |-- hda |-- hda1 |-- hda2 |-- hda4 --- extras/name_cdrom.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/extras/name_cdrom.pl b/extras/name_cdrom.pl index 569b119be7..7a14e866a6 100644 --- a/extras/name_cdrom.pl +++ b/extras/name_cdrom.pl @@ -2,8 +2,8 @@ # a horribly funny script that shows how flexible udev can really be # This is to be executed by udev with the following rules: -# CALLOUT, BUS="ide", PROGRAM="name_cdrom.pl %M %m", ID="good*", NAME="%1c", SYMLINK="cdrom" -# CALLOUT, BUS="scsi", PROGRAM="name_cdrom.pl %M %m", ID="good*", NAME="%1c", SYMLINK="cdrom" +# CALLOUT, BUS="ide", PROGRAM="name_cdrom.pl %M %m", ID="good*", NAME="%2c", SYMLINK="cdrom" +# CALLOUT, BUS="scsi", PROGRAM="name_cdrom.pl %M %m", ID="good*", NAME="%2c", SYMLINK="cdrom" # # The scsi rule catches USB cdroms and ide-scsi devices. # @@ -27,9 +27,10 @@ $major = $ARGV[0]; $minor = $ARGV[1]; # create our temp device node to read the cd info from +unlink($dev_node); if (system("mknod $dev_node b $major $minor")) { die "bad mknod failed"; - } +} # get it on my %cd=get_cddb(\%config); @@ -41,5 +42,7 @@ unlink($dev_node); unless(defined $cd{title}) { print"bad unknown cdrom\n"; } else { - print "good $cd{artist}_$cd{title}\n"; + $cd{artist} =~ s/ /_/g; + $cd{title} =~ s/ /_/g; + print "good $cd{artist}-$cd{title}\n"; } -- cgit v1.2.3-54-g00ecf From 2794d2491714bc546bc209d6996f6ad97aa8a994 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 10 Jan 2004 01:05:38 -0800 Subject: [PATCH] udev - exec status fix for klibc Here is a patch to remove the ifdef's and fix klibc instead. --- klibc_fixups.h | 5 +++++ namedev.c | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/klibc_fixups.h b/klibc_fixups.h index a89638ead4..37622c86d6 100644 --- a/klibc_fixups.h +++ b/klibc_fixups.h @@ -4,6 +4,11 @@ #define KLIBC_FIXUPS_H +#define WTERMSIG(status) ((status) & 0x7f) +#define WEXITSTATUS(status) (((status) & 0xff00) >> 8) +#define WIFEXITED(status) (WTERMSIG(status) == 0) + + struct group { char *gr_name; /* group name */ char *gr_passwd; /* group password */ diff --git a/namedev.c b/namedev.c index 226c1d313f..08cceacda0 100644 --- a/namedev.c +++ b/namedev.c @@ -401,12 +401,10 @@ static int exec_callout(struct config_device *dev, char *value, int len) retval = -1; } -#ifndef __KLIBC__ if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { dbg("callout program status 0x%x", status); retval = -1; } -#endif } return retval; } -- cgit v1.2.3-54-g00ecf From 41397661c625ece84c54d98d875d5afef4f829ff Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 10 Jan 2004 01:10:50 -0800 Subject: [PATCH] udev - make exec_callout() reusable Here is a patch that switches exec_callout() to be reusable. I want it to be callable in a different context. --- namedev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/namedev.c b/namedev.c index 08cceacda0..e502ba1a39 100644 --- a/namedev.c +++ b/namedev.c @@ -319,7 +319,7 @@ static int do_ignore(struct sysfs_class_device *class_dev, struct udevice *udev, return -ENODEV; } -static int exec_callout(struct config_device *dev, char *value, int len) +static int exec_program(char *path, char *value, int len) { int retval; int res; @@ -332,7 +332,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) char *args[CALLOUT_MAXARG]; int i; - dbg("callout to '%s'", dev->exec_program); + dbg("callout to '%s'", path); retval = pipe(fds); if (retval != 0) { dbg("pipe failed"); @@ -348,9 +348,9 @@ static int exec_callout(struct config_device *dev, char *value, int len) /* child */ close(STDOUT_FILENO); dup(fds[1]); /* dup write side of pipe to STDOUT */ - if (strchr(dev->exec_program, ' ')) { + if (strchr(path, ' ')) { /* callout with arguments */ - pos = dev->exec_program; + pos = path; for (i=0; i < CALLOUT_MAXARG-1; i++) { args[i] = strsep(&pos, " "); if (args[i] == NULL) @@ -362,7 +362,7 @@ static int exec_callout(struct config_device *dev, char *value, int len) } retval = execve(args[0], args, main_envp); } else { - retval = execve(dev->exec_program, main_argv, main_envp); + retval = execve(path, main_argv, main_envp); } if (retval != 0) { dbg("child execve failed"); @@ -428,7 +428,7 @@ static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev /* substitute anything that needs to be in the program name */ apply_format(udev, dev->exec_program); - if (exec_callout(dev, udev->callout_value, NAME_SIZE)) + if (exec_program(dev->exec_program, udev->callout_value, NAME_SIZE)) continue; if (strcmp_pattern(dev->id, udev->callout_value) != 0) continue; -- cgit v1.2.3-54-g00ecf From 40041ff4f1153360409ae88f0c0168ad2ee4d224 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 10 Jan 2004 01:14:34 -0800 Subject: [PATCH] added dri rule to the default config file. --- etc/udev/udev.rules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index c2b50eb90d..68c0c63c89 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -51,3 +51,7 @@ CALLOUT, BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", ID="cdrom", NAME="%k" # device mapper creates its own device nodes IGNORE, KERNEL="dm-[0-9]*" + +# DRI devices always go into a subdirectory (as per the LSB spec) +REPLACE, KERNEL="card*", NAME="dri/card%n" + -- cgit v1.2.3-54-g00ecf From e64280b8b30569ad6029e48f23d290e06a28d7ed Mon Sep 17 00:00:00 2001 From: "eike-hotplug@sf-tec.de" Date: Sat, 10 Jan 2004 01:19:57 -0800 Subject: [PATCH] LSB init script and other stuff I had too much time during the holidays, so I played a bit with udev. The changes are like last time mostly on the init stuff. I'm sending you this as a great diff which is just for comments. What it does: -fix a typo in Makefile -use only one "grep -v" instead of many -don't include BK-Files into release (shrinks the stuff to 30%!) -add a new init script which is LSB compliant -add some flags to choose which one to use -use /etc/udev/udev.conf in Redhat init script as the source for the udev directory. If this is not done then the init script may create a directory which udev itself isn't using (I changed /udev to /Udev to avoid collisions with /usr and ran into this) -first check for sysfs_dir before creating udev_root (maybe someone else has already fixed this, I saw this discussion on lkml) --- Makefile | 15 +++--- etc/init.d/udev | 11 ++-- etc/init.d/udev.init.LSB | 133 +++++++++++++++++++++++++++++++++++++++++++++++ extras/ide-devfs.sh | 2 +- udev.spec | 12 ++++- 5 files changed, 159 insertions(+), 14 deletions(-) create mode 100644 etc/init.d/udev.init.LSB diff --git a/Makefile b/Makefile index ffd61c0400..36f0272d02 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,7 @@ udevdir = ${prefix}/udev #USE_KLIBC = true # If you are running a cross compiler, you may want to set this -# to something more interesting, like "arm-linux-". I you want +# to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- CC = $(CROSS)gcc @@ -231,7 +231,7 @@ clean: -C $$target $@ ; \ done ; \ -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v CVS | grep -v "\.tar\.gz" | grep -v "\/\." | grep -v releases | grep -v BitKeeper | grep -v SCCS | grep -v "\.tdb" | grep -v "test\/sys" | sort ) +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz$" -e "\/\." -e releases -e BitKeeper -e SCCS -e "\.tdb$" -e test/sys | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . release: clean @@ -292,13 +292,16 @@ install-config: $(GEN_CONFIGS) $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir); \ fi - - install: install-config install-dbus-policy all $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) - $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev + @if [ "x$(USE_LSB)" = "xtrue" ]; then \ + $(INSTALL_PROGRAM) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev + ln -s $(DESTDIR)$(initdir)/udev $(sbin_dir)/rcudev + else + $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev + fi $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 - rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug - ln -f -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug @@ -324,5 +327,3 @@ uninstall: uninstall-dbus-policy $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ -C $$target $@ ; \ done ; \ - - diff --git a/etc/init.d/udev b/etc/init.d/udev index 0d26d07083..364a9aa5f7 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -7,7 +7,8 @@ . /etc/rc.d/init.d/functions -udev_dir=/udev +. /etc/udev/udev.conf + sysfs_dir=/sys bin=/sbin/udev @@ -42,12 +43,12 @@ run_udev () { case "$1" in start) - if [ ! -d $udev_dir ]; then - mkdir $udev_dir - fi if [ ! -d $sysfs_dir ]; then exit 1 fi + if [ ! -d $udev_root ]; then + mkdir $udev_root + fi # propogate /udev from /sys - we only need this while we do not # have initramfs and an early user-space with which to do early # device bring up @@ -62,7 +63,7 @@ case "$1" in run_udev ;; status) - if [ -d $udev_dir ]; then + if [ -d $udev_root ]; then echo "the udev device node directory exists" else echo "the udev device node directory does not exist" diff --git a/etc/init.d/udev.init.LSB b/etc/init.d/udev.init.LSB new file mode 100644 index 0000000000..0f5881c416 --- /dev/null +++ b/etc/init.d/udev.init.LSB @@ -0,0 +1,133 @@ +#! /bin/sh +# +# Author: Rolf Eike Beer +# derived from original RedHat udev init script +# based on the SuSE 9.0 template (c) 1995-2002 SuSE Linux AG +# +# /etc/init.d/udev +# and its symbolic link +# /(usr/)sbin/rcudev +# +# System startup script for udev +# +# LSB compatible service control script; see http://www.linuxbase.org/spec/ +# +### BEGIN INIT INFO +# Provides: udev +# Required-Start: +# Required-Stop: +# Default-Start: 1 2 3 5 +# Default-Stop: 0 6 +# Short-Description: manage user-space device nodes in /udev +# Description: Start udev to create the device files for all +# devices already present in system when script is +# called. All other devices files will be automatically +# created when udev is called via /sbin/hotplug. +# Requires at least a kernel 2.6 to work properly. +### END INIT INFO +# +# Note on script names: +# http://www.linuxbase.org/spec/refspecs/LSB_1.2.0/gLSB/scrptnames.html +# A registry has been set up to manage the init script namespace. +# http://www.lanana.org/ +# Please use the names already registered or register one or use a +# vendor prefix. + + +# Check for missing binaries (stale symlinks should not happen) +UDEV_BIN=/sbin/udev +test -x $UDEV_BIN || exit 5 + +# Check for existence of needed config file and read it +UDEV_CONFIG=/etc/udev/udev.conf +test -r $UDEV_CONFIG || exit 6 +. $UDEV_CONFIG + +# Directory where sysfs is mounted +SYSFS_DIR=/sys + +# Source LSB init functions +. /lib/lsb/init-functions + +run_udev () { + # handle block devices and their partitions + for i in ${SYSFS_DIR}/block/*; do + # add each drive + export DEVPATH=${i#${SYSFS_DIR}} + $UDEV_BIN block & + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${SYSFS_DIR}} + $UDEV_BIN block & + fi + done + done + # all other device classes + for i in ${SYSFS_DIR}/class/*; do + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${SYSFS_DIR}} + CLASS=`echo ${i#${SYSFS_DIR}} | \ + cut --delimiter='/' --fields=3-` + $UDEV_BIN $CLASS & + fi + done + done +} + +case "$1" in + start) + if [ ! -d $SYSFS_DIR ]; then + log_failure_msg "${0}: SYSFS_DIR \"$SYSFS_DIR\" not found" + exit 1 + fi + if [ ! -d $udev_root ]; then + mkdir $udev_root || exit 4 + fi + # propogate /udev from /sys - we only need this while we do not + # have initramfs and an early user-space with which to do early + # device bring up + echo -n "Creating initial udev device nodes: " + export ACTION=add + run_udev + log_success_msg + ;; + stop) + # be careful + echo -n "Removing udev device nodes: " + export ACTION=remove + run_udev + rm -f $udev_db || exit 1 + rmdir $udev_root || exit 1 + log_success_msg + ;; + restart) + $0 stop + $0 start + + exit $? + ;; + force-reload) + echo -n "Reload udev " + $0 stop && $0 start + exit $? + ;; + reload) + exit 3 + ;; + status) + echo -n "Checking for udev root directory: " + if [ -d $udev_root ]; then + log_success_msg found + else + log_warning_msg "not found" + exit 3 + fi + ;; + *) + echo "Usage: $0 {start|stop|status|restart|force-reload|reload}" + exit 1 + ;; +esac diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index db96b5d299..57fb00b676 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -38,7 +38,7 @@ get_dev_number() { if [ -z "$3" ]; then MEDIA=`cat /proc/ide/${1}/media` if [ "${MEDIA}" = "cdrom" ]; then - echo ${1} ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` + echo $1 ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` elif [ "${MEDIA}" = "disk" ]; then echo $1 ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc fi diff --git a/udev.spec b/udev.spec index 9e301deb7c..4056025df8 100644 --- a/udev.spec +++ b/udev.spec @@ -16,6 +16,11 @@ # 1 - debugging enabled %define debug 0 +# if we want to use the LSB version of the init script or the Redhat one +# 0 - use Redhat version: etc/init.d/udev +# 1 - use LSB version: etc/init.d/udev.init.LSB +%define lsb 0 + Summary: A userspace implementation of devfs Name: udev Version: 012_bk @@ -52,6 +57,9 @@ make DESTDIR=$RPM_BUILD_ROOT install \ %if %{dbus} USE_DBUS=true %endif +%if %{lsb} + USE_LSB=true +%endif %post /sbin/chkconfig --add udev @@ -81,6 +89,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_mandir}/man8/udev.8* %changelog +* Mon Jan 05 2004 Rolf Eike Beer +- add defines to choose the init script (Redhat or LSB) + * Tue Dec 16 2003 Robert Love - install the initscript and run chkconfig on it @@ -96,4 +107,3 @@ rm -rf $RPM_BUILD_ROOT * Mon Jul 28 2003 Paul Mundt - Initial spec file for udev-0.2. - -- cgit v1.2.3-54-g00ecf From 606143c8d214f7bb7271d40d514eb23a86547b3c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 12 Jan 2004 21:17:22 -0800 Subject: [PATCH] udev - Makefile error I get the following error on install: pim:/home/kay/src/udev.test# make install sed -e "s:@udevdir@:/udev:" < etc/udev/udev.conf.in > etc/udev/udev.conf /usr/bin/install -c -d /etc/udev/ /usr/bin/install -c -d /udev /usr/bin/install -c -d /etc/hotplug.d/default /usr/bin/install -c -D udev /sbin/udev /bin/sh: -c: line 2: syntax error: unexpected end of file make: *** [install] Error 2 --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 36f0272d02..5e64129266 100644 --- a/Makefile +++ b/Makefile @@ -297,10 +297,10 @@ install: install-config install-dbus-policy all $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) @if [ "x$(USE_LSB)" = "xtrue" ]; then \ - $(INSTALL_PROGRAM) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev - ln -s $(DESTDIR)$(initdir)/udev $(sbin_dir)/rcudev - else - $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev + $(INSTALL_PROGRAM) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ + ln -s $(DESTDIR)$(initdir)/udev $(sbin_dir)/rcudev; \ + else \ + $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ fi $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 - rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug -- cgit v1.2.3-54-g00ecf From 5472beeea5884dfc8bc5afb0f963de3ea3232e66 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 12 Jan 2004 21:18:57 -0800 Subject: [PATCH] udev - advanced user query options This patch improves the user options for udev. It is possible now to query for the name, the symlinks or owner/group. If asked for the name of the node we are able to prepend the udev_root with the -r option. SAMPLE: kay@pim:~/src/udev.test$ ./udev -V udev, version 012_bk kay@pim:~/src/udev.test$ ./udev -h Usage: [-qrVh] -q query database for the specified value -p device path used for query -r print udev root -V print udev version -h print this help text kay@pim:~/src/udev.test$ ./udev -r /udev/ kay@pim:~/src/udev.test$ ./udev -q name -p /class/video4linux/video0 video/webcam0 kay@pim:~/src/udev.test$ ./udev -q symlink -p /class/video4linux/video0 camera0 kamera0 kay@pim:~/src/udev.test$ ./udev -q owner -p /class/video4linux/video0 501 kay@pim:~/src/udev.test$ ./udev -r -q name -p /class/video4linux/video0 /udev/video/webcam0 --- udev.c | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 93 insertions(+), 16 deletions(-) diff --git a/udev.c b/udev.c index 30921420a0..7078f089e2 100644 --- a/udev.c +++ b/udev.c @@ -82,13 +82,26 @@ static inline char *get_seqnum(void) return seqnum; } +enum query_type { + NONE, + NAME, + SYMLINK, + OWNER, + GROUP +}; + static inline int udev_user(int argc, char **argv) { - static const char short_options[] = "q:rVh"; + static const char short_options[] = "p:q:rVh"; int option; int retval = -EINVAL; struct udevice dev; + int root = 0; + enum query_type query = NONE; + char result[NAME_SIZE] = ""; + char path[NAME_SIZE] = ""; + /* get command line options */ while (1) { option = getopt(argc, argv, short_options); if (option == -1) @@ -96,25 +109,40 @@ static inline int udev_user(int argc, char **argv) dbg("option '%c'", option); switch (option) { + case 'p': + dbg("udev path: %s\n", optarg); + strfieldcpy(path, optarg); + break; + case 'q': dbg("udev query: %s\n", optarg); - retval = udevdb_open_ro(); - if (retval != 0) { - printf("unable to open udev database\n"); - return -1; + + if (strcmp(optarg, "name") == 0) { + query = NAME; + break; + } + + if (strcmp(optarg, "symlink") == 0) { + query = SYMLINK; + break; } - retval = udevdb_get_dev(optarg, &dev); - if (retval == 0) { - printf("%s\n", dev.name); - } else { - printf("device not found in udev database\n"); + + if (strcmp(optarg, "owner") == 0) { + query = OWNER; + break; } - udevdb_exit(); - return retval; + + if (strcmp(optarg, "group") == 0) { + query = GROUP; + break; + } + + printf("unknown query type\n"); + return -EINVAL; case 'r': - printf("%s\n", udev_root); - return 0; + root = 1; + break; case 'V': printf("udev, version %s\n", UDEV_VERSION); @@ -128,14 +156,63 @@ static inline int udev_user(int argc, char **argv) } } + /* process options */ + if (query != NONE) { + if (path[0] == '\0') { + printf("query needs device path specified\n"); + return -EINVAL; + } + + retval = udevdb_open_ro(); + if (retval != 0) { + printf("unable to open udev database\n"); + return -EACCES; + } + retval = udevdb_get_dev(path, &dev); + if (retval == 0) { + switch(query) { + case NAME: + if (root) + strfieldcpy(result, udev_root); + strncat(result, dev.name, sizeof(result)); + break; + + case SYMLINK: + strfieldcpy(result, dev.symlink); + break; + + case GROUP: + strfieldcpy(result, dev.group); + break; + + case OWNER: + strfieldcpy(result, dev.owner); + break; + + default: + break; + } + printf("%s\n", result); + } else { + printf("device not found in udev database\n"); + } + udevdb_exit(); + return retval; + } + + if (root) { + printf("%s\n", udev_root); + return 0; + } + help: printf("Usage: [-qrVh]\n" - " -q query database for the name of the created node\n" + " -q query database for the specified value\n" + " -p device path used for query\n" " -r print udev root\n" " -V print udev version\n" " -h print this help text\n" "\n"); - return retval; } -- cgit v1.2.3-54-g00ecf From ac28b86d631f23b5df74dbeb33e76a2b3f5d88bb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 12 Jan 2004 21:39:05 -0800 Subject: [PATCH] udev - drop all methods :) > Hi, > as promised yesterday, here is a patch that drops the explicit methods > given in the udev config and implement only one type of rule. > > A rule now consists only of a number of keys to match. All known keys > are valid in any combination. The former configs should work with a few > changes: > > o the ", " at the beginning of the line should be removed > > o the result of the externel program is matched with RESULT= instead if ID= > the PROGRAM= key is only valid if the program exits with zero > (just exit with nozero in a script if the rule should not match) > > o rules are processed in order they appear in the file, no priority > > o if NAME="" is given, udev is instructed to ignore this device, > no node will be created > > > EXAMPLE: > > # combined BUS, SYSFS and KERNEL > BUS="usb", KERNEL="video*", SYSFS_model="Creative Labs WebCam*", NAME="test/webcam%n" > > # exec script only for the first ide drive (hda), all other will be skipped > BUS="ide", KERNEL="hda*", PROGRAM="/home/kay/src/udev.kay/extras/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%1c", SYMLINK="%2c %3c" > > > The udev-test.pl and test.block works fine here. > Please adapt your config and give it a try. > Here is a slightly better version of the patch. After a conversation with Patrick, we are now able to execute the PROGRAM and also match in all following rules with the RESULT value from this exec. EXAMPLE: We have 7 rules with RESULT and 2 with PROGRAM. Only the 5th rule matches with the callout result from the exec in the 4th rule. RULES: PROGRAM="/bin/echo abc", RESULT="no_match", NAME="web-no-2" KERNEL="video*", RESULT="123", NAME="web-no-3" KERNEL="video*", RESULT="123", NAME="web-no-4" PROGRAM="/bin/echo 123", RESULT="no_match", NAME="web-no-5" KERNEL="video*", RESULT="123", NAME="web-yes" RESULT: Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check PROGRAM Jan 11 23:36:52 pim udev[26050]: execute_program: executing '/bin/echo abc' Jan 11 23:36:52 pim udev[26050]: execute_program: result is 'abc' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: PROGRAM returned successful Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='no_match', udev->program_result='abc' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for KERNEL dev->kernel='video*' class_dev->name='video0' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: KERNEL matches Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='123', udev->program_result='abc' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for KERNEL dev->kernel='video*' class_dev->name='video0' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: KERNEL matches Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='123', udev->program_result='abc' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check PROGRAM Jan 11 23:36:52 pim udev[26050]: execute_program: executing '/bin/echo 123' Jan 11 23:36:52 pim udev[26050]: execute_program: result is '123' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: PROGRAM returned successful Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='no_match', udev->program_result='123' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT is not matching Jan 11 23:36:52 pim udev[26050]: namedev_name_device: process rule Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for KERNEL dev->kernel='video*' class_dev->name='video0' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: KERNEL matches Jan 11 23:36:52 pim udev[26050]: namedev_name_device: check for RESULT dev->result='123', udev->program_result='123' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: RESULT matches Jan 11 23:36:52 pim udev[26050]: namedev_name_device: found matching rule, 'video*' becomes '' Jan 11 23:36:52 pim udev[26050]: namedev_name_device: name, 'web-yes' is going to have owner='', group='', mode = 0600 --- namedev.c | 361 +++++++++++++++++++++++------------------------------- namedev.h | 29 +---- namedev_parse.c | 154 +++++------------------ test/udev-test.pl | 117 +++++++++--------- udev.h | 2 +- 5 files changed, 244 insertions(+), 419 deletions(-) diff --git a/namedev.c b/namedev.c index e502ba1a39..41fefc4bc8 100644 --- a/namedev.c +++ b/namedev.c @@ -213,27 +213,27 @@ static void apply_format(struct udevice *udev, unsigned char *string) dbg("substitute major number '%u'", udev->major); break; case 'c': - if (strlen(udev->callout_value) == 0) + if (strlen(udev->program_result) == 0) break; if (num) { /* get part of return string */ - strncpy(temp, udev->callout_value, sizeof(temp)); + strncpy(temp, udev->program_result, sizeof(temp)); pos2 = temp; while (num) { num--; pos3 = strsep(&pos2, " "); if (pos3 == NULL) { - dbg("requested part of callout string not found"); + dbg("requested part of result string not found"); break; } } if (pos3) { strcat(pos, pos3); - dbg("substitute partial callout output '%s'", pos3); + dbg("substitute part of result string '%s'", pos3); } } else { - strcat(pos, udev->callout_value); - dbg("substitute callout output '%s'", udev->callout_value); + strcat(pos, udev->program_result); + dbg("substitute result string '%s'", udev->program_result); } break; default: @@ -298,28 +298,7 @@ exit: return; /* here to prevent compiler warning... */ } -static int do_ignore(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) -{ - struct config_device *dev; - struct list_head *tmp; - - list_for_each(tmp, &config_device_list) { - dev = list_entry(tmp, struct config_device, node); - if (dev->type != IGNORE) - continue; - - dbg("compare name '%s' with '%s'", dev->kernel_name, class_dev->name); - if (strcmp_pattern(dev->kernel_name, class_dev->name) != 0) - continue; - - dbg("found name, '%s' will be ignored", dev->kernel_name); - - return 0; - } - return -ENODEV; -} - -static int exec_program(char *path, char *value, int len) +static int execute_program(char *path, char *value, int len) { int retval; int res; @@ -332,7 +311,7 @@ static int exec_program(char *path, char *value, int len) char *args[CALLOUT_MAXARG]; int i; - dbg("callout to '%s'", path); + dbg("executing '%s'", path); retval = pipe(fds); if (retval != 0) { dbg("pipe failed"); @@ -349,7 +328,7 @@ static int exec_program(char *path, char *value, int len) close(STDOUT_FILENO); dup(fds[1]); /* dup write side of pipe to STDOUT */ if (strchr(path, ' ')) { - /* callout with arguments */ + /* exec with arguments */ pos = path; for (i=0; i < CALLOUT_MAXARG-1; i++) { args[i] = strsep(&pos, " "); @@ -379,11 +358,11 @@ static int exec_program(char *path, char *value, int len) break; buffer[res] = '\0'; if (res > len) { - dbg("callout len %d too short", len); + dbg("result len %d too short", len); retval = -1; } if (value_set) { - dbg("callout value already set"); + dbg("result value already set"); retval = -1; } else { value_set = 1; @@ -391,7 +370,7 @@ static int exec_program(char *path, char *value, int len) pos = value + strlen(value)-1; if (pos[0] == '\n') pos[0] = '\0'; - dbg("callout returned '%s'", value); + dbg("result is '%s'", value); } } close(fds[0]); @@ -402,46 +381,14 @@ static int exec_program(char *path, char *value, int len) } if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { - dbg("callout program status 0x%x", status); + dbg("exec program status 0x%x", status); retval = -1; } } return retval; } -static int do_callout(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) -{ - struct config_device *dev; - - list_for_each_entry(dev, &config_device_list, node) { - if (dev->type != CALLOUT) - continue; - - if (dev->bus[0] != '\0') { - /* as the user specified a bus, we must match it up */ - if (!sysfs_device) - continue; - dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); - if (strcasecmp(dev->bus, sysfs_device->bus) != 0) - continue; - } - - /* substitute anything that needs to be in the program name */ - apply_format(udev, dev->exec_program); - if (exec_program(dev->exec_program, udev->callout_value, NAME_SIZE)) - continue; - if (strcmp_pattern(dev->id, udev->callout_value) != 0) - continue; - strfieldcpy(udev->name, dev->name); - strfieldcpy(udev->symlink, dev->symlink); - dbg("callout returned matching value '%s', '%s' becomes '%s'", - dev->id, class_dev->name, udev->name); - return 0; - } - return -ENODEV; -} - -static int match_pair(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair) +static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair) { struct sysfs_attribute *tmpattr = NULL; char *c; @@ -461,7 +408,6 @@ static int match_pair(struct sysfs_class_device *class_dev, struct sysfs_device if (tmpattr) goto label_found; } - return -ENODEV; label_found: @@ -478,53 +424,26 @@ label_found: return 0; } -static int do_label(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +static int match_sysfs_pairs(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { struct sysfs_pair *pair; - struct config_device *dev; int i; - int match; - - list_for_each_entry(dev, &config_device_list, node) { - if (dev->type != LABEL) - continue; - - if (dev->bus[0] != '\0') { - /* as the user specified a bus, we must match it up */ - if (!sysfs_device) - continue; - dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); - if (strcasecmp(dev->bus, sysfs_device->bus) != 0) - continue; - } - match = 1; - for (i = 0; i < MAX_SYSFS_PAIRS; ++i) { - pair = &dev->sysfs_pair[i]; - if ((pair->file[0] == '\0') || (pair->value[0] == '\0')) - break; - if (match_pair(class_dev, sysfs_device, pair) != 0) { - match = 0; - break; - } + for (i = 0; i < MAX_SYSFS_PAIRS; ++i) { + pair = &dev->sysfs_pair[i]; + if ((pair->file[0] == '\0') || (pair->value[0] == '\0')) + break; + if (compare_sysfs_attribute(class_dev, sysfs_device, pair) != 0) { + dbg("sysfs attribute doesn't match"); + return -ENODEV; } - if (match == 0) - continue; - - /* found match */ - strfieldcpy(udev->name, dev->name); - strfieldcpy(udev->symlink, dev->symlink); - dbg("found matching attribute, '%s' becomes '%s' ", - class_dev->name, udev->name); - - return 0; } - return -ENODEV; + + return 0; } -static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +static int match_id(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { - struct config_device *dev; char path[SYSFS_PATH_MAX]; int found; char *temp = NULL; @@ -533,107 +452,56 @@ static int do_number(struct sysfs_class_device *class_dev, struct udevice *udev, if (!sysfs_device) return -ENODEV; - list_for_each_entry(dev, &config_device_list, node) { - if (dev->type != NUMBER) - continue; - - dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); - if (strcasecmp(dev->bus, sysfs_device->bus) != 0) - continue; - - found = 0; - strfieldcpy(path, sysfs_device->path); + found = 0; + strfieldcpy(path, sysfs_device->path); + temp = strrchr(path, '/'); + dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); + if (strstr(temp, dev->id) != NULL) { + found = 1; + } else { + *temp = 0x00; temp = strrchr(path, '/'); dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); - if (strstr(temp, dev->id) != NULL) { + if (strstr(temp, dev->id) != NULL) found = 1; - } else { - *temp = 0x00; - temp = strrchr(path, '/'); - dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); - if (strstr(temp, dev->id) != NULL) - found = 1; - } - if (!found) - continue; - strfieldcpy(udev->name, dev->name); - strfieldcpy(udev->symlink, dev->symlink); - dbg("found matching id '%s', '%s' becomes '%s'", - dev->id, class_dev->name, udev->name); - return 0; } - return -ENODEV; + if (!found) { + dbg("id doesn't match"); + return -ENODEV; + } + + return 0; } -static int do_topology(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +static int match_place(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { - struct config_device *dev; char path[SYSFS_PATH_MAX]; int found; char *temp = NULL; - /* we have to have a sysfs device for TOPOLOGY to work */ + /* we have to have a sysfs device for NUMBER to work */ if (!sysfs_device) return -ENODEV; - list_for_each_entry(dev, &config_device_list, node) { - if (dev->type != TOPOLOGY) - continue; - - dbg("dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); - if (strcasecmp(dev->bus, sysfs_device->bus) != 0) - continue; - - found = 0; - strfieldcpy(path, sysfs_device->path); + found = 0; + strfieldcpy(path, sysfs_device->path); + temp = strrchr(path, '/'); + dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); + if (strstr(temp, dev->place) != NULL) { + found = 1; + } else { + *temp = 0x00; temp = strrchr(path, '/'); dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); - if (strstr(temp, dev->place) != NULL) { + if (strstr(temp, dev->place) != NULL) found = 1; - } else { - *temp = 0x00; - temp = strrchr(path, '/'); - dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); - if (strstr(temp, dev->place) != NULL) - found = 1; - } - if (!found) - continue; - - strfieldcpy(udev->name, dev->name); - strfieldcpy(udev->symlink, dev->symlink); - dbg("found matching place '%s', '%s' becomes '%s'", - dev->place, class_dev->name, udev->name); - return 0; } - return -ENODEV; -} - -static int do_replace(struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) -{ - struct config_device *dev; - - list_for_each_entry(dev, &config_device_list, node) { - if (dev->type != REPLACE) - continue; - - dbg("compare name '%s' with '%s'", dev->kernel_name, class_dev->name); - if (strcmp_pattern(dev->kernel_name, class_dev->name) != 0) - continue; - - strfieldcpy(udev->name, dev->name); - strfieldcpy(udev->symlink, dev->symlink); - dbg("found name, '%s' becomes '%s'", dev->kernel_name, udev->name); - - return 0; + if (!found) { + dbg("place doesn't match"); + return -ENODEV; } - return -ENODEV; -} -static void do_kernelname(struct sysfs_class_device *class_dev, struct udevice *udev) -{ - /* heh, this is pretty simple... */ - strfieldcpy(udev->name, class_dev->name); + return 0; } static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_dev) @@ -725,7 +593,7 @@ exit: int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) { struct sysfs_device *sysfs_device = NULL; - int retval = 0; + struct config_device *dev; struct perm_device *perm; char *pos; @@ -752,34 +620,109 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud strfieldcpy(udev->kernel_number, pos); dbg("kernel_number='%s'", udev->kernel_number); - /* rules are looked at in priority order */ - retval = do_ignore(class_dev, udev, sysfs_device); - if (retval == 0) { - dbg("name, '%s' is being ignored", class_dev->name); - return 1; - } + /* look for a matching rule to apply */ + list_for_each_entry(dev, &config_device_list, node) { + dbg("process rule"); - retval = do_callout(class_dev, udev, sysfs_device); - if (retval == 0) - goto found; + /* check for matching bus value */ + if (dev->bus[0] != '\0') { + if (sysfs_device == NULL) { + dbg("device has no bus"); + continue; + } + dbg("check for " FIELD_BUS " dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + if (strcmp_pattern(dev->bus, sysfs_device->bus) != 0) { + dbg(FIELD_BUS " is not matching"); + continue; + } else { + dbg(FIELD_BUS " matches"); + } + } - retval = do_label(class_dev, udev, sysfs_device); - if (retval == 0) - goto found; + /* check for matching kernel name*/ + if (dev->kernel[0] != '\0') { + dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", dev->kernel, class_dev->name); + if (strcmp_pattern(dev->kernel, class_dev->name) != 0) { + dbg(FIELD_KERNEL " is not matching"); + continue; + } else { + dbg(FIELD_KERNEL " matches"); + } + } - retval = do_number(class_dev, udev, sysfs_device); - if (retval == 0) - goto found; + /* check for matching bus id */ + if (dev->id[0] != '\0') { + dbg("check " FIELD_ID); + if (match_id(dev, class_dev, sysfs_device) != 0) { + dbg(FIELD_ID " is not matching"); + continue; + } else { + dbg(FIELD_ID " matches"); + } + } - retval = do_topology(class_dev, udev, sysfs_device); - if (retval == 0) - goto found; + /* check for matching place of device */ + if (dev->place[0] != '\0') { + dbg("check " FIELD_PLACE); + if (match_place(dev, class_dev, sysfs_device) != 0) { + dbg(FIELD_PLACE " is not matching"); + continue; + } else { + dbg(FIELD_PLACE " matches"); + } + } - retval = do_replace(class_dev, udev, sysfs_device); - if (retval == 0) + /* check for matching sysfs pairs */ + if (dev->sysfs_pair[0].file[0] != '\0') { + dbg("check " FIELD_SYSFS " pairs"); + if (match_sysfs_pairs(dev, class_dev, sysfs_device) != 0) { + dbg(FIELD_SYSFS " is not matching"); + continue; + } else { + dbg(FIELD_SYSFS " matches"); + } + } + + /* execute external program */ + if (dev->program[0] != '\0') { + dbg("check " FIELD_PROGRAM); + apply_format(udev, dev->program); + if (execute_program(dev->program, udev->program_result, NAME_SIZE) != 0) { + dbg(FIELD_PROGRAM " returned nozero"); + continue; + } else { + dbg(FIELD_PROGRAM " returned successful"); + } + } + + /* check for matching result of external program */ + if (dev->result[0] != '\0') { + dbg("check for " FIELD_RESULT + " dev->result='%s', udev->program_result='%s'", + dev->result, udev->program_result); + if (strcmp_pattern(dev->result, udev->program_result) != 0) { + dbg(FIELD_RESULT " is not matching"); + continue; + } else { + dbg(FIELD_RESULT " matches"); + } + } + + /* check if we are instructed to ignore this device */ + if (dev->name[0] == '\0') { + dbg("instructed to ignore this device"); + return -1; + } + + /* Yup, this rule belongs to us! */ + dbg("found matching rule, '%s' becomes '%s'", dev->kernel, udev->name); + strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); goto found; + } - do_kernelname(class_dev, udev); + /* no rule was found so we use the kernel name */ + strfieldcpy(udev->name, class_dev->name); goto done; found: diff --git a/namedev.h b/namedev.h index f1e770277b..4e75db6410 100644 --- a/namedev.h +++ b/namedev.h @@ -28,17 +28,6 @@ struct sysfs_class_device; - -enum config_type { - KERNEL_NAME = 0, /* must be 0 to let memset() default to this value */ - LABEL = 1, - NUMBER = 2, - TOPOLOGY = 3, - REPLACE = 4, - CALLOUT = 5, - IGNORE = 6, -}; - #define BUS_SIZE 30 #define FILE_SIZE 50 #define VALUE_SIZE 100 @@ -46,23 +35,17 @@ enum config_type { #define PLACE_SIZE 50 #define PROGRAM_SIZE 100 -#define TYPE_LABEL "LABEL" -#define TYPE_NUMBER "NUMBER" -#define TYPE_TOPOLOGY "TOPOLOGY" -#define TYPE_REPLACE "REPLACE" -#define TYPE_CALLOUT "CALLOUT" -#define TYPE_IGNORE "IGNORE" - #define FIELD_BUS "BUS" -#define FIELD_ID "ID" #define FIELD_SYSFS "SYSFS_" +#define FIELD_ID "ID" #define FIELD_PLACE "PLACE" #define FIELD_PROGRAM "PROGRAM" +#define FIELD_RESULT "RESULT" #define FIELD_KERNEL "KERNEL" #define FIELD_NAME "NAME" #define FIELD_SYMLINK "SYMLINK" -#define CALLOUT_MAXARG 8 +#define CALLOUT_MAXARG 10 #define MAX_SYSFS_PAIRS 5 struct sysfs_pair { @@ -73,12 +56,12 @@ struct sysfs_pair { struct config_device { struct list_head node; - enum config_type type; char bus[BUS_SIZE]; char id[ID_SIZE]; char place[PLACE_SIZE]; - char kernel_name[NAME_SIZE]; - char exec_program[PROGRAM_SIZE]; + char kernel[NAME_SIZE]; + char program[PROGRAM_SIZE]; + char result[PROGRAM_SIZE]; char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; diff --git a/namedev_parse.c b/namedev_parse.c index 5b5a5b3bc1..98e822dfef 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -86,37 +86,13 @@ int get_pair(char **orig_string, char **left, char **right) void dump_config_dev(struct config_device *dev) { - switch (dev->type) { - case KERNEL_NAME: - dbg_parse("KERNEL name='%s'", dev->name); - break; - case LABEL: - dbg_parse("LABEL name='%s', bus='%s', sysfs_file[0]='%s', sysfs_value[0]='%s'", - dev->name, dev->bus, dev->sysfs_pair[0].file, dev->sysfs_pair[0].value); - break; - case NUMBER: - dbg_parse("NUMBER name='%s', bus='%s', id='%s'", - dev->name, dev->bus, dev->id); - break; - case TOPOLOGY: - dbg_parse("TOPOLOGY name='%s', bus='%s', place='%s'", - dev->name, dev->bus, dev->place); - break; - case REPLACE: - dbg_parse("REPLACE name='%s', kernel_name='%s'", - dev->name, dev->kernel_name); - break; - case CALLOUT: - dbg_parse("CALLOUT name='%s', bus='%s', program='%s', id='%s'", - dev->name, dev->bus, dev->exec_program, dev->id); - break; - case IGNORE: - dbg_parse("IGNORE name='%s', kernel_name='%s'", - dev->name, dev->kernel_name); - break; - default: - dbg_parse("unknown type of method"); - } + /*FIXME dump all sysfs's */ + dbg_parse("name='%s', symlink='%s', bus='%s', place='%s', id='%s', " + "sysfs_file[0]='%s', sysfs_value[0]='%s', " + "kernel='%s', program='%s', result='%s'", + dev->name, dev->symlink, dev->bus, dev->place, dev->id, + dev->sysfs_pair[0].file, dev->sysfs_pair[0].value, + dev->kernel, dev->program, dev->result); } void dump_config_dev_list(void) @@ -150,6 +126,7 @@ int namedev_init_rules(void) char *temp2; char *temp3; FILE *fd; + int program_given = 0; int retval = 0; struct config_device dev; @@ -185,42 +162,6 @@ int namedev_init_rules(void) memset(&dev, 0x00, sizeof(struct config_device)); - /* get the method */ - temp2 = strsep(&temp, ","); - - if (strcasecmp(temp2, TYPE_LABEL) == 0) { - dev.type = LABEL; - goto keys; - } - - if (strcasecmp(temp2, TYPE_NUMBER) == 0) { - dev.type = NUMBER; - goto keys; - } - - if (strcasecmp(temp2, TYPE_TOPOLOGY) == 0) { - dev.type = TOPOLOGY; - goto keys; - } - - if (strcasecmp(temp2, TYPE_REPLACE) == 0) { - dev.type = REPLACE; - goto keys; - } - - if (strcasecmp(temp2, TYPE_CALLOUT) == 0) { - dev.type = CALLOUT; - goto keys; - } - - if (strcasecmp(temp2, TYPE_IGNORE) == 0) { - dev.type = IGNORE; - goto keys; - } - - dbg_parse("unknown type of method '%s'", temp2); - goto error; -keys: /* get all known keys */ while (1) { retval = get_pair(&temp, &temp2, &temp3); @@ -264,12 +205,18 @@ keys: } if (strcasecmp(temp2, FIELD_KERNEL) == 0) { - strfieldcpy(dev.kernel_name, temp3); + strfieldcpy(dev.kernel, temp3); continue; } if (strcasecmp(temp2, FIELD_PROGRAM) == 0) { - strfieldcpy(dev.exec_program, temp3); + program_given = 1; + strfieldcpy(dev.program, temp3); + continue; + } + + if (strcasecmp(temp2, FIELD_RESULT) == 0) { + strfieldcpy(dev.result, temp3); continue; } @@ -286,60 +233,15 @@ keys: dbg_parse("unknown type of field '%s'", temp2); } - /* check presence of keys according to method type */ - switch (dev.type) { - case LABEL: - dbg_parse(TYPE_LABEL " name='%s', bus='%s', " - "sysfs_file[0]='%s', sysfs_value[0]='%s', symlink='%s'", - dev.name, dev.bus, dev.sysfs_pair[0].file, - dev.sysfs_pair[0].value, dev.symlink); - if ((*dev.name == '\0') || - (*dev.sysfs_pair[0].file == '\0') || - (*dev.sysfs_pair[0].value == '\0')) - goto error; - break; - case NUMBER: - dbg_parse(TYPE_NUMBER " name='%s', bus='%s', id='%s', symlink='%s'", - dev.name, dev.bus, dev.id, dev.symlink); - if ((*dev.name == '\0') || - (*dev.bus == '\0') || - (*dev.id == '\0')) - goto error; - break; - case TOPOLOGY: - dbg_parse(TYPE_TOPOLOGY " name='%s', bus='%s', " - "place='%s', symlink='%s'", - dev.name, dev.bus, dev.place, dev.symlink); - if ((*dev.name == '\0') || - (*dev.bus == '\0') || - (*dev.place == '\0')) - goto error; - break; - case REPLACE: - dbg_parse(TYPE_REPLACE " name='%s', kernel_name='%s', symlink='%s'", - dev.name, dev.kernel_name, dev.symlink); - if ((*dev.name == '\0') || - (*dev.kernel_name == '\0')) - goto error; - break; - case CALLOUT: - dbg_parse(TYPE_CALLOUT " name='%s', bus='%s', program='%s', " - "id='%s', symlink='%s'", - dev.name, dev.bus, dev.exec_program, - dev.id, dev.symlink); - if ((*dev.name == '\0') || - (*dev.id == '\0') || - (*dev.exec_program == '\0')) - goto error; - break; - case IGNORE: - dbg_parse(TYPE_IGNORE "name='%s', kernel_name='%s'", - dev.name, dev.kernel_name); - if ((*dev.kernel_name == '\0')) - goto error; - break; - default: - dbg_parse("unknown type of method"); + /* simple plausibility check for given keys */ + if ((dev.sysfs_pair[0].file[0] == '\0') ^ + (dev.sysfs_pair[0].value[0] == '\0')) { + dbg("inconsistency in SYSFS_ key"); + goto error; + } + + if ((dev.result[0] != '\0') && (program_given == 0)) { + dbg("RESULT is only useful when PROGRAM called in any rule before"); goto error; } @@ -347,11 +249,11 @@ keys: if (retval) { dbg("add_config_dev returned with error %d", retval); continue; +error: + dbg("%s:%d:%Zd: parse error, rule skipped", + udev_rules_filename, lineno, temp - line); } } -error: - dbg_parse("%s:%d:%Zd: field missing or parse error", udev_rules_filename, - lineno, temp - line); exit: fclose(fd); return retval; diff --git a/test/udev-test.pl b/test/udev-test.pl index 97c0094921..ab27c74c6a 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -38,8 +38,8 @@ my @tests = ( devpath => "block/sda", expected => "boot_disk" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "class/tty/ttyUSB0", expected => "visor/0" , conf => < "class/tty/ttyUSB0", expected => "visor/0" , conf => < "class/tty/ttyUSB0", expected => "visor/0" , conf => < "class/tty/ttyUSB0", expected => "visor" , conf => < "visor" , conf => < "visor" , conf => < "visor" , conf => < "class/tty/ttyUSB0", expected => "sub/direct/ory/visor" , conf => < "block/sda/sda3", expected => "first_disk3" , conf => < "block/sda/sda3", expected => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "callout result substitution", + desc => "program result substitution", subsys => "block", devpath => "block/sda/sda3", expected => "special-device-3" , conf => < "callout program substitution", + desc => "program result substitution", subsys => "block", devpath => "block/sda/sda3", expected => "test-0:0:0:0" , conf => < "callout program substitution (numbered part of)", + desc => "program result substitution (numbered part of)", subsys => "block", devpath => "block/sda/sda3", expected => "link1" , conf => < "invalid callout for device with no bus", + desc => "invalid program for device with no bus", subsys => "tty", devpath => "class/tty/console", expected => "TTY" , conf => < "valid callout for device with no bus", + desc => "valid program for device with no bus", subsys => "tty", devpath => "class/tty/console", expected => "foo" , conf => < "class/tty/console", expected => "TTY" , conf => < "class/tty/console", expected => "foo" , conf => < "block/sda", expected => "lun0/disc" , conf => < "block/sda/sda2", expected => "lun0/part2" , conf => < "callout bus type", + desc => "program and bus type match", subsys => "block", devpath => "block/sda", expected => "scsi-0:0:0:0" , conf => < "class/tty/ttyUSB0", expected => "visor0" , conf => < "block/sda/sda2", expected => "1/2/a/b/symlink" , conf => < "block/sda/sda2", expected => "1/2/symlink" , conf => < "block/sda/sda2", expected => "1/2/c/d/symlink" , conf => < "class/tty/ttyUSB0", expected => "second-0" , conf => <{conf} =~ m/([A-Z]+)\s*,/; - my $method = $1; - print "TEST: $config->{desc}\n"; - print "method \'$method\' for \'$config->{devpath}\' expecting node \'$config->{expected}\'\n"; + print "device \'$config->{devpath}\' expecting node \'$config->{expected}\'\n"; udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); if (-e "$PWD/$udev_root$config->{expected}") { diff --git a/udev.h b/udev.h index 656c1b7d8c..678731c7d1 100644 --- a/udev.h +++ b/udev.h @@ -68,7 +68,7 @@ struct udevice { /* fields that help us in building strings */ unsigned char bus_id[SYSFS_NAME_LEN]; - unsigned char callout_value[NAME_SIZE]; + unsigned char program_result[NAME_SIZE]; unsigned char kernel_number[NAME_SIZE]; unsigned char kernel_name[NAME_SIZE]; -- cgit v1.2.3-54-g00ecf From 851cd18d81f7bce79947a014f19a6cb97141311d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 12 Jan 2004 23:08:43 -0800 Subject: [PATCH] Add some helpful messages if the user uses the older config file format Also fail a rule that we can not parse, as we can easily create incorrect rules if we do not do this. --- namedev_parse.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index 98e822dfef..0712c3b447 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -21,8 +21,10 @@ * */ -/* define this to enable parsing debugging */ +#ifdef DEBUG +/* define this to enable parsing debugging also */ /* #define DEBUG_PARSER */ +#endif #include #include @@ -230,7 +232,9 @@ int namedev_init_rules(void) continue; } - dbg_parse("unknown type of field '%s'", temp2); + dbg("unknown type of field '%s'", temp2); + dbg("You might be using a rules file in the old format, please fix."); + goto error; } /* simple plausibility check for given keys */ @@ -250,7 +254,7 @@ int namedev_init_rules(void) dbg("add_config_dev returned with error %d", retval); continue; error: - dbg("%s:%d:%Zd: parse error, rule skipped", + dbg("%s:%d:%d: parse error, rule skipped", udev_rules_filename, lineno, temp - line); } } -- cgit v1.2.3-54-g00ecf From b7824727a07a3d23674cfffbb0a819ed4184ecb2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 12 Jan 2004 23:09:02 -0800 Subject: [PATCH] add bus test for usb-serial bus. --- namedev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/namedev.c b/namedev.c index 41fefc4bc8..80ab96afe5 100644 --- a/namedev.c +++ b/namedev.c @@ -252,6 +252,7 @@ static struct bus_file { } bus_files[] = { { .bus = "scsi", .file = "vendor" }, { .bus = "usb", .file = "idVendor" }, + { .bus = "usb-serial", .file = "detach_state" }, { .bus = "ide", .file = "detach_state" }, { .bus = "pci", .file = "vendor" }, {} -- cgit v1.2.3-54-g00ecf From c38b796be9ff453903db7b4813f69323b6422695 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 12 Jan 2004 23:09:20 -0800 Subject: [PATCH] convert the test shell scripts to the config file format. --- test/ignore_test | 2 +- test/label_test | 4 ++-- test/modifier_test | 2 +- test/replace_test | 2 +- test/topo_test | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/ignore_test b/test/ignore_test index 888fd16ff3..602624c1e0 100644 --- a/test/ignore_test +++ b/test/ignore_test @@ -8,7 +8,7 @@ export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG cat > $RULES << EOF -IGNORE, KERNEL="ttyUSB0" +KERNEL="ttyUSB0", NAME="" EOF cat > $CONFIG << EOF diff --git a/test/label_test b/test/label_test index cf0d2eb09c..93d02c18f2 100644 --- a/test/label_test +++ b/test/label_test @@ -8,8 +8,8 @@ export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG cat > $RULES << EOF -LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW !#", NAME="boot_diskX%n" -LABEL, BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW !#", NAME="boot_disk%n" +BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW !#", NAME="boot_diskX%n" +BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW !#", NAME="boot_disk%n" EOF cat > $CONFIG << EOF diff --git a/test/modifier_test b/test/modifier_test index 9af946e598..7ffc7b16a1 100644 --- a/test/modifier_test +++ b/test/modifier_test @@ -8,7 +8,7 @@ export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG cat > $RULES << EOF -TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" +BUS="scsi", place="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" EOF cat > $CONFIG << EOF diff --git a/test/replace_test b/test/replace_test index 9ed366e358..10215b0f24 100644 --- a/test/replace_test +++ b/test/replace_test @@ -8,7 +8,7 @@ export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG cat > $RULES << EOF -REPLACE, KERNEL="ttyUSB0", NAME="visor" +KERNEL="ttyUSB0", NAME="visor" EOF cat > $CONFIG << EOF diff --git a/test/topo_test b/test/topo_test index 385f415893..18b2549b97 100644 --- a/test/topo_test +++ b/test/topo_test @@ -8,7 +8,7 @@ export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG cat > $RULES << EOF -TOPOLOGY, BUS="scsi", place="0:0:0:0", NAME="first_disk%n" +BUS="scsi", place="0:0:0:0", NAME="first_disk%n" EOF cat > $CONFIG << EOF -- cgit v1.2.3-54-g00ecf From 71cf391508a0f458971b327260d3d90af629131f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 12 Jan 2004 23:13:10 -0800 Subject: [PATCH] convert the default rules files to the new format. --- etc/udev/udev.rules | 34 +++++++++++++-------------- etc/udev/udev.rules.devfs | 34 +++++++++++++-------------- etc/udev/udev.rules.gentoo | 58 +++++++++++++++++++++++----------------------- 3 files changed, 63 insertions(+), 63 deletions(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 68c0c63c89..e72751656e 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -14,44 +14,44 @@ # # Looking for scsi bus id 42:0:0:1 -CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" +BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" # A usb camera. -LABEL, BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" +BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" # USB Epson printer to be called lp_epson -LABEL, BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" +BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" # USB HP printer to be called lp_hp -LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" +BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" # sound card with PCI bus id 00:0b.0 to be the first sound card -NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" +BUS="pci", ID="00:0b.0", NAME="dsp" # sound card with PCI bus id 00:07.1 to be the second sound card -NUMBER, BUS="pci", ID="00:07.1", NAME="dsp1" +BUS="pci", ID="00:07.1", NAME="dsp1" # USB mouse plugged into the third port of the first hub to be called mouse0 -TOPOLOGY, BUS="usb", PLACE="1.3", NAME="mouse0" +BUS="usb", PLACE="1.3", NAME="mouse0" # USB tablet plugged into the third port of the second hub to be called mouse1 -TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" -TOPOLOGY, BUS="usb", PLACE="2.4", NAME="mouse2" +BUS="usb", PLACE="2.3", NAME="mouse1" +BUS="usb", PLACE="2.4", NAME="mouse2" # ttyUSB1 should always be called visor -REPLACE, KERNEL="ttyUSB1", NAME="visor" -REPLACE, KERNEL="ttyUSB0", NAME="pl2303" +KERNEL="ttyUSB1", NAME="visor" +KERNEL="ttyUSB0", NAME="pl2303" # a devfs like way to name some tty devices -#REPLACE, KERNEL="ttyS*", NAME="tts/%n" -#REPLACE, KERNEL="tty*", NAME="vc/%n" +#KERNEL="ttyS*", NAME="tts/%n" +#KERNEL="tty*", NAME="vc/%n" # if this is a ide cdrom, name it the default name, and create a symlink to cdrom -CALLOUT, BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", ID="cdrom", NAME="%k", SYMLINK="cdrom" +BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", ID="cdrom", NAME="%k", SYMLINK="cdrom" -# device mapper creates its own device nodes -IGNORE, KERNEL="dm-[0-9]*" +# device mapper creates its own device nodes so ignore these +KERNEL="dm-[0-9]*", NAME="" # DRI devices always go into a subdirectory (as per the LSB spec) -REPLACE, KERNEL="card*", NAME="dri/card%n" +KERNEL="card*", NAME="dri/card%n" diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index 537d655a0e..b165e0dc8b 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -17,30 +17,30 @@ # # ide block devices -NUMBER, BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D" -NUMBER, BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%D" -NUMBER, BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%D" -NUMBER, BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D" +BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D" +BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%D" +BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%D" +BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D" # md block devices -REPLACE, KERNEL="md[0-9]*", NAME="md/%n" +KERNEL="md[0-9]*", NAME="md/%n" # tty devices -REPLACE, KERNEL="tty[0-9]*", NAME="vc/%n" -REPLACE, KERNEL="ttyS[0-9]*", NAME="tts/%n" -REPLACE, KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" +KERNEL="tty[0-9]*", NAME="vc/%n" +KERNEL="ttyS[0-9]*", NAME="tts/%n" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" # vc devices -REPLACE, KERNEL="vcs", NAME="vcc/0" -REPLACE, KERNEL="vcs[0-9]*", NAME="vcc/%n" -REPLACE, KERNEL="vcsa", NAME="vcc/a0" -REPLACE, KERNEL="vcsa[0-9]*", NAME="vcc/a%n" +KERNEL="vcs", NAME="vcc/0" +KERNEL="vcs[0-9]*", NAME="vcc/%n" +KERNEL="vcsa", NAME="vcc/a0" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n" # v4l devices -REPLACE, KERNEL="video[0-9]*", NAME="v4l/video%n" -REPLACE, KERNEL="radio[0-9]*", NAME="v4l/radio%n" -REPLACE, KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" -REPLACE, KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" +KERNEL="video[0-9]*", NAME="v4l/video%n" +KERNEL="radio[0-9]*", NAME="v4l/radio%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" # dm devices -IGNORE, KERNEL="dm-[0-9]*" +KERNEL="dm-[0-9]*", NAME="" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index e752fd0216..51c8bdd99d 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -23,33 +23,33 @@ ########################################################### # Looking for scsi bus id 42:0:0:1 -CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" +BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" # A usb camera. -LABEL, BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" +BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" # USB Epson printer to be called lp_epson -LABEL, BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" +BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" # USB HP printer to be called lp_hp -LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" +BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" # sound card with PCI bus id 00:0b.0 to be the first sound card -NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" +BUS="pci", ID="00:0b.0", NAME="dsp" # sound card with PCI bus id 00:07.1 to be the second sound card -NUMBER, BUS="pci", ID="00:07.1", NAME="dsp1" +BUS="pci", ID="00:07.1", NAME="dsp1" # USB mouse plugged into the third port of the first hub to be called mouse0 -TOPOLOGY, BUS="usb", PLACE="1.3", NAME="mouse0" +BUS="usb", PLACE="1.3", NAME="mouse0" # USB tablet plugged into the third port of the second hub to be called mouse1 -TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" -TOPOLOGY, BUS="usb", PLACE="2.4", NAME="mouse2" +BUS="usb", PLACE="2.3", NAME="mouse1" +BUS="usb", PLACE="2.4", NAME="mouse2" # ttyUSB1 should always be called visor -REPLACE, KERNEL="ttyUSB1", NAME="visor" -REPLACE, KERNEL="ttyUSB0", NAME="pl2303" +KERNEL="ttyUSB1", NAME="visor" +KERNEL="ttyUSB0", NAME="pl2303" ########################################################### @@ -60,38 +60,38 @@ REPLACE, KERNEL="ttyUSB0", NAME="pl2303" # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -CALLOUT, BUS="ide", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c %3c" +BUS="ide", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c %3c" # fb devices -REPLACE, KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" # loop devices -REPLACE, KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" # md block devices -REPLACE, KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" +KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" # pty devices -REPLACE, KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -REPLACE, KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" +KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" # ram devices -REPLACE, KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" +KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" # tty devices -REPLACE, KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" -REPLACE, KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" -REPLACE, KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" # vc devices -REPLACE, KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" -REPLACE, KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" -REPLACE, KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" -REPLACE, KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" +KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" +KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" +KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" # v4l devices -REPLACE, KERNEL="video[0-9]*", NAME="v4l/video%n" -REPLACE, KERNEL="radio[0-9]*", NAME="v4l/radio%n" -REPLACE, KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" -REPLACE, KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" +KERNEL="video[0-9]*", NAME="v4l/video%n" +KERNEL="radio[0-9]*", NAME="v4l/radio%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" -- cgit v1.2.3-54-g00ecf From 1f7148c7df35aea00f96ad52db221c0d561dbc4c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 12 Jan 2004 23:22:13 -0800 Subject: [PATCH] fix a few stale comments in namedev.c --- namedev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 80ab96afe5..4247b26693 100644 --- a/namedev.c +++ b/namedev.c @@ -449,7 +449,7 @@ static int match_id(struct config_device *dev, struct sysfs_class_device *class_ int found; char *temp = NULL; - /* we have to have a sysfs device for NUMBER to work */ + /* we have to have a sysfs device for ID to work */ if (!sysfs_device) return -ENODEV; @@ -480,7 +480,7 @@ static int match_place(struct config_device *dev, struct sysfs_class_device *cla int found; char *temp = NULL; - /* we have to have a sysfs device for NUMBER to work */ + /* we have to have a sysfs device for PLACE to work */ if (!sysfs_device) return -ENODEV; -- cgit v1.2.3-54-g00ecf From 86673eb3edb0f23bb83f2d04ed76f0302ea39fa5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 12 Jan 2004 23:22:52 -0800 Subject: [PATCH] Add alsa device rules and a few other devfs rules. Thanks to Libor Klepac for the information --- etc/udev/udev.rules | 8 ++++++++ etc/udev/udev.rules.devfs | 27 ++++++++++++++++++++++++++- etc/udev/udev.rules.gentoo | 24 ++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index e72751656e..12c7c581ec 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -55,3 +55,11 @@ KERNEL="dm-[0-9]*", NAME="" # DRI devices always go into a subdirectory (as per the LSB spec) KERNEL="card*", NAME="dri/card%n" +# alsa devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index b165e0dc8b..3c45db79cf 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -42,5 +42,30 @@ KERNEL="radio[0-9]*", NAME="v4l/radio%n" KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" -# dm devices +# dm devices (ignore them) KERNEL="dm-[0-9]*", NAME="" + +# i2c devices +KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" + +# loop devices +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" + +# ramdisks +KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" + +# framebuffer devices +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" + +# misc +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" + +# alsa devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 51c8bdd99d..a9c5f57bb4 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -95,3 +95,27 @@ KERNEL="radio[0-9]*", NAME="v4l/radio%n" KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" +# dm devices (ignore them) +KERNEL="dm-[0-9]*", NAME="" + +# i2c devices +KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" + +# loop devices +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" + +# framebuffer devices +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" + +# misc devices +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" + +# alsa devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + -- cgit v1.2.3-54-g00ecf From 655f414dde99fefacdd43948f3ca95ab05373e83 Mon Sep 17 00:00:00 2001 From: "elkropac@students.zcu.cz" Date: Mon, 12 Jan 2004 23:29:57 -0800 Subject: [PATCH] fix udev directory for Debian init script there is also patch on debian init.d file, it uses variable $udev_dir also when creating and removing symlinks --- etc/init.d/udev.debian | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/etc/init.d/udev.debian b/etc/init.d/udev.debian index cf7b0070ad..d67941cc13 100644 --- a/etc/init.d/udev.debian +++ b/etc/init.d/udev.debian @@ -72,24 +72,24 @@ case "$1" in run_udev # hack to create stdin node - cd /udev && ln -s /proc/self/fd fd - cd /udev && ln -s fd/0 stdin - cd /udev && ln -s fd/1 stdout - cd /udev && ln -s fd/2 stderr - cd /udev && ln -s /proc/kcore core - cd /udev && ln -s /proc/asound/oss/sndstat sndstat + cd $udev_dir && ln -s /proc/self/fd fd + cd $udev_dir && ln -s fd/0 stdin + cd $udev_dir && ln -s fd/1 stdout + cd $udev_dir && ln -s fd/2 stderr + cd $udev_dir && ln -s /proc/kcore core + cd $udev_dir && ln -s /proc/asound/oss/sndstat sndstat ;; stop) # be careful action "Removing udev device nodes: " /bin/true export ACTION=remove run_udev - rm -f /udev/sndstat - rm -f /udev/core - rm -f /udev/stderr - rm -f /udev/stdout - rm -f /udev/stdin - rm -f /udev/fd + rm -f $udev_dir/sndstat + rm -f $udev_dir/core + rm -f $udev_dir/stderr + rm -f $udev_dir/stdout + rm -f $udev_dir/stdin + rm -f $udev_dir/fd ;; status) if [ -d $udev_dir ]; then -- cgit v1.2.3-54-g00ecf From 1eefb969ab96e3a897d0d1344db38ae2956eec31 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 12 Jan 2004 23:45:30 -0800 Subject: [PATCH] oops, forgot to fix up the PROGRAM result from ID to RESULT in the config files. --- etc/udev/udev.rules | 4 ++-- etc/udev/udev.rules.gentoo | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 12c7c581ec..6cb4896743 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -14,7 +14,7 @@ # # Looking for scsi bus id 42:0:0:1 -BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" +BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" # A usb camera. BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" @@ -47,7 +47,7 @@ KERNEL="ttyUSB0", NAME="pl2303" #KERNEL="tty*", NAME="vc/%n" # if this is a ide cdrom, name it the default name, and create a symlink to cdrom -BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", ID="cdrom", NAME="%k", SYMLINK="cdrom" +BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" # device mapper creates its own device nodes so ignore these KERNEL="dm-[0-9]*", NAME="" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index a9c5f57bb4..4a3292853f 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -23,7 +23,7 @@ ########################################################### # Looking for scsi bus id 42:0:0:1 -BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-42:0:0:1", NAME="%c" +BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" # A usb camera. BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" @@ -60,7 +60,7 @@ KERNEL="ttyUSB0", NAME="pl2303" # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c %3c" +BUS="ide", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%1c", SYMLINK="%2c %3c" # fb devices KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From a2505f4d1da4793991a4d2b2dc8f93b9b89d9672 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 13 Jan 2004 00:51:44 -0800 Subject: [PATCH] udev - simple debug tweak change the empty debug string: Jan 13 00:55:42 pim udev[2849]: namedev_name_device: found matching rule, 'video*' becomes '' to something useful: Jan 13 01:00:23 pim udev[3234]: namedev_name_device: found matching rule, 'video*' becomes 'video/webcam%n' --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 4247b26693..fdc6252bf6 100644 --- a/namedev.c +++ b/namedev.c @@ -716,7 +716,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } /* Yup, this rule belongs to us! */ - dbg("found matching rule, '%s' becomes '%s'", dev->kernel, udev->name); + dbg("found matching rule, '%s' becomes '%s'", dev->kernel, dev->name); strfieldcpy(udev->name, dev->name); strfieldcpy(udev->symlink, dev->symlink); goto found; -- cgit v1.2.3-54-g00ecf From ee1db00d07ed1db55061ba5e2cb54800cc3e2495 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 13 Jan 2004 01:01:19 -0800 Subject: [PATCH] more advanced user query options Here is the '-h' and a '-d' to dump the whole database: kay@pim:~/src/udev.kay$ ./udev -d P: /block/hdb/hdb1 N: hdb1 S: O: G: P: /class/video4linux/video0 N: video/webcam0 S: camera0 kamera0 O: 500 G: 500 P: /block/hdc N: hdc S: O: G: --- udev.c | 39 ++++++++++++++++++++++++++++++++------- udevdb.c | 25 ++++++++++++++++++++++++- udevdb.h | 1 + 3 files changed, 57 insertions(+), 8 deletions(-) diff --git a/udev.c b/udev.c index 7078f089e2..84950c82a3 100644 --- a/udev.c +++ b/udev.c @@ -82,6 +82,16 @@ static inline char *get_seqnum(void) return seqnum; } +static void print_record(char *path, struct udevice *dev) +{ + printf("P: %s\n", path); + printf("N: %s\n", dev->name); + printf("S: %s\n", dev->symlink); + printf("O: %s\n", dev->owner); + printf("G: %s\n", dev->group); + printf("\n"); +} + enum query_type { NONE, NAME, @@ -92,7 +102,7 @@ enum query_type { static inline int udev_user(int argc, char **argv) { - static const char short_options[] = "p:q:rVh"; + static const char short_options[] = "dp:q:rVh"; int option; int retval = -EINVAL; struct udevice dev; @@ -144,6 +154,16 @@ static inline int udev_user(int argc, char **argv) root = 1; break; + case 'd': + retval = udevdb_open_ro(); + if (retval != 0) { + printf("unable to open udev database\n"); + return -EACCES; + } + retval = udevdb_dump(print_record); + udevdb_exit(); + return retval; + case 'V': printf("udev, version %s\n", UDEV_VERSION); return 0; @@ -206,12 +226,17 @@ static inline int udev_user(int argc, char **argv) } help: - printf("Usage: [-qrVh]\n" - " -q query database for the specified value\n" - " -p device path used for query\n" - " -r print udev root\n" - " -V print udev version\n" - " -h print this help text\n" + printf("Usage: [-pqrdVh]\n" + " -q TYPE query database for the specified value:\n" + " 'name' name of device node\n" + " 'symlink' pointing to node\n" + " 'owner' of node\n" + " 'group' of node\n" + " -p PATH sysfs device path used for query\n" + " -r print udev root\n" + " -d dump whole database\n" + " -V print udev version\n" + " -h print this help text\n" "\n"); return retval; } diff --git a/udevdb.c b/udevdb.c index ca9e63c97e..8d077ea94f 100644 --- a/udevdb.c +++ b/udevdb.c @@ -124,7 +124,7 @@ int udevdb_init(int init_flag) dbg("unable to initialize in-memory database"); else dbg("unable to initialize database at '%s'", udev_db_filename); - return -EINVAL; + return -EACCES; } return 0; } @@ -137,7 +137,30 @@ int udevdb_open_ro(void) udevdb = tdb_open(udev_db_filename, 0, 0, O_RDONLY, 0); if (udevdb == NULL) { dbg("unable to open database at '%s'", udev_db_filename); + return -EACCES; + } + return 0; +} + +void (*user_record_callback) (char *path, struct udevice *dev); + +static int traverse_callback(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) +{ + user_record_callback((char*) key.dptr, (struct udevice*) dbuf.dptr); + return 0; +} + +/** + * udevdb_dump: dumps whole database by passing record data to user function + * @user_record_handler: user function called for every record in the database + */ +int udevdb_dump(void (*user_record_handler) (char *path, struct udevice *dev)) +{ + if (user_record_handler == NULL) { + dbg("invalid user record handling function"); return -EINVAL; } + user_record_callback = user_record_handler; + tdb_traverse(udevdb, traverse_callback, NULL); return 0; } diff --git a/udevdb.h b/udevdb.h index f36a9ca799..a0e5338265 100644 --- a/udevdb.h +++ b/udevdb.h @@ -12,6 +12,7 @@ extern void udevdb_exit(void); extern int udevdb_init(int init_flag); extern int udevdb_open_ro(void); +extern int udevdb_dump(void (*user_record_handler) (char *path, struct udevice *dev)); extern int udevdb_add_dev(const char *path, const struct udevice *dev); extern int udevdb_get_dev(const char *path, struct udevice *dev); -- cgit v1.2.3-54-g00ecf From 79c3cb65f8a2c17502258aaed36704780470f257 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 13 Jan 2004 01:02:56 -0800 Subject: [PATCH] Fix stupid gcc "optimization" of 1 character printk() calls.... Ick... --- udev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/udev.c b/udev.c index 84950c82a3..a51c04399e 100644 --- a/udev.c +++ b/udev.c @@ -88,8 +88,7 @@ static void print_record(char *path, struct udevice *dev) printf("N: %s\n", dev->name); printf("S: %s\n", dev->symlink); printf("O: %s\n", dev->owner); - printf("G: %s\n", dev->group); - printf("\n"); + printf("G: %s\n\n", dev->group); } enum query_type { -- cgit v1.2.3-54-g00ecf From 4bd46ac7e5ea893989c3bb83b07c26e852380cac Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 13 Jan 2004 01:35:55 -0800 Subject: [PATCH] update documentation for new config file format Here is the man page update after my udev-weekend :) --- udev.8 | 115 ++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 57 insertions(+), 58 deletions(-) diff --git a/udev.8 b/udev.8 index 3eb4aecad2..fdf5eae73d 100644 --- a/udev.8 +++ b/udev.8 @@ -5,7 +5,7 @@ udev \- Linux configurable dynamic device naming support .BI udev " hotplug-subsystem" .br .B udev -.RI "[-q " sysfs_path "] [-rVh]" +.RI "[-q " query_type " -p " sysfs_path "] [-drVh]" .SH "DESCRIPTION" .B udev creates or removes device node files usually located in the /dev directory. @@ -21,14 +21,14 @@ On device creation, .B udev reads the sysfs directory of the given device to collect device attributes like label, serial number or bus device number. -These attributes are treated as a key -to determine a unique name for device file creation. +These attributes may used as keys to determine a +unique name for device file creation. .B udev maintains a database for devices present on the system. .br On device removal, .B udev -queries the internal database for the name of the device file to be deleted. +queries its database for the name of the device file to be deleted. .SH "OPTIONS" .B udev normally is called by @@ -42,11 +42,21 @@ Print the version information. .TP .B -r Print the the -.B udev -root directory. +.B udev_root +directory. When used in conjunction with a query for the node name, the +.B udev_root +will be prepended. +.TP +.BI -q " query_type" +Query the database for specified value of a created device node. +Valid types are: +.BR name ", " symlink ", " owner " or " group . .TP -.BI -q " sysfs_path" -Query with the sysfs path as argument for the name of the created device node. +.BI -p " sysfs_path" +Specify the sysfs path needed for the query. +.TP +.B -q +Dump the whole database. .TP .B -h Print help text. @@ -115,61 +125,50 @@ value in the .I /etc/udev/udev.conf file. .P -Every line in the rules file define the mapping between device attributes and -the device file name. It starts with a keyword defining the method used to -match, followed by one ore more keys to compare and the filename for the -device. One ore more optional symlinks targeting the node may be specified. +Every line in the rules file defines the mapping between device attributes +and the device file name. One ore more keys are specified to match a rule +with the current device. If all keys are matching, the rule will be applied +and the name is used for the device node. One or more optional symlinks +targeting the node may be specified. .br -If no matching configuration is found, the default kernel device name -is used. +If no matching rule is found, the default kernel device name is used. .P The line format is: .sp -.I method, key,[key,...] name [, symlink] +.I key,[key,...] name [, symlink] .sp -where valid methods with corresponding keys are: +where keys are: .TP -.B CALLOUT -calling external program, that returns a string to match. The .B BUS -key is optional, but if specified, the sysfs device bus must be able to be -determined by a "device" symlink. -.br -.RB "keys: " BUS ", " PROGRAM ", " ID +Match the bus type of the device. +(The sysfs device bus must be able to be determined by a "device" symlink.) .TP -.B LABEL -device label or serial number, like USB serial number, SCSI UUID or -file system label. Up to 5 different sysfs files can be checked, with -all of the values being required in order to match the rule. The -.B BUS -key is optional, but if specified, the sysfs device bus must be able to be -detemined by a "device" symlink. -.br -.RB "keys: " BUS ", " SYSFS_ +.B KERNEL +Match the kernel device name. .TP -.B NUMBER -device number on the bus, like PCI bus id -.br -.RB "keys: " BUS ", " ID +.B ID +Match the device number on the bus, like PCI bus id. .TP -.B TOPOLOGY -device position on bus, like physical port of USB device -.br -.RB "keys: " BUS ", " PLACE +.B PLACE +Match the topological position on bus, like physical port of USB device .TP -.B REPLACE -string replacement of the kernel device name -.br -.RB "key: " KERNEL +.BI SYSFS_ filename +Match sysfs device attribute like label, vendor, USB serial number, SCSI UUID +or file system label. Up to 5 different sysfs files can be checked, with +all of the values being required in order to match the rule. .TP -.B IGNORE -tell udev to not care about creation of this device, e.g. because the -device is already handled by another program -.br -.RB "key: " KERNEL -.P -The methods are applied in the following order: -.BR IGNORE ", " CALLOUT ", " LABEL ", " NUMBER ", " TOPOLOGY ", " REPLACE "." +.B PROGRAM +Call external program. This key is valid if the program returns successful. +The string returned by the program may additionally matched with the +.B RESULT +key. +.TP +.B RESULT +Match the returned string of the last +.B PROGRAM +call. This key may used in any following rule after a +.B PROGRAM +call. .P .RB "The " NAME " ," SYMLINK " and " PROGRAM fields support simple printf-like string substitution: @@ -203,25 +202,25 @@ If this is not a partition, it will result in 'disc'. .sp .nf # if /sbin/scsi_id returns "OEM 0815" device will be called disk1 -CALLOUT, BUS="scsi", PROGRAM="/sbin/scsi_id", ID="OEM 0815", NAME="disk1" +BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="OEM 0815", NAME="disk1" # USB printer to be called lp_color -LABEL, BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_color" +BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_color" # SCSI disk with a specific vendor and model number is to be called boot -LABEL, BUS="scsi", SYSFS_vendor="IBM", SYSFS_model="ST336", NAME="boot%n" +BUS="scsi", SYSFS_vendor="IBM", SYSFS_model="ST336", NAME="boot%n" # sound card with PCI bus id 00:0b.0 to be called dsp -NUMBER, BUS="pci", ID="00:0b.0", NAME="dsp" +BUS="pci", ID="00:0b.0", NAME="dsp" # USB mouse at third port of the second hub to be called mouse1 -TOPOLOGY, BUS="usb", PLACE="2.3", NAME="mouse1" +BUS="usb", PLACE="2.3", NAME="mouse1" # ttyUSB1 should always be called pda with two additional symlinks -REPLACE, KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" +KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" # multiple USB webcams with symlinks to be called webcam0, webcam1, ... -LABEL, BUS="usb", SYSFS_model="XV3", NAME="video%n", SYMLINK="webcam%n" +BUS="usb", SYSFS_model="XV3", NAME="video%n", SYMLINK="webcam%n" .fi .P Permissions and ownership for the created device files may specified at -- cgit v1.2.3-54-g00ecf From 2ebcaa235fe2b82a844ae19daecb0c996375fc1b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 13 Jan 2004 01:36:56 -0800 Subject: [PATCH] fix -d typo in the manpage update --- udev.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.8 b/udev.8 index fdf5eae73d..6ee68d795e 100644 --- a/udev.8 +++ b/udev.8 @@ -55,7 +55,7 @@ Valid types are: .BI -p " sysfs_path" Specify the sysfs path needed for the query. .TP -.B -q +.B -d Dump the whole database. .TP .B -h -- cgit v1.2.3-54-g00ecf From 9ab314222d66d53a46ecefdeb37bec15b7dff66a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 13 Jan 2004 01:49:45 -0800 Subject: [PATCH] update the README in a few places. --- README | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/README b/README index dab0ab4197..123fce6a1b 100644 --- a/README +++ b/README @@ -8,6 +8,8 @@ To use: - You must be running a 2.6 version of the Linux kernel. +- Your 2.6 kernel must have had CONFIG_HOTPLUG enabled when it was built. + - Make sure sysfs is mounted. udev will figure out where sysfs is mounted, but the traditional place for it is at /sys. You can mount it by hand by running: mount -t sysfs none /sys @@ -45,6 +47,9 @@ To use: would do: make USE_KLIBC=true DEBUG=true + Note: If you want to use klibc, you will have to set up the "linux" + symlink properly. See the file klibc/klibc/README and pay + attention to step "a)" there. - Install the project: make install @@ -62,18 +67,18 @@ To use: make uninstall -Things are still quite rough, and it's a bit beyond proof of concept -code. Help is very much appreciated, see the TODO file for a list of -things left to be done. +Things are still quite rough, but it should work properly. If nothing +seems to happen, make sure your build worked properly by running the +udev-test.pl script as root in the test/ subdirectory of the udev source +tree. + +Development and documentation help is very much appreciated, see the TODO +file for a list of things left to be done. -If you want to build using klibc, use the Makefile.klibc file: - - read the klibc/klibc/README file for how to set up the linux - symlink properly. - - make clean - - make -f Makefile.klibc -and marvel at the tiny binary you just created :) -Any comment/questions/concerns please let me know. +Any comment/questions/concerns please let me and the other udev developers +know by sending a message to the linux-hotplug-devel mailing list at: + linux-hotplug-devel@lists.sourceforge.net greg k-h greg@kroah.com -- cgit v1.2.3-54-g00ecf From 7e5f7397f9dbbf2be421d639494576a5c8167241 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 13 Jan 2004 18:31:18 -0800 Subject: [PATCH] udev - CALLOUT is PROGRAM now replace CALLOUT by PROGRAM and fix old rule format --- etc/udev/udev.rules | 2 +- etc/udev/udev.rules.devfs | 2 +- etc/udev/udev.rules.gentoo | 2 +- extras/ide-devfs.sh | 4 ++-- extras/name_cdrom.pl | 4 ++-- namedev.c | 4 ++-- namedev.h | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 6cb4896743..a2279976fe 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -6,7 +6,7 @@ # %M - the kernel major number for the device # %m - the kernel minor number for the device # %b - the bus id for the device -# %c - the return value for the CALLOUT program (note, this doesn't work within +# %c - the return value of the external PROGRAM (note, this doesn't work within # the PROGRAM field for the obvious reason.) # %D - use the devfs style disk name for this device. # For partitions, this will result in 'part%n' diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index 3c45db79cf..bc3f26c1cc 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -9,7 +9,7 @@ # %M - the kernel major number for the device # %m - the kernel minor number for the device # %b - the bus id for the device -# %c - the return value for the CALLOUT program (note, this doesn't work within +# %c - the return value of the external PROGRAM (note, this doesn't work within # the PROGRAM field for the obvious reason.) # %D - use the devfs style disk name for this device. # For partitions, this will result in 'part%n' diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 4a3292853f..a449a4dac9 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -9,7 +9,7 @@ # %M - the kernel major number for the device # %m - the kernel minor number for the device # %b - the bus id for the device -# %c - the return value for the CALLOUT program (note, this doesn't work within +# %c - the return value of the external PROGRAM (note, this doesn't work within # the PROGRAM field for the obvious reason.) # %D - use the devfs style disk name for this device. # For partitions, this will result in 'part%n' diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 57fb00b676..ab194b01e6 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -1,8 +1,8 @@ #!/bin/sh -# udev CALLOUT script +# udev external PROGRAM script # return devfs-names for ide-devices -# CALLOUT, BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", ID="hd*", NAME="%1c", SYMLINK="%2c %3c" +# BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%1c", SYMLINK="%2c %3c" HOST="${2%\.[0-9]}" TARGET="${2#[0-9]\.}" diff --git a/extras/name_cdrom.pl b/extras/name_cdrom.pl index 7a14e866a6..e522c9fda8 100644 --- a/extras/name_cdrom.pl +++ b/extras/name_cdrom.pl @@ -2,8 +2,8 @@ # a horribly funny script that shows how flexible udev can really be # This is to be executed by udev with the following rules: -# CALLOUT, BUS="ide", PROGRAM="name_cdrom.pl %M %m", ID="good*", NAME="%2c", SYMLINK="cdrom" -# CALLOUT, BUS="scsi", PROGRAM="name_cdrom.pl %M %m", ID="good*", NAME="%2c", SYMLINK="cdrom" +# BUS="ide", PROGRAM="name_cdrom.pl %M %m", PROGRAM="good*", NAME="%2c", SYMLINK="cdrom" +# BUS="scsi", PROGRAM="name_cdrom.pl %M %m", PROGRAM="good*", NAME="%2c", SYMLINK="cdrom" # # The scsi rule catches USB cdroms and ide-scsi devices. # diff --git a/namedev.c b/namedev.c index fdc6252bf6..6f7bfb6805 100644 --- a/namedev.c +++ b/namedev.c @@ -309,7 +309,7 @@ static int execute_program(char *path, char *value, int len) int value_set = 0; char buffer[256]; char *pos; - char *args[CALLOUT_MAXARG]; + char *args[PROGRAM_MAXARG]; int i; dbg("executing '%s'", path); @@ -331,7 +331,7 @@ static int execute_program(char *path, char *value, int len) if (strchr(path, ' ')) { /* exec with arguments */ pos = path; - for (i=0; i < CALLOUT_MAXARG-1; i++) { + for (i=0; i < PROGRAM_MAXARG-1; i++) { args[i] = strsep(&pos, " "); if (args[i] == NULL) break; diff --git a/namedev.h b/namedev.h index 4e75db6410..f5b63a8805 100644 --- a/namedev.h +++ b/namedev.h @@ -45,7 +45,7 @@ struct sysfs_class_device; #define FIELD_NAME "NAME" #define FIELD_SYMLINK "SYMLINK" -#define CALLOUT_MAXARG 10 +#define PROGRAM_MAXARG 10 #define MAX_SYSFS_PAIRS 5 struct sysfs_pair { -- cgit v1.2.3-54-g00ecf From e68faf511dd9be15a27042d1828460d3655707d8 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 13 Jan 2004 18:31:20 -0800 Subject: [PATCH] udev - more CALLOUT is PROGRAM now On Tue, Jan 13, 2004 at 02:45:17AM +0100, Kay Sievers wrote: > replace CALLOUT by PROGRAM and fix old rule format One is missing. --- udev.8 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/udev.8 b/udev.8 index 6ee68d795e..c78fd4a32b 100644 --- a/udev.8 +++ b/udev.8 @@ -190,8 +190,12 @@ The kernel minor number for the device. The bus id for the device. .TP .B %c -The CALLOUT program returned string. -(This does not work within the PROGRAM field for the obvious reason.) +The +.B PROGRAM +returned string. +(This does not work within the +.B PROGRAM +field for the obvious reason.) .TP .B %D Use the devfs style disk name for this device. -- cgit v1.2.3-54-g00ecf From 8ffb636f013a193688b132b8512e77b0747c41a1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 13 Jan 2004 18:34:33 -0800 Subject: [PATCH] udev - introduce format escape char This patch adds a '%' to the format char list, so that a external program may called with a non expanded '%' like: PROGRAM="/bin/date +%%s" Olaf Hering asked for the feature. A tricky test is also added :) --- namedev.c | 19 ++++++++++++------- test/udev-test.pl | 9 +++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/namedev.c b/namedev.c index 6f7bfb6805..0e1af9385f 100644 --- a/namedev.c +++ b/namedev.c @@ -151,20 +151,21 @@ static mode_t get_default_mode(struct sysfs_class_device *class_dev) static void apply_format(struct udevice *udev, unsigned char *string) { - char name[NAME_SIZE]; char temp[NAME_SIZE]; + char temp1[NAME_SIZE]; char *tail; char *pos; char *pos2; char *pos3; int num; + pos = string; while (1) { num = 0; - pos = strchr(string, '%'); + pos = strchr(pos, '%'); if (pos) { - *pos = '\0'; + pos[0] = '\0'; tail = pos+1; if (isdigit(tail[0])) { num = (int) strtoul(&pos[1], &tail, 10); @@ -173,7 +174,7 @@ static void apply_format(struct udevice *udev, unsigned char *string) break; } } - strfieldcpy(name, tail+1); + strfieldcpy(temp, tail+1); switch (tail[0]) { case 'b': @@ -217,8 +218,8 @@ static void apply_format(struct udevice *udev, unsigned char *string) break; if (num) { /* get part of return string */ - strncpy(temp, udev->program_result, sizeof(temp)); - pos2 = temp; + strncpy(temp1, udev->program_result, sizeof(temp1)); + pos2 = temp1; while (num) { num--; pos3 = strsep(&pos2, " "); @@ -236,11 +237,15 @@ static void apply_format(struct udevice *udev, unsigned char *string) dbg("substitute result string '%s'", udev->program_result); } break; + case '%': + strcat(pos, "%"); + pos++; + break; default: dbg("unknown substitution type '%%%c'", pos[1]); break; } - strcat(string, name); + strcat(string, temp); } else break; } diff --git a/test/udev-test.pl b/test/udev-test.pl index ab27c74c6a..5e5756b660 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -203,6 +203,15 @@ EOF expected => "test-0:0:0:0" , conf => < "program with escaped format char (tricky: callout returns format char!)", + subsys => "block", + devpath => "block/sda/sda3", + expected => "escape-3" , + conf => < Date: Tue, 13 Jan 2004 18:34:38 -0800 Subject: [PATCH] udev - small script optimization Optimize the scripts reflecting the now more powerful rule logic, cause we can combine all known fields now in any order: The ide-devfs.sh is only executed if the kernel name matches with 'hd*': BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%1c %2c" The name_cdrom.pl is only executed for ide and scsi devices, but not for a partition. It exits with nonzero to skip the rule if the CD is not found: KERNEL="[hs]d[a-z]", PROGRAM="name_cdrom.pl %M %m", NAME="%1c", SYMLINK="cdrom" --- extras/ide-devfs.sh | 8 ++++---- extras/name_cdrom.pl | 28 +++++++++++++--------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index ab194b01e6..8648f6c0c0 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -2,7 +2,7 @@ # udev external PROGRAM script # return devfs-names for ide-devices -# BUS="ide", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%1c", SYMLINK="%2c %3c" +# BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%1c %2c" HOST="${2%\.[0-9]}" TARGET="${2#[0-9]\.}" @@ -38,10 +38,10 @@ get_dev_number() { if [ -z "$3" ]; then MEDIA=`cat /proc/ide/${1}/media` if [ "${MEDIA}" = "cdrom" ]; then - echo $1 ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` elif [ "${MEDIA}" = "disk" ]; then - echo $1 ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc fi else - echo $1 ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/part$3 discs/disc`get_dev_number $1 disk`/part$3 + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/part$3 discs/disc`get_dev_number $1 disk`/part$3 fi diff --git a/extras/name_cdrom.pl b/extras/name_cdrom.pl index e522c9fda8..3a4772e6d9 100644 --- a/extras/name_cdrom.pl +++ b/extras/name_cdrom.pl @@ -2,19 +2,17 @@ # a horribly funny script that shows how flexible udev can really be # This is to be executed by udev with the following rules: -# BUS="ide", PROGRAM="name_cdrom.pl %M %m", PROGRAM="good*", NAME="%2c", SYMLINK="cdrom" -# BUS="scsi", PROGRAM="name_cdrom.pl %M %m", PROGRAM="good*", NAME="%2c", SYMLINK="cdrom" -# -# The scsi rule catches USB cdroms and ide-scsi devices. -# +# KERNEL="[hs]d[a-z]", PROGRAM="name_cdrom.pl %M %m", NAME="%1c", SYMLINK="cdrom" -use CDDB_get qw( get_cddb ); +use strict; +use warnings; -my %config; +use CDDB_get qw( get_cddb ); -$dev_node = "/tmp/cd_foo"; +my $dev_node = "/tmp/cd_foo"; # following variables just need to be declared if different from defaults +my %config; $config{CDDB_HOST}="freedb.freedb.org"; # set cddb host $config{CDDB_PORT}=8880; # set cddb port $config{CDDB_MODE}="cddb"; # set cddb mode: cddb or http @@ -23,8 +21,8 @@ $config{CD_DEVICE}="$dev_node"; # set cd device # No user interaction, this is a automated script! $config{input}=0; -$major = $ARGV[0]; -$minor = $ARGV[1]; +my $major = $ARGV[0]; +my $minor = $ARGV[1]; # create our temp device node to read the cd info from unlink($dev_node); @@ -38,11 +36,11 @@ my %cd=get_cddb(\%config); # remove the dev node we just created unlink($dev_node); -# print out our cd name if we have found it -unless(defined $cd{title}) { - print"bad unknown cdrom\n"; -} else { +# print out our cd name if we have found it or skip rule by nonzero exit +if (defined $cd{title}) { $cd{artist} =~ s/ /_/g; $cd{title} =~ s/ /_/g; - print "good $cd{artist}-$cd{title}\n"; + print "$cd{artist}-$cd{title}\n"; +} else { + exit -1; } -- cgit v1.2.3-54-g00ecf From c03e2c6f5f385c6782416cfade63661374a22c5f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 13 Jan 2004 18:47:17 -0800 Subject: [PATCH] Cset exclude: greg@kroah.com|ChangeSet|20040113010256|48515 --- udev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev.c b/udev.c index a51c04399e..84950c82a3 100644 --- a/udev.c +++ b/udev.c @@ -88,7 +88,8 @@ static void print_record(char *path, struct udevice *dev) printf("N: %s\n", dev->name); printf("S: %s\n", dev->symlink); printf("O: %s\n", dev->owner); - printf("G: %s\n\n", dev->group); + printf("G: %s\n", dev->group); + printf("\n"); } enum query_type { -- cgit v1.2.3-54-g00ecf From 68e07a2b0798bd22554c82496455100f29cf6140 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 13 Jan 2004 18:48:33 -0800 Subject: [PATCH] fix klibc with printf() and gcc On Mon, Jan 12, 2004 at 05:04:45PM -0800, Greg KH wrote: > Very nice, applied. But I did have to make one small change to get the > code to build properly with klibc: > > > +static void print_record(char *path, struct udevice *dev) > > +{ > > + printf("P: %s\n", path); > > + printf("N: %s\n", dev->name); > > + printf("S: %s\n", dev->symlink); > > + printf("O: %s\n", dev->owner); > > + printf("G: %s\n", dev->group); > > + printf("\n"); > > +} > > Turns out that gcc likes to convert single character printf() calls to > putchar() which is only defined in klibc as a macro :( Just for information. This seems to fix the gcc with klibc :) --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5e64129266..a921a22bb9 100644 --- a/Makefile +++ b/Makefile @@ -133,7 +133,7 @@ ifeq ($(strip $(USE_KLIBC)),true) LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(KLIBC_DIR)/arch/$(ARCH)/include \ -I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -I$(LINUX_INCLUDE_DIR) \ - -D__KLIBC__ + -D__KLIBC__ -fno-builtin-printf LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs else -- cgit v1.2.3-54-g00ecf From 542bd1c0150453c94f3cc179e3aa891581a5004a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 13 Jan 2004 22:55:21 -0800 Subject: [PATCH] update TODO with some new, small items. --- TODO | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TODO b/TODO index d0d0bec4d9..702d0d6b27 100644 --- a/TODO +++ b/TODO @@ -9,6 +9,11 @@ greg@kroah.com - more documentation (can never have too much.) - better partition support (it's a hack right now, maybe new libsysfs changes can help out a lot here.) +- option to always add all partitions. This is needed to properly handle + devices with removable media. +- install the proper init.d script based on the distro we are running on. +- persuade the distro packagers to submit their changes (or just steal them + if we can find them...) - allow database to be queried by other programs - split program into two pieces (daemon and helper that sends events to it). This will allow us to keep track of sequences, and lots of other needed -- cgit v1.2.3-54-g00ecf From c58ffe501caa2757437aa13ab1d84db1033eb065 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 13 Jan 2004 22:59:11 -0800 Subject: [PATCH] v013 release --- ChangeLog | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f626070268..4affadaf53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,57 @@ +Summary of changes from v012 to v013 +============================================ + +: + o LSB init script and other stuff + +: + o fix udev directory for Debian init script + +: + o udev 012 old gcc fixup + +Christophe Saout: + o add IGNORE rule type + o small cleanup + +Greg Kroah-Hartman: + o update TODO with some new, small items + o Cset exclude: greg@kroah.com|ChangeSet|20040113010256|48515 + o update the README in a few places + o fix -d typo in the manpage update + o Fix stupid gcc "optimization" of 1 character printk() calls.... Ick + o oops, forgot to fix up the PROGRAM result from ID to RESULT in the config files + o Add alsa device rules and a few other devfs rules + o fix a few stale comments in namedev.c + o convert the default rules files to the new format + o convert the test shell scripts to the config file format + o add bus test for usb-serial bus + o Add some helpful messages if the user uses the older config file format + o added dri rule to the default config file + o added init.d udev script for debian + o add a script that tests the IGNORE rule + o add silly script that names cdrom drives based on the cd in them + o add cdrom rule for ide cdrom + o replace list_for_each with list_for_each_entry, saving a few lines of code + o add a blacklist of class devices we do not want to look at + +Kay Sievers: + o fix klibc with printf() and gcc + o udev - small script optimization + o udev - introduce format escape char + o udev - more CALLOUT is PROGRAM now + o udev - CALLOUT is PROGRAM now + o update documentation for new config file format + o more advanced user query options + o udev - simple debug tweak + o udev - drop all methods :) + o udev - advanced user query options + o udev - Makefile error + o udev - make exec_callout() reusable + o udev - exec status fix for klibc + o fix Silly udev script + + Summary of changes from v011 to v012 ============================================ diff --git a/Makefile b/Makefile index a921a22bb9..eba9766938 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 012_bk +VERSION = 013 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 4056025df8..f76ccaa134 100644 --- a/udev.spec +++ b/udev.spec @@ -23,7 +23,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 012_bk +Version: 013 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 78812b99d371f362bb0e0eb1c111a8a7adffe48f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 14 Jan 2004 18:16:32 -0800 Subject: [PATCH] 013_bk mark --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index eba9766938..80c4908ccb 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ USE_DBUS = false ROOT = udev -VERSION = 013 +VERSION = 013_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index f76ccaa134..07331807ef 100644 --- a/udev.spec +++ b/udev.spec @@ -23,7 +23,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 013 +Version: 013_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From b6864b4bf1945d6b950a77e96fd68e9952bbeb02 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 14 Jan 2004 18:18:12 -0800 Subject: [PATCH] udev - mention format string escape char in man page If we want to pass any '%' down to a program, you need to ecape it by '%%', otherwise we try to expand it with our own format char list. --- udev.8 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udev.8 b/udev.8 index c78fd4a32b..1ca42982ea 100644 --- a/udev.8 +++ b/udev.8 @@ -201,6 +201,9 @@ field for the obvious reason.) Use the devfs style disk name for this device. For partitions, this will result in 'part%n' If this is not a partition, it will result in 'disc'. +.TP +.B %% +The '%' char itself. .P .RI "A sample " udev.rules " might look like this:" .sp -- cgit v1.2.3-54-g00ecf From 1782087e4f80fd1d8c4d8bd9a6edeed27414426e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 14 Jan 2004 21:38:36 -0800 Subject: [PATCH] added input device rules to udev.rules and udev.rules.devfs --- etc/udev/udev.rules | 8 ++++++++ etc/udev/udev.rules.devfs | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index a2279976fe..1f3ef07242 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -63,3 +63,11 @@ KERNEL="midi[CD0-9]*", NAME="snd/%k" KERNEL="timer", NAME="snd/%k" KERNEL="seq", NAME="snd/%k" +# input devices +KERNEL="mice", NAME="input/%k" +KERNEL="keyboard", NAME="input/%k" +KERNEL="mouse*", NAME="input/%k" +KERNEL="event*", NAME="input/%k" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index bc3f26c1cc..026e9465b1 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -69,3 +69,11 @@ KERNEL="midi[CD0-9]*", NAME="snd/%k" KERNEL="timer", NAME="snd/%k" KERNEL="seq", NAME="snd/%k" +# input devices +KERNEL="mice", NAME="input/%k" +KERNEL="keyboard", NAME="input/%k" +KERNEL="mouse*", NAME="input/%k" +KERNEL="event*", NAME="input/%k" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + -- cgit v1.2.3-54-g00ecf From 616a7078071362b32a4db73fe3314feb46438258 Mon Sep 17 00:00:00 2001 From: "ananthmg@rediffmail.com" Date: Wed, 14 Jan 2004 22:21:38 -0800 Subject: [PATCH] libsysfs update for refresh + namedev.c changes Please find inlined a patch which contains updates to libsysfs (pre-release) for refresh and also changes to namedev.c to take advantage of it. --- libsysfs/libsysfs.h | 36 +++++--- libsysfs/sysfs_bus.c | 49 +++++++---- libsysfs/sysfs_class.c | 201 ++++++++++++++++++++++++++---------------- libsysfs/sysfs_device.c | 72 +++++++++------ libsysfs/sysfs_dir.c | 227 ++++++++++++++++++++++++++++++++++++------------ libsysfs/sysfs_driver.c | 86 ++++++++++++++---- libsysfs/sysfs_utils.c | 144 ++++++++++++++++++++---------- namedev.c | 105 ++++++++++------------ 8 files changed, 611 insertions(+), 309 deletions(-) diff --git a/libsysfs/libsysfs.h b/libsysfs/libsysfs.h index 2ffe1005cc..10faab92aa 100644 --- a/libsysfs/libsysfs.h +++ b/libsysfs/libsysfs.h @@ -62,18 +62,20 @@ struct sysfs_link { }; struct sysfs_directory { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ struct dlist *subdirs; struct dlist *links; struct dlist *attributes; - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; }; struct sysfs_driver { unsigned char name[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; - /* for internal use only */ + /* Private: for internal use only */ struct dlist *devices; struct sysfs_directory *directory; }; @@ -85,7 +87,7 @@ struct sysfs_device { unsigned char driver_name[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; - /* for internal use only */ + /* Private: for internal use only */ struct sysfs_device *parent; struct dlist *children; struct sysfs_directory *directory; @@ -95,7 +97,7 @@ struct sysfs_root_device { unsigned char name[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; - /* for internal use only */ + /* Private: for internal use only */ struct dlist *devices; struct sysfs_directory *directory; }; @@ -104,7 +106,7 @@ struct sysfs_bus { unsigned char name[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; - /* internal use only */ + /* Private: for internal use only */ struct dlist *drivers; struct dlist *devices; struct sysfs_directory *directory; @@ -115,7 +117,7 @@ struct sysfs_class_device { unsigned char classname[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; - /* for internal use only */ + /* Private: for internal use only */ struct sysfs_class_device *parent; struct sysfs_device *sysdevice; /* NULL if virtual */ struct sysfs_driver *driver; /* NULL if not implemented */ @@ -126,7 +128,7 @@ struct sysfs_class { unsigned char name[SYSFS_NAME_LEN]; unsigned char path[SYSFS_PATH_MAX]; - /* for internal use only */ + /* Private: for internal use only */ struct dlist *devices; struct sysfs_directory *directory; }; @@ -138,8 +140,8 @@ extern "C" { /* * Function Prototypes */ -extern int sysfs_trailing_slash(unsigned char *path); extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); +extern int sysfs_remove_trailing_slash(unsigned char *path); extern int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, size_t len); extern int sysfs_path_is_dir(const unsigned char *path); @@ -161,7 +163,9 @@ extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, const unsigned char *new_value, size_t len); extern unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, const unsigned char * name); -extern int sysfs_refresh_attributes(struct dlist *attrlist); +extern int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir); +extern int sysfs_refresh_dir_links(struct sysfs_directory *sysdir); +extern int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir); extern void sysfs_close_directory(struct sysfs_directory *sysdir); extern struct sysfs_directory *sysfs_open_directory(const unsigned char *path); extern int sysfs_read_dir_attributes(struct sysfs_directory *sysdir); @@ -179,6 +183,9 @@ extern struct sysfs_link *sysfs_get_subdirectory_link (struct sysfs_directory *dir, unsigned char *linkname); extern struct sysfs_attribute *sysfs_get_directory_attribute (struct sysfs_directory *dir, unsigned char *attrname); +extern struct dlist *sysfs_get_dir_attributes(struct sysfs_directory *dir); +extern struct dlist *sysfs_get_dir_links(struct sysfs_directory *dir); +extern struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir); /* sysfs driver access */ extern void sysfs_close_driver(struct sysfs_driver *driver); @@ -189,9 +196,12 @@ extern struct sysfs_attribute *sysfs_get_driver_attr (struct sysfs_driver *drv, const unsigned char *name); extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); extern struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver); +extern struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver); extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); extern struct sysfs_device *sysfs_get_driver_device (struct sysfs_driver *driver, const unsigned char *name); +extern struct dlist *sysfs_refresh_driver_attributes + (struct sysfs_driver *driver); extern struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, const unsigned char *drv, const unsigned char *attrib); @@ -205,9 +215,12 @@ extern struct sysfs_device *sysfs_open_device (const unsigned char *bus_id, const unsigned char *bus); extern struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev); extern struct sysfs_device *sysfs_open_device_path(const unsigned char *path); +extern int sysfs_get_device_bus(struct sysfs_device *dev); extern struct sysfs_attribute *sysfs_get_device_attr (struct sysfs_device *dev, const unsigned char *name); extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); +extern struct dlist *sysfs_refresh_device_attributes + (struct sysfs_device *device); extern struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, const unsigned char *bus_id, const unsigned char *attrib); @@ -221,6 +234,7 @@ extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); extern struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus); +extern struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus); extern struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, unsigned char *attrname); extern struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, @@ -247,6 +261,8 @@ extern struct sysfs_class_device *sysfs_get_class_device (struct sysfs_class *class, unsigned char *name); extern struct dlist *sysfs_get_classdev_attributes (struct sysfs_class_device *cdev); +extern struct dlist *sysfs_refresh_classdev_attributes + (struct sysfs_class_device *cdev); extern struct sysfs_attribute *sysfs_get_classdev_attr (struct sysfs_class_device *clsdev, const unsigned char *name); extern struct sysfs_attribute *sysfs_open_classdev_attr diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index d9da0f84cf..aca392875e 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -209,9 +209,7 @@ struct sysfs_bus *sysfs_open_bus(const unsigned char *name) return NULL; } - if (sysfs_trailing_slash(buspath) == 0) - strcat(buspath, "/"); - + strcat(buspath, "/"); strcat(buspath, SYSFS_BUS_NAME); strcat(buspath, "/"); strcat(buspath, name); @@ -226,6 +224,11 @@ struct sysfs_bus *sysfs_open_bus(const unsigned char *name) } strcpy(bus->name, name); strcpy(bus->path, buspath); + if ((sysfs_remove_trailing_slash(bus->path)) != 0) { + dprintf("Incorrect path to bus %s\n", bus->path); + sysfs_close_bus(bus); + return NULL; + } return bus; } @@ -296,20 +299,37 @@ struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) if (bus->directory->attributes == NULL) { if ((sysfs_read_dir_attributes(bus->directory)) != 0) return NULL; - } else { - if ((sysfs_path_is_dir(bus->path)) != 0) { - dprintf("Bus at %s no longer exists\n", bus->path); - return NULL; - } - if ((sysfs_refresh_attributes - (bus->directory->attributes)) != 0) { - dprintf("Error refreshing bus attributes\n"); - return NULL; - } } return bus->directory->attributes; } +/** + * sysfs_refresh_bus_attributes: refreshes the bus's list of attributes + * @bus: sysfs_bus whose attributes to refresh + * + * NOTE: Upon return, prior references to sysfs_attributes for this bus + * _may_ not be valid + * + * Returns list of attributes on success and NULL on failure + */ +struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus) +{ + if (bus == NULL) { + errno = EINVAL; + return NULL; + } + + if (bus->directory == NULL) + return (sysfs_get_bus_attributes(bus)); + + if ((sysfs_refresh_dir_attributes(bus->directory)) != 0) { + dprintf("Error refreshing bus attributes\n"); + return NULL; + } + + return (bus->directory->attributes); +} + /** * sysfs_get_bus_attribute: gets a specific bus attribute, if buses had * attributes. @@ -357,8 +377,7 @@ struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, return NULL; } - if (sysfs_trailing_slash(path) == 0) - strcat(path, "/"); + strcat(path, "/"); strcat(path, SYSFS_BUS_NAME); strcat(path, "/"); strcat(path, busname); diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index 16eaf6e514..cd86912142 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -160,6 +160,11 @@ struct sysfs_class_device *sysfs_open_class_device_path } strcpy(cdev->path, path); + if ((sysfs_remove_trailing_slash(cdev->path)) != 0) { + dprintf("Invalid path to class device %s\n", cdev->path); + sysfs_close_class_device(cdev); + return NULL; + } set_classdev_classname(cdev); return cdev; @@ -179,6 +184,10 @@ struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) errno = EINVAL; return NULL; } + + if (cls->devices != NULL) + return cls->devices; + if (cls->directory == NULL) { cls->directory = sysfs_open_directory(cls->path); if (cls->directory == NULL) @@ -226,16 +235,16 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) dprintf("Sysfs not supported on this system\n"); return NULL; } - if (sysfs_trailing_slash(classpath) == 0) - strcat(classpath, "/"); /* * We shall now treat "block" also as a class. Hence, check here * if "name" is "block" and proceed accordingly */ if (strcmp(name, SYSFS_BLOCK_NAME) == 0) { + strcat(classpath, "/"); strcat(classpath, SYSFS_BLOCK_NAME); } else { + strcat(classpath, "/"); strcat(classpath, SYSFS_CLASS_NAME); strcat(classpath, "/"); strcat(classpath, name); @@ -252,6 +261,11 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) } strcpy(cls->name, name); strcpy(cls->path, classpath); + if ((sysfs_remove_trailing_slash(cls->path)) != 0) { + dprintf("Invalid path to class device %s\n", cls->path); + sysfs_close_class(cls); + return NULL; + } return cls; } @@ -264,8 +278,6 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *class, unsigned char *name) { - struct dlist *devlist = NULL; - if (class == NULL || name == NULL) { errno = EINVAL; return NULL; @@ -273,7 +285,7 @@ struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *class, if (class->devices == NULL) { class->devices = sysfs_get_class_devices(class); - if (devlist == NULL) + if (class->devices == NULL) return NULL; } return (struct sysfs_class_device *)dlist_find_custom(class->devices, @@ -291,14 +303,21 @@ struct sysfs_device *sysfs_get_classdev_device (struct sysfs_class_device *clsdev) { struct sysfs_link *devlink = NULL; + unsigned char devpath[SYSFS_PATH_MAX]; if (clsdev == NULL) { errno = EINVAL; return NULL; } - - if (clsdev->sysdevice != NULL) - return (clsdev->sysdevice); + strcpy(devpath, clsdev->path); + strcat(devpath, "/device"); + if ((sysfs_path_is_link(devpath)) != 0) { + if (clsdev->sysdevice != NULL) { + sysfs_close_device(clsdev->sysdevice); + clsdev->sysdevice = NULL; + } + return NULL; + } if (clsdev->directory == NULL) { clsdev->directory = sysfs_open_directory(clsdev->path); @@ -306,8 +325,24 @@ struct sysfs_device *sysfs_get_classdev_device return NULL; } devlink = sysfs_get_directory_link(clsdev->directory, "device"); - if (devlink == NULL) + if (devlink == NULL) { + if (clsdev->sysdevice != NULL) { + dprintf("Device link no longer exists\n"); + sysfs_close_device(clsdev->sysdevice); + clsdev->sysdevice = NULL; + } return NULL; + } + + if (clsdev->sysdevice != NULL) { + if (!strncmp(devlink->target, clsdev->sysdevice->path, + SYSFS_PATH_MAX)) + /* sysdevice hasn't changed */ + return (clsdev->sysdevice); + else + /* come here only if the device link for has changed */ + sysfs_close_device(clsdev->sysdevice); + } clsdev->sysdevice = sysfs_open_device_path(devlink->target); if (clsdev->sysdevice == NULL) @@ -329,31 +364,56 @@ struct sysfs_driver *sysfs_get_classdev_driver (struct sysfs_class_device *clsdev) { struct sysfs_link *drvlink = NULL; + unsigned char drvpath[SYSFS_PATH_MAX]; if (clsdev == NULL) { errno = EINVAL; return NULL; } - - if (clsdev->driver != NULL) - return (clsdev->driver); - + strcpy(drvpath, clsdev->path); + strcat(drvpath, "/driver"); + if ((sysfs_path_is_link(drvpath)) != 0) { + if (clsdev->driver != NULL) { + sysfs_close_driver(clsdev->driver); + clsdev->driver = NULL; + } + return NULL; + } + if (clsdev->directory == NULL) { clsdev->directory = sysfs_open_directory(clsdev->path); if (clsdev->directory == NULL) return NULL; } drvlink = sysfs_get_directory_link(clsdev->directory, "driver"); - if (drvlink != NULL) { - clsdev->driver = sysfs_open_driver_path(drvlink->target); - if (clsdev->driver == NULL) - return NULL; - + if (drvlink == NULL) { + if (clsdev->driver != NULL) { + dprintf("Driver link no longer exists\n"); + sysfs_close_driver(clsdev->driver); + clsdev->driver = NULL; + } + return NULL; + } + if (clsdev->driver != NULL) { + if (!strncmp(drvlink->target, clsdev->driver->path, + SYSFS_PATH_MAX)) + /* driver hasn't changed */ + return (clsdev->driver); + else + /* come here only if the device link for has changed */ + sysfs_close_driver(clsdev->driver); } + + clsdev->driver = sysfs_open_driver_path(drvlink->target); + if (clsdev->driver == NULL) + return NULL; + if (clsdev->sysdevice != NULL) + strcpy(clsdev->sysdevice->driver_name, clsdev->driver->name); + return (clsdev->driver); } - -/* + +/** * get_blockdev_parent: Get the parent class device for a "block" subsystem * device if present * @clsdev: block subsystem class device whose parent needs to be found @@ -361,48 +421,34 @@ struct sysfs_driver *sysfs_get_classdev_driver */ static int get_blockdev_parent(struct sysfs_class_device *clsdev) { - unsigned char parent_path[SYSFS_PATH_MAX], value[256], *c = NULL; - - memset(parent_path, 0, SYSFS_PATH_MAX); - strcpy(parent_path, clsdev->path); + unsigned char parent_path[SYSFS_PATH_MAX], *c = NULL; + strcpy(parent_path, clsdev->path); c = strstr(parent_path, SYSFS_BLOCK_NAME); if (c == NULL) { - dprintf("Class device %s does not belong to BLOCK subsystem", + dprintf("Class device %s does not belong to BLOCK subsystem\n", clsdev->name); return 1; } - + c += strlen(SYSFS_BLOCK_NAME); if (*c == '/') c++; else goto errout; - - /* validate whether the given class device is a partition or not */ - if ((strncmp(c, clsdev->name, strlen(clsdev->name))) == 0) { - dprintf("%s not a partition\n", clsdev->name); - return 1; - } - c = strchr(c, '/'); - if (c == NULL) - goto errout; - *c = '\0'; - - /* Now validate if the parent has the "dev" attribute */ - memset(value, 0, 256); - strcat(parent_path, "/dev"); - if ((sysfs_read_attribute_value(parent_path, value, 256)) != 0) { - dprintf("Block device %s does not have a parent\n", - clsdev->name); - return 1; - } - - c = strrchr(parent_path, '/'); + + /* validate whether the given class device is a partition or not */ + if ((strncmp(c, clsdev->name, strlen(clsdev->name))) == 0) { + dprintf("%s not a partition\n", clsdev->name); + return 1; + } + + c = strchr(c, '/'); if (c == NULL) goto errout; *c = '\0'; + clsdev->parent = sysfs_open_class_device_path(parent_path); if (clsdev->parent == NULL) { dprintf("Error opening the parent class device at %s\n", @@ -467,13 +513,11 @@ static int get_classdev_path(const unsigned char *classname, dprintf("Error getting sysfs mount path\n"); return -1; } - - if (sysfs_trailing_slash(path) == 0) - strcat(path, "/"); - if (strcmp(classname, SYSFS_BLOCK_NAME) == 0) { + strcat(path, "/"); strcat(path, SYSFS_BLOCK_NAME); } else { + strcat(path, "/"); strcat(path, SYSFS_CLASS_NAME); strcat(path, "/"); strcat(path, classname); @@ -537,26 +581,40 @@ struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev) return NULL; } if (cdev->directory->attributes == NULL) { - if ((sysfs_read_dir_attributes(cdev->directory)) != 0) { - dprintf("Error reading attributes for directory %s\n", - cdev->directory->path); - return NULL; - } - } else { - if ((sysfs_path_is_dir(cdev->path)) != 0) { - dprintf("Class device at %s no longer exists\n", - cdev->path); - return NULL; - } - if ((sysfs_refresh_attributes - (cdev->directory->attributes)) != 0) { - dprintf("Error refreshing classdev attributes\n"); + if ((sysfs_read_dir_attributes(cdev->directory)) != 0) return NULL; - } } return (cdev->directory->attributes); } +/** + * sysfs_refresh_clsassdev_attributes: refreshes the driver's list of attributes + * @clsdev: sysfs_class_device whose attributes to refresh + * + * NOTE: Upon return, prior references to sysfs_attributes for this classdev + * _may_ not be valid + * + * Returns list of attributes on success and NULL on failure + */ +struct dlist *sysfs_refresh_classdev_attributes + (struct sysfs_class_device *clsdev) +{ + if (clsdev == NULL) { + errno = EINVAL; + return NULL; + } + + if (clsdev->directory == NULL) + return (sysfs_get_classdev_attributes(clsdev)); + + if ((sysfs_refresh_dir_attributes(clsdev->directory)) != 0) { + dprintf("Error refreshing class_device attributes\n"); + return NULL; + } + + return (clsdev->directory->attributes); +} + /** * sysfs_get_classdev_attr: searches class device's attributes by name * @clsdev: class device to look through @@ -597,15 +655,10 @@ struct sysfs_attribute *sysfs_get_classdev_attr struct sysfs_directory) { if ((sysfs_path_is_dir(sdir->path)) != 0) continue; - if (sdir->attributes == NULL) { - cur = sysfs_get_directory_attribute(sdir, - (unsigned char *)name); - } else { - if ((sysfs_refresh_attributes - (sdir->attributes)) == 0) - cur = sysfs_get_directory_attribute(sdir, + cur = sysfs_get_directory_attribute(sdir, (unsigned char *)name); - } + if (cur == NULL) + continue; } } return cur; diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 66d5f9aef7..bfd761b885 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -24,12 +24,12 @@ #include "sysfs.h" /** - * get_device_bus: retrieves the bus name the device is on, checks path to - * bus' link to make sure it has correct device. + * sysfs_get_device_bus: retrieves the bus name the device is on, checks path + * to bus' link to make sure it has correct device. * @dev: device to get busname. * returns 0 with success and -1 with error. */ -static int get_device_bus(struct sysfs_device *dev) +int sysfs_get_device_bus(struct sysfs_device *dev) { unsigned char subsys[SYSFS_NAME_LEN], path[SYSFS_PATH_MAX]; unsigned char target[SYSFS_PATH_MAX], *bus = NULL, *c = NULL; @@ -197,6 +197,11 @@ struct sysfs_device *sysfs_open_device_path(const unsigned char *path) return NULL; } strcpy(dev->path, path); + if ((sysfs_remove_trailing_slash(dev->path)) != 0) { + dprintf("Invalid path to device %s\n", dev->path); + sysfs_close_device(dev); + return NULL; + } /* * The "name" attribute no longer exists... return the device's * sysfs representation instead, in the "dev->name" field, which @@ -204,8 +209,8 @@ struct sysfs_device *sysfs_open_device_path(const unsigned char *path) */ strncpy(dev->name, dev->bus_id, SYSFS_NAME_LEN); - if (get_device_bus(dev) != 0) - strcpy(dev->bus, SYSFS_UNKNOWN); + if (sysfs_get_device_bus(dev) != 0) + dprintf("Could not get device bus\n"); return dev; } @@ -334,8 +339,7 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) return NULL; } - if (sysfs_trailing_slash(rootpath) == 0) - strcat(rootpath, "/"); + strcat(rootpath, "/"); strcat(rootpath, SYSFS_DEVICES_NAME); strcat(rootpath, "/"); strcat(rootpath, name); @@ -352,6 +356,11 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) } strcpy(root->name, name); strcpy(root->path, rootpath); + if ((sysfs_remove_trailing_slash(root->path)) != 0) { + dprintf("Invalid path to root device %s\n", root->path); + sysfs_close_root_device(root); + return NULL; + } return root; } @@ -373,20 +382,37 @@ struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) if (device->directory->attributes == NULL) { if ((sysfs_read_dir_attributes(device->directory)) != 0) return NULL; - } else { - if ((sysfs_path_is_dir(device->path)) != 0) { - dprintf("Device at %s no longer exists", device->path); - return NULL; - } - if ((sysfs_refresh_attributes - (device->directory->attributes)) != 0) { - dprintf("Error refreshing device attributes\n"); - return NULL; - } } return (device->directory->attributes); } +/** + * sysfs_refresh_device_attributes: refreshes the device's list of attributes + * @device: sysfs_device whose attributes to refresh + * + * NOTE: Upon return, prior references to sysfs_attributes for this device + * _may_ not be valid + * + * Returns list of attributes on success and NULL on failure + */ +struct dlist *sysfs_refresh_device_attributes(struct sysfs_device *device) +{ + if (device == NULL) { + errno = EINVAL; + return NULL; + } + + if (device->directory == NULL) + return (sysfs_get_device_attributes(device)); + + if ((sysfs_refresh_dir_attributes(device->directory)) != 0) { + dprintf("Error refreshing device attributes\n"); + return NULL; + } + + return (device->directory->attributes); +} + /** * sysfs_get_device_attr: searches dev's attributes by name * @dev: device to look through @@ -396,22 +422,19 @@ struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, const unsigned char *name) { - struct sysfs_attribute *cur = NULL; struct dlist *attrlist = NULL; if (dev == NULL || name == NULL) { errno = EINVAL; return NULL; } - + attrlist = sysfs_get_device_attributes(dev); if (attrlist == NULL) return NULL; - cur = sysfs_get_directory_attribute(dev->directory, - (unsigned char *)name); - - return cur; + return sysfs_get_directory_attribute(dev->directory, + (unsigned char *)name); } /** @@ -437,8 +460,7 @@ static int get_device_absolute_path(const unsigned char *device, dprintf ("Sysfs not supported on this system\n"); return -1; } - if (sysfs_trailing_slash(bus_path) == 0) - strcat(bus_path, "/"); + strcat(bus_path, "/"); strcat(bus_path, SYSFS_BUS_NAME); strcat(bus_path, "/"); strcat(bus_path, bus); diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index c159db7af8..a60410ed28 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -195,7 +195,7 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, return -1; } if ((strncmp(sysattr->value, new_value, sysattr->len)) == 0) { - dprintf("Attribute %s already has the requested value %s\n", + dprintf("Attr %s already has the requested value %s\n", sysattr->name, new_value); return 0; } @@ -274,7 +274,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) return -1; } #ifdef __KLIBC__ - pgsize = 0x1000; + pgsize = 0x1000; #else pgsize = sysconf(_SC_PAGESIZE); #endif @@ -468,6 +468,13 @@ struct sysfs_directory *sysfs_open_directory(const unsigned char *path) errno = EINVAL; return NULL; } + + if (sysfs_path_is_dir(path) != 0) { + dprintf("Invalid path directory %s\n", path); + errno = EINVAL; + return NULL; + } + sdir = alloc_directory(); if (sdir == NULL) { dprintf("Error allocating directory %s\n", path); @@ -513,39 +520,6 @@ struct sysfs_link *sysfs_open_link(const unsigned char *linkpath) return ln; } -/** - * sysfs_refresh_attributes: Refresh attributes list - * @attrlist: list of attributes to refresh - * Returns 0 on success, 1 on failure - */ -int sysfs_refresh_attributes(struct dlist *attrlist) -{ - struct sysfs_attribute *attr = NULL; - - if (attrlist == NULL) { - errno = EINVAL; - return 1; - } - dlist_for_each_data(attrlist, attr, struct sysfs_attribute) { - if (attr->method & SYSFS_METHOD_SHOW) { - if ((sysfs_read_attribute(attr)) != 0) { - dprintf("Error reading attribute %s\n", - attr->path); - if ((sysfs_path_is_file(attr->path)) != 0) { - dprintf("Attr %s no longer exists\n", - attr->name); - } - } - } else { - if ((sysfs_path_is_file(attr->path)) != 0) { - dprintf("Attr %s no longer exists\n", - attr->name); - } - } - } - return 0; -} - /** * add_attribute: open and add attribute at path to given directory * @sysdir: directory to add attribute to @@ -633,7 +607,6 @@ int sysfs_read_dir_attributes(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; - struct stat astats; unsigned char file_path[SYSFS_PATH_MAX]; int retval = 0; @@ -655,11 +628,7 @@ int sysfs_read_dir_attributes(struct sysfs_directory *sysdir) strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); strcat(file_path, "/"); strcat(file_path, dirent->d_name); - if ((lstat(file_path, &astats)) != 0) { - dprintf("stat failed\n"); - continue; - } - if (S_ISREG(astats.st_mode)) + if ((sysfs_path_is_file(file_path)) == 0) retval = add_attribute(sysdir, file_path); } closedir(dir); @@ -675,7 +644,6 @@ int sysfs_read_dir_links(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; - struct stat astats; unsigned char file_path[SYSFS_PATH_MAX]; int retval = 0; @@ -697,11 +665,7 @@ int sysfs_read_dir_links(struct sysfs_directory *sysdir) strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); strcat(file_path, "/"); strcat(file_path, dirent->d_name); - if ((lstat(file_path, &astats)) != 0) { - dprintf("stat failed\n"); - continue; - } - if (S_ISLNK(astats.st_mode)) { + if ((sysfs_path_is_link(file_path)) == 0) { retval = add_link(sysdir, file_path); if (retval != 0) break; @@ -720,7 +684,6 @@ int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; - struct stat astats; unsigned char file_path[SYSFS_PATH_MAX]; int retval = 0; @@ -742,11 +705,7 @@ int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir) strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); strcat(file_path, "/"); strcat(file_path, dirent->d_name); - if ((lstat(file_path, &astats)) != 0) { - dprintf("stat failed\n"); - continue; - } - if (S_ISDIR(astats.st_mode)) + if ((sysfs_path_is_dir(file_path)) == 0) retval = add_subdirectory(sysdir, file_path); } closedir(dir); @@ -801,6 +760,90 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) return(retval); } +/** + * sysfs_refresh_dir_attributes: Refresh attributes list + * @sysdir: directory whose list of attributes to refresh + * Returns 0 on success, 1 on failure + */ +int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir) +{ + if (sysdir == NULL) { + errno = EINVAL; + return 1; + } + if ((sysfs_path_is_dir(sysdir->path)) != 0) { + dprintf("Invalid path to directory %s\n", sysdir->path); + errno = EINVAL; + return 1; + } + if (sysdir->attributes != NULL) { + dlist_destroy(sysdir->attributes); + sysdir->attributes = NULL; + } + if ((sysfs_read_dir_attributes(sysdir)) != 0) { + dprintf("Error refreshing attributes for directory %s\n", + sysdir->path); + return 1; + } + return 0; +} + +/** + * sysfs_refresh_dir_links: Refresh links list + * @sysdir: directory whose list of links to refresh + * Returns 0 on success, 1 on failure + */ +int sysfs_refresh_dir_links(struct sysfs_directory *sysdir) +{ + if (sysdir == NULL) { + errno = EINVAL; + return 1; + } + if ((sysfs_path_is_dir(sysdir->path)) != 0) { + dprintf("Invalid path to directory %s\n", sysdir->path); + errno = EINVAL; + return 1; + } + if (sysdir->links != NULL) { + dlist_destroy(sysdir->links); + sysdir->links = NULL; + } + if ((sysfs_read_dir_links(sysdir)) != 0) { + dprintf("Error refreshing links for directory %s\n", + sysdir->path); + return 1; + } + return 0; +} + +/** + * sysfs_refresh_dir_subdirs: Refresh subdirs list + * @sysdir: directory whose list of subdirs to refresh + * Returns 0 on success, 1 on failure + */ +int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir) +{ + if (sysdir == NULL) { + errno = EINVAL; + return 1; + } + if ((sysfs_path_is_dir(sysdir->path)) != 0) { + dprintf("Invalid path to directory %s\n", sysdir->path); + errno = EINVAL; + return 1; + } + if (sysdir->subdirs != NULL) { + dlist_destroy(sysdir->subdirs); + sysdir->subdirs = NULL; + } + if ((sysfs_read_dir_subdirs(sysdir)) != 0) { + dprintf("Error refreshing subdirs for directory %s\n", + sysdir->path); + return 1; + } + return 0; +} + /** * sysfs_get_directory_attribute: retrieves attribute attrname from current * directory only @@ -826,19 +869,25 @@ struct sysfs_attribute *sysfs_get_directory_attribute attr = (struct sysfs_attribute *)dlist_find_custom (dir->attributes, attrname, dir_attribute_name_equal); - if (attr == NULL) { + if (attr != NULL) { + if ((sysfs_read_attribute(attr)) != 0) { + dprintf("Error reading attribute %s\n", attr->name); + return NULL; + } + } else { memset(new_path, 0, SYSFS_PATH_MAX); strcpy(new_path, dir->path); strcat(new_path, "/"); strcat(new_path, attrname); if ((sysfs_path_is_file(new_path)) == 0) { - if ((add_attribute(dir, new_path)) == 0) { + if ((add_attribute(dir, new_path)) == 0) { attr = (struct sysfs_attribute *) - dlist_find_custom(dir->attributes, + dlist_find_custom(dir->attributes, attrname, dir_attribute_name_equal); } } } + return attr; } @@ -855,9 +904,13 @@ struct sysfs_link *sysfs_get_directory_link errno = EINVAL; return NULL; } - if (dir->links == NULL) + if (dir->links == NULL) { if ((sysfs_read_dir_links(dir) != 0) || (dir->links == NULL)) return NULL; + } else { + if ((sysfs_refresh_dir_links(dir)) != 0) + return NULL; + } return (struct sysfs_link *)dlist_find_custom(dir->links, linkname, dir_link_name_equal); @@ -940,3 +993,63 @@ struct sysfs_link *sysfs_get_subdirectory_link(struct sysfs_directory *dir, } return NULL; } + +/** + * sysfs_get_dir_attributes: returns dlist of directory attributes + * @dir: directory to retrieve attributes from + * returns dlist of attributes or NULL + */ +struct dlist *sysfs_get_dir_attributes(struct sysfs_directory *dir) +{ + if (dir == NULL) { + errno = EINVAL; + return NULL; + } + + if (dir->attributes == NULL) { + if (sysfs_read_dir_attributes(dir) != 0) + return NULL; + } + + return (dir->attributes); +} + +/** + * sysfs_get_dir_links: returns dlist of directory links + * @dir: directory to return links for + * returns dlist of links or NULL + */ +struct dlist *sysfs_get_dir_links(struct sysfs_directory *dir) +{ + if (dir == NULL) { + errno = EINVAL; + return NULL; + } + + if (dir->links == NULL) { + if (sysfs_read_dir_links(dir) != 0) + return NULL; + } + + return (dir->links); +} + +/** + * sysfs_get_dir_subdirs: returns dlist of directory subdirectories + * @dir: directory to return subdirs for + * returns dlist of subdirs or NULL + */ +struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir) +{ + if (dir == NULL) { + errno = EINVAL; + return NULL; + } + + if (dir->subdirs == NULL) { + if (sysfs_read_dir_subdirs(dir) != 0) + return NULL; + } + + return (dir->subdirs); +} diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index 695ca794f1..a4440cfdf9 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -103,6 +103,11 @@ struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path) return NULL; } strcpy(driver->path, path); + if ((sysfs_remove_trailing_slash(driver->path)) != 0) { + dprintf("Invalid path to driver %s\n", driver->path); + sysfs_close_driver(driver); + return NULL; + } return driver; } @@ -125,25 +130,37 @@ struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) return NULL; } if (driver->directory->attributes == NULL) { - if ((sysfs_read_dir_attributes(driver->directory)) != 0) { - dprintf("Error reading driver attributes\n"); - return NULL; - } - } else { - if ((sysfs_path_is_dir(driver->path)) != 0) { - dprintf("Driver at %s no longer exists\n", - driver->path); - return NULL; - } - if ((sysfs_refresh_attributes - (driver->directory->attributes)) != 0) { - dprintf("Error refreshing driver attributes\n"); + if ((sysfs_read_dir_attributes(driver->directory)) != 0) return NULL; - } } return(driver->directory->attributes); } +/** + * sysfs_refresh_driver_attributes: refreshes the driver's list of attributes + * @driver: sysfs_driver whose attributes to refresh + * + * NOTE: Upon return, prior references to sysfs_attributes for this driver + * _may_ not be valid + * + * Returns list of attributes on success and NULL on failure + */ +struct dlist *sysfs_refresh_driver_attributes(struct sysfs_driver *driver) +{ + if (driver == NULL) { + errno = EINVAL; + return NULL; + } + if (driver->directory == NULL) + return (sysfs_get_driver_attributes(driver)); + + if ((sysfs_refresh_dir_attributes(driver->directory)) != 0) { + dprintf("Error refreshing driver attributes\n"); + return NULL; + } + return (driver->directory->attributes); +} + /** * sysfs_get_driver_attr: searches driver's attributes by name * @drv: driver to look through @@ -153,7 +170,6 @@ struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, const unsigned char *name) { - struct sysfs_attribute *cur = NULL; struct dlist *attrlist = NULL; if (drv == NULL) { @@ -163,9 +179,10 @@ struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, attrlist = sysfs_get_driver_attributes(drv); if (attrlist != NULL) - cur = sysfs_get_directory_attribute(drv->directory, + return NULL; + + return sysfs_get_directory_attribute(drv->directory, (unsigned char *)name); - return cur; } /** @@ -233,6 +250,38 @@ struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver) return (driver->devices); } +/** + * sysfs_refresh_driver_devices: Refreshes drivers list of devices + * @driver: sysfs_driver whose devices list needs to be refreshed + * + * NOTE: Upon return from this function, prior sysfs_device references from + * this driver's list of devices _may_ not be valid + * + * Returns dlist of devices on success and NULL on failure + */ +struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver) +{ + if (driver == NULL) { + errno = EINVAL; + return NULL; + } + + if (driver->devices != NULL) { + dlist_destroy(driver->devices); + driver->devices = NULL; + } + + if (driver->directory == NULL) + return (sysfs_get_driver_devices(driver)); + + if ((sysfs_refresh_dir_links(driver->directory)) != 0) { + dprintf("Error refreshing driver links\n"); + return NULL; + } + + return (sysfs_get_driver_devices(driver)); +} + /** * sysfs_get_driver_device: looks up a device from a list of driver's devices * and returns its sysfs_device corresponding to it @@ -285,8 +334,7 @@ static int get_driver_path(const unsigned char *bus, dprintf("Error getting sysfs mount path\n"); return -1; } - if (sysfs_trailing_slash(path) == 0) - strcat(path, "/"); + strcat(path, "/"); strcat(path, SYSFS_BUS_NAME); strcat(path, "/"); strcat(path, bus); diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 009ae94efa..f1f82361d0 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -26,6 +26,30 @@ #include #endif +/** + * sysfs_remove_trailing_slash: Removes any trailing '/' in the given path + * @path: Path to look for the trailing '/' + * Returns 0 on success 1 on error + */ +int sysfs_remove_trailing_slash(unsigned char *path) +{ + unsigned char *c = NULL; + + if (path == NULL) { + errno = EINVAL; + return 1; + } + c = strrchr(path, '/'); + if (c == NULL) { + dprintf("Invalid path %s\n", path); + errno = EINVAL; + return 1; + } + if (*(c+1) == '\0') + *c = '\0'; + return 0; +} + /** * sysfs_get_mnt_path: Gets the mount point for specified filesystem. * @fs_type: filesystem type to retrieve mount point @@ -72,27 +96,13 @@ static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, errno = EINVAL; ret = -1; } + if ((sysfs_remove_trailing_slash(mnt_path)) != 0) + ret = -1; + return ret; #endif } -/* - * sysfs_trailing_slash: checks if there's a trailing slash to path - * @path: path to check - * returns 1 if true and 0 if not - */ -int sysfs_trailing_slash(unsigned char *path) -{ - unsigned char *s = NULL; - - if (path == NULL) - return 0; - s = &path[strlen(path)-1]; - if (strncmp(s, "/", 1) == 0) - return 1; - return 0; -} - /* * sysfs_get_mnt_path: Gets the sysfs mount point. * @mnt_path: place to put "sysfs" mount point @@ -109,9 +119,11 @@ int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len) return -1; } sysfs_path = getenv(SYSFS_PATH_ENV); - if (sysfs_path != NULL) + if (sysfs_path != NULL) { strncpy(mnt_path, sysfs_path, len); - else + if ((sysfs_remove_trailing_slash(mnt_path)) != 0) + return 1; + } else ret = sysfs_get_fs_mnt_path(SYSFS_FSTYPE_NAME, mnt_path, len); return ret; @@ -152,7 +164,7 @@ int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, strncpy(name, n, len); return 0; } - + /** * sysfs_get_link: returns link source * @path: symbolic link's path @@ -178,32 +190,69 @@ int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) if ((readlink(path, linkpath, SYSFS_PATH_MAX)) < 0) { return -1; } - d = linkpath; - - /* getting rid of leading "../.." */ - while (*d == '/' || *d == '.') { - if (*d == '/') - slashes++; - d++; - } - - d--; - - s = &devdir[strlen(devdir)-1]; - while (s != NULL && count != (slashes+1)) { - s--; - if (*s == '/') - count++; + /* + * Three cases here: + * 1. relative path => format ../.. + * 2. absolute path => format /abcd/efgh + * 3. relative path _from_ this dir => format abcd/efgh + */ + switch (*d) { + case '.': + /* + * handle the case where link is of type ./abcd/xxx + */ + strncpy(target, devdir, len); + if (*(d+1) == '/') + d += 2; + else if (*(d+1) == '.') + goto parse_path; + s = strrchr(target, '/'); + if (s != NULL) { + *(s+1) = '\0'; + strcat(target, d); + } else { + strcpy(target, d); + } + break; + /* + * relative path + * getting rid of leading "../.." + */ +parse_path: + while (*d == '/' || *d == '.') { + if (*d == '/') + slashes++; + d++; + } + d--; + s = &devdir[strlen(devdir)-1]; + while (s != NULL && count != (slashes+1)) { + s--; + if (*s == '/') + count++; + } + strncpy(s, d, (SYSFS_PATH_MAX-strlen(devdir))); + strncpy(target, devdir, len); + break; + case '/': + /* absolute path - copy as is */ + strncpy(target, linkpath, len); + break; + default: + /* relative path from this directory */ + strncpy(target, devdir, len); + s = strrchr(target, '/'); + if (s != NULL) { + *(s+1) = '\0'; + strcat(target, linkpath); + } else { + strcpy(target, linkpath); + } } - - strncpy(s, d, (SYSFS_PATH_MAX-strlen(devdir))); - strncpy(target, devdir, len); - return 0; } - /** * sysfs_del_name: free function for sysfs_open_subsystem_list * @name: memory area to be freed @@ -245,8 +294,8 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) dprintf("Error getting sysfs mount point\n"); return NULL; } - if (sysfs_trailing_slash(sysfs_path) == 0) - strcat(sysfs_path, "/"); + + strcat(sysfs_path, "/"); strcat(sysfs_path, name); dir = sysfs_open_directory(sysfs_path); if (dir == NULL) { @@ -318,8 +367,7 @@ struct dlist *sysfs_open_bus_devices_list(unsigned char *name) return NULL; } - if (sysfs_trailing_slash(sysfs_path) == 0) - strcat(sysfs_path, "/"); + strcat(sysfs_path, "/"); strcat(sysfs_path, SYSFS_BUS_NAME); strcat(sysfs_path, "/"); strcat(sysfs_path, name); @@ -376,7 +424,7 @@ int sysfs_path_is_dir(const unsigned char *path) } if (S_ISDIR(astats.st_mode)) return 0; - + return 1; } @@ -399,7 +447,7 @@ int sysfs_path_is_link(const unsigned char *path) } if (S_ISLNK(astats.st_mode)) return 0; - + return 1; } @@ -422,6 +470,6 @@ int sysfs_path_is_file(const unsigned char *path) } if (S_ISREG(astats.st_mode)) return 0; - + return 1; } diff --git a/namedev.c b/namedev.c index 0e1af9385f..fdda039f59 100644 --- a/namedev.c +++ b/namedev.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -514,11 +515,8 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de { struct sysfs_device *sysfs_device; struct sysfs_class_device *class_dev_parent; + struct timespec tspec; int loop; - char filename[SYSFS_PATH_MAX + 6]; - int retval; - char *temp; - int partition = 0; /* Figure out where the device symlink is at. For char devices this will * always be in the class_dev->path. But for block devices, it's different. @@ -529,69 +527,54 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de * symlink yet. We do sit and spin on waiting for them right now, we should * possibly have a whitelist for these devices here... */ - strcpy(filename, class_dev->path); - dbg("filename = %s", filename); - if (strcmp(class_dev->classname, SYSFS_BLOCK_NAME) == 0) { - if (isdigit(class_dev->path[strlen(class_dev->path)-1])) { - temp = strrchr(filename, '/'); - if (temp) { - char *temp2 = strrchr(filename, '/'); - partition = 1; - *temp = 0x00; - dbg("temp2 = %s", temp2); - if (temp2 && (strcmp(temp2, "/block") == 0)) { - /* oops, we have no parent block device, so go back to original directory */ - strcpy(filename, class_dev->path); - partition = 0; - } - } - } - } - strcat(filename, "/device"); + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent) + dbg("Really a partition"); - loop = 2; + tspec.tv_sec = 0; + tspec.tv_nsec = 10000000; /* sleep 10 millisec */ + loop = 10; while (loop--) { - struct stat buf; - dbg("looking for '%s'", filename); - retval = stat(filename, &buf); - if (!retval) - break; - /* sleep to give the kernel a chance to create the device file */ - sleep(1); - } + nanosleep(&tspec, NULL); + if (class_dev_parent) + sysfs_device = sysfs_get_classdev_device(class_dev_parent); + else + sysfs_device = sysfs_get_classdev_device(class_dev); - loop = 1; /* FIXME put a real value in here for when everything is fixed... */ - while (loop--) { - /* find the sysfs_device for this class device */ - /* Wouldn't it really be nice if libsysfs could do this for us? */ - sysfs_device = sysfs_get_classdev_device(class_dev); if (sysfs_device != NULL) - goto exit; - - /* if it's a partition, we need to get the parent device */ - if (partition) { - /* FIXME HACK HACK HACK HACK - * for some reason partitions need this extra sleep here, in order - * to wait for the device properly. Once the libsysfs code is - * fixed properly, this sleep should go away, and we can just loop above. - */ - sleep(1); - dbg("really is a partition"); - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent == NULL) { - dbg("sysfs_get_classdev_parent for class device '%s' failed", class_dev->name); - } else { - dbg("class_dev_parent->name='%s'", class_dev_parent->name); - sysfs_device = sysfs_get_classdev_device(class_dev_parent); - if (sysfs_device != NULL) - goto exit; - } - } - /* sleep to give the kernel a chance to create the link */ - /* FIXME remove comment... - sleep(1); */ + goto device_found; } dbg("Timed out waiting for device symlink, continuing on anyway..."); + +device_found: + /* We have another issue with just the wait above - the sysfs part of + * the kernel may not be quick enough to have created the link to the + * device under the "bus" subsystem. Due to this, the sysfs_device->bus + * will not contain the actual bus name :( + * + * Libsysfs now provides a new API sysfs_get_device_bus(), so use it + * if needed + */ + if (sysfs_device) { + + if (sysfs_device->bus[0] != '\0') + goto bus_found; + + loop = 10; + tspec.tv_nsec = 10000000; + while (loop--) { + nanosleep(&tspec, NULL); + sysfs_get_device_bus(sysfs_device); + + if (sysfs_device->bus[0] != '\0') + goto bus_found; + } + dbg("Timed out waiting to find the device bus, continuing on anyway\n"); + goto exit; +bus_found: + dbg("Device %s is registered with bus %s\n", + sysfs_device->name, sysfs_device->bus); + } exit: return sysfs_device; } -- cgit v1.2.3-54-g00ecf From f130b15645fb41d9dd902b6c96948d344bfe96fa Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 14 Jan 2004 22:55:24 -0800 Subject: [PATCH] add usb_host and pci_bus to the class blacklist. --- udev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev.c b/udev.c index 84950c82a3..b395be2abb 100644 --- a/udev.c +++ b/udev.c @@ -245,6 +245,8 @@ static char *subsystem_blacklist[] = { "net", "scsi_host", "scsi_device", + "usb_host", + "pci_bus", "", }; -- cgit v1.2.3-54-g00ecf From 45d57088f915897fc54ff8a98934b1b34c4cc18f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 15 Jan 2004 21:18:21 -0800 Subject: [PATCH] remove unneeded keyboard rule. --- etc/udev/udev.rules | 1 - etc/udev/udev.rules.devfs | 1 - 2 files changed, 2 deletions(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 1f3ef07242..406a1891bd 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -65,7 +65,6 @@ KERNEL="seq", NAME="snd/%k" # input devices KERNEL="mice", NAME="input/%k" -KERNEL="keyboard", NAME="input/%k" KERNEL="mouse*", NAME="input/%k" KERNEL="event*", NAME="input/%k" KERNEL="js*", NAME="input/%k" diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index 026e9465b1..c04fc7e8ef 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -71,7 +71,6 @@ KERNEL="seq", NAME="snd/%k" # input devices KERNEL="mice", NAME="input/%k" -KERNEL="keyboard", NAME="input/%k" KERNEL="mouse*", NAME="input/%k" KERNEL="event*", NAME="input/%k" KERNEL="js*", NAME="input/%k" -- cgit v1.2.3-54-g00ecf From 18f0045bc86f6b8b50a91fc4e8af4cfdd2379751 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 15 Jan 2004 21:42:59 -0800 Subject: [PATCH] remove the %D modifier as it is not longer needed. --- etc/udev/udev.rules | 16 ++-------------- etc/udev/udev.rules.devfs | 19 ++----------------- namedev.c | 10 ---------- udev.8 | 5 ----- 4 files changed, 4 insertions(+), 46 deletions(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 406a1891bd..98d2ceccc7 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -1,17 +1,5 @@ -# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields. -# They provide the following subsitutions: -# %n - the "kernel number" of the device. -# for example, 'sda3' has a "kernel number" of '3' -# %k - the kernel name for the device. -# %M - the kernel major number for the device -# %m - the kernel minor number for the device -# %b - the bus id for the device -# %c - the return value of the external PROGRAM (note, this doesn't work within -# the PROGRAM field for the obvious reason.) -# %D - use the devfs style disk name for this device. -# For partitions, this will result in 'part%n' -# If this is not a partition, it will result in 'disc' -# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. # Looking for scsi bus id 42:0:0:1 BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index c04fc7e8ef..6182f502bf 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -1,20 +1,5 @@ -# These rules are to try to emulate a devfs naming scheme in udev -# if there are any missing rules, please let the udev developers -# know. -# -# There are a number of modifiers that are allowed to be used in the -# a number of the different fields. They provide the following subsitutions: -# %n - the "kernel number" of the device. -# for example, 'sda3' has a "kernel number" of '3' -# %M - the kernel major number for the device -# %m - the kernel minor number for the device -# %b - the bus id for the device -# %c - the return value of the external PROGRAM (note, this doesn't work within -# the PROGRAM field for the obvious reason.) -# %D - use the devfs style disk name for this device. -# For partitions, this will result in 'part%n' -# If this is not a partition, it will result in 'disc' -# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. # ide block devices BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D" diff --git a/namedev.c b/namedev.c index fdda039f59..b3b23521d6 100644 --- a/namedev.c +++ b/namedev.c @@ -196,16 +196,6 @@ static void apply_format(struct udevice *udev, unsigned char *string) strcat(pos, udev->kernel_number); dbg("substitute kernel number '%s'", udev->kernel_number); break; - case 'D': - if (strlen(udev->kernel_number) == 0) { - strcat(pos, "disc"); - dbg("substitute devfs disc"); - break; - } - strcat(pos, "part"); - strcat(pos, udev->kernel_number); - dbg("substitute devfs part '%s'", udev->kernel_number); - break; case 'm': sprintf(pos, "%u", udev->minor); dbg("substitute minor number '%u'", udev->minor); diff --git a/udev.8 b/udev.8 index 1ca42982ea..0421fee4e6 100644 --- a/udev.8 +++ b/udev.8 @@ -197,11 +197,6 @@ returned string. .B PROGRAM field for the obvious reason.) .TP -.B %D -Use the devfs style disk name for this device. -For partitions, this will result in 'part%n' -If this is not a partition, it will result in 'disc'. -.TP .B %% The '%' char itself. .P -- cgit v1.2.3-54-g00ecf From 5e4f123888a30bcc2a9fc256ec00315387b2d240 Mon Sep 17 00:00:00 2001 From: "flamingice@sourmilk.net" Date: Thu, 15 Jan 2004 21:49:53 -0800 Subject: [PATCH] minor patch for devfs rules I've attached a patch that adds a few rules to udev.rules.devfs, making it look a little more like devfs on my system. (I have the sysfs patches from 2.6.1-rc1-mm2) I added rules for oss, misc, floppy, and input devices. The oss rules look like trouble with a wildcard at the end of each name, but I'm not sure how I can make it any better. Devfs has a bunch of other devices in the floppy directory for floppies formatted in unusual ways, but I don't see them in udev. Not that I ever used them, since they're usually automatically detected. --- etc/udev/udev.rules.devfs | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index 6182f502bf..1a52425633 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -10,9 +10,12 @@ BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D" # md block devices KERNEL="md[0-9]*", NAME="md/%n" +# floppy devices +KERNEL="fd[0-9]*", NAME="floppy/%n" + # tty devices -KERNEL="tty[0-9]*", NAME="vc/%n" -KERNEL="ttyS[0-9]*", NAME="tts/%n" +KERNEL="tty[0-9]*", NAME="vc/%n" +KERNEL="ttyS[0-9]*", NAME="tts/%n" KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" # vc devices @@ -43,8 +46,12 @@ KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" # misc -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" # alsa devices KERNEL="controlC[0-9]*", NAME="snd/%k" @@ -54,10 +61,18 @@ KERNEL="midi[CD0-9]*", NAME="snd/%k" KERNEL="timer", NAME="snd/%k" KERNEL="seq", NAME="snd/%k" +# oss devices +KERNEL="audio*", NAME="sound/%k", SYMLINK="%k" +KERNEL="dmmidi", NAME="sound/%k", SYMLINK="%k" +KERNEL="dsp*", NAME="sound/%k", SYMLINK="%k" +KERNEL="midi*", NAME="sound/%k", SYMLINK="%k" +KERNEL="mixer*", NAME="sound/%k", SYMLINK="%k" +KERNEL="sequencer*", NAME="sound/%k", SYMLINK="%k" + # input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse*", NAME="input/%k" -KERNEL="event*", NAME="input/%k" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" +KERNEL="mice", NAME="input/%k" +KERNEL="mouse*", NAME="input/%k" +KERNEL="event*", NAME="input/%k" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" -- cgit v1.2.3-54-g00ecf From 54988802b795328ceba29480611102902e88f572 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 15 Jan 2004 21:53:20 -0800 Subject: [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 --- Makefile | 13 +++++++++++-- logging.c | 6 ++---- logging.h | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ namedev.c | 14 ++++++++------ namedev.h | 1 + namedev_parse.c | 2 ++ udev-add.c | 2 ++ udev-remove.c | 3 ++- udev.c | 1 + udev.h | 25 ------------------------ udev_config.c | 1 + udevdb.c | 1 + 12 files changed, 91 insertions(+), 38 deletions(-) create mode 100644 logging.h diff --git a/Makefile b/Makefile index 80c4908ccb..88c7cf0bc7 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,12 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Set the following to `true' to make a debuggable build. +# Set the following to control the use of syslog +# Set it to `false' to remove all logging +LOG = true + +# Set the following to `true' to log the debug +# and make a unstripped, unoptimized binary. # Leave this set to `false' for production use. DEBUG = false @@ -104,6 +109,10 @@ else CFLAGS+=-pipe endif +ifeq ($(strip $(LOG)),true) + CFLAGS += -DLOG +endif + # if DEBUG is enabled, then we do not strip or optimize ifeq ($(strip $(DEBUG)),true) CFLAGS += $(WARNINGS) -O1 -g -DDEBUG -D_GNU_SOURCE @@ -216,7 +225,7 @@ $(LOCAL_CFG_DIR)/udev.conf: $(OBJS): $(GEN_HEADERS) -$(ROOT): $(OBJS) udev.h namedev.h udev_version.h udev_dbus.h udevdb.h klibc_fixups.h list.h +$(ROOT): $(OBJS) udev.h namedev.h udev_version.h udev_dbus.h udevdb.h klibc_fixups.h logging.h list.h $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) diff --git a/logging.c b/logging.c index 4815f39fdc..cf1da5e040 100644 --- a/logging.c +++ b/logging.c @@ -25,9 +25,9 @@ #include #include #include -#include "udev.h" -#ifdef DEBUG +#include "logging.h" + static int logging_init = 0; static unsigned char udev_logname[42]; @@ -54,5 +54,3 @@ int log_message(int level, const char *format, ...) va_end(args); return 1; } - -#endif diff --git a/logging.h b/logging.h new file mode 100644 index 0000000000..85016ad328 --- /dev/null +++ b/logging.h @@ -0,0 +1,60 @@ +/* + * udev.h + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + +#ifndef LOGGING_H +#define LOGGING_H + +#ifdef LOG +#include +#define info(format, arg...) \ + do { \ + log_message (LOG_INFO , format , ## arg); \ + } while (0) +#else + #define info(format, arg...) do { } while (0) +#endif + +#ifdef DEBUG +#define dbg(format, arg...) \ + do { \ + log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + } while (0) +#else + #define dbg(format, arg...) do { } while (0) +#endif + +/* Parser needs it's own debugging statement, we usually don't care about this at all */ +#ifdef DEBUG_PARSER +#define dbg_parse(format, arg...) \ + do { \ + log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + } while (0) +#else + #define dbg_parse(format, arg...) do { } while (0) +#endif + + +extern int log_message (int level, const char *format, ...) + __attribute__ ((format (printf, 2, 3))); + +#endif diff --git a/namedev.c b/namedev.c index b3b23521d6..137446e255 100644 --- a/namedev.c +++ b/namedev.c @@ -36,6 +36,7 @@ #include "list.h" #include "udev.h" #include "udev_version.h" +#include "logging.h" #include "namedev.h" #include "libsysfs/libsysfs.h" #include "klibc_fixups.h" @@ -285,12 +286,12 @@ static void wait_for_device_to_initialize(struct sysfs_device *sysfs_device) /* sleep to give the kernel a chance to create the file */ sleep(1); } - dbg("Timed out waiting for '%s' file, continuing on anyway...", b->file); + dbg("timed out waiting for '%s' file, continuing on anyway...", b->file); goto exit; } b++; } - dbg("Did not find bus type '%s' on list of bus_id_files, contact greg@kroah.com", sysfs_device->bus); + dbg("did not find bus type '%s' on list of bus_id_files, contact greg@kroah.com", sysfs_device->bus); exit: return; /* here to prevent compiler warning... */ } @@ -534,7 +535,7 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de if (sysfs_device != NULL) goto device_found; } - dbg("Timed out waiting for device symlink, continuing on anyway..."); + dbg("timed out waiting for device symlink, continuing on anyway..."); device_found: /* We have another issue with just the wait above - the sysfs part of @@ -559,10 +560,10 @@ device_found: if (sysfs_device->bus[0] != '\0') goto bus_found; } - dbg("Timed out waiting to find the device bus, continuing on anyway\n"); + dbg("timed out waiting to find the device bus, continuing on anyway"); goto exit; bus_found: - dbg("Device %s is registered with bus %s\n", + dbg("device %s is registered with bus '%s'", sysfs_device->name, sysfs_device->bus); } exit: @@ -694,7 +695,8 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } /* Yup, this rule belongs to us! */ - dbg("found matching rule, '%s' becomes '%s'", dev->kernel, dev->name); + info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", + udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); strfieldcpy(udev->name, dev->name); strfieldcpy(udev->symlink, dev->symlink); goto found; diff --git a/namedev.h b/namedev.h index f5b63a8805..42b1e6c1a0 100644 --- a/namedev.h +++ b/namedev.h @@ -65,6 +65,7 @@ struct config_device { char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; + int config_line; }; struct perm_device { diff --git a/namedev_parse.c b/namedev_parse.c index 0712c3b447..a17c02e395 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -36,6 +36,7 @@ #include #include "udev.h" +#include "logging.h" #include "namedev.h" static int add_config_dev(struct config_device *new_dev) @@ -249,6 +250,7 @@ int namedev_init_rules(void) goto error; } + dev.config_line = lineno; retval = add_config_dev(&dev); if (retval) { dbg("add_config_dev returned with error %d", retval); diff --git a/udev-add.c b/udev-add.c index 802d85b5b0..9aa8bdb3e9 100644 --- a/udev-add.c +++ b/udev-add.c @@ -37,6 +37,7 @@ #include "udev.h" #include "udev_version.h" #include "udev_dbus.h" +#include "logging.h" #include "namedev.h" #include "udevdb.h" #include "libsysfs/libsysfs.h" @@ -141,6 +142,7 @@ static int create_node(struct udevice *dev) if (strrchr(dev->name, '/')) create_path(filename); + info("creating device node '%s'", filename); dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor); retval = mknod(filename, dev->mode, res); if (retval) diff --git a/udev-remove.c b/udev-remove.c index c5de6c823f..9db63ed93e 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -31,6 +31,7 @@ #include "udev.h" #include "udev_version.h" #include "udev_dbus.h" +#include "logging.h" #include "namedev.h" #include "udevdb.h" #include "libsysfs/libsysfs.h" @@ -73,7 +74,7 @@ static int delete_node(struct udevice *dev) strncpy(filename, udev_root, sizeof(filename)); strncat(filename, dev->name, sizeof(filename)); - dbg("unlinking node '%s'", filename); + info("removing device node '%s'", filename); retval = unlink(filename); if (retval) { dbg("unlink(%s) failed with error '%s'", diff --git a/udev.c b/udev.c index b395be2abb..b872f42494 100644 --- a/udev.c +++ b/udev.c @@ -34,6 +34,7 @@ #include "udev.h" #include "udev_version.h" #include "udev_dbus.h" +#include "logging.h" #include "namedev.h" #include "udevdb.h" #include "libsysfs/libsysfs.h" diff --git a/udev.h b/udev.h index 678731c7d1..90aa823939 100644 --- a/udev.h +++ b/udev.h @@ -26,30 +26,6 @@ #include "libsysfs/libsysfs.h" #include -#ifdef DEBUG -#include -#define dbg(format, arg...) \ - do { \ - log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ - } while (0) -#else - #define dbg(format, arg...) do { } while (0) -#endif - -/* Parser needs it's own debugging statement, we usually don't care about this at all */ -#ifdef DEBUG_PARSER -#define dbg_parse(format, arg...) \ - do { \ - log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ - } while (0) -#else - #define dbg_parse(format, arg...) do { } while (0) -#endif - - -extern int log_message (int level, const char *format, ...) - __attribute__ ((format (printf, 2, 3))); - #define COMMENT_CHARACTER '#' #define NAME_SIZE 100 @@ -71,7 +47,6 @@ struct udevice { unsigned char program_result[NAME_SIZE]; unsigned char kernel_number[NAME_SIZE]; unsigned char kernel_name[NAME_SIZE]; - }; #define strfieldcpy(to, from) \ diff --git a/udev_config.c b/udev_config.c index 074bd7b35b..44b5767b85 100644 --- a/udev_config.c +++ b/udev_config.c @@ -34,6 +34,7 @@ #include "udev.h" #include "udev_version.h" +#include "logging.h" #include "namedev.h" #include "libsysfs/libsysfs.h" diff --git a/udevdb.c b/udevdb.c index 8d077ea94f..2d99f51d0e 100644 --- a/udevdb.c +++ b/udevdb.c @@ -35,6 +35,7 @@ #include "udev_version.h" #include "udev.h" +#include "logging.h" #include "namedev.h" #include "udevdb.h" #include "tdb/tdb.h" -- cgit v1.2.3-54-g00ecf From 0523018487a60ad817556af30632a212ad3351e0 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 15 Jan 2004 22:00:58 -0800 Subject: [PATCH] clean up the logging patch a bit to make the option more like the other options. Also documented it and added it to the .spec file. --- Makefile | 4 ++-- README | 22 ++++++++++++++++------ logging.h | 2 +- udev.spec | 9 +++++++++ 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 88c7cf0bc7..f19354fb05 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ # Set the following to control the use of syslog # Set it to `false' to remove all logging -LOG = true +USE_LOG = true # Set the following to `true' to log the debug # and make a unstripped, unoptimized binary. @@ -109,7 +109,7 @@ else CFLAGS+=-pipe endif -ifeq ($(strip $(LOG)),true) +ifeq ($(strip $(USE_LOG)),true) CFLAGS += -DLOG endif diff --git a/README b/README index 123fce6a1b..26032c35dc 100644 --- a/README +++ b/README @@ -30,18 +30,28 @@ To use: Note: There are a number of different flags that you can use when building udev. They are as follows: - prefix - set this to the default root that you want udev to be + prefix + set this to the default root that you want udev to be installed into. This works just like the 'configure --prefix' script does. Default value is ''. Only override this if you really know what you are doing. - USE_KLIBC - if set to 'true', udev is built and linked against the included - version of klibc. Default value is 'false'. - DEBUG - if set to 'true', debugging messages will be sent to the syslog - as udev is run. Default value is 'false'. - USE_DBUS - if set to 'true', DBUS messages will be sent everytime udev + USE_KLIBC + if set to 'true', udev is built and linked against the + included version of klibc. Default value is 'false'. + USE_LOG + if set to 'true', udev will emit messages to the syslog when + it creates or removes device nodes. This is helpful to see + what udev is doing. This is enabled by default. Note, if you + are building udev against klibc it is recommended that you + disable this option (due to klibc's syslog implementation.) + USE_DBUS + if set to 'true', DBUS messages will be sent everytime udev creates or removes a device node. This requires that DBUS development headers and libraries be present on your system to build properly. Default value is 'false'. + DEBUG + if set to 'true', debugging messages will be sent to the syslog + as udev is run. Default value is 'false'. So, if you want to build udev using klibc with debugging messages, you would do: diff --git a/logging.h b/logging.h index 85016ad328..1f2126839b 100644 --- a/logging.h +++ b/logging.h @@ -1,5 +1,5 @@ /* - * udev.h + * logging.h * * Userspace devfs * diff --git a/udev.spec b/udev.spec index 07331807ef..575e3cdf60 100644 --- a/udev.spec +++ b/udev.spec @@ -5,6 +5,12 @@ # it probably is not where you want it to be. %define klibc 1 +# if we want to have logging support in or not. +# 0 - no logging support +# 1 - logging support +# Note, it is not recommend if you use klibc to enable logging. +%define log 0 + # if we want to build DBUS support in or not. # 0 - no DBUS support # 1 - DBUS support @@ -45,6 +51,9 @@ make CC="gcc $RPM_OPT_FLAGS" \ %if %{klibc} USE_KLIBC=true \ %endif +%if %{log} + USE_LOG=true \ +%endif %if %{dbus} USE_DBUS=true \ %endif -- cgit v1.2.3-54-g00ecf From eb7a964a7c66e5aff8147026a60c99258454b612 Mon Sep 17 00:00:00 2001 From: "hannal@us.ibm.com" Date: Fri, 16 Jan 2004 00:22:56 -0800 Subject: [PATCH] small cut n paste error fix --- namedev_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev_parse.c b/namedev_parse.c index a17c02e395..546d767aed 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -324,7 +324,7 @@ int namedev_init_permissions(void) dbg("cannot parse line '%s'", line); continue; } - strncpy(dev.group, temp2, sizeof(dev.owner)); + strncpy(dev.group, temp2, sizeof(dev.group)); if (!temp) { dbg("cannot parse line: %s", line); -- cgit v1.2.3-54-g00ecf From e996d97835c8d0728a9d4880e9e1f8f285cadf4b Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Fri, 16 Jan 2004 22:03:50 -0800 Subject: [PATCH] update udev scsi_id to scsi_id 0.3 --- extras/scsi_id/ChangeLog | 39 ++++++++++++++++++++++++++--- extras/scsi_id/Makefile | 29 +++++++++++++++------- extras/scsi_id/README | 7 +----- extras/scsi_id/TODO | 2 +- extras/scsi_id/release-notes | 39 +++++++++++++++++++++++++++++ extras/scsi_id/scsi_id.c | 57 ++++++++++++++++++++----------------------- extras/scsi_id/scsi_id.config | 7 ++++-- extras/scsi_id/scsi_id.h | 21 ++++++---------- extras/scsi_id/scsi_serial.c | 21 ++++++++-------- 9 files changed, 147 insertions(+), 75 deletions(-) create mode 100644 extras/scsi_id/release-notes diff --git a/extras/scsi_id/ChangeLog b/extras/scsi_id/ChangeLog index 7f2317723d..7032dfd07f 100644 --- a/extras/scsi_id/ChangeLog +++ b/extras/scsi_id/ChangeLog @@ -1,3 +1,36 @@ +2004-jan-15: + * Makefile: Version 0.3 + +2004-jan-13: + * scsi_id.c, Makefile: Fix prefix usage with scsi_id.config. + +2004-jan-13: + * scsi_id.config: Clean up some comment entries. + +2004-jan-13: + * Makefile: Install the sample scsi_id.config file. + +2004-jan-13: + * Makefile: Use DESTDIR in all install/uninstall rules, per + problem reported by Svetoslav Slavtchev. + +2004-jan-12: + * scsi_id.h, scsi_id.c, scsi_serial.c: Fix to work with current + sysfs 0.4, based on patch from Dan Stekloff, but uses + sysfs_read_attribute_value instead of + sysfs_get_value_from_attributes. + +2004-jan-08: + * scsi_id.c: SYSFS_BUS_DIR was replaced with SYSFS_BUS_NAME. + +2004-jan-08: + * scsi_id.c: Must now use sysfs_open_class_device_path instead of the + previous sysfs_open_class_device. + +2003-dec-07: + * Makefile: patch from Olaf Hering remove DEBUG and + add --fno-builtin + 2003-dec-05: * Makefile, scsi_id.8: Add a man page. @@ -53,12 +86,12 @@ is no support for that in klibc. 2003-nov-17: - * scsi_id.c: Patch from Brian King: check result of setting model, - not vendor in per_dev_options. + * scsi_id.c: Patch from Brian King : check + result of setting model, not vendor in per_dev_options. 2003-nov-03: * scsi_id.c, scsi_serial.c: Use new and correct path to libsysfs.h. 2003-nov-03: - * scsi_id.h: Fix scsi_id.h so var args in marcros works ok with + * scsi_id.h: Fix scsi_id.h so var args in macros works ok with older gcc. diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index ead205682a..abf48895ad 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -14,9 +14,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.2 +SCSI_ID_VERSION=0.3 prefix = +etcdir = ${prefix}/etc sbindir = ${prefix}/sbin mandir = ${prefix}/usr/share/man @@ -27,7 +28,7 @@ INSTALL_DATA = ${INSTALL} -m 644 # Note some of the variables used here are set when built under udev, and # otherwise might not be set. -override CFLAGS+=-DSCSI_ID_VERSION=\"$(SCSI_ID_VERSION)\" $(DEBUG) -Wall +override CFLAGS+=-Wall -fno-builtin PROG=scsi_id SYSFS=-lsysfs @@ -39,25 +40,35 @@ SYSFS=-lsysfs # LDFLAGS=$(STRIP) LD=$(CC) -OBJS= scsi_id.o \ - scsi_serial.o \ +OBJS= scsi_id.o scsi_serial.o all: $(PROG) # XXX use a compressed man page? install: all - $(INSTALL_PROGRAM) -D $(PROG) $(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG) $(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 + @if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \ + echo $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir); \ + $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \ + fi uninstall: - -rm $(sbindir)/$(PROG) - -rm $(mandir)/man8/scsi_id.8 + -rm $(DESTDIR)$(sbindir)/$(PROG) + -rm $(DESTDIR)$(mandir)/man8/scsi_id.8 + -rm $(DESTDIR)$(etcdir)/scsi_id.config -$(OBJS): scsi_id.h scsi.h +GEN_HEADER=scsi_id_version.h + +scsi_id_version.h: + @echo "/* This file is auto-generated by the Makefile */" > $@ + @echo \#define SCSI_ID_VERSION \"$(SCSI_ID_VERSION)\" >> $@ + @echo \#define SCSI_ID_CONFIG_FILE \"$(etcdir)/scsi_id.config\" >> $@ +$(OBJS): scsi_id.h scsi.h scsi_id_version.h clean: - rm -f $(PROG) $(OBJS) + rm -f $(PROG) $(OBJS) $(GEN_HEADER) $(PROG): $(OBJS) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) diff --git a/extras/scsi_id/README b/extras/scsi_id/README index 4281c318a2..97af517304 100644 --- a/extras/scsi_id/README +++ b/extras/scsi_id/README @@ -7,12 +7,7 @@ Requires: - Linux kernel 2.6 - - libsysfs - -No man page yet. - -libsysfs 0_2_0 was not installing libsysfs.h or dlist.h, manually copy -those files to /usr/include/sys before compiling. + - sysfsutils 0.4 Build via make and make install. diff --git a/extras/scsi_id/TODO b/extras/scsi_id/TODO index 5d020c276a..dde5c84a67 100644 --- a/extras/scsi_id/TODO +++ b/extras/scsi_id/TODO @@ -1,4 +1,4 @@ -- add information abou the config file to the man page +- add information about the config file to the man page - change so non-KLIBC builds under udev don't use /usr/include/sysfs, but instead use the sysfs included with udev (needs udev change and/or diff --git a/extras/scsi_id/release-notes b/extras/scsi_id/release-notes new file mode 100644 index 0000000000..7ef12a25db --- /dev/null +++ b/extras/scsi_id/release-notes @@ -0,0 +1,39 @@ +Version 0.3 of scsi_id is available at: + +http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.3.tar.gz + +scsi_id is a program to generate a SCSI unique identifier for a given SCSI +device. + +It is primarily for use with udev callout config entries. It can also be +used for automatic multi-path configuration or device mapper configuration. + +Version 0.3 requires: + +- Linux kernel 2.6 +- libsysfs 0.4.0 + +Major changes since the last release: + + - Changes to work with libsysfs 0.4.0 + +All changes: + + - fix "prefix" usage for path to scsi_id.config + + - install the sample scsi_id.config file. + + - Use DESTDIR in all install/uninstall rules, per problem reported + by Svetoslav Slavtchev. + + - Fix to work with current sysfs 0.4, based on patch from Dan + Stekloff, but uses sysfs_read_attribute_value instead of + sysfs_get_value_from_attributes. + + - SYSFS_BUS_DIR was replaced with SYSFS_BUS_NAME. + + - Must now use sysfs_open_class_device_path instead of the + previous sysfs_open_class_device. + + - patch from Olaf Hering remove DEBUG and + add --fno-builtin diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 6bb41132de..75a342bb12 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -40,6 +40,7 @@ #else #include #endif +#include "scsi_id_version.h" #include "scsi_id.h" #ifndef SCSI_ID_VERSION @@ -53,8 +54,6 @@ #define TMP_DIR "/tmp" #define TMP_PREFIX "scsi" -#define CONFIG_FILE "/etc/scsi_id.config" - static const char short_options[] = "bc:d:ef:gip:s:vV"; /* * Just duplicate per dev options. @@ -67,7 +66,7 @@ static int all_good; static char *default_callout; static int dev_specified; static int sys_specified; -static char config_file[MAX_NAME_LEN] = CONFIG_FILE; +static char config_file[MAX_NAME_LEN] = SCSI_ID_CONFIG_FILE; static int display_bus_id; static int default_page_code; static int use_stderr; @@ -102,6 +101,18 @@ void log_message (int level, const char *format, ...) return; } +int sysfs_get_attr(const char *devpath, const char *attr, char *value, + size_t bufsize) +{ + char attr_path[SYSFS_PATH_MAX]; + + strncpy(attr_path, devpath, SYSFS_PATH_MAX); + strncat(attr_path, "/", SYSFS_PATH_MAX); + strncat(attr_path, attr, SYSFS_PATH_MAX); + dprintf("%s\n", attr_path); + return sysfs_read_attribute_value(attr_path, value, SYSFS_NAME_LEN); +} + static int sysfs_get_actual_dev(const char *sysfs_path, char *dev, int len) { dprintf("%s\n", sysfs_path); @@ -153,34 +164,22 @@ static int sysfs_is_bus(const char *sysfs_path, const char *bus) static int get_major_minor(const char *devpath, int *major, int *minor) { - struct sysfs_class_device *class_dev; - char dev_value[SYSFS_NAME_LEN]; - char *dev; - - dprintf("%s\n", devpath); - class_dev = sysfs_open_class_device_path(devpath); - if (!class_dev) { - log_message(LOG_WARNING, "open class %s failed: %s\n", devpath, - strerror(errno)); - return -1; - } + char dev_value[MAX_ATTR_LEN]; - dev = sysfs_get_attr(class_dev, "dev"); - if (dev) - strncpy(dev_value, dev, SYSFS_NAME_LEN); - sysfs_close_class_device(class_dev); - if (!dev) { + if (sysfs_get_attr(devpath, "dev", dev_value, MAX_ATTR_LEN)) { /* * XXX This happens a lot, since sg has no dev attr. - * Someday change this back to a LOG_WARNING. + * And now sysfsutils does not set a meaningful errno + * value. Someday change this back to a LOG_WARNING. + * And if sysfsutils changes, check for ENOENT and handle + * it separately. */ log_message(LOG_DEBUG, "%s could not get dev attribute: %s\n", devpath, strerror(errno)); return -1; } - dev = NULL; - dprintf("dev %s", dev_value); /* dev_value has a trailing \n */ + dprintf("dev value %s", dev_value); /* dev_value has a trailing \n */ if (sscanf(dev_value, "%u:%u", major, minor) != 2) { log_message(LOG_WARNING, "%s: invalid dev major/minor\n", devpath); @@ -547,8 +546,8 @@ static int per_dev_options(struct sysfs_class_device *scsi_dev, int *good_bad, int retval; int newargc; char **newargv = NULL; - char *vendor; - char *model; + char vendor[MAX_ATTR_LEN]; + char model[MAX_ATTR_LEN]; int option; *good_bad = all_good; @@ -558,16 +557,14 @@ static int per_dev_options(struct sysfs_class_device *scsi_dev, int *good_bad, else callout[0] = '\0'; - vendor = sysfs_get_attr(scsi_dev, "vendor"); - if (!vendor) { - log_message(LOG_WARNING, "%s: no vendor attribute\n", + if (sysfs_get_attr(scsi_dev->path, "vendor", vendor, MAX_ATTR_LEN)) { + log_message(LOG_WARNING, "%s: cannot get vendor attribute\n", scsi_dev->name); return -1; } - model = sysfs_get_attr(scsi_dev, "model"); - if (!model) { - log_message(LOG_WARNING, "%s: no model attribute\n", + if (sysfs_get_attr(scsi_dev->path, "model", model, MAX_ATTR_LEN)) { + log_message(LOG_WARNING, "%s: cannot get model attribute\n", scsi_dev->name); return -1; } diff --git a/extras/scsi_id/scsi_id.config b/extras/scsi_id/scsi_id.config index 4fdb89e28a..f3fc4b3fda 100644 --- a/extras/scsi_id/scsi_id.config +++ b/extras/scsi_id/scsi_id.config @@ -21,7 +21,9 @@ # vendor=string[,model=string],options= # -# If you normally don't need id's, black list everyone: +# If you normally don't need scsi id's, or might be attaching devices of +# an unknown functionality, black list everyone. This is the default +# behaviour (if no -b or -g is specified). # options=-b @@ -30,7 +32,8 @@ options=-b # vendor=someone, model=nicedrive, options=-g -# If you have all good devices on your system use, mark all as good: +# If you all the scsi devices are your system support valid id's, remove +# the -b line above, and mark all devices as good: ## options=-g diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index cb27e88a5f..573a2b60d7 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -27,6 +27,12 @@ #define MAX_NAME_LEN 72 #define OFFSET (2 * sizeof(unsigned int)) +/* + * MAX_ATTR_LEN: maximum length of the result of reading a sysfs + * attribute. + */ +#define MAX_ATTR_LEN 256 + /* * MAX_SERIAL_LEN: the maximum length of the serial number, including * added prefixes such as vendor and product (model) strings. @@ -39,19 +45,8 @@ */ #define MAX_BUFFER_LEN 256 -static inline char *sysfs_get_attr(struct sysfs_class_device *dev, - const char *attr) -{ - struct dlist *attributes = NULL; - - attributes = sysfs_get_classdev_attributes(dev); - - if (attributes == NULL) - return NULL; - - return sysfs_get_value_from_attributes(attributes, attr); -} - +extern int sysfs_get_attr(const char *devpath, const char *attr, char *value, + size_t bufsize); extern int scsi_get_serial (struct sysfs_class_device *scsi_dev, const char *devname, int page_code, char *serial, int len); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 18cd290817..80a1d51635 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -385,7 +385,7 @@ static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, char *buffer, int len) { int retval; - char *vendor; + char vendor[MAX_ATTR_LEN]; memset(buffer, 0, len); retval = scsi_inquiry(scsi_dev, fd, 1, 0x0, buffer, len); @@ -415,9 +415,10 @@ static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, * If the vendor id appears in the page assume the page is * invalid. */ - vendor = sysfs_get_attr(scsi_dev, "vendor"); - if (!vendor) { - log_message(LOG_WARNING, "%s: no vendor attribute\n", + if (sysfs_get_attr(scsi_dev->path, "vendor", vendor, + MAX_ATTR_LEN)) { + log_message(LOG_WARNING, + "%s: cannot get model attribute\n", scsi_dev->name); return 1; } @@ -437,12 +438,11 @@ static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, static int prepend_vendor_model(struct sysfs_class_device *scsi_dev, char *serial) { - char *attr; + char attr[MAX_ATTR_LEN]; int ind; - attr = sysfs_get_attr(scsi_dev, "vendor"); - if (!attr) { - log_message(LOG_WARNING, "%s: no vendor attribute\n", + if (sysfs_get_attr(scsi_dev->path, "vendor", attr, MAX_ATTR_LEN)) { + log_message(LOG_WARNING, "%s: cannot get vendor attribute\n", scsi_dev->name); return 1; } @@ -454,9 +454,8 @@ static int prepend_vendor_model(struct sysfs_class_device *scsi_dev, if (serial[ind] == '\n') serial[ind] = '\0'; - attr = sysfs_get_attr(scsi_dev, "model"); - if (!attr) { - log_message(LOG_WARNING, "%s: no model attribute\n", + if (sysfs_get_attr(scsi_dev->path, "model", attr, MAX_ATTR_LEN)) { + log_message(LOG_WARNING, "%s: cannot get model attribute\n", scsi_dev->name); return 1; } -- cgit v1.2.3-54-g00ecf From 778050914360dfb469817e12a1080bbf98422ef2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 19 Jan 2004 19:39:28 -0800 Subject: [PATCH] udev - kill %D from udev-test.pl Kill the two tests with %D. --- test/udev-test.pl | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 5e5756b660..b7013e4bde 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -261,24 +261,6 @@ EOF conf => < "devfs disk naming substitution", - subsys => "block", - devpath => "block/sda", - expected => "lun0/disc" , - conf => < "devfs disk naming substitution", - subsys => "block", - devpath => "block/sda/sda2", - expected => "lun0/part2" , - conf => < Date: Mon, 19 Jan 2004 19:40:32 -0800 Subject: [PATCH] udev - reverse user query options Here we get the ability to query with the name of the node instead of the device path. It uses a linear search over the whole database. kay@pim:~/src/udev.kay$ ./udev -q path -n video/webcam0 /class/video4linux/video0 New version, with better function return codes for error handling. --- udev.8 | 7 +++-- udev.c | 98 ++++++++++++++++++++++++++++++++++++++++++++-------------------- udevdb.c | 49 ++++++++++++++++++++++++++++---- udevdb.h | 3 +- 4 files changed, 117 insertions(+), 40 deletions(-) diff --git a/udev.8 b/udev.8 index 0421fee4e6..ff89e435ff 100644 --- a/udev.8 +++ b/udev.8 @@ -50,10 +50,13 @@ will be prepended. .BI -q " query_type" Query the database for specified value of a created device node. Valid types are: -.BR name ", " symlink ", " owner " or " group . +.BR name ", " symlink ", " owner " , " group " or " path. .TP .BI -p " sysfs_path" -Specify the sysfs path needed for the query. +Specify the sysfs path of the device to query. +.TP +.BI -n " name" +Specify the name of the node for the device to query. .TP .B -d Dump the whole database. diff --git a/udev.c b/udev.c index b872f42494..3b701ac26f 100644 --- a/udev.c +++ b/udev.c @@ -83,7 +83,8 @@ static inline char *get_seqnum(void) return seqnum; } -static void print_record(char *path, struct udevice *dev) +/* callback for database dump */ +static int print_record(char *path, struct udevice *dev) { printf("P: %s\n", path); printf("N: %s\n", dev->name); @@ -91,11 +92,13 @@ static void print_record(char *path, struct udevice *dev) printf("O: %s\n", dev->owner); printf("G: %s\n", dev->group); printf("\n"); + return 0; } enum query_type { NONE, NAME, + PATH, SYMLINK, OWNER, GROUP @@ -103,7 +106,7 @@ enum query_type { static inline int udev_user(int argc, char **argv) { - static const char short_options[] = "dp:q:rVh"; + static const char short_options[] = "dn:p:q:rVh"; int option; int retval = -EINVAL; struct udevice dev; @@ -111,6 +114,7 @@ static inline int udev_user(int argc, char **argv) enum query_type query = NONE; char result[NAME_SIZE] = ""; char path[NAME_SIZE] = ""; + char name[NAME_SIZE] = ""; /* get command line options */ while (1) { @@ -120,6 +124,11 @@ static inline int udev_user(int argc, char **argv) dbg("option '%c'", option); switch (option) { + case 'n': + dbg("udev name: %s\n", optarg); + strfieldcpy(name, optarg); + break; + case 'p': dbg("udev path: %s\n", optarg); strfieldcpy(path, optarg); @@ -148,6 +157,11 @@ static inline int udev_user(int argc, char **argv) break; } + if (strcmp(optarg, "path") == 0) { + query = PATH; + break; + } + printf("unknown query type\n"); return -EINVAL; @@ -161,7 +175,7 @@ static inline int udev_user(int argc, char **argv) printf("unable to open udev database\n"); return -EACCES; } - retval = udevdb_dump(print_record); + retval = udevdb_call_foreach(print_record); udevdb_exit(); return retval; @@ -179,44 +193,63 @@ static inline int udev_user(int argc, char **argv) /* process options */ if (query != NONE) { - if (path[0] == '\0') { - printf("query needs device path specified\n"); - return -EINVAL; - } - retval = udevdb_open_ro(); if (retval != 0) { printf("unable to open udev database\n"); return -EACCES; } - retval = udevdb_get_dev(path, &dev); - if (retval == 0) { - switch(query) { - case NAME: - if (root) + + if (path[0] != '\0') { + retval = udevdb_get_dev(path, &dev); + if (retval != 0) { + printf("device not found in database\n"); + goto exit; + } + goto print; + } + + if (name[0] != '\0') { + retval = udevdb_get_dev_byname(name, path, &dev); + if (retval != 0) { + printf("device not found in database\n"); + goto exit; + } + goto print; + } + + printf("query needs device path(-p) or node name(-n) specified\n"); + goto exit; + +print: + switch(query) { + case NAME: + if (root) strfieldcpy(result, udev_root); - strncat(result, dev.name, sizeof(result)); - break; + strncat(result, dev.name, sizeof(result)); + break; - case SYMLINK: - strfieldcpy(result, dev.symlink); - break; + case SYMLINK: + strfieldcpy(result, dev.symlink); + break; - case GROUP: - strfieldcpy(result, dev.group); - break; + case GROUP: + strfieldcpy(result, dev.group); + break; - case OWNER: - strfieldcpy(result, dev.owner); - break; + case OWNER: + strfieldcpy(result, dev.owner); + break; - default: - break; - } - printf("%s\n", result); - } else { - printf("device not found in udev database\n"); + case PATH: + strfieldcpy(result, path); + break; + + default: + goto exit; } + printf("%s\n", result); + +exit: udevdb_exit(); return retval; } @@ -227,13 +260,16 @@ static inline int udev_user(int argc, char **argv) } help: - printf("Usage: [-pqrdVh]\n" + printf("Usage: [-npqrdVh]\n" " -q TYPE query database for the specified value:\n" " 'name' name of device node\n" " 'symlink' pointing to node\n" " 'owner' of node\n" " 'group' of node\n" + " 'path' sysfs device path\n" " -p PATH sysfs device path used for query\n" + " -n NAME node name used for query\n" + "\n" " -r print udev root\n" " -d dump whole database\n" " -V print udev version\n" diff --git a/udevdb.c b/udevdb.c index 2d99f51d0e..c4e064fc11 100644 --- a/udevdb.c +++ b/udevdb.c @@ -143,25 +143,62 @@ int udevdb_open_ro(void) return 0; } -void (*user_record_callback) (char *path, struct udevice *dev); +static int (*user_record_callback) (char *path, struct udevice *dev); static int traverse_callback(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) { - user_record_callback((char*) key.dptr, (struct udevice*) dbuf.dptr); - return 0; + return user_record_callback((char*) key.dptr, (struct udevice*) dbuf.dptr); } /** - * udevdb_dump: dumps whole database by passing record data to user function + * udevdb_call_foreach: dumps whole database by passing record data to user function * @user_record_handler: user function called for every record in the database */ -int udevdb_dump(void (*user_record_handler) (char *path, struct udevice *dev)) +int udevdb_call_foreach(int (*user_record_handler) (char *path, struct udevice *dev)) { + int retval = 0; + if (user_record_handler == NULL) { dbg("invalid user record handling function"); return -EINVAL; } user_record_callback = user_record_handler; - tdb_traverse(udevdb, traverse_callback, NULL); + retval = tdb_traverse(udevdb, traverse_callback, NULL); + if (retval < 0) + return -ENODEV; + else + return 0; +} + +static struct udevice *find_dev; +static char *find_path; +static const char *find_name; +static int find_found; + +static int find_device_by_name(char *path, struct udevice *dev) +{ + if (strncmp(dev->name, find_name, sizeof(dev->name)) == 0) { + memcpy(find_dev, dev, sizeof(*find_dev)); + strncpy(find_path, path, NAME_SIZE); + find_found = 1; + /* stop search */ + return 1; + } return 0; } + +/** + * udevdb_get_dev_byname: search device with given name by traversing the whole database + */ +int udevdb_get_dev_byname(const char *name, char *path, struct udevice *dev) +{ + find_found = 0; + find_path = path; + find_dev = dev; + find_name = name; + udevdb_call_foreach(find_device_by_name); + if (find_found == 1) + return 0; + else + return -1; +} diff --git a/udevdb.h b/udevdb.h index a0e5338265..6eaeb25668 100644 --- a/udevdb.h +++ b/udevdb.h @@ -12,10 +12,11 @@ extern void udevdb_exit(void); extern int udevdb_init(int init_flag); extern int udevdb_open_ro(void); -extern int udevdb_dump(void (*user_record_handler) (char *path, struct udevice *dev)); +extern int udevdb_call_foreach(int (*user_record_handler) (char *path, struct udevice *dev)); extern int udevdb_add_dev(const char *path, const struct udevice *dev); extern int udevdb_get_dev(const char *path, struct udevice *dev); extern int udevdb_delete_dev(const char *path); +extern int udevdb_get_dev_byname(const char *name, char *path, struct udevice *dev); #endif /* _UDEVDB_H_ */ -- cgit v1.2.3-54-g00ecf From 74c73ef994f3ea8d013c33fe7be73e0c0c86977b Mon Sep 17 00:00:00 2001 From: "hannal@us.ibm.com" Date: Mon, 19 Jan 2004 19:42:42 -0800 Subject: [PATCH] set default owner/group in db. This patch fixes a bug where the udev database stored empty strings for Owner and Group if they were default. This patch stores the default value into the database if not set otherwise. See example output: crw------- 1 root root 4, 65 Jan 16 11:13 ttyS1 P: /class/tty/ttyS1 N: ttyS1 S: O: root G: root This is a bit of a hack. However, until udev supports setting the o/g values they will be root/root anyway so the database might as well reflect the truth instead of empty strings. --- namedev.c | 20 ++++++++++++++++++-- udev.h | 2 ++ udev_config.c | 4 ++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 137446e255..e39207e6a7 100644 --- a/namedev.c +++ b/namedev.c @@ -151,6 +151,22 @@ static mode_t get_default_mode(struct sysfs_class_device *class_dev) return mode; } +static char * get_default_owner(void) +{ + if (strlen(default_owner_str) == 0) { + strncpy(default_owner_str, "root", OWNER_SIZE); + } + return default_owner_str; +} + +static char * get_default_group(void) +{ + if (strlen(default_group_str) == 0) { + strncpy(default_group_str, "root", GROUP_SIZE); + } + return default_group_str; +} + static void apply_format(struct udevice *udev, unsigned char *string) { char temp[NAME_SIZE]; @@ -720,8 +736,8 @@ done: } else { /* no matching perms found :( */ udev->mode = get_default_mode(class_dev); - udev->owner[0] = 0x00; - udev->group[0] = 0x00; + strncpy(udev->owner, get_default_owner(), OWNER_SIZE); + strncpy(udev->group, get_default_group(), GROUP_SIZE); } dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", udev->name, udev->owner, udev->group, udev->mode); diff --git a/udev.h b/udev.h index 90aa823939..963f8d2516 100644 --- a/udev.h +++ b/udev.h @@ -68,5 +68,7 @@ extern char udev_permissions_filename[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; extern char default_mode_str[NAME_MAX]; +extern char default_owner_str[OWNER_SIZE]; +extern char default_group_str[GROUP_SIZE]; #endif diff --git a/udev_config.c b/udev_config.c index 44b5767b85..d262f2af07 100644 --- a/udev_config.c +++ b/udev_config.c @@ -46,6 +46,8 @@ char udev_permissions_filename[PATH_MAX+NAME_MAX]; char udev_rules_filename[PATH_MAX+NAME_MAX]; char udev_config_filename[PATH_MAX+NAME_MAX]; char default_mode_str[NAME_MAX]; +char default_owner_str[OWNER_SIZE]; +char default_group_str[GROUP_SIZE]; static void init_variables(void) @@ -117,6 +119,8 @@ static int parse_config_file(void) set_var("udev_rules", udev_rules_filename); set_var("udev_permissions", udev_permissions_filename); set_var("default_mode", default_mode_str); + set_var("default_owner", default_owner_str); + set_var("default_group", default_group_str); } dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, lineno, temp - line, temp); -- cgit v1.2.3-54-g00ecf From 765cbd97599d943adc73d03f4c91bd7cf7ef7fab Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 19 Jan 2004 19:44:24 -0800 Subject: [PATCH] set default owner/group in db - update I've edited the man page today, so this is alreay included :) Also a few more trivials: o added the defaults to udev.conf.in o removed class_dev from get_default_mode(), to match with Hanna's o changed size of mode_str to MODE_SIZE o changed a few char compares from from 0x00 to '\0' --- etc/udev/udev.conf.in | 10 +++++++++- namedev.c | 4 ++-- udev-add.c | 18 +++++++++--------- udev.8 | 18 ++++++++++++++++++ udev.h | 3 ++- udev_config.c | 2 +- 6 files changed, 41 insertions(+), 14 deletions(-) diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index d06b0b0698..f9a60ab3c8 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -17,7 +17,15 @@ udev_rules="/etc/udev/udev.rules" # udev_permissions - The name and location of the udev permission file udev_permissions="/etc/udev/udev.permissions" -# default_mode - set the default mode for all nodes that have no +# default_mode - set the default mode for all nodes that have no # explicit match in the permissions file default_mode="0600" +# default_owner - set the default owner for all nodes that have no +# explicit match in the permissions file +default_owner="root" + +# default_group - set the default group for all nodes that have no +# explicit match in the permissions file +default_group="root" + diff --git a/namedev.c b/namedev.c index e39207e6a7..7fd69f7778 100644 --- a/namedev.c +++ b/namedev.c @@ -141,7 +141,7 @@ static struct perm_device *find_perm(char *name) return NULL; } -static mode_t get_default_mode(struct sysfs_class_device *class_dev) +static mode_t get_default_mode(void) { mode_t mode = 0600; /* default to owner rw only */ @@ -735,7 +735,7 @@ done: strfieldcpy(udev->group, perm->group); } else { /* no matching perms found :( */ - udev->mode = get_default_mode(class_dev); + udev->mode = get_default_mode(); strncpy(udev->owner, get_default_owner(), OWNER_SIZE); strncpy(udev->group, get_default_group(), GROUP_SIZE); } diff --git a/udev-add.c b/udev-add.c index 9aa8bdb3e9..586911acc2 100644 --- a/udev-add.c +++ b/udev-add.c @@ -155,29 +155,29 @@ static int create_node(struct udevice *dev) dbg("chmod(%s, %#o) failed with error '%s'", filename, dev->mode, strerror(errno)); - if (*dev->owner) { + if (dev->owner[0]) { char *endptr; unsigned long id = strtoul(dev->owner, &endptr, 10); - if (*endptr == 0x00) + if (endptr[0] == '\0') uid = (uid_t) id; else { struct passwd *pw = getpwnam(dev->owner); - if (!pw) - dbg("user unknown '%s'", dev->owner); + if (pw == NULL) + dbg("specified user unknown '%s'", dev->owner); else uid = pw->pw_uid; } } - if (*dev->group) { + if (dev->group[0]) { char *endptr; unsigned long id = strtoul(dev->group, &endptr, 10); - if (*endptr == 0x00) + if (endptr[0] == '\0') gid = (gid_t) id; else { struct group *gr = getgrnam(dev->group); - if (!gr) - dbg("group unknown '%s'", dev->group); + if (gr == NULL) + dbg("specified group unknown '%s'", dev->group); else gid = gr->gr_gid; } @@ -192,7 +192,7 @@ static int create_node(struct udevice *dev) } /* create symlink if requested */ - if (*dev->symlink) { + if (dev->symlink[0]) { symlinks = dev->symlink; while (1) { linkname = strsep(&symlinks, " "); diff --git a/udev.8 b/udev.8 index ff89e435ff..9a597276c6 100644 --- a/udev.8 +++ b/udev.8 @@ -98,6 +98,16 @@ This is the location of the udev permission file. The default value for this is This is the default mode for all nodes that have no explicit match in the permissions file. The default value for this is .I 0666 +.TP +.B default_owner +This is the default owner for all nodes that have no explicit match in the +permissions file. The default value for this is +.I root +.TP +.B default_group +This is the default group for all nodes that have no explicit match in the +permissions file. The default value for this is +.I root .br .P .RI "A sample " udev.conf " might look like this: @@ -118,6 +128,14 @@ udev_permissions="/etc/udev/udev.permissions" # default_mode - set the default mode for all nodes that have no # explicit match in the permissions file default_mode="0666" + +# default_owner - set the default owner for all nodes that have no +# explicit match in the permissions file +default_owner="root" + +# default_group - set the default group for all nodes that have no +# explicit match in the permissions file +default_group="root" .fi .P The rules for udev to use when naming devices may specified at diff --git a/udev.h b/udev.h index 963f8d2516..e5c983a212 100644 --- a/udev.h +++ b/udev.h @@ -31,6 +31,7 @@ #define NAME_SIZE 100 #define OWNER_SIZE 30 #define GROUP_SIZE 30 +#define MODE_SIZE 8 struct udevice { char name[NAME_SIZE]; @@ -67,7 +68,7 @@ extern char udev_db_filename[PATH_MAX+NAME_MAX]; extern char udev_permissions_filename[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; -extern char default_mode_str[NAME_MAX]; +extern char default_mode_str[MODE_SIZE]; extern char default_owner_str[OWNER_SIZE]; extern char default_group_str[GROUP_SIZE]; diff --git a/udev_config.c b/udev_config.c index d262f2af07..e75ee3a346 100644 --- a/udev_config.c +++ b/udev_config.c @@ -45,7 +45,7 @@ char udev_db_filename[PATH_MAX+NAME_MAX]; char udev_permissions_filename[PATH_MAX+NAME_MAX]; char udev_rules_filename[PATH_MAX+NAME_MAX]; char udev_config_filename[PATH_MAX+NAME_MAX]; -char default_mode_str[NAME_MAX]; +char default_mode_str[MODE_SIZE]; char default_owner_str[OWNER_SIZE]; char default_group_str[GROUP_SIZE]; -- cgit v1.2.3-54-g00ecf From be9b51f6638d66025ebde1ca154ae9180383409c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 19 Jan 2004 19:46:26 -0800 Subject: [PATCH] udev - program to query all device attributes to build a rule On Sun, Jan 18, 2004 at 07:30:50AM +0100, Kay Sievers wrote: > Hi, > here is a small program to query all attributes of a device and > print these in the udev key format. It may help to get the keys to > define a rule. Fixed a typo - the sysfs_device is right now. USB FLash Reader: kay@pim:~/src/udev.kay$ extras/udevinfo/udevinfo /sys/block/sda/sda1 device '/sys/block/sda/sda1' has major:minor 8:1 looking at class device '/sys/block/sda/sda1': SYSFS_dev="8:1" SYSFS_start="32" SYSFS_size="160" SYSFS_stat=" 0 0 0 0" follow class device's "device" link '/sys/block/sda': BUS="scsi" ID="57:0:0:0" SYSFS_detach_state="0" SYSFS_type="0" SYSFS_device_blocked="0" SYSFS_queue_depth="1" SYSFS_scsi_level="3" SYSFS_vendor="SMSC " SYSFS_model="USB 2 HS-CF" SYSFS_rev="1.25" SYSFS_online="1" --- extras/udevinfo/Makefile | 14 +++++ extras/udevinfo/udevinfo.c | 132 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 146 insertions(+) create mode 100644 extras/udevinfo/Makefile create mode 100644 extras/udevinfo/udevinfo.c diff --git a/extras/udevinfo/Makefile b/extras/udevinfo/Makefile new file mode 100644 index 0000000000..f31c8c11e9 --- /dev/null +++ b/extras/udevinfo/Makefile @@ -0,0 +1,14 @@ +PROG=udevinfo +LD=$(CC) +OBJS=udevinfo.o + +all: $(PROG) + +clean: + rm -f $(PROG) $(OBJS) + +$(PROG): $(OBJS) + $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) + +me: + cd ../..; make EXTRAS=extras/udevinfo diff --git a/extras/udevinfo/udevinfo.c b/extras/udevinfo/udevinfo.c new file mode 100644 index 0000000000..4f229cd376 --- /dev/null +++ b/extras/udevinfo/udevinfo.c @@ -0,0 +1,132 @@ +/* + * udevinfo - fetches attributes for a device + * + * Copyright (C) 2004 Kay Sievers + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include + +#include "libsysfs.h" + + +# define VALUE_SIZE 200 + +char **main_argv; +char **main_envp; + +static int print_all_attributes(char *path) +{ + struct dlist *attributes; + struct sysfs_attribute *attr; + struct sysfs_directory *sysfs_dir; + char value[VALUE_SIZE]; + int len; + int retval = 0; + + sysfs_dir = sysfs_open_directory(path); + if (sysfs_dir == NULL) + return -1; + + attributes = sysfs_get_dir_attributes(sysfs_dir); + if (attributes == NULL) { + retval = -1; + goto exit; + } + + dlist_for_each_data(attributes, attr, struct sysfs_attribute) { + if (attr->value != NULL) { + strncpy(value, attr->value, VALUE_SIZE); + len = strlen(value); + if (value[len-1] == '\n') + value[len-1] = '\0'; + printf(" SYSFS_%s=\"%s\"\n", attr->name, value); + } + } + printf("\n"); + +exit: + sysfs_close_directory(sysfs_dir); + + return retval; +} + +int main(int argc, char **argv, char **envp) +{ + main_argv = argv; + main_envp = envp; + struct sysfs_class_device *class_dev; + struct sysfs_class_device *class_dev_parent; + struct sysfs_attribute *attr; + struct sysfs_device *sysfs_device; + char *path; + int retval = 0; + + if (argc != 2) { + printf("Usage: udevinfo \n"); + return -1; + } + path = argv[1]; + + /* get the class dev */ + class_dev = sysfs_open_class_device_path(path); + if (class_dev == NULL) { + printf("couldn't get the class device\n"); + return -1; + } + + /* read the 'dev' file for major/minor*/ + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr == NULL) { + printf("couldn't get the \"dev\" file\n"); + retval = -1; + goto exit; + } + printf("\ndevice '%s' has major:minor %s\n", class_dev->path, attr->value); + sysfs_close_attribute(attr); + + /* open sysfs class device directory and print all attributes */ + printf("looking at class device '%s':\n", class_dev->path); + if (print_all_attributes(class_dev->path) != 0) { + printf("couldn't open class device directory\n"); + retval = -1; + goto exit; + } + + /* get the device (if parent exists use it instead) */ + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent != NULL) { + //sysfs_close_class_device(class_dev); + class_dev = class_dev_parent; + } + sysfs_device = sysfs_get_classdev_device(class_dev); + if (sysfs_device != NULL) { + printf("follow class device's \"device\" link '%s':\n", class_dev->path); + printf(" BUS=\"%s\"\n", sysfs_device->bus); + printf(" ID=\"%s\"\n", sysfs_device->bus_id); + + /* open sysfs device directory and print all attributes */ + print_all_attributes(sysfs_device->path); + sysfs_close_device(sysfs_device); + } + +exit: + //sysfs_close_class_device(class_dev); + return retval; +} -- cgit v1.2.3-54-g00ecf From f10fec8197d9cc794f7f87cf9b14daaf414974d4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 19 Jan 2004 20:41:14 -0800 Subject: [PATCH] fixup logging.h to handle different logging options properly. Thanks to Olaf Hering for the error message. --- logging.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/logging.h b/logging.h index 1f2126839b..2d09b9a088 100644 --- a/logging.h +++ b/logging.h @@ -24,35 +24,37 @@ #ifndef LOGGING_H #define LOGGING_H +#define info(format, arg...) do { } while (0) +#define dbg(format, arg...) do { } while (0) +#define dbg_parse(format, arg...) do { } while (0) + #ifdef LOG #include + +#undef info #define info(format, arg...) \ do { \ log_message (LOG_INFO , format , ## arg); \ } while (0) -#else - #define info(format, arg...) do { } while (0) -#endif #ifdef DEBUG +#undef dbg #define dbg(format, arg...) \ do { \ log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ } while (0) -#else - #define dbg(format, arg...) do { } while (0) #endif /* Parser needs it's own debugging statement, we usually don't care about this at all */ #ifdef DEBUG_PARSER +#undef dbg_parse #define dbg_parse(format, arg...) \ do { \ log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ } while (0) -#else - #define dbg_parse(format, arg...) do { } while (0) #endif +#endif /* LOG */ extern int log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -- cgit v1.2.3-54-g00ecf From 069bd530124afe40453a5530b8bfa17b1b39989a Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Thu, 22 Jan 2004 00:16:28 -0800 Subject: [PATCH] udev-013/extras/multipath update incremental to 0.0.13, * update the DM target synthax to the 2.6.0-udm5 style * update the changelog and the doc to reflect minimal requirements --- extras/multipath/ChangeLog | 2 ++ extras/multipath/README | 4 +++- extras/multipath/main.c | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index a780865d3e..bb2f6baf89 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,3 +1,5 @@ +2004-01-19 multipath-013 + * update the DM target synthax to the 2.6.0-udm5 style 2003-12-29 multipath-012 * check hotplug event refers to a block device; if not exit early * refresh doc diff --git a/extras/multipath/README b/extras/multipath/README index 951c2788bc..417a0d38e4 100644 --- a/extras/multipath/README +++ b/extras/multipath/README @@ -4,8 +4,10 @@ Dependancies : o libdevmapper : comes with device-mapper-XXXX.tar.gz See www.sistina.com This lib has been dropped in the multipath tree -o libsysfs : comes with sysutils +o libsysfs : comes with sysutils or udev See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ +o Linux kernel 2.6.0 with udm5 patchset + http://people.sistina.com/~thornber/dm/ How it works : ============== diff --git a/extras/multipath/main.c b/extras/multipath/main.c index a8e29e8ba6..e18e049128 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -665,7 +665,7 @@ setup_map(struct env * conf, struct path * all_paths, if (all_paths[PINDEX(index,0)].iopolicy == MULTIBUS && !conf->forcedfailover ) { - params_p += sprintf(params_p, " %i %s %i %i", + params_p += sprintf(params_p, " 1 %i %s %i %i", dm_pg_prio, dm_ps_name, np, dm_ps_nr_args); for (i=0; i<=mp[index].npaths; i++) { @@ -678,6 +678,7 @@ setup_map(struct env * conf, struct path * all_paths, if (all_paths[PINDEX(index,0)].iopolicy == FAILOVER || conf->forcedfailover) { + params_p += sprintf(params_p, " %i", mp[index].npaths + 1); for (i=0; i<=mp[index].npaths; i++) { if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) continue; -- cgit v1.2.3-54-g00ecf From 267f534d1c809c31e0dcc9613953ecac45529038 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 22 Jan 2004 00:54:52 -0800 Subject: [PATCH] misc code cleanups. --- logging.h | 2 +- namedev.c | 19 +++++++++---------- namedev_parse.c | 4 +--- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/logging.h b/logging.h index 2d09b9a088..df5922b3e6 100644 --- a/logging.h +++ b/logging.h @@ -34,7 +34,7 @@ #undef info #define info(format, arg...) \ do { \ - log_message (LOG_INFO , format , ## arg); \ + log_message (LOG_INFO , format , ## arg); \ } while (0) #ifdef DEBUG diff --git a/namedev.c b/namedev.c index 7fd69f7778..e0d396e6ff 100644 --- a/namedev.c +++ b/namedev.c @@ -145,25 +145,25 @@ static mode_t get_default_mode(void) { mode_t mode = 0600; /* default to owner rw only */ - if (strlen(default_mode_str) != 0) { + if (strlen(default_mode_str) != 0) mode = strtol(default_mode_str, NULL, 8); - } + return mode; } -static char * get_default_owner(void) +static char *get_default_owner(void) { - if (strlen(default_owner_str) == 0) { + if (strlen(default_owner_str) == 0) strncpy(default_owner_str, "root", OWNER_SIZE); - } + return default_owner_str; } -static char * get_default_group(void) +static char *get_default_group(void) { - if (strlen(default_group_str) == 0) { + if (strlen(default_group_str) == 0) strncpy(default_group_str, "root", GROUP_SIZE); - } + return default_group_str; } @@ -563,10 +563,9 @@ device_found: * if needed */ if (sysfs_device) { - if (sysfs_device->bus[0] != '\0') goto bus_found; - + loop = 10; tspec.tv_nsec = 10000000; while (loop--) { diff --git a/namedev_parse.c b/namedev_parse.c index 546d767aed..b15be0e6fa 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -120,7 +120,6 @@ void dump_perm_dev_list(void) dump_perm_dev(dev); } - int namedev_init_rules(void) { char line[255]; @@ -345,6 +344,5 @@ int namedev_init_permissions(void) exit: fclose(fd); return retval; -} - +} -- cgit v1.2.3-54-g00ecf From f2ec8f1a7f1af707579d3cd85d440176e5180212 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 22 Jan 2004 01:06:18 -0800 Subject: [PATCH] 014 release --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4affadaf53..534fff49e9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Summary of changes from v013 to v014 +============================================ + +: + o libsysfs update for refresh + namedev.c changes + +: + o udev-013/extras/multipath update + +: + o minor patch for devfs rules + +Kay Sievers: + o udev - program to query all device attributes to build a rule + o set default owner/group in db - update + o udev - reverse user query options + o udev - kill %D from udev-test.pl + o add udev logging to info log + o udev - mention format string escape char in man page + +Greg Kroah-Hartman: + o misc code cleanups + o fixup logging.h to handle different logging options properly + o clean up the logging patch a bit to make the option more like the other options + o remove the %D modifier as it is not longer needed + o remove unneeded keyboard rule + o add usb_host and pci_bus to the class blacklist + o added input device rules to udev.rules and udev.rules.devfs + o 013_bk mark + o v013 release TAG: v013 + +Hanna V. Linder: + o set default owner/group in db + o small cut n paste error fix + +Patrick Mansfield: + o update udev scsi_id to scsi_id 0.3 + + Summary of changes from v012 to v013 ============================================ diff --git a/Makefile b/Makefile index f19354fb05..1bb9d878b3 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ USE_DBUS = false ROOT = udev -VERSION = 013_bk +VERSION = 014 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 575e3cdf60..89a9ee6c6a 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 013_bk +Version: 014 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From bb513a064ce00e8efca1c697955d4a34b6782c29 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 22 Jan 2004 21:04:54 -0800 Subject: [PATCH] 014_bk mark --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1bb9d878b3..8ff4dd1384 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,7 @@ USE_DBUS = false ROOT = udev -VERSION = 014 +VERSION = 014_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 89a9ee6c6a..8494143ec0 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 014 +Version: 014_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 724257d97b452dd563ea1a3a5cdc53b18e8dcb34 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 23 Jan 2004 00:21:13 -0800 Subject: [PATCH] add support for figuring out which device on the sysfs "chain" the rule applies to. This should fix one of the more annoying things to me about udev, and gets rid of a TODO item. --- namedev.c | 113 +++++++++++++++++++++++++++++++----------------------- test/udev-test.pl | 9 +++++ 2 files changed, 75 insertions(+), 47 deletions(-) diff --git a/namedev.c b/namedev.c index e0d396e6ff..6b1aa297ea 100644 --- a/namedev.c +++ b/namedev.c @@ -585,50 +585,19 @@ exit: return sysfs_device; } -int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) +static int match_rule(struct config_device *dev, struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { - struct sysfs_device *sysfs_device = NULL; - struct config_device *dev; - struct perm_device *perm; - char *pos; - - udev->mode = 0; - - /* find the sysfs_device associated with this class device */ - sysfs_device = get_sysfs_device(class_dev); - if (sysfs_device) { - dbg("sysfs_device->path='%s'", sysfs_device->path); - dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); - dbg("sysfs_device->bus='%s'", sysfs_device->bus); - strfieldcpy(udev->bus_id, sysfs_device->bus_id); - wait_for_device_to_initialize(sysfs_device); - } else { - dbg("class_dev->name = '%s'", class_dev->name); - } - - strfieldcpy(udev->kernel_name, class_dev->name); - - /* get kernel number */ - pos = class_dev->name + strlen(class_dev->name); - while (isdigit(*(pos-1))) - pos--; - strfieldcpy(udev->kernel_number, pos); - dbg("kernel_number='%s'", udev->kernel_number); - - /* look for a matching rule to apply */ - list_for_each_entry(dev, &config_device_list, node) { - dbg("process rule"); - + while (1) { /* check for matching bus value */ if (dev->bus[0] != '\0') { if (sysfs_device == NULL) { dbg("device has no bus"); - continue; + goto no_good; } dbg("check for " FIELD_BUS " dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcmp_pattern(dev->bus, sysfs_device->bus) != 0) { dbg(FIELD_BUS " is not matching"); - continue; + goto no_good; } else { dbg(FIELD_BUS " matches"); } @@ -639,7 +608,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", dev->kernel, class_dev->name); if (strcmp_pattern(dev->kernel, class_dev->name) != 0) { dbg(FIELD_KERNEL " is not matching"); - continue; + goto no_good; } else { dbg(FIELD_KERNEL " matches"); } @@ -650,7 +619,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud dbg("check " FIELD_ID); if (match_id(dev, class_dev, sysfs_device) != 0) { dbg(FIELD_ID " is not matching"); - continue; + goto no_good; } else { dbg(FIELD_ID " matches"); } @@ -661,7 +630,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud dbg("check " FIELD_PLACE); if (match_place(dev, class_dev, sysfs_device) != 0) { dbg(FIELD_PLACE " is not matching"); - continue; + goto no_good; } else { dbg(FIELD_PLACE " matches"); } @@ -672,7 +641,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud dbg("check " FIELD_SYSFS " pairs"); if (match_sysfs_pairs(dev, class_dev, sysfs_device) != 0) { dbg(FIELD_SYSFS " is not matching"); - continue; + goto no_good; } else { dbg(FIELD_SYSFS " matches"); } @@ -684,7 +653,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud apply_format(udev, dev->program); if (execute_program(dev->program, udev->program_result, NAME_SIZE) != 0) { dbg(FIELD_PROGRAM " returned nozero"); - continue; + goto no_good; } else { dbg(FIELD_PROGRAM " returned successful"); } @@ -697,7 +666,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud dev->result, udev->program_result); if (strcmp_pattern(dev->result, udev->program_result) != 0) { dbg(FIELD_RESULT " is not matching"); - continue; + goto no_good; } else { dbg(FIELD_RESULT " matches"); } @@ -709,12 +678,62 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud return -1; } - /* Yup, this rule belongs to us! */ - info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", - udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); - strfieldcpy(udev->name, dev->name); - strfieldcpy(udev->symlink, dev->symlink); - goto found; + /* Yeah, we matched! */ + return 0; + +no_good: + sysfs_device = sysfs_get_device_parent(sysfs_device); + if (sysfs_device == NULL) + return -ENODEV; + dbg("sysfs_device->path='%s'", sysfs_device->path); + dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); + dbg("sysfs_device->bus='%s'", sysfs_device->bus); + } + +} + +int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) +{ + struct sysfs_device *sysfs_device = NULL; + struct config_device *dev; + struct perm_device *perm; + char *pos; + + udev->mode = 0; + + /* find the sysfs_device associated with this class device */ + sysfs_device = get_sysfs_device(class_dev); + if (sysfs_device) { + dbg("sysfs_device->path='%s'", sysfs_device->path); + dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); + dbg("sysfs_device->bus='%s'", sysfs_device->bus); + strfieldcpy(udev->bus_id, sysfs_device->bus_id); + wait_for_device_to_initialize(sysfs_device); + } else { + dbg("class_dev->name = '%s'", class_dev->name); + } + + strfieldcpy(udev->kernel_name, class_dev->name); + + /* get kernel number */ + pos = class_dev->name + strlen(class_dev->name); + while (isdigit(*(pos-1))) + pos--; + strfieldcpy(udev->kernel_number, pos); + dbg("kernel_number='%s'", udev->kernel_number); + + /* look for a matching rule to apply */ + list_for_each_entry(dev, &config_device_list, node) { + dbg("process rule"); + + if (match_rule(dev, class_dev, udev, sysfs_device) == 0) { + /* Yup, this rule belongs to us! */ + info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", + udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); + strfieldcpy(udev->name, dev->name); + strfieldcpy(udev->symlink, dev->symlink); + goto found; + } } /* no rule was found so we use the kernel name */ diff --git a/test/udev-test.pl b/test/udev-test.pl index b7013e4bde..0700e53576 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -317,6 +317,15 @@ EOF expected => "second-0" , conf => < "sysfs parent heirachy", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor" , + conf => < Date: Fri, 23 Jan 2004 00:22:17 -0800 Subject: [PATCH] remove TODO item about BUS value, as it is now done. --- TODO | 5 ----- 1 file changed, 5 deletions(-) diff --git a/TODO b/TODO index 702d0d6b27..dffa809df9 100644 --- a/TODO +++ b/TODO @@ -25,8 +25,3 @@ greg@kroah.com - do early boot logic (putting udev into initramfs, handle pivot-root, etc.) - lots of other stuff... -- actually use the BUS= value to determine where the LABEL rule should look - (right now it's ignored, and we only look in the current sysfs directory.) - This is needed, for example, to look at the usb device's serial number of a - usb-storage device, instead of the scsi device's sysfs directory for the - serial number. -- cgit v1.2.3-54-g00ecf From 7fafc0324272731c5666047715b9f58f56761534 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 23 Jan 2004 00:28:57 -0800 Subject: [PATCH] spilt udev into pieces On Thu, Jan 22, 2004 at 01:27:45AM +0100, Kay Sievers wrote: > On Wed, Jan 21, 2004 at 02:38:25PM +0100, Kay Sievers wrote: > > On Thu, Jan 15, 2004 at 01:45:10PM -0800, Greg KH wrote: > > > On Thu, Jan 15, 2004 at 10:36:25PM +0800, Ling, Xiaofeng wrote: > > > > Hi, Greg > > > > I wrote a simple implementation for the two pieces > > > > of send and receive hotplug event, > > > > use a message queue and a list for the out of order > > > > hotplug event. It also has a timeout timer of 3 seconds. > > > > They are now separate program. the file nseq is the test script. > > > > Could you have a look to see wether it is feasible? > > > > If so, I'll continue to merge with udev. > > > > > > Yes, very nice start. Please continue on. > > > > > > One minor comment, please stick with the kernel coding style when you > > > are writing new code for udev. > > > > I took the code from Xiaofeng, cleaned the whitespace, renamed some bits, > > tweaked the debugging, added the udev exec and created a patch for the current tree. > > > > It seems functional now, by simply executing our current udev (dirty hack). > > It reorders the incoming events and if one is missing it delays the > > execution of the following ones up to a maximum of 10 seconds. > > > > Test script is included, but you can't mix hotplug sequence numbers and > > test script numbers, it will result in waiting for the missing numbers :) > > Hey, nobody want's to play with me? > So here I'm chatting with myself :) > > This is the next version with signal handling for resetting the expected > signal number. I changed the behaviour of the timeout to skip all > missing events at once and to proceed with the next event in the queue. > > So it's now possible to use the test script at any time, cause it resets > the daemon, if real hotplug event coming in later all missing nimbers will > be skipped after a timeout of 10 seconds and the queued events are applied. Here is the next updated updated version to apply to the lastet udev. I've added infrastructure for getting the state of the IPC queue in the sender and set the program to exec by the daemon. Also the magic key id is replaced by the usual key generation by path/nr. It looks promising, I use it on my machine and my 4in1 USB-flash-reader connect/disconnect emits the events "randomly" but udevd is able to reorder it and calls our normal udev in the right order. --- Makefile | 14 ++- test/udevd_test.sh | 47 ++++++++++ udevd.c | 255 +++++++++++++++++++++++++++++++++++++++++++++++++++++ udevd.h | 36 ++++++++ udevsend.c | 152 +++++++++++++++++++++++++++++++ 5 files changed, 502 insertions(+), 2 deletions(-) create mode 100644 test/udevd_test.sh create mode 100644 udevd.c create mode 100644 udevd.h create mode 100644 udevsend.c diff --git a/Makefile b/Makefile index 8ff4dd1384..0fd158a2c7 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,8 @@ USE_DBUS = false ROOT = udev +DAEMON = udevd +SENDER = udevsend VERSION = 014_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) @@ -155,7 +157,7 @@ endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) +all: $(ROOT) $(DAEMON) $(SENDER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ @@ -229,10 +231,18 @@ $(ROOT): $(OBJS) udev.h namedev.h udev_version.h udev_dbus.h udevdb.h klibc_fixu $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) +$(DAEMON): $(ROOT) udevd.h udevd.o + $(LD) $(LDFLAGS) -o $(DAEMON) $(CRT0) udevd.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $(ROOT) + +$(SENDER): $(ROOT) udevd.h udevsend.o + $(LD) $(LDFLAGS) -o $(SENDER) $(CRT0) udevsend.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $(ROOT) + clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(DAEMON) $(SENDER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ diff --git a/test/udevd_test.sh b/test/udevd_test.sh new file mode 100644 index 0000000000..013cdb9d6c --- /dev/null +++ b/test/udevd_test.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# reset udevd, expected sequence number and empty queue +killall -HUP udevd + +export ACTION=add +export DEVPATH=/block/sda + +export SEQNUM=1 +./udevsend block + +export SEQNUM=2 +./udevsend block + +export SEQNUM=3 +./udevsend block + +export SEQNUM=5 +./udevsend block + +export SEQNUM=4 +./udevsend block + +export SEQNUM=6 +./udevsend block + +export SEQNUM=7 +./udevsend block + +export SEQNUM=10 +./udevsend block + +export SEQNUM=9 +#./udevsend block + +export SEQNUM=8 +#./udevsend block + +export SEQNUM=13 +./udevsend block + +export SEQNUM=12 +./udevsend block + +export SEQNUM=11 +./udevsend block + diff --git a/udevd.c b/udevd.c new file mode 100644 index 0000000000..08dede36ee --- /dev/null +++ b/udevd.c @@ -0,0 +1,255 @@ +/* + * udevd.c + * + * Userspace devfs + * + * Copyright (C) 2004 Ling, Xiaofeng + * Copyright (C) 2004 Kay Sievers + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" +#include "logging.h" + +#define BUFFER_SIZE 1024 +#define TIMEOUT_SECONDS 10 + +static void reset_timer(void); +static void reset_queue(void); + + +static int expect_seqnum = 0; +static int timeout_value = TIMEOUT_SECONDS; +static int timeout = 0; +static struct hotplug_msg *head = NULL; +static char exec_program[100]; + +static void sig_handler(int signum) +{ + dbg("caught signal %d", signum); + switch (signum) { + case SIGHUP: + dbg("reset requested, all waiting events killed"); + reset_timer(); + reset_queue(); + timeout = 0; + expect_seqnum = 0; + break; + + case SIGINT: + case SIGTERM: + case SIGKILL: + exit(20 + signum); + break; + + default: + dbg("unhandled signal"); + } +} + +static void sig_alarmhandler(int signum) +{ + dbg("caught signal %d", signum); + switch (signum) { + case SIGALRM: + timeout = 1; + dbg("event timeout reached"); + break; + + default: + dbg("unhandled signal"); + } +} + +static void dump_queue(void) +{ + struct hotplug_msg *p; + p = head; + + dbg("next expected sequence is %d", expect_seqnum); + while(p) { + dbg("sequence %d in queue", p->seqnum); + p=p->next; + } +} + +static void dump_msg(struct hotplug_msg *pmsg) +{ + dbg("sequence %d, '%s', '%s', '%s'", + pmsg->seqnum, pmsg->action, pmsg->devpath, pmsg->subsystem); +} + +static void dispatch_msg(struct hotplug_msg *pmsg) +{ + dump_msg(pmsg); + dbg("exec '%s'", exec_program); + setenv("ACTION", pmsg->action, 1); + setenv("DEVPATH", pmsg->devpath, 1); + execl(exec_program, pmsg->subsystem); +} + +static void reset_timer(void) +{ + alarm(0); +} + +static void set_timer(void) +{ + signal(SIGALRM, sig_alarmhandler); + alarm(timeout_value); +} + +static void reset_queue(void) +{ + struct hotplug_msg *p; + p = head; + + while(head) { + p = head; + head = head->next; + free(p); + } +} + +static void check_queue(void) +{ + struct hotplug_msg *p; + p = head; + + dump_queue(); + while(head && head->seqnum == expect_seqnum) { + dispatch_msg(head); + expect_seqnum++; + p = head; + head = head->next; + free(p); + } + if (head != NULL) + set_timer(); + else + reset_timer(); +} + +static void add_queue(struct hotplug_msg *pmsg) +{ + struct hotplug_msg *pnewmsg; + struct hotplug_msg *p; + struct hotplug_msg *p1; + + p = head; + p1 = NULL; + pnewmsg = malloc(sizeof(struct hotplug_msg)); + *pnewmsg = *pmsg; + pnewmsg->next = NULL; + while(p && pmsg->seqnum > p->seqnum) { + p1 = p; + p = p->next; + } + pnewmsg->next = p; + if (p1 == NULL) { + head = pnewmsg; + } else { + p1->next = pnewmsg; + } + dump_queue(); +} + +static int process_queue(void) +{ + int msgid; + key_t key; + struct hotplug_msg *pmsg; + char buf[BUFFER_SIZE]; + int ret; + + key = ftok(DEFAULT_EXEC_PROGRAM, IPC_KEY_ID); + pmsg = (struct hotplug_msg *) buf; + msgid = msgget(key, IPC_CREAT); + if (msgid == -1) { + dbg("open message queue error"); + goto exit; + } + while (1) { + ret = msgrcv(msgid, (struct msgbuf *) buf, BUFFER_SIZE-4, HOTPLUGMSGTYPE, 0); + if (ret != -1) { + dbg("current sequence %d, expected sequence %d", pmsg->seqnum, expect_seqnum); + + /* init expected sequence with value from first call */ + if (expect_seqnum == 0) { + expect_seqnum = pmsg->seqnum; + dbg("init next expected sequence number to %d", expect_seqnum); + } + + if (pmsg->seqnum > expect_seqnum) { + add_queue(pmsg); + set_timer(); + } else { + if (pmsg->seqnum == expect_seqnum) { + dispatch_msg(pmsg); + expect_seqnum++; + check_queue(); + } else { + dbg("timeout event for unexpected sequence number %d", pmsg->seqnum); + } + } + } else + if (errno == EINTR) { + if (head != NULL) { + /* timeout, skip all missing, proceed with next queued event */ + dbg("timeout reached, skip events %d - %d", expect_seqnum, head->seqnum-1); + expect_seqnum = head->seqnum; + } + check_queue(); + timeout = 0; + } else { + dbg("ipc message receive error '%s'", strerror(errno)); + } + } + return 0; +exit: + return -1; +} + +int main(int argc, char *argv[]) +{ + /* get program to exec on events */ + if (argc == 2) + strncpy(exec_program, argv[1], sizeof(exec_program)); + else + strcpy(exec_program, DEFAULT_EXEC_PROGRAM); + + /* set up signal handler */ + signal(SIGINT, sig_handler); + signal(SIGTERM, sig_handler); + signal(SIGKILL, sig_handler); + signal(SIGHUP, sig_handler); + + /* main loop */ + process_queue(); + return 0; +} diff --git a/udevd.h b/udevd.h new file mode 100644 index 0000000000..eb516ab65d --- /dev/null +++ b/udevd.h @@ -0,0 +1,36 @@ +/* + * udevd.h + * + * Userspace devfs + * + * Copyright (C) 2004 Ling, Xiaofeng + * + * + * 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 02139, USA. + * + */ + +#define HOTPLUGMSGTYPE 44 +#define DEFAULT_EXEC_PROGRAM "/sbin/udev" +#define IPC_KEY_ID 0 + + +struct hotplug_msg { + long mtype; + struct hotplug_msg *next; + int seqnum; + char action[8]; + char devpath[128]; + char subsystem[16]; +}; diff --git a/udevsend.c b/udevsend.c new file mode 100644 index 0000000000..37afaf55fa --- /dev/null +++ b/udevsend.c @@ -0,0 +1,152 @@ +/* + * udevsend.c + * + * Userspace devfs + * + * Copyright (C) 2004 Ling, Xiaofeng + * Copyright (C) 2004 Kay Sievers + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" +#include "logging.h" + +static inline char *get_action(void) +{ + char *action; + + action = getenv("ACTION"); + return action; +} + +static inline char *get_devpath(void) +{ + char *devpath; + + devpath = getenv("DEVPATH"); + return devpath; +} + +static inline char *get_seqnum(void) +{ + char *seqnum; + + seqnum = getenv("SEQNUM"); + return seqnum; +} + +static int build_hotplugmsg(struct hotplug_msg **ppmsg, char *action, + char *devpath, char *subsystem, int seqnum) +{ + struct hotplug_msg *pmsg; + + pmsg = malloc(sizeof(struct hotplug_msg)); + pmsg->mtype = HOTPLUGMSGTYPE; + pmsg->seqnum = seqnum; + strncpy(pmsg->action, action, 8); + strncpy(pmsg->devpath, devpath, 128); + strncpy(pmsg->subsystem, subsystem, 16); + *ppmsg = pmsg; + return sizeof(struct hotplug_msg); +} + +static void free_hotplugmsg(struct hotplug_msg *pmsg) +{ + free(pmsg); +} + +int main(int argc, char* argv[]) +{ + int msgid; + key_t key; + struct msqid_ds msg_queue; + struct msgbuf *pmsg; + char *action; + char *devpath; + char *subsystem; + char *seqnum; + int seq; + int retval = -EINVAL; + int size; + + subsystem = argv[1]; + if (subsystem == NULL) { + dbg("no subsystem"); + goto exit; + } + + devpath = get_devpath(); + if (devpath == NULL) { + dbg("no devpath"); + goto exit; + } + + action = get_action(); + if (action == NULL) { + dbg("no action"); + goto exit; + } + + seqnum = get_seqnum(); + if (seqnum == NULL) { + dbg("no seqnum"); + goto exit; + } + + seq = atoi(seqnum); + key = ftok(DEFAULT_EXEC_PROGRAM, IPC_KEY_ID); + size = build_hotplugmsg( (struct hotplug_msg**) &pmsg, action, devpath, subsystem, seq); + msgid = msgget(key, IPC_CREAT); + if (msgid == -1) + { + dbg("open ipc queue error"); + goto exit; + } + + /* get state of queue */ + retval = msgctl(msgid, IPC_STAT, &msg_queue); + if (retval == -1) { + dbg("error getting info on ipc queue"); + goto exit; + } + if (msg_queue.msg_qnum > 0) + dbg("%li messages already in the ipc queue", msg_queue.msg_qnum); + + retval = msgsnd(msgid, pmsg, size, 0); + free_hotplugmsg( (struct hotplug_msg*) pmsg); + if (retval == -1) + { + dbg("send ipc message error"); + goto exit; + } + return 0; + +exit: + if (retval > 0) + retval = 0; + + return retval; +} -- cgit v1.2.3-54-g00ecf From 7b15897b464e246c7342b9bf2098fd5d91b64cca Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 23 Jan 2004 01:51:06 -0800 Subject: [PATCH] whitespace cleanups --- udevsend.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/udevsend.c b/udevsend.c index 37afaf55fa..1a897451c0 100644 --- a/udevsend.c +++ b/udevsend.c @@ -115,13 +115,12 @@ int main(int argc, char* argv[]) dbg("no seqnum"); goto exit; } - seq = atoi(seqnum); + key = ftok(DEFAULT_EXEC_PROGRAM, IPC_KEY_ID); size = build_hotplugmsg( (struct hotplug_msg**) &pmsg, action, devpath, subsystem, seq); msgid = msgget(key, IPC_CREAT); - if (msgid == -1) - { + if (msgid == -1) { dbg("open ipc queue error"); goto exit; } @@ -137,8 +136,7 @@ int main(int argc, char* argv[]) retval = msgsnd(msgid, pmsg, size, 0); free_hotplugmsg( (struct hotplug_msg*) pmsg); - if (retval == -1) - { + if (retval == -1) { dbg("send ipc message error"); goto exit; } -- cgit v1.2.3-54-g00ecf From 034f35d7e634d3900c32e58e791bf631f30a1e57 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 23 Jan 2004 03:01:02 -0800 Subject: [PATCH] udev - udevinfo with device chain walk udevinfo is now capable to print "all" attributes along the device chain of a sysfs device. Just like udev itself it walks the chain upwards and prints all usable attributes in the udev key format. So it should be easy to find unique attributes to compose a rule. All multiline attribute values and values containing non printable characters are skipped now. I hope nothing useful gets lost with this :) NOTE: The BUS value corresponding with the attributes is printed for every device. Don't specify BUS= in a rule and mix SYSFS_attributes from different busses, the rule can't match. ./udevinfo /sys/block/sda/sda1 device '/sys/block/sda/sda1' has major:minor 8:1 looking at class device '/sys/block/sda/sda1': SYSFS_dev="8:1" SYSFS_start="32" SYSFS_size="160" SYSFS_stat=" 0 0 0 0" follow the class device's "device" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/host32/32:0:0:0': BUS="scsi" ID="32:0:0:0" SYSFS_detach_state="0" SYSFS_type="0" SYSFS_model="USB 2 HS-CF" SYSFS_vendor="SMSC " SYSFS_max_sectors="240" SYSFS_device_blocked="0" SYSFS_queue_depth="1" SYSFS_scsi_level="3" SYSFS_rev="1.25" SYSFS_online="1" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0/host32': BUS="" ID="host32" SYSFS_detach_state="0" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3/1-1.3:1.0': BUS="usb" ID="1-1.3:1.0" SYSFS_detach_state="0" SYSFS_bInterfaceNumber="00" SYSFS_bAlternateSetting=" 0" SYSFS_bNumEndpoints="02" SYSFS_bInterfaceClass="08" SYSFS_bInterfaceSubClass="06" SYSFS_bInterfaceProtocol="50" SYSFS_iInterface="00" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.3': BUS="usb" ID="1-1.3" SYSFS_detach_state="0" SYSFS_bNumConfigurations="1" SYSFS_bNumInterfaces=" 1" SYSFS_bConfigurationValue="1" SYSFS_bmAttributes="80" SYSFS_bMaxPower=" 96mA" SYSFS_idVendor="0424" SYSFS_idProduct="20fc" SYSFS_bcdDevice="0125" SYSFS_bDeviceClass="00" SYSFS_bDeviceSubClass="00" SYSFS_bDeviceProtocol="00" SYSFS_speed="12" SYSFS_manufacturer="SMSC" SYSFS_product="USB 2 Flash Media Device" SYSFS_serial="0305037000C2" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-1': BUS="usb" ID="1-1" SYSFS_detach_state="0" SYSFS_bNumConfigurations="1" SYSFS_bNumInterfaces=" 1" SYSFS_bConfigurationValue="1" SYSFS_bmAttributes="e0" SYSFS_bMaxPower=" 64mA" SYSFS_idVendor="03eb" SYSFS_idProduct="3301" SYSFS_bcdDevice="0300" SYSFS_bDeviceClass="09" SYSFS_bDeviceSubClass="00" SYSFS_bDeviceProtocol="00" SYSFS_speed="12" SYSFS_product="Standard USB Hub" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0/usb1': BUS="usb" ID="usb1" SYSFS_detach_state="0" SYSFS_bNumConfigurations="1" SYSFS_bNumInterfaces=" 1" SYSFS_bConfigurationValue="1" SYSFS_bmAttributes="40" SYSFS_bMaxPower=" 0mA" SYSFS_idVendor="0000" SYSFS_idProduct="0000" SYSFS_bcdDevice="0206" SYSFS_bDeviceClass="09" SYSFS_bDeviceSubClass="00" SYSFS_bDeviceProtocol="00" SYSFS_speed="12" SYSFS_manufacturer="Linux 2.6.2-rc1-p4 uhci_hcd" SYSFS_product="UHCI Host Controller" SYSFS_serial="0000:00:1d.0" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1d.0': BUS="pci" ID="0000:00:1d.0" SYSFS_detach_state="0" SYSFS_vendor="0x8086" SYSFS_device="0x2482" SYSFS_subsystem_vendor="0x1014" SYSFS_subsystem_device="0x0220" SYSFS_class="0x0c0300" SYSFS_irq="9" looking at the device chain at '/sys/devices/pci0000:00': BUS="" ID="pci0000:00" SYSFS_detach_state="0" --- extras/udevinfo/udevinfo.c | 53 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/extras/udevinfo/udevinfo.c b/extras/udevinfo/udevinfo.c index 4f229cd376..c5934be2d4 100644 --- a/extras/udevinfo/udevinfo.c +++ b/extras/udevinfo/udevinfo.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "libsysfs.h" @@ -54,9 +55,23 @@ static int print_all_attributes(char *path) if (attr->value != NULL) { strncpy(value, attr->value, VALUE_SIZE); len = strlen(value); - if (value[len-1] == '\n') + if (len == 0) + continue; + + /* remove trailing newline */ + if (value[len-1] == '\n') { value[len-1] = '\0'; - printf(" SYSFS_%s=\"%s\"\n", attr->name, value); + len--; + } + + /* skip nonprintable values */ + while (len) { + if (isprint(value[len-1]) == 0) + break; + len--; + } + if (len == 0) + printf(" SYSFS_%s=\"%s\"\n", attr->name, value); } } printf("\n"); @@ -74,7 +89,8 @@ int main(int argc, char **argv, char **envp) struct sysfs_class_device *class_dev; struct sysfs_class_device *class_dev_parent; struct sysfs_attribute *attr; - struct sysfs_device *sysfs_device; + struct sysfs_device *sysfs_dev; + struct sysfs_device *sysfs_dev_parent; char *path; int retval = 0; @@ -98,33 +114,44 @@ int main(int argc, char **argv, char **envp) retval = -1; goto exit; } - printf("\ndevice '%s' has major:minor %s\n", class_dev->path, attr->value); + printf("\ndevice '%s' has major:minor %s", class_dev->path, attr->value); sysfs_close_attribute(attr); /* open sysfs class device directory and print all attributes */ - printf("looking at class device '%s':\n", class_dev->path); + printf(" looking at class device '%s':\n", class_dev->path); if (print_all_attributes(class_dev->path) != 0) { printf("couldn't open class device directory\n"); retval = -1; goto exit; } - /* get the device (if parent exists use it instead) */ + /* get the device link (if parent exists look here) */ class_dev_parent = sysfs_get_classdev_parent(class_dev); if (class_dev_parent != NULL) { //sysfs_close_class_device(class_dev); class_dev = class_dev_parent; } - sysfs_device = sysfs_get_classdev_device(class_dev); - if (sysfs_device != NULL) { - printf("follow class device's \"device\" link '%s':\n", class_dev->path); - printf(" BUS=\"%s\"\n", sysfs_device->bus); - printf(" ID=\"%s\"\n", sysfs_device->bus_id); + sysfs_dev = sysfs_get_classdev_device(class_dev); + if (sysfs_dev != NULL) + printf("follow the class device's \"device\"\n"); + + /* look the device chain upwards */ + while (sysfs_dev != NULL) { + printf(" looking at the device chain at '%s':\n", sysfs_dev->path); + printf(" BUS=\"%s\"\n", sysfs_dev->bus); + printf(" ID=\"%s\"\n", sysfs_dev->bus_id); /* open sysfs device directory and print all attributes */ - print_all_attributes(sysfs_device->path); - sysfs_close_device(sysfs_device); + print_all_attributes(sysfs_dev->path); + + sysfs_dev_parent = sysfs_get_device_parent(sysfs_dev); + if (sysfs_dev_parent == NULL) + break; + + //sysfs_close_device(sysfs_dev); + sysfs_dev = sysfs_dev_parent; } + sysfs_close_device(sysfs_dev); exit: //sysfs_close_class_device(class_dev); -- cgit v1.2.3-54-g00ecf From 90c210eb6bfc2ae294202fffb080315f3c47a57b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 23 Jan 2004 04:01:09 -0800 Subject: [PATCH] fix udevd exec Sorry, some code is missing. Here is a fix to make the exec functional. --- udevd.c | 33 +++++++++++++++++++++++++++++++-- udevsend.c | 8 +++++--- 2 files changed, 36 insertions(+), 5 deletions(-) diff --git a/udevd.c b/udevd.c index 08dede36ee..6af265a389 100644 --- a/udevd.c +++ b/udevd.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -49,6 +50,7 @@ static int timeout = 0; static struct hotplug_msg *head = NULL; static char exec_program[100]; + static void sig_handler(int signum) { dbg("caught signal %d", signum); @@ -104,13 +106,40 @@ static void dump_msg(struct hotplug_msg *pmsg) pmsg->seqnum, pmsg->action, pmsg->devpath, pmsg->subsystem); } -static void dispatch_msg(struct hotplug_msg *pmsg) +static int dispatch_msg(struct hotplug_msg *pmsg) { + pid_t pid; + char *argv[3]; + int retval; + extern char **environ; + dump_msg(pmsg); dbg("exec '%s'", exec_program); + setenv("ACTION", pmsg->action, 1); setenv("DEVPATH", pmsg->devpath, 1); - execl(exec_program, pmsg->subsystem); + + argv[0] = exec_program; + argv[1] = pmsg->subsystem; + argv[2] = NULL; + + pid = fork(); + switch (pid) { + case 0: + retval = execve(argv[0], argv, environ); + if (retval != 0) { + dbg("child execve failed"); + exit(1); + } + break; + case -1: + dbg("fork failed"); + return -1; + default: + wait(0); + break; + } + return 0; } static void reset_timer(void) diff --git a/udevsend.c b/udevsend.c index 1a897451c0..748c8f2217 100644 --- a/udevsend.c +++ b/udevsend.c @@ -117,15 +117,16 @@ int main(int argc, char* argv[]) } seq = atoi(seqnum); + /* create ipc message queue or get id of our existing one */ key = ftok(DEFAULT_EXEC_PROGRAM, IPC_KEY_ID); size = build_hotplugmsg( (struct hotplug_msg**) &pmsg, action, devpath, subsystem, seq); msgid = msgget(key, IPC_CREAT); if (msgid == -1) { - dbg("open ipc queue error"); + dbg("error open ipc queue"); goto exit; } - /* get state of queue */ + /* get state of ipc queue */ retval = msgctl(msgid, IPC_STAT, &msg_queue); if (retval == -1) { dbg("error getting info on ipc queue"); @@ -134,10 +135,11 @@ int main(int argc, char* argv[]) if (msg_queue.msg_qnum > 0) dbg("%li messages already in the ipc queue", msg_queue.msg_qnum); + /* send ipc message to the daemon */ retval = msgsnd(msgid, pmsg, size, 0); free_hotplugmsg( (struct hotplug_msg*) pmsg); if (retval == -1) { - dbg("send ipc message error"); + dbg("error sending ipc message"); goto exit; } return 0; -- cgit v1.2.3-54-g00ecf From 33db4b8da001242b8b3b0ce8a746ef46d4416d6d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 23 Jan 2004 21:25:17 -0800 Subject: [PATCH] udev - next round of udev event order daemon Here is the next round of udevd/udevsend: udevsend - If the IPC message we send is not catched by a receiver we fork the udevd daemon to process this and the following events udevd - We reorder the events we receive and execute our current udev for every event. If one or more events are missing, we wait 10 seconds and then go ahead in the queue. If the queue is empty and we don't receive any event for the next 30 seconds, the daemon exits. The next incoming event will fork the daemon again. config - The path's to the executable are specified in udevd.h Now they are pointing to the current directory only. I don't like daemons hiding secrets (and mem leaks :)) inside, so I want to try this model. It should be enough logic to get all possible hotplug events executed in the right order. If no event, then no daemon! So everybody should be happy :) Here we see: 1. the daemon fork, 2. the udev work, 3. the 10 sec timeout and the skipped events, 4. the udev work, ..., 5. and the 30 sec timeout and exit. EVENTS: pim:/home/kay/src/udev.kay# test/udevd_test.sh pim:/home/kay/src/udev.kay# SEQNUM=15 ./udevsend block pim:/home/kay/src/udev.kay# SEQNUM=16 ./udevsend block pim:/home/kay/src/udev.kay# SEQNUM=17 ./udevsend block pim:/home/kay/src/udev.kay# SEQNUM=18 ./udevsend block pim:/home/kay/src/udev.kay# SEQNUM=20 ./udevsend block pim:/home/kay/src/udev.kay# SEQNUM=21 ./udevsend block LOG: Jan 23 15:35:35 pim udev[11795]: message is still in the ipc queue, starting daemon... Jan 23 15:35:35 pim udev[11799]: configured rule in '/etc/udev/udev.rules' at line 19 applied, 'sda' becomes '%k-flash' Jan 23 15:35:35 pim udev[11799]: creating device node '/udev/sda-flash' Jan 23 15:35:35 pim udev[11800]: creating device node '/udev/sdb' Jan 23 15:35:35 pim udev[11804]: creating device node '/udev/sdc' Jan 23 15:35:35 pim udev[11805]: removing device node '/udev/sda-flash' Jan 23 15:35:35 pim udev[11808]: removing device node '/udev/sdb' Jan 23 15:35:35 pim udev[11809]: removing device node '/udev/sdc' Jan 23 15:35:45 pim udev[11797]: timeout reached, skip events 7 - 7 Jan 23 15:35:45 pim udev[11811]: creating device node '/udev/sdb' Jan 23 15:35:45 pim udev[11812]: creating device node '/udev/sdc' Jan 23 15:36:01 pim udev[11797]: timeout reached, skip events 10 - 14 Jan 23 15:36:01 pim udev[11814]: creating device node '/udev/sdc' Jan 23 15:36:04 pim udev[11816]: creating device node '/udev/sdc' Jan 23 15:36:12 pim udev[11818]: creating device node '/udev/sdc' Jan 23 15:36:16 pim udev[11820]: creating device node '/udev/sdc' Jan 23 15:36:38 pim udev[11797]: timeout reached, skip events 19 - 19 Jan 23 15:36:38 pim udev[11823]: creating device node '/udev/sdc' Jan 23 15:36:38 pim udev[11824]: creating device node '/udev/sdc' Jan 23 15:37:08 pim udev[11797]: we have nothing to do, so daemon exits... --- test/udevd_test.sh | 49 +++++++++++--------- udevd.c | 129 +++++++++++++++++++---------------------------------- udevd.h | 6 ++- udevsend.c | 71 +++++++++++++++++++++++------ 4 files changed, 133 insertions(+), 122 deletions(-) diff --git a/test/udevd_test.sh b/test/udevd_test.sh index 013cdb9d6c..0c7bd431be 100644 --- a/test/udevd_test.sh +++ b/test/udevd_test.sh @@ -1,47 +1,52 @@ #!/bin/bash -# reset udevd, expected sequence number and empty queue -killall -HUP udevd +# kill daemon, first event will start it again +killall udevd -export ACTION=add -export DEVPATH=/block/sda +# connect(123) - disconnect(456) - connect(789) sequence of sda/sdb/sdc export SEQNUM=1 +export ACTION=add +export DEVPATH=/block/sda ./udevsend block export SEQNUM=2 -./udevsend block - -export SEQNUM=3 -./udevsend block - -export SEQNUM=5 +export ACTION=add +export DEVPATH=/block/sdb ./udevsend block export SEQNUM=4 +export ACTION=remove +export DEVPATH=/block/sda ./udevsend block -export SEQNUM=6 +export SEQNUM=3 +export ACTION=add +export DEVPATH=/block/sdc ./udevsend block -export SEQNUM=7 +export SEQNUM=6 +export ACTION=remove +export DEVPATH=/block/sdc ./udevsend block -export SEQNUM=10 +export SEQNUM=5 +export ACTION=remove +export DEVPATH=/block/sdb ./udevsend block -export SEQNUM=9 -#./udevsend block - -export SEQNUM=8 +export SEQNUM=7 +export ACTION=add +export DEVPATH=/block/sda #./udevsend block -export SEQNUM=13 -./udevsend block - -export SEQNUM=12 +export SEQNUM=9 +export ACTION=add +export DEVPATH=/block/sdc ./udevsend block -export SEQNUM=11 +export SEQNUM=8 +export ACTION=add +export DEVPATH=/block/sdb ./udevsend block diff --git a/udevd.c b/udevd.c index 6af265a389..da887ec29b 100644 --- a/udevd.c +++ b/udevd.c @@ -37,49 +37,20 @@ #include "udevd.h" #include "logging.h" -#define BUFFER_SIZE 1024 -#define TIMEOUT_SECONDS 10 - -static void reset_timer(void); -static void reset_queue(void); +#define BUFFER_SIZE 1024 +#define EVENT_TIMEOUT_SECONDS 10 +#define DAEMON_TIMEOUT_SECONDS 30 static int expect_seqnum = 0; -static int timeout_value = TIMEOUT_SECONDS; -static int timeout = 0; static struct hotplug_msg *head = NULL; -static char exec_program[100]; - - -static void sig_handler(int signum) -{ - dbg("caught signal %d", signum); - switch (signum) { - case SIGHUP: - dbg("reset requested, all waiting events killed"); - reset_timer(); - reset_queue(); - timeout = 0; - expect_seqnum = 0; - break; - - case SIGINT: - case SIGTERM: - case SIGKILL: - exit(20 + signum); - break; - default: - dbg("unhandled signal"); - } -} static void sig_alarmhandler(int signum) { dbg("caught signal %d", signum); switch (signum) { case SIGALRM: - timeout = 1; dbg("event timeout reached"); break; @@ -94,9 +65,9 @@ static void dump_queue(void) p = head; dbg("next expected sequence is %d", expect_seqnum); - while(p) { + while(p != NULL) { dbg("sequence %d in queue", p->seqnum); - p=p->next; + p = p->next; } } @@ -110,59 +81,37 @@ static int dispatch_msg(struct hotplug_msg *pmsg) { pid_t pid; char *argv[3]; - int retval; extern char **environ; dump_msg(pmsg); - dbg("exec '%s'", exec_program); setenv("ACTION", pmsg->action, 1); setenv("DEVPATH", pmsg->devpath, 1); - - argv[0] = exec_program; + argv[0] = DEFAULT_UDEV_EXEC; argv[1] = pmsg->subsystem; argv[2] = NULL; pid = fork(); switch (pid) { case 0: - retval = execve(argv[0], argv, environ); - if (retval != 0) { - dbg("child execve failed"); - exit(1); - } + /* child */ + execve(argv[0], argv, environ); + dbg("exec of child failed"); + exit(1); break; case -1: - dbg("fork failed"); + dbg("fork of child failed"); return -1; default: wait(0); - break; } return 0; } -static void reset_timer(void) -{ - alarm(0); -} - -static void set_timer(void) +static void set_timer(int seconds) { signal(SIGALRM, sig_alarmhandler); - alarm(timeout_value); -} - -static void reset_queue(void) -{ - struct hotplug_msg *p; - p = head; - - while(head) { - p = head; - head = head->next; - free(p); - } + alarm(seconds); } static void check_queue(void) @@ -171,7 +120,7 @@ static void check_queue(void) p = head; dump_queue(); - while(head && head->seqnum == expect_seqnum) { + while(head != NULL && head->seqnum == expect_seqnum) { dispatch_msg(head); expect_seqnum++; p = head; @@ -179,9 +128,9 @@ static void check_queue(void) free(p); } if (head != NULL) - set_timer(); + set_timer(EVENT_TIMEOUT_SECONDS); else - reset_timer(); + set_timer(DAEMON_TIMEOUT_SECONDS); } static void add_queue(struct hotplug_msg *pmsg) @@ -195,7 +144,7 @@ static void add_queue(struct hotplug_msg *pmsg) pnewmsg = malloc(sizeof(struct hotplug_msg)); *pnewmsg = *pmsg; pnewmsg->next = NULL; - while(p && pmsg->seqnum > p->seqnum) { + while(p != NULL && pmsg->seqnum > p->seqnum) { p1 = p; p = p->next; } @@ -216,12 +165,12 @@ static int process_queue(void) char buf[BUFFER_SIZE]; int ret; - key = ftok(DEFAULT_EXEC_PROGRAM, IPC_KEY_ID); + key = ftok(DEFAULT_UDEVD_EXEC, IPC_KEY_ID); pmsg = (struct hotplug_msg *) buf; msgid = msgget(key, IPC_CREAT); if (msgid == -1) { dbg("open message queue error"); - goto exit; + return -1; } while (1) { ret = msgrcv(msgid, (struct msgbuf *) buf, BUFFER_SIZE-4, HOTPLUGMSGTYPE, 0); @@ -236,7 +185,7 @@ static int process_queue(void) if (pmsg->seqnum > expect_seqnum) { add_queue(pmsg); - set_timer(); + set_timer(EVENT_TIMEOUT_SECONDS); } else { if (pmsg->seqnum == expect_seqnum) { dispatch_msg(pmsg); @@ -246,37 +195,49 @@ static int process_queue(void) dbg("timeout event for unexpected sequence number %d", pmsg->seqnum); } } - } else + } else { if (errno == EINTR) { if (head != NULL) { - /* timeout, skip all missing, proceed with next queued event */ - dbg("timeout reached, skip events %d - %d", expect_seqnum, head->seqnum-1); + /* event timeout, skip all missing, proceed with next queued event */ + info("timeout reached, skip events %d - %d", expect_seqnum, head->seqnum-1); expect_seqnum = head->seqnum; + } else { + info("we have nothing to do, so daemon exits..."); + exit(0); } check_queue(); - timeout = 0; } else { dbg("ipc message receive error '%s'", strerror(errno)); } + } } return 0; -exit: - return -1; } -int main(int argc, char *argv[]) +static void sig_handler(int signum) { - /* get program to exec on events */ - if (argc == 2) - strncpy(exec_program, argv[1], sizeof(exec_program)); - else - strcpy(exec_program, DEFAULT_EXEC_PROGRAM); + dbg("caught signal %d", signum); + switch (signum) { + case SIGINT: + case SIGTERM: + case SIGKILL: + exit(20 + signum); + break; + + default: + dbg("unhandled signal"); + } +} +int main(int argc, char *argv[]) +{ /* set up signal handler */ signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); signal(SIGKILL, sig_handler); - signal(SIGHUP, sig_handler); + + /* we exit if we have nothing to do, next event will start us again */ + set_timer(DAEMON_TIMEOUT_SECONDS); /* main loop */ process_queue(); diff --git a/udevd.h b/udevd.h index eb516ab65d..43fe6b421a 100644 --- a/udevd.h +++ b/udevd.h @@ -21,9 +21,11 @@ * */ -#define HOTPLUGMSGTYPE 44 -#define DEFAULT_EXEC_PROGRAM "/sbin/udev" +#define DEFAULT_UDEV_EXEC "./udev" +#define DEFAULT_UDEVD_EXEC "./udevd" + #define IPC_KEY_ID 0 +#define HOTPLUGMSGTYPE 44 struct hotplug_msg { diff --git a/udevsend.c b/udevsend.c index 748c8f2217..d3e5378285 100644 --- a/udevsend.c +++ b/udevsend.c @@ -29,6 +29,9 @@ #include #include #include +#include +#include +#include #include "udev.h" #include "udevd.h" @@ -78,6 +81,39 @@ static void free_hotplugmsg(struct hotplug_msg *pmsg) free(pmsg); } +static int start_daemon(void) +{ + pid_t pid; + pid_t child_pid; + + pid = fork(); + switch (pid) { + case 0: + /* helper child */ + child_pid = fork(); + switch (child_pid) { + case 0: + /* daemon */ + execl(DEFAULT_UDEVD_EXEC, NULL); + dbg("exec of daemon failed"); + exit(1); + case -1: + dbg("fork of daemon failed"); + return -1; + default: + exit(0); + } + break; + case -1: + dbg("fork of helper failed"); + return -1; + default: + wait(0); + } + return 0; +} + + int main(int argc, char* argv[]) { int msgid; @@ -91,6 +127,8 @@ int main(int argc, char* argv[]) int seq; int retval = -EINVAL; int size; + int loop; + struct timespec tspec; subsystem = argv[1]; if (subsystem == NULL) { @@ -118,7 +156,7 @@ int main(int argc, char* argv[]) seq = atoi(seqnum); /* create ipc message queue or get id of our existing one */ - key = ftok(DEFAULT_EXEC_PROGRAM, IPC_KEY_ID); + key = ftok(DEFAULT_UDEVD_EXEC, IPC_KEY_ID); size = build_hotplugmsg( (struct hotplug_msg**) &pmsg, action, devpath, subsystem, seq); msgid = msgget(key, IPC_CREAT); if (msgid == -1) { @@ -126,15 +164,6 @@ int main(int argc, char* argv[]) goto exit; } - /* get state of ipc queue */ - retval = msgctl(msgid, IPC_STAT, &msg_queue); - if (retval == -1) { - dbg("error getting info on ipc queue"); - goto exit; - } - if (msg_queue.msg_qnum > 0) - dbg("%li messages already in the ipc queue", msg_queue.msg_qnum); - /* send ipc message to the daemon */ retval = msgsnd(msgid, pmsg, size, 0); free_hotplugmsg( (struct hotplug_msg*) pmsg); @@ -142,11 +171,25 @@ int main(int argc, char* argv[]) dbg("error sending ipc message"); goto exit; } - return 0; -exit: - if (retval > 0) - retval = 0; + /* get state of ipc queue */ + tspec.tv_sec = 0; + tspec.tv_nsec = 10000000; /* 10 millisec */ + loop = 20; + while (loop--) { + retval = msgctl(msgid, IPC_STAT, &msg_queue); + if (retval == -1) { + dbg("error getting info on ipc queue"); + goto exit; + } + if (msg_queue.msg_qnum == 0) + goto exit; + nanosleep(&tspec, NULL); + } + info("message is still in the ipc queue, starting daemon..."); + retval = start_daemon(); + +exit: return retval; } -- cgit v1.2.3-54-g00ecf From 71c077fb0a9f7222f5363ebc1c67d48d7a2f5ff8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 23 Jan 2004 21:43:37 -0800 Subject: [PATCH] udevsnd : clean up message creation logic a bit. --- udevsend.c | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/udevsend.c b/udevsend.c index d3e5378285..bdc8293df7 100644 --- a/udevsend.c +++ b/udevsend.c @@ -61,26 +61,17 @@ static inline char *get_seqnum(void) return seqnum; } -static int build_hotplugmsg(struct hotplug_msg **ppmsg, char *action, +static int build_hotplugmsg(struct hotplug_msg *msg, char *action, char *devpath, char *subsystem, int seqnum) { - struct hotplug_msg *pmsg; - - pmsg = malloc(sizeof(struct hotplug_msg)); - pmsg->mtype = HOTPLUGMSGTYPE; - pmsg->seqnum = seqnum; - strncpy(pmsg->action, action, 8); - strncpy(pmsg->devpath, devpath, 128); - strncpy(pmsg->subsystem, subsystem, 16); - *ppmsg = pmsg; + msg->mtype = HOTPLUGMSGTYPE; + msg->seqnum = seqnum; + strncpy(msg->action, action, 8); + strncpy(msg->devpath, devpath, 128); + strncpy(msg->subsystem, subsystem, 16); return sizeof(struct hotplug_msg); } -static void free_hotplugmsg(struct hotplug_msg *pmsg) -{ - free(pmsg); -} - static int start_daemon(void) { pid_t pid; @@ -118,8 +109,8 @@ int main(int argc, char* argv[]) { int msgid; key_t key; - struct msqid_ds msg_queue; - struct msgbuf *pmsg; + struct msqid_ds msg_queue; + struct hotplug_msg message; char *action; char *devpath; char *subsystem; @@ -157,7 +148,7 @@ int main(int argc, char* argv[]) /* create ipc message queue or get id of our existing one */ key = ftok(DEFAULT_UDEVD_EXEC, IPC_KEY_ID); - size = build_hotplugmsg( (struct hotplug_msg**) &pmsg, action, devpath, subsystem, seq); + size = build_hotplugmsg(&message, action, devpath, subsystem, seq); msgid = msgget(key, IPC_CREAT); if (msgid == -1) { dbg("error open ipc queue"); @@ -165,8 +156,7 @@ int main(int argc, char* argv[]) } /* send ipc message to the daemon */ - retval = msgsnd(msgid, pmsg, size, 0); - free_hotplugmsg( (struct hotplug_msg*) pmsg); + retval = msgsnd(msgid, &message, size, 0); if (retval == -1) { dbg("error sending ipc message"); goto exit; -- cgit v1.2.3-54-g00ecf From 305dd8b494d62168897313031293485ef4d085c2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 23 Jan 2004 22:25:24 -0800 Subject: [PATCH] new testd.block script for debugging. --- test/testd.block | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 test/testd.block diff --git a/test/testd.block b/test/testd.block new file mode 100644 index 0000000000..ca9ac8c1ac --- /dev/null +++ b/test/testd.block @@ -0,0 +1,36 @@ +#!/bin/bash +# +# test.block - run udev(8) on each block device in /sys/block + +if [ $# = "0" ] ; then + echo + echo "usage: $0 " + echo "where is \"add\" or \"remove\"" + echo + exit 1 +fi + +killall udevd + +SYSFSDIR=/sys # change this for a nonstand sysfs mount point +BIN=./udevsend # location of your udev binary +export ACTION=$1 # 'add' or 'remove' +seq=1 + +for i in ${SYSFSDIR}/block/*; do + # add each drive + export DEVPATH=${i#${SYSFSDIR}} + export SEQNUM=$seq + $BIN block + x=$((seq++)) + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${SYSFSDIR}} + export SEQNUM=$seq + $BIN block + x=$((seq++)) + fi + done +done -- cgit v1.2.3-54-g00ecf From 1c5c245e6f053da7ac147a1733ea49dd84f260a5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 23 Jan 2004 22:26:19 -0800 Subject: [PATCH] make udevd only have one instance running at a time it used a file lock right now. need to put that lock in the udev directory, it's in the current directory, which isn't a good thing... --- udevd.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/udevd.c b/udevd.c index da887ec29b..2e63d8030e 100644 --- a/udevd.c +++ b/udevd.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "udev.h" #include "udevd.h" @@ -157,6 +158,9 @@ static void add_queue(struct hotplug_msg *pmsg) dump_queue(); } +static int lock_file = -1; +static char *lock_filename = ".udevd_lock"; + static int process_queue(void) { int msgid; @@ -203,6 +207,10 @@ static int process_queue(void) expect_seqnum = head->seqnum; } else { info("we have nothing to do, so daemon exits..."); + if (lock_file >= 0) { + close(lock_file); + unlink(lock_filename); + } exit(0); } check_queue(); @@ -221,6 +229,10 @@ static void sig_handler(int signum) case SIGINT: case SIGTERM: case SIGKILL: + if (lock_file >= 0) { + close(lock_file); + unlink(lock_filename); + } exit(20 + signum); break; @@ -229,8 +241,35 @@ static void sig_handler(int signum) } } +static int one_and_only(void) +{ + char string[100]; + + lock_file = open(lock_filename, O_RDWR | O_CREAT, 0x640); + + /* see if we can open */ + if (lock_file < 0) + return -EINVAL; + + /* see if we can lock */ + if (lockf(lock_file, F_TLOCK, 0) < 0) { + close(lock_file); + unlink(lock_filename); + return -EINVAL; + } + + snprintf(string, sizeof(string), "%d\n", getpid()); + write(lock_file, string, strlen(string)); + + return 0; +} + int main(int argc, char *argv[]) { + /* only let one version of the daemon run at any one time */ + if (one_and_only() != 0) + exit(0); + /* set up signal handler */ signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); -- cgit v1.2.3-54-g00ecf From 25f8a5ad642e4338dacaf892e4ad47577c1cbf11 Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Fri, 23 Jan 2004 22:54:55 -0800 Subject: [PATCH] LFS init script update --- etc/init.d/udev.init.lfs | 100 ++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 54 deletions(-) diff --git a/etc/init.d/udev.init.lfs b/etc/init.d/udev.init.lfs index 08c81733e1..c738369081 100644 --- a/etc/init.d/udev.init.lfs +++ b/etc/init.d/udev.init.lfs @@ -2,83 +2,75 @@ # # LinuxFromScratch udev init script # derived from original RedHat udev init script -# 2003 by Michael Buesch +# 2003, 2004 by Michael Buesch # source /etc/sysconfig/rc source $rc_functions +source /etc/udev/udev.conf -udev_dir="/udev" sysfs_dir="/sys" bin="/sbin/udev" + +run_udev () +{ + # handle block devices and their partitions + for i in ${sysfs_dir}/block/*; do + # add each drive + export DEVPATH=${i#${sysfs_dir}} + $bin block & + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${sysfs_dir}} + $bin block & + fi + done + done + # all other device classes + for i in ${sysfs_dir}/class/*; do + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${sysfs_dir}} + CLASS=`echo ${i#${sysfs_dir}} | \ + cut --delimiter='/' --fields=3-` + $bin $CLASS & + fi + done + done + return 0 +} + case "$1" in start) echo "Creating initial udev device nodes ..." - if [ ! -d $udev_dir ]; then - mkdir $udev_dir - if [ $? -ne 0 ]; then - print_status failure - exit 1 - fi - fi if [ ! -d $sysfs_dir ]; then echo "sysfs_dir $sysfs_dir does not exist!" print_status failure exit 1 fi + if [ ! -d $udev_root ]; then + mkdir $udev_root + if [ $? -ne 0 ]; then + print_status failure + exit 1 + fi + fi + # propogate /udev from /sys - we only need this while we do not # have initramfs and an early user-space with which to do early # device bring up - clean_exit="yes" export ACTION=add - # add block devices and their partitions - for i in ${sysfs_dir}/block/*; do - # add each drive - export DEVPATH=${i#${sysfs_dir}} - $bin block - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - $bin block - if [ $? -ne 0 ]; then - echo "Warning: $DEVPATH failed." - clean_exit="no" - fi - fi - done - done - # all other device classes - for i in ${sysfs_dir}/class/*; do - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - CLASS=`echo ${i#${sysfs_dir}} | \ - cut --delimiter='/' --fields=3-` - $bin $CLASS - if [ $? -ne 0 ]; then - echo "Warning: $DEVPATH failed." - clean_exit="no" - fi - fi - done - done - if [ $clean_exit = "yes" ]; then - print_status success - else - print_status warning - fi + run_udev + evaluate_retval ;; stop) echo "Removing udev device nodes ..." - # be careful - if [ $udev_dir -a "$udev_dir" != "/" ]; then - # clear out /udev - rm -rf ${udev_dir}/* - evaluate_retval - fi + export ACTION=remove + run_udev + evaluate_retval ;; reload) # nothing to do here -- cgit v1.2.3-54-g00ecf From eea34a0e9909405467185bb1e5291e6cc88fd0bc Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 18:10:53 -0800 Subject: [PATCH] clean up compiler warnings if building using klibc. --- Makefile | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 0fd158a2c7..30ebd45eed 100644 --- a/Makefile +++ b/Makefile @@ -94,7 +94,7 @@ OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2> then echo "-Os"; else echo "-O2" ; fi} # add -Wredundant-decls when libsysfs gets cleaned up -WARNINGS := -Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations +WARNINGS := -Wall # Some nice architecture specific optimizations ifeq ($(strip $(TARGET_ARCH)),arm) @@ -117,11 +117,11 @@ endif # if DEBUG is enabled, then we do not strip or optimize ifeq ($(strip $(DEBUG)),true) - CFLAGS += $(WARNINGS) -O1 -g -DDEBUG -D_GNU_SOURCE + CFLAGS += -O1 -g -DDEBUG -D_GNU_SOURCE LDFLAGS += -Wl,-warn-common STRIPCMD = /bin/true -Since_we_are_debugging else - CFLAGS += $(WARNINGS) $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE + CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE LDFLAGS += -s -Wl,-warn-common STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment endif @@ -142,15 +142,20 @@ ifeq ($(strip $(USE_KLIBC)),true) CRT0 = $(KLIBC_DIR)/crt0.o LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) - CFLAGS += -nostdinc -I$(INCLUDE_DIR) -I$(KLIBC_DIR)/arch/$(ARCH)/include \ - -I$(INCLUDE_DIR)/bits$(BITSIZE) -I$(GCCINCDIR) -I$(LINUX_INCLUDE_DIR) \ - -D__KLIBC__ -fno-builtin-printf + CFLAGS += $(WARNINGS) -nostdinc \ + -D__KLIBC__ -fno-builtin-printf \ + -I$(INCLUDE_DIR) \ + -I$(KLIBC_DIR)/arch/$(ARCH)/include \ + -I$(INCLUDE_DIR)/bits$(BITSIZE) \ + -I$(GCCINCDIR) \ + -I$(LINUX_INCLUDE_DIR) LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs else + WARNINGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations CRT0 = LIBC = - CFLAGS += -I$(GCCINCDIR) + CFLAGS += $(WARNINGS) -I$(GCCINCDIR) LIB_OBJS = -lc LDFLAGS = endif -- cgit v1.2.3-54-g00ecf From a695feaeff0551745e1a397be2daa61b8cd0cc42 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 26 Jan 2004 18:19:33 -0800 Subject: [PATCH] udevd - cleanup and better timeout handling Here is the next revision for udevd: o Small cleanups all over the place. o Swich to the usual linked list format "list.h". o Better timeout handling. We store a timestamp in in every queued event, so we don't wait longer than the timeout specified, if the hole in the list is not shrinking. o ignore udevd target if klibc is used --- Makefile | 8 ++- udevd.c | 231 ++++++++++++++++++++++++++++++------------------------------- udevd.h | 15 ++-- udevsend.c | 10 +-- 4 files changed, 133 insertions(+), 131 deletions(-) diff --git a/Makefile b/Makefile index 30ebd45eed..5c265492b4 100644 --- a/Makefile +++ b/Makefile @@ -151,6 +151,7 @@ ifeq ($(strip $(USE_KLIBC)),true) -I$(LINUX_INCLUDE_DIR) LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs + UDEVD = else WARNINGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations CRT0 = @@ -158,11 +159,12 @@ else CFLAGS += $(WARNINGS) -I$(GCCINCDIR) LIB_OBJS = -lc LDFLAGS = + UDEVD = $(DAEMON) $(SENDER) endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(DAEMON) $(SENDER) +all: $(ROOT) $(UDEVD) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ @@ -236,11 +238,11 @@ $(ROOT): $(OBJS) udev.h namedev.h udev_version.h udev_dbus.h udevdb.h klibc_fixu $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) -$(DAEMON): $(ROOT) udevd.h udevd.o +$(DAEMON): udevd.h udevd.o udevd.o logging.o $(LD) $(LDFLAGS) -o $(DAEMON) $(CRT0) udevd.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) -$(SENDER): $(ROOT) udevd.h udevsend.o +$(SENDER): udevd.h udevsend.o udevd.o logging.o $(LD) $(LDFLAGS) -o $(SENDER) $(CRT0) udevsend.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $(ROOT) diff --git a/udevd.c b/udevd.c index 2e63d8030e..26e6b23486 100644 --- a/udevd.c +++ b/udevd.c @@ -22,6 +22,7 @@ * */ +#include #include #include #include @@ -32,29 +33,38 @@ #include #include #include +#include #include +#include "list.h" #include "udev.h" #include "udevd.h" #include "logging.h" #define BUFFER_SIZE 1024 -#define EVENT_TIMEOUT_SECONDS 10 -#define DAEMON_TIMEOUT_SECONDS 30 - static int expect_seqnum = 0; -static struct hotplug_msg *head = NULL; +static int lock_file = -1; +static char *lock_filename = ".udevd_lock"; +LIST_HEAD(msg_list); -static void sig_alarmhandler(int signum) +static void sig_handler(int signum) { dbg("caught signal %d", signum); switch (signum) { case SIGALRM: dbg("event timeout reached"); break; - + case SIGINT: + case SIGTERM: + case SIGKILL: + if (lock_file >= 0) { + close(lock_file); + unlink(lock_filename); + } + exit(20 + signum); + break; default: dbg("unhandled signal"); } @@ -62,41 +72,32 @@ static void sig_alarmhandler(int signum) static void dump_queue(void) { - struct hotplug_msg *p; - p = head; + struct hotplug_msg *msg; - dbg("next expected sequence is %d", expect_seqnum); - while(p != NULL) { - dbg("sequence %d in queue", p->seqnum); - p = p->next; - } + list_for_each_entry(msg, &msg_list, list) + dbg("sequence %d in queue", msg->seqnum); } -static void dump_msg(struct hotplug_msg *pmsg) +static void dump_msg(struct hotplug_msg *msg) { dbg("sequence %d, '%s', '%s', '%s'", - pmsg->seqnum, pmsg->action, pmsg->devpath, pmsg->subsystem); + msg->seqnum, msg->action, msg->devpath, msg->subsystem); } -static int dispatch_msg(struct hotplug_msg *pmsg) +static int dispatch_msg(struct hotplug_msg *msg) { pid_t pid; - char *argv[3]; - extern char **environ; - dump_msg(pmsg); + dump_msg(msg); - setenv("ACTION", pmsg->action, 1); - setenv("DEVPATH", pmsg->devpath, 1); - argv[0] = DEFAULT_UDEV_EXEC; - argv[1] = pmsg->subsystem; - argv[2] = NULL; + setenv("ACTION", msg->action, 1); + setenv("DEVPATH", msg->devpath, 1); pid = fork(); switch (pid) { case 0: /* child */ - execve(argv[0], argv, environ); + execl(UDEV_EXEC, "udev", msg->subsystem, NULL); dbg("exec of child failed"); exit(1); break; @@ -104,108 +105,119 @@ static int dispatch_msg(struct hotplug_msg *pmsg) dbg("fork of child failed"); return -1; default: - wait(0); + wait(NULL); } return 0; } -static void set_timer(int seconds) +static void set_timeout(int seconds) { - signal(SIGALRM, sig_alarmhandler); alarm(seconds); + dbg("set timeout in %d seconds", seconds); } static void check_queue(void) { - struct hotplug_msg *p; - p = head; - - dump_queue(); - while(head != NULL && head->seqnum == expect_seqnum) { - dispatch_msg(head); + struct hotplug_msg *msg; + struct hotplug_msg *tmp_msg; + time_t msg_age; + +recheck: + /* dispatch events until one is missing */ + list_for_each_entry_safe(msg, tmp_msg, &msg_list, list) { + if (msg->seqnum != expect_seqnum) + break; + dispatch_msg(msg); expect_seqnum++; - p = head; - head = head->next; - free(p); + list_del_init(&msg->list); + free(msg); + } + + /* recalculate timeout */ + if (list_empty(&msg_list) == 0) { + msg_age = time(NULL) - msg->queue_time; + if (msg_age > EVENT_TIMEOUT_SECONDS-1) { + info("event %d, age %li seconds, skip event %d-%d", + msg->seqnum, msg_age, expect_seqnum, msg->seqnum-1); + expect_seqnum = msg->seqnum; + goto recheck; + } + set_timeout(EVENT_TIMEOUT_SECONDS - msg_age); + return; } - if (head != NULL) - set_timer(EVENT_TIMEOUT_SECONDS); - else - set_timer(DAEMON_TIMEOUT_SECONDS); + + /* queue is empty */ + set_timeout(UDEVD_TIMEOUT_SECONDS); } -static void add_queue(struct hotplug_msg *pmsg) +static int queue_msg(struct hotplug_msg *msg) { - struct hotplug_msg *pnewmsg; - struct hotplug_msg *p; - struct hotplug_msg *p1; - - p = head; - p1 = NULL; - pnewmsg = malloc(sizeof(struct hotplug_msg)); - *pnewmsg = *pmsg; - pnewmsg->next = NULL; - while(p != NULL && pmsg->seqnum > p->seqnum) { - p1 = p; - p = p->next; - } - pnewmsg->next = p; - if (p1 == NULL) { - head = pnewmsg; - } else { - p1->next = pnewmsg; + struct hotplug_msg *new_msg; + struct hotplug_msg *tmp_msg; + + new_msg = malloc(sizeof(*new_msg)); + if (new_msg == NULL) { + dbg("error malloc"); + return -ENOMEM; } - dump_queue(); -} + memcpy(new_msg, msg, sizeof(*new_msg)); -static int lock_file = -1; -static char *lock_filename = ".udevd_lock"; + /* store timestamp of queuing */ + new_msg->queue_time = time(NULL); + + /* sort message by sequence number into list*/ + list_for_each_entry(tmp_msg, &msg_list, list) + if (tmp_msg->seqnum > new_msg->seqnum) + break; + list_add_tail(&new_msg->list, &tmp_msg->list); + + return 0; +} -static int process_queue(void) +static void work(void) { + struct hotplug_msg *msg; int msgid; key_t key; - struct hotplug_msg *pmsg; char buf[BUFFER_SIZE]; int ret; - key = ftok(DEFAULT_UDEVD_EXEC, IPC_KEY_ID); - pmsg = (struct hotplug_msg *) buf; + key = ftok(UDEVD_EXEC, IPC_KEY_ID); + msg = (struct hotplug_msg *) buf; msgid = msgget(key, IPC_CREAT); if (msgid == -1) { dbg("open message queue error"); - return -1; + exit(1); } while (1) { ret = msgrcv(msgid, (struct msgbuf *) buf, BUFFER_SIZE-4, HOTPLUGMSGTYPE, 0); if (ret != -1) { - dbg("current sequence %d, expected sequence %d", pmsg->seqnum, expect_seqnum); - - /* init expected sequence with value from first call */ + /* init the expected sequence with value from first call */ if (expect_seqnum == 0) { - expect_seqnum = pmsg->seqnum; + expect_seqnum = msg->seqnum; dbg("init next expected sequence number to %d", expect_seqnum); } - - if (pmsg->seqnum > expect_seqnum) { - add_queue(pmsg); - set_timer(EVENT_TIMEOUT_SECONDS); - } else { - if (pmsg->seqnum == expect_seqnum) { - dispatch_msg(pmsg); - expect_seqnum++; - check_queue(); - } else { - dbg("timeout event for unexpected sequence number %d", pmsg->seqnum); - } + dbg("current sequence %d, expected sequence %d", msg->seqnum, expect_seqnum); + if (msg->seqnum == expect_seqnum) { + /* execute expected event */ + dispatch_msg(msg); + expect_seqnum++; + check_queue(); + dump_queue(); + continue; } + if (msg->seqnum > expect_seqnum) { + /* something missing, queue event*/ + queue_msg(msg); + check_queue(); + dump_queue(); + continue; + } + dbg("too late for event with sequence %d, even skipped ", msg->seqnum); } else { if (errno == EINTR) { - if (head != NULL) { - /* event timeout, skip all missing, proceed with next queued event */ - info("timeout reached, skip events %d - %d", expect_seqnum, head->seqnum-1); - expect_seqnum = head->seqnum; - } else { + /* timeout */ + if (list_empty(&msg_list)) { info("we have nothing to do, so daemon exits..."); if (lock_file >= 0) { close(lock_file); @@ -214,31 +226,12 @@ static int process_queue(void) exit(0); } check_queue(); - } else { - dbg("ipc message receive error '%s'", strerror(errno)); + dump_queue(); + continue; } + dbg("ipc message receive error '%s'", strerror(errno)); } } - return 0; -} - -static void sig_handler(int signum) -{ - dbg("caught signal %d", signum); - switch (signum) { - case SIGINT: - case SIGTERM: - case SIGKILL: - if (lock_file >= 0) { - close(lock_file); - unlink(lock_filename); - } - exit(20 + signum); - break; - - default: - dbg("unhandled signal"); - } } static int one_and_only(void) @@ -249,18 +242,18 @@ static int one_and_only(void) /* see if we can open */ if (lock_file < 0) - return -EINVAL; + return -1; /* see if we can lock */ if (lockf(lock_file, F_TLOCK, 0) < 0) { close(lock_file); unlink(lock_filename); - return -EINVAL; + return -1; } snprintf(string, sizeof(string), "%d\n", getpid()); write(lock_file, string, strlen(string)); - + return 0; } @@ -274,11 +267,11 @@ int main(int argc, char *argv[]) signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); signal(SIGKILL, sig_handler); + signal(SIGALRM, sig_handler); /* we exit if we have nothing to do, next event will start us again */ - set_timer(DAEMON_TIMEOUT_SECONDS); + set_timeout(UDEVD_TIMEOUT_SECONDS); - /* main loop */ - process_queue(); - return 0; + work(); + exit(0); } diff --git a/udevd.h b/udevd.h index 43fe6b421a..c9b69bbc3c 100644 --- a/udevd.h +++ b/udevd.h @@ -21,17 +21,22 @@ * */ -#define DEFAULT_UDEV_EXEC "./udev" -#define DEFAULT_UDEVD_EXEC "./udevd" +#include "list.h" -#define IPC_KEY_ID 0 -#define HOTPLUGMSGTYPE 44 +#define UDEV_EXEC "./udev" +#define UDEVD_EXEC "./udevd" +#define UDEVD_TIMEOUT_SECONDS 60 +#define EVENT_TIMEOUT_SECONDS 5 + +#define IPC_KEY_ID 0 +#define HOTPLUGMSGTYPE 44 struct hotplug_msg { long mtype; - struct hotplug_msg *next; + struct list_head list; int seqnum; + time_t queue_time; char action[8]; char devpath[128]; char subsystem[16]; diff --git a/udevsend.c b/udevsend.c index bdc8293df7..3f3bbacbc2 100644 --- a/udevsend.c +++ b/udevsend.c @@ -64,6 +64,7 @@ static inline char *get_seqnum(void) static int build_hotplugmsg(struct hotplug_msg *msg, char *action, char *devpath, char *subsystem, int seqnum) { + memset(msg, 0x00, sizeof(msg)); msg->mtype = HOTPLUGMSGTYPE; msg->seqnum = seqnum; strncpy(msg->action, action, 8); @@ -85,7 +86,8 @@ static int start_daemon(void) switch (child_pid) { case 0: /* daemon */ - execl(DEFAULT_UDEVD_EXEC, NULL); + setsid(); + execl(UDEVD_EXEC, "udevd", NULL); dbg("exec of daemon failed"); exit(1); case -1: @@ -99,7 +101,7 @@ static int start_daemon(void) dbg("fork of helper failed"); return -1; default: - wait(0); + wait(NULL); } return 0; } @@ -147,7 +149,7 @@ int main(int argc, char* argv[]) seq = atoi(seqnum); /* create ipc message queue or get id of our existing one */ - key = ftok(DEFAULT_UDEVD_EXEC, IPC_KEY_ID); + key = ftok(UDEVD_EXEC, IPC_KEY_ID); size = build_hotplugmsg(&message, action, devpath, subsystem, seq); msgid = msgget(key, IPC_CREAT); if (msgid == -1) { @@ -165,7 +167,7 @@ int main(int argc, char* argv[]) /* get state of ipc queue */ tspec.tv_sec = 0; tspec.tv_nsec = 10000000; /* 10 millisec */ - loop = 20; + loop = 30; while (loop--) { retval = msgctl(msgid, IPC_STAT, &msg_queue); if (retval == -1) { -- cgit v1.2.3-54-g00ecf From 87171e46cd9d179e0bb5549c4d74769a1be86e64 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 26 Jan 2004 18:20:12 -0800 Subject: [PATCH] udevinfo - now a real program :) I want to make udevinfo the standard query interface, so all the user features of the main udev are copied in here. It is now capable to: o query the database for a given value o dump the whole database o extract all possible device attributes for a sysfs_device In addition to the known options of udev it supports the query for the mode of the device node, and it includes the mode in the database dump: udevinfo -d P: /class/video4linux/video0 N: video/webcam0 M: 0666 S: camera0 kamera0 O: 500 G: 500 It is also a bit more friendly with the pathnames specified for devices or nodes. We remove the absolute path or add it if neccessary: udevinfo -q mode -n video/webcam0 udevinfo -q mode -n /udev/video/webcam0 0666 udevinfo -q mode -p /sys/class/video4linux/video0 udevinfo -q mode -p /class/video4linux/video0 udevinfo -q mode -p class/video4linux/video0 0666 --- extras/udevinfo/Makefile | 28 +++-- extras/udevinfo/udevinfo.c | 295 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 301 insertions(+), 22 deletions(-) diff --git a/extras/udevinfo/Makefile b/extras/udevinfo/Makefile index f31c8c11e9..b740b25331 100644 --- a/extras/udevinfo/Makefile +++ b/extras/udevinfo/Makefile @@ -1,14 +1,28 @@ PROG=udevinfo -LD=$(CC) -OBJS=udevinfo.o +OBJS= ../../udev_config.o \ + ../../udev-add.o \ + ../../udev-remove.o \ + ../../udevdb.o \ + ../../logging.o \ + ../../namedev.o \ + ../../namedev_parse.o \ + ../../libsysfs/sysfs_bus.o \ + ../../libsysfs/sysfs_class.o \ + ../../libsysfs/sysfs_device.o \ + ../../libsysfs/sysfs_dir.o \ + ../../libsysfs/sysfs_driver.o \ + ../../libsysfs/sysfs_utils.o \ + ../../libsysfs/dlist.o \ + ../../tdb/tdb.o \ + ../../tdb/spinlock.o \ -all: $(PROG) +all: $(PROG) -clean: - rm -f $(PROG) $(OBJS) +$(PROG): $(PROG).o + $(LD) $(LDFLAGS) -o $(PROG) $(PROG).o $(OBJS) -lc -$(PROG): $(OBJS) - $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) +clean: + rm -f $(PROG) $(OBJS) $(PROG).o me: cd ../..; make EXTRAS=extras/udevinfo diff --git a/extras/udevinfo/udevinfo.c b/extras/udevinfo/udevinfo.c index c5934be2d4..3f03901f49 100644 --- a/extras/udevinfo/udevinfo.c +++ b/extras/udevinfo/udevinfo.c @@ -23,21 +23,29 @@ #include #include #include +#include +#include +#include -#include "libsysfs.h" +#include "../../udev.h" +#include "../../udev_version.h" +#include "../../logging.h" +#include "../../udevdb.h" +#include "../../libsysfs/libsysfs.h" -# define VALUE_SIZE 200 +# define SYSFS_VALUE_MAX 200 char **main_argv; +int main_argc; char **main_envp; -static int print_all_attributes(char *path) +static int print_all_attributes(const char *path) { struct dlist *attributes; struct sysfs_attribute *attr; struct sysfs_directory *sysfs_dir; - char value[VALUE_SIZE]; + char value[SYSFS_VALUE_MAX]; int len; int retval = 0; @@ -53,7 +61,7 @@ static int print_all_attributes(char *path) dlist_for_each_data(attributes, attr, struct sysfs_attribute) { if (attr->value != NULL) { - strncpy(value, attr->value, VALUE_SIZE); + strncpy(value, attr->value, SYSFS_VALUE_MAX); len = strlen(value); if (len == 0) continue; @@ -82,24 +90,38 @@ exit: return retval; } -int main(int argc, char **argv, char **envp) +/* callback for database dump */ +static int print_record(char *path, struct udevice *dev) +{ + printf("P: %s\n", path); + printf("N: %s\n", dev->name); + printf("M: %#o\n", dev->mode); + printf("S: %s\n", dev->symlink); + printf("O: %s\n", dev->owner); + printf("G: %s\n", dev->group); + printf("\n"); + return 0; +} + +enum query_type { + NONE, + NAME, + PATH, + SYMLINK, + MODE, + OWNER, + GROUP +}; + +static int print_device_chain(const char *path) { - main_argv = argv; - main_envp = envp; struct sysfs_class_device *class_dev; struct sysfs_class_device *class_dev_parent; struct sysfs_attribute *attr; struct sysfs_device *sysfs_dev; struct sysfs_device *sysfs_dev_parent; - char *path; int retval = 0; - if (argc != 2) { - printf("Usage: udevinfo \n"); - return -1; - } - path = argv[1]; - /* get the class dev */ class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { @@ -157,3 +179,246 @@ exit: //sysfs_close_class_device(class_dev); return retval; } + +static int process_options(void) +{ + static const char short_options[] = "adn:p:q:rVh"; + int option; + int retval = 1; + struct udevice dev; + int root = 0; + int attributes = 0; + enum query_type query = NONE; + char result[NAME_SIZE] = ""; + char path[NAME_SIZE] = ""; + char name[NAME_SIZE] = ""; + char temp[NAME_SIZE]; + char *pos; + + /* get command line options */ + while (1) { + option = getopt(main_argc, main_argv, short_options); + if (option == -1) + break; + + dbg("option '%c'", option); + switch (option) { + case 'n': + dbg("udev name: %s\n", optarg); + strfieldcpy(name, optarg); + break; + + case 'p': + dbg("udev path: %s\n", optarg); + strfieldcpy(path, optarg); + break; + + case 'q': + dbg("udev query: %s\n", optarg); + + if (strcmp(optarg, "name") == 0) { + query = NAME; + break; + } + + if (strcmp(optarg, "symlink") == 0) { + query = SYMLINK; + break; + } + + if (strcmp(optarg, "mode") == 0) { + query = MODE; + break; + } + + if (strcmp(optarg, "owner") == 0) { + query = OWNER; + break; + } + + if (strcmp(optarg, "group") == 0) { + query = GROUP; + break; + } + + if (strcmp(optarg, "path") == 0) { + query = PATH; + break; + } + + printf("unknown query type\n"); + exit(1); + + case 'r': + root = 1; + break; + + case 'a': + attributes = 1; + break; + + case 'd': + retval = udevdb_open_ro(); + if (retval != 0) { + printf("unable to open udev database\n"); + exit(2); + } + udevdb_call_foreach(print_record); + udevdb_exit(); + exit(0); + + case 'V': + printf("udev, version %s\n", UDEV_VERSION); + exit(0); + + case 'h': + retval = 0; + case '?': + default: + goto help; + } + } + + /* process options */ + if (query != NONE) { + retval = udevdb_open_ro(); + if (retval != 0) { + printf("unable to open udev database\n"); + return -EACCES; + } + + if (path[0] != '\0') { + /* remove sysfs_path if given */ + if (strncmp(path, sysfs_path, strlen(sysfs_path)) == 0) { + pos = path + strlen(sysfs_path); + } else { + if (path[0] != '/') { + /* prepend '/' if missing */ + strcat(temp, "/"); + strncat(temp, path, sizeof(path)); + pos = temp; + } else { + pos = path; + } + } + retval = udevdb_get_dev(pos, &dev); + if (retval != 0) { + printf("device not found in database\n"); + goto exit; + } + goto print; + } + + if (name[0] != '\0') { + /* remove udev_root if given */ + if (strncmp(name, udev_root, strlen(udev_root)) == 0) { + pos = name + strlen(udev_root); + } else + pos = name; + retval = udevdb_get_dev_byname(pos, path, &dev); + if (retval != 0) { + printf("device not found in database\n"); + goto exit; + } + goto print; + } + + printf("query needs device path(-p) or node name(-n) specified\n"); + goto exit; + +print: + switch(query) { + case NAME: + if (root) + strfieldcpy(result, udev_root); + strncat(result, dev.name, sizeof(result)); + break; + + case SYMLINK: + strfieldcpy(result, dev.symlink); + break; + + case MODE: + sprintf(result, "%#o", dev.mode); + break; + + case GROUP: + strfieldcpy(result, dev.group); + break; + + case OWNER: + strfieldcpy(result, dev.owner); + break; + + case PATH: + strfieldcpy(result, path); + break; + + default: + goto exit; + } + printf("%s\n", result); + +exit: + udevdb_exit(); + return retval; + } + + if (attributes) { + if (path[0] == '\0') { + printf("attribute walk on device chain needs path(-p) specified\n"); + return -EINVAL; + } else { + if (strncmp(path, sysfs_path, strlen(sysfs_path)) != 0) { + /* prepend sysfs mountpoint if not given */ + strfieldcpy(temp, path); + strfieldcpy(path, sysfs_path); + strncat(path, temp, sizeof(path)); + } + print_device_chain(path); + return 0; + } + } + + if (root) { + printf("%s\n", udev_root); + return 0; + } + +help: + printf("Usage: [-anpqrdVh]\n" + " -q TYPE query database for the specified value:\n" + " 'name' name of device node\n" + " 'symlink' pointing to node\n" + " 'mode' permissions of node\n" + " 'owner' of node\n" + " 'group' of node\n" + " 'path' sysfs device path\n" + " -p PATH sysfs device path used for query or chain\n" + " -n NAME node name used for query\n" + "\n" + " -r print udev root\n" + " -a print all attributes along the chain of the device\n" + " -d dump whole database\n" + " -V print udev version\n" + " -h print this help text\n" + "\n"); + return retval; +} + +int main(int argc, char *argv[], char *envp[]) +{ + int retval; + + main_argv = argv; + main_argc = argc; + main_envp = envp; + + /* initialize our configuration */ + udev_init_config(); + + retval = process_options(); + if (retval != 0) + exit(1); + exit(0); +} -- cgit v1.2.3-54-g00ecf From 869fc2f1ff73209b9aa5dc7d582eba39feaf6f86 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 18:55:37 -0800 Subject: [PATCH] move udevinfo into the main build and clean up the main Makefile a bit. --- Makefile | 34 ++-- extras/udevinfo/Makefile | 28 --- extras/udevinfo/udevinfo.c | 424 --------------------------------------------- udevinfo.c | 424 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 448 insertions(+), 462 deletions(-) delete mode 100644 extras/udevinfo/Makefile delete mode 100644 extras/udevinfo/udevinfo.c create mode 100644 udevinfo.c diff --git a/Makefile b/Makefile index 5c265492b4..20c739e404 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ USE_DBUS = false ROOT = udev DAEMON = udevd SENDER = udevsend +HELPERS = udevinfo VERSION = 014_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) @@ -164,7 +165,7 @@ endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(UDEVD) +all: $(ROOT) $(UDEVD) $(HELPERS) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ @@ -189,8 +190,7 @@ SYSFS = $(PWD)/libsysfs/sysfs_bus.o \ $(PWD)/libsysfs/sysfs_utils.o \ $(PWD)/libsysfs/dlist.o -OBJS = udev.o \ - udev_config.o \ +OBJS = udev_config.o \ udev-add.o \ udev-remove.o \ udevdb.o \ @@ -200,6 +200,16 @@ OBJS = udev.o \ $(SYSFS) \ $(TDB) +HEADERS = $(GEN_HEADERS) \ + udev.h \ + namedev.h \ + udev_version.h \ + udev_dbus.h \ + udevdb.h \ + klibc_fixups.h \ + logging.h \ + list.h + ifeq ($(strip $(USE_KLIBC)),true) OBJS += klibc_fixups.o endif @@ -234,17 +244,21 @@ $(LOCAL_CFG_DIR)/udev.conf: $(OBJS): $(GEN_HEADERS) -$(ROOT): $(OBJS) udev.h namedev.h udev_version.h udev_dbus.h udevdb.h klibc_fixups.h logging.h list.h - $(LD) $(LDFLAGS) -o $(ROOT) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $(ROOT) +$(ROOT): udev.o $(OBJS) $(HEADERS) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $@ + +$(HELPERS): udevinfo.o $(OBJS) $(HEADERS) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $@ $(DAEMON): udevd.h udevd.o udevd.o logging.o - $(LD) $(LDFLAGS) -o $(DAEMON) $(CRT0) udevd.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $(ROOT) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $@ $(SENDER): udevd.h udevsend.o udevd.o logging.o - $(LD) $(LDFLAGS) -o $(SENDER) $(CRT0) udevsend.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $(ROOT) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $@ clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ diff --git a/extras/udevinfo/Makefile b/extras/udevinfo/Makefile deleted file mode 100644 index b740b25331..0000000000 --- a/extras/udevinfo/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -PROG=udevinfo -OBJS= ../../udev_config.o \ - ../../udev-add.o \ - ../../udev-remove.o \ - ../../udevdb.o \ - ../../logging.o \ - ../../namedev.o \ - ../../namedev_parse.o \ - ../../libsysfs/sysfs_bus.o \ - ../../libsysfs/sysfs_class.o \ - ../../libsysfs/sysfs_device.o \ - ../../libsysfs/sysfs_dir.o \ - ../../libsysfs/sysfs_driver.o \ - ../../libsysfs/sysfs_utils.o \ - ../../libsysfs/dlist.o \ - ../../tdb/tdb.o \ - ../../tdb/spinlock.o \ - -all: $(PROG) - -$(PROG): $(PROG).o - $(LD) $(LDFLAGS) -o $(PROG) $(PROG).o $(OBJS) -lc - -clean: - rm -f $(PROG) $(OBJS) $(PROG).o - -me: - cd ../..; make EXTRAS=extras/udevinfo diff --git a/extras/udevinfo/udevinfo.c b/extras/udevinfo/udevinfo.c deleted file mode 100644 index 3f03901f49..0000000000 --- a/extras/udevinfo/udevinfo.c +++ /dev/null @@ -1,424 +0,0 @@ -/* - * udevinfo - fetches attributes for a device - * - * Copyright (C) 2004 Kay Sievers - * - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "../../udev.h" -#include "../../udev_version.h" -#include "../../logging.h" -#include "../../udevdb.h" -#include "../../libsysfs/libsysfs.h" - - -# define SYSFS_VALUE_MAX 200 - -char **main_argv; -int main_argc; -char **main_envp; - -static int print_all_attributes(const char *path) -{ - struct dlist *attributes; - struct sysfs_attribute *attr; - struct sysfs_directory *sysfs_dir; - char value[SYSFS_VALUE_MAX]; - int len; - int retval = 0; - - sysfs_dir = sysfs_open_directory(path); - if (sysfs_dir == NULL) - return -1; - - attributes = sysfs_get_dir_attributes(sysfs_dir); - if (attributes == NULL) { - retval = -1; - goto exit; - } - - dlist_for_each_data(attributes, attr, struct sysfs_attribute) { - if (attr->value != NULL) { - strncpy(value, attr->value, SYSFS_VALUE_MAX); - len = strlen(value); - if (len == 0) - continue; - - /* remove trailing newline */ - if (value[len-1] == '\n') { - value[len-1] = '\0'; - len--; - } - - /* skip nonprintable values */ - while (len) { - if (isprint(value[len-1]) == 0) - break; - len--; - } - if (len == 0) - printf(" SYSFS_%s=\"%s\"\n", attr->name, value); - } - } - printf("\n"); - -exit: - sysfs_close_directory(sysfs_dir); - - return retval; -} - -/* callback for database dump */ -static int print_record(char *path, struct udevice *dev) -{ - printf("P: %s\n", path); - printf("N: %s\n", dev->name); - printf("M: %#o\n", dev->mode); - printf("S: %s\n", dev->symlink); - printf("O: %s\n", dev->owner); - printf("G: %s\n", dev->group); - printf("\n"); - return 0; -} - -enum query_type { - NONE, - NAME, - PATH, - SYMLINK, - MODE, - OWNER, - GROUP -}; - -static int print_device_chain(const char *path) -{ - struct sysfs_class_device *class_dev; - struct sysfs_class_device *class_dev_parent; - struct sysfs_attribute *attr; - struct sysfs_device *sysfs_dev; - struct sysfs_device *sysfs_dev_parent; - int retval = 0; - - /* get the class dev */ - class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) { - printf("couldn't get the class device\n"); - return -1; - } - - /* read the 'dev' file for major/minor*/ - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr == NULL) { - printf("couldn't get the \"dev\" file\n"); - retval = -1; - goto exit; - } - printf("\ndevice '%s' has major:minor %s", class_dev->path, attr->value); - sysfs_close_attribute(attr); - - /* open sysfs class device directory and print all attributes */ - printf(" looking at class device '%s':\n", class_dev->path); - if (print_all_attributes(class_dev->path) != 0) { - printf("couldn't open class device directory\n"); - retval = -1; - goto exit; - } - - /* get the device link (if parent exists look here) */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) { - //sysfs_close_class_device(class_dev); - class_dev = class_dev_parent; - } - sysfs_dev = sysfs_get_classdev_device(class_dev); - if (sysfs_dev != NULL) - printf("follow the class device's \"device\"\n"); - - /* look the device chain upwards */ - while (sysfs_dev != NULL) { - printf(" looking at the device chain at '%s':\n", sysfs_dev->path); - printf(" BUS=\"%s\"\n", sysfs_dev->bus); - printf(" ID=\"%s\"\n", sysfs_dev->bus_id); - - /* open sysfs device directory and print all attributes */ - print_all_attributes(sysfs_dev->path); - - sysfs_dev_parent = sysfs_get_device_parent(sysfs_dev); - if (sysfs_dev_parent == NULL) - break; - - //sysfs_close_device(sysfs_dev); - sysfs_dev = sysfs_dev_parent; - } - sysfs_close_device(sysfs_dev); - -exit: - //sysfs_close_class_device(class_dev); - return retval; -} - -static int process_options(void) -{ - static const char short_options[] = "adn:p:q:rVh"; - int option; - int retval = 1; - struct udevice dev; - int root = 0; - int attributes = 0; - enum query_type query = NONE; - char result[NAME_SIZE] = ""; - char path[NAME_SIZE] = ""; - char name[NAME_SIZE] = ""; - char temp[NAME_SIZE]; - char *pos; - - /* get command line options */ - while (1) { - option = getopt(main_argc, main_argv, short_options); - if (option == -1) - break; - - dbg("option '%c'", option); - switch (option) { - case 'n': - dbg("udev name: %s\n", optarg); - strfieldcpy(name, optarg); - break; - - case 'p': - dbg("udev path: %s\n", optarg); - strfieldcpy(path, optarg); - break; - - case 'q': - dbg("udev query: %s\n", optarg); - - if (strcmp(optarg, "name") == 0) { - query = NAME; - break; - } - - if (strcmp(optarg, "symlink") == 0) { - query = SYMLINK; - break; - } - - if (strcmp(optarg, "mode") == 0) { - query = MODE; - break; - } - - if (strcmp(optarg, "owner") == 0) { - query = OWNER; - break; - } - - if (strcmp(optarg, "group") == 0) { - query = GROUP; - break; - } - - if (strcmp(optarg, "path") == 0) { - query = PATH; - break; - } - - printf("unknown query type\n"); - exit(1); - - case 'r': - root = 1; - break; - - case 'a': - attributes = 1; - break; - - case 'd': - retval = udevdb_open_ro(); - if (retval != 0) { - printf("unable to open udev database\n"); - exit(2); - } - udevdb_call_foreach(print_record); - udevdb_exit(); - exit(0); - - case 'V': - printf("udev, version %s\n", UDEV_VERSION); - exit(0); - - case 'h': - retval = 0; - case '?': - default: - goto help; - } - } - - /* process options */ - if (query != NONE) { - retval = udevdb_open_ro(); - if (retval != 0) { - printf("unable to open udev database\n"); - return -EACCES; - } - - if (path[0] != '\0') { - /* remove sysfs_path if given */ - if (strncmp(path, sysfs_path, strlen(sysfs_path)) == 0) { - pos = path + strlen(sysfs_path); - } else { - if (path[0] != '/') { - /* prepend '/' if missing */ - strcat(temp, "/"); - strncat(temp, path, sizeof(path)); - pos = temp; - } else { - pos = path; - } - } - retval = udevdb_get_dev(pos, &dev); - if (retval != 0) { - printf("device not found in database\n"); - goto exit; - } - goto print; - } - - if (name[0] != '\0') { - /* remove udev_root if given */ - if (strncmp(name, udev_root, strlen(udev_root)) == 0) { - pos = name + strlen(udev_root); - } else - pos = name; - retval = udevdb_get_dev_byname(pos, path, &dev); - if (retval != 0) { - printf("device not found in database\n"); - goto exit; - } - goto print; - } - - printf("query needs device path(-p) or node name(-n) specified\n"); - goto exit; - -print: - switch(query) { - case NAME: - if (root) - strfieldcpy(result, udev_root); - strncat(result, dev.name, sizeof(result)); - break; - - case SYMLINK: - strfieldcpy(result, dev.symlink); - break; - - case MODE: - sprintf(result, "%#o", dev.mode); - break; - - case GROUP: - strfieldcpy(result, dev.group); - break; - - case OWNER: - strfieldcpy(result, dev.owner); - break; - - case PATH: - strfieldcpy(result, path); - break; - - default: - goto exit; - } - printf("%s\n", result); - -exit: - udevdb_exit(); - return retval; - } - - if (attributes) { - if (path[0] == '\0') { - printf("attribute walk on device chain needs path(-p) specified\n"); - return -EINVAL; - } else { - if (strncmp(path, sysfs_path, strlen(sysfs_path)) != 0) { - /* prepend sysfs mountpoint if not given */ - strfieldcpy(temp, path); - strfieldcpy(path, sysfs_path); - strncat(path, temp, sizeof(path)); - } - print_device_chain(path); - return 0; - } - } - - if (root) { - printf("%s\n", udev_root); - return 0; - } - -help: - printf("Usage: [-anpqrdVh]\n" - " -q TYPE query database for the specified value:\n" - " 'name' name of device node\n" - " 'symlink' pointing to node\n" - " 'mode' permissions of node\n" - " 'owner' of node\n" - " 'group' of node\n" - " 'path' sysfs device path\n" - " -p PATH sysfs device path used for query or chain\n" - " -n NAME node name used for query\n" - "\n" - " -r print udev root\n" - " -a print all attributes along the chain of the device\n" - " -d dump whole database\n" - " -V print udev version\n" - " -h print this help text\n" - "\n"); - return retval; -} - -int main(int argc, char *argv[], char *envp[]) -{ - int retval; - - main_argv = argv; - main_argc = argc; - main_envp = envp; - - /* initialize our configuration */ - udev_init_config(); - - retval = process_options(); - if (retval != 0) - exit(1); - exit(0); -} diff --git a/udevinfo.c b/udevinfo.c new file mode 100644 index 0000000000..a2f5601b7c --- /dev/null +++ b/udevinfo.c @@ -0,0 +1,424 @@ +/* + * udevinfo - fetches attributes for a device + * + * Copyright (C) 2004 Kay Sievers + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_version.h" +#include "logging.h" +#include "udevdb.h" +#include "libsysfs/libsysfs.h" + + +# define SYSFS_VALUE_MAX 200 + +char **main_argv; +int main_argc; +char **main_envp; + +static int print_all_attributes(const char *path) +{ + struct dlist *attributes; + struct sysfs_attribute *attr; + struct sysfs_directory *sysfs_dir; + char value[SYSFS_VALUE_MAX]; + int len; + int retval = 0; + + sysfs_dir = sysfs_open_directory(path); + if (sysfs_dir == NULL) + return -1; + + attributes = sysfs_get_dir_attributes(sysfs_dir); + if (attributes == NULL) { + retval = -1; + goto exit; + } + + dlist_for_each_data(attributes, attr, struct sysfs_attribute) { + if (attr->value != NULL) { + strncpy(value, attr->value, SYSFS_VALUE_MAX); + len = strlen(value); + if (len == 0) + continue; + + /* remove trailing newline */ + if (value[len-1] == '\n') { + value[len-1] = '\0'; + len--; + } + + /* skip nonprintable values */ + while (len) { + if (isprint(value[len-1]) == 0) + break; + len--; + } + if (len == 0) + printf(" SYSFS_%s=\"%s\"\n", attr->name, value); + } + } + printf("\n"); + +exit: + sysfs_close_directory(sysfs_dir); + + return retval; +} + +/* callback for database dump */ +static int print_record(char *path, struct udevice *dev) +{ + printf("P: %s\n", path); + printf("N: %s\n", dev->name); + printf("M: %#o\n", dev->mode); + printf("S: %s\n", dev->symlink); + printf("O: %s\n", dev->owner); + printf("G: %s\n", dev->group); + printf("\n"); + return 0; +} + +enum query_type { + NONE, + NAME, + PATH, + SYMLINK, + MODE, + OWNER, + GROUP +}; + +static int print_device_chain(const char *path) +{ + struct sysfs_class_device *class_dev; + struct sysfs_class_device *class_dev_parent; + struct sysfs_attribute *attr; + struct sysfs_device *sysfs_dev; + struct sysfs_device *sysfs_dev_parent; + int retval = 0; + + /* get the class dev */ + class_dev = sysfs_open_class_device_path(path); + if (class_dev == NULL) { + printf("couldn't get the class device\n"); + return -1; + } + + /* read the 'dev' file for major/minor*/ + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr == NULL) { + printf("couldn't get the \"dev\" file\n"); + retval = -1; + goto exit; + } + printf("\ndevice '%s' has major:minor %s", class_dev->path, attr->value); + sysfs_close_attribute(attr); + + /* open sysfs class device directory and print all attributes */ + printf(" looking at class device '%s':\n", class_dev->path); + if (print_all_attributes(class_dev->path) != 0) { + printf("couldn't open class device directory\n"); + retval = -1; + goto exit; + } + + /* get the device link (if parent exists look here) */ + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent != NULL) { + //sysfs_close_class_device(class_dev); + class_dev = class_dev_parent; + } + sysfs_dev = sysfs_get_classdev_device(class_dev); + if (sysfs_dev != NULL) + printf("follow the class device's \"device\"\n"); + + /* look the device chain upwards */ + while (sysfs_dev != NULL) { + printf(" looking at the device chain at '%s':\n", sysfs_dev->path); + printf(" BUS=\"%s\"\n", sysfs_dev->bus); + printf(" ID=\"%s\"\n", sysfs_dev->bus_id); + + /* open sysfs device directory and print all attributes */ + print_all_attributes(sysfs_dev->path); + + sysfs_dev_parent = sysfs_get_device_parent(sysfs_dev); + if (sysfs_dev_parent == NULL) + break; + + //sysfs_close_device(sysfs_dev); + sysfs_dev = sysfs_dev_parent; + } + sysfs_close_device(sysfs_dev); + +exit: + //sysfs_close_class_device(class_dev); + return retval; +} + +static int process_options(void) +{ + static const char short_options[] = "adn:p:q:rVh"; + int option; + int retval = 1; + struct udevice dev; + int root = 0; + int attributes = 0; + enum query_type query = NONE; + char result[NAME_SIZE] = ""; + char path[NAME_SIZE] = ""; + char name[NAME_SIZE] = ""; + char temp[NAME_SIZE]; + char *pos; + + /* get command line options */ + while (1) { + option = getopt(main_argc, main_argv, short_options); + if (option == -1) + break; + + dbg("option '%c'", option); + switch (option) { + case 'n': + dbg("udev name: %s\n", optarg); + strfieldcpy(name, optarg); + break; + + case 'p': + dbg("udev path: %s\n", optarg); + strfieldcpy(path, optarg); + break; + + case 'q': + dbg("udev query: %s\n", optarg); + + if (strcmp(optarg, "name") == 0) { + query = NAME; + break; + } + + if (strcmp(optarg, "symlink") == 0) { + query = SYMLINK; + break; + } + + if (strcmp(optarg, "mode") == 0) { + query = MODE; + break; + } + + if (strcmp(optarg, "owner") == 0) { + query = OWNER; + break; + } + + if (strcmp(optarg, "group") == 0) { + query = GROUP; + break; + } + + if (strcmp(optarg, "path") == 0) { + query = PATH; + break; + } + + printf("unknown query type\n"); + exit(1); + + case 'r': + root = 1; + break; + + case 'a': + attributes = 1; + break; + + case 'd': + retval = udevdb_open_ro(); + if (retval != 0) { + printf("unable to open udev database\n"); + exit(2); + } + udevdb_call_foreach(print_record); + udevdb_exit(); + exit(0); + + case 'V': + printf("udevinfo, version %s\n", UDEV_VERSION); + exit(0); + + case 'h': + retval = 0; + case '?': + default: + goto help; + } + } + + /* process options */ + if (query != NONE) { + retval = udevdb_open_ro(); + if (retval != 0) { + printf("unable to open udev database\n"); + return -EACCES; + } + + if (path[0] != '\0') { + /* remove sysfs_path if given */ + if (strncmp(path, sysfs_path, strlen(sysfs_path)) == 0) { + pos = path + strlen(sysfs_path); + } else { + if (path[0] != '/') { + /* prepend '/' if missing */ + strcat(temp, "/"); + strncat(temp, path, sizeof(path)); + pos = temp; + } else { + pos = path; + } + } + retval = udevdb_get_dev(pos, &dev); + if (retval != 0) { + printf("device not found in database\n"); + goto exit; + } + goto print; + } + + if (name[0] != '\0') { + /* remove udev_root if given */ + if (strncmp(name, udev_root, strlen(udev_root)) == 0) { + pos = name + strlen(udev_root); + } else + pos = name; + retval = udevdb_get_dev_byname(pos, path, &dev); + if (retval != 0) { + printf("device not found in database\n"); + goto exit; + } + goto print; + } + + printf("query needs device path(-p) or node name(-n) specified\n"); + goto exit; + +print: + switch(query) { + case NAME: + if (root) + strfieldcpy(result, udev_root); + strncat(result, dev.name, sizeof(result)); + break; + + case SYMLINK: + strfieldcpy(result, dev.symlink); + break; + + case MODE: + sprintf(result, "%#o", dev.mode); + break; + + case GROUP: + strfieldcpy(result, dev.group); + break; + + case OWNER: + strfieldcpy(result, dev.owner); + break; + + case PATH: + strfieldcpy(result, path); + break; + + default: + goto exit; + } + printf("%s\n", result); + +exit: + udevdb_exit(); + return retval; + } + + if (attributes) { + if (path[0] == '\0') { + printf("attribute walk on device chain needs path(-p) specified\n"); + return -EINVAL; + } else { + if (strncmp(path, sysfs_path, strlen(sysfs_path)) != 0) { + /* prepend sysfs mountpoint if not given */ + strfieldcpy(temp, path); + strfieldcpy(path, sysfs_path); + strncat(path, temp, sizeof(path)); + } + print_device_chain(path); + return 0; + } + } + + if (root) { + printf("%s\n", udev_root); + return 0; + } + +help: + printf("Usage: [-anpqrdVh]\n" + " -q TYPE query database for the specified value:\n" + " 'name' name of device node\n" + " 'symlink' pointing to node\n" + " 'mode' permissions of node\n" + " 'owner' of node\n" + " 'group' of node\n" + " 'path' sysfs device path\n" + " -p PATH sysfs device path used for query or chain\n" + " -n NAME node name used for query\n" + "\n" + " -r print udev root\n" + " -a print all attributes along the chain of the device\n" + " -d dump whole database\n" + " -V print udev version\n" + " -h print this help text\n" + "\n"); + return retval; +} + +int main(int argc, char *argv[], char *envp[]) +{ + int retval; + + main_argv = argv; + main_argc = argc; + main_envp = envp; + + /* initialize our configuration */ + udev_init_config(); + + retval = process_options(); + if (retval != 0) + exit(1); + exit(0); +} -- cgit v1.2.3-54-g00ecf From 1f6d07b9a5d97183a20f3d07619e2f9aa31510f0 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:21:12 -0800 Subject: [PATCH] more makefile cleanups --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 20c739e404..23b6ff87d8 100644 --- a/Makefile +++ b/Makefile @@ -200,8 +200,7 @@ OBJS = udev_config.o \ $(SYSFS) \ $(TDB) -HEADERS = $(GEN_HEADERS) \ - udev.h \ +HEADERS = udev.h \ namedev.h \ udev_version.h \ udev_dbus.h \ @@ -243,13 +242,14 @@ $(LOCAL_CFG_DIR)/udev.conf: $(OBJS): $(GEN_HEADERS) +udev.o: $(GEN_HEADERS) -$(ROOT): udev.o $(OBJS) $(HEADERS) +$(ROOT): udev.o $(OBJS) $(HEADERS) $(GEN_HEADERS) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ $(HELPERS): udevinfo.o $(OBJS) $(HEADERS) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o logging.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ $(DAEMON): udevd.h udevd.o udevd.o logging.o -- cgit v1.2.3-54-g00ecf From 274812b502089c55acb1bc7bfe99bebf9ce669b2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:21:58 -0800 Subject: [PATCH] move get_pair to udev_config.c because udevinfo doesn't need all of namedev.o --- namedev.h | 4 +--- namedev_parse.c | 39 ++------------------------------------- udev.h | 1 + udev_config.c | 39 +++++++++++++++++++++++++++++++++++++-- 4 files changed, 41 insertions(+), 42 deletions(-) diff --git a/namedev.h b/namedev.h index 42b1e6c1a0..9cff3710d4 100644 --- a/namedev.h +++ b/namedev.h @@ -3,7 +3,7 @@ * * Userspace devfs * - * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003,2004 Greg Kroah-Hartman * * 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 @@ -91,6 +91,4 @@ extern void dump_config_dev_list(void); extern void dump_perm_dev(struct perm_device *dev); extern void dump_perm_dev_list(void); -extern int get_pair(char **orig_string, char **left, char **right); - #endif diff --git a/namedev_parse.c b/namedev_parse.c index b15be0e6fa..e6575fa108 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -3,7 +3,7 @@ * * Userspace devfs * - * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003,2004 Greg Kroah-Hartman * * * This program is free software; you can redistribute it and/or modify it @@ -52,41 +52,6 @@ static int add_config_dev(struct config_device *new_dev) return 0; } -int get_pair(char **orig_string, char **left, char **right) -{ - char *temp; - char *string = *orig_string; - - if (!string) - return -ENODEV; - - /* eat any whitespace */ - while (isspace(*string) || *string == ',') - ++string; - - /* split based on '=' */ - temp = strsep(&string, "="); - *left = temp; - if (!string) - return -ENODEV; - - /* take the right side and strip off the '"' */ - while (isspace(*string)) - ++string; - if (*string == '"') - ++string; - else - return -ENODEV; - - temp = strsep(&string, "\""); - if (!string || *temp == '\0') - return -ENODEV; - *right = temp; - *orig_string = string; - - return 0; -} - void dump_config_dev(struct config_device *dev) { /*FIXME dump all sysfs's */ @@ -166,7 +131,7 @@ int namedev_init_rules(void) /* get all known keys */ while (1) { - retval = get_pair(&temp, &temp2, &temp3); + retval = parse_get_pair(&temp, &temp2, &temp3); if (retval) break; diff --git a/udev.h b/udev.h index e5c983a212..f854a183d3 100644 --- a/udev.h +++ b/udev.h @@ -59,6 +59,7 @@ do { \ extern int udev_add_device(char *path, char *subsystem); extern int udev_remove_device(char *path, char *subsystem); extern void udev_init_config(void); +extern int parse_get_pair(char **orig_string, char **left, char **right); extern char **main_argv; extern char **main_envp; diff --git a/udev_config.c b/udev_config.c index e75ee3a346..6d39d294e1 100644 --- a/udev_config.c +++ b/udev_config.c @@ -3,7 +3,7 @@ * * Userspace devfs * - * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003,2004 Greg Kroah-Hartman * * * This program is free software; you can redistribute it and/or modify it @@ -68,6 +68,41 @@ static void init_variables(void) strncpy(_var, value, sizeof(_var)); \ } +int parse_get_pair(char **orig_string, char **left, char **right) +{ + char *temp; + char *string = *orig_string; + + if (!string) + return -ENODEV; + + /* eat any whitespace */ + while (isspace(*string) || *string == ',') + ++string; + + /* split based on '=' */ + temp = strsep(&string, "="); + *left = temp; + if (!string) + return -ENODEV; + + /* take the right side and strip off the '"' */ + while (isspace(*string)) + ++string; + if (*string == '"') + ++string; + else + return -ENODEV; + + temp = strsep(&string, "\""); + if (!string || *temp == '\0') + return -ENODEV; + *right = temp; + *orig_string = string; + + return 0; +} + static int parse_config_file(void) { char line[255]; @@ -108,7 +143,7 @@ static int parse_config_file(void) if (*temp == COMMENT_CHARACTER) continue; - retval = get_pair(&temp, &variable, &value); + retval = parse_get_pair(&temp, &variable, &value); if (retval) break; -- cgit v1.2.3-54-g00ecf From ac4dc8746501ae3b9c859e5714f508d90cbe41a7 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:22:31 -0800 Subject: [PATCH] udevinfo doesn't need to declare main_envp --- udevinfo.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index a2f5601b7c..aa9d20a773 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -38,7 +38,6 @@ char **main_argv; int main_argc; -char **main_envp; static int print_all_attributes(const char *path) { @@ -412,7 +411,6 @@ int main(int argc, char *argv[], char *envp[]) main_argv = argv; main_argc = argc; - main_envp = envp; /* initialize our configuration */ udev_init_config(); -- cgit v1.2.3-54-g00ecf From 8202eb32b97a236dac725bfe24e390840ded7098 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:23:11 -0800 Subject: [PATCH] rip out command line code from udev, now that we have udevinfo. --- udev.c | 233 ++++------------------------------------------------------------- 1 file changed, 12 insertions(+), 221 deletions(-) diff --git a/udev.c b/udev.c index 3b701ac26f..4c67477c20 100644 --- a/udev.c +++ b/udev.c @@ -3,8 +3,7 @@ * * Userspace devfs * - * Copyright (C) 2003 Greg Kroah-Hartman - * + * Copyright (C) 2003,2004 Greg Kroah-Hartman * * 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 @@ -24,12 +23,9 @@ #include #include #include -#include -#include #include #include #include -#include #include "udev.h" #include "udev_version.h" @@ -83,201 +79,6 @@ static inline char *get_seqnum(void) return seqnum; } -/* callback for database dump */ -static int print_record(char *path, struct udevice *dev) -{ - printf("P: %s\n", path); - printf("N: %s\n", dev->name); - printf("S: %s\n", dev->symlink); - printf("O: %s\n", dev->owner); - printf("G: %s\n", dev->group); - printf("\n"); - return 0; -} - -enum query_type { - NONE, - NAME, - PATH, - SYMLINK, - OWNER, - GROUP -}; - -static inline int udev_user(int argc, char **argv) -{ - static const char short_options[] = "dn:p:q:rVh"; - int option; - int retval = -EINVAL; - struct udevice dev; - int root = 0; - enum query_type query = NONE; - char result[NAME_SIZE] = ""; - char path[NAME_SIZE] = ""; - char name[NAME_SIZE] = ""; - - /* get command line options */ - while (1) { - option = getopt(argc, argv, short_options); - if (option == -1) - break; - - dbg("option '%c'", option); - switch (option) { - case 'n': - dbg("udev name: %s\n", optarg); - strfieldcpy(name, optarg); - break; - - case 'p': - dbg("udev path: %s\n", optarg); - strfieldcpy(path, optarg); - break; - - case 'q': - dbg("udev query: %s\n", optarg); - - if (strcmp(optarg, "name") == 0) { - query = NAME; - break; - } - - if (strcmp(optarg, "symlink") == 0) { - query = SYMLINK; - break; - } - - if (strcmp(optarg, "owner") == 0) { - query = OWNER; - break; - } - - if (strcmp(optarg, "group") == 0) { - query = GROUP; - break; - } - - if (strcmp(optarg, "path") == 0) { - query = PATH; - break; - } - - printf("unknown query type\n"); - return -EINVAL; - - case 'r': - root = 1; - break; - - case 'd': - retval = udevdb_open_ro(); - if (retval != 0) { - printf("unable to open udev database\n"); - return -EACCES; - } - retval = udevdb_call_foreach(print_record); - udevdb_exit(); - return retval; - - case 'V': - printf("udev, version %s\n", UDEV_VERSION); - return 0; - - case 'h': - retval = 0; - case '?': - default: - goto help; - } - } - - /* process options */ - if (query != NONE) { - retval = udevdb_open_ro(); - if (retval != 0) { - printf("unable to open udev database\n"); - return -EACCES; - } - - if (path[0] != '\0') { - retval = udevdb_get_dev(path, &dev); - if (retval != 0) { - printf("device not found in database\n"); - goto exit; - } - goto print; - } - - if (name[0] != '\0') { - retval = udevdb_get_dev_byname(name, path, &dev); - if (retval != 0) { - printf("device not found in database\n"); - goto exit; - } - goto print; - } - - printf("query needs device path(-p) or node name(-n) specified\n"); - goto exit; - -print: - switch(query) { - case NAME: - if (root) - strfieldcpy(result, udev_root); - strncat(result, dev.name, sizeof(result)); - break; - - case SYMLINK: - strfieldcpy(result, dev.symlink); - break; - - case GROUP: - strfieldcpy(result, dev.group); - break; - - case OWNER: - strfieldcpy(result, dev.owner); - break; - - case PATH: - strfieldcpy(result, path); - break; - - default: - goto exit; - } - printf("%s\n", result); - -exit: - udevdb_exit(); - return retval; - } - - if (root) { - printf("%s\n", udev_root); - return 0; - } - -help: - printf("Usage: [-npqrdVh]\n" - " -q TYPE query database for the specified value:\n" - " 'name' name of device node\n" - " 'symlink' pointing to node\n" - " 'owner' of node\n" - " 'group' of node\n" - " 'path' sysfs device path\n" - " -p PATH sysfs device path used for query\n" - " -n NAME node name used for query\n" - "\n" - " -r print udev root\n" - " -d dump whole database\n" - " -V print udev version\n" - " -h print this help text\n" - "\n"); - return retval; -} - static char *subsystem_blacklist[] = { "net", "scsi_host", @@ -287,7 +88,7 @@ static char *subsystem_blacklist[] = { "", }; -static inline int udev_hotplug(int argc, char **argv) +static int udev_hotplug(int argc, char **argv) { char *action; char *devpath; @@ -295,7 +96,11 @@ static inline int udev_hotplug(int argc, char **argv) int retval = -EINVAL; int i; - subsystem = argv[1]; + action = get_action(); + if (!action) { + dbg ("no action?"); + goto exit; + } devpath = get_devpath(); if (!devpath) { @@ -312,6 +117,7 @@ static inline int udev_hotplug(int argc, char **argv) } /* skip blacklisted subsystems */ + subsystem = argv[1]; i = 0; while (subsystem_blacklist[i][0] != '\0') { if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { @@ -321,15 +127,12 @@ static inline int udev_hotplug(int argc, char **argv) i++; } - action = get_action(); - if (!action) { - dbg ("no action?"); - goto exit; - } - /* connect to the system message bus */ sysbus_connect(); + /* initialize our configuration */ + udev_init_config(); + /* initialize udev database */ retval = udevdb_init(UDEVDB_DEFAULT); if (retval != 0) { @@ -370,24 +173,12 @@ exit: int main(int argc, char **argv, char **envp) { - int retval; main_argv = argv; main_envp = envp; dbg("version %s", UDEV_VERSION); - /* initialize our configuration */ - udev_init_config(); - - if (argc == 2 && argv[1][0] != '-') { - dbg("called by hotplug"); - retval = udev_hotplug(argc, argv); - } else { - dbg("called by user"); - retval = udev_user(argc, argv); - } - - return retval; + return udev_hotplug(argc, argv); } -- cgit v1.2.3-54-g00ecf From 245f9f52cec28b0377376beec222c8d5c0d07276 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:32:01 -0800 Subject: [PATCH] add udevinfo to install target of Makefile --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 23b6ff87d8..7846086294 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ USE_DBUS = false ROOT = udev DAEMON = udevd SENDER = udevsend -HELPERS = udevinfo +HELPER = udevinfo VERSION = 014_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) @@ -165,7 +165,7 @@ endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(UDEVD) $(HELPERS) +all: $(ROOT) $(UDEVD) $(HELPER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ @@ -248,7 +248,7 @@ $(ROOT): udev.o $(OBJS) $(HEADERS) $(GEN_HEADERS) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(HELPERS): udevinfo.o $(OBJS) $(HEADERS) +$(HELPER): udevinfo.o $(OBJS) $(HEADERS) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o logging.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ @@ -336,6 +336,7 @@ install: install-config install-dbus-policy all $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) + $(INSTALL_PROGRAM) -D $(HELPER) $(DESTDIR)$(sbindir)/$(HELPER) @if [ "x$(USE_LSB)" = "xtrue" ]; then \ $(INSTALL_PROGRAM) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ ln -s $(DESTDIR)$(initdir)/udev $(sbin_dir)/rcudev; \ @@ -359,6 +360,7 @@ uninstall: uninstall-dbus-policy - rm $(initdir)/udev - rm $(mandir)/man8/udev.8 - rm $(sbindir)/$(ROOT) + - rm $(sbindir)/$(HELPER) - rmdir $(hotplugdir) - rmdir $(configdir) - rmdir $(udevdir) -- cgit v1.2.3-54-g00ecf From da1cc7cc5fc671312436cd6122fcb6022cbcfd83 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:32:57 -0800 Subject: [PATCH] add udevinfo to udev.spec file. --- udev.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udev.spec b/udev.spec index 8494143ec0..2be4496f40 100644 --- a/udev.spec +++ b/udev.spec @@ -85,6 +85,7 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %doc COPYING README TODO ChangeLog %attr(755,root,root) /sbin/udev +%attr(755,root,root) /sbin/udevinfo %attr(755,root,root) /udev/ %attr(755,root,root) /etc/udev/ %config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf @@ -98,6 +99,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_mandir}/man8/udev.8* %changelog +* Mon Jan 26 2004 Greg Kroah-Hartman +- add udevinfo to rpm + * Mon Jan 05 2004 Rolf Eike Beer - add defines to choose the init script (Redhat or LSB) -- cgit v1.2.3-54-g00ecf From 8fc34188503e0dd131eb215b7b1832e21434c7c8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:41:00 -0800 Subject: [PATCH] added URL to spec file. --- udev.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev.spec b/udev.spec index 2be4496f40..b9a20ac5fd 100644 --- a/udev.spec +++ b/udev.spec @@ -36,6 +36,7 @@ Group: Utilities/System Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.gz ExclusiveOS: Linux Vendor: Greg Kroah-Hartman +URL : kernel.org/pub/linux/utils/kernel/hotplug/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Prereq: /bin/sh, fileutils, hotplug @@ -101,6 +102,7 @@ rm -rf $RPM_BUILD_ROOT %changelog * Mon Jan 26 2004 Greg Kroah-Hartman - add udevinfo to rpm +- added URL to spec file * Mon Jan 05 2004 Rolf Eike Beer - add defines to choose the init script (Redhat or LSB) -- cgit v1.2.3-54-g00ecf From e31474a1e1ede5692f6dd7c710e4f2682588659e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:56:19 -0800 Subject: [PATCH] create initial version of udevinfo man page. --- Makefile | 2 ++ udevinfo.8 | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 udevinfo.8 diff --git a/Makefile b/Makefile index 7846086294..0fa39d7a41 100644 --- a/Makefile +++ b/Makefile @@ -344,6 +344,7 @@ install: install-config install-dbus-policy all $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ fi $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 + $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 - rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug - ln -f -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug @extras="$(EXTRAS)" ; for target in $$extras ; do \ @@ -359,6 +360,7 @@ uninstall: uninstall-dbus-policy - rm $(configdir)/udev.conf - rm $(initdir)/udev - rm $(mandir)/man8/udev.8 + - rm $(mandir)/man8/udevinfo.8 - rm $(sbindir)/$(ROOT) - rm $(sbindir)/$(HELPER) - rmdir $(hotplugdir) diff --git a/udevinfo.8 b/udevinfo.8 new file mode 100644 index 0000000000..852e2ae93f --- /dev/null +++ b/udevinfo.8 @@ -0,0 +1,52 @@ +.TH UDEVINFO 8 "October 2003" "" "Linux Administrator's Manual" +.SH NAME +udevinfo \- retrieve information from udev +.SH SYNOPSIS +.B udevinfo +.RI "[-q " query_type " -p " sysfs_path "] [-drVh]" +.SH "DESCRIPTION" +.B udevinfo +allows users to query the udev database for information on any of the devices +currently present in the system. It also provides a way to query any device +in the sysfs tree to help in creating +.B udev +rule files. +.SH "OPTIONS" +.TP +.B -V +Print the version information. +.TP +.B -r +Print the the +.B udev_root +directory. When used in conjunction with a query for the node name, the +.B udev_root +will be prepended. +.TP +.BI -q " query_type" +Query the database for specified value of a created device node. +Valid types are: +.BR name ", " symlink ", " owner " , " group " or " path. +.TP +.BI -p " sysfs_path" +Specify the sysfs path of the device to query. +.TP +.BI -n " name" +Specify the name of the node for the device to query. +.TP +.B -d +Dump the whole database. +.TP +.B -h +Print help text. +.SH "FILES" +.nf +/etc/udev/* udev config files +.fi +.LP +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevinfo +was developed primarily by Kay Sievers , with help +from others. -- cgit v1.2.3-54-g00ecf From 05c0c9da0b49d53ce5cf8e3f20a17e3b7b1566e1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:56:43 -0800 Subject: [PATCH] remove command line documentation from udev man page --- udev.8 | 38 +------------------------------------- 1 file changed, 1 insertion(+), 37 deletions(-) diff --git a/udev.8 b/udev.8 index 9a597276c6..0c8f2b1e60 100644 --- a/udev.8 +++ b/udev.8 @@ -3,9 +3,6 @@ udev \- Linux configurable dynamic device naming support .SH SYNOPSIS .BI udev " hotplug-subsystem" -.br -.B udev -.RI "[-q " query_type " -p " sysfs_path "] [-drVh]" .SH "DESCRIPTION" .B udev creates or removes device node files usually located in the /dev directory. @@ -29,40 +26,6 @@ maintains a database for devices present on the system. On device removal, .B udev queries its database for the name of the device file to be deleted. -.SH "OPTIONS" -.B udev -normally is called by -.B hotplug -with the subsystem as argument and various environment variables set. -.br -It may also called with the following options: -.TP -.B -V -Print the version information. -.TP -.B -r -Print the the -.B udev_root -directory. When used in conjunction with a query for the node name, the -.B udev_root -will be prepended. -.TP -.BI -q " query_type" -Query the database for specified value of a created device node. -Valid types are: -.BR name ", " symlink ", " owner " , " group " or " path. -.TP -.BI -p " sysfs_path" -Specify the sysfs path of the device to query. -.TP -.BI -n " name" -Specify the name of the node for the device to query. -.TP -.B -d -Dump the whole database. -.TP -.B -h -Print help text. .SH "CONFIGURATION" All .B udev @@ -296,6 +259,7 @@ following the '[' is a '!' then any character not enclosed is matched. .fi .LP .SH "SEE ALSO" +.BR udevinfo (8), .BR hotplug (8) .PP The -- cgit v1.2.3-54-g00ecf From 567f6d14e8dec7d252601b90808c320b136d6e60 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 19:56:59 -0800 Subject: [PATCH] add udevinfo man page to spec file. --- udev.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udev.spec b/udev.spec index b9a20ac5fd..b622237e67 100644 --- a/udev.spec +++ b/udev.spec @@ -97,12 +97,13 @@ rm -rf $RPM_BUILD_ROOT %endif %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(755,root,root) /etc/init.d/udev -%attr(0644,root,root) %{_mandir}/man8/udev.8* +%attr(0644,root,root) %{_mandir}/man8/udev*.8* %changelog * Mon Jan 26 2004 Greg Kroah-Hartman -- add udevinfo to rpm +- added udevinfo to rpm - added URL to spec file +- added udevinfo's man page * Mon Jan 05 2004 Rolf Eike Beer - add defines to choose the init script (Redhat or LSB) -- cgit v1.2.3-54-g00ecf From 28706bd9a1110f00f40888251425eea6e4bc22e1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 20:04:26 -0800 Subject: [PATCH] clean up udevinfo on 'make clean' --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0fa39d7a41..2712f265f5 100644 --- a/Makefile +++ b/Makefile @@ -263,7 +263,7 @@ $(SENDER): udevd.h udevsend.o udevd.o logging.o clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(DAEMON) $(SENDER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(HELPER) $(DAEMON) $(SENDER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ -- cgit v1.2.3-54-g00ecf From 125611d9d47bd3a99ed6ce90ed327860de022e8a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 20:17:10 -0800 Subject: [PATCH] update klibc to version 0.98 --- klibc/klibc/SYSCALLS | 8 ++ klibc/klibc/arch/i386/include/sys/io.h | 126 +++++++++++++++++++++++++++++++ klibc/klibc/arch/i386/include/sys/vm86.h | 41 ++++++++++ klibc/klibc/arch/x86_64/include/sys/io.h | 126 +++++++++++++++++++++++++++++++ klibc/klibc/fopen.c | 12 +-- klibc/klibc/include/stdio.h | 11 ++- klibc/klibc/include/unistd.h | 1 + klibc/klibc/makeerrlist.pl | 2 +- klibc/klibc/syscommon.h | 4 + klibc/version | 2 +- 10 files changed, 320 insertions(+), 13 deletions(-) create mode 100644 klibc/klibc/arch/i386/include/sys/io.h create mode 100644 klibc/klibc/arch/i386/include/sys/vm86.h create mode 100644 klibc/klibc/arch/x86_64/include/sys/io.h diff --git a/klibc/klibc/SYSCALLS b/klibc/klibc/SYSCALLS index 0be1b4425a..00883cc098 100644 --- a/klibc/klibc/SYSCALLS +++ b/klibc/klibc/SYSCALLS @@ -71,6 +71,7 @@ int chdir(const char *) int rename(const char *, const char *) int mknod(const char *, mode_t, dev_t) int chmod(const char *, mode_t) +int fchmod(int, mode_t) int mkdir(const char *, mode_t) int rmdir(const char *) int pipe(int *) @@ -144,3 +145,10 @@ long delete_module(const char *, unsigned int) int query_module(const char *, int, void *, size_t, size_t) int reboot::__reboot(int, int, int, void *) int syslog::klogctl(int, char *, int) + +# +# Low-level I/O (generally architecture-specific) +# + int iopl(int) + int ioperm(unsigned long, unsigned long, int) + int vm86(struct vm86_struct *) diff --git a/klibc/klibc/arch/i386/include/sys/io.h b/klibc/klibc/arch/i386/include/sys/io.h new file mode 100644 index 0000000000..b051464dfc --- /dev/null +++ b/klibc/klibc/arch/i386/include/sys/io.h @@ -0,0 +1,126 @@ +#ident "$Id: io.h,v 1.2 2004/01/25 07:49:39 hpa Exp $" +/* ----------------------------------------------------------------------- * + * + * Copyright 2004 H. Peter Anvin - All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall + * be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * ----------------------------------------------------------------------- */ + +/* + * sys/io.h for the i386 architecture + * + * Basic I/O macros + */ + +#ifndef _SYS_IO_H +#define _SYS_IO_H 1 + +/* I/O-related system calls */ + +int iopl(int); +int ioperm(unsigned long, unsigned long, int); + +/* Basic I/O macros */ + +static __inline__ void +outb(unsigned char __v, unsigned short __p) +{ + asm volatile("outb %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ void +outw(unsigned short __v, unsigned short __p) +{ + asm volatile("outw %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ void +outl(unsigned int __v, unsigned short __p) +{ + asm volatile("outl %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ unsigned char +inb(unsigned short __p) +{ + unsigned char __v; + asm volatile("inb %1,%0" : "=a" (__v) : "dN" (__p)); + return __v; +} + +static __inline__ unsigned short +inw(unsigned short __p) +{ + unsigned short __v; + asm volatile("inw %1,%0" : "=a" (__v) : "dN" (__p)); + return __v; +} + +static __inline__ unsigned int +inl(unsigned short __p) +{ + unsigned int __v; + asm volatile("inl %1,%0" : "=a" (__v) : "dN" (__p)); + return __v; +} + +/* String I/O macros */ + +static __inline__ void +outsb (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsb" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +outsw (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsw" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +outsl (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsl" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + + +static __inline__ void +insb (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insb" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +insw (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insw" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +insl (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insl" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +#endif /* _SYS_IO_H */ diff --git a/klibc/klibc/arch/i386/include/sys/vm86.h b/klibc/klibc/arch/i386/include/sys/vm86.h new file mode 100644 index 0000000000..d3272393dc --- /dev/null +++ b/klibc/klibc/arch/i386/include/sys/vm86.h @@ -0,0 +1,41 @@ +#ident "$Id: vm86.h,v 1.1 2004/01/25 01:34:28 hpa Exp $" +/* ----------------------------------------------------------------------- * + * + * Copyright 2004 H. Peter Anvin - All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall + * be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * ----------------------------------------------------------------------- */ + +/* + * sys/vm86.h for i386 + */ + +#ifndef _SYS_VM86_H +#define _SYS_VM86_H 1 + +#include + +/* Actual system call */ +int vm86(struct vm86_struct *); + +#endif diff --git a/klibc/klibc/arch/x86_64/include/sys/io.h b/klibc/klibc/arch/x86_64/include/sys/io.h new file mode 100644 index 0000000000..4a0ae44985 --- /dev/null +++ b/klibc/klibc/arch/x86_64/include/sys/io.h @@ -0,0 +1,126 @@ +#ident "$Id: io.h,v 1.1 2004/01/25 01:34:29 hpa Exp $" +/* ----------------------------------------------------------------------- * + * + * Copyright 2004 H. Peter Anvin - All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall + * be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * ----------------------------------------------------------------------- */ + +/* + * sys/io.h for the i386 architecture + * + * Basic I/O macros + */ + +#ifndef _SYS_IO_H +#define _SYS_IO_H 1 + +/* I/O-related system calls */ + +int iopl(int); +int ioperm(unsigned long, unsigned long, int); + +/* Basic I/O macros */ + +static __inline__ void +outb(unsigned char __v, unsigned short __p) +{ + asm volatile("outb %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ void +outw(unsigned short __v, unsigned short __p) +{ + asm volatile("outw %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ void +outl(unsigned int __v, unsigned short __p) +{ + asm volatile("outl %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ unsigned char +inb(unsigned short __p) +{ + unsigned char __v; + asm volatile("inb %1,%0" : "=a" (__v) : "dN" (__p)); + return v; +} + +static __inline__ unsigned short +inw(unsigned short __p) +{ + unsigned short __v; + asm volatile("inw %1,%0" : "=a" (__v) : "dN" (__p)); + return v; +} + +static __inline__ unsigned int +inl(unsigned short __p) +{ + unsigned int __v; + asm volatile("inl %1,%0" : "=a" (__v) : "dN" (__p)); + return v; +} + +/* String I/O macros */ + +static __inline__ void +outsb (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsb" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +outsw (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsw" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +outsl (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsl" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + + +static __inline__ void +insb (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insb" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +insw (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insw" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +insl (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insl" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +#endif /* _SYS_IO_H */ diff --git a/klibc/klibc/fopen.c b/klibc/klibc/fopen.c index 5c84184809..ee62c68bd7 100644 --- a/klibc/klibc/fopen.c +++ b/klibc/klibc/fopen.c @@ -13,10 +13,9 @@ FILE *fopen(const char *file, const char *mode) { int flags = O_RDONLY; int plus = 0; - int fd; while ( *mode ) { - switch ( *mode ) { + switch ( *mode++ ) { case 'r': flags = O_RDONLY; break; @@ -30,17 +29,12 @@ FILE *fopen(const char *file, const char *mode) plus = 1; break; } - mode++; } if ( plus ) { flags = (flags & ~(O_RDONLY|O_WRONLY)) | O_RDWR; } - fd = open(file, flags, 0666); - - if ( fd < 0 ) - return NULL; - else - return fdopen(fd, mode); + /* Note: __create_file(-1) == NULL, so this is safe */ + return __create_file(open(file, flags, 0666)); } diff --git a/klibc/klibc/include/stdio.h b/klibc/klibc/include/stdio.h index f57439f018..31a1fe40af 100644 --- a/klibc/klibc/include/stdio.h +++ b/klibc/klibc/include/stdio.h @@ -31,15 +31,22 @@ typedef struct _IO_file FILE; #define SEEK_CUR 1 #define SEEK_END 2 +/* + * Convert between a FILE * and a file descriptor. We don't actually + * have any in-memory data, so we just abuse the pointer itself to + * hold the data. Note, however, that for file descriptors, -1 is + * error and 0 is a valid value; for FILE *, NULL (0) is error and + * non-NULL are valid. + */ static __inline__ int fileno(FILE *__f) { /* This should really be intptr_t, but size_t should be the same size */ - return (int)(size_t)__f; + return (int)(size_t)__f - 1; } static __inline__ FILE * __create_file(int __fd) { - return (FILE *)(size_t)__fd; + return (FILE *)(size_t)(__fd + 1); } __extern FILE *fopen(const char *, const char *); diff --git a/klibc/klibc/include/unistd.h b/klibc/klibc/include/unistd.h index 36c486f49d..ad12913834 100644 --- a/klibc/klibc/include/unistd.h +++ b/klibc/klibc/include/unistd.h @@ -54,6 +54,7 @@ __extern int link(const char *, const char *); __extern int unlink(const char *); __extern int chdir(const char *); __extern int chmod(const char *, mode_t); +__extern int fchmod(int, mode_t); __extern int mkdir(const char *, mode_t); __extern int rmdir(const char *); __extern int pipe(int *); diff --git a/klibc/klibc/makeerrlist.pl b/klibc/klibc/makeerrlist.pl index 121ed1f46b..00acb8a3d5 100644 --- a/klibc/klibc/makeerrlist.pl +++ b/klibc/klibc/makeerrlist.pl @@ -10,7 +10,7 @@ use FileHandle; %errors = (); %errmsg = (); $maxerr = -1; -$rootdir = 'linux/include/'; # Must have trailing / +$rootdir = '../linux/include/'; # Must have trailing / sub parse_file($) { my($file) = @_; diff --git a/klibc/klibc/syscommon.h b/klibc/klibc/syscommon.h index 916d4eb0c0..3093920739 100644 --- a/klibc/klibc/syscommon.h +++ b/klibc/klibc/syscommon.h @@ -26,3 +26,7 @@ #include #include #include + +#ifdef __i386__ +#include +#endif diff --git a/klibc/version b/klibc/version index fd6d73e4a0..0f6db3dda2 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.95 +0.98 -- cgit v1.2.3-54-g00ecf From 46a7fa4bdbce640c76b0a582e3afadc53b8cffd2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 20:23:55 -0800 Subject: [PATCH] v015 release --- ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 534fff49e9..3a4b2c0099 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +Summary of changes from v014 to v015 +============================================ + +: + o LFS init script update + +Greg Kroah-Hartman: + o update klibc to version 0.98 + o clean up udevinfo on 'make clean' + o add udevinfo man page to spec file + o remove command line documentation from udev man page + o create initial version of udevinfo man page + o added URL to spec file + o add udevinfo to udev.spec file + o add udevinfo to install target of Makefile + o rip out command line code from udev, now that we have udevinfo + o udevinfo doesn't need to declare main_envp + o move get_pair to udev_config.c because udevinfo doesn't need all of namedev.o + o more makefile cleanups + o move udevinfo into the main build and clean up the main Makefile a bit + o clean up compiler warnings if building using klibc + o make udevd only have one instance running at a time + o new testd.block script for debugging + o udevsnd : clean up message creation logic a bit + o make bk ignore udevd and udevsend binaries + o whitespace cleanups + o remove TODO item about BUS value, as it is now done + o add support for figuring out which device on the sysfs "chain" the rule applies to + +Kay Sievers: + o udevinfo - now a real program :) + o udevd - cleanup and better timeout handling + o udev - next round of udev event order daemon + o fix udevd exec + o udev - udevinfo with device chain walk + o spilt udev into pieces + + Summary of changes from v013 to v014 ============================================ diff --git a/Makefile b/Makefile index 2712f265f5..88b61d6be6 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ ROOT = udev DAEMON = udevd SENDER = udevsend HELPER = udevinfo -VERSION = 014_bk +VERSION = 015 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index b622237e67..fba731fc36 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 014_bk +Version: 015 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From ff2c16f0d1ee459b7bd002f4f9d5e41390c9a21d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 26 Jan 2004 23:54:46 -0800 Subject: [PATCH] allow dbus code to actually build again. --- udev_dbus.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_dbus.c b/udev_dbus.c index 947a5c1b5d..da633a31a1 100644 --- a/udev_dbus.c +++ b/udev_dbus.c @@ -12,6 +12,7 @@ #include "udev.h" #include "udev_version.h" #include "udev_dbus.h" +#include "logging.h" /** variable for the connection the to system message bus or #NULL -- cgit v1.2.3-54-g00ecf From 8af67a67c2542a9d4eb2371dfba661c65d48d4b6 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 27 Jan 2004 00:40:06 -0800 Subject: [PATCH] 015_bk mark --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 88b61d6be6..d43899b9ed 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ ROOT = udev DAEMON = udevd SENDER = udevsend HELPER = udevinfo -VERSION = 015 +VERSION = 015_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index fba731fc36..ccc0ca7f6a 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 015 +Version: 015_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 2a25816ff0079247d7f868621951739e6d58c885 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 27 Jan 2004 00:40:12 -0800 Subject: [PATCH] udev - trivial style cleanup Trivial style cleanup, to be consistent. And add chdir("/") to the daemon so one can umout its filesystem, while we are running :) --- namedev.c | 24 ++++++++++-------------- udevinfo.c | 2 +- udevsend.c | 1 + 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/namedev.c b/namedev.c index 6b1aa297ea..de7f7c1b88 100644 --- a/namedev.c +++ b/namedev.c @@ -332,12 +332,8 @@ static int execute_program(char *path, char *value, int len) return -1; } pid = fork(); - if (pid == -1) { - dbg("fork failed"); - return -1; - } - - if (pid == 0) { + switch(pid) { + case 0: /* child */ close(STDOUT_FILENO); dup(fds[1]); /* dup write side of pipe to STDOUT */ @@ -353,16 +349,16 @@ static int execute_program(char *path, char *value, int len) dbg("too many args - %d", i); args[i] = NULL; } - retval = execve(args[0], args, main_envp); + retval = execv(args[0], args); } else { - retval = execve(path, main_argv, main_envp); - } - if (retval != 0) { - dbg("child execve failed"); - exit(1); + retval = execv(path, main_argv); } - return -1; /* avoid compiler warning */ - } else { + dbg("child execve failed"); + exit(1); + case -1: + dbg("fork failed"); + return -1; + default: /* parent reads from fds[0] */ close(fds[1]); retval = 0; diff --git a/udevinfo.c b/udevinfo.c index aa9d20a773..4d28755b2f 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -397,7 +397,7 @@ help: " -n NAME node name used for query\n" "\n" " -r print udev root\n" - " -a print all attributes along the chain of the device\n" + " -a print all SYSFS_attributes along the device chain\n" " -d dump whole database\n" " -V print udev version\n" " -h print this help text\n" diff --git a/udevsend.c b/udevsend.c index 3f3bbacbc2..0a305e50c4 100644 --- a/udevsend.c +++ b/udevsend.c @@ -87,6 +87,7 @@ static int start_daemon(void) case 0: /* daemon */ setsid(); + chdir("/"); execl(UDEVD_EXEC, "udevd", NULL); dbg("exec of daemon failed"); exit(1); -- cgit v1.2.3-54-g00ecf From 01fc67683a88d4175a9437fb24e3b99e83eeb3ef Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 27 Jan 2004 00:40:14 -0800 Subject: [PATCH] udevinfo - missing options for man page Here are the missing udevinfo options for the new man page. --- udevinfo.8 | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/udevinfo.8 b/udevinfo.8 index 852e2ae93f..fdb0e6f62b 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -25,8 +25,10 @@ will be prepended. .TP .BI -q " query_type" Query the database for specified value of a created device node. +.RB Needs " -p " or " -n " specified. +.br Valid types are: -.BR name ", " symlink ", " owner " , " group " or " path. +.BR name ", " symlink ", " mode " ," owner " , " group " or " path. .TP .BI -p " sysfs_path" Specify the sysfs path of the device to query. @@ -34,6 +36,13 @@ Specify the sysfs path of the device to query. .BI -n " name" Specify the name of the node for the device to query. .TP +.B -a +Print all +.BI SYSFS_ filename +attributes along the device chain. Useful for for finding +unique attributes to compose a rule. +.RB Needs " -p " specified. +.TP .B -d Dump the whole database. .TP -- cgit v1.2.3-54-g00ecf From 34ee4dd4553160b082b6bc44a6e5be74787cd085 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 27 Jan 2004 18:54:24 -0800 Subject: [PATCH] fix Makefile typo for USE_LSB install. Thanks to Martin Schwenke for pointing this out. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d43899b9ed..c68fd37312 100644 --- a/Makefile +++ b/Makefile @@ -339,7 +339,7 @@ install: install-config install-dbus-policy all $(INSTALL_PROGRAM) -D $(HELPER) $(DESTDIR)$(sbindir)/$(HELPER) @if [ "x$(USE_LSB)" = "xtrue" ]; then \ $(INSTALL_PROGRAM) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ - ln -s $(DESTDIR)$(initdir)/udev $(sbin_dir)/rcudev; \ + ln -s $(DESTDIR)$(initdir)/udev $(sbindir)/rcudev; \ else \ $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ fi -- cgit v1.2.3-54-g00ecf From 35b7d88c0dab4c1104c127ddd644db22307949c9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 27 Jan 2004 18:57:36 -0800 Subject: [PATCH] udevd - next round of fixes Here is the next round. We have three queues now. All incoming messages are queued in msg_list and if nothing is missing we move it to the running_list and exec in the background. If the exec comes back, it removes the message from the running_list and frees the message. Before we exec, we check the running_list if there is a udev running on the same device path. If yes, we move the message to the delay_list. If the former exec comes back, we move the message to the running_list and exec it. The very first event is delayed now to catch possible earlier sequences, every following event is executed without delay if no sequence is missing. The daemon doesn't exit by itself any longer, cause we don't want to delay every first exec. I've put a $(PWD) for now in the Makefile for testing this beast. Only the local binaries are executed, not the /sbin/udev. We can change it if we are ready for real testing. And SIGKILL can't be cought, so I removed it from the handler :) 06:58:36 sig_handler: caught signal 15 06:58:36 main: using ipc queue 0x2d548 06:58:37 message is still in the ipc queue, starting daemon... 06:58:37 work: received sequence 3, expected sequence 0 06:58:37 msg_dump_queue: sequence 3 in queue 06:58:37 set_timeout: set timeout in 1 seconds 06:58:37 main: using ipc queue 0x2d548 06:58:37 main: using ipc queue 0x2d548 06:58:37 work: received sequence 1, expected sequence 1 06:58:37 msg_dump_queue: sequence 1 in queue 06:58:37 msg_dump_queue: sequence 3 in queue 06:58:37 msg_dump: sequence 1, 'add', '/block/sda', 'block' 06:58:37 msg_exec: child [8038] created 06:58:37 running_moveto_queue: move sequence 1 [8038] to running queue '/block/sda' 06:58:37 set_timeout: set timeout in 5 seconds 06:58:37 work: received sequence 2, expected sequence 2 06:58:37 msg_dump_queue: sequence 2 in queue 06:58:37 msg_dump_queue: sequence 3 in queue 06:58:37 msg_dump: sequence 2, 'add', '/block/sdb', 'block' 06:58:37 msg_exec: child [8039] created 06:58:37 running_moveto_queue: move sequence 2 [8039] to running queue '/block/sdb' 06:58:37 msg_dump: sequence 3, 'add', '/block/sdc', 'block' 06:58:37 msg_exec: child [8040] created 06:58:37 running_moveto_queue: move sequence 3 [8040] to running queue '/block/sdc' 06:58:37 main: using ipc queue 0x2d548 06:58:37 main: using ipc queue 0x2d548 06:58:37 work: received sequence 4, expected sequence 4 06:58:37 msg_dump_queue: sequence 4 in queue 06:58:37 msg_dump: sequence 4, 'remove', '/block/sdc', 'block' 06:58:37 msg_exec: delay exec of sequence 4, [8040] already working on '/block/sdc' 06:58:37 delayed_moveto_queue: move event to delayed queue '/block/sdc' 06:58:37 msg_exec: child [8043] created 06:58:37 running_moveto_queue: move sequence 4 [8043] to running queue '/block/sdc' 06:58:37 work: received sequence 5, expected sequence 5 06:58:37 msg_dump_queue: sequence 5 in queue 06:58:37 msg_dump: sequence 5, 'remove', '/block/sdb', 'block' 06:58:37 msg_exec: delay exec of sequence 5, [8039] already working on '/block/sdb' 06:58:37 delayed_moveto_queue: move event to delayed queue '/block/sdb' 06:58:37 msg_exec: child [8044] created 06:58:37 running_moveto_queue: move sequence 5 [8044] to running queue '/block/sdb' 06:58:37 main: using ipc queue 0x2d548 06:58:37 main: using ipc queue 0x2d548 06:58:37 work: received sequence 8, expected sequence 6 06:58:37 msg_dump_queue: sequence 8 in queue 06:58:37 set_timeout: set timeout in 5 seconds 06:58:37 work: received sequence 6, expected sequence 6 06:58:37 msg_dump_queue: sequence 6 in queue 06:58:37 msg_dump_queue: sequence 8 in queue 06:58:37 msg_dump: sequence 6, 'remove', '/block/sda', 'block' 06:58:37 msg_exec: delay exec of sequence 6, [8038] already working on '/block/sda' 06:58:37 delayed_moveto_queue: move event to delayed queue '/block/sda' 06:58:37 msg_exec: child [8047] created 06:58:37 running_moveto_queue: move sequence 6 [8047] to running queue '/block/sda' 06:58:37 set_timeout: set timeout in 5 seconds 06:58:38 sig_handler: caught signal 17 06:58:38 sig_handler: exec finished, pid 8038 06:58:38 set_timeout: set timeout in 4 seconds 06:58:38 msg_dump_queue: sequence 8 in queue 06:58:38 sig_handler: caught signal 17 06:58:38 sig_handler: exec finished, pid 8039 06:58:38 set_timeout: set timeout in 4 seconds 06:58:38 msg_dump_queue: sequence 8 in queue 06:58:38 sig_handler: caught signal 17 06:58:38 sig_handler: exec finished, pid 8040 06:58:38 set_timeout: set timeout in 4 seconds 06:58:38 msg_dump_queue: sequence 8 in queue 06:58:38 sig_handler: caught signal 17 06:58:38 sig_handler: exec finished, pid 8043 06:58:38 set_timeout: set timeout in 4 seconds 06:58:38 msg_dump_queue: sequence 8 in queue 06:58:38 sig_handler: caught signal 17 06:58:38 sig_handler: exec finished, pid 8044 06:58:38 set_timeout: set timeout in 4 seconds 06:58:38 msg_dump_queue: sequence 8 in queue 06:58:38 sig_handler: caught signal 17 06:58:38 sig_handler: exec finished, pid 8047 06:58:38 set_timeout: set timeout in 4 seconds 06:58:38 msg_dump_queue: sequence 8 in queue 06:58:39 main: using ipc queue 0x2d548 06:58:39 main: using ipc queue 0x2d548 06:58:39 work: received sequence 9, expected sequence 7 06:58:39 msg_dump_queue: sequence 8 in queue 06:58:39 msg_dump_queue: sequence 9 in queue 06:58:39 set_timeout: set timeout in 3 seconds 06:58:39 work: received sequence 11, expected sequence 7 06:58:39 msg_dump_queue: sequence 8 in queue 06:58:39 msg_dump_queue: sequence 9 in queue 06:58:39 msg_dump_queue: sequence 11 in queue 06:58:39 set_timeout: set timeout in 3 seconds 06:58:39 main: using ipc queue 0x2d548 06:58:39 work: received sequence 10, expected sequence 7 06:58:39 msg_dump_queue: sequence 8 in queue 06:58:39 msg_dump_queue: sequence 9 in queue 06:58:39 msg_dump_queue: sequence 10 in queue 06:58:39 msg_dump_queue: sequence 11 in queue 06:58:39 set_timeout: set timeout in 3 seconds 06:58:39 main: using ipc queue 0x2d548 06:58:39 work: received sequence 13, expected sequence 7 06:58:39 msg_dump_queue: sequence 8 in queue 06:58:39 msg_dump_queue: sequence 9 in queue 06:58:39 msg_dump_queue: sequence 10 in queue 06:58:39 msg_dump_queue: sequence 11 in queue 06:58:39 msg_dump_queue: sequence 13 in queue 06:58:39 set_timeout: set timeout in 3 seconds 06:58:39 main: using ipc queue 0x2d548 06:58:39 work: received sequence 14, expected sequence 7 06:58:39 msg_dump_queue: sequence 8 in queue 06:58:39 msg_dump_queue: sequence 9 in queue 06:58:39 msg_dump_queue: sequence 10 in queue 06:58:39 msg_dump_queue: sequence 11 in queue 06:58:39 msg_dump_queue: sequence 13 in queue 06:58:39 msg_dump_queue: sequence 14 in queue 06:58:39 set_timeout: set timeout in 3 seconds 06:58:39 main: using ipc queue 0x2d548 06:58:39 work: received sequence 15, expected sequence 7 06:58:39 msg_dump_queue: sequence 8 in queue 06:58:39 msg_dump_queue: sequence 9 in queue 06:58:39 msg_dump_queue: sequence 10 in queue 06:58:39 msg_dump_queue: sequence 11 in queue 06:58:39 msg_dump_queue: sequence 13 in queue 06:58:39 msg_dump_queue: sequence 14 in queue 06:58:39 msg_dump_queue: sequence 15 in queue 06:58:39 set_timeout: set timeout in 3 seconds 06:58:41 main: using ipc queue 0x2d548 06:58:41 work: received sequence 12, expected sequence 7 06:58:41 msg_dump_queue: sequence 8 in queue 06:58:41 msg_dump_queue: sequence 9 in queue 06:58:41 msg_dump_queue: sequence 10 in queue 06:58:41 msg_dump_queue: sequence 11 in queue 06:58:41 msg_dump_queue: sequence 12 in queue 06:58:41 msg_dump_queue: sequence 13 in queue 06:58:41 msg_dump_queue: sequence 14 in queue 06:58:41 msg_dump_queue: sequence 15 in queue 06:58:41 set_timeout: set timeout in 1 seconds 06:58:42 sig_handler: caught signal 14 06:58:42 sig_handler: event timeout reached 06:58:42 event 8, age 5 seconds, skip event 7-7 06:58:42 msg_dump: sequence 8, 'add', '/block/sdb', 'block' 06:58:42 msg_exec: child [8057] created 06:58:42 running_moveto_queue: move sequence 8 [8057] to running queue '/block/sdb' 06:58:42 msg_dump: sequence 9, 'add', '/block/sdc', 'block' 06:58:42 msg_exec: child [8058] created 06:58:42 running_moveto_queue: move sequence 9 [8058] to running queue '/block/sdc' 06:58:42 msg_dump: sequence 10, 'remove', '/block/sdc', 'block' 06:58:42 msg_exec: delay exec of sequence 10, [8058] already working on '/block/sdc' 06:58:42 delayed_moveto_queue: move event to delayed queue '/block/sdc' 06:58:42 msg_exec: child [8059] created 06:58:42 running_moveto_queue: move sequence 10 [8059] to running queue '/block/sdc' 06:58:42 msg_dump: sequence 11, 'remove', '/block/sdb', 'block' 06:58:42 msg_exec: delay exec of sequence 11, [8057] already working on '/block/sdb' 06:58:42 delayed_moveto_queue: move event to delayed queue '/block/sdb' 06:58:42 msg_exec: child [8060] created 06:58:42 running_moveto_queue: move sequence 11 [8060] to running queue '/block/sdb' 06:58:42 msg_dump: sequence 12, 'remove', '/block/sda', 'block' 06:58:42 msg_exec: child [8061] created 06:58:42 running_moveto_queue: move sequence 12 [8061] to running queue '/block/sda' 06:58:42 msg_dump: sequence 13, 'add', '/block/sda', 'block' 06:58:42 msg_exec: delay exec of sequence 13, [8061] already working on '/block/sda' 06:58:42 delayed_moveto_queue: move event to delayed queue '/block/sda' 06:58:42 msg_exec: child [8062] created 06:58:42 running_moveto_queue: move sequence 13 [8062] to running queue '/block/sda' 06:58:42 msg_dump: sequence 14, 'add', '/block/sdb', 'block' 06:58:42 msg_exec: delay exec of sequence 14, [8057] already working on '/block/sdb' 06:58:42 delayed_moveto_queue: move event to delayed queue '/block/sdb' 06:58:42 msg_exec: child [8063] created 06:58:42 running_moveto_queue: move sequence 14 [8063] to running queue '/block/sdb' 06:58:42 msg_dump: sequence 15, 'add', '/block/sdc', 'block' 06:58:42 msg_exec: delay exec of sequence 15, [8058] already working on '/block/sdc' 06:58:42 delayed_moveto_queue: move event to delayed queue '/block/sdc' 06:58:42 msg_exec: child [8064] created 06:58:42 running_moveto_queue: move sequence 15 [8064] to running queue '/block/sdc' 06:58:43 sig_handler: caught signal 17 06:58:43 sig_handler: exec finished, pid 8057 06:58:43 sig_handler: exec finished, pid 8058 06:58:43 sig_handler: caught signal 17 06:58:43 sig_handler: exec finished, pid 8059 06:58:43 sig_handler: caught signal 17 06:58:43 sig_handler: exec finished, pid 8060 06:58:43 sig_handler: exec finished, pid 8061 06:58:43 sig_handler: caught signal 17 06:58:43 sig_handler: exec finished, pid 8062 06:58:43 sig_handler: caught signal 17 06:58:43 sig_handler: exec finished, pid 8063 06:58:43 sig_handler: caught signal 17 06:58:43 sig_handler: exec finished, pid 8064 --- Makefile | 2 + test/udevd_test.sh | 55 ++++++++++++---- udev.c | 2 - udevd.c | 188 ++++++++++++++++++++++++++++++++++++----------------- udevd.h | 10 +-- udevsend.c | 10 +-- 6 files changed, 185 insertions(+), 82 deletions(-) diff --git a/Makefile b/Makefile index c68fd37312..8af6ecf638 100644 --- a/Makefile +++ b/Makefile @@ -232,6 +232,8 @@ udev_version.h: @echo \#define UDEV_CONFIG_FILE \"$(configdir)\udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)\udev.rules\" >> $@ @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ + @echo \#define UDEV_BIN \"$(PWD)/udev\" >> $@ + @echo \#define UDEVD_BIN \"$(PWD)/udevd\" >> $@ # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf diff --git a/test/udevd_test.sh b/test/udevd_test.sh index 0c7bd431be..94698085ca 100644 --- a/test/udevd_test.sh +++ b/test/udevd_test.sh @@ -3,7 +3,12 @@ # kill daemon, first event will start it again killall udevd -# connect(123) - disconnect(456) - connect(789) sequence of sda/sdb/sdc +# 3 x connect/disconnect sequence of sda/sdb/sdc + +export SEQNUM=3 +export ACTION=add +export DEVPATH=/block/sdc +./udevsend block export SEQNUM=1 export ACTION=add @@ -17,36 +22,64 @@ export DEVPATH=/block/sdb export SEQNUM=4 export ACTION=remove -export DEVPATH=/block/sda -./udevsend block - -export SEQNUM=3 -export ACTION=add export DEVPATH=/block/sdc ./udevsend block -export SEQNUM=6 +export SEQNUM=5 export ACTION=remove -export DEVPATH=/block/sdc +export DEVPATH=/block/sdb ./udevsend block -export SEQNUM=5 -export ACTION=remove +export SEQNUM=8 +export ACTION=add export DEVPATH=/block/sdb ./udevsend block +export SEQNUM=6 +export ACTION=remove +export DEVPATH=/block/sda +./udevsend block + export SEQNUM=7 export ACTION=add export DEVPATH=/block/sda #./udevsend block +sleep 2 + export SEQNUM=9 export ACTION=add export DEVPATH=/block/sdc ./udevsend block -export SEQNUM=8 +export SEQNUM=11 +export ACTION=remove +export DEVPATH=/block/sdb +./udevsend block + +export SEQNUM=10 +export ACTION=remove +export DEVPATH=/block/sdc +./udevsend block + +export SEQNUM=13 +export ACTION=add +export DEVPATH=/block/sda +./udevsend block + +export SEQNUM=14 export ACTION=add export DEVPATH=/block/sdb ./udevsend block +export SEQNUM=15 +export ACTION=add +export DEVPATH=/block/sdc +./udevsend block + +sleep 2 + +export SEQNUM=12 +export ACTION=remove +export DEVPATH=/block/sda +./udevsend block diff --git a/udev.c b/udev.c index 4c67477c20..38b26916c9 100644 --- a/udev.c +++ b/udev.c @@ -45,7 +45,6 @@ static void sig_handler(int signum) switch (signum) { case SIGINT: case SIGTERM: - case SIGKILL: sysbus_disconnect(); udevdb_exit(); exit(20 + signum); @@ -143,7 +142,6 @@ static int udev_hotplug(int argc, char **argv) /* set up a default signal handler for now */ signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); - signal(SIGKILL, sig_handler); /* initialize the naming deamon */ namedev_init(); diff --git a/udevd.c b/udevd.c index 26e6b23486..a80da5b0d4 100644 --- a/udevd.c +++ b/udevd.c @@ -38,27 +38,42 @@ #include "list.h" #include "udev.h" +#include "udev_version.h" #include "udevd.h" #include "logging.h" + #define BUFFER_SIZE 1024 +static int running_remove_queue(pid_t pid); +static int msg_exec(struct hotplug_msg *msg); + static int expect_seqnum = 0; static int lock_file = -1; static char *lock_filename = ".udevd_lock"; LIST_HEAD(msg_list); +LIST_HEAD(running_list); +LIST_HEAD(delayed_list); static void sig_handler(int signum) { + pid_t pid; + dbg("caught signal %d", signum); switch (signum) { case SIGALRM: dbg("event timeout reached"); break; + case SIGCHLD: + /* catch signals from exiting childs */ + while ( (pid = waitpid(-1, NULL, WNOHANG)) > 0) { + dbg("exec finished, pid %d", pid); + running_remove_queue(pid); + } + break; case SIGINT: case SIGTERM: - case SIGKILL: if (lock_file >= 0) { close(lock_file); unlink(lock_filename); @@ -70,34 +85,104 @@ static void sig_handler(int signum) } } -static void dump_queue(void) +static void set_timeout(int seconds) { - struct hotplug_msg *msg; + alarm(seconds); + dbg("set timeout in %d seconds", seconds); +} - list_for_each_entry(msg, &msg_list, list) - dbg("sequence %d in queue", msg->seqnum); +static int running_moveto_queue(struct hotplug_msg *msg) +{ + dbg("move sequence %d [%d] to running queue '%s'", + msg->seqnum, msg->pid, msg->devpath); + list_move_tail(&msg->list, &running_list); + return 0; +} + +static int running_remove_queue(pid_t pid) +{ + struct hotplug_msg *child; + struct hotplug_msg *tmp_child; + + list_for_each_entry_safe(child, tmp_child, &running_list, list) + if (child->pid == pid) { + list_del_init(&child->list); + free(child); + return 0; + } + return -EINVAL; +} + +static pid_t running_getpid_by_devpath(struct hotplug_msg *msg) +{ + struct hotplug_msg *child; + struct hotplug_msg *tmp_child; + + list_for_each_entry_safe(child, tmp_child, &running_list, list) + if (strncmp(child->devpath, msg->devpath, sizeof(child->devpath)) == 0) + return child->pid; + return 0; +} + +static void delayed_dump_queue(void) +{ + struct hotplug_msg *child; + + list_for_each_entry(child, &delayed_list, list) + dbg("event for '%s' in queue", child->devpath); +} + +static int delayed_moveto_queue(struct hotplug_msg *msg) +{ + dbg("move event to delayed queue '%s'", msg->devpath); + list_move_tail(&msg->list, &delayed_list); + return 0; +} + +static void delayed_check_queue(void) +{ + struct hotplug_msg *delayed_child; + struct hotplug_msg *running_child; + struct hotplug_msg *tmp_child; + + /* see if we have delayed exec's that can run now */ + list_for_each_entry_safe(delayed_child, tmp_child, &delayed_list, list) + list_for_each_entry_safe(running_child, tmp_child, &running_list, list) + if (strncmp(delayed_child->devpath, running_child->devpath, + sizeof(running_child->devpath)) == 0) { + dbg("delayed exec for '%s' can run now", delayed_child->devpath); + msg_exec(delayed_child); + } } -static void dump_msg(struct hotplug_msg *msg) +static void msg_dump(struct hotplug_msg *msg) { dbg("sequence %d, '%s', '%s', '%s'", msg->seqnum, msg->action, msg->devpath, msg->subsystem); } -static int dispatch_msg(struct hotplug_msg *msg) +static int msg_exec(struct hotplug_msg *msg) { pid_t pid; - dump_msg(msg); + msg_dump(msg); setenv("ACTION", msg->action, 1); setenv("DEVPATH", msg->devpath, 1); + /* delay exec, if we already have a udev working on the same devpath */ + pid = running_getpid_by_devpath(msg); + if (pid != 0) { + dbg("delay exec of sequence %d, [%d] already working on '%s'", + msg->seqnum, pid, msg->devpath); + delayed_moveto_queue(msg); + } + pid = fork(); switch (pid) { case 0: /* child */ - execl(UDEV_EXEC, "udev", msg->subsystem, NULL); + execl(UDEV_BIN, "udev", msg->subsystem, NULL); dbg("exec of child failed"); exit(1); break; @@ -105,18 +190,23 @@ static int dispatch_msg(struct hotplug_msg *msg) dbg("fork of child failed"); return -1; default: - wait(NULL); + /* exec in background, get the SIGCHLD with the sig handler */ + msg->pid = pid; + running_moveto_queue(msg); + break; } return 0; } -static void set_timeout(int seconds) +static void msg_dump_queue(void) { - alarm(seconds); - dbg("set timeout in %d seconds", seconds); + struct hotplug_msg *msg; + + list_for_each_entry(msg, &msg_list, list) + dbg("sequence %d in queue", msg->seqnum); } -static void check_queue(void) +static void msg_check_queue(void) { struct hotplug_msg *msg; struct hotplug_msg *tmp_msg; @@ -127,30 +217,32 @@ recheck: list_for_each_entry_safe(msg, tmp_msg, &msg_list, list) { if (msg->seqnum != expect_seqnum) break; - dispatch_msg(msg); + msg_exec(msg); expect_seqnum++; - list_del_init(&msg->list); - free(msg); } - /* recalculate timeout */ + /* recalculate next timeout */ if (list_empty(&msg_list) == 0) { msg_age = time(NULL) - msg->queue_time; - if (msg_age > EVENT_TIMEOUT_SECONDS-1) { + if (msg_age > EVENT_TIMEOUT_SEC-1) { info("event %d, age %li seconds, skip event %d-%d", msg->seqnum, msg_age, expect_seqnum, msg->seqnum-1); expect_seqnum = msg->seqnum; goto recheck; } - set_timeout(EVENT_TIMEOUT_SECONDS - msg_age); + + /* the first sequence gets its own timeout */ + if (expect_seqnum == 0) { + msg_age = EVENT_TIMEOUT_SEC - FIRST_EVENT_TIMEOUT_SEC; + expect_seqnum = 1; + } + + set_timeout(EVENT_TIMEOUT_SEC - msg_age); return; } - - /* queue is empty */ - set_timeout(UDEVD_TIMEOUT_SECONDS); } -static int queue_msg(struct hotplug_msg *msg) +static int msg_add_queue(struct hotplug_msg *msg) { struct hotplug_msg *new_msg; struct hotplug_msg *tmp_msg; @@ -182,7 +274,7 @@ static void work(void) char buf[BUFFER_SIZE]; int ret; - key = ftok(UDEVD_EXEC, IPC_KEY_ID); + key = ftok(UDEVD_BIN, IPC_KEY_ID); msg = (struct hotplug_msg *) buf; msgid = msgget(key, IPC_CREAT); if (msgid == -1) { @@ -192,41 +284,20 @@ static void work(void) while (1) { ret = msgrcv(msgid, (struct msgbuf *) buf, BUFFER_SIZE-4, HOTPLUGMSGTYPE, 0); if (ret != -1) { - /* init the expected sequence with value from first call */ - if (expect_seqnum == 0) { - expect_seqnum = msg->seqnum; - dbg("init next expected sequence number to %d", expect_seqnum); - } - dbg("current sequence %d, expected sequence %d", msg->seqnum, expect_seqnum); - if (msg->seqnum == expect_seqnum) { - /* execute expected event */ - dispatch_msg(msg); - expect_seqnum++; - check_queue(); - dump_queue(); + dbg("received sequence %d, expected sequence %d", msg->seqnum, expect_seqnum); + if (msg->seqnum >= expect_seqnum) { + msg_add_queue(msg); + msg_dump_queue(); + msg_check_queue(); continue; } - if (msg->seqnum > expect_seqnum) { - /* something missing, queue event*/ - queue_msg(msg); - check_queue(); - dump_queue(); - continue; - } - dbg("too late for event with sequence %d, even skipped ", msg->seqnum); + dbg("too late for event with sequence %d, event skipped ", msg->seqnum); } else { if (errno == EINTR) { - /* timeout */ - if (list_empty(&msg_list)) { - info("we have nothing to do, so daemon exits..."); - if (lock_file >= 0) { - close(lock_file); - unlink(lock_filename); - } - exit(0); - } - check_queue(); - dump_queue(); + msg_check_queue(); + msg_dump_queue(); + delayed_check_queue(); + delayed_dump_queue(); continue; } dbg("ipc message receive error '%s'", strerror(errno)); @@ -266,11 +337,8 @@ int main(int argc, char *argv[]) /* set up signal handler */ signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); - signal(SIGKILL, sig_handler); signal(SIGALRM, sig_handler); - - /* we exit if we have nothing to do, next event will start us again */ - set_timeout(UDEVD_TIMEOUT_SECONDS); + signal(SIGCHLD, sig_handler); work(); exit(0); diff --git a/udevd.h b/udevd.h index c9b69bbc3c..4bccd4b81a 100644 --- a/udevd.h +++ b/udevd.h @@ -23,18 +23,18 @@ #include "list.h" -#define UDEV_EXEC "./udev" -#define UDEVD_EXEC "./udevd" -#define UDEVD_TIMEOUT_SECONDS 60 -#define EVENT_TIMEOUT_SECONDS 5 +#define FIRST_EVENT_TIMEOUT_SEC 1 +#define EVENT_TIMEOUT_SEC 5 +#define UDEVSEND_RETRY_COUNT 50 /* x 10 millisec */ -#define IPC_KEY_ID 0 +#define IPC_KEY_ID 1 #define HOTPLUGMSGTYPE 44 struct hotplug_msg { long mtype; struct list_head list; + pid_t pid; int seqnum; time_t queue_time; char action[8]; diff --git a/udevsend.c b/udevsend.c index 0a305e50c4..f92ee2b5d8 100644 --- a/udevsend.c +++ b/udevsend.c @@ -34,6 +34,7 @@ #include #include "udev.h" +#include "udev_version.h" #include "udevd.h" #include "logging.h" @@ -64,7 +65,7 @@ static inline char *get_seqnum(void) static int build_hotplugmsg(struct hotplug_msg *msg, char *action, char *devpath, char *subsystem, int seqnum) { - memset(msg, 0x00, sizeof(msg)); + memset(msg, 0x00, sizeof(*msg)); msg->mtype = HOTPLUGMSGTYPE; msg->seqnum = seqnum; strncpy(msg->action, action, 8); @@ -88,7 +89,7 @@ static int start_daemon(void) /* daemon */ setsid(); chdir("/"); - execl(UDEVD_EXEC, "udevd", NULL); + execl(UDEVD_BIN, "udevd", NULL); dbg("exec of daemon failed"); exit(1); case -1: @@ -150,7 +151,8 @@ int main(int argc, char* argv[]) seq = atoi(seqnum); /* create ipc message queue or get id of our existing one */ - key = ftok(UDEVD_EXEC, IPC_KEY_ID); + key = ftok(UDEVD_BIN, IPC_KEY_ID); + dbg("using ipc queue 0x%0x", key); size = build_hotplugmsg(&message, action, devpath, subsystem, seq); msgid = msgget(key, IPC_CREAT); if (msgid == -1) { @@ -168,7 +170,7 @@ int main(int argc, char* argv[]) /* get state of ipc queue */ tspec.tv_sec = 0; tspec.tv_nsec = 10000000; /* 10 millisec */ - loop = 30; + loop = UDEVSEND_RETRY_COUNT; while (loop--) { retval = msgctl(msgid, IPC_STAT, &msg_queue); if (retval == -1) { -- cgit v1.2.3-54-g00ecf From 273636ca8b745ec62d432a4cbf30269f52aedaf4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 28 Jan 2004 18:35:47 -0800 Subject: [PATCH] update to klibc version 0.101, fixing the stdin bug. --- klibc/klibc/Makefile | 12 ++++++------ klibc/klibc/arch/ppc/include/klibc/archsys.h | 24 +++++++++++++++--------- klibc/klibc/getpagesize.c | 26 ++++++++++++++++++++++++++ klibc/klibc/include/stdio.h | 14 ++++++-------- klibc/klibc/include/unistd.h | 2 ++ klibc/klibc/mmap.c | 2 +- klibc/klibc/syscommon.h | 2 +- klibc/version | 2 +- 8 files changed, 58 insertions(+), 26 deletions(-) create mode 100644 klibc/klibc/getpagesize.c diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index 5fc481aa8a..def201524a 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -24,7 +24,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \ __signal.o signal.o bsd_signal.o siglist.o siglongjmp.o \ sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ - brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ + brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o getpagesize.o \ memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ memmove.o \ strcasecmp.o strncasecmp.o strndup.o strerror.o \ @@ -118,12 +118,12 @@ socketcalls.dir: SOCKETCALLS socketcalls.pl socketcommon.h touch $@ %/static.obj: %.dir - $(MAKE) objects-$(basename $(notdir $@)) DIR=$* + $(MAKE) objects-$(basename $(notdir $@)) DIR=$*/ -STATIC = $(addsuffix .o,$(basename $(wildcard $(DIR)/*.[cS]))) +STATIC = $(addsuffix .o,$(basename $(wildcard $(DIR)*.[cS]))) objects-static: $(STATIC) - touch $(DIR)/static.obj + touch $(DIR)static.obj clean: archclean find . -type f -a \( -name \*.[isoa] -o -name \*.l[iso] \) -print0 | xargs -0rt rm -f @@ -140,6 +140,6 @@ spotless: clean bitsize: @echo $(BITSIZE) -ifneq ($(wildcard $(DIR)/.*.d),) -include $(wildcard $(DIR)/.*.d) +ifneq ($(wildcard $(DIR).*.d),) +include $(wildcard $(DIR).*.d) endif diff --git a/klibc/klibc/arch/ppc/include/klibc/archsys.h b/klibc/klibc/arch/ppc/include/klibc/archsys.h index 33a5ff3236..17a28859e5 100644 --- a/klibc/klibc/arch/ppc/include/klibc/archsys.h +++ b/klibc/klibc/arch/ppc/include/klibc/archsys.h @@ -36,18 +36,24 @@ type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ __asm__ __volatile__ \ ("sc \n\t" \ "mfcr %1 " \ - : "=&r" (__sc_3), "=&r" (__sc_0) \ - : "0" (__sc_3), "1" (__sc_0), \ - "r" (__sc_4), \ - "r" (__sc_5), \ - "r" (__sc_6), \ - "r" (__sc_7), \ - "r" (__sc_8) \ - : __syscall_clobbers); \ + : "+r" (__sc_3), \ + "+r" (__sc_0), \ + "+r" (__sc_4), \ + "+r" (__sc_5), \ + "+r" (__sc_6), \ + "+r" (__sc_7), \ + "+r" (__sc_8) \ + : : "cr0", "ctr", "memory", \ + "r9", "r10", "r11", "r12"); \ __sc_ret = __sc_3; \ __sc_err = __sc_0; \ } \ - __syscall_return (type); \ + if (__sc_err & 0x10000000) \ + { \ + errno = (int)__sc_ret; \ + __sc_ret = -1; \ + } \ + return (type)__sc_ret; \ } #endif /* _syscall6() missing */ diff --git a/klibc/klibc/getpagesize.c b/klibc/klibc/getpagesize.c new file mode 100644 index 0000000000..2d975b1586 --- /dev/null +++ b/klibc/klibc/getpagesize.c @@ -0,0 +1,26 @@ +/* + * getpagesize.c + */ + +#include +#include + +/* Presumably there is a better way to do this... */ +#ifdef __ia64__ +# define __NR_getpagesize 1171 +#endif + +#ifdef __NR_getpagesize + +_syscall0(int,getpagesize); + +#else + +int getpagesize(void) +{ + return PAGE_SIZE; +} + +#endif + + diff --git a/klibc/klibc/include/stdio.h b/klibc/klibc/include/stdio.h index 31a1fe40af..fba1e30746 100644 --- a/klibc/klibc/include/stdio.h +++ b/klibc/klibc/include/stdio.h @@ -15,10 +15,6 @@ struct _IO_file; typedef struct _IO_file FILE; -#define stdin ((FILE *)0) -#define stdout ((FILE *)1) -#define stderr ((FILE *)2) - #ifndef EOF # define EOF (-1) #endif @@ -44,10 +40,12 @@ static __inline__ int fileno(FILE *__f) return (int)(size_t)__f - 1; } -static __inline__ FILE * __create_file(int __fd) -{ - return (FILE *)(size_t)(__fd + 1); -} +/* This is a macro so it can be used as initializer */ +#define __create_file(__fd) ((FILE *)(size_t)((__fd) + 1)) + +#define stdin __create_file(0) +#define stdout __create_file(1) +#define stderr __create_file(2) __extern FILE *fopen(const char *, const char *); diff --git a/klibc/klibc/include/unistd.h b/klibc/klibc/include/unistd.h index ad12913834..3d5c6881d3 100644 --- a/klibc/klibc/include/unistd.h +++ b/klibc/klibc/include/unistd.h @@ -105,6 +105,8 @@ __extern int optind, opterr, optopt; __extern int isatty(int); +__extern int getpagesize(void); + /* Standard file descriptor numbers. */ #define STDIN_FILENO 0 #define STDOUT_FILENO 1 diff --git a/klibc/klibc/mmap.c b/klibc/klibc/mmap.c index aedf4dceb5..89cf3a6a8f 100644 --- a/klibc/klibc/mmap.c +++ b/klibc/klibc/mmap.c @@ -19,7 +19,7 @@ * Prefer mmap2() over mmap(), except on the architectures listed */ -#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) && !defined(__powerpc64__) +#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) && !defined(__powerpc__) && !defined(__powerpc64__) /* This architecture uses mmap2() */ diff --git a/klibc/klibc/syscommon.h b/klibc/klibc/syscommon.h index 3093920739..429025279e 100644 --- a/klibc/klibc/syscommon.h +++ b/klibc/klibc/syscommon.h @@ -28,5 +28,5 @@ #include #ifdef __i386__ -#include +# include #endif diff --git a/klibc/version b/klibc/version index 0f6db3dda2..2f3d7fa995 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.98 +0.101 -- cgit v1.2.3-54-g00ecf From 0115874355e618a4b7684be814610d3612283c6a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 28 Jan 2004 18:52:45 -0800 Subject: [PATCH] udevd - remove stupid locking error I wrote. --- udevd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/udevd.c b/udevd.c index a80da5b0d4..22c38653e7 100644 --- a/udevd.c +++ b/udevd.c @@ -318,7 +318,6 @@ static int one_and_only(void) /* see if we can lock */ if (lockf(lock_file, F_TLOCK, 0) < 0) { close(lock_file); - unlink(lock_filename); return -1; } -- cgit v1.2.3-54-g00ecf From bc59f0167a03be2d2e4cf8a680dda8444243c64f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 28 Jan 2004 18:53:12 -0800 Subject: [PATCH] remove a __KLIBC__ tests in libsysfs, as klibc now supports getpagesize() --- libsysfs/sysfs_dir.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index a60410ed28..ce01669754 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -273,11 +273,8 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) sysattr->path); return -1; } -#ifdef __KLIBC__ - pgsize = 0x1000; -#else - pgsize = sysconf(_SC_PAGESIZE); -#endif + + pgsize = getpagesize(); fbuf = (unsigned char *)calloc(1, pgsize+1); if (fbuf == NULL) { dprintf("calloc failed\n"); -- cgit v1.2.3-54-g00ecf From 8a08e4b1906eef5d5cb585b125612cce8d565e5c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 28 Jan 2004 19:00:51 -0800 Subject: [PATCH] fix possible buffer overflow On Tue, Jan 27, 2004 at 11:02:25AM -0800, Greg KH wrote: > On Mon, Jan 26, 2004 at 07:28:03PM -0500, Adrian Drzewiecki wrote: > > Looking over the code, I noticed something odd in > > namedev.c:strcmp_pattern() -- > > > > while (*p && (*p != ']')) > > p ++; > > return strcmp_pattern(p+1, s+1); > > > > If the pattern string is invalid, and is not terminated by a ']', then 'p' > > will point at \0 and p+1 will be beyond the string. > > Yes, I think you are correct. > > Hm, Kay, any idea of the proper way to fix this? I've attached a patch > below, but I don't think it is correct. > > while (*p && (*p != ']')) > p++; > - return strcmp_pattern(p+1, s+1); > + if (*p) > + return strcmp_pattern(p+1, s+1); > + else > + return 1; > } > } Sure, it's perfectly correct. I'm wondering how Adrian found this. We can use the return 1 at the end of the whole function, and asking for the closing ']' is more descriptive, but it does the same. - return strcmp_pattern(p+1, s+1); + if (*p == ']') + return strcmp_pattern(p+1, s+1); Patch is attached, that also replaces all the *s with s[0]. --- namedev.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/namedev.c b/namedev.c index de7f7c1b88..6685596479 100644 --- a/namedev.c +++ b/namedev.c @@ -47,34 +47,35 @@ LIST_HEAD(perm_device_list); /* compare string with pattern (supports * ? [0-9] [!A-Z]) */ static int strcmp_pattern(const char *p, const char *s) { - if (*s == '\0') { - while (*p == '*') + if (s[0] == '\0') { + while (p[0] == '*') p++; - return (*p != '\0'); + return (p[0] != '\0'); } - switch (*p) { + switch (p[0]) { case '[': { int not = 0; p++; - if (*p == '!') { + if (p[0] == '!') { not = 1; p++; } - while (*p && (*p != ']')) { + while ((p[0] != '\0') && (p[0] != ']')) { int match = 0; if (p[1] == '-') { - if ((*s >= *p) && (*s <= p[2])) + if ((s[0] >= p[0]) && (s[0] <= p[2])) match = 1; p += 3; } else { - match = (*p == *s); + match = (p[0] == s[0]); p++; } if (match ^ not) { - while (*p && (*p != ']')) + while ((p[0] != '\0') && (p[0] != ']')) p++; - return strcmp_pattern(p+1, s+1); + if (p[0] == ']') + return strcmp_pattern(p+1, s+1); } } } @@ -84,12 +85,12 @@ static int strcmp_pattern(const char *p, const char *s) return strcmp_pattern(p+1, s); return 0; case '\0': - if (*s == '\0') { + if (s[0] == '\0') { return 0; } break; default: - if ((*p == *s) || (*p == '?')) + if ((p[0] == s[0]) || (p[0] == '?')) return strcmp_pattern(p+1, s+1); break; } -- cgit v1.2.3-54-g00ecf From 79080c2664117e745eee3fcb812ec17208263672 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 29 Jan 2004 21:54:38 -0800 Subject: [PATCH] kill the last examples that contained the %D option. --- etc/udev/udev.rules.devfs | 5 +---- etc/udev/udev.rules.gentoo | 3 --- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index 1a52425633..f9333e91c4 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -2,10 +2,7 @@ # fields. See the udev man page for a full description of them. # ide block devices -BUS="ide", id="0.0", NAME="ide/host0/bus0/target0/lun0/%D" -BUS="ide", id="0.1", NAME="ide/host0/bus0/target1/lun0/%D" -BUS="ide", id="1.0", NAME="ide/host0/bus1/target0/lun0/%D" -BUS="ide", id="1.1", NAME="ide/host0/bus1/target1/lun0/%D" +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%1c %2c" # md block devices KERNEL="md[0-9]*", NAME="md/%n" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index a449a4dac9..0c53df535c 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -11,9 +11,6 @@ # %b - the bus id for the device # %c - the return value of the external PROGRAM (note, this doesn't work within # the PROGRAM field for the obvious reason.) -# %D - use the devfs style disk name for this device. -# For partitions, this will result in 'part%n' -# If this is not a partition, it will result in 'disc' # ########################################################### -- cgit v1.2.3-54-g00ecf From 53921bfa44129a19661a4aaa4c1647282921fc18 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 1 Feb 2004 09:12:36 -0800 Subject: [PATCH] udevd - cleanup and better timeout handling On Thu, Jan 29, 2004 at 04:55:11PM +0100, Kay Sievers wrote: > On Thu, Jan 29, 2004 at 02:56:25AM +0100, Kay Sievers wrote: > > On Wed, Jan 28, 2004 at 10:47:36PM +0100, Kay Sievers wrote: > > > Oh, couldn't resist to try threads. > > > It's a multithreaded udevd that communicates through a localhost socket. > > > The message includes a magic with the udev version, so we don't accept > > > older udevsend's. > > > > > > No need for locking, cause we can't bind two sockets on the same address. > > > The daemon tries to connect and if it fails it starts the daemon. > > > > > > We create a thread for every incoming connection, handle over the socket, > > > sort the messages in the global message queue and exit the thread. > > > Huh, that was easy with threads :) > > > > > > With the addition of a message we wakeup the queue manager thread and > > > handle timeouts or move the message to the global exec list. This wakes > > > up the exec list manager who looks if a process is already running for this > > > device path. > > > If yes, the exec is delayed otherwise we create a thread that execs udev. > > > n the background. With the return of udev we free the message and wakeup > > > the exec list manager to look if something is pending. > > > > > > It is just a quick shot, cause I couldn't solve the problems with fork an > > > scheduling and I wanted to see if I'm to stupid :) > > > But if anybody with a better idea or more experience with I/O scheduling > > > we may go another way. The remaining problem is that klibc doesn't support > > > threads. > > > > > > By now, we don't exec anything, it's just a sleep 3 for every exec, > > > but you can see the queue management by watching syslog and do: > > > > > > DEVPATH=/abc ACTION=add SEQNUM=0 ./udevsend /abc > > Next version, switched to unix domain sockets. Next cleaned up version. Hey, nobody wants to try it :) Works for me, It's funny if I connect/disconnect my 4in1-usb-flash-reader every two seconds. The 2.6 usb rocks! I can connect/diconnect a hub with 3 devices plugged in every second and don't run into any problem but a _very_ big udevd queue. --- Makefile | 2 +- test/udevd_test.sh | 8 +- udevd.c | 480 ++++++++++++++++++++++++++++++----------------------- udevd.h | 20 ++- udevsend.c | 78 +++++---- 5 files changed, 339 insertions(+), 249 deletions(-) diff --git a/Makefile b/Makefile index 8af6ecf638..d953218f7b 100644 --- a/Makefile +++ b/Makefile @@ -255,7 +255,7 @@ $(HELPER): udevinfo.o $(OBJS) $(HEADERS) $(STRIPCMD) $@ $(DAEMON): udevd.h udevd.o udevd.o logging.o - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(LD) $(LDFLAGS) -lpthread -o $@ $(CRT0) udevd.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ $(SENDER): udevd.h udevsend.o udevd.o logging.o diff --git a/test/udevd_test.sh b/test/udevd_test.sh index 94698085ca..506e886948 100644 --- a/test/udevd_test.sh +++ b/test/udevd_test.sh @@ -1,9 +1,7 @@ -#!/bin/bash +#!/bin/sh -# kill daemon, first event will start it again -killall udevd - -# 3 x connect/disconnect sequence of sda/sdb/sdc +# add/rem/add/rem/add sequence of sda/sdb/sdc +# a few days longer and the socket of my usb-flash-reader is gone :) export SEQNUM=3 export ACTION=add diff --git a/udevd.c b/udevd.c index 22c38653e7..22fb4d33db 100644 --- a/udevd.c +++ b/udevd.c @@ -1,9 +1,6 @@ /* - * udevd.c + * udevd.c - hotplug event serializer * - * Userspace devfs - * - * Copyright (C) 2004 Ling, Xiaofeng * Copyright (C) 2004 Kay Sievers * * @@ -24,9 +21,7 @@ #include #include -#include #include -#include #include #include #include @@ -35,6 +30,10 @@ #include #include #include +#include +#include +#include +#include #include "list.h" #include "udev.h" @@ -43,141 +42,82 @@ #include "logging.h" -#define BUFFER_SIZE 1024 - -static int running_remove_queue(pid_t pid); -static int msg_exec(struct hotplug_msg *msg); - -static int expect_seqnum = 0; -static int lock_file = -1; -static char *lock_filename = ".udevd_lock"; +static pthread_mutex_t msg_lock; +static pthread_mutex_t msg_active_lock; +static pthread_cond_t msg_active; +static pthread_mutex_t exec_lock; +static pthread_mutex_t exec_active_lock; +static pthread_cond_t exec_active; +static pthread_mutex_t running_lock; +static pthread_attr_t thr_attr; +static int expected_seqnum = 0; LIST_HEAD(msg_list); +LIST_HEAD(exec_list); LIST_HEAD(running_list); -LIST_HEAD(delayed_list); -static void sig_handler(int signum) -{ - pid_t pid; - - dbg("caught signal %d", signum); - switch (signum) { - case SIGALRM: - dbg("event timeout reached"); - break; - case SIGCHLD: - /* catch signals from exiting childs */ - while ( (pid = waitpid(-1, NULL, WNOHANG)) > 0) { - dbg("exec finished, pid %d", pid); - running_remove_queue(pid); - } - break; - case SIGINT: - case SIGTERM: - if (lock_file >= 0) { - close(lock_file); - unlink(lock_filename); - } - exit(20 + signum); - break; - default: - dbg("unhandled signal"); - } -} -static void set_timeout(int seconds) +static void msg_dump_queue(void) { - alarm(seconds); - dbg("set timeout in %d seconds", seconds); -} + struct hotplug_msg *msg; -static int running_moveto_queue(struct hotplug_msg *msg) -{ - dbg("move sequence %d [%d] to running queue '%s'", - msg->seqnum, msg->pid, msg->devpath); - list_move_tail(&msg->list, &running_list); - return 0; + list_for_each_entry(msg, &msg_list, list) + dbg("sequence %d in queue", msg->seqnum); } -static int running_remove_queue(pid_t pid) +static void msg_dump(struct hotplug_msg *msg) { - struct hotplug_msg *child; - struct hotplug_msg *tmp_child; - - list_for_each_entry_safe(child, tmp_child, &running_list, list) - if (child->pid == pid) { - list_del_init(&child->list); - free(child); - return 0; - } - return -EINVAL; + dbg("sequence %d, '%s', '%s', '%s'", + msg->seqnum, msg->action, msg->devpath, msg->subsystem); } -static pid_t running_getpid_by_devpath(struct hotplug_msg *msg) +/* allocates a new message */ +static struct hotplug_msg *msg_create(void) { - struct hotplug_msg *child; - struct hotplug_msg *tmp_child; + struct hotplug_msg *new_msg; - list_for_each_entry_safe(child, tmp_child, &running_list, list) - if (strncmp(child->devpath, msg->devpath, sizeof(child->devpath)) == 0) - return child->pid; - return 0; + new_msg = malloc(sizeof(struct hotplug_msg)); + if (new_msg == NULL) { + dbg("error malloc"); + return NULL; + } + memset(new_msg, 0x00, sizeof(struct hotplug_msg)); + return new_msg; } -static void delayed_dump_queue(void) +/* orders the message in the queue by sequence number */ +static void msg_queue_insert(struct hotplug_msg *msg) { - struct hotplug_msg *child; + struct hotplug_msg *loop_msg; - list_for_each_entry(child, &delayed_list, list) - dbg("event for '%s' in queue", child->devpath); -} + /* sort message by sequence number into list*/ + list_for_each_entry(loop_msg, &msg_list, list) + if (loop_msg->seqnum > msg->seqnum) + break; + list_add_tail(&msg->list, &loop_msg->list); + dbg("queued message seq %d", msg->seqnum); -static int delayed_moveto_queue(struct hotplug_msg *msg) -{ - dbg("move event to delayed queue '%s'", msg->devpath); - list_move_tail(&msg->list, &delayed_list); - return 0; -} + /* store timestamp of queuing */ + msg->queue_time = time(NULL); -static void delayed_check_queue(void) -{ - struct hotplug_msg *delayed_child; - struct hotplug_msg *running_child; - struct hotplug_msg *tmp_child; - - /* see if we have delayed exec's that can run now */ - list_for_each_entry_safe(delayed_child, tmp_child, &delayed_list, list) - list_for_each_entry_safe(running_child, tmp_child, &running_list, list) - if (strncmp(delayed_child->devpath, running_child->devpath, - sizeof(running_child->devpath)) == 0) { - dbg("delayed exec for '%s' can run now", delayed_child->devpath); - msg_exec(delayed_child); - } -} + /* signal queue activity to manager */ + pthread_mutex_lock(&msg_active_lock); + pthread_cond_signal(&msg_active); + pthread_mutex_unlock(&msg_active_lock); -static void msg_dump(struct hotplug_msg *msg) -{ - dbg("sequence %d, '%s', '%s', '%s'", - msg->seqnum, msg->action, msg->devpath, msg->subsystem); + return ; } -static int msg_exec(struct hotplug_msg *msg) +/* forks event and removes event from run queue when finished */ +static void *run_threads(void * parm) { pid_t pid; + struct hotplug_msg *msg; - msg_dump(msg); - + msg = parm; setenv("ACTION", msg->action, 1); setenv("DEVPATH", msg->devpath, 1); - /* delay exec, if we already have a udev working on the same devpath */ - pid = running_getpid_by_devpath(msg); - if (pid != 0) { - dbg("delay exec of sequence %d, [%d] already working on '%s'", - msg->seqnum, pid, msg->devpath); - delayed_moveto_queue(msg); - } - pid = fork(); switch (pid) { case 0: @@ -188,135 +128,206 @@ static int msg_exec(struct hotplug_msg *msg) break; case -1: dbg("fork of child failed"); - return -1; + goto exit; default: - /* exec in background, get the SIGCHLD with the sig handler */ - msg->pid = pid; - running_moveto_queue(msg); - break; + /* wait for exit of child */ + dbg("==> exec seq %d [%d] working at '%s'", + msg->seqnum, pid, msg->devpath); + wait(NULL); + dbg("<== exec seq %d came back", msg->seqnum); } - return 0; + +exit: + /* remove event from run list */ + pthread_mutex_lock(&running_lock); + list_del_init(&msg->list); + pthread_mutex_unlock(&running_lock); + + free(msg); + + /* signal queue activity to exec manager */ + pthread_mutex_lock(&exec_active_lock); + pthread_cond_signal(&exec_active); + pthread_mutex_unlock(&exec_active_lock); + + pthread_exit(0); } -static void msg_dump_queue(void) +/* returns already running task with devpath */ +static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) { - struct hotplug_msg *msg; + struct hotplug_msg *loop_msg; + struct hotplug_msg *tmp_msg; - list_for_each_entry(msg, &msg_list, list) - dbg("sequence %d in queue", msg->seqnum); + list_for_each_entry_safe(loop_msg, tmp_msg, &running_list, list) + if (strncmp(loop_msg->devpath, msg->devpath, sizeof(loop_msg->devpath)) == 0) + return loop_msg; + return NULL; } -static void msg_check_queue(void) +/* queue management executes the events and delays events for the same devpath */ +static void *exec_queue_manager(void * parm) { + struct hotplug_msg *loop_msg; + struct hotplug_msg *tmp_msg; struct hotplug_msg *msg; + pthread_t run_tid; + + while (1) { + pthread_mutex_lock(&exec_lock); + list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, list) { + msg = running_with_devpath(loop_msg); + if (msg == NULL) { + /* move event to run list */ + pthread_mutex_lock(&running_lock); + list_move_tail(&loop_msg->list, &running_list); + pthread_mutex_unlock(&running_lock); + + pthread_create(&run_tid, &thr_attr, run_threads, (void *) loop_msg); + + dbg("moved seq %d to running list", loop_msg->seqnum); + } else { + dbg("delay seq %d, cause seq %d already working on '%s'", + loop_msg->seqnum, msg->seqnum, msg->devpath); + } + } + pthread_mutex_unlock(&exec_lock); + + /* wait for activation, new events or childs coming back */ + pthread_mutex_lock(&exec_active_lock); + pthread_cond_wait(&exec_active, &exec_active_lock); + pthread_mutex_unlock(&exec_active_lock); + } +} + +/* move message from incoming to exec queue */ +static void msg_move_exec(struct list_head *head) +{ + list_move_tail(head, &exec_list); + /* signal queue activity to manager */ + pthread_mutex_lock(&exec_active_lock); + pthread_cond_signal(&exec_active); + pthread_mutex_unlock(&exec_active_lock); +} + +/* queue management thread handles the timeouts and dispatches the events */ +static void *msg_queue_manager(void * parm) +{ + struct hotplug_msg *loop_msg; struct hotplug_msg *tmp_msg; - time_t msg_age; + time_t msg_age = 0; + struct timespec tv; + while (1) { + dbg("msg queue manager, next expected is %d", expected_seqnum); + pthread_mutex_lock(&msg_lock); + pthread_mutex_lock(&exec_lock); recheck: - /* dispatch events until one is missing */ - list_for_each_entry_safe(msg, tmp_msg, &msg_list, list) { - if (msg->seqnum != expect_seqnum) - break; - msg_exec(msg); - expect_seqnum++; - } + list_for_each_entry_safe(loop_msg, tmp_msg, &msg_list, list) { + /* move event with expected sequence to the exec list */ + if (loop_msg->seqnum == expected_seqnum) { + msg_move_exec(&loop_msg->list); + expected_seqnum++; + dbg("moved seq %d to exec, next expected is %d", + loop_msg->seqnum, expected_seqnum); + continue; + } - /* recalculate next timeout */ - if (list_empty(&msg_list) == 0) { - msg_age = time(NULL) - msg->queue_time; - if (msg_age > EVENT_TIMEOUT_SEC-1) { - info("event %d, age %li seconds, skip event %d-%d", - msg->seqnum, msg_age, expect_seqnum, msg->seqnum-1); - expect_seqnum = msg->seqnum; - goto recheck; + /* move event with expired timeout to the exec list */ + msg_age = time(NULL) - loop_msg->queue_time; + if (msg_age > EVENT_TIMEOUT_SEC-1) { + msg_move_exec(&loop_msg->list); + expected_seqnum = loop_msg->seqnum+1; + dbg("moved seq %d to exec, reset next expected to %d", + loop_msg->seqnum, expected_seqnum); + goto recheck; + } else { + break; + } } - /* the first sequence gets its own timeout */ - if (expect_seqnum == 0) { - msg_age = EVENT_TIMEOUT_SEC - FIRST_EVENT_TIMEOUT_SEC; - expect_seqnum = 1; - } + msg_dump_queue(); + pthread_mutex_unlock(&exec_lock); + pthread_mutex_unlock(&msg_lock); - set_timeout(EVENT_TIMEOUT_SEC - msg_age); - return; + /* wait until queue gets active or next message timeout expires */ + pthread_mutex_lock(&msg_active_lock); + + if (list_empty(&msg_list) == 0) { + tv.tv_sec = time(NULL) + EVENT_TIMEOUT_SEC - msg_age; + tv.tv_nsec = 0; + dbg("next event expires in %li seconds", + EVENT_TIMEOUT_SEC - msg_age); + pthread_cond_timedwait(&msg_active, &msg_active_lock, &tv); + } else { + pthread_cond_wait(&msg_active, &msg_active_lock); + } + pthread_mutex_unlock(&msg_active_lock); } } -static int msg_add_queue(struct hotplug_msg *msg) +/* every connect creates a thread which gets the msg, queues it and exits */ +static void *client_threads(void * parm) { - struct hotplug_msg *new_msg; - struct hotplug_msg *tmp_msg; + int sock; + struct hotplug_msg *msg; + int retval; - new_msg = malloc(sizeof(*new_msg)); - if (new_msg == NULL) { - dbg("error malloc"); - return -ENOMEM; + sock = (int) parm; + + msg = msg_create(); + if (msg == NULL) { + dbg("unable to store message"); + goto exit; } - memcpy(new_msg, msg, sizeof(*new_msg)); - /* store timestamp of queuing */ - new_msg->queue_time = time(NULL); + retval = recv(sock, msg, sizeof(struct hotplug_msg), 0); + if (retval < 0) { + dbg("unable to receive message"); + goto exit; + } - /* sort message by sequence number into list*/ - list_for_each_entry(tmp_msg, &msg_list, list) - if (tmp_msg->seqnum > new_msg->seqnum) - break; - list_add_tail(&new_msg->list, &tmp_msg->list); + if (strncmp(msg->magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { + dbg("message magic '%s' doesn't match, ignore it", msg->magic); + goto exit; + } - return 0; + pthread_mutex_lock(&msg_lock); + msg_queue_insert(msg); + pthread_mutex_unlock(&msg_lock); + +exit: + close(sock); + pthread_exit(0); } -static void work(void) +static void sig_handler(int signum) { - struct hotplug_msg *msg; - int msgid; - key_t key; - char buf[BUFFER_SIZE]; - int ret; - - key = ftok(UDEVD_BIN, IPC_KEY_ID); - msg = (struct hotplug_msg *) buf; - msgid = msgget(key, IPC_CREAT); - if (msgid == -1) { - dbg("open message queue error"); - exit(1); - } - while (1) { - ret = msgrcv(msgid, (struct msgbuf *) buf, BUFFER_SIZE-4, HOTPLUGMSGTYPE, 0); - if (ret != -1) { - dbg("received sequence %d, expected sequence %d", msg->seqnum, expect_seqnum); - if (msg->seqnum >= expect_seqnum) { - msg_add_queue(msg); - msg_dump_queue(); - msg_check_queue(); - continue; - } - dbg("too late for event with sequence %d, event skipped ", msg->seqnum); - } else { - if (errno == EINTR) { - msg_check_queue(); - msg_dump_queue(); - delayed_check_queue(); - delayed_dump_queue(); - continue; - } - dbg("ipc message receive error '%s'", strerror(errno)); - } + switch (signum) { + case SIGINT: + case SIGTERM: + unlink(UDEVD_LOCK); + unlink(UDEVD_SOCKET); + exit(20 + signum); + break; + default: + dbg("unhandled signal"); } } static int one_and_only(void) { - char string[100]; - - lock_file = open(lock_filename, O_RDWR | O_CREAT, 0x640); + char string[50]; + int lock_file; /* see if we can open */ + lock_file = open(UDEVD_LOCK, O_RDWR | O_CREAT, 0x640); if (lock_file < 0) return -1; - + /* see if we can lock */ if (lockf(lock_file, F_TLOCK, 0) < 0) { + dbg("file is already locked, exit"); close(lock_file); return -1; } @@ -329,16 +340,73 @@ static int one_and_only(void) int main(int argc, char *argv[]) { + int ssock; + int csock; + struct sockaddr_un saddr; + struct sockaddr_un caddr; + socklen_t clen; + pthread_t cli_tid; + pthread_t mgr_msg_tid; + pthread_t mgr_exec_tid; + int retval; + /* only let one version of the daemon run at any one time */ if (one_and_only() != 0) exit(0); - /* set up signal handler */ signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); - signal(SIGALRM, sig_handler); - signal(SIGCHLD, sig_handler); - work(); - exit(0); + memset(&saddr, 0x00, sizeof(saddr)); + saddr.sun_family = AF_LOCAL; + strcpy(saddr.sun_path, UDEVD_SOCKET); + + unlink(UDEVD_SOCKET); + ssock = socket(AF_LOCAL, SOCK_STREAM, 0); + if (ssock == -1) { + dbg("error getting socket"); + exit(1); + } + + retval = bind(ssock, &saddr, sizeof(saddr)); + if (retval < 0) { + dbg("bind failed\n"); + goto exit; + } + + retval = listen(ssock, SOMAXCONN); + if (retval < 0) { + dbg("listen failed\n"); + goto exit; + } + + pthread_mutex_init(&msg_lock, NULL); + pthread_mutex_init(&msg_active_lock, NULL); + pthread_mutex_init(&exec_lock, NULL); + pthread_mutex_init(&exec_active_lock, NULL); + pthread_mutex_init(&running_lock, NULL); + + /* set default attributes for created threads */ + pthread_attr_init(&thr_attr); + pthread_attr_setdetachstate(&thr_attr, PTHREAD_CREATE_DETACHED); + + /* init queue management */ + pthread_create(&mgr_msg_tid, &thr_attr, msg_queue_manager, NULL); + pthread_create(&mgr_exec_tid, &thr_attr, exec_queue_manager, NULL); + + clen = sizeof(caddr); + /* main loop */ + while (1) { + csock = accept(ssock, &caddr, &clen); + if (csock < 0) { + if (errno == EINTR) + continue; + dbg("client accept failed\n"); + } + pthread_create(&cli_tid, &thr_attr, client_threads, (void *) csock); + } +exit: + close(ssock); + unlink(UDEVD_SOCKET); + exit(1); } diff --git a/udevd.h b/udevd.h index 4bccd4b81a..e24bc28a78 100644 --- a/udevd.h +++ b/udevd.h @@ -4,6 +4,7 @@ * Userspace devfs * * Copyright (C) 2004 Ling, Xiaofeng + * Copyright (C) 2004 Kay Sievers * * * This program is free software; you can redistribute it and/or modify it @@ -23,16 +24,21 @@ #include "list.h" -#define FIRST_EVENT_TIMEOUT_SEC 1 -#define EVENT_TIMEOUT_SEC 5 -#define UDEVSEND_RETRY_COUNT 50 /* x 10 millisec */ - -#define IPC_KEY_ID 1 -#define HOTPLUGMSGTYPE 44 +/* + * FIXME: udev_root is post compile configurable and may also be + * mounted over at any time and /var/run/ and /tmp/ is unusable, + * cause it's cleaned at system startup, long _after_ udevd is + * already running. Should we use udev_init_config()? + */ +#define UDEV_MAGIC "udev_" UDEV_VERSION +#define EVENT_TIMEOUT_SEC 5 +#define UDEVSEND_CONNECT_RETRY 20 /* x 100 millisec */ +#define UDEVD_SOCKET UDEV_ROOT ".udevd.socket" +#define UDEVD_LOCK UDEV_ROOT ".udevd.pid" struct hotplug_msg { - long mtype; + char magic[20]; struct list_head list; pid_t pid; int seqnum; diff --git a/udevsend.c b/udevsend.c index f92ee2b5d8..6ffd68c1b7 100644 --- a/udevsend.c +++ b/udevsend.c @@ -32,12 +32,15 @@ #include #include #include +#include +#include #include "udev.h" #include "udev_version.h" #include "udevd.h" #include "logging.h" + static inline char *get_action(void) { char *action; @@ -66,7 +69,7 @@ static int build_hotplugmsg(struct hotplug_msg *msg, char *action, char *devpath, char *subsystem, int seqnum) { memset(msg, 0x00, sizeof(*msg)); - msg->mtype = HOTPLUGMSGTYPE; + strfieldcpy(msg->magic, UDEV_MAGIC); msg->seqnum = seqnum; strncpy(msg->action, action, 8); strncpy(msg->devpath, devpath, 128); @@ -108,12 +111,8 @@ static int start_daemon(void) return 0; } - int main(int argc, char* argv[]) { - int msgid; - key_t key; - struct msqid_ds msg_queue; struct hotplug_msg message; char *action; char *devpath; @@ -124,6 +123,8 @@ int main(int argc, char* argv[]) int size; int loop; struct timespec tspec; + int sock; + struct sockaddr_un saddr; subsystem = argv[1]; if (subsystem == NULL) { @@ -150,41 +151,58 @@ int main(int argc, char* argv[]) } seq = atoi(seqnum); - /* create ipc message queue or get id of our existing one */ - key = ftok(UDEVD_BIN, IPC_KEY_ID); - dbg("using ipc queue 0x%0x", key); - size = build_hotplugmsg(&message, action, devpath, subsystem, seq); - msgid = msgget(key, IPC_CREAT); - if (msgid == -1) { - dbg("error open ipc queue"); + sock = socket(AF_LOCAL, SOCK_STREAM, 0); + if (sock == -1) { + dbg("error getting socket"); goto exit; } - /* send ipc message to the daemon */ - retval = msgsnd(msgid, &message, size, 0); - if (retval == -1) { - dbg("error sending ipc message"); - goto exit; + memset(&saddr, 0x00, sizeof(saddr)); + saddr.sun_family = AF_LOCAL; + strcpy(saddr.sun_path, UDEVD_SOCKET); + + /* try to connect, if it fails start daemon */ + retval = connect(sock, &saddr, sizeof(saddr)); + if (retval != -1) { + goto send; + } else { + dbg("connect failed, try starting daemon..."); + retval = start_daemon(); + if (retval == 0) { + dbg("daemon started"); + } else { + dbg("error starting daemon"); + goto exit; + } } - /* get state of ipc queue */ + /* try to connect while daemon to starts */ tspec.tv_sec = 0; - tspec.tv_nsec = 10000000; /* 10 millisec */ - loop = UDEVSEND_RETRY_COUNT; + tspec.tv_nsec = 100000000; /* 100 millisec */ + loop = UDEVSEND_CONNECT_RETRY; while (loop--) { - retval = msgctl(msgid, IPC_STAT, &msg_queue); - if (retval == -1) { - dbg("error getting info on ipc queue"); - goto exit; - } - if (msg_queue.msg_qnum == 0) - goto exit; + retval = connect(sock, &saddr, sizeof(saddr)); + if (retval != -1) + goto send; + else + dbg("retry to connect %d", + UDEVSEND_CONNECT_RETRY - loop); nanosleep(&tspec, NULL); } + dbg("error connecting to daemon, start daemon failed"); + goto exit; - info("message is still in the ipc queue, starting daemon..."); - retval = start_daemon(); +send: + size = build_hotplugmsg(&message, action, devpath, subsystem, seq); + retval = send(sock, &message, size, 0); + if (retval == -1) { + dbg("error sending message"); + close (sock); + goto exit; + } + close (sock); + return 0; exit: - return retval; + return 1; } -- cgit v1.2.3-54-g00ecf From 8e2229c439f4d0bcf5660457d5a2d6f9d4723e88 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 2 Feb 2004 08:00:07 -0800 Subject: [PATCH] udevd - config cleanup > Here is a small cleanup and better Makefile integration. > udevd and udevsender are now installed. Just switch HOTPLUG_EXEC from ROOT > to SENDER before install and udevsend will be called. > > We may add the location of the socket and lock file to the config, > if this is needed. Same patch with a fix for the stack size setting. --- Makefile | 15 +++++++++++---- udevd.c | 26 +++++++++++++++----------- udevd.h | 11 +---------- udevsend.c | 2 +- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index d953218f7b..05d5da5a33 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,7 @@ VERSION = 015_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev +HOTPLUG_EXEC = $(ROOT) DESTDIR = # override this to make udev look in a different location for it's config files @@ -232,8 +233,10 @@ udev_version.h: @echo \#define UDEV_CONFIG_FILE \"$(configdir)\udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)\udev.rules\" >> $@ @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ - @echo \#define UDEV_BIN \"$(PWD)/udev\" >> $@ - @echo \#define UDEVD_BIN \"$(PWD)/udevd\" >> $@ + @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ + @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ + @echo \#define UDEVD_SOCK \"$(udevdir)/\.udevd.sock\" >> $@ + @echo \#define UDEVD_LOCK \"$(udevdir)/\.udevd.lock\" >> $@ # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf @@ -338,6 +341,8 @@ install: install-config install-dbus-policy all $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) + $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) + $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(HELPER) $(DESTDIR)$(sbindir)/$(HELPER) @if [ "x$(USE_LSB)" = "xtrue" ]; then \ $(INSTALL_PROGRAM) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ @@ -347,8 +352,8 @@ install: install-config install-dbus-policy all fi $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 - - rm -f $(DESTDIR)$(hotplugdir)/udev.hotplug - - ln -f -s $(sbindir)/$(ROOT) $(DESTDIR)$(hotplugdir)/udev.hotplug + - rm -f $(DESTDIR)$(hotplugdir)/$(HOTPLUG_EXEC).hotplug + - ln -f -s $(sbindir)/$(HOTPLUG_EXEC) $(DESTDIR)$(hotplugdir)/udev.hotplug @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ @@ -364,6 +369,8 @@ uninstall: uninstall-dbus-policy - rm $(mandir)/man8/udev.8 - rm $(mandir)/man8/udevinfo.8 - rm $(sbindir)/$(ROOT) + - rm $(sbindir)/$(DAEMON) + - rm $(sbindir)/$(SENDER) - rm $(sbindir)/$(HELPER) - rmdir $(hotplugdir) - rmdir $(configdir) diff --git a/udevd.c b/udevd.c index 22fb4d33db..dc7d581c24 100644 --- a/udevd.c +++ b/udevd.c @@ -19,6 +19,7 @@ * */ +#include #include #include #include @@ -33,7 +34,6 @@ #include #include #include -#include #include "list.h" #include "udev.h" @@ -71,7 +71,6 @@ static void msg_dump(struct hotplug_msg *msg) msg->seqnum, msg->action, msg->devpath, msg->subsystem); } -/* allocates a new message */ static struct hotplug_msg *msg_create(void) { struct hotplug_msg *new_msg; @@ -81,10 +80,15 @@ static struct hotplug_msg *msg_create(void) dbg("error malloc"); return NULL; } - memset(new_msg, 0x00, sizeof(struct hotplug_msg)); return new_msg; } +static void msg_delete(struct hotplug_msg *msg) +{ + if (msg != NULL) + free(msg); +} + /* orders the message in the queue by sequence number */ static void msg_queue_insert(struct hotplug_msg *msg) { @@ -143,7 +147,7 @@ exit: list_del_init(&msg->list); pthread_mutex_unlock(&running_lock); - free(msg); + msg_delete(msg); /* signal queue activity to exec manager */ pthread_mutex_lock(&exec_active_lock); @@ -289,6 +293,7 @@ static void *client_threads(void * parm) if (strncmp(msg->magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { dbg("message magic '%s' doesn't match, ignore it", msg->magic); + msg_delete(msg); goto exit; } @@ -307,7 +312,7 @@ static void sig_handler(int signum) case SIGINT: case SIGTERM: unlink(UDEVD_LOCK); - unlink(UDEVD_SOCKET); + unlink(UDEVD_SOCK); exit(20 + signum); break; default: @@ -320,7 +325,6 @@ static int one_and_only(void) char string[50]; int lock_file; - /* see if we can open */ lock_file = open(UDEVD_LOCK, O_RDWR | O_CREAT, 0x640); if (lock_file < 0) return -1; @@ -359,9 +363,9 @@ int main(int argc, char *argv[]) memset(&saddr, 0x00, sizeof(saddr)); saddr.sun_family = AF_LOCAL; - strcpy(saddr.sun_path, UDEVD_SOCKET); + strcpy(saddr.sun_path, UDEVD_SOCK); - unlink(UDEVD_SOCKET); + unlink(UDEVD_SOCK); ssock = socket(AF_LOCAL, SOCK_STREAM, 0); if (ssock == -1) { dbg("error getting socket"); @@ -389,6 +393,7 @@ int main(int argc, char *argv[]) /* set default attributes for created threads */ pthread_attr_init(&thr_attr); pthread_attr_setdetachstate(&thr_attr, PTHREAD_CREATE_DETACHED); + pthread_attr_setstacksize(&thr_attr, 16 * 1024); /* init queue management */ pthread_create(&mgr_msg_tid, &thr_attr, msg_queue_manager, NULL); @@ -399,14 +404,13 @@ int main(int argc, char *argv[]) while (1) { csock = accept(ssock, &caddr, &clen); if (csock < 0) { - if (errno == EINTR) - continue; dbg("client accept failed\n"); + continue; } pthread_create(&cli_tid, &thr_attr, client_threads, (void *) csock); } exit: close(ssock); - unlink(UDEVD_SOCKET); + unlink(UDEVD_SOCK); exit(1); } diff --git a/udevd.h b/udevd.h index e24bc28a78..6dbee3a295 100644 --- a/udevd.h +++ b/udevd.h @@ -24,18 +24,9 @@ #include "list.h" -/* - * FIXME: udev_root is post compile configurable and may also be - * mounted over at any time and /var/run/ and /tmp/ is unusable, - * cause it's cleaned at system startup, long _after_ udevd is - * already running. Should we use udev_init_config()? - */ - -#define UDEV_MAGIC "udev_" UDEV_VERSION +#define UDEV_MAGIC "udevd_" UDEV_VERSION #define EVENT_TIMEOUT_SEC 5 #define UDEVSEND_CONNECT_RETRY 20 /* x 100 millisec */ -#define UDEVD_SOCKET UDEV_ROOT ".udevd.socket" -#define UDEVD_LOCK UDEV_ROOT ".udevd.pid" struct hotplug_msg { char magic[20]; diff --git a/udevsend.c b/udevsend.c index 6ffd68c1b7..0ddc6839de 100644 --- a/udevsend.c +++ b/udevsend.c @@ -159,7 +159,7 @@ int main(int argc, char* argv[]) memset(&saddr, 0x00, sizeof(saddr)); saddr.sun_family = AF_LOCAL; - strcpy(saddr.sun_path, UDEVD_SOCKET); + strcpy(saddr.sun_path, UDEVD_SOCK); /* try to connect, if it fails start daemon */ retval = connect(sock, &saddr, sizeof(saddr)); -- cgit v1.2.3-54-g00ecf From 3a7798f4714c88021b6ac0cda3e1d818a3fa7a07 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 2 Feb 2004 08:19:13 -0800 Subject: [PATCH] remove logging.c as it's no longer needed. --- logging.c | 56 -------------------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 logging.c diff --git a/logging.c b/logging.c deleted file mode 100644 index cf1da5e040..0000000000 --- a/logging.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * logging.c - * - * Simple logging functions that can be compiled away into nothing. - * - * Copyright (C) 2001-2003 Greg Kroah-Hartman - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include - -#include "logging.h" - - -static int logging_init = 0; -static unsigned char udev_logname[42]; - -static void init_logging(void) -{ - snprintf(udev_logname, 42,"udev[%d]", getpid()); - - openlog(udev_logname, 0, LOG_DAEMON); - logging_init = 1; -} - -/** - * log_message - sends a message to the logging facility - */ -int log_message(int level, const char *format, ...) -{ - va_list args; - - if (!logging_init) - init_logging(); - va_start(args, format); - vsyslog(level, format, args); - va_end(args); - return 1; -} -- cgit v1.2.3-54-g00ecf From 95a6f4c8acafe7031087667aa556a50a6a091c93 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 2 Feb 2004 08:19:41 -0800 Subject: [PATCH] rework the logging code so that each program logs with the proper name in the syslog. --- Makefile | 11 +++++------ libsysfs/sysfs.h | 6 +----- logging.h | 28 +++++++++++++++++++++++----- udev.c | 2 ++ udevd.c | 3 +++ udevinfo.c | 3 +++ udevsend.c | 3 +++ 7 files changed, 40 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 05d5da5a33..386583b7eb 100644 --- a/Makefile +++ b/Makefile @@ -195,7 +195,6 @@ OBJS = udev_config.o \ udev-add.o \ udev-remove.o \ udevdb.o \ - logging.o \ namedev.o \ namedev_parse.o \ $(SYSFS) \ @@ -254,15 +253,15 @@ $(ROOT): udev.o $(OBJS) $(HEADERS) $(GEN_HEADERS) $(STRIPCMD) $@ $(HELPER): udevinfo.o $(OBJS) $(HEADERS) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o logging.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(DAEMON): udevd.h udevd.o udevd.o logging.o - $(LD) $(LDFLAGS) -lpthread -o $@ $(CRT0) udevd.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(DAEMON): udevd.h udevd.o + $(LD) $(LDFLAGS) -lpthread -o $@ $(CRT0) udevd.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(SENDER): udevd.h udevsend.o udevd.o logging.o - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o logging.o $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(SENDER): udevd.h udevsend.o + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ clean: diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 4ea4919351..49c9285bc3 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -34,7 +34,7 @@ /* Debugging */ #ifdef DEBUG -#include +#include "../logging.h" #define dprintf(format, arg...) \ do { \ log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ @@ -43,8 +43,4 @@ #define dprintf(format, arg...) do { } while (0) #endif -extern int log_message (int level, const char *format, ...) - __attribute__ ((format (printf, 2, 3))); - - #endif /* _SYSFS_H_ */ diff --git a/logging.h b/logging.h index df5922b3e6..e233ddc889 100644 --- a/logging.h +++ b/logging.h @@ -1,9 +1,9 @@ /* * logging.h * - * Userspace devfs + * Simple logging functions that can be compiled away into nothing. * - * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003,2004 Greg Kroah-Hartman * Copyright (C) 2004 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ #define dbg_parse(format, arg...) do { } while (0) #ifdef LOG +#include #include #undef info @@ -54,9 +55,26 @@ } while (0) #endif -#endif /* LOG */ - -extern int log_message (int level, const char *format, ...) +static void log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); +static inline void log_message (int level, const char *format, ...) +{ + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} + +/* each program must declare this variable somewhere */ +extern unsigned char logname[42]; + +static inline void init_logging(char *program_name) +{ + snprintf(logname, 42,"%s[%d]", program_name, getpid()); + openlog(logname, 0, LOG_DAEMON); +} + +#endif /* LOG */ #endif diff --git a/udev.c b/udev.c index 38b26916c9..b45fb336be 100644 --- a/udev.c +++ b/udev.c @@ -38,6 +38,7 @@ /* global variables */ char **main_argv; char **main_envp; +unsigned char logname[42]; static void sig_handler(int signum) { @@ -174,6 +175,7 @@ int main(int argc, char **argv, char **envp) main_argv = argv; main_envp = envp; + init_logging("udev"); dbg("version %s", UDEV_VERSION); return udev_hotplug(argc, argv); diff --git a/udevd.c b/udevd.c index dc7d581c24..331b7e4b84 100644 --- a/udevd.c +++ b/udevd.c @@ -42,6 +42,7 @@ #include "logging.h" +unsigned char logname[42]; static pthread_mutex_t msg_lock; static pthread_mutex_t msg_active_lock; static pthread_cond_t msg_active; @@ -354,6 +355,8 @@ int main(int argc, char *argv[]) pthread_t mgr_exec_tid; int retval; + init_logging("udevd"); + /* only let one version of the daemon run at any one time */ if (one_and_only() != 0) exit(0); diff --git a/udevinfo.c b/udevinfo.c index 4d28755b2f..71a9a6d93e 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -38,6 +38,7 @@ char **main_argv; int main_argc; +unsigned char logname[42]; static int print_all_attributes(const char *path) { @@ -412,6 +413,8 @@ int main(int argc, char *argv[], char *envp[]) main_argv = argv; main_argc = argc; + init_logging("udevinfo"); + /* initialize our configuration */ udev_init_config(); diff --git a/udevsend.c b/udevsend.c index 0ddc6839de..6af9df7704 100644 --- a/udevsend.c +++ b/udevsend.c @@ -40,6 +40,7 @@ #include "udevd.h" #include "logging.h" +unsigned char logname[42]; static inline char *get_action(void) { @@ -126,6 +127,8 @@ int main(int argc, char* argv[]) int sock; struct sockaddr_un saddr; + init_logging("udevsend"); + subsystem = argv[1]; if (subsystem == NULL) { dbg("no subsystem"); -- cgit v1.2.3-54-g00ecf From 62e156af9438bfd6404de3e359a890286cb49479 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 2 Feb 2004 08:22:01 -0800 Subject: [PATCH] fix up logging code so that it can be built without it being enabled --- logging.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/logging.h b/logging.h index e233ddc889..3ee3e1acf0 100644 --- a/logging.h +++ b/logging.h @@ -27,6 +27,7 @@ #define info(format, arg...) do { } while (0) #define dbg(format, arg...) do { } while (0) #define dbg_parse(format, arg...) do { } while (0) +#define init_logging(foo) do { } while (0) #ifdef LOG #include @@ -69,6 +70,7 @@ static inline void log_message (int level, const char *format, ...) /* each program must declare this variable somewhere */ extern unsigned char logname[42]; +#undef init_logging static inline void init_logging(char *program_name) { snprintf(logname, 42,"%s[%d]", program_name, getpid()); -- cgit v1.2.3-54-g00ecf From 0be0c18de37b463f40c649f1b66b7683f2bf836b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 2 Feb 2004 08:29:04 -0800 Subject: [PATCH] udevsend now almost compiles with klibc, struct sockaddr_un is only problem now. --- udevsend.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/udevsend.c b/udevsend.c index 6af9df7704..415207d8ca 100644 --- a/udevsend.c +++ b/udevsend.c @@ -23,17 +23,15 @@ */ #include -#include -#include +#include +#include +#include #include #include #include #include #include #include -#include -#include -#include #include "udev.h" #include "udev_version.h" -- cgit v1.2.3-54-g00ecf From d5c6d80ff1b617419dfcadb2fea4710d14f34b98 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 2 Feb 2004 18:10:29 -0800 Subject: [PATCH] let udevsend build with klibc > I don't mind udevd using glibc, I just want the programs that get run a > lot of different times (udev and udevsend) to be as small as possible to > get the best cache results. As udevd sticks around all the time, it's > not as important. Sound sane to you? Oh, nice. Good idea. --- Makefile | 4 ++-- klibc/klibc/include/sys/un.h | 10 ++++++++++ udevsend.c | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 klibc/klibc/include/sys/un.h diff --git a/Makefile b/Makefile index 386583b7eb..dd2f697591 100644 --- a/Makefile +++ b/Makefile @@ -161,12 +161,12 @@ else CFLAGS += $(WARNINGS) -I$(GCCINCDIR) LIB_OBJS = -lc LDFLAGS = - UDEVD = $(DAEMON) $(SENDER) + UDEVD = $(DAEMON) endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(UDEVD) $(HELPER) +all: $(ROOT) $(SENDER) $(UDEVD) $(HELPER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ diff --git a/klibc/klibc/include/sys/un.h b/klibc/klibc/include/sys/un.h new file mode 100644 index 0000000000..85822ba6a4 --- /dev/null +++ b/klibc/klibc/include/sys/un.h @@ -0,0 +1,10 @@ +/* + * sys/un.h + */ + +#ifndef _UN_H +#define _UN_H + +#include + +#endif /* _UN_H */ diff --git a/udevsend.c b/udevsend.c index 415207d8ca..fd61cb2a2f 100644 --- a/udevsend.c +++ b/udevsend.c @@ -163,7 +163,7 @@ int main(int argc, char* argv[]) strcpy(saddr.sun_path, UDEVD_SOCK); /* try to connect, if it fails start daemon */ - retval = connect(sock, &saddr, sizeof(saddr)); + retval = connect(sock, (struct sockaddr *) &saddr, sizeof(saddr)); if (retval != -1) { goto send; } else { @@ -182,7 +182,7 @@ int main(int argc, char* argv[]) tspec.tv_nsec = 100000000; /* 100 millisec */ loop = UDEVSEND_CONNECT_RETRY; while (loop--) { - retval = connect(sock, &saddr, sizeof(saddr)); + retval = connect(sock, (struct sockaddr *) &saddr, sizeof(saddr)); if (retval != -1) goto send; else -- cgit v1.2.3-54-g00ecf From e047ca9bdfc3d95cccbbcf6d4f2358648c7d0758 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 2 Feb 2004 18:42:42 -0800 Subject: [PATCH] make udevsend binary even smaller --- udevsend.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udevsend.c b/udevsend.c index fd61cb2a2f..d3c74dd46a 100644 --- a/udevsend.c +++ b/udevsend.c @@ -125,7 +125,9 @@ int main(int argc, char* argv[]) int sock; struct sockaddr_un saddr; +#ifdef DEBUG init_logging("udevsend"); +#endif subsystem = argv[1]; if (subsystem == NULL) { -- cgit v1.2.3-54-g00ecf From 786f9231961cc12e59cce3e3ad117ad976adf6f5 Mon Sep 17 00:00:00 2001 From: "rrm3@rrm3.org" Date: Tue, 3 Feb 2004 00:20:27 -0800 Subject: [PATCH] FAQ udev.rules.devfs I have a very small patch for the udev FAQ. :-) --- FAQ | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FAQ b/FAQ index 1f7ceb0dd3..a3bec17408 100644 --- a/FAQ +++ b/FAQ @@ -53,7 +53,7 @@ A: The devfs approach caused a lot of spurious modprobe attempts as Q: I really like the devfs naming scheme, will udev do that? A: Yes, udev can create /dev nodes using the devfs naming policy. A configuration file needs to be created to map the kernel default names - to the devfs names. See the initial udev.conf.devfs file in the udev + to the devfs names. See the initial udev.rules.devfs file in the udev release. It is the start of such a configuration file. If there are any things missing, please let the udev authors know. -- cgit v1.2.3-54-g00ecf From c7e2a0bc082321bceea7ac86fa6e1a42bcc91072 Mon Sep 17 00:00:00 2001 From: "elkropac@students.zcu.cz" Date: Tue, 3 Feb 2004 00:20:31 -0800 Subject: [PATCH] get_dev_number() in extras/ide-devfs.sh this patch corrects ide devices with number greater than 9 being linked into wrong discs/discX directories (my hda10 device was in discs/disc1 directory) it adds % into pattern for $DRIVE, so for example, hda10 is not eaten to hda1, but to hda, and break in for cycle works for it --- extras/ide-devfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 8648f6c0c0..1cf6f9c9e4 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -18,7 +18,7 @@ get_dev_number() { local x= local num=0 local MEDIA= - local DRIVE="${1%[0-9]*}" + local DRIVE="${1%%[0-9]*}" for x in /proc/ide/*/media; do if [ -e "${x}" ]; then -- cgit v1.2.3-54-g00ecf From 977083c253a6c7ec282f1cf36c496ee280dbf069 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 3 Feb 2004 00:51:51 -0800 Subject: [PATCH] add KERNEL_DIR option so that the distros will be happy Based on a patch from Svetoslav Slavtchev --- Makefile | 13 ++++++++++--- README | 10 ++++++---- extras/multipath/Makefile | 4 ++-- extras/multipath/libdevmapper/Makefile | 2 +- klibc/MCONFIG | 2 +- 5 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index dd2f697591..e1846dd4c0 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,9 @@ LOCAL_CFG_DIR = etc/udev HOTPLUG_EXEC = $(ROOT) DESTDIR = + +KERNEL_DIR = /lib/modules/${shell uname -r}/build + # override this to make udev look in a different location for it's config files prefix = exec_prefix = ${prefix} @@ -135,7 +138,8 @@ ifeq ($(strip $(USE_KLIBC)),true) KLIBC_BASE = $(PWD)/klibc KLIBC_DIR = $(KLIBC_BASE)/klibc INCLUDE_DIR := $(KLIBC_DIR)/include - LINUX_INCLUDE_DIR := $(KLIBC_BASE)/linux/include + LINUX_INCLUDE_DIR := $(KERNEL_DIR)/include +# LINUX_INCLUDE_DIR := $(KLIBC_BASE)/linux/include include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG # arch specific objects ARCH_LIB_OBJS = \ @@ -169,7 +173,10 @@ CFLAGS += -I$(PWD)/libsysfs all: $(ROOT) $(SENDER) $(UDEVD) $(HELPER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ - $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ + $(MAKE) prefix=$(prefix) \ + LD="$(LD)" \ + SYSFS="$(SYSFS)" \ + KERNEL_DIR="$(KERNEL_DIR)" \ -C $$target $@ ; \ done ; \ @@ -178,7 +185,7 @@ $(ROOT): $(LIBC) $(ARCH_LIB_OBJS) : $(CRT0) $(CRT0): - $(MAKE) -C klibc + $(MAKE) -C klibc KERNEL_DIR=$(KERNEL_DIR) TDB = tdb/tdb.o \ tdb/spinlock.o diff --git a/README b/README index 26032c35dc..c63912101a 100644 --- a/README +++ b/README @@ -52,15 +52,16 @@ To use: DEBUG if set to 'true', debugging messages will be sent to the syslog as udev is run. Default value is 'false'. + KERNEL_DIR + If this is not set it will default to /lib/modules/`uname -r`/build + This is used if USE_KLIBC=true to find the kernel include + directory that klibc needs to build against. This must be set + if you are not building udev while running a 2.6 kernel. So, if you want to build udev using klibc with debugging messages, you would do: make USE_KLIBC=true DEBUG=true - Note: If you want to use klibc, you will have to set up the "linux" - symlink properly. See the file klibc/klibc/README and pay - attention to step "a)" there. - - Install the project: make install @@ -95,3 +96,4 @@ greg@kroah.com + diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index 3f13532e16..0aac146a87 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -15,7 +15,7 @@ CC = gcc GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ - -I$(GCCINCDIR) -I$(klibcdir)/linux/include -I$(sysfsdir) -I. + -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I$(sysfsdir) -I. OBJS = main.o CRT0 = ../../klibc/klibc/crt0.o @@ -32,7 +32,7 @@ SUBDIRS = libdevmapper recurse: @for dir in $(SUBDIRS); do\ - $(MAKE) -C $$dir ; \ + $(MAKE) KERNEL_DIR=$(KERNEL_DIR) -C $$dir ; \ done $(MAKE) $(EXEC) diff --git a/extras/multipath/libdevmapper/Makefile b/extras/multipath/libdevmapper/Makefile index b160075416..a05a31e85a 100644 --- a/extras/multipath/libdevmapper/Makefile +++ b/extras/multipath/libdevmapper/Makefile @@ -10,7 +10,7 @@ CC = gcc GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ - -I$(GCCINCDIR) -I$(klibcdir)/linux/include -I. -Iioctl + -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I. -Iioctl OBJS = ioctl/libdevmapper.o libdm-common.o diff --git a/klibc/MCONFIG b/klibc/MCONFIG index ed7755b382..8b5da4154b 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -12,7 +12,7 @@ REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include -I$(KLIBSRC) \ -I$(KLIBSRC)/arch/$(ARCH)/include \ -I$(KLIBSRC)/include/bits$(BITSIZE) \ -D__KLIBC__ -DBITSIZE=$(BITSIZE) -I$(KLIBSRC)/include \ - -I$(SRCROOT)/linux/include + -I$(KERNEL_DIR)/include LDFLAGS = AR = $(CROSS)ar RANLIB = $(CROSS)ranlib -- cgit v1.2.3-54-g00ecf From db8f5cf28c13fd7d81d1aa32fe8df6864a0a019f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 3 Feb 2004 01:29:20 -0800 Subject: [PATCH] make /etc/hotplug.d/default/udev.hotplug symlink point to udevsend now. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e1846dd4c0..58e0bd51af 100644 --- a/Makefile +++ b/Makefile @@ -358,8 +358,8 @@ install: install-config install-dbus-policy all fi $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 - - rm -f $(DESTDIR)$(hotplugdir)/$(HOTPLUG_EXEC).hotplug - - ln -f -s $(sbindir)/$(HOTPLUG_EXEC) $(DESTDIR)$(hotplugdir)/udev.hotplug + - rm -f $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug + - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ -- cgit v1.2.3-54-g00ecf From d83a9b89e75aeb79856ddc4d95dc32a6bbd17f0e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 3 Feb 2004 01:29:45 -0800 Subject: [PATCH] add udevd and udevsend to the spec file. --- udev.spec | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/udev.spec b/udev.spec index ccc0ca7f6a..7a42dbc1fd 100644 --- a/udev.spec +++ b/udev.spec @@ -62,6 +62,10 @@ make CC="gcc $RPM_OPT_FLAGS" \ DEBUG=true \ %endif +# now build udevd on it's own, as it can't handle being built with klibc +make CC="gcc $RPM_OPT_FLAGS" udevd + + %install make DESTDIR=$RPM_BUILD_ROOT install \ %if %{dbus} @@ -70,7 +74,6 @@ make DESTDIR=$RPM_BUILD_ROOT install \ %if %{lsb} USE_LSB=true %endif - %post /sbin/chkconfig --add udev @@ -87,6 +90,8 @@ rm -rf $RPM_BUILD_ROOT %doc COPYING README TODO ChangeLog %attr(755,root,root) /sbin/udev %attr(755,root,root) /sbin/udevinfo +%attr(755,root,root) /sbin/udevsend +%attr(755,root,root) /sbin/udevd %attr(755,root,root) /udev/ %attr(755,root,root) /etc/udev/ %config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf @@ -100,6 +105,10 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_mandir}/man8/udev*.8* %changelog +* Mon Feb 2 2004 Greg Kroah-Hartman +- add udevsend, and udevd to the files +- add ability to build udevd with glibc after the rest is build with klibc + * Mon Jan 26 2004 Greg Kroah-Hartman - added udevinfo to rpm - added URL to spec file -- cgit v1.2.3-54-g00ecf From 33689812366dfc74825956b4a2a1f86081b51b9d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 3 Feb 2004 18:23:13 -0800 Subject: [PATCH] v016 release --- ChangeLog | 35 +++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a4b2c0099..ca1f765aef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +Summary of changes from v015 to v016 +============================================ + +: + o get_dev_number() in extras/ide-devfs.sh + +: + o FAQ udev.rules.devfs + +Greg Kroah-Hartman: + o add udevd and udevsend to the spec file + o make /etc/hotplug.d/default/udev.hotplug symlink point to udevsend now + o add KERNEL_DIR option so that the distros will be happy + o make udevsend binary even smaller + o udevsend now almost compiles with klibc, struct sockaddr_un is only problem now + o fix up logging code so that it can be built without it being enabled + o rework the logging code so that each program logs with the proper name in the syslog + o remove logging.c as it's no longer needed + o kill the last examples that contained the %D option + o remove a __KLIBC__ tests in libsysfs, as klibc now supports getpagesize() + o udevd - remove stupid locking error I wrote + o update to klibc version 0.101, fixing the stdin bug + o fix Makefile typo for USE_LSB install + o allow dbus code to actually build again + +Kay Sievers: + o let udevsend build with klibc + o udevd - config cleanup + o udevd - cleanup and better timeout handling + o fix possible buffer overflow + o udevd - next round of fixes + o udevinfo - missing options for man page + o udev - trivial style cleanup + + Summary of changes from v014 to v015 ============================================ diff --git a/Makefile b/Makefile index 58e0bd51af..631439a316 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ ROOT = udev DAEMON = udevd SENDER = udevsend HELPER = udevinfo -VERSION = 015_bk +VERSION = 016 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 7a42dbc1fd..238494c45b 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 015_bk +Version: 016 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 1dc10a94d8334b49ddf6fb4ceed33e5038105c83 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 3 Feb 2004 22:45:49 -0800 Subject: [PATCH] fix up Makefile dependancies for udev_version.h --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 631439a316..426ee577e3 100644 --- a/Makefile +++ b/Makefile @@ -259,15 +259,15 @@ $(ROOT): udev.o $(OBJS) $(HEADERS) $(GEN_HEADERS) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(HELPER): udevinfo.o $(OBJS) $(HEADERS) +$(HELPER): $(HEADERS) udevinfo.o $(OBJS) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(DAEMON): udevd.h udevd.o +$(DAEMON): udevd.h $(GEN_HEADERS) udevd.o $(LD) $(LDFLAGS) -lpthread -o $@ $(CRT0) udevd.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(SENDER): udevd.h udevsend.o +$(SENDER): udevd.h $(GEN_HEADERS) udevsend.o $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -- cgit v1.2.3-54-g00ecf From e5369f0a3adf14cebaf9537cba2d2092d392583d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 4 Feb 2004 00:55:24 -0800 Subject: [PATCH] include used function This includes the missing header for the use of getpid in logging.h. --- logging.h | 1 + 1 file changed, 1 insertion(+) diff --git a/logging.h b/logging.h index 3ee3e1acf0..485209adf3 100644 --- a/logging.h +++ b/logging.h @@ -31,6 +31,7 @@ #ifdef LOG #include +#include #include #undef info -- cgit v1.2.3-54-g00ecf From 16be1328898ed54d6b9cbc56ea113bf911450376 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 4 Feb 2004 00:56:10 -0800 Subject: [PATCH] 016_bk mark --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 426ee577e3..618adad71e 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ ROOT = udev DAEMON = udevd SENDER = udevsend HELPER = udevinfo -VERSION = 016 +VERSION = 016_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 238494c45b..20f4154998 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 016 +Version: 016_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 86590cd590a9f2fcc5917e8f5c85e024af1e58e0 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 5 Feb 2004 01:35:08 -0800 Subject: [PATCH] udevd - allow to bypass sequence number This patch allows udevsend to be called by the user and not only by the kernel with its SEQNUM. If no SEQNUM is given, we move the event straight to the exec queue and don't look if something is missing. I don't know if this is really needed, but some people seem trying to send events trough udevd instead of calling udev directly with their scripts and confuse the reorder logic with that. So at least, we may remove this source of confusion and udevsend is much much faster back than udev itself and it will also block concurrent events for the same devpath. --- udevd.c | 26 +++++++++++++++++++------- udevsend.c | 9 ++++----- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/udevd.c b/udevd.c index 331b7e4b84..f8b8c27ee4 100644 --- a/udevd.c +++ b/udevd.c @@ -205,16 +205,20 @@ static void *exec_queue_manager(void * parm) } } -/* move message from incoming to exec queue */ -static void msg_move_exec(struct list_head *head) +static void exec_queue_activate(void) { - list_move_tail(head, &exec_list); - /* signal queue activity to manager */ pthread_mutex_lock(&exec_active_lock); pthread_cond_signal(&exec_active); pthread_mutex_unlock(&exec_active_lock); } +/* move message from incoming to exec queue */ +static void msg_move_exec(struct list_head *head) +{ + list_move_tail(head, &exec_list); + exec_queue_activate(); +} + /* queue management thread handles the timeouts and dispatches the events */ static void *msg_queue_manager(void * parm) { @@ -298,9 +302,17 @@ static void *client_threads(void * parm) goto exit; } - pthread_mutex_lock(&msg_lock); - msg_queue_insert(msg); - pthread_mutex_unlock(&msg_lock); + /* if no seqnum is given, we move straight to exec queue */ + if (msg->seqnum == 0) { + pthread_mutex_lock(&exec_lock); + list_add(&msg->list, &exec_list); + exec_queue_activate(); + pthread_mutex_unlock(&exec_lock); + } else { + pthread_mutex_lock(&msg_lock); + msg_queue_insert(msg); + pthread_mutex_unlock(&msg_lock); + } exit: close(sock); diff --git a/udevsend.c b/udevsend.c index d3c74dd46a..9dc2b2e841 100644 --- a/udevsend.c +++ b/udevsend.c @@ -148,11 +148,10 @@ int main(int argc, char* argv[]) } seqnum = get_seqnum(); - if (seqnum == NULL) { - dbg("no seqnum"); - goto exit; - } - seq = atoi(seqnum); + if (seqnum == NULL) + seq = 0; + else + seq = atoi(seqnum); sock = socket(AF_LOCAL, SOCK_STREAM, 0); if (sock == -1) { -- cgit v1.2.3-54-g00ecf From 872344c41094f636fd667b9e619f8f219d814605 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 5 Feb 2004 01:35:15 -0800 Subject: [PATCH] udevd - switch socket path to abstract namespace As Chris Friesen suggested, here we switch the unix domains socket path to abstract namespace and get rid of the socket file in the filesystem. Hey, this was new to me today. So here a few words: Linux supports a abstract namespace for sockets. We don't need a physical file on the filesystem but only a unique string magically starting with the '\0' character. strace with real file: connect(3, {sa_family=AF_UNIX, path="/udev/.udevd.sock"}, 110) strace with abstract namespace: connect(3, {sa_family=AF_UNIX, path=@udevd}, 110) --- Makefile | 1 - udevd.c | 6 ++---- udevd.h | 1 + udevsend.c | 3 ++- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 618adad71e..35575806db 100644 --- a/Makefile +++ b/Makefile @@ -241,7 +241,6 @@ udev_version.h: @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ - @echo \#define UDEVD_SOCK \"$(udevdir)/\.udevd.sock\" >> $@ @echo \#define UDEVD_LOCK \"$(udevdir)/\.udevd.lock\" >> $@ # config files automatically generated diff --git a/udevd.c b/udevd.c index f8b8c27ee4..24cf9c9a7c 100644 --- a/udevd.c +++ b/udevd.c @@ -325,7 +325,6 @@ static void sig_handler(int signum) case SIGINT: case SIGTERM: unlink(UDEVD_LOCK); - unlink(UDEVD_SOCK); exit(20 + signum); break; default: @@ -378,9 +377,9 @@ int main(int argc, char *argv[]) memset(&saddr, 0x00, sizeof(saddr)); saddr.sun_family = AF_LOCAL; - strcpy(saddr.sun_path, UDEVD_SOCK); + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); - unlink(UDEVD_SOCK); ssock = socket(AF_LOCAL, SOCK_STREAM, 0); if (ssock == -1) { dbg("error getting socket"); @@ -426,6 +425,5 @@ int main(int argc, char *argv[]) } exit: close(ssock); - unlink(UDEVD_SOCK); exit(1); } diff --git a/udevd.h b/udevd.h index 6dbee3a295..8efe1d569c 100644 --- a/udevd.h +++ b/udevd.h @@ -27,6 +27,7 @@ #define UDEV_MAGIC "udevd_" UDEV_VERSION #define EVENT_TIMEOUT_SEC 5 #define UDEVSEND_CONNECT_RETRY 20 /* x 100 millisec */ +#define UDEVD_SOCK_PATH "udevd" struct hotplug_msg { char magic[20]; diff --git a/udevsend.c b/udevsend.c index 9dc2b2e841..223647785d 100644 --- a/udevsend.c +++ b/udevsend.c @@ -161,7 +161,8 @@ int main(int argc, char* argv[]) memset(&saddr, 0x00, sizeof(saddr)); saddr.sun_family = AF_LOCAL; - strcpy(saddr.sun_path, UDEVD_SOCK); + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); /* try to connect, if it fails start daemon */ retval = connect(sock, (struct sockaddr *) &saddr, sizeof(saddr)); -- cgit v1.2.3-54-g00ecf From 1dadabd79b28a4cd72382abf746e9cf4c0589617 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 6 Feb 2004 00:11:24 -0800 Subject: [PATCH] udevd - fix socket path length It seems that the guys are no longer differ about the right size of the socket address :) The kernel simply takes all bytes until the specified length as the name, so the real length should be enough. --- udevd.c | 4 +++- udevsend.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index 24cf9c9a7c..10d67f2c35 100644 --- a/udevd.c +++ b/udevd.c @@ -360,6 +360,7 @@ int main(int argc, char *argv[]) int csock; struct sockaddr_un saddr; struct sockaddr_un caddr; + socklen_t addrlen; socklen_t clen; pthread_t cli_tid; pthread_t mgr_msg_tid; @@ -379,6 +380,7 @@ int main(int argc, char *argv[]) saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; ssock = socket(AF_LOCAL, SOCK_STREAM, 0); if (ssock == -1) { @@ -386,7 +388,7 @@ int main(int argc, char *argv[]) exit(1); } - retval = bind(ssock, &saddr, sizeof(saddr)); + retval = bind(ssock, &saddr, addrlen); if (retval < 0) { dbg("bind failed\n"); goto exit; diff --git a/udevsend.c b/udevsend.c index 223647785d..246a097f26 100644 --- a/udevsend.c +++ b/udevsend.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -124,6 +125,7 @@ int main(int argc, char* argv[]) struct timespec tspec; int sock; struct sockaddr_un saddr; + socklen_t addrlen; #ifdef DEBUG init_logging("udevsend"); @@ -163,9 +165,10 @@ int main(int argc, char* argv[]) saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; /* try to connect, if it fails start daemon */ - retval = connect(sock, (struct sockaddr *) &saddr, sizeof(saddr)); + retval = connect(sock, (struct sockaddr *) &saddr, addrlen); if (retval != -1) { goto send; } else { -- cgit v1.2.3-54-g00ecf From aca29aa51f0c8dfb1e6b8d60471d4034b65effb5 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Fri, 6 Feb 2004 00:14:51 -0800 Subject: [PATCH] update extras/multipath incremental to udev-016/extras/multipath, * don't rely on the linux symlink in the udev/klibc dir since udev build doesn't use it anymore. This corrects build breakage * remove make_dm_node fn & call. Rely on udev for this. The first patch is to be applied. The second is conditioned by udev dealing correctly with devmap names. For this I can suggest a CALLOUT rule like this : KERNEL=3D"dm-[0-9]*", PROGRAM=3D"/tmp/name_devmap %M %m", NAME=3D"%k", SY= MLINK=3D"%c" With name_devmap like : #!/bin/sh /usr/sbin/dmsetup ls|/bin/grep "$1, $2"|/usr/bin/awk '{print $1}' --- extras/multipath/ChangeLog | 4 ++++ extras/multipath/Makefile | 1 + extras/multipath/main.c | 41 ----------------------------------------- 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index bb2f6baf89..c3361ff8e8 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,3 +1,7 @@ +2004-02-04 multipath-016 + * remove make_dm_node fn & call. Rely on udev for this. + * don't rely on the linux symlink in the udev/klibc dir since + udev build doesn't use it anymore. This corrects build breakage 2004-01-19 multipath-013 * update the DM target synthax to the 2.6.0-udm5 style 2003-12-29 multipath-012 diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index 0aac146a87..caf24bbd90 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -13,6 +13,7 @@ sysfsdir = $(udevdir)/libsysfs CC = gcc GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} +KERNEL_DIR = /lib/modules/${shell uname -r}/build CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I$(sysfsdir) -I. diff --git a/extras/multipath/main.c b/extras/multipath/main.c index e18e049128..d4dd89a305 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -558,46 +558,6 @@ coalesce_paths(struct env * conf, struct multipath * mp, return nmp; } -static int -make_dm_node(char * str) -{ - int r = 0; - char buff[FILE_NAME_SIZE]; - struct dm_names * names; - unsigned next = 0; - struct dm_task *dmt; - - if (!(dmt = dm_task_create(DM_DEVICE_LIST))) - return 0; - - if (!dm_task_run(dmt)) - goto out; - - if (!(names = dm_task_get_names(dmt))) - goto out; - - if (!names->dev) { - r = 1; - goto out; - } - - do { - if (0 == strcmp(names->name, str)) - break; - next = names->next; - names = (void *) names + next; - } while (next); - - sprintf(buff, "/dev/mapper/%s", str); - unlink(buff); - mknod(buff, 0600 | S_IFBLK, names->dev); - - out: - dm_task_destroy(dmt); - return r; - -} - static int dm_simplecmd(int task, const char *name) { int r = 0; @@ -711,7 +671,6 @@ setup_map(struct env * conf, struct path * all_paths, if (op == DM_DEVICE_RELOAD) dm_simplecmd(DM_DEVICE_RESUME, mp[index].wwid); - make_dm_node(mp[index].wwid); return 1; } -- cgit v1.2.3-54-g00ecf From d2cf99df7df132d8d90c4f7b438374618793c15a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 6 Feb 2004 01:04:28 -0800 Subject: [PATCH] udevd - kill the lockfile --- Makefile | 1 - udev-remove.c | 1 - udevd.c | 29 ----------------------------- 3 files changed, 31 deletions(-) diff --git a/Makefile b/Makefile index 35575806db..d3493f6940 100644 --- a/Makefile +++ b/Makefile @@ -241,7 +241,6 @@ udev_version.h: @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ - @echo \#define UDEVD_LOCK \"$(udevdir)/\.udevd.lock\" >> $@ # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf diff --git a/udev-remove.c b/udev-remove.c index 9db63ed93e..c21938fae7 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -34,7 +34,6 @@ #include "logging.h" #include "namedev.h" #include "udevdb.h" -#include "libsysfs/libsysfs.h" static int delete_path(char *path) { diff --git a/udevd.c b/udevd.c index 10d67f2c35..3ce8c8b07d 100644 --- a/udevd.c +++ b/udevd.c @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -30,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -324,7 +322,6 @@ static void sig_handler(int signum) switch (signum) { case SIGINT: case SIGTERM: - unlink(UDEVD_LOCK); exit(20 + signum); break; default: @@ -332,28 +329,6 @@ static void sig_handler(int signum) } } -static int one_and_only(void) -{ - char string[50]; - int lock_file; - - lock_file = open(UDEVD_LOCK, O_RDWR | O_CREAT, 0x640); - if (lock_file < 0) - return -1; - - /* see if we can lock */ - if (lockf(lock_file, F_TLOCK, 0) < 0) { - dbg("file is already locked, exit"); - close(lock_file); - return -1; - } - - snprintf(string, sizeof(string), "%d\n", getpid()); - write(lock_file, string, strlen(string)); - - return 0; -} - int main(int argc, char *argv[]) { int ssock; @@ -369,10 +344,6 @@ int main(int argc, char *argv[]) init_logging("udevd"); - /* only let one version of the daemon run at any one time */ - if (one_and_only() != 0) - exit(0); - signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); -- cgit v1.2.3-54-g00ecf From 2f6cbd19113167746dc4fb6b4f3f5fd64a1c211f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 6 Feb 2004 22:21:15 -0800 Subject: [PATCH] convert udevsend/udevd to DGRAM and single-threaded On Fri, Feb 06, 2004 at 01:08:24AM -0500, Chris Friesen wrote: > > Kay, you said "unless we can get rid of _all_ the threads or at least > getting faster, I don't want to change it." > > Well how about we get rid of all the threads, *and* we get faster? Yes, we are twice as fast now on my box :) > This patch applies to current bk trees, and does the following: > > 1) Switch to DGRAM sockets rather than STREAM. This simplifies things > as mentioned in the previous message. > > 2) Invalid sequence numbers are mapped to -1 rather than zero, since > zero is a valid sequence number (I think). Also, this allows for real > speed tests using scripts starting at a zero sequence number, since that > is what the initial expected sequence number is. > > 3) Get rid of all threading. This is the biggie. Some highlights: > a) timeout using setitimer() and SIGALRM > b) async child death notification via SIGCHLD > c) these two signal handlers do nothing but raise volatile flags, > all the > work is done in the main loop > d) locking no longer required I cleaned up the rest of the comments, the whitespace and a few names to match the whole thing. Please recheck it. Test script is switched to work on subsystem 'test' to let udev ignore it. --- Makefile | 2 +- test/udevd_test.sh | 65 ++++++------ udevd.c | 299 +++++++++++++++++++++-------------------------------- udevsend.c | 80 +++++++------- 4 files changed, 190 insertions(+), 256 deletions(-) diff --git a/Makefile b/Makefile index d3493f6940..97c6ca63bd 100644 --- a/Makefile +++ b/Makefile @@ -262,7 +262,7 @@ $(HELPER): $(HEADERS) udevinfo.o $(OBJS) $(STRIPCMD) $@ $(DAEMON): udevd.h $(GEN_HEADERS) udevd.o - $(LD) $(LDFLAGS) -lpthread -o $@ $(CRT0) udevd.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ $(SENDER): udevd.h $(GEN_HEADERS) udevsend.o diff --git a/test/udevd_test.sh b/test/udevd_test.sh index 506e886948..981a39d01d 100644 --- a/test/udevd_test.sh +++ b/test/udevd_test.sh @@ -3,81 +3,86 @@ # add/rem/add/rem/add sequence of sda/sdb/sdc # a few days longer and the socket of my usb-flash-reader is gone :) +export SEQNUM=0 +export ACTION=add +export DEVPATH=/test/init +./udevsend test + export SEQNUM=3 export ACTION=add -export DEVPATH=/block/sdc -./udevsend block +export DEVPATH=/test/sdc +./udevsend test export SEQNUM=1 export ACTION=add -export DEVPATH=/block/sda -./udevsend block +export DEVPATH=/test/sda +./udevsend test export SEQNUM=2 export ACTION=add -export DEVPATH=/block/sdb -./udevsend block +export DEVPATH=/test/sdb +./udevsend test export SEQNUM=4 export ACTION=remove -export DEVPATH=/block/sdc -./udevsend block +export DEVPATH=/test/sdc +./udevsend test export SEQNUM=5 export ACTION=remove -export DEVPATH=/block/sdb -./udevsend block +export DEVPATH=/test/sdb +./udevsend test export SEQNUM=8 export ACTION=add -export DEVPATH=/block/sdb -./udevsend block +export DEVPATH=/test/sdb +./udevsend test export SEQNUM=6 export ACTION=remove -export DEVPATH=/block/sda -./udevsend block +export DEVPATH=/test/sda +./udevsend test export SEQNUM=7 export ACTION=add -export DEVPATH=/block/sda -#./udevsend block +export DEVPATH=/test/sda +#./udevsend test sleep 2 export SEQNUM=9 export ACTION=add -export DEVPATH=/block/sdc -./udevsend block +export DEVPATH=/test/sdc +./udevsend test export SEQNUM=11 export ACTION=remove -export DEVPATH=/block/sdb -./udevsend block +export DEVPATH=/test/sdb +./udevsend test export SEQNUM=10 export ACTION=remove -export DEVPATH=/block/sdc -./udevsend block +export DEVPATH=/test/sdc +./udevsend test export SEQNUM=13 export ACTION=add -export DEVPATH=/block/sda -./udevsend block +export DEVPATH=/test/sda +./udevsend test export SEQNUM=14 export ACTION=add -export DEVPATH=/block/sdb -./udevsend block +export DEVPATH=/test/sdb +./udevsend test export SEQNUM=15 export ACTION=add -export DEVPATH=/block/sdc -./udevsend block +export DEVPATH=/test/sdc +./udevsend test sleep 2 export SEQNUM=12 export ACTION=remove -export DEVPATH=/block/sda -./udevsend block +export DEVPATH=/test/sda +./udevsend test diff --git a/udevd.c b/udevd.c index 3ce8c8b07d..8ba833186e 100644 --- a/udevd.c +++ b/udevd.c @@ -2,6 +2,7 @@ * udevd.c - hotplug event serializer * * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004 Chris Friesen * * * This program is free software; you can redistribute it and/or modify it @@ -19,7 +20,6 @@ * */ -#include #include #include #include @@ -32,6 +32,7 @@ #include #include #include +#include #include "list.h" #include "udev.h" @@ -39,22 +40,17 @@ #include "udevd.h" #include "logging.h" - unsigned char logname[42]; -static pthread_mutex_t msg_lock; -static pthread_mutex_t msg_active_lock; -static pthread_cond_t msg_active; -static pthread_mutex_t exec_lock; -static pthread_mutex_t exec_active_lock; -static pthread_cond_t exec_active; -static pthread_mutex_t running_lock; -static pthread_attr_t thr_attr; static int expected_seqnum = 0; +volatile static int children_waiting; +volatile static int msg_q_timeout; LIST_HEAD(msg_list); LIST_HEAD(exec_list); LIST_HEAD(running_list); +static void exec_queue_manager(void); +static void msg_queue_manager(void); static void msg_dump_queue(void) { @@ -75,17 +71,16 @@ static struct hotplug_msg *msg_create(void) struct hotplug_msg *new_msg; new_msg = malloc(sizeof(struct hotplug_msg)); - if (new_msg == NULL) { + if (new_msg == NULL) dbg("error malloc"); - return NULL; - } return new_msg; } -static void msg_delete(struct hotplug_msg *msg) +static void run_queue_delete(struct hotplug_msg *msg) { - if (msg != NULL) - free(msg); + list_del(&msg->list); + free(msg); + exec_queue_manager(); } /* orders the message in the queue by sequence number */ @@ -103,21 +98,16 @@ static void msg_queue_insert(struct hotplug_msg *msg) /* store timestamp of queuing */ msg->queue_time = time(NULL); - /* signal queue activity to manager */ - pthread_mutex_lock(&msg_active_lock); - pthread_cond_signal(&msg_active); - pthread_mutex_unlock(&msg_active_lock); + /* run msg queue manager */ + msg_queue_manager(); return ; } /* forks event and removes event from run queue when finished */ -static void *run_threads(void * parm) +static void udev_run(struct hotplug_msg *msg) { pid_t pid; - struct hotplug_msg *msg; - - msg = parm; setenv("ACTION", msg->action, 1); setenv("DEVPATH", msg->devpath, 1); @@ -131,190 +121,124 @@ static void *run_threads(void * parm) break; case -1: dbg("fork of child failed"); - goto exit; + run_queue_delete(msg); + break; default: - /* wait for exit of child */ - dbg("==> exec seq %d [%d] working at '%s'", - msg->seqnum, pid, msg->devpath); - wait(NULL); - dbg("<== exec seq %d came back", msg->seqnum); + /* get SIGCHLD in main loop */ + dbg("==> exec seq %d [%d] working at '%s'", msg->seqnum, pid, msg->devpath); + msg->pid = pid; } - -exit: - /* remove event from run list */ - pthread_mutex_lock(&running_lock); - list_del_init(&msg->list); - pthread_mutex_unlock(&running_lock); - - msg_delete(msg); - - /* signal queue activity to exec manager */ - pthread_mutex_lock(&exec_active_lock); - pthread_cond_signal(&exec_active); - pthread_mutex_unlock(&exec_active_lock); - - pthread_exit(0); } /* returns already running task with devpath */ static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) { struct hotplug_msg *loop_msg; - struct hotplug_msg *tmp_msg; - - list_for_each_entry_safe(loop_msg, tmp_msg, &running_list, list) + list_for_each_entry(loop_msg, &running_list, list) if (strncmp(loop_msg->devpath, msg->devpath, sizeof(loop_msg->devpath)) == 0) return loop_msg; return NULL; } -/* queue management executes the events and delays events for the same devpath */ -static void *exec_queue_manager(void * parm) +/* exec queue management routine executes the events and delays events for the same devpath */ +static void exec_queue_manager() { struct hotplug_msg *loop_msg; struct hotplug_msg *tmp_msg; struct hotplug_msg *msg; - pthread_t run_tid; - while (1) { - pthread_mutex_lock(&exec_lock); - list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, list) { - msg = running_with_devpath(loop_msg); - if (msg == NULL) { - /* move event to run list */ - pthread_mutex_lock(&running_lock); - list_move_tail(&loop_msg->list, &running_list); - pthread_mutex_unlock(&running_lock); - - pthread_create(&run_tid, &thr_attr, run_threads, (void *) loop_msg); - - dbg("moved seq %d to running list", loop_msg->seqnum); - } else { - dbg("delay seq %d, cause seq %d already working on '%s'", - loop_msg->seqnum, msg->seqnum, msg->devpath); - } + list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, list) { + msg = running_with_devpath(loop_msg); + if (!msg) { + /* move event to run list */ + list_move_tail(&loop_msg->list, &running_list); + udev_run(loop_msg); + dbg("moved seq %d to running list", loop_msg->seqnum); + } else { + dbg("delay seq %d, cause seq %d already working on '%s'", + loop_msg->seqnum, msg->seqnum, msg->devpath); } - pthread_mutex_unlock(&exec_lock); - - /* wait for activation, new events or childs coming back */ - pthread_mutex_lock(&exec_active_lock); - pthread_cond_wait(&exec_active, &exec_active_lock); - pthread_mutex_unlock(&exec_active_lock); } } -static void exec_queue_activate(void) -{ - pthread_mutex_lock(&exec_active_lock); - pthread_cond_signal(&exec_active); - pthread_mutex_unlock(&exec_active_lock); -} - -/* move message from incoming to exec queue */ -static void msg_move_exec(struct list_head *head) +static void msg_move_exec(struct hotplug_msg *msg) { - list_move_tail(head, &exec_list); - exec_queue_activate(); + list_move_tail(&msg->list, &exec_list); + exec_queue_manager(); + expected_seqnum = msg->seqnum+1; + dbg("moved seq %d to exec, next expected is %d", + msg->seqnum, expected_seqnum); } -/* queue management thread handles the timeouts and dispatches the events */ -static void *msg_queue_manager(void * parm) +/* msg queue management routine handles the timeouts and dispatches the events */ +static void msg_queue_manager() { struct hotplug_msg *loop_msg; struct hotplug_msg *tmp_msg; time_t msg_age = 0; - struct timespec tv; - while (1) { - dbg("msg queue manager, next expected is %d", expected_seqnum); - pthread_mutex_lock(&msg_lock); - pthread_mutex_lock(&exec_lock); + dbg("msg queue manager, next expected is %d", expected_seqnum); recheck: - list_for_each_entry_safe(loop_msg, tmp_msg, &msg_list, list) { - /* move event with expected sequence to the exec list */ - if (loop_msg->seqnum == expected_seqnum) { - msg_move_exec(&loop_msg->list); - expected_seqnum++; - dbg("moved seq %d to exec, next expected is %d", - loop_msg->seqnum, expected_seqnum); - continue; - } - - /* move event with expired timeout to the exec list */ - msg_age = time(NULL) - loop_msg->queue_time; - if (msg_age > EVENT_TIMEOUT_SEC-1) { - msg_move_exec(&loop_msg->list); - expected_seqnum = loop_msg->seqnum+1; - dbg("moved seq %d to exec, reset next expected to %d", - loop_msg->seqnum, expected_seqnum); - goto recheck; - } else { - break; - } + list_for_each_entry_safe(loop_msg, tmp_msg, &msg_list, list) { + /* move event with expected sequence to the exec list */ + if (loop_msg->seqnum == expected_seqnum) { + msg_move_exec(loop_msg); + continue; } - msg_dump_queue(); - pthread_mutex_unlock(&exec_lock); - pthread_mutex_unlock(&msg_lock); - - /* wait until queue gets active or next message timeout expires */ - pthread_mutex_lock(&msg_active_lock); - - if (list_empty(&msg_list) == 0) { - tv.tv_sec = time(NULL) + EVENT_TIMEOUT_SEC - msg_age; - tv.tv_nsec = 0; - dbg("next event expires in %li seconds", - EVENT_TIMEOUT_SEC - msg_age); - pthread_cond_timedwait(&msg_active, &msg_active_lock, &tv); + /* move event with expired timeout to the exec list */ + msg_age = time(NULL) - loop_msg->queue_time; + if (msg_age > EVENT_TIMEOUT_SEC-1) { + msg_move_exec(loop_msg); + goto recheck; } else { - pthread_cond_wait(&msg_active, &msg_active_lock); + break; } - pthread_mutex_unlock(&msg_active_lock); + } + + msg_dump_queue(); + + if (list_empty(&msg_list) == 0) { + /* set timeout for remaining queued events */ + struct itimerval itv = {{0, 0}, {EVENT_TIMEOUT_SEC - msg_age, 0}}; + dbg("next event expires in %li seconds", + EVENT_TIMEOUT_SEC - msg_age); + setitimer(ITIMER_REAL, &itv, 0); } } -/* every connect creates a thread which gets the msg, queues it and exits */ -static void *client_threads(void * parm) +/* receive the msg, do some basic sanity checks, and queue it */ +static void handle_msg(int sock) { - int sock; struct hotplug_msg *msg; int retval; - sock = (int) parm; - msg = msg_create(); if (msg == NULL) { dbg("unable to store message"); - goto exit; + return; } retval = recv(sock, msg, sizeof(struct hotplug_msg), 0); if (retval < 0) { - dbg("unable to receive message"); - goto exit; + if (errno != EINTR) + dbg("unable to receive message"); + return; } - + if (strncmp(msg->magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { dbg("message magic '%s' doesn't match, ignore it", msg->magic); - msg_delete(msg); - goto exit; + free(msg); + return; } /* if no seqnum is given, we move straight to exec queue */ - if (msg->seqnum == 0) { - pthread_mutex_lock(&exec_lock); + if (msg->seqnum == -1) { list_add(&msg->list, &exec_list); - exec_queue_activate(); - pthread_mutex_unlock(&exec_lock); + exec_queue_manager(); } else { - pthread_mutex_lock(&msg_lock); msg_queue_insert(msg); - pthread_mutex_unlock(&msg_lock); } - -exit: - close(sock); - pthread_exit(0); } static void sig_handler(int signum) @@ -324,28 +248,48 @@ static void sig_handler(int signum) case SIGTERM: exit(20 + signum); break; + case SIGALRM: + msg_q_timeout = 1; + break; + case SIGCHLD: + children_waiting = 1; + break; default: dbg("unhandled signal"); } } +static void udev_done(int pid) +{ + /* find msg associated with pid and delete it */ + struct hotplug_msg *msg; + + list_for_each_entry(msg, &running_list, list) { + if (msg->pid == pid) { + dbg("<== exec seq %d came back", msg->seqnum); + run_queue_delete(msg); + return; + } + } +} + int main(int argc, char *argv[]) { int ssock; - int csock; struct sockaddr_un saddr; - struct sockaddr_un caddr; socklen_t addrlen; - socklen_t clen; - pthread_t cli_tid; - pthread_t mgr_msg_tid; - pthread_t mgr_exec_tid; int retval; init_logging("udevd"); signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); + signal(SIGALRM, sig_handler); + signal(SIGCHLD, sig_handler); + + /* we want these two to interrupt system calls */ + siginterrupt(SIGALRM, 1); + siginterrupt(SIGCHLD, 1); memset(&saddr, 0x00, sizeof(saddr)); saddr.sun_family = AF_LOCAL; @@ -353,48 +297,37 @@ int main(int argc, char *argv[]) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - ssock = socket(AF_LOCAL, SOCK_STREAM, 0); + ssock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (ssock == -1) { dbg("error getting socket"); exit(1); } + /* the bind takes care of ensuring only one copy running */ retval = bind(ssock, &saddr, addrlen); if (retval < 0) { dbg("bind failed\n"); goto exit; } - retval = listen(ssock, SOMAXCONN); - if (retval < 0) { - dbg("listen failed\n"); - goto exit; - } - - pthread_mutex_init(&msg_lock, NULL); - pthread_mutex_init(&msg_active_lock, NULL); - pthread_mutex_init(&exec_lock, NULL); - pthread_mutex_init(&exec_active_lock, NULL); - pthread_mutex_init(&running_lock, NULL); - - /* set default attributes for created threads */ - pthread_attr_init(&thr_attr); - pthread_attr_setdetachstate(&thr_attr, PTHREAD_CREATE_DETACHED); - pthread_attr_setstacksize(&thr_attr, 16 * 1024); + while (1) { + handle_msg(ssock); - /* init queue management */ - pthread_create(&mgr_msg_tid, &thr_attr, msg_queue_manager, NULL); - pthread_create(&mgr_exec_tid, &thr_attr, exec_queue_manager, NULL); + while(msg_q_timeout) { + msg_q_timeout = 0; + msg_queue_manager(); + } - clen = sizeof(caddr); - /* main loop */ - while (1) { - csock = accept(ssock, &caddr, &clen); - if (csock < 0) { - dbg("client accept failed\n"); - continue; + while(children_waiting) { + children_waiting = 0; + /* reap all dead children */ + while(1) { + int pid = waitpid(-1, 0, WNOHANG); + if ((pid == -1) || (pid == 0)) + break; + udev_done(pid); + } } - pthread_create(&cli_tid, &thr_attr, client_threads, (void *) csock); } exit: close(ssock); diff --git a/udevsend.c b/udevsend.c index 246a097f26..f6de88565f 100644 --- a/udevsend.c +++ b/udevsend.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "udev.h" #include "udev_version.h" @@ -119,13 +120,14 @@ int main(int argc, char* argv[]) char *subsystem; char *seqnum; int seq; - int retval = -EINVAL; + int retval = 1; int size; int loop; struct timespec tspec; int sock; struct sockaddr_un saddr; socklen_t addrlen; + int started_daemon = 0; #ifdef DEBUG init_logging("udevsend"); @@ -151,11 +153,11 @@ int main(int argc, char* argv[]) seqnum = get_seqnum(); if (seqnum == NULL) - seq = 0; + seq = -1; else seq = atoi(seqnum); - sock = socket(AF_LOCAL, SOCK_STREAM, 0); + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { dbg("error getting socket"); goto exit; @@ -167,48 +169,42 @@ int main(int argc, char* argv[]) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - /* try to connect, if it fails start daemon */ - retval = connect(sock, (struct sockaddr *) &saddr, addrlen); - if (retval != -1) { - goto send; - } else { - dbg("connect failed, try starting daemon..."); - retval = start_daemon(); - if (retval == 0) { + size = build_hotplugmsg(&message, action, devpath, subsystem, seq); + + /* If we can't send, try to start daemon and resend message */ + loop = UDEVSEND_CONNECT_RETRY; + while (loop--) { + retval = sendto(sock, &message, size, 0, (struct sockaddr*)&saddr, addrlen); + if (retval != -1) { + retval = 0; + goto close_and_exit; + } + + if (errno != ECONNREFUSED) { + dbg("error sending message"); + goto close_and_exit; + } + + if (!started_daemon) { + dbg("connect failed, try starting daemon..."); + retval = start_daemon(); + if (retval) { + dbg("error starting daemon"); + goto exit; + } + dbg("daemon started"); + started_daemon = 1; } else { - dbg("error starting daemon"); - goto exit; + dbg("retry to connect %d", UDEVSEND_CONNECT_RETRY - loop); + tspec.tv_sec = 0; + tspec.tv_nsec = 100000000; /* 100 millisec */ + nanosleep(&tspec, NULL); } } - - /* try to connect while daemon to starts */ - tspec.tv_sec = 0; - tspec.tv_nsec = 100000000; /* 100 millisec */ - loop = UDEVSEND_CONNECT_RETRY; - while (loop--) { - retval = connect(sock, (struct sockaddr *) &saddr, sizeof(saddr)); - if (retval != -1) - goto send; - else - dbg("retry to connect %d", - UDEVSEND_CONNECT_RETRY - loop); - nanosleep(&tspec, NULL); - } - dbg("error connecting to daemon, start daemon failed"); - goto exit; - -send: - size = build_hotplugmsg(&message, action, devpath, subsystem, seq); - retval = send(sock, &message, size, 0); - if (retval == -1) { - dbg("error sending message"); - close (sock); - goto exit; - } - close (sock); - return 0; - + +close_and_exit: + close(sock); exit: - return 1; + return retval; } -- cgit v1.2.3-54-g00ecf From 01504bd96b6e7cb6ad1350d6d0a0c6a1300409b8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 11 Feb 2004 18:27:55 -0800 Subject: [PATCH] sync with latest version of klibc (0.107) --- klibc/klibc/CAVEATS | 10 ++ klibc/klibc/MCONFIG | 38 +---- klibc/klibc/Makefile | 5 +- klibc/klibc/README | 17 ++- klibc/klibc/__put_env.c | 60 ++++++++ klibc/klibc/arch/x86_64/include/klibc/archsys.h | 85 ++++++++++- klibc/klibc/include/elf.h | 4 +- klibc/klibc/include/signal.h | 2 +- klibc/klibc/include/stdint.h | 3 + klibc/klibc/include/sys/elf32.h | 115 +++++++++++++++ klibc/klibc/include/sys/elf64.h | 115 +++++++++++++++ klibc/klibc/include/sys/elfcommon.h | 186 ++++++++++++++++++++++++ klibc/klibc/include/sys/sysmacros.h | 31 ++++ klibc/klibc/include/sys/time.h | 1 + klibc/klibc/include/sys/types.h | 24 ++- klibc/klibc/include/sys/wait.h | 9 ++ klibc/klibc/include/unistd.h | 6 + klibc/klibc/putenv.c | 40 +++++ klibc/klibc/setenv.c | 85 +---------- klibc/klibc/signal.c | 11 -- klibc/klibc/sysv_signal.c | 11 ++ klibc/klibc/tests/environ.c | 24 +++ klibc/klibc/tests/getenvtest.c | 26 ---- klibc/klibc/tests/nfs_no_rpc.c | 2 +- klibc/klibc/tests/setenvtest.c | 38 +++++ 25 files changed, 763 insertions(+), 185 deletions(-) create mode 100644 klibc/klibc/__put_env.c create mode 100644 klibc/klibc/include/sys/elf32.h create mode 100644 klibc/klibc/include/sys/elf64.h create mode 100644 klibc/klibc/include/sys/elfcommon.h create mode 100644 klibc/klibc/include/sys/sysmacros.h create mode 100644 klibc/klibc/putenv.c delete mode 100644 klibc/klibc/signal.c create mode 100644 klibc/klibc/sysv_signal.c create mode 100644 klibc/klibc/tests/environ.c delete mode 100644 klibc/klibc/tests/getenvtest.c create mode 100644 klibc/klibc/tests/setenvtest.c diff --git a/klibc/klibc/CAVEATS b/klibc/klibc/CAVEATS index c7131ac367..5bc11e4179 100644 --- a/klibc/klibc/CAVEATS +++ b/klibc/klibc/CAVEATS @@ -49,3 +49,13 @@ theading: klibc is not thread-safe. Consequently, clone() or any of the pthreads functions are not included. + +bsd_signal vs sysv_signal: +-------------------------- + +There is no signal() call, because you never know if you want +Linux/SysV semantics (SA_RESETHAND) or GNU/BSD semantics (SA_RESTART). +The best, in *any* circumstances, is to never use signal() and instead +use sigaction(), but in order to simplify porting you can use either +sysv_signal() or bsd_signal(), depending on what you actually want. + diff --git a/klibc/klibc/MCONFIG b/klibc/klibc/MCONFIG index a46a98a9dd..253a9461b7 100644 --- a/klibc/klibc/MCONFIG +++ b/klibc/klibc/MCONFIG @@ -5,45 +5,9 @@ SRCROOT = .. include ../MCONFIG +include ../MRULES WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline CFLAGS = -Wp,-MD,$(dir $*).$(notdir $*).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) SOFLAGS = -fPIC - -.SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss - -.c.o: - $(CC) $(CFLAGS) -c -o $@ $< - -.c.i: - $(CC) $(CFLAGS) -E -o $@ $< - -.c.s: - $(CC) $(CFLAGS) -S -o $@ $< - -.S.o: - $(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $< - -.S.s: - $(CC) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $< - -.S.lo: - $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -c -o $@ $< - -.S.ls: - $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -E -o $@ $< - -.s.o: - $(CC) $(CFLAGS) -x assembler -c -o $@ $< - -.ls.lo: - $(CC) $(CFLAGS) $(SOFLAGS) -x assembler -c -o $@ $< - -.c.lo: - $(CC) $(CFLAGS) $(SOFLAGS) -c -o $@ $< - -.c.ls: - $(CC) $(CFLAGS) $(SOFLAGS) -S -o $@ $< - - diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index def201524a..0d5b197f0d 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -22,7 +22,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ fopen.o fread.o fread2.o fgetc.o fgets.o \ fwrite.o fwrite2.o fputc.o fputs.o puts.o \ sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \ - __signal.o signal.o bsd_signal.o siglist.o siglongjmp.o \ + __signal.o sysv_signal.o bsd_signal.o siglist.o siglongjmp.o \ sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o getpagesize.o \ memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ @@ -33,7 +33,8 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ strsep.o strtok.o \ gethostname.o getdomainname.o getcwd.o \ seteuid.o setegid.o setresuid.o setresgid.o \ - getenv.o setenv.o unsetenv.o getopt.o readdir.o \ + getenv.o setenv.o putenv.o __put_env.o unsetenv.o \ + getopt.o readdir.o \ syslog.o closelog.o pty.o isatty.o reboot.o \ time.o utime.o fdatasync.o llseek.o select.o nice.o getpriority.o \ qsort.o lrand48.o srand48.o seed48.o \ diff --git a/klibc/klibc/README b/klibc/klibc/README index ce0ad7ba6a..4495908a22 100644 --- a/klibc/klibc/README +++ b/klibc/klibc/README @@ -9,12 +9,12 @@ this: a) In the source root directory (the directory above the one in which this file is found) create a symlink called "linux" pointing to a - reasonably recent Linux kernel tree (2.4 or 2.5 should be OK.) + reasonably recent Linux kernel tree (2.4 or 2.6 should be OK.) This tree must have the include/asm symlink set up for the architecture you're compiling for, and include/linux/autoconf.h must exist. The easiest way to make sure of all of these is to do a "make config" or any of its variants on the kernel tree is - question, followed by a "make dep". + question, followed by a "make dep" (2.4) or "make prepare" (2.6). b) If you're cross-compiling, change ARCH in the main MCONFIG file to the appropriate architecture, and set CROSS to your toolchain @@ -34,16 +34,17 @@ b) If you're cross-compiling, change ARCH in the main MCONFIG file to The following is the last known status of various architectures: - Known to work: alpha arm ia64 i386 s390 s390x sparc + Known to work: alpha arm ia64 i386 ppc s390 s390x sparc sparc64 x86_64* Works static, not shared: mips* arm-thumb sh* - Might work: ppc ppc64 + Might work: ppc64 Need porting work: cris m68k mips64 parisc x86_64: requires a kernel header patch (to be created) mips, sh: linker problem; might work with fixed linker - Shared library support for sparc/sparc64 requires binutils 2.13.90.0.4. + Shared library support requires binutils 2.13.90.0.4 or later on + many architectures. Note that even the "known to work" ones likely have bugs. Please report them if you run into them. @@ -52,6 +53,10 @@ c) Type "make" and pray... d) Try the test programs in the tests/ directory. They should run... -Contact me at for more info. +Contact the klibc mailing list: + + http://www.zytor.com/mailman/listinfo/klibc + +... for more info. -hpa diff --git a/klibc/klibc/__put_env.c b/klibc/klibc/__put_env.c new file mode 100644 index 0000000000..7e55f2c43b --- /dev/null +++ b/klibc/klibc/__put_env.c @@ -0,0 +1,60 @@ +/* + * __put_env.c - common code for putenv() and setenv() + */ + +#include +#include +#include +#include + +/* Initialized to zero, meaning "not malloc'd" */ +static size_t __environ_size; + +/* str should be a duplicated version of the input string; + len is the length of the key including the = sign */ +int __put_env(char *str, size_t len, int overwrite) +{ + char **p, *q; + char **newenv; + size_t n; + + n = 1; /* Include space for final NULL */ + for ( p = environ ; (q = *p) ; p++ ) { + n++; + if ( !strncmp(q,str,len) ) { + if ( !overwrite ) + free(str); + else + *p = str; /* Possible memory leak... */ + return 0; + } + } + + /* Need to extend the environment */ + if ( n < __environ_size ) { + p[1] = NULL; + *p = str; + return 0; + } else { + if ( __environ_size ) { + newenv = realloc(environ, (__environ_size << 1)*sizeof(char *)); + if ( !newenv ) + return -1; + + __environ_size <<= 1; + } else { + /* Make a reasonable guess how much more space we need */ + size_t newsize = n+32; + newenv = malloc(newsize*sizeof(char *)); + if ( !newenv ) + return -1; + + memcpy(newenv, environ, n*sizeof(char *)); + __environ_size = newsize; + } + newenv[n-1] = str; /* Old NULL position */ + newenv[n] = NULL; + environ = newenv; + } + return 0; +} diff --git a/klibc/klibc/arch/x86_64/include/klibc/archsys.h b/klibc/klibc/arch/x86_64/include/klibc/archsys.h index 3bd8b0a5d9..2ec72cd397 100644 --- a/klibc/klibc/arch/x86_64/include/klibc/archsys.h +++ b/klibc/klibc/arch/x86_64/include/klibc/archsys.h @@ -7,9 +7,88 @@ #ifndef _KLIBC_ARCHSYS_H #define _KLIBC_ARCHSYS_H -/* x86-64 seems to miss _syscall6() from its headers */ +/* The x86-64 syscall headers are needlessly inefficient */ -#ifndef _syscall6 +#undef _syscall0 +#undef _syscall1 +#undef _syscall2 +#undef _syscall3 +#undef _syscall4 +#undef _syscall5 +#undef _syscall6 + +#define _syscall0(type,name) \ +type name (void) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name (type1 arg1) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name (type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name (type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ + "d" (arg3) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ +{ \ +long __res; \ +register type4 __r10 asm("%r10") = arg4; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ + "d" (arg3),"r" (__r10) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +register type4 __r10 asm("%r10") = arg4; \ +register type5 __r8 asm("%r8") = arg5; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ + "d" (arg3),"r" (__r10),"r" (__r8) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ type5,arg5,type6,arg6) \ @@ -27,6 +106,4 @@ __asm__ volatile (__syscall \ __syscall_return(type,__res); \ } -#endif /* _syscall6 missing */ - #endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/include/elf.h b/klibc/klibc/include/elf.h index bd0f3e7f9b..52f47d042e 100644 --- a/klibc/klibc/include/elf.h +++ b/klibc/klibc/include/elf.h @@ -5,8 +5,8 @@ #ifndef _ELF_H #define _ELF_H -#include -#include +#include +#include #endif /* _ELF_H */ diff --git a/klibc/klibc/include/signal.h b/klibc/klibc/include/signal.h index f9eebb2a29..513b4e5a04 100644 --- a/klibc/klibc/include/signal.h +++ b/klibc/klibc/include/signal.h @@ -64,7 +64,7 @@ static __inline__ int sigismember(sigset_t *__set, int __signum) } __extern __sighandler_t __signal(int, __sighandler_t, int); -__extern __sighandler_t signal(int, __sighandler_t); +__extern __sighandler_t sysv_signal(int, __sighandler_t); __extern __sighandler_t bsd_signal(int, __sighandler_t); __extern int sigaction(int, const struct sigaction *, struct sigaction *); __extern int sigprocmask(int, const sigset_t *, sigset_t *); diff --git a/klibc/klibc/include/stdint.h b/klibc/klibc/include/stdint.h index 2022a30fd7..47fec18594 100644 --- a/klibc/klibc/include/stdint.h +++ b/klibc/klibc/include/stdint.h @@ -110,4 +110,7 @@ typedef uint64_t uintmax_t; #endif +/* Keep the kernel from trying to define these types... */ +#define __BIT_TYPES_DEFINED__ + #endif /* _STDINT_H */ diff --git a/klibc/klibc/include/sys/elf32.h b/klibc/klibc/include/sys/elf32.h new file mode 100644 index 0000000000..652de5bc5f --- /dev/null +++ b/klibc/klibc/include/sys/elf32.h @@ -0,0 +1,115 @@ +/* + * sys/elf32.h + */ + +#ifndef _SYS_ELF32_H +#define _SYS_ELF32_H + +#include + +/* ELF standard typedefs (yet more proof that was way overdue) */ +typedef uint16_t Elf32_Half; +typedef int16_t Elf32_SHalf; +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; + +typedef uint32_t Elf32_Off; +typedef uint32_t Elf32_Addr; +typedef uint16_t Elf32_Section; + +/* Dynamic header */ + +typedef struct elf32_dyn { + Elf32_Sword d_tag; + union{ + Elf32_Sword d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +/* Relocations */ + +#define ELF32_R_SYM(x) ((x) >> 8) +#define ELF32_R_TYPE(x) ((x) & 0xff) + +typedef struct elf32_rel { + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct elf32_rela { + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +/* Symbol */ + +typedef struct elf32_sym { + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; +} Elf32_Sym; + +/* Main file header */ + +typedef struct elf32_hdr { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +/* Program header */ + +typedef struct elf32_phdr { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + + +/* Section header */ + +typedef struct elf32_shdr { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +/* Note header */ +typedef struct elf32_note { + Elf32_Word n_namesz; /* Name size */ + Elf32_Word n_descsz; /* Content size */ + Elf32_Word n_type; /* Content type */ +} Elf32_Nhdr; + +#endif /* _SYS_ELF32_H */ + diff --git a/klibc/klibc/include/sys/elf64.h b/klibc/klibc/include/sys/elf64.h new file mode 100644 index 0000000000..750ddac4d9 --- /dev/null +++ b/klibc/klibc/include/sys/elf64.h @@ -0,0 +1,115 @@ +/* + * sys/elf64.h + */ + +#ifndef _SYS_ELF64_H +#define _SYS_ELF64_H + +#include + +/* ELF standard typedefs (yet more proof that was way overdue) */ +typedef uint16_t Elf64_Half; +typedef int16_t Elf64_SHalf; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; + +typedef uint64_t Elf64_Off; +typedef uint64_t Elf64_Addr; +typedef uint16_t Elf64_Section; + +/* Dynamic header */ + +typedef struct elf64_dyn { + Elf64_Sxword d_tag; + union{ + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + +/* Relocations */ + +#define ELF64_R_SYM(x) ((x) >> 32) +#define ELF64_R_TYPE(x) ((x) & 0xffffffff) + +typedef struct elf64_rel { + Elf64_Addr r_offset; + Elf64_Xword r_info; +} Elf64_Rel; + +typedef struct elf64_rela { + Elf64_Addr r_offset; + Elf64_Xword r_info; + Elf64_Sxword r_addend; +} Elf64_Rela; + +/* Symbol */ + +typedef struct elf64_sym { + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Half st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; +} Elf64_Sym; + +/* Main file header */ + +typedef struct elf64_hdr { + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +/* Program header */ + +typedef struct elf64_phdr { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +} Elf64_Phdr; + + +/* Section header */ + +typedef struct elf64_shdr { + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; +} Elf64_Shdr; + +/* Note header */ +typedef struct elf64_note { + Elf64_Word n_namesz; /* Name size */ + Elf64_Word n_descsz; /* Content size */ + Elf64_Word n_type; /* Content type */ +} Elf64_Nhdr; + +#endif /* _SYS_ELF64_H */ + diff --git a/klibc/klibc/include/sys/elfcommon.h b/klibc/klibc/include/sys/elfcommon.h new file mode 100644 index 0000000000..f984f6a56b --- /dev/null +++ b/klibc/klibc/include/sys/elfcommon.h @@ -0,0 +1,186 @@ +/* + * sys/elfcommon.h + */ + +#ifndef _SYS_ELFCOMMON_H +#define _SYS_ELFCOMMON_H + +/* Segment types */ +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_LOOS 0x60000000 +#define PT_HIOS 0x6fffffff +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff +#define PT_GNU_EH_FRAME 0x6474e550 /* Extension, eh? */ + +/* ELF file types */ +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + +/* ELF machine types */ +#define EM_NONE 0 +#define EM_M32 1 +#define EM_SPARC 2 +#define EM_386 3 +#define EM_68K 4 +#define EM_88K 5 +#define EM_486 6 /* Not used in Linux at least */ +#define EM_860 7 +#define EM_MIPS 8 /* R3k, bigendian(?) */ +#define EM_MIPS_RS4_BE 10 /* R4k BE */ +#define EM_PARISC 15 +#define EM_SPARC32PLUS 18 +#define EM_PPC 20 +#define EM_PPC64 21 +#define EM_S390 22 +#define EM_SH 42 +#define EM_SPARCV9 43 /* v9 = SPARC64 */ +#define EM_H8_300H 47 +#define EM_H8S 48 +#define EM_IA_64 50 /* Itanic */ +#define EM_X86_64 62 +#define EM_CRIS 76 +#define EM_V850 87 +#define EM_ALPHA 0x9026 /* Interrim Alpha that stuck around */ +#define EM_CYGNUS_V850 0x9080 /* Old v850 ID used by Cygnus */ +#define EM_S390_OLD 0xA390 /* Obsolete interrim value for S/390 */ + +/* Dynamic type values */ +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff + +/* Auxilliary table entries */ +#define AT_NULL 0 /* end of vector */ +#define AT_IGNORE 1 /* entry should be ignored */ +#define AT_EXECFD 2 /* file descriptor of program */ +#define AT_PHDR 3 /* program headers for program */ +#define AT_PHENT 4 /* size of program header entry */ +#define AT_PHNUM 5 /* number of program headers */ +#define AT_PAGESZ 6 /* system page size */ +#define AT_BASE 7 /* base address of interpreter */ +#define AT_FLAGS 8 /* flags */ +#define AT_ENTRY 9 /* entry point of program */ +#define AT_NOTELF 10 /* program is not ELF */ +#define AT_UID 11 /* real uid */ +#define AT_EUID 12 /* effective uid */ +#define AT_GID 13 /* real gid */ +#define AT_EGID 14 /* effective gid */ +#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ +#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ +#define AT_CLKTCK 17 /* frequency at which times() increments */ +/* 18..22 = ? */ +#define AT_SECURE 23 /* secure mode boolean */ + +/* Program header permission flags */ +#define PF_X 0x1 +#define PF_W 0x2 +#define PF_R 0x4 + +/* Section header types */ +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_NUM 12 +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0xffffffff + +/* Section header flags */ +#define SHF_WRITE 0x1 +#define SHF_ALLOC 0x2 +#define SHF_EXECINSTR 0x4 +#define SHF_MASKPROC 0xf0000000 + +/* Special section numbers */ +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_HIPROC 0xff1f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_HIRESERVE 0xffff + +/* Lenght of magic at the start of a file */ +#define EI_NIDENT 16 + +/* Magic number constants... */ +#define EI_MAG0 0 /* e_ident[] indexes */ +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 +#define EI_CLASS 4 +#define EI_DATA 5 +#define EI_VERSION 6 +#define EI_OSABI 7 +#define EI_PAD 8 + +#define ELFMAG0 0x7f /* EI_MAG */ +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define ELFCLASSNONE 0 /* EI_CLASS */ +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define ELFDATANONE 0 /* e_ident[EI_DATA] */ +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 + +#define EV_NONE 0 /* e_version, EI_VERSION */ +#define EV_CURRENT 1 +#define EV_NUM 2 + +#define ELFOSABI_NONE 0 +#define ELFOSABI_LINUX 3 + +#endif /* _SYS_ELFCOMMON_H */ + diff --git a/klibc/klibc/include/sys/sysmacros.h b/klibc/klibc/include/sys/sysmacros.h new file mode 100644 index 0000000000..7f1e0822b3 --- /dev/null +++ b/klibc/klibc/include/sys/sysmacros.h @@ -0,0 +1,31 @@ +/* + * sys/sysmacros.h + * + * Constructs to create and pick apart dev_t. This applies to the Linux 2.6 + * 32-bit dev_t format. + */ + +#ifndef _SYS_SYSMACROS_H +#define _SYS_SYSMACROS_H + +#ifndef _SYS_TYPES_H +# include +#endif + +static __inline__ int major(dev_t __d) +{ + return (__d >> 8) & 0xfff; +} + +static __inline__ int minor(dev_t __d) +{ + return (__d & 0xff) | ((__d >> 12) & 0xfff00); +} + +static __inline__ dev_t makedev(int __ma, int __mi) +{ + return ((__ma & 0xfff) << 8) | (__mi & 0xff) | ((__mi & 0xfff00) << 12); +} + +#endif /* _SYS_SYSMACROS_H */ + diff --git a/klibc/klibc/include/sys/time.h b/klibc/klibc/include/sys/time.h index 4eccf824a4..b503d21076 100644 --- a/klibc/klibc/include/sys/time.h +++ b/klibc/klibc/include/sys/time.h @@ -6,6 +6,7 @@ #define _SYS_TIME_H #include +#include #include __extern int gettimeofday(struct timeval *, struct timezone *); diff --git a/klibc/klibc/include/sys/types.h b/klibc/klibc/include/sys/types.h index a25873cc4b..0aaeeb1612 100644 --- a/klibc/klibc/include/sys/types.h +++ b/klibc/klibc/include/sys/types.h @@ -1,8 +1,5 @@ /* * sys/types.h - * - * This is a bastardized version of linux/types.h, since that file - * is broken w.r.t. definitions. */ #ifndef _SYS_TYPES_H @@ -25,7 +22,7 @@ typedef uint32_t dev_t; typedef __kernel_ino_t ino_t; typedef __kernel_mode_t mode_t; typedef __kernel_nlink_t nlink_t; -typedef __kernel_off_t off_t; +typedef __kernel_off_t off_t; /* Should become __kernel_loff_t... */ typedef __kernel_pid_t pid_t; typedef __kernel_daddr_t daddr_t; typedef __kernel_key_t key_t; @@ -83,15 +80,11 @@ typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; -#ifndef __BIT_TYPES_DEFINED__ -#define __BIT_TYPES_DEFINED__ - -typedef __u8 u_int8_t; -typedef __u16 u_int16_t; -typedef __u32 u_int32_t; -typedef __u64 u_int64_t; - -#endif /* !(__BIT_TYPES_DEFINED__) */ +/* Linux-specific? */ +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +typedef uint64_t u_int64_t; /* * transition to 64-bit sector_t, possibly making it an option... @@ -124,4 +117,9 @@ struct ustat { char f_fpack[6]; }; +/* + * Some apps want this in + */ +#include + #endif diff --git a/klibc/klibc/include/sys/wait.h b/klibc/klibc/include/sys/wait.h index cad6989bf7..4cfafc9408 100644 --- a/klibc/klibc/include/sys/wait.h +++ b/klibc/klibc/include/sys/wait.h @@ -11,6 +11,15 @@ #include +#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) +#define WTERMSIG(s) ((s) & 0x7f) +#define WIFEXITED(s) (WTERMSIG(s) == 0) +#define WIFSTOPPED(s) (WTERMSIG(s) == 0x7f) +/* Ugly hack to avoid multiple evaluation of "s" */ +#define WIFSIGNALED(s) (WTERMSIG((s)+1) >= 2) +#define WCOREDUMP(s) ((s) & 0x80) +#define WSTOPSIG(s) WEXITSTATUS(s) + __extern pid_t wait(int *); __extern pid_t waitpid(pid_t, int *, int); __extern pid_t wait3(int *, int, struct rusage *); diff --git a/klibc/klibc/include/unistd.h b/klibc/klibc/include/unistd.h index 3d5c6881d3..f1cde2376e 100644 --- a/klibc/klibc/include/unistd.h +++ b/klibc/klibc/include/unistd.h @@ -49,6 +49,12 @@ __extern int setresgid(gid_t, gid_t, gid_t); __extern int getfsuid(uid_t); __extern int setfsuid(uid_t); +/* Macros for access() */ +#define R_OK 4 /* Read */ +#define W_OK 2 /* Write */ +#define X_OK 1 /* Execute */ +#define F_OK 0 /* Existence */ + __extern int access(const char *, int); __extern int link(const char *, const char *); __extern int unlink(const char *); diff --git a/klibc/klibc/putenv.c b/klibc/klibc/putenv.c new file mode 100644 index 0000000000..8138c653b4 --- /dev/null +++ b/klibc/klibc/putenv.c @@ -0,0 +1,40 @@ +/* + * putenv.c + */ + +#include +#include +#include +#include + +/* str should be a duplicated version of the input string; + len is the length of the key including the = sign */ +int __put_env(char *str, size_t len, int overwrite); + +int putenv(const char *str) +{ + char *s; + const char *e, *z; + + if ( !str ) { + errno = EINVAL; + return -1; + } + + e = NULL; + for ( z = str ; *z ; z++ ) { + if ( *z == '=' ) + e = z; + } + + if ( !e ) { + errno = EINVAL; + return -1; + } + + s = strdup(str); + if ( !s ) + return -1; + + return __put_env(s, e-str, 1); +} diff --git a/klibc/klibc/setenv.c b/klibc/klibc/setenv.c index d1118ff3ed..d4ada53d74 100644 --- a/klibc/klibc/setenv.c +++ b/klibc/klibc/setenv.c @@ -7,87 +7,9 @@ #include #include -/* Initialized to zero, meaning "not malloc'd" */ -static size_t __environ_size; - /* str should be a duplicated version of the input string; len is the length of the key including the = sign */ -static int _putenv(char *str, size_t len, int overwrite) -{ - char **p, *q; - char **newenv; - size_t n; - - n = 1; /* Include space for final NULL */ - for ( p = environ ; (q = *p) ; p++ ) { - n++; - if ( !strncmp(q,str,len) ) { - if ( overwrite ) - free(str); - else - *p = str; /* Memory leak... */ - return 0; - } - } - - /* Need to extend the environment */ - if ( n < __environ_size ) { - p[1] = NULL; - *p = str; - return 0; - } else { - if ( __environ_size ) { - newenv = realloc(environ, (__environ_size << 1)*sizeof(char *)); - if ( !newenv ) - return -1; - - __environ_size <<= 1; - } else { - /* Make a reasonable guess how much more space we need */ - size_t newsize = n+32; - newenv = malloc(newsize*sizeof(char *)); - if ( !newenv ) - return -1; - - memcpy(newenv, environ, n*sizeof(char *)); - __environ_size = newsize; - } - newenv[n+1] = NULL; - newenv[n] = str; - environ = newenv; - } - return 0; -} - -int putenv(const char *str) -{ - char *s; - const char *e, *z; - size_t len; - - if ( !str ) { - errno = EINVAL; - return -1; - } - - len = 0; e = NULL; - for ( z = str ; *z ; z++ ) { - len++; - if ( *z == '=' ) - e = z; - } - - if ( !e ) { - errno = EINVAL; - return -1; - } - - s = strdup(str); - if ( !s ) - return -1; - - return _putenv(s, len, 1); -} +int __put_env(char *str, size_t len, int overwrite); int setenv(const char *name, const char *val, int overwrite) { @@ -117,8 +39,7 @@ int setenv(const char *name, const char *val, int overwrite) memcpy(s, name, l1); s[l1] = '='; - memcpy(s+l1+1, val, l2); - s[l1+l2+1] = '\0'; + memcpy(s+l1+1, val, l2+1); - return _putenv(s, l1+1, overwrite); + return __put_env(s, l1+1, overwrite); } diff --git a/klibc/klibc/signal.c b/klibc/klibc/signal.c deleted file mode 100644 index 982d0c659d..0000000000 --- a/klibc/klibc/signal.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * signal.c - */ - -#include - -__sighandler_t signal(int signum, __sighandler_t handler) -{ - /* Linux/SysV signal() semantics */ - return __signal(signum, handler, SA_RESETHAND); -} diff --git a/klibc/klibc/sysv_signal.c b/klibc/klibc/sysv_signal.c new file mode 100644 index 0000000000..3e55a02bb5 --- /dev/null +++ b/klibc/klibc/sysv_signal.c @@ -0,0 +1,11 @@ +/* + * sysv_signal.c + */ + +#include + +__sighandler_t sysv_signal(int signum, __sighandler_t handler) +{ + /* Linux/SysV signal() semantics */ + return __signal(signum, handler, SA_RESETHAND); +} diff --git a/klibc/klibc/tests/environ.c b/klibc/klibc/tests/environ.c new file mode 100644 index 0000000000..6eeeb9197e --- /dev/null +++ b/klibc/klibc/tests/environ.c @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(int argc, char *argv[], char *envp[]) +{ + int i; + + /* Verify envp == environ */ + printf("Verifying envp == environ... %s\n", + (envp == environ) ? "ok" : "ERROR"); + + /* Test argc/argv */ + printf("argc = %d, argv = %p\n", argc, argv); + for ( i = 0 ; i < argc ; i++ ) { + printf("argv[%2d] = %s\n", i, argv[i]); + } + + /* Test environ */ + for ( i = 0 ; envp[i] ; i++ ) + printf("%s\n", envp[i]); + + return 0; +} diff --git a/klibc/klibc/tests/getenvtest.c b/klibc/klibc/tests/getenvtest.c deleted file mode 100644 index 07cac0cef7..0000000000 --- a/klibc/klibc/tests/getenvtest.c +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include - -int main(int argc, char *argv[], char *envp[]) -{ - int i; - - /* Verify envp == environ */ - printf("Verifying envp == environ... %s\n", - (envp == environ) ? "ok" : "ERROR"); - - /* Test argc/argv */ - printf("argc = %d, argv = %p\n", argc, argv); - for ( i = 0 ; i < argc ; i++ ) { - printf("argv[%2d] = %s\n", i, argv[i]); - } - - /* Test environ */ - printf("PATH = %s\n", getenv("PATH")); - printf("HOME = %s\n", getenv("HOME")); - printf("TERM = %s\n", getenv("TERM")); - printf("USER = %s\n", getenv("USER")); - - return 0; -} diff --git a/klibc/klibc/tests/nfs_no_rpc.c b/klibc/klibc/tests/nfs_no_rpc.c index 11b9f61fea..5c17706b63 100644 --- a/klibc/klibc/tests/nfs_no_rpc.c +++ b/klibc/klibc/tests/nfs_no_rpc.c @@ -282,7 +282,7 @@ static int do_call(struct sockaddr_in *sin, u_int32_t msg[], u_int32_t rmsg[], int n; int fd; - signal(SIGALRM, timeout); + sysv_signal(SIGALRM, timeout); fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (fd < 0) goto Esocket; diff --git a/klibc/klibc/tests/setenvtest.c b/klibc/klibc/tests/setenvtest.c new file mode 100644 index 0000000000..111bef9dfe --- /dev/null +++ b/klibc/klibc/tests/setenvtest.c @@ -0,0 +1,38 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + (void)argc; (void)argv; + + /* Set SETENV */ + setenv("SETENV", "setenv", 1); + + /* Set PUTENV */ + putenv("PUTENV=putenv"); + + /* Print the results... */ + printf("SETENV = %s\n", getenv("SETENV")); + printf("PUTENV = %s\n", getenv("PUTENV")); + + /* Override tests */ + setenv("SETENV", "setenv_good", 1); + putenv("PUTENV=putenv_good"); + printf("SETENV = %s\n", getenv("SETENV")); + printf("PUTENV = %s\n", getenv("PUTENV")); + + /* Non-override test */ + setenv("SETENV", "setenv_bad", 0); + setenv("NEWENV", "newenv_good", 0); + printf("SETENV = %s\n", getenv("SETENV")); + printf("NEWENV = %s\n", getenv("NEWENV")); + + /* Undef test */ + unsetenv("SETENV"); + unsetenv("NEWENV"); + printf("SETENV = %s\n", getenv("SETENV")); + printf("NEWENV = %s\n", getenv("NEWENV")); + + return 0; +} -- cgit v1.2.3-54-g00ecf From da92f46b9e86643e70861bb705453f81aef5618d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 11 Feb 2004 18:34:28 -0800 Subject: [PATCH] finish syncing up with klibc --- klibc/MCONFIG | 3 +- klibc/MRULES | 41 ++++++++++++++ klibc/README | 10 ++-- klibc/klibc.spec.in | 151 ++++++++++++++++++++++++++++++++++++++++++++++++++++ klibc/version | 2 +- 5 files changed, 202 insertions(+), 5 deletions(-) create mode 100644 klibc/MRULES create mode 100644 klibc/klibc.spec.in diff --git a/klibc/MCONFIG b/klibc/MCONFIG index 8b5da4154b..de8b332d98 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -21,7 +21,8 @@ PERL = perl STRIP = $(CROSS)strip --strip-all -R .comment -R .note HOST_CC = gcc -HOST_LDFLAGS = -s +HOST_CFLAGS = -g -O +HOST_LDFLAGS = HOST_LIBS = CRT0 = $(KLIBSRC)/crt0.o diff --git a/klibc/MRULES b/klibc/MRULES new file mode 100644 index 0000000000..8a8831c348 --- /dev/null +++ b/klibc/MRULES @@ -0,0 +1,41 @@ +# -*- makefile -*- +# +# Standard pattern rules +# + +.SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss + +.c.o: + $(CC) $(CFLAGS) -c -o $@ $< + +.c.i: + $(CC) $(CFLAGS) -E -o $@ $< + +.c.s: + $(CC) $(CFLAGS) -S -o $@ $< + +.S.o: + $(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $< + +.S.s: + $(CC) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $< + +.S.lo: + $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -c -o $@ $< + +.S.ls: + $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -E -o $@ $< + +.s.o: + $(CC) $(CFLAGS) -x assembler -c -o $@ $< + +.ls.lo: + $(CC) $(CFLAGS) $(SOFLAGS) -x assembler -c -o $@ $< + +.c.lo: + $(CC) $(CFLAGS) $(SOFLAGS) -c -o $@ $< + +.c.ls: + $(CC) $(CFLAGS) $(SOFLAGS) -S -o $@ $< + + diff --git a/klibc/README b/klibc/README index 577de2b704..4381364874 100644 --- a/klibc/README +++ b/klibc/README @@ -1,8 +1,10 @@ -Please see klibc/README for how to set up the tree before building. +Please see klibc/README for build instructions. + + klibc is archived at: - ftp://ftp.zytor.com/pub/linux/libs/klibc/ + ftp://ftp.kernel.org/pub/linux/libs/klibc/ There is a mailing list for klibc and early-userspace issues at: @@ -12,5 +14,7 @@ There is also a cvsweb repository at: http://www.zytor.com/cvsweb.cgi/klibc/ -There is no direct public CVS access yet, however. +There is no direct public CVS access yet, however, the CVS repository +is available for rsync from: + rsync://rsync.kernel.org/pub/linux/libs/klibc/cvsroot/ diff --git a/klibc/klibc.spec.in b/klibc/klibc.spec.in new file mode 100644 index 0000000000..f8bccc390e --- /dev/null +++ b/klibc/klibc.spec.in @@ -0,0 +1,151 @@ +%define _rpmdir rpms +%define _builddir . + +Summary: A minimal libc subset for use with initramfs. +Name: klibc +Version: 0.89 +Release: 1 +License: BSD/GPL +Group: Development/Libraries +URL: http://www.zytor.com/klibc +Source: /dev/null +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +Packager: Bryan O'Sullivan +Prefix: /usr +Vendor: Starving Linux Artists + +%description +%{name} is intended to be a minimalistic libc subset for use with +initramfs. It is deliberately written for small size, minimal +entanglement, and portability, not speed. It is definitely a work in +progress, and a lot of things are still missing. + +%package kernheaders +Summary: Kernel headers used during the build of klibc. +Group: Development/Libraries + +%description kernheaders +This package contains the set of kernel headers that were required to +build %{name} and the utilities that ship with it. This may or may +not be a complete enough set to build other programs that link against +%{name}. If in doubt, use real kernel headers instead. + +%package utils +Summary: Small statically-linked utilities built with klibc. +Group: Utilities/System + +%description utils + +This package contains a collection of programs that are statically +linked against klibc. These duplicate some of the functionality of a +regular Linux toolset, but are typically much smaller than their +full-function counterparts. They are intended for inclusion in +initramfs images and embedded systems. + +%prep +if [ ! -L linux ]; then + echo "*** You must have a symlink named linux to build klibc" 1>&2 + exit 1 +fi +if [ ! -f linux/include/asm/page.h ]; then + echo "*** You need to 'make prepare' in the linux tree before building klibc" 1>&2 + exit 1 +fi +mkdir -p %{buildroot} %{_rpmdir} + +%build +make + +%install +rm -rf %{buildroot} + +dest=%{buildroot}/%{prefix} +lib=$dest/%{_lib}/klibc +inc=$dest/include/klibc +exe=$dest/libexec/klibc +doc=$dest/share/doc/%{name}-%{version} +udoc=$dest/share/doc/%{name}-utils-%{version} + +# First, the library. + +install -dD -m 755 $lib $inc/kernel $exe $doc $udoc +install -m 755 klibc/klibc.so $lib +install -m 644 klibc/libc.a $lib +install -m 644 klibc/crt0.o $lib +install -m 644 klibc/libc.so.hash $lib +ln $lib/klibc.so $lib/libc.so +ln $lib/klibc.so $lib/klibc-$(cat $lib/libc.so.hash).so + +# Next, the generated binaries. + +install -m 755 ash/sh $exe +install -m 755 gzip/gzip $exe +ln $exe/gzip $exe/gunzip +ln $exe/gzip $exe/zcat +install -m 755 ipconfig/ipconfig $exe +install -m 755 kinit/kinit $exe +install -m 755 nfsmount/nfsmount $exe +for i in chroot dd fstype mkdir mkfifo mount umount; do + install -m 755 utils/$i $exe +done + +# The docs. + +install -m 444 README $doc +install -m 444 klibc/README $doc/README.klibc +install -m 444 klibc/arch/README $doc/README.klibc.arch + +install -m 444 gzip/COPYING $udoc/COPYING.gzip +install -m 444 gzip/README $udoc/README.gzip +install -m 444 ipconfig/README $udoc/README.ipconfig +install -m 444 kinit/README $udoc/README.kinit + +# Finally, the include files. + +bitsize=$(make --no-print-directory -C klibc bitsize) +cp --parents $(find klibc/include \( -name CVS -o -name SCCS \) -prune \ + -o -name '*.h' -print) $inc +mv $inc/klibc $inc/klibc.$$ +mv $inc/klibc.$$/include/* $inc +mv $inc/bits$bitsize/bitsize $inc +rm -rf $inc/klibc.$$ $inc/bits[0-9]* +pushd klibc/arch/%{_arch}/include +cp --parents -f $(find . \( -name CVS -o -name SCCS \) -prune \ + -o -name '*.h' -print) $inc +popd + +# Yeugh. Find the transitive closure over all kernel headers included +# by klibc, and copy them into place. + +find . -name '.*.d' | xargs -r sed -e 's,[ \t][ \t]*,\n,g' | sed -n -e 's,^\.\./linux/include/,,p' | sort | uniq | (cd linux/include && xargs -ri cp --parents '{}' $inc/kernel) + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%docdir %{prefix}/share/doc/%{name}-%{version} +%{prefix}/%{_lib}/klibc +%dir %{prefix}/include/klibc +%{prefix}/include/klibc/*.h +%{prefix}/include/klibc/arpa +%{prefix}/include/klibc/bitsize +%{prefix}/include/klibc/klibc +%{prefix}/include/klibc/net +%{prefix}/include/klibc/netinet +%{prefix}/include/klibc/sys +%{prefix}/share/doc/%{name}-%{version} + +%files kernheaders +%defattr(-,root,root,-) +%{prefix}/include/klibc/kernel + +%files utils +%defattr(-,root,root,-) +%{prefix}/libexec/klibc +%docdir %{prefix}/share/doc/%{name}-utils-%{version} +%{prefix}/share/doc/%{name}-utils-%{version} + +%changelog +* Sat Nov 29 2003 Bryan O'Sullivan - +- Initial build. diff --git a/klibc/version b/klibc/version index 2f3d7fa995..f14cf6a1e0 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.101 +0.107 -- cgit v1.2.3-54-g00ecf From 4d803d8d04a8493f8efc039c7789c65be33048a0 Mon Sep 17 00:00:00 2001 From: "azarah@nosferatu.za.org" Date: Wed, 11 Feb 2004 19:42:51 -0800 Subject: [PATCH] make logging a config option Once again, patch to make logging a config option. Reason for this (since you asked for it): - In our setup it is easy (although still annoying) .. just edit the ebuild, add logging support (or remove it) and rebuild. For say a binary distro, having the logging is useful for debugging some times, but its more a once of, or rare thing, as you do not add or change config files every day. Sure, we can have logging by default, but many do not want ~300 lines of extra debugging in their logs is not pleasant, and they will complain. Rebuilding the package for that binary package (given the users it is targeted to) is usually not within most users grasp. --- Makefile | 1 + etc/udev/udev.conf.in | 3 +++ logging.h | 6 ++++++ udev.h | 3 +++ udev_config.c | 5 +++++ 5 files changed, 18 insertions(+) diff --git a/Makefile b/Makefile index 97c6ca63bd..ebcb2815c8 100644 --- a/Makefile +++ b/Makefile @@ -239,6 +239,7 @@ udev_version.h: @echo \#define UDEV_CONFIG_FILE \"$(configdir)\udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)\udev.rules\" >> $@ @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ + @echo \#define UDEV_LOG_DEFAULT \"yes\" >> $@ @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index f9a60ab3c8..3e73bedbf5 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -29,3 +29,6 @@ default_owner="root" # explicit match in the permissions file default_group="root" +# udev_log - set to "yes" if you want logging, else "no" +udev_log="yes" + diff --git a/logging.h b/logging.h index 485209adf3..5ae228b139 100644 --- a/logging.h +++ b/logging.h @@ -34,6 +34,9 @@ #include #include +#include "udev.h" +#include "udev_version.h" + #undef info #define info(format, arg...) \ do { \ @@ -63,6 +66,9 @@ static inline void log_message (int level, const char *format, ...) { va_list args; + if (0 != strncmp(udev_log_str, UDEV_LOG_DEFAULT, BOOL_SIZE)) + return; + va_start(args, format); vsyslog(level, format, args); va_end(args); diff --git a/udev.h b/udev.h index f854a183d3..8b3f305d34 100644 --- a/udev.h +++ b/udev.h @@ -32,6 +32,8 @@ #define OWNER_SIZE 30 #define GROUP_SIZE 30 #define MODE_SIZE 8 +#define BOOL_SIZE 5 /* 'yes', 'no' and possibly 'true' or 'false' + in future */ struct udevice { char name[NAME_SIZE]; @@ -72,5 +74,6 @@ extern char udev_rules_filename[PATH_MAX+NAME_MAX]; extern char default_mode_str[MODE_SIZE]; extern char default_owner_str[OWNER_SIZE]; extern char default_group_str[GROUP_SIZE]; +extern char udev_log_str[BOOL_SIZE]; #endif diff --git a/udev_config.c b/udev_config.c index 6d39d294e1..ec38272bc5 100644 --- a/udev_config.c +++ b/udev_config.c @@ -48,6 +48,7 @@ char udev_config_filename[PATH_MAX+NAME_MAX]; char default_mode_str[MODE_SIZE]; char default_owner_str[OWNER_SIZE]; char default_group_str[GROUP_SIZE]; +char udev_log_str[BOOL_SIZE]; static void init_variables(void) @@ -60,6 +61,7 @@ static void init_variables(void) strfieldcpy(udev_config_filename, UDEV_CONFIG_FILE); strfieldcpy(udev_rules_filename, UDEV_RULES_FILE); strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE); + strfieldcpy(udev_log_str, UDEV_LOG_DEFAULT); } #define set_var(_name, _var) \ @@ -156,6 +158,7 @@ static int parse_config_file(void) set_var("default_mode", default_mode_str); set_var("default_owner", default_owner_str); set_var("default_group", default_group_str); + set_var("udev_log", udev_log_str); } dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, lineno, temp - line, temp); @@ -191,6 +194,7 @@ static void get_dirs(void) dbg_parse("udev_db_filename = %s", udev_db_filename); dbg_parse("udev_rules_filename = %s", udev_rules_filename); dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); + dbg_parse("udev_log_str = %s", udev_log_str); parse_config_file(); dbg_parse("udev_root = %s", udev_root); @@ -198,6 +202,7 @@ static void get_dirs(void) dbg_parse("udev_db_filename = %s", udev_db_filename); dbg_parse("udev_rules_filename = %s", udev_rules_filename); dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); + dbg_parse("udev_log_str = %s", udev_log_str); } void udev_init_config(void) -- cgit v1.2.3-54-g00ecf From 51a8bb2f361d86013e7579570faba446eed9c66d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 11 Feb 2004 22:10:26 -0800 Subject: [PATCH] fix log option code so that it actually works for all udev programs. Also introduce boolean type for config file to use. --- logging.h | 12 +++++------- test/ignore_test | 1 + udev.c | 5 +++++ udev.h | 4 +--- udev_config.c | 25 ++++++++++++++++++++----- udevd.c | 8 +++++++- udevinfo.c | 5 +++++ udevsend.c | 5 +++++ 8 files changed, 49 insertions(+), 16 deletions(-) diff --git a/logging.h b/logging.h index 5ae228b139..df0d7dedce 100644 --- a/logging.h +++ b/logging.h @@ -34,9 +34,6 @@ #include #include -#include "udev.h" -#include "udev_version.h" - #undef info #define info(format, arg...) \ do { \ @@ -60,13 +57,17 @@ } while (0) #endif +/* each program must declare this variable and function somewhere */ +extern unsigned char logname[42]; +extern int log_ok(void); + static void log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); static inline void log_message (int level, const char *format, ...) { va_list args; - if (0 != strncmp(udev_log_str, UDEV_LOG_DEFAULT, BOOL_SIZE)) + if (!log_ok()) return; va_start(args, format); @@ -74,9 +75,6 @@ static inline void log_message (int level, const char *format, ...) va_end(args); } -/* each program must declare this variable somewhere */ -extern unsigned char logname[42]; - #undef init_logging static inline void init_logging(char *program_name) { diff --git a/test/ignore_test b/test/ignore_test index 602624c1e0..ca51e9a1ab 100644 --- a/test/ignore_test +++ b/test/ignore_test @@ -16,6 +16,7 @@ udev_root="$PWD/udev/" udev_db="$PWD/udev/.udev.tdb" udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" +udev_log="true" EOF mkdir udev diff --git a/udev.c b/udev.c index b45fb336be..55a324efbc 100644 --- a/udev.c +++ b/udev.c @@ -40,6 +40,11 @@ char **main_argv; char **main_envp; unsigned char logname[42]; +int log_ok(void) +{ + return udev_log; +} + static void sig_handler(int signum) { dbg("caught signal %d", signum); diff --git a/udev.h b/udev.h index 8b3f305d34..108623e059 100644 --- a/udev.h +++ b/udev.h @@ -32,8 +32,6 @@ #define OWNER_SIZE 30 #define GROUP_SIZE 30 #define MODE_SIZE 8 -#define BOOL_SIZE 5 /* 'yes', 'no' and possibly 'true' or 'false' - in future */ struct udevice { char name[NAME_SIZE]; @@ -74,6 +72,6 @@ extern char udev_rules_filename[PATH_MAX+NAME_MAX]; extern char default_mode_str[MODE_SIZE]; extern char default_owner_str[OWNER_SIZE]; extern char default_group_str[GROUP_SIZE]; -extern char udev_log_str[BOOL_SIZE]; +extern int udev_log; #endif diff --git a/udev_config.c b/udev_config.c index ec38272bc5..34ef82b881 100644 --- a/udev_config.c +++ b/udev_config.c @@ -48,9 +48,18 @@ char udev_config_filename[PATH_MAX+NAME_MAX]; char default_mode_str[MODE_SIZE]; char default_owner_str[OWNER_SIZE]; char default_group_str[GROUP_SIZE]; -char udev_log_str[BOOL_SIZE]; +int udev_log; +static int string_is_true(char *str) +{ + if (strcasecmp(str, "true") == 0) + return 1; + if (strcasecmp(str, "yes") == 0) + return 1; + return 0; +} + static void init_variables(void) { /* fill up the defaults. @@ -61,7 +70,7 @@ static void init_variables(void) strfieldcpy(udev_config_filename, UDEV_CONFIG_FILE); strfieldcpy(udev_rules_filename, UDEV_RULES_FILE); strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE); - strfieldcpy(udev_log_str, UDEV_LOG_DEFAULT); + udev_log = string_is_true(UDEV_LOG_DEFAULT); } #define set_var(_name, _var) \ @@ -70,6 +79,12 @@ static void init_variables(void) strncpy(_var, value, sizeof(_var)); \ } +#define set_bool(_name, _var) \ + if (strcasecmp(variable, _name) == 0) { \ + dbg_parse("%s = '%s'", _name, value); \ + _var = string_is_true(value); \ + } + int parse_get_pair(char **orig_string, char **left, char **right) { char *temp; @@ -158,7 +173,7 @@ static int parse_config_file(void) set_var("default_mode", default_mode_str); set_var("default_owner", default_owner_str); set_var("default_group", default_group_str); - set_var("udev_log", udev_log_str); + set_bool("udev_log", udev_log); } dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, lineno, temp - line, temp); @@ -194,7 +209,7 @@ static void get_dirs(void) dbg_parse("udev_db_filename = %s", udev_db_filename); dbg_parse("udev_rules_filename = %s", udev_rules_filename); dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); - dbg_parse("udev_log_str = %s", udev_log_str); + dbg_parse("udev_log = %d", udev_log); parse_config_file(); dbg_parse("udev_root = %s", udev_root); @@ -202,7 +217,7 @@ static void get_dirs(void) dbg_parse("udev_db_filename = %s", udev_db_filename); dbg_parse("udev_rules_filename = %s", udev_rules_filename); dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); - dbg_parse("udev_log_str = %s", udev_log_str); + dbg_parse("udev_log_str = %d", udev_log); } void udev_init_config(void) diff --git a/udevd.c b/udevd.c index 8ba833186e..476cb64309 100644 --- a/udevd.c +++ b/udevd.c @@ -40,7 +40,6 @@ #include "udevd.h" #include "logging.h" -unsigned char logname[42]; static int expected_seqnum = 0; volatile static int children_waiting; volatile static int msg_q_timeout; @@ -52,6 +51,13 @@ LIST_HEAD(running_list); static void exec_queue_manager(void); static void msg_queue_manager(void); +unsigned char logname[42]; + +int log_ok(void) +{ + return 1; +} + static void msg_dump_queue(void) { struct hotplug_msg *msg; diff --git a/udevinfo.c b/udevinfo.c index 71a9a6d93e..103ebce08c 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -40,6 +40,11 @@ char **main_argv; int main_argc; unsigned char logname[42]; +int log_ok(void) +{ + return 1; +} + static int print_all_attributes(const char *path) { struct dlist *attributes; diff --git a/udevsend.c b/udevsend.c index f6de88565f..17372d8d9a 100644 --- a/udevsend.c +++ b/udevsend.c @@ -42,6 +42,11 @@ unsigned char logname[42]; +int log_ok(void) +{ + return 1; +} + static inline char *get_action(void) { char *action; -- cgit v1.2.3-54-g00ecf From 0c25b2066d06ae1f75d3e9f3f8e1e31d952906c5 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 11 Feb 2004 22:28:47 -0800 Subject: [PATCH] udev - fix cdrom symlink rule We only need to look at the device, not at the partitions. --- etc/udev/udev.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 98d2ceccc7..344304dd95 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -35,7 +35,7 @@ KERNEL="ttyUSB0", NAME="pl2303" #KERNEL="tty*", NAME="vc/%n" # if this is a ide cdrom, name it the default name, and create a symlink to cdrom -BUS="ide", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" +BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" # device mapper creates its own device nodes so ignore these KERNEL="dm-[0-9]*", NAME="" -- cgit v1.2.3-54-g00ecf From c5118442a16940fc6ba40fd94ab28061e0f0d43b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 11 Feb 2004 22:28:51 -0800 Subject: [PATCH] udev - fix "ignore method" On Sun, Feb 08, 2004 at 04:36:01PM +0100, Kay Sievers wrote: > We don't handle NAME="" the right way. Thanks to Emil None > for pointing this out. Here is a fix for it and a trivial style cleanup. Changed the ignore dbg() to info(). --- namedev.c | 35 +++++++++++++++++------------------ udev-add.c | 30 +++++++++++++++--------------- 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/namedev.c b/namedev.c index 6685596479..7984adfb31 100644 --- a/namedev.c +++ b/namedev.c @@ -589,12 +589,12 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas if (dev->bus[0] != '\0') { if (sysfs_device == NULL) { dbg("device has no bus"); - goto no_good; + goto try_parent; } dbg("check for " FIELD_BUS " dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); if (strcmp_pattern(dev->bus, sysfs_device->bus) != 0) { dbg(FIELD_BUS " is not matching"); - goto no_good; + goto try_parent; } else { dbg(FIELD_BUS " matches"); } @@ -605,7 +605,7 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", dev->kernel, class_dev->name); if (strcmp_pattern(dev->kernel, class_dev->name) != 0) { dbg(FIELD_KERNEL " is not matching"); - goto no_good; + goto try_parent; } else { dbg(FIELD_KERNEL " matches"); } @@ -616,7 +616,7 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas dbg("check " FIELD_ID); if (match_id(dev, class_dev, sysfs_device) != 0) { dbg(FIELD_ID " is not matching"); - goto no_good; + goto try_parent; } else { dbg(FIELD_ID " matches"); } @@ -627,7 +627,7 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas dbg("check " FIELD_PLACE); if (match_place(dev, class_dev, sysfs_device) != 0) { dbg(FIELD_PLACE " is not matching"); - goto no_good; + goto try_parent; } else { dbg(FIELD_PLACE " matches"); } @@ -638,7 +638,7 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas dbg("check " FIELD_SYSFS " pairs"); if (match_sysfs_pairs(dev, class_dev, sysfs_device) != 0) { dbg(FIELD_SYSFS " is not matching"); - goto no_good; + goto try_parent; } else { dbg(FIELD_SYSFS " matches"); } @@ -650,7 +650,7 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas apply_format(udev, dev->program); if (execute_program(dev->program, udev->program_result, NAME_SIZE) != 0) { dbg(FIELD_PROGRAM " returned nozero"); - goto no_good; + goto try_parent; } else { dbg(FIELD_PROGRAM " returned successful"); } @@ -663,22 +663,17 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas dev->result, udev->program_result); if (strcmp_pattern(dev->result, udev->program_result) != 0) { dbg(FIELD_RESULT " is not matching"); - goto no_good; + goto try_parent; } else { dbg(FIELD_RESULT " matches"); } } - /* check if we are instructed to ignore this device */ - if (dev->name[0] == '\0') { - dbg("instructed to ignore this device"); - return -1; - } - /* Yeah, we matched! */ return 0; -no_good: +try_parent: + dbg("try parent sysfs device"); sysfs_device = sysfs_get_device_parent(sysfs_device); if (sysfs_device == NULL) return -ENODEV; @@ -722,11 +717,15 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud /* look for a matching rule to apply */ list_for_each_entry(dev, &config_device_list, node) { dbg("process rule"); - if (match_rule(dev, class_dev, udev, sysfs_device) == 0) { - /* Yup, this rule belongs to us! */ + if (dev->name[0] == '\0') { + info("configured rule in '%s' at line %i applied, '%s' is ignored", + udev_rules_filename, dev->config_line, udev->kernel_name); + return -1; + } + info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", - udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); + udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); strfieldcpy(udev->name, dev->name); strfieldcpy(udev->symlink, dev->symlink); goto found; diff --git a/udev-add.c b/udev-add.c index 586911acc2..9f07d22ec6 100644 --- a/udev-add.c +++ b/udev-add.c @@ -87,7 +87,7 @@ static int create_path(char *file) *pos = 0x00; if (stat(p, &stats)) { retval = mkdir(p, 0755); - if (retval) { + if (retval != 0) { dbg("mkdir(%s) failed with error '%s'", p, strerror(errno)); return retval; @@ -145,17 +145,17 @@ static int create_node(struct udevice *dev) info("creating device node '%s'", filename); dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor); retval = mknod(filename, dev->mode, res); - if (retval) + if (retval != 0) dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", filename, dev->mode, dev->major, dev->minor, strerror(errno)); dbg("chmod(%s, %#o)", filename, dev->mode); retval = chmod(filename, dev->mode); - if (retval) + if (retval != 0) dbg("chmod(%s, %#o) failed with error '%s'", filename, dev->mode, strerror(errno)); - if (dev->owner[0]) { + if (dev->owner[0] != '\0') { char *endptr; unsigned long id = strtoul(dev->owner, &endptr, 10); if (endptr[0] == '\0') @@ -169,7 +169,7 @@ static int create_node(struct udevice *dev) } } - if (dev->group[0]) { + if (dev->group[0] != '\0') { char *endptr; unsigned long id = strtoul(dev->group, &endptr, 10); if (endptr[0] == '\0') @@ -183,16 +183,16 @@ static int create_node(struct udevice *dev) } } - if (uid || gid) { + if (uid != 0 || gid != 0) { dbg("chown(%s, %u, %u)", filename, uid, gid); retval = chown(filename, uid, gid); - if (retval) + if (retval != 0) dbg("chown(%s, %u, %u) failed with error '%s'", filename, uid, gid, strerror(errno)); } /* create symlink if requested */ - if (dev->symlink[0]) { + if (dev->symlink[0] != '\0') { symlinks = dev->symlink; while (1) { linkname = strsep(&symlinks, " "); @@ -214,13 +214,13 @@ static int create_node(struct udevice *dev) tail = i+1; i++; } - while (linkname[i]) { + while (linkname[i] != '\0') { if (linkname[i] == '/') strcat(linktarget, "../"); i++; } - if (*linktarget == '\0') + if (linktarget[0] == '\0') strcpy(linktarget, "./"); strcat(linktarget, &dev->name[tail]); @@ -236,7 +236,7 @@ static int create_node(struct udevice *dev) dbg("symlink(%s, %s)", linktarget, filename); retval = symlink(linktarget, filename); - if (retval) + if (retval != 0) dbg("symlink(%s, %s) failed with error '%s'", linktarget, filename, strerror(errno)); } @@ -285,7 +285,7 @@ static int sleep_for_dev(char *path) dbg("looking for '%s'", filename); retval = stat(filename, &buf); - if (!retval) + if (retval == 0) goto exit; /* sleep to give the kernel a chance to create the dev file */ @@ -311,7 +311,7 @@ int udev_add_device(char *path, char *subsystem) dev.type = 'c'; retval = sleep_for_dev(path); - if (retval) + if (retval != 0) goto exit; class_dev = get_class_dev(path); @@ -319,13 +319,13 @@ int udev_add_device(char *path, char *subsystem) goto exit; retval = get_major_minor(class_dev, &dev); - if (retval) { + if (retval != 0) { dbg("get_major_minor failed"); goto exit; } retval = namedev_name_device(class_dev, &dev); - if (retval) + if (retval != 0) goto exit; retval = udevdb_add_dev(path, &dev); -- cgit v1.2.3-54-g00ecf From f8911dbb0404902502085c7bb204f2f9c5bc1b9c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 11 Feb 2004 22:29:15 -0800 Subject: [PATCH] compile udevd with klibc On Mon, Feb 09, 2004 at 05:41:15AM +0100, Kay Sievers wrote: > It seems that today was just another udev-sunday for me :) > > Here is a working patch to compile udevd with klibc. > > It's sweet the static binary takes 6 kbytes and it runs > with only 80 kbytes virtual memory. > > I changed a few peaces and added a siginterrupt.c file to klibc. > We may check with hpa to get the changes upstream? So here is the next try :) hpa, for good reason, didn't like my changes to klibc. He will dump signal() completely from klibc instead, so here we switch to sigaction() and keep udevd working with klibc. --- Makefile | 4 +--- udev.c | 10 ++++++---- udevd.c | 28 ++++++++++++++++++---------- udevsend.c | 2 +- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index ebcb2815c8..d2cec3ac8a 100644 --- a/Makefile +++ b/Makefile @@ -157,7 +157,6 @@ ifeq ($(strip $(USE_KLIBC)),true) -I$(LINUX_INCLUDE_DIR) LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs - UDEVD = else WARNINGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations CRT0 = @@ -165,12 +164,11 @@ else CFLAGS += $(WARNINGS) -I$(GCCINCDIR) LIB_OBJS = -lc LDFLAGS = - UDEVD = $(DAEMON) endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(SENDER) $(UDEVD) $(HELPER) +all: $(ROOT) $(SENDER) $(DAEMON) $(HELPER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ diff --git a/udev.c b/udev.c index 55a324efbc..0f01fa41d2 100644 --- a/udev.c +++ b/udev.c @@ -47,14 +47,12 @@ int log_ok(void) static void sig_handler(int signum) { - dbg("caught signal %d", signum); switch (signum) { case SIGINT: case SIGTERM: sysbus_disconnect(); udevdb_exit(); exit(20 + signum); - break; default: dbg("unhandled signal"); } @@ -100,6 +98,7 @@ static int udev_hotplug(int argc, char **argv) char *subsystem; int retval = -EINVAL; int i; + struct sigaction act; action = get_action(); if (!action) { @@ -146,8 +145,11 @@ static int udev_hotplug(int argc, char **argv) } /* set up a default signal handler for now */ - signal(SIGINT, sig_handler); - signal(SIGTERM, sig_handler); + act.sa_handler = sig_handler; + sigemptyset (&act.sa_mask); + act.sa_flags = SA_RESTART; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); /* initialize the naming deamon */ namedev_init(); diff --git a/udevd.c b/udevd.c index 476cb64309..104cb2b987 100644 --- a/udevd.c +++ b/udevd.c @@ -114,14 +114,18 @@ static void msg_queue_insert(struct hotplug_msg *msg) static void udev_run(struct hotplug_msg *msg) { pid_t pid; - setenv("ACTION", msg->action, 1); - setenv("DEVPATH", msg->devpath, 1); + char action[32]; + char devpath[256]; + char *env[] = { action, devpath, NULL }; + + snprintf(action, sizeof(action), "ACTION=%s", msg->action); + snprintf(devpath, sizeof(devpath), "DEVPATH=%s", msg->devpath); pid = fork(); switch (pid) { case 0: /* child */ - execl(UDEV_BIN, "udev", msg->subsystem, NULL); + execle(UDEV_BIN, "udev", msg->subsystem, NULL, env); dbg("exec of child failed"); exit(1); break; @@ -285,17 +289,21 @@ int main(int argc, char *argv[]) struct sockaddr_un saddr; socklen_t addrlen; int retval; + struct sigaction act; init_logging("udevd"); - signal(SIGINT, sig_handler); - signal(SIGTERM, sig_handler); - signal(SIGALRM, sig_handler); - signal(SIGCHLD, sig_handler); + /* set signal handler */ + act.sa_handler = sig_handler; + sigemptyset (&act.sa_mask); + act.sa_flags = SA_RESTART; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); /* we want these two to interrupt system calls */ - siginterrupt(SIGALRM, 1); - siginterrupt(SIGCHLD, 1); + act.sa_flags = 0; + sigaction(SIGALRM, &act, NULL); + sigaction(SIGCHLD, &act, NULL); memset(&saddr, 0x00, sizeof(saddr)); saddr.sun_family = AF_LOCAL; @@ -310,7 +318,7 @@ int main(int argc, char *argv[]) } /* the bind takes care of ensuring only one copy running */ - retval = bind(ssock, &saddr, addrlen); + retval = bind(ssock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { dbg("bind failed\n"); goto exit; diff --git a/udevsend.c b/udevsend.c index 17372d8d9a..a24e7d75ed 100644 --- a/udevsend.c +++ b/udevsend.c @@ -179,7 +179,7 @@ int main(int argc, char* argv[]) /* If we can't send, try to start daemon and resend message */ loop = UDEVSEND_CONNECT_RETRY; while (loop--) { - retval = sendto(sock, &message, size, 0, (struct sockaddr*)&saddr, addrlen); + retval = sendto(sock, &message, size, 0, (struct sockaddr *)&saddr, addrlen); if (retval != -1) { retval = 0; goto close_and_exit; -- cgit v1.2.3-54-g00ecf From 0028653cdff8e3a7f3577509ce89f8bb15efa01e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 11 Feb 2004 22:32:11 -0800 Subject: [PATCH] udevd - client access authorization Here is the badly needed client authorization for udevd. Since we switched to abstract namespace sockets, we are unable to control the access of the socket by file permissions. So here we send a ancillary credential message with every datagram, to be able to verify the uid of the sender. The sender can't fake the credentials, cause the kernel doesn't allow it for non root users. udevd is still working with klibc here :) --- udevd.c | 30 ++++++++++++++++++++++++++++-- udevsend.c | 37 +++++++++++++++++++++++++++++++++---- 2 files changed, 61 insertions(+), 6 deletions(-) diff --git a/udevd.c b/udevd.c index 104cb2b987..366c227a3b 100644 --- a/udevd.c +++ b/udevd.c @@ -222,6 +222,11 @@ static void handle_msg(int sock) { struct hotplug_msg *msg; int retval; + struct msghdr smsg; + struct cmsghdr *cmsg; + struct iovec iov; + struct ucred *cred; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; msg = msg_create(); if (msg == NULL) { @@ -229,13 +234,30 @@ static void handle_msg(int sock) return; } - retval = recv(sock, msg, sizeof(struct hotplug_msg), 0); + iov.iov_base = msg; + iov.iov_len = sizeof(struct hotplug_msg); + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + + retval = recvmsg(sock, &smsg, 0); if (retval < 0) { if (errno != EINTR) dbg("unable to receive message"); return; } - + cmsg = CMSG_FIRSTHDR(&smsg); + cred = (struct ucred *) CMSG_DATA(cmsg); + + if (cred->uid != 0) { + dbg("sender uid=%i, message ignored", cred->uid); + free(msg); + return; + } + if (strncmp(msg->magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { dbg("message magic '%s' doesn't match, ignore it", msg->magic); free(msg); @@ -289,6 +311,7 @@ int main(int argc, char *argv[]) struct sockaddr_un saddr; socklen_t addrlen; int retval; + const int on = 1; struct sigaction act; init_logging("udevd"); @@ -324,6 +347,9 @@ int main(int argc, char *argv[]) goto exit; } + /* enable receiving of the sender credentials */ + setsockopt(ssock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + while (1) { handle_msg(ssock); diff --git a/udevsend.c b/udevsend.c index a24e7d75ed..b26c744422 100644 --- a/udevsend.c +++ b/udevsend.c @@ -119,7 +119,7 @@ static int start_daemon(void) int main(int argc, char* argv[]) { - struct hotplug_msg message; + struct hotplug_msg msg; char *action; char *devpath; char *subsystem; @@ -133,6 +133,13 @@ int main(int argc, char* argv[]) struct sockaddr_un saddr; socklen_t addrlen; int started_daemon = 0; + struct iovec iov; + struct msghdr smsg; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + struct cmsghdr *cmsg; + struct ucred *cred; + + #ifdef DEBUG init_logging("udevsend"); @@ -174,12 +181,34 @@ int main(int argc, char* argv[]) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - size = build_hotplugmsg(&message, action, devpath, subsystem, seq); - + size = build_hotplugmsg(&msg, action, devpath, subsystem, seq); + + /* prepare message with credentials to authenticate ourself */ + iov.iov_base = &msg; + iov.iov_len = size; + + smsg.msg_name = &saddr; + smsg.msg_namelen = addrlen; + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = CMSG_LEN(sizeof(struct ucred));; + smsg.msg_flags = 0; + + cmsg = CMSG_FIRSTHDR(&smsg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_CREDENTIALS; + cmsg->cmsg_len = sizeof(cred_msg); + cred = (struct ucred *) CMSG_DATA(cmsg); + cred->uid = getuid(); + cred->gid = getgid(); + cred->pid = getpid(); + cred->pid = getpid(); + /* If we can't send, try to start daemon and resend message */ loop = UDEVSEND_CONNECT_RETRY; while (loop--) { - retval = sendto(sock, &message, size, 0, (struct sockaddr *)&saddr, addrlen); + retval = sendmsg(sock, &smsg, 0); if (retval != -1) { retval = 0; goto close_and_exit; -- cgit v1.2.3-54-g00ecf From e9b2679f420b77f1ea49fc3cd8a746072fe66854 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 11 Feb 2004 23:23:17 -0800 Subject: [PATCH] fix up 'make release' to use bk to build the export tree. --- Makefile | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d2cec3ac8a..f53e7ca2fd 100644 --- a/Makefile +++ b/Makefile @@ -283,15 +283,13 @@ DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.ta DISTDIR := $(RELEASE_NAME) srcdir = . release: clean - @echo "--------------------------cut here------------------------" - @echo "cd .." - @echo "rm -rf $(DISTDIR)" - @echo "mkdir $(DISTDIR)" - @echo "chmod 777 $(DISTDIR)" - @echo "cp -avr udev/* $(DISTDIR)" - @echo "tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz" - @echo "rm -rf $(DISTDIR)" - @echo "--------------------------cut here------------------------" + -rm -rf $(DISTDIR) + mkdir $(DISTDIR) + chmod 777 $(DISTDIR) + bk export $(DISTDIR) + tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz + rm -rf $(DISTDIR) + @echo "$(RELEASE_NAME).tar.gz created" small_release: $(DISTFILES) clean -- cgit v1.2.3-54-g00ecf From f0142622b8b68d58694d0c97396bb24d0830c5df Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 11 Feb 2004 23:34:21 -0800 Subject: [PATCH] add a block device with a ! in the name, and a test for this. --- test/sys/block/rd!c0d0/dev | 1 + test/udev-test.pl | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 test/sys/block/rd!c0d0/dev diff --git a/test/sys/block/rd!c0d0/dev b/test/sys/block/rd!c0d0/dev new file mode 100644 index 0000000000..fae0a50572 --- /dev/null +++ b/test/sys/block/rd!c0d0/dev @@ -0,0 +1 @@ +8:0 diff --git a/test/udev-test.pl b/test/udev-test.pl index 0700e53576..1bce65885e 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -326,6 +326,16 @@ EOF expected => "visor" , conf => < "name test with ! in the name", + subsys => "block", + devpath => "block/rd!c0d0", + expected => "rd/c0d0" , + conf => < Date: Wed, 11 Feb 2004 23:49:04 -0800 Subject: [PATCH] Handle the '!' character that some block devices have. --- namedev.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 7984adfb31..3e2182ae7b 100644 --- a/namedev.c +++ b/namedev.c @@ -313,6 +313,19 @@ exit: return; /* here to prevent compiler warning... */ } +static void fix_kernel_name(struct udevice *udev) +{ + char *temp = udev->kernel_name; + + while (*temp != 0x00) { + /* Some block devices have a ! in their name, + * we need to change that to / */ + if (*temp == '!') + *temp = '/'; + ++temp; + } +} + static int execute_program(char *path, char *value, int len) { int retval; @@ -701,11 +714,12 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud dbg("sysfs_device->bus='%s'", sysfs_device->bus); strfieldcpy(udev->bus_id, sysfs_device->bus_id); wait_for_device_to_initialize(sysfs_device); - } else { - dbg("class_dev->name = '%s'", class_dev->name); } + dbg("class_dev->name = '%s'", class_dev->name); strfieldcpy(udev->kernel_name, class_dev->name); + fix_kernel_name(udev); + dbg("udev->kernel_name = '%s'", udev->kernel_name); /* get kernel number */ pos = class_dev->name + strlen(class_dev->name); -- cgit v1.2.3-54-g00ecf From 2e31718495a89e6b582240ed527950f78e7d1849 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 00:49:52 -0800 Subject: [PATCH] let udev-test.pl run an individual test if you ask it to. just put the test number on the command line: udev-test.pl 3 will run test number 3 If no test number is specified, all of the tests will be run, just like before. --- test/udev-test.pl | 62 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 1bce65885e..c433b84a97 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -90,6 +90,16 @@ EOF expected => "visor/0" , conf => < "catch device by * - take 2", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + expected => "visor/0" , + conf => <$main_conf" || die "unable to create config file: $main_conf"; -print CONF "udev_root=\"$udev_root\"\n"; -print CONF "udev_db=\"$udev_db\"\n"; -print CONF "udev_rules=\"$conf_tmp\"\n"; -print CONF "udev_permissions=\"$perm\"\n"; -close CONF; -foreach my $config (@tests) { - print "TEST: $config->{desc}\n"; +sub run_test { + my ($config, $number) = @_; + + print "TEST $number: $config->{desc}\n"; print "device \'$config->{devpath}\' expecting node \'$config->{expected}\'\n"; udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); @@ -402,6 +399,37 @@ foreach my $config (@tests) { } } +# prepare +system("rm -rf $udev_root"); +mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; + +# create initial config file +open CONF, ">$main_conf" || die "unable to create config file: $main_conf"; +print CONF "udev_root=\"$udev_root\"\n"; +print CONF "udev_db=\"$udev_db\"\n"; +print CONF "udev_rules=\"$conf_tmp\"\n"; +print CONF "udev_permissions=\"$perm\"\n"; +close CONF; + +my $test_num = 1; + +if ($ARGV[0]) { + # only run one test + $test_num = $ARGV[0]; + print "udev-test will run test number $test_num only\n"; + + run_test($tests[$test_num], $test_num); +} else { + # test all + print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; + + foreach my $config (@tests) { + run_test($config, $test_num); + $test_num++; + + } +} + print "$error errors occured\n\n"; # cleanup -- cgit v1.2.3-54-g00ecf From ede4308a803131f473efed3dc3246ffac7163dfa Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 01:14:48 -0800 Subject: [PATCH] remove some more KLIBC fixups that are no longer needed. --- klibc_fixups.h | 6 ------ udev-add.c | 9 +-------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/klibc_fixups.h b/klibc_fixups.h index 37622c86d6..1ac112b087 100644 --- a/klibc_fixups.h +++ b/klibc_fixups.h @@ -3,12 +3,6 @@ #ifndef KLIBC_FIXUPS_H #define KLIBC_FIXUPS_H - -#define WTERMSIG(status) ((status) & 0x7f) -#define WEXITSTATUS(status) (((status) & 0xff00) >> 8) -#define WIFEXITED(status) (WTERMSIG(status) == 0) - - struct group { char *gr_name; /* group name */ char *gr_passwd; /* group password */ diff --git a/udev-add.c b/udev-add.c index 9f07d22ec6..fedc8f0fc8 100644 --- a/udev-add.c +++ b/udev-add.c @@ -109,19 +109,12 @@ static int create_node(struct udevice *dev) int retval = 0; uid_t uid = 0; gid_t gid = 0; - dev_t res; int i; int tail; strncpy(filename, udev_root, sizeof(filename)); strncat(filename, dev->name, sizeof(filename)); -#ifdef __KLIBC__ - res = (dev->major << 8) | (dev->minor); -#else - res = makedev(dev->major, dev->minor); -#endif - switch (dev->type) { case 'b': dev->mode |= S_IFBLK; @@ -144,7 +137,7 @@ static int create_node(struct udevice *dev) info("creating device node '%s'", filename); dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor); - retval = mknod(filename, dev->mode, res); + retval = mknod(filename, dev->mode, makedev(dev->major, dev->minor)); if (retval != 0) dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", filename, dev->mode, dev->major, dev->minor, strerror(errno)); -- cgit v1.2.3-54-g00ecf From 7b1cbec91a51a8d8f1546935d942744b0f5a274e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 12 Feb 2004 01:23:59 -0800 Subject: [PATCH] better credential patch Here is a small improvement. We check for the type of message we receive and udevsend seems not to need all the credential setup stuff, the kernel will fill it for us. udevd now refuses to start as non root, cause it doesn't make any sense. --- udevd.c | 25 +++++++++++++++++++------ udevsend.c | 31 +------------------------------ 2 files changed, 20 insertions(+), 36 deletions(-) diff --git a/udevd.c b/udevd.c index 366c227a3b..14616b9824 100644 --- a/udevd.c +++ b/udevd.c @@ -252,16 +252,19 @@ static void handle_msg(int sock) cmsg = CMSG_FIRSTHDR(&smsg); cred = (struct ucred *) CMSG_DATA(cmsg); + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + dbg("no sender credentials received, message ignored"); + goto skip; + } + if (cred->uid != 0) { dbg("sender uid=%i, message ignored", cred->uid); - free(msg); - return; + goto skip; } if (strncmp(msg->magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { dbg("message magic '%s' doesn't match, ignore it", msg->magic); - free(msg); - return; + goto skip; } /* if no seqnum is given, we move straight to exec queue */ @@ -271,6 +274,11 @@ static void handle_msg(int sock) } else { msg_queue_insert(msg); } + return; + +skip: + free(msg); + return; } static void sig_handler(int signum) @@ -316,6 +324,11 @@ int main(int argc, char *argv[]) init_logging("udevd"); + if (getuid() != 0) { + dbg("need to be root, exit"); + exit(1); + } + /* set signal handler */ act.sa_handler = sig_handler; sigemptyset (&act.sa_mask); @@ -336,14 +349,14 @@ int main(int argc, char *argv[]) ssock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (ssock == -1) { - dbg("error getting socket"); + dbg("error getting socket, exit"); exit(1); } /* the bind takes care of ensuring only one copy running */ retval = bind(ssock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { - dbg("bind failed\n"); + dbg("bind failed, exit"); goto exit; } diff --git a/udevsend.c b/udevsend.c index b26c744422..b2fbcbbca6 100644 --- a/udevsend.c +++ b/udevsend.c @@ -133,13 +133,6 @@ int main(int argc, char* argv[]) struct sockaddr_un saddr; socklen_t addrlen; int started_daemon = 0; - struct iovec iov; - struct msghdr smsg; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - struct cmsghdr *cmsg; - struct ucred *cred; - - #ifdef DEBUG init_logging("udevsend"); @@ -183,32 +176,10 @@ int main(int argc, char* argv[]) size = build_hotplugmsg(&msg, action, devpath, subsystem, seq); - /* prepare message with credentials to authenticate ourself */ - iov.iov_base = &msg; - iov.iov_len = size; - - smsg.msg_name = &saddr; - smsg.msg_namelen = addrlen; - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = CMSG_LEN(sizeof(struct ucred));; - smsg.msg_flags = 0; - - cmsg = CMSG_FIRSTHDR(&smsg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_CREDENTIALS; - cmsg->cmsg_len = sizeof(cred_msg); - cred = (struct ucred *) CMSG_DATA(cmsg); - cred->uid = getuid(); - cred->gid = getgid(); - cred->pid = getpid(); - cred->pid = getpid(); - /* If we can't send, try to start daemon and resend message */ loop = UDEVSEND_CONNECT_RETRY; while (loop--) { - retval = sendmsg(sock, &smsg, 0); + retval = sendto(sock, &msg, size, 0, (struct sockaddr *)&saddr, addrlen); if (retval != -1) { retval = 0; goto close_and_exit; -- cgit v1.2.3-54-g00ecf From 5a42932b9a783670ae3406fb2c3462036bb16d32 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Thu, 12 Feb 2004 01:24:54 -0800 Subject: [PATCH] udev kill extra bus_id compares in match_id Kill the extra bus_id check in match_id. This is wrong, especially since we check for rule matches with the parent devices on a given devices path. For example, given a device path of: /sys/devices/pci0000:01/0000:01:0c.0/host5/5:0:2:0 With this patch, the following rule will no longer match: BUS="scsi", ID="host5", NAME="sd-bus_id-host5" --- namedev.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/namedev.c b/namedev.c index 3e2182ae7b..59ec08c715 100644 --- a/namedev.c +++ b/namedev.c @@ -469,32 +469,19 @@ static int match_sysfs_pairs(struct config_device *dev, struct sysfs_class_devic static int match_id(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { char path[SYSFS_PATH_MAX]; - int found; char *temp = NULL; /* we have to have a sysfs device for ID to work */ if (!sysfs_device) return -ENODEV; - found = 0; strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); - if (strstr(temp, dev->id) != NULL) { - found = 1; - } else { - *temp = 0x00; - temp = strrchr(path, '/'); - dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); - if (strstr(temp, dev->id) != NULL) - found = 1; - } - if (!found) { - dbg("id doesn't match"); + if (strstr(temp, dev->id) == NULL) return -ENODEV; - } - - return 0; + else + return 0; } static int match_place(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) -- cgit v1.2.3-54-g00ecf From 3a8c51a771b5c67d5cf0002980254ef175668630 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Thu, 12 Feb 2004 01:25:28 -0800 Subject: [PATCH] udev add wild card compare for ID Allow wild card comparison of the ID. Using strcmp_pattern here also means we on longer match partial values, for example, a scsi rule like this won't match anymore: BUS="scsi", ID=":0", NAME="sdfoo-short-bus_id-1" But this now works: BUS="scsi", ID="*:0", NAME="sdfoo-bus_id-wild-card-1" --- namedev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 59ec08c715..e4e585b5cd 100644 --- a/namedev.c +++ b/namedev.c @@ -477,8 +477,9 @@ static int match_id(struct config_device *dev, struct sysfs_class_device *class_ strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); + temp++; dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); - if (strstr(temp, dev->id) == NULL) + if (strcmp_pattern(dev->id, temp) != 0) return -ENODEV; else return 0; -- cgit v1.2.3-54-g00ecf From d45ea2b70c0cba69b02dae81d696a8b4c05c1771 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 01:29:40 -0800 Subject: [PATCH] stop using mode_t as different libcs define it in different ways :( --- namedev.h | 2 +- udev.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/namedev.h b/namedev.h index 9cff3710d4..a0cdba6b16 100644 --- a/namedev.h +++ b/namedev.h @@ -74,7 +74,7 @@ struct perm_device { char name[NAME_SIZE]; char owner[OWNER_SIZE]; char group[GROUP_SIZE]; - mode_t mode; + unsigned int mode; }; extern struct list_head config_device_list; diff --git a/udev.h b/udev.h index 108623e059..9e01e40492 100644 --- a/udev.h +++ b/udev.h @@ -40,7 +40,7 @@ struct udevice { char type; int major; int minor; - mode_t mode; + unsigned int mode; /* not mode_t due to conflicting definitions in different libcs */ char symlink[NAME_SIZE]; /* fields that help us in building strings */ -- cgit v1.2.3-54-g00ecf From d026a35d747c0a993281408a9644ab843cf89fdd Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 18:57:06 -0800 Subject: [PATCH] more logging.h cleanups to be a bit more flexible. --- logging.h | 18 +++--------------- udev.c | 15 ++++++++++++--- udevd.c | 11 ++++++++--- udevinfo.c | 12 +++++++++--- udevsend.c | 11 ++++++++--- 5 files changed, 40 insertions(+), 27 deletions(-) diff --git a/logging.h b/logging.h index df0d7dedce..2ba2ac4965 100644 --- a/logging.h +++ b/logging.h @@ -57,23 +57,11 @@ } while (0) #endif -/* each program must declare this variable and function somewhere */ -extern unsigned char logname[42]; -extern int log_ok(void); - -static void log_message (int level, const char *format, ...) +extern void log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -static inline void log_message (int level, const char *format, ...) -{ - va_list args; - if (!log_ok()) - return; - - va_start(args, format); - vsyslog(level, format, args); - va_end(args); -} +/* each program that uses syslog must declare this variable somewhere */ +extern unsigned char logname[42]; #undef init_logging static inline void init_logging(char *program_name) diff --git a/udev.c b/udev.c index 0f01fa41d2..9f10cc2125 100644 --- a/udev.c +++ b/udev.c @@ -38,12 +38,21 @@ /* global variables */ char **main_argv; char **main_envp; -unsigned char logname[42]; -int log_ok(void) +#ifdef LOG +unsigned char logname[42]; +void log_message (int level, const char *format, ...) { - return udev_log; + va_list args; + + if (!udev_log) + return; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); } +#endif static void sig_handler(int signum) { diff --git a/udevd.c b/udevd.c index 14616b9824..9fbb4e964b 100644 --- a/udevd.c +++ b/udevd.c @@ -51,12 +51,17 @@ LIST_HEAD(running_list); static void exec_queue_manager(void); static void msg_queue_manager(void); +#ifdef LOG unsigned char logname[42]; - -int log_ok(void) +void log_message (int level, const char *format, ...) { - return 1; + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); } +#endif static void msg_dump_queue(void) { diff --git a/udevinfo.c b/udevinfo.c index 103ebce08c..44eb142709 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -38,12 +38,18 @@ char **main_argv; int main_argc; -unsigned char logname[42]; -int log_ok(void) +#ifdef LOG +unsigned char logname[42]; +void log_message (int level, const char *format, ...) { - return 1; + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); } +#endif static int print_all_attributes(const char *path) { diff --git a/udevsend.c b/udevsend.c index b2fbcbbca6..c738fe2245 100644 --- a/udevsend.c +++ b/udevsend.c @@ -40,12 +40,17 @@ #include "udevd.h" #include "logging.h" +#ifdef LOG unsigned char logname[42]; - -int log_ok(void) +void log_message (int level, const char *format, ...) { - return 1; + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); } +#endif static inline char *get_action(void) { -- cgit v1.2.3-54-g00ecf From bb051f66571121e2c9c97422b65aa89a37ec8feb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 19:48:07 -0800 Subject: [PATCH] fix problem where usb devices can be either the main device or the interface This fixes the bug of a long delay for mouse devices --- namedev.c | 46 ++++++++------ udevtest.c | 200 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 228 insertions(+), 18 deletions(-) create mode 100644 udevtest.c diff --git a/namedev.c b/namedev.c index e4e585b5cd..68ca5dd306 100644 --- a/namedev.c +++ b/namedev.c @@ -260,12 +260,17 @@ static void apply_format(struct udevice *udev, unsigned char *string) } } +/* + * Note, we can have multiple files for different busses in here due + * to the mess that USB has for its device tree... + */ static struct bus_file { char *bus; char *file; } bus_files[] = { { .bus = "scsi", .file = "vendor" }, { .bus = "usb", .file = "idVendor" }, + { .bus = "usb", .file = "iInterface" }, { .bus = "usb-serial", .file = "detach_state" }, { .bus = "ide", .file = "detach_state" }, { .bus = "pci", .file = "vendor" }, @@ -285,30 +290,35 @@ static void wait_for_device_to_initialize(struct sysfs_device *sysfs_device) */ struct bus_file *b = &bus_files[0]; struct sysfs_attribute *tmpattr; - int loop; + int found = 0; + int loop = SECONDS_TO_WAIT_FOR_FILE; while (1) { - if (b->bus == NULL) - break; + if (b->bus == NULL) { + if (!found) + break; + /* sleep to give the kernel a chance to create the file */ + sleep(1); + --loop; + if (loop == 0) + break; + b = &bus_files[0]; + } if (strcmp(sysfs_device->bus, b->bus) == 0) { - tmpattr = NULL; - loop = SECONDS_TO_WAIT_FOR_FILE; - while (loop--) { - dbg("looking for file '%s' on bus '%s'", b->file, b->bus); - tmpattr = sysfs_get_device_attr(sysfs_device, b->file); - if (tmpattr) { - /* found it! */ - goto exit; - } - /* sleep to give the kernel a chance to create the file */ - sleep(1); + found = 1; + dbg("looking for file '%s' on bus '%s'", b->file, b->bus); + tmpattr = sysfs_get_device_attr(sysfs_device, b->file); + if (tmpattr) { + /* found it! */ + goto exit; } - dbg("timed out waiting for '%s' file, continuing on anyway...", b->file); - goto exit; + dbg("can't find '%s' file", b->file); } - b++; + ++b; } - dbg("did not find bus type '%s' on list of bus_id_files, contact greg@kroah.com", sysfs_device->bus); + if (!found) + dbg("did not find bus type '%s' on list of bus_id_files, " + "contact greg@kroah.com", sysfs_device->bus); exit: return; /* here to prevent compiler warning... */ } diff --git a/udevtest.c b/udevtest.c new file mode 100644 index 0000000000..9f10cc2125 --- /dev/null +++ b/udevtest.c @@ -0,0 +1,200 @@ +/* + * udev.c + * + * Userspace devfs + * + * Copyright (C) 2003,2004 Greg Kroah-Hartman + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_version.h" +#include "udev_dbus.h" +#include "logging.h" +#include "namedev.h" +#include "udevdb.h" +#include "libsysfs/libsysfs.h" + +/* global variables */ +char **main_argv; +char **main_envp; + +#ifdef LOG +unsigned char logname[42]; +void log_message (int level, const char *format, ...) +{ + va_list args; + + if (!udev_log) + return; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif + +static void sig_handler(int signum) +{ + switch (signum) { + case SIGINT: + case SIGTERM: + sysbus_disconnect(); + udevdb_exit(); + exit(20 + signum); + default: + dbg("unhandled signal"); + } +} + +static inline char *get_action(void) +{ + char *action; + + action = getenv("ACTION"); + return action; +} + +static inline char *get_devpath(void) +{ + char *devpath; + + devpath = getenv("DEVPATH"); + return devpath; +} + +static inline char *get_seqnum(void) +{ + char *seqnum; + + seqnum = getenv("SEQNUM"); + return seqnum; +} + +static char *subsystem_blacklist[] = { + "net", + "scsi_host", + "scsi_device", + "usb_host", + "pci_bus", + "", +}; + +static int udev_hotplug(int argc, char **argv) +{ + char *action; + char *devpath; + char *subsystem; + int retval = -EINVAL; + int i; + struct sigaction act; + + action = get_action(); + if (!action) { + dbg ("no action?"); + goto exit; + } + + devpath = get_devpath(); + if (!devpath) { + dbg ("no devpath?"); + goto exit; + } + dbg("looking at '%s'", devpath); + + /* we only care about class devices and block stuff */ + if (!strstr(devpath, "class") && + !strstr(devpath, "block")) { + dbg("not a block or class device"); + goto exit; + } + + /* skip blacklisted subsystems */ + subsystem = argv[1]; + i = 0; + while (subsystem_blacklist[i][0] != '\0') { + if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { + dbg("don't care about '%s' devices", subsystem); + goto exit; + } + i++; + } + + /* connect to the system message bus */ + sysbus_connect(); + + /* initialize our configuration */ + udev_init_config(); + + /* initialize udev database */ + retval = udevdb_init(UDEVDB_DEFAULT); + if (retval != 0) { + dbg("unable to initialize database"); + goto exit_sysbus; + } + + /* set up a default signal handler for now */ + act.sa_handler = sig_handler; + sigemptyset (&act.sa_mask); + act.sa_flags = SA_RESTART; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + + /* initialize the naming deamon */ + namedev_init(); + + if (strcmp(action, "add") == 0) + retval = udev_add_device(devpath, subsystem); + + else if (strcmp(action, "remove") == 0) + retval = udev_remove_device(devpath, subsystem); + + else { + dbg("unknown action '%s'", action); + retval = -EINVAL; + } + udevdb_exit(); + +exit_sysbus: + /* disconnect from the system message bus */ + sysbus_disconnect(); + +exit: + if (retval > 0) + retval = 0; + + return -retval; +} + +int main(int argc, char **argv, char **envp) +{ + main_argv = argv; + main_envp = envp; + + init_logging("udev"); + dbg("version %s", UDEV_VERSION); + + return udev_hotplug(argc, argv); +} + + -- cgit v1.2.3-54-g00ecf From eb10f97f2816ae09f949060a2bb8c46b8c1788ed Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 20:19:21 -0800 Subject: [PATCH] add udevtest program to build Also fix up some other dependancy issues in the Makefile. Thanks to Olaf Hering for pointing them out. --- Makefile | 23 +++++++++++++++-------- udev-add.c | 56 +++++++++++++++++++++++++++++++++----------------------- udev.c | 2 +- udev.h | 2 +- udevtest.c | 51 +++++++++------------------------------------------ 5 files changed, 59 insertions(+), 75 deletions(-) diff --git a/Makefile b/Makefile index f53e7ca2fd..cb9dfdd3d8 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ ROOT = udev DAEMON = udevd SENDER = udevsend HELPER = udevinfo +TESTER = udevtest VERSION = 016_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) @@ -168,7 +169,7 @@ endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(SENDER) $(DAEMON) $(HELPER) +all: $(ROOT) $(SENDER) $(DAEMON) $(HELPER) $(TESTER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -178,8 +179,6 @@ all: $(ROOT) $(SENDER) $(DAEMON) $(HELPER) -C $$target $@ ; \ done ; \ -$(ROOT): $(LIBC) - $(ARCH_LIB_OBJS) : $(CRT0) $(CRT0): @@ -250,21 +249,29 @@ $(LOCAL_CFG_DIR)/udev.conf: $(OBJS): $(GEN_HEADERS) -udev.o: $(GEN_HEADERS) +$(ROOT).o: $(GEN_HEADERS) +$(TESTER).o: $(GEN_HEADERS) +$(HELPER).o: $(GEN_HEADERS) +$(DAEMON).o: $(GEN_HEADERS) +$(SENDER).o: $(GEN_HEADERS) -$(ROOT): udev.o $(OBJS) $(HEADERS) $(GEN_HEADERS) +$(ROOT): $(ROOT).o $(OBJS) $(HEADERS) $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(HELPER): $(HEADERS) udevinfo.o $(OBJS) +$(TESTER): $(TESTER).o $(OBJS) $(HEADERS) $(LIBC) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevtest.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $@ + +$(HELPER): $(HELPER).o $(OBJS) $(HEADERS) $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(DAEMON): udevd.h $(GEN_HEADERS) udevd.o +$(DAEMON): $(DAEMON).o udevd.h $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(SENDER): udevd.h $(GEN_HEADERS) udevsend.o +$(SENDER): $(SENDER).o udevd.h $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ diff --git a/udev-add.c b/udev-add.c index fedc8f0fc8..8867c8f5af 100644 --- a/udev-add.c +++ b/udev-add.c @@ -99,7 +99,7 @@ static int create_path(char *file) return 0; } -static int create_node(struct udevice *dev) +static int create_node(struct udevice *dev, int fake) { struct stat stats; char filename[255]; @@ -137,16 +137,20 @@ static int create_node(struct udevice *dev) info("creating device node '%s'", filename); dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor); - retval = mknod(filename, dev->mode, makedev(dev->major, dev->minor)); - if (retval != 0) - dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", - filename, dev->mode, dev->major, dev->minor, strerror(errno)); + if (!fake) { + retval = mknod(filename, dev->mode, makedev(dev->major, dev->minor)); + if (retval != 0) + dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", + filename, dev->mode, dev->major, dev->minor, strerror(errno)); + } dbg("chmod(%s, %#o)", filename, dev->mode); - retval = chmod(filename, dev->mode); - if (retval != 0) - dbg("chmod(%s, %#o) failed with error '%s'", - filename, dev->mode, strerror(errno)); + if (!fake) { + retval = chmod(filename, dev->mode); + if (retval != 0) + dbg("chmod(%s, %#o) failed with error '%s'", + filename, dev->mode, strerror(errno)); + } if (dev->owner[0] != '\0') { char *endptr; @@ -195,8 +199,9 @@ static int create_node(struct udevice *dev) strncpy(filename, udev_root, sizeof(filename)); strncat(filename, linkname, sizeof(filename)); dbg("symlink '%s' to node '%s' requested", filename, dev->name); - if (strrchr(linkname, '/')) - create_path(filename); + if (!fake) + if (strrchr(linkname, '/')) + create_path(filename); /* optimize relative link */ linktarget[0] = '\0'; @@ -219,7 +224,7 @@ static int create_node(struct udevice *dev) /* unlink existing non-directories to ensure that our symlink * is created */ - if (lstat(filename, &stats) == 0) { + if (!fake && (lstat(filename, &stats) == 0)) { if ((stats.st_mode & S_IFMT) != S_IFDIR) { if (unlink(filename)) dbg("unlink(%s) failed with error '%s'", @@ -228,10 +233,12 @@ static int create_node(struct udevice *dev) } dbg("symlink(%s, %s)", linktarget, filename); - retval = symlink(linktarget, filename); - if (retval != 0) - dbg("symlink(%s, %s) failed with error '%s'", - linktarget, filename, strerror(errno)); + if (!fake) { + retval = symlink(linktarget, filename); + if (retval != 0) + dbg("symlink(%s, %s) failed with error '%s'", + linktarget, filename, strerror(errno)); + } } } @@ -289,7 +296,7 @@ exit: return retval; } -int udev_add_device(char *path, char *subsystem) +int udev_add_device(char *path, char *subsystem, int fake) { struct sysfs_class_device *class_dev = NULL; struct udevice dev; @@ -321,15 +328,18 @@ int udev_add_device(char *path, char *subsystem) if (retval != 0) goto exit; - retval = udevdb_add_dev(path, &dev); - if (retval != 0) - dbg("udevdb_add_dev failed, but we are going to try to create the node anyway. " - "But remove might not work properly for this device."); + if (!fake) { + retval = udevdb_add_dev(path, &dev); + if (retval != 0) + dbg("udevdb_add_dev failed, but we are going to try " + "to create the node anyway. But remove might not " + "work properly for this device."); + } dbg("name='%s'", dev.name); - retval = create_node(&dev); + retval = create_node(&dev, fake); - if (retval == 0) + if ((retval == 0) && (!fake)) sysbus_send_create(&dev, path); exit: diff --git a/udev.c b/udev.c index 9f10cc2125..ce6d6ce9df 100644 --- a/udev.c +++ b/udev.c @@ -164,7 +164,7 @@ static int udev_hotplug(int argc, char **argv) namedev_init(); if (strcmp(action, "add") == 0) - retval = udev_add_device(devpath, subsystem); + retval = udev_add_device(devpath, subsystem, 0); else if (strcmp(action, "remove") == 0) retval = udev_remove_device(devpath, subsystem); diff --git a/udev.h b/udev.h index 9e01e40492..00f1361016 100644 --- a/udev.h +++ b/udev.h @@ -56,7 +56,7 @@ do { \ strncpy(to, from, sizeof(to)-1); \ } while (0) -extern int udev_add_device(char *path, char *subsystem); +extern int udev_add_device(char *path, char *subsystem, int fake); extern int udev_remove_device(char *path, char *subsystem); extern void udev_init_config(void); extern int parse_get_pair(char **orig_string, char **left, char **right); diff --git a/udevtest.c b/udevtest.c index 9f10cc2125..dd8375aa5c 100644 --- a/udevtest.c +++ b/udevtest.c @@ -29,10 +29,8 @@ #include "udev.h" #include "udev_version.h" -#include "udev_dbus.h" #include "logging.h" #include "namedev.h" -#include "udevdb.h" #include "libsysfs/libsysfs.h" /* global variables */ @@ -45,12 +43,15 @@ void log_message (int level, const char *format, ...) { va_list args; - if (!udev_log) - return; +// if (!udev_log) +// return; + /* FIXME use level... */ va_start(args, format); - vsyslog(level, format, args); + vprintf(format, args); va_end(args); + if (format[strlen(format)-1] != '\n') + printf("\n"); } #endif @@ -59,8 +60,6 @@ static void sig_handler(int signum) switch (signum) { case SIGINT: case SIGTERM: - sysbus_disconnect(); - udevdb_exit(); exit(20 + signum); default: dbg("unhandled signal"); @@ -102,22 +101,15 @@ static char *subsystem_blacklist[] = { static int udev_hotplug(int argc, char **argv) { - char *action; char *devpath; char *subsystem; int retval = -EINVAL; int i; struct sigaction act; - action = get_action(); - if (!action) { - dbg ("no action?"); - goto exit; - } - - devpath = get_devpath(); + devpath = argv[1]; if (!devpath) { - dbg ("no devpath?"); + dbg("no devpath?"); goto exit; } dbg("looking at '%s'", devpath); @@ -140,19 +132,9 @@ static int udev_hotplug(int argc, char **argv) i++; } - /* connect to the system message bus */ - sysbus_connect(); - /* initialize our configuration */ udev_init_config(); - /* initialize udev database */ - retval = udevdb_init(UDEVDB_DEFAULT); - if (retval != 0) { - dbg("unable to initialize database"); - goto exit_sysbus; - } - /* set up a default signal handler for now */ act.sa_handler = sig_handler; sigemptyset (&act.sa_mask); @@ -163,21 +145,7 @@ static int udev_hotplug(int argc, char **argv) /* initialize the naming deamon */ namedev_init(); - if (strcmp(action, "add") == 0) - retval = udev_add_device(devpath, subsystem); - - else if (strcmp(action, "remove") == 0) - retval = udev_remove_device(devpath, subsystem); - - else { - dbg("unknown action '%s'", action); - retval = -EINVAL; - } - udevdb_exit(); - -exit_sysbus: - /* disconnect from the system message bus */ - sysbus_disconnect(); + retval = udev_add_device(devpath, subsystem, 1); exit: if (retval > 0) @@ -191,7 +159,6 @@ int main(int argc, char **argv, char **envp) main_argv = argv; main_envp = envp; - init_logging("udev"); dbg("version %s", UDEV_VERSION); return udev_hotplug(argc, argv); -- cgit v1.2.3-54-g00ecf From 5a98bc58e429bd6f4b1da10ef965d8b3f130fbe9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 22:41:55 -0800 Subject: [PATCH] update klibc to version .107 --- klibc/klibc/include/endian.h | 1 + klibc/klibc/include/klibc/compiler.h | 34 ++++++++++++++++++++++++++++++++++ klibc/version | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/klibc/klibc/include/endian.h b/klibc/klibc/include/endian.h index 10dbbd8a89..44f89ccbbc 100644 --- a/klibc/klibc/include/endian.h +++ b/klibc/klibc/include/endian.h @@ -5,6 +5,7 @@ #ifndef _ENDIAN_H #define _ENDIAN_H +#include #include /* Linux' asm/byteorder.h defines either __LITTLE_ENDIAN or diff --git a/klibc/klibc/include/klibc/compiler.h b/klibc/klibc/include/klibc/compiler.h index 64b8c54158..49872b89d4 100644 --- a/klibc/klibc/include/klibc/compiler.h +++ b/klibc/klibc/include/klibc/compiler.h @@ -65,4 +65,38 @@ # define __unusedfunc #endif +/* "pure" function: + + Many functions have no effects except the return value and their + return value depends only on the parameters and/or global + variables. Such a function can be subject to common subexpression + elimination and loop optimization just as an arithmetic operator + would be. These functions should be declared with the attribute + `pure'. +*/ +#ifdef __GNUC__ +# define __attribute_pure__ __attribute__((pure)) +#else +# define __attribute_pure__ +#endif + +/* "const" function: + + Many functions do not examine any values except their arguments, + and have no effects except the return value. Basically this is + just slightly more strict class than the `pure' attribute above, + since function is not allowed to read global memory. + + Note that a function that has pointer arguments and examines the + data pointed to must _not_ be declared `const'. Likewise, a + function that calls a non-`const' function usually must not be + `const'. It does not make sense for a `const' function to return + `void'. +*/ +#ifdef __GNUC__ +# define __attribute_const__ __attribute__((const)) +#else +# define __attribute_const__ +#endif + #endif diff --git a/klibc/version b/klibc/version index f14cf6a1e0..4b0a18ac52 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.107 +0.108 -- cgit v1.2.3-54-g00ecf From ba053b91e145d7bb88bbd34856f6a6a86e3e718b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 22:42:14 -0800 Subject: [PATCH] fix bug in permission handling. --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 68ca5dd306..018fd452e9 100644 --- a/namedev.c +++ b/namedev.c @@ -112,7 +112,7 @@ int add_perm_dev(struct perm_device *new_dev) /* update the values if we already have the device */ list_for_each_entry(dev, &perm_device_list, node) { - if (strcmp_pattern(new_dev->name, dev->name)) + if (strcmp(new_dev->name, dev->name)) continue; copy_var(dev, new_dev, mode); copy_string(dev, new_dev, owner); -- cgit v1.2.3-54-g00ecf From 00866ed2a1f755eb027c84827fed1ed77364d436 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 12 Feb 2004 22:51:44 -0800 Subject: [PATCH] udev - keep private data out of the database? Shouldn't we keep the temporary strings out of the database, or is this information useful for something? It cuts the length of the data from 628 to 275 bytes. --- udev.h | 14 +++++++++----- udevdb.c | 7 ++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/udev.h b/udev.h index 00f1361016..e615b4c8bb 100644 --- a/udev.h +++ b/udev.h @@ -24,6 +24,7 @@ #define UDEV_H #include "libsysfs/libsysfs.h" +#include #include #define COMMENT_CHARACTER '#' @@ -33,6 +34,9 @@ #define GROUP_SIZE 30 #define MODE_SIZE 8 +/* length of public data */ +#define UDEVICE_LEN (offsetof(struct udevice, bus_id)) + struct udevice { char name[NAME_SIZE]; char owner[OWNER_SIZE]; @@ -43,11 +47,11 @@ struct udevice { unsigned int mode; /* not mode_t due to conflicting definitions in different libcs */ char symlink[NAME_SIZE]; - /* fields that help us in building strings */ - unsigned char bus_id[SYSFS_NAME_LEN]; - unsigned char program_result[NAME_SIZE]; - unsigned char kernel_number[NAME_SIZE]; - unsigned char kernel_name[NAME_SIZE]; + /* private data that help us in building strings */ + char bus_id[SYSFS_NAME_LEN]; + char program_result[NAME_SIZE]; + char kernel_number[NAME_SIZE]; + char kernel_name[NAME_SIZE]; }; #define strfieldcpy(to, from) \ diff --git a/udevdb.c b/udevdb.c index c4e064fc11..e657fedcb2 100644 --- a/udevdb.c +++ b/udevdb.c @@ -58,8 +58,8 @@ int udevdb_add_dev(const char *path, const struct udevice *dev) key.dsize = strlen(keystr) + 1; data.dptr = (void *)dev; - data.dsize = sizeof(*dev); - + data.dsize = UDEVICE_LEN; + return tdb_store(udevdb, key, data, TDB_REPLACE); } @@ -77,7 +77,8 @@ int udevdb_get_dev(const char *path, struct udevice *dev) if (data.dptr == NULL || data.dsize == 0) return -ENODEV; - memcpy(dev, data.dptr, sizeof(*dev)); + memset(dev, 0, sizeof(struct udevice)); + memcpy(dev, data.dptr, UDEVICE_LEN); return 0; } -- cgit v1.2.3-54-g00ecf From 66a90217605c149fe06f3edf0f3c491f28e640b6 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 23:08:22 -0800 Subject: [PATCH] remove the database at startup. --- etc/init.d/udev | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/init.d/udev b/etc/init.d/udev index 364a9aa5f7..437556c3fb 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -49,6 +49,12 @@ case "$1" in if [ ! -d $udev_root ]; then mkdir $udev_root fi + + # remove the database if it is there as we always want to start fresh + if [ -f $udev_root/.udevdb ]; then + rm -f $udev_root/.udevdb + fi + # propogate /udev from /sys - we only need this while we do not # have initramfs and an early user-space with which to do early # device bring up -- cgit v1.2.3-54-g00ecf From 552a4d426f24364a13d92a31bafdb37649fcb0f1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 23:20:50 -0800 Subject: [PATCH] remove the .udev.tdb when installing or uninstalling to be safe. --- Makefile | 2 ++ etc/init.d/udev | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cb9dfdd3d8..2ecfd3a968 100644 --- a/Makefile +++ b/Makefile @@ -361,6 +361,7 @@ install: install-config install-dbus-policy all $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 - rm -f $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug + - rm -f $(udevdir)/.udev.tdb - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ @@ -382,6 +383,7 @@ uninstall: uninstall-dbus-policy - rm $(sbindir)/$(HELPER) - rmdir $(hotplugdir) - rmdir $(configdir) + - rm $(udevdir)/.udev.tdb - rmdir $(udevdir) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ diff --git a/etc/init.d/udev b/etc/init.d/udev index 437556c3fb..8a29f11975 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -51,8 +51,8 @@ case "$1" in fi # remove the database if it is there as we always want to start fresh - if [ -f $udev_root/.udevdb ]; then - rm -f $udev_root/.udevdb + if [ -f $udev_root/.udev.tdb ]; then + rm -f $udev_root/.udev.tdb fi # propogate /udev from /sys - we only need this while we do not -- cgit v1.2.3-54-g00ecf From 1a3b802ff219a82b4a39cd3d7cb7bb037b396216 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 23:30:11 -0800 Subject: [PATCH] update the init.d udev script based on a patch from Red Hat. --- etc/init.d/udev | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/etc/init.d/udev b/etc/init.d/udev index 8a29f11975..69c1bab74e 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -9,6 +9,7 @@ . /etc/udev/udev.conf +prog=udev sysfs_dir=/sys bin=/sbin/udev @@ -38,9 +39,9 @@ run_udev () { fi done done + return 0 } - case "$1" in start) if [ ! -d $sysfs_dir ]; then @@ -58,22 +59,29 @@ case "$1" in # propogate /udev from /sys - we only need this while we do not # have initramfs and an early user-space with which to do early # device bring up - action "Creating initial udev device nodes: " /bin/true export ACTION=add + echo -n $"Creating initial udev device nodes:" run_udev + success /bin/true + echo + touch /var/lock/subsys/udev ;; stop) # be careful - action "Removing udev device nodes: " /bin/true + echo -n $"Removing udev device nodes: " export ACTION=remove run_udev + success /bin/true + echo + rm -f /var/lock/subsys/udev ;; status) - if [ -d $udev_root ]; then - echo "the udev device node directory exists" - else - echo "the udev device node directory does not exist" + if [ -f /var/lock/subsys/udev ]; then + echo $"$prog has run" + exit 0 fi + echo $"$prog is stopped" + exit 3 ;; restart) $0 stop -- cgit v1.2.3-54-g00ecf From 1659326d724e5f94d94d43243e087c54f8508e2b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 23:40:56 -0800 Subject: [PATCH] add some .spec file changes from Red Hat. --- udev.spec | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/udev.spec b/udev.spec index 20f4154998..0b142f0942 100644 --- a/udev.spec +++ b/udev.spec @@ -54,12 +54,18 @@ make CC="gcc $RPM_OPT_FLAGS" \ %endif %if %{log} USE_LOG=true \ +%else + USE_LOG=false \ %endif %if %{dbus} USE_DBUS=true \ +%else + USE_DBUS=false \ %endif %if %{debug} DEBUG=true \ +%else + DEBUG=false \ %endif # now build udevd on it's own, as it can't handle being built with klibc @@ -94,6 +100,7 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /sbin/udevd %attr(755,root,root) /udev/ %attr(755,root,root) /etc/udev/ +%attr(755,root,root) %dir %config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf %config(noreplace) %attr(0644,root,root) /etc/udev/udev.rules %config(noreplace) %attr(0644,root,root) /etc/udev/udev.permissions @@ -105,6 +112,9 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_mandir}/man8/udev*.8* %changelog +* Thu Feb 12 2004 Greg Kroah-Hartman +- add some changes from the latest Fedora udev release. + * Mon Feb 2 2004 Greg Kroah-Hartman - add udevsend, and udevd to the files - add ability to build udevd with glibc after the rest is build with klibc -- cgit v1.2.3-54-g00ecf From 89c941084f175904fed110fc254eac0c1897f036 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 12 Feb 2004 23:43:31 -0800 Subject: [PATCH] fix offsetof() define in klibc. --- klibc/klibc/include/stddef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/klibc/klibc/include/stddef.h b/klibc/klibc/include/stddef.h index 900c147cd8..125d2352ec 100644 --- a/klibc/klibc/include/stddef.h +++ b/klibc/klibc/include/stddef.h @@ -19,6 +19,6 @@ #endif #undef offsetof -#define offsetof(t,m) ((size_t)&((t *)0->m)) +#define offsetof(t,m) ((size_t)&((t *)0)->m) #endif /* _STDDEF_H */ -- cgit v1.2.3-54-g00ecf From 0c040e8d7cc0d027a240769dd7455679beca521d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 13 Feb 2004 00:35:30 -0800 Subject: [PATCH] add udev_log to the documentation. --- udev.8 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/udev.8 b/udev.8 index 0c8f2b1e60..aea922675a 100644 --- a/udev.8 +++ b/udev.8 @@ -57,6 +57,11 @@ This is the location of the udev rules file. The default value for this is This is the location of the udev permission file. The default value for this is .I /etc/udev/udev.permissions .TP +.B udev_log +If you want udev to log some information to the syslog for every node created or +removed. The default value for this is +.I yes +.TP .B default_mode This is the default mode for all nodes that have no explicit match in the permissions file. The default value for this is @@ -88,6 +93,9 @@ udev_rules="/etc/udev/udev.rules" # udev_permissions - The name and location of the udev permission file udev_permissions="/etc/udev/udev.permissions" +# udev_log - set to "yes" if you want logging, else "no" +udev_log="yes" + # default_mode - set the default mode for all nodes that have no # explicit match in the permissions file default_mode="0666" -- cgit v1.2.3-54-g00ecf From cbb576b91dea8bd84a9fdd147b6b4cbe757dd198 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Fri, 13 Feb 2004 00:48:36 -0800 Subject: [PATCH] more udev-016/extras/multipath > Hello, > > incremental to udev-016/extras/multipath, > > * don't rely on the linux symlink in the udev/klibc dir since > udev build doesn't use it anymore. This corrects build breakage > * remove make_dm_node fn & call. Rely on udev for this. > > The first patch is to be applied. > The second is conditioned by udev dealing correctly with devmap names. > > For this I can suggest a CALLOUT rule like this : > KERNEL="dm-[0-9]*", PROGRAM="/tmp/name_devmap %M %m", NAME="%k", > SYMLINK="%c" > > With name_devmap like : > #!/bin/sh > /usr/sbin/dmsetup ls|/bin/grep "$1, $2"|/usr/bin/awk '{print $1}' > ok I coded the suggested tool. it works with the following rule : KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" I don't know if it's right to keep this tools packaged with multipath because it's widely more general. Maybe Joe should merge it in the device-mapper package or provide the functionnality through dmsetup ? --- extras/multipath/ChangeLog | 4 +++ extras/multipath/Makefile | 10 +++++-- extras/multipath/README | 8 ++++++ extras/multipath/devmap_name.c | 60 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 extras/multipath/devmap_name.c diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index c3361ff8e8..2cc492a192 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,4 +1,8 @@ 2004-02-04 multipath-016 + * add devmap_name proggy for udev to name devmaps as per their + internal DM name and not only by their sysfs enum name (dm-*) + The corresponding udev.rules line is : + KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" * remove make_dm_node fn & call. Rely on udev for this. * don't rely on the linux symlink in the udev/klibc dir since udev build doesn't use it anymore. This corrects build breakage diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index caf24bbd90..c039e2a19f 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -36,29 +36,35 @@ recurse: $(MAKE) KERNEL_DIR=$(KERNEL_DIR) -C $$dir ; \ done $(MAKE) $(EXEC) + $(MAKE) devmap_name all: recurse @echo "" @echo "Make complete" - $(EXEC): $(OBJS) $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC) strip $(EXEC) +devmap_name: devmap_name.o + $(LD) -o devmap_name $(CRT0) devmap_name.o $(DMOBJS) $(LIB) $(LIBGCC) + strip devmap_name + clean: - rm -f core *.o $(EXEC) + rm -f core *.o $(EXEC) devmap_name $(MAKE) -C libdevmapper clean install: install -d $(bindir) install -m 755 $(EXEC) $(bindir)/ + install -m 755 devmap_name $(bindir)/ install -d /etc/hotplug.d/scsi/ install -m 755 multipath.hotplug /etc/hotplug.d/scsi/ uninstall: rm /etc/hotplug.d/scsi/multipath.hotplug rm $(bindir)/$(EXEC) + rm $(bindir)/devmap_name # Code dependencies main.o: main.c main.h sg_include.h diff --git a/extras/multipath/README b/extras/multipath/README index 417a0d38e4..80945db438 100644 --- a/extras/multipath/README +++ b/extras/multipath/README @@ -8,6 +8,8 @@ o libsysfs : comes with sysutils or udev See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ o Linux kernel 2.6.0 with udm5 patchset http://people.sistina.com/~thornber/dm/ +o udev + See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ How it works : ============== @@ -53,6 +55,12 @@ struct multipath { When mp is filled, the device maps are fed to the kernel through libdevmapper. +The naming of the corresponding block device is handeld +by udev with the help of the devmap_name proggy. It is +called by the following rule in /etc/udev/udev.rules : +KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \ +NAME="%k", SYMLINK="%c" + Notes : ======= diff --git a/extras/multipath/devmap_name.c b/extras/multipath/devmap_name.c new file mode 100644 index 0000000000..08e526e072 --- /dev/null +++ b/extras/multipath/devmap_name.c @@ -0,0 +1,60 @@ +#include "libdevmapper/libdevmapper.h" + +#include +#include +#include +#include + +static void usage(char * progname) { + fprintf(stderr, "usage : %s major minor\n", progname); + exit(1); +} + +int main(int argc, char **argv) +{ + int r = 0; + struct dm_names *names; + unsigned next = 0; + int major, minor; + + /* sanity check */ + if (argc != 3) + usage(argv[0]); + + major = atoi(argv[1]); + minor = atoi(argv[2]); + + struct dm_task *dmt; + + if (!(dmt = dm_task_create(DM_DEVICE_LIST))) + return 0; + + if (!dm_task_run(dmt)) + goto out; + + if (!(names = dm_task_get_names(dmt))) + goto out; + + if (!names->dev) { + printf("No devices found\n"); + goto out; + } + + do { + names = (void *) names + next; + if ((int) MAJOR(names->dev) == major && + (int) MINOR(names->dev) == minor) { + printf("%s\n", names->name); + goto out; + } + next = names->next; + } while (next); + + /* No correspondance found */ + r = 1; + + out: + dm_task_destroy(dmt); + return r; +} + -- cgit v1.2.3-54-g00ecf From 09b7985cf611df26fc756e0b8025a260fc4a4948 Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Fri, 13 Feb 2004 00:53:10 -0800 Subject: [PATCH] more udev-016/extras/multipath incremental to udev-016/extras/multipath-0.0.16.3, * add a GROUP_BY_SERIAL flag. This should be useful for controlers that activate their spare paths on simple IO submition with a penalty. The StorageWorks HW defaults to this mode, even if the MULTIBUS mode is OK. * remove unused sg_err.c * big restructuring : split devinfo.c from main.c. Export : * void basename (char *, char *); * int get_serial (int, char *); * int get_lun_strings (char *, char *, char *, char *); * int get_evpd_wwid(char *, char *); * long get_disk_size (char *); Now we see clearly what is expected from an external package like scsi_id. * stop passing struct env as param --- extras/multipath/ChangeLog | 12 + extras/multipath/Makefile | 4 +- extras/multipath/devinfo.c | 204 ++++++++ extras/multipath/devinfo.h | 19 + extras/multipath/main.c | 255 +++------- extras/multipath/main.h | 9 +- extras/multipath/sg_err.c | 1197 -------------------------------------------- 7 files changed, 313 insertions(+), 1387 deletions(-) create mode 100644 extras/multipath/devinfo.c create mode 100644 extras/multipath/devinfo.h delete mode 100644 extras/multipath/sg_err.c diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index 2cc492a192..31f6c48f69 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,4 +1,16 @@ 2004-02-04 multipath-016 + * add a GROUP_BY_SERIAL flag. This should be useful for + controlers that activate they spare paths on simple IO + submition with a penalty. The StorageWorks HW defaults to + this mode, even if the MULTIBUS mode is OK. + * remove unused sg_err.c + * big restructuring : split devinfo.c from main.c. Export : + * void basename (char *, char *); + * int get_serial (int, char *); + * int get_lun_strings (char *, char *, char *, char *); + * int get_evpd_wwid(char *, char *); + * long get_disk_size (char *); + * stop passing struct env as param * add devmap_name proggy for udev to name devmaps as per their internal DM name and not only by their sysfs enum name (dm-*) The corresponding udev.rules line is : diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index c039e2a19f..eeec25b893 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -18,7 +18,7 @@ CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I$(sysfsdir) -I. -OBJS = main.o +OBJS = devinfo.o main.o CRT0 = ../../klibc/klibc/crt0.o LIB = ../../klibc/klibc/libc.a LIBGCC := $(shell $(CC) -print-libgcc-file-name ) @@ -67,4 +67,4 @@ uninstall: rm $(bindir)/devmap_name # Code dependencies -main.o: main.c main.h sg_include.h +main.o: main.c main.h sg_include.h devinfo.h diff --git a/extras/multipath/devinfo.c b/extras/multipath/devinfo.c new file mode 100644 index 0000000000..a6b089f517 --- /dev/null +++ b/extras/multipath/devinfo.c @@ -0,0 +1,204 @@ +#include +#include +#include +#include +#include +#include +#include "devinfo.h" +#include "sg_include.h" + +#define FILE_NAME_SIZE 255 + +void +basename(char * str1, char * str2) +{ + char *p = str1 + (strlen(str1) - 1); + + while (*--p != '/') + continue; + strcpy(str2, ++p); +} + +static int +do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, + void *resp, int mx_resp_len, int noisy) +{ + unsigned char inqCmdBlk[INQUIRY_CMDLEN] = + { INQUIRY_CMD, 0, 0, 0, 0, 0 }; + unsigned char sense_b[SENSE_BUFF_LEN]; + struct sg_io_hdr io_hdr; + + if (cmddt) + inqCmdBlk[1] |= 2; + if (evpd) + inqCmdBlk[1] |= 1; + inqCmdBlk[2] = (unsigned char) pg_op; + inqCmdBlk[4] = (unsigned char) mx_resp_len; + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (inqCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_b); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = mx_resp_len; + io_hdr.dxferp = resp; + io_hdr.cmdp = inqCmdBlk; + io_hdr.sbp = sense_b; + io_hdr.timeout = DEF_TIMEOUT; + + if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) { + perror("SG_IO (inquiry) error"); + return -1; + } + + /* treat SG_ERR here to get rid of sg_err.[ch] */ + io_hdr.status &= 0x7e; + if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && + (0 == io_hdr.driver_status)) + return 0; + if ((SCSI_CHECK_CONDITION == io_hdr.status) || + (SCSI_COMMAND_TERMINATED == io_hdr.status) || + (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) { + if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) { + int sense_key; + unsigned char * sense_buffer = io_hdr.sbp; + if (sense_buffer[0] & 0x2) + sense_key = sense_buffer[1] & 0xf; + else + sense_key = sense_buffer[2] & 0xf; + if(RECOVERED_ERROR == sense_key) + return 0; + } + } + return -1; +} + +int +get_serial (char * str, char * devname) +{ + int fd; + int len; + char buff[MX_ALLOC_LEN + 1]; + + if ((fd = open(devname, O_RDONLY)) < 0) + return 0; + + if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { + len = buff[3]; + if (len > 0) { + memcpy(str, buff + 4, len); + buff[len] = '\0'; + } + close(fd); + return 1; + } + close(fd); + return 0; +} + +int +get_lun_strings(char * vendor_id, char * product_id, char * rev, char * devname) +{ + int fd; + char buff[36]; + char attr_path[FILE_NAME_SIZE]; + char sysfs_path[FILE_NAME_SIZE]; + char basedev[FILE_NAME_SIZE]; + + if (0 == sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { + /* sysfs style */ + basename(devname, basedev); + + sprintf(attr_path, "%s/block/%s/device/vendor", + sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, + vendor_id, 8)) return 0; + + sprintf(attr_path, "%s/block/%s/device/model", + sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, + product_id, 16)) return 0; + + sprintf(attr_path, "%s/block/%s/device/rev", + sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, + rev, 4)) return 0; + } else { + /* ioctl style */ + if ((fd = open(devname, O_RDONLY)) < 0) + return 0; + if (0 != do_inq(fd, 0, 0, 0, buff, 36, 1)) + return 0; + memcpy(vendor_id, &buff[8], 8); + memcpy(product_id, &buff[16], 16); + memcpy(rev, &buff[32], 4); + close(fd); + return 1; + } + return 0; +} + +static void +sprint_wwid(char * buff, const char * str) +{ + int i; + const char *p; + char *cursor; + unsigned char c; + + p = str; + cursor = buff; + for (i = 0; i <= WWID_SIZE / 2 - 1; i++) { + c = *p++; + sprintf(cursor, "%.2x", (int) (unsigned char) c); + cursor += 2; + } + buff[WWID_SIZE - 1] = '\0'; +} + +/* get EVPD page 0x83 off 8 */ +/* tested ok with StorageWorks */ +int +get_evpd_wwid(char * devname, char * wwid) +{ + int fd; + char buff[64]; + + if ((fd = open(devname, O_RDONLY)) < 0) + return 0; + + if (0 == do_inq(fd, 0, 1, 0x83, buff, sizeof (buff), 1)) { + sprint_wwid(wwid, &buff[8]); + close(fd); + return 1; /* success */ + } + close(fd); + return 0; /* not good */ +} + +long +get_disk_size (char * devname) { + long size; + int fd; + char attr_path[FILE_NAME_SIZE]; + char sysfs_path[FILE_NAME_SIZE]; + char buff[FILE_NAME_SIZE]; + char basedev[FILE_NAME_SIZE]; + + if (0 == sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { + basename(devname, basedev); + sprintf(attr_path, "%s/block/%s/size", + sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, buff, + FILE_NAME_SIZE * sizeof(char))) + return -1; + size = atoi(buff); + return size; + } else { + if ((fd = open(devname, O_RDONLY)) < 0) + return -1; + if(!ioctl(fd, BLKGETSIZE, &size)) + return size; + } + return -1; +} + diff --git a/extras/multipath/devinfo.h b/extras/multipath/devinfo.h new file mode 100644 index 0000000000..53f2473027 --- /dev/null +++ b/extras/multipath/devinfo.h @@ -0,0 +1,19 @@ +#define INQUIRY_CMDLEN 6 +#define INQUIRY_CMD 0x12 +#define SENSE_BUFF_LEN 32 +#define DEF_TIMEOUT 60000 +#define RECOVERED_ERROR 0x01 +#define MX_ALLOC_LEN 255 +#define WWID_SIZE 33 +#define BLKGETSIZE _IO(0x12,96) + +/* exerpt from "sg_err.h" */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SG_ERR_DRIVER_SENSE 0x08 + +void basename (char *, char *); +int get_serial (char *, char *); +int get_lun_strings (char *, char *, char *, char *); +int get_evpd_wwid(char *, char *); +long get_disk_size (char *); diff --git a/extras/multipath/main.c b/extras/multipath/main.c index d4dd89a305..6ea9a064e1 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -28,150 +28,7 @@ #include #include "libdevmapper/libdevmapper.h" #include "main.h" - -static int -do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, - void *resp, int mx_resp_len, int noisy) -{ - unsigned char inqCmdBlk[INQUIRY_CMDLEN] = - { INQUIRY_CMD, 0, 0, 0, 0, 0 }; - unsigned char sense_b[SENSE_BUFF_LEN]; - struct sg_io_hdr io_hdr; - - if (cmddt) - inqCmdBlk[1] |= 2; - if (evpd) - inqCmdBlk[1] |= 1; - inqCmdBlk[2] = (unsigned char) pg_op; - inqCmdBlk[4] = (unsigned char) mx_resp_len; - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof (inqCmdBlk); - io_hdr.mx_sb_len = sizeof (sense_b); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.dxfer_len = mx_resp_len; - io_hdr.dxferp = resp; - io_hdr.cmdp = inqCmdBlk; - io_hdr.sbp = sense_b; - io_hdr.timeout = DEF_TIMEOUT; - - if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) { - perror("SG_IO (inquiry) error"); - return -1; - } - - /* treat SG_ERR here to get rid of sg_err.[ch] */ - io_hdr.status &= 0x7e; - if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && - (0 == io_hdr.driver_status)) - return 0; - if ((SCSI_CHECK_CONDITION == io_hdr.status) || - (SCSI_COMMAND_TERMINATED == io_hdr.status) || - (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) { - if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) { - int sense_key; - unsigned char * sense_buffer = io_hdr.sbp; - if (sense_buffer[0] & 0x2) - sense_key = sense_buffer[1] & 0xf; - else - sense_key = sense_buffer[2] & 0xf; - if(RECOVERED_ERROR == sense_key) - return 0; - } - } - return -1; -} - -static void -sprint_wwid(char * buff, const char * str) -{ - int i; - const char *p; - char *cursor; - unsigned char c; - - p = str; - cursor = buff; - for (i = 0; i <= WWID_SIZE / 2 - 1; i++) { - c = *p++; - sprintf(cursor, "%.2x", (int) (unsigned char) c); - cursor += 2; - } - buff[WWID_SIZE - 1] = '\0'; -} - -static void -basename(char * str1, char * str2) -{ - char *p = str1 + (strlen(str1) - 1); - - while (*--p != '/') - continue; - strcpy(str2, ++p); -} - -static int -get_lun_strings(struct env * conf, struct path * mypath) -{ - int fd; - char buff[36]; - char attr_path[FILE_NAME_SIZE]; - char basedev[FILE_NAME_SIZE]; - - if(conf->with_sysfs) { - /* sysfs style */ - basename(mypath->sg_dev, basedev); - - sprintf(attr_path, "%s/block/%s/device/vendor", - conf->sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, - mypath->vendor_id, 8)) return 0; - - sprintf(attr_path, "%s/block/%s/device/model", - conf->sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, - mypath->product_id, 16)) return 0; - - sprintf(attr_path, "%s/block/%s/device/rev", - conf->sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, - mypath->rev, 4)) return 0; - } else { - /* ioctl style */ - if ((fd = open(mypath->sg_dev, O_RDONLY)) < 0) - return 0; - if (0 != do_inq(fd, 0, 0, 0, buff, 36, 1)) - return 0; - memcpy(mypath->vendor_id, &buff[8], 8); - memcpy(mypath->product_id, &buff[16], 16); - memcpy(mypath->rev, &buff[32], 4); - close(fd); - return 1; - } - return 0; -} - -/* hardware vendor specifics : add support for new models below */ - -/* this one get EVPD page 0x83 off 8 */ -/* tested ok with StorageWorks */ -static int -get_evpd_wwid(struct path * mypath) -{ - int fd; - char buff[64]; - - if ((fd = open(mypath->sg_dev, O_RDONLY)) < 0) - return 0; - - if (0 == do_inq(fd, 0, 1, 0x83, buff, sizeof (buff), 1)) { - sprint_wwid(mypath->wwid, &buff[8]); - close(fd); - return 1; /* success */ - } - close(fd); - return 0; /* not good */ -} +#include "devinfo.h" /* White list switch */ static int @@ -182,13 +39,13 @@ get_unique_id(struct path * mypath) char * vendor; char * product; int iopolicy; - int (*getuid) (struct path *); + int (*getuid) (char *, char *); } wlist[] = { - {"COMPAQ ", "HSV110 (C)COMPAQ", MULTIBUS, &get_evpd_wwid}, - {"COMPAQ ", "MSA1000 ", MULTIBUS, &get_evpd_wwid}, - {"COMPAQ ", "MSA1000 VOLUME ", MULTIBUS, &get_evpd_wwid}, - {"DEC ", "HSG80 ", MULTIBUS, &get_evpd_wwid}, - {"HP ", "HSV100 ", MULTIBUS, &get_evpd_wwid}, + {"COMPAQ ", "HSV110 (C)COMPAQ", GROUP_BY_SERIAL, &get_evpd_wwid}, + {"COMPAQ ", "MSA1000 ", GROUP_BY_SERIAL, &get_evpd_wwid}, + {"COMPAQ ", "MSA1000 VOLUME ", GROUP_BY_SERIAL, &get_evpd_wwid}, + {"DEC ", "HSG80 ", GROUP_BY_SERIAL, &get_evpd_wwid}, + {"HP ", "HSV100 ", GROUP_BY_SERIAL, &get_evpd_wwid}, {"HP ", "A6189A ", MULTIBUS, &get_evpd_wwid}, {"HP ", "OPEN- ", MULTIBUS, &get_evpd_wwid}, {"DDN ", "SAN DataDirector", MULTIBUS, &get_evpd_wwid}, @@ -208,7 +65,7 @@ get_unique_id(struct path * mypath) if (strncmp(mypath->vendor_id, wlist[i].vendor, 8) == 0 && strncmp(mypath->product_id, wlist[i].product, 16) == 0) { mypath->iopolicy = wlist[i].iopolicy; - if (!wlist[i].getuid(mypath)) + if (!wlist[i].getuid(mypath->sg_dev, mypath->wwid)) return 0; } } @@ -269,7 +126,11 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) basename(conf->hotplugdev, buff); sprintf(curpath.sg_dev, "/dev/%s", buff); - get_lun_strings(conf, &curpath); + get_lun_strings(curpath.vendor_id, + curpath.product_id, + curpath.rev, + curpath.sg_dev); + get_serial(curpath.serial, curpath.sg_dev); if (!get_unique_id(&curpath)) return 0; strcpy(refwwid, curpath.wwid); @@ -301,7 +162,11 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) basename(devp->path, buff); sprintf(curpath.sg_dev, "/dev/%s", buff); - get_lun_strings(conf, &curpath); + get_lun_strings(curpath.vendor_id, + curpath.product_id, + curpath.rev, + curpath.sg_dev); + get_serial(curpath.serial, curpath.sg_dev); if(!get_unique_id(&curpath)) { memset(&curpath, 0, sizeof(path)); continue; @@ -349,7 +214,11 @@ get_all_paths_nosysfs(struct env * conf, struct path * all_paths, strncat(file_name, buff, FILE_NAME_SIZE); strcpy(all_paths[k].sg_dev, file_name); - get_lun_strings(conf, &all_paths[k]); + get_lun_strings(all_paths[k].vendor_id, + all_paths[k].product_id, + all_paths[k].rev, + all_paths[k].sg_dev); + get_serial(all_paths[k].serial, all_paths[k].sg_dev); if (!get_unique_id(&all_paths[k])) continue; @@ -484,32 +353,6 @@ print_all_mp(struct path * all_paths, struct multipath * mp, int nmp) } } -static long -get_disk_size (struct env * conf, char * dev) { - long size; - int fd; - char attr_path[FILE_NAME_SIZE]; - char buff[FILE_NAME_SIZE]; - char basedev[FILE_NAME_SIZE]; - - if(conf->with_sysfs) { - basename(dev, basedev); - sprintf(attr_path, "%s/block/%s/size", - conf->sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, buff, - FILE_NAME_SIZE * sizeof(char))) - return -1; - size = atoi(buff); - return size; - } else { - if ((fd = open(dev, O_RDONLY)) < 0) - return -1; - if(!ioctl(fd, BLKGETSIZE, &size)) - return size; - } - return -1; -} - static int coalesce_paths(struct env * conf, struct multipath * mp, struct path * all_paths) @@ -528,7 +371,7 @@ coalesce_paths(struct env * conf, struct multipath * mp, if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) continue; - /* 2. mp with this uid already instanciated */ + /* 2. if mp with this uid already instanciated */ for (i = 0; i <= nmp; i++) { if (0 == strcmp(mp[i].wwid, all_paths[k].wwid)) already_done = 1; @@ -545,7 +388,7 @@ coalesce_paths(struct env * conf, struct multipath * mp, PINDEX(nmp,np) = k; if (mp[nmp].size == 0) - mp[nmp].size = get_disk_size(conf, all_paths[k].dev); + mp[nmp].size = get_disk_size(all_paths[k].dev); for (i = k + 1; i < conf->max_devs; i++) { if (0 == strcmp(all_paths[k].wwid, all_paths[i].wwid)) { @@ -558,6 +401,49 @@ coalesce_paths(struct env * conf, struct multipath * mp, return nmp; } +static void +group_by_serial(struct multipath * mp, struct path * all_paths, char * str) { + int path_count, pg_count = 0; + int i, k; + int * bitmap; + char path_buff[FILE_NAME_SIZE]; + char pg_buff[FILE_NAME_SIZE]; + char * path_buff_p = &path_buff[0]; + char * pg_buff_p = &pg_buff[0]; + + /* init the bitmap */ + bitmap = malloc((mp->npaths + 1) * sizeof(int)); + memset(bitmap, 0, (mp->npaths + 1) * sizeof(int)); + + for (i = 0; i <= mp->npaths; i++) { + if (bitmap[i]) + continue; + + /* here, we really got a new pg */ + pg_count++; + path_count = 1; + memset(&path_buff, 0, FILE_NAME_SIZE * sizeof(char)); + path_buff_p = &path_buff[0]; + + path_buff_p += sprintf(path_buff_p, " %s", all_paths[mp->pindex[i]].dev); + bitmap[i] = 1; + + for (k = i + 1; k <= mp->npaths; k++) { + if (bitmap[k]) + continue; + if (0 == strcmp(all_paths[mp->pindex[i]].serial, + all_paths[mp->pindex[k]].serial)) { + path_buff_p += sprintf(path_buff_p, " %s", all_paths[mp->pindex[k]].dev); + bitmap[k] = 1; + path_count++; + } + } + pg_buff_p += sprintf(pg_buff_p, " 1 round-robin %i 0%s", + path_count, path_buff); + } + sprintf(str, " %i%s", pg_count, pg_buff); +} + static int dm_simplecmd(int task, const char *name) { int r = 0; @@ -651,6 +537,11 @@ setup_map(struct env * conf, struct path * all_paths, } } + if (all_paths[PINDEX(index,0)].iopolicy == GROUP_BY_SERIAL && + !conf->forcedfailover ) { + group_by_serial(&mp[index], all_paths, params_p); + } + if (mp[index].size < 0) return 0; diff --git a/extras/multipath/main.h b/extras/multipath/main.h index 3941c32e7c..731c55e41f 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -28,29 +28,25 @@ #define SG_ERR_DRIVER_SENSE 0x08 /* exerpt from "scsi.h" */ -#define RECOVERED_ERROR 0x01 #define SCSI_IOCTL_GET_IDLUN 0x5382 #define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 /* global defs */ #define WWID_SIZE 33 +#define SERIAL_SIZE 14 #define MAX_DEVS 128 #define MAX_MP MAX_DEVS / 2 #define MAX_MP_PATHS MAX_DEVS / 4 #define FILE_NAME_SIZE 256 -#define INQUIRY_CMDLEN 6 -#define INQUIRY_CMD 0x12 -#define SENSE_BUFF_LEN 32 #define DEF_TIMEOUT 60000 #define EBUFF_SZ 256 #define TUR_CMD_LEN 6 -#define MX_ALLOC_LEN 255 -#define BLKGETSIZE _IO(0x12,96) #define DM_TARGET "multipath" /* Storage controlers cpabilities */ #define FAILOVER 0 #define MULTIBUS 1 +#define GROUP_BY_SERIAL 2 #define PINDEX(x,y) mp[(x)].pindex[(y)] @@ -88,6 +84,7 @@ struct path { char vendor_id[8]; char product_id[16]; char rev[4]; + char serial[SERIAL_SIZE]; int iopolicy; }; diff --git a/extras/multipath/sg_err.c b/extras/multipath/sg_err.c deleted file mode 100644 index 8a332cd8c6..0000000000 --- a/extras/multipath/sg_err.c +++ /dev/null @@ -1,1197 +0,0 @@ -#include -#include -#include -#include "sg_include.h" -#include "sg_err.h" - - -/* This file is a huge cut, paste and hack from linux/drivers/scsi/constant.c -* which I guess was written by: -* Copyright (C) 1993, 1994, 1995 Eric Youngdale - -* The rest of this is: -* Copyright (C) 1999 - 2003 D. Gilbert -* -* 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; either version 2, or (at your option) -* any later version. -* -* ASCII values for a number of symbolic constants, printing functions, etc. -* -* Some of the tables have been updated for SCSI 2. -* Additions for SCSI 3+ (SPC-3 T10/1416-D Rev 12 18 March 2003) -* -* Version 0.91 (20030529) -* sense key specific field (bytes 15-17) decoding [Trent Piepho] -*/ - -#define OUTP stderr - -static const unsigned char scsi_command_size[8] = { 6, 10, 10, 12, - 16, 12, 10, 10 }; - -#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7] - -static const char unknown[] = "UNKNOWN"; - -static const char * group_0_commands[] = { -/* 00-03 */ "Test Unit Ready", "Rezero Unit", unknown, "Request Sense", -/* 04-07 */ "Format Unit", "Read Block Limits", unknown, "Reasssign Blocks", -/* 08-0d */ "Read (6)", unknown, "Write (6)", "Seek (6)", unknown, unknown, -/* 0e-12 */ unknown, "Read Reverse", "Write Filemarks", "Space", "Inquiry", -/* 13-16 */ "Verify", "Recover Buffered Data", "Mode Select", "Reserve", -/* 17-1b */ "Release", "Copy", "Erase", "Mode Sense", "Start/Stop Unit", -/* 1c-1d */ "Receive Diagnostic", "Send Diagnostic", -/* 1e-1f */ "Prevent/Allow Medium Removal", unknown, -}; - - -static const char *group_1_commands[] = { -/* 20-23 */ unknown, unknown, unknown, "Read Format capacities", -/* 24-28 */ "Set window", "Read Capacity", - unknown, unknown, "Read (10)", -/* 29-2d */ "Read Generation", "Write (10)", "Seek (10)", "Erase", - "Read updated block", -/* 2e-31 */ "Write Verify","Verify", "Search High", "Search Equal", -/* 32-34 */ "Search Low", "Set Limits", "Prefetch or Read Position", -/* 35-37 */ "Synchronize Cache","Lock/Unlock Cache", "Read Defect Data", -/* 38-3c */ "Medium Scan", "Compare", "Copy Verify", "Write Buffer", - "Read Buffer", -/* 3d-3f */ "Update Block", "Read Long", "Write Long", -}; - -static const char *group_2_commands[] = { -/* 40-41 */ "Change Definition", "Write Same", -/* 42-48 */ "Read sub-channel", "Read TOC", "Read header", - "Play audio (10)", "Get configuration", "Play audio msf", - "Play audio track/index", -/* 49-4f */ "Play track relative (10)", "Get event status notification", - "Pause/resume", "Log Select", "Log Sense", "Stop play/scan", - unknown, -/* 50-55 */ "Xdwrite", "Xpwrite, Read disk info", "Xdread, Read track info", - "Reserve track", "Send OPC onfo", "Mode Select (10)", -/* 56-5b */ "Reserve (10)", "Release (10)", "Repair track", "Read master cue", - "Mode Sense (10)", "Close track/session", -/* 5c-5f */ "Read buffer capacity", "Send cue sheet", "Persistent reserve in", - "Persistent reserve out", -}; - -/* The following are 16 byte commands in group 4 */ -static const char *group_4_commands[] = { -/* 80-84 */ "Xdwrite (16)", "Rebuild (16)", "Regenerate (16)", "Extended copy", - "Receive copy results", -/* 85-89 */ "Memory Export In (16)", "Access control in", "Access control out", - "Read (16)", "Memory Export Out (16)", -/* 8a-8f */ "Write (16)", unknown, "Read attributes", "Write attributes", - "Write and verify (16)", "Verify (16)", -/* 90-94 */ "Pre-fetch (16)", "Synchronize cache (16)", - "Lock/unlock cache (16)", "Write same (16)", unknown, -/* 95-99 */ unknown, unknown, unknown, unknown, unknown, -/* 9a-9f */ unknown, unknown, unknown, unknown, "Service action in", - "Service action out", -}; - -/* The following are 12 byte commands in group 5 */ -static const char *group_5_commands[] = { -/* a0-a5 */ "Report luns", "Blank", "Send event", "Maintenance (in)", - "Maintenance (out)", "Move medium/play audio(12)", -/* a6-a9 */ "Exchange medium", "Move medium attached", "Read(12)", - "Play track relative(12)", -/* aa-ae */ "Write(12)", unknown, "Erase(12), Get Performance", - "Read DVD structure", "Write and verify(12)", -/* af-b1 */ "Verify(12)", "Search data high(12)", "Search data equal(12)", -/* b2-b4 */ "Search data low(12)", "Set limits(12)", - "Read element status attached", -/* b5-b6 */ "Request volume element address", "Send volume tag, set streaming", -/* b7-b9 */ "Read defect data(12)", "Read element status", "Read CD msf", -/* ba-bc */ "Redundancy group (in), Scan", - "Redundancy group (out), Set cd-rom speed", "Spare (in), Play cd", -/* bd-bf */ "Spare (out), Mechanism status", "Volume set (in), Read cd", - "Volume set (out), Send DVD structure", -}; - - -#define group(opcode) (((opcode) >> 5) & 7) - -#define RESERVED_GROUP 0 -#define VENDOR_GROUP 1 - -static const char **commands[] = { - group_0_commands, group_1_commands, group_2_commands, - (const char **) RESERVED_GROUP, group_4_commands, - group_5_commands, (const char **) VENDOR_GROUP, - (const char **) VENDOR_GROUP -}; - -static const char reserved[] = "RESERVED"; -static const char vendor[] = "VENDOR SPECIFIC"; - -static void print_opcode(int opcode) { - const char **table = commands[ group(opcode) ]; - - switch ((unsigned long) table) { - case RESERVED_GROUP: - fprintf(OUTP, "%s(0x%02x)", reserved, opcode); - break; - case VENDOR_GROUP: - fprintf(OUTP, "%s(0x%02x)", vendor, opcode); - break; - default: - fprintf(OUTP, "%s",table[opcode & 0x1f]); - break; - } -} - -void sg_print_command (const unsigned char * command) { - int k, s; - print_opcode(command[0]); - fprintf(OUTP, " ["); - for (k = 0, s = COMMAND_SIZE(command[0]); k < s; ++k) - fprintf(OUTP, "%02x ", command[k]); - fprintf(OUTP, "]\n"); -} - -void sg_print_status(int masked_status) -{ - int scsi_status = (masked_status << 1) & 0x7e; - - sg_print_scsi_status(scsi_status); -} - -void sg_print_scsi_status(int scsi_status) -{ - const char * ccp; - - scsi_status &= 0x7e; /* sanitize as much as possible */ - switch (scsi_status) { - case 0: ccp = "Good"; break; - case 0x2: ccp = "Check Condition"; break; - case 0x4: ccp = "Condition Met"; break; - case 0x8: ccp = "Busy"; break; - case 0x10: ccp = "Intermediate"; break; - case 0x14: ccp = "Intermediate-Condition Met"; break; - case 0x18: ccp = "Reservation Conflict"; break; - case 0x22: ccp = "Command Terminated (obsolete)"; break; - case 0x28: ccp = "Task set Full"; break; - case 0x30: ccp = "ACA Active"; break; - case 0x40: ccp = "Task Aborted"; break; - default: ccp = "Unknown status"; break; - } - fprintf(OUTP, "%s ", ccp); -} - -/* In brackets is the related SCSI document (see www.t10.org) with the */ -/* peripheral device type after the colon */ -/* No programmatic use is made of these flags currently */ -#define D 0x0001 /* DIRECT ACCESS DEVICE (disk) [SBC-2: 0] */ -#define T 0x0002 /* SEQUENTIAL ACCESS DEVICE (tape) [SSC: 1] */ -#define L 0x0004 /* PRINTER DEVICE [SSC: 2] */ -#define P 0x0008 /* PROCESSOR DEVICE [SPC-2: 3] */ -#define W 0x0010 /* WRITE ONCE READ MULTIPLE DEVICE [SBC-2: 4] */ -#define R 0x0020 /* CD/DVD DEVICE [MMC-2: 5] */ -#define S 0x0040 /* SCANNER DEVICE [SCSI-2 (obsolete): 6] */ -#define O 0x0080 /* OPTICAL MEMORY DEVICE [SBC-2: 7] */ -#define M 0x0100 /* MEDIA CHANGER DEVICE [SMC-2: 8] */ -#define C 0x0200 /* COMMUNICATION DEVICE [SCSI-2 (obsolete): 9] */ -#define A 0x0400 /* ARRAY STORAGE [SCC-2: 12] */ -#define E 0x0800 /* ENCLOSURE SERVICES DEVICE [SES: 13] */ -#define B 0x1000 /* SIMPLIFIED DIRECT ACCESS DEVICE [RBC: 14] */ -#define K 0x2000 /* OPTICAL CARD READER/WRITER DEVICE [OCRW: 15] */ - -#define SC_ALL_DEVS ( D|T|L|P|W|R|S|O|M|C|A|E|B|K ) - -/* oft used strings are encoded using ASCII codes 0x1 to 0x1f . */ -/* This is to save space. This encoding should be UTF-8 and */ -/* UTF-16 friendly. */ -#define SC_AUDIO_PLAY_OPERATION "\x1" -#define SC_LOGICAL_UNIT "\x2" -#define SC_NOT_READY "\x3" -#define SC_OPERATION "\x4" -#define SC_IN_PROGRESS "\x5" -#define SC_HARDWARE_IF "\x6" -#define SC_CONTROLLER_IF "\x7" -#define SC_DATA_CHANNEL_IF "\x8" -#define SC_SERVO_IF "\x9" -#define SC_SPINDLE_IF "\xa" -#define SC_FIRMWARE_IF "\xb" -#define SC_RECOVERED_DATA "\xc" -#define SC_ERROR_RATE_TOO_HIGH "\xd" -#define SC_TIMES_TOO_HIGH "\xe" - - -struct error_info{ - unsigned char code1, code2; - unsigned short int devices; - const char * text; -}; - -struct error_info2{ - unsigned char code1, code2_min, code2_max; - unsigned short int devices; - const char * text; -}; - -static struct error_info2 additional2[] = -{ - {0x40,0x00,0x7f,D,"Ram failure (%x)"}, - {0x40,0x80,0xff,D|T|L|P|W|R|S|O|M|C,"Diagnostic failure on component (%x)"}, - {0x41,0x00,0xff,D,"Data path failure (%x)"}, - {0x42,0x00,0xff,D,"Power-on or self-test failure (%x)"}, - {0, 0, 0, 0, NULL} -}; - -static struct error_info additional[] = -{ - {0x00,0x00,SC_ALL_DEVS,"No additional sense information"}, - {0x00,0x01,T,"Filemark detected"}, - {0x00,0x02,T|S,"End-of-partition/medium detected"}, - {0x00,0x03,T,"Setmark detected"}, - {0x00,0x04,T|S,"Beginning-of-partition/medium detected"}, - {0x00,0x05,T|L|S,"End-of-data detected"}, - {0x00,0x06,SC_ALL_DEVS,"I/O process terminated"}, - {0x00,0x11,R,SC_AUDIO_PLAY_OPERATION SC_IN_PROGRESS}, - {0x00,0x12,R,SC_AUDIO_PLAY_OPERATION "paused"}, - {0x00,0x13,R,SC_AUDIO_PLAY_OPERATION "successfully completed"}, - {0x00,0x14,R,SC_AUDIO_PLAY_OPERATION "stopped due to error"}, - {0x00,0x15,R,"No current audio status to return"}, - {0x00,0x16,SC_ALL_DEVS,SC_OPERATION SC_IN_PROGRESS}, - {0x00,0x17,D|T|L|W|R|S|O|M|A|E|B|K,"Cleaning requested"}, - {0x00,0x18,T,"Erase" SC_OPERATION SC_IN_PROGRESS}, - {0x00,0x19,T,"Locate" SC_OPERATION SC_IN_PROGRESS}, - {0x00,0x1a,T,"Rewind" SC_OPERATION SC_IN_PROGRESS}, - {0x00,0x1b,T,"Set capacity" SC_OPERATION SC_IN_PROGRESS}, - {0x00,0x1c,T,"Verify" SC_OPERATION SC_IN_PROGRESS}, - {0x01,0x00,D|W|O|B|K,"No index/sector signal"}, - {0x02,0x00,D|W|R|O|M|B|K,"No seek complete"}, - {0x03,0x00,D|T|L|W|S|O|B|K,"Peripheral device write fault"}, - {0x03,0x01,T,"No write current"}, - {0x03,0x02,T,"Excessive write errors"}, - {0x04,0x00,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY "cause not reportable"}, - {0x04,0x01,SC_ALL_DEVS,SC_LOGICAL_UNIT "is" SC_IN_PROGRESS - "of becoming ready"}, - {0x04,0x02,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY - "initializing cmd. required"}, - {0x04,0x03,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY - "manual intervention required"}, - {0x04,0x04,D|T|L|R|O|B,SC_LOGICAL_UNIT SC_NOT_READY "format" SC_IN_PROGRESS}, - {0x04,0x05,D|T|W|O|M|C|A|B|K,SC_LOGICAL_UNIT SC_NOT_READY - "rebuild" SC_IN_PROGRESS}, - {0x04,0x06,D|T|W|O|M|C|A|B|K,SC_LOGICAL_UNIT SC_NOT_READY - "recalculation" SC_IN_PROGRESS}, - {0x04,0x07,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY - SC_OPERATION SC_IN_PROGRESS}, - {0x04,0x08,R,SC_LOGICAL_UNIT SC_NOT_READY "long write" SC_IN_PROGRESS}, - {0x04,0x09,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY "self-test" - SC_IN_PROGRESS}, - {0x04,0x0a,SC_ALL_DEVS,SC_LOGICAL_UNIT - "not accessible, asymmetric access state transition"}, - {0x04,0x0b,SC_ALL_DEVS,SC_LOGICAL_UNIT - "not accessible, target port in standby state"}, - {0x04,0x0c,SC_ALL_DEVS,SC_LOGICAL_UNIT - "not accessible, target port in unavailable state"}, - {0x04,0x10,SC_ALL_DEVS,SC_LOGICAL_UNIT SC_NOT_READY - "auxiliary memory not accessible"}, - {0x05,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,SC_LOGICAL_UNIT - "does not respond to selection"}, - {0x06,0x00,D|W|R|O|M|B|K,"No reference position found"}, - {0x07,0x00,D|T|L|W|R|S|O|M|B|K,"Multiple peripheral devices selected"}, - {0x08,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,SC_LOGICAL_UNIT "communication failure"}, - {0x08,0x01,D|T|L|W|R|S|O|M|C|A|E|B|K,SC_LOGICAL_UNIT - "communication time-out"}, - {0x08,0x02,D|T|L|W|R|S|O|M|C|A|E|B|K,SC_LOGICAL_UNIT - "communication parity error"}, - {0x08,0x03,D|T|R|O|M|B|K,SC_LOGICAL_UNIT - "communication CRC error (Ultra-DMA/32)"}, - {0x08,0x04,D|T|L|P|W|R|S|O|C|K,"Unreachable copy target"}, - {0x09,0x00,D|T|W|R|O|B,"Track following error"}, - {0x09,0x01,W|R|O|K,"Tracking servo failure"}, - {0x09,0x02,W|R|O|K,"Focus servo failure"}, - {0x09,0x03,W|R|O,"Spindle servo failure"}, - {0x09,0x04,D|T|W|R|O|B,"Head select fault"}, - {0x0A,0x00,SC_ALL_DEVS,"Error log overflow"}, - {0x0B,0x00,SC_ALL_DEVS,"Warning"}, - {0x0B,0x01,SC_ALL_DEVS,"Warning - specified temperature exceeded"}, - {0x0B,0x02,SC_ALL_DEVS,"Warning - enclosure degraded"}, - {0x0C,0x00,T|R|S,"Write error"}, - {0x0C,0x01,K,"Write error - recovered with auto reallocation"}, - {0x0C,0x02,D|W|O|B|K,"Write error - auto reallocation failed"}, - {0x0C,0x03,D|W|O|B|K,"Write error - recommend reassignment"}, - {0x0C,0x04,D|T|W|O|B,"Compression check miscompare error"}, - {0x0C,0x05,D|T|W|O|B,"Data expansion occurred during compression"}, - {0x0C,0x06,D|T|W|O|B,"Block not compressible"}, - {0x0C,0x07,R,"Write error - recovery needed"}, - {0x0C,0x08,R,"Write error - recovery failed"}, - {0x0C,0x09,R,"Write error - loss of streaming"}, - {0x0C,0x0A,R,"Write error - padding blocks added"}, - {0x0C,0x0B,D|T|W|R|O|M|B,"Auxiliary memory write error"}, - {0x0C,0x0C,SC_ALL_DEVS,"Write error - unexpected unsolicited data"}, - {0x0C,0x0D,SC_ALL_DEVS,"Write error - not enough unsolicited data"}, - {0x0D,0x00,D|T|L|P|W|R|S|O|C|A|K, - "Error detected by third party temporary initiator"}, - {0x0D,0x01,D|T|L|P|W|R|S|O|C|A|K, "Third party device failure"}, - {0x0D,0x02,D|T|L|P|W|R|S|O|C|A|K, "Copy target device not reachable"}, - {0x0D,0x03,D|T|L|P|W|R|S|O|C|A|K, "Incorrect copy target device"}, - {0x0D,0x04,D|T|L|P|W|R|S|O|C|A|K, "Copy target device underrun"}, - {0x0D,0x05,D|T|L|P|W|R|S|O|C|A|K, "Copy target device overrun"}, - {0x10,0x00,D|W|O|B|K,"Id CRC or ECC error"}, - {0x11,0x00,D|T|W|R|S|O|B|K,"Unrecovered read error"}, - {0x11,0x01,D|T|W|R|S|O|B|K,"Read retries exhausted"}, - {0x11,0x02,D|T|W|R|S|O|B|K,"Error too long to correct"}, - {0x11,0x03,D|T|W|S|O|B|K,"Multiple read errors"}, - {0x11,0x04,D|W|O|B|K,"Unrecovered read error - auto reallocate failed"}, - {0x11,0x05,W|R|O|B,"L-EC uncorrectable error"}, - {0x11,0x06,W|R|O|B,"CIRC unrecovered error"}, - {0x11,0x07,W|O|B,"Data re-synchronization error"}, - {0x11,0x08,T,"Incomplete block read"}, - {0x11,0x09,T,"No gap found"}, - {0x11,0x0A,D|T|O|B|K,"Miscorrected error"}, - {0x11,0x0B,D|W|O|B|K,"Unrecovered read error - recommend reassignment"}, - {0x11,0x0C,D|W|O|B|K,"Unrecovered read error - recommend rewrite the data"}, - {0x11,0x0D,D|T|W|R|O|B,"De-compression CRC error"}, - {0x11,0x0E,D|T|W|R|O|B,"Cannot decompress using declared algorithm"}, - {0x11,0x0F,R,"Error reading UPC/EAN number"}, - {0x11,0x10,R,"Error reading ISRC number"}, - {0x11,0x11,R,"Read error - loss of streaming"}, - {0x11,0x12,D|T|W|R|O|M|B,"Auxiliary memory read error"}, - {0x11,0x13,SC_ALL_DEVS,"Read error - failed retransmission request"}, - {0x12,0x00,D|W|O|B|K,"Address mark not found for id field"}, - {0x13,0x00,D|W|O|B|K,"Address mark not found for data field"}, - {0x14,0x00,D|T|L|W|R|S|O|B|K,"Recorded entity not found"}, - {0x14,0x01,D|T|W|R|O|B|K,"Record not found"}, - {0x14,0x02,T,"Filemark or setmark not found"}, - {0x14,0x03,T,"End-of-data not found"}, - {0x14,0x04,T,"Block sequence error"}, - {0x14,0x05,D|T|W|O|B|K,"Record not found - recommend reassignment"}, - {0x14,0x06,D|T|W|O|B|K,"Record not found - data auto-reallocated"}, - {0x14,0x07,T,"Locate" SC_OPERATION " failure"}, - {0x15,0x00,D|T|L|W|R|S|O|M|B|K,"Random positioning error"}, - {0x15,0x01,D|T|L|W|R|S|O|M|B|K,"Mechanical positioning error"}, - {0x15,0x02,D|T|W|R|O|B|K,"Positioning error detected by read of medium"}, - {0x16,0x00,D|W|O|B|K,"Data synchronization mark error"}, - {0x16,0x01,D|W|O|B|K,"Data sync error - data rewritten"}, - {0x16,0x02,D|W|O|B|K,"Data sync error - recommend rewrite"}, - {0x16,0x03,D|W|O|B|K,"Data sync error - data auto-reallocated"}, - {0x16,0x04,D|W|O|B|K,"Data sync error - recommend reassignment"}, - {0x17,0x00,D|T|W|R|S|O|B|K,SC_RECOVERED_DATA - "with no error correction applied"}, - {0x17,0x01,D|T|W|R|S|O|B|K,SC_RECOVERED_DATA "with retries"}, - {0x17,0x02,D|T|W|R|O|B|K,SC_RECOVERED_DATA "with positive head offset"}, - {0x17,0x03,D|T|W|R|O|B|K,SC_RECOVERED_DATA "with negative head offset"}, - {0x17,0x04,W|R|O|B,SC_RECOVERED_DATA "with retries and/or circ applied"}, - {0x17,0x05,D|W|R|O|B|K,SC_RECOVERED_DATA "using previous sector id"}, - {0x17,0x06,D|W|O|B|K,SC_RECOVERED_DATA "without ecc - data auto-reallocated"}, - {0x17,0x07,D|W|R|O|B|K,SC_RECOVERED_DATA - "without ecc - recommend reassignment"}, - {0x17,0x08,D|W|R|O|B|K,SC_RECOVERED_DATA "without ecc - recommend rewrite"}, - {0x17,0x09,D|W|R|O|B|K,SC_RECOVERED_DATA "without ecc - data rewritten"}, - {0x18,0x00,D|T|W|R|O|B|K,SC_RECOVERED_DATA "with error correction applied"}, - {0x18,0x01,D|W|R|O|B|K,SC_RECOVERED_DATA - "with error corr. & retries applied"}, - {0x18,0x02,D|W|R|O|B|K,SC_RECOVERED_DATA "- data auto-reallocated"}, - {0x18,0x03,R,SC_RECOVERED_DATA "with CIRC"}, - {0x18,0x04,R,SC_RECOVERED_DATA "with L-EC"}, - {0x18,0x05,D|W|R|O|B|K,SC_RECOVERED_DATA "- recommend reassignment"}, - {0x18,0x06,D|W|R|O|B|K,SC_RECOVERED_DATA "- recommend rewrite"}, - {0x18,0x07,D|W|O|B|K,SC_RECOVERED_DATA "with ecc - data rewritten"}, - {0x18,0x08,R,SC_RECOVERED_DATA "with linking"}, - {0x19,0x00,D|O|K,"Defect list error"}, - {0x19,0x01,D|O|K,"Defect list not available"}, - {0x19,0x02,D|O|K,"Defect list error in primary list"}, - {0x19,0x03,D|O|K,"Defect list error in grown list"}, - {0x1A,0x00,SC_ALL_DEVS,"Parameter list length error"}, - {0x1B,0x00,SC_ALL_DEVS,"Synchronous data transfer error"}, - {0x1C,0x00,D|O|B|K,"Defect list not found"}, - {0x1C,0x01,D|O|B|K,"Primary defect list not found"}, - {0x1C,0x02,D|O|B|K,"Grown defect list not found"}, - {0x1D,0x00,D|T|W|R|O|B|K,"Miscompare during verify" SC_OPERATION}, - {0x1E,0x00,D|W|O|B|K,"Recovered id with ecc correction"}, - {0x1F,0x00,D|O|K,"Partial defect list transfer"}, - {0x20,0x00,SC_ALL_DEVS,"Invalid command" SC_OPERATION " code"}, - {0x20,0x01,D|T|P|W|R|O|M|A|E|B|K, - "Access denied - initiator pending-enrolled"}, - {0x20,0x02,D|T|P|W|R|O|M|A|E|B|K,"Access denied - no access rights"}, - {0x20,0x03,D|T|P|W|R|O|M|A|E|B|K,"Access denied - no mgmt id key"}, - {0x20,0x04,T,"Illegal command while in write capable state"}, - {0x20,0x05,T,"Obsolete"}, - {0x20,0x06,T,"Illegal command while in explicit address mode"}, - {0x20,0x07,T,"Illegal command while in implicit address mode"}, - {0x20,0x08,D|T|P|W|R|O|M|A|E|B|K,"Access denied - enrollment conflict"}, - {0x20,0x09,D|T|P|W|R|O|M|A|E|B|K,"Access denied - invalid LU identifier"}, - {0x20,0x0A,D|T|P|W|R|O|M|A|E|B|K,"Access denied - invalid proxy token"}, - {0x20,0x0B,D|T|P|W|R|O|M|A|E|B|K,"Access denied - ACL LUN conflict"}, - {0x21,0x00,D|T|W|R|O|M|B|K,"Logical block address out of range"}, - {0x21,0x01,D|T|W|R|O|M|B|K,"Invalid element address"}, - {0x21,0x02,R,"Invalid address for write"}, - {0x22,0x00,D,"Illegal function (use 20 00,24 00,or 26 00)"}, - {0x24,0x00,SC_ALL_DEVS,"Invalid field in cdb"}, - {0x24,0x01,SC_ALL_DEVS,"CDB decryption error"}, - {0x25,0x00,SC_ALL_DEVS,SC_LOGICAL_UNIT "not supported"}, - {0x26,0x00,SC_ALL_DEVS,"Invalid field in parameter list"}, - {0x26,0x01,SC_ALL_DEVS,"Parameter not supported"}, - {0x26,0x02,SC_ALL_DEVS,"Parameter value invalid"}, - {0x26,0x03,D|T|L|P|W|R|S|O|M|C|A|E|K,"Threshold parameters not supported"}, - {0x26,0x04,SC_ALL_DEVS,"Invalid release of persistent reservation"}, - {0x26,0x05,D|T|L|P|W|R|S|O|M|C|A|B|K,"Data decryption error"}, - {0x26,0x06,D|T|L|P|W|R|S|O|C|K,"Too many target descriptors"}, - {0x26,0x07,D|T|L|P|W|R|S|O|C|K,"Unsupported target descriptor type code"}, - {0x26,0x08,D|T|L|P|W|R|S|O|C|K,"Too many segment descriptors"}, - {0x26,0x09,D|T|L|P|W|R|S|O|C|K,"Unsupported segment descriptor type code"}, - {0x26,0x0A,D|T|L|P|W|R|S|O|C|K,"Unexpected inexact segment"}, - {0x26,0x0B,D|T|L|P|W|R|S|O|C|K,"Inline data length exceeded"}, - {0x26,0x0C,D|T|L|P|W|R|S|O|C|K, - "Invalid" SC_OPERATION " for copy source or destination"}, - {0x26,0x0D,D|T|L|P|W|R|S|O|C|K,"Copy segment granularity violation"}, - {0x27,0x00,D|T|W|R|O|B|K,"Write protected"}, - {0x27,0x01,D|T|W|R|O|B|K,"Hardware write protected"}, - {0x27,0x02,D|T|W|R|O|B|K,SC_LOGICAL_UNIT "software write protected"}, - {0x27,0x03,T|R,"Associated write protect"}, - {0x27,0x04,T|R,"Persistent write protect"}, - {0x27,0x05,T|R,"Permanent write protect"}, - {0x27,0x06,R,"Conditional write protect"}, - {0x28,0x00,SC_ALL_DEVS,"Not ready to ready change, medium may have changed"}, - {0x28,0x01,D|T|W|R|O|M|B,"Import or export element accessed"}, - {0x29,0x00,SC_ALL_DEVS,"Power on, reset, or bus device reset occurred"}, - {0x29,0x01,SC_ALL_DEVS,"Power on occurred"}, - {0x29,0x02,SC_ALL_DEVS,"Scsi bus reset occurred"}, - {0x29,0x03,SC_ALL_DEVS,"Bus device reset function occurred"}, - {0x29,0x04,SC_ALL_DEVS,"Device internal reset"}, - {0x29,0x05,SC_ALL_DEVS,"Transceiver mode changed to single-ended"}, - {0x29,0x06,SC_ALL_DEVS,"Transceiver mode changed to lvd"}, - {0x29,0x07,SC_ALL_DEVS,"I_T nexus loss occurred"}, - {0x2A,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,"Parameters changed"}, - {0x2A,0x01,D|T|L|W|R|S|O|M|C|A|E|B|K,"Mode parameters changed"}, - {0x2A,0x02,D|T|L|W|R|S|O|M|C|A|E|K,"Log parameters changed"}, - {0x2A,0x03,D|T|L|P|W|R|S|O|M|C|A|E|K,"Reservations preempted"}, - {0x2A,0x04,D|T|L|P|W|R|S|O|M|C|A|E,"Reservations released"}, - {0x2A,0x05,D|T|L|P|W|R|S|O|M|C|A|E,"Registrations preempted"}, - {0x2A,0x06,SC_ALL_DEVS,"Asymmetric access state changed"}, - {0x2A,0x07,SC_ALL_DEVS,"Implicit asymmetric access state transition failed"}, - {0x2B,0x00,D|T|L|P|W|R|S|O|C|K, - "Copy cannot execute since host cannot disconnect"}, - {0x2C,0x00,SC_ALL_DEVS,"Command sequence error"}, - {0x2C,0x01,S,"Too many windows specified"}, - {0x2C,0x02,S,"Invalid combination of windows specified"}, - {0x2C,0x03,R,"Current program area is not empty"}, - {0x2C,0x04,R,"Current program area is empty"}, - {0x2C,0x05,B,"Illegal power condition request"}, - {0x2C,0x06,R,"Persistent prevent conflict"}, - {0x2C,0x07,SC_ALL_DEVS,"Previous busy status"}, - {0x2C,0x08,SC_ALL_DEVS,"Previous task set full status"}, - {0x2C,0x09,D|T|L|P|W|R|S|O|M|E|B|K,"Previous reservation conflict status"}, - {0x2D,0x00,T,"Overwrite error on update in place"}, - {0x2F,0x00,SC_ALL_DEVS,"Commands cleared by another initiator"}, - {0x30,0x00,D|T|W|R|O|M|B|K,"Incompatible medium installed"}, - {0x30,0x01,D|T|W|R|O|B|K,"Cannot read medium - unknown format"}, - {0x30,0x02,D|T|W|R|O|B|K,"Cannot read medium - incompatible format"}, - {0x30,0x03,D|T|R|K,"Cleaning cartridge installed"}, - {0x30,0x04,D|T|W|R|O|B|K,"Cannot write medium - unknown format"}, - {0x30,0x05,D|T|W|R|O|B|K,"Cannot write medium - incompatible format"}, - {0x30,0x06,D|T|W|R|O|B,"Cannot format medium - incompatible medium"}, - {0x30,0x07,D|T|L|W|R|S|O|M|A|E|B|K,"Cleaning failure"}, - {0x30,0x08,R,"Cannot write - application code mismatch"}, - {0x30,0x09,R,"Current session not fixated for append"}, - {0x30,0x10,R,"Medium not formatted"}, /* should ascq be 0xa ?? */ - {0x31,0x00,D|T|W|R|O|B|K,"Medium format corrupted"}, - {0x31,0x01,D|L|R|O|B,"Format command failed"}, - {0x31,0x02,R,"Zoned formatting failed due to spare linking"}, - {0x32,0x00,D|W|O|B|K,"No defect spare location available"}, - {0x32,0x01,D|W|O|B|K,"Defect list update failure"}, - {0x33,0x00,T,"Tape length error"}, - {0x34,0x00,SC_ALL_DEVS,"Enclosure failure"}, - {0x35,0x00,SC_ALL_DEVS,"Enclosure services failure"}, - {0x35,0x01,SC_ALL_DEVS,"Unsupported enclosure function"}, - {0x35,0x02,SC_ALL_DEVS,"Enclosure services unavailable"}, - {0x35,0x03,SC_ALL_DEVS,"Enclosure services transfer failure"}, - {0x35,0x04,SC_ALL_DEVS,"Enclosure services transfer refused"}, - {0x36,0x00,L,"Ribbon,ink,or toner failure"}, - {0x37,0x00,D|T|L|W|R|S|O|M|C|A|E|B|K,"Rounded parameter"}, - {0x38,0x00,B,"Event status notification"}, - {0x38,0x02,B,"Esn - power management class event"}, - {0x38,0x04,B,"Esn - media class event"}, - {0x38,0x06,B,"Esn - device busy class event"}, - {0x39,0x00,D|T|L|W|R|S|O|M|C|A|E|K,"Saving parameters not supported"}, - {0x3A,0x00,D|T|L|W|R|S|O|M|B|K,"Medium not present"}, - {0x3A,0x01,D|T|W|R|O|M|B|K,"Medium not present - tray closed"}, - {0x3A,0x02,D|T|W|R|O|M|B|K,"Medium not present - tray open"}, - {0x3A,0x03,D|T|W|R|O|M|B,"Medium not present - loadable"}, - {0x3A,0x04,D|T|W|R|O|M|B, - "Medium not present - medium auxiliary memory accessible"}, - {0x3B,0x00,T|L,"Sequential positioning error"}, - {0x3B,0x01,T,"Tape position error at beginning-of-medium"}, - {0x3B,0x02,T,"Tape position error at end-of-medium"}, - {0x3B,0x03,L,"Tape or electronic vertical forms unit " SC_NOT_READY}, - {0x3B,0x04,L,"Slew failure"}, - {0x3B,0x05,L,"Paper jam"}, - {0x3B,0x06,L,"Failed to sense top-of-form"}, - {0x3B,0x07,L,"Failed to sense bottom-of-form"}, - {0x3B,0x08,T,"Reposition error"}, - {0x3B,0x09,S,"Read past end of medium"}, - {0x3B,0x0A,S,"Read past beginning of medium"}, - {0x3B,0x0B,S,"Position past end of medium"}, - {0x3B,0x0C,T|S,"Position past beginning of medium"}, - {0x3B,0x0D,D|T|W|R|O|M|B|K,"Medium destination element full"}, - {0x3B,0x0E,D|T|W|R|O|M|B|K,"Medium source element empty"}, - {0x3B,0x0F,R,"End of medium reached"}, - {0x3B,0x11,D|T|W|R|O|M|B|K,"Medium magazine not accessible"}, - {0x3B,0x12,D|T|W|R|O|M|B|K,"Medium magazine removed"}, - {0x3B,0x13,D|T|W|R|O|M|B|K,"Medium magazine inserted"}, - {0x3B,0x14,D|T|W|R|O|M|B|K,"Medium magazine locked"}, - {0x3B,0x15,D|T|W|R|O|M|B|K,"Medium magazine unlocked"}, - {0x3B,0x16,R,"Mechanical positioning or changer error"}, - {0x3D,0x00,D|T|L|P|W|R|S|O|M|C|A|E|K,"Invalid bits in identify message"}, - {0x3E,0x00,SC_ALL_DEVS,SC_LOGICAL_UNIT "has not self-configured yet"}, - {0x3E,0x01,SC_ALL_DEVS,SC_LOGICAL_UNIT "failure"}, - {0x3E,0x02,SC_ALL_DEVS,"Timeout on logical unit"}, - {0x3E,0x03,SC_ALL_DEVS,SC_LOGICAL_UNIT "failed self-test"}, - {0x3E,0x04,SC_ALL_DEVS,SC_LOGICAL_UNIT "unable to update self-test log"}, - {0x3F,0x00,SC_ALL_DEVS,"Target operating conditions have changed"}, - {0x3F,0x01,SC_ALL_DEVS,"Microcode has been changed"}, - {0x3F,0x02,D|T|L|P|W|R|S|O|M|C|B|K,"Changed operating definition"}, - {0x3F,0x03,SC_ALL_DEVS,"Inquiry data has changed"}, - {0x3F,0x04,D|T|W|R|O|M|C|A|E|B|K,"Component device attached"}, - {0x3F,0x05,D|T|W|R|O|M|C|A|E|B|K,"Device identifier changed"}, - {0x3F,0x06,D|T|W|R|O|M|C|A|E|B,"Redundancy group created or modified"}, - {0x3F,0x07,D|T|W|R|O|M|C|A|E|B,"Redundancy group deleted"}, - {0x3F,0x08,D|T|W|R|O|M|C|A|E|B,"Spare created or modified"}, - {0x3F,0x09,D|T|W|R|O|M|C|A|E|B,"Spare deleted"}, - {0x3F,0x0A,D|T|W|R|O|M|C|A|E|B|K,"Volume set created or modified"}, - {0x3F,0x0B,D|T|W|R|O|M|C|A|E|B|K,"Volume set deleted"}, - {0x3F,0x0C,D|T|W|R|O|M|C|A|E|B|K,"Volume set deassigned"}, - {0x3F,0x0D,D|T|W|R|O|M|C|A|E|B|K,"Volume set reassigned"}, - {0x3F,0x0E,D|T|L|P|W|R|S|O|M|C|A|E,"Reported luns data has changed"}, - {0x3F,0x10,D|T|W|R|O|M|B,"Medium loadable"}, - {0x3F,0x11,D|T|W|R|O|M|B,"Medium auxiliary memory accessible"}, - {0x40,0x00,D,"Ram failure (should use 40 nn)"}, - /* - * FIXME(eric) - need a way to represent wildcards here. - */ - {0x40,0x00,SC_ALL_DEVS,"Diagnostic failure on component nn (80h-ffh)"}, - {0x41,0x00,D,"Data path failure (should use 40 nn)"}, - {0x42,0x00,D,"Power-on or self-test failure (should use 40 nn)"}, - {0x43,0x00,SC_ALL_DEVS,"Message error"}, - {0x44,0x00,SC_ALL_DEVS,"Internal target failure"}, - {0x45,0x00,SC_ALL_DEVS,"Select or reselect failure"}, - {0x46,0x00,D|T|L|P|W|R|S|O|M|C|B|K,"Unsuccessful soft reset"}, - {0x47,0x00,SC_ALL_DEVS,"Scsi parity error"}, - {0x47,0x01,SC_ALL_DEVS,"Data phase CRC error detected"}, - {0x47,0x02,SC_ALL_DEVS,"Scsi parity error detected during st data phase"}, - {0x47,0x03,SC_ALL_DEVS,"Information unit CRC error detected"}, - {0x47,0x04,SC_ALL_DEVS,"Asynchronous information protection error detected"}, - {0x47,0x05,SC_ALL_DEVS,"Protocol service CRC error"}, - {0x48,0x00,SC_ALL_DEVS,"Initiator detected error message received"}, - {0x49,0x00,SC_ALL_DEVS,"Invalid message error"}, - {0x4A,0x00,SC_ALL_DEVS,"Command phase error"}, - {0x4B,0x00,SC_ALL_DEVS,"Data phase error"}, - {0x4C,0x00,SC_ALL_DEVS,SC_LOGICAL_UNIT "failed self-configuration"}, - /* - * FIXME(eric) - need a way to represent wildcards here. - */ - {0x4D,0x00,SC_ALL_DEVS,"Tagged overlapped commands (nn = queue tag)"}, - {0x4E,0x00,SC_ALL_DEVS,"Overlapped commands attempted"}, - {0x50,0x00,T,"Write append error"}, - {0x50,0x01,T,"Write append position error"}, - {0x50,0x02,T,"Position error related to timing"}, - {0x51,0x00,T|R|O,"Erase failure"}, - {0x52,0x00,T,"Cartridge fault"}, - {0x53,0x00,D|T|L|W|R|S|O|M|B|K,"Media load or eject failed"}, - {0x53,0x01,T,"Unload tape failure"}, - {0x53,0x02,D|T|W|R|O|M|B|K,"Medium removal prevented"}, - {0x54,0x00,P,"Scsi to host system interface failure"}, - {0x55,0x00,P,"System resource failure"}, - {0x55,0x01,D|O|B|K,"System buffer full"}, - {0x55,0x02,D|T|L|P|W|R|S|O|M|A|E|K,"Insufficient reservation resources"}, - {0x55,0x03,D|T|L|P|W|R|S|O|M|C|A|E,"Insufficient resources"}, - {0x55,0x04,D|T|L|P|W|R|S|O|M|A|E,"Insufficient registration resources"}, - {0x55,0x05,D|T|P|W|R|O|M|A|E|B|K,"Insufficient access control resources"}, - {0x55,0x06,D|T|W|R|O|M|B,"Auxiliary memory out of space"}, - {0x57,0x00,R,"Unable to recover table-of-contents"}, - {0x58,0x00,O,"Generation does not exist"}, - {0x59,0x00,O,"Updated block read"}, - {0x5A,0x00,D|T|L|P|W|R|S|O|M|B|K,"Operator request or state change input"}, - {0x5A,0x01,D|T|W|R|O|M|B|K,"Operator medium removal request"}, - {0x5A,0x02,D|T|W|R|O|A|B|K,"Operator selected write protect"}, - {0x5A,0x03,D|T|W|R|O|A|B|K,"Operator selected write permit"}, - {0x5B,0x00,D|T|L|P|W|R|S|O|M|K,"Log exception"}, - {0x5B,0x01,D|T|L|P|W|R|S|O|M|K,"Threshold condition met"}, - {0x5B,0x02,D|T|L|P|W|R|S|O|M|K,"Log counter at maximum"}, - {0x5B,0x03,D|T|L|P|W|R|S|O|M|K,"Log list codes exhausted"}, - {0x5C,0x00,D|O,"Rpl status change"}, - {0x5C,0x01,D|O,"Spindles synchronized"}, - {0x5C,0x02,D|O,"Spindles not synchronized"}, - {0x5D,0x00,SC_ALL_DEVS,"Failure prediction threshold exceeded"}, - {0x5D,0x01,R|B,"Media failure prediction threshold exceeded"}, - {0x5D,0x02,R,SC_LOGICAL_UNIT "failure prediction threshold exceeded"}, - {0x5D,0x03,R,"spare area exhaustion prediction threshold exceeded"}, - /* large series of "impending failure" messages */ - {0x5D,0x10,D|B,SC_HARDWARE_IF "general hard drive failure"}, - {0x5D,0x11,D|B,SC_HARDWARE_IF "drive" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x12,D|B,SC_HARDWARE_IF "data" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x13,D|B,SC_HARDWARE_IF "seek" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x14,D|B,SC_HARDWARE_IF "too many block reassigns"}, - {0x5D,0x15,D|B,SC_HARDWARE_IF "access" SC_TIMES_TOO_HIGH }, - {0x5D,0x16,D|B,SC_HARDWARE_IF "start unit" SC_TIMES_TOO_HIGH }, - {0x5D,0x17,D|B,SC_HARDWARE_IF "channel parametrics"}, - {0x5D,0x18,D|B,SC_HARDWARE_IF "controller detected"}, - {0x5D,0x19,D|B,SC_HARDWARE_IF "throughput performance"}, - {0x5D,0x1A,D|B,SC_HARDWARE_IF "seek time performance"}, - {0x5D,0x1B,D|B,SC_HARDWARE_IF "spin-up retry count"}, - {0x5D,0x1C,D|B,SC_HARDWARE_IF "drive calibration retry count"}, - {0x5D,0x20,D|B,SC_CONTROLLER_IF "general hard drive failure"}, - {0x5D,0x21,D|B,SC_CONTROLLER_IF "drive" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x22,D|B,SC_CONTROLLER_IF "data" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x23,D|B,SC_CONTROLLER_IF "seek" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x24,D|B,SC_CONTROLLER_IF "too many block reassigns"}, - {0x5D,0x25,D|B,SC_CONTROLLER_IF "access" SC_TIMES_TOO_HIGH }, - {0x5D,0x26,D|B,SC_CONTROLLER_IF "start unit" SC_TIMES_TOO_HIGH }, - {0x5D,0x27,D|B,SC_CONTROLLER_IF "channel parametrics"}, - {0x5D,0x28,D|B,SC_CONTROLLER_IF "controller detected"}, - {0x5D,0x29,D|B,SC_CONTROLLER_IF "throughput performance"}, - {0x5D,0x2A,D|B,SC_CONTROLLER_IF "seek time performance"}, - {0x5D,0x2B,D|B,SC_CONTROLLER_IF "spin-up retry count"}, - {0x5D,0x2C,D|B,SC_CONTROLLER_IF "drive calibration retry count"}, - {0x5D,0x30,D|B,SC_DATA_CHANNEL_IF "general hard drive failure"}, - {0x5D,0x31,D|B,SC_DATA_CHANNEL_IF "drive" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x32,D|B,SC_DATA_CHANNEL_IF "data" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x33,D|B,SC_DATA_CHANNEL_IF "seek" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x34,D|B,SC_DATA_CHANNEL_IF "too many block reassigns"}, - {0x5D,0x35,D|B,SC_DATA_CHANNEL_IF "access" SC_TIMES_TOO_HIGH }, - {0x5D,0x36,D|B,SC_DATA_CHANNEL_IF "start unit" SC_TIMES_TOO_HIGH }, - {0x5D,0x37,D|B,SC_DATA_CHANNEL_IF "channel parametrics"}, - {0x5D,0x38,D|B,SC_DATA_CHANNEL_IF "controller detected"}, - {0x5D,0x39,D|B,SC_DATA_CHANNEL_IF "throughput performance"}, - {0x5D,0x3A,D|B,SC_DATA_CHANNEL_IF "seek time performance"}, - {0x5D,0x3B,D|B,SC_DATA_CHANNEL_IF "spin-up retry count"}, - {0x5D,0x3C,D|B,SC_DATA_CHANNEL_IF "drive calibration retry count"}, - {0x5D,0x40,D|B,SC_SERVO_IF "general hard drive failure"}, - {0x5D,0x41,D|B,SC_SERVO_IF "drive" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x42,D|B,SC_SERVO_IF "data" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x43,D|B,SC_SERVO_IF "seek" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x44,D|B,SC_SERVO_IF "too many block reassigns"}, - {0x5D,0x45,D|B,SC_SERVO_IF "access" SC_TIMES_TOO_HIGH }, - {0x5D,0x46,D|B,SC_SERVO_IF "start unit" SC_TIMES_TOO_HIGH }, - {0x5D,0x47,D|B,SC_SERVO_IF "channel parametrics"}, - {0x5D,0x48,D|B,SC_SERVO_IF "controller detected"}, - {0x5D,0x49,D|B,SC_SERVO_IF "throughput performance"}, - {0x5D,0x4A,D|B,SC_SERVO_IF "seek time performance"}, - {0x5D,0x4B,D|B,SC_SERVO_IF "spin-up retry count"}, - {0x5D,0x4C,D|B,SC_SERVO_IF "drive calibration retry count"}, - {0x5D,0x50,D|B,SC_SPINDLE_IF "general hard drive failure"}, - {0x5D,0x51,D|B,SC_SPINDLE_IF "drive" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x52,D|B,SC_SPINDLE_IF "data" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x53,D|B,SC_SPINDLE_IF "seek" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x54,D|B,SC_SPINDLE_IF "too many block reassigns"}, - {0x5D,0x55,D|B,SC_SPINDLE_IF "access" SC_TIMES_TOO_HIGH }, - {0x5D,0x56,D|B,SC_SPINDLE_IF "start unit" SC_TIMES_TOO_HIGH }, - {0x5D,0x57,D|B,SC_SPINDLE_IF "channel parametrics"}, - {0x5D,0x58,D|B,SC_SPINDLE_IF "controller detected"}, - {0x5D,0x59,D|B,SC_SPINDLE_IF "throughput performance"}, - {0x5D,0x5A,D|B,SC_SPINDLE_IF "seek time performance"}, - {0x5D,0x5B,D|B,SC_SPINDLE_IF "spin-up retry count"}, - {0x5D,0x5C,D|B,SC_SPINDLE_IF "drive calibration retry count"}, - {0x5D,0x60,D|B,SC_FIRMWARE_IF "general hard drive failure"}, - {0x5D,0x61,D|B,SC_FIRMWARE_IF "drive" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x62,D|B,SC_FIRMWARE_IF "data" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x63,D|B,SC_FIRMWARE_IF "seek" SC_ERROR_RATE_TOO_HIGH }, - {0x5D,0x64,D|B,SC_FIRMWARE_IF "too many block reassigns"}, - {0x5D,0x65,D|B,SC_FIRMWARE_IF "access" SC_TIMES_TOO_HIGH }, - {0x5D,0x66,D|B,SC_FIRMWARE_IF "start unit" SC_TIMES_TOO_HIGH }, - {0x5D,0x67,D|B,SC_FIRMWARE_IF "channel parametrics"}, - {0x5D,0x68,D|B,SC_FIRMWARE_IF "controller detected"}, - {0x5D,0x69,D|B,SC_FIRMWARE_IF "throughput performance"}, - {0x5D,0x6A,D|B,SC_FIRMWARE_IF "seek time performance"}, - {0x5D,0x6B,D|B,SC_FIRMWARE_IF "spin-up retry count"}, - {0x5D,0x6C,D|B,SC_FIRMWARE_IF "drive calibration retry count"}, - {0x5D,0xFF,SC_ALL_DEVS,"Failure prediction threshold exceeded (false)"}, - {0x5E,0x00,D|T|L|P|W|R|S|O|C|A|K,"Low power condition on"}, - {0x5E,0x01,D|T|L|P|W|R|S|O|C|A|K,"Idle condition activated by timer"}, - {0x5E,0x02,D|T|L|P|W|R|S|O|C|A|K,"Standby condition activated by timer"}, - {0x5E,0x03,D|T|L|P|W|R|S|O|C|A|K,"Idle condition activated by command"}, - {0x5E,0x04,D|T|L|P|W|R|S|O|C|A|K,"Standby condition activated by command"}, - {0x5E,0x41,B,"Power state change to active"}, - {0x5E,0x42,B,"Power state change to idle"}, - {0x5E,0x43,B,"Power state change to standby"}, - {0x5E,0x45,B,"Power state change to sleep"}, - {0x5E,0x47,B|K,"Power state change to device control"}, - {0x60,0x00,S,"Lamp failure"}, - {0x61,0x00,S,"Video acquisition error"}, - {0x61,0x01,S,"Unable to acquire video"}, - {0x61,0x02,S,"Out of focus"}, - {0x62,0x00,S,"Scan head positioning error"}, - {0x63,0x00,R,"End of user area encountered on this track"}, - {0x63,0x01,R,"Packet does not fit in available space"}, - {0x64,0x00,R,"Illegal mode for this track"}, - {0x64,0x01,R,"Invalid packet size"}, - {0x65,0x00,SC_ALL_DEVS,"Voltage fault"}, - {0x66,0x00,S,"Automatic document feeder cover up"}, - {0x66,0x01,S,"Automatic document feeder lift up"}, - {0x66,0x02,S,"Document jam in automatic document feeder"}, - {0x66,0x03,S,"Document miss feed automatic in document feeder"}, - {0x67,0x00,A,"Configuration failure"}, - {0x67,0x01,A,"Configuration of incapable logical units failed"}, - {0x67,0x02,A,"Add logical unit failed"}, - {0x67,0x03,A,"Modification of logical unit failed"}, - {0x67,0x04,A,"Exchange of logical unit failed"}, - {0x67,0x05,A,"Remove of logical unit failed"}, - {0x67,0x06,A,"Attachment of logical unit failed"}, - {0x67,0x07,A,"Creation of logical unit failed"}, - {0x67,0x08,A,"Assign failure occurred"}, - {0x67,0x09,A,"Multiply assigned logical unit"}, - {0x67,0x0A,SC_ALL_DEVS,"Set target port groups command failed"}, - {0x68,0x00,A,SC_LOGICAL_UNIT "not configured"}, - {0x69,0x00,A,"Data loss on logical unit"}, - {0x69,0x01,A,"Multiple logical unit failures"}, - {0x69,0x02,A,"Parity/data mismatch"}, - {0x6A,0x00,A,"Informational,refer to log"}, - {0x6B,0x00,A,"State change has occurred"}, - {0x6B,0x01,A,"Redundancy level got better"}, - {0x6B,0x02,A,"Redundancy level got worse"}, - {0x6C,0x00,A,"Rebuild failure occurred"}, - {0x6D,0x00,A,"Recalculate failure occurred"}, - {0x6E,0x00,A,"Command to logical unit failed"}, - {0x6F,0x00,R,"Copy protection key exchange failure - authentication failure"}, - {0x6F,0x01,R,"Copy protection key exchange failure - key not present"}, - {0x6F,0x02,R,"Copy protection key exchange failure - key not established"}, - {0x6F,0x03,R,"Read of scrambled sector without authentication"}, - {0x6F,0x04,R,"Media region code is mismatched to logical unit region"}, - {0x6F,0x05,R,"Drive region must be permanent/region reset count error"}, - /* - * FIXME(eric) - need a way to represent wildcards here. - */ - {0x70,0x00,T,"Decompression exception short algorithm id of nn"}, - {0x71,0x00,T,"Decompression exception long algorithm id"}, - {0x72,0x00,R,"Session fixation error"}, - {0x72,0x01,R,"Session fixation error writing lead-in"}, - {0x72,0x02,R,"Session fixation error writing lead-out"}, - {0x72,0x03,R,"Session fixation error - incomplete track in session"}, - {0x72,0x04,R,"Empty or partially written reserved track"}, - {0x72,0x05,R,"No more track reservations allowed"}, - {0x73,0x00,R,"Cd control error"}, - {0x73,0x01,R,"Power calibration area almost full"}, - {0x73,0x02,R,"Power calibration area is full"}, - {0x73,0x03,R,"Power calibration area error"}, - {0x73,0x04,R,"Program memory area update failure"}, - {0x73,0x05,R,"Program memory area is full"}, - {0x73,0x06,R,"RMA/PMA is full"}, - {0, 0, 0, NULL} -}; - -static const char * sc_oft_used[0x1f] = { - "umulig", /* index 0x0 should be impossible */ - "Audio play operation ", - "Logical unit ", - "not ready, ", - " operation", - " in progress ", - "Hardware impending failure ", - "Controller impending failure ", - "Data channel impending failure ", /* index 0x8 */ - "Servo impending failure ", - "Spindle impending failure ", - "Firmware impending failure ", - "Recovered data ", - " error rate too high", - " times too high", -}; - -static const char *snstext[] = { - "No Sense", /* There is no sense information */ - "Recovered Error", /* The last command completed successfully - but used error correction */ - "Not Ready", /* The addressed target is not ready */ - "Medium Error", /* Data error detected on the medium */ - "Hardware Error", /* Controller or device failure */ - "Illegal Request", - "Unit Attention", /* Removable medium was changed, or - the target has been reset */ - "Data Protect", /* Access to the data is blocked */ - "Blank Check", /* Reached unexpected written or unwritten - region of the medium */ - "Key=9", /* Vendor specific */ - "Copy Aborted", /* COPY or COMPARE was aborted */ - "Aborted Command", /* The target aborted the command */ - "Equal", /* SEARCH DATA found data equal (obsolete) */ - "Volume Overflow", /* Medium full with still data to be written */ - "Miscompare", /* Source data and data on the medium - do not agree */ - "Key=15" /* Reserved */ -}; - -static -void sg_print_asc_ascq(unsigned char asc, unsigned char ascq) -{ - int k, j; - char obuff[256]; - const char * ccp; - const char * oup; - char c; - int found = 0; - - for (k=0; additional[k].text; k++) { - if (additional[k].code1 == asc && - additional[k].code2 == ascq) { - found = 1; - ccp = additional[k].text; - for (j = 0; *ccp && (j < sizeof(obuff)); ++ccp) { - c = *ccp; - if ((c < 0x20) && (c > 0)) { - oup = sc_oft_used[(int)c]; - if (oup) { - strcpy(obuff + j, oup); - j += strlen(oup); - } - else { - strcpy(obuff + j, "???"); - j += 3; - } - } - else - obuff[j++] = c; - } - if (j < sizeof(obuff)) - obuff[j] = '\0'; - else - obuff[sizeof(obuff) - 1] = '\0'; - fprintf(OUTP, "Additional sense: %s\n", obuff); - } - } - if (found) - return; - - for(k=0; additional2[k].text; k++) { - if ((additional2[k].code1 == asc) && - (ascq >= additional2[k].code2_min) && - (ascq <= additional2[k].code2_max)) { - found = 1; - fprintf(OUTP, "Additional sense: "); - fprintf(OUTP, additional2[k].text, ascq); - fprintf(OUTP, "\n"); - } - } - if (! found) - fprintf(OUTP, "ASC=%2x ASCQ=%2x\n", asc, ascq); -} - -/* Print sense information */ -void sg_print_sense(const char * leadin, const unsigned char * sense_buffer, - int sb_len) -{ - int k, s; - int sense_key, sense_class, valid, code; - int descriptor_format = 0; - const char * error = NULL; - - if (sb_len < 1) { - fprintf(OUTP, "sense buffer empty\n"); - return; - } - sense_class = (sense_buffer[0] >> 4) & 0x07; - code = sense_buffer[0] & 0xf; - valid = sense_buffer[0] & 0x80; - if (leadin) - fprintf(OUTP, "%s: ", leadin); - - if (sense_class == 7) { /* extended sense data */ - s = sense_buffer[7] + 8; - if(s > sb_len) /* device has more available which we ignore */ - s = sb_len; - - switch (code) { - case 0x0: - error = "Current"; /* error concerns current command */ - break; - case 0x1: - error = "Deferred"; /* error concerns some earlier command */ - /* e.g., an earlier write to disk cache succeeded, but - now the disk discovers that it cannot write the data */ - break; - case 0x2: - descriptor_format = 1; - error = "Descriptor current"; - /* new descriptor sense format */ - break; - case 0x3: - descriptor_format = 1; - error = "Descriptor deferred"; - /* new descriptor sense format (deferred report) */ - break; - default: - error = "Invalid"; - } - sense_key = sense_buffer[ descriptor_format ? 1 : 2 ] & 0xf; - fprintf(OUTP, "%s, Sense key: %s\n", error, snstext[sense_key]); - - if (descriptor_format) - sg_print_asc_ascq(sense_buffer[2], sense_buffer[3]); - else { - if (!valid) - fprintf(OUTP, "[valid=0] "); - fprintf(OUTP, "Info fld=0x%x, ", (int)((sense_buffer[3] << 24) | - (sense_buffer[4] << 16) | (sense_buffer[5] << 8) | - sense_buffer[6])); - - if (sense_buffer[2] & 0x80) - fprintf(OUTP, "FMK "); /* current command has read a filemark */ - if (sense_buffer[2] & 0x40) - fprintf(OUTP, "EOM "); /* end-of-medium condition exists */ - if (sense_buffer[2] & 0x20) - fprintf(OUTP, "ILI "); /* incorrect block length requested */ - - if (s > 13) { - if (sense_buffer[12] || sense_buffer[13]) - sg_print_asc_ascq(sense_buffer[12], sense_buffer[13]); - } - if (sense_key == 5 && s >= 18 && (sense_buffer[15]&0x80)) { - fprintf(OUTP, "Sense Key Specific: Error in %s byte %d", - (sense_buffer[15]&0x40)?"Command":"Data", - (sense_buffer[16]<<8)|sense_buffer[17]); - if(sense_buffer[15]&0x08) { - fprintf(OUTP, " bit %d\n", sense_buffer[15]&0x07); - } else { - fprintf(OUTP, "\n"); - } - } - } - - } else { /* non-extended sense data */ - - /* - * Standard says: - * sense_buffer[0] & 0200 : address valid - * sense_buffer[0] & 0177 : vendor-specific error code - * sense_buffer[1] & 0340 : vendor-specific - * sense_buffer[1..3] : 21-bit logical block address - */ - - if (sb_len < 4) { - fprintf(OUTP, "sense buffer too short (4 byte minimum)\n"); - return; - } - if (leadin) - fprintf(OUTP, "%s: ", leadin); - if (sense_buffer[0] < 15) - fprintf(OUTP, - "old sense: key %s\n", snstext[sense_buffer[0] & 0x0f]); - else - fprintf(OUTP, "sns = %2x %2x\n", sense_buffer[0], sense_buffer[2]); - - fprintf(OUTP, "Non-extended sense class %d code 0x%0x ", - sense_class, code); - s = 4; - } - - fprintf(OUTP, "Raw sense data (in hex):\n "); - for (k = 0; k < s; ++k) { - if ((k > 0) && (0 == (k % 24))) - fprintf(OUTP, "\n "); - fprintf(OUTP, "%02x ", sense_buffer[k]); - } - fprintf(OUTP, "\n"); -} - -static const char * hostbyte_table[]={ -"DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET", -"DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", -"DID_PASSTHROUGH", "DID_SOFT_ERROR", NULL}; - -void sg_print_host_status(int host_status) -{ static int maxcode=0; - int i; - - if(! maxcode) { - for(i = 0; hostbyte_table[i]; i++) ; - maxcode = i-1; - } - fprintf(OUTP, "Host_status=0x%02x", host_status); - if(host_status > maxcode) { - fprintf(OUTP, "is invalid "); - return; - } - fprintf(OUTP, "(%s) ",hostbyte_table[host_status]); -} - -static const char * driverbyte_table[]={ -"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", -"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE", NULL}; - -static const char * driversuggest_table[]={"SUGGEST_OK", -"SUGGEST_RETRY", "SUGGEST_ABORT", "SUGGEST_REMAP", "SUGGEST_DIE", -unknown,unknown,unknown, "SUGGEST_SENSE",NULL}; - - -void sg_print_driver_status(int driver_status) -{ - static int driver_max =0 , suggest_max=0; - int i; - int dr = driver_status & SG_ERR_DRIVER_MASK; - int su = (driver_status & SG_ERR_SUGGEST_MASK) >> 4; - - if(! driver_max) { - for(i = 0; driverbyte_table[i]; i++) ; - driver_max = i; - for(i = 0; driversuggest_table[i]; i++) ; - suggest_max = i; - } - fprintf(OUTP, "Driver_status=0x%02x",driver_status); - fprintf(OUTP, " (%s,%s) ", - dr < driver_max ? driverbyte_table[dr]:"invalid", - su < suggest_max ? driversuggest_table[su]:"invalid"); -} - -static int sg_sense_print(const char * leadin, int scsi_status, - int host_status, int driver_status, - const unsigned char * sense_buffer, int sb_len) -{ - int done_leadin = 0; - int done_sense = 0; - - scsi_status &= 0x7e; /*sanity */ - if ((0 == scsi_status) && (0 == host_status) && - (0 == driver_status)) - return 1; /* No problems */ - if (0 != scsi_status) { - if (leadin) - fprintf(OUTP, "%s: ", leadin); - done_leadin = 1; - fprintf(OUTP, "scsi status: "); - sg_print_scsi_status(scsi_status); - fprintf(OUTP, "\n"); - if (sense_buffer && ((scsi_status == SCSI_CHECK_CONDITION) || - (scsi_status == SCSI_COMMAND_TERMINATED))) { - sg_print_sense(0, sense_buffer, sb_len); - done_sense = 1; - } - } - if (0 != host_status) { - if (leadin && (! done_leadin)) - fprintf(OUTP, "%s: ", leadin); - if (done_leadin) - fprintf(OUTP, "plus...: "); - else - done_leadin = 1; - sg_print_host_status(host_status); - fprintf(OUTP, "\n"); - } - if (0 != driver_status) { - if (leadin && (! done_leadin)) - fprintf(OUTP, "%s: ", leadin); - if (done_leadin) - fprintf(OUTP, "plus...: "); - else - done_leadin = 1; - sg_print_driver_status(driver_status); - fprintf(OUTP, "\n"); - if (sense_buffer && (! done_sense) && - (SG_ERR_DRIVER_SENSE == (0xf & driver_status))) - sg_print_sense(0, sense_buffer, sb_len); - } - return 0; -} - -#ifdef SG_IO -int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp) -{ - return sg_sense_print(leadin, hp->status, hp->host_status, - hp->driver_status, hp->sbp, hp->sb_len_wr); -} -#endif - -int sg_chk_n_print(const char * leadin, int masked_status, - int host_status, int driver_status, - const unsigned char * sense_buffer, int sb_len) -{ - int scsi_status = (masked_status << 1) & 0x7e; - - return sg_sense_print(leadin, scsi_status, host_status, driver_status, - sense_buffer, sb_len); -} - -#ifdef SG_IO -int sg_err_category3(struct sg_io_hdr * hp) -{ - return sg_err_category_new(hp->status, hp->host_status, - hp->driver_status, hp->sbp, hp->sb_len_wr); -} -#endif - -int sg_err_category(int masked_status, int host_status, - int driver_status, const unsigned char * sense_buffer, - int sb_len) -{ - int scsi_status = (masked_status << 1) & 0x7e; - - return sg_err_category_new(scsi_status, host_status, driver_status, - sense_buffer, sb_len); -} - -int sg_err_category_new(int scsi_status, int host_status, int driver_status, - const unsigned char * sense_buffer, int sb_len) -{ - scsi_status &= 0x7e; - if ((0 == scsi_status) && (0 == host_status) && - (0 == driver_status)) - return SG_ERR_CAT_CLEAN; - if ((SCSI_CHECK_CONDITION == scsi_status) || - (SCSI_COMMAND_TERMINATED == scsi_status) || - (SG_ERR_DRIVER_SENSE == (0xf & driver_status))) { - if (sense_buffer && (sb_len > 2)) { - int sense_key; - unsigned char asc; - - if (sense_buffer[0] & 0x2) { - sense_key = sense_buffer[1] & 0xf; - asc = sense_buffer[2]; - } - else { - sense_key = sense_buffer[2] & 0xf; - asc = (sb_len > 12) ? sense_buffer[12] : 0; - } - - if(RECOVERED_ERROR == sense_key) - return SG_ERR_CAT_RECOVERED; - else if (UNIT_ATTENTION == sense_key) { - if (0x28 == asc) - return SG_ERR_CAT_MEDIA_CHANGED; - if (0x29 == asc) - return SG_ERR_CAT_RESET; - } - } - return SG_ERR_CAT_SENSE; - } - if (0 != host_status) { - if ((SG_ERR_DID_NO_CONNECT == host_status) || - (SG_ERR_DID_BUS_BUSY == host_status) || - (SG_ERR_DID_TIME_OUT == host_status)) - return SG_ERR_CAT_TIMEOUT; - } - if (0 != driver_status) { - if (SG_ERR_DRIVER_TIMEOUT == driver_status) - return SG_ERR_CAT_TIMEOUT; - } - return SG_ERR_CAT_OTHER; -} - -int sg_get_command_size(unsigned char opcode) -{ - return COMMAND_SIZE(opcode); -} - -void sg_get_command_name(unsigned char opcode, int buff_len, char * buff) -{ - const char **table = commands[ group(opcode) ]; - - if ((NULL == buff) || (buff_len < 1)) - return; - - switch ((unsigned long) table) { - case RESERVED_GROUP: - strncpy(buff, reserved, buff_len); - break; - case VENDOR_GROUP: - strncpy(buff, vendor, buff_len); - break; - default: - strncpy(buff, table[opcode & 0x1f], buff_len); - break; - } -} -- cgit v1.2.3-54-g00ecf From 44a523e30d79efc5aca9a05073b32f5924191244 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 13 Feb 2004 01:01:07 -0800 Subject: [PATCH] v017 release --- ChangeLog | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca1f765aef..4ad5f63ace 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,57 @@ +Summary of changes from v016 to v017 +============================================ + +: + o make logging a config option + +: + o more udev-016/extras/multipath + o more udev-016/extras/multipath + o update extras/multipath + +Kay Sievers: + o udev - keep private data out of the database? + o better credential patch + o udevd - client access authorization + o compile udevd with klibc + o udev - fix "ignore method" + o udev - fix cdrom symlink rule + o convert udevsend/udevd to DGRAM and single-threaded + o udevd - kill the lockfile + o udevd - fix socket path length + o udevd - switch socket path to abstract namespace + o udevd - allow to bypass sequence number + o include used function + +Greg Kroah-Hartman: + o add udev_log to the documentation + o fix offsetof() define in klibc + o add some .spec file changes from Red Hat + o update the init.d udev script based on a patch from Red Hat + o remove the .udev.tdb when installing or uninstalling to be safe + o remove the database at startup + o fix bug in permission handling + o update klibc to version .107 + o update the bitkeeper ignore file list + o add udevtest program to build + o fix problem where usb devices can be either the main device or the interface + o more logging.h cleanups to be a bit more flexible + o stop using mode_t as different libcs define it in different ways :( + o remove some more KLIBC fixups that are no longer needed + o let udev-test.pl run an individual test if you ask it to + o Handle the '!' character that some block devices have + o add a block device with a ! in the name, and a test for this + o fix up 'make release' to use bk to build the export tree + o fix log option code so that it actually works for all udev programs + o finish syncing up with klibc + o sync with latest version of klibc (0.107) + o fix up Makefile dependancies for udev_version.h + +Patrick Mansfield: + o udev add wild card compare for ID + o udev kill extra bus_id compares in match_id + + Summary of changes from v015 to v016 ============================================ diff --git a/Makefile b/Makefile index 2ecfd3a968..0f347c7342 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ DAEMON = udevd SENDER = udevsend HELPER = udevinfo TESTER = udevtest -VERSION = 016_bk +VERSION = 017 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 0b142f0942..a53a1ad63b 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 016_bk +Version: 017 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 7a4877bf6fea5f1d1d8390b7efd6b8a53003631a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 16 Feb 2004 18:19:48 -0800 Subject: [PATCH] Fix bug where we did not use the "converted" kernel name if we had no rule. This fixes the bug with names that have a ! in them and no rule to match. --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 018fd452e9..f138fe9769 100644 --- a/namedev.c +++ b/namedev.c @@ -745,7 +745,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } /* no rule was found so we use the kernel name */ - strfieldcpy(udev->name, class_dev->name); + strfieldcpy(udev->name, udev->kernel_name); goto done; found: -- cgit v1.2.3-54-g00ecf From b9fc973b9a9e9622e3b7f4c4031ffe0835df5f65 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 16 Feb 2004 18:25:01 -0800 Subject: [PATCH] Add another test to udev-test.pl and fix a bug when only running 1 test. --- test/udev-test.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index c433b84a97..62a2bb327b 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -346,6 +346,15 @@ EOF conf => < "name test with ! in the name, but no matching rule", + subsys => "block", + devpath => "block/rd!c0d0", + expected => "rd/c0d0" , + conf => < Date: Mon, 16 Feb 2004 18:27:46 -0800 Subject: [PATCH] 017_bk mark --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0f347c7342..c9455e460c 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ DAEMON = udevd SENDER = udevsend HELPER = udevinfo TESTER = udevtest -VERSION = 017 +VERSION = 017_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev -- cgit v1.2.3-54-g00ecf From aa3400ae6d621db5d257340c1b07cb8ca6190913 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 16 Feb 2004 18:32:20 -0800 Subject: [PATCH] add ability to install udevtest to Makefile --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index c9455e460c..936a6613f0 100644 --- a/Makefile +++ b/Makefile @@ -352,6 +352,7 @@ install: install-config install-dbus-policy all $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(HELPER) $(DESTDIR)$(sbindir)/$(HELPER) + $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(sbindir)/$(TESTER) @if [ "x$(USE_LSB)" = "xtrue" ]; then \ $(INSTALL_PROGRAM) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ ln -s $(DESTDIR)$(initdir)/udev $(sbindir)/rcudev; \ -- cgit v1.2.3-54-g00ecf From e68582be4a9522bb936a7c8adcd20991793d7d14 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 16 Feb 2004 18:37:59 -0800 Subject: [PATCH] update the udev.spec to add udevtest and make some more Red Hat suggested changes. --- udev.spec | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/udev.spec b/udev.spec index a53a1ad63b..aa595962f7 100644 --- a/udev.spec +++ b/udev.spec @@ -23,13 +23,13 @@ %define debug 0 # if we want to use the LSB version of the init script or the Redhat one -# 0 - use Redhat version: etc/init.d/udev -# 1 - use LSB version: etc/init.d/udev.init.LSB +# 0 - use Redhat: etc/init.d/udev +# 1 - use LSB: etc/init.d/udev.init.LSB %define lsb 0 Summary: A userspace implementation of devfs Name: udev -Version: 017 +Version: 017_bk Release: 1 License: GPL Group: Utilities/System @@ -68,18 +68,20 @@ make CC="gcc $RPM_OPT_FLAGS" \ DEBUG=false \ %endif -# now build udevd on it's own, as it can't handle being built with klibc -make CC="gcc $RPM_OPT_FLAGS" udevd - %install make DESTDIR=$RPM_BUILD_ROOT install \ %if %{dbus} - USE_DBUS=true + USE_DBUS=true \ +%else + USE_DBUS=false \ %endif %if %{lsb} - USE_LSB=true + USE_LSB=true \ +%else + USE_LSB=false \ %endif + %post /sbin/chkconfig --add udev @@ -98,9 +100,9 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /sbin/udevinfo %attr(755,root,root) /sbin/udevsend %attr(755,root,root) /sbin/udevd -%attr(755,root,root) /udev/ -%attr(755,root,root) /etc/udev/ -%attr(755,root,root) %dir +%attr(755,root,root) /sbin/udevtest +%attr(755,root,root) %dir /udev/ +%attr(755,root,root) %dir /etc/udev/ %config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf %config(noreplace) %attr(0644,root,root) /etc/udev/udev.rules %config(noreplace) %attr(0644,root,root) /etc/udev/udev.permissions @@ -112,6 +114,11 @@ rm -rf $RPM_BUILD_ROOT %attr(0644,root,root) %{_mandir}/man8/udev*.8* %changelog +* Mon Feb 16 2004 Greg Kroah-Hartman +- fix up udevd build, as it's no longer needed to be build seperatly +- add udevtest to list of files +- more Red Hat sync ups. + * Thu Feb 12 2004 Greg Kroah-Hartman - add some changes from the latest Fedora udev release. -- cgit v1.2.3-54-g00ecf From a27cd06c6d3c83d9906f5e1aaf8d3c4b32055830 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 16 Feb 2004 21:36:34 -0800 Subject: [PATCH] Adding '%s' format specifier to NAME and SYMLINK On Thu, Feb 12, 2004 at 05:34:57PM -0800, Greg KH wrote: > On Tue, Feb 10, 2004 at 09:14:20AM +0100, Hannes Reinecke wrote: > > Hi all, > > > > this patch makes the format for NAME and SYMLINK a bit more flexible: > > I've added a new format specifier '%s{}', which allows for > > the value of any sysfs entry found for this device to be inserted. > > Example (for our S/390 fcp adapter): > > > > BUS="ccw", SYSFS_devtype="1732/03", NAME="%k" \ > > SYMLINK="zfcp-%s{hba_id}-%s{wwpn}:%s{fcp_lun}" > > > > I know this could also be done with an external program, but having this > > incorporated into udev makes life easier, especially if run from > > initramfs. Plus it makes the rules easier to follow, as the result is > > directly visible and need not to be looked up in some external program. > > > > Comments etc. welcome. > > Oops, sorry I missed this for the 017 release. I'll look at it tomorrow > and get back to you. At first glance it looks like a good thing. > > Oh, you forgot to update the documentation, that's important to do if > you want this change to make it in :) I took a part of the code and made a version that uses already implemented attribute finding logic. The parsing of the format length '%3x' and the '%x{attribute}' is a fuction now, maybe there are more possible users in the future. I've also added the test to udev-test.pl. --- namedev.c | 228 +++++++++++++++++++++++++++++++++++------------------- test/udev-test.pl | 10 +++ 2 files changed, 158 insertions(+), 80 deletions(-) diff --git a/namedev.c b/namedev.c index f138fe9769..cd38f25cb0 100644 --- a/namedev.c +++ b/namedev.c @@ -41,6 +41,8 @@ #include "libsysfs/libsysfs.h" #include "klibc_fixups.h" +static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr); + LIST_HEAD(config_device_list); LIST_HEAD(perm_device_list); @@ -168,7 +170,46 @@ static char *get_default_group(void) return default_group_str; } -static void apply_format(struct udevice *udev, unsigned char *string) +/* extract possible {attr} and move str behind it */ +static char *get_format_attribute(char **str) +{ + char *pos; + char *attr = NULL; + + if (*str[0] == '{') { + pos = strchr(*str, '}'); + if (pos == NULL) { + dbg("missing closing brace for format"); + return NULL; + } + pos[0] = '\0'; + attr = *str+1; + *str = pos+1; + dbg("attribute='%s', str='%s'", attr, *str); + } + return attr; +} + +/* extract possible format length and move str behind it*/ +static int get_format_len(char **str) +{ + int num; + char *tail; + + if (isdigit(*str[0])) { + num = (int) strtoul(*str, &tail, 10); + if (tail != NULL) { + *str = tail; + dbg("format length=%i", num); + return num; + } else { + dbg("format parsing error '%s'", *str); + } + } + return -1; +} + +static void apply_format(struct udevice *udev, unsigned char *string, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { char temp[NAME_SIZE]; char temp1[NAME_SIZE]; @@ -176,87 +217,100 @@ static void apply_format(struct udevice *udev, unsigned char *string) char *pos; char *pos2; char *pos3; + char *attr; int num; + char c; + struct sysfs_attribute *tmpattr; pos = string; + while (1) { - num = 0; pos = strchr(pos, '%'); - - if (pos) { + if (pos != NULL) { pos[0] = '\0'; tail = pos+1; - if (isdigit(tail[0])) { - num = (int) strtoul(&pos[1], &tail, 10); - if (tail == NULL) { - dbg("format parsing error '%s'", pos+1); - break; - } - } + num = get_format_len(&tail); + c = tail[0]; strfieldcpy(temp, tail+1); + tail = temp; + } else { + break; + } + dbg("format=%c, string='%s', tail='%s'",c , string, tail); - switch (tail[0]) { - case 'b': - if (strlen(udev->bus_id) == 0) - break; - strcat(pos, udev->bus_id); - dbg("substitute bus_id '%s'", udev->bus_id); + attr = get_format_attribute(&tail); + + switch (c) { + case 'b': + if (strlen(udev->bus_id) == 0) break; - case 'k': - if (strlen(udev->kernel_name) == 0) - break; - strcat(pos, udev->kernel_name); - dbg("substitute kernel name '%s'", udev->kernel_name); + strcat(pos, udev->bus_id); + dbg("substitute bus_id '%s'", udev->bus_id); + break; + case 'k': + if (strlen(udev->kernel_name) == 0) break; - case 'n': - if (strlen(udev->kernel_number) == 0) - break; - strcat(pos, udev->kernel_number); - dbg("substitute kernel number '%s'", udev->kernel_number); + strcat(pos, udev->kernel_name); + dbg("substitute kernel name '%s'", udev->kernel_name); + break; + case 'n': + if (strlen(udev->kernel_number) == 0) break; - case 'm': - sprintf(pos, "%u", udev->minor); - dbg("substitute minor number '%u'", udev->minor); + strcat(pos, udev->kernel_number); + dbg("substitute kernel number '%s'", udev->kernel_number); break; + case 'm': + sprintf(pos, "%u", udev->minor); + dbg("substitute minor number '%u'", udev->minor); + break; case 'M': - sprintf(pos, "%u", udev->major); - dbg("substitute major number '%u'", udev->major); + sprintf(pos, "%u", udev->major); + dbg("substitute major number '%u'", udev->major); + break; + case 'c': + if (strlen(udev->program_result) == 0) break; - case 'c': - if (strlen(udev->program_result) == 0) - break; - if (num) { - /* get part of return string */ - strncpy(temp1, udev->program_result, sizeof(temp1)); - pos2 = temp1; - while (num) { - num--; - pos3 = strsep(&pos2, " "); - if (pos3 == NULL) { - dbg("requested part of result string not found"); - break; - } - } - if (pos3) { - strcat(pos, pos3); - dbg("substitute part of result string '%s'", pos3); + if (num > 0) { + strncpy(temp1, udev->program_result, sizeof(temp1)); + pos2 = temp1; + while (num) { + num--; + pos3 = strsep(&pos2, " "); + if (pos3 == NULL) { + dbg("requested part of result string not found"); + break; } - } else { - strcat(pos, udev->program_result); - dbg("substitute result string '%s'", udev->program_result); } - break; - case '%': - strcat(pos, "%"); - pos++; - break; - default: - dbg("unknown substitution type '%%%c'", pos[1]); - break; + if (pos3) { + strcat(pos, pos3); + dbg("substitute part of result string '%s'", pos3); + } + } else { + strcat(pos, udev->program_result); + dbg("substitute result string '%s'", udev->program_result); } - strcat(string, temp); - } else break; + case 's': + if (attr != NULL) { + tmpattr = find_sysfs_attribute(class_dev, sysfs_device, attr); + if (tmpattr == NULL) { + dbg("sysfa attribute '%s' not found", attr); + break; + } + strcpy(pos, tmpattr->value); + dbg("substitute sysfs value '%s'", tmpattr->value); + } else { + dbg("missing attribute"); + } + break; + case '%': + strcat(pos, "%"); + break; + default: + dbg("unknown substitution type '%%%c'", c); + break; + } + strcat(pos, tail); } } @@ -422,32 +476,46 @@ static int execute_program(char *path, char *value, int len) return retval; } -static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair) +static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr) { struct sysfs_attribute *tmpattr = NULL; char *c; - if ((pair == NULL) || (pair->file[0] == '\0') || (pair->value == '\0')) - return -ENODEV; - - dbg("look for device attribute '%s'", pair->file); + dbg("look for device attribute '%s'", attr); /* try to find the attribute in the class device directory */ - tmpattr = sysfs_get_classdev_attr(class_dev, pair->file); + tmpattr = sysfs_get_classdev_attr(class_dev, attr); if (tmpattr) - goto label_found; + goto attr_found; /* look in the class device directory if present */ if (sysfs_device) { - tmpattr = sysfs_get_device_attr(sysfs_device, pair->file); + tmpattr = sysfs_get_device_attr(sysfs_device, attr); if (tmpattr) - goto label_found; + goto attr_found; } - return -ENODEV; -label_found: - c = tmpattr->value + strlen(tmpattr->value)-1; - if (*c == '\n') - *c = 0x00; + return NULL; + +attr_found: + c = strchr(tmpattr->value, '\n'); + if (c != NULL) + c[0] = '\0'; + + dbg("found attribute '%s'", tmpattr->path); + return tmpattr; +} + +static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair) +{ + struct sysfs_attribute *tmpattr; + + if ((pair == NULL) || (pair->file[0] == '\0') || (pair->value == '\0')) + return -ENODEV; + + tmpattr = find_sysfs_attribute(class_dev, sysfs_device, pair->file); + if (tmpattr == NULL) + return -ENODEV; + dbg("compare attribute '%s' value '%s' with '%s'", pair->file, tmpattr->value, pair->value); if (strcmp_pattern(pair->value, tmpattr->value) != 0) @@ -658,7 +726,7 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas /* execute external program */ if (dev->program[0] != '\0') { dbg("check " FIELD_PROGRAM); - apply_format(udev, dev->program); + apply_format(udev, dev->program, class_dev, sysfs_device); if (execute_program(dev->program, udev->program_result, NAME_SIZE) != 0) { dbg(FIELD_PROGRAM " returned nozero"); goto try_parent; @@ -750,8 +818,8 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud found: /* substitute placeholder */ - apply_format(udev, udev->name); - apply_format(udev, udev->symlink); + apply_format(udev, udev->name, class_dev, sysfs_device); + apply_format(udev, udev->symlink, class_dev, sysfs_device); done: perm = find_perm(udev->name); diff --git a/test/udev-test.pl b/test/udev-test.pl index 62a2bb327b..cbe110f797 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -191,6 +191,16 @@ EOF expected => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "sustitution of sysfs value (%s{file})", + subsys => "block", + devpath => "block/sda", + expected => "disk-IBM-ESXS-sda" , + conf => < Date: Mon, 16 Feb 2004 21:39:40 -0800 Subject: [PATCH] allow SYSFS{file} On Sun, Feb 15, 2004 at 03:36:00AM +0100, Kay Sievers wrote: > > Since we have %s{file} it may be nice to allow SYSFS{file}. > This patch allows: > > BUS="usb", SYSFS{idProduct}="a511", NAME="video%n" > > compared to the current: > > BUS="usb", SYSFS_idProduct="a511", NAME="video%n" > > The curent syntax is still supported. > Looks a bit nicer and less hackish, I think. Better patch with infrastructure to easily implement KEY{attribute} for every other key. The first user is the SYSFS{file} key. Both versions, brackets or underscore is supported for the attribute. --- namedev.h | 2 +- namedev_parse.c | 43 +++++++++++++++++++++++++++++++++++++++---- test/udev-test.pl | 10 ++++++++++ 3 files changed, 50 insertions(+), 5 deletions(-) diff --git a/namedev.h b/namedev.h index a0cdba6b16..e38c4f5257 100644 --- a/namedev.h +++ b/namedev.h @@ -36,7 +36,7 @@ struct sysfs_class_device; #define PROGRAM_SIZE 100 #define FIELD_BUS "BUS" -#define FIELD_SYSFS "SYSFS_" +#define FIELD_SYSFS "SYSFS" #define FIELD_ID "ID" #define FIELD_PLACE "PLACE" #define FIELD_PROGRAM "PROGRAM" diff --git a/namedev_parse.c b/namedev_parse.c index e6575fa108..20ff60d640 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -85,6 +85,35 @@ void dump_perm_dev_list(void) dump_perm_dev(dev); } +/* extract possible KEY{attr} or KEY_attr */ +static char *get_key_attribute(char *str) +{ + char *pos; + char *attr; + + attr = strchr(str, '_'); + if (attr != NULL) { + attr++; + dbg("attribute='%s'", attr); + return attr; + } + + attr = strchr(str, '{'); + if (attr != NULL) { + attr++; + pos = strchr(attr, '}'); + if (pos == NULL) { + dbg("missing closing brace for format"); + return NULL; + } + pos[0] = '\0'; + dbg("attribute='%s'", attr); + return attr; + } + + return NULL; +} + int namedev_init_rules(void) { char line[255]; @@ -92,6 +121,7 @@ int namedev_init_rules(void) char *temp; char *temp2; char *temp3; + char *attr; FILE *fd; int program_given = 0; int retval = 0; @@ -164,8 +194,12 @@ int namedev_init_rules(void) ++pair; } if (pair) { - /* remove prepended 'SYSFS_' */ - strfieldcpy(pair->file, temp2 + sizeof(FIELD_SYSFS)-1); + attr = get_key_attribute(temp2 + sizeof(FIELD_SYSFS)-1); + if (attr == NULL) { + dbg("error parsing " FIELD_SYSFS " attribute"); + continue; + } + strfieldcpy(pair->file, attr); strfieldcpy(pair->value, temp3); } continue; @@ -205,12 +239,13 @@ int namedev_init_rules(void) /* simple plausibility check for given keys */ if ((dev.sysfs_pair[0].file[0] == '\0') ^ (dev.sysfs_pair[0].value[0] == '\0')) { - dbg("inconsistency in SYSFS_ key"); + dbg("inconsistency in " FIELD_SYSFS " key"); goto error; } if ((dev.result[0] != '\0') && (program_given == 0)) { - dbg("RESULT is only useful when PROGRAM called in any rule before"); + dbg(FIELD_RESULT " is only useful when " + FIELD_PROGRAM " is called in any rule before"); goto error; } diff --git a/test/udev-test.pl b/test/udev-test.pl index cbe110f797..abe622cf8a 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -191,6 +191,16 @@ EOF expected => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "select sysfs attribute by SYSFS{vendor}", + subsys => "block", + devpath => "block/sda", + expected => "disk-IBM-ESXS-sda" , + conf => < Date: Mon, 16 Feb 2004 21:44:28 -0800 Subject: [PATCH] udev - create all partitions of blockdevice Here is the first try to create all partitons of a blockdevice, since removable media devices may need to acces the expected partition to revalidate the media. It uses the attribute syntax introduced with the last %s{file} patch. I'm using this with my multi-slot-flash-card-reader: SYSFS{model}="USB Storage-SMC ", NAME{all_partitions}="smartmedia" SYSFS{model}="USB Storage-CFC ", NAME{all_partitions}="compactflash" SYSFS{model}="USB Storage-MSC ", NAME{all_partitions}="memorystick" SYSFS{model}="USB Storage-MMC ", NAME{all_partitions}="multimedia" and I get: tree /udev/ /udev/ |-- memorystick |-- memorystick1 |-- memorystick10 |-- memorystick11 |-- memorystick12 |-- memorystick13 |-- memorystick14 |-- memorystick15 |-- memorystick2 |-- memorystick3 |-- memorystick4 |-- memorystick5 |-- memorystick6 |-- memorystick7 |-- memorystick8 |-- memorystick9 |-- multimedia |-- multimedia1 |-- multimedia10 |-- multimedia11 |-- multimedia12 |-- multimedia13 |-- multimedia14 |-- multimedia15 |-- multimedia2 |-- multimedia3 |-- multimedia4 |-- multimedia5 |-- multimedia6 |-- multimedia7 |-- multimedia8 |-- multimedia9 ... If needed, we can make the number of partions to create adjustable with the attribute? --- namedev.c | 2 +- namedev.h | 43 ++++++++++++++++++--------------- namedev_parse.c | 22 ++++++++++------- test/udev-test.pl | 11 ++++++++- udev-add.c | 71 +++++++++++++++++++++++++++++++++++-------------------- udev-remove.c | 13 +++++++++- udev.h | 1 + 7 files changed, 108 insertions(+), 55 deletions(-) diff --git a/namedev.c b/namedev.c index cd38f25cb0..942788b2a2 100644 --- a/namedev.c +++ b/namedev.c @@ -820,7 +820,7 @@ found: /* substitute placeholder */ apply_format(udev, udev->name, class_dev, sysfs_device); apply_format(udev, udev->symlink, class_dev, sysfs_device); - + udev->partitions = dev->partitions; done: perm = find_perm(udev->name); if (perm) { diff --git a/namedev.h b/namedev.h index e38c4f5257..10a5dcaf0c 100644 --- a/namedev.h +++ b/namedev.h @@ -28,25 +28,29 @@ struct sysfs_class_device; -#define BUS_SIZE 30 -#define FILE_SIZE 50 -#define VALUE_SIZE 100 -#define ID_SIZE 50 -#define PLACE_SIZE 50 -#define PROGRAM_SIZE 100 - -#define FIELD_BUS "BUS" -#define FIELD_SYSFS "SYSFS" -#define FIELD_ID "ID" -#define FIELD_PLACE "PLACE" -#define FIELD_PROGRAM "PROGRAM" -#define FIELD_RESULT "RESULT" -#define FIELD_KERNEL "KERNEL" -#define FIELD_NAME "NAME" -#define FIELD_SYMLINK "SYMLINK" - -#define PROGRAM_MAXARG 10 -#define MAX_SYSFS_PAIRS 5 +#define BUS_SIZE 30 +#define FILE_SIZE 50 +#define VALUE_SIZE 100 +#define ID_SIZE 50 +#define PLACE_SIZE 50 +#define PROGRAM_SIZE 100 + +#define FIELD_BUS "BUS" +#define FIELD_SYSFS "SYSFS" +#define FIELD_ID "ID" +#define FIELD_PLACE "PLACE" +#define FIELD_PROGRAM "PROGRAM" +#define FIELD_RESULT "RESULT" +#define FIELD_KERNEL "KERNEL" +#define FIELD_NAME "NAME" +#define FIELD_SYMLINK "SYMLINK" + +#define ATTR_PARTITIONS "all_partitions" +#define PARTITIONS_COUNT 15 + + +#define PROGRAM_MAXARG 10 +#define MAX_SYSFS_PAIRS 5 struct sysfs_pair { char file[FILE_SIZE]; @@ -65,6 +69,7 @@ struct config_device { char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; + int partitions; int config_line; }; diff --git a/namedev_parse.c b/namedev_parse.c index 20ff60d640..d5d2181cb6 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -91,13 +91,6 @@ static char *get_key_attribute(char *str) char *pos; char *attr; - attr = strchr(str, '_'); - if (attr != NULL) { - attr++; - dbg("attribute='%s'", attr); - return attr; - } - attr = strchr(str, '{'); if (attr != NULL) { attr++; @@ -111,6 +104,13 @@ static char *get_key_attribute(char *str) return attr; } + attr = strchr(str, '_'); + if (attr != NULL) { + attr++; + dbg("attribute='%s'", attr); + return attr; + } + return NULL; } @@ -221,7 +221,13 @@ int namedev_init_rules(void) continue; } - if (strcasecmp(temp2, FIELD_NAME) == 0) { + if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) { + attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1); + if (attr != NULL) + if (strcasecmp(attr, ATTR_PARTITIONS) == 0) { + dbg_parse("creation of partition nodes requested"); + dev.partitions = PARTITIONS_COUNT; + } strfieldcpy(dev.name, temp3); continue; } diff --git a/test/udev-test.pl b/test/udev-test.pl index abe622cf8a..258d5c9596 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -350,7 +350,16 @@ KERNEL="ttyUSB0", NAME="visor", SYMLINK="first-%n second-%n third-%n" EOF }, { - desc => "sysfs parent heirachy", + desc => "create all possible partitions", + subsys => "block", + devpath => "block/sda", + expected => "boot_disk15" , + conf => < "sysfs parent hierarchy", subsys => "tty", devpath => "class/tty/ttyUSB0", expected => "visor" , diff --git a/udev-add.c b/udev-add.c index 8867c8f5af..3b3ebd5bbb 100644 --- a/udev-add.c +++ b/udev-add.c @@ -99,11 +99,44 @@ static int create_path(char *file) return 0; } +static int make_node(char *filename, int major, int minor, unsigned int mode, uid_t uid, gid_t gid) +{ + int retval; + + retval = mknod(filename, mode, makedev(major, minor)); + if (retval != 0) { + dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", + filename, mode, major, minor, strerror(errno)); + return retval; + } + + dbg("chmod(%s, %#o)", filename, mode); + retval = chmod(filename, mode); + if (retval != 0) { + dbg("chmod(%s, %#o) failed with error '%s'", + filename, mode, strerror(errno)); + return retval; + } + + if (uid != 0 || gid != 0) { + dbg("chown(%s, %u, %u)", filename, uid, gid); + retval = chown(filename, uid, gid); + if (retval != 0) { + dbg("chown(%s, %u, %u) failed with error '%s'", + filename, uid, gid, strerror(errno)); + return retval; + } + } + + return 0; +} + static int create_node(struct udevice *dev, int fake) { struct stat stats; char filename[255]; char linktarget[255]; + char partitionname[255]; char *linkname; char *symlinks; int retval = 0; @@ -135,23 +168,6 @@ static int create_node(struct udevice *dev, int fake) if (strrchr(dev->name, '/')) create_path(filename); - info("creating device node '%s'", filename); - dbg("mknod(%s, %#o, %u, %u)", filename, dev->mode, dev->major, dev->minor); - if (!fake) { - retval = mknod(filename, dev->mode, makedev(dev->major, dev->minor)); - if (retval != 0) - dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", - filename, dev->mode, dev->major, dev->minor, strerror(errno)); - } - - dbg("chmod(%s, %#o)", filename, dev->mode); - if (!fake) { - retval = chmod(filename, dev->mode); - if (retval != 0) - dbg("chmod(%s, %#o) failed with error '%s'", - filename, dev->mode, strerror(errno)); - } - if (dev->owner[0] != '\0') { char *endptr; unsigned long id = strtoul(dev->owner, &endptr, 10); @@ -180,12 +196,18 @@ static int create_node(struct udevice *dev, int fake) } } - if (uid != 0 || gid != 0) { - dbg("chown(%s, %u, %u)", filename, uid, gid); - retval = chown(filename, uid, gid); - if (retval != 0) - dbg("chown(%s, %u, %u) failed with error '%s'", - filename, uid, gid, strerror(errno)); + if (!fake) + info("creating device node '%s'", filename); + make_node(filename, dev->major, dev->minor, dev->mode, uid, gid); + + /* create partitions if requested */ + if (dev->partitions > 0) { + info("creating device partition nodes '%s[1-%i]'", filename, dev->partitions); + for (i = 1; i <= dev->partitions; i++) { + sprintf(partitionname, "%s%i", filename, i); + make_node(partitionname, dev->major, dev->minor + i, + dev->mode, uid, gid); + } } /* create symlink if requested */ @@ -222,8 +244,7 @@ static int create_node(struct udevice *dev, int fake) strcpy(linktarget, "./"); strcat(linktarget, &dev->name[tail]); - /* unlink existing non-directories to ensure that our symlink - * is created */ + /* unlink existing files to ensure that our symlink is created */ if (!fake && (lstat(filename, &stats) == 0)) { if ((stats.st_mode & S_IFMT) != S_IFDIR) { if (unlink(filename)) diff --git a/udev-remove.c b/udev-remove.c index c21938fae7..c20c651dc5 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -66,9 +66,11 @@ static int delete_path(char *path) static int delete_node(struct udevice *dev) { char filename[255]; + char partitionname[255]; char *symlinks; char *linkname; int retval; + int i; strncpy(filename, udev_root, sizeof(filename)); strncat(filename, dev->name, sizeof(filename)); @@ -81,11 +83,20 @@ static int delete_node(struct udevice *dev) return retval; } + /* remove partition nodes */ + if (dev->partitions > 0) { + info("removing partitions '%s[1-%i]'", filename, dev->partitions); + for (i = 1; i <= dev->partitions; i++) { + sprintf(partitionname, "%s%i", filename, i); + unlink(partitionname); + } + } + /* remove subdirectories */ if (strchr(dev->name, '/')) delete_path(filename); - if (*dev->symlink) { + if (dev->symlink[0] != '\0') { symlinks = dev->symlink; while (1) { linkname = strsep(&symlinks, " "); diff --git a/udev.h b/udev.h index e615b4c8bb..e8f93ad5ad 100644 --- a/udev.h +++ b/udev.h @@ -46,6 +46,7 @@ struct udevice { int minor; unsigned int mode; /* not mode_t due to conflicting definitions in different libcs */ char symlink[NAME_SIZE]; + int partitions; /* private data that help us in building strings */ char bus_id[SYSFS_NAME_LEN]; -- cgit v1.2.3-54-g00ecf From ab2e5bd94631eb3fcc66ec0aaa031d83a2de1604 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 16 Feb 2004 21:58:25 -0800 Subject: [PATCH] fix up bug created for udevtest in previous partition creation patch. --- udev-add.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/udev-add.c b/udev-add.c index 3b3ebd5bbb..a3bc0df579 100644 --- a/udev-add.c +++ b/udev-add.c @@ -196,17 +196,24 @@ static int create_node(struct udevice *dev, int fake) } } - if (!fake) + if (!fake) { info("creating device node '%s'", filename); make_node(filename, dev->major, dev->minor, dev->mode, uid, gid); + } else { + info("creating device node '%s', major = '%d', minor = '%d', " + "mode = '%#o', uid = '%d', gid = '%d'", filename, + dev->major, dev->minor, (mode_t)dev->mode, uid, gid); + } /* create partitions if requested */ if (dev->partitions > 0) { info("creating device partition nodes '%s[1-%i]'", filename, dev->partitions); - for (i = 1; i <= dev->partitions; i++) { - sprintf(partitionname, "%s%i", filename, i); - make_node(partitionname, dev->major, dev->minor + i, - dev->mode, uid, gid); + if (!fake) { + for (i = 1; i <= dev->partitions; i++) { + sprintf(partitionname, "%s%i", filename, i); + make_node(partitionname, dev->major, + dev->minor + i, dev->mode, uid, gid); + } } } -- cgit v1.2.3-54-g00ecf From 93656247f3b398959a0b40ac352b9f6ac195e86b Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Mon, 16 Feb 2004 22:00:38 -0800 Subject: [PATCH] udev add some ID tests Patch against current udev bk to add a few ID rule tests. --- test/udev-test.pl | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 258d5c9596..7459f8ff5c 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -384,6 +384,52 @@ EOF expected => "rd/c0d0" , conf => < "ID rule", + subsys => "block", + devpath => "block/sda", + expected => "scsi-0:0:0:0", + conf => < "ID wildcard all", + subsys => "block", + devpath => "block/sda", + expected => "scsi-0:0:0:0", + conf => < "ID wildcard partial", + subsys => "block", + devpath => "block/sda", + expected => "scsi-0:0:0:0", + conf => < "ID wildcard partial 2", + subsys => "block", + devpath => "block/sda", + expected => "scsi-0:0:0:0", + conf => < Date: Mon, 16 Feb 2004 22:31:15 -0800 Subject: [PATCH] Have udevd report it's version in debug mode. --- udevd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevd.c b/udevd.c index 9fbb4e964b..f7901cb752 100644 --- a/udevd.c +++ b/udevd.c @@ -328,6 +328,7 @@ int main(int argc, char *argv[]) struct sigaction act; init_logging("udevd"); + dbg("version %s", UDEV_VERSION); if (getuid() != 0) { dbg("need to be root, exit"); -- cgit v1.2.3-54-g00ecf From 8bbf27514c5e59f4982d0164af6b5df00ca2bac9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 16 Feb 2004 22:31:32 -0800 Subject: [PATCH] Have udevsend report more info in debug mode. --- udevsend.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/udevsend.c b/udevsend.c index c738fe2245..b5850294ae 100644 --- a/udevsend.c +++ b/udevsend.c @@ -142,30 +142,35 @@ int main(int argc, char* argv[]) #ifdef DEBUG init_logging("udevsend"); #endif + dbg("version %s", UDEV_VERSION); subsystem = argv[1]; if (subsystem == NULL) { dbg("no subsystem"); goto exit; } + dbg("subsystem = '%s'", subsystem); devpath = get_devpath(); if (devpath == NULL) { dbg("no devpath"); goto exit; } + dbg("DEVPATH = '%s'", devpath); action = get_action(); if (action == NULL) { dbg("no action"); goto exit; } + dbg("ACTION = '%s'", action); seqnum = get_seqnum(); if (seqnum == NULL) seq = -1; else seq = atoi(seqnum); + dbg("SEQNUM = '%d'", seq); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { -- cgit v1.2.3-54-g00ecf From 16378373cb9d96e5d424921806ff71f218e92694 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 17 Feb 2004 01:27:01 -0800 Subject: [PATCH] udev - switch SYSFS_file to SYSFS{file} Here we switch the configs and man pages to the new attribute syntax. Also the 'partition trick' is mentioned in udev.8 I think it's more clear visible now, that inside the brackets are user supplied values used and not some magic keys handled: 'SYSFS_dev' is now 'SYSFS{dev}' The old syntax is still supported. --- etc/udev/udev.rules | 4 ++-- etc/udev/udev.rules.gentoo | 6 +++--- test/label_test | 4 ++-- test/udev-test.pl | 36 ++++++++++++++++++------------------ udev.8 | 15 +++++++++++---- udevinfo.8 | 2 +- udevinfo.c | 2 +- 7 files changed, 38 insertions(+), 31 deletions(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 344304dd95..e1c2cbe91e 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -5,13 +5,13 @@ BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" # A usb camera. -BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" +BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n" # USB Epson printer to be called lp_epson BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" # USB HP printer to be called lp_hp -BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" +BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_hp" # sound card with PCI bus id 00:0b.0 to be the first sound card BUS="pci", ID="00:0b.0", NAME="dsp" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 0c53df535c..b3ca042224 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -23,13 +23,13 @@ BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" # A usb camera. -BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" +BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n" # USB Epson printer to be called lp_epson -BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" +BUS="usb", SYSFS{serial}="HXOLL0012202323480", NAME="lp_epson" # USB HP printer to be called lp_hp -BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" +BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_hp" # sound card with PCI bus id 00:0b.0 to be the first sound card BUS="pci", ID="00:0b.0", NAME="dsp" diff --git a/test/label_test b/test/label_test index 93d02c18f2..b99a4acd54 100644 --- a/test/label_test +++ b/test/label_test @@ -8,8 +8,8 @@ export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG cat > $RULES << EOF -BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW !#", NAME="boot_diskX%n" -BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW !#", NAME="boot_disk%n" +BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_diskX%n" +BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_disk%n" EOF cat > $CONFIG << EOF diff --git a/test/udev-test.pl b/test/udev-test.pl index 7459f8ff5c..e238c909fa 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -38,7 +38,7 @@ my @tests = ( devpath => "block/sda", expected => "boot_disk" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "block/sda/sda1", expected => "boot_disk1" , conf => < "block/sda", expected => "disk-IBM-ESXS-sda" , conf => < "class/tty/console", expected => "TTY" , conf => < "class/tty/console", expected => "foo" , conf => < "block/sda/sda2", expected => "1/2/a/b/symlink" , conf => < "block/sda/sda2", expected => "1/2/symlink" , conf => < "block/sda/sda2", expected => "1/2/c/d/symlink" , conf => < "block/sda", expected => "boot_disk15" , conf => < "class/tty/ttyUSB0", expected => "visor" , conf => <name, value); + printf(" SYSFS{%s}=\"%s\"\n", attr->name, value); } } printf("\n"); -- cgit v1.2.3-54-g00ecf From 88f09368b3dc2d17cf2ce1a4841e42a120a4dbb9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 17 Feb 2004 01:29:03 -0800 Subject: [PATCH] udev - switch callout part selector to {attribute} Here we change the magic callout part number selector to the new atribute syntax. The syntax to select the second part of the callout string: '%2c' is now '%c{2}' I think it's more clear and we no longer misuse the length argument. The old syntax is still supported, but we should remove it some time in the future. --- etc/udev/udev.rules.devfs | 2 +- etc/udev/udev.rules.gentoo | 2 +- extras/ide-devfs.sh | 2 +- extras/name_cdrom.pl | 2 +- namedev.c | 11 ++++++++--- test/udev-test.pl | 12 +----------- 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index f9333e91c4..77d3cf5414 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -2,7 +2,7 @@ # fields. See the udev man page for a full description of them. # ide block devices -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%1c %2c" +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" # md block devices KERNEL="md[0-9]*", NAME="md/%n" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index b3ca042224..7e8966961d 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -57,7 +57,7 @@ KERNEL="ttyUSB0", NAME="pl2303" # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%1c", SYMLINK="%2c %3c" +BUS="ide", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%c{1}", SYMLINK="%c{2} %c{3}" # fb devices KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 1cf6f9c9e4..0a9369dff4 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -2,7 +2,7 @@ # udev external PROGRAM script # return devfs-names for ide-devices -# BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%1c %2c" +# BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" HOST="${2%\.[0-9]}" TARGET="${2#[0-9]\.}" diff --git a/extras/name_cdrom.pl b/extras/name_cdrom.pl index 3a4772e6d9..766f6f366a 100644 --- a/extras/name_cdrom.pl +++ b/extras/name_cdrom.pl @@ -2,7 +2,7 @@ # a horribly funny script that shows how flexible udev can really be # This is to be executed by udev with the following rules: -# KERNEL="[hs]d[a-z]", PROGRAM="name_cdrom.pl %M %m", NAME="%1c", SYMLINK="cdrom" +# KERNEL="[hs]d[a-z]", PROGRAM="name_cdrom.pl %M %m", NAME="%c{1}", SYMLINK="cdrom" use strict; use warnings; diff --git a/namedev.c b/namedev.c index 942788b2a2..186a9f5cc2 100644 --- a/namedev.c +++ b/namedev.c @@ -219,6 +219,7 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys char *pos3; char *attr; int num; + int i; char c; struct sysfs_attribute *tmpattr; @@ -270,11 +271,15 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys case 'c': if (strlen(udev->program_result) == 0) break; - if (num > 0) { + /* get part part of the result string */ + i = num; /* num syntax is deprecated and will be removed */ + if (attr != NULL) + i = atoi(attr); + if (i > 0) { strncpy(temp1, udev->program_result, sizeof(temp1)); pos2 = temp1; - while (num) { - num--; + while (i) { + i--; pos3 = strsep(&pos2, " "); if (pos3 == NULL) { dbg("requested part of result string not found"); diff --git a/test/udev-test.pl b/test/udev-test.pl index e238c909fa..6e031c4c2c 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -191,16 +191,6 @@ EOF expected => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "select sysfs attribute by SYSFS{vendor}", - subsys => "block", - devpath => "block/sda", - expected => "disk-IBM-ESXS-sda" , - conf => < "block/sda/sda3", expected => "link1" , conf => < Date: Tue, 17 Feb 2004 01:31:42 -0800 Subject: [PATCH] add a "old style" SYSFS_attribute test to udev-test.pl --- test/udev-test.pl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 6e031c4c2c..f2f77dd0e4 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -191,6 +191,15 @@ EOF expected => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "old style SYSFS_ attribute", + subsys => "block", + devpath => "block/sda", + expected => "good" , + conf => < Date: Tue, 17 Feb 2004 18:17:50 -0800 Subject: [PATCH] udev - udevd/udevsend man page Here is the missing man page for udevd/udevsend. --- Makefile | 2 ++ udevd.8 | 36 ++++++++++++++++++++++++++++++++++++ udevinfo.8 | 2 +- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 udevd.8 diff --git a/Makefile b/Makefile index 936a6613f0..25881e1dd3 100644 --- a/Makefile +++ b/Makefile @@ -361,6 +361,8 @@ install: install-config install-dbus-policy all fi $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 + $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 + - ln -f -s ./udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 - rm -f $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug - rm -f $(udevdir)/.udev.tdb - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug diff --git a/udevd.8 b/udevd.8 new file mode 100644 index 0000000000..401e9b2ade --- /dev/null +++ b/udevd.8 @@ -0,0 +1,36 @@ +.TH UDEVD 8 "February 2004" "" "Linux Administrator's Manual" +.SH NAME +udevd \- udev event serializer daemon +.br +udevsend \- sends the event to udevd +.SH "DESCRIPTION" +.B udevd +allows the serialization of +.BR hotplug (8) +events. The events generated by the kernel may arrive in random order +in userspace, that makes it neccessary to reorder it. +.br +.B udevd +takes care of the kernel supplied sequence number and arranges the events for +execution in the correct order. Missing sequences are delaying the +execution of the following events until a timeout of a maximum of 5 seconds +is reached. +.br +For each event a +.BR udev (8) +instance is executed in the background. All further events for the same device +are delayed until the execution is finished. This way it will never run more +than one instance for a single device. +.br +.B udevd +receives the events from +.B udevsend +which is called by +.BR hotplug (8) + +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevd +was developed primarily by Kay Sievers , with much help +from others. diff --git a/udevinfo.8 b/udevinfo.8 index 67d034aea6..1716d17434 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -1,4 +1,4 @@ -.TH UDEVINFO 8 "October 2003" "" "Linux Administrator's Manual" +.TH UDEVINFO 8 "January 2004" "" "Linux Administrator's Manual" .SH NAME udevinfo \- retrieve information from udev .SH SYNOPSIS -- cgit v1.2.3-54-g00ecf From 20f86361f48da48b08e1b73b04e22ea098f64e72 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 17 Feb 2004 18:34:23 -0800 Subject: [PATCH] update the red hat init script to handle nodes that are not present Thanks to Gentoo for the list of these files. --- etc/init.d/udev | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/etc/init.d/udev b/etc/init.d/udev index 69c1bab74e..3f1430271b 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -1,6 +1,6 @@ #! /bin/bash # -# random init script to setup /udev +# udev init script to setup /udev # # chkconfig: 2345 20 80 # description: manage user-space device nodes in /udev @@ -12,6 +12,7 @@ prog=udev sysfs_dir=/sys bin=/sbin/udev +udev_root=/udev run_udev () { # handle block devices and their partitions @@ -42,9 +43,34 @@ run_udev () { return 0 } +make_extra_nodes () { + # there are a few things that sysfs does not export for us. + # these things go here (and remember to remove them in + # remove_extra_nodes() + # + # Thanks to Gentoo for the initial list of these. + ln -snf /proc/self/fd $udev_root/fd + ln -snf /proc/self/fd/0 $udev_root/stdin + ln -snf /proc/self/fd/1 $udev_root/stdout + ln -snf /proc/self/fd/2 $udev_root/stderr + ln -snf /proc/kcore $udev_root/core + #ln -snf /proc/asound/oss/sndstat $udev_root/sndstat +} + +remove_extra_nodes () { + # get rid of the extra nodes created in make_extra_nodes() + rm $udev_root/fd + rm $udev_root/stdin + rm $udev_root/stdout + rm $udev_root/stderr + rm $udev_root/core + #rm $udev_root/sndstat +} + case "$1" in start) - if [ ! -d $sysfs_dir ]; then + # don't use udev if sysfs is not mounted. + if [ ! -d $sysfs_dir/block ]; then exit 1 fi if [ ! -d $udev_root ]; then @@ -61,7 +87,8 @@ case "$1" in # device bring up export ACTION=add echo -n $"Creating initial udev device nodes:" - run_udev + run_udev + make_extra_nodes success /bin/true echo touch /var/lock/subsys/udev @@ -71,6 +98,7 @@ case "$1" in echo -n $"Removing udev device nodes: " export ACTION=remove run_udev + remove_extra_nodes success /bin/true echo rm -f /var/lock/subsys/udev -- cgit v1.2.3-54-g00ecf From ad63031e49abc18a961c4b4302312744a487f417 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 17 Feb 2004 19:02:39 -0800 Subject: [PATCH] udev - add %s{filename} to man page Add the new %s{filename} to the udev man page. And add the automatic start of udevd to the udevd man page. --- udev.8 | 7 +++++++ udevd.8 | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/udev.8 b/udev.8 index 9291f33242..603ca45cba 100644 --- a/udev.8 +++ b/udev.8 @@ -195,6 +195,13 @@ returned string. (This does not work within the .B PROGRAM field for the obvious reason.) +.br +A single part of the string, separated by the space character +my be selected by specifying the part number as a attribute: +.BI %c{ part } +.TP +.BI %s{ filename } +The content of a sysfs attribute. .TP .B %% The '%' char itself. diff --git a/udevd.8 b/udevd.8 index 401e9b2ade..59dc0206c2 100644 --- a/udevd.8 +++ b/udevd.8 @@ -20,16 +20,20 @@ For each event a .BR udev (8) instance is executed in the background. All further events for the same device are delayed until the execution is finished. This way it will never run more -than one instance for a single device. +than one instance for a single device at the same time. .br .B udevd receives the events from .B udevsend which is called by -.BR hotplug (8) - +.BR hotplug (8). +If +.B udevd +isn't already running, +.B udevsend +will start it. .SH "SEE ALSO" -.BR udev (8) +.BR udev (8), hotplug (8) .SH AUTHORS .B udevd was developed primarily by Kay Sievers , with much help -- cgit v1.2.3-54-g00ecf From 24f8f09876e426ab1b5a4b7c76f25eededbeaa11 Mon Sep 17 00:00:00 2001 From: "john-hotplug@fjellstad.org" Date: Tue, 17 Feb 2004 19:02:44 -0800 Subject: [PATCH] init.d debian patch I dualboot between 2.4.x and 2.6.x right now, and although I want udev to start up when 2.6 is booting, I don't want it to try when 2.4.x is booting. This is a small patch to not start up udev if sysfs is not mounted. --- etc/init.d/udev.debian | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/init.d/udev.debian b/etc/init.d/udev.debian index d67941cc13..776a73644c 100644 --- a/etc/init.d/udev.debian +++ b/etc/init.d/udev.debian @@ -61,7 +61,8 @@ case "$1" in if [ ! -d $udev_dir ]; then mkdir $udev_dir fi - if [ ! -d $sysfs_dir ]; then + # don't use udev if sysfs is not mounted + if [ ! -d $sysfs_dir/block ]; then exit 1 fi # propogate /udev from /sys - we only need this while we do not -- cgit v1.2.3-54-g00ecf From f01f8c667793ef10baac489cf845ba273fd023db Mon Sep 17 00:00:00 2001 From: "ext.devoteam.varoqui@sncf.fr" Date: Tue, 17 Feb 2004 19:07:56 -0800 Subject: [PATCH] update extras/multipath patch follows : * remove the restrictive -f flag. Introduce a more generic "-m iopolicy" one. * remove useless "int with_sysfs" in env struct --- extras/multipath/ChangeLog | 4 ++++ extras/multipath/main.c | 43 ++++++++++++++++++++++++------------------- extras/multipath/main.h | 2 +- 3 files changed, 29 insertions(+), 20 deletions(-) diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index 31f6c48f69..43aa497e51 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,3 +1,7 @@ +2004-02-17 multipath-017 + * remove the restrictive -f flag. + Introduce a more generic "-m iopolicy" one. + * remove useless "int with_sysfs" in env struct 2004-02-04 multipath-016 * add a GROUP_BY_SERIAL flag. This should be useful for controlers that activate they spare paths on simple IO diff --git a/extras/multipath/main.c b/extras/multipath/main.c index 6ea9a064e1..706b2d1317 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -509,8 +509,8 @@ setup_map(struct env * conf, struct path * all_paths, params_p += sprintf(params_p, "%i", conf->dm_path_test_int); - if (all_paths[PINDEX(index,0)].iopolicy == MULTIBUS && - !conf->forcedfailover ) { + if ((all_paths[PINDEX(index,0)].iopolicy == MULTIBUS && + conf->iopolicy == -1) || conf->iopolicy == MULTIBUS) { params_p += sprintf(params_p, " 1 %i %s %i %i", dm_pg_prio, dm_ps_name, np, dm_ps_nr_args); @@ -522,8 +522,8 @@ setup_map(struct env * conf, struct path * all_paths, } } - if (all_paths[PINDEX(index,0)].iopolicy == FAILOVER || - conf->forcedfailover) { + if ((all_paths[PINDEX(index,0)].iopolicy == FAILOVER && + conf->iopolicy == -1) || conf->iopolicy == FAILOVER) { params_p += sprintf(params_p, " %i", mp[index].npaths + 1); for (i=0; i<=mp[index].npaths; i++) { if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) @@ -537,8 +537,8 @@ setup_map(struct env * conf, struct path * all_paths, } } - if (all_paths[PINDEX(index,0)].iopolicy == GROUP_BY_SERIAL && - !conf->forcedfailover ) { + if ((all_paths[PINDEX(index,0)].iopolicy == GROUP_BY_SERIAL && + conf->iopolicy == -1) || conf->iopolicy == GROUP_BY_SERIAL) { group_by_serial(&mp[index], all_paths, params_p); } @@ -602,14 +602,18 @@ static void usage(char * progname) { fprintf(stderr, VERSION_STRING); - fprintf(stderr, "Usage: %s [-v|-q] [-d] [-i int] [-m max_devs]\n", + fprintf(stderr, "Usage: %s [-v|-q] [-d] [-i int] [-m max_devs] ", progname); + fprintf(stderr, "[-p failover|multibus|group_by_serial]\n"); + fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n"); + fprintf(stderr, "\t-q\t\tquiet, no output at all\n"); fprintf(stderr, "\t-d\t\tdry run, do not create or update devmaps\n"); - fprintf(stderr, "\t-f\t\tforce maps to failover mode (1 path/pg)\n"); fprintf(stderr, "\t-i\t\tmultipath target param : polling interval\n"); fprintf(stderr, "\t-m max_devs\tscan {max_devs} devices at most\n"); - fprintf(stderr, "\t-q\t\tquiet, no output at all\n"); - fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n"); + fprintf(stderr, "\t-p policy\tforce maps to specified policy :\n"); + fprintf(stderr, "\t\t\tfailover\t1 path per priority group\n"); + fprintf(stderr, "\t\t\tmultibus\tall paths in 1 priority group\n"); + fprintf(stderr, "\t\t\tgroup_by_serial\t1 priority group per serial\n"); exit(1); } @@ -627,13 +631,9 @@ main(int argc, char *argv[]) conf.dry_run = 0; /* 1 == Do not Create/Update devmaps */ conf.verbose = 0; /* 1 == Print all_paths and mp */ conf.quiet = 0; /* 1 == Do not even print devmaps */ - conf.with_sysfs = 0; /* Default to compat / suboptimal behaviour */ + conf.iopolicy = -1; /* Apply the defaults in get_unique_id() */ conf.dm_path_test_int = 10; - /* kindly provided by libsysfs */ - if (0 == sysfs_get_mnt_path(conf.sysfs_path, FILE_NAME_SIZE)) - conf.with_sysfs = 1; - for (i = 1; i < argc; ++i) { if (0 == strcmp("-v", argv[i])) { if (conf.quiet == 1) @@ -649,11 +649,16 @@ main(int argc, char *argv[]) conf.quiet = 1; } else if (0 == strcmp("-d", argv[i])) conf.dry_run = 1; - else if (0 == strcmp("-f", argv[i])) - conf.forcedfailover = 1; else if (0 == strcmp("-i", argv[i])) conf.dm_path_test_int = atoi(argv[++i]); - else if (0 == strcmp("scsi", argv[i])) + else if (0 == strcmp("-p", argv[i++])) { + if (!strcmp(argv[i], "failover")) + conf.iopolicy = FAILOVER; + if (!strcmp(argv[i], "multibus")) + conf.iopolicy = MULTIBUS; + if (!strcmp(argv[i], "group_by_serial")) + conf.iopolicy = GROUP_BY_SERIAL; + } else if (0 == strcmp("scsi", argv[i])) strcpy(conf.hotplugdev, argv[++i]); else if (*argv[i] == '-') { fprintf(stderr, "Unknown switch: %s\n", argv[i]); @@ -672,7 +677,7 @@ main(int argc, char *argv[]) if (mp == NULL || all_paths == NULL || all_scsi_ids == NULL) exit(1); - if (!conf.with_sysfs) { + if (sysfs_get_mnt_path(conf.sysfs_path, FILE_NAME_SIZE)) { get_all_scsi_ids(&conf, all_scsi_ids); get_all_paths_nosysfs(&conf, all_paths, all_scsi_ids); } else { diff --git a/extras/multipath/main.h b/extras/multipath/main.h index 731c55e41f..e05555599f 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -100,7 +100,7 @@ struct env { int verbose; int quiet; int dry_run; - int forcedfailover; + int iopolicy; int with_sysfs; int dm_path_test_int; char sysfs_path[FILE_NAME_SIZE]; -- cgit v1.2.3-54-g00ecf From 8fff7b42b45ef13946f7bc25308016d3dfdc63df Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 17 Feb 2004 19:31:33 -0800 Subject: [PATCH] start up udevd ourselves in the init script to give it some good priorities. --- etc/init.d/udev | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/init.d/udev b/etc/init.d/udev index 3f1430271b..cd9074de09 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -12,6 +12,7 @@ prog=udev sysfs_dir=/sys bin=/sbin/udev +udevd=/sbin/udevd udev_root=/udev run_udev () { @@ -89,6 +90,11 @@ case "$1" in echo -n $"Creating initial udev device nodes:" run_udev make_extra_nodes + + # We want to start udevd ourselves if it isn't already running. This + # lets udevd run at a sane nice level... + $udevd & + success /bin/true echo touch /var/lock/subsys/udev -- cgit v1.2.3-54-g00ecf From 961e47847cdb33b1fabe4084cef7cd37f73a19d1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 17 Feb 2004 20:59:26 -0800 Subject: [PATCH] add support for UDEV_NO_SLEEP env variable so Gentoo people will be happy. Actually, I'm happy to, startup time is much smaller... --- namedev.c | 6 ++++-- udev.h | 1 + udev_config.c | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 186a9f5cc2..90c85d41e4 100644 --- a/namedev.c +++ b/namedev.c @@ -623,7 +623,8 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de tspec.tv_nsec = 10000000; /* sleep 10 millisec */ loop = 10; while (loop--) { - nanosleep(&tspec, NULL); + if (udev_sleep) + nanosleep(&tspec, NULL); if (class_dev_parent) sysfs_device = sysfs_get_classdev_device(class_dev_parent); else @@ -650,7 +651,8 @@ device_found: loop = 10; tspec.tv_nsec = 10000000; while (loop--) { - nanosleep(&tspec, NULL); + if (udev_sleep) + nanosleep(&tspec, NULL); sysfs_get_device_bus(sysfs_device); if (sysfs_device->bus[0] != '\0') diff --git a/udev.h b/udev.h index e8f93ad5ad..1cd07852b4 100644 --- a/udev.h +++ b/udev.h @@ -78,5 +78,6 @@ extern char default_mode_str[MODE_SIZE]; extern char default_owner_str[OWNER_SIZE]; extern char default_group_str[GROUP_SIZE]; extern int udev_log; +extern int udev_sleep; #endif diff --git a/udev_config.c b/udev_config.c index 34ef82b881..6714c1b73d 100644 --- a/udev_config.c +++ b/udev_config.c @@ -49,6 +49,7 @@ char default_mode_str[MODE_SIZE]; char default_owner_str[OWNER_SIZE]; char default_group_str[GROUP_SIZE]; int udev_log; +int udev_sleep; static int string_is_true(char *str) @@ -71,6 +72,10 @@ static void init_variables(void) strfieldcpy(udev_rules_filename, UDEV_RULES_FILE); strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE); udev_log = string_is_true(UDEV_LOG_DEFAULT); + + udev_sleep = 1; + if (getenv("UDEV_NO_SLEEP") != NULL) + udev_sleep = 0; } #define set_var(_name, _var) \ -- cgit v1.2.3-54-g00ecf From 2152332ea77b4dfdf04693b2861a58264259ece9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 17 Feb 2004 21:35:56 -0800 Subject: [PATCH] add start_udev init script. --- extras/start_udev | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 extras/start_udev diff --git a/extras/start_udev b/extras/start_udev new file mode 100644 index 0000000000..caba5270c2 --- /dev/null +++ b/extras/start_udev @@ -0,0 +1,91 @@ +#! /bin/bash +# +# start_udev +# +# script to initialize /dev by using udev. +# +# This needs to be run at the earliest possible point in the boot +# process. +# +# Based on the udev init.d script +# + +. /etc/udev/udev.conf + +prog=udev +sysfs_dir=/sys +bin=/sbin/udev +udevd=/sbin/udevd + +run_udev () { + # handle block devices and their partitions + for i in ${sysfs_dir}/block/*; do + # add each drive + export DEVPATH=${i#${sysfs_dir}} + echo "$DEVPATH" + $bin block + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${sysfs_dir}} + echo "$DEVPATH" + $bin block + fi + done + done + # all other device classes + for i in ${sysfs_dir}/class/*; do + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${sysfs_dir}} + CLASS=`echo ${i#${sysfs_dir}} | \ + cut --delimiter='/' --fields=3-` + echo "$DEVPATH" + $bin $CLASS + fi + done + done + return 0 +} + +make_extra_nodes () { + # there are a few things that sysfs does not export for us. + # these things go here (and remember to remove them in + # remove_extra_nodes() + # + # Thanks to Gentoo for the initial list of these. + ln -snf /proc/self/fd $udev_root/fd + ln -snf /proc/self/fd/0 $udev_root/stdin + ln -snf /proc/self/fd/1 $udev_root/stdout + ln -snf /proc/self/fd/2 $udev_root/stderr + ln -snf /proc/kcore $udev_root/core + + mkdir $udev_root/pts + mkdir $udev_root/shm +} + +# don't use udev if sysfs is not mounted. +if [ ! -d $sysfs_dir/block ]; then + exit 1 +fi + +echo "mounting... ramfs at $udev_root" +mount -n -t ramfs none $udev_root + +# We want to start udevd ourselves if it isn't already running. This +# lets udevd run at a sane nice level... +echo "starting udevd" +$udevd & + +# propogate /udev from /sys +export ACTION=add +export UDEV_NO_SLEEP=1 +echo "Creating initial udev device nodes:" +run_udev + +echo "making extra nodes" +make_extra_nodes + +echo "udev startup is finished!" +exit 0 -- cgit v1.2.3-54-g00ecf From a638109dfa2e99c31c74ce107940c8171027ba2e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 17 Feb 2004 23:56:59 -0800 Subject: [PATCH] mv libsysfs/libsysfs.h to libsysfs/sysfs/libsysfs.h to make it easier to use. --- libsysfs/libsysfs.h | 276 ---------------------------------------------- libsysfs/sysfs/libsysfs.h | 276 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 276 insertions(+), 276 deletions(-) delete mode 100644 libsysfs/libsysfs.h create mode 100644 libsysfs/sysfs/libsysfs.h diff --git a/libsysfs/libsysfs.h b/libsysfs/libsysfs.h deleted file mode 100644 index 10faab92aa..0000000000 --- a/libsysfs/libsysfs.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - * libsysfs.h - * - * Header Definitions for libsysfs - * - * Copyright (C) IBM Corp. 2003 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#ifndef _LIBSYSFS_H_ -#define _LIBSYSFS_H_ - -#include -#include "dlist.h" - -/* - * Generic #defines go here.. - */ -#define SYSFS_FSTYPE_NAME "sysfs" -#define SYSFS_PROC_MNTS "/proc/mounts" -#define SYSFS_BUS_NAME "bus" -#define SYSFS_CLASS_NAME "class" -#define SYSFS_BLOCK_NAME "block" -#define SYSFS_DEVICES_NAME "devices" -#define SYSFS_DRIVERS_NAME "drivers" -#define SYSFS_NAME_ATTRIBUTE "name" -#define SYSFS_UNKNOWN "unknown" -#define SYSFS_PATH_ENV "SYSFS_PATH" - -#define SYSFS_PATH_MAX 255 -#define SYSFS_NAME_LEN 50 -#define SYSFS_BUS_ID_SIZE 20 - -#define SYSFS_METHOD_SHOW 0x01 /* attr can be read by user */ -#define SYSFS_METHOD_STORE 0x02 /* attr can be changed by user */ - -struct sysfs_attribute { - unsigned char *value; - unsigned short len; /* value length */ - unsigned short method; /* show and store */ - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; -}; - -struct sysfs_link { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - unsigned char target[SYSFS_PATH_MAX]; -}; - -struct sysfs_directory { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *subdirs; - struct dlist *links; - struct dlist *attributes; -}; - -struct sysfs_driver { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; -}; - -struct sysfs_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char bus_id[SYSFS_NAME_LEN]; - unsigned char bus[SYSFS_NAME_LEN]; - unsigned char driver_name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct sysfs_device *parent; - struct dlist *children; - struct sysfs_directory *directory; -}; - -struct sysfs_root_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; -}; - -struct sysfs_bus { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *drivers; - struct dlist *devices; - struct sysfs_directory *directory; -}; - -struct sysfs_class_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char classname[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct sysfs_class_device *parent; - struct sysfs_device *sysdevice; /* NULL if virtual */ - struct sysfs_driver *driver; /* NULL if not implemented */ - struct sysfs_directory *directory; -}; - -struct sysfs_class { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Function Prototypes - */ -extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); -extern int sysfs_remove_trailing_slash(unsigned char *path); -extern int sysfs_get_name_from_path(const unsigned char *path, - unsigned char *name, size_t len); -extern int sysfs_path_is_dir(const unsigned char *path); -extern int sysfs_path_is_link(const unsigned char *path); -extern int sysfs_path_is_file(const unsigned char *path); -extern int sysfs_get_link(const unsigned char *path, unsigned char *target, - size_t len); -extern struct dlist *sysfs_open_subsystem_list(unsigned char *name); -extern struct dlist *sysfs_open_bus_devices_list(unsigned char *name); -extern void sysfs_close_list(struct dlist *list); - -/* sysfs directory and file access */ -extern void sysfs_close_attribute(struct sysfs_attribute *sysattr); -extern struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path); -extern int sysfs_read_attribute(struct sysfs_attribute *sysattr); -extern int sysfs_read_attribute_value(const unsigned char *attrpath, - unsigned char *value, size_t vsize); -extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const unsigned char *new_value, size_t len); -extern unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, - const unsigned char * name); -extern int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir); -extern int sysfs_refresh_dir_links(struct sysfs_directory *sysdir); -extern int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir); -extern void sysfs_close_directory(struct sysfs_directory *sysdir); -extern struct sysfs_directory *sysfs_open_directory(const unsigned char *path); -extern int sysfs_read_dir_attributes(struct sysfs_directory *sysdir); -extern int sysfs_read_dir_links(struct sysfs_directory *sysdir); -extern int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir); -extern int sysfs_read_directory(struct sysfs_directory *sysdir); -extern int sysfs_read_all_subdirs(struct sysfs_directory *sysdir); -extern struct sysfs_directory *sysfs_get_subdirectory - (struct sysfs_directory *dir, unsigned char *subname); -extern void sysfs_close_link(struct sysfs_link *ln); -extern struct sysfs_link *sysfs_open_link(const unsigned char *lnpath); -extern struct sysfs_link *sysfs_get_directory_link(struct sysfs_directory *dir, - unsigned char *linkname); -extern struct sysfs_link *sysfs_get_subdirectory_link - (struct sysfs_directory *dir, unsigned char *linkname); -extern struct sysfs_attribute *sysfs_get_directory_attribute - (struct sysfs_directory *dir, unsigned char *attrname); -extern struct dlist *sysfs_get_dir_attributes(struct sysfs_directory *dir); -extern struct dlist *sysfs_get_dir_links(struct sysfs_directory *dir); -extern struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir); - -/* sysfs driver access */ -extern void sysfs_close_driver(struct sysfs_driver *driver); -extern struct sysfs_driver *sysfs_open_driver - (const unsigned char *drv_name, const unsigned char *bus_name); -extern struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path); -extern struct sysfs_attribute *sysfs_get_driver_attr - (struct sysfs_driver *drv, const unsigned char *name); -extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); -extern struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver); -extern struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver); -extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); -extern struct sysfs_device *sysfs_get_driver_device - (struct sysfs_driver *driver, const unsigned char *name); -extern struct dlist *sysfs_refresh_driver_attributes - (struct sysfs_driver *driver); -extern struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, - const unsigned char *drv, const unsigned char *attrib); - -/* generic sysfs device access */ -extern void sysfs_close_root_device(struct sysfs_root_device *root); -extern struct sysfs_root_device *sysfs_open_root_device - (const unsigned char *name); -extern struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root); -extern void sysfs_close_device(struct sysfs_device *dev); -extern struct sysfs_device *sysfs_open_device - (const unsigned char *bus_id, const unsigned char *bus); -extern struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev); -extern struct sysfs_device *sysfs_open_device_path(const unsigned char *path); -extern int sysfs_get_device_bus(struct sysfs_device *dev); -extern struct sysfs_attribute *sysfs_get_device_attr - (struct sysfs_device *dev, const unsigned char *name); -extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); -extern struct dlist *sysfs_refresh_device_attributes - (struct sysfs_device *device); -extern struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, - const unsigned char *bus_id, const unsigned char *attrib); - -/* generic sysfs bus access */ -extern void sysfs_close_bus(struct sysfs_bus *bus); -extern struct sysfs_bus *sysfs_open_bus(const unsigned char *name); -extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, - unsigned char *id); -extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - unsigned char *drvname); -extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); -extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); -extern struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus); -extern struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus); -extern struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, - unsigned char *attrname); -extern struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, - unsigned char *dev_id); -extern int sysfs_find_driver_bus(const unsigned char *driver, - unsigned char *busname, size_t bsize); - -/* generic sysfs class access */ -extern void sysfs_close_class_device(struct sysfs_class_device *dev); -extern struct sysfs_class_device *sysfs_open_class_device_path - (const unsigned char *path); -extern struct sysfs_class_device *sysfs_open_class_device - (const unsigned char *class, const unsigned char *name); -extern struct sysfs_device *sysfs_get_classdev_device - (struct sysfs_class_device *clsdev); -extern struct sysfs_driver *sysfs_get_classdev_driver - (struct sysfs_class_device *clsdev); -extern struct sysfs_class_device *sysfs_get_classdev_parent - (struct sysfs_class_device *clsdev); -extern void sysfs_close_class(struct sysfs_class *cls); -extern struct sysfs_class *sysfs_open_class(const unsigned char *name); -extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); -extern struct sysfs_class_device *sysfs_get_class_device - (struct sysfs_class *class, unsigned char *name); -extern struct dlist *sysfs_get_classdev_attributes - (struct sysfs_class_device *cdev); -extern struct dlist *sysfs_refresh_classdev_attributes - (struct sysfs_class_device *cdev); -extern struct sysfs_attribute *sysfs_get_classdev_attr - (struct sysfs_class_device *clsdev, const unsigned char *name); -extern struct sysfs_attribute *sysfs_open_classdev_attr - (const unsigned char *classname, const unsigned char *dev, - const unsigned char *attrib); - -#ifdef __cplusplus -} -#endif - -#endif /* _LIBSYSFS_H_ */ diff --git a/libsysfs/sysfs/libsysfs.h b/libsysfs/sysfs/libsysfs.h new file mode 100644 index 0000000000..10faab92aa --- /dev/null +++ b/libsysfs/sysfs/libsysfs.h @@ -0,0 +1,276 @@ +/* + * libsysfs.h + * + * Header Definitions for libsysfs + * + * Copyright (C) IBM Corp. 2003 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef _LIBSYSFS_H_ +#define _LIBSYSFS_H_ + +#include +#include "dlist.h" + +/* + * Generic #defines go here.. + */ +#define SYSFS_FSTYPE_NAME "sysfs" +#define SYSFS_PROC_MNTS "/proc/mounts" +#define SYSFS_BUS_NAME "bus" +#define SYSFS_CLASS_NAME "class" +#define SYSFS_BLOCK_NAME "block" +#define SYSFS_DEVICES_NAME "devices" +#define SYSFS_DRIVERS_NAME "drivers" +#define SYSFS_NAME_ATTRIBUTE "name" +#define SYSFS_UNKNOWN "unknown" +#define SYSFS_PATH_ENV "SYSFS_PATH" + +#define SYSFS_PATH_MAX 255 +#define SYSFS_NAME_LEN 50 +#define SYSFS_BUS_ID_SIZE 20 + +#define SYSFS_METHOD_SHOW 0x01 /* attr can be read by user */ +#define SYSFS_METHOD_STORE 0x02 /* attr can be changed by user */ + +struct sysfs_attribute { + unsigned char *value; + unsigned short len; /* value length */ + unsigned short method; /* show and store */ + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; +}; + +struct sysfs_link { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + unsigned char target[SYSFS_PATH_MAX]; +}; + +struct sysfs_directory { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *subdirs; + struct dlist *links; + struct dlist *attributes; +}; + +struct sysfs_driver { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *devices; + struct sysfs_directory *directory; +}; + +struct sysfs_device { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char bus_id[SYSFS_NAME_LEN]; + unsigned char bus[SYSFS_NAME_LEN]; + unsigned char driver_name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct sysfs_device *parent; + struct dlist *children; + struct sysfs_directory *directory; +}; + +struct sysfs_root_device { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *devices; + struct sysfs_directory *directory; +}; + +struct sysfs_bus { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *drivers; + struct dlist *devices; + struct sysfs_directory *directory; +}; + +struct sysfs_class_device { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char classname[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct sysfs_class_device *parent; + struct sysfs_device *sysdevice; /* NULL if virtual */ + struct sysfs_driver *driver; /* NULL if not implemented */ + struct sysfs_directory *directory; +}; + +struct sysfs_class { + unsigned char name[SYSFS_NAME_LEN]; + unsigned char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *devices; + struct sysfs_directory *directory; +}; + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Function Prototypes + */ +extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); +extern int sysfs_remove_trailing_slash(unsigned char *path); +extern int sysfs_get_name_from_path(const unsigned char *path, + unsigned char *name, size_t len); +extern int sysfs_path_is_dir(const unsigned char *path); +extern int sysfs_path_is_link(const unsigned char *path); +extern int sysfs_path_is_file(const unsigned char *path); +extern int sysfs_get_link(const unsigned char *path, unsigned char *target, + size_t len); +extern struct dlist *sysfs_open_subsystem_list(unsigned char *name); +extern struct dlist *sysfs_open_bus_devices_list(unsigned char *name); +extern void sysfs_close_list(struct dlist *list); + +/* sysfs directory and file access */ +extern void sysfs_close_attribute(struct sysfs_attribute *sysattr); +extern struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path); +extern int sysfs_read_attribute(struct sysfs_attribute *sysattr); +extern int sysfs_read_attribute_value(const unsigned char *attrpath, + unsigned char *value, size_t vsize); +extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, + const unsigned char *new_value, size_t len); +extern unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, + const unsigned char * name); +extern int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir); +extern int sysfs_refresh_dir_links(struct sysfs_directory *sysdir); +extern int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir); +extern void sysfs_close_directory(struct sysfs_directory *sysdir); +extern struct sysfs_directory *sysfs_open_directory(const unsigned char *path); +extern int sysfs_read_dir_attributes(struct sysfs_directory *sysdir); +extern int sysfs_read_dir_links(struct sysfs_directory *sysdir); +extern int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir); +extern int sysfs_read_directory(struct sysfs_directory *sysdir); +extern int sysfs_read_all_subdirs(struct sysfs_directory *sysdir); +extern struct sysfs_directory *sysfs_get_subdirectory + (struct sysfs_directory *dir, unsigned char *subname); +extern void sysfs_close_link(struct sysfs_link *ln); +extern struct sysfs_link *sysfs_open_link(const unsigned char *lnpath); +extern struct sysfs_link *sysfs_get_directory_link(struct sysfs_directory *dir, + unsigned char *linkname); +extern struct sysfs_link *sysfs_get_subdirectory_link + (struct sysfs_directory *dir, unsigned char *linkname); +extern struct sysfs_attribute *sysfs_get_directory_attribute + (struct sysfs_directory *dir, unsigned char *attrname); +extern struct dlist *sysfs_get_dir_attributes(struct sysfs_directory *dir); +extern struct dlist *sysfs_get_dir_links(struct sysfs_directory *dir); +extern struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir); + +/* sysfs driver access */ +extern void sysfs_close_driver(struct sysfs_driver *driver); +extern struct sysfs_driver *sysfs_open_driver + (const unsigned char *drv_name, const unsigned char *bus_name); +extern struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path); +extern struct sysfs_attribute *sysfs_get_driver_attr + (struct sysfs_driver *drv, const unsigned char *name); +extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); +extern struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver); +extern struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver); +extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); +extern struct sysfs_device *sysfs_get_driver_device + (struct sysfs_driver *driver, const unsigned char *name); +extern struct dlist *sysfs_refresh_driver_attributes + (struct sysfs_driver *driver); +extern struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, + const unsigned char *drv, const unsigned char *attrib); + +/* generic sysfs device access */ +extern void sysfs_close_root_device(struct sysfs_root_device *root); +extern struct sysfs_root_device *sysfs_open_root_device + (const unsigned char *name); +extern struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root); +extern void sysfs_close_device(struct sysfs_device *dev); +extern struct sysfs_device *sysfs_open_device + (const unsigned char *bus_id, const unsigned char *bus); +extern struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev); +extern struct sysfs_device *sysfs_open_device_path(const unsigned char *path); +extern int sysfs_get_device_bus(struct sysfs_device *dev); +extern struct sysfs_attribute *sysfs_get_device_attr + (struct sysfs_device *dev, const unsigned char *name); +extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); +extern struct dlist *sysfs_refresh_device_attributes + (struct sysfs_device *device); +extern struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, + const unsigned char *bus_id, const unsigned char *attrib); + +/* generic sysfs bus access */ +extern void sysfs_close_bus(struct sysfs_bus *bus); +extern struct sysfs_bus *sysfs_open_bus(const unsigned char *name); +extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, + unsigned char *id); +extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, + unsigned char *drvname); +extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); +extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); +extern struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus); +extern struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus); +extern struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, + unsigned char *attrname); +extern struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, + unsigned char *dev_id); +extern int sysfs_find_driver_bus(const unsigned char *driver, + unsigned char *busname, size_t bsize); + +/* generic sysfs class access */ +extern void sysfs_close_class_device(struct sysfs_class_device *dev); +extern struct sysfs_class_device *sysfs_open_class_device_path + (const unsigned char *path); +extern struct sysfs_class_device *sysfs_open_class_device + (const unsigned char *class, const unsigned char *name); +extern struct sysfs_device *sysfs_get_classdev_device + (struct sysfs_class_device *clsdev); +extern struct sysfs_driver *sysfs_get_classdev_driver + (struct sysfs_class_device *clsdev); +extern struct sysfs_class_device *sysfs_get_classdev_parent + (struct sysfs_class_device *clsdev); +extern void sysfs_close_class(struct sysfs_class *cls); +extern struct sysfs_class *sysfs_open_class(const unsigned char *name); +extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); +extern struct sysfs_class_device *sysfs_get_class_device + (struct sysfs_class *class, unsigned char *name); +extern struct dlist *sysfs_get_classdev_attributes + (struct sysfs_class_device *cdev); +extern struct dlist *sysfs_refresh_classdev_attributes + (struct sysfs_class_device *cdev); +extern struct sysfs_attribute *sysfs_get_classdev_attr + (struct sysfs_class_device *clsdev, const unsigned char *name); +extern struct sysfs_attribute *sysfs_open_classdev_attr + (const unsigned char *classname, const unsigned char *dev, + const unsigned char *attrib); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBSYSFS_H_ */ -- cgit v1.2.3-54-g00ecf From 0bad3406c1e8eba6d5af2cbfd44d8a61231fa2bb Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Tue, 17 Feb 2004 23:59:06 -0800 Subject: [PATCH] udev use new libsysfs header file location Use the new location of libsysfs header files. --- extras/scsi_id/scsi_id.c | 8 +------- extras/scsi_id/scsi_serial.c | 8 +------- libsysfs/sysfs_bus.c | 2 +- libsysfs/sysfs_class.c | 2 +- libsysfs/sysfs_device.c | 2 +- libsysfs/sysfs_dir.c | 2 +- libsysfs/sysfs_driver.c | 2 +- libsysfs/sysfs_utils.c | 2 +- namedev.c | 2 +- udev-add.c | 2 +- udev.c | 2 +- udev.h | 2 +- udev_config.c | 2 +- udevdb.c | 2 +- udevinfo.c | 2 +- udevtest.c | 2 +- 16 files changed, 16 insertions(+), 28 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 75a342bb12..2754381976 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -32,14 +32,8 @@ #include #include #include -#ifdef __KLIBC__ -/* - * Assume built under udev with KLIBC - */ -#include -#else #include -#endif + #include "scsi_id_version.h" #include "scsi_id.h" diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 80a1d51635..9fb0f05e61 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -31,14 +31,8 @@ #include #include #include -#ifdef __KLIBC__ -/* - * Assume built under udev with KLIBC - */ -#include -#else #include -#endif + #include "scsi_id.h" #include "scsi.h" diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index aca392875e..87318c0029 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "libsysfs.h" +#include "sysfs/libsysfs.h" #include "sysfs.h" static void sysfs_close_dev(void *dev) diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index cd86912142..05305056dd 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "libsysfs.h" +#include "sysfs/libsysfs.h" #include "sysfs.h" static void sysfs_close_cls_dev(void *dev) diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index bfd761b885..06b8d2d99a 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "libsysfs.h" +#include "sysfs/libsysfs.h" #include "sysfs.h" /** diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index ce01669754..050e674038 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "libsysfs.h" +#include "sysfs/libsysfs.h" #include "sysfs.h" /** diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index a4440cfdf9..cd202d9f23 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "libsysfs.h" +#include "sysfs/libsysfs.h" #include "sysfs.h" static void sysfs_close_driver_device(void *device) diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index f1f82361d0..2509c73c98 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "libsysfs.h" +#include "sysfs/libsysfs.h" #include "sysfs.h" #ifndef __KLIBC__ #include diff --git a/namedev.c b/namedev.c index 90c85d41e4..89513934ff 100644 --- a/namedev.c +++ b/namedev.c @@ -32,13 +32,13 @@ #include #include #include +#include #include "list.h" #include "udev.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" -#include "libsysfs/libsysfs.h" #include "klibc_fixups.h" static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr); diff --git a/udev-add.c b/udev-add.c index a3bc0df579..87cf57c3b6 100644 --- a/udev-add.c +++ b/udev-add.c @@ -33,6 +33,7 @@ #ifndef __KLIBC__ #include #endif +#include #include "udev.h" #include "udev_version.h" @@ -40,7 +41,6 @@ #include "logging.h" #include "namedev.h" #include "udevdb.h" -#include "libsysfs/libsysfs.h" #include "klibc_fixups.h" /* diff --git a/udev.c b/udev.c index ce6d6ce9df..f3fab18b29 100644 --- a/udev.c +++ b/udev.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "udev.h" #include "udev_version.h" @@ -33,7 +34,6 @@ #include "logging.h" #include "namedev.h" #include "udevdb.h" -#include "libsysfs/libsysfs.h" /* global variables */ char **main_argv; diff --git a/udev.h b/udev.h index 1cd07852b4..b5088b90c6 100644 --- a/udev.h +++ b/udev.h @@ -23,7 +23,7 @@ #ifndef UDEV_H #define UDEV_H -#include "libsysfs/libsysfs.h" +#include #include #include diff --git a/udev_config.c b/udev_config.c index 6714c1b73d..1d05a3fb13 100644 --- a/udev_config.c +++ b/udev_config.c @@ -31,12 +31,12 @@ #include #include #include +#include #include "udev.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" -#include "libsysfs/libsysfs.h" /* global variables */ char sysfs_path[SYSFS_PATH_MAX]; diff --git a/udevdb.c b/udevdb.c index e657fedcb2..bfd5b4bd69 100644 --- a/udevdb.c +++ b/udevdb.c @@ -32,6 +32,7 @@ #include #include #include +#include #include "udev_version.h" #include "udev.h" @@ -39,7 +40,6 @@ #include "namedev.h" #include "udevdb.h" #include "tdb/tdb.h" -#include "libsysfs/libsysfs.h" static TDB_CONTEXT *udevdb; diff --git a/udevinfo.c b/udevinfo.c index e4ea698111..7991855b28 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -26,12 +26,12 @@ #include #include #include +#include #include "udev.h" #include "udev_version.h" #include "logging.h" #include "udevdb.h" -#include "libsysfs/libsysfs.h" # define SYSFS_VALUE_MAX 200 diff --git a/udevtest.c b/udevtest.c index dd8375aa5c..175f143269 100644 --- a/udevtest.c +++ b/udevtest.c @@ -26,12 +26,12 @@ #include #include #include +#include #include "udev.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" -#include "libsysfs/libsysfs.h" /* global variables */ char **main_argv; -- cgit v1.2.3-54-g00ecf From b07ed5a7dcfc6d8b5eb98f97592267a6f35de820 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 18 Feb 2004 00:04:58 -0800 Subject: [PATCH] udev - TODO update Make TODO really small :) --- TODO | 8 -------- 1 file changed, 8 deletions(-) diff --git a/TODO b/TODO index dffa809df9..1a29adba0e 100644 --- a/TODO +++ b/TODO @@ -7,17 +7,9 @@ greg@kroah.com - more documentation (can never have too much.) -- better partition support (it's a hack right now, maybe new libsysfs changes - can help out a lot here.) -- option to always add all partitions. This is needed to properly handle - devices with removable media. - install the proper init.d script based on the distro we are running on. - persuade the distro packagers to submit their changes (or just steal them if we can find them...) -- allow database to be queried by other programs -- split program into two pieces (daemon and helper that sends events to it). - This will allow us to keep track of sequences, and lots of other needed - stuff. - keep track of current permissions on devices when daemon shuts down. - better permission handling - create kernel name to devfs name config file so that all of the devfs users -- cgit v1.2.3-54-g00ecf From de46ad1952a40911eeea9fd941f578b6dacc1cec Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 18 Feb 2004 23:54:01 -0800 Subject: [PATCH] add HOWTO detailing how to use udev to manage /dev --- HOWTO-udev_for_dev | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 HOWTO-udev_for_dev diff --git a/HOWTO-udev_for_dev b/HOWTO-udev_for_dev new file mode 100644 index 0000000000..75a858f22a --- /dev/null +++ b/HOWTO-udev_for_dev @@ -0,0 +1,73 @@ +HOWTO use udev to manage /dev + + This document describes one way to get udev working on a Fedora-development + machine to manage /dev. This procedure may be used to get udev to manage + /dev on other distros, if you modify some of the steps. + + This will only work if you use a 2.6 based kernel, preferably the most + recent one. This does not prevent your machine from using a 2.4 + kernel, if you boot into one, udev will not run and your old /dev will + be present with no changes needed. + + +NOTE NOTE NOTE NOTE NOTE NOTE NOTE + This is completely unsupported. Attempting to do this may cause your + machine to be unable to boot properly. USE AT YOUR OWN RISK. Always + have a rescue disk or CD handy to allow you to fix up any errors that + may occur. +NOTE NOTE NOTE NOTE NOTE NOTE NOTE + + + - Build and install udev as specified in the README that comes with + udev. I recommend using the following build options to get the + smallest possible binaries: + make USE_KLIBC=true USE_LOG=false DEBUG=false + + - disable udev from the boot process by running: + chkconfig udev off + or + chkconfig --del udev + as root. + + - place the start_udev script somewhere that is accessible by your + initscripts. I placed it into /etc/rc.d with the following command: + copy extras/start_udev /etc/rc.d/ + + - modify the rc.sysinit script to call the start_udev script as one of + the first things that it does, but after /proc and /sys are mounted. + I did this with the latest Fedora startup scripts with the patch at + the end of this file. + + - reboot into a 2.6 kernel and watch udev create all of the initial + device nodes in /dev + + +If anyone has any problems with this, please let me, and the +linux-hotplug-devel@lists.sourceforge.net mailing list know. + +A big thanks go out to the Gentoo developers for showing me that this is +possible to do. + +Greg Kroah-Hartman + + + +---------------------------------- +Patch to modify rc.sysinit to call udev at the beginning of the boot +process: + + +--- /etc/rc.sysinit.orig 2004-02-17 11:45:17.000000000 -0800 ++++ /etc/rc.sysinit 2004-02-17 13:28:33.000000000 -0800 +@@ -32,6 +32,9 @@ + + . /etc/init.d/functions + ++# start udev to populate /dev ++/etc/rc.d/start_udev ++ + if [ "$HOSTTYPE" != "s390" -a "$HOSTTYPE" != "s390x" ]; then + last=0 + for i in `LC_ALL=C grep '^[0-9].*respawn:/sbin/mingetty' /etc/inittab | sed 's/^.* tty\([0-9][0-9]*\).*/\1/g'`; do + + -- cgit v1.2.3-54-g00ecf From 7fdc5cb4454d21b3451d3492f45e3891e5780f75 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 18 Feb 2004 23:59:54 -0800 Subject: [PATCH] more HOWTO cleanups. --- HOWTO-udev_for_dev | 4 ++++ extras/start_udev | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/HOWTO-udev_for_dev b/HOWTO-udev_for_dev index 75a858f22a..a6d0892e37 100644 --- a/HOWTO-udev_for_dev +++ b/HOWTO-udev_for_dev @@ -38,6 +38,10 @@ NOTE NOTE NOTE NOTE NOTE NOTE NOTE I did this with the latest Fedora startup scripts with the patch at the end of this file. + - make sure the /etc/udev/udev.conf file lists the udev_root as /dev. + It should contain the following line in order to work properly. + udev_root="/dev/" + - reboot into a 2.6 kernel and watch udev create all of the initial device nodes in /dev diff --git a/extras/start_udev b/extras/start_udev index caba5270c2..3c39fc9260 100644 --- a/extras/start_udev +++ b/extras/start_udev @@ -4,11 +4,22 @@ # # script to initialize /dev by using udev. # +# Copyright (C) 2004 Greg Kroah-Hartman +# +# Released under the GPL v2 only. +# # This needs to be run at the earliest possible point in the boot # process. # # Based on the udev init.d script # +# Thanks go out to the Gentoo developers for proving +# that this is possible to do. +# +# Yes, it's very verbose, feel free to turn off all of the echo calls, +# they were there to make me feel better that everything was working +# properly during development... +# . /etc/udev/udev.conf -- cgit v1.2.3-54-g00ecf From 67632351ec672ea7891a43fbceec696690dd940b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 19 Feb 2004 17:43:43 -0800 Subject: [PATCH] add udevd priority issue to the TODO list. --- TODO | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TODO b/TODO index 1a29adba0e..a87f398a03 100644 --- a/TODO +++ b/TODO @@ -7,6 +7,9 @@ greg@kroah.com - more documentation (can never have too much.) +- have udevd move up to the "default" priority level if it is started by + keventd (otherwise it runs at a _very_ low priority level.) Don't + know if this is necessary, but it would be nice to do. - install the proper init.d script based on the distro we are running on. - persuade the distro packagers to submit their changes (or just steal them if we can find them...) -- cgit v1.2.3-54-g00ecf From 3217d739fb0fb17656dfdfc5d2a2aec389dcc811 Mon Sep 17 00:00:00 2001 From: "ext.devoteam.varoqui@sncf.fr" Date: Thu, 19 Feb 2004 17:45:37 -0800 Subject: [PATCH] symlink dm-[0-9]* rule --- etc/udev/udev.rules | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index e1c2cbe91e..6e6bf4786b 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -37,8 +37,9 @@ KERNEL="ttyUSB0", NAME="pl2303" # if this is a ide cdrom, name it the default name, and create a symlink to cdrom BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" -# device mapper creates its own device nodes so ignore these -KERNEL="dm-[0-9]*", NAME="" +# create a symlink named after the device map name +# note devmap_name comes with extras/multipath +KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" # DRI devices always go into a subdirectory (as per the LSB spec) KERNEL="card*", NAME="dri/card%n" -- cgit v1.2.3-54-g00ecf From 1d24d9977d46e20779e7d9d05f4b6aa6dcad28cc Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 19 Feb 2004 17:54:48 -0800 Subject: [PATCH] Create a udev.rules.examples file to hold odd udev.rules These are for examples only, not for everyone to use as they cause too many problems for different people when they are in the main udev.rules file. --- etc/udev/udev.rules | 36 ++--------------------- etc/udev/udev.rules.examples | 68 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 33 deletions(-) create mode 100644 etc/udev/udev.rules.examples diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 6e6bf4786b..370a961de1 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -1,38 +1,8 @@ # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. - -# Looking for scsi bus id 42:0:0:1 -BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" - -# A usb camera. -BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n" - -# USB Epson printer to be called lp_epson -BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" - -# USB HP printer to be called lp_hp -BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_hp" - -# sound card with PCI bus id 00:0b.0 to be the first sound card -BUS="pci", ID="00:0b.0", NAME="dsp" - -# sound card with PCI bus id 00:07.1 to be the second sound card -BUS="pci", ID="00:07.1", NAME="dsp1" - -# USB mouse plugged into the third port of the first hub to be called mouse0 -BUS="usb", PLACE="1.3", NAME="mouse0" - -# USB tablet plugged into the third port of the second hub to be called mouse1 -BUS="usb", PLACE="2.3", NAME="mouse1" -BUS="usb", PLACE="2.4", NAME="mouse2" - -# ttyUSB1 should always be called visor -KERNEL="ttyUSB1", NAME="visor" -KERNEL="ttyUSB0", NAME="pl2303" - -# a devfs like way to name some tty devices -#KERNEL="ttyS*", NAME="tts/%n" -#KERNEL="tty*", NAME="vc/%n" +# +# See the udev.rules.examples file for more examples of how to create rules +# # if this is a ide cdrom, name it the default name, and create a symlink to cdrom BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" diff --git a/etc/udev/udev.rules.examples b/etc/udev/udev.rules.examples new file mode 100644 index 0000000000..0d619e37e6 --- /dev/null +++ b/etc/udev/udev.rules.examples @@ -0,0 +1,68 @@ +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# +# These are some example rules that you could use to name your devices. +# +# If anyone has any other examples that they think should be in here for others +# to use, please send them to greg@kroah.com +# + +# Looking for scsi bus id 42:0:0:1 +BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" + +# A usb camera. +BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n" + +# USB Epson printer to be called lp_epson +BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" + +# USB HP printer to be called lp_hp +BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_hp" + +# sound card with PCI bus id 00:0b.0 to be the first sound card +BUS="pci", ID="00:0b.0", NAME="dsp" + +# sound card with PCI bus id 00:07.1 to be the second sound card +BUS="pci", ID="00:07.1", NAME="dsp1" + +# USB mouse plugged into the third port of the first hub to be called mouse0 +BUS="usb", PLACE="1.3", NAME="mouse0" + +# USB tablet plugged into the third port of the second hub to be called mouse1 +BUS="usb", PLACE="2.3", NAME="mouse1" +BUS="usb", PLACE="2.4", NAME="mouse2" + +# ttyUSB1 should always be called visor +KERNEL="ttyUSB1", NAME="visor" +KERNEL="ttyUSB0", NAME="pl2303" + +# a devfs like way to name some tty devices +KERNEL="ttyS*", NAME="tts/%n" +KERNEL="tty*", NAME="vc/%n" + +# if this is a ide cdrom, name it the default name, and create a symlink to cdrom +BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" + +# create a symlink named after the device map name +# note devmap_name comes with extras/multipath +KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" + +# DRI devices always go into a subdirectory (as per the LSB spec) +KERNEL="card*", NAME="dri/card%n" + +# alsa devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + +# input devices +KERNEL="mice", NAME="input/%k" +KERNEL="mouse*", NAME="input/%k" +KERNEL="event*", NAME="input/%k" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + -- cgit v1.2.3-54-g00ecf From e59d338c9685985fa9aed890cbb8bf3bb17160ee Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 19 Feb 2004 17:55:17 -0800 Subject: [PATCH] Update the Gentoo udev.rules and udev.permissions files These are very good devfs-like rules for others to use if they want to. --- etc/udev/udev.permissions.gentoo | 24 +++++++- etc/udev/udev.rules.gentoo | 120 +++++++++++++++++++++------------------ 2 files changed, 85 insertions(+), 59 deletions(-) diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo index c2016bc280..d5ef9eaa37 100644 --- a/etc/udev/udev.permissions.gentoo +++ b/etc/udev/udev.permissions.gentoo @@ -1,5 +1,5 @@ # /etc/udev/udev.permissions: permission/ownership map for udev -# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.permissions,v 1.2 2003/12/26 23:32:44 azarah Exp $ +# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.permissions,v 1.3 2004/01/01 03:41:24 azarah Exp $ # console devices console:root:tty:0600 @@ -34,6 +34,20 @@ vcsa:root:root:0600 vcsa[0-9]*:root:root:0600 vcc/*:root:root:0600 +# memory devices +random:root:root:0666 +urandom:root:root:0444 +mem:root:kmem:0640 +kmem:root:kmem:0640 +port:root:kmem:0640 +full:root:root:0666 +null:root:root:0666 +zero:root:root:0666 + +# misc devices +nvram:root:root:0660 +rtc:root:root:0660 + # floppy devices fd[01]*:root:floppy:0660 @@ -117,6 +131,9 @@ npt*:root:tape:0660 st*:root:tape:0660 nst*:root:tape:0660 +# dm devices +dm-*:root:root:0640 + # memstick devices memstick*:root:root:0600 @@ -135,10 +152,11 @@ fb[0-9]*:root:root:0600 fb/*:root:root:0600 # kbd devices -kbd:root:root:0600 +kbd:root:root:0644 # joystick devices -js[0-9]*:root:root:0600 +js[0-9]*:root:root:0644 +djs[0-9]*:root:root:0644 # v4l devices video*:root:video:0660 diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 7e8966961d..81c370e03e 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -1,52 +1,43 @@ # /etc/udev/udev.rules: device naming rules for udev -# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.rules,v 1.1 2003/12/26 23:32:44 azarah Exp $ -# -# There are a number of modifiers that are allowed to be used in the NAME or PROGRAM fields. -# They provide the following subsitutions: -# %n - the "kernel number" of the device. -# for example, 'sda3' has a "kernel number" of '3' -# %k - the kernel name for the device. -# %M - the kernel major number for the device -# %m - the kernel minor number for the device -# %b - the bus id for the device -# %c - the return value of the external PROGRAM (note, this doesn't work within -# the PROGRAM field for the obvious reason.) +# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.rules.post_012,v 1.5 2004/02/08 16:59:29 azarah Exp $ # +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. ########################################################### # -# Add your own rules here +# Add your own rules here (examples are commented) # ########################################################### # Looking for scsi bus id 42:0:0:1 -BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" +#BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" # A usb camera. -BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n" +#BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" # USB Epson printer to be called lp_epson -BUS="usb", SYSFS{serial}="HXOLL0012202323480", NAME="lp_epson" +#BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" # USB HP printer to be called lp_hp -BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_hp" +#BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" # sound card with PCI bus id 00:0b.0 to be the first sound card -BUS="pci", ID="00:0b.0", NAME="dsp" +#BUS="pci", ID="00:0b.0", NAME="dsp" # sound card with PCI bus id 00:07.1 to be the second sound card -BUS="pci", ID="00:07.1", NAME="dsp1" +#BUS="pci", ID="00:07.1", NAME="dsp1" # USB mouse plugged into the third port of the first hub to be called mouse0 -BUS="usb", PLACE="1.3", NAME="mouse0" +#BUS="usb", PLACE="1.3", NAME="mouse0" # USB tablet plugged into the third port of the second hub to be called mouse1 -BUS="usb", PLACE="2.3", NAME="mouse1" -BUS="usb", PLACE="2.4", NAME="mouse2" +#BUS="usb", PLACE="2.3", NAME="mouse1" +#BUS="usb", PLACE="2.4", NAME="mouse2" # ttyUSB1 should always be called visor -KERNEL="ttyUSB1", NAME="visor" -KERNEL="ttyUSB0", NAME="pl2303" +#KERNEL="ttyUSB1", NAME="visor" +#KERNEL="ttyUSB0", NAME="pl2303" ########################################################### @@ -57,33 +48,74 @@ KERNEL="ttyUSB0", NAME="pl2303" # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", RESULT="hd*", NAME="%c{1}", SYMLINK="%c{2} %c{3}" - +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%1c %2c" + +# alsa devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + +# dm devices (ignore them) +KERNEL="dm-[0-9]*", NAME="" +KERNEL="device-mapper", NAME="mapper/control" + # fb devices KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" +# floppy devices +KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" + +# i2c devices +KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" + +# input devices +KERNEL="mice", NAME="input/mice" +KERNEL="mouse[0-9]*", NAME="input/mouse%n" +KERNEL="event[0-9]*", NAME="input/event%n" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + # loop devices KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" # md block devices KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" +# misc devices +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" + # pty devices KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" -# ram devices +# ramdisk devices KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" +# sound devices +KERNEL="adsp", NAME="sound/adsp" SYMLINK="%k" +KERNEL="audio", NAME="sound/audio", SYMLINK="%k" +KERNEL="dsp", NAME="sound/dsp", SYMLINK="%k" +KERNEL="mixer", NAME="sound/mixer", SYMLINK="%k" +KERNEL="sequencer", NAME="sound/sequencer", SYMLINK="%k" +KERNEL="sequencer2", NAME="sound/sequencer2", SYMLINK="%k" + # tty devices -KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" -KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" # vc devices -KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" -KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" -KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" +KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" +KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" +KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" # v4l devices @@ -92,27 +124,3 @@ KERNEL="radio[0-9]*", NAME="v4l/radio%n" KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" -# dm devices (ignore them) -KERNEL="dm-[0-9]*", NAME="" - -# i2c devices -KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" - -# loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" - -# framebuffer devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" - -# misc devices -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" - -# alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" - -- cgit v1.2.3-54-g00ecf From 2b7289ae887af8ed6bbdf060f618a1cc560caffb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 19 Feb 2004 18:00:38 -0800 Subject: [PATCH] update udev.rules.gentoo with new config file format. --- etc/udev/udev.rules.gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 81c370e03e..0f871ca7ff 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -48,7 +48,7 @@ # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%1c %2c" +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" # alsa devices KERNEL="controlC[0-9]*", NAME="snd/%k" -- cgit v1.2.3-54-g00ecf From ca8e992c9b9e1a4f476573756d16cf0ebabebf28 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 19 Feb 2004 18:20:33 -0800 Subject: [PATCH] added scsi_id and some more documentation to the udev.spec file. --- udev.spec | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/udev.spec b/udev.spec index aa595962f7..553e58a783 100644 --- a/udev.spec +++ b/udev.spec @@ -27,6 +27,11 @@ # 1 - use LSB: etc/init.d/udev.init.LSB %define lsb 0 +# if we want to build the scsi_id "extra" package or not +# 0 - do not build the package +# 1 - build it +%define scsi_id 1 + Summary: A userspace implementation of devfs Name: udev Version: 017_bk @@ -67,7 +72,11 @@ make CC="gcc $RPM_OPT_FLAGS" \ %else DEBUG=false \ %endif - + EXTRAS=" \ +%if %{scsi_id} + extras/scsi_id \ +%endif +" %install make DESTDIR=$RPM_BUILD_ROOT install \ @@ -81,6 +90,11 @@ make DESTDIR=$RPM_BUILD_ROOT install \ %else USE_LSB=false \ %endif + EXTRAS=" \ +%if %{scsi_id} + extras/scsi_id \ +%endif +" %post /sbin/chkconfig --add udev @@ -95,7 +109,7 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%doc COPYING README TODO ChangeLog +%doc COPYING README TODO ChangeLog HOWTO* etc/udev/udev.rules.examples docs/* %attr(755,root,root) /sbin/udev %attr(755,root,root) /sbin/udevinfo %attr(755,root,root) /sbin/udevsend @@ -106,14 +120,25 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf %config(noreplace) %attr(0644,root,root) /etc/udev/udev.rules %config(noreplace) %attr(0644,root,root) /etc/udev/udev.permissions -%if %{dbus} - %config(noreplace) %attr(0644,root,root) /etc/dbus-1/system.d/udev_sysbus_policy.conf -%endif %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(755,root,root) /etc/init.d/udev %attr(0644,root,root) %{_mandir}/man8/udev*.8* +%if %{dbus} + %config(noreplace) %attr(0644,root,root) /etc/dbus-1/system.d/udev_sysbus_policy.conf +%endif + +%if %{scsi_id} + %attr(755,root,root) /sbin/scsi_id + %config(noreplace) %attr(0644,root,root) /etc/scsi_id.config + %attr(0644,root,root) %{_mandir}/man8/scsi_id*.8* +%endif + %changelog +* Thu Feb 19 2004 Greg Kroah-Hartman +- add some more files to the documentation directory +- add ability to build scsi_id and make it the default + * Mon Feb 16 2004 Greg Kroah-Hartman - fix up udevd build, as it's no longer needed to be build seperatly - add udevtest to list of files -- cgit v1.2.3-54-g00ecf From 9e5a55213067422a6355b538d15b72de320d93bc Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 19 Feb 2004 18:35:19 -0800 Subject: [PATCH] v018 release --- ChangeLog | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ad5f63ace..bcc22c2328 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,53 @@ +Summary of changes from v017 to v018 +============================================ + +: + o [PATCH] symlink dm-[0-9]* rule + o update extras/multipath + +: + o init.d debian patch + +Kay Sievers: + o udev - TODO update + o udev - add %s{filename} to man page + o udev - udevd/udevsend man page + o udev - switch callout part selector to {attribute} + o udev - switch SYSFS_file to SYSFS{file} + o udev - create all partitions of blockdevice + o allow SYSFS{file} + o Adding '%s' format specifier to NAME and SYMLINK + +Greg Kroah-Hartman: + o added some scsi_id files to the bk ignore file + o added scsi_id and some more documentation to the udev.spec file + o update udev.rules.gentoo with new config file format + o Update the Gentoo udev.rules and udev.permissions files + o Create a udev.rules.examples file to hold odd udev.rules + o add udevd priority issue to the TODO list + o more HOWTO cleanups + o add HOWTO detailing how to use udev to manage /dev + o mv libsysfs/libsysfs.h to libsysfs/sysfs/libsysfs.h to make it easier to use + o add start_udev init script + o add support for UDEV_NO_SLEEP env variable so Gentoo people will be happy + o start up udevd ourselves in the init script to give it some good priorities + o update the red hat init script to handle nodes that are not present + o add a "old style" SYSFS_attribute test to udev-test.pl + o Have udevsend report more info in debug mode + o Have udevd report it's version in debug mode + o fix up bug created for udevtest in previous partition creation patch + o update the udev.spec to add udevtest and make some more Red Hat suggested changes + o add ability to install udevtest to Makefile + o 017_bk mark + o Add another test to udev-test.pl and fix a bug when only running 1 test + o Fix bug where we did not use the "converted" kernel name if we had no rule + o v017 release TAG: v017 + +Patrick Mansfield: + o udev use new libsysfs header file location + o udev add some ID tests + + Summary of changes from v016 to v017 ============================================ diff --git a/Makefile b/Makefile index 25881e1dd3..8ee84d09b9 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ DAEMON = udevd SENDER = udevsend HELPER = udevinfo TESTER = udevtest -VERSION = 017_bk +VERSION = 018 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 553e58a783..bfa633ba66 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 017_bk +Version: 018 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 286903679a6cd4cfa9f5e7eed49f0bb8f059109e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 20 Feb 2004 01:06:41 -0800 Subject: [PATCH] remove udevd priority TODO item, as it's not needed at all. We want to be started by keventd, as that runs at a very fast priority. --- TODO | 3 --- extras/start_udev | 5 ----- 2 files changed, 8 deletions(-) diff --git a/TODO b/TODO index a87f398a03..1a29adba0e 100644 --- a/TODO +++ b/TODO @@ -7,9 +7,6 @@ greg@kroah.com - more documentation (can never have too much.) -- have udevd move up to the "default" priority level if it is started by - keventd (otherwise it runs at a _very_ low priority level.) Don't - know if this is necessary, but it would be nice to do. - install the proper init.d script based on the distro we are running on. - persuade the distro packagers to submit their changes (or just steal them if we can find them...) diff --git a/extras/start_udev b/extras/start_udev index 3c39fc9260..5a7bc63515 100644 --- a/extras/start_udev +++ b/extras/start_udev @@ -84,11 +84,6 @@ fi echo "mounting... ramfs at $udev_root" mount -n -t ramfs none $udev_root -# We want to start udevd ourselves if it isn't already running. This -# lets udevd run at a sane nice level... -echo "starting udevd" -$udevd & - # propogate /udev from /sys export ACTION=add export UDEV_NO_SLEEP=1 -- cgit v1.2.3-54-g00ecf From d54fe24caa38ffc6e5dee7ef5cdcb3c24a882bf8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 20 Feb 2004 01:10:29 -0800 Subject: [PATCH] 018_bk mark --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8ee84d09b9..a4bba06d55 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ DAEMON = udevd SENDER = udevsend HELPER = udevinfo TESTER = udevtest -VERSION = 018 +VERSION = 018_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index bfa633ba66..63d1835a4a 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 018 +Version: 018_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 75a7b641ab766b14f4e5f3689b47486c7fdba694 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 20 Feb 2004 01:33:49 -0800 Subject: [PATCH] remove udevtest on 'make clean' --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index a4bba06d55..3b44b23359 100644 --- a/Makefile +++ b/Makefile @@ -278,7 +278,7 @@ $(SENDER): $(SENDER).o udevd.h $(LIBC) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(HELPER) $(DAEMON) $(SENDER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(HELPER) $(DAEMON) $(SENDER) $(TESTER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ -- cgit v1.2.3-54-g00ecf From df41554d990fd9e69495253b4dc1979c6cd8621f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 23 Feb 2004 19:06:49 -0800 Subject: [PATCH] fix up libsysfs header file usage to fix bug reports from users that have sysfsutils installed already. --- libsysfs/sysfs.h | 1 + libsysfs/sysfs/libsysfs.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 49c9285bc3..1b800ddcd2 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -31,6 +31,7 @@ #include #include #include +#include "dlist.h" /* Debugging */ #ifdef DEBUG diff --git a/libsysfs/sysfs/libsysfs.h b/libsysfs/sysfs/libsysfs.h index 10faab92aa..f3d2dd4d16 100644 --- a/libsysfs/sysfs/libsysfs.h +++ b/libsysfs/sysfs/libsysfs.h @@ -24,7 +24,6 @@ #define _LIBSYSFS_H_ #include -#include "dlist.h" /* * Generic #defines go here.. @@ -47,6 +46,8 @@ #define SYSFS_METHOD_SHOW 0x01 /* attr can be read by user */ #define SYSFS_METHOD_STORE 0x02 /* attr can be changed by user */ +struct dlist; + struct sysfs_attribute { unsigned char *value; unsigned short len; /* value length */ -- cgit v1.2.3-54-g00ecf From c80da5085f915bf6305e7ed6b786b63f6e9b14ea Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 23 Feb 2004 19:07:25 -0800 Subject: [PATCH] force udev to include the internal version of libsysfs and never the external one. Should fix some more build bugs... --- namedev.c | 2 +- udev-add.c | 2 +- udev.c | 2 +- udev_config.c | 2 +- udevdb.c | 2 +- udevinfo.c | 3 ++- udevtest.c | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) diff --git a/namedev.c b/namedev.c index 89513934ff..2f9d8f5f67 100644 --- a/namedev.c +++ b/namedev.c @@ -32,8 +32,8 @@ #include #include #include -#include +#include "libsysfs/sysfs/libsysfs.h" #include "list.h" #include "udev.h" #include "udev_version.h" diff --git a/udev-add.c b/udev-add.c index 87cf57c3b6..736316629f 100644 --- a/udev-add.c +++ b/udev-add.c @@ -33,8 +33,8 @@ #ifndef __KLIBC__ #include #endif -#include +#include "libsysfs/sysfs/libsysfs.h" #include "udev.h" #include "udev_version.h" #include "udev_dbus.h" diff --git a/udev.c b/udev.c index f3fab18b29..8c91ac62d4 100644 --- a/udev.c +++ b/udev.c @@ -26,8 +26,8 @@ #include #include #include -#include +#include "libsysfs/sysfs/libsysfs.h" #include "udev.h" #include "udev_version.h" #include "udev_dbus.h" diff --git a/udev_config.c b/udev_config.c index 1d05a3fb13..cade81cf20 100644 --- a/udev_config.c +++ b/udev_config.c @@ -31,8 +31,8 @@ #include #include #include -#include +#include "libsysfs/sysfs/libsysfs.h" #include "udev.h" #include "udev_version.h" #include "logging.h" diff --git a/udevdb.c b/udevdb.c index bfd5b4bd69..f9fca4ab70 100644 --- a/udevdb.c +++ b/udevdb.c @@ -32,8 +32,8 @@ #include #include #include -#include +#include "libsysfs/sysfs/libsysfs.h" #include "udev_version.h" #include "udev.h" #include "logging.h" diff --git a/udevinfo.c b/udevinfo.c index 7991855b28..b94376c9ce 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -26,8 +26,9 @@ #include #include #include -#include +#include "libsysfs/sysfs/libsysfs.h" +#include "libsysfs/dlist.h" #include "udev.h" #include "udev_version.h" #include "logging.h" diff --git a/udevtest.c b/udevtest.c index 175f143269..4956758636 100644 --- a/udevtest.c +++ b/udevtest.c @@ -26,8 +26,8 @@ #include #include #include -#include +#include "libsysfs/sysfs/libsysfs.h" #include "udev.h" #include "udev_version.h" #include "logging.h" -- cgit v1.2.3-54-g00ecf From 82962619c626edfc68d39f0b179a909dd3dd0a6b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 23 Feb 2004 19:29:32 -0800 Subject: [PATCH] udev - simple klibc textual uid/gid handling Here we get a very dumb getpwnam() and getgrnam() for klibc to stop the confusion of not handling textual id's if klibc is used. If used with initrd we just need to copy the /etc/passwd and /etc/group file and all should work well. --- klibc_fixups.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ klibc_fixups.h | 25 +++++---------- 2 files changed, 108 insertions(+), 17 deletions(-) diff --git a/klibc_fixups.c b/klibc_fixups.c index a99166811c..927f2f649a 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -1,10 +1,110 @@ +/* + * klibc_fixups.c - very simple implementation of stuff missing in klibc + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ #ifdef __KLIBC__ #include +#include #include #include #include + #include "klibc_fixups.h" +#include "logging.h" + +#define PW_FILE "/etc/passwd" +#define GR_FILE "/etc/group" + +/* return the id of a passwd style line, selected by the users name */ +static unsigned long get_id_by_name(const char *uname, const char *dbfile) +{ + unsigned long id = -1; + FILE *file; + char buf[255]; + char *pos; + char *name; + char *idstr; + char *tail; + + file = fopen(dbfile, "r"); + if (file == NULL) { + dbg("unable to open file '%s'", dbfile); + return -1; + } + + while (1) { + pos = fgets(buf, sizeof(buf), file); + if (pos == NULL) + break; + + /* get name */ + name = strsep(&pos, ":"); + if (name == NULL) + continue; + + /* skip pass */ + if (strsep(&pos, ":") == NULL) + continue; + + /* get id */ + idstr = strsep(&pos, ":"); + if (idstr == NULL) + continue; + + if (strcmp(uname, name) == 0) { + id = strtoul(idstr, &tail, 10); + if (tail == NULL) + id = -1; + else + dbg("id for '%s' is '%li'", name, id); + break; + } + } + + fclose(file); + return id; +} + +struct passwd *getpwnam(const char *name) +{ + static struct passwd pw; + + memset(&pw, 0x00, sizeof(struct passwd)); + pw.pw_uid = (uid_t) get_id_by_name(name, PW_FILE); + if (pw.pw_uid < 0) + return NULL; + else + return &pw; +} + +struct group *getgrnam(const char *name) +{ + static struct group gr; + + memset(&gr, 0x00, sizeof(struct group)); + gr.gr_gid = (gid_t) get_id_by_name(name, GR_FILE); + if (gr.gr_gid < 0) + return NULL; + else + return &gr; +} #endif diff --git a/klibc_fixups.h b/klibc_fixups.h index 1ac112b087..19bfd51caa 100644 --- a/klibc_fixups.h +++ b/klibc_fixups.h @@ -3,19 +3,6 @@ #ifndef KLIBC_FIXUPS_H #define KLIBC_FIXUPS_H -struct group { - char *gr_name; /* group name */ - char *gr_passwd; /* group password */ - gid_t gr_gid; /* group id */ - char **gr_mem; /* group members */ -}; - -static inline struct group *getgrnam(const char *name) -{ - return NULL; -} - - struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ @@ -26,11 +13,15 @@ struct passwd { char *pw_shell; /* shell program */ }; -static inline struct passwd *getpwnam(const char *name) -{ - return NULL; -} +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; +struct passwd *getpwnam(const char *name); +struct group *getgrnam(const char *name); #endif -- cgit v1.2.3-54-g00ecf From e41245cb256231ef6954b3cbf45f0635d01501ed Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 23 Feb 2004 19:31:14 -0800 Subject: [PATCH] udev - allow all files in a directory as the config I was on the train for 5 hours today and the TODO is almost empty :) So, at least four people wanted this feature, then here is a actual working patch. We may specify now in udev.conf: udev_rules="/etc/udev/" and udev will scan the whole directory for files ending with *.rules, sort it in lexical order and create our rule list from all of the files. A plain given file will still work and the same applies to the *.permissions. I sort the files in our usual linked list, cause klibc has no scandir(). --- namedev.h | 4 ++- namedev_parse.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++----- udev.c | 8 +++-- 3 files changed, 107 insertions(+), 12 deletions(-) diff --git a/namedev.h b/namedev.h index 10a5dcaf0c..ffdde83ca4 100644 --- a/namedev.h +++ b/namedev.h @@ -48,10 +48,12 @@ struct sysfs_class_device; #define ATTR_PARTITIONS "all_partitions" #define PARTITIONS_COUNT 15 - #define PROGRAM_MAXARG 10 #define MAX_SYSFS_PAIRS 5 +#define RULEFILE_EXT ".rules" +#define PERMFILE_EXT ".permissions" + struct sysfs_pair { char file[FILE_SIZE]; char value[VALUE_SIZE]; diff --git a/namedev_parse.c b/namedev_parse.c index d5d2181cb6..013878c679 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -33,12 +33,16 @@ #include #include #include +#include +#include #include #include "udev.h" #include "logging.h" #include "namedev.h" +LIST_HEAD(file_list); + static int add_config_dev(struct config_device *new_dev) { struct config_device *tmp_dev; @@ -114,7 +118,7 @@ static char *get_key_attribute(char *str) return NULL; } -int namedev_init_rules(void) +static int namedev_parse_rules(char *filename) { char line[255]; int lineno; @@ -127,11 +131,11 @@ int namedev_init_rules(void) int retval = 0; struct config_device dev; - fd = fopen(udev_rules_filename, "r"); + fd = fopen(filename, "r"); if (fd != NULL) { - dbg("reading '%s' as rules file", udev_rules_filename); + dbg("reading '%s' as rules file", filename); } else { - dbg("can't open '%s' as a rules file", udev_rules_filename); + dbg("can't open '%s' as a rules file", filename); return -ENODEV; } @@ -262,7 +266,7 @@ int namedev_init_rules(void) continue; error: dbg("%s:%d:%d: parse error, rule skipped", - udev_rules_filename, lineno, temp - line); + filename, lineno, temp - line); } } exit: @@ -270,7 +274,7 @@ exit: return retval; } -int namedev_init_permissions(void) +static int namedev_parse_permissions(char *filename) { char line[255]; char *temp; @@ -279,11 +283,11 @@ int namedev_init_permissions(void) int retval = 0; struct perm_device dev; - fd = fopen(udev_permissions_filename, "r"); + fd = fopen(filename, "r"); if (fd != NULL) { - dbg("reading '%s' as permissions file", udev_permissions_filename); + dbg("reading '%s' as permissions file", filename); } else { - dbg("can't open '%s' as permissions file", udev_permissions_filename); + dbg("can't open '%s' as permissions file", filename); return -ENODEV; } @@ -352,3 +356,88 @@ exit: return retval; } +struct files { + struct list_head list; + char name[NAME_SIZE]; +}; + +/* sort files in lexical order */ +static int file_list_insert(char *filename) +{ + struct files *loop_file; + struct files *new_file; + + list_for_each_entry(loop_file, &file_list, list) { + if (strcmp(loop_file->name, filename) > 0) { + break; + } + } + + new_file = malloc(sizeof(struct files)); + if (new_file == NULL) { + dbg("error malloc"); + return -ENOMEM; + } + + strfieldcpy(new_file->name, filename); + list_add_tail(&new_file->list, &loop_file->list); + return 0; +} + +/* calls function for file or every file found in directory */ +static int call_foreach_file(int parser (char *f) , char *filename, char *extension) +{ + struct dirent *ent; + DIR *dir; + char *ext; + char file[NAME_SIZE]; + struct stat stats; + struct files *loop_file; + struct files *tmp_file; + + /* look if we have a plain file or a directory to scan */ + stat(filename, &stats); + if ((stats.st_mode & S_IFMT) != S_IFDIR) + return parser(filename); + + /* sort matching filename into list */ + dbg("open config as directory '%s'", filename); + dir = opendir(filename); + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + + dbg("found file '%s'", ent->d_name); + ext = strrchr(ent->d_name, '.'); + if (ext == NULL) + continue; + + if (strcmp(ext, extension) == 0) { + dbg("put file in list '%s'", ent->d_name); + file_list_insert(ent->d_name); + } + } + + /* parse every file in the list */ + list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { + strfieldcpy(file, filename); + strcat(file, loop_file->name); + parser(file); + list_del(&loop_file->list); + free(loop_file); + } + + closedir(dir); + return 0; +} + +int namedev_init_rules() +{ + return call_foreach_file(namedev_parse_rules, udev_rules_filename, RULEFILE_EXT); +} + +int namedev_init_permissions() +{ + return call_foreach_file(namedev_parse_permissions, udev_permissions_filename, PERMFILE_EXT); +} diff --git a/udev.c b/udev.c index 8c91ac62d4..1c65f2e59c 100644 --- a/udev.c +++ b/udev.c @@ -111,13 +111,13 @@ static int udev_hotplug(int argc, char **argv) action = get_action(); if (!action) { - dbg ("no action?"); + dbg("no action?"); goto exit; } devpath = get_devpath(); if (!devpath) { - dbg ("no devpath?"); + dbg("no devpath?"); goto exit; } dbg("looking at '%s'", devpath); @@ -131,6 +131,10 @@ static int udev_hotplug(int argc, char **argv) /* skip blacklisted subsystems */ subsystem = argv[1]; + if (!subsystem) { + dbg("no subsystem?"); + goto exit; + } i = 0; while (subsystem_blacklist[i][0] != '\0') { if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { -- cgit v1.2.3-54-g00ecf From 7b7e4df57ba0109d8c90db84b1663f5f25427ce1 Mon Sep 17 00:00:00 2001 From: "arvidjaar@mail.ru" Date: Mon, 23 Feb 2004 19:31:19 -0800 Subject: [PATCH] do not remove real .udev.tdb during RPM build --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3b44b23359..8ab9099f4f 100644 --- a/Makefile +++ b/Makefile @@ -364,7 +364,7 @@ install: install-config install-dbus-policy all $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 - ln -f -s ./udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 - rm -f $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug - - rm -f $(udevdir)/.udev.tdb + - rm -f $(DESTDIR)$(udevdir)/.udev.tdb - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ -- cgit v1.2.3-54-g00ecf From 167a27e70f4010fdce561cff2ea1a07730aae28a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 26 Feb 2004 19:35:38 -0800 Subject: [PATCH] manpage update Nice, here is the corresponding man update which also removes the mention of the limitation of getgrname() and friends with klibc. --- udev.8 | 37 ++++++++++++++++++++----------------- udevd.8 | 2 +- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/udev.8 b/udev.8 index 603ca45cba..d7999aadfd 100644 --- a/udev.8 +++ b/udev.8 @@ -35,7 +35,7 @@ lines, and lines beginning with a '#' will be ignored. .B udev expects its main configuration file at -.I /etc/udev/udev.conf. +.IR /etc/udev/udev.conf . The file consists of a set of variables and values that allow the user to override default udev values. The current set of variables that can be overridden in this file is: @@ -43,39 +43,46 @@ overridden in this file is: .B udev_root This is the where in the filesystem to place the device nodes. The default value for this is -.I /udev/ +.IR /udev/ . .TP .B udev_db The name and location of the udev database. The default value for this is -.I /udev/.udev.tdb +.IR /udev/.udev.tdb . .TP .B udev_rules This is the location of the udev rules file. The default value for this is -.I /etc/udev/udev.rules +.IR /etc/udev/udev.rules . +If a directory is specified, the whole directory is +scanned for files ending with +.I .rules +and all rule files are read in lexical order. .TP .B udev_permissions -This is the location of the udev permission file. The default value for this is -.I /etc/udev/udev.permissions +This is the location of the udev permission file. The default value for this is +.IR /etc/udev/udev.permissions . +If a directory is specified, the whole directory is scanned for files ending with +.I .permissions +and all permission files are read in lexical order. .TP .B udev_log If you want udev to log some information to the syslog for every node created or removed. The default value for this is -.I yes +.IR yes . .TP .B default_mode This is the default mode for all nodes that have no explicit match in the permissions file. The default value for this is -.I 0666 +.IR 0666 . .TP .B default_owner This is the default owner for all nodes that have no explicit match in the permissions file. The default value for this is -.I root +.IR root . .TP .B default_group This is the default group for all nodes that have no explicit match in the permissions file. The default value for this is -.I root +.IR root . .br .P .RI "A sample " udev.conf " might look like this: @@ -87,8 +94,9 @@ udev_root="/udev/" # udev_db - The name and location of the udev database. udev_db="/udev/.udev.tdb" -# udev_rules - The name and location of the udev rules file -udev_rules="/etc/udev/udev.rules" +# udev_rules - The location of the directory where to look for files + which names ending with .rules +udev_rules="/etc/udev/" # udev_permissions - The name and location of the udev permission file udev_permissions="/etc/udev/udev.permissions" @@ -242,11 +250,6 @@ file. Every line lists a device name followed by owner, group and permission mode. All values are separated by colons. The name field may contain a pattern to apply the values to a whole class of devices. -.br -If -.B udev -was built using klibc or is used before the user database is accessible (e.g. -.BR initrd "(4)), only numeric owner and group values may be used." .sp .RI "A sample " udev.permissions " might look like this:" .sp diff --git a/udevd.8 b/udevd.8 index 59dc0206c2..ab13a31107 100644 --- a/udevd.8 +++ b/udevd.8 @@ -33,7 +33,7 @@ isn't already running, .B udevsend will start it. .SH "SEE ALSO" -.BR udev (8), hotplug (8) +.BR udev (8), " hotplug" (8) .SH AUTHORS .B udevd was developed primarily by Kay Sievers , with much help -- cgit v1.2.3-54-g00ecf From c472e3c89b9aaad90ad6398c0d2ff5dcf5a9d238 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 26 Feb 2004 19:37:47 -0800 Subject: [PATCH] udev - safer string handling all over the place On Tue, Feb 24, 2004 at 11:50:52PM +0100, Kay Sievers wrote: > Here is the first step towards a safer string handling. > More will follow, but for now only the easy ones :) > > Thanks to all who pointed this out. strncat() isn't a nice function. We > all should remember that the destination string is not terminated if the > given lenght is shorter than the strlen of the source string. > > And shame on the various implementers of strfieldcat() I found in the > unapplied patches on this list, it's not really better than strncpy() > and hides the real problem. Hmm, bk didn't checked in one file, maybe I edited it again as root. Nevermind, here is the more complete version. --- namedev.c | 10 +++++----- namedev_parse.c | 8 ++++---- udev-add.c | 26 +++++++++++++------------- udev-remove.c | 10 +++++----- udev.h | 6 ++++++ udev_dbus.c | 8 ++++---- udevdb.c | 6 +++--- udevinfo.c | 10 +++++----- udevsend.c | 6 +++--- 9 files changed, 48 insertions(+), 42 deletions(-) diff --git a/namedev.c b/namedev.c index 2f9d8f5f67..219cb8a4b8 100644 --- a/namedev.c +++ b/namedev.c @@ -157,7 +157,7 @@ static mode_t get_default_mode(void) static char *get_default_owner(void) { if (strlen(default_owner_str) == 0) - strncpy(default_owner_str, "root", OWNER_SIZE); + strfieldcpy(default_owner_str, "root"); return default_owner_str; } @@ -165,7 +165,7 @@ static char *get_default_owner(void) static char *get_default_group(void) { if (strlen(default_group_str) == 0) - strncpy(default_group_str, "root", GROUP_SIZE); + strfieldcpy(default_group_str, "root"); return default_group_str; } @@ -276,7 +276,7 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys if (attr != NULL) i = atoi(attr); if (i > 0) { - strncpy(temp1, udev->program_result, sizeof(temp1)); + strfieldcpy(temp1, udev->program_result); pos2 = temp1; while (i) { i--; @@ -837,8 +837,8 @@ done: } else { /* no matching perms found :( */ udev->mode = get_default_mode(); - strncpy(udev->owner, get_default_owner(), OWNER_SIZE); - strncpy(udev->group, get_default_group(), GROUP_SIZE); + strfieldcpy(udev->owner, get_default_owner()); + strfieldcpy(udev->group, get_default_group()); } dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", udev->name, udev->owner, udev->group, udev->mode); diff --git a/namedev_parse.c b/namedev_parse.c index 013878c679..d300b0907d 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -319,21 +319,21 @@ static int namedev_parse_permissions(char *filename) dbg("cannot parse line '%s'", line); continue; } - strncpy(dev.name, temp2, sizeof(dev.name)); + strfieldcpy(dev.name, temp2); temp2 = strsep(&temp, ":"); if (!temp2) { dbg("cannot parse line '%s'", line); continue; } - strncpy(dev.owner, temp2, sizeof(dev.owner)); + strfieldcpy(dev.owner, temp2); temp2 = strsep(&temp, ":"); if (!temp2) { dbg("cannot parse line '%s'", line); continue; } - strncpy(dev.group, temp2, sizeof(dev.group)); + strfieldcpy(dev.group, temp2); if (!temp) { dbg("cannot parse line: %s", line); @@ -422,7 +422,7 @@ static int call_foreach_file(int parser (char *f) , char *filename, char *extens /* parse every file in the list */ list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { strfieldcpy(file, filename); - strcat(file, loop_file->name); + strfieldcat(file, loop_file->name); parser(file); list_del(&loop_file->list); free(loop_file); diff --git a/udev-add.c b/udev-add.c index 736316629f..0d3131300f 100644 --- a/udev-add.c +++ b/udev-add.c @@ -78,7 +78,7 @@ static int create_path(char *file) int retval; struct stat stats; - strncpy(p, file, sizeof(p)); + strfieldcpy(p, file); pos = strchr(p+1, '/'); while (1) { pos = strchr(pos+1, '/'); @@ -145,8 +145,8 @@ static int create_node(struct udevice *dev, int fake) int i; int tail; - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, dev->name, sizeof(filename)); + strfieldcpy(filename, udev_root); + strfieldcat(filename, dev->name); switch (dev->type) { case 'b': @@ -225,8 +225,8 @@ static int create_node(struct udevice *dev, int fake) if (linkname == NULL || linkname[0] == '\0') break; - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, linkname, sizeof(filename)); + strfieldcpy(filename, udev_root); + strfieldcat(filename, linkname); dbg("symlink '%s' to node '%s' requested", filename, dev->name); if (!fake) if (strrchr(linkname, '/')) @@ -243,13 +243,13 @@ static int create_node(struct udevice *dev, int fake) } while (linkname[i] != '\0') { if (linkname[i] == '/') - strcat(linktarget, "../"); + strfieldcat(linktarget, "../"); i++; } if (linktarget[0] == '\0') - strcpy(linktarget, "./"); - strcat(linktarget, &dev->name[tail]); + strfieldcpy(linktarget, "./"); + strfieldcat(linktarget, &dev->name[tail]); /* unlink existing files to ensure that our symlink is created */ if (!fake && (lstat(filename, &stats) == 0)) { @@ -278,8 +278,8 @@ static struct sysfs_class_device *get_class_dev(char *device_name) char dev_path[SYSFS_PATH_MAX]; struct sysfs_class_device *class_dev = NULL; - strcpy(dev_path, sysfs_path); - strcat(dev_path, device_name); + strfieldcpy(dev_path, sysfs_path); + strfieldcat(dev_path, device_name); dbg("looking at '%s'", dev_path); /* open up the sysfs class device for this thing... */ @@ -304,9 +304,9 @@ static int sleep_for_dev(char *path) int loop = SECONDS_TO_WAIT_FOR_DEV; int retval; - strcpy(filename, sysfs_path); - strcat(filename, path); - strcat(filename, "/dev"); + strfieldcpy(filename, sysfs_path); + strfieldcat(filename, path); + strfieldcat(filename, "/dev"); while (loop--) { struct stat buf; diff --git a/udev-remove.c b/udev-remove.c index c20c651dc5..8794429635 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -72,8 +72,8 @@ static int delete_node(struct udevice *dev) int retval; int i; - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, dev->name, sizeof(filename)); + strfieldcpy(filename, udev_root); + strfieldcat(filename, dev->name); info("removing device node '%s'", filename); retval = unlink(filename); @@ -103,8 +103,8 @@ static int delete_node(struct udevice *dev) if (linkname == NULL) break; - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, linkname, sizeof(filename)); + strfieldcpy(filename, udev_root); + strfieldcat(filename, linkname); dbg("unlinking symlink '%s'", filename); retval = unlink(filename); @@ -141,7 +141,7 @@ int udev_remove_device(char *path, char *subsystem) temp = strrchr(path, '/'); if (temp == NULL) return -ENODEV; - strncpy(dev.name, &temp[1], sizeof(dev.name)); + strfieldcpy(dev.name, &temp[1]); } dbg("name is '%s'", dev.name); diff --git a/udev.h b/udev.h index b5088b90c6..fc44a9847c 100644 --- a/udev.h +++ b/udev.h @@ -61,6 +61,12 @@ do { \ strncpy(to, from, sizeof(to)-1); \ } while (0) +#define strfieldcat(to, from) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + strncat(to, from, sizeof(to) - strlen(to) -1); \ +} while (0) + extern int udev_add_device(char *path, char *subsystem, int fake); extern int udev_remove_device(char *path, char *subsystem); extern void udev_init_config(void); diff --git a/udev_dbus.c b/udev_dbus.c index da633a31a1..7b672ef363 100644 --- a/udev_dbus.c +++ b/udev_dbus.c @@ -80,8 +80,8 @@ void sysbus_send_create(struct udevice *dev, const char *path) if (sysbus_connection == NULL) return; - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, dev->name, sizeof(filename)); + strfieldcpy(filename, udev_root); + strfieldcat(filename, dev->name); /* object, interface, member */ message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", @@ -114,8 +114,8 @@ void sysbus_send_remove(const char* name, const char *path) if (sysbus_connection == NULL) return; - strncpy(filename, udev_root, sizeof(filename)); - strncat(filename, name, sizeof(filename)); + strfieldcpy(filename, udev_root); + strfieldcat(filename, name); /* object, interface, member */ message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", diff --git a/udevdb.c b/udevdb.c index f9fca4ab70..a1f79a7c65 100644 --- a/udevdb.c +++ b/udevdb.c @@ -53,7 +53,7 @@ int udevdb_add_dev(const char *path, const struct udevice *dev) return -ENODEV; memset(keystr, 0, NAME_SIZE); - strcpy(keystr, path); + strfieldcpy(keystr, path); key.dptr = keystr; key.dsize = strlen(keystr) + 1; @@ -91,7 +91,7 @@ int udevdb_delete_dev(const char *path) return -EINVAL; memset(keystr, 0, sizeof(keystr)); - strcpy(keystr, path); + strfieldcpy(keystr, path); key.dptr = keystr; key.dsize = strlen(keystr) + 1; @@ -180,7 +180,7 @@ static int find_device_by_name(char *path, struct udevice *dev) { if (strncmp(dev->name, find_name, sizeof(dev->name)) == 0) { memcpy(find_dev, dev, sizeof(*find_dev)); - strncpy(find_path, path, NAME_SIZE); + strfieldcpy(find_path, path); find_found = 1; /* stop search */ return 1; diff --git a/udevinfo.c b/udevinfo.c index b94376c9ce..defed2ee31 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -73,7 +73,7 @@ static int print_all_attributes(const char *path) dlist_for_each_data(attributes, attr, struct sysfs_attribute) { if (attr->value != NULL) { - strncpy(value, attr->value, SYSFS_VALUE_MAX); + strfieldcpy(value, attr->value); len = strlen(value); if (len == 0) continue; @@ -306,8 +306,8 @@ static int process_options(void) } else { if (path[0] != '/') { /* prepend '/' if missing */ - strcat(temp, "/"); - strncat(temp, path, sizeof(path)); + strfieldcat(temp, "/"); + strfieldcat(temp, path); pos = temp; } else { pos = path; @@ -343,7 +343,7 @@ print: case NAME: if (root) strfieldcpy(result, udev_root); - strncat(result, dev.name, sizeof(result)); + strfieldcat(result, dev.name); break; case SYMLINK: @@ -385,7 +385,7 @@ exit: /* prepend sysfs mountpoint if not given */ strfieldcpy(temp, path); strfieldcpy(path, sysfs_path); - strncat(path, temp, sizeof(path)); + strfieldcat(path, temp); } print_device_chain(path); return 0; diff --git a/udevsend.c b/udevsend.c index b5850294ae..08212dfee6 100644 --- a/udevsend.c +++ b/udevsend.c @@ -82,9 +82,9 @@ static int build_hotplugmsg(struct hotplug_msg *msg, char *action, memset(msg, 0x00, sizeof(*msg)); strfieldcpy(msg->magic, UDEV_MAGIC); msg->seqnum = seqnum; - strncpy(msg->action, action, 8); - strncpy(msg->devpath, devpath, 128); - strncpy(msg->subsystem, subsystem, 16); + strfieldcpy(msg->action, action); + strfieldcpy(msg->devpath, devpath); + strfieldcpy(msg->subsystem, subsystem); return sizeof(struct hotplug_msg); } -- cgit v1.2.3-54-g00ecf From bef370d6ebd6707cc2ef183c2dc83f4a62d8111b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 26 Feb 2004 19:39:33 -0800 Subject: [PATCH] udev - man page update Hey it's not longer the "goal" to provide a dynamic dev directory, we have just arrived. So I change it to more self-confident words :) I've also added the completly missing environment variables to the man pages. To stop the misuse of the PROGRAM= call paramenters, we better mention its limitations. --- udev.8 | 33 +++++++++++++++++++++++++++++++-- udevd.8 | 19 ++++++++++++++++++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/udev.8 b/udev.8 index d7999aadfd..84b08488fe 100644 --- a/udev.8 +++ b/udev.8 @@ -3,11 +3,34 @@ udev \- Linux configurable dynamic device naming support .SH SYNOPSIS .BI udev " hotplug-subsystem" +.P +The environment must provide the following variables: +.TP +.B ACTION +.IR add " or " remove +signifies the connection or disconnection of a device. +.TP +.B DEVPATH +The sysfs devpath of the device without the mountpoint but a leading slash. +.P +Additional optional environment variables are: +.TP +.B UDEV_CONFIG_FILE +Overrides the default location of the +.B udev +config file. +.TP +.B UDEV_NO_SLEEP +The default behavior of +.B udev +is to wait until all the sysfs files of the device chain are populated. If set +.B udev +will will continue, regardless of the state of the device representation. .SH "DESCRIPTION" .B udev creates or removes device node files usually located in the /dev directory. -Its goal is to provide a dynamic device directory that contains only the files -for devices that are actually present. +It provides a dynamic device directory that contains only the files for +devices that are actually present. .P As part of the .B hotplug @@ -159,6 +182,11 @@ all of the values being required in order to match the rule. .TP .B PROGRAM Call external program. This key is valid if the program returns successful. +A few command line options may specified, but shell characters like pipe, +diversion or similiar options are not available. The environment variables of +.B udev +are also available for the program. +.br The string returned by the program may additionally matched with the .B RESULT key. @@ -285,6 +313,7 @@ following the '[' is a '!' then any character not enclosed is matched. .LP .SH "SEE ALSO" .BR udevinfo (8), +.BR udevd (8), .BR hotplug (8) .PP The diff --git a/udevd.8 b/udevd.8 index ab13a31107..30adb94f2b 100644 --- a/udevd.8 +++ b/udevd.8 @@ -3,6 +3,21 @@ udevd \- udev event serializer daemon .br udevsend \- sends the event to udevd +.SH SYNOPSIS +.BI udevsend " hotplug-subsystem" +.sp +The environment must provide the following variables: +.TP +.B ACTION +.IR add " or " remove +signifies the connection or disconnection of a device. +.TP +.B DEVPATH +The sysfs devpath of the device without the mountpoint but a leading slash. +.TP +.B SEQNUM +The sequence number of the event provided by the kernel. +If unset, the event bypasses the queue and will be executed immediately. .SH "DESCRIPTION" .B udevd allows the serialization of @@ -33,7 +48,9 @@ isn't already running, .B udevsend will start it. .SH "SEE ALSO" -.BR udev (8), " hotplug" (8) +.BR udev (8), +.BR udevinfo (8), +.BR hotplug (8) .SH AUTHORS .B udevd was developed primarily by Kay Sievers , with much help -- cgit v1.2.3-54-g00ecf From 831f800da34ddb449aecae925cd1f154f20b1eed Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 26 Feb 2004 19:40:22 -0800 Subject: [PATCH] udev - safer string handling - part two As promised, here is the next round. We provide in addition to the already used macros: strfieldcpy(to, from) strfieldcat(to, from) the corresponding friends, if the size of the target is not known and must be provided by the caller: strnfieldcpy(to, from, maxsize) strnfieldcat(to, from, maxsize) and switch nearly all possibly unsafe users of strcat(), strncat(), strcpy() and strncpy() to these safer macros. The last known remaining issue seems the use of sprintf() and snprintf(). I will take on it later today or tomorrow. --- namedev.c | 31 ++++++++++++++++++------------- udev.h | 14 +++++++++++++- udev_config.c | 2 +- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/namedev.c b/namedev.c index 219cb8a4b8..f688507dc3 100644 --- a/namedev.c +++ b/namedev.c @@ -209,7 +209,9 @@ static int get_format_len(char **str) return -1; } -static void apply_format(struct udevice *udev, unsigned char *string, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) +static void apply_format(struct udevice *udev, char *string, size_t maxsize, + struct sysfs_class_device *class_dev, + struct sysfs_device *sysfs_device) { char temp[NAME_SIZE]; char temp1[NAME_SIZE]; @@ -245,19 +247,19 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys case 'b': if (strlen(udev->bus_id) == 0) break; - strcat(pos, udev->bus_id); + strnfieldcat(pos, udev->bus_id, maxsize); dbg("substitute bus_id '%s'", udev->bus_id); break; case 'k': if (strlen(udev->kernel_name) == 0) break; - strcat(pos, udev->kernel_name); + strnfieldcat(pos, udev->kernel_name, maxsize); dbg("substitute kernel name '%s'", udev->kernel_name); break; case 'n': if (strlen(udev->kernel_number) == 0) break; - strcat(pos, udev->kernel_number); + strnfieldcat(pos, udev->kernel_number, maxsize); dbg("substitute kernel number '%s'", udev->kernel_number); break; case 'm': @@ -287,11 +289,11 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys } } if (pos3) { - strcat(pos, pos3); + strnfieldcat(pos, pos3, maxsize); dbg("substitute part of result string '%s'", pos3); } } else { - strcat(pos, udev->program_result); + strnfieldcat(pos, udev->program_result, maxsize); dbg("substitute result string '%s'", udev->program_result); } break; @@ -302,20 +304,20 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys dbg("sysfa attribute '%s' not found", attr); break; } - strcpy(pos, tmpattr->value); + strnfieldcpy(pos, tmpattr->value, maxsize); dbg("substitute sysfs value '%s'", tmpattr->value); } else { dbg("missing attribute"); } break; case '%': - strcat(pos, "%"); + strnfieldcat(pos, "%", maxsize); break; default: dbg("unknown substitution type '%%%c'", c); break; } - strcat(pos, tail); + strnfieldcat(pos, tail, maxsize); } } @@ -462,7 +464,7 @@ static int execute_program(char *path, char *value, int len) strncpy(value, buffer, len); pos = value + strlen(value)-1; if (pos[0] == '\n') - pos[0] = '\0'; + pos[0] = '\0'; dbg("result is '%s'", value); } } @@ -733,7 +735,8 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas /* execute external program */ if (dev->program[0] != '\0') { dbg("check " FIELD_PROGRAM); - apply_format(udev, dev->program, class_dev, sysfs_device); + apply_format(udev, dev->program, sizeof(dev->program), + class_dev, sysfs_device); if (execute_program(dev->program, udev->program_result, NAME_SIZE) != 0) { dbg(FIELD_PROGRAM " returned nozero"); goto try_parent; @@ -825,8 +828,10 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud found: /* substitute placeholder */ - apply_format(udev, udev->name, class_dev, sysfs_device); - apply_format(udev, udev->symlink, class_dev, sysfs_device); + apply_format(udev, udev->name, sizeof(udev->name), + class_dev, sysfs_device); + apply_format(udev, udev->symlink, sizeof(udev->symlink), + class_dev, sysfs_device); udev->partitions = dev->partitions; done: perm = find_perm(udev->name); diff --git a/udev.h b/udev.h index fc44a9847c..0ce010f3c4 100644 --- a/udev.h +++ b/udev.h @@ -64,7 +64,19 @@ do { \ #define strfieldcat(to, from) \ do { \ to[sizeof(to)-1] = '\0'; \ - strncat(to, from, sizeof(to) - strlen(to) -1); \ + strncat(to, from, sizeof(to) - strlen(to)-1); \ +} while (0) + +#define strnfieldcpy(to, from, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + strncpy(to, from, maxsize-1); \ +} while (0) + +#define strnfieldcat(to, from, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + strncat(to, from, maxsize - strlen(to)-1); \ } while (0) extern int udev_add_device(char *path, char *subsystem, int fake); diff --git a/udev_config.c b/udev_config.c index cade81cf20..de83ef9c4c 100644 --- a/udev_config.c +++ b/udev_config.c @@ -81,7 +81,7 @@ static void init_variables(void) #define set_var(_name, _var) \ if (strcasecmp(variable, _name) == 0) { \ dbg_parse("%s = '%s'", _name, value); \ - strncpy(_var, value, sizeof(_var)); \ + strnfieldcpy(_var, value, sizeof(_var));\ } #define set_bool(_name, _var) \ -- cgit v1.2.3-54-g00ecf From e964c2c05d3d6e2bdb21b3461ed7a4e85315cbc1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 26 Feb 2004 19:40:32 -0800 Subject: [PATCH] udev - safer string handling - part three Here we truncate our input strings from the environment to our defined limit. It's a bit theroretical but better check for it. It cleans up some magic length definitions and removes the code duplication in udev, udevtest and udevsend. udevd needs to be killed after installation, cause the message size is changed with this patch. Should we do this with the 'make install', like we do with the '.udevdb'? --- namedev.c | 2 +- udev.c | 30 ++---------------------------- udev.h | 45 +++++++++++++++++++++++++++++++++++++++++++++ udevd.c | 4 ++-- udevd.h | 6 +++--- udevsend.c | 26 +------------------------- udevtest.c | 24 ------------------------ 7 files changed, 54 insertions(+), 83 deletions(-) diff --git a/namedev.c b/namedev.c index f688507dc3..bc407dd103 100644 --- a/namedev.c +++ b/namedev.c @@ -405,7 +405,7 @@ static int execute_program(char *path, char *value, int len) int fds[2]; pid_t pid; int value_set = 0; - char buffer[256]; + char buffer[255]; char *pos; char *args[PROGRAM_MAXARG]; int i; diff --git a/udev.c b/udev.c index 1c65f2e59c..4486707f42 100644 --- a/udev.c +++ b/udev.c @@ -43,7 +43,7 @@ char **main_envp; unsigned char logname[42]; void log_message (int level, const char *format, ...) { - va_list args; + va_list args; if (!udev_log) return; @@ -67,30 +67,6 @@ static void sig_handler(int signum) } } -static inline char *get_action(void) -{ - char *action; - - action = getenv("ACTION"); - return action; -} - -static inline char *get_devpath(void) -{ - char *devpath; - - devpath = getenv("DEVPATH"); - return devpath; -} - -static inline char *get_seqnum(void) -{ - char *seqnum; - - seqnum = getenv("SEQNUM"); - return seqnum; -} - static char *subsystem_blacklist[] = { "net", "scsi_host", @@ -130,7 +106,7 @@ static int udev_hotplug(int argc, char **argv) } /* skip blacklisted subsystems */ - subsystem = argv[1]; + subsystem = get_subsystem(argv[1]); if (!subsystem) { dbg("no subsystem?"); goto exit; @@ -200,5 +176,3 @@ int main(int argc, char **argv, char **envp) return udev_hotplug(argc, argv); } - - diff --git a/udev.h b/udev.h index 0ce010f3c4..fa56c36691 100644 --- a/udev.h +++ b/udev.h @@ -23,6 +23,8 @@ #ifndef UDEV_H #define UDEV_H +#include +#include #include #include #include @@ -34,6 +36,10 @@ #define GROUP_SIZE 30 #define MODE_SIZE 8 +#define ACTION_SIZE 30 +#define DEVPATH_SIZE 255 +#define SUBSYSTEM_SIZE 30 + /* length of public data */ #define UDEVICE_LEN (offsetof(struct udevice, bus_id)) @@ -79,6 +85,45 @@ do { \ strncat(to, from, maxsize - strlen(to)-1); \ } while (0) +static inline char *get_action(void) +{ + char *action; + + action = getenv("ACTION"); + if (strlen(action) > ACTION_SIZE) + action[ACTION_SIZE-1] = '\0'; + + return action; +} + +static inline char *get_devpath(void) +{ + char *devpath; + + devpath = getenv("DEVPATH"); + if (strlen(devpath) > DEVPATH_SIZE) + devpath[DEVPATH_SIZE-1] = '\0'; + + return devpath; +} + +static inline char *get_seqnum(void) +{ + char *seqnum; + + seqnum = getenv("SEQNUM"); + + return seqnum; +} + +static inline char *get_subsystem(char *subsystem) +{ + if (strlen(subsystem) > SUBSYSTEM_SIZE) + subsystem[SUBSYSTEM_SIZE-1] = '\0'; + + return subsystem; +} + extern int udev_add_device(char *path, char *subsystem, int fake); extern int udev_remove_device(char *path, char *subsystem); extern void udev_init_config(void); diff --git a/udevd.c b/udevd.c index f7901cb752..2b3dc55788 100644 --- a/udevd.c +++ b/udevd.c @@ -119,8 +119,8 @@ static void msg_queue_insert(struct hotplug_msg *msg) static void udev_run(struct hotplug_msg *msg) { pid_t pid; - char action[32]; - char devpath[256]; + char action[ACTION_SIZE]; + char devpath[DEVPATH_SIZE]; char *env[] = { action, devpath, NULL }; snprintf(action, sizeof(action), "ACTION=%s", msg->action); diff --git a/udevd.h b/udevd.h index 8efe1d569c..8b82ff9a70 100644 --- a/udevd.h +++ b/udevd.h @@ -35,7 +35,7 @@ struct hotplug_msg { pid_t pid; int seqnum; time_t queue_time; - char action[8]; - char devpath[128]; - char subsystem[16]; + char action[ACTION_SIZE]; + char devpath[DEVPATH_SIZE]; + char subsystem[SUBSYSTEM_SIZE]; }; diff --git a/udevsend.c b/udevsend.c index 08212dfee6..4b6ef5c2f3 100644 --- a/udevsend.c +++ b/udevsend.c @@ -52,30 +52,6 @@ void log_message (int level, const char *format, ...) } #endif -static inline char *get_action(void) -{ - char *action; - - action = getenv("ACTION"); - return action; -} - -static inline char *get_devpath(void) -{ - char *devpath; - - devpath = getenv("DEVPATH"); - return devpath; -} - -static inline char *get_seqnum(void) -{ - char *seqnum; - - seqnum = getenv("SEQNUM"); - return seqnum; -} - static int build_hotplugmsg(struct hotplug_msg *msg, char *action, char *devpath, char *subsystem, int seqnum) { @@ -144,7 +120,7 @@ int main(int argc, char* argv[]) #endif dbg("version %s", UDEV_VERSION); - subsystem = argv[1]; + subsystem = get_subsystem(argv[1]); if (subsystem == NULL) { dbg("no subsystem"); goto exit; diff --git a/udevtest.c b/udevtest.c index 4956758636..4bc094fd90 100644 --- a/udevtest.c +++ b/udevtest.c @@ -66,30 +66,6 @@ static void sig_handler(int signum) } } -static inline char *get_action(void) -{ - char *action; - - action = getenv("ACTION"); - return action; -} - -static inline char *get_devpath(void) -{ - char *devpath; - - devpath = getenv("DEVPATH"); - return devpath; -} - -static inline char *get_seqnum(void) -{ - char *seqnum; - - seqnum = getenv("SEQNUM"); - return seqnum; -} - static char *subsystem_blacklist[] = { "net", "scsi_host", -- cgit v1.2.3-54-g00ecf From 3fe0734266becd2ebcb111b07c3e17b2a9780477 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 26 Feb 2004 19:40:40 -0800 Subject: [PATCH] udev - safer string handling - part four Mainly a cleanup of the earlier patches with a few missing pieces and some cosmetical changes. I've moved the udev_init_config() to very early init, otherwise we don't get any logging for the processing of the input. What would I do without gdb :) Greg, it's the 7th patch in your box to apply. I will stop now and wait for you :) --- logging.h | 8 ++++---- namedev.c | 18 +++++++++--------- udev.c | 15 ++++++++------- udev.h | 6 +++--- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/logging.h b/logging.h index 2ba2ac4965..1c27917f61 100644 --- a/logging.h +++ b/logging.h @@ -37,14 +37,14 @@ #undef info #define info(format, arg...) \ do { \ - log_message (LOG_INFO , format , ## arg); \ + log_message(LOG_INFO , format , ## arg); \ } while (0) #ifdef DEBUG #undef dbg #define dbg(format, arg...) \ do { \ - log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + log_message(LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ } while (0) #endif @@ -53,11 +53,11 @@ #undef dbg_parse #define dbg_parse(format, arg...) \ do { \ - log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + log_message(LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ } while (0) #endif -extern void log_message (int level, const char *format, ...) +extern void log_message(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); /* each program that uses syslog must declare this variable somewhere */ diff --git a/namedev.c b/namedev.c index bc407dd103..21f52d1f3c 100644 --- a/namedev.c +++ b/namedev.c @@ -228,7 +228,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, pos = string; while (1) { - pos = strchr(pos, '%'); + pos = strchr(string, '%'); if (pos != NULL) { pos[0] = '\0'; tail = pos+1; @@ -247,19 +247,19 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, case 'b': if (strlen(udev->bus_id) == 0) break; - strnfieldcat(pos, udev->bus_id, maxsize); + strnfieldcat(string, udev->bus_id, maxsize); dbg("substitute bus_id '%s'", udev->bus_id); break; case 'k': if (strlen(udev->kernel_name) == 0) break; - strnfieldcat(pos, udev->kernel_name, maxsize); + strnfieldcat(string, udev->kernel_name, maxsize); dbg("substitute kernel name '%s'", udev->kernel_name); break; case 'n': if (strlen(udev->kernel_number) == 0) break; - strnfieldcat(pos, udev->kernel_number, maxsize); + strnfieldcat(string, udev->kernel_number, maxsize); dbg("substitute kernel number '%s'", udev->kernel_number); break; case 'm': @@ -289,11 +289,11 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, } } if (pos3) { - strnfieldcat(pos, pos3, maxsize); + strnfieldcat(string, pos3, maxsize); dbg("substitute part of result string '%s'", pos3); } } else { - strnfieldcat(pos, udev->program_result, maxsize); + strnfieldcat(string, udev->program_result, maxsize); dbg("substitute result string '%s'", udev->program_result); } break; @@ -304,20 +304,20 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("sysfa attribute '%s' not found", attr); break; } - strnfieldcpy(pos, tmpattr->value, maxsize); + strnfieldcat(string, tmpattr->value, maxsize); dbg("substitute sysfs value '%s'", tmpattr->value); } else { dbg("missing attribute"); } break; case '%': - strnfieldcat(pos, "%", maxsize); + strnfieldcat(string, "%", maxsize); break; default: dbg("unknown substitution type '%%%c'", c); break; } - strnfieldcat(pos, tail, maxsize); + strnfieldcat(string, tail, maxsize); } } diff --git a/udev.c b/udev.c index 4486707f42..4ae4684536 100644 --- a/udev.c +++ b/udev.c @@ -41,7 +41,7 @@ char **main_envp; #ifdef LOG unsigned char logname[42]; -void log_message (int level, const char *format, ...) +void log_message(int level, const char *format, ...) { va_list args; @@ -76,7 +76,7 @@ static char *subsystem_blacklist[] = { "", }; -static int udev_hotplug(int argc, char **argv) +static int udev_hotplug(void) { char *action; char *devpath; @@ -106,7 +106,7 @@ static int udev_hotplug(int argc, char **argv) } /* skip blacklisted subsystems */ - subsystem = get_subsystem(argv[1]); + subsystem = get_subsystem(main_argv[1]); if (!subsystem) { dbg("no subsystem?"); goto exit; @@ -123,9 +123,6 @@ static int udev_hotplug(int argc, char **argv) /* connect to the system message bus */ sysbus_connect(); - /* initialize our configuration */ - udev_init_config(); - /* initialize udev database */ retval = udevdb_init(UDEVDB_DEFAULT); if (retval != 0) { @@ -172,7 +169,11 @@ int main(int argc, char **argv, char **envp) main_envp = envp; init_logging("udev"); + + /* initialize our configuration */ + udev_init_config(); + dbg("version %s", UDEV_VERSION); - return udev_hotplug(argc, argv); + return udev_hotplug(); } diff --git a/udev.h b/udev.h index fa56c36691..3b676acf40 100644 --- a/udev.h +++ b/udev.h @@ -90,7 +90,7 @@ static inline char *get_action(void) char *action; action = getenv("ACTION"); - if (strlen(action) > ACTION_SIZE) + if (action != NULL && strlen(action) > ACTION_SIZE) action[ACTION_SIZE-1] = '\0'; return action; @@ -101,7 +101,7 @@ static inline char *get_devpath(void) char *devpath; devpath = getenv("DEVPATH"); - if (strlen(devpath) > DEVPATH_SIZE) + if (devpath != NULL && strlen(devpath) > DEVPATH_SIZE) devpath[DEVPATH_SIZE-1] = '\0'; return devpath; @@ -118,7 +118,7 @@ static inline char *get_seqnum(void) static inline char *get_subsystem(char *subsystem) { - if (strlen(subsystem) > SUBSYSTEM_SIZE) + if (subsystem != NULL && strlen(subsystem) > SUBSYSTEM_SIZE) subsystem[SUBSYSTEM_SIZE-1] = '\0'; return subsystem; -- cgit v1.2.3-54-g00ecf From dde05ccb8d423fbc5c29f54b0c1b545938c8f151 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 26 Feb 2004 21:29:49 -0800 Subject: [PATCH] remove limit of the number of args passed to PROGRAM If we go over our internal limit of 7, then we call out to /bin/sh otherwise we handle it ourself without relying on a shell. --- namedev.c | 18 +++++++++++++----- test/udev-test.pl | 9 +++++++++ udev.8 | 3 +-- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/namedev.c b/namedev.c index 21f52d1f3c..7c07e3b104 100644 --- a/namedev.c +++ b/namedev.c @@ -421,7 +421,13 @@ static int execute_program(char *path, char *value, int len) case 0: /* child */ close(STDOUT_FILENO); - dup(fds[1]); /* dup write side of pipe to STDOUT */ + + /* dup write side of pipe to STDOUT */ + dup(fds[1]); + + /* copy off our path to use incase we have too many args */ + strnfieldcpy(buffer, path, sizeof(buffer)); + if (strchr(path, ' ')) { /* exec with arguments */ pos = path; @@ -431,14 +437,16 @@ static int execute_program(char *path, char *value, int len) break; } if (args[i]) { - dbg("too many args - %d", i); - args[i] = NULL; + dbg("too many args - %d, using subshell instead '%s'", i, buffer); + retval = execl("/bin/sh", "sh", "-c", buffer, NULL); + } else { + dbg("execute program '%s'", path); + retval = execv(args[0], args); } - retval = execv(args[0], args); } else { retval = execv(path, main_argv); } - dbg("child execve failed"); + info(FIELD_PROGRAM " execution of '%s' failed", path); exit(1); case -1: dbg("fork failed"); diff --git a/test/udev-test.pl b/test/udev-test.pl index f2f77dd0e4..a3bf768fe3 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -241,6 +241,15 @@ EOF expected => "escape-3" , conf => < "program with lots of arguments", + subsys => "block", + devpath => "block/sda/sda3", + expected => "foo9" , + conf => < Date: Sat, 28 Feb 2004 00:30:24 -0800 Subject: [PATCH] fix build for very old versions of make. Should get rid of some more error reports of libsysfs header issues. --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 8ab9099f4f..d58569f581 100644 --- a/Makefile +++ b/Makefile @@ -73,6 +73,9 @@ udevdir = ${prefix}/udev # than the local version of klibc #USE_KLIBC = true +# set up PWD so that older versions of make will work with our build. +PWD = $(shell pwd) + # If you are running a cross compiler, you may want to set this # to something more interesting, like "arm-linux-". If you want # to compile vs uClibc, that can be done here as well. -- cgit v1.2.3-54-g00ecf From 8481f8ce2bd2b19ebcf3cb96ac6825093f626b0f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 28 Feb 2004 00:52:20 -0800 Subject: [PATCH] Add initial SELinux support for udev Based on a patch from Daniel J Walsh --- Makefile | 8 ++++++++ README | 6 ++++++ udev-add.c | 4 ++++ udev.spec | 15 +++++++++++++++ udev_selinux.c | 34 ++++++++++++++++++++++++++++++++++ udev_selinux.h | 10 ++++++++++ 6 files changed, 77 insertions(+) create mode 100644 udev_selinux.c create mode 100644 udev_selinux.h diff --git a/Makefile b/Makefile index d58569f581..b24e147838 100644 --- a/Makefile +++ b/Makefile @@ -227,6 +227,14 @@ ifeq ($(USE_DBUS), true) OBJS += udev_dbus.o endif +# if USE_SELINUX is enabled, then we do not strip or optimize +ifeq ($(strip $(USE_SELINUX)),true) + CFLAGS += -DUSE_SELINUX + OBJS += udev_selinux.o + LIB_OBJS += -lselinux +endif + + # header files automatically generated GEN_HEADERS = udev_version.h diff --git a/README b/README index c63912101a..75d642c942 100644 --- a/README +++ b/README @@ -49,6 +49,11 @@ To use: creates or removes a device node. This requires that DBUS development headers and libraries be present on your system to build properly. Default value is 'false'. + USE_SELINUX + if set to 'true', SELinux support for udev will be built in. + This requires that SELinux development headers and libraries be + present on your system to build properly. Default value is + 'false'. DEBUG if set to 'true', debugging messages will be sent to the syslog as udev is run. Default value is 'false'. @@ -97,3 +102,4 @@ greg@kroah.com + diff --git a/udev-add.c b/udev-add.c index 0d3131300f..2f64b4375a 100644 --- a/udev-add.c +++ b/udev-add.c @@ -38,6 +38,7 @@ #include "udev.h" #include "udev_version.h" #include "udev_dbus.h" +#include "udev_selinux.h" #include "logging.h" #include "namedev.h" #include "udevdb.h" @@ -217,6 +218,9 @@ static int create_node(struct udevice *dev, int fake) } } + if (!fake) + selinux_add_node(filename); + /* create symlink if requested */ if (dev->symlink[0] != '\0') { symlinks = dev->symlink; diff --git a/udev.spec b/udev.spec index 63d1835a4a..4cd1f8a94b 100644 --- a/udev.spec +++ b/udev.spec @@ -16,6 +16,11 @@ # 1 - DBUS support %define dbus 0 +# if we want to build SELinux support in or not. +# 0 - no SELinux support +# 1 - SELinux support +%define selinux 1 + # if we want to enable debugging support in udev. If it is enabled, lots of # stuff will get sent to the debug syslog. # 0 - debugging disabled @@ -67,6 +72,11 @@ make CC="gcc $RPM_OPT_FLAGS" \ %else USE_DBUS=false \ %endif +%if %{selinux} + USE_SELINUX=true \ +%else + USE_SELINUX=false \ +%endif %if %{debug} DEBUG=true \ %else @@ -85,6 +95,11 @@ make DESTDIR=$RPM_BUILD_ROOT install \ %else USE_DBUS=false \ %endif +%if %{selinux} + USE_SELINUX=true \ +%else + USE_SELINUX=false \ +%endif %if %{lsb} USE_LSB=true \ %else diff --git a/udev_selinux.c b/udev_selinux.c new file mode 100644 index 0000000000..3728fd0b50 --- /dev/null +++ b/udev_selinux.c @@ -0,0 +1,34 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_version.h" +#include "udev_selinux.h" +#include "logging.h" + + +void selinux_add_node(char *filename) +{ + int retval; + + if (is_selinux_enabled() > 0) { + security_context_t scontext; + retval = matchpathcon(filename, 0, &scontext); + if (retval < 0) { + dbg("matchpathcon(%s) failed\n", filename); + } else { + retval=setfilecon(filename,scontext); + if (retval < 0) + dbg("setfiles %s failed with error '%s'", + filename, strerror(errno)); + free(scontext); + } + } +} + diff --git a/udev_selinux.h b/udev_selinux.h new file mode 100644 index 0000000000..77a1f36bd9 --- /dev/null +++ b/udev_selinux.h @@ -0,0 +1,10 @@ +#ifndef UDEV_SELINUX_H +#define UDEV_SELINUX_H + +#ifdef USE_SELINUX +extern void selinux_add_node(char *filename); +#else +static void selinux_add_node(char *filename) { } +#endif + +#endif -- cgit v1.2.3-54-g00ecf From 49f9bede7c06d7c1c55ea795f3fcf36c95f26668 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 28 Feb 2004 00:54:49 -0800 Subject: [PATCH] udev - correct relative symlink Here we remove the useless leading "./" of the linktargets. Thanks to Olaf Hering , who asked why we do this :) We have now: /udev |-- camera0 -> video0 |-- kamera0 -> video0 `-- video0 --- udev-add.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/udev-add.c b/udev-add.c index 2f64b4375a..8fdd66fad5 100644 --- a/udev-add.c +++ b/udev-add.c @@ -251,8 +251,6 @@ static int create_node(struct udevice *dev, int fake) i++; } - if (linktarget[0] == '\0') - strfieldcpy(linktarget, "./"); strfieldcat(linktarget, &dev->name[tail]); /* unlink existing files to ensure that our symlink is created */ -- cgit v1.2.3-54-g00ecf From 84d282a9d29f9c1191fca8e58246e9fc912ab2e9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 28 Feb 2004 00:54:52 -0800 Subject: [PATCH] TODO update On Thu, Feb 12, 2004 at 05:26:37PM -0800, Greg KH wrote: > On Fri, Feb 13, 2004 at 12:45:38AM +0100, Kay Sievers wrote: > > > > Here a few questions about my favorite file in the tree :) > > - better permission handling > > > > What is missing here? > > I don't know for sure. Just a vague feeling that the way we currently > handle permissions is pretty lousy. Anyone else feel this way too? Seems that nobody cares and perhaps the recent klibc permission changes and the multiple file config directory are enough to kill these lines? :) --- TODO | 2 -- 1 file changed, 2 deletions(-) diff --git a/TODO b/TODO index 1a29adba0e..2239d7b024 100644 --- a/TODO +++ b/TODO @@ -10,8 +10,6 @@ greg@kroah.com - install the proper init.d script based on the distro we are running on. - persuade the distro packagers to submit their changes (or just steal them if we can find them...) -- keep track of current permissions on devices when daemon shuts down. -- better permission handling - create kernel name to devfs name config file so that all of the devfs users will have an upgrade path. - do early boot logic (putting udev into initramfs, handle pivot-root, -- cgit v1.2.3-54-g00ecf From 1373b381d0881dba99b2f2654856d28ac0a70fda Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 28 Feb 2004 00:55:25 -0800 Subject: [PATCH] add new TODO item about local user permissions. --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index 2239d7b024..fb94135426 100644 --- a/TODO +++ b/TODO @@ -7,6 +7,7 @@ greg@kroah.com - more documentation (can never have too much.) +- create way to set permission to the local user. - install the proper init.d script based on the distro we are running on. - persuade the distro packagers to submit their changes (or just steal them if we can find them...) -- cgit v1.2.3-54-g00ecf From b484e43622c04aaf4a2ca851bc7436b873530b1d Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Sat, 28 Feb 2004 01:00:36 -0800 Subject: [PATCH] update udev scsi_id to scsi_id 0.4 This patch syncs the scsi_id in the udev tree to version 0.4. --- extras/scsi_id/ChangeLog | 43 ++++++++++ extras/scsi_id/Makefile | 2 +- extras/scsi_id/TODO | 15 ++-- extras/scsi_id/gen_scsi_id_udev_rules.sh | 85 ++++++++++++++++++++ extras/scsi_id/release-notes | 50 +++++++----- extras/scsi_id/scsi_id.8 | 47 ++++++++--- extras/scsi_id/scsi_id.c | 134 ++++++++++++------------------- extras/scsi_id/scsi_id.h | 6 +- extras/scsi_id/scsi_serial.c | 64 +++++---------- 9 files changed, 279 insertions(+), 167 deletions(-) create mode 100644 extras/scsi_id/gen_scsi_id_udev_rules.sh diff --git a/extras/scsi_id/ChangeLog b/extras/scsi_id/ChangeLog index 7032dfd07f..095d84f2d0 100644 --- a/extras/scsi_id/ChangeLog +++ b/extras/scsi_id/ChangeLog @@ -1,3 +1,46 @@ +2004-feb-25: + * scsi_id.8: Add verbage about usage with udev, and running via + hotplug. + +2004-feb-25: + * scsi_id.c, scsi_id.8: Disable support for -e (all output to + stderr) as it cannot be used in any useful way, and the -c + (device specific callout) as the code is incomplete and has no + users. + +2004-feb-25: + * scsi_id.c: Don't print errno for NULL return from + sysfs_get_classdev_device. + +2004-feb-23: + * scsi_id.c: Get rid of dead/leftover code that checked + if we are on a scsi bus. + +2004-feb-23: + * scsi_serial.c, scsi_id.c: Use ":" consistently in output messages. + +2004-feb-23: + * scsi_serial.c: Add missing new lines for some error messages. + +2004-feb-23: + * scsi_serial.c: open O_NONBLOCK so we handle tape drives without + tapes loaded. + +2004-feb-20: + * scsi_id.h, scsi_id.c: Remove hacks based on KLIBC define to get + around problems when building with udev (udev libsysfs files + were rearranged). + +2004-feb-19: + * scsi_id.h, scsi_id.c, scsi_serial.c: As done in udev code, support + partitions via looking for a parent of the target path. Uses + libsysfs functions to do most of the work, and includes changing + a lot of variables to be struct sysfs_device instead of + sysfs_class_device. + +2004-feb-19: + * Makefile: Version 0.4 + 2004-jan-15: * Makefile: Version 0.3 diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index abf48895ad..bfc2923b34 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.3 +SCSI_ID_VERSION=0.4 prefix = etcdir = ${prefix}/etc diff --git a/extras/scsi_id/TODO b/extras/scsi_id/TODO index dde5c84a67..4f302ea0a4 100644 --- a/extras/scsi_id/TODO +++ b/extras/scsi_id/TODO @@ -1,11 +1,8 @@ -- add information about the config file to the man page +- Document that config file options override command line options, or fix + the code. This means a '-b' in the config file disables any -g on the + command line. -- change so non-KLIBC builds under udev don't use /usr/include/sysfs, - but instead use the sysfs included with udev (needs udev change and/or - sysfsutils changes). +- Add code to check that SCSI commands get back enough data for their + intended usage, mainly callers of scsi_inquiry(). -- do something with callout code - remove or change to a tag? - - This needs an implementation of a device specific callout or device - specific code (called via some special "tag" or such) before it can be - completed. Someone with such hardware to send in a patch. +- Document the config file in the man page diff --git a/extras/scsi_id/gen_scsi_id_udev_rules.sh b/extras/scsi_id/gen_scsi_id_udev_rules.sh new file mode 100644 index 0000000000..07e21ebd50 --- /dev/null +++ b/extras/scsi_id/gen_scsi_id_udev_rules.sh @@ -0,0 +1,85 @@ +#! /bin/sh + +# This script generates and sends to stdout a set of udev.rules for use +# with all scsi block devices on your system. It creates a udev key NAME +# with prefix defaulting to "disk-", and appends the current kernel name +# and the udev kernel number (the partition number, empty for the entire +# disk). +# +# Managing these is probably better done via a gui interface. +# +# You can edit and append the output to your /etc/udev/udev.rules file. +# You probably want to to change names to be non-kernel defaults, so as to +# avoid confusion if a configuration change modifies /sys/block/sd* +# naming. +# +# /etc/scsi_id.config must be properly configured. If you are using this +# script, you probably want a single line enabling scsi_id for all +# devices as follows: +# +# options=-g +# +# The above assumes you will not attach block devices that do not +# properly support the page codes used by scsi_id, this is especially true +# of many USB mass storage devices (mainly flash card readers). +# + +prefix=disk- +scsi_id=/sbin/scsi_id + +dump_ids() +{ + cd ${sysfs_dir}/block + for b in sd* + do + echo -n "$b " + $scsi_id -s /block/$b + if [ $? != 0 ] + then + echo $0 failed for device $b >&2 + exit 1 + fi + done +} + +sysfs_dir=$(mount | awk '$5 == "sysfs" {print $3}') + +c=$(ls /${sysfs_dir}/block/sd* 2>/dev/null | wc -l) +if [ $c = 0 ] +then + echo $0 no block devices present >&2 + exit 1 +fi + +echo "#" +echo "# Start of autogenerated scsi_id rules. Edit the NAME portions of these" +echo "# rules to your liking." +echo "#" +first_line=yes +dump_ids | while read in +do + set $in + name=$1 + shift + id="$*" + if [ $first_line = "yes" ] + then + first_line=no + echo "BUS=\"scsi\", PROGRAM=\"${scsi_id}\", RESULT=\"${id}\", NAME=\"${prefix}${name}%n\"" + echo + echo "# Further RESULT keys use the result of the last PROGRAM rule." + echo "# Be careful not to add any rules containing PROGRAM key between here" + echo "# and the end of this section" + echo + else + # No PROGRAM, so just use the last result of PROGRAM. The + # following is the same as the above without the PROGRAM + # key. + echo "BUS=\"scsi\", RESULT=\"${id}\", NAME=\"${prefix}${name}%n\"" + fi + +done + +echo "#" +echo "# End of autogenerated scsi_id rules" +echo "#" diff --git a/extras/scsi_id/release-notes b/extras/scsi_id/release-notes index 7ef12a25db..a10b569c2d 100644 --- a/extras/scsi_id/release-notes +++ b/extras/scsi_id/release-notes @@ -1,39 +1,49 @@ -Version 0.3 of scsi_id is available at: +Version 0.4 of scsi_id is available at: -http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.3.tar.gz +http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.4.tar.gz -scsi_id is a program to generate a SCSI unique identifier for a given SCSI +scsi_id is a program to generate a unique identifier for a given SCSI device. -It is primarily for use with udev callout config entries. It can also be -used for automatic multi-path configuration or device mapper configuration. +It is primarily for use with the udev callout key. It could also be used +for automatic multi-path configuration or device mapper configuration. -Version 0.3 requires: +Version 0.4 requires: - Linux kernel 2.6 - libsysfs 0.4.0 Major changes since the last release: - - Changes to work with libsysfs 0.4.0 + - Support block device partitions -All changes: + - Added a script to auto-generate udev rules. The script is not + installed but is part of the tarball. - - fix "prefix" usage for path to scsi_id.config +Detailed changes: - - install the sample scsi_id.config file. + - Add man page verbage about usage with udev, and running via + hotplug - - Use DESTDIR in all install/uninstall rules, per problem reported - by Svetoslav Slavtchev. + - Disable support for -e (all output to stderr) as it cannot be + used in any useful way, and the -c (device specific callout) as + the code is incomplete and has no users. - - Fix to work with current sysfs 0.4, based on patch from Dan - Stekloff, but uses sysfs_read_attribute_value instead of - sysfs_get_value_from_attributes. + - Don't print errno for NULL return from sysfs_get_classdev_device. - - SYSFS_BUS_DIR was replaced with SYSFS_BUS_NAME. + - Get rid of dead/leftover code that checked if we are on a scsi + bus. - - Must now use sysfs_open_class_device_path instead of the - previous sysfs_open_class_device. + - ":" consistently in output messages. - - patch from Olaf Hering remove DEBUG and - add --fno-builtin + - Add missing new lines for some error messages. + + - open O_NONBLOCK so we handle tape drives without tapes loaded. + + - Remove hacks based on KLIBC define to get around problems when + building with udev (udev libsysfs files were rearranged). + + - As done in udev code, support partitions via looking for a + parent of the target path. Uses libsysfs functions to do most of + the work, and includes changing a lot of variables to be struct + sysfs_device instead of sysfs_class_device. diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index a4fb881a05..db3effbc45 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -50,9 +50,13 @@ identifier starts with the NAA value of 6): .fi .P - .SH OPTIONS .TP +.BI subsystem +When called with only a single argument without a leading \-, runs in a hotplug +mode, and expects the environment variable DEVPATH to specify the +corresponding sysfs device. See section below on usage with \fBudev\fP. +.TP .BI \-b The default behaviour - treat the device as black listed, and do nothing unless a white listed device is found in the scsi_id config-file. @@ -63,11 +67,6 @@ of determining and creating a device node based on a sysfs dev entry as done for the \fB-s\fP, send SG_IO commands to \fBdevice\fP, such as \fB/dev/sdc\fP. .TP -.BI \-e -Send all output to standard error even if -.B scsi_id -is running in hotplug mode. -.TP .BI \-f "\| config-file" Read configuration and black/white list entries from .B config-file @@ -90,7 +89,7 @@ Use SCSI INQUIRY VPD page code 0x80 or 0x83. The default behaviour is to query the available VPD pages, and use page 0x83 if found, else page 0x80 if found, else nothing. .TP -.BI \-s "\|sysfs-device" +.BI \-s "\| sysfs-device" Generate an id for the .B sysfs-device. The sysfs mount point must not be included. For example, use /block/sd, @@ -102,6 +101,37 @@ Generate verbose debugging output. .BI \-V Display version number and exit. .RE + +.SH USAGE WITH UDEV +If \fBscsi_id\fP is invoked with one argument without a leading \-, it +assumes it is called for a hotplug event, and looks for the sysfs device +in the DEVPATH environment variable. + +This mode is used when run via the \fBudev\fP PROGRAM key. Passing any +arguments or options as part of the PROGRAM rule breaks this assumption, +and the results will likely not be as expected. + +When in this mode, all errors and warnings are sent via syslog. + +To determine the specific value needed in a RESULT key, use the -s option, +for example: + +.sp +.nf +/sbin/scsi_id -s /block/sda +.fi +.P + +An example \fBudev\fP rule using \fBscsi_id\fP, that will name a block +device and any partitions for the device matching the \fBscsi_id\fP output +of 312345: + +.sp +.nf +BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="312345", NAME="disk%n" +.fi +.P + .SH "FILES" .nf .ft B @@ -110,8 +140,7 @@ Display version number and exit. .fi .LP .SH "SEE ALSO" -.BR udev (8) -, especially the CALLOUT method. +.BR udev (8), hotplug (8) .SH AUTHORS Developed by Patrick Mansfield based on SCSI ID source included in earlier linux 2.5 kernels, sg_utils source, and SCSI diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 2754381976..1cd6981e5e 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -33,7 +33,6 @@ #include #include #include - #include "scsi_id_version.h" #include "scsi_id.h" @@ -48,11 +47,16 @@ #define TMP_DIR "/tmp" #define TMP_PREFIX "scsi" -static const char short_options[] = "bc:d:ef:gip:s:vV"; +/* + * XXX Note the 'e' (send output to stderr in all cases), and 'c' (callout) + * options are not supported, but other code is still left in place for + * now. + */ +static const char short_options[] = "bd:f:gip:s:vV"; /* * Just duplicate per dev options. */ -static const char dev_short_options[] = "bc:gp:"; +static const char dev_short_options[] = "bgp:"; char sysfs_mnt_path[SYSFS_PATH_MAX]; @@ -107,55 +111,6 @@ int sysfs_get_attr(const char *devpath, const char *attr, char *value, return sysfs_read_attribute_value(attr_path, value, SYSFS_NAME_LEN); } -static int sysfs_get_actual_dev(const char *sysfs_path, char *dev, int len) -{ - dprintf("%s\n", sysfs_path); - strncpy(dev, sysfs_path, len); - strncat(dev, "/device", len); - if (sysfs_get_link(dev, dev, len)) { - if (!hotplug_mode) - log_message(LOG_WARNING, "%s: %s\n", dev, - strerror(errno)); - return -1; - } - return 0; -} - -/* - * sysfs_is_bus: Given the sysfs_path to a device, return 1 if sysfs_path - * is on bus, 0 if not on bus, and < 0 on error - */ -static int sysfs_is_bus(const char *sysfs_path, const char *bus) -{ - char bus_dev_name[SYSFS_PATH_MAX]; - char bus_id[SYSFS_NAME_LEN]; - struct stat stat_buf; - ino_t dev_inode; - - dprintf("%s\n", sysfs_path); - - if (sysfs_get_name_from_path(sysfs_path, bus_id, SYSFS_NAME_LEN)) - return -1; - - snprintf(bus_dev_name, MAX_NAME_LEN, "%s/%s/%s/%s/%s", sysfs_mnt_path, - SYSFS_BUS_NAME, bus, SYSFS_DEVICES_NAME, bus_id); - - if (stat(sysfs_path, &stat_buf)) - return -1; - dev_inode = stat_buf.st_ino; - - if (stat(bus_dev_name, &stat_buf)) { - if (errno == ENOENT) - return 0; - else - return -1; - } - if (dev_inode == stat_buf.st_ino) - return 1; - else - return 0; -} - static int get_major_minor(const char *devpath, int *major, int *minor) { char dev_value[MAX_ATTR_LEN]; @@ -168,7 +123,7 @@ static int get_major_minor(const char *devpath, int *major, int *minor) * And if sysfsutils changes, check for ENOENT and handle * it separately. */ - log_message(LOG_DEBUG, "%s could not get dev attribute: %s\n", + log_message(LOG_DEBUG, "%s: could not get dev attribute: %s\n", devpath, strerror(errno)); return -1; } @@ -534,7 +489,7 @@ static int set_options(int argc, char **argv, const char *short_opts, return 0; } -static int per_dev_options(struct sysfs_class_device *scsi_dev, int *good_bad, +static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, int *page_code, char *callout) { int retval; @@ -628,9 +583,10 @@ static int scsi_id(const char *target_path, char *maj_min_dev) { int retval; int dev_type = 0; - char full_dev_path[MAX_NAME_LEN]; char serial[MAX_SERIAL_LEN]; - struct sysfs_class_device *scsi_dev; /* of scsi_device full_dev_path */ + struct sysfs_class_device *class_dev; /* of target_path */ + struct sysfs_class_device *class_dev_parent; /* for partitions */ + struct sysfs_device *scsi_dev; /* the scsi_device */ int good_dev; int page_code; char callout[MAX_NAME_LEN]; @@ -661,20 +617,48 @@ static int scsi_id(const char *target_path, char *maj_min_dev) } } - if (sysfs_get_actual_dev(target_path, full_dev_path, MAX_NAME_LEN)) + class_dev = sysfs_open_class_device_path(target_path); + if (!class_dev) { + log_message(LOG_WARNING, "open class %s failed: %s\n", + target_path, strerror(errno)); + return 1; + } + class_dev_parent = sysfs_get_classdev_parent(class_dev); + dprintf("class_dev 0x%p; class_dev_parent 0x%p\n", class_dev, + class_dev_parent); + if (class_dev_parent) { + scsi_dev = sysfs_get_classdev_device(class_dev_parent); + } else { + scsi_dev = sysfs_get_classdev_device(class_dev); + } + + /* + * The close of scsi_dev will close class_dev or class_dev_parent. + */ + + /* + * We assume we are called after the device is completely ready, + * so we don't have to loop here like udev. (And we are usually + * called via udev.) + */ + if (!scsi_dev) { + /* + * errno is not set if we can't find the device link, so + * don't print it out here. + */ + log_message(LOG_WARNING, "Cannot find sysfs device associated with %s\n", + target_path); return 1; + } - dprintf("full_dev_path %s\n", full_dev_path); /* - * Allow only scsi devices (those that have a matching device - * under /bus/scsi/devices). + * Allow only scsi devices. * * Other block devices can support SG IO, but only ide-cd does, so * for now, don't bother with anything else. */ - retval = sysfs_is_bus(full_dev_path, "scsi"); - if (retval == 0) { + if (strcmp(scsi_dev->bus, "scsi") != 0) { if (hotplug_mode) /* * Expected in some cases. @@ -684,14 +668,12 @@ static int scsi_id(const char *target_path, char *maj_min_dev) log_message(LOG_WARNING, "%s is not a scsi device\n", target_path); return 1; - } else if (retval < 0) { - log_message(LOG_WARNING, "sysfs_is_bus failed: %s\n", - strerror(errno)); - return 1; } /* * mknod a temp dev to communicate with the device. + * + * XXX pass down class_dev or class_dev_parent. */ if (!dev_specified && create_tmp_dev(target_path, maj_min_dev, dev_type)) { @@ -699,13 +681,6 @@ static int scsi_id(const char *target_path, char *maj_min_dev) return 1; } - scsi_dev = sysfs_open_class_device_path(full_dev_path); - if (!scsi_dev) { - log_message(LOG_WARNING, "open class %s failed: %s\n", - full_dev_path, strerror(errno)); - return 1; - } - /* * Get any per device (vendor + model) options from the config * file. @@ -718,14 +693,7 @@ static int scsi_id(const char *target_path, char *maj_min_dev) retval = 1; } else if (callout[0] != '\0') { /* - * exec vendor callout, pass it only the "name" to be used - * for error messages, and the dev to open. - * - * This won't work if we need to pass on the original - * command line (when not hotplug mode) since the option - * parsing and per dev parsing modify the argv's. - * - * XXX Not implemented yet. And not fully tested ;-) + * XXX Disabled for now ('c' is not in any options[]). */ retval = 1; } else if (scsi_get_serial(scsi_dev, maj_min_dev, page_code, @@ -736,14 +704,14 @@ static int scsi_id(const char *target_path, char *maj_min_dev) } if (!retval) { if (display_bus_id) - printf("%s ", scsi_dev->name); + printf("%s: ", scsi_dev->name); printf("%s", serial); if (!hotplug_mode) printf("\n"); dprintf("%s\n", serial); retval = 0; } - sysfs_close_class_device(scsi_dev); + sysfs_close_device(scsi_dev); if (!dev_specified) unlink(maj_min_dev); diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 573a2b60d7..9edb39ec49 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -47,9 +47,9 @@ extern int sysfs_get_attr(const char *devpath, const char *attr, char *value, size_t bufsize); -extern int scsi_get_serial (struct sysfs_class_device *scsi_dev, - const char *devname, int page_code, char *serial, - int len); +extern int scsi_get_serial (struct sysfs_device *scsi_dev, const char + *devname, int page_code, char *serial, int + len); extern void log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 9fb0f05e61..ae83330c30 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -32,7 +32,6 @@ #include #include #include - #include "scsi_id.h" #include "scsi.h" @@ -70,12 +69,6 @@ static const struct scsi_id_search_values id_search_list[] = { static const char hex_str[]="0123456789abcdef"; -/* - * XXX maybe move all these to an sg_io.c file. - * - * From here ... - */ - /* * Values returned in the result/status, only the ones used by the code * are used here. @@ -160,8 +153,7 @@ static int sg_err_category3(struct sg_io_hdr *hp) hp->sbp, hp->sb_len_wr); } -static int scsi_dump_sense(struct sysfs_class_device *scsi_dev, - struct sg_io_hdr *io) +static int scsi_dump_sense(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) { unsigned char *sense_buffer; int s; @@ -257,7 +249,7 @@ static int scsi_dump_sense(struct sysfs_class_device *scsi_dev, scsi_dev->name, sense_buffer[0], sense_buffer[2]); log_message(LOG_WARNING, - "%s: non-extended sense class %d code 0x%0x ", + "%s: non-extended sense class %d code 0x%0x\n", scsi_dev->name, sense_class, code); } @@ -277,7 +269,7 @@ static int scsi_dump_sense(struct sysfs_class_device *scsi_dev, return -1; } -static int scsi_dump(struct sysfs_class_device *scsi_dev, struct sg_io_hdr *io) +static int scsi_dump(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) { if (!io->status && !io->host_status && !io->msg_status && !io->driver_status) { @@ -298,9 +290,9 @@ static int scsi_dump(struct sysfs_class_device *scsi_dev, struct sg_io_hdr *io) return -1; } -static int scsi_inquiry(struct sysfs_class_device *scsi_dev, int fd, - unsigned char evpd, unsigned char page, unsigned - char *buf, unsigned int buflen) +static int scsi_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned + char evpd, unsigned char page, unsigned char *buf, + unsigned int buflen) { unsigned char inq_cmd[INQUIRY_CMDLEN] = { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; @@ -332,7 +324,7 @@ resend: io_hdr.timeout = DEF_TIMEOUT; if (ioctl(fd, SG_IO, &io_hdr) < 0) { - log_message(LOG_WARNING, "%s ioctl failed: %s\n", + log_message(LOG_WARNING, "%s: ioctl failed: %s\n", scsi_dev->name, strerror(errno)); return -1; } @@ -349,11 +341,6 @@ resend: retval = scsi_dump(scsi_dev, &io_hdr); } - /* - * XXX where is the length checked? That is, was our request - * buffer long enough? - */ - if (!retval) { retval = buflen; memcpy(buf, buffer, retval); @@ -369,13 +356,7 @@ resend: return retval; } -/* - * XXX maybe move all these to an sg_io.c file. - * - * Ending here. - */ - -static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, +static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, char *buffer, int len) { int retval; @@ -392,7 +373,7 @@ static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, return 1; } if (buffer[3] > len) { - log_message(LOG_WARNING, "%s: page 0 buffer too long %d", + log_message(LOG_WARNING, "%s: page 0 buffer too long %d\n", scsi_dev->name, buffer[3]); return 1; } @@ -417,7 +398,7 @@ static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, return 1; } if (!strncmp(&buffer[VENDOR_LENGTH], vendor, VENDOR_LENGTH)) { - log_message(LOG_WARNING, "%s invalid page0 data\n", + log_message(LOG_WARNING, "%s: invalid page0 data\n", scsi_dev->name); return 1; } @@ -429,8 +410,7 @@ static int do_scsi_page0_inquiry(struct sysfs_class_device *scsi_dev, int fd, * The caller checks that serial is long enough to include the vendor + * model. */ -static int prepend_vendor_model(struct sysfs_class_device *scsi_dev, - char *serial) +static int prepend_vendor_model(struct sysfs_device *scsi_dev, char *serial) { char attr[MAX_ATTR_LEN]; int ind; @@ -477,10 +457,9 @@ static int prepend_vendor_model(struct sysfs_class_device *scsi_dev, * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill * serial number. **/ -static int check_fill_0x83_id(struct sysfs_class_device *scsi_dev, - char *page_83, - const struct scsi_id_search_values *id_search, - char *serial, int max_len) +static int check_fill_0x83_id(struct sysfs_device *scsi_dev, char + *page_83, const struct scsi_id_search_values + *id_search, char *serial, int max_len) { int i, j, len; @@ -565,7 +544,7 @@ static int check_fill_0x83_id(struct sysfs_class_device *scsi_dev, return 0; } -static int do_scsi_page83_inquiry(struct sysfs_class_device *scsi_dev, int fd, +static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, char *serial, int len) { int retval; @@ -622,7 +601,7 @@ static int do_scsi_page83_inquiry(struct sysfs_class_device *scsi_dev, int fd, return 1; } -static int do_scsi_page80_inquiry(struct sysfs_class_device *scsi_dev, int fd, +static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, char *serial, int max_len) { int retval; @@ -662,7 +641,7 @@ static int do_scsi_page80_inquiry(struct sysfs_class_device *scsi_dev, int fd, return 0; } -int scsi_get_serial (struct sysfs_class_device *scsi_dev, const char *devname, +int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, int page_code, char *serial, int len) { unsigned char page0[256]; @@ -674,9 +653,9 @@ int scsi_get_serial (struct sysfs_class_device *scsi_dev, const char *devname, } memset(serial, 0, len); dprintf("opening %s\n", devname); - fd = open(devname, O_RDONLY); + fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { - log_message(LOG_WARNING, "%s cannot open %s: %s\n", + log_message(LOG_WARNING, "%s: cannot open %s: %s\n", scsi_dev->name, devname, strerror(errno)); return 1; } @@ -698,7 +677,7 @@ int scsi_get_serial (struct sysfs_class_device *scsi_dev, const char *devname, goto completed; } } else if (page_code != 0x00) { - log_message(LOG_WARNING, "%s unsupported page code 0x%d\n", + log_message(LOG_WARNING, "%s: unsupported page code 0x%d\n", scsi_dev->name, page_code); return 1; } @@ -743,6 +722,7 @@ int scsi_get_serial (struct sysfs_class_device *scsi_dev, const char *devname, retval = 1; completed: if (close(fd) < 0) - log_message(LOG_WARNING, "close failed: %s", strerror(errno)); + log_message(LOG_WARNING, "%s: close failed: %s\n", + scsi_dev->name, strerror(errno)); return retval; } -- cgit v1.2.3-54-g00ecf From 7eb136adb8fe265050b2a3e44b216e747163743f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 28 Feb 2004 01:11:20 -0800 Subject: [PATCH] 018 release --- ChangeLog | 32 ++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 5 ++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bcc22c2328..a3cc00c17a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +Summary of changes from v018 to v019 +============================================ + +Kay Sievers: + o TODO update + o udev - correct relative symlink + o udev - safer string handling - part four + o udev - safer string handling - part three + o udev - safer string handling - part two + o udev - man page update + o udev - safer string handling all over the place + o manpage update + o udev - allow all files in a directory as the config + o udev - simple klibc textual uid/gid handling + +Andrey Borzenkov: + o do not remove real .udev.tdb during RPM build + +Greg Kroah-Hartman: + o add new TODO item about local user permissions + o Add initial SELinux support for udev + o fix build for very old versions of make + o remove limit of the number of args passed to PROGRAM + o force udev to include the internal version of libsysfs and never the external one + o fix up libsysfs header file usage to fix bug reports from users that have sysfsutils installed already + o remove udevtest on 'make clean' + o remove udevd priority TODO item, as it's not needed at all + +Patrick Mansfield: + o update udev scsi_id to scsi_id 0.4 + + Summary of changes from v017 to v018 ============================================ diff --git a/Makefile b/Makefile index b24e147838..9f7c439974 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ DAEMON = udevd SENDER = udevsend HELPER = udevinfo TESTER = udevtest -VERSION = 018_bk +VERSION = 019 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 4cd1f8a94b..92a2911711 100644 --- a/udev.spec +++ b/udev.spec @@ -39,7 +39,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 018_bk +Version: 019 Release: 1 License: GPL Group: Utilities/System @@ -150,6 +150,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Fri Feb 27 2004 Greg Kroah-Hartman +- added ability to build with SELinux support + * Thu Feb 19 2004 Greg Kroah-Hartman - add some more files to the documentation directory - add ability to build scsi_id and make it the default -- cgit v1.2.3-54-g00ecf From c58e36c092ad5acc84d35e455ecc74096b25ae66 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 28 Feb 2004 01:59:02 -0800 Subject: [PATCH] udev - safer sprintf() use Here is for now my last patch to the string handling for a rather theorethical case, where the node is very very very long. :) We have accordant to strfieldcat(to, from) now a strintcat(to, i) macro, which appends the ascii representation of a integer to a string in a safe way. --- namedev.c | 6 +++--- udev-add.c | 3 ++- udev-remove.c | 3 ++- udev.h | 12 ++++++++++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/namedev.c b/namedev.c index 7c07e3b104..581a7f2218 100644 --- a/namedev.c +++ b/namedev.c @@ -263,11 +263,11 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("substitute kernel number '%s'", udev->kernel_number); break; case 'm': - sprintf(pos, "%u", udev->minor); + strnintcat(string, udev->minor, maxsize); dbg("substitute minor number '%u'", udev->minor); break; - case 'M': - sprintf(pos, "%u", udev->major); + case 'M': + strnintcat(string, udev->major, maxsize); dbg("substitute major number '%u'", udev->major); break; case 'c': diff --git a/udev-add.c b/udev-add.c index 8fdd66fad5..3a72c544b8 100644 --- a/udev-add.c +++ b/udev-add.c @@ -211,7 +211,8 @@ static int create_node(struct udevice *dev, int fake) info("creating device partition nodes '%s[1-%i]'", filename, dev->partitions); if (!fake) { for (i = 1; i <= dev->partitions; i++) { - sprintf(partitionname, "%s%i", filename, i); + strfieldcpy(partitionname, filename); + strintcat(partitionname, i); make_node(partitionname, dev->major, dev->minor + i, dev->mode, uid, gid); } diff --git a/udev-remove.c b/udev-remove.c index 8794429635..e62d1fb122 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -87,7 +87,8 @@ static int delete_node(struct udevice *dev) if (dev->partitions > 0) { info("removing partitions '%s[1-%i]'", filename, dev->partitions); for (i = 1; i <= dev->partitions; i++) { - sprintf(partitionname, "%s%i", filename, i); + strfieldcpy(partitionname, filename); + strintcat(partitionname, i); unlink(partitionname); } } diff --git a/udev.h b/udev.h index 3b676acf40..5737c84c9d 100644 --- a/udev.h +++ b/udev.h @@ -85,6 +85,18 @@ do { \ strncat(to, from, maxsize - strlen(to)-1); \ } while (0) +#define strintcat(to, i) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%u", i); \ +} while (0) + +#define strnintcat(to, i, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ +} while (0) + static inline char *get_action(void) { char *action; -- cgit v1.2.3-54-g00ecf From f070df164c95f825ba0217a71b2d475fd4a8a29e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 1 Mar 2004 22:23:35 -0800 Subject: [PATCH] udev - kill udevd on install We want to kill udevd after installing a new version, cause the event contains a magic with the version number of udev. --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9f7c439974..739b9c1351 100644 --- a/Makefile +++ b/Makefile @@ -373,10 +373,12 @@ install: install-config install-dbus-policy all $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 - - ln -f -s ./udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 - - rm -f $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug - - rm -f $(DESTDIR)$(udevdir)/.udev.tdb + - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug +ifndef DESTDIR + - killall udevd + - rm -f $(udevdir)/.udev.tdb +endif @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ -- cgit v1.2.3-54-g00ecf From 97ed02eebe5c0676848d0707d13f4a21b6f4232f Mon Sep 17 00:00:00 2001 From: "arvidjaar@mail.ru" Date: Mon, 1 Mar 2004 22:23:39 -0800 Subject: [PATCH] Add symlink only rules support --- namedev.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/namedev.c b/namedev.c index 581a7f2218..c9232fa2aa 100644 --- a/namedev.c +++ b/namedev.c @@ -816,17 +816,31 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud list_for_each_entry(dev, &config_device_list, node) { dbg("process rule"); if (match_rule(dev, class_dev, udev, sysfs_device) == 0) { - if (dev->name[0] == '\0') { + if (dev->name[0] == '\0' && dev->symlink[0] == '\0') { info("configured rule in '%s' at line %i applied, '%s' is ignored", udev_rules_filename, dev->config_line, udev->kernel_name); return -1; } - info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", - udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); - strfieldcpy(udev->name, dev->name); - strfieldcpy(udev->symlink, dev->symlink); - goto found; + if (dev->symlink[0] != '\0') { + char temp[NAME_MAX]; + + info("configured rule in '%s' at line %i applied, added symlink '%s'", + udev_rules_filename, dev->config_line, dev->symlink); + /* do not clobber dev */ + strfieldcpy(temp, dev->symlink); + apply_format(udev, temp, sizeof(temp), + class_dev, sysfs_device); + strfieldcat(udev->symlink, temp); + strfieldcat(udev->symlink, " "); + } + + if (dev->name[0] != '\0') { + info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", + udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); + strfieldcpy(udev->name, dev->name); + goto found; + } } } @@ -838,8 +852,6 @@ found: /* substitute placeholder */ apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); - apply_format(udev, udev->symlink, sizeof(udev->symlink), - class_dev, sysfs_device); udev->partitions = dev->partitions; done: perm = find_perm(udev->name); -- cgit v1.2.3-54-g00ecf From e408796e91e89a3fa50d1b8dc964f07fd439d865 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 28 Feb 2004 01:59:44 -0800 Subject: [PATCH] 019_bk mark --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 739b9c1351..c315d099ef 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ DAEMON = udevd SENDER = udevsend HELPER = udevinfo TESTER = udevtest -VERSION = 019 +VERSION = 019_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 92a2911711..ae802ca8e5 100644 --- a/udev.spec +++ b/udev.spec @@ -39,7 +39,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 019 +Version: 019_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 63ead27c228f9306f175b14a49df2415d09ece10 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 28 Feb 2004 06:53:25 -0800 Subject: [PATCH] udev - activate formt length attribute We carried the the old callout part selector syntax for two releases now after it was replaced by the new %c{1} syntax. So here we remove the old syntax and use the code to possibly specify the maximum count of chars to insert into the string. It will work with all of our format chars. I don't know if somebody will use it, but the code is already there :) 's%3s{vendor}' returns "IBM" now, instead of "IBM-ESXS". Also added is a test for it and a few words in the man page. --- namedev.c | 10 +++++++--- test/udev-test.pl | 9 +++++++++ udev.8 | 8 ++++++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/namedev.c b/namedev.c index c9232fa2aa..505264554d 100644 --- a/namedev.c +++ b/namedev.c @@ -220,7 +220,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, char *pos2; char *pos3; char *attr; - int num; + int len; int i; char c; struct sysfs_attribute *tmpattr; @@ -232,7 +232,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, if (pos != NULL) { pos[0] = '\0'; tail = pos+1; - num = get_format_len(&tail); + len = get_format_len(&tail); c = tail[0]; strfieldcpy(temp, tail+1); tail = temp; @@ -274,7 +274,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, if (strlen(udev->program_result) == 0) break; /* get part part of the result string */ - i = num; /* num syntax is deprecated and will be removed */ + i = 0; if (attr != NULL) i = atoi(attr); if (i > 0) { @@ -317,6 +317,10 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("unknown substitution type '%%%c'", c); break; } + /* truncate to specified length */ + if (len > 0) + pos[len] = '\0'; + strnfieldcat(string, tail, maxsize); } } diff --git a/test/udev-test.pl b/test/udev-test.pl index a3bf768fe3..6b7f515442 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -191,6 +191,15 @@ EOF expected => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "test NAME substitution chars (with length limit)", + subsys => "block", + devpath => "block/sda/sda3", + expected => "M8-m3-n3-b0:0-sIBM" , + conf => < Date: Mon, 1 Mar 2004 22:28:51 -0800 Subject: [PATCH] udev - fix debug info for multiple rule file config On Sat, Feb 28, 2004 at 09:56:32PM +0100, Kay Sievers wrote: > Andrey pointed out that we don't print the right filename in the debug > output. Here is a fix for that. It applies on top of Andrey's symlink > patch, cause we are touching the same part of the code. The copy/paste devil catched me :) Here is a fixed one. --- namedev.c | 6 +++--- namedev.h | 1 + namedev_parse.c | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/namedev.c b/namedev.c index 505264554d..2ebf276f6b 100644 --- a/namedev.c +++ b/namedev.c @@ -822,7 +822,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud if (match_rule(dev, class_dev, udev, sysfs_device) == 0) { if (dev->name[0] == '\0' && dev->symlink[0] == '\0') { info("configured rule in '%s' at line %i applied, '%s' is ignored", - udev_rules_filename, dev->config_line, udev->kernel_name); + dev->config_file, dev->config_line, udev->kernel_name); return -1; } @@ -830,7 +830,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud char temp[NAME_MAX]; info("configured rule in '%s' at line %i applied, added symlink '%s'", - udev_rules_filename, dev->config_line, dev->symlink); + dev->config_file, dev->config_line, dev->symlink); /* do not clobber dev */ strfieldcpy(temp, dev->symlink); apply_format(udev, temp, sizeof(temp), @@ -841,7 +841,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud if (dev->name[0] != '\0') { info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", - udev_rules_filename, dev->config_line, udev->kernel_name, dev->name); + dev->config_file, dev->config_line, udev->kernel_name, dev->name); strfieldcpy(udev->name, dev->name); goto found; } diff --git a/namedev.h b/namedev.h index ffdde83ca4..7f875ed603 100644 --- a/namedev.h +++ b/namedev.h @@ -72,6 +72,7 @@ struct config_device { char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; int partitions; + char config_file[NAME_SIZE]; int config_line; }; diff --git a/namedev_parse.c b/namedev_parse.c index d300b0907d..19acd96ef0 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -260,6 +260,7 @@ static int namedev_parse_rules(char *filename) } dev.config_line = lineno; + strfieldcpy(dev.config_file, filename); retval = add_config_dev(&dev); if (retval) { dbg("add_config_dev returned with error %d", retval); -- cgit v1.2.3-54-g00ecf From b7b6562729a661f6ebf4576e9ce90e9228315e93 Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Mon, 1 Mar 2004 22:34:08 -0800 Subject: [PATCH] remove usage of expr in ide-devfs.sh fix_expr: remove usage of expr in ide-devfs.sh, because it may be in /usr/bin and not available at early boot time. --- extras/ide-devfs.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 0a9369dff4..e5bf177f8b 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -8,7 +8,7 @@ HOST="${2%\.[0-9]}" TARGET="${2#[0-9]\.}" if [ -z "${HOST#[13579]}" ]; then - HOST=`expr ${HOST} - 1` + HOST=$((${HOST} - 1)) BUS="1" else BUS="0" @@ -24,7 +24,7 @@ get_dev_number() { if [ -e "${x}" ]; then MEDIA=`cat ${x}` if [ "${MEDIA}" = "$2" ]; then - num=`expr ${num} + 1` + num=$((${num} + 1)) fi if [ "${x}" = "/proc/ide/${DRIVE}/media" ]; then break @@ -32,7 +32,7 @@ get_dev_number() { fi done - echo `expr ${num} - 1` + echo $((${num} - 1)) } if [ -z "$3" ]; then -- cgit v1.2.3-54-g00ecf From 758f236fd1385fc7d95c719ec03e4e22ef205bf8 Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Mon, 1 Mar 2004 22:34:10 -0800 Subject: [PATCH] escape dashes in man pages man-dashes.diff: escape dashes in man pages, helps with UTF-8 locales (by Philipp Matthias Hahn). --- udev.8 | 6 +++--- udevinfo.8 | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/udev.8 b/udev.8 index e449ef8dbb..21ec908b82 100644 --- a/udev.8 +++ b/udev.8 @@ -304,8 +304,8 @@ Matches any single character, but does not match zero characters. .B [ ] Matches any single character specified within the brackets. For example, the pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also -supported within this match with the '-' character. For example, to match on -the range of all digits, the pattern [0-9] would be used. If the first character +supported within this match with the '\-' character. For example, to match on +the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!' then any character not enclosed is matched. .SH "FILES" .nf @@ -320,7 +320,7 @@ following the '[' is a '!' then any character not enclosed is matched. .BR hotplug (8) .PP The -.I http://linux-hotplug.sourceforge.net/ +.I http://linux\-hotplug.sourceforge.net/ web site. .SH AUTHORS .B udev diff --git a/udevinfo.8 b/udevinfo.8 index 1716d17434..ad16ce6aed 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -3,7 +3,7 @@ udevinfo \- retrieve information from udev .SH SYNOPSIS .B udevinfo -.RI "[-q " query_type " -p " sysfs_path "] [-drVh]" +.RI "[\-q " query_type " \-p " sysfs_path "] [\-drVh]" .SH "DESCRIPTION" .B udevinfo allows users to query the udev database for information on any of the devices @@ -13,40 +13,40 @@ in the sysfs tree to help in creating rule files. .SH "OPTIONS" .TP -.B -V +.B \-V Print the version information. .TP -.B -r +.B \-r Print the the .B udev_root directory. When used in conjunction with a query for the node name, the .B udev_root will be prepended. .TP -.BI -q " query_type" +.BI \-q " query_type" Query the database for specified value of a created device node. -.RB Needs " -p " or " -n " specified. +.RB Needs " \-p " or " \-n " specified. .br Valid types are: .BR name ", " symlink ", " mode " ," owner " , " group " or " path. .TP -.BI -p " sysfs_path" +.BI \-p " sysfs_path" Specify the sysfs path of the device to query. .TP -.BI -n " name" +.BI \-n " name" Specify the name of the node for the device to query. .TP -.B -a +.B \-a Print all .BI SYSFS{ filename } attributes along the device chain. Useful for for finding unique attributes to compose a rule. -.RB Needs " -p " specified. +.RB Needs " \-p " specified. .TP -.B -d +.B \-d Dump the whole database. .TP -.B -h +.B \-h Print help text. .SH "FILES" .nf -- cgit v1.2.3-54-g00ecf From 92c5ddee382d06de63c10aa81a18255d0b789812 Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Mon, 1 Mar 2004 22:34:12 -0800 Subject: [PATCH] no error on enoent no_error_on_enoent: do not exit with an error and delete all files when a device or directory does not exist. --- udev-remove.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/udev-remove.c b/udev-remove.c index e62d1fb122..dcd460bedc 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -51,6 +51,8 @@ static int delete_path(char *path) /* remove if empty */ retval = rmdir(path); + if (errno == ENOENT) + retval = 0; if (retval) { if (errno == ENOTEMPTY) return 0; @@ -77,6 +79,8 @@ static int delete_node(struct udevice *dev) info("removing device node '%s'", filename); retval = unlink(filename); + if (errno == ENOENT) + retval = 0; if (retval) { dbg("unlink(%s) failed with error '%s'", filename, strerror(errno)); @@ -109,6 +113,8 @@ static int delete_node(struct udevice *dev) dbg("unlinking symlink '%s'", filename); retval = unlink(filename); + if (errno == ENOENT) + retval = 0; if (retval) { dbg("unlink(%s) failed with error '%s'", filename, strerror(errno)); -- cgit v1.2.3-54-g00ecf From 311e9ae68139083c801284a52f498c105d7c09f9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 1 Mar 2004 22:38:44 -0800 Subject: [PATCH] udev - man page update Here is a small change to the udev man page: - clarify the use of the NAME{all_partitions} syntax and add a example to udev.rules.example - mention the empty NAME field to ignore the device - prepare a SYMLINK field for the addition of Andrey's "multiple symlinks" documentation :) --- etc/udev/udev.rules.examples | 4 ++++ udev.8 | 23 ++++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/etc/udev/udev.rules.examples b/etc/udev/udev.rules.examples index 0d619e37e6..a464b6ba57 100644 --- a/etc/udev/udev.rules.examples +++ b/etc/udev/udev.rules.examples @@ -51,6 +51,10 @@ KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" # DRI devices always go into a subdirectory (as per the LSB spec) KERNEL="card*", NAME="dri/card%n" +# create all 15 partitions of a USB flash card reader +# note the trailing spaces in the attribute, use udevinfo(8) to examine your device +BUS="scsi", SYSFS{model}="CF/MD ", NAME{all_partitions}="compactflash" + # alsa devices KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hw[CD0-9]*", NAME="snd/%k" diff --git a/udev.8 b/udev.8 index 21ec908b82..9eeff96d48 100644 --- a/udev.8 +++ b/udev.8 @@ -151,16 +151,15 @@ file. Every line in the rules file defines the mapping between device attributes and the device file name. One ore more keys are specified to match a rule with the current device. If all keys are matching, the rule will be applied -and the name is used for the device node. One or more optional symlinks -targeting the node may be specified. +and the name is used for the device node. .br If no matching rule is found, the default kernel device name is used. .P -The line format is: +Every rule consists of a list a comma separated fields: .sp -.I key,[key,...] name [, symlink] +.IR "key " ,[ "key " ,...] " name " [, " symlink" ] .sp -where keys are: +where possible fields are: .TP .B BUS Match the bus type of the device. @@ -196,13 +195,19 @@ Match the returned string of the last call. This key may used in any following rule after a .B PROGRAM call. -.P -The +.TP .B NAME -field given with the attribute +The name of the node to be created. If the name field is omitted or its +value is empty, the device will be ignored and no node will be created. +.br +If given with the attribute .BR NAME{ all_partitions } -will create all 15 partitions of a blockdevice. +it will create all 15 partitions of a blockdevice. This may be useful for removable media devices. +.TP +.B SYMLINK +The name of a symlink targeting the node. Multiple symlinks may be +specified by separating the names by the space character. .P .RB "The " NAME " ," SYMLINK " and " PROGRAM fields support simple printf-like string substitution: -- cgit v1.2.3-54-g00ecf From 534c853df52810b63b126e7e43d051a682829464 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 1 Mar 2004 22:42:30 -0800 Subject: [PATCH] add $local user spport for permissions --- klibc_fixups.c | 37 +++++++++++++++++++++++++++++++++++++ klibc_fixups.h | 47 +++++++++++++++++++++++++++++++++++++++++++++-- udev-add.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 119 insertions(+), 2 deletions(-) diff --git a/klibc_fixups.c b/klibc_fixups.c index 927f2f649a..1241eb7d10 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "klibc_fixups.h" @@ -32,6 +33,8 @@ #define PW_FILE "/etc/passwd" #define GR_FILE "/etc/group" +#define UTMP_FILE "/var/run/utmp" + /* return the id of a passwd style line, selected by the users name */ static unsigned long get_id_by_name(const char *uname, const char *dbfile) @@ -107,4 +110,38 @@ struct group *getgrnam(const char *name) return &gr; } + +int ufd = -1; + +void setutent() +{ + if (ufd < 0) + ufd = open(UTMP_FILE, O_RDONLY); + fcntl(ufd, F_SETFD, FD_CLOEXEC); + lseek(ufd, 0, SEEK_SET); +} + +void endutent() { + if (ufd < 0) + return; + close(ufd); + ufd = -1; +} + +struct utmp *getutent(void) +{ + static struct utmp utmp; + int retval; + + if (ufd < 0) { + setutent(); + if (ufd < 0) + return NULL; + } + retval = read(ufd, &utmp, sizeof(struct utmp)); + if (retval < 1) + return NULL; + return &utmp; +} + #endif diff --git a/klibc_fixups.h b/klibc_fixups.h index 19bfd51caa..f6c91cdd94 100644 --- a/klibc_fixups.h +++ b/klibc_fixups.h @@ -1,7 +1,7 @@ #ifdef __KLIBC__ #ifndef KLIBC_FIXUPS_H -#define KLIBC_FIXUPS_H +#define KLIBC_FIXUPS_H struct passwd { char *pw_name; /* user name */ @@ -23,6 +23,49 @@ struct group { struct passwd *getpwnam(const char *name); struct group *getgrnam(const char *name); -#endif +#define UT_LINESIZE 32 +#define UT_NAMESIZE 32 +#define UT_HOSTSIZE 256 +#define USER_PROCESS 7 /* normal process */ +#define ut_time ut_tv.tv_sec + + +extern int ufd; + +struct exit_status { + short int e_termination; /* process termination status */ + short int e_exit; /* process exit status */ +}; + +struct utmp +{ + short int ut_type; /* type of login */ + pid_t ut_pid; /* pid of login process */ + char ut_line[UT_LINESIZE]; /* devicename */ + char ut_id[4]; /* Inittab id */ + char ut_user[UT_NAMESIZE]; /* username */ + char ut_host[UT_HOSTSIZE]; /* hostname for remote login */ + struct exit_status ut_exit; /* exit status of a process marked as DEAD_PROCESS */ + /* The ut_session and ut_tv fields must be the same size for 32 and 64-bit */ +#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 + int32_t ut_session; /* sid used for windowing */ + struct { + int32_t tv_sec; /* seconds */ + int32_t tv_usec; /* microseconds */ + } ut_tv; +#else + long int ut_session; + struct timeval ut_tv; #endif + int32_t ut_addr_v6[4]; /* internet address of remote host */ + char __unused[20]; /* reserved for future use */ +}; + +struct utmp *getutent(void); +void setutent(void); +void endutent(void); + + +#endif /* KLIBC_FIXUPS_H */ +#endif /* __KLIBC__ */ diff --git a/udev-add.c b/udev-add.c index 3a72c544b8..19196bec54 100644 --- a/udev-add.c +++ b/udev-add.c @@ -32,6 +32,7 @@ #include #ifndef __KLIBC__ #include +#include #endif #include "libsysfs/sysfs/libsysfs.h" @@ -44,6 +45,8 @@ #include "udevdb.h" #include "klibc_fixups.h" +#define LOCAL_USER "$local" + /* * Right now the major/minor of a device is stored in a file called * "dev" in sysfs. @@ -132,6 +135,37 @@ static int make_node(char *filename, int major, int minor, unsigned int mode, ui return 0; } +/* get the local logged in user */ +static void set_to_local_user(char *user) +{ + struct utmp *u; + time_t recent = 0; + + strnfieldcpy(user, default_owner_str, OWNER_SIZE); + setutent(); + while (1) { + u = getutent(); + if (u == NULL) + break; + + /* is this a user login ? */ + if (u->ut_type != USER_PROCESS) + continue; + + /* is this a local login ? */ + if (strcmp(u->ut_host, "")) + continue; + + if (u->ut_time > recent) { + recent = u->ut_time; + strfieldcpy(user, u->ut_user); + dbg("local user is '%s'", user); + break; + } + } + endutent(); +} + static int create_node(struct udevice *dev, int fake) { struct stat stats; @@ -175,6 +209,9 @@ static int create_node(struct udevice *dev, int fake) if (endptr[0] == '\0') uid = (uid_t) id; else { + if (strncmp(dev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0) + set_to_local_user(dev->owner); + struct passwd *pw = getpwnam(dev->owner); if (pw == NULL) dbg("specified user unknown '%s'", dev->owner); -- cgit v1.2.3-54-g00ecf From cbd2ea21e4eac53bb95465c7808c723b787a709c Mon Sep 17 00:00:00 2001 From: "christophe.varoqui@free.fr" Date: Mon, 1 Mar 2004 23:08:47 -0800 Subject: [PATCH] multipath update --- extras/multipath/ChangeLog | 10 +++++++ extras/multipath/Makefile | 28 +++++++++++++------- extras/multipath/devinfo.c | 2 +- extras/multipath/devmap_name.8 | 30 +++++++++++++++++++++ extras/multipath/main.c | 37 +++++++++++--------------- extras/multipath/main.h | 5 ++-- extras/multipath/multipath.8 | 53 ++++++++++++++++++++++++++++++++++++++ extras/multipath/multipath.hotplug | 3 ++- 8 files changed, 132 insertions(+), 36 deletions(-) create mode 100644 extras/multipath/devmap_name.8 create mode 100644 extras/multipath/multipath.8 diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog index 43aa497e51..a2863ec23e 100644 --- a/extras/multipath/ChangeLog +++ b/extras/multipath/ChangeLog @@ -1,3 +1,13 @@ +2004-02-21 multipath-018 + * From the Debian SID inclusion review (Philipp Matthias Hahn) + * use DESTDIR install prefix in the Makefile + * add man pages for devmap_name & multipath + * correct libsysfs.h includes + * fork the hotplug script in its own shell + * Sync with the kernel device mapper code as of 2.6.3-udm3 + ie. Remove the test interval parameter and its uses + * Remove superfluous scsi parameter passed from hotplug + * Add the man pages to the [un]install targets 2004-02-17 multipath-017 * remove the restrictive -f flag. Introduce a more generic "-m iopolicy" one. diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile index eeec25b893..ee7f60e472 100644 --- a/extras/multipath/Makefile +++ b/extras/multipath/Makefile @@ -10,8 +10,11 @@ bindir = ${exec_prefix}/sbin udevdir = ../.. klibcdir = $(udevdir)/klibc sysfsdir = $(udevdir)/libsysfs +mandir = /usr/share/man/man8 CC = gcc +GZIP = /bin/gzip -c + GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} KERNEL_DIR = /lib/modules/${shell uname -r}/build CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ @@ -45,26 +48,33 @@ all: recurse $(EXEC): $(OBJS) $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC) strip $(EXEC) + $(GZIP) $(EXEC).8 > $(EXEC).8.gz devmap_name: devmap_name.o $(LD) -o devmap_name $(CRT0) devmap_name.o $(DMOBJS) $(LIB) $(LIBGCC) strip devmap_name + $(GZIP) devmap_name.8 > devmap_name.8.gz clean: - rm -f core *.o $(EXEC) devmap_name + rm -f core *.o $(EXEC) devmap_name *.gz $(MAKE) -C libdevmapper clean install: - install -d $(bindir) - install -m 755 $(EXEC) $(bindir)/ - install -m 755 devmap_name $(bindir)/ - install -d /etc/hotplug.d/scsi/ - install -m 755 multipath.hotplug /etc/hotplug.d/scsi/ + install -d $(DESTDIR)$(bindir) + install -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + install -m 755 devmap_name $(DESTDIR)$(bindir)/ + install -d $(DESTDIR)/etc/hotplug.d/scsi/ + install -m 755 multipath.hotplug $(DESTDIR)/etc/hotplug.d/scsi/ + install -d $(DESTDIR)$(mandir) + install -m 644 devmap_name.8.gz $(DESTDIR)$(mandir) + install -m 644 multipath.8.gz $(DESTDIR)$(mandir) uninstall: - rm /etc/hotplug.d/scsi/multipath.hotplug - rm $(bindir)/$(EXEC) - rm $(bindir)/devmap_name + rm $(DESTDIR)/etc/hotplug.d/scsi/multipath.hotplug + rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)$(bindir)/devmap_name + rm $(DESTDIR)$(mandir)/devmap_name.8.gz + rm $(DESTDIR)$(mandir)/multipath.8.gz # Code dependencies main.o: main.c main.h sg_include.h devinfo.h diff --git a/extras/multipath/devinfo.c b/extras/multipath/devinfo.c index a6b089f517..323da2f2f0 100644 --- a/extras/multipath/devinfo.c +++ b/extras/multipath/devinfo.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include "devinfo.h" #include "sg_include.h" diff --git a/extras/multipath/devmap_name.8 b/extras/multipath/devmap_name.8 new file mode 100644 index 0000000000..f4f03c3ec6 --- /dev/null +++ b/extras/multipath/devmap_name.8 @@ -0,0 +1,30 @@ +.TH DEVMAP_NAME 8 "February 2004" "" "Linux Administrator's Manual" +.SH NAME +devmap_name \- Query device-mapper name +.SH SYNOPSIS +.BI devmap_name " major minor" +.SH DESCRIPTION +.B devmap_name +queries the device-mapper for the name for the device +specified by +.I major +and +.I minor +number. +.br +.B devmap_name +can be called from +.B udev +by the following rule in +.IR /etc/udev/udev.rules : +.sp +.nf +KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \\ + NAME="%k", SYMLINK="%c" +.fi +.SH "SEE ALSO" +.BR udev (8), +.BR dmsetup (8) +.SH AUTHORS +.B devmap_name +was developed by Christophe Varoqui, and others. diff --git a/extras/multipath/main.c b/extras/multipath/main.c index 706b2d1317..dfaa6867dd 100644 --- a/extras/multipath/main.c +++ b/extras/multipath/main.c @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "libdevmapper/libdevmapper.h" #include "main.h" #include "devinfo.h" @@ -110,7 +110,7 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths) char path[FILE_NAME_SIZE]; struct path curpath; - /* if called from hotplug, only consider the paths that relate to */ + /* if called from hotplug, only consider the paths that relate */ /* to the device pointed by conf.hotplugdev */ memset(empty_buff, 0, WWID_SIZE); memset(refwwid, 0, WWID_SIZE); @@ -442,6 +442,7 @@ group_by_serial(struct multipath * mp, struct path * all_paths, char * str) { path_count, path_buff); } sprintf(str, " %i%s", pg_count, pg_buff); + free(bitmap); } static int @@ -507,8 +508,6 @@ setup_map(struct env * conf, struct path * all_paths, if (np < 1) return 0; - params_p += sprintf(params_p, "%i", conf->dm_path_test_int); - if ((all_paths[PINDEX(index,0)].iopolicy == MULTIBUS && conf->iopolicy == -1) || conf->iopolicy == MULTIBUS) { params_p += sprintf(params_p, " 1 %i %s %i %i", @@ -602,18 +601,19 @@ static void usage(char * progname) { fprintf(stderr, VERSION_STRING); - fprintf(stderr, "Usage: %s [-v|-q] [-d] [-i int] [-m max_devs] ", + fprintf(stderr, "Usage: %s [-v|-q] [-d] [-m max_devs]", progname); - fprintf(stderr, "[-p failover|multibus|group_by_serial]\n"); + fprintf(stderr, "[-p failover|multibus|group_by_serial] [device]\n"); fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n"); fprintf(stderr, "\t-q\t\tquiet, no output at all\n"); fprintf(stderr, "\t-d\t\tdry run, do not create or update devmaps\n"); - fprintf(stderr, "\t-i\t\tmultipath target param : polling interval\n"); fprintf(stderr, "\t-m max_devs\tscan {max_devs} devices at most\n"); fprintf(stderr, "\t-p policy\tforce maps to specified policy :\n"); - fprintf(stderr, "\t\t\tfailover\t1 path per priority group\n"); - fprintf(stderr, "\t\t\tmultibus\tall paths in 1 priority group\n"); - fprintf(stderr, "\t\t\tgroup_by_serial\t1 priority group per serial\n"); + fprintf(stderr, "\t failover\t\t- 1 path per priority group\n"); + fprintf(stderr, "\t multibus\t\t- all paths in 1 priority group\n"); + fprintf(stderr, "\t group_by_serial\t- 1 priority group per serial\n"); + fprintf(stderr, "\tdevice\t\tlimit scope to the device's multipath\n"); + fprintf(stderr, "\t\t\t(hotplug-style $DEVPATH reference)\n"); exit(1); } @@ -632,7 +632,6 @@ main(int argc, char *argv[]) conf.verbose = 0; /* 1 == Print all_paths and mp */ conf.quiet = 0; /* 1 == Do not even print devmaps */ conf.iopolicy = -1; /* Apply the defaults in get_unique_id() */ - conf.dm_path_test_int = 10; for (i = 1; i < argc; ++i) { if (0 == strcmp("-v", argv[i])) { @@ -649,25 +648,19 @@ main(int argc, char *argv[]) conf.quiet = 1; } else if (0 == strcmp("-d", argv[i])) conf.dry_run = 1; - else if (0 == strcmp("-i", argv[i])) - conf.dm_path_test_int = atoi(argv[++i]); - else if (0 == strcmp("-p", argv[i++])) { + else if (0 == strcmp("-p", argv[i])) { + i++; if (!strcmp(argv[i], "failover")) conf.iopolicy = FAILOVER; if (!strcmp(argv[i], "multibus")) conf.iopolicy = MULTIBUS; if (!strcmp(argv[i], "group_by_serial")) conf.iopolicy = GROUP_BY_SERIAL; - } else if (0 == strcmp("scsi", argv[i])) - strcpy(conf.hotplugdev, argv[++i]); - else if (*argv[i] == '-') { + } else if (*argv[i] == '-') { fprintf(stderr, "Unknown switch: %s\n", argv[i]); usage(argv[0]); - } else if (*argv[i] != '-') { - fprintf(stderr, "Unknown argument\n"); - usage(argv[0]); - } - + } else + strncpy(conf.hotplugdev, argv[i], FILE_NAME_SIZE); } /* dynamic allocations */ diff --git a/extras/multipath/main.h b/extras/multipath/main.h index e05555599f..cee99d2b88 100644 --- a/extras/multipath/main.h +++ b/extras/multipath/main.h @@ -102,7 +102,6 @@ struct env { int dry_run; int iopolicy; int with_sysfs; - int dm_path_test_int; char sysfs_path[FILE_NAME_SIZE]; char hotplugdev[FILE_NAME_SIZE]; }; @@ -110,8 +109,8 @@ struct env { /* Build version */ #define PROG "multipath" -#define VERSION_CODE 0x000010 -#define DATE_CODE 0x0C1503 +#define VERSION_CODE 0x000012 +#define DATE_CODE 0x021504 #define MULTIPATH_VERSION(version) \ (version >> 16) & 0xFF, \ diff --git a/extras/multipath/multipath.8 b/extras/multipath/multipath.8 new file mode 100644 index 0000000000..98746424b4 --- /dev/null +++ b/extras/multipath/multipath.8 @@ -0,0 +1,53 @@ +.TH MULTIPATH 8 "February 2004" "" "Linux Administrator's Manual" +.SH NAME +multipath \- Device mapper target autoconfig +.SH SYNOPSIS +.B multipath +.RB [\| \-v | \-q \|] +.RB [\| \-d \|] +.RB [\| \-m\ \c +.IR max_devs \|] +.RB [\| \-p\ \c +.BR failover | multibus | group_by_serial \|] +.RB [\| device \|] +.SH DESCRIPTION +.B multipath +is used to detect multiple paths to devices for fail-over or performance reasons and coalesces them. +.SH OPTIONS +.TP +.B \-v +verbose, print all paths and multipaths +.TP +.B \-q +quiet, no output at all +.TP +.B \-d +dry run, do not create or update devmaps +.TP +.BI \-m " max_devs" +scan +.I max_devs +devices at most +.TP +.BI \-p " policy" +force maps to specified policy: +.RS 1.2i +.TP 1.2i +.B failover +1 path per priority group +.TP +.B multibus +all paths in 1 priority group +.TP +.B group_by_serial +1 priority group per serial +.RE +.TP +.B device +limit the [re]configuration to the specified device's multipath scope. device is given in its hotplug $DEVPATH form like /devices/pci0000:03/0000:03:01.0/host0/0:0:5:1 +.SH "SEE ALSO" +.BR udev (8), +.BR dmsetup (8) +.SH AUTHORS +.B multipath +was developed by Christophe Varoqui, and others. diff --git a/extras/multipath/multipath.hotplug b/extras/multipath/multipath.hotplug index 9bab619826..9f44f86c9b 100644 --- a/extras/multipath/multipath.hotplug +++ b/extras/multipath/multipath.hotplug @@ -1,6 +1,7 @@ +#!bin/sh . /etc/hotplug/hotplug.functions # wait for sysfs sleep 1 -mesg `/sbin/multipath scsi $DEVPATH` +mesg `/sbin/multipath $DEVPATH` -- cgit v1.2.3-54-g00ecf From a6f01502bd2a76d1f9d90abb7bbeebd8f6893ed9 Mon Sep 17 00:00:00 2001 From: "rml@ximian.com" Date: Mon, 1 Mar 2004 23:16:39 -0800 Subject: [PATCH] update documetation for $local On Mon, 2004-03-01 at 17:44, Greg KH wrote: > Hm, that should be Robert's job actually, he should do something for > real... :) Hey, I wrote the nifty local user detection snippet - but, I owe Kay, so here is an updated man page. --- udev.8 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/udev.8 b/udev.8 index 9eeff96d48..c0dc68b803 100644 --- a/udev.8 +++ b/udev.8 @@ -297,6 +297,17 @@ video*:root:video:0660 dsp1:::0666 .fi .P +The value +.I $local +can be substituted for a specific username. In that case, udev will determine +the current local user at the time of device node creation and substitute +that username as the owner of the new device node. This is useful, for +example, to let hot-plugged devices, such as cameras, be owned by the user at +the current console. Note that if no user is currently logged in, or if udev +otherwise fails to determine a current user, the +.I default_owner +value is used in lieu. +.P A number of different fields in the above configuration files support a simple form of shell style pattern matching. It supports the following pattern characters: .TP -- cgit v1.2.3-54-g00ecf From aebef544cb4417bcf1dbc6d9d0ad795e5525e41c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 1 Mar 2004 23:17:59 -0800 Subject: [PATCH] fix stroul endptr use The endptr is never NULL, so here we hopefully do the right thing. --- klibc_fixups.c | 2 +- namedev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/klibc_fixups.c b/klibc_fixups.c index 1241eb7d10..99460c32f7 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -74,7 +74,7 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) if (strcmp(uname, name) == 0) { id = strtoul(idstr, &tail, 10); - if (tail == NULL) + if (tail[0] != '\0') id = -1; else dbg("id for '%s' is '%li'", name, id); diff --git a/namedev.c b/namedev.c index 2ebf276f6b..ed8d6c1808 100644 --- a/namedev.c +++ b/namedev.c @@ -198,7 +198,7 @@ static int get_format_len(char **str) if (isdigit(*str[0])) { num = (int) strtoul(*str, &tail, 10); - if (tail != NULL) { + if (num > 0) { *str = tail; dbg("format length=%i", num); return num; -- cgit v1.2.3-54-g00ecf From 97853b4f40708d2fdcde3da7e78138c683d9d66b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 1 Mar 2004 23:31:06 -0800 Subject: [PATCH] unlink the file before we try to create it. Based on the patch in the Gentoo repo. --- udev-add.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/udev-add.c b/udev-add.c index 19196bec54..776b542f08 100644 --- a/udev-add.c +++ b/udev-add.c @@ -166,9 +166,26 @@ static void set_to_local_user(char *user) endutent(); } -static int create_node(struct udevice *dev, int fake) +/* Used to unlink existing files to ensure that our new file/symlink is created */ +static int unlink_entry(char *filename) { struct stat stats; + int retval = 0; + + if (lstat(filename, &stats) == 0) { + if ((stats.st_mode & S_IFMT) != S_IFDIR) { + retval = unlink(filename); + if (retval) { + dbg("unlink(%s) failed with error '%s', " + filename, strerror(errno)); + } + } + } + return retval; +} + +static int create_node(struct udevice *dev, int fake) +{ char filename[255]; char linktarget[255]; char partitionname[255]; @@ -235,6 +252,7 @@ static int create_node(struct udevice *dev, int fake) } if (!fake) { + unlink_entry(filename); info("creating device node '%s'", filename); make_node(filename, dev->major, dev->minor, dev->mode, uid, gid); } else { @@ -250,6 +268,7 @@ static int create_node(struct udevice *dev, int fake) for (i = 1; i <= dev->partitions; i++) { strfieldcpy(partitionname, filename); strintcat(partitionname, i); + unlink_entry(partitionname); make_node(partitionname, dev->major, dev->minor + i, dev->mode, uid, gid); } @@ -291,14 +310,8 @@ static int create_node(struct udevice *dev, int fake) strfieldcat(linktarget, &dev->name[tail]); - /* unlink existing files to ensure that our symlink is created */ - if (!fake && (lstat(filename, &stats) == 0)) { - if ((stats.st_mode & S_IFMT) != S_IFDIR) { - if (unlink(filename)) - dbg("unlink(%s) failed with error '%s'", - filename, strerror(errno)); - } - } + if (!fake) + unlink_entry(filename); dbg("symlink(%s, %s)", linktarget, filename); if (!fake) { -- cgit v1.2.3-54-g00ecf From 8ea84a8a781c22f67def088eb9df581590393cda Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 1 Mar 2004 23:47:59 -0800 Subject: [PATCH] udevinfo symlink reverse query Thanks to Olaf Hering for this patch. It's possible now to feed the -n option of udevinfo with a symlink. I've also added a 'all' attribute, but no more text, it's all in the included man page :) --- udevdb.c | 21 +++++++++++++++++++-- udevinfo.8 | 4 ++-- udevinfo.c | 16 ++++++++++++++-- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/udevdb.c b/udevdb.c index a1f79a7c65..95bc06ce67 100644 --- a/udevdb.c +++ b/udevdb.c @@ -27,6 +27,7 @@ #define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #include +#include #include #include #include @@ -178,13 +179,29 @@ static int find_found; static int find_device_by_name(char *path, struct udevice *dev) { + int l, i, j; if (strncmp(dev->name, find_name, sizeof(dev->name)) == 0) { - memcpy(find_dev, dev, sizeof(*find_dev)); - strfieldcpy(find_path, path); + memcpy(find_dev, dev, sizeof(struct udevice)); + strnfieldcpy(find_path, path, NAME_SIZE); find_found = 1; /* stop search */ return 1; } + /* look for matching symlink*/ + l = strlen(dev->symlink); + if (!l) + return 0; + i = j = 0; + do { + j = strcspn(&dev->symlink[i], " "); + if (j && strncmp(&dev->symlink[i], find_name, j) == 0) { + memcpy(find_dev, dev, sizeof(struct udevice)); + strnfieldcpy(find_path, path, NAME_SIZE); + find_found = 1; + return 1; + } + i = i + j + 1; + } while (i < l); return 0; } diff --git a/udevinfo.8 b/udevinfo.8 index ad16ce6aed..528fa4ad95 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -28,13 +28,13 @@ Query the database for specified value of a created device node. .RB Needs " \-p " or " \-n " specified. .br Valid types are: -.BR name ", " symlink ", " mode " ," owner " , " group " or " path. +.BR name ", " symlink ", " mode " ," owner " , " group " , " path " or " all. .TP .BI \-p " sysfs_path" Specify the sysfs path of the device to query. .TP .BI \-n " name" -Specify the name of the node for the device to query. +Specify the name of the node or the symlink for the device to query. .TP .B \-a Print all diff --git a/udevinfo.c b/udevinfo.c index defed2ee31..01c2a2a8ae 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -122,7 +122,8 @@ enum query_type { SYMLINK, MODE, OWNER, - GROUP + GROUP, + ALL }; static int print_device_chain(const char *path) @@ -258,6 +259,11 @@ static int process_options(void) break; } + if (strcmp(optarg, "all") == 0) { + query = ALL; + break; + } + printf("unknown query type\n"); exit(1); @@ -366,6 +372,10 @@ print: strfieldcpy(result, path); break; + case ALL: + print_record(path, &dev); + goto exit; + default: goto exit; } @@ -406,8 +416,10 @@ help: " 'owner' of node\n" " 'group' of node\n" " 'path' sysfs device path\n" + " 'all' all values\n" + "\n" " -p PATH sysfs device path used for query or chain\n" - " -n NAME node name used for query\n" + " -n NAME node/symlink name used for query\n" "\n" " -r print udev root\n" " -a print all SYSFS_attributes along the device chain\n" -- cgit v1.2.3-54-g00ecf From dba8c18b8b7b5f4c6d79593df8179c02a78d020f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Mar 2004 00:08:28 -0800 Subject: [PATCH] clarify udevinfo device walk It seems that the long attribute list can confuse the user. Se here we print a few words on top the attributes. --- udevinfo.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index 01c2a2a8ae..b15f174e40 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -149,7 +149,14 @@ static int print_device_chain(const char *path) retval = -1; goto exit; } - printf("\ndevice '%s' has major:minor %s", class_dev->path, attr->value); + + printf("\nudevinfo starts with the device the node belongs to and then walks up the\n" + "device chain to print for every device found all possibly useful attributes\n" + "in the udev key format.\n" + "Only attributes within one device section may be used in a rule to match the\n" + "device for which the node will be created.\n" + "\n"); + printf("device '%s' has major:minor %s", class_dev->path, attr->value); sysfs_close_attribute(attr); /* open sysfs class device directory and print all attributes */ -- cgit v1.2.3-54-g00ecf From 5202dc99915de8fd858a75ccd0a51edc182f39ee Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Mar 2004 00:09:27 -0800 Subject: [PATCH] TODO update I promise, that I will not take every item you put in the TODO list :) --- TODO | 1 - 1 file changed, 1 deletion(-) diff --git a/TODO b/TODO index fb94135426..2239d7b024 100644 --- a/TODO +++ b/TODO @@ -7,7 +7,6 @@ greg@kroah.com - more documentation (can never have too much.) -- create way to set permission to the local user. - install the proper init.d script based on the distro we are running on. - persuade the distro packagers to submit their changes (or just steal them if we can find them...) -- cgit v1.2.3-54-g00ecf From dc820c1bc191db59f587660342285b2418e5ee74 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Mar 2004 00:21:27 -0800 Subject: [PATCH] - unlink bugfix Fix for recent unlink patch. --- udev-add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev-add.c b/udev-add.c index 776b542f08..c13cce53d4 100644 --- a/udev-add.c +++ b/udev-add.c @@ -176,7 +176,7 @@ static int unlink_entry(char *filename) if ((stats.st_mode & S_IFMT) != S_IFDIR) { retval = unlink(filename); if (retval) { - dbg("unlink(%s) failed with error '%s', " + dbg("unlink(%s) failed with error '%s'", filename, strerror(errno)); } } -- cgit v1.2.3-54-g00ecf From 82b9a637827398a1deada3d91fee72cc700818ec Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 01:30:38 -0800 Subject: [PATCH] add udevstart program based on a old patch from Harald Hoyer This can be used instead of the start_udev script for systems that do not have a shell, or some other problem... --- Makefile | 10 ++- udevstart.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 255 insertions(+), 2 deletions(-) create mode 100644 udevstart.c diff --git a/Makefile b/Makefile index c315d099ef..e2c7e42988 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,7 @@ DAEMON = udevd SENDER = udevsend HELPER = udevinfo TESTER = udevtest +STARTER = udevstart VERSION = 019_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) @@ -172,7 +173,7 @@ endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(SENDER) $(DAEMON) $(HELPER) $(TESTER) +all: $(ROOT) $(SENDER) $(DAEMON) $(HELPER) $(TESTER) $(STARTER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -265,6 +266,7 @@ $(TESTER).o: $(GEN_HEADERS) $(HELPER).o: $(GEN_HEADERS) $(DAEMON).o: $(GEN_HEADERS) $(SENDER).o: $(GEN_HEADERS) +$(STARTER).o: $(GEN_HEADERS) $(ROOT): $(ROOT).o $(OBJS) $(HEADERS) $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) @@ -286,10 +288,14 @@ $(SENDER): $(SENDER).o udevd.h $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ +$(STARTER): $(STARTER).o $(HEADERS) $(LIBC) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevstart.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $@ + clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(HELPER) $(DAEMON) $(SENDER) $(TESTER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(HELPER) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ diff --git a/udevstart.c b/udevstart.c new file mode 100644 index 0000000000..867919972a --- /dev/null +++ b/udevstart.c @@ -0,0 +1,247 @@ +/* + * udevstart.c + * + * Copyright (C) 2004 Greg Kroah-Hartman + * + * Quick and dirty way to populate a /dev with udev if your system + * does not have access to a shell. Based originally on a patch to udev + * from Harald Hoyer + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "logging.h" + + +#ifdef LOG +unsigned char logname[42]; +void log_message(int level, const char *format, ...) +{ + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif + + +#define MAX_PATHLEN 1024 +#define SYSBLOCK "/sys/block" +#define SYSCLASS "/sys/class" + +static int execute_udev(char *path, char *value, int len) +{ + int retval; + int res; + int status; + int fds[2]; + pid_t pid; + int value_set = 0; + char buffer[255]; + char *pos; + + retval = pipe(fds); + if (retval != 0) { + dbg("pipe failed"); + return -1; + } + pid = fork(); + switch(pid) { + case 0: + /* child */ + close(STDOUT_FILENO); + + /* dup write side of pipe to STDOUT */ + dup(fds[1]); + + dbg("executing /sbin/udev '%s'", path); + retval = execl("/sbin/udev", "/sbin/udev", path, NULL); + + info("execution of '%s' failed", path); + exit(1); + case -1: + dbg("fork failed"); + return -1; + default: + /* parent reads from fds[0] */ + close(fds[1]); + retval = 0; + while (1) { + res = read(fds[0], buffer, sizeof(buffer) - 1); + if (res <= 0) + break; + buffer[res] = '\0'; + if (res > len) { + dbg("result len %d too short", len); + retval = -1; + } + if (value_set) { + dbg("result value already set"); + retval = -1; + } else { + value_set = 1; + strncpy(value, buffer, len); + pos = value + strlen(value)-1; + if (pos[0] == '\n') + pos[0] = '\0'; + dbg("result is '%s'", value); + } + } + close(fds[0]); + res = wait(&status); + if (res < 0) { + dbg("wait failed result %d", res); + retval = -1; + } + + if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { + dbg("exec program status 0x%x", status); + retval = -1; + } + } + return retval; +} + +static int udev_scan(void) +{ + char *devpath; + DIR *dir; + struct dirent *dent; + int retval = -EINVAL; + char scratch[200]; + + devpath = "block"; + dir = opendir(SYSBLOCK); + if (dir) { + for (dent = readdir(dir); dent; dent = readdir(dir)) { + char dirname[MAX_PATHLEN]; + DIR *dir2; + struct dirent *dent2; + if ((strcmp(dent->d_name, ".") == 0) + || (strcmp(dent->d_name, "..") == 0)) + continue; + + snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name); + + setenv("DEVPATH", dirname, 1); + dbg("udev block, 'DEVPATH' = '%s'", dirname); + execute_udev("block", scratch, sizeof(scratch)); + + snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name); + + dir2 = opendir(dirname); + if (dir2) { + for (dent2 = readdir(dir2); dent2; dent2 = readdir(dir2)) { + char dirname2[MAX_PATHLEN]; + DIR *dir3; + struct dirent *dent3; + + if ((strcmp(dent2->d_name, ".") == 0) || + (strcmp(dent2->d_name, "..") == 0)) + continue; + + snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); + + dir3 = opendir(dirname2); + if (dir3) { + for (dent3 = readdir(dir3); dent3; dent3 = readdir(dir3)) { + char filename[MAX_PATHLEN]; + + if (strcmp(dent3->d_name, "dev") == 0) { + snprintf(filename, MAX_PATHLEN, "/block/%s/%s", dent->d_name, dent2->d_name); + setenv("DEVPATH", filename, 1); + dbg("udev block, 'DEVPATH' = '%s'", filename); + execute_udev("block", scratch, sizeof(scratch)); + } + } + } + } + } + } + } + + devpath = "class"; + dir = opendir(SYSCLASS); + if (dir) { + for (dent = readdir(dir); dent; dent = readdir(dir)) { + char dirname[MAX_PATHLEN]; + DIR *dir2; + struct dirent *dent2; + if ((strcmp(dent->d_name, ".") == 0) + || (strcmp(dent->d_name, "..") == 0)) + continue; + + snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); + + dir2 = opendir(dirname); + if (dir2) { + for (dent2 = readdir(dir2); dent2; dent2 = readdir(dir2)) { + char dirname2[MAX_PATHLEN]; + DIR *dir3; + struct dirent *dent3; + + if ((strcmp(dent2->d_name, ".") == 0) || (strcmp(dent2->d_name, "..") == 0)) + continue; + + snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); + + dir3 = opendir(dirname2); + if (dir3) { + for (dent3 = readdir(dir3); dent3; dent3 = readdir(dir3)) { + char + filename[MAX_PATHLEN]; + + if (strcmp(dent3->d_name, "dev") == 0) { + snprintf + (filename, + MAX_PATHLEN, + "/class/%s/%s", dent->d_name, dent2->d_name); + setenv("DEVPATH", filename, 1); + dbg("udev '%s', 'DEVPATH' = '%s'", dent->d_name, filename); + execute_udev(dent->d_name, scratch, sizeof(scratch)); + } + } + } + } + } + } + } + + if (retval > 0) + retval = 0; + + return -retval; +} + + +int main(int argc, char **argv, char **envp) +{ + init_logging("udevstart"); + + setenv("ACTION", "add", 1); + setenv("UDEV_NO_SLEEP", "1", 1); + + return udev_scan(); +} -- cgit v1.2.3-54-g00ecf From c9043d4597692b5809a40a4aaa9d9b3bd7fadb35 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 20:21:03 -0800 Subject: [PATCH] Add Red Hat rules and permissions files Taken from udev-018-2.src.rpm from Fedora Devel. --- etc/udev/udev.permissions.redhat | 193 +++++++++++++++++++++++++++++++++++++++ etc/udev/udev.rules.redhat | 125 +++++++++++++++++++++++++ 2 files changed, 318 insertions(+) create mode 100644 etc/udev/udev.permissions.redhat create mode 100644 etc/udev/udev.rules.redhat diff --git a/etc/udev/udev.permissions.redhat b/etc/udev/udev.permissions.redhat new file mode 100644 index 0000000000..f73360e34c --- /dev/null +++ b/etc/udev/udev.permissions.redhat @@ -0,0 +1,193 @@ +# /etc/udev/udev.permissions: permission/ownership map for udev + +# console devices +console:root:root:0600 +tty[0-9][0-9]*:root:tty:0660 +vc/[0-9]*:root:tty:0660 + +# pty devices +# Set this to 0660 if you only want users belonging to tty group +# to be able to allocate PTYs +ptmx:root:tty:0666 +pty[p-za-e][0-9a-f]*:root:tty:0660 +tty[p-za-e][0-9a-f]*:root:tty:0660 +pty/m*:root:tty:0660 +vc/s*:root:tty:0660 + +# serial+dialup devices +ttyS*:root:uucp:0660 +ippp*:root:root:0660 +isdn*:root:root:0660 +isdnctrl*:root:root:0660 +capi*:root:root:0660 +dcbri*:root:root:0660 +ircomm*:root:uucp:0660 +ttyUSB*:root:uucp:0660 +tts/[0-9]*:root:uucp:0660 +tts/USB[0-9]*:root:uucp:0660 + +# vc devices +vcs:vcsa:tty:0600 +vcs[0-9]*:vcsa:tty:0600 +vcsa:vcsa:tty:0600 +vcsa[0-9]*:vcsa:tty:0600 +vcc/*:vcsa:tty:0600 + +# memory devices +random:root:root:0666 +urandom:root:root:0444 +mem:root:kmem:0640 +kmem:root:kmem:0640 +port:root:kmem:0640 +full:root:root:0666 +null:root:root:0666 +zero:root:root:0666 + +# misc devices +nvram:root:root:0660 +rtc:root:root:0660 + +# floppy devices +fd[01]*:root:floppy:0660 + +# audio devices +dsp*:root:root:0660 +audio*:root:root:0660 +midi*:root:root:0660 +mixer*:root:root:0660 +sequencer*:root:root:0660 +sound/*:root:root:0660 +snd/*:root:root:0660 +beep:root:root:0660 +admm*:root:root:0660 +adsp*:root:root:0660 +aload*:root:root:0660 +amidi*:root:root:0660 +dmfm*:root:root:0660 +dmmidi*:root:root:0660 +sndstat:root:root:0660 + +# optical devices +sr*:root:disk:660 +scd*:root:disk:660 +pcd*:root:disk:0660 +disk*:root:disk:0660 +dvd:root:disk:0660 +rdvd:root:disk:0660 +cdroms/*:root:disk:0660 + +# pilot/palm devices +pilot:root:uucp:0660 + +# jaz devices +jaz*:root:disk:0660 + +# zip devices +pocketzip*:root:disk:0660 +zip*:root:disk:0660 + +# ls120 devices +ls120:root:disk:0660 +ls120*:root:disk:0660 + +# lp devices +lp*:root:lp:0660 +parport*:root:lp:0660 +irlpt*:root:lp:0660 +usblp*:root:lp:0660 +usb/lp*:root:lp:0660 + +# scanner devices +scanner:root:root:0600 +usb/scanner*:root:root:0600 + +# camera devices +camera*:root:root:0600 +usb/dc2xx*:root:root:0600 +usb/mdc800*:root:root:0600 + +# raw devices +ram*:root:disk:660 +raw/*:root:disk:660 + +# disk devices +hd*:root:disk:660 +sd*:root:disk:660 +dasd*:root:disk:660 +ataraid*:root:disk:660 +loop*:root:disk:660 +md*:root:disk:660 +ide/*/*/*/*/*:root:disk:660 +discs/*/*:root:disk:660 +loop/*:root:disk:660 +md/*:root:disk:660 + +# tape devices +ht*:root:disk:0660 +nht*:root:disk:0660 +pt[0-9]*:root:disk:0660 +npt*:root:disk:0660 +st*:root:disk:0660 +nst*:root:disk:0660 + +# dm devices +dm-*:root:root:0640 + +# memstick devices +memstick*:root:root:0600 + +# flash devices +flash*:root:root:0600 + +# diskonkey devices +diskonkey*:root:disk:0660 + +# rem_ide devices +microdrive*:root:disk:0660 + +# fb devices +fb:root:root:0600 +fb[0-9]*:root:root:0600 +fb/*:root:root:0600 + +# kbd devices +kbd:root:root:0644 + +# joystick devices +js[0-9]*:root:root:0644 +djs[0-9]*:root:root:0644 + +# v4l devices +video*:root:root:0660 +radio*:root:root:0660 +winradio*:root:root:0660 +vtx*:root:root:0660 +vbi*:root:root:0660 +video/*:root:root:0660 +vttuner:root:root:0660 +v4l/*:root:root:0660 + +# input devices +input/*:root:root:644 + +# gpm devices +gpmctl:root:root:0700 + +# dri devices +nvidia*:root:root:0660 +3dfx*:root:root:0660 +dri/*:root:root:0660 + +# mainboard devices +apm_bios:root:root:0600 + +# scsi devices +sg*:root:disk:0660 +pg*:root:disk:0660 +cdwriter:root:disk:0660 + +# usb devices +usb/dabusb*:root:usb:0660 +usb/mdc800*:root:usb:0660 +usb/rio500:root:usb:0660 + diff --git a/etc/udev/udev.rules.redhat b/etc/udev/udev.rules.redhat new file mode 100644 index 0000000000..0a43358bad --- /dev/null +++ b/etc/udev/udev.rules.redhat @@ -0,0 +1,125 @@ +# /etc/udev/udev.rules: device naming rules for udev +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. + +########################################################### +# +# Add your own rules here (examples are commented) +# +########################################################### + +# Looking for scsi bus id 42:0:0:1 +#BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" + +# A usb camera. +#BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" + +# USB Epson printer to be called lp_epson +#BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" + +# USB HP printer to be called lp_hp +#BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" + +# sound card with PCI bus id 00:0b.0 to be the first sound card +#BUS="pci", ID="00:0b.0", NAME="dsp" + +# sound card with PCI bus id 00:07.1 to be the second sound card +#BUS="pci", ID="00:07.1", NAME="dsp1" + +# USB mouse plugged into the third port of the first hub to be called mouse0 +#BUS="usb", PLACE="1.3", NAME="mouse0" + +# USB tablet plugged into the third port of the second hub to be called mouse1 +#BUS="usb", PLACE="2.3", NAME="mouse1" +#BUS="usb", PLACE="2.4", NAME="mouse2" + +# ttyUSB1 should always be called visor +#KERNEL="ttyUSB1", NAME="visor" +#KERNEL="ttyUSB0", NAME="pl2303" + + +########################################################### +# +# For devfs similar /dev layout (neater) +# +########################################################### + +# devfs-names for ide-devices (uncomment only one) +# /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" + +# alsa devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + +# dm devices (ignore them) +KERNEL="dm-[0-9]*", NAME="" +KERNEL="device-mapper", NAME="mapper/control" + +# fb devices +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" + +# floppy devices +KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" + +# i2c devices +KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" + +# input devices +KERNEL="mice", NAME="input/mice" +KERNEL="mouse[0-9]*", NAME="input/mouse%n" +KERNEL="event[0-9]*", NAME="input/event%n" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + +# loop devices +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" + +# md block devices +KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" + +# misc devices +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" + +# pty devices +KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" + +# ramdisk devices +KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" + +# sound devices +KERNEL="adsp", NAME="sound/adsp" SYMLINK="%k" +KERNEL="audio", NAME="sound/audio", SYMLINK="%k" +KERNEL="dsp", NAME="sound/dsp", SYMLINK="%k" +KERNEL="mixer", NAME="sound/mixer", SYMLINK="%k" +KERNEL="sequencer", NAME="sound/sequencer", SYMLINK="%k" +KERNEL="sequencer2", NAME="sound/sequencer2", SYMLINK="%k" + +# tty devices +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" + +# vc devices +KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" +KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" +KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" + +# v4l devices +KERNEL="video[0-9]*", NAME="v4l/video%n" +KERNEL="radio[0-9]*", NAME="v4l/radio%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" + -- cgit v1.2.3-54-g00ecf From 5ba7d3d603a63b7e2909c40a1e33d365024ba6b0 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 20:23:36 -0800 Subject: [PATCH] update the Gentoo rules files. --- etc/udev/udev.rules.gentoo | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 0f871ca7ff..f8419a2925 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -1,5 +1,5 @@ # /etc/udev/udev.rules: device naming rules for udev -# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.rules.post_012,v 1.5 2004/02/08 16:59:29 azarah Exp $ +# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.rules-018,v 1.2 2004/02/29 11:07:39 azarah Exp $ # # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. @@ -60,6 +60,9 @@ KERNEL="seq", NAME="snd/%k" # dm devices (ignore them) KERNEL="dm-[0-9]*", NAME="" +# create a symlink named after the device map name +# note devmap_name comes with extras/multipath +#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" KERNEL="device-mapper", NAME="mapper/control" # fb devices @@ -100,7 +103,7 @@ KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" # sound devices -KERNEL="adsp", NAME="sound/adsp" SYMLINK="%k" +KERNEL="adsp", NAME="sound/adsp", SYMLINK="%k" KERNEL="audio", NAME="sound/audio", SYMLINK="%k" KERNEL="dsp", NAME="sound/dsp", SYMLINK="%k" KERNEL="mixer", NAME="sound/mixer", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From 2ef3bc2b7094876488c9ac30f64f135b6f88350a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 20:24:26 -0800 Subject: [PATCH] Remove Debian permission files as the Debian maintainer doesn't seem to want to share :( --- etc/udev/udev.permissions.debian | 111 --------------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 etc/udev/udev.permissions.debian diff --git a/etc/udev/udev.permissions.debian b/etc/udev/udev.permissions.debian deleted file mode 100644 index 5df3d0feac..0000000000 --- a/etc/udev/udev.permissions.debian +++ /dev/null @@ -1,111 +0,0 @@ -# name:user:group:mode - -# CHARACTER DEVICES - -# tty devices -tty:root:tty:0660 -console:root:tty:0600 -ptmx:root:tty:0666 -ttyACM*:root:dialout:0660 -ttyUSB*:root:dialout:0660 -ttyI*:root:dialout:0660 -ttyS*:root:dialout:0660 -ttySC*:root:dialout:0660 -ttyB*:root:dialout:0660 -ttyC*:root:dialout:0660 -ttyD*:root:dialout:0660 -ttyE*:root:dialout:0660 -ttyH*:root:dialout:0660 -ttyI*:root:dialout:0660 -ttyL*:root:dialout:0660 -ttyM*:root:dialout:0660 -ttyP*:root:dialout:0660 -ttyR*:root:dialout:0660 -ttyV*:root:dialout:0660 -ttyW*:root:dialout:0660 -ttyX*:root:dialout:0660 -tts/*:root:dialout:0660 -ippp*:root:dialout:0660 -isdn*:root:dialout:0660 -isdnctrl*:root:dialout:0660 -capi*:root:dialout:0660 -dcbri*:root:dialout:0660 -ircomm*:root:dialout:0660 - -# Memory devices -random:root:root:0666 -urandom:root:root:0444 -mem:root:kmem:0640 -kmem:root:kmem:0640 -port:root:kmem:0640 -full:root:root:0666 -null:root:root:0666 -zero:root:root:0666 - -# Misc devices -nvram:root:root:0660 -rtc:root:root:0660 - -admmidi*:root:audio:660 -adsp*:root:audio:660 -aload*:root:audio:660 -amidi*:root:audio:660 -amixer*:root:audio:660 -audio*:root:audio:660 -dmfm*:root:audio:660 -dsp*:root:audio:660 -audio*:root:audio:660 -mixer*:root:audio:660 -music:root:audio:660 -sequencer*:root:audio:660 -snd/*:root:audio:660 -sound/*:root:audio:660 - -lp*:root:lp:0660 -parport*:root:lp:0660 -irlpt*:root:lp:0660 -usblp*:root:lp:0660 -usb/lp*:root:lp:0660 - -js:root:root:644 -djs:root:root:644 -input/*:root:root:644 - -dri/card*:root:root:666 - -fb*:root:video:0620 -agpgart:root:video:0660 -video*:root:video:0660 -radio*:root:video:0660 -vbi*:root:video:0660 -vtx*:root:video:0660 -mol:root:root:0600 - - -# BLOCK DEVICES - -floppy*:root:floppy:660 -floppy/*:root:floppy:660 - -ram*:root:disk:660 -raw/*:root:disk:660 - -hd*:root:disk:660 -sd*:root:disk:660 -dasd*:root:disk:660 -ataraid*:root:disk:660 -loop*:root:disk:660 -md*:root:disk:660 - -sr*:root:cdrom:660 -scd*:root:cdrom:660 -sr*:root:cdrom:660 - -ht*:root:tape:0660 -nht*:root:tape:0660 -pt*:root:tape:0660 -npt*:root:tape:0660 -st*:root:tape:0660 -nst*:root:tape:0660 - -dm-*:root:root:0640 -- cgit v1.2.3-54-g00ecf From 5ec4899acf4338fec32f8f8c218802a406319971 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Mar 2004 20:27:12 -0800 Subject: [PATCH] bugfix for local user While moving the local user logic in it's own function I missed to change the "secure" string macro. We copy only the first 3 bytes of the username. Guess why I didn't notice it :) --- udev-add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev-add.c b/udev-add.c index c13cce53d4..ed0286d1fc 100644 --- a/udev-add.c +++ b/udev-add.c @@ -158,7 +158,7 @@ static void set_to_local_user(char *user) if (u->ut_time > recent) { recent = u->ut_time; - strfieldcpy(user, u->ut_user); + strnfieldcpy(user, u->ut_user, OWNER_SIZE); dbg("local user is '%s'", user); break; } -- cgit v1.2.3-54-g00ecf From c58f8c3000b99db5c3810b9f8b1ecc2044070ac1 Mon Sep 17 00:00:00 2001 From: "rml@ximian.com" Date: Tue, 2 Mar 2004 20:27:53 -0800 Subject: [PATCH] automatically install correct initscript On Mon, 2004-03-01 at 20:08, Robert Love wrote: > Ack, I did not even see that! Thanks. > > Let's rip that out, and always use the new built-in logic to determine > what initscript to install. Hm, looks like we do not need the %{lsb} and USE_LSB logic at all, anymore. Here is the patch, updated, removing both completely. --- Makefile | 17 ++++++++++------- TODO | 1 - udev.spec | 10 ---------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index e2c7e42988..c3b33a7be1 100644 --- a/Makefile +++ b/Makefile @@ -347,6 +347,15 @@ uninstall-dbus-policy: - endif +install-initscript: etc/init.d/udev etc/init.d/udev.debian etc/init.d/udev.init.LSB + @if [ -f /etc/redhat-release ]; then \ + $(INSTALL_DATA) etc/init.d/udev $(etcdir)/init.d/udev; \ + elif [ -f /etc/SuSE-release ]; then \ + $(INSTALL_DATA) etc/init.d/udev.init.LSB $(etcdir)/init.d/udev; \ + elif [ -f /etc/debian_version ]; then \ + $(INSTALL_DATA) etc/init.d/udev.debian $(etcdir)/init.d/udev; \ + fi + install-config: $(GEN_CONFIGS) $(INSTALL) -d $(DESTDIR)$(configdir) @if [ ! -r $(DESTDIR)$(configdir)udev.conf ]; then \ @@ -362,7 +371,7 @@ install-config: $(GEN_CONFIGS) $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir); \ fi -install: install-config install-dbus-policy all +install: install-initscript install-config install-dbus-policy all $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) @@ -370,12 +379,6 @@ install: install-config install-dbus-policy all $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(HELPER) $(DESTDIR)$(sbindir)/$(HELPER) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(sbindir)/$(TESTER) - @if [ "x$(USE_LSB)" = "xtrue" ]; then \ - $(INSTALL_PROGRAM) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ - ln -s $(DESTDIR)$(initdir)/udev $(sbindir)/rcudev; \ - else \ - $(INSTALL_PROGRAM) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ - fi $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 diff --git a/TODO b/TODO index 2239d7b024..49a134effd 100644 --- a/TODO +++ b/TODO @@ -7,7 +7,6 @@ greg@kroah.com - more documentation (can never have too much.) -- install the proper init.d script based on the distro we are running on. - persuade the distro packagers to submit their changes (or just steal them if we can find them...) - create kernel name to devfs name config file so that all of the devfs users diff --git a/udev.spec b/udev.spec index ae802ca8e5..b9cf5b140e 100644 --- a/udev.spec +++ b/udev.spec @@ -27,11 +27,6 @@ # 1 - debugging enabled %define debug 0 -# if we want to use the LSB version of the init script or the Redhat one -# 0 - use Redhat: etc/init.d/udev -# 1 - use LSB: etc/init.d/udev.init.LSB -%define lsb 0 - # if we want to build the scsi_id "extra" package or not # 0 - do not build the package # 1 - build it @@ -99,11 +94,6 @@ make DESTDIR=$RPM_BUILD_ROOT install \ USE_SELINUX=true \ %else USE_SELINUX=false \ -%endif -%if %{lsb} - USE_LSB=true \ -%else - USE_LSB=false \ %endif EXTRAS=" \ %if %{scsi_id} -- cgit v1.2.3-54-g00ecf From e4dc0e11c148df0e907ea23fd902324d856abcb1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Mar 2004 22:15:20 -0800 Subject: [PATCH] cleanup udevstart I just wanted to terminate the snprintf() strings, cause I can see a overflow with closed eyes after all the audit :) But then I changed a bit more to bring it in line with the style of the other files. I replaced the exec_udev() function with the one from udevd, cause we don't need to read the stdout from udev. Please have a look if it still works for you too and not only for usernames with 3 characters :) --- udevstart.c | 192 ++++++++++++++++++++++-------------------------------------- 1 file changed, 70 insertions(+), 122 deletions(-) diff --git a/udevstart.c b/udevstart.c index 867919972a..5c977b5ce6 100644 --- a/udevstart.c +++ b/udevstart.c @@ -27,7 +27,6 @@ #include #include #include -#include #include #include @@ -47,133 +46,86 @@ void log_message(int level, const char *format, ...) #endif -#define MAX_PATHLEN 1024 -#define SYSBLOCK "/sys/block" -#define SYSCLASS "/sys/class" +#define MAX_PATHLEN 1024 +#define SYSBLOCK "/sys/block" +#define SYSCLASS "/sys/class" +#define UDEV_BIN "/sbin/udev" -static int execute_udev(char *path, char *value, int len) +static void udev_exec(const char *path, const char* subsystem) { - int retval; - int res; - int status; - int fds[2]; pid_t pid; - int value_set = 0; - char buffer[255]; - char *pos; - - retval = pipe(fds); - if (retval != 0) { - dbg("pipe failed"); - return -1; - } + char action[] = "ACTION=add"; + char devpath[MAX_PATHLEN]; + char nosleep[] = "UDEV_NO_SLEEP=1"; + char *env[] = { action, devpath, nosleep, NULL }; + + snprintf(devpath, MAX_PATHLEN, "DEVPATH=%s", path); + devpath[MAX_PATHLEN-1] = '\0'; + pid = fork(); - switch(pid) { + switch (pid) { case 0: /* child */ - close(STDOUT_FILENO); - - /* dup write side of pipe to STDOUT */ - dup(fds[1]); - - dbg("executing /sbin/udev '%s'", path); - retval = execl("/sbin/udev", "/sbin/udev", path, NULL); - - info("execution of '%s' failed", path); + execle(UDEV_BIN, "udev", subsystem, NULL, env); + dbg("exec of child failed"); exit(1); + break; case -1: - dbg("fork failed"); - return -1; + dbg("fork of child failed"); + break; default: - /* parent reads from fds[0] */ - close(fds[1]); - retval = 0; - while (1) { - res = read(fds[0], buffer, sizeof(buffer) - 1); - if (res <= 0) - break; - buffer[res] = '\0'; - if (res > len) { - dbg("result len %d too short", len); - retval = -1; - } - if (value_set) { - dbg("result value already set"); - retval = -1; - } else { - value_set = 1; - strncpy(value, buffer, len); - pos = value + strlen(value)-1; - if (pos[0] == '\n') - pos[0] = '\0'; - dbg("result is '%s'", value); - } - } - close(fds[0]); - res = wait(&status); - if (res < 0) { - dbg("wait failed result %d", res); - retval = -1; - } - - if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { - dbg("exec program status 0x%x", status); - retval = -1; - } + wait(NULL); } - return retval; } static int udev_scan(void) { - char *devpath; - DIR *dir; - struct dirent *dent; - int retval = -EINVAL; - char scratch[200]; + char *devpath; + DIR *dir; + struct dirent *dent; + int retval = -EINVAL; devpath = "block"; dir = opendir(SYSBLOCK); - if (dir) { - for (dent = readdir(dir); dent; dent = readdir(dir)) { - char dirname[MAX_PATHLEN]; - DIR *dir2; - struct dirent *dent2; - if ((strcmp(dent->d_name, ".") == 0) - || (strcmp(dent->d_name, "..") == 0)) + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[MAX_PATHLEN]; + DIR *dir2; + struct dirent *dent2; + + if ((strcmp(dent->d_name, ".") == 0) || + (strcmp(dent->d_name, "..") == 0)) continue; snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name); - - setenv("DEVPATH", dirname, 1); - dbg("udev block, 'DEVPATH' = '%s'", dirname); - execute_udev("block", scratch, sizeof(scratch)); + dirname[MAX_PATHLEN-1] = '\0'; + udev_exec(dirname, "block"); snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name); - dir2 = opendir(dirname); - if (dir2) { - for (dent2 = readdir(dir2); dent2; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN]; - DIR *dir3; - struct dirent *dent3; + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[MAX_PATHLEN]; + DIR *dir3; + struct dirent *dent3; if ((strcmp(dent2->d_name, ".") == 0) || (strcmp(dent2->d_name, "..") == 0)) continue; snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); + dirname2[MAX_PATHLEN-1] = '\0'; dir3 = opendir(dirname2); - if (dir3) { - for (dent3 = readdir(dir3); dent3; dent3 = readdir(dir3)) { + if (dir3 != NULL) { + for (dent3 = readdir(dir3); dent3 != NULL; dent3 = readdir(dir3)) { char filename[MAX_PATHLEN]; if (strcmp(dent3->d_name, "dev") == 0) { - snprintf(filename, MAX_PATHLEN, "/block/%s/%s", dent->d_name, dent2->d_name); - setenv("DEVPATH", filename, 1); - dbg("udev block, 'DEVPATH' = '%s'", filename); - execute_udev("block", scratch, sizeof(scratch)); + snprintf(filename, MAX_PATHLEN, "/block/%s/%s", + dent->d_name, dent2->d_name); + filename[MAX_PATHLEN-1] = '\0'; + udev_exec(filename, "block"); } } } @@ -184,43 +136,42 @@ static int udev_scan(void) devpath = "class"; dir = opendir(SYSCLASS); - if (dir) { - for (dent = readdir(dir); dent; dent = readdir(dir)) { - char dirname[MAX_PATHLEN]; - DIR *dir2; - struct dirent *dent2; - if ((strcmp(dent->d_name, ".") == 0) - || (strcmp(dent->d_name, "..") == 0)) + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[MAX_PATHLEN]; + DIR *dir2; + struct dirent *dent2; + + if ((strcmp(dent->d_name, ".") == 0) || + (strcmp(dent->d_name, "..") == 0)) continue; snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); - + dirname[MAX_PATHLEN] = '\0'; dir2 = opendir(dirname); - if (dir2) { - for (dent2 = readdir(dir2); dent2; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN]; - DIR *dir3; - struct dirent *dent3; + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[MAX_PATHLEN-1]; + DIR *dir3; + struct dirent *dent3; - if ((strcmp(dent2->d_name, ".") == 0) || (strcmp(dent2->d_name, "..") == 0)) + if ((strcmp(dent2->d_name, ".") == 0) || + (strcmp(dent2->d_name, "..") == 0)) continue; snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); + dirname2[MAX_PATHLEN-1] = '\0'; dir3 = opendir(dirname2); - if (dir3) { - for (dent3 = readdir(dir3); dent3; dent3 = readdir(dir3)) { - char - filename[MAX_PATHLEN]; + if (dir3 != NULL) { + for (dent3 = readdir(dir3); dent3 != NULL; dent3 = readdir(dir3)) { + char filename[MAX_PATHLEN]; if (strcmp(dent3->d_name, "dev") == 0) { - snprintf - (filename, - MAX_PATHLEN, - "/class/%s/%s", dent->d_name, dent2->d_name); - setenv("DEVPATH", filename, 1); - dbg("udev '%s', 'DEVPATH' = '%s'", dent->d_name, filename); - execute_udev(dent->d_name, scratch, sizeof(scratch)); + snprintf(filename, MAX_PATHLEN, "/class/%s/%s", + dent->d_name, dent2->d_name); + filename[MAX_PATHLEN-1] = '\0'; + udev_exec(filename, dent->d_name); } } } @@ -240,8 +191,5 @@ int main(int argc, char **argv, char **envp) { init_logging("udevstart"); - setenv("ACTION", "add", 1); - setenv("UDEV_NO_SLEEP", "1", 1); - return udev_scan(); } -- cgit v1.2.3-54-g00ecf From 1f63fbdd30b6a26e9197fab15147356c7040cbf9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 22:34:40 -0800 Subject: [PATCH] install udevstart --- Makefile | 1 + udev.spec | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Makefile b/Makefile index c3b33a7be1..e423630695 100644 --- a/Makefile +++ b/Makefile @@ -379,6 +379,7 @@ install: install-initscript install-config install-dbus-policy all $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(HELPER) $(DESTDIR)$(sbindir)/$(HELPER) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(sbindir)/$(TESTER) + $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 diff --git a/udev.spec b/udev.spec index b9cf5b140e..49b8b131da 100644 --- a/udev.spec +++ b/udev.spec @@ -120,6 +120,7 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /sbin/udevsend %attr(755,root,root) /sbin/udevd %attr(755,root,root) /sbin/udevtest +%attr(755,root,root) /sbin/udevstart %attr(755,root,root) %dir /udev/ %attr(755,root,root) %dir /etc/udev/ %config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf @@ -140,6 +141,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Tue Mar 2 2004 Greg Kroah-Hartman +- added udevstart to the list of files installed + * Fri Feb 27 2004 Greg Kroah-Hartman - added ability to build with SELinux support -- cgit v1.2.3-54-g00ecf From b5e0fc320850b7f04608e8e57f43f7ffbdd050a1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Mar 2004 22:43:00 -0800 Subject: [PATCH] man page udevstart --- Makefile | 1 + udevstart.8 | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 udevstart.8 diff --git a/Makefile b/Makefile index e423630695..049b278d4b 100644 --- a/Makefile +++ b/Makefile @@ -382,6 +382,7 @@ install: install-initscript install-config install-dbus-policy all $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 + $(INSTALL_DATA) -D udevstart.8 $(DESTDIR)$(mandir)/man8/udevstart.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug diff --git a/udevstart.8 b/udevstart.8 new file mode 100644 index 0000000000..3e6c61f547 --- /dev/null +++ b/udevstart.8 @@ -0,0 +1,18 @@ +.TH UDEVSTART 8 "March 2004" "" "Linux Administrator's Manual" +.SH NAME +udevstart \- populate device directory with all nodes available in sysfs +.SH SYNOPSIS +.B udevstart +.SH "DESCRIPTION" +.B udevstart +walks trough the sysfs device tree and calls +.B udev +to create the node for every valid device found. It can be used to fill a +empty device directory with nodes for all devices currently available on +the system. +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevstart +was developed primarily by Harald Hoyer , with much help +from others. -- cgit v1.2.3-54-g00ecf From 27abdb46ffb0d817888a75adeaf2c0a2e7d2c7a3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 22:45:22 -0800 Subject: [PATCH] make start_udev use udevstart binary --- extras/start_udev | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/extras/start_udev b/extras/start_udev index 5a7bc63515..0212d4f8c1 100644 --- a/extras/start_udev +++ b/extras/start_udev @@ -88,7 +88,12 @@ mount -n -t ramfs none $udev_root export ACTION=add export UDEV_NO_SLEEP=1 echo "Creating initial udev device nodes:" -run_udev + +# You can use the shell scripts above by calling run_udev or execute udevstart +# which does the same thing, but much faster by not using shell. +# only comment out one of the following lines. +#run_udev +/sbin/udevstart echo "making extra nodes" make_extra_nodes -- cgit v1.2.3-54-g00ecf From 43f46b560584b03e281660541373ff97d6406c99 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 22:46:24 -0800 Subject: [PATCH] update the TODO list as we already have a devfs config file. --- TODO | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/TODO b/TODO index 49a134effd..63e518feeb 100644 --- a/TODO +++ b/TODO @@ -9,8 +9,6 @@ greg@kroah.com - more documentation (can never have too much.) - persuade the distro packagers to submit their changes (or just steal them if we can find them...) -- create kernel name to devfs name config file so that all of the devfs users - will have an upgrade path. - do early boot logic (putting udev into initramfs, handle pivot-root, etc.) -- lots of other stuff... +- solve world hunger -- cgit v1.2.3-54-g00ecf From a8b41e072c01df8b3a31685e44dba145feaafc21 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 22:51:13 -0800 Subject: [PATCH] 020 release --- ChangeLog | 47 +++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a3cc00c17a..c8eedc3626 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,50 @@ +Summary of changes from v019 to v020 +============================================ + +: + o multipath update + +Kay Sievers: + o man page udevstart + o cleanup udevstart + o bugfix for local user + o unlink bugfix + o TODO update + o clarify udevinfo device walk + o udevinfo symlink reverse query + o fix stroul endptr use + o add $local user spport for permissions + o udev - man page update + o udev - fix debug info for multiple rule file config + o udev - kill udevd on install + o udev - activate formt length attribute + o udev - safer sprintf() use + +: + o no error on enoent + o escape dashes in man pages + o remove usage of expr in ide-devfs.sh + +: + o automatically install correct initscript + o update documetation for $local + +Andrey Borzenkov: + o Add symlink only rules support + +Greg Kroah-Hartman: + o update the TODO list as we already have a devfs config file + o make start_udev use udevstart binary + o install udevstart + o Remove Debian permission files as the Debian maintainer doesn't seem to want to share :( + o update the Gentoo rules files + o Add Red Hat rules and permissions files + o add udevstart to the ignore list + o add udevstart program based on a old patch from Harald Hoyer + o unlink the file before we try to create it + o Merge greg@bucket:/home/greg/src/udev into kroah.com:/home/greg/src/udev + + Summary of changes from v018 to v019 ============================================ diff --git a/Makefile b/Makefile index 049b278d4b..45ff672be7 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ SENDER = udevsend HELPER = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 019_bk +VERSION = 020 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 49b8b131da..0778f93dc7 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 019_bk +Version: 020 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From e729cb0b733390d4955d7f79cc5c7915dd1f41ce Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 22:54:00 -0800 Subject: [PATCH] make spec file turn off selinux support by default. --- udev.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.spec b/udev.spec index 0778f93dc7..9289a84e60 100644 --- a/udev.spec +++ b/udev.spec @@ -19,7 +19,7 @@ # if we want to build SELinux support in or not. # 0 - no SELinux support # 1 - SELinux support -%define selinux 1 +%define selinux 0 # if we want to enable debugging support in udev. If it is enabled, lots of # stuff will get sent to the debug syslog. -- cgit v1.2.3-54-g00ecf From 789adb79f54b256bce97f05f5d8cbbc5ebbd057a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 23:33:52 -0800 Subject: [PATCH] fix the Makefile to install the init script into the proper directory grrr...robert... --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 45ff672be7..8f06c367c9 100644 --- a/Makefile +++ b/Makefile @@ -349,11 +349,11 @@ endif install-initscript: etc/init.d/udev etc/init.d/udev.debian etc/init.d/udev.init.LSB @if [ -f /etc/redhat-release ]; then \ - $(INSTALL_DATA) etc/init.d/udev $(etcdir)/init.d/udev; \ + $(INSTALL_DATA) etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ elif [ -f /etc/SuSE-release ]; then \ - $(INSTALL_DATA) etc/init.d/udev.init.LSB $(etcdir)/init.d/udev; \ + $(INSTALL_DATA) etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ elif [ -f /etc/debian_version ]; then \ - $(INSTALL_DATA) etc/init.d/udev.debian $(etcdir)/init.d/udev; \ + $(INSTALL_DATA) etc/init.d/udev.debian $(DESTDIR)$(initdir)/udev; \ fi install-config: $(GEN_CONFIGS) -- cgit v1.2.3-54-g00ecf From dfe421a9654f5470b96fc6c6841a1f617c8a34f6 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 23:47:22 -0800 Subject: [PATCH] Fix another problem with Makefile installing initscript --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8f06c367c9..99abff35ff 100644 --- a/Makefile +++ b/Makefile @@ -349,11 +349,11 @@ endif install-initscript: etc/init.d/udev etc/init.d/udev.debian etc/init.d/udev.init.LSB @if [ -f /etc/redhat-release ]; then \ - $(INSTALL_DATA) etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ + $(INSTALL_DATA) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ elif [ -f /etc/SuSE-release ]; then \ - $(INSTALL_DATA) etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ + $(INSTALL_DATA) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ elif [ -f /etc/debian_version ]; then \ - $(INSTALL_DATA) etc/init.d/udev.debian $(DESTDIR)$(initdir)/udev; \ + $(INSTALL_DATA) -D etc/init.d/udev.debian $(DESTDIR)$(initdir)/udev; \ fi install-config: $(GEN_CONFIGS) -- cgit v1.2.3-54-g00ecf From e9f504e8d896e301099ffc1108a637e2842ee9ba Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Mar 2004 23:49:04 -0800 Subject: [PATCH] blacklist pcmcia_socket Is this something for the blacklist? /sys/class/pcmcia_socket/ |-- pcmcia_socket0 | |-- device -> ../../../devices/pci0000:00/0000:00:1e.0/0000:02:00.0 | `-- driver -> ../../../bus/pci/drivers/yenta_cardbus `-- pcmcia_socket1 |-- device -> ../../../devices/pci0000:00/0000:00:1e.0/0000:02:00.1 `-- driver -> ../../../bus/pci/drivers/yenta_cardbus --- udev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev.c b/udev.c index 4ae4684536..227145982e 100644 --- a/udev.c +++ b/udev.c @@ -73,6 +73,7 @@ static char *subsystem_blacklist[] = { "scsi_device", "usb_host", "pci_bus", + "pcmcia_socket", "", }; -- cgit v1.2.3-54-g00ecf From e56f005817ab12a63e91fee06c3f967d55ee6c3c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Mar 2004 23:49:08 -0800 Subject: [PATCH] install udevinfo in /usr/bin Here we rename the former tiny $(HELPER) to $(INFO) cause it's no longer only a helper :) And install it in /usr/bin instead of /sbin cause any user may want to call it and we don't need it on startup. --- Makefile | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 99abff35ff..9c95eeab85 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ USE_DBUS = false ROOT = udev DAEMON = udevd SENDER = udevsend -HELPER = udevinfo +INFO = udevinfo TESTER = udevtest STARTER = udevstart VERSION = 020 @@ -51,6 +51,7 @@ prefix = exec_prefix = ${prefix} etcdir = ${prefix}/etc sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin mandir = ${prefix}/usr/share/man hotplugdir = ${etcdir}/hotplug.d/default dbusdir = ${etcdir}/dbus-1/system.d @@ -173,7 +174,7 @@ endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(SENDER) $(DAEMON) $(HELPER) $(TESTER) $(STARTER) +all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -263,7 +264,7 @@ $(LOCAL_CFG_DIR)/udev.conf: $(OBJS): $(GEN_HEADERS) $(ROOT).o: $(GEN_HEADERS) $(TESTER).o: $(GEN_HEADERS) -$(HELPER).o: $(GEN_HEADERS) +$(INFO).o: $(GEN_HEADERS) $(DAEMON).o: $(GEN_HEADERS) $(SENDER).o: $(GEN_HEADERS) $(STARTER).o: $(GEN_HEADERS) @@ -276,7 +277,7 @@ $(TESTER): $(TESTER).o $(OBJS) $(HEADERS) $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevtest.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(HELPER): $(HELPER).o $(OBJS) $(HEADERS) $(LIBC) +$(INFO): $(INFO).o $(OBJS) $(HEADERS) $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ @@ -295,7 +296,7 @@ $(STARTER): $(STARTER).o $(HEADERS) $(LIBC) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(HELPER) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ @@ -377,7 +378,7 @@ install: install-initscript install-config install-dbus-policy all $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) - $(INSTALL_PROGRAM) -D $(HELPER) $(DESTDIR)$(sbindir)/$(HELPER) + $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(sbindir)/$(TESTER) $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 @@ -407,7 +408,7 @@ uninstall: uninstall-dbus-policy - rm $(sbindir)/$(ROOT) - rm $(sbindir)/$(DAEMON) - rm $(sbindir)/$(SENDER) - - rm $(sbindir)/$(HELPER) + - rm $(usrbindir)/$(INFO) - rmdir $(hotplugdir) - rmdir $(configdir) - rm $(udevdir)/.udev.tdb -- cgit v1.2.3-54-g00ecf From 0d1956de0eb112271a1d0d6e189ace3714bf0872 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 2 Mar 2004 23:51:50 -0800 Subject: [PATCH] fix udev.spec to find udevinfo now that it has moved to /usr/bin --- udev.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev.spec b/udev.spec index 9289a84e60..9437491117 100644 --- a/udev.spec +++ b/udev.spec @@ -116,7 +116,7 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %doc COPYING README TODO ChangeLog HOWTO* etc/udev/udev.rules.examples docs/* %attr(755,root,root) /sbin/udev -%attr(755,root,root) /sbin/udevinfo +%attr(755,root,root) /usr/bin/udevinfo %attr(755,root,root) /sbin/udevsend %attr(755,root,root) /sbin/udevd %attr(755,root,root) /sbin/udevtest @@ -143,6 +143,7 @@ rm -rf $RPM_BUILD_ROOT %changelog * Tue Mar 2 2004 Greg Kroah-Hartman - added udevstart to the list of files installed +- udevinfo is now in /usr/bin not /sbin * Fri Feb 27 2004 Greg Kroah-Hartman - added ability to build with SELinux support -- cgit v1.2.3-54-g00ecf From 88ed4bbe5605f6fe17993c5b81709f4d12812b9a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 3 Mar 2004 00:01:22 -0800 Subject: [PATCH] 021 release --- ChangeLog | 14 ++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8eedc3626..515450ac6a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Summary of changes from v020 to v021 +============================================ + +Kay Sievers: + o install udevinfo in /usr/bin + o blacklist pcmcia_socket + +Greg Kroah-Hartman: + o fix udev.spec to find udevinfo now that it has moved to /usr/bin + o Fix another problem with Makefile installing initscript + o fix the Makefile to install the init script into the proper directory + o make spec file turn off selinux support by default + + Summary of changes from v019 to v020 ============================================ diff --git a/Makefile b/Makefile index 9c95eeab85..526139a09b 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 020 +VERSION = 021 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 9437491117..9ead619186 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 020 +Version: 021 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 9fe3f9a9389bb06cf645d33cbb2b45e1f63d737c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 3 Mar 2004 18:16:35 -0800 Subject: [PATCH] cleanup mult field string handling Here I try to cleanup our various multifield iteration over the strings. Inspired by our nice list.h we now have a macro to iterate over the string and process the parts of it: It makes the code more readable and we don't change the string while we process it like the former strsep() does. Example: foreach_strpart(dev->symlink, " ", pos, len) { if (strncmp(&dev->symlink[pos], find_name, len) != 0) continue; ... } For the callout part selector %c{2} we separate now not only by space but also newline and return characters, cause some programs may give multiline values back. A possible RESULT match must contain wildcards for these characters. Also a bug in the recent udevinfo symlink query feature is fixed. --- namedev.c | 21 ++++++---------- udev-add.c | 80 +++++++++++++++++++++++++++-------------------------------- udev-remove.c | 46 +++++++++++++++------------------- udev.h | 6 +++++ udevdb.c | 29 +++++++++++----------- udevinfo.8 | 2 ++ 6 files changed, 87 insertions(+), 97 deletions(-) diff --git a/namedev.c b/namedev.c index ed8d6c1808..74d4d76467 100644 --- a/namedev.c +++ b/namedev.c @@ -214,14 +214,12 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, struct sysfs_device *sysfs_device) { char temp[NAME_SIZE]; - char temp1[NAME_SIZE]; char *tail; char *pos; - char *pos2; - char *pos3; char *attr; int len; int i; + int spos, slen; char c; struct sysfs_attribute *tmpattr; @@ -278,20 +276,17 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, if (attr != NULL) i = atoi(attr); if (i > 0) { - strfieldcpy(temp1, udev->program_result); - pos2 = temp1; - while (i) { + foreach_strpart(udev->program_result, " \n\r", spos, slen) { i--; - pos3 = strsep(&pos2, " "); - if (pos3 == NULL) { - dbg("requested part of result string not found"); + if (i == 0) break; - } } - if (pos3) { - strnfieldcat(string, pos3, maxsize); - dbg("substitute part of result string '%s'", pos3); + if (i > 0) { + dbg("requested part of result string not found"); + break; } + strnfieldcat(string, udev->program_result + spos, slen+1); + dbg("substitute part of result string '%s'", pos); } else { strnfieldcat(string, udev->program_result, maxsize); dbg("substitute result string '%s'", udev->program_result); diff --git a/udev-add.c b/udev-add.c index ed0286d1fc..c28256a5a6 100644 --- a/udev-add.c +++ b/udev-add.c @@ -186,16 +186,16 @@ static int unlink_entry(char *filename) static int create_node(struct udevice *dev, int fake) { - char filename[255]; - char linktarget[255]; - char partitionname[255]; - char *linkname; - char *symlinks; + char filename[NAME_SIZE]; + char linkname[NAME_SIZE]; + char linktarget[NAME_SIZE]; + char partitionname[NAME_SIZE]; int retval = 0; uid_t uid = 0; gid_t gid = 0; int i; int tail; + int pos, len; strfieldcpy(filename, udev_root); strfieldcat(filename, dev->name); @@ -279,47 +279,41 @@ static int create_node(struct udevice *dev, int fake) selinux_add_node(filename); /* create symlink if requested */ - if (dev->symlink[0] != '\0') { - symlinks = dev->symlink; - while (1) { - linkname = strsep(&symlinks, " "); - if (linkname == NULL || linkname[0] == '\0') - break; - - strfieldcpy(filename, udev_root); - strfieldcat(filename, linkname); - dbg("symlink '%s' to node '%s' requested", filename, dev->name); - if (!fake) - if (strrchr(linkname, '/')) - create_path(filename); - - /* optimize relative link */ - linktarget[0] = '\0'; - i = 0; - tail = 0; - while ((dev->name[i] == linkname[i]) && dev->name[i]) { - if (dev->name[i] == '/') - tail = i+1; - i++; - } - while (linkname[i] != '\0') { - if (linkname[i] == '/') - strfieldcat(linktarget, "../"); - i++; - } + foreach_strpart(dev->symlink, " ", pos, len) { + strnfieldcpy(linkname, dev->symlink + pos, len+1); + strfieldcpy(filename, udev_root); + strfieldcat(filename, linkname); + dbg("symlink '%s' to node '%s' requested", filename, dev->name); + if (!fake) + if (strrchr(linkname, '/')) + create_path(filename); + + /* optimize relative link */ + linktarget[0] = '\0'; + i = 0; + tail = 0; + while ((dev->name[i] == linkname[i]) && dev->name[i]) { + if (dev->name[i] == '/') + tail = i+1; + i++; + } + while (linkname[i] != '\0') { + if (linkname[i] == '/') + strfieldcat(linktarget, "../"); + i++; + } - strfieldcat(linktarget, &dev->name[tail]); + strfieldcat(linktarget, &dev->name[tail]); - if (!fake) - unlink_entry(filename); + if (!fake) + unlink_entry(filename); - dbg("symlink(%s, %s)", linktarget, filename); - if (!fake) { - retval = symlink(linktarget, filename); - if (retval != 0) - dbg("symlink(%s, %s) failed with error '%s'", - linktarget, filename, strerror(errno)); - } + dbg("symlink(%s, %s)", linktarget, filename); + if (!fake) { + retval = symlink(linktarget, filename); + if (retval != 0) + dbg("symlink(%s, %s) failed with error '%s'", + linktarget, filename, strerror(errno)); } } diff --git a/udev-remove.c b/udev-remove.c index dcd460bedc..93adcc7806 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -67,12 +67,12 @@ static int delete_path(char *path) static int delete_node(struct udevice *dev) { - char filename[255]; - char partitionname[255]; - char *symlinks; - char *linkname; + char filename[NAME_SIZE]; + char linkname[NAME_SIZE]; + char partitionname[NAME_SIZE]; int retval; int i; + int pos, len; strfieldcpy(filename, udev_root); strfieldcat(filename, dev->name); @@ -101,28 +101,22 @@ static int delete_node(struct udevice *dev) if (strchr(dev->name, '/')) delete_path(filename); - if (dev->symlink[0] != '\0') { - symlinks = dev->symlink; - while (1) { - linkname = strsep(&symlinks, " "); - if (linkname == NULL) - break; - - strfieldcpy(filename, udev_root); - strfieldcat(filename, linkname); - - dbg("unlinking symlink '%s'", filename); - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - if (retval) { - dbg("unlink(%s) failed with error '%s'", - filename, strerror(errno)); - return retval; - } - if (strchr(dev->symlink, '/')) { - delete_path(filename); - } + foreach_strpart(dev->symlink, " ", pos, len) { + strnfieldcpy(linkname, dev->symlink + pos, len+1); + strfieldcpy(filename, udev_root); + strfieldcat(filename, linkname); + + dbg("unlinking symlink '%s'", filename); + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; + if (retval) { + dbg("unlink(%s) failed with error '%s'", + filename, strerror(errno)); + return retval; + } + if (strchr(dev->symlink, '/')) { + delete_path(filename); } } diff --git a/udev.h b/udev.h index 5737c84c9d..9327e90913 100644 --- a/udev.h +++ b/udev.h @@ -97,6 +97,12 @@ do { \ snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ } while (0) +#define foreach_strpart(str, separator, pos, len) \ + for(pos = 0, len = strcspn(str, separator); \ + (pos) < strlen(str); \ + pos = pos + (len) + 1, len = strcspn((str) + pos, separator)) \ + if (len > 0) + static inline char *get_action(void) { char *action; diff --git a/udevdb.c b/udevdb.c index 95bc06ce67..22d439d638 100644 --- a/udevdb.c +++ b/udevdb.c @@ -179,7 +179,8 @@ static int find_found; static int find_device_by_name(char *path, struct udevice *dev) { - int l, i, j; + int pos, len; + if (strncmp(dev->name, find_name, sizeof(dev->name)) == 0) { memcpy(find_dev, dev, sizeof(struct udevice)); strnfieldcpy(find_path, path, NAME_SIZE); @@ -188,20 +189,18 @@ static int find_device_by_name(char *path, struct udevice *dev) return 1; } /* look for matching symlink*/ - l = strlen(dev->symlink); - if (!l) - return 0; - i = j = 0; - do { - j = strcspn(&dev->symlink[i], " "); - if (j && strncmp(&dev->symlink[i], find_name, j) == 0) { - memcpy(find_dev, dev, sizeof(struct udevice)); - strnfieldcpy(find_path, path, NAME_SIZE); - find_found = 1; - return 1; - } - i = i + j + 1; - } while (i < l); + foreach_strpart(dev->symlink, " ", pos, len) { + if (strncmp(&dev->symlink[pos], find_name, len) != 0) + continue; + + if (len != strlen(find_name)) + continue; + + memcpy(find_dev, dev, sizeof(struct udevice)); + strnfieldcpy(find_path, path, NAME_SIZE); + find_found = 1; + return 1; + } return 0; } diff --git a/udevinfo.8 b/udevinfo.8 index 528fa4ad95..e087e2d1ff 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -35,6 +35,8 @@ Specify the sysfs path of the device to query. .TP .BI \-n " name" Specify the name of the node or the symlink for the device to query. +Partition names generated with the NAME{all_partitons} option can not be +queried, the main device must be used instead. .TP .B \-a Print all -- cgit v1.2.3-54-g00ecf From 5895eb31fe86619a9d9070e12bc0c970da9daf6b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 4 Mar 2004 00:51:28 -0800 Subject: [PATCH] fix the build for older versions of gcc --- udev-add.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev-add.c b/udev-add.c index c28256a5a6..9562cb5dbb 100644 --- a/udev-add.c +++ b/udev-add.c @@ -226,10 +226,11 @@ static int create_node(struct udevice *dev, int fake) if (endptr[0] == '\0') uid = (uid_t) id; else { + struct passwd *pw; if (strncmp(dev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0) set_to_local_user(dev->owner); - struct passwd *pw = getpwnam(dev->owner); + pw = getpwnam(dev->owner); if (pw == NULL) dbg("specified user unknown '%s'", dev->owner); else -- cgit v1.2.3-54-g00ecf From e4f9c4a46de499841939c51da1a1cf6fd5321bb1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 4 Mar 2004 00:52:05 -0800 Subject: [PATCH] 021_bk mark --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 526139a09b..e4c6184c95 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 021 +VERSION = 021_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 9ead619186..b7e429d077 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 021 +Version: 021_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 27c3403dd810e53f6c9b8dffe34af7798a4b52d3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 4 Mar 2004 00:54:13 -0800 Subject: [PATCH] fix NAME="foo-%c{N}" gets a truncated name On Wed, Mar 03, 2004 at 02:43:34PM -0800, Patrick Mansfield wrote: > Here is a fix and a new test for the problem Atul hit, where if we have a > NAME based on a result of the form: > > NAME="foo-%c{7}" > > udev truncates the name. Without any prefix (the foo- in this example), > the rule was working OK. Here is a fix for the fix :) Sorry, I broke it yesterday. --- namedev.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 74d4d76467..e9b3babd56 100644 --- a/namedev.c +++ b/namedev.c @@ -214,6 +214,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, struct sysfs_device *sysfs_device) { char temp[NAME_SIZE]; + char temp2[NAME_SIZE]; char *tail; char *pos; char *attr; @@ -277,6 +278,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, i = atoi(attr); if (i > 0) { foreach_strpart(udev->program_result, " \n\r", spos, slen) { + strnfieldcpy(temp2, udev->program_result + spos, slen+1); i--; if (i == 0) break; @@ -285,8 +287,8 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("requested part of result string not found"); break; } - strnfieldcat(string, udev->program_result + spos, slen+1); - dbg("substitute part of result string '%s'", pos); + strnfieldcat(string, temp2, maxsize); + dbg("substitute part of result string '%s'", temp2); } else { strnfieldcat(string, udev->program_result, maxsize); dbg("substitute result string '%s'", udev->program_result); -- cgit v1.2.3-54-g00ecf From 56c963dc4d8a65a8f2f23ae329f2088fabbf3303 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Thu, 4 Mar 2004 00:55:22 -0800 Subject: [PATCH] add tests for NAME="foo-%c{N}" Here is a patch for some new tests. --- test/udev-test.pl | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 6b7f515442..60cf16901c 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -259,6 +259,24 @@ EOF expected => "foo9" , conf => < "characters before the %c{N} substitution", + subsys => "block", + devpath => "block/sda/sda3", + expected => "my-foo9" , + conf => < "substitute the second to last argument", + subsys => "block", + devpath => "block/sda/sda3", + expected => "my-foo8" , + conf => < Date: Thu, 4 Mar 2004 00:57:29 -0800 Subject: [PATCH] overall trivial trivial cleanup Here I try to make the style a bit more consistant in the different files, so that new patches just copy the 'right' one :) Some "magic" numbers are replaced and udevtest.c is catched up with udev. --- logging.h | 6 ++++-- namedev_parse.c | 1 - udev.c | 6 +++--- udevd.c | 2 +- udevinfo.c | 2 +- udevsend.c | 2 +- udevstart.c | 4 ++-- udevtest.c | 41 ++++++++++------------------------------- 8 files changed, 22 insertions(+), 42 deletions(-) diff --git a/logging.h b/logging.h index 1c27917f61..40c342c3ab 100644 --- a/logging.h +++ b/logging.h @@ -34,6 +34,8 @@ #include #include +#define LOGNAME_SIZE 42 + #undef info #define info(format, arg...) \ do { \ @@ -61,12 +63,12 @@ extern void log_message(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); /* each program that uses syslog must declare this variable somewhere */ -extern unsigned char logname[42]; +extern unsigned char logname[LOGNAME_SIZE]; #undef init_logging static inline void init_logging(char *program_name) { - snprintf(logname, 42,"%s[%d]", program_name, getpid()); + snprintf(logname, LOGNAME_SIZE,"%s[%d]", program_name, getpid()); openlog(logname, 0, LOG_DAEMON); } diff --git a/namedev_parse.c b/namedev_parse.c index 19acd96ef0..defb698b26 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -58,7 +58,6 @@ static int add_config_dev(struct config_device *new_dev) void dump_config_dev(struct config_device *dev) { - /*FIXME dump all sysfs's */ dbg_parse("name='%s', symlink='%s', bus='%s', place='%s', id='%s', " "sysfs_file[0]='%s', sysfs_value[0]='%s', " "kernel='%s', program='%s', result='%s'", diff --git a/udev.c b/udev.c index 227145982e..9b4d91f75c 100644 --- a/udev.c +++ b/udev.c @@ -40,7 +40,7 @@ char **main_argv; char **main_envp; #ifdef LOG -unsigned char logname[42]; +unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) { va_list args; @@ -74,7 +74,7 @@ static char *subsystem_blacklist[] = { "usb_host", "pci_bus", "pcmcia_socket", - "", + "" }; static int udev_hotplug(void) @@ -164,7 +164,7 @@ exit: return -retval; } -int main(int argc, char **argv, char **envp) +int main(int argc, char *argv[], char *envp[]) { main_argv = argv; main_envp = envp; diff --git a/udevd.c b/udevd.c index 2b3dc55788..efcb65bb53 100644 --- a/udevd.c +++ b/udevd.c @@ -52,7 +52,7 @@ static void exec_queue_manager(void); static void msg_queue_manager(void); #ifdef LOG -unsigned char logname[42]; +unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) { va_list args; diff --git a/udevinfo.c b/udevinfo.c index b15f174e40..3361837a37 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -41,7 +41,7 @@ char **main_argv; int main_argc; #ifdef LOG -unsigned char logname[42]; +unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) { va_list args; diff --git a/udevsend.c b/udevsend.c index 4b6ef5c2f3..11234808d9 100644 --- a/udevsend.c +++ b/udevsend.c @@ -41,7 +41,7 @@ #include "logging.h" #ifdef LOG -unsigned char logname[42]; +unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) { va_list args; diff --git a/udevstart.c b/udevstart.c index 5c977b5ce6..21fd93df74 100644 --- a/udevstart.c +++ b/udevstart.c @@ -34,7 +34,7 @@ #ifdef LOG -unsigned char logname[42]; +unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) { va_list args; @@ -187,7 +187,7 @@ static int udev_scan(void) } -int main(int argc, char **argv, char **envp) +int main(int argc, char *argv[], char *envp[]) { init_logging("udevstart"); diff --git a/udevtest.c b/udevtest.c index 4bc094fd90..e67d452577 100644 --- a/udevtest.c +++ b/udevtest.c @@ -38,15 +38,11 @@ char **main_argv; char **main_envp; #ifdef LOG -unsigned char logname[42]; +unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) { - va_list args; + va_list args; -// if (!udev_log) -// return; - - /* FIXME use level... */ va_start(args, format); vprintf(format, args); va_end(args); @@ -55,35 +51,24 @@ void log_message (int level, const char *format, ...) } #endif -static void sig_handler(int signum) -{ - switch (signum) { - case SIGINT: - case SIGTERM: - exit(20 + signum); - default: - dbg("unhandled signal"); - } -} - static char *subsystem_blacklist[] = { "net", "scsi_host", "scsi_device", "usb_host", "pci_bus", - "", + "pcmcia_socket", + "" }; -static int udev_hotplug(int argc, char **argv) +static int udev_hotplug(void) { char *devpath; char *subsystem; int retval = -EINVAL; int i; - struct sigaction act; - devpath = argv[1]; + devpath = main_argv[1]; if (!devpath) { dbg("no devpath?"); goto exit; @@ -98,7 +83,7 @@ static int udev_hotplug(int argc, char **argv) } /* skip blacklisted subsystems */ - subsystem = argv[1]; + subsystem = main_argv[1]; i = 0; while (subsystem_blacklist[i][0] != '\0') { if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { @@ -111,16 +96,10 @@ static int udev_hotplug(int argc, char **argv) /* initialize our configuration */ udev_init_config(); - /* set up a default signal handler for now */ - act.sa_handler = sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = SA_RESTART; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - /* initialize the naming deamon */ namedev_init(); + /* simulate node creation with fake flag */ retval = udev_add_device(devpath, subsystem, 1); exit: @@ -130,14 +109,14 @@ exit: return -retval; } -int main(int argc, char **argv, char **envp) +int main(int argc, char *argv[], char *envp[]) { main_argv = argv; main_envp = envp; dbg("version %s", UDEV_VERSION); - return udev_hotplug(argc, argv); + return udev_hotplug(); } -- cgit v1.2.3-54-g00ecf From a3fa7908e25bda3fc8627c7a91878a7825f9391f Mon Sep 17 00:00:00 2001 From: "hannal@us.ibm.com" Date: Thu, 4 Mar 2004 01:17:08 -0800 Subject: [PATCH] Small fix to remove extra "will" in man page remove extraneous word. --- udev.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.8 b/udev.8 index c0dc68b803..bc7308f484 100644 --- a/udev.8 +++ b/udev.8 @@ -25,7 +25,7 @@ The default behavior of .B udev is to wait until all the sysfs files of the device chain are populated. If set .B udev -will will continue, regardless of the state of the device representation. +will continue, regardless of the state of the device representation. .SH "DESCRIPTION" .B udev creates or removes device node files usually located in the /dev directory. -- cgit v1.2.3-54-g00ecf From ef672b3dc450846d540cf1a0519fe273bbd62e5f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 4 Mar 2004 18:55:34 -0800 Subject: [PATCH] better fix for NAME="foo-%c{N}" gets a truncated name On Wed, Mar 03, 2004 at 04:56:34PM -0800, Greg KH wrote: > On Wed, Mar 03, 2004 at 03:57:04PM -0800, Patrick Mansfield wrote: > > > > Here is a patch for some new tests. > > Applied, thanks. Here is a small improvement, which looks much better. Hey Pat, thanks a lot for finding the recent bug, hope this one will not break it again :) --- namedev.c | 5 +++-- udev-add.c | 5 +++-- udev-remove.c | 5 +++-- udev.h | 6 +++--- udevdb.c | 5 +++-- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/namedev.c b/namedev.c index e9b3babd56..9182ed1fdc 100644 --- a/namedev.c +++ b/namedev.c @@ -220,8 +220,9 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, char *attr; int len; int i; - int spos, slen; char c; + char *spos; + int slen; struct sysfs_attribute *tmpattr; pos = string; @@ -278,7 +279,6 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, i = atoi(attr); if (i > 0) { foreach_strpart(udev->program_result, " \n\r", spos, slen) { - strnfieldcpy(temp2, udev->program_result + spos, slen+1); i--; if (i == 0) break; @@ -287,6 +287,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("requested part of result string not found"); break; } + strnfieldcpy(temp2, spos, slen+1); strnfieldcat(string, temp2, maxsize); dbg("substitute part of result string '%s'", temp2); } else { diff --git a/udev-add.c b/udev-add.c index 9562cb5dbb..de1fb953c4 100644 --- a/udev-add.c +++ b/udev-add.c @@ -195,7 +195,8 @@ static int create_node(struct udevice *dev, int fake) gid_t gid = 0; int i; int tail; - int pos, len; + char *pos; + int len; strfieldcpy(filename, udev_root); strfieldcat(filename, dev->name); @@ -281,7 +282,7 @@ static int create_node(struct udevice *dev, int fake) /* create symlink if requested */ foreach_strpart(dev->symlink, " ", pos, len) { - strnfieldcpy(linkname, dev->symlink + pos, len+1); + strnfieldcpy(linkname, pos, len+1); strfieldcpy(filename, udev_root); strfieldcat(filename, linkname); dbg("symlink '%s' to node '%s' requested", filename, dev->name); diff --git a/udev-remove.c b/udev-remove.c index 93adcc7806..195b987411 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -72,7 +72,8 @@ static int delete_node(struct udevice *dev) char partitionname[NAME_SIZE]; int retval; int i; - int pos, len; + char *pos; + int len; strfieldcpy(filename, udev_root); strfieldcat(filename, dev->name); @@ -102,7 +103,7 @@ static int delete_node(struct udevice *dev) delete_path(filename); foreach_strpart(dev->symlink, " ", pos, len) { - strnfieldcpy(linkname, dev->symlink + pos, len+1); + strnfieldcpy(linkname, pos, len+1); strfieldcpy(filename, udev_root); strfieldcat(filename, linkname); diff --git a/udev.h b/udev.h index 9327e90913..32fda379e5 100644 --- a/udev.h +++ b/udev.h @@ -98,9 +98,9 @@ do { \ } while (0) #define foreach_strpart(str, separator, pos, len) \ - for(pos = 0, len = strcspn(str, separator); \ - (pos) < strlen(str); \ - pos = pos + (len) + 1, len = strcspn((str) + pos, separator)) \ + for(pos = str, len = 0; \ + (pos) < ((str) + strlen(str)); \ + pos = pos + len + strspn(pos, separator), len = strcspn(pos, separator)) \ if (len > 0) static inline char *get_action(void) diff --git a/udevdb.c b/udevdb.c index 22d439d638..b12f5b3d46 100644 --- a/udevdb.c +++ b/udevdb.c @@ -179,7 +179,8 @@ static int find_found; static int find_device_by_name(char *path, struct udevice *dev) { - int pos, len; + char *pos; + int len; if (strncmp(dev->name, find_name, sizeof(dev->name)) == 0) { memcpy(find_dev, dev, sizeof(struct udevice)); @@ -190,7 +191,7 @@ static int find_device_by_name(char *path, struct udevice *dev) } /* look for matching symlink*/ foreach_strpart(dev->symlink, " ", pos, len) { - if (strncmp(&dev->symlink[pos], find_name, len) != 0) + if (strncmp(pos, find_name, len) != 0) continue; if (len != strlen(find_name)) -- cgit v1.2.3-54-g00ecf From ebc39fefd5cb8249cd09d4b3d1b8c72c9e48bab1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 4 Mar 2004 18:58:02 -0800 Subject: [PATCH] clarify udevinfo text Make udevinfo attribute printing note so clear, that's nearly impossible to misunderstand it in the future. --- udevinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 3361837a37..ffc5e31f04 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -151,10 +151,10 @@ static int print_device_chain(const char *path) } printf("\nudevinfo starts with the device the node belongs to and then walks up the\n" - "device chain to print for every device found all possibly useful attributes\n" + "device chain, to print for every device found, all possibly useful attributes\n" "in the udev key format.\n" - "Only attributes within one device section may be used in a rule to match the\n" - "device for which the node will be created.\n" + "Only attributes within one device section may be used together in one rule,\n" + "to match the device for which the node will be created.\n" "\n"); printf("device '%s' has major:minor %s", class_dev->path, attr->value); sysfs_close_attribute(attr); -- cgit v1.2.3-54-g00ecf From d5f91372dd3241f8b4bbe2a99aaaeda541a76bad Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 4 Mar 2004 18:59:13 -0800 Subject: [PATCH] conditional remove of trailing sysfs whitespace Hey, it may never happen, that one wants to distinguish attributes by trailing spaces, but we should not lose the control over it, just for being lazy :) Here we remove the trailing spaces of the sysfs attribute only if the configured value to match doesn't have any trailing spaces by itself. So if you put a attribute in a rule with spaces at the end, the sysfs attribute _must_ match exactly. Is that cool for everyone? As usual, 2 tests are added for it with a artificial sysfs file and a few words to the man page. --- namedev.c | 14 ++++++++++++++ .../0000:02:05.0/host0/0:0:0:0/whitespace_test | 1 + test/udev-test.pl | 19 +++++++++++++++++++ udev.8 | 3 +++ 4 files changed, 37 insertions(+) create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/whitespace_test diff --git a/namedev.c b/namedev.c index 9182ed1fdc..dfeadee18a 100644 --- a/namedev.c +++ b/namedev.c @@ -525,6 +525,8 @@ attr_found: static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair) { struct sysfs_attribute *tmpattr; + int i; + int len; if ((pair == NULL) || (pair->file[0] == '\0') || (pair->value == '\0')) return -ENODEV; @@ -533,6 +535,18 @@ static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct if (tmpattr == NULL) return -ENODEV; + /* strip trailing whitespace of value, if not asked to match for it */ + if (! isspace(pair->value[strlen(pair->value)-1])) { + i = len = strlen(tmpattr->value); + while (i > 0 && isspace(tmpattr->value[i-1])) + i--; + if (i < len) { + tmpattr->value[i] = '\0'; + dbg("remove %i trailing whitespace chars from '%s'", + len - i, tmpattr->value); + } + } + dbg("compare attribute '%s' value '%s' with '%s'", pair->file, tmpattr->value, pair->value); if (strcmp_pattern(pair->value, tmpattr->value) != 0) diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/whitespace_test b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/whitespace_test new file mode 100644 index 0000000000..e3d48f0fe0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/whitespace_test @@ -0,0 +1 @@ +WHITE SPACE diff --git a/test/udev-test.pl b/test/udev-test.pl index 60cf16901c..38ea0181f6 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -465,6 +465,25 @@ EOF conf => < "ignore SYSFS attribute whitespace", + subsys => "block", + devpath => "block/sda", + expected => "ignored", + conf => < "do not ignore SYSFS attribute whitespace", + subsys => "block", + devpath => "block/sda", + expected => "matched-with-space", + conf => < Date: Thu, 4 Mar 2004 18:59:18 -0800 Subject: [PATCH] Include more examples in the docs area for gentoo and redhat Here's a patch that puts the udev.rules and udev.permissions files in the docs dir. This should help people out who install with just the rpm. --- udev.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev.spec b/udev.spec index b7e429d077..34e0755fda 100644 --- a/udev.spec +++ b/udev.spec @@ -114,7 +114,9 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%doc COPYING README TODO ChangeLog HOWTO* etc/udev/udev.rules.examples docs/* +%doc COPYING README TODO ChangeLog HOWTO* docs/* +%doc etc/udev/udev.rules.{examples,gentoo,redhat} +%doc etc/udev/udev.permissions.{gentoo,redhat} %attr(755,root,root) /sbin/udev %attr(755,root,root) /usr/bin/udevinfo %attr(755,root,root) /sbin/udevsend -- cgit v1.2.3-54-g00ecf From 3f20eac0a58dc3987200773a39163e30b60993fc Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Thu, 4 Mar 2004 19:10:02 -0800 Subject: [PATCH] udevstart fixes udevstart_no_retval: currently udevstart will always return rc=22 because of the error handling code. I completely removed it because it is not used, and returning a generic error to the init script is not much useful anyway. --- udevstart.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/udevstart.c b/udevstart.c index 21fd93df74..40dbaf2475 100644 --- a/udevstart.c +++ b/udevstart.c @@ -78,12 +78,11 @@ static void udev_exec(const char *path, const char* subsystem) } } -static int udev_scan(void) +static void udev_scan(void) { char *devpath; DIR *dir; struct dirent *dent; - int retval = -EINVAL; devpath = "block"; dir = opendir(SYSBLOCK); @@ -179,11 +178,6 @@ static int udev_scan(void) } } } - - if (retval > 0) - retval = 0; - - return -retval; } @@ -191,5 +185,7 @@ int main(int argc, char *argv[], char *envp[]) { init_logging("udevstart"); - return udev_scan(); + udev_scan(); + + return 0; } -- cgit v1.2.3-54-g00ecf From 17794d77b97fcb8af263bcecbe03dad5d0e9a89a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 9 Mar 2004 19:50:15 -0800 Subject: [PATCH] rename strn*() macros to strmax Hey, I wrote the strn*() macros just 10 days ago and yesterday this trap caught me with the %c{x} bug. The names are misleading cause we all expect that the from field is limited by the size argument, but we actually limit the overall size of the destination string to prevent a overflow. Here we rename all strn*() macros to str*max(). That should be more self-explanatory. --- namedev.c | 24 ++++++++++++------------ udev-add.c | 6 +++--- udev-remove.c | 2 +- udev.h | 6 +++--- udev_config.c | 2 +- udevdb.c | 4 ++-- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/namedev.c b/namedev.c index dfeadee18a..23d46518ea 100644 --- a/namedev.c +++ b/namedev.c @@ -247,27 +247,27 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, case 'b': if (strlen(udev->bus_id) == 0) break; - strnfieldcat(string, udev->bus_id, maxsize); + strfieldcatmax(string, udev->bus_id, maxsize); dbg("substitute bus_id '%s'", udev->bus_id); break; case 'k': if (strlen(udev->kernel_name) == 0) break; - strnfieldcat(string, udev->kernel_name, maxsize); + strfieldcatmax(string, udev->kernel_name, maxsize); dbg("substitute kernel name '%s'", udev->kernel_name); break; case 'n': if (strlen(udev->kernel_number) == 0) break; - strnfieldcat(string, udev->kernel_number, maxsize); + strfieldcatmax(string, udev->kernel_number, maxsize); dbg("substitute kernel number '%s'", udev->kernel_number); break; case 'm': - strnintcat(string, udev->minor, maxsize); + strintcatmax(string, udev->minor, maxsize); dbg("substitute minor number '%u'", udev->minor); break; case 'M': - strnintcat(string, udev->major, maxsize); + strintcatmax(string, udev->major, maxsize); dbg("substitute major number '%u'", udev->major); break; case 'c': @@ -287,11 +287,11 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("requested part of result string not found"); break; } - strnfieldcpy(temp2, spos, slen+1); - strnfieldcat(string, temp2, maxsize); + strfieldcpymax(temp2, spos, slen+1); + strfieldcatmax(string, temp2, maxsize); dbg("substitute part of result string '%s'", temp2); } else { - strnfieldcat(string, udev->program_result, maxsize); + strfieldcatmax(string, udev->program_result, maxsize); dbg("substitute result string '%s'", udev->program_result); } break; @@ -302,14 +302,14 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("sysfa attribute '%s' not found", attr); break; } - strnfieldcat(string, tmpattr->value, maxsize); + strfieldcatmax(string, tmpattr->value, maxsize); dbg("substitute sysfs value '%s'", tmpattr->value); } else { dbg("missing attribute"); } break; case '%': - strnfieldcat(string, "%", maxsize); + strfieldcatmax(string, "%", maxsize); break; default: dbg("unknown substitution type '%%%c'", c); @@ -319,7 +319,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, if (len > 0) pos[len] = '\0'; - strnfieldcat(string, tail, maxsize); + strfieldcatmax(string, tail, maxsize); } } @@ -428,7 +428,7 @@ static int execute_program(char *path, char *value, int len) dup(fds[1]); /* copy off our path to use incase we have too many args */ - strnfieldcpy(buffer, path, sizeof(buffer)); + strfieldcpymax(buffer, path, sizeof(buffer)); if (strchr(path, ' ')) { /* exec with arguments */ diff --git a/udev-add.c b/udev-add.c index de1fb953c4..ce723e45cc 100644 --- a/udev-add.c +++ b/udev-add.c @@ -141,7 +141,7 @@ static void set_to_local_user(char *user) struct utmp *u; time_t recent = 0; - strnfieldcpy(user, default_owner_str, OWNER_SIZE); + strfieldcpymax(user, default_owner_str, OWNER_SIZE); setutent(); while (1) { u = getutent(); @@ -158,7 +158,7 @@ static void set_to_local_user(char *user) if (u->ut_time > recent) { recent = u->ut_time; - strnfieldcpy(user, u->ut_user, OWNER_SIZE); + strfieldcpymax(user, u->ut_user, OWNER_SIZE); dbg("local user is '%s'", user); break; } @@ -282,7 +282,7 @@ static int create_node(struct udevice *dev, int fake) /* create symlink if requested */ foreach_strpart(dev->symlink, " ", pos, len) { - strnfieldcpy(linkname, pos, len+1); + strfieldcpymax(linkname, pos, len+1); strfieldcpy(filename, udev_root); strfieldcat(filename, linkname); dbg("symlink '%s' to node '%s' requested", filename, dev->name); diff --git a/udev-remove.c b/udev-remove.c index 195b987411..44ad603d4a 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -103,7 +103,7 @@ static int delete_node(struct udevice *dev) delete_path(filename); foreach_strpart(dev->symlink, " ", pos, len) { - strnfieldcpy(linkname, pos, len+1); + strfieldcpymax(linkname, pos, len+1); strfieldcpy(filename, udev_root); strfieldcat(filename, linkname); diff --git a/udev.h b/udev.h index 32fda379e5..8752f595d6 100644 --- a/udev.h +++ b/udev.h @@ -73,13 +73,13 @@ do { \ strncat(to, from, sizeof(to) - strlen(to)-1); \ } while (0) -#define strnfieldcpy(to, from, maxsize) \ +#define strfieldcpymax(to, from, maxsize) \ do { \ to[maxsize-1] = '\0'; \ strncpy(to, from, maxsize-1); \ } while (0) -#define strnfieldcat(to, from, maxsize) \ +#define strfieldcatmax(to, from, maxsize) \ do { \ to[maxsize-1] = '\0'; \ strncat(to, from, maxsize - strlen(to)-1); \ @@ -91,7 +91,7 @@ do { \ snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%u", i); \ } while (0) -#define strnintcat(to, i, maxsize) \ +#define strintcatmax(to, i, maxsize) \ do { \ to[maxsize-1] = '\0'; \ snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ diff --git a/udev_config.c b/udev_config.c index de83ef9c4c..e2031dc64d 100644 --- a/udev_config.c +++ b/udev_config.c @@ -81,7 +81,7 @@ static void init_variables(void) #define set_var(_name, _var) \ if (strcasecmp(variable, _name) == 0) { \ dbg_parse("%s = '%s'", _name, value); \ - strnfieldcpy(_var, value, sizeof(_var));\ + strfieldcpymax(_var, value, sizeof(_var));\ } #define set_bool(_name, _var) \ diff --git a/udevdb.c b/udevdb.c index b12f5b3d46..01df3ba7e1 100644 --- a/udevdb.c +++ b/udevdb.c @@ -184,7 +184,7 @@ static int find_device_by_name(char *path, struct udevice *dev) if (strncmp(dev->name, find_name, sizeof(dev->name)) == 0) { memcpy(find_dev, dev, sizeof(struct udevice)); - strnfieldcpy(find_path, path, NAME_SIZE); + strfieldcpymax(find_path, path, NAME_SIZE); find_found = 1; /* stop search */ return 1; @@ -198,7 +198,7 @@ static int find_device_by_name(char *path, struct udevice *dev) continue; memcpy(find_dev, dev, sizeof(struct udevice)); - strnfieldcpy(find_path, path, NAME_SIZE); + strfieldcpymax(find_path, path, NAME_SIZE); find_found = 1; return 1; } -- cgit v1.2.3-54-g00ecf From 2bd07cf29b30b424d4b5a17882d0cab0b235153b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 9 Mar 2004 19:50:22 -0800 Subject: [PATCH] put symlink only rules to the man page Here we mention the "symlink only - add it to another rule" feature to the man page. Andrey, does this describe what you have implemented :) --- udev.8 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/udev.8 b/udev.8 index 76b8913f03..24ff4e28a9 100644 --- a/udev.8 +++ b/udev.8 @@ -200,8 +200,7 @@ call. This key may used in any following rule after a call. .TP .B NAME -The name of the node to be created. If the name field is omitted or its -value is empty, the device will be ignored and no node will be created. +The name of the node to be created. .br If given with the attribute .BR NAME{ all_partitions } @@ -211,6 +210,16 @@ This may be useful for removable media devices. .B SYMLINK The name of a symlink targeting the node. Multiple symlinks may be specified by separating the names by the space character. +.br +If both the name and the symlink fields are omitted or its +values empty, the device will be ignored and no node will be created. +.br +If only the symlink field is given and the name field is omitted, +the rule will not be applied immediatly, but the symlink field is added +to the symlink list of the rule which will create the node. +This makes it possible to specify additional symlinks in a possibly +separate rules file, while the device nodes are maintained by the +distribution provided rules file. .P .RB "The " NAME " ," SYMLINK " and " PROGRAM fields support simple printf-like string substitution: -- cgit v1.2.3-54-g00ecf From b86f56ff0936b8bf3fddfc60bbb2697b74a3fcf7 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 9 Mar 2004 19:50:30 -0800 Subject: [PATCH] man page beauty Thanks to Christian Gierke, he sent me a beauty patch for our man pages. Some typos are fixed and a few word are clarified. --- udev.8 | 83 ++++++++++++++++++++++++++++++------------------------------- udevd.8 | 11 ++++---- udevinfo.8 | 12 ++++----- udevstart.8 | 4 +-- 4 files changed, 54 insertions(+), 56 deletions(-) diff --git a/udev.8 b/udev.8 index 24ff4e28a9..8ebcf7bd99 100644 --- a/udev.8 +++ b/udev.8 @@ -13,7 +13,7 @@ signifies the connection or disconnection of a device. .B DEVPATH The sysfs devpath of the device without the mountpoint but a leading slash. .P -Additional optional environment variables are: +Additional optional environment variables: .TP .B UDEV_CONFIG_FILE Overrides the default location of the @@ -29,8 +29,8 @@ will continue, regardless of the state of the device representation. .SH "DESCRIPTION" .B udev creates or removes device node files usually located in the /dev directory. -It provides a dynamic device directory that contains only the files for -devices that are actually present. +It provides a dynamic device directory contaning only the files for +actually present devices. .P As part of the .B hotplug @@ -41,7 +41,7 @@ On device creation, .B udev reads the sysfs directory of the given device to collect device attributes like label, serial number or bus device number. -These attributes may used as keys to determine a +These attributes may be used as keys to determine a unique name for device file creation. .B udev maintains a database for devices present on the system. @@ -53,27 +53,27 @@ queries its database for the name of the device file to be deleted. All .B udev configuration files consist of a set of lines of text. All empty -lines, and lines beginning with a '#' will be ignored. +lines and lines beginning with a '#' will be ignored. .P .B udev expects its main configuration file at .IR /etc/udev/udev.conf . -The file consists of a set of variables and values that allow the user to -override default udev values. The current set of variables that can be -overridden in this file is: +The file consists of a set of variables and values allowing the user to +override default udev values. The following variables can be overridden +in this file: .TP .B udev_root -This is the where in the filesystem to place the device nodes. The default -value for this is +Indicates where to place the device nodes in the filesystem. The default +value is .IR /udev/ . .TP .B udev_db -The name and location of the udev database. The default value for this is +The name and location of the udev database. The default value is .IR /udev/.udev.tdb . .TP .B udev_rules -This is the location of the udev rules file. The default value for this is +This is the location of the udev rules file. The default value for this is .IR /etc/udev/udev.rules . If a directory is specified, the whole directory is scanned for files ending with @@ -89,32 +89,32 @@ and all permission files are read in lexical order. .TP .B udev_log If you want udev to log some information to the syslog for every node created or -removed. The default value for this is +removed. The default value is .IR yes . .TP .B default_mode -This is the default mode for all nodes that have no explicit match in the -permissions file. The default value for this is +This is the default mode for all nodes not explicitely matching in the +permissions file. The default value is .IR 0666 . .TP .B default_owner -This is the default owner for all nodes that have no explicit match in the -permissions file. The default value for this is +This is the default owner for all nodes not explicitely matching in the +permissions file. The default value is .IR root . .TP .B default_group -This is the default group for all nodes that have no explicit match in the -permissions file. The default value for this is +This is the default group for all nodes not explicitely matching in the +permissions file. The default value is .IR root . .br .P .RI "A sample " udev.conf " might look like this: .sp .nf -# udev_root - where in the filesystem to place the device nodes +# udev_root - where to place the device nodes in the filesystem udev_root="/udev/" -# udev_db - The name and location of the udev database. +# udev_db - The name and location of the udev database udev_db="/udev/.udev.tdb" # udev_rules - The location of the directory where to look for files @@ -127,22 +127,22 @@ udev_permissions="/etc/udev/udev.permissions" # udev_log - set to "yes" if you want logging, else "no" udev_log="yes" -# default_mode - set the default mode for all nodes that have no -# explicit match in the permissions file +# default_mode - set the default mode for all nodes not +# explicitely matching in the permissions file default_mode="0666" -# default_owner - set the default owner for all nodes that have no -# explicit match in the permissions file +# default_owner - set the default owner for all nodes not +# explicitely matching in the permissions file default_owner="root" -# default_group - set the default group for all nodes that have no -# explicit match in the permissions file +# default_group - set the default group for all nodes not +# explicitely matching in the permissions file default_group="root" .fi .P -The rules for udev to use when naming devices may specified at +The rules for udev to use when naming devices may specified in .I /etc/udev/udev.rules -or specified by the +or by the .I udev_rules value in the .I /etc/udev/udev.conf @@ -159,7 +159,7 @@ Every rule consists of a list a comma separated fields: .sp .IR "key " ,[ "key " ,...] " name " [, " symlink" ] .sp -where possible fields are: +where fields are: .TP .B BUS Match the bus type of the device. @@ -177,7 +177,7 @@ Match the topological position on bus, like physical port of USB device .BI SYSFS{ filename } Match sysfs device attribute like label, vendor, USB serial number, SCSI UUID or file system label. Up to 5 different sysfs files can be checked, with -all of the values being required in order to match the rule. +all of the values being required to match the rule. .br Trailing whitespace characters in the sysfs attribute value are ignored, if the key doesn't have any trailing whitespace characters by itself. @@ -188,14 +188,14 @@ The environment variables of .B udev are also available for the program. .br -The string returned by the program may additionally matched with the +The string returned by the program may be additionally matched with the .B RESULT key. .TP .B RESULT Match the returned string of the last .B PROGRAM -call. This key may used in any following rule after a +call. This key may be used in any following rule after a .B PROGRAM call. .TP @@ -241,15 +241,14 @@ The kernel minor number for the device. The bus id for the device. .TP .B %c -The +The string returned from the execution of .B PROGRAM -returned string. (This does not work within the .B PROGRAM field for the obvious reason.) .br -A single part of the string, separated by the space character -my be selected by specifying the part number as a attribute: +A single part of the string, separated by a space character +may be selected by specifying the part number as a attribute: .BI %c{ part } .TP .BI %s{ filename } @@ -271,7 +270,7 @@ BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="OEM 0815", NAME="disk1" # USB printer to be called lp_color BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_color" -# SCSI disk with a specific vendor and model number is to be called boot +# SCSI disk with a specific vendor and model number will be called boot BUS="scsi", SYSFS{vendor}="IBM", SYSFS{model}="ST336", NAME="boot%n" # sound card with PCI bus id 00:0b.0 to be called dsp @@ -287,9 +286,9 @@ KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" BUS="usb", SYSFS{model}="XV3", NAME="video%n", SYMLINK="webcam%n" .fi .P -Permissions and ownership for the created device files may specified at +Permissions and ownership for the created device files may specified in .I /etc/udev/udev.permissions -or specified by the +or by the .I udev_permission value in the .I /etc/udev/udev.conf @@ -311,7 +310,7 @@ dsp1:::0666 .P The value .I $local -can be substituted for a specific username. In that case, udev will determine +can be used instead of a specific username. In that case, udev will determine the current local user at the time of device node creation and substitute that username as the owner of the new device node. This is useful, for example, to let hot-plugged devices, such as cameras, be owned by the user at @@ -334,7 +333,7 @@ Matches any single character specified within the brackets. For example, the pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character -following the '[' is a '!' then any character not enclosed is matched. +following the '[' is a '!', any character not enclosed is matched. .SH "FILES" .nf /sbin/udev udev program diff --git a/udevd.8 b/udevd.8 index 30adb94f2b..9d0127b6bc 100644 --- a/udevd.8 +++ b/udevd.8 @@ -23,19 +23,18 @@ If unset, the event bypasses the queue and will be executed immediately. allows the serialization of .BR hotplug (8) events. The events generated by the kernel may arrive in random order -in userspace, that makes it neccessary to reorder it. +in userspace, that makes it neccessary to reorder them. .br .B udevd takes care of the kernel supplied sequence number and arranges the events for -execution in the correct order. Missing sequences are delaying the -execution of the following events until a timeout of a maximum of 5 seconds -is reached. +execution in the correct order. Missing sequences delay the execution of the +following events until a timeout of a maximum of 5 seconds is reached. .br For each event a .BR udev (8) instance is executed in the background. All further events for the same device -are delayed until the execution is finished. This way it will never run more -than one instance for a single device at the same time. +are delayed until the execution is finished. This way there will never be more +than one instance running for a single device at the same time. .br .B udevd receives the events from diff --git a/udevinfo.8 b/udevinfo.8 index e087e2d1ff..bf6a0aded1 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -6,18 +6,18 @@ udevinfo \- retrieve information from udev .RI "[\-q " query_type " \-p " sysfs_path "] [\-drVh]" .SH "DESCRIPTION" .B udevinfo -allows users to query the udev database for information on any of the devices -currently present in the system. It also provides a way to query any device -in the sysfs tree to help in creating +allows users to query the udev database for information on any device +currently present on the system. It also provides a way to query any device +in the sysfs tree to help creating .B udev -rule files. +rules. .SH "OPTIONS" .TP .B \-V Print the version information. .TP .B \-r -Print the the +Print the .B udev_root directory. When used in conjunction with a query for the node name, the .B udev_root @@ -41,7 +41,7 @@ queried, the main device must be used instead. .B \-a Print all .BI SYSFS{ filename } -attributes along the device chain. Useful for for finding +attributes along the device chain. Useful for finding unique attributes to compose a rule. .RB Needs " \-p " specified. .TP diff --git a/udevstart.8 b/udevstart.8 index 3e6c61f547..c64400cc4f 100644 --- a/udevstart.8 +++ b/udevstart.8 @@ -1,13 +1,13 @@ .TH UDEVSTART 8 "March 2004" "" "Linux Administrator's Manual" .SH NAME -udevstart \- populate device directory with all nodes available in sysfs +udevstart \- populate initial device directory .SH SYNOPSIS .B udevstart .SH "DESCRIPTION" .B udevstart walks trough the sysfs device tree and calls .B udev -to create the node for every valid device found. It can be used to fill a +to create the nodes for every valid device found. It can be used to fill a empty device directory with nodes for all devices currently available on the system. .SH "SEE ALSO" -- cgit v1.2.3-54-g00ecf From 3e16482d259c4a768b24a82bc0ed0e3a77954210 Mon Sep 17 00:00:00 2001 From: "ken@cgi101.com" Date: Tue, 9 Mar 2004 19:55:17 -0800 Subject: [PATCH] Added line to udev.permissions.redhat Added this line to have xterms provide a prompt. --- etc/udev/udev.permissions.redhat | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/udev.permissions.redhat b/etc/udev/udev.permissions.redhat index f73360e34c..c96663964f 100644 --- a/etc/udev/udev.permissions.redhat +++ b/etc/udev/udev.permissions.redhat @@ -9,6 +9,7 @@ vc/[0-9]*:root:tty:0660 # Set this to 0660 if you only want users belonging to tty group # to be able to allocate PTYs ptmx:root:tty:0666 +tty:root:tty:0666 pty[p-za-e][0-9a-f]*:root:tty:0660 tty[p-za-e][0-9a-f]*:root:tty:0660 pty/m*:root:tty:0660 -- cgit v1.2.3-54-g00ecf From e41016d3547ef704c0785ba197d36ef69de51260 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 10 Mar 2004 22:35:37 -0800 Subject: [PATCH] allow to specify node permissions in the rule This allows to set the permissions along with the rule. This is not a general replacement for the permissions config, but it may be easier sometimes for the user to specify the permissions along with the rule, cause the permissions config file wants the final node name to match, which seems sometimes a bit difficult to guess, if format % chars are used in the NAME field. Any value not given in the rule is still be read from the permissions file or set to the default. This one will also work: BUS="usb", KERNEL="video*", NAME="my-%k", OWNER="$local" A few words to man page are also added and add_perm_dev() is moved into namedev_parse.c where it belongs to. --- namedev.c | 58 ++++++++++++++++----------------------------------------- namedev.h | 15 ++++++++++++++- namedev_parse.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++------ udev.8 | 4 ++++ 4 files changed, 82 insertions(+), 49 deletions(-) diff --git a/namedev.c b/namedev.c index 23d46518ea..1e424998f6 100644 --- a/namedev.c +++ b/namedev.c @@ -46,6 +46,7 @@ static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *c LIST_HEAD(config_device_list); LIST_HEAD(perm_device_list); + /* compare string with pattern (supports * ? [0-9] [!A-Z]) */ static int strcmp_pattern(const char *p, const char *s) { @@ -99,39 +100,6 @@ static int strcmp_pattern(const char *p, const char *s) return 1; } -#define copy_var(a, b, var) \ - if (b->var) \ - a->var = b->var; - -#define copy_string(a, b, var) \ - if (strlen(b->var)) \ - strcpy(a->var, b->var); - -int add_perm_dev(struct perm_device *new_dev) -{ - struct perm_device *dev; - struct perm_device *tmp_dev; - - /* update the values if we already have the device */ - list_for_each_entry(dev, &perm_device_list, node) { - if (strcmp(new_dev->name, dev->name)) - continue; - copy_var(dev, new_dev, mode); - copy_string(dev, new_dev, owner); - copy_string(dev, new_dev, group); - return 0; - } - - /* not found, add new structure to the perm list */ - tmp_dev = malloc(sizeof(*tmp_dev)); - if (!tmp_dev) - return -ENOMEM; - memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); - list_add_tail(&tmp_dev->node, &perm_device_list); - //dump_perm_dev(tmp_dev); - return 0; -} - static struct perm_device *find_perm(char *name) { struct perm_device *perm; @@ -865,22 +833,28 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud goto done; found: - /* substitute placeholder */ apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); udev->partitions = dev->partitions; + done: + /* get permissions given in rule */ + set_empty_perms(udev, dev->mode, + dev->owner, + dev->group); + + /* get permissions given in config file or set defaults */ perm = find_perm(udev->name); - if (perm) { - udev->mode = perm->mode; - strfieldcpy(udev->owner, perm->owner); - strfieldcpy(udev->group, perm->group); + if (perm != NULL) { + set_empty_perms(udev, perm->mode, + perm->owner, + perm->group); } else { - /* no matching perms found :( */ - udev->mode = get_default_mode(); - strfieldcpy(udev->owner, get_default_owner()); - strfieldcpy(udev->group, get_default_group()); + set_empty_perms(udev, get_default_mode(), + get_default_owner(), + get_default_group()); } + dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", udev->name, udev->owner, udev->group, udev->mode); diff --git a/namedev.h b/namedev.h index 7f875ed603..16a8bffe97 100644 --- a/namedev.h +++ b/namedev.h @@ -44,6 +44,9 @@ struct sysfs_class_device; #define FIELD_KERNEL "KERNEL" #define FIELD_NAME "NAME" #define FIELD_SYMLINK "SYMLINK" +#define FIELD_OWNER "OWNER" +#define FIELD_GROUP "GROUP" +#define FIELD_MODE "MODE" #define ATTR_PARTITIONS "all_partitions" #define PARTITIONS_COUNT 15 @@ -54,6 +57,14 @@ struct sysfs_class_device; #define RULEFILE_EXT ".rules" #define PERMFILE_EXT ".permissions" +#define set_empty_perms(dev, m, o, g) \ + if (dev->mode == 0) \ + dev->mode = m; \ + if (dev->owner[0] == '\0') \ + strfieldcpy(dev->owner, o); \ + if (dev->group[0] == '\0') \ + strfieldcpy(dev->group, g); + struct sysfs_pair { char file[FILE_SIZE]; char value[VALUE_SIZE]; @@ -71,6 +82,9 @@ struct config_device { char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; + char owner[OWNER_SIZE]; + char group[GROUP_SIZE]; + unsigned int mode; int partitions; char config_file[NAME_SIZE]; int config_line; @@ -93,7 +107,6 @@ extern int namedev_name_device(struct sysfs_class_device *class_dev, struct udev extern int namedev_init_permissions(void); extern int namedev_init_rules(void); -extern int add_perm_dev(struct perm_device *new_dev); extern void dump_config_dev(struct config_device *dev); extern void dump_config_dev_list(void); extern void dump_perm_dev(struct perm_device *dev); diff --git a/namedev_parse.c b/namedev_parse.c index defb698b26..fba32a4983 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -43,6 +43,7 @@ LIST_HEAD(file_list); + static int add_config_dev(struct config_device *new_dev) { struct config_device *tmp_dev; @@ -61,9 +62,11 @@ void dump_config_dev(struct config_device *dev) dbg_parse("name='%s', symlink='%s', bus='%s', place='%s', id='%s', " "sysfs_file[0]='%s', sysfs_value[0]='%s', " "kernel='%s', program='%s', result='%s'", + "owner='%s', group='%s', mode=%#o", dev->name, dev->symlink, dev->bus, dev->place, dev->id, dev->sysfs_pair[0].file, dev->sysfs_pair[0].value, - dev->kernel, dev->program, dev->result); + dev->kernel, dev->program, dev->result,; + dev->owner, dev->group, dev->mode); } void dump_config_dev_list(void) @@ -74,6 +77,31 @@ void dump_config_dev_list(void) dump_config_dev(dev); } +static int add_perm_dev(struct perm_device *new_dev) +{ + struct perm_device *dev; + struct perm_device *tmp_dev; + + /* update the values if we already have the device */ + list_for_each_entry(dev, &perm_device_list, node) { + if (strcmp(new_dev->name, dev->name) != 0) + continue; + + set_empty_perms(dev, new_dev->mode, new_dev->owner, new_dev->group); + return 0; + } + + /* not found, add new structure to the perm list */ + tmp_dev = malloc(sizeof(*tmp_dev)); + if (!tmp_dev) + return -ENOMEM; + + memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); + list_add_tail(&tmp_dev->node, &perm_device_list); + //dump_perm_dev(tmp_dev); + return 0; +} + void dump_perm_dev(struct perm_device *dev) { dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", @@ -240,12 +268,26 @@ static int namedev_parse_rules(char *filename) continue; } + if (strcasecmp(temp2, FIELD_OWNER) == 0) { + strfieldcpy(dev.owner, temp3); + continue; + } + + if (strcasecmp(temp2, FIELD_GROUP) == 0) { + strfieldcpy(dev.group, temp3); + continue; + } + + if (strcasecmp(temp2, FIELD_MODE) == 0) { + dev.mode = strtol(temp3, NULL, 8); + continue; + } + dbg("unknown type of field '%s'", temp2); - dbg("You might be using a rules file in the old format, please fix."); goto error; } - /* simple plausibility check for given keys */ + /* simple plausibility checks for given keys */ if ((dev.sysfs_pair[0].file[0] == '\0') ^ (dev.sysfs_pair[0].value[0] == '\0')) { dbg("inconsistency in " FIELD_SYSFS " key"); @@ -336,14 +378,14 @@ static int namedev_parse_permissions(char *filename) strfieldcpy(dev.group, temp2); if (!temp) { - dbg("cannot parse line: %s", line); + dbg("cannot parse line '%s'", line); continue; } dev.mode = strtol(temp, NULL, 8); dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", - dev.name, dev.owner, dev.group, - dev.mode); + dev.name, dev.owner, dev.group, dev.mode); + retval = add_perm_dev(&dev); if (retval) { dbg("add_perm_dev returned with error %d", retval); diff --git a/udev.8 b/udev.8 index 8ebcf7bd99..d5d9549113 100644 --- a/udev.8 +++ b/udev.8 @@ -220,6 +220,10 @@ to the symlink list of the rule which will create the node. This makes it possible to specify additional symlinks in a possibly separate rules file, while the device nodes are maintained by the distribution provided rules file. +.TP +.B OWNER, GROUP, MODE +The permissions for this device. Every specified value overwrites the value +given in the permissions file. .P .RB "The " NAME " ," SYMLINK " and " PROGRAM fields support simple printf-like string substitution: -- cgit v1.2.3-54-g00ecf From 49f9acf3844aa5c004b5794e919bd54166e53227 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Mar 2004 22:38:58 -0800 Subject: [PATCH] deleted current extras/multipath directory --- extras/multipath/AUTHOR | 1 - extras/multipath/COPYING | 483 --------- extras/multipath/ChangeLog | 126 --- extras/multipath/Makefile | 80 -- extras/multipath/README | 90 -- extras/multipath/VERSION | 1 - extras/multipath/devinfo.c | 204 ---- extras/multipath/devinfo.h | 19 - extras/multipath/devmap_name.8 | 30 - extras/multipath/devmap_name.c | 60 -- extras/multipath/libdevmapper/Makefile | 22 - extras/multipath/libdevmapper/ioctl/libdevmapper.c | 1092 -------------------- extras/multipath/libdevmapper/ioctl/libdm-compat.h | 111 -- .../multipath/libdevmapper/ioctl/libdm-targets.h | 51 - extras/multipath/libdevmapper/libdevmapper.h | 147 --- extras/multipath/libdevmapper/libdm-common.c | 382 ------- extras/multipath/libdevmapper/libdm-common.h | 38 - extras/multipath/libdevmapper/list.h | 99 -- extras/multipath/main.c | 705 ------------- extras/multipath/main.h | 124 --- extras/multipath/multipath.8 | 53 - extras/multipath/multipath.hotplug | 7 - extras/multipath/sg_err.h | 162 --- extras/multipath/sg_include.h | 43 - extras/multipath/unused.c | 95 -- 25 files changed, 4225 deletions(-) delete mode 100644 extras/multipath/AUTHOR delete mode 100644 extras/multipath/COPYING delete mode 100644 extras/multipath/ChangeLog delete mode 100644 extras/multipath/Makefile delete mode 100644 extras/multipath/README delete mode 100644 extras/multipath/VERSION delete mode 100644 extras/multipath/devinfo.c delete mode 100644 extras/multipath/devinfo.h delete mode 100644 extras/multipath/devmap_name.8 delete mode 100644 extras/multipath/devmap_name.c delete mode 100644 extras/multipath/libdevmapper/Makefile delete mode 100644 extras/multipath/libdevmapper/ioctl/libdevmapper.c delete mode 100644 extras/multipath/libdevmapper/ioctl/libdm-compat.h delete mode 100644 extras/multipath/libdevmapper/ioctl/libdm-targets.h delete mode 100644 extras/multipath/libdevmapper/libdevmapper.h delete mode 100644 extras/multipath/libdevmapper/libdm-common.c delete mode 100644 extras/multipath/libdevmapper/libdm-common.h delete mode 100644 extras/multipath/libdevmapper/list.h delete mode 100644 extras/multipath/main.c delete mode 100644 extras/multipath/main.h delete mode 100644 extras/multipath/multipath.8 delete mode 100644 extras/multipath/multipath.hotplug delete mode 100644 extras/multipath/sg_err.h delete mode 100644 extras/multipath/sg_include.h delete mode 100644 extras/multipath/unused.c diff --git a/extras/multipath/AUTHOR b/extras/multipath/AUTHOR deleted file mode 100644 index 4e8eeef5c8..0000000000 --- a/extras/multipath/AUTHOR +++ /dev/null @@ -1 +0,0 @@ -Christophe Varoqui, diff --git a/extras/multipath/COPYING b/extras/multipath/COPYING deleted file mode 100644 index 9e31bbf0b3..0000000000 --- a/extras/multipath/COPYING +++ /dev/null @@ -1,483 +0,0 @@ - - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/extras/multipath/ChangeLog b/extras/multipath/ChangeLog deleted file mode 100644 index a2863ec23e..0000000000 --- a/extras/multipath/ChangeLog +++ /dev/null @@ -1,126 +0,0 @@ -2004-02-21 multipath-018 - * From the Debian SID inclusion review (Philipp Matthias Hahn) - * use DESTDIR install prefix in the Makefile - * add man pages for devmap_name & multipath - * correct libsysfs.h includes - * fork the hotplug script in its own shell - * Sync with the kernel device mapper code as of 2.6.3-udm3 - ie. Remove the test interval parameter and its uses - * Remove superfluous scsi parameter passed from hotplug - * Add the man pages to the [un]install targets -2004-02-17 multipath-017 - * remove the restrictive -f flag. - Introduce a more generic "-m iopolicy" one. - * remove useless "int with_sysfs" in env struct -2004-02-04 multipath-016 - * add a GROUP_BY_SERIAL flag. This should be useful for - controlers that activate they spare paths on simple IO - submition with a penalty. The StorageWorks HW defaults to - this mode, even if the MULTIBUS mode is OK. - * remove unused sg_err.c - * big restructuring : split devinfo.c from main.c. Export : - * void basename (char *, char *); - * int get_serial (int, char *); - * int get_lun_strings (char *, char *, char *, char *); - * int get_evpd_wwid(char *, char *); - * long get_disk_size (char *); - * stop passing struct env as param - * add devmap_name proggy for udev to name devmaps as per their - internal DM name and not only by their sysfs enum name (dm-*) - The corresponding udev.rules line is : - KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" - * remove make_dm_node fn & call. Rely on udev for this. - * don't rely on the linux symlink in the udev/klibc dir since - udev build doesn't use it anymore. This corrects build breakage -2004-01-19 multipath-013 - * update the DM target synthax to the 2.6.0-udm5 style -2003-12-29 multipath-012 - * check hotplug event refers to a block device; if not exit early - * refresh doc - * add the uninstall target in Makefile -2003-12-22 multipath-010 - * tweak the install target in Makefile - * stop passing fds as argument : this change enable a strict - segregation of ugly 2.4 code - * sysfs version of get_lun_strings() - * be careful about the return of get_unique_id() since errors - formerly caught up by if(open()) in the caller fn are now returned - by get_unique_id() - * send get_serial() in unused.c - * introduce dm-simplecmd for RESUME & SUSPEND requests - * split add_map() in setup_map() & dm-addmap() - * setup_map() correctly submits "SUSPEND-RELOAD-RESUME or CREATE" - sequences instead of the bogus "RELOAD or CREATE" - * don't print .sg_dev if equal to .dev (2.6) in print_path() - * since the kernel code handles defective paths, remove all - code to cope with them : - * move do_tur() to unused.c - * remove .state from path struct - * remove .state settings & conditionals - * add a cmdline switch to force maps to failover mode, - ie 1 path per priority group - * add default policies to the whitelist array (spread io == - MULTIBUS / io forced to 1 path == FAILOVER) - * move get_disk_size() call out of add_map() to coalesce() - * comment tricky coalesce() fn - * bogus unsused.c file renamed to unused.c -2003-12-20 multipath-010 - * big ChangeLog update - * start to give a little control over target params : - introduce cmdline arg -i to control polling interval - * cope with hotplug-style calling convention : - ie "multipath scsi $DEVPATH" ... to avoid messing with - online maps not concerned by an event - * example hotplug agent to drop in /etc/hotplug.d/scsi - * revert the run & resched patch : unless someone proves me - wrong, this was overdesigned - * move commented out functions in unused.c - * update multipath target params to "udm[23] style" - * mp target now supports nr_path == 1, so do we - * add gratuitous free() - * push version forward -2003-12-15 multipath-009 - * Make the HW-specific get_unique_id switch pretty - * Prepare to field-test by whitelisting all known fibre array, - try to fetch WWID from the standard EVPD 0x83 off 8 for everyone - * configure the multipath target with round-robin path selector and - conservative default for a start (udm1 style) : - yes it makes this release the firstreally useful one. - * temporarily disable map creation for single path device - due to current restrictive defaults in the kernel target. - Sistina should work it out. - * correct the strncmp logic in blacklist function. - * update the Makefiles to autodetect libgcc.a & gcc includes - "ulibc-style". Factorisation of udevdirs & others niceties - * drop a hint about absent /dev/sd? on failed open() - * implement a reschedule flag in /var/run. - Last thing the prog do before exit is check if a call to multipath - was done (but canceled by /var/run/multipath.run check) during its - execution. If so restart themain loop. - * implement a blacklist of sysfs bdev to not bother with for now - (hd,md, dm, sr, scd, ram, raw). - This avoid sending SG_IO to unappropiate devices. - * Adds a /var/run/multipath.run handling to avoid simultaneous runs. - * Remove a commented-out "printf" - * drop a libdevmapper copy in extras/multipath; - maybe discussions w/Sistina folks will bring a better solution in the future. - * drop a putchar usage in libdevmapper to compile cleanly with klibc - * drop another such usage of my own in main.c - * massage the Makefile to compile libdevmapper against klibc - * use "ld" to produce the binary rather than "gcc -static" - * stop being stupid w/ uneeded major, minor & dev in main.c:dm_mk_node() - * reverse to creating striped target for now because the multipath target - is more hairy than expected initialy - * push the version code to 009 to be in synch w/ udev -2003-11-27 multipath-007 - * removes sg_err.[ch] deps - * makes sure the core code play nice with klibc - * port the sysfs calls to dlist helpers - * links against udev's sysfs (need libsysfs.a & dlist.a) - * finally define DM_TARGET as "multipath" as Joe posted the code today (not tested yet) - * push version forward (do you want it in sync with udev version?) -2003-11-19 - * merged in udev-006 tree -2003-09-18 Christophe Varoqui - * multipath 0.0.1 released. - * Initial release. diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile deleted file mode 100644 index ee7f60e472..0000000000 --- a/extras/multipath/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -# Makefile -# -# Copyright (C) 2003 Christophe Varoqui, - -EXEC = multipath - -prefix = -exec_prefix = ${prefix} -bindir = ${exec_prefix}/sbin -udevdir = ../.. -klibcdir = $(udevdir)/klibc -sysfsdir = $(udevdir)/libsysfs -mandir = /usr/share/man/man8 - -CC = gcc -GZIP = /bin/gzip -c - -GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} -KERNEL_DIR = /lib/modules/${shell uname -r}/build -CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ - -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ - -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I$(sysfsdir) -I. - -OBJS = devinfo.o main.o -CRT0 = ../../klibc/klibc/crt0.o -LIB = ../../klibc/klibc/libc.a -LIBGCC := $(shell $(CC) -print-libgcc-file-name ) - -DMOBJS = libdevmapper/libdm-common.o libdevmapper/ioctl/libdevmapper.o -SYSFSOBJS = ../../libsysfs/dlist.o ../../libsysfs/sysfs_bus.o \ - ../../libsysfs/sysfs_class.o ../../libsysfs/sysfs_device.o \ - ../../libsysfs/sysfs_dir.o ../../libsysfs/sysfs_driver.o \ - ../../libsysfs/sysfs_utils.o - -SUBDIRS = libdevmapper - -recurse: - @for dir in $(SUBDIRS); do\ - $(MAKE) KERNEL_DIR=$(KERNEL_DIR) -C $$dir ; \ - done - $(MAKE) $(EXEC) - $(MAKE) devmap_name - -all: recurse - @echo "" - @echo "Make complete" - -$(EXEC): $(OBJS) - $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC) - strip $(EXEC) - $(GZIP) $(EXEC).8 > $(EXEC).8.gz - -devmap_name: devmap_name.o - $(LD) -o devmap_name $(CRT0) devmap_name.o $(DMOBJS) $(LIB) $(LIBGCC) - strip devmap_name - $(GZIP) devmap_name.8 > devmap_name.8.gz - -clean: - rm -f core *.o $(EXEC) devmap_name *.gz - $(MAKE) -C libdevmapper clean - -install: - install -d $(DESTDIR)$(bindir) - install -m 755 $(EXEC) $(DESTDIR)$(bindir)/ - install -m 755 devmap_name $(DESTDIR)$(bindir)/ - install -d $(DESTDIR)/etc/hotplug.d/scsi/ - install -m 755 multipath.hotplug $(DESTDIR)/etc/hotplug.d/scsi/ - install -d $(DESTDIR)$(mandir) - install -m 644 devmap_name.8.gz $(DESTDIR)$(mandir) - install -m 644 multipath.8.gz $(DESTDIR)$(mandir) - -uninstall: - rm $(DESTDIR)/etc/hotplug.d/scsi/multipath.hotplug - rm $(DESTDIR)$(bindir)/$(EXEC) - rm $(DESTDIR)$(bindir)/devmap_name - rm $(DESTDIR)$(mandir)/devmap_name.8.gz - rm $(DESTDIR)$(mandir)/multipath.8.gz - -# Code dependencies -main.o: main.c main.h sg_include.h devinfo.h diff --git a/extras/multipath/README b/extras/multipath/README deleted file mode 100644 index 80945db438..0000000000 --- a/extras/multipath/README +++ /dev/null @@ -1,90 +0,0 @@ -Dependancies : -============== - -o libdevmapper : comes with device-mapper-XXXX.tar.gz - See www.sistina.com - This lib has been dropped in the multipath tree -o libsysfs : comes with sysutils or udev - See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ -o Linux kernel 2.6.0 with udm5 patchset - http://people.sistina.com/~thornber/dm/ -o udev - See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ - -How it works : -============== - -Fill the all_paths array. Each path store this info : - -struct path { - char dev[FILE_NAME_SIZE]; - char sg_dev[FILE_NAME_SIZE]; - struct scsi_idlun scsi_id; - struct sg_id sg_id; - int state; - char wwid[WWID_SIZE]; -}; - -scsi_id, sg_dev and sg_id are only really useful for 2.4 -kernels, for which SG cmnds must go through sg devs. -In 2.5+ we have the nice opportunity to send SG cmnds -through SCSI bdevs. - -For 2.4 compat, we pivot on idlun tupple to map sg devs -to SCSI bdevs. - -2.4 does not do device enumeration, so we must scan a -defined number of sg devs and scsi bdevs. Good enough. -In 2.5+, we rely on libsysfs (sysutils) to access to -sysfs device enums. - -the wwid is retrieved by a switch fonction. Only White -Listed HW can filled this field. For now every FC array -HW listed in kernel's devinfo.c is White Listed, assuming -the WWID is stored is the SCSI-3 standard 0x83 EVPD page. - -When all_paths is filled, we coalesce the paths and store -the result in mp array. Each mp is a struct like this : - -struct multipath { - char wwid[WWID_SIZE]; - int npaths; - int pindex[MAX_MP_PATHS]; -}; - -When mp is filled, the device maps are fed to the kernel -through libdevmapper. - -The naming of the corresponding block device is handeld -by udev with the help of the devmap_name proggy. It is -called by the following rule in /etc/udev/udev.rules : -KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \ -NAME="%k", SYMLINK="%c" - -Notes : -======= - -o On 2.4, make sure you have enough /dev/sg* nodes - (/dev/MAKEDEV if necesary). Same goes for /dev/sd* - -o path coalescing relies on a path unique id being found. - This unique id, lacking a standard method, is vendor - specific. A switch function (get_unique_id) is present - and an example function is provided for storageworks - arrays (get_evpd_wwid). Feel free to enrich - with hardware you have at hand :) - -o The kernel does NOT manage properly ghosts paths - with StorageWorks HW. Seems nobody cares after a load - of posts to linux-scsi. - -o 2.4.21 version of DM does not like even segment size. - if you enconter pbs with this, upgrade DM. - -Credits : -========= - -o Heavy cut'n paste from sg_utils. Thanks goes to D. - Gilbert. -o Light cut'n paste from dmsetup. Thanks Joe Thornber. -o Greg KH for the nice sysfs API. diff --git a/extras/multipath/VERSION b/extras/multipath/VERSION deleted file mode 100644 index bbdeab6222..0000000000 --- a/extras/multipath/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.0.5 diff --git a/extras/multipath/devinfo.c b/extras/multipath/devinfo.c deleted file mode 100644 index 323da2f2f0..0000000000 --- a/extras/multipath/devinfo.c +++ /dev/null @@ -1,204 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "devinfo.h" -#include "sg_include.h" - -#define FILE_NAME_SIZE 255 - -void -basename(char * str1, char * str2) -{ - char *p = str1 + (strlen(str1) - 1); - - while (*--p != '/') - continue; - strcpy(str2, ++p); -} - -static int -do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, - void *resp, int mx_resp_len, int noisy) -{ - unsigned char inqCmdBlk[INQUIRY_CMDLEN] = - { INQUIRY_CMD, 0, 0, 0, 0, 0 }; - unsigned char sense_b[SENSE_BUFF_LEN]; - struct sg_io_hdr io_hdr; - - if (cmddt) - inqCmdBlk[1] |= 2; - if (evpd) - inqCmdBlk[1] |= 1; - inqCmdBlk[2] = (unsigned char) pg_op; - inqCmdBlk[4] = (unsigned char) mx_resp_len; - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof (inqCmdBlk); - io_hdr.mx_sb_len = sizeof (sense_b); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.dxfer_len = mx_resp_len; - io_hdr.dxferp = resp; - io_hdr.cmdp = inqCmdBlk; - io_hdr.sbp = sense_b; - io_hdr.timeout = DEF_TIMEOUT; - - if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) { - perror("SG_IO (inquiry) error"); - return -1; - } - - /* treat SG_ERR here to get rid of sg_err.[ch] */ - io_hdr.status &= 0x7e; - if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && - (0 == io_hdr.driver_status)) - return 0; - if ((SCSI_CHECK_CONDITION == io_hdr.status) || - (SCSI_COMMAND_TERMINATED == io_hdr.status) || - (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) { - if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) { - int sense_key; - unsigned char * sense_buffer = io_hdr.sbp; - if (sense_buffer[0] & 0x2) - sense_key = sense_buffer[1] & 0xf; - else - sense_key = sense_buffer[2] & 0xf; - if(RECOVERED_ERROR == sense_key) - return 0; - } - } - return -1; -} - -int -get_serial (char * str, char * devname) -{ - int fd; - int len; - char buff[MX_ALLOC_LEN + 1]; - - if ((fd = open(devname, O_RDONLY)) < 0) - return 0; - - if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { - len = buff[3]; - if (len > 0) { - memcpy(str, buff + 4, len); - buff[len] = '\0'; - } - close(fd); - return 1; - } - close(fd); - return 0; -} - -int -get_lun_strings(char * vendor_id, char * product_id, char * rev, char * devname) -{ - int fd; - char buff[36]; - char attr_path[FILE_NAME_SIZE]; - char sysfs_path[FILE_NAME_SIZE]; - char basedev[FILE_NAME_SIZE]; - - if (0 == sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { - /* sysfs style */ - basename(devname, basedev); - - sprintf(attr_path, "%s/block/%s/device/vendor", - sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, - vendor_id, 8)) return 0; - - sprintf(attr_path, "%s/block/%s/device/model", - sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, - product_id, 16)) return 0; - - sprintf(attr_path, "%s/block/%s/device/rev", - sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, - rev, 4)) return 0; - } else { - /* ioctl style */ - if ((fd = open(devname, O_RDONLY)) < 0) - return 0; - if (0 != do_inq(fd, 0, 0, 0, buff, 36, 1)) - return 0; - memcpy(vendor_id, &buff[8], 8); - memcpy(product_id, &buff[16], 16); - memcpy(rev, &buff[32], 4); - close(fd); - return 1; - } - return 0; -} - -static void -sprint_wwid(char * buff, const char * str) -{ - int i; - const char *p; - char *cursor; - unsigned char c; - - p = str; - cursor = buff; - for (i = 0; i <= WWID_SIZE / 2 - 1; i++) { - c = *p++; - sprintf(cursor, "%.2x", (int) (unsigned char) c); - cursor += 2; - } - buff[WWID_SIZE - 1] = '\0'; -} - -/* get EVPD page 0x83 off 8 */ -/* tested ok with StorageWorks */ -int -get_evpd_wwid(char * devname, char * wwid) -{ - int fd; - char buff[64]; - - if ((fd = open(devname, O_RDONLY)) < 0) - return 0; - - if (0 == do_inq(fd, 0, 1, 0x83, buff, sizeof (buff), 1)) { - sprint_wwid(wwid, &buff[8]); - close(fd); - return 1; /* success */ - } - close(fd); - return 0; /* not good */ -} - -long -get_disk_size (char * devname) { - long size; - int fd; - char attr_path[FILE_NAME_SIZE]; - char sysfs_path[FILE_NAME_SIZE]; - char buff[FILE_NAME_SIZE]; - char basedev[FILE_NAME_SIZE]; - - if (0 == sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { - basename(devname, basedev); - sprintf(attr_path, "%s/block/%s/size", - sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, buff, - FILE_NAME_SIZE * sizeof(char))) - return -1; - size = atoi(buff); - return size; - } else { - if ((fd = open(devname, O_RDONLY)) < 0) - return -1; - if(!ioctl(fd, BLKGETSIZE, &size)) - return size; - } - return -1; -} - diff --git a/extras/multipath/devinfo.h b/extras/multipath/devinfo.h deleted file mode 100644 index 53f2473027..0000000000 --- a/extras/multipath/devinfo.h +++ /dev/null @@ -1,19 +0,0 @@ -#define INQUIRY_CMDLEN 6 -#define INQUIRY_CMD 0x12 -#define SENSE_BUFF_LEN 32 -#define DEF_TIMEOUT 60000 -#define RECOVERED_ERROR 0x01 -#define MX_ALLOC_LEN 255 -#define WWID_SIZE 33 -#define BLKGETSIZE _IO(0x12,96) - -/* exerpt from "sg_err.h" */ -#define SCSI_CHECK_CONDITION 0x2 -#define SCSI_COMMAND_TERMINATED 0x22 -#define SG_ERR_DRIVER_SENSE 0x08 - -void basename (char *, char *); -int get_serial (char *, char *); -int get_lun_strings (char *, char *, char *, char *); -int get_evpd_wwid(char *, char *); -long get_disk_size (char *); diff --git a/extras/multipath/devmap_name.8 b/extras/multipath/devmap_name.8 deleted file mode 100644 index f4f03c3ec6..0000000000 --- a/extras/multipath/devmap_name.8 +++ /dev/null @@ -1,30 +0,0 @@ -.TH DEVMAP_NAME 8 "February 2004" "" "Linux Administrator's Manual" -.SH NAME -devmap_name \- Query device-mapper name -.SH SYNOPSIS -.BI devmap_name " major minor" -.SH DESCRIPTION -.B devmap_name -queries the device-mapper for the name for the device -specified by -.I major -and -.I minor -number. -.br -.B devmap_name -can be called from -.B udev -by the following rule in -.IR /etc/udev/udev.rules : -.sp -.nf -KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \\ - NAME="%k", SYMLINK="%c" -.fi -.SH "SEE ALSO" -.BR udev (8), -.BR dmsetup (8) -.SH AUTHORS -.B devmap_name -was developed by Christophe Varoqui, and others. diff --git a/extras/multipath/devmap_name.c b/extras/multipath/devmap_name.c deleted file mode 100644 index 08e526e072..0000000000 --- a/extras/multipath/devmap_name.c +++ /dev/null @@ -1,60 +0,0 @@ -#include "libdevmapper/libdevmapper.h" - -#include -#include -#include -#include - -static void usage(char * progname) { - fprintf(stderr, "usage : %s major minor\n", progname); - exit(1); -} - -int main(int argc, char **argv) -{ - int r = 0; - struct dm_names *names; - unsigned next = 0; - int major, minor; - - /* sanity check */ - if (argc != 3) - usage(argv[0]); - - major = atoi(argv[1]); - minor = atoi(argv[2]); - - struct dm_task *dmt; - - if (!(dmt = dm_task_create(DM_DEVICE_LIST))) - return 0; - - if (!dm_task_run(dmt)) - goto out; - - if (!(names = dm_task_get_names(dmt))) - goto out; - - if (!names->dev) { - printf("No devices found\n"); - goto out; - } - - do { - names = (void *) names + next; - if ((int) MAJOR(names->dev) == major && - (int) MINOR(names->dev) == minor) { - printf("%s\n", names->name); - goto out; - } - next = names->next; - } while (next); - - /* No correspondance found */ - r = 1; - - out: - dm_task_destroy(dmt); - return r; -} - diff --git a/extras/multipath/libdevmapper/Makefile b/extras/multipath/libdevmapper/Makefile deleted file mode 100644 index a05a31e85a..0000000000 --- a/extras/multipath/libdevmapper/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# Makefile -# -# Copyright (C) 2003 Christophe Varoqui, - -CC = gcc -udevdir = ../../.. -klibcdir = $(udevdir)/klibc - -CC = gcc -GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} -CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ - -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ - -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I. -Iioctl - -OBJS = ioctl/libdevmapper.o libdm-common.o - -all: $(OBJS) - @echo "" - @echo "Make complete" - -clean: - rm -f core *.o ioctl/*.o ioctl/*.so diff --git a/extras/multipath/libdevmapper/ioctl/libdevmapper.c b/extras/multipath/libdevmapper/ioctl/libdevmapper.c deleted file mode 100644 index ac7ba0c86a..0000000000 --- a/extras/multipath/libdevmapper/ioctl/libdevmapper.c +++ /dev/null @@ -1,1092 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#include "libdm-targets.h" -#include "libdm-common.h" - -#ifdef DM_COMPAT -# include "libdm-compat.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef linux -# include -# include -# include -#else -# define MAJOR(x) major((x)) -# define MINOR(x) minor((x)) -# define MKDEV(x,y) makedev((x),(y)) -#endif - -/* - * Ensure build compatibility. - * The hard-coded versions here are the highest present - * in the _cmd_data arrays. - */ - -#if !((DM_VERSION_MAJOR == 1 && DM_VERSION_MINOR >= 0) || \ - (DM_VERSION_MAJOR == 4 && DM_VERSION_MINOR >= 0)) -#error The version of dm-ioctl.h included is incompatible. -#endif - -/* dm major version no for running kernel */ -static int _dm_version = DM_VERSION_MAJOR; -static int _log_suppress = 0; - -static int _control_fd = -1; -static int _version_checked = 0; -static int _version_ok = 1; - -/* - * Support both old and new major numbers to ease the transition. - * Clumsy, but only temporary. - */ -#if DM_VERSION_MAJOR == 4 && defined(DM_COMPAT) -const int _dm_compat = 1; -#else -const int _dm_compat = 0; -#endif - - -/* *INDENT-OFF* */ -static struct cmd_data _cmd_data_v4[] = { - {"create", DM_DEV_CREATE, {4, 0, 0}}, - {"reload", DM_TABLE_LOAD, {4, 0, 0}}, - {"remove", DM_DEV_REMOVE, {4, 0, 0}}, - {"remove_all", DM_REMOVE_ALL, {4, 0, 0}}, - {"suspend", DM_DEV_SUSPEND, {4, 0, 0}}, - {"resume", DM_DEV_SUSPEND, {4, 0, 0}}, - {"info", DM_DEV_STATUS, {4, 0, 0}}, - {"deps", DM_TABLE_DEPS, {4, 0, 0}}, - {"rename", DM_DEV_RENAME, {4, 0, 0}}, - {"version", DM_VERSION, {4, 0, 0}}, - {"status", DM_TABLE_STATUS, {4, 0, 0}}, - {"table", DM_TABLE_STATUS, {4, 0, 0}}, - {"waitevent", DM_DEV_WAIT, {4, 0, 0}}, - {"names", DM_LIST_DEVICES, {4, 0, 0}}, - {"clear", DM_TABLE_CLEAR, {4, 0, 0}}, - {"mknodes", DM_DEV_STATUS, {4, 0, 0}}, -}; -/* *INDENT-ON* */ - -#define ALIGNMENT_V1 sizeof(int) -#define ALIGNMENT 8 - -/* FIXME Rejig library to record & use errno instead */ -#ifndef DM_EXISTS_FLAG -# define DM_EXISTS_FLAG 0x00000004 -#endif - -static void *_align(void *ptr, unsigned int a) -{ - register unsigned long agn = --a; - - return (void *) (((unsigned long) ptr + agn) & ~agn); -} - -static int _open_control(void) -{ - char control[PATH_MAX]; - - if (_control_fd != -1) - return 1; - - snprintf(control, sizeof(control), "%s/control", dm_dir()); - - if ((_control_fd = open(control, O_RDWR)) < 0) { - log_error("%s: open failed: %s", control, strerror(errno)); - log_error("Is device-mapper driver missing from kernel?"); - return 0; - } - - return 1; -} - -void dm_task_destroy(struct dm_task *dmt) -{ - struct target *t, *n; - - for (t = dmt->head; t; t = n) { - n = t->next; - free(t->params); - free(t->type); - free(t); - } - - if (dmt->dev_name) - free(dmt->dev_name); - - if (dmt->newname) - free(dmt->newname); - - if (dmt->dmi.v4) - free(dmt->dmi.v4); - - if (dmt->uuid) - free(dmt->uuid); - - free(dmt); -} - -/* - * Protocol Version 1 compatibility functions. - */ - -#ifdef DM_COMPAT - -static int _dm_task_get_driver_version_v1(struct dm_task *dmt, char *version, - size_t size) -{ - unsigned int *v; - - if (!dmt->dmi.v1) { - version[0] = '\0'; - return 0; - } - - v = dmt->dmi.v1->version; - snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]); - return 1; -} - -/* Unmarshall the target info returned from a status call */ -static int _unmarshal_status_v1(struct dm_task *dmt, struct dm_ioctl_v1 *dmi) -{ - char *outbuf = (char *) dmi + dmi->data_start; - char *outptr = outbuf; - int32_t i; - struct dm_target_spec_v1 *spec; - - for (i = 0; i < dmi->target_count; i++) { - spec = (struct dm_target_spec_v1 *) outptr; - - if (!dm_task_add_target(dmt, spec->sector_start, - (uint64_t) spec->length, - spec->target_type, - outptr + sizeof(*spec))) - return 0; - - outptr = outbuf + spec->next; - } - - return 1; -} - -static int _dm_format_dev_v1(char *buf, int bufsize, uint32_t dev_major, - uint32_t dev_minor) -{ - int r; - - if (bufsize < 8) - return 0; - - r = snprintf(buf, bufsize, "%03x:%03x", dev_major, dev_minor); - if (r < 0 || r > bufsize - 1) - return 0; - - return 1; -} - -static int _dm_task_get_info_v1(struct dm_task *dmt, struct dm_info *info) -{ - if (!dmt->dmi.v1) - return 0; - - memset(info, 0, sizeof(*info)); - - info->exists = dmt->dmi.v1->flags & DM_EXISTS_FLAG ? 1 : 0; - if (!info->exists) - return 1; - - info->suspended = dmt->dmi.v1->flags & DM_SUSPEND_FLAG ? 1 : 0; - info->read_only = dmt->dmi.v1->flags & DM_READONLY_FLAG ? 1 : 0; - info->target_count = dmt->dmi.v1->target_count; - info->open_count = dmt->dmi.v1->open_count; - info->event_nr = 0; - info->major = MAJOR(dmt->dmi.v1->dev); - info->minor = MINOR(dmt->dmi.v1->dev); - info->live_table = 1; - info->inactive_table = 0; - - return 1; -} - -static const char *_dm_task_get_name_v1(struct dm_task *dmt) -{ - return (dmt->dmi.v1->name); -} - -static const char *_dm_task_get_uuid_v1(struct dm_task *dmt) -{ - return (dmt->dmi.v1->uuid); -} - -static struct dm_deps *_dm_task_get_deps_v1(struct dm_task *dmt) -{ - log_error("deps version 1 no longer supported by libdevmapper"); - return NULL; -} - -static struct dm_names *_dm_task_get_names_v1(struct dm_task *dmt) -{ - return (struct dm_names *) (((void *) dmt->dmi.v1) + - dmt->dmi.v1->data_start); -} - -static void *_add_target_v1(struct target *t, void *out, void *end) -{ - void *out_sp = out; - struct dm_target_spec_v1 sp; - size_t sp_size = sizeof(struct dm_target_spec_v1); - int len; - const char no_space[] = "Ran out of memory building ioctl parameter"; - - out += sp_size; - if (out >= end) { - log_error(no_space); - return NULL; - } - - sp.status = 0; - sp.sector_start = t->start; - sp.length = t->length; - strncpy(sp.target_type, t->type, sizeof(sp.target_type)); - - len = strlen(t->params); - - if ((out + len + 1) >= end) { - log_error(no_space); - - log_error("t->params= '%s'", t->params); - return NULL; - } - strcpy((char *) out, t->params); - out += len + 1; - - /* align next block */ - out = _align(out, ALIGNMENT_V1); - - sp.next = out - out_sp; - - memcpy(out_sp, &sp, sp_size); - - return out; -} - -static struct dm_ioctl_v1 *_flatten_v1(struct dm_task *dmt) -{ - const size_t min_size = 16 * 1024; - const int (*version)[3]; - - struct dm_ioctl_v1 *dmi; - struct target *t; - size_t len = sizeof(struct dm_ioctl_v1); - void *b, *e; - int count = 0; - - for (t = dmt->head; t; t = t->next) { - len += sizeof(struct dm_target_spec_v1); - len += strlen(t->params) + 1 + ALIGNMENT_V1; - count++; - } - - if (count && dmt->newname) { - log_error("targets and newname are incompatible"); - return NULL; - } - - if (dmt->newname) - len += strlen(dmt->newname) + 1; - - /* - * Give len a minimum size so that we have space to store - * dependencies or status information. - */ - if (len < min_size) - len = min_size; - - if (!(dmi = malloc(len))) - return NULL; - - memset(dmi, 0, len); - - version = &_cmd_data_v1[dmt->type].version; - - dmi->version[0] = (*version)[0]; - dmi->version[1] = (*version)[1]; - dmi->version[2] = (*version)[2]; - - dmi->data_size = len; - dmi->data_start = sizeof(struct dm_ioctl_v1); - - if (dmt->dev_name) - strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); - - if (dmt->type == DM_DEVICE_SUSPEND) - dmi->flags |= DM_SUSPEND_FLAG; - if (dmt->read_only) - dmi->flags |= DM_READONLY_FLAG; - - if (dmt->minor >= 0) { - if (dmt->major <= 0) { - log_error("Missing major number for persistent device"); - return NULL; - } - dmi->flags |= DM_PERSISTENT_DEV_FLAG; - dmi->dev = MKDEV(dmt->major, dmt->minor); - } - - if (dmt->uuid) - strncpy(dmi->uuid, dmt->uuid, sizeof(dmi->uuid)); - - dmi->target_count = count; - - b = (void *) (dmi + 1); - e = (void *) ((char *) dmi + len); - - for (t = dmt->head; t; t = t->next) - if (!(b = _add_target_v1(t, b, e))) - goto bad; - - if (dmt->newname) - strcpy(b, dmt->newname); - - return dmi; - - bad: - free(dmi); - return NULL; -} - -static int _dm_names_v1(struct dm_ioctl_v1 *dmi) -{ - const char *dev_dir = dm_dir(); - int r = 1, len; - const char *name; - struct dirent *dirent; - DIR *d; - struct dm_names *names, *old_names = NULL; - void *end = (void *) dmi + dmi->data_size; - struct stat buf; - char path[PATH_MAX]; - - if (!(d = opendir(dev_dir))) { - log_error("%s: opendir failed: %s", dev_dir, strerror(errno)); - return 0; - } - - names = (struct dm_names *) ((void *) dmi + dmi->data_start); - - names->dev = 0; /* Flags no data */ - - while ((dirent = readdir(d))) { - name = dirent->d_name; - - if (name[0] == '.' || !strcmp(name, "control")) - continue; - - if (old_names) - old_names->next = (uint32_t) ((void *) names - - (void *) old_names); - snprintf(path, sizeof(path), "%s/%s", dev_dir, name); - if (stat(path, &buf)) { - log_error("%s: stat failed: %s", path, strerror(errno)); - continue; - } - if (!S_ISBLK(buf.st_mode)) - continue; - names->dev = (uint64_t) buf.st_rdev; - names->next = 0; - len = strlen(name); - if (((void *) (names + 1) + len + 1) >= end) { - log_error("Insufficient buffer space for device list"); - r = 0; - break; - } - - strcpy(names->name, name); - - old_names = names; - names = _align((void *) ++names + len + 1, ALIGNMENT); - } - - if (closedir(d)) - log_error("%s: closedir failed: %s", dev_dir, strerror(errno)); - - return r; -} - -static int _dm_task_run_v1(struct dm_task *dmt) -{ - struct dm_ioctl_v1 *dmi; - unsigned int command; - - dmi = _flatten_v1(dmt); - if (!dmi) { - log_error("Couldn't create ioctl argument"); - return 0; - } - - if (!_open_control()) - return 0; - - if ((unsigned) dmt->type >= - (sizeof(_cmd_data_v1) / sizeof(*_cmd_data_v1))) { - log_error("Internal error: unknown device-mapper task %d", - dmt->type); - goto bad; - } - - command = _cmd_data_v1[dmt->type].cmd; - - if (dmt->type == DM_DEVICE_TABLE) - dmi->flags |= DM_STATUS_TABLE_FLAG; - - log_debug("dm %s %s %s %s", _cmd_data_v1[dmt->type].name, dmi->name, - dmi->uuid, dmt->newname ? dmt->newname : ""); - if (dmt->type == DM_DEVICE_LIST) { - if (!_dm_names_v1(dmi)) - goto bad; - } else if (ioctl(_control_fd, command, dmi) < 0) { - if (_log_suppress) - log_verbose("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); - else - log_error("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); - goto bad; - } - - switch (dmt->type) { - case DM_DEVICE_CREATE: - add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev)); - break; - - case DM_DEVICE_REMOVE: - rm_dev_node(dmt->dev_name); - break; - - case DM_DEVICE_RENAME: - rename_dev_node(dmt->dev_name, dmt->newname); - break; - - case DM_DEVICE_MKNODES: - if (dmi->flags & DM_EXISTS_FLAG) - add_dev_node(dmt->dev_name, MAJOR(dmi->dev), - MINOR(dmi->dev)); - else - rm_dev_node(dmt->dev_name); - break; - - case DM_DEVICE_STATUS: - case DM_DEVICE_TABLE: - if (!_unmarshal_status_v1(dmt, dmi)) - goto bad; - break; - - case DM_DEVICE_SUSPEND: - case DM_DEVICE_RESUME: - dmt->type = DM_DEVICE_INFO; - if (!dm_task_run(dmt)) - goto bad; - free(dmi); /* We'll use what info returned */ - return 1; - } - - dmt->dmi.v1 = dmi; - return 1; - - bad: - free(dmi); - return 0; -} - -#endif - -/* - * Protocol Version 4 functions. - */ - -int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size) -{ - unsigned int *v; - -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_driver_version_v1(dmt, version, size); -#endif - - if (!dmt->dmi.v4) { - version[0] = '\0'; - return 0; - } - - v = dmt->dmi.v4->version; - snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]); - return 1; -} - -static int _check_version(char *version, size_t size, int log_suppress) -{ - struct dm_task *task; - int r; - - if (!(task = dm_task_create(DM_DEVICE_VERSION))) { - log_error("Failed to get device-mapper version"); - version[0] = '\0'; - return 0; - } - - if (log_suppress) - _log_suppress = 1; - - r = dm_task_run(task); - dm_task_get_driver_version(task, version, size); - dm_task_destroy(task); - _log_suppress = 0; - - return r; -} - -/* - * Find out device-mapper's major version number the first time - * this is called and whether or not we support it. - */ -int dm_check_version(void) -{ - char libversion[64], dmversion[64]; - const char *compat = ""; - - if (_version_checked) - return _version_ok; - - _version_checked = 1; - - if (_check_version(dmversion, sizeof(dmversion), _dm_compat)) - return 1; - - if (!_dm_compat) - goto bad; - - log_verbose("device-mapper ioctl protocol version %d failed. " - "Trying protocol version 1.", _dm_version); - _dm_version = 1; - if (_check_version(dmversion, sizeof(dmversion), 0)) { - log_verbose("Using device-mapper ioctl protocol version 1"); - return 1; - } - - compat = "(compat)"; - - dm_get_library_version(libversion, sizeof(libversion)); - - log_error("Incompatible libdevmapper %s%s and kernel driver %s", - libversion, compat, dmversion); - - bad: - _version_ok = 0; - return 0; -} - -void *dm_get_next_target(struct dm_task *dmt, void *next, - uint64_t *start, uint64_t *length, - char **target_type, char **params) -{ - struct target *t = (struct target *) next; - - if (!t) - t = dmt->head; - - if (!t) - return NULL; - - *start = t->start; - *length = t->length; - *target_type = t->type; - *params = t->params; - - return t->next; -} - -/* Unmarshall the target info returned from a status call */ -static int _unmarshal_status(struct dm_task *dmt, struct dm_ioctl *dmi) -{ - char *outbuf = (char *) dmi + dmi->data_start; - char *outptr = outbuf; - uint32_t i; - struct dm_target_spec *spec; - - for (i = 0; i < dmi->target_count; i++) { - spec = (struct dm_target_spec *) outptr; - if (!dm_task_add_target(dmt, spec->sector_start, - spec->length, - spec->target_type, - outptr + sizeof(*spec))) - return 0; - - outptr = outbuf + spec->next; - } - - return 1; -} - -int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, - uint32_t dev_minor) -{ - int r; - -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_format_dev_v1(buf, bufsize, dev_major, dev_minor); -#endif - - if (bufsize < 8) - return 0; - - r = snprintf(buf, bufsize, "%03u:%03u", dev_major, dev_minor); - if (r < 0 || r > bufsize - 1) - return 0; - - return 1; -} - -int dm_task_get_info(struct dm_task *dmt, struct dm_info *info) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_info_v1(dmt, info); -#endif - - if (!dmt->dmi.v4) - return 0; - - memset(info, 0, sizeof(*info)); - - info->exists = dmt->dmi.v4->flags & DM_EXISTS_FLAG ? 1 : 0; - if (!info->exists) - return 1; - - info->suspended = dmt->dmi.v4->flags & DM_SUSPEND_FLAG ? 1 : 0; - info->read_only = dmt->dmi.v4->flags & DM_READONLY_FLAG ? 1 : 0; - info->live_table = dmt->dmi.v4->flags & DM_ACTIVE_PRESENT_FLAG ? 1 : 0; - info->inactive_table = dmt->dmi.v4->flags & DM_INACTIVE_PRESENT_FLAG ? - 1 : 0; - info->target_count = dmt->dmi.v4->target_count; - info->open_count = dmt->dmi.v4->open_count; - info->event_nr = dmt->dmi.v4->event_nr; - info->major = MAJOR(dmt->dmi.v4->dev); - info->minor = MINOR(dmt->dmi.v4->dev); - - return 1; -} - -const char *dm_task_get_name(struct dm_task *dmt) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_name_v1(dmt); -#endif - - return (dmt->dmi.v4->name); -} - -const char *dm_task_get_uuid(struct dm_task *dmt) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_uuid_v1(dmt); -#endif - - return (dmt->dmi.v4->uuid); -} - -struct dm_deps *dm_task_get_deps(struct dm_task *dmt) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_deps_v1(dmt); -#endif - - return (struct dm_deps *) (((void *) dmt->dmi.v4) + - dmt->dmi.v4->data_start); -} - -struct dm_names *dm_task_get_names(struct dm_task *dmt) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_names_v1(dmt); -#endif - - return (struct dm_names *) (((void *) dmt->dmi.v4) + - dmt->dmi.v4->data_start); -} - -int dm_task_set_ro(struct dm_task *dmt) -{ - dmt->read_only = 1; - return 1; -} - -int dm_task_set_newname(struct dm_task *dmt, const char *newname) -{ - if (!(dmt->newname = strdup(newname))) { - log_error("dm_task_set_newname: strdup(%s) failed", newname); - return 0; - } - - return 1; -} - -int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr) -{ - dmt->event_nr = event_nr; - - return 1; -} - -struct target *create_target(uint64_t start, uint64_t len, const char *type, - const char *params) -{ - struct target *t = malloc(sizeof(*t)); - - if (!t) { - log_error("create_target: malloc(%d) failed", sizeof(*t)); - return NULL; - } - - memset(t, 0, sizeof(*t)); - - if (!(t->params = strdup(params))) { - log_error("create_target: strdup(params) failed"); - goto bad; - } - - if (!(t->type = strdup(type))) { - log_error("create_target: strdup(type) failed"); - goto bad; - } - - t->start = start; - t->length = len; - return t; - - bad: - free(t->params); - free(t->type); - free(t); - return NULL; -} - -static void *_add_target(struct target *t, void *out, void *end) -{ - void *out_sp = out; - struct dm_target_spec sp; - size_t sp_size = sizeof(struct dm_target_spec); - int len; - const char no_space[] = "Ran out of memory building ioctl parameter"; - - out += sp_size; - if (out >= end) { - log_error(no_space); - return NULL; - } - - sp.status = 0; - sp.sector_start = t->start; - sp.length = t->length; - strncpy(sp.target_type, t->type, sizeof(sp.target_type)); - - len = strlen(t->params); - - if ((out + len + 1) >= end) { - log_error(no_space); - - log_error("t->params= '%s'", t->params); - return NULL; - } - strcpy((char *) out, t->params); - out += len + 1; - - /* align next block */ - out = _align(out, ALIGNMENT); - - sp.next = out - out_sp; - memcpy(out_sp, &sp, sp_size); - - return out; -} - -static struct dm_ioctl *_flatten(struct dm_task *dmt) -{ - const size_t min_size = 16 * 1024; - const int (*version)[3]; - - struct dm_ioctl *dmi; - struct target *t; - size_t len = sizeof(struct dm_ioctl); - void *b, *e; - int count = 0; - - for (t = dmt->head; t; t = t->next) { - len += sizeof(struct dm_target_spec); - len += strlen(t->params) + 1 + ALIGNMENT; - count++; - } - - if (count && dmt->newname) { - log_error("targets and newname are incompatible"); - return NULL; - } - - if (dmt->newname) - len += strlen(dmt->newname) + 1; - - /* - * Give len a minimum size so that we have space to store - * dependencies or status information. - */ - if (len < min_size) - len = min_size; - - if (!(dmi = malloc(len))) - return NULL; - - memset(dmi, 0, len); - - version = &_cmd_data_v4[dmt->type].version; - - dmi->version[0] = (*version)[0]; - dmi->version[1] = (*version)[1]; - dmi->version[2] = (*version)[2]; - - dmi->data_size = len; - dmi->data_start = sizeof(struct dm_ioctl); - - if (dmt->dev_name) - strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); - - if (dmt->type == DM_DEVICE_SUSPEND) - dmi->flags |= DM_SUSPEND_FLAG; - if (dmt->read_only) - dmi->flags |= DM_READONLY_FLAG; - - if (dmt->minor >= 0) { - if (dmt->major <= 0) { - log_error("Missing major number for persistent device"); - return NULL; - } - dmi->flags |= DM_PERSISTENT_DEV_FLAG; - dmi->dev = MKDEV(dmt->major, dmt->minor); - } - - if (dmt->uuid) - strncpy(dmi->uuid, dmt->uuid, sizeof(dmi->uuid)); - - dmi->target_count = count; - dmi->event_nr = dmt->event_nr; - - b = (void *) (dmi + 1); - e = (void *) ((char *) dmi + len); - - for (t = dmt->head; t; t = t->next) - if (!(b = _add_target(t, b, e))) - goto bad; - - if (dmt->newname) - strcpy(b, dmt->newname); - - return dmi; - - bad: - free(dmi); - return NULL; -} - -static int _create_and_load_v4(struct dm_task *dmt) -{ - struct dm_task *task; - int r; - - /* Use new task struct to create the device */ - if (!(task = dm_task_create(DM_DEVICE_CREATE))) { - log_error("Failed to create device-mapper task struct"); - return 0; - } - - /* Copy across relevant fields */ - if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { - dm_task_destroy(task); - return 0; - } - - if (dmt->uuid && !dm_task_set_uuid(task, dmt->uuid)) { - dm_task_destroy(task); - return 0; - } - - task->major = dmt->major; - task->minor = dmt->minor; - - r = dm_task_run(task); - dm_task_destroy(task); - if (!r) - return r; - - /* Next load the table */ - if (!(task = dm_task_create(DM_DEVICE_RELOAD))) { - log_error("Failed to create device-mapper task struct"); - return 0; - } - - /* Copy across relevant fields */ - if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { - dm_task_destroy(task); - return 0; - } - - task->read_only = dmt->read_only; - task->head = dmt->head; - task->tail = dmt->tail; - - r = dm_task_run(task); - - task->head = NULL; - task->tail = NULL; - dm_task_destroy(task); - if (!r) - return r; - - /* Use the original structure last so the info will be correct */ - dmt->type = DM_DEVICE_RESUME; - dmt->uuid = NULL; - free(dmt->uuid); - - r = dm_task_run(dmt); - - return r; -} - -int dm_task_run(struct dm_task *dmt) -{ - struct dm_ioctl *dmi = NULL; - unsigned int command; - -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_run_v1(dmt); -#endif - - if ((unsigned) dmt->type >= - (sizeof(_cmd_data_v4) / sizeof(*_cmd_data_v4))) { - log_error("Internal error: unknown device-mapper task %d", - dmt->type); - goto bad; - } - - command = _cmd_data_v4[dmt->type].cmd; - - /* Old-style creation had a table supplied */ - if (dmt->type == DM_DEVICE_CREATE && dmt->head) - return _create_and_load_v4(dmt); - - if (!_open_control()) - return 0; - - dmi = _flatten(dmt); - if (!dmi) { - log_error("Couldn't create ioctl argument"); - return 0; - } - - if (dmt->type == DM_DEVICE_TABLE) - dmi->flags |= DM_STATUS_TABLE_FLAG; - - dmi->flags |= DM_EXISTS_FLAG; /* FIXME */ - log_debug("dm %s %s %s %s", _cmd_data_v4[dmt->type].name, dmi->name, - dmi->uuid, dmt->newname ? dmt->newname : ""); - if (ioctl(_control_fd, command, dmi) < 0) { - if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) || - (dmt->type == DM_DEVICE_MKNODES))) { - dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */ - goto ignore_error; - } - if (_log_suppress) - log_verbose("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); - else - log_error("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); - goto bad; - } - - ignore_error: - switch (dmt->type) { - case DM_DEVICE_CREATE: - add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev)); - break; - - case DM_DEVICE_REMOVE: - rm_dev_node(dmt->dev_name); - break; - - case DM_DEVICE_RENAME: - rename_dev_node(dmt->dev_name, dmt->newname); - break; - - case DM_DEVICE_MKNODES: - if (dmi->flags & DM_EXISTS_FLAG) - add_dev_node(dmt->dev_name, MAJOR(dmi->dev), - MINOR(dmi->dev)); - else - rm_dev_node(dmt->dev_name); - break; - - case DM_DEVICE_STATUS: - case DM_DEVICE_TABLE: - case DM_DEVICE_WAITEVENT: - if (!_unmarshal_status(dmt, dmi)) - goto bad; - break; - } - - dmt->dmi.v4 = dmi; - return 1; - - bad: - free(dmi); - return 0; -} - -void dm_lib_release(void) -{ - if (_control_fd != -1) { - close(_control_fd); - _control_fd = -1; - } - update_devs(); -} - -void dm_lib_exit(void) -{ - if (_control_fd != -1) { - close(_control_fd); - _control_fd = -1; - } - _version_ok = 1; - _version_checked = 0; -} diff --git a/extras/multipath/libdevmapper/ioctl/libdm-compat.h b/extras/multipath/libdevmapper/ioctl/libdm-compat.h deleted file mode 100644 index af7a9f1f71..0000000000 --- a/extras/multipath/libdevmapper/ioctl/libdm-compat.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#ifndef _LINUX_LIBDM_COMPAT_H -#define _LINUX_LIBDM_COMPAT_H - -#include -#include -#include -#include - -struct dm_task; -struct dm_info; - -/* - * Old versions of structures for backwards compatibility. - */ - -struct dm_ioctl_v1 { - uint32_t version[3]; /* in/out */ - uint32_t data_size; /* total size of data passed in - * including this struct */ - - uint32_t data_start; /* offset to start of data - * relative to start of this struct */ - - int32_t target_count; /* in/out */ - int32_t open_count; /* out */ - uint32_t flags; /* in/out */ - - __kernel_dev_t dev; /* in/out */ - - char name[DM_NAME_LEN]; /* device name */ - char uuid[DM_UUID_LEN]; /* unique identifier for - * the block device */ -}; - -struct dm_target_spec_v1 { - int32_t status; /* used when reading from kernel only */ - uint64_t sector_start; - uint32_t length; - uint32_t next; - - char target_type[DM_MAX_TYPE_NAME]; - -}; - -struct dm_target_deps_v1 { - uint32_t count; - - __kernel_dev_t dev[0]; /* out */ -}; - -enum { - /* Top level cmds */ - DM_VERSION_CMD_V1 = 0, - DM_REMOVE_ALL_CMD_V1, - - /* device level cmds */ - DM_DEV_CREATE_CMD_V1, - DM_DEV_REMOVE_CMD_V1, - DM_DEV_RELOAD_CMD_V1, - DM_DEV_RENAME_CMD_V1, - DM_DEV_SUSPEND_CMD_V1, - DM_DEV_DEPS_CMD_V1, - DM_DEV_STATUS_CMD_V1, - - /* target level cmds */ - DM_TARGET_STATUS_CMD_V1, - DM_TARGET_WAIT_CMD_V1, -}; - -#define DM_VERSION_V1 _IOWR(DM_IOCTL, DM_VERSION_CMD_V1, struct dm_ioctl) -#define DM_REMOVE_ALL_V1 _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD_V1, struct dm_ioctl) - -#define DM_DEV_CREATE_V1 _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD_V1, struct dm_ioctl) -#define DM_DEV_REMOVE_V1 _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD_V1, struct dm_ioctl) -#define DM_DEV_RELOAD_V1 _IOWR(DM_IOCTL, DM_DEV_RELOAD_CMD_V1, struct dm_ioctl) -#define DM_DEV_SUSPEND_V1 _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD_V1, struct dm_ioctl) -#define DM_DEV_RENAME_V1 _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD_V1, struct dm_ioctl) -#define DM_DEV_DEPS_V1 _IOWR(DM_IOCTL, DM_DEV_DEPS_CMD_V1, struct dm_ioctl) -#define DM_DEV_STATUS_V1 _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD_V1, struct dm_ioctl) - -#define DM_TARGET_STATUS_V1 _IOWR(DM_IOCTL, DM_TARGET_STATUS_CMD_V1, struct dm_ioctl) -#define DM_TARGET_WAIT_V1 _IOWR(DM_IOCTL, DM_TARGET_WAIT_CMD_V1, struct dm_ioctl) - -/* *INDENT-OFF* */ -static struct cmd_data _cmd_data_v1[] = { - { "create", DM_DEV_CREATE_V1, {1, 0, 0} }, - { "reload", DM_DEV_RELOAD_V1, {1, 0, 0} }, - { "remove", DM_DEV_REMOVE_V1, {1, 0, 0} }, - { "remove_all", DM_REMOVE_ALL_V1, {1, 0, 0} }, - { "suspend", DM_DEV_SUSPEND_V1, {1, 0, 0} }, - { "resume", DM_DEV_SUSPEND_V1, {1, 0, 0} }, - { "info", DM_DEV_STATUS_V1, {1, 0, 0} }, - { "deps", DM_DEV_DEPS_V1, {1, 0, 0} }, - { "rename", DM_DEV_RENAME_V1, {1, 0, 0} }, - { "version", DM_VERSION_V1, {1, 0, 0} }, - { "status", DM_TARGET_STATUS_V1, {1, 0, 0} }, - { "table", DM_TARGET_STATUS_V1, {1, 0, 0} }, - { "waitevent", DM_TARGET_WAIT_V1, {1, 0, 0} }, - { "names", 0, {4, 0, 0} }, - { "clear", 0, {4, 0, 0} }, - { "mknodes", 0, {4, 0, 0} }, -}; -/* *INDENT-ON* */ - -#endif diff --git a/extras/multipath/libdevmapper/ioctl/libdm-targets.h b/extras/multipath/libdevmapper/ioctl/libdm-targets.h deleted file mode 100644 index a8c0e20547..0000000000 --- a/extras/multipath/libdevmapper/ioctl/libdm-targets.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#ifndef LIB_DMTARGETS_H -#define LIB_DMTARGETS_H - -#include - -struct dm_ioctl; -struct dm_ioctl_v1; - -struct target { - uint64_t start; - uint64_t length; - char *type; - char *params; - - struct target *next; -}; - -struct dm_task { - int type; - char *dev_name; - - struct target *head, *tail; - - int read_only; - uint32_t event_nr; - int major; - int minor; - union { - struct dm_ioctl *v4; - struct dm_ioctl_v1 *v1; - } dmi; - char *newname; - - char *uuid; -}; - -struct cmd_data { - const char *name; - const int cmd; - const int version[3]; -}; - -int dm_check_version(void); - -#endif diff --git a/extras/multipath/libdevmapper/libdevmapper.h b/extras/multipath/libdevmapper/libdevmapper.h deleted file mode 100644 index 6549af3641..0000000000 --- a/extras/multipath/libdevmapper/libdevmapper.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#ifndef LIB_DEVICE_MAPPER_H -#define LIB_DEVICE_MAPPER_H - -#include -#include - -#ifdef linux -# include -#endif - -/* - * Since it is quite laborious to build the ioctl - * arguments for the device-mapper people are - * encouraged to use this library. - * - * You will need to build a struct dm_task for - * each ioctl command you want to execute. - */ - -typedef void (*dm_log_fn) (int level, const char *file, int line, - const char *f, ...); - -/* - * The library user may wish to register their own - * logging function, by default errors go to - * stderr. - */ -void dm_log_init(dm_log_fn fn); -void dm_log_init_verbose(int level); - -enum { - DM_DEVICE_CREATE, - DM_DEVICE_RELOAD, - DM_DEVICE_REMOVE, - DM_DEVICE_REMOVE_ALL, - - DM_DEVICE_SUSPEND, - DM_DEVICE_RESUME, - - DM_DEVICE_INFO, - DM_DEVICE_DEPS, - DM_DEVICE_RENAME, - - DM_DEVICE_VERSION, - - DM_DEVICE_STATUS, - DM_DEVICE_TABLE, - DM_DEVICE_WAITEVENT, - - DM_DEVICE_LIST, - - DM_DEVICE_CLEAR, - - DM_DEVICE_MKNODES -}; - -struct dm_task; - -struct dm_task *dm_task_create(int type); -void dm_task_destroy(struct dm_task *dmt); - -int dm_task_set_name(struct dm_task *dmt, const char *name); -int dm_task_set_uuid(struct dm_task *dmt, const char *uuid); - -/* - * Retrieve attributes after an info. - */ -struct dm_info { - int exists; - int suspended; - int live_table; - int inactive_table; - int32_t open_count; - uint32_t event_nr; - uint32_t major; - uint32_t minor; /* minor device number */ - int read_only; /* 0:read-write; 1:read-only */ - - int32_t target_count; -}; - -struct dm_deps { - uint32_t count; - uint32_t filler; - uint64_t device[0]; -}; - -struct dm_names { - uint64_t dev; - uint32_t next; /* Offset to next struct from start of this struct */ - char name[0]; -}; - -int dm_get_library_version(char *version, size_t size); -int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size); -int dm_task_get_info(struct dm_task *dmt, struct dm_info *dmi); -const char *dm_task_get_name(struct dm_task *dmt); -const char *dm_task_get_uuid(struct dm_task *dmt); - -struct dm_deps *dm_task_get_deps(struct dm_task *dmt); -struct dm_names *dm_task_get_names(struct dm_task *dmt); - -int dm_task_set_ro(struct dm_task *dmt); -int dm_task_set_newname(struct dm_task *dmt, const char *newname); -int dm_task_set_minor(struct dm_task *dmt, int minor); -int dm_task_set_major(struct dm_task *dmt, int major); -int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr); - -/* - * Use these to prepare for a create or reload. - */ -int dm_task_add_target(struct dm_task *dmt, - uint64_t start, - uint64_t size, const char *ttype, const char *params); - -/* - * Format major/minor numbers correctly for input to driver - */ -int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, uint32_t dev_minor); - -/* Use this to retrive target information returned from a STATUS call */ -void *dm_get_next_target(struct dm_task *dmt, - void *next, uint64_t *start, uint64_t *length, - char **target_type, char **params); - -/* - * Call this to actually run the ioctl. - */ -int dm_task_run(struct dm_task *dmt); - -/* - * Configure the device-mapper directory - */ -int dm_set_dev_dir(const char *dir); -const char *dm_dir(void); - -/* Release library resources */ -void dm_lib_release(void); -void dm_lib_exit(void); - -#endif /* LIB_DEVICE_MAPPER_H */ diff --git a/extras/multipath/libdevmapper/libdm-common.c b/extras/multipath/libdevmapper/libdm-common.c deleted file mode 100644 index b0affd1eed..0000000000 --- a/extras/multipath/libdevmapper/libdm-common.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#include "libdm-targets.h" -#include "libdm-common.h" -#include "list.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEV_DIR "/dev/" - -static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR; - -static int _verbose = 0; - -/* - * Library users can provide their own logging - * function. - */ -static void _default_log(int level, const char *file, int line, - const char *f, ...) -{ - va_list ap; - - if (level > _LOG_WARN && !_verbose) - return; - - va_start(ap, f); - - if (level < _LOG_WARN) - vfprintf(stderr, f, ap); - else - vprintf(f, ap); - - va_end(ap); - - if (level < _LOG_WARN) - fprintf(stderr, "\n"); - else - fprintf(stdout, "\n"); -} - -dm_log_fn _log = _default_log; - -void dm_log_init(dm_log_fn fn) -{ - _log = fn; -} - -void dm_log_init_verbose(int level) -{ - _verbose = level; -} - -static void _build_dev_path(char *buffer, size_t len, const char *dev_name) -{ - /* If there's a /, assume caller knows what they're doing */ - if (strchr(dev_name, '/')) - snprintf(buffer, len, "%s", dev_name); - else - snprintf(buffer, len, "%s/%s", _dm_dir, dev_name); -} - -int dm_get_library_version(char *version, size_t size) -{ - strncpy(version, DM_LIB_VERSION, size); - return 1; -} - -struct dm_task *dm_task_create(int type) -{ - struct dm_task *dmt = malloc(sizeof(*dmt)); - - if (!dm_check_version()) - return NULL; - - if (!dmt) { - log_error("dm_task_create: malloc(%d) failed", sizeof(*dmt)); - return NULL; - } - - memset(dmt, 0, sizeof(*dmt)); - - dmt->type = type; - dmt->minor = -1; - dmt->major = -1; - - return dmt; -} - -int dm_task_set_name(struct dm_task *dmt, const char *name) -{ - char *pos; - char path[PATH_MAX]; - struct stat st1, st2; - - if (dmt->dev_name) { - free(dmt->dev_name); - dmt->dev_name = NULL; - } - - /* If path was supplied, remove it if it points to the same device - * as its last component. - */ - if ((pos = strrchr(name, '/'))) { - snprintf(path, sizeof(path), "%s/%s", _dm_dir, pos + 1); - - if (stat(name, &st1) || stat(path, &st2) || - !(st1.st_dev == st2.st_dev)) { - log_error("dm_task_set_name: Device %s not found", - name); - return 0; - } - - name = pos + 1; - } - - if (!(dmt->dev_name = strdup(name))) { - log_error("dm_task_set_name: strdup(%s) failed", name); - return 0; - } - - return 1; -} - -int dm_task_set_uuid(struct dm_task *dmt, const char *uuid) -{ - if (dmt->uuid) { - free(dmt->uuid); - dmt->uuid = NULL; - } - - if (!(dmt->uuid = strdup(uuid))) { - log_error("dm_task_set_uuid: strdup(%s) failed", uuid); - return 0; - } - - return 1; -} - -int dm_task_set_major(struct dm_task *dmt, int major) -{ - dmt->major = major; - log_debug("Setting major: %d", dmt->major); - - return 1; -} - -int dm_task_set_minor(struct dm_task *dmt, int minor) -{ - dmt->minor = minor; - log_debug("Setting minor: %d", dmt->minor); - - return 1; -} - -int dm_task_add_target(struct dm_task *dmt, uint64_t start, uint64_t size, - const char *ttype, const char *params) -{ - struct target *t = create_target(start, size, ttype, params); - - if (!t) - return 0; - - if (!dmt->head) - dmt->head = dmt->tail = t; - else { - dmt->tail->next = t; - dmt->tail = t; - } - - return 1; -} - -static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor) -{ - char path[PATH_MAX]; - struct stat info; - dev_t dev = MKDEV(major, minor); - - _build_dev_path(path, sizeof(path), dev_name); - - if (stat(path, &info) >= 0) { - if (!S_ISBLK(info.st_mode)) { - log_error("A non-block device file at '%s' " - "is already present", path); - return 0; - } - - if (info.st_rdev == dev) - return 1; - - if (unlink(path) < 0) { - log_error("Unable to unlink device node for '%s'", - dev_name); - return 0; - } - } - - if (mknod(path, S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP, dev) < 0) { - log_error("Unable to make device node for '%s'", dev_name); - return 0; - } - - return 1; -} - -static int _rename_dev_node(const char *old_name, const char *new_name) -{ - char oldpath[PATH_MAX]; - char newpath[PATH_MAX]; - struct stat info; - - _build_dev_path(oldpath, sizeof(oldpath), old_name); - _build_dev_path(newpath, sizeof(newpath), new_name); - - if (stat(newpath, &info) == 0) { - if (!S_ISBLK(info.st_mode)) { - log_error("A non-block device file at '%s' " - "is already present", newpath); - return 0; - } - - if (unlink(newpath) < 0) { - if (errno == EPERM) { - /* devfs, entry has already been renamed */ - return 1; - } - log_error("Unable to unlink device node for '%s'", - new_name); - return 0; - } - } - - if (rename(oldpath, newpath) < 0) { - log_error("Unable to rename device node from '%s' to '%s'", - old_name, new_name); - return 0; - } - - return 1; -} - -static int _rm_dev_node(const char *dev_name) -{ - char path[PATH_MAX]; - struct stat info; - - _build_dev_path(path, sizeof(path), dev_name); - - if (stat(path, &info) < 0) - return 1; - - if (unlink(path) < 0) { - log_error("Unable to unlink device node for '%s'", dev_name); - return 0; - } - - return 1; -} - -typedef enum { - NODE_ADD, - NODE_DEL, - NODE_RENAME -} node_op_t; - -static int _do_node_op(node_op_t type, const char *dev_name, uint32_t major, - uint32_t minor, const char *old_name) -{ - switch (type) { - case NODE_ADD: - return _add_dev_node(dev_name, major, minor); - case NODE_DEL: - return _rm_dev_node(dev_name); - case NODE_RENAME: - return _rename_dev_node(old_name, dev_name); - } - - return 1; -} - -static LIST_INIT(_node_ops); - -struct node_op_parms { - struct list list; - node_op_t type; - char *dev_name; - uint32_t major; - uint32_t minor; - char *old_name; - char names[0]; -}; - -static void _store_str(char **pos, char **ptr, const char *str) -{ - strcpy(*pos, str); - *ptr = *pos; - *pos += strlen(*ptr) + 1; -} - -static int _stack_node_op(node_op_t type, const char *dev_name, uint32_t major, - uint32_t minor, const char *old_name) -{ - struct node_op_parms *nop; - size_t len = strlen(dev_name) + strlen(old_name) + 2; - char *pos; - - if (!(nop = malloc(sizeof(*nop) + len))) { - log_error("Insufficient memory to stack mknod operation"); - return 0; - } - - pos = nop->names; - nop->type = type; - nop->major = major; - nop->minor = minor; - - _store_str(&pos, &nop->dev_name, dev_name); - _store_str(&pos, &nop->old_name, old_name); - - list_add(&_node_ops, &nop->list); - - return 1; -} - -static void _pop_node_ops(void) -{ - struct list *noph, *nopht; - struct node_op_parms *nop; - - list_iterate_safe(noph, nopht, &_node_ops) { - nop = list_item(noph, struct node_op_parms); - _do_node_op(nop->type, nop->dev_name, nop->major, nop->minor, - nop->old_name); - list_del(&nop->list); - free(nop); - } -} - -int add_dev_node(const char *dev_name, uint32_t major, uint32_t minor) -{ - return _stack_node_op(NODE_ADD, dev_name, major, minor, ""); -} - -int rename_dev_node(const char *old_name, const char *new_name) -{ - return _stack_node_op(NODE_RENAME, new_name, 0, 0, old_name); -} - -int rm_dev_node(const char *dev_name) -{ - return _stack_node_op(NODE_DEL, dev_name, 0, 0, ""); -} - -void update_devs(void) -{ - _pop_node_ops(); -} - -int dm_set_dev_dir(const char *dir) -{ - snprintf(_dm_dir, sizeof(_dm_dir), "%s%s", dir, DM_DIR); - return 1; -} - -const char *dm_dir(void) -{ - return _dm_dir; -} diff --git a/extras/multipath/libdevmapper/libdm-common.h b/extras/multipath/libdevmapper/libdm-common.h deleted file mode 100644 index 2b71242861..0000000000 --- a/extras/multipath/libdevmapper/libdm-common.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#ifndef LIB_DMCOMMON_H -#define LIB_DMCOMMON_H - -#include "libdevmapper.h" - -#define _LOG_DEBUG 7 -#define _LOG_INFO 6 -#define _LOG_NOTICE 5 -#define _LOG_WARN 4 -#define _LOG_ERR 3 -#define _LOG_FATAL 2 - -extern dm_log_fn _log; - -#define log_error(msg, x...) _log(_LOG_ERR, __FILE__, __LINE__, msg, ## x) -#define log_print(msg, x...) _log(_LOG_WARN, __FILE__, __LINE__, msg, ## x) -#define log_verbose(msg, x...) _log(_LOG_NOTICE, __FILE__, __LINE__, msg, ## x) -#define log_very_verbose(msg, x...) _log(_LOG_INFO, __FILE__, __LINE__, msg, ## x) -#define log_debug(msg, x...) _log(_LOG_DEBUG, __FILE__, __LINE__, msg, ## x) - -struct target *create_target(uint64_t start, - uint64_t len, - const char *type, const char *params); - -int add_dev_node(const char *dev_name, uint32_t minor, uint32_t major); -int rm_dev_node(const char *dev_name); -int rename_dev_node(const char *old_name, const char *new_name); -void update_devs(void); - -#define DM_LIB_VERSION "1.00.07-ioctl (2003-11-21)" - -#endif diff --git a/extras/multipath/libdevmapper/list.h b/extras/multipath/libdevmapper/list.h deleted file mode 100644 index df3d32aea8..0000000000 --- a/extras/multipath/libdevmapper/list.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software - * - * This file is released under the LGPL. - */ - -#ifndef _LVM_LIST_H -#define _LVM_LIST_H - -#include - -struct list { - struct list *n, *p; -}; - -#define LIST_INIT(name) struct list name = { &(name), &(name) } - -static inline void list_init(struct list *head) -{ - head->n = head->p = head; -} - -static inline void list_add(struct list *head, struct list *elem) -{ - assert(head->n); - - elem->n = head; - elem->p = head->p; - - head->p->n = elem; - head->p = elem; -} - -static inline void list_add_h(struct list *head, struct list *elem) -{ - assert(head->n); - - elem->n = head->n; - elem->p = head; - - head->n->p = elem; - head->n = elem; -} - -static inline void list_del(struct list *elem) -{ - elem->n->p = elem->p; - elem->p->n = elem->n; -} - -static inline int list_empty(struct list *head) -{ - return head->n == head; -} - -static inline int list_end(struct list *head, struct list *elem) -{ - return elem->n == head; -} - -static inline struct list *list_next(struct list *head, struct list *elem) -{ - return (list_end(head, elem) ? NULL : elem->n); -} - -#define list_iterate(v, head) \ - for (v = (head)->n; v != head; v = v->n) - -#define list_uniterate(v, head, start) \ - for (v = (start)->p; v != head; v = v->p) - -#define list_iterate_safe(v, t, head) \ - for (v = (head)->n, t = v->n; v != head; v = t, t = v->n) - -static inline unsigned int list_size(const struct list *head) -{ - unsigned int s = 0; - const struct list *v; - - list_iterate(v, head) - s++; - - return s; -} - -#define list_item(v, t) \ - ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->list)) - -#define list_struct_base(v, t, h) \ - ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->h)) - -/* Given a known element in a known structure, locate another */ -#define struct_field(v, t, e, f) \ - (((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->e))->f) - -/* Given a known element in a known structure, locate the list head */ -#define list_head(v, t, e) struct_field(v, t, e, list) - -#endif diff --git a/extras/multipath/main.c b/extras/multipath/main.c deleted file mode 100644 index dfaa6867dd..0000000000 --- a/extras/multipath/main.c +++ /dev/null @@ -1,705 +0,0 @@ -/* - * Soft: multipath device mapper target autoconfig - * - * Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $ - * - * Author: Copyright (C) 2003 Christophe Varoqui - * - * 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. - * - * 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; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "libdevmapper/libdevmapper.h" -#include "main.h" -#include "devinfo.h" - -/* White list switch */ -static int -get_unique_id(struct path * mypath) -{ - int i; - static struct { - char * vendor; - char * product; - int iopolicy; - int (*getuid) (char *, char *); - } wlist[] = { - {"COMPAQ ", "HSV110 (C)COMPAQ", GROUP_BY_SERIAL, &get_evpd_wwid}, - {"COMPAQ ", "MSA1000 ", GROUP_BY_SERIAL, &get_evpd_wwid}, - {"COMPAQ ", "MSA1000 VOLUME ", GROUP_BY_SERIAL, &get_evpd_wwid}, - {"DEC ", "HSG80 ", GROUP_BY_SERIAL, &get_evpd_wwid}, - {"HP ", "HSV100 ", GROUP_BY_SERIAL, &get_evpd_wwid}, - {"HP ", "A6189A ", MULTIBUS, &get_evpd_wwid}, - {"HP ", "OPEN- ", MULTIBUS, &get_evpd_wwid}, - {"DDN ", "SAN DataDirector", MULTIBUS, &get_evpd_wwid}, - {"FSC ", "CentricStor ", MULTIBUS, &get_evpd_wwid}, - {"HITACHI ", "DF400 ", MULTIBUS, &get_evpd_wwid}, - {"HITACHI ", "DF500 ", MULTIBUS, &get_evpd_wwid}, - {"HITACHI ", "DF600 ", MULTIBUS, &get_evpd_wwid}, - {"IBM ", "ProFibre 4000R ", MULTIBUS, &get_evpd_wwid}, - {"SGI ", "TP9100 ", MULTIBUS, &get_evpd_wwid}, - {"SGI ", "TP9300 ", MULTIBUS, &get_evpd_wwid}, - {"SGI ", "TP9400 ", MULTIBUS, &get_evpd_wwid}, - {"SGI ", "TP9500 ", MULTIBUS, &get_evpd_wwid}, - {NULL, NULL, 0, NULL}, - }; - - for (i = 0; wlist[i].vendor; i++) { - if (strncmp(mypath->vendor_id, wlist[i].vendor, 8) == 0 && - strncmp(mypath->product_id, wlist[i].product, 16) == 0) { - mypath->iopolicy = wlist[i].iopolicy; - if (!wlist[i].getuid(mypath->sg_dev, mypath->wwid)) - return 0; - } - } - return 1; -} - -static int -blacklist (char * dev) { - int i; - static struct { - char * headstr; - int lengh; - } blist[] = { - {"cciss", 5}, - {"hd", 2}, - {"md", 2}, - {"dm", 2}, - {"sr", 2}, - {"scd", 3}, - {"ram", 3}, - {"raw", 3}, - {NULL, 0}, - }; - - for (i = 0; blist[i].lengh; i++) { - if (strncmp(dev, blist[i].headstr, blist[i].lengh) == 0) - return 1; - } - return 0; -} - -static int -get_all_paths_sysfs(struct env * conf, struct path * all_paths) -{ - int k=0; - struct sysfs_directory * sdir; - struct sysfs_directory * devp; - struct sysfs_link * linkp; - char refwwid[WWID_SIZE]; - char empty_buff[WWID_SIZE]; - char buff[FILE_NAME_SIZE]; - char path[FILE_NAME_SIZE]; - struct path curpath; - - /* if called from hotplug, only consider the paths that relate */ - /* to the device pointed by conf.hotplugdev */ - memset(empty_buff, 0, WWID_SIZE); - memset(refwwid, 0, WWID_SIZE); - if (strncmp("/devices", conf->hotplugdev, 8) == 0) { - sprintf(buff, "%s%s/block", - conf->sysfs_path, conf->hotplugdev); - memset(conf->hotplugdev, 0, FILE_NAME_SIZE); - - /* if called from hotplug but with no block, leave */ - if (0 > readlink(buff, conf->hotplugdev, FILE_NAME_SIZE)) - return 0; - - basename(conf->hotplugdev, buff); - sprintf(curpath.sg_dev, "/dev/%s", buff); - - get_lun_strings(curpath.vendor_id, - curpath.product_id, - curpath.rev, - curpath.sg_dev); - get_serial(curpath.serial, curpath.sg_dev); - if (!get_unique_id(&curpath)) - return 0; - strcpy(refwwid, curpath.wwid); - memset(&curpath, 0, sizeof(path)); - } - - sprintf(path, "%s/block", conf->sysfs_path); - sdir = sysfs_open_directory(path); - sysfs_read_directory(sdir); - - dlist_for_each_data(sdir->subdirs, devp, struct sysfs_directory) { - if (blacklist(devp->name)) - continue; - - sysfs_read_directory(devp); - - if(devp->links == NULL) - continue; - - dlist_for_each_data(devp->links, linkp, struct sysfs_link) { - if (!strncmp(linkp->name, "device", 6)) - break; - } - - if (linkp == NULL) { - continue; - } - - basename(devp->path, buff); - sprintf(curpath.sg_dev, "/dev/%s", buff); - - get_lun_strings(curpath.vendor_id, - curpath.product_id, - curpath.rev, - curpath.sg_dev); - get_serial(curpath.serial, curpath.sg_dev); - if(!get_unique_id(&curpath)) { - memset(&curpath, 0, sizeof(path)); - continue; - } - - if (memcmp(empty_buff, refwwid, WWID_SIZE) != 0 && - strncmp(curpath.wwid, refwwid, WWID_SIZE) != 0) { - memset(&curpath, 0, sizeof(path)); - continue; - } - - strcpy(all_paths[k].sg_dev, curpath.sg_dev); - strcpy(all_paths[k].dev, curpath.sg_dev); - strcpy(all_paths[k].wwid, curpath.wwid); - strcpy(all_paths[k].vendor_id, curpath.vendor_id); - strcpy(all_paths[k].product_id, curpath.product_id); - all_paths[k].iopolicy = curpath.iopolicy; - - /* done with curpath, zero for reuse */ - memset(&curpath, 0, sizeof(path)); - - basename(linkp->target, buff); - sscanf(buff, "%i:%i:%i:%i", - &all_paths[k].sg_id.host_no, - &all_paths[k].sg_id.channel, - &all_paths[k].sg_id.scsi_id, - &all_paths[k].sg_id.lun); - k++; - } - sysfs_close_directory(sdir); - return 0; -} - -static int -get_all_paths_nosysfs(struct env * conf, struct path * all_paths, - struct scsi_dev * all_scsi_ids) -{ - int k, i, fd; - char buff[FILE_NAME_SIZE]; - char file_name[FILE_NAME_SIZE]; - - for (k = 0; k < conf->max_devs; k++) { - strcpy(file_name, "/dev/sg"); - sprintf(buff, "%d", k); - strncat(file_name, buff, FILE_NAME_SIZE); - strcpy(all_paths[k].sg_dev, file_name); - - get_lun_strings(all_paths[k].vendor_id, - all_paths[k].product_id, - all_paths[k].rev, - all_paths[k].sg_dev); - get_serial(all_paths[k].serial, all_paths[k].sg_dev); - if (!get_unique_id(&all_paths[k])) - continue; - - if ((fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) - return 0; - - if (0 > ioctl(fd, SG_GET_SCSI_ID, &(all_paths[k].sg_id))) - printf("device %s failed on sg ioctl, skip\n", - file_name); - - close(fd); - - for (i = 0; i < conf->max_devs; i++) { - if ((all_paths[k].sg_id.host_no == - all_scsi_ids[i].host_no) - && (all_paths[k].sg_id.scsi_id == - (all_scsi_ids[i].scsi_id.dev_id & 0xff)) - && (all_paths[k].sg_id.lun == - ((all_scsi_ids[i].scsi_id.dev_id >> 8) & 0xff)) - && (all_paths[k].sg_id.channel == - ((all_scsi_ids[i].scsi_id. - dev_id >> 16) & 0xff))) { - strcpy(all_paths[k].dev, all_scsi_ids[i].dev); - break; - } - } - } - return 0; -} - -static int -get_all_scsi_ids(struct env * conf, struct scsi_dev * all_scsi_ids) -{ - int k, big, little, res, host_no, fd; - char buff[64]; - char fname[FILE_NAME_SIZE]; - struct scsi_idlun my_scsi_id; - - for (k = 0; k < conf->max_devs; k++) { - strcpy(fname, "/dev/sd"); - if (k < 26) { - buff[0] = 'a' + (char) k; - buff[1] = '\0'; - strcat(fname, buff); - } else if (k <= 255) { - /* assumes sequence goes x,y,z,aa,ab,ac etc */ - big = k / 26; - little = k - (26 * big); - big = big - 1; - - buff[0] = 'a' + (char) big; - buff[1] = 'a' + (char) little; - buff[2] = '\0'; - strcat(fname, buff); - } else - strcat(fname, "xxxx"); - - if ((fd = open(fname, O_RDONLY)) < 0) { - if (conf->verbose) - fprintf(stderr, "can't open %s. mknod ?", - fname); - continue; - } - - res = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &my_scsi_id); - if (res < 0) { - close(fd); - printf("Could not get scsi idlun\n"); - continue; - } - - res = ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &host_no); - if (res < 0) { - close(fd); - printf("Could not get host_no\n"); - continue; - } - - close(fd); - - strcpy(all_scsi_ids[k].dev, fname); - all_scsi_ids[k].scsi_id = my_scsi_id; - all_scsi_ids[k].host_no = host_no; - } - return 0; -} - -/* print_path style */ -#define ALL 0 -#define NOWWID 1 - -static void -print_path(struct path * all_paths, int k, int style) -{ - if (style != NOWWID) - printf("%s ", all_paths[k].wwid); - else - printf(" \\_"); - printf("(%i %i %i %i) ", - all_paths[k].sg_id.host_no, - all_paths[k].sg_id.channel, - all_paths[k].sg_id.scsi_id, all_paths[k].sg_id.lun); - if(0 != strcmp(all_paths[k].sg_dev, all_paths[k].dev)) - printf("%s ", all_paths[k].sg_dev); - printf("%s ", all_paths[k].dev); - printf("[%.16s]\n", all_paths[k].product_id); -} - -static void -print_all_path(struct env * conf, struct path * all_paths) -{ - int k; - char empty_buff[WWID_SIZE]; - - memset(empty_buff, 0, WWID_SIZE); - for (k = 0; k < conf->max_devs; k++) { - if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) - continue; - print_path(all_paths, k, ALL); - } -} - -static void -print_all_mp(struct path * all_paths, struct multipath * mp, int nmp) -{ - int k, i; - - for (k = 0; k <= nmp; k++) { - printf("%s\n", mp[k].wwid); - for (i = 0; i <= mp[k].npaths; i++) - print_path(all_paths, PINDEX(k,i), NOWWID); - } -} - -static int -coalesce_paths(struct env * conf, struct multipath * mp, - struct path * all_paths) -{ - int k, i, nmp, np, already_done; - char empty_buff[WWID_SIZE]; - - nmp = -1; - already_done = 0; - memset(empty_buff, 0, WWID_SIZE); - - for (k = 0; k < conf->max_devs - 1; k++) { - /* skip this path for some reason */ - - /* 1. if path has no unique id */ - if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) - continue; - - /* 2. if mp with this uid already instanciated */ - for (i = 0; i <= nmp; i++) { - if (0 == strcmp(mp[i].wwid, all_paths[k].wwid)) - already_done = 1; - } - if (already_done) { - already_done = 0; - continue; - } - - /* at this point, we know we really got a new mp */ - np = 0; - nmp++; - strcpy(mp[nmp].wwid, all_paths[k].wwid); - PINDEX(nmp,np) = k; - - if (mp[nmp].size == 0) - mp[nmp].size = get_disk_size(all_paths[k].dev); - - for (i = k + 1; i < conf->max_devs; i++) { - if (0 == strcmp(all_paths[k].wwid, all_paths[i].wwid)) { - np++; - PINDEX(nmp,np) = i; - mp[nmp].npaths = np; - } - } - } - return nmp; -} - -static void -group_by_serial(struct multipath * mp, struct path * all_paths, char * str) { - int path_count, pg_count = 0; - int i, k; - int * bitmap; - char path_buff[FILE_NAME_SIZE]; - char pg_buff[FILE_NAME_SIZE]; - char * path_buff_p = &path_buff[0]; - char * pg_buff_p = &pg_buff[0]; - - /* init the bitmap */ - bitmap = malloc((mp->npaths + 1) * sizeof(int)); - memset(bitmap, 0, (mp->npaths + 1) * sizeof(int)); - - for (i = 0; i <= mp->npaths; i++) { - if (bitmap[i]) - continue; - - /* here, we really got a new pg */ - pg_count++; - path_count = 1; - memset(&path_buff, 0, FILE_NAME_SIZE * sizeof(char)); - path_buff_p = &path_buff[0]; - - path_buff_p += sprintf(path_buff_p, " %s", all_paths[mp->pindex[i]].dev); - bitmap[i] = 1; - - for (k = i + 1; k <= mp->npaths; k++) { - if (bitmap[k]) - continue; - if (0 == strcmp(all_paths[mp->pindex[i]].serial, - all_paths[mp->pindex[k]].serial)) { - path_buff_p += sprintf(path_buff_p, " %s", all_paths[mp->pindex[k]].dev); - bitmap[k] = 1; - path_count++; - } - } - pg_buff_p += sprintf(pg_buff_p, " 1 round-robin %i 0%s", - path_count, path_buff); - } - sprintf(str, " %i%s", pg_count, pg_buff); - free(bitmap); -} - -static int -dm_simplecmd(int task, const char *name) { - int r = 0; - struct dm_task *dmt; - - if (!(dmt = dm_task_create(task))) - return 0; - - if (!dm_task_set_name(dmt, name)) - goto out; - - r = dm_task_run(dmt); - - out: - dm_task_destroy(dmt); - return r; -} - -static int -dm_addmap(int task, const char *name, const char *params, long size) { - struct dm_task *dmt; - - if (!(dmt = dm_task_create(task))) - return 0; - - if (!dm_task_set_name(dmt, name)) - goto addout; - - if (!dm_task_add_target(dmt, 0, size, DM_TARGET, params)) - goto addout; - - if (!dm_task_run(dmt)) - goto addout; - - addout: - dm_task_destroy(dmt); - return 1; -} - -static int -setup_map(struct env * conf, struct path * all_paths, - struct multipath * mp, int index, int op) -{ - char params[255]; - char * params_p; - int i, np; - - /* defaults for multipath target */ - int dm_pg_prio = 1; - char * dm_ps_name = "round-robin"; - int dm_ps_nr_args = 0; - - params_p = ¶ms[0]; - - np = 0; - for (i=0; i<=mp[index].npaths; i++) { - if (0 == all_paths[PINDEX(index,i)].sg_id.scsi_type) - np++; - } - - if (np < 1) - return 0; - - if ((all_paths[PINDEX(index,0)].iopolicy == MULTIBUS && - conf->iopolicy == -1) || conf->iopolicy == MULTIBUS) { - params_p += sprintf(params_p, " 1 %i %s %i %i", - dm_pg_prio, dm_ps_name, np, dm_ps_nr_args); - - for (i=0; i<=mp[index].npaths; i++) { - if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) - continue; - params_p += sprintf(params_p, " %s", - all_paths[PINDEX(index,i)].dev); - } - } - - if ((all_paths[PINDEX(index,0)].iopolicy == FAILOVER && - conf->iopolicy == -1) || conf->iopolicy == FAILOVER) { - params_p += sprintf(params_p, " %i", mp[index].npaths + 1); - for (i=0; i<=mp[index].npaths; i++) { - if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) - continue; - params_p += sprintf(params_p, " %i %s ", - dm_pg_prio, dm_ps_name); - params_p += sprintf(params_p, "1 %i", - dm_ps_nr_args); - params_p += sprintf(params_p, " %s", - all_paths[PINDEX(index,i)].dev); - } - } - - if ((all_paths[PINDEX(index,0)].iopolicy == GROUP_BY_SERIAL && - conf->iopolicy == -1) || conf->iopolicy == GROUP_BY_SERIAL) { - group_by_serial(&mp[index], all_paths, params_p); - } - - if (mp[index].size < 0) - return 0; - - if (!conf->quiet) { - if (op == DM_DEVICE_RELOAD) - printf("U:"); - if (op == DM_DEVICE_CREATE) - printf("N:"); - printf("%s:0 %li %s %s\n", - mp[index].wwid, mp[index].size, DM_TARGET, params); - } - - if (op == DM_DEVICE_RELOAD) - dm_simplecmd(DM_DEVICE_SUSPEND, mp[index].wwid); - - dm_addmap(op, mp[index].wwid, params, mp[index].size); - - if (op == DM_DEVICE_RELOAD) - dm_simplecmd(DM_DEVICE_RESUME, mp[index].wwid); - - return 1; -} - -static int -map_present(char * str) -{ - int r = 0; - struct dm_task *dmt; - struct dm_names *names; - unsigned next = 0; - - if (!(dmt = dm_task_create(DM_DEVICE_LIST))) - return 0; - - if (!dm_task_run(dmt)) - goto out; - - if (!(names = dm_task_get_names(dmt))) - goto out; - - if (!names->dev) { - goto out; - } - - do { - if (0 == strcmp(names->name, str)) - r = 1; - next = names->next; - names = (void *) names + next; - } while (next); - - out: - dm_task_destroy(dmt); - return r; -} - -static void -usage(char * progname) -{ - fprintf(stderr, VERSION_STRING); - fprintf(stderr, "Usage: %s [-v|-q] [-d] [-m max_devs]", - progname); - fprintf(stderr, "[-p failover|multibus|group_by_serial] [device]\n"); - fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n"); - fprintf(stderr, "\t-q\t\tquiet, no output at all\n"); - fprintf(stderr, "\t-d\t\tdry run, do not create or update devmaps\n"); - fprintf(stderr, "\t-m max_devs\tscan {max_devs} devices at most\n"); - fprintf(stderr, "\t-p policy\tforce maps to specified policy :\n"); - fprintf(stderr, "\t failover\t\t- 1 path per priority group\n"); - fprintf(stderr, "\t multibus\t\t- all paths in 1 priority group\n"); - fprintf(stderr, "\t group_by_serial\t- 1 priority group per serial\n"); - fprintf(stderr, "\tdevice\t\tlimit scope to the device's multipath\n"); - fprintf(stderr, "\t\t\t(hotplug-style $DEVPATH reference)\n"); - exit(1); -} - -int -main(int argc, char *argv[]) -{ - struct multipath * mp; - struct path * all_paths; - struct scsi_dev * all_scsi_ids; - struct env conf; - int i, k, nmp; - - /* Default behaviour */ - conf.max_devs = MAX_DEVS; - conf.dry_run = 0; /* 1 == Do not Create/Update devmaps */ - conf.verbose = 0; /* 1 == Print all_paths and mp */ - conf.quiet = 0; /* 1 == Do not even print devmaps */ - conf.iopolicy = -1; /* Apply the defaults in get_unique_id() */ - - for (i = 1; i < argc; ++i) { - if (0 == strcmp("-v", argv[i])) { - if (conf.quiet == 1) - usage(argv[0]); - conf.verbose = 1; - } else if (0 == strcmp("-m", argv[i])) { - conf.max_devs = atoi(argv[++i]); - if (conf.max_devs < 2) - usage(argv[0]); - } else if (0 == strcmp("-q", argv[i])) { - if (conf.verbose == 1) - usage(argv[0]); - conf.quiet = 1; - } else if (0 == strcmp("-d", argv[i])) - conf.dry_run = 1; - else if (0 == strcmp("-p", argv[i])) { - i++; - if (!strcmp(argv[i], "failover")) - conf.iopolicy = FAILOVER; - if (!strcmp(argv[i], "multibus")) - conf.iopolicy = MULTIBUS; - if (!strcmp(argv[i], "group_by_serial")) - conf.iopolicy = GROUP_BY_SERIAL; - } else if (*argv[i] == '-') { - fprintf(stderr, "Unknown switch: %s\n", argv[i]); - usage(argv[0]); - } else - strncpy(conf.hotplugdev, argv[i], FILE_NAME_SIZE); - } - - /* dynamic allocations */ - mp = malloc(conf.max_devs * sizeof(struct multipath)); - all_paths = malloc(conf.max_devs * sizeof(struct path)); - all_scsi_ids = malloc(conf.max_devs * sizeof(struct scsi_dev)); - if (mp == NULL || all_paths == NULL || all_scsi_ids == NULL) - exit(1); - - if (sysfs_get_mnt_path(conf.sysfs_path, FILE_NAME_SIZE)) { - get_all_scsi_ids(&conf, all_scsi_ids); - get_all_paths_nosysfs(&conf, all_paths, all_scsi_ids); - } else { - get_all_paths_sysfs(&conf, all_paths); - } - nmp = coalesce_paths(&conf, mp, all_paths); - - if (conf.verbose) { - print_all_path(&conf, all_paths); - fprintf(stdout, "\n"); - print_all_mp(all_paths, mp, nmp); - fprintf(stdout, "\n"); - } - - if (conf.dry_run) - exit(0); - - for (k=0; k<=nmp; k++) { - if (map_present(mp[k].wwid)) { - setup_map(&conf, all_paths, mp, k, DM_DEVICE_RELOAD); - } else { - setup_map(&conf, all_paths, mp, k, DM_DEVICE_CREATE); - } - } - - /* free allocs */ - free(mp); - free(all_paths); - free(all_scsi_ids); - - exit(0); -} diff --git a/extras/multipath/main.h b/extras/multipath/main.h deleted file mode 100644 index cee99d2b88..0000000000 --- a/extras/multipath/main.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Soft: Description here... - * - * Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $ - * - * Author: Copyright (C) 2003 Christophe Varoqui - * - * 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. - * - * 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; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifndef _MAIN_H -#define _MAIN_H - -/* local includes */ -#include "sg_include.h" - -/* exerpt from "sg_err.h" */ -#define SCSI_CHECK_CONDITION 0x2 -#define SCSI_COMMAND_TERMINATED 0x22 -#define SG_ERR_DRIVER_SENSE 0x08 - -/* exerpt from "scsi.h" */ -#define SCSI_IOCTL_GET_IDLUN 0x5382 -#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 - -/* global defs */ -#define WWID_SIZE 33 -#define SERIAL_SIZE 14 -#define MAX_DEVS 128 -#define MAX_MP MAX_DEVS / 2 -#define MAX_MP_PATHS MAX_DEVS / 4 -#define FILE_NAME_SIZE 256 -#define DEF_TIMEOUT 60000 -#define EBUFF_SZ 256 -#define TUR_CMD_LEN 6 -#define DM_TARGET "multipath" - -/* Storage controlers cpabilities */ -#define FAILOVER 0 -#define MULTIBUS 1 -#define GROUP_BY_SERIAL 2 - -#define PINDEX(x,y) mp[(x)].pindex[(y)] - -/* global types */ -struct scsi_idlun { - int dev_id; - int host_unique_id; - int host_no; -}; - -struct sg_id { - int host_no; - int channel; - int scsi_id; - int lun; - int scsi_type; - short h_cmd_per_lun; - short d_queue_depth; - int unused1; - int unused2; -}; - -struct scsi_dev { - char dev[FILE_NAME_SIZE]; - struct scsi_idlun scsi_id; - int host_no; -}; - -struct path { - char dev[FILE_NAME_SIZE]; - char sg_dev[FILE_NAME_SIZE]; - struct scsi_idlun scsi_id; - struct sg_id sg_id; - char wwid[WWID_SIZE]; - char vendor_id[8]; - char product_id[16]; - char rev[4]; - char serial[SERIAL_SIZE]; - int iopolicy; -}; - -struct multipath { - char wwid[WWID_SIZE]; - int npaths; - long size; - int pindex[MAX_MP_PATHS]; -}; - -struct env { - int max_devs; - int verbose; - int quiet; - int dry_run; - int iopolicy; - int with_sysfs; - char sysfs_path[FILE_NAME_SIZE]; - char hotplugdev[FILE_NAME_SIZE]; -}; - -/* Build version */ -#define PROG "multipath" - -#define VERSION_CODE 0x000012 -#define DATE_CODE 0x021504 - -#define MULTIPATH_VERSION(version) \ - (version >> 16) & 0xFF, \ - (version >> 8) & 0xFF, \ - version & 0xFF - -#define VERSION_STRING PROG" v%d.%d.%d (%.2d/%.2d, 20%.2d)\n", \ - MULTIPATH_VERSION(VERSION_CODE), \ - MULTIPATH_VERSION(DATE_CODE) - -#endif diff --git a/extras/multipath/multipath.8 b/extras/multipath/multipath.8 deleted file mode 100644 index 98746424b4..0000000000 --- a/extras/multipath/multipath.8 +++ /dev/null @@ -1,53 +0,0 @@ -.TH MULTIPATH 8 "February 2004" "" "Linux Administrator's Manual" -.SH NAME -multipath \- Device mapper target autoconfig -.SH SYNOPSIS -.B multipath -.RB [\| \-v | \-q \|] -.RB [\| \-d \|] -.RB [\| \-m\ \c -.IR max_devs \|] -.RB [\| \-p\ \c -.BR failover | multibus | group_by_serial \|] -.RB [\| device \|] -.SH DESCRIPTION -.B multipath -is used to detect multiple paths to devices for fail-over or performance reasons and coalesces them. -.SH OPTIONS -.TP -.B \-v -verbose, print all paths and multipaths -.TP -.B \-q -quiet, no output at all -.TP -.B \-d -dry run, do not create or update devmaps -.TP -.BI \-m " max_devs" -scan -.I max_devs -devices at most -.TP -.BI \-p " policy" -force maps to specified policy: -.RS 1.2i -.TP 1.2i -.B failover -1 path per priority group -.TP -.B multibus -all paths in 1 priority group -.TP -.B group_by_serial -1 priority group per serial -.RE -.TP -.B device -limit the [re]configuration to the specified device's multipath scope. device is given in its hotplug $DEVPATH form like /devices/pci0000:03/0000:03:01.0/host0/0:0:5:1 -.SH "SEE ALSO" -.BR udev (8), -.BR dmsetup (8) -.SH AUTHORS -.B multipath -was developed by Christophe Varoqui, and others. diff --git a/extras/multipath/multipath.hotplug b/extras/multipath/multipath.hotplug deleted file mode 100644 index 9f44f86c9b..0000000000 --- a/extras/multipath/multipath.hotplug +++ /dev/null @@ -1,7 +0,0 @@ -#!bin/sh -. /etc/hotplug/hotplug.functions - -# wait for sysfs -sleep 1 - -mesg `/sbin/multipath $DEVPATH` diff --git a/extras/multipath/sg_err.h b/extras/multipath/sg_err.h deleted file mode 100644 index ef57b5ce38..0000000000 --- a/extras/multipath/sg_err.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef SG_ERR_H -#define SG_ERR_H - -/* Feel free to copy and modify this GPL-ed code into your applications. */ - -/* Version 0.90 (20030519) -*/ - - -/* Some of the following error/status codes are exchanged between the - various layers of the SCSI sub-system in Linux and should never - reach the user. They are placed here for completeness. What appears - here is copied from drivers/scsi/scsi.h which is not visible in - the user space. */ - -#ifndef SCSI_CHECK_CONDITION -/* Following are the "true" SCSI status codes. Linux has traditionally - used a 1 bit right and masked version of these. So now CHECK_CONDITION - and friends (in ) are deprecated. */ -#define SCSI_CHECK_CONDITION 0x2 -#define SCSI_CONDITION_MET 0x4 -#define SCSI_BUSY 0x8 -#define SCSI_IMMEDIATE 0x10 -#define SCSI_IMMEDIATE_CONDITION_MET 0x14 -#define SCSI_RESERVATION_CONFLICT 0x18 -#define SCSI_COMMAND_TERMINATED 0x22 -#define SCSI_TASK_SET_FULL 0x28 -#define SCSI_ACA_ACTIVE 0x30 -#define SCSI_TASK_ABORTED 0x40 -#endif - -/* The following are 'host_status' codes */ -#ifndef DID_OK -#define DID_OK 0x00 -#endif -#ifndef DID_NO_CONNECT -#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ -#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ -#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ -#define DID_BAD_TARGET 0x04 /* Bad target (id?) */ -#define DID_ABORT 0x05 /* Told to abort for some other reason */ -#define DID_PARITY 0x06 /* Parity error (on SCSI bus) */ -#define DID_ERROR 0x07 /* Internal error */ -#define DID_RESET 0x08 /* Reset by somebody */ -#define DID_BAD_INTR 0x09 /* Received an unexpected interrupt */ -#define DID_PASSTHROUGH 0x0a /* Force command past mid-level */ -#define DID_SOFT_ERROR 0x0b /* The low-level driver wants a retry */ -#endif - -/* These defines are to isolate applictaions from kernel define changes */ -#define SG_ERR_DID_OK DID_OK -#define SG_ERR_DID_NO_CONNECT DID_NO_CONNECT -#define SG_ERR_DID_BUS_BUSY DID_BUS_BUSY -#define SG_ERR_DID_TIME_OUT DID_TIME_OUT -#define SG_ERR_DID_BAD_TARGET DID_BAD_TARGET -#define SG_ERR_DID_ABORT DID_ABORT -#define SG_ERR_DID_PARITY DID_PARITY -#define SG_ERR_DID_ERROR DID_ERROR -#define SG_ERR_DID_RESET DID_RESET -#define SG_ERR_DID_BAD_INTR DID_BAD_INTR -#define SG_ERR_DID_PASSTHROUGH DID_PASSTHROUGH -#define SG_ERR_DID_SOFT_ERROR DID_SOFT_ERROR - -/* The following are 'driver_status' codes */ -#ifndef DRIVER_OK -#define DRIVER_OK 0x00 -#endif -#ifndef DRIVER_BUSY -#define DRIVER_BUSY 0x01 -#define DRIVER_SOFT 0x02 -#define DRIVER_MEDIA 0x03 -#define DRIVER_ERROR 0x04 -#define DRIVER_INVALID 0x05 -#define DRIVER_TIMEOUT 0x06 -#define DRIVER_HARD 0x07 -#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ - -/* Following "suggests" are "or-ed" with one of previous 8 entries */ -#define SUGGEST_RETRY 0x10 -#define SUGGEST_ABORT 0x20 -#define SUGGEST_REMAP 0x30 -#define SUGGEST_DIE 0x40 -#define SUGGEST_SENSE 0x80 -#define SUGGEST_IS_OK 0xff -#endif -#ifndef DRIVER_MASK -#define DRIVER_MASK 0x0f -#endif -#ifndef SUGGEST_MASK -#define SUGGEST_MASK 0xf0 -#endif - -/* These defines are to isolate applictaions from kernel define changes */ -#define SG_ERR_DRIVER_OK DRIVER_OK -#define SG_ERR_DRIVER_BUSY DRIVER_BUSY -#define SG_ERR_DRIVER_SOFT DRIVER_SOFT -#define SG_ERR_DRIVER_MEDIA DRIVER_MEDIA -#define SG_ERR_DRIVER_ERROR DRIVER_ERROR -#define SG_ERR_DRIVER_INVALID DRIVER_INVALID -#define SG_ERR_DRIVER_TIMEOUT DRIVER_TIMEOUT -#define SG_ERR_DRIVER_HARD DRIVER_HARD -#define SG_ERR_DRIVER_SENSE DRIVER_SENSE -#define SG_ERR_SUGGEST_RETRY SUGGEST_RETRY -#define SG_ERR_SUGGEST_ABORT SUGGEST_ABORT -#define SG_ERR_SUGGEST_REMAP SUGGEST_REMAP -#define SG_ERR_SUGGEST_DIE SUGGEST_DIE -#define SG_ERR_SUGGEST_SENSE SUGGEST_SENSE -#define SG_ERR_SUGGEST_IS_OK SUGGEST_IS_OK -#define SG_ERR_DRIVER_MASK DRIVER_MASK -#define SG_ERR_SUGGEST_MASK SUGGEST_MASK - - - -/* The following "print" functions send ACSII to stdout */ -extern void sg_print_command(const unsigned char * command); -extern void sg_print_sense(const char * leadin, - const unsigned char * sense_buffer, int sb_len); -extern void sg_print_status(int masked_status); -extern void sg_print_scsi_status(int scsi_status); -extern void sg_print_host_status(int host_status); -extern void sg_print_driver_status(int driver_status); - -/* sg_chk_n_print() returns 1 quietly if there are no errors/warnings - else it prints to standard output and returns 0. */ -extern int sg_chk_n_print(const char * leadin, int masked_status, - int host_status, int driver_status, - const unsigned char * sense_buffer, int sb_len); - -/* The following function declaration is for the sg version 3 driver. - Only version 3 sg_err.c defines it. */ -struct sg_io_hdr; -extern int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp); - - -/* The following "category" function returns one of the following */ -#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ -#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ -#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ -#define SG_ERR_CAT_TIMEOUT 3 -#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ -#define SG_ERR_CAT_SENSE 98 /* Something else is in the sense buffer */ -#define SG_ERR_CAT_OTHER 99 /* Some other error/warning has occurred */ - -extern int sg_err_category(int masked_status, int host_status, - int driver_status, const unsigned char * sense_buffer, - int sb_len); - -extern int sg_err_category_new(int scsi_status, int host_status, - int driver_status, const unsigned char * sense_buffer, - int sb_len); - -/* The following function declaration is for the sg version 3 driver. - Only version 3 sg_err.c defines it. */ -extern int sg_err_category3(struct sg_io_hdr * hp); - -/* Returns length of SCSI command given the opcode (first byte) */ -extern int sg_get_command_size(unsigned char opcode); - -extern void sg_get_command_name(unsigned char opcode, int buff_len, - char * buff); - -#endif diff --git a/extras/multipath/sg_include.h b/extras/multipath/sg_include.h deleted file mode 100644 index 460506826e..0000000000 --- a/extras/multipath/sg_include.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifdef SG_KERNEL_INCLUDES - #define __user - typedef unsigned char u8; - #include "/usr/src/linux/include/scsi/sg.h" - #include "/usr/src/linux/include/scsi/scsi.h" -#else - #ifdef SG_TRICK_GNU_INCLUDES - #include - #include - #else - #include - #endif -#endif - -/* - Getting the correct include files for the sg interface can be an ordeal. - In a perfect world, one would just write: - #include - #include - This would include the files found in the /usr/include/scsi directory. - Those files are maintained with the GNU library which may or may not - agree with the kernel and version of sg driver that is running. Any - many cases this will not matter. However in some it might, for example - glibc 2.1's include files match the sg driver found in the lk 2.2 - series. Hence if glibc 2.1 is used with lk 2.4 then the additional - sg v3 interface will not be visible. - If this is a problem then defining SG_KERNEL_INCLUDES will access the - kernel supplied header files (assuming they are in the normal place). - The GNU library maintainers and various kernel people don't like - this approach (but it does work). - The technique selected by defining SG_TRICK_GNU_INCLUDES worked (and - was used) prior to glibc 2.2 . Prior to that version /usr/include/linux - was a symbolic link to /usr/src/linux/include/linux . - - There are other approaches if this include "mixup" causes pain. These - would involve include files being copied or symbolic links being - introduced. - - Sorry about the inconvenience. Typically neither SG_KERNEL_INCLUDES - nor SG_TRICK_GNU_INCLUDES is defined. - - dpg 20010415, 20030522 -*/ diff --git a/extras/multipath/unused.c b/extras/multipath/unused.c deleted file mode 100644 index 08144cf717..0000000000 --- a/extras/multipath/unused.c +++ /dev/null @@ -1,95 +0,0 @@ -static int -get_serial (int fd, char * str) -{ - char buff[MX_ALLOC_LEN + 1]; - int len; - - if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { - len = buff[3]; - if (len > 0) { - memcpy(str, buff + 4, len); - buff[len] = '\0'; - } - return 1; - } - return 0; -} - -static int -do_tur(int fd) -{ - unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; - struct sg_io_hdr io_hdr; - unsigned char sense_buffer[32]; - - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof (turCmdBlk); - io_hdr.mx_sb_len = sizeof (sense_buffer); - io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; - io_hdr.sbp = sense_buffer; - io_hdr.timeout = 20000; - io_hdr.pack_id = 0; - if (ioctl(fd, SG_IO, &io_hdr) < 0) { - close(fd); - return 0; - } - if (io_hdr.info & SG_INFO_OK_MASK) { - return 0; - } - return 1; -} - -static int -del_map(char * str) { - struct dm_task *dmt; - - if (!(dmt = dm_task_create(DM_DEVICE_REMOVE))) - return 0; - if (!dm_task_set_name(dmt, str)) - goto delout; - if (!dm_task_run(dmt)) - goto delout; - - printf("Deleted device map : %s\n", str); - - delout: - dm_task_destroy(dmt); - return 1; -} - -get_table(const char * str) -{ - int r = 0; - struct dm_task *dmt; - void *next = NULL; - uint64_t start, length; - char *target_type = NULL; - char *params; - - if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) - return 0; - - if (!dm_task_set_name(dmt, str)) - goto out; - - if (!dm_task_run(dmt)) - goto out; - - do { - next = dm_get_next_target(dmt, next, &start, &length, - &target_type, ¶ms); - if (target_type) { - printf("%" PRIu64 " %" PRIu64 " %s %s\n", - start, length, target_type, params); - } - } while (next); - - r = 1; - - out: - dm_task_destroy(dmt); - return r; - -} -- cgit v1.2.3-54-g00ecf From a3b37a073d52ff01d4ef023a10f13316da4c9966 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Mar 2004 22:40:39 -0800 Subject: [PATCH] Added multipath-tools 0.1.1 release --- extras/multipath-tools/AUTHOR | 1 + extras/multipath-tools/COPYING | 483 +++++++++ extras/multipath-tools/ChangeLog | 137 +++ extras/multipath-tools/Makefile | 41 + extras/multipath-tools/README | 90 ++ extras/multipath-tools/VERSION | 1 + extras/multipath-tools/devmap_name/Makefile | 47 + extras/multipath-tools/devmap_name/devmap_name.8 | 30 + extras/multipath-tools/devmap_name/devmap_name.c | 60 ++ extras/multipath-tools/libdevmapper/Makefile | 28 + .../libdevmapper/ioctl/libdevmapper.c | 1092 ++++++++++++++++++++ .../libdevmapper/ioctl/libdm-compat.h | 111 ++ .../libdevmapper/ioctl/libdm-targets.h | 51 + extras/multipath-tools/libdevmapper/libdevmapper.h | 147 +++ extras/multipath-tools/libdevmapper/libdm-common.c | 382 +++++++ extras/multipath-tools/libdevmapper/libdm-common.h | 38 + extras/multipath-tools/libdevmapper/list.h | 99 ++ extras/multipath-tools/multipath/Makefile | 60 ++ extras/multipath-tools/multipath/devinfo.c | 240 +++++ extras/multipath-tools/multipath/devinfo.h | 21 + extras/multipath-tools/multipath/main.c | 895 ++++++++++++++++ extras/multipath-tools/multipath/main.h | 131 +++ extras/multipath-tools/multipath/multipath.8 | 66 ++ extras/multipath-tools/multipath/multipath.hotplug | 7 + extras/multipath-tools/multipath/sg_err.h | 162 +++ extras/multipath-tools/multipath/sg_include.h | 43 + extras/multipath-tools/multipath/unused.c | 95 ++ extras/multipath-tools/multipathd/Makefile | 31 + extras/multipath-tools/multipathd/checkers.c | 62 ++ extras/multipath-tools/multipathd/checkers.h | 2 + extras/multipath-tools/multipathd/devinfo.c | 82 ++ extras/multipath-tools/multipathd/devinfo.h | 15 + extras/multipath-tools/multipathd/main.c | 674 ++++++++++++ extras/multipath-tools/multipathd/multipathd.init | 42 + extras/multipath-tools/multipathd/sg_include.h | 43 + 35 files changed, 5509 insertions(+) create mode 100644 extras/multipath-tools/AUTHOR create mode 100644 extras/multipath-tools/COPYING create mode 100644 extras/multipath-tools/ChangeLog create mode 100644 extras/multipath-tools/Makefile create mode 100644 extras/multipath-tools/README create mode 100644 extras/multipath-tools/VERSION create mode 100644 extras/multipath-tools/devmap_name/Makefile create mode 100644 extras/multipath-tools/devmap_name/devmap_name.8 create mode 100644 extras/multipath-tools/devmap_name/devmap_name.c create mode 100644 extras/multipath-tools/libdevmapper/Makefile create mode 100644 extras/multipath-tools/libdevmapper/ioctl/libdevmapper.c create mode 100644 extras/multipath-tools/libdevmapper/ioctl/libdm-compat.h create mode 100644 extras/multipath-tools/libdevmapper/ioctl/libdm-targets.h create mode 100644 extras/multipath-tools/libdevmapper/libdevmapper.h create mode 100644 extras/multipath-tools/libdevmapper/libdm-common.c create mode 100644 extras/multipath-tools/libdevmapper/libdm-common.h create mode 100644 extras/multipath-tools/libdevmapper/list.h create mode 100644 extras/multipath-tools/multipath/Makefile create mode 100644 extras/multipath-tools/multipath/devinfo.c create mode 100644 extras/multipath-tools/multipath/devinfo.h create mode 100644 extras/multipath-tools/multipath/main.c create mode 100644 extras/multipath-tools/multipath/main.h create mode 100644 extras/multipath-tools/multipath/multipath.8 create mode 100644 extras/multipath-tools/multipath/multipath.hotplug create mode 100644 extras/multipath-tools/multipath/sg_err.h create mode 100644 extras/multipath-tools/multipath/sg_include.h create mode 100644 extras/multipath-tools/multipath/unused.c create mode 100644 extras/multipath-tools/multipathd/Makefile create mode 100644 extras/multipath-tools/multipathd/checkers.c create mode 100644 extras/multipath-tools/multipathd/checkers.h create mode 100644 extras/multipath-tools/multipathd/devinfo.c create mode 100644 extras/multipath-tools/multipathd/devinfo.h create mode 100644 extras/multipath-tools/multipathd/main.c create mode 100644 extras/multipath-tools/multipathd/multipathd.init create mode 100644 extras/multipath-tools/multipathd/sg_include.h diff --git a/extras/multipath-tools/AUTHOR b/extras/multipath-tools/AUTHOR new file mode 100644 index 0000000000..4e8eeef5c8 --- /dev/null +++ b/extras/multipath-tools/AUTHOR @@ -0,0 +1 @@ +Christophe Varoqui, diff --git a/extras/multipath-tools/COPYING b/extras/multipath-tools/COPYING new file mode 100644 index 0000000000..9e31bbf0b3 --- /dev/null +++ b/extras/multipath-tools/COPYING @@ -0,0 +1,483 @@ + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, + MA 02111-1307, USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/extras/multipath-tools/ChangeLog b/extras/multipath-tools/ChangeLog new file mode 100644 index 0000000000..0807a42678 --- /dev/null +++ b/extras/multipath-tools/ChangeLog @@ -0,0 +1,137 @@ +2004-03-06 multipath-tools-0.1.1 + * include dlist.h in multipath main.c (PM Hahn) + * typo in hotplug script (PM Hahn) + * pass -9 opt to gzip for manpages (PM Hahn) +2004-03-05 multipath-tools-0.1.0 + * add the group_by_tur policy + * add the multipathd daemon for pathchecking & DM hot-reconfig + * multipath doesn't run twice + * massive cleanups, and code restructuring + * Avoid Kernel Bug when passing too small a buffer in do_inq() + * Sync with 2.6.3-udm4 target synthax (no more PG prio) +2004-02-21 multipath-018 + * From the Debian SID inclusion review (Philipp Matthias Hahn) + * use DESTDIR install prefix in the Makefile + * add man pages for devmap_name & multipath + * correct libsysfs.h includes + * fork the hotplug script in its own shell + * Sync with the kernel device mapper code as of 2.6.3-udm3 + ie. Remove the test interval parameter and its uses + * Remove superfluous scsi parameter passed from hotplug + * Add the man pages to the [un]install targets +2004-02-17 multipath-017 + * remove the restrictive -f flag. + Introduce a more generic "-m iopolicy" one. + * remove useless "int with_sysfs" in env struct +2004-02-04 multipath-016 + * add a GROUP_BY_SERIAL flag. This should be useful for + controlers that activate they spare paths on simple IO + submition with a penalty. The StorageWorks HW defaults to + this mode, even if the MULTIBUS mode is OK. + * remove unused sg_err.c + * big restructuring : split devinfo.c from main.c. Export : + * void basename (char *, char *); + * int get_serial (int, char *); + * int get_lun_strings (char *, char *, char *, char *); + * int get_evpd_wwid(char *, char *); + * long get_disk_size (char *); + * stop passing struct env as param + * add devmap_name proggy for udev to name devmaps as per their + internal DM name and not only by their sysfs enum name (dm-*) + The corresponding udev.rules line is : + KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" + * remove make_dm_node fn & call. Rely on udev for this. + * don't rely on the linux symlink in the udev/klibc dir since + udev build doesn't use it anymore. This corrects build breakage +2004-01-19 multipath-013 + * update the DM target synthax to the 2.6.0-udm5 style +2003-12-29 multipath-012 + * check hotplug event refers to a block device; if not exit early + * refresh doc + * add the uninstall target in Makefile +2003-12-22 multipath-010 + * tweak the install target in Makefile + * stop passing fds as argument : this change enable a strict + segregation of ugly 2.4 code + * sysfs version of get_lun_strings() + * be careful about the return of get_unique_id() since errors + formerly caught up by if(open()) in the caller fn are now returned + by get_unique_id() + * send get_serial() in unused.c + * introduce dm-simplecmd for RESUME & SUSPEND requests + * split add_map() in setup_map() & dm-addmap() + * setup_map() correctly submits "SUSPEND-RELOAD-RESUME or CREATE" + sequences instead of the bogus "RELOAD or CREATE" + * don't print .sg_dev if equal to .dev (2.6) in print_path() + * since the kernel code handles defective paths, remove all + code to cope with them : + * move do_tur() to unused.c + * remove .state from path struct + * remove .state settings & conditionals + * add a cmdline switch to force maps to failover mode, + ie 1 path per priority group + * add default policies to the whitelist array (spread io == + MULTIBUS / io forced to 1 path == FAILOVER) + * move get_disk_size() call out of add_map() to coalesce() + * comment tricky coalesce() fn + * bogus unsused.c file renamed to unused.c +2003-12-20 multipath-010 + * big ChangeLog update + * start to give a little control over target params : + introduce cmdline arg -i to control polling interval + * cope with hotplug-style calling convention : + ie "multipath scsi $DEVPATH" ... to avoid messing with + online maps not concerned by an event + * example hotplug agent to drop in /etc/hotplug.d/scsi + * revert the run & resched patch : unless someone proves me + wrong, this was overdesigned + * move commented out functions in unused.c + * update multipath target params to "udm[23] style" + * mp target now supports nr_path == 1, so do we + * add gratuitous free() + * push version forward +2003-12-15 multipath-009 + * Make the HW-specific get_unique_id switch pretty + * Prepare to field-test by whitelisting all known fibre array, + try to fetch WWID from the standard EVPD 0x83 off 8 for everyone + * configure the multipath target with round-robin path selector and + conservative default for a start (udm1 style) : + yes it makes this release the firstreally useful one. + * temporarily disable map creation for single path device + due to current restrictive defaults in the kernel target. + Sistina should work it out. + * correct the strncmp logic in blacklist function. + * update the Makefiles to autodetect libgcc.a & gcc includes + "ulibc-style". Factorisation of udevdirs & others niceties + * drop a hint about absent /dev/sd? on failed open() + * implement a reschedule flag in /var/run. + Last thing the prog do before exit is check if a call to multipath + was done (but canceled by /var/run/multipath.run check) during its + execution. If so restart themain loop. + * implement a blacklist of sysfs bdev to not bother with for now + (hd,md, dm, sr, scd, ram, raw). + This avoid sending SG_IO to unappropiate devices. + * Adds a /var/run/multipath.run handling to avoid simultaneous runs. + * Remove a commented-out "printf" + * drop a libdevmapper copy in extras/multipath; + maybe discussions w/Sistina folks will bring a better solution in the future. + * drop a putchar usage in libdevmapper to compile cleanly with klibc + * drop another such usage of my own in main.c + * massage the Makefile to compile libdevmapper against klibc + * use "ld" to produce the binary rather than "gcc -static" + * stop being stupid w/ uneeded major, minor & dev in main.c:dm_mk_node() + * reverse to creating striped target for now because the multipath target + is more hairy than expected initialy + * push the version code to 009 to be in synch w/ udev +2003-11-27 multipath-007 + * removes sg_err.[ch] deps + * makes sure the core code play nice with klibc + * port the sysfs calls to dlist helpers + * links against udev's sysfs (need libsysfs.a & dlist.a) + * finally define DM_TARGET as "multipath" as Joe posted the code today (not tested yet) + * push version forward (do you want it in sync with udev version?) +2003-11-19 + * merged in udev-006 tree +2003-09-18 Christophe Varoqui + * multipath 0.0.1 released. + * Initial release. diff --git a/extras/multipath-tools/Makefile b/extras/multipath-tools/Makefile new file mode 100644 index 0000000000..2f21f0d112 --- /dev/null +++ b/extras/multipath-tools/Makefile @@ -0,0 +1,41 @@ +# Makefile +# +# Copyright (C) 2003 Christophe Varoqui, + +SUBDIRS = libdevmapper devmap_name multipath multipathd + +recurse: + @for dir in $(SUBDIRS); do\ + $(MAKE) -C $$dir ; \ + done + +recurse_clean: + @for dir in $(SUBDIRS); do\ + $(MAKE) -C $$dir clean ; \ + done + +recurse_install: + @for dir in $(SUBDIRS); do\ + $(MAKE) -C $$dir install ; \ + done + +recurse_uninstall: + @for dir in $(SUBDIRS); do\ + $(MAKE) -C $$dir uninstall ; \ + done + +all: recurse + @echo "" + @echo "Make complete" + +clean: recurse_clean + @echo "" + @echo "Make complete" + +install: recurse_install + @echo "" + @echo "Make complete" + +uninstall: recurse_uninstall + @echo "" + @echo "Make complete" diff --git a/extras/multipath-tools/README b/extras/multipath-tools/README new file mode 100644 index 0000000000..80945db438 --- /dev/null +++ b/extras/multipath-tools/README @@ -0,0 +1,90 @@ +Dependancies : +============== + +o libdevmapper : comes with device-mapper-XXXX.tar.gz + See www.sistina.com + This lib has been dropped in the multipath tree +o libsysfs : comes with sysutils or udev + See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ +o Linux kernel 2.6.0 with udm5 patchset + http://people.sistina.com/~thornber/dm/ +o udev + See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ + +How it works : +============== + +Fill the all_paths array. Each path store this info : + +struct path { + char dev[FILE_NAME_SIZE]; + char sg_dev[FILE_NAME_SIZE]; + struct scsi_idlun scsi_id; + struct sg_id sg_id; + int state; + char wwid[WWID_SIZE]; +}; + +scsi_id, sg_dev and sg_id are only really useful for 2.4 +kernels, for which SG cmnds must go through sg devs. +In 2.5+ we have the nice opportunity to send SG cmnds +through SCSI bdevs. + +For 2.4 compat, we pivot on idlun tupple to map sg devs +to SCSI bdevs. + +2.4 does not do device enumeration, so we must scan a +defined number of sg devs and scsi bdevs. Good enough. +In 2.5+, we rely on libsysfs (sysutils) to access to +sysfs device enums. + +the wwid is retrieved by a switch fonction. Only White +Listed HW can filled this field. For now every FC array +HW listed in kernel's devinfo.c is White Listed, assuming +the WWID is stored is the SCSI-3 standard 0x83 EVPD page. + +When all_paths is filled, we coalesce the paths and store +the result in mp array. Each mp is a struct like this : + +struct multipath { + char wwid[WWID_SIZE]; + int npaths; + int pindex[MAX_MP_PATHS]; +}; + +When mp is filled, the device maps are fed to the kernel +through libdevmapper. + +The naming of the corresponding block device is handeld +by udev with the help of the devmap_name proggy. It is +called by the following rule in /etc/udev/udev.rules : +KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \ +NAME="%k", SYMLINK="%c" + +Notes : +======= + +o On 2.4, make sure you have enough /dev/sg* nodes + (/dev/MAKEDEV if necesary). Same goes for /dev/sd* + +o path coalescing relies on a path unique id being found. + This unique id, lacking a standard method, is vendor + specific. A switch function (get_unique_id) is present + and an example function is provided for storageworks + arrays (get_evpd_wwid). Feel free to enrich + with hardware you have at hand :) + +o The kernel does NOT manage properly ghosts paths + with StorageWorks HW. Seems nobody cares after a load + of posts to linux-scsi. + +o 2.4.21 version of DM does not like even segment size. + if you enconter pbs with this, upgrade DM. + +Credits : +========= + +o Heavy cut'n paste from sg_utils. Thanks goes to D. + Gilbert. +o Light cut'n paste from dmsetup. Thanks Joe Thornber. +o Greg KH for the nice sysfs API. diff --git a/extras/multipath-tools/VERSION b/extras/multipath-tools/VERSION new file mode 100644 index 0000000000..bbdeab6222 --- /dev/null +++ b/extras/multipath-tools/VERSION @@ -0,0 +1 @@ +0.0.5 diff --git a/extras/multipath-tools/devmap_name/Makefile b/extras/multipath-tools/devmap_name/Makefile new file mode 100644 index 0000000000..a9683341b2 --- /dev/null +++ b/extras/multipath-tools/devmap_name/Makefile @@ -0,0 +1,47 @@ +# Makefile +# +# Copyright (C) 2003 Christophe Varoqui, + +EXEC = devmap_name + +prefix = +exec_prefix = ${prefix} +bindir = ${exec_prefix}/sbin +udevdir = ../../.. +klibcdir = $(udevdir)/klibc +mandir = /usr/share/man/man8 +libdmdir = ../libdevmapper + +CC = gcc +GZIP = /bin/gzip -9 -c + +GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} +KERNEL_DIR = /lib/modules/${shell uname -r}/build +CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ + -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ + -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I$(sysfsdir) -I. + +OBJS = devmap_name.o +CRT0 = $(klibcdir)/klibc/crt0.o +LIB = $(klibcdir)/klibc/libc.a +LIBGCC := $(shell $(CC) -print-libgcc-file-name ) + +DMOBJS = $(libdmdir)/libdm-common.o $(libdmdir)/ioctl/libdevmapper.o + +$(EXEC): $(OBJS) + $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(DMOBJS) $(LIB) $(LIBGCC) + strip $(EXEC) + $(GZIP) $(EXEC).8 > $(EXEC).8.gz + +clean: + rm -f core *.o $(EXEC) *.gz + +install: + install -d $(DESTDIR)$(bindir) + install -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + install -d $(DESTDIR)$(mandir) + install -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) + +uninstall: + rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)$(mandir)/$(EXEC).8.gz diff --git a/extras/multipath-tools/devmap_name/devmap_name.8 b/extras/multipath-tools/devmap_name/devmap_name.8 new file mode 100644 index 0000000000..f4f03c3ec6 --- /dev/null +++ b/extras/multipath-tools/devmap_name/devmap_name.8 @@ -0,0 +1,30 @@ +.TH DEVMAP_NAME 8 "February 2004" "" "Linux Administrator's Manual" +.SH NAME +devmap_name \- Query device-mapper name +.SH SYNOPSIS +.BI devmap_name " major minor" +.SH DESCRIPTION +.B devmap_name +queries the device-mapper for the name for the device +specified by +.I major +and +.I minor +number. +.br +.B devmap_name +can be called from +.B udev +by the following rule in +.IR /etc/udev/udev.rules : +.sp +.nf +KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \\ + NAME="%k", SYMLINK="%c" +.fi +.SH "SEE ALSO" +.BR udev (8), +.BR dmsetup (8) +.SH AUTHORS +.B devmap_name +was developed by Christophe Varoqui, and others. diff --git a/extras/multipath-tools/devmap_name/devmap_name.c b/extras/multipath-tools/devmap_name/devmap_name.c new file mode 100644 index 0000000000..0932e4f8bb --- /dev/null +++ b/extras/multipath-tools/devmap_name/devmap_name.c @@ -0,0 +1,60 @@ +#include +#include +#include +#include + +#include "../libdevmapper/libdevmapper.h" + +static void usage(char * progname) { + fprintf(stderr, "usage : %s major minor\n", progname); + exit(1); +} + +int main(int argc, char **argv) +{ + int r = 0; + struct dm_names *names; + unsigned next = 0; + int major, minor; + + /* sanity check */ + if (argc != 3) + usage(argv[0]); + + major = atoi(argv[1]); + minor = atoi(argv[2]); + + struct dm_task *dmt; + + if (!(dmt = dm_task_create(DM_DEVICE_LIST))) + return 0; + + if (!dm_task_run(dmt)) + goto out; + + if (!(names = dm_task_get_names(dmt))) + goto out; + + if (!names->dev) { + printf("No devices found\n"); + goto out; + } + + do { + names = (void *) names + next; + if ((int) MAJOR(names->dev) == major && + (int) MINOR(names->dev) == minor) { + printf("%s\n", names->name); + goto out; + } + next = names->next; + } while (next); + + /* No correspondance found */ + r = 1; + + out: + dm_task_destroy(dmt); + return r; +} + diff --git a/extras/multipath-tools/libdevmapper/Makefile b/extras/multipath-tools/libdevmapper/Makefile new file mode 100644 index 0000000000..445263caa8 --- /dev/null +++ b/extras/multipath-tools/libdevmapper/Makefile @@ -0,0 +1,28 @@ +# Makefile +# +# Copyright (C) 2003 Christophe Varoqui, + +CC = gcc +udevdir = ../../.. +klibcdir = $(udevdir)/klibc + +CC = gcc +GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} +KERNEL_DIR = /lib/modules/${shell uname -r}/build + +CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ + -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ + -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I. -Iioctl + +OBJS = ioctl/libdevmapper.o libdm-common.o + +all: $(OBJS) + @echo "" + @echo "Make complete" + +clean: + rm -f core *.o ioctl/*.o ioctl/*.so + +install: + +uninstall: diff --git a/extras/multipath-tools/libdevmapper/ioctl/libdevmapper.c b/extras/multipath-tools/libdevmapper/ioctl/libdevmapper.c new file mode 100644 index 0000000000..ac7ba0c86a --- /dev/null +++ b/extras/multipath-tools/libdevmapper/ioctl/libdevmapper.c @@ -0,0 +1,1092 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#include "libdm-targets.h" +#include "libdm-common.h" + +#ifdef DM_COMPAT +# include "libdm-compat.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef linux +# include +# include +# include +#else +# define MAJOR(x) major((x)) +# define MINOR(x) minor((x)) +# define MKDEV(x,y) makedev((x),(y)) +#endif + +/* + * Ensure build compatibility. + * The hard-coded versions here are the highest present + * in the _cmd_data arrays. + */ + +#if !((DM_VERSION_MAJOR == 1 && DM_VERSION_MINOR >= 0) || \ + (DM_VERSION_MAJOR == 4 && DM_VERSION_MINOR >= 0)) +#error The version of dm-ioctl.h included is incompatible. +#endif + +/* dm major version no for running kernel */ +static int _dm_version = DM_VERSION_MAJOR; +static int _log_suppress = 0; + +static int _control_fd = -1; +static int _version_checked = 0; +static int _version_ok = 1; + +/* + * Support both old and new major numbers to ease the transition. + * Clumsy, but only temporary. + */ +#if DM_VERSION_MAJOR == 4 && defined(DM_COMPAT) +const int _dm_compat = 1; +#else +const int _dm_compat = 0; +#endif + + +/* *INDENT-OFF* */ +static struct cmd_data _cmd_data_v4[] = { + {"create", DM_DEV_CREATE, {4, 0, 0}}, + {"reload", DM_TABLE_LOAD, {4, 0, 0}}, + {"remove", DM_DEV_REMOVE, {4, 0, 0}}, + {"remove_all", DM_REMOVE_ALL, {4, 0, 0}}, + {"suspend", DM_DEV_SUSPEND, {4, 0, 0}}, + {"resume", DM_DEV_SUSPEND, {4, 0, 0}}, + {"info", DM_DEV_STATUS, {4, 0, 0}}, + {"deps", DM_TABLE_DEPS, {4, 0, 0}}, + {"rename", DM_DEV_RENAME, {4, 0, 0}}, + {"version", DM_VERSION, {4, 0, 0}}, + {"status", DM_TABLE_STATUS, {4, 0, 0}}, + {"table", DM_TABLE_STATUS, {4, 0, 0}}, + {"waitevent", DM_DEV_WAIT, {4, 0, 0}}, + {"names", DM_LIST_DEVICES, {4, 0, 0}}, + {"clear", DM_TABLE_CLEAR, {4, 0, 0}}, + {"mknodes", DM_DEV_STATUS, {4, 0, 0}}, +}; +/* *INDENT-ON* */ + +#define ALIGNMENT_V1 sizeof(int) +#define ALIGNMENT 8 + +/* FIXME Rejig library to record & use errno instead */ +#ifndef DM_EXISTS_FLAG +# define DM_EXISTS_FLAG 0x00000004 +#endif + +static void *_align(void *ptr, unsigned int a) +{ + register unsigned long agn = --a; + + return (void *) (((unsigned long) ptr + agn) & ~agn); +} + +static int _open_control(void) +{ + char control[PATH_MAX]; + + if (_control_fd != -1) + return 1; + + snprintf(control, sizeof(control), "%s/control", dm_dir()); + + if ((_control_fd = open(control, O_RDWR)) < 0) { + log_error("%s: open failed: %s", control, strerror(errno)); + log_error("Is device-mapper driver missing from kernel?"); + return 0; + } + + return 1; +} + +void dm_task_destroy(struct dm_task *dmt) +{ + struct target *t, *n; + + for (t = dmt->head; t; t = n) { + n = t->next; + free(t->params); + free(t->type); + free(t); + } + + if (dmt->dev_name) + free(dmt->dev_name); + + if (dmt->newname) + free(dmt->newname); + + if (dmt->dmi.v4) + free(dmt->dmi.v4); + + if (dmt->uuid) + free(dmt->uuid); + + free(dmt); +} + +/* + * Protocol Version 1 compatibility functions. + */ + +#ifdef DM_COMPAT + +static int _dm_task_get_driver_version_v1(struct dm_task *dmt, char *version, + size_t size) +{ + unsigned int *v; + + if (!dmt->dmi.v1) { + version[0] = '\0'; + return 0; + } + + v = dmt->dmi.v1->version; + snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]); + return 1; +} + +/* Unmarshall the target info returned from a status call */ +static int _unmarshal_status_v1(struct dm_task *dmt, struct dm_ioctl_v1 *dmi) +{ + char *outbuf = (char *) dmi + dmi->data_start; + char *outptr = outbuf; + int32_t i; + struct dm_target_spec_v1 *spec; + + for (i = 0; i < dmi->target_count; i++) { + spec = (struct dm_target_spec_v1 *) outptr; + + if (!dm_task_add_target(dmt, spec->sector_start, + (uint64_t) spec->length, + spec->target_type, + outptr + sizeof(*spec))) + return 0; + + outptr = outbuf + spec->next; + } + + return 1; +} + +static int _dm_format_dev_v1(char *buf, int bufsize, uint32_t dev_major, + uint32_t dev_minor) +{ + int r; + + if (bufsize < 8) + return 0; + + r = snprintf(buf, bufsize, "%03x:%03x", dev_major, dev_minor); + if (r < 0 || r > bufsize - 1) + return 0; + + return 1; +} + +static int _dm_task_get_info_v1(struct dm_task *dmt, struct dm_info *info) +{ + if (!dmt->dmi.v1) + return 0; + + memset(info, 0, sizeof(*info)); + + info->exists = dmt->dmi.v1->flags & DM_EXISTS_FLAG ? 1 : 0; + if (!info->exists) + return 1; + + info->suspended = dmt->dmi.v1->flags & DM_SUSPEND_FLAG ? 1 : 0; + info->read_only = dmt->dmi.v1->flags & DM_READONLY_FLAG ? 1 : 0; + info->target_count = dmt->dmi.v1->target_count; + info->open_count = dmt->dmi.v1->open_count; + info->event_nr = 0; + info->major = MAJOR(dmt->dmi.v1->dev); + info->minor = MINOR(dmt->dmi.v1->dev); + info->live_table = 1; + info->inactive_table = 0; + + return 1; +} + +static const char *_dm_task_get_name_v1(struct dm_task *dmt) +{ + return (dmt->dmi.v1->name); +} + +static const char *_dm_task_get_uuid_v1(struct dm_task *dmt) +{ + return (dmt->dmi.v1->uuid); +} + +static struct dm_deps *_dm_task_get_deps_v1(struct dm_task *dmt) +{ + log_error("deps version 1 no longer supported by libdevmapper"); + return NULL; +} + +static struct dm_names *_dm_task_get_names_v1(struct dm_task *dmt) +{ + return (struct dm_names *) (((void *) dmt->dmi.v1) + + dmt->dmi.v1->data_start); +} + +static void *_add_target_v1(struct target *t, void *out, void *end) +{ + void *out_sp = out; + struct dm_target_spec_v1 sp; + size_t sp_size = sizeof(struct dm_target_spec_v1); + int len; + const char no_space[] = "Ran out of memory building ioctl parameter"; + + out += sp_size; + if (out >= end) { + log_error(no_space); + return NULL; + } + + sp.status = 0; + sp.sector_start = t->start; + sp.length = t->length; + strncpy(sp.target_type, t->type, sizeof(sp.target_type)); + + len = strlen(t->params); + + if ((out + len + 1) >= end) { + log_error(no_space); + + log_error("t->params= '%s'", t->params); + return NULL; + } + strcpy((char *) out, t->params); + out += len + 1; + + /* align next block */ + out = _align(out, ALIGNMENT_V1); + + sp.next = out - out_sp; + + memcpy(out_sp, &sp, sp_size); + + return out; +} + +static struct dm_ioctl_v1 *_flatten_v1(struct dm_task *dmt) +{ + const size_t min_size = 16 * 1024; + const int (*version)[3]; + + struct dm_ioctl_v1 *dmi; + struct target *t; + size_t len = sizeof(struct dm_ioctl_v1); + void *b, *e; + int count = 0; + + for (t = dmt->head; t; t = t->next) { + len += sizeof(struct dm_target_spec_v1); + len += strlen(t->params) + 1 + ALIGNMENT_V1; + count++; + } + + if (count && dmt->newname) { + log_error("targets and newname are incompatible"); + return NULL; + } + + if (dmt->newname) + len += strlen(dmt->newname) + 1; + + /* + * Give len a minimum size so that we have space to store + * dependencies or status information. + */ + if (len < min_size) + len = min_size; + + if (!(dmi = malloc(len))) + return NULL; + + memset(dmi, 0, len); + + version = &_cmd_data_v1[dmt->type].version; + + dmi->version[0] = (*version)[0]; + dmi->version[1] = (*version)[1]; + dmi->version[2] = (*version)[2]; + + dmi->data_size = len; + dmi->data_start = sizeof(struct dm_ioctl_v1); + + if (dmt->dev_name) + strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); + + if (dmt->type == DM_DEVICE_SUSPEND) + dmi->flags |= DM_SUSPEND_FLAG; + if (dmt->read_only) + dmi->flags |= DM_READONLY_FLAG; + + if (dmt->minor >= 0) { + if (dmt->major <= 0) { + log_error("Missing major number for persistent device"); + return NULL; + } + dmi->flags |= DM_PERSISTENT_DEV_FLAG; + dmi->dev = MKDEV(dmt->major, dmt->minor); + } + + if (dmt->uuid) + strncpy(dmi->uuid, dmt->uuid, sizeof(dmi->uuid)); + + dmi->target_count = count; + + b = (void *) (dmi + 1); + e = (void *) ((char *) dmi + len); + + for (t = dmt->head; t; t = t->next) + if (!(b = _add_target_v1(t, b, e))) + goto bad; + + if (dmt->newname) + strcpy(b, dmt->newname); + + return dmi; + + bad: + free(dmi); + return NULL; +} + +static int _dm_names_v1(struct dm_ioctl_v1 *dmi) +{ + const char *dev_dir = dm_dir(); + int r = 1, len; + const char *name; + struct dirent *dirent; + DIR *d; + struct dm_names *names, *old_names = NULL; + void *end = (void *) dmi + dmi->data_size; + struct stat buf; + char path[PATH_MAX]; + + if (!(d = opendir(dev_dir))) { + log_error("%s: opendir failed: %s", dev_dir, strerror(errno)); + return 0; + } + + names = (struct dm_names *) ((void *) dmi + dmi->data_start); + + names->dev = 0; /* Flags no data */ + + while ((dirent = readdir(d))) { + name = dirent->d_name; + + if (name[0] == '.' || !strcmp(name, "control")) + continue; + + if (old_names) + old_names->next = (uint32_t) ((void *) names - + (void *) old_names); + snprintf(path, sizeof(path), "%s/%s", dev_dir, name); + if (stat(path, &buf)) { + log_error("%s: stat failed: %s", path, strerror(errno)); + continue; + } + if (!S_ISBLK(buf.st_mode)) + continue; + names->dev = (uint64_t) buf.st_rdev; + names->next = 0; + len = strlen(name); + if (((void *) (names + 1) + len + 1) >= end) { + log_error("Insufficient buffer space for device list"); + r = 0; + break; + } + + strcpy(names->name, name); + + old_names = names; + names = _align((void *) ++names + len + 1, ALIGNMENT); + } + + if (closedir(d)) + log_error("%s: closedir failed: %s", dev_dir, strerror(errno)); + + return r; +} + +static int _dm_task_run_v1(struct dm_task *dmt) +{ + struct dm_ioctl_v1 *dmi; + unsigned int command; + + dmi = _flatten_v1(dmt); + if (!dmi) { + log_error("Couldn't create ioctl argument"); + return 0; + } + + if (!_open_control()) + return 0; + + if ((unsigned) dmt->type >= + (sizeof(_cmd_data_v1) / sizeof(*_cmd_data_v1))) { + log_error("Internal error: unknown device-mapper task %d", + dmt->type); + goto bad; + } + + command = _cmd_data_v1[dmt->type].cmd; + + if (dmt->type == DM_DEVICE_TABLE) + dmi->flags |= DM_STATUS_TABLE_FLAG; + + log_debug("dm %s %s %s %s", _cmd_data_v1[dmt->type].name, dmi->name, + dmi->uuid, dmt->newname ? dmt->newname : ""); + if (dmt->type == DM_DEVICE_LIST) { + if (!_dm_names_v1(dmi)) + goto bad; + } else if (ioctl(_control_fd, command, dmi) < 0) { + if (_log_suppress) + log_verbose("device-mapper ioctl cmd %d failed: %s", + _IOC_NR(command), strerror(errno)); + else + log_error("device-mapper ioctl cmd %d failed: %s", + _IOC_NR(command), strerror(errno)); + goto bad; + } + + switch (dmt->type) { + case DM_DEVICE_CREATE: + add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev)); + break; + + case DM_DEVICE_REMOVE: + rm_dev_node(dmt->dev_name); + break; + + case DM_DEVICE_RENAME: + rename_dev_node(dmt->dev_name, dmt->newname); + break; + + case DM_DEVICE_MKNODES: + if (dmi->flags & DM_EXISTS_FLAG) + add_dev_node(dmt->dev_name, MAJOR(dmi->dev), + MINOR(dmi->dev)); + else + rm_dev_node(dmt->dev_name); + break; + + case DM_DEVICE_STATUS: + case DM_DEVICE_TABLE: + if (!_unmarshal_status_v1(dmt, dmi)) + goto bad; + break; + + case DM_DEVICE_SUSPEND: + case DM_DEVICE_RESUME: + dmt->type = DM_DEVICE_INFO; + if (!dm_task_run(dmt)) + goto bad; + free(dmi); /* We'll use what info returned */ + return 1; + } + + dmt->dmi.v1 = dmi; + return 1; + + bad: + free(dmi); + return 0; +} + +#endif + +/* + * Protocol Version 4 functions. + */ + +int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size) +{ + unsigned int *v; + +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_driver_version_v1(dmt, version, size); +#endif + + if (!dmt->dmi.v4) { + version[0] = '\0'; + return 0; + } + + v = dmt->dmi.v4->version; + snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]); + return 1; +} + +static int _check_version(char *version, size_t size, int log_suppress) +{ + struct dm_task *task; + int r; + + if (!(task = dm_task_create(DM_DEVICE_VERSION))) { + log_error("Failed to get device-mapper version"); + version[0] = '\0'; + return 0; + } + + if (log_suppress) + _log_suppress = 1; + + r = dm_task_run(task); + dm_task_get_driver_version(task, version, size); + dm_task_destroy(task); + _log_suppress = 0; + + return r; +} + +/* + * Find out device-mapper's major version number the first time + * this is called and whether or not we support it. + */ +int dm_check_version(void) +{ + char libversion[64], dmversion[64]; + const char *compat = ""; + + if (_version_checked) + return _version_ok; + + _version_checked = 1; + + if (_check_version(dmversion, sizeof(dmversion), _dm_compat)) + return 1; + + if (!_dm_compat) + goto bad; + + log_verbose("device-mapper ioctl protocol version %d failed. " + "Trying protocol version 1.", _dm_version); + _dm_version = 1; + if (_check_version(dmversion, sizeof(dmversion), 0)) { + log_verbose("Using device-mapper ioctl protocol version 1"); + return 1; + } + + compat = "(compat)"; + + dm_get_library_version(libversion, sizeof(libversion)); + + log_error("Incompatible libdevmapper %s%s and kernel driver %s", + libversion, compat, dmversion); + + bad: + _version_ok = 0; + return 0; +} + +void *dm_get_next_target(struct dm_task *dmt, void *next, + uint64_t *start, uint64_t *length, + char **target_type, char **params) +{ + struct target *t = (struct target *) next; + + if (!t) + t = dmt->head; + + if (!t) + return NULL; + + *start = t->start; + *length = t->length; + *target_type = t->type; + *params = t->params; + + return t->next; +} + +/* Unmarshall the target info returned from a status call */ +static int _unmarshal_status(struct dm_task *dmt, struct dm_ioctl *dmi) +{ + char *outbuf = (char *) dmi + dmi->data_start; + char *outptr = outbuf; + uint32_t i; + struct dm_target_spec *spec; + + for (i = 0; i < dmi->target_count; i++) { + spec = (struct dm_target_spec *) outptr; + if (!dm_task_add_target(dmt, spec->sector_start, + spec->length, + spec->target_type, + outptr + sizeof(*spec))) + return 0; + + outptr = outbuf + spec->next; + } + + return 1; +} + +int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, + uint32_t dev_minor) +{ + int r; + +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_format_dev_v1(buf, bufsize, dev_major, dev_minor); +#endif + + if (bufsize < 8) + return 0; + + r = snprintf(buf, bufsize, "%03u:%03u", dev_major, dev_minor); + if (r < 0 || r > bufsize - 1) + return 0; + + return 1; +} + +int dm_task_get_info(struct dm_task *dmt, struct dm_info *info) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_info_v1(dmt, info); +#endif + + if (!dmt->dmi.v4) + return 0; + + memset(info, 0, sizeof(*info)); + + info->exists = dmt->dmi.v4->flags & DM_EXISTS_FLAG ? 1 : 0; + if (!info->exists) + return 1; + + info->suspended = dmt->dmi.v4->flags & DM_SUSPEND_FLAG ? 1 : 0; + info->read_only = dmt->dmi.v4->flags & DM_READONLY_FLAG ? 1 : 0; + info->live_table = dmt->dmi.v4->flags & DM_ACTIVE_PRESENT_FLAG ? 1 : 0; + info->inactive_table = dmt->dmi.v4->flags & DM_INACTIVE_PRESENT_FLAG ? + 1 : 0; + info->target_count = dmt->dmi.v4->target_count; + info->open_count = dmt->dmi.v4->open_count; + info->event_nr = dmt->dmi.v4->event_nr; + info->major = MAJOR(dmt->dmi.v4->dev); + info->minor = MINOR(dmt->dmi.v4->dev); + + return 1; +} + +const char *dm_task_get_name(struct dm_task *dmt) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_name_v1(dmt); +#endif + + return (dmt->dmi.v4->name); +} + +const char *dm_task_get_uuid(struct dm_task *dmt) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_uuid_v1(dmt); +#endif + + return (dmt->dmi.v4->uuid); +} + +struct dm_deps *dm_task_get_deps(struct dm_task *dmt) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_deps_v1(dmt); +#endif + + return (struct dm_deps *) (((void *) dmt->dmi.v4) + + dmt->dmi.v4->data_start); +} + +struct dm_names *dm_task_get_names(struct dm_task *dmt) +{ +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_get_names_v1(dmt); +#endif + + return (struct dm_names *) (((void *) dmt->dmi.v4) + + dmt->dmi.v4->data_start); +} + +int dm_task_set_ro(struct dm_task *dmt) +{ + dmt->read_only = 1; + return 1; +} + +int dm_task_set_newname(struct dm_task *dmt, const char *newname) +{ + if (!(dmt->newname = strdup(newname))) { + log_error("dm_task_set_newname: strdup(%s) failed", newname); + return 0; + } + + return 1; +} + +int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr) +{ + dmt->event_nr = event_nr; + + return 1; +} + +struct target *create_target(uint64_t start, uint64_t len, const char *type, + const char *params) +{ + struct target *t = malloc(sizeof(*t)); + + if (!t) { + log_error("create_target: malloc(%d) failed", sizeof(*t)); + return NULL; + } + + memset(t, 0, sizeof(*t)); + + if (!(t->params = strdup(params))) { + log_error("create_target: strdup(params) failed"); + goto bad; + } + + if (!(t->type = strdup(type))) { + log_error("create_target: strdup(type) failed"); + goto bad; + } + + t->start = start; + t->length = len; + return t; + + bad: + free(t->params); + free(t->type); + free(t); + return NULL; +} + +static void *_add_target(struct target *t, void *out, void *end) +{ + void *out_sp = out; + struct dm_target_spec sp; + size_t sp_size = sizeof(struct dm_target_spec); + int len; + const char no_space[] = "Ran out of memory building ioctl parameter"; + + out += sp_size; + if (out >= end) { + log_error(no_space); + return NULL; + } + + sp.status = 0; + sp.sector_start = t->start; + sp.length = t->length; + strncpy(sp.target_type, t->type, sizeof(sp.target_type)); + + len = strlen(t->params); + + if ((out + len + 1) >= end) { + log_error(no_space); + + log_error("t->params= '%s'", t->params); + return NULL; + } + strcpy((char *) out, t->params); + out += len + 1; + + /* align next block */ + out = _align(out, ALIGNMENT); + + sp.next = out - out_sp; + memcpy(out_sp, &sp, sp_size); + + return out; +} + +static struct dm_ioctl *_flatten(struct dm_task *dmt) +{ + const size_t min_size = 16 * 1024; + const int (*version)[3]; + + struct dm_ioctl *dmi; + struct target *t; + size_t len = sizeof(struct dm_ioctl); + void *b, *e; + int count = 0; + + for (t = dmt->head; t; t = t->next) { + len += sizeof(struct dm_target_spec); + len += strlen(t->params) + 1 + ALIGNMENT; + count++; + } + + if (count && dmt->newname) { + log_error("targets and newname are incompatible"); + return NULL; + } + + if (dmt->newname) + len += strlen(dmt->newname) + 1; + + /* + * Give len a minimum size so that we have space to store + * dependencies or status information. + */ + if (len < min_size) + len = min_size; + + if (!(dmi = malloc(len))) + return NULL; + + memset(dmi, 0, len); + + version = &_cmd_data_v4[dmt->type].version; + + dmi->version[0] = (*version)[0]; + dmi->version[1] = (*version)[1]; + dmi->version[2] = (*version)[2]; + + dmi->data_size = len; + dmi->data_start = sizeof(struct dm_ioctl); + + if (dmt->dev_name) + strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); + + if (dmt->type == DM_DEVICE_SUSPEND) + dmi->flags |= DM_SUSPEND_FLAG; + if (dmt->read_only) + dmi->flags |= DM_READONLY_FLAG; + + if (dmt->minor >= 0) { + if (dmt->major <= 0) { + log_error("Missing major number for persistent device"); + return NULL; + } + dmi->flags |= DM_PERSISTENT_DEV_FLAG; + dmi->dev = MKDEV(dmt->major, dmt->minor); + } + + if (dmt->uuid) + strncpy(dmi->uuid, dmt->uuid, sizeof(dmi->uuid)); + + dmi->target_count = count; + dmi->event_nr = dmt->event_nr; + + b = (void *) (dmi + 1); + e = (void *) ((char *) dmi + len); + + for (t = dmt->head; t; t = t->next) + if (!(b = _add_target(t, b, e))) + goto bad; + + if (dmt->newname) + strcpy(b, dmt->newname); + + return dmi; + + bad: + free(dmi); + return NULL; +} + +static int _create_and_load_v4(struct dm_task *dmt) +{ + struct dm_task *task; + int r; + + /* Use new task struct to create the device */ + if (!(task = dm_task_create(DM_DEVICE_CREATE))) { + log_error("Failed to create device-mapper task struct"); + return 0; + } + + /* Copy across relevant fields */ + if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { + dm_task_destroy(task); + return 0; + } + + if (dmt->uuid && !dm_task_set_uuid(task, dmt->uuid)) { + dm_task_destroy(task); + return 0; + } + + task->major = dmt->major; + task->minor = dmt->minor; + + r = dm_task_run(task); + dm_task_destroy(task); + if (!r) + return r; + + /* Next load the table */ + if (!(task = dm_task_create(DM_DEVICE_RELOAD))) { + log_error("Failed to create device-mapper task struct"); + return 0; + } + + /* Copy across relevant fields */ + if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { + dm_task_destroy(task); + return 0; + } + + task->read_only = dmt->read_only; + task->head = dmt->head; + task->tail = dmt->tail; + + r = dm_task_run(task); + + task->head = NULL; + task->tail = NULL; + dm_task_destroy(task); + if (!r) + return r; + + /* Use the original structure last so the info will be correct */ + dmt->type = DM_DEVICE_RESUME; + dmt->uuid = NULL; + free(dmt->uuid); + + r = dm_task_run(dmt); + + return r; +} + +int dm_task_run(struct dm_task *dmt) +{ + struct dm_ioctl *dmi = NULL; + unsigned int command; + +#ifdef DM_COMPAT + if (_dm_version == 1) + return _dm_task_run_v1(dmt); +#endif + + if ((unsigned) dmt->type >= + (sizeof(_cmd_data_v4) / sizeof(*_cmd_data_v4))) { + log_error("Internal error: unknown device-mapper task %d", + dmt->type); + goto bad; + } + + command = _cmd_data_v4[dmt->type].cmd; + + /* Old-style creation had a table supplied */ + if (dmt->type == DM_DEVICE_CREATE && dmt->head) + return _create_and_load_v4(dmt); + + if (!_open_control()) + return 0; + + dmi = _flatten(dmt); + if (!dmi) { + log_error("Couldn't create ioctl argument"); + return 0; + } + + if (dmt->type == DM_DEVICE_TABLE) + dmi->flags |= DM_STATUS_TABLE_FLAG; + + dmi->flags |= DM_EXISTS_FLAG; /* FIXME */ + log_debug("dm %s %s %s %s", _cmd_data_v4[dmt->type].name, dmi->name, + dmi->uuid, dmt->newname ? dmt->newname : ""); + if (ioctl(_control_fd, command, dmi) < 0) { + if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) || + (dmt->type == DM_DEVICE_MKNODES))) { + dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */ + goto ignore_error; + } + if (_log_suppress) + log_verbose("device-mapper ioctl cmd %d failed: %s", + _IOC_NR(command), strerror(errno)); + else + log_error("device-mapper ioctl cmd %d failed: %s", + _IOC_NR(command), strerror(errno)); + goto bad; + } + + ignore_error: + switch (dmt->type) { + case DM_DEVICE_CREATE: + add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev)); + break; + + case DM_DEVICE_REMOVE: + rm_dev_node(dmt->dev_name); + break; + + case DM_DEVICE_RENAME: + rename_dev_node(dmt->dev_name, dmt->newname); + break; + + case DM_DEVICE_MKNODES: + if (dmi->flags & DM_EXISTS_FLAG) + add_dev_node(dmt->dev_name, MAJOR(dmi->dev), + MINOR(dmi->dev)); + else + rm_dev_node(dmt->dev_name); + break; + + case DM_DEVICE_STATUS: + case DM_DEVICE_TABLE: + case DM_DEVICE_WAITEVENT: + if (!_unmarshal_status(dmt, dmi)) + goto bad; + break; + } + + dmt->dmi.v4 = dmi; + return 1; + + bad: + free(dmi); + return 0; +} + +void dm_lib_release(void) +{ + if (_control_fd != -1) { + close(_control_fd); + _control_fd = -1; + } + update_devs(); +} + +void dm_lib_exit(void) +{ + if (_control_fd != -1) { + close(_control_fd); + _control_fd = -1; + } + _version_ok = 1; + _version_checked = 0; +} diff --git a/extras/multipath-tools/libdevmapper/ioctl/libdm-compat.h b/extras/multipath-tools/libdevmapper/ioctl/libdm-compat.h new file mode 100644 index 0000000000..af7a9f1f71 --- /dev/null +++ b/extras/multipath-tools/libdevmapper/ioctl/libdm-compat.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#ifndef _LINUX_LIBDM_COMPAT_H +#define _LINUX_LIBDM_COMPAT_H + +#include +#include +#include +#include + +struct dm_task; +struct dm_info; + +/* + * Old versions of structures for backwards compatibility. + */ + +struct dm_ioctl_v1 { + uint32_t version[3]; /* in/out */ + uint32_t data_size; /* total size of data passed in + * including this struct */ + + uint32_t data_start; /* offset to start of data + * relative to start of this struct */ + + int32_t target_count; /* in/out */ + int32_t open_count; /* out */ + uint32_t flags; /* in/out */ + + __kernel_dev_t dev; /* in/out */ + + char name[DM_NAME_LEN]; /* device name */ + char uuid[DM_UUID_LEN]; /* unique identifier for + * the block device */ +}; + +struct dm_target_spec_v1 { + int32_t status; /* used when reading from kernel only */ + uint64_t sector_start; + uint32_t length; + uint32_t next; + + char target_type[DM_MAX_TYPE_NAME]; + +}; + +struct dm_target_deps_v1 { + uint32_t count; + + __kernel_dev_t dev[0]; /* out */ +}; + +enum { + /* Top level cmds */ + DM_VERSION_CMD_V1 = 0, + DM_REMOVE_ALL_CMD_V1, + + /* device level cmds */ + DM_DEV_CREATE_CMD_V1, + DM_DEV_REMOVE_CMD_V1, + DM_DEV_RELOAD_CMD_V1, + DM_DEV_RENAME_CMD_V1, + DM_DEV_SUSPEND_CMD_V1, + DM_DEV_DEPS_CMD_V1, + DM_DEV_STATUS_CMD_V1, + + /* target level cmds */ + DM_TARGET_STATUS_CMD_V1, + DM_TARGET_WAIT_CMD_V1, +}; + +#define DM_VERSION_V1 _IOWR(DM_IOCTL, DM_VERSION_CMD_V1, struct dm_ioctl) +#define DM_REMOVE_ALL_V1 _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD_V1, struct dm_ioctl) + +#define DM_DEV_CREATE_V1 _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD_V1, struct dm_ioctl) +#define DM_DEV_REMOVE_V1 _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD_V1, struct dm_ioctl) +#define DM_DEV_RELOAD_V1 _IOWR(DM_IOCTL, DM_DEV_RELOAD_CMD_V1, struct dm_ioctl) +#define DM_DEV_SUSPEND_V1 _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD_V1, struct dm_ioctl) +#define DM_DEV_RENAME_V1 _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD_V1, struct dm_ioctl) +#define DM_DEV_DEPS_V1 _IOWR(DM_IOCTL, DM_DEV_DEPS_CMD_V1, struct dm_ioctl) +#define DM_DEV_STATUS_V1 _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD_V1, struct dm_ioctl) + +#define DM_TARGET_STATUS_V1 _IOWR(DM_IOCTL, DM_TARGET_STATUS_CMD_V1, struct dm_ioctl) +#define DM_TARGET_WAIT_V1 _IOWR(DM_IOCTL, DM_TARGET_WAIT_CMD_V1, struct dm_ioctl) + +/* *INDENT-OFF* */ +static struct cmd_data _cmd_data_v1[] = { + { "create", DM_DEV_CREATE_V1, {1, 0, 0} }, + { "reload", DM_DEV_RELOAD_V1, {1, 0, 0} }, + { "remove", DM_DEV_REMOVE_V1, {1, 0, 0} }, + { "remove_all", DM_REMOVE_ALL_V1, {1, 0, 0} }, + { "suspend", DM_DEV_SUSPEND_V1, {1, 0, 0} }, + { "resume", DM_DEV_SUSPEND_V1, {1, 0, 0} }, + { "info", DM_DEV_STATUS_V1, {1, 0, 0} }, + { "deps", DM_DEV_DEPS_V1, {1, 0, 0} }, + { "rename", DM_DEV_RENAME_V1, {1, 0, 0} }, + { "version", DM_VERSION_V1, {1, 0, 0} }, + { "status", DM_TARGET_STATUS_V1, {1, 0, 0} }, + { "table", DM_TARGET_STATUS_V1, {1, 0, 0} }, + { "waitevent", DM_TARGET_WAIT_V1, {1, 0, 0} }, + { "names", 0, {4, 0, 0} }, + { "clear", 0, {4, 0, 0} }, + { "mknodes", 0, {4, 0, 0} }, +}; +/* *INDENT-ON* */ + +#endif diff --git a/extras/multipath-tools/libdevmapper/ioctl/libdm-targets.h b/extras/multipath-tools/libdevmapper/ioctl/libdm-targets.h new file mode 100644 index 0000000000..a8c0e20547 --- /dev/null +++ b/extras/multipath-tools/libdevmapper/ioctl/libdm-targets.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#ifndef LIB_DMTARGETS_H +#define LIB_DMTARGETS_H + +#include + +struct dm_ioctl; +struct dm_ioctl_v1; + +struct target { + uint64_t start; + uint64_t length; + char *type; + char *params; + + struct target *next; +}; + +struct dm_task { + int type; + char *dev_name; + + struct target *head, *tail; + + int read_only; + uint32_t event_nr; + int major; + int minor; + union { + struct dm_ioctl *v4; + struct dm_ioctl_v1 *v1; + } dmi; + char *newname; + + char *uuid; +}; + +struct cmd_data { + const char *name; + const int cmd; + const int version[3]; +}; + +int dm_check_version(void); + +#endif diff --git a/extras/multipath-tools/libdevmapper/libdevmapper.h b/extras/multipath-tools/libdevmapper/libdevmapper.h new file mode 100644 index 0000000000..6549af3641 --- /dev/null +++ b/extras/multipath-tools/libdevmapper/libdevmapper.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#ifndef LIB_DEVICE_MAPPER_H +#define LIB_DEVICE_MAPPER_H + +#include +#include + +#ifdef linux +# include +#endif + +/* + * Since it is quite laborious to build the ioctl + * arguments for the device-mapper people are + * encouraged to use this library. + * + * You will need to build a struct dm_task for + * each ioctl command you want to execute. + */ + +typedef void (*dm_log_fn) (int level, const char *file, int line, + const char *f, ...); + +/* + * The library user may wish to register their own + * logging function, by default errors go to + * stderr. + */ +void dm_log_init(dm_log_fn fn); +void dm_log_init_verbose(int level); + +enum { + DM_DEVICE_CREATE, + DM_DEVICE_RELOAD, + DM_DEVICE_REMOVE, + DM_DEVICE_REMOVE_ALL, + + DM_DEVICE_SUSPEND, + DM_DEVICE_RESUME, + + DM_DEVICE_INFO, + DM_DEVICE_DEPS, + DM_DEVICE_RENAME, + + DM_DEVICE_VERSION, + + DM_DEVICE_STATUS, + DM_DEVICE_TABLE, + DM_DEVICE_WAITEVENT, + + DM_DEVICE_LIST, + + DM_DEVICE_CLEAR, + + DM_DEVICE_MKNODES +}; + +struct dm_task; + +struct dm_task *dm_task_create(int type); +void dm_task_destroy(struct dm_task *dmt); + +int dm_task_set_name(struct dm_task *dmt, const char *name); +int dm_task_set_uuid(struct dm_task *dmt, const char *uuid); + +/* + * Retrieve attributes after an info. + */ +struct dm_info { + int exists; + int suspended; + int live_table; + int inactive_table; + int32_t open_count; + uint32_t event_nr; + uint32_t major; + uint32_t minor; /* minor device number */ + int read_only; /* 0:read-write; 1:read-only */ + + int32_t target_count; +}; + +struct dm_deps { + uint32_t count; + uint32_t filler; + uint64_t device[0]; +}; + +struct dm_names { + uint64_t dev; + uint32_t next; /* Offset to next struct from start of this struct */ + char name[0]; +}; + +int dm_get_library_version(char *version, size_t size); +int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size); +int dm_task_get_info(struct dm_task *dmt, struct dm_info *dmi); +const char *dm_task_get_name(struct dm_task *dmt); +const char *dm_task_get_uuid(struct dm_task *dmt); + +struct dm_deps *dm_task_get_deps(struct dm_task *dmt); +struct dm_names *dm_task_get_names(struct dm_task *dmt); + +int dm_task_set_ro(struct dm_task *dmt); +int dm_task_set_newname(struct dm_task *dmt, const char *newname); +int dm_task_set_minor(struct dm_task *dmt, int minor); +int dm_task_set_major(struct dm_task *dmt, int major); +int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr); + +/* + * Use these to prepare for a create or reload. + */ +int dm_task_add_target(struct dm_task *dmt, + uint64_t start, + uint64_t size, const char *ttype, const char *params); + +/* + * Format major/minor numbers correctly for input to driver + */ +int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, uint32_t dev_minor); + +/* Use this to retrive target information returned from a STATUS call */ +void *dm_get_next_target(struct dm_task *dmt, + void *next, uint64_t *start, uint64_t *length, + char **target_type, char **params); + +/* + * Call this to actually run the ioctl. + */ +int dm_task_run(struct dm_task *dmt); + +/* + * Configure the device-mapper directory + */ +int dm_set_dev_dir(const char *dir); +const char *dm_dir(void); + +/* Release library resources */ +void dm_lib_release(void); +void dm_lib_exit(void); + +#endif /* LIB_DEVICE_MAPPER_H */ diff --git a/extras/multipath-tools/libdevmapper/libdm-common.c b/extras/multipath-tools/libdevmapper/libdm-common.c new file mode 100644 index 0000000000..b0affd1eed --- /dev/null +++ b/extras/multipath-tools/libdevmapper/libdm-common.c @@ -0,0 +1,382 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#include "libdm-targets.h" +#include "libdm-common.h" +#include "list.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEV_DIR "/dev/" + +static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR; + +static int _verbose = 0; + +/* + * Library users can provide their own logging + * function. + */ +static void _default_log(int level, const char *file, int line, + const char *f, ...) +{ + va_list ap; + + if (level > _LOG_WARN && !_verbose) + return; + + va_start(ap, f); + + if (level < _LOG_WARN) + vfprintf(stderr, f, ap); + else + vprintf(f, ap); + + va_end(ap); + + if (level < _LOG_WARN) + fprintf(stderr, "\n"); + else + fprintf(stdout, "\n"); +} + +dm_log_fn _log = _default_log; + +void dm_log_init(dm_log_fn fn) +{ + _log = fn; +} + +void dm_log_init_verbose(int level) +{ + _verbose = level; +} + +static void _build_dev_path(char *buffer, size_t len, const char *dev_name) +{ + /* If there's a /, assume caller knows what they're doing */ + if (strchr(dev_name, '/')) + snprintf(buffer, len, "%s", dev_name); + else + snprintf(buffer, len, "%s/%s", _dm_dir, dev_name); +} + +int dm_get_library_version(char *version, size_t size) +{ + strncpy(version, DM_LIB_VERSION, size); + return 1; +} + +struct dm_task *dm_task_create(int type) +{ + struct dm_task *dmt = malloc(sizeof(*dmt)); + + if (!dm_check_version()) + return NULL; + + if (!dmt) { + log_error("dm_task_create: malloc(%d) failed", sizeof(*dmt)); + return NULL; + } + + memset(dmt, 0, sizeof(*dmt)); + + dmt->type = type; + dmt->minor = -1; + dmt->major = -1; + + return dmt; +} + +int dm_task_set_name(struct dm_task *dmt, const char *name) +{ + char *pos; + char path[PATH_MAX]; + struct stat st1, st2; + + if (dmt->dev_name) { + free(dmt->dev_name); + dmt->dev_name = NULL; + } + + /* If path was supplied, remove it if it points to the same device + * as its last component. + */ + if ((pos = strrchr(name, '/'))) { + snprintf(path, sizeof(path), "%s/%s", _dm_dir, pos + 1); + + if (stat(name, &st1) || stat(path, &st2) || + !(st1.st_dev == st2.st_dev)) { + log_error("dm_task_set_name: Device %s not found", + name); + return 0; + } + + name = pos + 1; + } + + if (!(dmt->dev_name = strdup(name))) { + log_error("dm_task_set_name: strdup(%s) failed", name); + return 0; + } + + return 1; +} + +int dm_task_set_uuid(struct dm_task *dmt, const char *uuid) +{ + if (dmt->uuid) { + free(dmt->uuid); + dmt->uuid = NULL; + } + + if (!(dmt->uuid = strdup(uuid))) { + log_error("dm_task_set_uuid: strdup(%s) failed", uuid); + return 0; + } + + return 1; +} + +int dm_task_set_major(struct dm_task *dmt, int major) +{ + dmt->major = major; + log_debug("Setting major: %d", dmt->major); + + return 1; +} + +int dm_task_set_minor(struct dm_task *dmt, int minor) +{ + dmt->minor = minor; + log_debug("Setting minor: %d", dmt->minor); + + return 1; +} + +int dm_task_add_target(struct dm_task *dmt, uint64_t start, uint64_t size, + const char *ttype, const char *params) +{ + struct target *t = create_target(start, size, ttype, params); + + if (!t) + return 0; + + if (!dmt->head) + dmt->head = dmt->tail = t; + else { + dmt->tail->next = t; + dmt->tail = t; + } + + return 1; +} + +static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor) +{ + char path[PATH_MAX]; + struct stat info; + dev_t dev = MKDEV(major, minor); + + _build_dev_path(path, sizeof(path), dev_name); + + if (stat(path, &info) >= 0) { + if (!S_ISBLK(info.st_mode)) { + log_error("A non-block device file at '%s' " + "is already present", path); + return 0; + } + + if (info.st_rdev == dev) + return 1; + + if (unlink(path) < 0) { + log_error("Unable to unlink device node for '%s'", + dev_name); + return 0; + } + } + + if (mknod(path, S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP, dev) < 0) { + log_error("Unable to make device node for '%s'", dev_name); + return 0; + } + + return 1; +} + +static int _rename_dev_node(const char *old_name, const char *new_name) +{ + char oldpath[PATH_MAX]; + char newpath[PATH_MAX]; + struct stat info; + + _build_dev_path(oldpath, sizeof(oldpath), old_name); + _build_dev_path(newpath, sizeof(newpath), new_name); + + if (stat(newpath, &info) == 0) { + if (!S_ISBLK(info.st_mode)) { + log_error("A non-block device file at '%s' " + "is already present", newpath); + return 0; + } + + if (unlink(newpath) < 0) { + if (errno == EPERM) { + /* devfs, entry has already been renamed */ + return 1; + } + log_error("Unable to unlink device node for '%s'", + new_name); + return 0; + } + } + + if (rename(oldpath, newpath) < 0) { + log_error("Unable to rename device node from '%s' to '%s'", + old_name, new_name); + return 0; + } + + return 1; +} + +static int _rm_dev_node(const char *dev_name) +{ + char path[PATH_MAX]; + struct stat info; + + _build_dev_path(path, sizeof(path), dev_name); + + if (stat(path, &info) < 0) + return 1; + + if (unlink(path) < 0) { + log_error("Unable to unlink device node for '%s'", dev_name); + return 0; + } + + return 1; +} + +typedef enum { + NODE_ADD, + NODE_DEL, + NODE_RENAME +} node_op_t; + +static int _do_node_op(node_op_t type, const char *dev_name, uint32_t major, + uint32_t minor, const char *old_name) +{ + switch (type) { + case NODE_ADD: + return _add_dev_node(dev_name, major, minor); + case NODE_DEL: + return _rm_dev_node(dev_name); + case NODE_RENAME: + return _rename_dev_node(old_name, dev_name); + } + + return 1; +} + +static LIST_INIT(_node_ops); + +struct node_op_parms { + struct list list; + node_op_t type; + char *dev_name; + uint32_t major; + uint32_t minor; + char *old_name; + char names[0]; +}; + +static void _store_str(char **pos, char **ptr, const char *str) +{ + strcpy(*pos, str); + *ptr = *pos; + *pos += strlen(*ptr) + 1; +} + +static int _stack_node_op(node_op_t type, const char *dev_name, uint32_t major, + uint32_t minor, const char *old_name) +{ + struct node_op_parms *nop; + size_t len = strlen(dev_name) + strlen(old_name) + 2; + char *pos; + + if (!(nop = malloc(sizeof(*nop) + len))) { + log_error("Insufficient memory to stack mknod operation"); + return 0; + } + + pos = nop->names; + nop->type = type; + nop->major = major; + nop->minor = minor; + + _store_str(&pos, &nop->dev_name, dev_name); + _store_str(&pos, &nop->old_name, old_name); + + list_add(&_node_ops, &nop->list); + + return 1; +} + +static void _pop_node_ops(void) +{ + struct list *noph, *nopht; + struct node_op_parms *nop; + + list_iterate_safe(noph, nopht, &_node_ops) { + nop = list_item(noph, struct node_op_parms); + _do_node_op(nop->type, nop->dev_name, nop->major, nop->minor, + nop->old_name); + list_del(&nop->list); + free(nop); + } +} + +int add_dev_node(const char *dev_name, uint32_t major, uint32_t minor) +{ + return _stack_node_op(NODE_ADD, dev_name, major, minor, ""); +} + +int rename_dev_node(const char *old_name, const char *new_name) +{ + return _stack_node_op(NODE_RENAME, new_name, 0, 0, old_name); +} + +int rm_dev_node(const char *dev_name) +{ + return _stack_node_op(NODE_DEL, dev_name, 0, 0, ""); +} + +void update_devs(void) +{ + _pop_node_ops(); +} + +int dm_set_dev_dir(const char *dir) +{ + snprintf(_dm_dir, sizeof(_dm_dir), "%s%s", dir, DM_DIR); + return 1; +} + +const char *dm_dir(void) +{ + return _dm_dir; +} diff --git a/extras/multipath-tools/libdevmapper/libdm-common.h b/extras/multipath-tools/libdevmapper/libdm-common.h new file mode 100644 index 0000000000..2b71242861 --- /dev/null +++ b/extras/multipath-tools/libdevmapper/libdm-common.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2001 Sistina Software (UK) Limited. + * + * This file is released under the LGPL. + */ + +#ifndef LIB_DMCOMMON_H +#define LIB_DMCOMMON_H + +#include "libdevmapper.h" + +#define _LOG_DEBUG 7 +#define _LOG_INFO 6 +#define _LOG_NOTICE 5 +#define _LOG_WARN 4 +#define _LOG_ERR 3 +#define _LOG_FATAL 2 + +extern dm_log_fn _log; + +#define log_error(msg, x...) _log(_LOG_ERR, __FILE__, __LINE__, msg, ## x) +#define log_print(msg, x...) _log(_LOG_WARN, __FILE__, __LINE__, msg, ## x) +#define log_verbose(msg, x...) _log(_LOG_NOTICE, __FILE__, __LINE__, msg, ## x) +#define log_very_verbose(msg, x...) _log(_LOG_INFO, __FILE__, __LINE__, msg, ## x) +#define log_debug(msg, x...) _log(_LOG_DEBUG, __FILE__, __LINE__, msg, ## x) + +struct target *create_target(uint64_t start, + uint64_t len, + const char *type, const char *params); + +int add_dev_node(const char *dev_name, uint32_t minor, uint32_t major); +int rm_dev_node(const char *dev_name); +int rename_dev_node(const char *old_name, const char *new_name); +void update_devs(void); + +#define DM_LIB_VERSION "1.00.07-ioctl (2003-11-21)" + +#endif diff --git a/extras/multipath-tools/libdevmapper/list.h b/extras/multipath-tools/libdevmapper/list.h new file mode 100644 index 0000000000..df3d32aea8 --- /dev/null +++ b/extras/multipath-tools/libdevmapper/list.h @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2001 Sistina Software + * + * This file is released under the LGPL. + */ + +#ifndef _LVM_LIST_H +#define _LVM_LIST_H + +#include + +struct list { + struct list *n, *p; +}; + +#define LIST_INIT(name) struct list name = { &(name), &(name) } + +static inline void list_init(struct list *head) +{ + head->n = head->p = head; +} + +static inline void list_add(struct list *head, struct list *elem) +{ + assert(head->n); + + elem->n = head; + elem->p = head->p; + + head->p->n = elem; + head->p = elem; +} + +static inline void list_add_h(struct list *head, struct list *elem) +{ + assert(head->n); + + elem->n = head->n; + elem->p = head; + + head->n->p = elem; + head->n = elem; +} + +static inline void list_del(struct list *elem) +{ + elem->n->p = elem->p; + elem->p->n = elem->n; +} + +static inline int list_empty(struct list *head) +{ + return head->n == head; +} + +static inline int list_end(struct list *head, struct list *elem) +{ + return elem->n == head; +} + +static inline struct list *list_next(struct list *head, struct list *elem) +{ + return (list_end(head, elem) ? NULL : elem->n); +} + +#define list_iterate(v, head) \ + for (v = (head)->n; v != head; v = v->n) + +#define list_uniterate(v, head, start) \ + for (v = (start)->p; v != head; v = v->p) + +#define list_iterate_safe(v, t, head) \ + for (v = (head)->n, t = v->n; v != head; v = t, t = v->n) + +static inline unsigned int list_size(const struct list *head) +{ + unsigned int s = 0; + const struct list *v; + + list_iterate(v, head) + s++; + + return s; +} + +#define list_item(v, t) \ + ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->list)) + +#define list_struct_base(v, t, h) \ + ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->h)) + +/* Given a known element in a known structure, locate another */ +#define struct_field(v, t, e, f) \ + (((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->e))->f) + +/* Given a known element in a known structure, locate the list head */ +#define list_head(v, t, e) struct_field(v, t, e, list) + +#endif diff --git a/extras/multipath-tools/multipath/Makefile b/extras/multipath-tools/multipath/Makefile new file mode 100644 index 0000000000..4121f4fc3b --- /dev/null +++ b/extras/multipath-tools/multipath/Makefile @@ -0,0 +1,60 @@ +# Makefile +# +# Copyright (C) 2003 Christophe Varoqui, + +EXEC = multipath + +prefix = +exec_prefix = ${prefix} +bindir = ${exec_prefix}/sbin +udevdir = ../../.. +klibcdir = $(udevdir)/klibc +sysfsdir = $(udevdir)/libsysfs +mandir = /usr/share/man/man8 +libdmdir = ../libdevmapper +arch = i386 +klibcarch = $(klibcdir)/klibc/arch/$(arch)/include + +CC = gcc +GZIP = /bin/gzip -9 -c + +GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} +KERNEL_DIR = /lib/modules/${shell uname -r}/build +CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ + -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ + -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I$(sysfsdir) -I. -I$(klibcarch) + +OBJS = devinfo.o main.o +CRT0 = $(klibcdir)/klibc/crt0.o +LIB = $(klibcdir)/klibc/libc.a +LIBGCC := $(shell $(CC) -print-libgcc-file-name ) + +DMOBJS = $(libdmdir)/libdm-common.o $(libdmdir)/ioctl/libdevmapper.o +SYSFSOBJS = $(sysfsdir)/dlist.o $(sysfsdir)/sysfs_bus.o \ + $(sysfsdir)/sysfs_class.o $(sysfsdir)/sysfs_device.o \ + $(sysfsdir)/sysfs_dir.o $(sysfsdir)/sysfs_driver.o \ + $(sysfsdir)/sysfs_utils.o + +$(EXEC): $(OBJS) + $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC) + strip $(EXEC) + $(GZIP) $(EXEC).8 > $(EXEC).8.gz + +clean: + rm -f core *.o $(EXEC) *.gz + +install: + install -d $(DESTDIR)$(bindir) + install -m 755 $(EXEC) $(DESTDIR)$(bindir)/ + install -d $(DESTDIR)/etc/hotplug.d/scsi/ + install -m 755 multipath.hotplug $(DESTDIR)/etc/hotplug.d/scsi/ + install -d $(DESTDIR)$(mandir) + install -m 644 multipath.8.gz $(DESTDIR)$(mandir) + +uninstall: + rm $(DESTDIR)/etc/hotplug.d/scsi/multipath.hotplug + rm $(DESTDIR)$(bindir)/$(EXEC) + rm $(DESTDIR)$(mandir)/multipath.8.gz + +# Code dependencies +main.o: main.c main.h sg_include.h devinfo.h diff --git a/extras/multipath-tools/multipath/devinfo.c b/extras/multipath-tools/multipath/devinfo.c new file mode 100644 index 0000000000..21890621e0 --- /dev/null +++ b/extras/multipath-tools/multipath/devinfo.c @@ -0,0 +1,240 @@ +#include +#include +#include +#include +#include +#include +#include "devinfo.h" +#include "sg_include.h" + +#define FILE_NAME_SIZE 255 + +void +basename(char * str1, char * str2) +{ + char *p = str1 + (strlen(str1) - 1); + + while (*--p != '/') + continue; + strcpy(str2, ++p); +} + +static int +do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, + void *resp, int mx_resp_len, int noisy) +{ + unsigned char inqCmdBlk[INQUIRY_CMDLEN] = + { INQUIRY_CMD, 0, 0, 0, 0, 0 }; + unsigned char sense_b[SENSE_BUFF_LEN]; + struct sg_io_hdr io_hdr; + + if (cmddt) + inqCmdBlk[1] |= 2; + if (evpd) + inqCmdBlk[1] |= 1; + inqCmdBlk[2] = (unsigned char) pg_op; + inqCmdBlk[4] = (unsigned char) mx_resp_len; + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (inqCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_b); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = mx_resp_len; + io_hdr.dxferp = resp; + io_hdr.cmdp = inqCmdBlk; + io_hdr.sbp = sense_b; + io_hdr.timeout = DEF_TIMEOUT; + + if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) { + perror("SG_IO (inquiry) error"); + return -1; + } + + /* treat SG_ERR here to get rid of sg_err.[ch] */ + io_hdr.status &= 0x7e; + if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && + (0 == io_hdr.driver_status)) + return 0; + if ((SCSI_CHECK_CONDITION == io_hdr.status) || + (SCSI_COMMAND_TERMINATED == io_hdr.status) || + (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) { + if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) { + int sense_key; + unsigned char * sense_buffer = io_hdr.sbp; + if (sense_buffer[0] & 0x2) + sense_key = sense_buffer[1] & 0xf; + else + sense_key = sense_buffer[2] & 0xf; + if(RECOVERED_ERROR == sense_key) + return 0; + } + } + return -1; +} + +int +get_serial (char * str, char * devname) +{ + int fd; + int len; + char buff[MX_ALLOC_LEN + 1]; + + if ((fd = open(devname, O_RDONLY)) < 0) + return 0; + + if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { + len = buff[3]; + if (len > 0) { + memcpy(str, buff + 4, len); + buff[len] = '\0'; + } + close(fd); + return 1; + } + close(fd); + return 0; +} + +int +get_lun_strings(char * vendor_id, char * product_id, char * rev, char * devname) +{ + int fd; + char buff[36]; + char attr_path[FILE_NAME_SIZE]; + char sysfs_path[FILE_NAME_SIZE]; + char basedev[FILE_NAME_SIZE]; + + if (0 == sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { + /* sysfs style */ + basename(devname, basedev); + + sprintf(attr_path, "%s/block/%s/device/vendor", + sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, + vendor_id, 8)) return 0; + + sprintf(attr_path, "%s/block/%s/device/model", + sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, + product_id, 16)) return 0; + + sprintf(attr_path, "%s/block/%s/device/rev", + sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, + rev, 4)) return 0; + } else { + /* ioctl style */ + if ((fd = open(devname, O_RDONLY)) < 0) + return 0; + if (0 != do_inq(fd, 0, 0, 0, buff, 36, 1)) + return 0; + memcpy(vendor_id, &buff[8], 8); + memcpy(product_id, &buff[16], 16); + memcpy(rev, &buff[32], 4); + close(fd); + return 1; + } + return 0; +} + +static void +sprint_wwid(char * buff, const char * str) +{ + int i; + const char *p; + char *cursor; + unsigned char c; + + p = str; + cursor = buff; + for (i = 0; i <= WWID_SIZE / 2 - 1; i++) { + c = *p++; + sprintf(cursor, "%.2x", (int) (unsigned char) c); + cursor += 2; + } + buff[WWID_SIZE - 1] = '\0'; +} + +/* get EVPD page 0x83 off 8 */ +/* tested ok with StorageWorks */ +int +get_evpd_wwid(char * devname, char * wwid) +{ + int fd; + char buff[MX_ALLOC_LEN + 1]; + + if ((fd = open(devname, O_RDONLY)) < 0) + return 0; + + if (0 == do_inq(fd, 0, 1, 0x83, buff, MX_ALLOC_LEN, 1)) { + sprint_wwid(wwid, &buff[8]); + close(fd); + return 1; /* success */ + } + + close(fd); + return 0; /* not good */ +} + +long +get_disk_size (char * devname) { + long size; + int fd; + char attr_path[FILE_NAME_SIZE]; + char sysfs_path[FILE_NAME_SIZE]; + char buff[FILE_NAME_SIZE]; + char basedev[FILE_NAME_SIZE]; + + if (0 == sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { + basename(devname, basedev); + sprintf(attr_path, "%s/block/%s/size", + sysfs_path, basedev); + if (0 > sysfs_read_attribute_value(attr_path, buff, + FILE_NAME_SIZE * sizeof(char))) + return -1; + size = atoi(buff); + return size; + } else { + if ((fd = open(devname, O_RDONLY)) < 0) + return -1; + if(!ioctl(fd, BLKGETSIZE, &size)) + return size; + } + return -1; +} + +int +do_tur(char *dev) +{ + unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; + struct sg_io_hdr io_hdr; + unsigned char sense_buffer[32]; + int fd; + + fd = open(dev, O_RDONLY); + + if (fd < 0) + return 0; + + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (turCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_buffer); + io_hdr.dxfer_direction = SG_DXFER_NONE; + io_hdr.cmdp = turCmdBlk; + io_hdr.sbp = sense_buffer; + io_hdr.timeout = 20000; + io_hdr.pack_id = 0; + + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + close(fd); + return 0; + } + + close(fd); + + if (io_hdr.info & SG_INFO_OK_MASK) + return 0; + + return 1; +} diff --git a/extras/multipath-tools/multipath/devinfo.h b/extras/multipath-tools/multipath/devinfo.h new file mode 100644 index 0000000000..ee17aba923 --- /dev/null +++ b/extras/multipath-tools/multipath/devinfo.h @@ -0,0 +1,21 @@ +#define INQUIRY_CMDLEN 6 +#define INQUIRY_CMD 0x12 +#define SENSE_BUFF_LEN 32 +#define DEF_TIMEOUT 60000 +#define RECOVERED_ERROR 0x01 +#define MX_ALLOC_LEN 255 +#define WWID_SIZE 33 +#define BLKGETSIZE _IO(0x12,96) +#define TUR_CMD_LEN 6 + +/* exerpt from "sg_err.h" */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SG_ERR_DRIVER_SENSE 0x08 + +void basename (char *, char *); +int get_serial (char *, char *); +int get_lun_strings (char *, char *, char *, char *); +int get_evpd_wwid(char *, char *); +long get_disk_size (char *); +int do_tur (char *); diff --git a/extras/multipath-tools/multipath/main.c b/extras/multipath-tools/multipath/main.c new file mode 100644 index 0000000000..8f06a8f94c --- /dev/null +++ b/extras/multipath-tools/multipath/main.c @@ -0,0 +1,895 @@ +/* + * Soft: multipath device mapper target autoconfig + * + * Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $ + * + * Author: Copyright (C) 2003 Christophe Varoqui + * + * 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. + * + * 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; either version + * 2 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "../libdevmapper/libdevmapper.h" +#include "main.h" +#include "devinfo.h" + +/* White list switch */ +static int +get_unique_id(struct path * mypath) +{ + int i; + static struct { + char * vendor; + char * product; + int iopolicy; + int (*getuid) (char *, char *); + } wlist[] = { + {"COMPAQ ", "HSV110 (C)COMPAQ", GROUP_BY_TUR, &get_evpd_wwid}, + {"COMPAQ ", "MSA1000 ", GROUP_BY_TUR, &get_evpd_wwid}, + {"COMPAQ ", "MSA1000 VOLUME ", GROUP_BY_TUR, &get_evpd_wwid}, + {"DEC ", "HSG80 ", GROUP_BY_TUR, &get_evpd_wwid}, + {"HP ", "HSV100 ", GROUP_BY_TUR, &get_evpd_wwid}, + {"HP ", "A6189A ", MULTIBUS, &get_evpd_wwid}, + {"HP ", "OPEN- ", MULTIBUS, &get_evpd_wwid}, + {"DDN ", "SAN DataDirector", MULTIBUS, &get_evpd_wwid}, + {"FSC ", "CentricStor ", MULTIBUS, &get_evpd_wwid}, + {"HITACHI ", "DF400 ", MULTIBUS, &get_evpd_wwid}, + {"HITACHI ", "DF500 ", MULTIBUS, &get_evpd_wwid}, + {"HITACHI ", "DF600 ", MULTIBUS, &get_evpd_wwid}, + {"IBM ", "ProFibre 4000R ", MULTIBUS, &get_evpd_wwid}, + {"SGI ", "TP9100 ", MULTIBUS, &get_evpd_wwid}, + {"SGI ", "TP9300 ", MULTIBUS, &get_evpd_wwid}, + {"SGI ", "TP9400 ", MULTIBUS, &get_evpd_wwid}, + {"SGI ", "TP9500 ", MULTIBUS, &get_evpd_wwid}, + {NULL, NULL, 0, NULL}, + }; + + for (i = 0; wlist[i].vendor; i++) { + if (strncmp(mypath->vendor_id, wlist[i].vendor, 8) == 0 && + strncmp(mypath->product_id, wlist[i].product, 16) == 0) { + mypath->iopolicy = wlist[i].iopolicy; + if (!wlist[i].getuid(mypath->sg_dev, mypath->wwid)) + return 0; + } + } + return 1; +} + +static int +sysfsdevice2devname (char *devname, char *device) +{ + char sysfs_path[FILE_NAME_SIZE]; + char block_path[FILE_NAME_SIZE]; + char link_path[FILE_NAME_SIZE]; + int r; + + if (sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { + fprintf(stderr, "[device] feature available with sysfs only\n"); + exit (1); + } + + sprintf(link_path, "%s%s/block", sysfs_path, device); + + r = sysfs_get_link(link_path, block_path, FILE_NAME_SIZE); + + if (r != 0) + return 1; + + sysfs_get_name_from_path(block_path, devname, FILE_NAME_SIZE); + + return 0; +} + + +static int +devt2devname (char *devname, int major, int minor) +{ + struct sysfs_directory * sdir; + struct sysfs_directory * devp; + char sysfs_path[FILE_NAME_SIZE]; + char block_path[FILE_NAME_SIZE]; + char attr_path[FILE_NAME_SIZE]; + char attr_value[16]; + char attr_ref_value[16]; + + if (sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { + fprintf(stderr, "-D feature available with sysfs only\n"); + exit (1); + } + + sprintf(attr_ref_value, "%i:%i\n", major, minor); + sprintf(block_path, "%s/block", sysfs_path); + sdir = sysfs_open_directory(block_path); + sysfs_read_directory(sdir); + + dlist_for_each_data(sdir->subdirs, devp, struct sysfs_directory) { + sprintf(attr_path, "%s/%s/dev", block_path, devp->name); + sysfs_read_attribute_value(attr_path, attr_value, 16); + + if (!strcmp(attr_value, attr_ref_value)) { + sprintf(attr_path, "%s/%s", block_path, devp->name); + sysfs_get_name_from_path(attr_path, devname, FILE_NAME_SIZE); + break; + } + } + + sysfs_close_directory(sdir); + + return 0; +} + +static int +blacklist (char * dev) { + int i; + static struct { + char * headstr; + int lengh; + } blist[] = { + {"cciss", 5}, + {"hd", 2}, + {"md", 2}, + {"dm", 2}, + {"sr", 2}, + {"scd", 3}, + {"ram", 3}, + {"raw", 3}, + {NULL, 0}, + }; + + for (i = 0; blist[i].lengh; i++) { + if (strncmp(dev, blist[i].headstr, blist[i].lengh) == 0) + return 1; + } + return 0; +} + +static int +devinfo (struct path *curpath) +{ + get_lun_strings(curpath->vendor_id, + curpath->product_id, + curpath->rev, + curpath->sg_dev); + get_serial(curpath->serial, curpath->sg_dev); + curpath->tur = do_tur(curpath->sg_dev); + if (!get_unique_id(curpath)) + return 1; + + return 0; +} + + +static int +get_all_paths_sysfs(struct env * conf, struct path * all_paths) +{ + int k=0; + struct sysfs_directory * sdir; + struct sysfs_directory * devp; + struct sysfs_link * linkp; + char refwwid[WWID_SIZE]; + char empty_buff[WWID_SIZE]; + char buff[FILE_NAME_SIZE]; + char path[FILE_NAME_SIZE]; + struct path curpath; + + memset(empty_buff, 0, WWID_SIZE); + memset(refwwid, 0, WWID_SIZE); + + /* if called from hotplug, only consider the paths that relate + to the device pointed by conf.hotplugdev */ + + if (strncmp("/devices", conf->hotplugdev, 8) == 0) { + if (sysfsdevice2devname (buff, conf->hotplugdev)) + return 0; + + sprintf(curpath.sg_dev, "/dev/%s", buff); + + if (devinfo(&curpath)) + return 0; + + strcpy(refwwid, curpath.wwid); + memset(&curpath, 0, sizeof(path)); + } + + /* if major/minor specified on the cmd line, + only consider affiliated paths */ + + if (conf->major >= 0 && conf->minor >= 0) { + if (devt2devname(buff, conf->major, conf->minor)) + return 0; + + sprintf(curpath.sg_dev, "/dev/%s", buff); + + if (devinfo(&curpath)) + return 0; + + strcpy(refwwid, curpath.wwid); + memset(&curpath, 0, sizeof(path)); + } + + + sprintf(path, "%s/block", conf->sysfs_path); + sdir = sysfs_open_directory(path); + sysfs_read_directory(sdir); + + dlist_for_each_data(sdir->subdirs, devp, struct sysfs_directory) { + if (blacklist(devp->name)) + continue; + + sysfs_read_directory(devp); + + if(devp->links == NULL) + continue; + + dlist_for_each_data(devp->links, linkp, struct sysfs_link) { + if (!strncmp(linkp->name, "device", 6)) + break; + } + + if (linkp == NULL) { + continue; + } + + basename(devp->path, buff); + sprintf(curpath.sg_dev, "/dev/%s", buff); + + if(devinfo(&curpath)) { + memset(&curpath, 0, sizeof(path)); + continue; + } + + if (memcmp(empty_buff, refwwid, WWID_SIZE) != 0 && + strncmp(curpath.wwid, refwwid, WWID_SIZE) != 0) { + memset(&curpath, 0, sizeof(path)); + continue; + } + + strcpy(all_paths[k].sg_dev, curpath.sg_dev); + strcpy(all_paths[k].dev, curpath.sg_dev); + strcpy(all_paths[k].wwid, curpath.wwid); + strcpy(all_paths[k].vendor_id, curpath.vendor_id); + strcpy(all_paths[k].product_id, curpath.product_id); + all_paths[k].iopolicy = curpath.iopolicy; + all_paths[k].tur = curpath.tur; + + /* done with curpath, zero for reuse */ + memset(&curpath, 0, sizeof(path)); + + basename(linkp->target, buff); + sscanf(buff, "%i:%i:%i:%i", + &all_paths[k].sg_id.host_no, + &all_paths[k].sg_id.channel, + &all_paths[k].sg_id.scsi_id, + &all_paths[k].sg_id.lun); + k++; + } + sysfs_close_directory(sdir); + return 0; +} + +static int +get_all_paths_nosysfs(struct env * conf, struct path * all_paths, + struct scsi_dev * all_scsi_ids) +{ + int k, i, fd; + char buff[FILE_NAME_SIZE]; + char file_name[FILE_NAME_SIZE]; + + for (k = 0; k < conf->max_devs; k++) { + strcpy(file_name, "/dev/sg"); + sprintf(buff, "%d", k); + strncat(file_name, buff, FILE_NAME_SIZE); + strcpy(all_paths[k].sg_dev, file_name); + + get_lun_strings(all_paths[k].vendor_id, + all_paths[k].product_id, + all_paths[k].rev, + all_paths[k].sg_dev); + get_serial(all_paths[k].serial, all_paths[k].sg_dev); + if (!get_unique_id(&all_paths[k])) + continue; + + if ((fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) + return 0; + + if (0 > ioctl(fd, SG_GET_SCSI_ID, &(all_paths[k].sg_id))) + printf("device %s failed on sg ioctl, skip\n", + file_name); + + close(fd); + + for (i = 0; i < conf->max_devs; i++) { + if ((all_paths[k].sg_id.host_no == + all_scsi_ids[i].host_no) + && (all_paths[k].sg_id.scsi_id == + (all_scsi_ids[i].scsi_id.dev_id & 0xff)) + && (all_paths[k].sg_id.lun == + ((all_scsi_ids[i].scsi_id.dev_id >> 8) & 0xff)) + && (all_paths[k].sg_id.channel == + ((all_scsi_ids[i].scsi_id. + dev_id >> 16) & 0xff))) { + strcpy(all_paths[k].dev, all_scsi_ids[i].dev); + break; + } + } + } + return 0; +} + +static int +get_all_scsi_ids(struct env * conf, struct scsi_dev * all_scsi_ids) +{ + int k, big, little, res, host_no, fd; + char buff[64]; + char fname[FILE_NAME_SIZE]; + struct scsi_idlun my_scsi_id; + + for (k = 0; k < conf->max_devs; k++) { + strcpy(fname, "/dev/sd"); + if (k < 26) { + buff[0] = 'a' + (char) k; + buff[1] = '\0'; + strcat(fname, buff); + } else if (k <= 255) { + /* assumes sequence goes x,y,z,aa,ab,ac etc */ + big = k / 26; + little = k - (26 * big); + big = big - 1; + + buff[0] = 'a' + (char) big; + buff[1] = 'a' + (char) little; + buff[2] = '\0'; + strcat(fname, buff); + } else + strcat(fname, "xxxx"); + + if ((fd = open(fname, O_RDONLY)) < 0) { + if (conf->verbose) + fprintf(stderr, "can't open %s. mknod ?", + fname); + continue; + } + + res = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &my_scsi_id); + if (res < 0) { + close(fd); + printf("Could not get scsi idlun\n"); + continue; + } + + res = ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &host_no); + if (res < 0) { + close(fd); + printf("Could not get host_no\n"); + continue; + } + + close(fd); + + strcpy(all_scsi_ids[k].dev, fname); + all_scsi_ids[k].scsi_id = my_scsi_id; + all_scsi_ids[k].host_no = host_no; + } + return 0; +} + +/* print_path style */ +#define ALL 0 +#define NOWWID 1 + +static void +print_path(struct path * all_paths, int k, int style) +{ + if (style != NOWWID) + printf("%s ", all_paths[k].wwid); + else + printf(" \\_"); + printf("(%i %i %i %i) ", + all_paths[k].sg_id.host_no, + all_paths[k].sg_id.channel, + all_paths[k].sg_id.scsi_id, all_paths[k].sg_id.lun); + if(0 != strcmp(all_paths[k].sg_dev, all_paths[k].dev)) + printf("%s ", all_paths[k].sg_dev); + printf("%s ", all_paths[k].dev); + printf("[%.16s]\n", all_paths[k].product_id); +} + +static void +print_all_path(struct env * conf, struct path * all_paths) +{ + int k; + char empty_buff[WWID_SIZE]; + + memset(empty_buff, 0, WWID_SIZE); + for (k = 0; k < conf->max_devs; k++) { + if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) + continue; + print_path(all_paths, k, ALL); + } +} + +static void +print_all_mp(struct path * all_paths, struct multipath * mp, int nmp) +{ + int k, i; + + for (k = 0; k <= nmp; k++) { + printf("%s\n", mp[k].wwid); + for (i = 0; i <= mp[k].npaths; i++) + print_path(all_paths, PINDEX(k,i), NOWWID); + } +} + +static int +coalesce_paths(struct env * conf, struct multipath * mp, + struct path * all_paths) +{ + int k, i, nmp, np, already_done; + char empty_buff[WWID_SIZE]; + + nmp = -1; + already_done = 0; + memset(empty_buff, 0, WWID_SIZE); + + for (k = 0; k < conf->max_devs - 1; k++) { + /* skip this path for some reason */ + + /* 1. if path has no unique id */ + if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) + continue; + + /* 2. if mp with this uid already instanciated */ + for (i = 0; i <= nmp; i++) { + if (0 == strcmp(mp[i].wwid, all_paths[k].wwid)) + already_done = 1; + } + if (already_done) { + already_done = 0; + continue; + } + + /* at this point, we know we really got a new mp */ + np = 0; + nmp++; + strcpy(mp[nmp].wwid, all_paths[k].wwid); + PINDEX(nmp,np) = k; + + if (mp[nmp].size == 0) + mp[nmp].size = get_disk_size(all_paths[k].dev); + + for (i = k + 1; i < conf->max_devs; i++) { + if (0 == strcmp(all_paths[k].wwid, all_paths[i].wwid)) { + np++; + PINDEX(nmp,np) = i; + mp[nmp].npaths = np; + } + } + } + return nmp; +} + +static void +group_by_tur(struct multipath * mp, struct path * all_paths, char * str) { + int left_path_count = 0; + int right_path_count = 0; + int i; + char left_path_buff[FILE_NAME_SIZE], right_path_buff[FILE_NAME_SIZE]; + char * left_path_buff_p = &left_path_buff[0]; + char * right_path_buff_p = &right_path_buff[0]; + + for (i = 0; i <= mp->npaths; i++) { + if (all_paths[mp->pindex[i]].tur) { + left_path_buff_p += sprintf(left_path_buff_p, " %s", all_paths[mp->pindex[i]].dev); + left_path_count++; + } else { + right_path_buff_p += sprintf(right_path_buff_p, " %s", all_paths[mp->pindex[i]].dev); + right_path_count++; + } + } + if (!left_path_count) + sprintf(str, " 1 round-robin %i 0 %s", right_path_count, right_path_buff); + else if (!right_path_count) + sprintf(str, " 1 round-robin %i 0 %s", left_path_count, left_path_buff); + else + sprintf(str, " 2 round-robin %i 0 %s round-robin %i 0 %s", + left_path_count, left_path_buff, + right_path_count, right_path_buff); +} + +static void +group_by_serial(struct multipath * mp, struct path * all_paths, char * str) { + int path_count, pg_count = 0; + int i, k; + int * bitmap; + char path_buff[FILE_NAME_SIZE]; + char pg_buff[FILE_NAME_SIZE]; + char * path_buff_p = &path_buff[0]; + char * pg_buff_p = &pg_buff[0]; + + /* init the bitmap */ + bitmap = malloc((mp->npaths + 1) * sizeof(int)); + memset(bitmap, 0, (mp->npaths + 1) * sizeof(int)); + + for (i = 0; i <= mp->npaths; i++) { + if (bitmap[i]) + continue; + + /* here, we really got a new pg */ + pg_count++; + path_count = 1; + memset(&path_buff, 0, FILE_NAME_SIZE * sizeof(char)); + path_buff_p = &path_buff[0]; + + path_buff_p += sprintf(path_buff_p, " %s", all_paths[mp->pindex[i]].dev); + bitmap[i] = 1; + + for (k = i + 1; k <= mp->npaths; k++) { + if (bitmap[k]) + continue; + if (0 == strcmp(all_paths[mp->pindex[i]].serial, + all_paths[mp->pindex[k]].serial)) { + path_buff_p += sprintf(path_buff_p, " %s", all_paths[mp->pindex[k]].dev); + bitmap[k] = 1; + path_count++; + } + } + pg_buff_p += sprintf(pg_buff_p, " round-robin %i 0%s", + path_count, path_buff); + } + sprintf(str, " %i%s", pg_count, pg_buff); + free(bitmap); +} + +static int +dm_simplecmd(int task, const char *name) { + int r = 0; + struct dm_task *dmt; + + if (!(dmt = dm_task_create(task))) + return 0; + + if (!dm_task_set_name(dmt, name)) + goto out; + + r = dm_task_run(dmt); + + out: + dm_task_destroy(dmt); + return r; +} + +static int +dm_addmap(int task, const char *name, const char *params, long size) { + struct dm_task *dmt; + + if (!(dmt = dm_task_create(task))) + return 0; + + if (!dm_task_set_name(dmt, name)) + goto addout; + + if (!dm_task_add_target(dmt, 0, size, DM_TARGET, params)) + goto addout; + + if (!dm_task_run(dmt)) + goto addout; + + addout: + dm_task_destroy(dmt); + return 1; +} + +static int +setup_map(struct env * conf, struct path * all_paths, + struct multipath * mp, int index, int op) +{ + char params[255]; + char * params_p; + int i, np; + + /* defaults for multipath target */ + char * dm_ps_name = "round-robin"; + int dm_ps_nr_args = 0; + + params_p = ¶ms[0]; + + np = 0; + for (i=0; i<=mp[index].npaths; i++) { + if (0 == all_paths[PINDEX(index,i)].sg_id.scsi_type) + np++; + } + + if (np < 1) + return 0; + + if ((all_paths[PINDEX(index,0)].iopolicy == MULTIBUS && + conf->iopolicy == -1) || conf->iopolicy == MULTIBUS) { + params_p += sprintf(params_p, " 1 %s %i %i", + dm_ps_name, np, dm_ps_nr_args); + + for (i=0; i<=mp[index].npaths; i++) { + if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) + continue; + params_p += sprintf(params_p, " %s", + all_paths[PINDEX(index,i)].dev); + } + } + + if ((all_paths[PINDEX(index,0)].iopolicy == FAILOVER && + conf->iopolicy == -1) || conf->iopolicy == FAILOVER) { + params_p += sprintf(params_p, " %i", mp[index].npaths + 1); + for (i=0; i<=mp[index].npaths; i++) { + if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) + continue; + params_p += sprintf(params_p, " %s ", + dm_ps_name); + params_p += sprintf(params_p, "1 %i", + dm_ps_nr_args); + params_p += sprintf(params_p, " %s", + all_paths[PINDEX(index,i)].dev); + } + } + + if ((all_paths[PINDEX(index,0)].iopolicy == GROUP_BY_SERIAL && + conf->iopolicy == -1) || conf->iopolicy == GROUP_BY_SERIAL) { + group_by_serial(&mp[index], all_paths, params_p); + } + + if ((all_paths[PINDEX(index,0)].iopolicy == GROUP_BY_TUR && + conf->iopolicy == -1) || conf->iopolicy == GROUP_BY_TUR) { + group_by_tur(&mp[index], all_paths, params_p); + } + + if (mp[index].size < 0) + return 0; + + if (!conf->quiet) { + if (op == DM_DEVICE_RELOAD) + printf("U:"); + if (op == DM_DEVICE_CREATE) + printf("N:"); + printf("%s:0 %li %s %s\n", + mp[index].wwid, mp[index].size, DM_TARGET, params); + } + + if (op == DM_DEVICE_RELOAD) + dm_simplecmd(DM_DEVICE_SUSPEND, mp[index].wwid); + + dm_addmap(op, mp[index].wwid, params, mp[index].size); + + if (op == DM_DEVICE_RELOAD) + dm_simplecmd(DM_DEVICE_RESUME, mp[index].wwid); + + return 1; +} + +static int +map_present(char * str) +{ + int r = 0; + struct dm_task *dmt; + struct dm_names *names; + unsigned next = 0; + + if (!(dmt = dm_task_create(DM_DEVICE_LIST))) + return 0; + + if (!dm_task_run(dmt)) + goto out; + + if (!(names = dm_task_get_names(dmt))) + goto out; + + if (!names->dev) { + goto out; + } + + do { + if (0 == strcmp(names->name, str)) + r = 1; + next = names->next; + names = (void *) names + next; + } while (next); + + out: + dm_task_destroy(dmt); + return r; +} + +static void +signal_daemon (void) +{ + FILE *file; + pid_t pid; + char *buf; + + buf = malloc (8); + + file = fopen (PIDFILE, "r"); + + if (!file) { + fprintf(stderr, "cannot signal daemon, pidfile not found\n"); + return; + } + + buf = fgets (buf, 8, file); + fclose (file); + + pid = (pid_t) atol (buf); + free (buf); + + kill(pid, SIGHUP); +} + +static int +filepresent(char * run) { + struct stat buf; + + if(!stat(run, &buf)) + return 1; + return 0; +} + +static void +usage(char * progname) +{ + fprintf(stderr, VERSION_STRING); + fprintf(stderr, "Usage: %s [-v|-q] [-d] [-m max_devs]\n", + progname); + fprintf(stderr, " [-p failover|multibus|group_by_serial]\n" \ + " [device]\n" \ + "\n" \ + "\t-v\t\tverbose, print all paths and multipaths\n" \ + "\t-q\t\tquiet, no output at all\n" \ + "\t-d\t\tdry run, do not create or update devmaps\n" \ + "\t-m max_devs\tscan {max_devs} devices at most\n" \ + "\n" \ + "\t-p policy\tforce maps to specified policy :\n" \ + "\t failover\t\t- 1 path per priority group\n" \ + "\t multibus\t\t- all paths in 1 priority group\n" \ + "\t group_by_serial\t- 1 priority group per serial\n" \ + "\t group_by_tur\t\t- 1 priority group per TUR state\n" \ + "\n" \ + "\t-D maj min\tlimit scope to the device's multipath\n" \ + "\t\t\t(major minor device reference)\n" + "\tdevice\t\tlimit scope to the device's multipath\n" \ + "\t\t\t(hotplug-style $DEVPATH reference)\n" + ); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + struct multipath * mp; + struct path * all_paths; + struct scsi_dev * all_scsi_ids; + struct env conf; + int i, k, nmp; + int try = 0; + + /* Don't run in parallel */ + while (filepresent(RUN) && try++ < MAXTRY) + usleep(100000); + + if (filepresent(RUN)) { + fprintf(stderr, "waited for to long. exiting\n"); + exit (1); + } + + /* Our turn */ + if (!open(RUN, O_CREAT)) { + fprintf(stderr, "can't create runfile\n"); + exit (1); + } + + /* Default behaviour */ + conf.max_devs = MAX_DEVS; + conf.dry_run = 0; /* 1 == Do not Create/Update devmaps */ + conf.verbose = 0; /* 1 == Print all_paths and mp */ + conf.quiet = 0; /* 1 == Do not even print devmaps */ + conf.iopolicy = -1; /* Apply the defaults in get_unique_id() */ + conf.major = -1; + conf.minor = -1; + + for (i = 1; i < argc; ++i) { + if (0 == strcmp("-v", argv[i])) { + if (conf.quiet == 1) + usage(argv[0]); + conf.verbose = 1; + } else if (0 == strcmp("-m", argv[i])) { + conf.max_devs = atoi(argv[++i]); + if (conf.max_devs < 2) + usage(argv[0]); + } else if (0 == strcmp("-D", argv[i])) { + conf.major = atoi(argv[++i]); + conf.minor = atoi(argv[++i]); + } else if (0 == strcmp("-q", argv[i])) { + if (conf.verbose == 1) + usage(argv[0]); + conf.quiet = 1; + } else if (0 == strcmp("-d", argv[i])) + conf.dry_run = 1; + else if (0 == strcmp("-p", argv[i])) { + i++; + if (!strcmp(argv[i], "failover")) + conf.iopolicy = FAILOVER; + if (!strcmp(argv[i], "multibus")) + conf.iopolicy = MULTIBUS; + if (!strcmp(argv[i], "group_by_serial")) + conf.iopolicy = GROUP_BY_SERIAL; + if (!strcmp(argv[i], "group_by_tur")) + conf.iopolicy = GROUP_BY_TUR; + } else if (*argv[i] == '-') { + fprintf(stderr, "Unknown switch: %s\n", argv[i]); + usage(argv[0]); + } else + strncpy(conf.hotplugdev, argv[i], FILE_NAME_SIZE); + } + + /* dynamic allocations */ + mp = malloc(conf.max_devs * sizeof(struct multipath)); + all_paths = malloc(conf.max_devs * sizeof(struct path)); + all_scsi_ids = malloc(conf.max_devs * sizeof(struct scsi_dev)); + if (mp == NULL || all_paths == NULL || all_scsi_ids == NULL) + exit(1); + + if (sysfs_get_mnt_path(conf.sysfs_path, FILE_NAME_SIZE)) { + get_all_scsi_ids(&conf, all_scsi_ids); + get_all_paths_nosysfs(&conf, all_paths, all_scsi_ids); + } else { + get_all_paths_sysfs(&conf, all_paths); + } + + nmp = coalesce_paths(&conf, mp, all_paths); + + if (conf.verbose) { + print_all_path(&conf, all_paths); + fprintf(stdout, "\n"); + print_all_mp(all_paths, mp, nmp); + fprintf(stdout, "\n"); + } + + if (conf.dry_run) + exit(0); + + for (k=0; k<=nmp; k++) { + if (map_present(mp[k].wwid)) { + setup_map(&conf, all_paths, mp, k, DM_DEVICE_RELOAD); + } else { + setup_map(&conf, all_paths, mp, k, DM_DEVICE_CREATE); + } + } + + /* signal multipathd that new devmaps may have come up */ + signal_daemon(); + + /* free allocs */ + free(mp); + free(all_paths); + free(all_scsi_ids); + + /* release runfile */ + unlink(RUN); + + exit(0); +} diff --git a/extras/multipath-tools/multipath/main.h b/extras/multipath-tools/multipath/main.h new file mode 100644 index 0000000000..ada7a7394b --- /dev/null +++ b/extras/multipath-tools/multipath/main.h @@ -0,0 +1,131 @@ +/* + * Soft: Description here... + * + * Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $ + * + * Author: Copyright (C) 2003 Christophe Varoqui + * + * 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. + * + * 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; either version + * 2 of the License, or (at your option) any later version. + */ + +#ifndef _MAIN_H +#define _MAIN_H + +/* local includes */ +#include "sg_include.h" + +/* exerpt from "sg_err.h" */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SG_ERR_DRIVER_SENSE 0x08 + +/* exerpt from "scsi.h" */ +#define SCSI_IOCTL_GET_IDLUN 0x5382 +#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 + +/* global defs */ +#define WWID_SIZE 33 +#define SERIAL_SIZE 14 +#define MAX_DEVS 128 +#define MAX_MP MAX_DEVS / 2 +#define MAX_MP_PATHS MAX_DEVS / 4 +#define FILE_NAME_SIZE 256 +#define DEF_TIMEOUT 60000 +#define EBUFF_SZ 256 +#define TUR_CMD_LEN 6 +#define DM_TARGET "multipath" +#define PIDFILE "/var/run/multipathd.pid" +#define RUN "/var/run/multipath.run" +#define MAXTRY 50 + +/* Storage controlers cpabilities */ +#define FAILOVER 0 +#define MULTIBUS 1 +#define GROUP_BY_SERIAL 2 +#define GROUP_BY_TUR 4 + +#define PINDEX(x,y) mp[(x)].pindex[(y)] + +/* global types */ +struct scsi_idlun { + int dev_id; + int host_unique_id; + int host_no; +}; + +struct sg_id { + int host_no; + int channel; + int scsi_id; + int lun; + int scsi_type; + short h_cmd_per_lun; + short d_queue_depth; + int unused1; + int unused2; +}; + +struct scsi_dev { + char dev[FILE_NAME_SIZE]; + struct scsi_idlun scsi_id; + int host_no; +}; + +struct path { + char dev[FILE_NAME_SIZE]; + char sg_dev[FILE_NAME_SIZE]; + struct scsi_idlun scsi_id; + struct sg_id sg_id; + char wwid[WWID_SIZE]; + char vendor_id[8]; + char product_id[16]; + char rev[4]; + char serial[SERIAL_SIZE]; + int iopolicy; + int tur; +}; + +struct multipath { + char wwid[WWID_SIZE]; + int npaths; + long size; + int pindex[MAX_MP_PATHS]; +}; + +struct env { + int max_devs; + int verbose; + int quiet; + int dry_run; + int iopolicy; + int with_sysfs; + int major; + int minor; + char sysfs_path[FILE_NAME_SIZE]; + char hotplugdev[FILE_NAME_SIZE]; +}; + +/* Build version */ +#define PROG "multipath" + +#define VERSION_CODE 0x000012 +#define DATE_CODE 0x021504 + +#define MULTIPATH_VERSION(version) \ + (version >> 16) & 0xFF, \ + (version >> 8) & 0xFF, \ + version & 0xFF + +#define VERSION_STRING PROG" v%d.%d.%d (%.2d/%.2d, 20%.2d)\n", \ + MULTIPATH_VERSION(VERSION_CODE), \ + MULTIPATH_VERSION(DATE_CODE) + +#endif diff --git a/extras/multipath-tools/multipath/multipath.8 b/extras/multipath-tools/multipath/multipath.8 new file mode 100644 index 0000000000..0856ca8dfc --- /dev/null +++ b/extras/multipath-tools/multipath/multipath.8 @@ -0,0 +1,66 @@ +.TH MULTIPATH 8 "February 2004" "" "Linux Administrator's Manual" +.SH NAME +multipath \- Device mapper target autoconfig +.SH SYNOPSIS +.B multipath +.RB [\| \-v | \-q \|] +.RB [\| \-d \|] +.RB [\| \-i\ \c +.IR int \|] +.RB [\| \-m\ \c +.IR max_devs \|] +.RB [\| \-p\ \c +.BR failover | multibus | group_by_serial \|] +.RB [\| device \|] +.SH DESCRIPTION +.B multipath +is used to detect multiple paths to devices for fail-over or performance reasons and coalesces them. +.SH OPTIONS +.TP +.B \-v +verbose, print all paths and multipaths +.TP +.B \-q +quiet, no output at all +.TP +.B \-d +dry run, do not create or update devmaps +.TP +.BI \-i " int" +multipath target param: polling interval +.TP +.BI \-m " max_devs" +scan +.I max_devs +devices at most +.TP +.BI \-D " major minor" +update only the devmap the path pointed by +.I major minor +is in +.TP +.BI \-p " policy" +force maps to specified policy: +.RS 1.2i +.TP 1.2i +.B failover +1 path per priority group +.TP +.B multibus +all paths in 1 priority group +.TP +.B group_by_serial +1 priority group per serial +.RE +.TP +.BI device +update only the devmap the path pointed by +.I device +is in +.SH "SEE ALSO" +.BR udev (8), +.BR dmsetup (8) +.BR hotplug (8) +.SH AUTHORS +.B multipath +was developed by Christophe Varoqui, and others. diff --git a/extras/multipath-tools/multipath/multipath.hotplug b/extras/multipath-tools/multipath/multipath.hotplug new file mode 100644 index 0000000000..5c411d1edf --- /dev/null +++ b/extras/multipath-tools/multipath/multipath.hotplug @@ -0,0 +1,7 @@ +#!/bin/sh +. /etc/hotplug/hotplug.functions + +# wait for sysfs +sleep 1 + +mesg `/sbin/multipath $DEVPATH` diff --git a/extras/multipath-tools/multipath/sg_err.h b/extras/multipath-tools/multipath/sg_err.h new file mode 100644 index 0000000000..ef57b5ce38 --- /dev/null +++ b/extras/multipath-tools/multipath/sg_err.h @@ -0,0 +1,162 @@ +#ifndef SG_ERR_H +#define SG_ERR_H + +/* Feel free to copy and modify this GPL-ed code into your applications. */ + +/* Version 0.90 (20030519) +*/ + + +/* Some of the following error/status codes are exchanged between the + various layers of the SCSI sub-system in Linux and should never + reach the user. They are placed here for completeness. What appears + here is copied from drivers/scsi/scsi.h which is not visible in + the user space. */ + +#ifndef SCSI_CHECK_CONDITION +/* Following are the "true" SCSI status codes. Linux has traditionally + used a 1 bit right and masked version of these. So now CHECK_CONDITION + and friends (in ) are deprecated. */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_CONDITION_MET 0x4 +#define SCSI_BUSY 0x8 +#define SCSI_IMMEDIATE 0x10 +#define SCSI_IMMEDIATE_CONDITION_MET 0x14 +#define SCSI_RESERVATION_CONFLICT 0x18 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SCSI_TASK_SET_FULL 0x28 +#define SCSI_ACA_ACTIVE 0x30 +#define SCSI_TASK_ABORTED 0x40 +#endif + +/* The following are 'host_status' codes */ +#ifndef DID_OK +#define DID_OK 0x00 +#endif +#ifndef DID_NO_CONNECT +#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ +#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ +#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ +#define DID_BAD_TARGET 0x04 /* Bad target (id?) */ +#define DID_ABORT 0x05 /* Told to abort for some other reason */ +#define DID_PARITY 0x06 /* Parity error (on SCSI bus) */ +#define DID_ERROR 0x07 /* Internal error */ +#define DID_RESET 0x08 /* Reset by somebody */ +#define DID_BAD_INTR 0x09 /* Received an unexpected interrupt */ +#define DID_PASSTHROUGH 0x0a /* Force command past mid-level */ +#define DID_SOFT_ERROR 0x0b /* The low-level driver wants a retry */ +#endif + +/* These defines are to isolate applictaions from kernel define changes */ +#define SG_ERR_DID_OK DID_OK +#define SG_ERR_DID_NO_CONNECT DID_NO_CONNECT +#define SG_ERR_DID_BUS_BUSY DID_BUS_BUSY +#define SG_ERR_DID_TIME_OUT DID_TIME_OUT +#define SG_ERR_DID_BAD_TARGET DID_BAD_TARGET +#define SG_ERR_DID_ABORT DID_ABORT +#define SG_ERR_DID_PARITY DID_PARITY +#define SG_ERR_DID_ERROR DID_ERROR +#define SG_ERR_DID_RESET DID_RESET +#define SG_ERR_DID_BAD_INTR DID_BAD_INTR +#define SG_ERR_DID_PASSTHROUGH DID_PASSTHROUGH +#define SG_ERR_DID_SOFT_ERROR DID_SOFT_ERROR + +/* The following are 'driver_status' codes */ +#ifndef DRIVER_OK +#define DRIVER_OK 0x00 +#endif +#ifndef DRIVER_BUSY +#define DRIVER_BUSY 0x01 +#define DRIVER_SOFT 0x02 +#define DRIVER_MEDIA 0x03 +#define DRIVER_ERROR 0x04 +#define DRIVER_INVALID 0x05 +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_HARD 0x07 +#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ + +/* Following "suggests" are "or-ed" with one of previous 8 entries */ +#define SUGGEST_RETRY 0x10 +#define SUGGEST_ABORT 0x20 +#define SUGGEST_REMAP 0x30 +#define SUGGEST_DIE 0x40 +#define SUGGEST_SENSE 0x80 +#define SUGGEST_IS_OK 0xff +#endif +#ifndef DRIVER_MASK +#define DRIVER_MASK 0x0f +#endif +#ifndef SUGGEST_MASK +#define SUGGEST_MASK 0xf0 +#endif + +/* These defines are to isolate applictaions from kernel define changes */ +#define SG_ERR_DRIVER_OK DRIVER_OK +#define SG_ERR_DRIVER_BUSY DRIVER_BUSY +#define SG_ERR_DRIVER_SOFT DRIVER_SOFT +#define SG_ERR_DRIVER_MEDIA DRIVER_MEDIA +#define SG_ERR_DRIVER_ERROR DRIVER_ERROR +#define SG_ERR_DRIVER_INVALID DRIVER_INVALID +#define SG_ERR_DRIVER_TIMEOUT DRIVER_TIMEOUT +#define SG_ERR_DRIVER_HARD DRIVER_HARD +#define SG_ERR_DRIVER_SENSE DRIVER_SENSE +#define SG_ERR_SUGGEST_RETRY SUGGEST_RETRY +#define SG_ERR_SUGGEST_ABORT SUGGEST_ABORT +#define SG_ERR_SUGGEST_REMAP SUGGEST_REMAP +#define SG_ERR_SUGGEST_DIE SUGGEST_DIE +#define SG_ERR_SUGGEST_SENSE SUGGEST_SENSE +#define SG_ERR_SUGGEST_IS_OK SUGGEST_IS_OK +#define SG_ERR_DRIVER_MASK DRIVER_MASK +#define SG_ERR_SUGGEST_MASK SUGGEST_MASK + + + +/* The following "print" functions send ACSII to stdout */ +extern void sg_print_command(const unsigned char * command); +extern void sg_print_sense(const char * leadin, + const unsigned char * sense_buffer, int sb_len); +extern void sg_print_status(int masked_status); +extern void sg_print_scsi_status(int scsi_status); +extern void sg_print_host_status(int host_status); +extern void sg_print_driver_status(int driver_status); + +/* sg_chk_n_print() returns 1 quietly if there are no errors/warnings + else it prints to standard output and returns 0. */ +extern int sg_chk_n_print(const char * leadin, int masked_status, + int host_status, int driver_status, + const unsigned char * sense_buffer, int sb_len); + +/* The following function declaration is for the sg version 3 driver. + Only version 3 sg_err.c defines it. */ +struct sg_io_hdr; +extern int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp); + + +/* The following "category" function returns one of the following */ +#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ +#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ +#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ +#define SG_ERR_CAT_TIMEOUT 3 +#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_SENSE 98 /* Something else is in the sense buffer */ +#define SG_ERR_CAT_OTHER 99 /* Some other error/warning has occurred */ + +extern int sg_err_category(int masked_status, int host_status, + int driver_status, const unsigned char * sense_buffer, + int sb_len); + +extern int sg_err_category_new(int scsi_status, int host_status, + int driver_status, const unsigned char * sense_buffer, + int sb_len); + +/* The following function declaration is for the sg version 3 driver. + Only version 3 sg_err.c defines it. */ +extern int sg_err_category3(struct sg_io_hdr * hp); + +/* Returns length of SCSI command given the opcode (first byte) */ +extern int sg_get_command_size(unsigned char opcode); + +extern void sg_get_command_name(unsigned char opcode, int buff_len, + char * buff); + +#endif diff --git a/extras/multipath-tools/multipath/sg_include.h b/extras/multipath-tools/multipath/sg_include.h new file mode 100644 index 0000000000..460506826e --- /dev/null +++ b/extras/multipath-tools/multipath/sg_include.h @@ -0,0 +1,43 @@ +#ifdef SG_KERNEL_INCLUDES + #define __user + typedef unsigned char u8; + #include "/usr/src/linux/include/scsi/sg.h" + #include "/usr/src/linux/include/scsi/scsi.h" +#else + #ifdef SG_TRICK_GNU_INCLUDES + #include + #include + #else + #include + #endif +#endif + +/* + Getting the correct include files for the sg interface can be an ordeal. + In a perfect world, one would just write: + #include + #include + This would include the files found in the /usr/include/scsi directory. + Those files are maintained with the GNU library which may or may not + agree with the kernel and version of sg driver that is running. Any + many cases this will not matter. However in some it might, for example + glibc 2.1's include files match the sg driver found in the lk 2.2 + series. Hence if glibc 2.1 is used with lk 2.4 then the additional + sg v3 interface will not be visible. + If this is a problem then defining SG_KERNEL_INCLUDES will access the + kernel supplied header files (assuming they are in the normal place). + The GNU library maintainers and various kernel people don't like + this approach (but it does work). + The technique selected by defining SG_TRICK_GNU_INCLUDES worked (and + was used) prior to glibc 2.2 . Prior to that version /usr/include/linux + was a symbolic link to /usr/src/linux/include/linux . + + There are other approaches if this include "mixup" causes pain. These + would involve include files being copied or symbolic links being + introduced. + + Sorry about the inconvenience. Typically neither SG_KERNEL_INCLUDES + nor SG_TRICK_GNU_INCLUDES is defined. + + dpg 20010415, 20030522 +*/ diff --git a/extras/multipath-tools/multipath/unused.c b/extras/multipath-tools/multipath/unused.c new file mode 100644 index 0000000000..08144cf717 --- /dev/null +++ b/extras/multipath-tools/multipath/unused.c @@ -0,0 +1,95 @@ +static int +get_serial (int fd, char * str) +{ + char buff[MX_ALLOC_LEN + 1]; + int len; + + if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { + len = buff[3]; + if (len > 0) { + memcpy(str, buff + 4, len); + buff[len] = '\0'; + } + return 1; + } + return 0; +} + +static int +do_tur(int fd) +{ + unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; + struct sg_io_hdr io_hdr; + unsigned char sense_buffer[32]; + + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (turCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_buffer); + io_hdr.dxfer_direction = SG_DXFER_NONE; + io_hdr.cmdp = turCmdBlk; + io_hdr.sbp = sense_buffer; + io_hdr.timeout = 20000; + io_hdr.pack_id = 0; + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + close(fd); + return 0; + } + if (io_hdr.info & SG_INFO_OK_MASK) { + return 0; + } + return 1; +} + +static int +del_map(char * str) { + struct dm_task *dmt; + + if (!(dmt = dm_task_create(DM_DEVICE_REMOVE))) + return 0; + if (!dm_task_set_name(dmt, str)) + goto delout; + if (!dm_task_run(dmt)) + goto delout; + + printf("Deleted device map : %s\n", str); + + delout: + dm_task_destroy(dmt); + return 1; +} + +get_table(const char * str) +{ + int r = 0; + struct dm_task *dmt; + void *next = NULL; + uint64_t start, length; + char *target_type = NULL; + char *params; + + if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) + return 0; + + if (!dm_task_set_name(dmt, str)) + goto out; + + if (!dm_task_run(dmt)) + goto out; + + do { + next = dm_get_next_target(dmt, next, &start, &length, + &target_type, ¶ms); + if (target_type) { + printf("%" PRIu64 " %" PRIu64 " %s %s\n", + start, length, target_type, params); + } + } while (next); + + r = 1; + + out: + dm_task_destroy(dmt); + return r; + +} diff --git a/extras/multipath-tools/multipathd/Makefile b/extras/multipath-tools/multipathd/Makefile new file mode 100644 index 0000000000..5bfd58a837 --- /dev/null +++ b/extras/multipath-tools/multipathd/Makefile @@ -0,0 +1,31 @@ +EXEC = multipathd + +CC = gcc +GZIP = /bin/gzip -9 -c + +bindir = /usr/bin +mandir = /usr/share/man/man8 +rcdir = /etc/init.d + +CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -DDEBUG=1 +LDFLAGS = -lpthread -ldevmapper -lsysfs + +OBJS = main.o devinfo.o checkers.o + +$(EXEC): $(OBJS) + $(CC) $(LDFLAGS) $(OBJS) -o $(EXEC) + strip $(EXEC) + +install: + install -d $(bindir) + install -m 755 $(EXEC) $(bindir) + install -d $(rcdir) + install -m 755 multipathd.init $(rcdir)/$(EXEC) + +uninstall: + rm -f $(bindir)/$(EXEC) + rm -f $(rcdir)/$(EXEC) + +clean: + rm -f core *.o $(EXEC) *.gz + diff --git a/extras/multipath-tools/multipathd/checkers.c b/extras/multipath-tools/multipathd/checkers.c new file mode 100644 index 0000000000..7ad32b04e9 --- /dev/null +++ b/extras/multipath-tools/multipathd/checkers.c @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include +#include +#include + +#include "sg_include.h" + +#define TUR_CMD_LEN 6 + +/* + * test IO functions : add yours here + * + * returns 0 : path gone valid + * returns 1 : path still failed + */ + +int readsector0 (char *devnode) +{ + int fd, r; + char buf; + + fd = open (devnode, O_RDONLY); + if (read (fd, &buf, 1) != 1) + r = 0; + else + r = 1; + + close (fd); + + return r; +} + +int tur(char *devnode) +{ + unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; + struct sg_io_hdr io_hdr; + unsigned char sense_buffer[32]; + int fd; + + fd = open (devnode, O_RDONLY); + + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (turCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_buffer); + io_hdr.dxfer_direction = SG_DXFER_NONE; + io_hdr.cmdp = turCmdBlk; + io_hdr.sbp = sense_buffer; + io_hdr.timeout = 20000; + io_hdr.pack_id = 0; + if (ioctl(fd, SG_IO, &io_hdr) < 0) { + close(fd); + return 0; + } + if (io_hdr.info & SG_INFO_OK_MASK) { + return 0; + } + return 1; +} diff --git a/extras/multipath-tools/multipathd/checkers.h b/extras/multipath-tools/multipathd/checkers.h new file mode 100644 index 0000000000..057c319d1b --- /dev/null +++ b/extras/multipath-tools/multipathd/checkers.h @@ -0,0 +1,2 @@ +int readsector0 (char *); +int tur (char *); diff --git a/extras/multipath-tools/multipathd/devinfo.c b/extras/multipath-tools/multipathd/devinfo.c new file mode 100644 index 0000000000..46505470f4 --- /dev/null +++ b/extras/multipath-tools/multipathd/devinfo.c @@ -0,0 +1,82 @@ +#include +#include +#include +#include +#include +#include +#include "devinfo.h" +#include "sg_include.h" + +#define FILE_NAME_SIZE 255 + +static int +do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, + void *resp, int mx_resp_len, int noisy) +{ + unsigned char inqCmdBlk[INQUIRY_CMDLEN] = + { INQUIRY_CMD, 0, 0, 0, 0, 0 }; + unsigned char sense_b[SENSE_BUFF_LEN]; + struct sg_io_hdr io_hdr; + + if (cmddt) + inqCmdBlk[1] |= 2; + if (evpd) + inqCmdBlk[1] |= 1; + inqCmdBlk[2] = (unsigned char) pg_op; + inqCmdBlk[4] = (unsigned char) mx_resp_len; + memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof (inqCmdBlk); + io_hdr.mx_sb_len = sizeof (sense_b); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = mx_resp_len; + io_hdr.dxferp = resp; + io_hdr.cmdp = inqCmdBlk; + io_hdr.sbp = sense_b; + io_hdr.timeout = DEF_TIMEOUT; + + if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) { + perror("SG_IO (inquiry) error"); + return -1; + } + + /* treat SG_ERR here to get rid of sg_err.[ch] */ + io_hdr.status &= 0x7e; + if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && + (0 == io_hdr.driver_status)) + return 0; + if ((SCSI_CHECK_CONDITION == io_hdr.status) || + (SCSI_COMMAND_TERMINATED == io_hdr.status) || + (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) { + if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) { + int sense_key; + unsigned char * sense_buffer = io_hdr.sbp; + if (sense_buffer[0] & 0x2) + sense_key = sense_buffer[1] & 0xf; + else + sense_key = sense_buffer[2] & 0xf; + if(RECOVERED_ERROR == sense_key) + return 0; + } + } + return -1; +} + +int +get_lun_strings(char * vendor_id, char * product_id, char * rev, char * devname) +{ + int fd; + char buff[36]; + + /* ioctl style */ + if ((fd = open(devname, O_RDONLY)) < 0) + return 1; + if (0 != do_inq(fd, 0, 0, 0, buff, 36, 1)) + return 1; + memcpy(vendor_id, &buff[8], 8); + memcpy(product_id, &buff[16], 16); + memcpy(rev, &buff[32], 4); + close(fd); + + return 0; +} diff --git a/extras/multipath-tools/multipathd/devinfo.h b/extras/multipath-tools/multipathd/devinfo.h new file mode 100644 index 0000000000..46b2894051 --- /dev/null +++ b/extras/multipath-tools/multipathd/devinfo.h @@ -0,0 +1,15 @@ +#define INQUIRY_CMDLEN 6 +#define INQUIRY_CMD 0x12 +#define SENSE_BUFF_LEN 32 +#define DEF_TIMEOUT 60000 +#define RECOVERED_ERROR 0x01 +#define MX_ALLOC_LEN 255 +#define WWID_SIZE 33 +#define BLKGETSIZE _IO(0x12,96) + +/* exerpt from "sg_err.h" */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SG_ERR_DRIVER_SENSE 0x08 + +int get_lun_strings (char *, char *, char *, char *); diff --git a/extras/multipath-tools/multipathd/main.c b/extras/multipath-tools/multipathd/main.c new file mode 100644 index 0000000000..7b5ccfca23 --- /dev/null +++ b/extras/multipath-tools/multipathd/main.c @@ -0,0 +1,674 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "devinfo.h" +#include "checkers.h" + +#define CHECKINT 5 +#define MAXPATHS 2048 +#define FILENAMESIZE 256 +#define MAPNAMESIZE 64 +#define TARGETTYPESIZE 16 +#define PARAMSSIZE 2048 +#define MAXMAPS 512 + +#define MULTIPATH "/sbin/multipath" +#define PIDFILE "/var/run/multipathd.pid" + +#ifndef DEBUG +#define DEBUG 1 +#endif +#define LOG(x, y, z...) if (DEBUG >= x) syslog(x, y, ##z) + +struct path +{ + int major; + int minor; + char mapname[MAPNAMESIZE]; + int (*checkfn) (char *); +}; + +struct paths +{ + pthread_mutex_t *lock; + struct path *paths_h; +}; + +struct event_thread +{ + pthread_t *thread; + pthread_mutex_t *waiter_lock; + char mapname[MAPNAMESIZE]; +}; + +struct devmap +{ + char mapname[MAPNAMESIZE]; +}; + +/* global var */ +pthread_mutex_t *event_lock; +pthread_cond_t *event; + +int makenode (char *devnode, int major, int minor) +{ + dev_t dev; + + dev = makedev (major, minor); + unlink (devnode); + + return mknod(devnode, S_IFBLK | S_IRUSR | S_IWUSR, dev); +} + +int select_checkfn(struct path *path_p) +{ + char devnode[FILENAMESIZE]; + char vendor[8]; + char product[16]; + char rev[4]; + int i, r; + + /* default checkfn */ + path_p->checkfn = &readsector0; + + sprintf (devnode, "/tmp/.select.%i.%i", path_p->major, path_p->minor); + + r = makenode (devnode, path_p->major, path_p->minor); + + if (r < 0) { + LOG(2, "[select_checkfn] can not make node %s", devnode); + return r; + } + + r = get_lun_strings(vendor, product, rev, devnode); + + if (r) { + LOG(2, "[select_checkfn] can not get strings"); + return r; + } + + r = unlink (devnode); + + if (r < 0) { + LOG(2, "[select_checkfn] can not unlink %s", devnode); + return r; + } + + static struct { + char * vendor; + char * product; + int (*checkfn) (char *); + } wlist[] = { + {"COMPAQ ", "HSV110 (C)COMPAQ", &tur}, + {"COMPAQ ", "MSA1000 ", &tur}, + {"COMPAQ ", "MSA1000 VOLUME ", &tur}, + {"DEC ", "HSG80 ", &tur}, + {"HP ", "HSV100 ", &readsector0}, + {NULL, NULL, NULL}, + }; + + for (i = 0; wlist[i].vendor; i++) { + if (strncmp(vendor, wlist[i].vendor, 8) == 0 && + strncmp(product, wlist[i].product, 16) == 0) { + path_p->checkfn = wlist[i].checkfn; + } + } + + return 0; +} + +int get_devmaps (struct devmap *devmaps) +{ + struct devmap *devmaps_p; + struct dm_task *dmt, *dmt1; + struct dm_names *names = NULL; + unsigned next = 0; + void *nexttgt; + int r = 0; + long long start, length; + char *target_type = NULL; + char *params; + + memset (devmaps, 0, MAXMAPS * sizeof (struct devmap)); + + if (!(dmt = dm_task_create(DM_DEVICE_LIST))) { + r = 1; + goto out; + } + + if (!dm_task_run(dmt)) { + r = 1; + goto out; + } + + if (!(names = dm_task_get_names(dmt))) { + r = 1; + goto out; + } + + if (!names->dev) { + LOG (1, "[get_devmaps] no devmap found"); + goto out; + } + + devmaps_p = devmaps; + + do { + /* keep only multipath maps */ + + names = (void *) names + next; + nexttgt = NULL; + LOG (3, "[get_devmaps] iterate on devmap names : %s", names->name); + + LOG (3, "[get_devmaps] dm_task_create(DM_DEVICE_STATUS)"); + if (!(dmt1 = dm_task_create(DM_DEVICE_STATUS))) + goto out1; + + LOG (3, "[get_devmaps] dm_task_set_name(dmt1, names->name)"); + if (!dm_task_set_name(dmt1, names->name)) + goto out1; + + LOG (3, "[get_devmaps] dm_task_run(dmt1)"); + if (!dm_task_run(dmt1)) + goto out1; + LOG (3, "[get_devmaps] DM_DEVICE_STATUS ioctl done"); + do { + LOG (3, "[get_devmaps] iterate on devmap's targets"); + nexttgt = dm_get_next_target(dmt1, nexttgt, + &start, + &length, + &target_type, + ¶ms); + + + LOG (3, "[get_devmaps] test target_type existence"); + if (!target_type) + goto out1; + + LOG (3, "[get_devmaps] test target_type is multipath"); + if (!strncmp (target_type, "multipath", 9)) { + strcpy (devmaps_p->mapname, names->name); + devmaps_p++; + + /* test vector overflow */ + if (devmaps_p - devmaps >= MAXMAPS * sizeof (struct devmap)) { + LOG (1, "[get_devmaps] devmaps overflow"); + dm_task_destroy(dmt1); + r = 1; + goto out; + } + } + + } while (nexttgt); + +out1: + dm_task_destroy(dmt1); + next = names->next; + + } while (next); + +out: + dm_task_destroy(dmt); + + LOG (3, "[get_devmaps] done"); + return r; +} + +int checkpath (struct path *path_p) +{ + char devnode[FILENAMESIZE]; + int r; + + LOG (2, "[checkpath] checking path %i:%i", path_p->major, path_p->minor); + sprintf (devnode, "/tmp/.checker.%i.%i", path_p->major, path_p->minor); + + if (path_p->checkfn == NULL) { + LOG (1, "[checkpath] test function not set for path %i:%i", + path_p->major, path_p->minor); + return 1; + } + + r = makenode (devnode, path_p->major, path_p->minor); + + if (r < 0) { + LOG (2, "[checkpath] can not make node for %s", devnode); + return r; + } + + r = path_p->checkfn(devnode); + unlink (devnode); + + return r; +} + +int updatepaths (struct devmap *devmaps, struct paths *failedpaths) +{ + struct path *path_p; + struct devmap *devmaps_p; + void *next; + struct dm_task *dmt; + long long start, length; + char *target_type = NULL; + char *params, *p1, *p2; + char word[6]; + int i; + + path_p = failedpaths->paths_h; + + pthread_mutex_lock (failedpaths->lock); + memset (failedpaths->paths_h, 0, MAXPATHS * sizeof (struct path)); + + /* first pass */ + /* ask DM the failed path list */ + + devmaps_p = devmaps; + + while (*devmaps_p->mapname != 0x0) { + next = NULL; + + if (!(dmt = dm_task_create(DM_DEVICE_STATUS))) + break; + + if (!dm_task_set_name(dmt, devmaps_p->mapname)) + goto out; + + if (!dm_task_run(dmt)) + goto out; + + do { + next = dm_get_next_target(dmt, next, &start, &length, + &target_type, ¶ms); + + /* begin ugly parser */ + p1 = params; + p2 = params; + while (*p1) { + /* p2 lags at the begining of the word p1 parses */ + while (*p1 != ' ') { + /* if the current word is a path */ + if (*p1 == ':') { + /* p1 jumps to path state */ + while (*p1 != 'A' && *p1 != 'F') + p1++; + + /* store path info */ + + path_p->checkfn = NULL; + + i = 0; + memset (&word, 'O', 6 * sizeof (char)); + while (*p2 != ':') { + word[i++] = *p2; + p2++; + } + path_p->major = atoi (word); + + p2++; + i = 0; + memset (&word, 'O', 6 * sizeof (char)); + while (*p2 != ' ') { + word[i++] = *p2; + p2++; + } + path_p->minor = atoi (word); + + strcpy (path_p->mapname, devmaps_p->mapname); + + /* + * discard active paths + * don't trust the A status flag : double check + */ + if (*p1 == 'A' && + !select_checkfn (path_p) && + checkpath (path_p)) { + LOG(2, "[updatepaths] discard %i:%i as valid path", + path_p->major, path_p->minor); + p1++; + memset (path_p, 0, sizeof(struct path)); + continue; + } + + path_p++; + + /* test vector overflow */ + if (path_p - failedpaths->paths_h >= MAXPATHS * sizeof (struct path)) { + LOG (1, "[updatepaths] path_h overflow"); + pthread_mutex_unlock (failedpaths->lock); + return 1; + } + } + p1++; + } + p2 = p1; + p1++; + } + } while (next); + +out: + dm_task_destroy(dmt); + devmaps_p++; + + } + + pthread_mutex_unlock (failedpaths->lock); + return 0; +} + +int geteventnr (char *name) +{ + struct dm_task *dmt; + struct dm_info info; + + if (!(dmt = dm_task_create(DM_DEVICE_INFO))) + return 0; + + if (!dm_task_set_name(dmt, name)) + goto out; + + if (!dm_task_run(dmt)) + goto out; + + if (!dm_task_get_info(dmt, &info)) + return 0; + + if (!info.exists) { + LOG(1, "Device %s does not exist", name); + return 0; + } + +out: + dm_task_destroy(dmt); + + return info.event_nr; +} + +void *waitevent (void * et) +{ + int event_nr; + struct event_thread *waiter; + + waiter = (struct event_thread *)et; + pthread_mutex_lock (waiter->waiter_lock); + + event_nr = geteventnr (waiter->mapname); + + struct dm_task *dmt; + + if (!(dmt = dm_task_create(DM_DEVICE_WAITEVENT))) + return 0; + + if (!dm_task_set_name(dmt, waiter->mapname)) + goto out; + + if (event_nr && !dm_task_set_event_nr(dmt, event_nr)) + goto out; + + dm_task_run(dmt); + +out: + dm_task_destroy(dmt); + + /* tell waiterloop we have an event */ + pthread_mutex_lock (event_lock); + pthread_cond_signal(event); + pthread_mutex_unlock (event_lock); + + /* release waiter_lock so that waiterloop knows we are gone */ + pthread_mutex_unlock (waiter->waiter_lock); + pthread_exit(waiter->thread); + + return (NULL); +} + +void *waiterloop (void *ap) +{ + struct paths *failedpaths; + struct devmap *devmaps, *devmaps_p; + struct event_thread *waiters, *waiters_p; + int r; + + /* inits */ + failedpaths = (struct paths *)ap; + devmaps = malloc (MAXMAPS * sizeof (struct devmap)); + waiters = malloc (MAXMAPS * sizeof (struct event_thread)); + memset (waiters, 0, MAXMAPS * sizeof (struct event_thread)); + + while (1) { + + /* update devmap list */ + LOG (1, "[event thread] refresh devmaps list"); + get_devmaps (devmaps); + + /* update failed paths list */ + LOG (1, "[event thread] refresh failpaths list"); + updatepaths (devmaps, failedpaths); + + /* start waiters on all devmaps */ + LOG (1, "[event thread] start up event loops"); + waiters_p = waiters; + devmaps_p = devmaps; + + while (*devmaps_p->mapname != 0x0) { + + /* find out if devmap already has a running waiter thread */ + while (*waiters_p->mapname != 0x0) { + if (!strcmp (waiters_p->mapname, devmaps_p->mapname)) + break; + waiters_p++; + } + + /* no event_thread struct : init it */ + if (*waiters_p->mapname == 0x0) { + strcpy (waiters_p->mapname, devmaps_p->mapname); + waiters_p->thread = malloc (sizeof (pthread_t)); + waiters_p->waiter_lock = (pthread_mutex_t *) malloc (sizeof (pthread_mutex_t)); + pthread_mutex_init (waiters_p->waiter_lock, NULL); + } + + /* event_thread struct found */ + if (*waiters_p->mapname != 0x0) { + r = pthread_mutex_trylock (waiters_p->waiter_lock); + /* thread already running : out */ + + if (r) + goto out; + + pthread_mutex_unlock (waiters_p->waiter_lock); + } + + LOG (1, "[event thread] create event thread for %s", waiters_p->mapname); + pthread_create (waiters_p->thread, NULL, waitevent, waiters_p); +out: + waiters_p = waiters; + devmaps_p++; + } + + /* wait event condition */ + pthread_mutex_lock (event_lock); + pthread_cond_wait(event, event_lock); + pthread_mutex_unlock (event_lock); + + LOG (1, "[event thread] event caught"); + } + + return (NULL); +} + +void *checkerloop (void *ap) +{ + struct paths *failedpaths; + struct path *path_p; + char *cmdargs[4] = {MULTIPATH, "-D", NULL, NULL}; + char major[5]; + char minor[5]; + int status; + + failedpaths = (struct paths *)ap; + + LOG (1, "[checker thread] path checkers start up"); + + while (1) { + path_p = failedpaths->paths_h; + pthread_mutex_lock (failedpaths->lock); + LOG (2, "[checker thread] checking paths"); + while (path_p->major != 0) { + + if (checkpath (path_p)) { + LOG (1, "[checker thread] reconfigure %s\n", path_p->mapname); + snprintf (major, 5, "%i", path_p->major); + snprintf (minor, 5, "%i", path_p->minor); + cmdargs[2] = major; + cmdargs[3] = minor; + if (fork () == 0) + execve (cmdargs[0], cmdargs, NULL); + + wait (&status); + /* MULTIPATH will ask for failedpaths refresh (SIGHUP) */ + } + + path_p++; + + /* test vector overflow */ + if (path_p - failedpaths->paths_h >= MAXPATHS * sizeof (struct path)) { + LOG (1, "[checker thread] path_h overflow"); + pthread_mutex_unlock (failedpaths->lock); + return (NULL); + } + } + pthread_mutex_unlock (failedpaths->lock); + sleep(CHECKINT); + } + + return (NULL); +} + +struct paths *initpaths (void) +{ + struct paths *failedpaths; + + failedpaths = malloc (sizeof (struct paths)); + failedpaths->paths_h = malloc (MAXPATHS * sizeof (struct path)); + failedpaths->lock = (pthread_mutex_t *) malloc (sizeof (pthread_mutex_t)); + pthread_mutex_init (failedpaths->lock, NULL); + event = (pthread_cond_t *) malloc (sizeof (pthread_cond_t)); + pthread_cond_init (event, NULL); + event_lock = (pthread_mutex_t *) malloc (sizeof (pthread_mutex_t)); + pthread_mutex_init (event_lock, NULL); + + return (failedpaths); +} + +void pidfile (pid_t pid) +{ + FILE *file; + struct stat *buf; + + buf = malloc (sizeof (struct stat)); + + if (!stat (PIDFILE, buf)) { + LOG(1, "[master thread] already running : out"); + free (buf); + exit (1); + } + + umask (022); + pid = setsid (); + + if (pid < -1) { + LOG(1, "[master thread] setsid() error"); + exit (1); + } + + file = fopen (PIDFILE, "w"); + fprintf (file, "%d\n", pid); + fclose (file); + free (buf); +} + +void * +signal_set(int signo, void (*func) (int)) +{ + int r; + struct sigaction sig; + struct sigaction osig; + + sig.sa_handler = func; + sigemptyset(&sig.sa_mask); + sig.sa_flags = 0; + + r = sigaction(signo, &sig, &osig); + + if (r < 0) + return (SIG_ERR); + else + return (osig.sa_handler); +} + +void sighup (int sig) +{ + LOG (1, "[master thread] SIGHUP caught : refresh devmap list"); + + /* ask for failedpaths refresh */ + pthread_mutex_lock (event_lock); + pthread_cond_signal(event); + pthread_mutex_unlock (event_lock); +} + +void sigend (int sig) +{ + LOG (1, "[master thread] unlink pidfile"); + unlink (PIDFILE); + LOG (1, "[master thread] --------shut down-------"); + exit (0); +} + +void signal_init(void) +{ + signal_set(SIGHUP, sighup); + signal_set(SIGINT, sigend); + signal_set(SIGTERM, sigend); + signal_set(SIGKILL, sigend); +} + +int main (int argc, char *argv[]) +{ + pthread_t wait, check; + struct paths *failedpaths; + pid_t pid; + + pid = fork (); + + /* can't fork */ + if (pid < 0) + exit (1); + + /* let the parent die happy */ + if (pid > 0) + exit (0); + + /* child's play */ + openlog (argv[0], 0, LOG_DAEMON); + LOG (1, "[master thread] --------start up--------"); + + pidfile (pid); + signal_init (); + + failedpaths = initpaths (); + + pthread_create (&wait, NULL, waiterloop, failedpaths); + pthread_create (&check, NULL, checkerloop, failedpaths); + pthread_join (wait, NULL); + pthread_join (check, NULL); + + return 0; +} diff --git a/extras/multipath-tools/multipathd/multipathd.init b/extras/multipath-tools/multipathd/multipathd.init new file mode 100644 index 0000000000..860b2b11db --- /dev/null +++ b/extras/multipath-tools/multipathd/multipathd.init @@ -0,0 +1,42 @@ +#!/bin/sh + +PATH=/bin:/usr/bin:/sbin:/usr/sbin +DAEMON=/usr/bin/multipathd +PIDFILE=/var/run/multipathd.pid + +test -x $DAEMON || exit 0 + +case "$1" in + start) + echo -n "Starting multipath daemon: multipathd" + if start-stop-daemon --quiet --stop --signal 0 --pidfile $PIDFILE --name multipathd + then + echo " already running." + exit + fi + /sbin/start-stop-daemon --start --quiet --exec $DAEMON + echo "." + ;; + stop) + echo -n "Stopping multipath daemon: multipathd" + if start-stop-daemon --quiet --stop --signal 0 --pidfile $PIDFILE --name multipathd + then + PID=`cat $PIDFILE` + start-stop-daemon --quiet --stop --exec $DAEMON --pidfile $PIDFILE --name multipathd + # Now we wait for it to die + while kill -0 $PID 2>/dev/null; do sleep 1; done + echo "." + else + echo " not running."; + fi + ;; + force-reload|restart) + $0 stop + $0 start + ;; + *) + echo "Usage: /etc/init.d/multipathd {start|stop|restart|force-reload}" + exit 1 +esac + +exit 0 diff --git a/extras/multipath-tools/multipathd/sg_include.h b/extras/multipath-tools/multipathd/sg_include.h new file mode 100644 index 0000000000..460506826e --- /dev/null +++ b/extras/multipath-tools/multipathd/sg_include.h @@ -0,0 +1,43 @@ +#ifdef SG_KERNEL_INCLUDES + #define __user + typedef unsigned char u8; + #include "/usr/src/linux/include/scsi/sg.h" + #include "/usr/src/linux/include/scsi/scsi.h" +#else + #ifdef SG_TRICK_GNU_INCLUDES + #include + #include + #else + #include + #endif +#endif + +/* + Getting the correct include files for the sg interface can be an ordeal. + In a perfect world, one would just write: + #include + #include + This would include the files found in the /usr/include/scsi directory. + Those files are maintained with the GNU library which may or may not + agree with the kernel and version of sg driver that is running. Any + many cases this will not matter. However in some it might, for example + glibc 2.1's include files match the sg driver found in the lk 2.2 + series. Hence if glibc 2.1 is used with lk 2.4 then the additional + sg v3 interface will not be visible. + If this is a problem then defining SG_KERNEL_INCLUDES will access the + kernel supplied header files (assuming they are in the normal place). + The GNU library maintainers and various kernel people don't like + this approach (but it does work). + The technique selected by defining SG_TRICK_GNU_INCLUDES worked (and + was used) prior to glibc 2.2 . Prior to that version /usr/include/linux + was a symbolic link to /usr/src/linux/include/linux . + + There are other approaches if this include "mixup" causes pain. These + would involve include files being copied or symbolic links being + introduced. + + Sorry about the inconvenience. Typically neither SG_KERNEL_INCLUDES + nor SG_TRICK_GNU_INCLUDES is defined. + + dpg 20010415, 20030522 +*/ -- cgit v1.2.3-54-g00ecf From 35b38379bac87ebf4d0cc6884feff588ee859d5f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 11 Mar 2004 01:36:12 -0800 Subject: [PATCH] cleanup callout fork Here I change the callout fork logic. The current cersion is unable to read a pipe which is not flushed at once, Now we read until it's closed. The maximum argument count is calculated by the strlen now. We have 100 chars for our result buffer so we can't have more than 50 parameters. So it's much more clear what will happen now and not some magic boundary where we use shell behind it. Parameter can be combined to one by using apostrophes. this on works now: BUS="scsi", PROGRAM="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'", KERNEL="sda3", NAME="%c{7}" Two new test are also added. --- namedev.c | 92 +++++++++++++++++++++++++++++-------------------------- namedev.h | 1 - test/udev-test.pl | 18 +++++++++++ 3 files changed, 66 insertions(+), 45 deletions(-) diff --git a/namedev.c b/namedev.c index 1e424998f6..a9142374f4 100644 --- a/namedev.c +++ b/namedev.c @@ -370,22 +370,41 @@ static void fix_kernel_name(struct udevice *udev) static int execute_program(char *path, char *value, int len) { int retval; - int res; + int count; int status; int fds[2]; pid_t pid; - int value_set = 0; - char buffer[255]; char *pos; - char *args[PROGRAM_MAXARG]; + char arg[PROGRAM_SIZE]; + char *argv[sizeof(arg) / 2]; int i; - dbg("executing '%s'", path); + i = 0; + if (strchr(path, ' ')) { + strfieldcpy(arg, path); + pos = arg; + while (pos != NULL) { + if (pos[0] == '\'') { + /* don't separate if in apostrophes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg("arg[%i] '%s'", i, argv[i]); + i++; + } + } + argv[i] = NULL; + retval = pipe(fds); if (retval != 0) { dbg("pipe failed"); return -1; } + pid = fork(); switch(pid) { case 0: @@ -394,28 +413,14 @@ static int execute_program(char *path, char *value, int len) /* dup write side of pipe to STDOUT */ dup(fds[1]); - - /* copy off our path to use incase we have too many args */ - strfieldcpymax(buffer, path, sizeof(buffer)); - - if (strchr(path, ' ')) { - /* exec with arguments */ - pos = path; - for (i=0; i < PROGRAM_MAXARG-1; i++) { - args[i] = strsep(&pos, " "); - if (args[i] == NULL) - break; - } - if (args[i]) { - dbg("too many args - %d, using subshell instead '%s'", i, buffer); - retval = execl("/bin/sh", "sh", "-c", buffer, NULL); - } else { - dbg("execute program '%s'", path); - retval = execv(args[0], args); - } + if (argv[0] != NULL) { + dbg("execute '%s' with given arguments", argv[0]); + retval = execv(argv[0], argv); } else { + dbg("execute '%s' with main argument", path); retval = execv(path, main_argv); } + info(FIELD_PROGRAM " execution of '%s' failed", path); exit(1); case -1: @@ -425,34 +430,33 @@ static int execute_program(char *path, char *value, int len) /* parent reads from fds[0] */ close(fds[1]); retval = 0; + i = 0; while (1) { - res = read(fds[0], buffer, sizeof(buffer) - 1); - if (res <= 0) + count = read(fds[0], value + i, len - i-1); + if (count <= 0) break; - buffer[res] = '\0'; - if (res > len) { + + i += count; + if (i >= len-1) { dbg("result len %d too short", len); retval = -1; - } - if (value_set) { - dbg("result value already set"); - retval = -1; - } else { - value_set = 1; - strncpy(value, buffer, len); - pos = value + strlen(value)-1; - if (pos[0] == '\n') - pos[0] = '\0'; - dbg("result is '%s'", value); + break; } } - close(fds[0]); - res = wait(&status); - if (res < 0) { - dbg("wait failed result %d", res); + + if (count < 0) { + dbg("read failed with '%s'", strerror(errno)); retval = -1; } + if (i > 0 && value[i] == '\n') + i--; + value[i] = '\0'; + dbg("result is '%s'", value); + + close(fds[0]); + wait(&status); + if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { dbg("exec program status 0x%x", status); retval = -1; @@ -730,7 +734,7 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas apply_format(udev, dev->program, sizeof(dev->program), class_dev, sysfs_device); if (execute_program(dev->program, udev->program_result, NAME_SIZE) != 0) { - dbg(FIELD_PROGRAM " returned nozero"); + dbg(FIELD_PROGRAM " returned nonzero"); goto try_parent; } else { dbg(FIELD_PROGRAM " returned successful"); diff --git a/namedev.h b/namedev.h index 16a8bffe97..68100d4f62 100644 --- a/namedev.h +++ b/namedev.h @@ -51,7 +51,6 @@ struct sysfs_class_device; #define ATTR_PARTITIONS "all_partitions" #define PARTITIONS_COUNT 15 -#define PROGRAM_MAXARG 10 #define MAX_SYSFS_PAIRS 5 #define RULEFILE_EXT ".rules" diff --git a/test/udev-test.pl b/test/udev-test.pl index 38ea0181f6..dadec568ba 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -259,6 +259,24 @@ EOF expected => "foo9" , conf => < "program with subshell", + subsys => "block", + devpath => "block/sda/sda3", + expected => "bar9" , + conf => < "program arguments combined with apostrophes", + subsys => "block", + devpath => "block/sda/sda3", + expected => "foo7" , + conf => < Date: Thu, 11 Mar 2004 01:37:18 -0800 Subject: [PATCH] callout part selector tweak Martin Schwenke asked for this feature and posted a patch: The following patch almost let's me have the following configuration: PROGRAM="/sbin/aliaser %b %k %n %M %m", RESULT="?*", NAME="%c{1}", SYMLINK="%c{2+}" allowing me to specify an arbitrary number of symlinks by saying "giveme the second and later words"." Here is the actual version with tests and a few words in the man page. --- namedev.c | 8 ++++++-- test/udev-test.pl | 9 +++++++++ udev.8 | 5 ++++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/namedev.c b/namedev.c index a9142374f4..7305676d42 100644 --- a/namedev.c +++ b/namedev.c @@ -190,6 +190,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, int i; char c; char *spos; + char *rest; int slen; struct sysfs_attribute *tmpattr; @@ -244,7 +245,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, /* get part part of the result string */ i = 0; if (attr != NULL) - i = atoi(attr); + i = strtoul(attr, &rest, 10); if (i > 0) { foreach_strpart(udev->program_result, " \n\r", spos, slen) { i--; @@ -255,7 +256,10 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("requested part of result string not found"); break; } - strfieldcpymax(temp2, spos, slen+1); + if (rest[0] == '+') + strfieldcpy(temp2, spos); + else + strfieldcpymax(temp2, spos, slen+1); strfieldcatmax(string, temp2, maxsize); dbg("substitute part of result string '%s'", temp2); } else { diff --git a/test/udev-test.pl b/test/udev-test.pl index dadec568ba..7db92691d3 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -304,6 +304,15 @@ EOF expected => "link1" , conf => < "program result substitution (numbered part of+)", + subsys => "block", + devpath => "block/sda/sda3", + expected => "link3" , + conf => < Date: Thu, 11 Mar 2004 01:39:53 -0800 Subject: [PATCH] "symlink only" test Here is a test for the "symlink only" rule. Any reason to do the apply_format() inside the loop? I've changed it. --- namedev.c | 15 +++++---------- test/udev-test.pl | 11 +++++++++++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/namedev.c b/namedev.c index 7305676d42..025a14aea4 100644 --- a/namedev.c +++ b/namedev.c @@ -815,16 +815,11 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } if (dev->symlink[0] != '\0') { - char temp[NAME_MAX]; - info("configured rule in '%s' at line %i applied, added symlink '%s'", dev->config_file, dev->config_line, dev->symlink); - /* do not clobber dev */ - strfieldcpy(temp, dev->symlink); - apply_format(udev, temp, sizeof(temp), - class_dev, sysfs_device); - strfieldcat(udev->symlink, temp); - strfieldcat(udev->symlink, " "); + if (udev->symlink[0] != '\0') + strfieldcat(udev->symlink, " "); + strfieldcat(udev->symlink, dev->symlink); } if (dev->name[0] != '\0') { @@ -841,8 +836,8 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud goto done; found: - apply_format(udev, udev->name, sizeof(udev->name), - class_dev, sysfs_device); + apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); + apply_format(udev, udev->symlink, sizeof(udev->symlink), class_dev, sysfs_device); udev->partitions = dev->partitions; done: diff --git a/test/udev-test.pl b/test/udev-test.pl index 7db92691d3..c12a21ee3d 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -511,6 +511,17 @@ EOF conf => < "SYMLINK only rule", + subsys => "block", + devpath => "block/sda", + expected => "symlink-only2", + conf => < Date: Fri, 12 Mar 2004 00:57:30 -0800 Subject: [PATCH] Libsysfs updates Please find attached a _BIG_ patch to update udev's libsysfs. Patch applies on udev-021 and contains: 1. Updates to get udev's libsysfs to the latest (to be released) level. 2. Changes for C++ compatibility (use "char" and not "unsigned char" unless absolutely necessary). 3. More importantly, take care of buffer overflows. Libsysfs now uses a scaled down version of Kay's "safe" macros. Tested using a usb-storage device. I will send you a doc update shortly. --- libsysfs/dlist.c | 10 +++ libsysfs/dlist.h | 3 +- libsysfs/sysfs/libsysfs.h | 205 +++++++++++++++++++++++++++------------------- libsysfs/sysfs_bus.c | 114 ++++++++------------------ libsysfs/sysfs_class.c | 119 +++++++++++++-------------- libsysfs/sysfs_device.c | 174 ++++++++++++++++++++++++++------------- libsysfs/sysfs_dir.c | 157 +++++++++++++++++++---------------- libsysfs/sysfs_driver.c | 73 +++++++++-------- libsysfs/sysfs_utils.c | 130 ++++++++++++++++------------- 9 files changed, 534 insertions(+), 451 deletions(-) diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c index a94ab1f854..942eccb48c 100644 --- a/libsysfs/dlist.c +++ b/libsysfs/dlist.c @@ -260,6 +260,16 @@ void dlist_unshift(Dlist *list,void *data) dlist_insert(list,data,0); } +void dlist_unshift_sorted(Dlist *list, void *data, + int (*sorter)(void *new, void *old)) +{ + if (list->count == 0) + dlist_unshift(list, data); + else { + list->marker=list->head->next; + dlist_insert_sorted(list, data, sorter); + } +} /* * Remove end node from list. diff --git a/libsysfs/dlist.h b/libsysfs/dlist.h index 83f67e8d44..7fc90e5bf5 100644 --- a/libsysfs/dlist.h +++ b/libsysfs/dlist.h @@ -76,13 +76,14 @@ void dlist_end(Dlist *); void *dlist_insert(Dlist *,void *,int) ; -void *dlist_insert_sorted(struct dlist *list, void *new, int (*sorter)(void *, void *)); +void *dlist_insert_sorted(struct dlist *list, void *new_elem, int (*sorter)(void *, void *)); void dlist_delete(Dlist *,int); void dlist_push(Dlist *,void *); void dlist_unshift(Dlist *,void *); +void dlist_unshift_sorted(Dlist *,void *,int (*sorter)(void *, void *)); void *dlist_pop(Dlist *); diff --git a/libsysfs/sysfs/libsysfs.h b/libsysfs/sysfs/libsysfs.h index f3d2dd4d16..cbde2f5783 100644 --- a/libsysfs/sysfs/libsysfs.h +++ b/libsysfs/sysfs/libsysfs.h @@ -24,6 +24,25 @@ #define _LIBSYSFS_H_ #include +#include + +/* + * Defines to prevent buffer overruns + */ +#define safestrcpy(to, from) strncpy(to, from, sizeof(to)-1) +#define safestrcat(to, from) strncat(to, from, sizeof(to) - strlen(to)-1) + +#define safestrncpy(to, from, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + strncpy(to, from, maxsize-1); \ +} while (0) + +#define safestrncat(to, from, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + strncat(to, from, maxsize - strlen(to)-1); \ +} while (0) /* * Generic #defines go here.. @@ -46,25 +65,28 @@ #define SYSFS_METHOD_SHOW 0x01 /* attr can be read by user */ #define SYSFS_METHOD_STORE 0x02 /* attr can be changed by user */ -struct dlist; +/* + * NOTE: We have the statically allocated "name" as the first element of all + * the structures. This feature is used in the "sorter" function for dlists + */ struct sysfs_attribute { - unsigned char *value; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + char *value; unsigned short len; /* value length */ unsigned short method; /* show and store */ - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; }; struct sysfs_link { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - unsigned char target[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + char target[SYSFS_PATH_MAX]; }; struct sysfs_directory { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *subdirs; @@ -73,8 +95,8 @@ struct sysfs_directory { }; struct sysfs_driver { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *devices; @@ -82,11 +104,11 @@ struct sysfs_driver { }; struct sysfs_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char bus_id[SYSFS_NAME_LEN]; - unsigned char bus[SYSFS_NAME_LEN]; - unsigned char driver_name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char bus_id[SYSFS_NAME_LEN]; + char bus[SYSFS_NAME_LEN]; + char driver_name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct sysfs_device *parent; @@ -95,8 +117,8 @@ struct sysfs_device { }; struct sysfs_root_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *devices; @@ -104,8 +126,8 @@ struct sysfs_root_device { }; struct sysfs_bus { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *drivers; @@ -114,9 +136,9 @@ struct sysfs_bus { }; struct sysfs_class_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char classname[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char classname[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct sysfs_class_device *parent; @@ -126,8 +148,8 @@ struct sysfs_class_device { }; struct sysfs_class { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct dlist *devices; @@ -141,49 +163,47 @@ extern "C" { /* * Function Prototypes */ -extern int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); -extern int sysfs_remove_trailing_slash(unsigned char *path); -extern int sysfs_get_name_from_path(const unsigned char *path, - unsigned char *name, size_t len); -extern int sysfs_path_is_dir(const unsigned char *path); -extern int sysfs_path_is_link(const unsigned char *path); -extern int sysfs_path_is_file(const unsigned char *path); -extern int sysfs_get_link(const unsigned char *path, unsigned char *target, - size_t len); -extern struct dlist *sysfs_open_subsystem_list(unsigned char *name); -extern struct dlist *sysfs_open_bus_devices_list(unsigned char *name); +extern int sysfs_get_mnt_path(char *mnt_path, size_t len); +extern int sysfs_remove_trailing_slash(char *path); +extern int sysfs_get_name_from_path(const char *path, char *name, size_t len); +extern int sysfs_path_is_dir(const char *path); +extern int sysfs_path_is_link(const char *path); +extern int sysfs_path_is_file(const char *path); +extern int sysfs_get_link(const char *path, char *target, size_t len); +extern struct dlist *sysfs_open_subsystem_list(char *name); +extern struct dlist *sysfs_open_bus_devices_list(char *name); extern void sysfs_close_list(struct dlist *list); /* sysfs directory and file access */ extern void sysfs_close_attribute(struct sysfs_attribute *sysattr); -extern struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path); +extern struct sysfs_attribute *sysfs_open_attribute(const char *path); extern int sysfs_read_attribute(struct sysfs_attribute *sysattr); -extern int sysfs_read_attribute_value(const unsigned char *attrpath, - unsigned char *value, size_t vsize); +extern int sysfs_read_attribute_value(const char *attrpath, + char *value, size_t vsize); extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const unsigned char *new_value, size_t len); -extern unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, - const unsigned char * name); + const char *new_value, size_t len); +extern char *sysfs_get_value_from_attributes(struct dlist *attr, + const char *name); extern int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir); extern int sysfs_refresh_dir_links(struct sysfs_directory *sysdir); extern int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir); extern void sysfs_close_directory(struct sysfs_directory *sysdir); -extern struct sysfs_directory *sysfs_open_directory(const unsigned char *path); +extern struct sysfs_directory *sysfs_open_directory(const char *path); extern int sysfs_read_dir_attributes(struct sysfs_directory *sysdir); extern int sysfs_read_dir_links(struct sysfs_directory *sysdir); extern int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir); extern int sysfs_read_directory(struct sysfs_directory *sysdir); extern int sysfs_read_all_subdirs(struct sysfs_directory *sysdir); extern struct sysfs_directory *sysfs_get_subdirectory - (struct sysfs_directory *dir, unsigned char *subname); + (struct sysfs_directory *dir, char *subname); extern void sysfs_close_link(struct sysfs_link *ln); -extern struct sysfs_link *sysfs_open_link(const unsigned char *lnpath); -extern struct sysfs_link *sysfs_get_directory_link(struct sysfs_directory *dir, - unsigned char *linkname); +extern struct sysfs_link *sysfs_open_link(const char *lnpath); +extern struct sysfs_link *sysfs_get_directory_link + (struct sysfs_directory *dir, char *linkname); extern struct sysfs_link *sysfs_get_subdirectory_link - (struct sysfs_directory *dir, unsigned char *linkname); + (struct sysfs_directory *dir, char *linkname); extern struct sysfs_attribute *sysfs_get_directory_attribute - (struct sysfs_directory *dir, unsigned char *attrname); + (struct sysfs_directory *dir, char *attrname); extern struct dlist *sysfs_get_dir_attributes(struct sysfs_directory *dir); extern struct dlist *sysfs_get_dir_links(struct sysfs_directory *dir); extern struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir); @@ -191,84 +211,101 @@ extern struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir); /* sysfs driver access */ extern void sysfs_close_driver(struct sysfs_driver *driver); extern struct sysfs_driver *sysfs_open_driver - (const unsigned char *drv_name, const unsigned char *bus_name); -extern struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path); + (const char *bus_name, const char *drv_name); +extern struct sysfs_driver *sysfs_open_driver_path(const char *path); extern struct sysfs_attribute *sysfs_get_driver_attr - (struct sysfs_driver *drv, const unsigned char *name); + (struct sysfs_driver *drv, const char *name); extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); extern struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver); extern struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver); extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); extern struct sysfs_device *sysfs_get_driver_device - (struct sysfs_driver *driver, const unsigned char *name); + (struct sysfs_driver *driver, const char *name); extern struct dlist *sysfs_refresh_driver_attributes - (struct sysfs_driver *driver); -extern struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, - const unsigned char *drv, const unsigned char *attrib); + (struct sysfs_driver *driver); +extern struct sysfs_attribute *sysfs_open_driver_attr + (const char *bus, const char *drv, const char *attrib); /* generic sysfs device access */ extern void sysfs_close_root_device(struct sysfs_root_device *root); -extern struct sysfs_root_device *sysfs_open_root_device - (const unsigned char *name); +extern struct sysfs_root_device *sysfs_open_root_device(const char *name); extern struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root); +extern void sysfs_close_device_tree(struct sysfs_device *device); +extern struct sysfs_device *sysfs_open_device_tree(const char *path); extern void sysfs_close_device(struct sysfs_device *dev); extern struct sysfs_device *sysfs_open_device - (const unsigned char *bus_id, const unsigned char *bus); + (const char *bus, const char *bus_id); extern struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev); -extern struct sysfs_device *sysfs_open_device_path(const unsigned char *path); +extern struct sysfs_device *sysfs_open_device_path(const char *path); extern int sysfs_get_device_bus(struct sysfs_device *dev); extern struct sysfs_attribute *sysfs_get_device_attr - (struct sysfs_device *dev, const unsigned char *name); + (struct sysfs_device *dev, const char *name); extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); extern struct dlist *sysfs_refresh_device_attributes - (struct sysfs_device *device); -extern struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, - const unsigned char *bus_id, const unsigned char *attrib); + (struct sysfs_device *device); +extern struct sysfs_attribute *sysfs_open_device_attr(const char *bus, + const char *bus_id, const char *attrib); /* generic sysfs bus access */ extern void sysfs_close_bus(struct sysfs_bus *bus); -extern struct sysfs_bus *sysfs_open_bus(const unsigned char *name); -extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, - unsigned char *id); +extern struct sysfs_bus *sysfs_open_bus(const char *name); +extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, + char *id); extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - unsigned char *drvname); + char *drvname); extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); extern struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus); extern struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus); -extern struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, - unsigned char *attrname); -extern struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, - unsigned char *dev_id); -extern int sysfs_find_driver_bus(const unsigned char *driver, - unsigned char *busname, size_t bsize); +extern struct sysfs_attribute *sysfs_get_bus_attribute + (struct sysfs_bus *bus, char *attrname); +extern int sysfs_find_driver_bus(const char *driver, char *busname, + size_t bsize); /* generic sysfs class access */ extern void sysfs_close_class_device(struct sysfs_class_device *dev); extern struct sysfs_class_device *sysfs_open_class_device_path - (const unsigned char *path); + (const char *path); extern struct sysfs_class_device *sysfs_open_class_device - (const unsigned char *class, const unsigned char *name); + (const char *classname, const char *name); extern struct sysfs_device *sysfs_get_classdev_device - (struct sysfs_class_device *clsdev); + (struct sysfs_class_device *clsdev); extern struct sysfs_driver *sysfs_get_classdev_driver - (struct sysfs_class_device *clsdev); + (struct sysfs_class_device *clsdev); extern struct sysfs_class_device *sysfs_get_classdev_parent - (struct sysfs_class_device *clsdev); + (struct sysfs_class_device *clsdev); extern void sysfs_close_class(struct sysfs_class *cls); -extern struct sysfs_class *sysfs_open_class(const unsigned char *name); +extern struct sysfs_class *sysfs_open_class(const char *name); extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); extern struct sysfs_class_device *sysfs_get_class_device - (struct sysfs_class *class, unsigned char *name); + (struct sysfs_class *cls, char *name); extern struct dlist *sysfs_get_classdev_attributes (struct sysfs_class_device *cdev); extern struct dlist *sysfs_refresh_classdev_attributes (struct sysfs_class_device *cdev); extern struct sysfs_attribute *sysfs_get_classdev_attr - (struct sysfs_class_device *clsdev, const unsigned char *name); + (struct sysfs_class_device *clsdev, const char *name); extern struct sysfs_attribute *sysfs_open_classdev_attr - (const unsigned char *classname, const unsigned char *dev, - const unsigned char *attrib); + (const char *classname, const char *dev, + const char *attrib); + +/** + * sort_list: sorter function to keep list elements sorted in alphabetical + * order. Just does a strncmp as you can see :) + * + * Returns 1 if less than 0 otherwise + * + * NOTE: We take care to have a statically allocated "name" as the first + * lement of all libsysfs structures. Hence, this function will work + * AS IS for _ALL_ the lists that have to be sorted. + */ +static inline int sort_list(void *new_elem, void *old_elem) +{ + return ((strncmp(((struct sysfs_attribute *)new_elem)->name, + ((struct sysfs_attribute *)old_elem)->name, + strlen(((struct sysfs_attribute *)new_elem)->name))) < 0 ? 1 : 0); +} + #ifdef __cplusplus } diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index 87318c0029..bff7f78f05 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -44,7 +44,7 @@ static int bus_device_id_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_device *)b)->bus_id) + if (strcmp(((char *)a), ((struct sysfs_device *)b)->bus_id) == 0) return 1; return 0; @@ -61,7 +61,7 @@ static int bus_driver_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_driver *)b)->name) == 0) + if (strcmp(((char *)a), ((struct sysfs_driver *)b)->name) == 0) return 1; return 0; } @@ -102,16 +102,16 @@ struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) struct sysfs_device *bdev = NULL; struct sysfs_directory *devdir = NULL; struct sysfs_link *curl = NULL; - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; if (bus == NULL) { errno = EINVAL; return NULL; } memset(path, 0, SYSFS_PATH_MAX); - strcpy(path, bus->path); - strcat(path, "/"); - strcat(path, SYSFS_DEVICES_NAME); + safestrcpy(path, bus->path); + safestrcat(path, "/"); + safestrcat(path, SYSFS_DEVICES_NAME); devdir = sysfs_open_directory(path); if (devdir == NULL) return NULL; @@ -121,7 +121,7 @@ struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) return NULL; } - if (devdir->links != 0) { + if (devdir->links != NULL) { dlist_for_each_data(devdir->links, curl, struct sysfs_link) { bdev = sysfs_open_device_path(curl->target); if (bdev == NULL) { @@ -133,7 +133,7 @@ struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) bus->devices = dlist_new_with_delete (sizeof(struct sysfs_device), sysfs_close_dev); - dlist_unshift(bus->devices, bdev); + dlist_unshift_sorted(bus->devices, bdev, sort_list); } } sysfs_close_directory(devdir); @@ -151,16 +151,16 @@ struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) struct sysfs_driver *driver = NULL; struct sysfs_directory *drvdir = NULL; struct sysfs_directory *cursub = NULL; - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; if (bus == NULL) { errno = EINVAL; return NULL; } memset(path, 0, SYSFS_PATH_MAX); - strcpy(path, bus->path); - strcat(path, "/"); - strcat(path, SYSFS_DRIVERS_NAME); + safestrcpy(path, bus->path); + safestrcat(path, "/"); + safestrcat(path, SYSFS_DRIVERS_NAME); drvdir = sysfs_open_directory(path); if (drvdir == NULL) return NULL; @@ -182,7 +182,7 @@ struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) bus->drivers = dlist_new_with_delete (sizeof(struct sysfs_driver), sysfs_close_drv); - dlist_unshift(bus->drivers, driver); + dlist_unshift_sorted(bus->drivers, driver, sort_list); } } sysfs_close_directory(drvdir); @@ -193,10 +193,10 @@ struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) * sysfs_open_bus: opens specific bus and all its devices on system * returns sysfs_bus structure with success or NULL with error. */ -struct sysfs_bus *sysfs_open_bus(const unsigned char *name) +struct sysfs_bus *sysfs_open_bus(const char *name) { struct sysfs_bus *bus = NULL; - unsigned char buspath[SYSFS_PATH_MAX]; + char buspath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; @@ -209,10 +209,10 @@ struct sysfs_bus *sysfs_open_bus(const unsigned char *name) return NULL; } - strcat(buspath, "/"); - strcat(buspath, SYSFS_BUS_NAME); - strcat(buspath, "/"); - strcat(buspath, name); + safestrcat(buspath, "/"); + safestrcat(buspath, SYSFS_BUS_NAME); + safestrcat(buspath, "/"); + safestrcat(buspath, name); if ((sysfs_path_is_dir(buspath)) != 0) { dprintf("Invalid path to bus: %s\n", buspath); return NULL; @@ -222,8 +222,8 @@ struct sysfs_bus *sysfs_open_bus(const unsigned char *name) dprintf("calloc failed\n"); return NULL; } - strcpy(bus->name, name); - strcpy(bus->path, buspath); + safestrcpy(bus->name, name); + safestrcpy(bus->path, buspath); if ((sysfs_remove_trailing_slash(bus->path)) != 0) { dprintf("Incorrect path to bus %s\n", bus->path); sysfs_close_bus(bus); @@ -239,8 +239,7 @@ struct sysfs_bus *sysfs_open_bus(const unsigned char *name) * @id: bus_id for device * returns struct sysfs_device reference or NULL if not found. */ -struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, - unsigned char *id) +struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, char *id) { if (bus == NULL || id == NULL) { errno = EINVAL; @@ -264,7 +263,7 @@ struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, * returns struct sysfs_driver reference or NULL if not found. */ struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - unsigned char *drvname) + char *drvname) { if (bus == NULL || drvname == NULL) { errno = EINVAL; @@ -338,7 +337,7 @@ struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus) * returns reference to sysfs_attribute if found or NULL if not found */ struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, - unsigned char *attrname) + char *attrname) { struct dlist *attrlist = NULL; @@ -353,49 +352,6 @@ struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, return sysfs_get_directory_attribute(bus->directory, attrname); } -/** - * sysfs_open_bus_device: locates a device on a bus and returns it. Device - * must be closed using sysfs_close_device. - * @busname: Name of bus to search - * @dev_id: Id of device on bus. - * returns sysfs_device if found or NULL if not. - */ -struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, - unsigned char *dev_id) -{ - struct sysfs_device *rdev = NULL; - char path[SYSFS_PATH_MAX]; - - if (busname == NULL || dev_id == NULL) { - errno = EINVAL; - return NULL; - } - - memset(path, 0, SYSFS_PATH_MAX); - if (sysfs_get_mnt_path(path, SYSFS_PATH_MAX) != 0) { - dprintf("Error getting sysfs mount point\n"); - return NULL; - } - - strcat(path, "/"); - strcat(path, SYSFS_BUS_NAME); - strcat(path, "/"); - strcat(path, busname); - strcat(path, "/"); - strcat(path, SYSFS_DEVICES_NAME); - strcat(path, "/"); - strcat(path, dev_id); - - rdev = sysfs_open_device_path(path); - if (rdev == NULL) { - dprintf("Error getting device %s on bus %s\n", - dev_id, busname); - return NULL; - } - - return rdev; -} - /** * sysfs_find_driver_bus: locates the bus the driver is on. * @driver: name of the driver to locate @@ -403,10 +359,9 @@ struct sysfs_device *sysfs_open_bus_device(unsigned char *busname, * @bsize: buffer size * returns 0 with success, -1 with error */ -int sysfs_find_driver_bus(const unsigned char *driver, unsigned char *busname, - size_t bsize) +int sysfs_find_driver_bus(const char *driver, char *busname, size_t bsize) { - unsigned char subsys[SYSFS_PATH_MAX], *bus = NULL, *curdrv = NULL; + char subsys[SYSFS_PATH_MAX], *bus = NULL, *curdrv = NULL; struct dlist *buslist = NULL, *drivers = NULL; if (driver == NULL || busname == NULL) { @@ -415,23 +370,22 @@ int sysfs_find_driver_bus(const unsigned char *driver, unsigned char *busname, } memset(subsys, 0, SYSFS_PATH_MAX); - strcat(subsys, "/"); - strcpy(subsys, SYSFS_BUS_NAME); + safestrcpy(subsys, SYSFS_BUS_NAME); buslist = sysfs_open_subsystem_list(subsys); if (buslist != NULL) { dlist_for_each_data(buslist, bus, char) { memset(subsys, 0, SYSFS_PATH_MAX); - strcat(subsys, "/"); - strcpy(subsys, SYSFS_BUS_NAME); - strcat(subsys, "/"); - strcat(subsys, bus); - strcat(subsys, "/"); - strcat(subsys, SYSFS_DRIVERS_NAME); + safestrcpy(subsys, SYSFS_BUS_NAME); + safestrcat(subsys, "/"); + safestrcat(subsys, bus); + safestrcat(subsys, "/"); + safestrcat(subsys, SYSFS_DRIVERS_NAME); drivers = sysfs_open_subsystem_list(subsys); if (drivers != NULL) { dlist_for_each_data(drivers, curdrv, char) { if (strcmp(driver, curdrv) == 0) { - strncpy(busname, bus, bsize); + safestrncpy(busname, + bus, bsize); sysfs_close_list(drivers); sysfs_close_list(buslist); return 0; diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index 05305056dd..7a696355ca 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -38,8 +38,7 @@ static int class_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_class_device *)b)->name) - == 0) + if (strcmp(((char *)a), ((struct sysfs_class_device *)b)->name) == 0) return 1; return 0; @@ -66,7 +65,7 @@ void sysfs_close_class_device(struct sysfs_class_device *dev) /** * sysfs_close_class: close single class - * @class: class structure + * @cls: class structure */ void sysfs_close_class(struct sysfs_class *cls) { @@ -105,7 +104,7 @@ static struct sysfs_class *alloc_class(void) */ static void set_classdev_classname(struct sysfs_class_device *cdev) { - unsigned char *c = NULL, *e = NULL; + char *c = NULL, *e = NULL; int count = 0; c = strstr(cdev->path, SYSFS_CLASS_NAME); @@ -116,7 +115,7 @@ static void set_classdev_classname(struct sysfs_class_device *cdev) } if (c == NULL) - strcpy(cdev->classname, SYSFS_UNKNOWN); + safestrcpy(cdev->classname, SYSFS_UNKNOWN); else { if (*c == '/') c++; @@ -134,8 +133,7 @@ static void set_classdev_classname(struct sysfs_class_device *cdev) * @path: path to class device. * returns struct sysfs_class_device with success and NULL with error. */ -struct sysfs_class_device *sysfs_open_class_device_path - (const unsigned char *path) +struct sysfs_class_device *sysfs_open_class_device_path(const char *path) { struct sysfs_class_device *cdev = NULL; @@ -159,7 +157,7 @@ struct sysfs_class_device *sysfs_open_class_device_path return NULL; } - strcpy(cdev->path, path); + safestrcpy(cdev->path, path); if ((sysfs_remove_trailing_slash(cdev->path)) != 0) { dprintf("Invalid path to class device %s\n", cdev->path); sysfs_close_class_device(cdev); @@ -172,7 +170,7 @@ struct sysfs_class_device *sysfs_open_class_device_path /** * sysfs_get_class_devices: gets all devices for class - * @class: class to get devices for + * @cls: class to get devices for * returns dlist of class_devices with success and NULL with error */ struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) @@ -210,7 +208,7 @@ struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) cls->devices = dlist_new_with_delete (sizeof(struct sysfs_class_device), sysfs_close_cls_dev); - dlist_unshift(cls->devices, dev); + dlist_unshift_sorted(cls->devices, dev, sort_list); } } return cls->devices; @@ -220,10 +218,10 @@ struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) * sysfs_open_class: opens specific class and all its devices on system * returns sysfs_class structure with success or NULL with error. */ -struct sysfs_class *sysfs_open_class(const unsigned char *name) +struct sysfs_class *sysfs_open_class(const char *name) { struct sysfs_class *cls = NULL; - unsigned char classpath[SYSFS_PATH_MAX]; + char classpath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; @@ -241,13 +239,13 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) * if "name" is "block" and proceed accordingly */ if (strcmp(name, SYSFS_BLOCK_NAME) == 0) { - strcat(classpath, "/"); - strcat(classpath, SYSFS_BLOCK_NAME); + safestrcat(classpath, "/"); + safestrcat(classpath, SYSFS_BLOCK_NAME); } else { - strcat(classpath, "/"); - strcat(classpath, SYSFS_CLASS_NAME); - strcat(classpath, "/"); - strcat(classpath, name); + safestrcat(classpath, "/"); + safestrcat(classpath, SYSFS_CLASS_NAME); + safestrcat(classpath, "/"); + safestrcat(classpath, name); } if ((sysfs_path_is_dir(classpath)) != 0) { dprintf("Class %s not found on the system\n", name); @@ -259,8 +257,8 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) dprintf("calloc failed\n"); return NULL; } - strcpy(cls->name, name); - strcpy(cls->path, classpath); + safestrcpy(cls->name, name); + safestrcpy(cls->path, classpath); if ((sysfs_remove_trailing_slash(cls->path)) != 0) { dprintf("Invalid path to class device %s\n", cls->path); sysfs_close_class(cls); @@ -275,20 +273,20 @@ struct sysfs_class *sysfs_open_class(const unsigned char *name) * @class: class to find device on * @name: class name of the device */ -struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *class, - unsigned char *name) +struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *cls, + char *name) { - if (class == NULL || name == NULL) { + if (cls == NULL || name == NULL) { errno = EINVAL; return NULL; } - if (class->devices == NULL) { - class->devices = sysfs_get_class_devices(class); - if (class->devices == NULL) + if (cls->devices == NULL) { + cls->devices = sysfs_get_class_devices(cls); + if (cls->devices == NULL) return NULL; } - return (struct sysfs_class_device *)dlist_find_custom(class->devices, + return (struct sysfs_class_device *)dlist_find_custom(cls->devices, name, class_name_equal); } @@ -303,14 +301,14 @@ struct sysfs_device *sysfs_get_classdev_device (struct sysfs_class_device *clsdev) { struct sysfs_link *devlink = NULL; - unsigned char devpath[SYSFS_PATH_MAX]; + char devpath[SYSFS_PATH_MAX]; if (clsdev == NULL) { errno = EINVAL; return NULL; } - strcpy(devpath, clsdev->path); - strcat(devpath, "/device"); + safestrcpy(devpath, clsdev->path); + safestrcat(devpath, "/device"); if ((sysfs_path_is_link(devpath)) != 0) { if (clsdev->sysdevice != NULL) { sysfs_close_device(clsdev->sysdevice); @@ -347,8 +345,6 @@ struct sysfs_device *sysfs_get_classdev_device clsdev->sysdevice = sysfs_open_device_path(devlink->target); if (clsdev->sysdevice == NULL) return NULL; - if (clsdev->driver != NULL) - strcpy(clsdev->sysdevice->driver_name, clsdev->driver->name); return (clsdev->sysdevice); } @@ -364,14 +360,14 @@ struct sysfs_driver *sysfs_get_classdev_driver (struct sysfs_class_device *clsdev) { struct sysfs_link *drvlink = NULL; - unsigned char drvpath[SYSFS_PATH_MAX]; + char drvpath[SYSFS_PATH_MAX]; if (clsdev == NULL) { errno = EINVAL; return NULL; } - strcpy(drvpath, clsdev->path); - strcat(drvpath, "/driver"); + safestrcpy(drvpath, clsdev->path); + safestrcat(drvpath, "/driver"); if ((sysfs_path_is_link(drvpath)) != 0) { if (clsdev->driver != NULL) { sysfs_close_driver(clsdev->driver); @@ -407,8 +403,6 @@ struct sysfs_driver *sysfs_get_classdev_driver clsdev->driver = sysfs_open_driver_path(drvlink->target); if (clsdev->driver == NULL) return NULL; - if (clsdev->sysdevice != NULL) - strcpy(clsdev->sysdevice->driver_name, clsdev->driver->name); return (clsdev->driver); } @@ -421,16 +415,15 @@ struct sysfs_driver *sysfs_get_classdev_driver */ static int get_blockdev_parent(struct sysfs_class_device *clsdev) { - unsigned char parent_path[SYSFS_PATH_MAX], *c = NULL; + char parent_path[SYSFS_PATH_MAX], *c = NULL; - strcpy(parent_path, clsdev->path); + safestrcpy(parent_path, clsdev->path); c = strstr(parent_path, SYSFS_BLOCK_NAME); if (c == NULL) { dprintf("Class device %s does not belong to BLOCK subsystem\n", clsdev->name); return 1; } - c += strlen(SYSFS_BLOCK_NAME); if (*c == '/') c++; @@ -486,7 +479,8 @@ struct sysfs_class_device *sysfs_get_classdev_parent * structure. Hence, we now call a specialized function for block and * later we can add support functions for other subsystems as required. */ - if (!(strcmp(clsdev->classname, SYSFS_BLOCK_NAME))) { + if (!(strncmp(clsdev->classname, SYSFS_BLOCK_NAME, + sizeof(SYSFS_BLOCK_NAME)))) { if ((get_blockdev_parent(clsdev)) == 0) return (clsdev->parent); } @@ -502,8 +496,8 @@ struct sysfs_class_device *sysfs_get_classdev_parent * @psize: size of "path" * Returns 0 on SUCCESS or -1 on error */ -static int get_classdev_path(const unsigned char *classname, - const unsigned char *clsdev, unsigned char *path, size_t len) +static int get_classdev_path(const char *classname, const char *clsdev, + char *path, size_t len) { if (classname == NULL || clsdev == NULL || path == NULL) { errno = EINVAL; @@ -513,17 +507,18 @@ static int get_classdev_path(const unsigned char *classname, dprintf("Error getting sysfs mount path\n"); return -1; } - if (strcmp(classname, SYSFS_BLOCK_NAME) == 0) { - strcat(path, "/"); - strcat(path, SYSFS_BLOCK_NAME); + if (strncmp(classname, SYSFS_BLOCK_NAME, + sizeof(SYSFS_BLOCK_NAME)) == 0) { + safestrncat(path, "/", len); + safestrncat(path, SYSFS_BLOCK_NAME, len); } else { - strcat(path, "/"); - strcat(path, SYSFS_CLASS_NAME); - strcat(path, "/"); - strcat(path, classname); + safestrncat(path, "/", len); + safestrncat(path, SYSFS_CLASS_NAME, len); + safestrncat(path, "/", len); + safestrncat(path, classname, len); } - strcat(path, "/"); - strcat(path, clsdev); + safestrncat(path, "/", len); + safestrncat(path, clsdev, len); return 0; } @@ -537,9 +532,9 @@ static int get_classdev_path(const unsigned char *classname, * Call sysfs_close_class_device() to close the class device */ struct sysfs_class_device *sysfs_open_class_device - (const unsigned char *classname, const unsigned char *name) + (const char *classname, const char *name) { - unsigned char devpath[SYSFS_PATH_MAX]; + char devpath[SYSFS_PATH_MAX]; struct sysfs_class_device *cdev = NULL; if (classname == NULL || name == NULL) { @@ -622,7 +617,7 @@ struct dlist *sysfs_refresh_classdev_attributes * returns sysfs_attribute reference with success or NULL with error */ struct sysfs_attribute *sysfs_get_classdev_attr - (struct sysfs_class_device *clsdev, const unsigned char *name) + (struct sysfs_class_device *clsdev, const char *name) { struct sysfs_attribute *cur = NULL; struct sysfs_directory *sdir = NULL; @@ -640,7 +635,7 @@ struct sysfs_attribute *sysfs_get_classdev_attr attrlist = sysfs_get_classdev_attributes(clsdev); if (attrlist != NULL) { cur = sysfs_get_directory_attribute(clsdev->directory, - (unsigned char *)name); + (char *)name); if (cur != NULL) return cur; } @@ -656,7 +651,7 @@ struct sysfs_attribute *sysfs_get_classdev_attr if ((sysfs_path_is_dir(sdir->path)) != 0) continue; cur = sysfs_get_directory_attribute(sdir, - (unsigned char *)name); + (char *)name); if (cur == NULL) continue; } @@ -675,11 +670,11 @@ struct sysfs_attribute *sysfs_get_classdev_attr * A call to sysfs_close_attribute() is required to close the * attribute returned and to free memory */ -struct sysfs_attribute *sysfs_open_classdev_attr(const unsigned char *classname, - const unsigned char *dev, const unsigned char *attrib) +struct sysfs_attribute *sysfs_open_classdev_attr(const char *classname, + const char *dev, const char *attrib) { struct sysfs_attribute *attribute = NULL; - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; if (classname == NULL || dev == NULL || attrib == NULL) { errno = EINVAL; @@ -691,8 +686,8 @@ struct sysfs_attribute *sysfs_open_classdev_attr(const unsigned char *classname, dev, classname); return NULL; } - strcat(path, "/"); - strcat(path, attrib); + safestrcat(path, "/"); + safestrcat(path, attrib); attribute = sysfs_open_attribute(path); if (attribute == NULL) { dprintf("Error opening attribute %s on class device %s\n", diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 06b8d2d99a..e3a8977016 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -23,6 +23,57 @@ #include "sysfs/libsysfs.h" #include "sysfs.h" +/** + * get_dev_driver: fills in the dev->driver_name field + * + * Returns 0 on SUCCESS and 1 on error + */ +static int get_dev_driver(struct sysfs_device *dev) +{ + struct dlist *drvlist = NULL; + char path[SYSFS_PATH_MAX], devpath[SYSFS_PATH_MAX]; + char *drv = NULL, *c = NULL; + + if (dev == NULL) { + errno = EINVAL; + return 1; + } + if (dev->bus[0] == '\0') + return 1; + memset(path, 0, SYSFS_PATH_MAX); + memset(devpath, 0, SYSFS_PATH_MAX); + safestrcpy(path, SYSFS_BUS_NAME); + safestrcat(path, "/"); + safestrcat(path, dev->bus); + safestrcat(path, "/"); + safestrcat(path, SYSFS_DRIVERS_NAME); + + safestrcpy(devpath, dev->path); + c = strstr(devpath, SYSFS_DEVICES_NAME); + if (c == NULL) + return 1; + *c = '\0'; + safestrncat(c, path, (sizeof(devpath) - strlen(devpath))); + + drvlist = sysfs_open_subsystem_list(path); + if (drvlist != NULL) { + dlist_for_each_data(drvlist, drv, char) { + safestrcpy(path, devpath); + safestrcat(path, "/"); + safestrcat(path, drv); + safestrcat(path, "/"); + safestrcat(path, dev->bus_id); + if (sysfs_path_is_link(path) == 0) { + safestrcpy(dev->driver_name, drv); + sysfs_close_list(drvlist); + return 0; + } + } + sysfs_close_list(drvlist); + } + return 1; +} + /** * sysfs_get_device_bus: retrieves the bus name the device is on, checks path * to bus' link to make sure it has correct device. @@ -31,8 +82,8 @@ */ int sysfs_get_device_bus(struct sysfs_device *dev) { - unsigned char subsys[SYSFS_NAME_LEN], path[SYSFS_PATH_MAX]; - unsigned char target[SYSFS_PATH_MAX], *bus = NULL, *c = NULL; + char subsys[SYSFS_NAME_LEN], path[SYSFS_PATH_MAX]; + char target[SYSFS_PATH_MAX], *bus = NULL, *c = NULL; struct dlist *buslist = NULL; if (dev == NULL) { @@ -41,13 +92,12 @@ int sysfs_get_device_bus(struct sysfs_device *dev) } memset(subsys, 0, SYSFS_NAME_LEN); - strcat(subsys, "/"); - strcpy(subsys, SYSFS_BUS_NAME); /* subsys = /bus */ + safestrcpy(subsys, SYSFS_BUS_NAME); /* subsys = bus */ buslist = sysfs_open_subsystem_list(subsys); if (buslist != NULL) { dlist_for_each_data(buslist, bus, char) { memset(path, 0, SYSFS_PATH_MAX); - strcpy(path, dev->path); + safestrcpy(path, dev->path); c = strstr(path, "/devices"); if (c == NULL) { dprintf("Invalid path to device %s\n", path); @@ -55,25 +105,25 @@ int sysfs_get_device_bus(struct sysfs_device *dev) return -1; } *c = '\0'; - strcat(path, "/"); - strcat(path, SYSFS_BUS_NAME); - strcat(path, "/"); - strcat(path, bus); - strcat(path, "/"); - strcat(path, SYSFS_DEVICES_NAME); - strcat(path, "/"); - strcat(path, dev->bus_id); + safestrcat(path, "/"); + safestrcat(path, SYSFS_BUS_NAME); + safestrcat(path, "/"); + safestrcat(path, bus); + safestrcat(path, "/"); + safestrcat(path, SYSFS_DEVICES_NAME); + safestrcat(path, "/"); + safestrcat(path, dev->bus_id); if ((sysfs_path_is_link(path)) == 0) { memset(target, 0, SYSFS_PATH_MAX); if ((sysfs_get_link(path, target, - SYSFS_PATH_MAX)) != 0) { + SYSFS_PATH_MAX)) != 0) { dprintf("Error getting link target\n"); sysfs_close_list(buslist); return -1; } if (!(strncmp(target, dev->path, SYSFS_PATH_MAX))) { - strcpy(dev->bus, bus); + safestrcpy(dev->bus, bus); sysfs_close_list(buslist); return 0; } @@ -89,7 +139,7 @@ int sysfs_get_device_bus(struct sysfs_device *dev) * closing children only. * @devroot: device root of tree. */ -static void sysfs_close_device_tree(struct sysfs_device *devroot) +void sysfs_close_device_tree(struct sysfs_device *devroot) { if (devroot != NULL) { if (devroot->children != NULL) { @@ -143,7 +193,7 @@ static struct sysfs_device *alloc_device(void) * @name: name of root * returns struct sysfs_directory with success and NULL with error */ -static struct sysfs_directory *open_device_dir(const unsigned char *path) +static struct sysfs_directory *open_device_dir(const char *path) { struct sysfs_directory *rdir = NULL; @@ -172,7 +222,7 @@ static struct sysfs_directory *open_device_dir(const unsigned char *path) * @path: path to device, this is the /sys/devices/ path * returns sysfs_device structure with success or NULL with error */ -struct sysfs_device *sysfs_open_device_path(const unsigned char *path) +struct sysfs_device *sysfs_open_device_path(const char *path) { struct sysfs_device *dev = NULL; @@ -196,7 +246,7 @@ struct sysfs_device *sysfs_open_device_path(const unsigned char *path) sysfs_close_device(dev); return NULL; } - strcpy(dev->path, path); + safestrcpy(dev->path, path); if ((sysfs_remove_trailing_slash(dev->path)) != 0) { dprintf("Invalid path to device %s\n", dev->path); sysfs_close_device(dev); @@ -207,10 +257,15 @@ struct sysfs_device *sysfs_open_device_path(const unsigned char *path) * sysfs representation instead, in the "dev->name" field, which * implies that the dev->name and dev->bus_id contain same data. */ - strncpy(dev->name, dev->bus_id, SYSFS_NAME_LEN); + safestrcpy(dev->name, dev->bus_id); if (sysfs_get_device_bus(dev) != 0) dprintf("Could not get device bus\n"); + + if (get_dev_driver(dev) != 0) { + dprintf("Could not get device %s's driver\n", dev->bus_id); + safestrcpy(dev->driver_name, SYSFS_UNKNOWN); + } return dev; } @@ -222,7 +277,7 @@ struct sysfs_device *sysfs_open_device_path(const unsigned char *path) * returns struct sysfs_device and its children with success or NULL with * error. */ -static struct sysfs_device *sysfs_open_device_tree(const unsigned char *path) +struct sysfs_device *sysfs_open_device_tree(const char *path) { struct sysfs_device *rootdev = NULL, *new = NULL; struct sysfs_directory *cur = NULL; @@ -255,7 +310,8 @@ static struct sysfs_device *sysfs_open_device_tree(const unsigned char *path) rootdev->children = dlist_new_with_delete (sizeof(struct sysfs_device), sysfs_close_dev_tree); - dlist_unshift(rootdev->children, new); + dlist_unshift_sorted(rootdev->children, + new, sort_list); } } @@ -311,7 +367,7 @@ struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root) root->devices = dlist_new_with_delete (sizeof(struct sysfs_device), sysfs_close_dev_tree); - dlist_unshift(root->devices, dev); + dlist_unshift_sorted(root->devices, dev, sort_list); } return root->devices; @@ -323,10 +379,10 @@ struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root) * @name: name of /sys/devices/root to open * returns struct sysfs_root_device if success and NULL with error */ -struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) +struct sysfs_root_device *sysfs_open_root_device(const char *name) { struct sysfs_root_device *root = NULL; - unsigned char rootpath[SYSFS_PATH_MAX]; + char rootpath[SYSFS_PATH_MAX]; if (name == NULL) { errno = EINVAL; @@ -339,10 +395,10 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) return NULL; } - strcat(rootpath, "/"); - strcat(rootpath, SYSFS_DEVICES_NAME); - strcat(rootpath, "/"); - strcat(rootpath, name); + safestrcat(rootpath, "/"); + safestrcat(rootpath, SYSFS_DEVICES_NAME); + safestrcat(rootpath, "/"); + safestrcat(rootpath, name); if ((sysfs_path_is_dir(rootpath)) != 0) { errno = EINVAL; dprintf("Invalid root device: %s\n", name); @@ -354,8 +410,8 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) dprintf("calloc failure\n"); return NULL; } - strcpy(root->name, name); - strcpy(root->path, rootpath); + safestrcpy(root->name, name); + safestrcpy(root->path, rootpath); if ((sysfs_remove_trailing_slash(root->path)) != 0) { dprintf("Invalid path to root device %s\n", root->path); sysfs_close_root_device(root); @@ -371,8 +427,10 @@ struct sysfs_root_device *sysfs_open_root_device(const unsigned char *name) */ struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) { - if (device == NULL) + if (device == NULL) { + errno = EINVAL; return NULL; + } if (device->directory == NULL) { device->directory = sysfs_open_directory(device->path); @@ -420,7 +478,7 @@ struct dlist *sysfs_refresh_device_attributes(struct sysfs_device *device) * returns sysfs_attribute reference with success or NULL with error. */ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, - const unsigned char *name) + const char *name) { struct dlist *attrlist = NULL; @@ -433,8 +491,7 @@ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, if (attrlist == NULL) return NULL; - return sysfs_get_directory_attribute(dev->directory, - (unsigned char *)name); + return sysfs_get_directory_attribute(dev->directory, (char *)name); } /** @@ -445,10 +502,10 @@ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, * @psize: size of "path" * Returns 0 on success -1 on failure */ -static int get_device_absolute_path(const unsigned char *device, - const unsigned char *bus, unsigned char *path, size_t psize) +static int get_device_absolute_path(const char *device, const char *bus, + char *path, size_t psize) { - unsigned char bus_path[SYSFS_PATH_MAX]; + char bus_path[SYSFS_PATH_MAX]; if (device == NULL || path == NULL) { errno = EINVAL; @@ -460,19 +517,19 @@ static int get_device_absolute_path(const unsigned char *device, dprintf ("Sysfs not supported on this system\n"); return -1; } - strcat(bus_path, "/"); - strcat(bus_path, SYSFS_BUS_NAME); - strcat(bus_path, "/"); - strcat(bus_path, bus); - strcat(bus_path, "/"); - strcat(bus_path, SYSFS_DEVICES_NAME); - strcat(bus_path, "/"); - strcat(bus_path, device); + safestrcat(bus_path, "/"); + safestrcat(bus_path, SYSFS_BUS_NAME); + safestrcat(bus_path, "/"); + safestrcat(bus_path, bus); + safestrcat(bus_path, "/"); + safestrcat(bus_path, SYSFS_DEVICES_NAME); + safestrcat(bus_path, "/"); + safestrcat(bus_path, device); /* * We now are at /sys/bus/"bus_name"/devices/"device" which is a link. * Now read this link to reach to the device. */ - if ((sysfs_get_link(bus_path, path, SYSFS_PATH_MAX)) != 0) { + if ((sysfs_get_link(bus_path, path, psize)) != 0) { dprintf("Error getting to device %s\n", device); return -1; } @@ -481,17 +538,16 @@ static int get_device_absolute_path(const unsigned char *device, /** * sysfs_open_device: open a device by id (use the "bus" subsystem) + * @bus: bus the device belongs to * @bus_id: bus_id of the device to open - has to be the "bus_id" in * /sys/bus/xxx/devices - * @bus: bus the device belongs to * returns struct sysfs_device if found, NULL otherwise * NOTE: * 1. Use sysfs_close_device to close the device * 2. Bus the device is on must be supplied * Use sysfs_find_device_bus to get the bus name */ -struct sysfs_device *sysfs_open_device(const unsigned char *bus_id, - const unsigned char *bus) +struct sysfs_device *sysfs_open_device(const char *bus, const char *bus_id) { char sysfs_path[SYSFS_PATH_MAX]; struct sysfs_device *device = NULL; @@ -524,7 +580,7 @@ struct sysfs_device *sysfs_open_device(const unsigned char *bus_id, */ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) { - unsigned char ppath[SYSFS_PATH_MAX], *tmp = NULL; + char ppath[SYSFS_PATH_MAX], *tmp = NULL; if (dev == NULL) { errno = EINVAL; @@ -535,13 +591,13 @@ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) return (dev->parent); memset(ppath, 0, SYSFS_PATH_MAX); - strcpy(ppath, dev->path); + safestrcpy(ppath, dev->path); tmp = strrchr(ppath, '/'); if (tmp == NULL) { dprintf("Invalid path to device %s\n", ppath); return NULL; } - if (*(tmp +1) == '\0') { + if (*(tmp + 1) == '\0') { *tmp = '\0'; tmp = strrchr(tmp, '/'); if (tmp == NULL) { @@ -554,7 +610,7 @@ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) /* * All "devices" have the "detach_state" attribute - validate here */ - strcat(ppath, "/detach_state"); + safestrcat(ppath, "/detach_state"); if ((sysfs_path_is_file(ppath)) != 0) { dprintf("Device at %s does not have a parent\n", dev->path); return NULL; @@ -581,11 +637,11 @@ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) * A call to sysfs_close_attribute() is required to close * the attribute returned and free memory. */ -struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, - const unsigned char *bus_id, const unsigned char *attrib) +struct sysfs_attribute *sysfs_open_device_attr(const char *bus, + const char *bus_id, const char *attrib) { struct sysfs_attribute *attribute = NULL; - unsigned char devpath[SYSFS_PATH_MAX]; + char devpath[SYSFS_PATH_MAX]; if (bus == NULL || bus_id == NULL || attrib == NULL) { errno = EINVAL; @@ -598,8 +654,8 @@ struct sysfs_attribute *sysfs_open_device_attr(const unsigned char *bus, dprintf("Error getting to device %s\n", bus_id); return NULL; } - strcat(devpath, "/"); - strcat(devpath, attrib); + safestrcat(devpath, "/"); + safestrcat(devpath, attrib); attribute = sysfs_open_attribute(devpath); if (attribute == NULL) { dprintf("Error opening attribute %s for device %s\n", diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index 050e674038..be54a1cf86 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -58,9 +58,9 @@ static int dir_attribute_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_attribute *)b)->name) - == 0) + if (strcmp(((char *)a), ((struct sysfs_attribute *)b)->name) == 0) return 1; + return 0; } @@ -75,9 +75,9 @@ static int dir_link_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_link *)b)->name) - == 0) + if (strcmp(((char *)a), ((struct sysfs_link *)b)->name) == 0) return 1; + return 0; } @@ -92,9 +92,9 @@ static int dir_subdir_name_equal(void *a, void *b) if (a == NULL || b == NULL) return 0; - if (strcmp(((unsigned char *)a), ((struct sysfs_directory *)b)->name) - == 0) + if (strcmp(((char *)a), ((struct sysfs_directory *)b)->name) == 0) return 1; + return 0; } @@ -126,7 +126,7 @@ static struct sysfs_attribute *alloc_attribute(void) * @path: path to attribute. * returns sysfs_attribute struct with success and NULL with error. */ -struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path) +struct sysfs_attribute *sysfs_open_attribute(const char *path) { struct sysfs_attribute *sysattr = NULL; struct stat fileinfo; @@ -140,14 +140,13 @@ struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path) dprintf("Error allocating attribute at %s\n", path); return NULL; } - if (sysfs_get_name_from_path(path, sysattr->name, SYSFS_NAME_LEN) - != 0) { - dprintf("Error retrieving attribute name from path: %s\n", - path); + if (sysfs_get_name_from_path(path, sysattr->name, + SYSFS_NAME_LEN) != 0) { + dprintf("Error retrieving attrib name from path: %s\n", path); sysfs_close_attribute(sysattr); return NULL; } - strncpy(sysattr->path, path, SYSFS_PATH_MAX); + safestrcpy(sysattr->path, path); if ((stat(sysattr->path, &fileinfo)) != 0) { dprintf("Stat failed: No such attribute?\n"); sysattr->method = 0; @@ -171,7 +170,7 @@ struct sysfs_attribute *sysfs_open_attribute(const unsigned char *path) * returns 0 with success and -1 with error. */ int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const unsigned char *new_value, size_t len) + const char *new_value, size_t len) { int fd; int length; @@ -184,6 +183,7 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, if (!(sysattr->method & SYSFS_METHOD_STORE)) { dprintf ("Store method not supported for attribute %s\n", sysattr->path); + errno = EACCES; return -1; } if (sysattr->method & SYSFS_METHOD_SHOW) { @@ -215,7 +215,7 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, sysattr->name); close(fd); return -1; - } else if (length != len) { + } else if ((unsigned int)length != len) { dprintf("Could not write %d bytes to attribute %s\n", len, sysattr->name); /* @@ -236,13 +236,13 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, */ if (sysattr->method & SYSFS_METHOD_SHOW) { if (length != sysattr->len) { - sysattr->value = (char *)realloc(sysattr->value, - length); + sysattr->value = (char *)realloc + (sysattr->value, length); sysattr->len = length; - strncpy(sysattr->value, new_value, length); + safestrncpy(sysattr->value, new_value, length); } else { /*"length" of the new value is same as old one */ - strncpy(sysattr->value, new_value, length); + safestrncpy(sysattr->value, new_value, length); } } @@ -250,7 +250,6 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, return 0; } - /** * sysfs_read_attribute: reads value from attribute * @sysattr: attribute to read @@ -258,8 +257,8 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, */ int sysfs_read_attribute(struct sysfs_attribute *sysattr) { - unsigned char *fbuf = NULL; - unsigned char *vbuf = NULL; + char *fbuf = NULL; + char *vbuf = NULL; ssize_t length = 0; long pgsize = 0; int fd; @@ -271,11 +270,11 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) if (!(sysattr->method & SYSFS_METHOD_SHOW)) { dprintf("Show method not supported for attribute %s\n", sysattr->path); + errno = EACCES; return -1; } - pgsize = getpagesize(); - fbuf = (unsigned char *)calloc(1, pgsize+1); + fbuf = (char *)calloc(1, pgsize+1); if (fbuf == NULL) { dprintf("calloc failed\n"); return -1; @@ -296,13 +295,14 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) if ((sysattr->len == length) && (!(strncmp(sysattr->value, fbuf, length)))) { close(fd); + free(fbuf); return 0; } free(sysattr->value); } sysattr->len = length; close(fd); - vbuf = (unsigned char *)realloc(fbuf, length+1); + vbuf = (char *)realloc(fbuf, length+1); if (vbuf == NULL) { dprintf("realloc failed\n"); free(fbuf); @@ -322,13 +322,13 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) * @vsize: size of value buffer * returns 0 with success and -1 with error. */ -int sysfs_read_attribute_value(const unsigned char *attrpath, - unsigned char *value, size_t vsize) +int sysfs_read_attribute_value(const char *attrpath, + char *value, size_t vsize) { struct sysfs_attribute *attr = NULL; size_t length = 0; - if (attrpath == NULL || value == NULL) { + if (attrpath == NULL || value == NULL || vsize == 0) { errno = EINVAL; return -1; } @@ -348,7 +348,7 @@ int sysfs_read_attribute_value(const unsigned char *attrpath, if (length > vsize) dprintf("Value length %d is larger than supplied buffer %d\n", length, vsize); - strncpy(value, attr->value, vsize); + safestrncpy(value, attr->value, vsize); sysfs_close_attribute(attr); return 0; @@ -359,10 +359,9 @@ int sysfs_read_attribute_value(const unsigned char *attrpath, * attribute name, return its value * @attr: attribute to search * @name: name to look for - * returns unsigned char * value - could be NULL + * returns char * value - could be NULL */ -unsigned char *sysfs_get_value_from_attributes(struct dlist *attr, - const unsigned char *name) +char *sysfs_get_value_from_attributes(struct dlist *attr, const char *name) { struct sysfs_attribute *cur = NULL; @@ -432,6 +431,7 @@ static struct sysfs_link *alloc_link(void) int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) { struct sysfs_directory *cursub = NULL; + int retval = 0; if (sysdir == NULL) { errno = EINVAL; @@ -443,12 +443,16 @@ int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) if (sysdir->subdirs != NULL) { dlist_for_each_data(sysdir->subdirs, cursub, struct sysfs_directory) { - if ((sysfs_read_dir_subdirs(cursub)) != 0) + if ((sysfs_read_dir_subdirs(cursub)) != 0) { dprintf ("Error reading subdirectory %s\n", cursub->name); + retval = -1; + } } } - return 0; + if (!retval) + errno = 0; + return retval; } /** @@ -457,7 +461,7 @@ int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) * @path: path of directory to open. * returns: struct sysfs_directory * with success and NULL on error. */ -struct sysfs_directory *sysfs_open_directory(const unsigned char *path) +struct sysfs_directory *sysfs_open_directory(const char *path) { struct sysfs_directory *sdir = NULL; @@ -467,7 +471,7 @@ struct sysfs_directory *sysfs_open_directory(const unsigned char *path) } if (sysfs_path_is_dir(path) != 0) { - dprintf("Invalid path directory %s\n", path); + dprintf("Invalid path to directory %s\n", path); errno = EINVAL; return NULL; } @@ -482,7 +486,7 @@ struct sysfs_directory *sysfs_open_directory(const unsigned char *path) sysfs_close_directory(sdir); return NULL; } - strncpy(sdir->path, path, SYSFS_PATH_MAX); + safestrcpy(sdir->path, path); return sdir; } @@ -492,7 +496,7 @@ struct sysfs_directory *sysfs_open_directory(const unsigned char *path) * @path: path of link to open. * returns: struct sysfs_link * with success and NULL on error. */ -struct sysfs_link *sysfs_open_link(const unsigned char *linkpath) +struct sysfs_link *sysfs_open_link(const char *linkpath) { struct sysfs_link *ln = NULL; @@ -506,7 +510,7 @@ struct sysfs_link *sysfs_open_link(const unsigned char *linkpath) dprintf("Error allocating link %s\n", linkpath); return NULL; } - strcpy(ln->path, linkpath); + safestrcpy(ln->path, linkpath); if ((sysfs_get_name_from_path(linkpath, ln->name, SYSFS_NAME_LEN)) != 0 || (sysfs_get_link(linkpath, ln->target, SYSFS_PATH_MAX)) != 0) { errno = EINVAL; @@ -523,8 +527,7 @@ struct sysfs_link *sysfs_open_link(const unsigned char *linkpath) * @path: path to attribute * returns 0 with success and -1 with error. */ -static int add_attribute(struct sysfs_directory *sysdir, - const unsigned char *path) +static int add_attribute(struct sysfs_directory *sysdir, const char *path) { struct sysfs_attribute *attr = NULL; @@ -545,7 +548,7 @@ static int add_attribute(struct sysfs_directory *sysdir, sysdir->attributes = dlist_new_with_delete (sizeof(struct sysfs_attribute), sysfs_del_attribute); } - dlist_unshift(sysdir->attributes, attr); + dlist_unshift_sorted(sysdir->attributes, attr, sort_list); return 0; } @@ -556,8 +559,7 @@ static int add_attribute(struct sysfs_directory *sysdir, * @path: path to subdirectory * returns 0 with success and -1 with error. */ -static int add_subdirectory(struct sysfs_directory *sysdir, - const unsigned char *path) +static int add_subdirectory(struct sysfs_directory *sysdir, const char *path) { struct sysfs_directory *subdir = NULL; @@ -569,7 +571,7 @@ static int add_subdirectory(struct sysfs_directory *sysdir, if (sysdir->subdirs == NULL) sysdir->subdirs = dlist_new_with_delete (sizeof(struct sysfs_directory), sysfs_del_directory); - dlist_unshift(sysdir->subdirs, subdir); + dlist_unshift_sorted(sysdir->subdirs, subdir, sort_list); return 0; } @@ -579,7 +581,7 @@ static int add_subdirectory(struct sysfs_directory *sysdir, * @path: path to link * returns 0 with success and -1 with error. */ -static int add_link(struct sysfs_directory *sysdir, const unsigned char *path) +static int add_link(struct sysfs_directory *sysdir, const char *path) { struct sysfs_link *ln = NULL; @@ -591,7 +593,7 @@ static int add_link(struct sysfs_directory *sysdir, const unsigned char *path) if (sysdir->links == NULL) sysdir->links = dlist_new_with_delete (sizeof(struct sysfs_link), sysfs_del_link); - dlist_unshift(sysdir->links, ln); + dlist_unshift_sorted(sysdir->links, ln, sort_list); return 0; } @@ -604,7 +606,7 @@ int sysfs_read_dir_attributes(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; - unsigned char file_path[SYSFS_PATH_MAX]; + char file_path[SYSFS_PATH_MAX]; int retval = 0; if (sysdir == NULL) { @@ -622,13 +624,15 @@ int sysfs_read_dir_attributes(struct sysfs_directory *sysdir) if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); - strcat(file_path, "/"); - strcat(file_path, dirent->d_name); + safestrcpy(file_path, sysdir->path); + safestrcat(file_path, "/"); + safestrcat(file_path, dirent->d_name); if ((sysfs_path_is_file(file_path)) == 0) retval = add_attribute(sysdir, file_path); } closedir(dir); + if (!retval) + errno = 0; return(retval); } @@ -641,7 +645,7 @@ int sysfs_read_dir_links(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; - unsigned char file_path[SYSFS_PATH_MAX]; + char file_path[SYSFS_PATH_MAX]; int retval = 0; if (sysdir == NULL) { @@ -659,9 +663,9 @@ int sysfs_read_dir_links(struct sysfs_directory *sysdir) if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); - strcat(file_path, "/"); - strcat(file_path, dirent->d_name); + safestrcpy(file_path, sysdir->path); + safestrcat(file_path, "/"); + safestrcat(file_path, dirent->d_name); if ((sysfs_path_is_link(file_path)) == 0) { retval = add_link(sysdir, file_path); if (retval != 0) @@ -669,6 +673,8 @@ int sysfs_read_dir_links(struct sysfs_directory *sysdir) } } closedir(dir); + if (!retval) + errno = 0; return(retval); } @@ -681,7 +687,7 @@ int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir) { DIR *dir = NULL; struct dirent *dirent = NULL; - unsigned char file_path[SYSFS_PATH_MAX]; + char file_path[SYSFS_PATH_MAX]; int retval = 0; if (sysdir == NULL) { @@ -699,13 +705,15 @@ int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir) if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); - strcat(file_path, "/"); - strcat(file_path, dirent->d_name); + safestrcpy(file_path, sysdir->path); + safestrcat(file_path, "/"); + safestrcat(file_path, dirent->d_name); if ((sysfs_path_is_dir(file_path)) == 0) retval = add_subdirectory(sysdir, file_path); } closedir(dir); + if (!retval) + errno = 0; return(retval); } @@ -719,7 +727,7 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) DIR *dir = NULL; struct dirent *dirent = NULL; struct stat astats; - unsigned char file_path[SYSFS_PATH_MAX]; + char file_path[SYSFS_PATH_MAX]; int retval = 0; if (sysdir == NULL) { @@ -737,9 +745,9 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - strncpy(file_path, sysdir->path, SYSFS_PATH_MAX); - strcat(file_path, "/"); - strcat(file_path, dirent->d_name); + safestrcpy(file_path, sysdir->path); + safestrcat(file_path, "/"); + safestrcat(file_path, dirent->d_name); if ((lstat(file_path, &astats)) != 0) { dprintf("stat failed\n"); continue; @@ -754,6 +762,8 @@ int sysfs_read_directory(struct sysfs_directory *sysdir) retval = add_attribute(sysdir, file_path); } closedir(dir); + if (!retval) + errno = 0; return(retval); } @@ -782,6 +792,7 @@ int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir) sysdir->path); return 1; } + errno = 0; return 0; } @@ -810,6 +821,7 @@ int sysfs_refresh_dir_links(struct sysfs_directory *sysdir) sysdir->path); return 1; } + errno = 0; return 0; } @@ -838,6 +850,7 @@ int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir) sysdir->path); return 1; } + errno = 0; return 0; } @@ -846,13 +859,17 @@ int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir) * directory only * @dir: directory to retrieve attribute from * @attrname: name of attribute to look for + * + * NOTE: Since we know the attribute to look for, this routine looks for the + * attribute if it was created _after_ the attrlist was read initially. + * * returns sysfs_attribute if found and NULL if not found */ struct sysfs_attribute *sysfs_get_directory_attribute - (struct sysfs_directory *dir, unsigned char *attrname) + (struct sysfs_directory *dir, char *attrname) { struct sysfs_attribute *attr = NULL; - unsigned char new_path[SYSFS_PATH_MAX]; + char new_path[SYSFS_PATH_MAX]; if (dir == NULL || attrname == NULL) { errno = EINVAL; @@ -873,9 +890,9 @@ struct sysfs_attribute *sysfs_get_directory_attribute } } else { memset(new_path, 0, SYSFS_PATH_MAX); - strcpy(new_path, dir->path); - strcat(new_path, "/"); - strcat(new_path, attrname); + safestrcpy(new_path, dir->path); + safestrcat(new_path, "/"); + safestrcat(new_path, attrname); if ((sysfs_path_is_file(new_path)) == 0) { if ((add_attribute(dir, new_path)) == 0) { attr = (struct sysfs_attribute *) @@ -895,7 +912,7 @@ struct sysfs_attribute *sysfs_get_directory_attribute * returns reference to sysfs_link if found and NULL if not found */ struct sysfs_link *sysfs_get_directory_link - (struct sysfs_directory *dir, unsigned char *linkname) + (struct sysfs_directory *dir, char *linkname) { if (dir == NULL || linkname == NULL) { errno = EINVAL; @@ -920,7 +937,7 @@ struct sysfs_link *sysfs_get_directory_link * returns reference to subdirectory or NULL if not found */ struct sysfs_directory *sysfs_get_subdirectory(struct sysfs_directory *dir, - unsigned char *subname) + char *subname) { struct sysfs_directory *sub = NULL, *cursub = NULL; @@ -962,7 +979,7 @@ struct sysfs_directory *sysfs_get_subdirectory(struct sysfs_directory *dir, * returns reference to link or NULL if not found */ struct sysfs_link *sysfs_get_subdirectory_link(struct sysfs_directory *dir, - unsigned char *linkname) + char *linkname) { struct sysfs_directory *cursub = NULL; struct sysfs_link *ln = NULL; diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index cd202d9f23..9ffa9c9077 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -79,7 +79,7 @@ static struct sysfs_driver *alloc_driver(void) * @path: path to driver directory * returns struct sysfs_driver with success and NULL with error */ -struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path) +struct sysfs_driver *sysfs_open_driver_path(const char *path) { struct sysfs_driver *driver = NULL; @@ -102,7 +102,7 @@ struct sysfs_driver *sysfs_open_driver_path(const unsigned char *path) free(driver); return NULL; } - strcpy(driver->path, path); + safestrcpy(driver->path, path); if ((sysfs_remove_trailing_slash(driver->path)) != 0) { dprintf("Invalid path to driver %s\n", driver->path); sysfs_close_driver(driver); @@ -168,7 +168,7 @@ struct dlist *sysfs_refresh_driver_attributes(struct sysfs_driver *driver) * returns sysfs_attribute reference on success or NULL with error */ struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, - const unsigned char *name) + const char *name) { struct dlist *attrlist = NULL; @@ -178,11 +178,10 @@ struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, } attrlist = sysfs_get_driver_attributes(drv); - if (attrlist != NULL) + if (attrlist == NULL) return NULL; - return sysfs_get_directory_attribute(drv->directory, - (unsigned char *)name); + return sysfs_get_directory_attribute(drv->directory, (char *)name); } /** @@ -197,12 +196,15 @@ struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver) errno = EINVAL; return NULL; } - if (driver->directory == NULL) { + + if (driver->directory == NULL) if ((open_driver_dir(driver)) == 1) return NULL; + + if (driver->directory->links == NULL) if ((sysfs_read_dir_links(driver->directory)) != 0) return NULL; - } + return(driver->directory->links); } @@ -224,12 +226,11 @@ struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver) if (driver->devices != NULL) return (driver->devices); - if (driver->directory == NULL) { - if ((open_driver_dir(driver)) == 1) - return NULL; - if ((sysfs_read_dir_links(driver->directory)) != 0) - return NULL; + if (driver->directory == NULL || driver->directory->links == NULL) { + struct dlist *list = NULL; + list = sysfs_get_driver_links(driver); } + if (driver->directory->links != NULL) { dlist_for_each_data(driver->directory->links, curlink, struct sysfs_link) { @@ -239,12 +240,12 @@ struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver) curlink->target); return NULL; } - strcpy(device->driver_name, driver->name); if (driver->devices == NULL) driver->devices = dlist_new_with_delete (sizeof(struct sysfs_device), sysfs_close_driver_device); - dlist_unshift(driver->devices, device); + dlist_unshift_sorted(driver->devices, device, + sort_list); } } return (driver->devices); @@ -290,7 +291,7 @@ struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver) * Returns a sysfs_device if found, NULL otherwise */ struct sysfs_device *sysfs_get_driver_device(struct sysfs_driver *driver, - const unsigned char *name) + const char *name) { struct sysfs_device *device = NULL; struct dlist *devlist = NULL; @@ -323,10 +324,10 @@ struct sysfs_device *sysfs_get_driver_device(struct sysfs_driver *driver, * @psize: size of "path" * Returns 0 on success and -1 on error */ -static int get_driver_path(const unsigned char *bus, - const unsigned char *drv, unsigned char *path, size_t psize) +static int get_driver_path(const char *bus, const char *drv, + char *path, size_t psize) { - if (bus == NULL || drv == NULL || path == NULL) { + if (bus == NULL || drv == NULL || path == NULL || psize == 0) { errno = EINVAL; return -1; } @@ -334,14 +335,14 @@ static int get_driver_path(const unsigned char *bus, dprintf("Error getting sysfs mount path\n"); return -1; } - strcat(path, "/"); - strcat(path, SYSFS_BUS_NAME); - strcat(path, "/"); - strcat(path, bus); - strcat(path, "/"); - strcat(path, SYSFS_DRIVERS_NAME); - strcat(path, "/"); - strcat(path, drv); + safestrncat(path, "/", psize); + safestrncat(path, SYSFS_BUS_NAME, psize); + safestrncat(path, "/", psize); + safestrncat(path, bus, psize); + safestrncat(path, "/", psize); + safestrncat(path, SYSFS_DRIVERS_NAME, psize); + safestrncat(path, "/", psize); + safestrncat(path, drv, psize); return 0; } @@ -356,11 +357,11 @@ static int get_driver_path(const unsigned char *bus, * A call to sysfs_close_attribute() is required to close the * attribute returned and to free memory */ -struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, - const unsigned char *drv, const unsigned char *attrib) +struct sysfs_attribute *sysfs_open_driver_attr(const char *bus, + const char *drv, const char *attrib) { struct sysfs_attribute *attribute = NULL; - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; if (bus == NULL || drv == NULL || attrib == NULL) { errno = EINVAL; @@ -372,8 +373,8 @@ struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, dprintf("Error getting to driver %s\n", drv); return NULL; } - strcat(path, "/"); - strcat(path, attrib); + safestrcat(path, "/"); + safestrcat(path, attrib); attribute = sysfs_open_attribute(path); if (attribute == NULL) { dprintf("Error opening attribute %s for driver %s\n", @@ -391,14 +392,14 @@ struct sysfs_attribute *sysfs_open_driver_attr(const unsigned char *bus, /** * sysfs_open_driver: open driver by name, given its bus - * @drv_name: Name of the driver * @bus_name: Name of the bus + * @drv_name: Name of the driver * Returns the sysfs_driver reference on success and NULL on failure */ -struct sysfs_driver *sysfs_open_driver(const unsigned char *drv_name, - const unsigned char *bus_name) +struct sysfs_driver *sysfs_open_driver(const char *bus_name, + const char *drv_name) { - unsigned char path[SYSFS_PATH_MAX]; + char path[SYSFS_PATH_MAX]; struct sysfs_driver *driver = NULL; if (drv_name == NULL || bus_name == NULL) { diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 2509c73c98..699a9829b8 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -26,14 +26,20 @@ #include #endif +static int sort_char(void *new_elem, void *old_elem) +{ + return ((strncmp((char *)new_elem, (char *)old_elem, + strlen((char *)new_elem))) < 0 ? 1 : 0); +} + /** * sysfs_remove_trailing_slash: Removes any trailing '/' in the given path * @path: Path to look for the trailing '/' * Returns 0 on success 1 on error */ -int sysfs_remove_trailing_slash(unsigned char *path) +int sysfs_remove_trailing_slash(char *path) { - unsigned char *c = NULL; + char *c = NULL; if (path == NULL) { errno = EINVAL; @@ -51,17 +57,17 @@ int sysfs_remove_trailing_slash(unsigned char *path) } /** - * sysfs_get_mnt_path: Gets the mount point for specified filesystem. + * sysfs_get_fs_mnt_path: Gets the mount point for specified filesystem. * @fs_type: filesystem type to retrieve mount point * @mnt_path: place to put the retrieved mount path * @len: size of mnt_path * returns 0 with success and -1 with error. */ -static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, - unsigned char *mnt_path, size_t len) +static int sysfs_get_fs_mnt_path(const char *fs_type, + char *mnt_path, size_t len) { #ifdef __KLIBC__ - strcpy(mnt_path, "/sys"); + safestrncpy(mnt_path, "/sys", len); return 0; #else FILE *mnt; @@ -70,7 +76,7 @@ static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, size_t dirlen = 0; /* check arg */ - if (fs_type == NULL || mnt_path == NULL) { + if (fs_type == NULL || mnt_path == NULL || len == 0) { errno = EINVAL; return -1; } @@ -83,7 +89,7 @@ static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, if (strcmp(mntent->mnt_type, fs_type) == 0) { dirlen = strlen(mntent->mnt_dir); if (dirlen <= (len - 1)) { - strcpy(mnt_path, mntent->mnt_dir); + safestrncpy(mnt_path, mntent->mnt_dir, len); } else { dprintf("Error - mount path too long\n"); ret = -1; @@ -109,18 +115,18 @@ static int sysfs_get_fs_mnt_path(const unsigned char *fs_type, * @len: size of mnt_path * returns 0 with success and -1 with error. */ -int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len) +int sysfs_get_mnt_path(char *mnt_path, size_t len) { char *sysfs_path = NULL; int ret = 0; - if (mnt_path == NULL) { + if (mnt_path == NULL || len == 0) { errno = EINVAL; return -1; } sysfs_path = getenv(SYSFS_PATH_ENV); if (sysfs_path != NULL) { - strncpy(mnt_path, sysfs_path, len); + safestrncpy(mnt_path, sysfs_path, len); if ((sysfs_remove_trailing_slash(mnt_path)) != 0) return 1; } else @@ -135,18 +141,17 @@ int sysfs_get_mnt_path(unsigned char *mnt_path, size_t len) * @name: where to put name * @len: size of name */ -int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, - size_t len) +int sysfs_get_name_from_path(const char *path, char *name, size_t len) { - unsigned char tmp[SYSFS_PATH_MAX]; - unsigned char *n = NULL; + char tmp[SYSFS_PATH_MAX]; + char *n = NULL; - if (path == NULL || name == NULL) { + if (path == NULL || name == NULL || len == 0) { errno = EINVAL; return -1; } memset(tmp, 0, SYSFS_PATH_MAX); - strcpy(tmp, path); + safestrcpy(tmp, path); n = strrchr(tmp, '/'); if (n == NULL) { errno = EINVAL; @@ -161,7 +166,7 @@ int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, } } n++; - strncpy(name, n, len); + safestrncpy(name, n, len); return 0; } @@ -171,21 +176,23 @@ int sysfs_get_name_from_path(const unsigned char *path, unsigned char *name, * @target: where to put name * @len: size of name */ -int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) +int sysfs_get_link(const char *path, char *target, size_t len) { - unsigned char devdir[SYSFS_PATH_MAX]; - unsigned char linkpath[SYSFS_PATH_MAX]; - unsigned char *d = NULL, *s = NULL; + char devdir[SYSFS_PATH_MAX]; + char linkpath[SYSFS_PATH_MAX]; + char temp_path[SYSFS_PATH_MAX]; + char *d = NULL, *s = NULL; int slashes = 0, count = 0; - if (path == NULL || target == NULL) { + if (path == NULL || target == NULL || len == 0) { errno = EINVAL; return -1; } memset(devdir, 0, SYSFS_PATH_MAX); memset(linkpath, 0, SYSFS_PATH_MAX); - strncpy(devdir, path, SYSFS_PATH_MAX); + memset(temp_path, 0, SYSFS_PATH_MAX); + safestrcpy(devdir, path); if ((readlink(path, linkpath, SYSFS_PATH_MAX)) < 0) { return -1; @@ -202,18 +209,19 @@ int sysfs_get_link(const unsigned char *path, unsigned char *target, size_t len) /* * handle the case where link is of type ./abcd/xxx */ - strncpy(target, devdir, len); + safestrcpy(temp_path, devdir); if (*(d+1) == '/') d += 2; else if (*(d+1) == '.') goto parse_path; - s = strrchr(target, '/'); + s = strrchr(temp_path, '/'); if (s != NULL) { *(s+1) = '\0'; - strcat(target, d); + safestrcat(temp_path, d); } else { - strcpy(target, d); + safestrcpy(temp_path, d); } + safestrncpy(target, temp_path, len); break; /* * relative path @@ -232,23 +240,24 @@ parse_path: if (*s == '/') count++; } - strncpy(s, d, (SYSFS_PATH_MAX-strlen(devdir))); - strncpy(target, devdir, len); + safestrncpy(s, d, (SYSFS_PATH_MAX-strlen(devdir))); + safestrncpy(target, devdir, len); break; case '/': /* absolute path - copy as is */ - strncpy(target, linkpath, len); + safestrncpy(target, linkpath, len); break; default: /* relative path from this directory */ - strncpy(target, devdir, len); - s = strrchr(target, '/'); + safestrcpy(temp_path, devdir); + s = strrchr(temp_path, '/'); if (s != NULL) { *(s+1) = '\0'; - strcat(target, linkpath); + safestrcat(temp_path, linkpath); } else { - strcpy(target, linkpath); - } + safestrcpy(temp_path, linkpath); + } + safestrncpy(target, temp_path, len); } return 0; } @@ -280,10 +289,10 @@ void sysfs_close_list(struct dlist *list) * @name: name of the subsystem, eg., "bus", "class", "devices" * Returns a dlist of supported names or NULL if subsystem not supported */ -struct dlist *sysfs_open_subsystem_list(unsigned char *name) +struct dlist *sysfs_open_subsystem_list(char *name) { - unsigned char sysfs_path[SYSFS_PATH_MAX], *subsys_name = NULL; - unsigned char *c = NULL; + char sysfs_path[SYSFS_PATH_MAX], *subsys_name = NULL; + char *c = NULL; struct sysfs_directory *dir = NULL, *cur = NULL; struct dlist *list = NULL; @@ -295,8 +304,8 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) return NULL; } - strcat(sysfs_path, "/"); - strcat(sysfs_path, name); + safestrcat(sysfs_path, "/"); + safestrcat(sysfs_path, name); dir = sysfs_open_directory(sysfs_path); if (dir == NULL) { dprintf("Error opening sysfs_directory at %s\n", sysfs_path); @@ -321,8 +330,8 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) dlist_for_each_data(dir->subdirs, cur, struct sysfs_directory) { subsys_name = (char *)calloc(1, SYSFS_NAME_LEN); - strcpy(subsys_name, cur->name); - dlist_unshift(list, subsys_name); + safestrncpy(subsys_name, cur->name, SYSFS_NAME_LEN); + dlist_unshift_sorted(list, subsys_name, sort_char); } } sysfs_close_directory(dir); @@ -335,11 +344,14 @@ struct dlist *sysfs_open_subsystem_list(unsigned char *name) c = strstr(sysfs_path, SYSFS_CLASS_NAME); if (c == NULL) goto out; - strcpy(c, SYSFS_BLOCK_NAME); + *c = '\0'; + safestrncpy(c, SYSFS_BLOCK_NAME, + sizeof(sysfs_path) - strlen(sysfs_path)); if ((sysfs_path_is_dir(sysfs_path)) == 0) { subsys_name = (char *)calloc(1, SYSFS_NAME_LEN); - strcpy(subsys_name, SYSFS_BLOCK_NAME); - dlist_unshift(list, subsys_name); + safestrncpy(subsys_name, SYSFS_BLOCK_NAME, + SYSFS_NAME_LEN); + dlist_unshift_sorted(list, subsys_name, sort_char); } } out: @@ -352,9 +364,9 @@ out: * @name: name of the subsystem, eg., "pci", "scsi", "usb" * Returns a dlist of supported names or NULL if subsystem not supported */ -struct dlist *sysfs_open_bus_devices_list(unsigned char *name) +struct dlist *sysfs_open_bus_devices_list(char *name) { - unsigned char sysfs_path[SYSFS_PATH_MAX], *device_name = NULL; + char sysfs_path[SYSFS_PATH_MAX], *device_name = NULL; struct sysfs_directory *dir = NULL; struct sysfs_link *cur = NULL; struct dlist *list = NULL; @@ -367,12 +379,12 @@ struct dlist *sysfs_open_bus_devices_list(unsigned char *name) return NULL; } - strcat(sysfs_path, "/"); - strcat(sysfs_path, SYSFS_BUS_NAME); - strcat(sysfs_path, "/"); - strcat(sysfs_path, name); - strcat(sysfs_path, "/"); - strcat(sysfs_path, SYSFS_DEVICES_NAME); + safestrcat(sysfs_path, "/"); + safestrcat(sysfs_path, SYSFS_BUS_NAME); + safestrcat(sysfs_path, "/"); + safestrcat(sysfs_path, name); + safestrcat(sysfs_path, "/"); + safestrcat(sysfs_path, SYSFS_DEVICES_NAME); dir = sysfs_open_directory(sysfs_path); if (dir == NULL) { dprintf("Error opening sysfs_directory at %s\n", sysfs_path); @@ -397,8 +409,8 @@ struct dlist *sysfs_open_bus_devices_list(unsigned char *name) dlist_for_each_data(dir->links, cur, struct sysfs_link) { device_name = (char *)calloc(1, SYSFS_NAME_LEN); - strcpy(device_name, cur->name); - dlist_unshift(list, device_name); + safestrncpy(device_name, cur->name, SYSFS_NAME_LEN); + dlist_unshift_sorted(list, device_name, sort_char); } } sysfs_close_directory(dir); @@ -410,7 +422,7 @@ struct dlist *sysfs_open_bus_devices_list(unsigned char *name) * @path: path to validate * Returns 0 if path points to dir, 1 otherwise */ -int sysfs_path_is_dir(const unsigned char *path) +int sysfs_path_is_dir(const char *path) { struct stat astats; @@ -433,7 +445,7 @@ int sysfs_path_is_dir(const unsigned char *path) * @path: path to validate * Returns 0 if path points to link, 1 otherwise */ -int sysfs_path_is_link(const unsigned char *path) +int sysfs_path_is_link(const char *path) { struct stat astats; @@ -456,7 +468,7 @@ int sysfs_path_is_link(const unsigned char *path) * @path: path to validate * Returns 0 if path points to file, 1 otherwise */ -int sysfs_path_is_file(const unsigned char *path) +int sysfs_path_is_file(const char *path) { struct stat astats; -- cgit v1.2.3-54-g00ecf From 656703759d7d3eac6e8c86f1121cde7dfd6d8cbd Mon Sep 17 00:00:00 2001 From: "ananth@in.ibm.com" Date: Fri, 12 Mar 2004 00:57:36 -0800 Subject: [PATCH] more Libsysfs updates On Thu, Mar 11, 2004 at 02:36:23PM +0100, Kay Sievers wrote: > On Thu, 2004-03-11 at 15:02, Ananth N Mavinakayanahalli wrote: > > On Thu, Mar 11, 2004 at 02:04:36PM +0100, Kay Sievers wrote: > > > On Thu, Mar 11, 2004 at 11:53:50AM +0500, Ananth N Mavinakayanahalli wrote: > > > > > > > +#define safestrcpy(to, from) strncpy(to, from, sizeof(to)-1) > > > > +#define safestrcat(to, from) strncat(to, from, sizeof(to) - strlen(to)-1) > > > > > > These strings are not terminated with '\0' if from is longer than > > > the sizeof to. > > > > Did not do it on purpose as the "to" elements are either calloc'd or memset to > > '0' explicitly in the library. Thats the reason I mentioned "scaled down" :) > > Ahh, sounds good. > > > > > +#define safestrncpy(to, from, maxsize) \ > > > > +do { \ > > > > + to[maxsize-1] = '\0'; \ > > > > + strncpy(to, from, maxsize-1); \ > > > > +} while (0) > > > > + > > > > +#define safestrncat(to, from, maxsize) \ > > > > +do { \ > > > > + to[maxsize-1] = '\0'; \ > > > > + strncat(to, from, maxsize - strlen(to)-1); \ > > > > +} while (0) > > > > > > We all expect a similar behavior like strncat/strncpy according to the > > > names, but these macros are limiting by the target size and do not limit > > > the count of chars copied. > > > This is confusing I think and suggest using a different name like > > > 'safestrcopymax()' or something. > > > > Good point.. will make the change > > Nice. I've had these *n* names too and I forgot about the logic and only > 10 days later I introduced a ugly bug cause I can't limit the count of > copied chars :) Inlined is the patch for this... applies on the earlier _BIG_ patch. --- libsysfs/sysfs/libsysfs.h | 12 ++++++------ libsysfs/sysfs_bus.c | 2 +- libsysfs/sysfs_class.c | 16 ++++++++-------- libsysfs/sysfs_device.c | 2 +- libsysfs/sysfs_dir.c | 6 +++--- libsysfs/sysfs_driver.c | 16 ++++++++-------- libsysfs/sysfs_utils.c | 26 +++++++++++++------------- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/libsysfs/sysfs/libsysfs.h b/libsysfs/sysfs/libsysfs.h index cbde2f5783..11cffae045 100644 --- a/libsysfs/sysfs/libsysfs.h +++ b/libsysfs/sysfs/libsysfs.h @@ -32,16 +32,16 @@ #define safestrcpy(to, from) strncpy(to, from, sizeof(to)-1) #define safestrcat(to, from) strncat(to, from, sizeof(to) - strlen(to)-1) -#define safestrncpy(to, from, maxsize) \ +#define safestrcpymax(to, from, max) \ do { \ - to[maxsize-1] = '\0'; \ - strncpy(to, from, maxsize-1); \ + to[max-1] = '\0'; \ + strncpy(to, from, max-1); \ } while (0) -#define safestrncat(to, from, maxsize) \ +#define safestrcatmax(to, from, max) \ do { \ - to[maxsize-1] = '\0'; \ - strncat(to, from, maxsize - strlen(to)-1); \ + to[max-1] = '\0'; \ + strncat(to, from, max - strlen(to)-1); \ } while (0) /* diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index bff7f78f05..9ca23c85d8 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -384,7 +384,7 @@ int sysfs_find_driver_bus(const char *driver, char *busname, size_t bsize) if (drivers != NULL) { dlist_for_each_data(drivers, curdrv, char) { if (strcmp(driver, curdrv) == 0) { - safestrncpy(busname, + safestrcpymax(busname, bus, bsize); sysfs_close_list(drivers); sysfs_close_list(buslist); diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index 7a696355ca..59ef0be48e 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -509,16 +509,16 @@ static int get_classdev_path(const char *classname, const char *clsdev, } if (strncmp(classname, SYSFS_BLOCK_NAME, sizeof(SYSFS_BLOCK_NAME)) == 0) { - safestrncat(path, "/", len); - safestrncat(path, SYSFS_BLOCK_NAME, len); + safestrcatmax(path, "/", len); + safestrcatmax(path, SYSFS_BLOCK_NAME, len); } else { - safestrncat(path, "/", len); - safestrncat(path, SYSFS_CLASS_NAME, len); - safestrncat(path, "/", len); - safestrncat(path, classname, len); + safestrcatmax(path, "/", len); + safestrcatmax(path, SYSFS_CLASS_NAME, len); + safestrcatmax(path, "/", len); + safestrcatmax(path, classname, len); } - safestrncat(path, "/", len); - safestrncat(path, clsdev, len); + safestrcatmax(path, "/", len); + safestrcatmax(path, clsdev, len); return 0; } diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index e3a8977016..290fd9723e 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -53,7 +53,7 @@ static int get_dev_driver(struct sysfs_device *dev) if (c == NULL) return 1; *c = '\0'; - safestrncat(c, path, (sizeof(devpath) - strlen(devpath))); + safestrcatmax(c, path, (sizeof(devpath) - strlen(devpath))); drvlist = sysfs_open_subsystem_list(path); if (drvlist != NULL) { diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index be54a1cf86..8ce8522200 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -239,10 +239,10 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, sysattr->value = (char *)realloc (sysattr->value, length); sysattr->len = length; - safestrncpy(sysattr->value, new_value, length); + safestrcpymax(sysattr->value, new_value, length); } else { /*"length" of the new value is same as old one */ - safestrncpy(sysattr->value, new_value, length); + safestrcpymax(sysattr->value, new_value, length); } } @@ -348,7 +348,7 @@ int sysfs_read_attribute_value(const char *attrpath, if (length > vsize) dprintf("Value length %d is larger than supplied buffer %d\n", length, vsize); - safestrncpy(value, attr->value, vsize); + safestrcpymax(value, attr->value, vsize); sysfs_close_attribute(attr); return 0; diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index 9ffa9c9077..2439b7a567 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -335,14 +335,14 @@ static int get_driver_path(const char *bus, const char *drv, dprintf("Error getting sysfs mount path\n"); return -1; } - safestrncat(path, "/", psize); - safestrncat(path, SYSFS_BUS_NAME, psize); - safestrncat(path, "/", psize); - safestrncat(path, bus, psize); - safestrncat(path, "/", psize); - safestrncat(path, SYSFS_DRIVERS_NAME, psize); - safestrncat(path, "/", psize); - safestrncat(path, drv, psize); + safestrcatmax(path, "/", psize); + safestrcatmax(path, SYSFS_BUS_NAME, psize); + safestrcatmax(path, "/", psize); + safestrcatmax(path, bus, psize); + safestrcatmax(path, "/", psize); + safestrcatmax(path, SYSFS_DRIVERS_NAME, psize); + safestrcatmax(path, "/", psize); + safestrcatmax(path, drv, psize); return 0; } diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 699a9829b8..492c7fa668 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -67,7 +67,7 @@ static int sysfs_get_fs_mnt_path(const char *fs_type, char *mnt_path, size_t len) { #ifdef __KLIBC__ - safestrncpy(mnt_path, "/sys", len); + safestrcpymax(mnt_path, "/sys", len); return 0; #else FILE *mnt; @@ -89,7 +89,7 @@ static int sysfs_get_fs_mnt_path(const char *fs_type, if (strcmp(mntent->mnt_type, fs_type) == 0) { dirlen = strlen(mntent->mnt_dir); if (dirlen <= (len - 1)) { - safestrncpy(mnt_path, mntent->mnt_dir, len); + safestrcpymax(mnt_path, mntent->mnt_dir, len); } else { dprintf("Error - mount path too long\n"); ret = -1; @@ -126,7 +126,7 @@ int sysfs_get_mnt_path(char *mnt_path, size_t len) } sysfs_path = getenv(SYSFS_PATH_ENV); if (sysfs_path != NULL) { - safestrncpy(mnt_path, sysfs_path, len); + safestrcpymax(mnt_path, sysfs_path, len); if ((sysfs_remove_trailing_slash(mnt_path)) != 0) return 1; } else @@ -166,7 +166,7 @@ int sysfs_get_name_from_path(const char *path, char *name, size_t len) } } n++; - safestrncpy(name, n, len); + safestrcpymax(name, n, len); return 0; } @@ -221,7 +221,7 @@ int sysfs_get_link(const char *path, char *target, size_t len) } else { safestrcpy(temp_path, d); } - safestrncpy(target, temp_path, len); + safestrcpymax(target, temp_path, len); break; /* * relative path @@ -240,12 +240,12 @@ parse_path: if (*s == '/') count++; } - safestrncpy(s, d, (SYSFS_PATH_MAX-strlen(devdir))); - safestrncpy(target, devdir, len); + safestrcpymax(s, d, (SYSFS_PATH_MAX-strlen(devdir))); + safestrcpymax(target, devdir, len); break; case '/': /* absolute path - copy as is */ - safestrncpy(target, linkpath, len); + safestrcpymax(target, linkpath, len); break; default: /* relative path from this directory */ @@ -257,7 +257,7 @@ parse_path: } else { safestrcpy(temp_path, linkpath); } - safestrncpy(target, temp_path, len); + safestrcpymax(target, temp_path, len); } return 0; } @@ -330,7 +330,7 @@ struct dlist *sysfs_open_subsystem_list(char *name) dlist_for_each_data(dir->subdirs, cur, struct sysfs_directory) { subsys_name = (char *)calloc(1, SYSFS_NAME_LEN); - safestrncpy(subsys_name, cur->name, SYSFS_NAME_LEN); + safestrcpymax(subsys_name, cur->name, SYSFS_NAME_LEN); dlist_unshift_sorted(list, subsys_name, sort_char); } } @@ -345,11 +345,11 @@ struct dlist *sysfs_open_subsystem_list(char *name) if (c == NULL) goto out; *c = '\0'; - safestrncpy(c, SYSFS_BLOCK_NAME, + safestrcpymax(c, SYSFS_BLOCK_NAME, sizeof(sysfs_path) - strlen(sysfs_path)); if ((sysfs_path_is_dir(sysfs_path)) == 0) { subsys_name = (char *)calloc(1, SYSFS_NAME_LEN); - safestrncpy(subsys_name, SYSFS_BLOCK_NAME, + safestrcpymax(subsys_name, SYSFS_BLOCK_NAME, SYSFS_NAME_LEN); dlist_unshift_sorted(list, subsys_name, sort_char); } @@ -409,7 +409,7 @@ struct dlist *sysfs_open_bus_devices_list(char *name) dlist_for_each_data(dir->links, cur, struct sysfs_link) { device_name = (char *)calloc(1, SYSFS_NAME_LEN); - safestrncpy(device_name, cur->name, SYSFS_NAME_LEN); + safestrcpymax(device_name, cur->name, SYSFS_NAME_LEN); dlist_unshift_sorted(list, device_name, sort_char); } } -- cgit v1.2.3-54-g00ecf From c612a0acc8c45303b5c40538b87e406ac22a26ef Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 12 Mar 2004 00:58:33 -0800 Subject: [PATCH] add permission tests > Any chance on being able to add a test for this kind of stuff to the > udev-test.pl script? Sure, not brilliant but seems to work :) Only numeric id's are supported so far. --- test/udev-test.pl | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index c12a21ee3d..e345b20c58 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -522,6 +522,16 @@ EOF BUS="scsi", KERNEL="sda", SYMLINK="symlink-only1" BUS="scsi", KERNEL="sda", SYMLINK="symlink-only2" BUS="scsi", KERNEL="sda", NAME="link", SYMLINK="symlink0" +EOF + }, + { + desc => "permissions test", + subsys => "block", + devpath => "block/sda", + expected => "node", + perms => "5000::0444", + conf => <{subsys}, $config->{devpath}, \$config->{conf}); if (-e "$PWD/$udev_root$config->{expected}") { + if (defined($config->{perms})) { + my $wrong = 0; + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$config->{expected}"); + + $config->{perms} =~ m/^(.*):(.*):(.*)$/; + if ($1 ne "") { + if ($uid != $1) { $wrong = 1; }; + } + if ($2 ne "") { + if ($gid != $2) { $wrong = 1; }; + } + if ($3 ne "") { + if (($mode & 07777) != oct($3)) { $wrong = 1; }; + } + if ($wrong == 1) { + printf "expected permissions are: %i:%i:%#o\n", $1, $2, oct($3); + printf "created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; + } + } print "add: ok "; } else { print "add: error\n"; -- cgit v1.2.3-54-g00ecf From 0c17d02da29a4c41186caabb3f7ff488e0f6c9ea Mon Sep 17 00:00:00 2001 From: "ken@cgi101.com" Date: Fri, 12 Mar 2004 00:58:38 -0800 Subject: [PATCH] fix a type in docs/libsysfs.txt Mary Edie Merideth noticed this typo. I think this is what it was supposed to be. Judging by the pattern. --- docs/libsysfs.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/libsysfs.txt b/docs/libsysfs.txt index 66156e5607..2d68ee4648 100644 --- a/docs/libsysfs.txt +++ b/docs/libsysfs.txt @@ -131,7 +131,7 @@ and devices, here's some examples: #define SYSFS_BUS_DIR "/bus" #define SYSFS_BUS_NAME "bus" #define SYSFS_CLASS_DIR "/class" -#define SYSFS_CLASS_DIR "/class" +#define SYSFS_CLASS_NAME "class" #define SYSFS_BLOCK_DIR "/block" #define SYSFS_BLOCK_NAME "block" #define SYSFS_DEVICES_DIR "/devices" -- cgit v1.2.3-54-g00ecf From 60ea6945259ee0336ebd742e701a109c90e5a6ab Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Fri, 12 Mar 2004 01:06:55 -0800 Subject: [PATCH] udev* segfaults with new klibc current klibc uses regparm on i386. This leads to nice segfaults in all udev apps. Using the content of the just included MCONFIG file fixes it. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index e4c6184c95..23aef06666 100644 --- a/Makefile +++ b/Makefile @@ -155,6 +155,7 @@ ifeq ($(strip $(USE_KLIBC)),true) CRT0 = $(KLIBC_DIR)/crt0.o LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) CFLAGS += $(WARNINGS) -nostdinc \ + $(OPTFLAGS) \ -D__KLIBC__ -fno-builtin-printf \ -I$(INCLUDE_DIR) \ -I$(KLIBC_DIR)/arch/$(ARCH)/include \ -- cgit v1.2.3-54-g00ecf From 2731fd98c626209362322645c5b283e98bf6f745 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 12 Mar 2004 16:43:31 -0800 Subject: [PATCH] remove extra ; in namedev_parse.c Thanks to Olaf Hering for pointing this out. --- namedev_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev_parse.c b/namedev_parse.c index fba32a4983..8198f7e684 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -65,7 +65,7 @@ void dump_config_dev(struct config_device *dev) "owner='%s', group='%s', mode=%#o", dev->name, dev->symlink, dev->bus, dev->place, dev->id, dev->sysfs_pair[0].file, dev->sysfs_pair[0].value, - dev->kernel, dev->program, dev->result,; + dev->kernel, dev->program, dev->result, dev->owner, dev->group, dev->mode); } -- cgit v1.2.3-54-g00ecf From fa19f1811c20b6ec3631cecca9aa18ff2413eebb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 12 Mar 2004 17:13:59 -0800 Subject: [PATCH] add dev node test to udev-test.pl > Nice, that's a good start. Now we need to check the major:minor values > too somehow... I better do it immediately, before you put it in the empty TODO :) Patch is a bit big, cause spaces are changed to tabs to get space for the longer names. --- test/udev-test.pl | 559 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 295 insertions(+), 264 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index e345b20c58..fc682b528a 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -33,30 +33,30 @@ my $conf_tmp = "udev-test.rules"; my @tests = ( { - desc => "label test of scsi disc", - subsys => "block", - devpath => "block/sda", - expected => "boot_disk" , - conf => < "label test of scsi disc", + subsys => "block", + devpath => "block/sda", + exp_name=> "boot_disk" , + conf => < "label test of scsi partition", - subsys => "block", - devpath => "block/sda/sda1", - expected => "boot_disk1" , - conf => < "label test of scsi partition", + subsys => "block", + devpath => "block/sda/sda1", + exp_name=> "boot_disk1" , + conf => < "label test of pattern match", - subsys => "block", - devpath => "block/sda/sda1", - expected => "boot_disk1" , - conf => < "label test of pattern match", + subsys => "block", + devpath => "block/sda/sda1", + exp_name=> "boot_disk1" , + conf => < "label test of multiple sysfs files", - subsys => "block", - devpath => "block/sda/sda1", - expected => "boot_disk1" , - conf => < "label test of multiple sysfs files", + subsys => "block", + devpath => "block/sda/sda1", + exp_name => "boot_disk1" , + conf => < "label test of max sysfs files", - subsys => "block", - devpath => "block/sda/sda1", - expected => "boot_disk1" , - conf => < "label test of max sysfs files", + subsys => "block", + devpath => "block/sda/sda1", + exp_name => "boot_disk1" , + conf => < "catch device by *", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor/0" , - conf => < "catch device by *", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor/0" , + conf => < "catch device by * - take 2", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor/0" , - conf => < "catch device by * - take 2", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor/0" , + conf => < "catch device by ?", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor/0" , - conf => < "catch device by ?", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor/0" , + conf => < "catch device by character class", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor/0" , - conf => < "catch device by character class", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor/0" , + conf => < "replace kernel name", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor" , - conf => < "replace kernel name", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor" , + conf => < "Handle comment lines in config file (and replace kernel name)", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor" , - conf => < "Handle comment lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor" , + conf => < "Handle comment lines in config file with whitespace (and replace kernel name)", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor" , - conf => < "Handle comment lines in config file with whitespace (and replace kernel name)", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor" , + conf => < "Handle empty lines in config file (and replace kernel name)", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor" , - conf => < "Handle empty lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor" , + conf => < "subdirectory handling", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "sub/direct/ory/visor" , - conf => < "subdirectory handling", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "sub/direct/ory/visor" , + conf => < "place on bus of scsi partition", - subsys => "block", - devpath => "block/sda/sda3", - expected => "first_disk3" , - conf => < "place on bus of scsi partition", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "first_disk3" , + conf => < "test NAME substitution chars", - subsys => "block", - devpath => "block/sda/sda3", - expected => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , - conf => < "test NAME substitution chars", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , + conf => < "test NAME substitution chars (with length limit)", - subsys => "block", - devpath => "block/sda/sda3", - expected => "M8-m3-n3-b0:0-sIBM" , - conf => < "test NAME substitution chars (with length limit)", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "M8-m3-n3-b0:0-sIBM" , + conf => < "old style SYSFS_ attribute", - subsys => "block", - devpath => "block/sda", - expected => "good" , - conf => < "old style SYSFS_ attribute", + subsys => "block", + devpath => "block/sda", + exp_name => "good" , + conf => < "sustitution of sysfs value (%s{file})", - subsys => "block", - devpath => "block/sda", - expected => "disk-IBM-ESXS-sda" , - conf => < "sustitution of sysfs value (%s{file})", + subsys => "block", + devpath => "block/sda", + exp_name => "disk-IBM-ESXS-sda" , + conf => < "program result substitution", - subsys => "block", - devpath => "block/sda/sda3", - expected => "special-device-3" , - conf => < "program result substitution", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "special-device-3" , + conf => < "block", - devpath => "block/sda/sda3", - expected => "test-0:0:0:0" , - conf => < "program result substitution", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "test-0:0:0:0" , + conf => < "program with escaped format char (tricky: callout returns format char!)", - subsys => "block", - devpath => "block/sda/sda3", - expected => "escape-3" , - conf => < "program with escaped format char (tricky: callout returns format char!)", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "escape-3" , + conf => < "program with lots of arguments", - subsys => "block", - devpath => "block/sda/sda3", - expected => "foo9" , - conf => < "program with lots of arguments", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "foo9" , + conf => < "program with subshell", - subsys => "block", - devpath => "block/sda/sda3", - expected => "bar9" , - conf => < "program with subshell", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "bar9" , + conf => < "program arguments combined with apostrophes", - subsys => "block", - devpath => "block/sda/sda3", - expected => "foo7" , - conf => < "program arguments combined with apostrophes", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "foo7" , + conf => < "characters before the %c{N} substitution", - subsys => "block", - devpath => "block/sda/sda3", - expected => "my-foo9" , - conf => < "characters before the %c{N} substitution", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "my-foo9" , + conf => < "substitute the second to last argument", - subsys => "block", - devpath => "block/sda/sda3", - expected => "my-foo8" , - conf => < "substitute the second to last argument", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "my-foo8" , + conf => < "program result substitution (numbered part of)", - subsys => "block", - devpath => "block/sda/sda3", - expected => "link1" , - conf => < "program result substitution (numbered part of)", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "link1" , + conf => < "program result substitution (numbered part of+)", - subsys => "block", - devpath => "block/sda/sda3", - expected => "link3" , - conf => < "program result substitution (numbered part of+)", + subsys => "block", + devpath => "block/sda/sda3", + exp_name => "link3" , + conf => < "invalid program for device with no bus", - subsys => "tty", - devpath => "class/tty/console", - expected => "TTY" , - conf => < "invalid program for device with no bus", + subsys => "tty", + devpath => "class/tty/console", + exp_name => "TTY" , + conf => < "valid program for device with no bus", - subsys => "tty", - devpath => "class/tty/console", - expected => "foo" , - conf => < "valid program for device with no bus", + subsys => "tty", + devpath => "class/tty/console", + exp_name => "foo" , + conf => < "invalid label for device with no bus", - subsys => "tty", - devpath => "class/tty/console", - expected => "TTY" , - conf => < "invalid label for device with no bus", + subsys => "tty", + devpath => "class/tty/console", + exp_name => "TTY" , + conf => < "valid label for device with no bus", - subsys => "tty", - devpath => "class/tty/console", - expected => "foo" , - conf => < "valid label for device with no bus", + subsys => "tty", + devpath => "class/tty/console", + exp_name => "foo" , + conf => < "program and bus type match", - subsys => "block", - devpath => "block/sda", - expected => "scsi-0:0:0:0" , - conf => < "program and bus type match", + subsys => "block", + devpath => "block/sda", + exp_name => "scsi-0:0:0:0" , + conf => < "symlink creation (same directory)", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor0" , - conf => < "symlink creation (same directory)", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor0" , + conf => < "symlink creation (relative link back)", - subsys => "block", - devpath => "block/sda/sda2", - expected => "1/2/a/b/symlink" , - conf => < "symlink creation (relative link back)", + subsys => "block", + devpath => "block/sda/sda2", + exp_name => "1/2/a/b/symlink" , + conf => < "symlink creation (relative link forward)", - subsys => "block", - devpath => "block/sda/sda2", - expected => "1/2/symlink" , - conf => < "symlink creation (relative link forward)", + subsys => "block", + devpath => "block/sda/sda2", + exp_name => "1/2/symlink" , + conf => < "symlink creation (relative link back and forward)", - subsys => "block", - devpath => "block/sda/sda2", - expected => "1/2/c/d/symlink" , - conf => < "symlink creation (relative link back and forward)", + subsys => "block", + devpath => "block/sda/sda2", + exp_name => "1/2/c/d/symlink" , + conf => < "multiple symlinks", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "second-0" , - conf => < "multiple symlinks", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "second-0" , + conf => < "create all possible partitions", - subsys => "block", - devpath => "block/sda", - expected => "boot_disk15" , - conf => < "create all possible partitions", + subsys => "block", + devpath => "block/sda", + exp_name => "boot_disk15" , + conf => < "sysfs parent hierarchy", - subsys => "tty", - devpath => "class/tty/ttyUSB0", - expected => "visor" , - conf => < "sysfs parent hierarchy", + subsys => "tty", + devpath => "class/tty/ttyUSB0", + exp_name => "visor" , + conf => < "name test with ! in the name", - subsys => "block", - devpath => "block/rd!c0d0", - expected => "rd/c0d0" , - conf => < "name test with ! in the name", + subsys => "block", + devpath => "block/rd!c0d0", + exp_name => "rd/c0d0" , + conf => < "name test with ! in the name, but no matching rule", - subsys => "block", - devpath => "block/rd!c0d0", - expected => "rd/c0d0" , - conf => < "name test with ! in the name, but no matching rule", + subsys => "block", + devpath => "block/rd!c0d0", + exp_name => "rd/c0d0" , + conf => < "ID rule", - subsys => "block", - devpath => "block/sda", - expected => "scsi-0:0:0:0", - conf => < "ID rule", + subsys => "block", + devpath => "block/sda", + exp_name => "scsi-0:0:0:0", + conf => < "ID wildcard all", - subsys => "block", - devpath => "block/sda", - expected => "scsi-0:0:0:0", - conf => < "ID wildcard all", + subsys => "block", + devpath => "block/sda", + exp_name => "scsi-0:0:0:0", + conf => < "ID wildcard partial", - subsys => "block", - devpath => "block/sda", - expected => "scsi-0:0:0:0", - conf => < "ID wildcard partial", + subsys => "block", + devpath => "block/sda", + exp_name => "scsi-0:0:0:0", + conf => < "ID wildcard partial 2", - subsys => "block", - devpath => "block/sda", - expected => "scsi-0:0:0:0", - conf => < "ID wildcard partial 2", + subsys => "block", + devpath => "block/sda", + exp_name => "scsi-0:0:0:0", + conf => < "ignore SYSFS attribute whitespace", - subsys => "block", - devpath => "block/sda", - expected => "ignored", - conf => < "ignore SYSFS attribute whitespace", + subsys => "block", + devpath => "block/sda", + exp_name => "ignored", + conf => < "do not ignore SYSFS attribute whitespace", - subsys => "block", - devpath => "block/sda", - expected => "matched-with-space", - conf => < "do not ignore SYSFS attribute whitespace", + subsys => "block", + devpath => "block/sda", + exp_name => "matched-with-space", + conf => < "SYMLINK only rule", - subsys => "block", - devpath => "block/sda", - expected => "symlink-only2", - conf => < "SYMLINK only rule", + subsys => "block", + devpath => "block/sda", + exp_name => "symlink-only2", + conf => < "permissions test", - subsys => "block", - devpath => "block/sda", - expected => "node", - perms => "5000::0444", - conf => < "permissions test", + subsys => "block", + devpath => "block/sda", + exp_name => "node", + perms => "5000::0444", + conf => < "major/minor number test", + subsys => "block", + devpath => "block/sda", + exp_name => "node", + perms => "5000::0444", + exp_majorminor => "8:0", + conf => <{desc}\n"; - print "device \'$config->{devpath}\' expecting node \'$config->{expected}\'\n"; + print "device \'$config->{devpath}\' expecting node \'$config->{exp_name}\'\n"; udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); - if (-e "$PWD/$udev_root$config->{expected}") { + if (-e "$PWD/$udev_root$config->{exp_name}") { + + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$config->{exp_name}"); + if (defined($config->{perms})) { my $wrong = 0; - my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, - $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$config->{expected}"); - $config->{perms} =~ m/^(.*):(.*):(.*)$/; if ($1 ne "") { if ($uid != $1) { $wrong = 1; }; @@ -586,6 +598,25 @@ sub run_test { printf "created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; } } + + if (defined($config->{exp_majorminor})) { + my $major = ($rdev >> 8) & 0xfff; + my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); + + my $wrong = 0; + $config->{exp_majorminor} =~ m/^(.*):(.*)$/; + if ($1 ne "") { + if ($major != $1) { $wrong = 1; }; + } + if ($2 ne "") { + if ($minor != $2) { $wrong = 1; }; + } + if ($wrong == 1) { + printf "expected major:minor is: %i:%i\n", $1, $2; + printf "created major:minor is : %i:%i\n", $major, $minor; + } + } + print "add: ok "; } else { print "add: error\n"; @@ -595,8 +626,8 @@ sub run_test { } udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf}); - if ((-e "$PWD/$udev_root$config->{expected}") || - (-l "$PWD/$udev_root$config->{expected}")) { + if ((-e "$PWD/$udev_root$config->{exp_name}") || + (-l "$PWD/$udev_root$config->{exp_name}")) { print "remove: error\n\n"; system("tree $udev_root"); $error++; -- cgit v1.2.3-54-g00ecf From b9a88fe756d20ea13b8f6da87c784d8aac9c4538 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 12 Mar 2004 17:19:50 -0800 Subject: [PATCH] make perm and major:minor test errors be reported properly. --- test/udev-test.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index fc682b528a..e5407364bb 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -596,6 +596,7 @@ sub run_test { if ($wrong == 1) { printf "expected permissions are: %i:%i:%#o\n", $1, $2, oct($3); printf "created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; + $error++; } } @@ -614,6 +615,7 @@ sub run_test { if ($wrong == 1) { printf "expected major:minor is: %i:%i\n", $1, $2; printf "created major:minor is : %i:%i\n", $major, $minor; + $error++; } } -- cgit v1.2.3-54-g00ecf From 7ddb6f47d70ea7a5881d1f2fa6ed856d2cbe0090 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 12 Mar 2004 17:27:44 -0800 Subject: [PATCH] udev-test.pl: print out major:minor and perm test "ok" if is ok. --- test/udev-test.pl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index e5407364bb..300d822d92 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -539,10 +539,9 @@ EOF subsys => "block", devpath => "block/sda", exp_name => "node", - perms => "5000::0444", exp_majorminor => "8:0", conf => < Date: Fri, 12 Mar 2004 17:39:59 -0800 Subject: [PATCH] add a test for a minor over 255 --- test/sys/class/i2c-dev/i2c-300/dev | 1 + test/sys/class/i2c-dev/i2c-300/name | 1 + test/udev-test.pl | 10 ++++++++++ 3 files changed, 12 insertions(+) create mode 100644 test/sys/class/i2c-dev/i2c-300/dev create mode 100644 test/sys/class/i2c-dev/i2c-300/name diff --git a/test/sys/class/i2c-dev/i2c-300/dev b/test/sys/class/i2c-dev/i2c-300/dev new file mode 100644 index 0000000000..e1ffb89f95 --- /dev/null +++ b/test/sys/class/i2c-dev/i2c-300/dev @@ -0,0 +1 @@ +89:300 diff --git a/test/sys/class/i2c-dev/i2c-300/name b/test/sys/class/i2c-dev/i2c-300/name new file mode 100644 index 0000000000..9357009701 --- /dev/null +++ b/test/sys/class/i2c-dev/i2c-300/name @@ -0,0 +1 @@ +foo dev diff --git a/test/udev-test.pl b/test/udev-test.pl index 300d822d92..407ecd3b5b 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -542,6 +542,16 @@ EOF exp_majorminor => "8:0", conf => < "big minor number test", + subsys => "i2c-dev", + devpath => "class/i2c-dev/i2c-300", + exp_name => "node", + exp_majorminor => "89:300", + conf => < Date: Fri, 12 Mar 2004 18:00:39 -0800 Subject: [PATCH] add big major tests to udev-test.pl --- test/sys/class/i2c-dev/i2c-fake1/dev | 1 + test/sys/class/i2c-dev/i2c-fake1/name | 1 + test/sys/class/i2c-dev/i2c-fake2/dev | 1 + test/sys/class/i2c-dev/i2c-fake2/name | 1 + test/udev-test.pl | 20 ++++++++++++++++++++ 5 files changed, 24 insertions(+) create mode 100644 test/sys/class/i2c-dev/i2c-fake1/dev create mode 100644 test/sys/class/i2c-dev/i2c-fake1/name create mode 100644 test/sys/class/i2c-dev/i2c-fake2/dev create mode 100644 test/sys/class/i2c-dev/i2c-fake2/name diff --git a/test/sys/class/i2c-dev/i2c-fake1/dev b/test/sys/class/i2c-dev/i2c-fake1/dev new file mode 100644 index 0000000000..ab453138aa --- /dev/null +++ b/test/sys/class/i2c-dev/i2c-fake1/dev @@ -0,0 +1 @@ +4095:1 diff --git a/test/sys/class/i2c-dev/i2c-fake1/name b/test/sys/class/i2c-dev/i2c-fake1/name new file mode 100644 index 0000000000..ced44c39d4 --- /dev/null +++ b/test/sys/class/i2c-dev/i2c-fake1/name @@ -0,0 +1 @@ +fake1 dev diff --git a/test/sys/class/i2c-dev/i2c-fake2/dev b/test/sys/class/i2c-dev/i2c-fake2/dev new file mode 100644 index 0000000000..d2425b701a --- /dev/null +++ b/test/sys/class/i2c-dev/i2c-fake2/dev @@ -0,0 +1 @@ +4094:89999 diff --git a/test/sys/class/i2c-dev/i2c-fake2/name b/test/sys/class/i2c-dev/i2c-fake2/name new file mode 100644 index 0000000000..b69deec2bf --- /dev/null +++ b/test/sys/class/i2c-dev/i2c-fake2/name @@ -0,0 +1 @@ +fake2 dev diff --git a/test/udev-test.pl b/test/udev-test.pl index 407ecd3b5b..0f623be0d3 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -552,6 +552,26 @@ EOF exp_majorminor => "89:300", conf => < "big major number test", + subsys => "i2c-dev", + devpath => "class/i2c-dev/i2c-fake1", + exp_name => "node", + exp_majorminor => "4095:1", + conf => < "big major and big minor number test", + subsys => "i2c-dev", + devpath => "class/i2c-dev/i2c-fake2", + exp_name => "node", + exp_majorminor => "4094:89999", + conf => < Date: Fri, 12 Mar 2004 18:18:58 -0800 Subject: [PATCH] udev-test.pl cleanup Here is a small name change, so all expected values are named exp_* --- test/udev-test.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 0f623be0d3..d93ebb9cc3 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -36,7 +36,7 @@ my @tests = ( desc => "label test of scsi disc", subsys => "block", devpath => "block/sda", - exp_name=> "boot_disk" , + exp_name => "boot_disk" , conf => < "label test of scsi partition", subsys => "block", devpath => "block/sda/sda1", - exp_name=> "boot_disk1" , + exp_name => "boot_disk1" , conf => < "label test of pattern match", subsys => "block", devpath => "block/sda/sda1", - exp_name=> "boot_disk1" , + exp_name => "boot_disk1" , conf => < "block", devpath => "block/sda", exp_name => "node", - perms => "5000::0444", + exp_perms => "5000::0444", conf => <{exp_name}"); - if (defined($config->{perms})) { + if (defined($config->{exp_perms})) { my $wrong = 0; - $config->{perms} =~ m/^(.*):(.*):(.*)$/; + $config->{exp_perms} =~ m/^(.*):(.*):(.*)$/; if ($1 ne "") { if ($uid != $1) { $wrong = 1; }; } -- cgit v1.2.3-54-g00ecf From b1224bc0da0328c44ed8816bb0cf28e7343bab86 Mon Sep 17 00:00:00 2001 From: "async@cc.gatech.edu" Date: Fri, 12 Mar 2004 23:52:17 -0800 Subject: [PATCH] fix HOWTO-udev_for_dev for udevdir --- HOWTO-udev_for_dev | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/HOWTO-udev_for_dev b/HOWTO-udev_for_dev index a6d0892e37..58bf2d4e8c 100644 --- a/HOWTO-udev_for_dev +++ b/HOWTO-udev_for_dev @@ -38,9 +38,11 @@ NOTE NOTE NOTE NOTE NOTE NOTE NOTE I did this with the latest Fedora startup scripts with the patch at the end of this file. - - make sure the /etc/udev/udev.conf file lists the udev_root as /dev. - It should contain the following line in order to work properly. + - make sure the /etc/udev/udev.conf file lists the udev_root as "/dev/" + and the udev_db as "/dev/.udev.tdb". It should contain the + following lines in order to work properly. udev_root="/dev/" + udev_db="/dev/.udev.tdb" - reboot into a 2.6 kernel and watch udev create all of the initial device nodes in /dev -- cgit v1.2.3-54-g00ecf From 2761f9b951057c3ed0aaac73f5e003b0d23805f9 Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Fri, 12 Mar 2004 23:52:21 -0800 Subject: [PATCH] make spotless klibc has a target make spotless, this patch makes it possible to clean the whole udev tree and start from scratch. --- Makefile | 2 ++ extras/multipath-tools/Makefile | 2 ++ extras/multipath-tools/devmap_name/Makefile | 2 ++ extras/multipath-tools/libdevmapper/Makefile | 2 ++ extras/multipath-tools/multipath/Makefile | 2 ++ extras/multipath-tools/multipathd/Makefile | 1 + extras/scsi_id/Makefile | 1 + tdb/Makefile | 2 ++ 8 files changed, 14 insertions(+) diff --git a/Makefile b/Makefile index 23aef06666..2c9472a0bb 100644 --- a/Makefile +++ b/Makefile @@ -305,6 +305,8 @@ clean: -C $$target $@ ; \ done ; \ +spotless: clean + DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz$" -e "\/\." -e releases -e BitKeeper -e SCCS -e "\.tdb$" -e test/sys | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . diff --git a/extras/multipath-tools/Makefile b/extras/multipath-tools/Makefile index 2f21f0d112..fa8830082b 100644 --- a/extras/multipath-tools/Makefile +++ b/extras/multipath-tools/Makefile @@ -32,6 +32,8 @@ clean: recurse_clean @echo "" @echo "Make complete" +spotless: clean + install: recurse_install @echo "" @echo "Make complete" diff --git a/extras/multipath-tools/devmap_name/Makefile b/extras/multipath-tools/devmap_name/Makefile index a9683341b2..e3b70a5e0d 100644 --- a/extras/multipath-tools/devmap_name/Makefile +++ b/extras/multipath-tools/devmap_name/Makefile @@ -36,6 +36,8 @@ $(EXEC): $(OBJS) clean: rm -f core *.o $(EXEC) *.gz +spotless: clean + install: install -d $(DESTDIR)$(bindir) install -m 755 $(EXEC) $(DESTDIR)$(bindir)/ diff --git a/extras/multipath-tools/libdevmapper/Makefile b/extras/multipath-tools/libdevmapper/Makefile index 445263caa8..4a8b7723fa 100644 --- a/extras/multipath-tools/libdevmapper/Makefile +++ b/extras/multipath-tools/libdevmapper/Makefile @@ -23,6 +23,8 @@ all: $(OBJS) clean: rm -f core *.o ioctl/*.o ioctl/*.so +spotless: clean + install: uninstall: diff --git a/extras/multipath-tools/multipath/Makefile b/extras/multipath-tools/multipath/Makefile index 4121f4fc3b..4c0fae6d32 100644 --- a/extras/multipath-tools/multipath/Makefile +++ b/extras/multipath-tools/multipath/Makefile @@ -43,6 +43,8 @@ $(EXEC): $(OBJS) clean: rm -f core *.o $(EXEC) *.gz +spotless: clean + install: install -d $(DESTDIR)$(bindir) install -m 755 $(EXEC) $(DESTDIR)$(bindir)/ diff --git a/extras/multipath-tools/multipathd/Makefile b/extras/multipath-tools/multipathd/Makefile index 5bfd58a837..82c77b8351 100644 --- a/extras/multipath-tools/multipathd/Makefile +++ b/extras/multipath-tools/multipathd/Makefile @@ -29,3 +29,4 @@ uninstall: clean: rm -f core *.o $(EXEC) *.gz +spotless: clean diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index bfc2923b34..6af4d7f18e 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -70,5 +70,6 @@ $(OBJS): scsi_id.h scsi.h scsi_id_version.h clean: rm -f $(PROG) $(OBJS) $(GEN_HEADER) +spotless: clean $(PROG): $(OBJS) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) diff --git a/tdb/Makefile b/tdb/Makefile index 021cb35c95..87fb680bdd 100644 --- a/tdb/Makefile +++ b/tdb/Makefile @@ -28,3 +28,5 @@ tdbbackup: tdbbackup.o $(TDB_OBJ) clean: rm -f $(PROGS) *.o *~ *% core test.db test.tdb test.gdbm + +spotless: clean -- cgit v1.2.3-54-g00ecf From b99c85e440193eb7f7dd84e473cafb16cb75722f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 12 Mar 2004 23:53:38 -0800 Subject: [PATCH] 022 release --- ChangeLog | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 515450ac6a..b78b0b9bbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,61 @@ +Summary of changes from v021 to v022 +============================================ + +: + o more Libsysfs updates + o Libsysfs updates + +: + o fix HOWTO-udev_for_dev for udevdir + +: + o udev-test.pl cleanup + o add dev node test to udev-test.pl + o add permission tests + o "symlink only" test + o callout part selector tweak + o cleanup callout fork + o allow to specify node permissions in the rule + o man page beauty + o put symlink only rules to the man page + o rename strn*() macros to strmax + o conditional remove of trailing sysfs whitespace + o clarify udevinfo text + o better fix for NAME="foo-%c{N}" gets a truncated name + o overall trivial trivial cleanup + o fix NAME="foo-%c{N}" gets a truncated name + o cleanup mult field string handling + +: + o fix a type in docs/libsysfs.txt + o Added line to udev.permissions.redhat + o Include more examples in the docs area for gentoo and redhat + +: + o udevstart fixes + +Greg Kroah-Hartman: + o add big major tests to udev-test.pl + o add a test for a minor over 255 + o udev-test.pl: print out major:minor and perm test "ok" if is ok + o make perm and major:minor test errors be reported properly + o remove extra ; in namedev_parse.c + o Added multipath-tools 0.1.1 release + o deleted current extras/multipath directory + o 021_bk mark + o fix the build for older versions of gcc + o 021 release TAG: v021 + +Hanna V. Linder: + o Small fix to remove extra "will" in man page + +Olaf Hering: + o make spotless + o udev* segfaults with new klibc + +Patrick Mansfield: + o add tests for NAME="foo-%c{N}" + Summary of changes from v020 to v021 ============================================ diff --git a/Makefile b/Makefile index 2c9472a0bb..612911c441 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 021_bk +VERSION = 022 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 34e0755fda..7de035c86e 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 021_bk +Version: 022 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 8a0acf85f25d2fb4659aafbad7db2fe48a58307d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 22 Mar 2004 22:18:34 -0800 Subject: [PATCH] make udevtest a real program :) Here are the missing pieces for udevtest. A simple man page is added, the blacklist is removed, cause it can't work without having a subsystem. The Makefile removes all manpages now with a uninstall and installs udevtest in /usr/bin/. Any old version from /sbin/ should be deleted by hand. The only expected argument is the sysfs devpath, here I changed it to be more tolerant to the input. The path may now be specified with or without a leading slash and optionally with the /sys moutpoint prepended. I hope this will end the confusion about the use of this program :) --- Makefile | 7 +++++- udevtest.8 | 17 +++++++++++++ udevtest.c | 83 +++++++++++++++++++++++++------------------------------------- 3 files changed, 56 insertions(+), 51 deletions(-) create mode 100644 udevtest.8 diff --git a/Makefile b/Makefile index 612911c441..000918573e 100644 --- a/Makefile +++ b/Makefile @@ -382,10 +382,11 @@ install: install-initscript install-config install-dbus-policy all $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) - $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(sbindir)/$(TESTER) + $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 + $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 $(INSTALL_DATA) -D udevstart.8 $(DESTDIR)$(mandir)/man8/udevstart.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 @@ -408,6 +409,10 @@ uninstall: uninstall-dbus-policy - rm $(initdir)/udev - rm $(mandir)/man8/udev.8 - rm $(mandir)/man8/udevinfo.8 + - rm $(mandir)/man8/udevtest.8 + - rm $(mandir)/man8/udevstart.8 + - rm $(mandir)/man8/udevd.8 + - rm $(mandir)/man8/udevsend.8 - rm $(sbindir)/$(ROOT) - rm $(sbindir)/$(DAEMON) - rm $(sbindir)/$(SENDER) diff --git a/udevtest.8 b/udevtest.8 new file mode 100644 index 0000000000..f23e219244 --- /dev/null +++ b/udevtest.8 @@ -0,0 +1,17 @@ +.TH UDEVTEST 8 "March 2004" "" "Linux Administrator's Manual" +.SH NAME +udevtest \- simulates a udev run to test the configured rules +.SH SYNOPSIS +.BI udevtest " sysfs_device_path" +.SH "DESCRIPTION" +.B udevtest +simulates a +.B udev +run for the given device, and prints out the node names +for the given device, the real udev would have created. +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevtest +was developed by Greg Kroah-Hartman with much help +from others. diff --git a/udevtest.c b/udevtest.c index e67d452577..95b85dd8be 100644 --- a/udevtest.c +++ b/udevtest.c @@ -37,6 +37,7 @@ char **main_argv; char **main_envp; + #ifdef LOG unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) @@ -51,72 +52,54 @@ void log_message (int level, const char *format, ...) } #endif -static char *subsystem_blacklist[] = { - "net", - "scsi_host", - "scsi_device", - "usb_host", - "pci_bus", - "pcmcia_socket", - "" -}; - -static int udev_hotplug(void) +int main(int argc, char *argv[], char *envp[]) { char *devpath; - char *subsystem; - int retval = -EINVAL; - int i; + char temp[NAME_SIZE]; + char subsystem[] = ""; + const int fake = 1; + + main_argv = argv; + main_envp = envp; + + info("version %s", UDEV_VERSION); - devpath = main_argv[1]; - if (!devpath) { - dbg("no devpath?"); + if (argv[1] == NULL) { + info("udevinfo expects the DEVPATH of the sysfs device as a argument"); goto exit; } - dbg("looking at '%s'", devpath); + + /* initialize our configuration */ + udev_init_config(); + + /* remove sysfs_path if given */ + if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) + devpath = argv[1] + strlen(sysfs_path); + else + if (argv[1][0] != '/') { + /* prepend '/' if missing */ + strfieldcpy(temp, "/"); + strfieldcat(temp, argv[1]); + devpath = temp; + } else { + devpath = argv[1]; + } + + info("looking at '%s'", devpath); /* we only care about class devices and block stuff */ if (!strstr(devpath, "class") && !strstr(devpath, "block")) { - dbg("not a block or class device"); + info("not a block or class device"); goto exit; } - /* skip blacklisted subsystems */ - subsystem = main_argv[1]; - i = 0; - while (subsystem_blacklist[i][0] != '\0') { - if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { - dbg("don't care about '%s' devices", subsystem); - goto exit; - } - i++; - } - - /* initialize our configuration */ - udev_init_config(); - /* initialize the naming deamon */ namedev_init(); /* simulate node creation with fake flag */ - retval = udev_add_device(devpath, subsystem, 1); + udev_add_device(devpath, subsystem, fake); exit: - if (retval > 0) - retval = 0; - - return -retval; -} - -int main(int argc, char *argv[], char *envp[]) -{ - main_argv = argv; - main_envp = envp; - - dbg("version %s", UDEV_VERSION); - - return udev_hotplug(); + return 0; } - - -- cgit v1.2.3-54-g00ecf From c58286656e8bd4285e35a1cf12906416dd259aab Mon Sep 17 00:00:00 2001 From: "tytso@mit.edu" Date: Mon, 22 Mar 2004 22:19:37 -0800 Subject: [PATCH] Trivial man page typo fixes to udev Fix minor man page typo's. --- udev.8 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev.8 b/udev.8 index b367d39813..417b74bdc5 100644 --- a/udev.8 +++ b/udev.8 @@ -149,13 +149,13 @@ value in the file. .P Every line in the rules file defines the mapping between device attributes -and the device file name. One ore more keys are specified to match a rule +and the device file name. One or more keys are specified to match a rule with the current device. If all keys are matching, the rule will be applied and the name is used for the device node. .br If no matching rule is found, the default kernel device name is used. .P -Every rule consists of a list a comma separated fields: +Every rule consists of a list of comma separated fields: .sp .IR "key " ,[ "key " ,...] " name " [, " symlink" ] .sp @@ -252,7 +252,7 @@ The string returned from the execution of field for the obvious reason.) .br A single part of the string, separated by a space character -may be selected by specifying the part number as a attribute: +may be selected by specifying the part number as an attribute: .BI %c{ N } If the number is followed by the + char this part plus all remaining parts of the result string are substituted: -- cgit v1.2.3-54-g00ecf From c81b35c08bbd7789883993ea280e0d3772cce440 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 22 Mar 2004 22:22:20 -0800 Subject: [PATCH] replace fgets() with mmap() and introduce udev_lib.[hc] Here we replace the various fgets() with a mmap() call for the config file reading, due to the reported performance problems with klibc. Thanks to Patrick's testing, it makes a very small, close to nothing speed gain for libc users, but a 6 times speed increase for klibc users with a 1000 line config file. I've created a udev_lib.[hc] for this and also moved all the generic stuff from udev.h in there and uninlined the functions. --- Makefile | 8 ++-- klibc_fixups.c | 30 +++++++++++---- namedev.c | 1 + namedev_parse.c | 56 ++++++++++++++++++---------- udev-add.c | 1 + udev-remove.c | 1 + udev.c | 6 ++- udev.h | 104 +++++----------------------------------------------- udev_config.c | 32 ++++++++++------ udev_lib.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev_lib.h | 78 +++++++++++++++++++++++++++++++++++++++ udevd.c | 1 + udevdb.c | 9 ++--- udevinfo.c | 1 + udevsend.c | 1 + 15 files changed, 298 insertions(+), 142 deletions(-) create mode 100644 udev_lib.c create mode 100644 udev_lib.h diff --git a/Makefile b/Makefile index 000918573e..0604c1fa07 100644 --- a/Makefile +++ b/Makefile @@ -201,7 +201,8 @@ SYSFS = $(PWD)/libsysfs/sysfs_bus.o \ $(PWD)/libsysfs/sysfs_utils.o \ $(PWD)/libsysfs/dlist.o -OBJS = udev_config.o \ +OBJS = udev_lib.o \ + udev_config.o \ udev-add.o \ udev-remove.o \ udevdb.o \ @@ -211,6 +212,7 @@ OBJS = udev_config.o \ $(TDB) HEADERS = udev.h \ + udev_lib.h \ namedev.h \ udev_version.h \ udev_dbus.h \ @@ -279,7 +281,7 @@ $(TESTER): $(TESTER).o $(OBJS) $(HEADERS) $(LIBC) $(STRIPCMD) $@ $(INFO): $(INFO).o $(OBJS) $(HEADERS) $(LIBC) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ $(DAEMON): $(DAEMON).o udevd.h $(LIBC) @@ -287,7 +289,7 @@ $(DAEMON): $(DAEMON).o udevd.h $(LIBC) $(STRIPCMD) $@ $(SENDER): $(SENDER).o udevd.h $(LIBC) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ $(STARTER): $(STARTER).o $(HEADERS) $(LIBC) diff --git a/klibc_fixups.c b/klibc_fixups.c index 99460c32f7..eaa240c183 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -28,6 +28,7 @@ #include #include +#include "udev.h" #include "klibc_fixups.h" #include "logging.h" @@ -40,22 +41,35 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) { unsigned long id = -1; - FILE *file; - char buf[255]; + char line[255]; + char *buf; + size_t bufsize; + size_t cur; + size_t count; char *pos; char *name; char *idstr; char *tail; - file = fopen(dbfile, "r"); - if (file == NULL) { - dbg("unable to open file '%s'", dbfile); + if (file_map(dbfile, &buf, &bufsize) == 0) { + dbg("reading '%s' as db file", dbfile); + } else { + dbg("can't open '%s' as db file", dbfile); return -1; } + /* loop through the whole file */ + + cur = 0; while (1) { - pos = fgets(buf, sizeof(buf), file); - if (pos == NULL) + count = buf_get_line(buf, bufsize, cur); + + strncpy(line, buf + cur, count); + line[count] = '\0'; + pos = line; + + cur += count+1; + if (cur > bufsize) break; /* get name */ @@ -82,7 +96,7 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) } } - fclose(file); + file_unmap(buf, bufsize); return id; } diff --git a/namedev.c b/namedev.c index 025a14aea4..8f781a66e2 100644 --- a/namedev.c +++ b/namedev.c @@ -36,6 +36,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "list.h" #include "udev.h" +#include "udev_lib.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" diff --git a/namedev_parse.c b/namedev_parse.c index 8198f7e684..f4ffdb21d6 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -38,6 +37,7 @@ #include #include "udev.h" +#include "udev_lib.h" #include "logging.h" #include "namedev.h" @@ -153,27 +153,36 @@ static int namedev_parse_rules(char *filename) char *temp2; char *temp3; char *attr; - FILE *fd; + char *buf; + size_t bufsize; + size_t cur; + size_t count; int program_given = 0; int retval = 0; struct config_device dev; - fd = fopen(filename, "r"); - if (fd != NULL) { + if (file_map(filename, &buf, &bufsize) == 0) { dbg("reading '%s' as rules file", filename); } else { - dbg("can't open '%s' as a rules file", filename); - return -ENODEV; + dbg("can't open '%s' as rules file", filename); + return -1; } /* loop through the whole file */ + cur = 0; lineno = 0; while (1) { - /* get a line */ - temp = fgets(line, sizeof(line), fd); - if (temp == NULL) - goto exit; + count = buf_get_line(buf, bufsize, cur); + + strncpy(line, buf + cur, count); + line[count] = '\0'; + temp = line; lineno++; + + cur += count+1; + if (cur > bufsize) + break; + dbg_parse("read '%s'", temp); /* eat the whitespace */ @@ -311,8 +320,8 @@ error: filename, lineno, temp - line); } } -exit: - fclose(fd); + + file_unmap(buf, bufsize); return retval; } @@ -321,22 +330,31 @@ static int namedev_parse_permissions(char *filename) char line[255]; char *temp; char *temp2; - FILE *fd; + char *buf; + size_t bufsize; + size_t cur; + size_t count; int retval = 0; struct perm_device dev; - fd = fopen(filename, "r"); - if (fd != NULL) { + if (file_map(filename, &buf, &bufsize) == 0) { dbg("reading '%s' as permissions file", filename); } else { dbg("can't open '%s' as permissions file", filename); - return -ENODEV; + return -1; } /* loop through the whole file */ + cur = 0; while (1) { - temp = fgets(line, sizeof(line), fd); - if (temp == NULL) + count = buf_get_line(buf, bufsize, cur); + + strncpy(line, buf + cur, count); + line[count] = '\0'; + temp = line; + + cur += count+1; + if (cur > bufsize) break; dbg_parse("read '%s'", temp); @@ -394,7 +412,7 @@ static int namedev_parse_permissions(char *filename) } exit: - fclose(fd); + file_unmap(buf, bufsize); return retval; } diff --git a/udev-add.c b/udev-add.c index ce723e45cc..2bd16014f5 100644 --- a/udev-add.c +++ b/udev-add.c @@ -37,6 +37,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" +#include "udev_lib.h" #include "udev_version.h" #include "udev_dbus.h" #include "udev_selinux.h" diff --git a/udev-remove.c b/udev-remove.c index 44ad603d4a..d909713450 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -29,6 +29,7 @@ #include #include "udev.h" +#include "udev_lib.h" #include "udev_version.h" #include "udev_dbus.h" #include "logging.h" diff --git a/udev.c b/udev.c index 9b4d91f75c..d10badc8ea 100644 --- a/udev.c +++ b/udev.c @@ -20,15 +20,17 @@ * */ +#include +#include #include #include -#include -#include #include +#include #include #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" +#include "udev_lib.h" #include "udev_version.h" #include "udev_dbus.h" #include "logging.h" diff --git a/udev.h b/udev.h index 8752f595d6..54269dfd31 100644 --- a/udev.h +++ b/udev.h @@ -20,25 +20,22 @@ * */ -#ifndef UDEV_H -#define UDEV_H +#ifndef _UDEV_H_ +#define _UDEV_H_ -#include -#include -#include -#include #include +#include "libsysfs/sysfs/libsysfs.h" #define COMMENT_CHARACTER '#' -#define NAME_SIZE 100 -#define OWNER_SIZE 30 -#define GROUP_SIZE 30 -#define MODE_SIZE 8 +#define NAME_SIZE 100 +#define OWNER_SIZE 30 +#define GROUP_SIZE 30 +#define MODE_SIZE 8 -#define ACTION_SIZE 30 -#define DEVPATH_SIZE 255 -#define SUBSYSTEM_SIZE 30 +#define ACTION_SIZE 30 +#define DEVPATH_SIZE 255 +#define SUBSYSTEM_SIZE 30 /* length of public data */ #define UDEVICE_LEN (offsetof(struct udevice, bus_id)) @@ -61,87 +58,6 @@ struct udevice { char kernel_name[NAME_SIZE]; }; -#define strfieldcpy(to, from) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - strncpy(to, from, sizeof(to)-1); \ -} while (0) - -#define strfieldcat(to, from) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - strncat(to, from, sizeof(to) - strlen(to)-1); \ -} while (0) - -#define strfieldcpymax(to, from, maxsize) \ -do { \ - to[maxsize-1] = '\0'; \ - strncpy(to, from, maxsize-1); \ -} while (0) - -#define strfieldcatmax(to, from, maxsize) \ -do { \ - to[maxsize-1] = '\0'; \ - strncat(to, from, maxsize - strlen(to)-1); \ -} while (0) - -#define strintcat(to, i) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%u", i); \ -} while (0) - -#define strintcatmax(to, i, maxsize) \ -do { \ - to[maxsize-1] = '\0'; \ - snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ -} while (0) - -#define foreach_strpart(str, separator, pos, len) \ - for(pos = str, len = 0; \ - (pos) < ((str) + strlen(str)); \ - pos = pos + len + strspn(pos, separator), len = strcspn(pos, separator)) \ - if (len > 0) - -static inline char *get_action(void) -{ - char *action; - - action = getenv("ACTION"); - if (action != NULL && strlen(action) > ACTION_SIZE) - action[ACTION_SIZE-1] = '\0'; - - return action; -} - -static inline char *get_devpath(void) -{ - char *devpath; - - devpath = getenv("DEVPATH"); - if (devpath != NULL && strlen(devpath) > DEVPATH_SIZE) - devpath[DEVPATH_SIZE-1] = '\0'; - - return devpath; -} - -static inline char *get_seqnum(void) -{ - char *seqnum; - - seqnum = getenv("SEQNUM"); - - return seqnum; -} - -static inline char *get_subsystem(char *subsystem) -{ - if (subsystem != NULL && strlen(subsystem) > SUBSYSTEM_SIZE) - subsystem[SUBSYSTEM_SIZE-1] = '\0'; - - return subsystem; -} - extern int udev_add_device(char *path, char *subsystem, int fake); extern int udev_remove_device(char *path, char *subsystem); extern void udev_init_config(void); diff --git a/udev_config.c b/udev_config.c index e2031dc64d..57a512d711 100644 --- a/udev_config.c +++ b/udev_config.c @@ -34,6 +34,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" +#include "udev_lib.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" @@ -131,12 +132,14 @@ static int parse_config_file(void) char *temp; char *variable; char *value; - FILE *fd; - int lineno = 0; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + int lineno; int retval = 0; - - fd = fopen(udev_config_filename, "r"); - if (fd != NULL) { + + if (file_map(udev_config_filename, &buf, &bufsize) == 0) { dbg("reading '%s' as config file", udev_config_filename); } else { dbg("can't open '%s' as config file", udev_config_filename); @@ -144,13 +147,20 @@ static int parse_config_file(void) } /* loop through the whole file */ + lineno = 0; + cur = 0; while (1) { - /* get a line */ - temp = fgets(line, sizeof(line), fd); - if (temp == NULL) - goto exit; + count = buf_get_line(buf, bufsize, cur); + + strncpy(line, buf + cur, count); + line[count] = '\0'; + temp = line; lineno++; + cur += count+1; + if (cur > bufsize) + break; + dbg_parse("read '%s'", temp); /* eat the whitespace at the beginning of the line */ @@ -182,8 +192,8 @@ static int parse_config_file(void) } dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, lineno, temp - line, temp); -exit: - fclose(fd); + + file_unmap(buf, bufsize); return retval; } diff --git a/udev_lib.c b/udev_lib.c new file mode 100644 index 0000000000..50598a4a31 --- /dev/null +++ b/udev_lib.c @@ -0,0 +1,111 @@ +/* + * udev_lib - generic stuff used by udev + * + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include + +#include "libsysfs/sysfs/libsysfs.h" +#include "udev.h" +#include "udev_lib.h" + + +char *get_action(void) +{ + char *action; + + action = getenv("ACTION"); + if (action != NULL && strlen(action) > ACTION_SIZE) + action[ACTION_SIZE-1] = '\0'; + + return action; +} + +char *get_devpath(void) +{ + char *devpath; + + devpath = getenv("DEVPATH"); + if (devpath != NULL && strlen(devpath) > DEVPATH_SIZE) + devpath[DEVPATH_SIZE-1] = '\0'; + + return devpath; +} + +char *get_seqnum(void) +{ + char *seqnum; + + seqnum = getenv("SEQNUM"); + + return seqnum; +} + +char *get_subsystem(char *subsystem) +{ + if (subsystem != NULL && strlen(subsystem) > SUBSYSTEM_SIZE) + subsystem[SUBSYSTEM_SIZE-1] = '\0'; + + return subsystem; +} + +int file_map(const char *filename, char **buf, size_t *bufsize) +{ + struct stat stats; + int fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) { + return -1; + } + + if (fstat(fd, &stats) < 0) { + return -1; + } + + *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); + if (*buf == MAP_FAILED) { + return -1; + } + *bufsize = stats.st_size; + + close(fd); + + return 0; +} + +void file_unmap(char *buf, size_t bufsize) +{ + munmap(buf, bufsize); +} + +size_t buf_get_line(char *buf, size_t buflen, size_t cur) +{ + size_t count = 0; + + for (count = cur; count < buflen && buf[count] != '\n'; count++); + + return count - cur; +} + diff --git a/udev_lib.h b/udev_lib.h new file mode 100644 index 0000000000..565d87e9a5 --- /dev/null +++ b/udev_lib.h @@ -0,0 +1,78 @@ +/* + * udev_lib - generic stuff used by udev + * + * Copyright (C) 2004 Kay Sievers + * + * + * 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 02139, USA. + * + */ + +#ifndef _UDEV_LIB_H_ +#define _UDEV_LIB_H_ + + +#define strfieldcpy(to, from) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + strncpy(to, from, sizeof(to)-1); \ +} while (0) + +#define strfieldcat(to, from) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + strncat(to, from, sizeof(to) - strlen(to)-1); \ +} while (0) + +#define strfieldcpymax(to, from, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + strncpy(to, from, maxsize-1); \ +} while (0) + +#define strfieldcatmax(to, from, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + strncat(to, from, maxsize - strlen(to)-1); \ +} while (0) + +#define strintcat(to, i) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%u", i); \ +} while (0) + +#define strintcatmax(to, i, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ +} while (0) + +#define foreach_strpart(str, separator, pos, len) \ + for(pos = str, len = 0; \ + (pos) < ((str) + strlen(str)); \ + pos = pos + len + strspn(pos, separator), len = strcspn(pos, separator)) \ + if (len > 0) + + +extern char *get_action(void); +extern char *get_devpath(void); +extern char *get_seqnum(void); +extern char *get_subsystem(char *subsystem); +extern int file_map(const char *filename, char **buf, size_t *bufsize); +extern void file_unmap(char *buf, size_t bufsize); +extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); + + +#endif diff --git a/udevd.c b/udevd.c index efcb65bb53..4cb3e1d405 100644 --- a/udevd.c +++ b/udevd.c @@ -36,6 +36,7 @@ #include "list.h" #include "udev.h" +#include "udev_lib.h" #include "udev_version.h" #include "udevd.h" #include "logging.h" diff --git a/udevdb.c b/udevdb.c index 01df3ba7e1..40580e5a3b 100644 --- a/udevdb.c +++ b/udevdb.c @@ -1,5 +1,5 @@ /* - * udevdb.c + * udevdb.c - udev database library * * Userspace devfs * @@ -21,13 +21,11 @@ * */ -/* - * udev database library - */ #define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #include #include +#include #include #include #include @@ -35,8 +33,9 @@ #include #include "libsysfs/sysfs/libsysfs.h" -#include "udev_version.h" #include "udev.h" +#include "udev_lib.h" +#include "udev_version.h" #include "logging.h" #include "namedev.h" #include "udevdb.h" diff --git a/udevinfo.c b/udevinfo.c index ffc5e31f04..5ad9e64746 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -30,6 +30,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "libsysfs/dlist.h" #include "udev.h" +#include "udev_lib.h" #include "udev_version.h" #include "logging.h" #include "udevdb.h" diff --git a/udevsend.c b/udevsend.c index 11234808d9..f1c46d3367 100644 --- a/udevsend.c +++ b/udevsend.c @@ -36,6 +36,7 @@ #include #include "udev.h" +#include "udev_lib.h" #include "udev_version.h" #include "udevd.h" #include "logging.h" -- cgit v1.2.3-54-g00ecf From 30ccd6a3e128c0c32253f9c70f701cab20a8ebf0 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 22 Mar 2004 22:32:34 -0800 Subject: [PATCH] fix udevtest to build properly after the big udev_lib change. --- udevtest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevtest.c b/udevtest.c index 95b85dd8be..67ae9cc98f 100644 --- a/udevtest.c +++ b/udevtest.c @@ -29,6 +29,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" +#include "udev_lib.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" -- cgit v1.2.3-54-g00ecf From e4c89108001a9af3b8c132111d63980e3a1dcaf4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 22 Mar 2004 22:39:39 -0800 Subject: [PATCH] Increase the name size as requested by Richard Gooch --- udev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.h b/udev.h index 54269dfd31..65cbf42b51 100644 --- a/udev.h +++ b/udev.h @@ -28,7 +28,7 @@ #define COMMENT_CHARACTER '#' -#define NAME_SIZE 100 +#define NAME_SIZE 256 #define OWNER_SIZE 30 #define GROUP_SIZE 30 #define MODE_SIZE 8 -- cgit v1.2.3-54-g00ecf From c641a99c6f7de872c291b7d14568d8e7df447f8b Mon Sep 17 00:00:00 2001 From: "rgooch@ras.ucalgary.ca" Date: Mon, 22 Mar 2004 22:43:07 -0800 Subject: [PATCH] SCSI logical and physical names for udev Hi, Greg. Appended is scsi-devfs.sh, a script for udev to implement devfs-style names for SCSI hard discs, CD-ROM's and generic devices. This has been tested with both hard discs and CD-ROM's. The SCSI generic support should be OK for when there is sysfs/udev support for SCSI generic devices. SCSI tapes are not yet implemented because I don't have one to test with. In addition, this script supports physical names, based on PCI bus location, both longhand (/udev/bus/pci/...) and shorthand (/udev/sd/pci/*). --- extras/scsi-devfs.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 extras/scsi-devfs.sh diff --git a/extras/scsi-devfs.sh b/extras/scsi-devfs.sh new file mode 100644 index 0000000000..30f4553a5b --- /dev/null +++ b/extras/scsi-devfs.sh @@ -0,0 +1,88 @@ +#! /bin/sh +# +# scsi-devfs.sh: udev external PROGRAM script +# +# Copyright 2004 Richard Gooch +# Copyright 2004 Fujitsu Ltd. +# Distributed under the GNU Copyleft version 2.0. +# +# return devfs-names for scsi-devices +# Usage in udev.rules: +# BUS="scsi", KERNEL="sd*", PROGRAM="/etc/udev/scsi-devfs.sh sd %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" +# BUS="scsi", KERNEL="sr*", PROGRAM="/etc/udev/scsi-devfs.sh sr %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" +# BUS="scsi", KERNEL="st*", PROGRAM="/etc/udev/scsi-devfs.sh st %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" +# BUS="scsi", KERNEL="sg*", PROGRAM="/etc/udev/scsi-devfs.sh sg %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" + +# Find out where sysfs is mounted. Exit if not available +sysfs=`fgrep sysfs /proc/mounts | awk '{print $2}'` +if [ "$sysfs" = "" ]; then + echo "sysfs is required" + exit 1 +fi +cd $sysfs/bus/scsi/devices + +case "$1" in + sd) + # Extract partition component + if [ "$3" = "" ]; then + lpart="disc" + spart="" + else + lpart="part$3" + spart="p$3" + fi + ;; + sr) + lpart="cdrom" + spart="" + ;; + st) + # Not supported yet + exit 1 + ;; + sg) + lpart="generic" + spart="" + ;; + *) + exit 1 + ;; +esac + +# Extract SCSI logical address components +scsi_host=`echo $2 | cut -f 1 -d:` +scsi_bus=`echo $2 | cut -f 2 -d:` +scsi_target=`echo $2 | cut -f 3 -d:` +scsi_lun=`echo $2 | cut -f 4 -d:` + +# Generate long and short common name parts +l_com="bus$scsi_bus/target$scsi_target/lun$scsi_lun/$lpart" +s_com="b${scsi_bus}t${scsi_target}u${scsi_lun}$spart" + +# Generate long and short logical names +l_log="scsi/host$scsi_host/$l_com" +s_log="$1/c${scsi_host}${s_com}" + +readlink $2 | fgrep -q pci +if [ "$?" != "0" ]; then + # Not a PCI controller, show logical locations only + echo $l_log $s_log + exit 0 +fi + +# Extract PCI address +tmp=`readlink $2 | sed -e 's@/host.*/.*@@'` +pci_addr=`basename "$tmp"` +pci_domain=`echo $pci_addr | cut -f 1 -d:` +pci_bus=`echo $pci_addr | cut -f 2 -d:` +pci_slot=`echo $pci_addr | tr . : | cut -f 3 -d:` +pci_function=`echo $pci_addr | cut -f 2 -d.` + +# Generate long and short physical names +l_pci="domain$pci_domain/bus$pci_bus/slot$pci_slot/function$pci_function" +l_phy="bus/pci/$l_pci/scsi/$l_com" +s_phy="$1/pci/$pci_addr/$s_com" + +echo $l_phy $s_phy $l_log $s_log + + -- cgit v1.2.3-54-g00ecf From 166612d79decf5e7331a6bb65a60b4873551dfde Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 23 Mar 2004 18:21:45 -0800 Subject: [PATCH] add a question/answer about automounting usb devices to the FAQ. Thanks to bert hubert for the text. --- FAQ | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/FAQ b/FAQ index a3bec17408..28f7552ae3 100644 --- a/FAQ +++ b/FAQ @@ -84,6 +84,20 @@ Q: How will udev handle devices found before init runs? A: udev will be placed in initramfs and run for every device that is found. Work to get this implemented is still underway. +Q: Can I use udev to automount a USB device when I connect it? +A: Technically, yes, but udev is not intended for this. Projects that do + automount hotplugged storage devices are: + * Usb-mount http://users.actrix.co.nz/michael/usbmount.html + * devlabel http://linux.dell.com/projects.shtml#devlabel + + Alternatively, it is easy to add the following to fstab: + /udev/pendrive /pendrive vfat user,noauto 0 0 + + This means that users can access the device with: + $ mount /pendrive + And don't have to be root but will get full permissions on /pendrive. + This works even without udev if /udev/pendrive is replaced by /dev/sda1 + Q: I have other questions about udev, where do I ask them? A: The linux-hotplug-devel mailing list is the proper place for it. The address for it is linux-hotplug-devel@lists.sourceforge.net -- cgit v1.2.3-54-g00ecf From b608ade8e4b3df1f2e798dd460ce8ff4e70eb3d9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Mar 2004 18:24:25 -0800 Subject: [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". --- Makefile | 7 +- namedev.c | 5 + udev.h | 3 + udevinfo.c | 3 + udevruler.c | 503 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 520 insertions(+), 1 deletion(-) create mode 100644 udevruler.c diff --git a/Makefile b/Makefile index 0604c1fa07..3d5288b25d 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart +RULER = udevruler VERSION = 022 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) @@ -296,10 +297,14 @@ $(STARTER): $(STARTER).o $(HEADERS) $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevstart.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ +$(RULER): $(RULER).o $(OBJS) $(HEADERS) $(LIBC) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevruler.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) -lnewt + $(STRIPCMD) $@ + clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) $(RULER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ diff --git a/namedev.c b/namedev.c index 8f781a66e2..e075e20af5 100644 --- a/namedev.c +++ b/namedev.c @@ -840,6 +840,8 @@ found: apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); apply_format(udev, udev->symlink, sizeof(udev->symlink), class_dev, sysfs_device); udev->partitions = dev->partitions; + strfieldcpy(udev->config_file, dev->config_file); + udev->config_line = dev->config_line; done: /* get permissions given in rule */ @@ -862,6 +864,9 @@ done: dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", udev->name, udev->owner, udev->group, udev->mode); + /* store time of action */ + udev->config_time = time(NULL); + return 0; } diff --git a/udev.h b/udev.h index 65cbf42b51..16a212cd2c 100644 --- a/udev.h +++ b/udev.h @@ -50,6 +50,9 @@ struct udevice { unsigned int mode; /* not mode_t due to conflicting definitions in different libcs */ char symlink[NAME_SIZE]; int partitions; + int config_line; + char config_file[NAME_SIZE]; + time_t config_time; /* private data that help us in building strings */ char bus_id[SYSFS_NAME_LEN]; diff --git a/udevinfo.c b/udevinfo.c index 5ad9e64746..dc3f94fffe 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -112,6 +112,9 @@ static int print_record(char *path, struct udevice *dev) printf("S: %s\n", dev->symlink); printf("O: %s\n", dev->owner); printf("G: %s\n", dev->group); + printf("F: %s\n", dev->config_file); + printf("L: %i\n", dev->config_line); + printf("T: %li\n", dev->config_time); printf("\n"); return 0; } diff --git a/udevruler.c b/udevruler.c new file mode 100644 index 0000000000..b66940e944 --- /dev/null +++ b/udevruler.c @@ -0,0 +1,503 @@ +/* + * udevruler.c - simple udev-rule composer + * + * Reads the udev-db to get all currently known devices and + * scans the sysfs device chain for the choosen device to select attributes + * to compose a rule for the udev.rules file to uniquely name this device. + * + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_lib.h" +#include "udev_version.h" +#include "udevdb.h" +#include "logging.h" +#include "libsysfs/sysfs.h" +#include "list.h" + +#ifdef LOG +unsigned char logname[LOGNAME_SIZE]; +void log_message(int level, const char *format, ...) +{ + va_list args; + + if (!udev_log) + return; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif + +static char *dev_blacklist[] = { + "tty", + "pty", + "zero", + "null", + "kmsg", + "rtc", + "timer", + "full", + "kmem", + "mem", + "random", + "urandom", + "console", + "port", + "" +}; + +struct device { + struct list_head list; + char name[NAME_SIZE]; + char devpath[DEVPATH_SIZE]; + int config_line; + char config_file[NAME_SIZE]; + time_t config_time; + int added; +}; + +LIST_HEAD(device_list); +int device_count; + +/* callback for database dump */ +static int add_record(char *path, struct udevice *udev) +{ + struct device *dev; + struct device *loop_dev; + int i = 0; + + while (dev_blacklist[i][0] != '\0') { + if (strncmp(udev->name, dev_blacklist[i], strlen(dev_blacklist[i])) == 0) + goto exit; + i++; + } + + dev = malloc(sizeof(struct device)); + if (dev == NULL) { + printf("error malloc\n"); + exit(2); + } + strfieldcpy(dev->name, udev->name); + strfieldcpy(dev->devpath, path); + dev->config_line = udev->config_line; + strfieldcpy(dev->config_file, udev->config_file); + dev->config_time = udev->config_time; + dev->added = 0; + + /* sort in lexical order */ + list_for_each_entry(loop_dev, &device_list, list) { + if (strcmp(loop_dev->name, dev->name) > 0) { + break; + } + } + + list_add_tail(&dev->list, &loop_dev->list); + device_count++; + +exit: + return 0; +} + +/* get all devices from udev database */ +static int get_all_devices(void) +{ + int retval; + + device_count = 0; + INIT_LIST_HEAD(&device_list); + + retval = udevdb_open_ro(); + if (retval != 0) { + printf("unable to open udev database\n"); + exit(1); + } + + udevdb_call_foreach(add_record); + udevdb_exit(); + + return 0; +} + +struct attribute { + struct list_head list; + int level; + char key[NAME_SIZE]; +}; + +LIST_HEAD(attribute_list); +int attribute_count; + +static int add_attribute(const char *key, int level) +{ + struct attribute *attr; + + dbg("add attribute '%s'", key); + attr = malloc(sizeof(struct attribute)); + if (attr == NULL) { + printf("error malloc\n"); + exit(2); + } + + strfieldcpy(attr->key, key); + attr->level = level; + list_add_tail(&attr->list, &attribute_list); + attribute_count++; + return 0; +} + +static int add_all_attributes(const char *path, int level) +{ + struct dlist *attributes; + struct sysfs_attribute *attr; + struct sysfs_directory *sysfs_dir; + char value[NAME_SIZE]; + char key[NAME_SIZE]; + int len; + int retval = 0; + + dbg("look at '%s', level %i", path, level); + + sysfs_dir = sysfs_open_directory(path); + if (sysfs_dir == NULL) + return -1; + + attributes = sysfs_get_dir_attributes(sysfs_dir); + if (attributes == NULL) { + retval = -1; + return 0; + } + + dlist_for_each_data(attributes, attr, struct sysfs_attribute) + if (attr->value != NULL) { + dbg("found attribute '%s'", attr->name); + strfieldcpy(value, attr->value); + len = strlen(value); + if (len == 0) + continue; + + /* skip very long attributes */ + if (len > 40) + continue; + + /* remove trailing newline */ + if (value[len-1] == '\n') { + value[len-1] = '\0'; + len--; + } + + /* skip nonprintable values */ + while (len) { + if (!isprint(value[len-1])) + break; + len--; + } + if (len == 0) { + sprintf(key, "SYSFS{%s}=\"%s\"", attr->name, value); + add_attribute(key, level); + } + } + + return 0; +} + +static int get_all_attributes(char *path) +{ + struct sysfs_class_device *class_dev; + struct sysfs_class_device *class_dev_parent; + struct sysfs_attribute *attr; + struct sysfs_device *sysfs_dev; + struct sysfs_device *sysfs_dev_parent; + char key[NAME_SIZE]; + int retval = 0; + int level = 0; + + attribute_count = 0; + INIT_LIST_HEAD(&attribute_list); + + /* get the class dev */ + class_dev = sysfs_open_class_device_path(path); + if (class_dev == NULL) { + dbg("couldn't get the class device"); + return -1; + } + + /* read the 'dev' file for major/minor*/ + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr == NULL) { + dbg("couldn't get the \"dev\" file"); + retval = -1; + goto exit; + } + + sysfs_close_attribute(attr); + + /* open sysfs class device directory and get all attributes */ + if (add_all_attributes(class_dev->path, level) != 0) { + dbg("couldn't open class device directory"); + retval = -1; + goto exit; + } + level++; + + /* get the device link (if parent exists look here) */ + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent != NULL) { + //sysfs_close_class_device(class_dev); + class_dev = class_dev_parent; + } + sysfs_dev = sysfs_get_classdev_device(class_dev); + + /* look the device chain upwards */ + while (sysfs_dev != NULL) { + if (sysfs_dev->bus[0] != '\0') { + add_attribute("", level); + sprintf(key, "BUS=\"%s\"", sysfs_dev->bus); + add_attribute(key, level); + sprintf(key, "ID=\"%s\"", sysfs_dev->bus_id); + add_attribute(key, level); + + /* open sysfs device directory and print all attributes */ + add_all_attributes(sysfs_dev->path, level); + } + level++; + + sysfs_dev_parent = sysfs_get_device_parent(sysfs_dev); + if (sysfs_dev_parent == NULL) + break; + + //sysfs_close_device(sysfs_dev); + sysfs_dev = sysfs_dev_parent; + } + sysfs_close_device(sysfs_dev); + +exit: + //sysfs_close_class_device(class_dev); + return retval; +} + + +int main(int argc, char *argv[]) { + newtComponent lbox, run, lattr; + newtComponent quit, form, answer; + newtGrid grid, grid2; + char roottext[81]; + char path[NAME_SIZE]; + struct device *dev; + time_t time_last; + int count_last; + + newtInit(); + newtCls(); + + newtWinMessage("udevruler", "Ok", + "This program lets you select a device currently present " + "on the system and you may choose the attributes to uniquely " + "name the device with a udev rule.\n" + "No configuration will be changed, it just prints the rule " + "to place in a udev.rules configuration file. The \"%k\" in the " + "NAME key of the printed rule may be replaced by the name the " + "node should have."); + + init_logging("udevruler"); + udev_init_config(); + get_all_devices(); + + lbox = newtListbox(2, 1, 10, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT); + + /* look for last discovered device */ + time_last = 0; + list_for_each_entry(dev, &device_list, list) + if (dev->config_time > time_last) + time_last = dev->config_time; + + /* skip if more than 16 recent devices */ + count_last = 0; + list_for_each_entry(dev, &device_list, list) { + if (dev->config_time < time_last - 10) + continue; + count_last++; + } + + /* add devices up to 10 seconds older than the last one */ + if (count_last < 16) { + newtListboxAppendEntry(lbox, "--- last dicovered ---", NULL); + list_for_each_entry(dev, &device_list, list) { + if (dev->config_time < time_last - 10) + continue; + + dbg("%s %i", dev->name, dev->config_line); + newtListboxAppendEntry(lbox, dev->name, (void*) dev); + dev->added = 1; + } + newtListboxAppendEntry(lbox, "", NULL); + } + + /* add devices not catched by a rule */ + newtListboxAppendEntry(lbox, "--- not configured by a rule ---", NULL); + list_for_each_entry(dev, &device_list, list) { + if (dev->added) + continue; + + if (dev->config_line != 0) + continue; + + dbg("%s %i", dev->name, dev->config_line); + newtListboxAppendEntry(lbox, dev->name, (void*) dev); + dev->added = 1; + } + newtListboxAppendEntry(lbox, "", NULL); + + /* add remaining devices */ + newtListboxAppendEntry(lbox, "--- configured by a rule ---", NULL); + list_for_each_entry(dev, &device_list, list) { + if (dev->added) + continue; + + dbg("%s %i", dev->name, dev->config_line); + newtListboxAppendEntry(lbox, dev->name, (void*) dev); + } + + newtPushHelpLine(" / between elements | Use to select a device"); + snprintf(roottext, sizeof(roottext), "simple udev rule composer, version %s, (c) 2004 can't sleep team", UDEV_VERSION); + roottext[sizeof(roottext)-1] = '\0'; + newtDrawRootText(0, 0, roottext); + + form = newtForm(NULL, NULL, 0); + grid = newtCreateGrid(1, 2); + grid2 = newtButtonBar("Select device", &run, "Quit", &quit, NULL); + newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, lbox, 1, 0, 1, 0, NEWT_ANCHOR_TOP, 0); + newtGridSetField(grid, 0, 1, NEWT_GRID_SUBGRID, grid2, 0, 1, 0, 0, NEWT_ANCHOR_TOP, 0); + newtFormAddComponents(form, lbox, run, quit, NULL); + newtGridWrappedWindow(grid,"Choose the device for which to compose a rule"); + newtGridFree(grid, 1); + + while (1) { + struct attribute *attr; + newtComponent ok, back, form2, answer2, text; + newtGrid grid3, grid4; + int i; + int numitems; + struct attribute **selattr; + char text_rule[80]; + + answer = newtRunForm(form); + if (answer == quit) + break; + + dev = (struct device *) newtListboxGetCurrent(lbox); + if (dev == NULL) + continue; + + if (dev->config_line > 0) + snprintf(text_rule, sizeof(text_rule), + "The device is handled by a rule in the file '%s', line %i.", + dev->config_file, dev->config_line); + else + strcpy(text_rule, "The device was not handled by a rule."); + + strfieldcpy(path, sysfs_path); + strfieldcat(path, dev->devpath); + dbg("look at sysfs device '%s'", path); + get_all_attributes(path); + + grid3 = newtCreateGrid(1, 3); + form2 = newtForm(NULL, NULL, 0); + grid4 = newtButtonBar("Ok", &ok, "Back", &back, NULL); + + lattr = newtListbox(-1, -1, 10, NEWT_FLAG_MULTIPLE | NEWT_FLAG_BORDER | NEWT_FLAG_RETURNEXIT); + list_for_each_entry(attr, &attribute_list, list) + newtListboxAddEntry(lattr, attr->key, (void *) attr); + + text = newtTextbox(-1, -1, 50, 2, NEWT_FLAG_WRAP); + newtTextboxSetText(text, text_rule); + + newtGridSetField(grid3, 0, 0, NEWT_GRID_COMPONENT, lattr, 0, 0, 0, 1, 0, 0); + newtGridSetField(grid3, 0, 1, NEWT_GRID_COMPONENT, text, 0, 0, 0, 1, 0, 0); + newtGridSetField(grid3, 0, 2, NEWT_GRID_SUBGRID, grid4, 0, 1, 0, 0, NEWT_ANCHOR_TOP, 0); + + newtFormAddComponents(form2, text, lattr, ok, back, NULL); + newtGridWrappedWindow(grid3, "Select one ore more attributes within one section with the space bar"); + newtGridFree(grid3, 1); + + while (1) { + char rule[255]; + int onelevel; + int skipped; + + answer2 = newtRunForm(form2); + if (answer2 == back) + break; + + selattr = (struct attribute **) newtListboxGetSelection(lattr, &numitems); + if (selattr == NULL) + continue; + + rule[0] = '\0'; + onelevel = -1; + skipped = 0; + for (i = 0; i < numitems; i++) { + if (selattr[i]->key[0] == '\0') + continue; + + if (onelevel != -1) { + if (onelevel != selattr[i]->level) { + skipped = 1; + continue; + } + } else { + onelevel = selattr[i]->level; + } + + dbg("'%s'\n", selattr[i]->key); + strfieldcat(rule, selattr[i]->key); + strfieldcat(rule, ", "); + } + if (skipped) { + newtWinMessage("error", "Ok", "Please select only attributes within one section"); + continue; + } + + if (strlen(rule) > 200) { + newtWinMessage("error", "Ok", "The line is too long, please select fewer attributes."); + } else { + if (rule[0] == '\0') + continue; + + strfieldcat(rule, "NAME=\"%k\""); + newtWinMessage("the rule to place in config file", "Ok", rule); + } + } + + newtPopWindow(); + } + + newtPopWindow(); + newtFormDestroy(form); + newtFinished(); + return 0; +} -- cgit v1.2.3-54-g00ecf From 93e6b62cbd2ddcd2550f6ea6fb9733b0758146ae Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 23 Mar 2004 18:43:49 -0800 Subject: [PATCH] fix 'make spotless' to really do that in klibc. bah, this took me forever to figure out why I couldn't build with klibc on on box... --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 3d5288b25d..b51b5a6acc 100644 --- a/Makefile +++ b/Makefile @@ -313,6 +313,7 @@ clean: done ; \ spotless: clean + $(MAKE) -C klibc spotless DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz$" -e "\/\." -e releases -e BitKeeper -e SCCS -e "\.tdb$" -e test/sys | sort ) DISTDIR := $(RELEASE_NAME) -- cgit v1.2.3-54-g00ecf From fdcfcec707ab48a5285d675412820d4320382e92 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 23 Mar 2004 18:49:56 -0800 Subject: [PATCH] 022_bk tag --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index b51b5a6acc..bd511a83ae 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 022 +VERSION = 022_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 7de035c86e..017affbc36 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 022 +Version: 022_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 4474484153f529c1a1c11392e8fc3fa8a588de54 Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Tue, 23 Mar 2004 18:52:52 -0800 Subject: [PATCH] uninitialized variable for mknod and friend mknod gets an uninitialized variable, which leads to interesting file modes. the bug is in namedev, devices with no match must not use the uninitialized stuff were dev points to. --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index e075e20af5..6606ce8f79 100644 --- a/namedev.c +++ b/namedev.c @@ -843,12 +843,12 @@ found: strfieldcpy(udev->config_file, dev->config_file); udev->config_line = dev->config_line; -done: /* get permissions given in rule */ set_empty_perms(udev, dev->mode, dev->owner, dev->group); +done: /* get permissions given in config file or set defaults */ perm = find_perm(udev->name); if (perm != NULL) { -- cgit v1.2.3-54-g00ecf From 2a94c8777eacff16821a06368092852f7b42882f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Mar 2004 18:54:34 -0800 Subject: [PATCH] don't init namedev on remove Is there any reason to parse the rules for a remove event? Without it, our test script needs only 2.1 seconds instead of 2.5, so we have 19 percent more time for testing now :) --- udev.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/udev.c b/udev.c index d10badc8ea..1220e637e5 100644 --- a/udev.c +++ b/udev.c @@ -140,19 +140,18 @@ static int udev_hotplug(void) sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); - /* initialize the naming deamon */ - namedev_init(); - - if (strcmp(action, "add") == 0) + if (strcmp(action, "add") == 0) { + namedev_init(); retval = udev_add_device(devpath, subsystem, 0); - - else if (strcmp(action, "remove") == 0) - retval = udev_remove_device(devpath, subsystem); - - else { - dbg("unknown action '%s'", action); - retval = -EINVAL; + } else { + if (strcmp(action, "remove") == 0) { + retval = udev_remove_device(devpath, subsystem); + } else { + dbg("unknown action '%s'", action); + retval = -EINVAL; + } } + udevdb_exit(); exit_sysbus: -- cgit v1.2.3-54-g00ecf From ddd5b5dc4890d40b7ed412e9de52b33e62447f78 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 24 Mar 2004 17:34:00 -0800 Subject: [PATCH] correct apply_format() for symlink only rules Patch from Andrey, which restores the ability to use RESULT values in a "symlink only" rule. We need to call apply_format() directly after the matching rule, otherwise the RESULT value may be lost. --- namedev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 6606ce8f79..98529cb840 100644 --- a/namedev.c +++ b/namedev.c @@ -816,11 +816,15 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } if (dev->symlink[0] != '\0') { + char temp[NAMESIZE]; + info("configured rule in '%s' at line %i applied, added symlink '%s'", dev->config_file, dev->config_line, dev->symlink); + strfieldcpy(temp, dev->symlink); + apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); if (udev->symlink[0] != '\0') strfieldcat(udev->symlink, " "); - strfieldcat(udev->symlink, dev->symlink); + strfieldcat(udev->symlink, temp); } if (dev->name[0] != '\0') { @@ -838,7 +842,6 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud found: apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); - apply_format(udev, udev->symlink, sizeof(udev->symlink), class_dev, sysfs_device); udev->partitions = dev->partitions; strfieldcpy(udev->config_file, dev->config_file); udev->config_line = dev->config_line; -- cgit v1.2.3-54-g00ecf From a291a14b9062339134c561453cfbb2409713582d Mon Sep 17 00:00:00 2001 From: "dsteklof@us.ibm.com" Date: Wed, 24 Mar 2004 17:34:38 -0800 Subject: [PATCH] udevinfo patch I think this is what you want for udevinfo. Patched against the latest BK tree. I tested it and it seemed to work. One other question, shouldn't udevinfo.c:print_all_attributes() check to make sure attr->method is SYSFS_METHOD_SHOW along with checking to see if attr->value != NULL or doesn't that matter? Here's the libsysfs fix for print_device_chain(): --- udevinfo.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index dc3f94fffe..800882eb1a 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -161,7 +161,6 @@ static int print_device_chain(const char *path) "to match the device for which the node will be created.\n" "\n"); printf("device '%s' has major:minor %s", class_dev->path, attr->value); - sysfs_close_attribute(attr); /* open sysfs class device directory and print all attributes */ printf(" looking at class device '%s':\n", class_dev->path); @@ -173,11 +172,11 @@ static int print_device_chain(const char *path) /* get the device link (if parent exists look here) */ class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) { - //sysfs_close_class_device(class_dev); - class_dev = class_dev_parent; - } - sysfs_dev = sysfs_get_classdev_device(class_dev); + if (class_dev_parent != NULL) + sysfs_dev = sysfs_get_classdev_device(class_dev_parent); + else + sysfs_dev = sysfs_get_classdev_device(class_dev); + if (sysfs_dev != NULL) printf("follow the class device's \"device\"\n"); @@ -194,13 +193,11 @@ static int print_device_chain(const char *path) if (sysfs_dev_parent == NULL) break; - //sysfs_close_device(sysfs_dev); sysfs_dev = sysfs_dev_parent; } - sysfs_close_device(sysfs_dev); exit: - //sysfs_close_class_device(class_dev); + sysfs_close_class_device(class_dev); return retval; } -- cgit v1.2.3-54-g00ecf From 615ba3e82b2e49e06bbf9ad3e6a8ab6f0446ee26 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 17:50:40 -0800 Subject: [PATCH] fix build error in namedev.c caused by previous patch. --- namedev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 98529cb840..b9d8a3db2c 100644 --- a/namedev.c +++ b/namedev.c @@ -816,7 +816,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } if (dev->symlink[0] != '\0') { - char temp[NAMESIZE]; + char temp[NAME_SIZE]; info("configured rule in '%s' at line %i applied, added symlink '%s'", dev->config_file, dev->config_line, dev->symlink); -- cgit v1.2.3-54-g00ecf From dd64e26b0c88892b367f57c4c7a7484e35641c7c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 20:46:58 -0800 Subject: [PATCH] add /etc/dev.d/ support for udev add and remove events. --- Makefile | 1 + dev_d.c | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev-add.c | 4 +- udev-remove.c | 1 + udev.h | 1 + 5 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 dev_d.c diff --git a/Makefile b/Makefile index bd511a83ae..f20337bb54 100644 --- a/Makefile +++ b/Makefile @@ -209,6 +209,7 @@ OBJS = udev_lib.o \ udevdb.o \ namedev.o \ namedev_parse.o \ + dev_d.o \ $(SYSFS) \ $(TDB) diff --git a/dev_d.c b/dev_d.c new file mode 100644 index 0000000000..36bee33bd9 --- /dev/null +++ b/dev_d.c @@ -0,0 +1,117 @@ +/* + * dev.d multipleer + * + * Copyright (C) 2004 Greg Kroah-Hartman + * + * 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. + * + * Based on the klibc version of hotplug written by: + * Author(s) Christian Borntraeger + * which was based on the shell script written by: + * Greg Kroah-Hartman + * + */ + +/* + * This essentially emulates the following shell script logic in C: + DIR="/etc/dev.d" + export DEVNODE="whatever_dev_name_udev_just_gave" + for I in "${DIR}/$DEVNODE/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do + if [ -f $I ]; then $I $1 ; fi + done + exit 1; + */ + +#include +#include +#include +#include +#include +#include +#include +#include "udev.h" +#include "udev_lib.h" +#include "logging.h" + +#define HOTPLUGDIR "/etc/dev.d" +#define COMMENT_PREFIX '#' + +static void run_program(char *name) +{ + pid_t pid; + + dbg("running %s", name); + + pid = fork(); + + if (pid < 0) { + perror("fork"); + return; + } + + if (pid > 0) { + wait(NULL); + return; + } + + execv(name, main_argv); + exit(1); +} + +static void execute_dir (char *dirname) +{ + DIR *directory; + struct dirent *entry; + char filename[256]; + + dbg("opening %s", dirname); + directory = opendir(dirname); + if (!directory) + return; + + while ((entry = readdir(directory))) { + if (entry->d_name[0] == '\0') + break; + /* Don't run the files '.', '..', or hidden files, + * or files that start with a '#' */ + if ((entry->d_name[0] == '.') || + (entry->d_name[0] == COMMENT_PREFIX)) + continue; + + /* FIXME - need to use file_list_insert() here to run these in sorted order... */ + snprintf(filename, sizeof(filename), "%s%s", dirname, entry->d_name); + filename[sizeof(filename)-1] = '\0'; + run_program(filename); + } + + closedir(directory); +} + +/* runs files in these directories in order: + * name given by udev + * subsystem + * default + */ +void dev_d_send(struct udevice *dev, char *subsystem) +{ + char dirname[256]; + char devnode[NAME_SIZE]; + + strfieldcpy(devnode, udev_root); + strfieldcat(devnode, dev->name); + setenv("DEVNODE", devnode, 1); + + snprintf(dirname, sizeof(dirname), HOTPLUGDIR "/%s/", dev->name); + dirname[sizeof(dirname)-1] = '\0'; + execute_dir(dirname); + + snprintf(dirname, sizeof(dirname), HOTPLUGDIR "/%s/", subsystem); + dirname[sizeof(dirname)-1] = '\0'; + execute_dir(dirname); + + strcpy(dirname, HOTPLUGDIR "/default/"); + execute_dir(dirname); +} + diff --git a/udev-add.c b/udev-add.c index 2bd16014f5..94a423dc6e 100644 --- a/udev-add.c +++ b/udev-add.c @@ -417,8 +417,10 @@ int udev_add_device(char *path, char *subsystem, int fake) dbg("name='%s'", dev.name); retval = create_node(&dev, fake); - if ((retval == 0) && (!fake)) + if ((retval == 0) && (!fake)) { + dev_d_send(&dev, subsystem); sysbus_send_create(&dev, path); + } exit: if (class_dev) diff --git a/udev-remove.c b/udev-remove.c index d909713450..dc6fcfc331 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -150,6 +150,7 @@ int udev_remove_device(char *path, char *subsystem) dbg("name is '%s'", dev.name); udevdb_delete_dev(path); + dev_d_send(&dev, subsystem); sysbus_send_remove(dev.name, path); retval = delete_node(&dev); diff --git a/udev.h b/udev.h index 16a212cd2c..eb42edce10 100644 --- a/udev.h +++ b/udev.h @@ -65,6 +65,7 @@ extern int udev_add_device(char *path, char *subsystem, int fake); extern int udev_remove_device(char *path, char *subsystem); extern void udev_init_config(void); extern int parse_get_pair(char **orig_string, char **left, char **right); +extern void dev_d_send(struct udevice *dev, char *subsystem); extern char **main_argv; extern char **main_envp; -- cgit v1.2.3-54-g00ecf From 7e371e86a420cb82948b72ca3dd93915cb8dd764 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:11:13 -0800 Subject: [PATCH] remove dbus code from core udev code as it's no longer needed to be there. --- udev-add.c | 5 +---- udev-remove.c | 2 -- udev.c | 11 +---------- udev_dbus.h | 23 ----------------------- 4 files changed, 2 insertions(+), 39 deletions(-) delete mode 100644 udev_dbus.h diff --git a/udev-add.c b/udev-add.c index 94a423dc6e..369ea82b6c 100644 --- a/udev-add.c +++ b/udev-add.c @@ -39,7 +39,6 @@ #include "udev.h" #include "udev_lib.h" #include "udev_version.h" -#include "udev_dbus.h" #include "udev_selinux.h" #include "logging.h" #include "namedev.h" @@ -417,10 +416,8 @@ int udev_add_device(char *path, char *subsystem, int fake) dbg("name='%s'", dev.name); retval = create_node(&dev, fake); - if ((retval == 0) && (!fake)) { + if ((retval == 0) && (!fake)) dev_d_send(&dev, subsystem); - sysbus_send_create(&dev, path); - } exit: if (class_dev) diff --git a/udev-remove.c b/udev-remove.c index dc6fcfc331..41636b684e 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -31,7 +31,6 @@ #include "udev.h" #include "udev_lib.h" #include "udev_version.h" -#include "udev_dbus.h" #include "logging.h" #include "namedev.h" #include "udevdb.h" @@ -151,7 +150,6 @@ int udev_remove_device(char *path, char *subsystem) udevdb_delete_dev(path); dev_d_send(&dev, subsystem); - sysbus_send_remove(dev.name, path); retval = delete_node(&dev); return retval; diff --git a/udev.c b/udev.c index 1220e637e5..52b98c8d45 100644 --- a/udev.c +++ b/udev.c @@ -32,7 +32,6 @@ #include "udev.h" #include "udev_lib.h" #include "udev_version.h" -#include "udev_dbus.h" #include "logging.h" #include "namedev.h" #include "udevdb.h" @@ -61,7 +60,6 @@ static void sig_handler(int signum) switch (signum) { case SIGINT: case SIGTERM: - sysbus_disconnect(); udevdb_exit(); exit(20 + signum); default: @@ -123,14 +121,11 @@ static int udev_hotplug(void) i++; } - /* connect to the system message bus */ - sysbus_connect(); - /* initialize udev database */ retval = udevdb_init(UDEVDB_DEFAULT); if (retval != 0) { dbg("unable to initialize database"); - goto exit_sysbus; + goto exit; } /* set up a default signal handler for now */ @@ -154,10 +149,6 @@ static int udev_hotplug(void) udevdb_exit(); -exit_sysbus: - /* disconnect from the system message bus */ - sysbus_disconnect(); - exit: if (retval > 0) retval = 0; diff --git a/udev_dbus.h b/udev_dbus.h deleted file mode 100644 index afa2046548..0000000000 --- a/udev_dbus.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef UDEV_DBUS_H -#define UDEV_DBUS_H - - -#ifdef USE_DBUS - -extern void sysbus_connect(void); -extern void sysbus_disconnect(void); -extern void sysbus_send_create(struct udevice *dev, const char *path); -extern void sysbus_send_remove(const char* name, const char *path); - -#else - -static inline void sysbus_connect(void) { } -static inline void sysbus_disconnect(void) { } -static inline void sysbus_send_create(struct udevice *dev, const char *path) { } -static inline void sysbus_send_remove(const char* name, const char *path) { } - -#endif /* USE_DBUS */ - - - -#endif -- cgit v1.2.3-54-g00ecf From 89fe4e00fe0ac4b5125a3a66ffe3d42366feb5da Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:11:36 -0800 Subject: [PATCH] add get_devnode() helper to udev_lib for udev_dbus program --- udev_lib.c | 11 +++++++++++ udev_lib.h | 1 + 2 files changed, 12 insertions(+) diff --git a/udev_lib.c b/udev_lib.c index 50598a4a31..f095513c97 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -53,6 +53,17 @@ char *get_devpath(void) return devpath; } +char *get_devnode(void) +{ + char *devnode; + + devnode = getenv("DEVNODE"); + if (devnode != NULL && strlen(devnode) > NAME_SIZE) + devnode[NAME_SIZE-1] = '\0'; + + return devnode; +} + char *get_seqnum(void) { char *seqnum; diff --git a/udev_lib.h b/udev_lib.h index 565d87e9a5..5db6b5261a 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -68,6 +68,7 @@ do { \ extern char *get_action(void); extern char *get_devpath(void); +extern char *get_devnode(void); extern char *get_seqnum(void); extern char *get_subsystem(char *subsystem); extern int file_map(const char *filename, char **buf, size_t *bufsize); -- cgit v1.2.3-54-g00ecf From 3bfbe50bd85feb2b26327032dc5fb68773cc785f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:12:10 -0800 Subject: [PATCH] first cut at standalone udev_dbus program. Will not work, need to finish working on this on a system with dbus installed... --- udev_dbus.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 67 insertions(+), 22 deletions(-) diff --git a/udev_dbus.c b/udev_dbus.c index 7b672ef363..a031a41101 100644 --- a/udev_dbus.c +++ b/udev_dbus.c @@ -14,6 +14,20 @@ #include "udev_dbus.h" #include "logging.h" +#ifdef LOG +unsigned char logname[LOGNAME_SIZE]; +void log_message(int level, const char *format, ...) +{ + va_list args; + + if (!udev_log) + return; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif /** variable for the connection the to system message bus or #NULL * if we cannot connect or acquire the org.kernel.udev service @@ -21,7 +35,7 @@ static DBusConnection* sysbus_connection; /** Disconnect from the system message bus */ -void sysbus_disconnect(void) +static void sysbus_disconnect(void) { if (sysbus_connection == NULL) return; @@ -31,7 +45,7 @@ void sysbus_disconnect(void) } /** Connect to the system message bus */ -void sysbus_connect(void) +static void sysbus_connect(void) { DBusError error; @@ -68,28 +82,21 @@ void sysbus_connect(void) /** Send out a signal that a device node is created * - * @param dev udevice object + * @param devnode name of the device node, e.g. /dev/sda1 * @param path Sysfs path of device */ -void sysbus_send_create(struct udevice *dev, const char *path) +static void sysbus_send_create(const char *devnode, const char *path) { - char filename[255]; DBusMessage* message; DBusMessageIter iter; - if (sysbus_connection == NULL) - return; - - strfieldcpy(filename, udev_root); - strfieldcat(filename, dev->name); - /* object, interface, member */ message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", "org.kernel.udev.NodeMonitor", "NodeCreated"); dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, filename); + dbus_message_iter_append_string(&iter, devnode); dbus_message_iter_append_string(&iter, path); if ( !dbus_connection_send(sysbus_connection, message, NULL) ) @@ -102,28 +109,21 @@ void sysbus_send_create(struct udevice *dev, const char *path) /** Send out a signal that a device node is deleted * - * @param name Name of the device node, e.g. /udev/sda1 + * @param devnode Name of the device node, e.g. /udev/sda1 * @param path Sysfs path of device */ -void sysbus_send_remove(const char* name, const char *path) +static void sysbus_send_remove(const char *devnode, const char *path) { - char filename[255]; DBusMessage* message; DBusMessageIter iter; - if (sysbus_connection == NULL) - return; - - strfieldcpy(filename, udev_root); - strfieldcat(filename, name); - /* object, interface, member */ message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", "org.kernel.udev.NodeMonitor", "NodeDeleted"); dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, filename); + dbus_message_iter_append_string(&iter, devnode); dbus_message_iter_append_string(&iter, path); if ( !dbus_connection_send(sysbus_connection, message, NULL) ) @@ -133,3 +133,48 @@ void sysbus_send_remove(const char* name, const char *path) dbus_connection_flush(sysbus_connection); } + +int main(int argc, char *argv[], char *envp[]) +{ + char *action; + char *devpath; + char *devnode; + int retval = 0; + + init_logging("udev_dbus"); + + sysbus_connect(); + if (sysbus_connection == NULL) + return; + + action = get_action(); + if (!action) { + dbg("no action?"); + goto exit; + } + devpath = get_devpath(); + if (!devpath) { + dbg("no devpath?"); + goto exit; + } + devnode = get_devnode(); + if (!devnode) { + dbg("no devnode?"); + goto exit; + } + + if (strcmp(action, "add") == 0) { + sysbus_send_create(devnode, devpath); + } else { + if (strcmp(action, "remove") == 0) { + sysbus_send_remove(devnode, devpath); + } else { + dbg("unknown action '%s'", action); + retval = -EINVAL; + } + } + +exit: + sysbus_disconnect(); + return retval; +} -- cgit v1.2.3-54-g00ecf From eddf1bca24d49055aa409315fd218561005fba07 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:14:08 -0800 Subject: [PATCH] remove selinux support from udev core as it's no longer needed. --- udev-add.c | 4 ---- udev_selinux.h | 10 ---------- 2 files changed, 14 deletions(-) delete mode 100644 udev_selinux.h diff --git a/udev-add.c b/udev-add.c index 369ea82b6c..aef755442f 100644 --- a/udev-add.c +++ b/udev-add.c @@ -39,7 +39,6 @@ #include "udev.h" #include "udev_lib.h" #include "udev_version.h" -#include "udev_selinux.h" #include "logging.h" #include "namedev.h" #include "udevdb.h" @@ -277,9 +276,6 @@ static int create_node(struct udevice *dev, int fake) } } - if (!fake) - selinux_add_node(filename); - /* create symlink if requested */ foreach_strpart(dev->symlink, " ", pos, len) { strfieldcpymax(linkname, pos, len+1); diff --git a/udev_selinux.h b/udev_selinux.h deleted file mode 100644 index 77a1f36bd9..0000000000 --- a/udev_selinux.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef UDEV_SELINUX_H -#define UDEV_SELINUX_H - -#ifdef USE_SELINUX -extern void selinux_add_node(char *filename); -#else -static void selinux_add_node(char *filename) { } -#endif - -#endif -- cgit v1.2.3-54-g00ecf From b528cd49203c64cf117868b5a5907cb11d934bbb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:18:36 -0800 Subject: [PATCH] first cut at standalone udev_selinux program. Will not work, need to finish working on this on a system with selinux installed... --- udev_selinux.c | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/udev_selinux.c b/udev_selinux.c index 3728fd0b50..723af9a02f 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -8,10 +8,23 @@ #include #include "udev.h" -#include "udev_version.h" -#include "udev_selinux.h" +#include "udev_lib.h" #include "logging.h" +#ifdef LOG +unsigned char logname[LOGNAME_SIZE]; +void log_message(int level, const char *format, ...) +{ + va_list args; + + if (!udev_log) + return; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif void selinux_add_node(char *filename) { @@ -32,3 +45,29 @@ void selinux_add_node(char *filename) } } +int main(int argc, char *argv[], char *envp[]) +{ + char *action; + char *devpath; + char *devnode; + int retval = 0; + + init_logging("udev_selinux"); + + action = get_action(); + if (!action) { + dbg("no action?"); + goto exit; + } + devnode = get_devnode(); + if (!devnode) { + dbg("no devnode?"); + goto exit; + } + + if (strcmp(action, "add") == 0) + selinux_add_node(devnode); + +exit: + return retval; +} -- cgit v1.2.3-54-g00ecf From ddc8f83132368098e63634dd355cde7d787fc85c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:21:21 -0800 Subject: [PATCH] remove udev_dbus.h from Makefile --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index f20337bb54..219ce2cbf0 100644 --- a/Makefile +++ b/Makefile @@ -217,7 +217,6 @@ HEADERS = udev.h \ udev_lib.h \ namedev.h \ udev_version.h \ - udev_dbus.h \ udevdb.h \ klibc_fixups.h \ logging.h \ -- cgit v1.2.3-54-g00ecf From c5039077b710dca041b2b36a3fc3247964abc069 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:23:42 -0800 Subject: [PATCH] udev_dbus can now compile properly, but linnking is another story... --- udev_dbus.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/udev_dbus.c b/udev_dbus.c index a031a41101..7e767040f0 100644 --- a/udev_dbus.c +++ b/udev_dbus.c @@ -10,8 +10,7 @@ #include #include "udev.h" -#include "udev_version.h" -#include "udev_dbus.h" +#include "udev_lib.h" #include "logging.h" #ifdef LOG @@ -145,7 +144,7 @@ int main(int argc, char *argv[], char *envp[]) sysbus_connect(); if (sysbus_connection == NULL) - return; + return 0; action = get_action(); if (!action) { -- cgit v1.2.3-54-g00ecf From 357f44a534e5e32e52020121c983aca90ae7ac1b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:37:34 -0800 Subject: [PATCH] move udev_dbus to extras/dbus Should build now, but might have linking problems. --- etc/dbus-1/system.d/udev_sysbus_policy.conf | 23 --- extras/dbus/Makefile | 63 ++++++++ .../etc/dbus-1/system.d/udev_sysbus_policy.conf | 23 +++ extras/dbus/udev_dbus.c | 178 ++++++++++++++++++++ udev_dbus.c | 179 --------------------- 5 files changed, 264 insertions(+), 202 deletions(-) delete mode 100644 etc/dbus-1/system.d/udev_sysbus_policy.conf create mode 100644 extras/dbus/Makefile create mode 100644 extras/dbus/etc/dbus-1/system.d/udev_sysbus_policy.conf create mode 100644 extras/dbus/udev_dbus.c delete mode 100644 udev_dbus.c diff --git a/etc/dbus-1/system.d/udev_sysbus_policy.conf b/etc/dbus-1/system.d/udev_sysbus_policy.conf deleted file mode 100644 index b2660e65cf..0000000000 --- a/etc/dbus-1/system.d/udev_sysbus_policy.conf +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/extras/dbus/Makefile b/extras/dbus/Makefile new file mode 100644 index 0000000000..99aa33d8fb --- /dev/null +++ b/extras/dbus/Makefile @@ -0,0 +1,63 @@ +# Makefile for udev_dbus +# +# Copyright (C) 2004 Greg Kroah-Hartman +# +# 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. +# + +# Set the following to `true' to log the debug +# and make a unstripped, unoptimized binary. +# Leave this set to `false' for production use. +DEBUG = false + +PROG = udev_dbus + +all: $(PROG) + +# override this to make udev look in a different location for it's config files +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +mandir = ${prefix}/usr/share/man +hotplugdir = ${etcdir}/hotplug.d/default +dbusdir = ${etcdir}/dbus-1/system.d +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +override CFLAGS+=-Wall -fno-builtin + +override CFLAGS += -DUSE_DBUS +override CFLAGS += $(shell pkg-config --cflags dbus-1) +override LDFLAGS += $(shell pkg-config --libs dbus-1) +OBJS = udev_dbus.o + +$(PROG): $(OBJS) + $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) ../../udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + + +install-dbus-policy: + $(INSTALL) -d $(DESTDIR)$(dbusdir) + $(INSTALL_DATA) etc/dbus-1/system.d/udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) + +uninstall-dbus-policy: + - rm $(DESTDIR)$(dbusdir)/udev_sysbus_policy.conf + +install: install-dbus-policy all + +uninstall: uninstall-dbus-policy + diff --git a/extras/dbus/etc/dbus-1/system.d/udev_sysbus_policy.conf b/extras/dbus/etc/dbus-1/system.d/udev_sysbus_policy.conf new file mode 100644 index 0000000000..b2660e65cf --- /dev/null +++ b/extras/dbus/etc/dbus-1/system.d/udev_sysbus_policy.conf @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + diff --git a/extras/dbus/udev_dbus.c b/extras/dbus/udev_dbus.c new file mode 100644 index 0000000000..955a3dbb49 --- /dev/null +++ b/extras/dbus/udev_dbus.c @@ -0,0 +1,178 @@ +#include +#include +#include +#include +#include +#include +#include + +#define DBUS_API_SUBJECT_TO_CHANGE +#include + +#include "../../udev_lib.h" +#include "../../logging.h" + +#ifdef LOG +unsigned char logname[LOGNAME_SIZE]; +void log_message(int level, const char *format, ...) +{ + va_list args; + + if (!udev_log) + return; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif + +/** variable for the connection the to system message bus or #NULL + * if we cannot connect or acquire the org.kernel.udev service + */ +static DBusConnection* sysbus_connection; + +/** Disconnect from the system message bus */ +static void sysbus_disconnect(void) +{ + if (sysbus_connection == NULL) + return; + + dbus_connection_disconnect(sysbus_connection); + sysbus_connection = NULL; +} + +/** Connect to the system message bus */ +static void sysbus_connect(void) +{ + DBusError error; + + /* Connect to a well-known bus instance, the system bus */ + dbus_error_init(&error); + sysbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); + if (sysbus_connection == NULL) { + dbg("cannot connect to system message bus, error %s: %s", + error.name, error.message); + dbus_error_free(&error); + return; + } + + /* Acquire the org.kernel.udev service such that listeners + * know that the message is really from us and not from a + * random attacker. See the file udev_sysbus_policy.conf for + * details. + * + * Note that a service can have multiple owners (though there + * is a concept of a primary owner for reception of messages) + * so no race is introduced if two copies of udev is running + * at the same time. + */ + dbus_bus_acquire_service(sysbus_connection, "org.kernel.udev", 0, + &error); + if (dbus_error_is_set(&error)) { + printf("cannot acquire org.kernel.udev service, error %s: %s'", + error.name, error.message); + sysbus_disconnect(); + return; + } +} + + +/** Send out a signal that a device node is created + * + * @param devnode name of the device node, e.g. /dev/sda1 + * @param path Sysfs path of device + */ +static void sysbus_send_create(const char *devnode, const char *path) +{ + DBusMessage* message; + DBusMessageIter iter; + + /* object, interface, member */ + message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", + "org.kernel.udev.NodeMonitor", + "NodeCreated"); + + dbus_message_iter_init(message, &iter); + dbus_message_iter_append_string(&iter, devnode); + dbus_message_iter_append_string(&iter, path); + + if ( !dbus_connection_send(sysbus_connection, message, NULL) ) + dbg("error sending d-bus signal"); + + dbus_message_unref(message); + + dbus_connection_flush(sysbus_connection); +} + +/** Send out a signal that a device node is deleted + * + * @param devnode Name of the device node, e.g. /udev/sda1 + * @param path Sysfs path of device + */ +static void sysbus_send_remove(const char *devnode, const char *path) +{ + DBusMessage* message; + DBusMessageIter iter; + + /* object, interface, member */ + message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", + "org.kernel.udev.NodeMonitor", + "NodeDeleted"); + + dbus_message_iter_init(message, &iter); + dbus_message_iter_append_string(&iter, devnode); + dbus_message_iter_append_string(&iter, path); + + if ( !dbus_connection_send(sysbus_connection, message, NULL) ) + dbg("error sending d-bus signal"); + + dbus_message_unref(message); + + dbus_connection_flush(sysbus_connection); +} + +int main(int argc, char *argv[], char *envp[]) +{ + char *action; + char *devpath; + char *devnode; + int retval = 0; + + init_logging("udev_dbus"); + + sysbus_connect(); + if (sysbus_connection == NULL) + return 0; + + action = get_action(); + if (!action) { + dbg("no action?"); + goto exit; + } + devpath = get_devpath(); + if (!devpath) { + dbg("no devpath?"); + goto exit; + } + devnode = get_devnode(); + if (!devnode) { + dbg("no devnode?"); + goto exit; + } + + if (strcmp(action, "add") == 0) { + sysbus_send_create(devnode, devpath); + } else { + if (strcmp(action, "remove") == 0) { + sysbus_send_remove(devnode, devpath); + } else { + dbg("unknown action '%s'", action); + retval = -EINVAL; + } + } + +exit: + sysbus_disconnect(); + return retval; +} diff --git a/udev_dbus.c b/udev_dbus.c deleted file mode 100644 index 7e767040f0..0000000000 --- a/udev_dbus.c +++ /dev/null @@ -1,179 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#define DBUS_API_SUBJECT_TO_CHANGE -#include - -#include "udev.h" -#include "udev_lib.h" -#include "logging.h" - -#ifdef LOG -unsigned char logname[LOGNAME_SIZE]; -void log_message(int level, const char *format, ...) -{ - va_list args; - - if (!udev_log) - return; - - va_start(args, format); - vsyslog(level, format, args); - va_end(args); -} -#endif - -/** variable for the connection the to system message bus or #NULL - * if we cannot connect or acquire the org.kernel.udev service - */ -static DBusConnection* sysbus_connection; - -/** Disconnect from the system message bus */ -static void sysbus_disconnect(void) -{ - if (sysbus_connection == NULL) - return; - - dbus_connection_disconnect(sysbus_connection); - sysbus_connection = NULL; -} - -/** Connect to the system message bus */ -static void sysbus_connect(void) -{ - DBusError error; - - /* Connect to a well-known bus instance, the system bus */ - dbus_error_init(&error); - sysbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); - if (sysbus_connection == NULL) { - dbg("cannot connect to system message bus, error %s: %s", - error.name, error.message); - dbus_error_free(&error); - return; - } - - /* Acquire the org.kernel.udev service such that listeners - * know that the message is really from us and not from a - * random attacker. See the file udev_sysbus_policy.conf for - * details. - * - * Note that a service can have multiple owners (though there - * is a concept of a primary owner for reception of messages) - * so no race is introduced if two copies of udev is running - * at the same time. - */ - dbus_bus_acquire_service(sysbus_connection, "org.kernel.udev", 0, - &error); - if (dbus_error_is_set(&error)) { - printf("cannot acquire org.kernel.udev service, error %s: %s'", - error.name, error.message); - sysbus_disconnect(); - return; - } -} - - -/** Send out a signal that a device node is created - * - * @param devnode name of the device node, e.g. /dev/sda1 - * @param path Sysfs path of device - */ -static void sysbus_send_create(const char *devnode, const char *path) -{ - DBusMessage* message; - DBusMessageIter iter; - - /* object, interface, member */ - message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", - "org.kernel.udev.NodeMonitor", - "NodeCreated"); - - dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, devnode); - dbus_message_iter_append_string(&iter, path); - - if ( !dbus_connection_send(sysbus_connection, message, NULL) ) - dbg("error sending d-bus signal"); - - dbus_message_unref(message); - - dbus_connection_flush(sysbus_connection); -} - -/** Send out a signal that a device node is deleted - * - * @param devnode Name of the device node, e.g. /udev/sda1 - * @param path Sysfs path of device - */ -static void sysbus_send_remove(const char *devnode, const char *path) -{ - DBusMessage* message; - DBusMessageIter iter; - - /* object, interface, member */ - message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", - "org.kernel.udev.NodeMonitor", - "NodeDeleted"); - - dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, devnode); - dbus_message_iter_append_string(&iter, path); - - if ( !dbus_connection_send(sysbus_connection, message, NULL) ) - dbg("error sending d-bus signal"); - - dbus_message_unref(message); - - dbus_connection_flush(sysbus_connection); -} - -int main(int argc, char *argv[], char *envp[]) -{ - char *action; - char *devpath; - char *devnode; - int retval = 0; - - init_logging("udev_dbus"); - - sysbus_connect(); - if (sysbus_connection == NULL) - return 0; - - action = get_action(); - if (!action) { - dbg("no action?"); - goto exit; - } - devpath = get_devpath(); - if (!devpath) { - dbg("no devpath?"); - goto exit; - } - devnode = get_devnode(); - if (!devnode) { - dbg("no devnode?"); - goto exit; - } - - if (strcmp(action, "add") == 0) { - sysbus_send_create(devnode, devpath); - } else { - if (strcmp(action, "remove") == 0) { - sysbus_send_remove(devnode, devpath); - } else { - dbg("unknown action '%s'", action); - retval = -EINVAL; - } - } - -exit: - sysbus_disconnect(); - return retval; -} -- cgit v1.2.3-54-g00ecf From 886069394932f45b43d400289c2761600aa0727b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:39:33 -0800 Subject: [PATCH] remove dbus stuff from main Makefile Not needed now that it's in extras. --- Makefile | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 219ce2cbf0..65d870bf97 100644 --- a/Makefile +++ b/Makefile @@ -25,10 +25,6 @@ USE_LOG = true # Leave this set to `false' for production use. DEBUG = false -# Set the following to `true' to make udev emit a D-BUS signal when a -# new node is created. -USE_DBUS = false - ROOT = udev DAEMON = udevd @@ -55,7 +51,6 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin mandir = ${prefix}/usr/share/man hotplugdir = ${etcdir}/hotplug.d/default -dbusdir = ${etcdir}/dbus-1/system.d configdir = ${etcdir}/udev/ initdir = ${etcdir}/init.d/ srcdir = . @@ -226,13 +221,6 @@ ifeq ($(strip $(USE_KLIBC)),true) OBJS += klibc_fixups.o endif -ifeq ($(USE_DBUS), true) - CFLAGS += -DUSE_DBUS - CFLAGS += $(shell pkg-config --cflags dbus-1) - LDFLAGS += $(shell pkg-config --libs dbus-1) - OBJS += udev_dbus.o -endif - # if USE_SELINUX is enabled, then we do not strip or optimize ifeq ($(strip $(USE_SELINUX)),true) CFLAGS += -DUSE_SELINUX @@ -345,20 +333,6 @@ small_release: $(DISTFILES) clean @echo "Built $(RELEASE_NAME).tar.gz" -ifeq ($(USE_DBUS), true) -install-dbus-policy: - $(INSTALL) -d $(DESTDIR)$(dbusdir) - $(INSTALL_DATA) etc/dbus-1/system.d/udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) - -uninstall-dbus-policy: - - rm $(DESTDIR)$(dbusdir)/udev_sysbus_policy.conf -else -install-dbus-policy: - - -uninstall-dbus-policy: - - -endif - install-initscript: etc/init.d/udev etc/init.d/udev.debian etc/init.d/udev.init.LSB @if [ -f /etc/redhat-release ]; then \ $(INSTALL_DATA) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ @@ -383,7 +357,7 @@ install-config: $(GEN_CONFIGS) $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir); \ fi -install: install-initscript install-config install-dbus-policy all +install: install-initscript install-config all $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) @@ -409,7 +383,7 @@ endif -C $$target $@ ; \ done ; \ -uninstall: uninstall-dbus-policy +uninstall: - rm $(hotplugdir)/udev.hotplug - rm $(configdir)/udev.permissions - rm $(configdir)/udev.rules -- cgit v1.2.3-54-g00ecf From 6fb7313bad16334c4b7bc742ee8cc9416ed1d78e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 21:42:40 -0800 Subject: [PATCH] fix dbus build in the udev.spec file. --- udev.spec | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/udev.spec b/udev.spec index 017affbc36..a0cd75a608 100644 --- a/udev.spec +++ b/udev.spec @@ -11,11 +11,6 @@ # Note, it is not recommend if you use klibc to enable logging. %define log 0 -# if we want to build DBUS support in or not. -# 0 - no DBUS support -# 1 - DBUS support -%define dbus 0 - # if we want to build SELinux support in or not. # 0 - no SELinux support # 1 - SELinux support @@ -27,6 +22,11 @@ # 1 - debugging enabled %define debug 0 +# if we want to build the DBUS "extra package or not +# 0 - no DBUS support +# 1 - DBUS support +%define dbus 0 + # if we want to build the scsi_id "extra" package or not # 0 - do not build the package # 1 - build it @@ -62,11 +62,6 @@ make CC="gcc $RPM_OPT_FLAGS" \ %else USE_LOG=false \ %endif -%if %{dbus} - USE_DBUS=true \ -%else - USE_DBUS=false \ -%endif %if %{selinux} USE_SELINUX=true \ %else @@ -81,15 +76,13 @@ make CC="gcc $RPM_OPT_FLAGS" \ %if %{scsi_id} extras/scsi_id \ %endif +%if %{dbus} + extras/dbus \ +%endif " %install make DESTDIR=$RPM_BUILD_ROOT install \ -%if %{dbus} - USE_DBUS=true \ -%else - USE_DBUS=false \ -%endif %if %{selinux} USE_SELINUX=true \ %else @@ -99,6 +92,9 @@ make DESTDIR=$RPM_BUILD_ROOT install \ %if %{scsi_id} extras/scsi_id \ %endif +%if %{dbus} + extras/dbus \ +%endif " %post @@ -143,6 +139,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Wed Mar 24 2004 Greg Kroah-Hartman +- change the way dbus support is built (now an extra) + * Tue Mar 2 2004 Greg Kroah-Hartman - added udevstart to the list of files installed - udevinfo is now in /usr/bin not /sbin -- cgit v1.2.3-54-g00ecf From 0384e43ad9cfb85cc32ab926d1780a05ca3ab1dc Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 22:41:45 -0800 Subject: [PATCH] move udev_selinux into extras/selinux --- extras/selinux/Makefile | 59 ++++++++++++++++++++++++++++++++++ extras/selinux/udev_selinux.c | 72 ++++++++++++++++++++++++++++++++++++++++++ udev_selinux.c | 73 ------------------------------------------- 3 files changed, 131 insertions(+), 73 deletions(-) create mode 100644 extras/selinux/Makefile create mode 100644 extras/selinux/udev_selinux.c delete mode 100644 udev_selinux.c diff --git a/extras/selinux/Makefile b/extras/selinux/Makefile new file mode 100644 index 0000000000..813756700b --- /dev/null +++ b/extras/selinux/Makefile @@ -0,0 +1,59 @@ +# Makefile for udev_selinux +# +# Copyright (C) 2004 Greg Kroah-Hartman +# +# 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. +# + +# Set the following to control the use of syslog +# Set it to `false' to remove all logging +USE_LOG = true + +# Set the following to `true' to log the debug +# and make a unstripped, unoptimized binary. +# Leave this set to `false' for production use. +DEBUG = false + +PROG = udev_selinux + +DESTDIR = + +# override this to make udev look in a different location for it's config files +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +mandir = ${prefix}/usr/share/man +hotplugdir = ${etcdir}/hotplug.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +all: $(PROG) + +OBJS = udev_selinux.o + +override CFLAGS += -DUSE_SELINUX +override LIB_OBJS += -lselinux + +$(PROG): $(OBJS) + $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) ../../udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + + +install: all + +uninstall: + diff --git a/extras/selinux/udev_selinux.c b/extras/selinux/udev_selinux.c new file mode 100644 index 0000000000..bbbdd6ba53 --- /dev/null +++ b/extras/selinux/udev_selinux.c @@ -0,0 +1,72 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../udev_lib.h" +#include "../../logging.h" + +#ifdef LOG +unsigned char logname[LOGNAME_SIZE]; +void log_message(int level, const char *format, ...) +{ + va_list args; + + if (!udev_log) + return; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif + +void selinux_add_node(char *filename) +{ + int retval; + + if (is_selinux_enabled() > 0) { + security_context_t scontext; + retval = matchpathcon(filename, 0, &scontext); + if (retval < 0) { + dbg("matchpathcon(%s) failed\n", filename); + } else { + retval=setfilecon(filename,scontext); + if (retval < 0) + dbg("setfiles %s failed with error '%s'", + filename, strerror(errno)); + free(scontext); + } + } +} + +int main(int argc, char *argv[], char *envp[]) +{ + char *action; + char *devpath; + char *devnode; + int retval = 0; + + init_logging("udev_selinux"); + + action = get_action(); + if (!action) { + dbg("no action?"); + goto exit; + } + devnode = get_devnode(); + if (!devnode) { + dbg("no devnode?"); + goto exit; + } + + if (strcmp(action, "add") == 0) + selinux_add_node(devnode); + +exit: + return retval; +} diff --git a/udev_selinux.c b/udev_selinux.c deleted file mode 100644 index 723af9a02f..0000000000 --- a/udev_selinux.c +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_lib.h" -#include "logging.h" - -#ifdef LOG -unsigned char logname[LOGNAME_SIZE]; -void log_message(int level, const char *format, ...) -{ - va_list args; - - if (!udev_log) - return; - - va_start(args, format); - vsyslog(level, format, args); - va_end(args); -} -#endif - -void selinux_add_node(char *filename) -{ - int retval; - - if (is_selinux_enabled() > 0) { - security_context_t scontext; - retval = matchpathcon(filename, 0, &scontext); - if (retval < 0) { - dbg("matchpathcon(%s) failed\n", filename); - } else { - retval=setfilecon(filename,scontext); - if (retval < 0) - dbg("setfiles %s failed with error '%s'", - filename, strerror(errno)); - free(scontext); - } - } -} - -int main(int argc, char *argv[], char *envp[]) -{ - char *action; - char *devpath; - char *devnode; - int retval = 0; - - init_logging("udev_selinux"); - - action = get_action(); - if (!action) { - dbg("no action?"); - goto exit; - } - devnode = get_devnode(); - if (!devnode) { - dbg("no devnode?"); - goto exit; - } - - if (strcmp(action, "add") == 0) - selinux_add_node(devnode); - -exit: - return retval; -} -- cgit v1.2.3-54-g00ecf From 7e2fb86463fd6f09125d73c5eb110842511ad04e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 22:46:29 -0800 Subject: [PATCH] remove selinux stuff from the main Makefile --- Makefile | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Makefile b/Makefile index 65d870bf97..4481ee1bfa 100644 --- a/Makefile +++ b/Makefile @@ -221,14 +221,6 @@ ifeq ($(strip $(USE_KLIBC)),true) OBJS += klibc_fixups.o endif -# if USE_SELINUX is enabled, then we do not strip or optimize -ifeq ($(strip $(USE_SELINUX)),true) - CFLAGS += -DUSE_SELINUX - OBJS += udev_selinux.o - LIB_OBJS += -lselinux -endif - - # header files automatically generated GEN_HEADERS = udev_version.h -- cgit v1.2.3-54-g00ecf From 5476249ffd3239cbfad91999db3917dc292b158f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 22:47:15 -0800 Subject: [PATCH] remove USE_DBUS and USE_SELINUX flags from the README as they are no longer present. --- README | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/README b/README index 75d642c942..508566b50a 100644 --- a/README +++ b/README @@ -44,16 +44,6 @@ To use: what udev is doing. This is enabled by default. Note, if you are building udev against klibc it is recommended that you disable this option (due to klibc's syslog implementation.) - USE_DBUS - if set to 'true', DBUS messages will be sent everytime udev - creates or removes a device node. This requires that DBUS - development headers and libraries be present on your system to - build properly. Default value is 'false'. - USE_SELINUX - if set to 'true', SELinux support for udev will be built in. - This requires that SELinux development headers and libraries be - present on your system to build properly. Default value is - 'false'. DEBUG if set to 'true', debugging messages will be sent to the syslog as udev is run. Default value is 'false'. @@ -98,8 +88,3 @@ know by sending a message to the linux-hotplug-devel mailing list at: greg k-h greg@kroah.com - - - - - -- cgit v1.2.3-54-g00ecf From b658bc09a1ae34f57d7719ecad74caf571d5cdf8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 22:49:03 -0800 Subject: [PATCH] fixed up udev.spec to handle selinux stuff properly now. --- udev.spec | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/udev.spec b/udev.spec index a0cd75a608..8e6c16d6b2 100644 --- a/udev.spec +++ b/udev.spec @@ -11,22 +11,22 @@ # Note, it is not recommend if you use klibc to enable logging. %define log 0 -# if we want to build SELinux support in or not. -# 0 - no SELinux support -# 1 - SELinux support -%define selinux 0 - # if we want to enable debugging support in udev. If it is enabled, lots of # stuff will get sent to the debug syslog. # 0 - debugging disabled # 1 - debugging enabled %define debug 0 -# if we want to build the DBUS "extra package or not +# if we want to build the DBUS "extra" package or not # 0 - no DBUS support # 1 - DBUS support %define dbus 0 +# if we want to build the SELinux "extra" package or not +# 0 - no SELinux support +# 1 - SELinux support +%define selinux 0 + # if we want to build the scsi_id "extra" package or not # 0 - do not build the package # 1 - build it @@ -62,11 +62,6 @@ make CC="gcc $RPM_OPT_FLAGS" \ %else USE_LOG=false \ %endif -%if %{selinux} - USE_SELINUX=true \ -%else - USE_SELINUX=false \ -%endif %if %{debug} DEBUG=true \ %else @@ -79,15 +74,13 @@ make CC="gcc $RPM_OPT_FLAGS" \ %if %{dbus} extras/dbus \ %endif +%if %{selinux} + extras/selinux \ +%endif " %install make DESTDIR=$RPM_BUILD_ROOT install \ -%if %{selinux} - USE_SELINUX=true \ -%else - USE_SELINUX=false \ -%endif EXTRAS=" \ %if %{scsi_id} extras/scsi_id \ @@ -95,6 +88,9 @@ make DESTDIR=$RPM_BUILD_ROOT install \ %if %{dbus} extras/dbus \ %endif +%if %{selinux} + extras/selinux \ +%endif " %post @@ -140,7 +136,7 @@ rm -rf $RPM_BUILD_ROOT %changelog * Wed Mar 24 2004 Greg Kroah-Hartman -- change the way dbus support is built (now an extra) +- change the way dbus and selinux support is built (now an extra) * Tue Mar 2 2004 Greg Kroah-Hartman - added udevstart to the list of files installed -- cgit v1.2.3-54-g00ecf From 3e33961b4557f9b709c901b4aa77dfe0220222bd Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 23:11:08 -0800 Subject: [PATCH] added RFC-dev.d document detailing how /etc/dev.d/ works. --- docs/RFC-dev.d | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 docs/RFC-dev.d diff --git a/docs/RFC-dev.d b/docs/RFC-dev.d new file mode 100644 index 0000000000..4985e841be --- /dev/null +++ b/docs/RFC-dev.d @@ -0,0 +1,49 @@ + /etc/dev.d/ How it works, and what it is for + + by Greg Kroah-Hartman March 2004 + +The /etc/dev.d directory works much like the /etc/hotplug.d/ directory +in that it is a place to put symlinks or programs that get called when +an event happens in the system. Programs will get called whenever the +device naming program in the system has either named a new device and +created a /dev node for it, or when a /dev node has been removed from +the system due to a device being removed. + +The directory tree under /etc/dev.d/ dictate which program is run first, +and when some programs will be run or not. The device naming program +calls the programs in the following order: + /etc/dev.d/DEVNODE/*.dev + /etc/dev.d/SUBSYSTEM/*.dev + /etc/dev.d/default/*.dev + +The .dev extension is needed to allow automatic package managers to +deposit backup files in these directories safely. + +The DEVNODE name is the name of the /dev file that has been created. +This value, including the /dev path, will also be exported to userspace +in the DEVNODE environment variable. + +The SUBSYSTEM name is the name of the sysfs subsystem that originally +generated the hotplug event that caused the device naming program to +create or remove the /dev node originally. This value is passed to +userspace as the first argument to the program. + +The default directory will always be run, to enable programs to catch +every device add and remove in a single place. + +All environment variables that were originally passed by the hotplug +call that caused this device action will also be passed to the program +called in the /etc/dev.d/ directories. Examples of these variables are +ACTION, DEVPATH, and others. See the hotplug documentation for full +description of this + +An equivalent shell script that would do this same kind of action would +be: + DIR="/etc/dev.d" + export DEVNODE="whatever_dev_name_udev_just_gave" + for I in "${DIR}/$DEVNODE/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do + if [ -f $I ]; then $I $1 ; fi + done + exit 1; + + -- cgit v1.2.3-54-g00ecf From f61d732a02c8a5e11c39651a70e3e3fd00529495 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 24 Mar 2004 23:19:39 -0800 Subject: [PATCH] hmm, handle net devices with udev? Hmm, Arndt Bergmann sent a patch like this one a few weeks ago and I want to bring the question back, if we want to handle net device naming with udev. With this patch it is actually possible to specify something like this in udev.rules: KERNEL="dummy*", SYSFS{address}="00:00:00:00:00:00", SYSFS{features}="0x0", NAME="blind%n" KERNEL="eth*", SYSFS{address}="00:0d:60:77:30:91", NAME="private" and you will get: [root@pim udev.kay]# cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 1500 30 0 0 0 0 0 0 1500 30 0 0 0 0 0 0 private: 278393 1114 0 0 0 0 0 0 153204 1468 0 0 0 0 0 0 sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 blind0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 The udevinfo program is also working: [root@pim udev.kay]# ./udevinfo -a -p /sys/class/net/private looking at class device '/sys/class/net/private': SYSFS{addr_len}="6" SYSFS{address}="00:0d:60:77:30:91" SYSFS{broadcast}="ff:ff:ff:ff:ff:ff" SYSFS{features}="0x3a9" SYSFS{flags}="0x1003" SYSFS{ifindex}="2" SYSFS{iflink}="2" SYSFS{mtu}="1500" SYSFS{tx_queue_len}="1000" SYSFS{type}="1" follow the class device's "device" looking at the device chain at '/sys/devices/pci0000:00/0000:00:1e.0/0000:02:01.0': BUS="pci" ID="0000:02:01.0" SYSFS{class}="0x020000" SYSFS{detach_state}="0" SYSFS{device}="0x101e" SYSFS{irq}="11" SYSFS{subsystem_device}="0x0549" SYSFS{subsystem_vendor}="0x1014" SYSFS{vendor}="0x8086" The matching device will be renamed to the given name. The device name will not be put into the udev database, cause the kernel renames the device and the sysfs name disappears. I like it, cause it plugs in nicely. We have all the naming features and sysfs queries and walks inside of udev. The sysfs timing races are already solved and the management tools are working for net devices too. nameif can only match the MAC address now. udev can match any sysfs value of the device tree the net device is connected to. But right, net devices do not have device nodes :) --- namedev.c | 10 +++++ test/udev-test.pl | 110 +++++++++++++++++++++++++++--------------------------- udev-add.c | 86 +++++++++++++++++++++++++++++++++--------- udev-remove.c | 42 ++++++++++++++------- udev.c | 26 ++++++------- udev_lib.c | 16 ++++++++ udev_lib.h | 1 + udevinfo.c | 24 +++++++----- 8 files changed, 207 insertions(+), 108 deletions(-) diff --git a/namedev.c b/namedev.c index b9d8a3db2c..f2aea34719 100644 --- a/namedev.c +++ b/namedev.c @@ -836,12 +836,22 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } } + /* no rule was found for the net device */ + if (udev->type == 'n') { + dbg("no name for net device '%s' configured", udev->kernel_name); + return -1; + } + /* no rule was found so we use the kernel name */ strfieldcpy(udev->name, udev->kernel_name); goto done; found: apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); + + if (udev->type == 'n') + return 0; + udev->partitions = dev->partitions; strfieldcpy(udev->config_file, dev->config_file); udev->config_line = dev->config_line; diff --git a/test/udev-test.pl b/test/udev-test.pl index d93ebb9cc3..8ae01c31d4 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -35,7 +35,7 @@ my @tests = ( { desc => "label test of scsi disc", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "boot_disk" , conf => < "label test of scsi partition", subsys => "block", - devpath => "block/sda/sda1", + devpath => "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "label test of pattern match", subsys => "block", - devpath => "block/sda/sda1", + devpath => "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "label test of multiple sysfs files", subsys => "block", - devpath => "block/sda/sda1", + devpath => "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "label test of max sysfs files", subsys => "block", - devpath => "block/sda/sda1", + devpath => "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "catch device by *", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "catch device by * - take 2", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "catch device by ?", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "catch device by character class", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "replace kernel name", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "Handle comment lines in config file (and replace kernel name)", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "Handle comment lines in config file with whitespace (and replace kernel name)", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "Handle empty lines in config file (and replace kernel name)", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "subdirectory handling", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "sub/direct/ory/visor" , conf => < "place on bus of scsi partition", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "first_disk3" , conf => < "test NAME substitution chars", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "test NAME substitution chars (with length limit)", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "M8-m3-n3-b0:0-sIBM" , conf => < "old style SYSFS_ attribute", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "good" , conf => < "sustitution of sysfs value (%s{file})", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "disk-IBM-ESXS-sda" , conf => < "program result substitution", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "special-device-3" , conf => < "program result substitution", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "test-0:0:0:0" , conf => < "program with escaped format char (tricky: callout returns format char!)", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "escape-3" , conf => < "program with lots of arguments", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "foo9" , conf => < "program with subshell", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "bar9" , conf => < "program arguments combined with apostrophes", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "foo7" , conf => < "characters before the %c{N} substitution", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "my-foo9" , conf => < "substitute the second to last argument", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "my-foo8" , conf => < "program result substitution (numbered part of)", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "link1" , conf => < "program result substitution (numbered part of+)", subsys => "block", - devpath => "block/sda/sda3", + devpath => "/block/sda/sda3", exp_name => "link3" , conf => < "invalid program for device with no bus", subsys => "tty", - devpath => "class/tty/console", + devpath => "/class/tty/console", exp_name => "TTY" , conf => < "valid program for device with no bus", subsys => "tty", - devpath => "class/tty/console", + devpath => "/class/tty/console", exp_name => "foo" , conf => < "invalid label for device with no bus", subsys => "tty", - devpath => "class/tty/console", + devpath => "/class/tty/console", exp_name => "TTY" , conf => < "valid label for device with no bus", subsys => "tty", - devpath => "class/tty/console", + devpath => "/class/tty/console", exp_name => "foo" , conf => < "program and bus type match", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "scsi-0:0:0:0" , conf => < "symlink creation (same directory)", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor0" , conf => < "symlink creation (relative link back)", subsys => "block", - devpath => "block/sda/sda2", + devpath => "/block/sda/sda2", exp_name => "1/2/a/b/symlink" , conf => < "symlink creation (relative link forward)", subsys => "block", - devpath => "block/sda/sda2", + devpath => "/block/sda/sda2", exp_name => "1/2/symlink" , conf => < "symlink creation (relative link back and forward)", subsys => "block", - devpath => "block/sda/sda2", + devpath => "/block/sda/sda2", exp_name => "1/2/c/d/symlink" , conf => < "multiple symlinks", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "second-0" , conf => < "create all possible partitions", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "boot_disk15" , conf => < "sysfs parent hierarchy", subsys => "tty", - devpath => "class/tty/ttyUSB0", + devpath => "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "name test with ! in the name", subsys => "block", - devpath => "block/rd!c0d0", + devpath => "/block/rd!c0d0", exp_name => "rd/c0d0" , conf => < "name test with ! in the name, but no matching rule", subsys => "block", - devpath => "block/rd!c0d0", + devpath => "/block/rd!c0d0", exp_name => "rd/c0d0" , conf => < "ID rule", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "ID wildcard all", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "ID wildcard partial", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "ID wildcard partial 2", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "ignore SYSFS attribute whitespace", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "ignored", conf => < "do not ignore SYSFS attribute whitespace", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "matched-with-space", conf => < "SYMLINK only rule", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "symlink-only2", conf => < "permissions test", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "node", exp_perms => "5000::0444", conf => < "major/minor number test", subsys => "block", - devpath => "block/sda", + devpath => "/block/sda", exp_name => "node", exp_majorminor => "8:0", conf => < "big minor number test", subsys => "i2c-dev", - devpath => "class/i2c-dev/i2c-300", + devpath => "/class/i2c-dev/i2c-300", exp_name => "node", exp_majorminor => "89:300", conf => < "big major number test", subsys => "i2c-dev", - devpath => "class/i2c-dev/i2c-fake1", + devpath => "/class/i2c-dev/i2c-fake1", exp_name => "node", exp_majorminor => "4095:1", conf => < "big major and big minor number test", subsys => "i2c-dev", - devpath => "class/i2c-dev/i2c-fake2", + devpath => "/class/i2c-dev/i2c-fake2", exp_name => "node", exp_majorminor => "4094:89999", conf => < #include #include +#include +#include +#include +#include #ifndef __KLIBC__ #include #include @@ -342,16 +346,16 @@ exit: /* wait for the "dev" file to show up in the directory in sysfs. * If it doesn't happen in about 10 seconds, give up. */ -#define SECONDS_TO_WAIT_FOR_DEV 10 -static int sleep_for_dev(char *path) +#define SECONDS_TO_WAIT_FOR_FILE 10 +static int sleep_for_file(char *path, char* file) { char filename[SYSFS_PATH_MAX + 6]; - int loop = SECONDS_TO_WAIT_FOR_DEV; + int loop = SECONDS_TO_WAIT_FOR_FILE; int retval; strfieldcpy(filename, sysfs_path); strfieldcat(filename, path); - strfieldcat(filename, "/dev"); + strfieldcat(filename, file); while (loop--) { struct stat buf; @@ -369,6 +373,30 @@ exit: return retval; } +static int rename_net_if(struct udevice *dev) +{ + int sk; + struct ifreq ifr; + int retval; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) { + dbg("error opening socket"); + return -1; + } + + memset(&ifr, 0x00, sizeof(struct ifreq)); + strfieldcpy(ifr.ifr_name, dev->kernel_name); + strfieldcpy(ifr.ifr_newname, dev->name); + + dbg("changing net interface name from '%s' to '%s'", dev->kernel_name, dev->name); + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval != 0) + dbg("error changing net interface name"); + + return retval; +} + int udev_add_device(char *path, char *subsystem, int fake) { struct sysfs_class_device *class_dev = NULL; @@ -378,39 +406,61 @@ int udev_add_device(char *path, char *subsystem, int fake) memset(&dev, 0x00, sizeof(dev)); /* for now, the block layer is the only place where block devices are */ - if (strcmp(subsystem, "block") == 0) - dev.type = 'b'; - else - dev.type = 'c'; - retval = sleep_for_dev(path); - if (retval != 0) - goto exit; + dev.type = get_device_type(path, subsystem); + + switch (dev.type) { + case 'b': + case 'c': + retval = sleep_for_file(path, "/dev"); + break; + + case 'n': + retval = sleep_for_file(path, "/address"); + break; + + default: + dbg("unknown device type '%c'", dev.type); + retval = -EINVAL; + } class_dev = get_class_dev(path); if (class_dev == NULL) goto exit; - retval = get_major_minor(class_dev, &dev); - if (retval != 0) { - dbg("get_major_minor failed"); - goto exit; + if (dev.type == 'b' || dev.type == 'c') { + retval = get_major_minor(class_dev, &dev); + if (retval != 0) { + dbg("get_major_minor failed"); + goto exit; + } } retval = namedev_name_device(class_dev, &dev); if (retval != 0) goto exit; - if (!fake) { + if (!fake && (dev.type == 'b' || dev.type == 'c')) { retval = udevdb_add_dev(path, &dev); if (retval != 0) dbg("udevdb_add_dev failed, but we are going to try " "to create the node anyway. But remove might not " "work properly for this device."); - } + dbg("name='%s'", dev.name); - retval = create_node(&dev, fake); + switch (dev.type) { + case 'b': + case 'c': + retval = create_node(&dev, fake); + break; + + case 'n': + retval = rename_net_if(&dev); + if (retval != 0) + dbg("net device naming failed"); + break; + } if ((retval == 0) && (!fake)) dev_d_send(&dev, subsystem); diff --git a/udev-remove.c b/udev-remove.c index 41636b684e..98c45d6c33 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -135,22 +135,38 @@ int udev_remove_device(char *path, char *subsystem) char *temp; int retval; - memset(&dev, 0, sizeof(dev)); + memset(&dev, 0x00, sizeof(dev)); - retval = udevdb_get_dev(path, &dev); - if (retval) { - dbg("'%s' not found in database, falling back on default name", path); - temp = strrchr(path, '/'); - if (temp == NULL) - return -ENODEV; - strfieldcpy(dev.name, &temp[1]); - } + dev.type = get_device_type(path, subsystem); + + switch (dev.type) { + case 'b': + case 'c': + retval = udevdb_get_dev(path, &dev); + if (retval) { + dbg("'%s' not found in database, falling back on default name", path); + temp = strrchr(path, '/'); + if (temp == NULL) + return -ENODEV; + strfieldcpy(dev.name, &temp[1]); + } - dbg("name is '%s'", dev.name); - udevdb_delete_dev(path); + dbg("name='%s'", dev.name); + udevdb_delete_dev(path); - dev_d_send(&dev, subsystem); + dev_d_send(&dev, subsystem); + + retval = delete_node(&dev); + break; + + case 'n': + retval = 0; + break; + + default: + dbg("unknown device type '%c'", dev.type); + retval = -EINVAL; + } - retval = delete_node(&dev); return retval; } diff --git a/udev.c b/udev.c index 52b98c8d45..192bed97d8 100644 --- a/udev.c +++ b/udev.c @@ -68,7 +68,6 @@ static void sig_handler(int signum) } static char *subsystem_blacklist[] = { - "net", "scsi_host", "scsi_device", "usb_host", @@ -85,6 +84,7 @@ static int udev_hotplug(void) int retval = -EINVAL; int i; struct sigaction act; + const int nofake = 0; action = get_action(); if (!action) { @@ -137,23 +137,23 @@ static int udev_hotplug(void) if (strcmp(action, "add") == 0) { namedev_init(); - retval = udev_add_device(devpath, subsystem, 0); - } else { - if (strcmp(action, "remove") == 0) { - retval = udev_remove_device(devpath, subsystem); - } else { - dbg("unknown action '%s'", action); - retval = -EINVAL; - } + retval = udev_add_device(devpath, subsystem, nofake); + goto action_done; + } + + if (strcmp(action, "remove") == 0) { + retval = udev_remove_device(devpath, subsystem); + goto action_done; } + dbg("unknown action '%s'", action); + retval = -EINVAL; + +action_done: udevdb_exit(); exit: - if (retval > 0) - retval = 0; - - return -retval; + return retval; } int main(int argc, char *argv[], char *envp[]) diff --git a/udev_lib.c b/udev_lib.c index f095513c97..4a9eea506c 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -81,6 +81,22 @@ char *get_subsystem(char *subsystem) return subsystem; } +char get_device_type(const char *path, const char *subsystem) +{ + if (strcmp(subsystem, "block") == 0 || + strstr(path, "/block/") != NULL) + return 'b'; + + if (strcmp(subsystem, "net") == 0 || + strstr(path, "/class/net/") != NULL) + return 'n'; + + if (strstr(path, "/class/") != NULL) + return 'c'; + + return '\0'; +} + int file_map(const char *filename, char **buf, size_t *bufsize) { struct stat stats; diff --git a/udev_lib.h b/udev_lib.h index 5db6b5261a..90a42ffe96 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -71,6 +71,7 @@ extern char *get_devpath(void); extern char *get_devnode(void); extern char *get_seqnum(void); extern char *get_subsystem(char *subsystem); +extern char get_device_type(const char *path, const char *subsystem); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); diff --git a/udevinfo.c b/udevinfo.c index 800882eb1a..b23f9d0aef 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -138,6 +138,10 @@ static int print_device_chain(const char *path) struct sysfs_device *sysfs_dev; struct sysfs_device *sysfs_dev_parent; int retval = 0; + char type; + + type = get_device_type(path, ""); + dbg("device type is %c", type); /* get the class dev */ class_dev = sysfs_open_class_device_path(path); @@ -146,21 +150,23 @@ static int print_device_chain(const char *path) return -1; } - /* read the 'dev' file for major/minor*/ - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr == NULL) { - printf("couldn't get the \"dev\" file\n"); - retval = -1; - goto exit; - } - printf("\nudevinfo starts with the device the node belongs to and then walks up the\n" "device chain, to print for every device found, all possibly useful attributes\n" "in the udev key format.\n" "Only attributes within one device section may be used together in one rule,\n" "to match the device for which the node will be created.\n" "\n"); - printf("device '%s' has major:minor %s", class_dev->path, attr->value); + + if (type == 'b' || type =='c') { + /* read the 'dev' file for major/minor*/ + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr == NULL) { + printf("couldn't get the \"dev\" file\n"); + retval = -1; + goto exit; + } + printf("device '%s' has major:minor %s", class_dev->path, attr->value); + } /* open sysfs class device directory and print all attributes */ printf(" looking at class device '%s':\n", class_dev->path); -- cgit v1.2.3-54-g00ecf From 1f5caf43c88a247d36d1c8362009cda59f3ac729 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 24 Mar 2004 23:31:04 -0800 Subject: [PATCH] actually have udev run files ending in .dev in the /etc/dev.d/ directory as documented. --- dev_d.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dev_d.c b/dev_d.c index 36bee33bd9..9412c3da77 100644 --- a/dev_d.c +++ b/dev_d.c @@ -36,6 +36,7 @@ #include "logging.h" #define HOTPLUGDIR "/etc/dev.d" +#define SUFFIX ".dev" #define COMMENT_PREFIX '#' static void run_program(char *name) @@ -64,7 +65,8 @@ static void execute_dir (char *dirname) { DIR *directory; struct dirent *entry; - char filename[256]; + char filename[NAME_SIZE]; + int name_len; dbg("opening %s", dirname); directory = opendir(dirname); @@ -80,6 +82,13 @@ static void execute_dir (char *dirname) (entry->d_name[0] == COMMENT_PREFIX)) continue; + /* Nor do we run files that do not end in ".dev" */ + name_len = strlen(entry->d_name); + if (name_len < strlen(SUFFIX)) + continue; + if (strcmp(&entry->d_name[name_len - sizeof (SUFFIX) + 1], SUFFIX) != 0) + continue; + /* FIXME - need to use file_list_insert() here to run these in sorted order... */ snprintf(filename, sizeof(filename), "%s%s", dirname, entry->d_name); filename[sizeof(filename)-1] = '\0'; -- cgit v1.2.3-54-g00ecf From df73b398de73acbf9f9b0e49b872968460f1eb28 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 25 Mar 2004 00:03:28 -0800 Subject: [PATCH] create the /etc/dev.d/ directories in 'make install' --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 4481ee1bfa..94b873d2f7 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,7 @@ mandir = ${prefix}/usr/share/man hotplugdir = ${etcdir}/hotplug.d/default configdir = ${etcdir}/udev/ initdir = ${etcdir}/init.d/ +dev_ddir = ${etcdir}/dev.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -349,7 +350,11 @@ install-config: $(GEN_CONFIGS) $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir); \ fi -install: install-initscript install-config all +install-dev.d: + $(INSTALL) -d $(DESTDIR)$(dev_ddir) + $(INSTALL) -d $(DESTDIR)$(dev_ddir)default/ + +install: install-initscript install-config install-dev.d all $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) @@ -393,6 +398,8 @@ uninstall: - rm $(usrbindir)/$(INFO) - rmdir $(hotplugdir) - rmdir $(configdir) + - rmdir $(dev_ddir)default + - rmdir $(dev_ddir) - rm $(udevdir)/.udev.tdb - rmdir $(udevdir) @extras="$(EXTRAS)" ; for target in $$extras ; do \ -- cgit v1.2.3-54-g00ecf From 04b902d5bfff632765688ac0f1c7a19a6ef6e0ea Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 25 Mar 2004 00:08:46 -0800 Subject: [PATCH] v023 release --- ChangeLog | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- Makefile | 2 +- udev.spec | 2 +- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b78b0b9bbd..a9d4f94e06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,55 @@ +Summary of changes from v022 to v023 +============================================ + +Kay Sievers: + o hmm, handle net devices with udev? + o correct apply_format() for symlink only rules + o don't init namedev on remove + o first stupid try for a rule compose gui + o replace fgets() with mmap() and introduce udev_lib.[hc] + o make udevtest a real program :) + +Daniel E. F. Stekloff: + o udevinfo patch + +Greg Kroah-Hartman: + o create the /etc/dev.d/ directories in 'make install' + o actually have udev run files ending in .dev in the /etc/dev.d/ directory as documented + o added RFC-dev.d document detailing how /etc/dev.d/ works + o fixed up udev.spec to handle selinux stuff properly now + o remove USE_DBUS and USE_SELINUX flags from the README as they are no longer present + o remove selinux stuff from the main Makefile + o move udev_selinux into extras/selinux + o fix dbus build in the udev.spec file + o remove dbus stuff from main Makefile + o move udev_dbus to extras/dbus + o udev_dbus can now compile properly, but linnking is another story + o remove udev_dbus.h from Makefile + o first cut at standalone udev_selinux program + o remove selinux support from udev core as it's no longer needed + o first cut at standalone udev_dbus program + o add get_devnode() helper to udev_lib for udev_dbus program + o remove dbus code from core udev code as it's no longer needed to be there + o add /etc/dev.d/ support for udev add and remove events + o fix build error in namedev.c caused by previous patch + o 022_bk tag + o fix 'make spotless' to really do that in klibc + o add a question/answer about automounting usb devices to the FAQ + o mark scsi-devfs.sh as executable + o Increase the name size as requested by Richard Gooch + o fix udevtest to build properly after the big udev_lib change + o 022 release TAG: v022 + +Olaf Hering: + o uninitialized variable for mknod and friend + +Richard Gooch: + o SCSI logical and physical names for udev + +Theodore Y. T'so: + o Trivial man page typo fixes to udev + + Summary of changes from v021 to v022 ============================================ @@ -8,7 +60,7 @@ Summary of changes from v021 to v022 : o fix HOWTO-udev_for_dev for udevdir -: +Kay Sievers: o udev-test.pl cleanup o add dev node test to udev-test.pl o add permission tests diff --git a/Makefile b/Makefile index 94b873d2f7..7b48b91610 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 022_bk +VERSION = 023 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 8e6c16d6b2..2445b40de5 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 022_bk +Version: 023 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From d0dede8f9af8d17d556c969adedd97b40c931920 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 25 Mar 2004 00:14:47 -0800 Subject: [PATCH] fix udev.spec file for where udevtest should be placed. --- udev.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.spec b/udev.spec index 2445b40de5..a780acfa98 100644 --- a/udev.spec +++ b/udev.spec @@ -113,7 +113,7 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /usr/bin/udevinfo %attr(755,root,root) /sbin/udevsend %attr(755,root,root) /sbin/udevd -%attr(755,root,root) /sbin/udevtest +%attr(755,root,root) /usr/bin/udevtest %attr(755,root,root) /sbin/udevstart %attr(755,root,root) %dir /udev/ %attr(755,root,root) %dir /etc/udev/ -- cgit v1.2.3-54-g00ecf From c2818554cee064360b8a3ed543fe30349096a74a Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Sat, 27 Mar 2004 01:21:41 -0800 Subject: [PATCH] small ide-devfs.sh fix The file may not exist and errors would be spewed on the console. --- extras/ide-devfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index e5bf177f8b..22d09d7a5a 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -35,7 +35,7 @@ get_dev_number() { echo $((${num} - 1)) } -if [ -z "$3" ]; then +if [ -z "$3" -a -f /proc/ide/${1}/media ]; then MEDIA=`cat /proc/ide/${1}/media` if [ "${MEDIA}" = "cdrom" ]; then echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` -- cgit v1.2.3-54-g00ecf From 949e32f2249da55890a6a49208023df30b6b5227 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 27 Mar 2004 01:21:43 -0800 Subject: [PATCH] apply all_partitions rule to main block device only Rules with NAME{all_partitions}= are now applied only to the parent of a block device. We no longer need to exclude the partitions or sg* devices. --- namedev.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/namedev.c b/namedev.c index f2aea34719..7b70f8bcdf 100644 --- a/namedev.c +++ b/namedev.c @@ -619,8 +619,8 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de * possibly have a whitelist for these devices here... */ class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent) - dbg("Really a partition"); + if (class_dev_parent != NULL) + dbg("given class device has a parent, use this instead"); tspec.tv_sec = 0; tspec.tv_nsec = 10000000; /* sleep 10 millisec */ @@ -628,24 +628,21 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de while (loop--) { if (udev_sleep) nanosleep(&tspec, NULL); + if (class_dev_parent) sysfs_device = sysfs_get_classdev_device(class_dev_parent); else sysfs_device = sysfs_get_classdev_device(class_dev); - if (sysfs_device != NULL) goto device_found; } dbg("timed out waiting for device symlink, continuing on anyway..."); - + device_found: /* We have another issue with just the wait above - the sysfs part of * the kernel may not be quick enough to have created the link to the * device under the "bus" subsystem. Due to this, the sysfs_device->bus * will not contain the actual bus name :( - * - * Libsysfs now provides a new API sysfs_get_device_bus(), so use it - * if needed */ if (sysfs_device) { if (sysfs_device->bus[0] != '\0') @@ -828,6 +825,11 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } if (dev->name[0] != '\0') { + /* apply all_partitions flag only at a main block device */ + if (dev->partitions > 0 && + (udev->type != 'b' || udev->kernel_number[0] != '\0')) + continue; + info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", dev->config_file, dev->config_line, udev->kernel_name, dev->name); strfieldcpy(udev->name, dev->name); -- cgit v1.2.3-54-g00ecf From 4a539daf1e5daa17b52239478d97f8dc7a6506b6 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 27 Mar 2004 01:21:46 -0800 Subject: [PATCH] dev_d.c file sorting and cleanup On Thu, Mar 25, 2004 at 02:52:13AM +0100, Kay Sievers wrote: > Please have look if it still works for you, I only did a very quick > test. Here is a unified version, with all the functions moved to udev_lib.c. We have a generic function now, to call a given fnct(char *) for every file ending with a specific suffix, sorted in lexical order. We use it to execute the dev.d/ files and read our rules.d/ files. The binary should be a bit smaller now. I've also changed it, to not do the dev.d/ exec for net devices. --- dev_d.c | 114 ++++++++++++++++++-------------------------------------- namedev.h | 4 +- namedev_parse.c | 93 +++++++-------------------------------------- udev-add.c | 6 +-- udev_lib.c | 86 ++++++++++++++++++++++++++++++++++++++++++ udev_lib.h | 1 + udevd.c | 6 +-- udevruler.c | 8 ++-- 8 files changed, 149 insertions(+), 169 deletions(-) diff --git a/dev_d.c b/dev_d.c index 9412c3da77..9bb9507b9b 100644 --- a/dev_d.c +++ b/dev_d.c @@ -1,30 +1,23 @@ /* - * dev.d multipleer + * dev_d.c - dev.d/ multiplexer * * Copyright (C) 2004 Greg Kroah-Hartman * * 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. - * - * Based on the klibc version of hotplug written by: - * Author(s) Christian Borntraeger - * which was based on the shell script written by: - * Greg Kroah-Hartman - * */ -/* +/* * This essentially emulates the following shell script logic in C: - DIR="/etc/dev.d" - export DEVNODE="whatever_dev_name_udev_just_gave" - for I in "${DIR}/$DEVNODE/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do - if [ -f $I ]; then $I $1 ; fi - done - exit 1; + * DIR="/etc/dev.d" + * export DEVNODE="whatever_dev_name_udev_just_gave" + * for I in "${DIR}/$DEVNODE/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do + * if [ -f $I ]; then $I $1 ; fi + * done + * exit 1; */ -#include #include #include #include @@ -35,73 +28,38 @@ #include "udev_lib.h" #include "logging.h" -#define HOTPLUGDIR "/etc/dev.d" -#define SUFFIX ".dev" -#define COMMENT_PREFIX '#' +#define DEVD_DIR "/etc/dev.d/" +#define DEVD_SUFFIX ".dev" -static void run_program(char *name) +static int run_program(char *name) { pid_t pid; dbg("running %s", name); pid = fork(); - - if (pid < 0) { - perror("fork"); - return; - } - - if (pid > 0) { + switch (pid) { + case 0: + /* child */ + execv(name, main_argv); + dbg("exec of child failed"); + exit(1); + case -1: + dbg("fork of child failed"); + break; + return -1; + default: wait(NULL); - return; } - execv(name, main_argv); - exit(1); + return 0; } -static void execute_dir (char *dirname) -{ - DIR *directory; - struct dirent *entry; - char filename[NAME_SIZE]; - int name_len; - - dbg("opening %s", dirname); - directory = opendir(dirname); - if (!directory) - return; - - while ((entry = readdir(directory))) { - if (entry->d_name[0] == '\0') - break; - /* Don't run the files '.', '..', or hidden files, - * or files that start with a '#' */ - if ((entry->d_name[0] == '.') || - (entry->d_name[0] == COMMENT_PREFIX)) - continue; - - /* Nor do we run files that do not end in ".dev" */ - name_len = strlen(entry->d_name); - if (name_len < strlen(SUFFIX)) - continue; - if (strcmp(&entry->d_name[name_len - sizeof (SUFFIX) + 1], SUFFIX) != 0) - continue; - - /* FIXME - need to use file_list_insert() here to run these in sorted order... */ - snprintf(filename, sizeof(filename), "%s%s", dirname, entry->d_name); - filename[sizeof(filename)-1] = '\0'; - run_program(filename); - } - - closedir(directory); -} - -/* runs files in these directories in order: - * name given by udev - * subsystem - * default +/* + * runs files in these directories in order: + * / + * subsystem/ + * default/ */ void dev_d_send(struct udevice *dev, char *subsystem) { @@ -112,15 +70,15 @@ void dev_d_send(struct udevice *dev, char *subsystem) strfieldcat(devnode, dev->name); setenv("DEVNODE", devnode, 1); - snprintf(dirname, sizeof(dirname), HOTPLUGDIR "/%s/", dev->name); - dirname[sizeof(dirname)-1] = '\0'; - execute_dir(dirname); + strcpy(dirname, DEVD_DIR); + strfieldcat(dirname, dev->name); + call_foreach_file(run_program, dirname, DEVD_SUFFIX); - snprintf(dirname, sizeof(dirname), HOTPLUGDIR "/%s/", subsystem); - dirname[sizeof(dirname)-1] = '\0'; - execute_dir(dirname); + strcpy(dirname, DEVD_DIR); + strfieldcat(dirname, subsystem); + call_foreach_file(run_program, dirname, DEVD_SUFFIX); - strcpy(dirname, HOTPLUGDIR "/default/"); - execute_dir(dirname); + strcpy(dirname, DEVD_DIR "default"); + call_foreach_file(run_program, dirname, DEVD_SUFFIX); } diff --git a/namedev.h b/namedev.h index 68100d4f62..fa924b14d9 100644 --- a/namedev.h +++ b/namedev.h @@ -53,8 +53,8 @@ struct sysfs_class_device; #define MAX_SYSFS_PAIRS 5 -#define RULEFILE_EXT ".rules" -#define PERMFILE_EXT ".permissions" +#define RULEFILE_SUFFIX ".rules" +#define PERMFILE_SUFFIX ".permissions" #define set_empty_perms(dev, m, o, g) \ if (dev->mode == 0) \ diff --git a/namedev_parse.c b/namedev_parse.c index f4ffdb21d6..679efae1b5 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -33,7 +33,6 @@ #include #include #include -#include #include #include "udev.h" @@ -41,8 +40,6 @@ #include "logging.h" #include "namedev.h" -LIST_HEAD(file_list); - static int add_config_dev(struct config_device *new_dev) { @@ -416,88 +413,26 @@ exit: return retval; } -struct files { - struct list_head list; - char name[NAME_SIZE]; -}; - -/* sort files in lexical order */ -static int file_list_insert(char *filename) -{ - struct files *loop_file; - struct files *new_file; - - list_for_each_entry(loop_file, &file_list, list) { - if (strcmp(loop_file->name, filename) > 0) { - break; - } - } - - new_file = malloc(sizeof(struct files)); - if (new_file == NULL) { - dbg("error malloc"); - return -ENOMEM; - } - - strfieldcpy(new_file->name, filename); - list_add_tail(&new_file->list, &loop_file->list); - return 0; -} - -/* calls function for file or every file found in directory */ -static int call_foreach_file(int parser (char *f) , char *filename, char *extension) +int namedev_init_rules() { - struct dirent *ent; - DIR *dir; - char *ext; - char file[NAME_SIZE]; struct stat stats; - struct files *loop_file; - struct files *tmp_file; - /* look if we have a plain file or a directory to scan */ - stat(filename, &stats); + stat(udev_rules_filename, &stats); if ((stats.st_mode & S_IFMT) != S_IFDIR) - return parser(filename); - - /* sort matching filename into list */ - dbg("open config as directory '%s'", filename); - dir = opendir(filename); - while (1) { - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - - dbg("found file '%s'", ent->d_name); - ext = strrchr(ent->d_name, '.'); - if (ext == NULL) - continue; - - if (strcmp(ext, extension) == 0) { - dbg("put file in list '%s'", ent->d_name); - file_list_insert(ent->d_name); - } - } - - /* parse every file in the list */ - list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { - strfieldcpy(file, filename); - strfieldcat(file, loop_file->name); - parser(file); - list_del(&loop_file->list); - free(loop_file); - } - - closedir(dir); - return 0; -} - -int namedev_init_rules() -{ - return call_foreach_file(namedev_parse_rules, udev_rules_filename, RULEFILE_EXT); + return namedev_parse_rules(udev_rules_filename); + else + return call_foreach_file(namedev_parse_rules, + udev_rules_filename, RULEFILE_SUFFIX); } int namedev_init_permissions() { - return call_foreach_file(namedev_parse_permissions, udev_permissions_filename, PERMFILE_EXT); + struct stat stats; + + stat(udev_permissions_filename, &stats); + if ((stats.st_mode & S_IFMT) != S_IFDIR) + return namedev_parse_permissions(udev_permissions_filename); + else + return call_foreach_file(namedev_parse_permissions, + udev_permissions_filename, PERMFILE_SUFFIX); } diff --git a/udev-add.c b/udev-add.c index 4aff06e15f..6dfd059105 100644 --- a/udev-add.c +++ b/udev-add.c @@ -393,6 +393,7 @@ static int rename_net_if(struct udevice *dev) retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) dbg("error changing net interface name"); + close(sk); return retval; } @@ -453,6 +454,8 @@ int udev_add_device(char *path, char *subsystem, int fake) case 'b': case 'c': retval = create_node(&dev, fake); + if ((retval == 0) && (!fake)) + dev_d_send(&dev, subsystem); break; case 'n': @@ -462,9 +465,6 @@ int udev_add_device(char *path, char *subsystem, int fake) break; } - if ((retval == 0) && (!fake)) - dev_d_send(&dev, subsystem); - exit: if (class_dev) sysfs_close_class_device(class_dev); diff --git a/udev_lib.c b/udev_lib.c index 4a9eea506c..e9c16c863a 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -21,14 +21,19 @@ #include #include +#include #include #include +#include +#include #include #include #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" +#include "logging.h" #include "udev_lib.h" +#include "list.h" char *get_action(void) @@ -136,3 +141,84 @@ size_t buf_get_line(char *buf, size_t buflen, size_t cur) return count - cur; } +struct files { + struct list_head list; + char name[NAME_SIZE]; +}; + +/* sort files in lexical order */ +static int file_list_insert(char *filename, struct list_head *file_list) +{ + struct files *loop_file; + struct files *new_file; + + list_for_each_entry(loop_file, file_list, list) { + if (strcmp(loop_file->name, filename) > 0) { + break; + } + } + + new_file = malloc(sizeof(struct files)); + if (new_file == NULL) { + dbg("error malloc"); + return -ENOMEM; + } + + strfieldcpy(new_file->name, filename); + list_add_tail(&new_file->list, &loop_file->list); + return 0; +} + +/* calls function for file or every file found in directory */ +int call_foreach_file(int fnct(char *f) , char *dirname, char *suffix) +{ + struct dirent *ent; + DIR *dir; + char *ext; + char file[NAME_SIZE]; + struct files *loop_file; + struct files *tmp_file; + LIST_HEAD(file_list); + + dbg("open directory '%s'", dirname); + dir = opendir(dirname); + if (dir == NULL) { + dbg("unable to open '%s'", dirname); + return -1; + } + + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + + if ((ent->d_name[0] == '.') || (ent->d_name[0] == COMMENT_CHARACTER)) + continue; + + /* look for file with specified suffix */ + ext = strrchr(ent->d_name, '.'); + if (ext == NULL) + continue; + + if (strcmp(ext, suffix) != 0) + continue; + + dbg("put file '%s/%s' in list", dirname, ent->d_name); + file_list_insert(ent->d_name, &file_list); + } + + /* call function for every file in the list */ + list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { + strfieldcpy(file, dirname); + strfieldcat(file, "/"); + strfieldcat(file, loop_file->name); + + fnct(file); + + list_del(&loop_file->list); + free(loop_file); + } + + closedir(dir); + return 0; +} diff --git a/udev_lib.h b/udev_lib.h index 90a42ffe96..e412ba96f4 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -75,6 +75,7 @@ extern char get_device_type(const char *path, const char *subsystem); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); +extern int call_foreach_file(int fnct(char *f) , char *filename, char *extension); #endif diff --git a/udevd.c b/udevd.c index 4cb3e1d405..0757dcaf3d 100644 --- a/udevd.c +++ b/udevd.c @@ -45,9 +45,9 @@ static int expected_seqnum = 0; volatile static int children_waiting; volatile static int msg_q_timeout; -LIST_HEAD(msg_list); -LIST_HEAD(exec_list); -LIST_HEAD(running_list); +static LIST_HEAD(msg_list); +static LIST_HEAD(exec_list); +static LIST_HEAD(running_list); static void exec_queue_manager(void); static void msg_queue_manager(void); diff --git a/udevruler.c b/udevruler.c index b66940e944..af2cf7bb81 100644 --- a/udevruler.c +++ b/udevruler.c @@ -81,8 +81,8 @@ struct device { int added; }; -LIST_HEAD(device_list); -int device_count; +static LIST_HEAD(device_list); +static int device_count; /* callback for database dump */ static int add_record(char *path, struct udevice *udev) @@ -149,8 +149,8 @@ struct attribute { char key[NAME_SIZE]; }; -LIST_HEAD(attribute_list); -int attribute_count; +static LIST_HEAD(attribute_list); +static int attribute_count; static int add_attribute(const char *key, int level) { -- cgit v1.2.3-54-g00ecf From 6d472fe777b237d5843dda9e685f225e2c7341b4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 27 Mar 2004 01:23:21 -0800 Subject: [PATCH] 023_bk mark --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7b48b91610..d0ca3a18d9 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 023 +VERSION = 023_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index a780acfa98..1df59ecdb8 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 023 +Version: 023_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 69b94397d32d8f2ba41a8e2987318b2eb144f673 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 29 Mar 2004 18:33:48 -0800 Subject: [PATCH] fix up udev.rules to handle oss rules better. Patch from Jordan --- etc/udev/udev.rules | 2 +- etc/udev/udev.rules.gentoo | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 370a961de1..725294cede 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -18,7 +18,7 @@ KERNEL="card*", NAME="dri/card%n" KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hw[CD0-9]*", NAME="snd/%k" KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="midiC[D0-9]*", NAME="snd/%k" KERNEL="timer", NAME="snd/%k" KERNEL="seq", NAME="snd/%k" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index f8419a2925..eb72931c3f 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -54,7 +54,7 @@ BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hw[CD0-9]*", NAME="snd/%k" KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="midiC[D0-9]*", NAME="snd/%k" KERNEL="timer", NAME="snd/%k" KERNEL="seq", NAME="snd/%k" @@ -103,12 +103,16 @@ KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" # sound devices -KERNEL="adsp", NAME="sound/adsp", SYMLINK="%k" -KERNEL="audio", NAME="sound/audio", SYMLINK="%k" -KERNEL="dsp", NAME="sound/dsp", SYMLINK="%k" -KERNEL="mixer", NAME="sound/mixer", SYMLINK="%k" -KERNEL="sequencer", NAME="sound/sequencer", SYMLINK="%k" -KERNEL="sequencer2", NAME="sound/sequencer2", SYMLINK="%k" +KERNEL="adsp", NAME="sound/%k", SYMLINK="%k" +KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="audio", NAME="sound/%k", SYMLINK="%k" +KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="dsp", NAME="sound/%k", SYMLINK="%k" +KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="mixer", NAME="sound/%k", SYMLINK="%k" +KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k" +KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k" # tty devices KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From b579916fb53f3916cf27c85072ce87f5b6b84b8b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 29 Mar 2004 18:38:53 -0800 Subject: [PATCH] clean up the gentoo rules file a bit more, adding dri rules. --- etc/udev/udev.rules.gentoo | 51 +++++++++------------------------------------- 1 file changed, 10 insertions(+), 41 deletions(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index eb72931c3f..a0681d7dd9 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -1,44 +1,10 @@ # /etc/udev/udev.rules: device naming rules for udev -# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.rules-018,v 1.2 2004/02/29 11:07:39 azarah Exp $ +# +# Gentoo specific rules, based a bit on devfs rules, but much simpler. # # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. -########################################################### -# -# Add your own rules here (examples are commented) -# -########################################################### - -# Looking for scsi bus id 42:0:0:1 -#BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" - -# A usb camera. -#BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" - -# USB Epson printer to be called lp_epson -#BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" - -# USB HP printer to be called lp_hp -#BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" - -# sound card with PCI bus id 00:0b.0 to be the first sound card -#BUS="pci", ID="00:0b.0", NAME="dsp" - -# sound card with PCI bus id 00:07.1 to be the second sound card -#BUS="pci", ID="00:07.1", NAME="dsp1" - -# USB mouse plugged into the third port of the first hub to be called mouse0 -#BUS="usb", PLACE="1.3", NAME="mouse0" - -# USB tablet plugged into the third port of the second hub to be called mouse1 -#BUS="usb", PLACE="2.3", NAME="mouse1" -#BUS="usb", PLACE="2.4", NAME="mouse2" - -# ttyUSB1 should always be called visor -#KERNEL="ttyUSB1", NAME="visor" -#KERNEL="ttyUSB0", NAME="pl2303" - ########################################################### # @@ -50,6 +16,9 @@ # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" +# DRI devices +KERNEL="card*", NAME="dri/card%n" + # alsa devices KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hw[CD0-9]*", NAME="snd/%k" @@ -75,11 +44,11 @@ KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" # input devices -KERNEL="mice", NAME="input/mice" -KERNEL="mouse[0-9]*", NAME="input/mouse%n" -KERNEL="event[0-9]*", NAME="input/event%n" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" +KERNEL="mice", NAME="input/%k" +KERNEL="mouse*", NAME="input/%k" +KERNEL="event*", NAME="input/%k" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" # loop devices KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From b085ec0d561983a2000e122f005439f154dd96f2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 29 Mar 2004 19:46:40 -0800 Subject: [PATCH] added USB device rules to rules files. --- etc/udev/udev.rules | 5 +++++ etc/udev/udev.rules.devfs | 5 +++++ etc/udev/udev.rules.gentoo | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 725294cede..dd934df850 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -29,3 +29,8 @@ KERNEL="event*", NAME="input/%k" KERNEL="js*", NAME="input/%k" KERNEL="ts*", NAME="input/%k" +# USB devices +KERNEL="hiddev*", NAME="usb/%k" +KERNEL="auer*", NAME="usb/%k" +KERNEL="legousbtower*", NAME="usb/%k" +KERNEL="dabusb*", NAME="usb/%k" diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index 77d3cf5414..c9154e46f3 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -73,3 +73,8 @@ KERNEL="event*", NAME="input/%k" KERNEL="js*", NAME="input/%k" KERNEL="ts*", NAME="input/%k" +# USB devices +KERNEL="hiddev*", NAME="usb/%k" +KERNEL="auer*", NAME="usb/%k" +KERNEL="legousbtower*", NAME="usb/%k" +KERNEL="dabusb*", NAME="usb/%k" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index a0681d7dd9..ced08c9a0b 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -100,3 +100,8 @@ KERNEL="radio[0-9]*", NAME="v4l/radio%n" KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" +# USB devices +KERNEL="hiddev*", NAME="usb/%k" +KERNEL="auer*", NAME="usb/%k" +KERNEL="legousbtower*", NAME="usb/%k" +KERNEL="dabusb*", NAME="usb/%k" -- cgit v1.2.3-54-g00ecf From 150aa5aaf15d4bd37fded470de8e829b34000d97 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 29 Mar 2004 19:52:56 -0800 Subject: [PATCH] add netlink rules to devfs and gentoo rules files. --- etc/udev/udev.rules.devfs | 14 ++++++++++++++ etc/udev/udev.rules.gentoo | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index c9154e46f3..f7903a0d23 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -78,3 +78,17 @@ KERNEL="hiddev*", NAME="usb/%k" KERNEL="auer*", NAME="usb/%k" KERNEL="legousbtower*", NAME="usb/%k" KERNEL="dabusb*", NAME="usb/%k" + +# netlink devices +KERNEL="route", NAME="netlink/%k" +KERNEL="skip", NAME="netlink/%k" +KERNEL="usersock", NAME="netlink/%k" +KERNEL="fwmonitor", NAME="netlink/%k" +KERNEL="tcpdiag", NAME="netlink/%k" +KERNEL="nflog", NAME="netlink/%k" +KERNEL="xfrm", NAME="netlink/%k" +KERNEL="arpd", NAME="netlink/%k" +KERNEL="route6", NAME="netlink/%k" +KERNEL="ip6_fw", NAME="netlink/%k" +KERNEL="dnrtmsg", NAME="netlink/%k" +KERNEL="tap*", NAME="netlink/%k" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index ced08c9a0b..28e92aab1b 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -105,3 +105,17 @@ KERNEL="hiddev*", NAME="usb/%k" KERNEL="auer*", NAME="usb/%k" KERNEL="legousbtower*", NAME="usb/%k" KERNEL="dabusb*", NAME="usb/%k" + +# netlink devices +KERNEL="route", NAME="netlink/%k" +KERNEL="skip", NAME="netlink/%k" +KERNEL="usersock", NAME="netlink/%k" +KERNEL="fwmonitor", NAME="netlink/%k" +KERNEL="tcpdiag", NAME="netlink/%k" +KERNEL="nflog", NAME="netlink/%k" +KERNEL="xfrm", NAME="netlink/%k" +KERNEL="arpd", NAME="netlink/%k" +KERNEL="route6", NAME="netlink/%k" +KERNEL="ip6_fw", NAME="netlink/%k" +KERNEL="dnrtmsg", NAME="netlink/%k" +KERNEL="tap*", NAME="netlink/%k" -- cgit v1.2.3-54-g00ecf From 4012ff38d8b2d9ed145d6867102251f87bdc9a1b Mon Sep 17 00:00:00 2001 From: "maryedie@osdl.org" Date: Wed, 31 Mar 2004 18:11:27 -0800 Subject: [PATCH] add OSDL documentation for persistent naming --- docs/persistent_naming/Testing_scsi_notes.txt | 213 +++++ docs/persistent_naming/udev.rules_1000_scsi_debug | 1014 +++++++++++++++++++++ 2 files changed, 1227 insertions(+) create mode 100644 docs/persistent_naming/Testing_scsi_notes.txt create mode 100644 docs/persistent_naming/udev.rules_1000_scsi_debug diff --git a/docs/persistent_naming/Testing_scsi_notes.txt b/docs/persistent_naming/Testing_scsi_notes.txt new file mode 100644 index 0000000000..5013c87e1d --- /dev/null +++ b/docs/persistent_naming/Testing_scsi_notes.txt @@ -0,0 +1,213 @@ +Using UDEV to do Persistent storage device naming +for large numbers of storage devices +3/16/2004 + +Here are some lessons we learned at OSDL recently on how to use +UDEV (version 021) to do persistent device naming for lots of storage +devices. We used what was available in udev for scsi devices. Here is +an outline of this report: + +Background information - a list of resources we needed to get +started. +Setup - what we needed to create the right enviroment (kernel, +patches, drivers) +How udev works to assign persistent storage device names - +what the documentation didn't tell us. +Performance - A sanity test we ran to compare with and without +persistent naming. + + +BACKGROUND INFORMATION +To get started, here are some references. Review the overview +articles so that the rest of the information makes sense. + +Download the latest udev stuff from: +http://www.kernel.org/pub/linux/utils/kernel/hotplug/ + +mailing list: +linux-hotplug-devel@lists.sourceforge.net + +Here is a nice overview article to get started (warning, this is from +summer 2003 so many items indicated as "todo" have been done and +configuration file name references have sometime changed): +http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf +(also included when you download udev) + +More general info (also included in the udev package): +http://kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ +UDEV version 021 Announcement: +http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=107827264803336&w=2 + +"Managing Dynamic Naming" +http://lwn.net/Articles/28897/ + +If you are a fan of devfs, whatever you do, don't complain until you +read everything you possibly can about udev. This for example: +http://kernel.org/pub/linux/utils/kernel/hotplug/udev_vs_devfs + +You will need to create udev.rules to supply consistent names. (See +etc/udev/udev.rules in the download). This article gives you some +background about udev.rules, but avoids describing the "PROGRAM" +key which is needed for our work. Read it for background: +writing udev rules (current as of udev 018) +http://www.reactivated.net/udevrules.php + +bitkeeper tree: +bk://kernel.bkbits.net/gregkh/udev + +Libsysfs (used to get sysfs information): +http://www-124.ibm.com/linux/papers/libsysfs/libsysfs-linuxconfau2004.pdf + +UDEV works using the way hotplug events are handled by the kernel. +Several overview articles about hotplug include: +Hotplug events +http://lwn.net/Articles/52621/ +Overview of Hotplug +http://linux-hotplug.sourceforge.net/ + +Gentoo centric install info: +http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html + +rpms built against Red Hat FC2-test1 may be available at: +http://kernel.org/pub/linux/utils/kernel/hotplug/udev-021-1.i386.rpm + +with the source rpm at: +http://kernel.org/pub/linux/utils/kernel/hotplug/udev-021-1.src.rpm + + + +SETUP + +Here is a brief checklist of what you need on your system for this to +work: + +Kernel must be a 2.6 kernel + +Must use CONFIG_HOTPLUG kernel config option, since the solution +is based on hotplug capabilities. + +To test more than 256 scsi devices you need a patch to the scsi driver +to support that many (available from IBM or SuSE). To see the patch +we used, see this link: +http://developer.osdl.org/maryedie/DCL/PSDN/lotsofdisks.patch + +Your storage device must support (via the driver) a unique identifier for +persistent device naming. (Adaptec RAID device does not, for +example.) + +Your device driver must support sysfs (new in 2.6 kernel). This is +already done for scsi devices and most if not all block devices. + +A program (scsi_id) exists in the udev download +( extras/scsi_id/scsi_id.c) for scsi devices. It can read the identifier and +is needed for persistent naming. + + +HOW UDEV WORKS TO ASSIGN PERSISTENT NAMES: + +There are three places where device information is stored that udev +uses: +(1) /sys maintained by sysfs +(2) /etc/udev/udev.rules - where you can store the identifier to NAME +mapping information. +(3) The tdb (udev-021/tdb/tdb.c), trivial data base, that is held in +memory and holds the valid system configuration. It is not saved +between one boot to the next. It is constructed at boot time and +updated with configuration changes. + +The persistent names are kept (at least this is one way to do it) in +udev.rules (uuid and NAME), one entry per device. If you want to +initially give your 1000 disk devices a default name and then make +sure those names are preserved, here is how : + +Start with no special entry in udev.rules when do you an initial boot of +your system with disks in place. Udev will assign default names (there +are ways to control what you want for default too). + +Once the names are assigned, use a script supplied for scsi devices - +udev-021/extras/scsi_id/gen_scsi_id_udev_rules.sh +to generate the lines needed for udev.rules, one per device. Each line +indicates the identifier and the NAME it was assigned. You could +optionally create this manually if you prefer other names . + +[example entries in udev.rules for scsi disks] +BUS="scsi", PROGRAM="scsi_id", RESULT="",NAME="" +BUS="scsi", RESULT="",NAME="" +... +BUS="scsi", RESULT="",NAME="" + +(The actual file we used is the file udev.rules_1000_scsi_debug in this +directory ) + +Upon reboot, for each device a hotplug event occurs. The udev.rules +file is scanned looking for the device type (BUS) in this case for "scsi". +The first entry generated by the above program references a +PROGRAM in the key field (scsi_id) which is called to probe the device +and determine the unique identifier. sysfs is used to determine the +major/minor number for the device. The result of the program +execution (the uuid) is compared with the RESULT entry in the same +udev.rules line. + +-If it matches, then the NAME entered on this line is used. The uuid +and major/minor number is saved in tdb (newly recreated upon boot). +That device is created in /udev (the target directory name is +configurable) with the assigned NAME. + +-If it doesn't match, the RESULT (uuid) is preserved for use on the next +udev.rules line as long as the bus type (scsi) is the same. So the result +(the uuid) is compared on the next line, and the next until a match +occurs. + +-If no match occurs, the device will be assigned a default name. + +-Tdb is updated with the resulting name assignment. + + +Thus if the uuid and names are enumerated, they will be found, +assigned, and are therefore permanent. + +If the device is removed from a live system, a hotplug event occurs, +and it is removed from tdb and the /udev entry disappears. + +If it is re-inserted at a new location, the udev.rules file is scanned as +above. The new major/minor number goes in tdb with the uuid , the +name in udev.rules is found again, and the /udev name re-appears. + + + +PERFORMANCE + +Now the question becomes, how much longer does it take to scan the +udev.rules table once there are 1000 entries? + +To test this, we created 1000 "scsi " devices using the scsi debug +device driver supplied in the kernel. When this device driver is loaded +you can specify how many fake scsi devices to create. There is no +real I/O involved but it does respond to some scsi commands. It +simulates the uuid by using the device number assigned when the +device is created. + +Then we auto-generated entries into udev.rules with +gen_scsi_id_udev_rules.sh. We then removed the devices and +reassigned them to simulate a reboot. The delta between assigning +defaults and assigning the names enumerated in the udev.rules file +was 7 seconds (that's for 1000 drives). + +Scripts utilized the feature (described above) that saves the "RESULT" +key after one scsi-id program call for later reference with other +udev.rules entries (so only have one PROGRAM key is the moral of +the story). If you repeated the PROGRAM key, you would +unnecessarily call the program up to 999 times! + +The script that creates udev.rules did not work for 1000 drives (the +input line is too long). We determined that a patch for this already +existed but had not yet been checked in. + + + + + + + + + diff --git a/docs/persistent_naming/udev.rules_1000_scsi_debug b/docs/persistent_naming/udev.rules_1000_scsi_debug new file mode 100644 index 0000000000..e1598cb829 --- /dev/null +++ b/docs/persistent_naming/udev.rules_1000_scsi_debug @@ -0,0 +1,1014 @@ +# +# Start of autogenerated scsi_id rules. Edit the NAME portions of these +# rules to your liking. +# +BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="SSEAGATE ST336704LC 3CD1HVVA00007128JK12", NAME="disk-sda%n" + +# Further RESULT keys use the result of the last PROGRAM rule. +# Be careful not to add any rules containing PROGRAM key between here +# and the end of this section + +BUS="scsi", RESULT="3512345600000afc8", NAME="disk-sdaa%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaaa%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaab%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaac%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdaad%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaae%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaaf%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaag%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaah%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaai%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaaj%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaak%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdaal%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaam%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdaan%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaao%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdaap%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaaq%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaar%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaas%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdaat%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaau%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaav%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaaw%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaax%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaay%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaaz%n" +BUS="scsi", RESULT="3512345600000b3b0", NAME="disk-sdab%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaba%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdabb%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdabc%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdabd%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdabe%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdabf%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdabg%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdabh%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdabi%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdabj%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdabk%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdabl%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdabm%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdabn%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdabo%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdabp%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdabq%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdabr%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdabs%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdabt%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdabu%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdabv%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdabw%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdabx%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaby%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdabz%n" +BUS="scsi", RESULT="3512345600000b798", NAME="disk-sdac%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaca%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdacb%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdacc%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdacd%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdace%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdacf%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdacg%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdach%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaci%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdacj%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdack%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdacl%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdacm%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdacn%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaco%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdacp%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdacq%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdacr%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdacs%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdact%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdacu%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdacv%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdacw%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdacx%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdacy%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdacz%n" +BUS="scsi", RESULT="3512345600000bb80", NAME="disk-sdad%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdada%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdadb%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdadc%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdadd%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdade%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdadf%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdadg%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdadh%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdadi%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdadj%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdadk%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdadl%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdadm%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdadn%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdado%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdadp%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdadq%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdadr%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdads%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdadt%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdadu%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdadv%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdadw%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdadx%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdady%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdadz%n" +BUS="scsi", RESULT="3512345600000bf68", NAME="disk-sdae%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaea%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaeb%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaec%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdaed%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaee%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdaef%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaeg%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdaeh%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaei%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaej%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaek%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdael%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaem%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaen%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaeo%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaep%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaeq%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaer%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaes%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdaet%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaeu%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdaev%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaew%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdaex%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaey%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaez%n" +BUS="scsi", RESULT="3512345600000c350", NAME="disk-sdaf%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdafa%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdafb%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdafc%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdafd%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdafe%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaff%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdafg%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdafh%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdafi%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdafj%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdafk%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdafl%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdafm%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdafn%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdafo%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdafp%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdafq%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdafr%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdafs%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaft%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdafu%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdafv%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdafw%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdafx%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdafy%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdafz%n" +BUS="scsi", RESULT="3512345600000c738", NAME="disk-sdag%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaga%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdagb%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdagc%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdagd%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdage%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdagf%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdagg%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdagh%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdagi%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdagj%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdagk%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdagl%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdagm%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdagn%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdago%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdagp%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdagq%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdagr%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdags%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdagt%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdagu%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdagv%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdagw%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdagx%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdagy%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdagz%n" +BUS="scsi", RESULT="3512345600000cb20", NAME="disk-sdah%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaha%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdahb%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdahc%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdahd%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdahe%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdahf%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdahg%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdahh%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdahi%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdahj%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdahk%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdahl%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdahm%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdahn%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaho%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdahp%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdahq%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdahr%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdahs%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaht%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdahu%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdahv%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdahw%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdahx%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdahy%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdahz%n" +BUS="scsi", RESULT="3512345600000cf08", NAME="disk-sdai%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaia%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaib%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaic%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdaid%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaie%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaif%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaig%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaih%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaii%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaij%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaik%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdail%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaim%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdain%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaio%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdaip%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaiq%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdair%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdais%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdait%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaiu%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaiv%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaiw%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaix%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaiy%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaiz%n" +BUS="scsi", RESULT="3512345600000d2f0", NAME="disk-sdaj%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaja%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdajb%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdajc%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdajd%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaje%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdajf%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdajg%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdajh%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaji%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdajj%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdajk%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdajl%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdajm%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdajn%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdajo%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdajp%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdajq%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdajr%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdajs%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdajt%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaju%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdajv%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdajw%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdajx%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdajy%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdajz%n" +BUS="scsi", RESULT="3512345600000d6d8", NAME="disk-sdak%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaka%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdakb%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdakc%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdakd%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdake%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdakf%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdakg%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdakh%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaki%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdakj%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdakk%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdakl%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdakm%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdakn%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdako%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdakp%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdakq%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdakr%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaks%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdakt%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaku%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdakv%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdakw%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdakx%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaky%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdakz%n" +BUS="scsi", RESULT="3512345600000dac0", NAME="disk-sdal%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdala%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdalb%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdalc%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdald%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdale%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdalf%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdalg%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdalh%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdali%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdalj%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdalk%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdall%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdalm%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdaln%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdalo%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdalp%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdalq%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdalr%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdals%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdalt%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdalu%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdalv%n" +BUS="scsi", RESULT="3512345600000dea8", NAME="disk-sdam%n" +BUS="scsi", RESULT="3512345600000e290", NAME="disk-sdan%n" +BUS="scsi", RESULT="3512345600000e678", NAME="disk-sdao%n" +BUS="scsi", RESULT="3512345600000ea60", NAME="disk-sdap%n" +BUS="scsi", RESULT="3512345600000ee48", NAME="disk-sdaq%n" +BUS="scsi", RESULT="3512345600000f230", NAME="disk-sdar%n" +BUS="scsi", RESULT="3512345600000f618", NAME="disk-sdas%n" +BUS="scsi", RESULT="3512345600000fa00", NAME="disk-sdat%n" +BUS="scsi", RESULT="3512345600000fde8", NAME="disk-sdau%n" +BUS="scsi", RESULT="351234560000101d0", NAME="disk-sdav%n" +BUS="scsi", RESULT="351234560000105b8", NAME="disk-sdaw%n" +BUS="scsi", RESULT="351234560000109a0", NAME="disk-sdax%n" +BUS="scsi", RESULT="35123456000010d88", NAME="disk-sday%n" +BUS="scsi", RESULT="35123456000011170", NAME="disk-sdaz%n" +BUS="scsi", RESULT="SSEAGATE ST336704LC 3CD1HVBC000071283KA0", NAME="disk-sdb%n" +BUS="scsi", RESULT="35123456000011558", NAME="disk-sdba%n" +BUS="scsi", RESULT="35123456000011940", NAME="disk-sdbb%n" +BUS="scsi", RESULT="35123456000011d28", NAME="disk-sdbc%n" +BUS="scsi", RESULT="35123456000012110", NAME="disk-sdbd%n" +BUS="scsi", RESULT="351234560000124f8", NAME="disk-sdbe%n" +BUS="scsi", RESULT="351234560000128e0", NAME="disk-sdbf%n" +BUS="scsi", RESULT="35123456000012cc8", NAME="disk-sdbg%n" +BUS="scsi", RESULT="351234560000130b0", NAME="disk-sdbh%n" +BUS="scsi", RESULT="35123456000013498", NAME="disk-sdbi%n" +BUS="scsi", RESULT="35123456000013880", NAME="disk-sdbj%n" +BUS="scsi", RESULT="35123456000013c68", NAME="disk-sdbk%n" +BUS="scsi", RESULT="35123456000014050", NAME="disk-sdbl%n" +BUS="scsi", RESULT="35123456000014438", NAME="disk-sdbm%n" +BUS="scsi", RESULT="35123456000014820", NAME="disk-sdbn%n" +BUS="scsi", RESULT="35123456000014c08", NAME="disk-sdbo%n" +BUS="scsi", RESULT="35123456000014ff0", NAME="disk-sdbp%n" +BUS="scsi", RESULT="351234560000153d8", NAME="disk-sdbq%n" +BUS="scsi", RESULT="351234560000157c0", NAME="disk-sdbr%n" +BUS="scsi", RESULT="35123456000015ba8", NAME="disk-sdbs%n" +BUS="scsi", RESULT="35123456000015f90", NAME="disk-sdbt%n" +BUS="scsi", RESULT="35123456000016378", NAME="disk-sdbu%n" +BUS="scsi", RESULT="35123456000016760", NAME="disk-sdbv%n" +BUS="scsi", RESULT="35123456000016b48", NAME="disk-sdbw%n" +BUS="scsi", RESULT="35123456000016f30", NAME="disk-sdbx%n" +BUS="scsi", RESULT="35123456000017318", NAME="disk-sdby%n" +BUS="scsi", RESULT="35123456000017700", NAME="disk-sdbz%n" +BUS="scsi", RESULT="35123456000017ae8", NAME="disk-sdca%n" +BUS="scsi", RESULT="35123456000017ed0", NAME="disk-sdcb%n" +BUS="scsi", RESULT="351234560000182b8", NAME="disk-sdcc%n" +BUS="scsi", RESULT="351234560000186a0", NAME="disk-sdcd%n" +BUS="scsi", RESULT="35123456000018a88", NAME="disk-sdce%n" +BUS="scsi", RESULT="35123456000018e70", NAME="disk-sdcf%n" +BUS="scsi", RESULT="35123456000019258", NAME="disk-sdcg%n" +BUS="scsi", RESULT="35123456000019640", NAME="disk-sdch%n" +BUS="scsi", RESULT="35123456000019a28", NAME="disk-sdci%n" +BUS="scsi", RESULT="35123456000019e10", NAME="disk-sdcj%n" +BUS="scsi", RESULT="3512345600001a1f8", NAME="disk-sdck%n" +BUS="scsi", RESULT="3512345600001a5e0", NAME="disk-sdcl%n" +BUS="scsi", RESULT="3512345600001a9c8", NAME="disk-sdcm%n" +BUS="scsi", RESULT="3512345600001adb0", NAME="disk-sdcn%n" +BUS="scsi", RESULT="3512345600001b198", NAME="disk-sdco%n" +BUS="scsi", RESULT="3512345600001b580", NAME="disk-sdcp%n" +BUS="scsi", RESULT="3512345600001b968", NAME="disk-sdcq%n" +BUS="scsi", RESULT="3512345600001bd50", NAME="disk-sdcr%n" +BUS="scsi", RESULT="3512345600001c138", NAME="disk-sdcs%n" +BUS="scsi", RESULT="3512345600001c520", NAME="disk-sdct%n" +BUS="scsi", RESULT="3512345600001c908", NAME="disk-sdcu%n" +BUS="scsi", RESULT="3512345600001ccf0", NAME="disk-sdcv%n" +BUS="scsi", RESULT="3512345600001d0d8", NAME="disk-sdcw%n" +BUS="scsi", RESULT="3512345600001d4c0", NAME="disk-sdcx%n" +BUS="scsi", RESULT="3512345600001d8a8", NAME="disk-sdcy%n" +BUS="scsi", RESULT="3512345600001dc90", NAME="disk-sdcz%n" +BUS="scsi", RESULT="3512345600001e078", NAME="disk-sdda%n" +BUS="scsi", RESULT="3512345600001e460", NAME="disk-sddb%n" +BUS="scsi", RESULT="3512345600001e848", NAME="disk-sddc%n" +BUS="scsi", RESULT="3512345600001ec30", NAME="disk-sddd%n" +BUS="scsi", RESULT="3512345600001f018", NAME="disk-sdde%n" +BUS="scsi", RESULT="3512345600001f400", NAME="disk-sddf%n" +BUS="scsi", RESULT="35123456000007530", NAME="disk-sddg%n" +BUS="scsi", RESULT="35123456000007918", NAME="disk-sddh%n" +BUS="scsi", RESULT="35123456000007d00", NAME="disk-sddi%n" +BUS="scsi", RESULT="351234560000080e8", NAME="disk-sddj%n" +BUS="scsi", RESULT="351234560000084d0", NAME="disk-sddk%n" +BUS="scsi", RESULT="351234560000088b8", NAME="disk-sddl%n" +BUS="scsi", RESULT="35123456000008ca0", NAME="disk-sddm%n" +BUS="scsi", RESULT="35123456000009470", NAME="disk-sddn%n" +BUS="scsi", RESULT="35123456000009858", NAME="disk-sddo%n" +BUS="scsi", RESULT="35123456000009c40", NAME="disk-sddp%n" +BUS="scsi", RESULT="3512345600000a028", NAME="disk-sddq%n" +BUS="scsi", RESULT="3512345600000a410", NAME="disk-sddr%n" +BUS="scsi", RESULT="3512345600000a7f8", NAME="disk-sdds%n" +BUS="scsi", RESULT="3512345600000abe0", NAME="disk-sddt%n" +BUS="scsi", RESULT="3512345600000afc8", NAME="disk-sddu%n" +BUS="scsi", RESULT="3512345600000b3b0", NAME="disk-sddv%n" +BUS="scsi", RESULT="3512345600000b798", NAME="disk-sddw%n" +BUS="scsi", RESULT="3512345600000bb80", NAME="disk-sddx%n" +BUS="scsi", RESULT="3512345600000bf68", NAME="disk-sddy%n" +BUS="scsi", RESULT="3512345600000c350", NAME="disk-sddz%n" +BUS="scsi", RESULT="3512345600000c738", NAME="disk-sdea%n" +BUS="scsi", RESULT="3512345600000cb20", NAME="disk-sdeb%n" +BUS="scsi", RESULT="3512345600000cf08", NAME="disk-sdec%n" +BUS="scsi", RESULT="3512345600000d2f0", NAME="disk-sded%n" +BUS="scsi", RESULT="3512345600000d6d8", NAME="disk-sdee%n" +BUS="scsi", RESULT="3512345600000dac0", NAME="disk-sdef%n" +BUS="scsi", RESULT="3512345600000dea8", NAME="disk-sdeg%n" +BUS="scsi", RESULT="3512345600000e290", NAME="disk-sdeh%n" +BUS="scsi", RESULT="3512345600000e678", NAME="disk-sdei%n" +BUS="scsi", RESULT="3512345600000ea60", NAME="disk-sdej%n" +BUS="scsi", RESULT="3512345600000ee48", NAME="disk-sdek%n" +BUS="scsi", RESULT="3512345600000f230", NAME="disk-sdel%n" +BUS="scsi", RESULT="3512345600000f618", NAME="disk-sdem%n" +BUS="scsi", RESULT="3512345600000fa00", NAME="disk-sden%n" +BUS="scsi", RESULT="3512345600000fde8", NAME="disk-sdeo%n" +BUS="scsi", RESULT="351234560000101d0", NAME="disk-sdep%n" +BUS="scsi", RESULT="351234560000105b8", NAME="disk-sdeq%n" +BUS="scsi", RESULT="351234560000109a0", NAME="disk-sder%n" +BUS="scsi", RESULT="35123456000010d88", NAME="disk-sdes%n" +BUS="scsi", RESULT="35123456000011170", NAME="disk-sdet%n" +BUS="scsi", RESULT="35123456000011558", NAME="disk-sdeu%n" +BUS="scsi", RESULT="35123456000011940", NAME="disk-sdev%n" +BUS="scsi", RESULT="35123456000011d28", NAME="disk-sdew%n" +BUS="scsi", RESULT="35123456000012110", NAME="disk-sdex%n" +BUS="scsi", RESULT="351234560000124f8", NAME="disk-sdey%n" +BUS="scsi", RESULT="351234560000128e0", NAME="disk-sdez%n" +BUS="scsi", RESULT="35123456000012cc8", NAME="disk-sdfa%n" +BUS="scsi", RESULT="351234560000130b0", NAME="disk-sdfb%n" +BUS="scsi", RESULT="35123456000013498", NAME="disk-sdfc%n" +BUS="scsi", RESULT="35123456000013880", NAME="disk-sdfd%n" +BUS="scsi", RESULT="35123456000013c68", NAME="disk-sdfe%n" +BUS="scsi", RESULT="35123456000014050", NAME="disk-sdff%n" +BUS="scsi", RESULT="35123456000014438", NAME="disk-sdfg%n" +BUS="scsi", RESULT="35123456000014820", NAME="disk-sdfh%n" +BUS="scsi", RESULT="35123456000014c08", NAME="disk-sdfi%n" +BUS="scsi", RESULT="35123456000014ff0", NAME="disk-sdfj%n" +BUS="scsi", RESULT="351234560000153d8", NAME="disk-sdfk%n" +BUS="scsi", RESULT="351234560000157c0", NAME="disk-sdfl%n" +BUS="scsi", RESULT="35123456000015ba8", NAME="disk-sdfm%n" +BUS="scsi", RESULT="35123456000015f90", NAME="disk-sdfn%n" +BUS="scsi", RESULT="35123456000016378", NAME="disk-sdfo%n" +BUS="scsi", RESULT="35123456000016760", NAME="disk-sdfp%n" +BUS="scsi", RESULT="35123456000016b48", NAME="disk-sdfq%n" +BUS="scsi", RESULT="35123456000016f30", NAME="disk-sdfr%n" +BUS="scsi", RESULT="35123456000017318", NAME="disk-sdfs%n" +BUS="scsi", RESULT="35123456000017700", NAME="disk-sdft%n" +BUS="scsi", RESULT="35123456000017ae8", NAME="disk-sdfu%n" +BUS="scsi", RESULT="35123456000017ed0", NAME="disk-sdfv%n" +BUS="scsi", RESULT="351234560000182b8", NAME="disk-sdfw%n" +BUS="scsi", RESULT="351234560000186a0", NAME="disk-sdfx%n" +BUS="scsi", RESULT="35123456000018a88", NAME="disk-sdfy%n" +BUS="scsi", RESULT="35123456000018e70", NAME="disk-sdfz%n" +BUS="scsi", RESULT="35123456000019258", NAME="disk-sdga%n" +BUS="scsi", RESULT="35123456000019640", NAME="disk-sdgb%n" +BUS="scsi", RESULT="35123456000019a28", NAME="disk-sdgc%n" +BUS="scsi", RESULT="35123456000019e10", NAME="disk-sdgd%n" +BUS="scsi", RESULT="3512345600001a1f8", NAME="disk-sdge%n" +BUS="scsi", RESULT="3512345600001a5e0", NAME="disk-sdgf%n" +BUS="scsi", RESULT="3512345600001a9c8", NAME="disk-sdgg%n" +BUS="scsi", RESULT="3512345600001adb0", NAME="disk-sdgh%n" +BUS="scsi", RESULT="3512345600001b198", NAME="disk-sdgi%n" +BUS="scsi", RESULT="3512345600001b580", NAME="disk-sdgj%n" +BUS="scsi", RESULT="3512345600001b968", NAME="disk-sdgk%n" +BUS="scsi", RESULT="3512345600001bd50", NAME="disk-sdgl%n" +BUS="scsi", RESULT="3512345600001c138", NAME="disk-sdgm%n" +BUS="scsi", RESULT="3512345600001c520", NAME="disk-sdgn%n" +BUS="scsi", RESULT="3512345600001c908", NAME="disk-sdgo%n" +BUS="scsi", RESULT="3512345600001ccf0", NAME="disk-sdgp%n" +BUS="scsi", RESULT="3512345600001d0d8", NAME="disk-sdgq%n" +BUS="scsi", RESULT="3512345600001d4c0", NAME="disk-sdgr%n" +BUS="scsi", RESULT="3512345600001d8a8", NAME="disk-sdgs%n" +BUS="scsi", RESULT="3512345600001dc90", NAME="disk-sdgt%n" +BUS="scsi", RESULT="3512345600001e078", NAME="disk-sdgu%n" +BUS="scsi", RESULT="3512345600001e460", NAME="disk-sdgv%n" +BUS="scsi", RESULT="3512345600001e848", NAME="disk-sdgw%n" +BUS="scsi", RESULT="3512345600001ec30", NAME="disk-sdgx%n" +BUS="scsi", RESULT="3512345600001f018", NAME="disk-sdgy%n" +BUS="scsi", RESULT="3512345600001f400", NAME="disk-sdgz%n" +BUS="scsi", RESULT="3512345600001f7e8", NAME="disk-sdha%n" +BUS="scsi", RESULT="3512345600001fbd0", NAME="disk-sdhb%n" +BUS="scsi", RESULT="35123456000007d00", NAME="disk-sdhc%n" +BUS="scsi", RESULT="351234560000080e8", NAME="disk-sdhd%n" +BUS="scsi", RESULT="351234560000084d0", NAME="disk-sdhe%n" +BUS="scsi", RESULT="351234560000088b8", NAME="disk-sdhf%n" +BUS="scsi", RESULT="35123456000008ca0", NAME="disk-sdhg%n" +BUS="scsi", RESULT="35123456000009088", NAME="disk-sdhh%n" +BUS="scsi", RESULT="35123456000009470", NAME="disk-sdhi%n" +BUS="scsi", RESULT="35123456000009c40", NAME="disk-sdhj%n" +BUS="scsi", RESULT="3512345600000a028", NAME="disk-sdhk%n" +BUS="scsi", RESULT="3512345600000a410", NAME="disk-sdhl%n" +BUS="scsi", RESULT="3512345600000a7f8", NAME="disk-sdhm%n" +BUS="scsi", RESULT="3512345600000abe0", NAME="disk-sdhn%n" +BUS="scsi", RESULT="3512345600000afc8", NAME="disk-sdho%n" +BUS="scsi", RESULT="3512345600000b3b0", NAME="disk-sdhp%n" +BUS="scsi", RESULT="3512345600000b798", NAME="disk-sdhq%n" +BUS="scsi", RESULT="3512345600000bb80", NAME="disk-sdhr%n" +BUS="scsi", RESULT="3512345600000bf68", NAME="disk-sdhs%n" +BUS="scsi", RESULT="3512345600000c350", NAME="disk-sdht%n" +BUS="scsi", RESULT="3512345600000c738", NAME="disk-sdhu%n" +BUS="scsi", RESULT="3512345600000cb20", NAME="disk-sdhv%n" +BUS="scsi", RESULT="3512345600000cf08", NAME="disk-sdhw%n" +BUS="scsi", RESULT="3512345600000d2f0", NAME="disk-sdhx%n" +BUS="scsi", RESULT="3512345600000d6d8", NAME="disk-sdhy%n" +BUS="scsi", RESULT="3512345600000dac0", NAME="disk-sdhz%n" +BUS="scsi", RESULT="3512345600000dea8", NAME="disk-sdia%n" +BUS="scsi", RESULT="3512345600000e290", NAME="disk-sdib%n" +BUS="scsi", RESULT="3512345600000e678", NAME="disk-sdic%n" +BUS="scsi", RESULT="3512345600000ea60", NAME="disk-sdid%n" +BUS="scsi", RESULT="3512345600000ee48", NAME="disk-sdie%n" +BUS="scsi", RESULT="3512345600000f230", NAME="disk-sdif%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdig%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdih%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdii%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdij%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdik%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdil%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdim%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdin%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdio%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdip%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdiq%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdir%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdis%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdit%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdiu%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdiv%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdiw%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdix%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdiy%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdiz%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdja%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdjb%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdjc%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdjd%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdje%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdjf%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdjg%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdjh%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdji%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdjj%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdjk%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdjl%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdjm%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdjn%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdjo%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdjp%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdjq%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdjr%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdjs%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdjt%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdju%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdjv%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdjw%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdjx%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdjy%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdjz%n" +BUS="scsi", RESULT="35123456000006d60", NAME="disk-sdk%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdka%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdkb%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdkc%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdkd%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdke%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdkf%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdkg%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdkh%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdki%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdkj%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdkk%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdkl%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdkm%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdkn%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdko%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdkp%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdkq%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdkr%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdks%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdkt%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdku%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdkv%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdkw%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdkx%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdky%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdkz%n" +BUS="scsi", RESULT="35123456000007148", NAME="disk-sdl%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdla%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdlb%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdlc%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdld%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdle%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdlf%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdlg%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdlh%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdli%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdlj%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdlk%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdll%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdlm%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdln%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdlo%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdlp%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdlq%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdlr%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdls%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdlt%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdlu%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdlv%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdlw%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdlx%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdly%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdlz%n" +BUS="scsi", RESULT="35123456000007530", NAME="disk-sdm%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdma%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdmb%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdmc%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdmd%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdme%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdmf%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdmg%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdmh%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdmi%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdmj%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdmk%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdml%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdmm%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdmn%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdmo%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdmp%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdmq%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdmr%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdms%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdmt%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdmu%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdmv%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdmw%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdmx%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdmy%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdmz%n" +BUS="scsi", RESULT="35123456000007918", NAME="disk-sdn%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdna%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdnb%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdnc%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdnd%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdne%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdnf%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdng%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdnh%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdni%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdnj%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdnk%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdnl%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdnm%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdnn%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdno%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdnp%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdnq%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdnr%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdns%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdnt%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdnu%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdnv%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdnw%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdnx%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdny%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdnz%n" +BUS="scsi", RESULT="35123456000007d00", NAME="disk-sdo%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdoa%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdob%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdoc%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdod%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdoe%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdof%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdog%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdoh%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdoi%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdoj%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdok%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdol%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdom%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdon%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdoo%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdop%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdoq%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdor%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdos%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdot%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdou%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdov%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdow%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdox%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdoy%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdoz%n" +BUS="scsi", RESULT="351234560000080e8", NAME="disk-sdp%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdpa%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdpb%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdpc%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdpd%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdpe%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdpf%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdpg%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdph%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdpi%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdpj%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdpk%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdpl%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdpm%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdpn%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdpo%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdpp%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdpq%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdpr%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdps%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdpt%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdpu%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdpv%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdpw%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdpx%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdpy%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdpz%n" +BUS="scsi", RESULT="351234560000084d0", NAME="disk-sdq%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdqa%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdqb%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdqc%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdqd%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdqe%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdqf%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdqg%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdqh%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdqi%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdqj%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdqk%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdql%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdqm%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdqn%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdqo%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdqp%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdqq%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdqr%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdqs%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdqt%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdqu%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdqv%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdqw%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdqx%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdqy%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdqz%n" +BUS="scsi", RESULT="35123456000008ca0", NAME="disk-sdr%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdra%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdrb%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdrc%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdrd%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdre%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdrf%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdrg%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdrh%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdri%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdrj%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdrk%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdrl%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdrm%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdrn%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdro%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdrp%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdrq%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdrr%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdrs%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdrt%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdru%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdrv%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdrw%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdrx%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdry%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdrz%n" +BUS="scsi", RESULT="35123456000009088", NAME="disk-sds%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdsa%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdsb%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdsc%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdsd%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdse%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdsf%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdsg%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdsh%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdsi%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdsj%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdsk%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdsl%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdsm%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdsn%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdso%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdsp%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdsq%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdsr%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdss%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdst%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdsu%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdsv%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdsw%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdsx%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdsy%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdsz%n" +BUS="scsi", RESULT="35123456000009470", NAME="disk-sdt%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdta%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdtb%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdtc%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdtd%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdte%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdtf%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdtg%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdth%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdti%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdtj%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdtk%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdtl%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdtm%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdtn%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdto%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdtp%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdtq%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdtr%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdts%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdtt%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdtu%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdtv%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdtw%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdtx%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdty%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdtz%n" +BUS="scsi", RESULT="35123456000009858", NAME="disk-sdu%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdua%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdub%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sduc%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdud%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdue%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sduf%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdug%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sduh%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdui%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sduj%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sduk%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdul%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdum%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdun%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sduo%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdup%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sduq%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdur%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdus%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdut%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sduu%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sduv%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sduw%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdux%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sduy%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sduz%n" +BUS="scsi", RESULT="35123456000009c40", NAME="disk-sdv%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdva%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdvb%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdvc%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdvd%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdve%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdvf%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdvg%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdvh%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdvi%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdvj%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdvk%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdvl%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdvm%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdvn%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdvo%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdvp%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdvq%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdvr%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdvs%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdvt%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdvu%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdvv%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdvw%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdvx%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdvy%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdvz%n" +BUS="scsi", RESULT="3512345600000a028", NAME="disk-sdw%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdwa%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdwb%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdwc%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdwd%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdwe%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdwf%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdwg%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdwh%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdwi%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdwj%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdwk%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdwl%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdwm%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdwn%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdwo%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdwp%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdwq%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdwr%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdws%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdwt%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdwu%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdwv%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdww%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdwx%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdwy%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdwz%n" +BUS="scsi", RESULT="3512345600000a410", NAME="disk-sdx%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdxa%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdxb%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdxc%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdxd%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdxe%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdxf%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdxg%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdxh%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdxi%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdxj%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdxk%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdxl%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdxm%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdxn%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdxo%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdxp%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdxq%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdxr%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdxs%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdxt%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdxu%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdxv%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdxw%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdxx%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdxy%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdxz%n" +BUS="scsi", RESULT="3512345600000a7f8", NAME="disk-sdy%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdya%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdyb%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdyc%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdyd%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdye%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdyf%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdyg%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdyh%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdyi%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdyj%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdyk%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdyl%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdym%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdyn%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdyo%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdyp%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdyq%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdyr%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdys%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdyt%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdyu%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdyv%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdyw%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdyx%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdyy%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdyz%n" +BUS="scsi", RESULT="3512345600000abe0", NAME="disk-sdz%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdza%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdzb%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdzc%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdzd%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdze%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdzf%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdzg%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdzh%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdzi%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdzj%n" +BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdzk%n" +BUS="scsi", RESULT="35123456000023280", NAME="disk-sdzl%n" +BUS="scsi", RESULT="35123456000023668", NAME="disk-sdzm%n" +BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdzn%n" +BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdzo%n" +BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdzp%n" +BUS="scsi", RESULT="35123456000020788", NAME="disk-sdzq%n" +BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdzr%n" +BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdzs%n" +BUS="scsi", RESULT="35123456000021340", NAME="disk-sdzt%n" +BUS="scsi", RESULT="35123456000021728", NAME="disk-sdzu%n" +BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdzv%n" +BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdzw%n" +BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdzx%n" +BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdzy%n" +BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdzz%n" +# +# End of autogenerated scsi_id rules +# -- cgit v1.2.3-54-g00ecf From 52a8572366c15cc2676e3fad433f366ba3bc279c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Mar 2004 18:17:38 -0800 Subject: [PATCH] clean up the OSDL document formatting a bit --- docs/persistent_naming/Testing_scsi_notes.txt | 213 -------------------------- docs/persistent_naming/testing_scsi_notes.txt | 203 ++++++++++++++++++++++++ 2 files changed, 203 insertions(+), 213 deletions(-) delete mode 100644 docs/persistent_naming/Testing_scsi_notes.txt create mode 100644 docs/persistent_naming/testing_scsi_notes.txt diff --git a/docs/persistent_naming/Testing_scsi_notes.txt b/docs/persistent_naming/Testing_scsi_notes.txt deleted file mode 100644 index 5013c87e1d..0000000000 --- a/docs/persistent_naming/Testing_scsi_notes.txt +++ /dev/null @@ -1,213 +0,0 @@ -Using UDEV to do Persistent storage device naming -for large numbers of storage devices -3/16/2004 - -Here are some lessons we learned at OSDL recently on how to use -UDEV (version 021) to do persistent device naming for lots of storage -devices. We used what was available in udev for scsi devices. Here is -an outline of this report: - -Background information - a list of resources we needed to get -started. -Setup - what we needed to create the right enviroment (kernel, -patches, drivers) -How udev works to assign persistent storage device names - -what the documentation didn't tell us. -Performance - A sanity test we ran to compare with and without -persistent naming. - - -BACKGROUND INFORMATION -To get started, here are some references. Review the overview -articles so that the rest of the information makes sense. - -Download the latest udev stuff from: -http://www.kernel.org/pub/linux/utils/kernel/hotplug/ - -mailing list: -linux-hotplug-devel@lists.sourceforge.net - -Here is a nice overview article to get started (warning, this is from -summer 2003 so many items indicated as "todo" have been done and -configuration file name references have sometime changed): -http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf -(also included when you download udev) - -More general info (also included in the udev package): -http://kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ -UDEV version 021 Announcement: -http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=107827264803336&w=2 - -"Managing Dynamic Naming" -http://lwn.net/Articles/28897/ - -If you are a fan of devfs, whatever you do, don't complain until you -read everything you possibly can about udev. This for example: -http://kernel.org/pub/linux/utils/kernel/hotplug/udev_vs_devfs - -You will need to create udev.rules to supply consistent names. (See -etc/udev/udev.rules in the download). This article gives you some -background about udev.rules, but avoids describing the "PROGRAM" -key which is needed for our work. Read it for background: -writing udev rules (current as of udev 018) -http://www.reactivated.net/udevrules.php - -bitkeeper tree: -bk://kernel.bkbits.net/gregkh/udev - -Libsysfs (used to get sysfs information): -http://www-124.ibm.com/linux/papers/libsysfs/libsysfs-linuxconfau2004.pdf - -UDEV works using the way hotplug events are handled by the kernel. -Several overview articles about hotplug include: -Hotplug events -http://lwn.net/Articles/52621/ -Overview of Hotplug -http://linux-hotplug.sourceforge.net/ - -Gentoo centric install info: -http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html - -rpms built against Red Hat FC2-test1 may be available at: -http://kernel.org/pub/linux/utils/kernel/hotplug/udev-021-1.i386.rpm - -with the source rpm at: -http://kernel.org/pub/linux/utils/kernel/hotplug/udev-021-1.src.rpm - - - -SETUP - -Here is a brief checklist of what you need on your system for this to -work: - -Kernel must be a 2.6 kernel - -Must use CONFIG_HOTPLUG kernel config option, since the solution -is based on hotplug capabilities. - -To test more than 256 scsi devices you need a patch to the scsi driver -to support that many (available from IBM or SuSE). To see the patch -we used, see this link: -http://developer.osdl.org/maryedie/DCL/PSDN/lotsofdisks.patch - -Your storage device must support (via the driver) a unique identifier for -persistent device naming. (Adaptec RAID device does not, for -example.) - -Your device driver must support sysfs (new in 2.6 kernel). This is -already done for scsi devices and most if not all block devices. - -A program (scsi_id) exists in the udev download -( extras/scsi_id/scsi_id.c) for scsi devices. It can read the identifier and -is needed for persistent naming. - - -HOW UDEV WORKS TO ASSIGN PERSISTENT NAMES: - -There are three places where device information is stored that udev -uses: -(1) /sys maintained by sysfs -(2) /etc/udev/udev.rules - where you can store the identifier to NAME -mapping information. -(3) The tdb (udev-021/tdb/tdb.c), trivial data base, that is held in -memory and holds the valid system configuration. It is not saved -between one boot to the next. It is constructed at boot time and -updated with configuration changes. - -The persistent names are kept (at least this is one way to do it) in -udev.rules (uuid and NAME), one entry per device. If you want to -initially give your 1000 disk devices a default name and then make -sure those names are preserved, here is how : - -Start with no special entry in udev.rules when do you an initial boot of -your system with disks in place. Udev will assign default names (there -are ways to control what you want for default too). - -Once the names are assigned, use a script supplied for scsi devices - -udev-021/extras/scsi_id/gen_scsi_id_udev_rules.sh -to generate the lines needed for udev.rules, one per device. Each line -indicates the identifier and the NAME it was assigned. You could -optionally create this manually if you prefer other names . - -[example entries in udev.rules for scsi disks] -BUS="scsi", PROGRAM="scsi_id", RESULT="",NAME="" -BUS="scsi", RESULT="",NAME="" -... -BUS="scsi", RESULT="",NAME="" - -(The actual file we used is the file udev.rules_1000_scsi_debug in this -directory ) - -Upon reboot, for each device a hotplug event occurs. The udev.rules -file is scanned looking for the device type (BUS) in this case for "scsi". -The first entry generated by the above program references a -PROGRAM in the key field (scsi_id) which is called to probe the device -and determine the unique identifier. sysfs is used to determine the -major/minor number for the device. The result of the program -execution (the uuid) is compared with the RESULT entry in the same -udev.rules line. - --If it matches, then the NAME entered on this line is used. The uuid -and major/minor number is saved in tdb (newly recreated upon boot). -That device is created in /udev (the target directory name is -configurable) with the assigned NAME. - --If it doesn't match, the RESULT (uuid) is preserved for use on the next -udev.rules line as long as the bus type (scsi) is the same. So the result -(the uuid) is compared on the next line, and the next until a match -occurs. - --If no match occurs, the device will be assigned a default name. - --Tdb is updated with the resulting name assignment. - - -Thus if the uuid and names are enumerated, they will be found, -assigned, and are therefore permanent. - -If the device is removed from a live system, a hotplug event occurs, -and it is removed from tdb and the /udev entry disappears. - -If it is re-inserted at a new location, the udev.rules file is scanned as -above. The new major/minor number goes in tdb with the uuid , the -name in udev.rules is found again, and the /udev name re-appears. - - - -PERFORMANCE - -Now the question becomes, how much longer does it take to scan the -udev.rules table once there are 1000 entries? - -To test this, we created 1000 "scsi " devices using the scsi debug -device driver supplied in the kernel. When this device driver is loaded -you can specify how many fake scsi devices to create. There is no -real I/O involved but it does respond to some scsi commands. It -simulates the uuid by using the device number assigned when the -device is created. - -Then we auto-generated entries into udev.rules with -gen_scsi_id_udev_rules.sh. We then removed the devices and -reassigned them to simulate a reboot. The delta between assigning -defaults and assigning the names enumerated in the udev.rules file -was 7 seconds (that's for 1000 drives). - -Scripts utilized the feature (described above) that saves the "RESULT" -key after one scsi-id program call for later reference with other -udev.rules entries (so only have one PROGRAM key is the moral of -the story). If you repeated the PROGRAM key, you would -unnecessarily call the program up to 999 times! - -The script that creates udev.rules did not work for 1000 drives (the -input line is too long). We determined that a patch for this already -existed but had not yet been checked in. - - - - - - - - - diff --git a/docs/persistent_naming/testing_scsi_notes.txt b/docs/persistent_naming/testing_scsi_notes.txt new file mode 100644 index 0000000000..8d94c842b4 --- /dev/null +++ b/docs/persistent_naming/testing_scsi_notes.txt @@ -0,0 +1,203 @@ +Using UDEV to do Persistent storage device naming +for large numbers of storage devices +3/16/2004 + +Here are some lessons we learned at OSDL recently on how to use UDEV +(version 021) to do persistent device naming for lots of storage devices. +We used what was available in udev for scsi devices. Here is an outline of +this report: + +Background information + a list of resources we needed to get started. +Setup + what we needed to create the right enviroment (kernel, patches, + drivers) +How udev works to assign persistent storage device names + what the documentation didn't tell us. +Performance + A sanity test we ran to compare with and without persistent naming. + + +BACKGROUND INFORMATION +To get started, here are some references. Review the overview articles so +that the rest of the information makes sense. + +Download the latest udev stuff from: + http://www.kernel.org/pub/linux/utils/kernel/hotplug/ + +mailing list: + linux-hotplug-devel@lists.sourceforge.net + +Here is a nice overview article to get started (warning, this is from +summer 2003 so many items indicated as "todo" have been done and +configuration file name references have sometime changed): +http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf +(also included when you download udev) + +More general info (also included in the udev package): + http://kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ +UDEV version 021 Announcement: + http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=107827264803336&w=2 + +"Managing Dynamic Naming": + http://lwn.net/Articles/28897/ + +If you are a fan of devfs, whatever you do, don't complain until you read +everything you possibly can about udev. This for example: + http://kernel.org/pub/linux/utils/kernel/hotplug/udev_vs_devfs + +You will need to create udev.rules to supply consistent names. (See +etc/udev/udev.rules in the download). This article gives you some +background about udev.rules, but avoids describing the "PROGRAM" key which +is needed for our work. Read it for background: writing udev rules +(current as of udev 018) + http://www.reactivated.net/udevrules.php + +bitkeeper tree: + bk://kernel.bkbits.net/gregkh/udev + +Libsysfs used to get sysfs information): + http://www-124.ibm.com/linux/papers/libsysfs/libsysfs-linuxconfau2004.pdf + +UDEV works using the way hotplug events are handled by the kernel. +Several overview articles about hotplug include: +Hotplug events +http://lwn.net/Articles/52621/ +Overview of Hotplug +http://linux-hotplug.sourceforge.net/ + +Gentoo centric install info: +http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html + +rpms built against Red Hat FC2-test1 may be available at: +http://kernel.org/pub/linux/utils/kernel/hotplug/udev-021-1.i386.rpm + +with the source rpm at: +http://kernel.org/pub/linux/utils/kernel/hotplug/udev-021-1.src.rpm + + + +SETUP + +Here is a brief checklist of what you need on your system for this to +work: + +Kernel must be a 2.6 kernel + +Must use CONFIG_HOTPLUG kernel config option, since the solution is based +on hotplug capabilities. + +To test more than 256 scsi devices you need a patch to the scsi driver to +support that many (available from IBM or SuSE). To see the patch we used, +see this link: +http://developer.osdl.org/maryedie/DCL/PSDN/lotsofdisks.patch + +Your storage device must support (via the driver) a unique identifier for +persistent device naming. (Adaptec RAID device does not, for example.) + +Your device driver must support sysfs (new in 2.6 kernel). This is already +done for scsi devices and most if not all block devices. + +A program (scsi_id) exists in the udev download (extras/scsi_id/scsi_id.c) +for scsi devices. It can read the identifier and is needed for persistent +naming. + + +HOW UDEV WORKS TO ASSIGN PERSISTENT NAMES: + +There are three places where device information is stored that udev +uses: +(1) /sys maintained by sysfs +(2) /etc/udev/udev.rules - where you can store the identifier to NAME + mapping information. +(3) The tdb (udev-021/tdb/tdb.c), trivial data base, that is held in + memory and holds the valid system configuration. It is not saved + between one boot to the next. It is constructed at boot time and + updated with configuration changes. + +The persistent names are kept (at least this is one way to do it) in +udev.rules (uuid and NAME), one entry per device. If you want to initially +give your 1000 disk devices a default name and then make sure those names +are preserved, here is how : + +Start with no special entry in udev.rules when do you an initial boot of +your system with disks in place. Udev will assign default names (there +are ways to control what you want for default too). + +Once the names are assigned, use a script supplied for scsi devices - +udev-021/extras/scsi_id/gen_scsi_id_udev_rules.sh to generate the lines +needed for udev.rules, one per device. Each line indicates the identifier +and the NAME it was assigned. You could optionally create this manually if +you prefer other names . + +[example entries in udev.rules for scsi disks] +BUS="scsi", PROGRAM="scsi_id", RESULT="",NAME="" +BUS="scsi", RESULT="",NAME="" +... +BUS="scsi", RESULT="",NAME="" + +(The actual file we used is the file udev.rules_1000_scsi_debug in this +directory ) + +Upon reboot, for each device a hotplug event occurs. The udev.rules file +is scanned looking for the device type (BUS) in this case for "scsi". The +first entry generated by the above program references a PROGRAM in the key +field (scsi_id) which is called to probe the device and determine the +unique identifier. sysfs is used to determine the major/minor number for +the device. The result of the program execution (the uuid) is compared +with the RESULT entry in the same udev.rules line. + +- If it matches, then the NAME entered on this line is used. The uuid and + major/minor number is saved in tdb (newly recreated upon boot). That + device is created in /udev (the target directory name is configurable) + with the assigned NAME. + +- If it doesn't match, the RESULT (uuid) is preserved for use on the next + udev.rules line as long as the bus type (scsi) is the same. So the + result (the uuid) is compared on the next line, and the next until a + match occurs. + +- If no match occurs, the device will be assigned a default name. + +- Tdb is updated with the resulting name assignment. + + +Thus if the uuid and names are enumerated, they will be found, assigned, +and are therefore permanent. + +If the device is removed from a live system, a hotplug event occurs, and it +is removed from tdb and the /udev entry disappears. + +If it is re-inserted at a new location, the udev.rules file is scanned as +above. The new major/minor number goes in tdb with the uuid , the name in +udev.rules is found again, and the /udev name re-appears. + + + +PERFORMANCE + +Now the question becomes, how much longer does it take to scan the +udev.rules table once there are 1000 entries? + +To test this, we created 1000 "scsi " devices using the scsi debug device +driver supplied in the kernel. When this device driver is loaded you can +specify how many fake scsi devices to create. There is no real I/O +involved but it does respond to some scsi commands. It simulates the uuid +by using the device number assigned when the device is created. + +Then we auto-generated entries into udev.rules with +gen_scsi_id_udev_rules.sh. We then removed the devices and reassigned them +to simulate a reboot. The delta between assigning defaults and assigning +the names enumerated in the udev.rules file was 7 seconds (that's for 1000 +drives). + +Scripts utilized the feature (described above) that saves the "RESULT" key +after one scsi-id program call for later reference with other udev.rules +entries (so only have one PROGRAM key is the moral of the story). If you +repeated the PROGRAM key, you would unnecessarily call the program up to +999 times! + +The script that creates udev.rules did not work for 1000 drives (the input +line is too long). We determined that a patch for this already existed but +had not yet been checked in. + -- cgit v1.2.3-54-g00ecf From fa5acd760db98d8f7ec810e44e8d4527b115e43c Mon Sep 17 00:00:00 2001 From: "atul.sabharwal@intel.com" Date: Wed, 31 Mar 2004 18:18:58 -0800 Subject: [PATCH] Add chassis_id program to extras directory --- extras/chassis_id/Makefile | 26 ++++++++++ extras/chassis_id/chassis_id.c | 112 ++++++++++++++++++++++++++++++++++++++++ extras/chassis_id/chassis_id.h | 34 ++++++++++++ extras/chassis_id/provision.tbl | 5 ++ extras/chassis_id/table.c | 102 ++++++++++++++++++++++++++++++++++++ 5 files changed, 279 insertions(+) create mode 100644 extras/chassis_id/Makefile create mode 100644 extras/chassis_id/chassis_id.c create mode 100644 extras/chassis_id/chassis_id.h create mode 100644 extras/chassis_id/provision.tbl create mode 100644 extras/chassis_id/table.c diff --git a/extras/chassis_id/Makefile b/extras/chassis_id/Makefile new file mode 100644 index 0000000000..d3152e863c --- /dev/null +++ b/extras/chassis_id/Makefile @@ -0,0 +1,26 @@ +# +# ** +# ** (C) 2003 Intel Corporation +# ** Atul Sabharwal +# ** +# ** $Id: Makefile,v 1.3 2004/03/22 23:54:54 atul Exp $ +# ** +# ** Distributed under the terms of the GNU Public License, v2.0 or +# ** later. +# ** +# ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; +# ** with his permission, they have been re-licensed GPL, and his +# ** copyright still applies on them. +# ** +# */ +# +CFLAGS = -g +TARGET = chassis_id + +all: chassis_id + +chassis_id: chassis_id.c table.c + gcc -o $(TARGET) $(CFLAGS) chassis_id.c table.c + +clean: + rm -rf core a.out $(TARGET) diff --git a/extras/chassis_id/chassis_id.c b/extras/chassis_id/chassis_id.c new file mode 100644 index 0000000000..8f878b2c6e --- /dev/null +++ b/extras/chassis_id/chassis_id.c @@ -0,0 +1,112 @@ + + /* -*-c-*-: + ** + ** (C) 2003 Intel Corporation + ** Atul Sabharwal + ** + ** $Id: chassis_id.c,v 1.8 2004/03/22 23:33:10 atul Exp $ + ** + ** Distributed under the terms of the GNU Public License, v2.0 or + ** later. + ** + ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; + ** with his permission, they have been re-licensed GPL, and his + ** copyright still applies on them. + ** + */ + +#include +#include +#include + +#include "chassis_id.h" + +//#define DEBUG 1 + +int main(int argc, char **argv, char ** envp) +{ + int chassis_num, slot_num, retval, host_num; + char disk_snum[255], devpath[255]; + char * ptr; + int disk_index; + + syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", "starting chassis_id" ); + +#if 0 + ptr = (char *) getenv( "CHASSIS"); + if( ptr == NULL ) + return -ERROR_NO_CHASSIS; + + sscanf(ptr, "%d", &chassis_num); + #ifdef DEBUG + syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "Chassis %d", chassis_num); + #endif + + + ptr = (char *) getenv( "SLOT" ); + if( ptr== NULL ) + return -ERROR_NO_SLOT; + + sscanf(ptr, "%d", &slot_num); + #ifdef DEBUG + syslog( LOG_PID|LOG_DAEMON| LOG_ERR, "Slot %d", slot_num); + #endif +#endif + ptr = (char *) getenv( "DEVPATH"); + if( ptr == NULL ) + return -ERROR_NO_DEVPATH; + + sscanf(ptr, "%s", &devpath[0]); + #ifdef DEBUG + syslog( LOG_PID|LOG_DAEMON| LOG_ERR, "Devpath %s", devpath); + #endif + + retval = table_init(); + if(retval < 0 ) + return -ERROR_BAD_TABLE; + + getserial_number( devpath, disk_snum); + + + /* Now we open the provisioning table t find actual entry for the serial number*/ + disk_index = table_find_disk(disk_snum, &host_num, &chassis_num, &slot_num); + if ( disk_index == -1 ) + { + //typical provisioning error + return -ERROR_NO_DISK; + } + else + { + table_select_disk( disk_index ); + } + return 0; +} + + +/* Run SCSI id to find serial number of the device */ +int getserial_number( char * devpath, char * snumber ) +{ + FILE *fp; + char vendor [255], model[255], cmd[255]; + int retval; + + sprintf(cmd, "/sbin/scsi_id -s %s -p 0x80", devpath); + + fp = popen( cmd, "r"); + + if (fp == NULL) + return -ERROR_BAD_SNUMBER; + + fscanf( fp, "%s %s %s", vendor, model, snumber); + #ifdef DEBUG + syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", snumber ); + #endif + + retval = pclose(fp); + if (retval == -1) + return -ERROR_BAD_SNUMBER; + else + return NO_ERROR; + +} + diff --git a/extras/chassis_id/chassis_id.h b/extras/chassis_id/chassis_id.h new file mode 100644 index 0000000000..db5db90c21 --- /dev/null +++ b/extras/chassis_id/chassis_id.h @@ -0,0 +1,34 @@ + + /* -*-c-*-: + ** + ** (C) 2003 Intel Corporation + ** Atul Sabharwal + ** + ** $Id: chassis_id.h,v 1.1 2004/03/16 18:24:44 atul Exp $ + ** + ** Distributed under the terms of the GNU Public License, v2.0 or + ** later. + ** + ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; + ** with his permission, they have been re-licensed GPL, and his + ** copyright still applies on them. + ** + */ + +#ifndef _CHASSIS_ID_H +#define _CHASSIS_ID_H + +//#define DEBUG 1 +#define ERROR 1 +#define ERROR_NO_SLOT 2 +#define ERROR_NO_CHASSIS 3 +#define ERROR_NO_DEVPATH 4 +#define ERROR_BAD_SNUMBER 5 +#define ERROR_NO_DISK 6 +#define ERROR_BAD_TABLE 7 +#define ERROR_BAD_SCAN 8 +#define NO_ERROR 0 + +extern int table_init(); + +#endif diff --git a/extras/chassis_id/provision.tbl b/extras/chassis_id/provision.tbl new file mode 100644 index 0000000000..c137fd537f --- /dev/null +++ b/extras/chassis_id/provision.tbl @@ -0,0 +1,5 @@ +id host number_of_disks chassis# slot# serial# name +1 1 2 1 2 3BM07NKA000070456Z6B disk1 +2 1 2 1 2 3BM07R68000070456ZCK disk2 +3 2 2 1 3 3EV08ANK00007219JAVA disk3 +4 2 2 1 4 3EV00NZB000072190Y90 disk4 diff --git a/extras/chassis_id/table.c b/extras/chassis_id/table.c new file mode 100644 index 0000000000..418497edbe --- /dev/null +++ b/extras/chassis_id/table.c @@ -0,0 +1,102 @@ + /* -*-c-*-: + ** + ** (C) 2003 Intel Corporation + ** Atul Sabharwal + ** + ** $Id: table.c,v 1.4 2004/03/18 21:56:24 atul Exp $ + ** + ** Distributed under the terms of the GNU Public License, v2.0 or + ** later. + ** + ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; + ** with his permission, they have been re-licensed GPL, and his + ** copyright still applies on them. + ** + */ + +#include +#define TABLE_SIZE 100 +#define PROVISION_DB "/usr/local/bin/provision.tbl" + +struct provision_record +{ + int id; + int host_num; //port # or adaptor number + int num_disks; + int chassis_num; + int slot_num; + char serial_num[32]; + char name[32]; + +} ptable[TABLE_SIZE]; + +int ptable_size; + +/* Initialize the provisioning table by reading the data from special file provision.tbl * + Return error if something does not work appropriately. */ +int table_init() +{ + FILE *fp; + char ptr[255]; + int i; + + fp=fopen( PROVISION_DB, "r"); + + if ((fp== NULL) || feof(fp)) + return -1; + + //skip the first line of text which contains descriptive details. + fgets(ptr, 80, fp); + i = 0; + while (!feof(fp)) + { + fgets(ptr, 80, fp); + sscanf( ptr, "%d %d %d %d %d %s %s", &ptable[i].id, &ptable[i].host_num, + &ptable[i].num_disks, &ptable[i].chassis_num, &ptable[i].slot_num, + ptable[i].serial_num, ptable[i].name ); + i++; + } + + ptable_size = i; + fclose(fp); + return 0; +} + + +/* return -1 when no disk found. Otherwise return index of disk */ +int table_find_disk( char * serialnumber , int * host_num, int * chassis_num, int *slot_num) +{ + + int i; + + for(i = 0; i < ptable_size; i++) + { + + if(strcmp(ptable[i].serial_num, serialnumber) == 0) + { + + *host_num = ptable[i].host_num; + *chassis_num = ptable[i].chassis_num; + *slot_num = ptable[i].slot_num; + break; + } + } + + if(i == ptable_size) + return -1; + else + return i; +} + +/* This function is primarily there for passing the selected disk entry to udev so that * + * it can create descriptive GDN for it. So, for that we need to output this data to * + * stdout. */ +int table_select_disk( int diskindex ) +{ + printf("%d ", ptable[diskindex].chassis_num); + printf("%d ", ptable[diskindex].slot_num); + printf("%d ", ptable[diskindex].host_num); + printf("%s ", ptable[diskindex].name); + +} + -- cgit v1.2.3-54-g00ecf From 0bcdc8498cdeaaef37444d38f39a19ff9557914d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 31 Mar 2004 18:27:02 -0800 Subject: [PATCH] clean up chassis_id coding style. --- extras/chassis_id/chassis_id.c | 152 +++++++++++++++++++---------------------- extras/chassis_id/chassis_id.h | 49 +++++++------ extras/chassis_id/table.c | 147 +++++++++++++++++++-------------------- 3 files changed, 166 insertions(+), 182 deletions(-) diff --git a/extras/chassis_id/chassis_id.c b/extras/chassis_id/chassis_id.c index 8f878b2c6e..857707eac7 100644 --- a/extras/chassis_id/chassis_id.c +++ b/extras/chassis_id/chassis_id.c @@ -1,19 +1,16 @@ - - /* -*-c-*-: - ** - ** (C) 2003 Intel Corporation - ** Atul Sabharwal - ** - ** $Id: chassis_id.c,v 1.8 2004/03/22 23:33:10 atul Exp $ - ** - ** Distributed under the terms of the GNU Public License, v2.0 or - ** later. - ** - ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; - ** with his permission, they have been re-licensed GPL, and his - ** copyright still applies on them. - ** - */ +/* -*-c-*-: + ** + ** (C) 2003 Intel Corporation + ** Atul Sabharwal + ** + ** Distributed under the terms of the GNU Public License, v2.0 or + ** later. + ** + ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; + ** with his permission, they have been re-licensed GPL, and his + ** copyright still applies on them + ** + */ #include #include @@ -25,88 +22,83 @@ int main(int argc, char **argv, char ** envp) { - int chassis_num, slot_num, retval, host_num; - char disk_snum[255], devpath[255]; - char * ptr; - int disk_index; + int chassis_num, slot_num, retval, host_num; + char disk_snum[255], devpath[255]; + char *ptr; + int disk_index; - syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", "starting chassis_id" ); + syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", "starting chassis_id" ); #if 0 - ptr = (char *) getenv( "CHASSIS"); - if( ptr == NULL ) - return -ERROR_NO_CHASSIS; + ptr = getenv("CHASSIS"); + if (ptr == NULL) + return -ERROR_NO_CHASSIS; - sscanf(ptr, "%d", &chassis_num); - #ifdef DEBUG - syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "Chassis %d", chassis_num); - #endif + sscanf(ptr, "%d", &chassis_num); + #ifdef DEBUG + syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "Chassis %d", chassis_num); + #endif - ptr = (char *) getenv( "SLOT" ); - if( ptr== NULL ) - return -ERROR_NO_SLOT; + ptr = getenv("SLOT"); + if (ptr== NULL) + return -ERROR_NO_SLOT; - sscanf(ptr, "%d", &slot_num); - #ifdef DEBUG - syslog( LOG_PID|LOG_DAEMON| LOG_ERR, "Slot %d", slot_num); - #endif + sscanf(ptr, "%d", &slot_num); + #ifdef DEBUG + syslog( LOG_PID|LOG_DAEMON| LOG_ERR, "Slot %d", slot_num); + #endif #endif - ptr = (char *) getenv( "DEVPATH"); - if( ptr == NULL ) - return -ERROR_NO_DEVPATH; - - sscanf(ptr, "%s", &devpath[0]); - #ifdef DEBUG - syslog( LOG_PID|LOG_DAEMON| LOG_ERR, "Devpath %s", devpath); - #endif - - retval = table_init(); - if(retval < 0 ) - return -ERROR_BAD_TABLE; - - getserial_number( devpath, disk_snum); - - - /* Now we open the provisioning table t find actual entry for the serial number*/ - disk_index = table_find_disk(disk_snum, &host_num, &chassis_num, &slot_num); - if ( disk_index == -1 ) - { - //typical provisioning error - return -ERROR_NO_DISK; - } - else - { - table_select_disk( disk_index ); - } - return 0; + ptr = getenv("DEVPATH"); + if (ptr == NULL) + return -ERROR_NO_DEVPATH; + + sscanf(ptr, "%s", &devpath[0]); + #ifdef DEBUG + syslog(LOG_PID|LOG_DAEMON| LOG_ERR, "Devpath %s", devpath); + #endif + + retval = table_init(); + if (retval < 0) + return -ERROR_BAD_TABLE; + + getserial_number(devpath, disk_snum); + + /* Now we open the provisioning table t find actual entry for the serial number*/ + disk_index = table_find_disk(disk_snum, &host_num, &chassis_num, &slot_num); + if ( disk_index == -1 ) { + // typical provisioning error + return -ERROR_NO_DISK; + } else { + table_select_disk( disk_index ); + } + return 0; } /* Run SCSI id to find serial number of the device */ int getserial_number( char * devpath, char * snumber ) { - FILE *fp; - char vendor [255], model[255], cmd[255]; - int retval; - - sprintf(cmd, "/sbin/scsi_id -s %s -p 0x80", devpath); + FILE *fp; + char vendor[255], model[255], cmd[255]; + int retval; - fp = popen( cmd, "r"); + sprintf(cmd, "/sbin/scsi_id -s %s -p 0x80", devpath); - if (fp == NULL) - return -ERROR_BAD_SNUMBER; + fp = popen(cmd, "r"); - fscanf( fp, "%s %s %s", vendor, model, snumber); - #ifdef DEBUG - syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", snumber ); - #endif + if (fp == NULL) + return -ERROR_BAD_SNUMBER; - retval = pclose(fp); - if (retval == -1) - return -ERROR_BAD_SNUMBER; - else - return NO_ERROR; + fscanf(fp, "%s %s %s", vendor, model, snumber); + #ifdef DEBUG + syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", snumber ); + #endif + retval = pclose(fp); + if (retval == -1) + return -ERROR_BAD_SNUMBER; + else + return NO_ERROR; } diff --git a/extras/chassis_id/chassis_id.h b/extras/chassis_id/chassis_id.h index db5db90c21..253e603bfd 100644 --- a/extras/chassis_id/chassis_id.h +++ b/extras/chassis_id/chassis_id.h @@ -1,33 +1,30 @@ - - /* -*-c-*-: - ** - ** (C) 2003 Intel Corporation - ** Atul Sabharwal - ** - ** $Id: chassis_id.h,v 1.1 2004/03/16 18:24:44 atul Exp $ - ** - ** Distributed under the terms of the GNU Public License, v2.0 or - ** later. - ** - ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; - ** with his permission, they have been re-licensed GPL, and his - ** copyright still applies on them. - ** - */ +/* -*-c-*-: + ** + ** (C) 2003 Intel Corporation + ** Atul Sabharwal + ** + ** Distributed under the terms of the GNU Public License, v2.0 or + ** later. + ** + ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; + ** with his permission, they have been re-licensed GPL, and his + ** copyright still applies on them. + ** + */ #ifndef _CHASSIS_ID_H #define _CHASSIS_ID_H -//#define DEBUG 1 -#define ERROR 1 -#define ERROR_NO_SLOT 2 -#define ERROR_NO_CHASSIS 3 -#define ERROR_NO_DEVPATH 4 -#define ERROR_BAD_SNUMBER 5 -#define ERROR_NO_DISK 6 -#define ERROR_BAD_TABLE 7 -#define ERROR_BAD_SCAN 8 -#define NO_ERROR 0 +//#define DEBUG 1 +#define ERROR 1 +#define ERROR_NO_SLOT 2 +#define ERROR_NO_CHASSIS 3 +#define ERROR_NO_DEVPATH 4 +#define ERROR_BAD_SNUMBER 5 +#define ERROR_NO_DISK 6 +#define ERROR_BAD_TABLE 7 +#define ERROR_BAD_SCAN 8 +#define NO_ERROR 0 extern int table_init(); diff --git a/extras/chassis_id/table.c b/extras/chassis_id/table.c index 418497edbe..e619fa9ef3 100644 --- a/extras/chassis_id/table.c +++ b/extras/chassis_id/table.c @@ -1,33 +1,33 @@ - /* -*-c-*-: - ** - ** (C) 2003 Intel Corporation - ** Atul Sabharwal - ** - ** $Id: table.c,v 1.4 2004/03/18 21:56:24 atul Exp $ - ** - ** Distributed under the terms of the GNU Public License, v2.0 or - ** later. - ** - ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; - ** with his permission, they have been re-licensed GPL, and his - ** copyright still applies on them. - ** - */ +/* -*-c-*-: + ** + ** (C) 2003 Intel Corporation + ** Atul Sabharwal + ** + ** $Id: table.c,v 1.4 2004/03/18 21:56:24 atul Exp $ + ** + ** Distributed under the terms of the GNU Public License, v2.0 or + ** later. + ** + ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; + ** with his permission, they have been re-licensed GPL, and his + ** copyright still applies on them. + ** + */ #include + #define TABLE_SIZE 100 #define PROVISION_DB "/usr/local/bin/provision.tbl" struct provision_record { - int id; - int host_num; //port # or adaptor number - int num_disks; - int chassis_num; - int slot_num; - char serial_num[32]; - char name[32]; - + int id; + int host_num; //port # or adaptor number + int num_disks; + int chassis_num; + int slot_num; + char serial_num[32]; + char name[32]; } ptable[TABLE_SIZE]; int ptable_size; @@ -36,67 +36,62 @@ int ptable_size; Return error if something does not work appropriately. */ int table_init() { - FILE *fp; - char ptr[255]; - int i; - - fp=fopen( PROVISION_DB, "r"); - - if ((fp== NULL) || feof(fp)) - return -1; - - //skip the first line of text which contains descriptive details. - fgets(ptr, 80, fp); - i = 0; - while (!feof(fp)) - { - fgets(ptr, 80, fp); - sscanf( ptr, "%d %d %d %d %d %s %s", &ptable[i].id, &ptable[i].host_num, - &ptable[i].num_disks, &ptable[i].chassis_num, &ptable[i].slot_num, - ptable[i].serial_num, ptable[i].name ); - i++; - } - - ptable_size = i; - fclose(fp); - return 0; + FILE *fp; + char ptr[255]; + int i; + + fp = fopen( PROVISION_DB, "r"); + + if ((fp== NULL) || feof(fp)) + return -1; + + // skip the first line of text which contains descriptive details. + fgets(ptr, 80, fp); + i = 0; + while (!feof(fp)) { + fgets(ptr, 80, fp); + sscanf(ptr, "%d %d %d %d %d %s %s", &ptable[i].id, + &ptable[i].host_num, &ptable[i].num_disks, + &ptable[i].chassis_num, &ptable[i].slot_num, + ptable[i].serial_num, ptable[i].name); + i++; + } + + ptable_size = i; + fclose(fp); + return 0; } -/* return -1 when no disk found. Otherwise return index of disk */ +/* return -1 when no disk found. Otherwise return index of disk */ int table_find_disk( char * serialnumber , int * host_num, int * chassis_num, int *slot_num) { - - int i; - - for(i = 0; i < ptable_size; i++) - { - - if(strcmp(ptable[i].serial_num, serialnumber) == 0) - { - - *host_num = ptable[i].host_num; - *chassis_num = ptable[i].chassis_num; - *slot_num = ptable[i].slot_num; - break; - } - } - - if(i == ptable_size) - return -1; - else - return i; + int i; + + for (i = 0; i < ptable_size; i++) { + if (strcmp(ptable[i].serial_num, serialnumber) == 0) { + *host_num = ptable[i].host_num; + *chassis_num = ptable[i].chassis_num; + *slot_num = ptable[i].slot_num; + break; + } + } + + if (i == ptable_size) + return -1; + else + return i; } -/* This function is primarily there for passing the selected disk entry to udev so that * - * it can create descriptive GDN for it. So, for that we need to output this data to * - * stdout. */ +/* This function is primarily there for passing the selected disk entry to udev + * so that it can create descriptive GDN for it. So, for that we need to output + * this data to stdout. + */ int table_select_disk( int diskindex ) { - printf("%d ", ptable[diskindex].chassis_num); - printf("%d ", ptable[diskindex].slot_num); - printf("%d ", ptable[diskindex].host_num); - printf("%s ", ptable[diskindex].name); - + printf("%d ", ptable[diskindex].chassis_num); + printf("%d ", ptable[diskindex].slot_num); + printf("%d ", ptable[diskindex].host_num); + printf("%s ", ptable[diskindex].name); } -- cgit v1.2.3-54-g00ecf From 0536819cca9468cf383807037dbaa5ad0d48b60f Mon Sep 17 00:00:00 2001 From: "hare@suse.de" Date: Wed, 31 Mar 2004 22:56:45 -0800 Subject: [PATCH] fix SEGV in libsysfs/dlist.c Hi all, Greg, libsysfs/dlist.c: _dlist_mark_move() is missing checks for empty lists and may (and indeed, does) crash when=20 called with empty dlists. --- libsysfs/dlist.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c index 942eccb48c..b440d65bed 100644 --- a/libsysfs/dlist.c +++ b/libsysfs/dlist.c @@ -74,14 +74,14 @@ inline void *_dlist_mark_move(Dlist *list,int direction) { if(direction) { - if( list->marker->next!=NULL) + if( list->marker && list->marker->next!=NULL) list->marker=list->marker->next; else return(NULL); } else { - if( list->marker->prev!=NULL) + if( list->marker && list->marker->prev!=NULL) list->marker=list->marker->prev; else return(NULL); -- cgit v1.2.3-54-g00ecf From c1f8ea9562765d920881d46aeac69cce554d7ce3 Mon Sep 17 00:00:00 2001 From: "atul.sabharwal@intel.com" Date: Wed, 31 Mar 2004 22:56:51 -0800 Subject: [PATCH] Add README for chassis_id --- extras/chassis_id/README | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 extras/chassis_id/README diff --git a/extras/chassis_id/README b/extras/chassis_id/README new file mode 100644 index 0000000000..51add4945e --- /dev/null +++ b/extras/chassis_id/README @@ -0,0 +1,28 @@ + README.txt + ~~~~~~~~~~ +Chassis_id is a callout program which is used to give geographic names to devices. It uses +another callout program scsi_id to determine the serial number of a device and then looks up +the provisioning table based on this key. It retrieves geographic information +( chassis#, slot# and host# ) about the device and prints it to stdout. These fields are +used by udev to create the device entry. + +Using Udev: +~~~~~~~~~~ +Chassis_id gets invoked by udev using the udev as below: + +BUS="scsi", PROGRAM="/usr/local/bin/chassis_id", NAME="/chassis%c{1}/slot%c{2}/host%c{3}/disk-%c{4} + +The provisioning table ( file provision.tbl ) has to be put in /usr/local/bin and as of now has +to be populated manually. This is the only place where the geographic map of devices is kept +in the system. + + +Usage Model: +~~~~~~~~~~~~ +On ATCA based blade architecture systems, blade insertion/removal is common. We create names +in a 3 level deep tree which represent the geographic map of the devices. + + +CONTACT: +~~~~~~~~ +Please feel free to contact atul.sabharwal@intel.com with questions, comments, suggestions. -- cgit v1.2.3-54-g00ecf From 7b9b18392182e5cfa5d731288e8592549bdf67df Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 31 Mar 2004 23:00:45 -0800 Subject: [PATCH] udevinfo patch On Fri, Mar 26, 2004 at 06:36:32PM +0500, Ananth N Mavinakayanahalli wrote: > On Fri, Mar 26, 2004 at 11:24:39AM +0100, Kay Sievers wrote: > > On Fri, Mar 26, 2004 at 11:21:29AM +0500, Ananth N Mavinakayanahalli wrote: > > > On Fri, Mar 26, 2004 at 04:47:35AM +0100, Kay Sievers wrote: > > > > On Fri, Mar 26, 2004 at 01:26:46AM +0100, Carl-Daniel Hailfinger wrote: > > > > > Greg KH wrote: > > > > > > On Tue, Mar 23, 2004 at 01:51:01PM -0800, Daniel Stekloff wrote: > > > > > > > > No, it breaks the net device handling. I think we should change > > > > libsysfs instead, not to return a class device for '/block', if > > > > we want to fix it. > > > > > > /sys/block is considered a sysfs "class" and not a class_device. So, > > > going by udevinfo's help, -p expects path to a class_device and _not_ > > > a class itself and hence option /sys/block with -p is not a valid query. > > > > > > Kay? > > > > Yes, it's invalid, but we shouldn't print major minor for a invalid > > path. sysfs_open_class_device_path("/block") returns a device. If this is > > the right behavior for libsysfs, I will change the get_device_type("/block") > > not to return a 'b'-type. > > Libsysfs validates the path given to it for opening a class_device to be > a valid directory; it does not however validate if the path is a valid > class_device path. So, in the case of udevinfo, a 'b' type should not > be returned if the path is just /sys/block or /sys/block/ This may prevent it. --- udev_lib.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/udev_lib.c b/udev_lib.c index e9c16c863a..db1096ebf7 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -86,17 +86,28 @@ char *get_subsystem(char *subsystem) return subsystem; } +#define BLOCK_PATH "/block/" +#define CLASS_PATH "/class/" +#define NET_PATH "/class/net/" + char get_device_type(const char *path, const char *subsystem) { - if (strcmp(subsystem, "block") == 0 || - strstr(path, "/block/") != NULL) + if (strcmp(subsystem, "block") == 0) + return 'b'; + + if (strcmp(subsystem, "net") == 0) + return 'n'; + + if (strncmp(path, BLOCK_PATH, strlen(BLOCK_PATH)) == 0 && + strlen(path) > strlen(BLOCK_PATH)) return 'b'; - if (strcmp(subsystem, "net") == 0 || - strstr(path, "/class/net/") != NULL) + if (strncmp(path, NET_PATH, strlen(NET_PATH)) == 0 && + strlen(path) > strlen(NET_PATH)) return 'n'; - if (strstr(path, "/class/") != NULL) + if (strncmp(path, CLASS_PATH, strlen(CLASS_PATH)) == 0 && + strlen(path) > strlen(CLASS_PATH)) return 'c'; return '\0'; -- cgit v1.2.3-54-g00ecf From f27125f98f6487e881a957726da895aebd799f0d Mon Sep 17 00:00:00 2001 From: "chris_friesen@sympatico.ca" Date: Wed, 31 Mar 2004 23:03:07 -0800 Subject: [PATCH] udevd race conditions and performance, assorted cleanups This patch covers a number of areas: 1) sysfs.h is fixed up to use the common dbg() macro. This fixes the case where DEBUG is defined but USE_LOG isn't. 2) udevstart.c is modified to include the proper headers, rather than getting them indirectly which can break depending on Makefile flags 3) udevd.c gets some major changes: a) I added a pipe from the signal handler. This fixes the race conditions that I mentioned earlier. Basically, the point of the pipe is to force the select() call to return immediately if a signal handler fired before we actually started the select() call. This then lets us run the appropriate code based on flags set in the signal handler proper. b) I added a number of flags to coalesce calls to common routines. This should make things slightly more efficient. c) since most calls will tend to come in with a sequence number larger than what has been received, I switched msg_queue_insert() to scan the msg_list backwards to improve performance. filename="udevd.diff" --- libsysfs/sysfs.h | 4 +- udevd.c | 167 +++++++++++++++++++++++++++++++++++++++++++++---------- udevstart.c | 2 + 3 files changed, 140 insertions(+), 33 deletions(-) diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 1b800ddcd2..0fdb38af19 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -37,9 +37,7 @@ #ifdef DEBUG #include "../logging.h" #define dprintf(format, arg...) \ - do { \ - log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ - } while (0) + dbg(format, ##arg) #else #define dprintf(format, arg...) do { } while (0) #endif diff --git a/udevd.c b/udevd.c index 0757dcaf3d..3b91a458da 100644 --- a/udevd.c +++ b/udevd.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "list.h" #include "udev.h" @@ -41,9 +42,12 @@ #include "udevd.h" #include "logging.h" +static int pipefds[2]; static int expected_seqnum = 0; volatile static int children_waiting; -volatile static int msg_q_timeout; +volatile static int run_msg_q; +volatile static int sig_flag; +static int run_exec_q; static LIST_HEAD(msg_list); static LIST_HEAD(exec_list); @@ -51,6 +55,8 @@ static LIST_HEAD(running_list); static void exec_queue_manager(void); static void msg_queue_manager(void); +static void user_sighandler(void); +static void reap_kids(void); #ifdef LOG unsigned char logname[LOGNAME_SIZE]; @@ -66,10 +72,12 @@ void log_message (int level, const char *format, ...) static void msg_dump_queue(void) { +#ifdef DEBUG struct hotplug_msg *msg; list_for_each_entry(msg, &msg_list, list) dbg("sequence %d in queue", msg->seqnum); +#endif } static void msg_dump(struct hotplug_msg *msg) @@ -92,7 +100,6 @@ static void run_queue_delete(struct hotplug_msg *msg) { list_del(&msg->list); free(msg); - exec_queue_manager(); } /* orders the message in the queue by sequence number */ @@ -100,18 +107,20 @@ static void msg_queue_insert(struct hotplug_msg *msg) { struct hotplug_msg *loop_msg; - /* sort message by sequence number into list*/ - list_for_each_entry(loop_msg, &msg_list, list) - if (loop_msg->seqnum > msg->seqnum) + /* sort message by sequence number into list. events + * will tend to come in order, so scan the list backwards + */ + list_for_each_entry_reverse(loop_msg, &msg_list, list) + if (loop_msg->seqnum < msg->seqnum) break; - list_add_tail(&msg->list, &loop_msg->list); + list_add(&msg->list, &loop_msg->list); dbg("queued message seq %d", msg->seqnum); /* store timestamp of queuing */ msg->queue_time = time(NULL); /* run msg queue manager */ - msg_queue_manager(); + run_msg_q = 1; return ; } @@ -138,6 +147,9 @@ static void udev_run(struct hotplug_msg *msg) case -1: dbg("fork of child failed"); run_queue_delete(msg); + /* note: we never managed to run, so we had no impact on + * running_with_devpath(), so don't bother setting run_exec_q + */ break; default: /* get SIGCHLD in main loop */ @@ -180,7 +192,7 @@ static void exec_queue_manager() static void msg_move_exec(struct hotplug_msg *msg) { list_move_tail(&msg->list, &exec_list); - exec_queue_manager(); + run_exec_q = 1; expected_seqnum = msg->seqnum+1; dbg("moved seq %d to exec, next expected is %d", msg->seqnum, expected_seqnum); @@ -276,7 +288,7 @@ static void handle_msg(int sock) /* if no seqnum is given, we move straight to exec queue */ if (msg->seqnum == -1) { list_add(&msg->list, &exec_list); - exec_queue_manager(); + run_exec_q = 1; } else { msg_queue_insert(msg); } @@ -289,19 +301,37 @@ skip: static void sig_handler(int signum) { + int rc; switch (signum) { case SIGINT: case SIGTERM: exit(20 + signum); break; case SIGALRM: - msg_q_timeout = 1; + /* set flag, then write to pipe if needed */ + run_msg_q = 1; + goto do_write; break; case SIGCHLD: + /* set flag, then write to pipe if needed */ children_waiting = 1; + goto do_write; break; default: dbg("unhandled signal"); + return; + } + +do_write: + /* if pipe is empty, write to pipe to force select to return + * immediately when it gets called + */ + if (!sig_flag) { + rc = write(pipefds[1],&signum,sizeof(signum)); + if (rc < 0) + dbg("unable to write to pipe"); + else + sig_flag = 1; } } @@ -314,19 +344,53 @@ static void udev_done(int pid) if (msg->pid == pid) { dbg("<== exec seq %d came back", msg->seqnum); run_queue_delete(msg); + + /* we want to run the exec queue manager since there may + * be events waiting with the devpath of the one that + * just finished + */ + run_exec_q = 1; return; } } } +static void reap_kids() +{ + /* reap all dead children */ + while(1) { + int pid = waitpid(-1, 0, WNOHANG); + if ((pid == -1) || (pid == 0)) + break; + udev_done(pid); + } +} + +/* just read everything from the pipe and clear the flag, + * the useful flags were set in the signal handler + */ +static void user_sighandler() +{ + int sig; + while(1) { + int rc = read(pipefds[0],&sig,sizeof(sig)); + if (rc < 0) + break; + + sig_flag = 0; + } +} + + int main(int argc, char *argv[]) { - int ssock; + int ssock, maxsockplus; struct sockaddr_un saddr; socklen_t addrlen; int retval; const int on = 1; struct sigaction act; + fd_set readfds; init_logging("udevd"); dbg("version %s", UDEV_VERSION); @@ -335,16 +399,32 @@ int main(int argc, char *argv[]) dbg("need to be root, exit"); exit(1); } - - /* set signal handler */ + + /* setup signal handler pipe */ + retval = pipe(pipefds); + if (retval < 0) { + dbg("error getting pipes: %s", strerror(errno)); + exit(1); + } + + retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK); + if (retval < 0) { + dbg("fcntl on read pipe: %s", strerror(errno)); + exit(1); + } + + retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK); + if (retval < 0) { + dbg("fcntl on write pipe: %s", strerror(errno)); + exit(1); + } + + /* set signal handlers */ act.sa_handler = sig_handler; - sigemptyset (&act.sa_mask); + sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); - - /* we want these two to interrupt system calls */ - act.sa_flags = 0; sigaction(SIGALRM, &act, NULL); sigaction(SIGCHLD, &act, NULL); @@ -370,23 +450,50 @@ int main(int argc, char *argv[]) /* enable receiving of the sender credentials */ setsockopt(ssock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + FD_ZERO(&readfds); + FD_SET(ssock, &readfds); + FD_SET(pipefds[0], &readfds); + maxsockplus = ssock+1; while (1) { - handle_msg(ssock); - - while(msg_q_timeout) { - msg_q_timeout = 0; - msg_queue_manager(); + fd_set workreadfds = readfds; + retval = select(maxsockplus, &workreadfds, NULL, NULL, NULL); + + if (retval < 0) { + dbg("error in select: %s", strerror(errno)); + continue; } - - while(children_waiting) { + + if (FD_ISSET(ssock, &workreadfds)) + handle_msg(ssock); + + if (FD_ISSET(pipefds[0], &workreadfds)) + user_sighandler(); + + if (children_waiting) { children_waiting = 0; - /* reap all dead children */ - while(1) { - int pid = waitpid(-1, 0, WNOHANG); - if ((pid == -1) || (pid == 0)) - break; - udev_done(pid); + reap_kids(); + } + + if (run_msg_q) { + run_msg_q = 0; + msg_queue_manager(); + } + + if (run_exec_q) { + + /* this is tricky. exec_queue_manager() loops over exec_list, and + * calls running_with_devpath(), which loops over running_list. This gives + * O(N*M), which can get *nasty*. Clean up running_list before + * calling exec_queue_manager(). + */ + + if (children_waiting) { + children_waiting = 0; + reap_kids(); } + + run_exec_q = 0; + exec_queue_manager(); } } exit: diff --git a/udevstart.c b/udevstart.c index 40dbaf2475..eda6355b53 100644 --- a/udevstart.c +++ b/udevstart.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "logging.h" -- cgit v1.2.3-54-g00ecf From e5a2989efbae81f40b60885a8f92ea1f87df7ea9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 31 Mar 2004 23:03:46 -0800 Subject: [PATCH] udevd race conditions and performance, assorted cleanups - take 2 here is a patch on top of your nice improvements. I fixed the whitespace and it hopefully fixes the stupid timestamp bug in udevd. Some stupid OS sets the hwclock to localtime and linux changes it to UTC while starting. If any events are pending they may be delayed by the users time distance from UTC :) So we use the uptime seconds now. --- Makefile | 5 ++-- klibc_fixups.c | 2 ++ klibc_fixups.h | 5 ++++ libsysfs/sysfs.h | 3 +- udevd.c | 87 ++++++++++++++++++++++++++++++-------------------------- udevd.h | 2 +- udevsend.c | 17 ++++++----- 7 files changed, 67 insertions(+), 54 deletions(-) diff --git a/Makefile b/Makefile index d0ca3a18d9..652e712d77 100644 --- a/Makefile +++ b/Makefile @@ -220,6 +220,7 @@ HEADERS = udev.h \ ifeq ($(strip $(USE_KLIBC)),true) OBJS += klibc_fixups.o + KLIBC_FIXUP = klibc_fixups.o endif # header files automatically generated @@ -266,8 +267,8 @@ $(INFO): $(INFO).o $(OBJS) $(HEADERS) $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(DAEMON): $(DAEMON).o udevd.h $(LIBC) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(DAEMON): $(DAEMON).o $(OBJS) udevd.h $(LIBC) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o udev_lib.o $(KLIBC_FIXUP) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ $(SENDER): $(SENDER).o udevd.h $(LIBC) diff --git a/klibc_fixups.c b/klibc_fixups.c index eaa240c183..c4d44bbc49 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -30,12 +30,14 @@ #include "udev.h" #include "klibc_fixups.h" +#include "udev_lib.h" #include "logging.h" #define PW_FILE "/etc/passwd" #define GR_FILE "/etc/group" #define UTMP_FILE "/var/run/utmp" +_syscall1(int, sysinfo, struct sysinfo *, info); /* return the id of a passwd style line, selected by the users name */ static unsigned long get_id_by_name(const char *uname, const char *dbfile) diff --git a/klibc_fixups.h b/klibc_fixups.h index f6c91cdd94..6dfd5a5c17 100644 --- a/klibc_fixups.h +++ b/klibc_fixups.h @@ -3,6 +3,11 @@ #ifndef KLIBC_FIXUPS_H #define KLIBC_FIXUPS_H +#include +#include + +int sysinfo(struct sysinfo *info); + struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 0fdb38af19..7ac6efc678 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -36,8 +36,7 @@ /* Debugging */ #ifdef DEBUG #include "../logging.h" -#define dprintf(format, arg...) \ - dbg(format, ##arg) +#define dprintf(format, arg...) dbg(format, ##arg) #else #define dprintf(format, arg...) do { } while (0) #endif diff --git a/udevd.c b/udevd.c index 3b91a458da..301625fd92 100644 --- a/udevd.c +++ b/udevd.c @@ -28,12 +28,15 @@ #include #include #include -#include +#include #include #include #include -#include #include +#include "klibc_fixups.h" +#ifndef __KLIBC__ +#include +#endif #include "list.h" #include "udev.h" @@ -106,6 +109,7 @@ static void run_queue_delete(struct hotplug_msg *msg) static void msg_queue_insert(struct hotplug_msg *msg) { struct hotplug_msg *loop_msg; + struct sysinfo info; /* sort message by sequence number into list. events * will tend to come in order, so scan the list backwards @@ -113,11 +117,13 @@ static void msg_queue_insert(struct hotplug_msg *msg) list_for_each_entry_reverse(loop_msg, &msg_list, list) if (loop_msg->seqnum < msg->seqnum) break; - list_add(&msg->list, &loop_msg->list); - dbg("queued message seq %d", msg->seqnum); /* store timestamp of queuing */ - msg->queue_time = time(NULL); + sysinfo(&info); + msg->queue_time = info.uptime; + + list_add(&msg->list, &loop_msg->list); + dbg("queued message seq %d", msg->seqnum); /* run msg queue manager */ run_msg_q = 1; @@ -203,7 +209,8 @@ static void msg_queue_manager() { struct hotplug_msg *loop_msg; struct hotplug_msg *tmp_msg; - time_t msg_age = 0; + struct sysinfo info; + long msg_age = 0; dbg("msg queue manager, next expected is %d", expected_seqnum); recheck: @@ -215,7 +222,9 @@ recheck: } /* move event with expired timeout to the exec list */ - msg_age = time(NULL) - loop_msg->queue_time; + sysinfo(&info); + msg_age = info.uptime - loop_msg->queue_time; + dbg("seq %d is %li seconds old", loop_msg->seqnum, msg_age); if (msg_age > EVENT_TIMEOUT_SEC-1) { msg_move_exec(loop_msg); goto recheck; @@ -226,11 +235,10 @@ recheck: msg_dump_queue(); + /* set timeout for remaining queued events */ if (list_empty(&msg_list) == 0) { - /* set timeout for remaining queued events */ struct itimerval itv = {{0, 0}, {EVENT_TIMEOUT_SEC - msg_age, 0}}; - dbg("next event expires in %li seconds", - EVENT_TIMEOUT_SEC - msg_age); + dbg("next event expires in %li seconds", EVENT_TIMEOUT_SEC - msg_age); setitimer(ITIMER_REAL, &itv, 0); } } @@ -399,25 +407,25 @@ int main(int argc, char *argv[]) dbg("need to be root, exit"); exit(1); } - + /* setup signal handler pipe */ - retval = pipe(pipefds); - if (retval < 0) { - dbg("error getting pipes: %s", strerror(errno)); - exit(1); - } - - retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK); - if (retval < 0) { - dbg("fcntl on read pipe: %s", strerror(errno)); - exit(1); - } - - retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK); - if (retval < 0) { - dbg("fcntl on write pipe: %s", strerror(errno)); - exit(1); - } + retval = pipe(pipefds); + if (retval < 0) { + dbg("error getting pipes: %s", strerror(errno)); + exit(1); + } + + retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK); + if (retval < 0) { + dbg("error fcntl on read pipe: %s", strerror(errno)); + exit(1); + } + + retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK); + if (retval < 0) { + dbg("error fcntl on write pipe: %s", strerror(errno)); + exit(1); + } /* set signal handlers */ act.sa_handler = sig_handler; @@ -450,43 +458,42 @@ int main(int argc, char *argv[]) /* enable receiving of the sender credentials */ setsockopt(ssock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - FD_ZERO(&readfds); - FD_SET(ssock, &readfds); - FD_SET(pipefds[0], &readfds); + FD_ZERO(&readfds); + FD_SET(ssock, &readfds); + FD_SET(pipefds[0], &readfds); maxsockplus = ssock+1; while (1) { fd_set workreadfds = readfds; retval = select(maxsockplus, &workreadfds, NULL, NULL, NULL); - + if (retval < 0) { - dbg("error in select: %s", strerror(errno)); + if (errno != EINTR) + dbg("error in select: %s", strerror(errno)); continue; } - + if (FD_ISSET(ssock, &workreadfds)) handle_msg(ssock); - + if (FD_ISSET(pipefds[0], &workreadfds)) user_sighandler(); - + if (children_waiting) { children_waiting = 0; reap_kids(); } - + if (run_msg_q) { run_msg_q = 0; msg_queue_manager(); } - + if (run_exec_q) { - /* this is tricky. exec_queue_manager() loops over exec_list, and * calls running_with_devpath(), which loops over running_list. This gives * O(N*M), which can get *nasty*. Clean up running_list before * calling exec_queue_manager(). */ - if (children_waiting) { children_waiting = 0; reap_kids(); diff --git a/udevd.h b/udevd.h index 8b82ff9a70..96f179ad44 100644 --- a/udevd.h +++ b/udevd.h @@ -34,7 +34,7 @@ struct hotplug_msg { struct list_head list; pid_t pid; int seqnum; - time_t queue_time; + long queue_time; char action[ACTION_SIZE]; char devpath[DEVPATH_SIZE]; char subsystem[SUBSYSTEM_SIZE]; diff --git a/udevsend.c b/udevsend.c index f1c46d3367..f28e445433 100644 --- a/udevsend.c +++ b/udevsend.c @@ -26,13 +26,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include #include "udev.h" @@ -53,16 +53,15 @@ void log_message (int level, const char *format, ...) } #endif -static int build_hotplugmsg(struct hotplug_msg *msg, char *action, - char *devpath, char *subsystem, int seqnum) +static void build_hotplugmsg(struct hotplug_msg *msg, char *action, + char *devpath, char *subsystem, int seqnum) { - memset(msg, 0x00, sizeof(*msg)); + memset(msg, 0x00, sizeof(struct hotplug_msg)); strfieldcpy(msg->magic, UDEV_MAGIC); msg->seqnum = seqnum; strfieldcpy(msg->action, action); strfieldcpy(msg->devpath, devpath); strfieldcpy(msg->subsystem, subsystem); - return sizeof(struct hotplug_msg); } static int start_daemon(void) @@ -108,7 +107,6 @@ int main(int argc, char* argv[]) char *seqnum; int seq; int retval = 1; - int size; int loop; struct timespec tspec; int sock; @@ -155,18 +153,19 @@ int main(int argc, char* argv[]) goto exit; } - memset(&saddr, 0x00, sizeof(saddr)); + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - size = build_hotplugmsg(&msg, action, devpath, subsystem, seq); + build_hotplugmsg(&msg, action, devpath, subsystem, seq); /* If we can't send, try to start daemon and resend message */ loop = UDEVSEND_CONNECT_RETRY; while (loop--) { - retval = sendto(sock, &msg, size, 0, (struct sockaddr *)&saddr, addrlen); + retval = sendto(sock, &msg, sizeof(struct hotplug_msg), 0, + (struct sockaddr *)&saddr, addrlen); if (retval != -1) { retval = 0; goto close_and_exit; -- cgit v1.2.3-54-g00ecf From bbbe503ec1a5623a5a8abd003f46fdd8c3581054 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 31 Mar 2004 23:12:57 -0800 Subject: [PATCH] netdev - udevdb+dev.d changes Here is a patch to change the netdev handling in the database and for the dev.d/ calls. I applies on top of the udevd.patch, cause klibc has no sysinfo(). o netdev's are also put into our database now. I want this for the udevruler gui to get a list of all handled devices. All devices in the db are stamped with the system uptime value at the creation time. 'udevinfo -d' prints it. o the DEVPATH value is the key for udevdb, but if we rename a netdev, the name is replaced in the kernel, so we add the changed name to the db to match with the remove event. NOTE: The dev.d/ scripts still get the original name from the hotplug call. Should we replace DEVPATH with the new name too? o We now only add a device to the db, if we have successfully created the main node or successfully renamed a netdev. This is the main part of the patch, cause I needed to clean the retval passing trough all the functions used for node creation. o DEVNODE sounds a bit ugly for netdev's so I exported DEVNAME too. Can we change the name? o I've added a UDEV_NO_DEVD to possibly skip the script execution and used it in udev-test.pl. udevstart is the same horror now, if you have scripts with logging statements in dev.d/ it takes minutes to finish, can we skip the scripts here too? o The get_device_type() function is changed to be more strict, cause 'udevinfo -a -p /block/' gets a class device for it and tries to print the major/minor values. o bugfix, the RESULT value has now a working newline removal and a test for this case. --- dev_d.c | 18 ++++++--- namedev.c | 26 +++++++------ test/udev-test.pl | 11 ++++++ udev-add.c | 107 ++++++++++++++++++++++++++++++------------------------ udev-remove.c | 40 +++++++------------- udev.h | 3 +- udev_config.c | 5 +++ udevdb.c | 1 + udevinfo.c | 3 +- udevruler.c | 14 +++---- 10 files changed, 128 insertions(+), 100 deletions(-) diff --git a/dev_d.c b/dev_d.c index 9bb9507b9b..0910e4d323 100644 --- a/dev_d.c +++ b/dev_d.c @@ -64,11 +64,20 @@ static int run_program(char *name) void dev_d_send(struct udevice *dev, char *subsystem) { char dirname[256]; - char devnode[NAME_SIZE]; + char devname[NAME_SIZE]; - strfieldcpy(devnode, udev_root); - strfieldcat(devnode, dev->name); - setenv("DEVNODE", devnode, 1); + if (udev_dev_d == 0) + return; + + if (dev->type == 'b' || dev->type == 'c') { + strfieldcpy(devname, udev_root); + strfieldcat(devname, dev->name); + } else if (dev->type == 'n') { + strfieldcpy(devname, dev->name); + } + setenv("DEVNODE", devname, 1); /* FIXME: bad name for netif */ + setenv("DEVNAME", devname, 1); + dbg("DEVNAME='%s'", devname); strcpy(dirname, DEVD_DIR); strfieldcat(dirname, dev->name); @@ -81,4 +90,3 @@ void dev_d_send(struct udevice *dev, char *subsystem) strcpy(dirname, DEVD_DIR "default"); call_foreach_file(run_program, dirname, DEVD_SUFFIX); } - diff --git a/namedev.c b/namedev.c index 7b70f8bcdf..a3ae1d36b3 100644 --- a/namedev.c +++ b/namedev.c @@ -32,6 +32,9 @@ #include #include #include +#ifndef __KLIBC__ +#include +#endif #include "libsysfs/sysfs/libsysfs.h" #include "list.h" @@ -454,7 +457,7 @@ static int execute_program(char *path, char *value, int len) retval = -1; } - if (i > 0 && value[i] == '\n') + if (i > 0 && value[i-1] == '\n') i--; value[i] = '\0'; dbg("result is '%s'", value); @@ -776,6 +779,7 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud struct sysfs_device *sysfs_device = NULL; struct config_device *dev; struct perm_device *perm; + struct sysinfo info; char *pos; udev->mode = 0; @@ -837,22 +841,18 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } } } - - /* no rule was found for the net device */ - if (udev->type == 'n') { - dbg("no name for net device '%s' configured", udev->kernel_name); - return -1; - } - /* no rule was found so we use the kernel name */ strfieldcpy(udev->name, udev->kernel_name); - goto done; + if (udev->type == 'n') + goto done; + else + goto perms; found: apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); if (udev->type == 'n') - return 0; + goto done; udev->partitions = dev->partitions; strfieldcpy(udev->config_file, dev->config_file); @@ -863,7 +863,7 @@ found: dev->owner, dev->group); -done: +perms: /* get permissions given in config file or set defaults */ perm = find_perm(udev->name); if (perm != NULL) { @@ -879,8 +879,10 @@ done: dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", udev->name, udev->owner, udev->group, udev->mode); +done: /* store time of action */ - udev->config_time = time(NULL); + sysinfo(&info); + udev->config_uptime = info.uptime; return 0; } diff --git a/test/udev-test.pl b/test/udev-test.pl index 8ae01c31d4..31bc990b81 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -232,6 +232,15 @@ BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special--*", NAME="%c BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special-device-", NAME="%c-3-%n" BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special-devic", NAME="%c-4-%n" BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special-*", NAME="%c-%n" +EOF + }, + { + desc => "program result substitution (newline removal)", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "newline_removed" , + conf => <value); if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2) - goto exit; + goto error; dbg("found major=%d, minor=%d", udev->major, udev->minor); - retval = 0; -exit: - return retval; + return 0; +error: + return -1; } static int create_path(char *file) @@ -114,28 +113,27 @@ static int make_node(char *filename, int major, int minor, unsigned int mode, ui if (retval != 0) { dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", filename, mode, major, minor, strerror(errno)); - return retval; + goto exit; } dbg("chmod(%s, %#o)", filename, mode); - retval = chmod(filename, mode); - if (retval != 0) { + if (chmod(filename, mode) != 0) { dbg("chmod(%s, %#o) failed with error '%s'", filename, mode, strerror(errno)); - return retval; + goto exit; } if (uid != 0 || gid != 0) { dbg("chown(%s, %u, %u)", filename, uid, gid); - retval = chown(filename, uid, gid); - if (retval != 0) { + if (chown(filename, uid, gid) != 0) { dbg("chown(%s, %u, %u) failed with error '%s'", filename, uid, gid, strerror(errno)); - return retval; + goto exit; } } - return 0; +exit: + return retval; } /* get the local logged in user */ @@ -169,7 +167,6 @@ static void set_to_local_user(char *user) endutent(); } -/* Used to unlink existing files to ensure that our new file/symlink is created */ static int unlink_entry(char *filename) { struct stat stats; @@ -193,7 +190,6 @@ static int create_node(struct udevice *dev, int fake) char linkname[NAME_SIZE]; char linktarget[NAME_SIZE]; char partitionname[NAME_SIZE]; - int retval = 0; uid_t uid = 0; gid_t gid = 0; int i; @@ -259,14 +255,15 @@ static int create_node(struct udevice *dev, int fake) if (!fake) { unlink_entry(filename); info("creating device node '%s'", filename); - make_node(filename, dev->major, dev->minor, dev->mode, uid, gid); + if (make_node(filename, dev->major, dev->minor, dev->mode, uid, gid) != 0) + goto error; } else { info("creating device node '%s', major = '%d', minor = '%d', " "mode = '%#o', uid = '%d', gid = '%d'", filename, dev->major, dev->minor, (mode_t)dev->mode, uid, gid); } - /* create partitions if requested */ + /* create all_partitions if requested */ if (dev->partitions > 0) { info("creating device partition nodes '%s[1-%i]'", filename, dev->partitions); if (!fake) { @@ -280,7 +277,7 @@ static int create_node(struct udevice *dev, int fake) } } - /* create symlink if requested */ + /* create symlink(s) if requested */ foreach_strpart(dev->symlink, " ", pos, len) { strfieldcpymax(linkname, pos, len+1); strfieldcpy(filename, udev_root); @@ -312,14 +309,15 @@ static int create_node(struct udevice *dev, int fake) dbg("symlink(%s, %s)", linktarget, filename); if (!fake) { - retval = symlink(linktarget, filename); - if (retval != 0) + if (symlink(linktarget, filename) != 0) dbg("symlink(%s, %s) failed with error '%s'", linktarget, filename, strerror(errno)); } } - return retval; + return 0; +error: + return -1; } static struct sysfs_class_device *get_class_dev(char *device_name) @@ -373,12 +371,16 @@ exit: return retval; } -static int rename_net_if(struct udevice *dev) +static int rename_net_if(struct udevice *dev, int fake) { int sk; struct ifreq ifr; int retval; + dbg("changing net interface name from '%s' to '%s'", dev->kernel_name, dev->name); + if (fake) + return 0; + sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { dbg("error opening socket"); @@ -389,7 +391,6 @@ static int rename_net_if(struct udevice *dev) strfieldcpy(ifr.ifr_name, dev->kernel_name); strfieldcpy(ifr.ifr_newname, dev->name); - dbg("changing net interface name from '%s' to '%s'", dev->kernel_name, dev->name); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) dbg("error changing net interface name"); @@ -400,16 +401,15 @@ static int rename_net_if(struct udevice *dev) int udev_add_device(char *path, char *subsystem, int fake) { - struct sysfs_class_device *class_dev = NULL; + struct sysfs_class_device *class_dev; struct udevice dev; - int retval = -EINVAL; + char key[DEVPATH_SIZE]; + char *pos; + int retval; memset(&dev, 0x00, sizeof(dev)); - /* for now, the block layer is the only place where block devices are */ - dev.type = get_device_type(path, subsystem); - switch (dev.type) { case 'b': case 'c': @@ -422,12 +422,12 @@ int udev_add_device(char *path, char *subsystem, int fake) default: dbg("unknown device type '%c'", dev.type); - retval = -EINVAL; + return -1; } class_dev = get_class_dev(path); if (class_dev == NULL) - goto exit; + return -1; if (dev.type == 'b' || dev.type == 'c') { retval = get_major_minor(class_dev, &dev); @@ -437,37 +437,48 @@ int udev_add_device(char *path, char *subsystem, int fake) } } - retval = namedev_name_device(class_dev, &dev); - if (retval != 0) + if (namedev_name_device(class_dev, &dev) != 0) goto exit; - if (!fake && (dev.type == 'b' || dev.type == 'c')) { - retval = udevdb_add_dev(path, &dev); - if (retval != 0) - dbg("udevdb_add_dev failed, but we are going to try " - "to create the node anyway. But remove might not " - "work properly for this device."); - } - dbg("name='%s'", dev.name); + switch (dev.type) { case 'b': case 'c': retval = create_node(&dev, fake); - if ((retval == 0) && (!fake)) - dev_d_send(&dev, subsystem); + if (fake || retval != 0) + goto exit; + if (udevdb_add_dev(path, &dev) != 0) + dbg("udevdb_add_dev failed, but we are going to try " + "to create the node anyway. But remove might not " + "work properly for this device."); break; case 'n': - retval = rename_net_if(&dev); - if (retval != 0) - dbg("net device naming failed"); + strfieldcpy(key, path); + if (strcmp(dev.name, dev.kernel_name) != 0) { + retval = rename_net_if(&dev, fake); + if (fake || retval != 0) + goto exit; + /* netif's are keyed with the configured name, cause + * the original kernel name sleeps with the fishes + */ + pos = strrchr(key, '/'); + if (pos != NULL) { + pos[1] = '\0'; + strfieldcat(key, dev.name); + } + } + if (udevdb_add_dev(key, &dev) != 0) + dbg("udevdb_add_dev failed"); break; } + /* execute programs in dev.d/ with the name in the environment */ + dev_d_send(&dev, subsystem); + exit: - if (class_dev) - sysfs_close_class_device(class_dev); + sysfs_close_class_device(class_dev); return retval; } diff --git a/udev-remove.c b/udev-remove.c index 98c45d6c33..c838f15ce3 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -137,36 +137,24 @@ int udev_remove_device(char *path, char *subsystem) memset(&dev, 0x00, sizeof(dev)); - dev.type = get_device_type(path, subsystem); - - switch (dev.type) { - case 'b': - case 'c': - retval = udevdb_get_dev(path, &dev); - if (retval) { - dbg("'%s' not found in database, falling back on default name", path); - temp = strrchr(path, '/'); - if (temp == NULL) - return -ENODEV; - strfieldcpy(dev.name, &temp[1]); - } - - dbg("name='%s'", dev.name); - udevdb_delete_dev(path); + retval = udevdb_get_dev(path, &dev); + if (retval != 0) { + dbg("'%s' not found in database, falling back on default name", path); + temp = strrchr(path, '/'); + if (temp == NULL) + return -ENODEV; + strfieldcpy(dev.name, &temp[1]); + } + dbg("name='%s'", dev.name); - dev_d_send(&dev, subsystem); + dev.type = get_device_type(path, subsystem); + dev_d_send(&dev, subsystem); + udevdb_delete_dev(path); + if (dev.type == 'b' || dev.type == 'c') retval = delete_node(&dev); - break; - - case 'n': + else if (dev.type == 'n') retval = 0; - break; - - default: - dbg("unknown device type '%c'", dev.type); - retval = -EINVAL; - } return retval; } diff --git a/udev.h b/udev.h index eb42edce10..8d13fb5bc3 100644 --- a/udev.h +++ b/udev.h @@ -52,7 +52,7 @@ struct udevice { int partitions; int config_line; char config_file[NAME_SIZE]; - time_t config_time; + long config_uptime; /* private data that help us in building strings */ char bus_id[SYSFS_NAME_LEN]; @@ -80,5 +80,6 @@ extern char default_owner_str[OWNER_SIZE]; extern char default_group_str[GROUP_SIZE]; extern int udev_log; extern int udev_sleep; +extern int udev_dev_d; #endif diff --git a/udev_config.c b/udev_config.c index 57a512d711..fe26850a87 100644 --- a/udev_config.c +++ b/udev_config.c @@ -51,6 +51,7 @@ char default_owner_str[OWNER_SIZE]; char default_group_str[GROUP_SIZE]; int udev_log; int udev_sleep; +int udev_dev_d; static int string_is_true(char *str) @@ -77,6 +78,10 @@ static void init_variables(void) udev_sleep = 1; if (getenv("UDEV_NO_SLEEP") != NULL) udev_sleep = 0; + + udev_dev_d = 1; + if (getenv("UDEV_NO_DEVD") != NULL) + udev_dev_d = 0; } #define set_var(_name, _var) \ diff --git a/udevdb.c b/udevdb.c index 40580e5a3b..f246936710 100644 --- a/udevdb.c +++ b/udevdb.c @@ -59,6 +59,7 @@ int udevdb_add_dev(const char *path, const struct udevice *dev) data.dptr = (void *)dev; data.dsize = UDEVICE_LEN; + dbg("store key '%s' for device '%s'", path, dev->name); return tdb_store(udevdb, key, data, TDB_REPLACE); } diff --git a/udevinfo.c b/udevinfo.c index b23f9d0aef..8329fe7d06 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -108,13 +108,14 @@ static int print_record(char *path, struct udevice *dev) { printf("P: %s\n", path); printf("N: %s\n", dev->name); + printf("T: %c\n", dev->type); printf("M: %#o\n", dev->mode); printf("S: %s\n", dev->symlink); printf("O: %s\n", dev->owner); printf("G: %s\n", dev->group); printf("F: %s\n", dev->config_file); printf("L: %i\n", dev->config_line); - printf("T: %li\n", dev->config_time); + printf("U: %li\n", dev->config_uptime); printf("\n"); return 0; } diff --git a/udevruler.c b/udevruler.c index af2cf7bb81..a13bd625a8 100644 --- a/udevruler.c +++ b/udevruler.c @@ -77,7 +77,7 @@ struct device { char devpath[DEVPATH_SIZE]; int config_line; char config_file[NAME_SIZE]; - time_t config_time; + long config_uptime; int added; }; @@ -106,7 +106,7 @@ static int add_record(char *path, struct udevice *udev) strfieldcpy(dev->devpath, path); dev->config_line = udev->config_line; strfieldcpy(dev->config_file, udev->config_file); - dev->config_time = udev->config_time; + dev->config_uptime = udev->config_uptime; dev->added = 0; /* sort in lexical order */ @@ -308,7 +308,7 @@ int main(int argc, char *argv[]) { char roottext[81]; char path[NAME_SIZE]; struct device *dev; - time_t time_last; + long time_last; int count_last; newtInit(); @@ -332,13 +332,13 @@ int main(int argc, char *argv[]) { /* look for last discovered device */ time_last = 0; list_for_each_entry(dev, &device_list, list) - if (dev->config_time > time_last) - time_last = dev->config_time; + if (dev->config_uptime > time_last) + time_last = dev->config_uptime; /* skip if more than 16 recent devices */ count_last = 0; list_for_each_entry(dev, &device_list, list) { - if (dev->config_time < time_last - 10) + if (dev->config_uptime < time_last - 10) continue; count_last++; } @@ -347,7 +347,7 @@ int main(int argc, char *argv[]) { if (count_last < 16) { newtListboxAppendEntry(lbox, "--- last dicovered ---", NULL); list_for_each_entry(dev, &device_list, list) { - if (dev->config_time < time_last - 10) + if (dev->config_uptime < time_last - 10) continue; dbg("%s %i", dev->name, dev->config_line); -- cgit v1.2.3-54-g00ecf From 9b28a52a0ac9b7993c932bbfe9d86dfc814be218 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 1 Apr 2004 00:59:58 -0800 Subject: [PATCH] DEVPATH for netdev Here we change the DEVPATH for netdev's in the environment of the dev.d/ scripts to the name the device is renamed to. The original name doesn't exist in the kernel after rename. --- dev_d.c | 4 ++-- udev-add.c | 17 +++++++++-------- udev-remove.c | 2 +- udev.h | 2 +- udev_config.c | 6 +++--- udevd.c | 6 ++++-- udevstart.c | 5 +++-- 7 files changed, 23 insertions(+), 19 deletions(-) diff --git a/dev_d.c b/dev_d.c index 0910e4d323..483ceb4b1b 100644 --- a/dev_d.c +++ b/dev_d.c @@ -61,7 +61,7 @@ static int run_program(char *name) * subsystem/ * default/ */ -void dev_d_send(struct udevice *dev, char *subsystem) +void dev_d_send(struct udevice *dev, char *subsystem, char *devpath) { char dirname[256]; char devname[NAME_SIZE]; @@ -74,8 +74,8 @@ void dev_d_send(struct udevice *dev, char *subsystem) strfieldcat(devname, dev->name); } else if (dev->type == 'n') { strfieldcpy(devname, dev->name); + setenv("DEVPATH", devpath, 1); } - setenv("DEVNODE", devname, 1); /* FIXME: bad name for netif */ setenv("DEVNAME", devname, 1); dbg("DEVNAME='%s'", devname); diff --git a/udev-add.c b/udev-add.c index 1f17f50bc3..09c2ac6d3e 100644 --- a/udev-add.c +++ b/udev-add.c @@ -403,7 +403,7 @@ int udev_add_device(char *path, char *subsystem, int fake) { struct sysfs_class_device *class_dev; struct udevice dev; - char key[DEVPATH_SIZE]; + char devpath[DEVPATH_SIZE]; char *pos; int retval; @@ -452,10 +452,11 @@ int udev_add_device(char *path, char *subsystem, int fake) dbg("udevdb_add_dev failed, but we are going to try " "to create the node anyway. But remove might not " "work properly for this device."); + + dev_d_send(&dev, subsystem, path); break; case 'n': - strfieldcpy(key, path); if (strcmp(dev.name, dev.kernel_name) != 0) { retval = rename_net_if(&dev, fake); if (fake || retval != 0) @@ -463,20 +464,20 @@ int udev_add_device(char *path, char *subsystem, int fake) /* netif's are keyed with the configured name, cause * the original kernel name sleeps with the fishes */ - pos = strrchr(key, '/'); + strfieldcpy(devpath, path); + pos = strrchr(devpath, '/'); if (pos != NULL) { pos[1] = '\0'; - strfieldcat(key, dev.name); + strfieldcat(devpath, dev.name); } } - if (udevdb_add_dev(key, &dev) != 0) + if (udevdb_add_dev(devpath, &dev) != 0) dbg("udevdb_add_dev failed"); + + dev_d_send(&dev, subsystem, devpath); break; } - /* execute programs in dev.d/ with the name in the environment */ - dev_d_send(&dev, subsystem); - exit: sysfs_close_class_device(class_dev); diff --git a/udev-remove.c b/udev-remove.c index c838f15ce3..27ff5bc0a2 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -148,7 +148,7 @@ int udev_remove_device(char *path, char *subsystem) dbg("name='%s'", dev.name); dev.type = get_device_type(path, subsystem); - dev_d_send(&dev, subsystem); + dev_d_send(&dev, subsystem, path); udevdb_delete_dev(path); if (dev.type == 'b' || dev.type == 'c') diff --git a/udev.h b/udev.h index 8d13fb5bc3..da02e26bba 100644 --- a/udev.h +++ b/udev.h @@ -65,7 +65,7 @@ extern int udev_add_device(char *path, char *subsystem, int fake); extern int udev_remove_device(char *path, char *subsystem); extern void udev_init_config(void); extern int parse_get_pair(char **orig_string, char **left, char **right); -extern void dev_d_send(struct udevice *dev, char *subsystem); +extern void dev_d_send(struct udevice *dev, char *subsystem, char *devpath); extern char **main_argv; extern char **main_envp; diff --git a/udev_config.c b/udev_config.c index fe26850a87..ba04003e90 100644 --- a/udev_config.c +++ b/udev_config.c @@ -86,13 +86,13 @@ static void init_variables(void) #define set_var(_name, _var) \ if (strcasecmp(variable, _name) == 0) { \ - dbg_parse("%s = '%s'", _name, value); \ - strfieldcpymax(_var, value, sizeof(_var));\ + dbg_parse("%s='%s'", _name, value); \ + strfieldcpy(_var, value);\ } #define set_bool(_name, _var) \ if (strcasecmp(variable, _name) == 0) { \ - dbg_parse("%s = '%s'", _name, value); \ + dbg_parse("%s='%s'", _name, value); \ _var = string_is_true(value); \ } diff --git a/udevd.c b/udevd.c index 301625fd92..d464b9a196 100644 --- a/udevd.c +++ b/udevd.c @@ -139,8 +139,10 @@ static void udev_run(struct hotplug_msg *msg) char devpath[DEVPATH_SIZE]; char *env[] = { action, devpath, NULL }; - snprintf(action, sizeof(action), "ACTION=%s", msg->action); - snprintf(devpath, sizeof(devpath), "DEVPATH=%s", msg->devpath); + strcpy(action, "ACTION="); + strfieldcat(action, msg->action); + strcpy(devpath, "DEVPATH="); + strfieldcat(devpath, msg->devpath); pid = fork(); switch (pid) { diff --git a/udevstart.c b/udevstart.c index eda6355b53..7e19c379a5 100644 --- a/udevstart.c +++ b/udevstart.c @@ -33,6 +33,7 @@ #include #include "logging.h" +#include "udev_lib.h" #ifdef LOG @@ -61,8 +62,8 @@ static void udev_exec(const char *path, const char* subsystem) char nosleep[] = "UDEV_NO_SLEEP=1"; char *env[] = { action, devpath, nosleep, NULL }; - snprintf(devpath, MAX_PATHLEN, "DEVPATH=%s", path); - devpath[MAX_PATHLEN-1] = '\0'; + strcpy(action, "DEVPATH=%s"); + strfieldcat(action, path); pid = fork(); switch (pid) { -- cgit v1.2.3-54-g00ecf From 5cd749f342ae95649a628668918e622b94bfdf4e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 01:02:53 -0800 Subject: [PATCH] update RFC-dev.d docs due to DEVNODE to DEVNAME change --- docs/RFC-dev.d | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/RFC-dev.d b/docs/RFC-dev.d index 4985e841be..1aca1aa393 100644 --- a/docs/RFC-dev.d +++ b/docs/RFC-dev.d @@ -12,16 +12,17 @@ the system due to a device being removed. The directory tree under /etc/dev.d/ dictate which program is run first, and when some programs will be run or not. The device naming program calls the programs in the following order: - /etc/dev.d/DEVNODE/*.dev + /etc/dev.d/DEVNAME/*.dev /etc/dev.d/SUBSYSTEM/*.dev /etc/dev.d/default/*.dev The .dev extension is needed to allow automatic package managers to deposit backup files in these directories safely. -The DEVNODE name is the name of the /dev file that has been created. -This value, including the /dev path, will also be exported to userspace -in the DEVNODE environment variable. +The DEVNAME name is the name of the /dev file that has been created, or +for network devices, the name of the newly named network device. This +value, including the /dev path, will also be exported to userspace in +the DEVNAME environment variable. The SUBSYSTEM name is the name of the sysfs subsystem that originally generated the hotplug event that caused the device naming program to @@ -40,8 +41,8 @@ description of this An equivalent shell script that would do this same kind of action would be: DIR="/etc/dev.d" - export DEVNODE="whatever_dev_name_udev_just_gave" - for I in "${DIR}/$DEVNODE/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do + export DEVNAME="whatever_dev_name_udev_just_gave" + for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do if [ -f $I ]; then $I $1 ; fi done exit 1; -- cgit v1.2.3-54-g00ecf From a008521bb8a619b63a2d6e9c1e16b3a113a6cf20 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 19:25:41 -0800 Subject: [PATCH] add a bunch of network class devices to the test sysfs tree --- test/sys/class/net/eth0/addr_len | 1 + test/sys/class/net/eth0/address | 1 + test/sys/class/net/eth0/broadcast | 1 + test/sys/class/net/eth0/features | 1 + test/sys/class/net/eth0/flags | 1 + test/sys/class/net/eth0/ifindex | 1 + test/sys/class/net/eth0/iflink | 1 + test/sys/class/net/eth0/mtu | 1 + test/sys/class/net/eth0/tx_queue_len | 1 + test/sys/class/net/eth0/type | 1 + test/sys/class/net/eth1/addr_len | 1 + test/sys/class/net/eth1/address | 1 + test/sys/class/net/eth1/broadcast | 1 + test/sys/class/net/eth1/features | 1 + test/sys/class/net/eth1/flags | 1 + test/sys/class/net/eth1/ifindex | 1 + test/sys/class/net/eth1/iflink | 1 + test/sys/class/net/eth1/mtu | 1 + test/sys/class/net/eth1/tx_queue_len | 1 + test/sys/class/net/eth1/type | 1 + test/sys/class/net/eth1/wireless/beacon | 1 + test/sys/class/net/eth1/wireless/crypt | 1 + test/sys/class/net/eth1/wireless/fragment | 1 + test/sys/class/net/eth1/wireless/level | 1 + test/sys/class/net/eth1/wireless/link | 1 + test/sys/class/net/eth1/wireless/misc | 1 + test/sys/class/net/eth1/wireless/noise | 1 + test/sys/class/net/eth1/wireless/nwid | 1 + test/sys/class/net/eth1/wireless/retries | 1 + test/sys/class/net/eth1/wireless/status | 1 + test/sys/class/net/lo/addr_len | 1 + test/sys/class/net/lo/address | 1 + test/sys/class/net/lo/broadcast | 1 + test/sys/class/net/lo/features | 1 + test/sys/class/net/lo/flags | 1 + test/sys/class/net/lo/ifindex | 1 + test/sys/class/net/lo/iflink | 1 + test/sys/class/net/lo/mtu | 1 + test/sys/class/net/lo/tx_queue_len | 1 + test/sys/class/net/lo/type | 1 + 40 files changed, 40 insertions(+) create mode 100644 test/sys/class/net/eth0/addr_len create mode 100644 test/sys/class/net/eth0/address create mode 100644 test/sys/class/net/eth0/broadcast create mode 100644 test/sys/class/net/eth0/features create mode 100644 test/sys/class/net/eth0/flags create mode 100644 test/sys/class/net/eth0/ifindex create mode 100644 test/sys/class/net/eth0/iflink create mode 100644 test/sys/class/net/eth0/mtu create mode 100644 test/sys/class/net/eth0/tx_queue_len create mode 100644 test/sys/class/net/eth0/type create mode 100644 test/sys/class/net/eth1/addr_len create mode 100644 test/sys/class/net/eth1/address create mode 100644 test/sys/class/net/eth1/broadcast create mode 100644 test/sys/class/net/eth1/features create mode 100644 test/sys/class/net/eth1/flags create mode 100644 test/sys/class/net/eth1/ifindex create mode 100644 test/sys/class/net/eth1/iflink create mode 100644 test/sys/class/net/eth1/mtu create mode 100644 test/sys/class/net/eth1/tx_queue_len create mode 100644 test/sys/class/net/eth1/type create mode 100644 test/sys/class/net/eth1/wireless/beacon create mode 100644 test/sys/class/net/eth1/wireless/crypt create mode 100644 test/sys/class/net/eth1/wireless/fragment create mode 100644 test/sys/class/net/eth1/wireless/level create mode 100644 test/sys/class/net/eth1/wireless/link create mode 100644 test/sys/class/net/eth1/wireless/misc create mode 100644 test/sys/class/net/eth1/wireless/noise create mode 100644 test/sys/class/net/eth1/wireless/nwid create mode 100644 test/sys/class/net/eth1/wireless/retries create mode 100644 test/sys/class/net/eth1/wireless/status create mode 100644 test/sys/class/net/lo/addr_len create mode 100644 test/sys/class/net/lo/address create mode 100644 test/sys/class/net/lo/broadcast create mode 100644 test/sys/class/net/lo/features create mode 100644 test/sys/class/net/lo/flags create mode 100644 test/sys/class/net/lo/ifindex create mode 100644 test/sys/class/net/lo/iflink create mode 100644 test/sys/class/net/lo/mtu create mode 100644 test/sys/class/net/lo/tx_queue_len create mode 100644 test/sys/class/net/lo/type diff --git a/test/sys/class/net/eth0/addr_len b/test/sys/class/net/eth0/addr_len new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/class/net/eth0/addr_len @@ -0,0 +1 @@ +6 diff --git a/test/sys/class/net/eth0/address b/test/sys/class/net/eth0/address new file mode 100644 index 0000000000..4e0cdd519d --- /dev/null +++ b/test/sys/class/net/eth0/address @@ -0,0 +1 @@ +00:e0:00:fb:04:e1 diff --git a/test/sys/class/net/eth0/broadcast b/test/sys/class/net/eth0/broadcast new file mode 100644 index 0000000000..d516b03245 --- /dev/null +++ b/test/sys/class/net/eth0/broadcast @@ -0,0 +1 @@ +ff:ff:ff:ff:ff:ff diff --git a/test/sys/class/net/eth0/features b/test/sys/class/net/eth0/features new file mode 100644 index 0000000000..bf73d73743 --- /dev/null +++ b/test/sys/class/net/eth0/features @@ -0,0 +1 @@ +0x29 diff --git a/test/sys/class/net/eth0/flags b/test/sys/class/net/eth0/flags new file mode 100644 index 0000000000..4af9ab2807 --- /dev/null +++ b/test/sys/class/net/eth0/flags @@ -0,0 +1 @@ +0x1023 diff --git a/test/sys/class/net/eth0/ifindex b/test/sys/class/net/eth0/ifindex new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/test/sys/class/net/eth0/ifindex @@ -0,0 +1 @@ +9 diff --git a/test/sys/class/net/eth0/iflink b/test/sys/class/net/eth0/iflink new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/test/sys/class/net/eth0/iflink @@ -0,0 +1 @@ +9 diff --git a/test/sys/class/net/eth0/mtu b/test/sys/class/net/eth0/mtu new file mode 100644 index 0000000000..3d86ec6498 --- /dev/null +++ b/test/sys/class/net/eth0/mtu @@ -0,0 +1 @@ +1500 diff --git a/test/sys/class/net/eth0/tx_queue_len b/test/sys/class/net/eth0/tx_queue_len new file mode 100644 index 0000000000..83b33d238d --- /dev/null +++ b/test/sys/class/net/eth0/tx_queue_len @@ -0,0 +1 @@ +1000 diff --git a/test/sys/class/net/eth0/type b/test/sys/class/net/eth0/type new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/class/net/eth0/type @@ -0,0 +1 @@ +1 diff --git a/test/sys/class/net/eth1/addr_len b/test/sys/class/net/eth1/addr_len new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/class/net/eth1/addr_len @@ -0,0 +1 @@ +6 diff --git a/test/sys/class/net/eth1/address b/test/sys/class/net/eth1/address new file mode 100644 index 0000000000..7325095c16 --- /dev/null +++ b/test/sys/class/net/eth1/address @@ -0,0 +1 @@ +00:e0:00:8d:9f:25 diff --git a/test/sys/class/net/eth1/broadcast b/test/sys/class/net/eth1/broadcast new file mode 100644 index 0000000000..d516b03245 --- /dev/null +++ b/test/sys/class/net/eth1/broadcast @@ -0,0 +1 @@ +ff:ff:ff:ff:ff:ff diff --git a/test/sys/class/net/eth1/features b/test/sys/class/net/eth1/features new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/class/net/eth1/features @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/class/net/eth1/flags b/test/sys/class/net/eth1/flags new file mode 100644 index 0000000000..7f97d854fc --- /dev/null +++ b/test/sys/class/net/eth1/flags @@ -0,0 +1 @@ +0x1002 diff --git a/test/sys/class/net/eth1/ifindex b/test/sys/class/net/eth1/ifindex new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/class/net/eth1/ifindex @@ -0,0 +1 @@ +10 diff --git a/test/sys/class/net/eth1/iflink b/test/sys/class/net/eth1/iflink new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/class/net/eth1/iflink @@ -0,0 +1 @@ +10 diff --git a/test/sys/class/net/eth1/mtu b/test/sys/class/net/eth1/mtu new file mode 100644 index 0000000000..3d86ec6498 --- /dev/null +++ b/test/sys/class/net/eth1/mtu @@ -0,0 +1 @@ +1500 diff --git a/test/sys/class/net/eth1/tx_queue_len b/test/sys/class/net/eth1/tx_queue_len new file mode 100644 index 0000000000..83b33d238d --- /dev/null +++ b/test/sys/class/net/eth1/tx_queue_len @@ -0,0 +1 @@ +1000 diff --git a/test/sys/class/net/eth1/type b/test/sys/class/net/eth1/type new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/class/net/eth1/type @@ -0,0 +1 @@ +1 diff --git a/test/sys/class/net/eth1/wireless/beacon b/test/sys/class/net/eth1/wireless/beacon new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/class/net/eth1/wireless/beacon @@ -0,0 +1 @@ +0 diff --git a/test/sys/class/net/eth1/wireless/crypt b/test/sys/class/net/eth1/wireless/crypt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/class/net/eth1/wireless/crypt @@ -0,0 +1 @@ +0 diff --git a/test/sys/class/net/eth1/wireless/fragment b/test/sys/class/net/eth1/wireless/fragment new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/class/net/eth1/wireless/fragment @@ -0,0 +1 @@ +0 diff --git a/test/sys/class/net/eth1/wireless/level b/test/sys/class/net/eth1/wireless/level new file mode 100644 index 0000000000..e702a30b33 --- /dev/null +++ b/test/sys/class/net/eth1/wireless/level @@ -0,0 +1 @@ +188 diff --git a/test/sys/class/net/eth1/wireless/link b/test/sys/class/net/eth1/wireless/link new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/class/net/eth1/wireless/link @@ -0,0 +1 @@ +0 diff --git a/test/sys/class/net/eth1/wireless/misc b/test/sys/class/net/eth1/wireless/misc new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/class/net/eth1/wireless/misc @@ -0,0 +1 @@ +0 diff --git a/test/sys/class/net/eth1/wireless/noise b/test/sys/class/net/eth1/wireless/noise new file mode 100644 index 0000000000..405e2afe8e --- /dev/null +++ b/test/sys/class/net/eth1/wireless/noise @@ -0,0 +1 @@ +134 diff --git a/test/sys/class/net/eth1/wireless/nwid b/test/sys/class/net/eth1/wireless/nwid new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/class/net/eth1/wireless/nwid @@ -0,0 +1 @@ +0 diff --git a/test/sys/class/net/eth1/wireless/retries b/test/sys/class/net/eth1/wireless/retries new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/class/net/eth1/wireless/retries @@ -0,0 +1 @@ +0 diff --git a/test/sys/class/net/eth1/wireless/status b/test/sys/class/net/eth1/wireless/status new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/class/net/eth1/wireless/status @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/class/net/lo/addr_len b/test/sys/class/net/lo/addr_len new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/class/net/lo/addr_len @@ -0,0 +1 @@ +6 diff --git a/test/sys/class/net/lo/address b/test/sys/class/net/lo/address new file mode 100644 index 0000000000..34e09d077c --- /dev/null +++ b/test/sys/class/net/lo/address @@ -0,0 +1 @@ +00:00:00:00:00:00 diff --git a/test/sys/class/net/lo/broadcast b/test/sys/class/net/lo/broadcast new file mode 100644 index 0000000000..34e09d077c --- /dev/null +++ b/test/sys/class/net/lo/broadcast @@ -0,0 +1 @@ +00:00:00:00:00:00 diff --git a/test/sys/class/net/lo/features b/test/sys/class/net/lo/features new file mode 100644 index 0000000000..e8768d26fc --- /dev/null +++ b/test/sys/class/net/lo/features @@ -0,0 +1 @@ +0x65 diff --git a/test/sys/class/net/lo/flags b/test/sys/class/net/lo/flags new file mode 100644 index 0000000000..4bc4da19ae --- /dev/null +++ b/test/sys/class/net/lo/flags @@ -0,0 +1 @@ +0x9 diff --git a/test/sys/class/net/lo/ifindex b/test/sys/class/net/lo/ifindex new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/class/net/lo/ifindex @@ -0,0 +1 @@ +1 diff --git a/test/sys/class/net/lo/iflink b/test/sys/class/net/lo/iflink new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/class/net/lo/iflink @@ -0,0 +1 @@ +1 diff --git a/test/sys/class/net/lo/mtu b/test/sys/class/net/lo/mtu new file mode 100644 index 0000000000..e20e16cfe8 --- /dev/null +++ b/test/sys/class/net/lo/mtu @@ -0,0 +1 @@ +16436 diff --git a/test/sys/class/net/lo/tx_queue_len b/test/sys/class/net/lo/tx_queue_len new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/class/net/lo/tx_queue_len @@ -0,0 +1 @@ +0 diff --git a/test/sys/class/net/lo/type b/test/sys/class/net/lo/type new file mode 100644 index 0000000000..6d629c4a23 --- /dev/null +++ b/test/sys/class/net/lo/type @@ -0,0 +1 @@ +772 -- cgit v1.2.3-54-g00ecf From d5853b48fb098ca63af813ae74cd6af3a9400d01 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 21:38:59 -0800 Subject: [PATCH] add hotplug.dev script to handle renamed network devices. --- etc/dev.d/net/hotplug.dev | 23 ++++++++++++++++++++++ test/net_test | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 etc/dev.d/net/hotplug.dev create mode 100644 test/net_test diff --git a/etc/dev.d/net/hotplug.dev b/etc/dev.d/net/hotplug.dev new file mode 100644 index 0000000000..ed64c08cf2 --- /dev/null +++ b/etc/dev.d/net/hotplug.dev @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Script to ensure that any network device that udev renames +# still gets the hotplug script run with the proper name. +# +# Released under the GPL v2 +# +# Copyright (C) 2004 Greg Kroah-Hartman +# + +# See if we really did rename this device. +if [ "$INTERFACE" = "$DEVNAME" ]; then + exit 0 +fi + +# ok, we have renamed this device, so let's set $INTERFACE to the new name +# and call the network hotplug script to handle it properly... +INTERFACE=$DEVNAME +export INTERFACE +if [ -f /etc/hotplug.d/default/default.hotplug ]; then + /etc/hotplug.d/default/default.hotplug net +fi + diff --git a/test/net_test b/test/net_test new file mode 100644 index 0000000000..b99a4acd54 --- /dev/null +++ b/test/net_test @@ -0,0 +1,49 @@ +#!/bin/bash + +RULES=label_test.rules +CONFIG=label_test.conf + +export UDEV_TEST=yes +export SYSFS_PATH=$PWD/sys/ +export UDEV_CONFIG_FILE=$PWD/$CONFIG + +cat > $RULES << EOF +BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_diskX%n" +BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_disk%n" +EOF + +cat > $CONFIG << EOF +udev_root="$PWD/udev/" +udev_db="$PWD/udev/.udev.tdb" +udev_rules="$PWD/$RULES" +udev_permissions="$PWD/udev.permissions" +EOF + +mkdir udev + +export ACTION=add +export DEVPATH=block/sda + +../udev block +ls -l udev + +export DEVPATH=block/sda/sda3 + +../udev block +ls -l udev + +export ACTION=remove +export DEVPATH=block/sda + +../udev block +ls -l udev + +export DEVPATH=block/sda/sda3 + +../udev block +ls -l udev + + +rm $RULES +rm $CONFIG +rm -rf udev -- cgit v1.2.3-54-g00ecf From ce4256bdc5012b9b63abca392bc0ead7ad70d20a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 21:46:07 -0800 Subject: [PATCH] handle the subsytem if provided in udevtest. this is needed to test the /etc/dev.d/ stuff properly. --- udevtest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/udevtest.c b/udevtest.c index 67ae9cc98f..36f223e1e5 100644 --- a/udevtest.c +++ b/udevtest.c @@ -57,7 +57,7 @@ int main(int argc, char *argv[], char *envp[]) { char *devpath; char temp[NAME_SIZE]; - char subsystem[] = ""; + char *subsystem = ""; const int fake = 1; main_argv = argv; @@ -98,6 +98,9 @@ int main(int argc, char *argv[], char *envp[]) /* initialize the naming deamon */ namedev_init(); + if (argv[2] != NULL) + subsystem = argv[2]; + /* simulate node creation with fake flag */ udev_add_device(devpath, subsystem, fake); -- cgit v1.2.3-54-g00ecf From cfdfda10783b2764de6d22946c5a6159c8caaea3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 21:51:17 -0800 Subject: [PATCH] make a net_test test script using udevtest. --- test/net_test | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/test/net_test b/test/net_test index b99a4acd54..fcc21e1b94 100644 --- a/test/net_test +++ b/test/net_test @@ -8,8 +8,7 @@ export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG cat > $RULES << EOF -BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_diskX%n" -BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_disk%n" +SYSFS{address}="00:e0:00:8d:9f:25", NAME="wireless" EOF cat > $CONFIG << EOF @@ -22,28 +21,17 @@ EOF mkdir udev export ACTION=add -export DEVPATH=block/sda +export DEVPATH=class/net/eth1 -../udev block -ls -l udev - -export DEVPATH=block/sda/sda3 - -../udev block +../udevtest class/net/eth1 net ls -l udev export ACTION=remove -export DEVPATH=block/sda +export DEVPATH=class/net/eth1 -../udev block +../udevtest net ls -l udev -export DEVPATH=block/sda/sda3 - -../udev block -ls -l udev - - rm $RULES rm $CONFIG rm -rf udev -- cgit v1.2.3-54-g00ecf From c4603a0726b30ce30472a6dfdeb1a76c365dd89f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 21:52:46 -0800 Subject: [PATCH] fix some segfaults when running udevtest for network devices. --- udev-add.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev-add.c b/udev-add.c index 09c2ac6d3e..20599822d3 100644 --- a/udev-add.c +++ b/udev-add.c @@ -446,9 +446,9 @@ int udev_add_device(char *path, char *subsystem, int fake) case 'b': case 'c': retval = create_node(&dev, fake); - if (fake || retval != 0) + if (retval != 0) goto exit; - if (udevdb_add_dev(path, &dev) != 0) + if ((!fake) && (udevdb_add_dev(path, &dev) != 0)) dbg("udevdb_add_dev failed, but we are going to try " "to create the node anyway. But remove might not " "work properly for this device."); @@ -459,7 +459,7 @@ int udev_add_device(char *path, char *subsystem, int fake) case 'n': if (strcmp(dev.name, dev.kernel_name) != 0) { retval = rename_net_if(&dev, fake); - if (fake || retval != 0) + if (retval != 0) goto exit; /* netif's are keyed with the configured name, cause * the original kernel name sleeps with the fishes @@ -471,7 +471,7 @@ int udev_add_device(char *path, char *subsystem, int fake) strfieldcat(devpath, dev.name); } } - if (udevdb_add_dev(devpath, &dev) != 0) + if ((!fake) && (udevdb_add_dev(devpath, &dev) != 0)) dbg("udevdb_add_dev failed"); dev_d_send(&dev, subsystem, devpath); -- cgit v1.2.3-54-g00ecf From fc238cffafab6518564ebfefaece5d24a8423daa Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 1 Apr 2004 22:59:56 -0800 Subject: [PATCH] put netdev handling and dev.d/ in manpages Mention the recently added netdev handling and the dev.d/ directories in the man pages. --- udev.8 | 56 +++++++++++++++++++++++++++++++++++++++++++++----------- udevinfo.8 | 9 +++++---- udevtest.8 | 5 +++-- 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/udev.8 b/udev.8 index 417b74bdc5..680587a270 100644 --- a/udev.8 +++ b/udev.8 @@ -23,14 +23,25 @@ config file. .B UDEV_NO_SLEEP The default behavior of .B udev -is to wait until all the sysfs files of the device chain are populated. If set +is to wait until all the sysfs files of the device chain are populated. If set, .B udev will continue, regardless of the state of the device representation. +.TP +.B UDEV_NO_DEVD +The default behavior of +.B udev +is to execute programs in the +.I /etc/dev.d/ +directory after device handling. If set, +.B udev +will skip this step. .SH "DESCRIPTION" .B udev -creates or removes device node files usually located in the /dev directory. -It provides a dynamic device directory contaning only the files for -actually present devices. +provides a dynamic device directory containing only the files for actually +present devices. It creates or removes device node files usually located in +the /dev directory, or it renames network interfaces. +.br + .P As part of the .B hotplug @@ -42,7 +53,7 @@ On device creation, reads the sysfs directory of the given device to collect device attributes like label, serial number or bus device number. These attributes may be used as keys to determine a -unique name for device file creation. +unique name for the device. .B udev maintains a database for devices present on the system. .br @@ -88,8 +99,8 @@ If a directory is specified, the whole directory is scanned for files ending wit and all permission files are read in lexical order. .TP .B udev_log -If you want udev to log some information to the syslog for every node created or -removed. The default value is +If you want udev to log some information to the syslog for every device handled. +The default value is .IR yes . .TP .B default_mode @@ -149,9 +160,9 @@ value in the file. .P Every line in the rules file defines the mapping between device attributes -and the device file name. One or more keys are specified to match a rule -with the current device. If all keys are matching, the rule will be applied -and the name is used for the device node. +and the device name. One or more keys are specified to match a rule with +the current device. If all keys are matching, the rule will be applied and +the name is used to name the device file or the network interface. .br If no matching rule is found, the default kernel device name is used. .P @@ -200,7 +211,8 @@ call. This key may be used in any following rule after a call. .TP .B NAME -The name of the node to be created. +The name of the node to be created, or the name, the network interface +should be renamed to. .br If given with the attribute .BR NAME{ all_partitions } @@ -341,11 +353,33 @@ pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any character not enclosed is matched. +.P +After device node creation, removal, or network device renaming, +.B udev +executes the programs in the directory tree under +.IR /etc/dev.d/ . +The name of a program must end with +.I .dev +suffix, to be recognized. +.br +In addition to the hotplug environment variables, +.B DEVNAME +is exported to make the name of the created node, or the name the network +device is renamed to, available to the executed program. The programs in every +directory are sorted in lexical order, while the directories are searched in +the following order: +.sp +.nf +/etc/dev.d/$(DEVNAME)/*.dev +/etc/dev.d/$(SUBSYSTEM)/*.dev +/etc/dev.d/default/*.dev +.fi .SH "FILES" .nf /sbin/udev udev program /etc/udev/* udev config files /etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program +/etc/dev.d/* programs invoked by udev .fi .LP .SH "SEE ALSO" diff --git a/udevinfo.8 b/udevinfo.8 index bf6a0aded1..0588084cac 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -24,7 +24,8 @@ directory. When used in conjunction with a query for the node name, the will be prepended. .TP .BI \-q " query_type" -Query the database for specified value of a created device node. +Query the database for specified value of a created device node or network +interface. .RB Needs " \-p " or " \-n " specified. .br Valid types are: @@ -34,9 +35,9 @@ Valid types are: Specify the sysfs path of the device to query. .TP .BI \-n " name" -Specify the name of the node or the symlink for the device to query. -Partition names generated with the NAME{all_partitons} option can not be -queried, the main device must be used instead. +Specify the name of the node, the symlink or the network interface for the +device to query. Partition names generated with the NAME{all_partitons} option +can not be queried, the main device must be used instead. .TP .B \-a Print all diff --git a/udevtest.8 b/udevtest.8 index f23e219244..6be7e089cf 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -7,8 +7,9 @@ udevtest \- simulates a udev run to test the configured rules .B udevtest simulates a .B udev -run for the given device, and prints out the node names -for the given device, the real udev would have created. +run for the given device, and prints out the name of the node +the real udev would have created, or the name of the renamed network +interface. .SH "SEE ALSO" .BR udev (8) .SH AUTHORS -- cgit v1.2.3-54-g00ecf From c40f61e6e86943c3e1342b20b1c7d19ce30cc5a5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 23:36:58 -0800 Subject: [PATCH] tweak net_test a bit. --- test/net_test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/net_test b/test/net_test index fcc21e1b94..56a6847d19 100644 --- a/test/net_test +++ b/test/net_test @@ -29,7 +29,7 @@ ls -l udev export ACTION=remove export DEVPATH=class/net/eth1 -../udevtest net +../udevtest class/net/eth1 net ls -l udev rm $RULES -- cgit v1.2.3-54-g00ecf From 42e4b6819ff91725fc101e1169e30ed27a7da3ca Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 23:37:43 -0800 Subject: [PATCH] add install and uninstall the etc/dev.d/net/hotplug.dev file to the Makefile --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 652e712d77..2504034b13 100644 --- a/Makefile +++ b/Makefile @@ -354,6 +354,13 @@ install-config: $(GEN_CONFIGS) install-dev.d: $(INSTALL) -d $(DESTDIR)$(dev_ddir) $(INSTALL) -d $(DESTDIR)$(dev_ddir)default/ + $(INSTALL_PROGRAM) -D etc/dev.d/net/hotplug.dev $(DESTDIR)$(dev_ddir)net/hotplug.dev + +uninstall-dev.d: + - rm $(dev_ddir)net/hotplug.dev + - rmdir $(dev_ddir)net + - rmdir $(dev_ddir)default + - rmdir $(dev_ddir) install: install-initscript install-config install-dev.d all $(INSTALL) -d $(DESTDIR)$(udevdir) @@ -381,7 +388,7 @@ endif -C $$target $@ ; \ done ; \ -uninstall: +uninstall: uninstall-dev.d - rm $(hotplugdir)/udev.hotplug - rm $(configdir)/udev.permissions - rm $(configdir)/udev.rules @@ -399,8 +406,6 @@ uninstall: - rm $(usrbindir)/$(INFO) - rmdir $(hotplugdir) - rmdir $(configdir) - - rmdir $(dev_ddir)default - - rmdir $(dev_ddir) - rm $(udevdir)/.udev.tdb - rmdir $(udevdir) @extras="$(EXTRAS)" ; for target in $$extras ; do \ -- cgit v1.2.3-54-g00ecf From 438ac360e803c5b05d3c50c7bc93babbe0bea37d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 23:47:23 -0800 Subject: [PATCH] first step of making man pages dynamically generated. Based on a an original patch from Olaf Hering --- Makefile | 40 +++--- udev.8 | 397 --------------------------------------------------------- udev.8.in | 397 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udevd.8 | 56 -------- udevd.8.in | 56 ++++++++ udevinfo.8 | 64 ---------- udevinfo.8.in | 64 ++++++++++ udevstart.8 | 18 --- udevstart.8.in | 18 +++ udevtest.8 | 18 --- udevtest.8.in | 18 +++ 11 files changed, 578 insertions(+), 568 deletions(-) delete mode 100644 udev.8 create mode 100644 udev.8.in delete mode 100644 udevd.8 create mode 100644 udevd.8.in delete mode 100644 udevinfo.8 create mode 100644 udevinfo.8.in delete mode 100644 udevstart.8 create mode 100644 udevstart.8.in delete mode 100644 udevtest.8 create mode 100644 udevtest.8.in diff --git a/Makefile b/Makefile index 2504034b13..01fb2a4486 100644 --- a/Makefile +++ b/Makefile @@ -246,6 +246,12 @@ GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf $(LOCAL_CFG_DIR)/udev.conf: sed -e "s:@udevdir@:$(udevdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ +GEN_MANPAGES = udev.8 udevd.8 udevinfo.8 udevstart.8 udevtest.8 +GEN_MANPAGESIN = udev.8.in udevd.8.in udevinfo.8.in udevstart.8.in udevtest.8.in +# Rules on how to create the man pages +$(GEN_MANPAGES): $(GEN_MANPAGESIN) + sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ + $(OBJS): $(GEN_HEADERS) $(ROOT).o: $(GEN_HEADERS) @@ -286,7 +292,7 @@ $(RULER): $(RULER).o $(OBJS) $(HEADERS) $(LIBC) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) $(RULER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) $(RULER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ @@ -362,7 +368,23 @@ uninstall-dev.d: - rmdir $(dev_ddir)default - rmdir $(dev_ddir) -install: install-initscript install-config install-dev.d all +install-man: $(GEN_MANPAGES) + $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 + $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 + $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 + $(INSTALL_DATA) -D udevstart.8 $(DESTDIR)$(mandir)/man8/udevstart.8 + $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 + - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 + +uninstall-man: + - rm $(mandir)/man8/udev.8 + - rm $(mandir)/man8/udevinfo.8 + - rm $(mandir)/man8/udevtest.8 + - rm $(mandir)/man8/udevstart.8 + - rm $(mandir)/man8/udevd.8 + - rm $(mandir)/man8/udevsend.8 + +install: install-initscript install-config install-man install-dev.d all $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) @@ -371,12 +393,6 @@ install: install-initscript install-config install-dev.d all $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) - $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 - $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 - $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 - $(INSTALL_DATA) -D udevstart.8 $(DESTDIR)$(mandir)/man8/udevstart.8 - $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 - - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug ifndef DESTDIR - killall udevd @@ -388,18 +404,12 @@ endif -C $$target $@ ; \ done ; \ -uninstall: uninstall-dev.d +uninstall: uninstall-man uninstall-dev.d - rm $(hotplugdir)/udev.hotplug - rm $(configdir)/udev.permissions - rm $(configdir)/udev.rules - rm $(configdir)/udev.conf - rm $(initdir)/udev - - rm $(mandir)/man8/udev.8 - - rm $(mandir)/man8/udevinfo.8 - - rm $(mandir)/man8/udevtest.8 - - rm $(mandir)/man8/udevstart.8 - - rm $(mandir)/man8/udevd.8 - - rm $(mandir)/man8/udevsend.8 - rm $(sbindir)/$(ROOT) - rm $(sbindir)/$(DAEMON) - rm $(sbindir)/$(SENDER) diff --git a/udev.8 b/udev.8 deleted file mode 100644 index 680587a270..0000000000 --- a/udev.8 +++ /dev/null @@ -1,397 +0,0 @@ -.TH UDEV 8 "October 2003" "" "Linux Administrator's Manual" -.SH NAME -udev \- Linux configurable dynamic device naming support -.SH SYNOPSIS -.BI udev " hotplug-subsystem" -.P -The environment must provide the following variables: -.TP -.B ACTION -.IR add " or " remove -signifies the connection or disconnection of a device. -.TP -.B DEVPATH -The sysfs devpath of the device without the mountpoint but a leading slash. -.P -Additional optional environment variables: -.TP -.B UDEV_CONFIG_FILE -Overrides the default location of the -.B udev -config file. -.TP -.B UDEV_NO_SLEEP -The default behavior of -.B udev -is to wait until all the sysfs files of the device chain are populated. If set, -.B udev -will continue, regardless of the state of the device representation. -.TP -.B UDEV_NO_DEVD -The default behavior of -.B udev -is to execute programs in the -.I /etc/dev.d/ -directory after device handling. If set, -.B udev -will skip this step. -.SH "DESCRIPTION" -.B udev -provides a dynamic device directory containing only the files for actually -present devices. It creates or removes device node files usually located in -the /dev directory, or it renames network interfaces. -.br - -.P -As part of the -.B hotplug -subsystem, -.B udev -is executed if a kernel device is added or removed from the system. -On device creation, -.B udev -reads the sysfs directory of the given device to collect device attributes -like label, serial number or bus device number. -These attributes may be used as keys to determine a -unique name for the device. -.B udev -maintains a database for devices present on the system. -.br -On device removal, -.B udev -queries its database for the name of the device file to be deleted. -.SH "CONFIGURATION" -All -.B udev -configuration files consist of a set of lines of text. All empty -lines and lines beginning with a '#' will be ignored. -.P - -.B udev -expects its main configuration file at -.IR /etc/udev/udev.conf . -The file consists of a set of variables and values allowing the user to -override default udev values. The following variables can be overridden -in this file: -.TP -.B udev_root -Indicates where to place the device nodes in the filesystem. The default -value is -.IR /udev/ . -.TP -.B udev_db -The name and location of the udev database. The default value is -.IR /udev/.udev.tdb . -.TP -.B udev_rules -This is the location of the udev rules file. The default value for this is -.IR /etc/udev/udev.rules . -If a directory is specified, the whole directory is -scanned for files ending with -.I .rules -and all rule files are read in lexical order. -.TP -.B udev_permissions -This is the location of the udev permission file. The default value for this is -.IR /etc/udev/udev.permissions . -If a directory is specified, the whole directory is scanned for files ending with -.I .permissions -and all permission files are read in lexical order. -.TP -.B udev_log -If you want udev to log some information to the syslog for every device handled. -The default value is -.IR yes . -.TP -.B default_mode -This is the default mode for all nodes not explicitely matching in the -permissions file. The default value is -.IR 0666 . -.TP -.B default_owner -This is the default owner for all nodes not explicitely matching in the -permissions file. The default value is -.IR root . -.TP -.B default_group -This is the default group for all nodes not explicitely matching in the -permissions file. The default value is -.IR root . -.br -.P -.RI "A sample " udev.conf " might look like this: -.sp -.nf -# udev_root - where to place the device nodes in the filesystem -udev_root="/udev/" - -# udev_db - The name and location of the udev database -udev_db="/udev/.udev.tdb" - -# udev_rules - The location of the directory where to look for files - which names ending with .rules -udev_rules="/etc/udev/" - -# udev_permissions - The name and location of the udev permission file -udev_permissions="/etc/udev/udev.permissions" - -# udev_log - set to "yes" if you want logging, else "no" -udev_log="yes" - -# default_mode - set the default mode for all nodes not -# explicitely matching in the permissions file -default_mode="0666" - -# default_owner - set the default owner for all nodes not -# explicitely matching in the permissions file -default_owner="root" - -# default_group - set the default group for all nodes not -# explicitely matching in the permissions file -default_group="root" -.fi -.P -The rules for udev to use when naming devices may specified in -.I /etc/udev/udev.rules -or by the -.I udev_rules -value in the -.I /etc/udev/udev.conf -file. -.P -Every line in the rules file defines the mapping between device attributes -and the device name. One or more keys are specified to match a rule with -the current device. If all keys are matching, the rule will be applied and -the name is used to name the device file or the network interface. -.br -If no matching rule is found, the default kernel device name is used. -.P -Every rule consists of a list of comma separated fields: -.sp -.IR "key " ,[ "key " ,...] " name " [, " symlink" ] -.sp -where fields are: -.TP -.B BUS -Match the bus type of the device. -(The sysfs device bus must be able to be determined by a "device" symlink.) -.TP -.B KERNEL -Match the kernel device name. -.TP -.B ID -Match the device number on the bus, like PCI bus id. -.TP -.B PLACE -Match the topological position on bus, like physical port of USB device -.TP -.BI SYSFS{ filename } -Match sysfs device attribute like label, vendor, USB serial number, SCSI UUID -or file system label. Up to 5 different sysfs files can be checked, with -all of the values being required to match the rule. -.br -Trailing whitespace characters in the sysfs attribute value are ignored, if -the key doesn't have any trailing whitespace characters by itself. -.TP -.B PROGRAM -Call external program. This key is valid if the program returns successful. -The environment variables of -.B udev -are also available for the program. -.br -The string returned by the program may be additionally matched with the -.B RESULT -key. -.TP -.B RESULT -Match the returned string of the last -.B PROGRAM -call. This key may be used in any following rule after a -.B PROGRAM -call. -.TP -.B NAME -The name of the node to be created, or the name, the network interface -should be renamed to. -.br -If given with the attribute -.BR NAME{ all_partitions } -it will create all 15 partitions of a blockdevice. -This may be useful for removable media devices. -.TP -.B SYMLINK -The name of a symlink targeting the node. Multiple symlinks may be -specified by separating the names by the space character. -.br -If both the name and the symlink fields are omitted or its -values empty, the device will be ignored and no node will be created. -.br -If only the symlink field is given and the name field is omitted, -the rule will not be applied immediatly, but the symlink field is added -to the symlink list of the rule which will create the node. -This makes it possible to specify additional symlinks in a possibly -separate rules file, while the device nodes are maintained by the -distribution provided rules file. -.TP -.B OWNER, GROUP, MODE -The permissions for this device. Every specified value overwrites the value -given in the permissions file. -.P -.RB "The " NAME " ," SYMLINK " and " PROGRAM -fields support simple printf-like string substitution: -.TP -.B %n -The "kernel number" of the device. -For example, 'sda3' has a "kernel number" of '3'. -.TP -.B %k -The "kernel name" for the device. -.TP -.B %M -The kernel major number for the device. -.TP -.B %m -The kernel minor number for the device. -.TP -.B %b -The bus id for the device. -.TP -.B %c -The string returned from the execution of -.B PROGRAM -(This does not work within the -.B PROGRAM -field for the obvious reason.) -.br -A single part of the string, separated by a space character -may be selected by specifying the part number as an attribute: -.BI %c{ N } -If the number is followed by the + char this part plus -all remaining parts of the result string are substituted: -.BI %c{ N+ } -.TP -.BI %s{ filename } -The content of a sysfs attribute. -.TP -.B %% -The '%' character itself. -.P -The count of charcters to insert may be limited by specifying -the format length value. For example, '%3s{file}' will only insert -the first three characters of the sysfs attribute. -.P -.RI "A sample " udev.rules " might look like this:" -.sp -.nf -# if /sbin/scsi_id returns "OEM 0815" device will be called disk1 -BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="OEM 0815", NAME="disk1" - -# USB printer to be called lp_color -BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_color" - -# SCSI disk with a specific vendor and model number will be called boot -BUS="scsi", SYSFS{vendor}="IBM", SYSFS{model}="ST336", NAME="boot%n" - -# sound card with PCI bus id 00:0b.0 to be called dsp -BUS="pci", ID="00:0b.0", NAME="dsp" - -# USB mouse at third port of the second hub to be called mouse1 -BUS="usb", PLACE="2.3", NAME="mouse1" - -# ttyUSB1 should always be called pda with two additional symlinks -KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" - -# multiple USB webcams with symlinks to be called webcam0, webcam1, ... -BUS="usb", SYSFS{model}="XV3", NAME="video%n", SYMLINK="webcam%n" -.fi -.P -Permissions and ownership for the created device files may specified in -.I /etc/udev/udev.permissions -or by the -.I udev_permission -value in the -.I /etc/udev/udev.conf -file. -.br -Every line lists a device name followed by owner, group and permission -mode. All values are separated by colons. The name field may contain a -pattern to apply the values to a whole class of devices. -.sp -.RI "A sample " udev.permissions " might look like this:" -.sp -.nf -#name:user:group:mode -input/*:root:root:644 -ttyUSB1:0:8:0660 -video*:root:video:0660 -dsp1:::0666 -.fi -.P -The value -.I $local -can be used instead of a specific username. In that case, udev will determine -the current local user at the time of device node creation and substitute -that username as the owner of the new device node. This is useful, for -example, to let hot-plugged devices, such as cameras, be owned by the user at -the current console. Note that if no user is currently logged in, or if udev -otherwise fails to determine a current user, the -.I default_owner -value is used in lieu. -.P -A number of different fields in the above configuration files support a simple -form of shell style pattern matching. It supports the following pattern characters: -.TP -.B * -Matches zero, one, or more characters. -.TP -.B ? -Matches any single character, but does not match zero characters. -.TP -.B [ ] -Matches any single character specified within the brackets. For example, the -pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also -supported within this match with the '\-' character. For example, to match on -the range of all digits, the pattern [0\-9] would be used. If the first character -following the '[' is a '!', any character not enclosed is matched. -.P -After device node creation, removal, or network device renaming, -.B udev -executes the programs in the directory tree under -.IR /etc/dev.d/ . -The name of a program must end with -.I .dev -suffix, to be recognized. -.br -In addition to the hotplug environment variables, -.B DEVNAME -is exported to make the name of the created node, or the name the network -device is renamed to, available to the executed program. The programs in every -directory are sorted in lexical order, while the directories are searched in -the following order: -.sp -.nf -/etc/dev.d/$(DEVNAME)/*.dev -/etc/dev.d/$(SUBSYSTEM)/*.dev -/etc/dev.d/default/*.dev -.fi -.SH "FILES" -.nf -/sbin/udev udev program -/etc/udev/* udev config files -/etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program -/etc/dev.d/* programs invoked by udev -.fi -.LP -.SH "SEE ALSO" -.BR udevinfo (8), -.BR udevd (8), -.BR hotplug (8) -.PP -The -.I http://linux\-hotplug.sourceforge.net/ -web site. -.SH AUTHORS -.B udev -was developed by Greg Kroah-Hartman with much help from -Dan Stekloff , Kay Sievers , and -many others. diff --git a/udev.8.in b/udev.8.in new file mode 100644 index 0000000000..680587a270 --- /dev/null +++ b/udev.8.in @@ -0,0 +1,397 @@ +.TH UDEV 8 "October 2003" "" "Linux Administrator's Manual" +.SH NAME +udev \- Linux configurable dynamic device naming support +.SH SYNOPSIS +.BI udev " hotplug-subsystem" +.P +The environment must provide the following variables: +.TP +.B ACTION +.IR add " or " remove +signifies the connection or disconnection of a device. +.TP +.B DEVPATH +The sysfs devpath of the device without the mountpoint but a leading slash. +.P +Additional optional environment variables: +.TP +.B UDEV_CONFIG_FILE +Overrides the default location of the +.B udev +config file. +.TP +.B UDEV_NO_SLEEP +The default behavior of +.B udev +is to wait until all the sysfs files of the device chain are populated. If set, +.B udev +will continue, regardless of the state of the device representation. +.TP +.B UDEV_NO_DEVD +The default behavior of +.B udev +is to execute programs in the +.I /etc/dev.d/ +directory after device handling. If set, +.B udev +will skip this step. +.SH "DESCRIPTION" +.B udev +provides a dynamic device directory containing only the files for actually +present devices. It creates or removes device node files usually located in +the /dev directory, or it renames network interfaces. +.br + +.P +As part of the +.B hotplug +subsystem, +.B udev +is executed if a kernel device is added or removed from the system. +On device creation, +.B udev +reads the sysfs directory of the given device to collect device attributes +like label, serial number or bus device number. +These attributes may be used as keys to determine a +unique name for the device. +.B udev +maintains a database for devices present on the system. +.br +On device removal, +.B udev +queries its database for the name of the device file to be deleted. +.SH "CONFIGURATION" +All +.B udev +configuration files consist of a set of lines of text. All empty +lines and lines beginning with a '#' will be ignored. +.P + +.B udev +expects its main configuration file at +.IR /etc/udev/udev.conf . +The file consists of a set of variables and values allowing the user to +override default udev values. The following variables can be overridden +in this file: +.TP +.B udev_root +Indicates where to place the device nodes in the filesystem. The default +value is +.IR /udev/ . +.TP +.B udev_db +The name and location of the udev database. The default value is +.IR /udev/.udev.tdb . +.TP +.B udev_rules +This is the location of the udev rules file. The default value for this is +.IR /etc/udev/udev.rules . +If a directory is specified, the whole directory is +scanned for files ending with +.I .rules +and all rule files are read in lexical order. +.TP +.B udev_permissions +This is the location of the udev permission file. The default value for this is +.IR /etc/udev/udev.permissions . +If a directory is specified, the whole directory is scanned for files ending with +.I .permissions +and all permission files are read in lexical order. +.TP +.B udev_log +If you want udev to log some information to the syslog for every device handled. +The default value is +.IR yes . +.TP +.B default_mode +This is the default mode for all nodes not explicitely matching in the +permissions file. The default value is +.IR 0666 . +.TP +.B default_owner +This is the default owner for all nodes not explicitely matching in the +permissions file. The default value is +.IR root . +.TP +.B default_group +This is the default group for all nodes not explicitely matching in the +permissions file. The default value is +.IR root . +.br +.P +.RI "A sample " udev.conf " might look like this: +.sp +.nf +# udev_root - where to place the device nodes in the filesystem +udev_root="/udev/" + +# udev_db - The name and location of the udev database +udev_db="/udev/.udev.tdb" + +# udev_rules - The location of the directory where to look for files + which names ending with .rules +udev_rules="/etc/udev/" + +# udev_permissions - The name and location of the udev permission file +udev_permissions="/etc/udev/udev.permissions" + +# udev_log - set to "yes" if you want logging, else "no" +udev_log="yes" + +# default_mode - set the default mode for all nodes not +# explicitely matching in the permissions file +default_mode="0666" + +# default_owner - set the default owner for all nodes not +# explicitely matching in the permissions file +default_owner="root" + +# default_group - set the default group for all nodes not +# explicitely matching in the permissions file +default_group="root" +.fi +.P +The rules for udev to use when naming devices may specified in +.I /etc/udev/udev.rules +or by the +.I udev_rules +value in the +.I /etc/udev/udev.conf +file. +.P +Every line in the rules file defines the mapping between device attributes +and the device name. One or more keys are specified to match a rule with +the current device. If all keys are matching, the rule will be applied and +the name is used to name the device file or the network interface. +.br +If no matching rule is found, the default kernel device name is used. +.P +Every rule consists of a list of comma separated fields: +.sp +.IR "key " ,[ "key " ,...] " name " [, " symlink" ] +.sp +where fields are: +.TP +.B BUS +Match the bus type of the device. +(The sysfs device bus must be able to be determined by a "device" symlink.) +.TP +.B KERNEL +Match the kernel device name. +.TP +.B ID +Match the device number on the bus, like PCI bus id. +.TP +.B PLACE +Match the topological position on bus, like physical port of USB device +.TP +.BI SYSFS{ filename } +Match sysfs device attribute like label, vendor, USB serial number, SCSI UUID +or file system label. Up to 5 different sysfs files can be checked, with +all of the values being required to match the rule. +.br +Trailing whitespace characters in the sysfs attribute value are ignored, if +the key doesn't have any trailing whitespace characters by itself. +.TP +.B PROGRAM +Call external program. This key is valid if the program returns successful. +The environment variables of +.B udev +are also available for the program. +.br +The string returned by the program may be additionally matched with the +.B RESULT +key. +.TP +.B RESULT +Match the returned string of the last +.B PROGRAM +call. This key may be used in any following rule after a +.B PROGRAM +call. +.TP +.B NAME +The name of the node to be created, or the name, the network interface +should be renamed to. +.br +If given with the attribute +.BR NAME{ all_partitions } +it will create all 15 partitions of a blockdevice. +This may be useful for removable media devices. +.TP +.B SYMLINK +The name of a symlink targeting the node. Multiple symlinks may be +specified by separating the names by the space character. +.br +If both the name and the symlink fields are omitted or its +values empty, the device will be ignored and no node will be created. +.br +If only the symlink field is given and the name field is omitted, +the rule will not be applied immediatly, but the symlink field is added +to the symlink list of the rule which will create the node. +This makes it possible to specify additional symlinks in a possibly +separate rules file, while the device nodes are maintained by the +distribution provided rules file. +.TP +.B OWNER, GROUP, MODE +The permissions for this device. Every specified value overwrites the value +given in the permissions file. +.P +.RB "The " NAME " ," SYMLINK " and " PROGRAM +fields support simple printf-like string substitution: +.TP +.B %n +The "kernel number" of the device. +For example, 'sda3' has a "kernel number" of '3'. +.TP +.B %k +The "kernel name" for the device. +.TP +.B %M +The kernel major number for the device. +.TP +.B %m +The kernel minor number for the device. +.TP +.B %b +The bus id for the device. +.TP +.B %c +The string returned from the execution of +.B PROGRAM +(This does not work within the +.B PROGRAM +field for the obvious reason.) +.br +A single part of the string, separated by a space character +may be selected by specifying the part number as an attribute: +.BI %c{ N } +If the number is followed by the + char this part plus +all remaining parts of the result string are substituted: +.BI %c{ N+ } +.TP +.BI %s{ filename } +The content of a sysfs attribute. +.TP +.B %% +The '%' character itself. +.P +The count of charcters to insert may be limited by specifying +the format length value. For example, '%3s{file}' will only insert +the first three characters of the sysfs attribute. +.P +.RI "A sample " udev.rules " might look like this:" +.sp +.nf +# if /sbin/scsi_id returns "OEM 0815" device will be called disk1 +BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="OEM 0815", NAME="disk1" + +# USB printer to be called lp_color +BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_color" + +# SCSI disk with a specific vendor and model number will be called boot +BUS="scsi", SYSFS{vendor}="IBM", SYSFS{model}="ST336", NAME="boot%n" + +# sound card with PCI bus id 00:0b.0 to be called dsp +BUS="pci", ID="00:0b.0", NAME="dsp" + +# USB mouse at third port of the second hub to be called mouse1 +BUS="usb", PLACE="2.3", NAME="mouse1" + +# ttyUSB1 should always be called pda with two additional symlinks +KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" + +# multiple USB webcams with symlinks to be called webcam0, webcam1, ... +BUS="usb", SYSFS{model}="XV3", NAME="video%n", SYMLINK="webcam%n" +.fi +.P +Permissions and ownership for the created device files may specified in +.I /etc/udev/udev.permissions +or by the +.I udev_permission +value in the +.I /etc/udev/udev.conf +file. +.br +Every line lists a device name followed by owner, group and permission +mode. All values are separated by colons. The name field may contain a +pattern to apply the values to a whole class of devices. +.sp +.RI "A sample " udev.permissions " might look like this:" +.sp +.nf +#name:user:group:mode +input/*:root:root:644 +ttyUSB1:0:8:0660 +video*:root:video:0660 +dsp1:::0666 +.fi +.P +The value +.I $local +can be used instead of a specific username. In that case, udev will determine +the current local user at the time of device node creation and substitute +that username as the owner of the new device node. This is useful, for +example, to let hot-plugged devices, such as cameras, be owned by the user at +the current console. Note that if no user is currently logged in, or if udev +otherwise fails to determine a current user, the +.I default_owner +value is used in lieu. +.P +A number of different fields in the above configuration files support a simple +form of shell style pattern matching. It supports the following pattern characters: +.TP +.B * +Matches zero, one, or more characters. +.TP +.B ? +Matches any single character, but does not match zero characters. +.TP +.B [ ] +Matches any single character specified within the brackets. For example, the +pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also +supported within this match with the '\-' character. For example, to match on +the range of all digits, the pattern [0\-9] would be used. If the first character +following the '[' is a '!', any character not enclosed is matched. +.P +After device node creation, removal, or network device renaming, +.B udev +executes the programs in the directory tree under +.IR /etc/dev.d/ . +The name of a program must end with +.I .dev +suffix, to be recognized. +.br +In addition to the hotplug environment variables, +.B DEVNAME +is exported to make the name of the created node, or the name the network +device is renamed to, available to the executed program. The programs in every +directory are sorted in lexical order, while the directories are searched in +the following order: +.sp +.nf +/etc/dev.d/$(DEVNAME)/*.dev +/etc/dev.d/$(SUBSYSTEM)/*.dev +/etc/dev.d/default/*.dev +.fi +.SH "FILES" +.nf +/sbin/udev udev program +/etc/udev/* udev config files +/etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program +/etc/dev.d/* programs invoked by udev +.fi +.LP +.SH "SEE ALSO" +.BR udevinfo (8), +.BR udevd (8), +.BR hotplug (8) +.PP +The +.I http://linux\-hotplug.sourceforge.net/ +web site. +.SH AUTHORS +.B udev +was developed by Greg Kroah-Hartman with much help from +Dan Stekloff , Kay Sievers , and +many others. diff --git a/udevd.8 b/udevd.8 deleted file mode 100644 index 9d0127b6bc..0000000000 --- a/udevd.8 +++ /dev/null @@ -1,56 +0,0 @@ -.TH UDEVD 8 "February 2004" "" "Linux Administrator's Manual" -.SH NAME -udevd \- udev event serializer daemon -.br -udevsend \- sends the event to udevd -.SH SYNOPSIS -.BI udevsend " hotplug-subsystem" -.sp -The environment must provide the following variables: -.TP -.B ACTION -.IR add " or " remove -signifies the connection or disconnection of a device. -.TP -.B DEVPATH -The sysfs devpath of the device without the mountpoint but a leading slash. -.TP -.B SEQNUM -The sequence number of the event provided by the kernel. -If unset, the event bypasses the queue and will be executed immediately. -.SH "DESCRIPTION" -.B udevd -allows the serialization of -.BR hotplug (8) -events. The events generated by the kernel may arrive in random order -in userspace, that makes it neccessary to reorder them. -.br -.B udevd -takes care of the kernel supplied sequence number and arranges the events for -execution in the correct order. Missing sequences delay the execution of the -following events until a timeout of a maximum of 5 seconds is reached. -.br -For each event a -.BR udev (8) -instance is executed in the background. All further events for the same device -are delayed until the execution is finished. This way there will never be more -than one instance running for a single device at the same time. -.br -.B udevd -receives the events from -.B udevsend -which is called by -.BR hotplug (8). -If -.B udevd -isn't already running, -.B udevsend -will start it. -.SH "SEE ALSO" -.BR udev (8), -.BR udevinfo (8), -.BR hotplug (8) -.SH AUTHORS -.B udevd -was developed primarily by Kay Sievers , with much help -from others. diff --git a/udevd.8.in b/udevd.8.in new file mode 100644 index 0000000000..9d0127b6bc --- /dev/null +++ b/udevd.8.in @@ -0,0 +1,56 @@ +.TH UDEVD 8 "February 2004" "" "Linux Administrator's Manual" +.SH NAME +udevd \- udev event serializer daemon +.br +udevsend \- sends the event to udevd +.SH SYNOPSIS +.BI udevsend " hotplug-subsystem" +.sp +The environment must provide the following variables: +.TP +.B ACTION +.IR add " or " remove +signifies the connection or disconnection of a device. +.TP +.B DEVPATH +The sysfs devpath of the device without the mountpoint but a leading slash. +.TP +.B SEQNUM +The sequence number of the event provided by the kernel. +If unset, the event bypasses the queue and will be executed immediately. +.SH "DESCRIPTION" +.B udevd +allows the serialization of +.BR hotplug (8) +events. The events generated by the kernel may arrive in random order +in userspace, that makes it neccessary to reorder them. +.br +.B udevd +takes care of the kernel supplied sequence number and arranges the events for +execution in the correct order. Missing sequences delay the execution of the +following events until a timeout of a maximum of 5 seconds is reached. +.br +For each event a +.BR udev (8) +instance is executed in the background. All further events for the same device +are delayed until the execution is finished. This way there will never be more +than one instance running for a single device at the same time. +.br +.B udevd +receives the events from +.B udevsend +which is called by +.BR hotplug (8). +If +.B udevd +isn't already running, +.B udevsend +will start it. +.SH "SEE ALSO" +.BR udev (8), +.BR udevinfo (8), +.BR hotplug (8) +.SH AUTHORS +.B udevd +was developed primarily by Kay Sievers , with much help +from others. diff --git a/udevinfo.8 b/udevinfo.8 deleted file mode 100644 index 0588084cac..0000000000 --- a/udevinfo.8 +++ /dev/null @@ -1,64 +0,0 @@ -.TH UDEVINFO 8 "January 2004" "" "Linux Administrator's Manual" -.SH NAME -udevinfo \- retrieve information from udev -.SH SYNOPSIS -.B udevinfo -.RI "[\-q " query_type " \-p " sysfs_path "] [\-drVh]" -.SH "DESCRIPTION" -.B udevinfo -allows users to query the udev database for information on any device -currently present on the system. It also provides a way to query any device -in the sysfs tree to help creating -.B udev -rules. -.SH "OPTIONS" -.TP -.B \-V -Print the version information. -.TP -.B \-r -Print the -.B udev_root -directory. When used in conjunction with a query for the node name, the -.B udev_root -will be prepended. -.TP -.BI \-q " query_type" -Query the database for specified value of a created device node or network -interface. -.RB Needs " \-p " or " \-n " specified. -.br -Valid types are: -.BR name ", " symlink ", " mode " ," owner " , " group " , " path " or " all. -.TP -.BI \-p " sysfs_path" -Specify the sysfs path of the device to query. -.TP -.BI \-n " name" -Specify the name of the node, the symlink or the network interface for the -device to query. Partition names generated with the NAME{all_partitons} option -can not be queried, the main device must be used instead. -.TP -.B \-a -Print all -.BI SYSFS{ filename } -attributes along the device chain. Useful for finding -unique attributes to compose a rule. -.RB Needs " \-p " specified. -.TP -.B \-d -Dump the whole database. -.TP -.B \-h -Print help text. -.SH "FILES" -.nf -/etc/udev/* udev config files -.fi -.LP -.SH "SEE ALSO" -.BR udev (8) -.SH AUTHORS -.B udevinfo -was developed primarily by Kay Sievers , with help -from others. diff --git a/udevinfo.8.in b/udevinfo.8.in new file mode 100644 index 0000000000..0588084cac --- /dev/null +++ b/udevinfo.8.in @@ -0,0 +1,64 @@ +.TH UDEVINFO 8 "January 2004" "" "Linux Administrator's Manual" +.SH NAME +udevinfo \- retrieve information from udev +.SH SYNOPSIS +.B udevinfo +.RI "[\-q " query_type " \-p " sysfs_path "] [\-drVh]" +.SH "DESCRIPTION" +.B udevinfo +allows users to query the udev database for information on any device +currently present on the system. It also provides a way to query any device +in the sysfs tree to help creating +.B udev +rules. +.SH "OPTIONS" +.TP +.B \-V +Print the version information. +.TP +.B \-r +Print the +.B udev_root +directory. When used in conjunction with a query for the node name, the +.B udev_root +will be prepended. +.TP +.BI \-q " query_type" +Query the database for specified value of a created device node or network +interface. +.RB Needs " \-p " or " \-n " specified. +.br +Valid types are: +.BR name ", " symlink ", " mode " ," owner " , " group " , " path " or " all. +.TP +.BI \-p " sysfs_path" +Specify the sysfs path of the device to query. +.TP +.BI \-n " name" +Specify the name of the node, the symlink or the network interface for the +device to query. Partition names generated with the NAME{all_partitons} option +can not be queried, the main device must be used instead. +.TP +.B \-a +Print all +.BI SYSFS{ filename } +attributes along the device chain. Useful for finding +unique attributes to compose a rule. +.RB Needs " \-p " specified. +.TP +.B \-d +Dump the whole database. +.TP +.B \-h +Print help text. +.SH "FILES" +.nf +/etc/udev/* udev config files +.fi +.LP +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevinfo +was developed primarily by Kay Sievers , with help +from others. diff --git a/udevstart.8 b/udevstart.8 deleted file mode 100644 index c64400cc4f..0000000000 --- a/udevstart.8 +++ /dev/null @@ -1,18 +0,0 @@ -.TH UDEVSTART 8 "March 2004" "" "Linux Administrator's Manual" -.SH NAME -udevstart \- populate initial device directory -.SH SYNOPSIS -.B udevstart -.SH "DESCRIPTION" -.B udevstart -walks trough the sysfs device tree and calls -.B udev -to create the nodes for every valid device found. It can be used to fill a -empty device directory with nodes for all devices currently available on -the system. -.SH "SEE ALSO" -.BR udev (8) -.SH AUTHORS -.B udevstart -was developed primarily by Harald Hoyer , with much help -from others. diff --git a/udevstart.8.in b/udevstart.8.in new file mode 100644 index 0000000000..c64400cc4f --- /dev/null +++ b/udevstart.8.in @@ -0,0 +1,18 @@ +.TH UDEVSTART 8 "March 2004" "" "Linux Administrator's Manual" +.SH NAME +udevstart \- populate initial device directory +.SH SYNOPSIS +.B udevstart +.SH "DESCRIPTION" +.B udevstart +walks trough the sysfs device tree and calls +.B udev +to create the nodes for every valid device found. It can be used to fill a +empty device directory with nodes for all devices currently available on +the system. +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevstart +was developed primarily by Harald Hoyer , with much help +from others. diff --git a/udevtest.8 b/udevtest.8 deleted file mode 100644 index 6be7e089cf..0000000000 --- a/udevtest.8 +++ /dev/null @@ -1,18 +0,0 @@ -.TH UDEVTEST 8 "March 2004" "" "Linux Administrator's Manual" -.SH NAME -udevtest \- simulates a udev run to test the configured rules -.SH SYNOPSIS -.BI udevtest " sysfs_device_path" -.SH "DESCRIPTION" -.B udevtest -simulates a -.B udev -run for the given device, and prints out the name of the node -the real udev would have created, or the name of the renamed network -interface. -.SH "SEE ALSO" -.BR udev (8) -.SH AUTHORS -.B udevtest -was developed by Greg Kroah-Hartman with much help -from others. diff --git a/udevtest.8.in b/udevtest.8.in new file mode 100644 index 0000000000..6be7e089cf --- /dev/null +++ b/udevtest.8.in @@ -0,0 +1,18 @@ +.TH UDEVTEST 8 "March 2004" "" "Linux Administrator's Manual" +.SH NAME +udevtest \- simulates a udev run to test the configured rules +.SH SYNOPSIS +.BI udevtest " sysfs_device_path" +.SH "DESCRIPTION" +.B udevtest +simulates a +.B udev +run for the given device, and prints out the name of the node +the real udev would have created, or the name of the renamed network +interface. +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevtest +was developed by Greg Kroah-Hartman with much help +from others. -- cgit v1.2.3-54-g00ecf From 326e0876e40eb7559e7fbbde47785685013cb624 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Apr 2004 23:55:45 -0800 Subject: [PATCH] convert udev.8.in to use @udevdir@ macro for make install. --- udev.8.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev.8.in b/udev.8.in index 680587a270..76e727f598 100644 --- a/udev.8.in +++ b/udev.8.in @@ -77,11 +77,11 @@ in this file: .B udev_root Indicates where to place the device nodes in the filesystem. The default value is -.IR /udev/ . +.IR @udevdir@ . .TP .B udev_db The name and location of the udev database. The default value is -.IR /udev/.udev.tdb . +.IR @udevdir@/.udev.tdb . .TP .B udev_rules This is the location of the udev rules file. The default value for this is @@ -123,10 +123,10 @@ permissions file. The default value is .sp .nf # udev_root - where to place the device nodes in the filesystem -udev_root="/udev/" +udev_root="@udevdir@" # udev_db - The name and location of the udev database -udev_db="/udev/.udev.tdb" +udev_db="@udevdir@/.udev.tdb" # udev_rules - The location of the directory where to look for files which names ending with .rules -- cgit v1.2.3-54-g00ecf From 487c1b35ba1d0a2f76d99dc9b9454e2895f915bb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 2 Apr 2004 00:01:58 -0800 Subject: [PATCH] switch to generate the man pages during the normal build, not during the install. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 01fb2a4486..d82fea0690 100644 --- a/Makefile +++ b/Makefile @@ -261,7 +261,7 @@ $(DAEMON).o: $(GEN_HEADERS) $(SENDER).o: $(GEN_HEADERS) $(STARTER).o: $(GEN_HEADERS) -$(ROOT): $(ROOT).o $(OBJS) $(HEADERS) $(LIBC) +$(ROOT): $(ROOT).o $(OBJS) $(HEADERS) $(LIBC) $(GEN_MANPAGES) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ @@ -368,7 +368,7 @@ uninstall-dev.d: - rmdir $(dev_ddir)default - rmdir $(dev_ddir) -install-man: $(GEN_MANPAGES) +install-man: $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 -- cgit v1.2.3-54-g00ecf From c19b069189fc31ff07bf482cf77fcf25549501b4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 2 Apr 2004 00:13:20 -0800 Subject: [PATCH] update bk ignore list some more. --- udevd.8 | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ udevd.8.in | 56 -------------------------------------------------- udevinfo.8 | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udevinfo.8.in | 64 ---------------------------------------------------------- udevstart.8 | 18 +++++++++++++++++ udevstart.8.in | 18 ----------------- udevtest.8 | 18 +++++++++++++++++ udevtest.8.in | 18 ----------------- 8 files changed, 156 insertions(+), 156 deletions(-) create mode 100644 udevd.8 delete mode 100644 udevd.8.in create mode 100644 udevinfo.8 delete mode 100644 udevinfo.8.in create mode 100644 udevstart.8 delete mode 100644 udevstart.8.in create mode 100644 udevtest.8 delete mode 100644 udevtest.8.in diff --git a/udevd.8 b/udevd.8 new file mode 100644 index 0000000000..9d0127b6bc --- /dev/null +++ b/udevd.8 @@ -0,0 +1,56 @@ +.TH UDEVD 8 "February 2004" "" "Linux Administrator's Manual" +.SH NAME +udevd \- udev event serializer daemon +.br +udevsend \- sends the event to udevd +.SH SYNOPSIS +.BI udevsend " hotplug-subsystem" +.sp +The environment must provide the following variables: +.TP +.B ACTION +.IR add " or " remove +signifies the connection or disconnection of a device. +.TP +.B DEVPATH +The sysfs devpath of the device without the mountpoint but a leading slash. +.TP +.B SEQNUM +The sequence number of the event provided by the kernel. +If unset, the event bypasses the queue and will be executed immediately. +.SH "DESCRIPTION" +.B udevd +allows the serialization of +.BR hotplug (8) +events. The events generated by the kernel may arrive in random order +in userspace, that makes it neccessary to reorder them. +.br +.B udevd +takes care of the kernel supplied sequence number and arranges the events for +execution in the correct order. Missing sequences delay the execution of the +following events until a timeout of a maximum of 5 seconds is reached. +.br +For each event a +.BR udev (8) +instance is executed in the background. All further events for the same device +are delayed until the execution is finished. This way there will never be more +than one instance running for a single device at the same time. +.br +.B udevd +receives the events from +.B udevsend +which is called by +.BR hotplug (8). +If +.B udevd +isn't already running, +.B udevsend +will start it. +.SH "SEE ALSO" +.BR udev (8), +.BR udevinfo (8), +.BR hotplug (8) +.SH AUTHORS +.B udevd +was developed primarily by Kay Sievers , with much help +from others. diff --git a/udevd.8.in b/udevd.8.in deleted file mode 100644 index 9d0127b6bc..0000000000 --- a/udevd.8.in +++ /dev/null @@ -1,56 +0,0 @@ -.TH UDEVD 8 "February 2004" "" "Linux Administrator's Manual" -.SH NAME -udevd \- udev event serializer daemon -.br -udevsend \- sends the event to udevd -.SH SYNOPSIS -.BI udevsend " hotplug-subsystem" -.sp -The environment must provide the following variables: -.TP -.B ACTION -.IR add " or " remove -signifies the connection or disconnection of a device. -.TP -.B DEVPATH -The sysfs devpath of the device without the mountpoint but a leading slash. -.TP -.B SEQNUM -The sequence number of the event provided by the kernel. -If unset, the event bypasses the queue and will be executed immediately. -.SH "DESCRIPTION" -.B udevd -allows the serialization of -.BR hotplug (8) -events. The events generated by the kernel may arrive in random order -in userspace, that makes it neccessary to reorder them. -.br -.B udevd -takes care of the kernel supplied sequence number and arranges the events for -execution in the correct order. Missing sequences delay the execution of the -following events until a timeout of a maximum of 5 seconds is reached. -.br -For each event a -.BR udev (8) -instance is executed in the background. All further events for the same device -are delayed until the execution is finished. This way there will never be more -than one instance running for a single device at the same time. -.br -.B udevd -receives the events from -.B udevsend -which is called by -.BR hotplug (8). -If -.B udevd -isn't already running, -.B udevsend -will start it. -.SH "SEE ALSO" -.BR udev (8), -.BR udevinfo (8), -.BR hotplug (8) -.SH AUTHORS -.B udevd -was developed primarily by Kay Sievers , with much help -from others. diff --git a/udevinfo.8 b/udevinfo.8 new file mode 100644 index 0000000000..0588084cac --- /dev/null +++ b/udevinfo.8 @@ -0,0 +1,64 @@ +.TH UDEVINFO 8 "January 2004" "" "Linux Administrator's Manual" +.SH NAME +udevinfo \- retrieve information from udev +.SH SYNOPSIS +.B udevinfo +.RI "[\-q " query_type " \-p " sysfs_path "] [\-drVh]" +.SH "DESCRIPTION" +.B udevinfo +allows users to query the udev database for information on any device +currently present on the system. It also provides a way to query any device +in the sysfs tree to help creating +.B udev +rules. +.SH "OPTIONS" +.TP +.B \-V +Print the version information. +.TP +.B \-r +Print the +.B udev_root +directory. When used in conjunction with a query for the node name, the +.B udev_root +will be prepended. +.TP +.BI \-q " query_type" +Query the database for specified value of a created device node or network +interface. +.RB Needs " \-p " or " \-n " specified. +.br +Valid types are: +.BR name ", " symlink ", " mode " ," owner " , " group " , " path " or " all. +.TP +.BI \-p " sysfs_path" +Specify the sysfs path of the device to query. +.TP +.BI \-n " name" +Specify the name of the node, the symlink or the network interface for the +device to query. Partition names generated with the NAME{all_partitons} option +can not be queried, the main device must be used instead. +.TP +.B \-a +Print all +.BI SYSFS{ filename } +attributes along the device chain. Useful for finding +unique attributes to compose a rule. +.RB Needs " \-p " specified. +.TP +.B \-d +Dump the whole database. +.TP +.B \-h +Print help text. +.SH "FILES" +.nf +/etc/udev/* udev config files +.fi +.LP +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevinfo +was developed primarily by Kay Sievers , with help +from others. diff --git a/udevinfo.8.in b/udevinfo.8.in deleted file mode 100644 index 0588084cac..0000000000 --- a/udevinfo.8.in +++ /dev/null @@ -1,64 +0,0 @@ -.TH UDEVINFO 8 "January 2004" "" "Linux Administrator's Manual" -.SH NAME -udevinfo \- retrieve information from udev -.SH SYNOPSIS -.B udevinfo -.RI "[\-q " query_type " \-p " sysfs_path "] [\-drVh]" -.SH "DESCRIPTION" -.B udevinfo -allows users to query the udev database for information on any device -currently present on the system. It also provides a way to query any device -in the sysfs tree to help creating -.B udev -rules. -.SH "OPTIONS" -.TP -.B \-V -Print the version information. -.TP -.B \-r -Print the -.B udev_root -directory. When used in conjunction with a query for the node name, the -.B udev_root -will be prepended. -.TP -.BI \-q " query_type" -Query the database for specified value of a created device node or network -interface. -.RB Needs " \-p " or " \-n " specified. -.br -Valid types are: -.BR name ", " symlink ", " mode " ," owner " , " group " , " path " or " all. -.TP -.BI \-p " sysfs_path" -Specify the sysfs path of the device to query. -.TP -.BI \-n " name" -Specify the name of the node, the symlink or the network interface for the -device to query. Partition names generated with the NAME{all_partitons} option -can not be queried, the main device must be used instead. -.TP -.B \-a -Print all -.BI SYSFS{ filename } -attributes along the device chain. Useful for finding -unique attributes to compose a rule. -.RB Needs " \-p " specified. -.TP -.B \-d -Dump the whole database. -.TP -.B \-h -Print help text. -.SH "FILES" -.nf -/etc/udev/* udev config files -.fi -.LP -.SH "SEE ALSO" -.BR udev (8) -.SH AUTHORS -.B udevinfo -was developed primarily by Kay Sievers , with help -from others. diff --git a/udevstart.8 b/udevstart.8 new file mode 100644 index 0000000000..c64400cc4f --- /dev/null +++ b/udevstart.8 @@ -0,0 +1,18 @@ +.TH UDEVSTART 8 "March 2004" "" "Linux Administrator's Manual" +.SH NAME +udevstart \- populate initial device directory +.SH SYNOPSIS +.B udevstart +.SH "DESCRIPTION" +.B udevstart +walks trough the sysfs device tree and calls +.B udev +to create the nodes for every valid device found. It can be used to fill a +empty device directory with nodes for all devices currently available on +the system. +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevstart +was developed primarily by Harald Hoyer , with much help +from others. diff --git a/udevstart.8.in b/udevstart.8.in deleted file mode 100644 index c64400cc4f..0000000000 --- a/udevstart.8.in +++ /dev/null @@ -1,18 +0,0 @@ -.TH UDEVSTART 8 "March 2004" "" "Linux Administrator's Manual" -.SH NAME -udevstart \- populate initial device directory -.SH SYNOPSIS -.B udevstart -.SH "DESCRIPTION" -.B udevstart -walks trough the sysfs device tree and calls -.B udev -to create the nodes for every valid device found. It can be used to fill a -empty device directory with nodes for all devices currently available on -the system. -.SH "SEE ALSO" -.BR udev (8) -.SH AUTHORS -.B udevstart -was developed primarily by Harald Hoyer , with much help -from others. diff --git a/udevtest.8 b/udevtest.8 new file mode 100644 index 0000000000..6be7e089cf --- /dev/null +++ b/udevtest.8 @@ -0,0 +1,18 @@ +.TH UDEVTEST 8 "March 2004" "" "Linux Administrator's Manual" +.SH NAME +udevtest \- simulates a udev run to test the configured rules +.SH SYNOPSIS +.BI udevtest " sysfs_device_path" +.SH "DESCRIPTION" +.B udevtest +simulates a +.B udev +run for the given device, and prints out the name of the node +the real udev would have created, or the name of the renamed network +interface. +.SH "SEE ALSO" +.BR udev (8) +.SH AUTHORS +.B udevtest +was developed by Greg Kroah-Hartman with much help +from others. diff --git a/udevtest.8.in b/udevtest.8.in deleted file mode 100644 index 6be7e089cf..0000000000 --- a/udevtest.8.in +++ /dev/null @@ -1,18 +0,0 @@ -.TH UDEVTEST 8 "March 2004" "" "Linux Administrator's Manual" -.SH NAME -udevtest \- simulates a udev run to test the configured rules -.SH SYNOPSIS -.BI udevtest " sysfs_device_path" -.SH "DESCRIPTION" -.B udevtest -simulates a -.B udev -run for the given device, and prints out the name of the node -the real udev would have created, or the name of the renamed network -interface. -.SH "SEE ALSO" -.BR udev (8) -.SH AUTHORS -.B udevtest -was developed by Greg Kroah-Hartman with much help -from others. -- cgit v1.2.3-54-g00ecf From 08b5da6a030f86810c100e465d9bfaa5113ba34d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 2 Apr 2004 00:13:50 -0800 Subject: [PATCH] only generate udev.8 on the fly, not all other man pages. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d82fea0690..4c194cd0fc 100644 --- a/Makefile +++ b/Makefile @@ -246,8 +246,8 @@ GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf $(LOCAL_CFG_DIR)/udev.conf: sed -e "s:@udevdir@:$(udevdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ -GEN_MANPAGES = udev.8 udevd.8 udevinfo.8 udevstart.8 udevtest.8 -GEN_MANPAGESIN = udev.8.in udevd.8.in udevinfo.8.in udevstart.8.in udevtest.8.in +GEN_MANPAGES = udev.8 +GEN_MANPAGESIN = udev.8.in # Rules on how to create the man pages $(GEN_MANPAGES): $(GEN_MANPAGESIN) sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ -- cgit v1.2.3-54-g00ecf From 5df33ccd8e03043597ff2b1777bbf5219e7080e3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 2 Apr 2004 16:58:57 -0800 Subject: [PATCH] udevstart fix Sorry, udevstart needs a small cleanup after my recent copy/pastes. --- udevstart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevstart.c b/udevstart.c index 7e19c379a5..5e6606d535 100644 --- a/udevstart.c +++ b/udevstart.c @@ -62,8 +62,8 @@ static void udev_exec(const char *path, const char* subsystem) char nosleep[] = "UDEV_NO_SLEEP=1"; char *env[] = { action, devpath, nosleep, NULL }; - strcpy(action, "DEVPATH=%s"); - strfieldcat(action, path); + strcpy(devpath, "DEVPATH="); + strfieldcat(devpath, path); pid = fork(); switch (pid) { -- cgit v1.2.3-54-g00ecf From 4ef51da90ceec73aafacf32d1eba427236763ce1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 2 Apr 2004 16:58:59 -0800 Subject: [PATCH] increase udevd event timeout I have a very slow Bluetooth adapter hotplug event call, so we need to increase the event timeout to something larger than 6 seconds. Apr 1 02:54:08 pim udevsend[12119]: main: DEVPATH = '/class/tty/ttyUB0' Apr 1 02:54:08 pim udevsend[12119]: main: SEQNUM = '340' Apr 1 02:54:08 pim udevsend[12120]: main: DEVPATH = '/devices/pci0000:00/0000:00:1d.2/usb4/4-1' Apr 1 02:54:08 pim udevsend[12120]: main: SEQNUM = '344' Apr 1 02:54:09 pim udevsend[12133]: main: DEVPATH = '/devices/pci0000:00/0000:00:1d.2/usb4/4-1/4-1:1.1' Apr 1 02:54:09 pim udevsend[12133]: main: SEQNUM = '342' Apr 1 02:54:10 pim udevsend[12136]: main: DEVPATH = '/devices/pci0000:00/0000:00:1d.2/usb4/4-1/4-1:1.2' Apr 1 02:54:10 pim udevsend[12136]: main: SEQNUM = '343' Apr 1 02:54:13 pim udevsend[12141]: main: DEVPATH = '/devices/pci0000:00/0000:00:1d.2/usb4/4-1/4-1:1.0' Apr 1 02:54:13 pim udevsend[12141]: main: SEQNUM = '341' --- udevd.8 | 2 +- udevd.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udevd.8 b/udevd.8 index 9d0127b6bc..52c270add8 100644 --- a/udevd.8 +++ b/udevd.8 @@ -28,7 +28,7 @@ in userspace, that makes it neccessary to reorder them. .B udevd takes care of the kernel supplied sequence number and arranges the events for execution in the correct order. Missing sequences delay the execution of the -following events until a timeout of a maximum of 5 seconds is reached. +following events until a timeout is reached. .br For each event a .BR udev (8) diff --git a/udevd.h b/udevd.h index 96f179ad44..5fdd62d323 100644 --- a/udevd.h +++ b/udevd.h @@ -25,7 +25,7 @@ #include "list.h" #define UDEV_MAGIC "udevd_" UDEV_VERSION -#define EVENT_TIMEOUT_SEC 5 +#define EVENT_TIMEOUT_SEC 10 #define UDEVSEND_CONNECT_RETRY 20 /* x 100 millisec */ #define UDEVD_SOCK_PATH "udevd" -- cgit v1.2.3-54-g00ecf From 1e799babb6f37b2d52f1a0a3bfaf85c0405cf10a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 2 Apr 2004 16:59:01 -0800 Subject: [PATCH] put config info in db for netdev Small change, to put the config informations for handled network interfaces into the database. --- namedev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index a3ae1d36b3..51a4639abe 100644 --- a/namedev.c +++ b/namedev.c @@ -850,13 +850,13 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud found: apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); + strfieldcpy(udev->config_file, dev->config_file); + udev->config_line = dev->config_line; if (udev->type == 'n') goto done; udev->partitions = dev->partitions; - strfieldcpy(udev->config_file, dev->config_file); - udev->config_line = dev->config_line; /* get permissions given in rule */ set_empty_perms(udev, dev->mode, -- cgit v1.2.3-54-g00ecf From a53277558395dd30ed15dec3c9af6bab01fadfea Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 2 Apr 2004 16:59:04 -0800 Subject: [PATCH] man page cleanup Small cleanup of the wording in the udev. man page. --- udev.8.in | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/udev.8.in b/udev.8.in index 76e727f598..f803578968 100644 --- a/udev.8.in +++ b/udev.8.in @@ -84,38 +84,36 @@ The name and location of the udev database. The default value is .IR @udevdir@/.udev.tdb . .TP .B udev_rules -This is the location of the udev rules file. The default value for this is +The name of the udev rules file or directory to look for files with the suffix +.IR .rules . +All rule files are read in lexical order. The default value is .IR /etc/udev/udev.rules . -If a directory is specified, the whole directory is -scanned for files ending with -.I .rules -and all rule files are read in lexical order. .TP .B udev_permissions -This is the location of the udev permission file. The default value for this is +The name of the udev permission file or directory to look for files with the +suffix +.IR .permissions . +All permission files are read in lexical order. The default value is .IR /etc/udev/udev.permissions . -If a directory is specified, the whole directory is scanned for files ending with -.I .permissions -and all permission files are read in lexical order. .TP .B udev_log -If you want udev to log some information to the syslog for every device handled. +The switch, if udev logs some information for every device handled. The default value is .IR yes . .TP .B default_mode -This is the default mode for all nodes not explicitely matching in the -permissions file. The default value is +The default mode for all nodes not explicitely matching in the permissions +file. The default value is .IR 0666 . .TP .B default_owner -This is the default owner for all nodes not explicitely matching in the -permissions file. The default value is +The default owner for all nodes not explicitely matching in the permissions +file. The default value is .IR root . .TP .B default_group -This is the default group for all nodes not explicitely matching in the -permissions file. The default value is +The default group for all nodes not explicitely matching in the permissions +file. The default value is .IR root . .br .P @@ -128,11 +126,12 @@ udev_root="@udevdir@" # udev_db - The name and location of the udev database udev_db="@udevdir@/.udev.tdb" -# udev_rules - The location of the directory where to look for files - which names ending with .rules -udev_rules="/etc/udev/" +# udev_rules - The name of the udev rules file or directory to look + for files with the suffix .rules +udev_rules="/etc/udev/rules.d/" -# udev_permissions - The name and location of the udev permission file +# udev_permissions - The name of the udev permission file or directry to look + for files with the suffix .permissions udev_permissions="/etc/udev/udev.permissions" # udev_log - set to "yes" if you want logging, else "no" -- cgit v1.2.3-54-g00ecf From 9a689d5863f2794aa71674dce4d251bec20ef0fb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 2 Apr 2004 17:02:09 -0800 Subject: [PATCH] remove compiler warning from udevd.c --- udevd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udevd.c b/udevd.c index d464b9a196..1bbb0a98e7 100644 --- a/udevd.c +++ b/udevd.c @@ -83,11 +83,13 @@ static void msg_dump_queue(void) #endif } +#if 0 static void msg_dump(struct hotplug_msg *msg) { dbg("sequence %d, '%s', '%s', '%s'", msg->seqnum, msg->action, msg->devpath, msg->subsystem); } +#endif static struct hotplug_msg *msg_create(void) { -- cgit v1.2.3-54-g00ecf From dd785ba628d89ae2f67f2fac0f36d0d2393f4109 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 2 Apr 2004 20:10:35 -0800 Subject: [PATCH] handle netdev in udevruler Here we get the netdev handling for udevruler, after all information is available now in the udev database. It also fixes the way libsysfs is used. --- udevruler.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/udevruler.c b/udevruler.c index a13bd625a8..a065591cd1 100644 --- a/udevruler.c +++ b/udevruler.c @@ -222,6 +222,7 @@ static int add_all_attributes(const char *path, int level) } } + sysfs_close_directory(sysfs_dir); return 0; } @@ -229,7 +230,6 @@ static int get_all_attributes(char *path) { struct sysfs_class_device *class_dev; struct sysfs_class_device *class_dev_parent; - struct sysfs_attribute *attr; struct sysfs_device *sysfs_dev; struct sysfs_device *sysfs_dev_parent; char key[NAME_SIZE]; @@ -246,16 +246,6 @@ static int get_all_attributes(char *path) return -1; } - /* read the 'dev' file for major/minor*/ - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr == NULL) { - dbg("couldn't get the \"dev\" file"); - retval = -1; - goto exit; - } - - sysfs_close_attribute(attr); - /* open sysfs class device directory and get all attributes */ if (add_all_attributes(class_dev->path, level) != 0) { dbg("couldn't open class device directory"); @@ -266,11 +256,10 @@ static int get_all_attributes(char *path) /* get the device link (if parent exists look here) */ class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) { - //sysfs_close_class_device(class_dev); - class_dev = class_dev_parent; - } - sysfs_dev = sysfs_get_classdev_device(class_dev); + if (class_dev_parent != NULL) + sysfs_dev = sysfs_get_classdev_device(class_dev_parent); + else + sysfs_dev = sysfs_get_classdev_device(class_dev); /* look the device chain upwards */ while (sysfs_dev != NULL) { @@ -290,13 +279,11 @@ static int get_all_attributes(char *path) if (sysfs_dev_parent == NULL) break; - //sysfs_close_device(sysfs_dev); sysfs_dev = sysfs_dev_parent; } - sysfs_close_device(sysfs_dev); exit: - //sysfs_close_class_device(class_dev); + sysfs_close_class_device(class_dev); return retval; } @@ -403,7 +390,7 @@ int main(int argc, char *argv[]) { int i; int numitems; struct attribute **selattr; - char text_rule[80]; + char text_rule[255]; answer = newtRunForm(form); if (answer == quit) -- cgit v1.2.3-54-g00ecf From b6bf0b123635cb0902a95d9d6d4584edef43ed19 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 2 Apr 2004 20:10:37 -0800 Subject: [PATCH] switch udevd's msg_dump() to #define Here we switch the msg_dump() to #define instead of commenting it out. --- udevd.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/udevd.c b/udevd.c index 1bbb0a98e7..b2cb62f386 100644 --- a/udevd.c +++ b/udevd.c @@ -73,6 +73,10 @@ void log_message (int level, const char *format, ...) } #endif +#define msg_dump(msg) \ + dbg("msg_dump: sequence %d, '%s', '%s', '%s'", \ + msg->seqnum, msg->action, msg->devpath, msg->subsystem); + static void msg_dump_queue(void) { #ifdef DEBUG @@ -83,14 +87,6 @@ static void msg_dump_queue(void) #endif } -#if 0 -static void msg_dump(struct hotplug_msg *msg) -{ - dbg("sequence %d, '%s', '%s', '%s'", - msg->seqnum, msg->action, msg->devpath, msg->subsystem); -} -#endif - static struct hotplug_msg *msg_create(void) { struct hotplug_msg *new_msg; -- cgit v1.2.3-54-g00ecf From 49747bdc374d6f98846e86d57016d8009aacb1cb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 2 Apr 2004 22:16:38 -0800 Subject: [PATCH] tweak node unlink handling Based on a patch from Olaf Hering we remove the node now only if the requested dev_t is different from the already existing node, so any run of udevstart should preserve the inode number of the node file. syslog while the right node is already there: creating device node '/udev/hda' make_node: preserve file '/udev/hda', cause it has correct dev_t make_node: chmod(/udev/hda, 060600) syslog for wrong file already there: creating device node '/udev/hda' make_node: already present file '/udev/hda' unlinked make_node: chmod(/udev/hda, 060600) syslog for directory with same name already there: creating device node '/udev/hda' make_node: unlink(/udev/hda) failed with error '21' --- udev-add.c | 62 +++++++++++++++++++++++++++++--------------------------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/udev-add.c b/udev-add.c index 20599822d3..5dc46cf2a7 100644 --- a/udev-add.c +++ b/udev-add.c @@ -105,29 +105,46 @@ static int create_path(char *file) return 0; } -static int make_node(char *filename, int major, int minor, unsigned int mode, uid_t uid, gid_t gid) +static int make_node(char *file, int major, int minor, unsigned int mode, uid_t uid, gid_t gid) { - int retval; + struct stat stats; + int retval = 0; + + if (stat(file, &stats) != 0) + goto create; + + /* preserve node with already correct numbers, to not change the inode number */ + if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) && + (stats.st_rdev == makedev(major, minor))) { + dbg("preserve file '%s', cause it has correct dev_t", file); + goto perms; + } + + if (unlink(file) != 0) + dbg("unlink(%s) failed with error '%s'", file, strerror(errno)); + else + dbg("already present file '%s' unlinked", file); - retval = mknod(filename, mode, makedev(major, minor)); +create: + retval = mknod(file, mode, makedev(major, minor)); if (retval != 0) { dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", - filename, mode, major, minor, strerror(errno)); + file, mode, major, minor, strerror(errno)); goto exit; } - dbg("chmod(%s, %#o)", filename, mode); - if (chmod(filename, mode) != 0) { - dbg("chmod(%s, %#o) failed with error '%s'", - filename, mode, strerror(errno)); +perms: + dbg("chmod(%s, %#o)", file, mode); + if (chmod(file, mode) != 0) { + dbg("chmod(%s, %#o) failed with error '%s'", file, mode, strerror(errno)); goto exit; } if (uid != 0 || gid != 0) { - dbg("chown(%s, %u, %u)", filename, uid, gid); - if (chown(filename, uid, gid) != 0) { + dbg("chown(%s, %u, %u)", file, uid, gid); + if (chown(file, uid, gid) != 0) { dbg("chown(%s, %u, %u) failed with error '%s'", - filename, uid, gid, strerror(errno)); + file, uid, gid, strerror(errno)); goto exit; } } @@ -167,23 +184,6 @@ static void set_to_local_user(char *user) endutent(); } -static int unlink_entry(char *filename) -{ - struct stat stats; - int retval = 0; - - if (lstat(filename, &stats) == 0) { - if ((stats.st_mode & S_IFMT) != S_IFDIR) { - retval = unlink(filename); - if (retval) { - dbg("unlink(%s) failed with error '%s'", - filename, strerror(errno)); - } - } - } - return retval; -} - static int create_node(struct udevice *dev, int fake) { char filename[NAME_SIZE]; @@ -253,7 +253,6 @@ static int create_node(struct udevice *dev, int fake) } if (!fake) { - unlink_entry(filename); info("creating device node '%s'", filename); if (make_node(filename, dev->major, dev->minor, dev->mode, uid, gid) != 0) goto error; @@ -270,7 +269,6 @@ static int create_node(struct udevice *dev, int fake) for (i = 1; i <= dev->partitions; i++) { strfieldcpy(partitionname, filename); strintcat(partitionname, i); - unlink_entry(partitionname); make_node(partitionname, dev->major, dev->minor + i, dev->mode, uid, gid); } @@ -304,11 +302,9 @@ static int create_node(struct udevice *dev, int fake) strfieldcat(linktarget, &dev->name[tail]); - if (!fake) - unlink_entry(filename); - dbg("symlink(%s, %s)", linktarget, filename); if (!fake) { + unlink(filename); if (symlink(linktarget, filename) != 0) dbg("symlink(%s, %s) failed with error '%s'", linktarget, filename, strerror(errno)); -- cgit v1.2.3-54-g00ecf From 1321258af575f1e704aedfb3b6ed8aa341632a50 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 2 Apr 2004 22:47:22 -0800 Subject: [PATCH] v024 release --- ChangeLog | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a9d4f94e06..abbab093bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,65 @@ +Summary of changes from v023 to v024 +============================================ + +: + o Add README for chassis_id + o Add chassis_id program to extras directory + +: + o udevd race conditions and performance, assorted cleanups + +: + o fix SEGV in libsysfs/dlist.c + +: + o add OSDL documentation for persistent naming + +: + o small ide-devfs.sh fix + +Greg Kroah-Hartman: + o remove compiler warning from udevd.c + o only generate udev.8 on the fly, not all other man pages + o update bk ignore list some more + o update bk ignore list + o switch to generate the man pages during the normal build, not during the install + o convert udev.8.in to use @udevdir@ macro for make install + o first step of making man pages dynamically generated + o add install and uninstall the etc/dev.d/net/hotplug.dev file to the Makefile + o tweak net_test a bit + o fix some segfaults when running udevtest for network devices + o make a net_test test script using udevtest + o handle the subsytem if provided in udevtest + o add hotplug.dev script to handle renamed network devices + o add a bunch of network class devices to the test sysfs tree + o add udevruler to the bk ignore list + o update RFC-dev.d docs due to DEVNODE to DEVNAME change + o clean up chassis_id coding style + o clean up the OSDL document formatting a bit + o add netlink rules to devfs and gentoo rules files + o added USB device rules to rules files + o clean up the gentoo rules file a bit more, adding dri rules + o fix up udev.rules to handle oss rules better + o 023_bk mark + o fix udev.spec file for where udevtest should be placed + +Kay Sievers: + o tweak node unlink handling + o switch udevd's msg_dump() to #define + o handle netdev in udevruler + o man page cleanup + o put config info in db for netdev + o increase udevd event timeout + o udevstart fix + o put netdev handling and dev.d/ in manpages + o DEVPATH for netdev + o netdev - udevdb+dev.d changes + o udevd race conditions and performance, assorted cleanups - take 2 + o udevinfo patch + o dev_d.c file sorting and cleanup + o apply all_partitions rule to main block device only + + Summary of changes from v022 to v023 ============================================ diff --git a/Makefile b/Makefile index 4c194cd0fc..85620779ac 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 023_bk +VERSION = 024 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 1df59ecdb8..cacaf2868a 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 023_bk +Version: 024 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 4b06c852cb7da274b50f665a75367f901d8064ae Mon Sep 17 00:00:00 2001 From: "sjoerd@spring.luon.net" Date: Thu, 8 Apr 2004 18:48:56 -0700 Subject: [PATCH] DEVNODE -> DEVNAME transition fixes It seems that the transition from DEVNODE to DEVNAME wasn't done everywhere. This broke udev_dbus for me. Attached patch does the transition in the places it wasn't done yet. --- dev_d.c | 4 ++-- extras/dbus/udev_dbus.c | 24 ++++++++++++------------ extras/selinux/udev_selinux.c | 10 +++++----- udev_lib.c | 12 ++++++------ udev_lib.h | 2 +- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/dev_d.c b/dev_d.c index 483ceb4b1b..81c7013315 100644 --- a/dev_d.c +++ b/dev_d.c @@ -11,8 +11,8 @@ /* * This essentially emulates the following shell script logic in C: * DIR="/etc/dev.d" - * export DEVNODE="whatever_dev_name_udev_just_gave" - * for I in "${DIR}/$DEVNODE/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do + * export DEVNAME="whatever_dev_name_udev_just_gave" + * for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do * if [ -f $I ]; then $I $1 ; fi * done * exit 1; diff --git a/extras/dbus/udev_dbus.c b/extras/dbus/udev_dbus.c index 955a3dbb49..e99e92ec87 100644 --- a/extras/dbus/udev_dbus.c +++ b/extras/dbus/udev_dbus.c @@ -80,10 +80,10 @@ static void sysbus_connect(void) /** Send out a signal that a device node is created * - * @param devnode name of the device node, e.g. /dev/sda1 + * @param devname name of the device node, e.g. /dev/sda1 * @param path Sysfs path of device */ -static void sysbus_send_create(const char *devnode, const char *path) +static void sysbus_send_create(const char *devname, const char *path) { DBusMessage* message; DBusMessageIter iter; @@ -94,7 +94,7 @@ static void sysbus_send_create(const char *devnode, const char *path) "NodeCreated"); dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, devnode); + dbus_message_iter_append_string(&iter, devname); dbus_message_iter_append_string(&iter, path); if ( !dbus_connection_send(sysbus_connection, message, NULL) ) @@ -107,10 +107,10 @@ static void sysbus_send_create(const char *devnode, const char *path) /** Send out a signal that a device node is deleted * - * @param devnode Name of the device node, e.g. /udev/sda1 + * @param devname Name of the device node, e.g. /udev/sda1 * @param path Sysfs path of device */ -static void sysbus_send_remove(const char *devnode, const char *path) +static void sysbus_send_remove(const char *devname, const char *path) { DBusMessage* message; DBusMessageIter iter; @@ -121,7 +121,7 @@ static void sysbus_send_remove(const char *devnode, const char *path) "NodeDeleted"); dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, devnode); + dbus_message_iter_append_string(&iter, devname); dbus_message_iter_append_string(&iter, path); if ( !dbus_connection_send(sysbus_connection, message, NULL) ) @@ -136,7 +136,7 @@ int main(int argc, char *argv[], char *envp[]) { char *action; char *devpath; - char *devnode; + char *devname; int retval = 0; init_logging("udev_dbus"); @@ -155,17 +155,17 @@ int main(int argc, char *argv[], char *envp[]) dbg("no devpath?"); goto exit; } - devnode = get_devnode(); - if (!devnode) { - dbg("no devnode?"); + devname = get_devname(); + if (!devname) { + dbg("no devname?"); goto exit; } if (strcmp(action, "add") == 0) { - sysbus_send_create(devnode, devpath); + sysbus_send_create(devname, devpath); } else { if (strcmp(action, "remove") == 0) { - sysbus_send_remove(devnode, devpath); + sysbus_send_remove(devname, devpath); } else { dbg("unknown action '%s'", action); retval = -EINVAL; diff --git a/extras/selinux/udev_selinux.c b/extras/selinux/udev_selinux.c index bbbdd6ba53..df23d9e6a7 100644 --- a/extras/selinux/udev_selinux.c +++ b/extras/selinux/udev_selinux.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[], char *envp[]) { char *action; char *devpath; - char *devnode; + char *devname; int retval = 0; init_logging("udev_selinux"); @@ -58,14 +58,14 @@ int main(int argc, char *argv[], char *envp[]) dbg("no action?"); goto exit; } - devnode = get_devnode(); - if (!devnode) { - dbg("no devnode?"); + devname = get_devname(); + if (!devname) { + dbg("no devname?"); goto exit; } if (strcmp(action, "add") == 0) - selinux_add_node(devnode); + selinux_add_node(devname); exit: return retval; diff --git a/udev_lib.c b/udev_lib.c index db1096ebf7..381492db01 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -58,15 +58,15 @@ char *get_devpath(void) return devpath; } -char *get_devnode(void) +char *get_devname(void) { - char *devnode; + char *devname; - devnode = getenv("DEVNODE"); - if (devnode != NULL && strlen(devnode) > NAME_SIZE) - devnode[NAME_SIZE-1] = '\0'; + devname = getenv("DEVNAME"); + if (devname != NULL && strlen(devname) > NAME_SIZE) + devname[NAME_SIZE-1] = '\0'; - return devnode; + return devname; } char *get_seqnum(void) diff --git a/udev_lib.h b/udev_lib.h index e412ba96f4..cc264fa9b4 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -68,7 +68,7 @@ do { \ extern char *get_action(void); extern char *get_devpath(void); -extern char *get_devnode(void); +extern char *get_devname(void); extern char *get_seqnum(void); extern char *get_subsystem(char *subsystem); extern char get_device_type(const char *path, const char *subsystem); -- cgit v1.2.3-54-g00ecf From a41de03083de75a972ee48dbe2c8c03f5d73cf57 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 8 Apr 2004 18:49:27 -0700 Subject: [PATCH] fix devpath for netdev Fix the devpath string for unhandled netdev's. --- udev-add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev-add.c b/udev-add.c index 5dc46cf2a7..900e4795aa 100644 --- a/udev-add.c +++ b/udev-add.c @@ -453,6 +453,7 @@ int udev_add_device(char *path, char *subsystem, int fake) break; case 'n': + strfieldcpy(devpath, path); if (strcmp(dev.name, dev.kernel_name) != 0) { retval = rename_net_if(&dev, fake); if (retval != 0) @@ -460,7 +461,6 @@ int udev_add_device(char *path, char *subsystem, int fake) /* netif's are keyed with the configured name, cause * the original kernel name sleeps with the fishes */ - strfieldcpy(devpath, path); pos = strrchr(devpath, '/'); if (pos != NULL) { pos[1] = '\0'; -- cgit v1.2.3-54-g00ecf From 0e404ee1efdb941d1c287434abe1e56f571dc7ba Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 8 Apr 2004 21:51:47 -0700 Subject: [PATCH] added a dev.d alsa script to help people out. Originally by Marco d'Itri --- etc/dev.d/snd/controlC0/alsa.dev | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 etc/dev.d/snd/controlC0/alsa.dev diff --git a/etc/dev.d/snd/controlC0/alsa.dev b/etc/dev.d/snd/controlC0/alsa.dev new file mode 100644 index 0000000000..642dde4f36 --- /dev/null +++ b/etc/dev.d/snd/controlC0/alsa.dev @@ -0,0 +1,2 @@ +#!/bin/sh -e +exec /usr/sbin/alsactl restore 0 -- cgit v1.2.3-54-g00ecf From a04913b56858448ed42724ab7d544f70289bb2bf Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 13 Apr 2004 00:43:14 -0700 Subject: [PATCH] added rules for CAPI devices. Thanks to Marcel Holtmann for the information. --- etc/udev/udev.rules | 4 ++++ etc/udev/udev.rules.gentoo | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index dd934df850..27a11ae900 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -34,3 +34,7 @@ KERNEL="hiddev*", NAME="usb/%k" KERNEL="auer*", NAME="usb/%k" KERNEL="legousbtower*", NAME="usb/%k" KERNEL="dabusb*", NAME="usb/%k" + +# CAPI devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi*", NAME="capi/%n" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 28e92aab1b..da41b3e2e5 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -119,3 +119,7 @@ KERNEL="route6", NAME="netlink/%k" KERNEL="ip6_fw", NAME="netlink/%k" KERNEL="dnrtmsg", NAME="netlink/%k" KERNEL="tap*", NAME="netlink/%k" + +# CAPI devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi*", NAME="capi/%n" -- cgit v1.2.3-54-g00ecf From e3f83d532e2e7415c003e2759750c96ecb635e81 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 13 Apr 2004 01:19:41 -0700 Subject: [PATCH] added rule to put USB printers in their proper places. Thanks to Dan Weber for the info. --- etc/udev/udev.rules | 1 + etc/udev/udev.rules.devfs | 1 + etc/udev/udev.rules.gentoo | 1 + 3 files changed, 3 insertions(+) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index 27a11ae900..ef61eafb8d 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -34,6 +34,7 @@ KERNEL="hiddev*", NAME="usb/%k" KERNEL="auer*", NAME="usb/%k" KERNEL="legousbtower*", NAME="usb/%k" KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" # CAPI devices KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index f7903a0d23..3934fc6984 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -78,6 +78,7 @@ KERNEL="hiddev*", NAME="usb/%k" KERNEL="auer*", NAME="usb/%k" KERNEL="legousbtower*", NAME="usb/%k" KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" # netlink devices KERNEL="route", NAME="netlink/%k" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index da41b3e2e5..ab6f3bd405 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -105,6 +105,7 @@ KERNEL="hiddev*", NAME="usb/%k" KERNEL="auer*", NAME="usb/%k" KERNEL="legousbtower*", NAME="usb/%k" KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" # netlink devices KERNEL="route", NAME="netlink/%k" -- cgit v1.2.3-54-g00ecf From eab52c24431b4305708a7579a823585555b8f33b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 13 Apr 2004 01:21:46 -0700 Subject: [PATCH] udev_dbus changes On Sun, Apr 11, 2004 at 03:51:07AM +0200, Kay Sievers wrote: > Here we change extras/dbus/* to > o install the binary in /etc/dev.d > o append .dev to the binary > o add David's copyright > o add the listener script to watch the sent dbus messages > o removed the undefined udev_log variable > o switch printf() to dbg() Here we install the binary in /usr/sbin/ and symlink it to /etc/dev.d/ with the .dev suffix. --- extras/dbus/Makefile | 7 ++++++- extras/dbus/dbus-listen-test.py | 26 ++++++++++++++++++++++++ extras/dbus/udev_dbus.c | 45 ++++++++++++++++++++++++++++------------- 3 files changed, 63 insertions(+), 15 deletions(-) create mode 100644 extras/dbus/dbus-listen-test.py diff --git a/extras/dbus/Makefile b/extras/dbus/Makefile index 99aa33d8fb..04f17605e8 100644 --- a/extras/dbus/Makefile +++ b/extras/dbus/Makefile @@ -22,8 +22,9 @@ exec_prefix = ${prefix} etcdir = ${prefix}/etc sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -hotplugdir = ${etcdir}/hotplug.d/default +devddir = ${etcdir}/dev.d/default dbusdir = ${etcdir}/dbus-1/system.d configdir = ${etcdir}/udev/ initdir = ${etcdir}/init.d/ @@ -53,9 +54,13 @@ spotless: clean install-dbus-policy: $(INSTALL) -d $(DESTDIR)$(dbusdir) $(INSTALL_DATA) etc/dbus-1/system.d/udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(usrsbindir)/$(PROG) + - ln -s -f $(DESTDIR)$(usrsbindir)/$(PROG) $(DESTDIR)$(devddir)/$(PROG).dev uninstall-dbus-policy: - rm $(DESTDIR)$(dbusdir)/udev_sysbus_policy.conf + - rm $(DESTDIR)$(devddir)/$(PROG).dev + - rm $(DESTDIR)$(usrsbindir)/$(PROG) install: install-dbus-policy all diff --git a/extras/dbus/dbus-listen-test.py b/extras/dbus/dbus-listen-test.py new file mode 100644 index 0000000000..6a68b5d2aa --- /dev/null +++ b/extras/dbus/dbus-listen-test.py @@ -0,0 +1,26 @@ +#!/usr/bin/python + +# receives and prints the messages udev_dbus sent +# to the org.kernel.udev.NodeMonitor interface + +import dbus +import gtk + +def udev_signal_received(dbus_iface, member, service, object_path, message): + [filename, sysfs_path] = message.get_args_list() + if member=='NodeCreated': + print 'Node %s created for %s'%(filename, sysfs_path) + elif member=='NodeDeleted': + print 'Node %s deleted for %s'%(filename, sysfs_path) + +def main(): + bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) + bus.add_signal_receiver(udev_signal_received, + 'org.kernel.udev.NodeMonitor', # interface + 'org.kernel.udev', # service + '/org/kernel/udev/NodeMonitor') # object + gtk.mainloop() + +if __name__ == '__main__': + main() + diff --git a/extras/dbus/udev_dbus.c b/extras/dbus/udev_dbus.c index e99e92ec87..4852d429f8 100644 --- a/extras/dbus/udev_dbus.c +++ b/extras/dbus/udev_dbus.c @@ -1,3 +1,23 @@ +/* + * udev_dbus.c + * + * Copyright (C) 2003 David Zeuthen + * + * 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 02139, USA. + * + */ + #include #include #include @@ -18,21 +38,18 @@ void log_message(int level, const char *format, ...) { va_list args; - if (!udev_log) - return; - va_start(args, format); vsyslog(level, format, args); va_end(args); } #endif -/** variable for the connection the to system message bus or #NULL +/* Variable for the connection the to system message bus or NULL * if we cannot connect or acquire the org.kernel.udev service */ static DBusConnection* sysbus_connection; -/** Disconnect from the system message bus */ +/* Disconnect from the system message bus */ static void sysbus_disconnect(void) { if (sysbus_connection == NULL) @@ -42,7 +59,7 @@ static void sysbus_disconnect(void) sysbus_connection = NULL; } -/** Connect to the system message bus */ +/* Connect to the system message bus */ static void sysbus_connect(void) { DBusError error; @@ -70,18 +87,18 @@ static void sysbus_connect(void) dbus_bus_acquire_service(sysbus_connection, "org.kernel.udev", 0, &error); if (dbus_error_is_set(&error)) { - printf("cannot acquire org.kernel.udev service, error %s: %s'", - error.name, error.message); + dbg("cannot acquire org.kernel.udev service, error %s: %s'", + error.name, error.message); sysbus_disconnect(); return; } } -/** Send out a signal that a device node is created +/* Send out a signal that a device node is created * - * @param devname name of the device node, e.g. /dev/sda1 - * @param path Sysfs path of device + * @param devname Name of the device node, e.g. /dev/sda1 + * @param path Sysfs path of device */ static void sysbus_send_create(const char *devname, const char *path) { @@ -105,10 +122,10 @@ static void sysbus_send_create(const char *devname, const char *path) dbus_connection_flush(sysbus_connection); } -/** Send out a signal that a device node is deleted +/* Send out a signal that a device node is deleted * - * @param devname Name of the device node, e.g. /udev/sda1 - * @param path Sysfs path of device + * @param devname Name of the device node, e.g. /udev/sda1 + * @param path Sysfs path of device */ static void sysbus_send_remove(const char *devname, const char *path) { -- cgit v1.2.3-54-g00ecf From b1ea9f3ef5aad038b4d31cb3e79749de9afb41f8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 13 Apr 2004 01:28:05 -0700 Subject: [PATCH] added execelent "writing udev rules" document from Daniel Drake --- docs/writing_udev_rules/index.html | 408 +++++++++++++++++++++++++++++++++++++ 1 file changed, 408 insertions(+) create mode 100644 docs/writing_udev_rules/index.html diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html new file mode 100644 index 0000000000..0e4d54cfaf --- /dev/null +++ b/docs/writing_udev_rules/index.html @@ -0,0 +1,408 @@ + + +Writing udev rules [reactivated.net] + + + + + +

Writing udev rules

+by Daniel Drake (dsd)
+Version 0.51

+ +The most recent version of this document can always be found at:
+http://www.reactivated.net/udevrules.php + +

Contents

+
    +
  1. About this document
  2. +
  3. History
  4. +
  5. Software versions used at time of writing
  6. +
  7. Terminology: devfs, sysfs, nodes, etc.
  8. + +
  9. Why? (The purpose of this document)
  10. +
  11. The basics of writing rules
  12. +
  13. Additional automated customisation for NAME and SYMLINK parameters
  14. +
  15. Using regular expressions and wildcards in keys
  16. +
  17. Key-writing basics
  18. +
  19. Identifying devices through basic keys
  20. +
  21. Identifying devices through SYSFS files
  22. +
  23. Example: Writing a rule for my USB printer
  24. +
  25. Example: Writing a rule for my USB-Storage digital camera
  26. + +
  27. Additional notes on writing rules for USB storage
  28. +
  29. Example: Writing convenience rules for my CD drives
  30. +
  31. Tips for finding the appropriate places in SYSFS
  32. +
  33. udev vs Nvidia's graphics drivers
  34. +
  35. Author and credits
  36. +
+ + +

About this document

+udev is targetted at Linux kernels 2.6 and beyond to provide a userspace solution for a dynamic /dev directory, with persistant device naming. The previous /dev implementation, devfs, is now deprecated, and udev is seen as the successor. udev vs devfs is a sensitive area of conversation - you should read this document before making comparisons.

+ +udev is a well thought out solution, but I was initially very confused how I might customise it for my system. This document attempts to make the process of rule writing a little bit clearer.

+ +I'm all open to feedback - please contact me with any comments, problems, and suggested improvements.

+ +This document assumes that you have udev/hotplug installed and running OK with default configurations. If you do not yet have udev configured and running, I would suggest that you follow Decibels udev Primer to get to this stage (contains some Gentoo Linux specifics, but should be useful for other distro's too).

+ + + +

History

+ +April 6th 2004: I now write suggest users to use their own "local.rules" file rather than prepending "udev.rules".

+ +April 3rd 2004: Minor cleanups and preparations for possible inclusion in the udev distribution.

+February 15th 2004: Initial publication.

+February 18th 2004: Fixed a small omission in an example. Updated section on identifying mass-storage devices. Updated section on nvidia.

+February 23rd 2004: Rewrote some parts to emphasise how sysfs naming works, and how it can be matched. Updated rule-writing parts to represent udev 018s new SYSFS{filename} naming scheme. Improved sectioning, and clarified many points. Added info about KDE.

+March 20th 2004: General improvements, clarifications, and cleanups. Added more information about writing rules for usb-storage.

+ + +

Software versions used at time of writing

+Linux Kernel 2.6.5-rc3
+ +udev 024
+hotplug 20040401

+ + +

Terminology: devfs, sysfs, nodes, etc.

+A basic introduction only, might not be totally accurate.

+ +On typical linux-based systems, the /dev directory is used to store file-like device nodes which refer to certain devices in the system. Each node points to a part of the system (a device), which might or might not exist. Userspace applications can use these device nodes to interface with the systems hardware, for example, XFree86 will "listen to" /dev/input/mice so that it can relate the users mouse movements to moving the visual mouse pointer.

+ +The original /dev directories were just populated with every device that might possibly appear in the system. /dev directories were typically very large because of this. devfs came along to provide a more managable approach (noticably, it only populated /dev with hardware that is plugged into the system), as well as some other functionality, but the system proved to have problems which could not be easily fixed.

+ +udev is the "new" way of managing /dev directories, designed to clear up some issues with previous /dev implementations, and provide a robust path forward. In order to create and name /dev device nodes corresponding to devices that are present in the system, udev relies on matching information provided by sysfs with rules provided by the user. This documentation aims to detail the process of rule-writing, one of the only udev-related tasks that must (optionally) be performed by the user.

+ +sysfs is a new filesystem to the 2.6 kernels. It is managed by the kernel, and exports basic information about the devices currently plugged into your system. udev can use this information to create device nodes corresponding to your hardware. sysfs is mounted at /sys and is browsable. You may wish to investigate some of the files stored there before getting to grips with udev. Throughout this document, I will use the terms /sys and SYSFS interchangeably.


+ + +

Why?

+ +As stated above, writing rules for udev is an optional process. By default, you can plug a device in, and the a relevant node (e.g. /dev/sda for a mass-storage device) will be there, just like in previous /dev implementations.

+ +However, udev allows you to customise the naming of device nodes. There are two reasons why you might want to do this: convenience, and persistant naming.

+ +Take the example of using udev, so that when your printer is plugged in, it gets named as /dev/printer and also as the usual /dev/lp0. It's not only convenience (e.g. reading and interpreting "printer" as opposed to "lp0"), its a solution for non-persistant naming. Say that I have two printers - a HP laser printer and an Epson inkjet. When they are both plugged in and on, I have /dev/lp0 and /dev/lp1.
+ +How do I know which node refers to which printer? There is no easy way. The first printer that got connected was assigned name "lp0", and the second "lp1". Plugging in my printers in a different order would swap the names here, and that would mess up my scripts that always expect my HP laser printer to be lp1.

+ +However, if my HP laser printer got named lp_hp (as well as lpX) and my other printer got named lp_epson (as well as lpY), then my scripts could just refer to those names. udev magic can control this and ensure that these persistant names always point to the device that I intended.

+ +For external mass-storage devices (e.g. usb hard disks), persistant naming is very helpful in that it allows you to hardcode accurate device paths into your /etc/fstab.

+ + +

The basics of writing rules

+ +When populating /dev, udev decides which nodes to include, and how to name them, by reading a rules file. The default rules file includes some examples, and defaults to giving a devfs-style layout. The examples may safely be removed, but it is generally sensible to keep the devfs rules and simply make your own amendments and modifications.

+ +Default udev rules are stored in /etc/udev/udev.rules. You may find it interesting to look over this file - it includes a few examples, and then some default rules proving a devfs-style /dev layout. However, you should not write rules into this file directly, to reduce hassle while updating your udev installation in the future.

+ +Files in /etc/udev are parsed in lexical order. udev will stop processing rules as soon as it finds a matching rule in a file for the new item of hardware that has been detected. It is important that your own rules get processed before the udev defaults, otherwise your own naming schemes will not take effect! I suggest that you keep your own rules in a file at /etc/udev/local.rules (this doesn't exist by default - create it). As L comes before U, you know that your rules will be looked at first.

+ +As your own rules will effectively mask out the udev defaults which create the base /dev layout, it is recommended that you also specify devfs-style names/symlinks for the rules you write, so that you get the sensible defaults plus your own names.

+ +In rule files, lines starting with a "#" are treated as comments. Every uncommented line in the file corresponds to a rule.

+ +The basic form for a rule is: +
key,[key,...] name [, symlink]
+ +
    +
  1. At least one key must be specified. Keys are used to identify which devices the rule matches.
  2. +
  3. The name parameter is required. It tells udev what that device should be named as in the /dev tree. It is written in the format NAME="X", where X is what the node will be named. You can specify multiple symlinks here, seperate them with a space.
  4. +
  5. The symlink parameter (optional) allows for you to specify additional places where this node will be linked.
  6. +
+ +Remember that udev will only create one node for one device. If you want it to be accessible through multiple nodes, then you have to specify the other nodes in the SYMLINK parameter.

+ +I'll take a slightly modified udev example rule to illustrate this: +
BUS="usb", SYSFS{serial}="HXOLL0012202323480", NAME="lp_epson", SYMLINK="printers/epson_stylus"
+ +The keys here are the BUS and SYSFS{serial} parameters. udev will match this rule against a device that is connected through the USB bus and with a serial number of HXOLL0012202323480. Note that all (as opposed to any) specified keys must be matched for udev to use the rule to name a device.
+ +udev will name this node lp_epson, and it will be located at /dev/lp_epson.
+udev will also create a symlink to /dev/lp_epson, located at /dev/printers/epson_stylus (the printers directory will be automatically created). You can now print to your Epson printer by sending data to /dev/printers/epson_stylus or /dev/lp_epson.

+ + +

Additional automated customisation for NAME and SYMLINK parameters

+ +In the NAME and SYMLINK parameters of your rules, you are able to use basic operators to assist the naming of devices. Hackers will know this sort of thing as printf-like string substitution. + +There are a number of operators which can compose some or all of your NAME/SYMLINK parameters. These operators refer to kernel-data relating to the device. Take this example: + +
BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n"
+ +The %n operator will be replaced with the "kernel number" for the camera device, to produce a NAME such as camera0, camera1, etc.

+ +Another common operator is %k. This represents what the kernel would name the device, e.g. "hda1". You may often see rules which have NAME="%k" to produce the default names for the hardware. In these rules, customisation is usually done through the SYMLINK parameter.

+ +A full list of operators, with explanations, can be found in the udev man page.

+ + +

Using regular expressions and wildcards in keys

+ +You can use wildcards and basic regular-expression style matching to provide even more flexibility when writing keys. Taking a default udev rule: + +
KERNEL="ts*", NAME="input/%k"
+ +The * operator is used here, which matches literally anything - zero, one, or more characters of any kind. The rule literally says:
+ +
Match a device identified by a KERNEL name starting with the letters "ts" optionally followed by anything at all, and name it with the KERNEL name (%k) under the input directory.
+ +The ? operator is similar, and matches any single character (but not zero characters).

+ +You can also use square brackets [ ] to match any single character. Direct quote from udev man page:
+
For example, the pattern string "tty[SR]" would match either "ttyS" or "ttyR".
+ +You can also specify ranges that can be matched, e.g. [0-9] would match any single digit. Using an example rule from a default udev installation: + +
KERNEL="fd[0-9]*", NAME="floppy/%n"
+ +This rule says:
+ +
Match a device identified by a KERNEL name starting with the letters "fd", followed by any single digit, optionally followed by anything at all. Name the device with the kernel number of the device (%n) under the floppy directory.
+ +You can use these wildcards/regular-expression matches in any type of key, including both basic keys and sysfs-based identification (see below for explanations of these key types).

+ +I have purposely left out some information on this topic (particularly the flexibility of using [ ] operators) that is out of the scope of basic rule-writing documentation. More information on this topic can be found in the udev man page.

+ + +

Key-writing basics

+ +udev provides a few basic key matching methods, and also provides flexible ways of matching information in SYSFS. A typical rule will match both normal keys (e.g. BUS and KERNEL), as well as SYSFS keys to differentiate between different hardware plugged in throught the same port.

+ +You may be wondering, "How do I find the serial number of my printer? What is the model of my camera?". Rule writing isn't as hard as it sounds. The trickiest bit is finding your device in /sys, and deciding which info to use.

+ + +

Identifying devices through basic keys

+ +See the udev man page for more info on these keys.

+ +The valid keys are: +
  • BUS - match the bus type of the device.
  • +
  • KERNEL - match the kernel device name.
  • +
  • ID - match the device number on the bus (e.g. PCI bus ID).
  • +
  • PLACE - match the physical position where the device is plugged into (useful for USB).
  • + +
+ +The ID and PLACE keys do have their uses, but they are not commonly used in rules. This document focuses on using BUS and KERNEL keys, as well as SYSFS{...} keys (detailed in the next section). I will show how to use these keys by example.

+ +For extra flexibility, udev also provides keys to call external scripts and examine their result. This is out of scope of this document. Look at the udev man page for more details. + + +

Identifying devices through SYSFS files

+ +Background information: SYSFS stores many small files under a tree of directories which provide information about your hardware. One file typically contains just one "data item" - e.g. device name, manufacturer, or product ID.

+Note that SYSFS{...} keys can be combined with the basic keys described in the previous section.


+ +You can use keys in the format SYSFS{filename} to match specific info from SYSFS, where filename corresponds to a file in your SYSFS tree. For example, when my camera is connected, there is a file located at /sys/block/sda/device/model which contains "USB 2.0M DSC". To match this, I could use the following key: SYSFS{model} = "USB 2.0M DSC"

+ +Note that any file in sysfs can be matched in this manner, but if you match more than one file (through multiple keys), then you must only match files that exist in the same directory. Typically, there will be several directories giving information about one device. You cannot mix and match (as shown by example below).

+ +Luckily, the process of rule writing does not entail hunting through millions of files in SYSFS, the udevinfo utility does the hard work. This program is included in the udev distribution.

+ +The first thing you need to do is find a directory somewhere in /sys that corresponds to your hardware, and includes a file named "dev", as udevinfo can only work on directories of this type. These directories are all found under either /sys/block or /sys/class - there is no point looking anywhere else! However, udevinfo will follow links through this directory and read info found from other sections of sysfs.

+ +Once you have found a directory of this type, you can use the following command to assist you in the creation of writing keys for udev rules: +
# udevinfo -a -p /sys/path/to/hardware/info
+ +Some snipped output of the results of my "udevinfo -a -p /sys/block/sda" command is shown below, with colour added.
+ +

+follow the class device's "device"
+  looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3/3-3:1.0/host0/0:0:0:0':
+    BUS="scsi"
+    ID="0:0:0:0"
+    SYSFS{detach_state}="0"
+    SYSFS{type}="0"
+    SYSFS{max_sectors}="240"
+    SYSFS{device_blocked}="0"
+    SYSFS{queue_depth}="1"
+    SYSFS{scsi_level}="3"
+    SYSFS{vendor}="        "
+    SYSFS{model}="USB 2.0M DSC    "
+    SYSFS{rev}="1.00"
+    SYSFS{online}="1"
+
+  looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
+    BUS="usb"
+    ID="3-3"
+    SYSFS{detach_state}="0"
+    SYSFS{bNumInterfaces}=" 1"
+    SYSFS{bConfigurationValue}="1"
+    SYSFS{bmAttributes}="c0"
+    SYSFS{bMaxPower}="  0mA"
+    SYSFS{idVendor}="052b"
+    SYSFS{idProduct}="1514"
+    SYSFS{bcdDevice}="0100"
+    SYSFS{bDeviceClass}="00"
+    SYSFS{bDeviceSubClass}="00"
+    SYSFS{bDeviceProtocol}="00"
+    SYSFS{bNumConfigurations}="1"
+    SYSFS{speed}="12"
+    SYSFS{manufacturer}="Tekom Technologies, Inc"
+    SYSFS{product}="USB 2.0M DSC"
+
+ +The udevinfo tool provides a lot of information which you can simply copy-paste as udev rules. The reason that I have colour coded the above output is to point out that you generally cannot mix and match information from different parts of the udevinfo output. In the above output, I could not combine information from the different coloured sections - this is because each section of output refers to a different directory in SYSFS. For example, the following rule would not work: +
BUS="scsi", SYSFS{manufacturer}="Tekom Technologies, Inc", NAME="%k"
+This rule would not work because I am combining information found in the section beginning with BUS="scsi" (green) with information only found in the blue section. The rule would work if I used BUS="usb", sticking only to information found in the blue section above.

+ +You will notice that a lot of information is not relevant for writing basic rules (there is so much of it!), you should generally be looking for information that you recognise and know will not change (e.g. model name).

+ +Note that if you write your own rule to identify a device, the default devfs-style rules will not take effect! It is usually sensible to use NAME="%k" and specify your own extra names in the SYMLINK parameter so that you do not lose the default sensible names.

+ +I will show three examples of this rule writing based on udevinfo output process below. I will then attempt to list some device-dependant tips and tricks for locating the correct info.

+ +A reader wrote to me and informed me that he found KDE's control centre useful for writing rules. Apparently, information about USB devices (and others) can be found in the "Info Centre" section of the KDE Control Centre. This interface shows information such as serial number, vendor ID, etc. If you prefer a GUI-like approach, you might want to investigate this. + + +

Example: Writing a rule for my USB printer

+ +After plugging in my printer, I started looking around some /sys directories for a relevant place to start. I didn't get anywhere, but I noticed that my printer had been given device node /dev/lp0. I used this command sequence to find an answer: +
+# cd /sys
+# find | grep lp0
+./class/usb/lp0
+./class/usb/lp0/dev
+./class/usb/lp0/driver
+./class/usb/lp0/device
+
+ +Running "udevinfo -a -p /sys/class/usb/lp0" provided me with a heap of info, as usual. I picked out the relevant bits for unique device identification: +
+looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
+BUS="usb"
+SYSFS{manufacturer}="EPSON"
+SYSFS{product}="USB Printer"
+SYSFS{serial}="L72010011070626380"
+
+ +My udev rule becomes: +
BUS="usb", SYSFS{serial}="L72010011070626380", NAME="%k", SYMLINK="epson_680"
+ +And my printer nodes exist at /dev/lp0 (or /dev/lp1 if another printer was plugged in beforehand) and /dev/epson_680 always points at the device node for that particular printer.

+ + +

Example: Writing a rule for my USB-Storage digital camera

+ +Quick Intro: My camera identifies itself as an external SCSI hard disk (it uses the usb-storage driver which is also used by devices such as USB hard disks and flash-card readers). I can then mount the partition on that disk and copy images over. Not all cameras work like this - many require external software (e.g. gphoto2) to be able to access photos.

+ +This one is a bit tricky. Two nodes are created by default when my camera is connected : /dev/sda and /dev/sda1. sda1 is the node that I would like as my /dev/camera, as that is what gets mounted. The problem is that there are only small details which can be used as udev rules to show the difference between sda and sda1.

+ +As these nodes (sda, sda1) are treated as block devices, looking in /sys/block would be a good place to start.

+ +In my /sys/block, I have a directory named sda. In my /sys/block/sda, I have a directory named sda1. Both of these directories have dev files in, so they are OK for udev rules. Running the following dumps a lot of information about my camera and the USB ports it is connected through. + +
+# udevinfo -a -p /sys/block/sda
+# udevinfo -a -p /sys/block/sda/sda1
+
+ +The output of both of these command was almost identical, so that does not help in writing keys to differentiate between sda and sda1.
+ +To differentiate between sda and sda1, I decided that matching KERNEL names would be most appropriate here. Some examples of KERNEL names for this type of device are: sda, sda1, sdb, sdb1, sdc, ...

+ +udev's support for wildcards in key expressions comes in handy here. A key such as KERNEL="sd?1" would match KERNEL names such as "sda1", "sdb1", "sdc1", and equally importantly, it will not match KERNEL names such as sda, sdb (because the name must have a "1" on the end). The purpose of this key is to ignore the /dev/sda node. The device is a digital camera - I would not dream of fdisking it or anything like that, so this node is pretty useless to me. The key attempts to capture the /dev/sda1 node, which is mountable and therefore useful!

+ +In the udevinfo output, I also noticed this bit of useful and understandable information: +
SYSFS{product}="USB 2.0M DSC"
+ +So that gives me my rule. For completeness, I also include a BUS key (this was also found in the udevinfo output). +
BUS="usb", SYSFS{product}="USB 2.0M DSC", KERNEL="sd?1", NAME="%k", SYMLINK="camera"
+ +Now, when my camera is plugged in, it will be named /dev/sda1 (or, if sda1 isnt available, it might be called /dev/sdb1) and will always be correctly linked to from /dev/camera. The /dev/sda (or sdb) node still appears as normal, but the important thing is that my custom persistant "camera" symlink points to the mountable partition.

+ + +

Additional notes on writing rules for USB storage

+ +Carl Streeter, the owner of a large USB hard disk, wrote to me and explained that unlike in my digital camera example, the /dev/sda node is useful to him. He pointed out that he does occasionally need to use tools such as fdisk and hdparm on that node.

+ +Carl's rule is: +
BUS="usb", KERNEL="sd*", SYSFS{product}="USB 2.0 Storage Device", NAME="%k", SYMLINK="usbhd%n"
+ +This rule creates symlinks such as: +
    +
  • /dev/usbhdd - The fdiskable node
  • +
  • /dev/usbhdd1 - The first partition (mountable)
  • +
  • /dev/usbhdd2 - The second partition (mountable)
  • + +
+ +We agreed that depending on the situation and device in question, there are reasons for both wanting and not wanting the non-mountable /dev/sda node. Use whichever setup suits you best.

+ + +

Example: Writing convenience rules for my CD drives

+I have two CD drives in my PC - a DVD reader, and a CD rewriter. My DVD is hdc and my CDRW is hdd. I would not expect this to change, unless I manually changed the cabling of my system.

+ +Still, some people (myself included) like to have nodes such as /dev/dvd and /dev/cdrw for convenience. Since we know the "hdX" values for these drives, writing rules is simple. The examples below should be self explanatory. + + +
+BUS="ide", KERNEL="hdc", NAME="%k", SYMLINK="dvd cdroms/cdrom%n"
+BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n"
+
+ +You may have noticed that the default udev.rules file contains a rule which runs a script to produces names for block devices. Do not be confused by this - as usual, because your own rules in local.rules are processed before the default rules, the default rules will not be used when naming the hardware you have written rules for.

+ + +

Tips for finding the appropriate places in SYSFS

+I'm looking for some more device specific tips here. Please contact me with any you can provide. + +
    +
  • Always use udevinfo to assist the rule-writing process. Always use udevinfo to look under /sys/block or /sys/class (it will not start reading a chain from anywhere else).
  • +
  • If you get totally stuck, use the following command to find all "dev" files under /sys (udevinfo can work on directories containing this file): find /sys -iname dev
  • +
  • If your device is a flash-card reader, usb flash-drive, or digital camera that acts as usb-storage, that is created as /dev/sdX, then start looking in /sys/block/sdX.
  • +
  • If applicable, make sure you identify the difference between sdX and sdX1 in the above situation. This can be done with the key KERNEL="sd?1" to match sdX1, or KERNEL="sd?" to match sdX.
  • +
  • For USB printers that are created as /dev/lpX, then you should start looking in /sys/class/usb/lpX.
  • + +
  • The usb scanner driver has recently been removed from the kernel and re-implemented in userspace (as part of the SANE package). You do not (and can not) write rules for this hardware as it does not rely on specific kernel drivers.
  • +
  • Remember that unfortunately, the kernel does not export information for all devices into sysfs, meaning that you simply can't write rules for some devices yet. On 20/02/04, the udev author stated that there are 162 drivers left to convert to sysfs.
  • +
+ + +

udev vs Nvidia's graphics drivers

+ +This section isn't really relevant to the purpose of this document, but judging from the hits I get from google, this is a hot topic. I will leave it here for now.

+ +Nvidia's graphics drivers (the closed-source ones, not the ones that come with XFree) do not work with a default installation of udev - you are unable to start X. This is because the nvidia module is loaded by X, but the /dev/nvidia* nodes are not created quick enough, so X bails out.

+ +The solution to this problem is to autoload the nvidia module on bootup. Yes - you are *supposed* to do this - the NVidia FAQ confirms this! On devfs-based systems, devfs did this automatically at bootup anyway. Your linux distribution will have created a file which you can list modules to be loaded on bootup (e.g. /etc/modules.autoload.d/kernel-2.6 for Gentoo).

+ +This isn't all - you will also need to patch the nvidia kernel interface to export some basic info to SYSFS so that udev will create the devices. Martin Schlemmer has written a patch against the 1.0.5336 version of the nvidia drivers, which can be found here. The Gentoo package nvidia-kernel-1.0.5336-r1 contains this patch.

+ +Another solution is to simply create the nvidia specific nodes on bootup. X will then load the module when required, and as the nodes are already in existance, you will not run into the problem described above. Place these commands in a file that is automatically executed on bootup (e.g. /etc/conf.d/local.start for Gentoo): +
+mknod /dev/nvidia0 c 195 0
+mknod /dev/nvidiactl c 195 255
+
+ +You should now be able to get into X with no problems.

+ + +

Author and Credits

+This document is written by Daniel Drake <dan@reactivated.net>
+Please do not hesitate to send feedback!

+ +Additional thanks to: +
    +
  • The udev developers!
  • +
  • agrippa_cash (usb-storage info)
  • +
  • Carl Streeter (usb-storage info)
  • +
  • Decibels
  • +
  • Frank Pieczynski
  • +
  • Jim (KDE info)
  • +
  • Patrick Dreker
  • +
  • Tuna
  • +
  • Ueli Schlpfer
  • +
  • ...and anyone else who provided information or feedback
  • +
+ +

Copyright (C) 2003-2004 Daniel Drake
+This document is licensed under the GNU General Public License, Version 2. + + + \ No newline at end of file -- cgit v1.2.3-54-g00ecf From b86691919a5687c3749d8e3324dd3b8eae22a435 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 15 Apr 2004 23:14:49 -0700 Subject: [PATCH] Added expanded tests to the test framework from Leann Ogasawara --- test/udev-test.pl | 707 +++++++++++++++++++++++++++++++++++++++++--------- test/udev.permissions | 16 ++ 2 files changed, 604 insertions(+), 119 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 31bc990b81..ebd3c6a8a0 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -16,7 +16,12 @@ # # happy testing, # Kay Sievers , 2003 - +# +# Modified April 9, 2004 by Leann Ogasawara +# - expanded @tests array to add more symlinks and permissions tests +# - some of the symlinks tests also test lack of node creation +# - added symlink_test() function +# - moved permissions and major_minor tests into their own functions use warnings; use strict; @@ -304,24 +309,6 @@ EOF exp_name => "my-foo8" , conf => < "program result substitution (numbered part of)", - subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "link1" , - conf => < "program result substitution (numbered part of+)", - subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "link3" , - conf => < "symlink creation (same directory)", - subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor0" , - conf => < "symlink creation (relative link back)", - subsys => "block", - devpath => "/block/sda/sda2", - exp_name => "1/2/a/b/symlink" , - conf => < "symlink creation (relative link forward)", - subsys => "block", - devpath => "/block/sda/sda2", - exp_name => "1/2/symlink" , - conf => < "symlink creation (relative link back and forward)", - subsys => "block", - devpath => "/block/sda/sda2", - exp_name => "1/2/c/d/symlink" , - conf => < "multiple symlinks", - subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "second-0" , - conf => < "SYMLINK only rule", + desc => "permissions test", subsys => "block", devpath => "/block/sda", - exp_name => "symlink-only2", + exp_name => "node", + exp_perms => "5000::0444", conf => < "permissions test", + desc => "permissions ttyUSB0:root:uucp:0660", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => "0:14:0660", + conf => < "permissions tty0::root:0444", + subsys => "tty", + devpath => "/class/tty/tty0", + exp_name => "tty0", + exp_perms => "0:0:0444", + conf => < "permissions tty1:root::0555", + subsys => "tty", + devpath => "/class/tty/tty1", + exp_name => "tty1", + exp_perms => "0:0:0555", + conf => < "permissions tty2:::0777", + subsys => "tty", + devpath => "/class/tty/tty2", + exp_name => "tty2", + exp_perms => "0:0:0777", + conf => < "permissions tty3:::", + subsys => "tty", + devpath => "/class/tty/tty3", + exp_name => "tty3", + exp_perms => "0:0:0", + conf => < "permissions i2c-300:root:sys:0744", + subsys => "i2c-dev", + devpath => "/class/i2c-dev/i2c-300", + exp_name => "i2c-300", + exp_perms => "0:3:0744", + conf => < "permissions i2c-fake1:root:7:0007", + subsys => "i2c-dev", + devpath => "/class/i2c-dev/i2c-fake1", + exp_name => "i2c-fake1", + exp_perms => "0:7:0007", + conf => < "permissions ttyS[01]:0:5:0700", + subsys => "tty", + devpath => "/class/tty/ttyS1", + exp_name => "ttyS1", + exp_perms => "0:5:0700", + conf => < "permissions ttyS[4-9]:tty:5:0060", + subsys => "tty", + devpath => "/class/tty/ttyS7", + exp_name => "ttyS7", + exp_perms => "0:5:0060", + conf => < "permissions tty4:0:5:0707", + subsys => "ttyS4", + devpath => "/class/tty/tty4", + exp_name => "tty4", + exp_perms => "0:5:0707", + conf => < "permissions tty4?:0:5:0007", + subsys => "tty", + devpath => "/class/tty/tty44", + exp_name => "tty44", + exp_perms => "0:5:0007", + conf => < "permissions tty3[!3]:::0467", + subsys => "tty", + devpath => "/class/tty/tty35", + exp_name => "tty35", + exp_perms => "0:0:0467", + conf => < "permissions tty33:bad:name:0500", + subsys => "tty", + devpath => "/class/tty/tty33", + exp_name => "tty33", + exp_perms => "0:0:0500", + conf => < "permissions rtc:0:users:0600", + subsys => "misc", + devpath => "/class/misc/rtc", + exp_name => "misc/rtc", + exp_perms => "0:100:0600", + conf => < "permissions misc:0:users:0600", + subsys => "misc", + devpath => "/class/misc/psaux", + exp_name => "misc/psaux", + exp_perms => "0:100:0600", + conf => < "permissions set OWNER=5000", subsys => "block", devpath => "/block/sda", exp_name => "node", - exp_perms => "5000::0444", + exp_perms => "5000::0600", conf => < "permissions set GROUP=100", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + exp_perms => ":100:0600", + conf => < "permissions set mode=0777", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + exp_perms => "::0777", + conf => < "permissions set OWNER=5000 GROUP=100 MODE=0777", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + exp_perms => "5000:100:0777", + conf => < "permissions override OWNER to 5000", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => "5000:14:0660", + conf => < "permissions override GROUP to 100", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => ":100:0660", + conf => < "permissions override MODE to 0060", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => ":14:0060", + conf => < "permissions override OWNER, GROUP, MODE", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => "5000:100:0777", + conf => < "4094:89999", conf => < "symlink creation (same directory)", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "visor0", + exp_target => "ttyUSB0", + conf => < "symlink creation (relative link forward)", + subsys => "block", + devpath => "/block/sda/sda2", + exp_name => "1/2/symlink" , + exp_target => "a/b/node", + conf => < "symlink creation (relative link back and forward)", + subsys => "block", + devpath => "/block/sda/sda2", + exp_name => "1/2/c/d/symlink" , + exp_target => "../../a/b/node", + conf => < "multiple symlinks", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "second-0" , + exp_target => "visor" , + conf => < "symlink only rule", + subsys => "block", + devpath => "/block/sda", + exp_name => "symlink-only2", + exp_target => "link", + conf => < "symlink name empty", + subsys => "block", + devpath => "/block/sda", + exp_name => "", + exp_target => "link", + exp_error => "yes", + conf => < "symlink name '.'", + subsys => "block", + devpath => "/block/sda", + exp_name => ".", + exp_target => "link", + exp_error => "yes", + conf => < "symlink to empty name", + subsys => "block", + devpath => "/block/sda", + exp_name => "symlink", + exp_target => "", + exp_error => "yes", + conf => < "symlink and name empty", + subsys => "block", + devpath => "/block/sda", + exp_name => "", + exp_target => "", + exp_error => "yes", + conf => < "symlink node to itself", + subsys => "tty", + devpath => "/class/tty/tty0", + exp_name => "link", + exp_target => "link", + conf => < "symlink %n substitution", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "symlink0", + exp_target => "ttyUSB0", + conf => < "symlink %k substitution", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "symlink-ttyUSB0", + exp_target => "ttyUSB0", + conf => < "symlink %M:%m substitution", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "major-188:0", + exp_target => "ttyUSB0", + conf => < "symlink %b substitution", + subsys => "block", + devpath => "/block/sda", + exp_name => "symlink-0:0:0:0", + exp_target => "node", + conf => < "symlink %c substitution", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "test", + exp_target => "ttyUSB0", + conf => < "symlink %c{N} substitution", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "test", + exp_target => "ttyUSB0", + conf => < "symlink %c{N+} substitution", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "this", + exp_target => "ttyUSB0", + conf => < "symlink only rule with %c{N+}", + subsys => "block", + devpath => "/block/sda", + exp_name => "test", + exp_target => "link", + conf => < "symlink %s{filename} substitution", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "188:0", + exp_target => "ttyUSB0", + conf => < "symlink %Ns{filename} substitution", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "188", + exp_target => "ttyUSB0", + conf => < "symlink with '%' in name", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "percent%sign", + exp_target => "ttyUSB0", + conf => < "symlink with '%' in name", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "%ttyUSB0_name", + exp_target => "ttyUSB0", + conf => < "program result substitution (numbered part of)", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "link1", + exp_target => "node", + conf => < "program result substitution (numbered part of+)", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "link4", + exp_target => "node", + conf => <{exp_perms} =~ m/^(.*):(.*):(.*)$/; + if ($1 ne "") { + if ($uid != $1) { $wrong = 1; }; + } + if ($2 ne "") { + if ($gid != $2) { $wrong = 1; }; + } + if ($3 ne "") { + if (($mode & 07777) != oct($3)) { $wrong = 1; }; + } + if ($wrong == 0) { + print "permissions: ok "; + } else { + printf "expected permissions are: %i:%i:%#o\n", $1, $2, oct($3); + printf "created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; + $error++; + } +} + +sub major_minor_test { + my($config, $rdev) = @_; + + my $major = ($rdev >> 8) & 0xfff; + my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); + my $wrong = 0; + + $config->{exp_majorminor} =~ m/^(.*):(.*)$/; + if ($1 ne "") { + if ($major != $1) { $wrong = 1; }; + } + if ($2 ne "") { + if ($minor != $2) { $wrong = 1; }; + } + if ($wrong == 0) { + print "major:minor: ok "; + } else { + printf "expected major:minor is: %i:%i\n", $1, $2; + printf "created major:minor is : %i:%i\n", $major, $minor; + print "major:minor: error "; + $error++; + } +} + +sub symlink_test { + my ($config) = @_; + + my $output = `ls -l $PWD/$udev_root$config->{exp_name}`; + + if ($output =~ m/(.*)-> (.*)/) { + if ($2 eq $config->{exp_target}) { + print "symlink: ok "; + } else { + print "expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; + print "created symlink from: \'$config->{exp_name}\' to \'$2\'\n"; + if ($config->{exp_error}) { + print "as expected "; + } else { + $error++; + } + } + } else { + print "expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; + print "symlink: not created "; + if ($config->{exp_error}) { + print "as expected "; + } else { + $error++; + } + } +} + sub run_test { my ($config, $number) = @_; print "TEST $number: $config->{desc}\n"; - print "device \'$config->{devpath}\' expecting node \'$config->{exp_name}\'\n"; + + if ($config->{exp_target}) { + print "device \'$config->{devpath}\' expecting symlink '$config->{exp_name}' to node \'$config->{exp_target}\'\n"; + } else { + print "device \'$config->{devpath}\' expecting node \'$config->{exp_name}\'\n"; + } + udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); - if (-e "$PWD/$udev_root$config->{exp_name}") { + + if ((-e "$PWD/$udev_root$config->{exp_name}") || + (-l "$PWD/$udev_root$config->{exp_name}")) { my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$config->{exp_name}"); if (defined($config->{exp_perms})) { - my $wrong = 0; - $config->{exp_perms} =~ m/^(.*):(.*):(.*)$/; - if ($1 ne "") { - if ($uid != $1) { $wrong = 1; }; - } - if ($2 ne "") { - if ($gid != $2) { $wrong = 1; }; - } - if ($3 ne "") { - if (($mode & 07777) != oct($3)) { $wrong = 1; }; - } - if ($wrong == 0) { - print "permissions: ok "; - } else { - printf "expected permissions are: %i:%i:%#o\n", $1, $2, oct($3); - printf "created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; - $error++; - } + permissions_test($config, $uid, $gid, $mode); } - if (defined($config->{exp_majorminor})) { - my $major = ($rdev >> 8) & 0xfff; - my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); - - my $wrong = 0; - $config->{exp_majorminor} =~ m/^(.*):(.*)$/; - if ($1 ne "") { - if ($major != $1) { $wrong = 1; }; - } - if ($2 ne "") { - if ($minor != $2) { $wrong = 1; }; - } - if ($wrong == 0) { - print "major:minor: ok "; - } else { - printf "expected major:minor is: %i:%i\n", $1, $2; - printf "created major:minor is : %i:%i\n", $major, $minor; - $error++; - } + major_minor_test($config, $rdev); + } + if (defined($config->{exp_target})) { + symlink_test($config); } - print "add: ok "; } else { - print "add: error\n"; - system("tree $udev_root"); - print "\n"; - $error++; + print "add: error "; + if ($config->{exp_error}) { + print "as expected "; + } else { + print "\n\n"; + system("tree $udev_root"); + print "\n"; + $error++; + } } udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf}); if ((-e "$PWD/$udev_root$config->{exp_name}") || (-l "$PWD/$udev_root$config->{exp_name}")) { - print "remove: error\n\n"; - system("tree $udev_root"); - $error++; + print "remove: error "; + if ($config->{exp_error}) { + print "as expected\n\n"; + } else { + print "\n\n"; + system("tree $udev_root"); + print "\n"; + $error++; + } } else { print "remove: ok\n\n"; } diff --git a/test/udev.permissions b/test/udev.permissions index 44ef3d43e5..b7baeea7b4 100644 --- a/test/udev.permissions +++ b/test/udev.permissions @@ -4,3 +4,19 @@ ttyUSB1:root:uucp:0666 visor:500:500:0666 dsp1:::0666 boot_disk?:::0666 + +#used for permissions tests in udev-test.pl +tty0::root:0444 +tty1:root::0555 +tty2:::0777 +tty3::: +rtc:0:6:0770 +misc/*:0:users:0600 +i2c-fake1:root:7:0007 +i2c*:root:sys:0744 +ttyS[01]:0:5:0700 +ttyS[5-9]:root:5:0060 +tty4::tty:0707 +tty4?::tty:0007 +tty3[!3]:::0467 +tty33:bad:name:0500 -- cgit v1.2.3-54-g00ecf From 1352a36fbe768904cc76c44c81a8522a15782548 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 16 Apr 2004 19:34:01 -0700 Subject: [PATCH] Fix build process for users who have LC_ALL set to a non-english language. Many thanks to jack_mort for helping track this down. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 85620779ac..dd7de95dc3 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,7 @@ ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sp -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/powerpc/ppc/g'} # code taken from uClibc to determine the gcc include dir -GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} +GCCINCDIR := ${shell LC_ALL=C $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} # code taken from uClibc to determine the libgcc.a filename GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) -- cgit v1.2.3-54-g00ecf From af5b5178fa9cb8b75d00fb364f266c3919f12cd2 Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Fri, 16 Apr 2004 23:58:02 -0700 Subject: [PATCH] devfs.sh-ide-floppy --- extras/ide-devfs.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 22d09d7a5a..4d021c5e87 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -39,6 +39,8 @@ if [ -z "$3" -a -f /proc/ide/${1}/media ]; then MEDIA=`cat /proc/ide/${1}/media` if [ "${MEDIA}" = "cdrom" ]; then echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` + elif [ "${MEDIA}" = "floppy" ]; then + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc elif [ "${MEDIA}" = "disk" ]; then echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc fi -- cgit v1.2.3-54-g00ecf From 7d855c3116ec9ddab9adde96b568681930d9855b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 16 Apr 2004 23:58:05 -0700 Subject: [PATCH] udevd test script Thanks to Yin, Hu , who made a nice perl script to test the expected behavior of the udevd sequence number handling. The test sends different SEQNUM sequences to udevd, while analyzing the reordering and timeout handling of udevd. --- test/udevd-test/udev-log-amplify.pl | 87 +++++ test/udevd-test/udev-log-script.pl | 82 +++++ test/udevd-test/udevd-test.pl | 669 ++++++++++++++++++++++++++++++++++++ udevd.c | 10 +- 4 files changed, 847 insertions(+), 1 deletion(-) create mode 100644 test/udevd-test/udev-log-amplify.pl create mode 100644 test/udevd-test/udev-log-script.pl create mode 100644 test/udevd-test/udevd-test.pl diff --git a/test/udevd-test/udev-log-amplify.pl b/test/udevd-test/udev-log-amplify.pl new file mode 100644 index 0000000000..c2d4723974 --- /dev/null +++ b/test/udevd-test/udev-log-amplify.pl @@ -0,0 +1,87 @@ +#!/usr/bin/perl -w +# +# udev-log-amplify +# +# Copyright (C) Intel Corp, 2004 +# +# Author: Yin Hu +# +# This is a script for replacing udev binary during udevsend/udevd testing. +# It first amplifies the execution time ( sleep 5 ) and then logs the event +# information sent by udved in order that test script udevd-test.pl can +# analyze whether udved execute as we expected. +# You should not execute this script directly because it will be invoked by +# udevd automatically. +# +# Before you run your test please modify $log_file to designate where the udev +# log file should be placed, in fact, the default value is ok. +# +# +# 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 02139, USA. +# + +use warnings; +use strict; + +# modifiable settings +my $udev_exe_time = 5; +my $log_file = "/tmp/udev_log.txt"; + +# global variables +my $devpath; +my $action; +my $subsystem; + +# common functions +sub getDate { + # Get current date/time + # If we want GTM time, simply pass GMT as first argument to this function. + + my $format = @_; + my $date; + + if( $format =~ /GMT/i ) { + $date = gmtime() . " GMT"; + } else { + $date = localtime(); + } + return $date; +} + +# main program +if ($ARGV[0]) { + $subsystem = $ARGV[0]; + $devpath = $ENV{DEVPATH}; + $action = $ENV{ACTION}; + + # Get current system date + my $time = getDate(); + + # Logging + if (open(LOGF, ">>$log_file")) { + print LOGF "$devpath,$action,$subsystem,$time\n"; + } else { + print "File open failed. \n"; + exit 1; + } + close(LOGF); + + # Amplify the execution time of udev + sleep 5; + + exit 0; +} else { + print "Too less argument count.\n"; + exit 1; +} diff --git a/test/udevd-test/udev-log-script.pl b/test/udevd-test/udev-log-script.pl new file mode 100644 index 0000000000..5f4f8a4495 --- /dev/null +++ b/test/udevd-test/udev-log-script.pl @@ -0,0 +1,82 @@ +#!/usr/bin/perl -w +# +# udev-log-script +# +# Copyright (C) Intel Corp, 2004 +# +# Author: Yin Hu +# +# This is a script for replacing udev binary during udevsend/udevd testing. +# It just simply logs the event information sent by udved in order to +# test script udevd-test.pl can analyze whether udved execute as we expected. +# You should not execute this script directly because it will be invoked by +# udevd automatically. +# +# Before you run your test please modify $log_file to designate where the udev +# log file should be placed, in fact, the default value is ok. +# +# +# 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 02139, USA. +# + +use warnings; +use strict; + +# modifiable settings +my $log_file = "/tmp/udev_log.txt"; + +# global variables +my $devpath; +my $action; +my $subsystem; + +# common functions +sub getDate { + # Get current date/time + # If we want GTM time, simply pass GMT as first argument to this function. + my $format = @_; + my $date; + + if( $format =~ /GMT/i ) { + $date = gmtime() . " GMT"; + } else { + $date = localtime(); + } + return $date; +} + +# main program +if ($ARGV[0]) { + # prepare + $subsystem = $ARGV[0]; + $devpath = $ENV{DEVPATH}; + $action = $ENV{ACTION}; + + # Get current system date + my $time = getDate(); + + # Logging + if (open(LOGF, ">>$log_file")) { + print LOGF "$devpath,$action,$subsystem,$time\n"; + } else { + print "File open failed. \n"; + exit 1; + } + close(LOGF); + + exit 0; +} else { + print "Too less argument count.\n"; + exit 1; +} diff --git a/test/udevd-test/udevd-test.pl b/test/udevd-test/udevd-test.pl new file mode 100644 index 0000000000..060c3ec5f2 --- /dev/null +++ b/test/udevd-test/udevd-test.pl @@ -0,0 +1,669 @@ +#!/usr/bin/perl -w +# +# udevd-test +# +# Copyright (C) Intel Corp, 2004 +# +# Author: Yin Hu +# Kay Sievers +# +# Provides automated testing of the udevd binary.This test script is self-contained. +# Before you run this script please modify $sysfs to locate your sysfs filesystem, +# modify $udevd_bin to locate your udevsend binary, +# modify $udev_bin to locate dummy udev script, +# modify $udev_bin2 to locate another dummy udev script ( amplify the execution time for test), +# modify $log_file to locate where udev script have placed the log file, +# modify $time_out to decide the time out for events, +# modify $udev_exe_time to decide the execution time for dummy udev script. +# +# Detail information of each test case please refer to the header of corresponding +# test case function. +# +# +# 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 02139, USA. +# + +use warnings; +use strict; + +# modifiable settings +my $sysfs = "../sys"; +my $udevd_bin = "../../udevsend"; +my $udev_bin = "$ENV{PWD}/udev-log-script.pl"; +my $udev_bin2 = "$ENV{PWD}/udev-log-amplify.pl"; +my $log_file = "/tmp/udev_log.txt"; +my $time_out = 10; +my $udev_exe_time = 5; + +# global variables +my $test_case = 0; + +# common functions + +sub kill_daemon { + system("killall udevd"); + system("rm -f $log_file"); + sleep 1; +} + +sub udevsend { + # This function prepares corresponding environment variables + # and then call $udevd_bin to send event. + + my ($seqnum, $devpath, $action, $subsystem, $udev_bin_tmp) = @_; + + $ENV{DEVPATH} = $devpath; + $ENV{ACTION} = $action; + $udev_bin_tmp = $udev_bin if ( not $udev_bin_tmp ); + $ENV{UDEV_BIN} = $udev_bin_tmp; + if ( $seqnum != -1) { + $ENV{SEQNUM} = $seqnum; + } else { + delete $ENV{SEQNUM}; + } + + return system("$udevd_bin $subsystem"); +} + +sub getDate { + # Get current date function + # If we want GTM time, simply pass GMT as first argument to this function. + + my $format = @_; + my $date; + + if( $format =~ /GMT/i ) { + $date = gmtime() . " GMT"; + } else { + $date = localtime(); + } + + return $date; +} + +sub cmpDate { + # This function should return a difference betweent date1 and date2 + + my ($date1, $date2) = @_; + my @monList = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", + "Aug", "Sep", "Oct", "Nov", "Dec" ); + my ( $m1, $m2, $tmp ); + + $date1 =~ s/([\D]*)$//g; + $date2 =~ s/([\D]*)$//g; + + return if( (not $date1) or (not $date2) ); + + my $mon = 0; + + my ( @T1 ) = + ( $date1 =~ /([\d]+)[\s]+([\d]+):([\d]+):([\d]+)[\s]+([\d]+)/g ); + my ( @T2 ) = + ( $date2 =~ /([\d]+)[\s]+([\d]+):([\d]+):([\d]+)[\s]+([\d]+)/g ); + + foreach $tmp (@monList) { + $m1 = sprintf("%2.2d",$mon) if( $date1 =~ /$tmp/i ); + $m2 = sprintf("%2.2d",$mon) if( $date2 =~ /$tmp/i ); + $mon++; + } + + my $dt1 = sprintf("%4.4d%s%2.2d%2.2d%2.2d%2.2d", $T1[4], $m1, $T1[0], + $T1[1], $T1[2], $T1[3]); + my $dt2 = sprintf("%4.4d%s%2.2d%2.2d%2.2d%2.2d", $T2[4], $m2, $T2[0], + $T2[1], $T2[2], $T2[3]); + + my $ret = $dt1 - $dt2; + + if ( $ret > 40 ) { + $ret = abs($ret-40); + } + + return $ret; +} + +sub check_count_and_time { + my $event_recv_time; + my $udev_fork_time; + my $log_ln_count = 0; + my $line; + my @content; + my @line_items; + my $diff; + + ($event_recv_time) = @_; + + print " event receiving time: $event_recv_time\n\n"; + + open(LOGF, $log_file) || die "Opening file $log_file: $!"; + @content = ; + foreach $line ( @content ) { + @line_items = split(/,/,$line); + print " device: $line_items[0], action: $line_items[1] \n"; + print " forking udev time: $line_items[-1]"; + $diff = cmpDate($line_items[-1], $event_recv_time); + print " the delay time is: $diff s \n\n"; + if ( $diff > $time_out ) { + print " the delay time is: $diff \n"; + print " udevd doesn't act properly. \n"; + exit 1; + } + $log_ln_count++; + } + close(LOGF); + + return $log_ln_count; +} + +sub check_sysfs_device_exist { + # check if the designated devices exist + my @dev_list = @_; + my $dev; + + foreach $dev (@dev_list) { + if (! -e $dev) { + print "the designated device $dev doesn't exist. please change a device!\n"; + exit 1; + } + } +} + +sub show_result { + my $event_recv_time; + my $udev_fork_time; + my $line; + my @content; + my @line_items; + my $diff; + + ($event_recv_time) = @_; + + print " event receiving time: $event_recv_time\n\n"; + + open(LOGF, $log_file) || die "Opening file $log_file: $!"; + @content = ; + foreach $line ( @content ) { + @line_items = split(/,/,$line); + print " device: $line_items[0], action: $line_items[1] \n"; + print " forking udev time: $line_items[-1]"; + $diff = cmpDate($line_items[-1], $event_recv_time); + print " the delay time is: $diff s \n\n"; + } + close(LOGF); +} + +sub show_result_tm_out { + my $event_recv_time; + my $udev_fork_time; + my $line; + my @content; + my @line_items; + my $diff; + + ($event_recv_time) = @_; + + print " event receiving time: $event_recv_time\n\n"; + + open(LOGF, $log_file) || die "Opening file $log_file: $!"; + @content = ; + foreach $line ( @content ) { + @line_items = split(/,/,$line); + print " device: $line_items[0], action: $line_items[1] \n"; + print " forking udev time: $line_items[-1]"; + $diff = cmpDate($line_items[-1], $event_recv_time); + print " the delay time is: $diff s \n\n"; + if ( $diff < $time_out ) { + print " the delay time is: $diff \n"; + print " udevd doesn't act properly. \n"; + exit 1; + } + } + close(LOGF); +} + +sub show_result_immediate { + my $event_recv_time; + my $udev_fork_time; + my $line; + my @content; + my @line_items; + my $diff; + + ($event_recv_time) = @_; + + print " event receiving time: $event_recv_time\n\n"; + + open(LOGF, $log_file) || die "Opening file $log_file: $!"; + @content = ; + foreach $line ( @content ) { + @line_items = split(/,/,$line); + print " device: $line_items[0], action: $line_items[1] \n"; + print " forking udev time: $line_items[-1]"; + $diff = cmpDate($line_items[-1], $event_recv_time); + print " the delay time is: $diff s \n\n"; + if ( $diff > $time_out ) { + print " the delay time is: $diff \n"; + print " udevd doesn't act properly. \n"; + exit 1; + } + } + close(LOGF); +} + +sub check_exe_time { + my @exe_time; + my $i = 0; + my $line; + my @content; + my @line_items; + my $diff; + + open(LOGF, $log_file) || die "Opening file $log_file: $!"; + @content = ; + close(LOGF); + foreach $line ( @content ) { + @line_items = split(/,/,$line); + $exe_time[$i] = $line_items[-1]; + $i++; + } + $diff = cmpDate($exe_time[1], $exe_time[0]); + if ( $diff < $udev_exe_time ) { + print " there are more than one udev instance for a single device at the same time. \n"; + exit 1; + } else { + print " there is just one udev instance for a single device at the same time. \n"; + } +} + +# test case functions +sub run_no_seq_test { + print "Test case name: no sequence number test\n"; + print "Test case purpose: check whether udevd forks udev immediately when environment variable SEQNUM is null.\n"; + print "Test expected visible results: \n"; + print " the delay time between event receiving and forking udev for udevd should be negligible, \n"; + print " that is, udev should be forked at once. please notice the following time...\n\n"; + + # local variables + my $time; + + # + # add devices event test + # + kill_daemon(); + + # check if devices /block/sda exist + check_sysfs_device_exist("$sysfs/block/sda"); + + # log current system date/time + $time = getDate(); + + # fork udevd + udevsend(-1, "/block/sda", "add", "block"); + + # check if execution is successful in time + sleep 1; + show_result_immediate($time); + print " fork udev (add device) at once successfully.\n\n"; + + # + # remove devices event test + # + system("rm -f $log_file"); + + # log current system date/time + $time = getDate(); + + # fork udevd + udevsend(-1, "/block/sda", "remove", "block"); + + # check if execution is successful in time + sleep 1; + show_result_immediate($time); + print " fork udev (remove device) at once successfully.\n\n"; + print "this case is ok\n\n"; +} + +sub run_normal_seq_test { + print "Test case name: normal sequence number stress test\n"; + print "Test case purpose: check whether udevd can fork massive udev instances for \n"; + print " massive sequential events successfully. \n"; + print "Test expected visible results: \n"; + print " Populate all the devices in directory $sysfs/class/tty, fork udved to send add/remove \n"; + print " event to udev for each device. \n"; + print " We can see the delay time for each device should be negligible. \n\n"; + + # local variables + my @file_list; + my $file; + my $seq = 0; + my $time; + my $ret_seq; + + # prepare + kill_daemon(); + @file_list = glob "$sysfs/class/tty/*"; + + # log current system date/time for device add events + $time = getDate(); + + # + # add devices event test + # + print "add device events test: \n"; + foreach $file (@file_list) { + udevsend($seq, substr($file, length($sysfs), length($file)-length($sysfs)), "add", "tty"); + # check if execution is successful + if ($? == 0) { + $seq++; + } else { + print "add event: error\n\n"; + exit 1; + } + } + + # we'd better wait the udev to create all the device for a few seconds + print " wait for udevd processing about $time_out s... \n\n"; + sleep $time_out; + + $ret_seq = check_count_and_time($time); + if ( $ret_seq != $seq ) { + print " add event: failed. some device-adding events fail to execute.\n\n"; + exit 1; + } else { + print " $seq pieces of device-adding events have executed successfully.\n\n"; + } + + # log current system date/time for device remove events + $time = getDate(); + + # + # remove devices event test + # + print "remove device events test: \n"; + kill_daemon(); + @file_list = glob "$sysfs/class/tty/*"; + $seq = 0; + foreach $file (@file_list) { + udevsend($seq, substr($file, length($sysfs), length($file)-length($sysfs)), "remove", "tty"); + # check if execution is successful + if ($? == 0) { + $seq++; + } else { + print "remove event: error\n\n"; + exit 1; + } + } + + # we'd better wait the udev to create all the device for a few seconds + print " waiting for udev removing devices (about $time_out s)...\n"; + sleep $time_out; + + # show results + $ret_seq = check_count_and_time($time); + if ( $ret_seq != $seq ) { + print " remove event: failed. some device-removing events fail to execute.\n\n"; + exit 1; + } else { + print " $seq pieces of device-removing events have executed successfully.\n\n"; + print "this case is ok.\n\n"; + } +} + +sub run_random_seq_test { + print "Test case name: random sequence number test case,\n"; + print "Test case purpose: check whether udevd can order the events with random sequence number \n"; + print " and fork udev correctly. \n"; + print "Test expected visible results: \n"; + print " We have disordered the events sent to udevd, if udevd can order them correctly, the devices' \n"; + print " add/remove sequence should be tty0, tty1, tty2. \n\n"; + + # local variables + my $time; + + # check if devices /class/tty/tty0, tty1, tty2 exist + check_sysfs_device_exist("$sysfs/class/tty/tty0", "$sysfs/class/tty/tty1", "$sysfs/class/tty/tty2"); + + # + # add device events test + # + print "add device events test: \n"; + kill_daemon(); + + # log current system date/time for device remove events + $time = getDate(); + + # parameters: 1 sequence number, 2 device, 3 action, 4 subsystem + udevsend(3, "/class/tty/tty2", "add", "tty"); + udevsend(1, "/class/tty/tty0", "add", "tty"); + udevsend(2, "/class/tty/tty1", "add", "tty"); + print " wait for udevd processing about $time_out s... \n\n"; + sleep $time_out+1; + show_result_tm_out($time); + + # + # remove device events test + # + print "\nremove device events test: \n"; + kill_daemon(); + + # log current system date/time for device remove events + $time = getDate(); + + # fork udevd + udevsend(3, "/class/tty/tty2", "remove", "tty"); + udevsend(2, "/class/tty/tty1", "remove", "tty"); + udevsend(1, "/class/tty/tty0", "remove", "tty"); + + # show results + print " wait for udevd processing about $time_out s... \n\n"; + sleep $time_out+1; + show_result_tm_out($time); + print "this case is ok.\n\n"; +} + +sub run_expected_seq_test { + print "Test case name: expected sequence number test \n"; + print "Test case purpose: check whether udevd fork udev immediately when the incoming event\n"; + print " is exactly the expected event sequence number.\n"; + print "Test expected visible results:\n"; + print " first, udevd disposes disorder events(sequence number is 3,1,2,5,4,6),\n"; + print " thus after disposed the expected event number for udevd is 7, when incoming event is 7, udevd\n"; + print " should fork udev immediately, the delay time should be negligible. \n"; + print " where: event 7 is (add device /class/tty/tty2) \n\n"; + + # local variables + my $time; + + # check if devices /class/tty0, tty1, tty2 exist + check_sysfs_device_exist("$sysfs/class/tty/tty0", "$sysfs/class/tty/tty1", "$sysfs/class/tty/tty2"); + + # prepare + kill_daemon(); + + # parameters: 1 sequence number, 2 device, 3 action, 4 subsystem + udevsend(3, "/class/tty/tty2", "add", "tty"); + udevsend(1, "/class/tty/tty0", "add", "tty"); + udevsend(2, "/class/tty/tty1", "add", "tty"); + udevsend(5, "/class/tty/tty1", "remove", "tty"); + udevsend(4, "/class/tty/tty0", "remove", "tty"); + udevsend(6, "/class/tty/tty2", "remove", "tty"); + + print " wait for udevd timing out for disorder events (about $time_out s) \n\n"; + sleep $time_out+1; + system("rm -f $log_file"); + + # log current system date/time for device remove events + $time = getDate(); + + # show results + udevsend(7, "/class/tty/tty2", "add", "tty"); + sleep 1; + print " event sequence number: 7 \n"; + show_result_immediate($time); + + print "this case is ok.\n\n"; +} + +sub run_single_instance_test { + print "Test case name: single instance running for a single device test \n"; + print "Test case purpose: check whether udevd only fork one udev instance for a single\n"; + print " device at the same time. For each event a udev instance is \n"; + print " executed in the background. All further events for the same \n"; + print " device are delayed until the execution is finished. This way \n"; + print " there will never be more than one instance running for a single \n"; + print " device at the same time.\n"; + print "Test expected visible results:\n"; + print " In this test we amplify the execution time of udev (about 5 seconds), first, \n"; + print " we send a add event for device /block/sda, and then we send a remove event, so the \n"; + print " execution of remove event should be delayed until add is finished. \n\n"; + + # local variables + my $time; + + # prepare + kill_daemon(); + + # check if device exists + check_sysfs_device_exist("$sysfs/block/sda"); + + # log current system date/time + $time = getDate(); + + # fork udved + udevsend(-1, "/block/sda", "add", "block", $udev_bin2); + udevsend(-1, "/block/sda", "remove", "block", $udev_bin2); + + # show results + print " wait for udevd processing about $udev_exe_time s... \n\n"; + sleep $udev_exe_time+1; + show_result_immediate($time); + check_exe_time(); + print "this case is ok\n\n"; +} + +sub run_same_events_test { + print "Test case name: event sequence number overlap test \n"; + print "Test case purpose: check whether udevd doesn't fork udev untill time out\n"; + print " when encountering a event with sequence number same as the pevious event. \n"; + print "Test expected visible results:\n"; + print " event ( remove device /block/sda ) should be no delay, \n"; + print " event ( add device /class/tty/tty1 ) should be delayed for $time_out s than its previous \n"; + print " event ( remove device /block/sda ) \n\n"; + + # local variables + my $time; + + # prepare + kill_daemon(); + + # check if device exist + check_sysfs_device_exist("$sysfs/block/sda", "$sysfs/class/tty/tty1"); + + # fork udevd + udevsend(0, "/block/sda", "add", "block"); + + # log current system date/time + sleep 1; + $time = getDate(); + system("rm -f $log_file"); + + # fork udevd + udevsend(1, "/block/sda", "remove", "block"); + udevsend(1, "/class/tty/tty1", "add", "tty"); + + # show results + print " wait for udevd processing about $time_out s... \n\n"; + sleep $time_out+1; + show_result($time); + print "this case is ok\n\n"; +} + +sub run_missing_seq_test { + print "Test case name: missing sequence number test \n"; + print "Test case purpose: check whether udevd doesn't fork udev untill time out\n"; + print " when certain event sequence number is missing.\n"; + print "Test expected visible results:\n"; + print " the delay time for event(add device /block/sda) should be about $time_out s.\n\n"; + + # local variables + my $time; + + # prepare + kill_daemon(); + + # check if device exist + check_sysfs_device_exist("$sysfs/block/sda", "$sysfs/class/tty/tty1"); + + # fork udevd + udevsend(0, "/class/tty/tty1", "add", "tty"); + udevsend(1, "/class/tty/tty1", "remove", "tty"); + sleep 1; + + # log current system date/time + $time = getDate(); + system("rm -f $log_file"); + + # fork udevd + udevsend(3, "/block/sda", "add", "block"); + + # show results + print " wait for udevd processing about $time_out s... \n\n"; + sleep $time_out+1; + show_result($time); + print "this case is ok\n\n"; +} + +sub run_all_cases_test { + run_no_seq_test(); + run_normal_seq_test(); + run_random_seq_test(); + run_missing_seq_test(); + run_expected_seq_test(); + run_same_events_test(); + run_single_instance_test(); +} + +# main program +if ($ARGV[0]) { + $test_case = $ARGV[0]; + + if ($test_case == 1) { + run_no_seq_test(); + } elsif ($test_case == 2) { + run_normal_seq_test(); + } elsif ($test_case == 3) { + run_random_seq_test(); + } elsif ($test_case == 4) { + run_missing_seq_test(); + } elsif ($test_case == 5) { + run_expected_seq_test(); + } elsif ($test_case == 6) { + run_single_instance_test(); + } elsif ($test_case == 7) { + run_same_events_test(); + } else { + run_all_cases_test(); + } +} else { + # echo usage + print "command format: perl udevd-test.pl \n"; + print " test case:\n"; + print " 1: no event sequence number\n"; + print " 2: sequential event sequence number\n"; + print " 3: random event sequence number\n"; + print " 4: missing event sequence number\n"; + print " 5: the incoming event sequence number is right the expected sequence number\n"; + print " 6: single udev instance on a single device at the same time\n"; + print " 7: test event sequence number overlap\n"; + print " 9: all the cases\n\n"; +} diff --git a/udevd.c b/udevd.c index b2cb62f386..d807e4168d 100644 --- a/udevd.c +++ b/udevd.c @@ -60,6 +60,7 @@ static void exec_queue_manager(void); static void msg_queue_manager(void); static void user_sighandler(void); static void reap_kids(void); +char *udev_bin; #ifdef LOG unsigned char logname[LOGNAME_SIZE]; @@ -146,7 +147,7 @@ static void udev_run(struct hotplug_msg *msg) switch (pid) { case 0: /* child */ - execle(UDEV_BIN, "udev", msg->subsystem, NULL, env); + execle(udev_bin, "udev", msg->subsystem, NULL, env); dbg("exec of child failed"); exit(1); break; @@ -458,6 +459,13 @@ int main(int argc, char *argv[]) /* enable receiving of the sender credentials */ setsockopt(ssock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + /* possible override of udev binary, used for testing */ + udev_bin = getenv("UDEV_BIN"); + if (udev_bin != NULL) + dbg("udev binary is set to '%s'", udev_bin); + else + udev_bin = UDEV_BIN; + FD_ZERO(&readfds); FD_SET(ssock, &readfds); FD_SET(pipefds[0], &readfds); -- cgit v1.2.3-54-g00ecf From f2bd44417bf2c6c99037b430f3f97cfd65a21f76 Mon Sep 17 00:00:00 2001 From: "dan@reactivated.net" Date: Fri, 16 Apr 2004 23:58:08 -0700 Subject: [PATCH] Update writing udev rules docs Here's an update for the writing udev rules document. - Minor corrections/clarifications - Added info about using NAME{all_partitions} - Added more info about udevinfo, simplifying the rule-writing process You can ignore the diff I sent you yesterday - according to the 20040415 bk snapshot on codemonkey.org, you haven't applied it yet. This patch incorporates that update, and some other changes I just made. --- docs/writing_udev_rules/index.html | 69 +++++++++++++++++++++++++------------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index 0e4d54cfaf..1a2702aeaf 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -1,6 +1,6 @@ -Writing udev rules [reactivated.net] +Writing udev rules @@ -8,7 +8,7 @@

Writing udev rules

by Daniel Drake (dsd)
-Version 0.51

+Version 0.53

The most recent version of this document can always be found at:
http://www.reactivated.net/udevrules.php @@ -23,7 +23,7 @@ The most recent version of this document can always be found at:
  • Why? (The purpose of this document)
  • The basics of writing rules
  • Additional automated customisation for NAME and SYMLINK parameters
  • -
  • Using regular expressions and wildcards in keys
  • +
  • Using shell-style pattern matching in keys
  • Key-writing basics
  • Identifying devices through basic keys
  • Identifying devices through SYSFS files
  • @@ -51,8 +51,9 @@ This document assumes that you have udev/hotplug installed and running OK with d

    History

    +April 15th 2004: Minor corrections. Added info about NAME{all_partitions}. Added info about other udevinfo tricks.

    +April 14th 2004: Reverted to suggesting using "udev.rules" until the udev defaults allow for other files. Minor work.

    April 6th 2004: I now write suggest users to use their own "local.rules" file rather than prepending "udev.rules".

    - April 3rd 2004: Minor cleanups and preparations for possible inclusion in the udev distribution.

    February 15th 2004: Initial publication.

    February 18th 2004: Fixed a small omission in an example. Updated section on identifying mass-storage devices. Updated section on nvidia.

    @@ -96,11 +97,13 @@ For external mass-storage devices (e.g. usb hard disks), persistant naming is ve

    The basics of writing rules

    -When populating /dev, udev decides which nodes to include, and how to name them, by reading a rules file. The default rules file includes some examples, and defaults to giving a devfs-style layout. The examples may safely be removed, but it is generally sensible to keep the devfs rules and simply make your own amendments and modifications.

    +When populating /dev, udev decides which nodes to include, and how to name them, by reading a rules file. This rules file is processed from top to bottom, and udev will stop processing rules for a device once it finds one that matches.

    + +Default udev rules are stored in /etc/udev/udev.rules. The default file includes some examples, and defaults to giving a devfs-style layout. The examples may safely be removed, but it is generally sensible to keep the devfs rules and simply make your own amendments and modifications. You should write your rules in this file, above the examples and default devfs-style rules.

    -Default udev rules are stored in /etc/udev/udev.rules. You may find it interesting to look over this file - it includes a few examples, and then some default rules proving a devfs-style /dev layout. However, you should not write rules into this file directly, to reduce hassle while updating your udev installation in the future.

    + As your own rules will effectively mask out the udev defaults which create the base /dev layout, it is recommended that you also specify devfs-style names/symlinks for the rules you write, so that you get the sensible defaults plus your own names.

    @@ -141,9 +144,9 @@ Another common operator is %k. This represents what the kernel would name A full list of operators, with explanations, can be found in the udev man page.

    -

    Using regular expressions and wildcards in keys

    +

    Using shell-style pattern matching in keys

    -You can use wildcards and basic regular-expression style matching to provide even more flexibility when writing keys. Taking a default udev rule: +You can use shell style pattern matching to provide even more flexibility when writing keys. Taking a default udev rule:
    KERNEL="ts*", NAME="input/%k"
    @@ -164,7 +167,7 @@ This rule says:
    Match a device identified by a KERNEL name starting with the letters "fd", followed by any single digit, optionally followed by anything at all. Name the device with the kernel number of the device (%n) under the floppy directory.
    -You can use these wildcards/regular-expression matches in any type of key, including both basic keys and sysfs-based identification (see below for explanations of these key types).

    +You can use these wildcards/pattern matches in any type of key, including both basic keys and sysfs-based identification (see below for explanations of these key types).

    I have purposely left out some information on this topic (particularly the flexibility of using [ ] operators) that is out of the scope of basic rule-writing documentation. More information on this topic can be found in the udev man page.

    @@ -209,7 +212,18 @@ The first thing you need to do is find a directory somewhere in /sys that corres Once you have found a directory of this type, you can use the following command to assist you in the creation of writing keys for udev rules:
    # udevinfo -a -p /sys/path/to/hardware/info
    -Some snipped output of the results of my "udevinfo -a -p /sys/block/sda" command is shown below, with colour added.
    +You may find that finding the correct place in /sys to run udevinfo on is not obvious. Chances are the device you just plugged in has already careted a device node (e.g. /dev/sda), in which case, udevinfo can be helpful! Taking the example of my /dev/sda node, running the following command will point you to the appropriate area of sysfs: +
    +# udevinfo -q path -n /dev/sda
    +
    +/block/sda
    +
    + +The output of the command (shown above) is telling me that the sysfs path to start at is /sys/block/sda. I would now run "udevinfo -a -p /sys/block/sda". These two commands can be stringed together, like so: + +
    # udevinfo -a -p `udevinfo -q path -n /dev/sda`
    + +Moving on to rule-writing, some snipped output of the results of my "udevinfo -a -p /sys/block/sda" command is shown below, with colour added.
    
     follow the class device's "device"
    @@ -262,14 +276,10 @@ I will show three examples of this rule writing based on udevinfo output
     
     

    Example: Writing a rule for my USB printer

    -After plugging in my printer, I started looking around some /sys directories for a relevant place to start. I didn't get anywhere, but I noticed that my printer had been given device node /dev/lp0. I used this command sequence to find an answer: +After plugging in my printer, I started looking around some /sys directories for a relevant place to start. I didn't get anywhere, but I noticed that my printer had been given device node /dev/lp0. udevinfo was able to provide me with a useful path:
    -# cd /sys
    -# find | grep lp0
    -./class/usb/lp0
    -./class/usb/lp0/dev
    -./class/usb/lp0/driver
    -./class/usb/lp0/device
    +# udevinfo -q path -n /dev/lp0
    +/class/usb/lp0
     
    Running "udevinfo -a -p /sys/class/usb/lp0" provided me with a heap of info, as usual. I picked out the relevant bits for unique device identification: @@ -326,14 +336,23 @@ Carl's rule is: This rule creates symlinks such as:
      -
    • /dev/usbhdd - The fdiskable node
    • -
    • /dev/usbhdd1 - The first partition (mountable)
    • -
    • /dev/usbhdd2 - The second partition (mountable)
    • +
    • /dev/usbhd - The fdiskable node
    • +
    • /dev/usbhd1 - The first partition (mountable)
    • +
    • /dev/usbhd2 - The second partition (mountable)
    We agreed that depending on the situation and device in question, there are reasons for both wanting and not wanting the non-mountable /dev/sda node. Use whichever setup suits you best.

    +Another difficult situation is having a multiple-slot USB-storage card reader. These types of device generally do not inform the host when new cards are plugged in or out, so plugging a card into an unused slot while the reader is plugged in will not create the extra device node needed for mounting!
    +This problem also applies to other USB disks - e.g. if you create a new partition, the new partition node will not appear until you re-plug the device.

    + +udev provides a solution here - it is able to create nodes for all partitions of a block device. For every rule that you specify, the block device will have all 16 partition nodes created. To achieve this, you can simply modify the NAME key, as shown below:
    + +
    BUS="usb", SYSFS{product}="USB 2.0 Storage Device", NAME{all_partitions}="usbhd%n"
    + +You will now have nodes named: usbhd, usbhd1, usbhd2, usbhd3, ..., usbhd15.

    +

    Example: Writing convenience rules for my CD drives

    I have two CD drives in my PC - a DVD reader, and a CD rewriter. My DVD is hdc and my CDRW is hdd. I would not expect this to change, unless I manually changed the cabling of my system.

    @@ -346,13 +365,14 @@ BUS="ide", KERNEL="hdc", NAME="%k", SYMLINK="dvd cdroms/cdrom%n" BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n"
    -You may have noticed that the default udev.rules file contains a rule which runs a script to produces names for block devices. Do not be confused by this - as usual, because your own rules in local.rules are processed before the default rules, the default rules will not be used when naming the hardware you have written rules for.

    +You may have noticed that the default udev.rules file contains a rule which runs a script to produces names for block devices. Do not be confused by this - as usual, because your own rules are located at the top of the rules file, they are processed before the default rules, so the default rules will not be used when naming the hardware you have written rules for.

    Tips for finding the appropriate places in SYSFS

    I'm looking for some more device specific tips here. Please contact me with any you can provide.
      +
    • If the device you are looking to write rules for has created a device node under /dev, then you are in luck! Run the following command to get an appropriate /sys path: udevinfo -q path -n /dev/yournode
    • Always use udevinfo to assist the rule-writing process. Always use udevinfo to look under /sys/block or /sys/class (it will not start reading a chain from anywhere else).
    • If you get totally stuck, use the following command to find all "dev" files under /sys (udevinfo can work on directories containing this file): find /sys -iname dev
    • If your device is a flash-card reader, usb flash-drive, or digital camera that acts as usb-storage, that is created as /dev/sdX, then start looking in /sys/block/sdX.
    • @@ -394,8 +414,11 @@ Additional thanks to:
    • Carl Streeter (usb-storage info)
    • Decibels
    • Frank Pieczynski
    • +
    • Feth Arezki
    • Jim (KDE info)
    • +
    • Kay Sievers
    • Patrick Dreker
    • +
    • Todd Musall
    • Tuna
    • Ueli Schlpfer
    • ...and anyone else who provided information or feedback
    • @@ -405,4 +428,4 @@ Additional thanks to: This document is licensed under the GNU General Public License, Version 2. - \ No newline at end of file + -- cgit v1.2.3-54-g00ecf From b2983b9d4a05b44c9230e17a3d6737d185d1c749 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 16 Apr 2004 23:58:27 -0700 Subject: [PATCH] udev_selinux changes Here is the fix for extras/seliux/* o install the binary in /sbin/ o add symlink to /etc/dev.d/ with suffix .dev o removed the undefined udev_log variable o fixed compiler warnings --- extras/dbus/Makefile | 10 +++++----- extras/selinux/Makefile | 9 +++++++-- extras/selinux/udev_selinux.c | 31 ++++++++++++++++++++++--------- 3 files changed, 34 insertions(+), 16 deletions(-) diff --git a/extras/dbus/Makefile b/extras/dbus/Makefile index 04f17605e8..0cfc650c4b 100644 --- a/extras/dbus/Makefile +++ b/extras/dbus/Makefile @@ -53,16 +53,16 @@ spotless: clean install-dbus-policy: $(INSTALL) -d $(DESTDIR)$(dbusdir) - $(INSTALL_DATA) etc/dbus-1/system.d/udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(usrsbindir)/$(PROG) - - ln -s -f $(DESTDIR)$(usrsbindir)/$(PROG) $(DESTDIR)$(devddir)/$(PROG).dev uninstall-dbus-policy: - rm $(DESTDIR)$(dbusdir)/udev_sysbus_policy.conf - - rm $(DESTDIR)$(devddir)/$(PROG).dev - - rm $(DESTDIR)$(usrsbindir)/$(PROG) install: install-dbus-policy all + $(INSTALL_DATA) etc/dbus-1/system.d/udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(usrsbindir)/$(PROG) + - ln -s -f $(DESTDIR)$(usrsbindir)/$(PROG) $(DESTDIR)$(devddir)/$(PROG).dev uninstall: uninstall-dbus-policy + - rm $(DESTDIR)$(devddir)/$(PROG).dev + - rm $(DESTDIR)$(usrsbindir)/$(PROG) diff --git a/extras/selinux/Makefile b/extras/selinux/Makefile index 813756700b..35d2e9e6da 100644 --- a/extras/selinux/Makefile +++ b/extras/selinux/Makefile @@ -26,7 +26,9 @@ exec_prefix = ${prefix} etcdir = ${prefix}/etc sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default hotplugdir = ${etcdir}/hotplug.d/default configdir = ${etcdir}/udev/ initdir = ${etcdir}/init.d/ @@ -52,8 +54,11 @@ clean: spotless: clean - install: all + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + - ln -s -f $(DESTDIR)$(sbindir)/$(PROG) $(DESTDIR)$(devddir)/$(PROG).dev -uninstall: +uninstall: + - rm $(DESTDIR)$(devddir)/$(PROG).dev + - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/selinux/udev_selinux.c b/extras/selinux/udev_selinux.c index df23d9e6a7..8b1c2c7da8 100644 --- a/extras/selinux/udev_selinux.c +++ b/extras/selinux/udev_selinux.c @@ -1,10 +1,27 @@ +/* + * udev_selinux.c + * + * Copyright (C) 2004 Daniel J Walsh + * + * 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 02139, USA. + * + */ + #include #include #include -#include -#include #include -#include #include #include "../../udev_lib.h" @@ -16,16 +33,13 @@ void log_message(int level, const char *format, ...) { va_list args; - if (!udev_log) - return; - va_start(args, format); vsyslog(level, format, args); va_end(args); } #endif -void selinux_add_node(char *filename) +static void selinux_add_node(char *filename) { int retval; @@ -35,7 +49,7 @@ void selinux_add_node(char *filename) if (retval < 0) { dbg("matchpathcon(%s) failed\n", filename); } else { - retval=setfilecon(filename,scontext); + retval = setfilecon(filename,scontext); if (retval < 0) dbg("setfiles %s failed with error '%s'", filename, strerror(errno)); @@ -47,7 +61,6 @@ void selinux_add_node(char *filename) int main(int argc, char *argv[], char *envp[]) { char *action; - char *devpath; char *devname; int retval = 0; -- cgit v1.2.3-54-g00ecf From d9154d11760bc650ca396d19bd31240616d4f80a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 17 Apr 2004 00:09:17 -0700 Subject: [PATCH] add scripts to run gcov for udev from Leann Ogasawara --- README-gcov_for_udev | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++ make_gcov.sh | 53 +++++++++++++++++++++++ run_gcov.sh | 40 ++++++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 README-gcov_for_udev create mode 100644 make_gcov.sh create mode 100644 run_gcov.sh diff --git a/README-gcov_for_udev b/README-gcov_for_udev new file mode 100644 index 0000000000..fa377bc4af --- /dev/null +++ b/README-gcov_for_udev @@ -0,0 +1,116 @@ +################################################ + +Using GCC's code coverage tool, gcov, with udev + +################################################ + +For more information on using gcov please see: + +http://gcc.gnu.org/onlinedocs/gcc/Gcov.html + +With that said, here is how to get code coverage analysis for udev files. +Note that this was developed with udev version 024. + +- Make sure you've installed udev and that it is working properly. + If you are having problems, refer to the README and HOWTO-udev_for_dev + documents in udev tarball. I've also compiled a udev_for_dev + toubleshooting document for Red Hat which can be found at: + + http://developer.osdl.org/ogasawara/gcov_for_udev/rh_udev_for_dev.txt + +- Get the following files: + make_gcov.sh + run_gcov.sh + + These can be found at http://developer.osdl.org/ogasawara/gcov_for_udev/ + +- After grabbing these files, copy both make_gcov.sh and run_gcov.sh + into the top level of your udev directory. + +- execute make_gcov.sh + + ./make_gcov.sh + + This will compile udev with gcov support. Basically make_gcov.sh will + run make but override the CFLAGS. It strips any optimization from + CFLAGS in order for gcov to get correct code coverage analysis. It will + also add the -fprofile-arcs and -ftest-coverage options which are the + necessary flags needed to use gcov. + + make_gcov.sh will assume the same default parameters as the regular + make but also accepts the same parameters. For example if you want + to get code coverage analysis for udev with the DEBUG flag turned + on, you would just execute: + + ./make_gcov.sh DEBUG=true + + There is one exception, gcov will not work with klibc as it does not + compile cleanly with the -fprofile-arcs and -ftest-coverage flags. + With this said it is pretty much useless to set the KERNEL_DIR flag + when using make_gcov.sh as well. + + Don't be alarmed if you look into your udev directory and see that it + has been polluted with a bunch of *.bb, *.bbg, *.da, and *.gcov files. + gcov creates and uses these files to extract the code coverage info. + +- After running make_gcov.sh you need to install udev again. So basically, + + su to root + make install + +- Then execute some udev tasks. You can run some udev tests, reboot, or + do anything your little udev heart desires. Once you are satisfied, you + can now see how much udev code was covered. + +- To get the udev code coverage analysis, execute run_gcov.sh. You need to + be root to do this. + + su to root + ./run_gcov.sh + +- This creates udev_gcov.txt which holds all the code coverage information. + To see an example of the code coverage info after executing the udev-test.pl + test, please see: + + http://developer.osdl.org/ogasawara/gcov_for_udev/udev_gcov.txt + +- Also, after having executed gcov on udev (ie executing run_gcov.sh) a + *.gcov file is created for every file which contained code that was + used. Looking at the *.gcov files, one will see what lines of code + were hit, and what lines were missed. For, example if code in udev-add.c + were executed, gcov then created a file called udev-add.c.gcov. And a + portion of udev-add.c.gov might look like: + + static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) + 95 { + 95 struct sysfs_attribute *attr = NULL; + + 95 attr = sysfs_get_classdev_attr(class_dev, "dev"); + 95 if (attr == NULL) + ###### goto error; + dbg("dev='%s'", attr->value); + + 95 if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2) + ###### goto error; + dbg("found major=%d, minor=%d", udev->major, udev->minor); + + 95 return 0; + error: + ###### return -1; + } + + Any line of code that is preceded by a "######" implies that the code + was never hit during execution. + +- Once you are done with using gcov for udev and want to return to your + normal use of udev. Simply, + + ./make_gcov.sh clean + + This will clean out all the *.bb, *.bbg, *.da, *.gcov files produced by gcov. + It will also run a regular make clean on your udev directory. Then just run + a regular make and make install and you are back to normal: + + make + su to root + make isntall diff --git a/make_gcov.sh b/make_gcov.sh new file mode 100644 index 0000000000..907c1ebd48 --- /dev/null +++ b/make_gcov.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# +# gcov capability for udev +# +# Provides code coverage analysis for udev. +# +# make_gcov.sh assumes the same same default parameters as make, but also +# accepts the same parameters as make (see README file in udev/ for +# parameter info). There is one exception, klibc can not be used with +# gcov as it will not compile cleanly. +# +# make_gcov.sh then overrides CFLAGS to strip out optimization in order +# for gcov to get correct code coverage analysis. +# +# Leann Ogasawara , April 2004 + +# clean up udev dir +clean_udev () { + find -name "*.da" -exec rm -f "{}" \; + find -name "*.bb" -exec rm -f "{}" \; + find -name "*.bbg" -exec rm -f "{}" \; + find -name "*.gcov" -exec rm -f "{}" \; + make clean +} + +PWD=`pwd` +GCCINCDIR=`gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"` +LIBSYSFS="-I$PWD/libsysfs" +WARNINGS="-Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" +GCC="-I$GCCINCDIR" +USE_LOG="-DLOG" +DEBUG="-D_GNU_SOURCE" +GCOV_FLAGS="-pipe -fprofile-arcs -ftest-coverage" + +for i in $*; do + pre=`echo $i | sed 's/=.*//g'` + post=`echo $i | sed 's/.*=//g'` + if [ $pre = "USE_KLIBC" ] && [ $post = "true" ]; then + echo "cannot use gcov with klibc, will not compile" + exit + elif [ $pre = "USE_LOG" ] && [ $post = "false" ]; then + USE_LOG="" + elif [ $pre = "DEBUG" ] && [ $post = "true" ]; then + DEBUG="-g -DDEBUG -D_GNU_SOURCE" + elif [ $pre = "clean" ]; then + clean_udev + exit + fi +done + +clean_udev + +make $* CFLAGS="$WARNINGS $GCOV_FLAGS $USE_LOG $DEBUG $GCC $LIBSYSFS" diff --git a/run_gcov.sh b/run_gcov.sh new file mode 100644 index 0000000000..4fe936199f --- /dev/null +++ b/run_gcov.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +# +# run gcov on udev +# +# Generate code coverage analysis for udev files +# +# This requires that you compiled udev with gcov flags i.e. +# you should have compiled udev with the make_gcov.sh script. +# +# Leann Ogasawara , April 2004 + +PWD=`pwd` + +# check if root else may not have access to *.da files +# and gcov analysis will fail. +if [ $(id -u) -ne 0 ]; then + echo "please become root before executing run_gcov.sh" + exit 1 +fi + +echo > udev_gcov.txt +echo "CODE COVERAGE ANALYSIS FOR UDEV" >> udev_gcov.txt +echo >> udev_gcov.txt + +for file in `find -maxdepth 1 -name "*.bb"`; do + name=`basename $file .bb` + echo "################" >> udev_gcov.txt + echo "$name.c" >> udev_gcov.txt + echo "################" >> udev_gcov.txt + if [ -e "$name.da" ]; then + gcov -l "$name.c" >> udev_gcov.txt 2>&1 + else + echo "code for $name.c was never executed" >> udev_gcov.txt 2>&1 + echo "no code coverage analysis to be done" >> udev_gcov.txt 2>&1 + fi + echo >> udev_gcov.txt +done + +echo "udev gcov analysis done. View udev_gcov.txt for results." -- cgit v1.2.3-54-g00ecf From 0e3dcb3dc6f4aab5625e033a112a5e03703b87b9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 17 Apr 2004 00:09:32 -0700 Subject: [PATCH] add hints for red hat users from Leann Ogasawara --- docs/rh_udev_for_dev.txt | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 docs/rh_udev_for_dev.txt diff --git a/docs/rh_udev_for_dev.txt b/docs/rh_udev_for_dev.txt new file mode 100644 index 0000000000..1a21c0e59b --- /dev/null +++ b/docs/rh_udev_for_dev.txt @@ -0,0 +1,68 @@ +Troubleshooting udev for dev on Red Hat distro + +1) Make sure you have a rescue disk/cd in case you hose your machine. You've + been forewarned. +2) Grab latest udev tarball or clone udev bitkeeper tree + (bk://linuxusb.bkbits.net.udev) +3) Follow README and HOWTO-udev_for_dev documents + +The following is some additional help to get udev for dev up and running on RH. + +Q. I login as my normal self from the login screen and RH just hangs on an + empty blue screen. What's wrong? + +A. You have some wrong permissions. I'm guessing you can probably log in as root + but not as your normal user. Basically you need to edit the + /etc/udev/udev.permissions file to set the correct permissions to the nodes + in /dev. I added the following: + + null:root:users:0666 + urandom:root:users:0644 + + setting the correct permissions to null and urandom allowed me to login + as myself and not at root. + + While you are there you might want to set the permissions to ptmx as well + or you may have trouble getting a bash prompt in an xterm. i.e. + ptmx:root:users:0666 Also refer to the next question. + +Q. I'm having trouble getting a bash prompt from my xterm. i.e. I bring up a + terminal and all I have is a blank screen with a blinking cursor. + +A. First make sure you have the correct permissions set for ptmx. See above + Q&A for help on this. But I'm guessing that something is wrong with your + /dev/pts, thanks Captain Obvious, heh:) You probably have devpts mounted + to /dev/pts from /etc/fstab. I'm also guessing that you have sysfs mounted + to /sys from /etc/fstab as well. If this is the case then the line in + /etc/rc.sysinit + + action $"Mounting local filesystems:" mount -a -t nonfs,smbfs,ncpfs -O no_netdev + + will have mounted these for you. As a result you placed your call to + start_udev directly after this because the HOWTO-udev_for_dev document + told you to insert start_udev after /proc and /sys have been mounted. + Well start_udev actually overwrites /dev thus anything you had mounted in + /dev prior to start_udev being called will be blown away. So basically, + you mounted devpts to /dev/pts because everything in /etc/fstab was mounted + and then it was blown away by calling start_udev. A simple fix is to remove + the mount devpts line from /etc/fstab and mount it after calling start_udev. + I did the following: + + action $"Mounting local filesystems:" mount -a -t nonfs,smbfs,ncpfs -O no_netdev + /etc/rc.d/start_udev + action $"Mounting devpts: " mount -t devpts none /dev/pts + + After doing so I rebooted and was able to get my prompt from my xterm. + +Q. I'm getting some error messages during boot. How do I get rid of them? + +A. For me it was a matter of setting up Symlinks. Basically, some /dev entries + were being looked for and not being found so an error was thrown. For example, + /dev/cdrom was needed but udev had named it /dev/hdc by default. Basically I + edited my /etc/udev/udev.rules file to create a symlink from /dev/cdrom to + /dev/hdc and my error went away. + +These are some of the things I ran into. NOTE: I hosed my machine more than once +trying to figure this out and a rescue disk was my best friend. If you have any +other experiences and would like to add to this Q&A list feel free to send me a +patch (ogasawara@osdl.org). Hopefully this helped someone. Thanks. -- cgit v1.2.3-54-g00ecf From b4eafd94677a12f1dc3d6cade21cece0fd858339 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 17 Apr 2004 00:23:17 -0700 Subject: [PATCH] add dbus.dev, pam_console.dev and selinux.dev files for /etc/dev.d/default/ usage Thanks to Red Hat for them. --- etc/dev.d/default/dbus.dev | 11 +++++++++++ etc/dev.d/default/pam_console.dev | 14 ++++++++++++++ etc/dev.d/default/selinux.dev | 14 ++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 etc/dev.d/default/dbus.dev create mode 100644 etc/dev.d/default/pam_console.dev create mode 100644 etc/dev.d/default/selinux.dev diff --git a/etc/dev.d/default/dbus.dev b/etc/dev.d/default/dbus.dev new file mode 100644 index 0000000000..0e79632b30 --- /dev/null +++ b/etc/dev.d/default/dbus.dev @@ -0,0 +1,11 @@ +#!/bin/sh + +if [ -f /etc/sysconfig/udev ]; then + . /etc/sysconfig/udev +fi + +[ "$UDEV_DBUS" != "yes" ] && exit 0 + +if [ -x /usr/sbin/udev_dbus ]; then + exec /usr/sbin/udev_dbus "$@" +fi diff --git a/etc/dev.d/default/pam_console.dev b/etc/dev.d/default/pam_console.dev new file mode 100644 index 0000000000..324c4fd804 --- /dev/null +++ b/etc/dev.d/default/pam_console.dev @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ -f /etc/sysconfig/udev ]; then + . /etc/sysconfig/udev +fi + +[ "$UDEV_CONSOLE" != "yes" ] && exit 0 + +if [ -x /sbin/pam_console_setowner ]; then + if [ "$UDEV_LOG" = "yes" -a -x /usr/bin/logger ]; then + /usr/bin/logger -p auth.debug "Restoring console permissions for $DEVNAME" + fi + exec /sbin/pam_console_setowner $DEVNAME +fi diff --git a/etc/dev.d/default/selinux.dev b/etc/dev.d/default/selinux.dev new file mode 100644 index 0000000000..f168eefc42 --- /dev/null +++ b/etc/dev.d/default/selinux.dev @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ -f /etc/sysconfig/udev ]; then + . /etc/sysconfig/udev +fi + +[ "$UDEV_SELINUX" != "yes" ] && exit 0 + +if [ -x /sbin/restorecon ]; then + if [ "$UDEV_LOG" = "yes" -a -x /usr/bin/logger ]; then + /usr/bin/logger -p auth.debug "Restoring file security contexts for $DEVNAME" + fi + /sbin/restorecon $DEVNAME +fi -- cgit v1.2.3-54-g00ecf From 6763c8a5a1d954c6453c2b01e331ae95b1bcfe2a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 17 Apr 2004 00:25:20 -0700 Subject: [PATCH] update the Red Hat .dev files to work on other distros --- etc/dev.d/default/dbus.dev | 4 ++++ etc/dev.d/default/pam_console.dev | 4 ++++ etc/dev.d/default/selinux.dev | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/etc/dev.d/default/dbus.dev b/etc/dev.d/default/dbus.dev index 0e79632b30..2fe1ed9b3a 100644 --- a/etc/dev.d/default/dbus.dev +++ b/etc/dev.d/default/dbus.dev @@ -4,6 +4,10 @@ if [ -f /etc/sysconfig/udev ]; then . /etc/sysconfig/udev fi +if [ -f /etc/conf.d/udev ]; then + . /etc/conf.d/udev +fi + [ "$UDEV_DBUS" != "yes" ] && exit 0 if [ -x /usr/sbin/udev_dbus ]; then diff --git a/etc/dev.d/default/pam_console.dev b/etc/dev.d/default/pam_console.dev index 324c4fd804..7e95810e2c 100644 --- a/etc/dev.d/default/pam_console.dev +++ b/etc/dev.d/default/pam_console.dev @@ -4,6 +4,10 @@ if [ -f /etc/sysconfig/udev ]; then . /etc/sysconfig/udev fi +if [ -f /etc/conf.d/udev ]; then + . /etc/conf.d/udev +fi + [ "$UDEV_CONSOLE" != "yes" ] && exit 0 if [ -x /sbin/pam_console_setowner ]; then diff --git a/etc/dev.d/default/selinux.dev b/etc/dev.d/default/selinux.dev index f168eefc42..7911d345b9 100644 --- a/etc/dev.d/default/selinux.dev +++ b/etc/dev.d/default/selinux.dev @@ -4,6 +4,10 @@ if [ -f /etc/sysconfig/udev ]; then . /etc/sysconfig/udev fi +if [ -f /etc/conf.d/udev ]; then + . /etc/conf.d/udev +fi + [ "$UDEV_SELINUX" != "yes" ] && exit 0 if [ -x /sbin/restorecon ]; then -- cgit v1.2.3-54-g00ecf From 87afc6dea0aca3cb9e40cba526e2241e4a887a54 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 17 Apr 2004 00:25:46 -0700 Subject: [PATCH] Switch the default config to point to a directory for the rules and permission files. --- etc/udev/udev.conf.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index 3e73bedbf5..9b6b9c7ee2 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -12,10 +12,10 @@ udev_root="@udevdir@/" udev_db="@udevdir@/.udev.tdb" # udev_rules - The name and location of the udev rules file -udev_rules="/etc/udev/udev.rules" +udev_rules="/etc/udev/rules.d/" # udev_permissions - The name and location of the udev permission file -udev_permissions="/etc/udev/udev.permissions" +udev_permissions="/etc/udev/permissions.d/" # default_mode - set the default mode for all nodes that have no # explicit match in the permissions file -- cgit v1.2.3-54-g00ecf From 56dbd7dfb000f082d34f36883873f2f266725494 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 17 Apr 2004 00:29:36 -0700 Subject: [PATCH] add udev conf.d file. --- etc/conf.d/udev | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 etc/conf.d/udev diff --git a/etc/conf.d/udev b/etc/conf.d/udev new file mode 100644 index 0000000000..50eda3a970 --- /dev/null +++ b/etc/conf.d/udev @@ -0,0 +1,11 @@ +# if selinux file attributes +# should be restored (leave to yes, if unsure) +UDEV_SELINUX="yes" + +# if console permissions (pam_console) +# should be restored (leave to yes, if unsure) +UDEV_CONSOLE="yes" + +# if dbus messages should be sent +UDEV_DBUS="no" + -- cgit v1.2.3-54-g00ecf From 3a0b657b76ea3844e8bc7f742adba1d7f16f7d2c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 21 Apr 2004 17:43:17 -0700 Subject: [PATCH] added rules for tun and raw devices --- etc/udev/udev.rules | 6 ++++++ etc/udev/udev.rules.devfs | 10 ++++++++++ etc/udev/udev.rules.gentoo | 6 ++++++ 3 files changed, 22 insertions(+) diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index ef61eafb8d..bc8c8bdd6c 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -39,3 +39,9 @@ BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" # CAPI devices KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" KERNEL="capi*", NAME="capi/%n" + +# Network devices +KERNEL="tun", NAME="net/%k" + +# raw devices +KERNEL="raw[0-9]*", NAME="raw/%k" diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index 3934fc6984..867f95029c 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -93,3 +93,13 @@ KERNEL="route6", NAME="netlink/%k" KERNEL="ip6_fw", NAME="netlink/%k" KERNEL="dnrtmsg", NAME="netlink/%k" KERNEL="tap*", NAME="netlink/%k" + +# CAPI devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi*", NAME="capi/%n" + +# Network devices +KERNEL="tun", NAME="net/%k" + +# raw devices +KERNEL="raw[0-9]*", NAME="raw/%k" diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index ab6f3bd405..1a84baa9d4 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -124,3 +124,9 @@ KERNEL="tap*", NAME="netlink/%k" # CAPI devices KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" KERNEL="capi*", NAME="capi/%n" + +# Network devices +KERNEL="tun", NAME="net/%k" + +# raw devices +KERNEL="raw[0-9]*", NAME="raw/%k" -- cgit v1.2.3-54-g00ecf From a36a3c3a44286e77d6ec05c7579f61b4eb0ee344 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 21 Apr 2004 17:49:44 -0700 Subject: [PATCH] fix test regressions On Sat, Apr 17, 2004 at 03:30:29AM +0200, Kay Sievers wrote: > On Sat, Apr 17, 2004 at 02:04:55AM +0200, Kay Sievers wrote: > > On Fri, Apr 16, 2004 at 04:04:42PM -0700, Greg KH wrote: > > > Oh, and if you run the latest udev_test.pl, we have a bunch more tests, > > > including a few that fail, if you were looking for something to do :) > > > > Will do it. We need to change apply_format(). I tries to expand the '%%' > > with the next iteration over the string and removes the '%'. The tests are all successful now. If this patch breaks something else, we simply have too few tests :) --- namedev.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/namedev.c b/namedev.c index 51a4639abe..b3a2a8ae4b 100644 --- a/namedev.c +++ b/namedev.c @@ -199,23 +199,21 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, struct sysfs_attribute *tmpattr; pos = string; - while (1) { - pos = strchr(string, '%'); - if (pos != NULL) { - pos[0] = '\0'; - tail = pos+1; - len = get_format_len(&tail); - c = tail[0]; - strfieldcpy(temp, tail+1); - tail = temp; - } else { + pos = strchr(pos, '%'); + if (pos == NULL) break; - } - dbg("format=%c, string='%s', tail='%s'",c , string, tail); + pos[0] = '\0'; + tail = pos+1; + len = get_format_len(&tail); + c = tail[0]; + strfieldcpy(temp, tail+1); + tail = temp; + dbg("format=%c, string='%s', tail='%s'",c , string, tail); attr = get_format_attribute(&tail); + switch (c) { case 'b': if (strlen(udev->bus_id) == 0) @@ -286,6 +284,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, break; case '%': strfieldcatmax(string, "%", maxsize); + pos++; break; default: dbg("unknown substitution type '%%%c'", c); -- cgit v1.2.3-54-g00ecf From 738e5c3f28ec5b4907b6bbef41ca721ba8b353ff Mon Sep 17 00:00:00 2001 From: "ogasawara@osdl.org" Date: Wed, 21 Apr 2004 17:49:49 -0700 Subject: [PATCH] gcov for udev Sorry for the late email regarding the gcov code coverage information for udev. For those of you who have not yet noticed, udev can now be compiled with gcov support and provide code coverage analysis. All pertinent scripts and information can be found in the udev tree. Please refer to "README-gcov_for_udev" for detailed information on compiling gcov into udev and obtaining code coverage analysis. I've enclosed a patch that updates the README-gcov_for_udev. Also, "udev-test.pl" in udev/test/ was expanded to test symlinks, permissions, and some lack of node creation a little more thoroughly. All comments and feedback would be greatly welcomed. Also, any extra testing would be appreciated. Thanks, --- README-gcov_for_udev | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/README-gcov_for_udev b/README-gcov_for_udev index fa377bc4af..ca832803a2 100644 --- a/README-gcov_for_udev +++ b/README-gcov_for_udev @@ -14,20 +14,11 @@ Note that this was developed with udev version 024. - Make sure you've installed udev and that it is working properly. If you are having problems, refer to the README and HOWTO-udev_for_dev documents in udev tarball. I've also compiled a udev_for_dev - toubleshooting document for Red Hat which can be found at: + toubleshooting document for Red Hat which can be found in: - http://developer.osdl.org/ogasawara/gcov_for_udev/rh_udev_for_dev.txt + docs/rh_udev_for_dev.txt -- Get the following files: - make_gcov.sh - run_gcov.sh - - These can be found at http://developer.osdl.org/ogasawara/gcov_for_udev/ - -- After grabbing these files, copy both make_gcov.sh and run_gcov.sh - into the top level of your udev directory. - -- execute make_gcov.sh +- execute make_gcov.sh from udev top level directory ./make_gcov.sh @@ -60,17 +51,18 @@ Note that this was developed with udev version 024. - Then execute some udev tasks. You can run some udev tests, reboot, or do anything your little udev heart desires. Once you are satisfied, you - can now see how much udev code was covered. + can now see how much udev code was covered. I personally recommend just + running test/udev-test.pl for starters. -- To get the udev code coverage analysis, execute run_gcov.sh. You need to - be root to do this. +- To get the udev code coverage analysis, execute run_gcov.sh from udev top + level directory. You need to be root to do this. su to root ./run_gcov.sh -- This creates udev_gcov.txt which holds all the code coverage information. - To see an example of the code coverage info after executing the udev-test.pl - test, please see: +- This creates udev_gcov.txt in the udev top level directory which holds all + the code coverage information. To see an example of the code coverage info + after executing the udev-test.pl test, please see: http://developer.osdl.org/ogasawara/gcov_for_udev/udev_gcov.txt -- cgit v1.2.3-54-g00ecf From 477f5b63ec9b208e29350f242482bd2290a8a164 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 21 Apr 2004 17:53:52 -0700 Subject: [PATCH] add more permissions based on SuSE's recommendations. --- etc/udev/udev.permissions | 3 +++ etc/udev/udev.permissions.gentoo | 3 +++ 2 files changed, 6 insertions(+) diff --git a/etc/udev/udev.permissions b/etc/udev/udev.permissions index e87b4ddc67..dd56bbec4c 100644 --- a/etc/udev/udev.permissions +++ b/etc/udev/udev.permissions @@ -5,3 +5,6 @@ pl2303:500:500:0666 visor:root:uucp:0666 dsp1:::0666 camera*:500:500:0666 +sgi_fetchop:root:root:666 +iseries/vcd*:root:disk:660 +iseries/vd*:root:disk:660 diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo index d5ef9eaa37..6c422b8ce7 100644 --- a/etc/udev/udev.permissions.gentoo +++ b/etc/udev/udev.permissions.gentoo @@ -192,3 +192,6 @@ usb/dabusb*:root:usb:0660 usb/mdc800*:root:usb:0660 usb/rio500:root:usb:0660 +sgi_fetchop:root:root:666 +iseries/vcd*:root:disk:660 +iseries/vd*:root:disk:660 -- cgit v1.2.3-54-g00ecf From ffcd3851b22b28e5ac8a9756b486050a2c915f11 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 21 Apr 2004 20:23:47 -0700 Subject: [PATCH] add devd_test script. --- test/devd_test | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 test/devd_test diff --git a/test/devd_test b/test/devd_test new file mode 100644 index 0000000000..007a0bec90 --- /dev/null +++ b/test/devd_test @@ -0,0 +1,39 @@ +#!/bin/bash + +RULES=label_test.rules +CONFIG=label_test.conf + +export UDEV_TEST=yes +export SYSFS_PATH=$PWD/sys/ +export UDEV_CONFIG_FILE=$PWD/$CONFIG + +cat > $RULES << EOF +BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_diskX%n" +BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="a/nice/place/to/put/a/boot_disk%n" +EOF + +cat > $CONFIG << EOF +udev_root="$PWD/udev/" +udev_db="$PWD/udev/.udev.tdb" +udev_rules="$PWD/$RULES" +udev_permissions="$PWD/udev.permissions" +EOF + +mkdir udev + +export ACTION=add +export DEVPATH=block/sda + +../udev block +ls -l udev + +export ACTION=remove +export DEVPATH=block/sda + +../udev block +ls -l udev + + +rm $RULES +rm $CONFIG +rm -rf udev -- cgit v1.2.3-54-g00ecf From a3e6c80049137722cf75d65de8d1e6d5a35bc252 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 21 Apr 2004 20:24:51 -0700 Subject: [PATCH] make dev.d call each directory in the directory chain of the device name, instead of just the whole name. This lets /etc/dev.d/sound/ work better. --- dev_d.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/dev_d.c b/dev_d.c index 81c7013315..97c552647b 100644 --- a/dev_d.c +++ b/dev_d.c @@ -64,20 +64,41 @@ static int run_program(char *name) void dev_d_send(struct udevice *dev, char *subsystem, char *devpath) { char dirname[256]; - char devname[NAME_SIZE]; + char env_devname[NAME_SIZE]; + char *devname; + char *temp; if (udev_dev_d == 0) return; if (dev->type == 'b' || dev->type == 'c') { - strfieldcpy(devname, udev_root); - strfieldcat(devname, dev->name); + strfieldcpy(env_devname, udev_root); + strfieldcat(env_devname, dev->name); } else if (dev->type == 'n') { - strfieldcpy(devname, dev->name); + strfieldcpy(env_devname, dev->name); setenv("DEVPATH", devpath, 1); } - setenv("DEVNAME", devname, 1); - dbg("DEVNAME='%s'", devname); + setenv("DEVNAME", env_devname, 1); + dbg("DEVNAME='%s'", env_devname); + + devname = strdup(dev->name); + if (!devname) { + dbg("out of memory"); + return; + } + + /* Chop the device name up into pieces based on '/' */ + temp = strchr(devname, '/'); + while (temp != NULL) { + *temp = 0x00; + strcpy(dirname, DEVD_DIR); + strfieldcat(dirname, devname); + call_foreach_file(run_program, dirname, DEVD_SUFFIX); + + *temp = '/'; + ++temp; + temp = strchr(temp, '/'); + } strcpy(dirname, DEVD_DIR); strfieldcat(dirname, dev->name); -- cgit v1.2.3-54-g00ecf From da361dd7dfd451153e9dc10866a79de8a9f2f414 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 21 Apr 2004 22:31:17 -0700 Subject: [PATCH] v025 release --- ChangeLog | 43 +++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index abbab093bd..c37e615487 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,46 @@ +Summary of changes from v024 to v025 +============================================ + +: + o devfs.sh-ide-floppy + +: + o DEVNODE -> DEVNAME transition fixes + +Daniel Drake: + o Update writing udev rules docs + +Greg Kroah-Hartman: + o make dev.d call each directory in the directory chain of the device name, instead of just the whole name + o add devd_test script + o add more permissions based on SuSE's recommendations + o added rules for tun and raw devices + o add udev conf.d file + o Switch the default config to point to a directory for the rules and permission files + o update the Red Hat .dev files to work on other distros + o add dbus.dev, pam_console.dev and selinux.dev files for /etc/dev.d/default/ usage + o add hints for red hat users from Leann Ogasawara + o add scripts to run gcov for udev from Leann Ogasawara + o change permissions on udevd test scripts + o Fix build process for users who have LC_ALL set to a non-english language + o Added expanded tests to the test framework from Leann Ogasawara + o added execelent "writing udev rules" document from Daniel Drake + o added rule to put USB printers in their proper places + o added rules for CAPI devices + o added a dev.d alsa script to help people out + o v024 release TAG: v024 + +Kay Sievers: + o fix test regressions + o udev_selinux changes + o udevd test script + o udev_dbus changes + o fix devpath for netdev + +Leann Ogasawara: + o gcov for udev + + Summary of changes from v023 to v024 ============================================ diff --git a/Makefile b/Makefile index dd7de95dc3..7969c0f51d 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 024 +VERSION = 025 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index cacaf2868a..f183f5b3d2 100644 --- a/udev.spec +++ b/udev.spec @@ -34,7 +34,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 024 +Version: 025 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From aef6bb132ef2f5b4c446e42f6050033d4f5c177b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 23 Apr 2004 21:50:27 -0700 Subject: [PATCH] udev default config layout changes Here we catch up, after the default config changes. o the man page is updated to reflect the new default config o /etc/udev/rules.d/ + permissions.d/ dirs are created now o udev.rules is installed in /etc/udev/rules.d/50-udev.rules so the user can easily order the files by prepending a number. (RedHat has the same name in the last rpm.) o defined directory names in the Makefile are all without slashes now, not the first half with and the remaining without. o all binaries are uninstalled now o leading slashes in config values are now removed or prepended while the config is parsed, so we are more robust if the usere changes something. o replaced the macros from udev_config.c with real code, cause we can skip if the value matches and not useless iterate over the remaining fields. o config parsing errors are logged with info() now, fixes the bug where we report a error with debug_parse(), even when there isn't one --- Makefile | 64 ++++++++++++++++++----------------- udev.8.in | 29 ++++++++-------- udev_config.c | 106 +++++++++++++++++++++++++++++++++++----------------------- udev_lib.c | 22 +++++++++++- udev_lib.h | 2 ++ 5 files changed, 137 insertions(+), 86 deletions(-) diff --git a/Makefile b/Makefile index 7969c0f51d..7c716e852e 100644 --- a/Makefile +++ b/Makefile @@ -51,9 +51,9 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin mandir = ${prefix}/usr/share/man hotplugdir = ${etcdir}/hotplug.d/default -configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ -dev_ddir = ${etcdir}/dev.d/ +configdir = ${etcdir}/udev +initdir = ${etcdir}/init.d +dev_ddir = ${etcdir}/dev.d srcdir = . INSTALL = /usr/bin/install -c @@ -228,16 +228,16 @@ GEN_HEADERS = udev_version.h # Rules on how to create the generated header files udev_version.h: - @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ - @echo \#define UDEV_ROOT \"$(udevdir)/\" >> $@ - @echo \#define UDEV_DB \"$(udevdir)/\.udev.tdb\" >> $@ - @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ - @echo \#define UDEV_CONFIG_FILE \"$(configdir)\udev.conf\" >> $@ - @echo \#define UDEV_RULES_FILE \"$(configdir)\udev.rules\" >> $@ - @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ - @echo \#define UDEV_LOG_DEFAULT \"yes\" >> $@ - @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ - @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ + @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ + @echo \#define UDEV_ROOT \"$(udevdir)/\" >> $@ + @echo \#define UDEV_DB \"$(udevdir)/.udev.tdb\" >> $@ + @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ + @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ + @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ + @echo \#define UDEV_PERMISSION_FILE \"$(configdir)/permissions.d\" >> $@ + @echo \#define UDEV_LOG_DEFAULT \"yes\" >> $@ + @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ + @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf @@ -343,29 +343,29 @@ install-initscript: etc/init.d/udev etc/init.d/udev.debian etc/init.d/udev.init. fi install-config: $(GEN_CONFIGS) - $(INSTALL) -d $(DESTDIR)$(configdir) - @if [ ! -r $(DESTDIR)$(configdir)udev.conf ]; then \ + $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d + $(INSTALL) -d $(DESTDIR)$(configdir)/permissions.d + @if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ fi - @if [ ! -r $(DESTDIR)$(configdir)udev.rules ]; then \ - echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir); \ - $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir); \ + @if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \ + echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir)/rules.d/50-udev.rules; \ + $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir)/rules.d/50-udev.rules; \ fi - @if [ ! -r $(DESTDIR)$(configdir)udev.permissions ]; then \ - echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir); \ - $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir); \ + @if [ ! -r $(DESTDIR)$(configdir)/permissions.d/50-udev.permissions ]; then \ + echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir)/permissions.d/50-udev.permissions; \ + $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir)/permissions.d/50-udev.permissions; \ fi install-dev.d: - $(INSTALL) -d $(DESTDIR)$(dev_ddir) - $(INSTALL) -d $(DESTDIR)$(dev_ddir)default/ - $(INSTALL_PROGRAM) -D etc/dev.d/net/hotplug.dev $(DESTDIR)$(dev_ddir)net/hotplug.dev + $(INSTALL) -d $(DESTDIR)$(dev_ddir)/default + $(INSTALL_PROGRAM) -D etc/dev.d/net/hotplug.dev $(DESTDIR)$(dev_ddir)/net/hotplug.dev uninstall-dev.d: - - rm $(dev_ddir)net/hotplug.dev - - rmdir $(dev_ddir)net - - rmdir $(dev_ddir)default + - rm $(dev_ddir)/net/hotplug.dev + - rmdir $(dev_ddir)/net + - rmdir $(dev_ddir)/default - rmdir $(dev_ddir) install-man: @@ -406,16 +406,20 @@ endif uninstall: uninstall-man uninstall-dev.d - rm $(hotplugdir)/udev.hotplug - - rm $(configdir)/udev.permissions - - rm $(configdir)/udev.rules + - rm $(configdir)/rules.d/50-udev.rules + - rm $(configdir)/permissions.d/50-udev.permissions - rm $(configdir)/udev.conf + - rmdir $(configdir)/rules.d + - rmdir $(configdir)/permissions.d + - rmdir $(configdir) - rm $(initdir)/udev - rm $(sbindir)/$(ROOT) - rm $(sbindir)/$(DAEMON) - rm $(sbindir)/$(SENDER) + - rm $(sbindir)/$(STARTER) - rm $(usrbindir)/$(INFO) + - rm $(usrbindir)/$(TESTER) - rmdir $(hotplugdir) - - rmdir $(configdir) - rm $(udevdir)/.udev.tdb - rmdir $(udevdir) @extras="$(EXTRAS)" ; for target in $$extras ; do \ diff --git a/udev.8.in b/udev.8.in index f803578968..6d1dfd9d18 100644 --- a/udev.8.in +++ b/udev.8.in @@ -77,7 +77,7 @@ in this file: .B udev_root Indicates where to place the device nodes in the filesystem. The default value is -.IR @udevdir@ . +.IR @udevdir@/ . .TP .B udev_db The name and location of the udev database. The default value is @@ -87,14 +87,14 @@ The name and location of the udev database. The default value is The name of the udev rules file or directory to look for files with the suffix .IR .rules . All rule files are read in lexical order. The default value is -.IR /etc/udev/udev.rules . +.IR /etc/udev/rules.d/ . .TP .B udev_permissions The name of the udev permission file or directory to look for files with the suffix .IR .permissions . All permission files are read in lexical order. The default value is -.IR /etc/udev/udev.permissions . +.IR /etc/udev/permissions.d/ . .TP .B udev_log The switch, if udev logs some information for every device handled. @@ -121,17 +121,17 @@ file. The default value is .sp .nf # udev_root - where to place the device nodes in the filesystem -udev_root="@udevdir@" +udev_root="/udev" # udev_db - The name and location of the udev database -udev_db="@udevdir@/.udev.tdb" +udev_db="/udev/.udev.tdb" # udev_rules - The name of the udev rules file or directory to look for files with the suffix .rules udev_rules="/etc/udev/rules.d/" -# udev_permissions - The name of the udev permission file or directry to look - for files with the suffix .permissions +# udev_permissions - The name of the udev permission file or directory + to look for files with the suffix .permissions udev_permissions="/etc/udev/udev.permissions" # udev_log - set to "yes" if you want logging, else "no" @@ -150,14 +150,14 @@ default_owner="root" default_group="root" .fi .P -The rules for udev to use when naming devices may specified in -.I /etc/udev/udev.rules -or by the +The rules for device naming, are read from the files located in the +.I /etc/udev/rules.d/ +directory, or at the location specified by the .I udev_rules value in the .I /etc/udev/udev.conf file. -.P +.br Every line in the rules file defines the mapping between device attributes and the device name. One or more keys are specified to match a rule with the current device. If all keys are matching, the rule will be applied and @@ -304,9 +304,10 @@ KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" BUS="usb", SYSFS{model}="XV3", NAME="video%n", SYMLINK="webcam%n" .fi .P -Permissions and ownership for the created device files may specified in -.I /etc/udev/udev.permissions -or by the +The permissions and ownership of the created device file is read from +the files located in the +.I /etc/udev/permissions.d/ +directory, or at the location specified by the .I udev_permission value in the .I /etc/udev/udev.conf diff --git a/udev_config.c b/udev_config.c index ba04003e90..51a91d0092 100644 --- a/udev_config.c +++ b/udev_config.c @@ -84,18 +84,6 @@ static void init_variables(void) udev_dev_d = 0; } -#define set_var(_name, _var) \ - if (strcasecmp(variable, _name) == 0) { \ - dbg_parse("%s='%s'", _name, value); \ - strfieldcpy(_var, value);\ - } - -#define set_bool(_name, _var) \ - if (strcasecmp(variable, _name) == 0) { \ - dbg_parse("%s='%s'", _name, value); \ - _var = string_is_true(value); \ - } - int parse_get_pair(char **orig_string, char **left, char **right) { char *temp; @@ -181,22 +169,58 @@ static int parse_config_file(void) continue; retval = parse_get_pair(&temp, &variable, &value); - if (retval) - break; - - dbg_parse("variable = '%s', value = '%s'", variable, value); - - set_var("udev_root", udev_root); - set_var("udev_db", udev_db_filename); - set_var("udev_rules", udev_rules_filename); - set_var("udev_permissions", udev_permissions_filename); - set_var("default_mode", default_mode_str); - set_var("default_owner", default_owner_str); - set_var("default_group", default_group_str); - set_bool("udev_log", udev_log); + if (retval != 0) + info("%s:%d:%Zd: error parsing '%s'", + udev_config_filename, lineno, temp-line, temp); + + dbg_parse("variable='%s', value='%s'", variable, value); + + if (strcasecmp(variable, "udev_root") == 0) { + strfieldcpy(udev_root, value); + leading_slash(udev_root); + continue; + } + + if (strcasecmp(variable, "udev_db") == 0) { + strfieldcpy(udev_db_filename, value); + continue; + } + + if (strcasecmp(variable, "udev_rules") == 0) { + strfieldcpy(udev_rules_filename, value); + no_leading_slash(udev_rules_filename); + continue; + } + + if (strcasecmp(variable, "udev_permissions") == 0) { + strfieldcpy(udev_permissions_filename, value); + no_leading_slash(udev_permissions_filename); + continue; + } + + if (strcasecmp(variable, "default_mode") == 0) { + strfieldcpy(default_mode_str, value); + continue; + } + + if (strcasecmp(variable, "default_owner") == 0) { + strfieldcpy(default_owner_str, value); + continue; + } + + if (strcasecmp(variable, "default_group") == 0) { + strfieldcpy(default_group_str, value); + continue; + } + + if (strcasecmp(variable, "udev_log") == 0) { + udev_log = string_is_true(value); + continue; + } + + info("%s:%d:%Zd: unknown key '%s'", + udev_config_filename, lineno, temp-line, temp); } - dbg_parse("%s:%d:%Zd: error parsing '%s'", udev_config_filename, - lineno, temp - line, temp); file_unmap(buf, bufsize); return retval; @@ -212,32 +236,34 @@ static void get_dirs(void) dbg("sysfs_get_mnt_path failed"); /* see if we should try to override any of the default values */ - temp = getenv("UDEV_TEST"); - if (temp != NULL) { - /* hm testing is happening, use the specified values, if they are present */ + if (getenv("UDEV_TEST") != NULL) { temp = getenv("SYSFS_PATH"); - if (temp) + if (temp != NULL) { strfieldcpy(sysfs_path, temp); + no_leading_slash(sysfs_path); + } + temp = getenv("UDEV_CONFIG_FILE"); - if (temp) + if (temp != NULL) strfieldcpy(udev_config_filename, temp); } - dbg("sysfs_path='%s'", sysfs_path); + dbg("sysfs_path='%s'", sysfs_path); dbg_parse("udev_root = %s", udev_root); dbg_parse("udev_config_filename = %s", udev_config_filename); dbg_parse("udev_db_filename = %s", udev_db_filename); dbg_parse("udev_rules_filename = %s", udev_rules_filename); dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); dbg_parse("udev_log = %d", udev_log); + parse_config_file(); - dbg_parse("udev_root = %s", udev_root); - dbg_parse("udev_config_filename = %s", udev_config_filename); - dbg_parse("udev_db_filename = %s", udev_db_filename); - dbg_parse("udev_rules_filename = %s", udev_rules_filename); - dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); - dbg_parse("udev_log_str = %d", udev_log); + dbg("udev_root = %s", udev_root); + dbg("udev_config_filename = %s", udev_config_filename); + dbg("udev_db_filename = %s", udev_db_filename); + dbg("udev_rules_filename = %s", udev_rules_filename); + dbg("udev_permissions_filename = %s", udev_permissions_filename); + dbg("udev_log_str = %d", udev_log); } void udev_init_config(void) @@ -245,5 +271,3 @@ void udev_init_config(void) init_variables(); get_dirs(); } - - diff --git a/udev_lib.c b/udev_lib.c index 381492db01..16b473f576 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -152,6 +152,26 @@ size_t buf_get_line(char *buf, size_t buflen, size_t cur) return count - cur; } +void leading_slash(char *path) +{ + int len; + + len = strlen(path); + if (len > 0 && path[len-1] != '/') { + path[len] = '/'; + path[len+1] = '\0'; + } +} + +void no_leading_slash(char *path) +{ + int len; + + len = strlen(path); + if (len > 0 && path[len-1] == '/') + path[len-1] = '\0'; +} + struct files { struct list_head list; char name[NAME_SIZE]; @@ -180,7 +200,7 @@ static int file_list_insert(char *filename, struct list_head *file_list) return 0; } -/* calls function for file or every file found in directory */ +/* calls function for every file found in specified directory */ int call_foreach_file(int fnct(char *f) , char *dirname, char *suffix) { struct dirent *ent; diff --git a/udev_lib.h b/udev_lib.h index cc264fa9b4..18ce25ccc7 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -75,6 +75,8 @@ extern char get_device_type(const char *path, const char *subsystem); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); +extern void leading_slash(char *path); +extern void no_leading_slash(char *path); extern int call_foreach_file(int fnct(char *f) , char *filename, char *extension); -- cgit v1.2.3-54-g00ecf From e13fa59953d64e478025fd1200bb5fd0baf671b2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 23 Apr 2004 21:55:57 -0700 Subject: [PATCH] udevstart: close open directories. Based on a munged patch from Olaf Hering --- udevstart.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/udevstart.c b/udevstart.c index 5e6606d535..1d9b60464c 100644 --- a/udevstart.c +++ b/udevstart.c @@ -130,10 +130,13 @@ static void udev_scan(void) udev_exec(filename, "block"); } } + closedir(dir3); } } + closedir(dir2); } } + closedir(dir); } devpath = "class"; @@ -176,10 +179,13 @@ static void udev_scan(void) udev_exec(filename, dent->d_name); } } + closedir(dir3); } } + closedir(dir2); } } + closedir(dir); } } -- cgit v1.2.3-54-g00ecf From 3611d5820c0fc0863d15c04884b05c9e04492f45 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 30 Apr 2004 23:26:33 -0700 Subject: [PATCH] udev callout for reading filesystem labels here is a small udev toy, which enables udev to name partitions by its filesystem label or uuid's. The following udev rule: KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -M%M -m%m -u", SYMLINK="%c" creates a symlink with the uuid read from the filesystem. If no label or uuid is found the program exits with nonzero and the rule will fail. ext2, ext3, reiserfs, xfs, jfs, vfat, msdos volume labels are supported, ntfs and swap partitions can be recognized. It's possible to compile with klibc and the static binary takes 13kb. --- extras/volume_id/Makefile | 50 ++++ extras/volume_id/udev_volume_id.c | 120 +++++++++ extras/volume_id/volume_id.c | 550 ++++++++++++++++++++++++++++++++++++++ extras/volume_id/volume_id.h | 72 +++++ 4 files changed, 792 insertions(+) create mode 100644 extras/volume_id/Makefile create mode 100644 extras/volume_id/udev_volume_id.c create mode 100644 extras/volume_id/volume_id.c create mode 100644 extras/volume_id/volume_id.h diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile new file mode 100644 index 0000000000..6a3d2866c4 --- /dev/null +++ b/extras/volume_id/Makefile @@ -0,0 +1,50 @@ +# Makefile for udev_volume_id +# +# Copyright (C) 2004 Kay Sievers +# +# 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. +# + +PROG = udev_volume_id + +all: $(PROG) + +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin +mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +override CFLAGS+=-Wall -fno-builtin +OBJS = volume_id.o udev_volume_id.o +HEADERS = volume_id.h + +$(OBJS): $(HEADERS) + +$(PROG): $(OBJS) $(HEADERS) + $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + +install: all + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(usrsbindir)/$(PROG) + +uninstall: + - rm $(DESTDIR)$(usrsbindir)/$(PROG) + diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c new file mode 100644 index 0000000000..88779ccd36 --- /dev/null +++ b/extras/volume_id/udev_volume_id.c @@ -0,0 +1,120 @@ +/* + * udev_volume_id - udev callout to read filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * sample udev rule for creation of a symlink with the filsystem uuid: + * KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -M%M -m%m -u", SYMLINK="%c" + * + * 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 02139, USA. + * + */ + +#include +#include +#include + +#include "volume_id.h" + +int main(int argc, char *argv[]) +{ + struct volume_id *vid; + const char help[] = "usage: udev_volume_id -m -M [-t|-l|-u]\n"; + int major = -1; + int minor = -1; + char *tail; + static const char short_options[] = "M:m:htlu"; + int option; + char print = '\0'; + int rc; + + + while (1) { + option = getopt(argc, argv, short_options); + if (option == -1) + break; + + switch (option) { + case 'M': + major = (int) strtoul(optarg, &tail, 10); + if (tail[0] != '\0') { + printf("invalid major\n"); + exit(1); + } + break; + case 'm': + minor = (int) strtoul(optarg, &tail, 10); + if (tail[0] != '\0') { + printf("invalid minor\n"); + exit(1); + } + break; + case 't': + print = 't'; + break; + case 'l': + print = 'l'; + break; + case 'u': + print = 'u'; + break; + case 'h': + case '?': + default: + printf(help); + exit(1); + } + } + + if (major == -1 || minor == -1) { + printf(help); + exit(1); + } + + vid = volume_id_open_dev_t(makedev(major, minor)); + if (vid == NULL) { + printf("error open volume\n"); + exit(1); + } + + rc = volume_id_probe(vid, ALL); + if (rc != 0) { + printf("error probing volume\n"); + exit(1); + } + + switch (print) { + case 't': + printf("%s\n", vid->fs_name); + break; + case 'l': + if (vid->label_string[0] == '\0') + exit(2); + printf("%s\n", vid->label_string); + break; + case 'u': + if (vid->uuid_string[0] == '\0') + exit(2); + printf("%s\n", vid->uuid_string); + break; + default: + printf("T:%s\n", vid->fs_name); + printf("L:%s\n", vid->label_string); + printf("U:%s\n", vid->uuid_string); + } + + volume_id_close(vid); + + exit(0); +} diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c new file mode 100644 index 0000000000..cc5475fc8d --- /dev/null +++ b/extras/volume_id/volume_id.c @@ -0,0 +1,550 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * The superblock structs are taken from the libblkid living inside + * the e2fsprogs. This is a simple straightforward implementation for + * reading the label strings of only the most common filesystems. + * If you need a full featured library with attribute caching, support for + * much more partition/media types or non-root data access, you may have + * a look at: + * http://e2fsprogs.sourceforge.net. + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" + + +#define bswap32(x) (__u32)((((__u32)(x) & 0xff000000u) >> 24) | \ + (((__u32)(x) & 0x00ff0000u) >> 8) | \ + (((__u32)(x) & 0x0000ff00u) << 8) | \ + (((__u32)(x) & 0x000000ffu) << 24)) + +#if (__BYTE_ORDER == __LITTLE_ENDIAN) +#define cpu_to_le32(x) (x) +#elif (__BYTE_ORDER == __BIG_ENDIAN) +#define cpu_to_le32(x) bswap32(x) +#endif + +#define VOLUME_ID_BUFFER_SIZE 0x11000 /* reiser offset is 64k */ + + +static void set_label(struct volume_id *id, char *buf, int count) +{ + int i; + + memcpy(id->label, buf, count); + + memcpy(id->label_string, buf, count); + + /* remove trailing whitespace */ + i = strlen(id->label_string); + while (i--) { + if (! isspace(id->label_string[i])) + break; + } + id->label_string[i+1] = '\0'; +} + +static void set_uuid(struct volume_id *id, unsigned char *buf, int count) +{ + int i; + + memcpy(id->uuid, buf, count); + + /* create string if uuid is set */ + for (i = 0; i < count; i++) + if (buf[i] != 0) + goto set; + return; + +set: + switch(count) { + case 4: + sprintf(id->uuid_string, "%02X%02X-%02X%02X", + buf[3], buf[2], buf[1], buf[0]); + break; + case 16: + sprintf(id->uuid_string, + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], + buf[6], buf[7], + buf[8], buf[9], + buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); + break; + } +} + +static int open_superblock(struct volume_id *id) +{ + /* get buffer to read the first block */ + if (id->buf == NULL) { + id->buf = malloc(VOLUME_ID_BUFFER_SIZE); + if (id->buf == NULL) + return -1; + } + + /* try to read the first 64k, but at least the first block */ + memset(id->buf, 0x00, VOLUME_ID_BUFFER_SIZE); + lseek(id->fd, 0, SEEK_SET); + if (read(id->fd, id->buf, VOLUME_ID_BUFFER_SIZE) < 0x200) + return -1; + + return 0; +} + +static void close_superblock(struct volume_id *id) +{ + if (id->buf != NULL) { + free(id->buf); + id->buf = NULL; + } +} + +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 +#define EXT_SUPERBLOCK_OFFSET 0x400 +static int probe_ext(struct volume_id *id) +{ + struct ext2_super_block { + __u32 s_inodes_count; + __u32 s_blocks_count; + __u32 s_r_blocks_count; + __u32 s_free_blocks_count; + __u32 s_free_inodes_count; + __u32 s_first_data_block; + __u32 s_log_block_size; + __u32 s_dummy3[7]; + unsigned char s_magic[2]; + __u16 s_state; + __u32 s_dummy5[8]; + __u32 s_feature_compat; + __u32 s_feature_incompat; + __u32 s_feature_ro_compat; + unsigned char s_uuid[16]; + char s_volume_name[16]; + } *es; + + es = (struct ext2_super_block *) (id->buf + EXT_SUPERBLOCK_OFFSET); + + if (es->s_magic[0] != 0123 || + es->s_magic[1] != 0357) + return -1; + + set_label(id, es->s_volume_name, 16); + set_uuid(id, es->s_uuid, 16); + + if ((cpu_to_le32(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) { + id->fs_type = EXT3; + id->fs_name = "ext3"; + } else { + id->fs_type = EXT2; + id->fs_name = "ext2"; + } + + return 0; +} + +#define REISER1_SUPERBLOCK_OFFSET 0x2000 +#define REISER_SUPERBLOCK_OFFSET 0x10000 +static int probe_reiser(struct volume_id *id) +{ + struct reiser_super_block { + __u32 rs_blocks_count; + __u32 rs_free_blocks; + __u32 rs_root_block; + __u32 rs_journal_block; + __u32 rs_journal_dev; + __u32 rs_orig_journal_size; + __u32 rs_dummy2[5]; + __u16 rs_blocksize; + __u16 rs_dummy3[3]; + unsigned char rs_magic[12]; + __u32 rs_dummy4[5]; + unsigned char rs_uuid[16]; + char rs_label[16]; + } *rs; + + rs = (struct reiser_super_block *) &(id->buf[REISER1_SUPERBLOCK_OFFSET]); + + if (strncmp(rs->rs_magic, "ReIsErFs", 8) == 0) + goto found; + + rs = (struct reiser_super_block *) &(id->buf[REISER_SUPERBLOCK_OFFSET]); + + if (strncmp(rs->rs_magic, "ReIsEr2Fs", 9) == 0) + goto found; + if (strncmp(rs->rs_magic, "ReIsEr3Fs", 9) == 0) + goto found; + + return -1; + +found: + set_label(id, rs->rs_label, 16); + set_uuid(id, rs->rs_uuid, 16); + + id->fs_type = REISER; + id->fs_name = "reiser"; + + return 0; +} + +static int probe_xfs(struct volume_id *id) +{ + struct xfs_super_block { + unsigned char xs_magic[4]; + __u32 xs_blocksize; + __u64 xs_dblocks; + __u64 xs_rblocks; + __u32 xs_dummy1[2]; + unsigned char xs_uuid[16]; + __u32 xs_dummy2[15]; + char xs_fname[12]; + __u32 xs_dummy3[2]; + __u64 xs_icount; + __u64 xs_ifree; + __u64 xs_fdblocks; + } *xs; + + xs = (struct xfs_super_block *) id->buf; + + if (strncmp(xs->xs_magic, "XFSB", 4) != 0) + return -1; + + set_label(id, xs->xs_fname, 12); + set_uuid(id, xs->xs_uuid, 16); + + id->fs_type = XFS; + id->fs_name = "xfs"; + + return 0; +} + +#define JFS_SUPERBLOCK_OFFSET 0x8000 +static int probe_jfs(struct volume_id *id) +{ + struct jfs_super_block { + unsigned char js_magic[4]; + __u32 js_version; + __u64 js_size; + __u32 js_bsize; + __u32 js_dummy1; + __u32 js_pbsize; + __u32 js_dummy2[27]; + unsigned char js_uuid[16]; + unsigned char js_label[16]; + unsigned char js_loguuid[16]; + } *js; + + js = (struct jfs_super_block *) &(id->buf[JFS_SUPERBLOCK_OFFSET]); + + if (strncmp(js->js_magic, "JFS1", 4) != 0) + return -1; + + set_label(id, js->js_label, 16); + set_uuid(id, js->js_uuid, 16); + + id->fs_type = JFS; + id->fs_name = "jfs"; + + return 0; +} + +static int probe_vfat(struct volume_id *id) +{ + struct vfat_super_block { + unsigned char vs_ignored[3]; + unsigned char vs_sysid[8]; + unsigned char vs_sector_size[2]; + __u8 vs_cluster_size; + __u16 vs_reserved; + __u8 vs_fats; + unsigned char vs_dir_entries[2]; + unsigned char vs_sectors[2]; + unsigned char vs_media; + __u16 vs_fat_length; + __u16 vs_secs_track; + __u16 vs_heads; + __u32 vs_hidden; + __u32 vs_total_sect; + __u32 vs_fat32_length; + __u16 vs_flags; + __u8 vs_version[2]; + __u32 vs_root_cluster; + __u16 vs_insfo_sector; + __u16 vs_backup_boot; + __u16 vs_reserved2[6]; + unsigned char vs_unknown[3]; + unsigned char vs_serno[4]; + char vs_label[11]; + unsigned char vs_magic[8]; + unsigned char vs_dummy2[164]; + unsigned char vs_pmagic[2]; + } *vs; + + vs = (struct vfat_super_block *) id->buf; + + if (strncmp(vs->vs_magic, "MSWIN", 5) == 0) + goto found; + if (strncmp(vs->vs_magic, "FAT32 ", 8) == 0) + goto found; + return -1; + +found: + memcpy(id->label, vs->vs_label, 11); + memcpy(id->uuid, vs->vs_serno, 4); + + id->fs_type = VFAT; + id->fs_name = "vfat"; + + return 0; +} + +static int probe_msdos(struct volume_id *id) +{ + struct msdos_super_block { + unsigned char ms_ignored[3]; + unsigned char ms_sysid[8]; + unsigned char ms_sector_size[2]; + __u8 ms_cluster_size; + __u16 ms_reserved; + __u8 ms_fats; + unsigned char ms_dir_entries[2]; + unsigned char ms_sectors[2]; + unsigned char ms_media; + __u16 ms_fat_length; + __u16 ms_secs_track; + __u16 ms_heads; + __u32 ms_hidden; + __u32 ms_total_sect; + unsigned char ms_unknown[3]; + unsigned char ms_serno[4]; + char ms_label[11]; + unsigned char ms_magic[8]; + unsigned char ms_dummy2[192]; + unsigned char ms_pmagic[2]; + } *ms; + + ms = (struct msdos_super_block *) id->buf; + + if (strncmp(ms->ms_magic, "MSDOS", 5) == 0) + goto found; + if (strncmp(ms->ms_magic, "FAT16 ", 8) == 0) + goto found; + if (strncmp(ms->ms_magic, "FAT12 ", 8) == 0) + goto found; + return -1; + +found: + set_label(id, ms->ms_label, 11); + set_uuid(id, ms->ms_serno, 4); + + id->fs_type = MSDOS; + id->fs_name = "msdos"; + + return 0; +} + +static int probe_ntfs(struct volume_id *id) +{ + struct ntfs_super_block { + char jump[3]; + char oem_id[4]; + } *ns; + + ns = (struct ntfs_super_block *) id->buf; + + if (strncmp(ns->oem_id, "NTFS", 4) != 0) + return -1; + + id->fs_type = NTFS; + id->fs_name = "ntfs"; + + return 0; +} + +static int probe_swap(struct volume_id *id) +{ + int magic; + + /* huhh, the swap signature is on the end of the PAGE_SIZE */ + for (magic = 0x1000; magic <= 0x4000; magic <<= 1) { + if (strncmp(&(id->buf[magic -10]), "SWAP-SPACE", 10) == 0) + goto found; + if (strncmp(&(id->buf[magic -10]), "SWAPSPACE2", 10) == 0) + goto found; + } + return -1; + +found: + id->fs_type = SWAP; + id->fs_name = "swap"; + + return 0; +} + +/* probe volume for filesystem type and try to read label+uuid */ +int volume_id_probe(struct volume_id *id, enum filesystem_type fs_type) +{ + int rc; + + if (id == NULL) + return -EINVAL; + + if (open_superblock(id) != 0) + return -EACCES; + + switch (fs_type) { + case EXT3: + case EXT2: + rc = probe_ext(id); + break; + case REISER: + rc = probe_reiser(id); + break; + case XFS: + rc = probe_xfs(id); + break; + case JFS: + rc = probe_jfs(id); + break; + case MSDOS: + rc = probe_msdos(id); + break; + case VFAT: + rc = probe_vfat(id); + break; + case NTFS: + rc = probe_ntfs(id); + break; + case SWAP: + rc = probe_swap(id); + break; + default: + rc = probe_ext(id); + if (rc == 0) + break; + rc = probe_reiser(id); + if (rc == 0) + break; + rc = probe_xfs(id); + if (rc == 0) + break; + rc = probe_jfs(id); + if (rc == 0) + break; + rc = probe_msdos(id); + if (rc == 0) + break; + rc = probe_vfat(id); + if (rc == 0) + break; + rc = probe_ntfs(id); + if (rc == 0) + break; + rc = probe_swap(id); + if (rc == 0) + break; + rc = -1; + } + + if (rc == 0) + close_superblock(id); + + return rc; +} + +/* open volume by already open file descriptor */ +struct volume_id *volume_id_open_fd(int fd) +{ + struct volume_id *id; + + id = malloc(sizeof(struct volume_id)); + if (id == NULL) + return NULL; + memset(id, 0x00, sizeof(struct volume_id)); + + id->fd = fd; + + return id; +} + +/* open volume by device node */ +struct volume_id *volume_id_open_node(const char *path) +{ + struct volume_id *id; + int fd; + + fd = open(path, O_RDONLY); + if (fd < 0) + return NULL; + + id = volume_id_open_fd(fd); + if (id == NULL) + return NULL; + + /* close fd on device close */ + id->fd_close = 1; + + return id; +} + +/* open volume by major/minor */ +struct volume_id *volume_id_open_dev_t(dev_t devt) +{ + struct volume_id *id; + char tmp_node[VOLUME_ID_PATH_MAX]; + + snprintf(tmp_node, VOLUME_ID_PATH_MAX, + "/tmp/volume-%u-%u", major(devt), minor(devt)); + tmp_node[VOLUME_ID_PATH_MAX] = '\0'; + + /* create tempory node to open the block device */ + if (mknod(tmp_node, (S_IFBLK | 0600), devt) != 0) + return NULL; + + id = volume_id_open_node(tmp_node); + + unlink(tmp_node); + + return id; +} + +/* free allocated volume info */ +void volume_id_close(struct volume_id *id) +{ + if (id == NULL) + return; + + if (id->fd_close != 0) + close(id->fd); + + close_superblock(id); + + free(id); +} diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h new file mode 100644 index 0000000000..a0d2acda22 --- /dev/null +++ b/extras/volume_id/volume_id.h @@ -0,0 +1,72 @@ +/* + * volume_id - reads partition label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + +#ifndef _VOLUME_ID_H_ +#define _VOLUME_ID_H_ + +#define VOLUME_ID_VERSION 001 + +#define VOLUME_ID_LABEL_SIZE 16 +#define VOLUME_ID_UUID_SIZE 16 +#define VOLUME_ID_UUID_STRING_SIZE 37 +#define VOLUME_ID_PATH_MAX 255 + + +enum filesystem_type { + ALL, + EXT2, + EXT3, + REISER, + XFS, + JFS, + MSDOS, + VFAT, + NTFS, + SWAP +}; + +struct volume_id { + char label[VOLUME_ID_LABEL_SIZE]; + char label_string[VOLUME_ID_LABEL_SIZE+1]; + unsigned char uuid[VOLUME_ID_UUID_SIZE]; + char uuid_string[VOLUME_ID_UUID_STRING_SIZE]; + enum filesystem_type fs_type; + char *fs_name; + int fd; + char *buf; + int fd_close; +}; + +/* open volume by already open file descriptor */ +extern struct volume_id *volume_id_open_fd(int fd); + +/* open volume by device node */ +extern struct volume_id *volume_id_open_node(const char *path); + +/* open volume by major/minor */ +extern struct volume_id *volume_id_open_dev_t(dev_t devt); + +/* probe volume for filesystem type and try to read label/uuid */ +extern int volume_id_probe(struct volume_id *id, enum filesystem_type fs_type); + +/* free allocated device info */ +extern void volume_id_close(struct volume_id *id); + +#endif -- cgit v1.2.3-54-g00ecf From 599b626127f420236b8757a1e9bccc8b07081a01 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 5 May 2004 22:21:48 -0700 Subject: [PATCH] udev callout for reading filesystem labels On Fri, Apr 30, 2004 at 03:29:54PM -0700, Greg KH wrote: > On Thu, Apr 29, 2004 at 11:04:46PM +0200, Kay Sievers wrote: > > Hi, > > here is a small udev toy, which enables udev to name partitions by > > its filesystem label or uuid's. > > > > The following udev rule: > > > > KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -M%M -m%m -u", SYMLINK="%c" > > > > creates a symlink with the uuid read from the filesystem. If no label or > > uuid is found the program exits with nonzero and the rule will fail. > > > > ext2, ext3, reiserfs, xfs, jfs, vfat, msdos volume labels are supported, > > ntfs and swap partitions can be recognized. > > > > It's possible to compile with klibc and the static binary takes 13kb. > > Very nice, I was wondering who was going to use that library to make > such a tool. This is even better as we can use klibc for it. Here is a update, which supports iso9660 and udf labels. Not very useful in the udev case, but I've added it for hal, so we just catch up with the latest version. --- extras/volume_id/volume_id.c | 672 +++++++++++++++++++++++++++++++------------ extras/volume_id/volume_id.h | 53 ++-- 2 files changed, 525 insertions(+), 200 deletions(-) diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index cc5475fc8d..8eba4b22f2 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -11,19 +11,19 @@ * a look at: * http://e2fsprogs.sourceforge.net. * - * 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 library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * - * 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 02139, USA. + * This library 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 + * Lesser General Public License for more details. * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include @@ -38,6 +38,17 @@ #include "volume_id.h" +#ifdef DEBUG +#define dbg(format, arg...) \ + do { \ + printf("%s: " format "\n", __FUNCTION__ , ## arg); \ + } while (0) +#else +#define dbg(format, arg...) do {} while (0) +#endif + +#define bswap16(x) (__u16)((((__u16)(x) & 0x00ffu) << 8) | \ + (((__u32)(x) & 0xff00u) >> 8)) #define bswap32(x) (__u32)((((__u32)(x) & 0xff000000u) >> 24) | \ (((__u32)(x) & 0x00ff0000u) >> 8) | \ @@ -45,19 +56,28 @@ (((__u32)(x) & 0x000000ffu) << 24)) #if (__BYTE_ORDER == __LITTLE_ENDIAN) -#define cpu_to_le32(x) (x) +#define le16_to_cpu(x) (x) +#define le32_to_cpu(x) (x) #elif (__BYTE_ORDER == __BIG_ENDIAN) -#define cpu_to_le32(x) bswap32(x) +#define le16_to_cpu(x) bswap16(x) +#define le32_to_cpu(x) bswap32(x) #endif -#define VOLUME_ID_BUFFER_SIZE 0x11000 /* reiser offset is 64k */ +/* size of superblock buffer, reiser block is at 64k */ +#define SB_BUFFER_SIZE 0x11000 +/* size of seek buffer 2k */ +#define SEEK_BUFFER_SIZE 0x800 -static void set_label(struct volume_id *id, char *buf, int count) +static void set_label_raw(struct volume_id *id, char *buf, int count) { - int i; + memcpy(id->label_raw, buf, count); + id->label_raw_len = count; +} - memcpy(id->label, buf, count); +static void set_label_string(struct volume_id *id, char *buf, int count) +{ + int i; memcpy(id->label_string, buf, count); @@ -90,7 +110,8 @@ set: break; case 16: sprintf(id->uuid_string, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" + "%02x%02x%02x%02x%02x%02x", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], @@ -100,29 +121,67 @@ set: } } -static int open_superblock(struct volume_id *id) +static char *get_buffer(struct volume_id *id, size_t off, size_t len) { - /* get buffer to read the first block */ - if (id->buf == NULL) { - id->buf = malloc(VOLUME_ID_BUFFER_SIZE); - if (id->buf == NULL) - return -1; + size_t buf_len; + + /* check if requested area fits in superblock buffer */ + if (off + len <= SB_BUFFER_SIZE) { + if (id->sbbuf == NULL) { + id->sbbuf = malloc(SB_BUFFER_SIZE); + if (id->sbbuf == NULL) + return NULL; + } + + /* check if we need to read */ + if ((off + len) > id->sbbuf_len) { + dbg("read sbbuf len:0x%x", off + len); + lseek(id->fd, 0, SEEK_SET); + buf_len = read(id->fd, id->sbbuf, off + len); + id->sbbuf_len = buf_len; + if (buf_len < off + len) + return NULL; + } + + return &(id->sbbuf[off]); + } else { + if (len > SEEK_BUFFER_SIZE) + len = SEEK_BUFFER_SIZE; + + /* get seek buffer */ + if (id->seekbuf == NULL) { + id->seekbuf = malloc(SEEK_BUFFER_SIZE); + if (id->seekbuf == NULL) + return NULL; + } + + /* check if we need to read */ + if ((off < id->seekbuf_off) || + ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { + dbg("read seekbuf off:0x%x len:0x%x", off, len); + lseek(id->fd, off, SEEK_SET); + buf_len = read(id->fd, id->seekbuf, len); + id->seekbuf_off = off; + id->seekbuf_len = buf_len; + if (buf_len < len) + return NULL; + } + + return &(id->seekbuf[off - id->seekbuf_off]); } - - /* try to read the first 64k, but at least the first block */ - memset(id->buf, 0x00, VOLUME_ID_BUFFER_SIZE); - lseek(id->fd, 0, SEEK_SET); - if (read(id->fd, id->buf, VOLUME_ID_BUFFER_SIZE) < 0x200) - return -1; - - return 0; } -static void close_superblock(struct volume_id *id) +static void free_buffer(struct volume_id *id) { - if (id->buf != NULL) { - free(id->buf); - id->buf = NULL; + if (id->sbbuf != NULL) { + free(id->sbbuf); + id->sbbuf = NULL; + id->sbbuf_len = 0; + } + if (id->seekbuf != NULL) { + free(id->seekbuf); + id->seekbuf = NULL; + id->seekbuf_len = 0; } } @@ -132,34 +191,39 @@ static void close_superblock(struct volume_id *id) static int probe_ext(struct volume_id *id) { struct ext2_super_block { - __u32 s_inodes_count; - __u32 s_blocks_count; - __u32 s_r_blocks_count; - __u32 s_free_blocks_count; - __u32 s_free_inodes_count; - __u32 s_first_data_block; - __u32 s_log_block_size; - __u32 s_dummy3[7]; - unsigned char s_magic[2]; - __u16 s_state; - __u32 s_dummy5[8]; - __u32 s_feature_compat; - __u32 s_feature_incompat; - __u32 s_feature_ro_compat; - unsigned char s_uuid[16]; - char s_volume_name[16]; + __u32 inodes_count; + __u32 blocks_count; + __u32 r_blocks_count; + __u32 free_blocks_count; + __u32 free_inodes_count; + __u32 first_data_block; + __u32 log_block_size; + __u32 dummy3[7]; + unsigned char magic[2]; + __u16 state; + __u32 dummy5[8]; + __u32 feature_compat; + __u32 feature_incompat; + __u32 feature_ro_compat; + unsigned char uuid[16]; + char volume_name[16]; } *es; - es = (struct ext2_super_block *) (id->buf + EXT_SUPERBLOCK_OFFSET); + es = (struct ext2_super_block *) + get_buffer(id, EXT_SUPERBLOCK_OFFSET, 0x200); + if (es == NULL) + return -1; - if (es->s_magic[0] != 0123 || - es->s_magic[1] != 0357) + if (es->magic[0] != 0123 || + es->magic[1] != 0357) return -1; - set_label(id, es->s_volume_name, 16); - set_uuid(id, es->s_uuid, 16); + set_label_raw(id, es->volume_name, 16); + set_label_string(id, es->volume_name, 16); + set_uuid(id, es->uuid, 16); - if ((cpu_to_le32(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) { + if ((le32_to_cpu(es->feature_compat) & + EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) { id->fs_type = EXT3; id->fs_name = "ext3"; } else { @@ -175,38 +239,45 @@ static int probe_ext(struct volume_id *id) static int probe_reiser(struct volume_id *id) { struct reiser_super_block { - __u32 rs_blocks_count; - __u32 rs_free_blocks; - __u32 rs_root_block; - __u32 rs_journal_block; - __u32 rs_journal_dev; - __u32 rs_orig_journal_size; - __u32 rs_dummy2[5]; - __u16 rs_blocksize; - __u16 rs_dummy3[3]; - unsigned char rs_magic[12]; - __u32 rs_dummy4[5]; - unsigned char rs_uuid[16]; - char rs_label[16]; + __u32 blocks_count; + __u32 free_blocks; + __u32 root_block; + __u32 journal_block; + __u32 journal_dev; + __u32 orig_journal_size; + __u32 dummy2[5]; + __u16 blocksize; + __u16 dummy3[3]; + unsigned char magic[12]; + __u32 dummy4[5]; + unsigned char uuid[16]; + char label[16]; } *rs; - rs = (struct reiser_super_block *) &(id->buf[REISER1_SUPERBLOCK_OFFSET]); + rs = (struct reiser_super_block *) + get_buffer(id, REISER_SUPERBLOCK_OFFSET, 0x200); + if (rs == NULL) + return -1; - if (strncmp(rs->rs_magic, "ReIsErFs", 8) == 0) + if (strncmp(rs->magic, "ReIsEr2Fs", 9) == 0) + goto found; + if (strncmp(rs->magic, "ReIsEr3Fs", 9) == 0) goto found; - rs = (struct reiser_super_block *) &(id->buf[REISER_SUPERBLOCK_OFFSET]); + rs = (struct reiser_super_block *) + get_buffer(id, REISER1_SUPERBLOCK_OFFSET, 0x200); + if (rs == NULL) + return -1; - if (strncmp(rs->rs_magic, "ReIsEr2Fs", 9) == 0) - goto found; - if (strncmp(rs->rs_magic, "ReIsEr3Fs", 9) == 0) + if (strncmp(rs->magic, "ReIsErFs", 8) == 0) goto found; return -1; found: - set_label(id, rs->rs_label, 16); - set_uuid(id, rs->rs_uuid, 16); + set_label_raw(id, rs->label, 16); + set_label_string(id, rs->label, 16); + set_uuid(id, rs->uuid, 16); id->fs_type = REISER; id->fs_name = "reiser"; @@ -217,27 +288,30 @@ found: static int probe_xfs(struct volume_id *id) { struct xfs_super_block { - unsigned char xs_magic[4]; - __u32 xs_blocksize; - __u64 xs_dblocks; - __u64 xs_rblocks; - __u32 xs_dummy1[2]; - unsigned char xs_uuid[16]; - __u32 xs_dummy2[15]; - char xs_fname[12]; - __u32 xs_dummy3[2]; - __u64 xs_icount; - __u64 xs_ifree; - __u64 xs_fdblocks; + unsigned char magic[4]; + __u32 blocksize; + __u64 dblocks; + __u64 rblocks; + __u32 dummy1[2]; + unsigned char uuid[16]; + __u32 dummy2[15]; + char fname[12]; + __u32 dummy3[2]; + __u64 icount; + __u64 ifree; + __u64 fdblocks; } *xs; - xs = (struct xfs_super_block *) id->buf; + xs = (struct xfs_super_block *) get_buffer(id, 0, 0x200); + if (xs == NULL) + return -1; - if (strncmp(xs->xs_magic, "XFSB", 4) != 0) + if (strncmp(xs->magic, "XFSB", 4) != 0) return -1; - set_label(id, xs->xs_fname, 12); - set_uuid(id, xs->xs_uuid, 16); + set_label_raw(id, xs->fname, 12); + set_label_string(id, xs->fname, 12); + set_uuid(id, xs->uuid, 16); id->fs_type = XFS; id->fs_name = "xfs"; @@ -249,25 +323,29 @@ static int probe_xfs(struct volume_id *id) static int probe_jfs(struct volume_id *id) { struct jfs_super_block { - unsigned char js_magic[4]; - __u32 js_version; - __u64 js_size; - __u32 js_bsize; - __u32 js_dummy1; - __u32 js_pbsize; - __u32 js_dummy2[27]; - unsigned char js_uuid[16]; - unsigned char js_label[16]; - unsigned char js_loguuid[16]; + unsigned char magic[4]; + __u32 version; + __u64 size; + __u32 bsize; + __u32 dummy1; + __u32 pbsize; + __u32 dummy2[27]; + unsigned char uuid[16]; + unsigned char label[16]; + unsigned char loguuid[16]; } *js; - js = (struct jfs_super_block *) &(id->buf[JFS_SUPERBLOCK_OFFSET]); + js = (struct jfs_super_block *) + get_buffer(id, JFS_SUPERBLOCK_OFFSET, 0x200); + if (js == NULL) + return -1; - if (strncmp(js->js_magic, "JFS1", 4) != 0) + if (strncmp(js->magic, "JFS1", 4) != 0) return -1; - set_label(id, js->js_label, 16); - set_uuid(id, js->js_uuid, 16); + set_label_raw(id, js->label, 16); + set_label_string(id, js->label, 16); + set_uuid(id, js->uuid, 16); id->fs_type = JFS; id->fs_name = "jfs"; @@ -278,46 +356,49 @@ static int probe_jfs(struct volume_id *id) static int probe_vfat(struct volume_id *id) { struct vfat_super_block { - unsigned char vs_ignored[3]; - unsigned char vs_sysid[8]; - unsigned char vs_sector_size[2]; - __u8 vs_cluster_size; - __u16 vs_reserved; - __u8 vs_fats; - unsigned char vs_dir_entries[2]; - unsigned char vs_sectors[2]; - unsigned char vs_media; - __u16 vs_fat_length; - __u16 vs_secs_track; - __u16 vs_heads; - __u32 vs_hidden; - __u32 vs_total_sect; - __u32 vs_fat32_length; - __u16 vs_flags; - __u8 vs_version[2]; - __u32 vs_root_cluster; - __u16 vs_insfo_sector; - __u16 vs_backup_boot; - __u16 vs_reserved2[6]; - unsigned char vs_unknown[3]; - unsigned char vs_serno[4]; - char vs_label[11]; - unsigned char vs_magic[8]; - unsigned char vs_dummy2[164]; - unsigned char vs_pmagic[2]; + unsigned char ignored[3]; + unsigned char sysid[8]; + unsigned char sector_size[2]; + __u8 cluster_size; + __u16 reserved; + __u8 fats; + unsigned char dir_entries[2]; + unsigned char sectors[2]; + unsigned char media; + __u16 fat_length; + __u16 secs_track; + __u16 heads; + __u32 hidden; + __u32 total_sect; + __u32 fat32_length; + __u16 flags; + __u8 version[2]; + __u32 root_cluster; + __u16 insfo_sector; + __u16 backup_boot; + __u16 reserved2[6]; + unsigned char unknown[3]; + unsigned char serno[4]; + char label[11]; + unsigned char magic[8]; + unsigned char dummy2[164]; + unsigned char pmagic[2]; } *vs; - vs = (struct vfat_super_block *) id->buf; + vs = (struct vfat_super_block *) get_buffer(id, 0, 0x200); + if (vs == NULL) + return -1; - if (strncmp(vs->vs_magic, "MSWIN", 5) == 0) + if (strncmp(vs->magic, "MSWIN", 5) == 0) goto found; - if (strncmp(vs->vs_magic, "FAT32 ", 8) == 0) + if (strncmp(vs->magic, "FAT32 ", 8) == 0) goto found; return -1; found: - memcpy(id->label, vs->vs_label, 11); - memcpy(id->uuid, vs->vs_serno, 4); + set_label_raw(id, vs->label, 11); + set_label_string(id, vs->label, 11); + set_uuid(id, vs->serno, 4); id->fs_type = VFAT; id->fs_name = "vfat"; @@ -328,41 +409,44 @@ found: static int probe_msdos(struct volume_id *id) { struct msdos_super_block { - unsigned char ms_ignored[3]; - unsigned char ms_sysid[8]; - unsigned char ms_sector_size[2]; - __u8 ms_cluster_size; - __u16 ms_reserved; - __u8 ms_fats; - unsigned char ms_dir_entries[2]; - unsigned char ms_sectors[2]; - unsigned char ms_media; - __u16 ms_fat_length; - __u16 ms_secs_track; - __u16 ms_heads; - __u32 ms_hidden; - __u32 ms_total_sect; - unsigned char ms_unknown[3]; - unsigned char ms_serno[4]; - char ms_label[11]; - unsigned char ms_magic[8]; - unsigned char ms_dummy2[192]; - unsigned char ms_pmagic[2]; + unsigned char ignored[3]; + unsigned char sysid[8]; + unsigned char sector_size[2]; + __u8 cluster_size; + __u16 reserved; + __u8 fats; + unsigned char dir_entries[2]; + unsigned char sectors[2]; + unsigned char media; + __u16 fat_length; + __u16 secs_track; + __u16 heads; + __u32 hidden; + __u32 total_sect; + unsigned char unknown[3]; + unsigned char serno[4]; + char label[11]; + unsigned char magic[8]; + unsigned char dummy2[192]; + unsigned char pmagic[2]; } *ms; - ms = (struct msdos_super_block *) id->buf; + ms = (struct msdos_super_block *) get_buffer(id, 0, 0x200); + if (ms == NULL) + return -1; - if (strncmp(ms->ms_magic, "MSDOS", 5) == 0) + if (strncmp(ms->magic, "MSDOS", 5) == 0) goto found; - if (strncmp(ms->ms_magic, "FAT16 ", 8) == 0) + if (strncmp(ms->magic, "FAT16 ", 8) == 0) goto found; - if (strncmp(ms->ms_magic, "FAT12 ", 8) == 0) + if (strncmp(ms->magic, "FAT12 ", 8) == 0) goto found; return -1; found: - set_label(id, ms->ms_label, 11); - set_uuid(id, ms->ms_serno, 4); + set_label_raw(id, ms->label, 11); + set_label_string(id, ms->label, 11); + set_uuid(id, ms->serno, 4); id->fs_type = MSDOS; id->fs_name = "msdos"; @@ -370,6 +454,218 @@ found: return 0; } +#define UDF_VSD_OFFSET 0x8000 +static int probe_udf(struct volume_id *id) +{ + struct volume_descriptor { + struct descriptor_tag { + __u16 id; + __u16 version; + unsigned char checksum; + unsigned char reserved; + __u16 serial; + __u16 crc; + __u16 crc_len; + __u32 location; + } tag; + union { + struct anchor_descriptor { + __u32 length; + __u32 location; + } anchor; + struct primary_descriptor { + __u32 seq_num; + __u32 desc_num; + struct dstring { + char clen; + char c[31]; + } ident; + } primary; + } type; + } *vd; + + struct volume_structure_descriptor { + unsigned char type; + char id[5]; + unsigned char version; + } *vsd; + + size_t bs; + size_t b; + int type; + int count; + int loc; + int clen; + int i,j; + int c; + + vsd = (struct volume_structure_descriptor *) + get_buffer(id, UDF_VSD_OFFSET, 0x200); + if (vsd == NULL) + return -1; + + if (strncmp(vsd->id, "NSR02", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "NSR03", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "BEA01", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "BOOT2", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "CD001", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "CDW02", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "TEA03", 5) == 0) + goto blocksize; + return -1; + +blocksize: + /* search the next VSD to get the logical block size of the volume */ + for (bs = 0x800; bs < 0x8000; bs += 0x800) { + vsd = (struct volume_structure_descriptor *) + get_buffer(id, UDF_VSD_OFFSET + bs, 0x800); + if (vsd == NULL) + return -1; + dbg("test for blocksize: 0x%x", bs); + if (vsd->id[0] != '\0') + goto nsr; + } + return -1; + +nsr: + /* search the list of VSDs for a NSR descriptor */ + for (b = 0; b < 64; b++) { + vsd = (struct volume_structure_descriptor *) + get_buffer(id, UDF_VSD_OFFSET + (b * bs), 0x800); + if (vsd == NULL) + return -1; + + dbg("vsd: %c%c%c%c%c", + vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); + + if (vsd->id[0] == '\0') + return -1; + if (strncmp(vsd->id, "NSR02", 5) == 0) + goto anchor; + if (strncmp(vsd->id, "NSR03", 5) == 0) + goto anchor; + } + return -1; + +anchor: + /* read anchor volume descriptor */ + vd = (struct volume_descriptor *) get_buffer(id, 256 * bs, 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + if (type != 2) /* TAG_ID_AVDP */ + goto found; + + /* get desriptor list address and block count */ + count = le32_to_cpu(vd->type.anchor.length) / bs; + loc = le32_to_cpu(vd->type.anchor.location); + dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); + + /* pick the primary descriptor from the list */ + for (b = 0; b < count; b++) { + vd = (struct volume_descriptor *) + get_buffer(id, (loc + b) * bs, 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + dbg("descriptor type %i", type); + + /* check validity */ + if (type == 0) + goto found; + if (le32_to_cpu(vd->tag.location) != loc + b) + goto found; + + if (type == 1) /* TAG_ID_PVD */ + goto pvd; + } + goto found; + +pvd: + set_label_raw(id, &(vd->type.primary.ident.clen), 32); + + clen = vd->type.primary.ident.clen; + dbg("label string charsize=%i bit", clen); + if (clen == 8) { + set_label_string(id, vd->type.primary.ident.c, 31); + } else if (clen == 16) { + /* convert unicode OSTA dstring to UTF-8 */ + j = 0; + for (i = 0; i < 32; i += 2) { + c = (vd->type.primary.ident.c[i] << 8) | + vd->type.primary.ident.c[i+1]; + if (c == 0) { + id->label_string[j] = '\0'; + break; + }else if (c < 0x80U) { + id->label_string[j++] = (char) c; + } else if (c < 0x800U) { + id->label_string[j++] = (char) (0xc0 | (c >> 6)); + id->label_string[j++] = (char) (0x80 | (c & 0x3f)); + } else { + id->label_string[j++] = (char) (0xe0 | (c >> 12)); + id->label_string[j++] = (char) (0x80 | ((c >> 6) & 0x3f)); + id->label_string[j++] = (char) (0x80 | (c & 0x3f)); + } + } + } + +found: + id->fs_type = UDF; + id->fs_name = "udf"; + + return 0; +} + +#define ISO_SUPERBLOCK_OFFSET 0x8000 +static int probe_iso9660(struct volume_id *id) +{ + union iso_super_block { + struct iso_header { + unsigned char type; + char id[5]; + unsigned char version; + unsigned char unused1; + char system_id[32]; + char volume_id[32]; + } iso; + struct hs_header { + char foo[8]; + unsigned char type; + char id[4]; + unsigned char version; + } hs; + } *is; + + is = (union iso_super_block *) + get_buffer(id, ISO_SUPERBLOCK_OFFSET, 0x200); + if (is == NULL) + return -1; + + if (strncmp(is->iso.id, "CD001", 5) == 0) { + set_label_raw(id, is->iso.volume_id, 32); + set_label_string(id, is->iso.volume_id, 32); + goto found; + } + if (strncmp(is->hs.id, "CDROM", 5) == 0) + goto found; + return -1; + +found: + id->fs_type = ISO9660; + id->fs_name = "iso9660"; + + return 0; +} + static int probe_ntfs(struct volume_id *id) { struct ntfs_super_block { @@ -377,7 +673,9 @@ static int probe_ntfs(struct volume_id *id) char oem_id[4]; } *ns; - ns = (struct ntfs_super_block *) id->buf; + ns = (struct ntfs_super_block *) get_buffer(id, 0, 0x200); + if (ns == NULL) + return -1; if (strncmp(ns->oem_id, "NTFS", 4) != 0) return -1; @@ -388,15 +686,21 @@ static int probe_ntfs(struct volume_id *id) return 0; } +#define LARGEST_PAGESIZE 0x4000 static int probe_swap(struct volume_id *id) { - int magic; + char *sig; + size_t page; /* huhh, the swap signature is on the end of the PAGE_SIZE */ - for (magic = 0x1000; magic <= 0x4000; magic <<= 1) { - if (strncmp(&(id->buf[magic -10]), "SWAP-SPACE", 10) == 0) + for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { + sig = get_buffer(id, page-10, 10); + if (sig == NULL) + return -1; + + if (strncmp(sig, "SWAP-SPACE", 10) == 0) goto found; - if (strncmp(&(id->buf[magic -10]), "SWAPSPACE2", 10) == 0) + if (strncmp(sig, "SWAPSPACE2", 10) == 0) goto found; } return -1; @@ -416,9 +720,6 @@ int volume_id_probe(struct volume_id *id, enum filesystem_type fs_type) if (id == NULL) return -EINVAL; - if (open_superblock(id) != 0) - return -EACCES; - switch (fs_type) { case EXT3: case EXT2: @@ -439,13 +740,22 @@ int volume_id_probe(struct volume_id *id, enum filesystem_type fs_type) case VFAT: rc = probe_vfat(id); break; + case UDF: + rc = probe_udf(id); + break; + case ISO9660: + rc = probe_iso9660(id); + break; case NTFS: rc = probe_ntfs(id); break; case SWAP: rc = probe_swap(id); break; + case ALL: default: + /* fill buffer with maximum */ + get_buffer(id, 0, SB_BUFFER_SIZE); rc = probe_ext(id); if (rc == 0) break; @@ -462,6 +772,12 @@ int volume_id_probe(struct volume_id *id, enum filesystem_type fs_type) if (rc == 0) break; rc = probe_vfat(id); + if (rc == 0) + break; + rc = probe_udf(id); + if (rc == 0) + break; + rc = probe_iso9660(id); if (rc == 0) break; rc = probe_ntfs(id); @@ -473,8 +789,10 @@ int volume_id_probe(struct volume_id *id, enum filesystem_type fs_type) rc = -1; } + /* If the filestystem in recognized, we free the allocated buffers, + otherwise they will stay in place for the possible next probe call */ if (rc == 0) - close_superblock(id); + free_buffer(id); return rc; } @@ -544,7 +862,7 @@ void volume_id_close(struct volume_id *id) if (id->fd_close != 0) close(id->fd); - close_superblock(id); + free_buffer(id); free(id); } diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h index a0d2acda22..2f20244c7c 100644 --- a/extras/volume_id/volume_id.h +++ b/extras/volume_id/volume_id.h @@ -3,27 +3,27 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 02139, USA. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 001 +#define VOLUME_ID_VERSION 002 -#define VOLUME_ID_LABEL_SIZE 16 +#define VOLUME_ID_LABEL_SIZE 32 #define VOLUME_ID_UUID_SIZE 16 #define VOLUME_ID_UUID_STRING_SIZE 37 #define VOLUME_ID_PATH_MAX 255 @@ -38,20 +38,27 @@ enum filesystem_type { JFS, MSDOS, VFAT, + UDF, + ISO9660, NTFS, SWAP }; struct volume_id { - char label[VOLUME_ID_LABEL_SIZE]; - char label_string[VOLUME_ID_LABEL_SIZE+1]; - unsigned char uuid[VOLUME_ID_UUID_SIZE]; - char uuid_string[VOLUME_ID_UUID_STRING_SIZE]; - enum filesystem_type fs_type; - char *fs_name; - int fd; - char *buf; - int fd_close; + char label_raw[VOLUME_ID_LABEL_SIZE]; + size_t label_raw_len; + char label_string[VOLUME_ID_LABEL_SIZE+1]; + unsigned char uuid[VOLUME_ID_UUID_SIZE]; + char uuid_string[VOLUME_ID_UUID_STRING_SIZE]; + enum filesystem_type fs_type; + char *fs_name; + int fd; + char *sbbuf; + size_t sbbuf_len; + char *seekbuf; + size_t seekbuf_off; + size_t seekbuf_len; + int fd_close; }; /* open volume by already open file descriptor */ -- cgit v1.2.3-54-g00ecf From 7f639ff99e3857870e4e0f41843dff7ad48ad784 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 5 May 2004 22:32:05 -0700 Subject: [PATCH] add udev.permissions.slackware file. From Lucas de Souza Santos --- etc/udev/udev.permissions.slackware | 133 ++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 etc/udev/udev.permissions.slackware diff --git a/etc/udev/udev.permissions.slackware b/etc/udev/udev.permissions.slackware new file mode 100644 index 0000000000..2edc1aaa53 --- /dev/null +++ b/etc/udev/udev.permissions.slackware @@ -0,0 +1,133 @@ +#name:user:group:mode +pl2303:500:500:0666 +visor:root:uucp:0666 +camera*:500:500:0666 + +# console devices +console:root:tty:0600 +tty[0-9][0-9]*:root:tty:0666 +vcs*:root:tty:0620 +tty[CIS]*:root:uucp:0660 +ttyUB[0-9]:root:uucp:0660 +ttyUSB0:root:uucp:0660 +ttyUSB1:root:uucp:0666 + +# pty devices +ptmx:root:tty:0666 +pty[p-za-e][0-9a-f]*:root:tty:0666 +tty[p-za-e][0-9a-f]*:root:tty:0666 +cu[abiu]*:root:uucp:0660 + +# sound devices +audio*:root:sys:0662 +beep:root:root:0644 +dsp*:root:sys:0662 +midi*:root:sys:0662 +mixer*:root:sys:0666 +music:root:sys:0662 +sequencer*:root:sys:0662 +snd/*:root:root:0666 +sndstat:root:sys:0662 +speaker:root:root:0644 +sound/*:root:root:0666 +admmidi*:root:root:0666 +adsp*:root:root:0666 +aload*:root:root:0666 +amidi*:root:root:0666 +amixer*:root:root:0666 + +# input devices (mouse, joystick, etc) +input/*:root:root:0644 +input/js*:root:games:0666 +djs[0-3]:root:games:0660 +psaux:root:sys:0660 +crash:roor:root:0660 +logibm:root:sys:0660 +jbm:root:sys:0660 +hwtrap:root:root:0644 +inportbm:root:sys:0660 +sexec:root:root:0660 +jsflash:roo:root:0660 + +# power manager device +apm_bios:root:root:0644 + +# printer device +lp[0-9]:root:lp:0660 +parport*:root:root:0660 + +# video devices +dri/card[0-9]*:root:root:0666 +fb[0-9]:root:tty:0660 +agpgart:root:root:0660 +nvidia*:root:root:0666 +video*:root:sys:0660 + +# DISK devices +ed[ab]*:root:disk:0640 +gscd0:root:disk:0640 +initrd:root:disk:0640 +lmscd:root:disk:0640 +mcd*:root:disk:0640 +md*:root:disk:0660 +mtd*:root:disk:0640 +userdma:root:root:0660 + +# floppy devices +fd[0-3]*:root:floppy:0660 + +# IDE devices (hd, cdrom) +hd*:root:disk:0660 +ht0:root:disk:0640 + +# RAID IDE +ataraid[0-9]*:root:disk:0660 +ataraid/*:root:disk:0660 + +# SCSI devices +scsi/*/cd:root:disk:0660 +scsi/*:root:disk:0660 +sd[a-h]*:root:disk:0640 +s[rt][0-9]*:root:disk:0640 +scd*:root:disk:0660 + +# generic scsi devices +sg*:root:root:0600 + +# old CD-ROM +sbpcd*:root:disk:0640 + +# loop devices +loop[0-9]*:root:disk:0660 + +# network block devices +nb[0-7]:root:disk:0660 +nht0:root:disk:0640 +npt[0-3]:root:disk:0660 +n[qrs]*:root:disk:0640 + +# memory access devices +kmem:root:kmem:0640 +mem:root:kmem:0640 +null:root:sys:0666 +nvram:root:root:0640 +port:root:kmem:0640 +ram[0-9]*:root:disk:0640 +random:root:root:0644 +rtc:root:root:0444 +urandom:root:root:0644 +full:root:sys:0666 +zero:root:root:0664 +raw/*:root:disk:0660 +modreq:root:root:0644 +msr:root:root:0660 +profile*:root:root:0640 + +# ISDN devices +isdn*:root:tty:0660 + +# net devices +ippp*:root:root:0644 +ipstate:root:root:0660 +spx:root:root:0644 +fwmonitor:root:root:0660 -- cgit v1.2.3-54-g00ecf From cde5a756ce10530136b8d387346c48260a69dbfb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 12 May 2004 00:52:52 -0700 Subject: [PATCH] udev_volume_id update Here is a update to extras/volume_id/* o The device is now specified by the DEVPATH in the environment, it's no longer needed to pass the major/minor to the callout. o leading spaces and slashes are now removed from the returned string and spaces are replaced by underscore, to not to confuse udev. o Arnd Bergmann provided the code to recognize s390 dasd disk labels. The -d switch tries to read the main block device instead of the partition. --- extras/volume_id/Makefile | 17 +++- extras/volume_id/README | 49 +++++++++ extras/volume_id/dasdlabel.c | 178 ++++++++++++++++++++++++++++++++ extras/volume_id/dasdlabel.h | 26 +++++ extras/volume_id/s390-dasd.rules | 7 ++ extras/volume_id/udev_volume_id.c | 206 +++++++++++++++++++++++++++++--------- extras/volume_id/volume_id.c | 5 +- 7 files changed, 437 insertions(+), 51 deletions(-) create mode 100644 extras/volume_id/README create mode 100644 extras/volume_id/dasdlabel.c create mode 100644 extras/volume_id/dasdlabel.h create mode 100644 extras/volume_id/s390-dasd.rules diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 6a3d2866c4..307fdc2f16 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -1,6 +1,6 @@ # Makefile for udev_volume_id # -# Copyright (C) 2004 Kay Sievers +# Copyright (C) 2004 Kay Sievers # # 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 @@ -29,8 +29,19 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} override CFLAGS+=-Wall -fno-builtin -OBJS = volume_id.o udev_volume_id.o -HEADERS = volume_id.h + +SYSFS = ../../libsysfs/sysfs_bus.o \ + ../../libsysfs/sysfs_class.o \ + ../../libsysfs/sysfs_device.o \ + ../../libsysfs/sysfs_dir.o \ + ../../libsysfs/sysfs_driver.o \ + ../../libsysfs/sysfs_utils.o \ + ../../libsysfs/dlist.o + + + +OBJS = volume_id.o udev_volume_id.o dasdlabel.o $(SYSFS) +HEADERS = volume_id.h dasdlabel.h $(OBJS): $(HEADERS) diff --git a/extras/volume_id/README b/extras/volume_id/README new file mode 100644 index 0000000000..9d881a1a05 --- /dev/null +++ b/extras/volume_id/README @@ -0,0 +1,49 @@ + +udev_volume_id - partition, filesystem, disklabel reader + +This program is normally called from a udev rule, to provide udev with the +name, uuid or the filesystem type of a partition to name a device node. +udev_volume_id opens the blockdevice specified by the environment variable +DEVPATH and searches for a filesystem superblock to read the label. The +following commandline switches are supported to specify what udev_volume_id +should print to stdout: + + no option prints all values + -h prints help text + -l prints the label of the partition + -u prints the uuid of the partition + -d read disk instead of partition + +If -d is specified udev_volume_id tries to read the label from the main +block device where the partition belongs to. For now this is only useful +for s390 dasd labels. + +udev_volume_id will only return successful if the string asked for, is not +empty. All trailing whitespace will be removed, spaces replaced by underscore +and slashes ignored. + +The following rule will create a symlink named with the label string: + KERNEL="[hs]d*", PROGRAM="/sbin/udev_volume_id -l", SYMLINK="%c" + +If no label is found udev_volume_id exits with nonzero and the rule will be +ignored. + +To give it a try, you may call it on the commandline: + + [root@pim udev.kay]# DEVPATH=/block/hda/hda3 extras/volume_id/udev_volume_id + T:ext3 + L:Music Store + N:Music_Store + U:d2da42b5-bbd9-44eb-a72c-cc4542fcb71e + + [root@pim udev.kay]# DEVPATH=/block/hda/hda3 extras/volume_id/udev_volume_id -l + Music_Store + + [root@pim udev.kay]# DEVPATH=/block/hda/hda1 extras/volume_id/udev_volume_id -t + swap + + +Please send any comment/questions/concerns to me or: + linux-hotplug-devel@lists.sourceforge.net + +Kay Sievers diff --git a/extras/volume_id/dasdlabel.c b/extras/volume_id/dasdlabel.c new file mode 100644 index 0000000000..cbbe88179d --- /dev/null +++ b/extras/volume_id/dasdlabel.c @@ -0,0 +1,178 @@ +/* + * dasdlabel - read label from s390 block device + * + * Copyright (C) 2004 Arnd Bergmann + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include + +#include "dasdlabel.h" + +static unsigned char EBCtoASC[256] = +{ +/* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ + 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, +/* 0x08 -GE -SPS -RPT VT FF CR SO SI */ + 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, +/* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC + -ENP ->LF */ + 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, +/* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB + -IUS */ + 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +/* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC + -INP */ + 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, +/* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL + -SW */ + 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, +/* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ + 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, +/* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ + 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, +/* 0x40 SP RSP ä ---- */ + 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, +/* 0x48 . < ( + | */ + 0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, +/* 0x50 & ---- */ + 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, +/* 0x58 ß ! $ * ) ; */ + 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, +/* 0x60 - / ---- Ä ---- ---- ---- */ + 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, +/* 0x68 ---- , % _ > ? */ + 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, +/* 0x70 --- ---- ---- ---- ---- ---- ---- */ + 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +/* 0x78 * ` : # @ ' = " */ + 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, +/* 0x80 * a b c d e f g */ + 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, +/* 0x88 h i ---- ---- ---- */ + 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, +/* 0x90 ° j k l m n o p */ + 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, +/* 0x98 q r ---- ---- */ + 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, +/* 0xA0 ~ s t u v w x */ + 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, +/* 0xA8 y z ---- ---- ---- ---- */ + 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, +/* 0xB0 ^ ---- § ---- */ + 0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, +/* 0xB8 ---- [ ] ---- ---- ---- ---- */ + 0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07, +/* 0xC0 { A B C D E F G */ + 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, +/* 0xC8 H I ---- ö ---- */ + 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, +/* 0xD0 } J K L M N O P */ + 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, +/* 0xD8 Q R ---- ü */ + 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, +/* 0xE0 \ S T U V W X */ + 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, +/* 0xE8 Y Z ---- Ö ---- ---- ---- */ + 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, +/* 0xF0 0 1 2 3 4 5 6 7 */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, +/* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ + 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 +}; + +static void vtoc_ebcdic_dec (unsigned char *source, unsigned char *target, int l) +{ + int i; + + for (i = 0; i < l; i++) + target[i]=EBCtoASC[(unsigned char)(source[i])]; +} + +/* + * struct dasd_information_t + * represents any data about the data, which is visible to userspace + */ +typedef struct dasd_information_t { + unsigned int devno; /* S/390 devno */ + unsigned int real_devno; /* for aliases */ + unsigned int schid; /* S/390 subchannel identifier */ + unsigned int cu_type : 16; /* from SenseID */ + unsigned int cu_model : 8; /* from SenseID */ + unsigned int dev_type : 16; /* from SenseID */ + unsigned int dev_model : 8; /* from SenseID */ + unsigned int open_count; + unsigned int req_queue_len; + unsigned int chanq_len; /* length of chanq */ + char type[4]; /* from discipline.name, 'none' for unknown */ + unsigned int status; /* current device level */ + unsigned int label_block; /* where to find the VOLSER */ + unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ + unsigned int characteristics_size; + unsigned int confdata_size; + char characteristics[64]; /* from read_device_characteristics */ + char configuration_data[256]; /* from read_configuration_data */ +} dasd_information_t; + +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 14 +#define _IOC_DIRBITS 2 +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) +#define DASD_IOCTL_LETTER 'D' + +#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) +#define BLKSSZGET _IO(0x12,104) + +int probe_ibm_partition(int fd, char *out) +{ + int blocksize; + dasd_information_t info; + char name[7] = {0,}; + unsigned char data[16]; + + if (ioctl(fd, BIODASDINFO, (unsigned long)&info) != 0) + return -1; + + if (ioctl(fd, BLKSSZGET, (unsigned long)&blocksize)) + return -1; + + lseek(fd, info.label_block * blocksize, SEEK_SET); + if (read(fd, &data, 16) != 16) + return -1; + + if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) + strncpy(name, data + 8, 6); + else + strncpy(name, data + 4, 6); + + vtoc_ebcdic_dec(name, out, 6); + + return 0; +} diff --git a/extras/volume_id/dasdlabel.h b/extras/volume_id/dasdlabel.h new file mode 100644 index 0000000000..1501d3ff89 --- /dev/null +++ b/extras/volume_id/dasdlabel.h @@ -0,0 +1,26 @@ +/* + * dasdlabel - read label from s390 block device + * + * Copyright (C) 2004 Arnd Bergmann + * + * 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 02139, USA. + * + */ + +#ifndef _DASDLABEL_H_ +#define _DASDLABEL_H_ + +extern int probe_ibm_partition(int fd, char *out); + +#endif diff --git a/extras/volume_id/s390-dasd.rules b/extras/volume_id/s390-dasd.rules new file mode 100644 index 0000000000..a870d87e04 --- /dev/null +++ b/extras/volume_id/s390-dasd.rules @@ -0,0 +1,7 @@ +# s390 block devices named by disk label +KERNEL="dasd*[a-z]", PROGRAM="/sbin/udev_volume_id -d -l" RESULT="[0-9A-Z]*", SYMLINK="dasd/%c/disc dasd/%b/disc" +KERNEL="dasd*[0-9]", PROGRAM="/sbin/udev_volume_id -d -l" RESULT="[0-9A-Z]*", SYMLINK="dasd/%c/part%n dasd/%b/part%n" +KERNEL="dasd*[a-z]", SYMLINK="dasd/%b/disc" +KERNEL="dasd*[0-9]", SYMLINK="dasd/%b/part%n" +KERNEL="dcssblk*", NAME="%k", SYMLINK="dcssblk/%b" + diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 88779ccd36..18915cb62b 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -4,7 +4,7 @@ * Copyright (C) 2004 Kay Sievers * * sample udev rule for creation of a symlink with the filsystem uuid: - * KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -M%M -m%m -u", SYMLINK="%c" + * KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -u", SYMLINK="%c" * * 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 @@ -24,21 +24,75 @@ #include #include #include +#include +#include "../../libsysfs/sysfs/libsysfs.h" +#include "../../udev_lib.h" +#include "../../logging.h" #include "volume_id.h" +#include "dasdlabel.h" -int main(int argc, char *argv[]) +#ifdef LOG +unsigned char logname[LOGNAME_SIZE]; +void log_message(int level, const char *format, ...) +{ + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif + +static struct volume_id *open_classdev(struct sysfs_class_device *class_dev) { struct volume_id *vid; - const char help[] = "usage: udev_volume_id -m -M [-t|-l|-u]\n"; - int major = -1; - int minor = -1; - char *tail; - static const char short_options[] = "M:m:htlu"; - int option; - char print = '\0'; - int rc; + struct sysfs_attribute *attr; + int major, minor; + + attr = sysfs_get_classdev_attr(class_dev, "dev"); + + if (attr == NULL) { + printf("error reading 'dev' attribute\n"); + return NULL; + } + + if (sscanf(attr->value, "%u:%u", &major, &minor) != 2) { + printf("error getting major/minor number\n"); + return NULL; + } + + vid = volume_id_open_dev_t(makedev(major, minor)); + if (vid == NULL) { + printf("error open volume\n"); + return NULL; + } + + return vid; +} +int main(int argc, char *argv[]) +{ + const char help[] = "usage: udev_volume_id [-t|-l|-u|-d]\n" + " -t filesystem type\n" + " -l filesystem label\n" + " -u filesystem uuid\n" + " -d disk label from main device\n" + "\n"; + static const char short_options[] = "htlud"; + int option; + char sysfs_path[SYSFS_PATH_MAX]; + char dev_path[SYSFS_PATH_MAX]; + struct sysfs_class_device *class_dev = NULL; + struct sysfs_class_device *class_dev_parent = NULL; + struct volume_id *vid = NULL; + char *devpath; + char probe = 'p'; + char print = 'a'; + char dasd_label[7]; + static char name[VOLUME_ID_LABEL_SIZE]; + int len, i, j; + int rc = 1; while (1) { option = getopt(argc, argv, short_options); @@ -46,29 +100,18 @@ int main(int argc, char *argv[]) break; switch (option) { - case 'M': - major = (int) strtoul(optarg, &tail, 10); - if (tail[0] != '\0') { - printf("invalid major\n"); - exit(1); - } - break; - case 'm': - minor = (int) strtoul(optarg, &tail, 10); - if (tail[0] != '\0') { - printf("invalid minor\n"); - exit(1); - } - break; case 't': print = 't'; - break; + continue; case 'l': print = 'l'; - break; + continue; case 'u': print = 'u'; - break; + continue; + case 'd': + probe = 'd'; + continue; case 'h': case '?': default: @@ -77,44 +120,115 @@ int main(int argc, char *argv[]) } } - if (major == -1 || minor == -1) { - printf(help); - exit(1); + devpath = getenv("DEVPATH"); + if (devpath == NULL) { + printf("error DEVPATH empty\n"); + goto exit; } - vid = volume_id_open_dev_t(makedev(major, minor)); - if (vid == NULL) { - printf("error open volume\n"); - exit(1); + if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) { + printf("error getting sysfs mount path\n"); + goto exit; + } + + strfieldcpy(dev_path, sysfs_path); + strfieldcat(dev_path, devpath); + + class_dev = sysfs_open_class_device_path(dev_path); + if (class_dev == NULL) { + printf("error getting class device\n"); + goto exit; } - rc = volume_id_probe(vid, ALL); - if (rc != 0) { - printf("error probing volume\n"); - exit(1); + switch(probe) { + case 'p' : + /* open block device */ + vid = open_classdev(class_dev); + if (vid == NULL) + goto exit; + if (volume_id_probe(vid, ALL) == 0) + goto print; + break; + case 'd' : + /* if we are on a partition, close it and open main block device */ + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent != NULL) { + volume_id_close(vid); + vid = open_classdev(class_dev_parent); + } else { + vid = open_classdev(class_dev_parent); + } + if (vid == NULL) + goto exit; + if (probe_ibm_partition(vid->fd, dasd_label) == 0) { + vid->fs_name = "dasd"; + strncpy(vid->label_string, dasd_label, 6); + vid->label_string[6] = '\0'; + goto print; + } + break; } + printf("unknown volume type\n"); + goto exit; + + +print: + len = strnlen(vid->label_string, VOLUME_ID_LABEL_SIZE); + + /* remove trailing spaces */ + while (len > 0 && isspace(vid->label_string[len-1])) + len--; + name[len] = '\0'; + + /* substitute chars */ + i = 0; + j = 0; + while (j < len) { + switch(vid->label_string[j]) { + case '/' : + break; + case ' ' : + name[i++] = '_'; + break; + default : + name[i++] = vid->label_string[j]; + } + j++; + } + name[i] = '\0'; + switch (print) { case 't': printf("%s\n", vid->fs_name); break; case 'l': - if (vid->label_string[0] == '\0') - exit(2); - printf("%s\n", vid->label_string); + if (name[0] == '\0') { + rc = 2; + goto exit; + } + printf("%s\n", name); break; case 'u': - if (vid->uuid_string[0] == '\0') - exit(2); + if (vid->uuid_string[0] == '\0') { + rc = 2; + goto exit; + } printf("%s\n", vid->uuid_string); break; - default: + case 'a': printf("T:%s\n", vid->fs_name); printf("L:%s\n", vid->label_string); + printf("N:%s\n", name); printf("U:%s\n", vid->uuid_string); } + rc = 0; - volume_id_close(vid); +exit: + if (class_dev != NULL) + sysfs_close_class_device(class_dev); + if (vid != NULL) + volume_id_close(vid); - exit(0); + exit(rc); } diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index 8eba4b22f2..dcc341c4dd 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -82,7 +82,7 @@ static void set_label_string(struct volume_id *id, char *buf, int count) memcpy(id->label_string, buf, count); /* remove trailing whitespace */ - i = strlen(id->label_string); + i = strnlen(id->label_string, count); while (i--) { if (! isspace(id->label_string[i])) break; @@ -839,10 +839,11 @@ struct volume_id *volume_id_open_dev_t(dev_t devt) char tmp_node[VOLUME_ID_PATH_MAX]; snprintf(tmp_node, VOLUME_ID_PATH_MAX, - "/tmp/volume-%u-%u", major(devt), minor(devt)); + "/tmp/volume-%u-%u-%u", getpid(), major(devt), minor(devt)); tmp_node[VOLUME_ID_PATH_MAX] = '\0'; /* create tempory node to open the block device */ + unlink(tmp_node); if (mknod(tmp_node, (S_IFBLK | 0600), devt) != 0) return NULL; -- cgit v1.2.3-54-g00ecf From d7a4f62d3d2a9c13239131da57d23e85eab23529 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 14 May 2004 23:03:15 -0700 Subject: [PATCH] Deleted the udev_dbus extra as it didn't really work properly and HAL has a real solution now. --- extras/dbus/Makefile | 68 ------- extras/dbus/dbus-listen-test.py | 26 --- .../etc/dbus-1/system.d/udev_sysbus_policy.conf | 23 --- extras/dbus/udev_dbus.c | 195 --------------------- 4 files changed, 312 deletions(-) delete mode 100644 extras/dbus/Makefile delete mode 100644 extras/dbus/dbus-listen-test.py delete mode 100644 extras/dbus/etc/dbus-1/system.d/udev_sysbus_policy.conf delete mode 100644 extras/dbus/udev_dbus.c diff --git a/extras/dbus/Makefile b/extras/dbus/Makefile deleted file mode 100644 index 0cfc650c4b..0000000000 --- a/extras/dbus/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# Makefile for udev_dbus -# -# Copyright (C) 2004 Greg Kroah-Hartman -# -# 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. -# - -# Set the following to `true' to log the debug -# and make a unstripped, unoptimized binary. -# Leave this set to `false' for production use. -DEBUG = false - -PROG = udev_dbus - -all: $(PROG) - -# override this to make udev look in a different location for it's config files -prefix = -exec_prefix = ${prefix} -etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin -mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default -dbusdir = ${etcdir}/dbus-1/system.d -configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ -srcdir = . - -INSTALL = /usr/bin/install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} - -override CFLAGS+=-Wall -fno-builtin - -override CFLAGS += -DUSE_DBUS -override CFLAGS += $(shell pkg-config --cflags dbus-1) -override LDFLAGS += $(shell pkg-config --libs dbus-1) -OBJS = udev_dbus.o - -$(PROG): $(OBJS) - $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) ../../udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) - -clean: - rm -f $(PROG) $(OBJS) - -spotless: clean - - -install-dbus-policy: - $(INSTALL) -d $(DESTDIR)$(dbusdir) - -uninstall-dbus-policy: - - rm $(DESTDIR)$(dbusdir)/udev_sysbus_policy.conf - -install: install-dbus-policy all - $(INSTALL_DATA) etc/dbus-1/system.d/udev_sysbus_policy.conf $(DESTDIR)$(dbusdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(usrsbindir)/$(PROG) - - ln -s -f $(DESTDIR)$(usrsbindir)/$(PROG) $(DESTDIR)$(devddir)/$(PROG).dev - -uninstall: uninstall-dbus-policy - - rm $(DESTDIR)$(devddir)/$(PROG).dev - - rm $(DESTDIR)$(usrsbindir)/$(PROG) - diff --git a/extras/dbus/dbus-listen-test.py b/extras/dbus/dbus-listen-test.py deleted file mode 100644 index 6a68b5d2aa..0000000000 --- a/extras/dbus/dbus-listen-test.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/python - -# receives and prints the messages udev_dbus sent -# to the org.kernel.udev.NodeMonitor interface - -import dbus -import gtk - -def udev_signal_received(dbus_iface, member, service, object_path, message): - [filename, sysfs_path] = message.get_args_list() - if member=='NodeCreated': - print 'Node %s created for %s'%(filename, sysfs_path) - elif member=='NodeDeleted': - print 'Node %s deleted for %s'%(filename, sysfs_path) - -def main(): - bus = dbus.Bus(dbus.Bus.TYPE_SYSTEM) - bus.add_signal_receiver(udev_signal_received, - 'org.kernel.udev.NodeMonitor', # interface - 'org.kernel.udev', # service - '/org/kernel/udev/NodeMonitor') # object - gtk.mainloop() - -if __name__ == '__main__': - main() - diff --git a/extras/dbus/etc/dbus-1/system.d/udev_sysbus_policy.conf b/extras/dbus/etc/dbus-1/system.d/udev_sysbus_policy.conf deleted file mode 100644 index b2660e65cf..0000000000 --- a/extras/dbus/etc/dbus-1/system.d/udev_sysbus_policy.conf +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/extras/dbus/udev_dbus.c b/extras/dbus/udev_dbus.c deleted file mode 100644 index 4852d429f8..0000000000 --- a/extras/dbus/udev_dbus.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - * udev_dbus.c - * - * Copyright (C) 2003 David Zeuthen - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#define DBUS_API_SUBJECT_TO_CHANGE -#include - -#include "../../udev_lib.h" -#include "../../logging.h" - -#ifdef LOG -unsigned char logname[LOGNAME_SIZE]; -void log_message(int level, const char *format, ...) -{ - va_list args; - - va_start(args, format); - vsyslog(level, format, args); - va_end(args); -} -#endif - -/* Variable for the connection the to system message bus or NULL - * if we cannot connect or acquire the org.kernel.udev service - */ -static DBusConnection* sysbus_connection; - -/* Disconnect from the system message bus */ -static void sysbus_disconnect(void) -{ - if (sysbus_connection == NULL) - return; - - dbus_connection_disconnect(sysbus_connection); - sysbus_connection = NULL; -} - -/* Connect to the system message bus */ -static void sysbus_connect(void) -{ - DBusError error; - - /* Connect to a well-known bus instance, the system bus */ - dbus_error_init(&error); - sysbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &error); - if (sysbus_connection == NULL) { - dbg("cannot connect to system message bus, error %s: %s", - error.name, error.message); - dbus_error_free(&error); - return; - } - - /* Acquire the org.kernel.udev service such that listeners - * know that the message is really from us and not from a - * random attacker. See the file udev_sysbus_policy.conf for - * details. - * - * Note that a service can have multiple owners (though there - * is a concept of a primary owner for reception of messages) - * so no race is introduced if two copies of udev is running - * at the same time. - */ - dbus_bus_acquire_service(sysbus_connection, "org.kernel.udev", 0, - &error); - if (dbus_error_is_set(&error)) { - dbg("cannot acquire org.kernel.udev service, error %s: %s'", - error.name, error.message); - sysbus_disconnect(); - return; - } -} - - -/* Send out a signal that a device node is created - * - * @param devname Name of the device node, e.g. /dev/sda1 - * @param path Sysfs path of device - */ -static void sysbus_send_create(const char *devname, const char *path) -{ - DBusMessage* message; - DBusMessageIter iter; - - /* object, interface, member */ - message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", - "org.kernel.udev.NodeMonitor", - "NodeCreated"); - - dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, devname); - dbus_message_iter_append_string(&iter, path); - - if ( !dbus_connection_send(sysbus_connection, message, NULL) ) - dbg("error sending d-bus signal"); - - dbus_message_unref(message); - - dbus_connection_flush(sysbus_connection); -} - -/* Send out a signal that a device node is deleted - * - * @param devname Name of the device node, e.g. /udev/sda1 - * @param path Sysfs path of device - */ -static void sysbus_send_remove(const char *devname, const char *path) -{ - DBusMessage* message; - DBusMessageIter iter; - - /* object, interface, member */ - message = dbus_message_new_signal("/org/kernel/udev/NodeMonitor", - "org.kernel.udev.NodeMonitor", - "NodeDeleted"); - - dbus_message_iter_init(message, &iter); - dbus_message_iter_append_string(&iter, devname); - dbus_message_iter_append_string(&iter, path); - - if ( !dbus_connection_send(sysbus_connection, message, NULL) ) - dbg("error sending d-bus signal"); - - dbus_message_unref(message); - - dbus_connection_flush(sysbus_connection); -} - -int main(int argc, char *argv[], char *envp[]) -{ - char *action; - char *devpath; - char *devname; - int retval = 0; - - init_logging("udev_dbus"); - - sysbus_connect(); - if (sysbus_connection == NULL) - return 0; - - action = get_action(); - if (!action) { - dbg("no action?"); - goto exit; - } - devpath = get_devpath(); - if (!devpath) { - dbg("no devpath?"); - goto exit; - } - devname = get_devname(); - if (!devname) { - dbg("no devname?"); - goto exit; - } - - if (strcmp(action, "add") == 0) { - sysbus_send_create(devname, devpath); - } else { - if (strcmp(action, "remove") == 0) { - sysbus_send_remove(devname, devpath); - } else { - dbg("unknown action '%s'", action); - retval = -EINVAL; - } - } - -exit: - sysbus_disconnect(); - return retval; -} -- cgit v1.2.3-54-g00ecf From bd2598afb628257c23cee57040ed22f8064cfee3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 14 May 2004 23:03:50 -0700 Subject: [PATCH] delete udev_selinux as it doesn't work properly and is the wrong way to do it... --- extras/selinux/Makefile | 64 -------------------------------- extras/selinux/udev_selinux.c | 85 ------------------------------------------- 2 files changed, 149 deletions(-) delete mode 100644 extras/selinux/Makefile delete mode 100644 extras/selinux/udev_selinux.c diff --git a/extras/selinux/Makefile b/extras/selinux/Makefile deleted file mode 100644 index 35d2e9e6da..0000000000 --- a/extras/selinux/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# Makefile for udev_selinux -# -# Copyright (C) 2004 Greg Kroah-Hartman -# -# 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. -# - -# Set the following to control the use of syslog -# Set it to `false' to remove all logging -USE_LOG = true - -# Set the following to `true' to log the debug -# and make a unstripped, unoptimized binary. -# Leave this set to `false' for production use. -DEBUG = false - -PROG = udev_selinux - -DESTDIR = - -# override this to make udev look in a different location for it's config files -prefix = -exec_prefix = ${prefix} -etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin -mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default -hotplugdir = ${etcdir}/hotplug.d/default -configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ -srcdir = . - -INSTALL = /usr/bin/install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} - -all: $(PROG) - -OBJS = udev_selinux.o - -override CFLAGS += -DUSE_SELINUX -override LIB_OBJS += -lselinux - -$(PROG): $(OBJS) - $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) ../../udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) - -clean: - rm -f $(PROG) $(OBJS) - -spotless: clean - -install: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) - - ln -s -f $(DESTDIR)$(sbindir)/$(PROG) $(DESTDIR)$(devddir)/$(PROG).dev - -uninstall: - - rm $(DESTDIR)$(devddir)/$(PROG).dev - - rm $(DESTDIR)$(sbindir)/$(PROG) - diff --git a/extras/selinux/udev_selinux.c b/extras/selinux/udev_selinux.c deleted file mode 100644 index 8b1c2c7da8..0000000000 --- a/extras/selinux/udev_selinux.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * udev_selinux.c - * - * Copyright (C) 2004 Daniel J Walsh - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include - -#include "../../udev_lib.h" -#include "../../logging.h" - -#ifdef LOG -unsigned char logname[LOGNAME_SIZE]; -void log_message(int level, const char *format, ...) -{ - va_list args; - - va_start(args, format); - vsyslog(level, format, args); - va_end(args); -} -#endif - -static void selinux_add_node(char *filename) -{ - int retval; - - if (is_selinux_enabled() > 0) { - security_context_t scontext; - retval = matchpathcon(filename, 0, &scontext); - if (retval < 0) { - dbg("matchpathcon(%s) failed\n", filename); - } else { - retval = setfilecon(filename,scontext); - if (retval < 0) - dbg("setfiles %s failed with error '%s'", - filename, strerror(errno)); - free(scontext); - } - } -} - -int main(int argc, char *argv[], char *envp[]) -{ - char *action; - char *devname; - int retval = 0; - - init_logging("udev_selinux"); - - action = get_action(); - if (!action) { - dbg("no action?"); - goto exit; - } - devname = get_devname(); - if (!devname) { - dbg("no devname?"); - goto exit; - } - - if (strcmp(action, "add") == 0) - selinux_add_node(devname); - -exit: - return retval; -} -- cgit v1.2.3-54-g00ecf From 91cb2628950fc80e719983fa86dbb616af3e94f0 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 14 May 2004 23:05:05 -0700 Subject: [PATCH] remove dbus and selinux stuff from the udev.spec file. --- udev.spec | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/udev.spec b/udev.spec index f183f5b3d2..0c8969dfac 100644 --- a/udev.spec +++ b/udev.spec @@ -17,16 +17,6 @@ # 1 - debugging enabled %define debug 0 -# if we want to build the DBUS "extra" package or not -# 0 - no DBUS support -# 1 - DBUS support -%define dbus 0 - -# if we want to build the SELinux "extra" package or not -# 0 - no SELinux support -# 1 - SELinux support -%define selinux 0 - # if we want to build the scsi_id "extra" package or not # 0 - do not build the package # 1 - build it @@ -71,12 +61,6 @@ make CC="gcc $RPM_OPT_FLAGS" \ %if %{scsi_id} extras/scsi_id \ %endif -%if %{dbus} - extras/dbus \ -%endif -%if %{selinux} - extras/selinux \ -%endif " %install @@ -85,12 +69,6 @@ make DESTDIR=$RPM_BUILD_ROOT install \ %if %{scsi_id} extras/scsi_id \ %endif -%if %{dbus} - extras/dbus \ -%endif -%if %{selinux} - extras/selinux \ -%endif " %post @@ -124,10 +102,6 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) /etc/init.d/udev %attr(0644,root,root) %{_mandir}/man8/udev*.8* -%if %{dbus} - %config(noreplace) %attr(0644,root,root) /etc/dbus-1/system.d/udev_sysbus_policy.conf -%endif - %if %{scsi_id} %attr(755,root,root) /sbin/scsi_id %config(noreplace) %attr(0644,root,root) /etc/scsi_id.config -- cgit v1.2.3-54-g00ecf From 1eae2f3f712ff839bf80721bf9c44a76a78460dc Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 14 May 2004 23:08:04 -0700 Subject: [PATCH] add volume_id support to the udev.spec file --- udev.spec | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/udev.spec b/udev.spec index 0c8969dfac..79b6952415 100644 --- a/udev.spec +++ b/udev.spec @@ -22,6 +22,11 @@ # 1 - build it %define scsi_id 1 +# if we want to build the volume_id "extra" package or not +# 0 - do not build the package +# 1 - build it +%define volume_id 1 + Summary: A userspace implementation of devfs Name: udev Version: 025 @@ -61,6 +66,9 @@ make CC="gcc $RPM_OPT_FLAGS" \ %if %{scsi_id} extras/scsi_id \ %endif +%if %{volume_id} + extras/volume_id \ +%endif " %install @@ -69,6 +77,9 @@ make DESTDIR=$RPM_BUILD_ROOT install \ %if %{scsi_id} extras/scsi_id \ %endif +%if %{volume_id} + extras/volume_id \ +%endif " %post @@ -107,8 +118,15 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) %attr(0644,root,root) /etc/scsi_id.config %attr(0644,root,root) %{_mandir}/man8/scsi_id*.8* %endif +%if %{volume_id} + %attr(755,root,root) /sbin/udev_volume_id +%endif %changelog +* Fri May 14 2004 Greg Kroah-Hartman +- remove dbus and selinux stuff from here +- added volume_id option + * Wed Mar 24 2004 Greg Kroah-Hartman - change the way dbus and selinux support is built (now an extra) -- cgit v1.2.3-54-g00ecf From 28e169f067aa96b406342677922e34e7361a7d1b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 14 May 2004 23:18:41 -0700 Subject: [PATCH] udevsend fallback On Tue, May 11, 2004 at 04:54:44PM -0700, Greg KH wrote: > On Tue, May 11, 2004 at 01:16:41PM +0200, Kay Sievers wrote: > > Hi, > > the execution of udev depends on the proper fuction of udevd, the > > serializing daemon. If we can't connect to udevd within a 20 second we > > give up and the request to create a node is lost. Hope this never happens, > > but a broken udevd may prevent udev from working. > > > > What do you think? Should we call the udev binary directly from udevsend > > instead of discarding the event? This way we would create the node, regardless > > of the state of udevd. It would be 20 seconds later and maybe not in the right > > sequence order - but the node will propably be there. > > > > Does it sound sane? What do you think? > > That sounds like a good "failsafe" thing to do. Here we go: Add a fallback udev call to udevsend. If udevsend is unable to send the event to udevd, we call the udev binary instead of doing nothing and exiting. --- udevsend.c | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/udevsend.c b/udevsend.c index f28e445433..a52d6ec165 100644 --- a/udevsend.c +++ b/udevsend.c @@ -98,6 +98,26 @@ static int start_daemon(void) return 0; } +static void run_udev(const char *subsystem) +{ + pid_t pid; + + pid = fork(); + switch (pid) { + case 0: + /* child */ + execl(UDEV_BIN, "udev", subsystem, NULL); + dbg("exec of child failed"); + exit(1); + break; + case -1: + dbg("fork of child failed"); + break; + default: + wait(NULL); + } +} + int main(int argc, char* argv[]) { struct hotplug_msg msg; @@ -109,14 +129,12 @@ int main(int argc, char* argv[]) int retval = 1; int loop; struct timespec tspec; - int sock; + int sock = -1; struct sockaddr_un saddr; socklen_t addrlen; int started_daemon = 0; -#ifdef DEBUG init_logging("udevsend"); -#endif dbg("version %s", UDEV_VERSION); subsystem = get_subsystem(argv[1]); @@ -150,7 +168,7 @@ int main(int argc, char* argv[]) sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { dbg("error getting socket"); - goto exit; + goto fallback; } memset(&saddr, 0x00, sizeof(struct sockaddr_un)); @@ -168,22 +186,21 @@ int main(int argc, char* argv[]) (struct sockaddr *)&saddr, addrlen); if (retval != -1) { retval = 0; - goto close_and_exit; + goto exit; } - + if (errno != ECONNREFUSED) { dbg("error sending message"); - goto close_and_exit; + goto fallback; } - + if (!started_daemon) { - dbg("connect failed, try starting daemon..."); + info("starting udevd daemon"); retval = start_daemon(); if (retval) { - dbg("error starting daemon"); - goto exit; + info("error starting daemon"); + goto fallback; } - dbg("daemon started"); started_daemon = 1; } else { @@ -193,9 +210,14 @@ int main(int argc, char* argv[]) nanosleep(&tspec, NULL); } } - -close_and_exit: - close(sock); + +fallback: + info("unable to connect to event daemon, try to call udev directly"); + run_udev(subsystem); + exit: + if (sock != -1) + close(sock); + return retval; } -- cgit v1.2.3-54-g00ecf From c33359307b4a337d6c4f2f4fbe4451544fa5cc1f Mon Sep 17 00:00:00 2001 From: "ogasawara@osdl.org" Date: Fri, 14 May 2004 23:18:46 -0700 Subject: [PATCH] evaluate getenv() return value for udev_config.c Small patch to fix the evaluation logic for the return value of getenv() in udev_config.c file. Basically, the actual values for the environment variables "UDEV_NO_SLEEP" and "UDEV_NO_DEVD" were not being checked. For example UDEV_NO_SLEEP could have been set to false but the line: if (getenv("UDEV_NO_SLEEP") != NULL) in this case would always evaluate to true, since getenv() returns char*, thus the "udev_sleep" variable would be set incorrectly. The patch makes sure to check the value returned by getenv() not just if getenv() returned a value. Hope this made sense. Thanks, --- udev_config.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/udev_config.c b/udev_config.c index 51a91d0092..19f690c7e8 100644 --- a/udev_config.c +++ b/udev_config.c @@ -60,11 +60,15 @@ static int string_is_true(char *str) return 1; if (strcasecmp(str, "yes") == 0) return 1; + if (strcasecmp(str, "1") == 0) + return 1; return 0; } static void init_variables(void) { + char *env; + /* fill up the defaults. * If any config values are specified, they will * override these values. */ @@ -76,11 +80,13 @@ static void init_variables(void) udev_log = string_is_true(UDEV_LOG_DEFAULT); udev_sleep = 1; - if (getenv("UDEV_NO_SLEEP") != NULL) + env = getenv("UDEV_NO_SLEEP"); + if (env && string_is_true(env)) udev_sleep = 0; udev_dev_d = 1; - if (getenv("UDEV_NO_DEVD") != NULL) + env = getenv("UDEV_NO_DEVD"); + if (env && string_is_true(env)) udev_dev_d = 0; } -- cgit v1.2.3-54-g00ecf From 3c60abb55ad438857248c4e5c5ba8acde887ba26 Mon Sep 17 00:00:00 2001 From: "arnd@arndb.de" Date: Thu, 20 May 2004 19:14:09 -0700 Subject: [PATCH] udev rpm fix Some file locations have changed since the spec file was last updated. Also a failed build might leave behind a stale buildroot directory. This patch should fix both problems. --- udev.spec | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/udev.spec b/udev.spec index 79b6952415..e53b3598fc 100644 --- a/udev.spec +++ b/udev.spec @@ -72,6 +72,7 @@ make CC="gcc $RPM_OPT_FLAGS" \ " %install +rm -rf $RPM_BUILD_ROOT make DESTDIR=$RPM_BUILD_ROOT install \ EXTRAS=" \ %if %{scsi_id} @@ -107,11 +108,16 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) %dir /udev/ %attr(755,root,root) %dir /etc/udev/ %config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf -%config(noreplace) %attr(0644,root,root) /etc/udev/udev.rules -%config(noreplace) %attr(0644,root,root) /etc/udev/udev.permissions +%attr(755,root,root) %dir /etc/udev/rules.d/ +%attr(755,root,root) %dir /etc/udev/permissions.d/ +%config(noreplace) %attr(0644,root,root) /etc/udev/rules.d/50-udev.rules +%config(noreplace) %attr(0644,root,root) /etc/udev/permissions.d/50-udev.permissions %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(755,root,root) /etc/init.d/udev %attr(0644,root,root) %{_mandir}/man8/udev*.8* +%attr(755,root,root) %dir /etc/dev.d/ +%attr(755,root,root) %dir /etc/dev.d/net/ +%attr(0755,root,root) /etc/dev.d/net/hotplug.dev %if %{scsi_id} %attr(755,root,root) /sbin/scsi_id -- cgit v1.2.3-54-g00ecf From 73028bc3322c9ec88e046c57e7b297fdd1c02b1a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 20 May 2004 23:14:08 -0700 Subject: [PATCH] Update to version 117 of klibc (from version 108) --- klibc/MCONFIG | 11 ++- klibc/MRULES | 4 + klibc/klibc/Makefile | 5 +- klibc/klibc/README | 4 +- klibc/klibc/SYSCALLS | 3 +- klibc/klibc/__static_init.c | 2 - klibc/klibc/arch/i386/MCONFIG | 9 +-- klibc/klibc/arch/i386/crt0.S | 1 - klibc/klibc/arch/parisc/Makefile.inc | 5 ++ klibc/klibc/arch/parisc/crt0.S | 34 +++++++++ klibc/klibc/arch/parisc/include/klibc/archsignal.h | 13 +++- klibc/klibc/arch/parisc/setjmp.S | 88 ++++++++++++++++++++++ klibc/klibc/getpgrp.c | 9 +++ klibc/klibc/getpt.c | 17 +++++ klibc/klibc/include/klibc/compiler.h | 4 + klibc/klibc/include/stdlib.h | 6 +- klibc/klibc/include/sys/sysinfo.h | 12 +++ klibc/klibc/include/sys/un.h | 8 +- klibc/klibc/include/unistd.h | 5 +- klibc/klibc/open.c | 17 +++++ klibc/klibc/pty.c | 2 +- klibc/version | 2 +- 22 files changed, 233 insertions(+), 28 deletions(-) create mode 100644 klibc/klibc/arch/parisc/crt0.S create mode 100644 klibc/klibc/arch/parisc/setjmp.S create mode 100644 klibc/klibc/getpgrp.c create mode 100644 klibc/klibc/getpt.c create mode 100644 klibc/klibc/include/sys/sysinfo.h create mode 100644 klibc/klibc/open.c diff --git a/klibc/MCONFIG b/klibc/MCONFIG index de8b332d98..ec8b65c0e4 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -25,9 +25,14 @@ HOST_CFLAGS = -g -O HOST_LDFLAGS = HOST_LIBS = -CRT0 = $(KLIBSRC)/crt0.o -KLIBC = $(KLIBSRC)/libc.a -LIBGCC = $(shell $(CC) --print-libgcc) +# Static library paths +CRT0 = $(KLIBSRC)/crt0.o +KLIBC = $(KLIBSRC)/libc.a +LIBGCC = $(shell $(CC) --print-libgcc) + +# Shared library paths +CRTSHARED = $(KLIBSRC)/interp.o +LIBSHARED = $(KLIBSRC)/libc.so # # This indicates the location of the final version of the shared library. diff --git a/klibc/MRULES b/klibc/MRULES index 8a8831c348..41fdd07af8 100644 --- a/klibc/MRULES +++ b/klibc/MRULES @@ -5,6 +5,10 @@ .SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss +% : %.c # Cancel default rule + +% : %.S + .c.o: $(CC) $(CFLAGS) -c -o $@ $< diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index 0d5b197f0d..7ed03a8e87 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -17,7 +17,8 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ strtoimax.o strtoumax.o \ globals.o exitc.o atexit.o onexit.o \ execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \ - fork.o wait.o wait3.o waitpid.o system.o setpgrp.o \ + fork.o wait.o wait3.o waitpid.o system.o setpgrp.o getpgrp.o \ + open.o \ printf.o vprintf.o fprintf.o vfprintf.o perror.o \ fopen.o fread.o fread2.o fgetc.o fgets.o \ fwrite.o fwrite2.o fputc.o fputs.o puts.o \ @@ -35,7 +36,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ seteuid.o setegid.o setresuid.o setresgid.o \ getenv.o setenv.o putenv.o __put_env.o unsetenv.o \ getopt.o readdir.o \ - syslog.o closelog.o pty.o isatty.o reboot.o \ + syslog.o closelog.o pty.o getpt.o isatty.o reboot.o \ time.o utime.o fdatasync.o llseek.o select.o nice.o getpriority.o \ qsort.o lrand48.o srand48.o seed48.o \ inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ diff --git a/klibc/klibc/README b/klibc/klibc/README index 4495908a22..d69fa8de41 100644 --- a/klibc/klibc/README +++ b/klibc/klibc/README @@ -36,9 +36,9 @@ b) If you're cross-compiling, change ARCH in the main MCONFIG file to Known to work: alpha arm ia64 i386 ppc s390 s390x sparc sparc64 x86_64* - Works static, not shared: mips* arm-thumb sh* + Works static, not shared: mips* arm-thumb sh* parisc Might work: ppc64 - Need porting work: cris m68k mips64 parisc + Need porting work: cris m68k mips64 v850 x86_64: requires a kernel header patch (to be created) mips, sh: linker problem; might work with fixed linker diff --git a/klibc/klibc/SYSCALLS b/klibc/klibc/SYSCALLS index 00883cc098..82081201b4 100644 --- a/klibc/klibc/SYSCALLS +++ b/klibc/klibc/SYSCALLS @@ -19,7 +19,6 @@ int setpgid(pid_t, pid_t) pid_t getpgid(pid_t) pid_t getppid() pid_t getxpid@dual1::getppid() - pid_t getpgrp() pid_t setsid() pid_t getsid(pid_t) pid_t wait4(pid_t, int *, int, struct rusage *) @@ -92,7 +91,6 @@ int lchown(const char *, uid_t, gid_t) # ssize_t read(int, void *, size_t) ssize_t write(int, const void *, size_t) -int open(const char *, int, mode_t) int close(int) off_t lseek(int, off_t, int) int dup(int) @@ -145,6 +143,7 @@ long delete_module(const char *, unsigned int) int query_module(const char *, int, void *, size_t, size_t) int reboot::__reboot(int, int, int, void *) int syslog::klogctl(int, char *, int) +int sysinfo(struct sysinfo *) # # Low-level I/O (generally architecture-specific) diff --git a/klibc/klibc/__static_init.c b/klibc/klibc/__static_init.c index dcb8d01856..5a90b5cd88 100644 --- a/klibc/klibc/__static_init.c +++ b/klibc/klibc/__static_init.c @@ -36,5 +36,3 @@ __noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void)) environ = envp; exit(main(argc, argv, envp)); } - - diff --git a/klibc/klibc/arch/i386/MCONFIG b/klibc/klibc/arch/i386/MCONFIG index 367ee89773..516b1b6738 100644 --- a/klibc/klibc/arch/i386/MCONFIG +++ b/klibc/klibc/arch/i386/MCONFIG @@ -7,17 +7,16 @@ # accordingly. # -# Comment this out to compile with register parameter passing -# This doesn't work right now because gcc 3.2 (at least) calls -# libgcc with the default calling convention instead of forcing -# them to be cdecl -# REGPARM = -mregparm=3 -DREGPARM +# Enable this to compile with register parameters; only safe for +# gcc > 3 +REGPARM_OPT := -mregparm=3 -DREGPARM gcc_major := $(shell $(CC) -v 2>&1 | awk '/gcc version/{print int($$3)}') OPTFLAGS = $(REGPARM) -march=i386 -Os ifeq ($(gcc_major),3) +REGPARM := $(REGPARM_OPT) OPTFLAGS += -falign-functions=0 -falign-jumps=0 -falign-loops=0 else OPTFLAGS += -malign-functions=0 -malign-jumps=0 -malign-loops=0 diff --git a/klibc/klibc/arch/i386/crt0.S b/klibc/klibc/arch/i386/crt0.S index 1c82eda513..0f3a7db35e 100644 --- a/klibc/klibc/arch/i386/crt0.S +++ b/klibc/klibc/arch/i386/crt0.S @@ -26,7 +26,6 @@ _start: #endif call __libc_init # If __libc_init returns, problem... - ud2 hlt .size _start, .-_start diff --git a/klibc/klibc/arch/parisc/Makefile.inc b/klibc/klibc/arch/parisc/Makefile.inc index f7a983da7f..abe9155bf4 100644 --- a/klibc/klibc/arch/parisc/Makefile.inc +++ b/klibc/klibc/arch/parisc/Makefile.inc @@ -7,4 +7,9 @@ # accordingly. # +ARCHOBJS = \ + arch/$(ARCH)/setjmp.o + +ARCHOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS)) + archclean: diff --git a/klibc/klibc/arch/parisc/crt0.S b/klibc/klibc/arch/parisc/crt0.S new file mode 100644 index 0000000000..fb0bd373ee --- /dev/null +++ b/klibc/klibc/arch/parisc/crt0.S @@ -0,0 +1,34 @@ + .align 4 + + .import $global$, data + .import __libc_init, code + + .global _start + .export _start, ENTRY + .type _start,@function + + .proc + .callinfo + +_start: +/* extend the stack by 64-bytes */ + ldo 64(%sp), %sp + +/* %r25 = argc + * %r24 = argv + * envp = argv + (argc + 1) + * elfdata = (argv - 4) + */ + ldo -4(%r24), %r26 + +/* load global data */ + ldil L%$global$, %dp + ldo R%$global$(%dp), %dp + +/* branch to __libc_init */ + bl __libc_init,%r2 + nop +/* break miserably if we ever return */ + iitlbp %r0,(%r0) /* illegal instruction */ + nop + .procend diff --git a/klibc/klibc/arch/parisc/include/klibc/archsignal.h b/klibc/klibc/arch/parisc/include/klibc/archsignal.h index 511d774b2d..3190e8528e 100644 --- a/klibc/klibc/arch/parisc/include/klibc/archsignal.h +++ b/klibc/klibc/arch/parisc/include/klibc/archsignal.h @@ -8,6 +8,17 @@ #ifndef _KLIBC_ARCHSIGNAL_H #define _KLIBC_ARCHSIGNAL_H -/* No special stuff for this architecture */ +#define _NSIG 64 +#define _NSIG_SZ (_NSIG / LONG_BIT) + +typedef struct { + unsigned long sig[_NSIG_SZ]; +} sigset_t; + +struct sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + sigset_t sa_mask; +}; #endif diff --git a/klibc/klibc/arch/parisc/setjmp.S b/klibc/klibc/arch/parisc/setjmp.S new file mode 100644 index 0000000000..51b2b1a58b --- /dev/null +++ b/klibc/klibc/arch/parisc/setjmp.S @@ -0,0 +1,88 @@ +/* + * parisc specific setjmp/longjmp routines + * + */ + + .text + .align 4 + .global setjmp + .export setjmp, code + .proc + .callinfo +setjmp: + stw %r3,0(%r26) + stw %r4,8(%r26) + stw %r5,12(%r26) + stw %r6,16(%r26) + stw %r7,20(%r26) + stw %r8,24(%r26) + stw %r9,28(%r26) + stw %r10,32(%r26) + stw %r11,36(%r26) + stw %r12,40(%r26) + stw %r13,44(%r26) + stw %r14,48(%r26) + stw %r15,52(%r26) + stw %r16,56(%r26) + stw %r17,60(%r26) + stw %r18,64(%r26) + stw %r19,68(%r26) + stw %dp,72(%r26) + stw %r30,76(%r26) + stw %rp,80(%r26) + ldo 88(%r26),%r19 + fstd,ma %fr12,8(%r19) + fstd,ma %fr13,8(%r19) + fstd,ma %fr14,8(%r19) + fstd,ma %fr15,8(%r19) + fstd,ma %fr16,8(%r19) + fstd,ma %fr17,8(%r19) + fstd,ma %fr18,8(%r19) + fstd,ma %fr19,8(%r19) + fstd,ma %fr20,8(%r19) + fstd %fr21,0(%r19) + bv %r0(%rp) + copy %r0,%r28 + .procend + + .text + .align 4 + .global longjmp + .export longjmp, code + .proc + .callinfo +longjmp: + ldw 0(%r26),%r3 + ldw 8(%r26),%r4 + ldw 12(%r26),%r5 + ldw 16(%r26),%r6 + ldw 20(%r26),%r7 + ldw 24(%r26),%r8 + ldw 28(%r26),%r9 + ldw 32(%r26),%r10 + ldw 36(%r26),%r11 + ldw 40(%r26),%r12 + ldw 44(%r26),%r13 + ldw 48(%r26),%r14 + ldw 52(%r26),%r15 + ldw 56(%r26),%r16 + ldw 60(%r26),%r17 + ldw 64(%r26),%r18 + ldw 68(%r26),%r19 + ldw 72(%r26),%r27 + ldw 76(%r26),%r30 + ldw 80(%r26),%rp + ldo 88(%r26),%r20 + fldd,ma 8(%r20),%fr12 + fldd,ma 8(%r20),%fr13 + fldd,ma 8(%r20),%fr14 + fldd,ma 8(%r20),%fr15 + fldd,ma 8(%r20),%fr16 + fldd,ma 8(%r20),%fr17 + fldd,ma 8(%r20),%fr18 + fldd,ma 8(%r20),%fr19 + fldd,ma 8(%r20),%fr20 + fldd 0(%r20),%fr21 + bv %r0(%rp) + copy %r25,%r28 + .procend diff --git a/klibc/klibc/getpgrp.c b/klibc/klibc/getpgrp.c new file mode 100644 index 0000000000..c92369807b --- /dev/null +++ b/klibc/klibc/getpgrp.c @@ -0,0 +1,9 @@ +/* + * getpgrp.c + */ + +#include + +pid_t getpgrp(void) { + return getpgid(0); +} diff --git a/klibc/klibc/getpt.c b/klibc/klibc/getpt.c new file mode 100644 index 0000000000..a05903062c --- /dev/null +++ b/klibc/klibc/getpt.c @@ -0,0 +1,17 @@ +/* + * getpt.c + * + * GNU extension to the standard Unix98 pty suite + */ + +#include +#include +#include +#include +#include +#include + +int getpt(void) +{ + return open("/dev/ptmx", O_RDWR|O_NOCTTY); +} diff --git a/klibc/klibc/include/klibc/compiler.h b/klibc/klibc/include/klibc/compiler.h index 49872b89d4..6c01474cc1 100644 --- a/klibc/klibc/include/klibc/compiler.h +++ b/klibc/klibc/include/klibc/compiler.h @@ -8,12 +8,16 @@ #define _KLIBC_COMPILER_H /* Specific calling conventions */ +/* __cdecl is used when we want varadic and non-varadic functions to have + the same binary calling convention. */ #ifdef __i386__ # ifdef __GNUC__ # define __cdecl __attribute__((cdecl,regparm(0))) # else /* Most other C compilers have __cdecl as a keyword */ # endif +#else +# define __cdecl /* Meaningless on non-i386 */ #endif /* How to declare a function that *must* be inlined */ diff --git a/klibc/klibc/include/stdlib.h b/klibc/klibc/include/stdlib.h index 38dd1624a5..af97eea636 100644 --- a/klibc/klibc/include/stdlib.h +++ b/klibc/klibc/include/stdlib.h @@ -83,12 +83,14 @@ static __inline__ void srandom(unsigned int __s) /* Basic PTY functions. These only work if devpts is mounted! */ +__extern int unlockpt(int); +__extern char *ptsname(int); +__extern int getpt(void); + static __inline__ int grantpt(int __fd) { (void)__fd; return 0; /* devpts does this all for us! */ } -__extern int unlockpt(int); -__extern char *ptsname(int); #endif /* _STDLIB_H */ diff --git a/klibc/klibc/include/sys/sysinfo.h b/klibc/klibc/include/sys/sysinfo.h new file mode 100644 index 0000000000..4051c6897a --- /dev/null +++ b/klibc/klibc/include/sys/sysinfo.h @@ -0,0 +1,12 @@ +/* + * sys/sysinfo.h + */ + +#ifndef _SYS_SYSINFO_H +#define _SYS_SYSINFO_H + +#include + +extern int sysinfo (struct sysinfo *info); + +#endif /* _SYS_SYSINFO_H */ diff --git a/klibc/klibc/include/sys/un.h b/klibc/klibc/include/sys/un.h index 85822ba6a4..df42d719f7 100644 --- a/klibc/klibc/include/sys/un.h +++ b/klibc/klibc/include/sys/un.h @@ -1,10 +1,10 @@ /* - * sys/un.h + * */ -#ifndef _UN_H -#define _UN_H +#ifndef _SYS_UN_H +#define _SYS_UN_H #include -#endif /* _UN_H */ +#endif /* _SYS_UN_H */ diff --git a/klibc/klibc/include/unistd.h b/klibc/klibc/include/unistd.h index f1cde2376e..13ff03b012 100644 --- a/klibc/klibc/include/unistd.h +++ b/klibc/klibc/include/unistd.h @@ -17,6 +17,7 @@ __extern __noreturn _exit(int); __extern pid_t fork(void); __extern pid_t vfork(void); __extern pid_t getpid(void); +__extern pid_t getpgid(pid_t); __extern int setpgid(pid_t, pid_t); __extern pid_t getppid(void); __extern pid_t getpgrp(void); @@ -76,8 +77,8 @@ __extern int sync(void); __extern ssize_t read(int, void *, size_t); __extern ssize_t write(int, const void *, size_t); -#ifndef __IN_SYS_COMMON -__extern int open(const char *, int, ...); +#ifndef __IN_OPEN_C +__extern __cdecl int open(const char *, int, ...); #endif __extern int close(int); __extern off_t lseek(int, off_t, int); diff --git a/klibc/klibc/open.c b/klibc/klibc/open.c new file mode 100644 index 0000000000..0d7db10c4a --- /dev/null +++ b/klibc/klibc/open.c @@ -0,0 +1,17 @@ +/* + * open.c + * + * The open syscall is weird, because it's defined as a varadic + * function, but implementing it as such generally sucks for + * performance. Thus we generate it as a 3-argument function, + * but with explicit __cdecl assuming the __cdecl convention is + * independent of being varadic. + */ + +#define __IN_OPEN_C +#include +#include +#include +#include + +__cdecl _syscall3(int,open,const char *,file,int,flags,mode_t,mode) diff --git a/klibc/klibc/pty.c b/klibc/klibc/pty.c index 5907ca2ff5..2fe01ab204 100644 --- a/klibc/klibc/pty.c +++ b/klibc/klibc/pty.c @@ -1,7 +1,7 @@ /* * pty.c * - * Basic Unix98 PTY functionality; assumes devpts + * Basic Unix98 PTY functionality; assumes devpts mounted on /dev/pts */ #include diff --git a/klibc/version b/klibc/version index 4b0a18ac52..31ba1bdaa5 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.108 +0.117 -- cgit v1.2.3-54-g00ecf From 9e86e12e10ad147d27cb19bc3a6f799f38fd4502 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 20 May 2004 23:53:50 -0700 Subject: [PATCH] 025_bk mark because kernel.org is down, no release just yet... --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7c716e852e..e471f02475 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 025 +VERSION = 025_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index e53b3598fc..d82c656ef5 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 025 +Version: 025_bk Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 84df02dd63bf53acb5a61e9db1da067760b927e9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 26 May 2004 19:40:27 -0700 Subject: [PATCH] catchup with recent klibc Our own implementation of the sysinfo system call is no longer needed, cause it's merged it into klibc now. --- klibc_fixups.c | 2 -- klibc_fixups.h | 5 ----- namedev.c | 2 -- udevd.c | 2 -- 4 files changed, 11 deletions(-) diff --git a/klibc_fixups.c b/klibc_fixups.c index c4d44bbc49..bbacfbdc75 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -37,8 +37,6 @@ #define GR_FILE "/etc/group" #define UTMP_FILE "/var/run/utmp" -_syscall1(int, sysinfo, struct sysinfo *, info); - /* return the id of a passwd style line, selected by the users name */ static unsigned long get_id_by_name(const char *uname, const char *dbfile) { diff --git a/klibc_fixups.h b/klibc_fixups.h index 6dfd5a5c17..f6c91cdd94 100644 --- a/klibc_fixups.h +++ b/klibc_fixups.h @@ -3,11 +3,6 @@ #ifndef KLIBC_FIXUPS_H #define KLIBC_FIXUPS_H -#include -#include - -int sysinfo(struct sysinfo *info); - struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ diff --git a/namedev.c b/namedev.c index b3a2a8ae4b..5e3db1326c 100644 --- a/namedev.c +++ b/namedev.c @@ -32,9 +32,7 @@ #include #include #include -#ifndef __KLIBC__ #include -#endif #include "libsysfs/sysfs/libsysfs.h" #include "list.h" diff --git a/udevd.c b/udevd.c index d807e4168d..5756b46122 100644 --- a/udevd.c +++ b/udevd.c @@ -34,9 +34,7 @@ #include #include #include "klibc_fixups.h" -#ifndef __KLIBC__ #include -#endif #include "list.h" #include "udev.h" -- cgit v1.2.3-54-g00ecf From 0f36e68e8a28e02981b90a3a4712f198b58746ba Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 4 Jun 2004 22:01:53 -0700 Subject: [PATCH] add test for ! in partition name --- test/sys/block/cciss!c0d0/cciss!c0d0p1/dev | 1 + test/sys/block/cciss!c0d0/cciss!c0d0p2/dev | 1 + test/sys/block/cciss!c0d0/cciss!c0d0p5/dev | 1 + test/sys/block/cciss!c0d0/dev | 1 + test/udev-test.pl | 10 ++++++++++ 5 files changed, 14 insertions(+) create mode 100644 test/sys/block/cciss!c0d0/cciss!c0d0p1/dev create mode 100644 test/sys/block/cciss!c0d0/cciss!c0d0p2/dev create mode 100644 test/sys/block/cciss!c0d0/cciss!c0d0p5/dev create mode 100644 test/sys/block/cciss!c0d0/dev diff --git a/test/sys/block/cciss!c0d0/cciss!c0d0p1/dev b/test/sys/block/cciss!c0d0/cciss!c0d0p1/dev new file mode 100644 index 0000000000..92c4b9b088 --- /dev/null +++ b/test/sys/block/cciss!c0d0/cciss!c0d0p1/dev @@ -0,0 +1 @@ +8:1 diff --git a/test/sys/block/cciss!c0d0/cciss!c0d0p2/dev b/test/sys/block/cciss!c0d0/cciss!c0d0p2/dev new file mode 100644 index 0000000000..9799a2674a --- /dev/null +++ b/test/sys/block/cciss!c0d0/cciss!c0d0p2/dev @@ -0,0 +1 @@ +8:2 diff --git a/test/sys/block/cciss!c0d0/cciss!c0d0p5/dev b/test/sys/block/cciss!c0d0/cciss!c0d0p5/dev new file mode 100644 index 0000000000..b3d5042192 --- /dev/null +++ b/test/sys/block/cciss!c0d0/cciss!c0d0p5/dev @@ -0,0 +1 @@ +8:5 diff --git a/test/sys/block/cciss!c0d0/dev b/test/sys/block/cciss!c0d0/dev new file mode 100644 index 0000000000..fae0a50572 --- /dev/null +++ b/test/sys/block/cciss!c0d0/dev @@ -0,0 +1 @@ +8:0 diff --git a/test/udev-test.pl b/test/udev-test.pl index ebd3c6a8a0..1e7c51e556 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -397,6 +397,16 @@ EOF exp_name => "rd/c0d0" , conf => < "name test with ! in the name for a partition", + subsys => "block", + devpath => "/block/cciss!c0d0/cciss!c0d0p1", + exp_name => "cciss/c0d0p1" , + conf => < Date: Mon, 7 Jun 2004 02:56:47 -0700 Subject: [PATCH] fix udevd zombies The recent version of klibc switched to -mregparm=3. This broke the signal handlers parameter, cause it is called directly from the kernel with the parameter on the stack not in a register. --- udev.c | 6 +++--- udevd.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/udev.c b/udev.c index 192bed97d8..eb21f75461 100644 --- a/udev.c +++ b/udev.c @@ -55,7 +55,7 @@ void log_message(int level, const char *format, ...) } #endif -static void sig_handler(int signum) +__attribute__((regparm(0))) static void sig_handler(int signum) { switch (signum) { case SIGINT: @@ -63,7 +63,7 @@ static void sig_handler(int signum) udevdb_exit(); exit(20 + signum); default: - dbg("unhandled signal"); + dbg("unhandled signal %d", signum); } } @@ -128,7 +128,7 @@ static int udev_hotplug(void) goto exit; } - /* set up a default signal handler for now */ + /* set signal handlers */ act.sa_handler = sig_handler; sigemptyset (&act.sa_mask); act.sa_flags = SA_RESTART; diff --git a/udevd.c b/udevd.c index 5756b46122..e0c5bf5c77 100644 --- a/udevd.c +++ b/udevd.c @@ -306,9 +306,10 @@ skip: return; } -static void sig_handler(int signum) +__attribute__((regparm(0))) static void sig_handler(int signum) { int rc; + switch (signum) { case SIGINT: case SIGTERM: @@ -325,7 +326,7 @@ static void sig_handler(int signum) goto do_write; break; default: - dbg("unhandled signal"); + dbg("unhandled signal %d", signum); return; } -- cgit v1.2.3-54-g00ecf From e3496f5932ab1460519db5c789bf6fdb242dd4c5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 7 Jun 2004 23:43:46 -0700 Subject: [PATCH] 026 release --- ChangeLog | 30 ++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c37e615487..8fea6a7f91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +Summary of changes from v025 to v026 +============================================ + +Arnd Bergmann: + o udev rpm fix + +Greg Kroah-Hartman: + o add test for ! in partition name + o 025_bk mark + o Update to version 117 of klibc (from version 108) + o add volume_id ignore rule for bk + o add volume_id support to the udev.spec file + o remove dbus and selinux stuff from the udev.spec file + o delete udev_selinux as it doesn't work properly and is the wrong way to do it + o Deleted the udev_dbus extra as it didn't really work properly and HAL has a real solution now + o add udev.permissions.slackware file + o udevstart: close open directories + +Kay Sievers: + o fix udevd zombies + o catchup with recent klibc + o Re: udevsend fallback + o udev_volume_id update + o udev callout for reading filesystem labels + o udev callout for reading filesystem labels + o udev default config layout changes + +Leann Ogasawara: + o evaluate getenv() return value for udev_config.c + Summary of changes from v024 to v025 ============================================ diff --git a/Makefile b/Makefile index e471f02475..625c21efc0 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 025_bk +VERSION = 026 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index d82c656ef5..591a60bc87 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 025_bk +Version: 026 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 686cecf24216770190133aa6f270bb2b124329a7 Mon Sep 17 00:00:00 2001 From: "fork0@users.sf.net" Date: Tue, 8 Jun 2004 16:47:16 -0700 Subject: [PATCH] fix handle leak in udev_lib.c There is a handle leak in failure path in file_map, and the result of file_map (or the result of the caller of the file_map) is not always checked. --- udev_lib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_lib.c b/udev_lib.c index 16b473f576..8f6aa42377 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -124,11 +124,13 @@ int file_map(const char *filename, char **buf, size_t *bufsize) } if (fstat(fd, &stats) < 0) { + close(fd); return -1; } *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); if (*buf == MAP_FAILED) { + close(fd); return -1; } *bufsize = stats.st_size; -- cgit v1.2.3-54-g00ecf From e978da492b7bef4c465f0461db034f55124b72a0 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 14 Jun 2004 21:33:01 -0700 Subject: [PATCH] tweak the gentoo default permission rules as they are wrong for tty and misc devices. --- etc/udev/udev.permissions.gentoo | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo index 6c422b8ce7..e257151512 100644 --- a/etc/udev/udev.permissions.gentoo +++ b/etc/udev/udev.permissions.gentoo @@ -3,7 +3,8 @@ # console devices console:root:tty:0600 -tty[0-9][0-9]*:root:tty:0660 +tty:root:tty:0666 +tty[0-9]*:root:tty:0660 vc/[0-9]*:root:tty:0660 # pty devices @@ -45,8 +46,8 @@ null:root:root:0666 zero:root:root:0666 # misc devices -nvram:root:root:0660 -rtc:root:root:0660 +misc/nvram:root:root:0660 +misc/rtc:root:root:0660 # floppy devices fd[01]*:root:floppy:0660 -- cgit v1.2.3-54-g00ecf From ff0977b12e8b92963c687b593c3f1bc33e3d8a9c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Jul 2004 00:29:06 -0700 Subject: [PATCH] change default perms of misc/rtc to be readable by anyone. --- etc/udev/udev.permissions.gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo index e257151512..7bde9833d7 100644 --- a/etc/udev/udev.permissions.gentoo +++ b/etc/udev/udev.permissions.gentoo @@ -47,7 +47,7 @@ zero:root:root:0666 # misc devices misc/nvram:root:root:0660 -misc/rtc:root:root:0660 +misc/rtc:root:root:0664 # floppy devices fd[01]*:root:floppy:0660 -- cgit v1.2.3-54-g00ecf From 8108813b5f52d92625003bc42bdd522aca02e8a2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 14 Jun 2004 21:36:50 -0700 Subject: [PATCH] 027 release --- ChangeLog | 10 ++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fea6a7f91..cc754dc9d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Summary of changes from v026 to v027 +============================================ + +: + o fix handle leak in udev_lib.c + +Greg Kroah-Hartman: + o tweak the gentoo default permission rules as they are wrong for tty and misc devices + + Summary of changes from v025 to v026 ============================================ diff --git a/Makefile b/Makefile index 625c21efc0..1e683cb35c 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 026 +VERSION = 027 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 591a60bc87..07fafbbc79 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 026 +Version: 027 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 57218a087303505b01fb20cbe4c6961bd13fe411 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 26 Jun 2004 01:08:47 -0700 Subject: [PATCH] reverse order of scanning of udevstart to look at class before block. this should fix the startup issue for lvm, hopefully... --- udevstart.c | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/udevstart.c b/udevstart.c index 1d9b60464c..2d11edeca2 100644 --- a/udevstart.c +++ b/udevstart.c @@ -87,8 +87,13 @@ static void udev_scan(void) DIR *dir; struct dirent *dent; - devpath = "block"; - dir = opendir(SYSBLOCK); + /* + * We want to scan the class tree first as lvm and dm needs to be able + * to have access to the char control device when probing the block + * devices. + */ + devpath = "class"; + dir = opendir(SYSCLASS); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char dirname[MAX_PATHLEN]; @@ -99,15 +104,12 @@ static void udev_scan(void) (strcmp(dent->d_name, "..") == 0)) continue; - snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name); - dirname[MAX_PATHLEN-1] = '\0'; - udev_exec(dirname, "block"); - - snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name); + snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); + dirname[MAX_PATHLEN] = '\0'; dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN]; + char dirname2[MAX_PATHLEN-1]; DIR *dir3; struct dirent *dent3; @@ -124,10 +126,10 @@ static void udev_scan(void) char filename[MAX_PATHLEN]; if (strcmp(dent3->d_name, "dev") == 0) { - snprintf(filename, MAX_PATHLEN, "/block/%s/%s", + snprintf(filename, MAX_PATHLEN, "/class/%s/%s", dent->d_name, dent2->d_name); filename[MAX_PATHLEN-1] = '\0'; - udev_exec(filename, "block"); + udev_exec(filename, dent->d_name); } } closedir(dir3); @@ -139,8 +141,8 @@ static void udev_scan(void) closedir(dir); } - devpath = "class"; - dir = opendir(SYSCLASS); + devpath = "block"; + dir = opendir(SYSBLOCK); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char dirname[MAX_PATHLEN]; @@ -151,12 +153,15 @@ static void udev_scan(void) (strcmp(dent->d_name, "..") == 0)) continue; - snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); - dirname[MAX_PATHLEN] = '\0'; + snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name); + dirname[MAX_PATHLEN-1] = '\0'; + udev_exec(dirname, "block"); + + snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name); dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN-1]; + char dirname2[MAX_PATHLEN]; DIR *dir3; struct dirent *dent3; @@ -173,10 +178,10 @@ static void udev_scan(void) char filename[MAX_PATHLEN]; if (strcmp(dent3->d_name, "dev") == 0) { - snprintf(filename, MAX_PATHLEN, "/class/%s/%s", + snprintf(filename, MAX_PATHLEN, "/block/%s/%s", dent->d_name, dent2->d_name); filename[MAX_PATHLEN-1] = '\0'; - udev_exec(filename, dent->d_name); + udev_exec(filename, "block"); } } closedir(dir3); @@ -189,7 +194,6 @@ static void udev_scan(void) } } - int main(int argc, char *argv[], char *envp[]) { init_logging("udevstart"); -- cgit v1.2.3-54-g00ecf From c5d046b6c7f4dbd2072933b792f95f2793b28178 Mon Sep 17 00:00:00 2001 From: "atul.sabharwal@intel.com" Date: Sat, 26 Jun 2004 01:18:08 -0700 Subject: [PATCH] Patch for chassis_id exras module --- extras/chassis_id/Makefile | 38 ++++++++++++++++------------ extras/chassis_id/chassis_id.c | 57 +++++++++++++++++------------------------- extras/chassis_id/chassis_id.h | 33 +++++++++++++++--------- extras/chassis_id/install.txt | 49 ++++++++++++++++++++++++++++++++++++ extras/chassis_id/table.c | 40 ++++++++++++++++------------- extras/chassis_id/udev.rules | 7 ++++++ 6 files changed, 144 insertions(+), 80 deletions(-) create mode 100644 extras/chassis_id/install.txt create mode 100644 extras/chassis_id/udev.rules diff --git a/extras/chassis_id/Makefile b/extras/chassis_id/Makefile index d3152e863c..1b641cafda 100644 --- a/extras/chassis_id/Makefile +++ b/extras/chassis_id/Makefile @@ -1,19 +1,25 @@ -# -# ** -# ** (C) 2003 Intel Corporation -# ** Atul Sabharwal -# ** -# ** $Id: Makefile,v 1.3 2004/03/22 23:54:54 atul Exp $ -# ** -# ** Distributed under the terms of the GNU Public License, v2.0 or -# ** later. -# ** -# ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; -# ** with his permission, they have been re-licensed GPL, and his -# ** copyright still applies on them. -# ** -# */ -# +# * +# * Makefile +# * +# * Copyright (C) 2004 Intel Corporation. All rights reserved. +# * +# * This program is free software; you can redistribute it and/or +# * modify it under the terms of the GNU General Public +# * License v2.0 as published by the Free Software Foundation; +# * +# * 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., 59 Temple Place - Suite 330, +# * Boston, MA 021110-1307, USA. +# * +# * Authors: Atul Sabharwal +# * +# * CFLAGS = -g TARGET = chassis_id diff --git a/extras/chassis_id/chassis_id.c b/extras/chassis_id/chassis_id.c index 857707eac7..3fdfa96018 100644 --- a/extras/chassis_id/chassis_id.c +++ b/extras/chassis_id/chassis_id.c @@ -1,15 +1,24 @@ -/* -*-c-*-: - ** - ** (C) 2003 Intel Corporation - ** Atul Sabharwal - ** - ** Distributed under the terms of the GNU Public License, v2.0 or - ** later. - ** - ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; - ** with his permission, they have been re-licensed GPL, and his - ** copyright still applies on them - ** +/* + * chassis_id.c + * + * Copyright (C) 2004 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v 2.0 as published by the Free Software Foundation; + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + * Authors: Atul Sabharwal + * */ #include @@ -22,33 +31,13 @@ int main(int argc, char **argv, char ** envp) { - int chassis_num, slot_num, retval, host_num; + int chassis_num, slot_num, retval; char disk_snum[255], devpath[255]; char *ptr; int disk_index; syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", "starting chassis_id" ); -#if 0 - ptr = getenv("CHASSIS"); - if (ptr == NULL) - return -ERROR_NO_CHASSIS; - - sscanf(ptr, "%d", &chassis_num); - #ifdef DEBUG - syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "Chassis %d", chassis_num); - #endif - - - ptr = getenv("SLOT"); - if (ptr== NULL) - return -ERROR_NO_SLOT; - - sscanf(ptr, "%d", &slot_num); - #ifdef DEBUG - syslog( LOG_PID|LOG_DAEMON| LOG_ERR, "Slot %d", slot_num); - #endif -#endif ptr = getenv("DEVPATH"); if (ptr == NULL) return -ERROR_NO_DEVPATH; @@ -65,7 +54,7 @@ int main(int argc, char **argv, char ** envp) getserial_number(devpath, disk_snum); /* Now we open the provisioning table t find actual entry for the serial number*/ - disk_index = table_find_disk(disk_snum, &host_num, &chassis_num, &slot_num); + disk_index = table_find_disk(disk_snum, &chassis_num, &slot_num); if ( disk_index == -1 ) { // typical provisioning error return -ERROR_NO_DISK; diff --git a/extras/chassis_id/chassis_id.h b/extras/chassis_id/chassis_id.h index 253e603bfd..9937e3dfac 100644 --- a/extras/chassis_id/chassis_id.h +++ b/extras/chassis_id/chassis_id.h @@ -1,15 +1,24 @@ -/* -*-c-*-: - ** - ** (C) 2003 Intel Corporation - ** Atul Sabharwal - ** - ** Distributed under the terms of the GNU Public License, v2.0 or - ** later. - ** - ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; - ** with his permission, they have been re-licensed GPL, and his - ** copyright still applies on them. - ** +/* + * chassis_id.h + * + * Copyright (C) 2004 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v 2.0 as published by the Free Software Foundation; + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + * Authors: Atul Sabharwal + * */ #ifndef _CHASSIS_ID_H diff --git a/extras/chassis_id/install.txt b/extras/chassis_id/install.txt new file mode 100644 index 0000000000..a567afedcf --- /dev/null +++ b/extras/chassis_id/install.txt @@ -0,0 +1,49 @@ + +Udev does not come pre-installed on a Linux system. Hence, we need to do the following before +a Linux system is ready :: + +Steps: +~~~~~ +1. Install libsysfs shared libraries by installing sysfsutils-0.4.0. + +2. Download latest version of udev from www.kernel.org site. It is + under repository->utils->kernel path chain. + + Do make and make install so as to install udev. To install scsi_id, + go into extras/scsi_id folder to compile scsi_id. Typically, this + would be in /sbin folder. Now, change scsi_id.cfg and set the + global option to work with all devices ( -g) and comment out the + black list option ( -b ). + +3. Download chassis_id callout code and compile. Install chassis_id and + provision.tbl file in /usr/local/bin. + +4. In /etc/rc.sysinit, add mount command to mount the sys memory file + system. ( mount -t sysfs sys /sys ). The /sys is necessary as + lot of the software components expect it to be in /sys. + +5. Now, in /etc/udev/udev.rules, install the udev rules file. This + is the GDN config file which is used by udev to create folders + in the form chasis/slot/port/disk

      . + +6. Now, you are almost there. Refer to PROVISIONING file. + + +PROVISIONING: +1. For GDN, the provisioning file is in the format : + + + SCSI host on which the device is connected + how many disks on this blade ? + chassis Number + Physical slot number + Serial Number for the disk + Name of the disk device. + +2. To fill the provisioning table, the user needs to collect this information and + fill provision.tbl. + + The serial number is found from the command scsi_id -p 0x80 -s . + + The host number is availble from the sys file system. The chassis & slot + are visual data and should be enetered into provision.tbl. diff --git a/extras/chassis_id/table.c b/extras/chassis_id/table.c index e619fa9ef3..f4689ae243 100644 --- a/extras/chassis_id/table.c +++ b/extras/chassis_id/table.c @@ -1,17 +1,24 @@ -/* -*-c-*-: - ** - ** (C) 2003 Intel Corporation - ** Atul Sabharwal - ** - ** $Id: table.c,v 1.4 2004/03/18 21:56:24 atul Exp $ - ** - ** Distributed under the terms of the GNU Public License, v2.0 or - ** later. - ** - ** Many parts heavily based on test-skeleton.c, by Ulrich Drepper; - ** with his permission, they have been re-licensed GPL, and his - ** copyright still applies on them. - ** +/* + * table.c + * + * Copyright (C) 2004 Intel Corporation. All rights reserved. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License v2.0 as published by the Free Software Foundation; + * + * 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., 59 Temple Place - Suite 330, + * Boston, MA 021110-1307, USA. + * + * Authors: Atul Sabharwal + * */ #include @@ -22,7 +29,6 @@ struct provision_record { int id; - int host_num; //port # or adaptor number int num_disks; int chassis_num; int slot_num; @@ -51,7 +57,7 @@ int table_init() while (!feof(fp)) { fgets(ptr, 80, fp); sscanf(ptr, "%d %d %d %d %d %s %s", &ptable[i].id, - &ptable[i].host_num, &ptable[i].num_disks, + &ptable[i].num_disks, &ptable[i].chassis_num, &ptable[i].slot_num, ptable[i].serial_num, ptable[i].name); i++; @@ -70,7 +76,6 @@ int table_find_disk( char * serialnumber , int * host_num, int * chassis_num, in for (i = 0; i < ptable_size; i++) { if (strcmp(ptable[i].serial_num, serialnumber) == 0) { - *host_num = ptable[i].host_num; *chassis_num = ptable[i].chassis_num; *slot_num = ptable[i].slot_num; break; @@ -91,7 +96,6 @@ int table_select_disk( int diskindex ) { printf("%d ", ptable[diskindex].chassis_num); printf("%d ", ptable[diskindex].slot_num); - printf("%d ", ptable[diskindex].host_num); printf("%s ", ptable[diskindex].name); } diff --git a/extras/chassis_id/udev.rules b/extras/chassis_id/udev.rules new file mode 100644 index 0000000000..b1618c1b0b --- /dev/null +++ b/extras/chassis_id/udev.rules @@ -0,0 +1,7 @@ +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# See the udev.rules.examples file for more examples of how to create rules +# + +BUS="scsi", PROGRAM="/usr/local/bin/chassis_id", NAME="/chassis%c{1}/slot%c{2}/%c{3}" -- cgit v1.2.3-54-g00ecf From c59a72105d0ff8a47b31f1829dd3c166ebd859d0 Mon Sep 17 00:00:00 2001 From: "dsd@gentoo.org" Date: Sat, 26 Jun 2004 01:18:12 -0700 Subject: [PATCH] Writing udev rules doc update Here's an update to the documentation. It makes a few minor corrections and adds info about multiple-symlinks. It also seems that the patch I sent on April 27th (patching v0.53 to 0.54) was not applied, so this patch includes that update too, which was also just some small corrections plus added info on renaming network devices. --- docs/writing_udev_rules/index.html | 114 ++++++++++++++++++++++++------------- 1 file changed, 74 insertions(+), 40 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index 1a2702aeaf..9396184366 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -8,7 +8,7 @@

      Writing udev rules

      by Daniel Drake (dsd)
      -Version 0.53

      +Version 0.55

      The most recent version of this document can always be found at:
      http://www.reactivated.net/udevrules.php @@ -32,14 +32,16 @@ The most recent version of this document can always be found at:
    • Additional notes on writing rules for USB storage
    • Example: Writing convenience rules for my CD drives
    • +
    • Example: Writing a rule to name my network interface
    • Tips for finding the appropriate places in SYSFS
    • +
    • Using multiple SYMLINK style rules
    • udev vs Nvidia's graphics drivers
    • Author and credits
    • About this document

      -udev is targetted at Linux kernels 2.6 and beyond to provide a userspace solution for a dynamic /dev directory, with persistant device naming. The previous /dev implementation, devfs, is now deprecated, and udev is seen as the successor. udev vs devfs is a sensitive area of conversation - you should read this document before making comparisons.

      +udev is targetted at Linux kernels 2.6 and beyond to provide a userspace solution for a dynamic /dev directory, with persistent device naming. The previous /dev implementation, devfs, is now deprecated, and udev is seen as the successor. udev vs devfs is a sensitive area of conversation - you should read this document before making comparisons.

      udev is a well thought out solution, but I was initially very confused how I might customise it for my system. This document attempts to make the process of rule writing a little bit clearer.

      @@ -51,20 +53,21 @@ This document assumes that you have udev/hotplug installed and running OK with d

      History

      -April 15th 2004: Minor corrections. Added info about NAME{all_partitions}. Added info about other udevinfo tricks.

      -April 14th 2004: Reverted to suggesting using "udev.rules" until the udev defaults allow for other files. Minor work.

      -April 6th 2004: I now write suggest users to use their own "local.rules" file rather than prepending "udev.rules".

      -April 3rd 2004: Minor cleanups and preparations for possible inclusion in the udev distribution.

      -February 15th 2004: Initial publication.

      -February 18th 2004: Fixed a small omission in an example. Updated section on identifying mass-storage devices. Updated section on nvidia.

      -February 23rd 2004: Rewrote some parts to emphasise how sysfs naming works, and how it can be matched. Updated rule-writing parts to represent udev 018s new SYSFS{filename} naming scheme. Improved sectioning, and clarified many points. Added info about KDE.

      -March 20th 2004: General improvements, clarifications, and cleanups. Added more information about writing rules for usb-storage.

      +June 20th 2004 v0.55: Added info on multiple symlinks, and some minor changes/updates.

      +April 26th 2004 v0.54: Added some Debian info. Minor corrections. Re-reverted information about what to call your rule file. Added info about naming network interfaces.

      +April 15th 2004 v0.53: Minor corrections. Added info about NAME{all_partitions}. Added info about other udevinfo tricks.

      +April 14th 2004 v0.52: Reverted to suggesting using "udev.rules" until the udev defaults allow for other files. Minor work.

      +April 6th 2004 v0.51: I now write suggest users to use their own "local.rules" file rather than prepending "udev.rules".

      +April 3rd 2004 v0.5: Minor cleanups and preparations for possible inclusion in the udev distribution.

      +March 20th 2004 v0.4: General improvements, clarifications, and cleanups. Added more information about writing rules for usb-storage.

      +February 23rd 2004 v0.3: Rewrote some parts to emphasise how sysfs naming works, and how it can be matched. Updated rule-writing parts to represent udev 018s new SYSFS{filename} naming scheme. Improved sectioning, and clarified many points. Added info about KDE.

      +February 18th 2004 v0.2: Fixed a small omission in an example. Updated section on identifying mass-storage devices. Updated section on nvidia.

      +February 15th 2004 v0.1: Initial publication.

      Software versions used at time of writing

      -Linux Kernel 2.6.5-rc3
      - -udev 024
      +Linux Kernel 2.6.7
      +udev 027
      hotplug 20040401

      @@ -84,26 +87,24 @@ The original /dev directories were just populated with every device that As stated above, writing rules for udev is an optional process. By default, you can plug a device in, and the a relevant node (e.g. /dev/sda for a mass-storage device) will be there, just like in previous /dev implementations.

      -However, udev allows you to customise the naming of device nodes. There are two reasons why you might want to do this: convenience, and persistant naming.

      +However, udev allows you to customise the naming of device nodes. There are two reasons why you might want to do this: convenience, and persistent naming.

      -Take the example of using udev, so that when your printer is plugged in, it gets named as /dev/printer and also as the usual /dev/lp0. It's not only convenience (e.g. reading and interpreting "printer" as opposed to "lp0"), its a solution for non-persistant naming. Say that I have two printers - a HP laser printer and an Epson inkjet. When they are both plugged in and on, I have /dev/lp0 and /dev/lp1.
      +Take the example of using udev, so that when your printer is plugged in, it gets named as /dev/printer and also as the usual /dev/lp0. It's not only convenience (e.g. reading and interpreting "printer" as opposed to "lp0"), its a solution for non-persistent naming. Say that I have two printers - a HP laser printer and an Epson inkjet. When they are both plugged in and on, I have /dev/lp0 and /dev/lp1.
      How do I know which node refers to which printer? There is no easy way. The first printer that got connected was assigned name "lp0", and the second "lp1". Plugging in my printers in a different order would swap the names here, and that would mess up my scripts that always expect my HP laser printer to be lp1.

      -However, if my HP laser printer got named lp_hp (as well as lpX) and my other printer got named lp_epson (as well as lpY), then my scripts could just refer to those names. udev magic can control this and ensure that these persistant names always point to the device that I intended.

      +However, if my HP laser printer got named lp_hp (as well as lpX) and my other printer got named lp_epson (as well as lpY), then my scripts could just refer to those names. udev magic can control this and ensure that these persistent names always point to the device that I intended.

      -For external mass-storage devices (e.g. usb hard disks), persistant naming is very helpful in that it allows you to hardcode accurate device paths into your /etc/fstab.

      +For external mass-storage devices (e.g. usb hard disks), persistent naming is very helpful in that it allows you to hardcode accurate device paths into your /etc/fstab.

      The basics of writing rules

      -When populating /dev, udev decides which nodes to include, and how to name them, by reading a rules file. This rules file is processed from top to bottom, and udev will stop processing rules for a device once it finds one that matches.

      - -Default udev rules are stored in /etc/udev/udev.rules. The default file includes some examples, and defaults to giving a devfs-style layout. The examples may safely be removed, but it is generally sensible to keep the devfs rules and simply make your own amendments and modifications. You should write your rules in this file, above the examples and default devfs-style rules.

      +When populating /dev, udev decides which nodes to include, and how to name them, by reading a series of rules files.

      - +Files in /etc/udev/rules.d/ are parsed in lexical order. udev will stop processing rules as soon as it finds a matching rule in a file for the new item of hardware that has been detected. It is important that your own rules get processed before the udev defaults, otherwise your own naming schemes will not take effect! I suggest that you keep your own rules in a file at /etc/udev/rules.d/10-local.rules (this doesn't exist by default - create it). As 10 comes before 50, you know that your rules will be looked at first.

      As your own rules will effectively mask out the udev defaults which create the base /dev layout, it is recommended that you also specify devfs-style names/symlinks for the rules you write, so that you get the sensible defaults plus your own names.

      @@ -271,7 +272,13 @@ You will notice that a lot of information is not relevant for writing basic rule I will show three examples of this rule writing based on udevinfo output process below. I will then attempt to list some device-dependant tips and tricks for locating the correct info.

      -A reader wrote to me and informed me that he found KDE's control centre useful for writing rules. Apparently, information about USB devices (and others) can be found in the "Info Centre" section of the KDE Control Centre. This interface shows information such as serial number, vendor ID, etc. If you prefer a GUI-like approach, you might want to investigate this. +A reader wrote to me and informed me that he found KDE's control centre useful for writing rules. Apparently, information about USB devices (and others) can be found in the "Info Centre" section of the KDE Control Centre. This interface shows information such as serial number, vendor ID, etc. If you prefer a GUI-like approach, you might want to investigate this.

      + +The current releases of gnome-volume-manager are unable to treat symlink-nodes as real devices. Conversely as described above, you may wish to specify your own naming in the NAME parameter and specify %k in the SYMLINK parameter.

      + +The behaviour of your own rules masking the defaults can be overcome if you write multiple-SYMLINK style rules. + +

      Example: Writing a rule for my USB printer

      @@ -301,22 +308,17 @@ And my printer nodes exist at /dev/lp0 (or /dev/lp1 if another pri Quick Intro: My camera identifies itself as an external SCSI hard disk (it uses the usb-storage driver which is also used by devices such as USB hard disks and flash-card readers). I can then mount the partition on that disk and copy images over. Not all cameras work like this - many require external software (e.g. gphoto2) to be able to access photos.

      -This one is a bit tricky. Two nodes are created by default when my camera is connected : /dev/sda and /dev/sda1. sda1 is the node that I would like as my /dev/camera, as that is what gets mounted. The problem is that there are only small details which can be used as udev rules to show the difference between sda and sda1.

      +This one is a bit tricky. Several nodes are created by default when my camera is connected : /dev/sda and /dev/sda1, and possibly even /dev/sg1. This is an example where specifity is important - if your rule is not specific enough, it could match any of the above 3 nodes.

      -As these nodes (sda, sda1) are treated as block devices, looking in /sys/block would be a good place to start.

      +sda1 is the node that I would like as my /dev/camera, as that is what gets mounted. udevinfo did not point out any useful differences between sda, sda1, and sg1. I decided that a reliable way to differentiate between these 3 nodes would be to look at the KERNEL name.

      -In my /sys/block, I have a directory named sda. In my /sys/block/sda, I have a directory named sda1. Both of these directories have dev files in, so they are OK for udev rules. Running the following dumps a lot of information about my camera and the USB ports it is connected through. +A key such as KERNEL="sd?1" would match KERNEL names such as "sda1", "sdb1", "sdc1", and equally importantly, it will not match KERNEL names such as sda, sdb, or sg1. The purpose of this key is to ignore the /dev/sda and /dev/sg1 nodes. The device is a digital camera - I would not dream of fdisking it or anything like that, so these 2 nodes are pretty useless to me. The key attempts to capture the /dev/sda1 node, which is mountable and therefore useful!

      -
      -# udevinfo -a -p /sys/block/sda
      -# udevinfo -a -p /sys/block/sda/sda1
      -
      - -The output of both of these command was almost identical, so that does not help in writing keys to differentiate between sda and sda1.
      +As this node (sda1) is treated as a block device, looking in /sys/block would be a good place to start.

      -To differentiate between sda and sda1, I decided that matching KERNEL names would be most appropriate here. Some examples of KERNEL names for this type of device are: sda, sda1, sdb, sdb1, sdc, ...

      +In my /sys/block, I have a directory named sda. In my /sys/block/sda, I have a directory named sda1. Both of these directories have dev files in, so they are OK to run udevinfo on. Running the following dumps a lot of information about my camera and the USB port it is connected through. -udev's support for wildcards in key expressions comes in handy here. A key such as KERNEL="sd?1" would match KERNEL names such as "sda1", "sdb1", "sdc1", and equally importantly, it will not match KERNEL names such as sda, sdb (because the name must have a "1" on the end). The purpose of this key is to ignore the /dev/sda node. The device is a digital camera - I would not dream of fdisking it or anything like that, so this node is pretty useless to me. The key attempts to capture the /dev/sda1 node, which is mountable and therefore useful!

      +
      # udevinfo -a -p /sys/block/sda/sda1
      In the udevinfo output, I also noticed this bit of useful and understandable information:
      SYSFS{product}="USB 2.0M DSC"
      @@ -324,7 +326,7 @@ In the udevinfo output, I also noticed this bit of useful and understandable inf So that gives me my rule. For completeness, I also include a BUS key (this was also found in the udevinfo output).
      BUS="usb", SYSFS{product}="USB 2.0M DSC", KERNEL="sd?1", NAME="%k", SYMLINK="camera"
      -Now, when my camera is plugged in, it will be named /dev/sda1 (or, if sda1 isnt available, it might be called /dev/sdb1) and will always be correctly linked to from /dev/camera. The /dev/sda (or sdb) node still appears as normal, but the important thing is that my custom persistant "camera" symlink points to the mountable partition.

      +Now, when my camera is plugged in, it will be named /dev/sda1 (or, if sda1 isnt available, it might be called /dev/sdb1) and will always be correctly linked to from /dev/camera. The /dev/sda (or sdb) node still appears as normal, but the important thing is that my custom persistent "camera" symlink points to the mountable partition.

      Additional notes on writing rules for USB storage

      @@ -349,7 +351,7 @@ This problem also applies to other USB disks - e.g. if you create a new partitio udev provides a solution here - it is able to create nodes for all partitions of a block device. For every rule that you specify, the block device will have all 16 partition nodes created. To achieve this, you can simply modify the NAME key, as shown below:
      -
      BUS="usb", SYSFS{product}="USB 2.0 Storage Device", NAME{all_partitions}="usbhd%n"
      +
      BUS="usb", SYSFS{product}="USB 2.0 Storage Device", NAME{all_partitions}="usbhd"
      You will now have nodes named: usbhd, usbhd1, usbhd2, usbhd3, ..., usbhd15.

      @@ -359,13 +361,31 @@ I have two CD drives in my PC - a DVD reader, and a CD rewriter. My DVD is hdc a Still, some people (myself included) like to have nodes such as /dev/dvd and /dev/cdrw for convenience. Since we know the "hdX" values for these drives, writing rules is simple. The examples below should be self explanatory. -
       BUS="ide", KERNEL="hdc", NAME="%k", SYMLINK="dvd cdroms/cdrom%n"
       BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n"
       
      -You may have noticed that the default udev.rules file contains a rule which runs a script to produces names for block devices. Do not be confused by this - as usual, because your own rules are located at the top of the rules file, they are processed before the default rules, so the default rules will not be used when naming the hardware you have written rules for.

      +You may have noticed that the default 50-udev.rules file contains a rule which runs a script to produces names for block devices. Do not be confused by this - as usual, because your own rules are located in a file which is processed before the default rules, the defaults will not be used when naming the hardware you have written rules for.

      + + +

      Example: Writing a rule to name my network interface

      +An interesting new feature in recent udev versions is the ability to write rules to name your network interfaces. Network interfaces do not show up in /dev, but they are generally referenced by names (e.g. with ifconfig). Despite the differences, the rule writing process is almost identical.

      + +As usual, udevinfo comes to our aid in rule-writing. In my example, I wish to rename my "eth0" network device (the following output is snipped): + +
      +# udevinfo -a -p /sys/class/net/eth0/
      +  looking at class device '/sys/class/net/eth0':
      +    SYSFS{address}="00:52:8b:d5:04:48"
      +
      + +Every network adapter has its own unique MAC-address, so I chose to use this when writing my rule. This will not change, unless you change your network card. An example rule is shown below: + +
      KERNEL="eth*", SYSFS{address}="00:52:8b:d5:04:48", NAME="lan"
      + +You will need to reload the net driver for this rule to take effect. You can either unload and reload the module, or simply reboot the system. You will also need to reconfigure your system to use "lan" rather than "eth0". I had some troubles getting this going (the interface wasn't being renamed) until I had completely dropped all references to eth0.
      +After that, you should be able to use "lan" instead of "eth0" in any calls to ifconfig or similar utilities.

      Tips for finding the appropriate places in SYSFS

      @@ -383,6 +403,18 @@ BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n"
    • Remember that unfortunately, the kernel does not export information for all devices into sysfs, meaning that you simply can't write rules for some devices yet. On 20/02/04, the udev author stated that there are 162 drivers left to convert to sysfs.
    + +

    Using multiple SYMLINK style rules

    +Another recent feature is the ability to write rules that do not specify a NAME, but instead they simply specify SYMLINK keys. This allows you to avoid the issue where your own rules effectively mask the udev defaults.

    + +Take the rule:
    +
    KERNEL="hdc", SYMLINK="dvd"
    + +When udev finds this rule, it will take a mental note of it. Upon finding another rule matching the same device which also includes a NAME parameter, udev will create the node as specified by the NAME parameter, plus symbolic links as specified by the SYMLINK parameters of both rules.
    +To put it into practical terms, when udev is naming nodes for my hdc device, it will use the default rules for block devices as usual, with the addition of my personal symlink "dvd".

    + +Similarly to normal rules, rules of this type will only take effect if udev is able to find them before it finds a rule specifying a NAME parameter.

    +

    udev vs Nvidia's graphics drivers

    @@ -390,9 +422,9 @@ BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n" Nvidia's graphics drivers (the closed-source ones, not the ones that come with XFree) do not work with a default installation of udev - you are unable to start X. This is because the nvidia module is loaded by X, but the /dev/nvidia* nodes are not created quick enough, so X bails out.

    -The solution to this problem is to autoload the nvidia module on bootup. Yes - you are *supposed* to do this - the NVidia FAQ confirms this! On devfs-based systems, devfs did this automatically at bootup anyway. Your linux distribution will have created a file which you can list modules to be loaded on bootup (e.g. /etc/modules.autoload.d/kernel-2.6 for Gentoo).

    +The solution to this problem is to autoload the nvidia module on bootup. Yes - you are *supposed* to do this - the NVidia FAQ confirms this! On devfs-based systems, devfs did this automatically at bootup anyway. Your linux distribution will have created a file which you can list modules to be loaded on bootup (e.g. /etc/modules.autoload.d/kernel-2.6 for Gentoo, /etc/modules for Debian).

    -This isn't all - you will also need to patch the nvidia kernel interface to export some basic info to SYSFS so that udev will create the devices. Martin Schlemmer has written a patch against the 1.0.5336 version of the nvidia drivers, which can be found here. The Gentoo package nvidia-kernel-1.0.5336-r1 contains this patch.

    +This isn't all - you will also need to patch the nvidia kernel interface to export some basic info to SYSFS so that udev will create the devices. Martin Schlemmer has written a patch against the 1.0.5336 version of the nvidia drivers, which can be found here. The Gentoo package nvidia-kernel-1.0.5336-r4 contains this patch.

    Another solution is to simply create the nvidia specific nodes on bootup. X will then load the module when required, and as the nodes are already in existance, you will not run into the problem described above. Place these commands in a file that is automatically executed on bootup (e.g. /etc/conf.d/local.start for Gentoo):
    @@ -412,10 +444,12 @@ Additional thanks to:
     
  • The udev developers!
  • agrippa_cash (usb-storage info)
  • Carl Streeter (usb-storage info)
  • +
  • David Watson
  • Decibels
  • Frank Pieczynski
  • Feth Arezki
  • Jim (KDE info)
  • +
  • Johannes Jordens
  • Kay Sievers
  • Patrick Dreker
  • Todd Musall
  • -- cgit v1.2.3-54-g00ecf From 062db23d5eb303ef49d2ff805381229932f44246 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Sat, 26 Jun 2004 01:18:17 -0700 Subject: [PATCH] update udev scsi_id to scsi_id 0.5 This patch syncs the scsi_id in the udev tree to version 0.5. --- extras/scsi_id/ChangeLog | 39 +++++++++++++++++++++++++ extras/scsi_id/Makefile | 3 +- extras/scsi_id/TODO | 9 ++++-- extras/scsi_id/gen_scsi_id_udev_rules.sh | 35 ++++++++++------------- extras/scsi_id/release-notes | 49 ++++++++++++++------------------ extras/scsi_id/scsi_id.8 | 20 ++++++------- extras/scsi_id/scsi_id.c | 21 +++++++------- extras/scsi_id/scsi_id.config | 12 ++++---- extras/scsi_id/scsi_id.h | 6 +--- extras/scsi_id/scsi_serial.c | 8 ++++++ 10 files changed, 119 insertions(+), 83 deletions(-) diff --git a/extras/scsi_id/ChangeLog b/extras/scsi_id/ChangeLog index 095d84f2d0..bfa353431b 100644 --- a/extras/scsi_id/ChangeLog +++ b/extras/scsi_id/ChangeLog @@ -1,3 +1,42 @@ +2004-jun-23: + * scsi_id.h: increase MAX_SERIAL_LEN from 128 to 256, as some + devices (maybe broken ones) are giving really long id's. + +2004-jun-17: + * Makefile: Olaf Hering add spotless target (already in udev). + +2004-jun-17: + * scsi_serial.c: Include linux/compiler.h so we can build with + klibc using kernel headers. + +2004-may-24: + * scsi_id.c: Rename major and minor to maj min to avoid compiler + warnings when compiled with -D_GNU_SOURCE. + +2004-mar-30: + * scsi_id.config: Minor wording changes + +2004-mar-30: + * scsi_id.h: Don't supply a makedev() when built under klibc. + +2004-mar-30: + * scsi_id.c: Ken Brush Have the command line + options override generic options. + +2004-mar-05: + * scsi_serial.c: Log INQUIRY failure, including the + failing page code and vpd values. And add a dprintf() to + the scsi_inquiry function. + +2004-mar-02: + * gen_scsi_id_udev_rules.sh: Per bug report from Atul Sabharwal + change to not require that sysfs be + in the mount tab (and default to "/sys"), and fix so scsi_id + results containing spaces work correctly. + +2004-mar-02: + * scsi_id.8: Escape '-' with '\-'. + 2004-feb-25: * scsi_id.8: Add verbage about usage with udev, and running via hotplug. diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 6af4d7f18e..8fe29f3647 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.4 +SCSI_ID_VERSION=0.5 prefix = etcdir = ${prefix}/etc @@ -71,5 +71,6 @@ clean: rm -f $(PROG) $(OBJS) $(GEN_HEADER) spotless: clean + $(PROG): $(OBJS) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) diff --git a/extras/scsi_id/TODO b/extras/scsi_id/TODO index 4f302ea0a4..e0283cf444 100644 --- a/extras/scsi_id/TODO +++ b/extras/scsi_id/TODO @@ -1,6 +1,9 @@ -- Document that config file options override command line options, or fix - the code. This means a '-b' in the config file disables any -g on the - command line. +- Add an option to replace blanks with spaces, so the generated id can be + more easily used as a /dev name. + +- Add a bus white/black list option. So for example, all scsi devices + under USB could easily be blacklisted. This should allow multiple busses + to be listed. - Add code to check that SCSI commands get back enough data for their intended usage, mainly callers of scsi_inquiry(). diff --git a/extras/scsi_id/gen_scsi_id_udev_rules.sh b/extras/scsi_id/gen_scsi_id_udev_rules.sh index 07e21ebd50..874e94e8bb 100644 --- a/extras/scsi_id/gen_scsi_id_udev_rules.sh +++ b/extras/scsi_id/gen_scsi_id_udev_rules.sh @@ -27,22 +27,12 @@ prefix=disk- scsi_id=/sbin/scsi_id -dump_ids() -{ - cd ${sysfs_dir}/block - for b in sd* - do - echo -n "$b " - $scsi_id -s /block/$b - if [ $? != 0 ] - then - echo $0 failed for device $b >&2 - exit 1 - fi - done -} - sysfs_dir=$(mount | awk '$5 == "sysfs" {print $3}') +if [ "$sysfs_dir" = "" ] +then + sysfs_dir="/sys" + echo "Using sysfs mount point \"$sysfs_dir\"" >&2 +fi c=$(ls /${sysfs_dir}/block/sd* 2>/dev/null | wc -l) if [ $c = 0 ] @@ -56,12 +46,17 @@ echo "# Start of autogenerated scsi_id rules. Edit the NAME portions of these" echo "# rules to your liking." echo "#" first_line=yes -dump_ids | while read in + +# +cd ${sysfs_dir}/block +for name in sd* do - set $in - name=$1 - shift - id="$*" + id=$($scsi_id -s /block/$name) + if [ $? != 0 ] + then + echo $0 failed for device $name exiting >&2 + exit 1 + fi if [ $first_line = "yes" ] then first_line=no diff --git a/extras/scsi_id/release-notes b/extras/scsi_id/release-notes index a10b569c2d..2996713117 100644 --- a/extras/scsi_id/release-notes +++ b/extras/scsi_id/release-notes @@ -1,49 +1,42 @@ -Version 0.4 of scsi_id is available at: +Version 0.5 of scsi_id is available at: -http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.4.tar.gz +http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.5.tar.gz scsi_id is a program to generate a unique identifier for a given SCSI device. -It is primarily for use with the udev callout key. It could also be used -for automatic multi-path configuration or device mapper configuration. +It is primarily for use with the udev program key, or hotplug scripts that +want persistent naming of scsi devices. It could also be used for +automatic multi-path configuration or device mapper configuration. -Version 0.4 requires: +Version 0.5 requires: - Linux kernel 2.6 - libsysfs 0.4.0 Major changes since the last release: - - Support block device partitions + - Ken Brush have the command line options + override generic options. - - Added a script to auto-generate udev rules. The script is not - installed but is part of the tarball. + - Fix the gen_scsi_id_udev_rules.sh to handle spaces in the id. -Detailed changes: + - Don't supply a makedev() when built with klibc. Also, the + scsi_id supplied makedev() was using the old major/minor method. - - Add man page verbage about usage with udev, and running via - hotplug + - Include compiler.h so we can build against klibc, as recent sg.h + changes need a define for __user. - - Disable support for -e (all output to stderr) as it cannot be - used in any useful way, and the -c (device specific callout) as - the code is incomplete and has no users. +Other changes: - - Don't print errno for NULL return from sysfs_get_classdev_device. + - Increase the MAX_SERIAL_LEN from 128 to 256, as some (possibly + broken devics) are returning very long id's - - Get rid of dead/leftover code that checked if we are on a scsi - bus. + - Add spotless target (via Olaf Hering's udev patch) - - ":" consistently in output messages. + - minor wording changes in scsi_id.config - - Add missing new lines for some error messages. + - Log INQUIRY failure, including the failing page code and vpd + values - - open O_NONBLOCK so we handle tape drives without tapes loaded. - - - Remove hacks based on KLIBC define to get around problems when - building with udev (udev libsysfs files were rearranged). - - - As done in udev code, support partitions via looking for a - parent of the target path. Uses libsysfs functions to do most of - the work, and includes changing a lot of variables to be struct - sysfs_device instead of sysfs_class_device. + - Escape '-' with '\-' in the man page. diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index db3effbc45..69dd2a998a 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -12,12 +12,12 @@ all SCSI devices that properly support page 0x80 or page 0x83. If a result is generated it is sent to standard output, and the program exits with a zero value. If no identifier is output, the program exits -with a non-zero value. +with a non\-zero value. \fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP that require a unique SCSI identifier. -By default all devices are assume black listed, the \fB-g\fP option must +By default all devices are assume black listed, the \fB\-g\fP option must be specified on the command line or in the config file for any useful behaviour. @@ -58,18 +58,18 @@ mode, and expects the environment variable DEVPATH to specify the corresponding sysfs device. See section below on usage with \fBudev\fP. .TP .BI \-b -The default behaviour - treat the device as black listed, and do nothing -unless a white listed device is found in the scsi_id config-file. +The default behaviour \- treat the device as black listed, and do nothing +unless a white listed device is found in the scsi_id config\-file. .TP .BI \-d "\| device\^" Instead of determining and creating a device node based on a sysfs dev -entry as done for the \fB-s\fP, send SG_IO commands to +entry as done for the \fB\-s\fP, send SG_IO commands to \fBdevice\fP, such as \fB/dev/sdc\fP. .TP -.BI \-f "\| config-file" +.BI \-f "\| config\-file" Read configuration and black/white list entries from -.B config-file +.B config\-file rather than the default .B /etc/scsi_id.config file. @@ -89,9 +89,9 @@ Use SCSI INQUIRY VPD page code 0x80 or 0x83. The default behaviour is to query the available VPD pages, and use page 0x83 if found, else page 0x80 if found, else nothing. .TP -.BI \-s "\| sysfs-device" +.BI \-s "\| sysfs\-device" Generate an id for the -.B sysfs-device. +.B sysfs\-device. The sysfs mount point must not be included. For example, use /block/sd, not /sys/block/sd. .TP @@ -113,7 +113,7 @@ and the results will likely not be as expected. When in this mode, all errors and warnings are sent via syslog. -To determine the specific value needed in a RESULT key, use the -s option, +To determine the specific value needed in a RESULT key, use the \-s option, for example: .sp diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 1cd6981e5e..e893987868 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -111,7 +111,7 @@ int sysfs_get_attr(const char *devpath, const char *attr, char *value, return sysfs_read_attribute_value(attr_path, value, SYSFS_NAME_LEN); } -static int get_major_minor(const char *devpath, int *major, int *minor) +static int get_major_minor(const char *devpath, int *maj, int *min) { char dev_value[MAX_ATTR_LEN]; @@ -129,7 +129,7 @@ static int get_major_minor(const char *devpath, int *major, int *minor) } dprintf("dev value %s", dev_value); /* dev_value has a trailing \n */ - if (sscanf(dev_value, "%u:%u", major, minor) != 2) { + if (sscanf(dev_value, "%u:%u", maj, min) != 2) { log_message(LOG_WARNING, "%s: invalid dev major/minor\n", devpath); return -1; @@ -140,18 +140,18 @@ static int get_major_minor(const char *devpath, int *major, int *minor) static int create_tmp_dev(const char *devpath, char *tmpdev, int dev_type) { - int major, minor; + int maj, min; dprintf("(%s)\n", devpath); - if (get_major_minor(devpath, &major, &minor)) + if (get_major_minor(devpath, &maj, &min)) return -1; snprintf(tmpdev, MAX_NAME_LEN, "%s/%s-maj%d-min%d-%u", - TMP_DIR, TMP_PREFIX, major, minor, getpid()); + TMP_DIR, TMP_PREFIX, maj, min, getpid()); dprintf("tmpdev '%s'\n", tmpdev); - if (mknod(tmpdev, 0600 | dev_type, makedev(major, minor))) { + if (mknod(tmpdev, 0600 | dev_type, makedev(maj, min))) { log_message(LOG_WARNING, "mknod failed: %s\n", strerror(errno)); return -1; } @@ -759,10 +759,6 @@ int main(int argc, char **argv) strncpy(target_path, sysfs_mnt_path, MAX_NAME_LEN); strncat(target_path, devpath, MAX_NAME_LEN); - } else { - if (set_options(argc, argv, short_options, target_path, - maj_min_dev) < 0) - exit(1); } /* @@ -779,6 +775,11 @@ int main(int argc, char **argv) exit(1); free(newargv); } + if (!hotplug_mode) { + if (set_options(argc, argv, short_options, target_path, + maj_min_dev) < 0) + exit(1); + } if (!sys_specified) { log_message(LOG_WARNING, "-s must be specified\n"); diff --git a/extras/scsi_id/scsi_id.config b/extras/scsi_id/scsi_id.config index f3fc4b3fda..0567ecb7d6 100644 --- a/extras/scsi_id/scsi_id.config +++ b/extras/scsi_id/scsi_id.config @@ -9,12 +9,12 @@ # INQUIRY product identification field. Per the SCSI INQUIRY, the vendor # is limited to 8 bytes, model to 16 bytes. # -# The first maching line found is used. Short matches match longer ones, +# The first matching line found is used. Short matches match longer ones, # if you do not want such a match space fill the extra bytes. If no model # is specified, only the vendor string need match. # -# The "option" line is searched when scsi_id first starts up (for use with -# hotplug during boot). +# The "options" line is searched for when scsi_id starts up, and is +# primarily for use with hotplug. # # options= # @@ -32,12 +32,12 @@ options=-b # vendor=someone, model=nicedrive, options=-g -# If you all the scsi devices are your system support valid id's, remove -# the -b line above, and mark all devices as good: +# If you know all the scsi devices on your system support valid id's, +# remove the options=-b line, and mark all devices as good: ## options=-g # Then black list any offenders. Missing entries here could be dangerous -# if you rely on the id for naming or multi-path configuration! +# if you rely on the id for persistent naming or multi-path configuration. ## vendor=ELBONIA, model=borken, options=-b diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 9edb39ec49..10599ebb5f 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -37,7 +37,7 @@ * MAX_SERIAL_LEN: the maximum length of the serial number, including * added prefixes such as vendor and product (model) strings. */ -#define MAX_SERIAL_LEN 128 +#define MAX_SERIAL_LEN 256 /* * MAX_BUFFER_LEN: maximum buffer size and line length used while reading @@ -53,10 +53,6 @@ extern int scsi_get_serial (struct sysfs_device *scsi_dev, const char extern void log_message (int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -#ifdef __KLIBC__ -#define makedev(major, minor) ((major) << 8) | (minor) -#endif - #ifndef u8 typedef unsigned char u8; #endif diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index ae83330c30..e0074b662d 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -30,6 +30,7 @@ #include #include #include +#include /* need __user when built via klibc */ #include #include #include "scsi_id.h" @@ -312,6 +313,8 @@ static int scsi_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned buffer = inq + OFFSET; resend: + dprintf("%s evpd %d, page 0x%x\n", scsi_dev->name, evpd, page); + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); io_hdr.interface_id = 'S'; io_hdr.cmd_len = sizeof(inq_cmd); @@ -352,6 +355,11 @@ resend: retval = -1; } + if (retval < 0) + log_message(LOG_WARNING, + "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", + scsi_dev->name, evpd, page); + free(inq); return retval; } -- cgit v1.2.3-54-g00ecf From b99f344fde90ddc131ea6e2ec8520e018e1274e2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 26 Jun 2004 01:18:21 -0700 Subject: [PATCH] update udev_volume_id volume_id is now able to read NTFS labels. Not very exciting, but we keep up to date with the version in HAL. Also __packed__ was needed for the structs, cause the gcc 3.4 compiled version was no longer working properly. --- extras/volume_id/volume_id.c | 540 ++++++++++++++++++++++++++++--------------- extras/volume_id/volume_id.h | 18 +- 2 files changed, 361 insertions(+), 197 deletions(-) diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index dcc341c4dd..ac7e76b9d4 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -7,7 +7,7 @@ * the e2fsprogs. This is a simple straightforward implementation for * reading the label strings of only the most common filesystems. * If you need a full featured library with attribute caching, support for - * much more partition/media types or non-root data access, you may have + * much more partition/media types or non-root disk access, you may have * a look at: * http://e2fsprogs.sourceforge.net. * @@ -26,6 +26,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + #include #include #include @@ -55,12 +59,23 @@ (((__u32)(x) & 0x0000ff00u) << 8) | \ (((__u32)(x) & 0x000000ffu) << 24)) +#define bswap64(x) (__u64)((((__u64)(x) & 0xff00000000000000u) >> 56) | \ + (((__u64)(x) & 0x00ff000000000000u) >> 40) | \ + (((__u64)(x) & 0x0000ff0000000000u) >> 24) | \ + (((__u64)(x) & 0x000000ff00000000u) >> 8) | \ + (((__u64)(x) & 0x00000000ff000000u) << 8) | \ + (((__u64)(x) & 0x0000000000ff0000u) << 24) | \ + (((__u64)(x) & 0x000000000000ff00u) << 40) | \ + (((__u64)(x) & 0x00000000000000ffu) << 56)) + #if (__BYTE_ORDER == __LITTLE_ENDIAN) #define le16_to_cpu(x) (x) #define le32_to_cpu(x) (x) +#define le64_to_cpu(x) (x) #elif (__BYTE_ORDER == __BIG_ENDIAN) #define le16_to_cpu(x) bswap16(x) #define le32_to_cpu(x) bswap32(x) +#define le64_to_cpu(x) bswap64(x) #endif /* size of superblock buffer, reiser block is at 64k */ @@ -69,15 +84,17 @@ #define SEEK_BUFFER_SIZE 0x800 -static void set_label_raw(struct volume_id *id, char *buf, int count) +static void set_label_raw(struct volume_id *id, + const __u8 *buf, unsigned int count) { memcpy(id->label_raw, buf, count); id->label_raw_len = count; } -static void set_label_string(struct volume_id *id, char *buf, int count) +static void set_label_string(struct volume_id *id, + const __u8 *buf, unsigned int count) { - int i; + unsigned int i; memcpy(id->label_string, buf, count); @@ -90,9 +107,42 @@ static void set_label_string(struct volume_id *id, char *buf, int count) id->label_string[i+1] = '\0'; } -static void set_uuid(struct volume_id *id, unsigned char *buf, int count) +#define LE 0 +#define BE 1 +static void set_label_unicode16(struct volume_id *id, + const __u8 *buf, + unsigned int endianess, + unsigned int count) +{ + unsigned int i, j; + __u16 c; + + j = 0; + for (i = 0; i <= count-2; i += 2) { + if (endianess == LE) + c = (buf[i+1] << 8) | buf[i]; + else + c = (buf[i] << 8) | buf[i+1]; + if (c == 0) { + id->label_string[j] = '\0'; + break; + } else if (c < 0x80) { + id->label_string[j++] = (__u8) c; + } else if (c < 0x800) { + id->label_string[j++] = (__u8) (0xc0 | (c >> 6)); + id->label_string[j++] = (__u8) (0x80 | (c & 0x3f)); + } else { + id->label_string[j++] = (__u8) (0xe0 | (c >> 12)); + id->label_string[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f)); + id->label_string[j++] = (__u8) (0x80 | (c & 0x3f)); + } + } +} + +static void set_uuid(struct volume_id *id, + const __u8 *buf, unsigned int count) { - int i; + unsigned int i; memcpy(id->uuid, buf, count); @@ -121,9 +171,10 @@ set: } } -static char *get_buffer(struct volume_id *id, size_t off, size_t len) +static __u8 *get_buffer(struct volume_id *id, + unsigned long off, unsigned int len) { - size_t buf_len; + unsigned int buf_len; /* check if requested area fits in superblock buffer */ if (off + len <= SB_BUFFER_SIZE) { @@ -135,8 +186,8 @@ static char *get_buffer(struct volume_id *id, size_t off, size_t len) /* check if we need to read */ if ((off + len) > id->sbbuf_len) { - dbg("read sbbuf len:0x%x", off + len); - lseek(id->fd, 0, SEEK_SET); + dbg("read sbbuf len:0x%lx", off + len); + lseek64(id->fd, 0, SEEK_SET); buf_len = read(id->fd, id->sbbuf, off + len); id->sbbuf_len = buf_len; if (buf_len < off + len) @@ -158,9 +209,10 @@ static char *get_buffer(struct volume_id *id, size_t off, size_t len) /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - dbg("read seekbuf off:0x%x len:0x%x", off, len); - lseek(id->fd, off, SEEK_SET); + dbg("read seekbuf off:0x%lx len:0x%x", off, len); + lseek64(id->fd, off, SEEK_SET); buf_len = read(id->fd, id->seekbuf, len); + dbg("got 0x%x (%i) bytes", buf_len, buf_len); id->seekbuf_off = off; id->seekbuf_len = buf_len; if (buf_len < len) @@ -191,23 +243,23 @@ static void free_buffer(struct volume_id *id) static int probe_ext(struct volume_id *id) { struct ext2_super_block { - __u32 inodes_count; - __u32 blocks_count; - __u32 r_blocks_count; - __u32 free_blocks_count; - __u32 free_inodes_count; - __u32 first_data_block; - __u32 log_block_size; - __u32 dummy3[7]; - unsigned char magic[2]; - __u16 state; - __u32 dummy5[8]; - __u32 feature_compat; - __u32 feature_incompat; - __u32 feature_ro_compat; - unsigned char uuid[16]; - char volume_name[16]; - } *es; + __u32 inodes_count; + __u32 blocks_count; + __u32 r_blocks_count; + __u32 free_blocks_count; + __u32 free_inodes_count; + __u32 first_data_block; + __u32 log_block_size; + __u32 dummy3[7]; + __u8 magic[2]; + __u16 state; + __u32 dummy5[8]; + __u32 feature_compat; + __u32 feature_incompat; + __u32 feature_ro_compat; + __u8 uuid[16]; + __u8 volume_name[16]; + } __attribute__((__packed__)) *es; es = (struct ext2_super_block *) get_buffer(id, EXT_SUPERBLOCK_OFFSET, 0x200); @@ -239,20 +291,20 @@ static int probe_ext(struct volume_id *id) static int probe_reiser(struct volume_id *id) { struct reiser_super_block { - __u32 blocks_count; - __u32 free_blocks; - __u32 root_block; - __u32 journal_block; - __u32 journal_dev; - __u32 orig_journal_size; - __u32 dummy2[5]; - __u16 blocksize; - __u16 dummy3[3]; - unsigned char magic[12]; - __u32 dummy4[5]; - unsigned char uuid[16]; - char label[16]; - } *rs; + __u32 blocks_count; + __u32 free_blocks; + __u32 root_block; + __u32 journal_block; + __u32 journal_dev; + __u32 orig_journal_size; + __u32 dummy2[5]; + __u16 blocksize; + __u16 dummy3[3]; + __u8 magic[12]; + __u32 dummy4[5]; + __u8 uuid[16]; + __u8 label[16]; + } __attribute__((__packed__)) *rs; rs = (struct reiser_super_block *) get_buffer(id, REISER_SUPERBLOCK_OFFSET, 0x200); @@ -288,19 +340,19 @@ found: static int probe_xfs(struct volume_id *id) { struct xfs_super_block { - unsigned char magic[4]; - __u32 blocksize; - __u64 dblocks; - __u64 rblocks; - __u32 dummy1[2]; - unsigned char uuid[16]; - __u32 dummy2[15]; - char fname[12]; - __u32 dummy3[2]; - __u64 icount; - __u64 ifree; - __u64 fdblocks; - } *xs; + __u8 magic[4]; + __u32 blocksize; + __u64 dblocks; + __u64 rblocks; + __u32 dummy1[2]; + __u8 uuid[16]; + __u32 dummy2[15]; + __u8 fname[12]; + __u32 dummy3[2]; + __u64 icount; + __u64 ifree; + __u64 fdblocks; + } __attribute__((__packed__)) *xs; xs = (struct xfs_super_block *) get_buffer(id, 0, 0x200); if (xs == NULL) @@ -323,17 +375,17 @@ static int probe_xfs(struct volume_id *id) static int probe_jfs(struct volume_id *id) { struct jfs_super_block { - unsigned char magic[4]; - __u32 version; - __u64 size; - __u32 bsize; - __u32 dummy1; - __u32 pbsize; - __u32 dummy2[27]; - unsigned char uuid[16]; - unsigned char label[16]; - unsigned char loguuid[16]; - } *js; + __u8 magic[4]; + __u32 version; + __u64 size; + __u32 bsize; + __u32 dummy1; + __u32 pbsize; + __u32 dummy2[27]; + __u8 uuid[16]; + __u8 label[16]; + __u8 loguuid[16]; + } __attribute__((__packed__)) *js; js = (struct jfs_super_block *) get_buffer(id, JFS_SUPERBLOCK_OFFSET, 0x200); @@ -356,34 +408,34 @@ static int probe_jfs(struct volume_id *id) static int probe_vfat(struct volume_id *id) { struct vfat_super_block { - unsigned char ignored[3]; - unsigned char sysid[8]; - unsigned char sector_size[2]; - __u8 cluster_size; - __u16 reserved; - __u8 fats; - unsigned char dir_entries[2]; - unsigned char sectors[2]; - unsigned char media; - __u16 fat_length; - __u16 secs_track; - __u16 heads; - __u32 hidden; - __u32 total_sect; - __u32 fat32_length; - __u16 flags; - __u8 version[2]; - __u32 root_cluster; - __u16 insfo_sector; - __u16 backup_boot; - __u16 reserved2[6]; - unsigned char unknown[3]; - unsigned char serno[4]; - char label[11]; - unsigned char magic[8]; - unsigned char dummy2[164]; - unsigned char pmagic[2]; - } *vs; + __u8 ignored[3]; + __u8 sysid[8]; + __u8 sector_size[2]; + __u8 cluster_size; + __u16 reserved; + __u8 fats; + __u8 dir_entries[2]; + __u8 sectors[2]; + __u8 media; + __u16 fat_length; + __u16 secs_track; + __u16 heads; + __u32 hidden; + __u32 total_sect; + __u32 fat32_length; + __u16 flags; + __u8 version[2]; + __u32 root_cluster; + __u16 insfo_sector; + __u16 backup_boot; + __u16 reserved2[6]; + __u8 unknown[3]; + __u8 serno[4]; + __u8 label[11]; + __u8 magic[8]; + __u8 dummy2[164]; + __u8 pmagic[2]; + } __attribute__((__packed__)) *vs; vs = (struct vfat_super_block *) get_buffer(id, 0, 0x200); if (vs == NULL) @@ -409,27 +461,27 @@ found: static int probe_msdos(struct volume_id *id) { struct msdos_super_block { - unsigned char ignored[3]; - unsigned char sysid[8]; - unsigned char sector_size[2]; - __u8 cluster_size; - __u16 reserved; - __u8 fats; - unsigned char dir_entries[2]; - unsigned char sectors[2]; - unsigned char media; - __u16 fat_length; - __u16 secs_track; - __u16 heads; - __u32 hidden; - __u32 total_sect; - unsigned char unknown[3]; - unsigned char serno[4]; - char label[11]; - unsigned char magic[8]; - unsigned char dummy2[192]; - unsigned char pmagic[2]; - } *ms; + __u8 ignored[3]; + __u8 sysid[8]; + __u8 sector_size[2]; + __u8 cluster_size; + __u16 reserved; + __u8 fats; + __u8 dir_entries[2]; + __u8 sectors[2]; + __u8 media; + __u16 fat_length; + __u16 secs_track; + __u16 heads; + __u32 hidden; + __u32 total_sect; + __u8 unknown[3]; + __u8 serno[4]; + __u8 label[11]; + __u8 magic[8]; + __u8 dummy2[192]; + __u8 pmagic[2]; + } __attribute__((__packed__)) *ms; ms = (struct msdos_super_block *) get_buffer(id, 0, 0x200); if (ms == NULL) @@ -459,45 +511,43 @@ static int probe_udf(struct volume_id *id) { struct volume_descriptor { struct descriptor_tag { - __u16 id; - __u16 version; - unsigned char checksum; - unsigned char reserved; - __u16 serial; - __u16 crc; - __u16 crc_len; - __u32 location; - } tag; + __u16 id; + __u16 version; + __u8 checksum; + __u8 reserved; + __u16 serial; + __u16 crc; + __u16 crc_len; + __u32 location; + } __attribute__((__packed__)) tag; union { struct anchor_descriptor { - __u32 length; - __u32 location; - } anchor; + __u32 length; + __u32 location; + } __attribute__((__packed__)) anchor; struct primary_descriptor { - __u32 seq_num; - __u32 desc_num; + __u32 seq_num; + __u32 desc_num; struct dstring { - char clen; - char c[31]; - } ident; - } primary; - } type; - } *vd; + __u8 clen; + __u8 c[31]; + } __attribute__((__packed__)) ident; + } __attribute__((__packed__)) primary; + } __attribute__((__packed__)) type; + } __attribute__((__packed__)) *vd; struct volume_structure_descriptor { - unsigned char type; - char id[5]; - unsigned char version; + __u8 type; + __u8 id[5]; + __u8 version; } *vsd; - size_t bs; - size_t b; - int type; - int count; - int loc; - int clen; - int i,j; - int c; + unsigned int bs; + unsigned int b; + unsigned int type; + unsigned int count; + unsigned int loc; + unsigned int clen; vsd = (struct volume_structure_descriptor *) get_buffer(id, UDF_VSD_OFFSET, 0x200); @@ -594,29 +644,10 @@ pvd: clen = vd->type.primary.ident.clen; dbg("label string charsize=%i bit", clen); - if (clen == 8) { + if (clen == 8) set_label_string(id, vd->type.primary.ident.c, 31); - } else if (clen == 16) { - /* convert unicode OSTA dstring to UTF-8 */ - j = 0; - for (i = 0; i < 32; i += 2) { - c = (vd->type.primary.ident.c[i] << 8) | - vd->type.primary.ident.c[i+1]; - if (c == 0) { - id->label_string[j] = '\0'; - break; - }else if (c < 0x80U) { - id->label_string[j++] = (char) c; - } else if (c < 0x800U) { - id->label_string[j++] = (char) (0xc0 | (c >> 6)); - id->label_string[j++] = (char) (0x80 | (c & 0x3f)); - } else { - id->label_string[j++] = (char) (0xe0 | (c >> 12)); - id->label_string[j++] = (char) (0x80 | ((c >> 6) & 0x3f)); - id->label_string[j++] = (char) (0x80 | (c & 0x3f)); - } - } - } + else if (clen == 16) + set_label_unicode16(id, vd->type.primary.ident.c, BE,31); found: id->fs_type = UDF; @@ -630,20 +661,20 @@ static int probe_iso9660(struct volume_id *id) { union iso_super_block { struct iso_header { - unsigned char type; - char id[5]; - unsigned char version; - unsigned char unused1; - char system_id[32]; - char volume_id[32]; - } iso; + __u8 type; + __u8 id[5]; + __u8 version; + __u8 unused1; + __u8 system_id[32]; + __u8 volume_id[32]; + } __attribute__((__packed__)) iso; struct hs_header { - char foo[8]; - unsigned char type; - char id[4]; - unsigned char version; - } hs; - } *is; + __u8 foo[8]; + __u8 type; + __u8 id[4]; + __u8 version; + } __attribute__((__packed__)) hs; + } __attribute__((__packed__)) *is; is = (union iso_super_block *) get_buffer(id, ISO_SUPERBLOCK_OFFSET, 0x200); @@ -666,12 +697,73 @@ found: return 0; } +#define MFT_RECORD_VOLUME 3 +#define MFT_RECORD_ATTR_VOLUME_NAME 0x60u +#define MFT_RECORD_ATTR_OBJECT_ID 0x40u +#define MFT_RECORD_ATTR_END 0xffffffffu static int probe_ntfs(struct volume_id *id) { struct ntfs_super_block { - char jump[3]; - char oem_id[4]; - } *ns; + __u8 jump[3]; + __u8 oem_id[8]; + struct bios_param_block { + __u16 bytes_per_sector; + __u8 sectors_per_cluster; + __u16 reserved_sectors; + __u8 fats; + __u16 root_entries; + __u16 sectors; + __u8 media_type; /* 0xf8 = hard disk */ + __u16 sectors_per_fat; + __u16 sectors_per_track; + __u16 heads; + __u32 hidden_sectors; + __u32 large_sectors; + } __attribute__((__packed__)) bpb; + __u8 unused[4]; + __u64 number_of_sectors; + __u64 mft_cluster_location; + __u64 mft_mirror_cluster_location; + __s8 cluster_per_mft_record; + } __attribute__((__packed__)) *ns; + + struct master_file_table_record { + __u8 magic[4]; + __u16 usa_ofs; + __u16 usa_count; + __u64 lsn; + __u16 sequence_number; + __u16 link_count; + __u16 attrs_offset; + __u16 flags; + __u32 bytes_in_use; + __u32 bytes_allocated; + } __attribute__((__packed__)) *mftr; + + struct file_attribute { + __u32 type; + __u32 len; + __u8 non_resident; + __u8 name_len; + __u16 name_offset; + __u16 flags; + __u16 instance; + __u32 value_len; + __u16 value_offset; + } __attribute__((__packed__)) *attr; + + unsigned int sector_size; + unsigned int cluster_size; + unsigned long mft_cluster; + unsigned long mft_off; + unsigned int mft_record_size; + unsigned int attr_type; + unsigned int attr_off; + unsigned int attr_len; + unsigned int val_off; + unsigned int val_len; + const __u8 *buf; + const __u8 *val; ns = (struct ntfs_super_block *) get_buffer(id, 0, 0x200); if (ns == NULL) @@ -680,6 +772,78 @@ static int probe_ntfs(struct volume_id *id) if (strncmp(ns->oem_id, "NTFS", 4) != 0) return -1; + sector_size = le16_to_cpu(ns->bpb.bytes_per_sector); + cluster_size = ns->bpb.sectors_per_cluster * sector_size; + mft_cluster = le64_to_cpu(ns->mft_cluster_location); + mft_off = mft_cluster * cluster_size; + + if (ns->cluster_per_mft_record < 0) + /* size = -log2(mft_record_size); normally 1024 Bytes */ + mft_record_size = 1 << -ns->cluster_per_mft_record; + else + mft_record_size = ns->cluster_per_mft_record * cluster_size; + + dbg("sectorsize 0x%x", sector_size); + dbg("clustersize 0x%x", cluster_size); + dbg("mftcluster %li", mft_cluster); + dbg("mftoffset 0x%lx", mft_off); + dbg("cluster per mft_record %i", ns->cluster_per_mft_record); + dbg("mft record size %i", mft_record_size); + + buf = get_buffer(id, mft_off + (MFT_RECORD_VOLUME * mft_record_size), + mft_record_size); + if (buf == NULL) + goto found; + + mftr = (struct master_file_table_record*) buf; + + dbg("mftr->magic[0] = '%c' %03d, 0x%02x", mftr->magic[0], mftr->magic[0], mftr->magic[0]); + dbg("mftr->magic[1] = '%c' %03d, 0x%02x", mftr->magic[1], mftr->magic[1], mftr->magic[1]); + dbg("mftr->magic[2] = '%c' %03d, 0x%02x", mftr->magic[2], mftr->magic[2], mftr->magic[2]); + dbg("mftr->magic[3] = '%c' %03d, 0x%02x", mftr->magic[3], mftr->magic[3], mftr->magic[3]); + if (strncmp(mftr->magic, "FILE", 4) != 0) + goto found; + + attr_off = le16_to_cpu(mftr->attrs_offset); + dbg("file $Volume's attributes are at offset %i", attr_off); + + while (1) { + attr = (struct file_attribute*) &buf[attr_off]; + attr_type = le32_to_cpu(attr->type); + attr_len = le16_to_cpu(attr->len); + val_off = le16_to_cpu(attr->value_offset); + val_len = le32_to_cpu(attr->value_len); + + if (attr_type == MFT_RECORD_ATTR_END) + break; + + dbg("found attribute type 0x%x, len %i, at offset %i", + attr_type, attr_len, attr_off); + + if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { + dbg("found label, len %i", val_len); + if (val_len > VOLUME_ID_LABEL_SIZE) + val_len = VOLUME_ID_LABEL_SIZE; + + val = &((__u8 *) attr)[val_off]; + set_label_raw(id, val, val_len); + set_label_unicode16(id, val, LE, val_len); + } + + if (attr_type == MFT_RECORD_ATTR_OBJECT_ID) { + dbg("found uuid"); + val = &((__u8 *) attr)[val_off]; + set_uuid(id, val, 16); + } + + if (attr_len == 0) + break; + attr_off += attr_len; + if (attr_off >= mft_record_size) + break; + } + +found: id->fs_type = NTFS; id->fs_name = "ntfs"; @@ -689,8 +853,8 @@ static int probe_ntfs(struct volume_id *id) #define LARGEST_PAGESIZE 0x4000 static int probe_swap(struct volume_id *id) { - char *sig; - size_t page; + const __u8 *sig; + unsigned int page; /* huhh, the swap signature is on the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { @@ -836,7 +1000,7 @@ struct volume_id *volume_id_open_node(const char *path) struct volume_id *volume_id_open_dev_t(dev_t devt) { struct volume_id *id; - char tmp_node[VOLUME_ID_PATH_MAX]; + __u8 tmp_node[VOLUME_ID_PATH_MAX]; snprintf(tmp_node, VOLUME_ID_PATH_MAX, "/tmp/volume-%u-%u-%u", getpid(), major(devt), minor(devt)); diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h index 2f20244c7c..a939743dc1 100644 --- a/extras/volume_id/volume_id.h +++ b/extras/volume_id/volume_id.h @@ -21,9 +21,9 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 002 +#define VOLUME_ID_VERSION 004 -#define VOLUME_ID_LABEL_SIZE 32 +#define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 #define VOLUME_ID_UUID_STRING_SIZE 37 #define VOLUME_ID_PATH_MAX 255 @@ -45,19 +45,19 @@ enum filesystem_type { }; struct volume_id { - char label_raw[VOLUME_ID_LABEL_SIZE]; - size_t label_raw_len; + unsigned char label_raw[VOLUME_ID_LABEL_SIZE]; + unsigned int label_raw_len; char label_string[VOLUME_ID_LABEL_SIZE+1]; unsigned char uuid[VOLUME_ID_UUID_SIZE]; char uuid_string[VOLUME_ID_UUID_STRING_SIZE]; enum filesystem_type fs_type; char *fs_name; int fd; - char *sbbuf; - size_t sbbuf_len; - char *seekbuf; - size_t seekbuf_off; - size_t seekbuf_len; + unsigned char *sbbuf; + unsigned int sbbuf_len; + unsigned char *seekbuf; + unsigned int seekbuf_off; + unsigned int seekbuf_len; int fd_close; }; -- cgit v1.2.3-54-g00ecf From 9a52390cfe0882df3a24b75cc9d8b36878a3982d Mon Sep 17 00:00:00 2001 From: "ogasawara@osdl.org" Date: Sat, 26 Jun 2004 01:18:31 -0700 Subject: [PATCH] udevstart performance increase I noticed a comment in namedev.c which stated "Figure out where the device symlink is at. For char devices this will always be in the class_dev->path. But for block devices, it's different. The main block device will have the device symlink in it's path, but all partitions have the symlink in its parent directory. But we need to watch out for block devices that do not have parents, yet look like a partition (fd0, loop0, etc.). They all do not have a device symlink yet. We do a sit and spin on waiting for them right now, we should possibly have a whitelist for these devices here..." I went ahead and created a whitelist for the block devices that look like partitions (mainly by using devices.txt) and tested for any performance increase that we would see. The whitelist only impacts udevstart time depending on the state of UDEV_NO_SLEEP. Since the list was short, I just did a sequential search and ordered the list in such a way that those block devices which have more /dev entires (ex. loop0, loop1, loop2, etc) appear sooner in the list and will thus be found quicker. I've enclosed the patch and some of the performance results I saw below. Basically, as the number of block devices without device symlinks increased, the use of the whitelist improved udevstart performance compared to just sitting and spinning. I just thought it was interesting and thought I'd share. If you feel the patch is beneficial please consider for merging. Also, if you'd be interested in expanding the whitelist for other devices which are missing device symlinks and seeing if there are added performance increases let me know and I'll do what I can. Thanks, Leann Note: ex. loop represents all the loop devices (i.e. loop0, loop1, loop2, etc) block devices present with whitelist time --- namedev.c | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/namedev.c b/namedev.c index 5e3db1326c..7f3a6a7783 100644 --- a/namedev.c +++ b/namedev.c @@ -602,6 +602,43 @@ static int match_place(struct config_device *dev, struct sysfs_class_device *cla return 0; } +static int whitelist_search(struct sysfs_class_device *class_dev) +{ + int i; + int list_size = 17; + int sysblock = 10; + + static char *list[] = { + "nb", + "ram", + "loop", + "fd", + "md", + "dos_cd", + "double", + "flash", + "msd", + "rflash", + "rom", + "rrom", + "sbpcd", + "pcd", + "pf", + "scd", + "ubd", + }; + + if (!strncmp(class_dev->path, "/sys/block", sysblock)) { + for (i=0; i < list_size; i++) { + if (!strncmp(class_dev->name, list[i], strlen(list[i]))) { + return 1; + } + } + } + + return 0; +} + static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_dev) { struct sysfs_device *sysfs_device; @@ -615,8 +652,8 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de * all partitions have the symlink in its parent directory. * But we need to watch out for block devices that do not have parents, yet * look like a partition (fd0, loop0, etc.) They all do not have a device - * symlink yet. We do sit and spin on waiting for them right now, we should - * possibly have a whitelist for these devices here... + * symlink yet. We do sit and spin on waiting for them right now unless + * they happen to be in the whitelist in which case we exit. */ class_dev_parent = sysfs_get_classdev_parent(class_dev); if (class_dev_parent != NULL) @@ -626,8 +663,13 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de tspec.tv_nsec = 10000000; /* sleep 10 millisec */ loop = 10; while (loop--) { - if (udev_sleep) + if (udev_sleep) { + if (whitelist_search(class_dev)) { + sysfs_device = NULL; + goto exit; + } nanosleep(&tspec, NULL); + } if (class_dev_parent) sysfs_device = sysfs_get_classdev_device(class_dev_parent); -- cgit v1.2.3-54-g00ecf From fcf3ce3417ea0805572873451d2a4f49deefdc10 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 26 Jun 2004 01:27:12 -0700 Subject: [PATCH] clean up block whitelist search logic a bit. --- namedev.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/namedev.c b/namedev.c index 7f3a6a7783..52417e3793 100644 --- a/namedev.c +++ b/namedev.c @@ -604,9 +604,8 @@ static int match_place(struct config_device *dev, struct sysfs_class_device *cla static int whitelist_search(struct sysfs_class_device *class_dev) { + char *sysblock = "/sys/block"; int i; - int list_size = 17; - int sysblock = 10; static char *list[] = { "nb", @@ -626,15 +625,15 @@ static int whitelist_search(struct sysfs_class_device *class_dev) "pf", "scd", "ubd", + NULL, }; - if (!strncmp(class_dev->path, "/sys/block", sysblock)) { - for (i=0; i < list_size; i++) { - if (!strncmp(class_dev->name, list[i], strlen(list[i]))) { - return 1; - } - } - } + if (strncmp(class_dev->path, sysblock, strlen(sysblock))) + return 0; + + for (i=0; list[i] != NULL; i++) + if (!strncmp(class_dev->name, list[i], strlen(list[i]))) + return 1; return 0; } -- cgit v1.2.3-54-g00ecf From 099602aaad8ebcc4969ee35e4167fd093325db50 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 26 Jun 2004 01:32:43 -0700 Subject: [PATCH] 028 release --- ChangeLog | 23 +++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc754dc9d5..8fe59ce796 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +Summary of changes from v027 to v028 +============================================ + +: + o Patch for chassis_id exras module + +Daniel Drake: + o Writing udev rules doc update + +Greg Kroah-Hartman: + o clean up block whitelist search logic a bit + o reverse order of scanning of udevstart to look at class before block + +Kay Sievers: + o update udev_volume_id + +Leann Ogasawara: + o udevstart performance increase + +Patrick Mansfield: + o update udev scsi_id to scsi_id 0.5 + + Summary of changes from v026 to v027 ============================================ diff --git a/Makefile b/Makefile index 1e683cb35c..ba876966f8 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 027 +VERSION = 028 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 07fafbbc79..95fe6b719f 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 027 +Version: 028 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 58ecc5d77ffaa6e1f941ae7dd9ef3f6a249950eb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Jul 2004 22:01:50 -0700 Subject: [PATCH] fix permission problem with input event and ts nodes for gentoo --- etc/udev/udev.permissions.gentoo | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo index 7bde9833d7..d8d5c53a0c 100644 --- a/etc/udev/udev.permissions.gentoo +++ b/etc/udev/udev.permissions.gentoo @@ -170,6 +170,8 @@ vttuner:root:video:0660 v4l/*:root:video:0660 # input devices +input/event*:root:root:600 +input/ts*:root:root:600 input/*:root:root:644 # gpm devices -- cgit v1.2.3-54-g00ecf From 0e306d087daa0f6c5517c41743b948457013252c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Jul 2004 22:19:18 -0700 Subject: [PATCH] make a "last list" of devices for udevstart to operate on last. Should fix the dm startup issues, hopefully... --- udevstart.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 100 insertions(+), 25 deletions(-) diff --git a/udevstart.c b/udevstart.c index 2d11edeca2..6f90de7d18 100644 --- a/udevstart.c +++ b/udevstart.c @@ -23,6 +23,7 @@ */ #include +#include #include #include #include @@ -34,6 +35,7 @@ #include "logging.h" #include "udev_lib.h" +#include "list.h" #ifdef LOG @@ -54,6 +56,36 @@ void log_message(int level, const char *format, ...) #define SYSCLASS "/sys/class" #define UDEV_BIN "/sbin/udev" +struct device { + struct list_head list; + char path[MAX_PATHLEN]; + char subsys[MAX_PATHLEN]; +}; + +/* sort files in lexical order */ +static int device_list_insert(char *path, char *subsystem, struct list_head *device_list) +{ + struct device *loop_device; + struct device *new_device; + + list_for_each_entry(loop_device, device_list, list) { + if (strcmp(loop_device->path, path) > 0) { + break; + } + } + + new_device = malloc(sizeof(struct device)); + if (new_device == NULL) { + dbg("error malloc"); + return -ENOMEM; + } + + strfieldcpy(new_device->path, path); + strfieldcpy(new_device->subsys, subsystem); + list_add_tail(&new_device->list, &loop_device->list); + return 0; +} + static void udev_exec(const char *path, const char* subsystem) { pid_t pid; @@ -62,6 +94,7 @@ static void udev_exec(const char *path, const char* subsystem) char nosleep[] = "UDEV_NO_SLEEP=1"; char *env[] = { action, devpath, nosleep, NULL }; + return; strcpy(devpath, "DEVPATH="); strfieldcat(devpath, path); @@ -81,19 +114,50 @@ static void udev_exec(const char *path, const char* subsystem) } } -static void udev_scan(void) +/* list of devices that we should run last due to any one of a number of reasons */ +static char *last_list[] = { + "/block/dm", /* on here because dm wants to have the block devices around before it */ + NULL, +}; + +static void exec_list(struct list_head *device_list) +{ + struct device *loop_device; + struct device *tmp_device; + + /* handle the devices we are allowed to, excluding the "last" type devices */ + list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + int found = 0; + int i; + for (i=0; last_list[i] != NULL; i++) { + if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) { + found = 1; + break; + } + } + if (found) + continue; + + udev_exec(loop_device->path, loop_device->subsys); + list_del(&loop_device->list); + free(loop_device); + } + + /* handle the rest of the devices left over, if any */ + list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + udev_exec(loop_device->path, loop_device->subsys); + list_del(&loop_device->list); + free(loop_device); + } +} + +static void udev_scan_block(void) { - char *devpath; DIR *dir; struct dirent *dent; + LIST_HEAD(device_list); - /* - * We want to scan the class tree first as lvm and dm needs to be able - * to have access to the char control device when probing the block - * devices. - */ - devpath = "class"; - dir = opendir(SYSCLASS); + dir = opendir(SYSBLOCK); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char dirname[MAX_PATHLEN]; @@ -104,12 +168,15 @@ static void udev_scan(void) (strcmp(dent->d_name, "..") == 0)) continue; - snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); - dirname[MAX_PATHLEN] = '\0'; + snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name); + dirname[MAX_PATHLEN-1] = '\0'; + device_list_insert(dirname, "block", &device_list); + + snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name); dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN-1]; + char dirname2[MAX_PATHLEN]; DIR *dir3; struct dirent *dent3; @@ -126,10 +193,10 @@ static void udev_scan(void) char filename[MAX_PATHLEN]; if (strcmp(dent3->d_name, "dev") == 0) { - snprintf(filename, MAX_PATHLEN, "/class/%s/%s", + snprintf(filename, MAX_PATHLEN, "/block/%s/%s", dent->d_name, dent2->d_name); filename[MAX_PATHLEN-1] = '\0'; - udev_exec(filename, dent->d_name); + device_list_insert(filename, "block", &device_list); } } closedir(dir3); @@ -141,8 +208,16 @@ static void udev_scan(void) closedir(dir); } - devpath = "block"; - dir = opendir(SYSBLOCK); + exec_list(&device_list); +} + +static void udev_scan_class(void) +{ + DIR *dir; + struct dirent *dent; + LIST_HEAD(device_list); + + dir = opendir(SYSCLASS); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char dirname[MAX_PATHLEN]; @@ -153,15 +228,12 @@ static void udev_scan(void) (strcmp(dent->d_name, "..") == 0)) continue; - snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name); - dirname[MAX_PATHLEN-1] = '\0'; - udev_exec(dirname, "block"); - - snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name); + snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); + dirname[MAX_PATHLEN] = '\0'; dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN]; + char dirname2[MAX_PATHLEN-1]; DIR *dir3; struct dirent *dent3; @@ -178,10 +250,10 @@ static void udev_scan(void) char filename[MAX_PATHLEN]; if (strcmp(dent3->d_name, "dev") == 0) { - snprintf(filename, MAX_PATHLEN, "/block/%s/%s", + snprintf(filename, MAX_PATHLEN, "/class/%s/%s", dent->d_name, dent2->d_name); filename[MAX_PATHLEN-1] = '\0'; - udev_exec(filename, "block"); + device_list_insert(filename, dent->d_name, &device_list); } } closedir(dir3); @@ -192,13 +264,16 @@ static void udev_scan(void) } closedir(dir); } + + exec_list(&device_list); } int main(int argc, char *argv[], char *envp[]) { init_logging("udevstart"); - udev_scan(); + udev_scan_class(); + udev_scan_block(); return 0; } -- cgit v1.2.3-54-g00ecf From fd87429578a01e8cc0c9ca4b54f458280808adfb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 1 Jul 2004 22:49:13 -0700 Subject: [PATCH] fix dumb bug I added to udevstart --- udevstart.c | 1 - 1 file changed, 1 deletion(-) diff --git a/udevstart.c b/udevstart.c index 6f90de7d18..19f588ab33 100644 --- a/udevstart.c +++ b/udevstart.c @@ -94,7 +94,6 @@ static void udev_exec(const char *path, const char* subsystem) char nosleep[] = "UDEV_NO_SLEEP=1"; char *env[] = { action, devpath, nosleep, NULL }; - return; strcpy(devpath, "DEVPATH="); strfieldcat(devpath, path); -- cgit v1.2.3-54-g00ecf From ea08d6fc3eff4ca20a195451d7f3e154e50acb1f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 2 Jul 2004 18:30:37 -0700 Subject: [PATCH] add permission rule for jogdial device. --- etc/udev/udev.permissions.gentoo | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo index d8d5c53a0c..8d2acc01fe 100644 --- a/etc/udev/udev.permissions.gentoo +++ b/etc/udev/udev.permissions.gentoo @@ -174,6 +174,9 @@ input/event*:root:root:600 input/ts*:root:root:600 input/*:root:root:644 +# Sony Vaio Jogdial sonypi device +sonypi:root:root:0666 + # gpm devices gpmctl:root:root:0700 -- cgit v1.2.3-54-g00ecf From cf9ffc8d9c02553b9698a795f26208fc121c8f1a Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Fri, 2 Jul 2004 18:59:30 -0700 Subject: [PATCH] allow NAME_SIZE > SYSFS_PATH_MAX NAME_SIZE is too small for some configurations. This patch allows more or longer names, it just keeps the stack in a sane state. --- udevdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevdb.c b/udevdb.c index f246936710..c4dc4f005c 100644 --- a/udevdb.c +++ b/udevdb.c @@ -52,7 +52,7 @@ int udevdb_add_dev(const char *path, const struct udevice *dev) if ((path == NULL) || (dev == NULL)) return -ENODEV; - memset(keystr, 0, NAME_SIZE); + memset(keystr, 0, SYSFS_PATH_MAX); strfieldcpy(keystr, path); key.dptr = keystr; key.dsize = strlen(keystr) + 1; -- cgit v1.2.3-54-g00ecf From bf21ea08b3f7b2a93141d98448c78bc3dbe87f84 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 2 Jul 2004 19:15:10 -0700 Subject: [PATCH] 029 release --- ChangeLog | 14 ++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8fe59ce796..84a5bd35bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Summary of changes from v028 to v029 +============================================ + +Greg Kroah-Hartman: + o add permission rule for jogdial device + o fix dumb bug I added to udevstart + o make a "last list" of devices for udevstart to operate on last + o fix permission problem with input event and ts nodes for gentoo + o change default perms of misc/rtc to be readable by anyone + +Olaf Hering: + o allow NAME_SIZE > SYSFS_PATH_MAX + + Summary of changes from v027 to v028 ============================================ diff --git a/Makefile b/Makefile index ba876966f8..0dfec46b71 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 028 +VERSION = 029 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 95fe6b719f..e537a917db 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 028 +Version: 029 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 462be028f18d94ab06c913768da78e30a1a66b68 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 9 Jul 2004 18:46:08 -0700 Subject: [PATCH] fix stupid off-by-one bug that caused udevstart to die on x86-64 boxes. --- udevstart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevstart.c b/udevstart.c index 19f588ab33..3ecfd4cb61 100644 --- a/udevstart.c +++ b/udevstart.c @@ -228,7 +228,7 @@ static void udev_scan_class(void) continue; snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); - dirname[MAX_PATHLEN] = '\0'; + dirname[MAX_PATHLEN-1] = '\0'; dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { -- cgit v1.2.3-54-g00ecf From 16ddbbe10a6484daf63596818a19890225388a71 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 9 Jul 2004 18:59:03 -0700 Subject: [PATCH] 030 release --- ChangeLog | 7 +++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84a5bd35bf..6a65376488 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Summary of changes from v029 to v030 +============================================ + +Greg Kroah-Hartman: + o fix stupid off-by-one bug that caused udevstart to die on x86-64 boxes + + Summary of changes from v028 to v029 ============================================ diff --git a/Makefile b/Makefile index 0dfec46b71..162a78d39d 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 029 +VERSION = 030 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index e537a917db..bdbcb4129e 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 029 +Version: 030 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From e2eef6d4dc31158b812b0ee2690fec3f41b92703 Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Tue, 10 Aug 2004 00:46:38 -0700 Subject: [PATCH] Try to provide a bit of security for hardlinks to /dev entries. --- udev-remove.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/udev-remove.c b/udev-remove.c index 27ff5bc0a2..4f2cd479c0 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -65,6 +65,41 @@ static int delete_path(char *path) return 0; } +/** Remove all permissions on the device node, before + * unlinking it. This fixes a security issue. + * If the user created a hard-link to the device node, + * he can't use it any longer, because he lost permission + * to do so. + */ +static int secure_unlink(const char *filename) +{ + int retval; + + retval = chown(filename, 0, 0); + if (retval) { + dbg("chown(%s, 0, 0) failed with error '%s'", + filename, strerror(errno)); + /* We continue nevertheless. + * I think it's very unlikely for chown + * to fail here, if the file exists. + */ + } + retval = chmod(filename, 0000); + if (retval) { + dbg("chmod(%s, 0000) failed with error '%s'", + filename, strerror(errno)); + /* We continue nevertheless. */ + } + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; + if (retval) { + dbg("unlink(%s) failed with error '%s'", + filename, strerror(errno)); + } + return retval; +} + static int delete_node(struct udevice *dev) { char filename[NAME_SIZE]; @@ -79,14 +114,9 @@ static int delete_node(struct udevice *dev) strfieldcat(filename, dev->name); info("removing device node '%s'", filename); - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - if (retval) { - dbg("unlink(%s) failed with error '%s'", - filename, strerror(errno)); + retval = secure_unlink(filename); + if (retval) return retval; - } /* remove partition nodes */ if (dev->partitions > 0) { @@ -94,7 +124,7 @@ static int delete_node(struct udevice *dev) for (i = 1; i <= dev->partitions; i++) { strfieldcpy(partitionname, filename); strintcat(partitionname, i); - unlink(partitionname); + secure_unlink(partitionname); } } -- cgit v1.2.3-54-g00ecf From 4723bf98c0835bc779f627d7125417aa4f84121d Mon Sep 17 00:00:00 2001 From: "Ballarin.Marc@gmx.de" Date: Tue, 10 Aug 2004 00:49:36 -0700 Subject: [PATCH] Update the FAQ with info about hardlink security --- FAQ | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/FAQ b/FAQ index 28f7552ae3..45337bf635 100644 --- a/FAQ +++ b/FAQ @@ -23,7 +23,7 @@ A: To quote Al Viro (Linux VFS kernel maintainer): - the former had stayed around for many months with maintainer claiming that everything works fine - the latter had stayed, period. - - the devfs maintainer/author disappeared and stoped maintaining + - the devfs maintainer/author disappeared and stopped maintaining the code. Q: But udev will not automatically load a driver if a /dev node is opened @@ -98,6 +98,19 @@ A: Technically, yes, but udev is not intended for this. Projects that do And don't have to be root but will get full permissions on /pendrive. This works even without udev if /udev/pendrive is replaced by /dev/sda1 +Q: Are there any security issues that I should be aware of? +A: When using dynamic device numbers, a given pair of major/minor numbers may + point to different hardware over time. If a user has permission to access a + specific device node directly and is able to create hard links to this node, + he or she can do so to create a copy of the device node. When the device is + unplugged and udev removes the device node, the user's copy remains. + If the device node is later recreated with different permissions the hard + link can still be used to access the device using the old permissions. + (The same problem exists when using PAM to change permissions on login.) + + The simplest solution is to prevent the creation of hard links by putting + /dev in a separate filesystem (tmpfs, ramfs, ...). + Q: I have other questions about udev, where do I ask them? A: The linux-hotplug-devel mailing list is the proper place for it. The address for it is linux-hotplug-devel@lists.sourceforge.net -- cgit v1.2.3-54-g00ecf From 807755776d294a9811c0c8e835538e83abf734bc Mon Sep 17 00:00:00 2001 From: "trini@kernel.crashing.org" Date: Tue, 10 Aug 2004 00:49:42 -0700 Subject: [PATCH] Add 'asmlinkage' to udev-030 The following patch adds 'asmlinkage' defines to udev, to kill off 2 warnings on !i386. Signed-off-by: Tom Rini Signed-off-by: Greg Kroah-Hartman --- Makefile | 4 ++-- udev.c | 2 +- udevd.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 162a78d39d..f4f371d463 100644 --- a/Makefile +++ b/Makefile @@ -114,9 +114,9 @@ ifeq ($(strip $(TARGET_ARCH)),i386) /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi} OPTIMIZATION += ${shell if $(CC) -malign-functions=0 -malign-jumps=0 -S -o /dev/null -xc \ /dev/null >/dev/null 2>&1; then echo "-malign-functions=0 -malign-jumps=0"; fi} - CFLAGS+=-pipe + CFLAGS+=-pipe -Dasmlinkage=__attribute__((regparm(0))) else - CFLAGS+=-pipe + CFLAGS+=-pipe -Dasmlinkage= endif ifeq ($(strip $(USE_LOG)),true) diff --git a/udev.c b/udev.c index eb21f75461..cc6ce10542 100644 --- a/udev.c +++ b/udev.c @@ -55,7 +55,7 @@ void log_message(int level, const char *format, ...) } #endif -__attribute__((regparm(0))) static void sig_handler(int signum) +asmlinkage static void sig_handler(int signum) { switch (signum) { case SIGINT: diff --git a/udevd.c b/udevd.c index e0c5bf5c77..79de11248e 100644 --- a/udevd.c +++ b/udevd.c @@ -306,7 +306,7 @@ skip: return; } -__attribute__((regparm(0))) static void sig_handler(int signum) +asmlinkage static void sig_handler(int signum) { int rc; -- cgit v1.2.3-54-g00ecf From eb6c7cd03635ffc28798734f0b87b9e21dae6f9e Mon Sep 17 00:00:00 2001 From: "trini@kernel.crashing.org" Date: Tue, 10 Aug 2004 00:50:21 -0700 Subject: [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 Signed-off-by: Greg Kroah-Hartman --- Makefile | 14 +++++-------- dev_d.c | 2 +- udev-add.c | 6 +++--- udev-remove.c | 2 +- udev.c | 66 +++++++++++++++++++++++++++++++++++++---------------------- udev.h | 10 ++++++--- udevstart.c | 47 ++++++++---------------------------------- 7 files changed, 67 insertions(+), 80 deletions(-) diff --git a/Makefile b/Makefile index f4f371d463..d4d3ac8b05 100644 --- a/Makefile +++ b/Makefile @@ -172,7 +172,7 @@ endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) +all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -261,8 +261,8 @@ $(DAEMON).o: $(GEN_HEADERS) $(SENDER).o: $(GEN_HEADERS) $(STARTER).o: $(GEN_HEADERS) -$(ROOT): $(ROOT).o $(OBJS) $(HEADERS) $(LIBC) $(GEN_MANPAGES) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(ROOT): $(ROOT).o $(STARTER).o $(OBJS) $(HEADERS) $(LIBC) $(GEN_MANPAGES) + $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o udevstart.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ $(TESTER): $(TESTER).o $(OBJS) $(HEADERS) $(LIBC) @@ -281,10 +281,6 @@ $(SENDER): $(SENDER).o udevd.h $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(STARTER): $(STARTER).o $(HEADERS) $(LIBC) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevstart.o $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $@ - $(RULER): $(RULER).o $(OBJS) $(HEADERS) $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevruler.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) -lnewt $(STRIPCMD) $@ @@ -292,7 +288,7 @@ $(RULER): $(RULER).o $(OBJS) $(HEADERS) $(LIBC) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(STARTER) $(RULER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(RULER) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ @@ -392,7 +388,7 @@ install: install-initscript install-config install-man install-dev.d all $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) - $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) + ln -sf $(sbindir)/udev $(DESTDIR)$(sbindir)/$(STARTER) - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug ifndef DESTDIR - killall udevd diff --git a/dev_d.c b/dev_d.c index 97c552647b..1ad599ead5 100644 --- a/dev_d.c +++ b/dev_d.c @@ -61,7 +61,7 @@ static int run_program(char *name) * subsystem/ * default/ */ -void dev_d_send(struct udevice *dev, char *subsystem, char *devpath) +void dev_d_send(struct udevice *dev, const char *subsystem, const char *devpath) { char dirname[256]; char env_devname[NAME_SIZE]; diff --git a/udev-add.c b/udev-add.c index 900e4795aa..1f69329788 100644 --- a/udev-add.c +++ b/udev-add.c @@ -316,7 +316,7 @@ error: return -1; } -static struct sysfs_class_device *get_class_dev(char *device_name) +static struct sysfs_class_device *get_class_dev(const char *device_name) { char dev_path[SYSFS_PATH_MAX]; struct sysfs_class_device *class_dev = NULL; @@ -341,7 +341,7 @@ exit: * If it doesn't happen in about 10 seconds, give up. */ #define SECONDS_TO_WAIT_FOR_FILE 10 -static int sleep_for_file(char *path, char* file) +static int sleep_for_file(const char *path, char* file) { char filename[SYSFS_PATH_MAX + 6]; int loop = SECONDS_TO_WAIT_FOR_FILE; @@ -395,7 +395,7 @@ static int rename_net_if(struct udevice *dev, int fake) return retval; } -int udev_add_device(char *path, char *subsystem, int fake) +int udev_add_device(const char *path, const char *subsystem, int fake) { struct sysfs_class_device *class_dev; struct udevice dev; diff --git a/udev-remove.c b/udev-remove.c index 4f2cd479c0..7ad7c2402a 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -159,7 +159,7 @@ static int delete_node(struct udevice *dev) * something different from the kernel name. If we have, us it. If not, use * the default kernel name for lack of anything else to know to do. */ -int udev_remove_device(char *path, char *subsystem) +int udev_remove_device(const char *path, const char *subsystem) { struct udevice dev; char *temp; diff --git a/udev.c b/udev.c index cc6ce10542..0ef4cf8657 100644 --- a/udev.c +++ b/udev.c @@ -40,6 +40,9 @@ char **main_argv; char **main_envp; +/* local variables */ +static int is_udevstart; + #ifdef LOG unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) @@ -76,27 +79,13 @@ static char *subsystem_blacklist[] = { "" }; -static int udev_hotplug(void) +int __udev_hotplug(char *action, const char *devpath, const char *subsystem) { - char *action; - char *devpath; - char *subsystem; int retval = -EINVAL; int i; struct sigaction act; const int nofake = 0; - action = get_action(); - if (!action) { - dbg("no action?"); - goto exit; - } - - devpath = get_devpath(); - if (!devpath) { - dbg("no devpath?"); - goto exit; - } dbg("looking at '%s'", devpath); /* we only care about class devices and block stuff */ @@ -106,12 +95,6 @@ static int udev_hotplug(void) goto exit; } - /* skip blacklisted subsystems */ - subsystem = get_subsystem(main_argv[1]); - if (!subsystem) { - dbg("no subsystem?"); - goto exit; - } i = 0; while (subsystem_blacklist[i][0] != '\0') { if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { @@ -136,7 +119,9 @@ static int udev_hotplug(void) sigaction(SIGTERM, &act, NULL); if (strcmp(action, "add") == 0) { - namedev_init(); + /* Already done. */ + if (!is_udevstart) + namedev_init(); retval = udev_add_device(devpath, subsystem, nofake); goto action_done; } @@ -156,17 +141,50 @@ exit: return retval; } +static int udev_hotplug(void) +{ + char *action; + char *devpath; + char *subsystem; + + action = get_action(); + if (!action) { + dbg("no action?"); + return -EINVAL; + } + + devpath = get_devpath(); + if (!devpath) { + dbg("no devpath?"); + return -EINVAL; + } + + /* skip blacklisted subsystems */ + subsystem = get_subsystem(main_argv[1]); + if (!subsystem) { + dbg("no subsystem?"); + return -EINVAL; + } + + return __udev_hotplug(action, devpath, subsystem); +} + int main(int argc, char *argv[], char *envp[]) { main_argv = argv; main_envp = envp; - init_logging("udev"); + if (strstr(argv[0], "udevstart")) + is_udevstart = 1; /* initialize our configuration */ udev_init_config(); dbg("version %s", UDEV_VERSION); - return udev_hotplug(); + if (is_udevstart) { + namedev_init(); + return udev_start(); + } else + return udev_hotplug(); } diff --git a/udev.h b/udev.h index da02e26bba..310154f55d 100644 --- a/udev.h +++ b/udev.h @@ -61,11 +61,15 @@ struct udevice { char kernel_name[NAME_SIZE]; }; -extern int udev_add_device(char *path, char *subsystem, int fake); -extern int udev_remove_device(char *path, char *subsystem); +extern int udev_add_device(const char *path, const char *subsystem, int fake); +extern int udev_remove_device(const char *path, const char *subsystem); extern void udev_init_config(void); +extern int udev_start(void); +extern int __udev_hotplug(char *action, const char *devpath, + const char *subsystem); extern int parse_get_pair(char **orig_string, char **left, char **right); -extern void dev_d_send(struct udevice *dev, char *subsystem, char *devpath); +extern void dev_d_send(struct udevice *dev, const char *subsystem, + const char *devpath); extern char **main_argv; extern char **main_envp; diff --git a/udevstart.c b/udevstart.c index 3ecfd4cb61..d94c9501c9 100644 --- a/udevstart.c +++ b/udevstart.c @@ -36,25 +36,12 @@ #include "logging.h" #include "udev_lib.h" #include "list.h" - - -#ifdef LOG -unsigned char logname[LOGNAME_SIZE]; -void log_message(int level, const char *format, ...) -{ - va_list args; - - va_start(args, format); - vsyslog(level, format, args); - va_end(args); -} -#endif +#include "udev.h" #define MAX_PATHLEN 1024 #define SYSBLOCK "/sys/block" #define SYSCLASS "/sys/class" -#define UDEV_BIN "/sbin/udev" struct device { struct list_head list; @@ -88,28 +75,13 @@ static int device_list_insert(char *path, char *subsystem, struct list_head *dev static void udev_exec(const char *path, const char* subsystem) { - pid_t pid; - char action[] = "ACTION=add"; - char devpath[MAX_PATHLEN]; - char nosleep[] = "UDEV_NO_SLEEP=1"; - char *env[] = { action, devpath, nosleep, NULL }; - - strcpy(devpath, "DEVPATH="); - strfieldcat(devpath, path); - - pid = fork(); - switch (pid) { - case 0: - /* child */ - execle(UDEV_BIN, "udev", subsystem, NULL, env); - dbg("exec of child failed"); + /* Setup env variables. */ + setenv("UDEV_NO_SLEEP", "1", 1); + + /* Now call __udev_hotplug(). */ + if (__udev_hotplug("add", path, subsystem)) { + dbg("Calling of udev_hotplug failed"); exit(1); - break; - case -1: - dbg("fork of child failed"); - break; - default: - wait(NULL); } } @@ -267,12 +239,9 @@ static void udev_scan_class(void) exec_list(&device_list); } -int main(int argc, char *argv[], char *envp[]) +int udev_start(void) { - init_logging("udevstart"); - udev_scan_class(); udev_scan_block(); - return 0; } -- cgit v1.2.3-54-g00ecf From 41ffb32e8de6fd0c2817775472514fe9a687d887 Mon Sep 17 00:00:00 2001 From: "azarah@gentoo.org" Date: Wed, 11 Aug 2004 01:02:54 -0700 Subject: [PATCH] add microcode rule to permissions.gentoo file Add microcode rule, remove duplicate rtc and psaux rules, and order alphabetically. --- etc/udev/udev.rules.gentoo | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 1a84baa9d4..c2a8ef54b1 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -57,12 +57,11 @@ KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" # misc devices -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="microcode", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" # pty devices KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From a4f5eb034bdbb77236f24f24c09286aa03f404ab Mon Sep 17 00:00:00 2001 From: "trini@kernel.crashing.org" Date: Wed, 11 Aug 2004 01:02:56 -0700 Subject: [PATCH] clean up start_udev a bit First, update extras/start_udev. udevstart always internally set UDEV_NO_SLEEP as well as setting the ACTION variable, so that only needs to be done in the run_udev script case. Signed-off-by: Tom Rini Signed-off-by: Greg Kroah-Hartman --- extras/start_udev | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/start_udev b/extras/start_udev index 0212d4f8c1..4908d05b70 100644 --- a/extras/start_udev +++ b/extras/start_udev @@ -29,6 +29,9 @@ bin=/sbin/udev udevd=/sbin/udevd run_udev () { + export ACTION=add + export UDEV_NO_SLEEP=1 + # handle block devices and their partitions for i in ${sysfs_dir}/block/*; do # add each drive @@ -85,8 +88,6 @@ echo "mounting... ramfs at $udev_root" mount -n -t ramfs none $udev_root # propogate /udev from /sys -export ACTION=add -export UDEV_NO_SLEEP=1 echo "Creating initial udev device nodes:" # You can use the shell scripts above by calling run_udev or execute udevstart -- cgit v1.2.3-54-g00ecf From 2410242aa4d21335026d3b90116078c9146a32f3 Mon Sep 17 00:00:00 2001 From: "trini@kernel.crashing.org" Date: Wed, 11 Aug 2004 01:02:59 -0700 Subject: [PATCH] fix UDEV_NO_SLEEP Move setting UDEV_NO_SLEEP into main(). I thought about moving udev_init_config() around, but it still must be invoked in both udev and udevstart cases, and before udev_hotplug() is called. An alternative would be to have main() do: if (is_udevstart) { ... current ... } else { udev_init_config(); return udev_hotplug(); } And move setting UDEV_NO_SLEEP into udev_start(). I can redo it that way, if you prefer. Signed-off-by: Tom Rini Signed-off-by: Greg Kroah-Hartman --- udev.c | 5 ++++- udevstart.c | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/udev.c b/udev.c index 0ef4cf8657..90c34d800a 100644 --- a/udev.c +++ b/udev.c @@ -174,8 +174,11 @@ int main(int argc, char *argv[], char *envp[]) main_argv = argv; main_envp = envp; - if (strstr(argv[0], "udevstart")) + if (strstr(argv[0], "udevstart")) { + /* Setup env variables. */ + setenv("UDEV_NO_SLEEP", "1", 1); is_udevstart = 1; + } /* initialize our configuration */ udev_init_config(); diff --git a/udevstart.c b/udevstart.c index d94c9501c9..2d5553e955 100644 --- a/udevstart.c +++ b/udevstart.c @@ -75,9 +75,6 @@ static int device_list_insert(char *path, char *subsystem, struct list_head *dev static void udev_exec(const char *path, const char* subsystem) { - /* Setup env variables. */ - setenv("UDEV_NO_SLEEP", "1", 1); - /* Now call __udev_hotplug(). */ if (__udev_hotplug("add", path, subsystem)) { dbg("Calling of udev_hotplug failed"); -- cgit v1.2.3-54-g00ecf From b9e3301c3b68a1c6464a0bf0ac6e61fc0e4063d1 Mon Sep 17 00:00:00 2001 From: "tao@kernel.org" Date: Wed, 11 Aug 2004 01:03:03 -0700 Subject: [PATCH] Minor POSIX-fixes for udev The attached patch contains a few patches against udev, to remove use of various XSI:isms and bash:isms, and to change two scripts form /bin/bash to /bin/sh. None of the bash-scripts in test/ uses any bash-specific functions as far as I know, but I didn't touch them since they aren't used runtime. Rationale: * Both of the /bin/bash-scripts are totally free from bashisms, hence they don't need to be /bin/bash; using /bin/sh instead helps (mainly) embedded-people * local and source are bash:isms (well, they exist in several other shells as well, but they aren't part of POSIX or any of its extensions) * -a in tests is an XSI-extension, not part of strict POSIX, and is easily replaced by && | http://www.opengroup.org/onlinepubs/009695399/utilities/test.html * Use of fgrep is deprecated in POSIX in favour of grep -F (though fgrep will remain in use for a long time...) | http://www.opengroup.org/onlinepubs/009695399/utilities/grep.html The fgrep-change isn't really necessary, since fgrep can always be implemented as a shell-script, but the rest of the changes would really be appreciated. --- etc/dev.d/default/pam_console.dev | 2 +- etc/dev.d/default/selinux.dev | 2 +- etc/init.d/udev | 2 +- etc/init.d/udev.debian | 2 +- etc/init.d/udev.init.lfs | 6 +++--- extras/ide-devfs.sh | 12 +++++------- extras/scsi-devfs.sh | 4 ++-- extras/start_udev | 2 +- 8 files changed, 15 insertions(+), 17 deletions(-) diff --git a/etc/dev.d/default/pam_console.dev b/etc/dev.d/default/pam_console.dev index 7e95810e2c..563051d7f6 100644 --- a/etc/dev.d/default/pam_console.dev +++ b/etc/dev.d/default/pam_console.dev @@ -11,7 +11,7 @@ fi [ "$UDEV_CONSOLE" != "yes" ] && exit 0 if [ -x /sbin/pam_console_setowner ]; then - if [ "$UDEV_LOG" = "yes" -a -x /usr/bin/logger ]; then + if [ "$UDEV_LOG" = "yes" ] && [ -x /usr/bin/logger ]; then /usr/bin/logger -p auth.debug "Restoring console permissions for $DEVNAME" fi exec /sbin/pam_console_setowner $DEVNAME diff --git a/etc/dev.d/default/selinux.dev b/etc/dev.d/default/selinux.dev index 7911d345b9..9682658aad 100644 --- a/etc/dev.d/default/selinux.dev +++ b/etc/dev.d/default/selinux.dev @@ -11,7 +11,7 @@ fi [ "$UDEV_SELINUX" != "yes" ] && exit 0 if [ -x /sbin/restorecon ]; then - if [ "$UDEV_LOG" = "yes" -a -x /usr/bin/logger ]; then + if [ "$UDEV_LOG" = "yes" ] && [ -x /usr/bin/logger ]; then /usr/bin/logger -p auth.debug "Restoring file security contexts for $DEVNAME" fi /sbin/restorecon $DEVNAME diff --git a/etc/init.d/udev b/etc/init.d/udev index cd9074de09..7e6305a45b 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # # udev init script to setup /udev # diff --git a/etc/init.d/udev.debian b/etc/init.d/udev.debian index 776a73644c..8268fe6c2f 100644 --- a/etc/init.d/udev.debian +++ b/etc/init.d/udev.debian @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # # random init script to setup /udev # diff --git a/etc/init.d/udev.init.lfs b/etc/init.d/udev.init.lfs index c738369081..41a3fecf0f 100644 --- a/etc/init.d/udev.init.lfs +++ b/etc/init.d/udev.init.lfs @@ -5,9 +5,9 @@ # 2003, 2004 by Michael Buesch # -source /etc/sysconfig/rc -source $rc_functions -source /etc/udev/udev.conf +. /etc/sysconfig/rc +. $rc_functions +. /etc/udev/udev.conf sysfs_dir="/sys" bin="/sbin/udev" diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 4d021c5e87..4f20259480 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -15,15 +15,13 @@ else fi get_dev_number() { - local x= - local num=0 - local MEDIA= - local DRIVE="${1%%[0-9]*}" + num=0 + DRIVE="${1%%[0-9]*}" for x in /proc/ide/*/media; do if [ -e "${x}" ]; then - MEDIA=`cat ${x}` - if [ "${MEDIA}" = "$2" ]; then + lMEDIA=`cat ${x}` + if [ "${lMEDIA}" = "$2" ]; then num=$((${num} + 1)) fi if [ "${x}" = "/proc/ide/${DRIVE}/media" ]; then @@ -35,7 +33,7 @@ get_dev_number() { echo $((${num} - 1)) } -if [ -z "$3" -a -f /proc/ide/${1}/media ]; then +if [ -z "$3" ] && [ -f /proc/ide/${1}/media ]; then MEDIA=`cat /proc/ide/${1}/media` if [ "${MEDIA}" = "cdrom" ]; then echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` diff --git a/extras/scsi-devfs.sh b/extras/scsi-devfs.sh index 30f4553a5b..12c8aa8eb5 100644 --- a/extras/scsi-devfs.sh +++ b/extras/scsi-devfs.sh @@ -14,7 +14,7 @@ # BUS="scsi", KERNEL="sg*", PROGRAM="/etc/udev/scsi-devfs.sh sg %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" # Find out where sysfs is mounted. Exit if not available -sysfs=`fgrep sysfs /proc/mounts | awk '{print $2}'` +sysfs=`grep -F sysfs /proc/mounts | awk '{print $2}'` if [ "$sysfs" = "" ]; then echo "sysfs is required" exit 1 @@ -63,7 +63,7 @@ s_com="b${scsi_bus}t${scsi_target}u${scsi_lun}$spart" l_log="scsi/host$scsi_host/$l_com" s_log="$1/c${scsi_host}${s_com}" -readlink $2 | fgrep -q pci +readlink $2 | grep -F -q pci if [ "$?" != "0" ]; then # Not a PCI controller, show logical locations only echo $l_log $s_log diff --git a/extras/start_udev b/extras/start_udev index 4908d05b70..bbf32a1bb9 100644 --- a/extras/start_udev +++ b/extras/start_udev @@ -1,4 +1,4 @@ -#! /bin/bash +#! /bin/sh # # start_udev # -- cgit v1.2.3-54-g00ecf From 9d009843750a055efe095f7139e0788f71de8f03 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 11 Aug 2004 01:03:06 -0700 Subject: [PATCH] fix manpages based on esr's spambot On Mon, Jul 12, 2004 at 11:14:28AM -0400, esr@thyrsus.com wrote: > This is automatically generated email about problems in a man page for which > you appear to be responsible. If you are not the right person or list, tell > me and I will attempt to correct my database. > > See http://catb.org/~esr/doclifter/problems.html for details on how and > why these patches were generated. Feel free to email me with any questions. > > Note: This patch does not change the mod date of the manual page. You > may wish to do that by hand. > > Problems with udevd.8: > > 1. There are multiple name lines. This makes it impossible to translate > the page to DocBook. It may also confuse some implementations > of man -k. > > --- udevd.8-orig 2004-07-10 06:35:12.032545856 -0400 > +++ udevd.8 2004-07-10 06:36:19.301319448 -0400 > @@ -1,8 +1,6 @@ > .TH UDEVD 8 "February 2004" "" "Linux Administrator's Manual" > .SH NAME > -udevd \- udev event serializer daemon > -.br > -udevsend \- sends the event to udevd > +udevd, udevdsend \- udev event serializer daemon and udev event sender > .SH SYNOPSIS > -- > Eric S. Raymond > Thanks Eric, udevsend.8 is only a symlink to udevd.8, so I attached a stripped down patch to this mail. --- udevd.8 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/udevd.8 b/udevd.8 index 52c270add8..1de7a3cba2 100644 --- a/udevd.8 +++ b/udevd.8 @@ -1,8 +1,6 @@ .TH UDEVD 8 "February 2004" "" "Linux Administrator's Manual" .SH NAME -udevd \- udev event serializer daemon -.br -udevsend \- sends the event to udevd +udevd, udevdsend \- udev event serializer daemon and udev event sender .SH SYNOPSIS .BI udevsend " hotplug-subsystem" .sp -- cgit v1.2.3-54-g00ecf From bf9c3576333c061051574ea043ce0bde7984d448 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 5 Sep 2004 17:52:51 +0200 Subject: [PATCH] add permission for legotower usb devices. --- etc/udev/udev.permissions.gentoo | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo index 8d2acc01fe..edd8e39cde 100644 --- a/etc/udev/udev.permissions.gentoo +++ b/etc/udev/udev.permissions.gentoo @@ -197,6 +197,7 @@ cdwriter:root:disk:0660 usb/dabusb*:root:usb:0660 usb/mdc800*:root:usb:0660 usb/rio500:root:usb:0660 +usb/legousbtower*:root:usb:0660 sgi_fetchop:root:root:666 iseries/vcd*:root:disk:660 -- cgit v1.2.3-54-g00ecf From c449ee6f7f328c66468988da5f07dff53e141f0f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 5 Sep 2004 17:53:11 +0200 Subject: [PATCH] add rules for i386 cpu devices. --- etc/udev/udev.rules.gentoo | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index c2a8ef54b1..a2b878d4a3 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -128,4 +128,9 @@ KERNEL="capi*", NAME="capi/%n" KERNEL="tun", NAME="net/%k" # raw devices -KERNEL="raw[0-9]*", NAME="raw/%k" +KERNEL="raw[0-9]*", NAME="raw/%k" + +# cpu devices +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL="msr[0-9]*", NAME="cpu/%n/cpuid" +KERNEL="microcode", NAME="cpu/microcode" -- cgit v1.2.3-54-g00ecf From 00d063985a209444d7252f622149351a5cff8939 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 5 Sep 2004 17:56:08 +0200 Subject: [PATCH] Fix old-style pty breakage in rules file for tty device. Thanks to Martin Schlemmer for the fix. --- etc/udev/udev.rules.gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index a2b878d4a3..f8208d9495 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -65,7 +65,7 @@ KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" # pty devices KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k" # ramdisk devices KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From 3169e8d1ee24c7d23d7e535eb22fced869104ff8 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 5 Sep 2004 18:05:29 +0200 Subject: [PATCH] pass SEQNUM trough udevd here we change udevd to pass the SEQNUM from the hotplug environment to udev and the dev.d/ scripts. We need this for HAL to match the hotplug event with the dev.d/ events. It also changes the type from int to long to match the kernel. --- udev.h | 7 ++++--- udev_lib.h | 6 ++++++ udevd.c | 27 +++++++++++++++------------ udevd.h | 2 +- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/udev.h b/udev.h index 310154f55d..717c1218eb 100644 --- a/udev.h +++ b/udev.h @@ -33,9 +33,10 @@ #define GROUP_SIZE 30 #define MODE_SIZE 8 -#define ACTION_SIZE 30 -#define DEVPATH_SIZE 255 -#define SUBSYSTEM_SIZE 30 +#define ACTION_SIZE 32 +#define DEVPATH_SIZE 256 +#define SUBSYSTEM_SIZE 32 +#define SEQNUM_SIZE 32 /* length of public data */ #define UDEVICE_LEN (offsetof(struct udevice, bus_id)) diff --git a/udev_lib.h b/udev_lib.h index 18ce25ccc7..53ad92d505 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -59,6 +59,12 @@ do { \ snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ } while (0) +#define strlongcat(to, i) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%li", i); \ +} while (0) + #define foreach_strpart(str, separator, pos, len) \ for(pos = str, len = 0; \ (pos) < ((str) + strlen(str)); \ diff --git a/udevd.c b/udevd.c index 79de11248e..50720c2450 100644 --- a/udevd.c +++ b/udevd.c @@ -44,7 +44,7 @@ #include "logging.h" static int pipefds[2]; -static int expected_seqnum = 0; +static long expected_seqnum = 0; volatile static int children_waiting; volatile static int run_msg_q; volatile static int sig_flag; @@ -82,7 +82,7 @@ static void msg_dump_queue(void) struct hotplug_msg *msg; list_for_each_entry(msg, &msg_list, list) - dbg("sequence %d in queue", msg->seqnum); + dbg("sequence %li in queue", msg->seqnum); #endif } @@ -120,7 +120,7 @@ static void msg_queue_insert(struct hotplug_msg *msg) msg->queue_time = info.uptime; list_add(&msg->list, &loop_msg->list); - dbg("queued message seq %d", msg->seqnum); + dbg("queued message seq %li", msg->seqnum); /* run msg queue manager */ run_msg_q = 1; @@ -134,12 +134,15 @@ static void udev_run(struct hotplug_msg *msg) pid_t pid; char action[ACTION_SIZE]; char devpath[DEVPATH_SIZE]; - char *env[] = { action, devpath, NULL }; + char seqnum[SEQNUM_SIZE]; + char *env[] = { action, devpath, seqnum, NULL }; strcpy(action, "ACTION="); strfieldcat(action, msg->action); strcpy(devpath, "DEVPATH="); strfieldcat(devpath, msg->devpath); + strcpy(seqnum, "SEQNUM="); + strlongcat(seqnum, msg->seqnum); pid = fork(); switch (pid) { @@ -158,7 +161,7 @@ static void udev_run(struct hotplug_msg *msg) break; default: /* get SIGCHLD in main loop */ - dbg("==> exec seq %d [%d] working at '%s'", msg->seqnum, pid, msg->devpath); + dbg("==> exec seq %li [%d] working at '%s'", msg->seqnum, pid, msg->devpath); msg->pid = pid; } } @@ -186,9 +189,9 @@ static void exec_queue_manager() /* move event to run list */ list_move_tail(&loop_msg->list, &running_list); udev_run(loop_msg); - dbg("moved seq %d to running list", loop_msg->seqnum); + dbg("moved seq %li to running list", loop_msg->seqnum); } else { - dbg("delay seq %d, cause seq %d already working on '%s'", + dbg("delay seq %li, cause seq %li already working on '%s'", loop_msg->seqnum, msg->seqnum, msg->devpath); } } @@ -199,7 +202,7 @@ static void msg_move_exec(struct hotplug_msg *msg) list_move_tail(&msg->list, &exec_list); run_exec_q = 1; expected_seqnum = msg->seqnum+1; - dbg("moved seq %d to exec, next expected is %d", + dbg("moved seq %li to exec, next expected is %li", msg->seqnum, expected_seqnum); } @@ -211,7 +214,7 @@ static void msg_queue_manager() struct sysinfo info; long msg_age = 0; - dbg("msg queue manager, next expected is %d", expected_seqnum); + dbg("msg queue manager, next expected is %li", expected_seqnum); recheck: list_for_each_entry_safe(loop_msg, tmp_msg, &msg_list, list) { /* move event with expected sequence to the exec list */ @@ -223,7 +226,7 @@ recheck: /* move event with expired timeout to the exec list */ sysinfo(&info); msg_age = info.uptime - loop_msg->queue_time; - dbg("seq %d is %li seconds old", loop_msg->seqnum, msg_age); + dbg("seq %li is %li seconds old", loop_msg->seqnum, msg_age); if (msg_age > EVENT_TIMEOUT_SEC-1) { msg_move_exec(loop_msg); goto recheck; @@ -350,9 +353,9 @@ static void udev_done(int pid) list_for_each_entry(msg, &running_list, list) { if (msg->pid == pid) { - dbg("<== exec seq %d came back", msg->seqnum); + dbg("<== exec seq %li came back", msg->seqnum); run_queue_delete(msg); - + /* we want to run the exec queue manager since there may * be events waiting with the devpath of the one that * just finished diff --git a/udevd.h b/udevd.h index 5fdd62d323..cced75d5f6 100644 --- a/udevd.h +++ b/udevd.h @@ -33,7 +33,7 @@ struct hotplug_msg { char magic[20]; struct list_head list; pid_t pid; - int seqnum; + long seqnum; long queue_time; char action[ACTION_SIZE]; char devpath[DEVPATH_SIZE]; -- cgit v1.2.3-54-g00ecf From cb7c281b8dfb4b1c53902b197c98ac7bd4c7e421 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 5 Sep 2004 18:05:32 +0200 Subject: [PATCH] let /sbin/hotplug execute udev earlier We ran into problems with all the /etc/hotplug.d/ scripts that sleep for the sysfs files or for other reasons. Anyway, it takes much too much time before udev is executed. HAL has its own notifier in /etc/hotplug.d/ and also waits for the dev.d/events with the same SEQNUM. Sometimes it take 25 seconds between these two events, cause the other scripts are sleeping too much :) Attached is a patch that installs the udevsend symlink as 10-udev.hotplug instead of udev.hotplug, to be executed earlier. [kay@pim udev.kay]$ tree /etc/hotplug.d/ /etc/hotplug.d/ `-- default |-- 10-udev.hotplug -> /sbin/udevsend |-- 20-hal.hotplug -> /usr/libexec/hal.hotplug `-- default.hotplug --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d4d3ac8b05..5083bed7f5 100644 --- a/Makefile +++ b/Makefile @@ -389,7 +389,7 @@ install: install-initscript install-config install-man install-dev.d all $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) ln -sf $(sbindir)/udev $(DESTDIR)$(sbindir)/$(STARTER) - - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/$(ROOT).hotplug + - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/10-udev.hotplug ifndef DESTDIR - killall udevd - rm -f $(udevdir)/.udev.tdb @@ -401,7 +401,7 @@ endif done ; \ uninstall: uninstall-man uninstall-dev.d - - rm $(hotplugdir)/udev.hotplug + - rm $(hotplugdir)/10-udev.hotplug - rm $(configdir)/rules.d/50-udev.rules - rm $(configdir)/permissions.d/50-udev.permissions - rm $(configdir)/udev.conf -- cgit v1.2.3-54-g00ecf From c506c4087efe567b3cb382bd228644cde3453b04 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 5 Sep 2004 18:05:36 +0200 Subject: [PATCH] update udev_volume_id Here is an update for the volume_id callout to catch up to the latest and greatest: o It is able to skip the label reading of linux raid members, which are otherwise recognized as a normal filesystem. o It reads FAT labels stored in the directory instead of the superblock (Windows only writes in the directory). o The NTFS uuid is the right one now. o It reads all the Apple HFS(+) formats with the labels. o UFS volumes are recognized but no labels are extracted. o We use CFLAGS+=-D_FILE_OFFSET_BITS=64 instead of lsee64() which may fix a bug mentioned on the klibc mailing list. A lot of other new features are only used in HAL and not needed in this simple callout. But if someone stumbles over it and want's to send a patch for some exotic formats, we better keep it up to date :) --- extras/volume_id/Makefile | 6 +- extras/volume_id/udev_volume_id.c | 80 +- extras/volume_id/volume_id.c | 1554 +++++++++++++++++++++++++++++++------ extras/volume_id/volume_id.h | 75 +- 4 files changed, 1430 insertions(+), 285 deletions(-) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 307fdc2f16..8813f9fca5 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -28,7 +28,11 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-Wall -fno-builtin +override CFLAGS+=-Wall -fno-builtin -Wchar-subscripts -Wmissing-declarations \ + -Wnested-externs -Wpointer-arith -Wcast-align \ + -Wsign-compare + +override CFLAGS+=-D_FILE_OFFSET_BITS=64 SYSFS = ../../libsysfs/sysfs_bus.o \ ../../libsysfs/sysfs_class.o \ diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 18915cb62b..e88445054b 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include "../../libsysfs/sysfs/libsysfs.h" #include "../../udev_lib.h" @@ -71,6 +73,36 @@ static struct volume_id *open_classdev(struct sysfs_class_device *class_dev) return vid; } +static unsigned long long get_size(struct volume_id *vid) +{ + unsigned long long size; + + if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) + size = 0; + + return size; +} + +static char *usage_id_name(enum volume_id_usage usage) +{ + switch(usage) { + case VOLUME_ID_UNUSED: + return "unused"; + case VOLUME_ID_UNPROBED: + return "unprobed"; + case VOLUME_ID_OTHER: + return "other"; + case VOLUME_ID_PARTITIONTABLE: + return "partitiontable"; + case VOLUME_ID_FILESYSTEM: + return "filesystem"; + case VOLUME_ID_RAID: + return "raid"; + default: + return "unknown type_id"; + } +} + int main(int argc, char *argv[]) { const char help[] = "usage: udev_volume_id [-t|-l|-u|-d]\n" @@ -80,7 +112,6 @@ int main(int argc, char *argv[]) " -d disk label from main device\n" "\n"; static const char short_options[] = "htlud"; - int option; char sysfs_path[SYSFS_PATH_MAX]; char dev_path[SYSFS_PATH_MAX]; struct sysfs_class_device *class_dev = NULL; @@ -92,9 +123,12 @@ int main(int argc, char *argv[]) char dasd_label[7]; static char name[VOLUME_ID_LABEL_SIZE]; int len, i, j; + unsigned long long size; int rc = 1; while (1) { + int option; + option = getopt(argc, argv, short_options); if (option == -1) break; @@ -146,24 +180,26 @@ int main(int argc, char *argv[]) vid = open_classdev(class_dev); if (vid == NULL) goto exit; - if (volume_id_probe(vid, ALL) == 0) + + size = get_size(vid); + + if (volume_id_probe(vid, VOLUME_ID_ALL, 0, size) == 0) goto print; break; case 'd' : - /* if we are on a partition, close it and open main block device */ + /* if we are on a partition, open main block device instead */ class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) { - volume_id_close(vid); + if (class_dev_parent != NULL) vid = open_classdev(class_dev_parent); - } else { + else vid = open_classdev(class_dev_parent); - } if (vid == NULL) goto exit; + if (probe_ibm_partition(vid->fd, dasd_label) == 0) { - vid->fs_name = "dasd"; - strncpy(vid->label_string, dasd_label, 6); - vid->label_string[6] = '\0'; + vid->type = "dasd"; + strncpy(vid->label, dasd_label, 6); + vid->label[6] = '\0'; goto print; } break; @@ -174,10 +210,10 @@ int main(int argc, char *argv[]) print: - len = strnlen(vid->label_string, VOLUME_ID_LABEL_SIZE); + len = strnlen(vid->label, VOLUME_ID_LABEL_SIZE); /* remove trailing spaces */ - while (len > 0 && isspace(vid->label_string[len-1])) + while (len > 0 && isspace(vid->label[len-1])) len--; name[len] = '\0'; @@ -185,14 +221,14 @@ print: i = 0; j = 0; while (j < len) { - switch(vid->label_string[j]) { + switch(vid->label[j]) { case '/' : break; case ' ' : name[i++] = '_'; break; default : - name[i++] = vid->label_string[j]; + name[i++] = vid->label[j]; } j++; } @@ -200,27 +236,29 @@ print: switch (print) { case 't': - printf("%s\n", vid->fs_name); + printf("%s\n", vid->type); break; case 'l': - if (name[0] == '\0') { + if (name[0] == '\0' || vid->usage_id != VOLUME_ID_FILESYSTEM) { rc = 2; goto exit; } printf("%s\n", name); break; case 'u': - if (vid->uuid_string[0] == '\0') { + if (vid->uuid[0] == '\0' || vid->usage_id != VOLUME_ID_FILESYSTEM) { rc = 2; goto exit; } - printf("%s\n", vid->uuid_string); + printf("%s\n", vid->uuid); break; case 'a': - printf("T:%s\n", vid->fs_name); - printf("L:%s\n", vid->label_string); + printf("F:%s\n", usage_id_name(vid->usage_id)); + printf("T:%s\n", vid->type); + printf("V:%s\n", vid->type_version); + printf("L:%s\n", vid->label); printf("N:%s\n", name); - printf("U:%s\n", vid->uuid_string); + printf("U:%s\n", vid->uuid); } rc = 0; diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index ac7e76b9d4..daeb00038a 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -3,13 +3,10 @@ * * Copyright (C) 2004 Kay Sievers * - * The superblock structs are taken from the libblkid living inside - * the e2fsprogs. This is a simple straightforward implementation for - * reading the label strings of only the most common filesystems. - * If you need a full featured library with attribute caching, support for - * much more partition/media types or non-root disk access, you may have - * a look at: - * http://e2fsprogs.sourceforge.net. + * The superblock structs are taken from the linux kernel sources + * and the libblkid living inside the e2fsprogs. This is a simple + * straightforward implementation for reading the label strings of the + * most common filesystems. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -30,6 +27,10 @@ #define _GNU_SOURCE #endif +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include #include @@ -49,7 +50,7 @@ } while (0) #else #define dbg(format, arg...) do {} while (0) -#endif +#endif /* DEBUG */ #define bswap16(x) (__u16)((((__u16)(x) & 0x00ffu) << 8) | \ (((__u32)(x) & 0xff00u) >> 8)) @@ -68,20 +69,24 @@ (((__u64)(x) & 0x000000000000ff00u) << 40) | \ (((__u64)(x) & 0x00000000000000ffu) << 56)) -#if (__BYTE_ORDER == __LITTLE_ENDIAN) +#if (__BYTE_ORDER == __LITTLE_ENDIAN) #define le16_to_cpu(x) (x) #define le32_to_cpu(x) (x) #define le64_to_cpu(x) (x) +#define be16_to_cpu(x) bswap16(x) +#define be32_to_cpu(x) bswap32(x) #elif (__BYTE_ORDER == __BIG_ENDIAN) #define le16_to_cpu(x) bswap16(x) #define le32_to_cpu(x) bswap32(x) #define le64_to_cpu(x) bswap64(x) +#define be16_to_cpu(x) (x) +#define be32_to_cpu(x) (x) #endif -/* size of superblock buffer, reiser block is at 64k */ +/* size of superblock buffer, reiserfs block is at 64k */ #define SB_BUFFER_SIZE 0x11000 -/* size of seek buffer 2k */ -#define SEEK_BUFFER_SIZE 0x800 +/* size of seek buffer 4k */ +#define SEEK_BUFFER_SIZE 0x1000 static void set_label_raw(struct volume_id *id, @@ -96,15 +101,15 @@ static void set_label_string(struct volume_id *id, { unsigned int i; - memcpy(id->label_string, buf, count); + memcpy(id->label, buf, count); /* remove trailing whitespace */ - i = strnlen(id->label_string, count); + i = strnlen(id->label, count); while (i--) { - if (! isspace(id->label_string[i])) + if (! isspace(id->label[i])) break; } - id->label_string[i+1] = '\0'; + id->label[i+1] = '\0'; } #define LE 0 @@ -118,23 +123,23 @@ static void set_label_unicode16(struct volume_id *id, __u16 c; j = 0; - for (i = 0; i <= count-2; i += 2) { + for (i = 0; i + 2 <= count; i += 2) { if (endianess == LE) c = (buf[i+1] << 8) | buf[i]; else c = (buf[i] << 8) | buf[i+1]; if (c == 0) { - id->label_string[j] = '\0'; + id->label[j] = '\0'; break; } else if (c < 0x80) { - id->label_string[j++] = (__u8) c; + id->label[j++] = (__u8) c; } else if (c < 0x800) { - id->label_string[j++] = (__u8) (0xc0 | (c >> 6)); - id->label_string[j++] = (__u8) (0x80 | (c & 0x3f)); + id->label[j++] = (__u8) (0xc0 | (c >> 6)); + id->label[j++] = (__u8) (0x80 | (c & 0x3f)); } else { - id->label_string[j++] = (__u8) (0xe0 | (c >> 12)); - id->label_string[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f)); - id->label_string[j++] = (__u8) (0x80 | (c & 0x3f)); + id->label[j++] = (__u8) (0xe0 | (c >> 12)); + id->label[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f)); + id->label[j++] = (__u8) (0x80 | (c & 0x3f)); } } } @@ -144,10 +149,10 @@ static void set_uuid(struct volume_id *id, { unsigned int i; - memcpy(id->uuid, buf, count); + memcpy(id->uuid_raw, buf, count); /* create string if uuid is set */ - for (i = 0; i < count; i++) + for (i = 0; i < count; i++) if (buf[i] != 0) goto set; return; @@ -155,11 +160,16 @@ static void set_uuid(struct volume_id *id, set: switch(count) { case 4: - sprintf(id->uuid_string, "%02X%02X-%02X%02X", + sprintf(id->uuid, "%02X%02X-%02X%02X", + buf[3], buf[2], buf[1], buf[0]); + break; + case 8: + sprintf(id->uuid,"%02X%02X-%02X%02X-%02X%02X-%02X%02X", + buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); break; case 16: - sprintf(id->uuid_string, + sprintf(id->uuid, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" "%02x%02x%02x%02x%02x%02x", buf[0], buf[1], buf[2], buf[3], @@ -171,11 +181,11 @@ set: } } -static __u8 *get_buffer(struct volume_id *id, - unsigned long off, unsigned int len) +static __u8 *get_buffer(struct volume_id *id, __u64 off, unsigned int len) { unsigned int buf_len; + dbg("get buffer off 0x%llx, len 0x%x", off, len); /* check if requested area fits in superblock buffer */ if (off + len <= SB_BUFFER_SIZE) { if (id->sbbuf == NULL) { @@ -186,9 +196,10 @@ static __u8 *get_buffer(struct volume_id *id, /* check if we need to read */ if ((off + len) > id->sbbuf_len) { - dbg("read sbbuf len:0x%lx", off + len); - lseek64(id->fd, 0, SEEK_SET); + dbg("read sbbuf len:0x%llx", off + len); + lseek(id->fd, 0, SEEK_SET); buf_len = read(id->fd, id->sbbuf, off + len); + dbg("got 0x%x (%i) bytes", buf_len, buf_len); id->sbbuf_len = buf_len; if (buf_len < off + len) return NULL; @@ -209,8 +220,9 @@ static __u8 *get_buffer(struct volume_id *id, /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - dbg("read seekbuf off:0x%lx len:0x%x", off, len); - lseek64(id->fd, off, SEEK_SET); + dbg("read seekbuf off:0x%llx len:0x%x", off, len); + if (lseek(id->fd, off, SEEK_SET) == -1) + return NULL; buf_len = read(id->fd, id->seekbuf, len); dbg("got 0x%x (%i) bytes", buf_len, buf_len); id->seekbuf_off = off; @@ -237,10 +249,298 @@ static void free_buffer(struct volume_id *id) } } +#define LVM1_SB_OFF 0x400 +#define LVM1_MAGIC "HM" +static int probe_lvm1(struct volume_id *id, __u64 off) +{ + struct lvm2_super_block { + __u8 id[2]; + } __attribute__((packed)) *lvm; + + const __u8 *buf; + + buf = get_buffer(id, off + LVM1_SB_OFF, 0x800); + if (buf == NULL) + return -1; + + lvm = (struct lvm2_super_block *) buf; + + if (strncmp(lvm->id, LVM1_MAGIC, 2) != 0) + return -1; + + id->usage_id = VOLUME_ID_RAID; + id->type_id = VOLUME_ID_LVM1; + id->type = "LVM1_member"; + + return 0; +} + +#define LVM2_LABEL_ID "LABELONE" +#define LVM2LABEL_SCAN_SECTORS 4 +static int probe_lvm2(struct volume_id *id, __u64 off) +{ + struct lvm2_super_block { + __u8 id[8]; + __u64 sector_xl; + __u32 crc_xl; + __u32 offset_xl; + __u8 type[8]; + } __attribute__((packed)) *lvm; + + const __u8 *buf; + unsigned int soff; + + buf = get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); + if (buf == NULL) + return -1; + + + for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { + lvm = (struct lvm2_super_block *) &buf[soff]; + + if (strncmp(lvm->id, LVM2_LABEL_ID, 8) == 0) + goto found; + } + + return -1; + +found: + strncpy(id->type_version, lvm->type, 8); + id->usage_id = VOLUME_ID_RAID; + id->type_id = VOLUME_ID_LVM1; + id->type = "LVM2_member"; + + return 0; +} + +#define MD_RESERVED_BYTES 0x10000 +#define MD_MAGIC 0xa92b4efc +static int probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) +{ + struct mdp_super_block { + __u32 md_magic; + __u32 major_version; + __u32 minor_version; + __u32 patch_version; + __u32 gvalid_words; + __u32 set_uuid0; + __u32 ctime; + __u32 level; + __u32 size; + __u32 nr_disks; + __u32 raid_disks; + __u32 md_minor; + __u32 not_persistent; + __u32 set_uuid1; + __u32 set_uuid2; + __u32 set_uuid3; + } __attribute__((packed)) *mdp; + + const __u8 *buf; + __u64 sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; + __u8 uuid[16]; + + if (size < 0x10000) + return -1; + + buf = get_buffer(id, off + sboff, 0x800); + if (buf == NULL) + return -1; + + mdp = (struct mdp_super_block *) buf; + + if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) + return -1; + + memcpy(uuid, &mdp->set_uuid0, 4); + memcpy(&uuid[4], &mdp->set_uuid1, 12); + set_uuid(id, uuid, 16); + + snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u.%u.%u", + le32_to_cpu(mdp->major_version), + le32_to_cpu(mdp->minor_version), + le32_to_cpu(mdp->patch_version)); + + dbg("found raid signature"); + id->usage_id = VOLUME_ID_RAID; + id->type = "linux_raid_member"; + + return 0; +} + +#define MSDOS_MAGIC "\x55\xaa" +#define MSDOS_PARTTABLE_OFFSET 0x1be +#define MSDOS_SIG_OFF 0x1fe +#define BSIZE 0x200 +#define DOS_EXTENDED_PARTITION 0x05 +#define LINUX_EXTENDED_PARTITION 0x85 +#define WIN98_EXTENDED_PARTITION 0x0f +#define LINUX_RAID_PARTITION 0xfd +#define is_extended(type) \ + (type == DOS_EXTENDED_PARTITION || \ + type == WIN98_EXTENDED_PARTITION || \ + type == LINUX_EXTENDED_PARTITION) +#define is_raid(type) \ + (type == LINUX_RAID_PARTITION) +static int probe_msdos_part_table(struct volume_id *id, __u64 off) +{ + struct msdos_partition_entry { + __u8 boot_ind; + __u8 head; + __u8 sector; + __u8 cyl; + __u8 sys_ind; + __u8 end_head; + __u8 end_sector; + __u8 end_cyl; + __u32 start_sect; + __u32 nr_sects; + } __attribute__((packed)) *part; + + const __u8 *buf; + int i; + __u64 poff; + __u64 plen; + __u64 extended = 0; + __u64 current; + __u64 next; + int limit; + int empty = 1; + struct volume_id_partition *p; + + buf = get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + if (strncmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + return -1; + + /* check flags on all entries for a valid partition table */ + part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; + for (i = 0; i < 4; i++) { + if (part[i].boot_ind != 0 && + part[i].boot_ind != 0x80) + return -1; + + if (le32_to_cpu(part[i].nr_sects) != 0) + empty = 0; + } + if (empty == 1) + return -1; + + if (id->partitions != NULL) + free(id->partitions); + id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX * + sizeof(struct volume_id_partition)); + if (id->partitions == NULL) + return -1; + memset(id->partitions, 0x00, + VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); + + for (i = 0; i < 4; i++) { + poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + + if (plen == 0) + continue; + + p = &id->partitions[i]; + + if (is_extended(part[i].sys_ind)) { + dbg("found extended partition at 0x%llx", poff); + p->usage_id = VOLUME_ID_PARTITIONTABLE; + p->type_id = VOLUME_ID_MSDOSEXTENDED; + p->type = "msdos_extended_partition"; + if (extended == 0) + extended = off + poff; + } else { + dbg("found 0x%x data partition at 0x%llx, len 0x%llx", + part[i].sys_ind, poff, plen); + + if (is_raid(part[i].sys_ind)) + p->usage_id = VOLUME_ID_RAID; + else + p->usage_id = VOLUME_ID_UNPROBED; + } + + p->off = off + poff; + p->len = plen; + id->partition_count = i+1; + } + + next = extended; + current = extended; + limit = 50; + + /* follow extended partition chain and add data partitions */ + while (next != 0) { + if (limit-- == 0) { + dbg("extended chain limit reached"); + break; + } + + buf = get_buffer(id, current, 0x200); + if (buf == NULL) + break; + + part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; + + if (strncmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + break; + + next = 0; + + for (i = 0; i < 4; i++) { + poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + + if (plen == 0) + continue; + + if (is_extended(part[i].sys_ind)) { + dbg("found extended partition at 0x%llx", poff); + if (next == 0) + next = extended + poff; + } else { + dbg("found 0x%x data partition at 0x%llx, len 0x%llx", + part[i].sys_ind, poff, plen); + + /* we always start at the 5th entry */ + while (id->partition_count < 4) + id->partitions[id->partition_count++].usage_id = + VOLUME_ID_UNUSED; + + p = &id->partitions[id->partition_count]; + + if (is_raid(part[i].sys_ind)) + p->usage_id = VOLUME_ID_RAID; + else + p->usage_id = VOLUME_ID_UNPROBED; + + p->off = current + poff; + p->len = plen; + id->partition_count++; + if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { + dbg("to many partitions"); + next = 0; + } + } + } + + current = next; + } + + id->usage_id = VOLUME_ID_PARTITIONTABLE; + id->type_id = VOLUME_ID_MSDOSPARTTABLE; + id->type = "msdos_partition_table"; + + return 0; +} + #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 #define EXT_SUPERBLOCK_OFFSET 0x400 -static int probe_ext(struct volume_id *id) +static int probe_ext(struct volume_id *id, __u64 off) { struct ext2_super_block { __u32 inodes_count; @@ -262,7 +562,7 @@ static int probe_ext(struct volume_id *id) } __attribute__((__packed__)) *es; es = (struct ext2_super_block *) - get_buffer(id, EXT_SUPERBLOCK_OFFSET, 0x200); + get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); if (es == NULL) return -1; @@ -276,21 +576,23 @@ static int probe_ext(struct volume_id *id) if ((le32_to_cpu(es->feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) { - id->fs_type = EXT3; - id->fs_name = "ext3"; + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_EXT3; + id->type = "ext3"; } else { - id->fs_type = EXT2; - id->fs_name = "ext2"; + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_EXT2; + id->type = "ext2"; } return 0; } -#define REISER1_SUPERBLOCK_OFFSET 0x2000 -#define REISER_SUPERBLOCK_OFFSET 0x10000 -static int probe_reiser(struct volume_id *id) +#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 +#define REISERFS_SUPERBLOCK_OFFSET 0x10000 +static int probe_reiserfs(struct volume_id *id, __u64 off) { - struct reiser_super_block { + struct reiserfs_super_block { __u32 blocks_count; __u32 free_blocks; __u32 root_block; @@ -306,23 +608,30 @@ static int probe_reiser(struct volume_id *id) __u8 label[16]; } __attribute__((__packed__)) *rs; - rs = (struct reiser_super_block *) - get_buffer(id, REISER_SUPERBLOCK_OFFSET, 0x200); + rs = (struct reiserfs_super_block *) + get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); if (rs == NULL) return -1; - if (strncmp(rs->magic, "ReIsEr2Fs", 9) == 0) + if (strncmp(rs->magic, "ReIsEr2Fs", 9) == 0) { + strcpy(id->type_version, "3.6"); goto found; - if (strncmp(rs->magic, "ReIsEr3Fs", 9) == 0) + } + + if (strncmp(rs->magic, "ReIsEr3Fs", 9) == 0) { + strcpy(id->type_version, "JR"); goto found; + } - rs = (struct reiser_super_block *) - get_buffer(id, REISER1_SUPERBLOCK_OFFSET, 0x200); + rs = (struct reiserfs_super_block *) + get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); if (rs == NULL) return -1; - if (strncmp(rs->magic, "ReIsErFs", 8) == 0) + if (strncmp(rs->magic, "ReIsErFs", 8) == 0) { + strcpy(id->type_version, "3.5"); goto found; + } return -1; @@ -331,13 +640,14 @@ found: set_label_string(id, rs->label, 16); set_uuid(id, rs->uuid, 16); - id->fs_type = REISER; - id->fs_name = "reiser"; + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_REISERFS; + id->type = "reiserfs"; return 0; } -static int probe_xfs(struct volume_id *id) +static int probe_xfs(struct volume_id *id, __u64 off) { struct xfs_super_block { __u8 magic[4]; @@ -354,7 +664,7 @@ static int probe_xfs(struct volume_id *id) __u64 fdblocks; } __attribute__((__packed__)) *xs; - xs = (struct xfs_super_block *) get_buffer(id, 0, 0x200); + xs = (struct xfs_super_block *) get_buffer(id, off, 0x200); if (xs == NULL) return -1; @@ -365,14 +675,15 @@ static int probe_xfs(struct volume_id *id) set_label_string(id, xs->fname, 12); set_uuid(id, xs->uuid, 16); - id->fs_type = XFS; - id->fs_name = "xfs"; + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_XFS; + id->type = "xfs"; return 0; } #define JFS_SUPERBLOCK_OFFSET 0x8000 -static int probe_jfs(struct volume_id *id) +static int probe_jfs(struct volume_id *id, __u64 off) { struct jfs_super_block { __u8 magic[4]; @@ -388,7 +699,7 @@ static int probe_jfs(struct volume_id *id) } __attribute__((__packed__)) *js; js = (struct jfs_super_block *) - get_buffer(id, JFS_SUPERBLOCK_OFFSET, 0x200); + get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); if (js == NULL) return -1; @@ -399,115 +710,294 @@ static int probe_jfs(struct volume_id *id) set_label_string(id, js->label, 16); set_uuid(id, js->uuid, 16); - id->fs_type = JFS; - id->fs_name = "jfs"; + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_JFS; + id->type = "jfs"; return 0; } -static int probe_vfat(struct volume_id *id) +#define FAT12_MAX 0xff5 +#define FAT16_MAX 0xfff5 +#define FAT_ATTR_VOLUME 0x08 +struct vfat_dir_entry { + __u8 name[11]; + __u8 attr; + __u16 time_creat; + __u16 date_creat; + __u16 time_acc; + __u16 date_acc; + __u16 cluster_high; + __u16 time_write; + __u16 date_write; + __u16 cluster_low; + __u32 size; +} __attribute__((__packed__)); + +static char *vfat_search_label_in_dir(const __u8 *buf, __u16 size) +{ + struct vfat_dir_entry *dir; + int i; + __u16 count; + + dir = (struct vfat_dir_entry*) buf; + count = size / sizeof(struct vfat_dir_entry); + dbg("expected entries 0x%x", count); + + for (i = 0; i <= count; i++) { + /* end marker */ + if (dir[i].attr == 0x00) { + dbg("end of dir"); + return NULL; + } + + /* empty entry */ + if (dir[i].attr == 0xe5) + continue; + + if (dir[i].attr == FAT_ATTR_VOLUME) { + dbg("found ATTR_VOLUME id in root dir"); + return dir[i].name; + } + + dbg("skip dir entry"); + } + + return NULL; +} + +static int probe_vfat(struct volume_id *id, __u64 off) { struct vfat_super_block { - __u8 ignored[3]; + __u8 boot_jump[3]; __u8 sysid[8]; - __u8 sector_size[2]; - __u8 cluster_size; + __u16 sector_size; + __u8 sectors_per_cluster; __u16 reserved; __u8 fats; - __u8 dir_entries[2]; - __u8 sectors[2]; + __u16 dir_entries; + __u16 sectors; __u8 media; __u16 fat_length; __u16 secs_track; __u16 heads; __u32 hidden; __u32 total_sect; - __u32 fat32_length; - __u16 flags; - __u8 version[2]; - __u32 root_cluster; - __u16 insfo_sector; - __u16 backup_boot; - __u16 reserved2[6]; - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[164]; - __u8 pmagic[2]; + union { + struct fat_super_block { + __u8 unknown[3]; + __u8 serno[4]; + __u8 label[11]; + __u8 magic[8]; + __u8 dummy2[192]; + __u8 pmagic[2]; + } __attribute__((__packed__)) fat; + struct fat32_super_block { + __u32 fat32_length; + __u16 flags; + __u8 version[2]; + __u32 root_cluster; + __u16 insfo_sector; + __u16 backup_boot; + __u16 reserved2[6]; + __u8 unknown[3]; + __u8 serno[4]; + __u8 label[11]; + __u8 magic[8]; + __u8 dummy2[164]; + __u8 pmagic[2]; + } __attribute__((__packed__)) fat32; + } __attribute__((__packed__)) type; } __attribute__((__packed__)) *vs; - vs = (struct vfat_super_block *) get_buffer(id, 0, 0x200); + __u16 sector_size; + __u16 dir_entries; + __u32 sect_count; + __u16 reserved; + __u16 fat_size; + __u32 root_cluster; + __u32 dir_size; + __u32 cluster_count; + __u32 fat_length; + __u64 root_start; + __u32 start_data_sect; + __u16 root_dir_entries; + __u8 *buf; + __u32 buf_size; + __u8 *label = NULL; + __u32 next; + + vs = (struct vfat_super_block *) get_buffer(id, off, 0x200); if (vs == NULL) return -1; - if (strncmp(vs->magic, "MSWIN", 5) == 0) - goto found; - if (strncmp(vs->magic, "FAT32 ", 8) == 0) - goto found; - return -1; + /* believe only that's fat, don't trust the version + * the cluster_count will tell us + */ + if (strncmp(vs->type.fat32.magic, "MSWIN", 5) == 0) + goto valid; -found: - set_label_raw(id, vs->label, 11); - set_label_string(id, vs->label, 11); - set_uuid(id, vs->serno, 4); + if (strncmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) + goto valid; - id->fs_type = VFAT; - id->fs_name = "vfat"; + if (strncmp(vs->type.fat.magic, "FAT16 ", 8) == 0) + goto valid; - return 0; -} + if (strncmp(vs->type.fat.magic, "MSDOS", 5) == 0) + goto valid; -static int probe_msdos(struct volume_id *id) -{ - struct msdos_super_block { - __u8 ignored[3]; - __u8 sysid[8]; - __u8 sector_size[2]; - __u8 cluster_size; - __u16 reserved; - __u8 fats; - __u8 dir_entries[2]; - __u8 sectors[2]; - __u8 media; - __u16 fat_length; - __u16 secs_track; - __u16 heads; - __u32 hidden; - __u32 total_sect; - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[192]; - __u8 pmagic[2]; - } __attribute__((__packed__)) *ms; - - ms = (struct msdos_super_block *) get_buffer(id, 0, 0x200); - if (ms == NULL) + if (strncmp(vs->type.fat.magic, "FAT12 ", 8) == 0) + goto valid; + + /* + * There are old floppies out there without a magic, so we check + * for well known values and guess if it's a fat volume + */ + + /* boot jump address check */ + if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && + vs->boot_jump[0] != 0xe9) return -1; - if (strncmp(ms->magic, "MSDOS", 5) == 0) - goto found; - if (strncmp(ms->magic, "FAT16 ", 8) == 0) - goto found; - if (strncmp(ms->magic, "FAT12 ", 8) == 0) + /* heads check */ + if (vs->heads == 0) + return -1; + + /* cluster size check*/ + if (vs->sectors_per_cluster == 0 || + (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) + return -1; + + /* media check */ + if (vs->media < 0xf8 && vs->media != 0xf0) + return -1; + + /* fat count*/ + if (vs->fats != 2) + return -1; + +valid: + /* sector size check */ + sector_size = le16_to_cpu(vs->sector_size); + if (sector_size != 0x200 && sector_size != 0x400 && + sector_size != 0x800 && sector_size != 0x1000) + return -1; + + dbg("sector_size 0x%x", sector_size); + dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); + + dir_entries = le16_to_cpu(vs->dir_entries); + reserved = le16_to_cpu(vs->reserved); + dbg("reserved 0x%x", reserved); + + sect_count = le16_to_cpu(vs->sectors); + if (sect_count == 0) + sect_count = vs->total_sect; + dbg("sect_count 0x%x", sect_count); + + fat_length = le16_to_cpu(vs->fat_length); + if (fat_length == 0) + fat_length = le32_to_cpu(vs->type.fat32.fat32_length); + dbg("fat_length 0x%x", fat_length); + + fat_size = fat_length * vs->fats; + dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + + (sector_size-1)) / sector_size; + dbg("dir_size 0x%x", dir_size); + + cluster_count = sect_count - (reserved + fat_size + dir_size); + cluster_count /= vs->sectors_per_cluster; + dbg("cluster_count 0x%x", cluster_count); + + if (cluster_count < FAT12_MAX) { + strcpy(id->type_version, "FAT12"); + } else if (cluster_count < FAT16_MAX) { + strcpy(id->type_version, "FAT16"); + } else { + strcpy(id->type_version, "FAT32"); + goto fat32; + } + + /* the label may be an attribute in the root directory */ + root_start = (reserved + fat_size) * sector_size; + root_dir_entries = le16_to_cpu(vs->dir_entries); + dbg("root dir start 0x%x", root_start); + + buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); + buf = get_buffer(id, off + root_start, buf_size); + if (buf == NULL) goto found; - return -1; -found: - set_label_raw(id, ms->label, 11); - set_label_string(id, ms->label, 11); - set_uuid(id, ms->serno, 4); + label = vfat_search_label_in_dir(buf, buf_size); + + if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { + set_label_raw(id, label, 11); + set_label_string(id, label, 11); + } else if (strncmp(vs->type.fat.label, "NO NAME ", 11) != 0) { + set_label_raw(id, vs->type.fat.label, 11); + set_label_string(id, vs->type.fat.label, 11); + } + set_uuid(id, vs->type.fat.serno, 4); + goto found; + +fat32: + /* FAT32 root dir is a cluster chain like any other directory */ + buf_size = vs->sectors_per_cluster * sector_size; + root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); + dbg("root dir cluster %u", root_cluster); + start_data_sect = reserved + fat_size; + + next = root_cluster; + while (1) { + __u32 next_sect_off; + __u64 next_off; + __u64 fat_entry_off; + + dbg("next cluster %u", next); + next_sect_off = (next - 2) * vs->sectors_per_cluster; + next_off = (start_data_sect + next_sect_off) * sector_size; + dbg("cluster offset 0x%x", next_off); + + /* get cluster */ + buf = get_buffer(id, off + next_off, buf_size); + if (buf == NULL) + goto found; - id->fs_type = MSDOS; - id->fs_name = "msdos"; + label = vfat_search_label_in_dir(buf, buf_size); + if (label != NULL) + break; + + /* get FAT entry */ + fat_entry_off = (reserved * sector_size) + (next * sizeof(__u32)); + buf = get_buffer(id, off + fat_entry_off, buf_size); + if (buf == NULL) + goto found; + + /* set next cluster */ + next = le32_to_cpu(*((__u32 *) buf) & 0x0fffffff); + if (next == 0) + break; + } + + if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { + set_label_raw(id, label, 11); + set_label_string(id, label, 11); + } else if (strncmp(vs->type.fat32.label, "NO NAME ", 11) == 0) { + set_label_raw(id, vs->type.fat32.label, 11); + set_label_string(id, vs->type.fat32.label, 11); + } + set_uuid(id, vs->type.fat32.serno, 4); + +found: + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_VFAT; + id->type = "vfat"; return 0; } #define UDF_VSD_OFFSET 0x8000 -static int probe_udf(struct volume_id *id) +static int probe_udf(struct volume_id *id, __u64 off) { struct volume_descriptor { struct descriptor_tag { @@ -550,7 +1040,7 @@ static int probe_udf(struct volume_id *id) unsigned int clen; vsd = (struct volume_structure_descriptor *) - get_buffer(id, UDF_VSD_OFFSET, 0x200); + get_buffer(id, off + UDF_VSD_OFFSET, 0x200); if (vsd == NULL) return -1; @@ -574,7 +1064,7 @@ blocksize: /* search the next VSD to get the logical block size of the volume */ for (bs = 0x800; bs < 0x8000; bs += 0x800) { vsd = (struct volume_structure_descriptor *) - get_buffer(id, UDF_VSD_OFFSET + bs, 0x800); + get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); if (vsd == NULL) return -1; dbg("test for blocksize: 0x%x", bs); @@ -587,7 +1077,7 @@ nsr: /* search the list of VSDs for a NSR descriptor */ for (b = 0; b < 64; b++) { vsd = (struct volume_structure_descriptor *) - get_buffer(id, UDF_VSD_OFFSET + (b * bs), 0x800); + get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); if (vsd == NULL) return -1; @@ -605,7 +1095,8 @@ nsr: anchor: /* read anchor volume descriptor */ - vd = (struct volume_descriptor *) get_buffer(id, 256 * bs, 0x200); + vd = (struct volume_descriptor *) + get_buffer(id, off + (256 * bs), 0x200); if (vd == NULL) return -1; @@ -621,7 +1112,7 @@ anchor: /* pick the primary descriptor from the list */ for (b = 0; b < count; b++) { vd = (struct volume_descriptor *) - get_buffer(id, (loc + b) * bs, 0x200); + get_buffer(id, off + ((loc + b) * bs), 0x200); if (vd == NULL) return -1; @@ -644,20 +1135,21 @@ pvd: clen = vd->type.primary.ident.clen; dbg("label string charsize=%i bit", clen); - if (clen == 8) + if (clen == 8) set_label_string(id, vd->type.primary.ident.c, 31); else if (clen == 16) set_label_unicode16(id, vd->type.primary.ident.c, BE,31); found: - id->fs_type = UDF; - id->fs_name = "udf"; + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_UDF; + id->type = "udf"; return 0; } #define ISO_SUPERBLOCK_OFFSET 0x8000 -static int probe_iso9660(struct volume_id *id) +static int probe_iso9660(struct volume_id *id, __u64 off) { union iso_super_block { struct iso_header { @@ -677,7 +1169,7 @@ static int probe_iso9660(struct volume_id *id) } __attribute__((__packed__)) *is; is = (union iso_super_block *) - get_buffer(id, ISO_SUPERBLOCK_OFFSET, 0x200); + get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); if (is == NULL) return -1; @@ -691,40 +1183,557 @@ static int probe_iso9660(struct volume_id *id) return -1; found: - id->fs_type = ISO9660; - id->fs_name = "iso9660"; + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_ISO9660; + id->type = "iso9660"; + + return 0; +} + +#define UFS_MAGIC 0x00011954 +#define UFS2_MAGIC 0x19540119 +#define UFS_MAGIC_FEA 0x00195612 +#define UFS_MAGIC_LFN 0x00095014 + + +static int probe_ufs(struct volume_id *id, __u64 off) +{ + struct ufs_super_block { + __u32 fs_link; + __u32 fs_rlink; + __u32 fs_sblkno; + __u32 fs_cblkno; + __u32 fs_iblkno; + __u32 fs_dblkno; + __u32 fs_cgoffset; + __u32 fs_cgmask; + __u32 fs_time; + __u32 fs_size; + __u32 fs_dsize; + __u32 fs_ncg; + __u32 fs_bsize; + __u32 fs_fsize; + __u32 fs_frag; + __u32 fs_minfree; + __u32 fs_rotdelay; + __u32 fs_rps; + __u32 fs_bmask; + __u32 fs_fmask; + __u32 fs_bshift; + __u32 fs_fshift; + __u32 fs_maxcontig; + __u32 fs_maxbpg; + __u32 fs_fragshift; + __u32 fs_fsbtodb; + __u32 fs_sbsize; + __u32 fs_csmask; + __u32 fs_csshift; + __u32 fs_nindir; + __u32 fs_inopb; + __u32 fs_nspf; + __u32 fs_optim; + __u32 fs_npsect_state; + __u32 fs_interleave; + __u32 fs_trackskew; + __u32 fs_id[2]; + __u32 fs_csaddr; + __u32 fs_cssize; + __u32 fs_cgsize; + __u32 fs_ntrak; + __u32 fs_nsect; + __u32 fs_spc; + __u32 fs_ncyl; + __u32 fs_cpg; + __u32 fs_ipg; + __u32 fs_fpg; + struct ufs_csum { + __u32 cs_ndir; + __u32 cs_nbfree; + __u32 cs_nifree; + __u32 cs_nffree; + } __attribute__((__packed__)) fs_cstotal; + __s8 fs_fmod; + __s8 fs_clean; + __s8 fs_ronly; + __s8 fs_flags; + union { + struct { + __s8 fs_fsmnt[512]; + __u32 fs_cgrotor; + __u32 fs_csp[31]; + __u32 fs_maxcluster; + __u32 fs_cpc; + __u16 fs_opostbl[16][8]; + } __attribute__((__packed__)) fs_u1; + struct { + __s8 fs_fsmnt[468]; + __u8 fs_volname[32]; + __u64 fs_swuid; + __s32 fs_pad; + __u32 fs_cgrotor; + __u32 fs_ocsp[28]; + __u32 fs_contigdirs; + __u32 fs_csp; + __u32 fs_maxcluster; + __u32 fs_active; + __s32 fs_old_cpc; + __s32 fs_maxbsize; + __s64 fs_sparecon64[17]; + __s64 fs_sblockloc; + struct ufs2_csum_total { + __u64 cs_ndir; + __u64 cs_nbfree; + __u64 cs_nifree; + __u64 cs_nffree; + __u64 cs_numclusters; + __u64 cs_spare[3]; + } __attribute__((__packed__)) fs_cstotal; + struct ufs_timeval { + __s32 tv_sec; + __s32 tv_usec; + } __attribute__((__packed__)) fs_time; + __s64 fs_size; + __s64 fs_dsize; + __u64 fs_csaddr; + __s64 fs_pendingblocks; + __s32 fs_pendinginodes; + } __attribute__((__packed__)) fs_u2; + } fs_u11; + union { + struct { + __s32 fs_sparecon[53]; + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __s32 fs_state; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + } __attribute__((__packed__)) fs_sun; + struct { + __s32 fs_sparecon[53]; + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __u32 fs_npsect; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + } __attribute__((__packed__)) fs_sunx86; + struct { + __s32 fs_sparecon[50]; + __s32 fs_contigsumsize; + __s32 fs_maxsymlinklen; + __s32 fs_inodefmt; + __u32 fs_maxfilesize[2]; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + __s32 fs_state; + } __attribute__((__packed__)) fs_44; + } fs_u2; + __s32 fs_postblformat; + __s32 fs_nrpos; + __s32 fs_postbloff; + __s32 fs_rotbloff; + __u32 fs_magic; + __u8 fs_space[1]; + } __attribute__((__packed__)) *ufs; + + __u32 magic; + int i; + int offsets[] = {0, 8, 64, 256, -1}; + + for (i = 0; offsets[i] >= 0; i++) { + ufs = (struct ufs_super_block *) + get_buffer(id, off + (offsets[i] * 0x400), 0x800); + if (ufs == NULL) + return -1; + + dbg("offset 0x%x", offsets[i] * 0x400); + magic = be32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(be)", magic); + goto found; + } + magic = le32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(le)", magic); + goto found; + } + } + return -1; + +found: + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_UFS; + id->type = "ufs"; + + return 0; +} + +static int probe_mac_partition_map(struct volume_id *id, __u64 off) +{ + struct mac_driver_desc { + __u8 signature[2]; + __u16 block_size; + __u32 block_count; + } __attribute__((__packed__)) *driver; + + struct mac_partition { + __u8 signature[2]; + __u16 res1; + __u32 map_count; + __u32 start_block; + __u32 block_count; + __u8 name[32]; + __u8 type[32]; + } __attribute__((__packed__)) *part; + + const __u8 *buf; + + buf = get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if ((strncmp(part->signature, "PM", 2) == 0) && + (strncmp(part->type, "Apple_partition_map", 19) == 0)) { + /* linux creates an own subdevice for the map + * just return the type if the drive header is missing */ + id->usage_id = VOLUME_ID_PARTITIONTABLE; + id->type_id = VOLUME_ID_MACPARTMAP; + id->type = "mac_partition_map"; + return 0; + } + + driver = (struct mac_driver_desc *) buf; + if (strncmp(driver->signature, "ER", 2) == 0) { + /* we are on a main device, like a CD + * just try to probe the first partition from the map */ + unsigned int bsize = be16_to_cpu(driver->block_size); + int part_count; + int i; + + /* get first entry of partition table */ + buf = get_buffer(id, off + bsize, 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if (strncmp(part->signature, "PM", 2) != 0) + return -1; + + part_count = be32_to_cpu(part->map_count); + dbg("expecting %d partition entries", part_count); + + if (id->partitions != NULL) + free(id->partitions); + id->partitions = + malloc(part_count * sizeof(struct volume_id_partition)); + if (id->partitions == NULL) + return -1; + memset(id->partitions, 0x00, sizeof(struct volume_id_partition)); + + id->partition_count = part_count; + + for (i = 0; i < part_count; i++) { + __u64 poff; + __u64 plen; + + buf = get_buffer(id, off + ((i+1) * bsize), 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if (strncmp(part->signature, "PM", 2) != 0) + return -1; + + poff = be32_to_cpu(part->start_block) * bsize; + plen = be32_to_cpu(part->block_count) * bsize; + dbg("found '%s' partition entry at 0x%llx, len 0x%llx", + part->type, poff, plen); + + id->partitions[i].off = poff; + id->partitions[i].len = plen; + + if (strncmp(part->type, "Apple_Free", 10) == 0) { + id->partitions[i].usage_id = VOLUME_ID_UNUSED; + } else if (strncmp(part->type, "Apple_partition_map", 19) == 0) { + id->partitions[i].usage_id = VOLUME_ID_PARTITIONTABLE; + id->partitions[i].type_id = VOLUME_ID_MACPARTMAP; + } else { + id->partitions[i].usage_id = VOLUME_ID_UNPROBED; + } + } + id->usage_id = VOLUME_ID_PARTITIONTABLE; + id->type_id = VOLUME_ID_MACPARTMAP; + id->type = "mac_partition_map"; + return 0; + } + + return -1; +} + +#define HFS_SUPERBLOCK_OFFSET 0x400 +#define HFS_NODE_LEAF 0xff +#define HFSPLUS_POR_CNID 1 +static int probe_hfs_hfsplus(struct volume_id *id, __u64 off) +{ + struct finder_info { + __u32 boot_folder; + __u32 start_app; + __u32 open_folder; + __u32 os9_folder; + __u32 reserved; + __u32 osx_folder; + __u8 id[8]; + } __attribute__((__packed__)); + + struct hfs_mdb { + __u8 signature[2]; + __u32 cr_date; + __u32 ls_Mod; + __u16 atrb; + __u16 nm_fls; + __u16 vbm_st; + __u16 alloc_ptr; + __u16 nm_al_blks; + __u32 al_blk_size; + __u32 clp_size; + __u16 al_bl_st; + __u32 nxt_cnid; + __u16 free_bks; + __u8 label_len; + __u8 label[27]; + __u32 vol_bkup; + __u16 vol_seq_num; + __u32 wr_cnt; + __u32 xt_clump_size; + __u32 ct_clump_size; + __u16 num_root_dirs; + __u32 file_count; + __u32 dir_count; + struct finder_info finfo; + __u8 embed_sig[2]; + __u16 embed_startblock; + __u16 embed_blockcount; + } __attribute__((__packed__)) *hfs; + + struct hfsplus_bnode_descriptor { + __u32 next; + __u32 prev; + __u8 type; + __u8 height; + __u16 num_recs; + __u16 reserved; + } __attribute__((__packed__)); + + struct hfsplus_bheader_record { + __u16 depth; + __u32 root; + __u32 leaf_count; + __u32 leaf_head; + __u32 leaf_tail; + __u16 node_size; + } __attribute__((__packed__)); + + struct hfsplus_catalog_key { + __u16 key_len; + __u32 parent_id; + __u16 unicode_len; + __u8 unicode[255 * 2]; + } __attribute__((__packed__)); + + struct hfsplus_extent { + __u32 start_block; + __u32 block_count; + } __attribute__((__packed__)); + + struct hfsplus_fork { + __u64 total_size; + __u32 clump_size; + __u32 total_blocks; + struct hfsplus_extent extents[8]; + } __attribute__((__packed__)); + + struct hfsplus_vol_header { + __u8 signature[2]; + __u16 version; + __u32 attributes; + __u32 last_mount_vers; + __u32 reserved; + __u32 create_date; + __u32 modify_date; + __u32 backup_date; + __u32 checked_date; + __u32 file_count; + __u32 folder_count; + __u32 blocksize; + __u32 total_blocks; + __u32 free_blocks; + __u32 next_alloc; + __u32 rsrc_clump_sz; + __u32 data_clump_sz; + __u32 next_cnid; + __u32 write_count; + __u64 encodings_bmp; + struct finder_info finfo; + struct hfsplus_fork alloc_file; + struct hfsplus_fork ext_file; + struct hfsplus_fork cat_file; + struct hfsplus_fork attr_file; + struct hfsplus_fork start_file; + } __attribute__((__packed__)) *hfsplus; + + unsigned int blocksize; + unsigned int cat_block; + unsigned int cat_block_count; + unsigned int cat_off; + unsigned int cat_len; + unsigned int leaf_node_head; + unsigned int leaf_node_size; + unsigned int alloc_block_size; + unsigned int alloc_first_block; + unsigned int embed_first_block; + struct hfsplus_bnode_descriptor *descr; + struct hfsplus_bheader_record *bnode; + struct hfsplus_catalog_key *key; + unsigned int label_len; + const __u8 *buf; + + buf = get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + hfs = (struct hfs_mdb *) buf; + if (strncmp(hfs->signature, "BD", 2) != 0) + goto checkplus; + + /* it may be just a hfs wrapper for hfs+ */ + if (strncmp(hfs->embed_sig, "H+", 2) == 0) { + alloc_block_size = be32_to_cpu(hfs->al_blk_size); + dbg("alloc_block_size 0x%x", alloc_block_size); + + alloc_first_block = be16_to_cpu(hfs->al_bl_st); + dbg("alloc_first_block 0x%x", alloc_first_block); + + embed_first_block = be16_to_cpu(hfs->embed_startblock); + dbg("embed_first_block 0x%x", embed_first_block); + + off += (alloc_first_block * 512) + + (embed_first_block * alloc_block_size); + dbg("hfs wrapped hfs+ found at offset 0x%llx", off); + + buf = get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + goto checkplus; + } + + if (hfs->label_len > 0 && hfs->label_len < 28) { + set_label_raw(id, hfs->label, hfs->label_len); + set_label_string(id, hfs->label, hfs->label_len) ; + } + + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_HFS; + id->type = "hfs"; + + return 0; + +checkplus: + hfsplus = (struct hfsplus_vol_header *) buf; + if (strncmp(hfsplus->signature, "H+", 2) == 0) + goto hfsplus; + if (strncmp(hfsplus->signature, "HX", 2) == 0) + goto hfsplus; + return -1; + +hfsplus: + blocksize = be32_to_cpu(hfsplus->blocksize); + cat_block = be32_to_cpu(hfsplus->cat_file.extents[0].start_block); + cat_block_count = be32_to_cpu(hfsplus->cat_file.extents[0].block_count); + cat_off = (cat_block * blocksize); + cat_len = cat_block_count * blocksize; + dbg("catalog start 0x%llx, len 0x%x", off + cat_off, cat_len); + + buf = get_buffer(id, off + cat_off, 0x2000); + if (buf == NULL) + goto found; + + bnode = (struct hfsplus_bheader_record *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + leaf_node_head = be32_to_cpu(bnode->leaf_head); + leaf_node_size = be16_to_cpu(bnode->node_size); + + dbg("catalog leaf node 0x%x, size 0x%x", + leaf_node_head, leaf_node_size); + + buf = get_buffer(id, off + cat_off + (leaf_node_head * leaf_node_size), + leaf_node_size); + if (buf == NULL) + goto found; + + descr = (struct hfsplus_bnode_descriptor *) buf; + dbg("descriptor type 0x%x", descr->type); + if (descr->type != HFS_NODE_LEAF) + goto found; + + key = (struct hfsplus_catalog_key *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); + if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) + goto found; + + label_len = be16_to_cpu(key->unicode_len) * 2; + dbg("label unicode16 len %i", label_len); + set_label_raw(id, key->unicode, label_len); + set_label_unicode16(id, key->unicode, BE, label_len); + +found: + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_HFSPLUS; + id->type = "hfsplus"; return 0; } #define MFT_RECORD_VOLUME 3 -#define MFT_RECORD_ATTR_VOLUME_NAME 0x60u -#define MFT_RECORD_ATTR_OBJECT_ID 0x40u +#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 +#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 +#define MFT_RECORD_ATTR_OBJECT_ID 0x40 #define MFT_RECORD_ATTR_END 0xffffffffu -static int probe_ntfs(struct volume_id *id) +static int probe_ntfs(struct volume_id *id, __u64 off) { struct ntfs_super_block { __u8 jump[3]; __u8 oem_id[8]; - struct bios_param_block { - __u16 bytes_per_sector; - __u8 sectors_per_cluster; - __u16 reserved_sectors; - __u8 fats; - __u16 root_entries; - __u16 sectors; - __u8 media_type; /* 0xf8 = hard disk */ - __u16 sectors_per_fat; - __u16 sectors_per_track; - __u16 heads; - __u32 hidden_sectors; - __u32 large_sectors; - } __attribute__((__packed__)) bpb; - __u8 unused[4]; + __u16 bytes_per_sector; + __u8 sectors_per_cluster; + __u16 reserved_sectors; + __u8 fats; + __u16 root_entries; + __u16 sectors; + __u8 media_type; + __u16 sectors_per_fat; + __u16 sectors_per_track; + __u16 heads; + __u32 hidden_sectors; + __u32 large_sectors; + __u16 unused[2]; __u64 number_of_sectors; __u64 mft_cluster_location; __u64 mft_mirror_cluster_location; __s8 cluster_per_mft_record; + __u8 reserved1[3]; + __s8 cluster_per_index_record; + __u8 reserved2[3]; + __u8 volume_serial[8]; + __u16 checksum; } __attribute__((__packed__)) *ns; struct master_file_table_record { @@ -752,28 +1761,36 @@ static int probe_ntfs(struct volume_id *id) __u16 value_offset; } __attribute__((__packed__)) *attr; - unsigned int sector_size; - unsigned int cluster_size; - unsigned long mft_cluster; - unsigned long mft_off; - unsigned int mft_record_size; - unsigned int attr_type; - unsigned int attr_off; - unsigned int attr_len; - unsigned int val_off; - unsigned int val_len; + struct volume_info { + __u64 reserved; + __u8 major_ver; + __u8 minor_ver; + } __attribute__((__packed__)) *info; + + unsigned int sector_size; + unsigned int cluster_size; + __u64 mft_cluster; + __u64 mft_off; + unsigned int mft_record_size; + unsigned int attr_type; + unsigned int attr_off; + unsigned int attr_len; + unsigned int val_off; + unsigned int val_len; const __u8 *buf; const __u8 *val; - ns = (struct ntfs_super_block *) get_buffer(id, 0, 0x200); + ns = (struct ntfs_super_block *) get_buffer(id, off, 0x200); if (ns == NULL) return -1; if (strncmp(ns->oem_id, "NTFS", 4) != 0) return -1; - sector_size = le16_to_cpu(ns->bpb.bytes_per_sector); - cluster_size = ns->bpb.sectors_per_cluster * sector_size; + set_uuid(id, ns->volume_serial, 8); + + sector_size = le16_to_cpu(ns->bytes_per_sector); + cluster_size = ns->sectors_per_cluster * sector_size; mft_cluster = le64_to_cpu(ns->mft_cluster_location); mft_off = mft_cluster * cluster_size; @@ -785,22 +1802,19 @@ static int probe_ntfs(struct volume_id *id) dbg("sectorsize 0x%x", sector_size); dbg("clustersize 0x%x", cluster_size); - dbg("mftcluster %li", mft_cluster); - dbg("mftoffset 0x%lx", mft_off); + dbg("mftcluster %lli", mft_cluster); + dbg("mftoffset 0x%llx", mft_off); dbg("cluster per mft_record %i", ns->cluster_per_mft_record); dbg("mft record size %i", mft_record_size); - buf = get_buffer(id, mft_off + (MFT_RECORD_VOLUME * mft_record_size), + buf = get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), mft_record_size); if (buf == NULL) goto found; mftr = (struct master_file_table_record*) buf; - dbg("mftr->magic[0] = '%c' %03d, 0x%02x", mftr->magic[0], mftr->magic[0], mftr->magic[0]); - dbg("mftr->magic[1] = '%c' %03d, 0x%02x", mftr->magic[1], mftr->magic[1], mftr->magic[1]); - dbg("mftr->magic[2] = '%c' %03d, 0x%02x", mftr->magic[2], mftr->magic[2], mftr->magic[2]); - dbg("mftr->magic[3] = '%c' %03d, 0x%02x", mftr->magic[3], mftr->magic[3], mftr->magic[3]); + dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); if (strncmp(mftr->magic, "FILE", 4) != 0) goto found; @@ -813,6 +1827,13 @@ static int probe_ntfs(struct volume_id *id) attr_len = le16_to_cpu(attr->len); val_off = le16_to_cpu(attr->value_offset); val_len = le32_to_cpu(attr->value_len); + attr_off += attr_len; + + if (attr_len == 0) + break; + + if (attr_off >= mft_record_size) + break; if (attr_type == MFT_RECORD_ATTR_END) break; @@ -820,136 +1841,182 @@ static int probe_ntfs(struct volume_id *id) dbg("found attribute type 0x%x, len %i, at offset %i", attr_type, attr_len, attr_off); + if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { + dbg("found info, len %i", val_len); + info = (struct volume_info*) (((__u8 *) attr) + val_off); + snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, + "%u.%u", info->major_ver, info->minor_ver); + } + if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { dbg("found label, len %i", val_len); if (val_len > VOLUME_ID_LABEL_SIZE) val_len = VOLUME_ID_LABEL_SIZE; - val = &((__u8 *) attr)[val_off]; + val = ((__u8 *) attr) + val_off; set_label_raw(id, val, val_len); set_label_unicode16(id, val, LE, val_len); } - - if (attr_type == MFT_RECORD_ATTR_OBJECT_ID) { - dbg("found uuid"); - val = &((__u8 *) attr)[val_off]; - set_uuid(id, val, 16); - } - - if (attr_len == 0) - break; - attr_off += attr_len; - if (attr_off >= mft_record_size) - break; } found: - id->fs_type = NTFS; - id->fs_name = "ntfs"; + id->usage_id = VOLUME_ID_FILESYSTEM; + id->type_id = VOLUME_ID_NTFS; + id->type = "ntfs"; return 0; } #define LARGEST_PAGESIZE 0x4000 -static int probe_swap(struct volume_id *id) +static int probe_swap(struct volume_id *id, __u64 off) { const __u8 *sig; unsigned int page; /* huhh, the swap signature is on the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { - sig = get_buffer(id, page-10, 10); + sig = get_buffer(id, off + page-10, 10); if (sig == NULL) return -1; - if (strncmp(sig, "SWAP-SPACE", 10) == 0) + if (strncmp(sig, "SWAP-SPACE", 10) == 0) { + strcpy(id->type_version, "1"); goto found; - if (strncmp(sig, "SWAPSPACE2", 10) == 0) + } + if (strncmp(sig, "SWAPSPACE2", 10) == 0) { + strcpy(id->type_version, "2"); goto found; + } } return -1; found: - id->fs_type = SWAP; - id->fs_name = "swap"; + id->usage_id = VOLUME_ID_OTHER; + id->type_id = VOLUME_ID_SWAP; + id->type = "swap"; return 0; } /* probe volume for filesystem type and try to read label+uuid */ -int volume_id_probe(struct volume_id *id, enum filesystem_type fs_type) +int volume_id_probe(struct volume_id *id, + enum volume_id_type type, + unsigned long long off, + unsigned long long size) { int rc; if (id == NULL) return -EINVAL; - switch (fs_type) { - case EXT3: - case EXT2: - rc = probe_ext(id); + switch (type) { + case VOLUME_ID_MSDOSPARTTABLE: + rc = probe_msdos_part_table(id, off); + break; + case VOLUME_ID_EXT3: + case VOLUME_ID_EXT2: + rc = probe_ext(id, off); + break; + case VOLUME_ID_REISERFS: + rc = probe_reiserfs(id, off); + break; + case VOLUME_ID_XFS: + rc = probe_xfs(id, off); + break; + case VOLUME_ID_JFS: + rc = probe_jfs(id, off); + break; + case VOLUME_ID_VFAT: + rc = probe_vfat(id, off); break; - case REISER: - rc = probe_reiser(id); + case VOLUME_ID_UDF: + rc = probe_udf(id, off); break; - case XFS: - rc = probe_xfs(id); + case VOLUME_ID_ISO9660: + rc = probe_iso9660(id, off); break; - case JFS: - rc = probe_jfs(id); + case VOLUME_ID_MACPARTMAP: + rc = probe_mac_partition_map(id, off); break; - case MSDOS: - rc = probe_msdos(id); + case VOLUME_ID_HFS: + case VOLUME_ID_HFSPLUS: + rc = probe_hfs_hfsplus(id, off); break; - case VFAT: - rc = probe_vfat(id); + case VOLUME_ID_UFS: + rc = probe_ufs(id, off); break; - case UDF: - rc = probe_udf(id); + case VOLUME_ID_NTFS: + rc = probe_ntfs(id, off); break; - case ISO9660: - rc = probe_iso9660(id); + case VOLUME_ID_SWAP: + rc = probe_swap(id, off); break; - case NTFS: - rc = probe_ntfs(id); + case VOLUME_ID_LINUX_RAID: + rc = probe_linux_raid(id, off, size); break; - case SWAP: - rc = probe_swap(id); + case VOLUME_ID_LVM1: + rc = probe_lvm1(id, off); break; - case ALL: + case VOLUME_ID_LVM2: + rc = probe_lvm2(id, off); + break; + case VOLUME_ID_ALL: default: + rc = probe_linux_raid(id, off, size); + if (rc == 0) + break; + + /* signature in the first block */ + rc = probe_ntfs(id, off); + if (rc == 0) + break; + rc = probe_vfat(id, off); + if (rc == 0) + break; + rc = probe_msdos_part_table(id, off); + if (rc == 0) + break; + rc = probe_mac_partition_map(id, off); + if (rc == 0) + break; + rc = probe_xfs(id, off); + if (rc == 0) + break; + /* fill buffer with maximum */ get_buffer(id, 0, SB_BUFFER_SIZE); - rc = probe_ext(id); + + rc = probe_swap(id, off); if (rc == 0) break; - rc = probe_reiser(id); + rc = probe_ext(id, off); if (rc == 0) break; - rc = probe_xfs(id); + rc = probe_reiserfs(id, off); if (rc == 0) break; - rc = probe_jfs(id); + rc = probe_jfs(id, off); if (rc == 0) break; - rc = probe_msdos(id); + rc = probe_udf(id, off); if (rc == 0) break; - rc = probe_vfat(id); + rc = probe_iso9660(id, off); if (rc == 0) break; - rc = probe_udf(id); + rc = probe_hfs_hfsplus(id, off); if (rc == 0) break; - rc = probe_iso9660(id); + rc = probe_ufs(id, off); if (rc == 0) break; - rc = probe_ntfs(id); + rc = probe_lvm1(id, off); if (rc == 0) break; - rc = probe_swap(id); + rc = probe_lvm2(id, off); if (rc == 0) break; + rc = -1; } @@ -982,9 +2049,11 @@ struct volume_id *volume_id_open_node(const char *path) struct volume_id *id; int fd; - fd = open(path, O_RDONLY); - if (fd < 0) + fd = open(path, O_RDONLY | O_NONBLOCK); + if (fd < 0) { + dbg("unable to open '%s'", path); return NULL; + } id = volume_id_open_fd(fd); if (id == NULL) @@ -1029,5 +2098,8 @@ void volume_id_close(struct volume_id *id) free_buffer(id); + if (id->partitions != NULL) + free(id->partitions); + free(id); } diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h index a939743dc1..eb90390617 100644 --- a/extras/volume_id/volume_id.h +++ b/extras/volume_id/volume_id.h @@ -21,42 +21,72 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 004 +#define VOLUME_ID_VERSION 022 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 #define VOLUME_ID_UUID_STRING_SIZE 37 -#define VOLUME_ID_PATH_MAX 255 +#define VOLUME_ID_FORMAT_SIZE 32 +#define VOLUME_ID_PATH_MAX 256 +#define VOLUME_ID_PARTITIONS_MAX 16 +enum volume_id_usage { + VOLUME_ID_UNUSED, + VOLUME_ID_UNPROBED, + VOLUME_ID_OTHER, + VOLUME_ID_FILESYSTEM, + VOLUME_ID_PARTITIONTABLE, + VOLUME_ID_RAID +}; + +enum volume_id_type { + VOLUME_ID_ALL, + VOLUME_ID_MSDOSPARTTABLE, + VOLUME_ID_MSDOSEXTENDED, + VOLUME_ID_SWAP, + VOLUME_ID_EXT2, + VOLUME_ID_EXT3, + VOLUME_ID_REISERFS, + VOLUME_ID_XFS, + VOLUME_ID_JFS, + VOLUME_ID_VFAT, + VOLUME_ID_UDF, + VOLUME_ID_ISO9660, + VOLUME_ID_NTFS, + VOLUME_ID_MACPARTMAP, + VOLUME_ID_HFS, + VOLUME_ID_HFSPLUS, + VOLUME_ID_UFS, + VOLUME_ID_LINUX_RAID, + VOLUME_ID_LVM1, + VOLUME_ID_LVM2 +}; -enum filesystem_type { - ALL, - EXT2, - EXT3, - REISER, - XFS, - JFS, - MSDOS, - VFAT, - UDF, - ISO9660, - NTFS, - SWAP +struct volume_id_partition { + enum volume_id_usage usage_id; + enum volume_id_type type_id; + char *type; + unsigned long long off; + unsigned long long len; }; struct volume_id { unsigned char label_raw[VOLUME_ID_LABEL_SIZE]; unsigned int label_raw_len; - char label_string[VOLUME_ID_LABEL_SIZE+1]; - unsigned char uuid[VOLUME_ID_UUID_SIZE]; - char uuid_string[VOLUME_ID_UUID_STRING_SIZE]; - enum filesystem_type fs_type; - char *fs_name; + char label[VOLUME_ID_LABEL_SIZE+1]; + unsigned char uuid_raw[VOLUME_ID_UUID_SIZE]; + char uuid[VOLUME_ID_UUID_STRING_SIZE]; + enum volume_id_usage usage_id; + enum volume_id_type type_id; + char *type; + char type_version[VOLUME_ID_FORMAT_SIZE]; + struct volume_id_partition *partitions; + unsigned int partition_count; int fd; unsigned char *sbbuf; unsigned int sbbuf_len; unsigned char *seekbuf; - unsigned int seekbuf_off; + unsigned long long seekbuf_off; unsigned int seekbuf_len; int fd_close; }; @@ -71,7 +101,8 @@ extern struct volume_id *volume_id_open_node(const char *path); extern struct volume_id *volume_id_open_dev_t(dev_t devt); /* probe volume for filesystem type and try to read label/uuid */ -extern int volume_id_probe(struct volume_id *id, enum filesystem_type fs_type); +extern int volume_id_probe(struct volume_id *id, enum volume_id_type type, + unsigned long long off, unsigned long long size); /* free allocated device info */ extern void volume_id_close(struct volume_id *id); -- cgit v1.2.3-54-g00ecf From bdde56de3993d8793b9af853f389f26f19541292 Mon Sep 17 00:00:00 2001 From: "olh@suse.de" Date: Tue, 7 Sep 2004 00:55:07 -0700 Subject: [PATCH] udevsend depends on udev_lib.o make -j doesnt work with current udev. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5083bed7f5..2f1f71090d 100644 --- a/Makefile +++ b/Makefile @@ -277,7 +277,7 @@ $(DAEMON): $(DAEMON).o $(OBJS) udevd.h $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o udev_lib.o $(KLIBC_FIXUP) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(SENDER): $(SENDER).o udevd.h $(LIBC) +$(SENDER): $(SENDER).o $(OBJS) udevd.h $(LIBC) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -- cgit v1.2.3-54-g00ecf From 3e4414508b409a21b023b9ca4532f62003e0db97 Mon Sep 17 00:00:00 2001 From: "arun@codemovers.org" Date: Fri, 10 Sep 2004 20:54:04 -0700 Subject: [PATCH] udev - read long lines from config files overflow fix Hi Kay, On 23:12 Sat 04 Sep , Kay Sievers wrote: > Cool, a real bug :) > Thanks, for the patch. I think it would be better to skip lenghth exceeding > lines instead of cutting it and continue. While looking at it I restructured > the buffer reading logic a bit and fixed another stupid bug. Thanks for the cleanup. You may have overlooked the fix for udev_config.c(parsing udev.conf) in your patch. So, I've adapted the fixes you applied to namedev_parse.c to this file also. Also, while 'eating' the whitespace the 'count' doesn't get decremented. This leads strncpy to copy the number of whitespace minus 1 characters from the next line. Minus 1 because it copies '\n' from the current line. while (isspace(bufline[0])) { bufline++; + count--; } . . . strncpy(line, bufline, count); Included patch(against udev-030) contains the above fixes as well as your fixes. Signed-off-by: Arun Bhanu --- klibc_fixups.c | 17 ++++---- namedev_parse.c | 118 +++++++++++++++++++++++++++++++++++--------------------- udev.h | 2 + udev_config.c | 40 +++++++++++-------- 4 files changed, 109 insertions(+), 68 deletions(-) diff --git a/klibc_fixups.c b/klibc_fixups.c index bbacfbdc75..d1a452a449 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -41,8 +41,9 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) { unsigned long id = -1; - char line[255]; + char line[LINE_SIZE]; char *buf; + char *bufline; size_t bufsize; size_t cur; size_t count; @@ -59,19 +60,19 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) } /* loop through the whole file */ - cur = 0; - while (1) { + while (cur < bufsize) { count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + + if (count >= LINE_SIZE) + continue; - strncpy(line, buf + cur, count); + strncpy(line, bufline, count); line[count] = '\0'; pos = line; - cur += count+1; - if (cur > bufsize) - break; - /* get name */ name = strsep(&pos, ":"); if (name == NULL) diff --git a/namedev_parse.c b/namedev_parse.c index 679efae1b5..4bb1a97ce9 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -58,7 +58,7 @@ void dump_config_dev(struct config_device *dev) { dbg_parse("name='%s', symlink='%s', bus='%s', place='%s', id='%s', " "sysfs_file[0]='%s', sysfs_value[0]='%s', " - "kernel='%s', program='%s', result='%s'", + "kernel='%s', program='%s', result='%s'" "owner='%s', group='%s', mode=%#o", dev->name, dev->symlink, dev->bus, dev->place, dev->id, dev->sysfs_pair[0].file, dev->sysfs_pair[0].value, @@ -144,7 +144,8 @@ static char *get_key_attribute(char *str) static int namedev_parse_rules(char *filename) { - char line[255]; + char line[LINE_SIZE]; + char *bufline; int lineno; char *temp; char *temp2; @@ -155,6 +156,7 @@ static int namedev_parse_rules(char *filename) size_t cur; size_t count; int program_given = 0; + int valid; int retval = 0; struct config_device dev; @@ -168,35 +170,41 @@ static int namedev_parse_rules(char *filename) /* loop through the whole file */ cur = 0; lineno = 0; - while (1) { + while (cur < bufsize) { count = buf_get_line(buf, bufsize, cur); - - strncpy(line, buf + cur, count); - line[count] = '\0'; - temp = line; - lineno++; - + bufline = &buf[cur]; cur += count+1; - if (cur > bufsize) - break; - - dbg_parse("read '%s'", temp); + lineno++; - /* eat the whitespace */ - while (isspace(*temp)) - ++temp; + if (count >= LINE_SIZE) { + info("line too long, rule skipped %s, line %d", + filename, lineno); + continue; + } /* empty line? */ - if ((*temp == '\0') || (*temp == '\n')) + if (bufline[0] == '\0' || bufline[0] == '\n') continue; + /* eat the whitespace */ + while (isspace(bufline[0])) { + bufline++; + count--; + } + /* see if this is a comment */ - if (*temp == COMMENT_CHARACTER) + if (bufline[0] == COMMENT_CHARACTER) continue; - memset(&dev, 0x00, sizeof(struct config_device)); + strncpy(line, bufline, count); + line[count] = '\0'; + dbg_parse("read '%s'", line); /* get all known keys */ + memset(&dev, 0x00, sizeof(struct config_device)); + temp = line; + valid = 0; + while (1) { retval = parse_get_pair(&temp, &temp2, &temp3); if (retval) @@ -204,16 +212,19 @@ static int namedev_parse_rules(char *filename) if (strcasecmp(temp2, FIELD_BUS) == 0) { strfieldcpy(dev.bus, temp3); + valid = 1; continue; } if (strcasecmp(temp2, FIELD_ID) == 0) { strfieldcpy(dev.id, temp3); + valid = 1; continue; } if (strcasecmp(temp2, FIELD_PLACE) == 0) { strfieldcpy(dev.place, temp3); + valid = 1; continue; } @@ -238,54 +249,62 @@ static int namedev_parse_rules(char *filename) } strfieldcpy(pair->file, attr); strfieldcpy(pair->value, temp3); + valid = 1; } continue; } if (strcasecmp(temp2, FIELD_KERNEL) == 0) { strfieldcpy(dev.kernel, temp3); + valid = 1; continue; } if (strcasecmp(temp2, FIELD_PROGRAM) == 0) { program_given = 1; strfieldcpy(dev.program, temp3); + valid = 1; continue; } if (strcasecmp(temp2, FIELD_RESULT) == 0) { strfieldcpy(dev.result, temp3); + valid = 1; continue; } if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) { attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1); - if (attr != NULL) - if (strcasecmp(attr, ATTR_PARTITIONS) == 0) { + if (attr != NULL && strcasecmp(attr, ATTR_PARTITIONS) == 0) { dbg_parse("creation of partition nodes requested"); dev.partitions = PARTITIONS_COUNT; } strfieldcpy(dev.name, temp3); + valid = 1; continue; } if (strcasecmp(temp2, FIELD_SYMLINK) == 0) { strfieldcpy(dev.symlink, temp3); + valid = 1; continue; } if (strcasecmp(temp2, FIELD_OWNER) == 0) { strfieldcpy(dev.owner, temp3); + valid = 1; continue; } if (strcasecmp(temp2, FIELD_GROUP) == 0) { strfieldcpy(dev.group, temp3); + valid = 1; continue; } if (strcasecmp(temp2, FIELD_MODE) == 0) { dev.mode = strtol(temp3, NULL, 8); + valid = 1; continue; } @@ -293,16 +312,20 @@ static int namedev_parse_rules(char *filename) goto error; } + /* skip line if not any valid key was found */ + if (!valid) + goto error; + /* simple plausibility checks for given keys */ if ((dev.sysfs_pair[0].file[0] == '\0') ^ (dev.sysfs_pair[0].value[0] == '\0')) { - dbg("inconsistency in " FIELD_SYSFS " key"); + info("inconsistency in " FIELD_SYSFS " key"); goto error; } if ((dev.result[0] != '\0') && (program_given == 0)) { - dbg(FIELD_RESULT " is only useful when " - FIELD_PROGRAM " is called in any rule before"); + info(FIELD_RESULT " is only useful when " + FIELD_PROGRAM " is called in any rule before"); goto error; } @@ -313,8 +336,8 @@ static int namedev_parse_rules(char *filename) dbg("add_config_dev returned with error %d", retval); continue; error: - dbg("%s:%d:%d: parse error, rule skipped", - filename, lineno, temp - line); + info("parse error %s, line %d:%d, rule skipped", + filename, lineno, temp - line); } } @@ -324,7 +347,8 @@ error: static int namedev_parse_permissions(char *filename) { - char line[255]; + char line[LINE_SIZE]; + char *bufline; char *temp; char *temp2; char *buf; @@ -333,6 +357,7 @@ static int namedev_parse_permissions(char *filename) size_t count; int retval = 0; struct perm_device dev; + int lineno; if (file_map(filename, &buf, &bufsize) == 0) { dbg("reading '%s' as permissions file", filename); @@ -343,34 +368,41 @@ static int namedev_parse_permissions(char *filename) /* loop through the whole file */ cur = 0; - while (1) { + lineno = 0; + while (cur < bufsize) { count = buf_get_line(buf, bufsize, cur); - - strncpy(line, buf + cur, count); - line[count] = '\0'; - temp = line; - + bufline = &buf[cur]; cur += count+1; - if (cur > bufsize) - break; - - dbg_parse("read '%s'", temp); + lineno++; - /* eat the whitespace at the beginning of the line */ - while (isspace(*temp)) - ++temp; + if (count >= LINE_SIZE) { + info("line too long, rule skipped %s, line %d", + filename, lineno); + continue; + } /* empty line? */ - if ((*temp == '\0') || (*temp == '\n')) + if (bufline[0] == '\0' || bufline[0] == '\n') continue; + /* eat the whitespace */ + while (isspace(bufline[0])) { + bufline++; + count--; + } + /* see if this is a comment */ - if (*temp == COMMENT_CHARACTER) + if (bufline[0] == COMMENT_CHARACTER) continue; - memset(&dev, 0x00, sizeof(dev)); + strncpy(line, bufline, count); + line[count] = '\0'; + dbg_parse("read '%s'", line); /* parse the line */ + memset(&dev, 0x00, sizeof(struct perm_device)); + temp = line; + temp2 = strsep(&temp, ":"); if (!temp2) { dbg("cannot parse line '%s'", line); diff --git a/udev.h b/udev.h index 717c1218eb..7c5d18a3d0 100644 --- a/udev.h +++ b/udev.h @@ -38,6 +38,8 @@ #define SUBSYSTEM_SIZE 32 #define SEQNUM_SIZE 32 +#define LINE_SIZE 256 + /* length of public data */ #define UDEVICE_LEN (offsetof(struct udevice, bus_id)) diff --git a/udev_config.c b/udev_config.c index 19f690c7e8..20b6c75d32 100644 --- a/udev_config.c +++ b/udev_config.c @@ -127,7 +127,8 @@ int parse_get_pair(char **orig_string, char **left, char **right) static int parse_config_file(void) { - char line[255]; + char line[LINE_SIZE]; + char *bufline; char *temp; char *variable; char *value; @@ -148,32 +149,37 @@ static int parse_config_file(void) /* loop through the whole file */ lineno = 0; cur = 0; - while (1) { + while (cur < bufsize) { count = buf_get_line(buf, bufsize, cur); - - strncpy(line, buf + cur, count); - line[count] = '\0'; - temp = line; - lineno++; - + bufline = &buf[cur]; cur += count+1; - if (cur > bufsize) - break; - - dbg_parse("read '%s'", temp); + lineno++; - /* eat the whitespace at the beginning of the line */ - while (isspace(*temp)) - ++temp; + if (count >= LINE_SIZE) { + info("line too long, conf line skipped %s, line %d", + udev_config_filename, lineno); + continue; + } /* empty line? */ - if (*temp == 0x00) + if (bufline[0] == '\0' || bufline[0] == '\n') continue; + /* eat the whitespace */ + while (isspace(bufline[0])) { + bufline++; + count--; + } + /* see if this is a comment */ - if (*temp == COMMENT_CHARACTER) + if (bufline[0] == COMMENT_CHARACTER) continue; + strncpy(line, bufline, count); + line[count] = '\0'; + temp = line; + dbg_parse("read '%s'", temp); + retval = parse_get_pair(&temp, &variable, &value); if (retval != 0) info("%s:%d:%Zd: error parsing '%s'", -- cgit v1.2.3-54-g00ecf From 0a8dd7f37c6f788c74aa528949c45aca66638e5a Mon Sep 17 00:00:00 2001 From: "david@fubar.dk" Date: Fri, 10 Sep 2004 21:04:13 -0700 Subject: [PATCH] compatibility symlinks for udev On Mon, 2004-09-06 at 17:45 +0200, Kay Sievers wrote: > On Mon, 2004-09-06 at 16:46 +0200, David Zeuthen wrote: > > Nice, I like it. It's a easy way to group device nodes of the same type, > but coming from different kernel subsystems. > That's a good way of putting it, yeah. > > Here's a patch against udev-030 that can help create compatibility > > symlinks like /dev/cdrom, /dev/cdrom1 etc. The patch introduces a new > > substitution type %C (for Compatibility) that can be used as follows > > I suggest using %e for enumeration here, cause "compatibility" can > easily be misunderstood. > Good point, I've changed that. > And we need a few lines added to the man page at udev.8.in :) > Done. I've also added an example. Also, Kay pointed out offlist that the rules can be written to not require a shell script; this actually works KERNEL="sr*", NAME="%k", SYMLINK="cdrom%e" KERNEL="scd*", NAME="%k", SYMLINK="cdrom%e" KERNEL="pcd*", NAME="%k", SYMLINK="cdrom%e" KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="\%k", SYMLINK="cdrom%e" KERNEL="fd[0-9]", NAME="%k", SYMLINK="floppy%e" KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy", NAME=\"%k", SYMLINK="floppy%e" New patch is attached. David --- namedev.c | 40 ++++++++++++++++++++++++++++++++++++++++ udev.8.in | 15 +++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/namedev.c b/namedev.c index 52417e3793..466016c297 100644 --- a/namedev.c +++ b/namedev.c @@ -42,6 +42,7 @@ #include "logging.h" #include "namedev.h" #include "klibc_fixups.h" +#include "udevdb.h" static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr); @@ -179,6 +180,37 @@ static int get_format_len(char **str) return -1; } +/** Finds the lowest positive N such that N isn't present in + * $(udevroot) either as a file or a symlink. + * + * @param name Name to check for + * @return 0 if didn't exist and N otherwise. + */ +static unsigned int find_free_number (struct udevice *udev, char *name) +{ + char temp[NAME_SIZE]; + char path[NAME_SIZE]; + struct udevice dev; + int result; + + /* have to sweep the database for each lookup */ + result = 0; + strncpy(temp, name, sizeof (temp)); + while (1) { + if (udevdb_get_dev_byname(temp, path, &dev) != 0) + goto found; + /* symlink might be stale if $(udevroot) isn't cleaned; check + * on major/minor to see if it's the same device + */ + if (dev.major == udev->major && dev.minor == udev->minor) + goto found; + snprintf (temp, sizeof(temp), "%s%d", name, ++result); + } + +found: + return result; +} + static void apply_format(struct udevice *udev, char *string, size_t maxsize, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) @@ -195,6 +227,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, char *rest; int slen; struct sysfs_attribute *tmpattr; + unsigned int next_free_number; pos = string; while (1) { @@ -284,6 +317,13 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, strfieldcatmax(string, "%", maxsize); pos++; break; + case 'e': + next_free_number = find_free_number(udev, string); + if (next_free_number > 0) { + snprintf(temp2, sizeof(temp2), "%d", next_free_number); + strfieldcatmax(string, temp2, maxsize); + } + break; default: dbg("unknown substitution type '%%%c'", c); break; diff --git a/udev.8.in b/udev.8.in index 6d1dfd9d18..9c22f8aa63 100644 --- a/udev.8.in +++ b/udev.8.in @@ -272,6 +272,13 @@ all remaining parts of the result string are substituted: .BI %s{ filename } The content of a sysfs attribute. .TP +.B %e +If a device node already exists with the name, the smallest positive +decimal integer N is substituted such that the resulting name doesn't +match an existing device node. Otherwise nothing is substituted. This +can be used to create compatibility symlinks and enumerate devices of +the same type originating from different kernel subsystems. +.TP .B %% The '%' character itself. .P @@ -302,6 +309,14 @@ KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" # multiple USB webcams with symlinks to be called webcam0, webcam1, ... BUS="usb", SYSFS{model}="XV3", NAME="video%n", SYMLINK="webcam%n" + +# grouping of optical drives from multiple kernel subsystems +KERNEL="sr*", NAME="%k", SYMLINK="cdrom%e" +KERNEL="scd*", NAME="%k", SYMLINK="cdrom%e" +KERNEL="pcd*", NAME="%k", SYMLINK="cdrom%e" +KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", + NAME="%k", SYMLINK="cdrom%e" + .fi .P The permissions and ownership of the created device file is read from -- cgit v1.2.3-54-g00ecf From aee380b6d8f849c21a5cc54e5d8f2a43fb88b2f2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 10 Sep 2004 21:09:25 -0700 Subject: [PATCH] Fix naming ethernet devices in udevstart On Tue, Sep 07, 2004 at 12:46:43PM +0200, Kay Sievers wrote: > On Mon, 2004-09-06 at 20:18 -0700, Tom Rini wrote: > > I noticed somewhat recently that my enet devices weren't being renamed > > on boot anymore. I don't quite know when this got broken (or rather, if > > it was supposed to be working. I swear it worked for me once..), but > > the following seems to do it. > > I think it never worked in the udevstart case. It worked only with the > hotplug-event-udev, I expect. > > > In udev_scan_class(), look for not just > > %s/%s/dev (which everything with a dev node has), but %s/%s/dev* (both > > of my enet devices, sis900 & 3c59x only have device) and if that > > exists, pass this along to udev. > > Yeah, network devices don't have a devnode and therefore no "dev", but > they are all in /sys/class/net/. We may just test if we are there > instead of the "device" match. How about something like this. It adds all the net devices without looking at the attributes and keeps the remaining logic like it is. It also removes certain levels of indirection and much simplifies the udevstart process. We surely don't need to open and close the udevdb for every node while iterating over the list. (We are about 5% faster on my box) It's not well tested, so it would be nice if someone can have a look at it, before a broken udevstart renders any system unbootable. --- udev.c | 164 ++++++++++++++++++++++++++++-------------------------------- udev.h | 3 ++ udevstart.c | 24 ++++----- udevtest.c | 2 +- 4 files changed, 92 insertions(+), 101 deletions(-) diff --git a/udev.c b/udev.c index 90c34d800a..114ca0a52b 100644 --- a/udev.c +++ b/udev.c @@ -40,9 +40,6 @@ char **main_argv; char **main_envp; -/* local variables */ -static int is_udevstart; - #ifdef LOG unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) @@ -79,36 +76,72 @@ static char *subsystem_blacklist[] = { "" }; -int __udev_hotplug(char *action, const char *devpath, const char *subsystem) +int main(int argc, char *argv[], char *envp[]) { - int retval = -EINVAL; - int i; + main_argv = argv; + main_envp = envp; struct sigaction act; - const int nofake = 0; + char *action; + char *devpath = ""; + char *subsystem = ""; + int i; + int retval = -EINVAL; + enum { + ADD, + REMOVE, + UDEVSTART, + } act_type; - dbg("looking at '%s'", devpath); + dbg("version %s", UDEV_VERSION); - /* we only care about class devices and block stuff */ - if (!strstr(devpath, "class") && - !strstr(devpath, "block")) { - dbg("not a block or class device"); - goto exit; - } + /* initialize our configuration */ + udev_init_config(); - i = 0; - while (subsystem_blacklist[i][0] != '\0') { - if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { - dbg("don't care about '%s' devices", subsystem); + if (strstr(argv[0], "udevstart")) { + act_type = UDEVSTART; + } else { + action = get_action(); + if (!action) { + dbg("no action?"); + goto exit; + } + if (strcmp(action, "add") == 0) { + act_type = ADD; + } else if (strcmp(action, "remove") == 0) { + act_type = REMOVE; + } else { + dbg("unknown action '%s'", action); goto exit; } - i++; - } - /* initialize udev database */ - retval = udevdb_init(UDEVDB_DEFAULT); - if (retval != 0) { - dbg("unable to initialize database"); - goto exit; + devpath = get_devpath(); + if (!devpath) { + dbg("no devpath?"); + goto exit; + } + dbg("looking at '%s'", devpath); + + /* we only care about class devices and block stuff */ + if (strstr(devpath, "class") && strstr(devpath, "block")) { + dbg("not a block or class device"); + goto exit; + } + + subsystem = get_subsystem(main_argv[1]); + if (!subsystem) { + dbg("no subsystem?"); + goto exit; + } + + /* skip blacklisted subsystems */ + i = 0; + while (subsystem_blacklist[i][0] != '\0') { + if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { + dbg("don't care about '%s' devices", subsystem); + goto exit; + } + i++; + } } /* set signal handlers */ @@ -118,76 +151,31 @@ int __udev_hotplug(char *action, const char *devpath, const char *subsystem) sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); - if (strcmp(action, "add") == 0) { - /* Already done. */ - if (!is_udevstart) - namedev_init(); - retval = udev_add_device(devpath, subsystem, nofake); - goto action_done; + /* initialize udev database */ + if (udevdb_init(UDEVDB_DEFAULT) != 0) { + dbg("unable to initialize database"); + goto exit; } - if (strcmp(action, "remove") == 0) { + switch(act_type) { + case UDEVSTART: + dbg("udevstart"); + namedev_init(); + udev_sleep = 0; + retval = udev_start(); + break; + case ADD: + dbg("udev add"); + namedev_init(); + retval = udev_add_device(devpath, subsystem, NOFAKE); + break; + case REMOVE: + dbg("udev remove"); retval = udev_remove_device(devpath, subsystem); - goto action_done; } - dbg("unknown action '%s'", action); - retval = -EINVAL; - -action_done: udevdb_exit(); exit: return retval; } - -static int udev_hotplug(void) -{ - char *action; - char *devpath; - char *subsystem; - - action = get_action(); - if (!action) { - dbg("no action?"); - return -EINVAL; - } - - devpath = get_devpath(); - if (!devpath) { - dbg("no devpath?"); - return -EINVAL; - } - - /* skip blacklisted subsystems */ - subsystem = get_subsystem(main_argv[1]); - if (!subsystem) { - dbg("no subsystem?"); - return -EINVAL; - } - - return __udev_hotplug(action, devpath, subsystem); -} - -int main(int argc, char *argv[], char *envp[]) -{ - main_argv = argv; - main_envp = envp; - - if (strstr(argv[0], "udevstart")) { - /* Setup env variables. */ - setenv("UDEV_NO_SLEEP", "1", 1); - is_udevstart = 1; - } - - /* initialize our configuration */ - udev_init_config(); - - dbg("version %s", UDEV_VERSION); - - if (is_udevstart) { - namedev_init(); - return udev_start(); - } else - return udev_hotplug(); -} diff --git a/udev.h b/udev.h index 7c5d18a3d0..d049fc1fd0 100644 --- a/udev.h +++ b/udev.h @@ -40,6 +40,9 @@ #define LINE_SIZE 256 +#define FAKE 1 +#define NOFAKE 0 + /* length of public data */ #define UDEVICE_LEN (offsetof(struct udevice, bus_id)) diff --git a/udevstart.c b/udevstart.c index 2d5553e955..cb1c78888c 100644 --- a/udevstart.c +++ b/udevstart.c @@ -70,18 +70,10 @@ static int device_list_insert(char *path, char *subsystem, struct list_head *dev strfieldcpy(new_device->path, path); strfieldcpy(new_device->subsys, subsystem); list_add_tail(&new_device->list, &loop_device->list); + dbg("add '%s' from subsys '%s'", new_device->path, new_device->subsys); return 0; } -static void udev_exec(const char *path, const char* subsystem) -{ - /* Now call __udev_hotplug(). */ - if (__udev_hotplug("add", path, subsystem)) { - dbg("Calling of udev_hotplug failed"); - exit(1); - } -} - /* list of devices that we should run last due to any one of a number of reasons */ static char *last_list[] = { "/block/dm", /* on here because dm wants to have the block devices around before it */ @@ -106,14 +98,14 @@ static void exec_list(struct list_head *device_list) if (found) continue; - udev_exec(loop_device->path, loop_device->subsys); + udev_add_device(loop_device->path, loop_device->subsys, NOFAKE); list_del(&loop_device->list); free(loop_device); } /* handle the rest of the devices left over, if any */ list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - udev_exec(loop_device->path, loop_device->subsys); + udev_add_device(loop_device->path, loop_device->subsys, NOFAKE); list_del(&loop_device->list); free(loop_device); } @@ -209,19 +201,27 @@ static void udev_scan_class(void) (strcmp(dent2->d_name, "..") == 0)) continue; + /* pass the net class as it is */ + if (strcmp(dent->d_name, "net") == 0) { + snprintf(dirname2, MAX_PATHLEN, "/class/net/%s", dent2->d_name); + device_list_insert(dirname2, "net", &device_list); + continue; + } + snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); dirname2[MAX_PATHLEN-1] = '\0'; - dir3 = opendir(dirname2); if (dir3 != NULL) { for (dent3 = readdir(dir3); dent3 != NULL; dent3 = readdir(dir3)) { char filename[MAX_PATHLEN]; + /* pass devices with a "dev" file */ if (strcmp(dent3->d_name, "dev") == 0) { snprintf(filename, MAX_PATHLEN, "/class/%s/%s", dent->d_name, dent2->d_name); filename[MAX_PATHLEN-1] = '\0'; device_list_insert(filename, dent->d_name, &device_list); + break; } } closedir(dir3); diff --git a/udevtest.c b/udevtest.c index 36f223e1e5..f24c7e4ba5 100644 --- a/udevtest.c +++ b/udevtest.c @@ -102,7 +102,7 @@ int main(int argc, char *argv[], char *envp[]) subsystem = argv[2]; /* simulate node creation with fake flag */ - udev_add_device(devpath, subsystem, fake); + udev_add_device(devpath, subsystem, FAKE); exit: return 0; -- cgit v1.2.3-54-g00ecf From 41bc97a0aded14db263b60f7902cc482c28fcfd9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 10 Sep 2004 21:13:18 -0700 Subject: [PATCH] fix compiler warning in udevtest.c --- udevtest.c | 1 - 1 file changed, 1 deletion(-) diff --git a/udevtest.c b/udevtest.c index f24c7e4ba5..df882d2d8c 100644 --- a/udevtest.c +++ b/udevtest.c @@ -58,7 +58,6 @@ int main(int argc, char *argv[], char *envp[]) char *devpath; char temp[NAME_SIZE]; char *subsystem = ""; - const int fake = 1; main_argv = argv; main_envp = envp; -- cgit v1.2.3-54-g00ecf From 70f630f64b4fd86af12ecb882c25ca8bce76b90c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 10 Sep 2004 21:44:15 -0700 Subject: [PATCH] add a "first" list to udevstart and make it contain the class/mem/ devices Seems some programs really want /dev/null to work properly :) --- udevstart.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/udevstart.c b/udevstart.c index cb1c78888c..9c1d69503d 100644 --- a/udevstart.c +++ b/udevstart.c @@ -80,15 +80,33 @@ static char *last_list[] = { NULL, }; +/* list of devices that we should run first due to any one of a number of reasons */ +static char *first_list[] = { + "/class/mem", /* people tend to like their memory devices around first... */ + NULL, +}; + static void exec_list(struct list_head *device_list) { struct device *loop_device; struct device *tmp_device; + int i; + + /* handle the "first" type devices first */ + list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + for (i=0; first_list[i] != NULL; i++) { + if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { + udev_add_device(loop_device->path, loop_device->subsys, NOFAKE); + list_del(&loop_device->list); + free(loop_device); + break; + } + } + } /* handle the devices we are allowed to, excluding the "last" type devices */ list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { int found = 0; - int i; for (i=0; last_list[i] != NULL; i++) { if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) { found = 1; -- cgit v1.2.3-54-g00ecf From a2383407b3c77f63234c482a2b27b0d45cd4a791 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 10 Sep 2004 21:58:59 -0700 Subject: [PATCH] add symlink for video rule. --- etc/udev/udev.rules.gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index f8208d9495..429762b8da 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -94,7 +94,7 @@ KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" # v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n" +KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n" KERNEL="radio[0-9]*", NAME="v4l/radio%n" KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" -- cgit v1.2.3-54-g00ecf From 10014f7c9d67b38d10a8a12d1aa79491f5a852bd Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 10 Sep 2004 22:09:58 -0700 Subject: [PATCH] 031 release --- ChangeLog | 47 +++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a65376488..701b447828 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,50 @@ +Summary of changes from v030 to v031 +============================================ + +: + o udev - read long lines from config files overflow fix + +: + o Update the FAQ with info about hardlink security + +: + o compatibility symlinks for udev + +David Weinehall: + o Minor POSIX-fixes for udev + +Greg Kroah-Hartman: + o add symlink for video rule + o add a "first" list to udevstart and make it contain the class/mem/ devices + o fix compiler warning in udevtest.c + o Fix old-style pty breakage in rules file for tty device + o add rules for i386 cpu devices + o add permission for legotower usb devices + o 030 release TAG: v030 + +Kay Sievers: + o Fix naming ethernet devices in udevstart + o update udev_volume_id + o let /sbin/hotplug execute udev earlier + o pass SEQNUM trough udevd + o fix manpages based on esr's spambot + +Martin Schlemmer: + o add microcode rule to permissions.gentoo file + +Michael Buesch: + o Try to provide a bit of security for hardlinks to /dev entries + +Olaf Hering: + o udevsend depends on udev_lib.o + +Tom Rini: + o fix UDEV_NO_SLEEP + o clean up start_udev a bit + o Make udev/udevstart be one binary + o Add 'asmlinkage' to udev-030 + + Summary of changes from v029 to v030 ============================================ diff --git a/Makefile b/Makefile index 2f1f71090d..c43bbddab6 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 030 +VERSION = 031 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index bdbcb4129e..b751295ed7 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 030 +Version: 031 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 29a3cead404d2043a7a3f98d1fb9c7139222b0df Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 14 Sep 2004 06:50:28 -0700 Subject: [PATCH] fix udevstart badly broken in udev 031 On Mon, 2004-09-13 at 01:56 +0200, Marco d'Itri wrote: > Starting from udev 031, the %-arguments passed to PROGRAMs are not > correct when the new udevstart code is being used. > > KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/inputdev.sh %k %n %M %m", RESULT="inputdev", MODE="0664", GROUP="video" > > generates this log (just echo $*): > > event0 0 13 64 > event0 0 13 64 > event0 0 13 64 > > while the correct log (generated using the old shell script instead of > udevstart) would be: > > event0 0 13 64 > event1 1 13 65 > event2 2 13 66 Yes, I can simulate this, please try the attached patch. I expect, that it fixes it, cause we better not mangle the parsed config while matching the rules. --- namedev.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/namedev.c b/namedev.c index 466016c297..e86f88f433 100644 --- a/namedev.c +++ b/namedev.c @@ -813,10 +813,12 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas /* execute external program */ if (dev->program[0] != '\0') { + char program[PROGRAM_SIZE]; + dbg("check " FIELD_PROGRAM); - apply_format(udev, dev->program, sizeof(dev->program), - class_dev, sysfs_device); - if (execute_program(dev->program, udev->program_result, NAME_SIZE) != 0) { + strfieldcpy(program, dev->program); + apply_format(udev, program, sizeof(program), class_dev, sysfs_device); + if (execute_program(program, udev->program_result, NAME_SIZE) != 0) { dbg(FIELD_PROGRAM " returned nonzero"); goto try_parent; } else { -- cgit v1.2.3-54-g00ecf From 6d74f9967b54104895e49c05549121026515fa58 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 14 Sep 2004 06:50:33 -0700 Subject: [PATCH] handle only block and class devices Fix a stupid logic bug, I introduced with the udev.c simplification. We want to look at class and block devices only. --- udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.c b/udev.c index 114ca0a52b..e6f2744fcb 100644 --- a/udev.c +++ b/udev.c @@ -122,7 +122,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("looking at '%s'", devpath); /* we only care about class devices and block stuff */ - if (strstr(devpath, "class") && strstr(devpath, "block")) { + if (!strstr(devpath, "class") && !strstr(devpath, "block")) { dbg("not a block or class device"); goto exit; } -- cgit v1.2.3-54-g00ecf From a75e2c14f9bc098966f39f26358e6de4dc167192 Mon Sep 17 00:00:00 2001 From: "harald@redhat.com" Date: Tue, 14 Sep 2004 06:50:38 -0700 Subject: [PATCH] udev parse bug There is a bug parsing PROGRAMs after apostrophes. Try PROGRAM="/bin/echo 'test test". --- namedev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index e86f88f433..c8217024c8 100644 --- a/namedev.c +++ b/namedev.c @@ -433,9 +433,9 @@ static int execute_program(char *path, char *value, int len) /* don't separate if in apostrophes */ pos++; argv[i] = strsep(&pos, "\'"); - while (pos[0] == ' ') + while (pos && pos[0] == ' ') pos++; - } else { + } else { argv[i] = strsep(&pos, " "); } dbg("arg[%i] '%s'", i, argv[i]); -- cgit v1.2.3-54-g00ecf From cb5203fb48d2c28f264b175aa560f08d6e368320 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 14 Sep 2004 06:55:08 -0700 Subject: [PATCH] 032 release --- ChangeLog | 11 +++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 701b447828..ab1dfa54d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Summary of changes from v031 to v032 +============================================ + +: + o udev parse bug + +Kay Sievers: + o handle only block and class devices + o fix udevstart badly broken in udev 031 + + Summary of changes from v030 to v031 ============================================ diff --git a/Makefile b/Makefile index c43bbddab6..764618e1b4 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 031 +VERSION = 032 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index b751295ed7..193befca6c 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 031 +Version: 032 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 3db7fa27027110fde92a1b6061fab434fe708e9f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 14 Sep 2004 17:45:48 -0700 Subject: [PATCH] fix udev segfaults with bad permissions file On Tue, Sep 14, 2004 at 02:53:12PM +0200, Loleslaw wrote: > Hi, > Since I started using udev-031 on my gentoo udevstart would just segfault > (udev-030 worked). As it turned out I had a file in /etc/udev/permissions.d > with a single space in one line. I've cleaned the file and it works all > right, but I thought you could be interested. > I've traced it to function namedev_init_permissions in namedev_parse.c > I don't know C well enough to suggest a patch. Yeah, thanks for pointing that out. It only happens if the file ends with whitespace-only lines. Here is a fix and a test for udev-test.pl to cover that case. --- namedev_parse.c | 16 ++++++---------- test/udev-test.pl | 16 ++++++++++++++++ udev_config.c | 8 +++----- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index 4bb1a97ce9..7e37833202 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -182,15 +182,13 @@ static int namedev_parse_rules(char *filename) continue; } - /* empty line? */ - if (bufline[0] == '\0' || bufline[0] == '\n') - continue; - /* eat the whitespace */ - while (isspace(bufline[0])) { + while ((count > 0) && isspace(bufline[0])) { bufline++; count--; } + if (count == 0) + continue; /* see if this is a comment */ if (bufline[0] == COMMENT_CHARACTER) @@ -381,15 +379,13 @@ static int namedev_parse_permissions(char *filename) continue; } - /* empty line? */ - if (bufline[0] == '\0' || bufline[0] == '\n') - continue; - /* eat the whitespace */ - while (isspace(bufline[0])) { + while ((count > 0) && isspace(bufline[0])) { bufline++; count--; } + if (count == 0) + continue; /* see if this is a comment */ if (bufline[0] == COMMENT_CHARACTER) diff --git a/test/udev-test.pl b/test/udev-test.pl index 1e7c51e556..9feb28a7ba 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -158,6 +158,22 @@ EOF # this is a comment with whitespace before the comment KERNEL="ttyUSB0", NAME="visor" +EOF + }, + { + desc => "Handle whitespace only lines (and replace kernel name)", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "whitespace" , + conf => < 0) && isspace(bufline[0])) { bufline++; count--; } + if (count == 0) + continue; /* see if this is a comment */ if (bufline[0] == COMMENT_CHARACTER) -- cgit v1.2.3-54-g00ecf From 0345b8623581497f49184ffd1d8143fe20f71893 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 14 Sep 2004 21:44:55 -0700 Subject: [PATCH] add enum tests On Fri, Sep 10, 2004 at 01:09:07PM -0700, Greg KH wrote: > On Tue, Sep 07, 2004 at 01:19:34PM +0200, David Zeuthen wrote: > > > > KERNEL="sr*", NAME="%k", SYMLINK="cdrom%e" > > KERNEL="scd*", NAME="%k", SYMLINK="cdrom%e" > > KERNEL="pcd*", NAME="%k", SYMLINK="cdrom%e" > > KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="\%k", SYMLINK="cdrom%e" > > KERNEL="fd[0-9]", NAME="%k", SYMLINK="floppy%e" > > KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy", NAME=\"%k", SYMLINK="floppy%e" > > > > New patch is attached. > > Nice, I've applied this. > > How about sending a patch for the test/udev-test.pl script that adds a > test for this new paramater, so we make sure to not break it in the > future. Here are the tests for the enumeration character %e. I've added a option string to be able to do a whole sequence of tests without node removal, so we can skip the "remove" event and get an increasing number to append to the name. After the sequence test the whole directory is cleaned for the next tests. --- test/udev-test.pl | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 3 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 9feb28a7ba..590b551dfe 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1015,6 +1015,74 @@ EOF exp_target => "node", conf => < "enumeration char test (single test)", + subsys => "block", + devpath => "/block/sda", + exp_name => "cdrom", + conf => < "enumeration char test sequence (1/5 keep)", + subsys => "block", + devpath => "/block/sda", + exp_name => "cdrom", + option => "keep", + conf => < "enumeration char test sequence 2/5 (keep)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "enum", + option => "keep", + conf => < "enumeration char test sequence 3/5 (keep)", + subsys => "block", + devpath => "/block/sda/sda2", + exp_name => "cdrom1", + option => "keep", + conf => < "enumeration char test sequence 4/5 (keep)", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "enum1", + option => "keep", + conf => < "enumeration char test sequence 5/5 (clean)", + subsys => "block", + devpath => "/block/sda/sda4", + exp_name => "cdrom2", + option => "clear", + conf => < "enumeration char test after cleanup (single test)", + subsys => "block", + devpath => "/block/sda", + exp_name => "cdrom", + conf => <{option}) && $config->{option} eq "keep") { + print "\n\n"; + return; + } + udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf}); if ((-e "$PWD/$udev_root$config->{exp_name}") || (-l "$PWD/$udev_root$config->{exp_name}")) { @@ -1175,6 +1248,13 @@ sub run_test { } else { print "remove: ok\n\n"; } + + if (defined($config->{option}) && $config->{option} eq "clear") { + unlink($udev_db); + system("rm -rf $udev_root"); + mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; + } + } # prepare @@ -1194,9 +1274,13 @@ my $test_num = 1; if ($ARGV[0]) { # only run one test $test_num = $ARGV[0]; - print "udev-test will run test number $test_num only\n"; - run_test($tests[$test_num-1], $test_num); + if (defined($tests[$test_num-1]->{desc})) { + print "udev-test will run test number $test_num only:\n\n"; + run_test($tests[$test_num-1], $test_num); + } else { + print "test does not exist.\n"; + } } else { # test all print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; @@ -1204,7 +1288,6 @@ if ($ARGV[0]) { foreach my $config (@tests) { run_test($config, $test_num); $test_num++; - } } -- cgit v1.2.3-54-g00ecf From cdc60e8afb06a0688e4b9f166625d4d0b8805e68 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 15 Sep 2004 22:36:31 -0700 Subject: [PATCH] switch udev's seqnum to u64 The kernel will use a u64 for the sequence number, so we want the same. --- udev.h | 4 +--- udev_lib.h | 6 ------ udevd.c | 35 +++++++++++++++++------------------ udevd.h | 2 +- udevsend.c | 26 ++++++++++---------------- 5 files changed, 29 insertions(+), 44 deletions(-) diff --git a/udev.h b/udev.h index d049fc1fd0..46c961c2d5 100644 --- a/udev.h +++ b/udev.h @@ -43,7 +43,7 @@ #define FAKE 1 #define NOFAKE 0 -/* length of public data */ +/* length of public data to store in udevdb */ #define UDEVICE_LEN (offsetof(struct udevice, bus_id)) struct udevice { @@ -71,8 +71,6 @@ extern int udev_add_device(const char *path, const char *subsystem, int fake); extern int udev_remove_device(const char *path, const char *subsystem); extern void udev_init_config(void); extern int udev_start(void); -extern int __udev_hotplug(char *action, const char *devpath, - const char *subsystem); extern int parse_get_pair(char **orig_string, char **left, char **right); extern void dev_d_send(struct udevice *dev, const char *subsystem, const char *devpath); diff --git a/udev_lib.h b/udev_lib.h index 53ad92d505..18ce25ccc7 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -59,12 +59,6 @@ do { \ snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ } while (0) -#define strlongcat(to, i) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%li", i); \ -} while (0) - #define foreach_strpart(str, separator, pos, len) \ for(pos = str, len = 0; \ (pos) < ((str) + strlen(str)); \ diff --git a/udevd.c b/udevd.c index 50720c2450..88131d63ab 100644 --- a/udevd.c +++ b/udevd.c @@ -44,7 +44,7 @@ #include "logging.h" static int pipefds[2]; -static long expected_seqnum = 0; +static unsigned long long expected_seqnum = 0; volatile static int children_waiting; volatile static int run_msg_q; volatile static int sig_flag; @@ -73,7 +73,7 @@ void log_message (int level, const char *format, ...) #endif #define msg_dump(msg) \ - dbg("msg_dump: sequence %d, '%s', '%s', '%s'", \ + dbg("msg_dump: sequence %llu, '%s', '%s', '%s'", \ msg->seqnum, msg->action, msg->devpath, msg->subsystem); static void msg_dump_queue(void) @@ -82,7 +82,7 @@ static void msg_dump_queue(void) struct hotplug_msg *msg; list_for_each_entry(msg, &msg_list, list) - dbg("sequence %li in queue", msg->seqnum); + dbg("sequence %llu in queue", msg->seqnum); #endif } @@ -120,7 +120,7 @@ static void msg_queue_insert(struct hotplug_msg *msg) msg->queue_time = info.uptime; list_add(&msg->list, &loop_msg->list); - dbg("queued message seq %li", msg->seqnum); + dbg("queued message seq %llu", msg->seqnum); /* run msg queue manager */ run_msg_q = 1; @@ -137,12 +137,11 @@ static void udev_run(struct hotplug_msg *msg) char seqnum[SEQNUM_SIZE]; char *env[] = { action, devpath, seqnum, NULL }; - strcpy(action, "ACTION="); - strfieldcat(action, msg->action); - strcpy(devpath, "DEVPATH="); - strfieldcat(devpath, msg->devpath); - strcpy(seqnum, "SEQNUM="); - strlongcat(seqnum, msg->seqnum); + snprintf(action, ACTION_SIZE-1, "ACTION=%s", msg->action); + action[ACTION_SIZE-1] = '\0'; + snprintf(devpath, DEVPATH_SIZE-1, "DEVPATH=%s", msg->devpath); + devpath[DEVPATH_SIZE-1] = '\0'; + sprintf(seqnum, "SEQNUM=%llu", msg->seqnum); pid = fork(); switch (pid) { @@ -161,7 +160,7 @@ static void udev_run(struct hotplug_msg *msg) break; default: /* get SIGCHLD in main loop */ - dbg("==> exec seq %li [%d] working at '%s'", msg->seqnum, pid, msg->devpath); + dbg("==> exec seq %llu [%d] working at '%s'", msg->seqnum, pid, msg->devpath); msg->pid = pid; } } @@ -189,9 +188,9 @@ static void exec_queue_manager() /* move event to run list */ list_move_tail(&loop_msg->list, &running_list); udev_run(loop_msg); - dbg("moved seq %li to running list", loop_msg->seqnum); + dbg("moved seq %llu to running list", loop_msg->seqnum); } else { - dbg("delay seq %li, cause seq %li already working on '%s'", + dbg("delay seq %llu, cause seq %llu already working on '%s'", loop_msg->seqnum, msg->seqnum, msg->devpath); } } @@ -202,7 +201,7 @@ static void msg_move_exec(struct hotplug_msg *msg) list_move_tail(&msg->list, &exec_list); run_exec_q = 1; expected_seqnum = msg->seqnum+1; - dbg("moved seq %li to exec, next expected is %li", + dbg("moved seq %llu to exec, next expected is %llu", msg->seqnum, expected_seqnum); } @@ -214,7 +213,7 @@ static void msg_queue_manager() struct sysinfo info; long msg_age = 0; - dbg("msg queue manager, next expected is %li", expected_seqnum); + dbg("msg queue manager, next expected is %llu", expected_seqnum); recheck: list_for_each_entry_safe(loop_msg, tmp_msg, &msg_list, list) { /* move event with expected sequence to the exec list */ @@ -226,7 +225,7 @@ recheck: /* move event with expired timeout to the exec list */ sysinfo(&info); msg_age = info.uptime - loop_msg->queue_time; - dbg("seq %li is %li seconds old", loop_msg->seqnum, msg_age); + dbg("seq %llu is %li seconds old", loop_msg->seqnum, msg_age); if (msg_age > EVENT_TIMEOUT_SEC-1) { msg_move_exec(loop_msg); goto recheck; @@ -296,7 +295,7 @@ static void handle_msg(int sock) } /* if no seqnum is given, we move straight to exec queue */ - if (msg->seqnum == -1) { + if (msg->seqnum == 0) { list_add(&msg->list, &exec_list); run_exec_q = 1; } else { @@ -353,7 +352,7 @@ static void udev_done(int pid) list_for_each_entry(msg, &running_list, list) { if (msg->pid == pid) { - dbg("<== exec seq %li came back", msg->seqnum); + dbg("<== exec seq %llu came back", msg->seqnum); run_queue_delete(msg); /* we want to run the exec queue manager since there may diff --git a/udevd.h b/udevd.h index cced75d5f6..9be581d420 100644 --- a/udevd.h +++ b/udevd.h @@ -33,7 +33,7 @@ struct hotplug_msg { char magic[20]; struct list_head list; pid_t pid; - long seqnum; + unsigned long long seqnum; long queue_time; char action[ACTION_SIZE]; char devpath[DEVPATH_SIZE]; diff --git a/udevsend.c b/udevsend.c index a52d6ec165..842a2a4bc4 100644 --- a/udevsend.c +++ b/udevsend.c @@ -53,17 +53,6 @@ void log_message (int level, const char *format, ...) } #endif -static void build_hotplugmsg(struct hotplug_msg *msg, char *action, - char *devpath, char *subsystem, int seqnum) -{ - memset(msg, 0x00, sizeof(struct hotplug_msg)); - strfieldcpy(msg->magic, UDEV_MAGIC); - msg->seqnum = seqnum; - strfieldcpy(msg->action, action); - strfieldcpy(msg->devpath, devpath); - strfieldcpy(msg->subsystem, subsystem); -} - static int start_daemon(void) { pid_t pid; @@ -125,7 +114,7 @@ int main(int argc, char* argv[]) char *devpath; char *subsystem; char *seqnum; - int seq; + unsigned long long seq; int retval = 1; int loop; struct timespec tspec; @@ -160,10 +149,10 @@ int main(int argc, char* argv[]) seqnum = get_seqnum(); if (seqnum == NULL) - seq = -1; + seq = 0; else - seq = atoi(seqnum); - dbg("SEQNUM = '%d'", seq); + seq = strtoull(seqnum, NULL, 10); + dbg("SEQNUM = '%llu'", seq); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { @@ -177,7 +166,12 @@ int main(int argc, char* argv[]) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - build_hotplugmsg(&msg, action, devpath, subsystem, seq); + memset(&msg, 0x00, sizeof(struct hotplug_msg)); + strcpy(msg.magic, UDEV_MAGIC); + msg.seqnum = seq; + strfieldcpy(msg.action, action); + strfieldcpy(msg.devpath, devpath); + strfieldcpy(msg.subsystem, subsystem); /* If we can't send, try to start daemon and resend message */ loop = UDEVSEND_CONNECT_RETRY; -- cgit v1.2.3-54-g00ecf From 9e8a3a095d955538acbdf28dba02582f6b2330e5 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 18 Sep 2004 23:22:27 -0700 Subject: [PATCH] volume-id build fix and update Let's try it another way: We define BLKGETSIZE64 in udev-volume_id.c now, cause including does also not work with klibc. This hopefully fixes your compile problem too. Also included is an update to udev_volume_id with the latest fixes for volume_id. It adds a simple logging file to map the debug function, that we can use exactly the same files in HAL and udev. --- extras/volume_id/udev_volume_id.c | 17 +- extras/volume_id/volume_id.c | 295 ++++++++++++++++++++++------------- extras/volume_id/volume_id.h | 2 +- extras/volume_id/volume_id_logging.h | 21 +++ 4 files changed, 211 insertions(+), 124 deletions(-) create mode 100644 extras/volume_id/volume_id_logging.h diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index e88445054b..6b62db0775 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -24,8 +24,8 @@ #include #include #include +#include #include -#include #include #include "../../libsysfs/sysfs/libsysfs.h" @@ -34,6 +34,8 @@ #include "volume_id.h" #include "dasdlabel.h" +#define BLKGETSIZE64 _IOR(0x12,114,size_t) + #ifdef LOG unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) @@ -73,16 +75,6 @@ static struct volume_id *open_classdev(struct sysfs_class_device *class_dev) return vid; } -static unsigned long long get_size(struct volume_id *vid) -{ - unsigned long long size; - - if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) - size = 0; - - return size; -} - static char *usage_id_name(enum volume_id_usage usage) { switch(usage) { @@ -181,7 +173,8 @@ int main(int argc, char *argv[]) if (vid == NULL) goto exit; - size = get_size(vid); + if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) + size = 0; if (volume_id_probe(vid, VOLUME_ID_ALL, 0, size) == 0) goto print; diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index daeb00038a..99aed6c96b 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -24,17 +24,17 @@ */ #ifndef _GNU_SOURCE -#define _GNU_SOURCE +#define _GNU_SOURCE 1 #endif #ifdef HAVE_CONFIG_H # include #endif -#include #include -#include +#include #include +#include #include #include #include @@ -42,32 +42,24 @@ #include #include "volume_id.h" - -#ifdef DEBUG -#define dbg(format, arg...) \ - do { \ - printf("%s: " format "\n", __FUNCTION__ , ## arg); \ - } while (0) -#else -#define dbg(format, arg...) do {} while (0) -#endif /* DEBUG */ +#include "volume_id_logging.h" #define bswap16(x) (__u16)((((__u16)(x) & 0x00ffu) << 8) | \ - (((__u32)(x) & 0xff00u) >> 8)) + (((__u16)(x) & 0xff00u) >> 8)) #define bswap32(x) (__u32)((((__u32)(x) & 0xff000000u) >> 24) | \ (((__u32)(x) & 0x00ff0000u) >> 8) | \ (((__u32)(x) & 0x0000ff00u) << 8) | \ (((__u32)(x) & 0x000000ffu) << 24)) -#define bswap64(x) (__u64)((((__u64)(x) & 0xff00000000000000u) >> 56) | \ - (((__u64)(x) & 0x00ff000000000000u) >> 40) | \ - (((__u64)(x) & 0x0000ff0000000000u) >> 24) | \ - (((__u64)(x) & 0x000000ff00000000u) >> 8) | \ - (((__u64)(x) & 0x00000000ff000000u) << 8) | \ - (((__u64)(x) & 0x0000000000ff0000u) << 24) | \ - (((__u64)(x) & 0x000000000000ff00u) << 40) | \ - (((__u64)(x) & 0x00000000000000ffu) << 56)) +#define bswap64(x) (__u64)((((__u64)(x) & 0xff00000000000000ull) >> 56) | \ + (((__u64)(x) & 0x00ff000000000000ull) >> 40) | \ + (((__u64)(x) & 0x0000ff0000000000ull) >> 24) | \ + (((__u64)(x) & 0x000000ff00000000ull) >> 8) | \ + (((__u64)(x) & 0x00000000ff000000ull) << 8) | \ + (((__u64)(x) & 0x0000000000ff0000ull) << 24) | \ + (((__u64)(x) & 0x000000000000ff00ull) << 40) | \ + (((__u64)(x) & 0x00000000000000ffull) << 56)) #if (__BYTE_ORDER == __LITTLE_ENDIAN) #define le16_to_cpu(x) (x) @@ -144,34 +136,56 @@ static void set_label_unicode16(struct volume_id *id, } } -static void set_uuid(struct volume_id *id, - const __u8 *buf, unsigned int count) +enum uuid_format { + UUID_DCE, + UUID_DOS, + UUID_NTFS, + UUID_HFS, +}; + +static void set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format format) { unsigned int i; + unsigned int count = 0; + switch(format) { + case UUID_DOS: + count = 4; + break; + case UUID_NTFS: + case UUID_HFS: + count = 8; + break; + case UUID_DCE: + count = 16; + } memcpy(id->uuid_raw, buf, count); - /* create string if uuid is set */ + /* if set, create string in the same format, the native platform uses */ for (i = 0; i < count; i++) if (buf[i] != 0) goto set; return; set: - switch(count) { - case 4: + switch(format) { + case UUID_DOS: sprintf(id->uuid, "%02X%02X-%02X%02X", buf[3], buf[2], buf[1], buf[0]); break; - case 8: - sprintf(id->uuid,"%02X%02X-%02X%02X-%02X%02X-%02X%02X", + case UUID_NTFS: + sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); break; - case 16: + case UUID_HFS: + sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], buf[6], buf[7]); + break; + case UUID_DCE: sprintf(id->uuid, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-" - "%02x%02x%02x%02x%02x%02x", + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], @@ -337,12 +351,13 @@ static int probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) } __attribute__((packed)) *mdp; const __u8 *buf; - __u64 sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; + __u64 sboff; __u8 uuid[16]; if (size < 0x10000) return -1; + sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; buf = get_buffer(id, off + sboff, 0x800); if (buf == NULL) return -1; @@ -354,7 +369,7 @@ static int probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) memcpy(uuid, &mdp->set_uuid0, 4); memcpy(&uuid[4], &mdp->set_uuid1, 12); - set_uuid(id, uuid, 16); + set_uuid(id, uuid, UUID_DCE); snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u.%u.%u", le32_to_cpu(mdp->major_version), @@ -572,7 +587,7 @@ static int probe_ext(struct volume_id *id, __u64 off) set_label_raw(id, es->volume_name, 16); set_label_string(id, es->volume_name, 16); - set_uuid(id, es->uuid, 16); + set_uuid(id, es->uuid, UUID_DCE); if ((le32_to_cpu(es->feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) { @@ -638,7 +653,7 @@ static int probe_reiserfs(struct volume_id *id, __u64 off) found: set_label_raw(id, rs->label, 16); set_label_string(id, rs->label, 16); - set_uuid(id, rs->uuid, 16); + set_uuid(id, rs->uuid, UUID_DCE); id->usage_id = VOLUME_ID_FILESYSTEM; id->type_id = VOLUME_ID_REISERFS; @@ -673,7 +688,7 @@ static int probe_xfs(struct volume_id *id, __u64 off) set_label_raw(id, xs->fname, 12); set_label_string(id, xs->fname, 12); - set_uuid(id, xs->uuid, 16); + set_uuid(id, xs->uuid, UUID_DCE); id->usage_id = VOLUME_ID_FILESYSTEM; id->type_id = VOLUME_ID_XFS; @@ -708,7 +723,7 @@ static int probe_jfs(struct volume_id *id, __u64 off) set_label_raw(id, js->label, 16); set_label_string(id, js->label, 16); - set_uuid(id, js->uuid, 16); + set_uuid(id, js->uuid, UUID_DCE); id->usage_id = VOLUME_ID_FILESYSTEM; id->type_id = VOLUME_ID_JFS; @@ -720,52 +735,6 @@ static int probe_jfs(struct volume_id *id, __u64 off) #define FAT12_MAX 0xff5 #define FAT16_MAX 0xfff5 #define FAT_ATTR_VOLUME 0x08 -struct vfat_dir_entry { - __u8 name[11]; - __u8 attr; - __u16 time_creat; - __u16 date_creat; - __u16 time_acc; - __u16 date_acc; - __u16 cluster_high; - __u16 time_write; - __u16 date_write; - __u16 cluster_low; - __u32 size; -} __attribute__((__packed__)); - -static char *vfat_search_label_in_dir(const __u8 *buf, __u16 size) -{ - struct vfat_dir_entry *dir; - int i; - __u16 count; - - dir = (struct vfat_dir_entry*) buf; - count = size / sizeof(struct vfat_dir_entry); - dbg("expected entries 0x%x", count); - - for (i = 0; i <= count; i++) { - /* end marker */ - if (dir[i].attr == 0x00) { - dbg("end of dir"); - return NULL; - } - - /* empty entry */ - if (dir[i].attr == 0xe5) - continue; - - if (dir[i].attr == FAT_ATTR_VOLUME) { - dbg("found ATTR_VOLUME id in root dir"); - return dir[i].name; - } - - dbg("skip dir entry"); - } - - return NULL; -} - static int probe_vfat(struct volume_id *id, __u64 off) { struct vfat_super_block { @@ -810,6 +779,20 @@ static int probe_vfat(struct volume_id *id, __u64 off) } __attribute__((__packed__)) type; } __attribute__((__packed__)) *vs; + struct vfat_dir_entry { + __u8 name[11]; + __u8 attr; + __u16 time_creat; + __u16 date_creat; + __u16 time_acc; + __u16 date_acc; + __u16 cluster_high; + __u16 time_write; + __u16 date_write; + __u16 cluster_low; + __u32 size; + } __attribute__((__packed__)) *dir; + __u16 sector_size; __u16 dir_entries; __u32 sect_count; @@ -826,6 +809,8 @@ static int probe_vfat(struct volume_id *id, __u64 off) __u32 buf_size; __u8 *label = NULL; __u32 next; + int maxloop; + int i; vs = (struct vfat_super_block *) get_buffer(id, off, 0x200); if (vs == NULL) @@ -892,7 +877,7 @@ valid: sect_count = le16_to_cpu(vs->sectors); if (sect_count == 0) - sect_count = vs->total_sect; + sect_count = le32_to_cpu(vs->total_sect); dbg("sect_count 0x%x", sect_count); fat_length = le16_to_cpu(vs->fat_length); @@ -920,15 +905,35 @@ valid: /* the label may be an attribute in the root directory */ root_start = (reserved + fat_size) * sector_size; + dbg("root dir start 0x%llx", root_start); root_dir_entries = le16_to_cpu(vs->dir_entries); - dbg("root dir start 0x%x", root_start); + dbg("expected entries 0x%x", root_dir_entries); buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); buf = get_buffer(id, off + root_start, buf_size); if (buf == NULL) goto found; - label = vfat_search_label_in_dir(buf, buf_size); + dir = (struct vfat_dir_entry*) buf; + + for (i = 0; i <= root_dir_entries; i++) { + /* end marker */ + if (dir[i].attr == 0x00) { + dbg("end of dir"); + break; + } + + /* empty entry */ + if (dir[i].attr == 0xe5) + continue; + + if (dir[i].attr == FAT_ATTR_VOLUME) { + dbg("found ATTR_VOLUME id in root dir"); + label = dir[i].name; + } + + dbg("skip dir entry"); + } if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { set_label_raw(id, label, 11); @@ -937,7 +942,7 @@ valid: set_label_raw(id, vs->type.fat.label, 11); set_label_string(id, vs->type.fat.label, 11); } - set_uuid(id, vs->type.fat.serno, 4); + set_uuid(id, vs->type.fat.serno, UUID_DOS); goto found; fat32: @@ -948,24 +953,46 @@ fat32: start_data_sect = reserved + fat_size; next = root_cluster; - while (1) { + maxloop = 100; + while (--maxloop) { __u32 next_sect_off; __u64 next_off; __u64 fat_entry_off; + int count; dbg("next cluster %u", next); next_sect_off = (next - 2) * vs->sectors_per_cluster; next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%x", next_off); + dbg("cluster offset 0x%llx", next_off); /* get cluster */ buf = get_buffer(id, off + next_off, buf_size); if (buf == NULL) goto found; - label = vfat_search_label_in_dir(buf, buf_size); - if (label != NULL) - break; + dir = (struct vfat_dir_entry*) buf; + count = buf_size / sizeof(struct vfat_dir_entry); + dbg("expected entries 0x%x", count); + + for (i = 0; i <= count; i++) { + /* end marker */ + if (dir[i].attr == 0x00) { + dbg("end of dir"); + goto fat32_label; + } + + /* empty entry */ + if (dir[i].attr == 0xe5) + continue; + + if (dir[i].attr == FAT_ATTR_VOLUME) { + dbg("found ATTR_VOLUME id in root dir"); + label = dir[i].name; + goto fat32_label; + } + + dbg("skip dir entry"); + } /* get FAT entry */ fat_entry_off = (reserved * sector_size) + (next * sizeof(__u32)); @@ -978,7 +1005,10 @@ fat32: if (next == 0) break; } + if (maxloop == 0) + dbg("reached maximum follow count of root cluster chain, give up"); +fat32_label: if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { set_label_raw(id, label, 11); set_label_string(id, label, 11); @@ -986,7 +1016,7 @@ fat32: set_label_raw(id, vs->type.fat32.label, 11); set_label_string(id, vs->type.fat32.label, 11); } - set_uuid(id, vs->type.fat32.serno, 4); + set_uuid(id, vs->type.fat32.serno, UUID_DCE); found: id->usage_id = VOLUME_ID_FILESYSTEM; @@ -1479,9 +1509,10 @@ static int probe_mac_partition_map(struct volume_id *id, __u64 off) #define HFS_SUPERBLOCK_OFFSET 0x400 #define HFS_NODE_LEAF 0xff #define HFSPLUS_POR_CNID 1 +#define HFSPLUS_EXTENT_COUNT 8 static int probe_hfs_hfsplus(struct volume_id *id, __u64 off) { - struct finder_info { + struct hfs_finder_info{ __u32 boot_folder; __u32 start_app; __u32 open_folder; @@ -1515,7 +1546,7 @@ static int probe_hfs_hfsplus(struct volume_id *id, __u64 off) __u16 num_root_dirs; __u32 file_count; __u32 dir_count; - struct finder_info finfo; + struct hfs_finder_info finder_info; __u8 embed_sig[2]; __u16 embed_startblock; __u16 embed_blockcount; @@ -1555,7 +1586,7 @@ static int probe_hfs_hfsplus(struct volume_id *id, __u64 off) __u64 total_size; __u32 clump_size; __u32 total_blocks; - struct hfsplus_extent extents[8]; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; } __attribute__((__packed__)); struct hfsplus_vol_header { @@ -1579,7 +1610,7 @@ static int probe_hfs_hfsplus(struct volume_id *id, __u64 off) __u32 next_cnid; __u32 write_count; __u64 encodings_bmp; - struct finder_info finfo; + struct hfs_finder_info finder_info; struct hfsplus_fork alloc_file; struct hfsplus_fork ext_file; struct hfsplus_fork cat_file; @@ -1589,18 +1620,23 @@ static int probe_hfs_hfsplus(struct volume_id *id, __u64 off) unsigned int blocksize; unsigned int cat_block; - unsigned int cat_block_count; - unsigned int cat_off; - unsigned int cat_len; + unsigned int ext_block_start; + unsigned int ext_block_count; + int ext; unsigned int leaf_node_head; + unsigned int leaf_node_count; unsigned int leaf_node_size; + unsigned int leaf_block; + __u64 leaf_off; unsigned int alloc_block_size; unsigned int alloc_first_block; unsigned int embed_first_block; + unsigned int record_count; struct hfsplus_bnode_descriptor *descr; struct hfsplus_bheader_record *bnode; struct hfsplus_catalog_key *key; unsigned int label_len; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; const __u8 *buf; buf = get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); @@ -1637,6 +1673,8 @@ static int probe_hfs_hfsplus(struct volume_id *id, __u64 off) set_label_string(id, hfs->label, hfs->label_len) ; } + set_uuid(id, hfs->finder_info.id, UUID_HFS); + id->usage_id = VOLUME_ID_FILESYSTEM; id->type_id = VOLUME_ID_HFS; id->type = "hfs"; @@ -1652,14 +1690,16 @@ checkplus: return -1; hfsplus: + set_uuid(id, hfsplus->finder_info.id, UUID_HFS); + blocksize = be32_to_cpu(hfsplus->blocksize); - cat_block = be32_to_cpu(hfsplus->cat_file.extents[0].start_block); - cat_block_count = be32_to_cpu(hfsplus->cat_file.extents[0].block_count); - cat_off = (cat_block * blocksize); - cat_len = cat_block_count * blocksize; - dbg("catalog start 0x%llx, len 0x%x", off + cat_off, cat_len); + dbg("blocksize %u", blocksize); + + memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); + cat_block = be32_to_cpu(extents[0].start_block); + dbg("catalog start block 0x%x", cat_block); - buf = get_buffer(id, off + cat_off, 0x2000); + buf = get_buffer(id, off + (cat_block * blocksize), 0x2000); if (buf == NULL) goto found; @@ -1667,18 +1707,51 @@ hfsplus: &buf[sizeof(struct hfsplus_bnode_descriptor)]; leaf_node_head = be32_to_cpu(bnode->leaf_head); + dbg("catalog leaf node 0x%x", leaf_node_head); + leaf_node_size = be16_to_cpu(bnode->node_size); + dbg("leaf node size 0x%x", leaf_node_size); + + leaf_node_count = be32_to_cpu(bnode->leaf_count); + dbg("leaf node count 0x%x", leaf_node_count); + if (leaf_node_count == 0) + goto found; + + leaf_block = (leaf_node_head * leaf_node_size) / blocksize; + + /* get physical location */ + for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { + ext_block_start = be32_to_cpu(extents[ext].start_block); + ext_block_count = be32_to_cpu(extents[ext].block_count); + dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); - dbg("catalog leaf node 0x%x, size 0x%x", - leaf_node_head, leaf_node_size); + if (ext_block_count == 0) + goto found; + + /* this is our extent */ + if (leaf_block < ext_block_count) + break; + + leaf_block -= ext_block_count; + } + if (ext == HFSPLUS_EXTENT_COUNT) + goto found; + dbg("found block in extent %i", ext); + + leaf_off = (ext_block_start + leaf_block) * blocksize; - buf = get_buffer(id, off + cat_off + (leaf_node_head * leaf_node_size), - leaf_node_size); + buf = get_buffer(id, off + leaf_off, leaf_node_size); if (buf == NULL) goto found; descr = (struct hfsplus_bnode_descriptor *) buf; dbg("descriptor type 0x%x", descr->type); + + record_count = be16_to_cpu(descr->num_recs); + dbg("number of records %u", record_count); + if (record_count == 0) + goto found; + if (descr->type != HFS_NODE_LEAF) goto found; @@ -1787,7 +1860,7 @@ static int probe_ntfs(struct volume_id *id, __u64 off) if (strncmp(ns->oem_id, "NTFS", 4) != 0) return -1; - set_uuid(id, ns->volume_serial, 8); + set_uuid(id, ns->volume_serial, UUID_NTFS); sector_size = le16_to_cpu(ns->bytes_per_sector); cluster_size = ns->sectors_per_cluster * sector_size; diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h index eb90390617..e68c42c3cf 100644 --- a/extras/volume_id/volume_id.h +++ b/extras/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 022 +#define VOLUME_ID_VERSION 024 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 diff --git a/extras/volume_id/volume_id_logging.h b/extras/volume_id/volume_id_logging.h new file mode 100644 index 0000000000..e978ce197c --- /dev/null +++ b/extras/volume_id/volume_id_logging.h @@ -0,0 +1,21 @@ +/* + * volume_id_logging - this file is used to map the dbg() function + * to the host logging facility + * + */ + +#ifndef _VOLUME_ID_LOGGING_H_ +#define _VOLUME_ID_LOGGING_H_ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* just use the udev version*/ +#include "../../logging.h" + +#endif /* _VOLUME_ID_LOGGING_H_ */ -- cgit v1.2.3-54-g00ecf From a0622777688ad84ef3d789e0171cfb0ca3dc21d2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 5 Oct 2004 18:32:12 -0700 Subject: [PATCH] update klibc to version 0.181 --- klibc/MCONFIG | 33 +- klibc/Makefile | 2 +- klibc/README | 3 +- klibc/klibc.spec | 157 +++++++ klibc/klibc.spec.in | 48 ++- klibc/klibc/MCONFIG | 5 + klibc/klibc/Makefile | 70 +++- klibc/klibc/README | 48 ++- klibc/klibc/SOCKETCALLS | 21 - klibc/klibc/SOCKETCALLS.def | 21 + klibc/klibc/SYSCALLS | 153 ------- klibc/klibc/SYSCALLS.def | 207 ++++++++++ klibc/klibc/__shared_init.c | 58 +-- klibc/klibc/__static_init.c | 40 +- klibc/klibc/alarm.c | 6 +- klibc/klibc/arch/alpha/Makefile.inc | 6 +- klibc/klibc/arch/alpha/crt0.S | 11 +- klibc/klibc/arch/alpha/include/klibc/archsetjmp.h | 33 -- klibc/klibc/arch/alpha/include/klibc/archsignal.h | 13 - klibc/klibc/arch/alpha/include/klibc/archsys.h | 53 --- klibc/klibc/arch/alpha/include/machine/asm.h | 44 -- klibc/klibc/arch/alpha/setjmp.S | 32 +- klibc/klibc/arch/alpha/syscall.S | 26 ++ klibc/klibc/arch/alpha/sysdual.S | 33 ++ klibc/klibc/arch/alpha/sysstub.ph | 37 ++ klibc/klibc/arch/arm/Makefile.inc | 14 +- klibc/klibc/arch/arm/crt0.S | 6 +- klibc/klibc/arch/arm/include/klibc/archsetjmp.h | 14 - klibc/klibc/arch/arm/include/klibc/archsignal.h | 13 - klibc/klibc/arch/arm/include/klibc/archsys.h | 12 - klibc/klibc/arch/arm/setjmp-arm.S | 3 +- klibc/klibc/arch/arm/syscall.S | 50 +++ klibc/klibc/arch/arm/sysstub.ph | 44 ++ klibc/klibc/arch/cris/MCONFIG | 15 + klibc/klibc/arch/cris/Makefile.inc | 23 ++ klibc/klibc/arch/cris/__negdi2.S | 25 ++ klibc/klibc/arch/cris/crt0.S | 28 ++ klibc/klibc/arch/cris/divide.c | 92 +++++ klibc/klibc/arch/cris/include/klibc/archsignal.h | 13 - klibc/klibc/arch/cris/include/klibc/archsys.h | 12 - klibc/klibc/arch/cris/setjmp.S | 37 ++ klibc/klibc/arch/cris/syscall.S | 30 ++ klibc/klibc/arch/cris/sysstub.ph | 29 ++ klibc/klibc/arch/i386/MCONFIG | 6 +- klibc/klibc/arch/i386/Makefile.inc | 4 +- klibc/klibc/arch/i386/include/klibc/archsetjmp.h | 19 - klibc/klibc/arch/i386/include/klibc/archsignal.h | 13 - klibc/klibc/arch/i386/include/klibc/archsys.h | 96 ----- klibc/klibc/arch/i386/include/klibc/diverr.h | 16 - klibc/klibc/arch/i386/include/sys/io.h | 126 ------ klibc/klibc/arch/i386/include/sys/vm86.h | 41 -- klibc/klibc/arch/i386/open.S | 29 ++ klibc/klibc/arch/i386/socketcall.S | 28 +- klibc/klibc/arch/i386/syscall.S | 60 +++ klibc/klibc/arch/i386/sysstub.ph | 32 ++ klibc/klibc/arch/ia64/Makefile.inc | 1 + klibc/klibc/arch/ia64/include/klibc/archsetjmp.h | 17 - klibc/klibc/arch/ia64/include/klibc/archsignal.h | 31 -- klibc/klibc/arch/ia64/include/klibc/archsys.h | 218 ---------- klibc/klibc/arch/ia64/pipe.c | 2 +- klibc/klibc/arch/ia64/syscall.S | 20 + klibc/klibc/arch/ia64/sysstub.ph | 29 ++ klibc/klibc/arch/ia64/vfork.S | 4 +- klibc/klibc/arch/m68k/include/klibc/archsignal.h | 13 - klibc/klibc/arch/m68k/include/klibc/archsys.h | 12 - klibc/klibc/arch/mips/MCONFIG | 7 +- klibc/klibc/arch/mips/Makefile.inc | 1 + klibc/klibc/arch/mips/include/klibc/archsetjmp.h | 39 -- klibc/klibc/arch/mips/include/klibc/archsignal.h | 13 - klibc/klibc/arch/mips/include/klibc/archsys.h | 12 - klibc/klibc/arch/mips/include/machine/asm.h | 11 - klibc/klibc/arch/mips/include/sgidefs.h | 20 - klibc/klibc/arch/mips/klibc.ld | 217 ++++++++++ klibc/klibc/arch/mips/syscall.S | 15 + klibc/klibc/arch/mips/sysstub.ph | 30 ++ klibc/klibc/arch/mips/vfork.S | 11 +- klibc/klibc/arch/mips64/include/klibc/archsignal.h | 13 - klibc/klibc/arch/mips64/include/klibc/archsys.h | 12 - klibc/klibc/arch/parisc/Makefile.inc | 6 +- klibc/klibc/arch/parisc/include/klibc/archsignal.h | 24 -- klibc/klibc/arch/parisc/include/klibc/archsys.h | 12 - klibc/klibc/arch/parisc/syscall.c | 29 ++ klibc/klibc/arch/parisc/sysstub.ph | 29 ++ klibc/klibc/arch/ppc/MCONFIG | 7 + klibc/klibc/arch/ppc/Makefile.inc | 1 + klibc/klibc/arch/ppc/include/klibc/archsetjmp.h | 36 -- klibc/klibc/arch/ppc/include/klibc/archsignal.h | 13 - klibc/klibc/arch/ppc/include/klibc/archsys.h | 61 --- klibc/klibc/arch/ppc/syscall.S | 16 + klibc/klibc/arch/ppc/sysstub.ph | 25 ++ klibc/klibc/arch/ppc64/MCONFIG | 7 + klibc/klibc/arch/ppc64/Makefile.inc | 12 +- klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h | 36 -- klibc/klibc/arch/ppc64/include/klibc/archsignal.h | 13 - klibc/klibc/arch/ppc64/include/klibc/archsys.h | 52 --- klibc/klibc/arch/ppc64/setjmp.S | 69 +++- klibc/klibc/arch/ppc64/syscall.c | 14 + klibc/klibc/arch/ppc64/sysstub.ph | 34 ++ klibc/klibc/arch/s390/Makefile.inc | 2 + klibc/klibc/arch/s390/include/klibc/archsetjmp.h | 15 - klibc/klibc/arch/s390/include/klibc/archsignal.h | 13 - klibc/klibc/arch/s390/include/klibc/archsys.h | 41 -- klibc/klibc/arch/s390/mmap.c | 41 ++ klibc/klibc/arch/s390/syscall.c | 16 + klibc/klibc/arch/s390/sysstub.ph | 31 ++ klibc/klibc/arch/s390x/Makefile.inc | 4 +- klibc/klibc/arch/s390x/include/klibc/archsetjmp.h | 15 - klibc/klibc/arch/s390x/include/klibc/archsignal.h | 13 - klibc/klibc/arch/s390x/include/klibc/archsys.h | 41 -- klibc/klibc/arch/s390x/mmap.c | 41 ++ klibc/klibc/arch/s390x/syscall.c | 16 + klibc/klibc/arch/s390x/sysstub.ph | 28 ++ klibc/klibc/arch/sh/Makefile.inc | 3 +- klibc/klibc/arch/sh/crt0.S | 11 +- klibc/klibc/arch/sh/include/klibc/archsetjmp.h | 22 - klibc/klibc/arch/sh/include/klibc/archsignal.h | 13 - klibc/klibc/arch/sh/include/klibc/archsys.h | 12 - klibc/klibc/arch/sh/syscall.S | 35 ++ klibc/klibc/arch/sh/sysstub.ph | 34 ++ klibc/klibc/arch/sparc/Makefile.inc | 4 +- klibc/klibc/arch/sparc/include/klibc/archsetjmp.h | 16 - klibc/klibc/arch/sparc/include/klibc/archsignal.h | 13 - klibc/klibc/arch/sparc/include/klibc/archsys.h | 65 --- klibc/klibc/arch/sparc/include/machine/asm.h | 192 --------- klibc/klibc/arch/sparc/include/machine/frame.h | 138 ------- klibc/klibc/arch/sparc/include/machine/trap.h | 141 ------- klibc/klibc/arch/sparc/syscall.S | 19 + klibc/klibc/arch/sparc/sysfork.S | 25 ++ klibc/klibc/arch/sparc/sysstub.ph | 25 ++ klibc/klibc/arch/sparc64/Makefile.inc | 4 +- .../klibc/arch/sparc64/include/klibc/archsetjmp.h | 16 - .../klibc/arch/sparc64/include/klibc/archsignal.h | 13 - klibc/klibc/arch/sparc64/include/klibc/archsys.h | 157 ------- klibc/klibc/arch/sparc64/syscall.S | 18 + klibc/klibc/arch/sparc64/sysfork.S | 26 ++ klibc/klibc/arch/sparc64/sysstub.ph | 25 ++ klibc/klibc/arch/x86_64/MCONFIG | 8 +- klibc/klibc/arch/x86_64/Makefile.inc | 3 +- klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h | 21 - klibc/klibc/arch/x86_64/include/klibc/archsignal.h | 13 - klibc/klibc/arch/x86_64/include/klibc/archsys.h | 109 ----- klibc/klibc/arch/x86_64/include/sys/io.h | 126 ------ klibc/klibc/arch/x86_64/syscall.S | 28 ++ klibc/klibc/arch/x86_64/sysstub.ph | 23 ++ klibc/klibc/asprintf.c | 30 ++ klibc/klibc/ctypes.c | 386 +++++++++--------- klibc/klibc/daemon.c | 38 ++ klibc/klibc/fdatasync.c | 15 - klibc/klibc/fork.c | 14 +- klibc/klibc/fstatfs.c | 19 + klibc/klibc/getcwd.c | 5 +- klibc/klibc/getpagesize.c | 26 -- klibc/klibc/getpriority.c | 12 +- klibc/klibc/include/alloca.h | 13 - klibc/klibc/include/arpa/inet.h | 24 -- klibc/klibc/include/assert.h | 22 - klibc/klibc/include/bits32/bitsize/limits.h | 14 - klibc/klibc/include/bits32/bitsize/stddef.h | 18 - klibc/klibc/include/bits32/bitsize/stdint.h | 34 -- klibc/klibc/include/bits32/bitsize/stdintconst.h | 18 - klibc/klibc/include/bits32/bitsize/stdintlimits.h | 22 - klibc/klibc/include/bits64/bitsize/limits.h | 14 - klibc/klibc/include/bits64/bitsize/stddef.h | 13 - klibc/klibc/include/bits64/bitsize/stdint.h | 36 -- klibc/klibc/include/bits64/bitsize/stdintconst.h | 18 - klibc/klibc/include/bits64/bitsize/stdintlimits.h | 22 - klibc/klibc/include/ctype.h | 118 ------ klibc/klibc/include/dirent.h | 20 - klibc/klibc/include/elf.h | 12 - klibc/klibc/include/endian.h | 42 -- klibc/klibc/include/errno.h | 8 - klibc/klibc/include/fcntl.h | 11 - klibc/klibc/include/grp.h | 13 - klibc/klibc/include/inttypes.h | 226 ---------- klibc/klibc/include/klibc/compiler.h | 106 ----- klibc/klibc/include/klibc/diverr.h | 16 - klibc/klibc/include/klibc/extern.h | 14 - klibc/klibc/include/limits.h | 40 -- klibc/klibc/include/net/if.h | 1 - klibc/klibc/include/net/if_arp.h | 1 - klibc/klibc/include/net/if_ether.h | 1 - klibc/klibc/include/net/if_packet.h | 1 - klibc/klibc/include/netinet/in.h | 33 -- klibc/klibc/include/netinet/in6.h | 10 - klibc/klibc/include/netinet/ip.h | 13 - klibc/klibc/include/netinet/tcp.h | 11 - klibc/klibc/include/netinet/udp.h | 19 - klibc/klibc/include/poll.h | 16 - klibc/klibc/include/sched.h | 23 -- klibc/klibc/include/setjmp.h | 43 -- klibc/klibc/include/signal.h | 80 ---- klibc/klibc/include/stdarg.h | 14 - klibc/klibc/include/stddef.h | 24 -- klibc/klibc/include/stdint.h | 116 ------ klibc/klibc/include/stdio.h | 115 ------ klibc/klibc/include/stdlib.h | 96 ----- klibc/klibc/include/string.h | 40 -- klibc/klibc/include/sys/dirent.h | 13 - klibc/klibc/include/sys/elf32.h | 115 ------ klibc/klibc/include/sys/elf64.h | 115 ------ klibc/klibc/include/sys/elfcommon.h | 186 --------- klibc/klibc/include/sys/fsuid.h | 14 - klibc/klibc/include/sys/ioctl.h | 14 - klibc/klibc/include/sys/klog.h | 24 -- klibc/klibc/include/sys/mman.h | 21 - klibc/klibc/include/sys/mount.h | 55 --- klibc/klibc/include/sys/param.h | 11 - klibc/klibc/include/sys/reboot.h | 25 -- klibc/klibc/include/sys/resource.h | 15 - klibc/klibc/include/sys/select.h | 13 - klibc/klibc/include/sys/socket.h | 50 --- klibc/klibc/include/sys/socketcalls.h | 28 -- klibc/klibc/include/sys/stat.h | 23 -- klibc/klibc/include/sys/syscall.h | 15 - klibc/klibc/include/sys/sysinfo.h | 12 - klibc/klibc/include/sys/sysmacros.h | 31 -- klibc/klibc/include/sys/time.h | 17 - klibc/klibc/include/sys/types.h | 125 ------ klibc/klibc/include/sys/uio.h | 15 - klibc/klibc/include/sys/un.h | 10 - klibc/klibc/include/sys/utime.h | 10 - klibc/klibc/include/sys/utsname.h | 23 -- klibc/klibc/include/sys/vfs.h | 14 - klibc/klibc/include/sys/wait.h | 28 -- klibc/klibc/include/syslog.h | 55 --- klibc/klibc/include/termios.h | 86 ---- klibc/klibc/include/time.h | 14 - klibc/klibc/include/unistd.h | 122 ------ klibc/klibc/include/utime.h | 15 - klibc/klibc/inet/bindresvport.c | 21 +- klibc/klibc/interp.S | 4 +- klibc/klibc/jrand48.c | 24 ++ klibc/klibc/libc_init.c | 86 ++++ klibc/klibc/llseek.c | 25 +- klibc/klibc/lrand48.c | 32 +- klibc/klibc/makeerrlist.pl | 21 +- klibc/klibc/malloc.c | 7 +- klibc/klibc/malloc.h | 8 +- klibc/klibc/mmap.c | 34 +- klibc/klibc/mrand48.c | 13 + klibc/klibc/nice.c | 6 +- klibc/klibc/nrand48.c | 11 + klibc/klibc/open.c | 22 +- klibc/klibc/pause.c | 6 +- klibc/klibc/perror.c | 3 +- klibc/klibc/putchar.c | 15 + klibc/klibc/qsort.c | 4 +- klibc/klibc/readdir.c | 23 +- klibc/klibc/sbrk.c | 30 +- klibc/klibc/seed48.c | 2 +- klibc/klibc/select.c | 9 - klibc/klibc/setresgid.c | 29 -- klibc/klibc/setresuid.c | 30 -- klibc/klibc/sha1hash.c | 2 +- klibc/klibc/sigaction.c | 6 +- klibc/klibc/sigpending.c | 6 +- klibc/klibc/sigprocmask.c | 6 +- klibc/klibc/sigsuspend.c | 6 +- klibc/klibc/socketcalls.pl | 61 +-- klibc/klibc/socketcommon.h | 11 +- klibc/klibc/srand48.c | 3 +- klibc/klibc/statfs.c | 19 + klibc/klibc/strerror.c | 20 +- klibc/klibc/strlcat.c | 31 ++ klibc/klibc/strlcpy.c | 26 ++ klibc/klibc/strncat.c | 16 +- klibc/klibc/strncpy.c | 8 +- klibc/klibc/strnlen.c | 19 + klibc/klibc/strtotimespec.c | 5 + klibc/klibc/strtotimeval.c | 5 + klibc/klibc/strtotimex.c | 39 ++ klibc/klibc/syscalls.pl | 129 +++--- klibc/klibc/syslog.c | 19 +- klibc/klibc/tests/fcntl.c | 53 +++ klibc/klibc/tests/getpagesize.c | 11 + klibc/klibc/tests/malloctest2.c | 60 +++ klibc/klibc/tests/microhello.c | 2 +- klibc/klibc/tests/minips.c | 453 --------------------- klibc/klibc/tests/mmaptest.c | 28 ++ klibc/klibc/tests/opentest.c | 17 + klibc/klibc/tests/stat.c | 65 +++ klibc/klibc/tests/statfs.c | 43 ++ klibc/klibc/tests/strtoimax.c | 24 ++ klibc/klibc/tests/strtotime.c | 27 ++ klibc/klibc/time.c | 6 +- klibc/klibc/utime.c | 8 +- klibc/klibc/vasprintf.c | 25 ++ klibc/version | 2 +- 288 files changed, 3419 insertions(+), 6726 deletions(-) create mode 100644 klibc/klibc.spec delete mode 100644 klibc/klibc/SOCKETCALLS create mode 100644 klibc/klibc/SOCKETCALLS.def delete mode 100644 klibc/klibc/SYSCALLS create mode 100644 klibc/klibc/SYSCALLS.def delete mode 100644 klibc/klibc/arch/alpha/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/alpha/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/alpha/include/klibc/archsys.h delete mode 100644 klibc/klibc/arch/alpha/include/machine/asm.h create mode 100644 klibc/klibc/arch/alpha/syscall.S create mode 100644 klibc/klibc/arch/alpha/sysdual.S create mode 100644 klibc/klibc/arch/alpha/sysstub.ph delete mode 100644 klibc/klibc/arch/arm/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/arm/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/arm/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/arm/syscall.S create mode 100644 klibc/klibc/arch/arm/sysstub.ph create mode 100644 klibc/klibc/arch/cris/__negdi2.S create mode 100644 klibc/klibc/arch/cris/crt0.S create mode 100644 klibc/klibc/arch/cris/divide.c delete mode 100644 klibc/klibc/arch/cris/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/cris/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/cris/setjmp.S create mode 100644 klibc/klibc/arch/cris/syscall.S create mode 100644 klibc/klibc/arch/cris/sysstub.ph delete mode 100644 klibc/klibc/arch/i386/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/i386/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/i386/include/klibc/archsys.h delete mode 100644 klibc/klibc/arch/i386/include/klibc/diverr.h delete mode 100644 klibc/klibc/arch/i386/include/sys/io.h delete mode 100644 klibc/klibc/arch/i386/include/sys/vm86.h create mode 100644 klibc/klibc/arch/i386/open.S create mode 100644 klibc/klibc/arch/i386/syscall.S create mode 100644 klibc/klibc/arch/i386/sysstub.ph delete mode 100644 klibc/klibc/arch/ia64/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/ia64/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/ia64/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/ia64/syscall.S create mode 100644 klibc/klibc/arch/ia64/sysstub.ph delete mode 100644 klibc/klibc/arch/m68k/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/m68k/include/klibc/archsys.h delete mode 100644 klibc/klibc/arch/mips/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/mips/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/mips/include/klibc/archsys.h delete mode 100644 klibc/klibc/arch/mips/include/machine/asm.h delete mode 100644 klibc/klibc/arch/mips/include/sgidefs.h create mode 100644 klibc/klibc/arch/mips/klibc.ld create mode 100644 klibc/klibc/arch/mips/syscall.S create mode 100644 klibc/klibc/arch/mips/sysstub.ph delete mode 100644 klibc/klibc/arch/mips64/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/mips64/include/klibc/archsys.h delete mode 100644 klibc/klibc/arch/parisc/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/parisc/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/parisc/syscall.c create mode 100644 klibc/klibc/arch/parisc/sysstub.ph delete mode 100644 klibc/klibc/arch/ppc/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/ppc/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/ppc/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/ppc/syscall.S create mode 100644 klibc/klibc/arch/ppc/sysstub.ph delete mode 100644 klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/ppc64/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/ppc64/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/ppc64/syscall.c create mode 100644 klibc/klibc/arch/ppc64/sysstub.ph delete mode 100644 klibc/klibc/arch/s390/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/s390/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/s390/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/s390/mmap.c create mode 100644 klibc/klibc/arch/s390/syscall.c create mode 100644 klibc/klibc/arch/s390/sysstub.ph delete mode 100644 klibc/klibc/arch/s390x/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/s390x/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/s390x/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/s390x/mmap.c create mode 100644 klibc/klibc/arch/s390x/syscall.c create mode 100644 klibc/klibc/arch/s390x/sysstub.ph delete mode 100644 klibc/klibc/arch/sh/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/sh/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/sh/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/sh/syscall.S create mode 100644 klibc/klibc/arch/sh/sysstub.ph delete mode 100644 klibc/klibc/arch/sparc/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/sparc/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/sparc/include/klibc/archsys.h delete mode 100644 klibc/klibc/arch/sparc/include/machine/asm.h delete mode 100644 klibc/klibc/arch/sparc/include/machine/frame.h delete mode 100644 klibc/klibc/arch/sparc/include/machine/trap.h create mode 100644 klibc/klibc/arch/sparc/syscall.S create mode 100644 klibc/klibc/arch/sparc/sysfork.S create mode 100644 klibc/klibc/arch/sparc/sysstub.ph delete mode 100644 klibc/klibc/arch/sparc64/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/sparc64/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/sparc64/include/klibc/archsys.h create mode 100644 klibc/klibc/arch/sparc64/syscall.S create mode 100644 klibc/klibc/arch/sparc64/sysfork.S create mode 100644 klibc/klibc/arch/sparc64/sysstub.ph delete mode 100644 klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h delete mode 100644 klibc/klibc/arch/x86_64/include/klibc/archsignal.h delete mode 100644 klibc/klibc/arch/x86_64/include/klibc/archsys.h delete mode 100644 klibc/klibc/arch/x86_64/include/sys/io.h create mode 100644 klibc/klibc/arch/x86_64/syscall.S create mode 100644 klibc/klibc/arch/x86_64/sysstub.ph create mode 100644 klibc/klibc/asprintf.c create mode 100644 klibc/klibc/daemon.c delete mode 100644 klibc/klibc/fdatasync.c create mode 100644 klibc/klibc/fstatfs.c delete mode 100644 klibc/klibc/getpagesize.c delete mode 100644 klibc/klibc/include/alloca.h delete mode 100644 klibc/klibc/include/arpa/inet.h delete mode 100644 klibc/klibc/include/assert.h delete mode 100644 klibc/klibc/include/bits32/bitsize/limits.h delete mode 100644 klibc/klibc/include/bits32/bitsize/stddef.h delete mode 100644 klibc/klibc/include/bits32/bitsize/stdint.h delete mode 100644 klibc/klibc/include/bits32/bitsize/stdintconst.h delete mode 100644 klibc/klibc/include/bits32/bitsize/stdintlimits.h delete mode 100644 klibc/klibc/include/bits64/bitsize/limits.h delete mode 100644 klibc/klibc/include/bits64/bitsize/stddef.h delete mode 100644 klibc/klibc/include/bits64/bitsize/stdint.h delete mode 100644 klibc/klibc/include/bits64/bitsize/stdintconst.h delete mode 100644 klibc/klibc/include/bits64/bitsize/stdintlimits.h delete mode 100644 klibc/klibc/include/ctype.h delete mode 100644 klibc/klibc/include/dirent.h delete mode 100644 klibc/klibc/include/elf.h delete mode 100644 klibc/klibc/include/endian.h delete mode 100644 klibc/klibc/include/errno.h delete mode 100644 klibc/klibc/include/fcntl.h delete mode 100644 klibc/klibc/include/grp.h delete mode 100644 klibc/klibc/include/inttypes.h delete mode 100644 klibc/klibc/include/klibc/compiler.h delete mode 100644 klibc/klibc/include/klibc/diverr.h delete mode 100644 klibc/klibc/include/klibc/extern.h delete mode 100644 klibc/klibc/include/limits.h delete mode 100644 klibc/klibc/include/net/if.h delete mode 100644 klibc/klibc/include/net/if_arp.h delete mode 100644 klibc/klibc/include/net/if_ether.h delete mode 100644 klibc/klibc/include/net/if_packet.h delete mode 100644 klibc/klibc/include/netinet/in.h delete mode 100644 klibc/klibc/include/netinet/in6.h delete mode 100644 klibc/klibc/include/netinet/ip.h delete mode 100644 klibc/klibc/include/netinet/tcp.h delete mode 100644 klibc/klibc/include/netinet/udp.h delete mode 100644 klibc/klibc/include/poll.h delete mode 100644 klibc/klibc/include/sched.h delete mode 100644 klibc/klibc/include/setjmp.h delete mode 100644 klibc/klibc/include/signal.h delete mode 100644 klibc/klibc/include/stdarg.h delete mode 100644 klibc/klibc/include/stddef.h delete mode 100644 klibc/klibc/include/stdint.h delete mode 100644 klibc/klibc/include/stdio.h delete mode 100644 klibc/klibc/include/stdlib.h delete mode 100644 klibc/klibc/include/string.h delete mode 100644 klibc/klibc/include/sys/dirent.h delete mode 100644 klibc/klibc/include/sys/elf32.h delete mode 100644 klibc/klibc/include/sys/elf64.h delete mode 100644 klibc/klibc/include/sys/elfcommon.h delete mode 100644 klibc/klibc/include/sys/fsuid.h delete mode 100644 klibc/klibc/include/sys/ioctl.h delete mode 100644 klibc/klibc/include/sys/klog.h delete mode 100644 klibc/klibc/include/sys/mman.h delete mode 100644 klibc/klibc/include/sys/mount.h delete mode 100644 klibc/klibc/include/sys/param.h delete mode 100644 klibc/klibc/include/sys/reboot.h delete mode 100644 klibc/klibc/include/sys/resource.h delete mode 100644 klibc/klibc/include/sys/select.h delete mode 100644 klibc/klibc/include/sys/socket.h delete mode 100644 klibc/klibc/include/sys/socketcalls.h delete mode 100644 klibc/klibc/include/sys/stat.h delete mode 100644 klibc/klibc/include/sys/syscall.h delete mode 100644 klibc/klibc/include/sys/sysinfo.h delete mode 100644 klibc/klibc/include/sys/sysmacros.h delete mode 100644 klibc/klibc/include/sys/time.h delete mode 100644 klibc/klibc/include/sys/types.h delete mode 100644 klibc/klibc/include/sys/uio.h delete mode 100644 klibc/klibc/include/sys/un.h delete mode 100644 klibc/klibc/include/sys/utime.h delete mode 100644 klibc/klibc/include/sys/utsname.h delete mode 100644 klibc/klibc/include/sys/vfs.h delete mode 100644 klibc/klibc/include/sys/wait.h delete mode 100644 klibc/klibc/include/syslog.h delete mode 100644 klibc/klibc/include/termios.h delete mode 100644 klibc/klibc/include/time.h delete mode 100644 klibc/klibc/include/unistd.h delete mode 100644 klibc/klibc/include/utime.h create mode 100644 klibc/klibc/jrand48.c create mode 100644 klibc/klibc/libc_init.c create mode 100644 klibc/klibc/mrand48.c create mode 100644 klibc/klibc/nrand48.c create mode 100644 klibc/klibc/putchar.c delete mode 100644 klibc/klibc/select.c delete mode 100644 klibc/klibc/setresgid.c delete mode 100644 klibc/klibc/setresuid.c create mode 100644 klibc/klibc/statfs.c create mode 100644 klibc/klibc/strlcat.c create mode 100644 klibc/klibc/strlcpy.c create mode 100644 klibc/klibc/strnlen.c create mode 100644 klibc/klibc/strtotimespec.c create mode 100644 klibc/klibc/strtotimeval.c create mode 100644 klibc/klibc/strtotimex.c create mode 100644 klibc/klibc/tests/fcntl.c create mode 100644 klibc/klibc/tests/getpagesize.c create mode 100644 klibc/klibc/tests/malloctest2.c delete mode 100644 klibc/klibc/tests/minips.c create mode 100644 klibc/klibc/tests/mmaptest.c create mode 100644 klibc/klibc/tests/opentest.c create mode 100644 klibc/klibc/tests/stat.c create mode 100644 klibc/klibc/tests/statfs.c create mode 100644 klibc/klibc/tests/strtoimax.c create mode 100644 klibc/klibc/tests/strtotime.c create mode 100644 klibc/klibc/vasprintf.c diff --git a/klibc/MCONFIG b/klibc/MCONFIG index ec8b65c0e4..d2aa23626c 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -3,22 +3,29 @@ # Makefile configuration, without explicit rules # +# Eventually support separate compilation, but we don't have it yet... +OBJROOT = $(SRCROOT) + ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) CROSS = CC = $(CROSS)gcc LD = $(CROSS)ld KLIBSRC = $(SRCROOT)/klibc -REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include -I$(KLIBSRC) \ - -I$(KLIBSRC)/arch/$(ARCH)/include \ - -I$(KLIBSRC)/include/bits$(BITSIZE) \ - -D__KLIBC__ -DBITSIZE=$(BITSIZE) -I$(KLIBSRC)/include \ - -I$(KERNEL_DIR)/include +KLIBOBJ = $(OBJROOT)/klibc +REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include \ + -D__KLIBC__ -DBITSIZE=$(BITSIZE) \ + -I$(SRCROOT)/include/arch/$(ARCH) \ + -I$(SRCROOT)/include/bits$(BITSIZE) \ + -I$(SRCROOT)/include \ + -I$(SRCROOT)/linux/include -I$(SRCROOT)/linux/include2 + LDFLAGS = AR = $(CROSS)ar RANLIB = $(CROSS)ranlib NM = $(CROSS)nm PERL = perl STRIP = $(CROSS)strip --strip-all -R .comment -R .note +OBJCOPY = $(CROSS)objcopy HOST_CC = gcc HOST_CFLAGS = -g -O @@ -26,13 +33,13 @@ HOST_LDFLAGS = HOST_LIBS = # Static library paths -CRT0 = $(KLIBSRC)/crt0.o -KLIBC = $(KLIBSRC)/libc.a +CRT0 = $(KLIBOBJ)/crt0.o +KLIBC = $(KLIBOBJ)/libc.a LIBGCC = $(shell $(CC) --print-libgcc) # Shared library paths -CRTSHARED = $(KLIBSRC)/interp.o -LIBSHARED = $(KLIBSRC)/libc.so +CRTSHARED = $(KLIBOBJ)/interp.o +LIBSHARED = $(KLIBOBJ)/libc.so # # This indicates the location of the final version of the shared library. @@ -41,7 +48,15 @@ LIBSHARED = $(KLIBSRC)/libc.so # SHLIBDIR = /lib +# Enable this to make perror/strerror return real error messages +# This makes klibc.so and any static binary which uses these functions +# about 4K bigger. +ERRLIST = 1 + # # Include arch-specific rule fragments # include $(KLIBSRC)/arch/$(ARCH)/MCONFIG + +# How to tell the linker main() is the entrypoint +EMAIN ?= -e main diff --git a/klibc/Makefile b/klibc/Makefile index ef5fbabff8..8823a33bfd 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -10,7 +10,7 @@ klibc.spec: klibc.spec.in version .PHONY: rpm rpm: klibc.spec - +$(rpmbuild) -bb klibc.spec + +$(rpmbuild) -bb klibc.spec --target=$(ARCH) %: @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done diff --git a/klibc/README b/klibc/README index 4381364874..eb72e1c239 100644 --- a/klibc/README +++ b/klibc/README @@ -1,4 +1,5 @@ -Please see klibc/README for build instructions. +Please see klibc/README for build instructions and for the status of +various platforms. diff --git a/klibc/klibc.spec b/klibc/klibc.spec new file mode 100644 index 0000000000..6166a35c4d --- /dev/null +++ b/klibc/klibc.spec @@ -0,0 +1,157 @@ +Summary: A minimal libc subset for use with initramfs. +Name: klibc +Version: 0.181 +Release: 1 +License: BSD/GPL +Group: Development/Libraries +URL: http://www.zytor.com/mailman/listinfo/klibc +Source: http://www.kernel.org/pub/linux/libs/klibc-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +BuildRequires: kernel-source >= 2.6.0 +Packager: H. Peter Anvin +Prefix: /usr +Vendor: Starving Linux Artists + +%description +%{name} is intended to be a minimalistic libc subset for use with +initramfs. It is deliberately written for small size, minimal +entanglement, and portability, not speed. It is definitely a work in +progress, and a lot of things are still missing. + +%package kernheaders +Summary: Kernel headers used during the build of klibc. +Group: Development/Libraries + +%description kernheaders +This package contains the set of kernel headers that were required to +build %{name} and the utilities that ship with it. This may or may +not be a complete enough set to build other programs that link against +%{name}. If in doubt, use real kernel headers instead. + +%package utils +Summary: Small statically-linked utilities built with klibc. +Group: Utilities/System + +%description utils + +This package contains a collection of programs that are statically +linked against klibc. These duplicate some of the functionality of a +regular Linux toolset, but are typically much smaller than their +full-function counterparts. They are intended for inclusion in +initramfs images and embedded systems. + +%prep +%setup -q +cp -as /usr/src/linux-`rpm -q kernel-source | tail -1 | cut -d- -f3-` ./linux +make -C linux defconfig ARCH=%{_target_cpu} +make -C linux prepare ARCH=%{_target_cpu} +# Deal with braindamage in RedHat's kernel-source RPM +rm -f linux/include/linux/config.h +cat < linux/include/linux/config.h +#ifndef _LINUX_CONFIG_H +#define _LINUX_CONFIG_H + +#include + +#endif +EOF +mkdir -p %{buildroot} + +%build +make ARCH=%{_target_cpu} + +%install +rm -rf %{buildroot} + +dest=%{buildroot}/%{prefix} +lib=$dest/%{_lib}/klibc +inc=$dest/include/klibc +exe=$dest/libexec/klibc +doc=$dest/share/doc/%{name}-%{version} +udoc=$dest/share/doc/%{name}-utils-%{version} + +# First, the library. + +install -dD -m 755 $lib $inc/kernel $exe $doc $udoc +install -m 755 klibc/klibc.so $lib +install -m 644 klibc/libc.a $lib +install -m 644 klibc/crt0.o $lib +install -m 644 klibc/libc.so.hash $lib +ln $lib/klibc.so $lib/libc.so +ln $lib/klibc.so $lib/klibc-$(cat $lib/libc.so.hash).so + +# Next, the generated binaries. +# These are currently static binaries, should we go for shared? + +install -m 755 ash/sh $exe +install -m 755 gzip/gzip $exe +ln $exe/gzip $exe/gunzip +ln $exe/gzip $exe/zcat +install -m 755 ipconfig/ipconfig $exe +install -m 755 kinit/kinit $exe +install -m 755 nfsmount/nfsmount $exe +install -m 755 utils/static/* $exe + +# The docs. + +install -m 444 README $doc +install -m 444 klibc/README $doc/README.klibc +install -m 444 klibc/arch/README $doc/README.klibc.arch + +install -m 444 gzip/COPYING $udoc/COPYING.gzip +install -m 444 gzip/README $udoc/README.gzip +install -m 444 ipconfig/README $udoc/README.ipconfig +install -m 444 kinit/README $udoc/README.kinit + +# Finally, the include files. + +bitsize=$(make --no-print-directory -C klibc bitsize ARCH=%{_target_cpu}) +cp --parents $(find klibc/include \( -name CVS -o -name SCCS \) -prune \ + -o -name '*.h' -print) $inc +mv $inc/klibc $inc/klibc.$$ +mv $inc/klibc.$$/include/* $inc +mv $inc/bits$bitsize/bitsize $inc +rm -rf $inc/klibc.$$ $inc/bits[0-9]* +pushd klibc/arch/%{_arch}/include +cp --parents -f $(find . \( -name CVS -o -name SCCS \) -prune \ + -o -name '*.h' -print) $inc +popd + +# Yeugh. Find the transitive closure over all kernel headers included +# by klibc, and copy them into place. + +find . -name '.*.d' | xargs -r sed -e 's,[ \t][ \t]*,\n,g' | sed -n -e 's,^\.\./linux/include/,,p' | sort | uniq | (cd linux/include && xargs -ri cp --parents '{}' $inc/kernel) + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%docdir %{prefix}/share/doc/%{name}-%{version} +%{prefix}/%{_lib}/klibc +%dir %{prefix}/include/klibc +%{prefix}/include/klibc/*.h +%{prefix}/include/klibc/arpa +%{prefix}/include/klibc/bitsize +%{prefix}/include/klibc/klibc +%{prefix}/include/klibc/net +%{prefix}/include/klibc/netinet +%{prefix}/include/klibc/sys +%{prefix}/share/doc/%{name}-%{version} + +%files kernheaders +%defattr(-,root,root,-) +%{prefix}/include/klibc/kernel + +%files utils +%defattr(-,root,root,-) +%{prefix}/libexec/klibc +%docdir %{prefix}/share/doc/%{name}-utils-%{version} +%{prefix}/share/doc/%{name}-utils-%{version} + +%changelog +* Tue Jul 6 2004 H. Peter Anvin +- Update to use kernel-source RPM for the kernel symlink. + +* Sat Nov 29 2003 Bryan O'Sullivan - +- Initial build. diff --git a/klibc/klibc.spec.in b/klibc/klibc.spec.in index f8bccc390e..8f5b2618d0 100644 --- a/klibc/klibc.spec.in +++ b/klibc/klibc.spec.in @@ -1,16 +1,14 @@ -%define _rpmdir rpms -%define _builddir . - Summary: A minimal libc subset for use with initramfs. Name: klibc -Version: 0.89 +Version: @@VERSION@@ Release: 1 License: BSD/GPL Group: Development/Libraries -URL: http://www.zytor.com/klibc -Source: /dev/null +URL: http://www.zytor.com/mailman/listinfo/klibc +Source: http://www.kernel.org/pub/linux/libs/klibc-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -Packager: Bryan O'Sullivan +BuildRequires: kernel-source >= 2.6.0 +Packager: H. Peter Anvin Prefix: /usr Vendor: Starving Linux Artists @@ -43,18 +41,24 @@ full-function counterparts. They are intended for inclusion in initramfs images and embedded systems. %prep -if [ ! -L linux ]; then - echo "*** You must have a symlink named linux to build klibc" 1>&2 - exit 1 -fi -if [ ! -f linux/include/asm/page.h ]; then - echo "*** You need to 'make prepare' in the linux tree before building klibc" 1>&2 - exit 1 -fi -mkdir -p %{buildroot} %{_rpmdir} +%setup -q +cp -as /usr/src/linux-`rpm -q kernel-source | tail -1 | cut -d- -f3-` ./linux +make -C linux defconfig ARCH=%{_target_cpu} +make -C linux prepare ARCH=%{_target_cpu} +# Deal with braindamage in RedHat's kernel-source RPM +rm -f linux/include/linux/config.h +cat < linux/include/linux/config.h +#ifndef _LINUX_CONFIG_H +#define _LINUX_CONFIG_H + +#include + +#endif +EOF +mkdir -p %{buildroot} %build -make +make ARCH=%{_target_cpu} %install rm -rf %{buildroot} @@ -77,6 +81,7 @@ ln $lib/klibc.so $lib/libc.so ln $lib/klibc.so $lib/klibc-$(cat $lib/libc.so.hash).so # Next, the generated binaries. +# These are currently static binaries, should we go for shared? install -m 755 ash/sh $exe install -m 755 gzip/gzip $exe @@ -85,9 +90,7 @@ ln $exe/gzip $exe/zcat install -m 755 ipconfig/ipconfig $exe install -m 755 kinit/kinit $exe install -m 755 nfsmount/nfsmount $exe -for i in chroot dd fstype mkdir mkfifo mount umount; do - install -m 755 utils/$i $exe -done +install -m 755 utils/static/* $exe # The docs. @@ -102,7 +105,7 @@ install -m 444 kinit/README $udoc/README.kinit # Finally, the include files. -bitsize=$(make --no-print-directory -C klibc bitsize) +bitsize=$(make --no-print-directory -C klibc bitsize ARCH=%{_target_cpu}) cp --parents $(find klibc/include \( -name CVS -o -name SCCS \) -prune \ -o -name '*.h' -print) $inc mv $inc/klibc $inc/klibc.$$ @@ -147,5 +150,8 @@ rm -rf $RPM_BUILD_ROOT %{prefix}/share/doc/%{name}-utils-%{version} %changelog +* Tue Jul 6 2004 H. Peter Anvin +- Update to use kernel-source RPM for the kernel symlink. + * Sat Nov 29 2003 Bryan O'Sullivan - - Initial build. diff --git a/klibc/klibc/MCONFIG b/klibc/klibc/MCONFIG index 253a9461b7..5b6eecd037 100644 --- a/klibc/klibc/MCONFIG +++ b/klibc/klibc/MCONFIG @@ -8,6 +8,11 @@ include ../MCONFIG include ../MRULES WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline + +ifeq ($(ERRLIST),1) +REQFLAGS += -DWITH_ERRLIST +endif + CFLAGS = -Wp,-MD,$(dir $*).$(notdir $*).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) SOFLAGS = -fPIC diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index 7ed03a8e87..d7e75f1814 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -10,6 +10,7 @@ include MCONFIG TESTS = $(patsubst %.c,%,$(wildcard tests/*.c)) \ $(patsubst %.c,%.shared,$(wildcard tests/*.c)) LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ + asprintf.o vasprintf.o \ vsscanf.o sscanf.o ctypes.o \ strntoumax.o strntoimax.o \ atoi.o atol.o atoll.o \ @@ -18,41 +19,51 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ globals.o exitc.o atexit.o onexit.o \ execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \ fork.o wait.o wait3.o waitpid.o system.o setpgrp.o getpgrp.o \ - open.o \ + daemon.o \ printf.o vprintf.o fprintf.o vfprintf.o perror.o \ - fopen.o fread.o fread2.o fgetc.o fgets.o \ - fwrite.o fwrite2.o fputc.o fputs.o puts.o \ - sleep.o usleep.o raise.o abort.o assert.o alarm.o pause.o \ + statfs.o fstatfs.o umount.o \ + open.o fopen.o fread.o fread2.o fgetc.o fgets.o \ + fwrite.o fwrite2.o fputc.o fputs.o puts.o putchar.o \ + sleep.o usleep.o strtotimespec.o strtotimeval.o \ + raise.o abort.o assert.o alarm.o pause.o \ __signal.o sysv_signal.o bsd_signal.o siglist.o siglongjmp.o \ sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ - brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o getpagesize.o \ + brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ - memmove.o \ + memmove.o memchr.o \ strcasecmp.o strncasecmp.o strndup.o strerror.o \ - strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o \ - strncat.o strstr.o strncmp.o strncpy.o strrchr.o strspn.o \ + strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \ + strncat.o strlcpy.o strlcat.o \ + strstr.o strncmp.o strncpy.o strrchr.o strspn.o \ strsep.o strtok.o \ gethostname.o getdomainname.o getcwd.o \ - seteuid.o setegid.o setresuid.o setresgid.o \ + seteuid.o setegid.o \ getenv.o setenv.o putenv.o __put_env.o unsetenv.o \ getopt.o readdir.o \ syslog.o closelog.o pty.o getpt.o isatty.o reboot.o \ - time.o utime.o fdatasync.o llseek.o select.o nice.o getpriority.o \ - qsort.o lrand48.o srand48.o seed48.o \ + time.o utime.o llseek.o nice.o getpriority.o \ + qsort.o \ + lrand48.o jrand48.o mrand48.o nrand48.o srand48.o seed48.o \ inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ send.o recv.o +ifeq ($(ERRLIST),1) +LIBOBJS += errlist.o +endif + SOLIB = libc.so SOHASH = klibc.so CRT0 = crt0.o LIB = libc.a -#all: tests $(CRT0) $(LIB) $(SOLIB) klibc.so -all: $(CRT0) $(LIB) $(SOLIB) klibc.so +INTERP_O = interp.o + +all: tests $(CRT0) $(LIB) $(SOLIB) klibc.so # Add any architecture-specific rules include arch/$(ARCH)/Makefile.inc +EMAIN ?= -e main tests: $(TESTS) @@ -71,19 +82,20 @@ tests/% : tests/%.o $(LIB) $(CRT0) $(STRIP) $@.stripped tests/%.shared : tests/%.o interp.o $(SOLIB) - $(LD) $(LDFLAGS) -o $@ -e main interp.o tests/$*.o -R $(SOLIB) $(LIBGCC) + $(LD) $(LDFLAGS) -o $@ $(EMAIN) interp.o tests/$*.o -R $(SOLIB) $(LIBGCC) cp $@ $@.stripped $(STRIP) $@.stripped $(LIB): __static_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/static.obj socketcalls/static.obj rm -f $(LIB) - $(AR) cq $(LIB) __static_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/*.o socketcalls/*.o + $(AR) cq $(LIB) __static_init.o $(LIBOBJS) $(ARCHOBJS) \ + $(wildcard syscalls/*.o) $(wildcard socketcalls/*.o) $(RANLIB) $(LIB) $(SOLIB): $(CRT0) __shared_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/static.obj socketcalls/static.obj $(LD) $(LDFLAGS) $(SHAREDFLAGS) -o $@ \ $(CRT0) __shared_init.o $(LIBOBJS) $(ARCHOBJS) \ - syscalls/*.o socketcalls/*.o \ + $(wildcard syscalls/*.o) $(wildcard socketcalls/*.o) \ $(LIBGCC) sha1hash: sha1hash.c @@ -99,7 +111,7 @@ $(SOHASH): $(SOLIB) $(SOLIB).hash rm -f klibc-??????????????????????.so ln -f $@ klibc-`cat $(SOLIB).hash`.so -interp.o: interp.S $(SOLIB).hash +$(INTERP_O): interp.S $(SOLIB).hash $(CC) $(CFLAGS) -D__ASSEMBLY__ -DLIBDIR=\"$(SHLIBDIR)\" \ -DSOHASH=\"`cat $(SOLIB).hash`\" \ -c -o $@ $< @@ -107,16 +119,29 @@ interp.o: interp.S $(SOLIB).hash crt0.o: arch/$(ARCH)/crt0.o cp arch/$(ARCH)/crt0.o . -syscalls.dir: SYSCALLS syscalls.pl syscommon.h +errlist.c: + $(PERL) makeerrlist.pl -errlist > $@ || rm -f $@ + +# We pass -ansi to keep cpp from define e.g. "i386" as well as "__i386__" +SYSCALLS.i: SYSCALLS.def + $(CC) $(CFLAGS) -D__ASSEMBLY__ -ansi -x assembler-with-cpp -E -o $@ $< + +syscalls.nrs: ../include/sys/syscall.h ../include/arch/$(ARCH)/klibc/archsys.h ../linux/include/asm/unistd.h + $(CC) $(CFLAGS) -Wp,-dM -x c -E -o $@ ../include/sys/syscall.h + +syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscalls.nrs rm -rf syscalls mkdir syscalls - $(PERL) syscalls.pl $(ARCH) SYSCALLS + $(PERL) syscalls.pl SYSCALLS.i $(ARCH) $(BITSIZE) syscalls.nrs ../include/klibc/havesyscall.h touch $@ -socketcalls.dir: SOCKETCALLS socketcalls.pl socketcommon.h +../include/klibc/havesyscall.h: syscalls.dir + : Generated by side effect + +socketcalls.dir: SOCKETCALLS.def socketcalls.pl socketcommon.h rm -rf socketcalls mkdir socketcalls - $(PERL) socketcalls.pl $(ARCH) SOCKETCALLS + $(PERL) socketcalls.pl SOCKETCALLS.def $(ARCH) touch $@ %/static.obj: %.dir @@ -133,9 +158,10 @@ clean: archclean rm -f $(TESTS) tests/*.stripped rm -rf syscalls syscalls.dir rm -rf socketcalls socketcalls.dir - rm -f sha1hash + rm -f sha1hash errlist.c spotless: clean + rm -f ../include/klibc/havesyscall.h syscalls.nrs find . \( -name \*~ -o -name '.*.d' \) -not -type d -print0 | \ xargs -0rt rm -f diff --git a/klibc/klibc/README b/klibc/klibc/README index d69fa8de41..edc8524f22 100644 --- a/klibc/klibc/README +++ b/klibc/klibc/README @@ -1,6 +1,6 @@ This is klibc, what is intended to be a minimalistic libc subset for use with initramfs. It is deliberately written for small size, -minimal entaglement and portability, not speed. It is definitely a +minimal entaglement, and portability, not speed. It is definitely a work in progress, and a lot of things are still missing. @@ -34,20 +34,38 @@ b) If you're cross-compiling, change ARCH in the main MCONFIG file to The following is the last known status of various architectures: - Known to work: alpha arm ia64 i386 ppc s390 s390x sparc - sparc64 x86_64* - Works static, not shared: mips* arm-thumb sh* parisc - Might work: ppc64 - Need porting work: cris m68k mips64 v850 - - x86_64: requires a kernel header patch (to be created) - mips, sh: linker problem; might work with fixed linker - - Shared library support requires binutils 2.13.90.0.4 or later on - many architectures. - - Note that even the "known to work" ones likely have bugs. Please - report them if you run into them. + alpha: Working static, shared untested + arm-thumb: Untested + arm26: Not yet ported + arm: Working + cris: Untested + h8300: Not yet ported + i386: Working + ia64: Working + m68k: Not yet ported + mips64: Not yet ported + mips: Working + parisc: Untested + ppc64: Working + ppc: Working + s390: Working static, shared untested + s390x: Working + sh: Untested + sparc64: sigaction() fails in ash for unknown reason + sparc: Working + v850: Not yet ported + x86-64: Working + + Shared library support requires recent binutils on many + architectures. + + "Need sysstub.ph" means the architectural changes first implemented + in klibc-0.117 has not yet been implemented; klibc-0.116 did, + however, work. "Not yet ported" means no porting work has been + done on this architecture. + + Note that even the "working" ones likely have bugs. Please report + them if you run into them. c) Type "make" and pray... diff --git a/klibc/klibc/SOCKETCALLS b/klibc/klibc/SOCKETCALLS deleted file mode 100644 index 1ab4e367a2..0000000000 --- a/klibc/klibc/SOCKETCALLS +++ /dev/null @@ -1,21 +0,0 @@ -# -*- fundamental -*- -# -# These are calls that are invoked via the socketcall mechanism -# -int socket(int, int, int) -int bind(int, struct sockaddr *, int) -int connect(int, struct sockaddr *, socklen_t) -int listen(int, int) -int accept(int, struct sockaddr *, socklen_t *) -int getsockname(int, struct sockaddr *, socklen_t *) -int getpeername(int, struct sockaddr *, socklen_t *) -int socketpair(int, int, int, int *) -# int send(int, const void *, size_t, unsigned int) -int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t) -# int recv(int, void *, size_t, unsigned int) -int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) -int shutdown(int, int) -int setsockopt(int, int, int, const void *, socklen_t) -int getsockopt(int, int, int, void *, socklen_t *) -int sendmsg(int, const struct msghdr *, unsigned int) -int recvmsg(int, struct msghdr *, unsigned int) diff --git a/klibc/klibc/SOCKETCALLS.def b/klibc/klibc/SOCKETCALLS.def new file mode 100644 index 0000000000..e70b3fc16e --- /dev/null +++ b/klibc/klibc/SOCKETCALLS.def @@ -0,0 +1,21 @@ +; -*- fundamental -*- +; +; These are calls that are invoked via the socketcall mechanism +; Note that on most architectures this is simply #included into +; SYSCALLS.def. +; + int socket(int, int, int) + int bind(int, struct sockaddr *, int) + int connect(int, struct sockaddr *, socklen_t) + int listen(int, int) + int accept(int, struct sockaddr *, socklen_t *) + int getsockname(int, struct sockaddr *, socklen_t *) + int getpeername(int, struct sockaddr *, socklen_t *) + int socketpair(int, int, int, int *) + int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t) + int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) + int shutdown(int, int) + int setsockopt(int, int, int, const void *, socklen_t) + int getsockopt(int, int, int, void *, socklen_t *) + int sendmsg(int, const struct msghdr *, unsigned int) + int recvmsg(int, struct msghdr *, unsigned int) diff --git a/klibc/klibc/SYSCALLS b/klibc/klibc/SYSCALLS deleted file mode 100644 index 82081201b4..0000000000 --- a/klibc/klibc/SYSCALLS +++ /dev/null @@ -1,153 +0,0 @@ -# -*- fundamental -*- -# -# This is a list of system calls we invoke "directly". These -# are generated into syscall stubs in their own C files, so the -# linker can do its job properly. -# -# The full description of a line is: -# [<[!]arch,...>] type sysname[@systype][::funcname](args) -# - -# -# Process-related syscalls -# - pid_t vfork() - pid_t vfork@forkish() - pid_t getpid() - pid_t getxpid@dual0::getpid() -int setpgid(pid_t, pid_t) -pid_t getpgid(pid_t) - pid_t getppid() - pid_t getxpid@dual1::getppid() -pid_t setsid() -pid_t getsid(pid_t) -pid_t wait4(pid_t, int *, int, struct rusage *) -int execve(const char *, char * const *, char * const *) -int setpriority(int, int, int) -int sched_setscheduler(pid_t, int, const struct sched_param *) -int sched_yield() - -# -# User and group IDs -# -int setuid(uid_t) -int setgid(gid_t) - uid_t getuid() - uid_t getxuid@dual0::getuid() - gid_t getgid() - gid_t getxgid@dual0::getgid() - uid_t geteuid() - uid_t getxuid@dual1::geteuid() - gid_t getegid() - uid_t getxgid@dual1::getegid() -int getgroups(int, gid_t *) -int setgroups(size_t, const gid_t *) -int setreuid(uid_t, uid_t) -int setregid(gid_t, gid_t) -int setfsuid(uid_t) -int setfsgid(gid_t) - -# -# Filesystem-related system calls -# -int mount(const char *, const char *, const char *, unsigned long, const void *) - int umount2(const char *, int) - int umount::umount2(const char *, int) - int pivot_root(const char *, const char *) -int sync() -int statfs(const char *, struct statfs *) -int fstatfs(int, struct statfs *) -int swapon(const char *, int) -int swapoff(const char *) - -# -# Inode-related system calls -# -int access(const char *, int) -int link(const char *, const char *) -int unlink(const char *) -int chdir(const char *) -int rename(const char *, const char *) -int mknod(const char *, mode_t, dev_t) -int chmod(const char *, mode_t) -int fchmod(int, mode_t) -int mkdir(const char *, mode_t) -int rmdir(const char *) - int pipe(int *) -mode_t umask(mode_t) -int chroot(const char *) -int symlink(const char *, const char *) -int readlink(const char *, char *, size_t) -int stat(const char *, struct stat *) -int lstat(const char *, struct stat *) -int fstat(int, struct stat *) -int getdents(unsigned int, struct dirent *, unsigned int) -int chown(const char *, uid_t, gid_t) -int fchown(int, uid_t, gid_t) -int lchown(const char *, uid_t, gid_t) - -# -# I/O operations -# -ssize_t read(int, void *, size_t) -ssize_t write(int, const void *, size_t) -int close(int) -off_t lseek(int, off_t, int) -int dup(int) -int dup2(int, int) -int fcntl(int, int, long) -int ioctl(int, int, void *) -int flock(int, int) -int poll(struct pollfd *, nfds_t, long) -int fsync(int) -int readv(int, const struct iovec *, int) -int writev(int, const struct iovec *, int) -int ftruncate(int, off_t) - -# -# Signal operations -# -int kill(pid_t, int) -int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) -int rt_sigsuspend(const sigset_t *, size_t) -int rt_sigpending(sigset_t *, size_t) -int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t) -int getitimer(int, struct itimerval *) -int setitimer(int, const struct itimerval *, struct itimerval *) - -# -# Time-related system calls -# -clock_t times(struct tms *) -int gettimeofday(struct timeval *, struct timezone *) -int settimeofday(const struct timeval *, const struct timezone *) -int nanosleep(const struct timespec *, struct timespec *) - -# -# Memory -# -void * brk::__brk(void *) -int munmap(void *, size_t) -void * mremap(void *, size_t, size_t, unsigned long) -int msync(const void *, size_t, int) -int mprotect(const void *, size_t, int) - -# -# System stuff -# -int uname(struct utsname *) -int setdomainname(const char *, size_t) -int sethostname(const char *, size_t) -long init_module(void *, unsigned long, const char *) -long delete_module(const char *, unsigned int) - int query_module(const char *, int, void *, size_t, size_t) -int reboot::__reboot(int, int, int, void *) -int syslog::klogctl(int, char *, int) -int sysinfo(struct sysinfo *) - -# -# Low-level I/O (generally architecture-specific) -# - int iopl(int) - int ioperm(unsigned long, unsigned long, int) - int vm86(struct vm86_struct *) diff --git a/klibc/klibc/SYSCALLS.def b/klibc/klibc/SYSCALLS.def new file mode 100644 index 0000000000..dbd7dc8434 --- /dev/null +++ b/klibc/klibc/SYSCALLS.def @@ -0,0 +1,207 @@ +; -*- fundamental -*- +; +; This is a list of system calls we invoke "directly". These +; are generated into syscall stubs in their own files, so the +; linker can do its job properly. +; +; The full description of a line is: +; [<[?][!]arch,...>] type [sysname,...][@systype][::funcname](args) +; +; ? means only instantiate this system call if present in asm/unistd.h +; + +#include + +; +; Process-related syscalls +; + pid_t clone::__clone(unsigned long, void *) + pid_t clone::__clone2(unsigned long, void *, void *) + pid_t fork() + pid_t fork@forkish() + pid_t vfork() + pid_t vfork@forkish() + pid_t getpid() + pid_t getxpid@dual0::getpid() +int setpgid(pid_t, pid_t) +pid_t getpgid(pid_t) + pid_t getppid() + pid_t getxpid@dual1::getppid() +pid_t setsid() +pid_t getsid(pid_t) +pid_t wait4(pid_t, int *, int, struct rusage *) +int execve(const char *, char * const *, char * const *) + int nice(int) + int getpriority(int, int) + int getpriority::__getpriority(int, int) +int setpriority(int, int, int) +int sched_setscheduler(pid_t, int, const struct sched_param *) +int sched_yield() + +; +; User and group IDs +; +int setuid32,setuid::setuid(uid_t) +int setgid32,setgid::setgid(gid_t) + uid_t getuid32,getuid::getuid() + uid_t getxuid@dual0::getuid() + gid_t getgid32,getgid::getgid() + gid_t getxgid@dual0::getgid() + uid_t geteuid32,geteuid::geteuid() + uid_t getxuid@dual1::geteuid() + gid_t getegid32,getegid::getegid() + gid_t getxgid@dual1::getegid() +int getgroups32,getgroups::getgroups(int, gid_t *) +int setgroups32,setgroups::setgroups(size_t, const gid_t *) +int setreuid32,setreuid::setreuid(uid_t, uid_t) +int setregid32,setregid::setregid(gid_t, gid_t) +int setfsuid32,setfsuid::setfsuid(uid_t) +int setfsgid32,setfsgid::setfsgid(gid_t) +int setresuid32,setresuid::setresuid(int, uid_t, uid, uid_t) + +; +; Filesystem-related system calls +; +int mount(const char *, const char *, const char *, unsigned long, const void *) + int umount2(const char *, int) + int umount::umount2(const char *, int) + int pivot_root(const char *, const char *) +int sync() +#ifdef __NR_statfs64 +int statfs64::__statfs64(const char *, size_t, struct statfs *) +#else +int statfs(const char *, struct statfs *) +#endif +#ifdef __NR_fstatfs64 +int fstatfs64::__fstatfs64(int, size_t, struct statfs *) +#else +int fstatfs(int, struct statfs *) +#endif +int swapon(const char *, int) +int swapoff(const char *) + +; +; Inode-related system calls +; +int access(const char *, int) +int link(const char *, const char *) +int unlink(const char *) +int chdir(const char *) +int fchdir(int) +int rename(const char *, const char *) +int mknod(const char *, mode_t, dev_t) +int chmod(const char *, mode_t) +int fchmod(int, mode_t) +int mkdir(const char *, mode_t) +int rmdir(const char *) + int pipe(int *) +mode_t umask(mode_t) +int chroot(const char *) +int symlink(const char *, const char *) +int readlink(const char *, char *, size_t) +int stat64,stat::stat(const char *, struct stat *) +int lstat64,lstat::lstat(const char *, struct stat *) +int fstat64,fstat::fstat(int, struct stat *) +int getdents64,getdents::getdents(unsigned int, struct dirent *, unsigned int) +int chown32,chown::chown(const char *, uid_t, gid_t) +int fchown32,fchown::fchown(int, uid_t, gid_t) +int lchown32,lchown::lchown(const char *, uid_t, gid_t) +int getcwd::__getcwd(char *, size_t) + int utime(const char *, const struct utimbuf *) + int utimes(const char *, const struct timeval *) + +; +; I/O operations +; + int open::__open(const char *, int, mode_t) +<64> int open(const char *, int, mode_t) +ssize_t read(int, void *, size_t) +ssize_t write(int, const void *, size_t) +int close(int) +<64> off_t lseek(int, off_t, int) +<32> int _llseek::__llseek(int, unsigned long, unsigned long, off_t *, int) +int dup(int) +int dup2(int, int) + int fcntl64@varadic::fcntl(int, int, unsigned long) + int fcntl64,fcntl::fcntl(int, int, unsigned long) +int ioctl(int, int, void *) +int flock(int, int) +int _newselect,select::select(int, fd_set *, fd_set *, fd_set *, struct timeval *) +int poll(struct pollfd *, nfds_t, long) +int fsync(int) +int fdatasync,fsync::fdatasync(int) +int readv(int, const struct iovec *, int) +int writev(int, const struct iovec *, int) +int ftruncate64,ftruncate::ftruncate(int, off_t) +ssize_t pread64,pread::pread(int, void *, size_t, off_t) +ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t) + +; +; Signal operations +; +int kill(pid_t, int) + int sigaction(int, const struct sigaction *, struct sigaction *) +int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) + int sigsuspend(const sigset_t *) +int rt_sigsuspend(const sigset_t *, size_t) + int sigpending(sigset_t) +int rt_sigpending(sigset_t *, size_t) + int sigprocmask(int, const sigset_t *, sigset_t *) +int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t) + unsigned int alarm(unsigned int) +int getitimer(int, struct itimerval *) +int setitimer(int, const struct itimerval *, struct itimerval *) + +; +; Time-related system calls +; + time_t time(time_t *) +clock_t times(struct tms *) +int gettimeofday(struct timeval *, struct timezone *) +int settimeofday(const struct timeval *, const struct timezone *) +int nanosleep(const struct timespec *, struct timespec *) + int pause() + +; +; Memory +; +void * brk::__brk(void *) +int munmap(void *, size_t) +void * mremap(void *, size_t, size_t, unsigned long) +int msync(const void *, size_t, int) +int mprotect(const void *, size_t, int) +#if (BITSIZE == 32 && defined(__NR_mmap2)) || (BITSIZE == 64 && !defined(__NR_mmap)) + void * mmap2::__mmap2(void *, size_t, int, int, int, long) +#else + void * mmap(void *, size_t, int, int, int, long) +#endif +int mlockall(int) +int munlockall() +int mlock(const void *, size_t) +int munlock(const void *, size_t) + +; +; System stuff +; +int uname(struct utsname *) +int setdomainname(const char *, size_t) +int sethostname(const char *, size_t) +long init_module(void *, unsigned long, const char *) +long delete_module(const char *, unsigned int) +int reboot::__reboot(int, int, int, void *) +int syslog::klogctl(int, char *, int) +int sysinfo(struct sysinfo *) + +; +; Low-level I/O (generally architecture-specific) +; + int iopl(int) + int ioperm(unsigned long, unsigned long, int) + int vm86(struct vm86_struct *) + +; +; Most architectures have the socket interfaces using regular +; system calls. +; + long socketcall::__socketcall(int, const unsigned long *) +#include "SOCKETCALLS.def" diff --git a/klibc/klibc/__shared_init.c b/klibc/klibc/__shared_init.c index 63e3f4644e..592a3db6f5 100644 --- a/klibc/klibc/__shared_init.c +++ b/klibc/klibc/__shared_init.c @@ -1,56 +1,2 @@ -/* - * __shared_init.c - * - * This function takes the raw data block set up by the ELF loader - * in the kernel and parses it. It is invoked by crt0.S which makes - * any necessary adjustments and passes calls this function using - * the standard C calling convention. - * - * The arguments are: - * uintptr_t *elfdata -- The ELF loader data block; usually from the stack. - * Basically a pointer to argc. - * void (*onexit)(void) -- Function to install into onexit - */ - -#include -#include -#include -#include -#include - -char **environ; - -__noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void)) -{ - int argc; - char **argv, **envp, **envend; - struct auxentry { - uintptr_t type; - uintptr_t v; - } *auxentry; - typedef int (*main_t)(int, char **, char **); - main_t main_ptr = NULL; - - (void)onexit; /* For now, we ignore this... */ - - argc = (int)*elfdata++; - argv = (char **)elfdata; - envp = argv+(argc+1); - - /* The auxillary entry vector is after all the environment vars */ - for ( envend = envp ; *envend ; envend++ ); - auxentry = (struct auxentry *)(envend+1); - - while ( auxentry->type ) { - if ( auxentry->type == AT_ENTRY ) { - main_ptr = (main_t)(auxentry->v); - break; - } - auxentry++; - } - - environ = envp; - exit(main_ptr(argc, argv, envp)); -} - - +#define SHARED 1 +#include "libc_init.c" diff --git a/klibc/klibc/__static_init.c b/klibc/klibc/__static_init.c index 5a90b5cd88..0b59eedaa7 100644 --- a/klibc/klibc/__static_init.c +++ b/klibc/klibc/__static_init.c @@ -1,38 +1,2 @@ -/* - * __static_init.c - * - * This function takes the raw data block set up by the ELF loader - * in the kernel and parses it. It is invoked by crt0.S which makes - * any necessary adjustments and passes calls this function using - * the standard C calling convention. - * - * The arguments are: - * uintptr_t *elfdata -- The ELF loader data block; usually from the stack. - * Basically a pointer to argc. - * void (*onexit)(void) -- Function to install into onexit - */ - -#include -#include -#include -#include -#include - -char **environ; - -extern int main(int, char **, char **); - -__noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void)) -{ - int argc; - char **argv, **envp; - - (void)onexit; /* For now, we ignore this... */ - - argc = (int)*elfdata++; - argv = (char **)elfdata; - envp = argv+(argc+1); - - environ = envp; - exit(main(argc, argv, envp)); -} +#define SHARED 0 +#include "libc_init.c" diff --git a/klibc/klibc/alarm.c b/klibc/klibc/alarm.c index ca7bb37f92..40c0969432 100644 --- a/klibc/klibc/alarm.c +++ b/klibc/klibc/alarm.c @@ -5,11 +5,7 @@ #include #include -#ifdef __NR_alarm - -_syscall1(unsigned int,alarm,unsigned int,seconds); - -#else +#ifndef __NR_alarm /* Emulate alarm() via setitimer() */ diff --git a/klibc/klibc/arch/alpha/Makefile.inc b/klibc/klibc/arch/alpha/Makefile.inc index 2a1100f962..62fce9dc28 100644 --- a/klibc/klibc/arch/alpha/Makefile.inc +++ b/klibc/klibc/arch/alpha/Makefile.inc @@ -11,7 +11,7 @@ DIVCFLAGS = $(REQFLAGS) \ -O3 -fomit-frame-pointer -fcall-saved-1 -fcall-saved-2 \ -fcall-saved-3 -fcall-saved-4 -fcall-saved-5 -fcall-saved-6 \ - -fcall-saved-7 -fcall-saved-8 -fcall-saved-15 -fcall-saved-16 \ + -fcall-saved-7 -fcall-saved-8 -ffixed-15 -fcall-saved-16 \ -fcall-saved-17 -fcall-saved-18 -fcall-saved-19 -fcall-saved-20 \ -fcall-saved-21 -fcall-saved-22 -ffixed-23 -fcall-saved-24 \ -ffixed-25 -ffixed-27 @@ -26,7 +26,9 @@ ARCHOBJS = \ arch/$(ARCH)/__divl.o \ arch/$(ARCH)/__reml.o \ arch/$(ARCH)/pipe.o \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o \ + arch/$(ARCH)/sysdual.o ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) diff --git a/klibc/klibc/arch/alpha/crt0.S b/klibc/klibc/arch/alpha/crt0.S index 6c2958117d..904b539741 100644 --- a/klibc/klibc/arch/alpha/crt0.S +++ b/klibc/klibc/arch/alpha/crt0.S @@ -3,10 +3,10 @@ # .text - .type __start,@function - .ent __start, 0 - .globl __start -__start: + .type _start,@function + .ent _start, 0 + .globl _start +_start: .frame $30, 0, $26, 0 mov $31, $15 br $29, 1f @@ -18,4 +18,5 @@ __start: jsr $26, __libc_init - .size __start,.-__start + .size _start,.-_start + .end _start diff --git a/klibc/klibc/arch/alpha/include/klibc/archsetjmp.h b/klibc/klibc/arch/alpha/include/klibc/archsetjmp.h deleted file mode 100644 index 9dc570a6f5..0000000000 --- a/klibc/klibc/arch/alpha/include/klibc/archsetjmp.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * arch/alpha/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __s0; - unsigned long __s1; - unsigned long __s2; - unsigned long __s3; - unsigned long __s4; - unsigned long __s5; - unsigned long __fp; - unsigned long __ra; - unsigned long __gp; - unsigned long __sp; - - unsigned long __f2; - unsigned long __f3; - unsigned long __f4; - unsigned long __f5; - unsigned long __f6; - unsigned long __f7; - unsigned long __f8; - unsigned long __f9; -}; - -/* Must be an array so it will decay to a pointer when a function is called */ -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/klibc/arch/alpha/include/klibc/archsignal.h b/klibc/klibc/arch/alpha/include/klibc/archsignal.h deleted file mode 100644 index b870a05131..0000000000 --- a/klibc/klibc/arch/alpha/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/alpha/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/alpha/include/klibc/archsys.h b/klibc/klibc/arch/alpha/include/klibc/archsys.h deleted file mode 100644 index 16ed658987..0000000000 --- a/klibc/klibc/arch/alpha/include/klibc/archsys.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * arch/alpha/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* Alpha has some bizarre Tru64-derived system calls which return two - different values in $0 and $20(!), respectively. The standard - macros can't deal with these; even the ones that give the right - return value have the wrong clobbers. */ - -#define _syscall0_dual0(type, name) \ -type name(void) \ -{ \ - long _sc_ret, _sc_err; \ - { \ - register long _sc_0 __asm__("$0"); \ - register long _sc_19 __asm__("$19"); \ - register long _sc_20 __asm__("$20"); \ - \ - _sc_0 = __NR_##name; \ - __asm__("callsys" \ - : "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \ - : "0"(_sc_0) \ - : _syscall_clobbers); \ - _sc_ret = _sc_0, _sc_err = _sc_19; (void)(_sc_20); \ - } \ - _syscall_return(type); \ -} - -#define _syscall0_dual1(type, name) \ -type name(void) \ -{ \ - long _sc_ret, _sc_err; \ - { \ - register long _sc_0 __asm__("$0"); \ - register long _sc_19 __asm__("$19"); \ - register long _sc_20 __asm__("$20"); \ - \ - _sc_0 = __NR_##name; \ - __asm__("callsys" \ - : "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \ - : "0"(_sc_0) \ - : _syscall_clobbers); \ - _sc_ret = _sc_20, _sc_err = _sc_19; (void)(_sc_0); \ - } \ - _syscall_return(type); \ -} - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/alpha/include/machine/asm.h b/klibc/klibc/arch/alpha/include/machine/asm.h deleted file mode 100644 index e22db90412..0000000000 --- a/klibc/klibc/arch/alpha/include/machine/asm.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * machine/asm.h - */ - -#ifndef _MACHINE_ASM_H -#define _MACHINE_ASM_H - -/* Standard aliases for Alpha register names */ - -#define v0 $0 -#define t0 $1 -#define t1 $2 -#define t2 $3 -#define t3 $4 -#define t4 $5 -#define t5 $6 -#define t6 $7 -#define t7 $8 -#define s0 $9 -#define s1 $10 -#define s2 $11 -#define s3 $12 -#define s4 $13 -#define s5 $14 -#define fp $15 -#define a0 $16 -#define a1 $17 -#define a2 $18 -#define a3 $19 -#define a4 $20 -#define a5 $21 -#define t8 $22 -#define t9 $23 -#define t10 $24 -#define t11 $25 -#define ra $26 -#define t12 $27 /* t12 and pv are both used for $27 */ -#define pv $27 /* t12 and pv are both used for $27 */ -#define at $28 -#define gp $29 -#define sp $30 -#define zero $31 - -#endif /* _MACHINE_ASM_H */ diff --git a/klibc/klibc/arch/alpha/setjmp.S b/klibc/klibc/arch/alpha/setjmp.S index e1ad642539..5d915f2dbe 100644 --- a/klibc/klibc/arch/alpha/setjmp.S +++ b/klibc/klibc/arch/alpha/setjmp.S @@ -31,14 +31,14 @@ setjmp: stq ra, 56(a0) stq gp, 64(a0) stq sp, 72(a0) - stt f2, 80(a0) - stt f3, 88(a0) - stt f4, 96(a0) - stt f5, 104(a0) - stt f6, 112(a0) - stt f7, 120(a0) - stt f8, 128(a0) - stt f9, 136(a0) + stt $f2, 80(a0) + stt $f3, 88(a0) + stt $f4, 96(a0) + stt $f5, 104(a0) + stt $f6, 112(a0) + stt $f7, 120(a0) + stt $f8, 128(a0) + stt $f9, 136(a0) ret zero,(ra),1 .size setjmp,.-setjmp @@ -59,14 +59,14 @@ longjmp: ldq ra, 56(a0) ldq gp, 64(a0) ldq sp, 72(a0) - ldt f2, 80(a0) - ldt f3, 88(a0) - ldt f4, 96(a0) - ldt f5, 104(a0) - ldt f6, 112(a0) - ldt f7, 120(a0) - ldt f8, 128(a0) - ldt f9, 136(a0) + ldt $f2, 80(a0) + ldt $f3, 88(a0) + ldt $f4, 96(a0) + ldt $f5, 104(a0) + ldt $f6, 112(a0) + ldt $f7, 120(a0) + ldt $f8, 128(a0) + ldt $f9, 136(a0) /* We're bound to get a mispredict here, but at least give us a chance to get the return stack back in sync... */ ret zero,(ra),1 diff --git a/klibc/klibc/arch/alpha/syscall.S b/klibc/klibc/arch/alpha/syscall.S new file mode 100644 index 0000000000..0c87414b1a --- /dev/null +++ b/klibc/klibc/arch/alpha/syscall.S @@ -0,0 +1,26 @@ +# +# arch/alpha/syscall.S +# + +#include + + .text + .align 3 + .type __syscall_common,@function + .ent __syscall_common, 0 + .globl __syscall_common +__syscall_common: + .frame sp,0,ra,0 + callsys + beq a3, 1f + br pv, 2f # pv <- pc +2: + ldgp gp, 0(pv) + lda a1, errno + lda v0, -1(zero) + stl a3, 0(a1) +1: + ret zero,(ra),1 + + .size __syscall_common,.-__syscall_common + .end __syscall_common diff --git a/klibc/klibc/arch/alpha/sysdual.S b/klibc/klibc/arch/alpha/sysdual.S new file mode 100644 index 0000000000..c00db88960 --- /dev/null +++ b/klibc/klibc/arch/alpha/sysdual.S @@ -0,0 +1,33 @@ +# +# arch/alpha/sysdual.S +# + +# +# Some system calls have an alternate return value in r20 (a4). +# This system call stub is for system calls where that is +# the "real" return value. +# + +#include + + .text + .align 3 + .type __syscall_dual1,@function + .ent __syscall_dual1, 0 + .globl __syscall_dual1 +__syscall_dual1: + .frame sp,0,ra,0 + callsys + mov v0, a4 + beq a3, 1f + br pv, 2f # pv <- pc +2: + ldgp gp, 0(pv) + lda a1, errno + lda v0, -1(zero) + stl a3, 0(a1) +1: + ret zero,(ra),1 + + .size __syscall_dual1,.-__syscall_dual1 + .end __syscall_dual1 diff --git a/klibc/klibc/arch/alpha/sysstub.ph b/klibc/klibc/arch/alpha/sysstub.ph new file mode 100644 index 0000000000..a24b6c07dc --- /dev/null +++ b/klibc/klibc/arch/alpha/sysstub.ph @@ -0,0 +1,37 @@ +# -*- perl -*- +# +# arch/alpha/sysstub.ph +# +# Script to generate system call stubs +# + +# On Alpha, most system calls follow the standard convention, with the +# system call number in r0 (v0), return an error value in r19 (a3) as +# well as the return value in r0 (v0). +# +# A few system calls are dual-return with the second return value in +# r20 (a4). + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + $stype = $stype || 'common'; + $stype = 'common' if ( $stype eq 'dual0' ); + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.text\n"; + print OUT "\t.type ${fname},\@function\n"; + print OUT "\t.ent\t${fname}, 0\n"; # What is this? + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT "\tlda\tv0, __NR_${sname}(zero)\n"; + print OUT "\tbr __syscall_${stype}\n"; + print OUT "\t.size\t${fname},.-${fname}\n"; + print OUT "\t.end\t${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/arm/Makefile.inc b/klibc/klibc/arch/arm/Makefile.inc index 3ec8c051b2..0603d850bd 100644 --- a/klibc/klibc/arch/arm/Makefile.inc +++ b/klibc/klibc/arch/arm/Makefile.inc @@ -17,7 +17,8 @@ ARCHOBJS = \ libgcc/__moddi3.o \ libgcc/__udivdi3.o \ libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o + libgcc/__udivmoddi4.o \ + arch/arm/syscall.o ifeq ($(THUMB),y) ARCHOBJS += arch/arm/setjmp-thumb.o @@ -26,6 +27,17 @@ else ARCHOBJS += arch/arm/setjmp-arm.o endif +arch/arm/sysstubs.a: arch/arm/sysstubs.pl + mkdir -p arch/arm/sysstubs + $(PERL) $< arch/arm/sysstubs + $(MAKE) $(patsubst %.S,%.o,$(wildcard arch/arm/sysstubs/*.S)) + -rm -f $@ + $(AR) cq $@ arch/arm/sysstubs/*.o + $(RANLIB) $@ + + ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) archclean: + -rm -rf arch/arm/sysstubs + -rm -f arch/arm/sysstubs.a diff --git a/klibc/klibc/arch/arm/crt0.S b/klibc/klibc/arch/arm/crt0.S index 8cd3640c30..fc1104ef0e 100644 --- a/klibc/klibc/arch/arm/crt0.S +++ b/klibc/klibc/arch/arm/crt0.S @@ -3,10 +3,8 @@ # # void _start(void) # { -# /* Divine up argc, argv, and envp */ -# environ = envp; -# exit(main(argc, argv, envp)); -# } +# __libc_init(elf_structure, atexit_ptr); +# } # .text diff --git a/klibc/klibc/arch/arm/include/klibc/archsetjmp.h b/klibc/klibc/arch/arm/include/klibc/archsetjmp.h deleted file mode 100644 index c956b50a90..0000000000 --- a/klibc/klibc/arch/arm/include/klibc/archsetjmp.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * arch/i386/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned int regs[10]; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/arm/include/klibc/archsignal.h b/klibc/klibc/arch/arm/include/klibc/archsignal.h deleted file mode 100644 index 77685e62f0..0000000000 --- a/klibc/klibc/arch/arm/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/arm/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/arm/include/klibc/archsys.h b/klibc/klibc/arch/arm/include/klibc/archsys.h deleted file mode 100644 index 1a77e53a65..0000000000 --- a/klibc/klibc/arch/arm/include/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/arm/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/arm/setjmp-arm.S b/klibc/klibc/arch/arm/setjmp-arm.S index bcb30b4221..1a29ee7f71 100644 --- a/klibc/klibc/arch/arm/setjmp-arm.S +++ b/klibc/klibc/arch/arm/setjmp-arm.S @@ -34,7 +34,6 @@ setjmp: .type longjmp, #function longjmp: ldmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} - movs r0, r1 - moveq r0, #1 + mov r0, r1 mov pc, lr .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/arm/syscall.S b/klibc/klibc/arch/arm/syscall.S new file mode 100644 index 0000000000..0e73f68ed0 --- /dev/null +++ b/klibc/klibc/arch/arm/syscall.S @@ -0,0 +1,50 @@ +/* + * arch/arm/syscall.S + * + * System call common handling + */ + + .type __syscall_common,#function + .globl __syscall_common +#ifndef __thumb__ + /* ARM version - this is executed after the swi */ + + .align 4 +__syscall_common: + cmn r0, #4096 + rsbcs r2, r0, #0 + ldrcs r3, 1f + mvncs r0, #0 + strcs r2, [r3] + ldmfd sp!,{r4,r5,pc} + + .align 4 +1: + .word errno + +#else + /* Thumb version - must still load r4 and r5 and run swi */ + + .thumb_func + .align 2 +__syscall_common: + ldr r4, [sp #12] + ldr r5, [sp #16] + swi 0 + ldr r1, 2f + cmp r0, r1 + bcc 1f + ldr r1, 3f + neg r2, r0 + mvn r0, #0 + str r2, [r1] +1: + pop {r4,r5,r7,pc} + + .align 4 +2: + .word #-4095 +3: + .word errno + +#endif diff --git a/klibc/klibc/arch/arm/sysstub.ph b/klibc/klibc/arch/arm/sysstub.ph new file mode 100644 index 0000000000..bf953ccd80 --- /dev/null +++ b/klibc/klibc/arch/arm/sysstub.ph @@ -0,0 +1,44 @@ +# -*- perl -*- +# +# arch/arm/sysstub.ph +# +# Script to generate system call stubs +# + + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + + print OUT "\t.text\n"; + print OUT "\t.type\t${fname}, #function\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "\t.align\t4\n"; + + print OUT "#ifndef __thumb__\n"; + + # ARM version first + print OUT "${fname}:\n"; + print OUT "\tstmfd\tsp!,{r4,r5,lr}\n"; + print OUT "\tldr\tr4,[sp,#12]\n"; + print OUT "\tldr\tr5,[sp,#16]\n"; + print OUT "\tswi\t# __NR_${sname}\n"; + print OUT "\tb\t__syscall_common\n"; + + print OUT "#else\n"; + + # Thumb version + print OUT "\t.thumb_func\n"; + print OUT "${fname}:\n"; + print OUT "\tpush\t{r4,r5,r7,pc}\n"; + print OUT "\tmov\tr7, # __NR_${sname}\n"; + print OUT "\tb\t__syscall_common\n"; + + print OUT "#endif\n"; + + print OUT "\t.size\t__syscall${i},.-__syscall${i}\n"; +} + +1; diff --git a/klibc/klibc/arch/cris/MCONFIG b/klibc/klibc/arch/cris/MCONFIG index 27809ebbe7..2762494a30 100644 --- a/klibc/klibc/arch/cris/MCONFIG +++ b/klibc/klibc/arch/cris/MCONFIG @@ -9,3 +9,18 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 32 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 224 MB - normal binaries start at 0 +# (lib?)gcc on cris seems to insist on producing .init and .fini sections +SHAREDFLAGS = --section-start .init=0x0e000100 + +# The CRIS compiler needs an -iprefix to find libgcc includes when +# nostdinc is used. It also needs -mlinux to compile linux applications. +INCLUDE_PREFIX = $(shell $(CC) -print-libgcc-file-name | sed -e s/libgcc.a//) +ARCHREQFLAGS = -iprefix $(INCLUDE_PREFIX) -mlinux + +# Special flags needed for linking +LDFLAGS += -mcrislinux diff --git a/klibc/klibc/arch/cris/Makefile.inc b/klibc/klibc/arch/cris/Makefile.inc index 41183fd64b..75fa17ba99 100644 --- a/klibc/klibc/arch/cris/Makefile.inc +++ b/klibc/klibc/arch/cris/Makefile.inc @@ -7,4 +7,27 @@ # accordingly. # +ARCHOBJS = \ + arch/$(ARCH)/__Umod.o \ + arch/$(ARCH)/__Udiv.o \ + arch/$(ARCH)/__Mod.o \ + arch/$(ARCH)/__Div.o \ + arch/$(ARCH)/__negdi2.o \ + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o \ + libgcc/__divdi3.o \ + libgcc/__moddi3.o \ + libgcc/__udivdi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmoddi4.o + +arch/$(ARCH)/__Umod.o: arch/$(ARCH)/divide.c + $(CC) $(CFLAGS) -DSIGNED=0 -DREM=1 -DBITS=32 -DNAME=__Umod -c -o $@ $< +arch/$(ARCH)/__Udiv.o: arch/$(ARCH)/divide.c + $(CC) $(CFLAGS) -DSIGNED=0 -DREM=0 -DBITS=32 -DNAME=__Udiv -c -o $@ $< +arch/$(ARCH)/__Mod.o: arch/$(ARCH)/divide.c + $(CC) $(CFLAGS) -DSIGNED=1 -DREM=1 -DBITS=32 -DNAME=__Mod -c -o $@ $< +arch/$(ARCH)/__Div.o: arch/$(ARCH)/divide.c + $(CC) $(CFLAGS) -DSIGNED=1 -DREM=0 -DBITS=32 -DNAME=__Div -c -o $@ $< + archclean: diff --git a/klibc/klibc/arch/cris/__negdi2.S b/klibc/klibc/arch/cris/__negdi2.S new file mode 100644 index 0000000000..3cca9edfa8 --- /dev/null +++ b/klibc/klibc/arch/cris/__negdi2.S @@ -0,0 +1,25 @@ +/* + * arch/cris/__negdi2.c + */ + +/* + * In 2's complement arithmetric, -x == (~x + 1), so + * -{h,l} = (~{h,l} + {0,1) + * -{h,l} = {~h,~l} + {0,1} + * -{h,l} = {~h + cy, ~l + 1} + * ... where cy = (l == 0) + * -{h,l} = {~h + cy, -l} + */ + + .text + .balign 4 + .type __negdi2,@function + .globl __negdi2 +__negdi2: + neg.d $r10,$r10 + seq $r12 + not $r11 + ret + add.d $r12,$r11 + + .size __negdi2, .-__negdi2 diff --git a/klibc/klibc/arch/cris/crt0.S b/klibc/klibc/arch/cris/crt0.S new file mode 100644 index 0000000000..989c82b2ba --- /dev/null +++ b/klibc/klibc/arch/cris/crt0.S @@ -0,0 +1,28 @@ +# +# arch/cris/crt0.S +# +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. +# + + .text + .balign 4 + .type _start,@function + .globl _start +_start: + /* Save the address of the ELF argument array */ + move.d $sp,$r10 /* Address of ELF arguments */ + + /* atexit() function (assume null) */ + moveq 0,$r11 + + /* Set up a dummy stack frame to keep gcc from getting confused */ + push $r11 + push $r11 + jump __libc_init + + .size _start, .-_start + diff --git a/klibc/klibc/arch/cris/divide.c b/klibc/klibc/arch/cris/divide.c new file mode 100644 index 0000000000..29081dc953 --- /dev/null +++ b/klibc/klibc/arch/cris/divide.c @@ -0,0 +1,92 @@ +#include +#include + +#if BITS == 64 +typedef uint64_t unum; +typedef int64_t snum; +#else +typedef uint32_t unum; +typedef int32_t snum; +#endif + +#ifdef SIGNED +typedef snum xnum; +#else +typedef unum xnum; +#endif + +#ifdef __cris__ +static inline unum __attribute__((const)) dstep(unum rs, unum rd) { + asm("dstep %1,%0" : "+r" (rd) : "r" (rs)); + return rd; +} + +static inline unum __attribute__((const)) lz(unum rs) { + unum rd; + asm("lz %1,%0" : "=r" (rd) : "r" (rs)); + return rd; +} + +#else +/* For testing */ +static inline unum __attribute__ ((const)) dstep(unum rs, unum rd) { + rd <<= 1; + if ( rd >= rs ) + rd -= rs; + + return rd; +} + +static inline unum __attribute__((const)) lz(unum rs) { + unum rd = 0; + while ( rs >= 0x7fffffff ) { + rd++; + rs <<= 1; + } + return rd; +} + +#endif + +xnum NAME (unum num, unum den) +{ + unum quot = 0, qbit = 1; + int minus = 0; + xnum v; + + if ( den == 0 ) { + raise(SIGFPE); + return 0; /* If signal ignored... */ + } + + if (den == 1) return (xnum)(REM ? 0 : num); + +#if SIGNED + if ( (snum)(num^den) < 0 ) + minus = 1; + if ( (snum)num < 0 ) num = -num; + if ( (snum)den < 0 ) den = -den; +#endif + + den--; + + + /* Left-justify denominator and count shift */ + while ( (snum)den >= 0 ) { + den <<= 1; + qbit <<= 1; + } + + while ( qbit ) { + if ( den <= num ) { + num -= den; + quot += qbit; + } + den >>= 1; + qbit >>= 1; + } + + v = (xnum)(REM ? num : quot); + if ( minus ) v = -v; + return v; +} diff --git a/klibc/klibc/arch/cris/include/klibc/archsignal.h b/klibc/klibc/arch/cris/include/klibc/archsignal.h deleted file mode 100644 index 73b2e196c9..0000000000 --- a/klibc/klibc/arch/cris/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/cris/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/cris/include/klibc/archsys.h b/klibc/klibc/arch/cris/include/klibc/archsys.h deleted file mode 100644 index dfdc70a6de..0000000000 --- a/klibc/klibc/arch/cris/include/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/cris/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/cris/setjmp.S b/klibc/klibc/arch/cris/setjmp.S new file mode 100644 index 0000000000..43162418af --- /dev/null +++ b/klibc/klibc/arch/cris/setjmp.S @@ -0,0 +1,37 @@ +# +# arch/cris/setjmp.S +# +# setjmp/longjmp for the cris architecture +# + +# +# The jmp_buf is assumed to contain the following, in order: +# $r8..$r0 (in that order) +# $sp ($r14) +# return address +# + + .text + .balign 4 + .globl setjmp + .type setjmp, @function +setjmp: + movem $r8,[$r10+] /* Save $r8..$r0 at $r10... */ + move.d $sp,[$r10+] + move $srp,[$r10] + ret + moveq 0,$r10 + + .size setjmp,.-setjmp + + .text + .balign 4 + .globl longjmp + .type longjmp, @function +longjmp: + movem [$r10+],$r8 /* Load $r8..$r0 from $r10... */ + move.d [$r10+],$sp + jump [$r10] + move.d $r11,$r10 + + .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/cris/syscall.S b/klibc/klibc/arch/cris/syscall.S new file mode 100644 index 0000000000..d71495aba2 --- /dev/null +++ b/klibc/klibc/arch/cris/syscall.S @@ -0,0 +1,30 @@ +/* + * arch/cris/syscall.S + * + * On cris, r9 contains the syscall number (set by generated stub); + * r10..r13 contain arguments 0-3 per the standard calling convention, + * and arguments 4-5 are passed in $mof and $srp; however, we have + * to save $srp around the system call. + */ + + .section ".text","ax" + .balign 4 + .globl __syscall_common + .type __syscall_common,@function +__syscall_common: + push $srp + move [$sp+4],$mof + move [$sp+8],$srp + break 13 + + cmps.w -4096,$r10 + blo 1f + neg.d $r10,$r11 + move.d $r11,[errno] + moveq -1,$r10 +1: + pop $srp + ret + nop + + .size __syscall_common,.-__syscall_common diff --git a/klibc/klibc/arch/cris/sysstub.ph b/klibc/klibc/arch/cris/sysstub.ph new file mode 100644 index 0000000000..6c894f62f5 --- /dev/null +++ b/klibc/klibc/arch/cris/sysstub.ph @@ -0,0 +1,29 @@ +# -*- perl -*- +# +# arch/cris/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.text\n"; + print OUT "\t.type\t${fname},\@function\n"; + print OUT "\t.globl\t${fname}\n"; + print OUT "\t.balign\t4\n"; + print OUT "${fname}:\n"; + print OUT "#if __NR_${sname} <= 31\n"; + print OUT "\t moveq\t__NR_${sname}, \$r9\n"; + print OUT "#else\n"; + print OUT "\t move.d\t__NR_${sname}, \$r9\n"; + print OUT "#endif\n"; + print OUT "\tjump\t__syscall_common\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/i386/MCONFIG b/klibc/klibc/arch/i386/MCONFIG index 516b1b6738..2421452eea 100644 --- a/klibc/klibc/arch/i386/MCONFIG +++ b/klibc/klibc/arch/i386/MCONFIG @@ -9,11 +9,11 @@ # Enable this to compile with register parameters; only safe for # gcc > 3 -REGPARM_OPT := -mregparm=3 -DREGPARM +REGPARM_OPT := -mregparm=3 -DREGPARM=3 -gcc_major := $(shell $(CC) -v 2>&1 | awk '/gcc version/{print int($$3)}') +gcc_major := $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1) -OPTFLAGS = $(REGPARM) -march=i386 -Os +OPTFLAGS = $(REGPARM) -march=i386 -Os -g ifeq ($(gcc_major),3) REGPARM := $(REGPARM_OPT) diff --git a/klibc/klibc/arch/i386/Makefile.inc b/klibc/klibc/arch/i386/Makefile.inc index 171248a796..5c320cb453 100644 --- a/klibc/klibc/arch/i386/Makefile.inc +++ b/klibc/klibc/arch/i386/Makefile.inc @@ -11,6 +11,8 @@ ARCHOBJS = \ arch/$(ARCH)/exits.o \ arch/$(ARCH)/socketcall.o \ arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o \ + arch/$(ARCH)/open.o \ arch/$(ARCH)/libgcc/__ashldi3.o \ arch/$(ARCH)/libgcc/__ashrdi3.o \ arch/$(ARCH)/libgcc/__lshrdi3.o \ @@ -22,6 +24,4 @@ ARCHOBJS = \ libgcc/__umoddi3.o \ libgcc/__udivmoddi4.o -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - archclean: diff --git a/klibc/klibc/arch/i386/include/klibc/archsetjmp.h b/klibc/klibc/arch/i386/include/klibc/archsetjmp.h deleted file mode 100644 index db04314b8c..0000000000 --- a/klibc/klibc/arch/i386/include/klibc/archsetjmp.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * arch/i386/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned int __ebx; - unsigned int __esp; - unsigned int __ebp; - unsigned int __esi; - unsigned int __edi; - unsigned int __eip; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/i386/include/klibc/archsignal.h b/klibc/klibc/arch/i386/include/klibc/archsignal.h deleted file mode 100644 index b092ba6d3a..0000000000 --- a/klibc/klibc/arch/i386/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/i386/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/i386/include/klibc/archsys.h b/klibc/klibc/arch/i386/include/klibc/archsys.h deleted file mode 100644 index e21487b256..0000000000 --- a/klibc/klibc/arch/i386/include/klibc/archsys.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * arch/i386/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* - * If we're compiling i386 in PIC mode, we need to treat %ebx - * specially. Most of these are copied from the equivalent file in - * newlib and were written by Werner Almesberger. - */ -#if defined(__PIC__) - -/* _syscall0() is the same as non-PIC */ - -#undef _syscall1 -#define _syscall1(type,name,type1,arg1) \ -type name(type1 arg1) \ -{ \ -long __res; \ -__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##name),"r" ((long)(arg1))); \ -__syscall_return(type,__res); \ -} - -#undef _syscall2 -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type name(type1 arg1,type2 arg2) \ -{ \ -long __res; \ -__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2))); \ -__syscall_return(type,__res); \ -} - -#undef _syscall3 -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type name(type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3))); \ -__syscall_return(type,__res); \ -} - -#undef _syscall4 -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ -long __res; \ -__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##name),"r" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4))); \ -__syscall_return(type,__res); \ -} - -#undef _syscall5 -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -__asm__ __volatile__ ("push %%ebx; movl %2,%%ebx; int $0x80; pop %%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5))); \ -__syscall_return(type,__res); \ -} - -#undef _syscall6 -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ -long __res; \ -__asm__ __volatile__ ("push %%ebx; pushl %%ebp; movl %2,%%ebx; " \ - "movl %%eax,%%ebp; movl %1,%%eax; int $0x80; " \ - "pop %%ebp ; pop %%ebx" \ - : "=a" (__res) \ - : "i" (__NR_##name),"m" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ - "a" ((long)(arg6))); \ -__syscall_return(type,__res); \ -} - -#endif /* __PIC__ */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/i386/include/klibc/diverr.h b/klibc/klibc/arch/i386/include/klibc/diverr.h deleted file mode 100644 index 410aba06d3..0000000000 --- a/klibc/klibc/arch/i386/include/klibc/diverr.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/i386/include/klibc/diverr.h - */ - -#ifndef _KLIBC_DIVERR_H -#define _KLIBC_DIVERR_H - -#include - -static __inline__ void -__divide_error(void) -{ - asm volatile("divl %0" :: "rm" (0) : "eax", "edx"); -} - -#endif /* _KLIBC_DIVERR_H */ diff --git a/klibc/klibc/arch/i386/include/sys/io.h b/klibc/klibc/arch/i386/include/sys/io.h deleted file mode 100644 index b051464dfc..0000000000 --- a/klibc/klibc/arch/i386/include/sys/io.h +++ /dev/null @@ -1,126 +0,0 @@ -#ident "$Id: io.h,v 1.2 2004/01/25 07:49:39 hpa Exp $" -/* ----------------------------------------------------------------------- * - * - * Copyright 2004 H. Peter Anvin - All Rights Reserved - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall - * be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * ----------------------------------------------------------------------- */ - -/* - * sys/io.h for the i386 architecture - * - * Basic I/O macros - */ - -#ifndef _SYS_IO_H -#define _SYS_IO_H 1 - -/* I/O-related system calls */ - -int iopl(int); -int ioperm(unsigned long, unsigned long, int); - -/* Basic I/O macros */ - -static __inline__ void -outb(unsigned char __v, unsigned short __p) -{ - asm volatile("outb %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ void -outw(unsigned short __v, unsigned short __p) -{ - asm volatile("outw %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ void -outl(unsigned int __v, unsigned short __p) -{ - asm volatile("outl %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ unsigned char -inb(unsigned short __p) -{ - unsigned char __v; - asm volatile("inb %1,%0" : "=a" (__v) : "dN" (__p)); - return __v; -} - -static __inline__ unsigned short -inw(unsigned short __p) -{ - unsigned short __v; - asm volatile("inw %1,%0" : "=a" (__v) : "dN" (__p)); - return __v; -} - -static __inline__ unsigned int -inl(unsigned short __p) -{ - unsigned int __v; - asm volatile("inl %1,%0" : "=a" (__v) : "dN" (__p)); - return __v; -} - -/* String I/O macros */ - -static __inline__ void -outsb (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsb" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -outsw (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsw" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -outsl (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsl" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - - -static __inline__ void -insb (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insb" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -insw (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insw" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -insl (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insl" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -#endif /* _SYS_IO_H */ diff --git a/klibc/klibc/arch/i386/include/sys/vm86.h b/klibc/klibc/arch/i386/include/sys/vm86.h deleted file mode 100644 index d3272393dc..0000000000 --- a/klibc/klibc/arch/i386/include/sys/vm86.h +++ /dev/null @@ -1,41 +0,0 @@ -#ident "$Id: vm86.h,v 1.1 2004/01/25 01:34:28 hpa Exp $" -/* ----------------------------------------------------------------------- * - * - * Copyright 2004 H. Peter Anvin - All Rights Reserved - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall - * be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * ----------------------------------------------------------------------- */ - -/* - * sys/vm86.h for i386 - */ - -#ifndef _SYS_VM86_H -#define _SYS_VM86_H 1 - -#include - -/* Actual system call */ -int vm86(struct vm86_struct *); - -#endif diff --git a/klibc/klibc/arch/i386/open.S b/klibc/klibc/arch/i386/open.S new file mode 100644 index 0000000000..4f492a1566 --- /dev/null +++ b/klibc/klibc/arch/i386/open.S @@ -0,0 +1,29 @@ +/* + * arch/i386/open.S + * + * Handle the open() system call - oddball due to the varadic + * prototype, which forces the use of the cdecl calling convention, + * and the need for O_LARGEFILE. + */ + +#include + +/* , despite the name, isn't assembly-safe */ +#define O_LARGEFILE 0100000 + + .globl open + .type open,@function + +open: +#ifdef REGPARM + movl 4(%esp),%eax + movl 8(%esp),%edx + movl 12(%esp),%ecx + orl $O_LARGEFILE,%edx +#else + orl $O_LARGEFILE,8(%esp) +#endif + pushl $__NR_open + jmp __syscall_common + + .size open,.-open diff --git a/klibc/klibc/arch/i386/socketcall.S b/klibc/klibc/arch/i386/socketcall.S index 6bac1e6913..b13d204c32 100644 --- a/klibc/klibc/arch/i386/socketcall.S +++ b/klibc/klibc/arch/i386/socketcall.S @@ -16,18 +16,22 @@ .type __socketcall_common, @function __socketcall_common: - pushl %ebx - movzbl %al,%ebx # The socketcall number is passed in in %al - leal 8(%esp),%ecx # Argument pointer - movl $__NR_socketcall, %eax - int $0x80 - cmpl $-125,%eax # Error return? - popl %ebx - jb 1f - neg %eax - movl %eax,errno - xorl %eax,%eax - decl %eax # Return = -1 + pushl %ebx + + movzbl %al,%ebx # The socketcall number is passed in in %al + leal 8(%esp),%ecx # Argument pointer + movl $__NR_socketcall,%eax + int $0x80 + + cmpl $-4096,%eax # Error return? + + popl %ebx + + jb 1f + + negl %eax + movl %eax,errno + orl $-1,%eax # Return -1 1: ret diff --git a/klibc/klibc/arch/i386/syscall.S b/klibc/klibc/arch/i386/syscall.S new file mode 100644 index 0000000000..f8fa7b4dd3 --- /dev/null +++ b/klibc/klibc/arch/i386/syscall.S @@ -0,0 +1,60 @@ +/* + * arch/i386/syscall.S + * + * Common tail-handling code for system calls. Because of __syscalldecl + * we are using the stack even on if we are compiling with regparm. + * + * The arguments are on the stack; the system call number in %eax. + */ + +#define ARG(n) (4*n+20)(%esp) + + .text + .align 4 + .globl __syscall_common + .type __syscall_common,@function +__syscall_common: +#ifdef REGPARM + xchgl %ebx,(%esp) +#else + popl %eax + pushl %ebx +#endif + pushl %esi + pushl %edi + pushl %ebp + +#ifdef REGPARM + xchgl %eax,%ebx + xchgl %ecx,%edx + movl ARG(0),%esi + movl ARG(1),%edi + movl ARG(2),%ebp +#else + movl ARG(0),%ebx # Syscall arguments + movl ARG(1),%ecx + movl ARG(2),%edx + movl ARG(3),%esi + movl ARG(4),%edi + movl ARG(5),%ebp +#endif + int $0x80 + + cmpl $-4096,%eax + + popl %ebp + popl %edi + popl %esi + popl %ebx + + jb 1f + + # Error return, must set errno + negl %eax + movl %eax,errno + orl $-1,%eax # Return -1 + +1: + ret + + .size __syscall_common,.-__syscall_common diff --git a/klibc/klibc/arch/i386/sysstub.ph b/klibc/klibc/arch/i386/sysstub.ph new file mode 100644 index 0000000000..eaa8180911 --- /dev/null +++ b/klibc/klibc/arch/i386/sysstub.ph @@ -0,0 +1,32 @@ +# -*- perl -*- +# +# arch/i386/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.type ${fname},\@function\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + + if ( $stype eq 'varadic' ) { + print OUT "#ifdef REGPARM\n"; + print OUT "\tmovl 4(%esp),%eax\n"; + print OUT "\tmovl 8(%esp),%edx\n"; + print OUT "\tmovl 12(%esp),%ecx\n"; + print OUT "#endif\n"; + } + + print OUT "\tpushl \$__NR_${sname}\n"; + print OUT "\tjmp __syscall_common\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/ia64/Makefile.inc b/klibc/klibc/arch/ia64/Makefile.inc index 781448770e..6363c1f948 100644 --- a/klibc/klibc/arch/ia64/Makefile.inc +++ b/klibc/klibc/arch/ia64/Makefile.inc @@ -11,6 +11,7 @@ ARCHOBJS = \ arch/$(ARCH)/vfork.o \ arch/$(ARCH)/setjmp.o \ arch/$(ARCH)/pipe.o \ + arch/$(ARCH)/syscall.o \ libgcc/__divdi3.o \ libgcc/__divsi3.o \ libgcc/__udivdi3.o \ diff --git a/klibc/klibc/arch/ia64/include/klibc/archsetjmp.h b/klibc/klibc/arch/ia64/include/klibc/archsetjmp.h deleted file mode 100644 index bd639c0b00..0000000000 --- a/klibc/klibc/arch/ia64/include/klibc/archsetjmp.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * arch/ia64/include/klibc/archsetjmp.h - * - * Code borrowed from the FreeBSD kernel. - * - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -/* User code must not depend on the internal representation of jmp_buf. */ -#define _JBLEN 0x200 - -/* guaranteed 128-bit alignment! */ -typedef char jmp_buf[_JBLEN] __attribute__ ((aligned (16))); - -#endif diff --git a/klibc/klibc/arch/ia64/include/klibc/archsignal.h b/klibc/klibc/arch/ia64/include/klibc/archsignal.h deleted file mode 100644 index 5b01f19bc2..0000000000 --- a/klibc/klibc/arch/ia64/include/klibc/archsignal.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * arch/ia64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions. - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -#define _NSIG 64 -#define _NSIG_BPW 64 -#define _NSIG_WORDS (_NSIG / _NSIG_BPW) - -typedef struct { - unsigned long sig[_NSIG_WORDS]; -} sigset_t; - -struct sigaction { - union { - __sighandler_t _sa_handler; - void (*_sa_sigaction)(int, struct siginfo *, void *); - } _u; - sigset_t sa_mask; - int sa_flags; -}; - -#define sa_handler _u._sa_handler -#define sa_sigaction _u._sa_sigaction - -#endif diff --git a/klibc/klibc/arch/ia64/include/klibc/archsys.h b/klibc/klibc/arch/ia64/include/klibc/archsys.h deleted file mode 100644 index fe331acf55..0000000000 --- a/klibc/klibc/arch/ia64/include/klibc/archsys.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * arch/ia64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -#define __IA64_BREAK "break 0x100000;;\n\t" - -#define _syscall0(type,name) \ -type \ -name (void) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15) \ - : "2" (_r15) ASM_ARGS_0 \ - : "memory" ASM_CLOBBERS_0); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return _retval; \ -} - -#define _syscall1(type,name,type1,arg1) \ -type \ -name (type1 arg1) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_1(arg1); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_1 \ - : "2" (_r15) ASM_ARGS_1 \ - : "memory" ASM_CLOBBERS_1); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return _retval; \ -} - -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type \ -name (type1 arg1, type2 arg2) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_2(arg1, arg2); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_2 \ - : "2" (_r15) ASM_ARGS_2 \ - : "memory" ASM_CLOBBERS_2); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return _retval; \ -} - -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type \ -name (type1 arg1, type2 arg2, type3 arg3) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_3(arg1, arg2, arg3); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_3 \ - : "2" (_r15) ASM_ARGS_3 \ - : "memory" ASM_CLOBBERS_3); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return _retval; \ -} - -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type \ -name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_4(arg1, arg2, arg3, arg4); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_4 \ - : "2" (_r15) ASM_ARGS_4 \ - : "memory" ASM_CLOBBERS_4); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return _retval; \ -} - -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ -type \ -name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_5(arg1, arg2, arg3, arg4, arg5); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_5 \ - : "2" (_r15) ASM_ARGS_5 \ - : "memory" ASM_CLOBBERS_5); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return _retval; \ -} - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ -type \ -name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_6 \ - : "2" (_r15) ASM_ARGS_6 \ - : "memory" ASM_CLOBBERS_6); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return _retval; \ -} - - -#define LOAD_ARGS_0() do { } while (0) -#define LOAD_ARGS_1(out0) \ - register long _out0 asm ("out0") = (long) (out0); \ - LOAD_ARGS_0 () -#define LOAD_ARGS_2(out0, out1) \ - register long _out1 asm ("out1") = (long) (out1); \ - LOAD_ARGS_1 (out0) -#define LOAD_ARGS_3(out0, out1, out2) \ - register long _out2 asm ("out2") = (long) (out2); \ - LOAD_ARGS_2 (out0, out1) -#define LOAD_ARGS_4(out0, out1, out2, out3) \ - register long _out3 asm ("out3") = (long) (out3); \ - LOAD_ARGS_3 (out0, out1, out2) -#define LOAD_ARGS_5(out0, out1, out2, out3, out4) \ - register long _out4 asm ("out4") = (long) (out4); \ - LOAD_ARGS_4 (out0, out1, out2, out3) -#define LOAD_ARGS_6(out0, out1, out2, out3, out4, out5) \ - register long _out5 asm ("out5") = (long) (out5); \ - LOAD_ARGS_5 (out0, out1, out2, out3, out4) - -#define ASM_OUTARGS_1 "=r" (_out0) -#define ASM_OUTARGS_2 ASM_OUTARGS_1, "=r" (_out1) -#define ASM_OUTARGS_3 ASM_OUTARGS_2, "=r" (_out2) -#define ASM_OUTARGS_4 ASM_OUTARGS_3, "=r" (_out3) -#define ASM_OUTARGS_5 ASM_OUTARGS_4, "=r" (_out4) -#define ASM_OUTARGS_6 ASM_OUTARGS_5, "=r" (_out5) - -#define ASM_ARGS_0 -#define ASM_ARGS_1 ASM_ARGS_0, "3" (_out0) -#define ASM_ARGS_2 ASM_ARGS_1, "4" (_out1) -#define ASM_ARGS_3 ASM_ARGS_2, "5" (_out2) -#define ASM_ARGS_4 ASM_ARGS_3, "6" (_out3) -#define ASM_ARGS_5 ASM_ARGS_4, "7" (_out4) -#define ASM_ARGS_6 ASM_ARGS_5, "8" (_out5) - -#define ASM_CLOBBERS_0 ASM_CLOBBERS_1, "out0" -#define ASM_CLOBBERS_1 ASM_CLOBBERS_2, "out1" -#define ASM_CLOBBERS_2 ASM_CLOBBERS_3, "out2" -#define ASM_CLOBBERS_3 ASM_CLOBBERS_4, "out3" -#define ASM_CLOBBERS_4 ASM_CLOBBERS_5, "out4" -#define ASM_CLOBBERS_5 ASM_CLOBBERS_6, "out5" -#define ASM_CLOBBERS_6 , "out6", "out7", \ - /* Non-stacked integer registers, minus r8, r10, r15. */ \ - "r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \ - "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \ - "r28", "r29", "r30", "r31", \ - /* Predicate registers. */ \ - "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \ - /* Non-rotating fp registers. */ \ - "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ - /* Branch registers. */ \ - "b6", "b7" - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/ia64/pipe.c b/klibc/klibc/arch/ia64/pipe.c index 5f5dd05727..0b641e8702 100644 --- a/klibc/klibc/arch/ia64/pipe.c +++ b/klibc/klibc/arch/ia64/pipe.c @@ -27,7 +27,7 @@ int pipe(int *filedes) long _retval; __asm __volatile (__IA64_BREAK : "=r" (_r8), "=r" (_r10), "=r" (_r15), - "=r" (_out0) + "=r" (_out0), "=r" (_r9) : "2" (_r15), "3" (_out0) : "memory" ASM_CLOBBERS); if (_r10 == -1) { diff --git a/klibc/klibc/arch/ia64/syscall.S b/klibc/klibc/arch/ia64/syscall.S new file mode 100644 index 0000000000..e3f264c0e4 --- /dev/null +++ b/klibc/klibc/arch/ia64/syscall.S @@ -0,0 +1,20 @@ +# +# arch/ia64/syscall.S +# + +#include + + .text + .align 32 + .proc __syscall_error + .globl __syscall_error +__syscall_error: + addl r2 = @ltoffx(errno),gp + ;; + ld8.mov r3 = [r2],errno + ;; + st4 [r3] = r8 + mov r8 = -1 + br.ret.sptk.many b0 + .size __syscall_error, .-__syscall_error + .endp __syscall_error diff --git a/klibc/klibc/arch/ia64/sysstub.ph b/klibc/klibc/arch/ia64/sysstub.ph new file mode 100644 index 0000000000..34031a29ae --- /dev/null +++ b/klibc/klibc/arch/ia64/sysstub.ph @@ -0,0 +1,29 @@ +# -*- perl -*- +# +# arch/ia64/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.text\n"; + print OUT "\t.align 32\n"; + print OUT "\t.proc ${fname}\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT "\tmov\tr15 = __NR_${sname}\n"; + print OUT "\tbreak __BREAK_SYSCALL\n"; + print OUT "\tcmp.eq p6,p0 = -1,r10\n"; + print OUT "(p6)\tbr.few __syscall_error\n"; + print OUT "\tbr.ret.sptk.many b0\n"; + print OUT "\t.size\t${fname},.-${fname}\n"; + print OUT "\t.endp\t${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/ia64/vfork.S b/klibc/klibc/arch/ia64/vfork.S index 0354fa9ef7..efcd03f7f1 100644 --- a/klibc/klibc/arch/ia64/vfork.S +++ b/klibc/klibc/arch/ia64/vfork.S @@ -27,8 +27,8 @@ vfork: mov out0=CLONE_VM|CLONE_VFORK|SIGCHLD mov out1=0 ;; - __IA64_BREAK // Do the syscall - + break 0x100000 // Do the syscall + ;; addl r15=0,r1 cmp.eq p7,p6 = -1,r10 ;; diff --git a/klibc/klibc/arch/m68k/include/klibc/archsignal.h b/klibc/klibc/arch/m68k/include/klibc/archsignal.h deleted file mode 100644 index 714527f6b0..0000000000 --- a/klibc/klibc/arch/m68k/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/m68k/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/m68k/include/klibc/archsys.h b/klibc/klibc/arch/m68k/include/klibc/archsys.h deleted file mode 100644 index 8f6bed8e94..0000000000 --- a/klibc/klibc/arch/m68k/include/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/m68k/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/mips/MCONFIG b/klibc/klibc/arch/mips/MCONFIG index 52b518461f..a248973815 100644 --- a/klibc/klibc/arch/mips/MCONFIG +++ b/klibc/klibc/arch/mips/MCONFIG @@ -7,12 +7,9 @@ # accordingly. # -ARCHREQFLAGS = -fno-pic -mno-abicalls +ARCHREQFLAGS = -fno-pic -mno-abicalls -G 0 OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 32 # Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# 2 MB -- the normal starting point for text is 4 MB. -SHAREDFLAGS = -Ttext 0x00200200 +SHAREDFLAGS = -T arch/$(ARCH)/klibc.ld diff --git a/klibc/klibc/arch/mips/Makefile.inc b/klibc/klibc/arch/mips/Makefile.inc index 09a2d2f736..e257023f34 100644 --- a/klibc/klibc/arch/mips/Makefile.inc +++ b/klibc/klibc/arch/mips/Makefile.inc @@ -11,6 +11,7 @@ ARCHOBJS = \ arch/$(ARCH)/pipe.o \ arch/$(ARCH)/vfork.o \ arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o \ libgcc/__divdi3.o \ libgcc/__moddi3.o \ libgcc/__udivdi3.o \ diff --git a/klibc/klibc/arch/mips/include/klibc/archsetjmp.h b/klibc/klibc/arch/mips/include/klibc/archsetjmp.h deleted file mode 100644 index 40e5be2736..0000000000 --- a/klibc/klibc/arch/mips/include/klibc/archsetjmp.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * arch/mips/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __s0; - unsigned long __s1; - unsigned long __s2; - unsigned long __s3; - unsigned long __s4; - unsigned long __s5; - unsigned long __s6; - unsigned long __s7; - unsigned long __gp; - unsigned long __sp; - unsigned long __s8; - unsigned long __ra; - unsigned long __f20; - unsigned long __f21; - unsigned long __f22; - unsigned long __f23; - unsigned long __f24; - unsigned long __f25; - unsigned long __f26; - unsigned long __f27; - unsigned long __f28; - unsigned long __f29; - unsigned long __f30; - unsigned long __f31; - unsigned long __fcr31; - unsigned long __unused; -} __attribute__((aligned(8))); - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/klibc/arch/mips/include/klibc/archsignal.h b/klibc/klibc/arch/mips/include/klibc/archsignal.h deleted file mode 100644 index 3b72908636..0000000000 --- a/klibc/klibc/arch/mips/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/mips/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/mips/include/klibc/archsys.h b/klibc/klibc/arch/mips/include/klibc/archsys.h deleted file mode 100644 index f696cdfaa7..0000000000 --- a/klibc/klibc/arch/mips/include/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/mips/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/mips/include/machine/asm.h b/klibc/klibc/arch/mips/include/machine/asm.h deleted file mode 100644 index e5239a6cef..0000000000 --- a/klibc/klibc/arch/mips/include/machine/asm.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * arch/mips/include/machine/asm.h - */ - -#ifndef _MACHINE_ASM_H -#define _MACHINE_ASM_H - -#include -#include - -#endif /* _MACHINE_ASM_H */ diff --git a/klibc/klibc/arch/mips/include/sgidefs.h b/klibc/klibc/arch/mips/include/sgidefs.h deleted file mode 100644 index eb103ace2c..0000000000 --- a/klibc/klibc/arch/mips/include/sgidefs.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * arch/mips/include/sgidefs.h - */ - -/* Some ABI constants */ - -#ifndef _SGIDEFS_H -#define _SGIDEFS_H - -#define _MIPS_ISA_MIPS1 1 -#define _MIPS_ISA_MIPS2 2 -#define _MIPS_ISA_MIPS3 3 -#define _MIPS_ISA_MIPS4 4 -#define _MIPS_ISA_MIPS5 5 - -#define _MIPS_SIM_ABI32 1 -#define _MIPS_SIM_NABI32 2 -#define _MIPS_SIM_ABI64 3 - -#endif /* _SGIDEFS_H */ diff --git a/klibc/klibc/arch/mips/klibc.ld b/klibc/klibc/arch/mips/klibc.ld new file mode 100644 index 0000000000..d75c9de70c --- /dev/null +++ b/klibc/klibc/arch/mips/klibc.ld @@ -0,0 +1,217 @@ +/* Linker script for klibc.so, needed because of the the damned + GNU ld script headers problem */ + +OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", + "elf32-tradlittlemips") +OUTPUT_ARCH(mips) +ENTRY(__start) +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + /* This address needs to be reachable using normal inter-module + calls, and work on the memory models for this architecture */ + /* 2 MB -- the normal starting point for text is 4 MB */ + . = 0x00200400; + .interp : { *(.interp) } + .reginfo : { *(.reginfo) } + .dynamic : { *(.dynamic) } + .hash : { *(.hash) } + .dynsym : { *(.dynsym) } + .dynstr : { *(.dynstr) } + .gnu.version : { *(.gnu.version) } + .gnu.version_d : { *(.gnu.version_d) } + .gnu.version_r : { *(.gnu.version_r) } + .rel.dyn : + { + *(.rel.init) + *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) + *(.rel.fini) + *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) + *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) + *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) + *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) + *(.rel.ctors) + *(.rel.dtors) + *(.rel.got) + *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) + *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) + *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) + *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) + *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) + } + .rela.dyn : + { + *(.rela.init) + *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) + *(.rela.fini) + *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) + *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) + *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) + *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) + *(.rela.ctors) + *(.rela.dtors) + *(.rela.got) + *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) + *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) + *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) + *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) + *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) + } + .rel.plt : { *(.rel.plt) } + .rela.plt : { *(.rela.plt) } + .init : + { + KEEP (*(.init)) + } =0 + .plt : { *(.plt) } + .text : + { + _ftext = . ; + *(.text .stub .text.* .gnu.linkonce.t.*) + /* .gnu.warning sections are handled specially by elf32.em. */ + *(.gnu.warning) + *(.mips16.fn.*) *(.mips16.call.*) + } =0 + .fini : + { + KEEP (*(.fini)) + } =0 + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } + .rodata1 : { *(.rodata1) } + .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } + .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } + .eh_frame_hdr : { *(.eh_frame_hdr) } + /* Adjust the address for the data segment. We want to adjust up to + the same address within the page on the next page up. */ + . = ALIGN(8192); + /* Ensure the __preinit_array_start label is properly aligned. We + could instead move the label definition inside the section, but + the linker would then create the section even if it turns out to + be empty, which isn't pretty. */ + . = ALIGN(32 / 8); + PROVIDE (__preinit_array_start = .); + .preinit_array : { *(.preinit_array) } + PROVIDE (__preinit_array_end = .); + PROVIDE (__init_array_start = .); + .init_array : { *(.init_array) } + PROVIDE (__init_array_end = .); + PROVIDE (__fini_array_start = .); + .fini_array : { *(.fini_array) } + PROVIDE (__fini_array_end = .); + .data : + { + _fdata = . ; + *(.data .data.* .gnu.linkonce.d.*) + SORT(CONSTRUCTORS) + } + .data1 : { *(.data1) } + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } + .eh_frame : { KEEP (*(.eh_frame)) } + .gcc_except_table : { *(.gcc_except_table) } + .ctors : + { + /* gcc uses crtbegin.o to find the start of + the constructors, so we make sure it is + first. Because this is a wildcard, it + doesn't matter if the user does not + actually link against crtbegin.o; the + linker won't look for a file to match a + wildcard. The wildcard also means that it + doesn't matter which directory crtbegin.o + is in. */ + KEEP (*crtbegin*.o(.ctors)) + /* We don't want to include the .ctor section from + from the crtend.o file until after the sorted ctors. + The .ctor section from the crtend file contains the + end of ctors marker and it must be last */ + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) + KEEP (*(SORT(.ctors.*))) + KEEP (*(.ctors)) + } + .dtors : + { + KEEP (*crtbegin*.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + } + .jcr : { KEEP (*(.jcr)) } + _gp = ALIGN(16) + 0x7ff0; + .got : { *(.got.plt) *(.got) } + /* We want the small data sections together, so single-instruction offsets + can access them all, and initialized data all before uninitialized, so + we can shorten the on-disk segment size. */ + .sdata : + { + *(.sdata .sdata.* .gnu.linkonce.s.*) + } + .lit8 : { *(.lit8) } + .lit4 : { *(.lit4) } + _edata = .; + PROVIDE (edata = .); + __bss_start = .; + _fbss = .; + .sbss : + { + PROVIDE (__sbss_start = .); + PROVIDE (___sbss_start = .); + *(.dynsbss) + *(.sbss .sbss.* .gnu.linkonce.sb.*) + *(.scommon) + PROVIDE (__sbss_end = .); + PROVIDE (___sbss_end = .); + } + .bss : + { + *(.dynbss) + *(.bss .bss.* .gnu.linkonce.b.*) + *(COMMON) + /* Align here to ensure that the .bss section occupies space up to + _end. Align after .bss to ensure correct alignment even if the + .bss section disappears because there are no input sections. */ + . = ALIGN(32 / 8); + } + . = ALIGN(32 / 8); + _end = .; + PROVIDE (end = .); + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } + .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } + .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } + /DISCARD/ : { *(.note.GNU-stack) } +} diff --git a/klibc/klibc/arch/mips/syscall.S b/klibc/klibc/arch/mips/syscall.S new file mode 100644 index 0000000000..d5c1fe1c7d --- /dev/null +++ b/klibc/klibc/arch/mips/syscall.S @@ -0,0 +1,15 @@ +#include +#include +#include + + .set noreorder + +LEAF(__syscall_common) + syscall + beqz a3, 1f + # sw is actually two instructions; the first one goes + # in the branch delay slot + sw v0, errno + li v0, -1 +1: jr ra + END(__syscall_common) diff --git a/klibc/klibc/arch/mips/sysstub.ph b/klibc/klibc/arch/mips/sysstub.ph new file mode 100644 index 0000000000..abe599c17d --- /dev/null +++ b/klibc/klibc/arch/mips/sysstub.ph @@ -0,0 +1,30 @@ +# -*- perl -*- +# +# arch/mips/sysstub.ph +# +# Script to generate system call stubs +# + +# On MIPS, most system calls follow the standard convention, with the +# system call number in r0 (v0), return an error value in r19 (a3) as +# well as the return value in r0 (v0). + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + $stype = $stype || 'common'; + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "#include \n"; + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.set noreorder\n"; + print OUT "\n"; + print OUT "LEAF(${fname})\n"; + print OUT "\tj\t__syscall_${stype}\n"; + print OUT "\t li\tv0, __NR_${sname}\n"; + print OUT "\tEND(${fname})\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/mips/vfork.S b/klibc/klibc/arch/mips/vfork.S index aca8083aa4..9829867fab 100644 --- a/klibc/klibc/arch/mips/vfork.S +++ b/klibc/klibc/arch/mips/vfork.S @@ -6,14 +6,11 @@ #define CLONE_VFORK 0x00004000 #define SIGCHLD 18 + .set noreorder + LEAF(vfork) li a0, CLONE_VFORK | CLONE_VM | SIGCHLD li a1, 0 - li v0, __NR_clone - syscall - bnez a3, 1f - b 2f -1: sw v0, errno - li v0, -1 -2: jr ra + j __syscall_common + li v0, __NR_clone END(vfork) diff --git a/klibc/klibc/arch/mips64/include/klibc/archsignal.h b/klibc/klibc/arch/mips64/include/klibc/archsignal.h deleted file mode 100644 index 56b0fd323e..0000000000 --- a/klibc/klibc/arch/mips64/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/mips64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/mips64/include/klibc/archsys.h b/klibc/klibc/arch/mips64/include/klibc/archsys.h deleted file mode 100644 index 81e5106e16..0000000000 --- a/klibc/klibc/arch/mips64/include/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/mips64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/parisc/Makefile.inc b/klibc/klibc/arch/parisc/Makefile.inc index abe9155bf4..980a543ed2 100644 --- a/klibc/klibc/arch/parisc/Makefile.inc +++ b/klibc/klibc/arch/parisc/Makefile.inc @@ -8,8 +8,12 @@ # ARCHOBJS = \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o ARCHOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS)) archclean: + +arch/$(ARCH)/syscall.o: arch/$(ARCH)/syscall.c + $(CC) $(CFLAGS) -ffixed-r20 -c -o $@ $< diff --git a/klibc/klibc/arch/parisc/include/klibc/archsignal.h b/klibc/klibc/arch/parisc/include/klibc/archsignal.h deleted file mode 100644 index 3190e8528e..0000000000 --- a/klibc/klibc/arch/parisc/include/klibc/archsignal.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * arch/parisc/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -#define _NSIG 64 -#define _NSIG_SZ (_NSIG / LONG_BIT) - -typedef struct { - unsigned long sig[_NSIG_SZ]; -} sigset_t; - -struct sigaction { - __sighandler_t sa_handler; - unsigned long sa_flags; - sigset_t sa_mask; -}; - -#endif diff --git a/klibc/klibc/arch/parisc/include/klibc/archsys.h b/klibc/klibc/arch/parisc/include/klibc/archsys.h deleted file mode 100644 index 5013ba8794..0000000000 --- a/klibc/klibc/arch/parisc/include/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/parisc/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/parisc/syscall.c b/klibc/klibc/arch/parisc/syscall.c new file mode 100644 index 0000000000..99ef5fe103 --- /dev/null +++ b/klibc/klibc/arch/parisc/syscall.c @@ -0,0 +1,29 @@ +/* + * arch/parisc/syscall.c + * + * This function is called from a stub with %r20 already set up. + * Compile this function with -ffixed-r20 so that it doesn't clobber + * this register by mistake. + */ + +#include +#include + +long __syscall_common(long a0, long a1, long a2, long a3, long a4, long a5) +{ + register unsigned long rv asm ("r28"); + + asm volatile("\tble 0x100(%%sr2, %%r0)\n" + : "=r" (rv) + : "r" (a0), "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5) + : "%r1", "%r2", "%r29", "%r31"); + + if ( __unlikely(rv >= -4095UL) ) { + errno = -rv; + return -1L; + } else { + return (long)rv; + } +} + + diff --git a/klibc/klibc/arch/parisc/sysstub.ph b/klibc/klibc/arch/parisc/sysstub.ph new file mode 100644 index 0000000000..eb6b5dd92a --- /dev/null +++ b/klibc/klibc/arch/parisc/sysstub.ph @@ -0,0 +1,29 @@ +# -*- perl -*- +# +# arch/parisc/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.text\n"; + print OUT "\t.align 4\n"; + print OUT "\t.import __syscall_common, code\n"; + print OUT "\t.global ${fname}\n"; + print OUT "\t.export ${fname}, code\n"; + print OUT "\t.type ${fname}, @function\n"; + print OUT "\t.proc\n"; + print OUT "\.callinfo\n"; + print OUT "${fname}:\n"; + print OUT "\tb\t__syscall_common\n"; + print OUT "\t ldo\t__NR_${sname}(%r0),%r20\n"; + print OUT "\t.procend\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/ppc/MCONFIG b/klibc/klibc/arch/ppc/MCONFIG index fcb0992150..ff7c44db9a 100644 --- a/klibc/klibc/arch/ppc/MCONFIG +++ b/klibc/klibc/arch/ppc/MCONFIG @@ -9,3 +9,10 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 32 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 256-16 MB - normal binaries start at 256 MB, and jumps are limited +# to +/- 16 MB +SHAREDFLAGS = -Ttext 0x0f000200 diff --git a/klibc/klibc/arch/ppc/Makefile.inc b/klibc/klibc/arch/ppc/Makefile.inc index 3bd2c0643c..c6bb975f0f 100644 --- a/klibc/klibc/arch/ppc/Makefile.inc +++ b/klibc/klibc/arch/ppc/Makefile.inc @@ -9,6 +9,7 @@ ARCHOBJS = \ arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o \ libgcc/__divdi3.o \ libgcc/__moddi3.o \ libgcc/__udivdi3.o \ diff --git a/klibc/klibc/arch/ppc/include/klibc/archsetjmp.h b/klibc/klibc/arch/ppc/include/klibc/archsetjmp.h deleted file mode 100644 index 53e2fccc3b..0000000000 --- a/klibc/klibc/arch/ppc/include/klibc/archsetjmp.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * arch/ppc/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __r2; - unsigned long __sp; - unsigned long __lr; - unsigned long __cr; - unsigned long __r13; - unsigned long __r14; - unsigned long __r15; - unsigned long __r16; - unsigned long __r17; - unsigned long __r18; - unsigned long __r19; - unsigned long __r20; - unsigned long __r21; - unsigned long __r22; - unsigned long __r23; - unsigned long __r24; - unsigned long __r25; - unsigned long __r26; - unsigned long __r27; - unsigned long __r28; - unsigned long __r29; - unsigned long __r30; - unsigned long __r31; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/ppc/include/klibc/archsignal.h b/klibc/klibc/arch/ppc/include/klibc/archsignal.h deleted file mode 100644 index 567a547ef9..0000000000 --- a/klibc/klibc/arch/ppc/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/ppc/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/ppc/include/klibc/archsys.h b/klibc/klibc/arch/ppc/include/klibc/archsys.h deleted file mode 100644 index 17a28859e5..0000000000 --- a/klibc/klibc/arch/ppc/include/klibc/archsys.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * arch/ppc/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* PowerPC seems to lack _syscall6() in its headers */ -/* This seems to work on both 32- and 64-bit ppc */ - -#ifndef _syscall6 - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ - unsigned long __sc_ret, __sc_err; \ - { \ - register unsigned long __sc_0 __asm__ ("r0"); \ - register unsigned long __sc_3 __asm__ ("r3"); \ - register unsigned long __sc_4 __asm__ ("r4"); \ - register unsigned long __sc_5 __asm__ ("r5"); \ - register unsigned long __sc_6 __asm__ ("r6"); \ - register unsigned long __sc_7 __asm__ ("r7"); \ - register unsigned long __sc_8 __asm__ ("r8"); \ - \ - __sc_3 = (unsigned long) (arg1); \ - __sc_4 = (unsigned long) (arg2); \ - __sc_5 = (unsigned long) (arg3); \ - __sc_6 = (unsigned long) (arg4); \ - __sc_7 = (unsigned long) (arg5); \ - __sc_8 = (unsigned long) (arg6); \ - __sc_0 = __NR_##name; \ - __asm__ __volatile__ \ - ("sc \n\t" \ - "mfcr %1 " \ - : "+r" (__sc_3), \ - "+r" (__sc_0), \ - "+r" (__sc_4), \ - "+r" (__sc_5), \ - "+r" (__sc_6), \ - "+r" (__sc_7), \ - "+r" (__sc_8) \ - : : "cr0", "ctr", "memory", \ - "r9", "r10", "r11", "r12"); \ - __sc_ret = __sc_3; \ - __sc_err = __sc_0; \ - } \ - if (__sc_err & 0x10000000) \ - { \ - errno = (int)__sc_ret; \ - __sc_ret = -1; \ - } \ - return (type)__sc_ret; \ -} - -#endif /* _syscall6() missing */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/ppc/syscall.S b/klibc/klibc/arch/ppc/syscall.S new file mode 100644 index 0000000000..0a7c37c903 --- /dev/null +++ b/klibc/klibc/arch/ppc/syscall.S @@ -0,0 +1,16 @@ +/* + * arch/ppc/syscall.S + * + * Common error-handling path for system calls. + */ + + .text + .align 2 + .globl __syscall_error + .type __syscall_error,@function +__syscall_error: + lis 9,errno@ha + stw 3,errno@l(9) + li 3,-1 + blr + .size __syscall_error,.-__syscall_error diff --git a/klibc/klibc/arch/ppc/sysstub.ph b/klibc/klibc/arch/ppc/sysstub.ph new file mode 100644 index 0000000000..542ab5575c --- /dev/null +++ b/klibc/klibc/arch/ppc/sysstub.ph @@ -0,0 +1,25 @@ +# -*- perl -*- +# +# arch/ppc/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.type ${fname},\@function\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT "\tli 0,__NR_${sname}\n"; + print OUT "\tsc\n"; + print OUT "\tbnslr\n"; + print OUT "\tb __syscall_error\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/ppc64/MCONFIG b/klibc/klibc/arch/ppc64/MCONFIG index 6997693e99..86526f895c 100644 --- a/klibc/klibc/arch/ppc64/MCONFIG +++ b/klibc/klibc/arch/ppc64/MCONFIG @@ -9,3 +9,10 @@ OPTFLAGS = -Os -fomit-frame-pointer BITSIZE = 64 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 256-16 MB - normal binaries start at 256 MB, and jumps are limited +# to +/- 16 MB +SHAREDFLAGS = -Ttext 0x0f000200 diff --git a/klibc/klibc/arch/ppc64/Makefile.inc b/klibc/klibc/arch/ppc64/Makefile.inc index 3ab3a8c8e6..928df1aeb7 100644 --- a/klibc/klibc/arch/ppc64/Makefile.inc +++ b/klibc/klibc/arch/ppc64/Makefile.inc @@ -8,8 +8,18 @@ # ARCHOBJS = \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) +INTERP_O = interp1.o + +interp.o: interp1.o klibc.got + $(LD) $(LDFLAGS) -r -o $@ interp1.o klibc.got + +klibc.got: $(SOHASH) + $(OBJCOPY) -j.got $< $@ + archclean: + rm -f klibc.got diff --git a/klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h b/klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h deleted file mode 100644 index 006a2e27be..0000000000 --- a/klibc/klibc/arch/ppc64/include/klibc/archsetjmp.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * arch/ppc64/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __r2; - unsigned long __sp; - unsigned long __lr; - unsigned long __cr; - unsigned long __r13; - unsigned long __r14; - unsigned long __r15; - unsigned long __r16; - unsigned long __r17; - unsigned long __r18; - unsigned long __r19; - unsigned long __r20; - unsigned long __r21; - unsigned long __r22; - unsigned long __r23; - unsigned long __r24; - unsigned long __r25; - unsigned long __r26; - unsigned long __r27; - unsigned long __r28; - unsigned long __r29; - unsigned long __r30; - unsigned long __r31; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/ppc64/include/klibc/archsignal.h b/klibc/klibc/arch/ppc64/include/klibc/archsignal.h deleted file mode 100644 index 8452f6e4bc..0000000000 --- a/klibc/klibc/arch/ppc64/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/ppc64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/ppc64/include/klibc/archsys.h b/klibc/klibc/arch/ppc64/include/klibc/archsys.h deleted file mode 100644 index 4f81fee00d..0000000000 --- a/klibc/klibc/arch/ppc64/include/klibc/archsys.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * arch/ppc64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -#ifndef _syscall6 - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ - unsigned long __sc_ret, __sc_err; \ - { \ - register unsigned long __sc_0 __asm__ ("r0"); \ - register unsigned long __sc_3 __asm__ ("r3"); \ - register unsigned long __sc_4 __asm__ ("r4"); \ - register unsigned long __sc_5 __asm__ ("r5"); \ - register unsigned long __sc_6 __asm__ ("r6"); \ - register unsigned long __sc_7 __asm__ ("r7"); \ - register unsigned long __sc_8 __asm__ ("r8"); \ - \ - __sc_3 = (unsigned long) (arg1); \ - __sc_4 = (unsigned long) (arg2); \ - __sc_5 = (unsigned long) (arg3); \ - __sc_6 = (unsigned long) (arg4); \ - __sc_7 = (unsigned long) (arg5); \ - __sc_8 = (unsigned long) (arg6); \ - __sc_0 = __NR_##name; \ - __asm__ __volatile__ \ - ("sc \n\t" \ - "mfcr %1 " \ - : "=&r" (__sc_3), "=&r" (__sc_0) \ - : "0" (__sc_3), "1" (__sc_0), \ - "r" (__sc_4), \ - "r" (__sc_5), \ - "r" (__sc_6), \ - "r" (__sc_7), \ - "r" (__sc_8) \ - : __syscall_clobbers); \ - __sc_ret = __sc_3; \ - __sc_err = __sc_0; \ - } \ - __syscall_return (type); \ -} - -#endif /* _syscall6() missing */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/ppc64/setjmp.S b/klibc/klibc/arch/ppc64/setjmp.S index 1dcc67035e..30db419140 100644 --- a/klibc/klibc/arch/ppc64/setjmp.S +++ b/klibc/klibc/arch/ppc64/setjmp.S @@ -2,7 +2,6 @@ # arch/ppc64/setjmp.S # # Basic setjmp/longjmp implementation -# This file was derived from the equivalent file in NetBSD # .text @@ -17,13 +16,33 @@ setjmp: .globl setjmp .globl .setjmp .setjmp: - mflr %r11 /* save return address */ - mfcr %r12 /* save condition register */ - mr %r10,%r1 /* save stack pointer */ - mr %r9,%r2 /* save GPR2 (not needed) */ - stmw %r9,0(%r3) /* save r9..r31 */ - li %r3,0 /* indicate success */ - blr /* return */ + mflr %r11 /* save return address */ + mfcr %r12 /* save condition register */ + std %r2,0(%r3) /* save TOC pointer (not needed) */ + stdu %r1,8(%r3) /* save stack pointer */ + stdu %r11,8(%r3) + stdu %r12,8(%r3) + stdu %r13,8(%r3) /* save caller saved regs */ + stdu %r14,8(%r3) + stdu %r15,8(%r3) + stdu %r16,8(%r3) + stdu %r17,8(%r3) + stdu %r18,8(%r3) + stdu %r19,8(%r3) + stdu %r20,8(%r3) + stdu %r21,8(%r3) + stdu %r22,8(%r3) + stdu %r23,8(%r3) + stdu %r24,8(%r3) + stdu %r25,8(%r3) + stdu %r26,8(%r3) + stdu %r27,8(%r3) + stdu %r28,8(%r3) + stdu %r29,8(%r3) + stdu %r30,8(%r3) + std %r31,8(%r3) + li %r3,0 /* indicate success */ + blr /* return */ .size .setjmp,.-.setjmp .section ".opd","aw" @@ -35,12 +54,32 @@ longjmp: .globl longjmp .globl .longjmp .longjmp: - lmw %r9,0(%r3) /* save r9..r31 */ - mtlr %r11 /* restore LR */ - mtcr %r12 /* restore CR */ - mr %r2,%r9 /* restore GPR2 (not needed) */ - mr %r1,%r10 /* restore stack */ - mr %r3,%r4 /* get return value */ - blr /* return */ + ld %r2,0(%r3) /* restore TOC pointer (not needed) */ + ldu %r1,8(%r3) /* restore stack */ + ldu %r11,8(%r3) + ldu %r12,8(%r3) + ldu %r13,8(%r3) /* restore caller saved regs */ + ldu %r14,8(%r3) + ldu %r15,8(%r3) + ldu %r16,8(%r3) + ldu %r17,8(%r3) + ldu %r18,8(%r3) + ldu %r19,8(%r3) + ldu %r20,8(%r3) + ldu %r21,8(%r3) + ldu %r22,8(%r3) + ldu %r23,8(%r3) + ldu %r24,8(%r3) + ldu %r25,8(%r3) + ldu %r26,8(%r3) + ldu %r27,8(%r3) + ldu %r28,8(%r3) + ldu %r29,8(%r3) + ldu %r30,8(%r3) + ld %r31,8(%r3) + mtlr %r11 /* restore LR */ + mtcr %r12 /* restore CR */ + mr %r3,%r4 /* get return value */ + blr /* return */ .size .longjmp,.-.longjmp diff --git a/klibc/klibc/arch/ppc64/syscall.c b/klibc/klibc/arch/ppc64/syscall.c new file mode 100644 index 0000000000..a5895fe88e --- /dev/null +++ b/klibc/klibc/arch/ppc64/syscall.c @@ -0,0 +1,14 @@ +/* + * arch/ppc64/syscall.c + * + * Common error-handling path for system calls. + * The return value from __syscall_error becomes the + * return value from the system call. + */ +#include + +long int __syscall_error(long int err) +{ + errno = err; + return -1; +} diff --git a/klibc/klibc/arch/ppc64/sysstub.ph b/klibc/klibc/arch/ppc64/sysstub.ph new file mode 100644 index 0000000000..1469cc6071 --- /dev/null +++ b/klibc/klibc/arch/ppc64/sysstub.ph @@ -0,0 +1,34 @@ +# -*- perl -*- +# +# arch/ppc64/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "\t.section \".opd\",\"aw\"\n"; + print OUT "\t.align 3\n"; + print OUT "${fname}:\n"; + print OUT "\t.quad .${fname},.TOC.\@tocbase,0\n"; + print OUT "\t.size ${fname},24\n"; + print OUT "\t.text\n"; + print OUT "\t.type .${fname},\@function\n"; + print OUT "\t.globl .${fname}\n"; + print OUT ".${fname}:\n"; + print OUT "\tli 0,__NR_${sname}\n"; + print OUT "\tsc\n"; + print OUT "\tmfcr 0\n"; + print OUT "\trldicl. 9,0,36,63\n"; + print OUT "\tbeqlr- 0\n"; + print OUT "\tb .__syscall_error\n"; + print OUT "\t.size .${fname},.-.${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/s390/Makefile.inc b/klibc/klibc/arch/s390/Makefile.inc index c50f4f2886..49b64ddbc6 100644 --- a/klibc/klibc/arch/s390/Makefile.inc +++ b/klibc/klibc/arch/s390/Makefile.inc @@ -9,6 +9,8 @@ ARCHOBJS = \ arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/mmap.o \ + arch/$(ARCH)/syscall.o \ libgcc/__divdi3.o \ libgcc/__moddi3.o \ libgcc/__udivdi3.o \ diff --git a/klibc/klibc/arch/s390/include/klibc/archsetjmp.h b/klibc/klibc/arch/s390/include/klibc/archsetjmp.h deleted file mode 100644 index 11a641ed5a..0000000000 --- a/klibc/klibc/arch/s390/include/klibc/archsetjmp.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * arch/s390/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - uint32_t __gregs[10]; /* general registers r6-r15 */ - uint64_t __fpregs[2]; /* fp registers f4 and f6 */ -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/s390/include/klibc/archsignal.h b/klibc/klibc/arch/s390/include/klibc/archsignal.h deleted file mode 100644 index 1f8de28b4b..0000000000 --- a/klibc/klibc/arch/s390/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/s390/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/s390/include/klibc/archsys.h b/klibc/klibc/arch/s390/include/klibc/archsys.h deleted file mode 100644 index 1cd0948f3c..0000000000 --- a/klibc/klibc/arch/s390/include/klibc/archsys.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * arch/s390/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* S/390 only has five syscall parameters, and uses a structure for - 6-argument syscalls. */ - -#ifndef _syscall6 - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,\ - type4,arg4,type5,arg5,type6,arg6) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ - type5 arg5, type6 arg6) { \ - unsigned long __arg[6] = { \ - (unsigned long) arg1, \ - (unsigned long) arg2, \ - (unsigned long) arg3, \ - (unsigned long) arg4, \ - (unsigned long) arg5, \ - (unsigned long) arg6 \ - }; \ - register void *__argp asm("2") = &__arg; \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - " lr %0,2" \ - : "=d" (__res) \ - : "i" (__NR_##name), \ - "d" (__argp) \ - : _svc_clobber); \ - __syscall_return(type, __res); \ -} - -#endif /* _syscall6() missing */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/s390/mmap.c b/klibc/klibc/arch/s390/mmap.c new file mode 100644 index 0000000000..51ff07f44c --- /dev/null +++ b/klibc/klibc/arch/s390/mmap.c @@ -0,0 +1,41 @@ +#include +#include + +struct mmap_arg_struct { + unsigned long addr; + unsigned long len; + unsigned long prot; + unsigned long flags; + unsigned long fd; + unsigned long offset; +}; + +void * __mmap2(void * addr, size_t len, int prot, int flags, + int fd, long offset) +{ + struct mmap_arg_struct args = { + (unsigned long) addr, + (unsigned long) len, + (unsigned long) prot, + (unsigned long) flags, + (unsigned long) fd, + (unsigned long) offset, + }; + + register struct mmap_arg_struct *__arg1 asm("2") = &args; + register long __svcres asm("2"); + unsigned long __res; + + __asm__ __volatile__ ( + " svc %b1\n" + : "=d" (__svcres) + : "i" (__NR_mmap2), + "0" (__arg1) + : "1", "cc", "memory"); + __res = __svcres; + if (__res >= (unsigned long)-125) { + errno = -__res; + __res = -1; + } + return (void *)__res; +} diff --git a/klibc/klibc/arch/s390/syscall.c b/klibc/klibc/arch/s390/syscall.c new file mode 100644 index 0000000000..c0f17c453c --- /dev/null +++ b/klibc/klibc/arch/s390/syscall.c @@ -0,0 +1,16 @@ +/* + * arch/s390/syscall.c + * + * Common error-handling path for system calls. + * The return value from __syscall_common becomes the + * return value from the system call. + */ +#include + +long int __syscall_common(long int err) +{ + if ((unsigned long)(err) < (unsigned long)(-125)) + return err; + errno = err; + return -1; +} diff --git a/klibc/klibc/arch/s390/sysstub.ph b/klibc/klibc/arch/s390/sysstub.ph new file mode 100644 index 0000000000..3838a1f1b2 --- /dev/null +++ b/klibc/klibc/arch/s390/sysstub.ph @@ -0,0 +1,31 @@ +# -*- perl -*- +# +# arch/s390/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.type ${fname},\@function\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT ".if __NR_${sname} < 256\n"; + print OUT "\tsvc __NR_${sname}\n"; + print OUT ".else\n"; + print OUT "\tlhi %r1,__NR_${sname}\n"; + print OUT "\tsvc 0\n"; + print OUT ".endif\n"; + print OUT "\tbras %r3,1f\n"; + print OUT "\t.long __syscall_common\n"; + print OUT "1:\tl %r3,0(%r3)\n"; + print OUT "\tbr %r3\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/s390x/Makefile.inc b/klibc/klibc/arch/s390x/Makefile.inc index eff8f951ac..9d614e07b2 100644 --- a/klibc/klibc/arch/s390x/Makefile.inc +++ b/klibc/klibc/arch/s390x/Makefile.inc @@ -8,7 +8,9 @@ # ARCHOBJS = \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/mmap.o \ + arch/$(ARCH)/syscall.o ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) diff --git a/klibc/klibc/arch/s390x/include/klibc/archsetjmp.h b/klibc/klibc/arch/s390x/include/klibc/archsetjmp.h deleted file mode 100644 index dd3ed0d47c..0000000000 --- a/klibc/klibc/arch/s390x/include/klibc/archsetjmp.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * arch/s390x/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - uint64_t __gregs[10]; /* general registers r6-r15 */ - uint64_t __fpregs[4]; /* fp registers f1, f3, f5, f7 */ -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/s390x/include/klibc/archsignal.h b/klibc/klibc/arch/s390x/include/klibc/archsignal.h deleted file mode 100644 index 08c9a0073a..0000000000 --- a/klibc/klibc/arch/s390x/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/s390x/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/s390x/include/klibc/archsys.h b/klibc/klibc/arch/s390x/include/klibc/archsys.h deleted file mode 100644 index 15f7113bb4..0000000000 --- a/klibc/klibc/arch/s390x/include/klibc/archsys.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * arch/s390x/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* S/390X only has five syscall parameters, and uses a structure for - 6-argument syscalls. */ - -#ifndef _syscall6 - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,\ - type4,arg4,type5,arg5,type6,arg6) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ - type5 arg5, type6 arg6) { \ - unsigned long __arg[6] = { \ - (unsigned long) arg1, \ - (unsigned long) arg2, \ - (unsigned long) arg3, \ - (unsigned long) arg4, \ - (unsigned long) arg5, \ - (unsigned long) arg6 \ - }; \ - register void *__argp asm("2") = &__arg; \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - " lgr %0,2" \ - : "=d" (__res) \ - : "i" (__NR_##name), \ - "d" (__argp) \ - : _svc_clobber); \ - __syscall_return(type, __res); \ -} - -#endif /* _syscall6() missing */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/s390x/mmap.c b/klibc/klibc/arch/s390x/mmap.c new file mode 100644 index 0000000000..158f0933a4 --- /dev/null +++ b/klibc/klibc/arch/s390x/mmap.c @@ -0,0 +1,41 @@ +#include +#include + +struct mmap_arg_struct { + unsigned long addr; + unsigned long len; + unsigned long prot; + unsigned long flags; + unsigned long fd; + unsigned long offset; +}; + +void * mmap(void * addr, size_t len, int prot, int flags, + int fd, off_t offset) +{ + struct mmap_arg_struct args = { + (unsigned long) addr, + (unsigned long) len, + (unsigned long) prot, + (unsigned long) flags, + (unsigned long) fd, + (unsigned long) offset, + }; + + register struct mmap_arg_struct *__arg1 asm("2") = &args; + register long __svcres asm("2"); + unsigned long __res; + + __asm__ __volatile__ ( + " svc %b1\n" + : "=d" (__svcres) + : "i" (__NR_mmap), + "0" (__arg1) + : "1", "cc", "memory"); + __res = __svcres; + if (__res >= (unsigned long)-125) { + errno = -__res; + __res = -1; + } + return (void *)__res; +} diff --git a/klibc/klibc/arch/s390x/syscall.c b/klibc/klibc/arch/s390x/syscall.c new file mode 100644 index 0000000000..c0f17c453c --- /dev/null +++ b/klibc/klibc/arch/s390x/syscall.c @@ -0,0 +1,16 @@ +/* + * arch/s390/syscall.c + * + * Common error-handling path for system calls. + * The return value from __syscall_common becomes the + * return value from the system call. + */ +#include + +long int __syscall_common(long int err) +{ + if ((unsigned long)(err) < (unsigned long)(-125)) + return err; + errno = err; + return -1; +} diff --git a/klibc/klibc/arch/s390x/sysstub.ph b/klibc/klibc/arch/s390x/sysstub.ph new file mode 100644 index 0000000000..10a47f7b07 --- /dev/null +++ b/klibc/klibc/arch/s390x/sysstub.ph @@ -0,0 +1,28 @@ +# -*- perl -*- +# +# arch/s390x/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.type ${fname},\@function\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT ".if __NR_${sname} < 256\n"; + print OUT "\tsvc __NR_${sname}\n"; + print OUT ".else\n"; + print OUT "\tlghi %r1,__NR_${sname}\n"; + print OUT "\tsvc 0\n"; + print OUT ".endif\n"; + print OUT "\tbrasl %r3,__syscall_common\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/sh/Makefile.inc b/klibc/klibc/arch/sh/Makefile.inc index 16d7ea1e18..ccabfa496b 100644 --- a/klibc/klibc/arch/sh/Makefile.inc +++ b/klibc/klibc/arch/sh/Makefile.inc @@ -7,7 +7,8 @@ # accordingly. # -ARCHOBJS = arch/sh/setjmp.o +ARCHOBJS = arch/sh/setjmp.o \ + arch/sh/syscall.o ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) diff --git a/klibc/klibc/arch/sh/crt0.S b/klibc/klibc/arch/sh/crt0.S index c9938a5612..21a37655f2 100644 --- a/klibc/klibc/arch/sh/crt0.S +++ b/klibc/klibc/arch/sh/crt0.S @@ -1,12 +1,11 @@ # # arch/sh/crt0.S # -# void _start(void) -# { -# /* Divine up argc, argv, and envp */ -# environ = envp; -# exit(main(argc, argv, envp)); -# } +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. # .text diff --git a/klibc/klibc/arch/sh/include/klibc/archsetjmp.h b/klibc/klibc/arch/sh/include/klibc/archsetjmp.h deleted file mode 100644 index 28dd932fbc..0000000000 --- a/klibc/klibc/arch/sh/include/klibc/archsetjmp.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * arch/sh/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long r11; - unsigned long r12; - unsigned long r13; - unsigned long r14; - unsigned long r15; - unsigned long pr; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/klibc/arch/sh/include/klibc/archsignal.h b/klibc/klibc/arch/sh/include/klibc/archsignal.h deleted file mode 100644 index 6c4e5976ad..0000000000 --- a/klibc/klibc/arch/sh/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/sh/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/sh/include/klibc/archsys.h b/klibc/klibc/arch/sh/include/klibc/archsys.h deleted file mode 100644 index 5f8050a536..0000000000 --- a/klibc/klibc/arch/sh/include/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/sh/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/sh/syscall.S b/klibc/klibc/arch/sh/syscall.S new file mode 100644 index 0000000000..41a0486679 --- /dev/null +++ b/klibc/klibc/arch/sh/syscall.S @@ -0,0 +1,35 @@ +/* + * arch/sh/syscall.S + * + * On sh, r3 contains the syscall number (set by generated stub); + * r4..r7 contain arguments 0-3 per the standard calling convention, + * and arguments 4-5 are passed in r0 and r1. + * + * The return value is in r3 rather than standard r0. + */ + + .section ".text.syscall","ax" + .align 2 + .globl ___syscall_common + .type ___syscall_common,@function +___syscall_common: + mov.l @(sp),r0 + mov.l @(4,sp),r1 + trapa #0x15 + mov.l 1f,r0 + cmp/hs r0,r3 + bt/s 3f + neg r3,r4 + mov.l 2f,r5 + mov.l r4,@r5 + rts + mov #-1,r0 +3: + rts + mov r3,r0 + + .align 2 +1: .long -4096 /* Errno limit */ +2: .long errno + + .size ___syscall_common,.-___syscall_common diff --git a/klibc/klibc/arch/sh/sysstub.ph b/klibc/klibc/arch/sh/sysstub.ph new file mode 100644 index 0000000000..add5d35892 --- /dev/null +++ b/klibc/klibc/arch/sh/sysstub.ph @@ -0,0 +1,34 @@ +# -*- perl -*- +# +# arch/sh/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.section\t\".text.syscall\",\"ax\"\n"; + print OUT "\t.type\t${fname},\#function\n"; + print OUT "\t.globl\t${fname}\n"; + print OUT "\t.align\t2\n"; + print OUT "${fname}:\n"; + print OUT "\tbra\t__syscall_common\n"; + print OUT "#if __NR_${sname} >= 128\n"; + print OUT "\t mov.l\t1f, r3\n"; + print OUT "#else\n"; + print OUT "\t mov\t# __NR_${sname}, r3\n"; + print OUT "#endif\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + print OUT "\n"; + print OUT "#if __NR_${sname} >= 128\n"; + print OUT "\t.align\t2\n"; + print OUT "1:\t.long\t__NR_${sname}\n"; + print OUT "#endif\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/sparc/Makefile.inc b/klibc/klibc/arch/sparc/Makefile.inc index 0186810aca..6ea66114fa 100644 --- a/klibc/klibc/arch/sparc/Makefile.inc +++ b/klibc/klibc/arch/sparc/Makefile.inc @@ -14,7 +14,9 @@ ARCHOBJS = \ arch/$(ARCH)/urem.o \ arch/$(ARCH)/smul.o \ arch/$(ARCH)/umul.o \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o \ + arch/$(ARCH)/sysfork.o arch/$(ARCH)/sdiv.S: arch/$(ARCH)/divrem.m4 @echo 'building $@ from $^' diff --git a/klibc/klibc/arch/sparc/include/klibc/archsetjmp.h b/klibc/klibc/arch/sparc/include/klibc/archsetjmp.h deleted file mode 100644 index 92c1c74c9d..0000000000 --- a/klibc/klibc/arch/sparc/include/klibc/archsetjmp.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/sparc/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __sp; - unsigned long __fp; - unsigned long __pc; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/sparc/include/klibc/archsignal.h b/klibc/klibc/arch/sparc/include/klibc/archsignal.h deleted file mode 100644 index 6af3709033..0000000000 --- a/klibc/klibc/arch/sparc/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/sparc/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/sparc/include/klibc/archsys.h b/klibc/klibc/arch/sparc/include/klibc/archsys.h deleted file mode 100644 index fe6e68df8a..0000000000 --- a/klibc/klibc/arch/sparc/include/klibc/archsys.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * arch/sparc/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* fork and vfork return the "other process" pid in %o0 and an - "is child" flag in %o1... */ - -#define _syscall0_forkish(type,name) \ -type name(void) \ -{ \ -register long __g1 __asm__ ("g1") = __NR_##name; \ -register unsigned long __o0 __asm__ ("o0"); \ -register unsigned long __o1 __asm__ ("o1"); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__o0), "=r" (__o1)\ - : "r" (__g1) \ - : "cc"); \ -if ((unsigned long)__o0 < (unsigned long)-255) \ - return (type)(__o0 & (__o1-1)); \ -errno = (int)-__o0; \ -return -1; \ -} - -/* SPARC seems to lack _syscall6() in its headers */ - -#ifndef _syscall6 - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ -long __res; \ -register long __g1 __asm__ ("g1") = __NR_##name; \ -register long __o0 __asm__ ("o0") = (long)(arg1); \ -register long __o1 __asm__ ("o1") = (long)(arg2); \ -register long __o2 __asm__ ("o2") = (long)(arg3); \ -register long __o3 __asm__ ("o3") = (long)(arg4); \ -register long __o4 __asm__ ("o4") = (long)(arg5); \ -register long __o5 __asm__ ("o5") = (long)(arg6); \ -__asm__ __volatile__ ("t 0x10\n\t" \ - "bcc 1f\n\t" \ - "mov %%o0, %0\n\t" \ - "sub %%g0, %%o0, %0\n\t" \ - "1:\n\t" \ - : "=r" (__res), "=&r" (__o0) \ - : "1" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), "r" (__o5), "r" (__g1) \ - : "cc"); \ -if (__res < -255 || __res>=0) \ -return (type) __res; \ -errno = -__res; \ -return (type)-1; \ -} - -#endif /* _syscall6 missing */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/sparc/include/machine/asm.h b/klibc/klibc/arch/sparc/include/machine/asm.h deleted file mode 100644 index b622bd8cf1..0000000000 --- a/klibc/klibc/arch/sparc/include/machine/asm.h +++ /dev/null @@ -1,192 +0,0 @@ -/* $NetBSD: asm.h,v 1.14 2002/07/20 08:37:30 mrg Exp $ */ - -/* - * Copyright (c) 1994 Allen Briggs - * All rights reserved. - * - * Gleaned from locore.s and sun3 asm.h which had the following copyrights: - * locore.s: - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1990 The Regents of the University of California. - * sun3/include/asm.h: - * Copyright (c) 1993 Adam Glass - * Copyright (c) 1990 The Regents of the University of California. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _ASM_H_ -#define _ASM_H_ - -/* Pull in CCFSZ, CC64FSZ, and BIAS from frame.h */ -#ifndef _LOCORE -#define _LOCORE -#endif -#include - -#ifdef __ELF__ -#define _C_LABEL(name) name -#else -#ifdef __STDC__ -#define _C_LABEL(name) _ ## name -#else -#define _C_LABEL(name) _/**/name -#endif -#endif -#define _ASM_LABEL(name) name - -#ifdef PIC -/* - * PIC_PROLOGUE() is akin to the compiler generated function prologue for - * PIC code. It leaves the address of the Global Offset Table in DEST, - * clobbering register TMP in the process. - * - * We can use two code sequences. We can read the %pc or use the call - * instruction that saves the pc in %o7. Call requires the branch unit and - * IEU1, and clobbers %o7 which needs to be restored. This instruction - * sequence takes about 4 cycles due to instruction interdependence. Reading - * the pc takes 4 cycles to dispatch and is always dispatched alone. That - * sequence takes 7 cycles. - */ -#ifdef __arch64__ -#define PIC_PROLOGUE(dest,tmp) \ - mov %o7, tmp; \ - sethi %hi(_GLOBAL_OFFSET_TABLE_-4),dest; \ - call 0f; \ - or dest,%lo(_GLOBAL_OFFSET_TABLE_+4),dest; \ -0: \ - add dest,%o7,dest; \ - mov tmp, %o7 -#else -#define PIC_PROLOGUE(dest,tmp) \ - mov %o7,tmp; 3: call 4f; nop; 4: \ - sethi %hi(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ - or dest,%lo(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ - add dest,%o7,dest; mov tmp,%o7 -#endif - -/* - * PICCY_SET() does the equivalent of a `set var, %dest' instruction in - * a PIC-like way, but without involving the Global Offset Table. This - * only works for VARs defined in the same file *and* in the text segment. - */ -#ifdef __arch64__ -#define PICCY_SET(var,dest,tmp) \ - 3: rd %pc, tmp; add tmp,(var-3b),dest -#else -#define PICCY_SET(var,dest,tmp) \ - mov %o7,tmp; 3: call 4f; nop; 4: \ - add %o7,(var-3b),dest; mov tmp,%o7 -#endif -#else -#define PIC_PROLOGUE(dest,tmp) -#define PICCY_OFFSET(var,dest,tmp) -#endif - -#define FTYPE(x) .type x,@function -#define OTYPE(x) .type x,@object - -#define _ENTRY(name) \ - .align 4; .globl name; .proc 1; FTYPE(name); name: - -#ifdef GPROF -/* see _MCOUNT_ENTRY in profile.h */ -#ifdef __ELF__ -#ifdef __arch64__ -#define _PROF_PROLOGUE \ - .data; .align 8; 1: .uaword 0; .uaword 0; \ - .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call _mcount; \ - or %o0,%lo(1b),%o0; restore -#else -#define _PROF_PROLOGUE \ - .data; .align 4; 1: .long 0; \ - .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call _mcount; \ - or %o0,%lo(1b),%o0; restore -#endif -#else -#ifdef __arch64__ -#define _PROF_PROLOGUE \ - .data; .align 8; 1: .uaword 0; .uaword 0; \ - .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call mcount; \ - or %o0,%lo(1b),%o0; restore -#else -#define _PROF_PROLOGUE \ - .data; .align 4; 1: .long 0; \ - .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \ - or %o0,%lo(1b),%o0; restore -#endif -#endif -#else -#define _PROF_PROLOGUE -#endif - -#define ENTRY(name) _ENTRY(_C_LABEL(name)); _PROF_PROLOGUE -#define ENTRY_NOPROFILE(name) _ENTRY(_C_LABEL(name)) -#define ASENTRY(name) _ENTRY(_ASM_LABEL(name)); _PROF_PROLOGUE -#define FUNC(name) ASENTRY(name) -#define RODATA(name) .align 4; .text; .globl _C_LABEL(name); \ - OTYPE(_C_LABEL(name)); _C_LABEL(name): - - -#define ASMSTR .asciz - -#define RCSID(name) .asciz name - -#ifdef __ELF__ -#define WEAK_ALIAS(alias,sym) \ - .weak alias; \ - alias = sym -#endif - -/* - * WARN_REFERENCES: create a warning if the specified symbol is referenced. - */ -#ifdef __ELF__ -#ifdef __STDC__ -#define WARN_REFERENCES(_sym,_msg) \ - .section .gnu.warning. ## _sym ; .ascii _msg ; .text -#else -#define WARN_REFERENCES(_sym,_msg) \ - .section .gnu.warning./**/_sym ; .ascii _msg ; .text -#endif /* __STDC__ */ -#else -#ifdef __STDC__ -#define __STRING(x) #x -#define WARN_REFERENCES(sym,msg) \ - .stabs msg ## ,30,0,0,0 ; \ - .stabs __STRING(_ ## sym) ## ,1,0,0,0 -#else -#define __STRING(x) "x" -#define WARN_REFERENCES(sym,msg) \ - .stabs msg,30,0,0,0 ; \ - .stabs __STRING(_/**/sym),1,0,0,0 -#endif /* __STDC__ */ -#endif /* __ELF__ */ - -#endif /* _ASM_H_ */ diff --git a/klibc/klibc/arch/sparc/include/machine/frame.h b/klibc/klibc/arch/sparc/include/machine/frame.h deleted file mode 100644 index b09175c7f4..0000000000 --- a/klibc/klibc/arch/sparc/include/machine/frame.h +++ /dev/null @@ -1,138 +0,0 @@ -/* $NetBSD: frame.h,v 1.4 2001/12/04 00:05:05 darrenr Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)frame.h 8.1 (Berkeley) 6/11/93 - */ - -#if defined(_KERNEL_OPT) -#include "opt_sparc_arch.h" -#endif - -/* - * Sparc stack frame format. - * - * Note that the contents of each stack frame may be held only in - * machine register windows. In order to get an accurate picture - * of the frame, you must first force the kernel to write any such - * windows to the stack. - */ -#ifndef _LOCORE -#ifndef SUN4U -struct frame { - int32_t fr_local[8]; /* space to save locals (%l0..%l7) */ - int32_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ - struct frame *fr_fp; /* space to save frame pointer (%i6) */ - int32_t fr_pc; /* space to save return pc (%i7) */ - /* - * SunOS reserves another 8 words here; this is pointless - * but we do it for compatibility. - */ - int32_t fr_xxx; /* `structure return pointer' (unused) */ - int32_t fr_argd[6]; /* `arg dump area' (lunacy) */ - int32_t fr_argx[1]; /* arg extension (args 7..n; variable size) */ -}; -#else -struct frame32 { - int32_t fr_local[8]; /* space to save locals (%l0..%l7) */ - int32_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ - u_int32_t fr_fp; /* space to save frame pointer (%i6) */ - u_int32_t fr_pc; /* space to save return pc (%i7) */ - /* - * SunOS reserves another 8 words here; this is pointless - * but we do it for compatibility. - */ - int32_t fr_xxx; /* `structure return pointer' (unused) */ - int32_t fr_argd[6]; /* `arg dump area' (lunacy) */ - int32_t fr_argx[1]; /* arg extension (args 7..n; variable size) */ -}; -#endif -#endif - -/* - * CCFSZ (C Compiler Frame SiZe) is the size of a stack frame required if - * a function is to call C code. It should be just 64, but Sun defined - * their frame with space to hold arguments 0 through 5 (plus some junk), - * and varargs routines (such as kprintf) demand this, and gcc uses this - * area at times anyway. - */ -#define CCFSZ 96 - -/* - * Sparc v9 stack frame format. - * - * Note that the contents of each stack frame may be held only in - * machine register windows. In order to get an accurate picture - * of the frame, you must first force the kernel to write any such - * windows to the stack. - * - * V9 frames have an odd bias, so you can tall a v9 frame from - * a v8 frame by testing the stack pointer's lsb. - */ -#if !defined(_LOCORE) && !defined(_LIBC) -struct frame64 { - int64_t fr_local[8]; /* space to save locals (%l0..%l7) */ - int64_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ - u_int64_t fr_fp; /* space to save frame pointer (%i6) */ - u_int64_t fr_pc; /* space to save return pc (%i7) */ - /* - * SVR4 reserves a bunch of extra stuff. - */ - int64_t fr_argd[6]; /* `register save area' (lunacy) */ - int64_t fr_argx[0]; /* arg extension (args 7..n; variable size) */ -}; - -#define v9next_frame(f) ((struct frame64*)(f->fr_fp+BIAS)) -#endif - -/* - * CC64FSZ (C Compiler 64-bit Frame SiZe) is the size of a stack frame used - * by the compiler in 64-bit mode. It is (16)*8; space for 8 ins, 8 outs. - */ -#define CC64FSZ 176 - -/* - * v9 stacks all have a bias of 2047 added to the %sp and %fp, so you can easily - * detect it by testing the register for an odd value. Why 2K-1 I don't know. - */ -#define BIAS (2048-1) - diff --git a/klibc/klibc/arch/sparc/include/machine/trap.h b/klibc/klibc/arch/sparc/include/machine/trap.h deleted file mode 100644 index 42c3ef6ae2..0000000000 --- a/klibc/klibc/arch/sparc/include/machine/trap.h +++ /dev/null @@ -1,141 +0,0 @@ -/* $NetBSD: trap.h,v 1.11 1999/01/20 00:15:08 pk Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)trap.h 8.1 (Berkeley) 6/11/93 - */ -/* - * Sun4m support by Aaron Brown, Harvard University. - * Changes Copyright (c) 1995 The President and Fellows of Harvard College. - * All rights reserved. - */ - -#ifndef _MACHINE_TRAP_H -#define _MACHINE_TRAP_H - -/* trap vec (pri) description */ -#define T_RESET 0x00 /* (1) not actually vectored; jumps to 0 */ -#define T_TEXTFAULT 0x01 /* (2) address fault during instr fetch */ -#define T_ILLINST 0x02 /* (3) illegal instruction */ -#define T_PRIVINST 0x03 /* (4) privileged instruction */ -#define T_FPDISABLED 0x04 /* (5) fp instr while fp disabled */ -#define T_WINOF 0x05 /* (6) register window overflow */ -#define T_WINUF 0x06 /* (7) register window underflow */ -#define T_ALIGN 0x07 /* (8) address not properly aligned */ -#define T_FPE 0x08 /* (9) floating point exception */ -#define T_DATAFAULT 0x09 /* (10) address fault during data fetch */ -#define T_TAGOF 0x0a /* (11) tag overflow */ -/* 0x0b unused */ -/* 0x0c unused */ -/* 0x0d unused */ -/* 0x0e unused */ -/* 0x0f unused */ -/* 0x10 unused */ -#define T_L1INT 0x11 /* (27) level 1 interrupt */ -#define T_L2INT 0x12 /* (26) level 2 interrupt */ -#define T_L3INT 0x13 /* (25) level 3 interrupt */ -#define T_L4INT 0x14 /* (24) level 4 interrupt */ -#define T_L5INT 0x15 /* (23) level 5 interrupt */ -#define T_L6INT 0x16 /* (22) level 6 interrupt */ -#define T_L7INT 0x17 /* (21) level 7 interrupt */ -#define T_L8INT 0x18 /* (20) level 8 interrupt */ -#define T_L9INT 0x19 /* (19) level 9 interrupt */ -#define T_L10INT 0x1a /* (18) level 10 interrupt */ -#define T_L11INT 0x1b /* (17) level 11 interrupt */ -#define T_L12INT 0x1c /* (16) level 12 interrupt */ -#define T_L13INT 0x1d /* (15) level 13 interrupt */ -#define T_L14INT 0x1e /* (14) level 14 interrupt */ -#define T_L15INT 0x1f /* (13) level 15 interrupt */ -/* 0x20 unused */ -/* through 0x23 unused */ -#define T_CPDISABLED 0x24 /* (5) coprocessor instr while disabled */ -#define T_UNIMPLFLUSH 0x25 /* Unimplemented FLUSH */ -/* through 0x27 unused */ -#define T_CPEXCEPTION 0x28 /* (9) coprocessor exception */ -/* 0x29 unused */ -#define T_IDIV0 0x2a /* divide by zero (from hw [su]div instr) */ -#define T_STOREBUFFAULT 0x2b /* SuperSPARC: Store buffer copy-back fault */ -/* 0x2c unused */ -/* through 0x7f unused */ - -/* beginning of `user' vectors (from trap instructions) - all priority 12 */ -#define T_SUN_SYSCALL 0x80 /* system call */ -#define T_BREAKPOINT 0x81 /* breakpoint `instruction' */ -#define T_DIV0 0x82 /* division routine was handed 0 */ -#define T_FLUSHWIN 0x83 /* flush windows */ -#define T_CLEANWIN 0x84 /* provide clean windows */ -#define T_RANGECHECK 0x85 /* ? */ -#define T_FIXALIGN 0x86 /* fix up unaligned accesses */ -#define T_INTOF 0x87 /* integer overflow ? */ -#define T_SVR4_SYSCALL 0x88 /* SVR4 system call */ -#define T_BSD_SYSCALL 0x89 /* BSD system call */ -#define T_KGDB_EXEC 0x8a /* for kernel gdb */ - -/* 0x8b..0xff are currently unallocated, except the following */ -#define T_SVR4_GETCC 0xa0 -#define T_SVR4_SETCC 0xa1 -#define T_SVR4_GETPSR 0xa2 -#define T_SVR4_SETPSR 0xa3 -#define T_SVR4_GETHRTIME 0xa4 -#define T_SVR4_GETHRVTIME 0xa5 -#define T_SVR4_GETHRESTIME 0xa7 - - -#ifdef _KERNEL /* pseudo traps for locore.s */ -#define T_RWRET -1 /* need first user window for trap return */ -#define T_AST -2 /* no-op, just needed reschedule or profile */ -#endif - -/* flags to system call (flags in %g1 along with syscall number) */ -#define SYSCALL_G2RFLAG 0x400 /* on success, return to %g2 rather than npc */ -#define SYSCALL_G7RFLAG 0x800 /* use %g7 as above (deprecated) */ - -/* - * `software trap' macros to keep people happy (sparc v8 manual says not - * to set the upper bits). - */ -#define ST_BREAKPOINT (T_BREAKPOINT & 0x7f) -#define ST_DIV0 (T_DIV0 & 0x7f) -#define ST_FLUSHWIN (T_FLUSHWIN & 0x7f) -#define ST_SYSCALL (T_SUN_SYSCALL & 0x7f) - -#endif /* _MACHINE_TRAP_H_ */ diff --git a/klibc/klibc/arch/sparc/syscall.S b/klibc/klibc/arch/sparc/syscall.S new file mode 100644 index 0000000000..c0273f77ca --- /dev/null +++ b/klibc/klibc/arch/sparc/syscall.S @@ -0,0 +1,19 @@ +/* + * arch/sparc/syscall.S + * + * Common system-call stub; %g1 already set to syscall number + */ + + .globl __syscall_common + .type __syscall_common,#function + .align 4 +__syscall_common: + t 0x10 + bcc 1f + sethi %hi(errno), %g4 + or %g4, %lo(errno), %g4 + st %o0,[%g4] + mov -1, %o0 +1: + retl + nop diff --git a/klibc/klibc/arch/sparc/sysfork.S b/klibc/klibc/arch/sparc/sysfork.S new file mode 100644 index 0000000000..a66c76e9db --- /dev/null +++ b/klibc/klibc/arch/sparc/sysfork.S @@ -0,0 +1,25 @@ +/* + * arch/sparc/sysfork.S + * + * The fork and vfork system calls are special on sparc[64]: + * they return the "other process" pid in %o0 and the + * "is child" flag in %o1 + * + * Common system-call stub; %g1 already set to syscall number + */ + + .globl __syscall_forkish + .type __syscall_forkish,#function + .align 4 +__syscall_forkish: + t 0x10 + sub %o1, 1, %o1 + bcc,a 1f + and %o0, %o1, %o0 + sethi %hi(errno), %g4 + or %g4, %lo(errno), %g4 + st %o0,[%g4] + mov -1, %o0 +1: + retl + nop diff --git a/klibc/klibc/arch/sparc/sysstub.ph b/klibc/klibc/arch/sparc/sysstub.ph new file mode 100644 index 0000000000..baad9e3d82 --- /dev/null +++ b/klibc/klibc/arch/sparc/sysstub.ph @@ -0,0 +1,25 @@ +# -*- perl -*- +# +# arch/sparc32/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + $stype = $stype || 'common'; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.type ${fname},\@function\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT "\tb __syscall_${stype}\n"; + print OUT "\t mov\t__NR_${sname}, %g1\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/sparc64/Makefile.inc b/klibc/klibc/arch/sparc64/Makefile.inc index d59f9878e9..06b79537a3 100644 --- a/klibc/klibc/arch/sparc64/Makefile.inc +++ b/klibc/klibc/arch/sparc64/Makefile.inc @@ -8,6 +8,8 @@ # ARCHOBJS = \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o \ + arch/$(ARCH)/sysfork.o archclean: diff --git a/klibc/klibc/arch/sparc64/include/klibc/archsetjmp.h b/klibc/klibc/arch/sparc64/include/klibc/archsetjmp.h deleted file mode 100644 index 022a31e542..0000000000 --- a/klibc/klibc/arch/sparc64/include/klibc/archsetjmp.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/sparc64/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __sp; - unsigned long __fp; - unsigned long __pc; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/sparc64/include/klibc/archsignal.h b/klibc/klibc/arch/sparc64/include/klibc/archsignal.h deleted file mode 100644 index f81bd668bb..0000000000 --- a/klibc/klibc/arch/sparc64/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/sparc64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/sparc64/include/klibc/archsys.h b/klibc/klibc/arch/sparc64/include/klibc/archsys.h deleted file mode 100644 index 651e4f7f09..0000000000 --- a/klibc/klibc/arch/sparc64/include/klibc/archsys.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * arch/sparc64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* The Linux 2.5.31 SPARC64 syscall macros are just plain broken */ - -#undef _syscall0 -#undef _syscall1 -#undef _syscall2 -#undef _syscall3 -#undef _syscall4 -#undef _syscall5 -#undef _syscall6 - -#define _syscall0(type,name) \ -type name (void) \ -{ \ - register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ - register unsigned long __ret __asm__("o0"); \ - __asm__ __volatile__ ("t 0x6d\n\t" \ - "bcs,a %%xcc, 1f\n\t" \ - " st %0,%1\n\t" \ - "1:" \ - "movcs %%xcc,-1,%0\n" \ - : "=&r" (__ret), "+m" (errno) \ - : "r" (__g1) \ - : "cc"); \ - return (type) __ret; \ -} - -#define _syscall1(type,name,type1,arg1) \ -type name (type1 arg1) \ -{ \ - register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ - register unsigned long __ret __asm__("o0"); \ - type1 __o0 = (arg1); \ - __asm__ __volatile__ ("t 0x6d\n\t" \ - "bcs,a %%xcc, 1f\n\t" \ - " st %0,%1\n\t" \ - "1:" \ - "movcs %%xcc,-1,%0\n" \ - : "=&r" (__ret), "+m" (errno) \ - : "0" (__o0), "r" (__g1) \ - : "cc"); \ - return (type) __ret; \ -} - -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type name (type1 arg1,type2 arg2) \ -{ \ - register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ - register unsigned long __ret __asm__("o0"); \ - type1 __o0 = (arg1); \ - register type2 __o1 __asm__ ("o1") = (arg2); \ - __asm__ __volatile__ ("t 0x6d\n\t" \ - "bcs,a %%xcc, 1f\n\t" \ - " st %0,%1\n\t" \ - "1:" \ - "movcs %%xcc,-1,%0\n" \ - : "=&r" (__ret), "+m" (errno) \ - : "0" (__o0), "r" (__o1), "r" (__g1) \ - : "cc"); \ - return (type) __ret; \ -} - -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type name (type1 arg1,type2 arg2,type3 arg3) \ -{ \ - register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ - register unsigned long __ret __asm__("o0"); \ - type1 __o0 = (arg1); \ - register type2 __o1 __asm__ ("o1") = (arg2); \ - register type3 __o2 __asm__ ("o2") = (arg3); \ - __asm__ __volatile__ ("t 0x6d\n\t" \ - "bcs,a %%xcc, 1f\n\t" \ - " st %0,%1\n\t" \ - "1:" \ - "movcs %%xcc,-1,%0\n" \ - : "=&r" (__ret), "+m" (errno) \ - : "0" (__o0), "r" (__o1), "r" (__o2), "r" (__g1) \ - : "cc"); \ - return (type) __ret; \ -} - -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ -{ \ - register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ - register unsigned long __ret __asm__("o0"); \ - type1 __o0 = (arg1); \ - register type2 __o1 __asm__ ("o1") = (arg2); \ - register type3 __o2 __asm__ ("o2") = (arg3); \ - register type4 __o3 __asm__ ("o3") = (arg4); \ - __asm__ __volatile__ ("t 0x6d\n\t" \ - "bcs,a %%xcc, 1f\n\t" \ - " st %0,%1\n\t" \ - "1:" \ - "movcs %%xcc,-1,%0\n" \ - : "=&r" (__ret), "+m" (errno) \ - : "0" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__g1) \ - : "cc"); \ - return (type) __ret; \ -} - -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,\ - type5,arg5) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ - register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ - register unsigned long __ret __asm__("o0"); \ - type1 __o0 = (arg1); \ - register type2 __o1 __asm__ ("o1") = (arg2); \ - register type3 __o2 __asm__ ("o2") = (arg3); \ - register type4 __o3 __asm__ ("o3") = (arg4); \ - register type5 __o4 __asm__ ("o4") = (arg5); \ - __asm__ __volatile__ ("t 0x6d\n\t" \ - "bcs,a %%xcc, 1f\n\t" \ - " st %0,%1\n\t" \ - "1:" \ - "movcs %%xcc,-1,%0\n" \ - : "=&r" (__ret), "+m" (errno) \ - : "0" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), \ - "r" (__g1) \ - : "cc"); \ - return (type) __ret; \ -} - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ - register unsigned long __g1 __asm__ ("g1") = __NR_##name; \ - register unsigned long __ret __asm__("o0"); \ - type1 __o0 = (arg1); \ - register type2 __o1 __asm__ ("o1") = (arg2); \ - register type3 __o2 __asm__ ("o2") = (arg3); \ - register type4 __o3 __asm__ ("o3") = (arg4); \ - register type5 __o4 __asm__ ("o4") = (arg5); \ - register type6 __o5 __asm__ ("o5") = (arg6); \ - __asm__ __volatile__ ("t 0x6d\n\t" \ - "bcs,a %%xcc, 1f\n\t" \ - " st %0,%1\n\t" \ - "1:" \ - "movcs %%xcc,-1,%0\n" \ - : "=&r" (__ret), "+m" (errno) \ - : "0" (__o0), "r" (__o1), "r" (__o2), "r" (__o3), "r" (__o4), \ - "r" (__o5), "r" (__g1) \ - : "cc"); \ - return (type) __ret; \ -} - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/sparc64/syscall.S b/klibc/klibc/arch/sparc64/syscall.S new file mode 100644 index 0000000000..7ab9d95f11 --- /dev/null +++ b/klibc/klibc/arch/sparc64/syscall.S @@ -0,0 +1,18 @@ +/* + * arch/sparc64/syscall.S + * + * Common system-call stub; %g1 already set to syscall number + */ + + .globl __syscall_common + .type __syscall_common,#function + .align 4 +__syscall_common: + t 0x6d + bcc %xcc, 1f + sethi %hi(errno), %g4 + or %g4, %lo(errno), %g4 + st %o0,[%g4] +1: + retl + movcs %xcc, -1, %o0 diff --git a/klibc/klibc/arch/sparc64/sysfork.S b/klibc/klibc/arch/sparc64/sysfork.S new file mode 100644 index 0000000000..739c35ede3 --- /dev/null +++ b/klibc/klibc/arch/sparc64/sysfork.S @@ -0,0 +1,26 @@ +/* + * arch/sparc64/sysfork.S + * + * The fork and vfork system calls are special on sparc[64]: + * they return the "other process" pid in %o0 and the + * "is child" flag in %o1 + * + * Common system-call stub; %g1 already set to syscall number + * + * IS THIS CORRECT FOR SPARC64? + */ + + .globl __syscall_forkish + .type __syscall_forkish,#function + .align 4 +__syscall_forkish: + t 0x6d + sub %o1, 1, %o1 + bcc,a %xcc, 1f + and %o0, %o1, %o0 + sethi %hi(errno), %g4 + or %g4, %lo(errno), %g4 + st %o0,[%g4] +1: + retl + movcs %xcc, -1, %o0 diff --git a/klibc/klibc/arch/sparc64/sysstub.ph b/klibc/klibc/arch/sparc64/sysstub.ph new file mode 100644 index 0000000000..2ef2c6b66e --- /dev/null +++ b/klibc/klibc/arch/sparc64/sysstub.ph @@ -0,0 +1,25 @@ +# -*- perl -*- +# +# arch/sparc64/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + $stype = $stype || 'common'; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.type ${fname},\@function\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT "\tb __syscall_${stype}\n"; + print OUT "\t mov\t__NR_${sname}, %g1\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/x86_64/MCONFIG b/klibc/klibc/arch/x86_64/MCONFIG index ecb14ccb70..f3c87410a6 100644 --- a/klibc/klibc/arch/x86_64/MCONFIG +++ b/klibc/klibc/arch/x86_64/MCONFIG @@ -9,8 +9,14 @@ # Blatantly copied and modified from i386 version by Mats Petersson, AMD. # +# +# NOTE: -fno-asynchronous-unwind-tables produce significantly smaller +# binaries (20% smaller), but makes the code completely useless for +# debugging using gdb. +# ARCHREQFLAGS = -m64 -OPTFLAGS = -Os -fomit-frame-pointer -falign-functions=0 -falign-jumps=0 -falign-loops=0 +OPTFLAGS = -Os -fno-asynchronous-unwind-tables -fomit-frame-pointer \ + -falign-functions=0 -falign-jumps=0 -falign-loops=0 BITSIZE = 64 LDFLAGS = -m elf_x86_64 diff --git a/klibc/klibc/arch/x86_64/Makefile.inc b/klibc/klibc/arch/x86_64/Makefile.inc index c84443f4e1..d6cc1204e4 100644 --- a/klibc/klibc/arch/x86_64/Makefile.inc +++ b/klibc/klibc/arch/x86_64/Makefile.inc @@ -9,7 +9,8 @@ ARCHOBJS = \ arch/$(ARCH)/exits.o \ - arch/$(ARCH)/setjmp.o + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) diff --git a/klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h b/klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h deleted file mode 100644 index 90d0a0d263..0000000000 --- a/klibc/klibc/arch/x86_64/include/klibc/archsetjmp.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * arch/x86_64/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __rbx; - unsigned long __rsp; - unsigned long __rbp; - unsigned long __r12; - unsigned long __r13; - unsigned long __r14; - unsigned long __r15; - unsigned long __rip; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/arch/x86_64/include/klibc/archsignal.h b/klibc/klibc/arch/x86_64/include/klibc/archsignal.h deleted file mode 100644 index 74e82e1dd0..0000000000 --- a/klibc/klibc/arch/x86_64/include/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/x86_64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/klibc/arch/x86_64/include/klibc/archsys.h b/klibc/klibc/arch/x86_64/include/klibc/archsys.h deleted file mode 100644 index 2ec72cd397..0000000000 --- a/klibc/klibc/arch/x86_64/include/klibc/archsys.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * arch/x86_64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* The x86-64 syscall headers are needlessly inefficient */ - -#undef _syscall0 -#undef _syscall1 -#undef _syscall2 -#undef _syscall3 -#undef _syscall4 -#undef _syscall5 -#undef _syscall6 - -#define _syscall0(type,name) \ -type name (void) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall1(type,name,type1,arg1) \ -type name (type1 arg1) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type name (type1 arg1,type2 arg2) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type name (type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ - "d" (arg3) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ -{ \ -long __res; \ -register type4 __r10 asm("%r10") = arg4; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ - "d" (arg3),"r" (__r10) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -register type4 __r10 asm("%r10") = arg4; \ -register type5 __r8 asm("%r8") = arg5; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ - "d" (arg3),"r" (__r10),"r" (__r8) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ -long __res; \ -register type4 __r10 asm("%r10") = arg4; \ -register type5 __r8 asm("%r8") = arg5; \ -register type6 __r9 asm("%r9") = arg6; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ - "d" (arg3),"r" (__r10),"r" (__r8), "r" (__r9) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/klibc/arch/x86_64/include/sys/io.h b/klibc/klibc/arch/x86_64/include/sys/io.h deleted file mode 100644 index 4a0ae44985..0000000000 --- a/klibc/klibc/arch/x86_64/include/sys/io.h +++ /dev/null @@ -1,126 +0,0 @@ -#ident "$Id: io.h,v 1.1 2004/01/25 01:34:29 hpa Exp $" -/* ----------------------------------------------------------------------- * - * - * Copyright 2004 H. Peter Anvin - All Rights Reserved - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall - * be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * ----------------------------------------------------------------------- */ - -/* - * sys/io.h for the i386 architecture - * - * Basic I/O macros - */ - -#ifndef _SYS_IO_H -#define _SYS_IO_H 1 - -/* I/O-related system calls */ - -int iopl(int); -int ioperm(unsigned long, unsigned long, int); - -/* Basic I/O macros */ - -static __inline__ void -outb(unsigned char __v, unsigned short __p) -{ - asm volatile("outb %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ void -outw(unsigned short __v, unsigned short __p) -{ - asm volatile("outw %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ void -outl(unsigned int __v, unsigned short __p) -{ - asm volatile("outl %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ unsigned char -inb(unsigned short __p) -{ - unsigned char __v; - asm volatile("inb %1,%0" : "=a" (__v) : "dN" (__p)); - return v; -} - -static __inline__ unsigned short -inw(unsigned short __p) -{ - unsigned short __v; - asm volatile("inw %1,%0" : "=a" (__v) : "dN" (__p)); - return v; -} - -static __inline__ unsigned int -inl(unsigned short __p) -{ - unsigned int __v; - asm volatile("inl %1,%0" : "=a" (__v) : "dN" (__p)); - return v; -} - -/* String I/O macros */ - -static __inline__ void -outsb (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsb" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -outsw (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsw" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -outsl (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsl" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - - -static __inline__ void -insb (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insb" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -insw (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insw" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -insl (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insl" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -#endif /* _SYS_IO_H */ diff --git a/klibc/klibc/arch/x86_64/syscall.S b/klibc/klibc/arch/x86_64/syscall.S new file mode 100644 index 0000000000..f2c74ae974 --- /dev/null +++ b/klibc/klibc/arch/x86_64/syscall.S @@ -0,0 +1,28 @@ +/* + * arch/x86-64/syscall.S + * + * Common tail-handling code for system calls. + * + * The arguments are in the standard argument registers; the system + * call number in %eax. + */ + .text + .align 4 + .globl __syscall_common + .type __syscall_common,@function +__syscall_common: + movq %rcx,%r10 # The kernel uses %r10 istf %rcx + syscall + + cmpq $-4095,%rax + jb 1f + + # Error return, must set errno + negl %eax + movl %eax,errno(%rip) # errno is type int, so 32 bits + orq $-1,%rax # orq $-1 smaller than movq $-1 + +1: + ret + + .size __syscall_common,.-__syscall_common diff --git a/klibc/klibc/arch/x86_64/sysstub.ph b/klibc/klibc/arch/x86_64/sysstub.ph new file mode 100644 index 0000000000..07af1227ca --- /dev/null +++ b/klibc/klibc/arch/x86_64/sysstub.ph @@ -0,0 +1,23 @@ +# -*- perl -*- +# +# arch/x86_64/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.type ${fname},\@function\n"; + print OUT "\t.globl ${fname}\n"; + print OUT "${fname}:\n"; + print OUT "\tmovl \$__NR_${sname},%eax\n"; # Zero-extends to 64 bits + print OUT "\tjmp __syscall_common\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/asprintf.c b/klibc/klibc/asprintf.c new file mode 100644 index 0000000000..457d34bb15 --- /dev/null +++ b/klibc/klibc/asprintf.c @@ -0,0 +1,30 @@ +/* + * asprintf.c + */ + +#include +#include +#include + +int asprintf(char **bufp, const char *format, ...) +{ + va_list ap, ap1; + int rv; + int bytes; + char *p; + + va_start(ap, format); + va_copy(ap1, ap); + + bytes = vsnprintf(NULL, 0, format, ap1); + va_end(ap1); + + *bufp = p = malloc(bytes+1); + if ( !p ) + return -1; + + rv = vsnprintf(p, bytes, format, ap); + va_end(ap); + + return rv; +} diff --git a/klibc/klibc/ctypes.c b/klibc/klibc/ctypes.c index c7adc9882c..acfa05ab65 100644 --- a/klibc/klibc/ctypes.c +++ b/klibc/klibc/ctypes.c @@ -10,41 +10,41 @@ const unsigned char __ctypes[257] = { 0, /* EOF */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - __ctype_space, /* BS */ - __ctype_space, /* TAB */ - __ctype_space, /* LF */ - __ctype_space, /* VT */ - __ctype_space, /* FF */ - __ctype_space, /* CR */ - 0, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl|__ctype_space, /* BS */ + __ctype_cntrl|__ctype_space, /* TAB */ + __ctype_cntrl|__ctype_space, /* LF */ + __ctype_cntrl|__ctype_space, /* VT */ + __ctype_cntrl|__ctype_space, /* FF */ + __ctype_cntrl|__ctype_space, /* CR */ + __ctype_cntrl, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ - __ctype_space|__ctype_print, /* space */ + __ctype_print|__ctype_space, /* space */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ @@ -61,16 +61,16 @@ const unsigned char __ctypes[257] = { __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ - __ctype_digit|__ctype_xdigit|__ctype_print, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ + __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ @@ -79,33 +79,33 @@ const unsigned char __ctypes[257] = { __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ - __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ - __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ - __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ - __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ - __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ - __ctype_upper|__ctype_print|__ctype_xdigit, /* A-F */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ + __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ + __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ + __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ + __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ + __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ + __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ - __ctype_upper|__ctype_print, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ + __ctype_print|__ctype_upper, /* G-Z */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ @@ -113,74 +113,74 @@ const unsigned char __ctypes[257] = { __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ - __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ - __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ - __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ - __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ - __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ - __ctype_lower|__ctype_print|__ctype_xdigit, /* a-f */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ + __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ + __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ + __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ + __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ + __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ + __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ - __ctype_lower|__ctype_print, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ + __ctype_print|__ctype_lower, /* g-z */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ - 0, /* control character */ + __ctype_cntrl, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ - 0, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ + __ctype_cntrl, /* control character */ - __ctype_space|__ctype_print, /* NBSP */ + __ctype_print|__ctype_space, /* NBSP */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ @@ -214,71 +214,71 @@ const unsigned char __ctypes[257] = { __ctype_print|__ctype_punct, /* punctuation */ __ctype_print|__ctype_punct, /* punctuation */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_upper|__ctype_print, /* upper accented */ - __ctype_lower|__ctype_print, /* lower accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_upper, /* upper accented */ + __ctype_print|__ctype_lower, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ - __ctype_lower|__ctype_print, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_punct, /* punctuation */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ + __ctype_print|__ctype_lower, /* lower accented */ }; diff --git a/klibc/klibc/daemon.c b/klibc/klibc/daemon.c new file mode 100644 index 0000000000..75d7146205 --- /dev/null +++ b/klibc/klibc/daemon.c @@ -0,0 +1,38 @@ +/* + * daemon.c - "daemonize" a process + */ + +#include +#include +#include + +int daemon(int nochdir, int noclose) +{ + int nullfd; + pid_t f; + + if ( !nochdir ) { + if ( chdir("/") ) + return -1; + } + + if ( !noclose ) { + if ( (nullfd = open("/dev/null", O_RDWR)) < 0 || + dup2(nullfd, 0) < 0 || + dup2(nullfd, 1) < 0 || + dup2(nullfd, 2) < 0 ) + return -1; + close(nullfd); + } + + f = fork(); + if ( f < 0 ) + return -1; + else if ( f > 0 ) + _exit(0); + + + return setsid(); +} + + diff --git a/klibc/klibc/fdatasync.c b/klibc/klibc/fdatasync.c deleted file mode 100644 index 53079b09d6..0000000000 --- a/klibc/klibc/fdatasync.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * fdatasync.c - * - * Some systems don't have this (alpha?) ... this is really a bug, - * but mimic using fsync() - */ - -#include -#include - -#ifndef __NR_fdatasync -#define __NR_fdatasync __NR_fsync -#endif - -_syscall1(int,fdatasync,int,fd); diff --git a/klibc/klibc/fork.c b/klibc/klibc/fork.c index d7e4db89a1..daf313eaf2 100644 --- a/klibc/klibc/fork.c +++ b/klibc/klibc/fork.c @@ -9,21 +9,13 @@ #include #include -#ifdef __NR_fork +#ifndef __NR_fork -#ifdef _syscall0_forkish -_syscall0_forkish(pid_t,fork); -#else -_syscall0(pid_t,fork); -#endif - -#else /* __NR_fork */ - -static inline _syscall2(pid_t,clone,unsigned long,flags,void *,newsp); +extern pid_t __clone(unsigned long flags, void * newsp); pid_t fork(void) { - return clone(SIGCHLD, 0); + return __clone(SIGCHLD, 0); } #endif /* __NR_fork */ diff --git a/klibc/klibc/fstatfs.c b/klibc/klibc/fstatfs.c new file mode 100644 index 0000000000..09e4674947 --- /dev/null +++ b/klibc/klibc/fstatfs.c @@ -0,0 +1,19 @@ +/* + * fstatfs.c + * + * On architectures which do fstatfs64, wrap the system call + */ + +#include +#include + +#ifdef __NR_fstatfs64 + +extern int __fstatfs64(int, size_t, struct statfs *); + +int fstatfs(int fd, struct statfs *buf) +{ + return __fstatfs64(fd, sizeof *buf, buf); +} + +#endif diff --git a/klibc/klibc/getcwd.c b/klibc/klibc/getcwd.c index 350ec69a63..613ca0529c 100644 --- a/klibc/klibc/getcwd.c +++ b/klibc/klibc/getcwd.c @@ -1,12 +1,13 @@ /* * getcwd.c + * + * The system call behaves differently than the library function. */ #include #include -#define __NR___getcwd __NR_getcwd -static inline _syscall2(int,__getcwd,char *,buf,size_t,size); +extern int __getcwd(char * buf, size_t size); char *getcwd(char *buf, size_t size) { diff --git a/klibc/klibc/getpagesize.c b/klibc/klibc/getpagesize.c deleted file mode 100644 index 2d975b1586..0000000000 --- a/klibc/klibc/getpagesize.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * getpagesize.c - */ - -#include -#include - -/* Presumably there is a better way to do this... */ -#ifdef __ia64__ -# define __NR_getpagesize 1171 -#endif - -#ifdef __NR_getpagesize - -_syscall0(int,getpagesize); - -#else - -int getpagesize(void) -{ - return PAGE_SIZE; -} - -#endif - - diff --git a/klibc/klibc/getpriority.c b/klibc/klibc/getpriority.c index d6db2cc6b9..4ea630487d 100644 --- a/klibc/klibc/getpriority.c +++ b/klibc/klibc/getpriority.c @@ -10,16 +10,14 @@ #include #include -#define __NR__getpriority __NR_getpriority +#if !defined(__alpha__) && !defined(__ia64__) -static inline _syscall2(int,_getpriority,int,which,int,who); +extern int __getpriority(int, int); int getpriority(int which, int who) { -#if defined(__alpha__) || defined(__ia64__) - return _getpriority(which, who); -#else - int rv = _getpriority(which, who); + int rv = __getpriority(which, who); return ( rv < 0 ) ? rv : 20-rv; -#endif } + +#endif diff --git a/klibc/klibc/include/alloca.h b/klibc/klibc/include/alloca.h deleted file mode 100644 index 41a4d94d44..0000000000 --- a/klibc/klibc/include/alloca.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * alloca.h - * - * Just call the builtin alloca() function - */ - -#ifndef _ALLOCA_H -#define _ALLOCA_H - -#define alloca(size) __builtin_alloca(size) - -#endif /* _ALLOCA_H */ - diff --git a/klibc/klibc/include/arpa/inet.h b/klibc/klibc/include/arpa/inet.h deleted file mode 100644 index 043b148e17..0000000000 --- a/klibc/klibc/include/arpa/inet.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * arpa/inet.h - */ - -#ifndef _ARPA_INET_H -#define _ARPA_INET_H - -#include -#include -#include -#include -#include - -__extern uint32_t inet_addr(const char *); -__extern int inet_aton(const char *, struct in_addr *); -__extern char *inet_ntoa(struct in_addr); -__extern int inet_pton(int, const char *, void *); -__extern const char *inet_ntop(int, const void *, char *, size_t); -__extern unsigned int inet_nsap_addr(const char *, unsigned char *, int); -__extern char *inet_nsap_ntoa(int, const unsigned char *, char *); - -#endif /* _ARPA_INET_H */ - - diff --git a/klibc/klibc/include/assert.h b/klibc/klibc/include/assert.h deleted file mode 100644 index 58cc37c487..0000000000 --- a/klibc/klibc/include/assert.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * assert.h - */ - -#ifndef _ASSERT_H -#define _ASSERT_H - -#ifdef NDEBUG - -#define assert(x) ((void)(x)) - -#else - -extern void __assert_fail(const char *, const char *, - unsigned int); - -#define assert(x) ((x) ? (void)0 : __assert_fail(#x, __FILE__, __LINE__)) - -#endif - -#endif /* _ASSERT_H */ - diff --git a/klibc/klibc/include/bits32/bitsize/limits.h b/klibc/klibc/include/bits32/bitsize/limits.h deleted file mode 100644 index f90e524b2b..0000000000 --- a/klibc/klibc/include/bits32/bitsize/limits.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * bits32/limits.h - */ - -#ifndef _BITSIZE_LIMITS_H -#define _BITSIZE_LIMITS_H - -#define LONG_BIT 32 - -#define LONG_MIN (-2147483647L-1) -#define LONG_MAX 2147483647L -#define ULONG_MAX 4294967295UL - -#endif /* _BITSIZE_LIMITS_H */ diff --git a/klibc/klibc/include/bits32/bitsize/stddef.h b/klibc/klibc/include/bits32/bitsize/stddef.h deleted file mode 100644 index bf6e695ed3..0000000000 --- a/klibc/klibc/include/bits32/bitsize/stddef.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * bits32/stddef.h - */ - -#ifndef _BITSIZE_STDDEF_H -#define _BITSIZE_STDDEF_H - -#define _SIZE_T -#if (defined(__s390__) || defined(__hppa__) || defined(__cris__)) -typedef unsigned long size_t; -#else -typedef unsigned int size_t; -#endif - -#define _PTRDIFF_T -typedef signed int ptrdiff_t; - -#endif /* _BITSIZE_STDDEF_H */ diff --git a/klibc/klibc/include/bits32/bitsize/stdint.h b/klibc/klibc/include/bits32/bitsize/stdint.h deleted file mode 100644 index 40b464961c..0000000000 --- a/klibc/klibc/include/bits32/bitsize/stdint.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * bits32/stdint.h - */ - -#ifndef _BITSIZE_STDINT_H -#define _BITSIZE_STDINT_H - -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef long long int int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; - -typedef int int_fast16_t; -typedef int int_fast32_t; - -typedef unsigned int uint_fast16_t; -typedef unsigned int uint_fast32_t; - -typedef int intptr_t; -typedef unsigned int uintptr_t; - -#define __INT64_C(c) c ## LL -#define __UINT64_C(c) c ## ULL - -#define __PRI64_RANK "ll" -#define __PRIFAST_RANK "" -#define __PRIPTR_RANK "" - -#endif /* _BITSIZE_STDINT_H */ diff --git a/klibc/klibc/include/bits32/bitsize/stdintconst.h b/klibc/klibc/include/bits32/bitsize/stdintconst.h deleted file mode 100644 index 8157dd06e0..0000000000 --- a/klibc/klibc/include/bits32/bitsize/stdintconst.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * bits32/stdintconst.h - */ - -#ifndef _BITSIZE_STDINTCONST_H -#define _BITSIZE_STDINTCONST_H - -#define INT_FAST16_C(c) INT32_C(c) -#define INT_FAST32_C(c) INT32_C(c) - -#define UINT_FAST16_C(c) UINT32_C(c) -#define UINT_FAST32_C(c) UINT32_C(c) - -#define INTPTR_C(c) INT32_C(c) -#define UINTPTR_C(c) UINT32_C(c) -#define PTRDIFF_C(c) INT32_C(c) - -#endif /* _BITSIZE_STDINTCONST_H */ diff --git a/klibc/klibc/include/bits32/bitsize/stdintlimits.h b/klibc/klibc/include/bits32/bitsize/stdintlimits.h deleted file mode 100644 index b44fe01186..0000000000 --- a/klibc/klibc/include/bits32/bitsize/stdintlimits.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * bits32/stdintlimits.h - */ - -#ifndef _BITSIZE_STDINTLIMITS_H -#define _BITSIZE_STDINTLIMITS_H - -#define INT_FAST16_MIN INT32_MIN -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST16_MAX INT32_MAX -#define INT_FAST32_MAX INT32_MAX -#define UINT_FAST16_MAX UINT32_MAX -#define UINT_FAST32_MAX UINT32_MAX - -#define INTPTR_MIN INT32_MIN -#define INTPTR_MAX INT32_MAX -#define UINTPTR_MAX UINT32_MAX - -#define PTRDIFF_MIN INT32_MIN -#define PTRDIFF_MAX INT32_MAX - -#endif /* _BITSIZE_STDINTLIMITS_H */ diff --git a/klibc/klibc/include/bits64/bitsize/limits.h b/klibc/klibc/include/bits64/bitsize/limits.h deleted file mode 100644 index 7b20da085b..0000000000 --- a/klibc/klibc/include/bits64/bitsize/limits.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * bits64/limits.h - */ - -#ifndef _BITSIZE_LIMITS_H -#define _BITSIZE_LIMITS_H - -#define LONG_BIT 64 - -#define LONG_MIN (-9223372036854775807L-1) -#define LONG_MAX 9223372036854775807L -#define ULONG_MAX 18446744073709551615UL - -#endif /* _BITSIZE_LIMITS_H */ diff --git a/klibc/klibc/include/bits64/bitsize/stddef.h b/klibc/klibc/include/bits64/bitsize/stddef.h deleted file mode 100644 index 3e72621862..0000000000 --- a/klibc/klibc/include/bits64/bitsize/stddef.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * bits64/stddef.h - */ - -#ifndef _BITSIZE_STDDEF_H -#define _BITSIZE_STDDEF_H - -#define _SIZE_T -typedef unsigned long size_t; -#define _PTRDIFF_T -typedef signed long ptrdiff_t; - -#endif /* _BITSIZE_STDDEF_H */ diff --git a/klibc/klibc/include/bits64/bitsize/stdint.h b/klibc/klibc/include/bits64/bitsize/stdint.h deleted file mode 100644 index f569f526b6..0000000000 --- a/klibc/klibc/include/bits64/bitsize/stdint.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * bits64/stdint.h - */ - -#ifndef _BITSIZE_STDINT_H -#define _BITSIZE_STDINT_H - -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef long long int int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long int uint64_t; - -typedef long int int_fast16_t; -typedef long int int_fast32_t; - -typedef unsigned long int uint_fast16_t; -typedef unsigned long int uint_fast32_t; - -typedef long int intptr_t; -typedef unsigned long int uintptr_t; - -#define __INT64_C(c) c ## L -#define __UINT64_C(c) c ## UL - -#define __PRI64_RANK "l" -#define __PRIFAST_RANK "l" -#define __PRIPTR_RANK "l" - -#endif /* _BITSIZE_STDINT_H */ - - diff --git a/klibc/klibc/include/bits64/bitsize/stdintconst.h b/klibc/klibc/include/bits64/bitsize/stdintconst.h deleted file mode 100644 index 65f2db0501..0000000000 --- a/klibc/klibc/include/bits64/bitsize/stdintconst.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * bits64/stdintconst.h - */ - -#ifndef _BITSIZE_STDINTCONST_H -#define _BITSIZE_STDINTCONST_H - -#define INT_FAST16_C(c) INT64_C(c) -#define INT_FAST32_C(c) INT64_C(c) - -#define UINT_FAST16_C(c) UINT64_C(c) -#define UINT_FAST32_C(c) UINT64_C(c) - -#define INTPTR_C(c) INT64_C(c) -#define UINTPTR_C(c) UINT64_C(c) -#define PTRDIFF_C(c) INT64_C(c) - -#endif /* _BITSIZE_STDINTCONST_H */ diff --git a/klibc/klibc/include/bits64/bitsize/stdintlimits.h b/klibc/klibc/include/bits64/bitsize/stdintlimits.h deleted file mode 100644 index d110d17d2d..0000000000 --- a/klibc/klibc/include/bits64/bitsize/stdintlimits.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * bits64/stdintlimits.h - */ - -#ifndef _BITSIZE_STDINTLIMITS_H -#define _BITSIZE_STDINTLIMITS_H - -#define INT_FAST16_MIN INT64_MIN -#define INT_FAST32_MIN INT64_MIN -#define INT_FAST16_MAX INT64_MAX -#define INT_FAST32_MAX INT64_MAX -#define UINT_FAST16_MAX UINT64_MAX -#define UINT_FAST32_MAX UINT64_MAX - -#define INTPTR_MIN INT64_MIN -#define INTPTR_MAX INT64_MAX -#define UINTPTR_MAX UINT64_MAX - -#define PTRDIFF_MIN INT64_MIN -#define PTRDIFF_MAX INT64_MAX - -#endif /* _BITSIZE_STDINTLIMITS_H */ diff --git a/klibc/klibc/include/ctype.h b/klibc/klibc/include/ctype.h deleted file mode 100644 index 3f5cfad558..0000000000 --- a/klibc/klibc/include/ctype.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * ctype.h - * - * This assumes ISO 8859-1, being a reasonable superset of ASCII. - */ - -#ifndef _CTYPE_H -#define _CTYPE_H - -#ifndef __CTYPE_NO_INLINE -# define __ctype_inline extern __inline__ -#else -# define __ctype_inline -#endif - -/* - * This relies on the following definitions: - * - * cntrl = !print - * alpha = upper|lower - * graph = punct|alpha|digit - * blank = '\t' || ' ' (per POSIX requirement) - */ -enum { - __ctype_upper = (1 << 0), - __ctype_lower = (1 << 1), - __ctype_digit = (1 << 2), - __ctype_xdigit = (1 << 3), - __ctype_space = (1 << 4), - __ctype_print = (1 << 5), - __ctype_punct = (1 << 6) -}; - -extern const unsigned char __ctypes[]; - -__ctype_inline int isalnum(int __c) -{ - return __ctypes[__c+1] & - (__ctype_upper|__ctype_lower|__ctype_digit); -} - -__ctype_inline int isalpha(int __c) -{ - return __ctypes[__c+1] & - (__ctype_upper|__ctype_lower); -} - -__ctype_inline int isascii(int __c) -{ - return !(__c & ~0x7f); -} - -__ctype_inline int isblank(int __c) -{ - return (__c == '\t') || (__c == ' '); -} - -__ctype_inline int iscntrl(int __c) -{ - return (__c >= 0) && !(__ctypes[__c+1] & __ctype_print); -} - -__ctype_inline int isdigit(int __c) -{ - return __ctypes[__c+1] & __ctype_digit; -} - -__ctype_inline int isgraph(int __c) -{ - return __ctypes[__c+1] & - (__ctype_upper|__ctype_lower|__ctype_digit|__ctype_punct); -} - -__ctype_inline int islower(int __c) -{ - return __ctypes[__c+1] & __ctype_lower; -} - -__ctype_inline int isprint(int __c) -{ - return __ctypes[__c+1] & __ctype_print; -} - -__ctype_inline int ispunct(int __c) -{ - return __ctypes[__c+1] & __ctype_punct; -} - -__ctype_inline int isspace(int __c) -{ - return __ctypes[__c+1] & __ctype_space; -} - -__ctype_inline int isupper(int __c) -{ - return __ctypes[__c+1] & __ctype_upper; -} - -__ctype_inline int isxdigit(int __c) -{ - return __ctypes[__c+1] & __ctype_xdigit; -} - -/* Note: this is decimal, not hex, to avoid accidental promotion to unsigned */ -#define _toupper(__c) ((__c) & ~32) -#define _tolower(__c) ((__c) | 32) - -__ctype_inline int toupper(int __c) -{ - return islower(__c) ? _toupper(__c) : __c; -} - -__ctype_inline int tolower(int __c) -{ - return isupper(__c) ? _tolower(__c) : __c; -} - -#endif /* _CTYPE_H */ diff --git a/klibc/klibc/include/dirent.h b/klibc/klibc/include/dirent.h deleted file mode 100644 index 10dd138ee5..0000000000 --- a/klibc/klibc/include/dirent.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * dirent.h - */ - -#ifndef _DIRENT_H -#define _DIRENT_H - -#include -#include - -#ifndef __IO_DIR_DEFINED -struct _IO_dir; -#endif -typedef struct _IO_dir DIR; - -__extern DIR *opendir(const char *); -__extern struct dirent *readdir(DIR *); -__extern int closedir(DIR *); - -#endif /* _DIRENT_H */ diff --git a/klibc/klibc/include/elf.h b/klibc/klibc/include/elf.h deleted file mode 100644 index 52f47d042e..0000000000 --- a/klibc/klibc/include/elf.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * elf.h - */ - -#ifndef _ELF_H -#define _ELF_H - -#include -#include - -#endif /* _ELF_H */ - diff --git a/klibc/klibc/include/endian.h b/klibc/klibc/include/endian.h deleted file mode 100644 index 44f89ccbbc..0000000000 --- a/klibc/klibc/include/endian.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * endian.h - */ - -#ifndef _ENDIAN_H -#define _ENDIAN_H - -#include -#include - -/* Linux' asm/byteorder.h defines either __LITTLE_ENDIAN or - __BIG_ENDIAN, but the glibc/BSD-ish macros expect both to be - defined with __BYTE_ORDER defining which is actually used... */ - -#if defined(__LITTLE_ENDIAN) -# undef __LITTLE_ENDIAN -# define __LITTLE_ENDIAN 1234 -# define __BIG_ENDIAN 4321 -# define __PDP_ENDIAN 3412 -# define __BYTE_ORDER __LITTLE_ENDIAN -#elif defined(__BIG_ENDIAN) -# undef __BIG_ENDIAN -# define __LITTLE_ENDIAN 1234 -# define __BIG_ENDIAN 4321 -# define __PDP_ENDIAN 3412 -# define __BYTE_ORDER __BIG_ENDIAN -#elif defined(__PDP_ENDIAN) -# undef __PDP_ENDIAN -# define __LITTLE_ENDIAN 1234 -# define __BIG_ENDIAN 4321 -# define __PDP_ENDIAN 3412 -# define __BYTE_ORDER __PDP_ENDIAN -#else -# error "Unknown byte order!" -#endif - -#define LITTLE_ENDIAN __LITTLE_ENDIAN -#define BIG_ENDIAN __BIG_ENDIAN -#define PDP_ENDIAN __PDP_ENDIAN -#define BYTE_ORDER __BYTE_ORDER - -#endif /* _ENDIAN_H */ diff --git a/klibc/klibc/include/errno.h b/klibc/klibc/include/errno.h deleted file mode 100644 index b2e666504d..0000000000 --- a/klibc/klibc/include/errno.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * errno.h - */ - -#include -#include - -__extern int errno; diff --git a/klibc/klibc/include/fcntl.h b/klibc/klibc/include/fcntl.h deleted file mode 100644 index e90959c7e9..0000000000 --- a/klibc/klibc/include/fcntl.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * fcntl.h - */ - -#ifndef _FCNTL_H -#define _FCNTL_H - -#include -#include - -#endif /* _FCNTL_H */ diff --git a/klibc/klibc/include/grp.h b/klibc/klibc/include/grp.h deleted file mode 100644 index 03ceb31560..0000000000 --- a/klibc/klibc/include/grp.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * grp.h - */ - -#ifndef _GRP_H -#define _GRP_H - -#include -#include - -__extern int setgroups(size_t, const gid_t *); - -#endif /* _GRP_H */ diff --git a/klibc/klibc/include/inttypes.h b/klibc/klibc/include/inttypes.h deleted file mode 100644 index e00fa63160..0000000000 --- a/klibc/klibc/include/inttypes.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * inttypes.h - */ - -#ifndef _INTTYPES_H -#define _INTTYPES_H - -#include -#include -#include - -static __inline__ intmax_t imaxabs(intmax_t __n) -{ - return (__n < (intmax_t)0) ? -__n : __n; -} - -__extern intmax_t strtoimax(const char *, char **, int); -__extern uintmax_t strtoumax(const char *, char **, int); - -/* extensions */ -__extern intmax_t strntoimax(const char *, char **, int, size_t); -__extern uintmax_t strntoumax(const char *, char **, int, size_t); - -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) - -#define PRId8 "d" -#define PRId16 "d" -#define PRId32 "d" -#define PRId64 __PRI64_RANK "d" - -#define PRIdLEAST8 "d" -#define PRIdLEAST16 "d" -#define PRIdLEAST32 "d" -#define PRIdLEAST64 __PRI64_RANK "d" - -#define PRIdFAST8 "d" -#define PRIdFAST16 __PRIFAST_RANK "d" -#define PRIdFAST32 __PRIFAST_RANK "d" -#define PRIdFAST64 __PRI64_RANK "d" - -#define PRIdMAX __PRI64_RANK "d" -#define PRIdPTR __PRIPTR_RANK "d" - -#define PRIi8 "i" -#define PRIi16 "i" -#define PRIi32 "i" -#define PRIi64 __PRI64_RANK "i" - -#define PRIiLEAST8 "i" -#define PRIiLEAST16 "i" -#define PRIiLEAST32 "i" -#define PRIiLEAST64 __PRI64_RANK "i" - -#define PRIiFAST8 "i" -#define PRIiFAST16 __PRIFAST_RANK "i" -#define PRIiFAST32 __PRIFAST_RANK "i" -#define PRIiFAST64 __PRI64_RANK "i" - -#define PRIiMAX __PRI64_RANK "i" -#define PRIiPTR __PRIPTR_RANK "i" - -#define PRIo8 "o" -#define PRIo16 "o" -#define PRIo32 "o" -#define PRIo64 __PRI64_RANK "o" - -#define PRIoLEAST8 "o" -#define PRIoLEAST16 "o" -#define PRIoLEAST32 "o" -#define PRIoLEAST64 __PRI64_RANK "o" - -#define PRIoFAST8 "o" -#define PRIoFAST16 __PRIFAST_RANK "o" -#define PRIoFAST32 __PRIFAST_RANK "o" -#define PRIoFAST64 __PRI64_RANK "o" - -#define PRIoMAX __PRI64_RANK "o" -#define PRIoPTR __PRIPTR_RANK "o" - -#define PRIu8 "u" -#define PRIu16 "u" -#define PRIu32 "u" -#define PRIu64 __PRI64_RANK "u" - -#define PRIuLEAST8 "u" -#define PRIuLEAST16 "u" -#define PRIuLEAST32 "u" -#define PRIuLEAST64 __PRI64_RANK "u" - -#define PRIuFAST8 "u" -#define PRIuFAST16 __PRIFAST_RANK "u" -#define PRIuFAST32 __PRIFAST_RANK "u" -#define PRIuFAST64 __PRI64_RANK "u" - -#define PRIuMAX __PRI64_RANK "u" -#define PRIuPTR __PRIPTR_RANK "u" - -#define PRIx8 "x" -#define PRIx16 "x" -#define PRIx32 "x" -#define PRIx64 __PRI64_RANK "x" - -#define PRIxLEAST8 "x" -#define PRIxLEAST16 "x" -#define PRIxLEAST32 "x" -#define PRIxLEAST64 __PRI64_RANK "x" - -#define PRIxFAST8 "x" -#define PRIxFAST16 __PRIFAST_RANK "x" -#define PRIxFAST32 __PRIFAST_RANK "x" -#define PRIxFAST64 __PRI64_RANK "x" - -#define PRIxMAX __PRI64_RANK "x" -#define PRIxPTR __PRIPTR_RANK "x" - -#define PRIX8 "X" -#define PRIX16 "X" -#define PRIX32 "X" -#define PRIX64 __PRI64_RANK "X" - -#define PRIXLEAST8 "X" -#define PRIXLEAST16 "X" -#define PRIXLEAST32 "X" -#define PRIXLEAST64 __PRI64_RANK "X" - -#define PRIXFAST8 "X" -#define PRIXFAST16 __PRIFAST_RANK "X" -#define PRIXFAST32 __PRIFAST_RANK "X" -#define PRIXFAST64 __PRI64_RANK "X" - -#define PRIXMAX __PRI64_RANK "X" -#define PRIXPTR __PRIPTR_RANK "X" - -#define SCNd8 "hhd" -#define SCNd16 "hd" -#define SCNd32 "d" -#define SCNd64 __PRI64_RANK "d" - -#define SCNdLEAST8 "hhd" -#define SCNdLEAST16 "hd" -#define SCNdLEAST32 "d" -#define SCNdLEAST64 __PRI64_RANK "d" - -#define SCNdFAST8 "hhd" -#define SCNdFAST16 __PRIFAST_RANK "d" -#define SCNdFAST32 __PRIFAST_RANK "d" -#define SCNdFAST64 __PRI64_RANK "d" - -#define SCNdMAX __PRI64_RANK "d" -#define SCNdPTR __PRIPTR_RANK "d" - -#define SCNi8 "hhi" -#define SCNi16 "hi" -#define SCNi32 "i" -#define SCNi64 __PRI64_RANK "i" - -#define SCNiLEAST8 "hhi" -#define SCNiLEAST16 "hi" -#define SCNiLEAST32 "i" -#define SCNiLEAST64 __PRI64_RANK "i" - -#define SCNiFAST8 "hhi" -#define SCNiFAST16 __PRIFAST_RANK "i" -#define SCNiFAST32 __PRIFAST_RANK "i" -#define SCNiFAST64 __PRI64_RANK "i" - -#define SCNiMAX __PRI64_RANK "i" -#define SCNiPTR __PRIPTR_RANK "i" - -#define SCNo8 "hho" -#define SCNo16 "ho" -#define SCNo32 "o" -#define SCNo64 __PRI64_RANK "o" - -#define SCNoLEAST8 "hho" -#define SCNoLEAST16 "ho" -#define SCNoLEAST32 "o" -#define SCNoLEAST64 __PRI64_RANK "o" - -#define SCNoFAST8 "hho" -#define SCNoFAST16 __PRIFAST_RANK "o" -#define SCNoFAST32 __PRIFAST_RANK "o" -#define SCNoFAST64 __PRI64_RANK "o" - -#define SCNoMAX __PRI64_RANK "o" -#define SCNoPTR __PRIPTR_RANK "o" - -#define SCNu8 "hhu" -#define SCNu16 "hu" -#define SCNu32 "u" -#define SCNu64 __PRI64_RANK "u" - -#define SCNuLEAST8 "hhu" -#define SCNuLEAST16 "hu" -#define SCNuLEAST32 "u" -#define SCNuLEAST64 __PRI64_RANK "u" - -#define SCNuFAST8 "hhu" -#define SCNuFAST16 __PRIFAST_RANK "u" -#define SCNuFAST32 __PRIFAST_RANK "u" -#define SCNuFAST64 __PRI64_RANK "u" - -#define SCNuMAX __PRI64_RANK "u" -#define SCNuPTR __PRIPTR_RANK "u" - -#define SCNx8 "hhx" -#define SCNx16 "hx" -#define SCNx32 "x" -#define SCNx64 __PRI64_RANK "x" - -#define SCNxLEAST8 "hhx" -#define SCNxLEAST16 "hx" -#define SCNxLEAST32 "x" -#define SCNxLEAST64 __PRI64_RANK "x" - -#define SCNxFAST8 "hhx" -#define SCNxFAST16 __PRIFAST_RANK "x" -#define SCNxFAST32 __PRIFAST_RANK "x" -#define SCNxFAST64 __PRI64_RANK "x" - -#define SCNxMAX __PRI64_RANK "x" -#define SCNxPTR __PRIPTR_RANK "x" - -#endif - -#endif /* _INTTYPES_H */ diff --git a/klibc/klibc/include/klibc/compiler.h b/klibc/klibc/include/klibc/compiler.h deleted file mode 100644 index 6c01474cc1..0000000000 --- a/klibc/klibc/include/klibc/compiler.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * klibc/compiler.h - * - * Various compiler features - */ - -#ifndef _KLIBC_COMPILER_H -#define _KLIBC_COMPILER_H - -/* Specific calling conventions */ -/* __cdecl is used when we want varadic and non-varadic functions to have - the same binary calling convention. */ -#ifdef __i386__ -# ifdef __GNUC__ -# define __cdecl __attribute__((cdecl,regparm(0))) -# else - /* Most other C compilers have __cdecl as a keyword */ -# endif -#else -# define __cdecl /* Meaningless on non-i386 */ -#endif - -/* How to declare a function that *must* be inlined */ -#ifdef __GNUC__ -# if __GNUC_MAJOR__ >= 3 -# define __must_inline static __inline__ __attribute__((always_inline)) -# else -# define __must_inline extern __inline__ -# endif -#else -# define __must_inline inline /* Just hope this works... */ -#endif - -/* How to declare a function that does not return */ -#ifdef __GNUC__ -# define __noreturn void __attribute__((noreturn)) -#else -# define __noreturn void -#endif - -/* How to declare a "constant" function (a function in the - mathematical sense) */ -#ifdef __GNUC__ -# define __constfunc __attribute__((const)) -#else -# define __constfunc -#endif - -/* Format attribute */ -#ifdef __GNUC__ -# define __formatfunc(t,f,a) __attribute__((format(t,f,a))) -#else -# define __formatfunc(t,f,a) -#endif - -/* likely/unlikely */ -#if defined(__GNUC__) && (__GNUC_MAJOR__ > 2 || (__GNUC_MAJOR__ == 2 && __GNUC_MINOR__ >= 95)) -# define __likely(x) __builtin_expect((x), 1) -# define __unlikely(x) __builtin_expect((x), 0) -#else -# define __likely(x) (x) -# define __unlikely(x) (x) -#endif - -/* Possibly unused function */ -#ifdef __GNUC__ -# define __unusedfunc __attribute__((unused)) -#else -# define __unusedfunc -#endif - -/* "pure" function: - - Many functions have no effects except the return value and their - return value depends only on the parameters and/or global - variables. Such a function can be subject to common subexpression - elimination and loop optimization just as an arithmetic operator - would be. These functions should be declared with the attribute - `pure'. -*/ -#ifdef __GNUC__ -# define __attribute_pure__ __attribute__((pure)) -#else -# define __attribute_pure__ -#endif - -/* "const" function: - - Many functions do not examine any values except their arguments, - and have no effects except the return value. Basically this is - just slightly more strict class than the `pure' attribute above, - since function is not allowed to read global memory. - - Note that a function that has pointer arguments and examines the - data pointed to must _not_ be declared `const'. Likewise, a - function that calls a non-`const' function usually must not be - `const'. It does not make sense for a `const' function to return - `void'. -*/ -#ifdef __GNUC__ -# define __attribute_const__ __attribute__((const)) -#else -# define __attribute_const__ -#endif - -#endif diff --git a/klibc/klibc/include/klibc/diverr.h b/klibc/klibc/include/klibc/diverr.h deleted file mode 100644 index 4d8c8d36c2..0000000000 --- a/klibc/klibc/include/klibc/diverr.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * klibc/diverr.h - */ - -#ifndef _KLIBC_DIVERR_H -#define _KLIBC_DIVERR_H - -#include - -static __inline__ void -__divide_error(void) -{ - raise(SIGFPE); -} - -#endif /* _KLIBC_DIVERR_H */ diff --git a/klibc/klibc/include/klibc/extern.h b/klibc/klibc/include/klibc/extern.h deleted file mode 100644 index f9c3467211..0000000000 --- a/klibc/klibc/include/klibc/extern.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * klibc/extern.h - */ - -#ifndef _KLIBC_EXTERN_H -#define _KLIBC_EXTERN_H - -#ifdef __cplusplus -#define __extern extern "C" -#else -#define __extern extern -#endif - -#endif /* _KLIBC_EXTERN_H */ diff --git a/klibc/klibc/include/limits.h b/klibc/klibc/include/limits.h deleted file mode 100644 index f1532e5323..0000000000 --- a/klibc/klibc/include/limits.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * limits.h - */ - -#ifndef _LIMITS_H -#define _LIMITS_H - -#define CHAR_BIT 8 -#define SHRT_BIT 16 -#define INT_BIT 32 -#define LONGLONG_BIT 64 - -#define SCHAR_MIN (-128) -#define SCHAR_MAX 127 -#define UCHAR_MAX 255 - -#ifdef __CHAR_UNSIGNED__ -# define CHAR_MIN 0 -# define CHAR_MAX UCHAR_MAX -#else -# define CHAR_MIN SCHAR_MIN -# define CHAR_MAX SCHAR_MAX -#endif - -#define SHRT_MIN (-32768) -#define SHRT_MAX 32767 -#define USHRT_MAX 65535 - -#define INT_MIN (-2147483647-1) -#define INT_MAX 2147483647 -#define UINT_MAX 4294967295U - -#define LONGLONG_MIN (-9223372036854775807LL-1) -#define LONGLONG_MAX 9223372036854775807LL -#define ULONGLONG_MAX 18446744073709551615ULL - -#include -#include - -#endif /* _LIMITS_H */ diff --git a/klibc/klibc/include/net/if.h b/klibc/klibc/include/net/if.h deleted file mode 100644 index 1aa8e7b90c..0000000000 --- a/klibc/klibc/include/net/if.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/klibc/include/net/if_arp.h b/klibc/klibc/include/net/if_arp.h deleted file mode 100644 index a25f1b4759..0000000000 --- a/klibc/klibc/include/net/if_arp.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/klibc/include/net/if_ether.h b/klibc/klibc/include/net/if_ether.h deleted file mode 100644 index 060ef22070..0000000000 --- a/klibc/klibc/include/net/if_ether.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/klibc/include/net/if_packet.h b/klibc/klibc/include/net/if_packet.h deleted file mode 100644 index b5e8e0e11f..0000000000 --- a/klibc/klibc/include/net/if_packet.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/klibc/include/netinet/in.h b/klibc/klibc/include/netinet/in.h deleted file mode 100644 index 92dc843bb1..0000000000 --- a/klibc/klibc/include/netinet/in.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * netinet/in.h - */ - -#ifndef _NETINET_IN_H -#define _NETINET_IN_H - -/* added this include by Mats Petersson */ -#include - -#include -#include -#include /* Must be included *before* */ -#include - -#ifndef htons -# define htons(x) __cpu_to_be16(x) -#endif -#ifndef ntohs -# define ntohs(x) __be16_to_cpu(x) -#endif -#ifndef htonl -# define htonl(x) __cpu_to_be32(x) -#endif -#ifndef ntohl -# define ntohl(x) __be32_to_cpu(x) -#endif - -#define IPPORT_RESERVED 1024 - -__extern int bindresvport (int sd, struct sockaddr_in *sin); - -#endif /* _NETINET_IN_H */ diff --git a/klibc/klibc/include/netinet/in6.h b/klibc/klibc/include/netinet/in6.h deleted file mode 100644 index 46584ca627..0000000000 --- a/klibc/klibc/include/netinet/in6.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * netinet/in6.h - */ - -#ifndef _NETINET_IN6_H -#define _NETINET_IN6_H - -#include - -#endif /* _NETINET_IN6_H */ diff --git a/klibc/klibc/include/netinet/ip.h b/klibc/klibc/include/netinet/ip.h deleted file mode 100644 index 8aecbe66a3..0000000000 --- a/klibc/klibc/include/netinet/ip.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * netinet/ip.h - */ - -#ifndef _NETINET_IP_H -#define _NETINET_IP_H - -#include -#include - -#define IP_DF 0x4000 /* Flag: "Don't Fragment" */ - -#endif /* _NETINET_IP_H */ diff --git a/klibc/klibc/include/netinet/tcp.h b/klibc/klibc/include/netinet/tcp.h deleted file mode 100644 index bb5d307e98..0000000000 --- a/klibc/klibc/include/netinet/tcp.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * netinet/tcp.h - */ - -#ifndef _NETINET_TCP_H -#define _NETINET_TCP_H - -#include /* Include *before* linux/tcp.h */ -#include - -#endif /* _NETINET_TCP_H */ diff --git a/klibc/klibc/include/netinet/udp.h b/klibc/klibc/include/netinet/udp.h deleted file mode 100644 index b809b4ee6e..0000000000 --- a/klibc/klibc/include/netinet/udp.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * netinet/udp.h - */ - -#ifndef _NETINET_UDP_H -#define _NETINET_UDP_H - -/* - * We would include linux/udp.h, but it brings in too much other stuff - */ - -struct udphdr { - __u16 source; - __u16 dest; - __u16 len; - __u16 check; -}; - -#endif /* _NETINET_UDP_H */ diff --git a/klibc/klibc/include/poll.h b/klibc/klibc/include/poll.h deleted file mode 100644 index 8710d92ebd..0000000000 --- a/klibc/klibc/include/poll.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * poll.h - */ - -#ifndef _POLL_H -#define _POLL_H - -#include -#include - -/* POSIX specifies "int" for the timeout, Linux seems to use long... */ - -typedef unsigned int nfds_t; -__extern int poll(struct pollfd *, nfds_t, long); - -#endif /* _POLL_H */ diff --git a/klibc/klibc/include/sched.h b/klibc/klibc/include/sched.h deleted file mode 100644 index 5e6103965f..0000000000 --- a/klibc/klibc/include/sched.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * sched.h - */ - -#ifndef _SCHED_H -#define _SCHED_H - -#include - -/* linux/sched.h is unusable; put the declarations we need here... */ - -#define SCHED_NORMAL 0 -#define SCHED_FIFO 1 -#define SCHED_RR 2 - -struct sched_param { - int sched_priority; -}; - -__extern int sched_setschedule(pid_t, int, const struct sched_param *); -__extern int sched_yield(void); - -#endif /* _SCHED_H */ diff --git a/klibc/klibc/include/setjmp.h b/klibc/klibc/include/setjmp.h deleted file mode 100644 index b504eb6d08..0000000000 --- a/klibc/klibc/include/setjmp.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * setjmp.h - */ - -#ifndef _SETJMP_H -#define _SETJMP_H - -#include -#include -#include -#include - -#include - -__extern int setjmp(jmp_buf); -__extern __noreturn longjmp(jmp_buf, int); - -/* - Whose bright idea was it to add unrelated functionality to just about - the only function in the standard C library (setjmp) which cannot be - wrapped by an ordinary function wrapper? Anyway, the damage is done, - and therefore, this wrapper *must* be inline. However, gcc will - complain if this is an inline function for unknown reason, and - therefore sigsetjmp() needs to be a macro. -*/ - -struct __sigjmp_buf { - jmp_buf __jmpbuf; - sigset_t __sigs; -}; - -typedef struct __sigjmp_buf sigjmp_buf[1]; - -#define sigsetjmp(__env, __save) \ -({ \ - struct __sigjmp_buf *__e = (__env); \ - sigprocmask(0, NULL, &__e->__sigs); \ - setjmp(__e->__jmpbuf); \ -}) - -__extern __noreturn siglongjmp(sigjmp_buf, int); - -#endif /* _SETJMP_H */ diff --git a/klibc/klibc/include/signal.h b/klibc/klibc/include/signal.h deleted file mode 100644 index 513b4e5a04..0000000000 --- a/klibc/klibc/include/signal.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * signal.h - */ - -#ifndef _SIGNAL_H -#define _SIGNAL_H - -#include -#include /* For memset() */ -#include /* For LONG_BIT */ -#include -#include - -#include - -/* glibc seems to use sig_atomic_t as "int" pretty much on all architectures. - Do the same, but allow the architecture to override. */ -#ifdef _KLIBC_HAS_ARCH_SIG_ATOMIC_T -typedef int sig_atomic_t; -#endif - -/* Some architectures don't define these */ -#ifndef SA_RESETHAND -# define SA_RESETHAND SA_ONESHOT -#endif -#ifndef SA_NODEFER -# define SA_NODEFER SA_NOMASK -#endif -#ifndef NSIG -# define NSIG _NSIG -#endif - -__extern const char * const sys_siglist[]; - -/* This assumes sigset_t is either an unsigned long or an array of such, - and that _NSIG_BPW in the kernel is always LONG_BIT */ - -static __inline__ int sigemptyset(sigset_t *__set) -{ - memset(__set, 0, sizeof *__set); - return 0; -} -static __inline__ int sigfillset(sigset_t *__set) -{ - memset(__set, ~0, sizeof *__set); - return 0; -} -static __inline__ int sigaddset(sigset_t *__set, int __signum) -{ - unsigned long *__lset = (unsigned long *)__set; - __lset[__signum/LONG_BIT] |= 1UL << (__signum%LONG_BIT); - return 0; -} -static __inline__ int sigdelset(sigset_t *__set, int __signum) -{ - unsigned long *__lset = (unsigned long *)__set; - __lset[__signum/LONG_BIT] &= ~(1UL << (__signum%LONG_BIT)); - return 0; -} -static __inline__ int sigismember(sigset_t *__set, int __signum) -{ - unsigned long *__lset = (unsigned long *)__set; - return (int)((__lset[__signum/LONG_BIT] >> (__signum%LONG_BIT)) & 1); -} - -__extern __sighandler_t __signal(int, __sighandler_t, int); -__extern __sighandler_t sysv_signal(int, __sighandler_t); -__extern __sighandler_t bsd_signal(int, __sighandler_t); -__extern int sigaction(int, const struct sigaction *, struct sigaction *); -__extern int sigprocmask(int, const sigset_t *, sigset_t *); -__extern int sigpending(sigset_t *); -__extern int sigsuspend(const sigset_t *); -__extern int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t); -__extern int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t); -__extern int rt_sigpending(sigset_t *, size_t); -__extern int rt_sigsuspend(const sigset_t *, size_t); -__extern int raise(int); -__extern int kill(pid_t, int); - -#endif /* _SIGNAL_H */ diff --git a/klibc/klibc/include/stdarg.h b/klibc/klibc/include/stdarg.h deleted file mode 100644 index cc324b825d..0000000000 --- a/klibc/klibc/include/stdarg.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * stdarg.h - * - * This is just a wrapper for the gcc one, but defines va_copy() - * even if gcc doesn't. - */ - -/* Note: the _STDARG_H macro belongs to the gcc header... */ -#include_next - -/* Older gcc considers this an extension, so it's double underbar only */ -#ifndef va_copy -#define va_copy(d,s) __va_copy(d,s) -#endif diff --git a/klibc/klibc/include/stddef.h b/klibc/klibc/include/stddef.h deleted file mode 100644 index 125d2352ec..0000000000 --- a/klibc/klibc/include/stddef.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * stddef.h - */ - -#ifndef _STDDEF_H -#define _STDDEF_H - -#ifndef __KLIBC__ -# define __KLIBC__ 1 -#endif - -#include - -#undef NULL -#ifdef __cplusplus -# define NULL 0 -#else -# define NULL ((void *)0) -#endif - -#undef offsetof -#define offsetof(t,m) ((size_t)&((t *)0)->m) - -#endif /* _STDDEF_H */ diff --git a/klibc/klibc/include/stdint.h b/klibc/klibc/include/stdint.h deleted file mode 100644 index 47fec18594..0000000000 --- a/klibc/klibc/include/stdint.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * stdint.h - */ - -#ifndef _STDINT_H -#define _STDINT_H - -#include - -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; - -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -typedef int8_t int_fast8_t; -typedef int64_t int_fast64_t; - -typedef uint8_t uint_fast8_t; -typedef uint64_t uint_fast64_t; - -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - -#define INT8_MIN (-128) -#define INT16_MIN (-32768) -#define INT32_MIN (-2147483647-1) -#define INT64_MIN (__INT64_C(-9223372036854775807)-1) - -#define INT8_MAX (127) -#define INT16_MAX (32767) -#define INT32_MAX (2147483647) -#define INT64_MAX (__INT64_C(9223372036854775807)) - -#define UINT8_MAX (255U) -#define UINT16_MAX (65535U) -#define UINT32_MAX (4294967295U) -#define UINT64_MAX (__UINT64_C(18446744073709551615)) - -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST64_MIN INT64_MIN - -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST64_MAX INT64_MAX - -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST64_MAX UINT64_MAX - -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -#include - -#endif - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) - -#define INT8_C(c) c -#define INT16_C(c) c -#define INT32_C(c) c -#define INT64_C(c) __INT64_C(c) - -#define UINT8_C(c) c ## U -#define UINT16_C(c) c ## U -#define UINT32_C(c) c ## U -#define UINT64_C(c) __UINT64_C(c) - -#define INT_LEAST8_C(c) INT8_C(c) -#define INT_LEAST16_C(c) INT16_C(c) -#define INT_LEAST32_C(c) INT32_C(c) -#define INT_LEAST64_C(c) INT64_C(c) - -#define UINT_LEAST8_C(c) UINT8_C(c) -#define UINT_LEAST16_C(c) UINT16_C(c) -#define UINT_LEAST32_C(c) UINT32_C(c) -#define UINT_LEAST64_C(c) UINT64_C(c) - -#define INT_FAST8_C(c) INT8_C(c) -#define INT_FAST64_C(c) INT64_C(c) - -#define UINT_FAST8_C(c) UINT8_C(c) -#define UINT_FAST64_C(c) UINT64_C(c) - -#define INTMAX_C(c) INT64_C(c) -#define UINTMAX_C(c) UINT64_C(c) - -#include - -#endif - -/* Keep the kernel from trying to define these types... */ -#define __BIT_TYPES_DEFINED__ - -#endif /* _STDINT_H */ diff --git a/klibc/klibc/include/stdio.h b/klibc/klibc/include/stdio.h deleted file mode 100644 index fba1e30746..0000000000 --- a/klibc/klibc/include/stdio.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * stdio.h - */ - -#ifndef _STDIO_H -#define _STDIO_H - -#include -#include -#include -#include - -/* This structure doesn't really exist, but it gives us something - to define FILE * with */ -struct _IO_file; -typedef struct _IO_file FILE; - -#ifndef EOF -# define EOF (-1) -#endif - -#ifndef BUFSIZ -# define BUFSIZ 4096 -#endif - -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - -/* - * Convert between a FILE * and a file descriptor. We don't actually - * have any in-memory data, so we just abuse the pointer itself to - * hold the data. Note, however, that for file descriptors, -1 is - * error and 0 is a valid value; for FILE *, NULL (0) is error and - * non-NULL are valid. - */ -static __inline__ int fileno(FILE *__f) -{ - /* This should really be intptr_t, but size_t should be the same size */ - return (int)(size_t)__f - 1; -} - -/* This is a macro so it can be used as initializer */ -#define __create_file(__fd) ((FILE *)(size_t)((__fd) + 1)) - -#define stdin __create_file(0) -#define stdout __create_file(1) -#define stderr __create_file(2) - -__extern FILE *fopen(const char *, const char *); - -static __inline__ FILE *fdopen(int __fd, const char *__m) -{ - (void)__m; return __create_file(__fd); -} -static __inline__ int fclose(FILE *__f) -{ - extern int close(int); - return close(fileno(__f)); -} -static __inline__ int fseek(FILE *__f, off_t __o, int __w) -{ - extern off_t lseek(int, off_t, int); - return (lseek(fileno(__f), __o, __w) == (off_t)-1) ? -1 : 0; -} -static __inline__ off_t ftell(FILE *__f) -{ - extern off_t lseek(int, off_t, int); - return lseek(fileno(__f), 0, SEEK_CUR); -} - -__extern int fputs(const char *, FILE *); -__extern int puts(const char *); -__extern int fputc(int, FILE *); -#define putc(c,f) fputc((c),(f)) -#define putchar(c) fputc((c),stdout) - -__extern int fgetc(FILE *); -__extern char * fgets(char *, int, FILE *); -#define getc(f) fgetc(f) - -__extern size_t _fread(void *, size_t, FILE *); -__extern size_t _fwrite(const void *, size_t, FILE *); - -#ifndef __NO_FREAD_FWRITE_INLINES -extern __inline__ size_t -fread(void *__p, size_t __s, size_t __n, FILE *__f) -{ - return _fread(__p, __s*__n, __f)/__s; -} - -extern __inline__ size_t -fwrite(void *__p, size_t __s, size_t __n, FILE *__f) -{ - return _fwrite(__p, __s*__n, __f)/__s; -} -#endif - -__extern int printf(const char *, ...); -__extern int vprintf(const char *, va_list); -__extern int fprintf(FILE *, const char *, ...); -__extern int vfprintf(FILE *, const char *, va_list); -__extern int sprintf(char *, const char *, ...); -__extern int vsprintf(char *, const char *, va_list); -__extern int snprintf(char *, size_t n, const char *, ...); -__extern int vsnprintf(char *, size_t n, const char *, va_list); - -__extern int sscanf(const char *, const char *, ...); -__extern int vsscanf(const char *, const char *, va_list); - -__extern void perror(const char *); - -__extern int rename(const char *, const char *); - -#endif /* _STDIO_H */ diff --git a/klibc/klibc/include/stdlib.h b/klibc/klibc/include/stdlib.h deleted file mode 100644 index af97eea636..0000000000 --- a/klibc/klibc/include/stdlib.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * stdlib.h - */ - -#ifndef _STDLIB_H -#define _STDLIB_H - -#include -#include -#include - -#define EXIT_FAILURE 1 -#define EXIT_SUCCESS 0 - -static __inline__ __noreturn _Exit(int __n) { - __extern __noreturn _exit(int); - _exit(__n); - for(;;); /* Some gcc versions are stupid */ -} -__extern __noreturn abort(void); -static __inline__ int abs(int __n) { - return (__n < 0) ? -__n : __n; -} -__extern int atexit(void (*)(void)); -__extern int on_exit(void (*)(int, void *), void *); -__extern int atoi(const char *); -__extern long atol(const char *); -__extern long long atoll(const char *); -__extern __noreturn exit(int); -__extern void free(void *); -static __inline__ long labs(long __n) { - return (__n < 0L) ? -__n : __n; -} - -static __inline__ long long llabs(long long __n) { - return (__n < 0LL) ? -__n : __n; -} - -#if defined(__GNUC__) && __GNUC_MAJOR__ >= 3 -# define __attribute_malloc __attribute__((malloc)) -#else -# define __attribute_malloc -#endif - -__extern __attribute_malloc void *malloc(size_t); -__extern __attribute_malloc void *calloc(size_t, size_t); -__extern void *realloc(void *, size_t); -__extern long strtol(const char *, char **, int); -__extern long long strtoll(const char *, char **, int); -__extern unsigned long strtoul(const char *, char **, int); -__extern unsigned long long strtoull(const char *, char **, int); - -__extern char *getenv(const char *); -__extern int putenv(const char *); -__extern int setenv(const char *, const char *, int); -__extern int unsetenv(const char *); - -__extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); - - -__extern long jrand48(unsigned short *); -__extern long mrand48(void); -__extern long nrand48(unsigned short *); -__extern long lrand48(void); -__extern unsigned short *seed48(const unsigned short *); -__extern void srand48(long); - -#define RAND_MAX 0x7fffffff -static __inline__ int rand(void) { - return (int)lrand48(); -} -static __inline__ void srand(unsigned int __s) { - srand48(__s); -} -static __inline__ long random(void) -{ - return lrand48(); -} -static __inline__ void srandom(unsigned int __s) -{ - srand48(__s); -} - -/* Basic PTY functions. These only work if devpts is mounted! */ - -__extern int unlockpt(int); -__extern char *ptsname(int); -__extern int getpt(void); - -static __inline__ int grantpt(int __fd) -{ - (void)__fd; - return 0; /* devpts does this all for us! */ -} - -#endif /* _STDLIB_H */ diff --git a/klibc/klibc/include/string.h b/klibc/klibc/include/string.h deleted file mode 100644 index 1debb55af0..0000000000 --- a/klibc/klibc/include/string.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * string.h - */ - -#ifndef _STRING_H -#define _STRING_H - -#include -#include - -__extern void *memccpy(void *, const void *, int, size_t); -__extern void *memchr(const void *, int, size_t); -__extern int memcmp(const void *, const void *, size_t); -__extern void *memcpy(void *, const void *, size_t); -__extern void *memmove(void *, const void *, size_t); -__extern void *memset(void *, int, size_t); -__extern void *memmem(const void *, size_t, const void *, size_t); -__extern void memswap(void *, void *, size_t); -__extern int strcasecmp(const char *, const char *); -__extern int strncasecmp(const char *, const char *, size_t); -__extern char *strcat(char *, const char *); -__extern char *strchr(const char *, int); -__extern int strcmp(const char *, const char *); -__extern char *strcpy(char *, const char *); -__extern size_t strcspn(const char *, const char *); -__extern char *strdup(const char *); -__extern char *strndup(const char *, size_t); -__extern char *strerror(int); -__extern size_t strlen(const char *); -__extern char *strncat(char *, const char *, size_t); -__extern int strncmp(const char *, const char *, size_t); -__extern char *strncpy(char *, const char *, size_t); -__extern char *strpbrk(const char *, const char *); -__extern char *strrchr(const char *, int); -__extern char *strsep(char **, const char *); -__extern size_t strspn(const char *, const char *); -__extern char *strstr(const char *, const char *); -__extern char *strtok(char *, const char *); - -#endif /* _STRING_H */ diff --git a/klibc/klibc/include/sys/dirent.h b/klibc/klibc/include/sys/dirent.h deleted file mode 100644 index 0700f4b561..0000000000 --- a/klibc/klibc/include/sys/dirent.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * sys/dirent.h - */ - -#ifndef _SYS_DIRENT_H -#define _SYS_DIRENT_H - -#include -#include - -__extern int getdents(unsigned int, struct dirent *, unsigned int); - -#endif /* _SYS_DIRENT_H */ diff --git a/klibc/klibc/include/sys/elf32.h b/klibc/klibc/include/sys/elf32.h deleted file mode 100644 index 652de5bc5f..0000000000 --- a/klibc/klibc/include/sys/elf32.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * sys/elf32.h - */ - -#ifndef _SYS_ELF32_H -#define _SYS_ELF32_H - -#include - -/* ELF standard typedefs (yet more proof that was way overdue) */ -typedef uint16_t Elf32_Half; -typedef int16_t Elf32_SHalf; -typedef uint32_t Elf32_Word; -typedef int32_t Elf32_Sword; -typedef uint64_t Elf32_Xword; -typedef int64_t Elf32_Sxword; - -typedef uint32_t Elf32_Off; -typedef uint32_t Elf32_Addr; -typedef uint16_t Elf32_Section; - -/* Dynamic header */ - -typedef struct elf32_dyn { - Elf32_Sword d_tag; - union{ - Elf32_Sword d_val; - Elf32_Addr d_ptr; - } d_un; -} Elf32_Dyn; - -/* Relocations */ - -#define ELF32_R_SYM(x) ((x) >> 8) -#define ELF32_R_TYPE(x) ((x) & 0xff) - -typedef struct elf32_rel { - Elf32_Addr r_offset; - Elf32_Word r_info; -} Elf32_Rel; - -typedef struct elf32_rela { - Elf32_Addr r_offset; - Elf32_Word r_info; - Elf32_Sword r_addend; -} Elf32_Rela; - -/* Symbol */ - -typedef struct elf32_sym { - Elf32_Word st_name; - Elf32_Addr st_value; - Elf32_Word st_size; - unsigned char st_info; - unsigned char st_other; - Elf32_Half st_shndx; -} Elf32_Sym; - -/* Main file header */ - -typedef struct elf32_hdr { - unsigned char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; -} Elf32_Ehdr; - -/* Program header */ - -typedef struct elf32_phdr { - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; -} Elf32_Phdr; - - -/* Section header */ - -typedef struct elf32_shdr { - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; -} Elf32_Shdr; - -/* Note header */ -typedef struct elf32_note { - Elf32_Word n_namesz; /* Name size */ - Elf32_Word n_descsz; /* Content size */ - Elf32_Word n_type; /* Content type */ -} Elf32_Nhdr; - -#endif /* _SYS_ELF32_H */ - diff --git a/klibc/klibc/include/sys/elf64.h b/klibc/klibc/include/sys/elf64.h deleted file mode 100644 index 750ddac4d9..0000000000 --- a/klibc/klibc/include/sys/elf64.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * sys/elf64.h - */ - -#ifndef _SYS_ELF64_H -#define _SYS_ELF64_H - -#include - -/* ELF standard typedefs (yet more proof that was way overdue) */ -typedef uint16_t Elf64_Half; -typedef int16_t Elf64_SHalf; -typedef uint32_t Elf64_Word; -typedef int32_t Elf64_Sword; -typedef uint64_t Elf64_Xword; -typedef int64_t Elf64_Sxword; - -typedef uint64_t Elf64_Off; -typedef uint64_t Elf64_Addr; -typedef uint16_t Elf64_Section; - -/* Dynamic header */ - -typedef struct elf64_dyn { - Elf64_Sxword d_tag; - union{ - Elf64_Xword d_val; - Elf64_Addr d_ptr; - } d_un; -} Elf64_Dyn; - -/* Relocations */ - -#define ELF64_R_SYM(x) ((x) >> 32) -#define ELF64_R_TYPE(x) ((x) & 0xffffffff) - -typedef struct elf64_rel { - Elf64_Addr r_offset; - Elf64_Xword r_info; -} Elf64_Rel; - -typedef struct elf64_rela { - Elf64_Addr r_offset; - Elf64_Xword r_info; - Elf64_Sxword r_addend; -} Elf64_Rela; - -/* Symbol */ - -typedef struct elf64_sym { - Elf64_Word st_name; - unsigned char st_info; - unsigned char st_other; - Elf64_Half st_shndx; - Elf64_Addr st_value; - Elf64_Xword st_size; -} Elf64_Sym; - -/* Main file header */ - -typedef struct elf64_hdr { - unsigned char e_ident[EI_NIDENT]; - Elf64_Half e_type; - Elf64_Half e_machine; - Elf64_Word e_version; - Elf64_Addr e_entry; - Elf64_Off e_phoff; - Elf64_Off e_shoff; - Elf64_Word e_flags; - Elf64_Half e_ehsize; - Elf64_Half e_phentsize; - Elf64_Half e_phnum; - Elf64_Half e_shentsize; - Elf64_Half e_shnum; - Elf64_Half e_shstrndx; -} Elf64_Ehdr; - -/* Program header */ - -typedef struct elf64_phdr { - Elf64_Word p_type; - Elf64_Word p_flags; - Elf64_Off p_offset; - Elf64_Addr p_vaddr; - Elf64_Addr p_paddr; - Elf64_Xword p_filesz; - Elf64_Xword p_memsz; - Elf64_Xword p_align; -} Elf64_Phdr; - - -/* Section header */ - -typedef struct elf64_shdr { - Elf64_Word sh_name; - Elf64_Word sh_type; - Elf64_Xword sh_flags; - Elf64_Addr sh_addr; - Elf64_Off sh_offset; - Elf64_Xword sh_size; - Elf64_Word sh_link; - Elf64_Word sh_info; - Elf64_Xword sh_addralign; - Elf64_Xword sh_entsize; -} Elf64_Shdr; - -/* Note header */ -typedef struct elf64_note { - Elf64_Word n_namesz; /* Name size */ - Elf64_Word n_descsz; /* Content size */ - Elf64_Word n_type; /* Content type */ -} Elf64_Nhdr; - -#endif /* _SYS_ELF64_H */ - diff --git a/klibc/klibc/include/sys/elfcommon.h b/klibc/klibc/include/sys/elfcommon.h deleted file mode 100644 index f984f6a56b..0000000000 --- a/klibc/klibc/include/sys/elfcommon.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * sys/elfcommon.h - */ - -#ifndef _SYS_ELFCOMMON_H -#define _SYS_ELFCOMMON_H - -/* Segment types */ -#define PT_NULL 0 -#define PT_LOAD 1 -#define PT_DYNAMIC 2 -#define PT_INTERP 3 -#define PT_NOTE 4 -#define PT_SHLIB 5 -#define PT_PHDR 6 -#define PT_LOOS 0x60000000 -#define PT_HIOS 0x6fffffff -#define PT_LOPROC 0x70000000 -#define PT_HIPROC 0x7fffffff -#define PT_GNU_EH_FRAME 0x6474e550 /* Extension, eh? */ - -/* ELF file types */ -#define ET_NONE 0 -#define ET_REL 1 -#define ET_EXEC 2 -#define ET_DYN 3 -#define ET_CORE 4 -#define ET_LOPROC 0xff00 -#define ET_HIPROC 0xffff - -/* ELF machine types */ -#define EM_NONE 0 -#define EM_M32 1 -#define EM_SPARC 2 -#define EM_386 3 -#define EM_68K 4 -#define EM_88K 5 -#define EM_486 6 /* Not used in Linux at least */ -#define EM_860 7 -#define EM_MIPS 8 /* R3k, bigendian(?) */ -#define EM_MIPS_RS4_BE 10 /* R4k BE */ -#define EM_PARISC 15 -#define EM_SPARC32PLUS 18 -#define EM_PPC 20 -#define EM_PPC64 21 -#define EM_S390 22 -#define EM_SH 42 -#define EM_SPARCV9 43 /* v9 = SPARC64 */ -#define EM_H8_300H 47 -#define EM_H8S 48 -#define EM_IA_64 50 /* Itanic */ -#define EM_X86_64 62 -#define EM_CRIS 76 -#define EM_V850 87 -#define EM_ALPHA 0x9026 /* Interrim Alpha that stuck around */ -#define EM_CYGNUS_V850 0x9080 /* Old v850 ID used by Cygnus */ -#define EM_S390_OLD 0xA390 /* Obsolete interrim value for S/390 */ - -/* Dynamic type values */ -#define DT_NULL 0 -#define DT_NEEDED 1 -#define DT_PLTRELSZ 2 -#define DT_PLTGOT 3 -#define DT_HASH 4 -#define DT_STRTAB 5 -#define DT_SYMTAB 6 -#define DT_RELA 7 -#define DT_RELASZ 8 -#define DT_RELAENT 9 -#define DT_STRSZ 10 -#define DT_SYMENT 11 -#define DT_INIT 12 -#define DT_FINI 13 -#define DT_SONAME 14 -#define DT_RPATH 15 -#define DT_SYMBOLIC 16 -#define DT_REL 17 -#define DT_RELSZ 18 -#define DT_RELENT 19 -#define DT_PLTREL 20 -#define DT_DEBUG 21 -#define DT_TEXTREL 22 -#define DT_JMPREL 23 -#define DT_LOPROC 0x70000000 -#define DT_HIPROC 0x7fffffff - -/* Auxilliary table entries */ -#define AT_NULL 0 /* end of vector */ -#define AT_IGNORE 1 /* entry should be ignored */ -#define AT_EXECFD 2 /* file descriptor of program */ -#define AT_PHDR 3 /* program headers for program */ -#define AT_PHENT 4 /* size of program header entry */ -#define AT_PHNUM 5 /* number of program headers */ -#define AT_PAGESZ 6 /* system page size */ -#define AT_BASE 7 /* base address of interpreter */ -#define AT_FLAGS 8 /* flags */ -#define AT_ENTRY 9 /* entry point of program */ -#define AT_NOTELF 10 /* program is not ELF */ -#define AT_UID 11 /* real uid */ -#define AT_EUID 12 /* effective uid */ -#define AT_GID 13 /* real gid */ -#define AT_EGID 14 /* effective gid */ -#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ -#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ -#define AT_CLKTCK 17 /* frequency at which times() increments */ -/* 18..22 = ? */ -#define AT_SECURE 23 /* secure mode boolean */ - -/* Program header permission flags */ -#define PF_X 0x1 -#define PF_W 0x2 -#define PF_R 0x4 - -/* Section header types */ -#define SHT_NULL 0 -#define SHT_PROGBITS 1 -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_RELA 4 -#define SHT_HASH 5 -#define SHT_DYNAMIC 6 -#define SHT_NOTE 7 -#define SHT_NOBITS 8 -#define SHT_REL 9 -#define SHT_SHLIB 10 -#define SHT_DYNSYM 11 -#define SHT_NUM 12 -#define SHT_LOPROC 0x70000000 -#define SHT_HIPROC 0x7fffffff -#define SHT_LOUSER 0x80000000 -#define SHT_HIUSER 0xffffffff - -/* Section header flags */ -#define SHF_WRITE 0x1 -#define SHF_ALLOC 0x2 -#define SHF_EXECINSTR 0x4 -#define SHF_MASKPROC 0xf0000000 - -/* Special section numbers */ -#define SHN_UNDEF 0 -#define SHN_LORESERVE 0xff00 -#define SHN_LOPROC 0xff00 -#define SHN_HIPROC 0xff1f -#define SHN_ABS 0xfff1 -#define SHN_COMMON 0xfff2 -#define SHN_HIRESERVE 0xffff - -/* Lenght of magic at the start of a file */ -#define EI_NIDENT 16 - -/* Magic number constants... */ -#define EI_MAG0 0 /* e_ident[] indexes */ -#define EI_MAG1 1 -#define EI_MAG2 2 -#define EI_MAG3 3 -#define EI_CLASS 4 -#define EI_DATA 5 -#define EI_VERSION 6 -#define EI_OSABI 7 -#define EI_PAD 8 - -#define ELFMAG0 0x7f /* EI_MAG */ -#define ELFMAG1 'E' -#define ELFMAG2 'L' -#define ELFMAG3 'F' -#define ELFMAG "\177ELF" -#define SELFMAG 4 - -#define ELFCLASSNONE 0 /* EI_CLASS */ -#define ELFCLASS32 1 -#define ELFCLASS64 2 -#define ELFCLASSNUM 3 - -#define ELFDATANONE 0 /* e_ident[EI_DATA] */ -#define ELFDATA2LSB 1 -#define ELFDATA2MSB 2 - -#define EV_NONE 0 /* e_version, EI_VERSION */ -#define EV_CURRENT 1 -#define EV_NUM 2 - -#define ELFOSABI_NONE 0 -#define ELFOSABI_LINUX 3 - -#endif /* _SYS_ELFCOMMON_H */ - diff --git a/klibc/klibc/include/sys/fsuid.h b/klibc/klibc/include/sys/fsuid.h deleted file mode 100644 index 823486b776..0000000000 --- a/klibc/klibc/include/sys/fsuid.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * sys/fsuid.h - */ - -#ifndef _SYS_FSUID_H -#define _SYS_FSUID_H - -#include -#include - -__extern int setfsuid(uid_t); -__extern int setfsgid(gid_t); - -#endif /* _SYS_FSUID_H */ diff --git a/klibc/klibc/include/sys/ioctl.h b/klibc/klibc/include/sys/ioctl.h deleted file mode 100644 index b0cee4c02c..0000000000 --- a/klibc/klibc/include/sys/ioctl.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * sys/ioctl.h - */ - -#ifndef _SYS_IOCTL_H -#define _SYS_IOCTL_H - -#include -#include -#include - -__extern int ioctl(int, int, void *); - -#endif /* _SYS_IOCTL_H */ diff --git a/klibc/klibc/include/sys/klog.h b/klibc/klibc/include/sys/klog.h deleted file mode 100644 index 0fc5f5d945..0000000000 --- a/klibc/klibc/include/sys/klog.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * sys/klog.h - */ - -#ifndef _SYS_KLOG_H -#define _SYS_KLOG_H - -#include - -#define KLOG_CLOSE 0 -#define KLOG_OPEN 1 -#define KLOG_READ 2 -#define KLOG_READ_ALL 3 -#define KLOG_READ_CLEAR 4 -#define KLOG_CLEAR 5 -#define KLOG_DISABLE 6 -#define KLOG_ENABLE 7 -#define KLOG_SETLEVEL 8 -#define KLOG_UNREADSIZE 9 -#define KLOG_WRITE 10 - -__extern int klogctl(int, char *, int); - -#endif /* _SYS_KLOG_H */ diff --git a/klibc/klibc/include/sys/mman.h b/klibc/klibc/include/sys/mman.h deleted file mode 100644 index 3d8a2f63c2..0000000000 --- a/klibc/klibc/include/sys/mman.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * sys/mman.h - */ - -#ifndef _SYS_MMAN_H -#define _SYS_MMAN_H - -#include -#include -#include -#include /* For PAGE_SIZE */ - -#define MAP_FAILED ((void *)-1) - -__extern void *mmap(void *, size_t, int, int, int, off_t); -__extern int munmap(void *, size_t); -__extern void *mremap(void *, size_t, size_t, unsigned long); -__extern int msync(const void *, size_t, int); -__extern int mprotect(const void *, size_t, int); - -#endif /* _SYS_MMAN_H */ diff --git a/klibc/klibc/include/sys/mount.h b/klibc/klibc/include/sys/mount.h deleted file mode 100644 index 313c90ec0e..0000000000 --- a/klibc/klibc/include/sys/mount.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * sys/mount.h - */ - -#ifndef _SYS_MOUNT_H -#define _SYS_MOUNT_H - -#include - -/* - * These are the fs-independent mount-flags: up to 32 flags are supported - */ -#define MS_RDONLY 1 /* Mount read-only */ -#define MS_NOSUID 2 /* Ignore suid and sgid bits */ -#define MS_NODEV 4 /* Disallow access to device special files */ -#define MS_NOEXEC 8 /* Disallow program execution */ -#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ -#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ -#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ -#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ -#define MS_NOATIME 1024 /* Do not update access times. */ -#define MS_NODIRATIME 2048 /* Do not update directory access times */ -#define MS_BIND 4096 -#define MS_MOVE 8192 -#define MS_REC 16384 -#define MS_VERBOSE 32768 -#define MS_NOUSER (1<<31) - -/* - * Superblock flags that can be altered by MS_REMOUNT - */ -#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|MS_NODIRATIME) - -/* - * Old magic mount flag and mask - */ -#define MS_MGC_VAL 0xC0ED0000 -#define MS_MGC_MSK 0xffff0000 - -/* - * umount2() flags - */ -#define MNT_FORCE 1 - -/* - * Prototypes - */ -__extern int mount(const char *, const char *, - const char *, unsigned long, - const void *); -__extern int umount(const char *); -__extern int umount2(const char *, int); -__extern int pivot_root(const char *, const char *); - -#endif /* _SYS_MOUNT_H */ diff --git a/klibc/klibc/include/sys/param.h b/klibc/klibc/include/sys/param.h deleted file mode 100644 index 63a0661f43..0000000000 --- a/klibc/klibc/include/sys/param.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * sys/param.h - */ - -#ifndef _SYS_PARAM_H -#define _SYS_PARAM_H - -#include -#include - -#endif /* _SYS_PARAM_H */ diff --git a/klibc/klibc/include/sys/reboot.h b/klibc/klibc/include/sys/reboot.h deleted file mode 100644 index eaf56610d7..0000000000 --- a/klibc/klibc/include/sys/reboot.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * sys/reboot.h - */ - -#ifndef _SYS_REBOOT_H -#define _SYS_REBOOT_H - -#include -#include - -/* glibc names these constants differently; allow both versions */ - -#define RB_AUTOBOOT LINUX_REBOOT_CMD_RESTART -#define RB_HALT_SYSTEM LINUX_REBOOT_CMD_HALT -#define RB_ENABLE_CAD LINUX_REBOOT_CMD_CAD_ON -#define RB_DISABLE_CAD LINUX_REBOOT_CMD_CAD_OFF -#define RB_POWER_OFF LINUX_REBOOT_CMD_POWER_OFF - -/* glibc-ish one-argument version */ -__extern int reboot(int); - -/* Native four-argument system call */ -__extern int __reboot(int, int, int, void *); - -#endif /* _SYS_REBOOT_H */ diff --git a/klibc/klibc/include/sys/resource.h b/klibc/klibc/include/sys/resource.h deleted file mode 100644 index ef14bde9f6..0000000000 --- a/klibc/klibc/include/sys/resource.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * sys/resource.h - */ - -#ifndef _SYS_RESOURCE_H -#define _SYS_RESOURCE_H - -#include -#include /* MUST be included before linux/resource.h */ -#include - -__extern int getpriority(int, int); -__extern int setpriority(int, int, int); - -#endif /* _SYS_RESOURCE_H */ diff --git a/klibc/klibc/include/sys/select.h b/klibc/klibc/include/sys/select.h deleted file mode 100644 index 7caf8c931b..0000000000 --- a/klibc/klibc/include/sys/select.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * sys/select.h - */ - -#ifndef _SYS_SELECT_H -#define _SYS_SELECT_H - -#include -#include - -__extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); - -#endif /* _SYS_SELECT_H */ diff --git a/klibc/klibc/include/sys/socket.h b/klibc/klibc/include/sys/socket.h deleted file mode 100644 index cbc2b89591..0000000000 --- a/klibc/klibc/include/sys/socket.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * sys/socket.h - */ - -#ifndef _SYS_SOCKET_H -#define _SYS_SOCKET_H - -#include -#include -#include - -/* For some reason these may be protected by __KERNEL__ in asm/socket.h */ -#ifndef SOCK_STREAM -# define SOCK_STREAM 1 -# define SOCK_DGRAM 2 -# define SOCK_RAW 3 -# define SOCK_RDM 4 -# define SOCK_SEQPACKET 5 -# define SOCK_PACKET 10 -#endif - -#ifdef __i386__ -# define __socketcall __extern __cdecl -#else -# define __socketcall __extern -#endif - -typedef int socklen_t; - -__socketcall int socket(int, int, int); -__socketcall int bind(int, struct sockaddr *, int); -__socketcall int connect(int, struct sockaddr *, socklen_t); -__socketcall int listen(int, int); -__socketcall int accept(int, struct sockaddr *, socklen_t *); -__socketcall int getsockname(int, struct sockaddr *, socklen_t *); -__socketcall int getpeername(int, struct sockaddr *, socklen_t *); -__socketcall int socketpair(int, int, int, int *); -__extern int send(int, const void *, size_t, unsigned int); -__socketcall int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); -__extern int recv(int, void *, size_t, unsigned int); -__socketcall int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *); -__socketcall int shutdown(int, int); -__socketcall int setsockopt(int, int, int, const void *, socklen_t); -__socketcall int getsockopt(int, int, int, void *, socklen_t *); -__socketcall int sendmsg(int, const struct msghdr *, unsigned int); -__socketcall int recvmsg(int, struct msghdr *, unsigned int); - -#undef __socketcall - -#endif /* _SYS_SOCKET_H */ diff --git a/klibc/klibc/include/sys/socketcalls.h b/klibc/klibc/include/sys/socketcalls.h deleted file mode 100644 index dac9f9aab6..0000000000 --- a/klibc/klibc/include/sys/socketcalls.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * sys/socketcalls.h - */ - -#ifndef _SYS_SOCKETCALLS_H -#define _SYS_SOCKETCALLS_H - -/* socketcalls by number, since isn't usable for assembly */ - -#define SYS_SOCKET 1 /* sys_socket(2) */ -#define SYS_BIND 2 /* sys_bind(2) */ -#define SYS_CONNECT 3 /* sys_connect(2) */ -#define SYS_LISTEN 4 /* sys_listen(2) */ -#define SYS_ACCEPT 5 /* sys_accept(2) */ -#define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */ -#define SYS_GETPEERNAME 7 /* sys_getpeername(2) */ -#define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */ -#define SYS_SEND 9 /* sys_send(2) */ -#define SYS_RECV 10 /* sys_recv(2) */ -#define SYS_SENDTO 11 /* sys_sendto(2) */ -#define SYS_RECVFROM 12 /* sys_recvfrom(2) */ -#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ -#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ -#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ -#define SYS_SENDMSG 16 /* sys_sendmsg(2) */ -#define SYS_RECVMSG 17 /* sys_recvmsg(2) */ - -#endif /* _SYS_SOCKETCALLS_H */ diff --git a/klibc/klibc/include/sys/stat.h b/klibc/klibc/include/sys/stat.h deleted file mode 100644 index f7bb5aacc5..0000000000 --- a/klibc/klibc/include/sys/stat.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * sys/stat.h - */ - -#ifndef _SYS_STAT_H -#define _SYS_STAT_H - -#include -#include -#include -#include - -__extern int stat(const char *, struct stat *); -__extern int fstat(int, struct stat *); -__extern int lstat(const char *, struct stat *); -__extern mode_t umask(mode_t); -__extern int mknod(const char *, mode_t, dev_t); -static __inline__ int mkfifo(const char *__p, mode_t __m) -{ - return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0); -} - -#endif /* _SYS_STAT_H */ diff --git a/klibc/klibc/include/sys/syscall.h b/klibc/klibc/include/sys/syscall.h deleted file mode 100644 index 907c7f9b9a..0000000000 --- a/klibc/klibc/include/sys/syscall.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * sys/syscall.h - * - * Generic system call interface macros - */ -#ifndef _SYS_SYSCALL_H -#define _SYS_SYSCALL_H - -#include -#include - -/* Many architectures have incomplete or defective syscall macros */ -#include - -#endif /* _SYS_SYSCALL_H */ diff --git a/klibc/klibc/include/sys/sysinfo.h b/klibc/klibc/include/sys/sysinfo.h deleted file mode 100644 index 4051c6897a..0000000000 --- a/klibc/klibc/include/sys/sysinfo.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * sys/sysinfo.h - */ - -#ifndef _SYS_SYSINFO_H -#define _SYS_SYSINFO_H - -#include - -extern int sysinfo (struct sysinfo *info); - -#endif /* _SYS_SYSINFO_H */ diff --git a/klibc/klibc/include/sys/sysmacros.h b/klibc/klibc/include/sys/sysmacros.h deleted file mode 100644 index 7f1e0822b3..0000000000 --- a/klibc/klibc/include/sys/sysmacros.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * sys/sysmacros.h - * - * Constructs to create and pick apart dev_t. This applies to the Linux 2.6 - * 32-bit dev_t format. - */ - -#ifndef _SYS_SYSMACROS_H -#define _SYS_SYSMACROS_H - -#ifndef _SYS_TYPES_H -# include -#endif - -static __inline__ int major(dev_t __d) -{ - return (__d >> 8) & 0xfff; -} - -static __inline__ int minor(dev_t __d) -{ - return (__d & 0xff) | ((__d >> 12) & 0xfff00); -} - -static __inline__ dev_t makedev(int __ma, int __mi) -{ - return ((__ma & 0xfff) << 8) | (__mi & 0xff) | ((__mi & 0xfff00) << 12); -} - -#endif /* _SYS_SYSMACROS_H */ - diff --git a/klibc/klibc/include/sys/time.h b/klibc/klibc/include/sys/time.h deleted file mode 100644 index b503d21076..0000000000 --- a/klibc/klibc/include/sys/time.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * sys/time.h - */ - -#ifndef _SYS_TIME_H -#define _SYS_TIME_H - -#include -#include -#include - -__extern int gettimeofday(struct timeval *, struct timezone *); -__extern int settimeofday(const struct timeval *, const struct timezone *); -__extern int getitimer(int, struct itimerval *); -__extern int setitimer(int, const struct itimerval *, struct itimerval *); - -#endif /* _SYS_TIME_H */ diff --git a/klibc/klibc/include/sys/types.h b/klibc/klibc/include/sys/types.h deleted file mode 100644 index 0aaeeb1612..0000000000 --- a/klibc/klibc/include/sys/types.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * sys/types.h - */ - -#ifndef _SYS_TYPES_H -#define _SYS_TYPES_H - -#include -#include - -#define _SSIZE_T -typedef ptrdiff_t ssize_t; - -#include -#include - -/* Keeps linux/types.h from getting included elsewhere */ -#define _LINUX_TYPES_H - -typedef __kernel_fd_set fd_set; -typedef uint32_t dev_t; -typedef __kernel_ino_t ino_t; -typedef __kernel_mode_t mode_t; -typedef __kernel_nlink_t nlink_t; -typedef __kernel_off_t off_t; /* Should become __kernel_loff_t... */ -typedef __kernel_pid_t pid_t; -typedef __kernel_daddr_t daddr_t; -typedef __kernel_key_t key_t; -typedef __kernel_suseconds_t suseconds_t; -typedef __kernel_timer_t timer_t; - -typedef __kernel_uid32_t uid_t; -typedef __kernel_gid32_t gid_t; - -typedef __kernel_loff_t loff_t; - -/* - * The following typedefs are also protected by individual ifdefs for - * historical reasons: - */ -#ifndef _SIZE_T -#define _SIZE_T -typedef __kernel_size_t size_t; -#endif - -#ifndef _SSIZE_T -#define _SSIZE_T -typedef __kernel_ssize_t ssize_t; -#endif - -#ifndef _PTRDIFF_T -#define _PTRDIFF_T -typedef __kernel_ptrdiff_t ptrdiff_t; -#endif - -#ifndef _TIME_T -#define _TIME_T -typedef __kernel_time_t time_t; -#endif - -#ifndef _CLOCK_T -#define _CLOCK_T -typedef __kernel_clock_t clock_t; -#endif - -#ifndef _CADDR_T -#define _CADDR_T -typedef __kernel_caddr_t caddr_t; -#endif - -/* bsd */ -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; - -/* sysv */ -typedef unsigned char unchar; -typedef unsigned short ushort; -typedef unsigned int uint; -typedef unsigned long ulong; - -/* Linux-specific? */ -typedef uint8_t u_int8_t; -typedef uint16_t u_int16_t; -typedef uint32_t u_int32_t; -typedef uint64_t u_int64_t; - -/* - * transition to 64-bit sector_t, possibly making it an option... - */ -#undef BLK_64BIT_SECTOR - -#ifdef BLK_64BIT_SECTOR -typedef u64 sector_t; -#else -typedef unsigned long sector_t; -#endif - -/* - * The type of an index into the pagecache. Use a #define so asm/types.h - * can override it. - */ -#ifndef pgoff_t -#define pgoff_t unsigned long -#endif - -/* - * Below are truly Linux-specific types that should never collide with - * any application/library that wants linux/types.h. - */ - -struct ustat { - __kernel_daddr_t f_tfree; - __kernel_ino_t f_tinode; - char f_fname[6]; - char f_fpack[6]; -}; - -/* - * Some apps want this in - */ -#include - -#endif diff --git a/klibc/klibc/include/sys/uio.h b/klibc/klibc/include/sys/uio.h deleted file mode 100644 index fc2525d11a..0000000000 --- a/klibc/klibc/include/sys/uio.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * sys/uio.h - */ - -#ifndef _SYS_UIO_H -#define _SYS_UIO_H - -#include -#include -#include - -__extern int readv(int, const struct iovec *, int); -__extern int writev(int, const struct iovec *, int); - -#endif /* _SYS_UIO_H */ diff --git a/klibc/klibc/include/sys/un.h b/klibc/klibc/include/sys/un.h deleted file mode 100644 index df42d719f7..0000000000 --- a/klibc/klibc/include/sys/un.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * - */ - -#ifndef _SYS_UN_H -#define _SYS_UN_H - -#include - -#endif /* _SYS_UN_H */ diff --git a/klibc/klibc/include/sys/utime.h b/klibc/klibc/include/sys/utime.h deleted file mode 100644 index d1d635d242..0000000000 --- a/klibc/klibc/include/sys/utime.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * sys/utime.h - */ - -#ifndef _SYS_UTIME_H -#define _SYS_UTIME_H - -#include - -#endif /* _SYS_UTIME_H */ diff --git a/klibc/klibc/include/sys/utsname.h b/klibc/klibc/include/sys/utsname.h deleted file mode 100644 index f2990f5711..0000000000 --- a/klibc/klibc/include/sys/utsname.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * sys/utsname.h - */ - -#ifndef _SYS_UTSNAME_H -#define _SYS_UTSNAME_H - -#include - -#define SYS_NMLN 65 - -struct utsname { - char sysname[SYS_NMLN]; - char nodename[SYS_NMLN]; - char release[SYS_NMLN]; - char version[SYS_NMLN]; - char machine[SYS_NMLN]; - char domainname[SYS_NMLN]; -}; - -__extern int uname(struct utsname *); - -#endif /* _SYS_UTSNAME_H */ diff --git a/klibc/klibc/include/sys/vfs.h b/klibc/klibc/include/sys/vfs.h deleted file mode 100644 index 8c1577c4bf..0000000000 --- a/klibc/klibc/include/sys/vfs.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * sys/vfs.h - */ - -#ifndef _SYS_VFS_H -#define _SYS_VFS_H - -#include -#include - -__extern int statfs(const char *, struct statfs *); -__extern int fstatfs(int, struct statfs *); - -#endif /* _SYS_VFS_H */ diff --git a/klibc/klibc/include/sys/wait.h b/klibc/klibc/include/sys/wait.h deleted file mode 100644 index 4cfafc9408..0000000000 --- a/klibc/klibc/include/sys/wait.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * sys/wait.h - */ - -#ifndef _SYS_WAIT_H -#define _SYS_WAIT_H - -#include -#include -#include - -#include - -#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) -#define WTERMSIG(s) ((s) & 0x7f) -#define WIFEXITED(s) (WTERMSIG(s) == 0) -#define WIFSTOPPED(s) (WTERMSIG(s) == 0x7f) -/* Ugly hack to avoid multiple evaluation of "s" */ -#define WIFSIGNALED(s) (WTERMSIG((s)+1) >= 2) -#define WCOREDUMP(s) ((s) & 0x80) -#define WSTOPSIG(s) WEXITSTATUS(s) - -__extern pid_t wait(int *); -__extern pid_t waitpid(pid_t, int *, int); -__extern pid_t wait3(int *, int, struct rusage *); -__extern pid_t wait4(pid_t, int *, int, struct rusage *); - -#endif /* _SYS_WAIT_H */ diff --git a/klibc/klibc/include/syslog.h b/klibc/klibc/include/syslog.h deleted file mode 100644 index 551527a042..0000000000 --- a/klibc/klibc/include/syslog.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * syslog.h - */ - -#ifndef _SYSLOG_H -#define _SYSLOG_H - -#include -#include - -/* Alert levels */ -#define LOG_EMERG 0 -#define LOG_ALERT 1 -#define LOG_CRIT 2 -#define LOG_ERR 3 -#define LOG_WARNING 4 -#define LOG_NOTICE 5 -#define LOG_INFO 6 -#define LOG_DEBUG 7 - -#define LOG_PRIMASK 7 -#define LOG_PRI(x) ((x) & LOG_PRIMASK) - - -/* Facilities; not actually used */ -#define LOG_KERN 0000 -#define LOG_USER 0010 -#define LOG_MAIL 0020 -#define LOG_DAEMON 0030 -#define LOG_AUTH 0040 -#define LOG_SYSLOG 0050 -#define LOG_LPR 0060 -#define LOG_NEWS 0070 -#define LOG_UUCP 0100 -#define LOG_CRON 0110 -#define LOG_AUTHPRIV 0120 -#define LOG_FTP 0130 -#define LOG_LOCAL0 0200 -#define LOG_LOCAL1 0210 -#define LOG_LOCAL2 0220 -#define LOG_LOCAL3 0230 -#define LOG_LOCAL4 0240 -#define LOG_LOCAL5 0250 -#define LOG_LOCAL6 0260 -#define LOG_LOCAL7 0270 - -#define LOG_FACMASK 01770 -#define LOG_FAC(x) (((x) >> 3) & (LOG_FACMASK >> 3)) - -__extern void openlog(const char *, int, int); -__extern void syslog(int, const char *, ...); -__extern void vsyslog(int, const char *, va_list); -__extern void closelog(void); - -#endif /* _SYSLOG_H */ diff --git a/klibc/klibc/include/termios.h b/klibc/klibc/include/termios.h deleted file mode 100644 index 08a5e56855..0000000000 --- a/klibc/klibc/include/termios.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * termios.h - */ - -#ifndef _TERMIOS_H -#define _TERMIOS_H - -#include -#include -#include -#include -#include - -/* Redefine these so the magic constants == the ioctl number to use. */ -#undef TCSANOW -#undef TCSADRAIN -#undef TCSAFLUSH -#define TCSANOW TCSETS -#define TCSADRAIN TCSETSW -#define TCSAFLUSH TCSETSF - -static __inline__ int tcgetattr(int __fd, struct termios *__s) -{ - return ioctl(__fd, TCGETS, __s); -} - -static __inline__ int tcsetattr(int __fd, int __opt, const struct termios *__s) -{ - return ioctl(__fd, __opt, (void *)__s); -} - -static __inline__ int tcflow(int __fd, int __action) -{ - return ioctl(__fd, TCXONC, (void *)(intptr_t)__action); -} - -static __inline__ int tcflush(int __fd, int __queue) -{ - return ioctl(__fd, TCFLSH, (void *)(intptr_t)__queue); -} - -static __inline__ pid_t tcgetpgrp(int __fd) -{ - pid_t __p; - return ioctl(__fd, TIOCGPGRP, &__p) ? (pid_t)-1 : __p; -} - -static __inline__ pid_t tcgetsid(int __fd) -{ - pid_t __p; - return ioctl(__fd, TIOCGSID, &__p) ? (pid_t)-1 : __p; -} - -static __inline__ int tcsendbreak(int __fd, int __duration) -{ - return ioctl(__fd, TCSBRKP, (void *)(uintptr_t)__duration); -} - -static __inline__ int tcsetpgrp(int __fd, pid_t __p) -{ - return ioctl(__fd, TIOCSPGRP, &__p); -} - -static __inline__ speed_t cfgetospeed(const struct termios *__s) -{ - return (speed_t)(__s->c_cflag & CBAUD); -} - -static __inline__ speed_t cfgetispeed(const struct termios *__s) -{ - return (speed_t)(__s->c_cflag & CBAUD); -} - -static __inline__ int cfsetospeed(struct termios *__s, speed_t __v) -{ - __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); - return 0; -} - -static __inline__ int cfsetispeed(struct termios *__s, speed_t __v) -{ - __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); - return 0; -} - -#endif /* _TERMIOS_H */ diff --git a/klibc/klibc/include/time.h b/klibc/klibc/include/time.h deleted file mode 100644 index c69c231ec8..0000000000 --- a/klibc/klibc/include/time.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * time.h - */ - -#ifndef _TIME_H -#define _TIME_H - -#include -#include - -__extern time_t time(time_t *); -__extern int nanosleep(const struct timespec *, struct timespec *); - -#endif /* _TIME_H */ diff --git a/klibc/klibc/include/unistd.h b/klibc/klibc/include/unistd.h deleted file mode 100644 index 13ff03b012..0000000000 --- a/klibc/klibc/include/unistd.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * unistd.h - */ - -#ifndef _UNISTD_H -#define _UNISTD_H - -#include -#include -#include -#include -#include - -__extern char **environ; -__extern __noreturn _exit(int); - -__extern pid_t fork(void); -__extern pid_t vfork(void); -__extern pid_t getpid(void); -__extern pid_t getpgid(pid_t); -__extern int setpgid(pid_t, pid_t); -__extern pid_t getppid(void); -__extern pid_t getpgrp(void); -__extern int setpgrp(void); -__extern pid_t setsid(void); -__extern pid_t getsid(pid_t); -__extern int execv(const char *, char * const *); -__extern int execvp(const char *, char * const *); -__extern int execve(const char *, char * const *, char * const *); -__extern int execvpe(const char *, char * const *, char * const *); -__extern int execl(const char *, const char *, ...); -__extern int execlp(const char *, const char *, ...); -__extern int execle(const char *, const char *, ...); -__extern int execlpe(const char *, const char *, ...); - -__extern int setuid(uid_t); -__extern uid_t getuid(void); -__extern int seteuid(uid_t); -__extern uid_t geteuid(void); -__extern int setgid(gid_t); -__extern gid_t getgid(void); -__extern int setegid(gid_t); -__extern gid_t getegid(void); -__extern int getgroups(int, gid_t *); -__extern int setgroups(size_t, const gid_t *); -__extern int setreuid(uid_t, uid_t); -__extern int setregid(gid_t, gid_t); -__extern int setresuid(uid_t, uid_t, uid_t); -__extern int setresgid(gid_t, gid_t, gid_t); -__extern int getfsuid(uid_t); -__extern int setfsuid(uid_t); - -/* Macros for access() */ -#define R_OK 4 /* Read */ -#define W_OK 2 /* Write */ -#define X_OK 1 /* Execute */ -#define F_OK 0 /* Existence */ - -__extern int access(const char *, int); -__extern int link(const char *, const char *); -__extern int unlink(const char *); -__extern int chdir(const char *); -__extern int chmod(const char *, mode_t); -__extern int fchmod(int, mode_t); -__extern int mkdir(const char *, mode_t); -__extern int rmdir(const char *); -__extern int pipe(int *); -__extern int chroot(const char *); -__extern int symlink(const char *, const char *); -__extern int readlink(const char *, char *, size_t); -__extern int chown(const char *, uid_t, gid_t); -__extern int fchown(int, uid_t, gid_t); -__extern int lchown(const char *, uid_t, gid_t); -__extern char *getcwd(char *, size_t); - -__extern int sync(void); - -__extern ssize_t read(int, void *, size_t); -__extern ssize_t write(int, const void *, size_t); -#ifndef __IN_OPEN_C -__extern __cdecl int open(const char *, int, ...); -#endif -__extern int close(int); -__extern off_t lseek(int, off_t, int); -__extern loff_t llseek(int, loff_t, int); -__extern int dup(int); -__extern int dup2(int, int); -__extern int fcntl(int, int, long); -__extern int ioctl(int, int, void *); -__extern int flock(int, int); -__extern int fsync(int); -__extern int fdatasync(int); -__extern int ftruncate(int, off_t); - -__extern int pause(void); -__extern unsigned int alarm(unsigned int); -__extern unsigned int sleep(unsigned int); -__extern void usleep(unsigned long); - -__extern int gethostname(char *, size_t); -__extern int sethostname(const char *, size_t); -__extern int getdomainname(char *, size_t); -__extern int setdomainname(const char *, size_t); - -__extern void *__brk(void *); -__extern int brk(void *); -__extern void *sbrk(ptrdiff_t); - -__extern int getopt(int, char * const *, const char *); -__extern char *optarg; -__extern int optind, opterr, optopt; - -__extern int isatty(int); - -__extern int getpagesize(void); - -/* Standard file descriptor numbers. */ -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -#endif /* _UNISTD_H */ diff --git a/klibc/klibc/include/utime.h b/klibc/klibc/include/utime.h deleted file mode 100644 index 3dfa03a14a..0000000000 --- a/klibc/klibc/include/utime.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * utime.h - */ - -#ifndef _UTIME_H -#define _UTIME_H - -#include -#include -#include - -__extern int utime(const char *, const struct utimbuf *); - -#endif /* _UTIME_H */ - diff --git a/klibc/klibc/inet/bindresvport.c b/klibc/klibc/inet/bindresvport.c index c30054edfd..750bd709c4 100644 --- a/klibc/klibc/inet/bindresvport.c +++ b/klibc/klibc/inet/bindresvport.c @@ -9,8 +9,8 @@ #include #include -#define START_PORT 600 -#define END_PORT (IPPORT_RESERVED - 1) +#define START_PORT 768 +#define END_PORT IPPORT_RESERVED #define NUM_PORTS (END_PORT - START_PORT) int bindresvport(int sd, struct sockaddr_in *sin) @@ -21,14 +21,12 @@ int bindresvport(int sd, struct sockaddr_in *sin) int i; if (sin == NULL) { + memset(&me, 0, sizeof(me)); sin = &me; - memset(sin, 0, sizeof(me)); - sin->sin_port = AF_INET; - } - else if (sin->sin_family != AF_INET) { + sin->sin_family = AF_INET; + } else if (sin->sin_family != AF_INET) { errno = EPFNOSUPPORT; - ret = -1; - goto bail; + return -1; } if (port == 0) { @@ -36,13 +34,12 @@ int bindresvport(int sd, struct sockaddr_in *sin) } for (i = 0; i < NUM_PORTS; i++, port++) { - sin->sin_port = htons(port); - if ((ret = bind(sd, (struct sockaddr *)&sin, sizeof(*sin))) != -1) - break; if (port == END_PORT) port = START_PORT; + sin->sin_port = htons(port); + if ((ret = bind(sd, (struct sockaddr *)sin, sizeof(*sin))) != -1) + break; } - bail: return ret; } diff --git a/klibc/klibc/interp.S b/klibc/klibc/interp.S index 303943697b..b1a2701999 100644 --- a/klibc/klibc/interp.S +++ b/klibc/klibc/interp.S @@ -2,7 +2,9 @@ # This is a hack to generate the .intrp section, which then # ld turns into an PT_INTERP header. # - +# NOTE: The .interp section needs to be "a", or it doesnt work... +# + .section ".interp","a" .ascii LIBDIR .ascii "/klibc-" diff --git a/klibc/klibc/jrand48.c b/klibc/klibc/jrand48.c new file mode 100644 index 0000000000..a2ead11e5f --- /dev/null +++ b/klibc/klibc/jrand48.c @@ -0,0 +1,24 @@ +/* + * jrand48.c + */ + +#include +#include + +long jrand48(unsigned short xsubi[3]) +{ + uint64_t x; + + /* The xsubi[] array is littleendian by spec */ + x = (uint64_t)xsubi[0] + + ((uint64_t)xsubi[1] << 16) + + ((uint64_t)xsubi[2] << 32); + + x = (0x5deece66dULL * x) + 0xb; + + xsubi[0] = (unsigned short)x; + xsubi[1] = (unsigned short)(x >> 16); + xsubi[2] = (unsigned short)(x >> 32); + + return (long)(int32_t)(x >> 16); +} diff --git a/klibc/klibc/libc_init.c b/klibc/klibc/libc_init.c new file mode 100644 index 0000000000..e91edc44a3 --- /dev/null +++ b/klibc/klibc/libc_init.c @@ -0,0 +1,86 @@ +/* + * libc_init.c + * + * This function takes the raw data block set up by the ELF loader + * in the kernel and parses it. It is invoked by crt0.S which makes + * any necessary adjustments and passes calls this function using + * the standard C calling convention. + * + * The arguments are: + * uintptr_t *elfdata -- The ELF loader data block; usually from the stack. + * Basically a pointer to argc. + * void (*onexit)(void) -- Function to install into onexit + */ + +#include +#include +#include +#include +#include + +/* This file is included from __static_init.c or __shared_init.c */ +#ifndef SHARED +# error "SHARED should be defined to 0 or 1" +#endif + +char **environ; +unsigned int __page_size, __page_shift; + +struct auxentry { + uintptr_t type; + uintptr_t v; +}; + +__noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void)) +{ + int argc; + char **argv, **envp, **envend; + struct auxentry *auxentry; +#if SHARED + typedef int (*main_t)(int, char **, char **); + main_t MAIN = NULL; +#else + extern int main(int, char **, char **); +#define MAIN main +#endif + unsigned int page_size = 0, page_shift = 0; + + (void)onexit; /* For now, we ignore this... */ + + argc = (int)*elfdata++; + argv = (char **)elfdata; + envp = argv+(argc+1); + + /* The auxillary entry vector is after all the environment vars */ + for ( envend = envp ; *envend ; envend++ ); + auxentry = (struct auxentry *)(envend+1); + + while ( auxentry->type ) { + switch ( auxentry->type ) { +#if SHARED + case AT_ENTRY: + MAIN = (main_t)(auxentry->v); + break; +#endif + case AT_PAGESZ: + page_size = (int)(auxentry->v); + break; + } + auxentry++; + } + + __page_size = page_size; + +#if defined(__i386__) || defined(__x86_64__) + asm("bsrl %1,%0" : "=r" (page_shift) : "rm" (page_size)); +#else + while ( page_size > 1 ) { + page_shift++; + page_size >>= 1; + } +#endif + __page_shift = page_shift; + + environ = envp; + exit(MAIN(argc, argv, envp)); +} diff --git a/klibc/klibc/llseek.c b/klibc/klibc/llseek.c index fdffc16e2c..2102a503e9 100644 --- a/klibc/klibc/llseek.c +++ b/klibc/klibc/llseek.c @@ -1,8 +1,10 @@ /* * llseek.c * - * On 32-bit platforms, we need llseek() as well as lseek() to be - * able to handle large disks + * On 32-bit platforms, we need to use the _llseek() system call + * rather than lseek(), to be able to handle large disks. _llseek() + * isn't just a normal syscall which takes a 64-bit argument; it needs + * to return a 64-bit value and so takes an extra pointer. */ #include @@ -10,24 +12,17 @@ #if BITSIZE == 32 -static inline _syscall5(int, _llseek, int, fd, unsigned long, hi, unsigned long, lo, loff_t *,res, int, whence); +extern int __llseek(int fd, unsigned long hi, unsigned long lo, off_t *res, int whence); -loff_t llseek(int fd, loff_t offset, int whence) +off_t lseek(int fd, off_t offset, int whence) { - loff_t result; + off_t result; int rv; - rv = _llseek(fd, (unsigned long)(offset >> 32), - (unsigned long)offset, &result, whence); + rv = __llseek(fd, (unsigned long)(offset >> 32), (unsigned long)offset, + &result, whence); - return rv ? (loff_t)-1 : result; -} - -#else - -loff_t llseek(int fd, loff_t offset, int whence) -{ - return lseek(fd, offset, whence); + return rv ? (off_t)-1 : result; } #endif diff --git a/klibc/klibc/lrand48.c b/klibc/klibc/lrand48.c index 4d05de2e89..8c0a3de176 100644 --- a/klibc/klibc/lrand48.c +++ b/klibc/klibc/lrand48.c @@ -5,38 +5,10 @@ #include #include -unsigned short __rand48_seed[3]; - -long jrand48(unsigned short xsubi[3]) -{ - uint64_t x; - - /* The xsubi[] array is littleendian by spec */ - x = (uint64_t)xsubi[0] + - ((uint64_t)xsubi[1] << 16) + - ((uint64_t)xsubi[2] << 32); - - x = (0x5deece66dULL * x) + 0xb; - - xsubi[0] = (unsigned short)x; - xsubi[1] = (unsigned short)(x >> 16); - xsubi[2] = (unsigned short)(x >> 32); - - return (long)(int32_t)(x >> 16); -} - -long mrand48(void) -{ - return jrand48(__rand48_seed); -} - -long nrand48(unsigned short xsubi[3]) -{ - return (long)((uint32_t)jrand48(xsubi) >> 1); -} +unsigned short __rand48_seed[3]; /* Common with mrand48.c, srand48.c */ long lrand48(void) { - return (long)((uint32_t)(mrand48() >> 1)); + return (uint32_t)jrand48(__rand48_seed) >> 1; } diff --git a/klibc/klibc/makeerrlist.pl b/klibc/klibc/makeerrlist.pl index 00acb8a3d5..f42704f88a 100644 --- a/klibc/klibc/makeerrlist.pl +++ b/klibc/klibc/makeerrlist.pl @@ -20,7 +20,7 @@ sub parse_file($) { $file = $rootdir.$file; - print STDERR "opening $file\n"; + print STDERR "opening $file\n" unless ( $quiet ); if ( !($fh->open("< ".$file)) ) { die "$0: cannot open $file\n"; @@ -38,7 +38,7 @@ sub parse_file($) { $error = $1; $errno = $2+0; $msg = $3; - print STDERR "$error ($errno) => \"$msg\"\n"; + print STDERR "$error ($errno) => \"$msg\"\n" unless ( $quiet ); $errors{$errno} = $error; $errmsg{$errno} = $msg; $maxerr = $errno if ( $errno > $maxerr ); @@ -50,12 +50,23 @@ sub parse_file($) { } } close($fh); - print STDERR "closing $file\n"; + print STDERR "closing $file\n" unless ( $quiet ); } -parse_file('linux/errno.h'); +$v = $ENV{'KBUILD_VERBOSE'}; +$quiet = defined($v) ? !$v : 0; -($type) = @ARGV; +foreach $arg ( @ARGV ) { + if ( $arg eq '-q' ) { + $quiet = 1; + } elsif ( $arg =~ /^-(errlist|errnos|maxerr)$/ ) { + $type = $arg; + } else { + die "$0: Unknown option: $arg\n"; + } +} + +parse_file('linux/errno.h'); if ( $type eq '-errlist' ) { print "#include \n"; diff --git a/klibc/klibc/malloc.c b/klibc/klibc/malloc.c index 20a2350d71..976353c201 100644 --- a/klibc/klibc/malloc.c +++ b/klibc/klibc/malloc.c @@ -133,9 +133,14 @@ void *malloc(size_t size) } /* Nothing found... need to request a block from the kernel */ - fsize = (size+MALLOC_CHUNK_MASK) & ~MALLOC_CHUNK_MASK; + fsize = (size+MALLOC_CHUNK_MASK) & ~MALLOC_CHUNK_MASK; + +#ifdef MALLOC_USING_SBRK + fp = (struct free_arena_header *) sbrk(fsize); +#else fp = (struct free_arena_header *) mmap(NULL, fsize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); +#endif if ( fp == (struct free_arena_header *)MAP_FAILED ) { return NULL; /* Failed to get a block */ diff --git a/klibc/klibc/malloc.h b/klibc/klibc/malloc.h index e053f71401..456295069a 100644 --- a/klibc/klibc/malloc.h +++ b/klibc/klibc/malloc.h @@ -6,13 +6,7 @@ #include #include - -/* - * This is the minimum chunk size we will ask the kernel for; this should - * be a multiple of the page size on all architectures. - */ -#define MALLOC_CHUNK_SIZE 65536 -#define MALLOC_CHUNK_MASK (MALLOC_CHUNK_SIZE-1) +#include /* * This structure should be a power of two. This becomes the diff --git a/klibc/klibc/mmap.c b/klibc/klibc/mmap.c index 89cf3a6a8f..196f1c088f 100644 --- a/klibc/klibc/mmap.c +++ b/klibc/klibc/mmap.c @@ -6,46 +6,44 @@ #include #include #include +#include #include /* For PAGE_SHIFT */ #if defined(__sparc__) # define MMAP2_SHIFT 12 /* Fixed by syscall definition */ +#elif defined(__mips__) || defined(__powerpc__) +# define MMAP2_SHIFT __getpageshift() /* Variable */ #else # define MMAP2_SHIFT PAGE_SHIFT #endif -#define MMAP2_MASK ((1UL << MMAP2_SHIFT)-1) /* - * Prefer mmap2() over mmap(), except on the architectures listed + * Set in SYSCALLS whether or not we should use an unadorned mmap() system + * call (typical on 64-bit architectures). */ +#if (BITSIZE == 32 && defined(__NR_mmap2)) || (BITSIZE == 64 && !defined(__NR_mmap)) -#if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__) && !defined(__powerpc__) && !defined(__powerpc64__) +/* This architecture uses mmap2(). The Linux mmap2() system call takes + a page offset as the offset argument. We need to make sure we have + the proper conversion in place. */ -/* This architecture uses mmap2() */ - -static inline _syscall6(void *,mmap2,void *,start,size_t,length,int,prot,int,flags,int,fd,off_t,offset); - -/* The Linux mmap2() system call takes a page offset as the offset argument. - We need to make sure we have the proper conversion in place. */ +extern void *__mmap2(void *, size_t, int, int, int, size_t); void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) { - if ( offset & MMAP2_MASK ) { + const int mmap2_shift = MMAP2_SHIFT; + const unsigned long mmap2_mask = (1UL << mmap2_shift) - 1; + + if ( offset & mmap2_mask ) { errno = EINVAL; return MAP_FAILED; } - return mmap2(start, length, prot, flags, fd, (size_t)offset >> MMAP2_SHIFT); + return __mmap2(start, length, prot, flags, fd, (size_t)offset >> mmap2_shift); } -#else - -/* This architecture uses a plain mmap() system call */ -/* Only use this for architectures where mmap() is a real 6-argument system call! */ - -_syscall6(void *,mmap,void *,start,size_t,length,int,prot,int,flags,int,fd,off_t,offset) - #endif + diff --git a/klibc/klibc/mrand48.c b/klibc/klibc/mrand48.c new file mode 100644 index 0000000000..886ae9f03c --- /dev/null +++ b/klibc/klibc/mrand48.c @@ -0,0 +1,13 @@ +/* + * mrand48.c + */ + +#include +#include + +unsigned short __rand48_seed[3]; /* Common with lrand48.c, srand48.c */ + +long mrand48(void) +{ + return jrand48(__rand48_seed); +} diff --git a/klibc/klibc/nice.c b/klibc/klibc/nice.c index f0d97a3cd0..5a18de9091 100644 --- a/klibc/klibc/nice.c +++ b/klibc/klibc/nice.c @@ -7,11 +7,7 @@ #include #include -#ifdef __NR_nice - -_syscall1(int,nice,int,inc); - -#else +#ifndef __NR_nice int nice(int inc) { diff --git a/klibc/klibc/nrand48.c b/klibc/klibc/nrand48.c new file mode 100644 index 0000000000..fb7c5772fd --- /dev/null +++ b/klibc/klibc/nrand48.c @@ -0,0 +1,11 @@ +/* + * nrand48.c + */ + +#include +#include + +long nrand48(unsigned short xsubi[3]) +{ + return (long)((uint32_t)jrand48(xsubi) >> 1); +} diff --git a/klibc/klibc/open.c b/klibc/klibc/open.c index 0d7db10c4a..d52b53a699 100644 --- a/klibc/klibc/open.c +++ b/klibc/klibc/open.c @@ -1,17 +1,21 @@ /* * open.c * - * The open syscall is weird, because it's defined as a varadic - * function, but implementing it as such generally sucks for - * performance. Thus we generate it as a 3-argument function, - * but with explicit __cdecl assuming the __cdecl convention is - * independent of being varadic. + * On 32-bit platforms we need to pass O_LARGEFILE to the open() + * system call, to indicate that we're 64-bit safe. */ -#define __IN_OPEN_C +#define _KLIBC_IN_OPEN_C #include #include -#include -#include -__cdecl _syscall3(int,open,const char *,file,int,flags,mode_t,mode) +#if BITSIZE == 32 && !defined(__i386__) + +extern int __open(const char *, int, mode_t); + +int open(const char *pathname, int flags, mode_t mode) +{ + return __open(pathname, flags|O_LARGEFILE, mode); +} + +#endif diff --git a/klibc/klibc/pause.c b/klibc/klibc/pause.c index 5748728472..1f7b9342de 100644 --- a/klibc/klibc/pause.c +++ b/klibc/klibc/pause.c @@ -7,11 +7,7 @@ #include #include -#ifdef __NR_pause - -_syscall0(int,pause); - -#else +#ifndef __NR_pause int pause(void) { diff --git a/klibc/klibc/perror.c b/klibc/klibc/perror.c index 45585cd577..26f8ce8f6d 100644 --- a/klibc/klibc/perror.c +++ b/klibc/klibc/perror.c @@ -8,5 +8,6 @@ void perror(const char *s) { - fprintf(stderr, "%s: error %d\n", s, errno); + int e = errno; + fprintf(stderr, "%s: %s\n", s, strerror(e)); } diff --git a/klibc/klibc/putchar.c b/klibc/klibc/putchar.c new file mode 100644 index 0000000000..0e35adda17 --- /dev/null +++ b/klibc/klibc/putchar.c @@ -0,0 +1,15 @@ +/* + * putchar.c + * + * - gcc wants this + */ + +#include + +#undef putchar /* Defined as a macro */ +int putchar(int); + +int putchar(int c) +{ + return fputc(c, stdout); +} diff --git a/klibc/klibc/qsort.c b/klibc/klibc/qsort.c index e2197ea2ae..185f4dac69 100644 --- a/klibc/klibc/qsort.c +++ b/klibc/klibc/qsort.c @@ -23,14 +23,14 @@ void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, co { size_t gap = nmemb; size_t i, j; - void *p1, *p2; + char *p1, *p2; int swapped; do { gap = newgap(gap); swapped = 0; - for ( i = 0, p1 = base ; i < nmemb-gap ; i++, (char *)p1 += size ) { + for ( i = 0, p1 = base ; i < nmemb-gap ; i++, p1 += size ) { j = i+gap; if ( compar(p1, p2 = (char *)base+j*size) > 0 ) { memswap(p1, p2, size); diff --git a/klibc/klibc/readdir.c b/klibc/klibc/readdir.c index bb216a1951..acfe588713 100644 --- a/klibc/klibc/readdir.c +++ b/klibc/klibc/readdir.c @@ -1,21 +1,12 @@ /* - * opendir/readdir/closedir + * readdir.c: opendir/readdir/closedir */ #include #include #include -#include -#include - -#define __IO_DIR_DEFINED -struct _IO_dir { - int fd; - size_t bytes_left; - struct dirent *next; - struct dirent buffer[15]; /* 15 times max dirent size =~ 4K */ -}; +#define __KLIBC_DIRENT_INTERNALS #include DIR *opendir(const char *name) @@ -25,9 +16,9 @@ DIR *opendir(const char *name) if ( !dp ) return NULL; - dp->fd = open(name, O_DIRECTORY|O_RDONLY); + dp->__fd = open(name, O_DIRECTORY|O_RDONLY); - if ( dp->fd < 0 ) { + if ( dp->__fd < 0 ) { free(dp); return NULL; } @@ -43,7 +34,7 @@ struct dirent *readdir(DIR *dir) int rv; if ( !dir->bytes_left ) { - rv = getdents(dir->fd, dir->buffer, sizeof(dir->buffer)); + rv = getdents(dir->__fd, dir->buffer, sizeof(dir->buffer)); if ( rv <= 0 ) return NULL; dir->bytes_left = rv; @@ -51,7 +42,7 @@ struct dirent *readdir(DIR *dir) } dent = dir->next; - ((char *)dir->next) += dent->d_reclen; + dir->next = (struct dirent *)((char *)dir->next + dent->d_reclen); dir->bytes_left -= dent->d_reclen; return dent; @@ -60,7 +51,7 @@ struct dirent *readdir(DIR *dir) int closedir(DIR *dir) { int rv; - rv = close(dir->fd); + rv = close(dir->__fd); free(dir); return rv; } diff --git a/klibc/klibc/sbrk.c b/klibc/klibc/sbrk.c index 03ab3c14bb..f7401dcfe2 100644 --- a/klibc/klibc/sbrk.c +++ b/klibc/klibc/sbrk.c @@ -1,23 +1,41 @@ /* sbrk.c - Change data segment size */ /* Written 2000 by Werner Almesberger */ +/* Modified 2003-2004 for klibc by H. Peter Anvin */ #include #include -#include +#include +#include +#include "malloc.h" char *__current_brk; /* Common with brk.c */ +/* p is an address, a is alignment; must be a power of 2 */ +static inline void *align_up(void *p, uintptr_t a) +{ + return (void *) (((uintptr_t)p + a-1) & ~(a-1)); +} + void *sbrk(ptrdiff_t increment) { - char *old_brk, *new_brk; + char *start, *end, *new_brk; if (!__current_brk) __current_brk = __brk(NULL); - new_brk = __brk(__current_brk+increment); - if (new_brk != __current_brk+increment) + + start = align_up(__current_brk, SBRK_ALIGNMENT); + end = start + increment; + + new_brk = __brk(end); + + if (new_brk == (void *)-1) + return (void *)-1; + else if (new_brk < end) { + errno = ENOMEM; return (void *) -1; - old_brk = __current_brk; + } + __current_brk = new_brk; - return old_brk; + return end; } diff --git a/klibc/klibc/seed48.c b/klibc/klibc/seed48.c index f8353c8715..ac916d6165 100644 --- a/klibc/klibc/seed48.c +++ b/klibc/klibc/seed48.c @@ -6,7 +6,7 @@ #include #include -extern unsigned short __rand48_seed[3]; +unsigned short __rand48_seed[3]; unsigned short *seed48(const unsigned short xsubi[3]) { diff --git a/klibc/klibc/select.c b/klibc/klibc/select.c deleted file mode 100644 index 2404bb1e64..0000000000 --- a/klibc/klibc/select.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -#ifdef __NR__newselect -#undef __NR_select -#define __NR_select __NR__newselect -#endif - -_syscall5(int,select,int,a0,fd_set *,a1,fd_set *,a2,fd_set *,a3,struct timeval *,a4); diff --git a/klibc/klibc/setresgid.c b/klibc/klibc/setresgid.c deleted file mode 100644 index f1a8c6b45c..0000000000 --- a/klibc/klibc/setresgid.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * setresgid.c - */ - -#include -#include - -#ifdef __NR_setresgid - -_syscall3(int,setresgid,gid_t,a0,gid_t,a1,gid_t,a2); - -#elif defined(__NR_setresgid32) - -static inline _syscall3(int,setresgid32,gid_t,a0,gid_t,a1,gid_t,a2); - -int setresgid(gid_t a0, gid_t a1, gid_t a2) -{ - if ( sizeof(gid_t) == sizeof(uint32_t) ) { - return setresgid32(a0,a1,a2); - } else { - uint32_t x0 = (a0 == (gid_t)-1) ? (uint32_t)-1 : a0; - uint32_t x1 = (a1 == (gid_t)-1) ? (uint32_t)-1 : a1; - uint32_t x2 = (a2 == (gid_t)-1) ? (uint32_t)-1 : a2; - - return setresgid32(x0,x1,x2); - } -} - -#endif diff --git a/klibc/klibc/setresuid.c b/klibc/klibc/setresuid.c deleted file mode 100644 index a587acbae3..0000000000 --- a/klibc/klibc/setresuid.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * setresuid.c - */ - -#include -#include - -#ifdef __NR_setresuid - -_syscall3(int,setresuid,uid_t,a0,uid_t,a1,uid_t,a2); - -#elif defined(__NR_setresuid32) - -static inline _syscall3(int,setresuid32,uid_t,a0,uid_t,a1,uid_t,a2); - -int setresuid(uid_t a0, uid_t a1, uid_t a2) -{ - if ( sizeof(uid_t) == sizeof(uint32_t) ) { - return setresuid32(a0,a1,a2); - } else { - uint32_t x0 = (a0 == (uid_t)-1) ? (uint32_t)-1 : a0; - uint32_t x1 = (a1 == (uid_t)-1) ? (uint32_t)-1 : a1; - uint32_t x2 = (a2 == (uid_t)-1) ? (uint32_t)-1 : a2; - - return setresuid32(x0,x1,x2); - } -} - -#endif - diff --git a/klibc/klibc/sha1hash.c b/klibc/klibc/sha1hash.c index 600d51248c..f81e08b17c 100644 --- a/klibc/klibc/sha1hash.c +++ b/klibc/klibc/sha1hash.c @@ -289,7 +289,7 @@ char *mybase64(uint8_t digest[20]) int main(int argc, char** argv) { - int i, j; + int i; SHA1_CTX context; uint8_t digest[20], buffer[16384]; FILE* file; diff --git a/klibc/klibc/sigaction.c b/klibc/klibc/sigaction.c index ebd34710f1..885bc6a4a4 100644 --- a/klibc/klibc/sigaction.c +++ b/klibc/klibc/sigaction.c @@ -5,11 +5,7 @@ #include #include -#ifdef __NR_sigaction - -_syscall3(int,sigaction,int,sig,const struct sigaction *,act,struct sigaction *,oact); - -#else +#if !defined(__NR_sigaction) int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) { diff --git a/klibc/klibc/sigpending.c b/klibc/klibc/sigpending.c index afbcf3cf34..76d2b1a7f6 100644 --- a/klibc/klibc/sigpending.c +++ b/klibc/klibc/sigpending.c @@ -5,11 +5,7 @@ #include #include -#ifdef __NR_sigpending - -_syscall1(int,sigpending,sigset_t *,set); - -#else +#ifndef __NR_sigpending int sigpending(sigset_t *set) { diff --git a/klibc/klibc/sigprocmask.c b/klibc/klibc/sigprocmask.c index 3a90f67732..b5e58b28b8 100644 --- a/klibc/klibc/sigprocmask.c +++ b/klibc/klibc/sigprocmask.c @@ -5,11 +5,7 @@ #include #include -#ifdef __NR_sigprocmask - -_syscall3(int,sigprocmask,int,how,const sigset_t *,set,sigset_t *,oset); - -#else +#ifndef __NR_sigprocmask int sigprocmask(int how, const sigset_t *set, sigset_t *oset) { diff --git a/klibc/klibc/sigsuspend.c b/klibc/klibc/sigsuspend.c index 85cdea20ca..a927999ae6 100644 --- a/klibc/klibc/sigsuspend.c +++ b/klibc/klibc/sigsuspend.c @@ -5,11 +5,7 @@ #include #include -#ifdef __NR_sigsuspend - -_syscall1(int,sigsuspend,const sigset_t *,mask); - -#else +#ifndef __NR_sigsuspend int sigsuspend(const sigset_t *mask) { diff --git a/klibc/klibc/socketcalls.pl b/klibc/klibc/socketcalls.pl index cf4daf6036..fd82b2b49f 100644 --- a/klibc/klibc/socketcalls.pl +++ b/klibc/klibc/socketcalls.pl @@ -1,17 +1,32 @@ #!/usr/bin/perl -($arch, $file) = @ARGV; + +$v = $ENV{'KBUILD_VERBOSE'}; +$quiet = defined($v) ? !$v : 0; + +@args = (); +for $arg ( @ARGV ) { + if ( $arg =~ /^-/ ) { + if ( $arg eq '-q' ) { + $quiet = 1; + } else { + die "$0: Unknown option: $arg\n"; + } + } else { + push(@args, $arg); + } +} +($file, $arch) = @args; if (!open(FILE, "< $file")) { - print STDERR "$file: $!\n"; - exit(1); + die "$file: $!\n"; } while ( defined($line = ) ) { chomp $line; - $line =~ s/\s*\#.*$//; # Strip comments and trailing blanks + $line =~ s/\s*[\#\;].*$//; # Strip comments and trailing blanks next unless $line; - if ( $line =~ /^\s*(.*)\s+([_a-zA-Z][_a-zA-Z0-9]+)\s*\((.*)\)$/ ) { + if ( $line =~ /^\s*\<\?\>\s*(.*)\s+([_a-zA-Z][_a-zA-Z0-9]+)\s*\((.*)\)$/ ) { $type = $1; $name = $2; $argv = $3; @@ -26,7 +41,7 @@ while ( defined($line = ) ) { $nargs = $i; if ( $arch eq 'i386' ) { - open(OUT, "> socketcalls/${name}.S") + open(OUT, '>', "socketcalls/${name}.S") or die "$0: Cannot open socketcalls/${name}.S\n"; print OUT "#include \n"; @@ -39,33 +54,31 @@ while ( defined($line = ) ) { print OUT "\tmovb \$SYS_\U${name}\E,%al\n"; print OUT "\tjmp __socketcall_common\n"; print OUT "\t.size ${name},.-${name}\n"; + close(OUT); } else { - open(OUT, "> socketcalls/${name}.c") + open(OUT, '>', "socketcalls/${name}.c") or die "$0: Cannot open socketcalls/${name}.c\n"; - print OUT "#include \"socketcommon.h\"\n\n"; - - print OUT "#ifdef __NR_$name\n\n"; - print OUT "_syscall", scalar(@args), "(", $type, ',', $name; - $i = 0; - foreach $arg ( @args ) { - print OUT ",", $arg, ",a",$i++; - } - print OUT ");\n"; - print OUT "\n#else\n\n"; - + + print OUT "#include \"../socketcommon.h\"\n"; + print OUT "\n"; + print OUT "#ifndef __NR_${name}\n\n"; + + print OUT "extern long __socketcall(int, const unsigned long *);\n\n"; + print OUT "$type $name (", join(', ', @cargs), ")\n"; print OUT "{\n"; print OUT " unsigned long args[$nargs];\n"; for ( $i = 0 ; $i < $nargs ; $i++ ) { print OUT " args[$i] = (unsigned long)a$i;\n"; } - print OUT " return ($type) socketcall(SYS_\U${name}\E, args);\n"; - print OUT "}\n"; - print OUT "\n#endif\n"; + print OUT " return ($type) __socketcall(SYS_\U${name}\E, args);\n"; + print OUT "}\n\n"; + + print OUT "#endif\n"; + + close(OUT); } - close(OUT); } else { - print STDERR "$file:$.: Could not parse input\n"; - exit(1); + die "$file:$.: Could not parse input\n"; } } diff --git a/klibc/klibc/socketcommon.h b/klibc/klibc/socketcommon.h index 7a5acaadaf..9c4b11fab8 100644 --- a/klibc/klibc/socketcommon.h +++ b/klibc/klibc/socketcommon.h @@ -13,13 +13,4 @@ #include #include #include - -/* - * Some architectures have socketcall(), some have real syscalls, - * and some have both, but the syscall version is always preferred. - * Look for __NR_ to probe for the existence of a syscall. - */ - -#ifdef __NR_socketcall -static inline _syscall2(int,socketcall,int,call,unsigned long *,args); -#endif +#include diff --git a/klibc/klibc/srand48.c b/klibc/klibc/srand48.c index a3df16d95c..5f201d2047 100644 --- a/klibc/klibc/srand48.c +++ b/klibc/klibc/srand48.c @@ -5,8 +5,7 @@ #include #include -extern unsigned short __rand48_seed[3]; - +unsigned short __rand48_seed[3]; /* Common with mrand48.c, lrand48.c */ void srand48(long seedval) { diff --git a/klibc/klibc/statfs.c b/klibc/klibc/statfs.c new file mode 100644 index 0000000000..60e9188a09 --- /dev/null +++ b/klibc/klibc/statfs.c @@ -0,0 +1,19 @@ +/* + * statfs.c + * + * On architectures which do statfs64, wrap the system call + */ + +#include +#include + +#ifdef __NR_statfs64 + +extern int __statfs64(const char *, size_t, struct statfs *); + +int statfs(const char *path, struct statfs *buf) +{ + return __statfs64(path, sizeof *buf, buf); +} + +#endif diff --git a/klibc/klibc/strerror.c b/klibc/klibc/strerror.c index 62705553a6..c8e3eac793 100644 --- a/klibc/klibc/strerror.c +++ b/klibc/klibc/strerror.c @@ -7,18 +7,28 @@ char *strerror(int errnum) { static char message[32] = "error "; /* enough for error 2^63-1 */ - char numbuf[32]; char *p; + unsigned int e = (unsigned int)errnum; + +#ifdef WITH_ERRLIST + extern const int sys_nerr; + extern const char * const sys_errlist[]; + + if ( e < (unsigned int)sys_nerr && sys_errlist[e] ) + return (char *)sys_errlist[e]; +#endif p = numbuf+sizeof numbuf; *--p = '\0'; do { - *--p = (errnum % 10) + '0'; - errnum /= 10; - } while ( errnum ); + *--p = (e % 10) + '0'; + e /= 10; + } while ( e ); + + memcpy(message+6, p, (numbuf+sizeof numbuf)-p); - return (char *)memcpy(message+6, p, (numbuf+sizeof numbuf)-p); + return message; } diff --git a/klibc/klibc/strlcat.c b/klibc/klibc/strlcat.c new file mode 100644 index 0000000000..6111445f06 --- /dev/null +++ b/klibc/klibc/strlcat.c @@ -0,0 +1,31 @@ +/* + * strlcat.c + */ + +#include +#include + +size_t strlcat(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ( bytes < size && *q ) { + q++; + bytes++; + } + + while ( (ch = *p++) ) { + if ( bytes < size ) + *q++ = ch; + + bytes++; + } + + *q = '\0'; + return bytes; +} + + diff --git a/klibc/klibc/strlcpy.c b/klibc/klibc/strlcpy.c new file mode 100644 index 0000000000..eb384c9885 --- /dev/null +++ b/klibc/klibc/strlcpy.c @@ -0,0 +1,26 @@ +/* + * strlcpy.c + */ + +#include +#include + +size_t strlcpy(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ( (ch = *p++) ) { + if ( bytes < size ) + *q++ = ch; + + bytes++; + } + + *q = '\0'; + return bytes; +} + + diff --git a/klibc/klibc/strncat.c b/klibc/klibc/strncat.c index 99d957594c..0dd9deb984 100644 --- a/klibc/klibc/strncat.c +++ b/klibc/klibc/strncat.c @@ -3,9 +3,23 @@ */ #include +#include char *strncat(char *dst, const char *src, size_t n) { - strncpy(strchr(dst, '\0'), src, n); + char *q = strchr(dst, '\0'); + const char *p = src; + char ch; + size_t nn = q-dst; + + if ( __likely(nn <= n) ) + n -= nn; + + while (n--) { + *q++ = ch = *p++; + if ( !ch ) + break; + } + return dst; } diff --git a/klibc/klibc/strncpy.c b/klibc/klibc/strncpy.c index a8fe45fcbb..06964f31d6 100644 --- a/klibc/klibc/strncpy.c +++ b/klibc/klibc/strncpy.c @@ -1,7 +1,5 @@ /* * strncpy.c - * - * strncpy() */ #include @@ -12,11 +10,15 @@ char *strncpy(char *dst, const char *src, size_t n) const char *p = src; char ch; - while ( n-- ) { + while (n) { + n--; *q++ = ch = *p++; if ( !ch ) break; } + /* The specs say strncpy() fills the entire buffer with NUL. Sigh. */ + memset(q, 0, n); + return dst; } diff --git a/klibc/klibc/strnlen.c b/klibc/klibc/strnlen.c new file mode 100644 index 0000000000..06b54c3189 --- /dev/null +++ b/klibc/klibc/strnlen.c @@ -0,0 +1,19 @@ +/* + * strnlen() + */ + +#include + +size_t strnlen(const char *s, size_t maxlen) +{ + const char *ss = s; + + /* Important: the maxlen test must precede the reference through ss; + since the byte beyond the maximum may segfault */ + while ((maxlen > 0) && *ss) { + ss++; + maxlen--; + } + return ss-s; +} + diff --git a/klibc/klibc/strtotimespec.c b/klibc/klibc/strtotimespec.c new file mode 100644 index 0000000000..b426bf8d0f --- /dev/null +++ b/klibc/klibc/strtotimespec.c @@ -0,0 +1,5 @@ +#define NAME strtotimespec +#define TIMEX struct timespec +#define FSEC tv_nsec +#define DECIMALS 9 +#include "strtotimex.c" diff --git a/klibc/klibc/strtotimeval.c b/klibc/klibc/strtotimeval.c new file mode 100644 index 0000000000..280d4bcd3a --- /dev/null +++ b/klibc/klibc/strtotimeval.c @@ -0,0 +1,5 @@ +#define NAME strtotimeval +#define TIMEX struct timeval +#define FSEC tv_usec +#define DECIMALS 6 +#include "strtotimex.c" diff --git a/klibc/klibc/strtotimex.c b/klibc/klibc/strtotimex.c new file mode 100644 index 0000000000..0f6c2f9181 --- /dev/null +++ b/klibc/klibc/strtotimex.c @@ -0,0 +1,39 @@ +/* + * strtotimex.c + * + * Nonstandard function which takes a string and converts it to a + * struct timespec/timeval. Returns a pointer to the first non-numeric + * character in the string. + * + */ + +#include +#include +#include +#include + +char * NAME (const char *str, TIMEX *ts) +{ + int n; + char *s, *s0; + __typeof__(ts->FSEC) fs; /* Fractional seconds */ + + ts->tv_sec = strntoumax(str, &s, 10, ~(size_t)0); + fs = 0; + + if ( *s == '.' ) { + s0 = s+1; + + fs = strntoumax(s0, &s, 10, DECIMALS); + n = s-s0; + + while ( isdigit(*s) ) + s++; + + for ( ; n < DECIMALS ; n++ ) + fs *= 10; + } + + ts->FSEC = fs; + return s; +} diff --git a/klibc/klibc/syscalls.pl b/klibc/klibc/syscalls.pl index b530a9b8c7..1c48ce58ff 100644 --- a/klibc/klibc/syscalls.pl +++ b/klibc/klibc/syscalls.pl @@ -1,46 +1,99 @@ #!/usr/bin/perl -($arch, $file) = @ARGV; +# +# Script to parse the SYSCALLS file and generate appropriate +# stubs. -if (!open(FILE, "< $file")) { - print STDERR "$file: $!\n"; - exit(1); +$v = $ENV{'KBUILD_VERBOSE'}; +$quiet = defined($v) ? !$v : 0; + +@args = (); +for $arg ( @ARGV ) { + if ( $arg =~ /^-/ ) { + if ( $arg eq '-q' ) { + $quiet = 1; + } else { + die "$0: Unknown option: $arg\n"; + } + } else { + push(@args, $arg); + } +} +($file, $arch, $bits, $unistd, $havesyscall) = @args; + +require "arch/$arch/sysstub.ph"; + +if (!open(UNISTD, '<', $unistd)) { + die "$0: $unistd: $!\n"; +} +while ( defined($line = ) ) { + chomp $line; + + if ( $line =~ /^\#\s*define\s+__NR_([A-Za-z0-9_]+)\s+(.*\S)\s*$/ ) { + $syscalls{$1} = $2; + print STDERR "SYSCALL FOUND: $1\n" unless ( $quiet ); + } +} +close(UNISTD); + +if (!open(HAVESYS, '>', $havesyscall)) { + die "$0: $havesyscall: $!\n"; +} + +print HAVESYS "#ifndef _KLIBC_HAVESYSCALL_H\n"; +print HAVESYS "#define _KLIBC_HAVESYSCALL_H 1\n\n"; + +if (!open(FILE, '<', $file)) { + die "$0: $file: $!\n"; } while ( defined($line = ) ) { chomp $line; - $line =~ s/\s*\#.*$//; # Strip comments and trailing blanks + $line =~ s/\s*(|[\#;].*)$//; # Strip comments and trailing blanks next unless $line; - if ( $line =~ /^\s*(\<[^\>]+\>\s+|)([^\(\<\>]+[^\@\:A-Za-z0-9_])([A-Za-z0-9_]+)(|\@[A-Za-z0-9_]+)(|\:\:[A-Za-z0-9_]+)\s*\(([^\:\)]*)\)\s*$/ ) { - $archs = $1; - $type = $2; - $sname = $3; - $stype = $4; - $fname = $5; - $argv = $6; + if ( $line =~ /^\s*(\<[^\>]+\>\s+|)([A-Za-z0-9_\*\s]+)\s+([A-Za-z0-9_,]+)(|\@[A-Za-z0-9_]+)(|\:\:[A-Za-z0-9_]+)\s*\(([^\:\)]*)\)\s*$/ ) { + $archs = $1; + $type = $2; + $snames = $3; + $stype = $4; + $fname = $5; + $argv = $6; - $doit = 1; + $doit = 1; + $maybe = 0; if ( $archs ne '' ) { - die "$0: Internal error" - unless ( $archs =~ /^\<(|\!)([^\>\!]+)\>/ ); - $not = $1; - $list = $2; + die "$file:$.: Invalid architecture spec: <$archs>\n" + unless ( $archs =~ /^\<(|\?)(|\!)([^\>\!\?]*)\>/ ); + $maybe = $1 ne ''; + $not = $2 ne ''; + $list = $3; - $doit = ($not eq '') ? 0 : 1; + $doit = $not || ($list eq ''); @list = split(/,/, $list); foreach $a ( @list ) { - if ( $a eq $arch ) { - $doit = ($not eq '') ? 1 : 0; + if ( $a eq $arch || $a eq $bits ) { + $doit = !$not; last; } } } next if ( ! $doit ); - $type =~ s/\s*$//; + undef $sname; + foreach $sn ( split(/,/, $snames) ) { + if ( defined $syscalls{$sn} ) { + $sname = $sn; + last; + } + } + if ( !defined($sname) ) { + next if ( $maybe ); + die "$file:$.: Undefined system call: $snames\n"; + } - $stype =~ s/^\@/_/; + $type =~ s/\s*$//; + $stype =~ s/^\@//; if ( $fname eq '' ) { $fname = $sname; @@ -50,32 +103,12 @@ while ( defined($line = ) ) { @args = split(/\s*\,\s*/, $argv); - open(OUT, "> syscalls/${fname}.c") - or die "$0: Cannot open syscalls/${fname}.c\n"; - - if ( $fname eq "rt_sigaction") { - print OUT "#ifdef __x86_64__\n\n"; - print OUT "struct sigaction;\n\n"; - print OUT "#endif\n\n" - } - - print OUT "#include \"syscommon.h\"\n\n"; - - if ( $fname ne $sname ) { - print OUT "#undef __NR_${fname}\n"; - print OUT "#define __NR_${fname} __NR_${sname}\n\n"; - } - - print OUT "_syscall", scalar(@args), $stype, "(", $type, ',', $fname; - - $i = 0; - foreach $arg ( @args ) { - print OUT ",", $arg, ",a",$i++; - } - print OUT ");\n"; - close(OUT); + print HAVESYS "#define _KLIBC_HAVE_SYSCALL_${fname} ${sname}\n"; + make_sysstub($fname, $type, $sname, $stype, @args); } else { - print STDERR "$file:$.: Could not parse input\n"; - exit(1); + die "$file:$.: Could not parse input: \"$line\"\n"; } } + +print HAVESYS "\n#endif\n"; +close(HAVESYS); diff --git a/klibc/klibc/syslog.c b/klibc/klibc/syslog.c index 10a2dce405..592992ba6b 100644 --- a/klibc/klibc/syslog.c +++ b/klibc/klibc/syslog.c @@ -18,7 +18,7 @@ #define LOGDEV "/dev/kmsg" /* Max length of ID string */ -#define MAXID 31 +#define MAXID 31 /* MAXID+6 must be < BUFLEN */ int __syslog_fd = -1; static char id[MAXID+1]; @@ -43,16 +43,12 @@ void openlog(const char *ident, int option, int facility) void vsyslog(int prio, const char *format, va_list ap) { char buf[BUFLEN]; - int rv, len; + int len; int fd; if ( __syslog_fd == -1 ) openlog(NULL, 0, 0); - fd = __syslog_fd; - if ( fd == -1 ) - fd = 2; /* Failed to open log, write to stderr */ - buf[0] = '<'; buf[1] = LOG_PRI(prio)+'0'; buf[2] = '>'; @@ -61,13 +57,16 @@ void vsyslog(int prio, const char *format, va_list ap) if ( *id ) len += sprintf(buf+3, "%s: ", id); - rv = vsnprintf(buf+len, BUFLEN-len, format, ap); + len += vsnprintf(buf+len, BUFLEN-len, format, ap); - len += rv; if ( len > BUFLEN-1 ) len = BUFLEN-1; - buf[len] = '\n'; + buf[len++] = '\n'; + + fd = __syslog_fd; + if ( fd == -1 ) + fd = 2; /* Failed to open log, write to stderr */ - write(fd, buf, len+1); + write(fd, buf, len); } void syslog(int prio, const char *format, ...) diff --git a/klibc/klibc/tests/fcntl.c b/klibc/klibc/tests/fcntl.c new file mode 100644 index 0000000000..f504ad90f7 --- /dev/null +++ b/klibc/klibc/tests/fcntl.c @@ -0,0 +1,53 @@ +/* + * Simple test of fcntl + */ + +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + int fd = open(argv[0], O_RDONLY); + struct flock l; + long flags; + + (void)argc; + + if ( fd < 0 ) { + perror("open"); + exit(1); + } + + /* Get the flags on this FD */ + + if ( (flags = fcntl(fd, F_GETFL)) == -1 ) { + perror("F_GETFL"); + exit(1); + } + + if ( flags != (O_RDONLY|O_LARGEFILE) ) + fprintf(stderr, "flags = %#lx\n", flags); + + /* Set a lock on this FD */ + memset(&l, 0, sizeof l); + l.l_type = F_RDLCK; + l.l_whence = SEEK_SET; + l.l_start = 123; + l.l_len = 456; + + if ( fcntl(fd, F_SETLK, &l) == -1 ) { + perror("F_SETLK"); + exit(1); + } + + /* Eventually, fork and try to conflict with this lock... */ + + return 0; +} + + + diff --git a/klibc/klibc/tests/getpagesize.c b/klibc/klibc/tests/getpagesize.c new file mode 100644 index 0000000000..bda37e1f6b --- /dev/null +++ b/klibc/klibc/tests/getpagesize.c @@ -0,0 +1,11 @@ +#include +#include + +int main(void) +{ + printf("getpagesize() = %d\n" + "__getpageshift() = %d\n", + getpagesize(), __getpageshift()); + + return 0; +} diff --git a/klibc/klibc/tests/malloctest2.c b/klibc/klibc/tests/malloctest2.c new file mode 100644 index 0000000000..b392046929 --- /dev/null +++ b/klibc/klibc/tests/malloctest2.c @@ -0,0 +1,60 @@ +#include +#include +#include + +#define NCYCLES 32768 +#define NSLOTS 4096 + +struct slot { + char *ptr; + size_t size; +}; + +struct slot s[NSLOTS]; + +int main(void) +{ + size_t sp, sq; + char *p, *ep, *q, *eq; + int r, i, j; + int ok; + int err = 0; + + for ( r = 0 ; r < NCYCLES ; r++ ) { + i = lrand48() % NSLOTS; + + if ( s[i].ptr ) { + free(s[i].ptr); + printf("Freed %8zu bytes at %p\n", s[i].size, s[i].ptr); + s[i].ptr = NULL; + s[i].size = 0; + } else { + sp = lrand48(); /* 32-bit random number */ + sp >>= 12+(lrand48() % 20); + + s[i].size = sp; + s[i].ptr = p = malloc(sp); + ep = p+sp; + ok = 1; + for ( j = 0 ; j < NSLOTS ; j++ ) { + q = s[j].ptr; + if ( i != j && q ) { + sq = s[j].size; + eq = q+sq; + + if ( (p < q && ep > q) || (p >= q && p < eq) ) { + ok = 0; + err = 1; + break; + } + } + } + printf("Allocated %8zu bytes at %p, ok = %d\n", sp, p, ok); + + if ( p ) + memset(p, 0xee, sp); /* Poison this memory */ + } + } + return err; +} + diff --git a/klibc/klibc/tests/microhello.c b/klibc/klibc/tests/microhello.c index e57cd05a50..f0f5a40379 100644 --- a/klibc/klibc/tests/microhello.c +++ b/klibc/klibc/tests/microhello.c @@ -3,7 +3,7 @@ int main(void) { - const char hello[] = "Hello, World!\n"; + static const char hello[] = "Hello, World!\n"; _fwrite(hello, sizeof hello-1, stdout); return 0; } diff --git a/klibc/klibc/tests/minips.c b/klibc/klibc/tests/minips.c deleted file mode 100644 index 20898270f4..0000000000 --- a/klibc/klibc/tests/minips.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright 1998 by Albert Cahalan; all rights reserved. - * This file may be used subject to the terms and conditions of the - * GNU Library General Public License Version 2, or any later version - * at your option, as published by the Free Software Foundation. - * 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 Library General Public License for more details. - */ - -/* This is a minimal /bin/ps, designed to be smaller than the old ps - * while still supporting some of the more important features of the - * new ps. (for total size, note that this ps does not need libproc) - * It is suitable for Linux-on-a-floppy systems only. - * - * Maintainers: do not compile or install for normal systems. - * Anyone needing this will want to tweak their compiler anyway. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include /* HZ */ -#include /* PAGE_SIZE */ - -static int P_euid; -static int P_pid; -static char P_cmd[16]; -static char P_state; -static int P_ppid, P_pgrp, P_session, P_tty, P_tpgid; -static unsigned long P_flags, P_min_flt, P_cmin_flt, P_maj_flt, P_cmaj_flt, P_utime, P_stime; -static long P_cutime, P_cstime, P_priority, P_nice, P_timeout, P_it_real_value; -static unsigned long P_start_time, P_vsize; -static long P_rss; -static unsigned long P_rss_rlim, P_start_code, P_end_code, P_start_stack, P_kstk_esp, P_kstk_eip; -static unsigned P_signal, P_blocked, P_sigignore, P_sigcatch; -static unsigned long P_wchan, P_nswap, P_cnswap; - - -#if 0 -static int screen_cols = 80; -static int w_count; -#endif - -static int want_one_pid; -static const char *want_one_command; -static int select_notty; -static int select_all; - -static int ps_format; -static int old_h_option; - -/* we only pretend to support this */ -static int show_args; /* implicit with -f and all BSD options */ -static int bsd_c_option; /* this option overrides the above */ - -static int ps_argc; /* global argc */ -static char **ps_argv; /* global argv */ -static int thisarg; /* index into ps_argv */ -static char *flagptr; /* current location in ps_argv[thisarg] */ - - -#ifndef PAGE_SIZE -#warning PAGE_SIZE not defined, assuming it is 4096 -#define PAGE_SIZE 4096 -#endif - -#ifndef HZ -#warning HZ not defined, assuming it is 100 -#define HZ 100 -#endif - - - -static void usage(void){ - fprintf(stderr, - "-C select by command name (minimal ps only accepts one)\n" - "-p select by process ID (minimal ps only accepts one)\n" - "-e all processes (same as ax)\n" - "a all processes w/ tty, including other users\n" - "x processes w/o controlling ttys\n" - "-f full format\n" - "-j,j job control format\n" - "v virtual memory format\n" - "-l,l long format\n" - "u user-oriented format\n" - "-o user-defined format (limited support, only \"ps -o pid=\")\n" - "h no header\n" -/* - "-A all processes (same as ax)\n" - "c true command name\n" - "-w,w wide output\n" -*/ - ); - exit(1); -} - -/* - * Return the next argument, or call the usage function. - * This handles both: -oFOO -o FOO - */ -static const char *get_opt_arg(void){ - const char *ret; - ret = flagptr+1; /* assume argument is part of ps_argv[thisarg] */ - if(*ret) return ret; - if(++thisarg >= ps_argc) usage(); /* there is nothing left */ - /* argument is the new ps_argv[thisarg] */ - ret = ps_argv[thisarg]; - if(!ret || !*ret) usage(); - return ret; -} - - -/* return the PID, or 0 if nothing good */ -static void parse_pid(const char *str){ - char *endp; - int num; - if(!str) goto bad; - num = strtol(str, &endp, 0); - if(*endp != '\0') goto bad; - if(num<1) goto bad; - if(want_one_pid) goto bad; - want_one_pid = num; - return; -bad: - usage(); -} - -/***************** parse SysV options, including Unix98 *****************/ -static void parse_sysv_option(void){ - do{ - switch(*flagptr){ - /**** selection ****/ - case 'C': /* end */ - if(want_one_command) usage(); - want_one_command = get_opt_arg(); - return; /* can't have any more options */ - case 'p': /* end */ - parse_pid(get_opt_arg()); - return; /* can't have any more options */ - case 'A': - case 'e': - select_all++; - select_notty++; -case 'w': /* here for now, since the real one is not used */ - break; - /**** output format ****/ - case 'f': - show_args = 1; - /* FALL THROUGH */ - case 'j': - case 'l': - if(ps_format) usage(); - ps_format = *flagptr; - break; - case 'o': /* end */ - /* We only support a limited form: "ps -o pid=" (yes, just "pid=") */ - if(strcmp(get_opt_arg(),"pid=")) usage(); - if(ps_format) usage(); - ps_format = 'o'; - old_h_option++; - return; /* can't have any more options */ - /**** other stuff ****/ -#if 0 - case 'w': - w_count++; - break; -#endif - default: - usage(); - } /* switch */ - }while(*++flagptr); -} - -/************************* parse BSD options **********************/ -static void parse_bsd_option(void){ - do{ - switch(*flagptr){ - /**** selection ****/ - case 'a': - select_all++; - break; - case 'x': - select_notty++; - break; - case 'p': /* end */ - parse_pid(get_opt_arg()); - return; /* can't have any more options */ - /**** output format ****/ - case 'j': - case 'l': - case 'u': - case 'v': - if(ps_format) usage(); - ps_format = 0x80 | *flagptr; /* use 0x80 to tell BSD from SysV */ - break; - /**** other stuff ****/ - case 'c': - bsd_c_option++; -#if 0 - break; -#endif - case 'w': -#if 0 - w_count++; -#endif - break; - case 'h': - old_h_option++; - break; - default: - usage(); - } /* switch */ - }while(*++flagptr); -} - -#if 0 -/* not used yet */ -static void choose_dimensions(void){ - struct winsize ws; - char *columns; - /* screen_cols is 80 by default */ - if(ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col>30) screen_cols = ws.ws_col; - columns = getenv("COLUMNS"); - if(columns && *columns){ - long t; - char *endptr; - t = strtol(columns, &endptr, 0); - if(!*endptr && (t>30) && (t<(long)999999999)) screen_cols = (int)t; - } - if(w_count && (screen_cols<132)) screen_cols=132; - if(w_count>1) screen_cols=999999999; -} -#endif - -static void arg_parse(int argc, char *argv[]){ - int sel = 0; /* to verify option sanity */ - ps_argc = argc; - ps_argv = argv; - thisarg = 0; - /**** iterate over the args ****/ - while(++thisarg < ps_argc){ - flagptr = ps_argv[thisarg]; - switch(*flagptr){ - case '0' ... '9': - show_args = 1; - parse_pid(flagptr); - break; - case '-': - flagptr++; - parse_sysv_option(); - break; - default: - show_args = 1; - parse_bsd_option(); - break; - } - } - /**** sanity check and clean-up ****/ - if(want_one_pid) sel++; - if(want_one_command) sel++; - if(select_notty || select_all) sel++; - if(sel>1 || select_notty>1 || select_all>1 || bsd_c_option>1 || old_h_option>1) usage(); - if(bsd_c_option) show_args = 0; -} - -/* return 1 if it works, or 0 for failure */ -static int stat2proc(int pid) { - char buf[800]; /* about 40 fields, 64-bit decimal is about 20 chars */ - int num; - int fd; - char* tmp; - struct stat sb; /* stat() used to get EUID */ - snprintf(buf, 32, "/proc/%d/stat", pid); - if ( (fd = open(buf, O_RDONLY, 0) ) == -1 ) return 0; - num = read(fd, buf, sizeof buf - 1); - fstat(fd, &sb); - P_euid = sb.st_uid; - close(fd); - if(num<80) return 0; - buf[num] = '\0'; - tmp = strrchr(buf, ')'); /* split into "PID (cmd" and "" */ - *tmp = '\0'; /* replace trailing ')' with NUL */ - /* parse these two strings separately, skipping the leading "(". */ - memset(P_cmd, 0, sizeof P_cmd); /* clear */ - sscanf(buf, "%d (%15c", &P_pid, P_cmd); /* comm[16] in kernel */ - num = sscanf(tmp + 2, /* skip space after ')' too */ - "%c " - "%d %d %d %d %d " - "%lu %lu %lu %lu %lu %lu %lu " - "%ld %ld %ld %ld %ld %ld " - "%lu %lu " - "%ld " - "%lu %lu %lu %lu %lu %lu " - "%u %u %u %u " /* no use for RT signals */ - "%lu %lu %lu", - &P_state, - &P_ppid, &P_pgrp, &P_session, &P_tty, &P_tpgid, - &P_flags, &P_min_flt, &P_cmin_flt, &P_maj_flt, &P_cmaj_flt, &P_utime, &P_stime, - &P_cutime, &P_cstime, &P_priority, &P_nice, &P_timeout, &P_it_real_value, - &P_start_time, &P_vsize, - &P_rss, - &P_rss_rlim, &P_start_code, &P_end_code, &P_start_stack, &P_kstk_esp, &P_kstk_eip, - &P_signal, &P_blocked, &P_sigignore, &P_sigcatch, - &P_wchan, &P_nswap, &P_cnswap - ); -/* fprintf(stderr, "stat2proc converted %d fields.\n",num); */ - P_vsize /= 1024; - P_rss *= (PAGE_SIZE/1024); - if(num < 30) return 0; - if(P_pid != pid) return 0; - return 1; -} - -static const char *do_time(unsigned long t){ - int hh,mm,ss; - static char buf[32]; - int cnt = 0; - t /= HZ; - ss = t%60; - t /= 60; - mm = t%60; - t /= 60; - hh = t%24; - t /= 24; - if(t) cnt = snprintf(buf, sizeof buf, "%d-", (int)t); - snprintf(cnt + buf, sizeof(buf)-cnt, "%02d:%02d:%02d", hh, mm, ss); - return buf; -} - -static void print_proc(void){ - char tty[16]; - snprintf(tty, sizeof tty, "%3d,%-3d", (P_tty>>8)&0xff, P_tty&0xff); - switch(ps_format){ - case 0: - printf("%5d %s %s", P_pid, tty, do_time(P_utime+P_stime)); - break; - case 'o': - printf("%d\n", P_pid); - return; /* don't want the command */ - case 'l': - printf( - "%03x %c %5d %5d %5d - %3d %3d - " - "%5ld %06x %s %s", - (unsigned)P_flags&0x777, P_state, P_euid, P_pid, P_ppid, - (int)P_priority, (int)P_nice, P_vsize/(PAGE_SIZE/1024), - (unsigned)(P_wchan&0xffffff), tty, do_time(P_utime+P_stime) - ); - break; - case 'f': - printf( - "%5d %5d %5d - - %s %s", - P_euid, P_pid, P_ppid, tty, do_time(P_utime+P_stime) - ); - break; - case 'j': - printf( - "%5d %5d %5d %s %s", - P_pid, P_pgrp, P_session, tty, do_time(P_utime+P_stime) - ); - break; - case 'u'|0x80: - printf( - "%5d %5d - - %5ld %5ld %s %c - %s", - P_euid, P_pid, P_vsize, P_rss, tty, P_state, - do_time(P_utime+P_stime) - ); - break; - case 'v'|0x80: - printf( - "%5d %s %c %s %6d - - %5d -", - P_pid, tty, P_state, do_time(P_utime+P_stime), (int)P_maj_flt, - (int)P_rss - ); - break; - case 'j'|0x80: - printf( - "%5d %5d %5d %5d %s %5d %c %5d %s", - P_ppid, P_pid, P_pgrp, P_session, tty, P_tpgid, P_state, P_euid, do_time(P_utime+P_stime) - ); - break; - case 'l'|0x80: - printf( - "%03x %5d %5d %5d %3d %3d " - "%5ld %4ld %06x %c %s %s", - (unsigned)P_flags&0x777, P_euid, P_pid, P_ppid, (int)P_priority, (int)P_nice, - P_vsize, P_rss, (unsigned)(P_wchan&0xffffff), P_state, tty, do_time(P_utime+P_stime) - ); - break; - default: - break; - } - if(show_args) printf(" [%s]\n", P_cmd); - else printf(" %s\n", P_cmd); -} - - -int main(int argc, char *argv[]){ - arg_parse(argc, argv); -#if 0 - choose_dimensions(); -#endif - if(!old_h_option){ - const char *head; - switch(ps_format){ - default: /* can't happen */ - case 0: head = " PID TTY TIME CMD"; break; - case 'l': head = " F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD"; break; - case 'f': head = " UID PID PPID C STIME TTY TIME CMD"; break; - case 'j': head = " PID PGID SID TTY TIME CMD"; break; - case 'u'|0x80: head = " UID PID %CPU %MEM VSZ RSS TTY S START TIME COMMAND"; break; - case 'v'|0x80: head = " PID TTY S TIME MAJFL TRS DRS RSS %MEM COMMAND"; break; - case 'j'|0x80: head = " PPID PID PGID SID TTY TPGID S UID TIME COMMAND"; break; - case 'l'|0x80: head = " F UID PID PPID PRI NI VSZ RSS WCHAN S TTY TIME COMMAND"; break; - } - printf("%s\n",head); - } - if(want_one_pid){ - if(stat2proc(want_one_pid)) print_proc(); - else exit(1); - }else{ - struct dirent *ent; /* dirent handle */ - DIR *dir; - int ouruid; - int found_a_proc; - found_a_proc = 0; - ouruid = getuid(); - dir = opendir("/proc"); - while(( ent = readdir(dir) )){ - if(*ent->d_name<'0' || *ent->d_name>'9') continue; - if(!stat2proc(atoi(ent->d_name))) continue; - if(want_one_command){ - if(strcmp(want_one_command,P_cmd)) continue; - }else{ - if(!select_notty && P_tty==-1) continue; - if(!select_all && P_euid!=ouruid) continue; - } - found_a_proc++; - print_proc(); - } - closedir(dir); - exit(!found_a_proc); - } - return 0; -} diff --git a/klibc/klibc/tests/mmaptest.c b/klibc/klibc/tests/mmaptest.c new file mode 100644 index 0000000000..a654affb83 --- /dev/null +++ b/klibc/klibc/tests/mmaptest.c @@ -0,0 +1,28 @@ +/* + * mmaptest.c + * + * Test some simple cases of mmap() + */ + +#include +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + void *foo; + + (void)argc; (void)argv; + + /* Important case, this is how we get memory for malloc() */ + errno = 0; + foo = mmap(0, 65536, PROT_READ|PROT_WRITE, + MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); + + printf("mmap() returned %p, errno = %d\n", foo, errno); + + return 0; +} diff --git a/klibc/klibc/tests/opentest.c b/klibc/klibc/tests/opentest.c new file mode 100644 index 0000000000..5a54d2fce2 --- /dev/null +++ b/klibc/klibc/tests/opentest.c @@ -0,0 +1,17 @@ +#include + +int main(void) +{ + char buffer[1024]; + FILE *f; + + f = fopen("/etc/passwd", "r"); + fgets(buffer, 1024, f); + fclose(f); + + printf("Line 1 = %s", buffer); + + return 0; +} + + diff --git a/klibc/klibc/tests/stat.c b/klibc/klibc/tests/stat.c new file mode 100644 index 0000000000..74b0bddf44 --- /dev/null +++ b/klibc/klibc/tests/stat.c @@ -0,0 +1,65 @@ +#include +#include +#include +#include +#include +#include + +static void do_stat(const char *path) +{ + struct stat st; + + if ( stat(path, &st) ) { + perror(path); + exit(1); + } + + printf("Path = %s\n" + " st_dev = %#jx (%u,%u)\n" + " st_ino = %ju\n" + " st_mode = %#jo\n" + " st_nlink = %ju\n" + " st_uid = %ju\n" + " st_gid = %ju\n" + " st_rdev = %#jx (%u,%u)\n" + " st_size = %ju\n" + " st_blksize = %ju\n" + " st_blocks = %ju\n", + path, + (uintmax_t)st.st_dev, major(st.st_dev), minor(st.st_dev), + (uintmax_t)st.st_ino, + (uintmax_t)st.st_mode, + (uintmax_t)st.st_nlink, + (uintmax_t)st.st_uid, + (uintmax_t)st.st_gid, + (uintmax_t)st.st_rdev, major(st.st_rdev), minor(st.st_rdev), + (uintmax_t)st.st_size, + (uintmax_t)st.st_blksize, + (uintmax_t)st.st_blocks); + +#ifdef _STATBUF_ST_NSEC + printf(" st_atim = %jd.%09u\n" + " st.mtim = %jd.%09u\n" + " st.ctim = %jd.%09u\n", + (uintmax_t)st.st_atim.tv_sec, (unsigned int)st.st_atim.tv_nsec, + (uintmax_t)st.st_mtim.tv_sec, (unsigned int)st.st_mtim.tv_nsec, + (uintmax_t)st.st_ctim.tv_sec, (unsigned int)st.st_ctim.tv_nsec); +#else + printf(" st_atime = %jd\n" + " st.mtime = %jd\n" + " st.ctime = %jd\n", + (uintmax_t)st.st_atime, + (uintmax_t)st.st_mtime, + (uintmax_t)st.st_ctime); +#endif +} + +int main(int argc, char *argv[]) +{ + int i; + + for ( i = 1 ; i < argc ; i++ ) + do_stat(argv[i]); + + return 0; +} diff --git a/klibc/klibc/tests/statfs.c b/klibc/klibc/tests/statfs.c new file mode 100644 index 0000000000..9b7a26d916 --- /dev/null +++ b/klibc/klibc/tests/statfs.c @@ -0,0 +1,43 @@ +#include +#include +#include +#include + +static void do_statfs(const char *path) +{ + struct statfs sfs; + + if ( statfs(path, &sfs) ) { + perror(path); + exit(1); + } + + printf("Path = %s\n" + " f_type = %#jx\n" + " f_bsize = %jd\n" + " f_blocks = %jd\n" + " f_bfree = %jd\n" + " f_bavail = %jd\n" + " f_files = %jd\n" + " f_ffree = %jd\n" + " f_namelen = %jd\n", + path, + (uintmax_t)sfs.f_type, + (intmax_t)sfs.f_bsize, + (intmax_t)sfs.f_blocks, + (intmax_t)sfs.f_bfree, + (intmax_t)sfs.f_bavail, + (intmax_t)sfs.f_files, + (intmax_t)sfs.f_ffree, + (intmax_t)sfs.f_namelen); +} + +int main(int argc, char *argv[]) +{ + int i; + + for ( i = 1 ; i < argc ; i++ ) + do_statfs(argv[i]); + + return 0; +} diff --git a/klibc/klibc/tests/strtoimax.c b/klibc/klibc/tests/strtoimax.c new file mode 100644 index 0000000000..5af0d7912b --- /dev/null +++ b/klibc/klibc/tests/strtoimax.c @@ -0,0 +1,24 @@ +/* + * strtoimaxtest.c + */ + +#include +#include +#include + +int main(int argc, char *argv[]) +{ + int i; + char *ep; + intmax_t iv; + + for ( i = 1 ; i < argc ; i++ ) { + iv = strtoimax(argv[i], &ep, 0); + printf("strtoimax(\"%s\") = %jd\n", argv[i], iv); + if ( *ep ) + printf(" ep = \"%s\"\n", ep); + } + + return 0; +} + diff --git a/klibc/klibc/tests/strtotime.c b/klibc/klibc/tests/strtotime.c new file mode 100644 index 0000000000..815d40da99 --- /dev/null +++ b/klibc/klibc/tests/strtotime.c @@ -0,0 +1,27 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + struct timeval tv; + struct timespec ts; + int i; + const char *rv, *rs; + + for ( i = 1 ; i < argc ; i++ ) { + rs = strtotimespec(argv[i], &ts); + rv = strtotimeval(argv[i], &tv); + printf("String: \"%s\"\n" + "Timespec: %ld.%09ld\n" + "Residual: \"%s\"\n" + "Timeval: %ld.%06ld\n" + "Residual: \"%s\"\n", + argv[i], + (long)ts.tv_sec, (long)ts.tv_nsec, rs, + (long)tv.tv_sec, (long)tv.tv_usec, rv); + } + + return 0; +} + + diff --git a/klibc/klibc/time.c b/klibc/klibc/time.c index 8f6e89738d..92f82ccee0 100644 --- a/klibc/klibc/time.c +++ b/klibc/klibc/time.c @@ -6,11 +6,7 @@ #include #include -#ifdef __NR_time - -_syscall1(time_t,time,time_t *,t); - -#else +#ifndef __NR_time time_t time(time_t *t) { diff --git a/klibc/klibc/utime.c b/klibc/klibc/utime.c index a00b589629..2c8607756a 100644 --- a/klibc/klibc/utime.c +++ b/klibc/klibc/utime.c @@ -7,13 +7,7 @@ #include #include -#ifdef __NR_utime - -_syscall2(int,utime,const char *,filename,const struct utimbuf *,buf); - -#else - -static inline _syscall2(int,utimes,const char *,filename, const struct timeval *,tvp); +#ifndef __NR_utime int utime(const char *filename, const struct utimbuf *buf) { diff --git a/klibc/klibc/vasprintf.c b/klibc/klibc/vasprintf.c new file mode 100644 index 0000000000..5066dbbfaf --- /dev/null +++ b/klibc/klibc/vasprintf.c @@ -0,0 +1,25 @@ +/* + * vasprintf.c + */ + +#include +#include +#include + +int vasprintf(char **bufp, const char *format, va_list ap) +{ + va_list ap1; + int bytes; + char *p; + + va_copy(ap1, ap); + + bytes = vsnprintf(NULL, 0, format, ap1); + va_end(ap1); + + *bufp = p = malloc(bytes+1); + if ( !p ) + return -1; + + return vsnprintf(p, bytes, format, ap); +} diff --git a/klibc/version b/klibc/version index 31ba1bdaa5..30a3f4aab8 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.117 +0.181 -- cgit v1.2.3-54-g00ecf From 60d1e263f0da2976938fa54efec88ab777a6b3c3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 5 Oct 2004 18:51:53 -0700 Subject: [PATCH] oops forgot to add the new klibc/include directory --- klibc/include/alloca.h | 13 ++ klibc/include/arch/alpha/klibc/archsetjmp.h | 33 ++++ klibc/include/arch/alpha/klibc/archsignal.h | 13 ++ klibc/include/arch/alpha/klibc/archstat.h | 26 +++ klibc/include/arch/alpha/klibc/archsys.h | 53 ++++++ klibc/include/arch/alpha/machine/asm.h | 44 +++++ klibc/include/arch/arm/klibc/archsetjmp.h | 14 ++ klibc/include/arch/arm/klibc/archsignal.h | 13 ++ klibc/include/arch/arm/klibc/archstat.h | 45 +++++ klibc/include/arch/arm/klibc/archsys.h | 12 ++ klibc/include/arch/cris/klibc/archsetjmp.h | 24 +++ klibc/include/arch/cris/klibc/archsignal.h | 13 ++ klibc/include/arch/cris/klibc/archstat.h | 37 +++++ klibc/include/arch/cris/klibc/archsys.h | 12 ++ klibc/include/arch/i386/klibc/archsetjmp.h | 19 +++ klibc/include/arch/i386/klibc/archsignal.h | 13 ++ klibc/include/arch/i386/klibc/archstat.h | 37 +++++ klibc/include/arch/i386/klibc/archsys.h | 12 ++ klibc/include/arch/i386/klibc/diverr.h | 16 ++ klibc/include/arch/i386/sys/io.h | 126 ++++++++++++++ klibc/include/arch/i386/sys/vm86.h | 41 +++++ klibc/include/arch/ia64/klibc/archsetjmp.h | 17 ++ klibc/include/arch/ia64/klibc/archsignal.h | 31 ++++ klibc/include/arch/ia64/klibc/archstat.h | 24 +++ klibc/include/arch/ia64/klibc/archsys.h | 218 +++++++++++++++++++++++++ klibc/include/arch/m68k/klibc/archsignal.h | 13 ++ klibc/include/arch/m68k/klibc/archstat.h | 37 +++++ klibc/include/arch/m68k/klibc/archsys.h | 12 ++ klibc/include/arch/mips/klibc/archfcntl.h | 87 ++++++++++ klibc/include/arch/mips/klibc/archsetjmp.h | 39 +++++ klibc/include/arch/mips/klibc/archsignal.h | 13 ++ klibc/include/arch/mips/klibc/archstat.h | 39 +++++ klibc/include/arch/mips/klibc/archsys.h | 12 ++ klibc/include/arch/mips/machine/asm.h | 11 ++ klibc/include/arch/mips/sgidefs.h | 20 +++ klibc/include/arch/mips/spaces.h | 1 + klibc/include/arch/mips64/klibc/archsignal.h | 13 ++ klibc/include/arch/mips64/klibc/archstat.h | 33 ++++ klibc/include/arch/mips64/klibc/archsys.h | 12 ++ klibc/include/arch/parisc/klibc/archsignal.h | 24 +++ klibc/include/arch/parisc/klibc/archstat.h | 27 +++ klibc/include/arch/parisc/klibc/archsys.h | 12 ++ klibc/include/arch/ppc/klibc/archsetjmp.h | 36 ++++ klibc/include/arch/ppc/klibc/archsignal.h | 13 ++ klibc/include/arch/ppc/klibc/archstat.h | 28 ++++ klibc/include/arch/ppc/klibc/archsys.h | 61 +++++++ klibc/include/arch/ppc64/klibc/archsetjmp.h | 36 ++++ klibc/include/arch/ppc64/klibc/archsignal.h | 13 ++ klibc/include/arch/ppc64/klibc/archstat.h | 25 +++ klibc/include/arch/ppc64/klibc/archsys.h | 52 ++++++ klibc/include/arch/s390/klibc/archsetjmp.h | 15 ++ klibc/include/arch/s390/klibc/archsignal.h | 13 ++ klibc/include/arch/s390/klibc/archstat.h | 31 ++++ klibc/include/arch/s390/klibc/archsys.h | 41 +++++ klibc/include/arch/s390x/klibc/archsetjmp.h | 15 ++ klibc/include/arch/s390x/klibc/archsignal.h | 13 ++ klibc/include/arch/s390x/klibc/archstat.h | 24 +++ klibc/include/arch/s390x/klibc/archsys.h | 41 +++++ klibc/include/arch/sh/klibc/archsetjmp.h | 22 +++ klibc/include/arch/sh/klibc/archsignal.h | 13 ++ klibc/include/arch/sh/klibc/archstat.h | 45 +++++ klibc/include/arch/sh/klibc/archsys.h | 12 ++ klibc/include/arch/sparc/klibc/archsetjmp.h | 16 ++ klibc/include/arch/sparc/klibc/archsignal.h | 13 ++ klibc/include/arch/sparc/klibc/archstat.h | 35 ++++ klibc/include/arch/sparc/klibc/archsys.h | 10 ++ klibc/include/arch/sparc/machine/asm.h | 192 ++++++++++++++++++++++ klibc/include/arch/sparc/machine/frame.h | 138 ++++++++++++++++ klibc/include/arch/sparc/machine/trap.h | 141 ++++++++++++++++ klibc/include/arch/sparc64/klibc/archsetjmp.h | 16 ++ klibc/include/arch/sparc64/klibc/archsignal.h | 13 ++ klibc/include/arch/sparc64/klibc/archstat.h | 22 +++ klibc/include/arch/sparc64/klibc/archsys.h | 10 ++ klibc/include/arch/x86_64/klibc/archsetjmp.h | 21 +++ klibc/include/arch/x86_64/klibc/archsignal.h | 13 ++ klibc/include/arch/x86_64/klibc/archstat.h | 26 +++ klibc/include/arch/x86_64/klibc/archsys.h | 109 +++++++++++++ klibc/include/arch/x86_64/sys/io.h | 126 ++++++++++++++ klibc/include/arpa/inet.h | 24 +++ klibc/include/assert.h | 22 +++ klibc/include/bits32/bitsize/limits.h | 14 ++ klibc/include/bits32/bitsize/stddef.h | 18 ++ klibc/include/bits32/bitsize/stdint.h | 34 ++++ klibc/include/bits32/bitsize/stdintconst.h | 18 ++ klibc/include/bits32/bitsize/stdintlimits.h | 22 +++ klibc/include/bits64/bitsize/limits.h | 14 ++ klibc/include/bits64/bitsize/stddef.h | 13 ++ klibc/include/bits64/bitsize/stdint.h | 36 ++++ klibc/include/bits64/bitsize/stdintconst.h | 18 ++ klibc/include/bits64/bitsize/stdintlimits.h | 22 +++ klibc/include/ctype.h | 119 ++++++++++++++ klibc/include/dirent.h | 32 ++++ klibc/include/elf.h | 12 ++ klibc/include/endian.h | 42 +++++ klibc/include/errno.h | 8 + klibc/include/fcntl.h | 46 ++++++ klibc/include/grp.h | 13 ++ klibc/include/inttypes.h | 226 ++++++++++++++++++++++++++ klibc/include/klibc/compiler.h | 119 ++++++++++++++ klibc/include/klibc/diverr.h | 16 ++ klibc/include/klibc/extern.h | 14 ++ klibc/include/klibc/sysconfig.h | 34 ++++ klibc/include/limits.h | 40 +++++ klibc/include/net/if.h | 1 + klibc/include/net/if_arp.h | 1 + klibc/include/net/if_ether.h | 1 + klibc/include/net/if_packet.h | 1 + klibc/include/netinet/in.h | 39 +++++ klibc/include/netinet/in6.h | 10 ++ klibc/include/netinet/ip.h | 13 ++ klibc/include/netinet/tcp.h | 11 ++ klibc/include/netinet/udp.h | 19 +++ klibc/include/paths.h | 74 +++++++++ klibc/include/poll.h | 16 ++ klibc/include/sched.h | 34 ++++ klibc/include/setjmp.h | 43 +++++ klibc/include/signal.h | 81 +++++++++ klibc/include/stdarg.h | 14 ++ klibc/include/stddef.h | 24 +++ klibc/include/stdint.h | 116 +++++++++++++ klibc/include/stdio.h | 123 ++++++++++++++ klibc/include/stdlib.h | 90 ++++++++++ klibc/include/string.h | 43 +++++ klibc/include/sys/dirent.h | 21 +++ klibc/include/sys/elf32.h | 115 +++++++++++++ klibc/include/sys/elf64.h | 115 +++++++++++++ klibc/include/sys/elfcommon.h | 188 +++++++++++++++++++++ klibc/include/sys/fsuid.h | 14 ++ klibc/include/sys/ioctl.h | 14 ++ klibc/include/sys/klog.h | 24 +++ klibc/include/sys/mman.h | 25 +++ klibc/include/sys/mount.h | 55 +++++++ klibc/include/sys/param.h | 11 ++ klibc/include/sys/reboot.h | 25 +++ klibc/include/sys/resource.h | 15 ++ klibc/include/sys/select.h | 13 ++ klibc/include/sys/socket.h | 50 ++++++ klibc/include/sys/socketcalls.h | 28 ++++ klibc/include/sys/stat.h | 31 ++++ klibc/include/sys/statfs.h | 1 + klibc/include/sys/syscall.h | 17 ++ klibc/include/sys/sysinfo.h | 12 ++ klibc/include/sys/sysmacros.h | 31 ++++ klibc/include/sys/time.h | 18 ++ klibc/include/sys/times.h | 14 ++ klibc/include/sys/types.h | 104 ++++++++++++ klibc/include/sys/uio.h | 15 ++ klibc/include/sys/un.h | 10 ++ klibc/include/sys/utime.h | 10 ++ klibc/include/sys/utsname.h | 23 +++ klibc/include/sys/vfs.h | 111 +++++++++++++ klibc/include/sys/wait.h | 28 ++++ klibc/include/syslog.h | 55 +++++++ klibc/include/termios.h | 86 ++++++++++ klibc/include/time.h | 18 ++ klibc/include/unistd.h | 140 ++++++++++++++++ klibc/include/utime.h | 15 ++ 157 files changed, 5943 insertions(+) create mode 100644 klibc/include/alloca.h create mode 100644 klibc/include/arch/alpha/klibc/archsetjmp.h create mode 100644 klibc/include/arch/alpha/klibc/archsignal.h create mode 100644 klibc/include/arch/alpha/klibc/archstat.h create mode 100644 klibc/include/arch/alpha/klibc/archsys.h create mode 100644 klibc/include/arch/alpha/machine/asm.h create mode 100644 klibc/include/arch/arm/klibc/archsetjmp.h create mode 100644 klibc/include/arch/arm/klibc/archsignal.h create mode 100644 klibc/include/arch/arm/klibc/archstat.h create mode 100644 klibc/include/arch/arm/klibc/archsys.h create mode 100644 klibc/include/arch/cris/klibc/archsetjmp.h create mode 100644 klibc/include/arch/cris/klibc/archsignal.h create mode 100644 klibc/include/arch/cris/klibc/archstat.h create mode 100644 klibc/include/arch/cris/klibc/archsys.h create mode 100644 klibc/include/arch/i386/klibc/archsetjmp.h create mode 100644 klibc/include/arch/i386/klibc/archsignal.h create mode 100644 klibc/include/arch/i386/klibc/archstat.h create mode 100644 klibc/include/arch/i386/klibc/archsys.h create mode 100644 klibc/include/arch/i386/klibc/diverr.h create mode 100644 klibc/include/arch/i386/sys/io.h create mode 100644 klibc/include/arch/i386/sys/vm86.h create mode 100644 klibc/include/arch/ia64/klibc/archsetjmp.h create mode 100644 klibc/include/arch/ia64/klibc/archsignal.h create mode 100644 klibc/include/arch/ia64/klibc/archstat.h create mode 100644 klibc/include/arch/ia64/klibc/archsys.h create mode 100644 klibc/include/arch/m68k/klibc/archsignal.h create mode 100644 klibc/include/arch/m68k/klibc/archstat.h create mode 100644 klibc/include/arch/m68k/klibc/archsys.h create mode 100644 klibc/include/arch/mips/klibc/archfcntl.h create mode 100644 klibc/include/arch/mips/klibc/archsetjmp.h create mode 100644 klibc/include/arch/mips/klibc/archsignal.h create mode 100644 klibc/include/arch/mips/klibc/archstat.h create mode 100644 klibc/include/arch/mips/klibc/archsys.h create mode 100644 klibc/include/arch/mips/machine/asm.h create mode 100644 klibc/include/arch/mips/sgidefs.h create mode 100644 klibc/include/arch/mips/spaces.h create mode 100644 klibc/include/arch/mips64/klibc/archsignal.h create mode 100644 klibc/include/arch/mips64/klibc/archstat.h create mode 100644 klibc/include/arch/mips64/klibc/archsys.h create mode 100644 klibc/include/arch/parisc/klibc/archsignal.h create mode 100644 klibc/include/arch/parisc/klibc/archstat.h create mode 100644 klibc/include/arch/parisc/klibc/archsys.h create mode 100644 klibc/include/arch/ppc/klibc/archsetjmp.h create mode 100644 klibc/include/arch/ppc/klibc/archsignal.h create mode 100644 klibc/include/arch/ppc/klibc/archstat.h create mode 100644 klibc/include/arch/ppc/klibc/archsys.h create mode 100644 klibc/include/arch/ppc64/klibc/archsetjmp.h create mode 100644 klibc/include/arch/ppc64/klibc/archsignal.h create mode 100644 klibc/include/arch/ppc64/klibc/archstat.h create mode 100644 klibc/include/arch/ppc64/klibc/archsys.h create mode 100644 klibc/include/arch/s390/klibc/archsetjmp.h create mode 100644 klibc/include/arch/s390/klibc/archsignal.h create mode 100644 klibc/include/arch/s390/klibc/archstat.h create mode 100644 klibc/include/arch/s390/klibc/archsys.h create mode 100644 klibc/include/arch/s390x/klibc/archsetjmp.h create mode 100644 klibc/include/arch/s390x/klibc/archsignal.h create mode 100644 klibc/include/arch/s390x/klibc/archstat.h create mode 100644 klibc/include/arch/s390x/klibc/archsys.h create mode 100644 klibc/include/arch/sh/klibc/archsetjmp.h create mode 100644 klibc/include/arch/sh/klibc/archsignal.h create mode 100644 klibc/include/arch/sh/klibc/archstat.h create mode 100644 klibc/include/arch/sh/klibc/archsys.h create mode 100644 klibc/include/arch/sparc/klibc/archsetjmp.h create mode 100644 klibc/include/arch/sparc/klibc/archsignal.h create mode 100644 klibc/include/arch/sparc/klibc/archstat.h create mode 100644 klibc/include/arch/sparc/klibc/archsys.h create mode 100644 klibc/include/arch/sparc/machine/asm.h create mode 100644 klibc/include/arch/sparc/machine/frame.h create mode 100644 klibc/include/arch/sparc/machine/trap.h create mode 100644 klibc/include/arch/sparc64/klibc/archsetjmp.h create mode 100644 klibc/include/arch/sparc64/klibc/archsignal.h create mode 100644 klibc/include/arch/sparc64/klibc/archstat.h create mode 100644 klibc/include/arch/sparc64/klibc/archsys.h create mode 100644 klibc/include/arch/x86_64/klibc/archsetjmp.h create mode 100644 klibc/include/arch/x86_64/klibc/archsignal.h create mode 100644 klibc/include/arch/x86_64/klibc/archstat.h create mode 100644 klibc/include/arch/x86_64/klibc/archsys.h create mode 100644 klibc/include/arch/x86_64/sys/io.h create mode 100644 klibc/include/arpa/inet.h create mode 100644 klibc/include/assert.h create mode 100644 klibc/include/bits32/bitsize/limits.h create mode 100644 klibc/include/bits32/bitsize/stddef.h create mode 100644 klibc/include/bits32/bitsize/stdint.h create mode 100644 klibc/include/bits32/bitsize/stdintconst.h create mode 100644 klibc/include/bits32/bitsize/stdintlimits.h create mode 100644 klibc/include/bits64/bitsize/limits.h create mode 100644 klibc/include/bits64/bitsize/stddef.h create mode 100644 klibc/include/bits64/bitsize/stdint.h create mode 100644 klibc/include/bits64/bitsize/stdintconst.h create mode 100644 klibc/include/bits64/bitsize/stdintlimits.h create mode 100644 klibc/include/ctype.h create mode 100644 klibc/include/dirent.h create mode 100644 klibc/include/elf.h create mode 100644 klibc/include/endian.h create mode 100644 klibc/include/errno.h create mode 100644 klibc/include/fcntl.h create mode 100644 klibc/include/grp.h create mode 100644 klibc/include/inttypes.h create mode 100644 klibc/include/klibc/compiler.h create mode 100644 klibc/include/klibc/diverr.h create mode 100644 klibc/include/klibc/extern.h create mode 100644 klibc/include/klibc/sysconfig.h create mode 100644 klibc/include/limits.h create mode 100644 klibc/include/net/if.h create mode 100644 klibc/include/net/if_arp.h create mode 100644 klibc/include/net/if_ether.h create mode 100644 klibc/include/net/if_packet.h create mode 100644 klibc/include/netinet/in.h create mode 100644 klibc/include/netinet/in6.h create mode 100644 klibc/include/netinet/ip.h create mode 100644 klibc/include/netinet/tcp.h create mode 100644 klibc/include/netinet/udp.h create mode 100644 klibc/include/paths.h create mode 100644 klibc/include/poll.h create mode 100644 klibc/include/sched.h create mode 100644 klibc/include/setjmp.h create mode 100644 klibc/include/signal.h create mode 100644 klibc/include/stdarg.h create mode 100644 klibc/include/stddef.h create mode 100644 klibc/include/stdint.h create mode 100644 klibc/include/stdio.h create mode 100644 klibc/include/stdlib.h create mode 100644 klibc/include/string.h create mode 100644 klibc/include/sys/dirent.h create mode 100644 klibc/include/sys/elf32.h create mode 100644 klibc/include/sys/elf64.h create mode 100644 klibc/include/sys/elfcommon.h create mode 100644 klibc/include/sys/fsuid.h create mode 100644 klibc/include/sys/ioctl.h create mode 100644 klibc/include/sys/klog.h create mode 100644 klibc/include/sys/mman.h create mode 100644 klibc/include/sys/mount.h create mode 100644 klibc/include/sys/param.h create mode 100644 klibc/include/sys/reboot.h create mode 100644 klibc/include/sys/resource.h create mode 100644 klibc/include/sys/select.h create mode 100644 klibc/include/sys/socket.h create mode 100644 klibc/include/sys/socketcalls.h create mode 100644 klibc/include/sys/stat.h create mode 100644 klibc/include/sys/statfs.h create mode 100644 klibc/include/sys/syscall.h create mode 100644 klibc/include/sys/sysinfo.h create mode 100644 klibc/include/sys/sysmacros.h create mode 100644 klibc/include/sys/time.h create mode 100644 klibc/include/sys/times.h create mode 100644 klibc/include/sys/types.h create mode 100644 klibc/include/sys/uio.h create mode 100644 klibc/include/sys/un.h create mode 100644 klibc/include/sys/utime.h create mode 100644 klibc/include/sys/utsname.h create mode 100644 klibc/include/sys/vfs.h create mode 100644 klibc/include/sys/wait.h create mode 100644 klibc/include/syslog.h create mode 100644 klibc/include/termios.h create mode 100644 klibc/include/time.h create mode 100644 klibc/include/unistd.h create mode 100644 klibc/include/utime.h diff --git a/klibc/include/alloca.h b/klibc/include/alloca.h new file mode 100644 index 0000000000..41a4d94d44 --- /dev/null +++ b/klibc/include/alloca.h @@ -0,0 +1,13 @@ +/* + * alloca.h + * + * Just call the builtin alloca() function + */ + +#ifndef _ALLOCA_H +#define _ALLOCA_H + +#define alloca(size) __builtin_alloca(size) + +#endif /* _ALLOCA_H */ + diff --git a/klibc/include/arch/alpha/klibc/archsetjmp.h b/klibc/include/arch/alpha/klibc/archsetjmp.h new file mode 100644 index 0000000000..9dc570a6f5 --- /dev/null +++ b/klibc/include/arch/alpha/klibc/archsetjmp.h @@ -0,0 +1,33 @@ +/* + * arch/alpha/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __s0; + unsigned long __s1; + unsigned long __s2; + unsigned long __s3; + unsigned long __s4; + unsigned long __s5; + unsigned long __fp; + unsigned long __ra; + unsigned long __gp; + unsigned long __sp; + + unsigned long __f2; + unsigned long __f3; + unsigned long __f4; + unsigned long __f5; + unsigned long __f6; + unsigned long __f7; + unsigned long __f8; + unsigned long __f9; +}; + +/* Must be an array so it will decay to a pointer when a function is called */ +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/alpha/klibc/archsignal.h b/klibc/include/arch/alpha/klibc/archsignal.h new file mode 100644 index 0000000000..b870a05131 --- /dev/null +++ b/klibc/include/arch/alpha/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/alpha/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/alpha/klibc/archstat.h b/klibc/include/arch/alpha/klibc/archstat.h new file mode 100644 index 0000000000..23302d737d --- /dev/null +++ b/klibc/include/arch/alpha/klibc/archstat.h @@ -0,0 +1,26 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +struct stat { + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_rdev; + long st_size; + unsigned long st_blocks; + + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int st_blksize; + unsigned int st_nlink; + unsigned int __pad0; + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long __unused[3]; +}; + +#endif diff --git a/klibc/include/arch/alpha/klibc/archsys.h b/klibc/include/arch/alpha/klibc/archsys.h new file mode 100644 index 0000000000..16ed658987 --- /dev/null +++ b/klibc/include/arch/alpha/klibc/archsys.h @@ -0,0 +1,53 @@ +/* + * arch/alpha/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* Alpha has some bizarre Tru64-derived system calls which return two + different values in $0 and $20(!), respectively. The standard + macros can't deal with these; even the ones that give the right + return value have the wrong clobbers. */ + +#define _syscall0_dual0(type, name) \ +type name(void) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_19 __asm__("$19"); \ + register long _sc_20 __asm__("$20"); \ + \ + _sc_0 = __NR_##name; \ + __asm__("callsys" \ + : "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \ + : "0"(_sc_0) \ + : _syscall_clobbers); \ + _sc_ret = _sc_0, _sc_err = _sc_19; (void)(_sc_20); \ + } \ + _syscall_return(type); \ +} + +#define _syscall0_dual1(type, name) \ +type name(void) \ +{ \ + long _sc_ret, _sc_err; \ + { \ + register long _sc_0 __asm__("$0"); \ + register long _sc_19 __asm__("$19"); \ + register long _sc_20 __asm__("$20"); \ + \ + _sc_0 = __NR_##name; \ + __asm__("callsys" \ + : "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \ + : "0"(_sc_0) \ + : _syscall_clobbers); \ + _sc_ret = _sc_20, _sc_err = _sc_19; (void)(_sc_0); \ + } \ + _syscall_return(type); \ +} + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/alpha/machine/asm.h b/klibc/include/arch/alpha/machine/asm.h new file mode 100644 index 0000000000..e22db90412 --- /dev/null +++ b/klibc/include/arch/alpha/machine/asm.h @@ -0,0 +1,44 @@ +/* + * machine/asm.h + */ + +#ifndef _MACHINE_ASM_H +#define _MACHINE_ASM_H + +/* Standard aliases for Alpha register names */ + +#define v0 $0 +#define t0 $1 +#define t1 $2 +#define t2 $3 +#define t3 $4 +#define t4 $5 +#define t5 $6 +#define t6 $7 +#define t7 $8 +#define s0 $9 +#define s1 $10 +#define s2 $11 +#define s3 $12 +#define s4 $13 +#define s5 $14 +#define fp $15 +#define a0 $16 +#define a1 $17 +#define a2 $18 +#define a3 $19 +#define a4 $20 +#define a5 $21 +#define t8 $22 +#define t9 $23 +#define t10 $24 +#define t11 $25 +#define ra $26 +#define t12 $27 /* t12 and pv are both used for $27 */ +#define pv $27 /* t12 and pv are both used for $27 */ +#define at $28 +#define gp $29 +#define sp $30 +#define zero $31 + +#endif /* _MACHINE_ASM_H */ diff --git a/klibc/include/arch/arm/klibc/archsetjmp.h b/klibc/include/arch/arm/klibc/archsetjmp.h new file mode 100644 index 0000000000..c956b50a90 --- /dev/null +++ b/klibc/include/arch/arm/klibc/archsetjmp.h @@ -0,0 +1,14 @@ +/* + * arch/i386/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned int regs[10]; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/arm/klibc/archsignal.h b/klibc/include/arch/arm/klibc/archsignal.h new file mode 100644 index 0000000000..77685e62f0 --- /dev/null +++ b/klibc/include/arch/arm/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/arm/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/arm/klibc/archstat.h b/klibc/include/arch/arm/klibc/archstat.h new file mode 100644 index 0000000000..42b1409f67 --- /dev/null +++ b/klibc/include/arch/arm/klibc/archstat.h @@ -0,0 +1,45 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#include + +#define _STATBUF_ST_NSEC + +/* This matches struct stat64 in glibc2.1, hence the absolutely + * insane amounts of padding around dev_t's. + * Note: The kernel zero's the padded region because glibc might read them + * in the hope that the kernel has stretched to using larger sizes. + */ +struct stat { + unsigned long long st_dev; + unsigned char __pad0[4]; + + unsigned long __st_ino; + unsigned int st_mode; + unsigned int st_nlink; + + unsigned long st_uid; + unsigned long st_gid; + + unsigned long long st_rdev; + unsigned char __pad3[4]; + + long long st_size; + unsigned long st_blksize; + +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned long __pad4; /* Future possible st_blocks hi bits */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ +#else /* Must be little */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long __pad4; /* Future possible st_blocks hi bits */ +#endif + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + + unsigned long long st_ino; +}; + +#endif diff --git a/klibc/include/arch/arm/klibc/archsys.h b/klibc/include/arch/arm/klibc/archsys.h new file mode 100644 index 0000000000..dfdc70a6de --- /dev/null +++ b/klibc/include/arch/arm/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/cris/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/cris/klibc/archsetjmp.h b/klibc/include/arch/cris/klibc/archsetjmp.h new file mode 100644 index 0000000000..8d20800609 --- /dev/null +++ b/klibc/include/arch/cris/klibc/archsetjmp.h @@ -0,0 +1,24 @@ +/* + * arch/cris/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __r0; + unsigned long __r1; + unsigned long __r2; + unsigned long __r3; + unsigned long __r4; + unsigned long __r5; + unsigned long __r6; + unsigned long __r7; + unsigned long __r8; + unsigned long __sp; + unsigned long __srp; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/cris/klibc/archsignal.h b/klibc/include/arch/cris/klibc/archsignal.h new file mode 100644 index 0000000000..73b2e196c9 --- /dev/null +++ b/klibc/include/arch/cris/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/cris/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/cris/klibc/archstat.h b/klibc/include/arch/cris/klibc/archstat.h new file mode 100644 index 0000000000..154820755f --- /dev/null +++ b/klibc/include/arch/cris/klibc/archstat.h @@ -0,0 +1,37 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +/* This matches struct stat64 in glibc2.1, hence the absolutely + * insane amounts of padding around dev_t's. + */ +struct stat { + unsigned long long st_dev; + unsigned char __pad0[4]; + + unsigned long __st_ino; + + unsigned int st_mode; + unsigned int st_nlink; + + unsigned long st_uid; + unsigned long st_gid; + + unsigned long long st_rdev; + unsigned char __pad3[4]; + + long long st_size; + unsigned long st_blksize; + + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long __pad4; /* future possible st_blocks high bits */ + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + + unsigned long long st_ino; +}; + +#endif diff --git a/klibc/include/arch/cris/klibc/archsys.h b/klibc/include/arch/cris/klibc/archsys.h new file mode 100644 index 0000000000..dfdc70a6de --- /dev/null +++ b/klibc/include/arch/cris/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/cris/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/i386/klibc/archsetjmp.h b/klibc/include/arch/i386/klibc/archsetjmp.h new file mode 100644 index 0000000000..db04314b8c --- /dev/null +++ b/klibc/include/arch/i386/klibc/archsetjmp.h @@ -0,0 +1,19 @@ +/* + * arch/i386/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned int __ebx; + unsigned int __esp; + unsigned int __ebp; + unsigned int __esi; + unsigned int __edi; + unsigned int __eip; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/i386/klibc/archsignal.h b/klibc/include/arch/i386/klibc/archsignal.h new file mode 100644 index 0000000000..b092ba6d3a --- /dev/null +++ b/klibc/include/arch/i386/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/i386/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/i386/klibc/archstat.h b/klibc/include/arch/i386/klibc/archstat.h new file mode 100644 index 0000000000..154820755f --- /dev/null +++ b/klibc/include/arch/i386/klibc/archstat.h @@ -0,0 +1,37 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +/* This matches struct stat64 in glibc2.1, hence the absolutely + * insane amounts of padding around dev_t's. + */ +struct stat { + unsigned long long st_dev; + unsigned char __pad0[4]; + + unsigned long __st_ino; + + unsigned int st_mode; + unsigned int st_nlink; + + unsigned long st_uid; + unsigned long st_gid; + + unsigned long long st_rdev; + unsigned char __pad3[4]; + + long long st_size; + unsigned long st_blksize; + + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long __pad4; /* future possible st_blocks high bits */ + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + + unsigned long long st_ino; +}; + +#endif diff --git a/klibc/include/arch/i386/klibc/archsys.h b/klibc/include/arch/i386/klibc/archsys.h new file mode 100644 index 0000000000..dfdc70a6de --- /dev/null +++ b/klibc/include/arch/i386/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/cris/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/i386/klibc/diverr.h b/klibc/include/arch/i386/klibc/diverr.h new file mode 100644 index 0000000000..410aba06d3 --- /dev/null +++ b/klibc/include/arch/i386/klibc/diverr.h @@ -0,0 +1,16 @@ +/* + * arch/i386/include/klibc/diverr.h + */ + +#ifndef _KLIBC_DIVERR_H +#define _KLIBC_DIVERR_H + +#include + +static __inline__ void +__divide_error(void) +{ + asm volatile("divl %0" :: "rm" (0) : "eax", "edx"); +} + +#endif /* _KLIBC_DIVERR_H */ diff --git a/klibc/include/arch/i386/sys/io.h b/klibc/include/arch/i386/sys/io.h new file mode 100644 index 0000000000..b051464dfc --- /dev/null +++ b/klibc/include/arch/i386/sys/io.h @@ -0,0 +1,126 @@ +#ident "$Id: io.h,v 1.2 2004/01/25 07:49:39 hpa Exp $" +/* ----------------------------------------------------------------------- * + * + * Copyright 2004 H. Peter Anvin - All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall + * be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * ----------------------------------------------------------------------- */ + +/* + * sys/io.h for the i386 architecture + * + * Basic I/O macros + */ + +#ifndef _SYS_IO_H +#define _SYS_IO_H 1 + +/* I/O-related system calls */ + +int iopl(int); +int ioperm(unsigned long, unsigned long, int); + +/* Basic I/O macros */ + +static __inline__ void +outb(unsigned char __v, unsigned short __p) +{ + asm volatile("outb %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ void +outw(unsigned short __v, unsigned short __p) +{ + asm volatile("outw %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ void +outl(unsigned int __v, unsigned short __p) +{ + asm volatile("outl %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ unsigned char +inb(unsigned short __p) +{ + unsigned char __v; + asm volatile("inb %1,%0" : "=a" (__v) : "dN" (__p)); + return __v; +} + +static __inline__ unsigned short +inw(unsigned short __p) +{ + unsigned short __v; + asm volatile("inw %1,%0" : "=a" (__v) : "dN" (__p)); + return __v; +} + +static __inline__ unsigned int +inl(unsigned short __p) +{ + unsigned int __v; + asm volatile("inl %1,%0" : "=a" (__v) : "dN" (__p)); + return __v; +} + +/* String I/O macros */ + +static __inline__ void +outsb (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsb" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +outsw (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsw" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +outsl (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsl" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + + +static __inline__ void +insb (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insb" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +insw (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insw" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +insl (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insl" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +#endif /* _SYS_IO_H */ diff --git a/klibc/include/arch/i386/sys/vm86.h b/klibc/include/arch/i386/sys/vm86.h new file mode 100644 index 0000000000..d3272393dc --- /dev/null +++ b/klibc/include/arch/i386/sys/vm86.h @@ -0,0 +1,41 @@ +#ident "$Id: vm86.h,v 1.1 2004/01/25 01:34:28 hpa Exp $" +/* ----------------------------------------------------------------------- * + * + * Copyright 2004 H. Peter Anvin - All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall + * be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * ----------------------------------------------------------------------- */ + +/* + * sys/vm86.h for i386 + */ + +#ifndef _SYS_VM86_H +#define _SYS_VM86_H 1 + +#include + +/* Actual system call */ +int vm86(struct vm86_struct *); + +#endif diff --git a/klibc/include/arch/ia64/klibc/archsetjmp.h b/klibc/include/arch/ia64/klibc/archsetjmp.h new file mode 100644 index 0000000000..bd639c0b00 --- /dev/null +++ b/klibc/include/arch/ia64/klibc/archsetjmp.h @@ -0,0 +1,17 @@ +/* + * arch/ia64/include/klibc/archsetjmp.h + * + * Code borrowed from the FreeBSD kernel. + * + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +/* User code must not depend on the internal representation of jmp_buf. */ +#define _JBLEN 0x200 + +/* guaranteed 128-bit alignment! */ +typedef char jmp_buf[_JBLEN] __attribute__ ((aligned (16))); + +#endif diff --git a/klibc/include/arch/ia64/klibc/archsignal.h b/klibc/include/arch/ia64/klibc/archsignal.h new file mode 100644 index 0000000000..5b01f19bc2 --- /dev/null +++ b/klibc/include/arch/ia64/klibc/archsignal.h @@ -0,0 +1,31 @@ +/* + * arch/ia64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions. + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +#define _NSIG 64 +#define _NSIG_BPW 64 +#define _NSIG_WORDS (_NSIG / _NSIG_BPW) + +typedef struct { + unsigned long sig[_NSIG_WORDS]; +} sigset_t; + +struct sigaction { + union { + __sighandler_t _sa_handler; + void (*_sa_sigaction)(int, struct siginfo *, void *); + } _u; + sigset_t sa_mask; + int sa_flags; +}; + +#define sa_handler _u._sa_handler +#define sa_sigaction _u._sa_sigaction + +#endif diff --git a/klibc/include/arch/ia64/klibc/archstat.h b/klibc/include/arch/ia64/klibc/archstat.h new file mode 100644 index 0000000000..9475c0b797 --- /dev/null +++ b/klibc/include/arch/ia64/klibc/archstat.h @@ -0,0 +1,24 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +struct stat { + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_nlink; + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad0; + unsigned long st_rdev; + unsigned long st_size; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long st_blksize; + long st_blocks; + unsigned long __unused[3]; +}; + +#endif diff --git a/klibc/include/arch/ia64/klibc/archsys.h b/klibc/include/arch/ia64/klibc/archsys.h new file mode 100644 index 0000000000..4c795a43ca --- /dev/null +++ b/klibc/include/arch/ia64/klibc/archsys.h @@ -0,0 +1,218 @@ +/* + * arch/ia64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +#define __IA64_BREAK "break 0x100000;;\n\t" + +#define _syscall0(type,name) \ +type \ +name (void) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15) \ + : "2" (_r15) ASM_ARGS_0 \ + : "memory" ASM_CLOBBERS_0); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return (type)_retval; \ +} + +#define _syscall1(type,name,type1,arg1) \ +type \ +name (type1 arg1) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_1(arg1); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_1 \ + : "2" (_r15) ASM_ARGS_1 \ + : "memory" ASM_CLOBBERS_1); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return (type)_retval; \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type \ +name (type1 arg1, type2 arg2) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_2(arg1, arg2); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_2 \ + : "2" (_r15) ASM_ARGS_2 \ + : "memory" ASM_CLOBBERS_2); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return (type)_retval; \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type \ +name (type1 arg1, type2 arg2, type3 arg3) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_3(arg1, arg2, arg3); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_3 \ + : "2" (_r15) ASM_ARGS_3 \ + : "memory" ASM_CLOBBERS_3); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return (type)_retval; \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type \ +name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_4(arg1, arg2, arg3, arg4); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_4 \ + : "2" (_r15) ASM_ARGS_4 \ + : "memory" ASM_CLOBBERS_4); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return (type)_retval; \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ +type \ +name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_5(arg1, arg2, arg3, arg4, arg5); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_5 \ + : "2" (_r15) ASM_ARGS_5 \ + : "memory" ASM_CLOBBERS_5); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return (type)_retval; \ +} + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ +type \ +name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ +{ \ + register long _r8 asm ("r8"); \ + register long _r10 asm ("r10"); \ + register long _r15 asm ("r15") = __NR_##name; \ + long _retval; \ + LOAD_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6); \ + __asm __volatile (__IA64_BREAK \ + : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ + ASM_OUTARGS_6 \ + : "2" (_r15) ASM_ARGS_6 \ + : "memory" ASM_CLOBBERS_6); \ + _retval = _r8; \ + if (_r10 == -1) { \ + errno = (_retval); \ + _retval = -1; \ + } \ + return (type)_retval; \ +} + + +#define LOAD_ARGS_0() do { } while (0) +#define LOAD_ARGS_1(out0) \ + register long _out0 asm ("out0") = (long) (out0); \ + LOAD_ARGS_0 () +#define LOAD_ARGS_2(out0, out1) \ + register long _out1 asm ("out1") = (long) (out1); \ + LOAD_ARGS_1 (out0) +#define LOAD_ARGS_3(out0, out1, out2) \ + register long _out2 asm ("out2") = (long) (out2); \ + LOAD_ARGS_2 (out0, out1) +#define LOAD_ARGS_4(out0, out1, out2, out3) \ + register long _out3 asm ("out3") = (long) (out3); \ + LOAD_ARGS_3 (out0, out1, out2) +#define LOAD_ARGS_5(out0, out1, out2, out3, out4) \ + register long _out4 asm ("out4") = (long) (out4); \ + LOAD_ARGS_4 (out0, out1, out2, out3) +#define LOAD_ARGS_6(out0, out1, out2, out3, out4, out5) \ + register long _out5 asm ("out5") = (long) (out5); \ + LOAD_ARGS_5 (out0, out1, out2, out3, out4) + +#define ASM_OUTARGS_1 "=r" (_out0) +#define ASM_OUTARGS_2 ASM_OUTARGS_1, "=r" (_out1) +#define ASM_OUTARGS_3 ASM_OUTARGS_2, "=r" (_out2) +#define ASM_OUTARGS_4 ASM_OUTARGS_3, "=r" (_out3) +#define ASM_OUTARGS_5 ASM_OUTARGS_4, "=r" (_out4) +#define ASM_OUTARGS_6 ASM_OUTARGS_5, "=r" (_out5) + +#define ASM_ARGS_0 +#define ASM_ARGS_1 ASM_ARGS_0, "3" (_out0) +#define ASM_ARGS_2 ASM_ARGS_1, "4" (_out1) +#define ASM_ARGS_3 ASM_ARGS_2, "5" (_out2) +#define ASM_ARGS_4 ASM_ARGS_3, "6" (_out3) +#define ASM_ARGS_5 ASM_ARGS_4, "7" (_out4) +#define ASM_ARGS_6 ASM_ARGS_5, "8" (_out5) + +#define ASM_CLOBBERS_0 ASM_CLOBBERS_1, "out0" +#define ASM_CLOBBERS_1 ASM_CLOBBERS_2, "out1" +#define ASM_CLOBBERS_2 ASM_CLOBBERS_3, "out2" +#define ASM_CLOBBERS_3 ASM_CLOBBERS_4, "out3" +#define ASM_CLOBBERS_4 ASM_CLOBBERS_5, "out4" +#define ASM_CLOBBERS_5 ASM_CLOBBERS_6, "out5" +#define ASM_CLOBBERS_6 , "out6", "out7", \ + /* Non-stacked integer registers, minus r8, r10, r15. */ \ + "r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \ + "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \ + "r28", "r29", "r30", "r31", \ + /* Predicate registers. */ \ + "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \ + /* Non-rotating fp registers. */ \ + "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ + /* Branch registers. */ \ + "b6", "b7" + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/m68k/klibc/archsignal.h b/klibc/include/arch/m68k/klibc/archsignal.h new file mode 100644 index 0000000000..714527f6b0 --- /dev/null +++ b/klibc/include/arch/m68k/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/m68k/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/m68k/klibc/archstat.h b/klibc/include/arch/m68k/klibc/archstat.h new file mode 100644 index 0000000000..9c0a05da09 --- /dev/null +++ b/klibc/include/arch/m68k/klibc/archstat.h @@ -0,0 +1,37 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +/* This matches struct stat64 in glibc2.1, hence the absolutely + * insane amounts of padding around dev_t's. + */ +struct stat { + unsigned long long st_dev; + unsigned char __pad1[2]; + + unsigned long __st_ino; + + unsigned int st_mode; + unsigned int st_nlink; + + unsigned long st_uid; + unsigned long st_gid; + + unsigned long long st_rdev; + unsigned char __pad3[2]; + + long long st_size; + unsigned long st_blksize; + + unsigned long __pad4; /* future possible st_blocks high bits */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + + unsigned long long st_ino; +}; + +#endif diff --git a/klibc/include/arch/m68k/klibc/archsys.h b/klibc/include/arch/m68k/klibc/archsys.h new file mode 100644 index 0000000000..8f6bed8e94 --- /dev/null +++ b/klibc/include/arch/m68k/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/m68k/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/mips/klibc/archfcntl.h b/klibc/include/arch/mips/klibc/archfcntl.h new file mode 100644 index 0000000000..54462ea69f --- /dev/null +++ b/klibc/include/arch/mips/klibc/archfcntl.h @@ -0,0 +1,87 @@ +/* + * arch/mips/include/klibc/archfcntl.h + * + * On MIPS, isn't usable (compiling struct stat with + * the correct definitions doesn't "just work"), so we need to provide + * our own definitions. + */ + +#ifndef _KLIBC_ARCHFCNTL_H +#define _KLIBC_ARCHFCNTL_H + +#ifdef _ASM_FCNTL_H /* We were too late! */ +# error " included before " +#endif +#define _ASM_FCNTL_H /* Keep from getting included */ + +#define O_ACCMODE 0x0003 +#define O_RDONLY 0x0000 +#define O_WRONLY 0x0001 +#define O_RDWR 0x0002 +#define O_APPEND 0x0008 +#define O_SYNC 0x0010 +#define O_NONBLOCK 0x0080 +#define O_CREAT 0x0100 +#define O_TRUNC 0x0200 +#define O_EXCL 0x0400 +#define O_NOCTTY 0x0800 +#define FASYNC 0x1000 +#define O_LARGEFILE 0x2000 +#define O_DIRECT 0x8000 +#define O_DIRECTORY 0x10000 +#define O_NOFOLLOW 0x20000 +#define O_NOATIME 0x40000 + +#define O_NDELAY O_NONBLOCK + +#define F_DUPFD 0 +#define F_GETFD 1 +#define F_SETFD 2 +#define F_GETFL 3 +#define F_SETFL 4 +#define F_GETLK 14 +#define F_SETLK 6 +#define F_SETLKW 7 + +#define F_SETOWN 24 +#define F_GETOWN 23 +#define F_SETSIG 10 +#define F_GETSIG 11 + +#define F_GETLK64 33 +#define F_SETLK64 34 +#define F_SETLKW64 35 + +#define FD_CLOEXEC 1 + +#define F_RDLCK 0 +#define F_WRLCK 1 +#define F_UNLCK 2 + +#define F_EXLCK 4 +#define F_SHLCK 8 + +#define F_INPROGRESS 16 + +#define LOCK_SH 1 +#define LOCK_EX 2 +#define LOCK_NB 4 +#define LOCK_UN 8 + +#define LOCK_MAND 32 +#define LOCK_READ 64 +#define LOCK_WRITE 128 +#define LOCK_RW 192 + +typedef struct flock { + short l_type; + short l_whence; + loff_t l_start; + loff_t l_len; + pid_t l_pid; +} flock_t; + +#define F_LINUX_SPECIFIC_BASE 1024 + +#endif /* _KLIBC_ARCHFCNTL_H */ + diff --git a/klibc/include/arch/mips/klibc/archsetjmp.h b/klibc/include/arch/mips/klibc/archsetjmp.h new file mode 100644 index 0000000000..40e5be2736 --- /dev/null +++ b/klibc/include/arch/mips/klibc/archsetjmp.h @@ -0,0 +1,39 @@ +/* + * arch/mips/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __s0; + unsigned long __s1; + unsigned long __s2; + unsigned long __s3; + unsigned long __s4; + unsigned long __s5; + unsigned long __s6; + unsigned long __s7; + unsigned long __gp; + unsigned long __sp; + unsigned long __s8; + unsigned long __ra; + unsigned long __f20; + unsigned long __f21; + unsigned long __f22; + unsigned long __f23; + unsigned long __f24; + unsigned long __f25; + unsigned long __f26; + unsigned long __f27; + unsigned long __f28; + unsigned long __f29; + unsigned long __f30; + unsigned long __f31; + unsigned long __fcr31; + unsigned long __unused; +} __attribute__((aligned(8))); + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/mips/klibc/archsignal.h b/klibc/include/arch/mips/klibc/archsignal.h new file mode 100644 index 0000000000..3b72908636 --- /dev/null +++ b/klibc/include/arch/mips/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/mips/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/mips/klibc/archstat.h b/klibc/include/arch/mips/klibc/archstat.h new file mode 100644 index 0000000000..612bbfa85b --- /dev/null +++ b/klibc/include/arch/mips/klibc/archstat.h @@ -0,0 +1,39 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +/* + * This matches struct stat64 in glibc2.1, hence the absolutely insane + * amounts of padding around dev_t's. The memory layout is the same as of + * struct stat of the 64-bit kernel. + */ + +struct stat { + unsigned long st_dev; + unsigned long st_pad0[3]; /* Reserved for st_dev expansion */ + + unsigned long long st_ino; + + mode_t st_mode; + nlink_t st_nlink; + + uid_t st_uid; + gid_t st_gid; + + unsigned long st_rdev; + unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */ + + long long st_size; + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + + unsigned long st_blksize; + unsigned long st_pad2; + + long long st_blocks; +}; + +#endif diff --git a/klibc/include/arch/mips/klibc/archsys.h b/klibc/include/arch/mips/klibc/archsys.h new file mode 100644 index 0000000000..f696cdfaa7 --- /dev/null +++ b/klibc/include/arch/mips/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/mips/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/mips/machine/asm.h b/klibc/include/arch/mips/machine/asm.h new file mode 100644 index 0000000000..e5239a6cef --- /dev/null +++ b/klibc/include/arch/mips/machine/asm.h @@ -0,0 +1,11 @@ +/* + * arch/mips/include/machine/asm.h + */ + +#ifndef _MACHINE_ASM_H +#define _MACHINE_ASM_H + +#include +#include + +#endif /* _MACHINE_ASM_H */ diff --git a/klibc/include/arch/mips/sgidefs.h b/klibc/include/arch/mips/sgidefs.h new file mode 100644 index 0000000000..eb103ace2c --- /dev/null +++ b/klibc/include/arch/mips/sgidefs.h @@ -0,0 +1,20 @@ +/* + * arch/mips/include/sgidefs.h + */ + +/* Some ABI constants */ + +#ifndef _SGIDEFS_H +#define _SGIDEFS_H + +#define _MIPS_ISA_MIPS1 1 +#define _MIPS_ISA_MIPS2 2 +#define _MIPS_ISA_MIPS3 3 +#define _MIPS_ISA_MIPS4 4 +#define _MIPS_ISA_MIPS5 5 + +#define _MIPS_SIM_ABI32 1 +#define _MIPS_SIM_NABI32 2 +#define _MIPS_SIM_ABI64 3 + +#endif /* _SGIDEFS_H */ diff --git a/klibc/include/arch/mips/spaces.h b/klibc/include/arch/mips/spaces.h new file mode 100644 index 0000000000..b5f530b753 --- /dev/null +++ b/klibc/include/arch/mips/spaces.h @@ -0,0 +1 @@ +/* Included by but not actually needed */ diff --git a/klibc/include/arch/mips64/klibc/archsignal.h b/klibc/include/arch/mips64/klibc/archsignal.h new file mode 100644 index 0000000000..56b0fd323e --- /dev/null +++ b/klibc/include/arch/mips64/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/mips64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/mips64/klibc/archstat.h b/klibc/include/arch/mips64/klibc/archstat.h new file mode 100644 index 0000000000..d237e3a3e8 --- /dev/null +++ b/klibc/include/arch/mips64/klibc/archstat.h @@ -0,0 +1,33 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +struct stat { + unsigned int st_dev; + unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ + + unsigned long st_ino; + + mode_t st_mode; + nlink_t st_nlink; + + uid_t st_uid; + gid_t st_gid; + + unsigned int st_rdev; + unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ + + off_t st_size; + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + + unsigned int st_blksize; + unsigned int st_pad2; + + unsigned long st_blocks; +}; + +#endif diff --git a/klibc/include/arch/mips64/klibc/archsys.h b/klibc/include/arch/mips64/klibc/archsys.h new file mode 100644 index 0000000000..81e5106e16 --- /dev/null +++ b/klibc/include/arch/mips64/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/mips64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/parisc/klibc/archsignal.h b/klibc/include/arch/parisc/klibc/archsignal.h new file mode 100644 index 0000000000..3190e8528e --- /dev/null +++ b/klibc/include/arch/parisc/klibc/archsignal.h @@ -0,0 +1,24 @@ +/* + * arch/parisc/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +#define _NSIG 64 +#define _NSIG_SZ (_NSIG / LONG_BIT) + +typedef struct { + unsigned long sig[_NSIG_SZ]; +} sigset_t; + +struct sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + sigset_t sa_mask; +}; + +#endif diff --git a/klibc/include/arch/parisc/klibc/archstat.h b/klibc/include/arch/parisc/klibc/archstat.h new file mode 100644 index 0000000000..7d28f459ee --- /dev/null +++ b/klibc/include/arch/parisc/klibc/archstat.h @@ -0,0 +1,27 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +struct stat { + unsigned long long st_dev; + unsigned int __pad1; + + unsigned int __st_ino; /* Not actually filled in */ + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned long long st_rdev; + unsigned int __pad2; + signed long long st_size; + signed int st_blksize; + + signed long long st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long long st_ino; +}; + +#endif diff --git a/klibc/include/arch/parisc/klibc/archsys.h b/klibc/include/arch/parisc/klibc/archsys.h new file mode 100644 index 0000000000..5013ba8794 --- /dev/null +++ b/klibc/include/arch/parisc/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/parisc/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/ppc/klibc/archsetjmp.h b/klibc/include/arch/ppc/klibc/archsetjmp.h new file mode 100644 index 0000000000..53e2fccc3b --- /dev/null +++ b/klibc/include/arch/ppc/klibc/archsetjmp.h @@ -0,0 +1,36 @@ +/* + * arch/ppc/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __r2; + unsigned long __sp; + unsigned long __lr; + unsigned long __cr; + unsigned long __r13; + unsigned long __r14; + unsigned long __r15; + unsigned long __r16; + unsigned long __r17; + unsigned long __r18; + unsigned long __r19; + unsigned long __r20; + unsigned long __r21; + unsigned long __r22; + unsigned long __r23; + unsigned long __r24; + unsigned long __r25; + unsigned long __r26; + unsigned long __r27; + unsigned long __r28; + unsigned long __r29; + unsigned long __r30; + unsigned long __r31; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/ppc/klibc/archsignal.h b/klibc/include/arch/ppc/klibc/archsignal.h new file mode 100644 index 0000000000..567a547ef9 --- /dev/null +++ b/klibc/include/arch/ppc/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/ppc/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/ppc/klibc/archstat.h b/klibc/include/arch/ppc/klibc/archstat.h new file mode 100644 index 0000000000..1d0487b47f --- /dev/null +++ b/klibc/include/arch/ppc/klibc/archstat.h @@ -0,0 +1,28 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +/* This matches struct stat64 in glibc2.1. + */ +struct stat { + unsigned long long st_dev; /* Device. */ + unsigned long long st_ino; /* File serial number. */ + unsigned int st_mode; /* File mode. */ + unsigned int st_nlink; /* Link count. */ + unsigned int st_uid; /* User ID of the file's owner. */ + unsigned int st_gid; /* Group ID of the file's group. */ + unsigned long long st_rdev; /* Device number, if device. */ + unsigned short int __pad2; + long long st_size; /* Size of file, in bytes. */ + long st_blksize; /* Optimal block size for I/O. */ + + long long st_blocks; /* Number 512-byte blocks allocated. */ + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ + unsigned long int __unused4; + unsigned long int __unused5; +}; + +#endif diff --git a/klibc/include/arch/ppc/klibc/archsys.h b/klibc/include/arch/ppc/klibc/archsys.h new file mode 100644 index 0000000000..17a28859e5 --- /dev/null +++ b/klibc/include/arch/ppc/klibc/archsys.h @@ -0,0 +1,61 @@ +/* + * arch/ppc/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* PowerPC seems to lack _syscall6() in its headers */ +/* This seems to work on both 32- and 64-bit ppc */ + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ + unsigned long __sc_ret, __sc_err; \ + { \ + register unsigned long __sc_0 __asm__ ("r0"); \ + register unsigned long __sc_3 __asm__ ("r3"); \ + register unsigned long __sc_4 __asm__ ("r4"); \ + register unsigned long __sc_5 __asm__ ("r5"); \ + register unsigned long __sc_6 __asm__ ("r6"); \ + register unsigned long __sc_7 __asm__ ("r7"); \ + register unsigned long __sc_8 __asm__ ("r8"); \ + \ + __sc_3 = (unsigned long) (arg1); \ + __sc_4 = (unsigned long) (arg2); \ + __sc_5 = (unsigned long) (arg3); \ + __sc_6 = (unsigned long) (arg4); \ + __sc_7 = (unsigned long) (arg5); \ + __sc_8 = (unsigned long) (arg6); \ + __sc_0 = __NR_##name; \ + __asm__ __volatile__ \ + ("sc \n\t" \ + "mfcr %1 " \ + : "+r" (__sc_3), \ + "+r" (__sc_0), \ + "+r" (__sc_4), \ + "+r" (__sc_5), \ + "+r" (__sc_6), \ + "+r" (__sc_7), \ + "+r" (__sc_8) \ + : : "cr0", "ctr", "memory", \ + "r9", "r10", "r11", "r12"); \ + __sc_ret = __sc_3; \ + __sc_err = __sc_0; \ + } \ + if (__sc_err & 0x10000000) \ + { \ + errno = (int)__sc_ret; \ + __sc_ret = -1; \ + } \ + return (type)__sc_ret; \ +} + +#endif /* _syscall6() missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/ppc64/klibc/archsetjmp.h b/klibc/include/arch/ppc64/klibc/archsetjmp.h new file mode 100644 index 0000000000..006a2e27be --- /dev/null +++ b/klibc/include/arch/ppc64/klibc/archsetjmp.h @@ -0,0 +1,36 @@ +/* + * arch/ppc64/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __r2; + unsigned long __sp; + unsigned long __lr; + unsigned long __cr; + unsigned long __r13; + unsigned long __r14; + unsigned long __r15; + unsigned long __r16; + unsigned long __r17; + unsigned long __r18; + unsigned long __r19; + unsigned long __r20; + unsigned long __r21; + unsigned long __r22; + unsigned long __r23; + unsigned long __r24; + unsigned long __r25; + unsigned long __r26; + unsigned long __r27; + unsigned long __r28; + unsigned long __r29; + unsigned long __r30; + unsigned long __r31; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/ppc64/klibc/archsignal.h b/klibc/include/arch/ppc64/klibc/archsignal.h new file mode 100644 index 0000000000..8452f6e4bc --- /dev/null +++ b/klibc/include/arch/ppc64/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/ppc64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/ppc64/klibc/archstat.h b/klibc/include/arch/ppc64/klibc/archstat.h new file mode 100644 index 0000000000..71f4748690 --- /dev/null +++ b/klibc/include/arch/ppc64/klibc/archstat.h @@ -0,0 +1,25 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +struct stat { + unsigned long st_dev; + ino_t st_ino; + nlink_t st_nlink; + mode_t st_mode; + uid_t st_uid; + gid_t st_gid; + unsigned long st_rdev; + off_t st_size; + unsigned long st_blksize; + unsigned long st_blocks; + struct timespec st_atim; /* Time of last access. */ + struct timespec st_mtim; /* Time of last modification. */ + struct timespec st_ctim; /* Time of last status change. */ + unsigned long __unused4; + unsigned long __unused5; + unsigned long __unused6; +}; + +#endif diff --git a/klibc/include/arch/ppc64/klibc/archsys.h b/klibc/include/arch/ppc64/klibc/archsys.h new file mode 100644 index 0000000000..4f81fee00d --- /dev/null +++ b/klibc/include/arch/ppc64/klibc/archsys.h @@ -0,0 +1,52 @@ +/* + * arch/ppc64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ + unsigned long __sc_ret, __sc_err; \ + { \ + register unsigned long __sc_0 __asm__ ("r0"); \ + register unsigned long __sc_3 __asm__ ("r3"); \ + register unsigned long __sc_4 __asm__ ("r4"); \ + register unsigned long __sc_5 __asm__ ("r5"); \ + register unsigned long __sc_6 __asm__ ("r6"); \ + register unsigned long __sc_7 __asm__ ("r7"); \ + register unsigned long __sc_8 __asm__ ("r8"); \ + \ + __sc_3 = (unsigned long) (arg1); \ + __sc_4 = (unsigned long) (arg2); \ + __sc_5 = (unsigned long) (arg3); \ + __sc_6 = (unsigned long) (arg4); \ + __sc_7 = (unsigned long) (arg5); \ + __sc_8 = (unsigned long) (arg6); \ + __sc_0 = __NR_##name; \ + __asm__ __volatile__ \ + ("sc \n\t" \ + "mfcr %1 " \ + : "=&r" (__sc_3), "=&r" (__sc_0) \ + : "0" (__sc_3), "1" (__sc_0), \ + "r" (__sc_4), \ + "r" (__sc_5), \ + "r" (__sc_6), \ + "r" (__sc_7), \ + "r" (__sc_8) \ + : __syscall_clobbers); \ + __sc_ret = __sc_3; \ + __sc_err = __sc_0; \ + } \ + __syscall_return (type); \ +} + +#endif /* _syscall6() missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/s390/klibc/archsetjmp.h b/klibc/include/arch/s390/klibc/archsetjmp.h new file mode 100644 index 0000000000..11a641ed5a --- /dev/null +++ b/klibc/include/arch/s390/klibc/archsetjmp.h @@ -0,0 +1,15 @@ +/* + * arch/s390/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + uint32_t __gregs[10]; /* general registers r6-r15 */ + uint64_t __fpregs[2]; /* fp registers f4 and f6 */ +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/s390/klibc/archsignal.h b/klibc/include/arch/s390/klibc/archsignal.h new file mode 100644 index 0000000000..1f8de28b4b --- /dev/null +++ b/klibc/include/arch/s390/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/s390/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/s390/klibc/archstat.h b/klibc/include/arch/s390/klibc/archstat.h new file mode 100644 index 0000000000..866c3d4f4c --- /dev/null +++ b/klibc/include/arch/s390/klibc/archstat.h @@ -0,0 +1,31 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +/* This matches struct stat64 in glibc2.1, hence the absolutely + * insane amounts of padding around dev_t's. + */ +struct stat { + unsigned long long st_dev; + unsigned int __pad1; +#define STAT64_HAS_BROKEN_ST_INO 1 + unsigned long __st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned long st_uid; + unsigned long st_gid; + unsigned long long st_rdev; + unsigned int __pad3; + long long st_size; + unsigned long st_blksize; + unsigned char __pad4[4]; + unsigned long __pad5; /* future possible st_blocks high bits */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long long st_ino; +}; + +#endif diff --git a/klibc/include/arch/s390/klibc/archsys.h b/klibc/include/arch/s390/klibc/archsys.h new file mode 100644 index 0000000000..1cd0948f3c --- /dev/null +++ b/klibc/include/arch/s390/klibc/archsys.h @@ -0,0 +1,41 @@ +/* + * arch/s390/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* S/390 only has five syscall parameters, and uses a structure for + 6-argument syscalls. */ + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,\ + type4,arg4,type5,arg5,type6,arg6) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ + type5 arg5, type6 arg6) { \ + unsigned long __arg[6] = { \ + (unsigned long) arg1, \ + (unsigned long) arg2, \ + (unsigned long) arg3, \ + (unsigned long) arg4, \ + (unsigned long) arg5, \ + (unsigned long) arg6 \ + }; \ + register void *__argp asm("2") = &__arg; \ + long __res; \ + __asm__ __volatile__ ( \ + " svc %b1\n" \ + " lr %0,2" \ + : "=d" (__res) \ + : "i" (__NR_##name), \ + "d" (__argp) \ + : _svc_clobber); \ + __syscall_return(type, __res); \ +} + +#endif /* _syscall6() missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/s390x/klibc/archsetjmp.h b/klibc/include/arch/s390x/klibc/archsetjmp.h new file mode 100644 index 0000000000..dd3ed0d47c --- /dev/null +++ b/klibc/include/arch/s390x/klibc/archsetjmp.h @@ -0,0 +1,15 @@ +/* + * arch/s390x/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + uint64_t __gregs[10]; /* general registers r6-r15 */ + uint64_t __fpregs[4]; /* fp registers f1, f3, f5, f7 */ +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/s390x/klibc/archsignal.h b/klibc/include/arch/s390x/klibc/archsignal.h new file mode 100644 index 0000000000..08c9a0073a --- /dev/null +++ b/klibc/include/arch/s390x/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/s390x/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/s390x/klibc/archstat.h b/klibc/include/arch/s390x/klibc/archstat.h new file mode 100644 index 0000000000..0de73cb2b6 --- /dev/null +++ b/klibc/include/arch/s390x/klibc/archstat.h @@ -0,0 +1,24 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +struct stat { + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_nlink; + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad1; + unsigned long st_rdev; + unsigned long st_size; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + unsigned long st_blksize; + long st_blocks; + unsigned long __unused[3]; +}; + +#endif diff --git a/klibc/include/arch/s390x/klibc/archsys.h b/klibc/include/arch/s390x/klibc/archsys.h new file mode 100644 index 0000000000..15f7113bb4 --- /dev/null +++ b/klibc/include/arch/s390x/klibc/archsys.h @@ -0,0 +1,41 @@ +/* + * arch/s390x/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* S/390X only has five syscall parameters, and uses a structure for + 6-argument syscalls. */ + +#ifndef _syscall6 + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,\ + type4,arg4,type5,arg5,type6,arg6) \ +type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ + type5 arg5, type6 arg6) { \ + unsigned long __arg[6] = { \ + (unsigned long) arg1, \ + (unsigned long) arg2, \ + (unsigned long) arg3, \ + (unsigned long) arg4, \ + (unsigned long) arg5, \ + (unsigned long) arg6 \ + }; \ + register void *__argp asm("2") = &__arg; \ + long __res; \ + __asm__ __volatile__ ( \ + " svc %b1\n" \ + " lgr %0,2" \ + : "=d" (__res) \ + : "i" (__NR_##name), \ + "d" (__argp) \ + : _svc_clobber); \ + __syscall_return(type, __res); \ +} + +#endif /* _syscall6() missing */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/sh/klibc/archsetjmp.h b/klibc/include/arch/sh/klibc/archsetjmp.h new file mode 100644 index 0000000000..28dd932fbc --- /dev/null +++ b/klibc/include/arch/sh/klibc/archsetjmp.h @@ -0,0 +1,22 @@ +/* + * arch/sh/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long r8; + unsigned long r9; + unsigned long r10; + unsigned long r11; + unsigned long r12; + unsigned long r13; + unsigned long r14; + unsigned long r15; + unsigned long pr; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/sh/klibc/archsignal.h b/klibc/include/arch/sh/klibc/archsignal.h new file mode 100644 index 0000000000..6c4e5976ad --- /dev/null +++ b/klibc/include/arch/sh/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/sh/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/sh/klibc/archstat.h b/klibc/include/arch/sh/klibc/archstat.h new file mode 100644 index 0000000000..73caceb593 --- /dev/null +++ b/klibc/include/arch/sh/klibc/archstat.h @@ -0,0 +1,45 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#include + +#define _STATBUF_ST_NSEC + +/* This matches struct stat64 in glibc2.1, hence the absolutely + * insane amounts of padding around dev_t's. + */ +struct stat64 { + unsigned long long st_dev; + unsigned char __pad0[4]; + + unsigned long st_ino; + unsigned int st_mode; + unsigned int st_nlink; + + unsigned long st_uid; + unsigned long st_gid; + + unsigned long long st_rdev; + unsigned char __pad3[4]; + + long long st_size; + unsigned long st_blksize; + +#if __BYTE_ORDER == __BIG_ENDIAN + unsigned long __pad4; /* Future possible st_blocks hi bits */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ +#else /* Must be little */ + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long __pad4; /* Future possible st_blocks hi bits */ +#endif + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + + unsigned long __unused1; + unsigned long __unused2; +}; + +#endif + diff --git a/klibc/include/arch/sh/klibc/archsys.h b/klibc/include/arch/sh/klibc/archsys.h new file mode 100644 index 0000000000..5f8050a536 --- /dev/null +++ b/klibc/include/arch/sh/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/sh/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/sparc/klibc/archsetjmp.h b/klibc/include/arch/sparc/klibc/archsetjmp.h new file mode 100644 index 0000000000..92c1c74c9d --- /dev/null +++ b/klibc/include/arch/sparc/klibc/archsetjmp.h @@ -0,0 +1,16 @@ +/* + * arch/sparc/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __sp; + unsigned long __fp; + unsigned long __pc; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/sparc/klibc/archsignal.h b/klibc/include/arch/sparc/klibc/archsignal.h new file mode 100644 index 0000000000..6af3709033 --- /dev/null +++ b/klibc/include/arch/sparc/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/sparc/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/sparc/klibc/archstat.h b/klibc/include/arch/sparc/klibc/archstat.h new file mode 100644 index 0000000000..0ff68785e5 --- /dev/null +++ b/klibc/include/arch/sparc/klibc/archstat.h @@ -0,0 +1,35 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +struct stat { + unsigned long long st_dev; + + unsigned long long st_ino; + + unsigned int st_mode; + unsigned int st_nlink; + + unsigned int st_uid; + unsigned int st_gid; + + unsigned long long st_rdev; + + unsigned char __pad3[8]; + + long long st_size; + unsigned int st_blksize; + + unsigned char __pad4[8]; + unsigned int st_blocks; + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + + unsigned int __unused4; + unsigned int __unused5; +}; + +#endif diff --git a/klibc/include/arch/sparc/klibc/archsys.h b/klibc/include/arch/sparc/klibc/archsys.h new file mode 100644 index 0000000000..20de8a8b44 --- /dev/null +++ b/klibc/include/arch/sparc/klibc/archsys.h @@ -0,0 +1,10 @@ +/* + * arch/sparc/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/sparc/machine/asm.h b/klibc/include/arch/sparc/machine/asm.h new file mode 100644 index 0000000000..b622bd8cf1 --- /dev/null +++ b/klibc/include/arch/sparc/machine/asm.h @@ -0,0 +1,192 @@ +/* $NetBSD: asm.h,v 1.14 2002/07/20 08:37:30 mrg Exp $ */ + +/* + * Copyright (c) 1994 Allen Briggs + * All rights reserved. + * + * Gleaned from locore.s and sun3 asm.h which had the following copyrights: + * locore.s: + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1982, 1990 The Regents of the University of California. + * sun3/include/asm.h: + * Copyright (c) 1993 Adam Glass + * Copyright (c) 1990 The Regents of the University of California. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef _ASM_H_ +#define _ASM_H_ + +/* Pull in CCFSZ, CC64FSZ, and BIAS from frame.h */ +#ifndef _LOCORE +#define _LOCORE +#endif +#include + +#ifdef __ELF__ +#define _C_LABEL(name) name +#else +#ifdef __STDC__ +#define _C_LABEL(name) _ ## name +#else +#define _C_LABEL(name) _/**/name +#endif +#endif +#define _ASM_LABEL(name) name + +#ifdef PIC +/* + * PIC_PROLOGUE() is akin to the compiler generated function prologue for + * PIC code. It leaves the address of the Global Offset Table in DEST, + * clobbering register TMP in the process. + * + * We can use two code sequences. We can read the %pc or use the call + * instruction that saves the pc in %o7. Call requires the branch unit and + * IEU1, and clobbers %o7 which needs to be restored. This instruction + * sequence takes about 4 cycles due to instruction interdependence. Reading + * the pc takes 4 cycles to dispatch and is always dispatched alone. That + * sequence takes 7 cycles. + */ +#ifdef __arch64__ +#define PIC_PROLOGUE(dest,tmp) \ + mov %o7, tmp; \ + sethi %hi(_GLOBAL_OFFSET_TABLE_-4),dest; \ + call 0f; \ + or dest,%lo(_GLOBAL_OFFSET_TABLE_+4),dest; \ +0: \ + add dest,%o7,dest; \ + mov tmp, %o7 +#else +#define PIC_PROLOGUE(dest,tmp) \ + mov %o7,tmp; 3: call 4f; nop; 4: \ + sethi %hi(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ + or dest,%lo(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ + add dest,%o7,dest; mov tmp,%o7 +#endif + +/* + * PICCY_SET() does the equivalent of a `set var, %dest' instruction in + * a PIC-like way, but without involving the Global Offset Table. This + * only works for VARs defined in the same file *and* in the text segment. + */ +#ifdef __arch64__ +#define PICCY_SET(var,dest,tmp) \ + 3: rd %pc, tmp; add tmp,(var-3b),dest +#else +#define PICCY_SET(var,dest,tmp) \ + mov %o7,tmp; 3: call 4f; nop; 4: \ + add %o7,(var-3b),dest; mov tmp,%o7 +#endif +#else +#define PIC_PROLOGUE(dest,tmp) +#define PICCY_OFFSET(var,dest,tmp) +#endif + +#define FTYPE(x) .type x,@function +#define OTYPE(x) .type x,@object + +#define _ENTRY(name) \ + .align 4; .globl name; .proc 1; FTYPE(name); name: + +#ifdef GPROF +/* see _MCOUNT_ENTRY in profile.h */ +#ifdef __ELF__ +#ifdef __arch64__ +#define _PROF_PROLOGUE \ + .data; .align 8; 1: .uaword 0; .uaword 0; \ + .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call _mcount; \ + or %o0,%lo(1b),%o0; restore +#else +#define _PROF_PROLOGUE \ + .data; .align 4; 1: .long 0; \ + .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call _mcount; \ + or %o0,%lo(1b),%o0; restore +#endif +#else +#ifdef __arch64__ +#define _PROF_PROLOGUE \ + .data; .align 8; 1: .uaword 0; .uaword 0; \ + .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call mcount; \ + or %o0,%lo(1b),%o0; restore +#else +#define _PROF_PROLOGUE \ + .data; .align 4; 1: .long 0; \ + .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \ + or %o0,%lo(1b),%o0; restore +#endif +#endif +#else +#define _PROF_PROLOGUE +#endif + +#define ENTRY(name) _ENTRY(_C_LABEL(name)); _PROF_PROLOGUE +#define ENTRY_NOPROFILE(name) _ENTRY(_C_LABEL(name)) +#define ASENTRY(name) _ENTRY(_ASM_LABEL(name)); _PROF_PROLOGUE +#define FUNC(name) ASENTRY(name) +#define RODATA(name) .align 4; .text; .globl _C_LABEL(name); \ + OTYPE(_C_LABEL(name)); _C_LABEL(name): + + +#define ASMSTR .asciz + +#define RCSID(name) .asciz name + +#ifdef __ELF__ +#define WEAK_ALIAS(alias,sym) \ + .weak alias; \ + alias = sym +#endif + +/* + * WARN_REFERENCES: create a warning if the specified symbol is referenced. + */ +#ifdef __ELF__ +#ifdef __STDC__ +#define WARN_REFERENCES(_sym,_msg) \ + .section .gnu.warning. ## _sym ; .ascii _msg ; .text +#else +#define WARN_REFERENCES(_sym,_msg) \ + .section .gnu.warning./**/_sym ; .ascii _msg ; .text +#endif /* __STDC__ */ +#else +#ifdef __STDC__ +#define __STRING(x) #x +#define WARN_REFERENCES(sym,msg) \ + .stabs msg ## ,30,0,0,0 ; \ + .stabs __STRING(_ ## sym) ## ,1,0,0,0 +#else +#define __STRING(x) "x" +#define WARN_REFERENCES(sym,msg) \ + .stabs msg,30,0,0,0 ; \ + .stabs __STRING(_/**/sym),1,0,0,0 +#endif /* __STDC__ */ +#endif /* __ELF__ */ + +#endif /* _ASM_H_ */ diff --git a/klibc/include/arch/sparc/machine/frame.h b/klibc/include/arch/sparc/machine/frame.h new file mode 100644 index 0000000000..b09175c7f4 --- /dev/null +++ b/klibc/include/arch/sparc/machine/frame.h @@ -0,0 +1,138 @@ +/* $NetBSD: frame.h,v 1.4 2001/12/04 00:05:05 darrenr Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)frame.h 8.1 (Berkeley) 6/11/93 + */ + +#if defined(_KERNEL_OPT) +#include "opt_sparc_arch.h" +#endif + +/* + * Sparc stack frame format. + * + * Note that the contents of each stack frame may be held only in + * machine register windows. In order to get an accurate picture + * of the frame, you must first force the kernel to write any such + * windows to the stack. + */ +#ifndef _LOCORE +#ifndef SUN4U +struct frame { + int32_t fr_local[8]; /* space to save locals (%l0..%l7) */ + int32_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ + struct frame *fr_fp; /* space to save frame pointer (%i6) */ + int32_t fr_pc; /* space to save return pc (%i7) */ + /* + * SunOS reserves another 8 words here; this is pointless + * but we do it for compatibility. + */ + int32_t fr_xxx; /* `structure return pointer' (unused) */ + int32_t fr_argd[6]; /* `arg dump area' (lunacy) */ + int32_t fr_argx[1]; /* arg extension (args 7..n; variable size) */ +}; +#else +struct frame32 { + int32_t fr_local[8]; /* space to save locals (%l0..%l7) */ + int32_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ + u_int32_t fr_fp; /* space to save frame pointer (%i6) */ + u_int32_t fr_pc; /* space to save return pc (%i7) */ + /* + * SunOS reserves another 8 words here; this is pointless + * but we do it for compatibility. + */ + int32_t fr_xxx; /* `structure return pointer' (unused) */ + int32_t fr_argd[6]; /* `arg dump area' (lunacy) */ + int32_t fr_argx[1]; /* arg extension (args 7..n; variable size) */ +}; +#endif +#endif + +/* + * CCFSZ (C Compiler Frame SiZe) is the size of a stack frame required if + * a function is to call C code. It should be just 64, but Sun defined + * their frame with space to hold arguments 0 through 5 (plus some junk), + * and varargs routines (such as kprintf) demand this, and gcc uses this + * area at times anyway. + */ +#define CCFSZ 96 + +/* + * Sparc v9 stack frame format. + * + * Note that the contents of each stack frame may be held only in + * machine register windows. In order to get an accurate picture + * of the frame, you must first force the kernel to write any such + * windows to the stack. + * + * V9 frames have an odd bias, so you can tall a v9 frame from + * a v8 frame by testing the stack pointer's lsb. + */ +#if !defined(_LOCORE) && !defined(_LIBC) +struct frame64 { + int64_t fr_local[8]; /* space to save locals (%l0..%l7) */ + int64_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ + u_int64_t fr_fp; /* space to save frame pointer (%i6) */ + u_int64_t fr_pc; /* space to save return pc (%i7) */ + /* + * SVR4 reserves a bunch of extra stuff. + */ + int64_t fr_argd[6]; /* `register save area' (lunacy) */ + int64_t fr_argx[0]; /* arg extension (args 7..n; variable size) */ +}; + +#define v9next_frame(f) ((struct frame64*)(f->fr_fp+BIAS)) +#endif + +/* + * CC64FSZ (C Compiler 64-bit Frame SiZe) is the size of a stack frame used + * by the compiler in 64-bit mode. It is (16)*8; space for 8 ins, 8 outs. + */ +#define CC64FSZ 176 + +/* + * v9 stacks all have a bias of 2047 added to the %sp and %fp, so you can easily + * detect it by testing the register for an odd value. Why 2K-1 I don't know. + */ +#define BIAS (2048-1) + diff --git a/klibc/include/arch/sparc/machine/trap.h b/klibc/include/arch/sparc/machine/trap.h new file mode 100644 index 0000000000..42c3ef6ae2 --- /dev/null +++ b/klibc/include/arch/sparc/machine/trap.h @@ -0,0 +1,141 @@ +/* $NetBSD: trap.h,v 1.11 1999/01/20 00:15:08 pk Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)trap.h 8.1 (Berkeley) 6/11/93 + */ +/* + * Sun4m support by Aaron Brown, Harvard University. + * Changes Copyright (c) 1995 The President and Fellows of Harvard College. + * All rights reserved. + */ + +#ifndef _MACHINE_TRAP_H +#define _MACHINE_TRAP_H + +/* trap vec (pri) description */ +#define T_RESET 0x00 /* (1) not actually vectored; jumps to 0 */ +#define T_TEXTFAULT 0x01 /* (2) address fault during instr fetch */ +#define T_ILLINST 0x02 /* (3) illegal instruction */ +#define T_PRIVINST 0x03 /* (4) privileged instruction */ +#define T_FPDISABLED 0x04 /* (5) fp instr while fp disabled */ +#define T_WINOF 0x05 /* (6) register window overflow */ +#define T_WINUF 0x06 /* (7) register window underflow */ +#define T_ALIGN 0x07 /* (8) address not properly aligned */ +#define T_FPE 0x08 /* (9) floating point exception */ +#define T_DATAFAULT 0x09 /* (10) address fault during data fetch */ +#define T_TAGOF 0x0a /* (11) tag overflow */ +/* 0x0b unused */ +/* 0x0c unused */ +/* 0x0d unused */ +/* 0x0e unused */ +/* 0x0f unused */ +/* 0x10 unused */ +#define T_L1INT 0x11 /* (27) level 1 interrupt */ +#define T_L2INT 0x12 /* (26) level 2 interrupt */ +#define T_L3INT 0x13 /* (25) level 3 interrupt */ +#define T_L4INT 0x14 /* (24) level 4 interrupt */ +#define T_L5INT 0x15 /* (23) level 5 interrupt */ +#define T_L6INT 0x16 /* (22) level 6 interrupt */ +#define T_L7INT 0x17 /* (21) level 7 interrupt */ +#define T_L8INT 0x18 /* (20) level 8 interrupt */ +#define T_L9INT 0x19 /* (19) level 9 interrupt */ +#define T_L10INT 0x1a /* (18) level 10 interrupt */ +#define T_L11INT 0x1b /* (17) level 11 interrupt */ +#define T_L12INT 0x1c /* (16) level 12 interrupt */ +#define T_L13INT 0x1d /* (15) level 13 interrupt */ +#define T_L14INT 0x1e /* (14) level 14 interrupt */ +#define T_L15INT 0x1f /* (13) level 15 interrupt */ +/* 0x20 unused */ +/* through 0x23 unused */ +#define T_CPDISABLED 0x24 /* (5) coprocessor instr while disabled */ +#define T_UNIMPLFLUSH 0x25 /* Unimplemented FLUSH */ +/* through 0x27 unused */ +#define T_CPEXCEPTION 0x28 /* (9) coprocessor exception */ +/* 0x29 unused */ +#define T_IDIV0 0x2a /* divide by zero (from hw [su]div instr) */ +#define T_STOREBUFFAULT 0x2b /* SuperSPARC: Store buffer copy-back fault */ +/* 0x2c unused */ +/* through 0x7f unused */ + +/* beginning of `user' vectors (from trap instructions) - all priority 12 */ +#define T_SUN_SYSCALL 0x80 /* system call */ +#define T_BREAKPOINT 0x81 /* breakpoint `instruction' */ +#define T_DIV0 0x82 /* division routine was handed 0 */ +#define T_FLUSHWIN 0x83 /* flush windows */ +#define T_CLEANWIN 0x84 /* provide clean windows */ +#define T_RANGECHECK 0x85 /* ? */ +#define T_FIXALIGN 0x86 /* fix up unaligned accesses */ +#define T_INTOF 0x87 /* integer overflow ? */ +#define T_SVR4_SYSCALL 0x88 /* SVR4 system call */ +#define T_BSD_SYSCALL 0x89 /* BSD system call */ +#define T_KGDB_EXEC 0x8a /* for kernel gdb */ + +/* 0x8b..0xff are currently unallocated, except the following */ +#define T_SVR4_GETCC 0xa0 +#define T_SVR4_SETCC 0xa1 +#define T_SVR4_GETPSR 0xa2 +#define T_SVR4_SETPSR 0xa3 +#define T_SVR4_GETHRTIME 0xa4 +#define T_SVR4_GETHRVTIME 0xa5 +#define T_SVR4_GETHRESTIME 0xa7 + + +#ifdef _KERNEL /* pseudo traps for locore.s */ +#define T_RWRET -1 /* need first user window for trap return */ +#define T_AST -2 /* no-op, just needed reschedule or profile */ +#endif + +/* flags to system call (flags in %g1 along with syscall number) */ +#define SYSCALL_G2RFLAG 0x400 /* on success, return to %g2 rather than npc */ +#define SYSCALL_G7RFLAG 0x800 /* use %g7 as above (deprecated) */ + +/* + * `software trap' macros to keep people happy (sparc v8 manual says not + * to set the upper bits). + */ +#define ST_BREAKPOINT (T_BREAKPOINT & 0x7f) +#define ST_DIV0 (T_DIV0 & 0x7f) +#define ST_FLUSHWIN (T_FLUSHWIN & 0x7f) +#define ST_SYSCALL (T_SUN_SYSCALL & 0x7f) + +#endif /* _MACHINE_TRAP_H_ */ diff --git a/klibc/include/arch/sparc64/klibc/archsetjmp.h b/klibc/include/arch/sparc64/klibc/archsetjmp.h new file mode 100644 index 0000000000..022a31e542 --- /dev/null +++ b/klibc/include/arch/sparc64/klibc/archsetjmp.h @@ -0,0 +1,16 @@ +/* + * arch/sparc64/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __sp; + unsigned long __fp; + unsigned long __pc; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/sparc64/klibc/archsignal.h b/klibc/include/arch/sparc64/klibc/archsignal.h new file mode 100644 index 0000000000..f81bd668bb --- /dev/null +++ b/klibc/include/arch/sparc64/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/sparc64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/sparc64/klibc/archstat.h b/klibc/include/arch/sparc64/klibc/archstat.h new file mode 100644 index 0000000000..c22905d30c --- /dev/null +++ b/klibc/include/arch/sparc64/klibc/archstat.h @@ -0,0 +1,22 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +/* No nsec fields?! */ +struct stat { + unsigned st_dev; + ino_t st_ino; + mode_t st_mode; + short st_nlink; + uid_t st_uid; + gid_t st_gid; + unsigned st_rdev; + off_t st_size; + time_t st_atime; + time_t st_mtime; + time_t st_ctime; + off_t st_blksize; + off_t st_blocks; + unsigned long __unused4[2]; +}; + +#endif diff --git a/klibc/include/arch/sparc64/klibc/archsys.h b/klibc/include/arch/sparc64/klibc/archsys.h new file mode 100644 index 0000000000..6a3a7b25bc --- /dev/null +++ b/klibc/include/arch/sparc64/klibc/archsys.h @@ -0,0 +1,10 @@ +/* + * arch/sparc64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/x86_64/klibc/archsetjmp.h b/klibc/include/arch/x86_64/klibc/archsetjmp.h new file mode 100644 index 0000000000..90d0a0d263 --- /dev/null +++ b/klibc/include/arch/x86_64/klibc/archsetjmp.h @@ -0,0 +1,21 @@ +/* + * arch/x86_64/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __rbx; + unsigned long __rsp; + unsigned long __rbp; + unsigned long __r12; + unsigned long __r13; + unsigned long __r14; + unsigned long __r15; + unsigned long __rip; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/x86_64/klibc/archsignal.h b/klibc/include/arch/x86_64/klibc/archsignal.h new file mode 100644 index 0000000000..74e82e1dd0 --- /dev/null +++ b/klibc/include/arch/x86_64/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/x86_64/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/x86_64/klibc/archstat.h b/klibc/include/arch/x86_64/klibc/archstat.h new file mode 100644 index 0000000000..53e141daea --- /dev/null +++ b/klibc/include/arch/x86_64/klibc/archstat.h @@ -0,0 +1,26 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +struct stat { + unsigned long st_dev; + unsigned long st_ino; + unsigned long st_nlink; + + unsigned int st_mode; + unsigned int st_uid; + unsigned int st_gid; + unsigned int __pad0; + unsigned long st_rdev; + long st_size; + long st_blksize; + long st_blocks; /* Number 512-byte blocks allocated. */ + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + long __unused[3]; +}; + +#endif diff --git a/klibc/include/arch/x86_64/klibc/archsys.h b/klibc/include/arch/x86_64/klibc/archsys.h new file mode 100644 index 0000000000..2ec72cd397 --- /dev/null +++ b/klibc/include/arch/x86_64/klibc/archsys.h @@ -0,0 +1,109 @@ +/* + * arch/x86_64/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* The x86-64 syscall headers are needlessly inefficient */ + +#undef _syscall0 +#undef _syscall1 +#undef _syscall2 +#undef _syscall3 +#undef _syscall4 +#undef _syscall5 +#undef _syscall6 + +#define _syscall0(type,name) \ +type name (void) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall1(type,name,type1,arg1) \ +type name (type1 arg1) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall2(type,name,type1,arg1,type2,arg2) \ +type name (type1 arg1,type2 arg2) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ +type name (type1 arg1,type2 arg2,type3 arg3) \ +{ \ +long __res; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ + "d" (arg3) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ +{ \ +long __res; \ +register type4 __r10 asm("%r10") = arg4; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ + "d" (arg3),"r" (__r10) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ +{ \ +long __res; \ +register type4 __r10 asm("%r10") = arg4; \ +register type5 __r8 asm("%r8") = arg5; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ + "d" (arg3),"r" (__r10),"r" (__r8) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ + type5,arg5,type6,arg6) \ +type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ +{ \ +long __res; \ +register type4 __r10 asm("%r10") = arg4; \ +register type5 __r8 asm("%r8") = arg5; \ +register type6 __r9 asm("%r9") = arg6; \ +__asm__ volatile (__syscall \ + : "=a" (__res) \ + : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ + "d" (arg3),"r" (__r10),"r" (__r8), "r" (__r9) \ + : __syscall_clobber); \ +__syscall_return(type,__res); \ +} + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/x86_64/sys/io.h b/klibc/include/arch/x86_64/sys/io.h new file mode 100644 index 0000000000..4a0ae44985 --- /dev/null +++ b/klibc/include/arch/x86_64/sys/io.h @@ -0,0 +1,126 @@ +#ident "$Id: io.h,v 1.1 2004/01/25 01:34:29 hpa Exp $" +/* ----------------------------------------------------------------------- * + * + * Copyright 2004 H. Peter Anvin - All Rights Reserved + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall + * be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * ----------------------------------------------------------------------- */ + +/* + * sys/io.h for the i386 architecture + * + * Basic I/O macros + */ + +#ifndef _SYS_IO_H +#define _SYS_IO_H 1 + +/* I/O-related system calls */ + +int iopl(int); +int ioperm(unsigned long, unsigned long, int); + +/* Basic I/O macros */ + +static __inline__ void +outb(unsigned char __v, unsigned short __p) +{ + asm volatile("outb %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ void +outw(unsigned short __v, unsigned short __p) +{ + asm volatile("outw %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ void +outl(unsigned int __v, unsigned short __p) +{ + asm volatile("outl %0,%1" : : "a" (__v), "dN" (__p)); +} + +static __inline__ unsigned char +inb(unsigned short __p) +{ + unsigned char __v; + asm volatile("inb %1,%0" : "=a" (__v) : "dN" (__p)); + return v; +} + +static __inline__ unsigned short +inw(unsigned short __p) +{ + unsigned short __v; + asm volatile("inw %1,%0" : "=a" (__v) : "dN" (__p)); + return v; +} + +static __inline__ unsigned int +inl(unsigned short __p) +{ + unsigned int __v; + asm volatile("inl %1,%0" : "=a" (__v) : "dN" (__p)); + return v; +} + +/* String I/O macros */ + +static __inline__ void +outsb (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsb" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +outsw (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsw" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +outsl (unsigned short __p, const void *__d, unsigned long __n) +{ + asm volatile("cld; rep; outsl" : "+S" (__d), "+c" (__n) : "d" (__p)); +} + + +static __inline__ void +insb (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insb" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +insw (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insw" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +static __inline__ void +insl (unsigned short __p, void *__d, unsigned long __n) +{ + asm volatile("cld; rep; insl" : "+D" (__d), "+c" (__n) : "d" (__p)); +} + +#endif /* _SYS_IO_H */ diff --git a/klibc/include/arpa/inet.h b/klibc/include/arpa/inet.h new file mode 100644 index 0000000000..043b148e17 --- /dev/null +++ b/klibc/include/arpa/inet.h @@ -0,0 +1,24 @@ +/* + * arpa/inet.h + */ + +#ifndef _ARPA_INET_H +#define _ARPA_INET_H + +#include +#include +#include +#include +#include + +__extern uint32_t inet_addr(const char *); +__extern int inet_aton(const char *, struct in_addr *); +__extern char *inet_ntoa(struct in_addr); +__extern int inet_pton(int, const char *, void *); +__extern const char *inet_ntop(int, const void *, char *, size_t); +__extern unsigned int inet_nsap_addr(const char *, unsigned char *, int); +__extern char *inet_nsap_ntoa(int, const unsigned char *, char *); + +#endif /* _ARPA_INET_H */ + + diff --git a/klibc/include/assert.h b/klibc/include/assert.h new file mode 100644 index 0000000000..58cc37c487 --- /dev/null +++ b/klibc/include/assert.h @@ -0,0 +1,22 @@ +/* + * assert.h + */ + +#ifndef _ASSERT_H +#define _ASSERT_H + +#ifdef NDEBUG + +#define assert(x) ((void)(x)) + +#else + +extern void __assert_fail(const char *, const char *, + unsigned int); + +#define assert(x) ((x) ? (void)0 : __assert_fail(#x, __FILE__, __LINE__)) + +#endif + +#endif /* _ASSERT_H */ + diff --git a/klibc/include/bits32/bitsize/limits.h b/klibc/include/bits32/bitsize/limits.h new file mode 100644 index 0000000000..f90e524b2b --- /dev/null +++ b/klibc/include/bits32/bitsize/limits.h @@ -0,0 +1,14 @@ +/* + * bits32/limits.h + */ + +#ifndef _BITSIZE_LIMITS_H +#define _BITSIZE_LIMITS_H + +#define LONG_BIT 32 + +#define LONG_MIN (-2147483647L-1) +#define LONG_MAX 2147483647L +#define ULONG_MAX 4294967295UL + +#endif /* _BITSIZE_LIMITS_H */ diff --git a/klibc/include/bits32/bitsize/stddef.h b/klibc/include/bits32/bitsize/stddef.h new file mode 100644 index 0000000000..c486041fe0 --- /dev/null +++ b/klibc/include/bits32/bitsize/stddef.h @@ -0,0 +1,18 @@ +/* + * bits32/stddef.h + */ + +#ifndef _BITSIZE_STDDEF_H +#define _BITSIZE_STDDEF_H + +#define _SIZE_T +#if defined(__s390__) || defined(__hppa__) || defined(__cris__) +typedef unsigned long size_t; +#else +typedef unsigned int size_t; +#endif + +#define _PTRDIFF_T +typedef signed int ptrdiff_t; + +#endif /* _BITSIZE_STDDEF_H */ diff --git a/klibc/include/bits32/bitsize/stdint.h b/klibc/include/bits32/bitsize/stdint.h new file mode 100644 index 0000000000..40b464961c --- /dev/null +++ b/klibc/include/bits32/bitsize/stdint.h @@ -0,0 +1,34 @@ +/* + * bits32/stdint.h + */ + +#ifndef _BITSIZE_STDINT_H +#define _BITSIZE_STDINT_H + +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long long int int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long long int uint64_t; + +typedef int int_fast16_t; +typedef int int_fast32_t; + +typedef unsigned int uint_fast16_t; +typedef unsigned int uint_fast32_t; + +typedef int intptr_t; +typedef unsigned int uintptr_t; + +#define __INT64_C(c) c ## LL +#define __UINT64_C(c) c ## ULL + +#define __PRI64_RANK "ll" +#define __PRIFAST_RANK "" +#define __PRIPTR_RANK "" + +#endif /* _BITSIZE_STDINT_H */ diff --git a/klibc/include/bits32/bitsize/stdintconst.h b/klibc/include/bits32/bitsize/stdintconst.h new file mode 100644 index 0000000000..8157dd06e0 --- /dev/null +++ b/klibc/include/bits32/bitsize/stdintconst.h @@ -0,0 +1,18 @@ +/* + * bits32/stdintconst.h + */ + +#ifndef _BITSIZE_STDINTCONST_H +#define _BITSIZE_STDINTCONST_H + +#define INT_FAST16_C(c) INT32_C(c) +#define INT_FAST32_C(c) INT32_C(c) + +#define UINT_FAST16_C(c) UINT32_C(c) +#define UINT_FAST32_C(c) UINT32_C(c) + +#define INTPTR_C(c) INT32_C(c) +#define UINTPTR_C(c) UINT32_C(c) +#define PTRDIFF_C(c) INT32_C(c) + +#endif /* _BITSIZE_STDINTCONST_H */ diff --git a/klibc/include/bits32/bitsize/stdintlimits.h b/klibc/include/bits32/bitsize/stdintlimits.h new file mode 100644 index 0000000000..b44fe01186 --- /dev/null +++ b/klibc/include/bits32/bitsize/stdintlimits.h @@ -0,0 +1,22 @@ +/* + * bits32/stdintlimits.h + */ + +#ifndef _BITSIZE_STDINTLIMITS_H +#define _BITSIZE_STDINTLIMITS_H + +#define INT_FAST16_MIN INT32_MIN +#define INT_FAST32_MIN INT32_MIN +#define INT_FAST16_MAX INT32_MAX +#define INT_FAST32_MAX INT32_MAX +#define UINT_FAST16_MAX UINT32_MAX +#define UINT_FAST32_MAX UINT32_MAX + +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX + +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX + +#endif /* _BITSIZE_STDINTLIMITS_H */ diff --git a/klibc/include/bits64/bitsize/limits.h b/klibc/include/bits64/bitsize/limits.h new file mode 100644 index 0000000000..7b20da085b --- /dev/null +++ b/klibc/include/bits64/bitsize/limits.h @@ -0,0 +1,14 @@ +/* + * bits64/limits.h + */ + +#ifndef _BITSIZE_LIMITS_H +#define _BITSIZE_LIMITS_H + +#define LONG_BIT 64 + +#define LONG_MIN (-9223372036854775807L-1) +#define LONG_MAX 9223372036854775807L +#define ULONG_MAX 18446744073709551615UL + +#endif /* _BITSIZE_LIMITS_H */ diff --git a/klibc/include/bits64/bitsize/stddef.h b/klibc/include/bits64/bitsize/stddef.h new file mode 100644 index 0000000000..3e72621862 --- /dev/null +++ b/klibc/include/bits64/bitsize/stddef.h @@ -0,0 +1,13 @@ +/* + * bits64/stddef.h + */ + +#ifndef _BITSIZE_STDDEF_H +#define _BITSIZE_STDDEF_H + +#define _SIZE_T +typedef unsigned long size_t; +#define _PTRDIFF_T +typedef signed long ptrdiff_t; + +#endif /* _BITSIZE_STDDEF_H */ diff --git a/klibc/include/bits64/bitsize/stdint.h b/klibc/include/bits64/bitsize/stdint.h new file mode 100644 index 0000000000..8e16cf0909 --- /dev/null +++ b/klibc/include/bits64/bitsize/stdint.h @@ -0,0 +1,36 @@ +/* + * bits64/stdint.h + */ + +#ifndef _BITSIZE_STDINT_H +#define _BITSIZE_STDINT_H + +typedef signed char int8_t; +typedef short int int16_t; +typedef int int32_t; +typedef long int int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned int uint32_t; +typedef unsigned long int uint64_t; + +typedef long int int_fast16_t; +typedef long int int_fast32_t; + +typedef unsigned long int uint_fast16_t; +typedef unsigned long int uint_fast32_t; + +typedef long int intptr_t; +typedef unsigned long int uintptr_t; + +#define __INT64_C(c) c ## L +#define __UINT64_C(c) c ## UL + +#define __PRI64_RANK "l" +#define __PRIFAST_RANK "l" +#define __PRIPTR_RANK "l" + +#endif /* _BITSIZE_STDINT_H */ + + diff --git a/klibc/include/bits64/bitsize/stdintconst.h b/klibc/include/bits64/bitsize/stdintconst.h new file mode 100644 index 0000000000..65f2db0501 --- /dev/null +++ b/klibc/include/bits64/bitsize/stdintconst.h @@ -0,0 +1,18 @@ +/* + * bits64/stdintconst.h + */ + +#ifndef _BITSIZE_STDINTCONST_H +#define _BITSIZE_STDINTCONST_H + +#define INT_FAST16_C(c) INT64_C(c) +#define INT_FAST32_C(c) INT64_C(c) + +#define UINT_FAST16_C(c) UINT64_C(c) +#define UINT_FAST32_C(c) UINT64_C(c) + +#define INTPTR_C(c) INT64_C(c) +#define UINTPTR_C(c) UINT64_C(c) +#define PTRDIFF_C(c) INT64_C(c) + +#endif /* _BITSIZE_STDINTCONST_H */ diff --git a/klibc/include/bits64/bitsize/stdintlimits.h b/klibc/include/bits64/bitsize/stdintlimits.h new file mode 100644 index 0000000000..d110d17d2d --- /dev/null +++ b/klibc/include/bits64/bitsize/stdintlimits.h @@ -0,0 +1,22 @@ +/* + * bits64/stdintlimits.h + */ + +#ifndef _BITSIZE_STDINTLIMITS_H +#define _BITSIZE_STDINTLIMITS_H + +#define INT_FAST16_MIN INT64_MIN +#define INT_FAST32_MIN INT64_MIN +#define INT_FAST16_MAX INT64_MAX +#define INT_FAST32_MAX INT64_MAX +#define UINT_FAST16_MAX UINT64_MAX +#define UINT_FAST32_MAX UINT64_MAX + +#define INTPTR_MIN INT64_MIN +#define INTPTR_MAX INT64_MAX +#define UINTPTR_MAX UINT64_MAX + +#define PTRDIFF_MIN INT64_MIN +#define PTRDIFF_MAX INT64_MAX + +#endif /* _BITSIZE_STDINTLIMITS_H */ diff --git a/klibc/include/ctype.h b/klibc/include/ctype.h new file mode 100644 index 0000000000..daa6a8eff4 --- /dev/null +++ b/klibc/include/ctype.h @@ -0,0 +1,119 @@ +/* + * ctype.h + * + * This assumes ISO 8859-1, being a reasonable superset of ASCII. + */ + +#ifndef _CTYPE_H +#define _CTYPE_H + +#ifndef __CTYPE_NO_INLINE +# define __ctype_inline extern __inline__ +#else +# define __ctype_inline +#endif + +/* + * This relies on the following definitions: + * + * cntrl = !print + * alpha = upper|lower + * graph = punct|alpha|digit + * blank = '\t' || ' ' (per POSIX requirement) + */ +enum { + __ctype_upper = (1 << 0), + __ctype_lower = (1 << 1), + __ctype_digit = (1 << 2), + __ctype_xdigit = (1 << 3), + __ctype_space = (1 << 4), + __ctype_print = (1 << 5), + __ctype_punct = (1 << 6), + __ctype_cntrl = (1 << 7), +}; + +extern const unsigned char __ctypes[]; + +__ctype_inline int isalnum(int __c) +{ + return __ctypes[__c+1] & + (__ctype_upper|__ctype_lower|__ctype_digit); +} + +__ctype_inline int isalpha(int __c) +{ + return __ctypes[__c+1] & + (__ctype_upper|__ctype_lower); +} + +__ctype_inline int isascii(int __c) +{ + return !(__c & ~0x7f); +} + +__ctype_inline int isblank(int __c) +{ + return (__c == '\t') || (__c == ' '); +} + +__ctype_inline int iscntrl(int __c) +{ + return __ctypes[__c+1] & __ctype_cntrl; +} + +__ctype_inline int isdigit(int __c) +{ + return ((unsigned)__c - '0') <= 9; +} + +__ctype_inline int isgraph(int __c) +{ + return __ctypes[__c+1] & + (__ctype_upper|__ctype_lower|__ctype_digit|__ctype_punct); +} + +__ctype_inline int islower(int __c) +{ + return __ctypes[__c+1] & __ctype_lower; +} + +__ctype_inline int isprint(int __c) +{ + return __ctypes[__c+1] & __ctype_print; +} + +__ctype_inline int ispunct(int __c) +{ + return __ctypes[__c+1] & __ctype_punct; +} + +__ctype_inline int isspace(int __c) +{ + return __ctypes[__c+1] & __ctype_space; +} + +__ctype_inline int isupper(int __c) +{ + return __ctypes[__c+1] & __ctype_upper; +} + +__ctype_inline int isxdigit(int __c) +{ + return __ctypes[__c+1] & __ctype_xdigit; +} + +/* Note: this is decimal, not hex, to avoid accidental promotion to unsigned */ +#define _toupper(__c) ((__c) & ~32) +#define _tolower(__c) ((__c) | 32) + +__ctype_inline int toupper(int __c) +{ + return islower(__c) ? _toupper(__c) : __c; +} + +__ctype_inline int tolower(int __c) +{ + return isupper(__c) ? _tolower(__c) : __c; +} + +#endif /* _CTYPE_H */ diff --git a/klibc/include/dirent.h b/klibc/include/dirent.h new file mode 100644 index 0000000000..4db479592b --- /dev/null +++ b/klibc/include/dirent.h @@ -0,0 +1,32 @@ +/* + * dirent.h + */ + +#ifndef _DIRENT_H +#define _DIRENT_H + +#include +#include + +struct _IO_dir { + int __fd; + +#ifdef __KLIBC_DIRENT_INTERNALS + /* These fields for internal use only */ + + size_t bytes_left; + struct dirent *next; + /* Declaring this as an array of struct enforces correct alignment */ + struct dirent buffer[15]; /* 15 times max dirent size =~ 4K */ +#endif +}; +typedef struct _IO_dir DIR; + +__extern DIR *opendir(const char *); +__extern struct dirent *readdir(DIR *); +__extern int closedir(DIR *); +static __inline__ int dirfd (DIR *__d) { + return __d->__fd; +} + +#endif /* _DIRENT_H */ diff --git a/klibc/include/elf.h b/klibc/include/elf.h new file mode 100644 index 0000000000..52f47d042e --- /dev/null +++ b/klibc/include/elf.h @@ -0,0 +1,12 @@ +/* + * elf.h + */ + +#ifndef _ELF_H +#define _ELF_H + +#include +#include + +#endif /* _ELF_H */ + diff --git a/klibc/include/endian.h b/klibc/include/endian.h new file mode 100644 index 0000000000..44f89ccbbc --- /dev/null +++ b/klibc/include/endian.h @@ -0,0 +1,42 @@ +/* + * endian.h + */ + +#ifndef _ENDIAN_H +#define _ENDIAN_H + +#include +#include + +/* Linux' asm/byteorder.h defines either __LITTLE_ENDIAN or + __BIG_ENDIAN, but the glibc/BSD-ish macros expect both to be + defined with __BYTE_ORDER defining which is actually used... */ + +#if defined(__LITTLE_ENDIAN) +# undef __LITTLE_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __LITTLE_ENDIAN +#elif defined(__BIG_ENDIAN) +# undef __BIG_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __BIG_ENDIAN +#elif defined(__PDP_ENDIAN) +# undef __PDP_ENDIAN +# define __LITTLE_ENDIAN 1234 +# define __BIG_ENDIAN 4321 +# define __PDP_ENDIAN 3412 +# define __BYTE_ORDER __PDP_ENDIAN +#else +# error "Unknown byte order!" +#endif + +#define LITTLE_ENDIAN __LITTLE_ENDIAN +#define BIG_ENDIAN __BIG_ENDIAN +#define PDP_ENDIAN __PDP_ENDIAN +#define BYTE_ORDER __BYTE_ORDER + +#endif /* _ENDIAN_H */ diff --git a/klibc/include/errno.h b/klibc/include/errno.h new file mode 100644 index 0000000000..b2e666504d --- /dev/null +++ b/klibc/include/errno.h @@ -0,0 +1,8 @@ +/* + * errno.h + */ + +#include +#include + +__extern int errno; diff --git a/klibc/include/fcntl.h b/klibc/include/fcntl.h new file mode 100644 index 0000000000..c9650f76b5 --- /dev/null +++ b/klibc/include/fcntl.h @@ -0,0 +1,46 @@ +/* + * fcntl.h + */ + +#ifndef _FCNTL_H +#define _FCNTL_H + +#include +#include +#include +#if defined(__mips__) && !defined(__mips64__) +# include +#endif +#include + +/* This is ugly, but "struct flock" has actually been defined with + a long off_t, so it's really "struct flock64". It just happens + to work. Gag. Barf. + + This happens to work on all 32-bit architectures except MIPS. */ + +#ifdef F_GETLK64 +# undef F_GETLK +# define F_GETLK F_GETLK64 +#endif + +#ifdef F_SETLK64 +# undef F_SETLK +# define F_SETLK F_SETLK64 +#endif + +#ifdef F_SETLKW64 +# undef F_SETLKW +# define F_SETLKW F_SETLKW64 +#endif + +/* This is defined here as well as in since old-style code + would still include when using open(), and open() being + a varadic function changes its calling convention on some architectures. */ +#ifndef _KLIBC_IN_OPEN_C +__extern int open(const char *, int, ...); +#endif + +__extern int fcntl(int, int, ...); + +#endif /* _FCNTL_H */ diff --git a/klibc/include/grp.h b/klibc/include/grp.h new file mode 100644 index 0000000000..03ceb31560 --- /dev/null +++ b/klibc/include/grp.h @@ -0,0 +1,13 @@ +/* + * grp.h + */ + +#ifndef _GRP_H +#define _GRP_H + +#include +#include + +__extern int setgroups(size_t, const gid_t *); + +#endif /* _GRP_H */ diff --git a/klibc/include/inttypes.h b/klibc/include/inttypes.h new file mode 100644 index 0000000000..e00fa63160 --- /dev/null +++ b/klibc/include/inttypes.h @@ -0,0 +1,226 @@ +/* + * inttypes.h + */ + +#ifndef _INTTYPES_H +#define _INTTYPES_H + +#include +#include +#include + +static __inline__ intmax_t imaxabs(intmax_t __n) +{ + return (__n < (intmax_t)0) ? -__n : __n; +} + +__extern intmax_t strtoimax(const char *, char **, int); +__extern uintmax_t strtoumax(const char *, char **, int); + +/* extensions */ +__extern intmax_t strntoimax(const char *, char **, int, size_t); +__extern uintmax_t strntoumax(const char *, char **, int, size_t); + +#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) + +#define PRId8 "d" +#define PRId16 "d" +#define PRId32 "d" +#define PRId64 __PRI64_RANK "d" + +#define PRIdLEAST8 "d" +#define PRIdLEAST16 "d" +#define PRIdLEAST32 "d" +#define PRIdLEAST64 __PRI64_RANK "d" + +#define PRIdFAST8 "d" +#define PRIdFAST16 __PRIFAST_RANK "d" +#define PRIdFAST32 __PRIFAST_RANK "d" +#define PRIdFAST64 __PRI64_RANK "d" + +#define PRIdMAX __PRI64_RANK "d" +#define PRIdPTR __PRIPTR_RANK "d" + +#define PRIi8 "i" +#define PRIi16 "i" +#define PRIi32 "i" +#define PRIi64 __PRI64_RANK "i" + +#define PRIiLEAST8 "i" +#define PRIiLEAST16 "i" +#define PRIiLEAST32 "i" +#define PRIiLEAST64 __PRI64_RANK "i" + +#define PRIiFAST8 "i" +#define PRIiFAST16 __PRIFAST_RANK "i" +#define PRIiFAST32 __PRIFAST_RANK "i" +#define PRIiFAST64 __PRI64_RANK "i" + +#define PRIiMAX __PRI64_RANK "i" +#define PRIiPTR __PRIPTR_RANK "i" + +#define PRIo8 "o" +#define PRIo16 "o" +#define PRIo32 "o" +#define PRIo64 __PRI64_RANK "o" + +#define PRIoLEAST8 "o" +#define PRIoLEAST16 "o" +#define PRIoLEAST32 "o" +#define PRIoLEAST64 __PRI64_RANK "o" + +#define PRIoFAST8 "o" +#define PRIoFAST16 __PRIFAST_RANK "o" +#define PRIoFAST32 __PRIFAST_RANK "o" +#define PRIoFAST64 __PRI64_RANK "o" + +#define PRIoMAX __PRI64_RANK "o" +#define PRIoPTR __PRIPTR_RANK "o" + +#define PRIu8 "u" +#define PRIu16 "u" +#define PRIu32 "u" +#define PRIu64 __PRI64_RANK "u" + +#define PRIuLEAST8 "u" +#define PRIuLEAST16 "u" +#define PRIuLEAST32 "u" +#define PRIuLEAST64 __PRI64_RANK "u" + +#define PRIuFAST8 "u" +#define PRIuFAST16 __PRIFAST_RANK "u" +#define PRIuFAST32 __PRIFAST_RANK "u" +#define PRIuFAST64 __PRI64_RANK "u" + +#define PRIuMAX __PRI64_RANK "u" +#define PRIuPTR __PRIPTR_RANK "u" + +#define PRIx8 "x" +#define PRIx16 "x" +#define PRIx32 "x" +#define PRIx64 __PRI64_RANK "x" + +#define PRIxLEAST8 "x" +#define PRIxLEAST16 "x" +#define PRIxLEAST32 "x" +#define PRIxLEAST64 __PRI64_RANK "x" + +#define PRIxFAST8 "x" +#define PRIxFAST16 __PRIFAST_RANK "x" +#define PRIxFAST32 __PRIFAST_RANK "x" +#define PRIxFAST64 __PRI64_RANK "x" + +#define PRIxMAX __PRI64_RANK "x" +#define PRIxPTR __PRIPTR_RANK "x" + +#define PRIX8 "X" +#define PRIX16 "X" +#define PRIX32 "X" +#define PRIX64 __PRI64_RANK "X" + +#define PRIXLEAST8 "X" +#define PRIXLEAST16 "X" +#define PRIXLEAST32 "X" +#define PRIXLEAST64 __PRI64_RANK "X" + +#define PRIXFAST8 "X" +#define PRIXFAST16 __PRIFAST_RANK "X" +#define PRIXFAST32 __PRIFAST_RANK "X" +#define PRIXFAST64 __PRI64_RANK "X" + +#define PRIXMAX __PRI64_RANK "X" +#define PRIXPTR __PRIPTR_RANK "X" + +#define SCNd8 "hhd" +#define SCNd16 "hd" +#define SCNd32 "d" +#define SCNd64 __PRI64_RANK "d" + +#define SCNdLEAST8 "hhd" +#define SCNdLEAST16 "hd" +#define SCNdLEAST32 "d" +#define SCNdLEAST64 __PRI64_RANK "d" + +#define SCNdFAST8 "hhd" +#define SCNdFAST16 __PRIFAST_RANK "d" +#define SCNdFAST32 __PRIFAST_RANK "d" +#define SCNdFAST64 __PRI64_RANK "d" + +#define SCNdMAX __PRI64_RANK "d" +#define SCNdPTR __PRIPTR_RANK "d" + +#define SCNi8 "hhi" +#define SCNi16 "hi" +#define SCNi32 "i" +#define SCNi64 __PRI64_RANK "i" + +#define SCNiLEAST8 "hhi" +#define SCNiLEAST16 "hi" +#define SCNiLEAST32 "i" +#define SCNiLEAST64 __PRI64_RANK "i" + +#define SCNiFAST8 "hhi" +#define SCNiFAST16 __PRIFAST_RANK "i" +#define SCNiFAST32 __PRIFAST_RANK "i" +#define SCNiFAST64 __PRI64_RANK "i" + +#define SCNiMAX __PRI64_RANK "i" +#define SCNiPTR __PRIPTR_RANK "i" + +#define SCNo8 "hho" +#define SCNo16 "ho" +#define SCNo32 "o" +#define SCNo64 __PRI64_RANK "o" + +#define SCNoLEAST8 "hho" +#define SCNoLEAST16 "ho" +#define SCNoLEAST32 "o" +#define SCNoLEAST64 __PRI64_RANK "o" + +#define SCNoFAST8 "hho" +#define SCNoFAST16 __PRIFAST_RANK "o" +#define SCNoFAST32 __PRIFAST_RANK "o" +#define SCNoFAST64 __PRI64_RANK "o" + +#define SCNoMAX __PRI64_RANK "o" +#define SCNoPTR __PRIPTR_RANK "o" + +#define SCNu8 "hhu" +#define SCNu16 "hu" +#define SCNu32 "u" +#define SCNu64 __PRI64_RANK "u" + +#define SCNuLEAST8 "hhu" +#define SCNuLEAST16 "hu" +#define SCNuLEAST32 "u" +#define SCNuLEAST64 __PRI64_RANK "u" + +#define SCNuFAST8 "hhu" +#define SCNuFAST16 __PRIFAST_RANK "u" +#define SCNuFAST32 __PRIFAST_RANK "u" +#define SCNuFAST64 __PRI64_RANK "u" + +#define SCNuMAX __PRI64_RANK "u" +#define SCNuPTR __PRIPTR_RANK "u" + +#define SCNx8 "hhx" +#define SCNx16 "hx" +#define SCNx32 "x" +#define SCNx64 __PRI64_RANK "x" + +#define SCNxLEAST8 "hhx" +#define SCNxLEAST16 "hx" +#define SCNxLEAST32 "x" +#define SCNxLEAST64 __PRI64_RANK "x" + +#define SCNxFAST8 "hhx" +#define SCNxFAST16 __PRIFAST_RANK "x" +#define SCNxFAST32 __PRIFAST_RANK "x" +#define SCNxFAST64 __PRI64_RANK "x" + +#define SCNxMAX __PRI64_RANK "x" +#define SCNxPTR __PRIPTR_RANK "x" + +#endif + +#endif /* _INTTYPES_H */ diff --git a/klibc/include/klibc/compiler.h b/klibc/include/klibc/compiler.h new file mode 100644 index 0000000000..823996e777 --- /dev/null +++ b/klibc/include/klibc/compiler.h @@ -0,0 +1,119 @@ +/* + * klibc/compiler.h + * + * Various compiler features + */ + +#ifndef _KLIBC_COMPILER_H +#define _KLIBC_COMPILER_H + +/* Specific calling conventions */ +/* __cdecl is used when we want varadic and non-varadic functions to have + the same binary calling convention. */ +#ifdef __i386__ +# ifdef __GNUC__ +# define __cdecl __attribute__((cdecl,regparm(0))) +# else + /* Most other C compilers have __cdecl as a keyword */ +# endif +#else +# define __cdecl /* Meaningless on non-i386 */ +#endif + +/* How to declare a function that *must* be inlined */ +#ifdef __GNUC__ +# if __GNUC_MAJOR__ >= 3 +# define __must_inline static __inline__ __attribute__((always_inline)) +# else +# define __must_inline extern __inline__ +# endif +#else +# define __must_inline inline /* Just hope this works... */ +#endif + +/* How to declare a function that does not return */ +#ifdef __GNUC__ +# define __noreturn void __attribute__((noreturn)) +#else +# define __noreturn void +#endif + +/* "const" function: + + Many functions do not examine any values except their arguments, + and have no effects except the return value. Basically this is + just slightly more strict class than the `pure' attribute above, + since function is not allowed to read global memory. + + Note that a function that has pointer arguments and examines the + data pointed to must _not_ be declared `const'. Likewise, a + function that calls a non-`const' function usually must not be + `const'. It does not make sense for a `const' function to return + `void'. +*/ +#ifdef __GNUC__ +# define __constfunc __attribute__((const)) +#else +# define __constfunc +#endif +#undef __attribute_const__ +#define __attribute_const__ __constfunc + +/* "pure" function: + + Many functions have no effects except the return value and their + return value depends only on the parameters and/or global + variables. Such a function can be subject to common subexpression + elimination and loop optimization just as an arithmetic operator + would be. These functions should be declared with the attribute + `pure'. +*/ +#ifdef __GNUC__ +# define __purefunc __attribute__((pure)) +#else +# define __purefunc +#endif +#undef __attribute_pure__ +#define __attribute_pure__ __purefunc + +/* Format attribute */ +#ifdef __GNUC__ +# define __formatfunc(t,f,a) __attribute__((format(t,f,a))) +#else +# define __formatfunc(t,f,a) +#endif + +/* malloc() function (returns unaliased pointer) */ +#if defined(__GNUC__) && (__GNUC_MAJOR__ >= 3) +# define __mallocfunc __attribute__((malloc)) +#else +# define __mallocfunc +#endif + +/* likely/unlikely */ +#if defined(__GNUC__) && (__GNUC_MAJOR__ > 2 || (__GNUC_MAJOR__ == 2 && __GNUC_MINOR__ >= 95)) +# define __likely(x) __builtin_expect((x), 1) +# define __unlikely(x) __builtin_expect((x), 0) +#else +# define __likely(x) (x) +# define __unlikely(x) (x) +#endif + +/* Possibly unused function */ +#ifdef __GNUC__ +# define __unusedfunc __attribute__((unused)) +#else +# define __unusedfunc +#endif + +/* It's all user space... */ +#define __user + +/* The bitwise attribute: disallow arithmetric operations */ +#ifdef __CHECKER__ /* sparse only */ +# define __bitwise __attribute__((bitwise)) +#else +# define __bitwise +#endif + +#endif diff --git a/klibc/include/klibc/diverr.h b/klibc/include/klibc/diverr.h new file mode 100644 index 0000000000..4d8c8d36c2 --- /dev/null +++ b/klibc/include/klibc/diverr.h @@ -0,0 +1,16 @@ +/* + * klibc/diverr.h + */ + +#ifndef _KLIBC_DIVERR_H +#define _KLIBC_DIVERR_H + +#include + +static __inline__ void +__divide_error(void) +{ + raise(SIGFPE); +} + +#endif /* _KLIBC_DIVERR_H */ diff --git a/klibc/include/klibc/extern.h b/klibc/include/klibc/extern.h new file mode 100644 index 0000000000..f9c3467211 --- /dev/null +++ b/klibc/include/klibc/extern.h @@ -0,0 +1,14 @@ +/* + * klibc/extern.h + */ + +#ifndef _KLIBC_EXTERN_H +#define _KLIBC_EXTERN_H + +#ifdef __cplusplus +#define __extern extern "C" +#else +#define __extern extern +#endif + +#endif /* _KLIBC_EXTERN_H */ diff --git a/klibc/include/klibc/sysconfig.h b/klibc/include/klibc/sysconfig.h new file mode 100644 index 0000000000..ce01c23593 --- /dev/null +++ b/klibc/include/klibc/sysconfig.h @@ -0,0 +1,34 @@ +/* + * klibc/sysconfig.h + * + * Allows for definitions of some things which may be system-dependent + */ + +#ifndef _KLIBC_SYSCONFIG_H +#define _KLIBC_SYSCONFIG_H + +/* + * Define this to obtain memory using sbrk() instead + * of mmap(). This should make it friendlier on + * non-MMU architectures. This should become a + * per-architecture configurable. + */ +#undef MALLOC_USING_SBRK + +/* + * This is the minimum chunk size we will ask the kernel for using + * malloc(); this should be a multiple of the page size on all + * architectures. + */ +#define MALLOC_CHUNK_SIZE 65536 +#define MALLOC_CHUNK_MASK (MALLOC_CHUNK_SIZE-1) + +/* + * This is the minimum alignment for the memory returned by sbrk(). + * It must be a power of 2. If MALLOC_USING_SBRK is defined it should + * be no smaller than the size of struct arena_header in malloc.h (4 + * pointers.) + */ +#define SBRK_ALIGNMENT 32 + +#endif /* _KLIBC_SYSCONFIG_H */ diff --git a/klibc/include/limits.h b/klibc/include/limits.h new file mode 100644 index 0000000000..f1532e5323 --- /dev/null +++ b/klibc/include/limits.h @@ -0,0 +1,40 @@ +/* + * limits.h + */ + +#ifndef _LIMITS_H +#define _LIMITS_H + +#define CHAR_BIT 8 +#define SHRT_BIT 16 +#define INT_BIT 32 +#define LONGLONG_BIT 64 + +#define SCHAR_MIN (-128) +#define SCHAR_MAX 127 +#define UCHAR_MAX 255 + +#ifdef __CHAR_UNSIGNED__ +# define CHAR_MIN 0 +# define CHAR_MAX UCHAR_MAX +#else +# define CHAR_MIN SCHAR_MIN +# define CHAR_MAX SCHAR_MAX +#endif + +#define SHRT_MIN (-32768) +#define SHRT_MAX 32767 +#define USHRT_MAX 65535 + +#define INT_MIN (-2147483647-1) +#define INT_MAX 2147483647 +#define UINT_MAX 4294967295U + +#define LONGLONG_MIN (-9223372036854775807LL-1) +#define LONGLONG_MAX 9223372036854775807LL +#define ULONGLONG_MAX 18446744073709551615ULL + +#include +#include + +#endif /* _LIMITS_H */ diff --git a/klibc/include/net/if.h b/klibc/include/net/if.h new file mode 100644 index 0000000000..1aa8e7b90c --- /dev/null +++ b/klibc/include/net/if.h @@ -0,0 +1 @@ +#include diff --git a/klibc/include/net/if_arp.h b/klibc/include/net/if_arp.h new file mode 100644 index 0000000000..a25f1b4759 --- /dev/null +++ b/klibc/include/net/if_arp.h @@ -0,0 +1 @@ +#include diff --git a/klibc/include/net/if_ether.h b/klibc/include/net/if_ether.h new file mode 100644 index 0000000000..060ef22070 --- /dev/null +++ b/klibc/include/net/if_ether.h @@ -0,0 +1 @@ +#include diff --git a/klibc/include/net/if_packet.h b/klibc/include/net/if_packet.h new file mode 100644 index 0000000000..b5e8e0e11f --- /dev/null +++ b/klibc/include/net/if_packet.h @@ -0,0 +1 @@ +#include diff --git a/klibc/include/netinet/in.h b/klibc/include/netinet/in.h new file mode 100644 index 0000000000..27b778700e --- /dev/null +++ b/klibc/include/netinet/in.h @@ -0,0 +1,39 @@ +/* + * netinet/in.h + */ + +#ifndef _NETINET_IN_H +#define _NETINET_IN_H + +/* added this include by Mats Petersson */ +#include + +#include +#include +#include /* Must be included *before* */ +#include + +#ifndef htons +# define htons(x) __cpu_to_be16(x) +#endif +#ifndef ntohs +# define ntohs(x) __be16_to_cpu(x) +#endif +#ifndef htonl +# define htonl(x) __cpu_to_be32(x) +#endif +#ifndef ntohl +# define ntohl(x) __be32_to_cpu(x) +#endif +#ifndef htonq +# define htonq(x) __cpu_to_be64(x) +#endif +#ifndef ntohq +# define ntohq(x) __be64_to_cpu(x) +#endif + +#define IPPORT_RESERVED 1024 + +__extern int bindresvport (int sd, struct sockaddr_in *sin); + +#endif /* _NETINET_IN_H */ diff --git a/klibc/include/netinet/in6.h b/klibc/include/netinet/in6.h new file mode 100644 index 0000000000..46584ca627 --- /dev/null +++ b/klibc/include/netinet/in6.h @@ -0,0 +1,10 @@ +/* + * netinet/in6.h + */ + +#ifndef _NETINET_IN6_H +#define _NETINET_IN6_H + +#include + +#endif /* _NETINET_IN6_H */ diff --git a/klibc/include/netinet/ip.h b/klibc/include/netinet/ip.h new file mode 100644 index 0000000000..8aecbe66a3 --- /dev/null +++ b/klibc/include/netinet/ip.h @@ -0,0 +1,13 @@ +/* + * netinet/ip.h + */ + +#ifndef _NETINET_IP_H +#define _NETINET_IP_H + +#include +#include + +#define IP_DF 0x4000 /* Flag: "Don't Fragment" */ + +#endif /* _NETINET_IP_H */ diff --git a/klibc/include/netinet/tcp.h b/klibc/include/netinet/tcp.h new file mode 100644 index 0000000000..bb5d307e98 --- /dev/null +++ b/klibc/include/netinet/tcp.h @@ -0,0 +1,11 @@ +/* + * netinet/tcp.h + */ + +#ifndef _NETINET_TCP_H +#define _NETINET_TCP_H + +#include /* Include *before* linux/tcp.h */ +#include + +#endif /* _NETINET_TCP_H */ diff --git a/klibc/include/netinet/udp.h b/klibc/include/netinet/udp.h new file mode 100644 index 0000000000..b809b4ee6e --- /dev/null +++ b/klibc/include/netinet/udp.h @@ -0,0 +1,19 @@ +/* + * netinet/udp.h + */ + +#ifndef _NETINET_UDP_H +#define _NETINET_UDP_H + +/* + * We would include linux/udp.h, but it brings in too much other stuff + */ + +struct udphdr { + __u16 source; + __u16 dest; + __u16 len; + __u16 check; +}; + +#endif /* _NETINET_UDP_H */ diff --git a/klibc/include/paths.h b/klibc/include/paths.h new file mode 100644 index 0000000000..a87831e74a --- /dev/null +++ b/klibc/include/paths.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)paths.h 8.1 (Berkeley) 6/2/93 + */ + +#ifndef _PATHS_H_ +#define _PATHS_H_ + +/* Default search path. */ +#define _PATH_DEFPATH "/usr/bin:/bin" +/* All standard utilities path. */ +#define _PATH_STDPATH \ + "/usr/bin:/bin:/usr/sbin:/sbin" + +#define _PATH_BSHELL "/bin/sh" +#define _PATH_CONSOLE "/dev/console" +#define _PATH_CSHELL "/bin/csh" +#define _PATH_DEVDB "/var/run/dev.db" +#define _PATH_DEVNULL "/dev/null" +#define _PATH_DRUM "/dev/drum" +#define _PATH_KLOG "/proc/kmsg" +#define _PATH_KMEM "/dev/kmem" +#define _PATH_LASTLOG "/var/log/lastlog" +#define _PATH_MAILDIR "/var/mail" +#define _PATH_MAN "/usr/share/man" +#define _PATH_MEM "/dev/mem" +#define _PATH_MNTTAB "/etc/fstab" +#define _PATH_MOUNTED "/etc/mtab" +#define _PATH_NOLOGIN "/etc/nologin" +#define _PATH_PRESERVE "/var/lib" +#define _PATH_RWHODIR "/var/spool/rwho" +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#define _PATH_SHADOW "/etc/shadow" +#define _PATH_SHELLS "/etc/shells" +#define _PATH_TTY "/dev/tty" +#define _PATH_UNIX "/boot/vmlinux" +#define _PATH_UTMP "/var/run/utmp" +#define _PATH_VI "/bin/vi" +#define _PATH_WTMP "/var/log/wtmp" + +/* Provide trailing slash, since mostly used for building pathnames. */ +#define _PATH_DEV "/dev/" +#define _PATH_TMP "/tmp/" +#define _PATH_VARDB "/var/db/" +#define _PATH_VARRUN "/var/run/" +#define _PATH_VARTMP "/var/tmp/" + +#endif /* !_PATHS_H_ */ diff --git a/klibc/include/poll.h b/klibc/include/poll.h new file mode 100644 index 0000000000..8710d92ebd --- /dev/null +++ b/klibc/include/poll.h @@ -0,0 +1,16 @@ +/* + * poll.h + */ + +#ifndef _POLL_H +#define _POLL_H + +#include +#include + +/* POSIX specifies "int" for the timeout, Linux seems to use long... */ + +typedef unsigned int nfds_t; +__extern int poll(struct pollfd *, nfds_t, long); + +#endif /* _POLL_H */ diff --git a/klibc/include/sched.h b/klibc/include/sched.h new file mode 100644 index 0000000000..fcf62a6e4f --- /dev/null +++ b/klibc/include/sched.h @@ -0,0 +1,34 @@ +/* + * sched.h + */ + +#ifndef _SCHED_H +#define _SCHED_H + +#include + +/* linux/sched.h is unusable; put the declarations we need here... */ + +#define SCHED_NORMAL 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 + +struct sched_param { + int sched_priority; +}; + +__extern int sched_setscheduler(pid_t, int, const struct sched_param *); +__extern int sched_yield(void); + +/* Raw interfaces to clone(2); only actually usable for non-VM-cloning */ +#ifdef __ia64__ +__extern pid_t __clone2(int, void *, void *); +static __inline__ pid_t __clone(int _f, void *_sp) +{ + return __clone2(_f, _sp, 0); +} +#else +__extern pid_t __clone(int, void *); +#endif + +#endif /* _SCHED_H */ diff --git a/klibc/include/setjmp.h b/klibc/include/setjmp.h new file mode 100644 index 0000000000..b504eb6d08 --- /dev/null +++ b/klibc/include/setjmp.h @@ -0,0 +1,43 @@ +/* + * setjmp.h + */ + +#ifndef _SETJMP_H +#define _SETJMP_H + +#include +#include +#include +#include + +#include + +__extern int setjmp(jmp_buf); +__extern __noreturn longjmp(jmp_buf, int); + +/* + Whose bright idea was it to add unrelated functionality to just about + the only function in the standard C library (setjmp) which cannot be + wrapped by an ordinary function wrapper? Anyway, the damage is done, + and therefore, this wrapper *must* be inline. However, gcc will + complain if this is an inline function for unknown reason, and + therefore sigsetjmp() needs to be a macro. +*/ + +struct __sigjmp_buf { + jmp_buf __jmpbuf; + sigset_t __sigs; +}; + +typedef struct __sigjmp_buf sigjmp_buf[1]; + +#define sigsetjmp(__env, __save) \ +({ \ + struct __sigjmp_buf *__e = (__env); \ + sigprocmask(0, NULL, &__e->__sigs); \ + setjmp(__e->__jmpbuf); \ +}) + +__extern __noreturn siglongjmp(sigjmp_buf, int); + +#endif /* _SETJMP_H */ diff --git a/klibc/include/signal.h b/klibc/include/signal.h new file mode 100644 index 0000000000..1b439077f2 --- /dev/null +++ b/klibc/include/signal.h @@ -0,0 +1,81 @@ +/* + * signal.h + */ + +#ifndef _SIGNAL_H +#define _SIGNAL_H + +#include +#include +#include /* For memset() */ +#include /* For LONG_BIT */ +#include +#include + +#include + +/* glibc seems to use sig_atomic_t as "int" pretty much on all architectures. + Do the same, but allow the architecture to override. */ +#ifdef _KLIBC_HAS_ARCH_SIG_ATOMIC_T +typedef int sig_atomic_t; +#endif + +/* Some architectures don't define these */ +#ifndef SA_RESETHAND +# define SA_RESETHAND SA_ONESHOT +#endif +#ifndef SA_NODEFER +# define SA_NODEFER SA_NOMASK +#endif +#ifndef NSIG +# define NSIG _NSIG +#endif + +__extern const char * const sys_siglist[]; + +/* This assumes sigset_t is either an unsigned long or an array of such, + and that _NSIG_BPW in the kernel is always LONG_BIT */ + +static __inline__ int sigemptyset(sigset_t *__set) +{ + memset(__set, 0, sizeof *__set); + return 0; +} +static __inline__ int sigfillset(sigset_t *__set) +{ + memset(__set, ~0, sizeof *__set); + return 0; +} +static __inline__ int sigaddset(sigset_t *__set, int __signum) +{ + unsigned long *__lset = (unsigned long *)__set; + __lset[__signum/LONG_BIT] |= 1UL << (__signum%LONG_BIT); + return 0; +} +static __inline__ int sigdelset(sigset_t *__set, int __signum) +{ + unsigned long *__lset = (unsigned long *)__set; + __lset[__signum/LONG_BIT] &= ~(1UL << (__signum%LONG_BIT)); + return 0; +} +static __inline__ int sigismember(sigset_t *__set, int __signum) +{ + unsigned long *__lset = (unsigned long *)__set; + return (int)((__lset[__signum/LONG_BIT] >> (__signum%LONG_BIT)) & 1); +} + +__extern __sighandler_t __signal(int, __sighandler_t, int); +__extern __sighandler_t sysv_signal(int, __sighandler_t); +__extern __sighandler_t bsd_signal(int, __sighandler_t); +__extern int sigaction(int, const struct sigaction *, struct sigaction *); +__extern int sigprocmask(int, const sigset_t *, sigset_t *); +__extern int sigpending(sigset_t *); +__extern int sigsuspend(const sigset_t *); +__extern int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t); +__extern int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t); +__extern int rt_sigpending(sigset_t *, size_t); +__extern int rt_sigsuspend(const sigset_t *, size_t); +__extern int raise(int); +__extern int kill(pid_t, int); + +#endif /* _SIGNAL_H */ diff --git a/klibc/include/stdarg.h b/klibc/include/stdarg.h new file mode 100644 index 0000000000..cc324b825d --- /dev/null +++ b/klibc/include/stdarg.h @@ -0,0 +1,14 @@ +/* + * stdarg.h + * + * This is just a wrapper for the gcc one, but defines va_copy() + * even if gcc doesn't. + */ + +/* Note: the _STDARG_H macro belongs to the gcc header... */ +#include_next + +/* Older gcc considers this an extension, so it's double underbar only */ +#ifndef va_copy +#define va_copy(d,s) __va_copy(d,s) +#endif diff --git a/klibc/include/stddef.h b/klibc/include/stddef.h new file mode 100644 index 0000000000..125d2352ec --- /dev/null +++ b/klibc/include/stddef.h @@ -0,0 +1,24 @@ +/* + * stddef.h + */ + +#ifndef _STDDEF_H +#define _STDDEF_H + +#ifndef __KLIBC__ +# define __KLIBC__ 1 +#endif + +#include + +#undef NULL +#ifdef __cplusplus +# define NULL 0 +#else +# define NULL ((void *)0) +#endif + +#undef offsetof +#define offsetof(t,m) ((size_t)&((t *)0)->m) + +#endif /* _STDDEF_H */ diff --git a/klibc/include/stdint.h b/klibc/include/stdint.h new file mode 100644 index 0000000000..47fec18594 --- /dev/null +++ b/klibc/include/stdint.h @@ -0,0 +1,116 @@ +/* + * stdint.h + */ + +#ifndef _STDINT_H +#define _STDINT_H + +#include + +typedef int8_t int_least8_t; +typedef int16_t int_least16_t; +typedef int32_t int_least32_t; +typedef int64_t int_least64_t; + +typedef uint8_t uint_least8_t; +typedef uint16_t uint_least16_t; +typedef uint32_t uint_least32_t; +typedef uint64_t uint_least64_t; + +typedef int8_t int_fast8_t; +typedef int64_t int_fast64_t; + +typedef uint8_t uint_fast8_t; +typedef uint64_t uint_fast64_t; + +typedef int64_t intmax_t; +typedef uint64_t uintmax_t; + +#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) + +#define INT8_MIN (-128) +#define INT16_MIN (-32768) +#define INT32_MIN (-2147483647-1) +#define INT64_MIN (__INT64_C(-9223372036854775807)-1) + +#define INT8_MAX (127) +#define INT16_MAX (32767) +#define INT32_MAX (2147483647) +#define INT64_MAX (__INT64_C(9223372036854775807)) + +#define UINT8_MAX (255U) +#define UINT16_MAX (65535U) +#define UINT32_MAX (4294967295U) +#define UINT64_MAX (__UINT64_C(18446744073709551615)) + +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST64_MIN INT64_MIN + +#define INT_LEAST8_MAX INT8_MAX +#define INT_LEAST16_MAX INT16_MAX +#define INT_LEAST32_MAX INT32_MAX +#define INT_LEAST64_MAX INT64_MAX + +#define UINT_LEAST8_MAX UINT8_MAX +#define UINT_LEAST16_MAX UINT16_MAX +#define UINT_LEAST32_MAX UINT32_MAX +#define UINT_LEAST64_MAX UINT64_MAX + +#define INT_FAST8_MIN INT8_MIN +#define INT_FAST64_MIN INT64_MIN + +#define INT_FAST8_MAX INT8_MAX +#define INT_FAST64_MAX INT64_MAX + +#define UINT_FAST8_MAX UINT8_MAX +#define UINT_FAST64_MAX UINT64_MAX + +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#define UINTMAX_MAX UINT64_MAX + +#include + +#endif + +#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) + +#define INT8_C(c) c +#define INT16_C(c) c +#define INT32_C(c) c +#define INT64_C(c) __INT64_C(c) + +#define UINT8_C(c) c ## U +#define UINT16_C(c) c ## U +#define UINT32_C(c) c ## U +#define UINT64_C(c) __UINT64_C(c) + +#define INT_LEAST8_C(c) INT8_C(c) +#define INT_LEAST16_C(c) INT16_C(c) +#define INT_LEAST32_C(c) INT32_C(c) +#define INT_LEAST64_C(c) INT64_C(c) + +#define UINT_LEAST8_C(c) UINT8_C(c) +#define UINT_LEAST16_C(c) UINT16_C(c) +#define UINT_LEAST32_C(c) UINT32_C(c) +#define UINT_LEAST64_C(c) UINT64_C(c) + +#define INT_FAST8_C(c) INT8_C(c) +#define INT_FAST64_C(c) INT64_C(c) + +#define UINT_FAST8_C(c) UINT8_C(c) +#define UINT_FAST64_C(c) UINT64_C(c) + +#define INTMAX_C(c) INT64_C(c) +#define UINTMAX_C(c) UINT64_C(c) + +#include + +#endif + +/* Keep the kernel from trying to define these types... */ +#define __BIT_TYPES_DEFINED__ + +#endif /* _STDINT_H */ diff --git a/klibc/include/stdio.h b/klibc/include/stdio.h new file mode 100644 index 0000000000..e00fac4d5e --- /dev/null +++ b/klibc/include/stdio.h @@ -0,0 +1,123 @@ +/* + * stdio.h + */ + +#ifndef _STDIO_H +#define _STDIO_H + +#include +#include +#include +#include + +/* This structure doesn't really exist, but it gives us something + to define FILE * with */ +struct _IO_file; +typedef struct _IO_file FILE; + +#ifndef EOF +# define EOF (-1) +#endif + +#ifndef BUFSIZ +# define BUFSIZ 4096 +#endif + +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +/* + * Convert between a FILE * and a file descriptor. We don't actually + * have any in-memory data, so we just abuse the pointer itself to + * hold the data. Note, however, that for file descriptors, -1 is + * error and 0 is a valid value; for FILE *, NULL (0) is error and + * non-NULL are valid. + */ +static __inline__ int fileno(FILE *__f) +{ + /* This should really be intptr_t, but size_t should be the same size */ + return (int)(size_t)__f - 1; +} + +/* This is a macro so it can be used as initializer */ +#define __create_file(__fd) ((FILE *)(size_t)((__fd) + 1)) + +#define stdin __create_file(0) +#define stdout __create_file(1) +#define stderr __create_file(2) + +__extern FILE *fopen(const char *, const char *); + +static __inline__ FILE *fdopen(int __fd, const char *__m) +{ + (void)__m; return __create_file(__fd); +} +static __inline__ int fclose(FILE *__f) +{ + extern int close(int); + return close(fileno(__f)); +} +static __inline__ int fseek(FILE *__f, off_t __o, int __w) +{ + extern off_t lseek(int, off_t, int); + return (lseek(fileno(__f), __o, __w) == (off_t)-1) ? -1 : 0; +} +static __inline__ off_t ftell(FILE *__f) +{ + extern off_t lseek(int, off_t, int); + return lseek(fileno(__f), 0, SEEK_CUR); +} + +__extern int fputs(const char *, FILE *); +__extern int puts(const char *); +__extern int fputc(int, FILE *); +#define putc(c,f) fputc((c),(f)) +#define putchar(c) fputc((c),stdout) + +__extern int fgetc(FILE *); +__extern char * fgets(char *, int, FILE *); +#define getc(f) fgetc(f) + +__extern size_t _fread(void *, size_t, FILE *); +__extern size_t _fwrite(const void *, size_t, FILE *); + +#ifndef __NO_FREAD_FWRITE_INLINES +extern __inline__ size_t +fread(void *__p, size_t __s, size_t __n, FILE *__f) +{ + return _fread(__p, __s*__n, __f)/__s; +} + +extern __inline__ size_t +fwrite(void *__p, size_t __s, size_t __n, FILE *__f) +{ + return _fwrite(__p, __s*__n, __f)/__s; +} +#endif + +__extern int printf(const char *, ...); +__extern int vprintf(const char *, va_list); +__extern int fprintf(FILE *, const char *, ...); +__extern int vfprintf(FILE *, const char *, va_list); +__extern int sprintf(char *, const char *, ...); +__extern int vsprintf(char *, const char *, va_list); +__extern int snprintf(char *, size_t n, const char *, ...); +__extern int vsnprintf(char *, size_t n, const char *, va_list); + +/* No buffering, so no flushing needed */ +extern __inline__ int +fflush(FILE *__f) +{ + (void)__f; + return 0; +} + +__extern int sscanf(const char *, const char *, ...); +__extern int vsscanf(const char *, const char *, va_list); + +__extern void perror(const char *); + +__extern int rename(const char *, const char *); + +#endif /* _STDIO_H */ diff --git a/klibc/include/stdlib.h b/klibc/include/stdlib.h new file mode 100644 index 0000000000..be4e76ed9f --- /dev/null +++ b/klibc/include/stdlib.h @@ -0,0 +1,90 @@ +/* + * stdlib.h + */ + +#ifndef _STDLIB_H +#define _STDLIB_H + +#include +#include +#include + +#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 + +static __inline__ __noreturn _Exit(int __n) { + __extern __noreturn _exit(int); + _exit(__n); + for(;;); /* Some gcc versions are stupid */ +} +__extern __noreturn abort(void); +static __inline__ int abs(int __n) { + return (__n < 0) ? -__n : __n; +} +__extern int atexit(void (*)(void)); +__extern int on_exit(void (*)(int, void *), void *); +__extern int atoi(const char *); +__extern long atol(const char *); +__extern long long atoll(const char *); +__extern __noreturn exit(int); +__extern void free(void *); +static __inline__ long labs(long __n) { + return (__n < 0L) ? -__n : __n; +} + +static __inline__ long long llabs(long long __n) { + return (__n < 0LL) ? -__n : __n; +} + +__extern __mallocfunc void *malloc(size_t); +__extern __mallocfunc void *calloc(size_t, size_t); +__extern __mallocfunc void *realloc(void *, size_t); +__extern long strtol(const char *, char **, int); +__extern long long strtoll(const char *, char **, int); +__extern unsigned long strtoul(const char *, char **, int); +__extern unsigned long long strtoull(const char *, char **, int); + +__extern char *getenv(const char *); +__extern int putenv(const char *); +__extern int setenv(const char *, const char *, int); +__extern int unsetenv(const char *); + +__extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); + + +__extern long jrand48(unsigned short *); +__extern long mrand48(void); +__extern long nrand48(unsigned short *); +__extern long lrand48(void); +__extern unsigned short *seed48(const unsigned short *); +__extern void srand48(long); + +#define RAND_MAX 0x7fffffff +static __inline__ int rand(void) { + return (int)lrand48(); +} +static __inline__ void srand(unsigned int __s) { + srand48(__s); +} +static __inline__ long random(void) +{ + return lrand48(); +} +static __inline__ void srandom(unsigned int __s) +{ + srand48(__s); +} + +/* Basic PTY functions. These only work if devpts is mounted! */ + +__extern int unlockpt(int); +__extern char *ptsname(int); +__extern int getpt(void); + +static __inline__ int grantpt(int __fd) +{ + (void)__fd; + return 0; /* devpts does this all for us! */ +} + +#endif /* _STDLIB_H */ diff --git a/klibc/include/string.h b/klibc/include/string.h new file mode 100644 index 0000000000..3bbb217e98 --- /dev/null +++ b/klibc/include/string.h @@ -0,0 +1,43 @@ +/* + * string.h + */ + +#ifndef _STRING_H +#define _STRING_H + +#include +#include + +__extern void *memccpy(void *, const void *, int, size_t); +__extern void *memchr(const void *, int, size_t); +__extern int memcmp(const void *, const void *, size_t); +__extern void *memcpy(void *, const void *, size_t); +__extern void *memmove(void *, const void *, size_t); +__extern void *memset(void *, int, size_t); +__extern void *memmem(const void *, size_t, const void *, size_t); +__extern void memswap(void *, void *, size_t); +__extern int strcasecmp(const char *, const char *); +__extern int strncasecmp(const char *, const char *, size_t); +__extern char *strcat(char *, const char *); +__extern char *strchr(const char *, int); +__extern int strcmp(const char *, const char *); +__extern char *strcpy(char *, const char *); +__extern size_t strcspn(const char *, const char *); +__extern char *strdup(const char *); +__extern char *strndup(const char *, size_t); +__extern char *strerror(int); +__extern size_t strlen(const char *); +__extern size_t strnlen(const char *, size_t); +__extern char *strncat(char *, const char *, size_t); +__extern size_t strlcat(char *, const char *, size_t); +__extern int strncmp(const char *, const char *, size_t); +__extern char *strncpy(char *, const char *, size_t); +__extern size_t strlcpy(char *, const char *, size_t); +__extern char *strpbrk(const char *, const char *); +__extern char *strrchr(const char *, int); +__extern char *strsep(char **, const char *); +__extern size_t strspn(const char *, const char *); +__extern char *strstr(const char *, const char *); +__extern char *strtok(char *, const char *); + +#endif /* _STRING_H */ diff --git a/klibc/include/sys/dirent.h b/klibc/include/sys/dirent.h new file mode 100644 index 0000000000..eec470ce1a --- /dev/null +++ b/klibc/include/sys/dirent.h @@ -0,0 +1,21 @@ +/* + * sys/dirent.h + */ + +#ifndef _SYS_DIRENT_H +#define _SYS_DIRENT_H + +#include + +/* The kernel calls this struct dirent64 */ +struct dirent { + uint64_t d_ino; + int64_t d_off; + unsigned short d_reclen; + unsigned char d_type; + char d_name[256]; +}; + +__extern int getdents(unsigned int, struct dirent *, unsigned int); + +#endif /* _SYS_DIRENT_H */ diff --git a/klibc/include/sys/elf32.h b/klibc/include/sys/elf32.h new file mode 100644 index 0000000000..652de5bc5f --- /dev/null +++ b/klibc/include/sys/elf32.h @@ -0,0 +1,115 @@ +/* + * sys/elf32.h + */ + +#ifndef _SYS_ELF32_H +#define _SYS_ELF32_H + +#include + +/* ELF standard typedefs (yet more proof that was way overdue) */ +typedef uint16_t Elf32_Half; +typedef int16_t Elf32_SHalf; +typedef uint32_t Elf32_Word; +typedef int32_t Elf32_Sword; +typedef uint64_t Elf32_Xword; +typedef int64_t Elf32_Sxword; + +typedef uint32_t Elf32_Off; +typedef uint32_t Elf32_Addr; +typedef uint16_t Elf32_Section; + +/* Dynamic header */ + +typedef struct elf32_dyn { + Elf32_Sword d_tag; + union{ + Elf32_Sword d_val; + Elf32_Addr d_ptr; + } d_un; +} Elf32_Dyn; + +/* Relocations */ + +#define ELF32_R_SYM(x) ((x) >> 8) +#define ELF32_R_TYPE(x) ((x) & 0xff) + +typedef struct elf32_rel { + Elf32_Addr r_offset; + Elf32_Word r_info; +} Elf32_Rel; + +typedef struct elf32_rela { + Elf32_Addr r_offset; + Elf32_Word r_info; + Elf32_Sword r_addend; +} Elf32_Rela; + +/* Symbol */ + +typedef struct elf32_sym { + Elf32_Word st_name; + Elf32_Addr st_value; + Elf32_Word st_size; + unsigned char st_info; + unsigned char st_other; + Elf32_Half st_shndx; +} Elf32_Sym; + +/* Main file header */ + +typedef struct elf32_hdr { + unsigned char e_ident[EI_NIDENT]; + Elf32_Half e_type; + Elf32_Half e_machine; + Elf32_Word e_version; + Elf32_Addr e_entry; + Elf32_Off e_phoff; + Elf32_Off e_shoff; + Elf32_Word e_flags; + Elf32_Half e_ehsize; + Elf32_Half e_phentsize; + Elf32_Half e_phnum; + Elf32_Half e_shentsize; + Elf32_Half e_shnum; + Elf32_Half e_shstrndx; +} Elf32_Ehdr; + +/* Program header */ + +typedef struct elf32_phdr { + Elf32_Word p_type; + Elf32_Off p_offset; + Elf32_Addr p_vaddr; + Elf32_Addr p_paddr; + Elf32_Word p_filesz; + Elf32_Word p_memsz; + Elf32_Word p_flags; + Elf32_Word p_align; +} Elf32_Phdr; + + +/* Section header */ + +typedef struct elf32_shdr { + Elf32_Word sh_name; + Elf32_Word sh_type; + Elf32_Word sh_flags; + Elf32_Addr sh_addr; + Elf32_Off sh_offset; + Elf32_Word sh_size; + Elf32_Word sh_link; + Elf32_Word sh_info; + Elf32_Word sh_addralign; + Elf32_Word sh_entsize; +} Elf32_Shdr; + +/* Note header */ +typedef struct elf32_note { + Elf32_Word n_namesz; /* Name size */ + Elf32_Word n_descsz; /* Content size */ + Elf32_Word n_type; /* Content type */ +} Elf32_Nhdr; + +#endif /* _SYS_ELF32_H */ + diff --git a/klibc/include/sys/elf64.h b/klibc/include/sys/elf64.h new file mode 100644 index 0000000000..750ddac4d9 --- /dev/null +++ b/klibc/include/sys/elf64.h @@ -0,0 +1,115 @@ +/* + * sys/elf64.h + */ + +#ifndef _SYS_ELF64_H +#define _SYS_ELF64_H + +#include + +/* ELF standard typedefs (yet more proof that was way overdue) */ +typedef uint16_t Elf64_Half; +typedef int16_t Elf64_SHalf; +typedef uint32_t Elf64_Word; +typedef int32_t Elf64_Sword; +typedef uint64_t Elf64_Xword; +typedef int64_t Elf64_Sxword; + +typedef uint64_t Elf64_Off; +typedef uint64_t Elf64_Addr; +typedef uint16_t Elf64_Section; + +/* Dynamic header */ + +typedef struct elf64_dyn { + Elf64_Sxword d_tag; + union{ + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } d_un; +} Elf64_Dyn; + +/* Relocations */ + +#define ELF64_R_SYM(x) ((x) >> 32) +#define ELF64_R_TYPE(x) ((x) & 0xffffffff) + +typedef struct elf64_rel { + Elf64_Addr r_offset; + Elf64_Xword r_info; +} Elf64_Rel; + +typedef struct elf64_rela { + Elf64_Addr r_offset; + Elf64_Xword r_info; + Elf64_Sxword r_addend; +} Elf64_Rela; + +/* Symbol */ + +typedef struct elf64_sym { + Elf64_Word st_name; + unsigned char st_info; + unsigned char st_other; + Elf64_Half st_shndx; + Elf64_Addr st_value; + Elf64_Xword st_size; +} Elf64_Sym; + +/* Main file header */ + +typedef struct elf64_hdr { + unsigned char e_ident[EI_NIDENT]; + Elf64_Half e_type; + Elf64_Half e_machine; + Elf64_Word e_version; + Elf64_Addr e_entry; + Elf64_Off e_phoff; + Elf64_Off e_shoff; + Elf64_Word e_flags; + Elf64_Half e_ehsize; + Elf64_Half e_phentsize; + Elf64_Half e_phnum; + Elf64_Half e_shentsize; + Elf64_Half e_shnum; + Elf64_Half e_shstrndx; +} Elf64_Ehdr; + +/* Program header */ + +typedef struct elf64_phdr { + Elf64_Word p_type; + Elf64_Word p_flags; + Elf64_Off p_offset; + Elf64_Addr p_vaddr; + Elf64_Addr p_paddr; + Elf64_Xword p_filesz; + Elf64_Xword p_memsz; + Elf64_Xword p_align; +} Elf64_Phdr; + + +/* Section header */ + +typedef struct elf64_shdr { + Elf64_Word sh_name; + Elf64_Word sh_type; + Elf64_Xword sh_flags; + Elf64_Addr sh_addr; + Elf64_Off sh_offset; + Elf64_Xword sh_size; + Elf64_Word sh_link; + Elf64_Word sh_info; + Elf64_Xword sh_addralign; + Elf64_Xword sh_entsize; +} Elf64_Shdr; + +/* Note header */ +typedef struct elf64_note { + Elf64_Word n_namesz; /* Name size */ + Elf64_Word n_descsz; /* Content size */ + Elf64_Word n_type; /* Content type */ +} Elf64_Nhdr; + +#endif /* _SYS_ELF64_H */ + diff --git a/klibc/include/sys/elfcommon.h b/klibc/include/sys/elfcommon.h new file mode 100644 index 0000000000..d25804e483 --- /dev/null +++ b/klibc/include/sys/elfcommon.h @@ -0,0 +1,188 @@ +/* + * sys/elfcommon.h + */ + +#ifndef _SYS_ELFCOMMON_H +#define _SYS_ELFCOMMON_H + +#include + +/* Segment types */ +#define PT_NULL 0 +#define PT_LOAD 1 +#define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_LOOS 0x60000000 +#define PT_HIOS 0x6fffffff +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff +#define PT_GNU_EH_FRAME 0x6474e550 /* Extension, eh? */ + +/* ELF file types */ +#define ET_NONE 0 +#define ET_REL 1 +#define ET_EXEC 2 +#define ET_DYN 3 +#define ET_CORE 4 +#define ET_LOPROC 0xff00 +#define ET_HIPROC 0xffff + +/* ELF machine types */ +#define EM_NONE 0 +#define EM_M32 1 +#define EM_SPARC 2 +#define EM_386 3 +#define EM_68K 4 +#define EM_88K 5 +#define EM_486 6 /* Not used in Linux at least */ +#define EM_860 7 +#define EM_MIPS 8 /* R3k, bigendian(?) */ +#define EM_MIPS_RS4_BE 10 /* R4k BE */ +#define EM_PARISC 15 +#define EM_SPARC32PLUS 18 +#define EM_PPC 20 +#define EM_PPC64 21 +#define EM_S390 22 +#define EM_SH 42 +#define EM_SPARCV9 43 /* v9 = SPARC64 */ +#define EM_H8_300H 47 +#define EM_H8S 48 +#define EM_IA_64 50 /* Itanic */ +#define EM_X86_64 62 +#define EM_CRIS 76 +#define EM_V850 87 +#define EM_ALPHA 0x9026 /* Interrim Alpha that stuck around */ +#define EM_CYGNUS_V850 0x9080 /* Old v850 ID used by Cygnus */ +#define EM_S390_OLD 0xA390 /* Obsolete interrim value for S/390 */ + +/* Dynamic type values */ +#define DT_NULL 0 +#define DT_NEEDED 1 +#define DT_PLTRELSZ 2 +#define DT_PLTGOT 3 +#define DT_HASH 4 +#define DT_STRTAB 5 +#define DT_SYMTAB 6 +#define DT_RELA 7 +#define DT_RELASZ 8 +#define DT_RELAENT 9 +#define DT_STRSZ 10 +#define DT_SYMENT 11 +#define DT_INIT 12 +#define DT_FINI 13 +#define DT_SONAME 14 +#define DT_RPATH 15 +#define DT_SYMBOLIC 16 +#define DT_REL 17 +#define DT_RELSZ 18 +#define DT_RELENT 19 +#define DT_PLTREL 20 +#define DT_DEBUG 21 +#define DT_TEXTREL 22 +#define DT_JMPREL 23 +#define DT_LOPROC 0x70000000 +#define DT_HIPROC 0x7fffffff + +/* Auxilliary table entries */ +#define AT_NULL 0 /* end of vector */ +#define AT_IGNORE 1 /* entry should be ignored */ +#define AT_EXECFD 2 /* file descriptor of program */ +#define AT_PHDR 3 /* program headers for program */ +#define AT_PHENT 4 /* size of program header entry */ +#define AT_PHNUM 5 /* number of program headers */ +#define AT_PAGESZ 6 /* system page size */ +#define AT_BASE 7 /* base address of interpreter */ +#define AT_FLAGS 8 /* flags */ +#define AT_ENTRY 9 /* entry point of program */ +#define AT_NOTELF 10 /* program is not ELF */ +#define AT_UID 11 /* real uid */ +#define AT_EUID 12 /* effective uid */ +#define AT_GID 13 /* real gid */ +#define AT_EGID 14 /* effective gid */ +#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ +#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ +#define AT_CLKTCK 17 /* frequency at which times() increments */ +/* 18..22 = ? */ +#define AT_SECURE 23 /* secure mode boolean */ + +/* Program header permission flags */ +#define PF_X 0x1 +#define PF_W 0x2 +#define PF_R 0x4 + +/* Section header types */ +#define SHT_NULL 0 +#define SHT_PROGBITS 1 +#define SHT_SYMTAB 2 +#define SHT_STRTAB 3 +#define SHT_RELA 4 +#define SHT_HASH 5 +#define SHT_DYNAMIC 6 +#define SHT_NOTE 7 +#define SHT_NOBITS 8 +#define SHT_REL 9 +#define SHT_SHLIB 10 +#define SHT_DYNSYM 11 +#define SHT_NUM 12 +#define SHT_LOPROC 0x70000000 +#define SHT_HIPROC 0x7fffffff +#define SHT_LOUSER 0x80000000 +#define SHT_HIUSER 0xffffffff + +/* Section header flags */ +#define SHF_WRITE 0x1 +#define SHF_ALLOC 0x2 +#define SHF_EXECINSTR 0x4 +#define SHF_MASKPROC 0xf0000000 + +/* Special section numbers */ +#define SHN_UNDEF 0 +#define SHN_LORESERVE 0xff00 +#define SHN_LOPROC 0xff00 +#define SHN_HIPROC 0xff1f +#define SHN_ABS 0xfff1 +#define SHN_COMMON 0xfff2 +#define SHN_HIRESERVE 0xffff + +/* Lenght of magic at the start of a file */ +#define EI_NIDENT 16 + +/* Magic number constants... */ +#define EI_MAG0 0 /* e_ident[] indexes */ +#define EI_MAG1 1 +#define EI_MAG2 2 +#define EI_MAG3 3 +#define EI_CLASS 4 +#define EI_DATA 5 +#define EI_VERSION 6 +#define EI_OSABI 7 +#define EI_PAD 8 + +#define ELFMAG0 0x7f /* EI_MAG */ +#define ELFMAG1 'E' +#define ELFMAG2 'L' +#define ELFMAG3 'F' +#define ELFMAG "\177ELF" +#define SELFMAG 4 + +#define ELFCLASSNONE 0 /* EI_CLASS */ +#define ELFCLASS32 1 +#define ELFCLASS64 2 +#define ELFCLASSNUM 3 + +#define ELFDATANONE 0 /* e_ident[EI_DATA] */ +#define ELFDATA2LSB 1 +#define ELFDATA2MSB 2 + +#define EV_NONE 0 /* e_version, EI_VERSION */ +#define EV_CURRENT 1 +#define EV_NUM 2 + +#define ELFOSABI_NONE 0 +#define ELFOSABI_LINUX 3 + +#endif /* _SYS_ELFCOMMON_H */ + diff --git a/klibc/include/sys/fsuid.h b/klibc/include/sys/fsuid.h new file mode 100644 index 0000000000..823486b776 --- /dev/null +++ b/klibc/include/sys/fsuid.h @@ -0,0 +1,14 @@ +/* + * sys/fsuid.h + */ + +#ifndef _SYS_FSUID_H +#define _SYS_FSUID_H + +#include +#include + +__extern int setfsuid(uid_t); +__extern int setfsgid(gid_t); + +#endif /* _SYS_FSUID_H */ diff --git a/klibc/include/sys/ioctl.h b/klibc/include/sys/ioctl.h new file mode 100644 index 0000000000..b0cee4c02c --- /dev/null +++ b/klibc/include/sys/ioctl.h @@ -0,0 +1,14 @@ +/* + * sys/ioctl.h + */ + +#ifndef _SYS_IOCTL_H +#define _SYS_IOCTL_H + +#include +#include +#include + +__extern int ioctl(int, int, void *); + +#endif /* _SYS_IOCTL_H */ diff --git a/klibc/include/sys/klog.h b/klibc/include/sys/klog.h new file mode 100644 index 0000000000..0fc5f5d945 --- /dev/null +++ b/klibc/include/sys/klog.h @@ -0,0 +1,24 @@ +/* + * sys/klog.h + */ + +#ifndef _SYS_KLOG_H +#define _SYS_KLOG_H + +#include + +#define KLOG_CLOSE 0 +#define KLOG_OPEN 1 +#define KLOG_READ 2 +#define KLOG_READ_ALL 3 +#define KLOG_READ_CLEAR 4 +#define KLOG_CLEAR 5 +#define KLOG_DISABLE 6 +#define KLOG_ENABLE 7 +#define KLOG_SETLEVEL 8 +#define KLOG_UNREADSIZE 9 +#define KLOG_WRITE 10 + +__extern int klogctl(int, char *, int); + +#endif /* _SYS_KLOG_H */ diff --git a/klibc/include/sys/mman.h b/klibc/include/sys/mman.h new file mode 100644 index 0000000000..7f8f3e2f96 --- /dev/null +++ b/klibc/include/sys/mman.h @@ -0,0 +1,25 @@ +/* + * sys/mman.h + */ + +#ifndef _SYS_MMAN_H +#define _SYS_MMAN_H + +#include +#include +#include +#include /* For PAGE_SIZE */ + +#define MAP_FAILED ((void *)-1) + +__extern void *mmap(void *, size_t, int, int, int, off_t); +__extern int munmap(void *, size_t); +__extern void *mremap(void *, size_t, size_t, unsigned long); +__extern int msync(const void *, size_t, int); +__extern int mprotect(const void *, size_t, int); +__extern int mlockall(int); +__extern int munlockall(void); +__extern int mlock(const void *, size_t); +__extern int munlock(const void *, size_t); + +#endif /* _SYS_MMAN_H */ diff --git a/klibc/include/sys/mount.h b/klibc/include/sys/mount.h new file mode 100644 index 0000000000..313c90ec0e --- /dev/null +++ b/klibc/include/sys/mount.h @@ -0,0 +1,55 @@ +/* + * sys/mount.h + */ + +#ifndef _SYS_MOUNT_H +#define _SYS_MOUNT_H + +#include + +/* + * These are the fs-independent mount-flags: up to 32 flags are supported + */ +#define MS_RDONLY 1 /* Mount read-only */ +#define MS_NOSUID 2 /* Ignore suid and sgid bits */ +#define MS_NODEV 4 /* Disallow access to device special files */ +#define MS_NOEXEC 8 /* Disallow program execution */ +#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ +#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ +#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ +#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ +#define MS_NOATIME 1024 /* Do not update access times. */ +#define MS_NODIRATIME 2048 /* Do not update directory access times */ +#define MS_BIND 4096 +#define MS_MOVE 8192 +#define MS_REC 16384 +#define MS_VERBOSE 32768 +#define MS_NOUSER (1<<31) + +/* + * Superblock flags that can be altered by MS_REMOUNT + */ +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|MS_NODIRATIME) + +/* + * Old magic mount flag and mask + */ +#define MS_MGC_VAL 0xC0ED0000 +#define MS_MGC_MSK 0xffff0000 + +/* + * umount2() flags + */ +#define MNT_FORCE 1 + +/* + * Prototypes + */ +__extern int mount(const char *, const char *, + const char *, unsigned long, + const void *); +__extern int umount(const char *); +__extern int umount2(const char *, int); +__extern int pivot_root(const char *, const char *); + +#endif /* _SYS_MOUNT_H */ diff --git a/klibc/include/sys/param.h b/klibc/include/sys/param.h new file mode 100644 index 0000000000..63a0661f43 --- /dev/null +++ b/klibc/include/sys/param.h @@ -0,0 +1,11 @@ +/* + * sys/param.h + */ + +#ifndef _SYS_PARAM_H +#define _SYS_PARAM_H + +#include +#include + +#endif /* _SYS_PARAM_H */ diff --git a/klibc/include/sys/reboot.h b/klibc/include/sys/reboot.h new file mode 100644 index 0000000000..eaf56610d7 --- /dev/null +++ b/klibc/include/sys/reboot.h @@ -0,0 +1,25 @@ +/* + * sys/reboot.h + */ + +#ifndef _SYS_REBOOT_H +#define _SYS_REBOOT_H + +#include +#include + +/* glibc names these constants differently; allow both versions */ + +#define RB_AUTOBOOT LINUX_REBOOT_CMD_RESTART +#define RB_HALT_SYSTEM LINUX_REBOOT_CMD_HALT +#define RB_ENABLE_CAD LINUX_REBOOT_CMD_CAD_ON +#define RB_DISABLE_CAD LINUX_REBOOT_CMD_CAD_OFF +#define RB_POWER_OFF LINUX_REBOOT_CMD_POWER_OFF + +/* glibc-ish one-argument version */ +__extern int reboot(int); + +/* Native four-argument system call */ +__extern int __reboot(int, int, int, void *); + +#endif /* _SYS_REBOOT_H */ diff --git a/klibc/include/sys/resource.h b/klibc/include/sys/resource.h new file mode 100644 index 0000000000..ef14bde9f6 --- /dev/null +++ b/klibc/include/sys/resource.h @@ -0,0 +1,15 @@ +/* + * sys/resource.h + */ + +#ifndef _SYS_RESOURCE_H +#define _SYS_RESOURCE_H + +#include +#include /* MUST be included before linux/resource.h */ +#include + +__extern int getpriority(int, int); +__extern int setpriority(int, int, int); + +#endif /* _SYS_RESOURCE_H */ diff --git a/klibc/include/sys/select.h b/klibc/include/sys/select.h new file mode 100644 index 0000000000..7caf8c931b --- /dev/null +++ b/klibc/include/sys/select.h @@ -0,0 +1,13 @@ +/* + * sys/select.h + */ + +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H + +#include +#include + +__extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); + +#endif /* _SYS_SELECT_H */ diff --git a/klibc/include/sys/socket.h b/klibc/include/sys/socket.h new file mode 100644 index 0000000000..cbc2b89591 --- /dev/null +++ b/klibc/include/sys/socket.h @@ -0,0 +1,50 @@ +/* + * sys/socket.h + */ + +#ifndef _SYS_SOCKET_H +#define _SYS_SOCKET_H + +#include +#include +#include + +/* For some reason these may be protected by __KERNEL__ in asm/socket.h */ +#ifndef SOCK_STREAM +# define SOCK_STREAM 1 +# define SOCK_DGRAM 2 +# define SOCK_RAW 3 +# define SOCK_RDM 4 +# define SOCK_SEQPACKET 5 +# define SOCK_PACKET 10 +#endif + +#ifdef __i386__ +# define __socketcall __extern __cdecl +#else +# define __socketcall __extern +#endif + +typedef int socklen_t; + +__socketcall int socket(int, int, int); +__socketcall int bind(int, struct sockaddr *, int); +__socketcall int connect(int, struct sockaddr *, socklen_t); +__socketcall int listen(int, int); +__socketcall int accept(int, struct sockaddr *, socklen_t *); +__socketcall int getsockname(int, struct sockaddr *, socklen_t *); +__socketcall int getpeername(int, struct sockaddr *, socklen_t *); +__socketcall int socketpair(int, int, int, int *); +__extern int send(int, const void *, size_t, unsigned int); +__socketcall int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); +__extern int recv(int, void *, size_t, unsigned int); +__socketcall int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *); +__socketcall int shutdown(int, int); +__socketcall int setsockopt(int, int, int, const void *, socklen_t); +__socketcall int getsockopt(int, int, int, void *, socklen_t *); +__socketcall int sendmsg(int, const struct msghdr *, unsigned int); +__socketcall int recvmsg(int, struct msghdr *, unsigned int); + +#undef __socketcall + +#endif /* _SYS_SOCKET_H */ diff --git a/klibc/include/sys/socketcalls.h b/klibc/include/sys/socketcalls.h new file mode 100644 index 0000000000..dac9f9aab6 --- /dev/null +++ b/klibc/include/sys/socketcalls.h @@ -0,0 +1,28 @@ +/* + * sys/socketcalls.h + */ + +#ifndef _SYS_SOCKETCALLS_H +#define _SYS_SOCKETCALLS_H + +/* socketcalls by number, since isn't usable for assembly */ + +#define SYS_SOCKET 1 /* sys_socket(2) */ +#define SYS_BIND 2 /* sys_bind(2) */ +#define SYS_CONNECT 3 /* sys_connect(2) */ +#define SYS_LISTEN 4 /* sys_listen(2) */ +#define SYS_ACCEPT 5 /* sys_accept(2) */ +#define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */ +#define SYS_GETPEERNAME 7 /* sys_getpeername(2) */ +#define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */ +#define SYS_SEND 9 /* sys_send(2) */ +#define SYS_RECV 10 /* sys_recv(2) */ +#define SYS_SENDTO 11 /* sys_sendto(2) */ +#define SYS_RECVFROM 12 /* sys_recvfrom(2) */ +#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ +#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ +#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ +#define SYS_SENDMSG 16 /* sys_sendmsg(2) */ +#define SYS_RECVMSG 17 /* sys_recvmsg(2) */ + +#endif /* _SYS_SOCKETCALLS_H */ diff --git a/klibc/include/sys/stat.h b/klibc/include/sys/stat.h new file mode 100644 index 0000000000..1bf6a75f79 --- /dev/null +++ b/klibc/include/sys/stat.h @@ -0,0 +1,31 @@ +/* + * sys/stat.h + */ + +#ifndef _SYS_STAT_H +#define _SYS_STAT_H + +#include +#include +#include /* For struct timespec */ +#include +#include + +#ifdef _STATBUF_ST_NSEC + /* struct stat has struct timespec instead of time_t */ +# define st_atime st_atim.tv_sec +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec +#endif + +__extern int stat(const char *, struct stat *); +__extern int fstat(int, struct stat *); +__extern int lstat(const char *, struct stat *); +__extern mode_t umask(mode_t); +__extern int mknod(const char *, mode_t, dev_t); +static __inline__ int mkfifo(const char *__p, mode_t __m) +{ + return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0); +} + +#endif /* _SYS_STAT_H */ diff --git a/klibc/include/sys/statfs.h b/klibc/include/sys/statfs.h new file mode 100644 index 0000000000..53b3b5e4da --- /dev/null +++ b/klibc/include/sys/statfs.h @@ -0,0 +1 @@ +#include diff --git a/klibc/include/sys/syscall.h b/klibc/include/sys/syscall.h new file mode 100644 index 0000000000..c2c7684c4a --- /dev/null +++ b/klibc/include/sys/syscall.h @@ -0,0 +1,17 @@ +/* + * sys/syscall.h + * + * Generic system call interface macros + */ +#ifndef _SYS_SYSCALL_H +#define _SYS_SYSCALL_H + +#include +#include +#include + +/* Many architectures have incomplete, defective or non-applicable + syscall macros */ +#include + +#endif /* _SYS_SYSCALL_H */ diff --git a/klibc/include/sys/sysinfo.h b/klibc/include/sys/sysinfo.h new file mode 100644 index 0000000000..4051c6897a --- /dev/null +++ b/klibc/include/sys/sysinfo.h @@ -0,0 +1,12 @@ +/* + * sys/sysinfo.h + */ + +#ifndef _SYS_SYSINFO_H +#define _SYS_SYSINFO_H + +#include + +extern int sysinfo (struct sysinfo *info); + +#endif /* _SYS_SYSINFO_H */ diff --git a/klibc/include/sys/sysmacros.h b/klibc/include/sys/sysmacros.h new file mode 100644 index 0000000000..7f1e0822b3 --- /dev/null +++ b/klibc/include/sys/sysmacros.h @@ -0,0 +1,31 @@ +/* + * sys/sysmacros.h + * + * Constructs to create and pick apart dev_t. This applies to the Linux 2.6 + * 32-bit dev_t format. + */ + +#ifndef _SYS_SYSMACROS_H +#define _SYS_SYSMACROS_H + +#ifndef _SYS_TYPES_H +# include +#endif + +static __inline__ int major(dev_t __d) +{ + return (__d >> 8) & 0xfff; +} + +static __inline__ int minor(dev_t __d) +{ + return (__d & 0xff) | ((__d >> 12) & 0xfff00); +} + +static __inline__ dev_t makedev(int __ma, int __mi) +{ + return ((__ma & 0xfff) << 8) | (__mi & 0xff) | ((__mi & 0xfff00) << 12); +} + +#endif /* _SYS_SYSMACROS_H */ + diff --git a/klibc/include/sys/time.h b/klibc/include/sys/time.h new file mode 100644 index 0000000000..2767a1bce3 --- /dev/null +++ b/klibc/include/sys/time.h @@ -0,0 +1,18 @@ +/* + * sys/time.h + */ + +#ifndef _SYS_TIME_H +#define _SYS_TIME_H + +#include +#include +#include + +__extern int gettimeofday(struct timeval *, struct timezone *); +__extern int settimeofday(const struct timeval *, const struct timezone *); +__extern int getitimer(int, struct itimerval *); +__extern int setitimer(int, const struct itimerval *, struct itimerval *); +__extern int utimes(const char *, const struct timeval *); + +#endif /* _SYS_TIME_H */ diff --git a/klibc/include/sys/times.h b/klibc/include/sys/times.h new file mode 100644 index 0000000000..657f9c4b1c --- /dev/null +++ b/klibc/include/sys/times.h @@ -0,0 +1,14 @@ +/* + * sys/times.h + */ + +#ifndef _SYS_TIMES_H +#define _SYS_TIMES_H + +#include + +__extern clock_t times(struct tms *); +__extern int gettimeofday(struct timeval *, struct timezone *); +__extern int settimeofday(const struct timeval *, const struct timezone *); + +#endif /* _SYS_TIMES_H */ diff --git a/klibc/include/sys/types.h b/klibc/include/sys/types.h new file mode 100644 index 0000000000..ddec242922 --- /dev/null +++ b/klibc/include/sys/types.h @@ -0,0 +1,104 @@ +/* + * sys/types.h + */ + +#ifndef _SYS_TYPES_H +#define _SYS_TYPES_H + +#include +#include +#include + +#define _SSIZE_T +typedef ptrdiff_t ssize_t; + +#include +#include + +/* Keeps linux/types.h from getting included elsewhere */ +#define _LINUX_TYPES_H + +typedef __kernel_fd_set fd_set; +typedef uint32_t dev_t; +typedef __kernel_ino_t ino_t; +typedef __kernel_mode_t mode_t; +typedef __kernel_nlink_t nlink_t; +typedef __kernel_loff_t off_t; +typedef __kernel_loff_t loff_t; +typedef __kernel_pid_t pid_t; +typedef __kernel_daddr_t daddr_t; +typedef __kernel_key_t key_t; +typedef __kernel_suseconds_t suseconds_t; +/* typedef __kernel_timer_t timer_t; */ +typedef int timer_t; + +typedef __kernel_uid32_t uid_t; +typedef __kernel_gid32_t gid_t; + +typedef __kernel_fsid_t fsid_t; + +/* + * The following typedefs are also protected by individual ifdefs for + * historical reasons: + */ +#ifndef _SIZE_T +#define _SIZE_T +typedef __kernel_size_t size_t; +#endif + +#ifndef _SSIZE_T +#define _SSIZE_T +typedef __kernel_ssize_t ssize_t; +#endif + +#ifndef _PTRDIFF_T +#define _PTRDIFF_T +typedef __kernel_ptrdiff_t ptrdiff_t; +#endif + +#ifndef _TIME_T +#define _TIME_T +typedef __kernel_time_t time_t; +#endif + +#ifndef _CLOCK_T +#define _CLOCK_T +typedef __kernel_clock_t clock_t; +#endif + +#ifndef _CADDR_T +#define _CADDR_T +typedef __kernel_caddr_t caddr_t; +#endif + +/* bsd */ +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; + +/* sysv */ +typedef unsigned char unchar; +typedef unsigned short ushort; +typedef unsigned int uint; +typedef unsigned long ulong; + +/* Linux-specific? */ +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +typedef uint64_t u_int64_t; + +typedef uint16_t __bitwise __le16; +typedef uint16_t __bitwise __be16; +typedef uint32_t __bitwise __le32; +typedef uint32_t __bitwise __be32; +typedef uint64_t __bitwise __le64; +typedef uint64_t __bitwise __be64; + +/* + * Some apps want this in + */ +#include + +#endif diff --git a/klibc/include/sys/uio.h b/klibc/include/sys/uio.h new file mode 100644 index 0000000000..fc2525d11a --- /dev/null +++ b/klibc/include/sys/uio.h @@ -0,0 +1,15 @@ +/* + * sys/uio.h + */ + +#ifndef _SYS_UIO_H +#define _SYS_UIO_H + +#include +#include +#include + +__extern int readv(int, const struct iovec *, int); +__extern int writev(int, const struct iovec *, int); + +#endif /* _SYS_UIO_H */ diff --git a/klibc/include/sys/un.h b/klibc/include/sys/un.h new file mode 100644 index 0000000000..df42d719f7 --- /dev/null +++ b/klibc/include/sys/un.h @@ -0,0 +1,10 @@ +/* + * + */ + +#ifndef _SYS_UN_H +#define _SYS_UN_H + +#include + +#endif /* _SYS_UN_H */ diff --git a/klibc/include/sys/utime.h b/klibc/include/sys/utime.h new file mode 100644 index 0000000000..d1d635d242 --- /dev/null +++ b/klibc/include/sys/utime.h @@ -0,0 +1,10 @@ +/* + * sys/utime.h + */ + +#ifndef _SYS_UTIME_H +#define _SYS_UTIME_H + +#include + +#endif /* _SYS_UTIME_H */ diff --git a/klibc/include/sys/utsname.h b/klibc/include/sys/utsname.h new file mode 100644 index 0000000000..f2990f5711 --- /dev/null +++ b/klibc/include/sys/utsname.h @@ -0,0 +1,23 @@ +/* + * sys/utsname.h + */ + +#ifndef _SYS_UTSNAME_H +#define _SYS_UTSNAME_H + +#include + +#define SYS_NMLN 65 + +struct utsname { + char sysname[SYS_NMLN]; + char nodename[SYS_NMLN]; + char release[SYS_NMLN]; + char version[SYS_NMLN]; + char machine[SYS_NMLN]; + char domainname[SYS_NMLN]; +}; + +__extern int uname(struct utsname *); + +#endif /* _SYS_UTSNAME_H */ diff --git a/klibc/include/sys/vfs.h b/klibc/include/sys/vfs.h new file mode 100644 index 0000000000..b60d1a572f --- /dev/null +++ b/klibc/include/sys/vfs.h @@ -0,0 +1,111 @@ +/* + * sys/vfs.h + */ + +#ifndef _SYS_VFS_H +#define _SYS_VFS_H + +#include +#include +#include + +/* struct statfs64 -- there seems to be two standards - + one for 32 and one for 64 bits, and they're incompatible... */ + +#if BITSIZE == 32 || defined(__s390__) + +struct statfs { + uint32_t f_type; + uint32_t f_bsize; + uint64_t f_blocks; + uint64_t f_bfree; + uint64_t f_bavail; + uint64_t f_files; + uint64_t f_ffree; + __kernel_fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_frsize; + uint32_t f_spare[5]; +}; + +#else /* BITSIZE == 64 */ + +struct statfs { + uint64_t f_type; + uint64_t f_bsize; + uint64_t f_blocks; + uint64_t f_bfree; + uint64_t f_bavail; + uint64_t f_files; + uint64_t f_ffree; + __kernel_fsid_t f_fsid; + uint64_t f_namelen; + uint64_t f_frsize; + uint64_t f_spare[5]; +}; + +#endif /* BITSIZE */ + +__extern int statfs(const char *, struct statfs *); +__extern int fstatfs(int, struct statfs *); + +/* Various filesystem types */ +#define ADFS_SUPER_MAGIC 0xadf5 +#define AFFS_SUPER_MAGIC 0xadff +#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */ +#define AUTOFS_SUPER_MAGIC 0x0187 +#define BFS_MAGIC 0x1BADFACE +#define CAPIFS_SUPER_MAGIC 0x434e +#define CIFS_MAGIC_NUMBER 0xFF534D42 +#define CODA_SUPER_MAGIC 0x73757245 +#define CRAMFS_MAGIC 0x28cd3d45 +#define DEVFS_SUPER_MAGIC 0x1373 +#define DEVPTS_SUPER_MAGIC 0x1cd1 +#define EFS_SUPER_MAGIC 0x414A53 +#define EVENTPOLLFS_MAGIC 0x03111965 +#define EXT2_SUPER_MAGIC 0xEF53 +#define EXT3_SUPER_MAGIC 0xEF53 +#define GADGETFS_MAGIC 0xaee71ee7 +#define HFSPLUS_SUPER_MAGIC 0x482b +#define HFS_MFS_SUPER_MAGIC 0xD2D7 /* MFS MDB (super block) */ +#define HFS_SUPER_MAGIC 0x4244 /* "BD": HFS MDB (super block) */ +#define HPFS_SUPER_MAGIC 0xf995e849 +#define HUGETLBFS_MAGIC 0x958458f6 +#define HWGFS_MAGIC 0x12061983 +#define IBMASMFS_MAGIC 0x66726f67 +#define ISOFS_SUPER_MAGIC 0x9660 +#define JFFS2_SUPER_MAGIC 0x72b6 +#define JFFS_MAGIC_BITMASK 0x34383931 /* "1984" */ +#define JFFS_MAGIC_SB_BITMASK 0x07c0 /* 1984 */ +#define JFS_SUPER_MAGIC 0x3153464a /* "JFS1" */ +#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ +#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ +#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ +#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ +#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ +#define NCP_SUPER_MAGIC 0x564c +#define NFS_SUPER_MAGIC 0x6969 +#define NFS_SUPER_MAGIC 0x6969 +#define OPENPROM_SUPER_MAGIC 0x9fa1 +#define OPROFILEFS_MAGIC 0x6f70726f +#define PFMFS_MAGIC 0xa0b4d889 +#define PIPEFS_MAGIC 0x50495045 +#define PROC_SUPER_MAGIC 0x9fa0 +#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ +#define RAMFS_MAGIC 0x858458f6 +#define REISERFS_SUPER_MAGIC 0x52654973 +#define ROMFS_MAGIC 0x7275 +#define SMB_SUPER_MAGIC 0x517B +#define SOCKFS_MAGIC 0x534F434B +#define SYSFS_MAGIC 0x62656572 +#define TMPFS_MAGIC 0x01021994 +#define UDF_SUPER_MAGIC 0x15013346 +#define UFS_MAGIC 0x00011954 +#define UFS_MAGIC_4GB 0x05231994 /* fs > 4 GB && fs_featurebits */ +#define UFS_MAGIC_FEA 0x00195612 /* fs_featurebits supported */ +#define UFS_MAGIC_LFN 0x00095014 /* fs supports filenames > 14 chars */ +#define UFS_MAGIC_SEC 0x00612195 /* B1 security fs */ +#define USBDEVICE_SUPER_MAGIC 0x9fa2 +#define VXFS_SUPER_MAGIC 0xa501FCF5 + +#endif /* _SYS_VFS_H */ diff --git a/klibc/include/sys/wait.h b/klibc/include/sys/wait.h new file mode 100644 index 0000000000..4cfafc9408 --- /dev/null +++ b/klibc/include/sys/wait.h @@ -0,0 +1,28 @@ +/* + * sys/wait.h + */ + +#ifndef _SYS_WAIT_H +#define _SYS_WAIT_H + +#include +#include +#include + +#include + +#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) +#define WTERMSIG(s) ((s) & 0x7f) +#define WIFEXITED(s) (WTERMSIG(s) == 0) +#define WIFSTOPPED(s) (WTERMSIG(s) == 0x7f) +/* Ugly hack to avoid multiple evaluation of "s" */ +#define WIFSIGNALED(s) (WTERMSIG((s)+1) >= 2) +#define WCOREDUMP(s) ((s) & 0x80) +#define WSTOPSIG(s) WEXITSTATUS(s) + +__extern pid_t wait(int *); +__extern pid_t waitpid(pid_t, int *, int); +__extern pid_t wait3(int *, int, struct rusage *); +__extern pid_t wait4(pid_t, int *, int, struct rusage *); + +#endif /* _SYS_WAIT_H */ diff --git a/klibc/include/syslog.h b/klibc/include/syslog.h new file mode 100644 index 0000000000..551527a042 --- /dev/null +++ b/klibc/include/syslog.h @@ -0,0 +1,55 @@ +/* + * syslog.h + */ + +#ifndef _SYSLOG_H +#define _SYSLOG_H + +#include +#include + +/* Alert levels */ +#define LOG_EMERG 0 +#define LOG_ALERT 1 +#define LOG_CRIT 2 +#define LOG_ERR 3 +#define LOG_WARNING 4 +#define LOG_NOTICE 5 +#define LOG_INFO 6 +#define LOG_DEBUG 7 + +#define LOG_PRIMASK 7 +#define LOG_PRI(x) ((x) & LOG_PRIMASK) + + +/* Facilities; not actually used */ +#define LOG_KERN 0000 +#define LOG_USER 0010 +#define LOG_MAIL 0020 +#define LOG_DAEMON 0030 +#define LOG_AUTH 0040 +#define LOG_SYSLOG 0050 +#define LOG_LPR 0060 +#define LOG_NEWS 0070 +#define LOG_UUCP 0100 +#define LOG_CRON 0110 +#define LOG_AUTHPRIV 0120 +#define LOG_FTP 0130 +#define LOG_LOCAL0 0200 +#define LOG_LOCAL1 0210 +#define LOG_LOCAL2 0220 +#define LOG_LOCAL3 0230 +#define LOG_LOCAL4 0240 +#define LOG_LOCAL5 0250 +#define LOG_LOCAL6 0260 +#define LOG_LOCAL7 0270 + +#define LOG_FACMASK 01770 +#define LOG_FAC(x) (((x) >> 3) & (LOG_FACMASK >> 3)) + +__extern void openlog(const char *, int, int); +__extern void syslog(int, const char *, ...); +__extern void vsyslog(int, const char *, va_list); +__extern void closelog(void); + +#endif /* _SYSLOG_H */ diff --git a/klibc/include/termios.h b/klibc/include/termios.h new file mode 100644 index 0000000000..08a5e56855 --- /dev/null +++ b/klibc/include/termios.h @@ -0,0 +1,86 @@ +/* + * termios.h + */ + +#ifndef _TERMIOS_H +#define _TERMIOS_H + +#include +#include +#include +#include +#include + +/* Redefine these so the magic constants == the ioctl number to use. */ +#undef TCSANOW +#undef TCSADRAIN +#undef TCSAFLUSH +#define TCSANOW TCSETS +#define TCSADRAIN TCSETSW +#define TCSAFLUSH TCSETSF + +static __inline__ int tcgetattr(int __fd, struct termios *__s) +{ + return ioctl(__fd, TCGETS, __s); +} + +static __inline__ int tcsetattr(int __fd, int __opt, const struct termios *__s) +{ + return ioctl(__fd, __opt, (void *)__s); +} + +static __inline__ int tcflow(int __fd, int __action) +{ + return ioctl(__fd, TCXONC, (void *)(intptr_t)__action); +} + +static __inline__ int tcflush(int __fd, int __queue) +{ + return ioctl(__fd, TCFLSH, (void *)(intptr_t)__queue); +} + +static __inline__ pid_t tcgetpgrp(int __fd) +{ + pid_t __p; + return ioctl(__fd, TIOCGPGRP, &__p) ? (pid_t)-1 : __p; +} + +static __inline__ pid_t tcgetsid(int __fd) +{ + pid_t __p; + return ioctl(__fd, TIOCGSID, &__p) ? (pid_t)-1 : __p; +} + +static __inline__ int tcsendbreak(int __fd, int __duration) +{ + return ioctl(__fd, TCSBRKP, (void *)(uintptr_t)__duration); +} + +static __inline__ int tcsetpgrp(int __fd, pid_t __p) +{ + return ioctl(__fd, TIOCSPGRP, &__p); +} + +static __inline__ speed_t cfgetospeed(const struct termios *__s) +{ + return (speed_t)(__s->c_cflag & CBAUD); +} + +static __inline__ speed_t cfgetispeed(const struct termios *__s) +{ + return (speed_t)(__s->c_cflag & CBAUD); +} + +static __inline__ int cfsetospeed(struct termios *__s, speed_t __v) +{ + __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); + return 0; +} + +static __inline__ int cfsetispeed(struct termios *__s, speed_t __v) +{ + __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); + return 0; +} + +#endif /* _TERMIOS_H */ diff --git a/klibc/include/time.h b/klibc/include/time.h new file mode 100644 index 0000000000..0f094c2806 --- /dev/null +++ b/klibc/include/time.h @@ -0,0 +1,18 @@ +/* + * time.h + */ + +#ifndef _TIME_H +#define _TIME_H + +#include +#include + +__extern time_t time(time_t *); +__extern int nanosleep(const struct timespec *, struct timespec *); + +/* klibc-specific but useful since we don't have floating point */ +__extern char *strtotimeval(const char *str, struct timeval *tv); +__extern char *strtotimespec(const char *str, struct timespec *tv); + +#endif /* _TIME_H */ diff --git a/klibc/include/unistd.h b/klibc/include/unistd.h new file mode 100644 index 0000000000..51fd7b769e --- /dev/null +++ b/klibc/include/unistd.h @@ -0,0 +1,140 @@ +/* + * unistd.h + */ + +#ifndef _UNISTD_H +#define _UNISTD_H + +#include +#include +#include +#include +#include + +__extern char **environ; +__extern __noreturn _exit(int); + +__extern pid_t fork(void); +__extern pid_t vfork(void); +__extern pid_t getpid(void); +__extern pid_t getpgid(pid_t); +__extern int setpgid(pid_t, pid_t); +__extern pid_t getppid(void); +__extern pid_t getpgrp(void); +__extern int setpgrp(void); +__extern pid_t setsid(void); +__extern pid_t getsid(pid_t); +__extern int execv(const char *, char * const *); +__extern int execvp(const char *, char * const *); +__extern int execve(const char *, char * const *, char * const *); +__extern int execvpe(const char *, char * const *, char * const *); +__extern int execl(const char *, const char *, ...); +__extern int execlp(const char *, const char *, ...); +__extern int execle(const char *, const char *, ...); +__extern int execlpe(const char *, const char *, ...); + +__extern int setuid(uid_t); +__extern uid_t getuid(void); +__extern int seteuid(uid_t); +__extern uid_t geteuid(void); +__extern int setgid(gid_t); +__extern gid_t getgid(void); +__extern int setegid(gid_t); +__extern gid_t getegid(void); +__extern int getgroups(int, gid_t *); +__extern int setgroups(size_t, const gid_t *); +__extern int setreuid(uid_t, uid_t); +__extern int setregid(gid_t, gid_t); +__extern int setresuid(uid_t, uid_t, uid_t); +__extern int setresgid(gid_t, gid_t, gid_t); +__extern int getfsuid(uid_t); +__extern int setfsuid(uid_t); + +/* Macros for access() */ +#define R_OK 4 /* Read */ +#define W_OK 2 /* Write */ +#define X_OK 1 /* Execute */ +#define F_OK 0 /* Existence */ + +__extern int access(const char *, int); +__extern int link(const char *, const char *); +__extern int unlink(const char *); +__extern int chdir(const char *); +__extern int fchdir(int); +__extern int chmod(const char *, mode_t); +__extern int fchmod(int, mode_t); +__extern int mkdir(const char *, mode_t); +__extern int rmdir(const char *); +__extern int pipe(int *); +__extern int chroot(const char *); +__extern int symlink(const char *, const char *); +__extern int readlink(const char *, char *, size_t); +__extern int chown(const char *, uid_t, gid_t); +__extern int fchown(int, uid_t, gid_t); +__extern int lchown(const char *, uid_t, gid_t); +__extern char *getcwd(char *, size_t); + +__extern int sync(void); + +/* Also in */ +#ifndef _KLIBC_IN_OPEN_C +__extern int open(const char *, int, ...); +#endif +__extern int close(int); +__extern off_t lseek(int, off_t, int); +/* off_t is 64 bits now even on 32-bit platforms; see llseek.c */ +static __inline__ off_t llseek(int __f, off_t __o, int __w) { + return lseek(__f, __o, __w); +} + +__extern ssize_t read(int, void *, size_t); +__extern ssize_t write(int, const void *, size_t); +__extern ssize_t pread(int, void *, size_t, off_t); +__extern ssize_t pwrite(int, void *, size_t, off_t); + +__extern int dup(int); +__extern int dup2(int, int); +__extern int fcntl(int, int, ...); +__extern int ioctl(int, int, void *); +__extern int flock(int, int); +__extern int fsync(int); +__extern int fdatasync(int); +__extern int ftruncate(int, off_t); + +__extern int pause(void); +__extern unsigned int alarm(unsigned int); +__extern unsigned int sleep(unsigned int); +__extern void usleep(unsigned long); + +__extern int gethostname(char *, size_t); +__extern int sethostname(const char *, size_t); +__extern int getdomainname(char *, size_t); +__extern int setdomainname(const char *, size_t); + +__extern void *__brk(void *); +__extern int brk(void *); +__extern void *sbrk(ptrdiff_t); + +__extern int getopt(int, char * const *, const char *); +__extern char *optarg; +__extern int optind, opterr, optopt; + +__extern int isatty(int); + +static __inline__ int getpagesize(void) { + extern unsigned int __page_size; + return __page_size; +} +static __inline__ int __getpageshift(void) { + extern unsigned int __page_shift; + return __page_shift; +} + +__extern int daemon(int, int); + +/* Standard file descriptor numbers. */ +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +#endif /* _UNISTD_H */ diff --git a/klibc/include/utime.h b/klibc/include/utime.h new file mode 100644 index 0000000000..3dfa03a14a --- /dev/null +++ b/klibc/include/utime.h @@ -0,0 +1,15 @@ +/* + * utime.h + */ + +#ifndef _UTIME_H +#define _UTIME_H + +#include +#include +#include + +__extern int utime(const char *, const struct utimbuf *); + +#endif /* _UTIME_H */ + -- cgit v1.2.3-54-g00ecf From e7c4f85f8a96b6b52e8885685eb6f36df48bbeba Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 5 Oct 2004 19:01:12 -0700 Subject: [PATCH] fix up Makefiles to get the klibc build working properly. Based on a patch from Kay Sievers --- Makefile | 31 +++++++++++++++++-------------- klibc/klibc/Makefile | 2 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 764618e1b4..bc2f852614 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for udev # -# Copyright (C) 2003 Greg Kroah-Hartman +# Copyright (C) 2003,2004 Greg Kroah-Hartman # # 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 @@ -33,7 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler -VERSION = 032 +VERSION = 032_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev @@ -140,9 +140,8 @@ endif ifeq ($(strip $(USE_KLIBC)),true) KLIBC_BASE = $(PWD)/klibc KLIBC_DIR = $(KLIBC_BASE)/klibc - INCLUDE_DIR := $(KLIBC_DIR)/include + INCLUDE_DIR := $(KLIBC_BASE)/include LINUX_INCLUDE_DIR := $(KERNEL_DIR)/include -# LINUX_INCLUDE_DIR := $(KLIBC_BASE)/linux/include include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG # arch specific objects ARCH_LIB_OBJS = \ @@ -150,12 +149,12 @@ ifeq ($(strip $(USE_KLIBC)),true) CRT0 = $(KLIBC_DIR)/crt0.o - LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) + LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) CFLAGS += $(WARNINGS) -nostdinc \ $(OPTFLAGS) \ -D__KLIBC__ -fno-builtin-printf \ -I$(INCLUDE_DIR) \ - -I$(KLIBC_DIR)/arch/$(ARCH)/include \ + -I$(INCLUDE_DIR)/arch/$(ARCH) \ -I$(INCLUDE_DIR)/bits$(BITSIZE) \ -I$(GCCINCDIR) \ -I$(LINUX_INCLUDE_DIR) @@ -164,7 +163,7 @@ ifeq ($(strip $(USE_KLIBC)),true) else WARNINGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations CRT0 = - LIBC = + LIBC = CFLAGS += $(WARNINGS) -I$(GCCINCDIR) LIB_OBJS = -lc LDFLAGS = @@ -185,7 +184,10 @@ all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(ARCH_LIB_OBJS) : $(CRT0) $(CRT0): - $(MAKE) -C klibc KERNEL_DIR=$(KERNEL_DIR) + @if [ ! -r klibc/linux ]; then \ + ln -f -s $(KERNEL_DIR) klibc/linux; \ + fi + $(MAKE) -C klibc SUBDIRS=klibc TDB = tdb/tdb.o \ tdb/spinlock.o @@ -261,27 +263,27 @@ $(DAEMON).o: $(GEN_HEADERS) $(SENDER).o: $(GEN_HEADERS) $(STARTER).o: $(GEN_HEADERS) -$(ROOT): $(ROOT).o $(STARTER).o $(OBJS) $(HEADERS) $(LIBC) $(GEN_MANPAGES) +$(ROOT): $(LIBC) $(ROOT).o $(STARTER).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o udevstart.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(TESTER): $(TESTER).o $(OBJS) $(HEADERS) $(LIBC) +$(TESTER): $(LIBC) $(TESTER).o $(OBJS) $(HEADERS) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevtest.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(INFO): $(INFO).o $(OBJS) $(HEADERS) $(LIBC) +$(INFO): $(LIBC) $(INFO).o $(OBJS) $(HEADERS) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(DAEMON): $(DAEMON).o $(OBJS) udevd.h $(LIBC) +$(DAEMON): $(LIBC) $(DAEMON).o $(OBJS) udevd.h $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o udev_lib.o $(KLIBC_FIXUP) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(SENDER): $(SENDER).o $(OBJS) udevd.h $(LIBC) +$(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(STRIPCMD) $@ -$(RULER): $(RULER).o $(OBJS) $(HEADERS) $(LIBC) +$(RULER): $(LIBC) $(RULER).o $(OBJS) $(HEADERS) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevruler.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) -lnewt $(STRIPCMD) $@ @@ -298,6 +300,7 @@ clean: spotless: clean $(MAKE) -C klibc spotless + -rm -f klibc/linux DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz$" -e "\/\." -e releases -e BitKeeper -e SCCS -e "\.tdb$" -e test/sys | sort ) DISTDIR := $(RELEASE_NAME) diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index d7e75f1814..3519b45089 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -59,7 +59,7 @@ LIB = libc.a INTERP_O = interp.o -all: tests $(CRT0) $(LIB) $(SOLIB) klibc.so +all: $(CRT0) $(LIB) $(SOLIB) klibc.so # Add any architecture-specific rules include arch/$(ARCH)/Makefile.inc -- cgit v1.2.3-54-g00ecf From 01f950e2eb86563255a269ecadd386cbe5361d0c Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Tue, 5 Oct 2004 21:30:54 -0700 Subject: [PATCH] update udev to include scsi_id 0.6 Here's a patch updating udev's copy of scsi_id to version 0.6. --- extras/scsi_id/ChangeLog | 23 +++++++++++++++++++++++ extras/scsi_id/Makefile | 2 +- extras/scsi_id/TODO | 3 --- extras/scsi_id/release-notes | 36 ++++++++++-------------------------- extras/scsi_id/scsi.h | 7 +++++++ extras/scsi_id/scsi_id.8 | 3 +++ extras/scsi_id/scsi_id.c | 34 ++++++++++++++++++++++++++++++++-- extras/scsi_id/scsi_id.h | 1 - extras/scsi_id/scsi_serial.c | 37 +++++++++++++++++-------------------- 9 files changed, 93 insertions(+), 53 deletions(-) diff --git a/extras/scsi_id/ChangeLog b/extras/scsi_id/ChangeLog index bfa353431b..724977dbf4 100644 --- a/extras/scsi_id/ChangeLog +++ b/extras/scsi_id/ChangeLog @@ -1,3 +1,26 @@ +2004-jul-30: + * scsi_id.c, scsi_serial.c: Align the buffer passed to scsi_serial, + don't bother aligning and memcpy-ing the result in scsi_inquiry. + Aligning to 512 probably does not help, since the IO length of + 254 is not a multiple of 512. + +2004-jul-30: + * scsi.h, scsi_serial.c: Use a define for the SCSI INQUIRY buffer + length. + +2004-jul-30: + * scsi_id.c: Patch from add a -u flag + to substitute white space with underscores so it is easier to use + the output as a device name. + +2004-jul-30: + * scsi_serial.c: Patch from Hannes Reinecke use 254 + bytes for SCSI INQUIRY commands. + +2004-jul-28: + * scsi_id.h, scsi_serial.c: get rid of dumb/dead code, and use a + 512 byte aligned buffer. + 2004-jun-23: * scsi_id.h: increase MAX_SERIAL_LEN from 128 to 256, as some devices (maybe broken ones) are giving really long id's. diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 8fe29f3647..7ccc4c5118 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.5 +SCSI_ID_VERSION=0.6 prefix = etcdir = ${prefix}/etc diff --git a/extras/scsi_id/TODO b/extras/scsi_id/TODO index e0283cf444..857c22b87a 100644 --- a/extras/scsi_id/TODO +++ b/extras/scsi_id/TODO @@ -1,6 +1,3 @@ -- Add an option to replace blanks with spaces, so the generated id can be - more easily used as a /dev name. - - Add a bus white/black list option. So for example, all scsi devices under USB could easily be blacklisted. This should allow multiple busses to be listed. diff --git a/extras/scsi_id/release-notes b/extras/scsi_id/release-notes index 2996713117..302817ea7f 100644 --- a/extras/scsi_id/release-notes +++ b/extras/scsi_id/release-notes @@ -1,6 +1,6 @@ -Version 0.5 of scsi_id is available at: +Version 0.6 of scsi_id is available at: -http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.5.tar.gz +http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.6.tar.gz scsi_id is a program to generate a unique identifier for a given SCSI device. @@ -9,34 +9,18 @@ It is primarily for use with the udev program key, or hotplug scripts that want persistent naming of scsi devices. It could also be used for automatic multi-path configuration or device mapper configuration. -Version 0.5 requires: +Requires: - Linux kernel 2.6 - libsysfs 0.4.0 Major changes since the last release: + + - add -u option, patch from Christoph Varoqui, to substitute white + space with underscores so it is easier to use the output as a + device name. - - Ken Brush have the command line options - override generic options. + - Use 254 bytes for SCSI INQUIRY commands, patch from Hannes + Reinecke. - - Fix the gen_scsi_id_udev_rules.sh to handle spaces in the id. - - - Don't supply a makedev() when built with klibc. Also, the - scsi_id supplied makedev() was using the old major/minor method. - - - Include compiler.h so we can build against klibc, as recent sg.h - changes need a define for __user. - -Other changes: - - - Increase the MAX_SERIAL_LEN from 128 to 256, as some (possibly - broken devics) are returning very long id's - - - Add spotless target (via Olaf Hering's udev patch) - - - minor wording changes in scsi_id.config - - - Log INQUIRY failure, including the failing page code and vpd - values - - - Escape '-' with '\-' in the man page. +See ChangeLog for more details. diff --git a/extras/scsi_id/scsi.h b/extras/scsi_id/scsi.h index 780e001576..212765a17d 100644 --- a/extras/scsi_id/scsi.h +++ b/extras/scsi_id/scsi.h @@ -37,6 +37,13 @@ struct scsi_ioctl_command { #define SENSE_BUFF_LEN 32 +/* + * The request buffer size passed to the SCSI INQUIRY commands, use 254, + * as this is a nice value for some devices, especially some of the usb + * mass storage devices. + */ +#define SCSI_INQ_BUFF_LEN 254 + /* * SCSI INQUIRY vendor and model (really product) lengths. */ diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 69dd2a998a..591bb79366 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -95,6 +95,9 @@ Generate an id for the The sysfs mount point must not be included. For example, use /block/sd, not /sys/block/sd. .TP +.BI \-u +Reformat the output : replace all whitespaces by underscores +.TP .BI \-v Generate verbose debugging output. .TP diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index e893987868..6395b822ce 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -52,7 +52,7 @@ * options are not supported, but other code is still left in place for * now. */ -static const char short_options[] = "bd:f:gip:s:vV"; +static const char short_options[] = "bd:f:gip:s:uvV"; /* * Just duplicate per dev options. */ @@ -70,6 +70,7 @@ static int default_page_code; static int use_stderr; static int debug; static int hotplug_mode; +static int reformat_serial; void log_message (int level, const char *format, ...) { @@ -469,6 +470,10 @@ static int set_options(int argc, char **argv, const char *short_opts, strncat(target, optarg, MAX_NAME_LEN); break; + case 'u': + reformat_serial = 1; + break; + case 'v': debug++; break; @@ -572,6 +577,23 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, return retval; } +/* + * format_serial: replace to whitespaces by underscores for calling + * programs that use the serial for device naming (multipath, Suse + * naming, etc...) + */ +static void format_serial(char *serial) +{ + char *p = serial; + + while (*p != '\0') { + if (isspace(*p)) + *p = '_'; + p++; + } + return; +} + /* * scsi_id: try to get an id, if one is found, printf it to stdout. * returns a value passed to exit() - 0 if printed an id, else 1. This @@ -583,7 +605,7 @@ static int scsi_id(const char *target_path, char *maj_min_dev) { int retval; int dev_type = 0; - char serial[MAX_SERIAL_LEN]; + char *serial, *unaligned_buf; struct sysfs_class_device *class_dev; /* of target_path */ struct sysfs_class_device *class_dev_parent; /* for partitions */ struct sysfs_device *scsi_dev; /* the scsi_device */ @@ -689,6 +711,12 @@ static int scsi_id(const char *target_path, char *maj_min_dev) dprintf("per dev options: good %d; page code 0x%x; callout '%s'\n", good_dev, page_code, callout); +#define ALIGN 512 + unaligned_buf = malloc(MAX_SERIAL_LEN + ALIGN); + serial = (char*) (((int) unaligned_buf + (ALIGN - 1)) & ~(ALIGN - 1)); + dprintf("buffer unaligned 0x%p; aligned 0x%p\n", unaligned_buf, serial); +#undef ALIGN + if (!good_dev) { retval = 1; } else if (callout[0] != '\0') { @@ -703,6 +731,8 @@ static int scsi_id(const char *target_path, char *maj_min_dev) retval = 0; } if (!retval) { + if (reformat_serial) + format_serial(serial); if (display_bus_id) printf("%s: ", scsi_dev->name); printf("%s", serial); diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 10599ebb5f..0ca7cd4206 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -25,7 +25,6 @@ log_message(LOG_DEBUG, "%s: " format, __FUNCTION__ , ## arg) #define MAX_NAME_LEN 72 -#define OFFSET (2 * sizeof(unsigned int)) /* * MAX_ATTR_LEN: maximum length of the result of reading a sysfs diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index e0074b662d..0db756404c 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -300,17 +300,12 @@ static int scsi_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned unsigned char sense[SENSE_BUFF_LEN]; struct sg_io_hdr io_hdr; int retval; - unsigned char *inq; - unsigned char *buffer; int retry = 3; /* rather random */ - if (buflen > 255) { + if (buflen > SCSI_INQ_BUFF_LEN) { log_message(LOG_WARNING, "buflen %d too long\n", buflen); return -1; } - inq = malloc(OFFSET + sizeof (inq_cmd) + 512); - memset(inq, 0, OFFSET + sizeof (inq_cmd) + 512); - buffer = inq + OFFSET; resend: dprintf("%s evpd %d, page 0x%x\n", scsi_dev->name, evpd, page); @@ -321,7 +316,7 @@ resend: io_hdr.mx_sb_len = sizeof(sense); io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; io_hdr.dxfer_len = buflen; - io_hdr.dxferp = buffer; + io_hdr.dxferp = buf; io_hdr.cmdp = inq_cmd; io_hdr.sbp = sense; io_hdr.timeout = DEF_TIMEOUT; @@ -329,7 +324,8 @@ resend: if (ioctl(fd, SG_IO, &io_hdr) < 0) { log_message(LOG_WARNING, "%s: ioctl failed: %s\n", scsi_dev->name, strerror(errno)); - return -1; + retval = -1; + goto error; } retval = sg_err_category3(&io_hdr); @@ -346,7 +342,6 @@ resend: if (!retval) { retval = buflen; - memcpy(buf, buffer, retval); } else if (retval > 0) { if (--retry > 0) { dprintf("%s: Retrying ...\n", scsi_dev->name); @@ -355,15 +350,16 @@ resend: retval = -1; } +error: if (retval < 0) log_message(LOG_WARNING, "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", scsi_dev->name, evpd, page); - free(inq); return retval; } +/* Get list of supported EVPD pages */ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, char *buffer, int len) { @@ -552,15 +548,17 @@ static int check_fill_0x83_id(struct sysfs_device *scsi_dev, char return 0; } +/* Get device identification VPD page */ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, char *serial, int len) { int retval; int id_ind, j; - unsigned char page_83[256]; + unsigned char page_83[SCSI_INQ_BUFF_LEN]; - memset(page_83, 0, 256); - retval = scsi_inquiry(scsi_dev, fd, 1, 0x83, page_83, 255); + memset(page_83, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(scsi_dev, fd, 1, 0x83, page_83, + SCSI_INQ_BUFF_LEN); if (retval < 0) return 1; @@ -609,6 +607,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, return 1; } +/* Get unit serial number VPD page */ static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, char *serial, int max_len) { @@ -616,10 +615,10 @@ static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, int ser_ind; int i; int len; - unsigned char buf[256]; + unsigned char buf[SCSI_INQ_BUFF_LEN]; - memset(buf, 0, 256); - retval = scsi_inquiry(scsi_dev, fd, 1, 0x80, buf, 255); + memset(buf, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(scsi_dev, fd, 1, 0x80, buf, SCSI_INQ_BUFF_LEN); if (retval < 0) return retval; @@ -652,13 +651,11 @@ static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, int page_code, char *serial, int len) { - unsigned char page0[256]; + unsigned char page0[SCSI_INQ_BUFF_LEN]; int fd; int ind; int retval; - if (len > 255) { - } memset(serial, 0, len); dprintf("opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); @@ -694,7 +691,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, * Get page 0, the page of the pages. By default, try from best to * worst of supported pages: 0x83 then 0x80. */ - if (do_scsi_page0_inquiry(scsi_dev, fd, page0, 255)) { + if (do_scsi_page0_inquiry(scsi_dev, fd, page0, SCSI_INQ_BUFF_LEN)) { /* * Don't try anything else. Black list if a specific page * should be used for this vendor+model, or maybe have an -- cgit v1.2.3-54-g00ecf From a8b5267a629f21c30d4e94ec82be193009803ddd Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 5 Oct 2004 21:35:39 -0700 Subject: [PATCH] finally solve the bad sysfs-timing for all of us On Tue, Sep 21, 2004 at 07:17:34PM +0200, Kay Sievers wrote: > During the integration of HAL into the linux hotplug system, we dicover > every week a new signaling path that fails cause of the delayed > population of the sysfs files, which are connected by symlinks and > appear in something like a random order in userspace. > > It's pretty complicated to understand the connection between all these > files for all the different subsystems with all the exceptions, so most > of the users simply sleep a few seconds, but that is not acceptable for > our integration work. > > Here I try to get all the special knowledge about that behavior together > and place that in a simple binary. That program _must_ run first of all > other hotplug processsing and every later script, udev or HAL all can get > rid of the wild guesses about the right time sysfs is ready. > > It will not only wait for the "dev"-file events we handle with udev, also > for every /device-device with the corresponding bus link. > > It is provided as a patch against the current udev tree and a "install" will > place the new program in the hotplug.d directory: > > [kay@pim ~]$ tree /etc/hotplug.d/ > /etc/hotplug.d/ > `-- default > |-- 00-wait_for_sysfs.hotplug -> /sbin/wait_for_sysfs > |-- 10-udev.hotplug -> /sbin/udevsend > |-- 20-hal.hotplug -> /usr/libexec/hal.hotplug > |-- default.hotplug > `-- log.hotplug > > > For now, it logs the result of the waiting to syslog, to catch any > device, that needs special treatment. All newly discovered delay problems, > device black/whitelist updates should go into that program and we may remove > that kind of specialisation from all the other hotplug programs. > > Any patches, reports, testing is more than welcome. > > Sample debug: > Sep 21 18:44:07 localhost kernel: usb 3-2: new full speed USB device using address 12 > Sep 21 18:44:07 localhost kernel: hub 3-2:1.0: USB hub found > Sep 21 18:44:07 localhost kernel: hub 3-2:1.0: 2 ports detected > Sep 21 18:44:07 localhost 00-wait_for_sysfs.hotplug: result: waiting for sysfs successful '/devices/pci0000:00/0000:00:1d.1/usb3/3-2' > Sep 21 18:44:07 localhost 00-wait_for_sysfs.hotplug: result: waiting for sysfs successful '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2:1.0' > Sep 21 18:44:08 localhost kernel: usb 3-2.1: new full speed USB device using address 13 > Sep 21 18:44:08 localhost 00-wait_for_sysfs.hotplug: result: waiting for sysfs successful '/class/usb/lp0' > Sep 21 18:44:08 localhost kernel: drivers/usb/class/usblp.c: usblp0: USB Bidirectional printer dev 13 if 0 alt 1 proto 2 vid 0x067B pid 0x2305 > Sep 21 18:44:08 localhost 00-wait_for_sysfs.hotplug: result: waiting for sysfs successful '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2.1/3-2.1:1.0' > Sep 21 18:44:08 localhost 00-wait_for_sysfs.hotplug: result: waiting for sysfs successful '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2.1' > Sep 21 18:44:08 localhost udev: configured rule in '/etc/udev/rules.d/50-udev.rules' at line 29 applied, 'lp0' becomes 'usb/%k' > Sep 21 18:44:08 localhost udev: creating device node '/udev/usb/lp0' > Sep 21 18:44:09 localhost kernel: usb 3-2.2: new full speed USB device using address 14 > Sep 21 18:44:09 localhost kernel: pl2303 3-2.2:1.0: PL-2303 converter detected > Sep 21 18:44:09 localhost kernel: usb 3-2.2: PL-2303 converter now attached to ttyUSB0 > Sep 21 18:44:09 localhost 00-wait_for_sysfs.hotplug: result: waiting for sysfs successful '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2.2' > Sep 21 18:44:09 localhost 00-wait_for_sysfs.hotplug: result: waiting for sysfs successful '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2.2/3-2.2:1.0' > Sep 21 18:44:09 localhost 00-wait_for_sysfs.hotplug: result: waiting for sysfs successful '/devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2.2/3-2.2:1.0/ttyUSB0' > Sep 21 18:44:09 localhost 00-wait_for_sysfs.hotplug: result: waiting for sysfs successful '/class/tty/ttyUSB0' > Sep 21 18:44:09 localhost udev: creating device node '/udev/ttyUSB0' New version with more devices excluded from /device-link saerch and a better maching for device names. --- Makefile | 15 ++- wait_for_sysfs.c | 334 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 346 insertions(+), 3 deletions(-) create mode 100644 wait_for_sysfs.c diff --git a/Makefile b/Makefile index bc2f852614..67a7d46525 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart RULER = udevruler +WAIT = wait_for_sysfs VERSION = 032_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) @@ -171,7 +172,7 @@ endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) +all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(WAIT) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -287,10 +288,14 @@ $(RULER): $(LIBC) $(RULER).o $(OBJS) $(HEADERS) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevruler.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) -lnewt $(STRIPCMD) $@ +$(WAIT): $(WAIT).o $(OBJS) $(HEADERS) $(LIBC) + $(LD) $(LDFLAGS) -o $@ $(CRT0) $(WAIT).o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(STRIPCMD) $@ + clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(RULER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(RULER) $(WAIT) $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ @@ -391,8 +396,10 @@ install: install-initscript install-config install-man install-dev.d all $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) - ln -sf $(sbindir)/udev $(DESTDIR)$(sbindir)/$(STARTER) + $(INSTALL_PROGRAM) -D $(WAIT) $(DESTDIR)$(sbindir)/$(WAIT) + - ln -f -s $(sbindir)/udev $(DESTDIR)$(sbindir)/$(STARTER) - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/10-udev.hotplug + - ln -f -s $(sbindir)/$(WAIT) $(DESTDIR)$(hotplugdir)/00-wait_for_sysfs.hotplug ifndef DESTDIR - killall udevd - rm -f $(udevdir)/.udev.tdb @@ -405,6 +412,7 @@ endif uninstall: uninstall-man uninstall-dev.d - rm $(hotplugdir)/10-udev.hotplug + - rm $(hotplugdir)/00-wait_for_sysfs.hotplug - rm $(configdir)/rules.d/50-udev.rules - rm $(configdir)/permissions.d/50-udev.permissions - rm $(configdir)/udev.conf @@ -418,6 +426,7 @@ uninstall: uninstall-man uninstall-dev.d - rm $(sbindir)/$(STARTER) - rm $(usrbindir)/$(INFO) - rm $(usrbindir)/$(TESTER) + - rm $(usrbindir)/$(WAIT) - rmdir $(hotplugdir) - rm $(udevdir)/.udev.tdb - rmdir $(udevdir) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c new file mode 100644 index 0000000000..b9efcddf87 --- /dev/null +++ b/wait_for_sysfs.c @@ -0,0 +1,334 @@ +/* + * wait_for_sysfs.c - small program to delay the execution + * of /etc/hotplug.d/ programs, until sysfs + * is populated by the kernel. Depending on + * the type of device, we wait for all expected + * directories and then just exit. + * + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "logging.h" +#include "libsysfs/sysfs/libsysfs.h" + +#ifdef LOG +unsigned char logname[LOGNAME_SIZE]; +void log_message(int level, const char *format, ...) +{ + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif + +#define WAIT_MAX_SECONDS 5 +#define WAIT_LOOP_PER_SECOND 20 + +static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev) +{ + static struct class_file { + char *subsystem; + char *file; + } class_files[] = { + { .subsystem = "net", .file = "ifindex" }, + { .subsystem = "usb_host", .file = NULL }, + { .subsystem = "pcmcia_socket", .file = NULL }, + { NULL, NULL } + }; + struct class_file *classfile; + const char *file = "dev"; + int loop; + + /* look if we want to look for another file instead of "dev" */ + for (classfile = class_files; classfile->subsystem != NULL; classfile++) { + if (strcmp(class_dev->classname, classfile->subsystem) == 0) { + if (classfile->file == NULL) { + dbg("class '%s' has no file to wait for", class_dev->classname); + return 0; + } + file = classfile->file; + break; + } + } + dbg("looking at class '%s' for specific file '%s'", class_dev->classname, file); + + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + if (sysfs_get_classdev_attr(class_dev, file) != NULL) { + dbg("class '%s' specific file '%s' found", class_dev->classname, file); + return 0; + } + } + + dbg("error: getting bus '%s' specific file '%s'", class_dev->classname, file); + return -1; +} + +static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev) +{ + char **device; + + static char *devices_without_link[] = { + "nb", + "ram", + "loop", + "fd", + "md", + "dos_cd", + "double", + "flash", + "msd", + "rflash", + "rom", + "rrom", + "sbpcd", + "pcd", + "pf", + "scd", + "sit", + "lp", + "ubd", + "vcs", + "vcsa", + "console", + "tty", + "ttyS", + NULL + }; + + for (device = devices_without_link; *device != NULL; device++) { + int len = strlen(*device); + + /* look if name matches */ + if (strncmp(class_dev->name, *device, len) != 0) + continue; + + /* exact match */ + if (strlen(class_dev->name) == len) + return 1; + + /* instance numbers are matching too */ + if (isdigit(class_dev->name[len])) + return 1; + } + + return 0; +} + +static int wait_for_bus_device(struct sysfs_device *device_dev) +{ + static struct bus_file { + char *bus; + char *file; + } bus_files[] = { + { .bus = "scsi", .file = "vendor" }, + { .bus = "usb", .file = "idVendor" }, + { .bus = "usb", .file = "iInterface" }, + { .bus = "usb-serial", .file = "detach_state" }, + { .bus = "ide", .file = "detach_state" }, + { .bus = "pci", .file = "vendor" }, + { NULL } + }; + struct bus_file *busfile; + int loop; + + /* wait for the /bus-device link to the /device-device */ + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + if (sysfs_get_device_bus(device_dev) == 0) + break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + if (loop == 0) { + dbg("error: getting /bus-device link"); + return -1; + } + dbg("/bus-device link found for bus '%s'", device_dev->bus); + + /* wait for a bus specific file to show up */ + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + for (busfile = bus_files; busfile->bus != NULL; busfile++) { + if (strcmp(device_dev->bus, busfile->bus) == 0) { + dbg("looking at bus '%s' for specific file '%s'", device_dev->bus, busfile->file); + if (sysfs_get_device_attr(device_dev, busfile->file) != NULL) { + dbg("bus '%s' specific file '%s' found", device_dev->bus, busfile->file); + return 0; + } + if (busfile->bus == NULL) { + info("error: unknown bus, update the build-in list '%s'", device_dev->bus); + return -1; + } + } + } + } + + dbg("error: getting bus '%s' specific file '%s'", device_dev->bus, busfile->file); + return -1; +} + +int main(int argc, char *argv[], char *envp[]) +{ + const char *devpath = ""; + const char *action; + const char *subsystem; + char sysfs_path[SYSFS_PATH_MAX]; + char filename[SYSFS_PATH_MAX]; + struct sysfs_class_device *class_dev; + struct sysfs_class_device *class_dev_parent; + struct sysfs_device *device_dev = NULL; + int loop; + int rc = 0; + + if (argc != 2) { + dbg("error: subsystem"); + return 1; + } + subsystem = argv[1]; + + devpath = getenv ("DEVPATH"); + if (!devpath) { + dbg("error: no DEVPATH"); + return 1; + } + + action = getenv ("ACTION"); + if (!action) { + dbg("error: no ACTION"); + return 1; + } + + if (strcmp(action, "add") != 0) + return 0; + + if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) { + dbg("error: no sysfs path"); + return 2; + } + + if ((strncmp(devpath, "/block/", 7) == 0) || (strncmp(devpath, "/class/", 7) == 0)) { + /* open the class device we are called for */ + snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); + filename[SYSFS_PATH_MAX-1] = '\0'; + + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + class_dev = sysfs_open_class_device_path(filename); + if (class_dev) + break; + } + if (class_dev == NULL) { + dbg("error: getting class_device"); + rc = 4; + goto exit; + } + dbg("class_device opened '%s'", filename); + + wait_for_class_device_attributes(class_dev); + + if (class_device_expect_no_device_link(class_dev)) { + dbg("no device symlink expected"); + sysfs_close_class_device(class_dev); + goto exit; + } + + /* the symlink may be on the parent device */ + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent) + dbg("looking at parent device for device link '%s'", class_dev_parent->path); + + /* wait for the symlink to the /device-device */ + dbg("waiting for symlink to /device-device"); + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + if (class_dev_parent) + device_dev = sysfs_get_classdev_device(class_dev_parent); + else + device_dev = sysfs_get_classdev_device(class_dev); + + if (device_dev) + break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + if (device_dev == NULL) { + dbg("error: getting /device-device"); + sysfs_close_class_device(class_dev); + rc = 5; + goto exit; + } + dbg("device symlink found pointing to '%s'", device_dev->path); + + /* wait for the bus value */ + if (wait_for_bus_device(device_dev) != 0) + rc = 6; + sysfs_close_class_device(class_dev); + + /* finished */ + goto exit; + + } else if ((strncmp(devpath, "/devices/", 9) == 0)) { + /* open the path we are called for */ + snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); + filename[SYSFS_PATH_MAX-1] = '\0'; + + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + device_dev = sysfs_open_device_path(filename); + if (device_dev) + break; + } + if (device_dev == NULL) { + dbg("error: getting /device-device"); + rc = 4; + goto exit; + } + dbg("device_device opened '%s'", filename); + + /* wait for the bus value */ + if (wait_for_bus_device(device_dev) != 0) + rc = 9; + + sysfs_close_device(device_dev); + + /* finished */ + goto exit; + + } else { + dbg("unhandled sysfs path, no need to wait"); + } + +exit: + if (rc == 0) + info("result: waiting for sysfs successful '%s'", devpath); + else + info("result: waiting for sysfs failed '%s'", devpath); + + return rc; +} -- cgit v1.2.3-54-g00ecf From 186f7b23623b044e4e38a886c6440fe06d800184 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 5 Oct 2004 21:56:39 -0700 Subject: [PATCH] update comments in scsi-devfs.sh --- extras/scsi-devfs.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/scsi-devfs.sh b/extras/scsi-devfs.sh index 12c8aa8eb5..b1a17cb21e 100644 --- a/extras/scsi-devfs.sh +++ b/extras/scsi-devfs.sh @@ -8,10 +8,10 @@ # # return devfs-names for scsi-devices # Usage in udev.rules: -# BUS="scsi", KERNEL="sd*", PROGRAM="/etc/udev/scsi-devfs.sh sd %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" -# BUS="scsi", KERNEL="sr*", PROGRAM="/etc/udev/scsi-devfs.sh sr %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" -# BUS="scsi", KERNEL="st*", PROGRAM="/etc/udev/scsi-devfs.sh st %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" -# BUS="scsi", KERNEL="sg*", PROGRAM="/etc/udev/scsi-devfs.sh sg %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" +# BUS="scsi", KERNEL="sd*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh sd %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" +# BUS="scsi", KERNEL="sr*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh sr %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" +# BUS="scsi", KERNEL="st*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh st %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" +# BUS="scsi", KERNEL="sg*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh sg %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" # Find out where sysfs is mounted. Exit if not available sysfs=`grep -F sysfs /proc/mounts | awk '{print $2}'` -- cgit v1.2.3-54-g00ecf From 1764266da0ce245d3a06c526d69f550b10913375 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 5 Oct 2004 22:13:30 -0700 Subject: [PATCH] kdetv wants to see device nodes in /dev --- etc/udev/udev.rules.gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 429762b8da..9245f6adcf 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -96,7 +96,7 @@ KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" # v4l devices KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n" KERNEL="radio[0-9]*", NAME="v4l/radio%n" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" # USB devices -- cgit v1.2.3-54-g00ecf From b88988007310c6dd76c1b388baf2390549cce719 Mon Sep 17 00:00:00 2001 From: "kpfleming@backtobasicsmgmt.com" Date: Tue, 5 Oct 2004 22:15:16 -0700 Subject: [PATCH] respect prefix= setting in built udev.conf (updated) Here is a revised version of the patch. Again, it modifies the Makefile to respect the prefix= setting when putting paths to /etc/udev/{rules.s,permissions.d} into the built /etc/udev/udev.conf file. It also changes the Makefile to create this file at "make" time, not "make install" time. This allows for udevdir to be specified at "make" time (thus putting the correct path into udev.conf), but not specified at "make install" time (thus allowing the installation to proceed without trying to use the wrong directory). Submitted By: Kevin P. Fleming Date: 2004-09-16 Initial Package Version: 032 Origin: David Jensen Description: correct udev's Makefile and template config file to respect the "prefix=" setting supplied when it is built; also build etc/udev/udev.conf at "make" time, not "make install" time --- Makefile | 12 ++++++------ etc/udev/udev.conf.in | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 67a7d46525..24677d4194 100644 --- a/Makefile +++ b/Makefile @@ -172,7 +172,10 @@ endif CFLAGS += -I$(PWD)/libsysfs -all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(WAIT) +# config files automatically generated +GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf + +all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(WAIT) $(GEN_CONFIGS) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -242,12 +245,9 @@ udev_version.h: @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ -# config files automatically generated -GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf - # Rules on how to create the generated config files $(LOCAL_CFG_DIR)/udev.conf: - sed -e "s:@udevdir@:$(udevdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ + sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ GEN_MANPAGES = udev.8 GEN_MANPAGESIN = udev.8.in @@ -346,7 +346,7 @@ install-initscript: etc/init.d/udev etc/init.d/udev.debian etc/init.d/udev.init. $(INSTALL_DATA) -D etc/init.d/udev.debian $(DESTDIR)$(initdir)/udev; \ fi -install-config: $(GEN_CONFIGS) +install-config: $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d $(INSTALL) -d $(DESTDIR)$(configdir)/permissions.d @if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index 9b6b9c7ee2..4c71b1dfec 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -12,10 +12,10 @@ udev_root="@udevdir@/" udev_db="@udevdir@/.udev.tdb" # udev_rules - The name and location of the udev rules file -udev_rules="/etc/udev/rules.d/" +udev_rules="@configdir@/rules.d/" # udev_permissions - The name and location of the udev permission file -udev_permissions="/etc/udev/permissions.d/" +udev_permissions="@configdir@/permissions.d/" # default_mode - set the default mode for all nodes that have no # explicit match in the permissions file -- cgit v1.2.3-54-g00ecf From ff213aecf68b3427f0a8b2c8a1074851b1511299 Mon Sep 17 00:00:00 2001 From: "harald@redhat.com" Date: Tue, 5 Oct 2004 22:20:12 -0700 Subject: [PATCH] cleanup PATCH for extras/chassis_id/Makefile for "make install" --- extras/chassis_id/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extras/chassis_id/Makefile b/extras/chassis_id/Makefile index 1b641cafda..141d23c7b8 100644 --- a/extras/chassis_id/Makefile +++ b/extras/chassis_id/Makefile @@ -23,6 +23,11 @@ CFLAGS = -g TARGET = chassis_id +exec_prefix = ${prefix} +sbindir = ${exec_prefix}/sbin +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 all: chassis_id chassis_id: chassis_id.c table.c @@ -30,3 +35,7 @@ chassis_id: chassis_id.c table.c clean: rm -rf core a.out $(TARGET) + +install: all + $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(sbindir)/$(TARGET) + -- cgit v1.2.3-54-g00ecf From 9825617b078c2122d130676e934ce21714b60e8b Mon Sep 17 00:00:00 2001 From: "harald@redhat.com" Date: Tue, 5 Oct 2004 23:39:05 -0700 Subject: [PATCH] PATCH selinux for udev Daniel Walsh's working selinux patch --- Makefile | 8 ++++ selinux.h | 131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev-add.c | 10 +++++ 3 files changed, 149 insertions(+) create mode 100644 selinux.h diff --git a/Makefile b/Makefile index 24677d4194..9405b25c5f 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,8 @@ USE_LOG = true # Leave this set to `false' for production use. DEBUG = false +# Set this to compile with Security-Enhanced Linux support. +USE_SELINUX = false ROOT = udev DAEMON = udevd @@ -170,6 +172,11 @@ else LDFLAGS = endif +ifeq ($(strip $(USE_SELINUX)),true) + CFLAGS += -DUSE_SELINUX + LIB_OBJS += -lselinux +endif + CFLAGS += -I$(PWD)/libsysfs # config files automatically generated @@ -222,6 +229,7 @@ HEADERS = udev.h \ udevdb.h \ klibc_fixups.h \ logging.h \ + selinux.h \ list.h ifeq ($(strip $(USE_KLIBC)),true) diff --git a/selinux.h b/selinux.h new file mode 100644 index 0000000000..475a60d6d2 --- /dev/null +++ b/selinux.h @@ -0,0 +1,131 @@ +#ifndef SELINUX_H +#define SELINUX_H + +#ifndef USE_SELINUX + +static inline void selinux_setfilecon(char *file, unsigned int mode) { } +static inline void selinux_setfscreatecon(char *file, unsigned int mode) {} +static inline void selinux_init(void) {} +static inline void selinux_restore(void) {} + +#else + +#include +#include +#include +#include + + +static int selinux_enabled=-1; +static security_context_t prev_scontext=NULL; + +static inline int is_selinux_running(void) { + if ( selinux_enabled==-1 ) + return selinux_enabled=is_selinux_enabled()>0; + return selinux_enabled; +} + +static inline int selinux_get_media(char *path, int mode, char **media) +{ + FILE *fp; + char buf[PATH_MAX]; + char mediabuf[PATH_MAX]; + *media=NULL; + if (!( mode && S_IFBLK )) { + return -1; + } + snprintf(buf,sizeof(buf), "/proc/ide/%s/media", basename(path)); + fp=fopen(buf,"r"); + if (fp) { + if (fgets(mediabuf,sizeof(mediabuf), fp)) { + int size=strlen(mediabuf); + while (size-- > 0) { + if (isspace(mediabuf[size])) { + mediabuf[size]='\0'; + } else { + break; + } + } + *media=strdup(mediabuf); + info("selinux_get_media(%s)->%s \n", path, *media); + } + fclose(fp); + return 0; + } else { + return -1; + } +} + +static inline void selinux_setfilecon(char *file, unsigned int mode) { + if (is_selinux_running()) { + security_context_t scontext=NULL; + char *media; + int ret=selinux_get_media(file, mode, &media); + if ( ret== 0) { + ret = matchmediacon(media, &scontext); + free(media); + } + if (ret==-1) + if (matchpathcon(file, mode, &scontext) < 0) { + dbg("matchpathcon(%s) failed\n", file); + return; + } + if (setfilecon(file, scontext) < 0) + dbg("setfiles %s failed with error '%s'", + file, strerror(errno)); + freecon(scontext); + } +} + +static inline void selinux_setfscreatecon(char *file, unsigned int mode) { + int retval = 0; + security_context_t scontext=NULL; + + if (is_selinux_running()) { + char *media; + int ret=selinux_get_media(file, mode, &media); + if ( ret== 0) { + ret = matchmediacon(media, &scontext); + free(media); + } + + if (ret==-1) + if (matchpathcon(file, mode, &scontext) < 0) { + dbg("matchpathcon(%s) failed\n", file); + return; + } + + retval=setfscreatecon(scontext); + if (retval < 0) + dbg("setfiles %s failed with error '%s'", + file, strerror(errno)); + freecon(scontext); + } +} +static inline void selinux_init(void) { + /* record the present security context, for file-creation + * restoration creation purposes. + * + */ + + if (is_selinux_running()) + { + if (getfscreatecon(&prev_scontext) < 0) { + dbg("getfscreatecon failed\n"); + } + prev_scontext=NULL; + } +} +static inline void selinux_restore(void) { + if (is_selinux_running()) { + /* reset the file create context to its former glory */ + if ( setfscreatecon(prev_scontext) < 0 ) + dbg("setfscreatecon failed\n"); + if (prev_scontext) { + freecon(prev_scontext); + prev_scontext=NULL; + } + } +} +#endif /* USE_SELINUX */ +#endif /* SELINUX_H */ diff --git a/udev-add.c b/udev-add.c index 1f69329788..e1e145de8a 100644 --- a/udev-add.c +++ b/udev-add.c @@ -50,6 +50,8 @@ #define LOCAL_USER "$local" +#include "selinux.h" + /* * Right now the major/minor of a device is stored in a file called * "dev" in sysfs. @@ -92,6 +94,7 @@ static int create_path(char *file) break; *pos = 0x00; if (stat(p, &stats)) { + selinux_setfscreatecon(p, S_IFDIR); retval = mkdir(p, 0755); if (retval != 0) { dbg("mkdir(%s) failed with error '%s'", @@ -99,6 +102,8 @@ static int create_path(char *file) return retval; } dbg("created '%s'", p); + } else { + selinux_setfilecon(p, S_IFDIR); } *pos = '/'; } @@ -117,6 +122,7 @@ static int make_node(char *file, int major, int minor, unsigned int mode, uid_t if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) && (stats.st_rdev == makedev(major, minor))) { dbg("preserve file '%s', cause it has correct dev_t", file); + selinux_setfilecon(file,stats.st_mode); goto perms; } @@ -126,6 +132,7 @@ static int make_node(char *file, int major, int minor, unsigned int mode, uid_t dbg("already present file '%s' unlinked", file); create: + selinux_setfscreatecon(file, mode); retval = mknod(file, mode, makedev(major, minor)); if (retval != 0) { dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", @@ -304,6 +311,7 @@ static int create_node(struct udevice *dev, int fake) dbg("symlink(%s, %s)", linktarget, filename); if (!fake) { + selinux_setfscreatecon(filename, S_IFLNK); unlink(filename); if (symlink(linktarget, filename) != 0) dbg("symlink(%s, %s) failed with error '%s'", @@ -438,6 +446,7 @@ int udev_add_device(const char *path, const char *subsystem, int fake) dbg("name='%s'", dev.name); + selinux_init(); switch (dev.type) { case 'b': case 'c': @@ -475,6 +484,7 @@ int udev_add_device(const char *path, const char *subsystem, int fake) } exit: + selinux_restore(); sysfs_close_class_device(class_dev); return retval; -- cgit v1.2.3-54-g00ecf From 8f2f874ae8d5bfdc1eda9b1f9d77f6637f6940a5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 5 Oct 2004 23:49:50 -0700 Subject: [PATCH] update the selinux.h file to start to look sane and I told them to follow the proper coding style... bleah... --- selinux.h | 108 +++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 58 insertions(+), 50 deletions(-) diff --git a/selinux.h b/selinux.h index 475a60d6d2..38c60a3588 100644 --- a/selinux.h +++ b/selinux.h @@ -3,7 +3,7 @@ #ifndef USE_SELINUX -static inline void selinux_setfilecon(char *file, unsigned int mode) { } +static inline void selinux_setfilecon(char *file, unsigned int mode) {} static inline void selinux_setfscreatecon(char *file, unsigned int mode) {} static inline void selinux_init(void) {} static inline void selinux_restore(void) {} @@ -15,57 +15,59 @@ static inline void selinux_restore(void) {} #include #include - static int selinux_enabled=-1; static security_context_t prev_scontext=NULL; -static inline int is_selinux_running(void) { - if ( selinux_enabled==-1 ) - return selinux_enabled=is_selinux_enabled()>0; +static inline int is_selinux_running(void) +{ + if (selinux_enabled == -1) + return selinux_enabled = is_selinux_enabled() > 0; return selinux_enabled; } static inline int selinux_get_media(char *path, int mode, char **media) { - FILE *fp; - char buf[PATH_MAX]; - char mediabuf[PATH_MAX]; - *media=NULL; - if (!( mode && S_IFBLK )) { - return -1; - } - snprintf(buf,sizeof(buf), "/proc/ide/%s/media", basename(path)); - fp=fopen(buf,"r"); - if (fp) { - if (fgets(mediabuf,sizeof(mediabuf), fp)) { - int size=strlen(mediabuf); - while (size-- > 0) { - if (isspace(mediabuf[size])) { - mediabuf[size]='\0'; - } else { - break; - } - } - *media=strdup(mediabuf); - info("selinux_get_media(%s)->%s \n", path, *media); - } - fclose(fp); - return 0; - } else { - return -1; - } + FILE *fp; + char buf[PATH_MAX]; + char mediabuf[PATH_MAX]; + + *media = NULL; + if (!(mode && S_IFBLK)) { + return -1; + } + snprintf(buf,sizeof(buf), "/proc/ide/%s/media", basename(path)); + fp=fopen(buf,"r"); + if (fp) { + if (fgets(mediabuf,sizeof(mediabuf), fp)) { + int size = strlen(mediabuf); + while (size-- > 0) { + if (isspace(mediabuf[size])) { + mediabuf[size]='\0'; + } else { + break; + } + } + *media = strdup(mediabuf); + info("selinux_get_media(%s)->%s \n", path, *media); + } + fclose(fp); + return 0; + } else { + return -1; + } } -static inline void selinux_setfilecon(char *file, unsigned int mode) { +static inline void selinux_setfilecon(char *file, unsigned int mode) +{ if (is_selinux_running()) { security_context_t scontext=NULL; char *media; int ret=selinux_get_media(file, mode, &media); - if ( ret== 0) { + if (ret == 0) { ret = matchmediacon(media, &scontext); free(media); } - if (ret==-1) + if (ret == -1) if (matchpathcon(file, mode, &scontext) < 0) { dbg("matchpathcon(%s) failed\n", file); return; @@ -77,55 +79,61 @@ static inline void selinux_setfilecon(char *file, unsigned int mode) { } } -static inline void selinux_setfscreatecon(char *file, unsigned int mode) { +static inline void selinux_setfscreatecon(char *file, unsigned int mode) +{ int retval = 0; security_context_t scontext=NULL; if (is_selinux_running()) { char *media; - int ret=selinux_get_media(file, mode, &media); - if ( ret== 0) { + int ret = selinux_get_media(file, mode, &media); + + if (ret == 0) { ret = matchmediacon(media, &scontext); free(media); } - if (ret==-1) + if (ret == -1) if (matchpathcon(file, mode, &scontext) < 0) { dbg("matchpathcon(%s) failed\n", file); return; } - retval=setfscreatecon(scontext); + retval = setfscreatecon(scontext); if (retval < 0) dbg("setfiles %s failed with error '%s'", file, strerror(errno)); freecon(scontext); } } -static inline void selinux_init(void) { - /* record the present security context, for file-creation + +static inline void selinux_init(void) +{ + /* + * record the present security context, for file-creation * restoration creation purposes. - * */ - - if (is_selinux_running()) - { + if (is_selinux_running()) { if (getfscreatecon(&prev_scontext) < 0) { dbg("getfscreatecon failed\n"); } - prev_scontext=NULL; + prev_scontext = NULL; } } -static inline void selinux_restore(void) { + +static inline void selinux_restore(void) +{ if (is_selinux_running()) { /* reset the file create context to its former glory */ - if ( setfscreatecon(prev_scontext) < 0 ) + if (setfscreatecon(prev_scontext) < 0) dbg("setfscreatecon failed\n"); if (prev_scontext) { freecon(prev_scontext); - prev_scontext=NULL; + prev_scontext = NULL; } } } + #endif /* USE_SELINUX */ + #endif /* SELINUX_H */ -- cgit v1.2.3-54-g00ecf From 057f2bdbf65ba6276209869feb74097d73c06b99 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 5 Oct 2004 23:51:24 -0700 Subject: [PATCH] add USE_SELINUX to README documentation so people have a chance to see what is going on. --- README | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README b/README index 508566b50a..c0475dc904 100644 --- a/README +++ b/README @@ -44,6 +44,9 @@ To use: what udev is doing. This is enabled by default. Note, if you are building udev against klibc it is recommended that you disable this option (due to klibc's syslog implementation.) + USE_SELINUX + if set to 'true', udev will be built with SELinux support + enabled. This is disabled by default. DEBUG if set to 'true', debugging messages will be sent to the syslog as udev is run. Default value is 'false'. @@ -88,3 +91,4 @@ know by sending a message to the linux-hotplug-devel mailing list at: greg k-h greg@kroah.com + -- cgit v1.2.3-54-g00ecf From 470c0ef2a6483d1b150d52319eb03b87f7744ea0 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 6 Oct 2004 00:23:37 -0700 Subject: [PATCH] be paranoid in dev_d.c --- dev_d.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dev_d.c b/dev_d.c index 1ad599ead5..e6081b3993 100644 --- a/dev_d.c +++ b/dev_d.c @@ -71,6 +71,7 @@ void dev_d_send(struct udevice *dev, const char *subsystem, const char *devpath) if (udev_dev_d == 0) return; + memset(env_devname, 0x00, sizeof(env_devname)); if (dev->type == 'b' || dev->type == 'c') { strfieldcpy(env_devname, udev_root); strfieldcat(env_devname, dev->name); -- cgit v1.2.3-54-g00ecf From a551c7b0ceb72145a5256cdd53b0b52ff9f766de Mon Sep 17 00:00:00 2001 From: "harald@redhat.com" Date: Wed, 6 Oct 2004 00:27:10 -0700 Subject: [PATCH] PATCH some cleanups and security fixes posted by Steve Grubb on https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130351 --- udevstart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevstart.c b/udevstart.c index 9c1d69503d..ba63745620 100644 --- a/udevstart.c +++ b/udevstart.c @@ -211,7 +211,7 @@ static void udev_scan_class(void) dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN-1]; + char dirname2[MAX_PATHLEN]; DIR *dir3; struct dirent *dent3; -- cgit v1.2.3-54-g00ecf From c8fa2d8b413f7cf1ab42d1c35865952649bfccad Mon Sep 17 00:00:00 2001 From: "harald@redhat.com" Date: Wed, 6 Oct 2004 00:48:10 -0700 Subject: [PATCH] PATCH some cleanups and security fixes posted by Steve Grubb on https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130351 --- udevd.c | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/udevd.c b/udevd.c index 88131d63ab..2bcb4a9e1e 100644 --- a/udevd.c +++ b/udevd.c @@ -45,9 +45,9 @@ static int pipefds[2]; static unsigned long long expected_seqnum = 0; -volatile static int children_waiting; -volatile static int run_msg_q; -volatile static int sig_flag; +static volatile int children_waiting; +static volatile int run_msg_q; +static volatile int sig_flag; static int run_exec_q; static LIST_HEAD(msg_list); @@ -397,7 +397,7 @@ int main(int argc, char *argv[]) int ssock, maxsockplus; struct sockaddr_un saddr; socklen_t addrlen; - int retval; + int retval, fd; const int on = 1; struct sigaction act; fd_set readfds; @@ -409,6 +409,22 @@ int main(int argc, char *argv[]) dbg("need to be root, exit"); exit(1); } + /* make sure we are at top of dir */ + chdir("/"); + umask( umask( 077 ) | 022 ); + /* Set fds to dev/null */ + fd = open( "/dev/null", O_RDWR ); + if ( fd < 0 ) { + dbg("error opening /dev/null %s", strerror(errno)); + exit(1); + } + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + if (fd > 2) + close(fd); + /* Get new session id so stray signals don't come our way. */ + setsid(); /* setup signal handler pipe */ retval = pipe(pipefds); @@ -418,7 +434,12 @@ int main(int argc, char *argv[]) } retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK); - if (retval < 0) { + if (retval < 0) { + dbg("error fcntl on read pipe: %s", strerror(errno)); + exit(1); + } + retval = fcntl(pipefds[0], F_SETFD, FD_CLOEXEC); + if (retval < 0) { dbg("error fcntl on read pipe: %s", strerror(errno)); exit(1); } @@ -428,7 +449,13 @@ int main(int argc, char *argv[]) dbg("error fcntl on write pipe: %s", strerror(errno)); exit(1); } + retval = fcntl(pipefds[1], F_SETFD, FD_CLOEXEC); + if (retval < 0) { + dbg("error fcntl on write pipe: %s", strerror(errno)); + exit(1); + } + /* set signal handlers */ act.sa_handler = sig_handler; sigemptyset(&act.sa_mask); @@ -456,6 +483,11 @@ int main(int argc, char *argv[]) dbg("bind failed, exit"); goto exit; } + retval = fcntl(ssock, F_SETFD, FD_CLOEXEC); + if (retval < 0) { + dbg("error fcntl on ssock: %s", strerror(errno)); + exit(1); + } /* enable receiving of the sender credentials */ setsockopt(ssock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); -- cgit v1.2.3-54-g00ecf From 6e3e3c3416864eca74cb885f64c453eb531eed63 Mon Sep 17 00:00:00 2001 From: "harald@redhat.com" Date: Wed, 6 Oct 2004 00:54:08 -0700 Subject: [PATCH] PATCH udev close on exec selinux wants a clean fd set, so better close all open fds --- dev_d.c | 13 +++++++++++++ namedev.c | 6 ++---- tdb/tdb.c | 7 +++++++ udev_lib.c | 19 +++++++++++++++++++ udev_lib.h | 2 +- udevd.c | 2 ++ udevsend.c | 2 ++ 7 files changed, 46 insertions(+), 5 deletions(-) diff --git a/dev_d.c b/dev_d.c index e6081b3993..c091f11c28 100644 --- a/dev_d.c +++ b/dev_d.c @@ -23,9 +23,13 @@ #include #include #include +#include #include +#include + #include "udev.h" #include "udev_lib.h" +#include "udevdb.h" #include "logging.h" #define DEVD_DIR "/etc/dev.d/" @@ -34,6 +38,7 @@ static int run_program(char *name) { pid_t pid; + int fd; dbg("running %s", name); @@ -41,6 +46,14 @@ static int run_program(char *name) switch (pid) { case 0: /* child */ + udevdb_exit(); /* close udevdb */ + fd = open("/dev/null", O_RDWR); + if ( fd >= 0) { + dup2(fd, STDOUT_FILENO); + dup2(fd, STDIN_FILENO); + dup2(fd, STDERR_FILENO); + } + close(fd); execv(name, main_argv); dbg("exec of child failed"); exit(1); diff --git a/namedev.c b/namedev.c index c8217024c8..fe7dddaf55 100644 --- a/namedev.c +++ b/namedev.c @@ -454,10 +454,8 @@ static int execute_program(char *path, char *value, int len) switch(pid) { case 0: /* child */ - close(STDOUT_FILENO); - - /* dup write side of pipe to STDOUT */ - dup(fds[1]); + /* dup2 write side of pipe to STDOUT */ + dup2(fds[1], STDOUT_FILENO); if (argv[0] != NULL) { dbg("execute '%s' with given arguments", argv[0]); retval = execv(argv[0], argv); diff --git a/tdb/tdb.c b/tdb/tdb.c index 9ae57a974e..e87ea3692e 100644 --- a/tdb/tdb.c +++ b/tdb/tdb.c @@ -65,6 +65,7 @@ #include #include "tdb.h" #include "spinlock.h" +#include "../udev_lib.h" #else #include "includes.h" #endif @@ -1736,6 +1737,12 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, goto fail; /* errno set by open(2) */ } + /* + Close file when execing another process. + Prevents SELinux access errors. + */ + set_cloexec_flag(tdb->fd, 1); + /* ensure there is only one process initialising at once */ if (tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0) == -1) { TDB_LOG((tdb, 0, "tdb_open_ex: failed to get global lock on %s: %s\n", diff --git a/udev_lib.c b/udev_lib.c index 8f6aa42377..4991ec3acb 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -255,3 +255,22 @@ int call_foreach_file(int fnct(char *f) , char *dirname, char *suffix) closedir(dir); return 0; } + +/* Set the FD_CLOEXEC flag of desc if value is nonzero, + or clear the flag if value is 0. + Return 0 on success, or -1 on error with errno set. */ + +int set_cloexec_flag (int desc, int value) +{ + int oldflags = fcntl (desc, F_GETFD, 0); + /* If reading the flags failed, return error indication now. */ + if (oldflags < 0) + return oldflags; + /* Set just the flag we want to set. */ + if (value != 0) + oldflags |= FD_CLOEXEC; + else + oldflags &= ~FD_CLOEXEC; + /* Store modified flag word in the descriptor. */ + return fcntl (desc, F_SETFD, oldflags); +} diff --git a/udev_lib.h b/udev_lib.h index 18ce25ccc7..2f1965ea32 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -78,6 +78,6 @@ extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); extern void leading_slash(char *path); extern void no_leading_slash(char *path); extern int call_foreach_file(int fnct(char *f) , char *filename, char *extension); - +extern int set_cloexec_flag (int desc, int value); #endif diff --git a/udevd.c b/udevd.c index 2bcb4a9e1e..81f4474a89 100644 --- a/udevd.c +++ b/udevd.c @@ -477,6 +477,8 @@ int main(int argc, char *argv[]) exit(1); } + set_cloexec_flag(ssock, 1); + /* the bind takes care of ensuring only one copy running */ retval = bind(ssock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { diff --git a/udevsend.c b/udevsend.c index 842a2a4bc4..23ba1a1b00 100644 --- a/udevsend.c +++ b/udevsend.c @@ -160,6 +160,8 @@ int main(int argc, char* argv[]) goto fallback; } + set_cloexec_flag(sock, 1); + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ -- cgit v1.2.3-54-g00ecf From 33eae955e24feb2e473b905d64de17ad641e57e0 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 6 Oct 2004 00:58:04 -0700 Subject: [PATCH] update volume_id Here is an update to the latest volume_id which fixes a few bugs with FAT volumes. --- extras/volume_id/volume_id.c | 38 ++++++++++++++++++++++---------------- extras/volume_id/volume_id.h | 3 ++- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index 99aed6c96b..f18baec6ee 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -321,7 +321,7 @@ static int probe_lvm2(struct volume_id *id, __u64 off) found: strncpy(id->type_version, lvm->type, 8); id->usage_id = VOLUME_ID_RAID; - id->type_id = VOLUME_ID_LVM1; + id->type_id = VOLUME_ID_LVM2; id->type = "LVM2_member"; return 0; @@ -461,6 +461,8 @@ static int probe_msdos_part_table(struct volume_id *id, __u64 off) p = &id->partitions[i]; + p->partition_type_raw = part[i].sys_ind; + if (is_extended(part[i].sys_ind)) { dbg("found extended partition at 0x%llx", poff); p->usage_id = VOLUME_ID_PARTITIONTABLE; @@ -535,6 +537,9 @@ static int probe_msdos_part_table(struct volume_id *id, __u64 off) p->off = current + poff; p->len = plen; id->partition_count++; + + p->partition_type_raw = part[i].sys_ind; + if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { dbg("to many partitions"); next = 0; @@ -918,13 +923,13 @@ valid: for (i = 0; i <= root_dir_entries; i++) { /* end marker */ - if (dir[i].attr == 0x00) { + if (dir[i].name[0] == 0x00) { dbg("end of dir"); break; } /* empty entry */ - if (dir[i].attr == 0xe5) + if (dir[i].name[0] == 0xe5) continue; if (dir[i].attr == FAT_ATTR_VOLUME) { @@ -976,13 +981,13 @@ fat32: for (i = 0; i <= count; i++) { /* end marker */ - if (dir[i].attr == 0x00) { + if (dir[i].name[0] == 0x00) { dbg("end of dir"); goto fat32_label; } /* empty entry */ - if (dir[i].attr == 0xe5) + if (dir[i].name[0] == 0xe5) continue; if (dir[i].attr == FAT_ATTR_VOLUME) { @@ -1016,7 +1021,7 @@ fat32_label: set_label_raw(id, vs->type.fat32.label, 11); set_label_string(id, vs->type.fat32.label, 11); } - set_uuid(id, vs->type.fat32.serno, UUID_DCE); + set_uuid(id, vs->type.fat32.serno, UUID_DOS); found: id->usage_id = VOLUME_ID_FILESYSTEM; @@ -2035,18 +2040,25 @@ int volume_id_probe(struct volume_id *id, break; case VOLUME_ID_ALL: default: + /* probe for raid first, cause fs probes may be successful on raid members */ rc = probe_linux_raid(id, off, size); if (rc == 0) break; - - /* signature in the first block */ - rc = probe_ntfs(id, off); + rc = probe_lvm1(id, off); if (rc == 0) break; - rc = probe_vfat(id, off); + rc = probe_lvm2(id, off); if (rc == 0) break; + + /* signature in the first block, only small buffer needed */ rc = probe_msdos_part_table(id, off); + if (rc == 0) + break; + rc = probe_ntfs(id, off); + if (rc == 0) + break; + rc = probe_vfat(id, off); if (rc == 0) break; rc = probe_mac_partition_map(id, off); @@ -2081,12 +2093,6 @@ int volume_id_probe(struct volume_id *id, if (rc == 0) break; rc = probe_ufs(id, off); - if (rc == 0) - break; - rc = probe_lvm1(id, off); - if (rc == 0) - break; - rc = probe_lvm2(id, off); if (rc == 0) break; diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h index e68c42c3cf..c6f52bec41 100644 --- a/extras/volume_id/volume_id.h +++ b/extras/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 024 +#define VOLUME_ID_VERSION 25 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 @@ -68,6 +68,7 @@ struct volume_id_partition { char *type; unsigned long long off; unsigned long long len; + unsigned int partition_type_raw; }; struct volume_id { -- cgit v1.2.3-54-g00ecf From 71144b744acb191d357dbfeb85a256389d4fac3b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 6 Oct 2004 18:32:41 -0700 Subject: [PATCH] delete extras/multipath-tools as per the author's request This is now a standalone package. --- extras/multipath-tools/AUTHOR | 1 - extras/multipath-tools/COPYING | 483 --------- extras/multipath-tools/ChangeLog | 137 --- extras/multipath-tools/Makefile | 43 - extras/multipath-tools/README | 90 -- extras/multipath-tools/VERSION | 1 - extras/multipath-tools/devmap_name/Makefile | 49 - extras/multipath-tools/devmap_name/devmap_name.8 | 30 - extras/multipath-tools/devmap_name/devmap_name.c | 60 -- extras/multipath-tools/libdevmapper/Makefile | 30 - .../libdevmapper/ioctl/libdevmapper.c | 1092 -------------------- .../libdevmapper/ioctl/libdm-compat.h | 111 -- .../libdevmapper/ioctl/libdm-targets.h | 51 - extras/multipath-tools/libdevmapper/libdevmapper.h | 147 --- extras/multipath-tools/libdevmapper/libdm-common.c | 382 ------- extras/multipath-tools/libdevmapper/libdm-common.h | 38 - extras/multipath-tools/libdevmapper/list.h | 99 -- extras/multipath-tools/multipath/Makefile | 62 -- extras/multipath-tools/multipath/devinfo.c | 240 ----- extras/multipath-tools/multipath/devinfo.h | 21 - extras/multipath-tools/multipath/main.c | 895 ---------------- extras/multipath-tools/multipath/main.h | 131 --- extras/multipath-tools/multipath/multipath.8 | 66 -- extras/multipath-tools/multipath/multipath.hotplug | 7 - extras/multipath-tools/multipath/sg_err.h | 162 --- extras/multipath-tools/multipath/sg_include.h | 43 - extras/multipath-tools/multipath/unused.c | 95 -- extras/multipath-tools/multipathd/Makefile | 32 - extras/multipath-tools/multipathd/checkers.c | 62 -- extras/multipath-tools/multipathd/checkers.h | 2 - extras/multipath-tools/multipathd/devinfo.c | 82 -- extras/multipath-tools/multipathd/devinfo.h | 15 - extras/multipath-tools/multipathd/main.c | 674 ------------ extras/multipath-tools/multipathd/multipathd.init | 42 - extras/multipath-tools/multipathd/sg_include.h | 43 - 35 files changed, 5518 deletions(-) delete mode 100644 extras/multipath-tools/AUTHOR delete mode 100644 extras/multipath-tools/COPYING delete mode 100644 extras/multipath-tools/ChangeLog delete mode 100644 extras/multipath-tools/Makefile delete mode 100644 extras/multipath-tools/README delete mode 100644 extras/multipath-tools/VERSION delete mode 100644 extras/multipath-tools/devmap_name/Makefile delete mode 100644 extras/multipath-tools/devmap_name/devmap_name.8 delete mode 100644 extras/multipath-tools/devmap_name/devmap_name.c delete mode 100644 extras/multipath-tools/libdevmapper/Makefile delete mode 100644 extras/multipath-tools/libdevmapper/ioctl/libdevmapper.c delete mode 100644 extras/multipath-tools/libdevmapper/ioctl/libdm-compat.h delete mode 100644 extras/multipath-tools/libdevmapper/ioctl/libdm-targets.h delete mode 100644 extras/multipath-tools/libdevmapper/libdevmapper.h delete mode 100644 extras/multipath-tools/libdevmapper/libdm-common.c delete mode 100644 extras/multipath-tools/libdevmapper/libdm-common.h delete mode 100644 extras/multipath-tools/libdevmapper/list.h delete mode 100644 extras/multipath-tools/multipath/Makefile delete mode 100644 extras/multipath-tools/multipath/devinfo.c delete mode 100644 extras/multipath-tools/multipath/devinfo.h delete mode 100644 extras/multipath-tools/multipath/main.c delete mode 100644 extras/multipath-tools/multipath/main.h delete mode 100644 extras/multipath-tools/multipath/multipath.8 delete mode 100644 extras/multipath-tools/multipath/multipath.hotplug delete mode 100644 extras/multipath-tools/multipath/sg_err.h delete mode 100644 extras/multipath-tools/multipath/sg_include.h delete mode 100644 extras/multipath-tools/multipath/unused.c delete mode 100644 extras/multipath-tools/multipathd/Makefile delete mode 100644 extras/multipath-tools/multipathd/checkers.c delete mode 100644 extras/multipath-tools/multipathd/checkers.h delete mode 100644 extras/multipath-tools/multipathd/devinfo.c delete mode 100644 extras/multipath-tools/multipathd/devinfo.h delete mode 100644 extras/multipath-tools/multipathd/main.c delete mode 100644 extras/multipath-tools/multipathd/multipathd.init delete mode 100644 extras/multipath-tools/multipathd/sg_include.h diff --git a/extras/multipath-tools/AUTHOR b/extras/multipath-tools/AUTHOR deleted file mode 100644 index 4e8eeef5c8..0000000000 --- a/extras/multipath-tools/AUTHOR +++ /dev/null @@ -1 +0,0 @@ -Christophe Varoqui, diff --git a/extras/multipath-tools/COPYING b/extras/multipath-tools/COPYING deleted file mode 100644 index 9e31bbf0b3..0000000000 --- a/extras/multipath-tools/COPYING +++ /dev/null @@ -1,483 +0,0 @@ - - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal -permission to copy, distribute and/or modify the library. - - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. - - GNU LIBRARY GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also compile or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - c) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - d) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/extras/multipath-tools/ChangeLog b/extras/multipath-tools/ChangeLog deleted file mode 100644 index 0807a42678..0000000000 --- a/extras/multipath-tools/ChangeLog +++ /dev/null @@ -1,137 +0,0 @@ -2004-03-06 multipath-tools-0.1.1 - * include dlist.h in multipath main.c (PM Hahn) - * typo in hotplug script (PM Hahn) - * pass -9 opt to gzip for manpages (PM Hahn) -2004-03-05 multipath-tools-0.1.0 - * add the group_by_tur policy - * add the multipathd daemon for pathchecking & DM hot-reconfig - * multipath doesn't run twice - * massive cleanups, and code restructuring - * Avoid Kernel Bug when passing too small a buffer in do_inq() - * Sync with 2.6.3-udm4 target synthax (no more PG prio) -2004-02-21 multipath-018 - * From the Debian SID inclusion review (Philipp Matthias Hahn) - * use DESTDIR install prefix in the Makefile - * add man pages for devmap_name & multipath - * correct libsysfs.h includes - * fork the hotplug script in its own shell - * Sync with the kernel device mapper code as of 2.6.3-udm3 - ie. Remove the test interval parameter and its uses - * Remove superfluous scsi parameter passed from hotplug - * Add the man pages to the [un]install targets -2004-02-17 multipath-017 - * remove the restrictive -f flag. - Introduce a more generic "-m iopolicy" one. - * remove useless "int with_sysfs" in env struct -2004-02-04 multipath-016 - * add a GROUP_BY_SERIAL flag. This should be useful for - controlers that activate they spare paths on simple IO - submition with a penalty. The StorageWorks HW defaults to - this mode, even if the MULTIBUS mode is OK. - * remove unused sg_err.c - * big restructuring : split devinfo.c from main.c. Export : - * void basename (char *, char *); - * int get_serial (int, char *); - * int get_lun_strings (char *, char *, char *, char *); - * int get_evpd_wwid(char *, char *); - * long get_disk_size (char *); - * stop passing struct env as param - * add devmap_name proggy for udev to name devmaps as per their - internal DM name and not only by their sysfs enum name (dm-*) - The corresponding udev.rules line is : - KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" - * remove make_dm_node fn & call. Rely on udev for this. - * don't rely on the linux symlink in the udev/klibc dir since - udev build doesn't use it anymore. This corrects build breakage -2004-01-19 multipath-013 - * update the DM target synthax to the 2.6.0-udm5 style -2003-12-29 multipath-012 - * check hotplug event refers to a block device; if not exit early - * refresh doc - * add the uninstall target in Makefile -2003-12-22 multipath-010 - * tweak the install target in Makefile - * stop passing fds as argument : this change enable a strict - segregation of ugly 2.4 code - * sysfs version of get_lun_strings() - * be careful about the return of get_unique_id() since errors - formerly caught up by if(open()) in the caller fn are now returned - by get_unique_id() - * send get_serial() in unused.c - * introduce dm-simplecmd for RESUME & SUSPEND requests - * split add_map() in setup_map() & dm-addmap() - * setup_map() correctly submits "SUSPEND-RELOAD-RESUME or CREATE" - sequences instead of the bogus "RELOAD or CREATE" - * don't print .sg_dev if equal to .dev (2.6) in print_path() - * since the kernel code handles defective paths, remove all - code to cope with them : - * move do_tur() to unused.c - * remove .state from path struct - * remove .state settings & conditionals - * add a cmdline switch to force maps to failover mode, - ie 1 path per priority group - * add default policies to the whitelist array (spread io == - MULTIBUS / io forced to 1 path == FAILOVER) - * move get_disk_size() call out of add_map() to coalesce() - * comment tricky coalesce() fn - * bogus unsused.c file renamed to unused.c -2003-12-20 multipath-010 - * big ChangeLog update - * start to give a little control over target params : - introduce cmdline arg -i to control polling interval - * cope with hotplug-style calling convention : - ie "multipath scsi $DEVPATH" ... to avoid messing with - online maps not concerned by an event - * example hotplug agent to drop in /etc/hotplug.d/scsi - * revert the run & resched patch : unless someone proves me - wrong, this was overdesigned - * move commented out functions in unused.c - * update multipath target params to "udm[23] style" - * mp target now supports nr_path == 1, so do we - * add gratuitous free() - * push version forward -2003-12-15 multipath-009 - * Make the HW-specific get_unique_id switch pretty - * Prepare to field-test by whitelisting all known fibre array, - try to fetch WWID from the standard EVPD 0x83 off 8 for everyone - * configure the multipath target with round-robin path selector and - conservative default for a start (udm1 style) : - yes it makes this release the firstreally useful one. - * temporarily disable map creation for single path device - due to current restrictive defaults in the kernel target. - Sistina should work it out. - * correct the strncmp logic in blacklist function. - * update the Makefiles to autodetect libgcc.a & gcc includes - "ulibc-style". Factorisation of udevdirs & others niceties - * drop a hint about absent /dev/sd? on failed open() - * implement a reschedule flag in /var/run. - Last thing the prog do before exit is check if a call to multipath - was done (but canceled by /var/run/multipath.run check) during its - execution. If so restart themain loop. - * implement a blacklist of sysfs bdev to not bother with for now - (hd,md, dm, sr, scd, ram, raw). - This avoid sending SG_IO to unappropiate devices. - * Adds a /var/run/multipath.run handling to avoid simultaneous runs. - * Remove a commented-out "printf" - * drop a libdevmapper copy in extras/multipath; - maybe discussions w/Sistina folks will bring a better solution in the future. - * drop a putchar usage in libdevmapper to compile cleanly with klibc - * drop another such usage of my own in main.c - * massage the Makefile to compile libdevmapper against klibc - * use "ld" to produce the binary rather than "gcc -static" - * stop being stupid w/ uneeded major, minor & dev in main.c:dm_mk_node() - * reverse to creating striped target for now because the multipath target - is more hairy than expected initialy - * push the version code to 009 to be in synch w/ udev -2003-11-27 multipath-007 - * removes sg_err.[ch] deps - * makes sure the core code play nice with klibc - * port the sysfs calls to dlist helpers - * links against udev's sysfs (need libsysfs.a & dlist.a) - * finally define DM_TARGET as "multipath" as Joe posted the code today (not tested yet) - * push version forward (do you want it in sync with udev version?) -2003-11-19 - * merged in udev-006 tree -2003-09-18 Christophe Varoqui - * multipath 0.0.1 released. - * Initial release. diff --git a/extras/multipath-tools/Makefile b/extras/multipath-tools/Makefile deleted file mode 100644 index fa8830082b..0000000000 --- a/extras/multipath-tools/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# Makefile -# -# Copyright (C) 2003 Christophe Varoqui, - -SUBDIRS = libdevmapper devmap_name multipath multipathd - -recurse: - @for dir in $(SUBDIRS); do\ - $(MAKE) -C $$dir ; \ - done - -recurse_clean: - @for dir in $(SUBDIRS); do\ - $(MAKE) -C $$dir clean ; \ - done - -recurse_install: - @for dir in $(SUBDIRS); do\ - $(MAKE) -C $$dir install ; \ - done - -recurse_uninstall: - @for dir in $(SUBDIRS); do\ - $(MAKE) -C $$dir uninstall ; \ - done - -all: recurse - @echo "" - @echo "Make complete" - -clean: recurse_clean - @echo "" - @echo "Make complete" - -spotless: clean - -install: recurse_install - @echo "" - @echo "Make complete" - -uninstall: recurse_uninstall - @echo "" - @echo "Make complete" diff --git a/extras/multipath-tools/README b/extras/multipath-tools/README deleted file mode 100644 index 80945db438..0000000000 --- a/extras/multipath-tools/README +++ /dev/null @@ -1,90 +0,0 @@ -Dependancies : -============== - -o libdevmapper : comes with device-mapper-XXXX.tar.gz - See www.sistina.com - This lib has been dropped in the multipath tree -o libsysfs : comes with sysutils or udev - See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ -o Linux kernel 2.6.0 with udm5 patchset - http://people.sistina.com/~thornber/dm/ -o udev - See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ - -How it works : -============== - -Fill the all_paths array. Each path store this info : - -struct path { - char dev[FILE_NAME_SIZE]; - char sg_dev[FILE_NAME_SIZE]; - struct scsi_idlun scsi_id; - struct sg_id sg_id; - int state; - char wwid[WWID_SIZE]; -}; - -scsi_id, sg_dev and sg_id are only really useful for 2.4 -kernels, for which SG cmnds must go through sg devs. -In 2.5+ we have the nice opportunity to send SG cmnds -through SCSI bdevs. - -For 2.4 compat, we pivot on idlun tupple to map sg devs -to SCSI bdevs. - -2.4 does not do device enumeration, so we must scan a -defined number of sg devs and scsi bdevs. Good enough. -In 2.5+, we rely on libsysfs (sysutils) to access to -sysfs device enums. - -the wwid is retrieved by a switch fonction. Only White -Listed HW can filled this field. For now every FC array -HW listed in kernel's devinfo.c is White Listed, assuming -the WWID is stored is the SCSI-3 standard 0x83 EVPD page. - -When all_paths is filled, we coalesce the paths and store -the result in mp array. Each mp is a struct like this : - -struct multipath { - char wwid[WWID_SIZE]; - int npaths; - int pindex[MAX_MP_PATHS]; -}; - -When mp is filled, the device maps are fed to the kernel -through libdevmapper. - -The naming of the corresponding block device is handeld -by udev with the help of the devmap_name proggy. It is -called by the following rule in /etc/udev/udev.rules : -KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \ -NAME="%k", SYMLINK="%c" - -Notes : -======= - -o On 2.4, make sure you have enough /dev/sg* nodes - (/dev/MAKEDEV if necesary). Same goes for /dev/sd* - -o path coalescing relies on a path unique id being found. - This unique id, lacking a standard method, is vendor - specific. A switch function (get_unique_id) is present - and an example function is provided for storageworks - arrays (get_evpd_wwid). Feel free to enrich - with hardware you have at hand :) - -o The kernel does NOT manage properly ghosts paths - with StorageWorks HW. Seems nobody cares after a load - of posts to linux-scsi. - -o 2.4.21 version of DM does not like even segment size. - if you enconter pbs with this, upgrade DM. - -Credits : -========= - -o Heavy cut'n paste from sg_utils. Thanks goes to D. - Gilbert. -o Light cut'n paste from dmsetup. Thanks Joe Thornber. -o Greg KH for the nice sysfs API. diff --git a/extras/multipath-tools/VERSION b/extras/multipath-tools/VERSION deleted file mode 100644 index bbdeab6222..0000000000 --- a/extras/multipath-tools/VERSION +++ /dev/null @@ -1 +0,0 @@ -0.0.5 diff --git a/extras/multipath-tools/devmap_name/Makefile b/extras/multipath-tools/devmap_name/Makefile deleted file mode 100644 index e3b70a5e0d..0000000000 --- a/extras/multipath-tools/devmap_name/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# Makefile -# -# Copyright (C) 2003 Christophe Varoqui, - -EXEC = devmap_name - -prefix = -exec_prefix = ${prefix} -bindir = ${exec_prefix}/sbin -udevdir = ../../.. -klibcdir = $(udevdir)/klibc -mandir = /usr/share/man/man8 -libdmdir = ../libdevmapper - -CC = gcc -GZIP = /bin/gzip -9 -c - -GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} -KERNEL_DIR = /lib/modules/${shell uname -r}/build -CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ - -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ - -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I$(sysfsdir) -I. - -OBJS = devmap_name.o -CRT0 = $(klibcdir)/klibc/crt0.o -LIB = $(klibcdir)/klibc/libc.a -LIBGCC := $(shell $(CC) -print-libgcc-file-name ) - -DMOBJS = $(libdmdir)/libdm-common.o $(libdmdir)/ioctl/libdevmapper.o - -$(EXEC): $(OBJS) - $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(DMOBJS) $(LIB) $(LIBGCC) - strip $(EXEC) - $(GZIP) $(EXEC).8 > $(EXEC).8.gz - -clean: - rm -f core *.o $(EXEC) *.gz - -spotless: clean - -install: - install -d $(DESTDIR)$(bindir) - install -m 755 $(EXEC) $(DESTDIR)$(bindir)/ - install -d $(DESTDIR)$(mandir) - install -m 644 $(EXEC).8.gz $(DESTDIR)$(mandir) - -uninstall: - rm $(DESTDIR)$(bindir)/$(EXEC) - rm $(DESTDIR)$(mandir)/$(EXEC).8.gz diff --git a/extras/multipath-tools/devmap_name/devmap_name.8 b/extras/multipath-tools/devmap_name/devmap_name.8 deleted file mode 100644 index f4f03c3ec6..0000000000 --- a/extras/multipath-tools/devmap_name/devmap_name.8 +++ /dev/null @@ -1,30 +0,0 @@ -.TH DEVMAP_NAME 8 "February 2004" "" "Linux Administrator's Manual" -.SH NAME -devmap_name \- Query device-mapper name -.SH SYNOPSIS -.BI devmap_name " major minor" -.SH DESCRIPTION -.B devmap_name -queries the device-mapper for the name for the device -specified by -.I major -and -.I minor -number. -.br -.B devmap_name -can be called from -.B udev -by the following rule in -.IR /etc/udev/udev.rules : -.sp -.nf -KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \\ - NAME="%k", SYMLINK="%c" -.fi -.SH "SEE ALSO" -.BR udev (8), -.BR dmsetup (8) -.SH AUTHORS -.B devmap_name -was developed by Christophe Varoqui, and others. diff --git a/extras/multipath-tools/devmap_name/devmap_name.c b/extras/multipath-tools/devmap_name/devmap_name.c deleted file mode 100644 index 0932e4f8bb..0000000000 --- a/extras/multipath-tools/devmap_name/devmap_name.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include -#include - -#include "../libdevmapper/libdevmapper.h" - -static void usage(char * progname) { - fprintf(stderr, "usage : %s major minor\n", progname); - exit(1); -} - -int main(int argc, char **argv) -{ - int r = 0; - struct dm_names *names; - unsigned next = 0; - int major, minor; - - /* sanity check */ - if (argc != 3) - usage(argv[0]); - - major = atoi(argv[1]); - minor = atoi(argv[2]); - - struct dm_task *dmt; - - if (!(dmt = dm_task_create(DM_DEVICE_LIST))) - return 0; - - if (!dm_task_run(dmt)) - goto out; - - if (!(names = dm_task_get_names(dmt))) - goto out; - - if (!names->dev) { - printf("No devices found\n"); - goto out; - } - - do { - names = (void *) names + next; - if ((int) MAJOR(names->dev) == major && - (int) MINOR(names->dev) == minor) { - printf("%s\n", names->name); - goto out; - } - next = names->next; - } while (next); - - /* No correspondance found */ - r = 1; - - out: - dm_task_destroy(dmt); - return r; -} - diff --git a/extras/multipath-tools/libdevmapper/Makefile b/extras/multipath-tools/libdevmapper/Makefile deleted file mode 100644 index 4a8b7723fa..0000000000 --- a/extras/multipath-tools/libdevmapper/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# Makefile -# -# Copyright (C) 2003 Christophe Varoqui, - -CC = gcc -udevdir = ../../.. -klibcdir = $(udevdir)/klibc - -CC = gcc -GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} -KERNEL_DIR = /lib/modules/${shell uname -r}/build - -CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ - -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ - -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I. -Iioctl - -OBJS = ioctl/libdevmapper.o libdm-common.o - -all: $(OBJS) - @echo "" - @echo "Make complete" - -clean: - rm -f core *.o ioctl/*.o ioctl/*.so - -spotless: clean - -install: - -uninstall: diff --git a/extras/multipath-tools/libdevmapper/ioctl/libdevmapper.c b/extras/multipath-tools/libdevmapper/ioctl/libdevmapper.c deleted file mode 100644 index ac7ba0c86a..0000000000 --- a/extras/multipath-tools/libdevmapper/ioctl/libdevmapper.c +++ /dev/null @@ -1,1092 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#include "libdm-targets.h" -#include "libdm-common.h" - -#ifdef DM_COMPAT -# include "libdm-compat.h" -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef linux -# include -# include -# include -#else -# define MAJOR(x) major((x)) -# define MINOR(x) minor((x)) -# define MKDEV(x,y) makedev((x),(y)) -#endif - -/* - * Ensure build compatibility. - * The hard-coded versions here are the highest present - * in the _cmd_data arrays. - */ - -#if !((DM_VERSION_MAJOR == 1 && DM_VERSION_MINOR >= 0) || \ - (DM_VERSION_MAJOR == 4 && DM_VERSION_MINOR >= 0)) -#error The version of dm-ioctl.h included is incompatible. -#endif - -/* dm major version no for running kernel */ -static int _dm_version = DM_VERSION_MAJOR; -static int _log_suppress = 0; - -static int _control_fd = -1; -static int _version_checked = 0; -static int _version_ok = 1; - -/* - * Support both old and new major numbers to ease the transition. - * Clumsy, but only temporary. - */ -#if DM_VERSION_MAJOR == 4 && defined(DM_COMPAT) -const int _dm_compat = 1; -#else -const int _dm_compat = 0; -#endif - - -/* *INDENT-OFF* */ -static struct cmd_data _cmd_data_v4[] = { - {"create", DM_DEV_CREATE, {4, 0, 0}}, - {"reload", DM_TABLE_LOAD, {4, 0, 0}}, - {"remove", DM_DEV_REMOVE, {4, 0, 0}}, - {"remove_all", DM_REMOVE_ALL, {4, 0, 0}}, - {"suspend", DM_DEV_SUSPEND, {4, 0, 0}}, - {"resume", DM_DEV_SUSPEND, {4, 0, 0}}, - {"info", DM_DEV_STATUS, {4, 0, 0}}, - {"deps", DM_TABLE_DEPS, {4, 0, 0}}, - {"rename", DM_DEV_RENAME, {4, 0, 0}}, - {"version", DM_VERSION, {4, 0, 0}}, - {"status", DM_TABLE_STATUS, {4, 0, 0}}, - {"table", DM_TABLE_STATUS, {4, 0, 0}}, - {"waitevent", DM_DEV_WAIT, {4, 0, 0}}, - {"names", DM_LIST_DEVICES, {4, 0, 0}}, - {"clear", DM_TABLE_CLEAR, {4, 0, 0}}, - {"mknodes", DM_DEV_STATUS, {4, 0, 0}}, -}; -/* *INDENT-ON* */ - -#define ALIGNMENT_V1 sizeof(int) -#define ALIGNMENT 8 - -/* FIXME Rejig library to record & use errno instead */ -#ifndef DM_EXISTS_FLAG -# define DM_EXISTS_FLAG 0x00000004 -#endif - -static void *_align(void *ptr, unsigned int a) -{ - register unsigned long agn = --a; - - return (void *) (((unsigned long) ptr + agn) & ~agn); -} - -static int _open_control(void) -{ - char control[PATH_MAX]; - - if (_control_fd != -1) - return 1; - - snprintf(control, sizeof(control), "%s/control", dm_dir()); - - if ((_control_fd = open(control, O_RDWR)) < 0) { - log_error("%s: open failed: %s", control, strerror(errno)); - log_error("Is device-mapper driver missing from kernel?"); - return 0; - } - - return 1; -} - -void dm_task_destroy(struct dm_task *dmt) -{ - struct target *t, *n; - - for (t = dmt->head; t; t = n) { - n = t->next; - free(t->params); - free(t->type); - free(t); - } - - if (dmt->dev_name) - free(dmt->dev_name); - - if (dmt->newname) - free(dmt->newname); - - if (dmt->dmi.v4) - free(dmt->dmi.v4); - - if (dmt->uuid) - free(dmt->uuid); - - free(dmt); -} - -/* - * Protocol Version 1 compatibility functions. - */ - -#ifdef DM_COMPAT - -static int _dm_task_get_driver_version_v1(struct dm_task *dmt, char *version, - size_t size) -{ - unsigned int *v; - - if (!dmt->dmi.v1) { - version[0] = '\0'; - return 0; - } - - v = dmt->dmi.v1->version; - snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]); - return 1; -} - -/* Unmarshall the target info returned from a status call */ -static int _unmarshal_status_v1(struct dm_task *dmt, struct dm_ioctl_v1 *dmi) -{ - char *outbuf = (char *) dmi + dmi->data_start; - char *outptr = outbuf; - int32_t i; - struct dm_target_spec_v1 *spec; - - for (i = 0; i < dmi->target_count; i++) { - spec = (struct dm_target_spec_v1 *) outptr; - - if (!dm_task_add_target(dmt, spec->sector_start, - (uint64_t) spec->length, - spec->target_type, - outptr + sizeof(*spec))) - return 0; - - outptr = outbuf + spec->next; - } - - return 1; -} - -static int _dm_format_dev_v1(char *buf, int bufsize, uint32_t dev_major, - uint32_t dev_minor) -{ - int r; - - if (bufsize < 8) - return 0; - - r = snprintf(buf, bufsize, "%03x:%03x", dev_major, dev_minor); - if (r < 0 || r > bufsize - 1) - return 0; - - return 1; -} - -static int _dm_task_get_info_v1(struct dm_task *dmt, struct dm_info *info) -{ - if (!dmt->dmi.v1) - return 0; - - memset(info, 0, sizeof(*info)); - - info->exists = dmt->dmi.v1->flags & DM_EXISTS_FLAG ? 1 : 0; - if (!info->exists) - return 1; - - info->suspended = dmt->dmi.v1->flags & DM_SUSPEND_FLAG ? 1 : 0; - info->read_only = dmt->dmi.v1->flags & DM_READONLY_FLAG ? 1 : 0; - info->target_count = dmt->dmi.v1->target_count; - info->open_count = dmt->dmi.v1->open_count; - info->event_nr = 0; - info->major = MAJOR(dmt->dmi.v1->dev); - info->minor = MINOR(dmt->dmi.v1->dev); - info->live_table = 1; - info->inactive_table = 0; - - return 1; -} - -static const char *_dm_task_get_name_v1(struct dm_task *dmt) -{ - return (dmt->dmi.v1->name); -} - -static const char *_dm_task_get_uuid_v1(struct dm_task *dmt) -{ - return (dmt->dmi.v1->uuid); -} - -static struct dm_deps *_dm_task_get_deps_v1(struct dm_task *dmt) -{ - log_error("deps version 1 no longer supported by libdevmapper"); - return NULL; -} - -static struct dm_names *_dm_task_get_names_v1(struct dm_task *dmt) -{ - return (struct dm_names *) (((void *) dmt->dmi.v1) + - dmt->dmi.v1->data_start); -} - -static void *_add_target_v1(struct target *t, void *out, void *end) -{ - void *out_sp = out; - struct dm_target_spec_v1 sp; - size_t sp_size = sizeof(struct dm_target_spec_v1); - int len; - const char no_space[] = "Ran out of memory building ioctl parameter"; - - out += sp_size; - if (out >= end) { - log_error(no_space); - return NULL; - } - - sp.status = 0; - sp.sector_start = t->start; - sp.length = t->length; - strncpy(sp.target_type, t->type, sizeof(sp.target_type)); - - len = strlen(t->params); - - if ((out + len + 1) >= end) { - log_error(no_space); - - log_error("t->params= '%s'", t->params); - return NULL; - } - strcpy((char *) out, t->params); - out += len + 1; - - /* align next block */ - out = _align(out, ALIGNMENT_V1); - - sp.next = out - out_sp; - - memcpy(out_sp, &sp, sp_size); - - return out; -} - -static struct dm_ioctl_v1 *_flatten_v1(struct dm_task *dmt) -{ - const size_t min_size = 16 * 1024; - const int (*version)[3]; - - struct dm_ioctl_v1 *dmi; - struct target *t; - size_t len = sizeof(struct dm_ioctl_v1); - void *b, *e; - int count = 0; - - for (t = dmt->head; t; t = t->next) { - len += sizeof(struct dm_target_spec_v1); - len += strlen(t->params) + 1 + ALIGNMENT_V1; - count++; - } - - if (count && dmt->newname) { - log_error("targets and newname are incompatible"); - return NULL; - } - - if (dmt->newname) - len += strlen(dmt->newname) + 1; - - /* - * Give len a minimum size so that we have space to store - * dependencies or status information. - */ - if (len < min_size) - len = min_size; - - if (!(dmi = malloc(len))) - return NULL; - - memset(dmi, 0, len); - - version = &_cmd_data_v1[dmt->type].version; - - dmi->version[0] = (*version)[0]; - dmi->version[1] = (*version)[1]; - dmi->version[2] = (*version)[2]; - - dmi->data_size = len; - dmi->data_start = sizeof(struct dm_ioctl_v1); - - if (dmt->dev_name) - strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); - - if (dmt->type == DM_DEVICE_SUSPEND) - dmi->flags |= DM_SUSPEND_FLAG; - if (dmt->read_only) - dmi->flags |= DM_READONLY_FLAG; - - if (dmt->minor >= 0) { - if (dmt->major <= 0) { - log_error("Missing major number for persistent device"); - return NULL; - } - dmi->flags |= DM_PERSISTENT_DEV_FLAG; - dmi->dev = MKDEV(dmt->major, dmt->minor); - } - - if (dmt->uuid) - strncpy(dmi->uuid, dmt->uuid, sizeof(dmi->uuid)); - - dmi->target_count = count; - - b = (void *) (dmi + 1); - e = (void *) ((char *) dmi + len); - - for (t = dmt->head; t; t = t->next) - if (!(b = _add_target_v1(t, b, e))) - goto bad; - - if (dmt->newname) - strcpy(b, dmt->newname); - - return dmi; - - bad: - free(dmi); - return NULL; -} - -static int _dm_names_v1(struct dm_ioctl_v1 *dmi) -{ - const char *dev_dir = dm_dir(); - int r = 1, len; - const char *name; - struct dirent *dirent; - DIR *d; - struct dm_names *names, *old_names = NULL; - void *end = (void *) dmi + dmi->data_size; - struct stat buf; - char path[PATH_MAX]; - - if (!(d = opendir(dev_dir))) { - log_error("%s: opendir failed: %s", dev_dir, strerror(errno)); - return 0; - } - - names = (struct dm_names *) ((void *) dmi + dmi->data_start); - - names->dev = 0; /* Flags no data */ - - while ((dirent = readdir(d))) { - name = dirent->d_name; - - if (name[0] == '.' || !strcmp(name, "control")) - continue; - - if (old_names) - old_names->next = (uint32_t) ((void *) names - - (void *) old_names); - snprintf(path, sizeof(path), "%s/%s", dev_dir, name); - if (stat(path, &buf)) { - log_error("%s: stat failed: %s", path, strerror(errno)); - continue; - } - if (!S_ISBLK(buf.st_mode)) - continue; - names->dev = (uint64_t) buf.st_rdev; - names->next = 0; - len = strlen(name); - if (((void *) (names + 1) + len + 1) >= end) { - log_error("Insufficient buffer space for device list"); - r = 0; - break; - } - - strcpy(names->name, name); - - old_names = names; - names = _align((void *) ++names + len + 1, ALIGNMENT); - } - - if (closedir(d)) - log_error("%s: closedir failed: %s", dev_dir, strerror(errno)); - - return r; -} - -static int _dm_task_run_v1(struct dm_task *dmt) -{ - struct dm_ioctl_v1 *dmi; - unsigned int command; - - dmi = _flatten_v1(dmt); - if (!dmi) { - log_error("Couldn't create ioctl argument"); - return 0; - } - - if (!_open_control()) - return 0; - - if ((unsigned) dmt->type >= - (sizeof(_cmd_data_v1) / sizeof(*_cmd_data_v1))) { - log_error("Internal error: unknown device-mapper task %d", - dmt->type); - goto bad; - } - - command = _cmd_data_v1[dmt->type].cmd; - - if (dmt->type == DM_DEVICE_TABLE) - dmi->flags |= DM_STATUS_TABLE_FLAG; - - log_debug("dm %s %s %s %s", _cmd_data_v1[dmt->type].name, dmi->name, - dmi->uuid, dmt->newname ? dmt->newname : ""); - if (dmt->type == DM_DEVICE_LIST) { - if (!_dm_names_v1(dmi)) - goto bad; - } else if (ioctl(_control_fd, command, dmi) < 0) { - if (_log_suppress) - log_verbose("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); - else - log_error("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); - goto bad; - } - - switch (dmt->type) { - case DM_DEVICE_CREATE: - add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev)); - break; - - case DM_DEVICE_REMOVE: - rm_dev_node(dmt->dev_name); - break; - - case DM_DEVICE_RENAME: - rename_dev_node(dmt->dev_name, dmt->newname); - break; - - case DM_DEVICE_MKNODES: - if (dmi->flags & DM_EXISTS_FLAG) - add_dev_node(dmt->dev_name, MAJOR(dmi->dev), - MINOR(dmi->dev)); - else - rm_dev_node(dmt->dev_name); - break; - - case DM_DEVICE_STATUS: - case DM_DEVICE_TABLE: - if (!_unmarshal_status_v1(dmt, dmi)) - goto bad; - break; - - case DM_DEVICE_SUSPEND: - case DM_DEVICE_RESUME: - dmt->type = DM_DEVICE_INFO; - if (!dm_task_run(dmt)) - goto bad; - free(dmi); /* We'll use what info returned */ - return 1; - } - - dmt->dmi.v1 = dmi; - return 1; - - bad: - free(dmi); - return 0; -} - -#endif - -/* - * Protocol Version 4 functions. - */ - -int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size) -{ - unsigned int *v; - -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_driver_version_v1(dmt, version, size); -#endif - - if (!dmt->dmi.v4) { - version[0] = '\0'; - return 0; - } - - v = dmt->dmi.v4->version; - snprintf(version, size, "%u.%u.%u", v[0], v[1], v[2]); - return 1; -} - -static int _check_version(char *version, size_t size, int log_suppress) -{ - struct dm_task *task; - int r; - - if (!(task = dm_task_create(DM_DEVICE_VERSION))) { - log_error("Failed to get device-mapper version"); - version[0] = '\0'; - return 0; - } - - if (log_suppress) - _log_suppress = 1; - - r = dm_task_run(task); - dm_task_get_driver_version(task, version, size); - dm_task_destroy(task); - _log_suppress = 0; - - return r; -} - -/* - * Find out device-mapper's major version number the first time - * this is called and whether or not we support it. - */ -int dm_check_version(void) -{ - char libversion[64], dmversion[64]; - const char *compat = ""; - - if (_version_checked) - return _version_ok; - - _version_checked = 1; - - if (_check_version(dmversion, sizeof(dmversion), _dm_compat)) - return 1; - - if (!_dm_compat) - goto bad; - - log_verbose("device-mapper ioctl protocol version %d failed. " - "Trying protocol version 1.", _dm_version); - _dm_version = 1; - if (_check_version(dmversion, sizeof(dmversion), 0)) { - log_verbose("Using device-mapper ioctl protocol version 1"); - return 1; - } - - compat = "(compat)"; - - dm_get_library_version(libversion, sizeof(libversion)); - - log_error("Incompatible libdevmapper %s%s and kernel driver %s", - libversion, compat, dmversion); - - bad: - _version_ok = 0; - return 0; -} - -void *dm_get_next_target(struct dm_task *dmt, void *next, - uint64_t *start, uint64_t *length, - char **target_type, char **params) -{ - struct target *t = (struct target *) next; - - if (!t) - t = dmt->head; - - if (!t) - return NULL; - - *start = t->start; - *length = t->length; - *target_type = t->type; - *params = t->params; - - return t->next; -} - -/* Unmarshall the target info returned from a status call */ -static int _unmarshal_status(struct dm_task *dmt, struct dm_ioctl *dmi) -{ - char *outbuf = (char *) dmi + dmi->data_start; - char *outptr = outbuf; - uint32_t i; - struct dm_target_spec *spec; - - for (i = 0; i < dmi->target_count; i++) { - spec = (struct dm_target_spec *) outptr; - if (!dm_task_add_target(dmt, spec->sector_start, - spec->length, - spec->target_type, - outptr + sizeof(*spec))) - return 0; - - outptr = outbuf + spec->next; - } - - return 1; -} - -int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, - uint32_t dev_minor) -{ - int r; - -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_format_dev_v1(buf, bufsize, dev_major, dev_minor); -#endif - - if (bufsize < 8) - return 0; - - r = snprintf(buf, bufsize, "%03u:%03u", dev_major, dev_minor); - if (r < 0 || r > bufsize - 1) - return 0; - - return 1; -} - -int dm_task_get_info(struct dm_task *dmt, struct dm_info *info) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_info_v1(dmt, info); -#endif - - if (!dmt->dmi.v4) - return 0; - - memset(info, 0, sizeof(*info)); - - info->exists = dmt->dmi.v4->flags & DM_EXISTS_FLAG ? 1 : 0; - if (!info->exists) - return 1; - - info->suspended = dmt->dmi.v4->flags & DM_SUSPEND_FLAG ? 1 : 0; - info->read_only = dmt->dmi.v4->flags & DM_READONLY_FLAG ? 1 : 0; - info->live_table = dmt->dmi.v4->flags & DM_ACTIVE_PRESENT_FLAG ? 1 : 0; - info->inactive_table = dmt->dmi.v4->flags & DM_INACTIVE_PRESENT_FLAG ? - 1 : 0; - info->target_count = dmt->dmi.v4->target_count; - info->open_count = dmt->dmi.v4->open_count; - info->event_nr = dmt->dmi.v4->event_nr; - info->major = MAJOR(dmt->dmi.v4->dev); - info->minor = MINOR(dmt->dmi.v4->dev); - - return 1; -} - -const char *dm_task_get_name(struct dm_task *dmt) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_name_v1(dmt); -#endif - - return (dmt->dmi.v4->name); -} - -const char *dm_task_get_uuid(struct dm_task *dmt) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_uuid_v1(dmt); -#endif - - return (dmt->dmi.v4->uuid); -} - -struct dm_deps *dm_task_get_deps(struct dm_task *dmt) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_deps_v1(dmt); -#endif - - return (struct dm_deps *) (((void *) dmt->dmi.v4) + - dmt->dmi.v4->data_start); -} - -struct dm_names *dm_task_get_names(struct dm_task *dmt) -{ -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_get_names_v1(dmt); -#endif - - return (struct dm_names *) (((void *) dmt->dmi.v4) + - dmt->dmi.v4->data_start); -} - -int dm_task_set_ro(struct dm_task *dmt) -{ - dmt->read_only = 1; - return 1; -} - -int dm_task_set_newname(struct dm_task *dmt, const char *newname) -{ - if (!(dmt->newname = strdup(newname))) { - log_error("dm_task_set_newname: strdup(%s) failed", newname); - return 0; - } - - return 1; -} - -int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr) -{ - dmt->event_nr = event_nr; - - return 1; -} - -struct target *create_target(uint64_t start, uint64_t len, const char *type, - const char *params) -{ - struct target *t = malloc(sizeof(*t)); - - if (!t) { - log_error("create_target: malloc(%d) failed", sizeof(*t)); - return NULL; - } - - memset(t, 0, sizeof(*t)); - - if (!(t->params = strdup(params))) { - log_error("create_target: strdup(params) failed"); - goto bad; - } - - if (!(t->type = strdup(type))) { - log_error("create_target: strdup(type) failed"); - goto bad; - } - - t->start = start; - t->length = len; - return t; - - bad: - free(t->params); - free(t->type); - free(t); - return NULL; -} - -static void *_add_target(struct target *t, void *out, void *end) -{ - void *out_sp = out; - struct dm_target_spec sp; - size_t sp_size = sizeof(struct dm_target_spec); - int len; - const char no_space[] = "Ran out of memory building ioctl parameter"; - - out += sp_size; - if (out >= end) { - log_error(no_space); - return NULL; - } - - sp.status = 0; - sp.sector_start = t->start; - sp.length = t->length; - strncpy(sp.target_type, t->type, sizeof(sp.target_type)); - - len = strlen(t->params); - - if ((out + len + 1) >= end) { - log_error(no_space); - - log_error("t->params= '%s'", t->params); - return NULL; - } - strcpy((char *) out, t->params); - out += len + 1; - - /* align next block */ - out = _align(out, ALIGNMENT); - - sp.next = out - out_sp; - memcpy(out_sp, &sp, sp_size); - - return out; -} - -static struct dm_ioctl *_flatten(struct dm_task *dmt) -{ - const size_t min_size = 16 * 1024; - const int (*version)[3]; - - struct dm_ioctl *dmi; - struct target *t; - size_t len = sizeof(struct dm_ioctl); - void *b, *e; - int count = 0; - - for (t = dmt->head; t; t = t->next) { - len += sizeof(struct dm_target_spec); - len += strlen(t->params) + 1 + ALIGNMENT; - count++; - } - - if (count && dmt->newname) { - log_error("targets and newname are incompatible"); - return NULL; - } - - if (dmt->newname) - len += strlen(dmt->newname) + 1; - - /* - * Give len a minimum size so that we have space to store - * dependencies or status information. - */ - if (len < min_size) - len = min_size; - - if (!(dmi = malloc(len))) - return NULL; - - memset(dmi, 0, len); - - version = &_cmd_data_v4[dmt->type].version; - - dmi->version[0] = (*version)[0]; - dmi->version[1] = (*version)[1]; - dmi->version[2] = (*version)[2]; - - dmi->data_size = len; - dmi->data_start = sizeof(struct dm_ioctl); - - if (dmt->dev_name) - strncpy(dmi->name, dmt->dev_name, sizeof(dmi->name)); - - if (dmt->type == DM_DEVICE_SUSPEND) - dmi->flags |= DM_SUSPEND_FLAG; - if (dmt->read_only) - dmi->flags |= DM_READONLY_FLAG; - - if (dmt->minor >= 0) { - if (dmt->major <= 0) { - log_error("Missing major number for persistent device"); - return NULL; - } - dmi->flags |= DM_PERSISTENT_DEV_FLAG; - dmi->dev = MKDEV(dmt->major, dmt->minor); - } - - if (dmt->uuid) - strncpy(dmi->uuid, dmt->uuid, sizeof(dmi->uuid)); - - dmi->target_count = count; - dmi->event_nr = dmt->event_nr; - - b = (void *) (dmi + 1); - e = (void *) ((char *) dmi + len); - - for (t = dmt->head; t; t = t->next) - if (!(b = _add_target(t, b, e))) - goto bad; - - if (dmt->newname) - strcpy(b, dmt->newname); - - return dmi; - - bad: - free(dmi); - return NULL; -} - -static int _create_and_load_v4(struct dm_task *dmt) -{ - struct dm_task *task; - int r; - - /* Use new task struct to create the device */ - if (!(task = dm_task_create(DM_DEVICE_CREATE))) { - log_error("Failed to create device-mapper task struct"); - return 0; - } - - /* Copy across relevant fields */ - if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { - dm_task_destroy(task); - return 0; - } - - if (dmt->uuid && !dm_task_set_uuid(task, dmt->uuid)) { - dm_task_destroy(task); - return 0; - } - - task->major = dmt->major; - task->minor = dmt->minor; - - r = dm_task_run(task); - dm_task_destroy(task); - if (!r) - return r; - - /* Next load the table */ - if (!(task = dm_task_create(DM_DEVICE_RELOAD))) { - log_error("Failed to create device-mapper task struct"); - return 0; - } - - /* Copy across relevant fields */ - if (dmt->dev_name && !dm_task_set_name(task, dmt->dev_name)) { - dm_task_destroy(task); - return 0; - } - - task->read_only = dmt->read_only; - task->head = dmt->head; - task->tail = dmt->tail; - - r = dm_task_run(task); - - task->head = NULL; - task->tail = NULL; - dm_task_destroy(task); - if (!r) - return r; - - /* Use the original structure last so the info will be correct */ - dmt->type = DM_DEVICE_RESUME; - dmt->uuid = NULL; - free(dmt->uuid); - - r = dm_task_run(dmt); - - return r; -} - -int dm_task_run(struct dm_task *dmt) -{ - struct dm_ioctl *dmi = NULL; - unsigned int command; - -#ifdef DM_COMPAT - if (_dm_version == 1) - return _dm_task_run_v1(dmt); -#endif - - if ((unsigned) dmt->type >= - (sizeof(_cmd_data_v4) / sizeof(*_cmd_data_v4))) { - log_error("Internal error: unknown device-mapper task %d", - dmt->type); - goto bad; - } - - command = _cmd_data_v4[dmt->type].cmd; - - /* Old-style creation had a table supplied */ - if (dmt->type == DM_DEVICE_CREATE && dmt->head) - return _create_and_load_v4(dmt); - - if (!_open_control()) - return 0; - - dmi = _flatten(dmt); - if (!dmi) { - log_error("Couldn't create ioctl argument"); - return 0; - } - - if (dmt->type == DM_DEVICE_TABLE) - dmi->flags |= DM_STATUS_TABLE_FLAG; - - dmi->flags |= DM_EXISTS_FLAG; /* FIXME */ - log_debug("dm %s %s %s %s", _cmd_data_v4[dmt->type].name, dmi->name, - dmi->uuid, dmt->newname ? dmt->newname : ""); - if (ioctl(_control_fd, command, dmi) < 0) { - if (errno == ENXIO && ((dmt->type == DM_DEVICE_INFO) || - (dmt->type == DM_DEVICE_MKNODES))) { - dmi->flags &= ~DM_EXISTS_FLAG; /* FIXME */ - goto ignore_error; - } - if (_log_suppress) - log_verbose("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); - else - log_error("device-mapper ioctl cmd %d failed: %s", - _IOC_NR(command), strerror(errno)); - goto bad; - } - - ignore_error: - switch (dmt->type) { - case DM_DEVICE_CREATE: - add_dev_node(dmt->dev_name, MAJOR(dmi->dev), MINOR(dmi->dev)); - break; - - case DM_DEVICE_REMOVE: - rm_dev_node(dmt->dev_name); - break; - - case DM_DEVICE_RENAME: - rename_dev_node(dmt->dev_name, dmt->newname); - break; - - case DM_DEVICE_MKNODES: - if (dmi->flags & DM_EXISTS_FLAG) - add_dev_node(dmt->dev_name, MAJOR(dmi->dev), - MINOR(dmi->dev)); - else - rm_dev_node(dmt->dev_name); - break; - - case DM_DEVICE_STATUS: - case DM_DEVICE_TABLE: - case DM_DEVICE_WAITEVENT: - if (!_unmarshal_status(dmt, dmi)) - goto bad; - break; - } - - dmt->dmi.v4 = dmi; - return 1; - - bad: - free(dmi); - return 0; -} - -void dm_lib_release(void) -{ - if (_control_fd != -1) { - close(_control_fd); - _control_fd = -1; - } - update_devs(); -} - -void dm_lib_exit(void) -{ - if (_control_fd != -1) { - close(_control_fd); - _control_fd = -1; - } - _version_ok = 1; - _version_checked = 0; -} diff --git a/extras/multipath-tools/libdevmapper/ioctl/libdm-compat.h b/extras/multipath-tools/libdevmapper/ioctl/libdm-compat.h deleted file mode 100644 index af7a9f1f71..0000000000 --- a/extras/multipath-tools/libdevmapper/ioctl/libdm-compat.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#ifndef _LINUX_LIBDM_COMPAT_H -#define _LINUX_LIBDM_COMPAT_H - -#include -#include -#include -#include - -struct dm_task; -struct dm_info; - -/* - * Old versions of structures for backwards compatibility. - */ - -struct dm_ioctl_v1 { - uint32_t version[3]; /* in/out */ - uint32_t data_size; /* total size of data passed in - * including this struct */ - - uint32_t data_start; /* offset to start of data - * relative to start of this struct */ - - int32_t target_count; /* in/out */ - int32_t open_count; /* out */ - uint32_t flags; /* in/out */ - - __kernel_dev_t dev; /* in/out */ - - char name[DM_NAME_LEN]; /* device name */ - char uuid[DM_UUID_LEN]; /* unique identifier for - * the block device */ -}; - -struct dm_target_spec_v1 { - int32_t status; /* used when reading from kernel only */ - uint64_t sector_start; - uint32_t length; - uint32_t next; - - char target_type[DM_MAX_TYPE_NAME]; - -}; - -struct dm_target_deps_v1 { - uint32_t count; - - __kernel_dev_t dev[0]; /* out */ -}; - -enum { - /* Top level cmds */ - DM_VERSION_CMD_V1 = 0, - DM_REMOVE_ALL_CMD_V1, - - /* device level cmds */ - DM_DEV_CREATE_CMD_V1, - DM_DEV_REMOVE_CMD_V1, - DM_DEV_RELOAD_CMD_V1, - DM_DEV_RENAME_CMD_V1, - DM_DEV_SUSPEND_CMD_V1, - DM_DEV_DEPS_CMD_V1, - DM_DEV_STATUS_CMD_V1, - - /* target level cmds */ - DM_TARGET_STATUS_CMD_V1, - DM_TARGET_WAIT_CMD_V1, -}; - -#define DM_VERSION_V1 _IOWR(DM_IOCTL, DM_VERSION_CMD_V1, struct dm_ioctl) -#define DM_REMOVE_ALL_V1 _IOWR(DM_IOCTL, DM_REMOVE_ALL_CMD_V1, struct dm_ioctl) - -#define DM_DEV_CREATE_V1 _IOWR(DM_IOCTL, DM_DEV_CREATE_CMD_V1, struct dm_ioctl) -#define DM_DEV_REMOVE_V1 _IOWR(DM_IOCTL, DM_DEV_REMOVE_CMD_V1, struct dm_ioctl) -#define DM_DEV_RELOAD_V1 _IOWR(DM_IOCTL, DM_DEV_RELOAD_CMD_V1, struct dm_ioctl) -#define DM_DEV_SUSPEND_V1 _IOWR(DM_IOCTL, DM_DEV_SUSPEND_CMD_V1, struct dm_ioctl) -#define DM_DEV_RENAME_V1 _IOWR(DM_IOCTL, DM_DEV_RENAME_CMD_V1, struct dm_ioctl) -#define DM_DEV_DEPS_V1 _IOWR(DM_IOCTL, DM_DEV_DEPS_CMD_V1, struct dm_ioctl) -#define DM_DEV_STATUS_V1 _IOWR(DM_IOCTL, DM_DEV_STATUS_CMD_V1, struct dm_ioctl) - -#define DM_TARGET_STATUS_V1 _IOWR(DM_IOCTL, DM_TARGET_STATUS_CMD_V1, struct dm_ioctl) -#define DM_TARGET_WAIT_V1 _IOWR(DM_IOCTL, DM_TARGET_WAIT_CMD_V1, struct dm_ioctl) - -/* *INDENT-OFF* */ -static struct cmd_data _cmd_data_v1[] = { - { "create", DM_DEV_CREATE_V1, {1, 0, 0} }, - { "reload", DM_DEV_RELOAD_V1, {1, 0, 0} }, - { "remove", DM_DEV_REMOVE_V1, {1, 0, 0} }, - { "remove_all", DM_REMOVE_ALL_V1, {1, 0, 0} }, - { "suspend", DM_DEV_SUSPEND_V1, {1, 0, 0} }, - { "resume", DM_DEV_SUSPEND_V1, {1, 0, 0} }, - { "info", DM_DEV_STATUS_V1, {1, 0, 0} }, - { "deps", DM_DEV_DEPS_V1, {1, 0, 0} }, - { "rename", DM_DEV_RENAME_V1, {1, 0, 0} }, - { "version", DM_VERSION_V1, {1, 0, 0} }, - { "status", DM_TARGET_STATUS_V1, {1, 0, 0} }, - { "table", DM_TARGET_STATUS_V1, {1, 0, 0} }, - { "waitevent", DM_TARGET_WAIT_V1, {1, 0, 0} }, - { "names", 0, {4, 0, 0} }, - { "clear", 0, {4, 0, 0} }, - { "mknodes", 0, {4, 0, 0} }, -}; -/* *INDENT-ON* */ - -#endif diff --git a/extras/multipath-tools/libdevmapper/ioctl/libdm-targets.h b/extras/multipath-tools/libdevmapper/ioctl/libdm-targets.h deleted file mode 100644 index a8c0e20547..0000000000 --- a/extras/multipath-tools/libdevmapper/ioctl/libdm-targets.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#ifndef LIB_DMTARGETS_H -#define LIB_DMTARGETS_H - -#include - -struct dm_ioctl; -struct dm_ioctl_v1; - -struct target { - uint64_t start; - uint64_t length; - char *type; - char *params; - - struct target *next; -}; - -struct dm_task { - int type; - char *dev_name; - - struct target *head, *tail; - - int read_only; - uint32_t event_nr; - int major; - int minor; - union { - struct dm_ioctl *v4; - struct dm_ioctl_v1 *v1; - } dmi; - char *newname; - - char *uuid; -}; - -struct cmd_data { - const char *name; - const int cmd; - const int version[3]; -}; - -int dm_check_version(void); - -#endif diff --git a/extras/multipath-tools/libdevmapper/libdevmapper.h b/extras/multipath-tools/libdevmapper/libdevmapper.h deleted file mode 100644 index 6549af3641..0000000000 --- a/extras/multipath-tools/libdevmapper/libdevmapper.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#ifndef LIB_DEVICE_MAPPER_H -#define LIB_DEVICE_MAPPER_H - -#include -#include - -#ifdef linux -# include -#endif - -/* - * Since it is quite laborious to build the ioctl - * arguments for the device-mapper people are - * encouraged to use this library. - * - * You will need to build a struct dm_task for - * each ioctl command you want to execute. - */ - -typedef void (*dm_log_fn) (int level, const char *file, int line, - const char *f, ...); - -/* - * The library user may wish to register their own - * logging function, by default errors go to - * stderr. - */ -void dm_log_init(dm_log_fn fn); -void dm_log_init_verbose(int level); - -enum { - DM_DEVICE_CREATE, - DM_DEVICE_RELOAD, - DM_DEVICE_REMOVE, - DM_DEVICE_REMOVE_ALL, - - DM_DEVICE_SUSPEND, - DM_DEVICE_RESUME, - - DM_DEVICE_INFO, - DM_DEVICE_DEPS, - DM_DEVICE_RENAME, - - DM_DEVICE_VERSION, - - DM_DEVICE_STATUS, - DM_DEVICE_TABLE, - DM_DEVICE_WAITEVENT, - - DM_DEVICE_LIST, - - DM_DEVICE_CLEAR, - - DM_DEVICE_MKNODES -}; - -struct dm_task; - -struct dm_task *dm_task_create(int type); -void dm_task_destroy(struct dm_task *dmt); - -int dm_task_set_name(struct dm_task *dmt, const char *name); -int dm_task_set_uuid(struct dm_task *dmt, const char *uuid); - -/* - * Retrieve attributes after an info. - */ -struct dm_info { - int exists; - int suspended; - int live_table; - int inactive_table; - int32_t open_count; - uint32_t event_nr; - uint32_t major; - uint32_t minor; /* minor device number */ - int read_only; /* 0:read-write; 1:read-only */ - - int32_t target_count; -}; - -struct dm_deps { - uint32_t count; - uint32_t filler; - uint64_t device[0]; -}; - -struct dm_names { - uint64_t dev; - uint32_t next; /* Offset to next struct from start of this struct */ - char name[0]; -}; - -int dm_get_library_version(char *version, size_t size); -int dm_task_get_driver_version(struct dm_task *dmt, char *version, size_t size); -int dm_task_get_info(struct dm_task *dmt, struct dm_info *dmi); -const char *dm_task_get_name(struct dm_task *dmt); -const char *dm_task_get_uuid(struct dm_task *dmt); - -struct dm_deps *dm_task_get_deps(struct dm_task *dmt); -struct dm_names *dm_task_get_names(struct dm_task *dmt); - -int dm_task_set_ro(struct dm_task *dmt); -int dm_task_set_newname(struct dm_task *dmt, const char *newname); -int dm_task_set_minor(struct dm_task *dmt, int minor); -int dm_task_set_major(struct dm_task *dmt, int major); -int dm_task_set_event_nr(struct dm_task *dmt, uint32_t event_nr); - -/* - * Use these to prepare for a create or reload. - */ -int dm_task_add_target(struct dm_task *dmt, - uint64_t start, - uint64_t size, const char *ttype, const char *params); - -/* - * Format major/minor numbers correctly for input to driver - */ -int dm_format_dev(char *buf, int bufsize, uint32_t dev_major, uint32_t dev_minor); - -/* Use this to retrive target information returned from a STATUS call */ -void *dm_get_next_target(struct dm_task *dmt, - void *next, uint64_t *start, uint64_t *length, - char **target_type, char **params); - -/* - * Call this to actually run the ioctl. - */ -int dm_task_run(struct dm_task *dmt); - -/* - * Configure the device-mapper directory - */ -int dm_set_dev_dir(const char *dir); -const char *dm_dir(void); - -/* Release library resources */ -void dm_lib_release(void); -void dm_lib_exit(void); - -#endif /* LIB_DEVICE_MAPPER_H */ diff --git a/extras/multipath-tools/libdevmapper/libdm-common.c b/extras/multipath-tools/libdevmapper/libdm-common.c deleted file mode 100644 index b0affd1eed..0000000000 --- a/extras/multipath-tools/libdevmapper/libdm-common.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#include "libdm-targets.h" -#include "libdm-common.h" -#include "list.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEV_DIR "/dev/" - -static char _dm_dir[PATH_MAX] = DEV_DIR DM_DIR; - -static int _verbose = 0; - -/* - * Library users can provide their own logging - * function. - */ -static void _default_log(int level, const char *file, int line, - const char *f, ...) -{ - va_list ap; - - if (level > _LOG_WARN && !_verbose) - return; - - va_start(ap, f); - - if (level < _LOG_WARN) - vfprintf(stderr, f, ap); - else - vprintf(f, ap); - - va_end(ap); - - if (level < _LOG_WARN) - fprintf(stderr, "\n"); - else - fprintf(stdout, "\n"); -} - -dm_log_fn _log = _default_log; - -void dm_log_init(dm_log_fn fn) -{ - _log = fn; -} - -void dm_log_init_verbose(int level) -{ - _verbose = level; -} - -static void _build_dev_path(char *buffer, size_t len, const char *dev_name) -{ - /* If there's a /, assume caller knows what they're doing */ - if (strchr(dev_name, '/')) - snprintf(buffer, len, "%s", dev_name); - else - snprintf(buffer, len, "%s/%s", _dm_dir, dev_name); -} - -int dm_get_library_version(char *version, size_t size) -{ - strncpy(version, DM_LIB_VERSION, size); - return 1; -} - -struct dm_task *dm_task_create(int type) -{ - struct dm_task *dmt = malloc(sizeof(*dmt)); - - if (!dm_check_version()) - return NULL; - - if (!dmt) { - log_error("dm_task_create: malloc(%d) failed", sizeof(*dmt)); - return NULL; - } - - memset(dmt, 0, sizeof(*dmt)); - - dmt->type = type; - dmt->minor = -1; - dmt->major = -1; - - return dmt; -} - -int dm_task_set_name(struct dm_task *dmt, const char *name) -{ - char *pos; - char path[PATH_MAX]; - struct stat st1, st2; - - if (dmt->dev_name) { - free(dmt->dev_name); - dmt->dev_name = NULL; - } - - /* If path was supplied, remove it if it points to the same device - * as its last component. - */ - if ((pos = strrchr(name, '/'))) { - snprintf(path, sizeof(path), "%s/%s", _dm_dir, pos + 1); - - if (stat(name, &st1) || stat(path, &st2) || - !(st1.st_dev == st2.st_dev)) { - log_error("dm_task_set_name: Device %s not found", - name); - return 0; - } - - name = pos + 1; - } - - if (!(dmt->dev_name = strdup(name))) { - log_error("dm_task_set_name: strdup(%s) failed", name); - return 0; - } - - return 1; -} - -int dm_task_set_uuid(struct dm_task *dmt, const char *uuid) -{ - if (dmt->uuid) { - free(dmt->uuid); - dmt->uuid = NULL; - } - - if (!(dmt->uuid = strdup(uuid))) { - log_error("dm_task_set_uuid: strdup(%s) failed", uuid); - return 0; - } - - return 1; -} - -int dm_task_set_major(struct dm_task *dmt, int major) -{ - dmt->major = major; - log_debug("Setting major: %d", dmt->major); - - return 1; -} - -int dm_task_set_minor(struct dm_task *dmt, int minor) -{ - dmt->minor = minor; - log_debug("Setting minor: %d", dmt->minor); - - return 1; -} - -int dm_task_add_target(struct dm_task *dmt, uint64_t start, uint64_t size, - const char *ttype, const char *params) -{ - struct target *t = create_target(start, size, ttype, params); - - if (!t) - return 0; - - if (!dmt->head) - dmt->head = dmt->tail = t; - else { - dmt->tail->next = t; - dmt->tail = t; - } - - return 1; -} - -static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor) -{ - char path[PATH_MAX]; - struct stat info; - dev_t dev = MKDEV(major, minor); - - _build_dev_path(path, sizeof(path), dev_name); - - if (stat(path, &info) >= 0) { - if (!S_ISBLK(info.st_mode)) { - log_error("A non-block device file at '%s' " - "is already present", path); - return 0; - } - - if (info.st_rdev == dev) - return 1; - - if (unlink(path) < 0) { - log_error("Unable to unlink device node for '%s'", - dev_name); - return 0; - } - } - - if (mknod(path, S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP, dev) < 0) { - log_error("Unable to make device node for '%s'", dev_name); - return 0; - } - - return 1; -} - -static int _rename_dev_node(const char *old_name, const char *new_name) -{ - char oldpath[PATH_MAX]; - char newpath[PATH_MAX]; - struct stat info; - - _build_dev_path(oldpath, sizeof(oldpath), old_name); - _build_dev_path(newpath, sizeof(newpath), new_name); - - if (stat(newpath, &info) == 0) { - if (!S_ISBLK(info.st_mode)) { - log_error("A non-block device file at '%s' " - "is already present", newpath); - return 0; - } - - if (unlink(newpath) < 0) { - if (errno == EPERM) { - /* devfs, entry has already been renamed */ - return 1; - } - log_error("Unable to unlink device node for '%s'", - new_name); - return 0; - } - } - - if (rename(oldpath, newpath) < 0) { - log_error("Unable to rename device node from '%s' to '%s'", - old_name, new_name); - return 0; - } - - return 1; -} - -static int _rm_dev_node(const char *dev_name) -{ - char path[PATH_MAX]; - struct stat info; - - _build_dev_path(path, sizeof(path), dev_name); - - if (stat(path, &info) < 0) - return 1; - - if (unlink(path) < 0) { - log_error("Unable to unlink device node for '%s'", dev_name); - return 0; - } - - return 1; -} - -typedef enum { - NODE_ADD, - NODE_DEL, - NODE_RENAME -} node_op_t; - -static int _do_node_op(node_op_t type, const char *dev_name, uint32_t major, - uint32_t minor, const char *old_name) -{ - switch (type) { - case NODE_ADD: - return _add_dev_node(dev_name, major, minor); - case NODE_DEL: - return _rm_dev_node(dev_name); - case NODE_RENAME: - return _rename_dev_node(old_name, dev_name); - } - - return 1; -} - -static LIST_INIT(_node_ops); - -struct node_op_parms { - struct list list; - node_op_t type; - char *dev_name; - uint32_t major; - uint32_t minor; - char *old_name; - char names[0]; -}; - -static void _store_str(char **pos, char **ptr, const char *str) -{ - strcpy(*pos, str); - *ptr = *pos; - *pos += strlen(*ptr) + 1; -} - -static int _stack_node_op(node_op_t type, const char *dev_name, uint32_t major, - uint32_t minor, const char *old_name) -{ - struct node_op_parms *nop; - size_t len = strlen(dev_name) + strlen(old_name) + 2; - char *pos; - - if (!(nop = malloc(sizeof(*nop) + len))) { - log_error("Insufficient memory to stack mknod operation"); - return 0; - } - - pos = nop->names; - nop->type = type; - nop->major = major; - nop->minor = minor; - - _store_str(&pos, &nop->dev_name, dev_name); - _store_str(&pos, &nop->old_name, old_name); - - list_add(&_node_ops, &nop->list); - - return 1; -} - -static void _pop_node_ops(void) -{ - struct list *noph, *nopht; - struct node_op_parms *nop; - - list_iterate_safe(noph, nopht, &_node_ops) { - nop = list_item(noph, struct node_op_parms); - _do_node_op(nop->type, nop->dev_name, nop->major, nop->minor, - nop->old_name); - list_del(&nop->list); - free(nop); - } -} - -int add_dev_node(const char *dev_name, uint32_t major, uint32_t minor) -{ - return _stack_node_op(NODE_ADD, dev_name, major, minor, ""); -} - -int rename_dev_node(const char *old_name, const char *new_name) -{ - return _stack_node_op(NODE_RENAME, new_name, 0, 0, old_name); -} - -int rm_dev_node(const char *dev_name) -{ - return _stack_node_op(NODE_DEL, dev_name, 0, 0, ""); -} - -void update_devs(void) -{ - _pop_node_ops(); -} - -int dm_set_dev_dir(const char *dir) -{ - snprintf(_dm_dir, sizeof(_dm_dir), "%s%s", dir, DM_DIR); - return 1; -} - -const char *dm_dir(void) -{ - return _dm_dir; -} diff --git a/extras/multipath-tools/libdevmapper/libdm-common.h b/extras/multipath-tools/libdevmapper/libdm-common.h deleted file mode 100644 index 2b71242861..0000000000 --- a/extras/multipath-tools/libdevmapper/libdm-common.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software (UK) Limited. - * - * This file is released under the LGPL. - */ - -#ifndef LIB_DMCOMMON_H -#define LIB_DMCOMMON_H - -#include "libdevmapper.h" - -#define _LOG_DEBUG 7 -#define _LOG_INFO 6 -#define _LOG_NOTICE 5 -#define _LOG_WARN 4 -#define _LOG_ERR 3 -#define _LOG_FATAL 2 - -extern dm_log_fn _log; - -#define log_error(msg, x...) _log(_LOG_ERR, __FILE__, __LINE__, msg, ## x) -#define log_print(msg, x...) _log(_LOG_WARN, __FILE__, __LINE__, msg, ## x) -#define log_verbose(msg, x...) _log(_LOG_NOTICE, __FILE__, __LINE__, msg, ## x) -#define log_very_verbose(msg, x...) _log(_LOG_INFO, __FILE__, __LINE__, msg, ## x) -#define log_debug(msg, x...) _log(_LOG_DEBUG, __FILE__, __LINE__, msg, ## x) - -struct target *create_target(uint64_t start, - uint64_t len, - const char *type, const char *params); - -int add_dev_node(const char *dev_name, uint32_t minor, uint32_t major); -int rm_dev_node(const char *dev_name); -int rename_dev_node(const char *old_name, const char *new_name); -void update_devs(void); - -#define DM_LIB_VERSION "1.00.07-ioctl (2003-11-21)" - -#endif diff --git a/extras/multipath-tools/libdevmapper/list.h b/extras/multipath-tools/libdevmapper/list.h deleted file mode 100644 index df3d32aea8..0000000000 --- a/extras/multipath-tools/libdevmapper/list.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2001 Sistina Software - * - * This file is released under the LGPL. - */ - -#ifndef _LVM_LIST_H -#define _LVM_LIST_H - -#include - -struct list { - struct list *n, *p; -}; - -#define LIST_INIT(name) struct list name = { &(name), &(name) } - -static inline void list_init(struct list *head) -{ - head->n = head->p = head; -} - -static inline void list_add(struct list *head, struct list *elem) -{ - assert(head->n); - - elem->n = head; - elem->p = head->p; - - head->p->n = elem; - head->p = elem; -} - -static inline void list_add_h(struct list *head, struct list *elem) -{ - assert(head->n); - - elem->n = head->n; - elem->p = head; - - head->n->p = elem; - head->n = elem; -} - -static inline void list_del(struct list *elem) -{ - elem->n->p = elem->p; - elem->p->n = elem->n; -} - -static inline int list_empty(struct list *head) -{ - return head->n == head; -} - -static inline int list_end(struct list *head, struct list *elem) -{ - return elem->n == head; -} - -static inline struct list *list_next(struct list *head, struct list *elem) -{ - return (list_end(head, elem) ? NULL : elem->n); -} - -#define list_iterate(v, head) \ - for (v = (head)->n; v != head; v = v->n) - -#define list_uniterate(v, head, start) \ - for (v = (start)->p; v != head; v = v->p) - -#define list_iterate_safe(v, t, head) \ - for (v = (head)->n, t = v->n; v != head; v = t, t = v->n) - -static inline unsigned int list_size(const struct list *head) -{ - unsigned int s = 0; - const struct list *v; - - list_iterate(v, head) - s++; - - return s; -} - -#define list_item(v, t) \ - ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->list)) - -#define list_struct_base(v, t, h) \ - ((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->h)) - -/* Given a known element in a known structure, locate another */ -#define struct_field(v, t, e, f) \ - (((t *)((uintptr_t)(v) - (uintptr_t)&((t *) 0)->e))->f) - -/* Given a known element in a known structure, locate the list head */ -#define list_head(v, t, e) struct_field(v, t, e, list) - -#endif diff --git a/extras/multipath-tools/multipath/Makefile b/extras/multipath-tools/multipath/Makefile deleted file mode 100644 index 4c0fae6d32..0000000000 --- a/extras/multipath-tools/multipath/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# Makefile -# -# Copyright (C) 2003 Christophe Varoqui, - -EXEC = multipath - -prefix = -exec_prefix = ${prefix} -bindir = ${exec_prefix}/sbin -udevdir = ../../.. -klibcdir = $(udevdir)/klibc -sysfsdir = $(udevdir)/libsysfs -mandir = /usr/share/man/man8 -libdmdir = ../libdevmapper -arch = i386 -klibcarch = $(klibcdir)/klibc/arch/$(arch)/include - -CC = gcc -GZIP = /bin/gzip -9 -c - -GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} -KERNEL_DIR = /lib/modules/${shell uname -r}/build -CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \ - -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \ - -I$(GCCINCDIR) -I$(KERNEL_DIR)/include -I$(sysfsdir) -I. -I$(klibcarch) - -OBJS = devinfo.o main.o -CRT0 = $(klibcdir)/klibc/crt0.o -LIB = $(klibcdir)/klibc/libc.a -LIBGCC := $(shell $(CC) -print-libgcc-file-name ) - -DMOBJS = $(libdmdir)/libdm-common.o $(libdmdir)/ioctl/libdevmapper.o -SYSFSOBJS = $(sysfsdir)/dlist.o $(sysfsdir)/sysfs_bus.o \ - $(sysfsdir)/sysfs_class.o $(sysfsdir)/sysfs_device.o \ - $(sysfsdir)/sysfs_dir.o $(sysfsdir)/sysfs_driver.o \ - $(sysfsdir)/sysfs_utils.o - -$(EXEC): $(OBJS) - $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC) - strip $(EXEC) - $(GZIP) $(EXEC).8 > $(EXEC).8.gz - -clean: - rm -f core *.o $(EXEC) *.gz - -spotless: clean - -install: - install -d $(DESTDIR)$(bindir) - install -m 755 $(EXEC) $(DESTDIR)$(bindir)/ - install -d $(DESTDIR)/etc/hotplug.d/scsi/ - install -m 755 multipath.hotplug $(DESTDIR)/etc/hotplug.d/scsi/ - install -d $(DESTDIR)$(mandir) - install -m 644 multipath.8.gz $(DESTDIR)$(mandir) - -uninstall: - rm $(DESTDIR)/etc/hotplug.d/scsi/multipath.hotplug - rm $(DESTDIR)$(bindir)/$(EXEC) - rm $(DESTDIR)$(mandir)/multipath.8.gz - -# Code dependencies -main.o: main.c main.h sg_include.h devinfo.h diff --git a/extras/multipath-tools/multipath/devinfo.c b/extras/multipath-tools/multipath/devinfo.c deleted file mode 100644 index 21890621e0..0000000000 --- a/extras/multipath-tools/multipath/devinfo.c +++ /dev/null @@ -1,240 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "devinfo.h" -#include "sg_include.h" - -#define FILE_NAME_SIZE 255 - -void -basename(char * str1, char * str2) -{ - char *p = str1 + (strlen(str1) - 1); - - while (*--p != '/') - continue; - strcpy(str2, ++p); -} - -static int -do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, - void *resp, int mx_resp_len, int noisy) -{ - unsigned char inqCmdBlk[INQUIRY_CMDLEN] = - { INQUIRY_CMD, 0, 0, 0, 0, 0 }; - unsigned char sense_b[SENSE_BUFF_LEN]; - struct sg_io_hdr io_hdr; - - if (cmddt) - inqCmdBlk[1] |= 2; - if (evpd) - inqCmdBlk[1] |= 1; - inqCmdBlk[2] = (unsigned char) pg_op; - inqCmdBlk[4] = (unsigned char) mx_resp_len; - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof (inqCmdBlk); - io_hdr.mx_sb_len = sizeof (sense_b); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.dxfer_len = mx_resp_len; - io_hdr.dxferp = resp; - io_hdr.cmdp = inqCmdBlk; - io_hdr.sbp = sense_b; - io_hdr.timeout = DEF_TIMEOUT; - - if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) { - perror("SG_IO (inquiry) error"); - return -1; - } - - /* treat SG_ERR here to get rid of sg_err.[ch] */ - io_hdr.status &= 0x7e; - if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && - (0 == io_hdr.driver_status)) - return 0; - if ((SCSI_CHECK_CONDITION == io_hdr.status) || - (SCSI_COMMAND_TERMINATED == io_hdr.status) || - (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) { - if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) { - int sense_key; - unsigned char * sense_buffer = io_hdr.sbp; - if (sense_buffer[0] & 0x2) - sense_key = sense_buffer[1] & 0xf; - else - sense_key = sense_buffer[2] & 0xf; - if(RECOVERED_ERROR == sense_key) - return 0; - } - } - return -1; -} - -int -get_serial (char * str, char * devname) -{ - int fd; - int len; - char buff[MX_ALLOC_LEN + 1]; - - if ((fd = open(devname, O_RDONLY)) < 0) - return 0; - - if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { - len = buff[3]; - if (len > 0) { - memcpy(str, buff + 4, len); - buff[len] = '\0'; - } - close(fd); - return 1; - } - close(fd); - return 0; -} - -int -get_lun_strings(char * vendor_id, char * product_id, char * rev, char * devname) -{ - int fd; - char buff[36]; - char attr_path[FILE_NAME_SIZE]; - char sysfs_path[FILE_NAME_SIZE]; - char basedev[FILE_NAME_SIZE]; - - if (0 == sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { - /* sysfs style */ - basename(devname, basedev); - - sprintf(attr_path, "%s/block/%s/device/vendor", - sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, - vendor_id, 8)) return 0; - - sprintf(attr_path, "%s/block/%s/device/model", - sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, - product_id, 16)) return 0; - - sprintf(attr_path, "%s/block/%s/device/rev", - sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, - rev, 4)) return 0; - } else { - /* ioctl style */ - if ((fd = open(devname, O_RDONLY)) < 0) - return 0; - if (0 != do_inq(fd, 0, 0, 0, buff, 36, 1)) - return 0; - memcpy(vendor_id, &buff[8], 8); - memcpy(product_id, &buff[16], 16); - memcpy(rev, &buff[32], 4); - close(fd); - return 1; - } - return 0; -} - -static void -sprint_wwid(char * buff, const char * str) -{ - int i; - const char *p; - char *cursor; - unsigned char c; - - p = str; - cursor = buff; - for (i = 0; i <= WWID_SIZE / 2 - 1; i++) { - c = *p++; - sprintf(cursor, "%.2x", (int) (unsigned char) c); - cursor += 2; - } - buff[WWID_SIZE - 1] = '\0'; -} - -/* get EVPD page 0x83 off 8 */ -/* tested ok with StorageWorks */ -int -get_evpd_wwid(char * devname, char * wwid) -{ - int fd; - char buff[MX_ALLOC_LEN + 1]; - - if ((fd = open(devname, O_RDONLY)) < 0) - return 0; - - if (0 == do_inq(fd, 0, 1, 0x83, buff, MX_ALLOC_LEN, 1)) { - sprint_wwid(wwid, &buff[8]); - close(fd); - return 1; /* success */ - } - - close(fd); - return 0; /* not good */ -} - -long -get_disk_size (char * devname) { - long size; - int fd; - char attr_path[FILE_NAME_SIZE]; - char sysfs_path[FILE_NAME_SIZE]; - char buff[FILE_NAME_SIZE]; - char basedev[FILE_NAME_SIZE]; - - if (0 == sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { - basename(devname, basedev); - sprintf(attr_path, "%s/block/%s/size", - sysfs_path, basedev); - if (0 > sysfs_read_attribute_value(attr_path, buff, - FILE_NAME_SIZE * sizeof(char))) - return -1; - size = atoi(buff); - return size; - } else { - if ((fd = open(devname, O_RDONLY)) < 0) - return -1; - if(!ioctl(fd, BLKGETSIZE, &size)) - return size; - } - return -1; -} - -int -do_tur(char *dev) -{ - unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; - struct sg_io_hdr io_hdr; - unsigned char sense_buffer[32]; - int fd; - - fd = open(dev, O_RDONLY); - - if (fd < 0) - return 0; - - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof (turCmdBlk); - io_hdr.mx_sb_len = sizeof (sense_buffer); - io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; - io_hdr.sbp = sense_buffer; - io_hdr.timeout = 20000; - io_hdr.pack_id = 0; - - if (ioctl(fd, SG_IO, &io_hdr) < 0) { - close(fd); - return 0; - } - - close(fd); - - if (io_hdr.info & SG_INFO_OK_MASK) - return 0; - - return 1; -} diff --git a/extras/multipath-tools/multipath/devinfo.h b/extras/multipath-tools/multipath/devinfo.h deleted file mode 100644 index ee17aba923..0000000000 --- a/extras/multipath-tools/multipath/devinfo.h +++ /dev/null @@ -1,21 +0,0 @@ -#define INQUIRY_CMDLEN 6 -#define INQUIRY_CMD 0x12 -#define SENSE_BUFF_LEN 32 -#define DEF_TIMEOUT 60000 -#define RECOVERED_ERROR 0x01 -#define MX_ALLOC_LEN 255 -#define WWID_SIZE 33 -#define BLKGETSIZE _IO(0x12,96) -#define TUR_CMD_LEN 6 - -/* exerpt from "sg_err.h" */ -#define SCSI_CHECK_CONDITION 0x2 -#define SCSI_COMMAND_TERMINATED 0x22 -#define SG_ERR_DRIVER_SENSE 0x08 - -void basename (char *, char *); -int get_serial (char *, char *); -int get_lun_strings (char *, char *, char *, char *); -int get_evpd_wwid(char *, char *); -long get_disk_size (char *); -int do_tur (char *); diff --git a/extras/multipath-tools/multipath/main.c b/extras/multipath-tools/multipath/main.c deleted file mode 100644 index 8f06a8f94c..0000000000 --- a/extras/multipath-tools/multipath/main.c +++ /dev/null @@ -1,895 +0,0 @@ -/* - * Soft: multipath device mapper target autoconfig - * - * Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $ - * - * Author: Copyright (C) 2003 Christophe Varoqui - * - * 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. - * - * 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; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../libdevmapper/libdevmapper.h" -#include "main.h" -#include "devinfo.h" - -/* White list switch */ -static int -get_unique_id(struct path * mypath) -{ - int i; - static struct { - char * vendor; - char * product; - int iopolicy; - int (*getuid) (char *, char *); - } wlist[] = { - {"COMPAQ ", "HSV110 (C)COMPAQ", GROUP_BY_TUR, &get_evpd_wwid}, - {"COMPAQ ", "MSA1000 ", GROUP_BY_TUR, &get_evpd_wwid}, - {"COMPAQ ", "MSA1000 VOLUME ", GROUP_BY_TUR, &get_evpd_wwid}, - {"DEC ", "HSG80 ", GROUP_BY_TUR, &get_evpd_wwid}, - {"HP ", "HSV100 ", GROUP_BY_TUR, &get_evpd_wwid}, - {"HP ", "A6189A ", MULTIBUS, &get_evpd_wwid}, - {"HP ", "OPEN- ", MULTIBUS, &get_evpd_wwid}, - {"DDN ", "SAN DataDirector", MULTIBUS, &get_evpd_wwid}, - {"FSC ", "CentricStor ", MULTIBUS, &get_evpd_wwid}, - {"HITACHI ", "DF400 ", MULTIBUS, &get_evpd_wwid}, - {"HITACHI ", "DF500 ", MULTIBUS, &get_evpd_wwid}, - {"HITACHI ", "DF600 ", MULTIBUS, &get_evpd_wwid}, - {"IBM ", "ProFibre 4000R ", MULTIBUS, &get_evpd_wwid}, - {"SGI ", "TP9100 ", MULTIBUS, &get_evpd_wwid}, - {"SGI ", "TP9300 ", MULTIBUS, &get_evpd_wwid}, - {"SGI ", "TP9400 ", MULTIBUS, &get_evpd_wwid}, - {"SGI ", "TP9500 ", MULTIBUS, &get_evpd_wwid}, - {NULL, NULL, 0, NULL}, - }; - - for (i = 0; wlist[i].vendor; i++) { - if (strncmp(mypath->vendor_id, wlist[i].vendor, 8) == 0 && - strncmp(mypath->product_id, wlist[i].product, 16) == 0) { - mypath->iopolicy = wlist[i].iopolicy; - if (!wlist[i].getuid(mypath->sg_dev, mypath->wwid)) - return 0; - } - } - return 1; -} - -static int -sysfsdevice2devname (char *devname, char *device) -{ - char sysfs_path[FILE_NAME_SIZE]; - char block_path[FILE_NAME_SIZE]; - char link_path[FILE_NAME_SIZE]; - int r; - - if (sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { - fprintf(stderr, "[device] feature available with sysfs only\n"); - exit (1); - } - - sprintf(link_path, "%s%s/block", sysfs_path, device); - - r = sysfs_get_link(link_path, block_path, FILE_NAME_SIZE); - - if (r != 0) - return 1; - - sysfs_get_name_from_path(block_path, devname, FILE_NAME_SIZE); - - return 0; -} - - -static int -devt2devname (char *devname, int major, int minor) -{ - struct sysfs_directory * sdir; - struct sysfs_directory * devp; - char sysfs_path[FILE_NAME_SIZE]; - char block_path[FILE_NAME_SIZE]; - char attr_path[FILE_NAME_SIZE]; - char attr_value[16]; - char attr_ref_value[16]; - - if (sysfs_get_mnt_path(sysfs_path, FILE_NAME_SIZE)) { - fprintf(stderr, "-D feature available with sysfs only\n"); - exit (1); - } - - sprintf(attr_ref_value, "%i:%i\n", major, minor); - sprintf(block_path, "%s/block", sysfs_path); - sdir = sysfs_open_directory(block_path); - sysfs_read_directory(sdir); - - dlist_for_each_data(sdir->subdirs, devp, struct sysfs_directory) { - sprintf(attr_path, "%s/%s/dev", block_path, devp->name); - sysfs_read_attribute_value(attr_path, attr_value, 16); - - if (!strcmp(attr_value, attr_ref_value)) { - sprintf(attr_path, "%s/%s", block_path, devp->name); - sysfs_get_name_from_path(attr_path, devname, FILE_NAME_SIZE); - break; - } - } - - sysfs_close_directory(sdir); - - return 0; -} - -static int -blacklist (char * dev) { - int i; - static struct { - char * headstr; - int lengh; - } blist[] = { - {"cciss", 5}, - {"hd", 2}, - {"md", 2}, - {"dm", 2}, - {"sr", 2}, - {"scd", 3}, - {"ram", 3}, - {"raw", 3}, - {NULL, 0}, - }; - - for (i = 0; blist[i].lengh; i++) { - if (strncmp(dev, blist[i].headstr, blist[i].lengh) == 0) - return 1; - } - return 0; -} - -static int -devinfo (struct path *curpath) -{ - get_lun_strings(curpath->vendor_id, - curpath->product_id, - curpath->rev, - curpath->sg_dev); - get_serial(curpath->serial, curpath->sg_dev); - curpath->tur = do_tur(curpath->sg_dev); - if (!get_unique_id(curpath)) - return 1; - - return 0; -} - - -static int -get_all_paths_sysfs(struct env * conf, struct path * all_paths) -{ - int k=0; - struct sysfs_directory * sdir; - struct sysfs_directory * devp; - struct sysfs_link * linkp; - char refwwid[WWID_SIZE]; - char empty_buff[WWID_SIZE]; - char buff[FILE_NAME_SIZE]; - char path[FILE_NAME_SIZE]; - struct path curpath; - - memset(empty_buff, 0, WWID_SIZE); - memset(refwwid, 0, WWID_SIZE); - - /* if called from hotplug, only consider the paths that relate - to the device pointed by conf.hotplugdev */ - - if (strncmp("/devices", conf->hotplugdev, 8) == 0) { - if (sysfsdevice2devname (buff, conf->hotplugdev)) - return 0; - - sprintf(curpath.sg_dev, "/dev/%s", buff); - - if (devinfo(&curpath)) - return 0; - - strcpy(refwwid, curpath.wwid); - memset(&curpath, 0, sizeof(path)); - } - - /* if major/minor specified on the cmd line, - only consider affiliated paths */ - - if (conf->major >= 0 && conf->minor >= 0) { - if (devt2devname(buff, conf->major, conf->minor)) - return 0; - - sprintf(curpath.sg_dev, "/dev/%s", buff); - - if (devinfo(&curpath)) - return 0; - - strcpy(refwwid, curpath.wwid); - memset(&curpath, 0, sizeof(path)); - } - - - sprintf(path, "%s/block", conf->sysfs_path); - sdir = sysfs_open_directory(path); - sysfs_read_directory(sdir); - - dlist_for_each_data(sdir->subdirs, devp, struct sysfs_directory) { - if (blacklist(devp->name)) - continue; - - sysfs_read_directory(devp); - - if(devp->links == NULL) - continue; - - dlist_for_each_data(devp->links, linkp, struct sysfs_link) { - if (!strncmp(linkp->name, "device", 6)) - break; - } - - if (linkp == NULL) { - continue; - } - - basename(devp->path, buff); - sprintf(curpath.sg_dev, "/dev/%s", buff); - - if(devinfo(&curpath)) { - memset(&curpath, 0, sizeof(path)); - continue; - } - - if (memcmp(empty_buff, refwwid, WWID_SIZE) != 0 && - strncmp(curpath.wwid, refwwid, WWID_SIZE) != 0) { - memset(&curpath, 0, sizeof(path)); - continue; - } - - strcpy(all_paths[k].sg_dev, curpath.sg_dev); - strcpy(all_paths[k].dev, curpath.sg_dev); - strcpy(all_paths[k].wwid, curpath.wwid); - strcpy(all_paths[k].vendor_id, curpath.vendor_id); - strcpy(all_paths[k].product_id, curpath.product_id); - all_paths[k].iopolicy = curpath.iopolicy; - all_paths[k].tur = curpath.tur; - - /* done with curpath, zero for reuse */ - memset(&curpath, 0, sizeof(path)); - - basename(linkp->target, buff); - sscanf(buff, "%i:%i:%i:%i", - &all_paths[k].sg_id.host_no, - &all_paths[k].sg_id.channel, - &all_paths[k].sg_id.scsi_id, - &all_paths[k].sg_id.lun); - k++; - } - sysfs_close_directory(sdir); - return 0; -} - -static int -get_all_paths_nosysfs(struct env * conf, struct path * all_paths, - struct scsi_dev * all_scsi_ids) -{ - int k, i, fd; - char buff[FILE_NAME_SIZE]; - char file_name[FILE_NAME_SIZE]; - - for (k = 0; k < conf->max_devs; k++) { - strcpy(file_name, "/dev/sg"); - sprintf(buff, "%d", k); - strncat(file_name, buff, FILE_NAME_SIZE); - strcpy(all_paths[k].sg_dev, file_name); - - get_lun_strings(all_paths[k].vendor_id, - all_paths[k].product_id, - all_paths[k].rev, - all_paths[k].sg_dev); - get_serial(all_paths[k].serial, all_paths[k].sg_dev); - if (!get_unique_id(&all_paths[k])) - continue; - - if ((fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) - return 0; - - if (0 > ioctl(fd, SG_GET_SCSI_ID, &(all_paths[k].sg_id))) - printf("device %s failed on sg ioctl, skip\n", - file_name); - - close(fd); - - for (i = 0; i < conf->max_devs; i++) { - if ((all_paths[k].sg_id.host_no == - all_scsi_ids[i].host_no) - && (all_paths[k].sg_id.scsi_id == - (all_scsi_ids[i].scsi_id.dev_id & 0xff)) - && (all_paths[k].sg_id.lun == - ((all_scsi_ids[i].scsi_id.dev_id >> 8) & 0xff)) - && (all_paths[k].sg_id.channel == - ((all_scsi_ids[i].scsi_id. - dev_id >> 16) & 0xff))) { - strcpy(all_paths[k].dev, all_scsi_ids[i].dev); - break; - } - } - } - return 0; -} - -static int -get_all_scsi_ids(struct env * conf, struct scsi_dev * all_scsi_ids) -{ - int k, big, little, res, host_no, fd; - char buff[64]; - char fname[FILE_NAME_SIZE]; - struct scsi_idlun my_scsi_id; - - for (k = 0; k < conf->max_devs; k++) { - strcpy(fname, "/dev/sd"); - if (k < 26) { - buff[0] = 'a' + (char) k; - buff[1] = '\0'; - strcat(fname, buff); - } else if (k <= 255) { - /* assumes sequence goes x,y,z,aa,ab,ac etc */ - big = k / 26; - little = k - (26 * big); - big = big - 1; - - buff[0] = 'a' + (char) big; - buff[1] = 'a' + (char) little; - buff[2] = '\0'; - strcat(fname, buff); - } else - strcat(fname, "xxxx"); - - if ((fd = open(fname, O_RDONLY)) < 0) { - if (conf->verbose) - fprintf(stderr, "can't open %s. mknod ?", - fname); - continue; - } - - res = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &my_scsi_id); - if (res < 0) { - close(fd); - printf("Could not get scsi idlun\n"); - continue; - } - - res = ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &host_no); - if (res < 0) { - close(fd); - printf("Could not get host_no\n"); - continue; - } - - close(fd); - - strcpy(all_scsi_ids[k].dev, fname); - all_scsi_ids[k].scsi_id = my_scsi_id; - all_scsi_ids[k].host_no = host_no; - } - return 0; -} - -/* print_path style */ -#define ALL 0 -#define NOWWID 1 - -static void -print_path(struct path * all_paths, int k, int style) -{ - if (style != NOWWID) - printf("%s ", all_paths[k].wwid); - else - printf(" \\_"); - printf("(%i %i %i %i) ", - all_paths[k].sg_id.host_no, - all_paths[k].sg_id.channel, - all_paths[k].sg_id.scsi_id, all_paths[k].sg_id.lun); - if(0 != strcmp(all_paths[k].sg_dev, all_paths[k].dev)) - printf("%s ", all_paths[k].sg_dev); - printf("%s ", all_paths[k].dev); - printf("[%.16s]\n", all_paths[k].product_id); -} - -static void -print_all_path(struct env * conf, struct path * all_paths) -{ - int k; - char empty_buff[WWID_SIZE]; - - memset(empty_buff, 0, WWID_SIZE); - for (k = 0; k < conf->max_devs; k++) { - if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) - continue; - print_path(all_paths, k, ALL); - } -} - -static void -print_all_mp(struct path * all_paths, struct multipath * mp, int nmp) -{ - int k, i; - - for (k = 0; k <= nmp; k++) { - printf("%s\n", mp[k].wwid); - for (i = 0; i <= mp[k].npaths; i++) - print_path(all_paths, PINDEX(k,i), NOWWID); - } -} - -static int -coalesce_paths(struct env * conf, struct multipath * mp, - struct path * all_paths) -{ - int k, i, nmp, np, already_done; - char empty_buff[WWID_SIZE]; - - nmp = -1; - already_done = 0; - memset(empty_buff, 0, WWID_SIZE); - - for (k = 0; k < conf->max_devs - 1; k++) { - /* skip this path for some reason */ - - /* 1. if path has no unique id */ - if (memcmp(empty_buff, all_paths[k].wwid, WWID_SIZE) == 0) - continue; - - /* 2. if mp with this uid already instanciated */ - for (i = 0; i <= nmp; i++) { - if (0 == strcmp(mp[i].wwid, all_paths[k].wwid)) - already_done = 1; - } - if (already_done) { - already_done = 0; - continue; - } - - /* at this point, we know we really got a new mp */ - np = 0; - nmp++; - strcpy(mp[nmp].wwid, all_paths[k].wwid); - PINDEX(nmp,np) = k; - - if (mp[nmp].size == 0) - mp[nmp].size = get_disk_size(all_paths[k].dev); - - for (i = k + 1; i < conf->max_devs; i++) { - if (0 == strcmp(all_paths[k].wwid, all_paths[i].wwid)) { - np++; - PINDEX(nmp,np) = i; - mp[nmp].npaths = np; - } - } - } - return nmp; -} - -static void -group_by_tur(struct multipath * mp, struct path * all_paths, char * str) { - int left_path_count = 0; - int right_path_count = 0; - int i; - char left_path_buff[FILE_NAME_SIZE], right_path_buff[FILE_NAME_SIZE]; - char * left_path_buff_p = &left_path_buff[0]; - char * right_path_buff_p = &right_path_buff[0]; - - for (i = 0; i <= mp->npaths; i++) { - if (all_paths[mp->pindex[i]].tur) { - left_path_buff_p += sprintf(left_path_buff_p, " %s", all_paths[mp->pindex[i]].dev); - left_path_count++; - } else { - right_path_buff_p += sprintf(right_path_buff_p, " %s", all_paths[mp->pindex[i]].dev); - right_path_count++; - } - } - if (!left_path_count) - sprintf(str, " 1 round-robin %i 0 %s", right_path_count, right_path_buff); - else if (!right_path_count) - sprintf(str, " 1 round-robin %i 0 %s", left_path_count, left_path_buff); - else - sprintf(str, " 2 round-robin %i 0 %s round-robin %i 0 %s", - left_path_count, left_path_buff, - right_path_count, right_path_buff); -} - -static void -group_by_serial(struct multipath * mp, struct path * all_paths, char * str) { - int path_count, pg_count = 0; - int i, k; - int * bitmap; - char path_buff[FILE_NAME_SIZE]; - char pg_buff[FILE_NAME_SIZE]; - char * path_buff_p = &path_buff[0]; - char * pg_buff_p = &pg_buff[0]; - - /* init the bitmap */ - bitmap = malloc((mp->npaths + 1) * sizeof(int)); - memset(bitmap, 0, (mp->npaths + 1) * sizeof(int)); - - for (i = 0; i <= mp->npaths; i++) { - if (bitmap[i]) - continue; - - /* here, we really got a new pg */ - pg_count++; - path_count = 1; - memset(&path_buff, 0, FILE_NAME_SIZE * sizeof(char)); - path_buff_p = &path_buff[0]; - - path_buff_p += sprintf(path_buff_p, " %s", all_paths[mp->pindex[i]].dev); - bitmap[i] = 1; - - for (k = i + 1; k <= mp->npaths; k++) { - if (bitmap[k]) - continue; - if (0 == strcmp(all_paths[mp->pindex[i]].serial, - all_paths[mp->pindex[k]].serial)) { - path_buff_p += sprintf(path_buff_p, " %s", all_paths[mp->pindex[k]].dev); - bitmap[k] = 1; - path_count++; - } - } - pg_buff_p += sprintf(pg_buff_p, " round-robin %i 0%s", - path_count, path_buff); - } - sprintf(str, " %i%s", pg_count, pg_buff); - free(bitmap); -} - -static int -dm_simplecmd(int task, const char *name) { - int r = 0; - struct dm_task *dmt; - - if (!(dmt = dm_task_create(task))) - return 0; - - if (!dm_task_set_name(dmt, name)) - goto out; - - r = dm_task_run(dmt); - - out: - dm_task_destroy(dmt); - return r; -} - -static int -dm_addmap(int task, const char *name, const char *params, long size) { - struct dm_task *dmt; - - if (!(dmt = dm_task_create(task))) - return 0; - - if (!dm_task_set_name(dmt, name)) - goto addout; - - if (!dm_task_add_target(dmt, 0, size, DM_TARGET, params)) - goto addout; - - if (!dm_task_run(dmt)) - goto addout; - - addout: - dm_task_destroy(dmt); - return 1; -} - -static int -setup_map(struct env * conf, struct path * all_paths, - struct multipath * mp, int index, int op) -{ - char params[255]; - char * params_p; - int i, np; - - /* defaults for multipath target */ - char * dm_ps_name = "round-robin"; - int dm_ps_nr_args = 0; - - params_p = ¶ms[0]; - - np = 0; - for (i=0; i<=mp[index].npaths; i++) { - if (0 == all_paths[PINDEX(index,i)].sg_id.scsi_type) - np++; - } - - if (np < 1) - return 0; - - if ((all_paths[PINDEX(index,0)].iopolicy == MULTIBUS && - conf->iopolicy == -1) || conf->iopolicy == MULTIBUS) { - params_p += sprintf(params_p, " 1 %s %i %i", - dm_ps_name, np, dm_ps_nr_args); - - for (i=0; i<=mp[index].npaths; i++) { - if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) - continue; - params_p += sprintf(params_p, " %s", - all_paths[PINDEX(index,i)].dev); - } - } - - if ((all_paths[PINDEX(index,0)].iopolicy == FAILOVER && - conf->iopolicy == -1) || conf->iopolicy == FAILOVER) { - params_p += sprintf(params_p, " %i", mp[index].npaths + 1); - for (i=0; i<=mp[index].npaths; i++) { - if (0 != all_paths[PINDEX(index,i)].sg_id.scsi_type) - continue; - params_p += sprintf(params_p, " %s ", - dm_ps_name); - params_p += sprintf(params_p, "1 %i", - dm_ps_nr_args); - params_p += sprintf(params_p, " %s", - all_paths[PINDEX(index,i)].dev); - } - } - - if ((all_paths[PINDEX(index,0)].iopolicy == GROUP_BY_SERIAL && - conf->iopolicy == -1) || conf->iopolicy == GROUP_BY_SERIAL) { - group_by_serial(&mp[index], all_paths, params_p); - } - - if ((all_paths[PINDEX(index,0)].iopolicy == GROUP_BY_TUR && - conf->iopolicy == -1) || conf->iopolicy == GROUP_BY_TUR) { - group_by_tur(&mp[index], all_paths, params_p); - } - - if (mp[index].size < 0) - return 0; - - if (!conf->quiet) { - if (op == DM_DEVICE_RELOAD) - printf("U:"); - if (op == DM_DEVICE_CREATE) - printf("N:"); - printf("%s:0 %li %s %s\n", - mp[index].wwid, mp[index].size, DM_TARGET, params); - } - - if (op == DM_DEVICE_RELOAD) - dm_simplecmd(DM_DEVICE_SUSPEND, mp[index].wwid); - - dm_addmap(op, mp[index].wwid, params, mp[index].size); - - if (op == DM_DEVICE_RELOAD) - dm_simplecmd(DM_DEVICE_RESUME, mp[index].wwid); - - return 1; -} - -static int -map_present(char * str) -{ - int r = 0; - struct dm_task *dmt; - struct dm_names *names; - unsigned next = 0; - - if (!(dmt = dm_task_create(DM_DEVICE_LIST))) - return 0; - - if (!dm_task_run(dmt)) - goto out; - - if (!(names = dm_task_get_names(dmt))) - goto out; - - if (!names->dev) { - goto out; - } - - do { - if (0 == strcmp(names->name, str)) - r = 1; - next = names->next; - names = (void *) names + next; - } while (next); - - out: - dm_task_destroy(dmt); - return r; -} - -static void -signal_daemon (void) -{ - FILE *file; - pid_t pid; - char *buf; - - buf = malloc (8); - - file = fopen (PIDFILE, "r"); - - if (!file) { - fprintf(stderr, "cannot signal daemon, pidfile not found\n"); - return; - } - - buf = fgets (buf, 8, file); - fclose (file); - - pid = (pid_t) atol (buf); - free (buf); - - kill(pid, SIGHUP); -} - -static int -filepresent(char * run) { - struct stat buf; - - if(!stat(run, &buf)) - return 1; - return 0; -} - -static void -usage(char * progname) -{ - fprintf(stderr, VERSION_STRING); - fprintf(stderr, "Usage: %s [-v|-q] [-d] [-m max_devs]\n", - progname); - fprintf(stderr, " [-p failover|multibus|group_by_serial]\n" \ - " [device]\n" \ - "\n" \ - "\t-v\t\tverbose, print all paths and multipaths\n" \ - "\t-q\t\tquiet, no output at all\n" \ - "\t-d\t\tdry run, do not create or update devmaps\n" \ - "\t-m max_devs\tscan {max_devs} devices at most\n" \ - "\n" \ - "\t-p policy\tforce maps to specified policy :\n" \ - "\t failover\t\t- 1 path per priority group\n" \ - "\t multibus\t\t- all paths in 1 priority group\n" \ - "\t group_by_serial\t- 1 priority group per serial\n" \ - "\t group_by_tur\t\t- 1 priority group per TUR state\n" \ - "\n" \ - "\t-D maj min\tlimit scope to the device's multipath\n" \ - "\t\t\t(major minor device reference)\n" - "\tdevice\t\tlimit scope to the device's multipath\n" \ - "\t\t\t(hotplug-style $DEVPATH reference)\n" - ); - exit(1); -} - -int -main(int argc, char *argv[]) -{ - struct multipath * mp; - struct path * all_paths; - struct scsi_dev * all_scsi_ids; - struct env conf; - int i, k, nmp; - int try = 0; - - /* Don't run in parallel */ - while (filepresent(RUN) && try++ < MAXTRY) - usleep(100000); - - if (filepresent(RUN)) { - fprintf(stderr, "waited for to long. exiting\n"); - exit (1); - } - - /* Our turn */ - if (!open(RUN, O_CREAT)) { - fprintf(stderr, "can't create runfile\n"); - exit (1); - } - - /* Default behaviour */ - conf.max_devs = MAX_DEVS; - conf.dry_run = 0; /* 1 == Do not Create/Update devmaps */ - conf.verbose = 0; /* 1 == Print all_paths and mp */ - conf.quiet = 0; /* 1 == Do not even print devmaps */ - conf.iopolicy = -1; /* Apply the defaults in get_unique_id() */ - conf.major = -1; - conf.minor = -1; - - for (i = 1; i < argc; ++i) { - if (0 == strcmp("-v", argv[i])) { - if (conf.quiet == 1) - usage(argv[0]); - conf.verbose = 1; - } else if (0 == strcmp("-m", argv[i])) { - conf.max_devs = atoi(argv[++i]); - if (conf.max_devs < 2) - usage(argv[0]); - } else if (0 == strcmp("-D", argv[i])) { - conf.major = atoi(argv[++i]); - conf.minor = atoi(argv[++i]); - } else if (0 == strcmp("-q", argv[i])) { - if (conf.verbose == 1) - usage(argv[0]); - conf.quiet = 1; - } else if (0 == strcmp("-d", argv[i])) - conf.dry_run = 1; - else if (0 == strcmp("-p", argv[i])) { - i++; - if (!strcmp(argv[i], "failover")) - conf.iopolicy = FAILOVER; - if (!strcmp(argv[i], "multibus")) - conf.iopolicy = MULTIBUS; - if (!strcmp(argv[i], "group_by_serial")) - conf.iopolicy = GROUP_BY_SERIAL; - if (!strcmp(argv[i], "group_by_tur")) - conf.iopolicy = GROUP_BY_TUR; - } else if (*argv[i] == '-') { - fprintf(stderr, "Unknown switch: %s\n", argv[i]); - usage(argv[0]); - } else - strncpy(conf.hotplugdev, argv[i], FILE_NAME_SIZE); - } - - /* dynamic allocations */ - mp = malloc(conf.max_devs * sizeof(struct multipath)); - all_paths = malloc(conf.max_devs * sizeof(struct path)); - all_scsi_ids = malloc(conf.max_devs * sizeof(struct scsi_dev)); - if (mp == NULL || all_paths == NULL || all_scsi_ids == NULL) - exit(1); - - if (sysfs_get_mnt_path(conf.sysfs_path, FILE_NAME_SIZE)) { - get_all_scsi_ids(&conf, all_scsi_ids); - get_all_paths_nosysfs(&conf, all_paths, all_scsi_ids); - } else { - get_all_paths_sysfs(&conf, all_paths); - } - - nmp = coalesce_paths(&conf, mp, all_paths); - - if (conf.verbose) { - print_all_path(&conf, all_paths); - fprintf(stdout, "\n"); - print_all_mp(all_paths, mp, nmp); - fprintf(stdout, "\n"); - } - - if (conf.dry_run) - exit(0); - - for (k=0; k<=nmp; k++) { - if (map_present(mp[k].wwid)) { - setup_map(&conf, all_paths, mp, k, DM_DEVICE_RELOAD); - } else { - setup_map(&conf, all_paths, mp, k, DM_DEVICE_CREATE); - } - } - - /* signal multipathd that new devmaps may have come up */ - signal_daemon(); - - /* free allocs */ - free(mp); - free(all_paths); - free(all_scsi_ids); - - /* release runfile */ - unlink(RUN); - - exit(0); -} diff --git a/extras/multipath-tools/multipath/main.h b/extras/multipath-tools/multipath/main.h deleted file mode 100644 index ada7a7394b..0000000000 --- a/extras/multipath-tools/multipath/main.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Soft: Description here... - * - * Version: $Id: main.h,v 0.0.1 2003/09/18 15:13:38 cvaroqui Exp $ - * - * Author: Copyright (C) 2003 Christophe Varoqui - * - * 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. - * - * 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; either version - * 2 of the License, or (at your option) any later version. - */ - -#ifndef _MAIN_H -#define _MAIN_H - -/* local includes */ -#include "sg_include.h" - -/* exerpt from "sg_err.h" */ -#define SCSI_CHECK_CONDITION 0x2 -#define SCSI_COMMAND_TERMINATED 0x22 -#define SG_ERR_DRIVER_SENSE 0x08 - -/* exerpt from "scsi.h" */ -#define SCSI_IOCTL_GET_IDLUN 0x5382 -#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 - -/* global defs */ -#define WWID_SIZE 33 -#define SERIAL_SIZE 14 -#define MAX_DEVS 128 -#define MAX_MP MAX_DEVS / 2 -#define MAX_MP_PATHS MAX_DEVS / 4 -#define FILE_NAME_SIZE 256 -#define DEF_TIMEOUT 60000 -#define EBUFF_SZ 256 -#define TUR_CMD_LEN 6 -#define DM_TARGET "multipath" -#define PIDFILE "/var/run/multipathd.pid" -#define RUN "/var/run/multipath.run" -#define MAXTRY 50 - -/* Storage controlers cpabilities */ -#define FAILOVER 0 -#define MULTIBUS 1 -#define GROUP_BY_SERIAL 2 -#define GROUP_BY_TUR 4 - -#define PINDEX(x,y) mp[(x)].pindex[(y)] - -/* global types */ -struct scsi_idlun { - int dev_id; - int host_unique_id; - int host_no; -}; - -struct sg_id { - int host_no; - int channel; - int scsi_id; - int lun; - int scsi_type; - short h_cmd_per_lun; - short d_queue_depth; - int unused1; - int unused2; -}; - -struct scsi_dev { - char dev[FILE_NAME_SIZE]; - struct scsi_idlun scsi_id; - int host_no; -}; - -struct path { - char dev[FILE_NAME_SIZE]; - char sg_dev[FILE_NAME_SIZE]; - struct scsi_idlun scsi_id; - struct sg_id sg_id; - char wwid[WWID_SIZE]; - char vendor_id[8]; - char product_id[16]; - char rev[4]; - char serial[SERIAL_SIZE]; - int iopolicy; - int tur; -}; - -struct multipath { - char wwid[WWID_SIZE]; - int npaths; - long size; - int pindex[MAX_MP_PATHS]; -}; - -struct env { - int max_devs; - int verbose; - int quiet; - int dry_run; - int iopolicy; - int with_sysfs; - int major; - int minor; - char sysfs_path[FILE_NAME_SIZE]; - char hotplugdev[FILE_NAME_SIZE]; -}; - -/* Build version */ -#define PROG "multipath" - -#define VERSION_CODE 0x000012 -#define DATE_CODE 0x021504 - -#define MULTIPATH_VERSION(version) \ - (version >> 16) & 0xFF, \ - (version >> 8) & 0xFF, \ - version & 0xFF - -#define VERSION_STRING PROG" v%d.%d.%d (%.2d/%.2d, 20%.2d)\n", \ - MULTIPATH_VERSION(VERSION_CODE), \ - MULTIPATH_VERSION(DATE_CODE) - -#endif diff --git a/extras/multipath-tools/multipath/multipath.8 b/extras/multipath-tools/multipath/multipath.8 deleted file mode 100644 index 0856ca8dfc..0000000000 --- a/extras/multipath-tools/multipath/multipath.8 +++ /dev/null @@ -1,66 +0,0 @@ -.TH MULTIPATH 8 "February 2004" "" "Linux Administrator's Manual" -.SH NAME -multipath \- Device mapper target autoconfig -.SH SYNOPSIS -.B multipath -.RB [\| \-v | \-q \|] -.RB [\| \-d \|] -.RB [\| \-i\ \c -.IR int \|] -.RB [\| \-m\ \c -.IR max_devs \|] -.RB [\| \-p\ \c -.BR failover | multibus | group_by_serial \|] -.RB [\| device \|] -.SH DESCRIPTION -.B multipath -is used to detect multiple paths to devices for fail-over or performance reasons and coalesces them. -.SH OPTIONS -.TP -.B \-v -verbose, print all paths and multipaths -.TP -.B \-q -quiet, no output at all -.TP -.B \-d -dry run, do not create or update devmaps -.TP -.BI \-i " int" -multipath target param: polling interval -.TP -.BI \-m " max_devs" -scan -.I max_devs -devices at most -.TP -.BI \-D " major minor" -update only the devmap the path pointed by -.I major minor -is in -.TP -.BI \-p " policy" -force maps to specified policy: -.RS 1.2i -.TP 1.2i -.B failover -1 path per priority group -.TP -.B multibus -all paths in 1 priority group -.TP -.B group_by_serial -1 priority group per serial -.RE -.TP -.BI device -update only the devmap the path pointed by -.I device -is in -.SH "SEE ALSO" -.BR udev (8), -.BR dmsetup (8) -.BR hotplug (8) -.SH AUTHORS -.B multipath -was developed by Christophe Varoqui, and others. diff --git a/extras/multipath-tools/multipath/multipath.hotplug b/extras/multipath-tools/multipath/multipath.hotplug deleted file mode 100644 index 5c411d1edf..0000000000 --- a/extras/multipath-tools/multipath/multipath.hotplug +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -. /etc/hotplug/hotplug.functions - -# wait for sysfs -sleep 1 - -mesg `/sbin/multipath $DEVPATH` diff --git a/extras/multipath-tools/multipath/sg_err.h b/extras/multipath-tools/multipath/sg_err.h deleted file mode 100644 index ef57b5ce38..0000000000 --- a/extras/multipath-tools/multipath/sg_err.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef SG_ERR_H -#define SG_ERR_H - -/* Feel free to copy and modify this GPL-ed code into your applications. */ - -/* Version 0.90 (20030519) -*/ - - -/* Some of the following error/status codes are exchanged between the - various layers of the SCSI sub-system in Linux and should never - reach the user. They are placed here for completeness. What appears - here is copied from drivers/scsi/scsi.h which is not visible in - the user space. */ - -#ifndef SCSI_CHECK_CONDITION -/* Following are the "true" SCSI status codes. Linux has traditionally - used a 1 bit right and masked version of these. So now CHECK_CONDITION - and friends (in ) are deprecated. */ -#define SCSI_CHECK_CONDITION 0x2 -#define SCSI_CONDITION_MET 0x4 -#define SCSI_BUSY 0x8 -#define SCSI_IMMEDIATE 0x10 -#define SCSI_IMMEDIATE_CONDITION_MET 0x14 -#define SCSI_RESERVATION_CONFLICT 0x18 -#define SCSI_COMMAND_TERMINATED 0x22 -#define SCSI_TASK_SET_FULL 0x28 -#define SCSI_ACA_ACTIVE 0x30 -#define SCSI_TASK_ABORTED 0x40 -#endif - -/* The following are 'host_status' codes */ -#ifndef DID_OK -#define DID_OK 0x00 -#endif -#ifndef DID_NO_CONNECT -#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ -#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ -#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ -#define DID_BAD_TARGET 0x04 /* Bad target (id?) */ -#define DID_ABORT 0x05 /* Told to abort for some other reason */ -#define DID_PARITY 0x06 /* Parity error (on SCSI bus) */ -#define DID_ERROR 0x07 /* Internal error */ -#define DID_RESET 0x08 /* Reset by somebody */ -#define DID_BAD_INTR 0x09 /* Received an unexpected interrupt */ -#define DID_PASSTHROUGH 0x0a /* Force command past mid-level */ -#define DID_SOFT_ERROR 0x0b /* The low-level driver wants a retry */ -#endif - -/* These defines are to isolate applictaions from kernel define changes */ -#define SG_ERR_DID_OK DID_OK -#define SG_ERR_DID_NO_CONNECT DID_NO_CONNECT -#define SG_ERR_DID_BUS_BUSY DID_BUS_BUSY -#define SG_ERR_DID_TIME_OUT DID_TIME_OUT -#define SG_ERR_DID_BAD_TARGET DID_BAD_TARGET -#define SG_ERR_DID_ABORT DID_ABORT -#define SG_ERR_DID_PARITY DID_PARITY -#define SG_ERR_DID_ERROR DID_ERROR -#define SG_ERR_DID_RESET DID_RESET -#define SG_ERR_DID_BAD_INTR DID_BAD_INTR -#define SG_ERR_DID_PASSTHROUGH DID_PASSTHROUGH -#define SG_ERR_DID_SOFT_ERROR DID_SOFT_ERROR - -/* The following are 'driver_status' codes */ -#ifndef DRIVER_OK -#define DRIVER_OK 0x00 -#endif -#ifndef DRIVER_BUSY -#define DRIVER_BUSY 0x01 -#define DRIVER_SOFT 0x02 -#define DRIVER_MEDIA 0x03 -#define DRIVER_ERROR 0x04 -#define DRIVER_INVALID 0x05 -#define DRIVER_TIMEOUT 0x06 -#define DRIVER_HARD 0x07 -#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ - -/* Following "suggests" are "or-ed" with one of previous 8 entries */ -#define SUGGEST_RETRY 0x10 -#define SUGGEST_ABORT 0x20 -#define SUGGEST_REMAP 0x30 -#define SUGGEST_DIE 0x40 -#define SUGGEST_SENSE 0x80 -#define SUGGEST_IS_OK 0xff -#endif -#ifndef DRIVER_MASK -#define DRIVER_MASK 0x0f -#endif -#ifndef SUGGEST_MASK -#define SUGGEST_MASK 0xf0 -#endif - -/* These defines are to isolate applictaions from kernel define changes */ -#define SG_ERR_DRIVER_OK DRIVER_OK -#define SG_ERR_DRIVER_BUSY DRIVER_BUSY -#define SG_ERR_DRIVER_SOFT DRIVER_SOFT -#define SG_ERR_DRIVER_MEDIA DRIVER_MEDIA -#define SG_ERR_DRIVER_ERROR DRIVER_ERROR -#define SG_ERR_DRIVER_INVALID DRIVER_INVALID -#define SG_ERR_DRIVER_TIMEOUT DRIVER_TIMEOUT -#define SG_ERR_DRIVER_HARD DRIVER_HARD -#define SG_ERR_DRIVER_SENSE DRIVER_SENSE -#define SG_ERR_SUGGEST_RETRY SUGGEST_RETRY -#define SG_ERR_SUGGEST_ABORT SUGGEST_ABORT -#define SG_ERR_SUGGEST_REMAP SUGGEST_REMAP -#define SG_ERR_SUGGEST_DIE SUGGEST_DIE -#define SG_ERR_SUGGEST_SENSE SUGGEST_SENSE -#define SG_ERR_SUGGEST_IS_OK SUGGEST_IS_OK -#define SG_ERR_DRIVER_MASK DRIVER_MASK -#define SG_ERR_SUGGEST_MASK SUGGEST_MASK - - - -/* The following "print" functions send ACSII to stdout */ -extern void sg_print_command(const unsigned char * command); -extern void sg_print_sense(const char * leadin, - const unsigned char * sense_buffer, int sb_len); -extern void sg_print_status(int masked_status); -extern void sg_print_scsi_status(int scsi_status); -extern void sg_print_host_status(int host_status); -extern void sg_print_driver_status(int driver_status); - -/* sg_chk_n_print() returns 1 quietly if there are no errors/warnings - else it prints to standard output and returns 0. */ -extern int sg_chk_n_print(const char * leadin, int masked_status, - int host_status, int driver_status, - const unsigned char * sense_buffer, int sb_len); - -/* The following function declaration is for the sg version 3 driver. - Only version 3 sg_err.c defines it. */ -struct sg_io_hdr; -extern int sg_chk_n_print3(const char * leadin, struct sg_io_hdr * hp); - - -/* The following "category" function returns one of the following */ -#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ -#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ -#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ -#define SG_ERR_CAT_TIMEOUT 3 -#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ -#define SG_ERR_CAT_SENSE 98 /* Something else is in the sense buffer */ -#define SG_ERR_CAT_OTHER 99 /* Some other error/warning has occurred */ - -extern int sg_err_category(int masked_status, int host_status, - int driver_status, const unsigned char * sense_buffer, - int sb_len); - -extern int sg_err_category_new(int scsi_status, int host_status, - int driver_status, const unsigned char * sense_buffer, - int sb_len); - -/* The following function declaration is for the sg version 3 driver. - Only version 3 sg_err.c defines it. */ -extern int sg_err_category3(struct sg_io_hdr * hp); - -/* Returns length of SCSI command given the opcode (first byte) */ -extern int sg_get_command_size(unsigned char opcode); - -extern void sg_get_command_name(unsigned char opcode, int buff_len, - char * buff); - -#endif diff --git a/extras/multipath-tools/multipath/sg_include.h b/extras/multipath-tools/multipath/sg_include.h deleted file mode 100644 index 460506826e..0000000000 --- a/extras/multipath-tools/multipath/sg_include.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifdef SG_KERNEL_INCLUDES - #define __user - typedef unsigned char u8; - #include "/usr/src/linux/include/scsi/sg.h" - #include "/usr/src/linux/include/scsi/scsi.h" -#else - #ifdef SG_TRICK_GNU_INCLUDES - #include - #include - #else - #include - #endif -#endif - -/* - Getting the correct include files for the sg interface can be an ordeal. - In a perfect world, one would just write: - #include - #include - This would include the files found in the /usr/include/scsi directory. - Those files are maintained with the GNU library which may or may not - agree with the kernel and version of sg driver that is running. Any - many cases this will not matter. However in some it might, for example - glibc 2.1's include files match the sg driver found in the lk 2.2 - series. Hence if glibc 2.1 is used with lk 2.4 then the additional - sg v3 interface will not be visible. - If this is a problem then defining SG_KERNEL_INCLUDES will access the - kernel supplied header files (assuming they are in the normal place). - The GNU library maintainers and various kernel people don't like - this approach (but it does work). - The technique selected by defining SG_TRICK_GNU_INCLUDES worked (and - was used) prior to glibc 2.2 . Prior to that version /usr/include/linux - was a symbolic link to /usr/src/linux/include/linux . - - There are other approaches if this include "mixup" causes pain. These - would involve include files being copied or symbolic links being - introduced. - - Sorry about the inconvenience. Typically neither SG_KERNEL_INCLUDES - nor SG_TRICK_GNU_INCLUDES is defined. - - dpg 20010415, 20030522 -*/ diff --git a/extras/multipath-tools/multipath/unused.c b/extras/multipath-tools/multipath/unused.c deleted file mode 100644 index 08144cf717..0000000000 --- a/extras/multipath-tools/multipath/unused.c +++ /dev/null @@ -1,95 +0,0 @@ -static int -get_serial (int fd, char * str) -{ - char buff[MX_ALLOC_LEN + 1]; - int len; - - if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) { - len = buff[3]; - if (len > 0) { - memcpy(str, buff + 4, len); - buff[len] = '\0'; - } - return 1; - } - return 0; -} - -static int -do_tur(int fd) -{ - unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; - struct sg_io_hdr io_hdr; - unsigned char sense_buffer[32]; - - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof (turCmdBlk); - io_hdr.mx_sb_len = sizeof (sense_buffer); - io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; - io_hdr.sbp = sense_buffer; - io_hdr.timeout = 20000; - io_hdr.pack_id = 0; - if (ioctl(fd, SG_IO, &io_hdr) < 0) { - close(fd); - return 0; - } - if (io_hdr.info & SG_INFO_OK_MASK) { - return 0; - } - return 1; -} - -static int -del_map(char * str) { - struct dm_task *dmt; - - if (!(dmt = dm_task_create(DM_DEVICE_REMOVE))) - return 0; - if (!dm_task_set_name(dmt, str)) - goto delout; - if (!dm_task_run(dmt)) - goto delout; - - printf("Deleted device map : %s\n", str); - - delout: - dm_task_destroy(dmt); - return 1; -} - -get_table(const char * str) -{ - int r = 0; - struct dm_task *dmt; - void *next = NULL; - uint64_t start, length; - char *target_type = NULL; - char *params; - - if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) - return 0; - - if (!dm_task_set_name(dmt, str)) - goto out; - - if (!dm_task_run(dmt)) - goto out; - - do { - next = dm_get_next_target(dmt, next, &start, &length, - &target_type, ¶ms); - if (target_type) { - printf("%" PRIu64 " %" PRIu64 " %s %s\n", - start, length, target_type, params); - } - } while (next); - - r = 1; - - out: - dm_task_destroy(dmt); - return r; - -} diff --git a/extras/multipath-tools/multipathd/Makefile b/extras/multipath-tools/multipathd/Makefile deleted file mode 100644 index 82c77b8351..0000000000 --- a/extras/multipath-tools/multipathd/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -EXEC = multipathd - -CC = gcc -GZIP = /bin/gzip -9 -c - -bindir = /usr/bin -mandir = /usr/share/man/man8 -rcdir = /etc/init.d - -CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -DDEBUG=1 -LDFLAGS = -lpthread -ldevmapper -lsysfs - -OBJS = main.o devinfo.o checkers.o - -$(EXEC): $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o $(EXEC) - strip $(EXEC) - -install: - install -d $(bindir) - install -m 755 $(EXEC) $(bindir) - install -d $(rcdir) - install -m 755 multipathd.init $(rcdir)/$(EXEC) - -uninstall: - rm -f $(bindir)/$(EXEC) - rm -f $(rcdir)/$(EXEC) - -clean: - rm -f core *.o $(EXEC) *.gz - -spotless: clean diff --git a/extras/multipath-tools/multipathd/checkers.c b/extras/multipath-tools/multipathd/checkers.c deleted file mode 100644 index 7ad32b04e9..0000000000 --- a/extras/multipath-tools/multipathd/checkers.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include "sg_include.h" - -#define TUR_CMD_LEN 6 - -/* - * test IO functions : add yours here - * - * returns 0 : path gone valid - * returns 1 : path still failed - */ - -int readsector0 (char *devnode) -{ - int fd, r; - char buf; - - fd = open (devnode, O_RDONLY); - if (read (fd, &buf, 1) != 1) - r = 0; - else - r = 1; - - close (fd); - - return r; -} - -int tur(char *devnode) -{ - unsigned char turCmdBlk[TUR_CMD_LEN] = { 0x00, 0, 0, 0, 0, 0 }; - struct sg_io_hdr io_hdr; - unsigned char sense_buffer[32]; - int fd; - - fd = open (devnode, O_RDONLY); - - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof (turCmdBlk); - io_hdr.mx_sb_len = sizeof (sense_buffer); - io_hdr.dxfer_direction = SG_DXFER_NONE; - io_hdr.cmdp = turCmdBlk; - io_hdr.sbp = sense_buffer; - io_hdr.timeout = 20000; - io_hdr.pack_id = 0; - if (ioctl(fd, SG_IO, &io_hdr) < 0) { - close(fd); - return 0; - } - if (io_hdr.info & SG_INFO_OK_MASK) { - return 0; - } - return 1; -} diff --git a/extras/multipath-tools/multipathd/checkers.h b/extras/multipath-tools/multipathd/checkers.h deleted file mode 100644 index 057c319d1b..0000000000 --- a/extras/multipath-tools/multipathd/checkers.h +++ /dev/null @@ -1,2 +0,0 @@ -int readsector0 (char *); -int tur (char *); diff --git a/extras/multipath-tools/multipathd/devinfo.c b/extras/multipath-tools/multipathd/devinfo.c deleted file mode 100644 index 46505470f4..0000000000 --- a/extras/multipath-tools/multipathd/devinfo.c +++ /dev/null @@ -1,82 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "devinfo.h" -#include "sg_include.h" - -#define FILE_NAME_SIZE 255 - -static int -do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op, - void *resp, int mx_resp_len, int noisy) -{ - unsigned char inqCmdBlk[INQUIRY_CMDLEN] = - { INQUIRY_CMD, 0, 0, 0, 0, 0 }; - unsigned char sense_b[SENSE_BUFF_LEN]; - struct sg_io_hdr io_hdr; - - if (cmddt) - inqCmdBlk[1] |= 2; - if (evpd) - inqCmdBlk[1] |= 1; - inqCmdBlk[2] = (unsigned char) pg_op; - inqCmdBlk[4] = (unsigned char) mx_resp_len; - memset(&io_hdr, 0, sizeof (struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof (inqCmdBlk); - io_hdr.mx_sb_len = sizeof (sense_b); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.dxfer_len = mx_resp_len; - io_hdr.dxferp = resp; - io_hdr.cmdp = inqCmdBlk; - io_hdr.sbp = sense_b; - io_hdr.timeout = DEF_TIMEOUT; - - if (ioctl(sg_fd, SG_IO, &io_hdr) < 0) { - perror("SG_IO (inquiry) error"); - return -1; - } - - /* treat SG_ERR here to get rid of sg_err.[ch] */ - io_hdr.status &= 0x7e; - if ((0 == io_hdr.status) && (0 == io_hdr.host_status) && - (0 == io_hdr.driver_status)) - return 0; - if ((SCSI_CHECK_CONDITION == io_hdr.status) || - (SCSI_COMMAND_TERMINATED == io_hdr.status) || - (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) { - if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) { - int sense_key; - unsigned char * sense_buffer = io_hdr.sbp; - if (sense_buffer[0] & 0x2) - sense_key = sense_buffer[1] & 0xf; - else - sense_key = sense_buffer[2] & 0xf; - if(RECOVERED_ERROR == sense_key) - return 0; - } - } - return -1; -} - -int -get_lun_strings(char * vendor_id, char * product_id, char * rev, char * devname) -{ - int fd; - char buff[36]; - - /* ioctl style */ - if ((fd = open(devname, O_RDONLY)) < 0) - return 1; - if (0 != do_inq(fd, 0, 0, 0, buff, 36, 1)) - return 1; - memcpy(vendor_id, &buff[8], 8); - memcpy(product_id, &buff[16], 16); - memcpy(rev, &buff[32], 4); - close(fd); - - return 0; -} diff --git a/extras/multipath-tools/multipathd/devinfo.h b/extras/multipath-tools/multipathd/devinfo.h deleted file mode 100644 index 46b2894051..0000000000 --- a/extras/multipath-tools/multipathd/devinfo.h +++ /dev/null @@ -1,15 +0,0 @@ -#define INQUIRY_CMDLEN 6 -#define INQUIRY_CMD 0x12 -#define SENSE_BUFF_LEN 32 -#define DEF_TIMEOUT 60000 -#define RECOVERED_ERROR 0x01 -#define MX_ALLOC_LEN 255 -#define WWID_SIZE 33 -#define BLKGETSIZE _IO(0x12,96) - -/* exerpt from "sg_err.h" */ -#define SCSI_CHECK_CONDITION 0x2 -#define SCSI_COMMAND_TERMINATED 0x22 -#define SG_ERR_DRIVER_SENSE 0x08 - -int get_lun_strings (char *, char *, char *, char *); diff --git a/extras/multipath-tools/multipathd/main.c b/extras/multipath-tools/multipathd/main.c deleted file mode 100644 index 7b5ccfca23..0000000000 --- a/extras/multipath-tools/multipathd/main.c +++ /dev/null @@ -1,674 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "devinfo.h" -#include "checkers.h" - -#define CHECKINT 5 -#define MAXPATHS 2048 -#define FILENAMESIZE 256 -#define MAPNAMESIZE 64 -#define TARGETTYPESIZE 16 -#define PARAMSSIZE 2048 -#define MAXMAPS 512 - -#define MULTIPATH "/sbin/multipath" -#define PIDFILE "/var/run/multipathd.pid" - -#ifndef DEBUG -#define DEBUG 1 -#endif -#define LOG(x, y, z...) if (DEBUG >= x) syslog(x, y, ##z) - -struct path -{ - int major; - int minor; - char mapname[MAPNAMESIZE]; - int (*checkfn) (char *); -}; - -struct paths -{ - pthread_mutex_t *lock; - struct path *paths_h; -}; - -struct event_thread -{ - pthread_t *thread; - pthread_mutex_t *waiter_lock; - char mapname[MAPNAMESIZE]; -}; - -struct devmap -{ - char mapname[MAPNAMESIZE]; -}; - -/* global var */ -pthread_mutex_t *event_lock; -pthread_cond_t *event; - -int makenode (char *devnode, int major, int minor) -{ - dev_t dev; - - dev = makedev (major, minor); - unlink (devnode); - - return mknod(devnode, S_IFBLK | S_IRUSR | S_IWUSR, dev); -} - -int select_checkfn(struct path *path_p) -{ - char devnode[FILENAMESIZE]; - char vendor[8]; - char product[16]; - char rev[4]; - int i, r; - - /* default checkfn */ - path_p->checkfn = &readsector0; - - sprintf (devnode, "/tmp/.select.%i.%i", path_p->major, path_p->minor); - - r = makenode (devnode, path_p->major, path_p->minor); - - if (r < 0) { - LOG(2, "[select_checkfn] can not make node %s", devnode); - return r; - } - - r = get_lun_strings(vendor, product, rev, devnode); - - if (r) { - LOG(2, "[select_checkfn] can not get strings"); - return r; - } - - r = unlink (devnode); - - if (r < 0) { - LOG(2, "[select_checkfn] can not unlink %s", devnode); - return r; - } - - static struct { - char * vendor; - char * product; - int (*checkfn) (char *); - } wlist[] = { - {"COMPAQ ", "HSV110 (C)COMPAQ", &tur}, - {"COMPAQ ", "MSA1000 ", &tur}, - {"COMPAQ ", "MSA1000 VOLUME ", &tur}, - {"DEC ", "HSG80 ", &tur}, - {"HP ", "HSV100 ", &readsector0}, - {NULL, NULL, NULL}, - }; - - for (i = 0; wlist[i].vendor; i++) { - if (strncmp(vendor, wlist[i].vendor, 8) == 0 && - strncmp(product, wlist[i].product, 16) == 0) { - path_p->checkfn = wlist[i].checkfn; - } - } - - return 0; -} - -int get_devmaps (struct devmap *devmaps) -{ - struct devmap *devmaps_p; - struct dm_task *dmt, *dmt1; - struct dm_names *names = NULL; - unsigned next = 0; - void *nexttgt; - int r = 0; - long long start, length; - char *target_type = NULL; - char *params; - - memset (devmaps, 0, MAXMAPS * sizeof (struct devmap)); - - if (!(dmt = dm_task_create(DM_DEVICE_LIST))) { - r = 1; - goto out; - } - - if (!dm_task_run(dmt)) { - r = 1; - goto out; - } - - if (!(names = dm_task_get_names(dmt))) { - r = 1; - goto out; - } - - if (!names->dev) { - LOG (1, "[get_devmaps] no devmap found"); - goto out; - } - - devmaps_p = devmaps; - - do { - /* keep only multipath maps */ - - names = (void *) names + next; - nexttgt = NULL; - LOG (3, "[get_devmaps] iterate on devmap names : %s", names->name); - - LOG (3, "[get_devmaps] dm_task_create(DM_DEVICE_STATUS)"); - if (!(dmt1 = dm_task_create(DM_DEVICE_STATUS))) - goto out1; - - LOG (3, "[get_devmaps] dm_task_set_name(dmt1, names->name)"); - if (!dm_task_set_name(dmt1, names->name)) - goto out1; - - LOG (3, "[get_devmaps] dm_task_run(dmt1)"); - if (!dm_task_run(dmt1)) - goto out1; - LOG (3, "[get_devmaps] DM_DEVICE_STATUS ioctl done"); - do { - LOG (3, "[get_devmaps] iterate on devmap's targets"); - nexttgt = dm_get_next_target(dmt1, nexttgt, - &start, - &length, - &target_type, - ¶ms); - - - LOG (3, "[get_devmaps] test target_type existence"); - if (!target_type) - goto out1; - - LOG (3, "[get_devmaps] test target_type is multipath"); - if (!strncmp (target_type, "multipath", 9)) { - strcpy (devmaps_p->mapname, names->name); - devmaps_p++; - - /* test vector overflow */ - if (devmaps_p - devmaps >= MAXMAPS * sizeof (struct devmap)) { - LOG (1, "[get_devmaps] devmaps overflow"); - dm_task_destroy(dmt1); - r = 1; - goto out; - } - } - - } while (nexttgt); - -out1: - dm_task_destroy(dmt1); - next = names->next; - - } while (next); - -out: - dm_task_destroy(dmt); - - LOG (3, "[get_devmaps] done"); - return r; -} - -int checkpath (struct path *path_p) -{ - char devnode[FILENAMESIZE]; - int r; - - LOG (2, "[checkpath] checking path %i:%i", path_p->major, path_p->minor); - sprintf (devnode, "/tmp/.checker.%i.%i", path_p->major, path_p->minor); - - if (path_p->checkfn == NULL) { - LOG (1, "[checkpath] test function not set for path %i:%i", - path_p->major, path_p->minor); - return 1; - } - - r = makenode (devnode, path_p->major, path_p->minor); - - if (r < 0) { - LOG (2, "[checkpath] can not make node for %s", devnode); - return r; - } - - r = path_p->checkfn(devnode); - unlink (devnode); - - return r; -} - -int updatepaths (struct devmap *devmaps, struct paths *failedpaths) -{ - struct path *path_p; - struct devmap *devmaps_p; - void *next; - struct dm_task *dmt; - long long start, length; - char *target_type = NULL; - char *params, *p1, *p2; - char word[6]; - int i; - - path_p = failedpaths->paths_h; - - pthread_mutex_lock (failedpaths->lock); - memset (failedpaths->paths_h, 0, MAXPATHS * sizeof (struct path)); - - /* first pass */ - /* ask DM the failed path list */ - - devmaps_p = devmaps; - - while (*devmaps_p->mapname != 0x0) { - next = NULL; - - if (!(dmt = dm_task_create(DM_DEVICE_STATUS))) - break; - - if (!dm_task_set_name(dmt, devmaps_p->mapname)) - goto out; - - if (!dm_task_run(dmt)) - goto out; - - do { - next = dm_get_next_target(dmt, next, &start, &length, - &target_type, ¶ms); - - /* begin ugly parser */ - p1 = params; - p2 = params; - while (*p1) { - /* p2 lags at the begining of the word p1 parses */ - while (*p1 != ' ') { - /* if the current word is a path */ - if (*p1 == ':') { - /* p1 jumps to path state */ - while (*p1 != 'A' && *p1 != 'F') - p1++; - - /* store path info */ - - path_p->checkfn = NULL; - - i = 0; - memset (&word, 'O', 6 * sizeof (char)); - while (*p2 != ':') { - word[i++] = *p2; - p2++; - } - path_p->major = atoi (word); - - p2++; - i = 0; - memset (&word, 'O', 6 * sizeof (char)); - while (*p2 != ' ') { - word[i++] = *p2; - p2++; - } - path_p->minor = atoi (word); - - strcpy (path_p->mapname, devmaps_p->mapname); - - /* - * discard active paths - * don't trust the A status flag : double check - */ - if (*p1 == 'A' && - !select_checkfn (path_p) && - checkpath (path_p)) { - LOG(2, "[updatepaths] discard %i:%i as valid path", - path_p->major, path_p->minor); - p1++; - memset (path_p, 0, sizeof(struct path)); - continue; - } - - path_p++; - - /* test vector overflow */ - if (path_p - failedpaths->paths_h >= MAXPATHS * sizeof (struct path)) { - LOG (1, "[updatepaths] path_h overflow"); - pthread_mutex_unlock (failedpaths->lock); - return 1; - } - } - p1++; - } - p2 = p1; - p1++; - } - } while (next); - -out: - dm_task_destroy(dmt); - devmaps_p++; - - } - - pthread_mutex_unlock (failedpaths->lock); - return 0; -} - -int geteventnr (char *name) -{ - struct dm_task *dmt; - struct dm_info info; - - if (!(dmt = dm_task_create(DM_DEVICE_INFO))) - return 0; - - if (!dm_task_set_name(dmt, name)) - goto out; - - if (!dm_task_run(dmt)) - goto out; - - if (!dm_task_get_info(dmt, &info)) - return 0; - - if (!info.exists) { - LOG(1, "Device %s does not exist", name); - return 0; - } - -out: - dm_task_destroy(dmt); - - return info.event_nr; -} - -void *waitevent (void * et) -{ - int event_nr; - struct event_thread *waiter; - - waiter = (struct event_thread *)et; - pthread_mutex_lock (waiter->waiter_lock); - - event_nr = geteventnr (waiter->mapname); - - struct dm_task *dmt; - - if (!(dmt = dm_task_create(DM_DEVICE_WAITEVENT))) - return 0; - - if (!dm_task_set_name(dmt, waiter->mapname)) - goto out; - - if (event_nr && !dm_task_set_event_nr(dmt, event_nr)) - goto out; - - dm_task_run(dmt); - -out: - dm_task_destroy(dmt); - - /* tell waiterloop we have an event */ - pthread_mutex_lock (event_lock); - pthread_cond_signal(event); - pthread_mutex_unlock (event_lock); - - /* release waiter_lock so that waiterloop knows we are gone */ - pthread_mutex_unlock (waiter->waiter_lock); - pthread_exit(waiter->thread); - - return (NULL); -} - -void *waiterloop (void *ap) -{ - struct paths *failedpaths; - struct devmap *devmaps, *devmaps_p; - struct event_thread *waiters, *waiters_p; - int r; - - /* inits */ - failedpaths = (struct paths *)ap; - devmaps = malloc (MAXMAPS * sizeof (struct devmap)); - waiters = malloc (MAXMAPS * sizeof (struct event_thread)); - memset (waiters, 0, MAXMAPS * sizeof (struct event_thread)); - - while (1) { - - /* update devmap list */ - LOG (1, "[event thread] refresh devmaps list"); - get_devmaps (devmaps); - - /* update failed paths list */ - LOG (1, "[event thread] refresh failpaths list"); - updatepaths (devmaps, failedpaths); - - /* start waiters on all devmaps */ - LOG (1, "[event thread] start up event loops"); - waiters_p = waiters; - devmaps_p = devmaps; - - while (*devmaps_p->mapname != 0x0) { - - /* find out if devmap already has a running waiter thread */ - while (*waiters_p->mapname != 0x0) { - if (!strcmp (waiters_p->mapname, devmaps_p->mapname)) - break; - waiters_p++; - } - - /* no event_thread struct : init it */ - if (*waiters_p->mapname == 0x0) { - strcpy (waiters_p->mapname, devmaps_p->mapname); - waiters_p->thread = malloc (sizeof (pthread_t)); - waiters_p->waiter_lock = (pthread_mutex_t *) malloc (sizeof (pthread_mutex_t)); - pthread_mutex_init (waiters_p->waiter_lock, NULL); - } - - /* event_thread struct found */ - if (*waiters_p->mapname != 0x0) { - r = pthread_mutex_trylock (waiters_p->waiter_lock); - /* thread already running : out */ - - if (r) - goto out; - - pthread_mutex_unlock (waiters_p->waiter_lock); - } - - LOG (1, "[event thread] create event thread for %s", waiters_p->mapname); - pthread_create (waiters_p->thread, NULL, waitevent, waiters_p); -out: - waiters_p = waiters; - devmaps_p++; - } - - /* wait event condition */ - pthread_mutex_lock (event_lock); - pthread_cond_wait(event, event_lock); - pthread_mutex_unlock (event_lock); - - LOG (1, "[event thread] event caught"); - } - - return (NULL); -} - -void *checkerloop (void *ap) -{ - struct paths *failedpaths; - struct path *path_p; - char *cmdargs[4] = {MULTIPATH, "-D", NULL, NULL}; - char major[5]; - char minor[5]; - int status; - - failedpaths = (struct paths *)ap; - - LOG (1, "[checker thread] path checkers start up"); - - while (1) { - path_p = failedpaths->paths_h; - pthread_mutex_lock (failedpaths->lock); - LOG (2, "[checker thread] checking paths"); - while (path_p->major != 0) { - - if (checkpath (path_p)) { - LOG (1, "[checker thread] reconfigure %s\n", path_p->mapname); - snprintf (major, 5, "%i", path_p->major); - snprintf (minor, 5, "%i", path_p->minor); - cmdargs[2] = major; - cmdargs[3] = minor; - if (fork () == 0) - execve (cmdargs[0], cmdargs, NULL); - - wait (&status); - /* MULTIPATH will ask for failedpaths refresh (SIGHUP) */ - } - - path_p++; - - /* test vector overflow */ - if (path_p - failedpaths->paths_h >= MAXPATHS * sizeof (struct path)) { - LOG (1, "[checker thread] path_h overflow"); - pthread_mutex_unlock (failedpaths->lock); - return (NULL); - } - } - pthread_mutex_unlock (failedpaths->lock); - sleep(CHECKINT); - } - - return (NULL); -} - -struct paths *initpaths (void) -{ - struct paths *failedpaths; - - failedpaths = malloc (sizeof (struct paths)); - failedpaths->paths_h = malloc (MAXPATHS * sizeof (struct path)); - failedpaths->lock = (pthread_mutex_t *) malloc (sizeof (pthread_mutex_t)); - pthread_mutex_init (failedpaths->lock, NULL); - event = (pthread_cond_t *) malloc (sizeof (pthread_cond_t)); - pthread_cond_init (event, NULL); - event_lock = (pthread_mutex_t *) malloc (sizeof (pthread_mutex_t)); - pthread_mutex_init (event_lock, NULL); - - return (failedpaths); -} - -void pidfile (pid_t pid) -{ - FILE *file; - struct stat *buf; - - buf = malloc (sizeof (struct stat)); - - if (!stat (PIDFILE, buf)) { - LOG(1, "[master thread] already running : out"); - free (buf); - exit (1); - } - - umask (022); - pid = setsid (); - - if (pid < -1) { - LOG(1, "[master thread] setsid() error"); - exit (1); - } - - file = fopen (PIDFILE, "w"); - fprintf (file, "%d\n", pid); - fclose (file); - free (buf); -} - -void * -signal_set(int signo, void (*func) (int)) -{ - int r; - struct sigaction sig; - struct sigaction osig; - - sig.sa_handler = func; - sigemptyset(&sig.sa_mask); - sig.sa_flags = 0; - - r = sigaction(signo, &sig, &osig); - - if (r < 0) - return (SIG_ERR); - else - return (osig.sa_handler); -} - -void sighup (int sig) -{ - LOG (1, "[master thread] SIGHUP caught : refresh devmap list"); - - /* ask for failedpaths refresh */ - pthread_mutex_lock (event_lock); - pthread_cond_signal(event); - pthread_mutex_unlock (event_lock); -} - -void sigend (int sig) -{ - LOG (1, "[master thread] unlink pidfile"); - unlink (PIDFILE); - LOG (1, "[master thread] --------shut down-------"); - exit (0); -} - -void signal_init(void) -{ - signal_set(SIGHUP, sighup); - signal_set(SIGINT, sigend); - signal_set(SIGTERM, sigend); - signal_set(SIGKILL, sigend); -} - -int main (int argc, char *argv[]) -{ - pthread_t wait, check; - struct paths *failedpaths; - pid_t pid; - - pid = fork (); - - /* can't fork */ - if (pid < 0) - exit (1); - - /* let the parent die happy */ - if (pid > 0) - exit (0); - - /* child's play */ - openlog (argv[0], 0, LOG_DAEMON); - LOG (1, "[master thread] --------start up--------"); - - pidfile (pid); - signal_init (); - - failedpaths = initpaths (); - - pthread_create (&wait, NULL, waiterloop, failedpaths); - pthread_create (&check, NULL, checkerloop, failedpaths); - pthread_join (wait, NULL); - pthread_join (check, NULL); - - return 0; -} diff --git a/extras/multipath-tools/multipathd/multipathd.init b/extras/multipath-tools/multipathd/multipathd.init deleted file mode 100644 index 860b2b11db..0000000000 --- a/extras/multipath-tools/multipathd/multipathd.init +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -PATH=/bin:/usr/bin:/sbin:/usr/sbin -DAEMON=/usr/bin/multipathd -PIDFILE=/var/run/multipathd.pid - -test -x $DAEMON || exit 0 - -case "$1" in - start) - echo -n "Starting multipath daemon: multipathd" - if start-stop-daemon --quiet --stop --signal 0 --pidfile $PIDFILE --name multipathd - then - echo " already running." - exit - fi - /sbin/start-stop-daemon --start --quiet --exec $DAEMON - echo "." - ;; - stop) - echo -n "Stopping multipath daemon: multipathd" - if start-stop-daemon --quiet --stop --signal 0 --pidfile $PIDFILE --name multipathd - then - PID=`cat $PIDFILE` - start-stop-daemon --quiet --stop --exec $DAEMON --pidfile $PIDFILE --name multipathd - # Now we wait for it to die - while kill -0 $PID 2>/dev/null; do sleep 1; done - echo "." - else - echo " not running."; - fi - ;; - force-reload|restart) - $0 stop - $0 start - ;; - *) - echo "Usage: /etc/init.d/multipathd {start|stop|restart|force-reload}" - exit 1 -esac - -exit 0 diff --git a/extras/multipath-tools/multipathd/sg_include.h b/extras/multipath-tools/multipathd/sg_include.h deleted file mode 100644 index 460506826e..0000000000 --- a/extras/multipath-tools/multipathd/sg_include.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifdef SG_KERNEL_INCLUDES - #define __user - typedef unsigned char u8; - #include "/usr/src/linux/include/scsi/sg.h" - #include "/usr/src/linux/include/scsi/scsi.h" -#else - #ifdef SG_TRICK_GNU_INCLUDES - #include - #include - #else - #include - #endif -#endif - -/* - Getting the correct include files for the sg interface can be an ordeal. - In a perfect world, one would just write: - #include - #include - This would include the files found in the /usr/include/scsi directory. - Those files are maintained with the GNU library which may or may not - agree with the kernel and version of sg driver that is running. Any - many cases this will not matter. However in some it might, for example - glibc 2.1's include files match the sg driver found in the lk 2.2 - series. Hence if glibc 2.1 is used with lk 2.4 then the additional - sg v3 interface will not be visible. - If this is a problem then defining SG_KERNEL_INCLUDES will access the - kernel supplied header files (assuming they are in the normal place). - The GNU library maintainers and various kernel people don't like - this approach (but it does work). - The technique selected by defining SG_TRICK_GNU_INCLUDES worked (and - was used) prior to glibc 2.2 . Prior to that version /usr/include/linux - was a symbolic link to /usr/src/linux/include/linux . - - There are other approaches if this include "mixup" causes pain. These - would involve include files being copied or symbolic links being - introduced. - - Sorry about the inconvenience. Typically neither SG_KERNEL_INCLUDES - nor SG_TRICK_GNU_INCLUDES is defined. - - dpg 20010415, 20030522 -*/ -- cgit v1.2.3-54-g00ecf From f608f8ac16889ce0e7e800c7f11dacc558d097c1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 6 Oct 2004 23:20:39 -0700 Subject: [PATCH] fix problems using scsi_id with udevstart when udevstart was running we didn't set the environment and the subsystem argument for the callouts the dev.d/ scripts. Here is a fix, that sets that with every udevstart iteration, corrects argv[0] to be the basename() only not the whole path and adds a test for invoking callouts without arguments. --- namedev.c | 27 ++++++++++++++++----------- test/udev-test.pl | 9 +++++++++ udevstart.c | 21 ++++++++++++++++++--- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/namedev.c b/namedev.c index fe7dddaf55..3843d02869 100644 --- a/namedev.c +++ b/namedev.c @@ -412,7 +412,7 @@ static void fix_kernel_name(struct udevice *udev) } } -static int execute_program(char *path, char *value, int len) +static int execute_program(const char *path, char *value, int len) { int retval; int count; @@ -421,12 +421,12 @@ static int execute_program(char *path, char *value, int len) pid_t pid; char *pos; char arg[PROGRAM_SIZE]; - char *argv[sizeof(arg) / 2]; + char *argv[(PROGRAM_SIZE / 2) + 1]; int i; + strfieldcpy(arg, path); i = 0; if (strchr(path, ' ')) { - strfieldcpy(arg, path); pos = arg; while (pos != NULL) { if (pos[0] == '\'') { @@ -441,8 +441,19 @@ static int execute_program(char *path, char *value, int len) dbg("arg[%i] '%s'", i, argv[i]); i++; } + argv[i] = NULL; + dbg("execute '%s' with parsed arguments", arg); + } else { + argv[0] = arg; + argv[1] = main_argv[1]; + argv[2] = NULL; + dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); } - argv[i] = NULL; + + /* set basename() only */ + pos = strrchr(argv[0], '/'); + if (pos != NULL) + argv[0] = &pos[1]; retval = pipe(fds); if (retval != 0) { @@ -456,13 +467,7 @@ static int execute_program(char *path, char *value, int len) /* child */ /* dup2 write side of pipe to STDOUT */ dup2(fds[1], STDOUT_FILENO); - if (argv[0] != NULL) { - dbg("execute '%s' with given arguments", argv[0]); - retval = execv(argv[0], argv); - } else { - dbg("execute '%s' with main argument", path); - retval = execv(path, main_argv); - } + retval = execv(arg, argv); info(FIELD_PROGRAM " execution of '%s' failed", path); exit(1); diff --git a/test/udev-test.pl b/test/udev-test.pl index 590b551dfe..9e4e192c51 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -253,6 +253,15 @@ BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special--*", NAME="%c BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special-device-", NAME="%c-3-%n" BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special-devic", NAME="%c-4-%n" BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special-*", NAME="%c-%n" +EOF + }, + { + desc => "program result substitution (no argument should be subsystem)", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "subsys_block" , + conf => <path, first_list[i], strlen(first_list[i])) == 0) { - udev_add_device(loop_device->path, loop_device->subsys, NOFAKE); + add_device(loop_device->path, loop_device->subsys, NOFAKE); list_del(&loop_device->list); free(loop_device); break; @@ -116,14 +131,14 @@ static void exec_list(struct list_head *device_list) if (found) continue; - udev_add_device(loop_device->path, loop_device->subsys, NOFAKE); + add_device(loop_device->path, loop_device->subsys, NOFAKE); list_del(&loop_device->list); free(loop_device); } /* handle the rest of the devices left over, if any */ list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - udev_add_device(loop_device->path, loop_device->subsys, NOFAKE); + add_device(loop_device->path, loop_device->subsys, NOFAKE); list_del(&loop_device->list); free(loop_device); } -- cgit v1.2.3-54-g00ecf From 12901d995fe7c99af36148d8d596f967c6ad68a3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 6 Oct 2004 23:40:35 -0700 Subject: [PATCH] enable native tdb spinlocks on i386 platforms. also clean out some stuff in the makefile that was never getting used. --- Makefile | 18 +++++------------- tdb/spinlock.c | 3 ++- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 9405b25c5f..1b7c71c57c 100644 --- a/Makefile +++ b/Makefile @@ -107,19 +107,11 @@ OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2> # add -Wredundant-decls when libsysfs gets cleaned up WARNINGS := -Wall -# Some nice architecture specific optimizations -ifeq ($(strip $(TARGET_ARCH)),arm) - OPTIMIZATION+=-fstrict-aliasing -endif -ifeq ($(strip $(TARGET_ARCH)),i386) - OPTIMIZATION+=-march=i386 - OPTIMIZATION += ${shell if $(CC) -mpreferred-stack-boundary=2 -S -o /dev/null -xc \ - /dev/null >/dev/null 2>&1; then echo "-mpreferred-stack-boundary=2"; fi} - OPTIMIZATION += ${shell if $(CC) -malign-functions=0 -malign-jumps=0 -S -o /dev/null -xc \ - /dev/null >/dev/null 2>&1; then echo "-malign-functions=0 -malign-jumps=0"; fi} - CFLAGS+=-pipe -Dasmlinkage=__attribute__((regparm(0))) -else - CFLAGS+=-pipe -Dasmlinkage= +CFLAGS := -pipe -Dasmlinkage= + +# set up the proper tdb spinlock code if we can +ifeq ($(strip $(ARCH)),i386) + CFLAGS += -DUSE_SPINLOCKS -DINTEL_SPINLOCKS endif ifeq ($(strip $(USE_LOG)),true) diff --git a/tdb/spinlock.c b/tdb/spinlock.c index 50cd952c72..451617fade 100644 --- a/tdb/spinlock.c +++ b/tdb/spinlock.c @@ -21,7 +21,6 @@ #define STANDALONE #define TDB_DEBUG #define HAVE_MMAP 1 -#include "../udev.h" #if HAVE_CONFIG_H #include @@ -40,6 +39,8 @@ #include #include "tdb.h" #include "spinlock.h" +#include "../udev.h" +#include "../logging.h" #else #include "includes.h" -- cgit v1.2.3-54-g00ecf From e629ca3f499baae644deae8c151e86e052f02113 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 6 Oct 2004 23:45:30 -0700 Subject: [PATCH] wait_for_sysfs debug cleanup > Sorry, I left my debug code in. Oops, just realized it now. You've applied a older version and not the latest. Here is a new patch to catch up. --- Makefile | 4 +-- wait_for_sysfs.c | 98 ++++++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 72 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index 1b7c71c57c..0b635ffb25 100644 --- a/Makefile +++ b/Makefile @@ -399,7 +399,7 @@ install: install-initscript install-config install-man install-dev.d all $(INSTALL_PROGRAM) -D $(WAIT) $(DESTDIR)$(sbindir)/$(WAIT) - ln -f -s $(sbindir)/udev $(DESTDIR)$(sbindir)/$(STARTER) - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/10-udev.hotplug - - ln -f -s $(sbindir)/$(WAIT) $(DESTDIR)$(hotplugdir)/00-wait_for_sysfs.hotplug + - ln -f -s $(sbindir)/$(WAIT) $(DESTDIR)$(hotplugdir)/05-wait_for_sysfs.hotplug ifndef DESTDIR - killall udevd - rm -f $(udevdir)/.udev.tdb @@ -412,7 +412,7 @@ endif uninstall: uninstall-man uninstall-dev.d - rm $(hotplugdir)/10-udev.hotplug - - rm $(hotplugdir)/00-wait_for_sysfs.hotplug + - rm $(hotplugdir)/05-wait_for_sysfs.hotplug - rm $(configdir)/rules.d/50-udev.rules - rm $(configdir)/permissions.d/50-udev.permissions - rm $(configdir)/udev.conf diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index b9efcddf87..6275db23b1 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -1,7 +1,7 @@ /* * wait_for_sysfs.c - small program to delay the execution * of /etc/hotplug.d/ programs, until sysfs - * is populated by the kernel. Depending on + * is fully populated by the kernel. Depending on * the type of device, we wait for all expected * directories and then just exit. * @@ -49,6 +49,7 @@ void log_message(int level, const char *format, ...) #define WAIT_MAX_SECONDS 5 #define WAIT_LOOP_PER_SECOND 20 +/* wait for specific file to show up, normally the "dev"-file */ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev) { static struct class_file { @@ -56,8 +57,10 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev char *file; } class_files[] = { { .subsystem = "net", .file = "ifindex" }, + { .subsystem = "scsi_host", .file = "unique_id" }, + { .subsystem = "scsi_device", .file = NULL }, + { .subsystem = "pcmcia_socket", .file = "card_type" }, { .subsystem = "usb_host", .file = NULL }, - { .subsystem = "pcmcia_socket", .file = NULL }, { NULL, NULL } }; struct class_file *classfile; @@ -83,16 +86,17 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev dbg("class '%s' specific file '%s' found", class_dev->classname, file); return 0; } + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - dbg("error: getting bus '%s' specific file '%s'", class_dev->classname, file); + dbg("error: getting class '%s' specific file '%s'", class_dev->classname, file); return -1; } +/* skip waiting for physical device */ static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev) { - char **device; - static char *devices_without_link[] = { "nb", "ram", @@ -120,6 +124,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d "ttyS", NULL }; + char **device; for (device = devices_without_link; *device != NULL; device++) { int len = strlen(*device); @@ -140,6 +145,26 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d return 0; } +/* skip waiting for the bus */ +static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) +{ + static char *devices_without_bus[] = { + "scsi_host", + NULL + }; + char **device; + + for (device = devices_without_bus; *device != NULL; device++) { + int len = strlen(*device); + + if (strncmp(class_dev->classname, *device, len) == 0) + return 1; + } + + return 0; +} + +/* wait for the bus and for a bus specific file to show up */ static int wait_for_bus_device(struct sysfs_device *device_dev) { static struct bus_file { @@ -152,6 +177,7 @@ static int wait_for_bus_device(struct sysfs_device *device_dev) { .bus = "usb-serial", .file = "detach_state" }, { .bus = "ide", .file = "detach_state" }, { .bus = "pci", .file = "vendor" }, + { .bus = "platform", .file = "detach_state" }, { NULL } }; struct bus_file *busfile; @@ -174,19 +200,24 @@ static int wait_for_bus_device(struct sysfs_device *device_dev) /* wait for a bus specific file to show up */ loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { + int found = 0; + for (busfile = bus_files; busfile->bus != NULL; busfile++) { if (strcmp(device_dev->bus, busfile->bus) == 0) { + found = 1; dbg("looking at bus '%s' for specific file '%s'", device_dev->bus, busfile->file); if (sysfs_get_device_attr(device_dev, busfile->file) != NULL) { dbg("bus '%s' specific file '%s' found", device_dev->bus, busfile->file); return 0; } - if (busfile->bus == NULL) { - info("error: unknown bus, update the build-in list '%s'", device_dev->bus); - return -1; - } } } + if (found == 0) { + info("error: unknown bus, please report to " + " '%s'", device_dev->bus); + return -1; + } + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } dbg("error: getting bus '%s' specific file '%s'", device_dev->bus, busfile->file); @@ -206,6 +237,8 @@ int main(int argc, char *argv[], char *envp[]) int loop; int rc = 0; + init_logging("wait_for_sysfs"); + if (argc != 2) { dbg("error: subsystem"); return 1; @@ -224,6 +257,7 @@ int main(int argc, char *argv[], char *envp[]) return 1; } + /* we only wait on an add event */ if (strcmp(action, "add") != 0) return 0; @@ -242,20 +276,25 @@ int main(int argc, char *argv[], char *envp[]) class_dev = sysfs_open_class_device_path(filename); if (class_dev) break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } if (class_dev == NULL) { dbg("error: getting class_device"); - rc = 4; + rc = 3; goto exit; } dbg("class_device opened '%s'", filename); - wait_for_class_device_attributes(class_dev); + if (wait_for_class_device_attributes(class_dev) != 0) { + rc = 4; + goto exit_class; + } + /* skip devices without /device-link */ if (class_device_expect_no_device_link(class_dev)) { - dbg("no device symlink expected"); - sysfs_close_class_device(class_dev); - goto exit; + dbg("no device symlink expected for '%s', ", class_dev->name); + goto exit_class; } /* the symlink may be on the parent device */ @@ -279,19 +318,21 @@ int main(int argc, char *argv[], char *envp[]) } if (device_dev == NULL) { dbg("error: getting /device-device"); - sysfs_close_class_device(class_dev); rc = 5; - goto exit; + goto exit_class; } dbg("device symlink found pointing to '%s'", device_dev->path); /* wait for the bus value */ - if (wait_for_bus_device(device_dev) != 0) - rc = 6; - sysfs_close_class_device(class_dev); + if (class_device_expect_no_bus(class_dev)) { + dbg("no bus device expected for '%s', ", class_dev->classname); + } else { + if (wait_for_bus_device(device_dev) != 0) + rc = 6; + } - /* finished */ - goto exit; +exit_class: + sysfs_close_class_device(class_dev); } else if ((strncmp(devpath, "/devices/", 9) == 0)) { /* open the path we are called for */ @@ -303,32 +344,33 @@ int main(int argc, char *argv[], char *envp[]) device_dev = sysfs_open_device_path(filename); if (device_dev) break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } if (device_dev == NULL) { dbg("error: getting /device-device"); - rc = 4; + rc = 7; goto exit; } dbg("device_device opened '%s'", filename); /* wait for the bus value */ if (wait_for_bus_device(device_dev) != 0) - rc = 9; + rc = 8; sysfs_close_device(device_dev); - /* finished */ - goto exit; - } else { dbg("unhandled sysfs path, no need to wait"); } exit: if (rc == 0) - info("result: waiting for sysfs successful '%s'", devpath); + dbg("result: waiting for sysfs successful '%s'", devpath); else - info("result: waiting for sysfs failed '%s'", devpath); + info("error: wait_for_sysfs needs an update to handle the device '%s' " + "properly, please report to ", + devpath); return rc; } -- cgit v1.2.3-54-g00ecf From e284ecba7646562da9ad4c3c22871f6c341960d4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 7 Oct 2004 00:11:04 -0700 Subject: [PATCH] add support for usb interfaces to wait_for_sysfs to keep it quiet. --- wait_for_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 6275db23b1..28ff43bdb5 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -174,6 +174,7 @@ static int wait_for_bus_device(struct sysfs_device *device_dev) { .bus = "scsi", .file = "vendor" }, { .bus = "usb", .file = "idVendor" }, { .bus = "usb", .file = "iInterface" }, + { .bus = "usb", .file = "bNumEndpoints" }, { .bus = "usb-serial", .file = "detach_state" }, { .bus = "ide", .file = "detach_state" }, { .bus = "pci", .file = "vendor" }, -- cgit v1.2.3-54-g00ecf From 1059b07a143fac796a4ae8a7235cab9665a7622e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 7 Oct 2004 00:17:11 -0700 Subject: [PATCH] fix problems with dev.d and udevstart Here is the correction for the dev.d/ scripts too. We should pass the right argv[0] here too. A script may depend on the right value, as udev does with udev/udevstart. Here is the old version: [pid 4692] execve("/etc/dev.d/default/log.dev", ["./udev", "block"], [/* 41 vars */]) = 0 this the new one: [pid 9832] execve("/etc/dev.d/default/log.dev", ["/etc/dev.d/default/log.dev", "block"], [/* 41 vars */]) = 0 --- dev_d.c | 8 +++++++- namedev.c | 5 ----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dev_d.c b/dev_d.c index c091f11c28..eaf9b1dc12 100644 --- a/dev_d.c +++ b/dev_d.c @@ -39,6 +39,7 @@ static int run_program(char *name) { pid_t pid; int fd; + char *argv[3]; dbg("running %s", name); @@ -54,7 +55,12 @@ static int run_program(char *name) dup2(fd, STDERR_FILENO); } close(fd); - execv(name, main_argv); + + argv[0] = name; + argv[1] = main_argv[1]; + argv[2] = NULL; + + execv(name, argv); dbg("exec of child failed"); exit(1); case -1: diff --git a/namedev.c b/namedev.c index 3843d02869..695fb55413 100644 --- a/namedev.c +++ b/namedev.c @@ -450,11 +450,6 @@ static int execute_program(const char *path, char *value, int len) dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); } - /* set basename() only */ - pos = strrchr(argv[0], '/'); - if (pos != NULL) - argv[0] = &pos[1]; - retval = pipe(fds); if (retval != 0) { dbg("pipe failed"); -- cgit v1.2.3-54-g00ecf From 5cb8eb82e01d01b16483ec59c8ab2d8a4100d807 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 7 Oct 2004 00:27:03 -0700 Subject: [PATCH] 033 release --- ChangeLog | 43 +++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab1dfa54d9..ade31556b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,46 @@ +Summary of changes from v032 to v033 +============================================ + +: + o udev close on exec + o some cleanups and security fixes + o some cleanups and security fixes + o selinux for udev + o cleanup PATCH for extras/chassis_id/Makefile + +: + o respect prefix= setting in built udev.conf (updated) + +Greg Kroah-Hartman: + o add support for usb interfaces to wait_for_sysfs to keep it quiet + o enable native tdb spinlocks on i386 platforms + o delete extras/multipath-tools as per the author's request + o be paranoid in dev_d.c + o add USE_SELINUX to README documentation so people have a chance to see what is going on + o update the selinux.h file to start to look sane + o update bk ignore list for the wait_for_sysfs binary + o kdetv wants to see device nodes in /dev + o update comments in scsi-devfs.sh + o fix up Makefiles to get the klibc build working properly + o update bk ignore list for new klibc generated files + o oops forgot to add the new klibc/include directory + o update klibc to version 0.181 + +Kay Sievers: + o fix problems with dev.d and udevstart + o wait_for_sysfs debug cleanup + o fix problems using scsi_id with udevstart + o update volume_id + o finally solve the bad sysfs-timing for all of us + o volume-id build fix and update + o switch udev's seqnum to u64 + o add enum tests + o fix udev segfaults with bad permissions file + +Patrick Mansfield: + o update udev to include scsi_id 0.6 + + Summary of changes from v031 to v032 ============================================ diff --git a/Makefile b/Makefile index 0b635ffb25..5ff74b4afe 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ TESTER = udevtest STARTER = udevstart RULER = udevruler WAIT = wait_for_sysfs -VERSION = 032_bk +VERSION = 033 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 193befca6c..e145ad2431 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 032 +Version: 033 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 90852564d01bb7d2835b159ba2e572dad1afb37d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 7 Oct 2004 01:34:31 -0700 Subject: [PATCH] wait_for_sysfs bluetooth class update Here is the file to wait for the bluetooth class, as it is not a "dev" file. udev waits for 10 seconds here too. --- wait_for_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 28ff43bdb5..0881b619c7 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -61,6 +61,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev { .subsystem = "scsi_device", .file = NULL }, { .subsystem = "pcmcia_socket", .file = "card_type" }, { .subsystem = "usb_host", .file = NULL }, + { .subsystem = "bluetooth", .file = "address" }, { NULL, NULL } }; struct class_file *classfile; -- cgit v1.2.3-54-g00ecf From 1a13fcb3dd814107d20ff2d26659cb2d6e63b354 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 7 Oct 2004 18:43:31 -0700 Subject: [PATCH] add support for i2c-adapter devices to wait_for_sysfs.c --- wait_for_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 0881b619c7..5e8874cf7c 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -62,6 +62,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev { .subsystem = "pcmcia_socket", .file = "card_type" }, { .subsystem = "usb_host", .file = NULL }, { .subsystem = "bluetooth", .file = "address" }, + { .subsystem = "i2c-adapter", .file = NULL }, { NULL, NULL } }; struct class_file *classfile; @@ -151,6 +152,7 @@ static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) { static char *devices_without_bus[] = { "scsi_host", + "i2c-adapter", NULL }; char **device; -- cgit v1.2.3-54-g00ecf From 606397db856af2b66947daed4a4a927c37951fe8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 7 Oct 2004 19:12:10 -0700 Subject: [PATCH] added support for i2c devices in wait_for_sysfs.c --- wait_for_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 5e8874cf7c..16ee50e4a7 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -182,6 +182,7 @@ static int wait_for_bus_device(struct sysfs_device *device_dev) { .bus = "ide", .file = "detach_state" }, { .bus = "pci", .file = "vendor" }, { .bus = "platform", .file = "detach_state" }, + { .bus = "i2c", .file = "detach_state" }, { NULL } }; struct bus_file *busfile; -- cgit v1.2.3-54-g00ecf From b19e47764c5a5baf4bf7b0d19528f8f456b05d61 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 7 Oct 2004 20:56:08 -0700 Subject: [PATCH] get rid of annoying extra lines in the syslog for some libsysfs debug messages. --- libsysfs/sysfs_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 492c7fa668..f65e5df3aa 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -454,7 +454,7 @@ int sysfs_path_is_link(const char *path) return 1; } if ((lstat(path, &astats)) != 0) { - dprintf("stat() failed\n"); + dprintf("stat() failed"); return 1; } if (S_ISLNK(astats.st_mode)) @@ -477,7 +477,7 @@ int sysfs_path_is_file(const char *path) return 1; } if ((lstat(path, &astats)) != 0) { - dprintf("stat() failed\n"); + dprintf("stat() failed"); return 1; } if (S_ISREG(astats.st_mode)) -- cgit v1.2.3-54-g00ecf From b9b659ae606c8583b052d663c5858028848b1878 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 7 Oct 2004 21:06:07 -0700 Subject: [PATCH] wait_for_sysfs: clean up the logic for the list of devices that we do not expect device symlinks for This makes it a lot easier to test for these devices, otherwise the list would have gotten very large --- wait_for_sysfs.c | 97 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 38 deletions(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 16ee50e4a7..cb94b64404 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -99,49 +99,70 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev /* skip waiting for physical device */ static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev) { - static char *devices_without_link[] = { - "nb", - "ram", - "loop", - "fd", - "md", - "dos_cd", - "double", - "flash", - "msd", - "rflash", - "rom", - "rrom", - "sbpcd", - "pcd", - "pf", - "scd", - "sit", - "lp", - "ubd", - "vcs", - "vcsa", - "console", - "tty", - "ttyS", - NULL + /* List of devices without a "device" symlink */ + static struct class_device { + char *subsystem; + char *device; + } class_device[] = { + { .subsystem = "block", .device = "double" }, + { .subsystem = "block", .device = "nb" }, + { .subsystem = "block", .device = "ram" }, + { .subsystem = "block", .device = "loop" }, + { .subsystem = "block", .device = "fd" }, + { .subsystem = "block", .device = "md" }, + { .subsystem = "block", .device = "dos_cd" }, + { .subsystem = "block", .device = "rflash" }, + { .subsystem = "block", .device = "rom" }, + { .subsystem = "block", .device = "rrom" }, + { .subsystem = "block", .device = "flash" }, + { .subsystem = "block", .device = "msd" }, + { .subsystem = "block", .device = "sbpcd" }, + { .subsystem = "block", .device = "pcd" }, + { .subsystem = "block", .device = "pf" }, + { .subsystem = "block", .device = "scd" }, + { .subsystem = "block", .device = "ubd" }, + { .subsystem = "input", .device = "event" }, + { .subsystem = "input", .device = "mice" }, + { .subsystem = "input", .device = "mouse" }, + { .subsystem = "input", .device = "ts" }, + { .subsystem = "vc", .device = "vcs" }, + { .subsystem = "vc", .device = "vcsa" }, + { .subsystem = "tty", .device = NULL }, + { .subsystem = "cpuid", .device = "cpu" }, + { .subsystem = "graphics", .device = "fb" }, + { .subsystem = "mem", .device = NULL }, + { .subsystem = "misc", .device = NULL }, + { .subsystem = "msr", .device = NULL }, + { .subsystem = "netlink", .device = NULL }, + { .subsystem = "sound", .device = NULL }, + { .subsystem = "snd", .device = NULL }, + { .subsystem = "printer", .device = "lp" }, + { NULL, NULL } }; - char **device; + struct class_device *classdevice; + int len; - for (device = devices_without_link; *device != NULL; device++) { - int len = strlen(*device); + /* look if we want to look for another file instead of "dev" */ + for (classdevice = class_device; classdevice->subsystem != NULL; classdevice++) { + if (strcmp(class_dev->classname, classdevice->subsystem) == 0) { + /* if device is NULL, all devices in this class are ok */ + if (classdevice->device == NULL) + return 1; - /* look if name matches */ - if (strncmp(class_dev->name, *device, len) != 0) - continue; + len = strlen(classdevice->device); - /* exact match */ - if (strlen(class_dev->name) == len) - return 1; + /* see if device name matches */ + if (strncmp(class_dev->name, classdevice->device, len) != 0) + continue; - /* instance numbers are matching too */ - if (isdigit(class_dev->name[len])) - return 1; + /* exact match */ + if (strlen(class_dev->name) == len) + return 1; + + /* instance numbers are matching too */ + if (isdigit(class_dev->name[len])) + return 1; + } } return 0; -- cgit v1.2.3-54-g00ecf From bab16df879b33e9dd33e37c12581d60cbfb6fe71 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 7 Oct 2004 21:39:40 -0700 Subject: [PATCH] 33_bk mark for the makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5ff74b4afe..2c4cb1e56f 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ TESTER = udevtest STARTER = udevstart RULER = udevruler WAIT = wait_for_sysfs -VERSION = 033 +VERSION = 033_bk INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev -- cgit v1.2.3-54-g00ecf From f35fb62819d017880d6008b65179a3528eaba623 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 7 Oct 2004 21:40:01 -0700 Subject: [PATCH] hm, somethings odd with DEVPATH, see if this fixes it... --- dev_d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev_d.c b/dev_d.c index eaf9b1dc12..050df7bbec 100644 --- a/dev_d.c +++ b/dev_d.c @@ -96,8 +96,9 @@ void dev_d_send(struct udevice *dev, const char *subsystem, const char *devpath) strfieldcat(env_devname, dev->name); } else if (dev->type == 'n') { strfieldcpy(env_devname, dev->name); - setenv("DEVPATH", devpath, 1); } + + setenv("DEVPATH", devpath, 1); setenv("DEVNAME", env_devname, 1); dbg("DEVNAME='%s'", env_devname); -- cgit v1.2.3-54-g00ecf From da767d0739c86a04a0c0326cebff6c08ffe1228c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 7 Oct 2004 22:26:02 -0700 Subject: [PATCH] Revert previous dev_d.c change, it's not what is causing HAL problems. Cset exclude: greg@kroah.com|ChangeSet|20041007204001|14326 --- dev_d.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dev_d.c b/dev_d.c index 050df7bbec..eaf9b1dc12 100644 --- a/dev_d.c +++ b/dev_d.c @@ -96,9 +96,8 @@ void dev_d_send(struct udevice *dev, const char *subsystem, const char *devpath) strfieldcat(env_devname, dev->name); } else if (dev->type == 'n') { strfieldcpy(env_devname, dev->name); + setenv("DEVPATH", devpath, 1); } - - setenv("DEVPATH", devpath, 1); setenv("DEVNAME", env_devname, 1); dbg("DEVNAME='%s'", env_devname); -- cgit v1.2.3-54-g00ecf From 2cb3973610958ea3991e3be8e6848060069ca458 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 8 Oct 2004 00:28:16 -0700 Subject: [PATCH] add comment in wait_for_sysfs to explain the structure better. --- wait_for_sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index cb94b64404..2504b2e0c3 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -99,7 +99,8 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev /* skip waiting for physical device */ static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev) { - /* List of devices without a "device" symlink */ + /* List of devices without a "device" symlink + * set .device to NULL to accept all devices in that subsystem */ static struct class_device { char *subsystem; char *device; -- cgit v1.2.3-54-g00ecf From d1f382f026ce03b9f2ef9111bacd821cbb33f743 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 8 Oct 2004 00:36:33 -0700 Subject: [PATCH] 034 release --- ChangeLog | 16 ++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ade31556b5..4472f0c8ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Summary of changes from v033 to v034 +============================================ + +Kay Sievers: + o wait_for_sysfs bluetooth class update + +Greg Kroah-Hartman: + o add comment in wait_for_sysfs to explain the structure better + o Revert previous dev_d.c change, it's not what is causing HAL problems + o hm, somethings odd with DEVPATH, see if this fixes it + o 33_bk mark for the makefile + o wait_for_sysfs: clean up the logic for the list of devices that we do not expect device symlinks for + o get rid of annoying extra lines in the syslog for some libsysfs debug messages + o added support for i2c devices in wait_for_sysfs.c + o add support for i2c-adapter devices to wait_for_sysfs.c + Summary of changes from v032 to v033 ============================================ diff --git a/Makefile b/Makefile index 2c4cb1e56f..90b69420a8 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ TESTER = udevtest STARTER = udevstart RULER = udevruler WAIT = wait_for_sysfs -VERSION = 033_bk +VERSION = 034 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index e145ad2431..0b843e9228 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 033 +Version: 034 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 10eb67ec70bf1a41dd1b94fc74a952e3845ab59b Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 12 Oct 2004 00:16:24 -0700 Subject: [PATCH] update wait_for_sysfs with a bunch more devices thanks to user reports. --- wait_for_sysfs.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 2504b2e0c3..86422c24c0 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -63,6 +63,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev { .subsystem = "usb_host", .file = NULL }, { .subsystem = "bluetooth", .file = "address" }, { .subsystem = "i2c-adapter", .file = NULL }, + { .subsystem = "pci_bus", .file = NULL }, { NULL, NULL } }; struct class_file *classfile; @@ -126,8 +127,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "input", .device = "mice" }, { .subsystem = "input", .device = "mouse" }, { .subsystem = "input", .device = "ts" }, - { .subsystem = "vc", .device = "vcs" }, - { .subsystem = "vc", .device = "vcsa" }, + { .subsystem = "vc", .device = NULL }, { .subsystem = "tty", .device = NULL }, { .subsystem = "cpuid", .device = "cpu" }, { .subsystem = "graphics", .device = "fb" }, @@ -135,9 +135,15 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "misc", .device = NULL }, { .subsystem = "msr", .device = NULL }, { .subsystem = "netlink", .device = NULL }, + { .subsystem = "net", .device = NULL }, { .subsystem = "sound", .device = NULL }, - { .subsystem = "snd", .device = NULL }, { .subsystem = "printer", .device = "lp" }, + { .subsystem = "nvidia", .device = NULL }, + { .subsystem = "video4linux", .device = NULL }, + { .subsystem = "lirc", .device = NULL }, + { .subsystem = "firmware", .device = NULL }, + { .subsystem = "drm", .device = NULL }, + { .subsystem = "pci_bus", .device = NULL }, { NULL, NULL } }; struct class_device *classdevice; -- cgit v1.2.3-54-g00ecf From 8372907752159970c86c3f7cc565c35cf2fa1ef9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 12 Oct 2004 00:47:27 -0700 Subject: [PATCH] added ieee1394 support to wait_for_sysfs --- wait_for_sysfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 86422c24c0..bce60731fa 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -64,6 +64,9 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev { .subsystem = "bluetooth", .file = "address" }, { .subsystem = "i2c-adapter", .file = NULL }, { .subsystem = "pci_bus", .file = NULL }, + { .subsystem = "ieee1394", .file = NULL }, + { .subsystem = "ieee1394_host", .file = NULL }, + { .subsystem = "ieee1394_node", .file = NULL }, { NULL, NULL } }; struct class_file *classfile; @@ -144,6 +147,9 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "firmware", .device = NULL }, { .subsystem = "drm", .device = NULL }, { .subsystem = "pci_bus", .device = NULL }, + { .subsystem = "ieee1394", .device = NULL }, + { .subsystem = "ieee1394_host", .device = NULL }, + { .subsystem = "ieee1394_node", .device = NULL }, { NULL, NULL } }; struct class_device *classdevice; -- cgit v1.2.3-54-g00ecf From 858e0e81d041877d88ae4608ac569e9208661865 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 12 Oct 2004 00:53:57 -0700 Subject: [PATCH] 035 release --- ChangeLog | 7 +++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4472f0c8ec..4ea4d32a35 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Summary of changes from v034 to v035 +============================================ + +Greg Kroah-Hartman: + o added ieee1394 support to wait_for_sysfs + o update wait_for_sysfs with a bunch more devices thanks to user reports + Summary of changes from v033 to v034 ============================================ diff --git a/Makefile b/Makefile index 90b69420a8..c08f92b0eb 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ TESTER = udevtest STARTER = udevstart RULER = udevruler WAIT = wait_for_sysfs -VERSION = 034 +VERSION = 035 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 0b843e9228..dcc96a7a30 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 034 +Version: 035 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 788b94201bcb354bf7d9c160371f52ecc6b1a458 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 12 Oct 2004 21:48:49 -0700 Subject: [PATCH] add the error number to the error message in wait_for_sysfs to help out in debugging problems. --- wait_for_sysfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index bce60731fa..c1d7aa0a0c 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -408,8 +408,8 @@ exit: dbg("result: waiting for sysfs successful '%s'", devpath); else info("error: wait_for_sysfs needs an update to handle the device '%s' " - "properly, please report to ", - devpath); + "properly (%d), please report to ", + devpath, rc); return rc; } -- cgit v1.2.3-54-g00ecf From b808414477b07ee827ebc41390b812fe8488297a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 12 Oct 2004 21:50:15 -0700 Subject: [PATCH] 036 release --- ChangeLog | 6 ++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ea4d32a35..7b16430849 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Summary of changes from v035 to v036 +============================================ + +Greg Kroah-Hartman: + o add the error number to the error message in wait_for_sysfs to help out in debugging problems + Summary of changes from v034 to v035 ============================================ diff --git a/Makefile b/Makefile index c08f92b0eb..1f246b7307 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ TESTER = udevtest STARTER = udevstart RULER = udevruler WAIT = wait_for_sysfs -VERSION = 035 +VERSION = 036 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index dcc96a7a30..d466804659 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 035 +Version: 036 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From d30ef6b192a39cf69f9e6037a4c984ccf533f721 Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Wed, 13 Oct 2004 20:53:52 -0700 Subject: [PATCH] small udev patch You should also remove etc/dev.d/default/dbus.dev which does not exist anymore. BTW, please remove etc/init.d/udev.debian because it is broken. --- etc/dev.d/net/hotplug.dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/dev.d/net/hotplug.dev b/etc/dev.d/net/hotplug.dev index ed64c08cf2..15cc5cb52e 100644 --- a/etc/dev.d/net/hotplug.dev +++ b/etc/dev.d/net/hotplug.dev @@ -18,6 +18,6 @@ fi INTERFACE=$DEVNAME export INTERFACE if [ -f /etc/hotplug.d/default/default.hotplug ]; then - /etc/hotplug.d/default/default.hotplug net + exec /etc/hotplug.d/default/default.hotplug net fi -- cgit v1.2.3-54-g00ecf From 91d55528e1cbea6a590b5f9298125c300be0fabf Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 20:54:43 -0700 Subject: [PATCH] remove the debian specific file, as they don't want to share with the rest of the world :( --- etc/init.d/udev.debian | 114 ------------------------------------------------- 1 file changed, 114 deletions(-) delete mode 100644 etc/init.d/udev.debian diff --git a/etc/init.d/udev.debian b/etc/init.d/udev.debian deleted file mode 100644 index 8268fe6c2f..0000000000 --- a/etc/init.d/udev.debian +++ /dev/null @@ -1,114 +0,0 @@ -#! /bin/sh -# -# random init script to setup /udev -# -# chkconfig: 2345 20 80 -# description: manage user-space device nodes in /udev -# -# 2003-12-23: - some tweaks to run silently on a debian system -# 2003-12-30: - manage creation (and deletion) of /proc/self/fd->fd and -# fd/[0,1,2]->std[in,out,err] links -# - creation and deletion of /proc/kcore->core link -# - creation and deletion of /proc/asound/oss/sndstat->sndstat link - - - -udev_dir=/udev -sysfs_dir=/sys -bin=/sbin/udev - -action () { - if test $2 ; then - echo $1 - else - echo "Assertion $2 failed" - echo "Aborting" - exit 1 - fi -} - -run_udev () { - # handle block devices and their partitions - for i in ${sysfs_dir}/block/*; do - # add each drive - export DEVPATH=${i#${sysfs_dir}} - $bin block & - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - $bin block & - fi - done - done - # all other device classes - for i in ${sysfs_dir}/class/*; do - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - CLASS=`echo ${i#${sysfs_dir}} | \ - cut --delimiter='/' --fields=3-` - $bin $CLASS & - fi - done - done -} - - -case "$1" in - start) - if [ ! -d $udev_dir ]; then - mkdir $udev_dir - fi - # don't use udev if sysfs is not mounted - if [ ! -d $sysfs_dir/block ]; then - exit 1 - fi - # propogate /udev from /sys - we only need this while we do not - # have initramfs and an early user-space with which to do early - # device bring up - action "Creating initial udev device nodes: " /bin/true - export ACTION=add - run_udev - - # hack to create stdin node - cd $udev_dir && ln -s /proc/self/fd fd - cd $udev_dir && ln -s fd/0 stdin - cd $udev_dir && ln -s fd/1 stdout - cd $udev_dir && ln -s fd/2 stderr - cd $udev_dir && ln -s /proc/kcore core - cd $udev_dir && ln -s /proc/asound/oss/sndstat sndstat - ;; - stop) - # be careful - action "Removing udev device nodes: " /bin/true - export ACTION=remove - run_udev - rm -f $udev_dir/sndstat - rm -f $udev_dir/core - rm -f $udev_dir/stderr - rm -f $udev_dir/stdout - rm -f $udev_dir/stdin - rm -f $udev_dir/fd - ;; - status) - if [ -d $udev_dir ]; then - echo "the udev device node directory exists" - else - echo "the udev device node directory does not exist" - fi - ;; - restart) - $0 stop - $0 start - ;; - reload) - # nothing to do here - ;; - *) - echo "Usage: $0 {start|stop|status|restart}" - exit 1 -esac - -exit 0 -- cgit v1.2.3-54-g00ecf From cdd95f9a2d80beb3e4e32a10349fe6a69aa95f5a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 13 Oct 2004 20:55:01 -0700 Subject: [PATCH] wait_for_sysfs_update Here is an update to wait_for_sysfs to print the udev version to syslog, let hardware net interfaces wait again for the device link and revert the video4linux to wait for the device. The error here was caused by a out-of-tree media-driver, that needs the fix, not the our program. I've added a small comment for that to the log as I expect more of this to show up and the recent desktop integration work depends heavily on proper sysfs support, so the drivers should be fixed. --- wait_for_sysfs.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index c1d7aa0a0c..2252c30cd8 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -32,6 +32,7 @@ #include #include "logging.h" +#include "udev_version.h" #include "libsysfs/sysfs/libsysfs.h" #ifdef LOG @@ -138,11 +139,14 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "misc", .device = NULL }, { .subsystem = "msr", .device = NULL }, { .subsystem = "netlink", .device = NULL }, - { .subsystem = "net", .device = NULL }, + { .subsystem = "net", .device = "sit" }, + { .subsystem = "net", .device = "ppp" }, + { .subsystem = "net", .device = "lo" }, + { .subsystem = "net", .device = "tap" }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, { .subsystem = "nvidia", .device = NULL }, - { .subsystem = "video4linux", .device = NULL }, + { .subsystem = "video4linux", .device = "vbi" }, { .subsystem = "lirc", .device = NULL }, { .subsystem = "firmware", .device = NULL }, { .subsystem = "drm", .device = NULL }, @@ -407,9 +411,10 @@ exit: if (rc == 0) dbg("result: waiting for sysfs successful '%s'", devpath); else - info("error: wait_for_sysfs needs an update to handle the device '%s' " - "properly (%d), please report to ", - devpath, rc); + info("either wait_for_sysfs (udev %s) needs an update to handle the device '%s' " + "properly (%d) or the sysfs-support of your device's driver needs to be fixed, " + "please report to ", + UDEV_VERSION, devpath, rc); return rc; } -- cgit v1.2.3-54-g00ecf From a5e425369c9eccb35c7d0533e7a9dbdee864a6b5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 21:08:57 -0700 Subject: [PATCH] fix up Makefile for wait_for_sysfs udev_version.h dependancy --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 1f246b7307..70499e079a 100644 --- a/Makefile +++ b/Makefile @@ -263,6 +263,7 @@ $(INFO).o: $(GEN_HEADERS) $(DAEMON).o: $(GEN_HEADERS) $(SENDER).o: $(GEN_HEADERS) $(STARTER).o: $(GEN_HEADERS) +$(WAIT).o: $(GEN_HEADERS) $(ROOT): $(LIBC) $(ROOT).o $(STARTER).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o udevstart.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) -- cgit v1.2.3-54-g00ecf From 2b29bb4f75bb6f7abb7e5957c812c9d41496aacf Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 21:09:28 -0700 Subject: [PATCH] add support for class/raw/ to wait_for_sysfs --- wait_for_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 2252c30cd8..86499a42cd 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -154,6 +154,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "ieee1394", .device = NULL }, { .subsystem = "ieee1394_host", .device = NULL }, { .subsystem = "ieee1394_node", .device = NULL }, + { .subsystem = "raw", .device = NULL }, { NULL, NULL } }; struct class_device *classdevice; -- cgit v1.2.3-54-g00ecf From fa7aa5ecbb4af0c027c250d0ed4e1c16a0b3fd80 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 21:19:49 -0700 Subject: [PATCH] change max time to wait in wait_for_sysfs to 10 seconds to hopefully handle some slow machines. --- wait_for_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 86499a42cd..f87253d044 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -47,7 +47,7 @@ void log_message(int level, const char *format, ...) } #endif -#define WAIT_MAX_SECONDS 5 +#define WAIT_MAX_SECONDS 10 #define WAIT_LOOP_PER_SECOND 20 /* wait for specific file to show up, normally the "dev"-file */ -- cgit v1.2.3-54-g00ecf From c850706e84e3a86484ca806f898f3c0672dae4cd Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 21:25:11 -0700 Subject: [PATCH] rename files to have '_' instead of '-' in them. We should be consistent in our madness... --- Makefile | 4 +- udev-add.c | 491 ---------------------------------------------------------- udev-remove.c | 190 ----------------------- udev_add.c | 491 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev_remove.c | 190 +++++++++++++++++++++++ 5 files changed, 683 insertions(+), 683 deletions(-) delete mode 100644 udev-add.c delete mode 100644 udev-remove.c create mode 100644 udev_add.c create mode 100644 udev_remove.c diff --git a/Makefile b/Makefile index 70499e079a..b55b5bcbe0 100644 --- a/Makefile +++ b/Makefile @@ -205,8 +205,8 @@ SYSFS = $(PWD)/libsysfs/sysfs_bus.o \ OBJS = udev_lib.o \ udev_config.o \ - udev-add.o \ - udev-remove.o \ + udev_add.o \ + udev_remove.o \ udevdb.o \ namedev.o \ namedev_parse.o \ diff --git a/udev-add.c b/udev-add.c deleted file mode 100644 index e1e145de8a..0000000000 --- a/udev-add.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * udev-add.c - * - * Userspace devfs - * - * Copyright (C) 2003 Greg Kroah-Hartman - * - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef __KLIBC__ -#include -#include -#endif - -#include "libsysfs/sysfs/libsysfs.h" -#include "udev.h" -#include "udev_lib.h" -#include "udev_version.h" -#include "logging.h" -#include "namedev.h" -#include "udevdb.h" -#include "klibc_fixups.h" - -#define LOCAL_USER "$local" - -#include "selinux.h" - -/* - * Right now the major/minor of a device is stored in a file called - * "dev" in sysfs. - * The number is stored as: - * MM:mm - * MM is the major - * mm is the minor - * The value is in decimal. - */ -static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) -{ - struct sysfs_attribute *attr = NULL; - - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr == NULL) - goto error; - dbg("dev='%s'", attr->value); - - if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2) - goto error; - dbg("found major=%d, minor=%d", udev->major, udev->minor); - - return 0; -error: - return -1; -} - -static int create_path(char *file) -{ - char p[NAME_SIZE]; - char *pos; - int retval; - struct stat stats; - - strfieldcpy(p, file); - pos = strchr(p+1, '/'); - while (1) { - pos = strchr(pos+1, '/'); - if (pos == NULL) - break; - *pos = 0x00; - if (stat(p, &stats)) { - selinux_setfscreatecon(p, S_IFDIR); - retval = mkdir(p, 0755); - if (retval != 0) { - dbg("mkdir(%s) failed with error '%s'", - p, strerror(errno)); - return retval; - } - dbg("created '%s'", p); - } else { - selinux_setfilecon(p, S_IFDIR); - } - *pos = '/'; - } - return 0; -} - -static int make_node(char *file, int major, int minor, unsigned int mode, uid_t uid, gid_t gid) -{ - struct stat stats; - int retval = 0; - - if (stat(file, &stats) != 0) - goto create; - - /* preserve node with already correct numbers, to not change the inode number */ - if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) && - (stats.st_rdev == makedev(major, minor))) { - dbg("preserve file '%s', cause it has correct dev_t", file); - selinux_setfilecon(file,stats.st_mode); - goto perms; - } - - if (unlink(file) != 0) - dbg("unlink(%s) failed with error '%s'", file, strerror(errno)); - else - dbg("already present file '%s' unlinked", file); - -create: - selinux_setfscreatecon(file, mode); - retval = mknod(file, mode, makedev(major, minor)); - if (retval != 0) { - dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", - file, mode, major, minor, strerror(errno)); - goto exit; - } - -perms: - dbg("chmod(%s, %#o)", file, mode); - if (chmod(file, mode) != 0) { - dbg("chmod(%s, %#o) failed with error '%s'", file, mode, strerror(errno)); - goto exit; - } - - if (uid != 0 || gid != 0) { - dbg("chown(%s, %u, %u)", file, uid, gid); - if (chown(file, uid, gid) != 0) { - dbg("chown(%s, %u, %u) failed with error '%s'", - file, uid, gid, strerror(errno)); - goto exit; - } - } - -exit: - return retval; -} - -/* get the local logged in user */ -static void set_to_local_user(char *user) -{ - struct utmp *u; - time_t recent = 0; - - strfieldcpymax(user, default_owner_str, OWNER_SIZE); - setutent(); - while (1) { - u = getutent(); - if (u == NULL) - break; - - /* is this a user login ? */ - if (u->ut_type != USER_PROCESS) - continue; - - /* is this a local login ? */ - if (strcmp(u->ut_host, "")) - continue; - - if (u->ut_time > recent) { - recent = u->ut_time; - strfieldcpymax(user, u->ut_user, OWNER_SIZE); - dbg("local user is '%s'", user); - break; - } - } - endutent(); -} - -static int create_node(struct udevice *dev, int fake) -{ - char filename[NAME_SIZE]; - char linkname[NAME_SIZE]; - char linktarget[NAME_SIZE]; - char partitionname[NAME_SIZE]; - uid_t uid = 0; - gid_t gid = 0; - int i; - int tail; - char *pos; - int len; - - strfieldcpy(filename, udev_root); - strfieldcat(filename, dev->name); - - switch (dev->type) { - case 'b': - dev->mode |= S_IFBLK; - break; - case 'c': - case 'u': - dev->mode |= S_IFCHR; - break; - case 'p': - dev->mode |= S_IFIFO; - break; - default: - dbg("unknown node type %c\n", dev->type); - return -EINVAL; - } - - /* create parent directories if needed */ - if (strrchr(dev->name, '/')) - create_path(filename); - - if (dev->owner[0] != '\0') { - char *endptr; - unsigned long id = strtoul(dev->owner, &endptr, 10); - if (endptr[0] == '\0') - uid = (uid_t) id; - else { - struct passwd *pw; - if (strncmp(dev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0) - set_to_local_user(dev->owner); - - pw = getpwnam(dev->owner); - if (pw == NULL) - dbg("specified user unknown '%s'", dev->owner); - else - uid = pw->pw_uid; - } - } - - if (dev->group[0] != '\0') { - char *endptr; - unsigned long id = strtoul(dev->group, &endptr, 10); - if (endptr[0] == '\0') - gid = (gid_t) id; - else { - struct group *gr = getgrnam(dev->group); - if (gr == NULL) - dbg("specified group unknown '%s'", dev->group); - else - gid = gr->gr_gid; - } - } - - if (!fake) { - info("creating device node '%s'", filename); - if (make_node(filename, dev->major, dev->minor, dev->mode, uid, gid) != 0) - goto error; - } else { - info("creating device node '%s', major = '%d', minor = '%d', " - "mode = '%#o', uid = '%d', gid = '%d'", filename, - dev->major, dev->minor, (mode_t)dev->mode, uid, gid); - } - - /* create all_partitions if requested */ - if (dev->partitions > 0) { - info("creating device partition nodes '%s[1-%i]'", filename, dev->partitions); - if (!fake) { - for (i = 1; i <= dev->partitions; i++) { - strfieldcpy(partitionname, filename); - strintcat(partitionname, i); - make_node(partitionname, dev->major, - dev->minor + i, dev->mode, uid, gid); - } - } - } - - /* create symlink(s) if requested */ - foreach_strpart(dev->symlink, " ", pos, len) { - strfieldcpymax(linkname, pos, len+1); - strfieldcpy(filename, udev_root); - strfieldcat(filename, linkname); - dbg("symlink '%s' to node '%s' requested", filename, dev->name); - if (!fake) - if (strrchr(linkname, '/')) - create_path(filename); - - /* optimize relative link */ - linktarget[0] = '\0'; - i = 0; - tail = 0; - while ((dev->name[i] == linkname[i]) && dev->name[i]) { - if (dev->name[i] == '/') - tail = i+1; - i++; - } - while (linkname[i] != '\0') { - if (linkname[i] == '/') - strfieldcat(linktarget, "../"); - i++; - } - - strfieldcat(linktarget, &dev->name[tail]); - - dbg("symlink(%s, %s)", linktarget, filename); - if (!fake) { - selinux_setfscreatecon(filename, S_IFLNK); - unlink(filename); - if (symlink(linktarget, filename) != 0) - dbg("symlink(%s, %s) failed with error '%s'", - linktarget, filename, strerror(errno)); - } - } - - return 0; -error: - return -1; -} - -static struct sysfs_class_device *get_class_dev(const char *device_name) -{ - char dev_path[SYSFS_PATH_MAX]; - struct sysfs_class_device *class_dev = NULL; - - strfieldcpy(dev_path, sysfs_path); - strfieldcat(dev_path, device_name); - dbg("looking at '%s'", dev_path); - - /* open up the sysfs class device for this thing... */ - class_dev = sysfs_open_class_device_path(dev_path); - if (class_dev == NULL) { - dbg ("sysfs_open_class_device_path failed"); - goto exit; - } - dbg("class_dev->name='%s'", class_dev->name); - -exit: - return class_dev; -} - -/* wait for the "dev" file to show up in the directory in sysfs. - * If it doesn't happen in about 10 seconds, give up. - */ -#define SECONDS_TO_WAIT_FOR_FILE 10 -static int sleep_for_file(const char *path, char* file) -{ - char filename[SYSFS_PATH_MAX + 6]; - int loop = SECONDS_TO_WAIT_FOR_FILE; - int retval; - - strfieldcpy(filename, sysfs_path); - strfieldcat(filename, path); - strfieldcat(filename, file); - - while (loop--) { - struct stat buf; - - dbg("looking for '%s'", filename); - retval = stat(filename, &buf); - if (retval == 0) - goto exit; - - /* sleep to give the kernel a chance to create the dev file */ - sleep(1); - } - retval = -ENODEV; -exit: - return retval; -} - -static int rename_net_if(struct udevice *dev, int fake) -{ - int sk; - struct ifreq ifr; - int retval; - - dbg("changing net interface name from '%s' to '%s'", dev->kernel_name, dev->name); - if (fake) - return 0; - - sk = socket(PF_INET, SOCK_DGRAM, 0); - if (sk < 0) { - dbg("error opening socket"); - return -1; - } - - memset(&ifr, 0x00, sizeof(struct ifreq)); - strfieldcpy(ifr.ifr_name, dev->kernel_name); - strfieldcpy(ifr.ifr_newname, dev->name); - - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval != 0) - dbg("error changing net interface name"); - close(sk); - - return retval; -} - -int udev_add_device(const char *path, const char *subsystem, int fake) -{ - struct sysfs_class_device *class_dev; - struct udevice dev; - char devpath[DEVPATH_SIZE]; - char *pos; - int retval; - - memset(&dev, 0x00, sizeof(dev)); - - dev.type = get_device_type(path, subsystem); - switch (dev.type) { - case 'b': - case 'c': - retval = sleep_for_file(path, "/dev"); - break; - - case 'n': - retval = sleep_for_file(path, "/address"); - break; - - default: - dbg("unknown device type '%c'", dev.type); - return -1; - } - - class_dev = get_class_dev(path); - if (class_dev == NULL) - return -1; - - if (dev.type == 'b' || dev.type == 'c') { - retval = get_major_minor(class_dev, &dev); - if (retval != 0) { - dbg("get_major_minor failed"); - goto exit; - } - } - - if (namedev_name_device(class_dev, &dev) != 0) - goto exit; - - dbg("name='%s'", dev.name); - - selinux_init(); - switch (dev.type) { - case 'b': - case 'c': - retval = create_node(&dev, fake); - if (retval != 0) - goto exit; - if ((!fake) && (udevdb_add_dev(path, &dev) != 0)) - dbg("udevdb_add_dev failed, but we are going to try " - "to create the node anyway. But remove might not " - "work properly for this device."); - - dev_d_send(&dev, subsystem, path); - break; - - case 'n': - strfieldcpy(devpath, path); - if (strcmp(dev.name, dev.kernel_name) != 0) { - retval = rename_net_if(&dev, fake); - if (retval != 0) - goto exit; - /* netif's are keyed with the configured name, cause - * the original kernel name sleeps with the fishes - */ - pos = strrchr(devpath, '/'); - if (pos != NULL) { - pos[1] = '\0'; - strfieldcat(devpath, dev.name); - } - } - if ((!fake) && (udevdb_add_dev(devpath, &dev) != 0)) - dbg("udevdb_add_dev failed"); - - dev_d_send(&dev, subsystem, devpath); - break; - } - -exit: - selinux_restore(); - sysfs_close_class_device(class_dev); - - return retval; -} diff --git a/udev-remove.c b/udev-remove.c deleted file mode 100644 index 7ad7c2402a..0000000000 --- a/udev-remove.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * udev-remove.c - * - * Userspace devfs - * - * Copyright (C) 2003 Greg Kroah-Hartman - * - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_lib.h" -#include "udev_version.h" -#include "logging.h" -#include "namedev.h" -#include "udevdb.h" - -static int delete_path(char *path) -{ - char *pos; - int retval; - - pos = strrchr(path, '/'); - while (1) { - *pos = '\0'; - pos = strrchr(path, '/'); - - /* don't remove the last one */ - if ((pos == path) || (pos == NULL)) - break; - - /* remove if empty */ - retval = rmdir(path); - if (errno == ENOENT) - retval = 0; - if (retval) { - if (errno == ENOTEMPTY) - return 0; - dbg("rmdir(%s) failed with error '%s'", - path, strerror(errno)); - break; - } - dbg("removed '%s'", path); - } - return 0; -} - -/** Remove all permissions on the device node, before - * unlinking it. This fixes a security issue. - * If the user created a hard-link to the device node, - * he can't use it any longer, because he lost permission - * to do so. - */ -static int secure_unlink(const char *filename) -{ - int retval; - - retval = chown(filename, 0, 0); - if (retval) { - dbg("chown(%s, 0, 0) failed with error '%s'", - filename, strerror(errno)); - /* We continue nevertheless. - * I think it's very unlikely for chown - * to fail here, if the file exists. - */ - } - retval = chmod(filename, 0000); - if (retval) { - dbg("chmod(%s, 0000) failed with error '%s'", - filename, strerror(errno)); - /* We continue nevertheless. */ - } - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - if (retval) { - dbg("unlink(%s) failed with error '%s'", - filename, strerror(errno)); - } - return retval; -} - -static int delete_node(struct udevice *dev) -{ - char filename[NAME_SIZE]; - char linkname[NAME_SIZE]; - char partitionname[NAME_SIZE]; - int retval; - int i; - char *pos; - int len; - - strfieldcpy(filename, udev_root); - strfieldcat(filename, dev->name); - - info("removing device node '%s'", filename); - retval = secure_unlink(filename); - if (retval) - return retval; - - /* remove partition nodes */ - if (dev->partitions > 0) { - info("removing partitions '%s[1-%i]'", filename, dev->partitions); - for (i = 1; i <= dev->partitions; i++) { - strfieldcpy(partitionname, filename); - strintcat(partitionname, i); - secure_unlink(partitionname); - } - } - - /* remove subdirectories */ - if (strchr(dev->name, '/')) - delete_path(filename); - - foreach_strpart(dev->symlink, " ", pos, len) { - strfieldcpymax(linkname, pos, len+1); - strfieldcpy(filename, udev_root); - strfieldcat(filename, linkname); - - dbg("unlinking symlink '%s'", filename); - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - if (retval) { - dbg("unlink(%s) failed with error '%s'", - filename, strerror(errno)); - return retval; - } - if (strchr(dev->symlink, '/')) { - delete_path(filename); - } - } - - return retval; -} - -/* - * Look up the sysfs path in the database to see if we have named this device - * something different from the kernel name. If we have, us it. If not, use - * the default kernel name for lack of anything else to know to do. - */ -int udev_remove_device(const char *path, const char *subsystem) -{ - struct udevice dev; - char *temp; - int retval; - - memset(&dev, 0x00, sizeof(dev)); - - retval = udevdb_get_dev(path, &dev); - if (retval != 0) { - dbg("'%s' not found in database, falling back on default name", path); - temp = strrchr(path, '/'); - if (temp == NULL) - return -ENODEV; - strfieldcpy(dev.name, &temp[1]); - } - dbg("name='%s'", dev.name); - - dev.type = get_device_type(path, subsystem); - dev_d_send(&dev, subsystem, path); - udevdb_delete_dev(path); - - if (dev.type == 'b' || dev.type == 'c') - retval = delete_node(&dev); - else if (dev.type == 'n') - retval = 0; - - return retval; -} diff --git a/udev_add.c b/udev_add.c new file mode 100644 index 0000000000..e1e145de8a --- /dev/null +++ b/udev_add.c @@ -0,0 +1,491 @@ +/* + * udev-add.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef __KLIBC__ +#include +#include +#endif + +#include "libsysfs/sysfs/libsysfs.h" +#include "udev.h" +#include "udev_lib.h" +#include "udev_version.h" +#include "logging.h" +#include "namedev.h" +#include "udevdb.h" +#include "klibc_fixups.h" + +#define LOCAL_USER "$local" + +#include "selinux.h" + +/* + * Right now the major/minor of a device is stored in a file called + * "dev" in sysfs. + * The number is stored as: + * MM:mm + * MM is the major + * mm is the minor + * The value is in decimal. + */ +static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) +{ + struct sysfs_attribute *attr = NULL; + + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr == NULL) + goto error; + dbg("dev='%s'", attr->value); + + if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2) + goto error; + dbg("found major=%d, minor=%d", udev->major, udev->minor); + + return 0; +error: + return -1; +} + +static int create_path(char *file) +{ + char p[NAME_SIZE]; + char *pos; + int retval; + struct stat stats; + + strfieldcpy(p, file); + pos = strchr(p+1, '/'); + while (1) { + pos = strchr(pos+1, '/'); + if (pos == NULL) + break; + *pos = 0x00; + if (stat(p, &stats)) { + selinux_setfscreatecon(p, S_IFDIR); + retval = mkdir(p, 0755); + if (retval != 0) { + dbg("mkdir(%s) failed with error '%s'", + p, strerror(errno)); + return retval; + } + dbg("created '%s'", p); + } else { + selinux_setfilecon(p, S_IFDIR); + } + *pos = '/'; + } + return 0; +} + +static int make_node(char *file, int major, int minor, unsigned int mode, uid_t uid, gid_t gid) +{ + struct stat stats; + int retval = 0; + + if (stat(file, &stats) != 0) + goto create; + + /* preserve node with already correct numbers, to not change the inode number */ + if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) && + (stats.st_rdev == makedev(major, minor))) { + dbg("preserve file '%s', cause it has correct dev_t", file); + selinux_setfilecon(file,stats.st_mode); + goto perms; + } + + if (unlink(file) != 0) + dbg("unlink(%s) failed with error '%s'", file, strerror(errno)); + else + dbg("already present file '%s' unlinked", file); + +create: + selinux_setfscreatecon(file, mode); + retval = mknod(file, mode, makedev(major, minor)); + if (retval != 0) { + dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", + file, mode, major, minor, strerror(errno)); + goto exit; + } + +perms: + dbg("chmod(%s, %#o)", file, mode); + if (chmod(file, mode) != 0) { + dbg("chmod(%s, %#o) failed with error '%s'", file, mode, strerror(errno)); + goto exit; + } + + if (uid != 0 || gid != 0) { + dbg("chown(%s, %u, %u)", file, uid, gid); + if (chown(file, uid, gid) != 0) { + dbg("chown(%s, %u, %u) failed with error '%s'", + file, uid, gid, strerror(errno)); + goto exit; + } + } + +exit: + return retval; +} + +/* get the local logged in user */ +static void set_to_local_user(char *user) +{ + struct utmp *u; + time_t recent = 0; + + strfieldcpymax(user, default_owner_str, OWNER_SIZE); + setutent(); + while (1) { + u = getutent(); + if (u == NULL) + break; + + /* is this a user login ? */ + if (u->ut_type != USER_PROCESS) + continue; + + /* is this a local login ? */ + if (strcmp(u->ut_host, "")) + continue; + + if (u->ut_time > recent) { + recent = u->ut_time; + strfieldcpymax(user, u->ut_user, OWNER_SIZE); + dbg("local user is '%s'", user); + break; + } + } + endutent(); +} + +static int create_node(struct udevice *dev, int fake) +{ + char filename[NAME_SIZE]; + char linkname[NAME_SIZE]; + char linktarget[NAME_SIZE]; + char partitionname[NAME_SIZE]; + uid_t uid = 0; + gid_t gid = 0; + int i; + int tail; + char *pos; + int len; + + strfieldcpy(filename, udev_root); + strfieldcat(filename, dev->name); + + switch (dev->type) { + case 'b': + dev->mode |= S_IFBLK; + break; + case 'c': + case 'u': + dev->mode |= S_IFCHR; + break; + case 'p': + dev->mode |= S_IFIFO; + break; + default: + dbg("unknown node type %c\n", dev->type); + return -EINVAL; + } + + /* create parent directories if needed */ + if (strrchr(dev->name, '/')) + create_path(filename); + + if (dev->owner[0] != '\0') { + char *endptr; + unsigned long id = strtoul(dev->owner, &endptr, 10); + if (endptr[0] == '\0') + uid = (uid_t) id; + else { + struct passwd *pw; + if (strncmp(dev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0) + set_to_local_user(dev->owner); + + pw = getpwnam(dev->owner); + if (pw == NULL) + dbg("specified user unknown '%s'", dev->owner); + else + uid = pw->pw_uid; + } + } + + if (dev->group[0] != '\0') { + char *endptr; + unsigned long id = strtoul(dev->group, &endptr, 10); + if (endptr[0] == '\0') + gid = (gid_t) id; + else { + struct group *gr = getgrnam(dev->group); + if (gr == NULL) + dbg("specified group unknown '%s'", dev->group); + else + gid = gr->gr_gid; + } + } + + if (!fake) { + info("creating device node '%s'", filename); + if (make_node(filename, dev->major, dev->minor, dev->mode, uid, gid) != 0) + goto error; + } else { + info("creating device node '%s', major = '%d', minor = '%d', " + "mode = '%#o', uid = '%d', gid = '%d'", filename, + dev->major, dev->minor, (mode_t)dev->mode, uid, gid); + } + + /* create all_partitions if requested */ + if (dev->partitions > 0) { + info("creating device partition nodes '%s[1-%i]'", filename, dev->partitions); + if (!fake) { + for (i = 1; i <= dev->partitions; i++) { + strfieldcpy(partitionname, filename); + strintcat(partitionname, i); + make_node(partitionname, dev->major, + dev->minor + i, dev->mode, uid, gid); + } + } + } + + /* create symlink(s) if requested */ + foreach_strpart(dev->symlink, " ", pos, len) { + strfieldcpymax(linkname, pos, len+1); + strfieldcpy(filename, udev_root); + strfieldcat(filename, linkname); + dbg("symlink '%s' to node '%s' requested", filename, dev->name); + if (!fake) + if (strrchr(linkname, '/')) + create_path(filename); + + /* optimize relative link */ + linktarget[0] = '\0'; + i = 0; + tail = 0; + while ((dev->name[i] == linkname[i]) && dev->name[i]) { + if (dev->name[i] == '/') + tail = i+1; + i++; + } + while (linkname[i] != '\0') { + if (linkname[i] == '/') + strfieldcat(linktarget, "../"); + i++; + } + + strfieldcat(linktarget, &dev->name[tail]); + + dbg("symlink(%s, %s)", linktarget, filename); + if (!fake) { + selinux_setfscreatecon(filename, S_IFLNK); + unlink(filename); + if (symlink(linktarget, filename) != 0) + dbg("symlink(%s, %s) failed with error '%s'", + linktarget, filename, strerror(errno)); + } + } + + return 0; +error: + return -1; +} + +static struct sysfs_class_device *get_class_dev(const char *device_name) +{ + char dev_path[SYSFS_PATH_MAX]; + struct sysfs_class_device *class_dev = NULL; + + strfieldcpy(dev_path, sysfs_path); + strfieldcat(dev_path, device_name); + dbg("looking at '%s'", dev_path); + + /* open up the sysfs class device for this thing... */ + class_dev = sysfs_open_class_device_path(dev_path); + if (class_dev == NULL) { + dbg ("sysfs_open_class_device_path failed"); + goto exit; + } + dbg("class_dev->name='%s'", class_dev->name); + +exit: + return class_dev; +} + +/* wait for the "dev" file to show up in the directory in sysfs. + * If it doesn't happen in about 10 seconds, give up. + */ +#define SECONDS_TO_WAIT_FOR_FILE 10 +static int sleep_for_file(const char *path, char* file) +{ + char filename[SYSFS_PATH_MAX + 6]; + int loop = SECONDS_TO_WAIT_FOR_FILE; + int retval; + + strfieldcpy(filename, sysfs_path); + strfieldcat(filename, path); + strfieldcat(filename, file); + + while (loop--) { + struct stat buf; + + dbg("looking for '%s'", filename); + retval = stat(filename, &buf); + if (retval == 0) + goto exit; + + /* sleep to give the kernel a chance to create the dev file */ + sleep(1); + } + retval = -ENODEV; +exit: + return retval; +} + +static int rename_net_if(struct udevice *dev, int fake) +{ + int sk; + struct ifreq ifr; + int retval; + + dbg("changing net interface name from '%s' to '%s'", dev->kernel_name, dev->name); + if (fake) + return 0; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) { + dbg("error opening socket"); + return -1; + } + + memset(&ifr, 0x00, sizeof(struct ifreq)); + strfieldcpy(ifr.ifr_name, dev->kernel_name); + strfieldcpy(ifr.ifr_newname, dev->name); + + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval != 0) + dbg("error changing net interface name"); + close(sk); + + return retval; +} + +int udev_add_device(const char *path, const char *subsystem, int fake) +{ + struct sysfs_class_device *class_dev; + struct udevice dev; + char devpath[DEVPATH_SIZE]; + char *pos; + int retval; + + memset(&dev, 0x00, sizeof(dev)); + + dev.type = get_device_type(path, subsystem); + switch (dev.type) { + case 'b': + case 'c': + retval = sleep_for_file(path, "/dev"); + break; + + case 'n': + retval = sleep_for_file(path, "/address"); + break; + + default: + dbg("unknown device type '%c'", dev.type); + return -1; + } + + class_dev = get_class_dev(path); + if (class_dev == NULL) + return -1; + + if (dev.type == 'b' || dev.type == 'c') { + retval = get_major_minor(class_dev, &dev); + if (retval != 0) { + dbg("get_major_minor failed"); + goto exit; + } + } + + if (namedev_name_device(class_dev, &dev) != 0) + goto exit; + + dbg("name='%s'", dev.name); + + selinux_init(); + switch (dev.type) { + case 'b': + case 'c': + retval = create_node(&dev, fake); + if (retval != 0) + goto exit; + if ((!fake) && (udevdb_add_dev(path, &dev) != 0)) + dbg("udevdb_add_dev failed, but we are going to try " + "to create the node anyway. But remove might not " + "work properly for this device."); + + dev_d_send(&dev, subsystem, path); + break; + + case 'n': + strfieldcpy(devpath, path); + if (strcmp(dev.name, dev.kernel_name) != 0) { + retval = rename_net_if(&dev, fake); + if (retval != 0) + goto exit; + /* netif's are keyed with the configured name, cause + * the original kernel name sleeps with the fishes + */ + pos = strrchr(devpath, '/'); + if (pos != NULL) { + pos[1] = '\0'; + strfieldcat(devpath, dev.name); + } + } + if ((!fake) && (udevdb_add_dev(devpath, &dev) != 0)) + dbg("udevdb_add_dev failed"); + + dev_d_send(&dev, subsystem, devpath); + break; + } + +exit: + selinux_restore(); + sysfs_close_class_device(class_dev); + + return retval; +} diff --git a/udev_remove.c b/udev_remove.c new file mode 100644 index 0000000000..7ad7c2402a --- /dev/null +++ b/udev_remove.c @@ -0,0 +1,190 @@ +/* + * udev-remove.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_lib.h" +#include "udev_version.h" +#include "logging.h" +#include "namedev.h" +#include "udevdb.h" + +static int delete_path(char *path) +{ + char *pos; + int retval; + + pos = strrchr(path, '/'); + while (1) { + *pos = '\0'; + pos = strrchr(path, '/'); + + /* don't remove the last one */ + if ((pos == path) || (pos == NULL)) + break; + + /* remove if empty */ + retval = rmdir(path); + if (errno == ENOENT) + retval = 0; + if (retval) { + if (errno == ENOTEMPTY) + return 0; + dbg("rmdir(%s) failed with error '%s'", + path, strerror(errno)); + break; + } + dbg("removed '%s'", path); + } + return 0; +} + +/** Remove all permissions on the device node, before + * unlinking it. This fixes a security issue. + * If the user created a hard-link to the device node, + * he can't use it any longer, because he lost permission + * to do so. + */ +static int secure_unlink(const char *filename) +{ + int retval; + + retval = chown(filename, 0, 0); + if (retval) { + dbg("chown(%s, 0, 0) failed with error '%s'", + filename, strerror(errno)); + /* We continue nevertheless. + * I think it's very unlikely for chown + * to fail here, if the file exists. + */ + } + retval = chmod(filename, 0000); + if (retval) { + dbg("chmod(%s, 0000) failed with error '%s'", + filename, strerror(errno)); + /* We continue nevertheless. */ + } + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; + if (retval) { + dbg("unlink(%s) failed with error '%s'", + filename, strerror(errno)); + } + return retval; +} + +static int delete_node(struct udevice *dev) +{ + char filename[NAME_SIZE]; + char linkname[NAME_SIZE]; + char partitionname[NAME_SIZE]; + int retval; + int i; + char *pos; + int len; + + strfieldcpy(filename, udev_root); + strfieldcat(filename, dev->name); + + info("removing device node '%s'", filename); + retval = secure_unlink(filename); + if (retval) + return retval; + + /* remove partition nodes */ + if (dev->partitions > 0) { + info("removing partitions '%s[1-%i]'", filename, dev->partitions); + for (i = 1; i <= dev->partitions; i++) { + strfieldcpy(partitionname, filename); + strintcat(partitionname, i); + secure_unlink(partitionname); + } + } + + /* remove subdirectories */ + if (strchr(dev->name, '/')) + delete_path(filename); + + foreach_strpart(dev->symlink, " ", pos, len) { + strfieldcpymax(linkname, pos, len+1); + strfieldcpy(filename, udev_root); + strfieldcat(filename, linkname); + + dbg("unlinking symlink '%s'", filename); + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; + if (retval) { + dbg("unlink(%s) failed with error '%s'", + filename, strerror(errno)); + return retval; + } + if (strchr(dev->symlink, '/')) { + delete_path(filename); + } + } + + return retval; +} + +/* + * Look up the sysfs path in the database to see if we have named this device + * something different from the kernel name. If we have, us it. If not, use + * the default kernel name for lack of anything else to know to do. + */ +int udev_remove_device(const char *path, const char *subsystem) +{ + struct udevice dev; + char *temp; + int retval; + + memset(&dev, 0x00, sizeof(dev)); + + retval = udevdb_get_dev(path, &dev); + if (retval != 0) { + dbg("'%s' not found in database, falling back on default name", path); + temp = strrchr(path, '/'); + if (temp == NULL) + return -ENODEV; + strfieldcpy(dev.name, &temp[1]); + } + dbg("name='%s'", dev.name); + + dev.type = get_device_type(path, subsystem); + dev_d_send(&dev, subsystem, path); + udevdb_delete_dev(path); + + if (dev.type == 'b' || dev.type == 'c') + retval = delete_node(&dev); + else if (dev.type == 'n') + retval = 0; + + return retval; +} -- cgit v1.2.3-54-g00ecf From c04a16479f5c3bde13e7e2400f384922196ec97f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 22:28:06 -0700 Subject: [PATCH] Make the build silent, thanks to a helper program from ncftp --- Makefile | 72 ++++++++---- ccdv.c | 384 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 432 insertions(+), 24 deletions(-) create mode 100644 ccdv.c diff --git a/Makefile b/Makefile index b55b5bcbe0..356d1a9f59 100644 --- a/Makefile +++ b/Makefile @@ -75,6 +75,10 @@ udevdir = ${prefix}/udev # than the local version of klibc #USE_KLIBC = true +# make the build silent (well, at least the udev part) Set this +# to something else to make it noisy again. +V=false + # set up PWD so that older versions of make will work with our build. PWD = $(shell pwd) @@ -87,6 +91,7 @@ LD = $(CROSS)gcc AR = $(CROSS)ar STRIP = $(CROSS)strip RANLIB = $(CROSS)ranlib +HOSTCC = gcc export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS ARCH_LIB_OBJS CRT0 @@ -195,13 +200,13 @@ $(CRT0): TDB = tdb/tdb.o \ tdb/spinlock.o -SYSFS = $(PWD)/libsysfs/sysfs_bus.o \ - $(PWD)/libsysfs/sysfs_class.o \ - $(PWD)/libsysfs/sysfs_device.o \ - $(PWD)/libsysfs/sysfs_dir.o \ - $(PWD)/libsysfs/sysfs_driver.o \ - $(PWD)/libsysfs/sysfs_utils.o \ - $(PWD)/libsysfs/dlist.o +SYSFS = libsysfs/sysfs_bus.o \ + libsysfs/sysfs_class.o \ + libsysfs/sysfs_device.o \ + libsysfs/sysfs_dir.o \ + libsysfs/sysfs_driver.o \ + libsysfs/sysfs_utils.o \ + libsysfs/dlist.o OBJS = udev_lib.o \ udev_config.o \ @@ -229,9 +234,21 @@ ifeq ($(strip $(USE_KLIBC)),true) KLIBC_FIXUP = klibc_fixups.o endif +ifeq ($(strip $(V)),false) + QUIET=@./ccdv + HOST_PROGS=ccdv +else + QUIET= + HOST_PROGS= +endif + # header files automatically generated GEN_HEADERS = udev_version.h +ccdv: + @echo "Building ccdv" + @$(HOSTCC) -O1 ccdv.c -o ccdv + # Rules on how to create the generated header files udev_version.h: @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ @@ -247,17 +264,17 @@ udev_version.h: # Rules on how to create the generated config files $(LOCAL_CFG_DIR)/udev.conf: - sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ + @./ccdv sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ GEN_MANPAGES = udev.8 GEN_MANPAGESIN = udev.8.in # Rules on how to create the man pages $(GEN_MANPAGES): $(GEN_MANPAGESIN) - sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ + @./ccdv sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ $(OBJS): $(GEN_HEADERS) -$(ROOT).o: $(GEN_HEADERS) +$(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS) $(TESTER).o: $(GEN_HEADERS) $(INFO).o: $(GEN_HEADERS) $(DAEMON).o: $(GEN_HEADERS) @@ -266,37 +283,44 @@ $(STARTER).o: $(GEN_HEADERS) $(WAIT).o: $(GEN_HEADERS) $(ROOT): $(LIBC) $(ROOT).o $(STARTER).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o udevstart.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $@ + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o udevstart.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ $(TESTER): $(LIBC) $(TESTER).o $(OBJS) $(HEADERS) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevtest.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $@ + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevtest.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ $(INFO): $(LIBC) $(INFO).o $(OBJS) $(HEADERS) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $@ + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ $(DAEMON): $(LIBC) $(DAEMON).o $(OBJS) udevd.h - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o udev_lib.o $(KLIBC_FIXUP) $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $@ + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o udev_lib.o $(KLIBC_FIXUP) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ $(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $@ + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ $(RULER): $(LIBC) $(RULER).o $(OBJS) $(HEADERS) - $(LD) $(LDFLAGS) -o $@ $(CRT0) udevruler.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) -lnewt - $(STRIPCMD) $@ + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevruler.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) -lnewt + $(QUIET) $(STRIPCMD) $@ $(WAIT): $(WAIT).o $(OBJS) $(HEADERS) $(LIBC) - $(LD) $(LDFLAGS) -o $@ $(CRT0) $(WAIT).o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(STRIPCMD) $@ + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(WAIT).o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ + +#.c.o: +# $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) -c -o $@ $< +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(RULER) $(WAIT) + - rm -f ccdv $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ diff --git a/ccdv.c b/ccdv.c new file mode 100644 index 0000000000..069cc461de --- /dev/null +++ b/ccdv.c @@ -0,0 +1,384 @@ +/* ccdv.c + * + * Copyright (C) 2002-2003, by Mike Gleason, NcFTP Software. + * All Rights Reserved. + * + * Licensed under the GNU Public License. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define SETCOLOR_SUCCESS (gANSIEscapes ? "\033\1331;32m" : "") +#define SETCOLOR_FAILURE (gANSIEscapes ? "\033\1331;31m" : "") +#define SETCOLOR_WARNING (gANSIEscapes ? "\033\1331;33m" : "") +#define SETCOLOR_NORMAL (gANSIEscapes ? "\033\1330;39m" : "") + +#define TEXT_BLOCK_SIZE 8192 +#define INDENT 2 + +#define TERMS "vt100:vt102:vt220:vt320:xterm:xterm-color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin" + +size_t gNBufUsed = 0, gNBufAllocated = 0; +char *gBuf = NULL; +int gCCPID; +char gAction[64] = ""; +char gTarget[64] = ""; +char gAr[32] = ""; +char gArLibraryTarget[64] = ""; +int gDumpCmdArgs = 0; +char gArgsStr[800]; +int gColumns = 80; +int gANSIEscapes = 0; +int gExitStatus = 95; + +static void DumpFormattedOutput(void) +{ + char *cp; + char spaces[8 + 1] = " "; + char *saved; + int curcol; + int i; + + curcol = 0; + saved = NULL; + for (cp = gBuf + ((gDumpCmdArgs == 0) ? strlen(gArgsStr) : 0); ; cp++) { + if (*cp == '\0') { + if (saved != NULL) { + cp = saved; + saved = NULL; + } else break; + } + if (*cp == '\r') + continue; + if (*cp == '\t') { + saved = cp + 1; + cp = spaces + 8 - (8 - ((curcol - INDENT - 1) % 8)); + } + if (curcol == 0) { + for (i = INDENT; --i >= 0; ) + putchar(' '); + curcol = INDENT; + } + putchar(*cp); + if (++curcol == (gColumns - 1)) { + putchar('\n'); + curcol = 0; + } else if (*cp == '\n') + curcol = 0; + } + free(gBuf); +} /* DumpFormattedOutput */ + + + +/* Difftime(), only for timeval structures. */ +static void TimeValSubtract(struct timeval *tdiff, struct timeval *t1, struct timeval *t0) +{ + tdiff->tv_sec = t1->tv_sec - t0->tv_sec; + tdiff->tv_usec = t1->tv_usec - t0->tv_usec; + if (tdiff->tv_usec < 0) { + tdiff->tv_sec--; + tdiff->tv_usec += 1000000; + } +} /* TimeValSubtract */ + + + +static void Wait(void) +{ + int pid2, status; + + do { + status = 0; + pid2 = (int) waitpid(gCCPID, &status, 0); + } while (((pid2 >= 0) && (! WIFEXITED(status))) || ((pid2 < 0) && (errno == EINTR))); + if (WIFEXITED(status)) + gExitStatus = WEXITSTATUS(status); +} /* Wait */ + + + +static int SlurpProgress(int fd) +{ + char s1[71]; + char *newbuf; + int nready; + size_t ntoread; + ssize_t nread; + struct timeval now, tnext, tleft; + fd_set ss; + fd_set ss2; + const char *trail = "/-\\|", *trailcp; + + trailcp = trail; + snprintf(s1, sizeof(s1), "%s%s%s... ", gAction, gTarget[0] ? " " : "", gTarget); + printf("\r%-70s%-9s", s1, ""); + fflush(stdout); + + gettimeofday(&now, NULL); + tnext = now; + tnext.tv_sec++; + tleft.tv_sec = 1; + tleft.tv_usec = 0; + FD_ZERO(&ss2); + FD_SET(fd, &ss2); + for(;;) { + if (gNBufUsed == (gNBufAllocated - 1)) { + if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) { + perror("ccdv: realloc"); + return (-1); + } + gNBufAllocated += TEXT_BLOCK_SIZE; + gBuf = newbuf; + } + for (;;) { + ss = ss2; + nready = select(fd + 1, &ss, NULL, NULL, &tleft); + if (nready == 1) + break; + if (nready < 0) { + if (errno != EINTR) { + perror("ccdv: select"); + return (-1); + } + continue; + } + gettimeofday(&now, NULL); + if ((now.tv_sec > tnext.tv_sec) || ((now.tv_sec == tnext.tv_sec) && (now.tv_usec >= tnext.tv_usec))) { + tnext = now; + tnext.tv_sec++; + tleft.tv_sec = 1; + tleft.tv_usec = 0; + printf("\r%-71s%c%-7s", s1, *trailcp, ""); + fflush(stdout); + if (*++trailcp == '\0') + trailcp = trail; + } else { + TimeValSubtract(&tleft, &tnext, &now); + } + } + ntoread = (gNBufAllocated - gNBufUsed - 1); + nread = read(fd, gBuf + gNBufUsed, ntoread); + if (nread < 0) { + if (errno == EINTR) + continue; + perror("ccdv: read"); + return (-1); + } else if (nread == 0) { + break; + } + gNBufUsed += nread; + gBuf[gNBufUsed] = '\0'; + } + snprintf(s1, sizeof(s1), "%s%s%s: ", gAction, gTarget[0] ? " " : "", gTarget); + Wait(); + if (gExitStatus == 0) { + printf("\r%-70s", s1); + printf("[%s%s%s]", ((gNBufUsed - strlen(gArgsStr)) < 4) ? SETCOLOR_SUCCESS : SETCOLOR_WARNING, "OK", SETCOLOR_NORMAL); + printf("%-5s\n", " "); + } else { + printf("\r%-70s", s1); + printf("[%s%s%s]", SETCOLOR_FAILURE, "ERROR", SETCOLOR_NORMAL); + printf("%-2s\n", " "); + gDumpCmdArgs = 1; /* print cmd when there are errors */ + } + fflush(stdout); + return (0); +} /* SlurpProgress */ + + + +static int SlurpAll(int fd) +{ + char *newbuf; + size_t ntoread; + ssize_t nread; + + printf("%s%s%s.\n", gAction, gTarget[0] ? " " : "", gTarget); + fflush(stdout); + + for(;;) { + if (gNBufUsed == (gNBufAllocated - 1)) { + if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) { + perror("ccdv: realloc"); + return (-1); + } + gNBufAllocated += TEXT_BLOCK_SIZE; + gBuf = newbuf; + } + ntoread = (gNBufAllocated - gNBufUsed - 1); + nread = read(fd, gBuf + gNBufUsed, ntoread); + if (nread < 0) { + if (errno == EINTR) + continue; + perror("ccdv: read"); + return (-1); + } else if (nread == 0) { + break; + } + gNBufUsed += nread; + gBuf[gNBufUsed] = '\0'; + } + Wait(); + gDumpCmdArgs = (gExitStatus != 0); /* print cmd when there are errors */ + return (0); +} /* SlurpAll */ + + + +static const char *Basename(const char *path) +{ + const char *cp; + cp = strrchr(path, '/'); + if (cp == NULL) + return (path); + return (cp + 1); +} /* Basename */ + + + +static const char * Extension(const char *path) +{ + const char *cp = path; + cp = strrchr(path, '.'); + if (cp == NULL) + return (""); + return (cp); +} /* Extension */ + + + +static void Usage(void) +{ + fprintf(stderr, "Usage: ccdv /path/to/cc CFLAGS...\n\n"); + fprintf(stderr, "I wrote this to reduce the deluge Make output to make finding actual problems\n"); + fprintf(stderr, "easier. It is intended to be invoked from Makefiles, like this. Instead of:\n\n"); + fprintf(stderr, "\t.c.o:\n"); + fprintf(stderr, "\t\t$(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n"); + fprintf(stderr, "\nRewrite your rule so it looks like:\n\n"); + fprintf(stderr, "\t.c.o:\n"); + fprintf(stderr, "\t\t@ccdv $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n\n"); + fprintf(stderr, "ccdv 1.1.0 is Free under the GNU Public License. Enjoy!\n"); + fprintf(stderr, " -- Mike Gleason, NcFTP Software \n"); + exit(96); +} /* Usage */ + + + +int main(int argc, char **argv) +{ + int pipe1[2]; + int devnull; + char emerg[256]; + int fd; + int nread; + int i; + int cc = 0, pch = 0; + const char *quote; + + if (argc < 2) + Usage(); + + snprintf(gAction, sizeof(gAction), "Running %s", Basename(argv[1])); + memset(gArgsStr, 0, sizeof(gArgsStr)); + for (i = 1; i < argc; i++) { + quote = (strchr(argv[i], ' ') != NULL) ? "\"" : ""; + snprintf(gArgsStr + strlen(gArgsStr), sizeof(gArgsStr) - strlen(gArgsStr), "%s%s%s%s%s", (i == 1) ? "" : " ", quote, argv[i], quote, (i == (argc - 1)) ? "\n" : ""); + if ((strcmp(argv[i], "-o") == 0) && ((i + 1) < argc)) { + if (strcasecmp(Extension(argv[i + 1]), ".o") != 0) { + strcpy(gAction, "Linking"); + snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i + 1])); + } + } else if (strchr("-+/", (int) argv[i][0]) != NULL) { + continue; + } else if (strncasecmp(Extension(argv[i]), ".c", 2) == 0) { + cc++; + snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); + } else if ((strncasecmp(Extension(argv[i]), ".h", 2) == 0) && (cc == 0)) { + pch++; + snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); + } else if ((i == 1) && (strcmp(Basename(argv[i]), "ar") == 0)) { + snprintf(gAr, sizeof(gAr), "%s", Basename(argv[i])); + } else if ((gArLibraryTarget[0] == '\0') && (strcasecmp(Extension(argv[i]), ".a") == 0)) { + snprintf(gArLibraryTarget, sizeof(gArLibraryTarget), "%s", Basename(argv[i])); + } + } + if ((gAr[0] != '\0') && (gArLibraryTarget[0] != '\0')) { + strcpy(gAction, "Creating library"); + snprintf(gTarget, sizeof(gTarget), "%s", gArLibraryTarget); + } else if (pch > 0) { + strcpy(gAction, "Precompiling"); + } else if (cc > 0) { + strcpy(gAction, "Compiling"); + } + + if (pipe(pipe1) < 0) { + perror("ccdv: pipe"); + exit(97); + } + + (void) close(0); + devnull = open("/dev/null", O_RDWR, 00666); + if ((devnull != 0) && (dup2(devnull, 0) == 0)) + close(devnull); + + gCCPID = (int) fork(); + if (gCCPID < 0) { + (void) close(pipe1[0]); + (void) close(pipe1[1]); + perror("ccdv: fork"); + exit(98); + } else if (gCCPID == 0) { + /* Child */ + (void) close(pipe1[0]); /* close read end */ + if (pipe1[1] != 1) { /* use write end on stdout */ + (void) dup2(pipe1[1], 1); + (void) close(pipe1[1]); + } + (void) dup2(1, 2); /* use write end on stderr */ + execvp(argv[1], argv + 1); + perror(argv[1]); + exit(99); + } + + /* parent */ + (void) close(pipe1[1]); /* close write end */ + fd = pipe1[0]; /* use read end */ + + gColumns = (getenv("COLUMNS") != NULL) ? atoi(getenv("COLUMNS")) : 80; + gANSIEscapes = (getenv("TERM") != NULL) && (strstr(TERMS, getenv("TERM")) != NULL); + gBuf = (char *) malloc(TEXT_BLOCK_SIZE); + if (gBuf == NULL) + goto panic; + gNBufUsed = 0; + gNBufAllocated = TEXT_BLOCK_SIZE; + if (strlen(gArgsStr) < (gNBufAllocated - 1)) { + strcpy(gBuf, gArgsStr); + gNBufUsed = strlen(gArgsStr); + } + + if (isatty(1)) { + if (SlurpProgress(fd) < 0) + goto panic; + } else { + if (SlurpAll(fd) < 0) + goto panic; + } + DumpFormattedOutput(); + exit(gExitStatus); + +panic: + gDumpCmdArgs = 1; /* print cmd when there are errors */ + DumpFormattedOutput(); + while ((nread = read(fd, emerg, (size_t) sizeof(emerg))) > 0) + (void) write(2, emerg, (size_t) nread); + Wait(); + exit(gExitStatus); +} /* main */ -- cgit v1.2.3-54-g00ecf From c36f0ac34fa3bf8b952889b9197a5ee1ea5d2714 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 22:33:09 -0700 Subject: [PATCH] a few more Makefile tweaks for the quiet feature. --- Makefile | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 356d1a9f59..4107b96a3f 100644 --- a/Makefile +++ b/Makefile @@ -251,6 +251,7 @@ ccdv: # Rules on how to create the generated header files udev_version.h: + @echo "Creating udev_version.h" @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ @echo \#define UDEV_ROOT \"$(udevdir)/\" >> $@ @echo \#define UDEV_DB \"$(udevdir)/.udev.tdb\" >> $@ @@ -264,23 +265,23 @@ udev_version.h: # Rules on how to create the generated config files $(LOCAL_CFG_DIR)/udev.conf: - @./ccdv sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ + $(QUIET) sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ GEN_MANPAGES = udev.8 GEN_MANPAGESIN = udev.8.in # Rules on how to create the man pages $(GEN_MANPAGES): $(GEN_MANPAGESIN) - @./ccdv sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ + $(QUIET) sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ $(OBJS): $(GEN_HEADERS) $(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS) -$(TESTER).o: $(GEN_HEADERS) -$(INFO).o: $(GEN_HEADERS) -$(DAEMON).o: $(GEN_HEADERS) -$(SENDER).o: $(GEN_HEADERS) -$(STARTER).o: $(GEN_HEADERS) -$(WAIT).o: $(GEN_HEADERS) +$(TESTER).o: $(GEN_HEADERS) $(HOST_PROGS) +$(INFO).o: $(GEN_HEADERS) $(HOST_PROGS) +$(DAEMON).o: $(GEN_HEADERS) $(HOST_PROGS) +$(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) +$(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) +$(WAIT).o: $(GEN_HEADERS) $(HOST_PROGS) $(ROOT): $(LIBC) $(ROOT).o $(STARTER).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o udevstart.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) @@ -320,7 +321,7 @@ clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(RULER) $(WAIT) - - rm -f ccdv + -rm -f ccdv $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ -- cgit v1.2.3-54-g00ecf From 7e89a569cc4db0c1482662dc4df5f60df7aef3ff Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 13 Oct 2004 23:13:26 -0700 Subject: [PATCH] prevent deadlocks on an corrupt udev database Here is the patch, that should prevent all of the known deadlocks with corrupt tdb databases we discovered. Thanks to Frank Steiner , who tested all this endlessly with a NFS mounted /dev. The conclusion is, that udev will not work on filesystems without proper record locking, but we should prevent the endless loops anyway. This patch implements: o recovery from a corrupted udev database. udev will continue without database support now, instead of doing nothing. So the node should be generated in any case, remove will obviously not work for custom names. o added iteration limits to the tdb-code at the places we discovered endless loops. In the case tdb tries to find more than 100.000 entries with the same hash, we better give up :) o prevent a {all_partitions} loop caused by corrupt db data o log all tdb errors to syslog o switch sleep() to usleep() cause we want to use alarm() --- namedev.c | 22 ++++++++-------------- tdb/tdb.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------- udev.c | 23 +++++++++++++++++------ udev.h | 3 +++ udev_add.c | 5 ++--- udev_remove.c | 14 ++++++++++---- udevdb.c | 16 +++++++++++++++- wait_for_sysfs.c | 13 ++++++------- 8 files changed, 110 insertions(+), 42 deletions(-) diff --git a/namedev.c b/namedev.c index 695fb55413..9276b0cbba 100644 --- a/namedev.c +++ b/namedev.c @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -353,7 +352,6 @@ static struct bus_file { {} }; -#define SECONDS_TO_WAIT_FOR_FILE 10 static void wait_for_device_to_initialize(struct sysfs_device *sysfs_device) { /* sleep until we see the file for this specific bus type show up this @@ -367,14 +365,14 @@ static void wait_for_device_to_initialize(struct sysfs_device *sysfs_device) struct bus_file *b = &bus_files[0]; struct sysfs_attribute *tmpattr; int found = 0; - int loop = SECONDS_TO_WAIT_FOR_FILE; + int loop = WAIT_FOR_FILE_SECONDS * WAIT_FOR_FILE_RETRY_FREQ; while (1) { if (b->bus == NULL) { if (!found) break; - /* sleep to give the kernel a chance to create the file */ - sleep(1); + /* give the kernel a chance to create the file */ + usleep(1000 * 1000 / WAIT_FOR_FILE_RETRY_FREQ); --loop; if (loop == 0) break; @@ -394,7 +392,8 @@ static void wait_for_device_to_initialize(struct sysfs_device *sysfs_device) } if (!found) dbg("did not find bus type '%s' on list of bus_id_files, " - "contact greg@kroah.com", sysfs_device->bus); + "please report to ", + sysfs_device->bus); exit: return; /* here to prevent compiler warning... */ } @@ -680,7 +679,6 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de { struct sysfs_device *sysfs_device; struct sysfs_class_device *class_dev_parent; - struct timespec tspec; int loop; /* Figure out where the device symlink is at. For char devices this will @@ -696,16 +694,14 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de if (class_dev_parent != NULL) dbg("given class device has a parent, use this instead"); - tspec.tv_sec = 0; - tspec.tv_nsec = 10000000; /* sleep 10 millisec */ - loop = 10; + loop = WAIT_FOR_FILE_SECONDS * WAIT_FOR_FILE_RETRY_FREQ; while (loop--) { if (udev_sleep) { if (whitelist_search(class_dev)) { sysfs_device = NULL; goto exit; } - nanosleep(&tspec, NULL); + usleep(1000 * 1000 / WAIT_FOR_FILE_RETRY_FREQ); } if (class_dev_parent) @@ -727,11 +723,9 @@ device_found: if (sysfs_device->bus[0] != '\0') goto bus_found; - loop = 10; - tspec.tv_nsec = 10000000; while (loop--) { if (udev_sleep) - nanosleep(&tspec, NULL); + usleep(1000 * 1000 / WAIT_FOR_FILE_RETRY_FREQ); sysfs_get_device_bus(sysfs_device); if (sysfs_device->bus[0] != '\0') diff --git a/tdb/tdb.c b/tdb/tdb.c index e87ea3692e..4cc1e07024 100644 --- a/tdb/tdb.c +++ b/tdb/tdb.c @@ -45,7 +45,12 @@ #define STANDALONE #define TDB_DEBUG #define HAVE_MMAP 1 - +/* this should prevent deadlocks loops on corrupt databases + * we've discovered. Most deadlocks happend by iterating over the + * list of entries with the same hash value. */ +#define LOOP_MAX 100000 +#define TDB_LOG(x) TDB_LOG_UDEV x +#define TDB_LOG_UDEV(tdb, level, format, arg...) info(format, ##arg) #ifdef STANDALONE #if HAVE_CONFIG_H @@ -66,6 +71,7 @@ #include "tdb.h" #include "spinlock.h" #include "../udev_lib.h" +#include "../logging.h" #else #include "includes.h" #endif @@ -89,7 +95,9 @@ /* NB assumes there is a local variable called "tdb" that is the * current context, also takes doubly-parenthesized print-style * argument. */ +#ifndef TDB_LOG #define TDB_LOG(x) (tdb->log_fn?((tdb->log_fn x),0) : 0) +#endif /* lock offsets */ #define GLOBAL_LOCK 0 @@ -268,7 +276,7 @@ static int tdb_lock(TDB_CONTEXT *tdb, int list, int ltype) if (tdb->locked[list+1].count == 0) { if (!tdb->read_only && tdb->header.rwlocks) { if (tdb_spinlock(tdb, list, ltype)) { - TDB_LOG((tdb, 0, "tdb_lock spinlock failed on list ltype=%d\n", + TDB_LOG((tdb, 0, "tdb_lock spinlock failed on list %d ltype=%d\n", list, ltype)); return -1; } @@ -481,7 +489,7 @@ static int rec_free_read(TDB_CONTEXT *tdb, tdb_off off, struct list_struct *rec) if (rec->magic == TDB_MAGIC) { /* this happens when a app is showdown while deleting a record - we should not completely fail when this happens */ - TDB_LOG((tdb, 0,"rec_free_read non-free magic at offset=%d - fixing\n", + TDB_LOG((tdb, 0,"rec_free_read non-free magic 0x%x at offset=%d - fixing\n", rec->magic, off)); rec->magic = TDB_FREE_MAGIC; if (tdb_write(tdb, off, rec, sizeof(*rec)) == -1) @@ -617,8 +625,10 @@ int tdb_printfreelist(TDB_CONTEXT *tdb) static int remove_from_freelist(TDB_CONTEXT *tdb, tdb_off off, tdb_off next) { tdb_off last_ptr, i; + int maxloop; /* read in the freelist top */ + maxloop = LOOP_MAX; last_ptr = FREELIST_TOP; while (ofs_read(tdb, last_ptr, &i) != -1 && i != 0) { if (i == off) { @@ -627,6 +637,12 @@ static int remove_from_freelist(TDB_CONTEXT *tdb, tdb_off off, tdb_off next) } /* Follow chain (next offset is at start of record) */ last_ptr = i; + + maxloop--; + if (maxloop == 0) { + TDB_LOG((tdb, 0, "remove_from_freelist: maxloop reached; corrupt database!\n")); + return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); + } } TDB_LOG((tdb, 0,"remove_from_freelist: not on list at off=%d\n", off)); return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); @@ -853,6 +869,7 @@ static tdb_off tdb_allocate(TDB_CONTEXT *tdb, tdb_len length, { tdb_off rec_ptr, last_ptr, newrec_ptr; struct list_struct newrec; + int maxloop; if (tdb_lock(tdb, -1, F_WRLCK) == -1) return 0; @@ -868,6 +885,7 @@ static tdb_off tdb_allocate(TDB_CONTEXT *tdb, tdb_len length, goto fail; /* keep looking until we find a freelist record big enough */ + maxloop = LOOP_MAX; while (rec_ptr) { if (rec_free_read(tdb, rec_ptr, rec) == -1) goto fail; @@ -919,6 +937,12 @@ static tdb_off tdb_allocate(TDB_CONTEXT *tdb, tdb_len length, /* move to the next record */ last_ptr = rec_ptr; rec_ptr = rec->next; + + maxloop--; + if (maxloop == 0) { + TDB_LOG((tdb, 0, "tdb_allocate: maxloop reached; corrupt database!\n")); + return TDB_ERRCODE(TDB_ERR_CORRUPT, 0); + } } /* we didn't find enough space. See if we can expand the database and if we can then try again */ @@ -981,12 +1005,14 @@ static tdb_off tdb_find(TDB_CONTEXT *tdb, TDB_DATA key, u32 hash, struct list_struct *r) { tdb_off rec_ptr; - + int maxloop; + /* read in the hash top */ if (ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) return 0; /* keep looking until we find the right record */ + maxloop = LOOP_MAX; while (rec_ptr) { if (rec_read(tdb, rec_ptr, r) == -1) return 0; @@ -1006,6 +1032,12 @@ static tdb_off tdb_find(TDB_CONTEXT *tdb, TDB_DATA key, u32 hash, SAFE_FREE(k); } rec_ptr = r->next; + + maxloop--; + if (maxloop == 0) { + TDB_LOG((tdb, 0, "tdb_find maxloop reached; corrupt database!\n")); + return TDB_ERRCODE(TDB_ERR_CORRUPT, 0); + } } return TDB_ERRCODE(TDB_ERR_NOEXIST, 0); } @@ -1188,6 +1220,7 @@ static int do_delete(TDB_CONTEXT *tdb, tdb_off rec_ptr, struct list_struct*rec) { tdb_off last_ptr, i; struct list_struct lastrec; + int maxloop; if (tdb->read_only) return -1; @@ -1202,10 +1235,19 @@ static int do_delete(TDB_CONTEXT *tdb, tdb_off rec_ptr, struct list_struct*rec) /* find previous record in hash chain */ if (ofs_read(tdb, TDB_HASH_TOP(rec->full_hash), &i) == -1) return -1; - for (last_ptr = 0; i != rec_ptr; last_ptr = i, i = lastrec.next) + + maxloop = LOOP_MAX; + for (last_ptr = 0; i != rec_ptr; last_ptr = i, i = lastrec.next) { if (rec_read(tdb, i, &lastrec) == -1) return -1; + maxloop--; + if (maxloop == 0) { + TDB_LOG((tdb, 0, "(tdb)do_delete: maxloop reached; corrupt database!\n")); + return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); + } + } + /* unlink it: next ptr is at start of record. */ if (last_ptr == 0) last_ptr = TDB_HASH_TOP(rec->full_hash); @@ -1789,8 +1831,8 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, /* Is it already in the open list? If so, fail. */ if (tdb_already_open(st.st_dev, st.st_ino)) { TDB_LOG((tdb, 2, "tdb_open_ex: " - "%s (%d,%d) is already open in this process\n", - name, st.st_dev, st.st_ino)); + "%s (%d:%d,%ld) is already open in this process\n", + name, major(st.st_dev), minor(st.st_dev), st.st_ino)); errno = EBUSY; goto fail; } diff --git a/udev.c b/udev.c index e6f2744fcb..974b9582d0 100644 --- a/udev.c +++ b/udev.c @@ -36,6 +36,9 @@ #include "namedev.h" #include "udevdb.h" +/* timeout flag for udevdb */ +extern sig_atomic_t gotalarm; + /* global variables */ char **main_argv; char **main_envp; @@ -58,6 +61,10 @@ void log_message(int level, const char *format, ...) asmlinkage static void sig_handler(int signum) { switch (signum) { + case SIGALRM: + gotalarm = 1; + info("error: timeout reached, event probably not handled correctly"); + break; case SIGINT: case SIGTERM: udevdb_exit(); @@ -94,7 +101,8 @@ int main(int argc, char *argv[], char *envp[]) dbg("version %s", UDEV_VERSION); - /* initialize our configuration */ + init_logging("udev"); + udev_init_config(); if (strstr(argv[0], "udevstart")) { @@ -146,16 +154,19 @@ int main(int argc, char *argv[], char *envp[]) /* set signal handlers */ act.sa_handler = sig_handler; + sigemptyset (&act.sa_mask); - act.sa_flags = SA_RESTART; + /* alarm must interrupt syscalls*/ + sigaction(SIGALRM, &act, NULL); sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); + /* trigger timout to interrupt blocking syscalls */ + alarm(ALARM_TIMEOUT); + /* initialize udev database */ - if (udevdb_init(UDEVDB_DEFAULT) != 0) { - dbg("unable to initialize database"); - goto exit; - } + if (udevdb_init(UDEVDB_DEFAULT) != 0) + info("error: unable to initialize database, continuing without database"); switch(act_type) { case UDEVSTART: diff --git a/udev.h b/udev.h index 46c961c2d5..d66e9f626e 100644 --- a/udev.h +++ b/udev.h @@ -26,6 +26,9 @@ #include #include "libsysfs/sysfs/libsysfs.h" +#define ALARM_TIMEOUT 30 +#define WAIT_FOR_FILE_SECONDS 10 +#define WAIT_FOR_FILE_RETRY_FREQ 10 #define COMMENT_CHARACTER '#' #define NAME_SIZE 256 diff --git a/udev_add.c b/udev_add.c index e1e145de8a..78c78a1100 100644 --- a/udev_add.c +++ b/udev_add.c @@ -348,11 +348,10 @@ exit: /* wait for the "dev" file to show up in the directory in sysfs. * If it doesn't happen in about 10 seconds, give up. */ -#define SECONDS_TO_WAIT_FOR_FILE 10 static int sleep_for_file(const char *path, char* file) { char filename[SYSFS_PATH_MAX + 6]; - int loop = SECONDS_TO_WAIT_FOR_FILE; + int loop = WAIT_FOR_FILE_SECONDS * WAIT_FOR_FILE_RETRY_FREQ; int retval; strfieldcpy(filename, sysfs_path); @@ -368,7 +367,7 @@ static int sleep_for_file(const char *path, char* file) goto exit; /* sleep to give the kernel a chance to create the dev file */ - sleep(1); + usleep(1000 * 1000 / WAIT_FOR_FILE_RETRY_FREQ); } retval = -ENODEV; exit: diff --git a/udev_remove.c b/udev_remove.c index 7ad7c2402a..d4be8bd6f9 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -109,6 +109,7 @@ static int delete_node(struct udevice *dev) int i; char *pos; int len; + int num; strfieldcpy(filename, udev_root); strfieldcat(filename, dev->name); @@ -118,10 +119,15 @@ static int delete_node(struct udevice *dev) if (retval) return retval; - /* remove partition nodes */ - if (dev->partitions > 0) { - info("removing partitions '%s[1-%i]'", filename, dev->partitions); - for (i = 1; i <= dev->partitions; i++) { + /* remove all_partitions nodes */ + num = dev->partitions; + if (num > 0) { + info("removing all_partitions '%s[1-%i]'", filename, num); + if (num > PARTITIONS_COUNT) { + info("garbage from udev database, skip all_partitions removal"); + return -1; + } + for (i = 1; i <= num; i++) { strfieldcpy(partitionname, filename); strintcat(partitionname, i); secure_unlink(partitionname); diff --git a/udevdb.c b/udevdb.c index c4dc4f005c..a218b66179 100644 --- a/udevdb.c +++ b/udevdb.c @@ -42,13 +42,16 @@ #include "tdb/tdb.h" static TDB_CONTEXT *udevdb; - +sig_atomic_t gotalarm; int udevdb_add_dev(const char *path, const struct udevice *dev) { TDB_DATA key, data; char keystr[SYSFS_PATH_MAX]; + if (udevdb == NULL) + return -1; + if ((path == NULL) || (dev == NULL)) return -ENODEV; @@ -68,6 +71,9 @@ int udevdb_get_dev(const char *path, struct udevice *dev) { TDB_DATA key, data; + if (udevdb == NULL) + return -1; + if (path == NULL) return -ENODEV; @@ -88,6 +94,9 @@ int udevdb_delete_dev(const char *path) TDB_DATA key; char keystr[SYSFS_PATH_MAX]; + if (udevdb == NULL) + return -1; + if (path == NULL) return -EINVAL; @@ -121,6 +130,8 @@ int udevdb_init(int init_flag) if (init_flag != UDEVDB_DEFAULT && init_flag != UDEVDB_INTERNAL) return -EINVAL; + tdb_set_lock_alarm(&gotalarm); + udevdb = tdb_open(udev_db_filename, 0, init_flag, O_RDWR | O_CREAT, 0644); if (udevdb == NULL) { if (init_flag == UDEVDB_INTERNAL) @@ -160,6 +171,9 @@ int udevdb_call_foreach(int (*user_record_handler) (char *path, struct udevice * { int retval = 0; + if (udevdb == NULL) + return -1; + if (user_record_handler == NULL) { dbg("invalid user record handling function"); return -EINVAL; diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index f87253d044..a5d8ab4111 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -101,11 +101,11 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev return -1; } -/* skip waiting for physical device */ +/* check if we need to wait for a physical device */ static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev) { - /* List of devices without a "device" symlink - * set .device to NULL to accept all devices in that subsystem */ + /* list of devices without a "device" symlink to the physical device + * if device is set to NULL, no devices in that subsystem has a link */ static struct class_device { char *subsystem; char *device; @@ -160,10 +160,9 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d struct class_device *classdevice; int len; - /* look if we want to look for another file instead of "dev" */ for (classdevice = class_device; classdevice->subsystem != NULL; classdevice++) { if (strcmp(class_dev->classname, classdevice->subsystem) == 0) { - /* if device is NULL, all devices in this class are ok */ + /* see if no device in this class is expected to have a device-link */ if (classdevice->device == NULL) return 1; @@ -173,11 +172,11 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d if (strncmp(class_dev->name, classdevice->device, len) != 0) continue; - /* exact match */ + /* exact name match */ if (strlen(class_dev->name) == len) return 1; - /* instance numbers are matching too */ + /* name match with instance number */ if (isdigit(class_dev->name[len])) return 1; } -- cgit v1.2.3-54-g00ecf From dc117daa28c87c6be5846a23f06e16c2b6ff6bc1 Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Wed, 13 Oct 2004 22:37:59 -0700 Subject: [PATCH] fix incompatible pointer type warning This patch fixes two warning: assignment from incompatible pointer type asmlinkage is the reason for the warning. We can simply cast to avoid it. It also fixes this warning: warning: implicit declaration of function `umask' --- udev.c | 2 +- udevd.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/udev.c b/udev.c index 974b9582d0..78da715fec 100644 --- a/udev.c +++ b/udev.c @@ -153,7 +153,7 @@ int main(int argc, char *argv[], char *envp[]) } /* set signal handlers */ - act.sa_handler = sig_handler; + act.sa_handler = (void (*) (int))sig_handler; sigemptyset (&act.sa_mask); /* alarm must interrupt syscalls*/ diff --git a/udevd.c b/udevd.c index 81f4474a89..380511d47e 100644 --- a/udevd.c +++ b/udevd.c @@ -35,6 +35,7 @@ #include #include "klibc_fixups.h" #include +#include #include "list.h" #include "udev.h" @@ -457,7 +458,7 @@ int main(int argc, char *argv[]) /* set signal handlers */ - act.sa_handler = sig_handler; + act.sa_handler = (void (*) (int))sig_handler; sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); -- cgit v1.2.3-54-g00ecf From e5a5b54ab675988febeaa9cd831e21e675d5947b Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Wed, 13 Oct 2004 22:38:15 -0700 Subject: [PATCH] fix asmlinkage This patch fixes the reintroduced bug with the sig_handler(), if we link against a -mregparm=3 compiled klibc on i386. It also fixes some compiler warnings about redefined asmlinkage on some systems. Also some (broken?) compilers on distros throw out warnings if asmlinkage is before "static void". This fixes it, too. --- Makefile | 2 +- udev.c | 2 +- udev_lib.h | 9 +++++++++ udevd.c | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4107b96a3f..4b8df13985 100644 --- a/Makefile +++ b/Makefile @@ -112,7 +112,7 @@ OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2> # add -Wredundant-decls when libsysfs gets cleaned up WARNINGS := -Wall -CFLAGS := -pipe -Dasmlinkage= +CFLAGS := -pipe # set up the proper tdb spinlock code if we can ifeq ($(strip $(ARCH)),i386) diff --git a/udev.c b/udev.c index 78da715fec..94888d6a43 100644 --- a/udev.c +++ b/udev.c @@ -58,7 +58,7 @@ void log_message(int level, const char *format, ...) } #endif -asmlinkage static void sig_handler(int signum) +static void asmlinkage sig_handler(int signum) { switch (signum) { case SIGALRM: diff --git a/udev_lib.h b/udev_lib.h index 2f1965ea32..e9ff379fc6 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -65,6 +65,15 @@ do { \ pos = pos + len + strspn(pos, separator), len = strcspn(pos, separator)) \ if (len > 0) +#ifdef asmlinkage +# undef asmlinkage +#endif +#ifdef __i386__ +# define asmlinkage __attribute__((regparm(0))) +#endif +#ifndef asmlinkage +# define asmlinkage /* nothing */ +#endif extern char *get_action(void); extern char *get_devpath(void); diff --git a/udevd.c b/udevd.c index 380511d47e..811f62243e 100644 --- a/udevd.c +++ b/udevd.c @@ -309,7 +309,7 @@ skip: return; } -asmlinkage static void sig_handler(int signum) +static void asmlinkage sig_handler(int signum) { int rc; -- cgit v1.2.3-54-g00ecf From d38c486a519b7ba2acb06d57e0335a4a09adc355 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 22:51:41 -0700 Subject: [PATCH] add ipsec to wait_for_sysfs ignore list. --- wait_for_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index a5d8ab4111..6f396b96ca 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -143,6 +143,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "ppp" }, { .subsystem = "net", .device = "lo" }, { .subsystem = "net", .device = "tap" }, + { .subsystem = "net", .device = "ipsec" }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, { .subsystem = "nvidia", .device = NULL }, -- cgit v1.2.3-54-g00ecf From a6150f4a8a45b0d53162b92e574f53a01d94c432 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 22:52:08 -0700 Subject: [PATCH] add wait_for_sysfs test script to the tarball to help people debug their boxes. --- test/wait_for_sysfs_test.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 test/wait_for_sysfs_test.sh diff --git a/test/wait_for_sysfs_test.sh b/test/wait_for_sysfs_test.sh new file mode 100644 index 0000000000..f299d23c94 --- /dev/null +++ b/test/wait_for_sysfs_test.sh @@ -0,0 +1,40 @@ +#! /bin/sh +# + +# Check for missing binaries (stale symlinks should not happen) +UDEV_BIN=../wait_for_sysfs +test -x $UDEV_BIN || exit 5 + +# Directory where sysfs is mounted +SYSFS_DIR=/sys + +run_udev () { + # handle block devices and their partitions + for i in ${SYSFS_DIR}/block/*; do + # add each drive + export DEVPATH=${i#${SYSFS_DIR}} + $UDEV_BIN block & + + # add each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + export DEVPATH=${j#${SYSFS_DIR}} + $UDEV_BIN block + fi + done + done + # all other device classes + for i in ${SYSFS_DIR}/class/*; do + for j in $i/*; do +# if [ -f $j/dev ]; then + export DEVPATH=${j#${SYSFS_DIR}} + CLASS=`echo ${i#${SYSFS_DIR}} | \ + cut --delimiter='/' --fields=3-` + $UDEV_BIN $CLASS +# fi + done + done +} + +export ACTION=add +run_udev -- cgit v1.2.3-54-g00ecf From f93987240e34ceb5cc4f9cdde59a54b1a0011ee1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 23:16:02 -0700 Subject: [PATCH] merge --- udev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/udev.c b/udev.c index 94888d6a43..d7fa327576 100644 --- a/udev.c +++ b/udev.c @@ -154,7 +154,6 @@ int main(int argc, char *argv[], char *envp[]) /* set signal handlers */ act.sa_handler = (void (*) (int))sig_handler; - sigemptyset (&act.sa_mask); /* alarm must interrupt syscalls*/ sigaction(SIGALRM, &act, NULL); -- cgit v1.2.3-54-g00ecf From 8dc0e1382d5a0103e169b95b583e4b03b9080161 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 23:22:37 -0700 Subject: [PATCH] Fix build error with klibc due to recent changes. --- udev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev.c b/udev.c index d7fa327576..a13f7013b6 100644 --- a/udev.c +++ b/udev.c @@ -20,6 +20,7 @@ * */ +#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #include #include -- cgit v1.2.3-54-g00ecf From b51a038ca59d50fb089fd92addaf815994e6d3e7 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 23:26:05 -0700 Subject: [PATCH] fix compilation warning in tdb log message. --- tdb/tdb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tdb/tdb.c b/tdb/tdb.c index 4cc1e07024..af475bb7ad 100644 --- a/tdb/tdb.c +++ b/tdb/tdb.c @@ -1831,8 +1831,8 @@ TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, /* Is it already in the open list? If so, fail. */ if (tdb_already_open(st.st_dev, st.st_ino)) { TDB_LOG((tdb, 2, "tdb_open_ex: " - "%s (%d:%d,%ld) is already open in this process\n", - name, major(st.st_dev), minor(st.st_dev), st.st_ino)); + "%s (%d:%d,%lld) is already open in this process\n", + name, major(st.st_dev), minor(st.st_dev), (unsigned long long)st.st_ino)); errno = EBUSY; goto fail; } -- cgit v1.2.3-54-g00ecf From e457f010b1360ce92a26018a933eefaaed03d520 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 13 Oct 2004 23:58:54 -0700 Subject: [PATCH] 037 release --- ChangeLog | 31 +++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7b16430849..c01448ee42 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +Summary of changes from v036 to v037 +============================================ + +: + o small udev patch + +Greg Kroah-Hartman: + o fix compilation warning in tdb log message + o Fix build error with klibc due to recent changes + o merge + o add wait_for_sysfs test script to the tarball to help people debug their boxes + o add ipsec to wait_for_sysfs ignore list + o added ccdv to bk ignore list + o a few more Makefile tweaks for the quiet feature + o Make the build silent, thanks to a helper program from ncftp + o rename files to have '_' instead of '-' in them + o change max time to wait in wait_for_sysfs to 10 seconds to hopefully handle some slow machines + o add support for class/raw/ to wait_for_sysfs + o fix up Makefile for wait_for_sysfs udev_version.h dependancy + o remove the debian specific file, as they don't want to share with the rest of the world :( + o 036 release TAG: v036 + +Kay Sievers: + o prevent deadlocks on an corrupt udev database + o wait_for_sysfs_update + +Michael Buesch: + o fix asmlinkage + o fix incompatible pointer type warning + + Summary of changes from v035 to v036 ============================================ diff --git a/Makefile b/Makefile index 4b8df13985..e51a050926 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ TESTER = udevtest STARTER = udevstart RULER = udevruler WAIT = wait_for_sysfs -VERSION = 036 +VERSION = 037 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index d466804659..a2ef95fb38 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 036 +Version: 037 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From c008fe93f5252d47f82d7f00e423983bda9ce1e3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 14 Oct 2004 00:38:08 -0700 Subject: [PATCH] fix up error in building extras and libsysfs --- Makefile | 1 - extras/scsi_id/Makefile | 8 +++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index e51a050926..1f9578e7f4 100644 --- a/Makefile +++ b/Makefile @@ -184,7 +184,6 @@ all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(WAIT) $(GEN_CONFIGS) echo $$target ; \ $(MAKE) prefix=$(prefix) \ LD="$(LD)" \ - SYSFS="$(SYSFS)" \ KERNEL_DIR="$(KERNEL_DIR)" \ -C $$target $@ ; \ done ; \ diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 7ccc4c5118..6a73e33785 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -31,8 +31,14 @@ INSTALL_DATA = ${INSTALL} -m 644 override CFLAGS+=-Wall -fno-builtin PROG=scsi_id -SYSFS=-lsysfs +SYSFS = ../../libsysfs/sysfs_bus.o \ + ../../libsysfs/sysfs_class.o \ + ../../libsysfs/sysfs_device.o \ + ../../libsysfs/sysfs_dir.o \ + ../../libsysfs/sysfs_driver.o \ + ../../libsysfs/sysfs_utils.o \ + ../../libsysfs/dlist.o # # Built static and stripped when built with udev. # -- cgit v1.2.3-54-g00ecf From 1fa26490e0d3b0df595fc7d327be46e4d9586bf7 Mon Sep 17 00:00:00 2001 From: "andrew.patterson@hp.com" Date: Thu, 14 Oct 2004 00:47:38 -0700 Subject: [PATCH] Problem parsing %s in udev rules > > > > That explains the spaces. What about stuff trailing %s, if %s does not > > > > contain spaces. I.e, in the above example, model is ST336753LC and the > > > > resulting device file is /dev/scsi_disks/some-proceding-stuff- > > > > ST336753LC. > > > > > > I expect the model value has trailing spaces. > > > > > > You may look with: > > > udevinfo -a -p /block/sdX > > > > Yes it does, and it seems for most SCSI devices, vendor and model will > > have trailing spaces. > > It all depends on the vendor and model :) > > > I have included a patch to udev-036 to deal with > > this issue. It trims off trailing whitespace for all sysfs attributes. > > It might be better to trim off leading whitespace as well. > > We already trim it off when matching, but we also allow matching if you > do put the spaces in there. This patch breaks that, right? Correct, I have a new patch that trims after the comparison, so it should work in both cases. --- namedev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/namedev.c b/namedev.c index 9276b0cbba..8a4436363d 100644 --- a/namedev.c +++ b/namedev.c @@ -306,6 +306,17 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("sysfa attribute '%s' not found", attr); break; } + /* strip trailing whitespace of matching value */ + if (isspace(tmpattr->value[strlen(tmpattr->value)-1])) { + i = len = strlen(tmpattr->value); + while (i > 0 && isspace(tmpattr->value[i-1])) + i--; + if (i < len) { + tmpattr->value[i] = '\0'; + dbg("remove %i trailing whitespace chars from '%s'", + len - i, tmpattr->value); + } + } strfieldcatmax(string, tmpattr->value, maxsize); dbg("substitute sysfs value '%s'", tmpattr->value); } else { -- cgit v1.2.3-54-g00ecf From 817c223af360b7ca518c9fe3065c641f6a17fbd3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 14 Oct 2004 00:49:55 -0700 Subject: [PATCH] 038 release --- ChangeLog | 18 +++++++++--------- Makefile | 2 +- udev.spec | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index c01448ee42..0c190852d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Summary of changes from v037 to v038 +============================================ + +: + o Re: Problem parsing %s in udev rules + +Greg Kroah-Hartman: + o fix up error in building extras and libsysfs + Summary of changes from v036 to v037 ============================================ @@ -18,7 +27,6 @@ Greg Kroah-Hartman: o add support for class/raw/ to wait_for_sysfs o fix up Makefile for wait_for_sysfs udev_version.h dependancy o remove the debian specific file, as they don't want to share with the rest of the world :( - o 036 release TAG: v036 Kay Sievers: o prevent deadlocks on an corrupt udev database @@ -134,7 +142,6 @@ Greg Kroah-Hartman: o Fix old-style pty breakage in rules file for tty device o add rules for i386 cpu devices o add permission for legotower usb devices - o 030 release TAG: v030 Kay Sievers: o Fix naming ethernet devices in udevstart @@ -273,7 +280,6 @@ Greg Kroah-Hartman: o added rule to put USB printers in their proper places o added rules for CAPI devices o added a dev.d alsa script to help people out - o v024 release TAG: v024 Kay Sievers: o fix test regressions @@ -388,7 +394,6 @@ Greg Kroah-Hartman: o mark scsi-devfs.sh as executable o Increase the name size as requested by Richard Gooch o fix udevtest to build properly after the big udev_lib change - o 022 release TAG: v022 Olaf Hering: o uninitialized variable for mknod and friend @@ -446,7 +451,6 @@ Greg Kroah-Hartman: o deleted current extras/multipath directory o 021_bk mark o fix the build for older versions of gcc - o 021 release TAG: v021 Hanna V. Linder: o Small fix to remove extra "will" in man page @@ -594,7 +598,6 @@ Greg Kroah-Hartman: o 017_bk mark o Add another test to udev-test.pl and fix a bug when only running 1 test o Fix bug where we did not use the "converted" kernel name if we had no rule - o v017 release TAG: v017 Patrick Mansfield: o udev use new libsysfs header file location @@ -757,7 +760,6 @@ Greg Kroah-Hartman: o add usb_host and pci_bus to the class blacklist o added input device rules to udev.rules and udev.rules.devfs o 013_bk mark - o v013 release TAG: v013 Hanna V. Linder: o set default owner/group in db @@ -1227,7 +1229,6 @@ Greg Kroah-Hartman: o Fix bug causing udev to sleep forever waiting for dev file to show up o change version to 004_bk o make config files, sysfs root, and udev root configurable from config variables - o 004 changelog entrys TAG: v004 Robert Love: o udev: sleep_for_dev() bits @@ -1254,7 +1255,6 @@ Greg Kroah-Hartman: o change the version to 003-bk to keep things sane with people using the bk tree o got "remove of named devices" working o fix segfaults when dealing with partitions - o update changelog for 003 release TAG: v003 Kay Sievers: o man file update diff --git a/Makefile b/Makefile index 1f9578e7f4..4849eff46d 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ TESTER = udevtest STARTER = udevstart RULER = udevruler WAIT = wait_for_sysfs -VERSION = 037 +VERSION = 038 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index a2ef95fb38..cb0686ea2b 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 037 +Version: 038 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 218f11bcf1ab339216337405a70e6cd0ec56a644 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 14 Oct 2004 01:42:33 -0700 Subject: [PATCH] Makefile fix Remove the rest of the debian stuff too, to make install working again. --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 4849eff46d..9922d6f173 100644 --- a/Makefile +++ b/Makefile @@ -362,13 +362,11 @@ small_release: $(DISTFILES) clean @echo "Built $(RELEASE_NAME).tar.gz" -install-initscript: etc/init.d/udev etc/init.d/udev.debian etc/init.d/udev.init.LSB +install-initscript: etc/init.d/udev etc/init.d/udev.init.LSB @if [ -f /etc/redhat-release ]; then \ $(INSTALL_DATA) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ elif [ -f /etc/SuSE-release ]; then \ $(INSTALL_DATA) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ - elif [ -f /etc/debian_version ]; then \ - $(INSTALL_DATA) -D etc/init.d/udev.debian $(DESTDIR)$(initdir)/udev; \ fi install-config: -- cgit v1.2.3-54-g00ecf From 053083431ff02dd365eb8c6fe12749b90d2a2a1f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 14 Oct 2004 19:42:52 -0700 Subject: [PATCH] fix broken 'make -j5' functionality. --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9922d6f173..28823d7f2a 100644 --- a/Makefile +++ b/Makefile @@ -263,17 +263,16 @@ udev_version.h: @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ # Rules on how to create the generated config files -$(LOCAL_CFG_DIR)/udev.conf: +$(LOCAL_CFG_DIR)/udev.conf: $(HOST_PROGS) $(QUIET) sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ GEN_MANPAGES = udev.8 GEN_MANPAGESIN = udev.8.in # Rules on how to create the man pages -$(GEN_MANPAGES): $(GEN_MANPAGESIN) +$(GEN_MANPAGES): $(GEN_MANPAGESIN) $(HOST_PROGS) $(QUIET) sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ - -$(OBJS): $(GEN_HEADERS) +$(OBJS): $(GEN_HEADERS) $(HOST_PROGS) $(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS) $(TESTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(INFO).o: $(GEN_HEADERS) $(HOST_PROGS) -- cgit v1.2.3-54-g00ecf From 32935a50ea9d0f97f9416da1512c11a346888d28 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 14 Oct 2004 20:36:04 -0700 Subject: [PATCH] delete udevruler? Hey, we got consistent source filenames today. Let's go ahead :) I once started this ambitiuos curses gui to edit udev rules files. udevruler still lays dead around in the tree. I will not finish it and it is not really useful at his state. If nobody wants to do something for it, I'm for deleting it. --- Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 28823d7f2a..167c88e55e 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,6 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -RULER = udevruler WAIT = wait_for_sysfs VERSION = 038 INSTALL_DIR = /usr/local/bin @@ -301,10 +300,6 @@ $(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ -$(RULER): $(LIBC) $(RULER).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevruler.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) -lnewt - $(QUIET) $(STRIPCMD) $@ - $(WAIT): $(WAIT).o $(OBJS) $(HEADERS) $(LIBC) $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(WAIT).o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ @@ -318,7 +313,7 @@ $(WAIT): $(WAIT).o $(OBJS) $(HEADERS) $(LIBC) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(RULER) $(WAIT) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(WAIT) -rm -f ccdv $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ -- cgit v1.2.3-54-g00ecf From 707680b1cf08369da365de1a5e06089621ff8c77 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 14 Oct 2004 20:36:07 -0700 Subject: [PATCH] remove sleeps from udev as it is external now Here we remove all the sysfs sleep loops from udev as wait_for_sysfs will do this for us and any other hotplug user. We still keep a small blacklist of subsystems we don't care about but any missing entry here will no longer lead to a spinning udev waiting for files. --- namedev.c | 189 ++++++---------------------------------------------------- udev.8.in | 7 --- udev.c | 52 ++++++++++------ udev.h | 3 - udev_add.c | 61 +++---------------- udev_config.c | 6 -- 6 files changed, 57 insertions(+), 261 deletions(-) diff --git a/namedev.c b/namedev.c index 8a4436363d..39f033726c 100644 --- a/namedev.c +++ b/namedev.c @@ -346,69 +346,6 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, } } -/* - * Note, we can have multiple files for different busses in here due - * to the mess that USB has for its device tree... - */ -static struct bus_file { - char *bus; - char *file; -} bus_files[] = { - { .bus = "scsi", .file = "vendor" }, - { .bus = "usb", .file = "idVendor" }, - { .bus = "usb", .file = "iInterface" }, - { .bus = "usb-serial", .file = "detach_state" }, - { .bus = "ide", .file = "detach_state" }, - { .bus = "pci", .file = "vendor" }, - {} -}; - -static void wait_for_device_to_initialize(struct sysfs_device *sysfs_device) -{ - /* sleep until we see the file for this specific bus type show up this - * is needed because we can easily out-run the kernel in looking for - * these files before the paticular subsystem has created them in the - * sysfs tree properly. - * - * And people thought that the /sbin/hotplug event system was going to - * be slow, poo on you for arguing that before even testing it... - */ - struct bus_file *b = &bus_files[0]; - struct sysfs_attribute *tmpattr; - int found = 0; - int loop = WAIT_FOR_FILE_SECONDS * WAIT_FOR_FILE_RETRY_FREQ; - - while (1) { - if (b->bus == NULL) { - if (!found) - break; - /* give the kernel a chance to create the file */ - usleep(1000 * 1000 / WAIT_FOR_FILE_RETRY_FREQ); - --loop; - if (loop == 0) - break; - b = &bus_files[0]; - } - if (strcmp(sysfs_device->bus, b->bus) == 0) { - found = 1; - dbg("looking for file '%s' on bus '%s'", b->file, b->bus); - tmpattr = sysfs_get_device_attr(sysfs_device, b->file); - if (tmpattr) { - /* found it! */ - goto exit; - } - dbg("can't find '%s' file", b->file); - } - ++b; - } - if (!found) - dbg("did not find bus type '%s' on list of bus_id_files, " - "please report to ", - sysfs_device->bus); -exit: - return; /* here to prevent compiler warning... */ -} - static void fix_kernel_name(struct udevice *udev) { char *temp = udev->kernel_name; @@ -650,108 +587,6 @@ static int match_place(struct config_device *dev, struct sysfs_class_device *cla return 0; } -static int whitelist_search(struct sysfs_class_device *class_dev) -{ - char *sysblock = "/sys/block"; - int i; - - static char *list[] = { - "nb", - "ram", - "loop", - "fd", - "md", - "dos_cd", - "double", - "flash", - "msd", - "rflash", - "rom", - "rrom", - "sbpcd", - "pcd", - "pf", - "scd", - "ubd", - NULL, - }; - - if (strncmp(class_dev->path, sysblock, strlen(sysblock))) - return 0; - - for (i=0; list[i] != NULL; i++) - if (!strncmp(class_dev->name, list[i], strlen(list[i]))) - return 1; - - return 0; -} - -static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_dev) -{ - struct sysfs_device *sysfs_device; - struct sysfs_class_device *class_dev_parent; - int loop; - - /* Figure out where the device symlink is at. For char devices this will - * always be in the class_dev->path. But for block devices, it's different. - * The main block device will have the device symlink in it's path, but - * all partitions have the symlink in its parent directory. - * But we need to watch out for block devices that do not have parents, yet - * look like a partition (fd0, loop0, etc.) They all do not have a device - * symlink yet. We do sit and spin on waiting for them right now unless - * they happen to be in the whitelist in which case we exit. - */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) - dbg("given class device has a parent, use this instead"); - - loop = WAIT_FOR_FILE_SECONDS * WAIT_FOR_FILE_RETRY_FREQ; - while (loop--) { - if (udev_sleep) { - if (whitelist_search(class_dev)) { - sysfs_device = NULL; - goto exit; - } - usleep(1000 * 1000 / WAIT_FOR_FILE_RETRY_FREQ); - } - - if (class_dev_parent) - sysfs_device = sysfs_get_classdev_device(class_dev_parent); - else - sysfs_device = sysfs_get_classdev_device(class_dev); - if (sysfs_device != NULL) - goto device_found; - } - dbg("timed out waiting for device symlink, continuing on anyway..."); - -device_found: - /* We have another issue with just the wait above - the sysfs part of - * the kernel may not be quick enough to have created the link to the - * device under the "bus" subsystem. Due to this, the sysfs_device->bus - * will not contain the actual bus name :( - */ - if (sysfs_device) { - if (sysfs_device->bus[0] != '\0') - goto bus_found; - - while (loop--) { - if (udev_sleep) - usleep(1000 * 1000 / WAIT_FOR_FILE_RETRY_FREQ); - sysfs_get_device_bus(sysfs_device); - - if (sysfs_device->bus[0] != '\0') - goto bus_found; - } - dbg("timed out waiting to find the device bus, continuing on anyway"); - goto exit; -bus_found: - dbg("device %s is registered with bus '%s'", - sysfs_device->name, sysfs_device->bus); - } -exit: - return sysfs_device; -} - static int match_rule(struct config_device *dev, struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) { while (1) { @@ -859,6 +694,7 @@ try_parent: int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) { + struct sysfs_class_device *class_dev_parent; struct sysfs_device *sysfs_device = NULL; struct config_device *dev; struct perm_device *perm; @@ -866,17 +702,26 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud char *pos; udev->mode = 0; + dbg("class_dev->name='%s'", class_dev->name); + + /* Figure out where the "device"-symlink is at. For char devices this will + * always be in the class_dev->path. On block devices, only the main block + * device will have the device symlink in it's path. All partition devices + * need to look at the symlink in its parent directory. + */ + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent != NULL) { + dbg("given class device has a parent, use this instead"); + sysfs_device = sysfs_get_classdev_device(class_dev_parent); + } else { + sysfs_device = sysfs_get_classdev_device(class_dev); + } - /* find the sysfs_device associated with this class device */ - sysfs_device = get_sysfs_device(class_dev); if (sysfs_device) { - dbg("sysfs_device->path='%s'", sysfs_device->path); - dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); - dbg("sysfs_device->bus='%s'", sysfs_device->bus); + dbg("found /device-device: path='%s', bus_id='%s', bus='%s'", + sysfs_device->path, sysfs_device->bus_id, sysfs_device->bus); strfieldcpy(udev->bus_id, sysfs_device->bus_id); - wait_for_device_to_initialize(sysfs_device); } - dbg("class_dev->name = '%s'", class_dev->name); strfieldcpy(udev->kernel_name, class_dev->name); fix_kernel_name(udev); diff --git a/udev.8.in b/udev.8.in index 9c22f8aa63..c842e7befb 100644 --- a/udev.8.in +++ b/udev.8.in @@ -20,13 +20,6 @@ Overrides the default location of the .B udev config file. .TP -.B UDEV_NO_SLEEP -The default behavior of -.B udev -is to wait until all the sysfs files of the device chain are populated. If set, -.B udev -will continue, regardless of the state of the device representation. -.TP .B UDEV_NO_DEVD The default behavior of .B udev diff --git a/udev.c b/udev.c index a13f7013b6..d98a017396 100644 --- a/udev.c +++ b/udev.c @@ -75,14 +75,34 @@ static void asmlinkage sig_handler(int signum) } } -static char *subsystem_blacklist[] = { - "scsi_host", - "scsi_device", - "usb_host", - "pci_bus", - "pcmcia_socket", - "" -}; +/* list of subsystems we don't care about. not listing such systems here + * is not critical, but it makes it faster as we don't look for the "dev" file + */ +static int subsystem_without_dev(const char *subsystem) +{ + char *subsystem_blacklist[] = { + "scsi_host", + "scsi_device", + "usb_host", + "pci_bus", + "pcmcia_socket", + "bluetooth", + "i2c-adapter", + "pci_bus", + "ieee1394", + "ieee1394_host", + "ieee1394_node", + NULL + }; + char **subsys; + + for (subsys = subsystem_blacklist; *subsys != NULL; subsys++) { + if (strcmp(subsystem, *subsys) == 0) + return 1; + } + + return 0; +} int main(int argc, char *argv[], char *envp[]) { @@ -92,7 +112,6 @@ int main(int argc, char *argv[], char *envp[]) char *action; char *devpath = ""; char *subsystem = ""; - int i; int retval = -EINVAL; enum { ADD, @@ -143,20 +162,16 @@ int main(int argc, char *argv[], char *envp[]) } /* skip blacklisted subsystems */ - i = 0; - while (subsystem_blacklist[i][0] != '\0') { - if (strcmp(subsystem, subsystem_blacklist[i]) == 0) { - dbg("don't care about '%s' devices", subsystem); - goto exit; - } - i++; - } + if (subsystem_without_dev(subsystem)) { + dbg("don't care about '%s' devices", subsystem); + exit(0); + }; } /* set signal handlers */ act.sa_handler = (void (*) (int))sig_handler; sigemptyset (&act.sa_mask); - /* alarm must interrupt syscalls*/ + /* alarm must not restart syscalls*/ sigaction(SIGALRM, &act, NULL); sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); @@ -172,7 +187,6 @@ int main(int argc, char *argv[], char *envp[]) case UDEVSTART: dbg("udevstart"); namedev_init(); - udev_sleep = 0; retval = udev_start(); break; case ADD: diff --git a/udev.h b/udev.h index d66e9f626e..642b30b517 100644 --- a/udev.h +++ b/udev.h @@ -27,8 +27,6 @@ #include "libsysfs/sysfs/libsysfs.h" #define ALARM_TIMEOUT 30 -#define WAIT_FOR_FILE_SECONDS 10 -#define WAIT_FOR_FILE_RETRY_FREQ 10 #define COMMENT_CHARACTER '#' #define NAME_SIZE 256 @@ -90,7 +88,6 @@ extern char default_mode_str[MODE_SIZE]; extern char default_owner_str[OWNER_SIZE]; extern char default_group_str[GROUP_SIZE]; extern int udev_log; -extern int udev_sleep; extern int udev_dev_d; #endif diff --git a/udev_add.c b/udev_add.c index 78c78a1100..08257609ad 100644 --- a/udev_add.c +++ b/udev_add.c @@ -52,14 +52,9 @@ #include "selinux.h" -/* - * Right now the major/minor of a device is stored in a file called - * "dev" in sysfs. - * The number is stored as: - * MM:mm - * MM is the major - * mm is the minor - * The value is in decimal. +/* + * the major/minor of a device is stored in a file called "dev" + * The number is stored in decimal values in the format: M:m */ static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) { @@ -345,35 +340,6 @@ exit: return class_dev; } -/* wait for the "dev" file to show up in the directory in sysfs. - * If it doesn't happen in about 10 seconds, give up. - */ -static int sleep_for_file(const char *path, char* file) -{ - char filename[SYSFS_PATH_MAX + 6]; - int loop = WAIT_FOR_FILE_SECONDS * WAIT_FOR_FILE_RETRY_FREQ; - int retval; - - strfieldcpy(filename, sysfs_path); - strfieldcat(filename, path); - strfieldcat(filename, file); - - while (loop--) { - struct stat buf; - - dbg("looking for '%s'", filename); - retval = stat(filename, &buf); - if (retval == 0) - goto exit; - - /* sleep to give the kernel a chance to create the dev file */ - usleep(1000 * 1000 / WAIT_FOR_FILE_RETRY_FREQ); - } - retval = -ENODEV; -exit: - return retval; -} - static int rename_net_if(struct udevice *dev, int fake) { int sk; @@ -408,25 +374,11 @@ int udev_add_device(const char *path, const char *subsystem, int fake) struct udevice dev; char devpath[DEVPATH_SIZE]; char *pos; - int retval; + int retval = 0; memset(&dev, 0x00, sizeof(dev)); dev.type = get_device_type(path, subsystem); - switch (dev.type) { - case 'b': - case 'c': - retval = sleep_for_file(path, "/dev"); - break; - - case 'n': - retval = sleep_for_file(path, "/address"); - break; - - default: - dbg("unknown device type '%c'", dev.type); - return -1; - } class_dev = get_class_dev(path); if (class_dev == NULL) @@ -435,8 +387,8 @@ int udev_add_device(const char *path, const char *subsystem, int fake) if (dev.type == 'b' || dev.type == 'c') { retval = get_major_minor(class_dev, &dev); if (retval != 0) { - dbg("get_major_minor failed"); - goto exit; + dbg("no dev-file found, do nothing"); + goto close; } } @@ -484,6 +436,7 @@ int udev_add_device(const char *path, const char *subsystem, int fake) exit: selinux_restore(); +close: sysfs_close_class_device(class_dev); return retval; diff --git a/udev_config.c b/udev_config.c index ba2b3d2b88..ae755f39fd 100644 --- a/udev_config.c +++ b/udev_config.c @@ -50,7 +50,6 @@ char default_mode_str[MODE_SIZE]; char default_owner_str[OWNER_SIZE]; char default_group_str[GROUP_SIZE]; int udev_log; -int udev_sleep; int udev_dev_d; @@ -79,11 +78,6 @@ static void init_variables(void) strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE); udev_log = string_is_true(UDEV_LOG_DEFAULT); - udev_sleep = 1; - env = getenv("UDEV_NO_SLEEP"); - if (env && string_is_true(env)) - udev_sleep = 0; - udev_dev_d = 1; env = getenv("UDEV_NO_DEVD"); if (env && string_is_true(env)) -- cgit v1.2.3-54-g00ecf From a75910b4c071c6033e72e18197284eda0bd08f4a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 14 Oct 2004 20:36:10 -0700 Subject: [PATCH] fix unusual sysfs behavior for pcmcia_socket All files in /sys/class/pcmcia_socket/pcmcia_socket0/* are unreadable without a card inserted: read(3, 0x9167858, 4096) = -1 ENODEV (No such device) So we need to skip that step for now. --- wait_for_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 6f396b96ca..292edfad13 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -60,7 +60,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev { .subsystem = "net", .file = "ifindex" }, { .subsystem = "scsi_host", .file = "unique_id" }, { .subsystem = "scsi_device", .file = NULL }, - { .subsystem = "pcmcia_socket", .file = "card_type" }, + { .subsystem = "pcmcia_socket", .file = NULL }, /* all files are unreadable in empty slot :( */ { .subsystem = "usb_host", .file = NULL }, { .subsystem = "bluetooth", .file = "address" }, { .subsystem = "i2c-adapter", .file = NULL }, -- cgit v1.2.3-54-g00ecf From 139087e844b5e2a7f029b608db6a855cb2ca1ac3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 14 Oct 2004 20:36:12 -0700 Subject: [PATCH] wait_for_sysfs update for /class/firmware and /class/net/irda devices update for /class/firmware and /class/net/irda devices --- wait_for_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 292edfad13..25a3fb4eef 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -63,6 +63,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev { .subsystem = "pcmcia_socket", .file = NULL }, /* all files are unreadable in empty slot :( */ { .subsystem = "usb_host", .file = NULL }, { .subsystem = "bluetooth", .file = "address" }, + { .subsystem = "firmware", .file = "data" }, { .subsystem = "i2c-adapter", .file = NULL }, { .subsystem = "pci_bus", .file = NULL }, { .subsystem = "ieee1394", .file = NULL }, @@ -144,6 +145,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "lo" }, { .subsystem = "net", .device = "tap" }, { .subsystem = "net", .device = "ipsec" }, + { .subsystem = "net", .device = "irda" }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, { .subsystem = "nvidia", .device = NULL }, -- cgit v1.2.3-54-g00ecf From 31a6e02871315a298b906b0915c779369dcf3f62 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 15 Oct 2004 17:15:52 -0700 Subject: [PATCH] crap, I messed up the 'sed' instances pretty badly, this fixes the config and man page mess. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 167c88e55e..fd46a93a41 100644 --- a/Makefile +++ b/Makefile @@ -262,14 +262,14 @@ udev_version.h: @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ # Rules on how to create the generated config files -$(LOCAL_CFG_DIR)/udev.conf: $(HOST_PROGS) - $(QUIET) sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ +$(LOCAL_CFG_DIR)/udev.conf: + sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ GEN_MANPAGES = udev.8 GEN_MANPAGESIN = udev.8.in # Rules on how to create the man pages -$(GEN_MANPAGES): $(GEN_MANPAGESIN) $(HOST_PROGS) - $(QUIET) sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ +$(GEN_MANPAGES): $(GEN_MANPAGESIN) + sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ $(OBJS): $(GEN_HEADERS) $(HOST_PROGS) $(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS) -- cgit v1.2.3-54-g00ecf From 92307b9e7bb08e1086d213617df3552e3ff53d75 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Fri, 15 Oct 2004 18:18:54 -0700 Subject: [PATCH] move assignments past local variables I'm using an older C compiler, and it doesn't like assignments mixed with declarations, but this is also a style cleanup. --- udev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udev.c b/udev.c index d98a017396..b4b08b335b 100644 --- a/udev.c +++ b/udev.c @@ -106,8 +106,6 @@ static int subsystem_without_dev(const char *subsystem) int main(int argc, char *argv[], char *envp[]) { - main_argv = argv; - main_envp = envp; struct sigaction act; char *action; char *devpath = ""; @@ -121,6 +119,9 @@ int main(int argc, char *argv[], char *envp[]) dbg("version %s", UDEV_VERSION); + main_argv = argv; + main_envp = envp; + init_logging("udev"); udev_init_config(); -- cgit v1.2.3-54-g00ecf From f837727408d862f0f23fe46f617d2060f0bd3aed Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 15 Oct 2004 18:42:42 -0700 Subject: [PATCH] tweak the ccdv program to handle files in subdirectories being built. --- ccdv.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ccdv.c b/ccdv.c index 069cc461de..e3ae9da91a 100644 --- a/ccdv.c +++ b/ccdv.c @@ -28,12 +28,12 @@ size_t gNBufUsed = 0, gNBufAllocated = 0; char *gBuf = NULL; int gCCPID; -char gAction[64] = ""; -char gTarget[64] = ""; +char gAction[200] = ""; +char gTarget[200] = ""; char gAr[32] = ""; char gArLibraryTarget[64] = ""; int gDumpCmdArgs = 0; -char gArgsStr[800]; +char gArgsStr[1000]; int gColumns = 80; int gANSIEscapes = 0; int gExitStatus = 95; @@ -250,6 +250,7 @@ static const char * Extension(const char *path) cp = strrchr(path, '.'); if (cp == NULL) return (""); + // printf("Extension='%s'\n", cp); return (cp); } /* Extension */ @@ -289,6 +290,7 @@ int main(int argc, char **argv) snprintf(gAction, sizeof(gAction), "Running %s", Basename(argv[1])); memset(gArgsStr, 0, sizeof(gArgsStr)); for (i = 1; i < argc; i++) { + // printf("argv[%d]='%s'\n", i, argv[i]); quote = (strchr(argv[i], ' ') != NULL) ? "\"" : ""; snprintf(gArgsStr + strlen(gArgsStr), sizeof(gArgsStr) - strlen(gArgsStr), "%s%s%s%s%s", (i == 1) ? "" : " ", quote, argv[i], quote, (i == (argc - 1)) ? "\n" : ""); if ((strcmp(argv[i], "-o") == 0) && ((i + 1) < argc)) { @@ -296,11 +298,12 @@ int main(int argc, char **argv) strcpy(gAction, "Linking"); snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i + 1])); } - } else if (strchr("-+/", (int) argv[i][0]) != NULL) { + } else if (strchr("-+", (int) argv[i][0]) != NULL) { continue; } else if (strncasecmp(Extension(argv[i]), ".c", 2) == 0) { cc++; snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); + // printf("gTarget='%s'\n", gTarget); } else if ((strncasecmp(Extension(argv[i]), ".h", 2) == 0) && (cc == 0)) { pch++; snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); -- cgit v1.2.3-54-g00ecf From 125930b45492c315f03d4b7a685d129a67338245 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Fri, 15 Oct 2004 18:42:53 -0700 Subject: [PATCH] pass SYSFS setting down for extras builds Modify SYSFS to specify the full path, and pass it down for the extras builds. Change the scsi_id Makefile so it will work with and without udev. --- Makefile | 15 ++++++++------- extras/scsi_id/Makefile | 8 +------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index fd46a93a41..890667be9d 100644 --- a/Makefile +++ b/Makefile @@ -183,6 +183,7 @@ all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(WAIT) $(GEN_CONFIGS) echo $$target ; \ $(MAKE) prefix=$(prefix) \ LD="$(LD)" \ + SYSFS="$(SYSFS)" \ KERNEL_DIR="$(KERNEL_DIR)" \ -C $$target $@ ; \ done ; \ @@ -198,13 +199,13 @@ $(CRT0): TDB = tdb/tdb.o \ tdb/spinlock.o -SYSFS = libsysfs/sysfs_bus.o \ - libsysfs/sysfs_class.o \ - libsysfs/sysfs_device.o \ - libsysfs/sysfs_dir.o \ - libsysfs/sysfs_driver.o \ - libsysfs/sysfs_utils.o \ - libsysfs/dlist.o +SYSFS = $(PWD)/libsysfs/sysfs_bus.o \ + $(PWD)/libsysfs/sysfs_class.o \ + $(PWD)/libsysfs/sysfs_device.o \ + $(PWD)/libsysfs/sysfs_dir.o \ + $(PWD)/libsysfs/sysfs_driver.o \ + $(PWD)/libsysfs/sysfs_utils.o \ + $(PWD)/libsysfs/dlist.o OBJS = udev_lib.o \ udev_config.o \ diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 6a73e33785..7ccc4c5118 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -31,14 +31,8 @@ INSTALL_DATA = ${INSTALL} -m 644 override CFLAGS+=-Wall -fno-builtin PROG=scsi_id +SYSFS=-lsysfs -SYSFS = ../../libsysfs/sysfs_bus.o \ - ../../libsysfs/sysfs_class.o \ - ../../libsysfs/sysfs_device.o \ - ../../libsysfs/sysfs_dir.o \ - ../../libsysfs/sysfs_driver.o \ - ../../libsysfs/sysfs_utils.o \ - ../../libsysfs/dlist.o # # Built static and stripped when built with udev. # -- cgit v1.2.3-54-g00ecf From 396bb4c3d33dfd68c5817da5e03251fbd82e2713 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 15 Oct 2004 18:49:27 -0700 Subject: [PATCH] let the extras/ programs build "pretty" also --- Makefile | 1 + extras/scsi_id/Makefile | 5 ++++- extras/volume_id/Makefile | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 890667be9d..fffc3c4c15 100644 --- a/Makefile +++ b/Makefile @@ -185,6 +185,7 @@ all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(WAIT) $(GEN_CONFIGS) LD="$(LD)" \ SYSFS="$(SYSFS)" \ KERNEL_DIR="$(KERNEL_DIR)" \ + QUIET="@$(PWD)/ccdv" \ -C $$target $@ ; \ done ; \ diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 7ccc4c5118..2f134bcdbd 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -72,5 +72,8 @@ clean: spotless: clean +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + $(PROG): $(OBJS) - $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 8813f9fca5..d0c6e40fa3 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -49,8 +49,11 @@ HEADERS = volume_id.h dasdlabel.h $(OBJS): $(HEADERS) +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + $(PROG): $(OBJS) $(HEADERS) - $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) clean: rm -f $(PROG) $(OBJS) -- cgit v1.2.3-54-g00ecf From 13299c29e7d87d38079fd8a25def44103564d9f4 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 15 Oct 2004 19:18:25 -0700 Subject: [PATCH] add debian config files. taken from latest udev debian package. --- etc/udev/udev.permissions.debian | 121 +++++++++++++++++++++++++++++++++++++++ etc/udev/udev.rules.debian | 69 ++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 etc/udev/udev.permissions.debian create mode 100644 etc/udev/udev.rules.debian diff --git a/etc/udev/udev.permissions.debian b/etc/udev/udev.permissions.debian new file mode 100644 index 0000000000..6429519eec --- /dev/null +++ b/etc/udev/udev.permissions.debian @@ -0,0 +1,121 @@ +# name:user:group:mode + +# character devices + +ptmx:root:tty:0666 +random:root:root:0666 +urandom:root:root:0444 +kmem:root:kmem:0640 +mem:root:kmem:0640 +port:root:kmem:0640 +null:root:root:0666 +zero:root:root:0666 +full:root:root:0666 + +misc/nvram:root:nvram:660 +nvram:root:nvram:660 +misc/rtc:root:audio:0664 +rtc:root:audio:0664 + +tts/*:root:dialout:0660 +bluetooth/rfcomm/*:root:dialout:0660 +tty[BCDEFHILMPRSTUVWX][0-9]*:root:dialout:0660 +ttyS[ACIR][0-9]*:root:dialout:0660 +ttyUSB[0-9]*:root:dialout:0660 +ttyACM[0-9]*:root:dialout:0660 +ippp[0-9]*:root:dialout:0660 +isdn[0-9]*:root:dialout:0660 +isdnctrl[0-9]*:root:dialout:0660 +capi[0-9.]*:root:dialout:0660 +dcbri[0-9]*:root:dialout:0660 +ircomm[0-9]*:root:dialout:0660 +rfcomm[0-9]*:root:dialout:0660 +tty:root:tty:0666 + +snd/*:root:audio:0660 +sound/*:root:audio:0660 +admmidi*:root:audio:0660 +adsp*:root:audio:0660 +aload*:root:audio:0660 +amidi*:root:audio:0660 +amixer*:root:audio:0660 +audio*:root:audio:0660 +dmfm*:root:audio:0660 +dsp*:root:audio:0660 +audio*:root:audio:0660 +mixer*:root:audio:0660 +music:root:audio:0660 +sequencer*:root:audio:0660 + +printers/*:root:lp:0660 +usb/lp[0-9]*:root:lp:0660 +usb/legousbtower[0-9]*:root:root:666 +lp[0-9]*:root:lp:0660 +parport[0-9]*:root:lp:0660 +irlpt[0-9]*:root:lp:0660 +usblp[0-9]*:root:lp:0660 + +input/mice:root:root:0600 +input/mouse[0-9]*:root:root:0600 +input/js[0-9]*:root:root:0644 +input/*:root:root:0600 +mouse[0-9]*:root:root:0600 +js[0-9]*:root:root:0644 + +dri/card[0-9]*:root:video:0660 +fb/*:root:video:0660 +fb[0-9]*:root:video:0660 +agpgart:root:video:0660 +nvidia*:root:video:0660 + +v4l/*:root:video:0660 +video[0-9]*:root:video:0660 +radio[0-9]*:root:video:0660 +vbi[0-9]*:root:video:0660 +vtx[0-9]*:root:video:0660 +dvb/*:root:video:0660 + +# block devices + +floppy/*:root:floppy:0660 +fd[0-9]*:root:floppy:0660 +cdemu/*:root:cdrom:0660 +pktcdvd[0-9]*:root:cdrom:0660 + +ram[0-9]*:root:disk:0660 +raw/*:root:disk:0660 + +ide/*/cd:root:cdrom:0660 +ide/*:root:disk:0660 +hd[a-s]:root:disk:0660 +hd[a-s][0-9]*:root:disk:0660 + +scsi/*/cd:root:cdrom:0660 +scsi/*:root:disk:0660 +sd[a-z]:root:disk:0660 +sd[a-z][0-9]*:root:disk:0660 +sd[a-i][a-z]:root:disk:0660 +sd[a-i][a-z][0-9]*:root:disk:0660 +s[gr][0-9]*:root:disk:0660 +scd[0-9]*:root:cdrom:0660 + +dasd[0-9]*:root:disk:0660 +ataraid[0-9]*:root:disk:0660 + +loop/*:root:disk:0660 +loop[0-9]*:root:disk:0660 +md/*:root:disk:0660 +md[0-9]*:root:disk:0660 +dm-*:root:disk:0640 + +ht[0-9]*:root:tape:0660 +nht[0-9]*:root:tape:0660 +pt[0-9]*:root:tape:0660 +npt[0-9]*:root:tape:0660 +st[0-9]*:root:tape:0660 +nst[0-9]*:root:tape:0660 + +sgi_fetchop:root:root:666 +iseries/vcd*:root:disk:660 +iseries/vd*:root:disk:660 + diff --git a/etc/udev/udev.rules.debian b/etc/udev/udev.rules.debian new file mode 100644 index 0000000000..cdc0505418 --- /dev/null +++ b/etc/udev/udev.rules.debian @@ -0,0 +1,69 @@ +# There are a number of modifiers that are allowed to be used in some +# of the different fields. They provide the following subsitutions: +# %n - the "kernel number" of the device. +# For example, 'sda3' has a "kernel number" of '3' +# %k - the kernel name for the device. +# %M - the kernel major number for the device +# %m - the kernel minor number for the device +# %b - the bus id for the device +# %c - the string returned by the PROGRAM. (Note, this doesn't work within +# the PROGRAM field for the obvious reason.) +# %s{filename} - the content of a sysfs attribute. +# %% - the '%' char itself. +# + +# /dev/cdrom symlink +BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" + +# permissions for SCSI sg devices +BUS="scsi", KERNEL="s[grt][0-9]*", SYSFS{type}="5", NAME="%k", MODE="0660", GROUP="cdrom" + +# permissions for IDE CD devices +BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", MODE="0660", GROUP="cdrom" + +# permissions for IDE floppy devices +BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", NAME="%k", MODE="0660", GROUP="floppy" + +# USB devices +BUS="usb", KERNEL="hiddev*", NAME="usb/%k" +BUS="usb", KERNEL="auer*", NAME="usb/%k" +BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" +BUS="usb", KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" + +KERNEL="dvb*", PROGRAM="/etc/udev/dvb.sh %k", NAME="%c" + +KERNEL="card*", NAME="dri/card%n" +KERNEL="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL="microcode", NAME="cpu/microcode" + +# ALSA devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + +# input devices +KERNEL="mice", NAME="input/%k" +KERNEL="mouse[0-9]*", NAME="input/%k" +KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/inputdev.sh %k", RESULT="inputdev", MODE="0664", GROUP="video" +KERNEL="event[0-9]*", NAME="input/%k" +KERNEL="js[0-9]*", NAME="input/%k" +KERNEL="ts[0-9]*", NAME="input/%k" +KERNEL="uinput", NAME="input/%k" + +KERNEL="tap*", NAME="net/%k" +KERNEL="tun", NAME="net/%k" + +# CAPI devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi[0-9]*", NAME="capi/%n" + +# device mapper creates its own device nodes, so ignore these +KERNEL="dm-[0-9]*", NAME="" +KERNEL="device-mapper", NAME="mapper/control" + -- cgit v1.2.3-54-g00ecf From 29afcc5f111f780869a7b091600b106136e11b6d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 15 Oct 2004 19:18:58 -0700 Subject: [PATCH] add some helper scripts for dvb and input devices. --- extras/dvb.sh | 3 +++ extras/inputdev.sh | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 extras/dvb.sh create mode 100644 extras/inputdev.sh diff --git a/extras/dvb.sh b/extras/dvb.sh new file mode 100644 index 0000000000..b14a6d0d7b --- /dev/null +++ b/extras/dvb.sh @@ -0,0 +1,3 @@ +#!/bin/sh -e +echo $1 | sed -e 's#^dvb\([0-9]\)\.\([^0-9]*\)\([0-9]\)#dvb/adapter\1/\2\3#' +exit 0 diff --git a/extras/inputdev.sh b/extras/inputdev.sh new file mode 100644 index 0000000000..82e4fdc374 --- /dev/null +++ b/extras/inputdev.sh @@ -0,0 +1,30 @@ +#!/bin/sh -e +# +# Scans /proc/bus/input/devices for the given device. +# +# (c) 2004 Darren Salt +# GPL v2 or later applies. + +[ "$1" ] || exit 0 + +# input device name, less leading "input/" +DEVICE=${1#input/} + +# "|"-separated list. +# The first found in the given device's "N:" line will be output. +DEFAULT_KEYWORDS='dvb|saa7134' +KEYWORDS=${2:-$DEFAULT_KEYWORDS} + +exec sed -nre ' + /^I:/ { + : gather + N + /\nH:/! b gather + /'"$DEVICE"'/ { + s/^.*\nN:[^\n]*("|\b)('"$KEYWORDS"')("|\b)[^\n]*\n.*$/inputdev/ + T + p + } + } +' < /proc/bus/input/devices + -- cgit v1.2.3-54-g00ecf From 79db6912cf8827bf4293d2d15b84cc9633dd7d4e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 15 Oct 2004 19:19:53 -0700 Subject: [PATCH] add very nice cdsymlinks scripts. These are from Darren Salt --- extras/cdsymlinks.c | 532 +++++++++++++++++++++++++++++++++++++++++++++++++ extras/cdsymlinks.conf | 12 ++ extras/cdsymlinks.sh | 184 +++++++++++++++++ 3 files changed, 728 insertions(+) create mode 100644 extras/cdsymlinks.c create mode 100644 extras/cdsymlinks.conf create mode 100644 extras/cdsymlinks.sh diff --git a/extras/cdsymlinks.c b/extras/cdsymlinks.c new file mode 100644 index 0000000000..2889ff446c --- /dev/null +++ b/extras/cdsymlinks.c @@ -0,0 +1,532 @@ +/* cdsymlinks.c + * + * Map cdrom, cd-r, cdrw, dvd, dvdrw, dvdram to suitable devices. + * Prefers cd* for DVD-incapable and cdrom and dvd for read-only devices. + * First parameter is the kernel device name. + * Second parameter, if present, must be "-d" => output the full mapping. + * + * Usage: + * BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" + * BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" + * BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" + * (this last one is "just in case") + * + * (c) 2004 Darren Salt + */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include + +static const char *progname; + +/* This file provides us with our devices and capabilities information. */ +#define CDROM_INFO "/proc/sys/dev/cdrom/info" + +/* This file contains our default settings. */ +#define CONFIGURATION "/etc/udev/cdsymlinks.conf" +/* Default output types configuration, in the presence of an empty list */ +#define OUTPUT_DEFAULT "CD CDRW DVD DVDRW DVDRAM" + +static int debug = 0; + +/* List item */ +struct list_item_t { + struct list_item_t *next; + char *data; +}; + +/* List root. Note offset of list_t->head and list_item_t->next */ +struct list_t { + struct list_item_t *head, *tail; +}; + +/* Configuration variables */ +static struct list_t allowed_output = {0}; +static int numbered_links = 1; + +/* Available devices */ +static struct list_t Devices = {0}; + +/* Devices' capabilities in full (same order as available devices list). + * There's no cap_CD; all are assumed able to read CDs. + */ +static struct list_t cap_DVDRAM = {0}, cap_DVDRW = {0}, cap_DVD = {0}, + cap_CDRW = {0}, cap_CDR = {0}, cap_CDWMRW = {0}, + cap_CDMRW = {0}; + +/* Device capabilities by name */ +static struct list_t dev_DVDRAM = {0}, dev_DVDRW = {0}, dev_DVD = {0}, + dev_CDRW = {0}, dev_CDR = {0}, dev_CDWMRW = {0}, + dev_CDMRW = {0}; +#define dev_CD Devices + + +/* + * Some library-like bits first... + */ + +static void +errexit (const char *reason) +{ + fprintf (stderr, "%s: %s: %s\n", progname, reason, strerror (errno)); + exit (2); +} + + +static void +msgexit (const char *reason) +{ + fprintf (stderr, "%s: %s\n", progname, reason); + exit (2); +} + + +static void +errwarn (const char *reason) +{ + fprintf (stderr, "%s: warning: %s: %s\n", progname, reason, strerror (errno)); +} + + +static void +msgwarn (const char *reason) +{ + fprintf (stderr, "%s: warning: %s\n", progname, reason); +} + + +static void * +xmalloc (size_t size) +{ + void *mem = malloc (size); + if (size && !mem) + msgexit ("malloc failed"); + return mem; +} + + +static char * +xstrdup (const char *text) +{ + char *mem = xmalloc (strlen (text) + 1); + return strcpy (mem, text); +} + + +/* Append a string to a list. The string is duplicated. */ +static void +list_append (struct list_t *list, const char *data) +{ + struct list_item_t *node = xmalloc (sizeof (struct list_item_t)); + node->next = NULL; + if (list->tail) + list->tail->next = node; + list->tail = node; + if (!list->head) + list->head = node; + node->data = xstrdup (data); +} + + +/* Prepend a string to a list. The string is duplicated. */ +static void +list_prepend (struct list_t *list, const char *data) +{ + struct list_item_t *node = xmalloc (sizeof (struct list_item_t)); + node->next = list->head; + list->head = node; + if (!list->tail) + list->tail = node; + node->data = xstrdup (data); +} + + +/* Delete a lists's contents, freeing claimed memory */ +static void +list_delete (struct list_t *list) +{ + struct list_item_t *node = list->head; + while (node) + { + struct list_item_t *n = node; + node = node->next; + free (n->data); + free (n); + } + list->tail = list->head = NULL; +} + + +/* Print out a list on one line, each item space-prefixed, no LF */ +static void +list_print (const struct list_t *list, FILE *stream) +{ + const struct list_item_t *node = (const struct list_item_t *)list; + while ((node = node->next) != NULL) + fprintf (stream, " %s", node->data); +} + + +/* Return the nth item in a list (count from 0) + * If there aren't enough items in the list, return the requested default + */ +static const struct list_item_t * +list_nth (const struct list_t *list, size_t nth) +{ + const struct list_item_t *node = list->head; + while (nth && node) + { + node = node->next; + --nth; + } + return node; +} + + +/* Return the first matching item in a list, or NULL */ +static const struct list_item_t * +list_search (const struct list_t *list, const char *data) +{ + const struct list_item_t *node = list->head; + while (node) + { + if (!strcmp (node->data, data)) + return node; + node = node->next; + } + return NULL; +} + + +/* Split up a string on whitespace & assign the resulting tokens to a list. + * Ignore everything up until the first colon (if present). + */ +static void +list_assign_split (struct list_t *list, char *text) +{ + char *token = strchr (text, ':'); + token = strtok (token ? token + 1 : text, " \t"); + while (token) + { + list_prepend (list, token); + token = strtok (0, " \t\n"); + } +} + + + +/* Gather the default settings. */ +static void +read_defaults (void) +{ + FILE *conf = fopen (CONFIGURATION, "r"); + if (!conf) + { + if (errno != ENOENT) + errwarn ("error accessing configuration"); + } + else + { + char *text = NULL; + size_t textlen; + while (getline (&text, &textlen, conf) != -1) + { + wordexp_t p = {0}; + int len = strlen (text); + if (len && text[len - 1] == '\n') + text[--len] = '\0'; + if (len && text[len - 1] == '\r') + text[--len] = '\0'; + if (!len) + continue; + char *token = text + strspn (text, " \t"); + if (!*token || *token == '#') + continue; + switch (len = wordexp (text, &p, 0)) + { + case WRDE_NOSPACE: + msgexit ("malloc failed"); + case 0: + if (p.we_wordc == 1) + { + if (!strncmp (p.we_wordv[0], "OUTPUT=", 7)) + { + list_delete (&allowed_output); + list_assign_split (&allowed_output, p.we_wordv[0] + 7); + } + else if (!strncmp (p.we_wordv[0], "NUMBERED_LINKS=", 14)) + numbered_links = atoi (p.we_wordv[0] + 14); + break; + } + /* fall through */ + default: + msgwarn ("syntax error in configuration file"); + } + wordfree (&p); + } + if (!feof (conf)) + errwarn ("error accessing configuration"); + if (fclose (conf)) + errwarn ("error accessing configuration"); + free (text); + } + if (!allowed_output.head) + { + char *dflt = strdup (OUTPUT_DEFAULT); + list_assign_split (&allowed_output, dflt); + free (dflt); + } +} + + +/* From information supplied by the kernel: + * + get the names of the available devices + * + populate our capability lists + * Order is significant: device item N maps to each capability item N. + */ +static void +populate_capability_lists (void) +{ + FILE *info = fopen (CDROM_INFO, "r"); + if (!info) + { + if (errno == ENOENT) + exit (0); + errexit ("error accessing CD/DVD info"); + } + + char *text = 0; + size_t textlen = 0; + + while (getline (&text, &textlen, info) != -1) + { + if (!strncasecmp (text, "drive name", 10)) + list_assign_split (&Devices, text); + else if (!strncasecmp (text, "Can write DVD-RAM", 17)) + list_assign_split (&cap_DVDRAM, text); + else if (!strncasecmp (text, "Can write DVD-R", 15)) + list_assign_split (&cap_DVDRW, text); + else if (!strncasecmp (text, "Can read DVD", 12)) + list_assign_split (&cap_DVD, text); + else if (!strncasecmp (text, "Can write CD-RW", 15)) + list_assign_split (&cap_CDRW, text); + else if (!strncasecmp (text, "Can write CD-R", 14)) + list_assign_split (&cap_CDR, text); + else if (!strncasecmp (text, "Can read MRW", 14)) + list_assign_split (&cap_CDMRW, text); + else if (!strncasecmp (text, "Can write MRW", 14)) + list_assign_split (&cap_CDWMRW, text); + } + if (!feof (info)) + errexit ("error accessing CD/DVD info"); + fclose (info); + free (text); +} + + +/* Write out the links of type LINK which should be created for device NAME, + * taking into account existing links and the capability list for type LINK. + */ +static void +do_output (const char *name, const char *link, const struct list_t *dev) +{ + const struct list_item_t *i = (const struct list_item_t *)dev; + if (!i->next) + return; + + errno = 0; + + size_t link_len = strlen (link); + DIR *dir = opendir ("/dev"); + if (!dir) + errexit ("error reading /dev"); + + struct list_t devls = {0}; /* symlinks whose name matches LINK */ + struct list_t devlinks = {0}; /* those symlinks' targets */ + struct dirent *entry; + while ((entry = readdir (dir)) != NULL) + { + if (strncmp (entry->d_name, link, link_len)) + continue; /* wrong name: ignore it */ + + /* The rest of the name must be null or consist entirely of digits. */ + const char *p = entry->d_name + link_len - 1; + while (*++p) + if (!isdigit (*p)) + break; + if (*p) + continue; /* wrong format - ignore */ + + /* Assume that it's a symlink and try to read its target. */ + char buf[sizeof (entry->d_name)]; + int r = readlink (entry->d_name, buf, sizeof (buf) - 1); + if (r < 0) + { + if (errno == EINVAL) + continue; /* not a symlink - ignore */ + errexit ("error reading link in /dev"); + } + /* We have the name and the target, so update our lists. */ + buf[r] = 0; + list_append (&devls, entry->d_name); + list_append (&devlinks, buf); + } + if (errno) + errexit ("error reading /dev"); + if (closedir (dir)) + errexit ("error closing /dev"); + + /* Now we write our output... */ + size_t count = 0; + while ((i = i->next) != NULL) + { + int isdev = !strcmp (name, i->data); /* current dev == target dev? */ + int present = 0; + size_t li = -1; + const struct list_item_t *l = (const struct list_item_t *)&devlinks; + + /* First, we look for existing symlinks to the target device. */ + while (++li, (l = l->next) != NULL) + { + if (strcmp (l->data, i->data)) + continue; + /* Existing symlink found - don't output a new one. + * If ISDEV, we output the name of the existing symlink. + */ + present = 1; + if (isdev) + printf (" %s", list_nth (&devls, li)->data); + } + + /* If we found no existing symlinks for the target device... */ + if (!present) + { + char buf[256]; + snprintf (buf, sizeof (buf), count ? "%s%d" : "%s", link, count); + /* Find the next available (not present) symlink name. + * We always need to do this for reasons of output consistency: if a + * symlink is created by udev as a result of use of this program, we + * DON'T want different output! + */ + while (list_search (&devls, buf)) + snprintf (buf, sizeof (buf), "%s%d", link, ++count); + /* If ISDEV, output it. */ + if (isdev && (numbered_links || count == 0)) + printf (" %s", buf); + /* If the link isn't in our "existing links" list, add it and increment + * our counter. + */ + if (!list_search (&devls, buf)) + { + list_append (&devls, buf); + ++count; + } + } + } + + list_delete (&devls); + list_delete (&devlinks); +} + + +/* Populate a device list from a capabilities list. */ +static void +populate_device_list (struct list_t *out, const struct list_t *caps) +{ + const struct list_item_t *cap, *dev; + cap = (const struct list_item_t *)caps; + dev = (const struct list_item_t *)&Devices; + while ((cap = cap->next) != NULL && (dev = dev->next) != NULL) + if (cap->data[0] != '0') + list_append (out, dev->data); +} + + +int +main (int argc, char *argv[]) +{ + progname = argv[0]; + debug = argc > 2 && !strcmp (argv[2], "-d"); + + if (argc < 2 || argc > 2 + debug) + msgexit ("usage: cdsymlinks DEVICE [-d]"); + + if (chdir ("/dev")) + errexit ("can't chdir /dev"); + + read_defaults (); + populate_capability_lists (); + + /* Construct the device lists from the capability lists. */ + populate_device_list (&dev_DVDRAM, &cap_DVDRAM); + populate_device_list (&dev_DVDRW, &cap_DVDRW); + populate_device_list (&dev_DVD, &cap_DVD); + populate_device_list (&dev_CDRW, &cap_CDRW); + populate_device_list (&dev_CDR, &cap_CDR); + populate_device_list (&dev_CDWMRW, &cap_CDWMRW); + populate_device_list (&dev_CDMRW, &cap_CDMRW); + /* (All devices can read CDs.) */ + + if (debug) + { +#define printdev(DEV) \ + printf ("%-7s:", #DEV); \ + list_print (&cap_##DEV, stdout); \ + list_print (&dev_##DEV, stdout); \ + puts (""); + + printf ("Devices:"); + const struct list_item_t *item = (const struct list_item_t *)&Devices; + while ((item = item->next) != NULL) + printf (" %s", item->data); + puts (""); + + printdev (DVDRAM); + printdev (DVDRW); + printdev (DVD); + printdev (CDRW); + printdev (CDR); + printdev (CDWMRW); + printdev (CDMRW); + + printf ("CDROM : (all)"); + item = (const struct list_item_t *)&dev_CD; + while ((item = item->next) != NULL) + printf (" %s", item->data); + puts (""); + } + + /* Write the symlink names. */ + if (list_search (&allowed_output, "CD")) + do_output (argv[1], "cdrom", &dev_CD); + if (list_search (&allowed_output, "CDR")) + do_output (argv[1], "cd-r", &dev_CDR); + if (list_search (&allowed_output, "CDRW")) + do_output (argv[1], "cdrw", &dev_CDRW); + if (list_search (&allowed_output, "DVD")) + do_output (argv[1], "dvd", &dev_DVD); + if (list_search (&allowed_output, "DVDRW")) + do_output (argv[1], "dvdrw", &dev_DVDRW); + if (list_search (&allowed_output, "DVDRAM")) + do_output (argv[1], "dvdram", &dev_DVDRAM); + if (list_search (&allowed_output, "CDMRW")) + do_output (argv[1], "cdmrw", &dev_CDMRW); + if (list_search (&allowed_output, "CDWMRW")) + do_output (argv[1], "cdwmrw", &dev_CDWMRW); + puts (""); + + return 0; +} diff --git a/extras/cdsymlinks.conf b/extras/cdsymlinks.conf new file mode 100644 index 0000000000..e50a2e6082 --- /dev/null +++ b/extras/cdsymlinks.conf @@ -0,0 +1,12 @@ +# Configuration file for cdsymlinks + +# Output links for these types of devices. +# Allowed keywords are CD, CDR, CDRW, DVD, DVDRW, DVDRAM, CDMRW, CDWMRW. +# Other words are accepted but ignored. +#OUTPUT="CD CDRW DVD DVDRW DVDRAM" + +# Whether to output numbered links. +# 1 = output 'cdrom1', 'dvd1' etc. for other devices +# 0 = don't output 'cdrom1', 'dvd1' etc. +# We always output 'cdrom', 'dvd' etc. for the best-match devices. +#NUMBERED_LINKS=1 diff --git a/extras/cdsymlinks.sh b/extras/cdsymlinks.sh new file mode 100644 index 0000000000..e99be2e544 --- /dev/null +++ b/extras/cdsymlinks.sh @@ -0,0 +1,184 @@ +#! /bin/sh -e +# +# Map cdrom, cdm, cdmrw, cd-r, cdrw, dvd, dvdrw, dvdram to suitable devices. +# Prefers cd* for DVD-incapable and cdrom and dvd for read-only devices. +# First parameter is the kernel device name. +# Second parameter, if present, must be "-d" => output the full mapping. +# +# Usage: +# BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +# BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +# BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +# (this last one is "just in case") +# +# (c) 2004 Darren Salt + +test -e /proc/sys/dev/cdrom/info || exit 0 + +# Defaults; it's better that you alter them in /etc/udev/cdsymlinks.conf +OUTPUT='CD CDRW DVD DVDRW DVDRAM' +NUMBERED_LINKS=1 + +test -e /etc/udev/cdsymlinks.conf && . /etc/udev/cdsymlinks.conf + +DEBUG='' +test "$2" = '-d' && DEBUG=1 + + +# Array emulation. 'setArray FOO a b c' gives FOO=3 FOO_1=a FOO_2=b FOO_3=c +setArray () { + local _ARRAY=$1 + local _INDEX=0 + shift + while test $# -ne 0; do + eval ${_ARRAY}_$_INDEX="$1" + _INDEX=$(($_INDEX+1)) + shift + done + eval $_ARRAY=$_INDEX +} + +ix () { eval echo -n \$$1_$2; } +ixs () { eval $1_$2="$3"; } + +# Args: variable, value +# Returns true if value is not in variable (a whitespace-separated list) +notin () { + test "$2" = '' && return 0 + local i + for i in `eval echo '$'$1`; do + test "$i" != "$2" || return 1 + done +} + + +# Scan /proc/sys/dev/cdrom/info for details on the present devices +setArray DEVICES `sed -re '/^drive name:/I! d; s/.*://' /proc/sys/dev/cdrom/info` +setArray DVDRAMs `sed -re '/^Can write DVD-RAM:/I! d; s/.*://' /proc/sys/dev/cdrom/info` +setArray DVDRWs `sed -re '/^Can write DVD-R:/I! d; s/.*://' /proc/sys/dev/cdrom/info` +setArray DVDs `sed -re '/^Can read DVD:/I! d; s/.*://' /proc/sys/dev/cdrom/info` +setArray CDRWs `sed -re '/^Can write CD-RW:/I! d; s/.*://' /proc/sys/dev/cdrom/info` +setArray CDRs `sed -re '/^Can write CD-R:/I! d; s/.*://' /proc/sys/dev/cdrom/info` +setArray CDMRWs `sed -re '/^Can write MRW:/I! d; s/.*://' /proc/sys/dev/cdrom/info` +setArray CDMs `sed -re '/^Can read MRW:/I! d; s/.*://' /proc/sys/dev/cdrom/info` + +# How many devices do we have? +NumDevs=$(($DEVICES-1)) +Count='' +i=-1 +while test $i -ne $NumDevs; do + i=$(($i+1)); + Count="$i${Count:+ }$Count"; +done + +# Fill in any missing capabilities information (assume not capable) +for i in $Count; do + test "`ix DVDRAMs $i`" != '' || ixs DVDRAMs $i 0 + test "`ix DVDRWs $i`" != '' || ixs DVDRWs $i 0 + test "`ix DVDs $i`" != '' || ixs DVDs $i 0 + test "`ix CDRWs $i`" != '' || ixs CDRWs $i 0 + test "`ix CDRs $i`" != '' || ixs CDRs $i 0 + test "`ix CDMRWs $i`" != '' || ixs CDMRWs $i 0 + test "`ix CDMs $i`" != '' || ixs CDMs $i 0 +done + +DVDRAM='' +DVDRW='' +DVD='' +CDRW='' +CDR='' +CDMRW='' +CDM='' +CD='' + +# Calculate symlink->device mappings. +# We need to be careful about how we assign mappings because we want +# read-only devices to have /dev/cdrom and /dev/dvd. +# Hot-plugged CD/DVD devices may well cause this scheme some problems. +for i in $Count; do + test "`ix DVDRAMs $i`" = 1 && DVDRAM="$DVDRAM `ix DEVICES $i`" +done +for i in $Count; do + test "`ix DVDRWs $i`" = 1 && DVDRW="$DVDRW `ix DEVICES $i`" +done +for i in $Count; do + test "`ix DVDs $i`" = 1 && DVD="$DVD `ix DEVICES $i`" +done +for i in $Count; do + test "`ix CDRWs $i`" = 1 && CDRW="$CDRW `ix DEVICES $i`" +done +for i in $Count; do + test "`ix CDRs $i`" = 1 && CDR="$CDR `ix DEVICES $i`" +done +for i in $Count; do + test "`ix CDMRWs $i`" = 1 && CDMRW="$CDMRW `ix DEVICES $i`" +done +for i in $Count; do + test "`ix CDMs $i`" = 1 && CDM="$CDM `ix DEVICES $i`" +done +for i in $Count; do + CD="$CD `ix DEVICES $i`" +done + +# Debug output +if test "$DEBUG" = 1; then + echo 'Devices:' `for i in $Count; do ix DEVICES $i; echo -n \ ; done` + echo 'DVDRAM :' `for i in $Count; do ix DVDRAMs $i; echo -n \ ; done` $DVDRAM + echo 'DVDRW :' `for i in $Count; do ix DVDRWs $i; echo -n \ ; done` $DVDRW + echo 'DVD :' `for i in $Count; do ix DVDs $i; echo -n \ ; done` $DVD + echo 'CDRW :' `for i in $Count; do ix CDRWs $i; echo -n \ ; done` $CDRW + echo 'CD-R :' `for i in $Count; do ix CDRs $i; echo -n \ ; done` $CDR + echo 'CDMRW :' `for i in $Count; do ix CDMRWs $i; echo -n \ ; done` $CDMRW + echo 'CDM :' `for i in $Count; do ix CDMs $i; echo -n \ ; done` $CDM + echo 'CDROM : (all)' $CD +fi + +# Prepare symlink names output +output () { + test "`eval echo '$'$3`" = '' && return + local i + local COUNT='' + local DEVLS="`ls -dl \"/dev/$2\" \"/dev/$2\"[0-9]* 2>/dev/null`" + local PRESENT="`echo "$DEVLS" | + sed -re 's!^.* /dev/('$2'[[:digit:]]*) -> [^[:space:]]+$!\1!'`" + for i in `eval echo '$'$3`; do + # First, we look for existing symlinks to the target device. + local DEVPRESENT="`echo "$DEVLS" | + sed -re 's!^.* /dev/('$2'[[:digit:]]*) -> '$i'$!\1!; t X; d; :X'`" + if test "$DEVPRESENT" != ""; then + # Existing symlinks found - don't output a new one. + # If the target dev ($1) is the current dev ($i), we output their names. + test "$1" = "$i" && echo " $DEVPRESENT" | sed -e 'N; $ s/\n/ /' + else + # If we found no existing symlinks for the target device... + # Find the next available (not present) symlink name. + # We always need to do this for reasons of output consistency: if a + # symlink is created by udev as a result of use of this program, we + # DON'T want different output! + until notin PRESENT "$2$COUNT"; do + COUNT=$(($COUNT+1)) + done + # If the target dev ($1) is the current dev ($i), we output its name. + if test $(($NUMBERED_LINKS)) -ne 0 || test "$COUNT" -eq 0; then + test "$i" = "$1" && echo -n " $2$COUNT" + fi + # If the link isn't in our "existing links" list, add it and increment + # our counter. + if test ! -e "/dev/$2$COUNT"; then + PRESENT="$PRESENT\n$2$COUNT" + COUNT=$(($COUNT+1)) + fi + fi + done +} + +# And output it +notin OUTPUT CD || echo -n "`output "$1" cdrom CD`" +notin OUTPUT CDMRW || echo -n "`output "$1" cdmrw CDM`" +notin OUTPUT CDWMRW || echo -n "`output "$1" cdwmrw CDMRW`" +notin OUTPUT CDR || echo -n "`output "$1" cd-r CDR`" +notin OUTPUT CDRW || echo -n "`output "$1" cdrw CDRW`" +notin OUTPUT DVD || echo -n "`output "$1" dvd DVD`" +notin OUTPUT DVDRW || echo -n "`output "$1" dvdrw DVDRW`" +notin OUTPUT DVDRAM || echo -n "`output "$1" dvdram DVDRAM`" +echo -- cgit v1.2.3-54-g00ecf From 1946fec4deba1ea5505c286ef2dd4ff2c6863b1c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 15 Oct 2004 19:45:56 -0700 Subject: [PATCH] swich attribute open() to simple stat() Here we switch to a simple stat() to recognize the file creation. This will make it possible to wait for files, which are unreadable. I've switched the timout back to 5 seconds cause the our /class/vc errors seems like a bug in the vc layer not a sysfs delay. --- wait_for_sysfs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 25a3fb4eef..72368efac8 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -47,7 +47,7 @@ void log_message(int level, const char *format, ...) } #endif -#define WAIT_MAX_SECONDS 10 +#define WAIT_MAX_SECONDS 5 #define WAIT_LOOP_PER_SECOND 20 /* wait for specific file to show up, normally the "dev"-file */ @@ -60,7 +60,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev { .subsystem = "net", .file = "ifindex" }, { .subsystem = "scsi_host", .file = "unique_id" }, { .subsystem = "scsi_device", .file = NULL }, - { .subsystem = "pcmcia_socket", .file = NULL }, /* all files are unreadable in empty slot :( */ + { .subsystem = "pcmcia_socket", .file = "card_type" }, { .subsystem = "usb_host", .file = NULL }, { .subsystem = "bluetooth", .file = "address" }, { .subsystem = "firmware", .file = "data" }, @@ -86,11 +86,14 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev break; } } - dbg("looking at class '%s' for specific file '%s'", class_dev->classname, file); + + dbg("looking at class '%s' for specific file '%s'", class_dev->classname, class_dev->path); loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { - if (sysfs_get_classdev_attr(class_dev, file) != NULL) { + struct stat stats; + + if (stat(class_dev->path, &stats) == 0) { dbg("class '%s' specific file '%s' found", class_dev->classname, file); return 0; } -- cgit v1.2.3-54-g00ecf From 052de0cec6cb3d92befd3d2de3e9e69e5f097a26 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 15 Oct 2004 22:38:46 -0700 Subject: [PATCH] take out & from wait_for_sysfs_test that I previously missed. --- test/wait_for_sysfs_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/wait_for_sysfs_test.sh b/test/wait_for_sysfs_test.sh index f299d23c94..659d99a9fe 100644 --- a/test/wait_for_sysfs_test.sh +++ b/test/wait_for_sysfs_test.sh @@ -13,7 +13,7 @@ run_udev () { for i in ${SYSFS_DIR}/block/*; do # add each drive export DEVPATH=${i#${SYSFS_DIR}} - $UDEV_BIN block & + $UDEV_BIN block # add each partition, on each device for j in $i/*; do -- cgit v1.2.3-54-g00ecf From a8f2703adaf21620bb92c04d3b8371f228cd11d2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 15 Oct 2004 22:54:12 -0700 Subject: [PATCH] Hopefully fix the vcs issue in wait_for_sysfs --- wait_for_sysfs.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 72368efac8..d775eb1c95 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -6,6 +6,7 @@ * directories and then just exit. * * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004 Greg Kroah-Hartman * * 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 @@ -35,6 +36,10 @@ #include "udev_version.h" #include "libsysfs/sysfs/libsysfs.h" +#ifndef FILENAME_MAX +#define FILENAME_MAX 4096 +#endif + #ifdef LOG unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) @@ -73,6 +78,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev }; struct class_file *classfile; const char *file = "dev"; + char filename[FILENAME_MAX]; int loop; /* look if we want to look for another file instead of "dev" */ @@ -87,13 +93,21 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev } } - dbg("looking at class '%s' for specific file '%s'", class_dev->classname, class_dev->path); + strcpy(filename, class_dev->path); + strcat(filename, "/"); + strcat(filename, file); + dbg("looking at class '%s' for specific file '%s' with full name %s", class_dev->classname, class_dev->path, filename); loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { struct stat stats; - if (stat(class_dev->path, &stats) == 0) { + if (stat(class_dev->path, &stats) == -1) { + dbg("oops, the directory '%s' just disappeared.", class_dev->path); + return -ENODEV; + } + + if (stat(filename, &stats) == 0) { dbg("class '%s' specific file '%s' found", class_dev->classname, file); return 0; } @@ -102,7 +116,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev } dbg("error: getting class '%s' specific file '%s'", class_dev->classname, file); - return -1; + return -ENOENT; } /* check if we need to wait for a physical device */ @@ -284,6 +298,7 @@ int main(int argc, char *argv[], char *envp[]) struct sysfs_class_device *class_dev_parent; struct sysfs_device *device_dev = NULL; int loop; + int retval; int rc = 0; init_logging("wait_for_sysfs"); @@ -335,7 +350,10 @@ int main(int argc, char *argv[], char *envp[]) } dbg("class_device opened '%s'", filename); - if (wait_for_class_device_attributes(class_dev) != 0) { + retval = wait_for_class_device_attributes(class_dev); + if (retval == -ENODEV) + goto exit_class; + if (retval != 0) { rc = 4; goto exit_class; } -- cgit v1.2.3-54-g00ecf From b337e60790382589e8e9f088f0ff41a496a85615 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Fri, 15 Oct 2004 23:04:44 -0700 Subject: [PATCH] update udev to scsi_id 0.7 Update udev's scsi_id to version 0.7, this fixes a bad bug in scsi_id on 64 bit systems. --- extras/scsi_id/ChangeLog | 6 ++++++ extras/scsi_id/Makefile | 2 +- extras/scsi_id/release-notes | 17 +++++++---------- extras/scsi_id/scsi_id.c | 3 ++- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/extras/scsi_id/ChangeLog b/extras/scsi_id/ChangeLog index 724977dbf4..d2a8be5b18 100644 --- a/extras/scsi_id/ChangeLog +++ b/extras/scsi_id/ChangeLog @@ -1,3 +1,9 @@ +2004-oct-15: + * Makefile: Add $(QUIET) to sync with the udev version. + +2004-oct-06: + * scsi_id.c: fix alignment for use with 64 bit pointers + 2004-jul-30: * scsi_id.c, scsi_serial.c: Align the buffer passed to scsi_serial, don't bother aligning and memcpy-ing the result in scsi_inquiry. diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 2f134bcdbd..610faac4b7 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.6 +SCSI_ID_VERSION=0.7 prefix = etcdir = ${prefix}/etc diff --git a/extras/scsi_id/release-notes b/extras/scsi_id/release-notes index 302817ea7f..c7ea51679c 100644 --- a/extras/scsi_id/release-notes +++ b/extras/scsi_id/release-notes @@ -1,6 +1,6 @@ -Version 0.6 of scsi_id is available at: +Version 0.7 of scsi_id is available at: -http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.6.tar.gz +http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.7.tar.gz scsi_id is a program to generate a unique identifier for a given SCSI device. @@ -14,13 +14,10 @@ Requires: - Linux kernel 2.6 - libsysfs 0.4.0 -Major changes since the last release: +Changes since the last release: - - add -u option, patch from Christoph Varoqui, to substitute white - space with underscores so it is easier to use the output as a - device name. + - Fix a bug introduced in version 0.6 so that buffer alignement + works on 64 bit systems. Without this fix, it crashes on 64 bit + systems. - - Use 254 bytes for SCSI INQUIRY commands, patch from Hannes - Reinecke. - -See ChangeLog for more details. + - Add $(QUIET) to sync up with the udev Makefile diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 6395b822ce..d2155e6866 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -713,7 +713,8 @@ static int scsi_id(const char *target_path, char *maj_min_dev) #define ALIGN 512 unaligned_buf = malloc(MAX_SERIAL_LEN + ALIGN); - serial = (char*) (((int) unaligned_buf + (ALIGN - 1)) & ~(ALIGN - 1)); + serial = (char*) (((unsigned long) unaligned_buf + (ALIGN - 1)) + & ~(ALIGN - 1)); dprintf("buffer unaligned 0x%p; aligned 0x%p\n", unaligned_buf, serial); #undef ALIGN -- cgit v1.2.3-54-g00ecf From 4a330247992f9a558dc3f906be139ff8deddfdc2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 15 Oct 2004 23:08:08 -0700 Subject: [PATCH] 039 release --- ChangeLog | 28 ++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c190852d8..ca7532a3fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +Summary of changes from v038 to v039 +============================================ + +Greg Kroah-Hartman: + o Hopefully fix the vcs issue in wait_for_sysfs + o take out & from wait_for_sysfs_test that I previously missed + o add very nice cdsymlinks scripts + o add some helper scripts for dvb and input devices + o add debian config files + o let the extras/ programs build "pretty" also + o tweak the ccdv program to handle files in subdirectories being built + o crap, I messed up the 'sed' instances pretty badly, this fixes the config and man page mess + o fix broken 'make -j5' functionality + +Kay Sievers: + o swich attribute open() to simple stat() + o wait_for_sysfs update for /class/firmware and /class/net/irda devices + o fix unusual sysfs behavior for pcmcia_socket + o remove sleeps from udev as it is external now + o delete udevruler? + o Makefile fix + +Patrick Mansfield: + o update udev to scsi_id 0.7 + o pass SYSFS setting down for extras builds + o move assignments past local variables + + Summary of changes from v037 to v038 ============================================ diff --git a/Makefile b/Makefile index fffc3c4c15..11f4781e0e 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart WAIT = wait_for_sysfs -VERSION = 038 +VERSION = 039 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index cb0686ea2b..44164124ed 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 038 +Version: 039 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From dcb9c852f563ce8c38c3558f8462be2d324c8de7 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 18:13:13 -0700 Subject: [PATCH] Fix wait_for_sysfs messages (more debugging info) On Sat, Oct 16, 2004 at 02:48:42PM -0400, Jeff wrote: > Kay Sievers wrote: > >On Sat, Oct 16, 2004 at 04:40:51AM +0200, Kay Sievers wrote: > > > >Here is a better version. We return successful in the case, that the > >advertised device does not appear within the timeout or goes completely > >away while waiting for the attributes. All magic numbers should be > >readable as a string now. > > > >This hopefully fixes the last vc errors. > > > K, first patch produced a couple of device unavailables & a slew of no > device symlinks. Second patch-no messages at all :) > > Thank god, if I have to reboot again I'm going to puke. Nice to hear that we covered all the vc errors now. I think we should apply the same logic to the /devices device wait loops, as they may go with a remove event too. Here is the 3rd version of the patch :) --- wait_for_sysfs.c | 248 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 141 insertions(+), 107 deletions(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index d775eb1c95..aac42e2421 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -56,7 +56,8 @@ void log_message(int level, const char *format, ...) #define WAIT_LOOP_PER_SECOND 20 /* wait for specific file to show up, normally the "dev"-file */ -static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev) +static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev, + const char **error) { static struct class_file { char *subsystem; @@ -77,7 +78,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev { NULL, NULL } }; struct class_file *classfile; - const char *file = "dev"; + char *file = "dev"; char filename[FILENAME_MAX]; int loop; @@ -103,11 +104,11 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev struct stat stats; if (stat(class_dev->path, &stats) == -1) { - dbg("oops, the directory '%s' just disappeared.", class_dev->path); + dbg("'%s' now disappeared (probably remove has beaten us)", class_dev->path); return -ENODEV; } - if (stat(filename, &stats) == 0) { + if (stat(filename, &stats) == 0) { dbg("class '%s' specific file '%s' found", class_dev->classname, file); return 0; } @@ -116,6 +117,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev } dbg("error: getting class '%s' specific file '%s'", class_dev->classname, file); + *error = "class specific file unavailable"; return -ENOENT; } @@ -226,7 +228,8 @@ static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) } /* wait for the bus and for a bus specific file to show up */ -static int wait_for_bus_device(struct sysfs_device *device_dev) +static int wait_for_bus_device(struct sysfs_device *devices_dev, + const char **error) { static struct bus_file { char *bus; @@ -246,19 +249,20 @@ static int wait_for_bus_device(struct sysfs_device *device_dev) struct bus_file *busfile; int loop; - /* wait for the /bus-device link to the /device-device */ + /* wait for the bus device link to the devices device */ loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { - if (sysfs_get_device_bus(device_dev) == 0) + if (sysfs_get_device_bus(devices_dev) == 0) break; usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } if (loop == 0) { - dbg("error: getting /bus-device link"); + dbg("error: getting bus device link"); + *error = "no bus device link"; return -1; } - dbg("/bus-device link found for bus '%s'", device_dev->bus); + dbg("bus device link found for bus '%s'", devices_dev->bus); /* wait for a bus specific file to show up */ loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; @@ -266,27 +270,115 @@ static int wait_for_bus_device(struct sysfs_device *device_dev) int found = 0; for (busfile = bus_files; busfile->bus != NULL; busfile++) { - if (strcmp(device_dev->bus, busfile->bus) == 0) { + if (strcmp(devices_dev->bus, busfile->bus) == 0) { found = 1; - dbg("looking at bus '%s' for specific file '%s'", device_dev->bus, busfile->file); - if (sysfs_get_device_attr(device_dev, busfile->file) != NULL) { - dbg("bus '%s' specific file '%s' found", device_dev->bus, busfile->file); + dbg("looking at bus '%s' for specific file '%s'", devices_dev->bus, busfile->file); + if (sysfs_get_device_attr(devices_dev, busfile->file) != NULL) { + dbg("bus '%s' specific file '%s' found", devices_dev->bus, busfile->file); return 0; } } } if (found == 0) { + *error = "unknown bus"; info("error: unknown bus, please report to " - " '%s'", device_dev->bus); + " '%s'", devices_dev->bus); return -1; } usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - dbg("error: getting bus '%s' specific file '%s'", device_dev->bus, busfile->file); + dbg("error: getting bus '%s' specific file '%s'", devices_dev->bus, busfile->file); + *error = "bus specific file unavailable"; return -1; } + +static struct sysfs_class_device *open_class_device(const char *path) +{ + struct sysfs_class_device *class_dev; + int loop; + + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + class_dev = sysfs_open_class_device_path(path); + if (class_dev) + break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + + return (class_dev); +} + +static int wait_for_class_device(struct sysfs_class_device *class_dev, + const char **error) +{ + struct sysfs_class_device *class_dev_parent; + struct sysfs_device *devices_dev = NULL; + int loop; + + if (wait_for_class_device_attributes(class_dev, error) != 0) + return -ENOENT; + + /* skip devices without devices-link */ + if (class_device_expect_no_device_link(class_dev)) { + dbg("no device symlink expected for '%s', ", class_dev->name); + return -ENODEV; + } + + /* the symlink may be on the parent device */ + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent) + dbg("looking at parent device for device link '%s'", class_dev_parent->path); + + /* wait for the symlink to the devices device */ + dbg("waiting for symlink to devices device"); + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + if (class_dev_parent) + devices_dev = sysfs_get_classdev_device(class_dev_parent); + else + devices_dev = sysfs_get_classdev_device(class_dev); + + if (devices_dev) + break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + if (!devices_dev) { + dbg(" error: no devices device symlink found"); + *error = "no device symlink"; + return -ENODEV; + } + dbg("device symlink found pointing to '%s'", devices_dev->path); + + /* wait for the bus value */ + if (class_device_expect_no_bus(class_dev)) { + dbg("no bus device expected for '%s', ", class_dev->classname); + return 0; + } else { + return wait_for_bus_device(devices_dev, error); + } +} + +static struct sysfs_device *open_devices_device(const char *path) +{ + struct sysfs_device *devices_dev; + int loop; + + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + devices_dev = sysfs_open_device_path(path); + if (devices_dev) + break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + + return(devices_dev); +} + int main(int argc, char *argv[], char *envp[]) { const char *devpath = ""; @@ -295,11 +387,9 @@ int main(int argc, char *argv[], char *envp[]) char sysfs_path[SYSFS_PATH_MAX]; char filename[SYSFS_PATH_MAX]; struct sysfs_class_device *class_dev; - struct sysfs_class_device *class_dev_parent; - struct sysfs_device *device_dev = NULL; - int loop; - int retval; + struct sysfs_device *devices_dev; int rc = 0; + const char *error = NULL; init_logging("wait_for_sysfs"); @@ -312,133 +402,77 @@ int main(int argc, char *argv[], char *envp[]) devpath = getenv ("DEVPATH"); if (!devpath) { dbg("error: no DEVPATH"); - return 1; + rc = 1; + goto exit; } action = getenv ("ACTION"); if (!action) { dbg("error: no ACTION"); - return 1; + rc = 1; + goto exit; } /* we only wait on an add event */ - if (strcmp(action, "add") != 0) - return 0; + if (strcmp(action, "add") != 0) { + dbg("no add ACTION"); + goto exit; + } if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) { dbg("error: no sysfs path"); - return 2; + rc = 2; + goto exit; } if ((strncmp(devpath, "/block/", 7) == 0) || (strncmp(devpath, "/class/", 7) == 0)) { - /* open the class device we are called for */ snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); filename[SYSFS_PATH_MAX-1] = '\0'; - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - class_dev = sysfs_open_class_device_path(filename); - if (class_dev) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - if (class_dev == NULL) { - dbg("error: getting class_device"); - rc = 3; + /* open the class device we are called for */ + class_dev = open_class_device(filename); + if (!class_dev) { + dbg("error: class device unavailable (probably remove has beaten us)"); goto exit; } - dbg("class_device opened '%s'", filename); - - retval = wait_for_class_device_attributes(class_dev); - if (retval == -ENODEV) - goto exit_class; - if (retval != 0) { - rc = 4; - goto exit_class; - } + dbg("class device opened '%s'", filename); - /* skip devices without /device-link */ - if (class_device_expect_no_device_link(class_dev)) { - dbg("no device symlink expected for '%s', ", class_dev->name); - goto exit_class; - } - - /* the symlink may be on the parent device */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent) - dbg("looking at parent device for device link '%s'", class_dev_parent->path); - - /* wait for the symlink to the /device-device */ - dbg("waiting for symlink to /device-device"); - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - if (class_dev_parent) - device_dev = sysfs_get_classdev_device(class_dev_parent); - else - device_dev = sysfs_get_classdev_device(class_dev); - - if (device_dev) - break; + /* wait for the class device with possible physical device and bus */ + wait_for_class_device(class_dev, &error); - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - if (device_dev == NULL) { - dbg("error: getting /device-device"); - rc = 5; - goto exit_class; - } - dbg("device symlink found pointing to '%s'", device_dev->path); - - /* wait for the bus value */ - if (class_device_expect_no_bus(class_dev)) { - dbg("no bus device expected for '%s', ", class_dev->classname); - } else { - if (wait_for_bus_device(device_dev) != 0) - rc = 6; - } - -exit_class: sysfs_close_class_device(class_dev); } else if ((strncmp(devpath, "/devices/", 9) == 0)) { - /* open the path we are called for */ snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); filename[SYSFS_PATH_MAX-1] = '\0'; - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - device_dev = sysfs_open_device_path(filename); - if (device_dev) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - if (device_dev == NULL) { - dbg("error: getting /device-device"); - rc = 7; + /* open the path we are called for */ + devices_dev = open_devices_device(filename); + if (!devices_dev) { + dbg("error: devices device unavailable (probably remove has beaten us)"); goto exit; } - dbg("device_device opened '%s'", filename); + dbg("devices device opened '%s'", filename); /* wait for the bus value */ - if (wait_for_bus_device(device_dev) != 0) - rc = 8; + wait_for_bus_device(devices_dev, &error); - sysfs_close_device(device_dev); + sysfs_close_device(devices_dev); } else { dbg("unhandled sysfs path, no need to wait"); } exit: - if (rc == 0) - dbg("result: waiting for sysfs successful '%s'", devpath); - else + if (error) { info("either wait_for_sysfs (udev %s) needs an update to handle the device '%s' " - "properly (%d) or the sysfs-support of your device's driver needs to be fixed, " + "properly (%s) or the sysfs-support of your device's driver needs to be fixed, " "please report to ", - UDEV_VERSION, devpath, rc); + UDEV_VERSION, devpath, error); + rc =3; + } else { + dbg("result: waiting for sysfs successful '%s'", devpath); + } - return rc; + exit(rc); } -- cgit v1.2.3-54-g00ecf From 0f634c33d7eb634737915dc1aa3b7d7342d1a5f2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 18:13:40 -0700 Subject: [PATCH] Fix ppp net devices in wait_for_sysfs On Sat, Oct 16, 2004 at 10:32:47AM -0500, Jason Dravet wrote: > FYI > > wait_for_sysfs[2986]: either wait_for_sysfs (udev 038) needs an update to > handle the device '/class/ppp/ppp' properly (5) or the sysfs-support of > your device's driver needs to be fixed, please report to > > > I am running udev 38-2 and ppp-2.4.2-6.3 Yeah, the ppp-class is missing, we only covered the net ppp-devices. --- wait_for_sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index aac42e2421..1d7044c61f 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -160,11 +160,12 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "msr", .device = NULL }, { .subsystem = "netlink", .device = NULL }, { .subsystem = "net", .device = "sit" }, - { .subsystem = "net", .device = "ppp" }, { .subsystem = "net", .device = "lo" }, { .subsystem = "net", .device = "tap" }, { .subsystem = "net", .device = "ipsec" }, { .subsystem = "net", .device = "irda" }, + { .subsystem = "net", .device = "ppp" }, + { .subsystem = "ppp", .device = NULL }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, { .subsystem = "nvidia", .device = NULL }, -- cgit v1.2.3-54-g00ecf From 7257cb18458e6b51cc9655887b7f9745f704b71f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 18:15:10 -0700 Subject: [PATCH] close the syslog Seems that we never closed the opened syslog. Here is a patch to do this in all our binaries. --- logging.h | 13 ++++++++++--- udev.c | 3 ++- udevd.c | 5 +++-- udevinfo.c | 12 ++++++------ udevsend.c | 4 +++- wait_for_sysfs.c | 3 ++- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/logging.h b/logging.h index 40c342c3ab..30f52c84ce 100644 --- a/logging.h +++ b/logging.h @@ -27,7 +27,8 @@ #define info(format, arg...) do { } while (0) #define dbg(format, arg...) do { } while (0) #define dbg_parse(format, arg...) do { } while (0) -#define init_logging(foo) do { } while (0) +#define logging_init(foo) do { } while (0) +#define logging_close(foo) do { } while (0) #ifdef LOG #include @@ -65,13 +66,19 @@ extern void log_message(int level, const char *format, ...) /* each program that uses syslog must declare this variable somewhere */ extern unsigned char logname[LOGNAME_SIZE]; -#undef init_logging -static inline void init_logging(char *program_name) +#undef logging_init +static inline void logging_init(char *program_name) { snprintf(logname, LOGNAME_SIZE,"%s[%d]", program_name, getpid()); openlog(logname, 0, LOG_DAEMON); } +#undef logging_close +static inline void logging_close(void) +{ + closelog(); +} + #endif /* LOG */ #endif diff --git a/udev.c b/udev.c index b4b08b335b..10a937e472 100644 --- a/udev.c +++ b/udev.c @@ -122,7 +122,7 @@ int main(int argc, char *argv[], char *envp[]) main_argv = argv; main_envp = envp; - init_logging("udev"); + logging_init("udev"); udev_init_config(); @@ -203,5 +203,6 @@ int main(int argc, char *argv[], char *envp[]) udevdb_exit(); exit: + logging_close(); return retval; } diff --git a/udevd.c b/udevd.c index 811f62243e..421c25a6e8 100644 --- a/udevd.c +++ b/udevd.c @@ -150,7 +150,7 @@ static void udev_run(struct hotplug_msg *msg) /* child */ execle(udev_bin, "udev", msg->subsystem, NULL, env); dbg("exec of child failed"); - exit(1); + _exit(1); break; case -1: dbg("fork of child failed"); @@ -403,7 +403,7 @@ int main(int argc, char *argv[]) struct sigaction act; fd_set readfds; - init_logging("udevd"); + logging_init("udevd"); dbg("version %s", UDEV_VERSION); if (getuid() != 0) { @@ -549,5 +549,6 @@ int main(int argc, char *argv[]) } exit: close(ssock); + logging_close(); exit(1); } diff --git a/udevinfo.c b/udevinfo.c index 8329fe7d06..763cfd139f 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -447,18 +447,18 @@ help: int main(int argc, char *argv[], char *envp[]) { - int retval; + int rc = 0; main_argv = argv; main_argc = argc; - init_logging("udevinfo"); + logging_init("udevinfo"); /* initialize our configuration */ udev_init_config(); - retval = process_options(); - if (retval != 0) - exit(1); - exit(0); + rc = process_options(); + + logging_close(); + exit(rc); } diff --git a/udevsend.c b/udevsend.c index 23ba1a1b00..883181c1b6 100644 --- a/udevsend.c +++ b/udevsend.c @@ -123,7 +123,7 @@ int main(int argc, char* argv[]) socklen_t addrlen; int started_daemon = 0; - init_logging("udevsend"); + logging_init("udevsend"); dbg("version %s", UDEV_VERSION); subsystem = get_subsystem(argv[1]); @@ -215,5 +215,7 @@ exit: if (sock != -1) close(sock); + logging_close(); + return retval; } diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 1d7044c61f..37de02261d 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -392,7 +392,7 @@ int main(int argc, char *argv[], char *envp[]) int rc = 0; const char *error = NULL; - init_logging("wait_for_sysfs"); + logging_init("wait_for_sysfs"); if (argc != 2) { dbg("error: subsystem"); @@ -475,5 +475,6 @@ exit: dbg("result: waiting for sysfs successful '%s'", devpath); } + logging_close(); exit(rc); } -- cgit v1.2.3-54-g00ecf From 74d2a1d53024d10145dc1e9e5e6124d9d14e9fbe Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 18:16:12 -0700 Subject: [PATCH] don't wait for dummy devices No need to wait for dummy net devices. --- wait_for_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 37de02261d..8f142f488b 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -163,6 +163,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "lo" }, { .subsystem = "net", .device = "tap" }, { .subsystem = "net", .device = "ipsec" }, + { .subsystem = "net", .device = "dummy" }, { .subsystem = "net", .device = "irda" }, { .subsystem = "net", .device = "ppp" }, { .subsystem = "ppp", .device = NULL }, -- cgit v1.2.3-54-g00ecf From 8e0871196c916be60a9d0327ce8483c4f9763c17 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 18 Oct 2004 19:04:20 -0700 Subject: [PATCH] fix up the wait_for_sysfs_test script a bit. We also emit the same things the -mm tree does now, so to make that easier to test for. --- test/wait_for_sysfs_test.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/test/wait_for_sysfs_test.sh b/test/wait_for_sysfs_test.sh index 659d99a9fe..9b80a42271 100644 --- a/test/wait_for_sysfs_test.sh +++ b/test/wait_for_sysfs_test.sh @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash # # Check for missing binaries (stale symlinks should not happen) @@ -25,13 +25,17 @@ run_udev () { done # all other device classes for i in ${SYSFS_DIR}/class/*; do - for j in $i/*; do -# if [ -f $j/dev ]; then - export DEVPATH=${j#${SYSFS_DIR}} - CLASS=`echo ${i#${SYSFS_DIR}} | \ - cut --delimiter='/' --fields=3-` - $UDEV_BIN $CLASS -# fi + # try adding empty classes, just to test stuff... + export DEVPATH=${i#${SYSFS_DIR}} + CLASS=`echo ${i#${SYSFS_DIR}} | cut --delimiter='/' --fields=3-` + $UDEV_BIN $CLASS + + for j in `ls $i/`; do + x=$i/$j + export DEVPATH=${x#${SYSFS_DIR}} + CLASS=`echo ${i#${SYSFS_DIR}} | \ + cut --delimiter='/' --fields=3-` + $UDEV_BIN $CLASS done done } -- cgit v1.2.3-54-g00ecf From 7a947ce51586fd4212447643df90580542777ab9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 19:11:51 -0700 Subject: [PATCH] big cleanup of internal udev api Here is the first patch to cleanup the internal processing of the various stages of an udev event. It should not change any behavior, but if your system depends on udev, please always test it before reboot :) We pass only one generic structure around between add, remove, namedev, db and dev_d handling and make all relevant data available to all internal stages. All udev structures are renamed to "udev". We replace the fake parameter by a flag in the udev structure. We open the class device in the main binaries and not in udev_add, to make it possible to use libsysfs for udevstart directory crawling. The last sleep parameters are removed. --- dev_d.c | 18 +++---- extras/start_udev | 1 - namedev.c | 5 +- namedev.h | 2 +- test/udev-test.pl | 1 - udev.c | 40 +++++++++++----- udev.h | 18 +++---- udev_add.c | 140 +++++++++++++++++++++--------------------------------- udev_lib.c | 9 +++- udev_lib.h | 2 + udev_remove.c | 39 ++++++++------- udevdb.c | 36 +++++++------- udevdb.h | 4 +- udevinfo.c | 2 +- udevstart.c | 28 ++++++++--- udevtest.c | 22 +++++++-- 16 files changed, 193 insertions(+), 174 deletions(-) diff --git a/dev_d.c b/dev_d.c index eaf9b1dc12..5580b5a362 100644 --- a/dev_d.c +++ b/dev_d.c @@ -80,7 +80,7 @@ static int run_program(char *name) * subsystem/ * default/ */ -void dev_d_send(struct udevice *dev, const char *subsystem, const char *devpath) +void dev_d_send(struct udevice *udev) { char dirname[256]; char env_devname[NAME_SIZE]; @@ -91,17 +91,17 @@ void dev_d_send(struct udevice *dev, const char *subsystem, const char *devpath) return; memset(env_devname, 0x00, sizeof(env_devname)); - if (dev->type == 'b' || dev->type == 'c') { + if (udev->type == 'b' || udev->type == 'c') { strfieldcpy(env_devname, udev_root); - strfieldcat(env_devname, dev->name); - } else if (dev->type == 'n') { - strfieldcpy(env_devname, dev->name); - setenv("DEVPATH", devpath, 1); + strfieldcat(env_devname, udev->name); + } else if (udev->type == 'n') { + strfieldcpy(env_devname, udev->name); + setenv("DEVPATH", udev->devpath, 1); } setenv("DEVNAME", env_devname, 1); dbg("DEVNAME='%s'", env_devname); - devname = strdup(dev->name); + devname = strdup(udev->name); if (!devname) { dbg("out of memory"); return; @@ -121,11 +121,11 @@ void dev_d_send(struct udevice *dev, const char *subsystem, const char *devpath) } strcpy(dirname, DEVD_DIR); - strfieldcat(dirname, dev->name); + strfieldcat(dirname, udev->name); call_foreach_file(run_program, dirname, DEVD_SUFFIX); strcpy(dirname, DEVD_DIR); - strfieldcat(dirname, subsystem); + strfieldcat(dirname, udev->subsystem); call_foreach_file(run_program, dirname, DEVD_SUFFIX); strcpy(dirname, DEVD_DIR "default"); diff --git a/extras/start_udev b/extras/start_udev index bbf32a1bb9..c2518761e3 100644 --- a/extras/start_udev +++ b/extras/start_udev @@ -30,7 +30,6 @@ udevd=/sbin/udevd run_udev () { export ACTION=add - export UDEV_NO_SLEEP=1 # handle block devices and their partitions for i in ${sysfs_dir}/block/*; do diff --git a/namedev.c b/namedev.c index 39f033726c..03fc41d234 100644 --- a/namedev.c +++ b/namedev.c @@ -692,7 +692,7 @@ try_parent: } -int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *udev) +int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_dev) { struct sysfs_class_device *class_dev_parent; struct sysfs_device *sysfs_device = NULL; @@ -718,9 +718,10 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud } if (sysfs_device) { - dbg("found /device-device: path='%s', bus_id='%s', bus='%s'", + dbg("found devices device: path='%s', bus_id='%s', bus='%s'", sysfs_device->path, sysfs_device->bus_id, sysfs_device->bus); strfieldcpy(udev->bus_id, sysfs_device->bus_id); + strfieldcpy(udev->bus, sysfs_device->bus); } strfieldcpy(udev->kernel_name, class_dev->name); diff --git a/namedev.h b/namedev.h index fa924b14d9..f1e0082241 100644 --- a/namedev.h +++ b/namedev.h @@ -102,7 +102,7 @@ extern struct list_head config_device_list; extern struct list_head perm_device_list; extern int namedev_init(void); -extern int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *dev); +extern int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_dev); extern int namedev_init_permissions(void); extern int namedev_init_rules(void); diff --git a/test/udev-test.pl b/test/udev-test.pl index 9e4e192c51..a7becf99df 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1100,7 +1100,6 @@ EOF $ENV{UDEV_TEST} = "yes"; $ENV{SYSFS_PATH} = $sysfs; $ENV{UDEV_CONFIG_FILE} = $main_conf; -$ENV{UDEV_NO_SLEEP} = "yes"; $ENV{UDEV_NO_DEVD} = "yes"; diff --git a/udev.c b/udev.c index 10a937e472..8d5be0542e 100644 --- a/udev.c +++ b/udev.c @@ -107,9 +107,9 @@ static int subsystem_without_dev(const char *subsystem) int main(int argc, char *argv[], char *envp[]) { struct sigaction act; - char *action; - char *devpath = ""; - char *subsystem = ""; + struct sysfs_class_device *class_dev; + struct udevice udev; + char path[SYSFS_PATH_MAX]; int retval = -EINVAL; enum { ADD, @@ -129,7 +129,10 @@ int main(int argc, char *argv[], char *envp[]) if (strstr(argv[0], "udevstart")) { act_type = UDEVSTART; } else { - action = get_action(); + const char *action = get_action(); + const char *devpath = get_devpath(); + const char *subsystem = get_subsystem(main_argv[1]); + if (!action) { dbg("no action?"); goto exit; @@ -139,16 +142,15 @@ int main(int argc, char *argv[], char *envp[]) } else if (strcmp(action, "remove") == 0) { act_type = REMOVE; } else { - dbg("unknown action '%s'", action); + dbg("no action '%s' for us", action); goto exit; } - devpath = get_devpath(); if (!devpath) { dbg("no devpath?"); goto exit; } - dbg("looking at '%s'", devpath); + dbg("looking at '%s'", udev.devpath); /* we only care about class devices and block stuff */ if (!strstr(devpath, "class") && !strstr(devpath, "block")) { @@ -156,17 +158,18 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - subsystem = get_subsystem(main_argv[1]); if (!subsystem) { - dbg("no subsystem?"); + dbg("no subsystem"); goto exit; } /* skip blacklisted subsystems */ if (subsystem_without_dev(subsystem)) { dbg("don't care about '%s' devices", subsystem); - exit(0); + goto exit; }; + + udev_set_values(&udev, devpath, subsystem); } /* set signal handlers */ @@ -192,12 +195,25 @@ int main(int argc, char *argv[], char *envp[]) break; case ADD: dbg("udev add"); + + /* init rules */ namedev_init(); - retval = udev_add_device(devpath, subsystem, NOFAKE); + + /* open the device */ + snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); + class_dev = sysfs_open_class_device_path(path); + if (class_dev == NULL) { + dbg ("sysfs_open_class_device_path failed"); + break; + } + dbg("opened class_dev->name='%s'", class_dev->name); + + /* name, create node, store in db */ + retval = udev_add_device(&udev, class_dev); break; case REMOVE: dbg("udev remove"); - retval = udev_remove_device(devpath, subsystem); + retval = udev_remove_device(&udev); } udevdb_exit(); diff --git a/udev.h b/udev.h index 642b30b517..70de729f30 100644 --- a/udev.h +++ b/udev.h @@ -41,11 +41,8 @@ #define LINE_SIZE 256 -#define FAKE 1 -#define NOFAKE 0 - /* length of public data to store in udevdb */ -#define UDEVICE_LEN (offsetof(struct udevice, bus_id)) +#define UDEVICE_DB_LEN (offsetof(struct udevice, devpath)) struct udevice { char name[NAME_SIZE]; @@ -61,20 +58,23 @@ struct udevice { char config_file[NAME_SIZE]; long config_uptime; - /* private data that help us in building strings */ + /* private data, not stored in udevdb */ + char devpath[DEVPATH_SIZE]; + char subsystem[SUBSYSTEM_SIZE]; char bus_id[SYSFS_NAME_LEN]; + char bus[SYSFS_NAME_LEN]; char program_result[NAME_SIZE]; char kernel_number[NAME_SIZE]; char kernel_name[NAME_SIZE]; + int test_run; }; -extern int udev_add_device(const char *path, const char *subsystem, int fake); -extern int udev_remove_device(const char *path, const char *subsystem); +extern int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev); +extern int udev_remove_device(struct udevice *udev); extern void udev_init_config(void); extern int udev_start(void); extern int parse_get_pair(char **orig_string, char **left, char **right); -extern void dev_d_send(struct udevice *dev, const char *subsystem, - const char *devpath); +extern void dev_d_send(struct udevice *udev); extern char **main_argv; extern char **main_envp; diff --git a/udev_add.c b/udev_add.c index 08257609ad..d07120de62 100644 --- a/udev_add.c +++ b/udev_add.c @@ -186,7 +186,7 @@ static void set_to_local_user(char *user) endutent(); } -static int create_node(struct udevice *dev, int fake) +static int create_node(struct udevice *udev) { char filename[NAME_SIZE]; char linkname[NAME_SIZE]; @@ -200,90 +200,89 @@ static int create_node(struct udevice *dev, int fake) int len; strfieldcpy(filename, udev_root); - strfieldcat(filename, dev->name); + strfieldcat(filename, udev->name); - switch (dev->type) { + switch (udev->type) { case 'b': - dev->mode |= S_IFBLK; + udev->mode |= S_IFBLK; break; case 'c': case 'u': - dev->mode |= S_IFCHR; + udev->mode |= S_IFCHR; break; case 'p': - dev->mode |= S_IFIFO; + udev->mode |= S_IFIFO; break; default: - dbg("unknown node type %c\n", dev->type); + dbg("unknown node type %c\n", udev->type); return -EINVAL; } /* create parent directories if needed */ - if (strrchr(dev->name, '/')) + if (strrchr(udev->name, '/')) create_path(filename); - if (dev->owner[0] != '\0') { + if (udev->owner[0] != '\0') { char *endptr; - unsigned long id = strtoul(dev->owner, &endptr, 10); + unsigned long id = strtoul(udev->owner, &endptr, 10); if (endptr[0] == '\0') uid = (uid_t) id; else { struct passwd *pw; - if (strncmp(dev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0) - set_to_local_user(dev->owner); + if (strncmp(udev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0) + set_to_local_user(udev->owner); - pw = getpwnam(dev->owner); + pw = getpwnam(udev->owner); if (pw == NULL) - dbg("specified user unknown '%s'", dev->owner); + dbg("specified user unknown '%s'", udev->owner); else uid = pw->pw_uid; } } - if (dev->group[0] != '\0') { + if (udev->group[0] != '\0') { char *endptr; - unsigned long id = strtoul(dev->group, &endptr, 10); + unsigned long id = strtoul(udev->group, &endptr, 10); if (endptr[0] == '\0') gid = (gid_t) id; else { - struct group *gr = getgrnam(dev->group); + struct group *gr = getgrnam(udev->group); if (gr == NULL) - dbg("specified group unknown '%s'", dev->group); + dbg("specified group unknown '%s'", udev->group); else gid = gr->gr_gid; } } - if (!fake) { + if (!udev->test_run) { info("creating device node '%s'", filename); - if (make_node(filename, dev->major, dev->minor, dev->mode, uid, gid) != 0) + if (make_node(filename, udev->major, udev->minor, udev->mode, uid, gid) != 0) goto error; } else { info("creating device node '%s', major = '%d', minor = '%d', " "mode = '%#o', uid = '%d', gid = '%d'", filename, - dev->major, dev->minor, (mode_t)dev->mode, uid, gid); + udev->major, udev->minor, (mode_t)udev->mode, uid, gid); } /* create all_partitions if requested */ - if (dev->partitions > 0) { - info("creating device partition nodes '%s[1-%i]'", filename, dev->partitions); - if (!fake) { - for (i = 1; i <= dev->partitions; i++) { + if (udev->partitions > 0) { + info("creating device partition nodes '%s[1-%i]'", filename, udev->partitions); + if (!udev->test_run) { + for (i = 1; i <= udev->partitions; i++) { strfieldcpy(partitionname, filename); strintcat(partitionname, i); - make_node(partitionname, dev->major, - dev->minor + i, dev->mode, uid, gid); + make_node(partitionname, udev->major, udev->minor + i, udev->mode, uid, gid); } } } /* create symlink(s) if requested */ - foreach_strpart(dev->symlink, " ", pos, len) { + foreach_strpart(udev->symlink, " ", pos, len) { strfieldcpymax(linkname, pos, len+1); strfieldcpy(filename, udev_root); strfieldcat(filename, linkname); - dbg("symlink '%s' to node '%s' requested", filename, dev->name); - if (!fake) + dbg("symlink '%s' to node '%s' requested", filename, udev->name); + if (!udev->test_run) if (strrchr(linkname, '/')) create_path(filename); @@ -291,8 +290,8 @@ static int create_node(struct udevice *dev, int fake) linktarget[0] = '\0'; i = 0; tail = 0; - while ((dev->name[i] == linkname[i]) && dev->name[i]) { - if (dev->name[i] == '/') + while ((udev->name[i] == linkname[i]) && udev->name[i]) { + if (udev->name[i] == '/') tail = i+1; i++; } @@ -302,10 +301,10 @@ static int create_node(struct udevice *dev, int fake) i++; } - strfieldcat(linktarget, &dev->name[tail]); + strfieldcat(linktarget, &udev->name[tail]); dbg("symlink(%s, %s)", linktarget, filename); - if (!fake) { + if (!udev->test_run) { selinux_setfscreatecon(filename, S_IFLNK); unlink(filename); if (symlink(linktarget, filename) != 0) @@ -319,35 +318,14 @@ error: return -1; } -static struct sysfs_class_device *get_class_dev(const char *device_name) -{ - char dev_path[SYSFS_PATH_MAX]; - struct sysfs_class_device *class_dev = NULL; - - strfieldcpy(dev_path, sysfs_path); - strfieldcat(dev_path, device_name); - dbg("looking at '%s'", dev_path); - - /* open up the sysfs class device for this thing... */ - class_dev = sysfs_open_class_device_path(dev_path); - if (class_dev == NULL) { - dbg ("sysfs_open_class_device_path failed"); - goto exit; - } - dbg("class_dev->name='%s'", class_dev->name); - -exit: - return class_dev; -} - -static int rename_net_if(struct udevice *dev, int fake) +static int rename_net_if(struct udevice *udev) { int sk; struct ifreq ifr; int retval; - dbg("changing net interface name from '%s' to '%s'", dev->kernel_name, dev->name); - if (fake) + dbg("changing net interface name from '%s' to '%s'", udev->kernel_name, udev->name); + if (udev->test_run) return 0; sk = socket(PF_INET, SOCK_DGRAM, 0); @@ -357,8 +335,8 @@ static int rename_net_if(struct udevice *dev, int fake) } memset(&ifr, 0x00, sizeof(struct ifreq)); - strfieldcpy(ifr.ifr_name, dev->kernel_name); - strfieldcpy(ifr.ifr_newname, dev->name); + strfieldcpy(ifr.ifr_name, udev->kernel_name); + strfieldcpy(ifr.ifr_newname, udev->name); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) @@ -368,69 +346,57 @@ static int rename_net_if(struct udevice *dev, int fake) return retval; } -int udev_add_device(const char *path, const char *subsystem, int fake) +int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) { - struct sysfs_class_device *class_dev; - struct udevice dev; - char devpath[DEVPATH_SIZE]; char *pos; int retval = 0; - memset(&dev, 0x00, sizeof(dev)); - - dev.type = get_device_type(path, subsystem); - - class_dev = get_class_dev(path); - if (class_dev == NULL) - return -1; - - if (dev.type == 'b' || dev.type == 'c') { - retval = get_major_minor(class_dev, &dev); + if (udev->type == 'b' || udev->type == 'c') { + retval = get_major_minor(class_dev, udev); if (retval != 0) { dbg("no dev-file found, do nothing"); goto close; } } - if (namedev_name_device(class_dev, &dev) != 0) + if (namedev_name_device(udev, class_dev) != 0) goto exit; - dbg("name='%s'", dev.name); + dbg("adding name='%s'", udev->name); selinux_init(); - switch (dev.type) { + switch (udev->type) { case 'b': case 'c': - retval = create_node(&dev, fake); + retval = create_node(udev); if (retval != 0) goto exit; - if ((!fake) && (udevdb_add_dev(path, &dev) != 0)) + if ((!udev->test_run) && (udevdb_add_dev(udev) != 0)) dbg("udevdb_add_dev failed, but we are going to try " "to create the node anyway. But remove might not " "work properly for this device."); - dev_d_send(&dev, subsystem, path); + dev_d_send(udev); break; case 'n': - strfieldcpy(devpath, path); - if (strcmp(dev.name, dev.kernel_name) != 0) { - retval = rename_net_if(&dev, fake); + if (strcmp(udev->name, udev->kernel_name) != 0) { + retval = rename_net_if(udev); if (retval != 0) goto exit; /* netif's are keyed with the configured name, cause * the original kernel name sleeps with the fishes */ - pos = strrchr(devpath, '/'); + pos = strrchr(udev->devpath, '/'); if (pos != NULL) { pos[1] = '\0'; - strfieldcat(devpath, dev.name); + strfieldcat(udev->devpath, udev->name); } } - if ((!fake) && (udevdb_add_dev(devpath, &dev) != 0)) + if ((!udev->test_run) && (udevdb_add_dev(udev) != 0)) dbg("udevdb_add_dev failed"); - dev_d_send(&dev, subsystem, devpath); + dev_d_send(udev); break; } diff --git a/udev_lib.c b/udev_lib.c index 4991ec3acb..bd3eeba661 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -29,7 +29,6 @@ #include #include -#include "libsysfs/sysfs/libsysfs.h" #include "udev.h" #include "logging.h" #include "udev_lib.h" @@ -113,6 +112,14 @@ char get_device_type(const char *path, const char *subsystem) return '\0'; } +void udev_set_values(struct udevice *udev, const char* devpath, const char *subsystem) +{ + memset(udev, 0x00, sizeof(struct udevice)); + strfieldcpy(udev->devpath, devpath); + strfieldcpy(udev->subsystem, subsystem); + udev->type = get_device_type(devpath, subsystem); +} + int file_map(const char *filename, char **buf, size_t *bufsize) { struct stat stats; diff --git a/udev_lib.h b/udev_lib.h index e9ff379fc6..8a14ef00b6 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -22,6 +22,7 @@ #ifndef _UDEV_LIB_H_ #define _UDEV_LIB_H_ +#include "udev.h" #define strfieldcpy(to, from) \ do { \ @@ -81,6 +82,7 @@ extern char *get_devname(void); extern char *get_seqnum(void); extern char *get_subsystem(char *subsystem); extern char get_device_type(const char *path, const char *subsystem); +extern void udev_set_values(struct udevice *udev, const char* devpath, const char *subsystem); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); diff --git a/udev_remove.c b/udev_remove.c index d4be8bd6f9..d97a2411f4 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -161,35 +162,37 @@ static int delete_node(struct udevice *dev) } /* - * Look up the sysfs path in the database to see if we have named this device - * something different from the kernel name. If we have, us it. If not, use - * the default kernel name for lack of anything else to know to do. + * look up the sysfs path in the database to get the node name to remove + * If we can't find it, use kernel name for lack of anything else to know to do */ -int udev_remove_device(const char *path, const char *subsystem) +int udev_remove_device(struct udevice *udev) { - struct udevice dev; + struct udevice db_dev; char *temp; int retval; - memset(&dev, 0x00, sizeof(dev)); + memset(&db_dev, 0x00, sizeof(struct udevice)); - retval = udevdb_get_dev(path, &dev); - if (retval != 0) { - dbg("'%s' not found in database, falling back on default name", path); - temp = strrchr(path, '/'); + retval = udevdb_get_dev(udev->devpath, &db_dev); + if (retval == 0) { + /* get stored values in our device */ + memcpy(udev, &db_dev, UDEVICE_DB_LEN); + } else { + /* fall back to kernel name */ + temp = strrchr(udev->devpath, '/'); if (temp == NULL) return -ENODEV; - strfieldcpy(dev.name, &temp[1]); + strfieldcpy(udev->name, &temp[1]); + dbg("'%s' not found in database, falling back on default name", udev->name); } - dbg("name='%s'", dev.name); + dbg("remove name='%s'", udev->name); - dev.type = get_device_type(path, subsystem); - dev_d_send(&dev, subsystem, path); - udevdb_delete_dev(path); + dev_d_send(udev); + udevdb_delete_dev(udev->devpath); - if (dev.type == 'b' || dev.type == 'c') - retval = delete_node(&dev); - else if (dev.type == 'n') + if (udev->type == 'b' || udev->type == 'c') + retval = delete_node(udev); + else retval = 0; return retval; diff --git a/udevdb.c b/udevdb.c index a218b66179..3d0a9ea3c2 100644 --- a/udevdb.c +++ b/udevdb.c @@ -44,7 +44,7 @@ static TDB_CONTEXT *udevdb; sig_atomic_t gotalarm; -int udevdb_add_dev(const char *path, const struct udevice *dev) +int udevdb_add_dev(struct udevice *udev) { TDB_DATA key, data; char keystr[SYSFS_PATH_MAX]; @@ -52,22 +52,19 @@ int udevdb_add_dev(const char *path, const struct udevice *dev) if (udevdb == NULL) return -1; - if ((path == NULL) || (dev == NULL)) - return -ENODEV; - - memset(keystr, 0, SYSFS_PATH_MAX); - strfieldcpy(keystr, path); + memset(keystr, 0x00, SYSFS_PATH_MAX); + strfieldcpy(keystr, udev->devpath); key.dptr = keystr; key.dsize = strlen(keystr) + 1; - data.dptr = (void *)dev; - data.dsize = UDEVICE_LEN; - dbg("store key '%s' for device '%s'", path, dev->name); + data.dptr = (void *) udev; + data.dsize = UDEVICE_DB_LEN; + dbg("store key '%s' for device '%s'", keystr, udev->name); return tdb_store(udevdb, key, data, TDB_REPLACE); } -int udevdb_get_dev(const char *path, struct udevice *dev) +int udevdb_get_dev(const char *path, struct udevice *udev) { TDB_DATA key, data; @@ -84,8 +81,9 @@ int udevdb_get_dev(const char *path, struct udevice *dev) if (data.dptr == NULL || data.dsize == 0) return -ENODEV; - memset(dev, 0, sizeof(struct udevice)); - memcpy(dev, data.dptr, UDEVICE_LEN); + memset(udev, 0x00, sizeof(struct udevice)); + memcpy(udev, data.dptr, UDEVICE_DB_LEN); + return 0; } @@ -156,7 +154,7 @@ int udevdb_open_ro(void) return 0; } -static int (*user_record_callback) (char *path, struct udevice *dev); +static int (*user_record_callback) (const char *path, struct udevice *dev); static int traverse_callback(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) { @@ -167,7 +165,7 @@ static int traverse_callback(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void * udevdb_call_foreach: dumps whole database by passing record data to user function * @user_record_handler: user function called for every record in the database */ -int udevdb_call_foreach(int (*user_record_handler) (char *path, struct udevice *dev)) +int udevdb_call_foreach(int (*user_record_handler) (const char *path, struct udevice *dev)) { int retval = 0; @@ -191,27 +189,27 @@ static char *find_path; static const char *find_name; static int find_found; -static int find_device_by_name(char *path, struct udevice *dev) +static int find_device_by_name(const char *path, struct udevice *udev) { char *pos; int len; - if (strncmp(dev->name, find_name, sizeof(dev->name)) == 0) { - memcpy(find_dev, dev, sizeof(struct udevice)); + if (strncmp(udev->name, find_name, sizeof(udev->name)) == 0) { + memcpy(find_dev, udev, sizeof(struct udevice)); strfieldcpymax(find_path, path, NAME_SIZE); find_found = 1; /* stop search */ return 1; } /* look for matching symlink*/ - foreach_strpart(dev->symlink, " ", pos, len) { + foreach_strpart(udev->symlink, " ", pos, len) { if (strncmp(pos, find_name, len) != 0) continue; if (len != strlen(find_name)) continue; - memcpy(find_dev, dev, sizeof(struct udevice)); + memcpy(find_dev, udev, sizeof(struct udevice)); strfieldcpymax(find_path, path, NAME_SIZE); find_found = 1; return 1; diff --git a/udevdb.h b/udevdb.h index 6eaeb25668..6986a0a113 100644 --- a/udevdb.h +++ b/udevdb.h @@ -12,9 +12,9 @@ extern void udevdb_exit(void); extern int udevdb_init(int init_flag); extern int udevdb_open_ro(void); -extern int udevdb_call_foreach(int (*user_record_handler) (char *path, struct udevice *dev)); +extern int udevdb_call_foreach(int (*user_record_handler) (const char *path, struct udevice *dev)); -extern int udevdb_add_dev(const char *path, const struct udevice *dev); +extern int udevdb_add_dev(struct udevice *dev); extern int udevdb_get_dev(const char *path, struct udevice *dev); extern int udevdb_delete_dev(const char *path); extern int udevdb_get_dev_byname(const char *name, char *path, struct udevice *dev); diff --git a/udevinfo.c b/udevinfo.c index 763cfd139f..af2346c8f5 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -104,7 +104,7 @@ exit: } /* callback for database dump */ -static int print_record(char *path, struct udevice *dev) +static int print_record(const char *path, struct udevice *dev) { printf("P: %s\n", path); printf("N: %s\n", dev->name); diff --git a/udevstart.c b/udevstart.c index cabafb0abc..c4ec0f7b7a 100644 --- a/udevstart.c +++ b/udevstart.c @@ -33,6 +33,7 @@ #include #include +#include "libsysfs/sysfs/libsysfs.h" #include "logging.h" #include "udev_lib.h" #include "list.h" @@ -86,19 +87,32 @@ static char *first_list[] = { NULL, }; -static void add_device(char *path, char *subsys, int fake) +static int add_device(char *devpath, char *subsystem) { + struct udevice udev; + char path[SYSFS_PATH_MAX]; + struct sysfs_class_device *class_dev; char *argv[3]; /* fake argument vector and environment for callouts and dev.d/ */ argv[0] = "udev"; - argv[1] = subsys; + argv[1] = subsystem; argv[2] = NULL; main_argv = argv; - setenv("DEVPATH", path, 1); + setenv("DEVPATH", devpath, 1); setenv("ACTION", "add", 1); - udev_add_device(path, subsys, fake); + + snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); + class_dev = sysfs_open_class_device_path(path); + if (class_dev == NULL) { + dbg ("sysfs_open_class_device_path failed"); + return -ENODEV; + } + + udev_set_values(&udev, devpath, subsystem); + + return udev_add_device(&udev, class_dev); } static void exec_list(struct list_head *device_list) @@ -111,7 +125,7 @@ static void exec_list(struct list_head *device_list) list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { for (i=0; first_list[i] != NULL; i++) { if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { - add_device(loop_device->path, loop_device->subsys, NOFAKE); + add_device(loop_device->path, loop_device->subsys); list_del(&loop_device->list); free(loop_device); break; @@ -131,14 +145,14 @@ static void exec_list(struct list_head *device_list) if (found) continue; - add_device(loop_device->path, loop_device->subsys, NOFAKE); + add_device(loop_device->path, loop_device->subsys); list_del(&loop_device->list); free(loop_device); } /* handle the rest of the devices left over, if any */ list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - add_device(loop_device->path, loop_device->subsys, NOFAKE); + add_device(loop_device->path, loop_device->subsys); list_del(&loop_device->list); free(loop_device); } diff --git a/udevtest.c b/udevtest.c index df882d2d8c..fa1629af25 100644 --- a/udevtest.c +++ b/udevtest.c @@ -55,9 +55,12 @@ void log_message (int level, const char *format, ...) int main(int argc, char *argv[], char *envp[]) { + struct sysfs_class_device *class_dev; char *devpath; + char path[SYSFS_PATH_MAX]; char temp[NAME_SIZE]; char *subsystem = ""; + struct udevice udev; main_argv = argv; main_envp = envp; @@ -88,9 +91,8 @@ int main(int argc, char *argv[], char *envp[]) info("looking at '%s'", devpath); /* we only care about class devices and block stuff */ - if (!strstr(devpath, "class") && - !strstr(devpath, "block")) { - info("not a block or class device"); + if (!strstr(devpath, "class") && !strstr(devpath, "block")) { + dbg("not a block or class device"); goto exit; } @@ -100,8 +102,20 @@ int main(int argc, char *argv[], char *envp[]) if (argv[2] != NULL) subsystem = argv[2]; + /* fill in values and test_run flag*/ + udev_set_values(&udev, devpath, subsystem); + udev.test_run = 1; + + /* open the device */ + snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); + class_dev = sysfs_open_class_device_path(path); + if (class_dev == NULL) + dbg ("sysfs_open_class_device_path failed"); + else + dbg("opened class_dev->name='%s'", class_dev->name); + /* simulate node creation with fake flag */ - udev_add_device(devpath, subsystem, FAKE); + udev_add_device(&udev, class_dev); exit: return 0; -- cgit v1.2.3-54-g00ecf From 5d24c6ca364c6232efa626049b03d02c15ab5e85 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 19:28:39 -0700 Subject: [PATCH] cleanup netif handling and netif-dev.d/ events Here we supress the dev.d/ execution if we didn't change a network interface's name with a rule. This should solve the issue of two running dhclients for the same interface, cause the /etc/dev.d/net/hotplug.dev script that fakes the hotplug event runs with every udevstart for every interface and fakes a second identical hotplug event on bootup. With this patch netif interfaces are no longer stored in the udevdb. It is not needed, cause we don't have permissions or symlinks :) and all information is available in sysfs. This patch also moves the dev_d execution calls out of the udev_add/udev_remove. As with the former api-cleanup-patch we have all processed data in one udev struct and can place the execution calls where needed. --- dev_d.c | 37 +++++++++++++++---------------------- udev.c | 10 ++++++++++ udev.h | 3 ++- udev_add.c | 39 +++++++++++++++++++-------------------- udev_remove.c | 20 +++++++++----------- udevdb.c | 3 +++ udevstart.c | 10 ++++++++-- udevtest.c | 17 +++++++++-------- 8 files changed, 75 insertions(+), 64 deletions(-) diff --git a/dev_d.c b/dev_d.c index 5580b5a362..be85f52775 100644 --- a/dev_d.c +++ b/dev_d.c @@ -62,7 +62,7 @@ static int run_program(char *name) execv(name, argv); dbg("exec of child failed"); - exit(1); + _exit(1); case -1: dbg("fork of child failed"); break; @@ -80,42 +80,35 @@ static int run_program(char *name) * subsystem/ * default/ */ -void dev_d_send(struct udevice *udev) +void dev_d_execute(struct udevice *udev) { - char dirname[256]; - char env_devname[NAME_SIZE]; - char *devname; + char dirname[PATH_MAX]; + char devname[NAME_SIZE]; char *temp; + /* skip if UDEV_NO_DEVD is set */ if (udev_dev_d == 0) return; - memset(env_devname, 0x00, sizeof(env_devname)); - if (udev->type == 'b' || udev->type == 'c') { - strfieldcpy(env_devname, udev_root); - strfieldcat(env_devname, udev->name); - } else if (udev->type == 'n') { - strfieldcpy(env_devname, udev->name); - setenv("DEVPATH", udev->devpath, 1); - } - setenv("DEVNAME", env_devname, 1); - dbg("DEVNAME='%s'", env_devname); - - devname = strdup(udev->name); - if (!devname) { - dbg("out of memory"); + /* skip if udev did nothing, like unchanged netif or no "dev" file */ + if (udev->devname[0] == '\0') return; - } + + /* add the node name or the netif name to the environment */ + setenv("DEVNAME", udev->devname, 1); + dbg("DEVNAME='%s'", udev->devname); + + strfieldcpy(devname, udev->name); /* Chop the device name up into pieces based on '/' */ temp = strchr(devname, '/'); while (temp != NULL) { - *temp = 0x00; + temp[0] = '\0'; strcpy(dirname, DEVD_DIR); strfieldcat(dirname, devname); call_foreach_file(run_program, dirname, DEVD_SUFFIX); - *temp = '/'; + temp[0] = '/'; ++temp; temp = strchr(temp, '/'); } diff --git a/udev.c b/udev.c index 8d5be0542e..dfb2baddbc 100644 --- a/udev.c +++ b/udev.c @@ -210,10 +210,20 @@ int main(int argc, char *argv[], char *envp[]) /* name, create node, store in db */ retval = udev_add_device(&udev, class_dev); + + /* run scripts */ + dev_d_execute(&udev); + + sysfs_close_class_device(class_dev); break; case REMOVE: dbg("udev remove"); + + /* get node from db, delete it*/ retval = udev_remove_device(&udev); + + /* run scripts */ + dev_d_execute(&udev); } udevdb_exit(); diff --git a/udev.h b/udev.h index 70de729f30..f7a13a634b 100644 --- a/udev.h +++ b/udev.h @@ -66,6 +66,7 @@ struct udevice { char program_result[NAME_SIZE]; char kernel_number[NAME_SIZE]; char kernel_name[NAME_SIZE]; + char devname[NAME_SIZE]; int test_run; }; @@ -74,7 +75,7 @@ extern int udev_remove_device(struct udevice *udev); extern void udev_init_config(void); extern int udev_start(void); extern int parse_get_pair(char **orig_string, char **left, char **right); -extern void dev_d_send(struct udevice *udev); +extern void dev_d_execute(struct udevice *udev); extern char **main_argv; extern char **main_envp; diff --git a/udev_add.c b/udev_add.c index d07120de62..809a33cedb 100644 --- a/udev_add.c +++ b/udev_add.c @@ -355,7 +355,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) retval = get_major_minor(class_dev, udev); if (retval != 0) { dbg("no dev-file found, do nothing"); - goto close; + return 0; } } @@ -365,45 +365,44 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) dbg("adding name='%s'", udev->name); selinux_init(); - switch (udev->type) { - case 'b': - case 'c': + + if (udev->type == 'b' || udev->type == 'c') { retval = create_node(udev); if (retval != 0) goto exit; - if ((!udev->test_run) && (udevdb_add_dev(udev) != 0)) - dbg("udevdb_add_dev failed, but we are going to try " - "to create the node anyway. But remove might not " - "work properly for this device."); - dev_d_send(udev); - break; + if (udevdb_add_dev(udev) != 0) + dbg("udevdb_add_dev failed, but we create the node anyway, " + "remove might not work for custom names"); - case 'n': + /* use full path to the environment */ + snprintf(udev->devname, NAME_SIZE-1, "%s%s", udev_root, udev->name); + + } else if (udev->type == 'n') { + /* look if we want to change the name of the netif */ if (strcmp(udev->name, udev->kernel_name) != 0) { retval = rename_net_if(udev); if (retval != 0) goto exit; - /* netif's are keyed with the configured name, cause - * the original kernel name sleeps with the fishes + + /* we've changed the name, now fake the devpath, + * cause original kernel name sleeps with the fishes + * and we don't get any event from the kernel now */ pos = strrchr(udev->devpath, '/'); if (pos != NULL) { pos[1] = '\0'; strfieldcat(udev->devpath, udev->name); + setenv("DEVPATH", udev->devpath, 1); } - } - if ((!udev->test_run) && (udevdb_add_dev(udev) != 0)) - dbg("udevdb_add_dev failed"); - dev_d_send(udev); - break; + /* use netif name for the environment */ + strfieldcpy(udev->devname, udev->name); + } } exit: selinux_restore(); -close: - sysfs_close_class_device(class_dev); return retval; } diff --git a/udev_remove.c b/udev_remove.c index d97a2411f4..0dcec731ea 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -36,7 +36,7 @@ #include "namedev.h" #include "udevdb.h" -static int delete_path(char *path) +static int delete_path(const char *path) { char *pos; int retval; @@ -168,14 +168,15 @@ static int delete_node(struct udevice *dev) int udev_remove_device(struct udevice *udev) { struct udevice db_dev; - char *temp; + const char *temp; int retval; - memset(&db_dev, 0x00, sizeof(struct udevice)); + if (udev->type != 'b' && udev->type != 'c') + return 0; retval = udevdb_get_dev(udev->devpath, &db_dev); if (retval == 0) { - /* get stored values in our device */ + /* copy over the stored values to our device */ memcpy(udev, &db_dev, UDEVICE_DB_LEN); } else { /* fall back to kernel name */ @@ -185,15 +186,12 @@ int udev_remove_device(struct udevice *udev) strfieldcpy(udev->name, &temp[1]); dbg("'%s' not found in database, falling back on default name", udev->name); } - dbg("remove name='%s'", udev->name); - dev_d_send(udev); + dbg("remove name='%s'", udev->name); udevdb_delete_dev(udev->devpath); - if (udev->type == 'b' || udev->type == 'c') - retval = delete_node(udev); - else - retval = 0; + /* use full path to the environment */ + snprintf(udev->devname, NAME_SIZE-1, "%s%s", udev_root, udev->name); - return retval; + return delete_node(udev); } diff --git a/udevdb.c b/udevdb.c index 3d0a9ea3c2..23de22751d 100644 --- a/udevdb.c +++ b/udevdb.c @@ -49,6 +49,9 @@ int udevdb_add_dev(struct udevice *udev) TDB_DATA key, data; char keystr[SYSFS_PATH_MAX]; + if (udev->test_run) + return 0; + if (udevdb == NULL) return -1; diff --git a/udevstart.c b/udevstart.c index c4ec0f7b7a..fd490f0791 100644 --- a/udevstart.c +++ b/udevstart.c @@ -103,7 +103,7 @@ static int add_device(char *devpath, char *subsystem) setenv("DEVPATH", devpath, 1); setenv("ACTION", "add", 1); - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); + snprintf(path, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { dbg ("sysfs_open_class_device_path failed"); @@ -111,8 +111,14 @@ static int add_device(char *devpath, char *subsystem) } udev_set_values(&udev, devpath, subsystem); + udev_add_device(&udev, class_dev); - return udev_add_device(&udev, class_dev); + /* run scripts */ + dev_d_execute(&udev); + + sysfs_close_class_device(class_dev); + + return 0; } static void exec_list(struct list_head *device_list) diff --git a/udevtest.c b/udevtest.c index fa1629af25..f2b0c98edb 100644 --- a/udevtest.c +++ b/udevtest.c @@ -69,12 +69,9 @@ int main(int argc, char *argv[], char *envp[]) if (argv[1] == NULL) { info("udevinfo expects the DEVPATH of the sysfs device as a argument"); - goto exit; + return 1; } - /* initialize our configuration */ - udev_init_config(); - /* remove sysfs_path if given */ if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) devpath = argv[1] + strlen(sysfs_path); @@ -93,9 +90,12 @@ int main(int argc, char *argv[], char *envp[]) /* we only care about class devices and block stuff */ if (!strstr(devpath, "class") && !strstr(devpath, "block")) { dbg("not a block or class device"); - goto exit; + return 2; } + /* initialize our configuration */ + udev_init_config(); + /* initialize the naming deamon */ namedev_init(); @@ -104,7 +104,6 @@ int main(int argc, char *argv[], char *envp[]) /* fill in values and test_run flag*/ udev_set_values(&udev, devpath, subsystem); - udev.test_run = 1; /* open the device */ snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); @@ -114,9 +113,11 @@ int main(int argc, char *argv[], char *envp[]) else dbg("opened class_dev->name='%s'", class_dev->name); - /* simulate node creation with fake flag */ + /* simulate node creation with test flag */ + udev.test_run = 1; udev_add_device(&udev, class_dev); -exit: + sysfs_close_class_device(class_dev); + return 0; } -- cgit v1.2.3-54-g00ecf From 1da6b0d0a71960f49e1ecf8bd9f1bc9e14c2b90e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 18 Oct 2004 19:40:21 -0700 Subject: [PATCH] delete udevruler.c as per Kay's request. --- udevruler.c | 490 ------------------------------------------------------------ 1 file changed, 490 deletions(-) delete mode 100644 udevruler.c diff --git a/udevruler.c b/udevruler.c deleted file mode 100644 index a065591cd1..0000000000 --- a/udevruler.c +++ /dev/null @@ -1,490 +0,0 @@ -/* - * udevruler.c - simple udev-rule composer - * - * Reads the udev-db to get all currently known devices and - * scans the sysfs device chain for the choosen device to select attributes - * to compose a rule for the udev.rules file to uniquely name this device. - * - * Copyright (C) 2004 Kay Sievers - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_lib.h" -#include "udev_version.h" -#include "udevdb.h" -#include "logging.h" -#include "libsysfs/sysfs.h" -#include "list.h" - -#ifdef LOG -unsigned char logname[LOGNAME_SIZE]; -void log_message(int level, const char *format, ...) -{ - va_list args; - - if (!udev_log) - return; - - va_start(args, format); - vsyslog(level, format, args); - va_end(args); -} -#endif - -static char *dev_blacklist[] = { - "tty", - "pty", - "zero", - "null", - "kmsg", - "rtc", - "timer", - "full", - "kmem", - "mem", - "random", - "urandom", - "console", - "port", - "" -}; - -struct device { - struct list_head list; - char name[NAME_SIZE]; - char devpath[DEVPATH_SIZE]; - int config_line; - char config_file[NAME_SIZE]; - long config_uptime; - int added; -}; - -static LIST_HEAD(device_list); -static int device_count; - -/* callback for database dump */ -static int add_record(char *path, struct udevice *udev) -{ - struct device *dev; - struct device *loop_dev; - int i = 0; - - while (dev_blacklist[i][0] != '\0') { - if (strncmp(udev->name, dev_blacklist[i], strlen(dev_blacklist[i])) == 0) - goto exit; - i++; - } - - dev = malloc(sizeof(struct device)); - if (dev == NULL) { - printf("error malloc\n"); - exit(2); - } - strfieldcpy(dev->name, udev->name); - strfieldcpy(dev->devpath, path); - dev->config_line = udev->config_line; - strfieldcpy(dev->config_file, udev->config_file); - dev->config_uptime = udev->config_uptime; - dev->added = 0; - - /* sort in lexical order */ - list_for_each_entry(loop_dev, &device_list, list) { - if (strcmp(loop_dev->name, dev->name) > 0) { - break; - } - } - - list_add_tail(&dev->list, &loop_dev->list); - device_count++; - -exit: - return 0; -} - -/* get all devices from udev database */ -static int get_all_devices(void) -{ - int retval; - - device_count = 0; - INIT_LIST_HEAD(&device_list); - - retval = udevdb_open_ro(); - if (retval != 0) { - printf("unable to open udev database\n"); - exit(1); - } - - udevdb_call_foreach(add_record); - udevdb_exit(); - - return 0; -} - -struct attribute { - struct list_head list; - int level; - char key[NAME_SIZE]; -}; - -static LIST_HEAD(attribute_list); -static int attribute_count; - -static int add_attribute(const char *key, int level) -{ - struct attribute *attr; - - dbg("add attribute '%s'", key); - attr = malloc(sizeof(struct attribute)); - if (attr == NULL) { - printf("error malloc\n"); - exit(2); - } - - strfieldcpy(attr->key, key); - attr->level = level; - list_add_tail(&attr->list, &attribute_list); - attribute_count++; - return 0; -} - -static int add_all_attributes(const char *path, int level) -{ - struct dlist *attributes; - struct sysfs_attribute *attr; - struct sysfs_directory *sysfs_dir; - char value[NAME_SIZE]; - char key[NAME_SIZE]; - int len; - int retval = 0; - - dbg("look at '%s', level %i", path, level); - - sysfs_dir = sysfs_open_directory(path); - if (sysfs_dir == NULL) - return -1; - - attributes = sysfs_get_dir_attributes(sysfs_dir); - if (attributes == NULL) { - retval = -1; - return 0; - } - - dlist_for_each_data(attributes, attr, struct sysfs_attribute) - if (attr->value != NULL) { - dbg("found attribute '%s'", attr->name); - strfieldcpy(value, attr->value); - len = strlen(value); - if (len == 0) - continue; - - /* skip very long attributes */ - if (len > 40) - continue; - - /* remove trailing newline */ - if (value[len-1] == '\n') { - value[len-1] = '\0'; - len--; - } - - /* skip nonprintable values */ - while (len) { - if (!isprint(value[len-1])) - break; - len--; - } - if (len == 0) { - sprintf(key, "SYSFS{%s}=\"%s\"", attr->name, value); - add_attribute(key, level); - } - } - - sysfs_close_directory(sysfs_dir); - return 0; -} - -static int get_all_attributes(char *path) -{ - struct sysfs_class_device *class_dev; - struct sysfs_class_device *class_dev_parent; - struct sysfs_device *sysfs_dev; - struct sysfs_device *sysfs_dev_parent; - char key[NAME_SIZE]; - int retval = 0; - int level = 0; - - attribute_count = 0; - INIT_LIST_HEAD(&attribute_list); - - /* get the class dev */ - class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) { - dbg("couldn't get the class device"); - return -1; - } - - /* open sysfs class device directory and get all attributes */ - if (add_all_attributes(class_dev->path, level) != 0) { - dbg("couldn't open class device directory"); - retval = -1; - goto exit; - } - level++; - - /* get the device link (if parent exists look here) */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) - sysfs_dev = sysfs_get_classdev_device(class_dev_parent); - else - sysfs_dev = sysfs_get_classdev_device(class_dev); - - /* look the device chain upwards */ - while (sysfs_dev != NULL) { - if (sysfs_dev->bus[0] != '\0') { - add_attribute("", level); - sprintf(key, "BUS=\"%s\"", sysfs_dev->bus); - add_attribute(key, level); - sprintf(key, "ID=\"%s\"", sysfs_dev->bus_id); - add_attribute(key, level); - - /* open sysfs device directory and print all attributes */ - add_all_attributes(sysfs_dev->path, level); - } - level++; - - sysfs_dev_parent = sysfs_get_device_parent(sysfs_dev); - if (sysfs_dev_parent == NULL) - break; - - sysfs_dev = sysfs_dev_parent; - } - -exit: - sysfs_close_class_device(class_dev); - return retval; -} - - -int main(int argc, char *argv[]) { - newtComponent lbox, run, lattr; - newtComponent quit, form, answer; - newtGrid grid, grid2; - char roottext[81]; - char path[NAME_SIZE]; - struct device *dev; - long time_last; - int count_last; - - newtInit(); - newtCls(); - - newtWinMessage("udevruler", "Ok", - "This program lets you select a device currently present " - "on the system and you may choose the attributes to uniquely " - "name the device with a udev rule.\n" - "No configuration will be changed, it just prints the rule " - "to place in a udev.rules configuration file. The \"%k\" in the " - "NAME key of the printed rule may be replaced by the name the " - "node should have."); - - init_logging("udevruler"); - udev_init_config(); - get_all_devices(); - - lbox = newtListbox(2, 1, 10, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT); - - /* look for last discovered device */ - time_last = 0; - list_for_each_entry(dev, &device_list, list) - if (dev->config_uptime > time_last) - time_last = dev->config_uptime; - - /* skip if more than 16 recent devices */ - count_last = 0; - list_for_each_entry(dev, &device_list, list) { - if (dev->config_uptime < time_last - 10) - continue; - count_last++; - } - - /* add devices up to 10 seconds older than the last one */ - if (count_last < 16) { - newtListboxAppendEntry(lbox, "--- last dicovered ---", NULL); - list_for_each_entry(dev, &device_list, list) { - if (dev->config_uptime < time_last - 10) - continue; - - dbg("%s %i", dev->name, dev->config_line); - newtListboxAppendEntry(lbox, dev->name, (void*) dev); - dev->added = 1; - } - newtListboxAppendEntry(lbox, "", NULL); - } - - /* add devices not catched by a rule */ - newtListboxAppendEntry(lbox, "--- not configured by a rule ---", NULL); - list_for_each_entry(dev, &device_list, list) { - if (dev->added) - continue; - - if (dev->config_line != 0) - continue; - - dbg("%s %i", dev->name, dev->config_line); - newtListboxAppendEntry(lbox, dev->name, (void*) dev); - dev->added = 1; - } - newtListboxAppendEntry(lbox, "", NULL); - - /* add remaining devices */ - newtListboxAppendEntry(lbox, "--- configured by a rule ---", NULL); - list_for_each_entry(dev, &device_list, list) { - if (dev->added) - continue; - - dbg("%s %i", dev->name, dev->config_line); - newtListboxAppendEntry(lbox, dev->name, (void*) dev); - } - - newtPushHelpLine(" / between elements | Use to select a device"); - snprintf(roottext, sizeof(roottext), "simple udev rule composer, version %s, (c) 2004 can't sleep team", UDEV_VERSION); - roottext[sizeof(roottext)-1] = '\0'; - newtDrawRootText(0, 0, roottext); - - form = newtForm(NULL, NULL, 0); - grid = newtCreateGrid(1, 2); - grid2 = newtButtonBar("Select device", &run, "Quit", &quit, NULL); - newtGridSetField(grid, 0, 0, NEWT_GRID_COMPONENT, lbox, 1, 0, 1, 0, NEWT_ANCHOR_TOP, 0); - newtGridSetField(grid, 0, 1, NEWT_GRID_SUBGRID, grid2, 0, 1, 0, 0, NEWT_ANCHOR_TOP, 0); - newtFormAddComponents(form, lbox, run, quit, NULL); - newtGridWrappedWindow(grid,"Choose the device for which to compose a rule"); - newtGridFree(grid, 1); - - while (1) { - struct attribute *attr; - newtComponent ok, back, form2, answer2, text; - newtGrid grid3, grid4; - int i; - int numitems; - struct attribute **selattr; - char text_rule[255]; - - answer = newtRunForm(form); - if (answer == quit) - break; - - dev = (struct device *) newtListboxGetCurrent(lbox); - if (dev == NULL) - continue; - - if (dev->config_line > 0) - snprintf(text_rule, sizeof(text_rule), - "The device is handled by a rule in the file '%s', line %i.", - dev->config_file, dev->config_line); - else - strcpy(text_rule, "The device was not handled by a rule."); - - strfieldcpy(path, sysfs_path); - strfieldcat(path, dev->devpath); - dbg("look at sysfs device '%s'", path); - get_all_attributes(path); - - grid3 = newtCreateGrid(1, 3); - form2 = newtForm(NULL, NULL, 0); - grid4 = newtButtonBar("Ok", &ok, "Back", &back, NULL); - - lattr = newtListbox(-1, -1, 10, NEWT_FLAG_MULTIPLE | NEWT_FLAG_BORDER | NEWT_FLAG_RETURNEXIT); - list_for_each_entry(attr, &attribute_list, list) - newtListboxAddEntry(lattr, attr->key, (void *) attr); - - text = newtTextbox(-1, -1, 50, 2, NEWT_FLAG_WRAP); - newtTextboxSetText(text, text_rule); - - newtGridSetField(grid3, 0, 0, NEWT_GRID_COMPONENT, lattr, 0, 0, 0, 1, 0, 0); - newtGridSetField(grid3, 0, 1, NEWT_GRID_COMPONENT, text, 0, 0, 0, 1, 0, 0); - newtGridSetField(grid3, 0, 2, NEWT_GRID_SUBGRID, grid4, 0, 1, 0, 0, NEWT_ANCHOR_TOP, 0); - - newtFormAddComponents(form2, text, lattr, ok, back, NULL); - newtGridWrappedWindow(grid3, "Select one ore more attributes within one section with the space bar"); - newtGridFree(grid3, 1); - - while (1) { - char rule[255]; - int onelevel; - int skipped; - - answer2 = newtRunForm(form2); - if (answer2 == back) - break; - - selattr = (struct attribute **) newtListboxGetSelection(lattr, &numitems); - if (selattr == NULL) - continue; - - rule[0] = '\0'; - onelevel = -1; - skipped = 0; - for (i = 0; i < numitems; i++) { - if (selattr[i]->key[0] == '\0') - continue; - - if (onelevel != -1) { - if (onelevel != selattr[i]->level) { - skipped = 1; - continue; - } - } else { - onelevel = selattr[i]->level; - } - - dbg("'%s'\n", selattr[i]->key); - strfieldcat(rule, selattr[i]->key); - strfieldcat(rule, ", "); - } - if (skipped) { - newtWinMessage("error", "Ok", "Please select only attributes within one section"); - continue; - } - - if (strlen(rule) > 200) { - newtWinMessage("error", "Ok", "The line is too long, please select fewer attributes."); - } else { - if (rule[0] == '\0') - continue; - - strfieldcat(rule, "NAME=\"%k\""); - newtWinMessage("the rule to place in config file", "Ok", rule); - } - } - - newtPopWindow(); - } - - newtPopWindow(); - newtFormDestroy(form); - newtFinished(); - return 0; -} -- cgit v1.2.3-54-g00ecf From 9cd1b46a138dbdd6c3fad2e23f88e34740b3a054 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 20:51:13 -0700 Subject: [PATCH] $local user We once implemented the devfsd feature to set the owner of a device node to the "local" user. This was before we had the dev.d/ scripts. We discussed a similar issue with D-BUS recently and this should be better handled depending on the distributions way to do such a thing. I'm for removing this here as this can be easily covered by a dev.d/ script. Here is the patch if nobody objects :) --- klibc_fixups.c | 34 ---------------------------------- klibc_fixups.h | 5 ----- udev.8.in | 11 ----------- udev_add.c | 35 ----------------------------------- 4 files changed, 85 deletions(-) diff --git a/klibc_fixups.c b/klibc_fixups.c index d1a452a449..e68ce22b50 100644 --- a/klibc_fixups.c +++ b/klibc_fixups.c @@ -125,38 +125,4 @@ struct group *getgrnam(const char *name) return &gr; } - -int ufd = -1; - -void setutent() -{ - if (ufd < 0) - ufd = open(UTMP_FILE, O_RDONLY); - fcntl(ufd, F_SETFD, FD_CLOEXEC); - lseek(ufd, 0, SEEK_SET); -} - -void endutent() { - if (ufd < 0) - return; - close(ufd); - ufd = -1; -} - -struct utmp *getutent(void) -{ - static struct utmp utmp; - int retval; - - if (ufd < 0) { - setutent(); - if (ufd < 0) - return NULL; - } - retval = read(ufd, &utmp, sizeof(struct utmp)); - if (retval < 1) - return NULL; - return &utmp; -} - #endif diff --git a/klibc_fixups.h b/klibc_fixups.h index f6c91cdd94..082105eb8e 100644 --- a/klibc_fixups.h +++ b/klibc_fixups.h @@ -62,10 +62,5 @@ struct utmp char __unused[20]; /* reserved for future use */ }; -struct utmp *getutent(void); -void setutent(void); -void endutent(void); - - #endif /* KLIBC_FIXUPS_H */ #endif /* __KLIBC__ */ diff --git a/udev.8.in b/udev.8.in index c842e7befb..a7f0bf0392 100644 --- a/udev.8.in +++ b/udev.8.in @@ -335,17 +335,6 @@ video*:root:video:0660 dsp1:::0666 .fi .P -The value -.I $local -can be used instead of a specific username. In that case, udev will determine -the current local user at the time of device node creation and substitute -that username as the owner of the new device node. This is useful, for -example, to let hot-plugged devices, such as cameras, be owned by the user at -the current console. Note that if no user is currently logged in, or if udev -otherwise fails to determine a current user, the -.I default_owner -value is used in lieu. -.P A number of different fields in the above configuration files support a simple form of shell style pattern matching. It supports the following pattern characters: .TP diff --git a/udev_add.c b/udev_add.c index 809a33cedb..0e7d575d58 100644 --- a/udev_add.c +++ b/udev_add.c @@ -48,8 +48,6 @@ #include "udevdb.h" #include "klibc_fixups.h" -#define LOCAL_USER "$local" - #include "selinux.h" /* @@ -155,37 +153,6 @@ exit: return retval; } -/* get the local logged in user */ -static void set_to_local_user(char *user) -{ - struct utmp *u; - time_t recent = 0; - - strfieldcpymax(user, default_owner_str, OWNER_SIZE); - setutent(); - while (1) { - u = getutent(); - if (u == NULL) - break; - - /* is this a user login ? */ - if (u->ut_type != USER_PROCESS) - continue; - - /* is this a local login ? */ - if (strcmp(u->ut_host, "")) - continue; - - if (u->ut_time > recent) { - recent = u->ut_time; - strfieldcpymax(user, u->ut_user, OWNER_SIZE); - dbg("local user is '%s'", user); - break; - } - } - endutent(); -} - static int create_node(struct udevice *udev) { char filename[NAME_SIZE]; @@ -229,8 +196,6 @@ static int create_node(struct udevice *udev) uid = (uid_t) id; else { struct passwd *pw; - if (strncmp(udev->owner, LOCAL_USER, sizeof(LOCAL_USER)) == 0) - set_to_local_user(udev->owner); pw = getpwnam(udev->owner); if (pw == NULL) -- cgit v1.2.3-54-g00ecf From 1b1ba9336508dd1a06bb81bbf89b049e9e38f126 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 20:51:16 -0700 Subject: [PATCH] volume_id fix I've been told that open() should not pass O_NONBLOCK. --- extras/volume_id/volume_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index f18baec6ee..0b43bc8efb 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -2128,7 +2128,7 @@ struct volume_id *volume_id_open_node(const char *path) struct volume_id *id; int fd; - fd = open(path, O_RDONLY | O_NONBLOCK); + fd = open(path, O_RDONLY); if (fd < 0) { dbg("unable to open '%s'", path); return NULL; -- cgit v1.2.3-54-g00ecf From 4a760b333459003055816bc6a296c54327d521dc Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 18 Oct 2004 21:42:23 -0700 Subject: [PATCH] fix stupid cut-and-paste error for msr devices on gentoo boxes. --- etc/udev/udev.rules.gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 9245f6adcf..b33df81d25 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -132,5 +132,5 @@ KERNEL="raw[0-9]*", NAME="raw/%k" # cpu devices KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL="msr[0-9]*", NAME="cpu/%n/cpuid" +KERNEL="msr[0-9]*", NAME="cpu/%n/msr" KERNEL="microcode", NAME="cpu/microcode" -- cgit v1.2.3-54-g00ecf From 3b2382de5192057d4c3ac25ddce9c70348d756f9 Mon Sep 17 00:00:00 2001 From: "jk@blackdown.de" Date: Mon, 18 Oct 2004 22:10:38 -0700 Subject: [PATCH] wait_for_sysfs update for dm devices Hi, I got these when creating LVM2 snapshots: ,---- | Oct 17 04:23:09 server wait_for_sysfs[5120]: error: wait_for_sysfs needs an update to handle the device '/block/dm-6' properly, please report to | Oct 17 04:23:09 server wait_for_sysfs[5129]: error: wait_for_sysfs needs an update to handle the device '/block/dm-6' properly, please report to | Oct 17 04:23:09 server wait_for_sysfs[5131]: error: wait_for_sysfs needs an update to handle the device '/block/dm-7' properly, please report to | [...] `---- --- wait_for_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 8f142f488b..b6de3947c8 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -147,6 +147,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "block", .device = "pf" }, { .subsystem = "block", .device = "scd" }, { .subsystem = "block", .device = "ubd" }, + { .subsystem = "block", .device = "dm-" }, { .subsystem = "input", .device = "event" }, { .subsystem = "input", .device = "mice" }, { .subsystem = "input", .device = "mouse" }, -- cgit v1.2.3-54-g00ecf From ff694eca172deb298e806246f6e88bc66235534a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 22:57:41 -0700 Subject: [PATCH] fix debug in volume id / fix clashing global var name Here we get the logging for udev_volume_id working if it is compiled with DEBUG=true. Also fixed is a name clash with a global variable. --- extras/volume_id/Makefile | 5 ++--- extras/volume_id/udev_volume_id.c | 10 +++++++--- wait_for_sysfs.c | 8 ++++---- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index d0c6e40fa3..c419e8860f 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -28,9 +28,8 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-Wall -fno-builtin -Wchar-subscripts -Wmissing-declarations \ - -Wnested-externs -Wpointer-arith -Wcast-align \ - -Wsign-compare +override CFLAGS+=-Wall -fno-builtin -Wchar-subscripts \ + -Wpointer-arith -Wcast-align -Wsign-compare override CFLAGS+=-D_FILE_OFFSET_BITS=64 diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 6b62db0775..5d1ccf6a89 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) " -d disk label from main device\n" "\n"; static const char short_options[] = "htlud"; - char sysfs_path[SYSFS_PATH_MAX]; + char sysfs_mnt_path[SYSFS_PATH_MAX]; char dev_path[SYSFS_PATH_MAX]; struct sysfs_class_device *class_dev = NULL; struct sysfs_class_device *class_dev_parent = NULL; @@ -118,6 +118,8 @@ int main(int argc, char *argv[]) unsigned long long size; int rc = 1; + logging_init("udev_volume_id"); + while (1) { int option; @@ -152,12 +154,12 @@ int main(int argc, char *argv[]) goto exit; } - if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) { + if (sysfs_get_mnt_path(sysfs_mnt_path, SYSFS_PATH_MAX) != 0) { printf("error getting sysfs mount path\n"); goto exit; } - strfieldcpy(dev_path, sysfs_path); + strfieldcpy(dev_path, sysfs_mnt_path); strfieldcat(dev_path, devpath); class_dev = sysfs_open_class_device_path(dev_path); @@ -261,5 +263,7 @@ exit: if (vid != NULL) volume_id_close(vid); + logging_close(); + exit(rc); } diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index b6de3947c8..45f84606b1 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -387,7 +387,7 @@ int main(int argc, char *argv[], char *envp[]) const char *devpath = ""; const char *action; const char *subsystem; - char sysfs_path[SYSFS_PATH_MAX]; + char sysfs_mnt_path[SYSFS_PATH_MAX]; char filename[SYSFS_PATH_MAX]; struct sysfs_class_device *class_dev; struct sysfs_device *devices_dev; @@ -422,14 +422,14 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) { + if (sysfs_get_mnt_path(sysfs_mnt_path, SYSFS_PATH_MAX) != 0) { dbg("error: no sysfs path"); rc = 2; goto exit; } if ((strncmp(devpath, "/block/", 7) == 0) || (strncmp(devpath, "/class/", 7) == 0)) { - snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); + snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_mnt_path, devpath); filename[SYSFS_PATH_MAX-1] = '\0'; /* open the class device we are called for */ @@ -446,7 +446,7 @@ int main(int argc, char *argv[], char *envp[]) sysfs_close_class_device(class_dev); } else if ((strncmp(devpath, "/devices/", 9) == 0)) { - snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); + snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_mnt_path, devpath); filename[SYSFS_PATH_MAX-1] = '\0'; /* open the path we are called for */ -- cgit v1.2.3-54-g00ecf From 1ceba9360b4de2f9ad3f20c23133bbfec027c036 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 18 Oct 2004 23:14:20 -0700 Subject: [PATCH] sparse cleanups on the tree --- namedev_parse.c | 4 ++-- udev.c | 1 + udev_remove.c | 1 + udevd.c | 12 ++++++------ 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index 7e37833202..22e3523f3d 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -441,7 +441,7 @@ exit: return retval; } -int namedev_init_rules() +int namedev_init_rules(void) { struct stat stats; @@ -453,7 +453,7 @@ int namedev_init_rules() udev_rules_filename, RULEFILE_SUFFIX); } -int namedev_init_permissions() +int namedev_init_permissions(void) { struct stat stats; diff --git a/udev.c b/udev.c index dfb2baddbc..839bfa6520 100644 --- a/udev.c +++ b/udev.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" diff --git a/udev_remove.c b/udev_remove.c index 0dcec731ea..cd9d27f8dc 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "udev.h" #include "udev_lib.h" diff --git a/udevd.c b/udevd.c index 421c25a6e8..9e0f71b583 100644 --- a/udevd.c +++ b/udevd.c @@ -177,7 +177,7 @@ static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) } /* exec queue management routine executes the events and delays events for the same devpath */ -static void exec_queue_manager() +static void exec_queue_manager(void) { struct hotplug_msg *loop_msg; struct hotplug_msg *tmp_msg; @@ -207,7 +207,7 @@ static void msg_move_exec(struct hotplug_msg *msg) } /* msg queue management routine handles the timeouts and dispatches the events */ -static void msg_queue_manager() +static void msg_queue_manager(void) { struct hotplug_msg *loop_msg; struct hotplug_msg *tmp_msg; @@ -241,7 +241,7 @@ recheck: if (list_empty(&msg_list) == 0) { struct itimerval itv = {{0, 0}, {EVENT_TIMEOUT_SEC - msg_age, 0}}; dbg("next event expires in %li seconds", EVENT_TIMEOUT_SEC - msg_age); - setitimer(ITIMER_REAL, &itv, 0); + setitimer(ITIMER_REAL, &itv, NULL); } } @@ -366,11 +366,11 @@ static void udev_done(int pid) } } -static void reap_kids() +static void reap_kids(void) { /* reap all dead children */ while(1) { - int pid = waitpid(-1, 0, WNOHANG); + int pid = waitpid(-1, NULL, WNOHANG); if ((pid == -1) || (pid == 0)) break; udev_done(pid); @@ -380,7 +380,7 @@ static void reap_kids() /* just read everything from the pipe and clear the flag, * the useful flags were set in the signal handler */ -static void user_sighandler() +static void user_sighandler(void) { int sig; while(1) { -- cgit v1.2.3-54-g00ecf From 796ed8851b2fe8c592c2e903ff218352c418b9fc Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 19 Oct 2004 01:20:30 -0700 Subject: [PATCH] 040 release --- ChangeLog | 25 +++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ca7532a3fb..73d52d46a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +Summary of changes from v039 to v040 +============================================ + +: + o wait_for_sysfs update for dm devices + +Greg Kroah-Hartman: + o sparse cleanups on the tree + o fix stupid cut-and-paste error for msr devices on gentoo boxes + o add *~ to bk ignore list + o delete udevruler.c as per Kay's request + o fix up the wait_for_sysfs_test script a bit + +Kay Sievers: + o fix debug in volume id / fix clashing global var name + o volume_id fix + o $local user + o cleanup netif handling and netif-dev.d/ events + o big cleanup of internal udev api + o don't wait for dummy devices + o close the syslog + o Fix ppp net devices in wait_for_sysfs + o Fix wait_for_sysfs messages (more debugging info) + + Summary of changes from v038 to v039 ============================================ diff --git a/Makefile b/Makefile index 11f4781e0e..d0633b70af 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart WAIT = wait_for_sysfs -VERSION = 039 +VERSION = 040 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 44164124ed..9055512332 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 039 +Version: 040 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From f071348004c8069b610effd95309ff47c515cf3e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 19 Oct 2004 04:37:22 -0700 Subject: [PATCH] expose sysfs functions for sharing it This patch exposes the wait_for_sysfs functions to all possible users, so we need to maintain only one list of exceptions. The last list is hereby removed from udev.c. --- Makefile | 4 +- udev.c | 43 ++----- udev_sysfs.c | 387 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev_sysfs.h | 36 ++++++ wait_for_sysfs.c | 339 +----------------------------------------------- 5 files changed, 437 insertions(+), 372 deletions(-) create mode 100644 udev_sysfs.c create mode 100644 udev_sysfs.h diff --git a/Makefile b/Makefile index d0633b70af..4d25aee73e 100644 --- a/Makefile +++ b/Makefile @@ -212,6 +212,7 @@ OBJS = udev_lib.o \ udev_config.o \ udev_add.o \ udev_remove.o \ + udev_sysfs.o \ udevdb.o \ namedev.o \ namedev_parse.o \ @@ -224,6 +225,7 @@ HEADERS = udev.h \ namedev.h \ udev_version.h \ udevdb.h \ + udev_sysfs.h \ klibc_fixups.h \ logging.h \ selinux.h \ @@ -303,7 +305,7 @@ $(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h $(QUIET) $(STRIPCMD) $@ $(WAIT): $(WAIT).o $(OBJS) $(HEADERS) $(LIBC) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(WAIT).o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(WAIT).o udev_sysfs.o udev_lib.o udev_config.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ #.c.o: diff --git a/udev.c b/udev.c index 839bfa6520..5064bbd175 100644 --- a/udev.c +++ b/udev.c @@ -33,6 +33,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" #include "udev_lib.h" +#include "udev_sysfs.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" @@ -76,35 +77,6 @@ static void asmlinkage sig_handler(int signum) } } -/* list of subsystems we don't care about. not listing such systems here - * is not critical, but it makes it faster as we don't look for the "dev" file - */ -static int subsystem_without_dev(const char *subsystem) -{ - char *subsystem_blacklist[] = { - "scsi_host", - "scsi_device", - "usb_host", - "pci_bus", - "pcmcia_socket", - "bluetooth", - "i2c-adapter", - "pci_bus", - "ieee1394", - "ieee1394_host", - "ieee1394_node", - NULL - }; - char **subsys; - - for (subsys = subsystem_blacklist; *subsys != NULL; subsys++) { - if (strcmp(subsystem, *subsys) == 0) - return 1; - } - - return 0; -} - int main(int argc, char *argv[], char *envp[]) { struct sigaction act; @@ -151,7 +123,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("no devpath?"); goto exit; } - dbg("looking at '%s'", udev.devpath); + dbg("looking at '%s'", devpath); /* we only care about class devices and block stuff */ if (!strstr(devpath, "class") && !strstr(devpath, "block")) { @@ -164,13 +136,14 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + udev_set_values(&udev, devpath, subsystem); + /* skip blacklisted subsystems */ - if (subsystem_without_dev(subsystem)) { + if (udev.type != 'n' && subsystem_expect_no_dev(subsystem)) { dbg("don't care about '%s' devices", subsystem); goto exit; }; - udev_set_values(&udev, devpath, subsystem); } /* set signal handlers */ @@ -197,9 +170,6 @@ int main(int argc, char *argv[], char *envp[]) case ADD: dbg("udev add"); - /* init rules */ - namedev_init(); - /* open the device */ snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); class_dev = sysfs_open_class_device_path(path); @@ -209,6 +179,9 @@ int main(int argc, char *argv[], char *envp[]) } dbg("opened class_dev->name='%s'", class_dev->name); + /* init rules */ + namedev_init(); + /* name, create node, store in db */ retval = udev_add_device(&udev, class_dev); diff --git a/udev_sysfs.c b/udev_sysfs.c new file mode 100644 index 0000000000..624f53586f --- /dev/null +++ b/udev_sysfs.c @@ -0,0 +1,387 @@ +/* + * udev_sysfs.c - sysfs linux kernel specific knowledge + * + * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004 Greg Kroah-Hartman + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "logging.h" +#include "udev_version.h" +#include "udev_sysfs.h" +#include "libsysfs/sysfs/libsysfs.h" + +/* list of subsystem specific files + * NULL if there is no file to wait for + */ +static struct subsystem_file { + char *subsystem; + char *file; +} subsystem_files[] = { + { .subsystem = "net", .file = "ifindex" }, + { .subsystem = "scsi_host", .file = "unique_id" }, + { .subsystem = "scsi_device", .file = NULL }, + { .subsystem = "pcmcia_socket", .file = "card_type" }, + { .subsystem = "usb_host", .file = NULL }, + { .subsystem = "bluetooth", .file = "address" }, + { .subsystem = "firmware", .file = "data" }, + { .subsystem = "i2c-adapter", .file = NULL }, + { .subsystem = "pci_bus", .file = NULL }, + { .subsystem = "ieee1394", .file = NULL }, + { .subsystem = "ieee1394_host", .file = NULL }, + { .subsystem = "ieee1394_node", .file = NULL }, + { NULL, NULL } +}; + +int subsystem_expect_no_dev(const char *subsystem) +{ + struct subsystem_file *file; + + for (file = subsystem_files; file->subsystem != NULL; file++) + if (strcmp(subsystem, file->subsystem) == 0) + return 1; + + return 0; +} + +/* get subsystem specific files, returns "dev" if no other found */ +static char *get_subsystem_specific_file(const char *subsystem) +{ + struct subsystem_file *file; + + /* look if we want to look for another file instead of "dev" */ + for (file = subsystem_files; file->subsystem != NULL; file++) + if (strcmp(subsystem, file->subsystem) == 0) + return file->file; + + return "dev"; +} + +/* wait for class pecific file to show up */ +static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev, + const char **error) +{ + const char *file; + char filename[SYSFS_PATH_MAX]; + int loop; + + file = get_subsystem_specific_file(class_dev->classname); + if (file == NULL) { + dbg("class '%s' has no file to wait for", class_dev->classname); + return 0; + } + + strcpy(filename, class_dev->path); + strcat(filename, "/"); + strcat(filename, file); + dbg("looking at class '%s' for specific file '%s' with full name %s", class_dev->classname, file, filename); + + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + struct stat stats; + + if (stat(class_dev->path, &stats) == -1) { + dbg("'%s' now disappeared (probably remove has beaten us)", class_dev->path); + return -ENODEV; + } + + if (stat(filename, &stats) == 0) { + dbg("class '%s' specific file '%s' found", class_dev->classname, file); + return 0; + } + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + + dbg("error: getting class '%s' specific file '%s'", class_dev->classname, file); + if (error) + *error = "class specific file unavailable"; + return -ENOENT; +} + +/* check if we need to wait for a physical device */ +static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev) +{ + /* list of devices without a "device" symlink to the physical device + * if device is set to NULL, no devices in that subsystem has a link */ + static struct class_device { + char *subsystem; + char *device; + } class_device[] = { + { .subsystem = "block", .device = "double" }, + { .subsystem = "block", .device = "nb" }, + { .subsystem = "block", .device = "ram" }, + { .subsystem = "block", .device = "loop" }, + { .subsystem = "block", .device = "fd" }, + { .subsystem = "block", .device = "md" }, + { .subsystem = "block", .device = "dos_cd" }, + { .subsystem = "block", .device = "rflash" }, + { .subsystem = "block", .device = "rom" }, + { .subsystem = "block", .device = "rrom" }, + { .subsystem = "block", .device = "flash" }, + { .subsystem = "block", .device = "msd" }, + { .subsystem = "block", .device = "sbpcd" }, + { .subsystem = "block", .device = "pcd" }, + { .subsystem = "block", .device = "pf" }, + { .subsystem = "block", .device = "scd" }, + { .subsystem = "block", .device = "ubd" }, + { .subsystem = "block", .device = "dm-" }, + { .subsystem = "input", .device = "event" }, + { .subsystem = "input", .device = "mice" }, + { .subsystem = "input", .device = "mouse" }, + { .subsystem = "input", .device = "ts" }, + { .subsystem = "vc", .device = NULL }, + { .subsystem = "tty", .device = NULL }, + { .subsystem = "cpuid", .device = "cpu" }, + { .subsystem = "graphics", .device = "fb" }, + { .subsystem = "mem", .device = NULL }, + { .subsystem = "misc", .device = NULL }, + { .subsystem = "msr", .device = NULL }, + { .subsystem = "netlink", .device = NULL }, + { .subsystem = "net", .device = "sit" }, + { .subsystem = "net", .device = "lo" }, + { .subsystem = "net", .device = "tap" }, + { .subsystem = "net", .device = "ipsec" }, + { .subsystem = "net", .device = "dummy" }, + { .subsystem = "net", .device = "irda" }, + { .subsystem = "net", .device = "ppp" }, + { .subsystem = "ppp", .device = NULL }, + { .subsystem = "sound", .device = NULL }, + { .subsystem = "printer", .device = "lp" }, + { .subsystem = "nvidia", .device = NULL }, + { .subsystem = "video4linux", .device = "vbi" }, + { .subsystem = "lirc", .device = NULL }, + { .subsystem = "firmware", .device = NULL }, + { .subsystem = "drm", .device = NULL }, + { .subsystem = "pci_bus", .device = NULL }, + { .subsystem = "ieee1394", .device = NULL }, + { .subsystem = "ieee1394_host", .device = NULL }, + { .subsystem = "ieee1394_node", .device = NULL }, + { .subsystem = "raw", .device = NULL }, + { NULL, NULL } + }; + struct class_device *classdevice; + int len; + + for (classdevice = class_device; classdevice->subsystem != NULL; classdevice++) { + if (strcmp(class_dev->classname, classdevice->subsystem) == 0) { + /* see if no device in this class is expected to have a device-link */ + if (classdevice->device == NULL) + return 1; + + len = strlen(classdevice->device); + + /* see if device name matches */ + if (strncmp(class_dev->name, classdevice->device, len) != 0) + continue; + + /* exact name match */ + if (strlen(class_dev->name) == len) + return 1; + + /* name match with instance number */ + if (isdigit(class_dev->name[len])) + return 1; + } + } + + return 0; +} + +/* skip waiting for the bus */ +static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) +{ + static char *devices_without_bus[] = { + "scsi_host", + "i2c-adapter", + NULL + }; + char **device; + + for (device = devices_without_bus; *device != NULL; device++) { + int len = strlen(*device); + + if (strncmp(class_dev->classname, *device, len) == 0) + return 1; + } + + return 0; +} + +/* wait for the bus and for a bus specific file to show up */ +int wait_for_bus_device(struct sysfs_device *devices_dev, + const char **error) +{ + static struct bus_file { + char *bus; + char *file; + } bus_files[] = { + { .bus = "scsi", .file = "vendor" }, + { .bus = "usb", .file = "idVendor" }, + { .bus = "usb", .file = "iInterface" }, + { .bus = "usb", .file = "bNumEndpoints" }, + { .bus = "usb-serial", .file = "detach_state" }, + { .bus = "ide", .file = "detach_state" }, + { .bus = "pci", .file = "vendor" }, + { .bus = "platform", .file = "detach_state" }, + { .bus = "i2c", .file = "detach_state" }, + { NULL } + }; + struct bus_file *busfile; + int loop; + + /* wait for the bus device link to the devices device */ + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + if (sysfs_get_device_bus(devices_dev) == 0) + break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + if (loop == 0) { + dbg("error: getting bus device link"); + if (error) + *error = "no bus device link"; + return -1; + } + dbg("bus device link found for bus '%s'", devices_dev->bus); + + /* wait for a bus specific file to show up */ + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + int found = 0; + + for (busfile = bus_files; busfile->bus != NULL; busfile++) { + if (strcmp(devices_dev->bus, busfile->bus) == 0) { + found = 1; + dbg("looking at bus '%s' for specific file '%s'", devices_dev->bus, busfile->file); + if (sysfs_get_device_attr(devices_dev, busfile->file) != NULL) { + dbg("bus '%s' specific file '%s' found", devices_dev->bus, busfile->file); + return 0; + } + } + } + if (found == 0) { + if (error) + *error = "unknown bus"; + info("error: unknown bus, please report to " + " '%s'", devices_dev->bus); + return -1; + } + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + + dbg("error: getting bus '%s' specific file '%s'", devices_dev->bus, busfile->file); + if (error) + *error = "bus specific file unavailable"; + return -1; +} + + +struct sysfs_class_device *open_class_device_wait(const char *path) +{ + struct sysfs_class_device *class_dev; + int loop; + + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + class_dev = sysfs_open_class_device_path(path); + if (class_dev) + break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + + return (class_dev); +} + +int wait_for_class_device(struct sysfs_class_device *class_dev, + const char **error) +{ + struct sysfs_class_device *class_dev_parent; + struct sysfs_device *devices_dev = NULL; + int loop; + + if (wait_for_class_device_attributes(class_dev, error) != 0) + return -ENOENT; + + /* skip devices without devices-link */ + if (class_device_expect_no_device_link(class_dev)) { + dbg("no device symlink expected for '%s', ", class_dev->name); + return -ENODEV; + } + + /* the symlink may be on the parent device */ + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent) + dbg("looking at parent device for device link '%s'", class_dev_parent->path); + + /* wait for the symlink to the devices device */ + dbg("waiting for symlink to devices device"); + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + if (class_dev_parent) + devices_dev = sysfs_get_classdev_device(class_dev_parent); + else + devices_dev = sysfs_get_classdev_device(class_dev); + + if (devices_dev) + break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + if (!devices_dev) { + dbg(" error: no devices device symlink found"); + if (error) + *error = "no device symlink"; + return -ENODEV; + } + dbg("device symlink found pointing to '%s'", devices_dev->path); + + /* wait for the bus value */ + if (class_device_expect_no_bus(class_dev)) { + dbg("no bus device expected for '%s', ", class_dev->classname); + return 0; + } else { + return wait_for_bus_device(devices_dev, error); + } +} + +struct sysfs_device *open_devices_device_wait(const char *path) +{ + struct sysfs_device *devices_dev; + int loop; + + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + devices_dev = sysfs_open_device_path(path); + if (devices_dev) + break; + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + + return(devices_dev); +} diff --git a/udev_sysfs.h b/udev_sysfs.h new file mode 100644 index 0000000000..922db1be79 --- /dev/null +++ b/udev_sysfs.h @@ -0,0 +1,36 @@ +/* + * udev_sysfs.h + * + * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004 Greg Kroah-Hartman + * + * 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 02139, USA. + * + */ + +#ifndef _UDEV_SYSFS_H_ +#define _UDEV_SYSFS_H_ + +#include "libsysfs/sysfs/libsysfs.h" + +#define WAIT_MAX_SECONDS 5 +#define WAIT_LOOP_PER_SECOND 20 + +extern int subsystem_expect_no_dev(const char *subsystem); +extern int wait_for_bus_device(struct sysfs_device *devices_dev, const char **error); +extern int wait_for_class_device(struct sysfs_class_device *class_dev, const char **error); +extern struct sysfs_class_device *open_class_device_wait(const char *path); +extern struct sysfs_device *open_devices_device_wait(const char *path); + +#endif /* _UDEV_SYSFS_H_ */ diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 45f84606b1..e7eed441ee 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -34,12 +34,9 @@ #include "logging.h" #include "udev_version.h" +#include "udev_sysfs.h" #include "libsysfs/sysfs/libsysfs.h" -#ifndef FILENAME_MAX -#define FILENAME_MAX 4096 -#endif - #ifdef LOG unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) @@ -52,336 +49,6 @@ void log_message(int level, const char *format, ...) } #endif -#define WAIT_MAX_SECONDS 5 -#define WAIT_LOOP_PER_SECOND 20 - -/* wait for specific file to show up, normally the "dev"-file */ -static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev, - const char **error) -{ - static struct class_file { - char *subsystem; - char *file; - } class_files[] = { - { .subsystem = "net", .file = "ifindex" }, - { .subsystem = "scsi_host", .file = "unique_id" }, - { .subsystem = "scsi_device", .file = NULL }, - { .subsystem = "pcmcia_socket", .file = "card_type" }, - { .subsystem = "usb_host", .file = NULL }, - { .subsystem = "bluetooth", .file = "address" }, - { .subsystem = "firmware", .file = "data" }, - { .subsystem = "i2c-adapter", .file = NULL }, - { .subsystem = "pci_bus", .file = NULL }, - { .subsystem = "ieee1394", .file = NULL }, - { .subsystem = "ieee1394_host", .file = NULL }, - { .subsystem = "ieee1394_node", .file = NULL }, - { NULL, NULL } - }; - struct class_file *classfile; - char *file = "dev"; - char filename[FILENAME_MAX]; - int loop; - - /* look if we want to look for another file instead of "dev" */ - for (classfile = class_files; classfile->subsystem != NULL; classfile++) { - if (strcmp(class_dev->classname, classfile->subsystem) == 0) { - if (classfile->file == NULL) { - dbg("class '%s' has no file to wait for", class_dev->classname); - return 0; - } - file = classfile->file; - break; - } - } - - strcpy(filename, class_dev->path); - strcat(filename, "/"); - strcat(filename, file); - dbg("looking at class '%s' for specific file '%s' with full name %s", class_dev->classname, class_dev->path, filename); - - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - struct stat stats; - - if (stat(class_dev->path, &stats) == -1) { - dbg("'%s' now disappeared (probably remove has beaten us)", class_dev->path); - return -ENODEV; - } - - if (stat(filename, &stats) == 0) { - dbg("class '%s' specific file '%s' found", class_dev->classname, file); - return 0; - } - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - - dbg("error: getting class '%s' specific file '%s'", class_dev->classname, file); - *error = "class specific file unavailable"; - return -ENOENT; -} - -/* check if we need to wait for a physical device */ -static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev) -{ - /* list of devices without a "device" symlink to the physical device - * if device is set to NULL, no devices in that subsystem has a link */ - static struct class_device { - char *subsystem; - char *device; - } class_device[] = { - { .subsystem = "block", .device = "double" }, - { .subsystem = "block", .device = "nb" }, - { .subsystem = "block", .device = "ram" }, - { .subsystem = "block", .device = "loop" }, - { .subsystem = "block", .device = "fd" }, - { .subsystem = "block", .device = "md" }, - { .subsystem = "block", .device = "dos_cd" }, - { .subsystem = "block", .device = "rflash" }, - { .subsystem = "block", .device = "rom" }, - { .subsystem = "block", .device = "rrom" }, - { .subsystem = "block", .device = "flash" }, - { .subsystem = "block", .device = "msd" }, - { .subsystem = "block", .device = "sbpcd" }, - { .subsystem = "block", .device = "pcd" }, - { .subsystem = "block", .device = "pf" }, - { .subsystem = "block", .device = "scd" }, - { .subsystem = "block", .device = "ubd" }, - { .subsystem = "block", .device = "dm-" }, - { .subsystem = "input", .device = "event" }, - { .subsystem = "input", .device = "mice" }, - { .subsystem = "input", .device = "mouse" }, - { .subsystem = "input", .device = "ts" }, - { .subsystem = "vc", .device = NULL }, - { .subsystem = "tty", .device = NULL }, - { .subsystem = "cpuid", .device = "cpu" }, - { .subsystem = "graphics", .device = "fb" }, - { .subsystem = "mem", .device = NULL }, - { .subsystem = "misc", .device = NULL }, - { .subsystem = "msr", .device = NULL }, - { .subsystem = "netlink", .device = NULL }, - { .subsystem = "net", .device = "sit" }, - { .subsystem = "net", .device = "lo" }, - { .subsystem = "net", .device = "tap" }, - { .subsystem = "net", .device = "ipsec" }, - { .subsystem = "net", .device = "dummy" }, - { .subsystem = "net", .device = "irda" }, - { .subsystem = "net", .device = "ppp" }, - { .subsystem = "ppp", .device = NULL }, - { .subsystem = "sound", .device = NULL }, - { .subsystem = "printer", .device = "lp" }, - { .subsystem = "nvidia", .device = NULL }, - { .subsystem = "video4linux", .device = "vbi" }, - { .subsystem = "lirc", .device = NULL }, - { .subsystem = "firmware", .device = NULL }, - { .subsystem = "drm", .device = NULL }, - { .subsystem = "pci_bus", .device = NULL }, - { .subsystem = "ieee1394", .device = NULL }, - { .subsystem = "ieee1394_host", .device = NULL }, - { .subsystem = "ieee1394_node", .device = NULL }, - { .subsystem = "raw", .device = NULL }, - { NULL, NULL } - }; - struct class_device *classdevice; - int len; - - for (classdevice = class_device; classdevice->subsystem != NULL; classdevice++) { - if (strcmp(class_dev->classname, classdevice->subsystem) == 0) { - /* see if no device in this class is expected to have a device-link */ - if (classdevice->device == NULL) - return 1; - - len = strlen(classdevice->device); - - /* see if device name matches */ - if (strncmp(class_dev->name, classdevice->device, len) != 0) - continue; - - /* exact name match */ - if (strlen(class_dev->name) == len) - return 1; - - /* name match with instance number */ - if (isdigit(class_dev->name[len])) - return 1; - } - } - - return 0; -} - -/* skip waiting for the bus */ -static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) -{ - static char *devices_without_bus[] = { - "scsi_host", - "i2c-adapter", - NULL - }; - char **device; - - for (device = devices_without_bus; *device != NULL; device++) { - int len = strlen(*device); - - if (strncmp(class_dev->classname, *device, len) == 0) - return 1; - } - - return 0; -} - -/* wait for the bus and for a bus specific file to show up */ -static int wait_for_bus_device(struct sysfs_device *devices_dev, - const char **error) -{ - static struct bus_file { - char *bus; - char *file; - } bus_files[] = { - { .bus = "scsi", .file = "vendor" }, - { .bus = "usb", .file = "idVendor" }, - { .bus = "usb", .file = "iInterface" }, - { .bus = "usb", .file = "bNumEndpoints" }, - { .bus = "usb-serial", .file = "detach_state" }, - { .bus = "ide", .file = "detach_state" }, - { .bus = "pci", .file = "vendor" }, - { .bus = "platform", .file = "detach_state" }, - { .bus = "i2c", .file = "detach_state" }, - { NULL } - }; - struct bus_file *busfile; - int loop; - - /* wait for the bus device link to the devices device */ - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - if (sysfs_get_device_bus(devices_dev) == 0) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - if (loop == 0) { - dbg("error: getting bus device link"); - *error = "no bus device link"; - return -1; - } - dbg("bus device link found for bus '%s'", devices_dev->bus); - - /* wait for a bus specific file to show up */ - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - int found = 0; - - for (busfile = bus_files; busfile->bus != NULL; busfile++) { - if (strcmp(devices_dev->bus, busfile->bus) == 0) { - found = 1; - dbg("looking at bus '%s' for specific file '%s'", devices_dev->bus, busfile->file); - if (sysfs_get_device_attr(devices_dev, busfile->file) != NULL) { - dbg("bus '%s' specific file '%s' found", devices_dev->bus, busfile->file); - return 0; - } - } - } - if (found == 0) { - *error = "unknown bus"; - info("error: unknown bus, please report to " - " '%s'", devices_dev->bus); - return -1; - } - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - - dbg("error: getting bus '%s' specific file '%s'", devices_dev->bus, busfile->file); - *error = "bus specific file unavailable"; - return -1; -} - - -static struct sysfs_class_device *open_class_device(const char *path) -{ - struct sysfs_class_device *class_dev; - int loop; - - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - class_dev = sysfs_open_class_device_path(path); - if (class_dev) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - - return (class_dev); -} - -static int wait_for_class_device(struct sysfs_class_device *class_dev, - const char **error) -{ - struct sysfs_class_device *class_dev_parent; - struct sysfs_device *devices_dev = NULL; - int loop; - - if (wait_for_class_device_attributes(class_dev, error) != 0) - return -ENOENT; - - /* skip devices without devices-link */ - if (class_device_expect_no_device_link(class_dev)) { - dbg("no device symlink expected for '%s', ", class_dev->name); - return -ENODEV; - } - - /* the symlink may be on the parent device */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent) - dbg("looking at parent device for device link '%s'", class_dev_parent->path); - - /* wait for the symlink to the devices device */ - dbg("waiting for symlink to devices device"); - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - if (class_dev_parent) - devices_dev = sysfs_get_classdev_device(class_dev_parent); - else - devices_dev = sysfs_get_classdev_device(class_dev); - - if (devices_dev) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - if (!devices_dev) { - dbg(" error: no devices device symlink found"); - *error = "no device symlink"; - return -ENODEV; - } - dbg("device symlink found pointing to '%s'", devices_dev->path); - - /* wait for the bus value */ - if (class_device_expect_no_bus(class_dev)) { - dbg("no bus device expected for '%s', ", class_dev->classname); - return 0; - } else { - return wait_for_bus_device(devices_dev, error); - } -} - -static struct sysfs_device *open_devices_device(const char *path) -{ - struct sysfs_device *devices_dev; - int loop; - - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - devices_dev = sysfs_open_device_path(path); - if (devices_dev) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - - return(devices_dev); -} - int main(int argc, char *argv[], char *envp[]) { const char *devpath = ""; @@ -433,7 +100,7 @@ int main(int argc, char *argv[], char *envp[]) filename[SYSFS_PATH_MAX-1] = '\0'; /* open the class device we are called for */ - class_dev = open_class_device(filename); + class_dev = open_class_device_wait(filename); if (!class_dev) { dbg("error: class device unavailable (probably remove has beaten us)"); goto exit; @@ -450,7 +117,7 @@ int main(int argc, char *argv[], char *envp[]) filename[SYSFS_PATH_MAX-1] = '\0'; /* open the path we are called for */ - devices_dev = open_devices_device(filename); + devices_dev = open_devices_device_wait(filename); if (!devices_dev) { dbg("error: devices device unavailable (probably remove has beaten us)"); goto exit; -- cgit v1.2.3-54-g00ecf From 1ad9a8c1b8479d88f2e83fc21c2b5d2d366932f1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 23 Oct 2004 12:12:28 +0200 Subject: [PATCH] switch wait for bus_file to stat() instead of open() --- udev_sysfs.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index 624f53586f..d849a8eba7 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -93,10 +93,8 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev return 0; } - strcpy(filename, class_dev->path); - strcat(filename, "/"); - strcat(filename, file); - dbg("looking at class '%s' for specific file '%s' with full name %s", class_dev->classname, file, filename); + snprintf(filename, SYSFS_PATH_MAX-1, "%s/%s", class_dev->path, file); + dbg("looking at class '%s' for specific file '%s'", class_dev->classname, filename); loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { @@ -167,6 +165,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "dummy" }, { .subsystem = "net", .device = "irda" }, { .subsystem = "net", .device = "ppp" }, + { .subsystem = "net", .device = "tun" }, { .subsystem = "ppp", .device = NULL }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, @@ -247,7 +246,10 @@ int wait_for_bus_device(struct sysfs_device *devices_dev, { .bus = "pci", .file = "vendor" }, { .bus = "platform", .file = "detach_state" }, { .bus = "i2c", .file = "detach_state" }, - { NULL } + { .bus = "ieee1394", .file = "node_count" }, + { .bus = "ieee1394", .file = "nodeid" }, + { .bus = "ieee1394", .file = "address" }, + { NULL, NULL } }; struct bus_file *busfile; int loop; @@ -271,19 +273,24 @@ int wait_for_bus_device(struct sysfs_device *devices_dev, /* wait for a bus specific file to show up */ loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { - int found = 0; + int found_bus_type = 0; for (busfile = bus_files; busfile->bus != NULL; busfile++) { if (strcmp(devices_dev->bus, busfile->bus) == 0) { - found = 1; - dbg("looking at bus '%s' for specific file '%s'", devices_dev->bus, busfile->file); - if (sysfs_get_device_attr(devices_dev, busfile->file) != NULL) { + char filename[SYSFS_PATH_MAX]; + struct stat stats; + + found_bus_type = 1; + snprintf(filename, SYSFS_PATH_MAX-1, "%s/%s", devices_dev->path, busfile->file); + dbg("looking at bus '%s' for specific file '%s'", devices_dev->bus, filename); + + if (stat(filename, &stats) == 0) { dbg("bus '%s' specific file '%s' found", devices_dev->bus, busfile->file); return 0; } } } - if (found == 0) { + if (found_bus_type == 0) { if (error) *error = "unknown bus"; info("error: unknown bus, please report to " -- cgit v1.2.3-54-g00ecf From 21d2888a0a0d238594e4124fe8020f54bfa29df5 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 23 Oct 2004 12:13:01 +0200 Subject: [PATCH] add net/pan and net/bnep handling --- udev_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index d849a8eba7..7fc1099ee5 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -166,6 +166,8 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "irda" }, { .subsystem = "net", .device = "ppp" }, { .subsystem = "net", .device = "tun" }, + { .subsystem = "net", .device = "pan" }, + { .subsystem = "net", .device = "bnep" }, { .subsystem = "ppp", .device = NULL }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, -- cgit v1.2.3-54-g00ecf From ab51035617d5725305b8ef98eff6b7c64f3ccec6 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 23 Oct 2004 12:15:22 +0200 Subject: [PATCH] skip waiting for device if we get a bad event for class creation --- wait_for_sysfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index e7eed441ee..91a2b6b628 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -99,6 +99,12 @@ int main(int argc, char *argv[], char *envp[]) snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_mnt_path, devpath); filename[SYSFS_PATH_MAX-1] = '\0'; + /* skip bad events where we get no device for the class */ + if (strncmp(devpath, "/class/", 7) == 0 && strchr(&devpath[7], '/') == NULL) { + dbg("no device name for '%s', bad event", devpath); + goto exit; + } + /* open the class device we are called for */ class_dev = open_class_device_wait(filename); if (!class_dev) { -- cgit v1.2.3-54-g00ecf From 5cab7caa2a767b16211c15f0051a2e21a96ebfd9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 19 Oct 2004 04:37:30 -0700 Subject: [PATCH] cleanup udevd/udevstart Change to the same timeout loop we use in the rest of the code. Change some comments and names to be more descriptive. I'm mostly finished with the overall cleanup. I will post a new patch for the udevd-nofork experiment, which will be much smaller now. --- udevd.c | 52 ++++++++++++++++++++++++---------------------------- udevd.h | 4 +++- udevsend.c | 15 ++++++--------- 3 files changed, 33 insertions(+), 38 deletions(-) diff --git a/udevd.c b/udevd.c index 9e0f71b583..c5267d6d9f 100644 --- a/udevd.c +++ b/udevd.c @@ -46,7 +46,7 @@ static int pipefds[2]; static unsigned long long expected_seqnum = 0; -static volatile int children_waiting; +static volatile int sigchilds_waiting; static volatile int run_msg_q; static volatile int sig_flag; static int run_exec_q; @@ -58,7 +58,7 @@ static LIST_HEAD(running_list); static void exec_queue_manager(void); static void msg_queue_manager(void); static void user_sighandler(void); -static void reap_kids(void); +static void reap_sigchilds(void); char *udev_bin; #ifdef LOG @@ -325,7 +325,7 @@ static void asmlinkage sig_handler(int signum) break; case SIGCHLD: /* set flag, then write to pipe if needed */ - children_waiting = 1; + sigchilds_waiting = 1; goto do_write; break; default: @@ -366,9 +366,8 @@ static void udev_done(int pid) } } -static void reap_kids(void) +static void reap_sigchilds(void) { - /* reap all dead children */ while(1) { int pid = waitpid(-1, NULL, WNOHANG); if ((pid == -1) || (pid == 0)) @@ -378,13 +377,13 @@ static void reap_kids(void) } /* just read everything from the pipe and clear the flag, - * the useful flags were set in the signal handler + * the flags was set in the signal handler */ static void user_sighandler(void) { int sig; while(1) { - int rc = read(pipefds[0],&sig,sizeof(sig)); + int rc = read(pipefds[0], &sig, sizeof(sig)); if (rc < 0) break; @@ -392,14 +391,13 @@ static void user_sighandler(void) } } - -int main(int argc, char *argv[]) +int main(int argc, char *argv[], char *envp[]) { int ssock, maxsockplus; struct sockaddr_un saddr; socklen_t addrlen; int retval, fd; - const int on = 1; + const int feature_on = 1; struct sigaction act; fd_set readfds; @@ -408,11 +406,13 @@ int main(int argc, char *argv[]) if (getuid() != 0) { dbg("need to be root, exit"); - exit(1); + _exit(1); } - /* make sure we are at top of dir */ + + /* make sure we don't lock any path */ chdir("/"); - umask( umask( 077 ) | 022 ); + umask(umask(077) | 022); + /* Set fds to dev/null */ fd = open( "/dev/null", O_RDWR ); if ( fd < 0 ) { @@ -424,7 +424,8 @@ int main(int argc, char *argv[]) dup2(fd, 2); if (fd > 2) close(fd); - /* Get new session id so stray signals don't come our way. */ + + /* become session leader */ setsid(); /* setup signal handler pipe */ @@ -456,7 +457,6 @@ int main(int argc, char *argv[]) exit(1); } - /* set signal handlers */ act.sa_handler = (void (*) (int))sig_handler; sigemptyset(&act.sa_mask); @@ -493,7 +493,7 @@ int main(int argc, char *argv[]) } /* enable receiving of the sender credentials */ - setsockopt(ssock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + setsockopt(ssock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); /* possible override of udev binary, used for testing */ udev_bin = getenv("UDEV_BIN"); @@ -522,9 +522,9 @@ int main(int argc, char *argv[]) if (FD_ISSET(pipefds[0], &workreadfds)) user_sighandler(); - if (children_waiting) { - children_waiting = 0; - reap_kids(); + if (sigchilds_waiting) { + sigchilds_waiting = 0; + reap_sigchilds(); } if (run_msg_q) { @@ -533,14 +533,10 @@ int main(int argc, char *argv[]) } if (run_exec_q) { - /* this is tricky. exec_queue_manager() loops over exec_list, and - * calls running_with_devpath(), which loops over running_list. This gives - * O(N*M), which can get *nasty*. Clean up running_list before - * calling exec_queue_manager(). - */ - if (children_waiting) { - children_waiting = 0; - reap_kids(); + /* clean up running_list before calling exec_queue_manager() */ + if (sigchilds_waiting) { + sigchilds_waiting = 0; + reap_sigchilds(); } run_exec_q = 0; @@ -550,5 +546,5 @@ int main(int argc, char *argv[]) exit: close(ssock); logging_close(); - exit(1); + return 1; } diff --git a/udevd.h b/udevd.h index 9be581d420..657f684e3f 100644 --- a/udevd.h +++ b/udevd.h @@ -26,8 +26,10 @@ #define UDEV_MAGIC "udevd_" UDEV_VERSION #define EVENT_TIMEOUT_SEC 10 -#define UDEVSEND_CONNECT_RETRY 20 /* x 100 millisec */ #define UDEVD_SOCK_PATH "udevd" +#define SEND_WAIT_MAX_SECONDS 3 +#define SEND_WAIT_LOOP_PER_SECOND 10 + struct hotplug_msg { char magic[20]; diff --git a/udevsend.c b/udevsend.c index 883181c1b6..84c46bc0c2 100644 --- a/udevsend.c +++ b/udevsend.c @@ -95,9 +95,9 @@ static void run_udev(const char *subsystem) switch (pid) { case 0: /* child */ - execl(UDEV_BIN, "udev", subsystem, NULL); + execl(UDEV_BIN, UDEV_BIN, subsystem, NULL); dbg("exec of child failed"); - exit(1); + _exit(1); break; case -1: dbg("fork of child failed"); @@ -117,7 +117,6 @@ int main(int argc, char* argv[]) unsigned long long seq; int retval = 1; int loop; - struct timespec tspec; int sock = -1; struct sockaddr_un saddr; socklen_t addrlen; @@ -176,8 +175,8 @@ int main(int argc, char* argv[]) strfieldcpy(msg.subsystem, subsystem); /* If we can't send, try to start daemon and resend message */ - loop = UDEVSEND_CONNECT_RETRY; - while (loop--) { + loop = SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND; + while (--loop) { retval = sendto(sock, &msg, sizeof(struct hotplug_msg), 0, (struct sockaddr *)&saddr, addrlen); if (retval != -1) { @@ -200,10 +199,8 @@ int main(int argc, char* argv[]) dbg("daemon started"); started_daemon = 1; } else { - dbg("retry to connect %d", UDEVSEND_CONNECT_RETRY - loop); - tspec.tv_sec = 0; - tspec.tv_nsec = 100000000; /* 100 millisec */ - nanosleep(&tspec, NULL); + dbg("retry to connect %d", SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND - loop); + usleep(1000 * 1000 / SEND_WAIT_LOOP_PER_SECOND); } } -- cgit v1.2.3-54-g00ecf From f8c1ccde6aaf08c858616c9a8a83c06d609f52f5 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 20 Oct 2004 11:59:11 +0200 Subject: [PATCH] improve klibc fixup integration --- Makefile | 25 +++++---- klibc_fixups.c | 128 -------------------------------------------- klibc_fixups.h | 66 ----------------------- klibc_fixups/klibc_fixups.c | 127 +++++++++++++++++++++++++++++++++++++++++++ klibc_fixups/klibc_fixups.h | 12 +++++ klibc_fixups/pwd.h | 27 ++++++++++ namedev.c | 1 - udev_add.c | 4 -- udevd.c | 1 - 9 files changed, 180 insertions(+), 211 deletions(-) delete mode 100644 klibc_fixups.c delete mode 100644 klibc_fixups.h create mode 100644 klibc_fixups/klibc_fixups.c create mode 100644 klibc_fixups/klibc_fixups.h create mode 100644 klibc_fixups/pwd.h diff --git a/Makefile b/Makefile index 4d25aee73e..19dc72d952 100644 --- a/Makefile +++ b/Makefile @@ -137,6 +137,7 @@ endif # link udev against it statically. # Otherwise, use glibc and link dynamically. ifeq ($(strip $(USE_KLIBC)),true) + KLIBC_FIXUPS_DIR= $(PWD)/klibc_fixups KLIBC_BASE = $(PWD)/klibc KLIBC_DIR = $(KLIBC_BASE)/klibc INCLUDE_DIR := $(KLIBC_BASE)/include @@ -149,13 +150,15 @@ ifeq ($(strip $(USE_KLIBC)),true) CRT0 = $(KLIBC_DIR)/crt0.o LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) - CFLAGS += $(WARNINGS) -nostdinc \ - $(OPTFLAGS) \ - -D__KLIBC__ -fno-builtin-printf \ - -I$(INCLUDE_DIR) \ - -I$(INCLUDE_DIR)/arch/$(ARCH) \ - -I$(INCLUDE_DIR)/bits$(BITSIZE) \ - -I$(GCCINCDIR) \ + CFLAGS += $(WARNINGS) -nostdinc \ + $(OPTFLAGS) \ + -D__KLIBC__ -fno-builtin-printf \ + -I$(KLIBC_FIXUPS_DIR) \ + -include $(KLIBC_FIXUPS_DIR)/klibc_fixups.h \ + -I$(INCLUDE_DIR) \ + -I$(INCLUDE_DIR)/arch/$(ARCH) \ + -I$(INCLUDE_DIR)/bits$(BITSIZE) \ + -I$(GCCINCDIR) \ -I$(LINUX_INCLUDE_DIR) LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs @@ -226,14 +229,14 @@ HEADERS = udev.h \ udev_version.h \ udevdb.h \ udev_sysfs.h \ - klibc_fixups.h \ logging.h \ selinux.h \ - list.h + list.h \ + klibc_fixups/klibc_fixups.h ifeq ($(strip $(USE_KLIBC)),true) - OBJS += klibc_fixups.o - KLIBC_FIXUP = klibc_fixups.o + OBJS += klibc_fixups/klibc_fixups.o + KLIBC_FIXUP = klibc_fixups/klibc_fixups.o endif ifeq ($(strip $(V)),false) diff --git a/klibc_fixups.c b/klibc_fixups.c deleted file mode 100644 index e68ce22b50..0000000000 --- a/klibc_fixups.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * klibc_fixups.c - very simple implementation of stuff missing in klibc - * - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers - * - * 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 02139, USA. - * - */ - -#ifdef __KLIBC__ - -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "klibc_fixups.h" -#include "udev_lib.h" -#include "logging.h" - -#define PW_FILE "/etc/passwd" -#define GR_FILE "/etc/group" -#define UTMP_FILE "/var/run/utmp" - -/* return the id of a passwd style line, selected by the users name */ -static unsigned long get_id_by_name(const char *uname, const char *dbfile) -{ - unsigned long id = -1; - char line[LINE_SIZE]; - char *buf; - char *bufline; - size_t bufsize; - size_t cur; - size_t count; - char *pos; - char *name; - char *idstr; - char *tail; - - if (file_map(dbfile, &buf, &bufsize) == 0) { - dbg("reading '%s' as db file", dbfile); - } else { - dbg("can't open '%s' as db file", dbfile); - return -1; - } - - /* loop through the whole file */ - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - - if (count >= LINE_SIZE) - continue; - - strncpy(line, bufline, count); - line[count] = '\0'; - pos = line; - - /* get name */ - name = strsep(&pos, ":"); - if (name == NULL) - continue; - - /* skip pass */ - if (strsep(&pos, ":") == NULL) - continue; - - /* get id */ - idstr = strsep(&pos, ":"); - if (idstr == NULL) - continue; - - if (strcmp(uname, name) == 0) { - id = strtoul(idstr, &tail, 10); - if (tail[0] != '\0') - id = -1; - else - dbg("id for '%s' is '%li'", name, id); - break; - } - } - - file_unmap(buf, bufsize); - return id; -} - -struct passwd *getpwnam(const char *name) -{ - static struct passwd pw; - - memset(&pw, 0x00, sizeof(struct passwd)); - pw.pw_uid = (uid_t) get_id_by_name(name, PW_FILE); - if (pw.pw_uid < 0) - return NULL; - else - return &pw; -} - -struct group *getgrnam(const char *name) -{ - static struct group gr; - - memset(&gr, 0x00, sizeof(struct group)); - gr.gr_gid = (gid_t) get_id_by_name(name, GR_FILE); - if (gr.gr_gid < 0) - return NULL; - else - return &gr; -} - -#endif diff --git a/klibc_fixups.h b/klibc_fixups.h deleted file mode 100644 index 082105eb8e..0000000000 --- a/klibc_fixups.h +++ /dev/null @@ -1,66 +0,0 @@ -#ifdef __KLIBC__ - -#ifndef KLIBC_FIXUPS_H -#define KLIBC_FIXUPS_H - -struct passwd { - char *pw_name; /* user name */ - char *pw_passwd; /* user password */ - uid_t pw_uid; /* user id */ - gid_t pw_gid; /* group id */ - char *pw_gecos; /* real name */ - char *pw_dir; /* home directory */ - char *pw_shell; /* shell program */ -}; - -struct group { - char *gr_name; /* group name */ - char *gr_passwd; /* group password */ - gid_t gr_gid; /* group id */ - char **gr_mem; /* group members */ -}; - -struct passwd *getpwnam(const char *name); -struct group *getgrnam(const char *name); - - -#define UT_LINESIZE 32 -#define UT_NAMESIZE 32 -#define UT_HOSTSIZE 256 -#define USER_PROCESS 7 /* normal process */ -#define ut_time ut_tv.tv_sec - - -extern int ufd; - -struct exit_status { - short int e_termination; /* process termination status */ - short int e_exit; /* process exit status */ -}; - -struct utmp -{ - short int ut_type; /* type of login */ - pid_t ut_pid; /* pid of login process */ - char ut_line[UT_LINESIZE]; /* devicename */ - char ut_id[4]; /* Inittab id */ - char ut_user[UT_NAMESIZE]; /* username */ - char ut_host[UT_HOSTSIZE]; /* hostname for remote login */ - struct exit_status ut_exit; /* exit status of a process marked as DEAD_PROCESS */ - /* The ut_session and ut_tv fields must be the same size for 32 and 64-bit */ -#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 - int32_t ut_session; /* sid used for windowing */ - struct { - int32_t tv_sec; /* seconds */ - int32_t tv_usec; /* microseconds */ - } ut_tv; -#else - long int ut_session; - struct timeval ut_tv; -#endif - int32_t ut_addr_v6[4]; /* internet address of remote host */ - char __unused[20]; /* reserved for future use */ -}; - -#endif /* KLIBC_FIXUPS_H */ -#endif /* __KLIBC__ */ diff --git a/klibc_fixups/klibc_fixups.c b/klibc_fixups/klibc_fixups.c new file mode 100644 index 0000000000..2d673d8ca9 --- /dev/null +++ b/klibc_fixups/klibc_fixups.c @@ -0,0 +1,127 @@ +/* + * klibc_fixups.c - very simple implementation of stuff missing in klibc + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + +#ifdef __KLIBC__ + +#include +#include +#include +#include +#include +#include + +#include "pwd.h" +#include "../udev.h" +#include "../udev_lib.h" +#include "../logging.h" + +#define PW_FILE "/etc/passwd" +#define GR_FILE "/etc/group" + +/* return the id of a passwd style line, selected by the users name */ +static unsigned long get_id_by_name(const char *uname, const char *dbfile) +{ + unsigned long id = -1; + char line[LINE_SIZE]; + char *buf; + char *bufline; + size_t bufsize; + size_t cur; + size_t count; + char *pos; + char *name; + char *idstr; + char *tail; + + if (file_map(dbfile, &buf, &bufsize) == 0) { + dbg("reading '%s' as db file", dbfile); + } else { + dbg("can't open '%s' as db file", dbfile); + return -1; + } + + /* loop through the whole file */ + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + + if (count >= LINE_SIZE) + continue; + + strncpy(line, bufline, count); + line[count] = '\0'; + pos = line; + + /* get name */ + name = strsep(&pos, ":"); + if (name == NULL) + continue; + + /* skip pass */ + if (strsep(&pos, ":") == NULL) + continue; + + /* get id */ + idstr = strsep(&pos, ":"); + if (idstr == NULL) + continue; + + if (strcmp(uname, name) == 0) { + id = strtoul(idstr, &tail, 10); + if (tail[0] != '\0') + id = -1; + else + dbg("id for '%s' is '%li'", name, id); + break; + } + } + + file_unmap(buf, bufsize); + return id; +} + +struct passwd *getpwnam(const char *name) +{ + static struct passwd pw; + + memset(&pw, 0x00, sizeof(struct passwd)); + pw.pw_uid = (uid_t) get_id_by_name(name, PW_FILE); + if (pw.pw_uid < 0) + return NULL; + else + return &pw; +} + +struct group *getgrnam(const char *name) +{ + static struct group gr; + + memset(&gr, 0x00, sizeof(struct group)); + gr.gr_gid = (gid_t) get_id_by_name(name, GR_FILE); + if (gr.gr_gid < 0) + return NULL; + else + return &gr; +} + +#endif /* __KLIBC__ */ diff --git a/klibc_fixups/klibc_fixups.h b/klibc_fixups/klibc_fixups.h new file mode 100644 index 0000000000..8d2933b1b6 --- /dev/null +++ b/klibc_fixups/klibc_fixups.h @@ -0,0 +1,12 @@ +#ifdef __KLIBC__ + +#ifndef _KLIBC_FIXUPS_H +#define _KLIBC_FIXUPS_H + +struct exit_status { + short int e_termination; /* process termination status */ + short int e_exit; /* process exit status */ +}; + +#endif /* KLIBC_FIXUPS_H */ +#endif /* __KLIBC__ */ diff --git a/klibc_fixups/pwd.h b/klibc_fixups/pwd.h new file mode 100644 index 0000000000..f5de6c50b8 --- /dev/null +++ b/klibc_fixups/pwd.h @@ -0,0 +1,27 @@ +#ifdef __KLIBC__ + +#ifndef _PWD_H +#define _PWD_H + +struct passwd { + char *pw_name; /* user name */ + char *pw_passwd; /* user password */ + uid_t pw_uid; /* user id */ + gid_t pw_gid; /* group id */ + char *pw_gecos; /* real name */ + char *pw_dir; /* home directory */ + char *pw_shell; /* shell program */ +}; + +struct group { + char *gr_name; /* group name */ + char *gr_passwd; /* group password */ + gid_t gr_gid; /* group id */ + char **gr_mem; /* group members */ +}; + +struct passwd *getpwnam(const char *name); +struct group *getgrnam(const char *name); + +#endif /* _PWD_H */ +#endif /* __KLIBC__ */ diff --git a/namedev.c b/namedev.c index 03fc41d234..80d5f1a499 100644 --- a/namedev.c +++ b/namedev.c @@ -40,7 +40,6 @@ #include "udev_version.h" #include "logging.h" #include "namedev.h" -#include "klibc_fixups.h" #include "udevdb.h" static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr); diff --git a/udev_add.c b/udev_add.c index 0e7d575d58..689c2dceec 100644 --- a/udev_add.c +++ b/udev_add.c @@ -34,10 +34,7 @@ #include #include #include -#ifndef __KLIBC__ #include -#include -#endif #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" @@ -46,7 +43,6 @@ #include "logging.h" #include "namedev.h" #include "udevdb.h" -#include "klibc_fixups.h" #include "selinux.h" diff --git a/udevd.c b/udevd.c index c5267d6d9f..0150837143 100644 --- a/udevd.c +++ b/udevd.c @@ -33,7 +33,6 @@ #include #include #include -#include "klibc_fixups.h" #include #include -- cgit v1.2.3-54-g00ecf From 993a633ab848487b8e546f66087595e2dc5aa4af Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 20 Oct 2004 13:15:26 +0200 Subject: [PATCH] update to libsysfs 1.2.0 and add some stuff klib_fixup --- Makefile | 10 +- klibc_fixups/klibc_fixups.h | 11 ++ klibc_fixups/malloc.h | 9 ++ klibc_fixups/mntent.h | 39 +++++++ libsysfs/dlist.c | 267 +++++++++++++++++++++++++++++++++++++++++++- libsysfs/dlist.h | 12 +- libsysfs/sysfs.h | 7 +- libsysfs/sysfs/libsysfs.h | 1 + libsysfs/sysfs_bus.c | 2 +- libsysfs/sysfs_class.c | 2 +- libsysfs/sysfs_device.c | 6 +- libsysfs/sysfs_dir.c | 8 +- libsysfs/sysfs_driver.c | 2 +- libsysfs/sysfs_utils.c | 20 +--- 14 files changed, 365 insertions(+), 31 deletions(-) create mode 100644 klibc_fixups/malloc.h create mode 100644 klibc_fixups/mntent.h diff --git a/Makefile b/Makefile index 19dc72d952..d1a0bfb645 100644 --- a/Makefile +++ b/Makefile @@ -176,7 +176,8 @@ ifeq ($(strip $(USE_SELINUX)),true) LIB_OBJS += -lselinux endif -CFLAGS += -I$(PWD)/libsysfs +CFLAGS += -I$(PWD)/libsysfs/sysfs \ + -I$(PWD)/libsysfs # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf @@ -231,10 +232,13 @@ HEADERS = udev.h \ udev_sysfs.h \ logging.h \ selinux.h \ - list.h \ - klibc_fixups/klibc_fixups.h + list.h ifeq ($(strip $(USE_KLIBC)),true) + HEADERS += klibc_fixups/klibc_fixups.h \ + klibc_fixups/mntent.h \ + klibc_fixups/pwd.h + OBJS += klibc_fixups/klibc_fixups.o KLIBC_FIXUP = klibc_fixups/klibc_fixups.o endif diff --git a/klibc_fixups/klibc_fixups.h b/klibc_fixups/klibc_fixups.h index 8d2933b1b6..a39ec42e5f 100644 --- a/klibc_fixups/klibc_fixups.h +++ b/klibc_fixups/klibc_fixups.h @@ -3,6 +3,17 @@ #ifndef _KLIBC_FIXUPS_H #define _KLIBC_FIXUPS_H +#include + +#define _SC_PAGESIZE 0x66 +static inline long int sysconf(int name) +{ + if (name == _SC_PAGESIZE) + return getpagesize(); + + return -1; +} + struct exit_status { short int e_termination; /* process termination status */ short int e_exit; /* process exit status */ diff --git a/klibc_fixups/malloc.h b/klibc_fixups/malloc.h new file mode 100644 index 0000000000..439608e3c4 --- /dev/null +++ b/klibc_fixups/malloc.h @@ -0,0 +1,9 @@ +#ifdef __KLIBC__ + +#ifndef _MALLOC_H +#define _MALLOC_H + +#include + +#endif /* _MALLOC_H */ +#endif /* __KLIBC__ */ diff --git a/klibc_fixups/mntent.h b/klibc_fixups/mntent.h new file mode 100644 index 0000000000..ea79a2dd63 --- /dev/null +++ b/klibc_fixups/mntent.h @@ -0,0 +1,39 @@ +#ifdef __KLIBC__ + +#ifndef _MNTENT_H +#define _MNTENT_H + +#include + +struct mntent +{ + char *mnt_fsname; + char *mnt_dir; + char *mnt_type; + char *mnt_opts; + int mnt_freq; + int mnt_passno; +}; + +static inline FILE *setmntent (const char *file, const char *mode) +{ + return (FILE *) 1; +} + +static inline struct mntent *getmntent (FILE *stream) +{ + static struct mntent mntent = { + .mnt_dir = "/sys", + .mnt_type = "sysfs" + }; + + return &mntent; +} + +static inline int endmntent (FILE *stream) +{ + return 0; +} + +#endif /* _MNTENT_H */ +#endif /* __KLIBC__ */ diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c index b440d65bed..5f2c00be9b 100644 --- a/libsysfs/dlist.c +++ b/libsysfs/dlist.c @@ -27,7 +27,6 @@ * delete function. Otherwise dlist will just use free. */ -#include #include "dlist.h" /* @@ -207,6 +206,46 @@ void *dlist_insert(Dlist *list,void *data,int direction) return(list->marker->data); } +/* internal use only + * Insert dl_node at marker. + * If direction true it inserts after. + * If direction false it inserts before. + * move marker to inserted node + * return pointer to inserted node + */ +void *_dlist_insert_dlnode(struct dlist *list,struct dl_node *new_node,int direction) +{ + if(list==NULL || new_node==NULL) + return(NULL); + if(list->marker==NULL) //in case the marker ends up unset + list->marker=list->head; + list->count++; + if(list->head->next==NULL) + { + list->head->next=list->head->prev=new_node; + new_node->prev=list->head; + new_node->next=list->head; + } + else if(direction) + { + new_node->next=list->marker->next; + new_node->prev=list->marker; + list->marker->next->prev=new_node; + list->marker->next=new_node; + } + else + { + new_node->prev=list->marker->prev; + new_node->next=list->marker; + list->marker->prev->next=new_node; + list->marker->prev=new_node; + } + list->marker=new_node; + return(list->marker); +} + + + /* * Remove DL_node from list without deallocating data. * if marker == killme . @@ -239,6 +278,54 @@ void *_dlist_remove(Dlist *list,DL_node *killme,int direction) return (NULL); } +/* + * move dl_node from source to dest + * if marker == target . + * when direction true it moves marker after + * when direction false it moves marker before. + * to previous if there is no next. + */ +void dlist_move(struct dlist *source, struct dlist *dest, struct dl_node *target,int direction) +{ + + if(target!=NULL) + { + if(target==source->head) + { + //not even going to try + } + else + { + // take care of head and marker pointers. + if(source->marker==target) + _dlist_mark_move(source,direction); + if(target ==source->head->next) + source->head->next=target->next; + if(target==source->head->prev) + source->head->prev=target->prev; + // remove from list + if(source->count==1) + { + target->prev=NULL; + target->next=NULL; + source->head->next=NULL; + source->head->prev=NULL; + } + else + { + if(target->prev !=NULL) + target->prev->next=target->next; + if(target->next !=NULL) + target->next->prev=target->prev; + target->prev=NULL; + target->next=NULL; + } + source->count--; + _dlist_insert_dlnode(dest,target,direction); + } + } +} + /* * Insert node containing data after end. @@ -261,7 +348,7 @@ void dlist_unshift(Dlist *list,void *data) } void dlist_unshift_sorted(Dlist *list, void *data, - int (*sorter)(void *new, void *old)) + int (*sorter)(void *new_elem, void *old_elem)) { if (list->count == 0) dlist_unshift(list, data); @@ -352,3 +439,179 @@ void *dlist_insert_sorted(struct dlist *list, void *new, int (*sorter)(void *, v list->marker!=list->head && !sorter(new,list->marker->data);dlist_next(list)); return(dlist_insert_before(list,new)); } + +/* + * NOTE: internal use only + */ +int _dlist_merge(struct dlist *listsource, struct dlist *listdest, unsigned int passcount, int (*compare)(void *, void *)) +{ + + struct dl_node *l1head; + struct dl_node *l2head; + struct dl_node *target; + unsigned int l1count=0; + unsigned int l2count=0; + unsigned int mergecount=0; + while(listsource->count>0) + { + l1head=listsource->head->next; + l2head=l1head; + while((l1counthead)) + { + l2head=l2head->next; + l1count++; + } + // so now we have two lists to merge + + if(l2head==listsource->head) + {// l2count + l2count=0; + } + else + { + l2count=passcount; + } + while(l1count>0 || l2count>0) + { + mergecount++; + if((l2count>0)&&(l1count>0)) + { + // we have things to merge + int result=compare(l1head->data,l2head->data); + if(result>0) + { + // move from l2 + target=l2head; + l2head=l2head->next; + dlist_move(listsource,listdest,target,1); + l2count--; + if(l2head==listsource->head) + l2count=0; + } + else + { + // move from l1 + target=l1head; + l1head=l1head->next; + dlist_move(listsource,listdest,target,1); + l1count--; + } + } + else if(l1count>0) + { + // only have l1 to work with + while(l1count>0) + { + target=l1head; + l1head=l1head->next; + dlist_move(listsource,listdest,target,1); + l1count--; + } + } + else if(l2count>0) + { + // only have l2 to work with + while(l2count>0) + { + if(l2head==listsource->head) + { + l2count=0; + } + else + { + target=l2head; + l2head=l2head->next; + dlist_move(listsource,listdest,target,1); + l2count--; + } + } + } + else + { //nothing left and this should be unreachable + } + } + } + return(mergecount); +} + +/** + * mergesort the list based on compare + * compare function in form int sorter(void * a,void * b) + * must return >0 for a after b + * must return <0 for a before b + * else 0 + + * NOTE: mergesort changes the mark pointer + */ +void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)) +{ + + dlist_start(list); + struct dlist *listsource, *listdest, *swap; + struct dlist *templist = dlist_new(list->data_size); + unsigned int passcount = 1; + unsigned int mergecount = 1; + // do nothing if there isn't anything to sort + listsource = list; + listdest = templist; + if(listsource->count<2) + { //nothing to do + return; + } + else + { + while(mergecount>0) + { + mergecount=_dlist_merge(listsource, listdest, passcount, compare); + if(mergecount>1) + { + passcount=passcount*2; + //start new pass + swap=listsource; + listsource=listdest; + listdest=swap; + } + } + } + // now put the input list pointers right + // list pointers = newlist pointers + // including the forward and next nodes prev and back pointers + if(list->count==0) + {//copy + list->marker = listdest->marker; + list->count = listdest->count; + list->data_size = listdest->data_size; + list->del_func = listdest->del_func; + list->head->prev = listdest->head->prev; + list->head->next = listdest->head->next; + list->head->data = listdest->head->data; + list->head->next->prev=list->head; + list->head->prev->next=list->head; + templist->head->next=NULL; + templist->head->prev=NULL; + templist->count=0; + } + else + {// no need to copy + + } + + dlist_destroy(templist); +} + + + +/* internal use function + swaps elements a and b + No sense in juggling node pointers when we can just swap the data pointers +*/ + +void _dlist_swap(struct dlist *list, struct dl_node *a, struct dl_node *b) +{ + + void *swap=a->data; + a->data=b->data; + b->data=swap; + +} + diff --git a/libsysfs/dlist.h b/libsysfs/dlist.h index 7fc90e5bf5..9e3a6c96de 100644 --- a/libsysfs/dlist.h +++ b/libsysfs/dlist.h @@ -52,6 +52,7 @@ * to think about it. */ +#include typedef struct dl_node { struct dl_node *prev; struct dl_node *next; @@ -73,7 +74,7 @@ void *_dlist_mark_move(Dlist *list,int direction); void *dlist_mark(Dlist *); void dlist_start(Dlist *); void dlist_end(Dlist *); - +void dlist_move(struct dlist *source, struct dlist *dest, struct dl_node *target,int direction); void *dlist_insert(Dlist *,void *,int) ; void *dlist_insert_sorted(struct dlist *list, void *new_elem, int (*sorter)(void *, void *)); @@ -91,7 +92,15 @@ void *dlist_shift(Dlist *); void dlist_destroy(Dlist *); +int _dlist_merge(struct dlist *listsource, struct dlist *listdest, unsigned int passcount, int (*compare)(void *, void *)); + void *dlist_find_custom(struct dlist *list, void *target, int (*comp)(void *, void *)); + +void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)); + + +void _dlist_swap(struct dlist *list, struct dl_node *a, struct dl_node *b); + void dlist_transform(struct dlist *list, void (*node_operation)(void *)); @@ -100,6 +109,7 @@ void dlist_transform(struct dlist *list, void (*node_operation)(void *)); * _dlist_mark_move is for internal use only */ void *_dlist_remove(struct dlist *,struct dl_node *,int ); +void *_dlist_insert_dlnode(struct dlist *list,struct dl_node *new_node,int direction); #define dlist_prev(A) _dlist_mark_move((A),0) #define dlist_next(A) _dlist_mark_move((A),1) diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 7ac6efc678..1e58e8abb4 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -27,15 +27,18 @@ #include #include #include +#include #include #include #include #include -#include "dlist.h" + +/* external library functions */ +extern int isascii(int c); /* Debugging */ #ifdef DEBUG -#include "../logging.h" +#include "../logging.h" #define dprintf(format, arg...) dbg(format, ##arg) #else #define dprintf(format, arg...) do { } while (0) diff --git a/libsysfs/sysfs/libsysfs.h b/libsysfs/sysfs/libsysfs.h index 11cffae045..29194f61a6 100644 --- a/libsysfs/sysfs/libsysfs.h +++ b/libsysfs/sysfs/libsysfs.h @@ -25,6 +25,7 @@ #include #include +#include "dlist.h" /* * Defines to prevent buffer overruns diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c index 9ca23c85d8..d47b94ca24 100644 --- a/libsysfs/sysfs_bus.c +++ b/libsysfs/sysfs_bus.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "sysfs/libsysfs.h" +#include "libsysfs.h" #include "sysfs.h" static void sysfs_close_dev(void *dev) diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index 59ef0be48e..db59aef90f 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "sysfs/libsysfs.h" +#include "libsysfs.h" #include "sysfs.h" static void sysfs_close_cls_dev(void *dev) diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 290fd9723e..f2f8d2d611 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "sysfs/libsysfs.h" +#include "libsysfs.h" #include "sysfs.h" /** @@ -502,7 +502,7 @@ struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, * @psize: size of "path" * Returns 0 on success -1 on failure */ -static int get_device_absolute_path(const char *device, const char *bus, +static int get_device_absolute_path(const char *device, const char *bus, char *path, size_t psize) { char bus_path[SYSFS_PATH_MAX]; @@ -547,7 +547,7 @@ static int get_device_absolute_path(const char *device, const char *bus, * 2. Bus the device is on must be supplied * Use sysfs_find_device_bus to get the bus name */ -struct sysfs_device *sysfs_open_device(const char *bus, const char *bus_id) +struct sysfs_device *sysfs_open_device(const char *bus, const char *bus_id) { char sysfs_path[SYSFS_PATH_MAX]; struct sysfs_device *device = NULL; diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index 8ce8522200..52769916cc 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "sysfs/libsysfs.h" +#include "libsysfs.h" #include "sysfs.h" /** @@ -273,7 +273,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) errno = EACCES; return -1; } - pgsize = getpagesize(); + pgsize = sysconf(_SC_PAGESIZE); fbuf = (char *)calloc(1, pgsize+1); if (fbuf == NULL) { dprintf("calloc failed\n"); @@ -513,6 +513,7 @@ struct sysfs_link *sysfs_open_link(const char *linkpath) safestrcpy(ln->path, linkpath); if ((sysfs_get_name_from_path(linkpath, ln->name, SYSFS_NAME_LEN)) != 0 || (sysfs_get_link(linkpath, ln->target, SYSFS_PATH_MAX)) != 0) { + sysfs_close_link(ln); errno = EINVAL; dprintf("Invalid link path %s\n", linkpath); return NULL; @@ -884,7 +885,8 @@ struct sysfs_attribute *sysfs_get_directory_attribute attr = (struct sysfs_attribute *)dlist_find_custom (dir->attributes, attrname, dir_attribute_name_equal); if (attr != NULL) { - if ((sysfs_read_attribute(attr)) != 0) { + if ((attr->method & SYSFS_METHOD_SHOW) && + (sysfs_read_attribute(attr)) != 0) { dprintf("Error reading attribute %s\n", attr->name); return NULL; } diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index 2439b7a567..88d26b56dd 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -20,7 +20,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "sysfs/libsysfs.h" +#include "libsysfs.h" #include "sysfs.h" static void sysfs_close_driver_device(void *device) diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index f65e5df3aa..8b1f56ed14 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -20,16 +20,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include "sysfs/libsysfs.h" +#include "libsysfs.h" #include "sysfs.h" -#ifndef __KLIBC__ -#include -#endif -static int sort_char(void *new_elem, void *old_elem) +static int sort_char(void *new, void *old) { - return ((strncmp((char *)new_elem, (char *)old_elem, - strlen((char *)new_elem))) < 0 ? 1 : 0); + return ((strncmp((char *)new, (char *)old, + strlen((char *)new))) < 0 ? 1 : 0); } /** @@ -66,10 +63,6 @@ int sysfs_remove_trailing_slash(char *path) static int sysfs_get_fs_mnt_path(const char *fs_type, char *mnt_path, size_t len) { -#ifdef __KLIBC__ - safestrcpymax(mnt_path, "/sys", len); - return 0; -#else FILE *mnt; struct mntent *mntent; int ret = 0; @@ -106,7 +99,6 @@ static int sysfs_get_fs_mnt_path(const char *fs_type, ret = -1; return ret; -#endif } /* @@ -454,7 +446,7 @@ int sysfs_path_is_link(const char *path) return 1; } if ((lstat(path, &astats)) != 0) { - dprintf("stat() failed"); + dprintf("stat() failed\n"); return 1; } if (S_ISLNK(astats.st_mode)) @@ -477,7 +469,7 @@ int sysfs_path_is_file(const char *path) return 1; } if ((lstat(path, &astats)) != 0) { - dprintf("stat() failed"); + dprintf("stat() failed\n"); return 1; } if (S_ISREG(astats.st_mode)) -- cgit v1.2.3-54-g00ecf From f4949c53e66a4a8697b1bd5aa3f8265faf3423b1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 20 Oct 2004 14:13:33 +0200 Subject: [PATCH] Remove the last klibc specific line from the main udev code --- klibc_fixups/klibc_fixups.h | 1 + udev.c | 1 - udevdb.c | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/klibc_fixups/klibc_fixups.h b/klibc_fixups/klibc_fixups.h index a39ec42e5f..13011b6888 100644 --- a/klibc_fixups/klibc_fixups.h +++ b/klibc_fixups/klibc_fixups.h @@ -3,6 +3,7 @@ #ifndef _KLIBC_FIXUPS_H #define _KLIBC_FIXUPS_H +#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #define _SC_PAGESIZE 0x66 diff --git a/udev.c b/udev.c index 5064bbd175..cac60fd932 100644 --- a/udev.c +++ b/udev.c @@ -20,7 +20,6 @@ * */ -#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #include #include diff --git a/udevdb.c b/udevdb.c index 23de22751d..6a3357d0bb 100644 --- a/udevdb.c +++ b/udevdb.c @@ -21,7 +21,6 @@ * */ -#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T #include #include #include -- cgit v1.2.3-54-g00ecf From 069410dbb4769595f57d6208c4a524b2eaa2659c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 23 Oct 2004 05:44:44 -0700 Subject: [PATCH] add inotify to the rules for gentoo --- etc/udev/udev.permissions.gentoo | 1 + etc/udev/udev.rules.gentoo | 1 + 2 files changed, 2 insertions(+) diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo index edd8e39cde..51dd9f290e 100644 --- a/etc/udev/udev.permissions.gentoo +++ b/etc/udev/udev.permissions.gentoo @@ -48,6 +48,7 @@ zero:root:root:0666 # misc devices misc/nvram:root:root:0660 misc/rtc:root:root:0664 +misc/inotify:root:root:0666 # floppy devices fd[01]*:root:floppy:0660 diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index b33df81d25..ffc56ee7e4 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -62,6 +62,7 @@ KERNEL="microcode", NAME="misc/%k", SYMLINK="%k" KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" +KERNEL="inotify", NAME="misc/%k", SYMLINK="%k" # pty devices KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From 1a04bce13adb853131a5be3eecc79ceab22ced49 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 23 Oct 2004 06:44:29 -0700 Subject: [PATCH] 042 release In the grand tradition of releasing free software projects on my birthday for the past few years. And yes, I skipped version 041, call it grumpyness in my old age... --- ChangeLog | 18 ++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 73d52d46a4..907314150c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +Summary of changes from v040 to v042 +============================================ + +Greg Kroah-Hartman: + o add inotify to the rules for gentoo + +Kay Sievers: + o skip waiting for device if we get a bad event for class creation and not for a device underneath it + o add net/pan and net/bnep handling + o switch wait for bus_file to stat() instead of open() add net/tun device handling add ieee1394 device handling + o Remove the last klibc specific line from the main udev code Move _KLIBC_HAS_ARCH_SIG_ATOMIC_T to the fixup file which is automatically included by the Makefile is we build with klibc + o ignore *.rej files from failed patches + o update to libsysfs 1.2.0 and add some stuff klib_fixup Now we have only the sysfs.h file different from the upstream version to map our dbg() macro. + o improve klibc fixup integration + o cleanup udevd/udevstart + o expose sysfs functions for sharing it + + Summary of changes from v039 to v040 ============================================ diff --git a/Makefile b/Makefile index d1a0bfb645..f75721e1f3 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart WAIT = wait_for_sysfs -VERSION = 040 +VERSION = 042 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 9055512332..ac2a874cf0 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 040 +Version: 042 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 948736dde7791e19528f829703042c7c843a43ca Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 25 Oct 2004 07:53:15 -0700 Subject: [PATCH] add dumb script to show all sysfs devices in the system. --- test/show_all_devices.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 test/show_all_devices.sh diff --git a/test/show_all_devices.sh b/test/show_all_devices.sh new file mode 100644 index 0000000000..921b8e6163 --- /dev/null +++ b/test/show_all_devices.sh @@ -0,0 +1,27 @@ +#! /bin/bash +# +# Directory where sysfs is mounted +SYSFS_DIR=/sys + +# handle block devices and their partitions +for i in ${SYSFS_DIR}/block/*; do + # each drive + echo ${i#${SYSFS_DIR}/block/} + + # each partition, on each device + for j in $i/*; do + if [ -f $j/dev ]; then + echo ${j#${SYSFS_DIR}} | cut --delimiter='/' --fields=4- + fi + done +done + +# all other device classes +for i in ${SYSFS_DIR}/class/*; do + for j in $i/*; do + if [ -f $j/dev ]; then + echo ${j#${SYSFS_DIR}} | cut --delimiter='/' --fields=4- + fi + done +done + -- cgit v1.2.3-54-g00ecf From bd842ba41aba926d5842c350593127594bba5d08 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 28 Oct 2004 10:19:13 -0500 Subject: [PATCH] add test target to makefile Will help distros that have a test phase of their build. --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index f75721e1f3..c90baba582 100644 --- a/Makefile +++ b/Makefile @@ -463,3 +463,6 @@ uninstall: uninstall-man uninstall-dev.d $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ -C $$target $@ ; \ done ; \ + +test: all + @ cd test && sudo ./udev-test.pl -- cgit v1.2.3-54-g00ecf From 6628a2ea38112451218fc21aec40db6ff7de8d63 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 30 Oct 2004 13:27:36 +0200 Subject: [PATCH] Add net/vmnet and class/zaptel to the list of devices without physical device --- udev_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 7fc1099ee5..95a46a6ecd 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -168,6 +168,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "tun" }, { .subsystem = "net", .device = "pan" }, { .subsystem = "net", .device = "bnep" }, + { .subsystem = "net", .device = "vmnet" }, { .subsystem = "ppp", .device = NULL }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, @@ -181,6 +182,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "ieee1394_host", .device = NULL }, { .subsystem = "ieee1394_node", .device = NULL }, { .subsystem = "raw", .device = NULL }, + { .subsystem = "zaptel", .device = NULL }, { NULL, NULL } }; struct class_device *classdevice; -- cgit v1.2.3-54-g00ecf From 2b0f835ccc67ae3209bc89be22cedfc8341ab5e3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 30 Oct 2004 13:29:52 +0200 Subject: [PATCH] add test for format chars in multiple symlinks to replace --- test/udev-test.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index a7becf99df..2b9fa8a238 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -777,6 +777,16 @@ EOF exp_majorminor => "4094:89999", conf => < "multiple symlinks with format char", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "symlink2-ttyUSB0", + exp_target => "ttyUSB0", + conf => < Date: Sat, 30 Oct 2004 13:33:06 +0200 Subject: [PATCH] Apply the default permissions even if we found a entry in --- namedev.c | 7 +++---- test/udev-test.pl | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/namedev.c b/namedev.c index 80d5f1a499..b142dda4fe 100644 --- a/namedev.c +++ b/namedev.c @@ -798,11 +798,10 @@ perms: set_empty_perms(udev, perm->mode, perm->owner, perm->group); - } else { - set_empty_perms(udev, get_default_mode(), - get_default_owner(), - get_default_group()); } + set_empty_perms(udev, get_default_mode(), + get_default_owner(), + get_default_group()); dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", udev->name, udev->owner, udev->group, udev->mode); diff --git a/test/udev-test.pl b/test/udev-test.pl index 2b9fa8a238..e615a1eda8 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -550,11 +550,11 @@ KERNEL="tty2", NAME="tty2" EOF }, { - desc => "permissions tty3:::", + desc => "permissions tty3::: (default mode applied)", subsys => "tty", devpath => "/class/tty/tty3", exp_name => "tty3", - exp_perms => "0:0:0", + exp_perms => "0:0:600", conf => < Date: Sat, 30 Oct 2004 13:37:48 +0200 Subject: [PATCH] Patches from Harald Hoyer . --- extras/volume_id/Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index c419e8860f..8605811cf5 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -33,13 +33,13 @@ override CFLAGS+=-Wall -fno-builtin -Wchar-subscripts \ override CFLAGS+=-D_FILE_OFFSET_BITS=64 -SYSFS = ../../libsysfs/sysfs_bus.o \ - ../../libsysfs/sysfs_class.o \ - ../../libsysfs/sysfs_device.o \ - ../../libsysfs/sysfs_dir.o \ - ../../libsysfs/sysfs_driver.o \ - ../../libsysfs/sysfs_utils.o \ - ../../libsysfs/dlist.o +override SYSFS = ../../libsysfs/sysfs_bus.o \ + ../../libsysfs/sysfs_class.o \ + ../../libsysfs/sysfs_device.o \ + ../../libsysfs/sysfs_dir.o \ + ../../libsysfs/sysfs_driver.o \ + ../../libsysfs/sysfs_utils.o \ + ../../libsysfs/dlist.o @@ -60,8 +60,8 @@ clean: spotless: clean install: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(usrsbindir)/$(PROG) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) uninstall: - - rm $(DESTDIR)$(usrsbindir)/$(PROG) + - rm $(DESTDIR)$(sbindir)/$(PROG) -- cgit v1.2.3-54-g00ecf From e5e2ea95a4b21ebc5297881e7e8c5ab4425bac5e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 30 Oct 2004 13:44:46 +0200 Subject: [PATCH] Exit, if udevtest cannot open the device (segfault). --- udevtest.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/udevtest.c b/udevtest.c index f2b0c98edb..8af2120fb1 100644 --- a/udevtest.c +++ b/udevtest.c @@ -108,10 +108,12 @@ int main(int argc, char *argv[], char *envp[]) /* open the device */ snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) - dbg ("sysfs_open_class_device_path failed"); - else - dbg("opened class_dev->name='%s'", class_dev->name); + if (class_dev == NULL) { + info("sysfs_open_class_device_path failed"); + return 1; + } + + dbg("opened class_dev->name='%s'", class_dev->name); /* simulate node creation with test flag */ udev.test_run = 1; -- cgit v1.2.3-54-g00ecf From 56b979e00d87d1766b61716f07870701aca20ead Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Nov 2004 10:20:31 +0100 Subject: [PATCH] Add a bunch of devices without "device" symlinks. --- udev_sysfs.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 95a46a6ecd..886e9f403b 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -174,6 +174,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "printer", .device = "lp" }, { .subsystem = "nvidia", .device = NULL }, { .subsystem = "video4linux", .device = "vbi" }, + { .subsystem = "dvb", .device = NULL }, { .subsystem = "lirc", .device = NULL }, { .subsystem = "firmware", .device = NULL }, { .subsystem = "drm", .device = NULL }, @@ -183,6 +184,21 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "ieee1394_node", .device = NULL }, { .subsystem = "raw", .device = NULL }, { .subsystem = "zaptel", .device = NULL }, + { .subsystem = "tiglusb", .device = NULL }, + { .subsystem = "ppdev", .device = NULL }, + { .subsystem = "ticables", .device = NULL }, + { .subsystem = "snsc", .device = NULL }, + { .subsystem = "staliomem", .device = NULL }, + { .subsystem = "tape", .device = NULL }, + { .subsystem = "ip2", .device = NULL }, + { .subsystem = "tpqic02", .device = NULL }, + { .subsystem = "dsp56k", .device = NULL }, + { .subsystem = "zft", .device = NULL }, + { .subsystem = "adb", .device = NULL }, + { .subsystem = "cosa", .device = NULL }, + { .subsystem = "pg", .device = NULL }, + { .subsystem = "pt", .device = NULL }, + { .subsystem = "capi", .device = NULL }, { NULL, NULL } }; struct class_device *classdevice; -- cgit v1.2.3-54-g00ecf From a5d00f9d3725c701d5a2d7a14dfcc7864aac27fb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 2 Nov 2004 10:22:11 +0100 Subject: [PATCH] Add support for highpoint ataraid to volume_id to suppress --- extras/volume_id/volume_id.c | 42 +++++++++++++++++++++++++++++++++++++++--- extras/volume_id/volume_id.h | 7 ++++--- 2 files changed, 43 insertions(+), 6 deletions(-) diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index 0b43bc8efb..42d658895f 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -263,6 +263,36 @@ static void free_buffer(struct volume_id *id) } } +#define HPT37X_CONFIG_OFF 0x1200 +#define HPT37X_MAGIC_OK 0x5a7816f0 +#define HPT37X_MAGIC_BAD 0x5a7816fd +static int probe_highpoint_ataraid(struct volume_id *id, __u64 off) +{ + struct hpt37x { + __u8 filler1[32]; + __u32 magic; + __u32 magic_0; + __u32 magic_1; + } __attribute__((packed)) *hpt; + + const __u8 *buf; + + buf = get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); + if (buf == NULL) + return -1; + + hpt = (struct hpt37x *) buf; + + if (hpt->magic != HPT37X_MAGIC_OK && hpt->magic != HPT37X_MAGIC_BAD) + return -1; + + id->usage_id = VOLUME_ID_RAID; + id->type_id = VOLUME_ID_HPTRAID; + id->type = "hpt_ataraid_member"; + + return 0; +} + #define LVM1_SB_OFF 0x400 #define LVM1_MAGIC "HM" static int probe_lvm1(struct volume_id *id, __u64 off) @@ -2038,6 +2068,9 @@ int volume_id_probe(struct volume_id *id, case VOLUME_ID_LVM2: rc = probe_lvm2(id, off); break; + case VOLUME_ID_HPTRAID: + rc = probe_highpoint_ataraid(id, off); + break; case VOLUME_ID_ALL: default: /* probe for raid first, cause fs probes may be successful on raid members */ @@ -2048,14 +2081,14 @@ int volume_id_probe(struct volume_id *id, if (rc == 0) break; rc = probe_lvm2(id, off); + if (rc == 0) + break; + rc = probe_highpoint_ataraid(id, off); if (rc == 0) break; /* signature in the first block, only small buffer needed */ rc = probe_msdos_part_table(id, off); - if (rc == 0) - break; - rc = probe_ntfs(id, off); if (rc == 0) break; rc = probe_vfat(id, off); @@ -2093,6 +2126,9 @@ int volume_id_probe(struct volume_id *id, if (rc == 0) break; rc = probe_ufs(id, off); + if (rc == 0) + break; + rc = probe_ntfs(id, off); if (rc == 0) break; diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h index c6f52bec41..d135f44e50 100644 --- a/extras/volume_id/volume_id.h +++ b/extras/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 25 +#define VOLUME_ID_VERSION 26 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 @@ -36,7 +36,7 @@ enum volume_id_usage { VOLUME_ID_OTHER, VOLUME_ID_FILESYSTEM, VOLUME_ID_PARTITIONTABLE, - VOLUME_ID_RAID + VOLUME_ID_RAID, }; enum volume_id_type { @@ -59,7 +59,8 @@ enum volume_id_type { VOLUME_ID_UFS, VOLUME_ID_LINUX_RAID, VOLUME_ID_LVM1, - VOLUME_ID_LVM2 + VOLUME_ID_LVM2, + VOLUME_ID_HPTRAID, }; struct volume_id_partition { -- cgit v1.2.3-54-g00ecf From 5a73b25fd6673134328443af04afe7bde0060d72 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 5 Nov 2004 13:16:32 +0100 Subject: [PATCH] Don't use any syslog() in signal handler, cause it may deadlock. --- udev.c | 5 +---- udev.h | 2 +- udevd.c | 9 ++------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/udev.c b/udev.c index cac60fd932..7809060520 100644 --- a/udev.c +++ b/udev.c @@ -65,14 +65,10 @@ static void asmlinkage sig_handler(int signum) switch (signum) { case SIGALRM: gotalarm = 1; - info("error: timeout reached, event probably not handled correctly"); break; case SIGINT: case SIGTERM: - udevdb_exit(); exit(20 + signum); - default: - dbg("unhandled signal %d", signum); } } @@ -148,6 +144,7 @@ int main(int argc, char *argv[], char *envp[]) /* set signal handlers */ act.sa_handler = (void (*) (int))sig_handler; sigemptyset (&act.sa_mask); + act.sa_flags = 0; /* alarm must not restart syscalls*/ sigaction(SIGALRM, &act, NULL); sigaction(SIGINT, &act, NULL); diff --git a/udev.h b/udev.h index f7a13a634b..e8954338d9 100644 --- a/udev.h +++ b/udev.h @@ -26,7 +26,7 @@ #include #include "libsysfs/sysfs/libsysfs.h" -#define ALARM_TIMEOUT 30 +#define ALARM_TIMEOUT 120 #define COMMENT_CHARACTER '#' #define NAME_SIZE 256 diff --git a/udevd.c b/udevd.c index 0150837143..395cdca88b 100644 --- a/udevd.c +++ b/udevd.c @@ -327,20 +327,15 @@ static void asmlinkage sig_handler(int signum) sigchilds_waiting = 1; goto do_write; break; - default: - dbg("unhandled signal %d", signum); - return; } - + do_write: /* if pipe is empty, write to pipe to force select to return * immediately when it gets called */ if (!sig_flag) { rc = write(pipefds[1],&signum,sizeof(signum)); - if (rc < 0) - dbg("unable to write to pipe"); - else + if (rc >= 0) sig_flag = 1; } } -- cgit v1.2.3-54-g00ecf From e920fed3499aa1445657b62499a11348faa3b24e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 5 Nov 2004 13:16:56 +0100 Subject: [PATCH] wait() for specific pid to return from fork(). --- dev_d.c | 2 +- namedev.c | 2 +- udevsend.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dev_d.c b/dev_d.c index be85f52775..64c2544248 100644 --- a/dev_d.c +++ b/dev_d.c @@ -68,7 +68,7 @@ static int run_program(char *name) break; return -1; default: - wait(NULL); + waitpid(pid, NULL, 0); } return 0; diff --git a/namedev.c b/namedev.c index b142dda4fe..f3fb3ff7ed 100644 --- a/namedev.c +++ b/namedev.c @@ -444,7 +444,7 @@ static int execute_program(const char *path, char *value, int len) dbg("result is '%s'", value); close(fds[0]); - wait(&status); + waitpid(pid, &status, 0); if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { dbg("exec program status 0x%x", status); diff --git a/udevsend.c b/udevsend.c index 84c46bc0c2..b564d6453f 100644 --- a/udevsend.c +++ b/udevsend.c @@ -82,7 +82,7 @@ static int start_daemon(void) dbg("fork of helper failed"); return -1; default: - wait(NULL); + waitpid(pid, NULL, 0); } return 0; } @@ -103,7 +103,7 @@ static void run_udev(const char *subsystem) dbg("fork of child failed"); break; default: - wait(NULL); + waitpid(pid, NULL, 0); } } -- cgit v1.2.3-54-g00ecf From 52a6ef66f2e98491b40b176619035abca3777a2c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 5 Nov 2004 13:17:30 +0100 Subject: [PATCH] Shut up wait_for_sysfs class/net failure messages, as it's not possible --- wait_for_sysfs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 91a2b6b628..3b1b0cd248 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -116,6 +116,15 @@ int main(int argc, char *argv[], char *envp[]) /* wait for the class device with possible physical device and bus */ wait_for_class_device(class_dev, &error); + /* + * we got too many unfixable class/net errors, kernel later than 2.6.10-rc1 will + * solve this by exporting the needed information with the hotplug event + * until we use this just don't print any error for net devices, but still + * wait for it. + */ + if (strncmp(devpath, "/class/net/", 11) == 0) + error = NULL; + sysfs_close_class_device(class_dev); } else if ((strncmp(devpath, "/devices/", 9) == 0)) { -- cgit v1.2.3-54-g00ecf From 800ab95bd55c9beebd14fd23ef34ea7f3e055e6a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Nov 2004 18:11:00 -0800 Subject: [PATCH] make udev-test.pl test for root permissions before running Should prevent false error reports from happening. --- test/udev-test.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index e615a1eda8..e8ce0b44dd 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1275,6 +1275,13 @@ sub run_test { } +# only run if we have root permissions +# due to mknod restrictions +if (!($<==0)) { + print "Must have root permissions to run properly.\n"; + exit; +} + # prepare system("rm -rf $udev_root"); mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; -- cgit v1.2.3-54-g00ecf From e9f653894e04621d217ca5143a92c803d9995dc5 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Nov 2004 18:11:40 -0800 Subject: [PATCH] remove 'sudo' usage from the Makefile should fix a lot of gentoo bug reports --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c90baba582..b62cd89702 100644 --- a/Makefile +++ b/Makefile @@ -465,4 +465,4 @@ uninstall: uninstall-man uninstall-dev.d done ; \ test: all - @ cd test && sudo ./udev-test.pl + @ cd test && ./udev-test.pl -- cgit v1.2.3-54-g00ecf From 3874126807efcc61eded424aace7e40c79a025a7 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Nov 2004 18:13:11 -0800 Subject: [PATCH] fix gentoo legacy tty rule I thought I had fixed this a long time ago... --- etc/udev/udev.rules.gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index ffc56ee7e4..08bc9f99d1 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -66,7 +66,7 @@ KERNEL="inotify", NAME="misc/%k", SYMLINK="%k" # pty devices KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" # ramdisk devices KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From 97a0e3c06e8a92af3cdf1110fe15cb693be0886a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Nov 2004 18:46:01 -0800 Subject: [PATCH] add cdsymlinks.sh support to gentoo rules file. --- etc/udev/udev.rules.gentoo | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 08bc9f99d1..2e2f89f26a 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -12,6 +12,11 @@ # ########################################################### +# cdrom symlinks and other good cdrom naming +BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS="scsi", KERNEL="sr[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" + # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" -- cgit v1.2.3-54-g00ecf From a258d159f4d0e1167d038b879164155e4bb8cad2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 10 Nov 2004 19:04:38 -0800 Subject: [PATCH] add i2c-dev to the list of devices without a bus --- udev_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 886e9f403b..a11c430df0 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -235,6 +235,7 @@ static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) static char *devices_without_bus[] = { "scsi_host", "i2c-adapter", + "i2c-dev", NULL }; char **device; -- cgit v1.2.3-54-g00ecf From c072fd0112b3cb93dd65537f59db74692f69664c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 10 Nov 2004 19:05:20 -0800 Subject: [PATCH] reduce syslog noise of udevsend if multiple instances try to start udevd --- udevsend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevsend.c b/udevsend.c index b564d6453f..c0c72b9c19 100644 --- a/udevsend.c +++ b/udevsend.c @@ -190,13 +190,13 @@ int main(int argc, char* argv[]) } if (!started_daemon) { - info("starting udevd daemon"); + dbg("try to start udevd daemon"); retval = start_daemon(); if (retval) { info("error starting daemon"); goto fallback; } - dbg("daemon started"); + info("udevd daemon started"); started_daemon = 1; } else { dbg("retry to connect %d", SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND - loop); -- cgit v1.2.3-54-g00ecf From 5ca6ff64574430d9394bb6417a38295902116bab Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 5 Nov 2004 06:52:53 -0800 Subject: [PATCH] 043 release --- ChangeLog | 24 ++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 907314150c..85a5f07d0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +Summary of changes from v042 to v043 +============================================ + +Greg Kroah-Hartman: + o add test target to makefile + o add dumb script to show all sysfs devices in the system + +Kay Sievers: + o Shut up wait_for_sysfs class/net failure messages, as it's not possible to + get that right for all net devices. Kernels later than 2.6.10-rc1 will + handle that by carrying the neccessary information in the hotplug event. + o wait() for specific pid to return from fork() + o Don't use any syslog() in signal handler, cause it may deadlock + o Add support for highpoint ataraid to volume_id to suppress label reading on raid set members. + o Add a bunch of devices without "device" symlinks + o Exit, if udevtest cannot open the device (segfault) + o Patches from Harald Hoyer + o Apply the default permissions even if we found a entry in the permissions + file. Correct one test, as the default is applied correctly now and the + mode will no longer be 0000. + o add test for format chars in multiple symlinks to replace + o Add net/vmnet and class/zaptel to the list of devices without physical device + + Summary of changes from v040 to v042 ============================================ diff --git a/Makefile b/Makefile index b62cd89702..0f95aaed9a 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart WAIT = wait_for_sysfs -VERSION = 042 +VERSION = 043 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index ac2a874cf0..310883e03f 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 042 +Version: 043 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 0bac7bab72648fe9f2667287b38d371929341b4f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 10 Nov 2004 19:38:07 -0800 Subject: [PATCH] 044 release --- ChangeLog | 14 ++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85a5f07d0f..29abba679d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Summary of changes from v043 to v044 +============================================ + +Greg Kroah-Hartman: + o add cdsymlinks.sh support to gentoo rules file + o fix gentoo legacy tty rule + o remove 'sudo' usage from the Makefile + o make udev-test.pl test for root permissions before running + +Kay Sievers: + o reduce syslog noise of udevsend if multiple instances try to start udevd + o add i2c-dev to the list of devices without a bus + + Summary of changes from v042 to v043 ============================================ diff --git a/Makefile b/Makefile index 0f95aaed9a..a3aa2ecb8b 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart WAIT = wait_for_sysfs -VERSION = 043 +VERSION = 044 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 310883e03f..bbaf076733 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 043 +Version: 044 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 9dfe20eff709a251da92c473ea94615887497e0a Mon Sep 17 00:00:00 2001 From: "azarah@nosferatu.za.org" Date: Wed, 17 Nov 2004 19:10:07 -0800 Subject: [PATCH] Some updates for Gentoo's udev rules Hi, Here is a few updates for the udev.rules.gentoo from udev package. I will summarise it briefly: 1) The last change you did to legacy tty's is wrong. I say this because: 1a) The original devfs rules had both master and slave in /dev/pty: nosferatu linux # grep devfs_name drivers/char/pty.c pty_driver->devfs_name = "pty/m"; pty_slave_driver->devfs_name = "pty/s"; nosferatu linux # 1b) If you refer to '2.6.8.1-mm1 Tty problems?', you will see that the /dev/tty/ directory our rules create, replaces this symlink: nosferatu portage # ls -l /dev/tty crw-rw-rw- 1 root tty 5, 0 Nov 14 17:06 /dev/tty nosferatu portage # which is used to determine the controlling tty. 2) Somebody added the /dev/cpu/microcode rule, but it was not run as there was an older rule before that placing it in /dev/misc (which is wrong). Just remove the first broken rule 3) Some form/tab cleanups. Reorder rules alphabetically according to device class to make searching/editing easier. --- etc/udev/udev.rules.gentoo | 148 ++++++++++++++++++++++----------------------- 1 file changed, 74 insertions(+), 74 deletions(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 2e2f89f26a..1809232ed0 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -21,32 +21,41 @@ BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYM # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" -# DRI devices -KERNEL="card*", NAME="dri/card%n" +# dri devices +KERNEL="card*", NAME="dri/card%n" # alsa devices KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midiC[D0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midiC[D0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + +# capi devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi*", NAME="capi/%n" + +# cpu devices +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL="microcode", NAME="cpu/microcode" # dm devices (ignore them) -KERNEL="dm-[0-9]*", NAME="" +KERNEL="dm-[0-9]*", NAME="" # create a symlink named after the device map name # note devmap_name comes with extras/multipath -#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" -KERNEL="device-mapper", NAME="mapper/control" +#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" +KERNEL="device-mapper", NAME="mapper/control" # fb devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" # floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" +KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" # i2c devices -KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" +KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" # input devices KERNEL="mice", NAME="input/%k" @@ -56,61 +65,17 @@ KERNEL="js*", NAME="input/%k" KERNEL="ts*", NAME="input/%k" # loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" # md block devices -KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" +KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" # misc devices -KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -KERNEL="microcode", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" -KERNEL="inotify", NAME="misc/%k", SYMLINK="%k" - -# pty devices -KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" - -# ramdisk devices -KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" - -# sound devices -KERNEL="adsp", NAME="sound/%k", SYMLINK="%k" -KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="audio", NAME="sound/%k", SYMLINK="%k" -KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="dsp", NAME="sound/%k", SYMLINK="%k" -KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="mixer", NAME="sound/%k", SYMLINK="%k" -KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k" -KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k" - -# tty devices -KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" -KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" - -# vc devices -KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" -KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" -KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" - -# v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n" -KERNEL="radio[0-9]*", NAME="v4l/radio%n" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" - -# USB devices -KERNEL="hiddev*", NAME="usb/%k" -KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k" -KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" +KERNEL="inotify", NAME="misc/%k", SYMLINK="%k" # netlink devices KERNEL="route", NAME="netlink/%k" @@ -126,17 +91,52 @@ KERNEL="ip6_fw", NAME="netlink/%k" KERNEL="dnrtmsg", NAME="netlink/%k" KERNEL="tap*", NAME="netlink/%k" -# CAPI devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi*", NAME="capi/%n" - -# Network devices +# network devices KERNEL="tun", NAME="net/%k" +# pty devices +KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k" + +# ramdisk devices +KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" + # raw devices -KERNEL="raw[0-9]*", NAME="raw/%k" +KERNEL="raw[0-9]*", NAME="raw/%k" + +# sound devices +KERNEL="adsp", NAME="sound/%k", SYMLINK="%k" +KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="audio", NAME="sound/%k", SYMLINK="%k" +KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="dsp", NAME="sound/%k", SYMLINK="%k" +KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="mixer", NAME="sound/%k", SYMLINK="%k" +KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k" +KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k" + +# tty devices +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" + +# usb devices +KERNEL="hiddev*", NAME="usb/%k" +KERNEL="auer*", NAME="usb/%k" +KERNEL="legousbtower*", NAME="usb/%k" +KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" + +# vc devices +KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" +KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" +KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" + +# v4l devices +KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n" +KERNEL="radio[0-9]*", NAME="v4l/radio%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" -# cpu devices -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL="microcode", NAME="cpu/microcode" -- cgit v1.2.3-54-g00ecf From 482b0ecd8fcc2651c003c6f1ae9a2d3301ecf34a Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 17 Nov 2004 19:28:03 -0800 Subject: [PATCH] 045 release --- ChangeLog | 7 +++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 29abba679d..5088273e62 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Summary of changes from v044 to v045 +============================================ + +Martin Schlemmer: + o Some updates for Gentoo's udev rules + + Summary of changes from v043 to v044 ============================================ diff --git a/Makefile b/Makefile index a3aa2ecb8b..676302819d 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart WAIT = wait_for_sysfs -VERSION = 044 +VERSION = 045 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index bbaf076733..edb033e864 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 044 +Version: 045 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 2b41e68a08548ce44b4d145900dab2bb04cd34f7 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 6 Nov 2004 14:28:01 +0100 Subject: [PATCH] replace tdb database by simple lockless file database This makes the udev operation completely lockless by storing a file for every node in /dev/.udevdb/* This solved the problem with deadlocking concurrent udev processes waiting for each other to release the file lock under heavy load. --- HOWTO-udev_for_dev | 4 +- Makefile | 29 +- dev_d.c | 1 - docs/persistent_naming/testing_scsi_notes.txt | 20 +- etc/init.d/udev | 4 +- etc/udev/udev.conf.in | 8 +- namedev.c | 40 +- tdb/Makefile | 32 - tdb/README | 167 -- tdb/spinlock.c | 433 ----- tdb/spinlock.h | 55 - tdb/tdb.c | 2099 ------------------------- tdb/tdb.h | 150 -- tdb/tdb.magic | 10 - tdb/tdbback.c | 201 --- tdb/tdbback.h | 23 - tdb/tdbbackup.c | 137 -- tdb/tdbdump.c | 89 -- tdb/tdbutil.c | 830 ---------- tdb/tdbutil.h | 37 - test/devd_test | 2 +- test/ignore_test | 2 +- test/label_test | 2 +- test/modifier_test | 2 +- test/net_test | 2 +- test/replace_test | 2 +- test/topo_test | 2 +- test/udev-test.pl | 6 +- udev.8.in | 4 +- udev.c | 11 +- udev.h | 13 +- udev_add.c | 48 +- udev_config.c | 19 +- udev_lib.c | 45 +- udev_lib.h | 4 +- udev_remove.c | 33 +- udevdb.c | 290 ++-- udevdb.h | 38 +- udevinfo.8 | 5 +- udevinfo.c | 98 +- udevsend.c | 2 +- 41 files changed, 318 insertions(+), 4681 deletions(-) delete mode 100644 tdb/Makefile delete mode 100644 tdb/README delete mode 100644 tdb/spinlock.c delete mode 100644 tdb/spinlock.h delete mode 100644 tdb/tdb.c delete mode 100644 tdb/tdb.h delete mode 100644 tdb/tdb.magic delete mode 100644 tdb/tdbback.c delete mode 100644 tdb/tdbback.h delete mode 100644 tdb/tdbbackup.c delete mode 100644 tdb/tdbdump.c delete mode 100644 tdb/tdbutil.c delete mode 100644 tdb/tdbutil.h diff --git a/HOWTO-udev_for_dev b/HOWTO-udev_for_dev index 58bf2d4e8c..9833dd1411 100644 --- a/HOWTO-udev_for_dev +++ b/HOWTO-udev_for_dev @@ -39,10 +39,10 @@ NOTE NOTE NOTE NOTE NOTE NOTE NOTE the end of this file. - make sure the /etc/udev/udev.conf file lists the udev_root as "/dev/" - and the udev_db as "/dev/.udev.tdb". It should contain the + and the udev_db as "/dev/.udevdb". It should contain the following lines in order to work properly. udev_root="/dev/" - udev_db="/dev/.udev.tdb" + udev_db="/dev/.udevdb" - reboot into a 2.6 kernel and watch udev create all of the initial device nodes in /dev diff --git a/Makefile b/Makefile index 676302819d..ef66213dd8 100644 --- a/Makefile +++ b/Makefile @@ -68,7 +68,8 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM} EXTRAS= # place to put our device nodes -udevdir = ${prefix}/udev +udevdir = ${prefix}/udev +udevdb = ${udevdir}/.udevdb # Comment out this line to build with something other # than the local version of klibc @@ -113,11 +114,6 @@ WARNINGS := -Wall CFLAGS := -pipe -# set up the proper tdb spinlock code if we can -ifeq ($(strip $(ARCH)),i386) - CFLAGS += -DUSE_SPINLOCKS -DINTEL_SPINLOCKS -endif - ifeq ($(strip $(USE_LOG)),true) CFLAGS += -DLOG endif @@ -201,9 +197,6 @@ $(CRT0): fi $(MAKE) -C klibc SUBDIRS=klibc -TDB = tdb/tdb.o \ - tdb/spinlock.o - SYSFS = $(PWD)/libsysfs/sysfs_bus.o \ $(PWD)/libsysfs/sysfs_class.o \ $(PWD)/libsysfs/sysfs_device.o \ @@ -221,8 +214,7 @@ OBJS = udev_lib.o \ namedev.o \ namedev_parse.o \ dev_d.o \ - $(SYSFS) \ - $(TDB) + $(SYSFS) HEADERS = udev.h \ udev_lib.h \ @@ -262,8 +254,8 @@ ccdv: udev_version.h: @echo "Creating udev_version.h" @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ - @echo \#define UDEV_ROOT \"$(udevdir)/\" >> $@ - @echo \#define UDEV_DB \"$(udevdir)/.udev.tdb\" >> $@ + @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ + @echo \#define UDEV_DB \"$(udevdb)\" >> $@ @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ @@ -300,7 +292,7 @@ $(TESTER): $(LIBC) $(TESTER).o $(OBJS) $(HEADERS) $(QUIET) $(STRIPCMD) $@ $(INFO): $(LIBC) $(INFO).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(TDB) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(DAEMON): $(LIBC) $(DAEMON).o $(OBJS) udevd.h @@ -337,7 +329,7 @@ spotless: clean $(MAKE) -C klibc spotless -rm -f klibc/linux -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz$" -e "\/\." -e releases -e BitKeeper -e SCCS -e "\.tdb$" -e test/sys | sort ) +DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz" -e "\/\." -e releases -e BitKeeper -e SCCS -e test/sys | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . release: clean @@ -429,8 +421,8 @@ install: install-initscript install-config install-man install-dev.d all - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/10-udev.hotplug - ln -f -s $(sbindir)/$(WAIT) $(DESTDIR)$(hotplugdir)/05-wait_for_sysfs.hotplug ifndef DESTDIR - - killall udevd - - rm -f $(udevdir)/.udev.tdb + - killall $(DAEMON) + - rm -rf $(udevdb) endif @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ @@ -456,8 +448,9 @@ uninstall: uninstall-man uninstall-dev.d - rm $(usrbindir)/$(TESTER) - rm $(usrbindir)/$(WAIT) - rmdir $(hotplugdir) - - rm $(udevdir)/.udev.tdb + - rm -rf $(udevdb) - rmdir $(udevdir) + - killall $(DAEMON) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ diff --git a/dev_d.c b/dev_d.c index 64c2544248..6e35f55ca2 100644 --- a/dev_d.c +++ b/dev_d.c @@ -47,7 +47,6 @@ static int run_program(char *name) switch (pid) { case 0: /* child */ - udevdb_exit(); /* close udevdb */ fd = open("/dev/null", O_RDWR); if ( fd >= 0) { dup2(fd, STDOUT_FILENO); diff --git a/docs/persistent_naming/testing_scsi_notes.txt b/docs/persistent_naming/testing_scsi_notes.txt index 8d94c842b4..728b40b0fe 100644 --- a/docs/persistent_naming/testing_scsi_notes.txt +++ b/docs/persistent_naming/testing_scsi_notes.txt @@ -110,10 +110,8 @@ uses: (1) /sys maintained by sysfs (2) /etc/udev/udev.rules - where you can store the identifier to NAME mapping information. -(3) The tdb (udev-021/tdb/tdb.c), trivial data base, that is held in - memory and holds the valid system configuration. It is not saved - between one boot to the next. It is constructed at boot time and - updated with configuration changes. +(3) The udevdb, that keeps track the valid system configuration. + It is constructed at boot time and updated with configuration changes. The persistent names are kept (at least this is one way to do it) in udev.rules (uuid and NAME), one entry per device. If you want to initially @@ -148,9 +146,9 @@ the device. The result of the program execution (the uuid) is compared with the RESULT entry in the same udev.rules line. - If it matches, then the NAME entered on this line is used. The uuid and - major/minor number is saved in tdb (newly recreated upon boot). That - device is created in /udev (the target directory name is configurable) - with the assigned NAME. + major/minor number is saved in the udevdb (newly recreated upon boot). + That device is created in /udev (the target directory name is configurable) + with the assigned NAME. - If it doesn't match, the RESULT (uuid) is preserved for use on the next udev.rules line as long as the bus type (scsi) is the same. So the @@ -159,18 +157,18 @@ with the RESULT entry in the same udev.rules line. - If no match occurs, the device will be assigned a default name. -- Tdb is updated with the resulting name assignment. +- The udevdb is updated with the resulting name assignment. Thus if the uuid and names are enumerated, they will be found, assigned, and are therefore permanent. If the device is removed from a live system, a hotplug event occurs, and it -is removed from tdb and the /udev entry disappears. +is removed from udevdb and the /udev entry disappears. If it is re-inserted at a new location, the udev.rules file is scanned as -above. The new major/minor number goes in tdb with the uuid , the name in -udev.rules is found again, and the /udev name re-appears. +above. The rule matches again against the uuid, the name in udev.rules +is applied again and the /udev name re-appears. diff --git a/etc/init.d/udev b/etc/init.d/udev index 7e6305a45b..8726090d44 100644 --- a/etc/init.d/udev +++ b/etc/init.d/udev @@ -79,8 +79,8 @@ case "$1" in fi # remove the database if it is there as we always want to start fresh - if [ -f $udev_root/.udev.tdb ]; then - rm -f $udev_root/.udev.tdb + if [ -f $udev_root/.udevdb ]; then + rm -rf $udev_root/.udevdb fi # propogate /udev from /sys - we only need this while we do not diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index 4c71b1dfec..bbbb1a93a2 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -6,16 +6,16 @@ # udev_root - where in the filesystem to place the device nodes -udev_root="@udevdir@/" +udev_root="@udevdir@" # udev_db - The name and location of the udev database. -udev_db="@udevdir@/.udev.tdb" +udev_db="@udevdir@/.udevdb" # udev_rules - The name and location of the udev rules file -udev_rules="@configdir@/rules.d/" +udev_rules="@configdir@/rules.d" # udev_permissions - The name and location of the udev permission file -udev_permissions="@configdir@/permissions.d/" +udev_permissions="@configdir@/permissions.d" # default_mode - set the default mode for all nodes that have no # explicit match in the permissions file diff --git a/namedev.c b/namedev.c index f3fb3ff7ed..d63e36e18a 100644 --- a/namedev.c +++ b/namedev.c @@ -184,29 +184,29 @@ static int get_format_len(char **str) * @param name Name to check for * @return 0 if didn't exist and N otherwise. */ -static unsigned int find_free_number (struct udevice *udev, char *name) +static int find_free_number(struct udevice *udev, const char *name) { - char temp[NAME_SIZE]; - char path[NAME_SIZE]; - struct udevice dev; - int result; + char filename[NAME_SIZE]; + int num = 0; + struct udevice db_udev; - /* have to sweep the database for each lookup */ - result = 0; - strncpy(temp, name, sizeof (temp)); + strfieldcpy(filename, name); while (1) { - if (udevdb_get_dev_byname(temp, path, &dev) != 0) - goto found; - /* symlink might be stale if $(udevroot) isn't cleaned; check - * on major/minor to see if it's the same device - */ - if (dev.major == udev->major && dev.minor == udev->minor) - goto found; - snprintf (temp, sizeof(temp), "%s%d", name, ++result); - } + dbg("look for existing node '%s'", filename); + memset(&db_udev, 0x00, sizeof(struct udevice)); + if (udevdb_get_dev_byname(&db_udev, filename) != 0) { + dbg("free num=%d", num); + return num; + } -found: - return result; + num++; + if (num > 1000) { + info("find_free_number gone crazy (num=%d), aborted", num); + return -1; + } + snprintf(filename, NAME_SIZE-1, "%s%d", name, num); + filename[NAME_SIZE-1] = '\0'; + } } static void apply_format(struct udevice *udev, char *string, size_t maxsize, @@ -329,7 +329,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, case 'e': next_free_number = find_free_number(udev, string); if (next_free_number > 0) { - snprintf(temp2, sizeof(temp2), "%d", next_free_number); + sprintf(temp2, "%d", next_free_number); strfieldcatmax(string, temp2, maxsize); } break; diff --git a/tdb/Makefile b/tdb/Makefile deleted file mode 100644 index 87fb680bdd..0000000000 --- a/tdb/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# Makefile for tdb directory -# - -CFLAGS = -DSTANDALONE -DTDB_DEBUG -g -DHAVE_MMAP=1 - -PROGS = tdbtest tdbtool tdbtorture -TDB_OBJ = tdb.o spinlock.o - -default: $(TDB_OBJ) - -progs: $(PROGS) - -tdbtest: tdbtest.o $(TDB_OBJ) - $(CC) $(CFLAGS) -o tdbtest tdbtest.o $(TDB_OBJ) -lgdbm - -tdbtool: tdbtool.o $(TDB_OBJ) - $(CC) $(CFLAGS) -o tdbtool tdbtool.o $(TDB_OBJ) - -tdbtorture: tdbtorture.o $(TDB_OBJ) - $(CC) $(CFLAGS) -o tdbtorture tdbtorture.o $(TDB_OBJ) - -tdbdump: tdbdump.o $(TDB_OBJ) - $(CC) $(CFLAGS) -o tdbdump tdbdump.o $(TDB_OBJ) - -tdbbackup: tdbbackup.o $(TDB_OBJ) - $(CC) $(CFLAGS) -o tdbbackup tdbbackup.o $(TDB_OBJ) - -clean: - rm -f $(PROGS) *.o *~ *% core test.db test.tdb test.gdbm - -spotless: clean diff --git a/tdb/README b/tdb/README deleted file mode 100644 index fac3eacb4d..0000000000 --- a/tdb/README +++ /dev/null @@ -1,167 +0,0 @@ -tdb - a trivial database system -tridge@linuxcare.com December 1999 -================================== - -This is a simple database API. It was inspired by the realisation that -in Samba we have several ad-hoc bits of code that essentially -implement small databases for sharing structures between parts of -Samba. As I was about to add another I realised that a generic -database module was called for to replace all the ad-hoc bits. - -I based the interface on gdbm. I couldn't use gdbm as we need to be -able to have multiple writers to the databases at one time. - -Compilation ------------ - -add HAVE_MMAP=1 to use mmap instead of read/write -add TDB_DEBUG=1 for verbose debug info -add NOLOCK=1 to disable locking code - -Testing -------- - -Compile tdbtest.c and link with gdbm for testing. tdbtest will perform -identical operations via tdb and gdbm then make sure the result is the -same - -Also included is tdbtool, which allows simple database manipulation -on the commandline. - -tdbtest and tdbtool are not built as part of Samba, but are included -for completeness. - -Interface ---------- - -The interface is very similar to gdbm except for the following: - -- different open interface. The tdb_open call is more similar to a - traditional open() -- no tdbm_reorganise() function -- no tdbm_sync() function. No operations are cached in the library anyway -- added a tdb_traverse() function for traversing the whole database - -A general rule for using tdb is that the caller frees any returned -TDB_DATA structures. Just call free(p.dptr) to free a TDB_DATA -return value called p. This is the same as gdbm. - -here is a full list of tdb functions with brief descriptions. - - ----------------------------------------------------------------------- -TDB_CONTEXT *tdb_open(char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode) - - open the database, creating it if necessary - - The open_flags and mode are passed straight to the open call on the database - file. A flags value of O_WRONLY is invalid - - The hash size is advisory, use zero for a default value. - - return is NULL on error - - possible tdb_flags are: - TDB_CLEAR_IF_FIRST - clear database if we are the only one with it open - TDB_INTERNAL - don't use a file, instaed store the data in - memory. The filename is ignored in this case. - TDB_NOLOCK - don't do any locking - TDB_NOMMAP - don't use mmap - ----------------------------------------------------------------------- -char *tdb_error(TDB_CONTEXT *tdb); - - return a error string for the last tdb error - ----------------------------------------------------------------------- -int tdb_close(TDB_CONTEXT *tdb); - - close a database - ----------------------------------------------------------------------- -int tdb_update(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf); - - update an entry in place - this only works if the new data size - is <= the old data size and the key exists. - on failure return -1 - ----------------------------------------------------------------------- -TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key); - - fetch an entry in the database given a key - if the return value has a null dptr then a error occurred - - caller must free the resulting data - ----------------------------------------------------------------------- -int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key); - - check if an entry in the database exists - - note that 1 is returned if the key is found and 0 is returned if not found - this doesn't match the conventions in the rest of this module, but is - compatible with gdbm - ----------------------------------------------------------------------- -int tdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb, - TDB_DATA key, TDB_DATA dbuf, void *state), void *state); - - traverse the entire database - calling fn(tdb, key, data, state) on each - element. - - return -1 on error or the record count traversed - - if fn is NULL then it is not called - - a non-zero return value from fn() indicates that the traversal should stop - ----------------------------------------------------------------------- -TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb); - - find the first entry in the database and return its key - - the caller must free the returned data - ----------------------------------------------------------------------- -TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key); - - find the next entry in the database, returning its key - - the caller must free the returned data - ----------------------------------------------------------------------- -int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key); - - delete an entry in the database given a key - ----------------------------------------------------------------------- -int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); - - store an element in the database, replacing any existing element - with the same key - - If flag==TDB_INSERT then don't overwrite an existing entry - If flag==TDB_MODIFY then don't create a new entry - - return 0 on success, -1 on failure - ----------------------------------------------------------------------- -int tdb_writelock(TDB_CONTEXT *tdb); - - lock the database. If we already have it locked then don't do anything - ----------------------------------------------------------------------- -int tdb_writeunlock(TDB_CONTEXT *tdb); - unlock the database - ----------------------------------------------------------------------- -int tdb_lockchain(TDB_CONTEXT *tdb, TDB_DATA key); - - lock one hash chain. This is meant to be used to reduce locking - contention - it cannot guarantee how many records will be locked - ----------------------------------------------------------------------- -int tdb_unlockchain(TDB_CONTEXT *tdb, TDB_DATA key); - - unlock one hash chain diff --git a/tdb/spinlock.c b/tdb/spinlock.c deleted file mode 100644 index 451617fade..0000000000 --- a/tdb/spinlock.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - Unix SMB/CIFS implementation. - Samba database functions - Copyright (C) Anton Blanchard 2001 - - 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; either version 2 of the License, or - (at your option) any later version. - - 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 02139, USA. -*/ -/* udev defines */ -#define STANDALONE -#define TDB_DEBUG -#define HAVE_MMAP 1 - -#if HAVE_CONFIG_H -#include -#endif - -#ifdef STANDALONE -#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tdb.h" -#include "spinlock.h" -#include "../udev.h" -#include "../logging.h" - -#else -#include "includes.h" -#endif - -#ifdef USE_SPINLOCKS - -/* - * ARCH SPECIFIC - */ - -#if defined(SPARC_SPINLOCKS) - -static inline int __spin_trylock(spinlock_t *lock) -{ - unsigned int result; - - asm volatile("ldstub [%1], %0" - : "=r" (result) - : "r" (lock) - : "memory"); - - return (result == 0) ? 0 : EBUSY; -} - -static inline void __spin_unlock(spinlock_t *lock) -{ - asm volatile("":::"memory"); - *lock = 0; -} - -static inline void __spin_lock_init(spinlock_t *lock) -{ - *lock = 0; -} - -static inline int __spin_is_locked(spinlock_t *lock) -{ - return (*lock != 0); -} - -#elif defined(POWERPC_SPINLOCKS) - -static inline int __spin_trylock(spinlock_t *lock) -{ - unsigned int result; - - __asm__ __volatile__( -"1: lwarx %0,0,%1\n\ - cmpwi 0,%0,0\n\ - li %0,0\n\ - bne- 2f\n\ - li %0,1\n\ - stwcx. %0,0,%1\n\ - bne- 1b\n\ - isync\n\ -2:" : "=&r"(result) - : "r"(lock) - : "cr0", "memory"); - - return (result == 1) ? 0 : EBUSY; -} - -static inline void __spin_unlock(spinlock_t *lock) -{ - asm volatile("eieio":::"memory"); - *lock = 0; -} - -static inline void __spin_lock_init(spinlock_t *lock) -{ - *lock = 0; -} - -static inline int __spin_is_locked(spinlock_t *lock) -{ - return (*lock != 0); -} - -#elif defined(INTEL_SPINLOCKS) - -static inline int __spin_trylock(spinlock_t *lock) -{ - int oldval; - - asm volatile("xchgl %0,%1" - : "=r" (oldval), "=m" (*lock) - : "0" (0) - : "memory"); - - return oldval > 0 ? 0 : EBUSY; -} - -static inline void __spin_unlock(spinlock_t *lock) -{ - asm volatile("":::"memory"); - *lock = 1; -} - -static inline void __spin_lock_init(spinlock_t *lock) -{ - *lock = 1; -} - -static inline int __spin_is_locked(spinlock_t *lock) -{ - return (*lock != 1); -} - -#elif defined(MIPS_SPINLOCKS) - -static inline unsigned int load_linked(unsigned long addr) -{ - unsigned int res; - - __asm__ __volatile__("ll\t%0,(%1)" - : "=r" (res) - : "r" (addr)); - - return res; -} - -static inline unsigned int store_conditional(unsigned long addr, unsigned int value) -{ - unsigned int res; - - __asm__ __volatile__("sc\t%0,(%2)" - : "=r" (res) - : "0" (value), "r" (addr)); - return res; -} - -static inline int __spin_trylock(spinlock_t *lock) -{ - unsigned int mw; - - do { - mw = load_linked(lock); - if (mw) - return EBUSY; - } while (!store_conditional(lock, 1)); - - asm volatile("":::"memory"); - - return 0; -} - -static inline void __spin_unlock(spinlock_t *lock) -{ - asm volatile("":::"memory"); - *lock = 0; -} - -static inline void __spin_lock_init(spinlock_t *lock) -{ - *lock = 0; -} - -static inline int __spin_is_locked(spinlock_t *lock) -{ - return (*lock != 0); -} - -#else -#error Need to implement spinlock code in spinlock.c -#endif - -/* - * OS SPECIFIC - */ - -static void yield_cpu(void) -{ - struct timespec tm; - -#ifdef USE_SCHED_YIELD - sched_yield(); -#else - /* Linux will busy loop for delays < 2ms on real time tasks */ - tm.tv_sec = 0; - tm.tv_nsec = 2000000L + 1; - nanosleep(&tm, NULL); -#endif -} - -static int this_is_smp(void) -{ - return 0; -} - -/* - * GENERIC - */ - -static int smp_machine = 0; - -static inline void __spin_lock(spinlock_t *lock) -{ - int ntries = 0; - - while(__spin_trylock(lock)) { - while(__spin_is_locked(lock)) { - if (smp_machine && ntries++ < MAX_BUSY_LOOPS) - continue; - yield_cpu(); - } - } -} - -static void __read_lock(tdb_rwlock_t *rwlock) -{ - int ntries = 0; - - while(1) { - __spin_lock(&rwlock->lock); - - if (!(rwlock->count & RWLOCK_BIAS)) { - rwlock->count++; - __spin_unlock(&rwlock->lock); - return; - } - - __spin_unlock(&rwlock->lock); - - while(rwlock->count & RWLOCK_BIAS) { - if (smp_machine && ntries++ < MAX_BUSY_LOOPS) - continue; - yield_cpu(); - } - } -} - -static void __write_lock(tdb_rwlock_t *rwlock) -{ - int ntries = 0; - - while(1) { - __spin_lock(&rwlock->lock); - - if (rwlock->count == 0) { - rwlock->count |= RWLOCK_BIAS; - __spin_unlock(&rwlock->lock); - return; - } - - __spin_unlock(&rwlock->lock); - - while(rwlock->count != 0) { - if (smp_machine && ntries++ < MAX_BUSY_LOOPS) - continue; - yield_cpu(); - } - } -} - -static void __write_unlock(tdb_rwlock_t *rwlock) -{ - __spin_lock(&rwlock->lock); - - if (!(rwlock->count & RWLOCK_BIAS)) - dbg("bug: write_unlock"); - - rwlock->count &= ~RWLOCK_BIAS; - __spin_unlock(&rwlock->lock); -} - -static void __read_unlock(tdb_rwlock_t *rwlock) -{ - __spin_lock(&rwlock->lock); - - if (!rwlock->count) - dbg("bug: read_unlock"); - - if (rwlock->count & RWLOCK_BIAS) - dbg("bug: read_unlock"); - - rwlock->count--; - __spin_unlock(&rwlock->lock); -} - -/* TDB SPECIFIC */ - -/* lock a list in the database. list -1 is the alloc list */ -int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type) -{ - tdb_rwlock_t *rwlocks; - - if (!tdb->map_ptr) return -1; - rwlocks = (tdb_rwlock_t *)((char *)tdb->map_ptr + tdb->header.rwlocks); - - switch(rw_type) { - case F_RDLCK: - __read_lock(&rwlocks[list+1]); - break; - - case F_WRLCK: - __write_lock(&rwlocks[list+1]); - break; - - default: - return TDB_ERRCODE(TDB_ERR_LOCK, -1); - } - return 0; -} - -/* unlock the database. */ -int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type) -{ - tdb_rwlock_t *rwlocks; - - if (!tdb->map_ptr) return -1; - rwlocks = (tdb_rwlock_t *)((char *)tdb->map_ptr + tdb->header.rwlocks); - - switch(rw_type) { - case F_RDLCK: - __read_unlock(&rwlocks[list+1]); - break; - - case F_WRLCK: - __write_unlock(&rwlocks[list+1]); - break; - - default: - return TDB_ERRCODE(TDB_ERR_LOCK, -1); - } - - return 0; -} - -int tdb_create_rwlocks(int fd, unsigned int hash_size) -{ - unsigned size, i; - tdb_rwlock_t *rwlocks; - - size = (hash_size + 1) * sizeof(tdb_rwlock_t); - rwlocks = malloc(size); - if (!rwlocks) - return -1; - - for(i = 0; i < hash_size+1; i++) { - __spin_lock_init(&rwlocks[i].lock); - rwlocks[i].count = 0; - } - - /* Write it out (appending to end) */ - if (write(fd, rwlocks, size) != size) { - free(rwlocks); - return -1; - } - smp_machine = this_is_smp(); - free(rwlocks); - return 0; -} - -int tdb_clear_spinlocks(TDB_CONTEXT *tdb) -{ - tdb_rwlock_t *rwlocks; - unsigned i; - - if (tdb->header.rwlocks == 0) return 0; - if (!tdb->map_ptr) return -1; - - /* We're mmapped here */ - rwlocks = (tdb_rwlock_t *)((char *)tdb->map_ptr + tdb->header.rwlocks); - for(i = 0; i < tdb->header.hash_size+1; i++) { - __spin_lock_init(&rwlocks[i].lock); - rwlocks[i].count = 0; - } - return 0; -} -#else -int tdb_create_rwlocks(int fd, unsigned int hash_size) { return 0; } -int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type) { return -1; } -int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type) { return -1; } - -/* Non-spinlock version: remove spinlock pointer */ -int tdb_clear_spinlocks(TDB_CONTEXT *tdb) -{ - tdb_off off = (tdb_off)((char *)&tdb->header.rwlocks - - (char *)&tdb->header); - - tdb->header.rwlocks = 0; - if (lseek(tdb->fd, off, SEEK_SET) != off - || write(tdb->fd, (void *)&tdb->header.rwlocks, - sizeof(tdb->header.rwlocks)) - != sizeof(tdb->header.rwlocks)) - return -1; - return 0; -} -#endif diff --git a/tdb/spinlock.h b/tdb/spinlock.h deleted file mode 100644 index 8b0e833ff5..0000000000 --- a/tdb/spinlock.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __SPINLOCK_H__ -#define __SPINLOCK_H__ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "tdb.h" - -#ifdef USE_SPINLOCKS - -#define RWLOCK_BIAS 0x1000UL - -/* OS SPECIFIC */ -#define MAX_BUSY_LOOPS 1000 -#undef USE_SCHED_YIELD - -/* ARCH SPECIFIC */ -/* We should make sure these are padded to a cache line */ -#if defined(SPARC_SPINLOCKS) -typedef volatile char spinlock_t; -#elif defined(POWERPC_SPINLOCKS) -typedef volatile unsigned long spinlock_t; -#elif defined(INTEL_SPINLOCKS) -typedef volatile int spinlock_t; -#elif defined(MIPS_SPINLOCKS) -typedef volatile unsigned long spinlock_t; -#else -#error Need to implement spinlock code in spinlock.h -#endif - -typedef struct { - spinlock_t lock; - volatile int count; -} tdb_rwlock_t; - -int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type); -int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type); -int tdb_create_rwlocks(int fd, unsigned int hash_size); -int tdb_clear_spinlocks(TDB_CONTEXT *tdb); - -#else /* !USE_SPINLOCKS */ -#if 0 -#define tdb_create_rwlocks(fd, hash_size) 0 -#define tdb_spinlock(tdb, list, rw_type) (-1) -#define tdb_spinunlock(tdb, list, rw_type) (-1) -#else -int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type); -int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type); -int tdb_create_rwlocks(int fd, unsigned int hash_size); -#endif -int tdb_clear_spinlocks(TDB_CONTEXT *tdb); -#endif - -#endif diff --git a/tdb/tdb.c b/tdb/tdb.c deleted file mode 100644 index af475bb7ad..0000000000 --- a/tdb/tdb.c +++ /dev/null @@ -1,2099 +0,0 @@ - /* - Unix SMB/CIFS implementation. - Samba database functions - Copyright (C) Andrew Tridgell 1999-2000 - Copyright (C) Luke Kenneth Casson Leighton 2000 - Copyright (C) Paul `Rusty' Russell 2000 - Copyright (C) Jeremy Allison 2000-2003 - - 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; either version 2 of the License, or - (at your option) any later version. - - 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 02139, USA. -*/ - - -/* NOTE: If you use tdbs under valgrind, and in particular if you run - * tdbtorture, you may get spurious "uninitialized value" warnings. I - * think this is because valgrind doesn't understand that the mmap'd - * area may be written to by other processes. Memory can, from the - * point of view of the grinded process, spontaneously become - * initialized. - * - * I can think of a few solutions. [mbp 20030311] - * - * 1 - Write suppressions for Valgrind so that it doesn't complain - * about this. Probably the most reasonable but people need to - * remember to use them. - * - * 2 - Use IO not mmap when running under valgrind. Not so nice. - * - * 3 - Use the special valgrind macros to mark memory as valid at the - * right time. Probably too hard -- the process just doesn't know. - */ - -/* udev defines */ -#define STANDALONE -#define TDB_DEBUG -#define HAVE_MMAP 1 -/* this should prevent deadlocks loops on corrupt databases - * we've discovered. Most deadlocks happend by iterating over the - * list of entries with the same hash value. */ -#define LOOP_MAX 100000 -#define TDB_LOG(x) TDB_LOG_UDEV x -#define TDB_LOG_UDEV(tdb, level, format, arg...) info(format, ##arg) - -#ifdef STANDALONE -#if HAVE_CONFIG_H -#include -#endif - -#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tdb.h" -#include "spinlock.h" -#include "../udev_lib.h" -#include "../logging.h" -#else -#include "includes.h" -#endif - -#define TDB_MAGIC_FOOD "TDB file\n" -#define TDB_VERSION (0x26011967 + 6) -#define TDB_MAGIC (0x26011999U) -#define TDB_FREE_MAGIC (~TDB_MAGIC) -#define TDB_DEAD_MAGIC (0xFEE1DEAD) -#define TDB_ALIGNMENT 4 -#define MIN_REC_SIZE (2*sizeof(struct list_struct) + TDB_ALIGNMENT) -#define DEFAULT_HASH_SIZE 131 -#define TDB_PAGE_SIZE 0x2000 -#define FREELIST_TOP (sizeof(struct tdb_header)) -#define TDB_ALIGN(x,a) (((x) + (a)-1) & ~((a)-1)) -#define TDB_BYTEREV(x) (((((x)&0xff)<<24)|((x)&0xFF00)<<8)|(((x)>>8)&0xFF00)|((x)>>24)) -#define TDB_DEAD(r) ((r)->magic == TDB_DEAD_MAGIC) -#define TDB_BAD_MAGIC(r) ((r)->magic != TDB_MAGIC && !TDB_DEAD(r)) -#define TDB_HASH_TOP(hash) (FREELIST_TOP + (BUCKET(hash)+1)*sizeof(tdb_off)) - -/* NB assumes there is a local variable called "tdb" that is the - * current context, also takes doubly-parenthesized print-style - * argument. */ -#ifndef TDB_LOG -#define TDB_LOG(x) (tdb->log_fn?((tdb->log_fn x),0) : 0) -#endif - -/* lock offsets */ -#define GLOBAL_LOCK 0 -#define ACTIVE_LOCK 4 - -#ifndef MAP_FILE -#define MAP_FILE 0 -#endif - -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -/* free memory if the pointer is valid and zero the pointer */ -#ifndef SAFE_FREE -#define SAFE_FREE(x) do { if ((x) != NULL) {free((x)); (x)=NULL;} } while(0) -#endif - -#define BUCKET(hash) ((hash) % tdb->header.hash_size) -TDB_DATA tdb_null; - -/* all contexts, to ensure no double-opens (fcntl locks don't nest!) */ -static TDB_CONTEXT *tdbs = NULL; - -static int tdb_munmap(TDB_CONTEXT *tdb) -{ - if (tdb->flags & TDB_INTERNAL) - return 0; - -#ifdef HAVE_MMAP - if (tdb->map_ptr) { - int ret = munmap(tdb->map_ptr, tdb->map_size); - if (ret != 0) - return ret; - } -#endif - tdb->map_ptr = NULL; - return 0; -} - -static void tdb_mmap(TDB_CONTEXT *tdb) -{ - if (tdb->flags & TDB_INTERNAL) - return; - -#ifdef HAVE_MMAP - if (!(tdb->flags & TDB_NOMMAP)) { - tdb->map_ptr = mmap(NULL, tdb->map_size, - PROT_READ|(tdb->read_only? 0:PROT_WRITE), - MAP_SHARED|MAP_FILE, tdb->fd, 0); - - /* - * NB. When mmap fails it returns MAP_FAILED *NOT* NULL !!!! - */ - - if (tdb->map_ptr == MAP_FAILED) { - tdb->map_ptr = NULL; - TDB_LOG((tdb, 2, "tdb_mmap failed for size %d (%s)\n", - tdb->map_size, strerror(errno))); - } - } else { - tdb->map_ptr = NULL; - } -#else - tdb->map_ptr = NULL; -#endif -} - -/* Endian conversion: we only ever deal with 4 byte quantities */ -static void *convert(void *buf, u32 size) -{ - u32 i, *p = buf; - for (i = 0; i < size / 4; i++) - p[i] = TDB_BYTEREV(p[i]); - return buf; -} -#define DOCONV() (tdb->flags & TDB_CONVERT) -#define CONVERT(x) (DOCONV() ? convert(&x, sizeof(x)) : &x) - -/* the body of the database is made of one list_struct for the free space - plus a separate data list for each hash value */ -struct list_struct { - tdb_off next; /* offset of the next record in the list */ - tdb_len rec_len; /* total byte length of record */ - tdb_len key_len; /* byte length of key */ - tdb_len data_len; /* byte length of data */ - u32 full_hash; /* the full 32 bit hash of the key */ - u32 magic; /* try to catch errors */ - /* the following union is implied: - union { - char record[rec_len]; - struct { - char key[key_len]; - char data[data_len]; - } - u32 totalsize; (tailer) - } - */ -}; - -/*************************************************************** - Allow a caller to set a "alarm" flag that tdb can check to abort - a blocking lock on SIGALRM. -***************************************************************/ - -static sig_atomic_t *palarm_fired; - -void tdb_set_lock_alarm(sig_atomic_t *palarm) -{ - palarm_fired = palarm; -} - -/* a byte range locking function - return 0 on success - this functions locks/unlocks 1 byte at the specified offset. - - On error, errno is also set so that errors are passed back properly - through tdb_open(). */ -static int tdb_brlock(TDB_CONTEXT *tdb, tdb_off offset, - int rw_type, int lck_type, int probe) -{ - struct flock fl; - int ret; - - if (tdb->flags & TDB_NOLOCK) - return 0; - if ((rw_type == F_WRLCK) && (tdb->read_only)) { - errno = EACCES; - return -1; - } - - fl.l_type = rw_type; - fl.l_whence = SEEK_SET; - fl.l_start = offset; - fl.l_len = 1; - fl.l_pid = 0; - - do { - ret = fcntl(tdb->fd,lck_type,&fl); - if (ret == -1 && errno == EINTR && palarm_fired && *palarm_fired) - break; - } while (ret == -1 && errno == EINTR); - - if (ret == -1) { - if (!probe && lck_type != F_SETLK) { - /* Ensure error code is set for log fun to examine. */ - if (errno == EINTR && palarm_fired && *palarm_fired) - tdb->ecode = TDB_ERR_LOCK_TIMEOUT; - else - tdb->ecode = TDB_ERR_LOCK; - TDB_LOG((tdb, 5,"tdb_brlock failed (fd=%d) at offset %d rw_type=%d lck_type=%d\n", - tdb->fd, offset, rw_type, lck_type)); - } - /* Was it an alarm timeout ? */ - if (errno == EINTR && palarm_fired && *palarm_fired) - return TDB_ERRCODE(TDB_ERR_LOCK_TIMEOUT, -1); - /* Otherwise - generic lock error. */ - /* errno set by fcntl */ - return TDB_ERRCODE(TDB_ERR_LOCK, -1); - } - return 0; -} - -/* lock a list in the database. list -1 is the alloc list */ -static int tdb_lock(TDB_CONTEXT *tdb, int list, int ltype) -{ - if (list < -1 || list >= (int)tdb->header.hash_size) { - TDB_LOG((tdb, 0,"tdb_lock: invalid list %d for ltype=%d\n", - list, ltype)); - return -1; - } - if (tdb->flags & TDB_NOLOCK) - return 0; - - /* Since fcntl locks don't nest, we do a lock for the first one, - and simply bump the count for future ones */ - if (tdb->locked[list+1].count == 0) { - if (!tdb->read_only && tdb->header.rwlocks) { - if (tdb_spinlock(tdb, list, ltype)) { - TDB_LOG((tdb, 0, "tdb_lock spinlock failed on list %d ltype=%d\n", - list, ltype)); - return -1; - } - } else if (tdb_brlock(tdb,FREELIST_TOP+4*list,ltype,F_SETLKW, 0)) { - TDB_LOG((tdb, 0,"tdb_lock failed on list %d ltype=%d (%s)\n", - list, ltype, strerror(errno))); - return -1; - } - tdb->locked[list+1].ltype = ltype; - } - tdb->locked[list+1].count++; - return 0; -} - -/* unlock the database: returns void because it's too late for errors. */ - /* changed to return int it may be interesting to know there - has been an error --simo */ -static int tdb_unlock(TDB_CONTEXT *tdb, int list, int ltype) -{ - int ret = -1; - - if (tdb->flags & TDB_NOLOCK) - return 0; - - /* Sanity checks */ - if (list < -1 || list >= (int)tdb->header.hash_size) { - TDB_LOG((tdb, 0, "tdb_unlock: list %d invalid (%d)\n", list, tdb->header.hash_size)); - return ret; - } - - if (tdb->locked[list+1].count==0) { - TDB_LOG((tdb, 0, "tdb_unlock: count is 0\n")); - return ret; - } - - if (tdb->locked[list+1].count == 1) { - /* Down to last nested lock: unlock underneath */ - if (!tdb->read_only && tdb->header.rwlocks) { - ret = tdb_spinunlock(tdb, list, ltype); - } else { - ret = tdb_brlock(tdb, FREELIST_TOP+4*list, F_UNLCK, F_SETLKW, 0); - } - } else { - ret = 0; - } - tdb->locked[list+1].count--; - - if (ret) - TDB_LOG((tdb, 0,"tdb_unlock: An error occurred unlocking!\n")); - return ret; -} - -/* This is based on the hash algorithm from gdbm */ -static u32 tdb_hash(TDB_DATA *key) -{ - u32 value; /* Used to compute the hash value. */ - u32 i; /* Used to cycle through random values. */ - - /* Set the initial value from the key size. */ - for (value = 0x238F13AF * key->dsize, i=0; i < key->dsize; i++) - value = (value + (key->dptr[i] << (i*5 % 24))); - - return (1103515243 * value + 12345); -} - -/* check for an out of bounds access - if it is out of bounds then - see if the database has been expanded by someone else and expand - if necessary - note that "len" is the minimum length needed for the db -*/ -static int tdb_oob(TDB_CONTEXT *tdb, tdb_off len, int probe) -{ - struct stat st; - if (len <= tdb->map_size) - return 0; - if (tdb->flags & TDB_INTERNAL) { - if (!probe) { - /* Ensure ecode is set for log fn. */ - tdb->ecode = TDB_ERR_IO; - TDB_LOG((tdb, 0,"tdb_oob len %d beyond internal malloc size %d\n", - (int)len, (int)tdb->map_size)); - } - return TDB_ERRCODE(TDB_ERR_IO, -1); - } - - if (fstat(tdb->fd, &st) == -1) - return TDB_ERRCODE(TDB_ERR_IO, -1); - - if (st.st_size < (size_t)len) { - if (!probe) { - /* Ensure ecode is set for log fn. */ - tdb->ecode = TDB_ERR_IO; - TDB_LOG((tdb, 0,"tdb_oob len %d beyond eof at %d\n", - (int)len, (int)st.st_size)); - } - return TDB_ERRCODE(TDB_ERR_IO, -1); - } - - /* Unmap, update size, remap */ - if (tdb_munmap(tdb) == -1) - return TDB_ERRCODE(TDB_ERR_IO, -1); - tdb->map_size = st.st_size; - tdb_mmap(tdb); - return 0; -} - -/* write a lump of data at a specified offset */ -static int tdb_write(TDB_CONTEXT *tdb, tdb_off off, void *buf, tdb_len len) -{ - if (tdb_oob(tdb, off + len, 0) != 0) - return -1; - - if (tdb->map_ptr) - memcpy(off + (char *)tdb->map_ptr, buf, len); -#ifdef HAVE_PWRITE - else if (pwrite(tdb->fd, buf, len, off) != (ssize_t)len) { -#else - else if (lseek(tdb->fd, off, SEEK_SET) != off - || write(tdb->fd, buf, len) != (ssize_t)len) { -#endif - /* Ensure ecode is set for log fn. */ - tdb->ecode = TDB_ERR_IO; - TDB_LOG((tdb, 0,"tdb_write failed at %d len=%d (%s)\n", - off, len, strerror(errno))); - return TDB_ERRCODE(TDB_ERR_IO, -1); - } - return 0; -} - -/* read a lump of data at a specified offset, maybe convert */ -static int tdb_read(TDB_CONTEXT *tdb,tdb_off off,void *buf,tdb_len len,int cv) -{ - if (tdb_oob(tdb, off + len, 0) != 0) - return -1; - - if (tdb->map_ptr) - memcpy(buf, off + (char *)tdb->map_ptr, len); -#ifdef HAVE_PREAD - else if (pread(tdb->fd, buf, len, off) != (ssize_t)len) { -#else - else if (lseek(tdb->fd, off, SEEK_SET) != off - || read(tdb->fd, buf, len) != (ssize_t)len) { -#endif - /* Ensure ecode is set for log fn. */ - tdb->ecode = TDB_ERR_IO; - TDB_LOG((tdb, 0,"tdb_read failed at %d len=%d (%s)\n", - off, len, strerror(errno))); - return TDB_ERRCODE(TDB_ERR_IO, -1); - } - if (cv) - convert(buf, len); - return 0; -} - -/* read a lump of data, allocating the space for it */ -static char *tdb_alloc_read(TDB_CONTEXT *tdb, tdb_off offset, tdb_len len) -{ - char *buf; - - if (!(buf = malloc(len))) { - /* Ensure ecode is set for log fn. */ - tdb->ecode = TDB_ERR_OOM; - TDB_LOG((tdb, 0,"tdb_alloc_read malloc failed len=%d (%s)\n", - len, strerror(errno))); - return TDB_ERRCODE(TDB_ERR_OOM, buf); - } - if (tdb_read(tdb, offset, buf, len, 0) == -1) { - SAFE_FREE(buf); - return NULL; - } - return buf; -} - -/* read/write a tdb_off */ -static int ofs_read(TDB_CONTEXT *tdb, tdb_off offset, tdb_off *d) -{ - return tdb_read(tdb, offset, (char*)d, sizeof(*d), DOCONV()); -} -static int ofs_write(TDB_CONTEXT *tdb, tdb_off offset, tdb_off *d) -{ - tdb_off off = *d; - return tdb_write(tdb, offset, CONVERT(off), sizeof(*d)); -} - -/* read/write a record */ -static int rec_read(TDB_CONTEXT *tdb, tdb_off offset, struct list_struct *rec) -{ - if (tdb_read(tdb, offset, rec, sizeof(*rec),DOCONV()) == -1) - return -1; - if (TDB_BAD_MAGIC(rec)) { - /* Ensure ecode is set for log fn. */ - tdb->ecode = TDB_ERR_CORRUPT; - TDB_LOG((tdb, 0,"rec_read bad magic 0x%x at offset=%d\n", rec->magic, offset)); - return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); - } - return tdb_oob(tdb, rec->next+sizeof(*rec), 0); -} -static int rec_write(TDB_CONTEXT *tdb, tdb_off offset, struct list_struct *rec) -{ - struct list_struct r = *rec; - return tdb_write(tdb, offset, CONVERT(r), sizeof(r)); -} - -/* read a freelist record and check for simple errors */ -static int rec_free_read(TDB_CONTEXT *tdb, tdb_off off, struct list_struct *rec) -{ - if (tdb_read(tdb, off, rec, sizeof(*rec),DOCONV()) == -1) - return -1; - - if (rec->magic == TDB_MAGIC) { - /* this happens when a app is showdown while deleting a record - we should - not completely fail when this happens */ - TDB_LOG((tdb, 0,"rec_free_read non-free magic 0x%x at offset=%d - fixing\n", - rec->magic, off)); - rec->magic = TDB_FREE_MAGIC; - if (tdb_write(tdb, off, rec, sizeof(*rec)) == -1) - return -1; - } - - if (rec->magic != TDB_FREE_MAGIC) { - /* Ensure ecode is set for log fn. */ - tdb->ecode = TDB_ERR_CORRUPT; - TDB_LOG((tdb, 0,"rec_free_read bad magic 0x%x at offset=%d\n", - rec->magic, off)); - return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); - } - if (tdb_oob(tdb, rec->next+sizeof(*rec), 0) != 0) - return -1; - return 0; -} - -/* update a record tailer (must hold allocation lock) */ -static int update_tailer(TDB_CONTEXT *tdb, tdb_off offset, - const struct list_struct *rec) -{ - tdb_off totalsize; - - /* Offset of tailer from record header */ - totalsize = sizeof(*rec) + rec->rec_len; - return ofs_write(tdb, offset + totalsize - sizeof(tdb_off), - &totalsize); -} - -static tdb_off tdb_dump_record(TDB_CONTEXT *tdb, tdb_off offset) -{ - struct list_struct rec; - tdb_off tailer_ofs, tailer; - - if (tdb_read(tdb, offset, (char *)&rec, sizeof(rec), DOCONV()) == -1) { - printf("ERROR: failed to read record at %u\n", offset); - return 0; - } - - printf(" rec: offset=%u next=%d rec_len=%d key_len=%d data_len=%d full_hash=0x%x magic=0x%x\n", - offset, rec.next, rec.rec_len, rec.key_len, rec.data_len, rec.full_hash, rec.magic); - - tailer_ofs = offset + sizeof(rec) + rec.rec_len - sizeof(tdb_off); - if (ofs_read(tdb, tailer_ofs, &tailer) == -1) { - printf("ERROR: failed to read tailer at %u\n", tailer_ofs); - return rec.next; - } - - if (tailer != rec.rec_len + sizeof(rec)) { - printf("ERROR: tailer does not match record! tailer=%u totalsize=%u\n", - (unsigned)tailer, (unsigned)(rec.rec_len + sizeof(rec))); - } - return rec.next; -} - -static int tdb_dump_chain(TDB_CONTEXT *tdb, int i) -{ - tdb_off rec_ptr, top; - - top = TDB_HASH_TOP(i); - - if (tdb_lock(tdb, i, F_WRLCK) != 0) - return -1; - - if (ofs_read(tdb, top, &rec_ptr) == -1) - return tdb_unlock(tdb, i, F_WRLCK); - - if (rec_ptr) - printf("hash=%d\n", i); - - while (rec_ptr) { - rec_ptr = tdb_dump_record(tdb, rec_ptr); - } - - return tdb_unlock(tdb, i, F_WRLCK); -} - -void tdb_dump_all(TDB_CONTEXT *tdb) -{ - int i; - for (i=0;iheader.hash_size;i++) { - tdb_dump_chain(tdb, i); - } - printf("freelist:\n"); - tdb_dump_chain(tdb, -1); -} - -int tdb_printfreelist(TDB_CONTEXT *tdb) -{ - int ret; - long total_free = 0; - tdb_off offset, rec_ptr; - struct list_struct rec; - - if ((ret = tdb_lock(tdb, -1, F_WRLCK)) != 0) - return ret; - - offset = FREELIST_TOP; - - /* read in the freelist top */ - if (ofs_read(tdb, offset, &rec_ptr) == -1) { - tdb_unlock(tdb, -1, F_WRLCK); - return 0; - } - - printf("freelist top=[0x%08x]\n", rec_ptr ); - while (rec_ptr) { - if (tdb_read(tdb, rec_ptr, (char *)&rec, sizeof(rec), DOCONV()) == -1) { - tdb_unlock(tdb, -1, F_WRLCK); - return -1; - } - - if (rec.magic != TDB_FREE_MAGIC) { - printf("bad magic 0x%08x in free list\n", rec.magic); - tdb_unlock(tdb, -1, F_WRLCK); - return -1; - } - - printf("entry offset=[0x%08x], rec.rec_len = [0x%08x (%d)]\n", rec.next, rec.rec_len, rec.rec_len ); - total_free += rec.rec_len; - - /* move to the next record */ - rec_ptr = rec.next; - } - printf("total rec_len = [0x%08x (%d)]\n", (int)total_free, - (int)total_free); - - return tdb_unlock(tdb, -1, F_WRLCK); -} - -/* Remove an element from the freelist. Must have alloc lock. */ -static int remove_from_freelist(TDB_CONTEXT *tdb, tdb_off off, tdb_off next) -{ - tdb_off last_ptr, i; - int maxloop; - - /* read in the freelist top */ - maxloop = LOOP_MAX; - last_ptr = FREELIST_TOP; - while (ofs_read(tdb, last_ptr, &i) != -1 && i != 0) { - if (i == off) { - /* We've found it! */ - return ofs_write(tdb, last_ptr, &next); - } - /* Follow chain (next offset is at start of record) */ - last_ptr = i; - - maxloop--; - if (maxloop == 0) { - TDB_LOG((tdb, 0, "remove_from_freelist: maxloop reached; corrupt database!\n")); - return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); - } - } - TDB_LOG((tdb, 0,"remove_from_freelist: not on list at off=%d\n", off)); - return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); -} - -/* Add an element into the freelist. Merge adjacent records if - neccessary. */ -static int tdb_free(TDB_CONTEXT *tdb, tdb_off offset, struct list_struct *rec) -{ - tdb_off right, left; - - /* Allocation and tailer lock */ - if (tdb_lock(tdb, -1, F_WRLCK) != 0) - return -1; - - /* set an initial tailer, so if we fail we don't leave a bogus record */ - if (update_tailer(tdb, offset, rec) != 0) { - TDB_LOG((tdb, 0, "tdb_free: upfate_tailer failed!\n")); - goto fail; - } - - /* Look right first (I'm an Australian, dammit) */ - right = offset + sizeof(*rec) + rec->rec_len; - if (right + sizeof(*rec) <= tdb->map_size) { - struct list_struct r; - - if (tdb_read(tdb, right, &r, sizeof(r), DOCONV()) == -1) { - TDB_LOG((tdb, 0, "tdb_free: right read failed at %u\n", right)); - goto left; - } - - /* If it's free, expand to include it. */ - if (r.magic == TDB_FREE_MAGIC) { - if (remove_from_freelist(tdb, right, r.next) == -1) { - TDB_LOG((tdb, 0, "tdb_free: right free failed at %u\n", right)); - goto left; - } - rec->rec_len += sizeof(r) + r.rec_len; - } - } - -left: - /* Look left */ - left = offset - sizeof(tdb_off); - if (left > TDB_HASH_TOP(tdb->header.hash_size-1)) { - struct list_struct l; - tdb_off leftsize; - - /* Read in tailer and jump back to header */ - if (ofs_read(tdb, left, &leftsize) == -1) { - TDB_LOG((tdb, 0, "tdb_free: left offset read failed at %u\n", left)); - goto update; - } - left = offset - leftsize; - - /* Now read in record */ - if (tdb_read(tdb, left, &l, sizeof(l), DOCONV()) == -1) { - TDB_LOG((tdb, 0, "tdb_free: left read failed at %u (%u)\n", left, leftsize)); - goto update; - } - - /* If it's free, expand to include it. */ - if (l.magic == TDB_FREE_MAGIC) { - if (remove_from_freelist(tdb, left, l.next) == -1) { - TDB_LOG((tdb, 0, "tdb_free: left free failed at %u\n", left)); - goto update; - } else { - offset = left; - rec->rec_len += leftsize; - } - } - } - -update: - if (update_tailer(tdb, offset, rec) == -1) { - TDB_LOG((tdb, 0, "tdb_free: update_tailer failed at %u\n", offset)); - goto fail; - } - - /* Now, prepend to free list */ - rec->magic = TDB_FREE_MAGIC; - - if (ofs_read(tdb, FREELIST_TOP, &rec->next) == -1 || - rec_write(tdb, offset, rec) == -1 || - ofs_write(tdb, FREELIST_TOP, &offset) == -1) { - TDB_LOG((tdb, 0, "tdb_free record write failed at offset=%d\n", offset)); - goto fail; - } - - /* And we're done. */ - tdb_unlock(tdb, -1, F_WRLCK); - return 0; - - fail: - tdb_unlock(tdb, -1, F_WRLCK); - return -1; -} - - -/* expand a file. we prefer to use ftruncate, as that is what posix - says to use for mmap expansion */ -static int expand_file(TDB_CONTEXT *tdb, tdb_off size, tdb_off addition) -{ - char buf[1024]; -#if HAVE_FTRUNCATE_EXTEND - if (ftruncate(tdb->fd, size+addition) != 0) { - TDB_LOG((tdb, 0, "expand_file ftruncate to %d failed (%s)\n", - size+addition, strerror(errno))); - return -1; - } -#else - char b = 0; - -#ifdef HAVE_PWRITE - if (pwrite(tdb->fd, &b, 1, (size+addition) - 1) != 1) { -#else - if (lseek(tdb->fd, (size+addition) - 1, SEEK_SET) != (size+addition) - 1 || - write(tdb->fd, &b, 1) != 1) { -#endif - TDB_LOG((tdb, 0, "expand_file to %d failed (%s)\n", - size+addition, strerror(errno))); - return -1; - } -#endif - - /* now fill the file with something. This ensures that the file isn't sparse, which would be - very bad if we ran out of disk. This must be done with write, not via mmap */ - memset(buf, 0x42, sizeof(buf)); - while (addition) { - int n = addition>sizeof(buf)?sizeof(buf):addition; -#ifdef HAVE_PWRITE - int ret = pwrite(tdb->fd, buf, n, size); -#else - int ret; - if (lseek(tdb->fd, size, SEEK_SET) != size) - return -1; - ret = write(tdb->fd, buf, n); -#endif - if (ret != n) { - TDB_LOG((tdb, 0, "expand_file write of %d failed (%s)\n", - n, strerror(errno))); - return -1; - } - addition -= n; - size += n; - } - return 0; -} - - -/* expand the database at least size bytes by expanding the underlying - file and doing the mmap again if necessary */ -static int tdb_expand(TDB_CONTEXT *tdb, tdb_off size) -{ - struct list_struct rec; - tdb_off offset; - - if (tdb_lock(tdb, -1, F_WRLCK) == -1) { - TDB_LOG((tdb, 0, "lock failed in tdb_expand\n")); - return -1; - } - - /* must know about any previous expansions by another process */ - tdb_oob(tdb, tdb->map_size + 1, 1); - - /* always make room for at least 10 more records, and round - the database up to a multiple of TDB_PAGE_SIZE */ - size = TDB_ALIGN(tdb->map_size + size*10, TDB_PAGE_SIZE) - tdb->map_size; - - if (!(tdb->flags & TDB_INTERNAL)) - tdb_munmap(tdb); - - /* - * We must ensure the file is unmapped before doing this - * to ensure consistency with systems like OpenBSD where - * writes and mmaps are not consistent. - */ - - /* expand the file itself */ - if (!(tdb->flags & TDB_INTERNAL)) { - if (expand_file(tdb, tdb->map_size, size) != 0) - goto fail; - } - - tdb->map_size += size; - - if (tdb->flags & TDB_INTERNAL) - tdb->map_ptr = realloc(tdb->map_ptr, tdb->map_size); - else { - /* - * We must ensure the file is remapped before adding the space - * to ensure consistency with systems like OpenBSD where - * writes and mmaps are not consistent. - */ - - /* We're ok if the mmap fails as we'll fallback to read/write */ - tdb_mmap(tdb); - } - - /* form a new freelist record */ - memset(&rec,'\0',sizeof(rec)); - rec.rec_len = size - sizeof(rec); - - /* link it into the free list */ - offset = tdb->map_size - size; - if (tdb_free(tdb, offset, &rec) == -1) - goto fail; - - tdb_unlock(tdb, -1, F_WRLCK); - return 0; - fail: - tdb_unlock(tdb, -1, F_WRLCK); - return -1; -} - -/* allocate some space from the free list. The offset returned points - to a unconnected list_struct within the database with room for at - least length bytes of total data - - 0 is returned if the space could not be allocated - */ -static tdb_off tdb_allocate(TDB_CONTEXT *tdb, tdb_len length, - struct list_struct *rec) -{ - tdb_off rec_ptr, last_ptr, newrec_ptr; - struct list_struct newrec; - int maxloop; - - if (tdb_lock(tdb, -1, F_WRLCK) == -1) - return 0; - - /* Extra bytes required for tailer */ - length += sizeof(tdb_off); - - again: - last_ptr = FREELIST_TOP; - - /* read in the freelist top */ - if (ofs_read(tdb, FREELIST_TOP, &rec_ptr) == -1) - goto fail; - - /* keep looking until we find a freelist record big enough */ - maxloop = LOOP_MAX; - while (rec_ptr) { - if (rec_free_read(tdb, rec_ptr, rec) == -1) - goto fail; - - if (rec->rec_len >= length) { - /* found it - now possibly split it up */ - if (rec->rec_len > length + MIN_REC_SIZE) { - /* Length of left piece */ - length = TDB_ALIGN(length, TDB_ALIGNMENT); - - /* Right piece to go on free list */ - newrec.rec_len = rec->rec_len - - (sizeof(*rec) + length); - newrec_ptr = rec_ptr + sizeof(*rec) + length; - - /* And left record is shortened */ - rec->rec_len = length; - } else - newrec_ptr = 0; - - /* Remove allocated record from the free list */ - if (ofs_write(tdb, last_ptr, &rec->next) == -1) - goto fail; - - /* Update header: do this before we drop alloc - lock, otherwise tdb_free() might try to - merge with us, thinking we're free. - (Thanks Jeremy Allison). */ - rec->magic = TDB_MAGIC; - if (rec_write(tdb, rec_ptr, rec) == -1) - goto fail; - - /* Did we create new block? */ - if (newrec_ptr) { - /* Update allocated record tailer (we - shortened it). */ - if (update_tailer(tdb, rec_ptr, rec) == -1) - goto fail; - - /* Free new record */ - if (tdb_free(tdb, newrec_ptr, &newrec) == -1) - goto fail; - } - - /* all done - return the new record offset */ - tdb_unlock(tdb, -1, F_WRLCK); - return rec_ptr; - } - /* move to the next record */ - last_ptr = rec_ptr; - rec_ptr = rec->next; - - maxloop--; - if (maxloop == 0) { - TDB_LOG((tdb, 0, "tdb_allocate: maxloop reached; corrupt database!\n")); - return TDB_ERRCODE(TDB_ERR_CORRUPT, 0); - } - } - /* we didn't find enough space. See if we can expand the - database and if we can then try again */ - if (tdb_expand(tdb, length + sizeof(*rec)) == 0) - goto again; - fail: - tdb_unlock(tdb, -1, F_WRLCK); - return 0; -} - -/* initialise a new database with a specified hash size */ -static int tdb_new_database(TDB_CONTEXT *tdb, int hash_size) -{ - struct tdb_header *newdb; - int size, ret = -1; - - /* We make it up in memory, then write it out if not internal */ - size = sizeof(struct tdb_header) + (hash_size+1)*sizeof(tdb_off); - if (!(newdb = calloc(size, 1))) - return TDB_ERRCODE(TDB_ERR_OOM, -1); - - /* Fill in the header */ - newdb->version = TDB_VERSION; - newdb->hash_size = hash_size; -#ifdef USE_SPINLOCKS - newdb->rwlocks = size; -#endif - if (tdb->flags & TDB_INTERNAL) { - tdb->map_size = size; - tdb->map_ptr = (char *)newdb; - memcpy(&tdb->header, newdb, sizeof(tdb->header)); - /* Convert the `ondisk' version if asked. */ - CONVERT(*newdb); - return 0; - } - if (lseek(tdb->fd, 0, SEEK_SET) == -1) - goto fail; - - if (ftruncate(tdb->fd, 0) == -1) - goto fail; - - /* This creates an endian-converted header, as if read from disk */ - CONVERT(*newdb); - memcpy(&tdb->header, newdb, sizeof(tdb->header)); - /* Don't endian-convert the magic food! */ - memcpy(newdb->magic_food, TDB_MAGIC_FOOD, strlen(TDB_MAGIC_FOOD)+1); - if (write(tdb->fd, newdb, size) != size) - ret = -1; - else - ret = tdb_create_rwlocks(tdb->fd, hash_size); - - fail: - SAFE_FREE(newdb); - return ret; -} - -/* Returns 0 on fail. On success, return offset of record, and fills - in rec */ -static tdb_off tdb_find(TDB_CONTEXT *tdb, TDB_DATA key, u32 hash, - struct list_struct *r) -{ - tdb_off rec_ptr; - int maxloop; - - /* read in the hash top */ - if (ofs_read(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) - return 0; - - /* keep looking until we find the right record */ - maxloop = LOOP_MAX; - while (rec_ptr) { - if (rec_read(tdb, rec_ptr, r) == -1) - return 0; - - if (!TDB_DEAD(r) && hash==r->full_hash && key.dsize==r->key_len) { - char *k; - /* a very likely hit - read the key */ - k = tdb_alloc_read(tdb, rec_ptr + sizeof(*r), - r->key_len); - if (!k) - return 0; - - if (memcmp(key.dptr, k, key.dsize) == 0) { - SAFE_FREE(k); - return rec_ptr; - } - SAFE_FREE(k); - } - rec_ptr = r->next; - - maxloop--; - if (maxloop == 0) { - TDB_LOG((tdb, 0, "tdb_find maxloop reached; corrupt database!\n")); - return TDB_ERRCODE(TDB_ERR_CORRUPT, 0); - } - } - return TDB_ERRCODE(TDB_ERR_NOEXIST, 0); -} - -/* If they do lockkeys, check that this hash is one they locked */ -static int tdb_keylocked(TDB_CONTEXT *tdb, u32 hash) -{ - u32 i; - if (!tdb->lockedkeys) - return 1; - for (i = 0; i < tdb->lockedkeys[0]; i++) - if (tdb->lockedkeys[i+1] == hash) - return 1; - return TDB_ERRCODE(TDB_ERR_NOLOCK, 0); -} - -/* As tdb_find, but if you succeed, keep the lock */ -static tdb_off tdb_find_lock(TDB_CONTEXT *tdb, TDB_DATA key, int locktype, - struct list_struct *rec) -{ - u32 hash, rec_ptr; - - hash = tdb_hash(&key); - if (!tdb_keylocked(tdb, hash)) - return 0; - if (tdb_lock(tdb, BUCKET(hash), locktype) == -1) - return 0; - if (!(rec_ptr = tdb_find(tdb, key, hash, rec))) - tdb_unlock(tdb, BUCKET(hash), locktype); - return rec_ptr; -} - -enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb) -{ - return tdb->ecode; -} - -static struct tdb_errname { - enum TDB_ERROR ecode; const char *estring; -} emap[] = { {TDB_SUCCESS, "Success"}, - {TDB_ERR_CORRUPT, "Corrupt database"}, - {TDB_ERR_IO, "IO Error"}, - {TDB_ERR_LOCK, "Locking error"}, - {TDB_ERR_OOM, "Out of memory"}, - {TDB_ERR_EXISTS, "Record exists"}, - {TDB_ERR_NOLOCK, "Lock exists on other keys"}, - {TDB_ERR_NOEXIST, "Record does not exist"} }; - -/* Error string for the last tdb error */ -const char *tdb_errorstr(TDB_CONTEXT *tdb) -{ - u32 i; - for (i = 0; i < sizeof(emap) / sizeof(struct tdb_errname); i++) - if (tdb->ecode == emap[i].ecode) - return emap[i].estring; - return "Invalid error code"; -} - -/* update an entry in place - this only works if the new data size - is <= the old data size and the key exists. - on failure return -1. -*/ - -static int tdb_update(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf) -{ - struct list_struct rec; - tdb_off rec_ptr; - - /* find entry */ - if (!(rec_ptr = tdb_find(tdb, key, tdb_hash(&key), &rec))) - return -1; - - /* must be long enough key, data and tailer */ - if (rec.rec_len < key.dsize + dbuf.dsize + sizeof(tdb_off)) { - tdb->ecode = TDB_SUCCESS; /* Not really an error */ - return -1; - } - - if (tdb_write(tdb, rec_ptr + sizeof(rec) + rec.key_len, - dbuf.dptr, dbuf.dsize) == -1) - return -1; - - if (dbuf.dsize != rec.data_len) { - /* update size */ - rec.data_len = dbuf.dsize; - return rec_write(tdb, rec_ptr, &rec); - } - - return 0; -} - -/* find an entry in the database given a key */ -/* If an entry doesn't exist tdb_err will be set to - * TDB_ERR_NOEXIST. If a key has no data attached - * tdb_err will not be set. Both will return a - * zero pptr and zero dsize. - */ - -TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key) -{ - tdb_off rec_ptr; - struct list_struct rec; - TDB_DATA ret; - - /* find which hash bucket it is in */ - if (!(rec_ptr = tdb_find_lock(tdb,key,F_RDLCK,&rec))) - return tdb_null; - - if (rec.data_len) - ret.dptr = tdb_alloc_read(tdb, rec_ptr + sizeof(rec) + rec.key_len, - rec.data_len); - else - ret.dptr = NULL; - ret.dsize = rec.data_len; - tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK); - return ret; -} - -/* check if an entry in the database exists - - note that 1 is returned if the key is found and 0 is returned if not found - this doesn't match the conventions in the rest of this module, but is - compatible with gdbm -*/ -int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key) -{ - struct list_struct rec; - - if (tdb_find_lock(tdb, key, F_RDLCK, &rec) == 0) - return 0; - tdb_unlock(tdb, BUCKET(rec.full_hash), F_RDLCK); - return 1; -} - -/* record lock stops delete underneath */ -static int lock_record(TDB_CONTEXT *tdb, tdb_off off) -{ - return off ? tdb_brlock(tdb, off, F_RDLCK, F_SETLKW, 0) : 0; -} -/* - Write locks override our own fcntl readlocks, so check it here. - Note this is meant to be F_SETLK, *not* F_SETLKW, as it's not - an error to fail to get the lock here. -*/ - -static int write_lock_record(TDB_CONTEXT *tdb, tdb_off off) -{ - struct tdb_traverse_lock *i; - for (i = &tdb->travlocks; i; i = i->next) - if (i->off == off) - return -1; - return tdb_brlock(tdb, off, F_WRLCK, F_SETLK, 1); -} - -/* - Note this is meant to be F_SETLK, *not* F_SETLKW, as it's not - an error to fail to get the lock here. -*/ - -static int write_unlock_record(TDB_CONTEXT *tdb, tdb_off off) -{ - return tdb_brlock(tdb, off, F_UNLCK, F_SETLK, 0); -} -/* fcntl locks don't stack: avoid unlocking someone else's */ -static int unlock_record(TDB_CONTEXT *tdb, tdb_off off) -{ - struct tdb_traverse_lock *i; - u32 count = 0; - - if (off == 0) - return 0; - for (i = &tdb->travlocks; i; i = i->next) - if (i->off == off) - count++; - return (count == 1 ? tdb_brlock(tdb, off, F_UNLCK, F_SETLKW, 0) : 0); -} - -/* actually delete an entry in the database given the offset */ -static int do_delete(TDB_CONTEXT *tdb, tdb_off rec_ptr, struct list_struct*rec) -{ - tdb_off last_ptr, i; - struct list_struct lastrec; - int maxloop; - - if (tdb->read_only) return -1; - - if (write_lock_record(tdb, rec_ptr) == -1) { - /* Someone traversing here: mark it as dead */ - rec->magic = TDB_DEAD_MAGIC; - return rec_write(tdb, rec_ptr, rec); - } - if (write_unlock_record(tdb, rec_ptr) != 0) - return -1; - - /* find previous record in hash chain */ - if (ofs_read(tdb, TDB_HASH_TOP(rec->full_hash), &i) == -1) - return -1; - - maxloop = LOOP_MAX; - for (last_ptr = 0; i != rec_ptr; last_ptr = i, i = lastrec.next) { - if (rec_read(tdb, i, &lastrec) == -1) - return -1; - - maxloop--; - if (maxloop == 0) { - TDB_LOG((tdb, 0, "(tdb)do_delete: maxloop reached; corrupt database!\n")); - return TDB_ERRCODE(TDB_ERR_CORRUPT, -1); - } - } - - /* unlink it: next ptr is at start of record. */ - if (last_ptr == 0) - last_ptr = TDB_HASH_TOP(rec->full_hash); - if (ofs_write(tdb, last_ptr, &rec->next) == -1) - return -1; - - /* recover the space */ - if (tdb_free(tdb, rec_ptr, rec) == -1) - return -1; - return 0; -} - -/* Uses traverse lock: 0 = finish, -1 = error, other = record offset */ -static int tdb_next_lock(TDB_CONTEXT *tdb, struct tdb_traverse_lock *tlock, - struct list_struct *rec) -{ - int want_next = (tlock->off != 0); - - /* No traversal allows if you've called tdb_lockkeys() */ - if (tdb->lockedkeys) - return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); - - /* Lock each chain from the start one. */ - for (; tlock->hash < tdb->header.hash_size; tlock->hash++) { - if (tdb_lock(tdb, tlock->hash, F_WRLCK) == -1) - return -1; - - /* No previous record? Start at top of chain. */ - if (!tlock->off) { - if (ofs_read(tdb, TDB_HASH_TOP(tlock->hash), - &tlock->off) == -1) - goto fail; - } else { - /* Otherwise unlock the previous record. */ - if (unlock_record(tdb, tlock->off) != 0) - goto fail; - } - - if (want_next) { - /* We have offset of old record: grab next */ - if (rec_read(tdb, tlock->off, rec) == -1) - goto fail; - tlock->off = rec->next; - } - - /* Iterate through chain */ - while( tlock->off) { - tdb_off current; - if (rec_read(tdb, tlock->off, rec) == -1) - goto fail; - if (!TDB_DEAD(rec)) { - /* Woohoo: we found one! */ - if (lock_record(tdb, tlock->off) != 0) - goto fail; - return tlock->off; - } - /* Try to clean dead ones from old traverses */ - current = tlock->off; - tlock->off = rec->next; - if (!tdb->read_only && - do_delete(tdb, current, rec) != 0) - goto fail; - } - tdb_unlock(tdb, tlock->hash, F_WRLCK); - want_next = 0; - } - /* We finished iteration without finding anything */ - return TDB_ERRCODE(TDB_SUCCESS, 0); - - fail: - tlock->off = 0; - if (tdb_unlock(tdb, tlock->hash, F_WRLCK) != 0) - TDB_LOG((tdb, 0, "tdb_next_lock: On error unlock failed!\n")); - return -1; -} - -/* traverse the entire database - calling fn(tdb, key, data) on each element. - return -1 on error or the record count traversed - if fn is NULL then it is not called - a non-zero return value from fn() indicates that the traversal should stop - */ -int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *state) -{ - TDB_DATA key, dbuf; - struct list_struct rec; - struct tdb_traverse_lock tl = { NULL, 0, 0 }; - int ret, count = 0; - - /* This was in the initializaton, above, but the IRIX compiler - * did not like it. crh - */ - tl.next = tdb->travlocks.next; - - /* fcntl locks don't stack: beware traverse inside traverse */ - tdb->travlocks.next = &tl; - - /* tdb_next_lock places locks on the record returned, and its chain */ - while ((ret = tdb_next_lock(tdb, &tl, &rec)) > 0) { - count++; - /* now read the full record */ - key.dptr = tdb_alloc_read(tdb, tl.off + sizeof(rec), - rec.key_len + rec.data_len); - if (!key.dptr) { - ret = -1; - if (tdb_unlock(tdb, tl.hash, F_WRLCK) != 0) - goto out; - if (unlock_record(tdb, tl.off) != 0) - TDB_LOG((tdb, 0, "tdb_traverse: key.dptr == NULL and unlock_record failed!\n")); - goto out; - } - key.dsize = rec.key_len; - dbuf.dptr = key.dptr + rec.key_len; - dbuf.dsize = rec.data_len; - - /* Drop chain lock, call out */ - if (tdb_unlock(tdb, tl.hash, F_WRLCK) != 0) { - ret = -1; - goto out; - } - if (fn && fn(tdb, key, dbuf, state)) { - /* They want us to terminate traversal */ - ret = count; - if (unlock_record(tdb, tl.off) != 0) { - TDB_LOG((tdb, 0, "tdb_traverse: unlock_record failed!\n"));; - ret = -1; - } - tdb->travlocks.next = tl.next; - SAFE_FREE(key.dptr); - return count; - } - SAFE_FREE(key.dptr); - } -out: - tdb->travlocks.next = tl.next; - if (ret < 0) - return -1; - else - return count; -} - -/* find the first entry in the database and return its key */ -TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb) -{ - TDB_DATA key; - struct list_struct rec; - - /* release any old lock */ - if (unlock_record(tdb, tdb->travlocks.off) != 0) - return tdb_null; - tdb->travlocks.off = tdb->travlocks.hash = 0; - - if (tdb_next_lock(tdb, &tdb->travlocks, &rec) <= 0) - return tdb_null; - /* now read the key */ - key.dsize = rec.key_len; - key.dptr =tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec),key.dsize); - if (tdb_unlock(tdb, BUCKET(tdb->travlocks.hash), F_WRLCK) != 0) - TDB_LOG((tdb, 0, "tdb_firstkey: error occurred while tdb_unlocking!\n")); - return key; -} - -/* find the next entry in the database, returning its key */ -TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA oldkey) -{ - u32 oldhash; - TDB_DATA key = tdb_null; - struct list_struct rec; - char *k = NULL; - - /* Is locked key the old key? If so, traverse will be reliable. */ - if (tdb->travlocks.off) { - if (tdb_lock(tdb,tdb->travlocks.hash,F_WRLCK)) - return tdb_null; - if (rec_read(tdb, tdb->travlocks.off, &rec) == -1 - || !(k = tdb_alloc_read(tdb,tdb->travlocks.off+sizeof(rec), - rec.key_len)) - || memcmp(k, oldkey.dptr, oldkey.dsize) != 0) { - /* No, it wasn't: unlock it and start from scratch */ - if (unlock_record(tdb, tdb->travlocks.off) != 0) - return tdb_null; - if (tdb_unlock(tdb, tdb->travlocks.hash, F_WRLCK) != 0) - return tdb_null; - tdb->travlocks.off = 0; - } - - SAFE_FREE(k); - } - - if (!tdb->travlocks.off) { - /* No previous element: do normal find, and lock record */ - tdb->travlocks.off = tdb_find_lock(tdb, oldkey, F_WRLCK, &rec); - if (!tdb->travlocks.off) - return tdb_null; - tdb->travlocks.hash = BUCKET(rec.full_hash); - if (lock_record(tdb, tdb->travlocks.off) != 0) { - TDB_LOG((tdb, 0, "tdb_nextkey: lock_record failed (%s)!\n", strerror(errno))); - return tdb_null; - } - } - oldhash = tdb->travlocks.hash; - - /* Grab next record: locks chain and returned record, - unlocks old record */ - if (tdb_next_lock(tdb, &tdb->travlocks, &rec) > 0) { - key.dsize = rec.key_len; - key.dptr = tdb_alloc_read(tdb, tdb->travlocks.off+sizeof(rec), - key.dsize); - /* Unlock the chain of this new record */ - if (tdb_unlock(tdb, tdb->travlocks.hash, F_WRLCK) != 0) - TDB_LOG((tdb, 0, "tdb_nextkey: WARNING tdb_unlock failed!\n")); - } - /* Unlock the chain of old record */ - if (tdb_unlock(tdb, BUCKET(oldhash), F_WRLCK) != 0) - TDB_LOG((tdb, 0, "tdb_nextkey: WARNING tdb_unlock failed!\n")); - return key; -} - -/* delete an entry in the database given a key */ -int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key) -{ - tdb_off rec_ptr; - struct list_struct rec; - int ret; - - if (!(rec_ptr = tdb_find_lock(tdb, key, F_WRLCK, &rec))) - return -1; - ret = do_delete(tdb, rec_ptr, &rec); - if (tdb_unlock(tdb, BUCKET(rec.full_hash), F_WRLCK) != 0) - TDB_LOG((tdb, 0, "tdb_delete: WARNING tdb_unlock failed!\n")); - return ret; -} - -/* store an element in the database, replacing any existing element - with the same key - - return 0 on success, -1 on failure -*/ -int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag) -{ - struct list_struct rec; - u32 hash; - tdb_off rec_ptr; - char *p = NULL; - int ret = 0; - - /* find which hash bucket it is in */ - hash = tdb_hash(&key); - if (!tdb_keylocked(tdb, hash)) - return -1; - if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1) - return -1; - - /* check for it existing, on insert. */ - if (flag == TDB_INSERT) { - if (tdb_exists(tdb, key)) { - tdb->ecode = TDB_ERR_EXISTS; - goto fail; - } - } else { - /* first try in-place update, on modify or replace. */ - if (tdb_update(tdb, key, dbuf) == 0) - goto out; - if (flag == TDB_MODIFY && tdb->ecode == TDB_ERR_NOEXIST) - goto fail; - } - /* reset the error code potentially set by the tdb_update() */ - tdb->ecode = TDB_SUCCESS; - - /* delete any existing record - if it doesn't exist we don't - care. Doing this first reduces fragmentation, and avoids - coalescing with `allocated' block before it's updated. */ - if (flag != TDB_INSERT) - tdb_delete(tdb, key); - - /* Copy key+value *before* allocating free space in case malloc - fails and we are left with a dead spot in the tdb. */ - - if (!(p = (char *)malloc(key.dsize + dbuf.dsize))) { - tdb->ecode = TDB_ERR_OOM; - goto fail; - } - - memcpy(p, key.dptr, key.dsize); - if (dbuf.dsize) - memcpy(p+key.dsize, dbuf.dptr, dbuf.dsize); - - /* now we're into insert / modify / replace of a record which - * we know could not be optimised by an in-place store (for - * various reasons). */ - if (!(rec_ptr = tdb_allocate(tdb, key.dsize + dbuf.dsize, &rec))) - goto fail; - - /* Read hash top into next ptr */ - if (ofs_read(tdb, TDB_HASH_TOP(hash), &rec.next) == -1) - goto fail; - - rec.key_len = key.dsize; - rec.data_len = dbuf.dsize; - rec.full_hash = hash; - rec.magic = TDB_MAGIC; - - /* write out and point the top of the hash chain at it */ - if (rec_write(tdb, rec_ptr, &rec) == -1 - || tdb_write(tdb, rec_ptr+sizeof(rec), p, key.dsize+dbuf.dsize)==-1 - || ofs_write(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) { - /* Need to tdb_unallocate() here */ - goto fail; - } - out: - SAFE_FREE(p); - tdb_unlock(tdb, BUCKET(hash), F_WRLCK); - return ret; -fail: - ret = -1; - goto out; -} - -/* Attempt to append data to an entry in place - this only works if the new data size - is <= the old data size and the key exists. - on failure return -1. Record must be locked before calling. -*/ -static int tdb_append_inplace(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf) -{ - struct list_struct rec; - tdb_off rec_ptr; - - /* find entry */ - if (!(rec_ptr = tdb_find(tdb, key, tdb_hash(&key), &rec))) - return -1; - - /* Append of 0 is always ok. */ - if (new_dbuf.dsize == 0) - return 0; - - /* must be long enough for key, old data + new data and tailer */ - if (rec.rec_len < key.dsize + rec.data_len + new_dbuf.dsize + sizeof(tdb_off)) { - /* No room. */ - tdb->ecode = TDB_SUCCESS; /* Not really an error */ - return -1; - } - - if (tdb_write(tdb, rec_ptr + sizeof(rec) + rec.key_len + rec.data_len, - new_dbuf.dptr, new_dbuf.dsize) == -1) - return -1; - - /* update size */ - rec.data_len += new_dbuf.dsize; - return rec_write(tdb, rec_ptr, &rec); -} - -/* Append to an entry. Create if not exist. */ - -int tdb_append(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf) -{ - struct list_struct rec; - u32 hash; - tdb_off rec_ptr; - char *p = NULL; - int ret = 0; - size_t new_data_size = 0; - - /* find which hash bucket it is in */ - hash = tdb_hash(&key); - if (!tdb_keylocked(tdb, hash)) - return -1; - if (tdb_lock(tdb, BUCKET(hash), F_WRLCK) == -1) - return -1; - - /* first try in-place. */ - if (tdb_append_inplace(tdb, key, new_dbuf) == 0) - goto out; - - /* reset the error code potentially set by the tdb_append_inplace() */ - tdb->ecode = TDB_SUCCESS; - - /* find entry */ - if (!(rec_ptr = tdb_find(tdb, key, hash, &rec))) { - if (tdb->ecode != TDB_ERR_NOEXIST) - goto fail; - - /* Not found - create. */ - - ret = tdb_store(tdb, key, new_dbuf, TDB_INSERT); - goto out; - } - - new_data_size = rec.data_len + new_dbuf.dsize; - - /* Copy key+old_value+value *before* allocating free space in case malloc - fails and we are left with a dead spot in the tdb. */ - - if (!(p = (char *)malloc(key.dsize + new_data_size))) { - tdb->ecode = TDB_ERR_OOM; - goto fail; - } - - /* Copy the key in place. */ - memcpy(p, key.dptr, key.dsize); - - /* Now read the old data into place. */ - if (rec.data_len && - tdb_read(tdb, rec_ptr + sizeof(rec) + rec.key_len, p + key.dsize, rec.data_len, 0) == -1) - goto fail; - - /* Finally append the new data. */ - if (new_dbuf.dsize) - memcpy(p+key.dsize+rec.data_len, new_dbuf.dptr, new_dbuf.dsize); - - /* delete any existing record - if it doesn't exist we don't - care. Doing this first reduces fragmentation, and avoids - coalescing with `allocated' block before it's updated. */ - - tdb_delete(tdb, key); - - if (!(rec_ptr = tdb_allocate(tdb, key.dsize + new_data_size, &rec))) - goto fail; - - /* Read hash top into next ptr */ - if (ofs_read(tdb, TDB_HASH_TOP(hash), &rec.next) == -1) - goto fail; - - rec.key_len = key.dsize; - rec.data_len = new_data_size; - rec.full_hash = hash; - rec.magic = TDB_MAGIC; - - /* write out and point the top of the hash chain at it */ - if (rec_write(tdb, rec_ptr, &rec) == -1 - || tdb_write(tdb, rec_ptr+sizeof(rec), p, key.dsize+new_data_size)==-1 - || ofs_write(tdb, TDB_HASH_TOP(hash), &rec_ptr) == -1) { - /* Need to tdb_unallocate() here */ - goto fail; - } - - out: - SAFE_FREE(p); - tdb_unlock(tdb, BUCKET(hash), F_WRLCK); - return ret; - -fail: - ret = -1; - goto out; -} - -static int tdb_already_open(dev_t device, - ino_t ino) -{ - TDB_CONTEXT *i; - - for (i = tdbs; i; i = i->next) { - if (i->device == device && i->inode == ino) { - return 1; - } - } - - return 0; -} - -/* open the database, creating it if necessary - - The open_flags and mode are passed straight to the open call on the - database file. A flags value of O_WRONLY is invalid. The hash size - is advisory, use zero for a default value. - - Return is NULL on error, in which case errno is also set. Don't - try to call tdb_error or tdb_errname, just do strerror(errno). - - @param name may be NULL for internal databases. */ -TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode) -{ - return tdb_open_ex(name, hash_size, tdb_flags, open_flags, mode, NULL); -} - - -TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode, - tdb_log_func log_fn) -{ - TDB_CONTEXT *tdb; - struct stat st; - int rev = 0, locked; - unsigned char *vp; - u32 vertest; - - if (!(tdb = calloc(1, sizeof *tdb))) { - /* Can't log this */ - errno = ENOMEM; - goto fail; - } - tdb->fd = -1; - tdb->name = NULL; - tdb->map_ptr = NULL; - tdb->lockedkeys = NULL; - tdb->flags = tdb_flags; - tdb->open_flags = open_flags; - tdb->log_fn = log_fn; - - if ((open_flags & O_ACCMODE) == O_WRONLY) { - TDB_LOG((tdb, 0, "tdb_open_ex: can't open tdb %s write-only\n", - name)); - errno = EINVAL; - goto fail; - } - - if (hash_size == 0) - hash_size = DEFAULT_HASH_SIZE; - if ((open_flags & O_ACCMODE) == O_RDONLY) { - tdb->read_only = 1; - /* read only databases don't do locking or clear if first */ - tdb->flags |= TDB_NOLOCK; - tdb->flags &= ~TDB_CLEAR_IF_FIRST; - } - - /* internal databases don't mmap or lock, and start off cleared */ - if (tdb->flags & TDB_INTERNAL) { - tdb->flags |= (TDB_NOLOCK | TDB_NOMMAP); - tdb->flags &= ~TDB_CLEAR_IF_FIRST; - if (tdb_new_database(tdb, hash_size) != 0) { - TDB_LOG((tdb, 0, "tdb_open_ex: tdb_new_database failed!")); - goto fail; - } - goto internal; - } - - if ((tdb->fd = open(name, open_flags, mode)) == -1) { - TDB_LOG((tdb, 5, "tdb_open_ex: could not open file %s: %s\n", - name, strerror(errno))); - goto fail; /* errno set by open(2) */ - } - - /* - Close file when execing another process. - Prevents SELinux access errors. - */ - set_cloexec_flag(tdb->fd, 1); - - /* ensure there is only one process initialising at once */ - if (tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0) == -1) { - TDB_LOG((tdb, 0, "tdb_open_ex: failed to get global lock on %s: %s\n", - name, strerror(errno))); - goto fail; /* errno set by tdb_brlock */ - } - - /* we need to zero database if we are the only one with it open */ - if ((locked = (tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0) == 0)) - && (tdb_flags & TDB_CLEAR_IF_FIRST)) { - open_flags |= O_CREAT; - if (ftruncate(tdb->fd, 0) == -1) { - TDB_LOG((tdb, 0, "tdb_open_ex: " - "failed to truncate %s: %s\n", - name, strerror(errno))); - goto fail; /* errno set by ftruncate */ - } - } - - if (read(tdb->fd, &tdb->header, sizeof(tdb->header)) != sizeof(tdb->header) - || strcmp(tdb->header.magic_food, TDB_MAGIC_FOOD) != 0 - || (tdb->header.version != TDB_VERSION - && !(rev = (tdb->header.version==TDB_BYTEREV(TDB_VERSION))))) { - /* its not a valid database - possibly initialise it */ - if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) { - errno = EIO; /* ie bad format or something */ - goto fail; - } - rev = (tdb->flags & TDB_CONVERT); - } - vp = (unsigned char *)&tdb->header.version; - vertest = (((u32)vp[0]) << 24) | (((u32)vp[1]) << 16) | - (((u32)vp[2]) << 8) | (u32)vp[3]; - tdb->flags |= (vertest==TDB_VERSION) ? TDB_BIGENDIAN : 0; - if (!rev) - tdb->flags &= ~TDB_CONVERT; - else { - tdb->flags |= TDB_CONVERT; - convert(&tdb->header, sizeof(tdb->header)); - } - if (fstat(tdb->fd, &st) == -1) - goto fail; - - /* Is it already in the open list? If so, fail. */ - if (tdb_already_open(st.st_dev, st.st_ino)) { - TDB_LOG((tdb, 2, "tdb_open_ex: " - "%s (%d:%d,%lld) is already open in this process\n", - name, major(st.st_dev), minor(st.st_dev), (unsigned long long)st.st_ino)); - errno = EBUSY; - goto fail; - } - - if (!(tdb->name = (char *)strdup(name))) { - errno = ENOMEM; - goto fail; - } - - tdb->map_size = st.st_size; - tdb->device = st.st_dev; - tdb->inode = st.st_ino; - tdb->locked = calloc(tdb->header.hash_size+1, sizeof(tdb->locked[0])); - if (!tdb->locked) { - TDB_LOG((tdb, 2, "tdb_open_ex: " - "failed to allocate lock structure for %s\n", - name)); - errno = ENOMEM; - goto fail; - } - tdb_mmap(tdb); - if (locked) { - if (!tdb->read_only) - if (tdb_clear_spinlocks(tdb) != 0) { - TDB_LOG((tdb, 0, "tdb_open_ex: " - "failed to clear spinlock\n")); - goto fail; - } - if (tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0) == -1) { - TDB_LOG((tdb, 0, "tdb_open_ex: " - "failed to take ACTIVE_LOCK on %s: %s\n", - name, strerror(errno))); - goto fail; - } - } - /* leave this lock in place to indicate it's in use */ - if (tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1) - goto fail; - - internal: - /* Internal (memory-only) databases skip all the code above to - * do with disk files, and resume here by releasing their - * global lock and hooking into the active list. */ - if (tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0) == -1) - goto fail; - tdb->next = tdbs; - tdbs = tdb; - return tdb; - - fail: - { int save_errno = errno; - - if (!tdb) - return NULL; - - if (tdb->map_ptr) { - if (tdb->flags & TDB_INTERNAL) - SAFE_FREE(tdb->map_ptr); - else - tdb_munmap(tdb); - } - SAFE_FREE(tdb->name); - if (tdb->fd != -1) - if (close(tdb->fd) != 0) - TDB_LOG((tdb, 5, "tdb_open_ex: failed to close tdb->fd on error!\n")); - SAFE_FREE(tdb->locked); - SAFE_FREE(tdb); - errno = save_errno; - return NULL; - } -} - -/** - * Close a database. - * - * @returns -1 for error; 0 for success. - **/ -int tdb_close(TDB_CONTEXT *tdb) -{ - TDB_CONTEXT **i; - int ret = 0; - - if (tdb->map_ptr) { - if (tdb->flags & TDB_INTERNAL) - SAFE_FREE(tdb->map_ptr); - else - tdb_munmap(tdb); - } - SAFE_FREE(tdb->name); - if (tdb->fd != -1) - ret = close(tdb->fd); - SAFE_FREE(tdb->locked); - SAFE_FREE(tdb->lockedkeys); - - /* Remove from contexts list */ - for (i = &tdbs; *i; i = &(*i)->next) { - if (*i == tdb) { - *i = tdb->next; - break; - } - } - - memset(tdb, 0, sizeof(*tdb)); - SAFE_FREE(tdb); - - return ret; -} - -/* lock/unlock entire database */ -int tdb_lockall(TDB_CONTEXT *tdb) -{ - u32 i; - - /* There are no locks on read-only dbs */ - if (tdb->read_only) - return TDB_ERRCODE(TDB_ERR_LOCK, -1); - if (tdb->lockedkeys) - return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); - for (i = 0; i < tdb->header.hash_size; i++) - if (tdb_lock(tdb, i, F_WRLCK)) - break; - - /* If error, release locks we have... */ - if (i < tdb->header.hash_size) { - u32 j; - - for ( j = 0; j < i; j++) - tdb_unlock(tdb, j, F_WRLCK); - return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); - } - - return 0; -} -void tdb_unlockall(TDB_CONTEXT *tdb) -{ - u32 i; - for (i=0; i < tdb->header.hash_size; i++) - tdb_unlock(tdb, i, F_WRLCK); -} - -int tdb_lockkeys(TDB_CONTEXT *tdb, u32 number, TDB_DATA keys[]) -{ - u32 i, j, hash; - - /* Can't lock more keys if already locked */ - if (tdb->lockedkeys) - return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); - if (!(tdb->lockedkeys = malloc(sizeof(u32) * (number+1)))) - return TDB_ERRCODE(TDB_ERR_OOM, -1); - /* First number in array is # keys */ - tdb->lockedkeys[0] = number; - - /* Insertion sort by bucket */ - for (i = 0; i < number; i++) { - hash = tdb_hash(&keys[i]); - for (j = 0; j < i && BUCKET(tdb->lockedkeys[j+1]) < BUCKET(hash); j++); - memmove(&tdb->lockedkeys[j+2], &tdb->lockedkeys[j+1], sizeof(u32) * (i-j)); - tdb->lockedkeys[j+1] = hash; - } - /* Finally, lock in order */ - for (i = 0; i < number; i++) - if (tdb_lock(tdb, i, F_WRLCK)) - break; - - /* If error, release locks we have... */ - if (i < number) { - for ( j = 0; j < i; j++) - tdb_unlock(tdb, j, F_WRLCK); - SAFE_FREE(tdb->lockedkeys); - return TDB_ERRCODE(TDB_ERR_NOLOCK, -1); - } - return 0; -} - -/* Unlock the keys previously locked by tdb_lockkeys() */ -void tdb_unlockkeys(TDB_CONTEXT *tdb) -{ - u32 i; - if (!tdb->lockedkeys) - return; - for (i = 0; i < tdb->lockedkeys[0]; i++) - tdb_unlock(tdb, tdb->lockedkeys[i+1], F_WRLCK); - SAFE_FREE(tdb->lockedkeys); -} - -/* lock/unlock one hash chain. This is meant to be used to reduce - contention - it cannot guarantee how many records will be locked */ -int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key) -{ - return tdb_lock(tdb, BUCKET(tdb_hash(&key)), F_WRLCK); -} - -int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key) -{ - return tdb_unlock(tdb, BUCKET(tdb_hash(&key)), F_WRLCK); -} - -int tdb_chainlock_read(TDB_CONTEXT *tdb, TDB_DATA key) -{ - return tdb_lock(tdb, BUCKET(tdb_hash(&key)), F_RDLCK); -} - -int tdb_chainunlock_read(TDB_CONTEXT *tdb, TDB_DATA key) -{ - return tdb_unlock(tdb, BUCKET(tdb_hash(&key)), F_RDLCK); -} - - -/* register a loging function */ -void tdb_logging_function(TDB_CONTEXT *tdb, void (*fn)(TDB_CONTEXT *, int , const char *, ...)) -{ - tdb->log_fn = fn; -} - - -/* reopen a tdb - this is used after a fork to ensure that we have an independent - seek pointer from our parent and to re-establish locks */ -int tdb_reopen(TDB_CONTEXT *tdb) -{ - struct stat st; - - if (tdb_munmap(tdb) != 0) { - TDB_LOG((tdb, 0, "tdb_reopen: munmap failed (%s)\n", strerror(errno))); - goto fail; - } - if (close(tdb->fd) != 0) - TDB_LOG((tdb, 0, "tdb_reopen: WARNING closing tdb->fd failed!\n")); - tdb->fd = open(tdb->name, tdb->open_flags & ~(O_CREAT|O_TRUNC), 0); - if (tdb->fd == -1) { - TDB_LOG((tdb, 0, "tdb_reopen: open failed (%s)\n", strerror(errno))); - goto fail; - } - if (fstat(tdb->fd, &st) != 0) { - TDB_LOG((tdb, 0, "tdb_reopen: fstat failed (%s)\n", strerror(errno))); - goto fail; - } - if (st.st_ino != tdb->inode || st.st_dev != tdb->device) { - TDB_LOG((tdb, 0, "tdb_reopen: file dev/inode has changed!\n")); - goto fail; - } - tdb_mmap(tdb); - if (tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0) == -1) { - TDB_LOG((tdb, 0, "tdb_reopen: failed to obtain active lock\n")); - goto fail; - } - - return 0; - -fail: - tdb_close(tdb); - return -1; -} - -/* reopen all tdb's */ -int tdb_reopen_all(void) -{ - TDB_CONTEXT *tdb; - - for (tdb=tdbs; tdb; tdb = tdb->next) { - if (tdb_reopen(tdb) != 0) return -1; - } - - return 0; -} diff --git a/tdb/tdb.h b/tdb/tdb.h deleted file mode 100644 index cac172adce..0000000000 --- a/tdb/tdb.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef __TDB_H__ -#define __TDB_H__ - -/* - Unix SMB/CIFS implementation. - Samba database functions - Copyright (C) Andrew Tridgell 1999 - - 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; either version 2 of the License, or - (at your option) any later version. - - 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 02139, USA. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T -#include - -/* flags to tdb_store() */ -#define TDB_REPLACE 1 -#define TDB_INSERT 2 -#define TDB_MODIFY 3 - -/* flags for tdb_open() */ -#define TDB_DEFAULT 0 /* just a readability place holder */ -#define TDB_CLEAR_IF_FIRST 1 -#define TDB_INTERNAL 2 /* don't store on disk */ -#define TDB_NOLOCK 4 /* don't do any locking */ -#define TDB_NOMMAP 8 /* don't use mmap */ -#define TDB_CONVERT 16 /* convert endian (internal use) */ -#define TDB_BIGENDIAN 32 /* header is big-endian (internal use) */ - -#define TDB_ERRCODE(code, ret) ((tdb->ecode = (code)), ret) - -/* error codes */ -enum TDB_ERROR {TDB_SUCCESS=0, TDB_ERR_CORRUPT, TDB_ERR_IO, TDB_ERR_LOCK, - TDB_ERR_OOM, TDB_ERR_EXISTS, TDB_ERR_NOEXIST, TDB_ERR_NOLOCK, TDB_ERR_LOCK_TIMEOUT }; - -#ifndef u32 -#define u32 unsigned -#endif - -typedef struct { - char *dptr; - size_t dsize; -} TDB_DATA; - -typedef u32 tdb_len; -typedef u32 tdb_off; - -/* this is stored at the front of every database */ -struct tdb_header { - char magic_food[32]; /* for /etc/magic */ - u32 version; /* version of the code */ - u32 hash_size; /* number of hash entries */ - tdb_off rwlocks; - tdb_off reserved[31]; -}; - -struct tdb_lock_type { - u32 count; - u32 ltype; -}; - -struct tdb_traverse_lock { - struct tdb_traverse_lock *next; - u32 off; - u32 hash; -}; - -/* this is the context structure that is returned from a db open */ -typedef struct tdb_context { - char *name; /* the name of the database */ - void *map_ptr; /* where it is currently mapped */ - int fd; /* open file descriptor for the database */ - tdb_len map_size; /* how much space has been mapped */ - int read_only; /* opened read-only */ - struct tdb_lock_type *locked; /* array of chain locks */ - enum TDB_ERROR ecode; /* error code for last tdb error */ - struct tdb_header header; /* a cached copy of the header */ - u32 flags; /* the flags passed to tdb_open */ - u32 *lockedkeys; /* array of locked keys: first is #keys */ - struct tdb_traverse_lock travlocks; /* current traversal locks */ - struct tdb_context *next; /* all tdbs to avoid multiple opens */ - dev_t device; /* uniquely identifies this tdb */ - ino_t inode; /* uniquely identifies this tdb */ - void (*log_fn)(struct tdb_context *tdb, int level, const char *, ...); /* logging function */ - int open_flags; /* flags used in the open - needed by reopen */ -} TDB_CONTEXT; - -typedef int (*tdb_traverse_func)(TDB_CONTEXT *, TDB_DATA, TDB_DATA, void *); -typedef void (*tdb_log_func)(TDB_CONTEXT *, int , const char *, ...); - -TDB_CONTEXT *tdb_open(const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode); -TDB_CONTEXT *tdb_open_ex(const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode, - tdb_log_func log_fn); - -int tdb_reopen(TDB_CONTEXT *tdb); -int tdb_reopen_all(void); -void tdb_logging_function(TDB_CONTEXT *tdb, tdb_log_func); -enum TDB_ERROR tdb_error(TDB_CONTEXT *tdb); -const char *tdb_errorstr(TDB_CONTEXT *tdb); -TDB_DATA tdb_fetch(TDB_CONTEXT *tdb, TDB_DATA key); -int tdb_delete(TDB_CONTEXT *tdb, TDB_DATA key); -int tdb_store(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, int flag); -int tdb_append(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA new_dbuf); -int tdb_close(TDB_CONTEXT *tdb); -TDB_DATA tdb_firstkey(TDB_CONTEXT *tdb); -TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key); -int tdb_traverse(TDB_CONTEXT *tdb, tdb_traverse_func fn, void *state); -int tdb_exists(TDB_CONTEXT *tdb, TDB_DATA key); -int tdb_lockkeys(TDB_CONTEXT *tdb, u32 number, TDB_DATA keys[]); -void tdb_unlockkeys(TDB_CONTEXT *tdb); -int tdb_lockall(TDB_CONTEXT *tdb); -void tdb_unlockall(TDB_CONTEXT *tdb); - -/* Low level locking functions: use with care */ -void tdb_set_lock_alarm(sig_atomic_t *palarm); -int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key); -int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key); - -/* Debug functions. Not used in production. */ -void tdb_dump_all(TDB_CONTEXT *tdb); -int tdb_printfreelist(TDB_CONTEXT *tdb); - -/* used only in tdbutil.c */ -int tdb_chainlock_read(TDB_CONTEXT *tdb, TDB_DATA key); -int tdb_chainunlock_read(TDB_CONTEXT *tdb, TDB_DATA key); - -extern TDB_DATA tdb_null; - -#ifdef __cplusplus -} -#endif - -#endif /* tdb.h */ diff --git a/tdb/tdb.magic b/tdb/tdb.magic deleted file mode 100644 index f5619e7327..0000000000 --- a/tdb/tdb.magic +++ /dev/null @@ -1,10 +0,0 @@ -# Magic file(1) information about tdb files. -# -# Install this into /etc/magic or the corresponding location for your -# system, or pass as a -m argument to file(1). - -# You may use and redistribute this file without restriction. - -0 string TDB\ file TDB database ->32 lelong =0x2601196D version 6, little-endian ->>36 lelong x hash size %d bytes diff --git a/tdb/tdbback.c b/tdb/tdbback.c deleted file mode 100644 index 744cface55..0000000000 --- a/tdb/tdbback.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - Unix SMB/CIFS implementation. - low level tdb backup and restore utility - Copyright (C) Andrew Tridgell 2002 - - 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; either version 2 of the License, or - (at your option) any later version. - - 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 02139, USA. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tdb.h" - -static int failed; - -char *add_suffix(const char *name, const char *suffix) -{ - char *ret; - int len = strlen(name) + strlen(suffix) + 1; - ret = malloc(len); - if (!ret) { - fprintf(stderr,"Out of memory!\n"); - exit(1); - } - strncpy(ret, name, len); - strncat(ret, suffix, len); - return ret; -} - -static int copy_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) -{ - TDB_CONTEXT *tdb_new = (TDB_CONTEXT *)state; - - if (tdb_store(tdb_new, key, dbuf, TDB_INSERT) != 0) { - fprintf(stderr,"Failed to insert into %s\n", tdb_new->name); - failed = 1; - return 1; - } - return 0; -} - - -static int test_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) -{ - return 0; -} - -/* - carefully backup a tdb, validating the contents and - only doing the backup if its OK - this function is also used for restore -*/ -int backup_tdb(const char *old_name, const char *new_name) -{ - TDB_CONTEXT *tdb; - TDB_CONTEXT *tdb_new; - char *tmp_name; - struct stat st; - int count1, count2; - - tmp_name = add_suffix(new_name, ".tmp"); - - /* stat the old tdb to find its permissions */ - if (stat(old_name, &st) != 0) { - perror(old_name); - return 1; - } - - /* open the old tdb */ - tdb = tdb_open(old_name, 0, 0, O_RDWR, 0); - if (!tdb) { - printf("Failed to open %s\n", old_name); - return 1; - } - - /* create the new tdb */ - unlink(tmp_name); - tdb_new = tdb_open(tmp_name, tdb->header.hash_size, - TDB_DEFAULT, O_RDWR|O_CREAT|O_EXCL, - st.st_mode & 0777); - if (!tdb_new) { - perror(tmp_name); - free(tmp_name); - return 1; - } - - /* lock the old tdb */ - if (tdb_lockall(tdb) != 0) { - fprintf(stderr,"Failed to lock %s\n", old_name); - tdb_close(tdb); - tdb_close(tdb_new); - unlink(tmp_name); - free(tmp_name); - return 1; - } - - failed = 0; - - /* traverse and copy */ - count1 = tdb_traverse(tdb, copy_fn, (void *)tdb_new); - if (count1 < 0 || failed) { - fprintf(stderr,"failed to copy %s\n", old_name); - tdb_close(tdb); - tdb_close(tdb_new); - unlink(tmp_name); - free(tmp_name); - return 1; - } - - /* close the old tdb */ - tdb_close(tdb); - - /* close the new tdb and re-open read-only */ - tdb_close(tdb_new); - tdb_new = tdb_open(tmp_name, 0, TDB_DEFAULT, O_RDONLY, 0); - if (!tdb_new) { - fprintf(stderr,"failed to reopen %s\n", tmp_name); - unlink(tmp_name); - perror(tmp_name); - free(tmp_name); - return 1; - } - - /* traverse the new tdb to confirm */ - count2 = tdb_traverse(tdb_new, test_fn, 0); - if (count2 != count1) { - fprintf(stderr,"failed to copy %s\n", old_name); - tdb_close(tdb_new); - unlink(tmp_name); - free(tmp_name); - return 1; - } - - /* make sure the new tdb has reached stable storage */ - fsync(tdb_new->fd); - - /* close the new tdb and rename it to .bak */ - tdb_close(tdb_new); - unlink(new_name); - if (rename(tmp_name, new_name) != 0) { - perror(new_name); - free(tmp_name); - return 1; - } - - free(tmp_name); - - return 0; -} - - - -/* - verify a tdb and if it is corrupt then restore from *.bak -*/ -int verify_tdb(const char *fname, const char *bak_name) -{ - TDB_CONTEXT *tdb; - int count = -1; - - /* open the tdb */ - tdb = tdb_open(fname, 0, 0, O_RDONLY, 0); - - /* traverse the tdb, then close it */ - if (tdb) { - count = tdb_traverse(tdb, test_fn, NULL); - tdb_close(tdb); - } - - /* count is < 0 means an error */ - if (count < 0) { - printf("restoring %s\n", fname); - return backup_tdb(bak_name, fname); - } - - printf("%s : %d records\n", fname, count); - - return 0; -} diff --git a/tdb/tdbback.h b/tdb/tdbback.h deleted file mode 100644 index 7ebeaa494d..0000000000 --- a/tdb/tdbback.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - Unix SMB/CIFS implementation. - low level tdb backup and restore utility - Copyright (C) Andrew Tridgell 2002 - - 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; either version 2 of the License, or - (at your option) any later version. - - 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 02139, USA. -*/ - -char *add_suffix(const char *name, const char *suffix); -int backup_tdb(const char *old_name, const char *new_name); -int verify_tdb(const char *fname, const char *bak_name); diff --git a/tdb/tdbbackup.c b/tdb/tdbbackup.c deleted file mode 100644 index 0eaf6b6c0b..0000000000 --- a/tdb/tdbbackup.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - Unix SMB/CIFS implementation. - low level tdb backup and restore utility - Copyright (C) Andrew Tridgell 2002 - - 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; either version 2 of the License, or - (at your option) any later version. - - 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 02139, USA. -*/ - -/* - - This program is meant for backup/restore of tdb databases. Typical usage would be: - tdbbackup *.tdb - when Samba shuts down cleanly, which will make a backup of all the local databases - to *.bak files. Then on Samba startup you would use: - tdbbackup -v *.tdb - and this will check the databases for corruption and if corruption is detected then - the backup will be restored. - - You may also like to do a backup on a regular basis while Samba is - running, perhaps using cron. - - The reason this program is needed is to cope with power failures - while Samba is running. A power failure could lead to database - corruption and Samba will then not start correctly. - - Note that many of the databases in Samba are transient and thus - don't need to be backed up, so you can optimise the above a little - by only running the backup on the critical databases. - - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tdb.h" -#include "tdbback.h" - -/* - see if one file is newer than another -*/ -static int file_newer(const char *fname1, const char *fname2) -{ - struct stat st1, st2; - if (stat(fname1, &st1) != 0) { - return 0; - } - if (stat(fname2, &st2) != 0) { - return 1; - } - return (st1.st_mtime > st2.st_mtime); -} - -static void usage(void) -{ - printf("Usage: tdbbackup [options] \n\n"); - printf(" -h this help message\n"); - printf(" -s suffix set the backup suffix\n"); - printf(" -v verify mode (restore if corrupt)\n"); -} - - - int main(int argc, char *argv[]) -{ - int i; - int ret = 0; - int c; - int verify = 0; - const char *suffix = ".bak"; - extern int optind; - extern char *optarg; - - while ((c = getopt(argc, argv, "vhs:")) != -1) { - switch (c) { - case 'h': - usage(); - exit(0); - case 'v': - verify = 1; - break; - case 's': - suffix = optarg; - break; - } - } - - argc -= optind; - argv += optind; - - if (argc < 1) { - usage(); - exit(1); - } - - for (i=0; i -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "tdb.h" - -static void print_data(TDB_DATA d) -{ - unsigned char *p = d.dptr; - int len = d.dsize; - while (len--) { - if (isprint(*p) && !strchr("\"\\", *p)) { - fputc(*p, stdout); - } else { - printf("\\%02X", *p); - } - p++; - } -} - -static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) -{ - printf("{\n"); - printf("key = \""); - print_data(key); - printf("\"\n"); - printf("data = \""); - print_data(dbuf); - printf("\"\n"); - printf("}\n"); - return 0; -} - -static int dump_tdb(const char *fname) -{ - TDB_CONTEXT *tdb; - - tdb = tdb_open(fname, 0, 0, O_RDONLY, 0); - if (!tdb) { - printf("Failed to open %s\n", fname); - return 1; - } - - tdb_traverse(tdb, traverse_fn, NULL); - return 0; -} - - int main(int argc, char *argv[]) -{ - char *fname; - - if (argc < 2) { - printf("Usage: tdbdump \n"); - exit(1); - } - - fname = argv[1]; - - return dump_tdb(fname); -} diff --git a/tdb/tdbutil.c b/tdb/tdbutil.c deleted file mode 100644 index b01dacd0f5..0000000000 --- a/tdb/tdbutil.c +++ /dev/null @@ -1,830 +0,0 @@ -/* - Unix SMB/CIFS implementation. - tdb utility functions - Copyright (C) Andrew Tridgell 1992-1998 - - 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; either version 2 of the License, or - (at your option) any later version. - - 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 02139, USA. -*/ - -#include "includes.h" -#include - -/* these are little tdb utility functions that are meant to make - dealing with a tdb database a little less cumbersome in Samba */ - -static SIG_ATOMIC_T gotalarm; - -/*************************************************************** - Signal function to tell us we timed out. -****************************************************************/ - -static void gotalarm_sig(void) -{ - gotalarm = 1; -} - -/*************************************************************** - Make a TDB_DATA and keep the const warning in one place -****************************************************************/ - -static TDB_DATA make_tdb_data(const char *dptr, size_t dsize) -{ - TDB_DATA ret; - ret.dptr = dptr; - ret.dsize = dsize; - return ret; -} - -/**************************************************************************** - Lock a chain with timeout (in seconds). -****************************************************************************/ - -static int tdb_chainlock_with_timeout_internal( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout, int rw_type) -{ - /* Allow tdb_chainlock to be interrupted by an alarm. */ - int ret; - gotalarm = 0; - tdb_set_lock_alarm(&gotalarm); - - if (timeout) { - CatchSignal(SIGALRM, SIGNAL_CAST gotalarm_sig); - alarm(timeout); - } - - if (rw_type == F_RDLCK) - ret = tdb_chainlock_read(tdb, key); - else - ret = tdb_chainlock(tdb, key); - - if (timeout) { - alarm(0); - CatchSignal(SIGALRM, SIGNAL_CAST SIG_IGN); - if (gotalarm) { - DEBUG(0,("tdb_chainlock_with_timeout_internal: alarm (%u) timed out for key %s in tdb %s\n", - timeout, key.dptr, tdb->name )); - /* TODO: If we time out waiting for a lock, it might - * be nice to use F_GETLK to get the pid of the - * process currently holding the lock and print that - * as part of the debugging message. -- mbp */ - return -1; - } - } - - return ret; -} - -/**************************************************************************** - Write lock a chain. Return -1 if timeout or lock failed. -****************************************************************************/ - -int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout) -{ - return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_WRLCK); -} - -/**************************************************************************** - Lock a chain by string. Return -1 if timeout or lock failed. -****************************************************************************/ - -int tdb_lock_bystring(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) -{ - TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); - - return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_WRLCK); -} - -/**************************************************************************** - Unlock a chain by string. -****************************************************************************/ - -void tdb_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval) -{ - TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); - - tdb_chainunlock(tdb, key); -} - -/**************************************************************************** - Read lock a chain by string. Return -1 if timeout or lock failed. -****************************************************************************/ - -int tdb_read_lock_bystring(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) -{ - TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); - - return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_RDLCK); -} - -/**************************************************************************** - Read unlock a chain by string. -****************************************************************************/ - -void tdb_read_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval) -{ - TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); - - tdb_chainunlock_read(tdb, key); -} - - -/**************************************************************************** - Fetch a int32 value by a arbitrary blob key, return -1 if not found. - Output is int32 in native byte order. -****************************************************************************/ - -int32 tdb_fetch_int32_byblob(TDB_CONTEXT *tdb, const char *keyval, size_t len) -{ - TDB_DATA key = make_tdb_data(keyval, len); - TDB_DATA data; - int32 ret; - - data = tdb_fetch(tdb, key); - if (!data.dptr || data.dsize != sizeof(int32)) { - SAFE_FREE(data.dptr); - return -1; - } - - ret = IVAL(data.dptr,0); - SAFE_FREE(data.dptr); - return ret; -} - -/**************************************************************************** - Fetch a int32 value by string key, return -1 if not found. - Output is int32 in native byte order. -****************************************************************************/ - -int32 tdb_fetch_int32(TDB_CONTEXT *tdb, const char *keystr) -{ - return tdb_fetch_int32_byblob(tdb, keystr, strlen(keystr) + 1); -} - -/**************************************************************************** - Store a int32 value by an arbitary blob key, return 0 on success, -1 on failure. - Input is int32 in native byte order. Output in tdb is in little-endian. -****************************************************************************/ - -int tdb_store_int32_byblob(TDB_CONTEXT *tdb, const char *keystr, size_t len, int32 v) -{ - TDB_DATA key = make_tdb_data(keystr, len); - TDB_DATA data; - int32 v_store; - - SIVAL(&v_store,0,v); - data.dptr = (void *)&v_store; - data.dsize = sizeof(int32); - - return tdb_store(tdb, key, data, TDB_REPLACE); -} - -/**************************************************************************** - Store a int32 value by string key, return 0 on success, -1 on failure. - Input is int32 in native byte order. Output in tdb is in little-endian. -****************************************************************************/ - -int tdb_store_int32(TDB_CONTEXT *tdb, const char *keystr, int32 v) -{ - return tdb_store_int32_byblob(tdb, keystr, strlen(keystr) + 1, v); -} - -/**************************************************************************** - Fetch a uint32 value by a arbitrary blob key, return -1 if not found. - Output is uint32 in native byte order. -****************************************************************************/ - -BOOL tdb_fetch_uint32_byblob(TDB_CONTEXT *tdb, const char *keyval, size_t len, uint32 *value) -{ - TDB_DATA key = make_tdb_data(keyval, len); - TDB_DATA data; - - data = tdb_fetch(tdb, key); - if (!data.dptr || data.dsize != sizeof(uint32)) { - SAFE_FREE(data.dptr); - return False; - } - - *value = IVAL(data.dptr,0); - SAFE_FREE(data.dptr); - return True; -} - -/**************************************************************************** - Fetch a uint32 value by string key, return -1 if not found. - Output is uint32 in native byte order. -****************************************************************************/ - -BOOL tdb_fetch_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 *value) -{ - return tdb_fetch_uint32_byblob(tdb, keystr, strlen(keystr) + 1, value); -} - -/**************************************************************************** - Store a uint32 value by an arbitary blob key, return 0 on success, -1 on failure. - Input is uint32 in native byte order. Output in tdb is in little-endian. -****************************************************************************/ - -BOOL tdb_store_uint32_byblob(TDB_CONTEXT *tdb, const char *keystr, size_t len, uint32 value) -{ - TDB_DATA key = make_tdb_data(keystr, len); - TDB_DATA data; - uint32 v_store; - BOOL ret = True; - - SIVAL(&v_store, 0, value); - data.dptr = (void *)&v_store; - data.dsize = sizeof(uint32); - - if (tdb_store(tdb, key, data, TDB_REPLACE) == -1) - ret = False; - - return ret; -} - -/**************************************************************************** - Store a uint32 value by string key, return 0 on success, -1 on failure. - Input is uint32 in native byte order. Output in tdb is in little-endian. -****************************************************************************/ - -BOOL tdb_store_uint32(TDB_CONTEXT *tdb, const char *keystr, uint32 value) -{ - return tdb_store_uint32_byblob(tdb, keystr, strlen(keystr) + 1, value); -} -/**************************************************************************** - Store a buffer by a null terminated string key. Return 0 on success, -1 - on failure. -****************************************************************************/ - -int tdb_store_bystring(TDB_CONTEXT *tdb, const char *keystr, TDB_DATA data, int flags) -{ - TDB_DATA key = make_tdb_data(keystr, strlen(keystr)+1); - - return tdb_store(tdb, key, data, flags); -} - -/**************************************************************************** - Fetch a buffer using a null terminated string key. Don't forget to call - free() on the result dptr. -****************************************************************************/ - -TDB_DATA tdb_fetch_bystring(TDB_CONTEXT *tdb, const char *keystr) -{ - TDB_DATA key = make_tdb_data(keystr, strlen(keystr)+1); - - return tdb_fetch(tdb, key); -} - -/**************************************************************************** - Delete an entry using a null terminated string key. -****************************************************************************/ - -int tdb_delete_bystring(TDB_CONTEXT *tdb, const char *keystr) -{ - TDB_DATA key = make_tdb_data(keystr, strlen(keystr)+1); - - return tdb_delete(tdb, key); -} - -/**************************************************************************** - Atomic integer change. Returns old value. To create, set initial value in *oldval. -****************************************************************************/ - -int32 tdb_change_int32_atomic(TDB_CONTEXT *tdb, const char *keystr, int32 *oldval, int32 change_val) -{ - int32 val; - int32 ret = -1; - - if (tdb_lock_bystring(tdb, keystr,0) == -1) - return -1; - - if ((val = tdb_fetch_int32(tdb, keystr)) == -1) { - /* The lookup failed */ - if (tdb_error(tdb) != TDB_ERR_NOEXIST) { - /* but not because it didn't exist */ - goto err_out; - } - - /* Start with 'old' value */ - val = *oldval; - - } else { - /* It worked, set return value (oldval) to tdb data */ - *oldval = val; - } - - /* Increment value for storage and return next time */ - val += change_val; - - if (tdb_store_int32(tdb, keystr, val) == -1) - goto err_out; - - ret = 0; - - err_out: - - tdb_unlock_bystring(tdb, keystr); - return ret; -} - -/**************************************************************************** - Atomic unsigned integer change. Returns old value. To create, set initial value in *oldval. -****************************************************************************/ - -BOOL tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldval, uint32 change_val) -{ - uint32 val; - BOOL ret = False; - - if (tdb_lock_bystring(tdb, keystr,0) == -1) - return False; - - if (!tdb_fetch_uint32(tdb, keystr, &val)) { - /* It failed */ - if (tdb_error(tdb) != TDB_ERR_NOEXIST) { - /* and not because it didn't exist */ - goto err_out; - } - - /* Start with 'old' value */ - val = *oldval; - - } else { - /* it worked, set return value (oldval) to tdb data */ - *oldval = val; - - } - - /* get a new value to store */ - val += change_val; - - if (!tdb_store_uint32(tdb, keystr, val)) - goto err_out; - - ret = True; - - err_out: - - tdb_unlock_bystring(tdb, keystr); - return ret; -} - -/**************************************************************************** - Useful pair of routines for packing/unpacking data consisting of - integers and strings. -****************************************************************************/ - -size_t tdb_pack(char *buf, int bufsize, const char *fmt, ...) -{ - va_list ap; - uint8 bt; - uint16 w; - uint32 d; - int i; - void *p; - int len; - char *s; - char c; - char *buf0 = buf; - const char *fmt0 = fmt; - int bufsize0 = bufsize; - - va_start(ap, fmt); - - while (*fmt) { - switch ((c = *fmt++)) { - case 'b': /* unsigned 8-bit integer */ - len = 1; - bt = (uint8)va_arg(ap, int); - if (bufsize && bufsize >= len) - SSVAL(buf, 0, bt); - break; - case 'w': /* unsigned 16-bit integer */ - len = 2; - w = (uint16)va_arg(ap, int); - if (bufsize && bufsize >= len) - SSVAL(buf, 0, w); - break; - case 'd': /* signed 32-bit integer (standard int in most systems) */ - len = 4; - d = va_arg(ap, uint32); - if (bufsize && bufsize >= len) - SIVAL(buf, 0, d); - break; - case 'p': /* pointer */ - len = 4; - p = va_arg(ap, void *); - d = p?1:0; - if (bufsize && bufsize >= len) - SIVAL(buf, 0, d); - break; - case 'P': /* null-terminated string */ - s = va_arg(ap,char *); - w = strlen(s); - len = w + 1; - if (bufsize && bufsize >= len) - memcpy(buf, s, len); - break; - case 'f': /* null-terminated string */ - s = va_arg(ap,char *); - w = strlen(s); - len = w + 1; - if (bufsize && bufsize >= len) - memcpy(buf, s, len); - break; - case 'B': /* fixed-length string */ - i = va_arg(ap, int); - s = va_arg(ap, char *); - len = 4+i; - if (bufsize && bufsize >= len) { - SIVAL(buf, 0, i); - memcpy(buf+4, s, i); - } - break; - default: - DEBUG(0,("Unknown tdb_pack format %c in %s\n", - c, fmt)); - len = 0; - break; - } - - buf += len; - if (bufsize) - bufsize -= len; - if (bufsize < 0) - bufsize = 0; - } - - va_end(ap); - - DEBUG(18,("tdb_pack(%s, %d) -> %d\n", - fmt0, bufsize0, (int)PTR_DIFF(buf, buf0))); - - return PTR_DIFF(buf, buf0); -} - -/**************************************************************************** - Useful pair of routines for packing/unpacking data consisting of - integers and strings. -****************************************************************************/ - -int tdb_unpack(char *buf, int bufsize, const char *fmt, ...) -{ - va_list ap; - uint8 *bt; - uint16 *w; - uint32 *d; - int len; - int *i; - void **p; - char *s, **b; - char c; - char *buf0 = buf; - const char *fmt0 = fmt; - int bufsize0 = bufsize; - - va_start(ap, fmt); - - while (*fmt) { - switch ((c=*fmt++)) { - case 'b': - len = 1; - bt = va_arg(ap, uint8 *); - if (bufsize < len) - goto no_space; - *bt = SVAL(buf, 0); - break; - case 'w': - len = 2; - w = va_arg(ap, uint16 *); - if (bufsize < len) - goto no_space; - *w = SVAL(buf, 0); - break; - case 'd': - len = 4; - d = va_arg(ap, uint32 *); - if (bufsize < len) - goto no_space; - *d = IVAL(buf, 0); - break; - case 'p': - len = 4; - p = va_arg(ap, void **); - if (bufsize < len) - goto no_space; - *p = (void *)IVAL(buf, 0); - break; - case 'P': - s = va_arg(ap,char *); - len = strlen(buf) + 1; - if (bufsize < len || len > sizeof(pstring)) - goto no_space; - memcpy(s, buf, len); - break; - case 'f': - s = va_arg(ap,char *); - len = strlen(buf) + 1; - if (bufsize < len || len > sizeof(fstring)) - goto no_space; - memcpy(s, buf, len); - break; - case 'B': - i = va_arg(ap, int *); - b = va_arg(ap, char **); - len = 4; - if (bufsize < len) - goto no_space; - *i = IVAL(buf, 0); - if (! *i) { - *b = NULL; - break; - } - len += *i; - if (bufsize < len) - goto no_space; - *b = (char *)malloc(*i); - if (! *b) - goto no_space; - memcpy(*b, buf+4, *i); - break; - default: - DEBUG(0,("Unknown tdb_unpack format %c in %s\n", - c, fmt)); - - len = 0; - break; - } - - buf += len; - bufsize -= len; - } - - va_end(ap); - - DEBUG(18,("tdb_unpack(%s, %d) -> %d\n", - fmt0, bufsize0, (int)PTR_DIFF(buf, buf0))); - - return PTR_DIFF(buf, buf0); - - no_space: - return -1; -} - - -/** - * Pack SID passed by pointer - * - * @param pack_buf pointer to buffer which is to be filled with packed data - * @param bufsize size of packing buffer - * @param sid pointer to sid to be packed - * - * @return length of the packed representation of the whole structure - **/ -size_t tdb_sid_pack(char* pack_buf, int bufsize, DOM_SID* sid) -{ - int idx; - size_t len = 0; - - if (!sid || !pack_buf) return -1; - - len += tdb_pack(pack_buf + len, bufsize - len, "bb", sid->sid_rev_num, - sid->num_auths); - - for (idx = 0; idx < 6; idx++) { - len += tdb_pack(pack_buf + len, bufsize - len, "b", sid->id_auth[idx]); - } - - for (idx = 0; idx < MAXSUBAUTHS; idx++) { - len += tdb_pack(pack_buf + len, bufsize - len, "d", sid->sub_auths[idx]); - } - - return len; -} - - -/** - * Unpack SID into a pointer - * - * @param pack_buf pointer to buffer with packed representation - * @param bufsize size of the buffer - * @param sid pointer to sid structure to be filled with unpacked data - * - * @return size of structure unpacked from buffer - **/ -size_t tdb_sid_unpack(char* pack_buf, int bufsize, DOM_SID* sid) -{ - int idx, len = 0; - - if (!sid || !pack_buf) return -1; - - len += tdb_unpack(pack_buf + len, bufsize - len, "bb", - &sid->sid_rev_num, &sid->num_auths); - - for (idx = 0; idx < 6; idx++) { - len += tdb_unpack(pack_buf + len, bufsize - len, "b", &sid->id_auth[idx]); - } - - for (idx = 0; idx < MAXSUBAUTHS; idx++) { - len += tdb_unpack(pack_buf + len, bufsize - len, "d", &sid->sub_auths[idx]); - } - - return len; -} - - -/** - * Pack TRUSTED_DOM_PASS passed by pointer - * - * @param pack_buf pointer to buffer which is to be filled with packed data - * @param bufsize size of the buffer - * @param pass pointer to trusted domain password to be packed - * - * @return length of the packed representation of the whole structure - **/ -size_t tdb_trusted_dom_pass_pack(char* pack_buf, int bufsize, TRUSTED_DOM_PASS* pass) -{ - int idx, len = 0; - - if (!pack_buf || !pass) return -1; - - /* packing unicode domain name and password */ - len += tdb_pack(pack_buf + len, bufsize - len, "d", pass->uni_name_len); - - for (idx = 0; idx < 32; idx++) - len += tdb_pack(pack_buf + len, bufsize - len, "w", pass->uni_name[idx]); - - len += tdb_pack(pack_buf + len, bufsize - len, "dPd", pass->pass_len, - pass->pass, pass->mod_time); - - /* packing SID structure */ - len += tdb_sid_pack(pack_buf + len, bufsize - len, &pass->domain_sid); - - return len; -} - - -/** - * Unpack TRUSTED_DOM_PASS passed by pointer - * - * @param pack_buf pointer to buffer with packed representation - * @param bufsize size of the buffer - * @param pass pointer to trusted domain password to be filled with unpacked data - * - * @return size of structure unpacked from buffer - **/ -size_t tdb_trusted_dom_pass_unpack(char* pack_buf, int bufsize, TRUSTED_DOM_PASS* pass) -{ - int idx, len = 0; - - if (!pack_buf || !pass) return -1; - - /* unpack unicode domain name and plaintext password */ - len += tdb_unpack(pack_buf, bufsize - len, "d", &pass->uni_name_len); - - for (idx = 0; idx < 32; idx++) - len += tdb_unpack(pack_buf + len, bufsize - len, "w", &pass->uni_name[idx]); - - len += tdb_unpack(pack_buf + len, bufsize - len, "dPd", &pass->pass_len, &pass->pass, - &pass->mod_time); - - /* unpack domain sid */ - len += tdb_sid_unpack(pack_buf + len, bufsize - len, &pass->domain_sid); - - return len; -} - - -/**************************************************************************** - Log tdb messages via DEBUG(). -****************************************************************************/ - -static void tdb_log(TDB_CONTEXT *tdb, int level, const char *format, ...) -{ - va_list ap; - char *ptr = NULL; - - va_start(ap, format); - vasprintf(&ptr, format, ap); - va_end(ap); - - if (!ptr || !*ptr) - return; - - DEBUG(level, ("tdb(%s): %s", tdb->name ? tdb->name : "unnamed", ptr)); - SAFE_FREE(ptr); -} - -/**************************************************************************** - Like tdb_open() but also setup a logging function that redirects to - the samba DEBUG() system. -****************************************************************************/ - -TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags, - int open_flags, mode_t mode) -{ - TDB_CONTEXT *tdb; - - if (!lp_use_mmap()) - tdb_flags |= TDB_NOMMAP; - - tdb = tdb_open_ex(name, hash_size, tdb_flags, - open_flags, mode, tdb_log); - if (!tdb) - return NULL; - - return tdb; -} - - -/**************************************************************************** - Allow tdb_delete to be used as a tdb_traversal_fn. -****************************************************************************/ - -int tdb_traverse_delete_fn(TDB_CONTEXT *the_tdb, TDB_DATA key, TDB_DATA dbuf, - void *state) -{ - return tdb_delete(the_tdb, key); -} - - - -/** - * Search across the whole tdb for keys that match the given pattern - * return the result as a list of keys - * - * @param tdb pointer to opened tdb file context - * @param pattern searching pattern used by fnmatch(3) functions - * - * @return list of keys found by looking up with given pattern - **/ -TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT *tdb, const char* pattern) -{ - TDB_DATA key, next; - TDB_LIST_NODE *list = NULL; - TDB_LIST_NODE *rec = NULL; - TDB_LIST_NODE *tmp = NULL; - - for (key = tdb_firstkey(tdb); key.dptr; key = next) { - /* duplicate key string to ensure null-termination */ - char *key_str = (char*) strndup(key.dptr, key.dsize); - if (!key_str) { - DEBUG(0, ("tdb_search_keys: strndup() failed!\n")); - smb_panic("strndup failed!\n"); - } - - DEBUG(18, ("checking %s for match to pattern %s\n", key_str, pattern)); - - next = tdb_nextkey(tdb, key); - - /* do the pattern checking */ - if (fnmatch(pattern, key_str, 0) == 0) { - rec = (TDB_LIST_NODE*) malloc(sizeof(*rec)); - ZERO_STRUCTP(rec); - - rec->node_key = key; - - DLIST_ADD_END(list, rec, tmp); - - DEBUG(18, ("checking %s matched pattern %s\n", key_str, pattern)); - } else { - free(key.dptr); - } - - /* free duplicated key string */ - free(key_str); - } - - return list; - -}; - - -/** - * Free the list returned by tdb_search_keys - * - * @param node list of results found by tdb_search_keys - **/ -void tdb_search_list_free(TDB_LIST_NODE* node) -{ - TDB_LIST_NODE *next_node; - - while (node) { - next_node = node->next; - SAFE_FREE(node->node_key.dptr); - SAFE_FREE(node); - node = next_node; - }; -}; - - diff --git a/tdb/tdbutil.h b/tdb/tdbutil.h deleted file mode 100644 index 01473446a1..0000000000 --- a/tdb/tdbutil.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - Unix SMB/CIFS implementation. - tdb utility functions - Copyright (C) Andrew Tridgell 1999 - - 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; either version 2 of the License, or - (at your option) any later version. - - 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 02139, USA. -*/ - -#ifndef __TDBUTIL_H__ -#define __TDBUTIL_H__ - - -/* single node of a list returned by tdb_search_keys */ -typedef struct keys_node -{ - struct keys_node *prev, *next; - TDB_DATA node_key; -} TDB_LIST_NODE; - - -TDB_LIST_NODE *tdb_search_keys(TDB_CONTEXT*, const char*); -void tdb_search_list_free(TDB_LIST_NODE*); - - -#endif /* __TDBUTIL_H__ */ diff --git a/test/devd_test b/test/devd_test index 007a0bec90..6e4c206352 100644 --- a/test/devd_test +++ b/test/devd_test @@ -14,7 +14,7 @@ EOF cat > $CONFIG << EOF udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udev.tdb" +udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF diff --git a/test/ignore_test b/test/ignore_test index ca51e9a1ab..d22a4d7b5f 100644 --- a/test/ignore_test +++ b/test/ignore_test @@ -13,7 +13,7 @@ EOF cat > $CONFIG << EOF udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udev.tdb" +udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" udev_log="true" diff --git a/test/label_test b/test/label_test index b99a4acd54..fbb7309045 100644 --- a/test/label_test +++ b/test/label_test @@ -14,7 +14,7 @@ EOF cat > $CONFIG << EOF udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udev.tdb" +udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF diff --git a/test/modifier_test b/test/modifier_test index 7ffc7b16a1..c2b5ec6830 100644 --- a/test/modifier_test +++ b/test/modifier_test @@ -13,7 +13,7 @@ EOF cat > $CONFIG << EOF udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udev.tdb" +udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF diff --git a/test/net_test b/test/net_test index 56a6847d19..ec0dea4642 100644 --- a/test/net_test +++ b/test/net_test @@ -13,7 +13,7 @@ EOF cat > $CONFIG << EOF udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udev.tdb" +udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF diff --git a/test/replace_test b/test/replace_test index 10215b0f24..9445b7262a 100644 --- a/test/replace_test +++ b/test/replace_test @@ -13,7 +13,7 @@ EOF cat > $CONFIG << EOF udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udev.tdb" +udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF diff --git a/test/topo_test b/test/topo_test index 18b2549b97..77333a978c 100644 --- a/test/topo_test +++ b/test/topo_test @@ -13,7 +13,7 @@ EOF cat > $CONFIG << EOF udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udev.tdb" +udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" udev_permissions="$PWD/udev.permissions" EOF diff --git a/test/udev-test.pl b/test/udev-test.pl index e8ce0b44dd..2ba63fe83f 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -30,7 +30,7 @@ my $PWD = $ENV{PWD}; my $sysfs = "sys/"; my $udev_bin = "../udev"; my $udev_root = "udev-root/"; # !!! directory will be removed !!! -my $udev_db = ".udev.tdb"; +my $udev_db = ".udevdb"; my $perm = "udev.permissions"; my $main_conf = "udev-test.conf"; my $conf_tmp = "udev-test.rules"; @@ -1268,7 +1268,7 @@ sub run_test { } if (defined($config->{option}) && $config->{option} eq "clear") { - unlink($udev_db); + system("rm -rf $udev_db"); system("rm -rf $udev_root"); mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; } @@ -1319,7 +1319,7 @@ if ($ARGV[0]) { print "$error errors occured\n\n"; # cleanup -unlink($udev_db); +system("rm -rf $udev_db"); system("rm -rf $udev_root"); unlink($conf_tmp); unlink($main_conf); diff --git a/udev.8.in b/udev.8.in index a7f0bf0392..168842d435 100644 --- a/udev.8.in +++ b/udev.8.in @@ -74,7 +74,7 @@ value is .TP .B udev_db The name and location of the udev database. The default value is -.IR @udevdir@/.udev.tdb . +.IR @udevdir@/.udevdb . .TP .B udev_rules The name of the udev rules file or directory to look for files with the suffix @@ -117,7 +117,7 @@ file. The default value is udev_root="/udev" # udev_db - The name and location of the udev database -udev_db="/udev/.udev.tdb" +udev_db="/udev/.udevdb" # udev_rules - The name of the udev rules file or directory to look for files with the suffix .rules diff --git a/udev.c b/udev.c index 7809060520..d8cb4365fd 100644 --- a/udev.c +++ b/udev.c @@ -38,8 +38,6 @@ #include "namedev.h" #include "udevdb.h" -/* timeout flag for udevdb */ -extern sig_atomic_t gotalarm; /* global variables */ char **main_argv; @@ -64,8 +62,7 @@ static void asmlinkage sig_handler(int signum) { switch (signum) { case SIGALRM: - gotalarm = 1; - break; + exit(1); case SIGINT: case SIGTERM: exit(20 + signum); @@ -153,10 +150,6 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timout to interrupt blocking syscalls */ alarm(ALARM_TIMEOUT); - /* initialize udev database */ - if (udevdb_init(UDEVDB_DEFAULT) != 0) - info("error: unable to initialize database, continuing without database"); - switch(act_type) { case UDEVSTART: dbg("udevstart"); @@ -196,8 +189,6 @@ int main(int argc, char *argv[], char *envp[]) dev_d_execute(&udev); } - udevdb_exit(); - exit: logging_close(); return retval; diff --git a/udev.h b/udev.h index e8954338d9..1cf4ad7eae 100644 --- a/udev.h +++ b/udev.h @@ -41,26 +41,21 @@ #define LINE_SIZE 256 -/* length of public data to store in udevdb */ -#define UDEVICE_DB_LEN (offsetof(struct udevice, devpath)) - struct udevice { + char devpath[DEVPATH_SIZE]; + char subsystem[SUBSYSTEM_SIZE]; char name[NAME_SIZE]; char owner[OWNER_SIZE]; char group[GROUP_SIZE]; char type; int major; int minor; - unsigned int mode; /* not mode_t due to conflicting definitions in different libcs */ + mode_t mode; char symlink[NAME_SIZE]; int partitions; int config_line; char config_file[NAME_SIZE]; long config_uptime; - - /* private data, not stored in udevdb */ - char devpath[DEVPATH_SIZE]; - char subsystem[SUBSYSTEM_SIZE]; char bus_id[SYSFS_NAME_LEN]; char bus[SYSFS_NAME_LEN]; char program_result[NAME_SIZE]; @@ -81,7 +76,7 @@ extern char **main_argv; extern char **main_envp; extern char sysfs_path[SYSFS_PATH_MAX]; extern char udev_root[PATH_MAX]; -extern char udev_db_filename[PATH_MAX+NAME_MAX]; +extern char udev_db_path[PATH_MAX+NAME_MAX]; extern char udev_permissions_filename[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; diff --git a/udev_add.c b/udev_add.c index 689c2dceec..60506b4243 100644 --- a/udev_add.c +++ b/udev_add.c @@ -68,37 +68,6 @@ error: return -1; } -static int create_path(char *file) -{ - char p[NAME_SIZE]; - char *pos; - int retval; - struct stat stats; - - strfieldcpy(p, file); - pos = strchr(p+1, '/'); - while (1) { - pos = strchr(pos+1, '/'); - if (pos == NULL) - break; - *pos = 0x00; - if (stat(p, &stats)) { - selinux_setfscreatecon(p, S_IFDIR); - retval = mkdir(p, 0755); - if (retval != 0) { - dbg("mkdir(%s) failed with error '%s'", - p, strerror(errno)); - return retval; - } - dbg("created '%s'", p); - } else { - selinux_setfilecon(p, S_IFDIR); - } - *pos = '/'; - } - return 0; -} - static int make_node(char *file, int major, int minor, unsigned int mode, uid_t uid, gid_t gid) { struct stat stats; @@ -152,8 +121,6 @@ exit: static int create_node(struct udevice *udev) { char filename[NAME_SIZE]; - char linkname[NAME_SIZE]; - char linktarget[NAME_SIZE]; char partitionname[NAME_SIZE]; uid_t uid = 0; gid_t gid = 0; @@ -162,8 +129,8 @@ static int create_node(struct udevice *udev) char *pos; int len; - strfieldcpy(filename, udev_root); - strfieldcat(filename, udev->name); + snprintf(filename, NAME_SIZE-1, "%s/%s", udev_root, udev->name); + filename[NAME_SIZE-1] = '\0'; switch (udev->type) { case 'b': @@ -239,9 +206,13 @@ static int create_node(struct udevice *udev) /* create symlink(s) if requested */ foreach_strpart(udev->symlink, " ", pos, len) { + char linkname[NAME_SIZE]; + char linktarget[NAME_SIZE]; + strfieldcpymax(linkname, pos, len+1); - strfieldcpy(filename, udev_root); - strfieldcat(filename, linkname); + snprintf(filename, NAME_SIZE-1, "%s/%s", udev_root, linkname); + filename[NAME_SIZE-1] = '\0'; + dbg("symlink '%s' to node '%s' requested", filename, udev->name); if (!udev->test_run) if (strrchr(linkname, '/')) @@ -337,7 +308,8 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) "remove might not work for custom names"); /* use full path to the environment */ - snprintf(udev->devname, NAME_SIZE-1, "%s%s", udev_root, udev->name); + snprintf(udev->devname, NAME_SIZE-1, "%s/%s", udev_root, udev->name); + udev->devname[NAME_SIZE-1] = '\0'; } else if (udev->type == 'n') { /* look if we want to change the name of the netif */ diff --git a/udev_config.c b/udev_config.c index ae755f39fd..198473936f 100644 --- a/udev_config.c +++ b/udev_config.c @@ -42,7 +42,7 @@ /* global variables */ char sysfs_path[SYSFS_PATH_MAX]; char udev_root[PATH_MAX]; -char udev_db_filename[PATH_MAX+NAME_MAX]; +char udev_db_path[PATH_MAX+NAME_MAX]; char udev_permissions_filename[PATH_MAX+NAME_MAX]; char udev_rules_filename[PATH_MAX+NAME_MAX]; char udev_config_filename[PATH_MAX+NAME_MAX]; @@ -72,7 +72,7 @@ static void init_variables(void) * If any config values are specified, they will * override these values. */ strfieldcpy(udev_root, UDEV_ROOT); - strfieldcpy(udev_db_filename, UDEV_DB); + strfieldcpy(udev_db_path, UDEV_DB); strfieldcpy(udev_config_filename, UDEV_CONFIG_FILE); strfieldcpy(udev_rules_filename, UDEV_RULES_FILE); strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE); @@ -181,24 +181,25 @@ static int parse_config_file(void) if (strcasecmp(variable, "udev_root") == 0) { strfieldcpy(udev_root, value); - leading_slash(udev_root); + no_trailing_slash(udev_root); continue; } if (strcasecmp(variable, "udev_db") == 0) { - strfieldcpy(udev_db_filename, value); + strfieldcpy(udev_db_path, value); + no_trailing_slash(udev_db_path); continue; } if (strcasecmp(variable, "udev_rules") == 0) { strfieldcpy(udev_rules_filename, value); - no_leading_slash(udev_rules_filename); + no_trailing_slash(udev_rules_filename); continue; } if (strcasecmp(variable, "udev_permissions") == 0) { strfieldcpy(udev_permissions_filename, value); - no_leading_slash(udev_permissions_filename); + no_trailing_slash(udev_permissions_filename); continue; } @@ -244,7 +245,7 @@ static void get_dirs(void) temp = getenv("SYSFS_PATH"); if (temp != NULL) { strfieldcpy(sysfs_path, temp); - no_leading_slash(sysfs_path); + no_trailing_slash(sysfs_path); } temp = getenv("UDEV_CONFIG_FILE"); @@ -255,7 +256,7 @@ static void get_dirs(void) dbg("sysfs_path='%s'", sysfs_path); dbg_parse("udev_root = %s", udev_root); dbg_parse("udev_config_filename = %s", udev_config_filename); - dbg_parse("udev_db_filename = %s", udev_db_filename); + dbg_parse("udev_db_path = %s", udev_db_path); dbg_parse("udev_rules_filename = %s", udev_rules_filename); dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); dbg_parse("udev_log = %d", udev_log); @@ -264,7 +265,7 @@ static void get_dirs(void) dbg("udev_root = %s", udev_root); dbg("udev_config_filename = %s", udev_config_filename); - dbg("udev_db_filename = %s", udev_db_filename); + dbg("udev_db_path = %s", udev_db_path); dbg("udev_rules_filename = %s", udev_rules_filename); dbg("udev_permissions_filename = %s", udev_permissions_filename); dbg("udev_log_str = %d", udev_log); diff --git a/udev_lib.c b/udev_lib.c index bd3eeba661..7fb45f0b5f 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -120,6 +120,33 @@ void udev_set_values(struct udevice *udev, const char* devpath, const char *subs udev->type = get_device_type(devpath, subsystem); } +int create_path(const char *path) +{ + char p[NAME_SIZE]; + char *pos; + struct stat stats; + + strcpy (p, path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (pos[-1] == '/') + pos--; + + pos[0] = '\0'; + + dbg("stat '%s'\n", p); + if (stat (p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + + if (create_path (p) != 0) + return -1; + + dbg("mkdir '%s'\n", p); + return mkdir(p, 0755); +} + int file_map(const char *filename, char **buf, size_t *bufsize) { struct stat stats; @@ -161,18 +188,7 @@ size_t buf_get_line(char *buf, size_t buflen, size_t cur) return count - cur; } -void leading_slash(char *path) -{ - int len; - - len = strlen(path); - if (len > 0 && path[len-1] != '/') { - path[len] = '/'; - path[len+1] = '\0'; - } -} - -void no_leading_slash(char *path) +void no_trailing_slash(char *path) { int len; @@ -249,9 +265,8 @@ int call_foreach_file(int fnct(char *f) , char *dirname, char *suffix) /* call function for every file in the list */ list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { - strfieldcpy(file, dirname); - strfieldcat(file, "/"); - strfieldcat(file, loop_file->name); + snprintf(file, NAME_SIZE-1, "%s/%s", dirname, loop_file->name); + file[NAME_SIZE-1] = '\0'; fnct(file); diff --git a/udev_lib.h b/udev_lib.h index 8a14ef00b6..94649b645f 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -83,11 +83,11 @@ extern char *get_seqnum(void); extern char *get_subsystem(char *subsystem); extern char get_device_type(const char *path, const char *subsystem); extern void udev_set_values(struct udevice *udev, const char* devpath, const char *subsystem); +extern int create_path(const char *path); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); -extern void leading_slash(char *path); -extern void no_leading_slash(char *path); +extern void no_trailing_slash(char *path); extern int call_foreach_file(int fnct(char *f) , char *filename, char *extension); extern int set_cloexec_flag (int desc, int value); diff --git a/udev_remove.c b/udev_remove.c index cd9d27f8dc..d855fce52c 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -102,10 +102,9 @@ static int secure_unlink(const char *filename) return retval; } -static int delete_node(struct udevice *dev) +static int delete_node(struct udevice *udev) { char filename[NAME_SIZE]; - char linkname[NAME_SIZE]; char partitionname[NAME_SIZE]; int retval; int i; @@ -113,8 +112,8 @@ static int delete_node(struct udevice *dev) int len; int num; - strfieldcpy(filename, udev_root); - strfieldcat(filename, dev->name); + snprintf(filename, NAME_SIZE-1, "%s/%s", udev_root, udev->name); + filename[NAME_SIZE-1] = '\0'; info("removing device node '%s'", filename); retval = secure_unlink(filename); @@ -122,7 +121,7 @@ static int delete_node(struct udevice *dev) return retval; /* remove all_partitions nodes */ - num = dev->partitions; + num = udev->partitions; if (num > 0) { info("removing all_partitions '%s[1-%i]'", filename, num); if (num > PARTITIONS_COUNT) { @@ -137,13 +136,15 @@ static int delete_node(struct udevice *dev) } /* remove subdirectories */ - if (strchr(dev->name, '/')) + if (strchr(udev->name, '/')) delete_path(filename); - foreach_strpart(dev->symlink, " ", pos, len) { + foreach_strpart(udev->symlink, " ", pos, len) { + char linkname[NAME_SIZE]; + strfieldcpymax(linkname, pos, len+1); - strfieldcpy(filename, udev_root); - strfieldcat(filename, linkname); + snprintf(filename, NAME_SIZE-1, "%s/%s", udev_root, linkname); + filename[NAME_SIZE-1] = '\0'; dbg("unlinking symlink '%s'", filename); retval = unlink(filename); @@ -154,7 +155,7 @@ static int delete_node(struct udevice *dev) filename, strerror(errno)); return retval; } - if (strchr(dev->symlink, '/')) { + if (strchr(udev->symlink, '/')) { delete_path(filename); } } @@ -168,18 +169,14 @@ static int delete_node(struct udevice *dev) */ int udev_remove_device(struct udevice *udev) { - struct udevice db_dev; const char *temp; int retval; if (udev->type != 'b' && udev->type != 'c') return 0; - retval = udevdb_get_dev(udev->devpath, &db_dev); - if (retval == 0) { - /* copy over the stored values to our device */ - memcpy(udev, &db_dev, UDEVICE_DB_LEN); - } else { + retval = udevdb_get_dev(udev); + if (retval) { /* fall back to kernel name */ temp = strrchr(udev->devpath, '/'); if (temp == NULL) @@ -189,10 +186,10 @@ int udev_remove_device(struct udevice *udev) } dbg("remove name='%s'", udev->name); - udevdb_delete_dev(udev->devpath); + udevdb_delete_dev(udev); /* use full path to the environment */ - snprintf(udev->devname, NAME_SIZE-1, "%s%s", udev_root, udev->name); + snprintf(udev->devname, NAME_SIZE-1, "%s/%s", udev_root, udev->name); return delete_node(udev); } diff --git a/udevdb.c b/udevdb.c index 6a3357d0bb..fc579a9451 100644 --- a/udevdb.c +++ b/udevdb.c @@ -1,10 +1,10 @@ /* - * udevdb.c - udev database library + * udevdb.c * * Userspace devfs * * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003 IBM Corp. + * Copyright (C) 2004 Kay Sievers * * 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 @@ -21,216 +21,194 @@ * */ + #include #include #include #include #include #include -#include #include -#include +#include #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" #include "udev_lib.h" -#include "udev_version.h" #include "logging.h" -#include "namedev.h" #include "udevdb.h" -#include "tdb/tdb.h" -static TDB_CONTEXT *udevdb; -sig_atomic_t gotalarm; +#define PATH_TO_NAME_CHAR '@' + +static int get_db_filename(struct udevice *udev, char *filename, int len) +{ + char devpath[SYSFS_PATH_MAX]; + char *pos; + + /* replace '/' to transform path into a filename */ + strfieldcpy(devpath, udev->devpath); + pos = strchr(&devpath[1], '/'); + while (pos) { + pos[0] = PATH_TO_NAME_CHAR; + pos = strchr(&pos[1], '/'); + } + snprintf(filename, len-1, "%s%s", udev_db_path, devpath); + filename[len-1] = '\0'; + + return 0; +} int udevdb_add_dev(struct udevice *udev) { - TDB_DATA key, data; - char keystr[SYSFS_PATH_MAX]; + char filename[SYSFS_PATH_MAX]; + FILE *f; if (udev->test_run) return 0; - if (udevdb == NULL) + get_db_filename(udev, filename, SYSFS_PATH_MAX); + + create_path(filename); + + f = fopen(filename, "w"); + if (f == NULL) { + dbg("unable to create db file '%s'", filename); return -1; + } + dbg("storing data for device '%s' in '%s'", udev->devpath, filename); - memset(keystr, 0x00, SYSFS_PATH_MAX); - strfieldcpy(keystr, udev->devpath); - key.dptr = keystr; - key.dsize = strlen(keystr) + 1; + fprintf(f, "P:%s\n", udev->devpath); + fprintf(f, "N:%s\n", udev->name); + fprintf(f, "S:%s\n", udev->symlink); + fprintf(f, "A:%d\n", udev->partitions); - data.dptr = (void *) udev; - data.dsize = UDEVICE_DB_LEN; - dbg("store key '%s' for device '%s'", keystr, udev->name); + fclose(f); - return tdb_store(udevdb, key, data, TDB_REPLACE); + return 0; } -int udevdb_get_dev(const char *path, struct udevice *udev) +static int parse_db_file(struct udevice *udev, const char *filename) { - TDB_DATA key, data; - - if (udevdb == NULL) + char line[NAME_SIZE]; + char *bufline; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + + if (file_map(filename, &buf, &bufsize) != 0) { + dbg("unable to read db file '%s'", filename); return -1; + } - if (path == NULL) - return -ENODEV; - - key.dptr = (void *)path; - key.dsize = strlen(path) + 1; - - data = tdb_fetch(udevdb, key); - if (data.dptr == NULL || data.dsize == 0) - return -ENODEV; + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + + switch(bufline[0]) { + case 'P': + if (count > DEVPATH_SIZE) + count = DEVPATH_SIZE-1; + strncpy(udev->devpath, &bufline[2], count-2); + break; + case 'N': + if (count > NAME_SIZE) + count = NAME_SIZE-1; + strncpy(udev->name, &bufline[2], count-2); + break; + case 'S': + if (count > NAME_SIZE) + count = NAME_SIZE-1; + strncpy(udev->symlink, &bufline[2], count-2); + break; + case 'A': + strfieldcpy(line, &bufline[2]); + udev->partitions = atoi(line); + break; + } + } - memset(udev, 0x00, sizeof(struct udevice)); - memcpy(udev, data.dptr, UDEVICE_DB_LEN); + if (udev->name[0] == '\0') + return -1; return 0; } -int udevdb_delete_dev(const char *path) +int udevdb_get_dev(struct udevice *udev) { - TDB_DATA key; - char keystr[SYSFS_PATH_MAX]; - - if (udevdb == NULL) - return -1; - - if (path == NULL) - return -EINVAL; + char filename[SYSFS_PATH_MAX]; - memset(keystr, 0, sizeof(keystr)); - strfieldcpy(keystr, path); + get_db_filename(udev, filename, SYSFS_PATH_MAX); - key.dptr = keystr; - key.dsize = strlen(keystr) + 1; - - return tdb_delete(udevdb, key); + return parse_db_file(udev, filename); } -/** - * udevdb_exit: closes database - */ -void udevdb_exit(void) +int udevdb_delete_dev(struct udevice *udev) { - if (udevdb != NULL) { - tdb_close(udevdb); - udevdb = NULL; - } -} + char filename[SYSFS_PATH_MAX]; + + get_db_filename(udev, filename, SYSFS_PATH_MAX); + unlink(filename); -/** - * udevdb_init: initializes database - * @init_flag: UDEVDB_INTERNAL - database stays in memory - * UDEVDB_DEFAULT - database is written to a file - */ -int udevdb_init(int init_flag) -{ - if (init_flag != UDEVDB_DEFAULT && init_flag != UDEVDB_INTERNAL) - return -EINVAL; - - tdb_set_lock_alarm(&gotalarm); - - udevdb = tdb_open(udev_db_filename, 0, init_flag, O_RDWR | O_CREAT, 0644); - if (udevdb == NULL) { - if (init_flag == UDEVDB_INTERNAL) - dbg("unable to initialize in-memory database"); - else - dbg("unable to initialize database at '%s'", udev_db_filename); - return -EACCES; - } return 0; } -/** - * udevdb_open_ro: open database for reading - */ -int udevdb_open_ro(void) +int udevdb_get_dev_byname(struct udevice *udev, const char *name) { - udevdb = tdb_open(udev_db_filename, 0, 0, O_RDONLY, 0); - if (udevdb == NULL) { - dbg("unable to open database at '%s'", udev_db_filename); - return -EACCES; + struct dirent *ent; + DIR *dir; + char filename[NAME_SIZE]; + struct udevice db_udev; + + dir = opendir(udev_db_path); + if (dir == NULL) { + dbg("unable to udev db '%s'", udev_db_path); + return -1; } - return 0; -} -static int (*user_record_callback) (const char *path, struct udevice *dev); + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; -static int traverse_callback(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state) -{ - return user_record_callback((char*) key.dptr, (struct udevice*) dbuf.dptr); -} + if (ent->d_name[0] == '.') + continue; -/** - * udevdb_call_foreach: dumps whole database by passing record data to user function - * @user_record_handler: user function called for every record in the database - */ -int udevdb_call_foreach(int (*user_record_handler) (const char *path, struct udevice *dev)) -{ - int retval = 0; + snprintf(filename, NAME_SIZE-1, "%s/%s", udev_db_path, ent->d_name); + filename[NAME_SIZE-1] = '\0'; - if (udevdb == NULL) - return -1; + memset(&db_udev, 0x00, sizeof(struct udevice)); + if (parse_db_file(&db_udev, filename) == 0) { + char *pos; + int len; - if (user_record_handler == NULL) { - dbg("invalid user record handling function"); - return -EINVAL; - } - user_record_callback = user_record_handler; - retval = tdb_traverse(udevdb, traverse_callback, NULL); - if (retval < 0) - return -ENODEV; - else - return 0; -} + if (strncmp(name, db_udev.name, NAME_SIZE) == 0) { + goto found; + } -static struct udevice *find_dev; -static char *find_path; -static const char *find_name; -static int find_found; + foreach_strpart(db_udev.symlink, " ", pos, len) { + if (strncmp(name, pos, len) != 0) + continue; -static int find_device_by_name(const char *path, struct udevice *udev) -{ - char *pos; - int len; - - if (strncmp(udev->name, find_name, sizeof(udev->name)) == 0) { - memcpy(find_dev, udev, sizeof(struct udevice)); - strfieldcpymax(find_path, path, NAME_SIZE); - find_found = 1; - /* stop search */ - return 1; + if (len == strlen(name)) + goto found; + } + + } } - /* look for matching symlink*/ - foreach_strpart(udev->symlink, " ", pos, len) { - if (strncmp(pos, find_name, len) != 0) - continue; - if (len != strlen(find_name)) - continue; + closedir(dir); - memcpy(find_dev, udev, sizeof(struct udevice)); - strfieldcpymax(find_path, path, NAME_SIZE); - find_found = 1; - return 1; - } - return 0; -} + return -1; -/** - * udevdb_get_dev_byname: search device with given name by traversing the whole database - */ -int udevdb_get_dev_byname(const char *name, char *path, struct udevice *dev) -{ - find_found = 0; - find_path = path; - find_dev = dev; - find_name = name; - udevdb_call_foreach(find_device_by_name); - if (find_found == 1) - return 0; - else - return -1; +found: + closedir(dir); + + strfieldcpy(udev->devpath, db_udev.devpath); + strfieldcpy(udev->name, db_udev.name); + strfieldcpy(udev->symlink, db_udev.symlink); + udev->partitions = db_udev.partitions; + + return 0; } diff --git a/udevdb.h b/udevdb.h index 6986a0a113..4f6b5de90c 100644 --- a/udevdb.h +++ b/udevdb.h @@ -1,22 +1,34 @@ /* - * udevdb header file + * udevdb.h + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * */ + #ifndef _UDEVDB_H_ #define _UDEVDB_H_ -/* Udevdb initialization flags */ -#define UDEVDB_DEFAULT 0 /* defaults database to use file */ -#define UDEVDB_INTERNAL 1 /* don't store db on disk, use in memory */ - -/* function prototypes */ -extern void udevdb_exit(void); -extern int udevdb_init(int init_flag); -extern int udevdb_open_ro(void); -extern int udevdb_call_foreach(int (*user_record_handler) (const char *path, struct udevice *dev)); extern int udevdb_add_dev(struct udevice *dev); -extern int udevdb_get_dev(const char *path, struct udevice *dev); -extern int udevdb_delete_dev(const char *path); -extern int udevdb_get_dev_byname(const char *name, char *path, struct udevice *dev); +extern int udevdb_get_dev(struct udevice *dev); +extern int udevdb_delete_dev(struct udevice *dev); + +extern int udevdb_get_dev_byname(struct udevice *udev, const char *name); #endif /* _UDEVDB_H_ */ diff --git a/udevinfo.8 b/udevinfo.8 index 0588084cac..a04e6df463 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -29,7 +29,7 @@ interface. .RB Needs " \-p " or " \-n " specified. .br Valid types are: -.BR name ", " symlink ", " mode " ," owner " , " group " , " path " or " all. +.BR name ", " symlink ", " path " or " all. .TP .BI \-p " sysfs_path" Specify the sysfs path of the device to query. @@ -46,9 +46,6 @@ attributes along the device chain. Useful for finding unique attributes to compose a rule. .RB Needs " \-p " specified. .TP -.B \-d -Dump the whole database. -.TP .B \-h Print help text. .SH "FILES" diff --git a/udevinfo.c b/udevinfo.c index af2346c8f5..a90bbe1138 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -103,19 +103,11 @@ exit: return retval; } -/* callback for database dump */ -static int print_record(const char *path, struct udevice *dev) +static int print_record(struct udevice *udev) { - printf("P: %s\n", path); - printf("N: %s\n", dev->name); - printf("T: %c\n", dev->type); - printf("M: %#o\n", dev->mode); - printf("S: %s\n", dev->symlink); - printf("O: %s\n", dev->owner); - printf("G: %s\n", dev->group); - printf("F: %s\n", dev->config_file); - printf("L: %i\n", dev->config_line); - printf("U: %li\n", dev->config_uptime); + printf("P: %s\n", udev->devpath); + printf("N: %s\n", udev->name); + printf("S: %s\n", udev->symlink); printf("\n"); return 0; } @@ -125,9 +117,6 @@ enum query_type { NAME, PATH, SYMLINK, - MODE, - OWNER, - GROUP, ALL }; @@ -213,7 +202,7 @@ static int process_options(void) static const char short_options[] = "adn:p:q:rVh"; int option; int retval = 1; - struct udevice dev; + struct udevice udev; int root = 0; int attributes = 0; enum query_type query = NONE; @@ -254,21 +243,6 @@ static int process_options(void) break; } - if (strcmp(optarg, "mode") == 0) { - query = MODE; - break; - } - - if (strcmp(optarg, "owner") == 0) { - query = OWNER; - break; - } - - if (strcmp(optarg, "group") == 0) { - query = GROUP; - break; - } - if (strcmp(optarg, "path") == 0) { query = PATH; break; @@ -290,16 +264,6 @@ static int process_options(void) attributes = 1; break; - case 'd': - retval = udevdb_open_ro(); - if (retval != 0) { - printf("unable to open udev database\n"); - exit(2); - } - udevdb_call_foreach(print_record); - udevdb_exit(); - exit(0); - case 'V': printf("udevinfo, version %s\n", UDEV_VERSION); exit(0); @@ -314,12 +278,6 @@ static int process_options(void) /* process options */ if (query != NONE) { - retval = udevdb_open_ro(); - if (retval != 0) { - printf("unable to open udev database\n"); - return -EACCES; - } - if (path[0] != '\0') { /* remove sysfs_path if given */ if (strncmp(path, sysfs_path, strlen(sysfs_path)) == 0) { @@ -334,7 +292,9 @@ static int process_options(void) pos = path; } } - retval = udevdb_get_dev(pos, &dev); + memset(&udev, 0x00, sizeof(struct udevice)); + strfieldcpy(udev.devpath, pos); + retval = udevdb_get_dev(&udev); if (retval != 0) { printf("device not found in database\n"); goto exit; @@ -344,15 +304,21 @@ static int process_options(void) if (name[0] != '\0') { /* remove udev_root if given */ - if (strncmp(name, udev_root, strlen(udev_root)) == 0) { - pos = name + strlen(udev_root); + int len = strlen(udev_root); + + if (strncmp(name, udev_root, len) == 0) { + pos = &name[len+1]; } else pos = name; - retval = udevdb_get_dev_byname(pos, path, &dev); + + memset(&udev, 0x00, sizeof(struct udevice)); + strfieldcpy(udev.name, pos); + retval = udevdb_get_dev_byname(&udev, pos); if (retval != 0) { printf("device not found in database\n"); goto exit; } + goto print; } @@ -362,25 +328,16 @@ static int process_options(void) print: switch(query) { case NAME: - if (root) - strfieldcpy(result, udev_root); - strfieldcat(result, dev.name); + if (root) { + snprintf(result, NAME_SIZE-1, "%s/%s", udev_root, udev.name); + result[NAME_SIZE-1] = '\0'; + } else { + strfieldcpy(result, udev.name); + } break; case SYMLINK: - strfieldcpy(result, dev.symlink); - break; - - case MODE: - sprintf(result, "%#o", dev.mode); - break; - - case GROUP: - strfieldcpy(result, dev.group); - break; - - case OWNER: - strfieldcpy(result, dev.owner); + strfieldcpy(result, udev.symlink); break; case PATH: @@ -388,7 +345,7 @@ print: break; case ALL: - print_record(path, &dev); + print_record(&udev); goto exit; default: @@ -397,7 +354,6 @@ print: printf("%s\n", result); exit: - udevdb_exit(); return retval; } @@ -427,9 +383,6 @@ help: " -q TYPE query database for the specified value:\n" " 'name' name of device node\n" " 'symlink' pointing to node\n" - " 'mode' permissions of node\n" - " 'owner' of node\n" - " 'group' of node\n" " 'path' sysfs device path\n" " 'all' all values\n" "\n" @@ -438,7 +391,6 @@ help: "\n" " -r print udev root\n" " -a print all SYSFS_attributes along the device chain\n" - " -d dump whole database\n" " -V print udev version\n" " -h print this help text\n" "\n"); diff --git a/udevsend.c b/udevsend.c index c0c72b9c19..19922f3870 100644 --- a/udevsend.c +++ b/udevsend.c @@ -95,7 +95,7 @@ static void run_udev(const char *subsystem) switch (pid) { case 0: /* child */ - execl(UDEV_BIN, UDEV_BIN, subsystem, NULL); + execl(UDEV_BIN, "udev", subsystem, NULL); dbg("exec of child failed"); _exit(1); break; -- cgit v1.2.3-54-g00ecf From 04b49aab9addcc628381d187d0586c20a8c2cfad Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 12 Nov 2004 23:43:34 -0800 Subject: [PATCH] make spotless for releases. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index ef66213dd8..e1a4b9fe27 100644 --- a/Makefile +++ b/Makefile @@ -332,7 +332,7 @@ spotless: clean DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz" -e "\/\." -e releases -e BitKeeper -e SCCS -e test/sys | sort ) DISTDIR := $(RELEASE_NAME) srcdir = . -release: clean +release: spotless -rm -rf $(DISTDIR) mkdir $(DISTDIR) chmod 777 $(DISTDIR) @@ -342,7 +342,7 @@ release: clean @echo "$(RELEASE_NAME).tar.gz created" -small_release: $(DISTFILES) clean +small_release: $(DISTFILES) spotless # @echo $(DISTFILES) @-rm -rf $(DISTDIR) @mkdir $(DISTDIR) -- cgit v1.2.3-54-g00ecf From 4a231017ff6e9f66a685b0d1e4e49dc46645bb40 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 6 Nov 2004 14:30:15 +0100 Subject: [PATCH] pass the whole event environment to udevd Make _all_ hotplug variables available to the forked udev, the udev callouts and the udev dev.d/ scripts. We put the whole environment into a buffer and send it over the udevd socket. udevd recreates *envp[] and passes it to the exec(). --- udevd.c | 94 ++++++++++++++++++++++++++++++++++---------------------------- udevd.h | 19 +++++++++---- udevsend.c | 90 ++++++++++++++++++++++++++++++----------------------------- 3 files changed, 112 insertions(+), 91 deletions(-) diff --git a/udevd.c b/udevd.c index 395cdca88b..12fbe1725f 100644 --- a/udevd.c +++ b/udevd.c @@ -86,16 +86,6 @@ static void msg_dump_queue(void) #endif } -static struct hotplug_msg *msg_create(void) -{ - struct hotplug_msg *new_msg; - - new_msg = malloc(sizeof(struct hotplug_msg)); - if (new_msg == NULL) - dbg("error malloc"); - return new_msg; -} - static void run_queue_delete(struct hotplug_msg *msg) { list_del(&msg->list); @@ -132,22 +122,12 @@ static void msg_queue_insert(struct hotplug_msg *msg) static void udev_run(struct hotplug_msg *msg) { pid_t pid; - char action[ACTION_SIZE]; - char devpath[DEVPATH_SIZE]; - char seqnum[SEQNUM_SIZE]; - char *env[] = { action, devpath, seqnum, NULL }; - - snprintf(action, ACTION_SIZE-1, "ACTION=%s", msg->action); - action[ACTION_SIZE-1] = '\0'; - snprintf(devpath, DEVPATH_SIZE-1, "DEVPATH=%s", msg->devpath); - devpath[DEVPATH_SIZE-1] = '\0'; - sprintf(seqnum, "SEQNUM=%llu", msg->seqnum); pid = fork(); switch (pid) { case 0: /* child */ - execle(udev_bin, "udev", msg->subsystem, NULL, env); + execle(udev_bin, "udev", msg->subsystem, NULL, msg->envp); dbg("exec of child failed"); _exit(1); break; @@ -245,24 +225,23 @@ recheck: } /* receive the msg, do some basic sanity checks, and queue it */ -static void handle_msg(int sock) +static void handle_udevsend_msg(int sock) { + static struct udevsend_msg usend_msg; struct hotplug_msg *msg; - int retval; + int bufpos; + int i; + ssize_t size; struct msghdr smsg; struct cmsghdr *cmsg; struct iovec iov; struct ucred *cred; char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + int envbuf_size; - msg = msg_create(); - if (msg == NULL) { - dbg("unable to store message"); - return; - } - - iov.iov_base = msg; - iov.iov_len = sizeof(struct hotplug_msg); + memset(&usend_msg, 0x00, sizeof(struct udevsend_msg)); + iov.iov_base = &usend_msg; + iov.iov_len = sizeof(struct udevsend_msg); memset(&smsg, 0x00, sizeof(struct msghdr)); smsg.msg_iov = &iov; @@ -270,8 +249,8 @@ static void handle_msg(int sock) smsg.msg_control = cred_msg; smsg.msg_controllen = sizeof(cred_msg); - retval = recvmsg(sock, &smsg, 0); - if (retval < 0) { + size = recvmsg(sock, &smsg, 0); + if (size < 0) { if (errno != EINTR) dbg("unable to receive message"); return; @@ -281,18 +260,51 @@ static void handle_msg(int sock) if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { dbg("no sender credentials received, message ignored"); - goto skip; + goto exit; } if (cred->uid != 0) { dbg("sender uid=%i, message ignored", cred->uid); - goto skip; + goto exit; + } + + if (strncmp(usend_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { + dbg("message magic '%s' doesn't match, ignore it", usend_msg.magic); + goto exit; } - if (strncmp(msg->magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { - dbg("message magic '%s' doesn't match, ignore it", msg->magic); - goto skip; + envbuf_size = size - offsetof(struct udevsend_msg, envbuf); + dbg("envbuf_size=%i", envbuf_size); + msg = malloc(sizeof(struct hotplug_msg) + envbuf_size); + memset(msg, 0x00, sizeof(struct hotplug_msg) + envbuf_size); + + /* copy environment buffer and reconstruct envp */ + memcpy(msg->envbuf, usend_msg.envbuf, envbuf_size); + bufpos = 0; + for (i = 0; (bufpos < envbuf_size) && (i < HOTPLUG_NUM_ENVP-1); i++) { + int keylen; + char *key; + + key = &msg->envbuf[bufpos]; + keylen = strlen(key); + msg->envp[i] = key; + bufpos += keylen + 1; + dbg("add '%s' to msg.envp[%i]", msg->envp[i], i); + + /* remember some keys for further processing */ + if (strncmp(key, "ACTION=", 7) == 0) + msg->action = &key[7]; + + if (strncmp(key, "DEVPATH=", 8) == 0) + msg->devpath = &key[8]; + + if (strncmp(key, "SUBSYSTEM=", 10) == 0) + msg->subsystem = &key[10]; + + if (strncmp(key, "SEQNUM=", 7) == 0) + msg->seqnum = strtoull(&key[7], NULL, 10); } + msg->envp[i] = NULL; /* if no seqnum is given, we move straight to exec queue */ if (msg->seqnum == 0) { @@ -301,10 +313,8 @@ static void handle_msg(int sock) } else { msg_queue_insert(msg); } - return; -skip: - free(msg); +exit: return; } @@ -511,7 +521,7 @@ int main(int argc, char *argv[], char *envp[]) } if (FD_ISSET(ssock, &workreadfds)) - handle_msg(ssock); + handle_udevsend_msg(ssock); if (FD_ISSET(pipefds[0], &workreadfds)) user_sighandler(); diff --git a/udevd.h b/udevd.h index 657f684e3f..b393a28bf9 100644 --- a/udevd.h +++ b/udevd.h @@ -30,14 +30,23 @@ #define SEND_WAIT_MAX_SECONDS 3 #define SEND_WAIT_LOOP_PER_SECOND 10 +/* environment buffer, should match the kernel's size in lib/kobject_uevent.h */ +#define HOTPLUG_BUFFER_SIZE 1024 +#define HOTPLUG_NUM_ENVP 32 -struct hotplug_msg { +struct udevsend_msg { char magic[20]; + char envbuf[HOTPLUG_BUFFER_SIZE]; +}; + +struct hotplug_msg { struct list_head list; pid_t pid; - unsigned long long seqnum; long queue_time; - char action[ACTION_SIZE]; - char devpath[DEVPATH_SIZE]; - char subsystem[SUBSYSTEM_SIZE]; + char *action; + char *devpath; + char *subsystem; + unsigned long long seqnum; + char *envp[HOTPLUG_NUM_ENVP]; + char envbuf[]; }; diff --git a/udevsend.c b/udevsend.c index 19922f3870..7db2378b83 100644 --- a/udevsend.c +++ b/udevsend.c @@ -70,7 +70,7 @@ static int start_daemon(void) chdir("/"); execl(UDEVD_BIN, "udevd", NULL); dbg("exec of daemon failed"); - exit(1); + _exit(1); case -1: dbg("fork of daemon failed"); return -1; @@ -107,51 +107,29 @@ static void run_udev(const char *subsystem) } } -int main(int argc, char* argv[]) +int main(int argc, char *argv[], char *envp[]) { - struct hotplug_msg msg; - char *action; - char *devpath; - char *subsystem; - char *seqnum; - unsigned long long seq; - int retval = 1; + static struct udevsend_msg usend_msg; + int usend_msg_len; + int i; int loop; - int sock = -1; struct sockaddr_un saddr; socklen_t addrlen; + const char *subsystem_argv; + int subsystem_env = 0; + int bufpos = 0; + int retval = 1; + int sock = -1; int started_daemon = 0; logging_init("udevsend"); dbg("version %s", UDEV_VERSION); - subsystem = get_subsystem(argv[1]); - if (subsystem == NULL) { + subsystem_argv = argv[1]; + if (subsystem_argv == NULL) { dbg("no subsystem"); goto exit; } - dbg("subsystem = '%s'", subsystem); - - devpath = get_devpath(); - if (devpath == NULL) { - dbg("no devpath"); - goto exit; - } - dbg("DEVPATH = '%s'", devpath); - - action = get_action(); - if (action == NULL) { - dbg("no action"); - goto exit; - } - dbg("ACTION = '%s'", action); - - seqnum = get_seqnum(); - if (seqnum == NULL) - seq = 0; - else - seq = strtoull(seqnum, NULL, 10); - dbg("SEQNUM = '%llu'", seq); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { @@ -167,25 +145,49 @@ int main(int argc, char* argv[]) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - memset(&msg, 0x00, sizeof(struct hotplug_msg)); - strcpy(msg.magic, UDEV_MAGIC); - msg.seqnum = seq; - strfieldcpy(msg.action, action); - strfieldcpy(msg.devpath, devpath); - strfieldcpy(msg.subsystem, subsystem); + memset(&usend_msg, 0x00, sizeof(struct udevsend_msg)); + + strcpy(usend_msg.magic, UDEV_MAGIC); + + /* copy all keys to send buffer */ + for (i = 0; envp[i]; i++) { + const char *key; + int keylen; + + key = envp[i]; + keylen = strlen(key); + if (bufpos + keylen >= HOTPLUG_BUFFER_SIZE-1) { + dbg("environment buffer too small, probably not called by the kernel"); + continue; + } + + /* older kernels do not have the SUBSYSTEM in the environment */ + if (strncmp(key, "SUBSYSTEM=", 10) == 0) + subsystem_env = 1; + + dbg("add '%s' to env[%i] buffer", key, i); + strcpy(&usend_msg.envbuf[bufpos], key); + bufpos += keylen + 1; + } + if (!subsystem_env) { + bufpos += sprintf(&usend_msg.envbuf[bufpos], "SUBSYSTEM=%s", subsystem_argv) + 1; + dbg("add 'SUBSYSTEM=%s' to env[%i] buffer from argv", subsystem_argv, i); + } + + usend_msg_len = offsetof(struct udevsend_msg, envbuf) + bufpos; + dbg("usend_msg_len=%i", usend_msg_len); /* If we can't send, try to start daemon and resend message */ loop = SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND; while (--loop) { - retval = sendto(sock, &msg, sizeof(struct hotplug_msg), 0, - (struct sockaddr *)&saddr, addrlen); + retval = sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen); if (retval != -1) { retval = 0; goto exit; } if (errno != ECONNREFUSED) { - dbg("error sending message"); + dbg("error sending message (%s)", strerror(errno)); goto fallback; } @@ -206,7 +208,7 @@ int main(int argc, char* argv[]) fallback: info("unable to connect to event daemon, try to call udev directly"); - run_udev(subsystem); + run_udev(subsystem_argv); exit: if (sock != -1) -- cgit v1.2.3-54-g00ecf From f156b6d2037ff09f7218e11d5326c05488356ea1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 9 Nov 2004 12:11:46 +0100 Subject: [PATCH] add sysfs info walk to udevinfo The option "-s" will get information about the major/minor, the physical device, the bus value and the driver from sysfs for all class and block devices: kay@pim udev.kay]$ ./udevinfo -s DEVPATH '/sys/block/sda' SUBSYSTEM 'block' NAME 'sda' MAJORMINOR '8:0' PHYSDEVPATH '/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0/host2/target2:0:0/2:0:0:0' PHYSDEVPATHBUS 'scsi' DRIVER 'sd' DEVPATH '/sys/class/input/mice' SUBSYSTEM 'input' NAME 'mice' MAJORMINOR '13:63' DEVPATH '/sys/class/input/mouse0' SUBSYSTEM 'input' NAME 'mouse0' MAJORMINOR '13:32' ... --- udevinfo.8 | 4 ++++ udevinfo.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/udevinfo.8 b/udevinfo.8 index a04e6df463..599a0033f8 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -46,6 +46,10 @@ attributes along the device chain. Useful for finding unique attributes to compose a rule. .RB Needs " \-p " specified. .TP +.B \-s +Print all sysfs devices with the major/minor number, the physical device and +the bus value. +.TP .B \-h Print help text. .SH "FILES" diff --git a/udevinfo.c b/udevinfo.c index a90bbe1138..f1b74fc8f6 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -197,9 +197,67 @@ exit: return retval; } +/* print all class/block devices with major/minor, physical device and bus*/ +static void print_sysfs_devices(void) +{ + struct dlist *subsyslist; + char *class; + + subsyslist = sysfs_open_subsystem_list("class"); + if (!subsyslist) + exit(1); + + dlist_for_each_data(subsyslist, class, char) { + struct sysfs_class *cls; + struct dlist *class_devices; + struct sysfs_class_device *class_dev; + struct sysfs_device *phys_dev; + + cls = sysfs_open_class(class); + if (!cls) + continue; + + class_devices = sysfs_get_class_devices(cls); + if (!class_devices) + continue; + + dlist_for_each_data(class_devices, class_dev, struct sysfs_class_device) { + struct sysfs_attribute *attr; + + printf("\n"); + printf("DEVPATH '%s'\n", class_dev->path); + printf("SUBSYSTEM '%s'\n", class_dev->classname); + printf("NAME '%s'\n", class_dev->name); + + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr) { + char *pos = &(attr->value[strlen(attr->value)-1]); + + if (pos[0] == '\n') + pos[0] = '\0'; + + printf("MAJORMINOR '%s'\n", attr->value); + } + + phys_dev = sysfs_get_classdev_device(class_dev); + if (phys_dev) { + printf("PHYSDEVPATH '%s'\n", phys_dev->path); + if (phys_dev->bus[0] != '\0') + printf("PHYSDEVPATHBUS '%s'\n", phys_dev->bus); + if (phys_dev->driver_name[0] != '\0') + printf("DRIVER '%s'\n", phys_dev->driver_name); + } + } + + sysfs_close_class(cls); + } + + sysfs_close_list(subsyslist); +} + static int process_options(void) { - static const char short_options[] = "adn:p:q:rVh"; + static const char short_options[] = "adn:p:q:rsVh"; int option; int retval = 1; struct udevice udev; @@ -260,6 +318,10 @@ static int process_options(void) root = 1; break; + case 's': + print_sysfs_devices(); + exit(0); + case 'a': attributes = 1; break; @@ -391,6 +453,7 @@ help: "\n" " -r print udev root\n" " -a print all SYSFS_attributes along the device chain\n" + " -s print all sysfs devices with major/minor, physical device and bus\n" " -V print udev version\n" " -h print this help text\n" "\n"); -- cgit v1.2.3-54-g00ecf From 3bdef3939d6501b26dac82fdc6f8e74d854a1f14 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 10 Nov 2004 02:15:27 +0100 Subject: [PATCH] improve udevinfo sysfs info walk --- udevinfo.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index f1b74fc8f6..8fab86ca8c 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -197,21 +197,22 @@ exit: return retval; } -/* print all class/block devices with major/minor, physical device and bus*/ -static void print_sysfs_devices(void) +/* print all class/main block devices with major/minor, physical device, driver and bus */ +static int print_sysfs_devices(void) { struct dlist *subsyslist; char *class; subsyslist = sysfs_open_subsystem_list("class"); if (!subsyslist) - exit(1); + return -1; dlist_for_each_data(subsyslist, class, char) { struct sysfs_class *cls; struct dlist *class_devices; struct sysfs_class_device *class_dev; struct sysfs_device *phys_dev; + struct sysfs_driver *driver; cls = sysfs_open_class(class); if (!cls) @@ -227,7 +228,6 @@ static void print_sysfs_devices(void) printf("\n"); printf("DEVPATH '%s'\n", class_dev->path); printf("SUBSYSTEM '%s'\n", class_dev->classname); - printf("NAME '%s'\n", class_dev->name); attr = sysfs_get_classdev_attr(class_dev, "dev"); if (attr) { @@ -236,23 +236,25 @@ static void print_sysfs_devices(void) if (pos[0] == '\n') pos[0] = '\0'; - printf("MAJORMINOR '%s'\n", attr->value); + printf("DEVMAJORMINOR '%s'\n", attr->value); } + driver = sysfs_get_classdev_driver(class_dev); + if (driver) + printf("DEVDRIVER '%s'\n", driver->name); + phys_dev = sysfs_get_classdev_device(class_dev); if (phys_dev) { printf("PHYSDEVPATH '%s'\n", phys_dev->path); if (phys_dev->bus[0] != '\0') - printf("PHYSDEVPATHBUS '%s'\n", phys_dev->bus); - if (phys_dev->driver_name[0] != '\0') - printf("DRIVER '%s'\n", phys_dev->driver_name); + printf("PHYSDEVBUS '%s'\n", phys_dev->bus); } } - sysfs_close_class(cls); } - sysfs_close_list(subsyslist); + + return 0; } static int process_options(void) -- cgit v1.2.3-54-g00ecf From 38753167e4e49879f97003f075158cc642bf0b0d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 10 Nov 2004 09:44:58 +0100 Subject: [PATCH] let udev act as udevstart if argv[1] == "udevstart" "udev udevstart" will run udev as udevstart. This makes it easier to run a test in the source tree without the need to create a symlink. --- udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.c b/udev.c index d8cb4365fd..b54896669b 100644 --- a/udev.c +++ b/udev.c @@ -91,7 +91,7 @@ int main(int argc, char *argv[], char *envp[]) udev_init_config(); - if (strstr(argv[0], "udevstart")) { + if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) { act_type = UDEVSTART; } else { const char *action = get_action(); -- cgit v1.2.3-54-g00ecf From 31fd340352236c06c30a85fa9fbdbfbbd10bd439 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 10 Nov 2004 10:19:39 +0100 Subject: [PATCH] make udevinfo's -r option also workimg for symlink queries [kay@pim udev.kay]$ ./udevinfo -r -q symlink -p /class/video4linux/video0 /dev/camera0 /dev/kamera0 /dev/videocam0 /dev/webcam0 [kay@pim udev.kay]$ ./udevinfo -q symlink -p /class/video4linux/video0 camera0 kamera0 videocam0 webcam0 --- udevinfo.8 | 5 +++-- udevinfo.c | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/udevinfo.8 b/udevinfo.8 index 599a0033f8..bbcc3d8f49 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -19,9 +19,10 @@ Print the version information. .B \-r Print the .B udev_root -directory. When used in conjunction with a query for the node name, the +directory. When used in conjunction with a query for the node name or the +symlink names, the .B udev_root -will be prepended. +will be prepended to query result. .TP .BI \-q " query_type" Query the database for specified value of a created device node or network diff --git a/udevinfo.c b/udevinfo.c index 8fab86ca8c..290a09e880 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -266,7 +266,7 @@ static int process_options(void) int root = 0; int attributes = 0; enum query_type query = NONE; - char result[NAME_SIZE] = ""; + char result[1024] = ""; char path[NAME_SIZE] = ""; char name[NAME_SIZE] = ""; char temp[NAME_SIZE]; @@ -401,7 +401,20 @@ print: break; case SYMLINK: - strfieldcpy(result, udev.symlink); + if (root) { + int slen; + char *spos; + char slink[NAME_SIZE]; + + pos = result; + foreach_strpart(udev.symlink, " \n\r", spos, slen) { + strncpy(slink, spos, slen); + slink[slen] = '\0'; + pos += sprintf(pos, "%s/%s ", udev_root, slink); + } + } else { + strfieldcpy(result, udev.symlink); + } break; case PATH: -- cgit v1.2.3-54-g00ecf From c6478ec1e128f0a92c2123ed110a651b88d43569 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 12 Nov 2004 06:17:35 +0100 Subject: [PATCH] add ACTION to udev object to expose it to the whole process --- udev.c | 8 ++++---- udev.h | 5 +++-- udev_lib.c | 54 +++--------------------------------------------------- udev_lib.h | 8 ++------ udevstart.c | 2 +- udevtest.c | 2 +- 6 files changed, 14 insertions(+), 65 deletions(-) diff --git a/udev.c b/udev.c index b54896669b..480a1cdca2 100644 --- a/udev.c +++ b/udev.c @@ -94,9 +94,9 @@ int main(int argc, char *argv[], char *envp[]) if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) { act_type = UDEVSTART; } else { - const char *action = get_action(); - const char *devpath = get_devpath(); - const char *subsystem = get_subsystem(main_argv[1]); + const char *action = getenv("ACTION"); + const char *devpath = getenv("DEVPATH"); + const char *subsystem = argv[1]; if (!action) { dbg("no action?"); @@ -128,7 +128,7 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - udev_set_values(&udev, devpath, subsystem); + udev_set_values(&udev, devpath, subsystem, action); /* skip blacklisted subsystems */ if (udev.type != 'n' && subsystem_expect_no_dev(subsystem)) { diff --git a/udev.h b/udev.h index 1cf4ad7eae..3f9f2c8612 100644 --- a/udev.h +++ b/udev.h @@ -30,8 +30,8 @@ #define COMMENT_CHARACTER '#' #define NAME_SIZE 256 -#define OWNER_SIZE 30 -#define GROUP_SIZE 30 +#define OWNER_SIZE 32 +#define GROUP_SIZE 32 #define MODE_SIZE 8 #define ACTION_SIZE 32 @@ -44,6 +44,7 @@ struct udevice { char devpath[DEVPATH_SIZE]; char subsystem[SUBSYSTEM_SIZE]; + char action[ACTION_SIZE]; char name[NAME_SIZE]; char owner[OWNER_SIZE]; char group[GROUP_SIZE]; diff --git a/udev_lib.c b/udev_lib.c index 7fb45f0b5f..951d36b1d7 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -35,56 +35,6 @@ #include "list.h" -char *get_action(void) -{ - char *action; - - action = getenv("ACTION"); - if (action != NULL && strlen(action) > ACTION_SIZE) - action[ACTION_SIZE-1] = '\0'; - - return action; -} - -char *get_devpath(void) -{ - char *devpath; - - devpath = getenv("DEVPATH"); - if (devpath != NULL && strlen(devpath) > DEVPATH_SIZE) - devpath[DEVPATH_SIZE-1] = '\0'; - - return devpath; -} - -char *get_devname(void) -{ - char *devname; - - devname = getenv("DEVNAME"); - if (devname != NULL && strlen(devname) > NAME_SIZE) - devname[NAME_SIZE-1] = '\0'; - - return devname; -} - -char *get_seqnum(void) -{ - char *seqnum; - - seqnum = getenv("SEQNUM"); - - return seqnum; -} - -char *get_subsystem(char *subsystem) -{ - if (subsystem != NULL && strlen(subsystem) > SUBSYSTEM_SIZE) - subsystem[SUBSYSTEM_SIZE-1] = '\0'; - - return subsystem; -} - #define BLOCK_PATH "/block/" #define CLASS_PATH "/class/" #define NET_PATH "/class/net/" @@ -112,11 +62,13 @@ char get_device_type(const char *path, const char *subsystem) return '\0'; } -void udev_set_values(struct udevice *udev, const char* devpath, const char *subsystem) +void udev_set_values(struct udevice *udev, const char* devpath, + const char *subsystem, const char* action) { memset(udev, 0x00, sizeof(struct udevice)); strfieldcpy(udev->devpath, devpath); strfieldcpy(udev->subsystem, subsystem); + strfieldcpy(udev->action, action); udev->type = get_device_type(devpath, subsystem); } diff --git a/udev_lib.h b/udev_lib.h index 94649b645f..30d839461a 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -76,13 +76,9 @@ do { \ # define asmlinkage /* nothing */ #endif -extern char *get_action(void); -extern char *get_devpath(void); -extern char *get_devname(void); -extern char *get_seqnum(void); -extern char *get_subsystem(char *subsystem); extern char get_device_type(const char *path, const char *subsystem); -extern void udev_set_values(struct udevice *udev, const char* devpath, const char *subsystem); +extern void udev_set_values(struct udevice *udev, const char* devpath, + const char *subsystem, const char* action); extern int create_path(const char *path); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); diff --git a/udevstart.c b/udevstart.c index fd490f0791..e05680aa93 100644 --- a/udevstart.c +++ b/udevstart.c @@ -110,7 +110,7 @@ static int add_device(char *devpath, char *subsystem) return -ENODEV; } - udev_set_values(&udev, devpath, subsystem); + udev_set_values(&udev, devpath, subsystem, "add"); udev_add_device(&udev, class_dev); /* run scripts */ diff --git a/udevtest.c b/udevtest.c index 8af2120fb1..e67af0df67 100644 --- a/udevtest.c +++ b/udevtest.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[], char *envp[]) subsystem = argv[2]; /* fill in values and test_run flag*/ - udev_set_values(&udev, devpath, subsystem); + udev_set_values(&udev, devpath, subsystem, "add"); /* open the device */ snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); -- cgit v1.2.3-54-g00ecf From 13f24d596c5638443ffc7bc48c10a66758335c74 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 12 Nov 2004 06:18:28 +0100 Subject: [PATCH] remove udev_lib dependency from udevsend, which makes it smaller --- Makefile | 2 +- udev_lib.c | 19 ------------------- udev_lib.h | 1 - udevd.c | 31 ++++++++++++++----------------- udevsend.c | 9 ++++----- 5 files changed, 19 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index e1a4b9fe27..50c72279f8 100644 --- a/Makefile +++ b/Makefile @@ -300,7 +300,7 @@ $(DAEMON): $(LIBC) $(DAEMON).o $(OBJS) udevd.h $(QUIET) $(STRIPCMD) $@ $(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o udev_lib.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(WAIT): $(WAIT).o $(OBJS) $(HEADERS) $(LIBC) diff --git a/udev_lib.c b/udev_lib.c index 951d36b1d7..84daf9fd19 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -229,22 +229,3 @@ int call_foreach_file(int fnct(char *f) , char *dirname, char *suffix) closedir(dir); return 0; } - -/* Set the FD_CLOEXEC flag of desc if value is nonzero, - or clear the flag if value is 0. - Return 0 on success, or -1 on error with errno set. */ - -int set_cloexec_flag (int desc, int value) -{ - int oldflags = fcntl (desc, F_GETFD, 0); - /* If reading the flags failed, return error indication now. */ - if (oldflags < 0) - return oldflags; - /* Set just the flag we want to set. */ - if (value != 0) - oldflags |= FD_CLOEXEC; - else - oldflags &= ~FD_CLOEXEC; - /* Store modified flag word in the descriptor. */ - return fcntl (desc, F_SETFD, oldflags); -} diff --git a/udev_lib.h b/udev_lib.h index 30d839461a..3777a7caa3 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -85,6 +85,5 @@ extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); extern void no_trailing_slash(char *path); extern int call_foreach_file(int fnct(char *f) , char *filename, char *extension); -extern int set_cloexec_flag (int desc, int value); #endif diff --git a/udevd.c b/udevd.c index 12fbe1725f..43f3f0324b 100644 --- a/udevd.c +++ b/udevd.c @@ -43,6 +43,9 @@ #include "udevd.h" #include "logging.h" +/* global variables*/ +static int udevsendsock; + static int pipefds[2]; static unsigned long long expected_seqnum = 0; static volatile int sigchilds_waiting; @@ -127,6 +130,7 @@ static void udev_run(struct hotplug_msg *msg) switch (pid) { case 0: /* child */ + close(udevsendsock); execle(udev_bin, "udev", msg->subsystem, NULL, msg->envp); dbg("exec of child failed"); _exit(1); @@ -397,7 +401,7 @@ static void user_sighandler(void) int main(int argc, char *argv[], char *envp[]) { - int ssock, maxsockplus; + int maxsockplus; struct sockaddr_un saddr; socklen_t addrlen; int retval, fd; @@ -476,28 +480,21 @@ int main(int argc, char *argv[], char *envp[]) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - ssock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (ssock == -1) { + udevsendsock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udevsendsock == -1) { dbg("error getting socket, exit"); exit(1); } - set_cloexec_flag(ssock, 1); - /* the bind takes care of ensuring only one copy running */ - retval = bind(ssock, (struct sockaddr *) &saddr, addrlen); + retval = bind(udevsendsock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { dbg("bind failed, exit"); goto exit; } - retval = fcntl(ssock, F_SETFD, FD_CLOEXEC); - if (retval < 0) { - dbg("error fcntl on ssock: %s", strerror(errno)); - exit(1); - } /* enable receiving of the sender credentials */ - setsockopt(ssock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); + setsockopt(udevsendsock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); /* possible override of udev binary, used for testing */ udev_bin = getenv("UDEV_BIN"); @@ -507,9 +504,9 @@ int main(int argc, char *argv[], char *envp[]) udev_bin = UDEV_BIN; FD_ZERO(&readfds); - FD_SET(ssock, &readfds); + FD_SET(udevsendsock, &readfds); FD_SET(pipefds[0], &readfds); - maxsockplus = ssock+1; + maxsockplus = udevsendsock+1; while (1) { fd_set workreadfds = readfds; retval = select(maxsockplus, &workreadfds, NULL, NULL, NULL); @@ -520,8 +517,8 @@ int main(int argc, char *argv[], char *envp[]) continue; } - if (FD_ISSET(ssock, &workreadfds)) - handle_udevsend_msg(ssock); + if (FD_ISSET(udevsendsock, &workreadfds)) + handle_udevsend_msg(udevsendsock); if (FD_ISSET(pipefds[0], &workreadfds)) user_sighandler(); @@ -548,7 +545,7 @@ int main(int argc, char *argv[], char *envp[]) } } exit: - close(ssock); + close(udevsendsock); logging_close(); return 1; } diff --git a/udevsend.c b/udevsend.c index 7db2378b83..9f324077b3 100644 --- a/udevsend.c +++ b/udevsend.c @@ -41,6 +41,9 @@ #include "udevd.h" #include "logging.h" +/* global variables */ +static int sock = -1; + #ifdef LOG unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) @@ -66,8 +69,7 @@ static int start_daemon(void) switch (child_pid) { case 0: /* daemon */ - setsid(); - chdir("/"); + close(sock); execl(UDEVD_BIN, "udevd", NULL); dbg("exec of daemon failed"); _exit(1); @@ -119,7 +121,6 @@ int main(int argc, char *argv[], char *envp[]) int subsystem_env = 0; int bufpos = 0; int retval = 1; - int sock = -1; int started_daemon = 0; logging_init("udevsend"); @@ -137,8 +138,6 @@ int main(int argc, char *argv[], char *envp[]) goto fallback; } - set_cloexec_flag(sock, 1); - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ -- cgit v1.2.3-54-g00ecf From af4b05d4917fdfa55eff3d8d53a830464d8162a1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 12 Nov 2004 06:20:22 +0100 Subject: [PATCH] make the udev object available to more processing stages Remove the overwriting of main_argv[] hack and use the values from the udev object. Pass the udev object to call_foreach_file(). In the udevstart case, export SUBSYSTEM and UDEVSTART to the environment. --- dev_d.c | 20 ++++++++------------ namedev.c | 6 +++--- namedev_parse.c | 16 ++++++++-------- udev.c | 9 --------- udev.h | 2 -- udev_lib.c | 12 +++++++----- udev_lib.h | 5 ++++- udevinfo.c | 16 +++++----------- udevstart.c | 15 +++++++-------- udevtest.c | 7 ------- 10 files changed, 42 insertions(+), 66 deletions(-) diff --git a/dev_d.c b/dev_d.c index 6e35f55ca2..1108c8cee4 100644 --- a/dev_d.c +++ b/dev_d.c @@ -35,13 +35,13 @@ #define DEVD_DIR "/etc/dev.d/" #define DEVD_SUFFIX ".dev" -static int run_program(char *name) +static int run_program(const char *filename, void *data) { pid_t pid; int fd; - char *argv[3]; + struct udevice *udev = data; - dbg("running %s", name); + dbg("running %s", filename); pid = fork(); switch (pid) { @@ -55,11 +55,7 @@ static int run_program(char *name) } close(fd); - argv[0] = name; - argv[1] = main_argv[1]; - argv[2] = NULL; - - execv(name, argv); + execl(filename, filename, udev->subsystem, NULL); dbg("exec of child failed"); _exit(1); case -1: @@ -105,7 +101,7 @@ void dev_d_execute(struct udevice *udev) temp[0] = '\0'; strcpy(dirname, DEVD_DIR); strfieldcat(dirname, devname); - call_foreach_file(run_program, dirname, DEVD_SUFFIX); + call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev); temp[0] = '/'; ++temp; @@ -114,12 +110,12 @@ void dev_d_execute(struct udevice *udev) strcpy(dirname, DEVD_DIR); strfieldcat(dirname, udev->name); - call_foreach_file(run_program, dirname, DEVD_SUFFIX); + call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev); strcpy(dirname, DEVD_DIR); strfieldcat(dirname, udev->subsystem); - call_foreach_file(run_program, dirname, DEVD_SUFFIX); + call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev); strcpy(dirname, DEVD_DIR "default"); - call_foreach_file(run_program, dirname, DEVD_SUFFIX); + call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev); } diff --git a/namedev.c b/namedev.c index d63e36e18a..268a3d5be6 100644 --- a/namedev.c +++ b/namedev.c @@ -358,7 +358,7 @@ static void fix_kernel_name(struct udevice *udev) } } -static int execute_program(const char *path, char *value, int len) +static int execute_program(struct udevice *udev, const char *path, char *value, int len) { int retval; int count; @@ -391,7 +391,7 @@ static int execute_program(const char *path, char *value, int len) dbg("execute '%s' with parsed arguments", arg); } else { argv[0] = arg; - argv[1] = main_argv[1]; + argv[1] = udev->subsystem; argv[2] = NULL; dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); } @@ -655,7 +655,7 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas dbg("check " FIELD_PROGRAM); strfieldcpy(program, dev->program); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - if (execute_program(program, udev->program_result, NAME_SIZE) != 0) { + if (execute_program(udev, program, udev->program_result, NAME_SIZE) != 0) { dbg(FIELD_PROGRAM " returned nonzero"); goto try_parent; } else { diff --git a/namedev_parse.c b/namedev_parse.c index 22e3523f3d..73828a83b2 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -142,7 +142,7 @@ static char *get_key_attribute(char *str) return NULL; } -static int namedev_parse_rules(char *filename) +static int namedev_parse_rules(const char *filename, void *data) { char line[LINE_SIZE]; char *bufline; @@ -343,7 +343,7 @@ error: return retval; } -static int namedev_parse_permissions(char *filename) +static int namedev_parse_permissions(const char *filename, void *data) { char line[LINE_SIZE]; char *bufline; @@ -447,10 +447,10 @@ int namedev_init_rules(void) stat(udev_rules_filename, &stats); if ((stats.st_mode & S_IFMT) != S_IFDIR) - return namedev_parse_rules(udev_rules_filename); + return namedev_parse_rules(udev_rules_filename, NULL); else - return call_foreach_file(namedev_parse_rules, - udev_rules_filename, RULEFILE_SUFFIX); + return call_foreach_file(namedev_parse_rules, udev_rules_filename, + RULEFILE_SUFFIX, NULL); } int namedev_init_permissions(void) @@ -459,8 +459,8 @@ int namedev_init_permissions(void) stat(udev_permissions_filename, &stats); if ((stats.st_mode & S_IFMT) != S_IFDIR) - return namedev_parse_permissions(udev_permissions_filename); + return namedev_parse_permissions(udev_permissions_filename, NULL); else - return call_foreach_file(namedev_parse_permissions, - udev_permissions_filename, PERMFILE_SUFFIX); + return call_foreach_file(namedev_parse_permissions, udev_permissions_filename, + PERMFILE_SUFFIX, NULL); } diff --git a/udev.c b/udev.c index 480a1cdca2..300e85ceb0 100644 --- a/udev.c +++ b/udev.c @@ -39,10 +39,6 @@ #include "udevdb.h" -/* global variables */ -char **main_argv; -char **main_envp; - #ifdef LOG unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) @@ -83,12 +79,7 @@ int main(int argc, char *argv[], char *envp[]) } act_type; dbg("version %s", UDEV_VERSION); - - main_argv = argv; - main_envp = envp; - logging_init("udev"); - udev_init_config(); if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) { diff --git a/udev.h b/udev.h index 3f9f2c8612..d031b9699c 100644 --- a/udev.h +++ b/udev.h @@ -73,8 +73,6 @@ extern int udev_start(void); extern int parse_get_pair(char **orig_string, char **left, char **right); extern void dev_d_execute(struct udevice *udev); -extern char **main_argv; -extern char **main_envp; extern char sysfs_path[SYSFS_PATH_MAX]; extern char udev_root[PATH_MAX]; extern char udev_db_path[PATH_MAX+NAME_MAX]; diff --git a/udev_lib.c b/udev_lib.c index 84daf9fd19..012d60b0ea 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -178,12 +178,12 @@ static int file_list_insert(char *filename, struct list_head *file_list) } /* calls function for every file found in specified directory */ -int call_foreach_file(int fnct(char *f) , char *dirname, char *suffix) +int call_foreach_file(file_fnct_t fnct, const char *dirname, + const char *suffix, void *data) { struct dirent *ent; DIR *dir; char *ext; - char file[NAME_SIZE]; struct files *loop_file; struct files *tmp_file; LIST_HEAD(file_list); @@ -217,10 +217,12 @@ int call_foreach_file(int fnct(char *f) , char *dirname, char *suffix) /* call function for every file in the list */ list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { - snprintf(file, NAME_SIZE-1, "%s/%s", dirname, loop_file->name); - file[NAME_SIZE-1] = '\0'; + char filename[NAME_SIZE]; - fnct(file); + snprintf(filename, NAME_SIZE-1, "%s/%s", dirname, loop_file->name); + filename[NAME_SIZE-1] = '\0'; + + fnct(filename, data); list_del(&loop_file->list); free(loop_file); diff --git a/udev_lib.h b/udev_lib.h index 3777a7caa3..2bc9ba82ab 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -84,6 +84,9 @@ extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); extern void no_trailing_slash(char *path); -extern int call_foreach_file(int fnct(char *f) , char *filename, char *extension); + +typedef int (*file_fnct_t)(const char *filename, void *data); +extern int call_foreach_file(file_fnct_t fnct, const char *dirname, + const char *suffix, void *data); #endif diff --git a/udevinfo.c b/udevinfo.c index 290a09e880..1148272743 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -36,10 +36,7 @@ #include "udevdb.h" -# define SYSFS_VALUE_MAX 200 - -char **main_argv; -int main_argc; +#define SYSFS_VALUE_SIZE 256 #ifdef LOG unsigned char logname[LOGNAME_SIZE]; @@ -58,7 +55,7 @@ static int print_all_attributes(const char *path) struct dlist *attributes; struct sysfs_attribute *attr; struct sysfs_directory *sysfs_dir; - char value[SYSFS_VALUE_MAX]; + char value[SYSFS_VALUE_SIZE]; int len; int retval = 0; @@ -257,7 +254,7 @@ static int print_sysfs_devices(void) return 0; } -static int process_options(void) +static int process_options(int argc, char *argv[]) { static const char short_options[] = "adn:p:q:rsVh"; int option; @@ -274,7 +271,7 @@ static int process_options(void) /* get command line options */ while (1) { - option = getopt(main_argc, main_argv, short_options); + option = getopt(argc, argv, short_options); if (option == -1) break; @@ -479,15 +476,12 @@ int main(int argc, char *argv[], char *envp[]) { int rc = 0; - main_argv = argv; - main_argc = argc; - logging_init("udevinfo"); /* initialize our configuration */ udev_init_config(); - rc = process_options(); + rc = process_options(argc, argv); logging_close(); exit(rc); diff --git a/udevstart.c b/udevstart.c index e05680aa93..0433e568d4 100644 --- a/udevstart.c +++ b/udevstart.c @@ -92,16 +92,10 @@ static int add_device(char *devpath, char *subsystem) struct udevice udev; char path[SYSFS_PATH_MAX]; struct sysfs_class_device *class_dev; - char *argv[3]; - /* fake argument vector and environment for callouts and dev.d/ */ - argv[0] = "udev"; - argv[1] = subsystem; - argv[2] = NULL; - - main_argv = argv; + /* set environment for callouts and dev.d/ */ setenv("DEVPATH", devpath, 1); - setenv("ACTION", "add", 1); + setenv("SUBSYSTEM", subsystem, 1); snprintf(path, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); class_dev = sysfs_open_class_device_path(path); @@ -291,7 +285,12 @@ static void udev_scan_class(void) int udev_start(void) { + /* set environment for callouts and dev.d/ */ + setenv("ACTION", "add", 1); + setenv("UDEVSTART", "1", 1); + udev_scan_class(); udev_scan_block(); + return 0; } diff --git a/udevtest.c b/udevtest.c index e67af0df67..14c511584b 100644 --- a/udevtest.c +++ b/udevtest.c @@ -34,10 +34,6 @@ #include "logging.h" #include "namedev.h" -/* global variables */ -char **main_argv; -char **main_envp; - #ifdef LOG unsigned char logname[LOGNAME_SIZE]; @@ -62,9 +58,6 @@ int main(int argc, char *argv[], char *envp[]) char *subsystem = ""; struct udevice udev; - main_argv = argv; - main_envp = envp; - info("version %s", UDEV_VERSION); if (argv[1] == NULL) { -- cgit v1.2.3-54-g00ecf From 8673dcb84299fd2adba6281c5359bed4399d5b2d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 12 Nov 2004 06:21:16 +0100 Subject: [PATCH] Make dev.d/ handling a separate processing stage Move the logic when and how to call the dev.d/ scripts into the main processing path. --- dev_d.c | 38 ++++++++++++++------------------------ namedev.c | 2 +- udev.c | 9 ++++++--- udev.h | 5 ++++- udev_add.c | 6 +++--- udev_lib.c | 2 +- udev_remove.c | 6 +++--- udevdb.c | 4 ++-- udevstart.c | 10 +++++++--- wait_for_sysfs.c | 4 ++-- 10 files changed, 43 insertions(+), 43 deletions(-) diff --git a/dev_d.c b/dev_d.c index 1108c8cee4..b3d05d9220 100644 --- a/dev_d.c +++ b/dev_d.c @@ -32,9 +32,6 @@ #include "udevdb.h" #include "logging.h" -#define DEVD_DIR "/etc/dev.d/" -#define DEVD_SUFFIX ".dev" - static int run_program(const char *filename, void *data) { pid_t pid; @@ -75,7 +72,7 @@ static int run_program(const char *filename, void *data) * subsystem/ * default/ */ -void dev_d_execute(struct udevice *udev) +void dev_d_execute(struct udevice *udev, const char *basedir, const char *suffix) { char dirname[PATH_MAX]; char devname[NAME_SIZE]; @@ -85,37 +82,30 @@ void dev_d_execute(struct udevice *udev) if (udev_dev_d == 0) return; - /* skip if udev did nothing, like unchanged netif or no "dev" file */ - if (udev->devname[0] == '\0') - return; - - /* add the node name or the netif name to the environment */ - setenv("DEVNAME", udev->devname, 1); - dbg("DEVNAME='%s'", udev->devname); - strfieldcpy(devname, udev->name); - /* Chop the device name up into pieces based on '/' */ + /* chop the device name up into pieces based on '/' */ temp = strchr(devname, '/'); while (temp != NULL) { temp[0] = '\0'; - strcpy(dirname, DEVD_DIR); - strfieldcat(dirname, devname); - call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev); + snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); temp[0] = '/'; ++temp; temp = strchr(temp, '/'); } - strcpy(dirname, DEVD_DIR); - strfieldcat(dirname, udev->name); - call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev); + snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->name); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); - strcpy(dirname, DEVD_DIR); - strfieldcat(dirname, udev->subsystem); - call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev); + snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->subsystem); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); - strcpy(dirname, DEVD_DIR "default"); - call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev); + snprintf(dirname, PATH_MAX, "%s/default", basedir); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); } diff --git a/namedev.c b/namedev.c index 268a3d5be6..9c94e69082 100644 --- a/namedev.c +++ b/namedev.c @@ -204,7 +204,7 @@ static int find_free_number(struct udevice *udev, const char *name) info("find_free_number gone crazy (num=%d), aborted", num); return -1; } - snprintf(filename, NAME_SIZE-1, "%s%d", name, num); + snprintf(filename, NAME_SIZE, "%s%d", name, num); filename[NAME_SIZE-1] = '\0'; } } diff --git a/udev.c b/udev.c index 300e85ceb0..bb3385e67d 100644 --- a/udev.c +++ b/udev.c @@ -165,8 +165,11 @@ int main(int argc, char *argv[], char *envp[]) /* name, create node, store in db */ retval = udev_add_device(&udev, class_dev); - /* run scripts */ - dev_d_execute(&udev); + /* run dev.d/ scripts if we created a node or changed a netif name */ + if (udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + } sysfs_close_class_device(class_dev); break; @@ -177,7 +180,7 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_remove_device(&udev); /* run scripts */ - dev_d_execute(&udev); + dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); } exit: diff --git a/udev.h b/udev.h index d031b9699c..73733ad3bb 100644 --- a/udev.h +++ b/udev.h @@ -41,6 +41,9 @@ #define LINE_SIZE 256 +#define DEVD_DIR "/etc/dev.d" +#define DEVD_SUFFIX ".dev" + struct udevice { char devpath[DEVPATH_SIZE]; char subsystem[SUBSYSTEM_SIZE]; @@ -71,7 +74,7 @@ extern int udev_remove_device(struct udevice *udev); extern void udev_init_config(void); extern int udev_start(void); extern int parse_get_pair(char **orig_string, char **left, char **right); -extern void dev_d_execute(struct udevice *udev); +extern void dev_d_execute(struct udevice *udev, const char *basedir, const char *suffix); extern char sysfs_path[SYSFS_PATH_MAX]; extern char udev_root[PATH_MAX]; diff --git a/udev_add.c b/udev_add.c index 60506b4243..c139bd38bf 100644 --- a/udev_add.c +++ b/udev_add.c @@ -129,7 +129,7 @@ static int create_node(struct udevice *udev) char *pos; int len; - snprintf(filename, NAME_SIZE-1, "%s/%s", udev_root, udev->name); + snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); filename[NAME_SIZE-1] = '\0'; switch (udev->type) { @@ -210,7 +210,7 @@ static int create_node(struct udevice *udev) char linktarget[NAME_SIZE]; strfieldcpymax(linkname, pos, len+1); - snprintf(filename, NAME_SIZE-1, "%s/%s", udev_root, linkname); + snprintf(filename, NAME_SIZE, "%s/%s", udev_root, linkname); filename[NAME_SIZE-1] = '\0'; dbg("symlink '%s' to node '%s' requested", filename, udev->name); @@ -308,7 +308,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) "remove might not work for custom names"); /* use full path to the environment */ - snprintf(udev->devname, NAME_SIZE-1, "%s/%s", udev_root, udev->name); + snprintf(udev->devname, NAME_SIZE, "%s/%s", udev_root, udev->name); udev->devname[NAME_SIZE-1] = '\0'; } else if (udev->type == 'n') { diff --git a/udev_lib.c b/udev_lib.c index 012d60b0ea..6807f817a1 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -219,7 +219,7 @@ int call_foreach_file(file_fnct_t fnct, const char *dirname, list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { char filename[NAME_SIZE]; - snprintf(filename, NAME_SIZE-1, "%s/%s", dirname, loop_file->name); + snprintf(filename, NAME_SIZE, "%s/%s", dirname, loop_file->name); filename[NAME_SIZE-1] = '\0'; fnct(filename, data); diff --git a/udev_remove.c b/udev_remove.c index d855fce52c..56834a45b9 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -112,7 +112,7 @@ static int delete_node(struct udevice *udev) int len; int num; - snprintf(filename, NAME_SIZE-1, "%s/%s", udev_root, udev->name); + snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); filename[NAME_SIZE-1] = '\0'; info("removing device node '%s'", filename); @@ -143,7 +143,7 @@ static int delete_node(struct udevice *udev) char linkname[NAME_SIZE]; strfieldcpymax(linkname, pos, len+1); - snprintf(filename, NAME_SIZE-1, "%s/%s", udev_root, linkname); + snprintf(filename, NAME_SIZE, "%s/%s", udev_root, linkname); filename[NAME_SIZE-1] = '\0'; dbg("unlinking symlink '%s'", filename); @@ -189,7 +189,7 @@ int udev_remove_device(struct udevice *udev) udevdb_delete_dev(udev); /* use full path to the environment */ - snprintf(udev->devname, NAME_SIZE-1, "%s/%s", udev_root, udev->name); + snprintf(udev->devname, NAME_SIZE, "%s/%s", udev_root, udev->name); return delete_node(udev); } diff --git a/udevdb.c b/udevdb.c index fc579a9451..38830b098e 100644 --- a/udevdb.c +++ b/udevdb.c @@ -51,7 +51,7 @@ static int get_db_filename(struct udevice *udev, char *filename, int len) pos[0] = PATH_TO_NAME_CHAR; pos = strchr(&pos[1], '/'); } - snprintf(filename, len-1, "%s%s", udev_db_path, devpath); + snprintf(filename, len, "%s%s", udev_db_path, devpath); filename[len-1] = '\0'; return 0; @@ -175,7 +175,7 @@ int udevdb_get_dev_byname(struct udevice *udev, const char *name) if (ent->d_name[0] == '.') continue; - snprintf(filename, NAME_SIZE-1, "%s/%s", udev_db_path, ent->d_name); + snprintf(filename, NAME_SIZE, "%s/%s", udev_db_path, ent->d_name); filename[NAME_SIZE-1] = '\0'; memset(&db_udev, 0x00, sizeof(struct udevice)); diff --git a/udevstart.c b/udevstart.c index 0433e568d4..c1d877fb37 100644 --- a/udevstart.c +++ b/udevstart.c @@ -97,7 +97,8 @@ static int add_device(char *devpath, char *subsystem) setenv("DEVPATH", devpath, 1); setenv("SUBSYSTEM", subsystem, 1); - snprintf(path, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); + snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); + path[SYSFS_PATH_MAX-1] = '\0'; class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { dbg ("sysfs_open_class_device_path failed"); @@ -107,8 +108,11 @@ static int add_device(char *devpath, char *subsystem) udev_set_values(&udev, devpath, subsystem, "add"); udev_add_device(&udev, class_dev); - /* run scripts */ - dev_d_execute(&udev); + /* run dev.d/ scripts if we created a node or changed a netif name */ + if (udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + } sysfs_close_class_device(class_dev); diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 3b1b0cd248..42b9d383dc 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -96,7 +96,7 @@ int main(int argc, char *argv[], char *envp[]) } if ((strncmp(devpath, "/block/", 7) == 0) || (strncmp(devpath, "/class/", 7) == 0)) { - snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_mnt_path, devpath); + snprintf(filename, SYSFS_PATH_MAX, "%s%s", sysfs_mnt_path, devpath); filename[SYSFS_PATH_MAX-1] = '\0'; /* skip bad events where we get no device for the class */ @@ -128,7 +128,7 @@ int main(int argc, char *argv[], char *envp[]) sysfs_close_class_device(class_dev); } else if ((strncmp(devpath, "/devices/", 9) == 0)) { - snprintf(filename, SYSFS_PATH_MAX-1, "%s%s", sysfs_mnt_path, devpath); + snprintf(filename, SYSFS_PATH_MAX, "%s%s", sysfs_mnt_path, devpath); filename[SYSFS_PATH_MAX-1] = '\0'; /* open the path we are called for */ -- cgit v1.2.3-54-g00ecf From 02fa9ae58920b431bc37182716dd863f1c482651 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 12 Nov 2004 06:32:19 +0100 Subject: [PATCH] rename udevdb* to udev_db* --- Makefile | 6 +- dev_d.c | 1 - namedev.c | 4 +- udev.c | 3 +- udev_add.c | 6 +- udev_db.c | 214 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev_db.h | 34 ++++++++++ udev_remove.c | 8 +-- udevdb.c | 214 ---------------------------------------------------------- udevdb.h | 34 ---------- udevinfo.c | 6 +- udevtest.c | 2 +- 12 files changed, 265 insertions(+), 267 deletions(-) create mode 100644 udev_db.c create mode 100644 udev_db.h delete mode 100644 udevdb.c delete mode 100644 udevdb.h diff --git a/Makefile b/Makefile index 50c72279f8..09b74fcde7 100644 --- a/Makefile +++ b/Makefile @@ -210,7 +210,7 @@ OBJS = udev_lib.o \ udev_add.o \ udev_remove.o \ udev_sysfs.o \ - udevdb.o \ + udev_db.o \ namedev.o \ namedev_parse.o \ dev_d.o \ @@ -220,7 +220,7 @@ HEADERS = udev.h \ udev_lib.h \ namedev.h \ udev_version.h \ - udevdb.h \ + udev_db.h \ udev_sysfs.h \ logging.h \ selinux.h \ @@ -292,7 +292,7 @@ $(TESTER): $(LIBC) $(TESTER).o $(OBJS) $(HEADERS) $(QUIET) $(STRIPCMD) $@ $(INFO): $(LIBC) $(INFO).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udevdb.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udev_db.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(DAEMON): $(LIBC) $(DAEMON).o $(OBJS) udevd.h diff --git a/dev_d.c b/dev_d.c index b3d05d9220..d14c70c256 100644 --- a/dev_d.c +++ b/dev_d.c @@ -29,7 +29,6 @@ #include "udev.h" #include "udev_lib.h" -#include "udevdb.h" #include "logging.h" static int run_program(const char *filename, void *data) diff --git a/namedev.c b/namedev.c index 9c94e69082..3ab45d4ec6 100644 --- a/namedev.c +++ b/namedev.c @@ -40,7 +40,7 @@ #include "udev_version.h" #include "logging.h" #include "namedev.h" -#include "udevdb.h" +#include "udev_db.h" static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr); @@ -194,7 +194,7 @@ static int find_free_number(struct udevice *udev, const char *name) while (1) { dbg("look for existing node '%s'", filename); memset(&db_udev, 0x00, sizeof(struct udevice)); - if (udevdb_get_dev_byname(&db_udev, filename) != 0) { + if (udev_db_get_device_byname(&db_udev, filename) != 0) { dbg("free num=%d", num); return num; } diff --git a/udev.c b/udev.c index bb3385e67d..a41f222778 100644 --- a/udev.c +++ b/udev.c @@ -34,9 +34,8 @@ #include "udev_lib.h" #include "udev_sysfs.h" #include "udev_version.h" -#include "logging.h" #include "namedev.h" -#include "udevdb.h" +#include "logging.h" #ifdef LOG diff --git a/udev_add.c b/udev_add.c index c139bd38bf..4fb5ef18c0 100644 --- a/udev_add.c +++ b/udev_add.c @@ -42,7 +42,7 @@ #include "udev_version.h" #include "logging.h" #include "namedev.h" -#include "udevdb.h" +#include "udev_db.h" #include "selinux.h" @@ -303,8 +303,8 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) if (retval != 0) goto exit; - if (udevdb_add_dev(udev) != 0) - dbg("udevdb_add_dev failed, but we create the node anyway, " + if (udev_db_add_device(udev) != 0) + dbg("udev_db_add_dev failed, but we create the node anyway, " "remove might not work for custom names"); /* use full path to the environment */ diff --git a/udev_db.c b/udev_db.c new file mode 100644 index 0000000000..f2a890ea42 --- /dev/null +++ b/udev_db.c @@ -0,0 +1,214 @@ +/* + * udev_db.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libsysfs/sysfs/libsysfs.h" +#include "udev.h" +#include "udev_lib.h" +#include "logging.h" +#include "udev_db.h" + +#define PATH_TO_NAME_CHAR '@' + +static int get_db_filename(struct udevice *udev, char *filename, int len) +{ + char devpath[SYSFS_PATH_MAX]; + char *pos; + + /* replace '/' to transform path into a filename */ + strfieldcpy(devpath, udev->devpath); + pos = strchr(&devpath[1], '/'); + while (pos) { + pos[0] = PATH_TO_NAME_CHAR; + pos = strchr(&pos[1], '/'); + } + snprintf(filename, len, "%s%s", udev_db_path, devpath); + filename[len-1] = '\0'; + + return 0; +} + +int udev_db_add_device(struct udevice *udev) +{ + char filename[SYSFS_PATH_MAX]; + FILE *f; + + if (udev->test_run) + return 0; + + get_db_filename(udev, filename, SYSFS_PATH_MAX); + + create_path(filename); + + f = fopen(filename, "w"); + if (f == NULL) { + dbg("unable to create db file '%s'", filename); + return -1; + } + dbg("storing data for device '%s' in '%s'", udev->devpath, filename); + + fprintf(f, "P:%s\n", udev->devpath); + fprintf(f, "N:%s\n", udev->name); + fprintf(f, "S:%s\n", udev->symlink); + fprintf(f, "A:%d\n", udev->partitions); + + fclose(f); + + return 0; +} + +static int parse_db_file(struct udevice *udev, const char *filename) +{ + char line[NAME_SIZE]; + char *bufline; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + + if (file_map(filename, &buf, &bufsize) != 0) { + dbg("unable to read db file '%s'", filename); + return -1; + } + + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + + switch(bufline[0]) { + case 'P': + if (count > DEVPATH_SIZE) + count = DEVPATH_SIZE-1; + strncpy(udev->devpath, &bufline[2], count-2); + break; + case 'N': + if (count > NAME_SIZE) + count = NAME_SIZE-1; + strncpy(udev->name, &bufline[2], count-2); + break; + case 'S': + if (count > NAME_SIZE) + count = NAME_SIZE-1; + strncpy(udev->symlink, &bufline[2], count-2); + break; + case 'A': + strfieldcpy(line, &bufline[2]); + udev->partitions = atoi(line); + break; + } + } + + if (udev->name[0] == '\0') + return -1; + + return 0; +} + +int udev_db_get_device(struct udevice *udev) +{ + char filename[SYSFS_PATH_MAX]; + + get_db_filename(udev, filename, SYSFS_PATH_MAX); + + return parse_db_file(udev, filename); +} + +int udev_db_delete_device(struct udevice *udev) +{ + char filename[SYSFS_PATH_MAX]; + + get_db_filename(udev, filename, SYSFS_PATH_MAX); + unlink(filename); + + return 0; +} + +int udev_db_get_device_byname(struct udevice *udev, const char *name) +{ + struct dirent *ent; + DIR *dir; + char filename[NAME_SIZE]; + struct udevice db_udev; + + dir = opendir(udev_db_path); + if (dir == NULL) { + dbg("unable to udev db '%s'", udev_db_path); + return -1; + } + + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + + if (ent->d_name[0] == '.') + continue; + + snprintf(filename, NAME_SIZE, "%s/%s", udev_db_path, ent->d_name); + filename[NAME_SIZE-1] = '\0'; + + memset(&db_udev, 0x00, sizeof(struct udevice)); + if (parse_db_file(&db_udev, filename) == 0) { + char *pos; + int len; + + if (strncmp(name, db_udev.name, NAME_SIZE) == 0) { + goto found; + } + + foreach_strpart(db_udev.symlink, " ", pos, len) { + if (strncmp(name, pos, len) != 0) + continue; + + if (len == strlen(name)) + goto found; + } + + } + } + + closedir(dir); + + return -1; + +found: + closedir(dir); + + strfieldcpy(udev->devpath, db_udev.devpath); + strfieldcpy(udev->name, db_udev.name); + strfieldcpy(udev->symlink, db_udev.symlink); + udev->partitions = db_udev.partitions; + + return 0; +} diff --git a/udev_db.h b/udev_db.h new file mode 100644 index 0000000000..141c586f24 --- /dev/null +++ b/udev_db.h @@ -0,0 +1,34 @@ +/* + * udev_db.h + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + +#ifndef _UDEV_DB_H_ +#define _UDEV_DB_H_ + + +extern int udev_db_add_device(struct udevice *dev); +extern int udev_db_get_device(struct udevice *dev); +extern int udev_db_delete_device(struct udevice *dev); + +extern int udev_db_get_device_byname(struct udevice *udev, const char *name); + +#endif /* _UDEV_DB_H_ */ diff --git a/udev_remove.c b/udev_remove.c index 56834a45b9..32cd785984 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -33,9 +33,9 @@ #include "udev.h" #include "udev_lib.h" #include "udev_version.h" -#include "logging.h" #include "namedev.h" -#include "udevdb.h" +#include "udev_db.h" +#include "logging.h" static int delete_path(const char *path) { @@ -175,7 +175,7 @@ int udev_remove_device(struct udevice *udev) if (udev->type != 'b' && udev->type != 'c') return 0; - retval = udevdb_get_dev(udev); + retval = udev_db_get_device(udev); if (retval) { /* fall back to kernel name */ temp = strrchr(udev->devpath, '/'); @@ -186,7 +186,7 @@ int udev_remove_device(struct udevice *udev) } dbg("remove name='%s'", udev->name); - udevdb_delete_dev(udev); + udev_db_delete_device(udev); /* use full path to the environment */ snprintf(udev->devname, NAME_SIZE, "%s/%s", udev_root, udev->name); diff --git a/udevdb.c b/udevdb.c deleted file mode 100644 index 38830b098e..0000000000 --- a/udevdb.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * udevdb.c - * - * Userspace devfs - * - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers - * - * 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 02139, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libsysfs/sysfs/libsysfs.h" -#include "udev.h" -#include "udev_lib.h" -#include "logging.h" -#include "udevdb.h" - -#define PATH_TO_NAME_CHAR '@' - -static int get_db_filename(struct udevice *udev, char *filename, int len) -{ - char devpath[SYSFS_PATH_MAX]; - char *pos; - - /* replace '/' to transform path into a filename */ - strfieldcpy(devpath, udev->devpath); - pos = strchr(&devpath[1], '/'); - while (pos) { - pos[0] = PATH_TO_NAME_CHAR; - pos = strchr(&pos[1], '/'); - } - snprintf(filename, len, "%s%s", udev_db_path, devpath); - filename[len-1] = '\0'; - - return 0; -} - -int udevdb_add_dev(struct udevice *udev) -{ - char filename[SYSFS_PATH_MAX]; - FILE *f; - - if (udev->test_run) - return 0; - - get_db_filename(udev, filename, SYSFS_PATH_MAX); - - create_path(filename); - - f = fopen(filename, "w"); - if (f == NULL) { - dbg("unable to create db file '%s'", filename); - return -1; - } - dbg("storing data for device '%s' in '%s'", udev->devpath, filename); - - fprintf(f, "P:%s\n", udev->devpath); - fprintf(f, "N:%s\n", udev->name); - fprintf(f, "S:%s\n", udev->symlink); - fprintf(f, "A:%d\n", udev->partitions); - - fclose(f); - - return 0; -} - -static int parse_db_file(struct udevice *udev, const char *filename) -{ - char line[NAME_SIZE]; - char *bufline; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - - if (file_map(filename, &buf, &bufsize) != 0) { - dbg("unable to read db file '%s'", filename); - return -1; - } - - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - - switch(bufline[0]) { - case 'P': - if (count > DEVPATH_SIZE) - count = DEVPATH_SIZE-1; - strncpy(udev->devpath, &bufline[2], count-2); - break; - case 'N': - if (count > NAME_SIZE) - count = NAME_SIZE-1; - strncpy(udev->name, &bufline[2], count-2); - break; - case 'S': - if (count > NAME_SIZE) - count = NAME_SIZE-1; - strncpy(udev->symlink, &bufline[2], count-2); - break; - case 'A': - strfieldcpy(line, &bufline[2]); - udev->partitions = atoi(line); - break; - } - } - - if (udev->name[0] == '\0') - return -1; - - return 0; -} - -int udevdb_get_dev(struct udevice *udev) -{ - char filename[SYSFS_PATH_MAX]; - - get_db_filename(udev, filename, SYSFS_PATH_MAX); - - return parse_db_file(udev, filename); -} - -int udevdb_delete_dev(struct udevice *udev) -{ - char filename[SYSFS_PATH_MAX]; - - get_db_filename(udev, filename, SYSFS_PATH_MAX); - unlink(filename); - - return 0; -} - -int udevdb_get_dev_byname(struct udevice *udev, const char *name) -{ - struct dirent *ent; - DIR *dir; - char filename[NAME_SIZE]; - struct udevice db_udev; - - dir = opendir(udev_db_path); - if (dir == NULL) { - dbg("unable to udev db '%s'", udev_db_path); - return -1; - } - - while (1) { - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - - if (ent->d_name[0] == '.') - continue; - - snprintf(filename, NAME_SIZE, "%s/%s", udev_db_path, ent->d_name); - filename[NAME_SIZE-1] = '\0'; - - memset(&db_udev, 0x00, sizeof(struct udevice)); - if (parse_db_file(&db_udev, filename) == 0) { - char *pos; - int len; - - if (strncmp(name, db_udev.name, NAME_SIZE) == 0) { - goto found; - } - - foreach_strpart(db_udev.symlink, " ", pos, len) { - if (strncmp(name, pos, len) != 0) - continue; - - if (len == strlen(name)) - goto found; - } - - } - } - - closedir(dir); - - return -1; - -found: - closedir(dir); - - strfieldcpy(udev->devpath, db_udev.devpath); - strfieldcpy(udev->name, db_udev.name); - strfieldcpy(udev->symlink, db_udev.symlink); - udev->partitions = db_udev.partitions; - - return 0; -} diff --git a/udevdb.h b/udevdb.h deleted file mode 100644 index 4f6b5de90c..0000000000 --- a/udevdb.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * udevdb.h - * - * Userspace devfs - * - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers - * - * 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 02139, USA. - * - */ - -#ifndef _UDEVDB_H_ -#define _UDEVDB_H_ - - -extern int udevdb_add_dev(struct udevice *dev); -extern int udevdb_get_dev(struct udevice *dev); -extern int udevdb_delete_dev(struct udevice *dev); - -extern int udevdb_get_dev_byname(struct udevice *udev, const char *name); - -#endif /* _UDEVDB_H_ */ diff --git a/udevinfo.c b/udevinfo.c index 1148272743..08c25d3a04 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -32,8 +32,8 @@ #include "udev.h" #include "udev_lib.h" #include "udev_version.h" +#include "udev_db.h" #include "logging.h" -#include "udevdb.h" #define SYSFS_VALUE_SIZE 256 @@ -355,7 +355,7 @@ static int process_options(int argc, char *argv[]) } memset(&udev, 0x00, sizeof(struct udevice)); strfieldcpy(udev.devpath, pos); - retval = udevdb_get_dev(&udev); + retval = udev_db_get_device(&udev); if (retval != 0) { printf("device not found in database\n"); goto exit; @@ -374,7 +374,7 @@ static int process_options(int argc, char *argv[]) memset(&udev, 0x00, sizeof(struct udevice)); strfieldcpy(udev.name, pos); - retval = udevdb_get_dev_byname(&udev, pos); + retval = udev_db_get_device_byname(&udev, pos); if (retval != 0) { printf("device not found in database\n"); goto exit; diff --git a/udevtest.c b/udevtest.c index 14c511584b..b9a5fea489 100644 --- a/udevtest.c +++ b/udevtest.c @@ -31,8 +31,8 @@ #include "udev.h" #include "udev_lib.h" #include "udev_version.h" -#include "logging.h" #include "namedev.h" +#include "logging.h" #ifdef LOG -- cgit v1.2.3-54-g00ecf From 6818c51d7abeab9914eb7193968b1efa9459a853 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 12 Nov 2004 06:52:55 +0100 Subject: [PATCH] support SUBSYSTEM as a rule key This should make it easier to catch e.g all block or net devices with a single rule. --- namedev.c | 13 ++++++++++++- namedev.h | 2 ++ namedev_parse.c | 6 ++++++ test/udev-test.pl | 11 +++++++++++ udev.8.in | 4 ++++ 5 files changed, 35 insertions(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 3ab45d4ec6..8bf3c0e73e 100644 --- a/namedev.c +++ b/namedev.c @@ -604,7 +604,7 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas } } - /* check for matching kernel name*/ + /* check for matching kernel name */ if (dev->kernel[0] != '\0') { dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", dev->kernel, class_dev->name); if (strcmp_pattern(dev->kernel, class_dev->name) != 0) { @@ -615,6 +615,17 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas } } + /* check for matching subsystem */ + if (dev->subsystem[0] != '\0') { + dbg("check for " FIELD_SUBSYSTEM " dev->subsystem='%s' class_dev->name='%s'", dev->subsystem, class_dev->name); + if (strcmp_pattern(dev->subsystem, udev->subsystem) != 0) { + dbg(FIELD_SUBSYSTEM " is not matching"); + goto try_parent; + } else { + dbg(FIELD_SUBSYSTEM " matches"); + } + } + /* check for matching bus id */ if (dev->id[0] != '\0') { dbg("check " FIELD_ID); diff --git a/namedev.h b/namedev.h index f1e0082241..3837e864a0 100644 --- a/namedev.h +++ b/namedev.h @@ -42,6 +42,7 @@ struct sysfs_class_device; #define FIELD_PROGRAM "PROGRAM" #define FIELD_RESULT "RESULT" #define FIELD_KERNEL "KERNEL" +#define FIELD_SUBSYSTEM "SUBSYSTEM" #define FIELD_NAME "NAME" #define FIELD_SYMLINK "SYMLINK" #define FIELD_OWNER "OWNER" @@ -78,6 +79,7 @@ struct config_device { char kernel[NAME_SIZE]; char program[PROGRAM_SIZE]; char result[PROGRAM_SIZE]; + char subsystem[SUBSYSTEM_SIZE]; char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; diff --git a/namedev_parse.c b/namedev_parse.c index 73828a83b2..cc02d25555 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -258,6 +258,12 @@ static int namedev_parse_rules(const char *filename, void *data) continue; } + if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) { + strfieldcpy(dev.subsystem, temp3); + valid = 1; + continue; + } + if (strcasecmp(temp2, FIELD_PROGRAM) == 0) { program_given = 1; strfieldcpy(dev.program, temp3); diff --git a/test/udev-test.pl b/test/udev-test.pl index 2ba63fe83f..5f6f864df2 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1102,6 +1102,17 @@ EOF exp_name => "cdrom", conf => < "SUBSYSTEM test", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + conf => < Date: Sat, 13 Nov 2004 05:21:12 +0100 Subject: [PATCH] support DRIVER as a rule key Match with a rule against a device with a specific kernel driver. --- namedev.c | 11 +++++++++++ namedev.h | 15 +++++++++------ namedev_parse.c | 6 ++++++ test/udev-test.pl | 10 ++++++++++ udev.8.in | 4 +++- 5 files changed, 39 insertions(+), 7 deletions(-) diff --git a/namedev.c b/namedev.c index 8bf3c0e73e..c5c7929ab2 100644 --- a/namedev.c +++ b/namedev.c @@ -626,6 +626,17 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas } } + /* check for matching driver */ + if (dev->driver[0] != '\0') { + dbg("check for " FIELD_DRIVER " dev->driver='%s' sysfs_device->driver_name='%s'", dev->driver, sysfs_device->driver_name); + if (strcmp_pattern(dev->driver, sysfs_device->driver_name) != 0) { + dbg(FIELD_DRIVER " is not matching"); + goto try_parent; + } else { + dbg(FIELD_DRIVER " matches"); + } + } + /* check for matching bus id */ if (dev->id[0] != '\0') { dbg("check " FIELD_ID); diff --git a/namedev.h b/namedev.h index 3837e864a0..7a98d66c24 100644 --- a/namedev.h +++ b/namedev.h @@ -28,12 +28,13 @@ struct sysfs_class_device; -#define BUS_SIZE 30 -#define FILE_SIZE 50 -#define VALUE_SIZE 100 -#define ID_SIZE 50 -#define PLACE_SIZE 50 -#define PROGRAM_SIZE 100 +#define BUS_SIZE 32 +#define FILE_SIZE 64 +#define VALUE_SIZE 128 +#define ID_SIZE 64 +#define PLACE_SIZE 64 +#define DRIVER_SIZE 64 +#define PROGRAM_SIZE 128 #define FIELD_BUS "BUS" #define FIELD_SYSFS "SYSFS" @@ -43,6 +44,7 @@ struct sysfs_class_device; #define FIELD_RESULT "RESULT" #define FIELD_KERNEL "KERNEL" #define FIELD_SUBSYSTEM "SUBSYSTEM" +#define FIELD_DRIVER "DRIVER" #define FIELD_NAME "NAME" #define FIELD_SYMLINK "SYMLINK" #define FIELD_OWNER "OWNER" @@ -80,6 +82,7 @@ struct config_device { char program[PROGRAM_SIZE]; char result[PROGRAM_SIZE]; char subsystem[SUBSYSTEM_SIZE]; + char driver[DRIVER_SIZE]; char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; diff --git a/namedev_parse.c b/namedev_parse.c index cc02d25555..ccacceceb4 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -264,6 +264,12 @@ static int namedev_parse_rules(const char *filename, void *data) continue; } + if (strcasecmp(temp2, FIELD_DRIVER) == 0) { + strfieldcpy(dev.driver, temp3); + valid = 1; + continue; + } + if (strcasecmp(temp2, FIELD_PROGRAM) == 0) { program_given = 1; strfieldcpy(dev.program, temp3); diff --git a/test/udev-test.pl b/test/udev-test.pl index 5f6f864df2..1e06df5220 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1113,6 +1113,16 @@ EOF BUS="scsi", KERNEL="sda", NAME="should_not_match", SUBSYSTEM="vc" BUS="scsi", KERNEL="sda", NAME="node", SUBSYSTEM="block" BUS="scsi", KERNEL="sda", NAME="should_not_match2", SUBSYSTEM="vc" +EOF + }, + { + desc => "DRIVER test", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + conf => < Date: Sat, 13 Nov 2004 12:36:47 +0100 Subject: [PATCH] don't wait for sysfs if the kernel(2.6.10-rc2) tells us what not to expect Newer kernels will tell us if we should wait for the "device" or the "bus" link. So don't waste the time with our lists or wait for the timeout. --- udev_lib.c | 24 +++++++++++++++++++++ udev_lib.h | 2 +- udev_sysfs.c | 63 ++++++++++++++++++++++++++++++++++---------------------- udev_sysfs.h | 10 ++++++--- wait_for_sysfs.c | 13 ++++++------ 5 files changed, 77 insertions(+), 35 deletions(-) diff --git a/udev_lib.c b/udev_lib.c index 6807f817a1..a3fab9632d 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "udev.h" #include "logging.h" @@ -72,6 +73,29 @@ void udev_set_values(struct udevice *udev, const char* devpath, udev->type = get_device_type(devpath, subsystem); } +int kernel_release_satisfactory(int version, int patchlevel, int sublevel) +{ + static struct utsname uts; + static int kversion = 0; + static int kpatchlevel; + static int ksublevel; + + if (kversion == 0) { + if (uname(&uts) != 0) + return -1; + + if (sscanf (uts.release, "%u.%u.%u", &kversion, &kpatchlevel, &ksublevel) != 3) { + kversion = 0; + return -1; + } + } + + if (kversion >= version && kpatchlevel >= patchlevel && ksublevel >= sublevel) + return 1; + else + return 0; +} + int create_path(const char *path) { char p[NAME_SIZE]; diff --git a/udev_lib.h b/udev_lib.h index 2bc9ba82ab..80dc49cd54 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -79,12 +79,12 @@ do { \ extern char get_device_type(const char *path, const char *subsystem); extern void udev_set_values(struct udevice *udev, const char* devpath, const char *subsystem, const char* action); +extern int kernel_release_satisfactory(int version, int patchlevel, int sublevel); extern int create_path(const char *path); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); extern void no_trailing_slash(char *path); - typedef int (*file_fnct_t)(const char *filename, void *data); extern int call_foreach_file(file_fnct_t fnct, const char *dirname, const char *suffix, void *data); diff --git a/udev_sysfs.c b/udev_sysfs.c index a11c430df0..1953dd7775 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -28,14 +28,13 @@ #include #include -#include "logging.h" +#include "libsysfs/sysfs/libsysfs.h" #include "udev_version.h" #include "udev_sysfs.h" -#include "libsysfs/sysfs/libsysfs.h" +#include "udev_lib.h" +#include "logging.h" -/* list of subsystem specific files - * NULL if there is no file to wait for - */ +/* list of subsystem specific files, NULL if there is no file to wait for */ static struct subsystem_file { char *subsystem; char *file; @@ -204,6 +203,13 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d struct class_device *classdevice; int len; + /* the kernel may tell us what to wait for */ + if (kernel_release_satisfactory(2,6,10) > 0) + if (getenv("PHYSDEVPATH") == NULL) { + dbg("the kernel says, that there is no physical device for '%s'", class_dev->path); + return 1; + } + for (classdevice = class_device; classdevice->subsystem != NULL; classdevice++) { if (strcmp(class_dev->classname, classdevice->subsystem) == 0) { /* see if no device in this class is expected to have a device-link */ @@ -229,7 +235,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d return 0; } -/* skip waiting for the bus */ +/* skip waiting for the bus of the devices device */ static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) { static char *devices_without_bus[] = { @@ -250,14 +256,14 @@ static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) return 0; } -/* wait for the bus and for a bus specific file to show up */ -int wait_for_bus_device(struct sysfs_device *devices_dev, +/* wait for a devices device specific file to show up */ +int wait_for_devices_device(struct sysfs_device *devices_dev, const char **error) { - static struct bus_file { + static struct device_file { char *bus; char *file; - } bus_files[] = { + } device_files[] = { { .bus = "scsi", .file = "vendor" }, { .bus = "usb", .file = "idVendor" }, { .bus = "usb", .file = "iInterface" }, @@ -272,9 +278,16 @@ int wait_for_bus_device(struct sysfs_device *devices_dev, { .bus = "ieee1394", .file = "address" }, { NULL, NULL } }; - struct bus_file *busfile; + struct device_file *devicefile; int loop; + /* the kernel may tell us what to wait for */ + if (kernel_release_satisfactory(2,6,10) > 0) + if (getenv("PHYSDEVBUS") == NULL) { + dbg("the kernel says, that there is no bus for '%s'", devices_dev->path); + return 0; + } + /* wait for the bus device link to the devices device */ loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { @@ -291,22 +304,22 @@ int wait_for_bus_device(struct sysfs_device *devices_dev, } dbg("bus device link found for bus '%s'", devices_dev->bus); - /* wait for a bus specific file to show up */ + /* wait for a bus device specific file to show up */ loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; while (--loop) { int found_bus_type = 0; - for (busfile = bus_files; busfile->bus != NULL; busfile++) { - if (strcmp(devices_dev->bus, busfile->bus) == 0) { + for (devicefile = device_files; devicefile->bus != NULL; devicefile++) { + if (strcmp(devices_dev->bus, devicefile->bus) == 0) { char filename[SYSFS_PATH_MAX]; struct stat stats; found_bus_type = 1; - snprintf(filename, SYSFS_PATH_MAX-1, "%s/%s", devices_dev->path, busfile->file); - dbg("looking at bus '%s' for specific file '%s'", devices_dev->bus, filename); + snprintf(filename, SYSFS_PATH_MAX-1, "%s/%s", devices_dev->path, devicefile->file); + dbg("looking at bus '%s' device for specific file '%s'", devices_dev->bus, filename); if (stat(filename, &stats) == 0) { - dbg("bus '%s' specific file '%s' found", devices_dev->bus, busfile->file); + dbg("bus '%s' device specific file '%s' found", devices_dev->bus, devicefile->file); return 0; } } @@ -321,14 +334,14 @@ int wait_for_bus_device(struct sysfs_device *devices_dev, usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - dbg("error: getting bus '%s' specific file '%s'", devices_dev->bus, busfile->file); + dbg("error: getting '%s' device specific file '%s'", devices_dev->bus, devicefile->file); if (error) - *error = "bus specific file unavailable"; + *error = "bus device specific file unavailable"; return -1; } -struct sysfs_class_device *open_class_device_wait(const char *path) +struct sysfs_class_device *wait_class_device_open(const char *path) { struct sysfs_class_device *class_dev; int loop; @@ -358,7 +371,7 @@ int wait_for_class_device(struct sysfs_class_device *class_dev, /* skip devices without devices-link */ if (class_device_expect_no_device_link(class_dev)) { dbg("no device symlink expected for '%s', ", class_dev->name); - return -ENODEV; + return 0; } /* the symlink may be on the parent device */ @@ -388,16 +401,16 @@ int wait_for_class_device(struct sysfs_class_device *class_dev, } dbg("device symlink found pointing to '%s'", devices_dev->path); - /* wait for the bus value */ + /* wait for the devices device */ if (class_device_expect_no_bus(class_dev)) { dbg("no bus device expected for '%s', ", class_dev->classname); return 0; - } else { - return wait_for_bus_device(devices_dev, error); } + + return wait_for_devices_device(devices_dev, error); } -struct sysfs_device *open_devices_device_wait(const char *path) +struct sysfs_device *wait_devices_device_open(const char *path) { struct sysfs_device *devices_dev; int loop; diff --git a/udev_sysfs.h b/udev_sysfs.h index 922db1be79..98ff53e11a 100644 --- a/udev_sysfs.h +++ b/udev_sysfs.h @@ -28,9 +28,13 @@ #define WAIT_LOOP_PER_SECOND 20 extern int subsystem_expect_no_dev(const char *subsystem); -extern int wait_for_bus_device(struct sysfs_device *devices_dev, const char **error); + +/* /sys/class /sys/block devices */ +extern struct sysfs_class_device *wait_class_device_open(const char *path); extern int wait_for_class_device(struct sysfs_class_device *class_dev, const char **error); -extern struct sysfs_class_device *open_class_device_wait(const char *path); -extern struct sysfs_device *open_devices_device_wait(const char *path); + +/* /sys/devices devices */ +extern struct sysfs_device *wait_devices_device_open(const char *path); +extern int wait_for_devices_device(struct sysfs_device *devices_dev, const char **error); #endif /* _UDEV_SYSFS_H_ */ diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c index 42b9d383dc..84a25adb97 100644 --- a/wait_for_sysfs.c +++ b/wait_for_sysfs.c @@ -32,10 +32,11 @@ #include #include -#include "logging.h" +#include "libsysfs/sysfs/libsysfs.h" +#include "udev_lib.h" #include "udev_version.h" #include "udev_sysfs.h" -#include "libsysfs/sysfs/libsysfs.h" +#include "logging.h" #ifdef LOG unsigned char logname[LOGNAME_SIZE]; @@ -106,7 +107,7 @@ int main(int argc, char *argv[], char *envp[]) } /* open the class device we are called for */ - class_dev = open_class_device_wait(filename); + class_dev = wait_class_device_open(filename); if (!class_dev) { dbg("error: class device unavailable (probably remove has beaten us)"); goto exit; @@ -132,15 +133,15 @@ int main(int argc, char *argv[], char *envp[]) filename[SYSFS_PATH_MAX-1] = '\0'; /* open the path we are called for */ - devices_dev = open_devices_device_wait(filename); + devices_dev = wait_devices_device_open(filename); if (!devices_dev) { dbg("error: devices device unavailable (probably remove has beaten us)"); goto exit; } dbg("devices device opened '%s'", filename); - /* wait for the bus value */ - wait_for_bus_device(devices_dev, &error); + /* wait for the devices device */ + wait_for_devices_device(devices_dev, &error); sysfs_close_device(devices_dev); -- cgit v1.2.3-54-g00ecf From d4a32aa2e4804de9189574213749616dda57faa7 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 13 Nov 2004 12:50:44 +0100 Subject: [PATCH] remove historical SYSFS_attr="value" format This is long ago replaced by the unified key attribute format SYSFS{attr}="value". --- namedev_parse.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index ccacceceb4..4afa85cfa9 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -113,7 +113,7 @@ void dump_perm_dev_list(void) dump_perm_dev(dev); } -/* extract possible KEY{attr} or KEY_attr */ +/* extract possible KEY{attr} */ static char *get_key_attribute(char *str) { char *pos; @@ -132,13 +132,6 @@ static char *get_key_attribute(char *str) return attr; } - attr = strchr(str, '_'); - if (attr != NULL) { - attr++; - dbg("attribute='%s'", attr); - return attr; - } - return NULL; } -- cgit v1.2.3-54-g00ecf From 7efa217db0db946e68e6274e2b9cbe0a973ec47a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 13 Nov 2004 14:43:24 +0100 Subject: [PATCH] add NAME{ignore_remove} attribute Some broken ide drivers are generating high event traffic, with add/remove events. With this attribute, it can be specified, that the node is always available. It may be used in conjunction with the new DRIVER= match to catch specific kernel device drivers. --- namedev.c | 1 + namedev.h | 2 ++ namedev_parse.c | 8 +++++++- test/udev-test.pl | 25 +++++++++++++++++++++++-- udev.8.in | 7 +++++++ udev.h | 1 + udev_db.c | 18 ++++++++++++++++-- udev_remove.c | 5 +++++ 8 files changed, 62 insertions(+), 5 deletions(-) diff --git a/namedev.c b/namedev.c index c5c7929ab2..69669709df 100644 --- a/namedev.c +++ b/namedev.c @@ -807,6 +807,7 @@ found: goto done; udev->partitions = dev->partitions; + udev->ignore_remove = dev->ignore_remove; /* get permissions given in rule */ set_empty_perms(udev, dev->mode, diff --git a/namedev.h b/namedev.h index 7a98d66c24..8e552c8568 100644 --- a/namedev.h +++ b/namedev.h @@ -52,6 +52,7 @@ struct sysfs_class_device; #define FIELD_MODE "MODE" #define ATTR_PARTITIONS "all_partitions" +#define ATTR_IGNORE_REMOVE "ignore_remove" #define PARTITIONS_COUNT 15 #define MAX_SYSFS_PAIRS 5 @@ -90,6 +91,7 @@ struct config_device { char group[GROUP_SIZE]; unsigned int mode; int partitions; + int ignore_remove; char config_file[NAME_SIZE]; int config_line; }; diff --git a/namedev_parse.c b/namedev_parse.c index 4afa85cfa9..cb1760fd57 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -278,10 +278,16 @@ static int namedev_parse_rules(const char *filename, void *data) if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) { attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1); - if (attr != NULL && strcasecmp(attr, ATTR_PARTITIONS) == 0) { + if (attr != NULL) { + if (strstr(attr, ATTR_PARTITIONS) != NULL) { dbg_parse("creation of partition nodes requested"); dev.partitions = PARTITIONS_COUNT; } + if (strstr(attr, ATTR_IGNORE_REMOVE) != NULL) { + dbg_parse("remove event should be ignored"); + dev.ignore_remove = 1; + } + } strfieldcpy(dev.name, temp3); valid = 1; continue; diff --git a/test/udev-test.pl b/test/udev-test.pl index 1e06df5220..d584579584 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1105,7 +1105,28 @@ KERNEL="sda", NAME="cdrom%e" EOF }, { - desc => "SUBSYSTEM test", + desc => "ignore remove event test", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + exp_error => "yes", + conf => < "ignore remove event test (with all partitions)", + subsys => "block", + devpath => "/block/sda", + exp_name => "node14", + exp_error => "yes", + option => "clear", + conf => < "SUBSYSTEM match test", subsys => "block", devpath => "/block/sda", exp_name => "node", @@ -1116,7 +1137,7 @@ BUS="scsi", KERNEL="sda", NAME="should_not_match2", SUBSYSTEM="vc" EOF }, { - desc => "DRIVER test", + desc => "DRIVER match test", subsys => "block", devpath => "/block/sda", exp_name => "node", diff --git a/udev.8.in b/udev.8.in index b5296b472d..728ddb1a45 100644 --- a/udev.8.in +++ b/udev.8.in @@ -216,6 +216,13 @@ If given with the attribute .BR NAME{ all_partitions } it will create all 15 partitions of a blockdevice. This may be useful for removable media devices. +.br +If given with the attribute +.BR NAME{ ignore_remove } +it will will ignore any later remove event for this device. +This may be useful as a workaround for broken device drivers. +.sp +Multiple attributes may be separated by comma. .TP .B SYMLINK The name of a symlink targeting the node. Multiple symlinks may be diff --git a/udev.h b/udev.h index 73733ad3bb..d9a775ae91 100644 --- a/udev.h +++ b/udev.h @@ -57,6 +57,7 @@ struct udevice { mode_t mode; char symlink[NAME_SIZE]; int partitions; + int ignore_remove; int config_line; char config_file[NAME_SIZE]; long config_uptime; diff --git a/udev_db.c b/udev_db.c index f2a890ea42..e07e72b858 100644 --- a/udev_db.c +++ b/udev_db.c @@ -79,7 +79,8 @@ int udev_db_add_device(struct udevice *udev) fprintf(f, "P:%s\n", udev->devpath); fprintf(f, "N:%s\n", udev->name); fprintf(f, "S:%s\n", udev->symlink); - fprintf(f, "A:%d\n", udev->partitions); + fprintf(f, "A:%u\n", udev->partitions); + fprintf(f, "R:%u\n", udev->ignore_remove); fclose(f); @@ -111,21 +112,34 @@ static int parse_db_file(struct udevice *udev, const char *filename) if (count > DEVPATH_SIZE) count = DEVPATH_SIZE-1; strncpy(udev->devpath, &bufline[2], count-2); + udev->devpath[count-2] = '\0'; break; case 'N': if (count > NAME_SIZE) count = NAME_SIZE-1; strncpy(udev->name, &bufline[2], count-2); + udev->name[count-2] = '\0'; break; case 'S': if (count > NAME_SIZE) count = NAME_SIZE-1; strncpy(udev->symlink, &bufline[2], count-2); + udev->symlink[count-2] = '\0'; break; case 'A': - strfieldcpy(line, &bufline[2]); + if (count > NAME_SIZE) + count = NAME_SIZE-1; + strncpy(line, &bufline[2], count-2); + line[count-2] = '\0'; udev->partitions = atoi(line); break; + case 'R': + if (count > NAME_SIZE) + count = NAME_SIZE-1; + strncpy(line, &bufline[2], count-2); + line[count-2] = '\0'; + udev->ignore_remove = atoi(line); + break; } } diff --git a/udev_remove.c b/udev_remove.c index 32cd785984..8887125dd8 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -185,6 +185,11 @@ int udev_remove_device(struct udevice *udev) dbg("'%s' not found in database, falling back on default name", udev->name); } + if (udev->ignore_remove) { + dbg("remove event for '%s' requested to be ignored by rule", udev->name); + return 0; + } + dbg("remove name='%s'", udev->name); udev_db_delete_device(udev); -- cgit v1.2.3-54-g00ecf From 7225821d631f37f3c2b11e1d62aeb516b2acec30 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 13 Nov 2004 14:51:10 +0100 Subject: [PATCH] disable logging for udevstart The slow logging facilites on some systems are a reason for the reported slowness of udevstart. On one of my boxes udevstart is down from 9 second to 0.3 seconds. --- Makefile | 4 +- udev.c | 1 + udev_start.c | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udevstart.c | 300 ----------------------------------------------------------- 4 files changed, 303 insertions(+), 302 deletions(-) create mode 100644 udev_start.c delete mode 100644 udevstart.c diff --git a/Makefile b/Makefile index 09b74fcde7..efbb74355a 100644 --- a/Makefile +++ b/Makefile @@ -283,8 +283,8 @@ $(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(WAIT).o: $(GEN_HEADERS) $(HOST_PROGS) -$(ROOT): $(LIBC) $(ROOT).o $(STARTER).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o udevstart.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(ROOT): $(LIBC) $(ROOT).o udev_start.o $(OBJS) $(HEADERS) $(GEN_MANPAGES) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o udev_start.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(TESTER): $(LIBC) $(TESTER).o $(OBJS) $(HEADERS) diff --git a/udev.c b/udev.c index a41f222778..78fe82cfbb 100644 --- a/udev.c +++ b/udev.c @@ -143,6 +143,7 @@ int main(int argc, char *argv[], char *envp[]) switch(act_type) { case UDEVSTART: dbg("udevstart"); + udev_log = 0; namedev_init(); retval = udev_start(); break; diff --git a/udev_start.c b/udev_start.c new file mode 100644 index 0000000000..c1d877fb37 --- /dev/null +++ b/udev_start.c @@ -0,0 +1,300 @@ +/* + * udevstart.c + * + * Copyright (C) 2004 Greg Kroah-Hartman + * + * Quick and dirty way to populate a /dev with udev if your system + * does not have access to a shell. Based originally on a patch to udev + * from Harald Hoyer + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libsysfs/sysfs/libsysfs.h" +#include "logging.h" +#include "udev_lib.h" +#include "list.h" +#include "udev.h" + + +#define MAX_PATHLEN 1024 +#define SYSBLOCK "/sys/block" +#define SYSCLASS "/sys/class" + +struct device { + struct list_head list; + char path[MAX_PATHLEN]; + char subsys[MAX_PATHLEN]; +}; + +/* sort files in lexical order */ +static int device_list_insert(char *path, char *subsystem, struct list_head *device_list) +{ + struct device *loop_device; + struct device *new_device; + + list_for_each_entry(loop_device, device_list, list) { + if (strcmp(loop_device->path, path) > 0) { + break; + } + } + + new_device = malloc(sizeof(struct device)); + if (new_device == NULL) { + dbg("error malloc"); + return -ENOMEM; + } + + strfieldcpy(new_device->path, path); + strfieldcpy(new_device->subsys, subsystem); + list_add_tail(&new_device->list, &loop_device->list); + dbg("add '%s' from subsys '%s'", new_device->path, new_device->subsys); + return 0; +} + +/* list of devices that we should run last due to any one of a number of reasons */ +static char *last_list[] = { + "/block/dm", /* on here because dm wants to have the block devices around before it */ + NULL, +}; + +/* list of devices that we should run first due to any one of a number of reasons */ +static char *first_list[] = { + "/class/mem", /* people tend to like their memory devices around first... */ + NULL, +}; + +static int add_device(char *devpath, char *subsystem) +{ + struct udevice udev; + char path[SYSFS_PATH_MAX]; + struct sysfs_class_device *class_dev; + + /* set environment for callouts and dev.d/ */ + setenv("DEVPATH", devpath, 1); + setenv("SUBSYSTEM", subsystem, 1); + + snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); + path[SYSFS_PATH_MAX-1] = '\0'; + class_dev = sysfs_open_class_device_path(path); + if (class_dev == NULL) { + dbg ("sysfs_open_class_device_path failed"); + return -ENODEV; + } + + udev_set_values(&udev, devpath, subsystem, "add"); + udev_add_device(&udev, class_dev); + + /* run dev.d/ scripts if we created a node or changed a netif name */ + if (udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + } + + sysfs_close_class_device(class_dev); + + return 0; +} + +static void exec_list(struct list_head *device_list) +{ + struct device *loop_device; + struct device *tmp_device; + int i; + + /* handle the "first" type devices first */ + list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + for (i=0; first_list[i] != NULL; i++) { + if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { + add_device(loop_device->path, loop_device->subsys); + list_del(&loop_device->list); + free(loop_device); + break; + } + } + } + + /* handle the devices we are allowed to, excluding the "last" type devices */ + list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + int found = 0; + for (i=0; last_list[i] != NULL; i++) { + if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) { + found = 1; + break; + } + } + if (found) + continue; + + add_device(loop_device->path, loop_device->subsys); + list_del(&loop_device->list); + free(loop_device); + } + + /* handle the rest of the devices left over, if any */ + list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + add_device(loop_device->path, loop_device->subsys); + list_del(&loop_device->list); + free(loop_device); + } +} + +static void udev_scan_block(void) +{ + DIR *dir; + struct dirent *dent; + LIST_HEAD(device_list); + + dir = opendir(SYSBLOCK); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[MAX_PATHLEN]; + DIR *dir2; + struct dirent *dent2; + + if ((strcmp(dent->d_name, ".") == 0) || + (strcmp(dent->d_name, "..") == 0)) + continue; + + snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name); + dirname[MAX_PATHLEN-1] = '\0'; + device_list_insert(dirname, "block", &device_list); + + snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name); + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[MAX_PATHLEN]; + DIR *dir3; + struct dirent *dent3; + + if ((strcmp(dent2->d_name, ".") == 0) || + (strcmp(dent2->d_name, "..") == 0)) + continue; + + snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); + dirname2[MAX_PATHLEN-1] = '\0'; + + dir3 = opendir(dirname2); + if (dir3 != NULL) { + for (dent3 = readdir(dir3); dent3 != NULL; dent3 = readdir(dir3)) { + char filename[MAX_PATHLEN]; + + if (strcmp(dent3->d_name, "dev") == 0) { + snprintf(filename, MAX_PATHLEN, "/block/%s/%s", + dent->d_name, dent2->d_name); + filename[MAX_PATHLEN-1] = '\0'; + device_list_insert(filename, "block", &device_list); + } + } + closedir(dir3); + } + } + closedir(dir2); + } + } + closedir(dir); + } + + exec_list(&device_list); +} + +static void udev_scan_class(void) +{ + DIR *dir; + struct dirent *dent; + LIST_HEAD(device_list); + + dir = opendir(SYSCLASS); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[MAX_PATHLEN]; + DIR *dir2; + struct dirent *dent2; + + if ((strcmp(dent->d_name, ".") == 0) || + (strcmp(dent->d_name, "..") == 0)) + continue; + + snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); + dirname[MAX_PATHLEN-1] = '\0'; + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[MAX_PATHLEN]; + DIR *dir3; + struct dirent *dent3; + + if ((strcmp(dent2->d_name, ".") == 0) || + (strcmp(dent2->d_name, "..") == 0)) + continue; + + /* pass the net class as it is */ + if (strcmp(dent->d_name, "net") == 0) { + snprintf(dirname2, MAX_PATHLEN, "/class/net/%s", dent2->d_name); + device_list_insert(dirname2, "net", &device_list); + continue; + } + + snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); + dirname2[MAX_PATHLEN-1] = '\0'; + dir3 = opendir(dirname2); + if (dir3 != NULL) { + for (dent3 = readdir(dir3); dent3 != NULL; dent3 = readdir(dir3)) { + char filename[MAX_PATHLEN]; + + /* pass devices with a "dev" file */ + if (strcmp(dent3->d_name, "dev") == 0) { + snprintf(filename, MAX_PATHLEN, "/class/%s/%s", + dent->d_name, dent2->d_name); + filename[MAX_PATHLEN-1] = '\0'; + device_list_insert(filename, dent->d_name, &device_list); + break; + } + } + closedir(dir3); + } + } + closedir(dir2); + } + } + closedir(dir); + } + + exec_list(&device_list); +} + +int udev_start(void) +{ + /* set environment for callouts and dev.d/ */ + setenv("ACTION", "add", 1); + setenv("UDEVSTART", "1", 1); + + udev_scan_class(); + udev_scan_block(); + + return 0; +} diff --git a/udevstart.c b/udevstart.c deleted file mode 100644 index c1d877fb37..0000000000 --- a/udevstart.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * udevstart.c - * - * Copyright (C) 2004 Greg Kroah-Hartman - * - * Quick and dirty way to populate a /dev with udev if your system - * does not have access to a shell. Based originally on a patch to udev - * from Harald Hoyer - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libsysfs/sysfs/libsysfs.h" -#include "logging.h" -#include "udev_lib.h" -#include "list.h" -#include "udev.h" - - -#define MAX_PATHLEN 1024 -#define SYSBLOCK "/sys/block" -#define SYSCLASS "/sys/class" - -struct device { - struct list_head list; - char path[MAX_PATHLEN]; - char subsys[MAX_PATHLEN]; -}; - -/* sort files in lexical order */ -static int device_list_insert(char *path, char *subsystem, struct list_head *device_list) -{ - struct device *loop_device; - struct device *new_device; - - list_for_each_entry(loop_device, device_list, list) { - if (strcmp(loop_device->path, path) > 0) { - break; - } - } - - new_device = malloc(sizeof(struct device)); - if (new_device == NULL) { - dbg("error malloc"); - return -ENOMEM; - } - - strfieldcpy(new_device->path, path); - strfieldcpy(new_device->subsys, subsystem); - list_add_tail(&new_device->list, &loop_device->list); - dbg("add '%s' from subsys '%s'", new_device->path, new_device->subsys); - return 0; -} - -/* list of devices that we should run last due to any one of a number of reasons */ -static char *last_list[] = { - "/block/dm", /* on here because dm wants to have the block devices around before it */ - NULL, -}; - -/* list of devices that we should run first due to any one of a number of reasons */ -static char *first_list[] = { - "/class/mem", /* people tend to like their memory devices around first... */ - NULL, -}; - -static int add_device(char *devpath, char *subsystem) -{ - struct udevice udev; - char path[SYSFS_PATH_MAX]; - struct sysfs_class_device *class_dev; - - /* set environment for callouts and dev.d/ */ - setenv("DEVPATH", devpath, 1); - setenv("SUBSYSTEM", subsystem, 1); - - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); - path[SYSFS_PATH_MAX-1] = '\0'; - class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) { - dbg ("sysfs_open_class_device_path failed"); - return -ENODEV; - } - - udev_set_values(&udev, devpath, subsystem, "add"); - udev_add_device(&udev, class_dev); - - /* run dev.d/ scripts if we created a node or changed a netif name */ - if (udev.devname[0] != '\0') { - setenv("DEVNAME", udev.devname, 1); - dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); - } - - sysfs_close_class_device(class_dev); - - return 0; -} - -static void exec_list(struct list_head *device_list) -{ - struct device *loop_device; - struct device *tmp_device; - int i; - - /* handle the "first" type devices first */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - for (i=0; first_list[i] != NULL; i++) { - if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { - add_device(loop_device->path, loop_device->subsys); - list_del(&loop_device->list); - free(loop_device); - break; - } - } - } - - /* handle the devices we are allowed to, excluding the "last" type devices */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - int found = 0; - for (i=0; last_list[i] != NULL; i++) { - if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) { - found = 1; - break; - } - } - if (found) - continue; - - add_device(loop_device->path, loop_device->subsys); - list_del(&loop_device->list); - free(loop_device); - } - - /* handle the rest of the devices left over, if any */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - add_device(loop_device->path, loop_device->subsys); - list_del(&loop_device->list); - free(loop_device); - } -} - -static void udev_scan_block(void) -{ - DIR *dir; - struct dirent *dent; - LIST_HEAD(device_list); - - dir = opendir(SYSBLOCK); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[MAX_PATHLEN]; - DIR *dir2; - struct dirent *dent2; - - if ((strcmp(dent->d_name, ".") == 0) || - (strcmp(dent->d_name, "..") == 0)) - continue; - - snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name); - dirname[MAX_PATHLEN-1] = '\0'; - device_list_insert(dirname, "block", &device_list); - - snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name); - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN]; - DIR *dir3; - struct dirent *dent3; - - if ((strcmp(dent2->d_name, ".") == 0) || - (strcmp(dent2->d_name, "..") == 0)) - continue; - - snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); - dirname2[MAX_PATHLEN-1] = '\0'; - - dir3 = opendir(dirname2); - if (dir3 != NULL) { - for (dent3 = readdir(dir3); dent3 != NULL; dent3 = readdir(dir3)) { - char filename[MAX_PATHLEN]; - - if (strcmp(dent3->d_name, "dev") == 0) { - snprintf(filename, MAX_PATHLEN, "/block/%s/%s", - dent->d_name, dent2->d_name); - filename[MAX_PATHLEN-1] = '\0'; - device_list_insert(filename, "block", &device_list); - } - } - closedir(dir3); - } - } - closedir(dir2); - } - } - closedir(dir); - } - - exec_list(&device_list); -} - -static void udev_scan_class(void) -{ - DIR *dir; - struct dirent *dent; - LIST_HEAD(device_list); - - dir = opendir(SYSCLASS); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[MAX_PATHLEN]; - DIR *dir2; - struct dirent *dent2; - - if ((strcmp(dent->d_name, ".") == 0) || - (strcmp(dent->d_name, "..") == 0)) - continue; - - snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); - dirname[MAX_PATHLEN-1] = '\0'; - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN]; - DIR *dir3; - struct dirent *dent3; - - if ((strcmp(dent2->d_name, ".") == 0) || - (strcmp(dent2->d_name, "..") == 0)) - continue; - - /* pass the net class as it is */ - if (strcmp(dent->d_name, "net") == 0) { - snprintf(dirname2, MAX_PATHLEN, "/class/net/%s", dent2->d_name); - device_list_insert(dirname2, "net", &device_list); - continue; - } - - snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); - dirname2[MAX_PATHLEN-1] = '\0'; - dir3 = opendir(dirname2); - if (dir3 != NULL) { - for (dent3 = readdir(dir3); dent3 != NULL; dent3 = readdir(dir3)) { - char filename[MAX_PATHLEN]; - - /* pass devices with a "dev" file */ - if (strcmp(dent3->d_name, "dev") == 0) { - snprintf(filename, MAX_PATHLEN, "/class/%s/%s", - dent->d_name, dent2->d_name); - filename[MAX_PATHLEN-1] = '\0'; - device_list_insert(filename, dent->d_name, &device_list); - break; - } - } - closedir(dir3); - } - } - closedir(dir2); - } - } - closedir(dir); - } - - exec_list(&device_list); -} - -int udev_start(void) -{ - /* set environment for callouts and dev.d/ */ - setenv("ACTION", "add", 1); - setenv("UDEVSTART", "1", 1); - - udev_scan_class(); - udev_scan_block(); - - return 0; -} -- cgit v1.2.3-54-g00ecf From e4ad54a302773d8b1c197e32fe67541f1b60518e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 13 Nov 2004 05:33:25 +0100 Subject: [PATCH] change key names in udevinfo sysfs walk to match the kernel --- udevinfo.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 08c25d3a04..097c91c21b 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -209,7 +209,7 @@ static int print_sysfs_devices(void) struct dlist *class_devices; struct sysfs_class_device *class_dev; struct sysfs_device *phys_dev; - struct sysfs_driver *driver; + unsigned int major, minor; cls = sysfs_open_class(class); if (!cls) @@ -228,23 +228,19 @@ static int print_sysfs_devices(void) attr = sysfs_get_classdev_attr(class_dev, "dev"); if (attr) { - char *pos = &(attr->value[strlen(attr->value)-1]); - - if (pos[0] == '\n') - pos[0] = '\0'; - - printf("DEVMAJORMINOR '%s'\n", attr->value); + sscanf(attr->value, "%u:%u", &major, &minor); + printf("MAJOR %u\n", minor); + printf("MINOR %u\n", major); } - driver = sysfs_get_classdev_driver(class_dev); - if (driver) - printf("DEVDRIVER '%s'\n", driver->name); - phys_dev = sysfs_get_classdev_device(class_dev); if (phys_dev) { printf("PHYSDEVPATH '%s'\n", phys_dev->path); if (phys_dev->bus[0] != '\0') printf("PHYSDEVBUS '%s'\n", phys_dev->bus); + + if (phys_dev->driver_name[0] != '\0') + printf("PHYSDEVDRIVER '%s'\n", phys_dev->driver_name); } } sysfs_close_class(cls); -- cgit v1.2.3-54-g00ecf From 90e84c81486d757f1eec263565e605c1df500e7c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 19 Nov 2004 03:41:38 +0100 Subject: [PATCH] let klibc add the trailing newline to syslog conditionally We get an empty line after every debug print from libsysfs, so don't add a second if we already have one. --- klibc/klibc/syslog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/klibc/klibc/syslog.c b/klibc/klibc/syslog.c index 592992ba6b..e9d84d9ddc 100644 --- a/klibc/klibc/syslog.c +++ b/klibc/klibc/syslog.c @@ -60,7 +60,8 @@ void vsyslog(int prio, const char *format, va_list ap) len += vsnprintf(buf+len, BUFLEN-len, format, ap); if ( len > BUFLEN-1 ) len = BUFLEN-1; - buf[len++] = '\n'; + if (buf[len-1] != '\n') + buf[len++] = '\n'; fd = __syslog_fd; if ( fd == -1 ) -- cgit v1.2.3-54-g00ecf From 4bee99940511a0e5ea5a3352ba2e8c0c97580e25 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 19 Nov 2004 03:43:43 +0100 Subject: [PATCH] add ippp and bcrypt to the exception lists of wait_for_sysfs --- udev_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 1953dd7775..fae3996406 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -145,6 +145,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "block", .device = "scd" }, { .subsystem = "block", .device = "ubd" }, { .subsystem = "block", .device = "dm-" }, + { .subsystem = "block", .device = "bcrypt" }, { .subsystem = "input", .device = "event" }, { .subsystem = "input", .device = "mice" }, { .subsystem = "input", .device = "mouse" }, @@ -168,6 +169,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "pan" }, { .subsystem = "net", .device = "bnep" }, { .subsystem = "net", .device = "vmnet" }, + { .subsystem = "net", .device = "ippp" }, { .subsystem = "ppp", .device = NULL }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, -- cgit v1.2.3-54-g00ecf From 80513ea38f66855fe9232d6eab3ab9469c379cad Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 19 Nov 2004 03:49:13 +0100 Subject: [PATCH] prevent udevd crash if DEVPATH is not set Just move the event straight to the exec list and don't try to compare a NULL pointer. --- udevd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index 43f3f0324b..dd505d03d9 100644 --- a/udevd.c +++ b/udevd.c @@ -153,9 +153,14 @@ static void udev_run(struct hotplug_msg *msg) static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) { struct hotplug_msg *loop_msg; - list_for_each_entry(loop_msg, &running_list, list) - if (strncmp(loop_msg->devpath, msg->devpath, sizeof(loop_msg->devpath)) == 0) + list_for_each_entry(loop_msg, &running_list, list) { + if (loop_msg->devpath == NULL || msg->devpath == NULL) + continue; + + if (strcmp(loop_msg->devpath, msg->devpath) == 0) return loop_msg; + } + return NULL; } -- cgit v1.2.3-54-g00ecf From fc2aa296137017ad748ef2a7fa08bf9de1336272 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 19 Nov 2004 03:50:05 +0100 Subject: [PATCH] remove get_device_type and merge that into udev_set_values() --- udev_lib.c | 48 +++++++++++++++++++----------------------------- udev_lib.h | 1 - udevinfo.c | 16 +++------------- 3 files changed, 22 insertions(+), 43 deletions(-) diff --git a/udev_lib.c b/udev_lib.c index a3fab9632d..d745c9bd86 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -36,41 +36,31 @@ #include "list.h" -#define BLOCK_PATH "/block/" -#define CLASS_PATH "/class/" -#define NET_PATH "/class/net/" - -char get_device_type(const char *path, const char *subsystem) +void udev_set_values(struct udevice *udev, const char* devpath, + const char *subsystem, const char* action) { - if (strcmp(subsystem, "block") == 0) - return 'b'; - - if (strcmp(subsystem, "net") == 0) - return 'n'; + memset(udev, 0x00, sizeof(struct udevice)); + if (devpath) + strfieldcpy(udev->devpath, devpath); + if (subsystem) + strfieldcpy(udev->subsystem, subsystem); + if (action) + strfieldcpy(udev->action, action); - if (strncmp(path, BLOCK_PATH, strlen(BLOCK_PATH)) == 0 && - strlen(path) > strlen(BLOCK_PATH)) - return 'b'; + if (strcmp(udev->subsystem, "block") == 0) + udev->type = 'b'; - if (strncmp(path, NET_PATH, strlen(NET_PATH)) == 0 && - strlen(path) > strlen(NET_PATH)) - return 'n'; + if (strcmp(udev->subsystem, "net") == 0) + udev->type = 'n'; - if (strncmp(path, CLASS_PATH, strlen(CLASS_PATH)) == 0 && - strlen(path) > strlen(CLASS_PATH)) - return 'c'; + if (strncmp(udev->devpath, "/block/", 7) == 0) + udev->type = 'b'; - return '\0'; -} + if (strncmp(udev->devpath, "/class/net/", 11) == 0) + udev->type = 'n'; -void udev_set_values(struct udevice *udev, const char* devpath, - const char *subsystem, const char* action) -{ - memset(udev, 0x00, sizeof(struct udevice)); - strfieldcpy(udev->devpath, devpath); - strfieldcpy(udev->subsystem, subsystem); - strfieldcpy(udev->action, action); - udev->type = get_device_type(devpath, subsystem); + if (strncmp(udev->devpath, "/class/", 7) == 0) + udev->type = 'c'; } int kernel_release_satisfactory(int version, int patchlevel, int sublevel) diff --git a/udev_lib.h b/udev_lib.h index 80dc49cd54..b9b0fda678 100644 --- a/udev_lib.h +++ b/udev_lib.h @@ -76,7 +76,6 @@ do { \ # define asmlinkage /* nothing */ #endif -extern char get_device_type(const char *path, const char *subsystem); extern void udev_set_values(struct udevice *udev, const char* devpath, const char *subsystem, const char* action); extern int kernel_release_satisfactory(int version, int patchlevel, int sublevel); diff --git a/udevinfo.c b/udevinfo.c index 097c91c21b..013068541e 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -125,10 +125,6 @@ static int print_device_chain(const char *path) struct sysfs_device *sysfs_dev; struct sysfs_device *sysfs_dev_parent; int retval = 0; - char type; - - type = get_device_type(path, ""); - dbg("device type is %c", type); /* get the class dev */ class_dev = sysfs_open_class_device_path(path); @@ -144,16 +140,10 @@ static int print_device_chain(const char *path) "to match the device for which the node will be created.\n" "\n"); - if (type == 'b' || type =='c') { - /* read the 'dev' file for major/minor*/ - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr == NULL) { - printf("couldn't get the \"dev\" file\n"); - retval = -1; - goto exit; - } + /* look for the 'dev' file */ + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr == NULL) printf("device '%s' has major:minor %s", class_dev->path, attr->value); - } /* open sysfs class device directory and print all attributes */ printf(" looking at class device '%s':\n", class_dev->path); -- cgit v1.2.3-54-g00ecf From c02ae2fe332e871b3132bfbc20ba8db359a71657 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 19 Nov 2004 04:03:52 +0100 Subject: [PATCH] Don't try to print major/minor for devices without a dev file. --- udevinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index 013068541e..901990ede6 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -142,7 +142,7 @@ static int print_device_chain(const char *path) /* look for the 'dev' file */ attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr == NULL) + if (attr != NULL) printf("device '%s' has major:minor %s", class_dev->path, attr->value); /* open sysfs class device directory and print all attributes */ -- cgit v1.2.3-54-g00ecf From 162c0ee8b95228676a83aaaaf5adf64ba56b0be8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 18 Nov 2004 19:39:05 -0800 Subject: [PATCH] 046 release --- ChangeLog | 32 ++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5088273e62..6319845aa7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +Summary of changes from v045 to v046 +============================================ + +Greg Kroah-Hartman: + o make spotless for releases + +Kay Sievers: + o Don't try to print major/minor for devices without a dev file + o remove get_device_type and merge that into udev_set_values() + o prevent udevd crash if DEVPATH is not set + o add ippp and bcrypt to the exception lists of wait_for_sysfs + o let klibc add the trailing newline to syslog conditionally + o disable logging for udevstart + o add NAME{ignore_remove} attribute + o remove historical SYSFS_attr="value" format + o don't wait for sysfs if the kernel(2.6.10-rc2) tells us what not to expect + o change key names in udevinfo sysfs walk to match the kernel + o support DRIVER as a rule key + o support SUBSYSTEM as a rule key + o rename udevdb* to udev_db* + o Make dev.d/ handling a separate processing stage + o make the udev object available to more processing stages + o remove udev_lib dependency from udevsend, which makes it smaller + o add ACTION to udev object to expose it to the whole process + o make udevinfo's -r option also workimg for symlink queries + o let udev act as udevstart if argv[1] == "udevstart" + o improve udevinfo sysfs info walk + o add sysfs info walk to udevinfo + o pass the whole event environment to udevd + o replace tdb database by simple lockless file database + + Summary of changes from v044 to v045 ============================================ diff --git a/Makefile b/Makefile index efbb74355a..1819dbecbb 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart WAIT = wait_for_sysfs -VERSION = 045 +VERSION = 046 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index edb033e864..05cee524c0 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 045 +Version: 046 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 8825e9e71b3eaac8ce90f4fede2bb07a7ea7a969 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 19 Nov 2004 22:42:19 -0800 Subject: [PATCH] fix network device naming bug --- udev_lib.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/udev_lib.c b/udev_lib.c index d745c9bd86..f388d23f3e 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -40,6 +40,7 @@ void udev_set_values(struct udevice *udev, const char* devpath, const char *subsystem, const char* action) { memset(udev, 0x00, sizeof(struct udevice)); + if (devpath) strfieldcpy(udev->devpath, devpath); if (subsystem) @@ -49,17 +50,13 @@ void udev_set_values(struct udevice *udev, const char* devpath, if (strcmp(udev->subsystem, "block") == 0) udev->type = 'b'; - - if (strcmp(udev->subsystem, "net") == 0) + else if (strcmp(udev->subsystem, "net") == 0) udev->type = 'n'; - - if (strncmp(udev->devpath, "/block/", 7) == 0) + else if (strncmp(udev->devpath, "/block/", 7) == 0) udev->type = 'b'; - - if (strncmp(udev->devpath, "/class/net/", 11) == 0) + else if (strncmp(udev->devpath, "/class/net/", 11) == 0) udev->type = 'n'; - - if (strncmp(udev->devpath, "/class/", 7) == 0) + else if (strncmp(udev->devpath, "/class/", 7) == 0) udev->type = 'c'; } -- cgit v1.2.3-54-g00ecf From ec9cc0127d3b50885723dd4f54d4851e7160ec22 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 03:28:41 +0100 Subject: [PATCH] udevd exit path cleanup --- udevd.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/udevd.c b/udevd.c index dd505d03d9..3ad8c47f22 100644 --- a/udevd.c +++ b/udevd.c @@ -419,7 +419,7 @@ int main(int argc, char *argv[], char *envp[]) if (getuid() != 0) { dbg("need to be root, exit"); - _exit(1); + goto exit; } /* make sure we don't lock any path */ @@ -430,7 +430,7 @@ int main(int argc, char *argv[], char *envp[]) fd = open( "/dev/null", O_RDWR ); if ( fd < 0 ) { dbg("error opening /dev/null %s", strerror(errno)); - exit(1); + goto exit; } dup2(fd, 0); dup2(fd, 1); @@ -445,29 +445,29 @@ int main(int argc, char *argv[], char *envp[]) retval = pipe(pipefds); if (retval < 0) { dbg("error getting pipes: %s", strerror(errno)); - exit(1); + goto exit; } retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK); if (retval < 0) { dbg("error fcntl on read pipe: %s", strerror(errno)); - exit(1); + goto exit; } retval = fcntl(pipefds[0], F_SETFD, FD_CLOEXEC); if (retval < 0) { dbg("error fcntl on read pipe: %s", strerror(errno)); - exit(1); + goto exit; } retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK); if (retval < 0) { dbg("error fcntl on write pipe: %s", strerror(errno)); - exit(1); + goto exit; } retval = fcntl(pipefds[1], F_SETFD, FD_CLOEXEC); if (retval < 0) { dbg("error fcntl on write pipe: %s", strerror(errno)); - exit(1); + goto exit; } /* set signal handlers */ @@ -488,13 +488,14 @@ int main(int argc, char *argv[], char *envp[]) udevsendsock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udevsendsock == -1) { dbg("error getting socket, exit"); - exit(1); + goto exit; } /* the bind takes care of ensuring only one copy running */ retval = bind(udevsendsock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { dbg("bind failed, exit"); + close(udevsendsock); goto exit; } @@ -549,8 +550,8 @@ int main(int argc, char *argv[], char *envp[]) exec_queue_manager(); } } + exit: - close(udevsendsock); logging_close(); return 1; } -- cgit v1.2.3-54-g00ecf From f602ccf0723f116c2c3a77e057a0540027aa38b8 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 03:30:13 +0100 Subject: [PATCH] close connection to syslog in forked udevd child --- udevd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevd.c b/udevd.c index 3ad8c47f22..2337493f1e 100644 --- a/udevd.c +++ b/udevd.c @@ -131,6 +131,7 @@ static void udev_run(struct hotplug_msg *msg) case 0: /* child */ close(udevsendsock); + logging_close(); execle(udev_bin, "udev", msg->subsystem, NULL, msg->envp); dbg("exec of child failed"); _exit(1); -- cgit v1.2.3-54-g00ecf From 8474ff500fa5671185f6203f5f20162304a5c7df Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 03:36:32 +0100 Subject: [PATCH] add a bunch of busses to the list of what to wait for --- udev_sysfs.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index fae3996406..e2c706c6f5 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -278,6 +278,28 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "ieee1394", .file = "node_count" }, { .bus = "ieee1394", .file = "nodeid" }, { .bus = "ieee1394", .file = "address" }, + { .bus = "bttv-sub", .file = "detach_state" }, + { .bus = "pnp", .file = "detach_state" }, + { .bus = "eisa", .file = "detach_state" }, + { .bus = "pseudo", .file = "detach_state" }, + { .bus = "mmc", .file = "detach_state" }, + { .bus = "macio", .file = "detach_state" }, + { .bus = "of_platform", .file = "detach_state" }, + { .bus = "vio", .file = "detach_state" }, + { .bus = "ecard", .file = "detach_state" }, + { .bus = "sa1111-rab", .file = "detach_state" }, + { .bus = "amba", .file = "detach_state" }, + { .bus = "locomo-bus", .file = "detach_state" }, + { .bus = "logicmodule", .file = "detach_state" }, + { .bus = "parisc", .file = "detach_state" }, + { .bus = "ocp", .file = "detach_state" }, + { .bus = "dio", .file = "detach_state" }, + { .bus = "MCA", .file = "detach_state" }, + { .bus = "wl", .file = "detach_state" }, + { .bus = "ccwgroup", .file = "detach_state" }, + { .bus = "css", .file = "detach_state" }, + { .bus = "ccw", .file = "detach_state" }, + { .bus = "iucv", .file = "detach_state" }, { NULL, NULL } }; struct device_file *devicefile; -- cgit v1.2.3-54-g00ecf From a4f0cc793a9a2053f9733c5ebd1445c9a2678445 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 03:43:37 +0100 Subject: [PATCH] Patch from Alex Riesen > I just put const's at some places. It cut down data segments, but > increased code size. > Overall still smaller: > > -rwxr-xr-x 1 user users 50420 Nov 19 10:53 ../udev-046/udev > -rwxr-xr-x 1 user users 49556 Nov 19 10:53 udev > text data bss dec hex filename > 47245 968 22480 70693 11425 ../udev-046/udev > 48089 104 22064 70257 11271 udev > > Also, the instance of utsname in udev_lib.c is used only once. --- udev_lib.c | 2 +- udev_sysfs.c | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/udev_lib.c b/udev_lib.c index f388d23f3e..86a526f7e8 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -62,12 +62,12 @@ void udev_set_values(struct udevice *udev, const char* devpath, int kernel_release_satisfactory(int version, int patchlevel, int sublevel) { - static struct utsname uts; static int kversion = 0; static int kpatchlevel; static int ksublevel; if (kversion == 0) { + struct utsname uts; if (uname(&uts) != 0) return -1; diff --git a/udev_sysfs.c b/udev_sysfs.c index e2c706c6f5..a25223ef46 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -35,9 +35,9 @@ #include "logging.h" /* list of subsystem specific files, NULL if there is no file to wait for */ -static struct subsystem_file { - char *subsystem; - char *file; +static const struct subsystem_file { + const char *subsystem; + const char *file; } subsystem_files[] = { { .subsystem = "net", .file = "ifindex" }, { .subsystem = "scsi_host", .file = "unique_id" }, @@ -56,7 +56,7 @@ static struct subsystem_file { int subsystem_expect_no_dev(const char *subsystem) { - struct subsystem_file *file; + const struct subsystem_file *file; for (file = subsystem_files; file->subsystem != NULL; file++) if (strcmp(subsystem, file->subsystem) == 0) @@ -66,9 +66,9 @@ int subsystem_expect_no_dev(const char *subsystem) } /* get subsystem specific files, returns "dev" if no other found */ -static char *get_subsystem_specific_file(const char *subsystem) +static const char *get_subsystem_specific_file(const char *subsystem) { - struct subsystem_file *file; + const struct subsystem_file *file; /* look if we want to look for another file instead of "dev" */ for (file = subsystem_files; file->subsystem != NULL; file++) @@ -123,9 +123,9 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { /* list of devices without a "device" symlink to the physical device * if device is set to NULL, no devices in that subsystem has a link */ - static struct class_device { - char *subsystem; - char *device; + static const struct class_device { + const char *subsystem; + const char *device; } class_device[] = { { .subsystem = "block", .device = "double" }, { .subsystem = "block", .device = "nb" }, @@ -202,7 +202,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "capi", .device = NULL }, { NULL, NULL } }; - struct class_device *classdevice; + const struct class_device *classdevice; int len; /* the kernel may tell us what to wait for */ @@ -240,13 +240,13 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d /* skip waiting for the bus of the devices device */ static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) { - static char *devices_without_bus[] = { + static const char *devices_without_bus[] = { "scsi_host", "i2c-adapter", "i2c-dev", NULL }; - char **device; + const char **device; for (device = devices_without_bus; *device != NULL; device++) { int len = strlen(*device); @@ -262,9 +262,9 @@ static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) int wait_for_devices_device(struct sysfs_device *devices_dev, const char **error) { - static struct device_file { - char *bus; - char *file; + static const struct device_file { + const char *bus; + const char *file; } device_files[] = { { .bus = "scsi", .file = "vendor" }, { .bus = "usb", .file = "idVendor" }, @@ -302,7 +302,7 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "iucv", .file = "detach_state" }, { NULL, NULL } }; - struct device_file *devicefile; + const struct device_file *devicefile; int loop; /* the kernel may tell us what to wait for */ -- cgit v1.2.3-54-g00ecf From ff5761c9727a5df9ac348fb9f8feed2469d6861f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Mon, 22 Nov 2004 19:23:00 -0800 Subject: [PATCH] fix parallel build error --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1819dbecbb..de08f7cf52 100644 --- a/Makefile +++ b/Makefile @@ -209,6 +209,7 @@ OBJS = udev_lib.o \ udev_config.o \ udev_add.o \ udev_remove.o \ + udev_start.o \ udev_sysfs.o \ udev_db.o \ namedev.o \ @@ -283,8 +284,8 @@ $(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(WAIT).o: $(GEN_HEADERS) $(HOST_PROGS) -$(ROOT): $(LIBC) $(ROOT).o udev_start.o $(OBJS) $(HEADERS) $(GEN_MANPAGES) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o udev_start.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(ROOT): $(LIBC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(TESTER): $(LIBC) $(TESTER).o $(OBJS) $(HEADERS) -- cgit v1.2.3-54-g00ecf From 7a0643a93f53cd5e7a05ae3d0c384e9e3160a94f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 03:55:24 +0100 Subject: [PATCH] add support for /devices-devices without any file to wait for --- udev_sysfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index a25223ef46..7293407be1 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -267,6 +267,7 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, const char *file; } device_files[] = { { .bus = "scsi", .file = "vendor" }, + { .bus = "usb", .file = NULL }, { .bus = "usb", .file = "idVendor" }, { .bus = "usb", .file = "iInterface" }, { .bus = "usb", .file = "bNumEndpoints" }, @@ -278,7 +279,7 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "ieee1394", .file = "node_count" }, { .bus = "ieee1394", .file = "nodeid" }, { .bus = "ieee1394", .file = "address" }, - { .bus = "bttv-sub", .file = "detach_state" }, + { .bus = "bttv-sub", .file = NULL }, { .bus = "pnp", .file = "detach_state" }, { .bus = "eisa", .file = "detach_state" }, { .bus = "pseudo", .file = "detach_state" }, @@ -338,6 +339,11 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, char filename[SYSFS_PATH_MAX]; struct stat stats; + if (devicefile->file == NULL) { + dbg("bus '%s' has no file to wait for", devices_dev->bus); + return 0; + } + found_bus_type = 1; snprintf(filename, SYSFS_PATH_MAX-1, "%s/%s", devices_dev->path, devicefile->file); dbg("looking at bus '%s' device for specific file '%s'", devices_dev->bus, filename); -- cgit v1.2.3-54-g00ecf From 69d2dbd66fdd52b5ebbc6545ef693fdd3f0638ec Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 04:47:06 +0100 Subject: [PATCH] export udev_log flag to the environment Forked scripts and callouts may want to follow udev's configured behavior and log only if udev is logging itself. --- udev.c | 10 +++++++++- udev_start.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/udev.c b/udev.c index 78fe82cfbb..39c16c2e77 100644 --- a/udev.c +++ b/udev.c @@ -81,6 +81,10 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udev"); udev_init_config(); + /* export logging flag, callouts may want to do the same as udev */ + if (udev_log) + setenv("UDEV_LOG", "1", 1); + if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) { act_type = UDEVSTART; } else { @@ -143,7 +147,11 @@ int main(int argc, char *argv[], char *envp[]) switch(act_type) { case UDEVSTART: dbg("udevstart"); + + /* disable all logging as it's much too slow on some facilities */ udev_log = 0; + unsetenv("UDEV_LOG"); + namedev_init(); retval = udev_start(); break; @@ -155,7 +163,7 @@ int main(int argc, char *argv[], char *envp[]) class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { dbg ("sysfs_open_class_device_path failed"); - break; + goto exit; } dbg("opened class_dev->name='%s'", class_dev->name); diff --git a/udev_start.c b/udev_start.c index c1d877fb37..3e3062c019 100644 --- a/udev_start.c +++ b/udev_start.c @@ -291,7 +291,7 @@ int udev_start(void) { /* set environment for callouts and dev.d/ */ setenv("ACTION", "add", 1); - setenv("UDEVSTART", "1", 1); + setenv("UDEV_START", "1", 1); udev_scan_class(); udev_scan_block(); -- cgit v1.2.3-54-g00ecf From a97b06483e3006a7d21e534694e8d67d3b3c694d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 05:05:37 +0100 Subject: [PATCH] export DEVNAME on remove event Fix from Sjoerd Simons , it got lost on the recent reorganization of the udev processing stages. --- udev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/udev.c b/udev.c index 39c16c2e77..605a55bf19 100644 --- a/udev.c +++ b/udev.c @@ -187,8 +187,11 @@ int main(int argc, char *argv[], char *envp[]) /* get node from db, delete it*/ retval = udev_remove_device(&udev); - /* run scripts */ - dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + /* run dev.d/ scripts if we're not instructed to ignore the event */ + if (udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + } } exit: -- cgit v1.2.3-54-g00ecf From 6f59ed5547426ddaf6bedf574d19a19f6bd20e1f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 06:14:21 +0100 Subject: [PATCH] add MANAGED_EVENT to the forked udev environment This will prevent a loop, if udev sends events back into the daemon. --- udevd.c | 3 ++- udevd.h | 4 ++-- udevsend.c | 6 ++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/udevd.c b/udevd.c index 2337493f1e..bd36d2c192 100644 --- a/udevd.c +++ b/udevd.c @@ -291,7 +291,7 @@ static void handle_udevsend_msg(int sock) /* copy environment buffer and reconstruct envp */ memcpy(msg->envbuf, usend_msg.envbuf, envbuf_size); bufpos = 0; - for (i = 0; (bufpos < envbuf_size) && (i < HOTPLUG_NUM_ENVP-1); i++) { + for (i = 0; (bufpos < envbuf_size) && (i < HOTPLUG_NUM_ENVP-2); i++) { int keylen; char *key; @@ -314,6 +314,7 @@ static void handle_udevsend_msg(int sock) if (strncmp(key, "SEQNUM=", 7) == 0) msg->seqnum = strtoull(&key[7], NULL, 10); } + msg->envp[i++] = "MANAGED_EVENT=1"; msg->envp[i] = NULL; /* if no seqnum is given, we move straight to exec queue */ diff --git a/udevd.h b/udevd.h index b393a28bf9..31f07de826 100644 --- a/udevd.h +++ b/udevd.h @@ -36,7 +36,7 @@ struct udevsend_msg { char magic[20]; - char envbuf[HOTPLUG_BUFFER_SIZE]; + char envbuf[HOTPLUG_BUFFER_SIZE+256]; }; struct hotplug_msg { @@ -47,6 +47,6 @@ struct hotplug_msg { char *devpath; char *subsystem; unsigned long long seqnum; - char *envp[HOTPLUG_NUM_ENVP]; + char *envp[HOTPLUG_NUM_ENVP+1]; char envbuf[]; }; diff --git a/udevsend.c b/udevsend.c index 9f324077b3..7d865573c2 100644 --- a/udevsend.c +++ b/udevsend.c @@ -132,6 +132,12 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + /* prevent loops in the scripts we execute */ + if (getenv("MANAGED_EVENT") != NULL) { + dbg("seems that the event source is not the kernel, just exit"); + goto exit; + } + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { dbg("error getting socket"); -- cgit v1.2.3-54-g00ecf From 491b02acd95904f17829f792c5a69c26bee1f2a7 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 06:22:26 +0100 Subject: [PATCH] make the searched multiplex directories conditionally If we don't have "name" or a "subsystem" don't look for it. --- dev_d.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dev_d.c b/dev_d.c index d14c70c256..817355af60 100644 --- a/dev_d.c +++ b/dev_d.c @@ -96,13 +96,17 @@ void dev_d_execute(struct udevice *udev, const char *basedir, const char *suffix temp = strchr(temp, '/'); } - snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->name); - dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); + if (udev->name[0] != '\0') { + snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->name); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); + } - snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->subsystem); - dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); + if (udev->subsystem[0] != '\0') { + snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->subsystem); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); + } snprintf(dirname, PATH_MAX, "%s/default", basedir); dirname[PATH_MAX-1] = '\0'; -- cgit v1.2.3-54-g00ecf From cc0e9bfc350e6a8b3fff79a9a0f2a97afa9b3825 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 04:22:16 +0100 Subject: [PATCH] remove my test code --- udev_sysfs.c | 1 - 1 file changed, 1 deletion(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index 7293407be1..4976b8f308 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -267,7 +267,6 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, const char *file; } device_files[] = { { .bus = "scsi", .file = "vendor" }, - { .bus = "usb", .file = NULL }, { .bus = "usb", .file = "idVendor" }, { .bus = "usb", .file = "iInterface" }, { .bus = "usb", .file = "bNumEndpoints" }, -- cgit v1.2.3-54-g00ecf From c449b25e3f998efe8f5988632126fb468ee55fc5 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 07:34:56 +0100 Subject: [PATCH] integrate wait_for_sysfs in udev Move the wait_for_sysfs logic into the udev binary. udev is called for every hotplug event. It also waits for /devices events. --- Makefile | 14 +---- udev.c | 186 ++++++++++++++++++++++++++++--------------------------- wait_for_sysfs.c | 165 ------------------------------------------------ 3 files changed, 97 insertions(+), 268 deletions(-) delete mode 100644 wait_for_sysfs.c diff --git a/Makefile b/Makefile index de08f7cf52..c89fa0feee 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,6 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -WAIT = wait_for_sysfs VERSION = 046 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) @@ -178,7 +177,7 @@ CFLAGS += -I$(PWD)/libsysfs/sysfs \ # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf -all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(WAIT) $(GEN_CONFIGS) +all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(GEN_CONFIGS) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -282,7 +281,6 @@ $(INFO).o: $(GEN_HEADERS) $(HOST_PROGS) $(DAEMON).o: $(GEN_HEADERS) $(HOST_PROGS) $(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) -$(WAIT).o: $(GEN_HEADERS) $(HOST_PROGS) $(ROOT): $(LIBC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) @@ -304,10 +302,6 @@ $(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ -$(WAIT): $(WAIT).o $(OBJS) $(HEADERS) $(LIBC) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(WAIT).o udev_sysfs.o udev_lib.o udev_config.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - #.c.o: # $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) -c -o $@ $< .c.o: @@ -317,7 +311,7 @@ $(WAIT): $(WAIT).o $(OBJS) $(HEADERS) $(LIBC) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) $(WAIT) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) -rm -f ccdv $(MAKE) -C klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ @@ -417,10 +411,8 @@ install: install-initscript install-config install-man install-dev.d all $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) - $(INSTALL_PROGRAM) -D $(WAIT) $(DESTDIR)$(sbindir)/$(WAIT) - ln -f -s $(sbindir)/udev $(DESTDIR)$(sbindir)/$(STARTER) - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/10-udev.hotplug - - ln -f -s $(sbindir)/$(WAIT) $(DESTDIR)$(hotplugdir)/05-wait_for_sysfs.hotplug ifndef DESTDIR - killall $(DAEMON) - rm -rf $(udevdb) @@ -433,7 +425,6 @@ endif uninstall: uninstall-man uninstall-dev.d - rm $(hotplugdir)/10-udev.hotplug - - rm $(hotplugdir)/05-wait_for_sysfs.hotplug - rm $(configdir)/rules.d/50-udev.rules - rm $(configdir)/permissions.d/50-udev.permissions - rm $(configdir)/udev.conf @@ -447,7 +438,6 @@ uninstall: uninstall-man uninstall-dev.d - rm $(sbindir)/$(STARTER) - rm $(usrbindir)/$(INFO) - rm $(usrbindir)/$(TESTER) - - rm $(usrbindir)/$(WAIT) - rmdir $(hotplugdir) - rm -rf $(udevdb) - rmdir $(udevdir) diff --git a/udev.c b/udev.c index 605a55bf19..8e6d06f1bd 100644 --- a/udev.c +++ b/udev.c @@ -4,6 +4,7 @@ * Userspace devfs * * Copyright (C) 2003,2004 Greg Kroah-Hartman + * Copyright (C) 2004 Kay Sievers * * 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 @@ -24,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -68,70 +70,19 @@ int main(int argc, char *argv[], char *envp[]) { struct sigaction act; struct sysfs_class_device *class_dev; + struct sysfs_device *devices_dev; struct udevice udev; char path[SYSFS_PATH_MAX]; int retval = -EINVAL; - enum { - ADD, - REMOVE, - UDEVSTART, - } act_type; + const char *error; + const char *action = getenv("ACTION"); + const char *devpath = getenv("DEVPATH"); + const char *subsystem = argv[1]; dbg("version %s", UDEV_VERSION); logging_init("udev"); udev_init_config(); - /* export logging flag, callouts may want to do the same as udev */ - if (udev_log) - setenv("UDEV_LOG", "1", 1); - - if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) { - act_type = UDEVSTART; - } else { - const char *action = getenv("ACTION"); - const char *devpath = getenv("DEVPATH"); - const char *subsystem = argv[1]; - - if (!action) { - dbg("no action?"); - goto exit; - } - if (strcmp(action, "add") == 0) { - act_type = ADD; - } else if (strcmp(action, "remove") == 0) { - act_type = REMOVE; - } else { - dbg("no action '%s' for us", action); - goto exit; - } - - if (!devpath) { - dbg("no devpath?"); - goto exit; - } - dbg("looking at '%s'", devpath); - - /* we only care about class devices and block stuff */ - if (!strstr(devpath, "class") && !strstr(devpath, "block")) { - dbg("not a block or class device"); - goto exit; - } - - if (!subsystem) { - dbg("no subsystem"); - goto exit; - } - - udev_set_values(&udev, devpath, subsystem, action); - - /* skip blacklisted subsystems */ - if (udev.type != 'n' && subsystem_expect_no_dev(subsystem)) { - dbg("don't care about '%s' devices", subsystem); - goto exit; - }; - - } - /* set signal handlers */ act.sa_handler = (void (*) (int))sig_handler; sigemptyset (&act.sa_mask); @@ -141,57 +92,110 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); - /* trigger timout to interrupt blocking syscalls */ + /* trigger timeout to interrupt blocking syscalls */ alarm(ALARM_TIMEOUT); - switch(act_type) { - case UDEVSTART: + udev_set_values(&udev, devpath, subsystem, action); + + if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) { dbg("udevstart"); - /* disable all logging as it's much too slow on some facilities */ + /* disable all logging, as it's much too slow on some facilities */ udev_log = 0; - unsetenv("UDEV_LOG"); namedev_init(); retval = udev_start(); - break; - case ADD: - dbg("udev add"); - - /* open the device */ - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); - class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) { - dbg ("sysfs_open_class_device_path failed"); - goto exit; - } - dbg("opened class_dev->name='%s'", class_dev->name); + goto exit; + } - /* init rules */ - namedev_init(); + if (!action) { + dbg("no action"); + goto exit; + } + + if (!subsystem) { + dbg("no subsystem"); + goto exit; + } + + if (!devpath) { + dbg("no devpath"); + goto exit; + } - /* name, create node, store in db */ - retval = udev_add_device(&udev, class_dev); + /* export logging flag, called scripts may want to do the same as udev */ + if (udev_log) + setenv("UDEV_LOG", "1", 1); + + if ((strncmp(devpath, "/block/", 7) == 0) || (strncmp(devpath, "/class/", 7) == 0)) { + if (strcmp(action, "add") == 0) { + /* wait for sysfs and possibly add node */ + dbg("udev add"); + + /* skip blacklisted subsystems */ + if (udev.type != 'n' && subsystem_expect_no_dev(udev.subsystem)) { + dbg("don't care about '%s' devices", udev.subsystem); + goto exit; + }; + + snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); + class_dev = wait_class_device_open(path); + if (class_dev == NULL) { + dbg ("open class device failed"); + goto exit; + } + dbg("opened class_dev->name='%s'", class_dev->name); + + wait_for_class_device(class_dev, &error); + + /* init rules, permissions */ + namedev_init(); + + /* name, create node, store in db */ + retval = udev_add_device(&udev, class_dev); + + /* run dev.d/ scripts if we created a node or changed a netif name */ + if (udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + } + + sysfs_close_class_device(class_dev); + } else if (strcmp(action, "remove") == 0) { + /* possibly remove a node */ + dbg("udev remove"); + + /* get node from db, delete it */ + retval = udev_remove_device(&udev); + + /* run dev.d/ scripts if we're not instructed to ignore the event */ + if (udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + } - /* run dev.d/ scripts if we created a node or changed a netif name */ - if (udev.devname[0] != '\0') { - setenv("DEVNAME", udev.devname, 1); - dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); } + } else if ((strncmp(devpath, "/devices/", 9) == 0)) { + if (strcmp(action, "add") == 0) { + /* wait for sysfs */ + dbg("devices add"); - sysfs_close_class_device(class_dev); - break; - case REMOVE: - dbg("udev remove"); + snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); + devices_dev = wait_devices_device_open(path); + if (!devices_dev) { + dbg("devices device unavailable (probably remove has beaten us)"); + goto exit; + } + dbg("devices device opened '%s'", path); - /* get node from db, delete it*/ - retval = udev_remove_device(&udev); + wait_for_devices_device(devices_dev, &error); - /* run dev.d/ scripts if we're not instructed to ignore the event */ - if (udev.devname[0] != '\0') { - setenv("DEVNAME", udev.devname, 1); - dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + sysfs_close_device(devices_dev); + } else if (strcmp(action, "remove") == 0) { + dbg("devices remove"); } + } else { + dbg("unhandled"); } exit: diff --git a/wait_for_sysfs.c b/wait_for_sysfs.c deleted file mode 100644 index 84a25adb97..0000000000 --- a/wait_for_sysfs.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * wait_for_sysfs.c - small program to delay the execution - * of /etc/hotplug.d/ programs, until sysfs - * is fully populated by the kernel. Depending on - * the type of device, we wait for all expected - * directories and then just exit. - * - * Copyright (C) 2004 Kay Sievers - * Copyright (C) 2004 Greg Kroah-Hartman - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libsysfs/sysfs/libsysfs.h" -#include "udev_lib.h" -#include "udev_version.h" -#include "udev_sysfs.h" -#include "logging.h" - -#ifdef LOG -unsigned char logname[LOGNAME_SIZE]; -void log_message(int level, const char *format, ...) -{ - va_list args; - - va_start(args, format); - vsyslog(level, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) -{ - const char *devpath = ""; - const char *action; - const char *subsystem; - char sysfs_mnt_path[SYSFS_PATH_MAX]; - char filename[SYSFS_PATH_MAX]; - struct sysfs_class_device *class_dev; - struct sysfs_device *devices_dev; - int rc = 0; - const char *error = NULL; - - logging_init("wait_for_sysfs"); - - if (argc != 2) { - dbg("error: subsystem"); - return 1; - } - subsystem = argv[1]; - - devpath = getenv ("DEVPATH"); - if (!devpath) { - dbg("error: no DEVPATH"); - rc = 1; - goto exit; - } - - action = getenv ("ACTION"); - if (!action) { - dbg("error: no ACTION"); - rc = 1; - goto exit; - } - - /* we only wait on an add event */ - if (strcmp(action, "add") != 0) { - dbg("no add ACTION"); - goto exit; - } - - if (sysfs_get_mnt_path(sysfs_mnt_path, SYSFS_PATH_MAX) != 0) { - dbg("error: no sysfs path"); - rc = 2; - goto exit; - } - - if ((strncmp(devpath, "/block/", 7) == 0) || (strncmp(devpath, "/class/", 7) == 0)) { - snprintf(filename, SYSFS_PATH_MAX, "%s%s", sysfs_mnt_path, devpath); - filename[SYSFS_PATH_MAX-1] = '\0'; - - /* skip bad events where we get no device for the class */ - if (strncmp(devpath, "/class/", 7) == 0 && strchr(&devpath[7], '/') == NULL) { - dbg("no device name for '%s', bad event", devpath); - goto exit; - } - - /* open the class device we are called for */ - class_dev = wait_class_device_open(filename); - if (!class_dev) { - dbg("error: class device unavailable (probably remove has beaten us)"); - goto exit; - } - dbg("class device opened '%s'", filename); - - /* wait for the class device with possible physical device and bus */ - wait_for_class_device(class_dev, &error); - - /* - * we got too many unfixable class/net errors, kernel later than 2.6.10-rc1 will - * solve this by exporting the needed information with the hotplug event - * until we use this just don't print any error for net devices, but still - * wait for it. - */ - if (strncmp(devpath, "/class/net/", 11) == 0) - error = NULL; - - sysfs_close_class_device(class_dev); - - } else if ((strncmp(devpath, "/devices/", 9) == 0)) { - snprintf(filename, SYSFS_PATH_MAX, "%s%s", sysfs_mnt_path, devpath); - filename[SYSFS_PATH_MAX-1] = '\0'; - - /* open the path we are called for */ - devices_dev = wait_devices_device_open(filename); - if (!devices_dev) { - dbg("error: devices device unavailable (probably remove has beaten us)"); - goto exit; - } - dbg("devices device opened '%s'", filename); - - /* wait for the devices device */ - wait_for_devices_device(devices_dev, &error); - - sysfs_close_device(devices_dev); - - } else { - dbg("unhandled sysfs path, no need to wait"); - } - -exit: - if (error) { - info("either wait_for_sysfs (udev %s) needs an update to handle the device '%s' " - "properly (%s) or the sysfs-support of your device's driver needs to be fixed, " - "please report to ", - UDEV_VERSION, devpath, error); - rc =3; - } else { - dbg("result: waiting for sysfs successful '%s'", devpath); - } - - logging_close(); - exit(rc); -} -- cgit v1.2.3-54-g00ecf From d07557b9b6ba72f50c6b80ea06cecac61cf9eeb1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 23 Nov 2004 08:01:57 +0100 Subject: [PATCH] handle whole hotplug event with udevd/udev If /proc/sys/kernel/hotplug points to /sbin/udevsend we handle the whole hotplug event with multiplexing /etc/hotplug.d/. --- udev.c | 44 ++++++++++++++++++++++++++++++++++++-------- udev.h | 3 +++ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/udev.c b/udev.c index 8e6d06f1bd..dad64288a9 100644 --- a/udev.c +++ b/udev.c @@ -55,6 +55,30 @@ void log_message(int level, const char *format, ...) } #endif +/* (for now) true if udevsend is the helper */ +static int manage_hotplug_event(void) { + char helper[256]; + int fd; + int len; + + fd = open("/proc/sys/kernel/hotplug", O_RDONLY); + if (fd < 0) + goto exit; + + len = read(fd, helper, 256); + close(fd); + + if (len < 0) + goto exit; + helper[len] = '\0'; + + if (strstr(helper, "udevsend")) + return 1; + +exit: + return 0; +} + static void asmlinkage sig_handler(int signum) { switch (signum) { @@ -110,20 +134,20 @@ int main(int argc, char *argv[], char *envp[]) if (!action) { dbg("no action"); - goto exit; + goto hotplug; } if (!subsystem) { dbg("no subsystem"); - goto exit; + goto hotplug; } if (!devpath) { dbg("no devpath"); - goto exit; + goto hotplug; } - /* export logging flag, called scripts may want to do the same as udev */ + /* export logging flag, as called scripts may want to do the same as udev */ if (udev_log) setenv("UDEV_LOG", "1", 1); @@ -135,14 +159,14 @@ int main(int argc, char *argv[], char *envp[]) /* skip blacklisted subsystems */ if (udev.type != 'n' && subsystem_expect_no_dev(udev.subsystem)) { dbg("don't care about '%s' devices", udev.subsystem); - goto exit; + goto hotplug; }; snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); class_dev = wait_class_device_open(path); if (class_dev == NULL) { dbg ("open class device failed"); - goto exit; + goto hotplug; } dbg("opened class_dev->name='%s'", class_dev->name); @@ -165,7 +189,7 @@ int main(int argc, char *argv[], char *envp[]) /* possibly remove a node */ dbg("udev remove"); - /* get node from db, delete it */ + /* get node from db, remove db-entry, delete created node */ retval = udev_remove_device(&udev); /* run dev.d/ scripts if we're not instructed to ignore the event */ @@ -184,7 +208,7 @@ int main(int argc, char *argv[], char *envp[]) devices_dev = wait_devices_device_open(path); if (!devices_dev) { dbg("devices device unavailable (probably remove has beaten us)"); - goto exit; + goto hotplug; } dbg("devices device opened '%s'", path); @@ -198,6 +222,10 @@ int main(int argc, char *argv[], char *envp[]) dbg("unhandled"); } +hotplug: + if (manage_hotplug_event()) + dev_d_execute(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX); + exit: logging_close(); return retval; diff --git a/udev.h b/udev.h index d9a775ae91..e834f1e5b9 100644 --- a/udev.h +++ b/udev.h @@ -44,6 +44,9 @@ #define DEVD_DIR "/etc/dev.d" #define DEVD_SUFFIX ".dev" +#define HOTPLUGD_DIR "/etc/hotplug.d" +#define HOTPLUG_SUFFIX ".hotplug" + struct udevice { char devpath[DEVPATH_SIZE]; char subsystem[SUBSYSTEM_SIZE]; -- cgit v1.2.3-54-g00ecf From 0d1ecb44a0b8c00b0fc6314d19e1bc8efd0f32bb Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 2 Dec 2004 21:45:26 -0800 Subject: [PATCH] fix udevinfo '-q path' option as it was not working --- udevinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index 901990ede6..9ba302cbdc 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -401,7 +401,7 @@ print: break; case PATH: - strfieldcpy(result, path); + strfieldcpy(result, udev.devpath); break; case ALL: -- cgit v1.2.3-54-g00ecf From 67aca2c50984d0b463c714eba142f33bb07f45a2 Mon Sep 17 00:00:00 2001 From: "sjoerd@spring.luon.net" Date: Tue, 23 Nov 2004 07:49:55 -0800 Subject: [PATCH] DEVNAME on device removal I just noticed that the DEVNAME enviroment variable isn't being set anymore in udev 0.046 on device removal, while it was being set in 0.042. We're using the property tto do umount -l when a block device is removed. Afaik there is no other way to associate a device with it's DEVNAME on removal ? Also are there cases where doing umount -l on the removed devices is wrong? I guess the device is gone, so there is no sense in keeping it mounted (it's not like the filesystem is gonna come back in a sane state again).. Attached (trivial) patch brings back the DEVNAME variable on device removal. --- udev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udev.c b/udev.c index dad64288a9..efeb1b5050 100644 --- a/udev.c +++ b/udev.c @@ -192,6 +192,10 @@ int main(int argc, char *argv[], char *envp[]) /* get node from db, remove db-entry, delete created node */ retval = udev_remove_device(&udev); + /* Set the DEVNAME if known */ + if (udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + } /* run dev.d/ scripts if we're not instructed to ignore the event */ if (udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); -- cgit v1.2.3-54-g00ecf From aa8666f77b1f605dced47a822a8b74b9c1326fed Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 2 Dec 2004 22:14:57 -0800 Subject: [PATCH] fix spurious valgrind warning in udev. --- udev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev.c b/udev.c index efeb1b5050..e71cddd3ee 100644 --- a/udev.c +++ b/udev.c @@ -108,6 +108,7 @@ int main(int argc, char *argv[], char *envp[]) udev_init_config(); /* set signal handlers */ + memset(&act, 0x00, sizeof(act)); act.sa_handler = (void (*) (int))sig_handler; sigemptyset (&act.sa_mask); act.sa_flags = 0; -- cgit v1.2.3-54-g00ecf From ad89f2be3b045f37b7e17de10f5ad46dbb09664f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 2 Dec 2004 22:16:54 -0800 Subject: [PATCH] comment out ability to run udev-test.pl with valgrind --- test/udev-test.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index d584579584..c2d8e27a52 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -35,6 +35,9 @@ my $perm = "udev.permissions"; my $main_conf = "udev-test.conf"; my $conf_tmp = "udev-test.rules"; +# uncomment following line to run udev with valgrind. +# Should make this a runtime option to the script someday... +#my $udev_bin = "valgrind --tool=memcheck --leak-check=yes ../udev"; my @tests = ( { @@ -1259,7 +1262,6 @@ sub run_test { udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); - if ((-e "$PWD/$udev_root$config->{exp_name}") || (-l "$PWD/$udev_root$config->{exp_name}")) { -- cgit v1.2.3-54-g00ecf From 8a0dc204e902a47a5b251c6d4a29eddb8f4a634a Mon Sep 17 00:00:00 2001 From: "sschweizer@gmail.com" Date: Thu, 2 Dec 2004 22:23:21 -0800 Subject: [PATCH] Allow GROUP to have modifiers in it --- etc/udev/udev.rules.gentoo | 2 +- extras/ide-devfs.sh | 6 +++--- namedev.c | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 1809232ed0..997acb8a34 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -19,7 +19,7 @@ BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYM # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" # dri devices KERNEL="card*", NAME="dri/card%n" diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 4f20259480..580a751abe 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -36,11 +36,11 @@ get_dev_number() { if [ -z "$3" ] && [ -f /proc/ide/${1}/media ]; then MEDIA=`cat /proc/ide/${1}/media` if [ "${MEDIA}" = "cdrom" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` ${MEDIA} elif [ "${MEDIA}" = "floppy" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc ${MEDIA} elif [ "${MEDIA}" = "disk" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc ${MEDIA} fi else echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/part$3 discs/disc`get_dev_number $1 disk`/part$3 diff --git a/namedev.c b/namedev.c index 69669709df..dca405ceba 100644 --- a/namedev.c +++ b/namedev.c @@ -809,6 +809,11 @@ found: udev->partitions = dev->partitions; udev->ignore_remove = dev->ignore_remove; + if (dev->group[0] != '\0') { + strfieldcpy(udev->group, dev->group); + apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); + } + /* get permissions given in rule */ set_empty_perms(udev, dev->mode, dev->owner, -- cgit v1.2.3-54-g00ecf From 9af5bb2f8fdbf54c064ddbd319d61092f28a4132 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 25 Nov 2004 02:44:38 +0100 Subject: [PATCH] rename udev_lib to udev_utils and dev_d to udev_multiplex --- Makefile | 10 +- dev_d.c | 114 --------------------- klibc_fixups/klibc_fixups.c | 2 +- namedev.c | 2 +- namedev_parse.c | 2 +- udev.c | 8 +- udev.h | 2 +- udev_add.c | 2 +- udev_config.c | 2 +- udev_db.c | 2 +- udev_lib.c | 244 -------------------------------------------- udev_lib.h | 91 ----------------- udev_multiplex.c | 114 +++++++++++++++++++++ udev_remove.c | 2 +- udev_start.c | 4 +- udev_sysfs.c | 2 +- udev_utils.c | 244 ++++++++++++++++++++++++++++++++++++++++++++ udev_utils.h | 91 +++++++++++++++++ udevd.c | 2 +- udevinfo.c | 2 +- udevsend.c | 1 - udevtest.c | 2 +- 22 files changed, 472 insertions(+), 473 deletions(-) delete mode 100644 dev_d.c delete mode 100644 udev_lib.c delete mode 100644 udev_lib.h create mode 100644 udev_multiplex.c create mode 100644 udev_utils.c create mode 100644 udev_utils.h diff --git a/Makefile b/Makefile index c89fa0feee..4d48b3c9e0 100644 --- a/Makefile +++ b/Makefile @@ -204,20 +204,20 @@ SYSFS = $(PWD)/libsysfs/sysfs_bus.o \ $(PWD)/libsysfs/sysfs_utils.o \ $(PWD)/libsysfs/dlist.o -OBJS = udev_lib.o \ +OBJS = udev_utils.o \ udev_config.o \ udev_add.o \ udev_remove.o \ udev_start.o \ udev_sysfs.o \ udev_db.o \ + udev_multiplex.o\ namedev.o \ namedev_parse.o \ - dev_d.o \ $(SYSFS) HEADERS = udev.h \ - udev_lib.h \ + udev_utils.h \ namedev.h \ udev_version.h \ udev_db.h \ @@ -291,11 +291,11 @@ $(TESTER): $(LIBC) $(TESTER).o $(OBJS) $(HEADERS) $(QUIET) $(STRIPCMD) $@ $(INFO): $(LIBC) $(INFO).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_lib.o udev_config.o udev_db.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_utils.o udev_config.o udev_db.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(DAEMON): $(LIBC) $(DAEMON).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o udev_lib.o $(KLIBC_FIXUP) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o udev_utils.o $(KLIBC_FIXUP) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h diff --git a/dev_d.c b/dev_d.c deleted file mode 100644 index 817355af60..0000000000 --- a/dev_d.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * dev_d.c - dev.d/ multiplexer - * - * Copyright (C) 2004 Greg Kroah-Hartman - * - * 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 essentially emulates the following shell script logic in C: - * DIR="/etc/dev.d" - * export DEVNAME="whatever_dev_name_udev_just_gave" - * for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do - * if [ -f $I ]; then $I $1 ; fi - * done - * exit 1; - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_lib.h" -#include "logging.h" - -static int run_program(const char *filename, void *data) -{ - pid_t pid; - int fd; - struct udevice *udev = data; - - dbg("running %s", filename); - - pid = fork(); - switch (pid) { - case 0: - /* child */ - fd = open("/dev/null", O_RDWR); - if ( fd >= 0) { - dup2(fd, STDOUT_FILENO); - dup2(fd, STDIN_FILENO); - dup2(fd, STDERR_FILENO); - } - close(fd); - - execl(filename, filename, udev->subsystem, NULL); - dbg("exec of child failed"); - _exit(1); - case -1: - dbg("fork of child failed"); - break; - return -1; - default: - waitpid(pid, NULL, 0); - } - - return 0; -} - -/* - * runs files in these directories in order: - * / - * subsystem/ - * default/ - */ -void dev_d_execute(struct udevice *udev, const char *basedir, const char *suffix) -{ - char dirname[PATH_MAX]; - char devname[NAME_SIZE]; - char *temp; - - /* skip if UDEV_NO_DEVD is set */ - if (udev_dev_d == 0) - return; - - strfieldcpy(devname, udev->name); - - /* chop the device name up into pieces based on '/' */ - temp = strchr(devname, '/'); - while (temp != NULL) { - temp[0] = '\0'; - snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname); - dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); - - temp[0] = '/'; - ++temp; - temp = strchr(temp, '/'); - } - - if (udev->name[0] != '\0') { - snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->name); - dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); - } - - if (udev->subsystem[0] != '\0') { - snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->subsystem); - dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); - } - - snprintf(dirname, PATH_MAX, "%s/default", basedir); - dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); -} diff --git a/klibc_fixups/klibc_fixups.c b/klibc_fixups/klibc_fixups.c index 2d673d8ca9..175cf27fe4 100644 --- a/klibc_fixups/klibc_fixups.c +++ b/klibc_fixups/klibc_fixups.c @@ -30,7 +30,7 @@ #include "pwd.h" #include "../udev.h" -#include "../udev_lib.h" +#include "../udev_utils.h" #include "../logging.h" #define PW_FILE "/etc/passwd" diff --git a/namedev.c b/namedev.c index dca405ceba..126453cc89 100644 --- a/namedev.c +++ b/namedev.c @@ -36,7 +36,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "list.h" #include "udev.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" diff --git a/namedev_parse.c b/namedev_parse.c index cb1760fd57..d39141bfc7 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -36,7 +36,7 @@ #include #include "udev.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "logging.h" #include "namedev.h" diff --git a/udev.c b/udev.c index e71cddd3ee..9b0a00fb78 100644 --- a/udev.c +++ b/udev.c @@ -33,7 +33,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "udev_sysfs.h" #include "udev_version.h" #include "namedev.h" @@ -182,7 +182,7 @@ int main(int argc, char *argv[], char *envp[]) /* run dev.d/ scripts if we created a node or changed a netif name */ if (udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); - dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } sysfs_close_class_device(class_dev); @@ -200,7 +200,7 @@ int main(int argc, char *argv[], char *envp[]) /* run dev.d/ scripts if we're not instructed to ignore the event */ if (udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); - dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } } @@ -229,7 +229,7 @@ int main(int argc, char *argv[], char *envp[]) hotplug: if (manage_hotplug_event()) - dev_d_execute(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX); + udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX); exit: logging_close(); diff --git a/udev.h b/udev.h index e834f1e5b9..1e3db5af27 100644 --- a/udev.h +++ b/udev.h @@ -78,7 +78,7 @@ extern int udev_remove_device(struct udevice *udev); extern void udev_init_config(void); extern int udev_start(void); extern int parse_get_pair(char **orig_string, char **left, char **right); -extern void dev_d_execute(struct udevice *udev, const char *basedir, const char *suffix); +extern void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix); extern char sysfs_path[SYSFS_PATH_MAX]; extern char udev_root[PATH_MAX]; diff --git a/udev_add.c b/udev_add.c index 4fb5ef18c0..f537f567cc 100644 --- a/udev_add.c +++ b/udev_add.c @@ -38,7 +38,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" diff --git a/udev_config.c b/udev_config.c index 198473936f..51bdc720a7 100644 --- a/udev_config.c +++ b/udev_config.c @@ -34,7 +34,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" diff --git a/udev_db.c b/udev_db.c index e07e72b858..36da264716 100644 --- a/udev_db.c +++ b/udev_db.c @@ -33,7 +33,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "logging.h" #include "udev_db.h" diff --git a/udev_lib.c b/udev_lib.c deleted file mode 100644 index 86a526f7e8..0000000000 --- a/udev_lib.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - * udev_lib - generic stuff used by udev - * - * Copyright (C) 2004 Kay Sievers - * - * 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 02139, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "logging.h" -#include "udev_lib.h" -#include "list.h" - - -void udev_set_values(struct udevice *udev, const char* devpath, - const char *subsystem, const char* action) -{ - memset(udev, 0x00, sizeof(struct udevice)); - - if (devpath) - strfieldcpy(udev->devpath, devpath); - if (subsystem) - strfieldcpy(udev->subsystem, subsystem); - if (action) - strfieldcpy(udev->action, action); - - if (strcmp(udev->subsystem, "block") == 0) - udev->type = 'b'; - else if (strcmp(udev->subsystem, "net") == 0) - udev->type = 'n'; - else if (strncmp(udev->devpath, "/block/", 7) == 0) - udev->type = 'b'; - else if (strncmp(udev->devpath, "/class/net/", 11) == 0) - udev->type = 'n'; - else if (strncmp(udev->devpath, "/class/", 7) == 0) - udev->type = 'c'; -} - -int kernel_release_satisfactory(int version, int patchlevel, int sublevel) -{ - static int kversion = 0; - static int kpatchlevel; - static int ksublevel; - - if (kversion == 0) { - struct utsname uts; - if (uname(&uts) != 0) - return -1; - - if (sscanf (uts.release, "%u.%u.%u", &kversion, &kpatchlevel, &ksublevel) != 3) { - kversion = 0; - return -1; - } - } - - if (kversion >= version && kpatchlevel >= patchlevel && ksublevel >= sublevel) - return 1; - else - return 0; -} - -int create_path(const char *path) -{ - char p[NAME_SIZE]; - char *pos; - struct stat stats; - - strcpy (p, path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (pos[-1] == '/') - pos--; - - pos[0] = '\0'; - - dbg("stat '%s'\n", p); - if (stat (p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - - if (create_path (p) != 0) - return -1; - - dbg("mkdir '%s'\n", p); - return mkdir(p, 0755); -} - -int file_map(const char *filename, char **buf, size_t *bufsize) -{ - struct stat stats; - int fd; - - fd = open(filename, O_RDONLY); - if (fd < 0) { - return -1; - } - - if (fstat(fd, &stats) < 0) { - close(fd); - return -1; - } - - *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (*buf == MAP_FAILED) { - close(fd); - return -1; - } - *bufsize = stats.st_size; - - close(fd); - - return 0; -} - -void file_unmap(char *buf, size_t bufsize) -{ - munmap(buf, bufsize); -} - -size_t buf_get_line(char *buf, size_t buflen, size_t cur) -{ - size_t count = 0; - - for (count = cur; count < buflen && buf[count] != '\n'; count++); - - return count - cur; -} - -void no_trailing_slash(char *path) -{ - int len; - - len = strlen(path); - if (len > 0 && path[len-1] == '/') - path[len-1] = '\0'; -} - -struct files { - struct list_head list; - char name[NAME_SIZE]; -}; - -/* sort files in lexical order */ -static int file_list_insert(char *filename, struct list_head *file_list) -{ - struct files *loop_file; - struct files *new_file; - - list_for_each_entry(loop_file, file_list, list) { - if (strcmp(loop_file->name, filename) > 0) { - break; - } - } - - new_file = malloc(sizeof(struct files)); - if (new_file == NULL) { - dbg("error malloc"); - return -ENOMEM; - } - - strfieldcpy(new_file->name, filename); - list_add_tail(&new_file->list, &loop_file->list); - return 0; -} - -/* calls function for every file found in specified directory */ -int call_foreach_file(file_fnct_t fnct, const char *dirname, - const char *suffix, void *data) -{ - struct dirent *ent; - DIR *dir; - char *ext; - struct files *loop_file; - struct files *tmp_file; - LIST_HEAD(file_list); - - dbg("open directory '%s'", dirname); - dir = opendir(dirname); - if (dir == NULL) { - dbg("unable to open '%s'", dirname); - return -1; - } - - while (1) { - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - - if ((ent->d_name[0] == '.') || (ent->d_name[0] == COMMENT_CHARACTER)) - continue; - - /* look for file with specified suffix */ - ext = strrchr(ent->d_name, '.'); - if (ext == NULL) - continue; - - if (strcmp(ext, suffix) != 0) - continue; - - dbg("put file '%s/%s' in list", dirname, ent->d_name); - file_list_insert(ent->d_name, &file_list); - } - - /* call function for every file in the list */ - list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { - char filename[NAME_SIZE]; - - snprintf(filename, NAME_SIZE, "%s/%s", dirname, loop_file->name); - filename[NAME_SIZE-1] = '\0'; - - fnct(filename, data); - - list_del(&loop_file->list); - free(loop_file); - } - - closedir(dir); - return 0; -} diff --git a/udev_lib.h b/udev_lib.h deleted file mode 100644 index b9b0fda678..0000000000 --- a/udev_lib.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * udev_lib - generic stuff used by udev - * - * Copyright (C) 2004 Kay Sievers - * - * - * 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 02139, USA. - * - */ - -#ifndef _UDEV_LIB_H_ -#define _UDEV_LIB_H_ - -#include "udev.h" - -#define strfieldcpy(to, from) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - strncpy(to, from, sizeof(to)-1); \ -} while (0) - -#define strfieldcat(to, from) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - strncat(to, from, sizeof(to) - strlen(to)-1); \ -} while (0) - -#define strfieldcpymax(to, from, maxsize) \ -do { \ - to[maxsize-1] = '\0'; \ - strncpy(to, from, maxsize-1); \ -} while (0) - -#define strfieldcatmax(to, from, maxsize) \ -do { \ - to[maxsize-1] = '\0'; \ - strncat(to, from, maxsize - strlen(to)-1); \ -} while (0) - -#define strintcat(to, i) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%u", i); \ -} while (0) - -#define strintcatmax(to, i, maxsize) \ -do { \ - to[maxsize-1] = '\0'; \ - snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ -} while (0) - -#define foreach_strpart(str, separator, pos, len) \ - for(pos = str, len = 0; \ - (pos) < ((str) + strlen(str)); \ - pos = pos + len + strspn(pos, separator), len = strcspn(pos, separator)) \ - if (len > 0) - -#ifdef asmlinkage -# undef asmlinkage -#endif -#ifdef __i386__ -# define asmlinkage __attribute__((regparm(0))) -#endif -#ifndef asmlinkage -# define asmlinkage /* nothing */ -#endif - -extern void udev_set_values(struct udevice *udev, const char* devpath, - const char *subsystem, const char* action); -extern int kernel_release_satisfactory(int version, int patchlevel, int sublevel); -extern int create_path(const char *path); -extern int file_map(const char *filename, char **buf, size_t *bufsize); -extern void file_unmap(char *buf, size_t bufsize); -extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); -extern void no_trailing_slash(char *path); -typedef int (*file_fnct_t)(const char *filename, void *data); -extern int call_foreach_file(file_fnct_t fnct, const char *dirname, - const char *suffix, void *data); - -#endif diff --git a/udev_multiplex.c b/udev_multiplex.c new file mode 100644 index 0000000000..7e3dc656d6 --- /dev/null +++ b/udev_multiplex.c @@ -0,0 +1,114 @@ +/* + * udev_multiplex.c directory multiplexer + * + * Copyright (C) 2004 Greg Kroah-Hartman + * + * 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 essentially emulates the following shell script logic in C: + * DIR="/etc/dev.d" + * export DEVNAME="whatever_dev_name_udev_just_gave" + * for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do + * if [ -f $I ]; then $I $1 ; fi + * done + * exit 1; + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_utils.h" +#include "logging.h" + +static int run_program(const char *filename, void *data) +{ + pid_t pid; + int fd; + struct udevice *udev = data; + + dbg("running %s", filename); + + pid = fork(); + switch (pid) { + case 0: + /* child */ + fd = open("/dev/null", O_RDWR); + if ( fd >= 0) { + dup2(fd, STDOUT_FILENO); + dup2(fd, STDIN_FILENO); + dup2(fd, STDERR_FILENO); + } + close(fd); + + execl(filename, filename, udev->subsystem, NULL); + dbg("exec of child failed"); + _exit(1); + case -1: + dbg("fork of child failed"); + break; + return -1; + default: + waitpid(pid, NULL, 0); + } + + return 0; +} + +/* + * runs files in these directories in order: + * / + * subsystem/ + * default/ + */ +void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix) +{ + char dirname[PATH_MAX]; + char devname[NAME_SIZE]; + char *temp; + + /* skip if UDEV_NO_DEVD is set */ + if (udev_dev_d == 0) + return; + + strfieldcpy(devname, udev->name); + + /* chop the device name up into pieces based on '/' */ + temp = strchr(devname, '/'); + while (temp != NULL) { + temp[0] = '\0'; + snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); + + temp[0] = '/'; + ++temp; + temp = strchr(temp, '/'); + } + + if (udev->name[0] != '\0') { + snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->name); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); + } + + if (udev->subsystem[0] != '\0') { + snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->subsystem); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); + } + + snprintf(dirname, PATH_MAX, "%s/default", basedir); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); +} diff --git a/udev_remove.c b/udev_remove.c index 8887125dd8..142503589a 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -31,7 +31,7 @@ #include #include "udev.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "udev_version.h" #include "namedev.h" #include "udev_db.h" diff --git a/udev_start.c b/udev_start.c index 3e3062c019..129af4291a 100644 --- a/udev_start.c +++ b/udev_start.c @@ -35,7 +35,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "logging.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "list.h" #include "udev.h" @@ -111,7 +111,7 @@ static int add_device(char *devpath, char *subsystem) /* run dev.d/ scripts if we created a node or changed a netif name */ if (udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); - dev_d_execute(&udev, DEVD_DIR, DEVD_SUFFIX); + udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } sysfs_close_class_device(class_dev); diff --git a/udev_sysfs.c b/udev_sysfs.c index 4976b8f308..6655968433 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -31,7 +31,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev_version.h" #include "udev_sysfs.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "logging.h" /* list of subsystem specific files, NULL if there is no file to wait for */ diff --git a/udev_utils.c b/udev_utils.c new file mode 100644 index 0000000000..bdf0233e3a --- /dev/null +++ b/udev_utils.c @@ -0,0 +1,244 @@ +/* + * udev_lib - generic stuff used by udev + * + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "logging.h" +#include "udev_utils.h" +#include "list.h" + + +void udev_set_values(struct udevice *udev, const char* devpath, + const char *subsystem, const char* action) +{ + memset(udev, 0x00, sizeof(struct udevice)); + + if (devpath) + strfieldcpy(udev->devpath, devpath); + if (subsystem) + strfieldcpy(udev->subsystem, subsystem); + if (action) + strfieldcpy(udev->action, action); + + if (strcmp(udev->subsystem, "block") == 0) + udev->type = 'b'; + else if (strcmp(udev->subsystem, "net") == 0) + udev->type = 'n'; + else if (strncmp(udev->devpath, "/block/", 7) == 0) + udev->type = 'b'; + else if (strncmp(udev->devpath, "/class/net/", 11) == 0) + udev->type = 'n'; + else if (strncmp(udev->devpath, "/class/", 7) == 0) + udev->type = 'c'; +} + +int kernel_release_satisfactory(int version, int patchlevel, int sublevel) +{ + static int kversion = 0; + static int kpatchlevel; + static int ksublevel; + + if (kversion == 0) { + struct utsname uts; + if (uname(&uts) != 0) + return -1; + + if (sscanf (uts.release, "%u.%u.%u", &kversion, &kpatchlevel, &ksublevel) != 3) { + kversion = 0; + return -1; + } + } + + if (kversion >= version && kpatchlevel >= patchlevel && ksublevel >= sublevel) + return 1; + else + return 0; +} + +int create_path(const char *path) +{ + char p[NAME_SIZE]; + char *pos; + struct stat stats; + + strcpy (p, path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (pos[-1] == '/') + pos--; + + pos[0] = '\0'; + + dbg("stat '%s'\n", p); + if (stat (p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + + if (create_path (p) != 0) + return -1; + + dbg("mkdir '%s'\n", p); + return mkdir(p, 0755); +} + +int file_map(const char *filename, char **buf, size_t *bufsize) +{ + struct stat stats; + int fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) { + return -1; + } + + if (fstat(fd, &stats) < 0) { + close(fd); + return -1; + } + + *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); + if (*buf == MAP_FAILED) { + close(fd); + return -1; + } + *bufsize = stats.st_size; + + close(fd); + + return 0; +} + +void file_unmap(char *buf, size_t bufsize) +{ + munmap(buf, bufsize); +} + +size_t buf_get_line(char *buf, size_t buflen, size_t cur) +{ + size_t count = 0; + + for (count = cur; count < buflen && buf[count] != '\n'; count++); + + return count - cur; +} + +void no_trailing_slash(char *path) +{ + int len; + + len = strlen(path); + if (len > 0 && path[len-1] == '/') + path[len-1] = '\0'; +} + +struct files { + struct list_head list; + char name[NAME_SIZE]; +}; + +/* sort files in lexical order */ +static int file_list_insert(char *filename, struct list_head *file_list) +{ + struct files *loop_file; + struct files *new_file; + + list_for_each_entry(loop_file, file_list, list) { + if (strcmp(loop_file->name, filename) > 0) { + break; + } + } + + new_file = malloc(sizeof(struct files)); + if (new_file == NULL) { + dbg("error malloc"); + return -ENOMEM; + } + + strfieldcpy(new_file->name, filename); + list_add_tail(&new_file->list, &loop_file->list); + return 0; +} + +/* calls function for every file found in specified directory */ +int call_foreach_file(file_fnct_t fnct, const char *dirname, + const char *suffix, void *data) +{ + struct dirent *ent; + DIR *dir; + char *ext; + struct files *loop_file; + struct files *tmp_file; + LIST_HEAD(file_list); + + dbg("open directory '%s'", dirname); + dir = opendir(dirname); + if (dir == NULL) { + dbg("unable to open '%s'", dirname); + return -1; + } + + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + + if ((ent->d_name[0] == '.') || (ent->d_name[0] == COMMENT_CHARACTER)) + continue; + + /* look for file with specified suffix */ + ext = strrchr(ent->d_name, '.'); + if (ext == NULL) + continue; + + if (strcmp(ext, suffix) != 0) + continue; + + dbg("put file '%s/%s' in list", dirname, ent->d_name); + file_list_insert(ent->d_name, &file_list); + } + + /* call function for every file in the list */ + list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { + char filename[NAME_SIZE]; + + snprintf(filename, NAME_SIZE, "%s/%s", dirname, loop_file->name); + filename[NAME_SIZE-1] = '\0'; + + fnct(filename, data); + + list_del(&loop_file->list); + free(loop_file); + } + + closedir(dir); + return 0; +} diff --git a/udev_utils.h b/udev_utils.h new file mode 100644 index 0000000000..b9b0fda678 --- /dev/null +++ b/udev_utils.h @@ -0,0 +1,91 @@ +/* + * udev_lib - generic stuff used by udev + * + * Copyright (C) 2004 Kay Sievers + * + * + * 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 02139, USA. + * + */ + +#ifndef _UDEV_LIB_H_ +#define _UDEV_LIB_H_ + +#include "udev.h" + +#define strfieldcpy(to, from) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + strncpy(to, from, sizeof(to)-1); \ +} while (0) + +#define strfieldcat(to, from) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + strncat(to, from, sizeof(to) - strlen(to)-1); \ +} while (0) + +#define strfieldcpymax(to, from, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + strncpy(to, from, maxsize-1); \ +} while (0) + +#define strfieldcatmax(to, from, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + strncat(to, from, maxsize - strlen(to)-1); \ +} while (0) + +#define strintcat(to, i) \ +do { \ + to[sizeof(to)-1] = '\0'; \ + snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%u", i); \ +} while (0) + +#define strintcatmax(to, i, maxsize) \ +do { \ + to[maxsize-1] = '\0'; \ + snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ +} while (0) + +#define foreach_strpart(str, separator, pos, len) \ + for(pos = str, len = 0; \ + (pos) < ((str) + strlen(str)); \ + pos = pos + len + strspn(pos, separator), len = strcspn(pos, separator)) \ + if (len > 0) + +#ifdef asmlinkage +# undef asmlinkage +#endif +#ifdef __i386__ +# define asmlinkage __attribute__((regparm(0))) +#endif +#ifndef asmlinkage +# define asmlinkage /* nothing */ +#endif + +extern void udev_set_values(struct udevice *udev, const char* devpath, + const char *subsystem, const char* action); +extern int kernel_release_satisfactory(int version, int patchlevel, int sublevel); +extern int create_path(const char *path); +extern int file_map(const char *filename, char **buf, size_t *bufsize); +extern void file_unmap(char *buf, size_t bufsize); +extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); +extern void no_trailing_slash(char *path); +typedef int (*file_fnct_t)(const char *filename, void *data); +extern int call_foreach_file(file_fnct_t fnct, const char *dirname, + const char *suffix, void *data); + +#endif diff --git a/udevd.c b/udevd.c index bd36d2c192..06b172bc25 100644 --- a/udevd.c +++ b/udevd.c @@ -38,8 +38,8 @@ #include "list.h" #include "udev.h" -#include "udev_lib.h" #include "udev_version.h" +#include "udev_utils.h" #include "udevd.h" #include "logging.h" diff --git a/udevinfo.c b/udevinfo.c index 9ba302cbdc..6e6b9aeb3e 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -30,7 +30,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "libsysfs/dlist.h" #include "udev.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "udev_version.h" #include "udev_db.h" #include "logging.h" diff --git a/udevsend.c b/udevsend.c index 7d865573c2..341ed4cc36 100644 --- a/udevsend.c +++ b/udevsend.c @@ -36,7 +36,6 @@ #include #include "udev.h" -#include "udev_lib.h" #include "udev_version.h" #include "udevd.h" #include "logging.h" diff --git a/udevtest.c b/udevtest.c index b9a5fea489..37ec767e13 100644 --- a/udevtest.c +++ b/udevtest.c @@ -29,7 +29,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" -#include "udev_lib.h" +#include "udev_utils.h" #include "udev_version.h" #include "namedev.h" #include "logging.h" -- cgit v1.2.3-54-g00ecf From 7c2aae11ff58b4e495a351d8025b5d4bbb0ce502 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 25 Nov 2004 08:38:06 +0100 Subject: [PATCH] link archive insted of objects This cuts the size of the binaries, as only objects that are actually used are linked into the binary: 45592 -> 43608 udev 4380 -> 4380 udevsend 10380 -> 4652 udevd 34732 -> 33100 udevinfo 45432 -> 37208 udevtest --- Makefile | 106 +++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 62 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index 4d48b3c9e0..55c51fd2a8 100644 --- a/Makefile +++ b/Makefile @@ -139,8 +139,7 @@ ifeq ($(strip $(USE_KLIBC)),true) LINUX_INCLUDE_DIR := $(KERNEL_DIR)/include include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG # arch specific objects - ARCH_LIB_OBJS = \ - $(KLIBC_DIR)/libc.a + ARCH_LIB_OBJS = $(KLIBC_DIR)/libc.a CRT0 = $(KLIBC_DIR)/crt0.o @@ -171,7 +170,7 @@ ifeq ($(strip $(USE_SELINUX)),true) LIB_OBJS += -lselinux endif -CFLAGS += -I$(PWD)/libsysfs/sysfs \ +CFLAGS += -I$(PWD)/libsysfs/sysfs \ -I$(PWD)/libsysfs # config files automatically generated @@ -196,43 +195,52 @@ $(CRT0): fi $(MAKE) -C klibc SUBDIRS=klibc -SYSFS = $(PWD)/libsysfs/sysfs_bus.o \ - $(PWD)/libsysfs/sysfs_class.o \ - $(PWD)/libsysfs/sysfs_device.o \ - $(PWD)/libsysfs/sysfs_dir.o \ - $(PWD)/libsysfs/sysfs_driver.o \ - $(PWD)/libsysfs/sysfs_utils.o \ - $(PWD)/libsysfs/dlist.o - -OBJS = udev_utils.o \ - udev_config.o \ - udev_add.o \ - udev_remove.o \ - udev_start.o \ - udev_sysfs.o \ - udev_db.o \ - udev_multiplex.o\ - namedev.o \ - namedev_parse.o \ - $(SYSFS) - -HEADERS = udev.h \ - udev_utils.h \ - namedev.h \ - udev_version.h \ - udev_db.h \ - udev_sysfs.h \ - logging.h \ - selinux.h \ - list.h +HEADERS = \ + udev.h \ + udev_utils.h \ + namedev.h \ + udev_version.h \ + udev_db.h \ + udev_sysfs.h \ + logging.h \ + selinux.h \ + list.h + +SYSFS_OBJS = \ + libsysfs/sysfs_bus.o \ + libsysfs/sysfs_class.o \ + libsysfs/sysfs_device.o \ + libsysfs/sysfs_dir.o \ + libsysfs/sysfs_driver.o \ + libsysfs/sysfs_utils.o \ + libsysfs/dlist.o + +UDEV_OBJS = \ + udev_utils.o \ + udev_config.o \ + udev_add.o \ + udev_remove.o \ + udev_start.o \ + udev_sysfs.o \ + udev_db.o \ + udev_multiplex.o \ + namedev.o \ + namedev_parse.o + +OBJS = \ + libsysfs/sysfs.a \ + udev.a ifeq ($(strip $(USE_KLIBC)),true) - HEADERS += klibc_fixups/klibc_fixups.h \ - klibc_fixups/mntent.h \ - klibc_fixups/pwd.h + HEADERS += \ + klibc_fixups/klibc_fixups.h \ + klibc_fixups/mntent.h \ + klibc_fixups/pwd.h - OBJS += klibc_fixups/klibc_fixups.o - KLIBC_FIXUP = klibc_fixups/klibc_fixups.o + KLIBC_FIXUP_OBJS = \ + klibc_fixups/klibc_fixups.o + + OBJS += klibc_fixups/klibc_fixups.a endif ifeq ($(strip $(V)),false) @@ -243,6 +251,18 @@ else HOST_PROGS= endif +udev.a: $(UDEV_OBJS) + $(QUIET) $(AR) cq $@ $(UDEV_OBJS) + $(QUIET) $(RANLIB) $@ + +libsysfs/sysfs.a: $(SYSFS_OBJS) + $(QUIET) $(AR) cq $@ $(SYSFS_OBJS) + $(QUIET) $(RANLIB) $@ + +klibc_fixups/klibc_fixups.a: $(KLIBC_FIXUP_OBJS) + $(QUIET) $(AR) cq $@ $(KLIBC_FIXUP_OBJS) + $(QUIET) $(RANLIB) $@ + # header files automatically generated GEN_HEADERS = udev_version.h @@ -283,27 +303,25 @@ $(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(ROOT): $(LIBC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udev.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(ROOT).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(TESTER): $(LIBC) $(TESTER).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevtest.o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(TESTER).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(INFO): $(LIBC) $(INFO).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevinfo.o udev_utils.o udev_config.o udev_db.o $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(INFO).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(DAEMON): $(LIBC) $(DAEMON).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevd.o udev_utils.o $(KLIBC_FIXUP) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(DAEMON).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ $(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) udevsend.o $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(SENDER).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ -#.c.o: -# $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) -c -o $@ $< .c.o: $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< -- cgit v1.2.3-54-g00ecf From 9aa0485c97d1b02a39550e3be31c37520a0d0620 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 25 Nov 2004 09:52:19 +0100 Subject: [PATCH] remove archive file if we changed something --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 55c51fd2a8..e966591b52 100644 --- a/Makefile +++ b/Makefile @@ -252,14 +252,17 @@ else endif udev.a: $(UDEV_OBJS) + rm -f $@ $(QUIET) $(AR) cq $@ $(UDEV_OBJS) $(QUIET) $(RANLIB) $@ libsysfs/sysfs.a: $(SYSFS_OBJS) + rm -f $@ $(QUIET) $(AR) cq $@ $(SYSFS_OBJS) $(QUIET) $(RANLIB) $@ klibc_fixups/klibc_fixups.a: $(KLIBC_FIXUP_OBJS) + rm -f $@ $(QUIET) $(AR) cq $@ $(KLIBC_FIXUP_OBJS) $(QUIET) $(RANLIB) $@ -- cgit v1.2.3-54-g00ecf From 7757db1f859616171693ed9a54d1d16d3d5ed8e9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 25 Nov 2004 09:55:54 +0100 Subject: [PATCH] don't call dev.d/ scripts twice, if directory = subsystem The /etc/dev.d/input/input.dev was called twice for /dev/input/mouse. Skip the execution if we get a directory named after the subsystem. Move UDEV_NO_DEVD where it belongs. --- udev.c | 4 ++-- udev_multiplex.c | 38 ++++++++++++++++++++------------------ udev_start.c | 2 +- 3 files changed, 23 insertions(+), 21 deletions(-) diff --git a/udev.c b/udev.c index 9b0a00fb78..5ad7e425e6 100644 --- a/udev.c +++ b/udev.c @@ -180,7 +180,7 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_add_device(&udev, class_dev); /* run dev.d/ scripts if we created a node or changed a netif name */ - if (udev.devname[0] != '\0') { + if (udev_dev_d && udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } @@ -198,7 +198,7 @@ int main(int argc, char *argv[], char *envp[]) setenv("DEVNAME", udev.devname, 1); } /* run dev.d/ scripts if we're not instructed to ignore the event */ - if (udev.devname[0] != '\0') { + if (udev_dev_d && udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } diff --git a/udev_multiplex.c b/udev_multiplex.c index 7e3dc656d6..3a484068ff 100644 --- a/udev_multiplex.c +++ b/udev_multiplex.c @@ -74,26 +74,28 @@ static int run_program(const char *filename, void *data) void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix) { char dirname[PATH_MAX]; - char devname[NAME_SIZE]; - char *temp; - - /* skip if UDEV_NO_DEVD is set */ - if (udev_dev_d == 0) - return; - - strfieldcpy(devname, udev->name); /* chop the device name up into pieces based on '/' */ - temp = strchr(devname, '/'); - while (temp != NULL) { - temp[0] = '\0'; - snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname); - dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); - - temp[0] = '/'; - ++temp; - temp = strchr(temp, '/'); + if (udev->name[0] != '\0') { + char devname[NAME_SIZE]; + char *temp; + + strfieldcpy(devname, udev->name); + temp = strchr(devname, '/'); + while (temp != NULL) { + temp[0] = '\0'; + + /* don't call the subsystem directory here */ + if (strcmp(devname, udev->subsystem) != 0) { + snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname); + dirname[PATH_MAX-1] = '\0'; + call_foreach_file(run_program, dirname, suffix, udev); + } + + temp[0] = '/'; + ++temp; + temp = strchr(temp, '/'); + } } if (udev->name[0] != '\0') { diff --git a/udev_start.c b/udev_start.c index 129af4291a..1a86163cd5 100644 --- a/udev_start.c +++ b/udev_start.c @@ -109,7 +109,7 @@ static int add_device(char *devpath, char *subsystem) udev_add_device(&udev, class_dev); /* run dev.d/ scripts if we created a node or changed a netif name */ - if (udev.devname[0] != '\0') { + if (udev_dev_d && udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } -- cgit v1.2.3-54-g00ecf From b1e95455d2683f43f47ea94a7b79af64f0738d36 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 26 Apr 2005 22:52:57 -0700 Subject: fixups to get back to proper patch order Damm, it's hard to merge a multi-line tree into one flat line at times... --- test/udev-test.pl | 4 +--- udev.c | 5 ----- udevinfo.c | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index c2d8e27a52..d584579584 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -35,9 +35,6 @@ my $perm = "udev.permissions"; my $main_conf = "udev-test.conf"; my $conf_tmp = "udev-test.rules"; -# uncomment following line to run udev with valgrind. -# Should make this a runtime option to the script someday... -#my $udev_bin = "valgrind --tool=memcheck --leak-check=yes ../udev"; my @tests = ( { @@ -1262,6 +1259,7 @@ sub run_test { udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); + if ((-e "$PWD/$udev_root$config->{exp_name}") || (-l "$PWD/$udev_root$config->{exp_name}")) { diff --git a/udev.c b/udev.c index 5ad7e425e6..35fa533a4e 100644 --- a/udev.c +++ b/udev.c @@ -108,7 +108,6 @@ int main(int argc, char *argv[], char *envp[]) udev_init_config(); /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); act.sa_handler = (void (*) (int))sig_handler; sigemptyset (&act.sa_mask); act.sa_flags = 0; @@ -193,10 +192,6 @@ int main(int argc, char *argv[], char *envp[]) /* get node from db, remove db-entry, delete created node */ retval = udev_remove_device(&udev); - /* Set the DEVNAME if known */ - if (udev.devname[0] != '\0') { - setenv("DEVNAME", udev.devname, 1); - } /* run dev.d/ scripts if we're not instructed to ignore the event */ if (udev_dev_d && udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); diff --git a/udevinfo.c b/udevinfo.c index 6e6b9aeb3e..fe847b875f 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -401,7 +401,7 @@ print: break; case PATH: - strfieldcpy(result, udev.devpath); + strfieldcpy(result, path); break; case ALL: -- cgit v1.2.3-54-g00ecf From 97adaace4f8f89ce175657d3ec71811715cc4dae Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 26 Apr 2005 22:54:32 -0700 Subject: more fixups --- etc/udev/udev.rules.gentoo | 2 +- extras/ide-devfs.sh | 6 +++--- namedev.c | 5 ----- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 997acb8a34..1809232ed0 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -19,7 +19,7 @@ BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYM # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" # dri devices KERNEL="card*", NAME="dri/card%n" diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 580a751abe..4f20259480 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -36,11 +36,11 @@ get_dev_number() { if [ -z "$3" ] && [ -f /proc/ide/${1}/media ]; then MEDIA=`cat /proc/ide/${1}/media` if [ "${MEDIA}" = "cdrom" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` ${MEDIA} + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` elif [ "${MEDIA}" = "floppy" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc ${MEDIA} + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc elif [ "${MEDIA}" = "disk" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc ${MEDIA} + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc fi else echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/part$3 discs/disc`get_dev_number $1 disk`/part$3 diff --git a/namedev.c b/namedev.c index 126453cc89..8976b8d40a 100644 --- a/namedev.c +++ b/namedev.c @@ -809,11 +809,6 @@ found: udev->partitions = dev->partitions; udev->ignore_remove = dev->ignore_remove; - if (dev->group[0] != '\0') { - strfieldcpy(udev->group, dev->group); - apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); - } - /* get permissions given in rule */ set_empty_perms(udev, dev->mode, dev->owner, -- cgit v1.2.3-54-g00ecf From 16ac31aaee34f1085daf1c43a8645b174712b2d4 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 25 Nov 2004 10:15:32 +0100 Subject: [PATCH] don't call the hotplug scripts with a test run --- test/udev-test.pl | 1 + udev.c | 2 +- udev.h | 1 + udev_config.c | 8 +++++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index d584579584..593e34e885 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1153,6 +1153,7 @@ $ENV{UDEV_TEST} = "yes"; $ENV{SYSFS_PATH} = $sysfs; $ENV{UDEV_CONFIG_FILE} = $main_conf; $ENV{UDEV_NO_DEVD} = "yes"; +$ENV{UDEV_NO_HOTPLUGD} = "yes"; sub udev { diff --git a/udev.c b/udev.c index 35fa533a4e..3a97eb1046 100644 --- a/udev.c +++ b/udev.c @@ -223,7 +223,7 @@ int main(int argc, char *argv[], char *envp[]) } hotplug: - if (manage_hotplug_event()) + if (udev_hotplug_d && manage_hotplug_event()) udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX); exit: diff --git a/udev.h b/udev.h index 1e3db5af27..ace843f0ad 100644 --- a/udev.h +++ b/udev.h @@ -91,5 +91,6 @@ extern char default_owner_str[OWNER_SIZE]; extern char default_group_str[GROUP_SIZE]; extern int udev_log; extern int udev_dev_d; +extern int udev_hotplug_d; #endif diff --git a/udev_config.c b/udev_config.c index 51bdc720a7..9549471b8b 100644 --- a/udev_config.c +++ b/udev_config.c @@ -51,6 +51,7 @@ char default_owner_str[OWNER_SIZE]; char default_group_str[GROUP_SIZE]; int udev_log; int udev_dev_d; +int udev_hotplug_d; static int string_is_true(char *str) @@ -68,7 +69,7 @@ static void init_variables(void) { char *env; - /* fill up the defaults. + /* fill up the defaults. * If any config values are specified, they will * override these values. */ strfieldcpy(udev_root, UDEV_ROOT); @@ -82,6 +83,11 @@ static void init_variables(void) env = getenv("UDEV_NO_DEVD"); if (env && string_is_true(env)) udev_dev_d = 0; + + udev_hotplug_d = 1; + env = getenv("UDEV_NO_HOTPLUGD"); + if (env && string_is_true(env)) + udev_hotplug_d = 0; } int parse_get_pair(char **orig_string, char **left, char **right) -- cgit v1.2.3-54-g00ecf From a0294b76252d8c84656218cafd458e6739361247 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 28 Nov 2004 13:41:15 +0100 Subject: [PATCH] update the man pages and correct Usage: hints Add UDEV_LOG to the man udev man page. Remove mention of specific variables from the udevd/udevsend man page as we changed to pass the whole environment. Correct printed Usage: of udevtest and udevinfo. Init the config in udevtest earlier to accept input with and without the sysfs mount point. --- udev.8.in | 20 ++++++++++++-------- udevd.8 | 29 ++++++++++------------------- udevinfo.c | 2 +- udevtest.8 | 3 ++- udevtest.c | 19 ++++++++++--------- 5 files changed, 35 insertions(+), 38 deletions(-) diff --git a/udev.8.in b/udev.8.in index 728ddb1a45..7bdf560970 100644 --- a/udev.8.in +++ b/udev.8.in @@ -4,22 +4,24 @@ udev \- Linux configurable dynamic device naming support .SH SYNOPSIS .BI udev " hotplug-subsystem" .P -The environment must provide the following variables: +The following variables are read from the environment: .TP .B ACTION .IR add " or " remove -signifies the connection or disconnection of a device. -.TP +signifies the addition or the removal of a device. +.P .B DEVPATH The sysfs devpath of the device without the mountpoint but a leading slash. .P -Additional optional environment variables: -.TP +.B SUBSYSTEM +The subsystem the device belongs to. Alternatively the subsystem may +be passed as the first argument. +.P .B UDEV_CONFIG_FILE Overrides the default location of the .B udev config file. -.TP +.P .B UDEV_NO_DEVD The default behavior of .B udev @@ -34,7 +36,6 @@ provides a dynamic device directory containing only the files for actually present devices. It creates or removes device node files usually located in the /dev directory, or it renames network interfaces. .br - .P As part of the .B hotplug @@ -373,9 +374,12 @@ The name of a program must end with suffix, to be recognized. .br In addition to the hotplug environment variables, +.B UDEV_LOG +is set if udev is configured to use the syslog facility. Executed programs may +want to follow that setting. .B DEVNAME is exported to make the name of the created node, or the name the network -device is renamed to, available to the executed program. The programs in every +device is renamed to, available to the executed program. The programs in every directory are sorted in lexical order, while the directories are searched in the following order: .sp diff --git a/udevd.8 b/udevd.8 index 1de7a3cba2..1a5940fef5 100644 --- a/udevd.8 +++ b/udevd.8 @@ -3,19 +3,6 @@ udevd, udevdsend \- udev event serializer daemon and udev event sender .SH SYNOPSIS .BI udevsend " hotplug-subsystem" -.sp -The environment must provide the following variables: -.TP -.B ACTION -.IR add " or " remove -signifies the connection or disconnection of a device. -.TP -.B DEVPATH -The sysfs devpath of the device without the mountpoint but a leading slash. -.TP -.B SEQNUM -The sequence number of the event provided by the kernel. -If unset, the event bypasses the queue and will be executed immediately. .SH "DESCRIPTION" .B udevd allows the serialization of @@ -24,15 +11,19 @@ events. The events generated by the kernel may arrive in random order in userspace, that makes it neccessary to reorder them. .br .B udevd -takes care of the kernel supplied sequence number and arranges the events for -execution in the correct order. Missing sequences delay the execution of the -following events until a timeout is reached. +takes care of the kernel supplied +.B SEQNUM +sequence number and arranges the events for execution in the correct order. +Missing sequences delay the execution of the following events until a timeout +is reached. Events without any sequence number are bypassing the queue and +will be executed immediately. .br For each event a .BR udev (8) -instance is executed in the background. All further events for the same device -are delayed until the execution is finished. This way there will never be more -than one instance running for a single device at the same time. +instance is executed in the background with the complete environment received +by the hotplug event. All further events for the same device are delayed until +the execution is finished. This way there will never be more than one instance +running for a single device at the same time. .br .B udevd receives the events from diff --git a/udevinfo.c b/udevinfo.c index fe847b875f..340496b42b 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -439,7 +439,7 @@ exit: } help: - printf("Usage: [-anpqrdVh]\n" + printf("Usage: udevinfo [-anpqrdVh]\n" " -q TYPE query database for the specified value:\n" " 'name' name of device node\n" " 'symlink' pointing to node\n" diff --git a/udevtest.8 b/udevtest.8 index 6be7e089cf..13b57f03b6 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -2,7 +2,8 @@ .SH NAME udevtest \- simulates a udev run to test the configured rules .SH SYNOPSIS -.BI udevtest " sysfs_device_path" +.B udevtest +.IR "sysfs_device_path " [ subsystem ] .SH "DESCRIPTION" .B udevtest simulates a diff --git a/udevtest.c b/udevtest.c index 37ec767e13..9cc23f0ac7 100644 --- a/udevtest.c +++ b/udevtest.c @@ -55,19 +55,23 @@ int main(int argc, char *argv[], char *envp[]) char *devpath; char path[SYSFS_PATH_MAX]; char temp[NAME_SIZE]; - char *subsystem = ""; struct udevice udev; + char *subsystem = NULL; info("version %s", UDEV_VERSION); - if (argv[1] == NULL) { - info("udevinfo expects the DEVPATH of the sysfs device as a argument"); + if (argc < 2 || argc > 3) { + info("Usage: udevtest [subsystem]"); return 1; } + /* initialize our configuration */ + udev_init_config(); + /* remove sysfs_path if given */ - if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) - devpath = argv[1] + strlen(sysfs_path); + if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) { + devpath = &argv[1][strlen(sysfs_path)] ; + } else if (argv[1][0] != '/') { /* prepend '/' if missing */ @@ -86,13 +90,10 @@ int main(int argc, char *argv[], char *envp[]) return 2; } - /* initialize our configuration */ - udev_init_config(); - /* initialize the naming deamon */ namedev_init(); - if (argv[2] != NULL) + if (argc == 3) subsystem = argv[2]; /* fill in values and test_run flag*/ -- cgit v1.2.3-54-g00ecf From 9a50eb497fa9d54e0dbb249f5a58d3c16bb937d0 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 28 Nov 2004 13:47:36 +0100 Subject: [PATCH] use blacklist on device "remove" and remove dev.d/ call code duplication --- udev.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/udev.c b/udev.c index 3a97eb1046..958fa4eb0a 100644 --- a/udev.c +++ b/udev.c @@ -156,11 +156,11 @@ int main(int argc, char *argv[], char *envp[]) /* wait for sysfs and possibly add node */ dbg("udev add"); - /* skip blacklisted subsystems */ + /* skip subsystems without "dev", but handle net devices */ if (udev.type != 'n' && subsystem_expect_no_dev(udev.subsystem)) { dbg("don't care about '%s' devices", udev.subsystem); goto hotplug; - }; + } snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); class_dev = wait_class_device_open(path); @@ -178,26 +178,25 @@ int main(int argc, char *argv[], char *envp[]) /* name, create node, store in db */ retval = udev_add_device(&udev, class_dev); - /* run dev.d/ scripts if we created a node or changed a netif name */ - if (udev_dev_d && udev.devname[0] != '\0') { - setenv("DEVNAME", udev.devname, 1); - udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); - } - sysfs_close_class_device(class_dev); } else if (strcmp(action, "remove") == 0) { /* possibly remove a node */ dbg("udev remove"); + /* skip subsystems without "dev" */ + if (subsystem_expect_no_dev(udev.subsystem)) { + dbg("don't care about '%s' devices", udev.subsystem); + goto hotplug; + } + /* get node from db, remove db-entry, delete created node */ retval = udev_remove_device(&udev); + } - /* run dev.d/ scripts if we're not instructed to ignore the event */ - if (udev_dev_d && udev.devname[0] != '\0') { - setenv("DEVNAME", udev.devname, 1); - udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); - } - + /* run dev.d/ scripts if we created/deleted a node or changed a netif name */ + if (udev_dev_d && udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } } else if ((strncmp(devpath, "/devices/", 9) == 0)) { if (strcmp(action, "add") == 0) { -- cgit v1.2.3-54-g00ecf From 4497fcbf7159975560b680fd8130adcd414d3d67 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 28 Nov 2004 13:56:22 +0100 Subject: [PATCH] udevsend/udevd handle events without a subsystem Accept event without a subsystem and pass it through udevd. Pass empty environment while starting udevd. --- udevd.c | 3 ++- udevsend.c | 44 ++++++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/udevd.c b/udevd.c index 06b172bc25..58f5be94bc 100644 --- a/udevd.c +++ b/udevd.c @@ -124,6 +124,7 @@ static void msg_queue_insert(struct hotplug_msg *msg) /* forks event and removes event from run queue when finished */ static void udev_run(struct hotplug_msg *msg) { + char *const argv[] = { "udev", msg->subsystem, NULL }; pid_t pid; pid = fork(); @@ -132,7 +133,7 @@ static void udev_run(struct hotplug_msg *msg) /* child */ close(udevsendsock); logging_close(); - execle(udev_bin, "udev", msg->subsystem, NULL, msg->envp); + execve(udev_bin, argv, msg->envp); dbg("exec of child failed"); _exit(1); break; diff --git a/udevsend.c b/udevsend.c index 341ed4cc36..16174f5e46 100644 --- a/udevsend.c +++ b/udevsend.c @@ -59,6 +59,8 @@ static int start_daemon(void) { pid_t pid; pid_t child_pid; + char *const argv[] = { "udevd", NULL }; + char *const envp[] = { NULL }; pid = fork(); switch (pid) { @@ -67,9 +69,9 @@ static int start_daemon(void) child_pid = fork(); switch (child_pid) { case 0: - /* daemon */ + /* daemon with empty environment */ close(sock); - execl(UDEVD_BIN, "udevd", NULL); + execve(UDEVD_BIN, argv, envp); dbg("exec of daemon failed"); _exit(1); case -1: @@ -90,13 +92,14 @@ static int start_daemon(void) static void run_udev(const char *subsystem) { + char *const argv[] = { "udev", (char *)subsystem, NULL }; pid_t pid; pid = fork(); switch (pid) { case 0: /* child */ - execl(UDEV_BIN, "udev", subsystem, NULL); + execv(UDEV_BIN, argv); dbg("exec of child failed"); _exit(1); break; @@ -116,27 +119,14 @@ int main(int argc, char *argv[], char *envp[]) int loop; struct sockaddr_un saddr; socklen_t addrlen; - const char *subsystem_argv; - int subsystem_env = 0; int bufpos = 0; int retval = 1; int started_daemon = 0; + const char *subsystem = NULL; logging_init("udevsend"); dbg("version %s", UDEV_VERSION); - subsystem_argv = argv[1]; - if (subsystem_argv == NULL) { - dbg("no subsystem"); - goto exit; - } - - /* prevent loops in the scripts we execute */ - if (getenv("MANAGED_EVENT") != NULL) { - dbg("seems that the event source is not the kernel, just exit"); - goto exit; - } - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { dbg("error getting socket"); @@ -150,7 +140,6 @@ int main(int argc, char *argv[], char *envp[]) addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; memset(&usend_msg, 0x00, sizeof(struct udevsend_msg)); - strcpy(usend_msg.magic, UDEV_MAGIC); /* copy all keys to send buffer */ @@ -165,17 +154,24 @@ int main(int argc, char *argv[], char *envp[]) continue; } - /* older kernels do not have the SUBSYSTEM in the environment */ + /* prevent loops in the scripts we execute */ + if (strncmp(key, "MANAGED_EVENT=", 14) == 0) { + dbg("seems that the event source is not the kernel, just exit"); + goto exit; + } + + /* remember the SUBSYSTEM */ if (strncmp(key, "SUBSYSTEM=", 10) == 0) - subsystem_env = 1; + subsystem = &key[10]; dbg("add '%s' to env[%i] buffer", key, i); strcpy(&usend_msg.envbuf[bufpos], key); bufpos += keylen + 1; } - if (!subsystem_env) { - bufpos += sprintf(&usend_msg.envbuf[bufpos], "SUBSYSTEM=%s", subsystem_argv) + 1; - dbg("add 'SUBSYSTEM=%s' to env[%i] buffer from argv", subsystem_argv, i); + /* older kernels passed the SUBSYSTEM only as the first argument */ + if (!subsystem && argc == 2) { + bufpos += sprintf(&usend_msg.envbuf[bufpos], "SUBSYSTEM=%s", argv[1]) + 1; + dbg("add 'SUBSYSTEM=%s' to env[%i] buffer from argv", argv[1], i); } usend_msg_len = offsetof(struct udevsend_msg, envbuf) + bufpos; @@ -212,7 +208,7 @@ int main(int argc, char *argv[], char *envp[]) fallback: info("unable to connect to event daemon, try to call udev directly"); - run_udev(subsystem_argv); + run_udev(subsystem); exit: if (sock != -1) -- cgit v1.2.3-54-g00ecf From 45a7b668eca398831c0cfc39e4237494b3d603e9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 28 Nov 2004 14:01:43 +0100 Subject: [PATCH] remove unused variables Remove udev.bus, cause it's currently unused and newer kernels will pass it in the hotplug environment as PHYSDEVBUS. Remove udev.action, cause it's unused. Rename udev_set_values() to udev_init_device(). --- namedev.c | 2 -- udev.c | 2 +- udev.h | 2 -- udev_start.c | 2 +- udev_utils.c | 5 +---- udev_utils.h | 3 +-- udevtest.c | 2 +- 7 files changed, 5 insertions(+), 13 deletions(-) diff --git a/namedev.c b/namedev.c index 8976b8d40a..c043cf339e 100644 --- a/namedev.c +++ b/namedev.c @@ -708,7 +708,6 @@ try_parent: return -ENODEV; dbg("sysfs_device->path='%s'", sysfs_device->path); dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); - dbg("sysfs_device->bus='%s'", sysfs_device->bus); } } @@ -742,7 +741,6 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg("found devices device: path='%s', bus_id='%s', bus='%s'", sysfs_device->path, sysfs_device->bus_id, sysfs_device->bus); strfieldcpy(udev->bus_id, sysfs_device->bus_id); - strfieldcpy(udev->bus, sysfs_device->bus); } strfieldcpy(udev->kernel_name, class_dev->name); diff --git a/udev.c b/udev.c index 958fa4eb0a..847cc5dade 100644 --- a/udev.c +++ b/udev.c @@ -119,7 +119,7 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timeout to interrupt blocking syscalls */ alarm(ALARM_TIMEOUT); - udev_set_values(&udev, devpath, subsystem, action); + udev_init_device(&udev, devpath, subsystem); if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) { dbg("udevstart"); diff --git a/udev.h b/udev.h index ace843f0ad..2c5270a4c3 100644 --- a/udev.h +++ b/udev.h @@ -50,7 +50,6 @@ struct udevice { char devpath[DEVPATH_SIZE]; char subsystem[SUBSYSTEM_SIZE]; - char action[ACTION_SIZE]; char name[NAME_SIZE]; char owner[OWNER_SIZE]; char group[GROUP_SIZE]; @@ -65,7 +64,6 @@ struct udevice { char config_file[NAME_SIZE]; long config_uptime; char bus_id[SYSFS_NAME_LEN]; - char bus[SYSFS_NAME_LEN]; char program_result[NAME_SIZE]; char kernel_number[NAME_SIZE]; char kernel_name[NAME_SIZE]; diff --git a/udev_start.c b/udev_start.c index 1a86163cd5..8c7a06b5af 100644 --- a/udev_start.c +++ b/udev_start.c @@ -105,7 +105,7 @@ static int add_device(char *devpath, char *subsystem) return -ENODEV; } - udev_set_values(&udev, devpath, subsystem, "add"); + udev_init_device(&udev, devpath, subsystem); udev_add_device(&udev, class_dev); /* run dev.d/ scripts if we created a node or changed a netif name */ diff --git a/udev_utils.c b/udev_utils.c index bdf0233e3a..aa5c75f74d 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -36,8 +36,7 @@ #include "list.h" -void udev_set_values(struct udevice *udev, const char* devpath, - const char *subsystem, const char* action) +void udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem) { memset(udev, 0x00, sizeof(struct udevice)); @@ -45,8 +44,6 @@ void udev_set_values(struct udevice *udev, const char* devpath, strfieldcpy(udev->devpath, devpath); if (subsystem) strfieldcpy(udev->subsystem, subsystem); - if (action) - strfieldcpy(udev->action, action); if (strcmp(udev->subsystem, "block") == 0) udev->type = 'b'; diff --git a/udev_utils.h b/udev_utils.h index b9b0fda678..e36255f526 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -76,8 +76,7 @@ do { \ # define asmlinkage /* nothing */ #endif -extern void udev_set_values(struct udevice *udev, const char* devpath, - const char *subsystem, const char* action); +extern void udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); extern int kernel_release_satisfactory(int version, int patchlevel, int sublevel); extern int create_path(const char *path); extern int file_map(const char *filename, char **buf, size_t *bufsize); diff --git a/udevtest.c b/udevtest.c index 9cc23f0ac7..38e2bb7562 100644 --- a/udevtest.c +++ b/udevtest.c @@ -97,7 +97,7 @@ int main(int argc, char *argv[], char *envp[]) subsystem = argv[2]; /* fill in values and test_run flag*/ - udev_set_values(&udev, devpath, subsystem, "add"); + udev_init_device(&udev, devpath, subsystem); /* open the device */ snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); -- cgit v1.2.3-54-g00ecf From 2af003feb21e79b68b048c212bb898b293b75421 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 29 Nov 2004 02:15:55 +0100 Subject: [PATCH] trivial cleanups and change some comments --- udev.c | 11 ++++++++--- udev.h | 8 +++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/udev.c b/udev.c index 847cc5dade..ca79bb4ec0 100644 --- a/udev.c +++ b/udev.c @@ -111,17 +111,22 @@ int main(int argc, char *argv[], char *envp[]) act.sa_handler = (void (*) (int))sig_handler; sigemptyset (&act.sa_mask); act.sa_flags = 0; - /* alarm must not restart syscalls*/ sigaction(SIGALRM, &act, NULL); sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); - /* trigger timeout to interrupt blocking syscalls */ + /* trigger timeout to prevent hanging processes */ alarm(ALARM_TIMEOUT); + action = getenv("ACTION"); + devpath = getenv("DEVPATH"); + subsystem = getenv("SUBSYSTEM"); + /* older kernels passed the SUBSYSTEM only as argument */ + if (!subsystem && argc == 2) + subsystem = argv[1]; udev_init_device(&udev, devpath, subsystem); - if (strstr(argv[0], "udevstart") || (argv[1] != NULL && strstr(argv[1], "udevstart"))) { + if (strstr(argv[0], "udevstart") || (argc == 2 && strstr(argv[1], "udevstart"))) { dbg("udevstart"); /* disable all logging, as it's much too slow on some facilities */ diff --git a/udev.h b/udev.h index 2c5270a4c3..0703b884cf 100644 --- a/udev.h +++ b/udev.h @@ -50,14 +50,17 @@ struct udevice { char devpath[DEVPATH_SIZE]; char subsystem[SUBSYSTEM_SIZE]; + char name[NAME_SIZE]; + char symlink[NAME_SIZE]; char owner[OWNER_SIZE]; char group[GROUP_SIZE]; + mode_t mode; char type; int major; int minor; - mode_t mode; - char symlink[NAME_SIZE]; + + char devname[NAME_SIZE]; int partitions; int ignore_remove; int config_line; @@ -67,7 +70,6 @@ struct udevice { char program_result[NAME_SIZE]; char kernel_number[NAME_SIZE]; char kernel_name[NAME_SIZE]; - char devname[NAME_SIZE]; int test_run; }; -- cgit v1.2.3-54-g00ecf From 927bda379205dfccd2fae8f5c54523230e0771a9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 29 Nov 2004 04:47:59 +0100 Subject: [PATCH] handle /etc/hotplug.d/ only if the event comes from udevd --- udev.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udev.c b/udev.c index ca79bb4ec0..507f2be943 100644 --- a/udev.c +++ b/udev.c @@ -61,6 +61,10 @@ static int manage_hotplug_event(void) { int fd; int len; + /* false, if we are called directly */ + if (!getenv("MANAGED_EVENT")) + goto exit; + fd = open("/proc/sys/kernel/hotplug", O_RDONLY); if (fd < 0) goto exit; -- cgit v1.2.3-54-g00ecf From 5f72c470ad244020f65784c33eb6bcd4ae149403 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 29 Nov 2004 13:44:01 +0100 Subject: [PATCH] simplify permission handling Initialize the defaults in udev_config.c instead of namedev.c. Replace macro by expanded code. Switch to mode_t instead of string value. Add and clarify some comments. --- namedev.c | 108 +++++++++++++++++++++++++------------------------------- namedev.h | 18 +++------- namedev_parse.c | 14 ++++++-- udev.h | 14 ++++---- udev_config.c | 39 ++++++++++---------- 5 files changed, 91 insertions(+), 102 deletions(-) diff --git a/namedev.c b/namedev.c index c043cf339e..0bc28bd028 100644 --- a/namedev.c +++ b/namedev.c @@ -101,7 +101,7 @@ static int strcmp_pattern(const char *p, const char *s) return 1; } -static struct perm_device *find_perm(char *name) +static struct perm_device *find_perm_entry(const char *name) { struct perm_device *perm; @@ -113,32 +113,6 @@ static struct perm_device *find_perm(char *name) return NULL; } -static mode_t get_default_mode(void) -{ - mode_t mode = 0600; /* default to owner rw only */ - - if (strlen(default_mode_str) != 0) - mode = strtol(default_mode_str, NULL, 8); - - return mode; -} - -static char *get_default_owner(void) -{ - if (strlen(default_owner_str) == 0) - strfieldcpy(default_owner_str, "root"); - - return default_owner_str; -} - -static char *get_default_group(void) -{ - if (strlen(default_group_str) == 0) - strfieldcpy(default_group_str, "root"); - - return default_group_str; -} - /* extract possible {attr} and move str behind it */ static char *get_format_attribute(char **str) { @@ -586,7 +560,8 @@ static int match_place(struct config_device *dev, struct sysfs_class_device *cla return 0; } -static int match_rule(struct config_device *dev, struct sysfs_class_device *class_dev, struct udevice *udev, struct sysfs_device *sysfs_device) +static int match_rule(struct udevice *udev, struct config_device *dev, + struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { while (1) { /* check for matching bus value */ @@ -595,7 +570,8 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas dbg("device has no bus"); goto try_parent; } - dbg("check for " FIELD_BUS " dev->bus='%s' sysfs_device->bus='%s'", dev->bus, sysfs_device->bus); + dbg("check for " FIELD_BUS " dev->bus='%s' sysfs_device->bus='%s'", + dev->bus, sysfs_device->bus); if (strcmp_pattern(dev->bus, sysfs_device->bus) != 0) { dbg(FIELD_BUS " is not matching"); goto try_parent; @@ -606,7 +582,8 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas /* check for matching kernel name */ if (dev->kernel[0] != '\0') { - dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", dev->kernel, class_dev->name); + dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", + dev->kernel, class_dev->name); if (strcmp_pattern(dev->kernel, class_dev->name) != 0) { dbg(FIELD_KERNEL " is not matching"); goto try_parent; @@ -617,7 +594,8 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas /* check for matching subsystem */ if (dev->subsystem[0] != '\0') { - dbg("check for " FIELD_SUBSYSTEM " dev->subsystem='%s' class_dev->name='%s'", dev->subsystem, class_dev->name); + dbg("check for " FIELD_SUBSYSTEM " dev->subsystem='%s' class_dev->name='%s'", + dev->subsystem, class_dev->name); if (strcmp_pattern(dev->subsystem, udev->subsystem) != 0) { dbg(FIELD_SUBSYSTEM " is not matching"); goto try_parent; @@ -628,7 +606,8 @@ static int match_rule(struct config_device *dev, struct sysfs_class_device *clas /* check for matching driver */ if (dev->driver[0] != '\0') { - dbg("check for " FIELD_DRIVER " dev->driver='%s' sysfs_device->driver_name='%s'", dev->driver, sysfs_device->driver_name); + dbg("check for " FIELD_DRIVER " dev->driver='%s' sysfs_device->driver_name='%s'", + dev->driver, sysfs_device->driver_name); if (strcmp_pattern(dev->driver, sysfs_device->driver_name) != 0) { dbg(FIELD_DRIVER " is not matching"); goto try_parent; @@ -757,13 +736,15 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d /* look for a matching rule to apply */ list_for_each_entry(dev, &config_device_list, node) { dbg("process rule"); - if (match_rule(dev, class_dev, udev, sysfs_device) == 0) { + if (match_rule(udev, dev, class_dev, sysfs_device) == 0) { + /* empty name and symlink will not create any node */ if (dev->name[0] == '\0' && dev->symlink[0] == '\0') { info("configured rule in '%s' at line %i applied, '%s' is ignored", dev->config_file, dev->config_line, udev->kernel_name); return -1; } + /* collect symlinks for the final matching rule */ if (dev->symlink[0] != '\0') { char temp[NAME_SIZE]; @@ -776,6 +757,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d strfieldcat(udev->symlink, temp); } + /* rule matches */ if (dev->name[0] != '\0') { /* apply all_partitions flag only at a main block device */ if (dev->partitions > 0 && @@ -784,45 +766,51 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", dev->config_file, dev->config_line, udev->kernel_name, dev->name); + strfieldcpy(udev->name, dev->name); - goto found; + apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); + strfieldcpy(udev->config_file, dev->config_file); + udev->config_line = dev->config_line; + udev->ignore_remove = dev->ignore_remove; + + if (udev->type == 'n') + goto done; + + udev->partitions = dev->partitions; + udev->mode = dev->mode; + strfieldcpy(udev->owner, dev->owner); + strfieldcpy(udev->group, dev->group); + + goto perms; } } } - /* no rule was found so we use the kernel name */ - strfieldcpy(udev->name, udev->kernel_name); - if (udev->type == 'n') - goto done; - else - goto perms; -found: - apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); - strfieldcpy(udev->config_file, dev->config_file); - udev->config_line = dev->config_line; + /* no rule matched, so we use the kernel name */ + strfieldcpy(udev->name, udev->kernel_name); if (udev->type == 'n') goto done; - udev->partitions = dev->partitions; - udev->ignore_remove = dev->ignore_remove; - - /* get permissions given in rule */ - set_empty_perms(udev, dev->mode, - dev->owner, - dev->group); - perms: - /* get permissions given in config file or set defaults */ - perm = find_perm(udev->name); + /* apply permissions from permissions file to empty fields */ + perm = find_perm_entry(udev->name); if (perm != NULL) { - set_empty_perms(udev, perm->mode, - perm->owner, - perm->group); + if (udev->mode == 0000) + udev->mode = perm->mode; + if (udev->owner[0] == '\0') + strfieldcpy(udev->owner, perm->owner); + if (udev->group[0] == '\0') + strfieldcpy(udev->group, perm->group); } - set_empty_perms(udev, get_default_mode(), - get_default_owner(), - get_default_group()); + + /* apply permissions from config to empty fields */ + if (udev->mode == 0000) + udev->mode = default_mode; + if (udev->owner[0] == '\0') + strfieldcpy(udev->owner, default_owner); + if (udev->group[0] == '\0') + strfieldcpy(udev->group, default_group); dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", udev->name, udev->owner, udev->group, udev->mode); diff --git a/namedev.h b/namedev.h index 8e552c8568..e29279243b 100644 --- a/namedev.h +++ b/namedev.h @@ -60,14 +60,6 @@ struct sysfs_class_device; #define RULEFILE_SUFFIX ".rules" #define PERMFILE_SUFFIX ".permissions" -#define set_empty_perms(dev, m, o, g) \ - if (dev->mode == 0) \ - dev->mode = m; \ - if (dev->owner[0] == '\0') \ - strfieldcpy(dev->owner, o); \ - if (dev->group[0] == '\0') \ - strfieldcpy(dev->group, g); - struct sysfs_pair { char file[FILE_SIZE]; char value[VALUE_SIZE]; @@ -87,9 +79,9 @@ struct config_device { char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; - char owner[OWNER_SIZE]; - char group[GROUP_SIZE]; - unsigned int mode; + char owner[USER_SIZE]; + char group[USER_SIZE]; + mode_t mode; int partitions; int ignore_remove; char config_file[NAME_SIZE]; @@ -100,8 +92,8 @@ struct perm_device { struct list_head node; char name[NAME_SIZE]; - char owner[OWNER_SIZE]; - char group[GROUP_SIZE]; + char owner[USER_SIZE]; + char group[USER_SIZE]; unsigned int mode; }; diff --git a/namedev_parse.c b/namedev_parse.c index d39141bfc7..5b8c5ab2d6 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -79,12 +79,19 @@ static int add_perm_dev(struct perm_device *new_dev) struct perm_device *dev; struct perm_device *tmp_dev; - /* update the values if we already have the device */ + /* if we already have that entry, just update the values */ list_for_each_entry(dev, &perm_device_list, node) { if (strcmp(new_dev->name, dev->name) != 0) continue; - set_empty_perms(dev, new_dev->mode, new_dev->owner, new_dev->group); + /* don't overwrite values from earlier entries */ + if (dev->mode == 0000) + dev->mode = new_dev->mode; + if (dev->owner[0] == '\0') + strfieldcpy(dev->owner, new_dev->owner); + if (dev->owner[0] == '\0') + strfieldcpy(dev->group, new_dev->group); + return 0; } @@ -95,7 +102,8 @@ static int add_perm_dev(struct perm_device *new_dev) memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); list_add_tail(&tmp_dev->node, &perm_device_list); - //dump_perm_dev(tmp_dev); + /* dump_perm_dev(tmp_dev); */ + return 0; } diff --git a/udev.h b/udev.h index 0703b884cf..cff991e57a 100644 --- a/udev.h +++ b/udev.h @@ -30,9 +30,7 @@ #define COMMENT_CHARACTER '#' #define NAME_SIZE 256 -#define OWNER_SIZE 32 -#define GROUP_SIZE 32 -#define MODE_SIZE 8 +#define USER_SIZE 32 #define ACTION_SIZE 32 #define DEVPATH_SIZE 256 @@ -53,8 +51,8 @@ struct udevice { char name[NAME_SIZE]; char symlink[NAME_SIZE]; - char owner[OWNER_SIZE]; - char group[GROUP_SIZE]; + char owner[USER_SIZE]; + char group[USER_SIZE]; mode_t mode; char type; int major; @@ -86,9 +84,9 @@ extern char udev_db_path[PATH_MAX+NAME_MAX]; extern char udev_permissions_filename[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; -extern char default_mode_str[MODE_SIZE]; -extern char default_owner_str[OWNER_SIZE]; -extern char default_group_str[GROUP_SIZE]; +extern mode_t default_mode; +extern char default_owner[USER_SIZE]; +extern char default_group[USER_SIZE]; extern int udev_log; extern int udev_dev_d; extern int udev_hotplug_d; diff --git a/udev_config.c b/udev_config.c index 9549471b8b..62eb728ea3 100644 --- a/udev_config.c +++ b/udev_config.c @@ -46,15 +46,15 @@ char udev_db_path[PATH_MAX+NAME_MAX]; char udev_permissions_filename[PATH_MAX+NAME_MAX]; char udev_rules_filename[PATH_MAX+NAME_MAX]; char udev_config_filename[PATH_MAX+NAME_MAX]; -char default_mode_str[MODE_SIZE]; -char default_owner_str[OWNER_SIZE]; -char default_group_str[GROUP_SIZE]; +mode_t default_mode; +char default_owner[USER_SIZE]; +char default_group[USER_SIZE]; int udev_log; int udev_dev_d; int udev_hotplug_d; -static int string_is_true(char *str) +static int string_is_true(const char *str) { if (strcasecmp(str, "true") == 0) return 1; @@ -67,16 +67,19 @@ static int string_is_true(char *str) static void init_variables(void) { - char *env; - - /* fill up the defaults. - * If any config values are specified, they will - * override these values. */ - strfieldcpy(udev_root, UDEV_ROOT); - strfieldcpy(udev_db_path, UDEV_DB); - strfieldcpy(udev_config_filename, UDEV_CONFIG_FILE); - strfieldcpy(udev_rules_filename, UDEV_RULES_FILE); - strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE); + const char *env; + + /* If any config values are specified, they will override these values. */ + strcpy(udev_root, UDEV_ROOT); + strcpy(udev_db_path, UDEV_DB); + strcpy(udev_config_filename, UDEV_CONFIG_FILE); + strcpy(udev_rules_filename, UDEV_RULES_FILE); + strcpy(udev_permissions_filename, UDEV_PERMISSION_FILE); + + strcpy(default_owner, "root"); + strcpy(default_group, "root"); + default_mode = 0600; + udev_log = string_is_true(UDEV_LOG_DEFAULT); udev_dev_d = 1; @@ -210,17 +213,17 @@ static int parse_config_file(void) } if (strcasecmp(variable, "default_mode") == 0) { - strfieldcpy(default_mode_str, value); + default_mode = strtol(value, NULL, 8); continue; } if (strcasecmp(variable, "default_owner") == 0) { - strfieldcpy(default_owner_str, value); + strfieldcpy(default_owner, value); continue; } if (strcasecmp(variable, "default_group") == 0) { - strfieldcpy(default_group_str, value); + strfieldcpy(default_group, value); continue; } @@ -274,7 +277,7 @@ static void get_dirs(void) dbg("udev_db_path = %s", udev_db_path); dbg("udev_rules_filename = %s", udev_rules_filename); dbg("udev_permissions_filename = %s", udev_permissions_filename); - dbg("udev_log_str = %d", udev_log); + dbg("udev_log = %d", udev_log); } void udev_init_config(void) -- cgit v1.2.3-54-g00ecf From 3fd7a9bfc068a5598a97de5e4b4fff167917f362 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 29 Nov 2004 13:51:20 +0100 Subject: [PATCH] remove unused timestamp field --- namedev.c | 12 +++--------- udev.h | 1 - 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/namedev.c b/namedev.c index 0bc28bd028..7045637e79 100644 --- a/namedev.c +++ b/namedev.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "libsysfs/sysfs/libsysfs.h" #include "list.h" @@ -697,7 +696,6 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d struct sysfs_device *sysfs_device = NULL; struct config_device *dev; struct perm_device *perm; - struct sysinfo info; char *pos; udev->mode = 0; @@ -774,7 +772,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d udev->ignore_remove = dev->ignore_remove; if (udev->type == 'n') - goto done; + goto exit; udev->partitions = dev->partitions; udev->mode = dev->mode; @@ -790,7 +788,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d strfieldcpy(udev->name, udev->kernel_name); if (udev->type == 'n') - goto done; + goto exit; perms: /* apply permissions from permissions file to empty fields */ @@ -815,11 +813,7 @@ perms: dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", udev->name, udev->owner, udev->group, udev->mode); -done: - /* store time of action */ - sysinfo(&info); - udev->config_uptime = info.uptime; - +exit: return 0; } diff --git a/udev.h b/udev.h index cff991e57a..7038376b3c 100644 --- a/udev.h +++ b/udev.h @@ -63,7 +63,6 @@ struct udevice { int ignore_remove; int config_line; char config_file[NAME_SIZE]; - long config_uptime; char bus_id[SYSFS_NAME_LEN]; char program_result[NAME_SIZE]; char kernel_number[NAME_SIZE]; -- cgit v1.2.3-54-g00ecf From d2fe701e9c312be019118d0cc7326d3466164159 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 30 Nov 2004 11:36:36 +0100 Subject: [PATCH] add "pcmcia" and "fc_transport" to the wait_for_sysfs lists --- udev_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 6655968433..ada413c484 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -51,6 +51,7 @@ static const struct subsystem_file { { .subsystem = "ieee1394", .file = NULL }, { .subsystem = "ieee1394_host", .file = NULL }, { .subsystem = "ieee1394_node", .file = NULL }, + { .subsystem = "fc_transport", .file = "port_id" }, { NULL, NULL } }; @@ -274,6 +275,7 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "ide", .file = "detach_state" }, { .bus = "pci", .file = "vendor" }, { .bus = "platform", .file = "detach_state" }, + { .bus = "pcmcia", .file = "detach_state" }, { .bus = "i2c", .file = "detach_state" }, { .bus = "ieee1394", .file = "node_count" }, { .bus = "ieee1394", .file = "nodeid" }, -- cgit v1.2.3-54-g00ecf From f2503c9792555e72f3a6ffedaf9dc6413fb12376 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 2 Dec 2004 19:30:23 +0100 Subject: [PATCH] add net/nlv* devices to the exception list --- udev_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index ada413c484..1c7cb16d93 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -171,6 +171,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "bnep" }, { .subsystem = "net", .device = "vmnet" }, { .subsystem = "net", .device = "ippp" }, + { .subsystem = "net", .device = "nlv" }, { .subsystem = "ppp", .device = NULL }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, -- cgit v1.2.3-54-g00ecf From e1b7e62a2676bf679f3eae8997caf0ea703e573d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 5 Dec 2004 15:03:43 +0100 Subject: [PATCH] add net/atml and class/ppdev to the wait_for_sysfs exception list --- udev_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 1c7cb16d93..5f7c63d31d 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -172,9 +172,11 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "net", .device = "vmnet" }, { .subsystem = "net", .device = "ippp" }, { .subsystem = "net", .device = "nlv" }, + { .subsystem = "net", .device = "atml" }, { .subsystem = "ppp", .device = NULL }, { .subsystem = "sound", .device = NULL }, { .subsystem = "printer", .device = "lp" }, + { .subsystem = "ppdev", .device = NULL }, { .subsystem = "nvidia", .device = NULL }, { .subsystem = "video4linux", .device = "vbi" }, { .subsystem = "dvb", .device = NULL }, -- cgit v1.2.3-54-g00ecf From 8e2bf855bddfb8df2b61ad78cb082b7bf2af317e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 5 Dec 2004 15:07:39 +0100 Subject: [PATCH] fix udev-test/udev-test.pl to work with again --- test/udevd-test/udevd-test.pl | 97 +++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 54 deletions(-) diff --git a/test/udevd-test/udevd-test.pl b/test/udevd-test/udevd-test.pl index 060c3ec5f2..e81aadd938 100644 --- a/test/udevd-test/udevd-test.pl +++ b/test/udevd-test/udevd-test.pl @@ -5,11 +5,10 @@ # Copyright (C) Intel Corp, 2004 # # Author: Yin Hu -# Kay Sievers # # Provides automated testing of the udevd binary.This test script is self-contained. # Before you run this script please modify $sysfs to locate your sysfs filesystem, -# modify $udevd_bin to locate your udevsend binary, +# modify $udevsend_bin to locate your udevsend binary, # modify $udev_bin to locate dummy udev script, # modify $udev_bin2 to locate another dummy udev script ( amplify the execution time for test), # modify $log_file to locate where udev script have placed the log file, @@ -38,42 +37,52 @@ use warnings; use strict; # modifiable settings -my $sysfs = "../sys"; -my $udevd_bin = "../../udevsend"; -my $udev_bin = "$ENV{PWD}/udev-log-script.pl"; -my $udev_bin2 = "$ENV{PWD}/udev-log-amplify.pl"; -my $log_file = "/tmp/udev_log.txt"; -my $time_out = 10; -my $udev_exe_time = 5; +my $sysfs = "../sys"; +my $udevd_bin = "../../udevd"; +my $udevsend_bin = "../../udevsend"; +my $udev_bin = "$ENV{'PWD'}/udev-log-script.pl"; +my $udev_bin2 = "$ENV{'PWD'}/udev-log-amplify.pl"; +my $log_file = "/tmp/udev_log.txt"; +my $time_out = 10; +my $udev_exe_time = 5; # global variables my $test_case = 0; # common functions -sub kill_daemon { +sub restart_daemon { + my ($udev_binary) = @_; + system("killall udevd"); system("rm -f $log_file"); sleep 1; + + if (!defined($udev_binary)) { + $udev_binary = $udev_bin; + } + + $ENV{'UDEV_BIN'} = $udev_binary; + system("/bin/sh -c $udevd_bin&"); + sleep(1); } sub udevsend { # This function prepares corresponding environment variables - # and then call $udevd_bin to send event. + # and then call $udevsend_bin to send event. + + my ($seqnum, $devpath, $action, $subsystem, $script) = @_; - my ($seqnum, $devpath, $action, $subsystem, $udev_bin_tmp) = @_; + %ENV = (); + $ENV{'DEVPATH'} = $devpath; + $ENV{'ACTION'} = $action; + $ENV{'SUBSYSTEM'} = $subsystem; - $ENV{DEVPATH} = $devpath; - $ENV{ACTION} = $action; - $udev_bin_tmp = $udev_bin if ( not $udev_bin_tmp ); - $ENV{UDEV_BIN} = $udev_bin_tmp; if ( $seqnum != -1) { $ENV{SEQNUM} = $seqnum; - } else { - delete $ENV{SEQNUM}; } - return system("$udevd_bin $subsystem"); + return system("$udevsend_bin $subsystem"); } sub getDate { @@ -153,7 +162,7 @@ sub check_count_and_time { print " forking udev time: $line_items[-1]"; $diff = cmpDate($line_items[-1], $event_recv_time); print " the delay time is: $diff s \n\n"; - if ( $diff > $time_out ) { + if ( $diff > $time_out+10 ) { print " the delay time is: $diff \n"; print " udevd doesn't act properly. \n"; exit 1; @@ -293,13 +302,12 @@ sub run_no_seq_test { print " the delay time between event receiving and forking udev for udevd should be negligible, \n"; print " that is, udev should be forked at once. please notice the following time...\n\n"; - # local variables my $time; # # add devices event test # - kill_daemon(); + restart_daemon(); # check if devices /block/sda exist check_sysfs_device_exist("$sysfs/block/sda"); @@ -307,7 +315,6 @@ sub run_no_seq_test { # log current system date/time $time = getDate(); - # fork udevd udevsend(-1, "/block/sda", "add", "block"); # check if execution is successful in time @@ -323,7 +330,6 @@ sub run_no_seq_test { # log current system date/time $time = getDate(); - # fork udevd udevsend(-1, "/block/sda", "remove", "block"); # check if execution is successful in time @@ -342,15 +348,13 @@ sub run_normal_seq_test { print " event to udev for each device. \n"; print " We can see the delay time for each device should be negligible. \n\n"; - # local variables my @file_list; my $file; my $seq = 0; my $time; my $ret_seq; - # prepare - kill_daemon(); + restart_daemon(); @file_list = glob "$sysfs/class/tty/*"; # log current system date/time for device add events @@ -373,7 +377,7 @@ sub run_normal_seq_test { # we'd better wait the udev to create all the device for a few seconds print " wait for udevd processing about $time_out s... \n\n"; - sleep $time_out; + sleep $time_out + 5; $ret_seq = check_count_and_time($time); if ( $ret_seq != $seq ) { @@ -390,7 +394,7 @@ sub run_normal_seq_test { # remove devices event test # print "remove device events test: \n"; - kill_daemon(); + restart_daemon(); @file_list = glob "$sysfs/class/tty/*"; $seq = 0; foreach $file (@file_list) { @@ -406,7 +410,7 @@ sub run_normal_seq_test { # we'd better wait the udev to create all the device for a few seconds print " waiting for udev removing devices (about $time_out s)...\n"; - sleep $time_out; + sleep $time_out + 5; # show results $ret_seq = check_count_and_time($time); @@ -427,7 +431,6 @@ sub run_random_seq_test { print " We have disordered the events sent to udevd, if udevd can order them correctly, the devices' \n"; print " add/remove sequence should be tty0, tty1, tty2. \n\n"; - # local variables my $time; # check if devices /class/tty/tty0, tty1, tty2 exist @@ -437,7 +440,7 @@ sub run_random_seq_test { # add device events test # print "add device events test: \n"; - kill_daemon(); + restart_daemon(); # log current system date/time for device remove events $time = getDate(); @@ -454,12 +457,11 @@ sub run_random_seq_test { # remove device events test # print "\nremove device events test: \n"; - kill_daemon(); + restart_daemon(); # log current system date/time for device remove events $time = getDate(); - # fork udevd udevsend(3, "/class/tty/tty2", "remove", "tty"); udevsend(2, "/class/tty/tty1", "remove", "tty"); udevsend(1, "/class/tty/tty0", "remove", "tty"); @@ -481,14 +483,12 @@ sub run_expected_seq_test { print " should fork udev immediately, the delay time should be negligible. \n"; print " where: event 7 is (add device /class/tty/tty2) \n\n"; - # local variables my $time; # check if devices /class/tty0, tty1, tty2 exist check_sysfs_device_exist("$sysfs/class/tty/tty0", "$sysfs/class/tty/tty1", "$sysfs/class/tty/tty2"); - # prepare - kill_daemon(); + restart_daemon(); # parameters: 1 sequence number, 2 device, 3 action, 4 subsystem udevsend(3, "/class/tty/tty2", "add", "tty"); @@ -499,7 +499,7 @@ sub run_expected_seq_test { udevsend(6, "/class/tty/tty2", "remove", "tty"); print " wait for udevd timing out for disorder events (about $time_out s) \n\n"; - sleep $time_out+1; + sleep $udev_exe_time + $time_out+1; system("rm -f $log_file"); # log current system date/time for device remove events @@ -527,11 +527,9 @@ sub run_single_instance_test { print " we send a add event for device /block/sda, and then we send a remove event, so the \n"; print " execution of remove event should be delayed until add is finished. \n\n"; - # local variables my $time; - # prepare - kill_daemon(); + restart_daemon($udev_bin2); # check if device exists check_sysfs_device_exist("$sysfs/block/sda"); @@ -539,9 +537,8 @@ sub run_single_instance_test { # log current system date/time $time = getDate(); - # fork udved - udevsend(-1, "/block/sda", "add", "block", $udev_bin2); - udevsend(-1, "/block/sda", "remove", "block", $udev_bin2); + udevsend(-1, "/block/sda", "add", "block"); + udevsend(-1, "/block/sda", "remove", "block"); # show results print " wait for udevd processing about $udev_exe_time s... \n\n"; @@ -560,16 +557,13 @@ sub run_same_events_test { print " event ( add device /class/tty/tty1 ) should be delayed for $time_out s than its previous \n"; print " event ( remove device /block/sda ) \n\n"; - # local variables my $time; - # prepare - kill_daemon(); + restart_daemon(); # check if device exist check_sysfs_device_exist("$sysfs/block/sda", "$sysfs/class/tty/tty1"); - # fork udevd udevsend(0, "/block/sda", "add", "block"); # log current system date/time @@ -577,7 +571,6 @@ sub run_same_events_test { $time = getDate(); system("rm -f $log_file"); - # fork udevd udevsend(1, "/block/sda", "remove", "block"); udevsend(1, "/class/tty/tty1", "add", "tty"); @@ -595,16 +588,13 @@ sub run_missing_seq_test { print "Test expected visible results:\n"; print " the delay time for event(add device /block/sda) should be about $time_out s.\n\n"; - # local variables my $time; - # prepare - kill_daemon(); + restart_daemon(); # check if device exist check_sysfs_device_exist("$sysfs/block/sda", "$sysfs/class/tty/tty1"); - # fork udevd udevsend(0, "/class/tty/tty1", "add", "tty"); udevsend(1, "/class/tty/tty1", "remove", "tty"); sleep 1; @@ -613,7 +603,6 @@ sub run_missing_seq_test { $time = getDate(); system("rm -f $log_file"); - # fork udevd udevsend(3, "/block/sda", "add", "block"); # show results -- cgit v1.2.3-54-g00ecf From e608ba5d457c8876da58e3877da21d014d4868e0 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 5 Dec 2004 16:31:51 +0100 Subject: [PATCH] make gcov compile scripts working with recent gcc --- make_gcov.sh | 10 +++++----- run_gcov.sh | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/make_gcov.sh b/make_gcov.sh index 907c1ebd48..4d5f63f1dd 100644 --- a/make_gcov.sh +++ b/make_gcov.sh @@ -16,16 +16,16 @@ # clean up udev dir clean_udev () { - find -name "*.da" -exec rm -f "{}" \; - find -name "*.bb" -exec rm -f "{}" \; - find -name "*.bbg" -exec rm -f "{}" \; + find -name "*.gcno" -exec rm -f "{}" \; + find -name "*.gcda" -exec rm -f "{}" \; find -name "*.gcov" -exec rm -f "{}" \; + rm -f udev_gcov.txt make clean } PWD=`pwd` GCCINCDIR=`gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"` -LIBSYSFS="-I$PWD/libsysfs" +LIBSYSFS="-I$PWD/libsysfs/sysfs -I$PWD/libsysfs" WARNINGS="-Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" GCC="-I$GCCINCDIR" USE_LOG="-DLOG" @@ -50,4 +50,4 @@ done clean_udev -make $* CFLAGS="$WARNINGS $GCOV_FLAGS $USE_LOG $DEBUG $GCC $LIBSYSFS" +make $* CFLAGS="$WARNINGS $GCOV_FLAGS $USE_LOG $DEBUG $GCC $LIBSYSFS" LDFLAGS="-Wl,-warn-common -fprofile-arcs" diff --git a/run_gcov.sh b/run_gcov.sh index 4fe936199f..ad6a62b130 100644 --- a/run_gcov.sh +++ b/run_gcov.sh @@ -23,12 +23,12 @@ echo > udev_gcov.txt echo "CODE COVERAGE ANALYSIS FOR UDEV" >> udev_gcov.txt echo >> udev_gcov.txt -for file in `find -maxdepth 1 -name "*.bb"`; do - name=`basename $file .bb` +for file in `find -maxdepth 1 -name "*.gcno"`; do + name=`basename $file .gcno` echo "################" >> udev_gcov.txt echo "$name.c" >> udev_gcov.txt echo "################" >> udev_gcov.txt - if [ -e "$name.da" ]; then + if [ -e "$name.gcda" ]; then gcov -l "$name.c" >> udev_gcov.txt 2>&1 else echo "code for $name.c was never executed" >> udev_gcov.txt 2>&1 -- cgit v1.2.3-54-g00ecf From 0ba5bb106b19d808c2e68af4ff34740854f78290 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 7 Dec 2004 22:38:40 +0100 Subject: [PATCH] restore OWNER/GROUP assignment in rule coming from RESULT --- namedev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 7045637e79..9cfc4283be 100644 --- a/namedev.c +++ b/namedev.c @@ -665,8 +665,7 @@ static int match_rule(struct udevice *udev, struct config_device *dev, /* check for matching result of external program */ if (dev->result[0] != '\0') { - dbg("check for " FIELD_RESULT - " dev->result='%s', udev->program_result='%s'", + dbg("check for " FIELD_RESULT " dev->result='%s', udev->program_result='%s'", dev->result, udev->program_result); if (strcmp_pattern(dev->result, udev->program_result) != 0) { dbg(FIELD_RESULT " is not matching"); @@ -777,7 +776,9 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d udev->partitions = dev->partitions; udev->mode = dev->mode; strfieldcpy(udev->owner, dev->owner); + apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); strfieldcpy(udev->group, dev->group); + apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); goto perms; } -- cgit v1.2.3-54-g00ecf From c64081980e7dc693327ad18995bc25e3eec61eea Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 7 Dec 2004 22:45:36 +0100 Subject: [PATCH] don't install distribution specific init script on "make install" Leave that part up to the one who itegrates udev into a system as there is much more to care of than to call a init stript for a dynamic dev. --- Makefile | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/Makefile b/Makefile index e966591b52..6494c1bf19 100644 --- a/Makefile +++ b/Makefile @@ -374,14 +374,6 @@ small_release: $(DISTFILES) spotless @rm -rf $(DISTDIR) @echo "Built $(RELEASE_NAME).tar.gz" - -install-initscript: etc/init.d/udev etc/init.d/udev.init.LSB - @if [ -f /etc/redhat-release ]; then \ - $(INSTALL_DATA) -D etc/init.d/udev $(DESTDIR)$(initdir)/udev; \ - elif [ -f /etc/SuSE-release ]; then \ - $(INSTALL_DATA) -D etc/init.d/udev.init.LSB $(DESTDIR)$(initdir)/udev; \ - fi - install-config: $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d $(INSTALL) -d $(DESTDIR)$(configdir)/permissions.d @@ -424,7 +416,7 @@ uninstall-man: - rm $(mandir)/man8/udevd.8 - rm $(mandir)/man8/udevsend.8 -install: install-initscript install-config install-man install-dev.d all +install: install-config install-man install-dev.d all $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) @@ -452,7 +444,6 @@ uninstall: uninstall-man uninstall-dev.d - rmdir $(configdir)/rules.d - rmdir $(configdir)/permissions.d - rmdir $(configdir) - - rm $(initdir)/udev - rm $(sbindir)/$(ROOT) - rm $(sbindir)/$(DAEMON) - rm $(sbindir)/$(SENDER) -- cgit v1.2.3-54-g00ecf From e4b5f339c7b63e9f67fccf2d0ef549ca34d56a7d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 7 Dec 2004 22:55:08 +0100 Subject: [PATCH] update Fedora dev.d/ example and remove unused conf.d/ directory --- etc/conf.d/udev | 11 -------- etc/dev.d/default/pam_console.dev | 56 +++++++++++++++++++++++++++++++-------- 2 files changed, 45 insertions(+), 22 deletions(-) delete mode 100644 etc/conf.d/udev diff --git a/etc/conf.d/udev b/etc/conf.d/udev deleted file mode 100644 index 50eda3a970..0000000000 --- a/etc/conf.d/udev +++ /dev/null @@ -1,11 +0,0 @@ -# if selinux file attributes -# should be restored (leave to yes, if unsure) -UDEV_SELINUX="yes" - -# if console permissions (pam_console) -# should be restored (leave to yes, if unsure) -UDEV_CONSOLE="yes" - -# if dbus messages should be sent -UDEV_DBUS="no" - diff --git a/etc/dev.d/default/pam_console.dev b/etc/dev.d/default/pam_console.dev index 563051d7f6..4c69ea3576 100644 --- a/etc/dev.d/default/pam_console.dev +++ b/etc/dev.d/default/pam_console.dev @@ -1,18 +1,52 @@ #!/bin/sh -if [ -f /etc/sysconfig/udev ]; then - . /etc/sysconfig/udev -fi +# Fedora solution to set the ownership/permissions of s device to the local +# logged in user. Uses the program pam_console_setowner to match the names of +# the device node and the symlinks against a device list and applies the +# configured ownership and permission to the node. -if [ -f /etc/conf.d/udev ]; then - . /etc/conf.d/udev -fi +[ "$ACTION" != "add" ] && exit 0 + +# we do not have console users in rc.sysinit +[ -n "$IN_INITLOG" ] && exit 0 + +if [ -x /sbin/pam_console_setowner -a -f /var/run/console/console.lock \ + -a -e "$DEVNAME" ]; then -[ "$UDEV_CONSOLE" != "yes" ] && exit 0 + if [ -x /usr/bin/logger ]; then + LOGGER=/usr/bin/logger + elif [ -x /bin/logger ]; then + LOGGER=/bin/logger + else + unset LOGGER + fi + # + # for diagnostics + # + if [ -t 1 -o -z "$LOGGER" ]; then + mesg () { + echo "$@" + } + else + mesg () { + $LOGGER -t $(basename $0)"[$$]" "$@" + } + fi -if [ -x /sbin/pam_console_setowner ]; then - if [ "$UDEV_LOG" = "yes" ] && [ -x /usr/bin/logger ]; then - /usr/bin/logger -p auth.debug "Restoring console permissions for $DEVNAME" + debug_mesg () { + test "$udev_log" = "" -o "$udev_log" = "no" && return + mesg "$@" + } + + if [ -f /etc/udev/udev.conf ]; then + . /etc/udev/udev.conf fi - exec /sbin/pam_console_setowner $DEVNAME + + SYMLINKS="" + for i in $(/usr/bin/udevinfo -q symlink -p "$DEVPATH"); do + [ $? -gt 0 ] && break + SYMLINKS="$SYMLINKS ${udev_root%%/}/$i" + done + debug_mesg "Restoring console permissions for $DEVNAME $SYMLINKS" + /sbin/pam_console_setowner "$DEVNAME" $SYMLINKS fi -- cgit v1.2.3-54-g00ecf From 5bc597fecaf6a2535aa4b66a21e609e80cfefcb1 Mon Sep 17 00:00:00 2001 From: "klauser@access.unizh.ch" Date: Tue, 7 Dec 2004 23:01:44 +0100 Subject: [PATCH] Various typos and other litte errors in udev.8.in Thanks-To: Tobias Klauser While crawling through the udev manpage I noticed some typos and other grammatical errors. English is not my native language, so I'm not sure if I fixed everything right. I would be glad if any English-speaking person could check this patch before applying. --- udev.8.in | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/udev.8.in b/udev.8.in index 7bdf560970..07bd7bce30 100644 --- a/udev.8.in +++ b/udev.8.in @@ -58,7 +58,7 @@ queries its database for the name of the device file to be deleted. All .B udev configuration files consist of a set of lines of text. All empty -lines and lines beginning with a '#' will be ignored. +lines or lines beginning with '#' will be ignored. .P .B udev @@ -91,22 +91,22 @@ All permission files are read in lexical order. The default value is .IR /etc/udev/permissions.d/ . .TP .B udev_log -The switch, if udev logs some information for every device handled. +The switch to enable/disable logging of udev information The default value is .IR yes . .TP .B default_mode -The default mode for all nodes not explicitely matching in the permissions +The default mode for all nodes not explicitly matching in the permissions file. The default value is .IR 0666 . .TP .B default_owner -The default owner for all nodes not explicitely matching in the permissions +The default owner for all nodes not explicitly matching in the permissions file. The default value is .IR root . .TP .B default_group -The default group for all nodes not explicitely matching in the permissions +The default group for all nodes not explicitly matching in the permissions file. The default value is .IR root . .br @@ -132,19 +132,19 @@ udev_permissions="/etc/udev/udev.permissions" udev_log="yes" # default_mode - set the default mode for all nodes not -# explicitely matching in the permissions file +# explicitly matching in the permissions file default_mode="0666" # default_owner - set the default owner for all nodes not -# explicitely matching in the permissions file +# explicitly matching in the permissions file default_owner="root" # default_group - set the default group for all nodes not -# explicitely matching in the permissions file +# explicitly matching in the permissions file default_group="root" .fi .P -The rules for device naming, are read from the files located in the +The rules for device naming are read from the files located in the .I /etc/udev/rules.d/ directory, or at the location specified by the .I udev_rules @@ -230,10 +230,10 @@ The name of a symlink targeting the node. Multiple symlinks may be specified by separating the names by the space character. .br If both the name and the symlink fields are omitted or its -values empty, the device will be ignored and no node will be created. +values are empty, the device will be ignored and no node will be created. .br If only the symlink field is given and the name field is omitted, -the rule will not be applied immediatly, but the symlink field is added +the rule will not be applied immediately, but the symlink field is added to the symlink list of the rule which will create the node. This makes it possible to specify additional symlinks in a possibly separate rules file, while the device nodes are maintained by the @@ -244,7 +244,7 @@ The permissions for this device. Every specified value overwrites the value given in the permissions file. .P .RB "The " NAME " ," SYMLINK " and " PROGRAM -fields support simple printf-like string substitution: +fields support simple printf-like string substitutions: .TP .B %n The "kernel number" of the device. @@ -263,7 +263,7 @@ The kernel minor number for the device. The bus id for the device. .TP .B %c -The string returned from the execution of +The string returned by the external program, specified in .B PROGRAM (This does not work within the .B PROGRAM @@ -296,7 +296,7 @@ the first three characters of the sysfs attribute. .RI "A sample " udev.rules " might look like this:" .sp .nf -# if /sbin/scsi_id returns "OEM 0815" device will be called disk1 +# if /sbin/scsi_id returns "OEM 0815", the device will be called disk1 BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="OEM 0815", NAME="disk1" # USB printer to be called lp_color @@ -326,7 +326,7 @@ KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", .fi .P -The permissions and ownership of the created device file is read from +The permissions and ownership of the created device file are read from the files located in the .I /etc/udev/permissions.d/ directory, or at the location specified by the @@ -363,15 +363,15 @@ Matches any single character specified within the brackets. For example, the pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character -following the '[' is a '!', any character not enclosed is matched. +following the '[' is a '!', any characters not enclosed are matched. .P After device node creation, removal, or network device renaming, .B udev executes the programs in the directory tree under .IR /etc/dev.d/ . -The name of a program must end with +The name of a program must have the suffix .I .dev -suffix, to be recognized. +to be recognized. .br In addition to the hotplug environment variables, .B UDEV_LOG -- cgit v1.2.3-54-g00ecf From 69bef84191f12dd82f7520f57e195f510bc9f96f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 5 Dec 2004 08:31:04 -0800 Subject: [PATCH] delete a bunch of files no longer needed. Thanks to Kay for pointing it out. --- etc/dev.d/default/dbus.dev | 15 ----- etc/dev.d/default/selinux.dev | 18 ------ etc/init.d/udev | 132 ------------------------------------------ test/ignore_test | 36 ------------ test/label_test | 49 ---------------- test/modifier_test | 47 --------------- test/topo_test | 47 --------------- test/udevd_test.sh | 88 ---------------------------- test/wait_for_sysfs_test.sh | 44 -------------- 9 files changed, 476 deletions(-) delete mode 100644 etc/dev.d/default/dbus.dev delete mode 100644 etc/dev.d/default/selinux.dev delete mode 100644 etc/init.d/udev delete mode 100644 test/ignore_test delete mode 100644 test/label_test delete mode 100644 test/modifier_test delete mode 100644 test/topo_test delete mode 100644 test/udevd_test.sh delete mode 100644 test/wait_for_sysfs_test.sh diff --git a/etc/dev.d/default/dbus.dev b/etc/dev.d/default/dbus.dev deleted file mode 100644 index 2fe1ed9b3a..0000000000 --- a/etc/dev.d/default/dbus.dev +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh - -if [ -f /etc/sysconfig/udev ]; then - . /etc/sysconfig/udev -fi - -if [ -f /etc/conf.d/udev ]; then - . /etc/conf.d/udev -fi - -[ "$UDEV_DBUS" != "yes" ] && exit 0 - -if [ -x /usr/sbin/udev_dbus ]; then - exec /usr/sbin/udev_dbus "$@" -fi diff --git a/etc/dev.d/default/selinux.dev b/etc/dev.d/default/selinux.dev deleted file mode 100644 index 9682658aad..0000000000 --- a/etc/dev.d/default/selinux.dev +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -if [ -f /etc/sysconfig/udev ]; then - . /etc/sysconfig/udev -fi - -if [ -f /etc/conf.d/udev ]; then - . /etc/conf.d/udev -fi - -[ "$UDEV_SELINUX" != "yes" ] && exit 0 - -if [ -x /sbin/restorecon ]; then - if [ "$UDEV_LOG" = "yes" ] && [ -x /usr/bin/logger ]; then - /usr/bin/logger -p auth.debug "Restoring file security contexts for $DEVNAME" - fi - /sbin/restorecon $DEVNAME -fi diff --git a/etc/init.d/udev b/etc/init.d/udev deleted file mode 100644 index 8726090d44..0000000000 --- a/etc/init.d/udev +++ /dev/null @@ -1,132 +0,0 @@ -#! /bin/sh -# -# udev init script to setup /udev -# -# chkconfig: 2345 20 80 -# description: manage user-space device nodes in /udev - -. /etc/rc.d/init.d/functions - -. /etc/udev/udev.conf - -prog=udev -sysfs_dir=/sys -bin=/sbin/udev -udevd=/sbin/udevd -udev_root=/udev - -run_udev () { - # handle block devices and their partitions - for i in ${sysfs_dir}/block/*; do - # add each drive - export DEVPATH=${i#${sysfs_dir}} - $bin block & - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - $bin block & - fi - done - done - # all other device classes - for i in ${sysfs_dir}/class/*; do - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - CLASS=`echo ${i#${sysfs_dir}} | \ - cut --delimiter='/' --fields=3-` - $bin $CLASS & - fi - done - done - return 0 -} - -make_extra_nodes () { - # there are a few things that sysfs does not export for us. - # these things go here (and remember to remove them in - # remove_extra_nodes() - # - # Thanks to Gentoo for the initial list of these. - ln -snf /proc/self/fd $udev_root/fd - ln -snf /proc/self/fd/0 $udev_root/stdin - ln -snf /proc/self/fd/1 $udev_root/stdout - ln -snf /proc/self/fd/2 $udev_root/stderr - ln -snf /proc/kcore $udev_root/core - #ln -snf /proc/asound/oss/sndstat $udev_root/sndstat -} - -remove_extra_nodes () { - # get rid of the extra nodes created in make_extra_nodes() - rm $udev_root/fd - rm $udev_root/stdin - rm $udev_root/stdout - rm $udev_root/stderr - rm $udev_root/core - #rm $udev_root/sndstat -} - -case "$1" in - start) - # don't use udev if sysfs is not mounted. - if [ ! -d $sysfs_dir/block ]; then - exit 1 - fi - if [ ! -d $udev_root ]; then - mkdir $udev_root - fi - - # remove the database if it is there as we always want to start fresh - if [ -f $udev_root/.udevdb ]; then - rm -rf $udev_root/.udevdb - fi - - # propogate /udev from /sys - we only need this while we do not - # have initramfs and an early user-space with which to do early - # device bring up - export ACTION=add - echo -n $"Creating initial udev device nodes:" - run_udev - make_extra_nodes - - # We want to start udevd ourselves if it isn't already running. This - # lets udevd run at a sane nice level... - $udevd & - - success /bin/true - echo - touch /var/lock/subsys/udev - ;; - stop) - # be careful - echo -n $"Removing udev device nodes: " - export ACTION=remove - run_udev - remove_extra_nodes - success /bin/true - echo - rm -f /var/lock/subsys/udev - ;; - status) - if [ -f /var/lock/subsys/udev ]; then - echo $"$prog has run" - exit 0 - fi - echo $"$prog is stopped" - exit 3 - ;; - restart) - $0 stop - $0 start - ;; - reload) - # nothing to do here - ;; - *) - echo "Usage: $0 {start|stop|status|restart}" - exit 1 -esac - -exit 0 diff --git a/test/ignore_test b/test/ignore_test deleted file mode 100644 index d22a4d7b5f..0000000000 --- a/test/ignore_test +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -RULES=ignore_test.rules -CONFIG=ignore_test.conf - -export UDEV_TEST=yes -export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_FILE=$PWD/$CONFIG - -cat > $RULES << EOF -KERNEL="ttyUSB0", NAME="" -EOF - -cat > $CONFIG << EOF -udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udevdb" -udev_rules="$PWD/$RULES" -udev_permissions="$PWD/udev.permissions" -udev_log="true" -EOF - -mkdir udev - -export DEVPATH=class/tty/ttyUSB0 -export ACTION=add - -../udev tty -ls -l udev - -export ACTION=remove -../udev tty -ls -l udev - -rm $RULES -rm $CONFIG -rm -rf udev diff --git a/test/label_test b/test/label_test deleted file mode 100644 index fbb7309045..0000000000 --- a/test/label_test +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash - -RULES=label_test.rules -CONFIG=label_test.conf - -export UDEV_TEST=yes -export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_FILE=$PWD/$CONFIG - -cat > $RULES << EOF -BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_diskX%n" -BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_disk%n" -EOF - -cat > $CONFIG << EOF -udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udevdb" -udev_rules="$PWD/$RULES" -udev_permissions="$PWD/udev.permissions" -EOF - -mkdir udev - -export ACTION=add -export DEVPATH=block/sda - -../udev block -ls -l udev - -export DEVPATH=block/sda/sda3 - -../udev block -ls -l udev - -export ACTION=remove -export DEVPATH=block/sda - -../udev block -ls -l udev - -export DEVPATH=block/sda/sda3 - -../udev block -ls -l udev - - -rm $RULES -rm $CONFIG -rm -rf udev diff --git a/test/modifier_test b/test/modifier_test deleted file mode 100644 index c2b5ec6830..0000000000 --- a/test/modifier_test +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -RULES=modifier_test.rules -CONFIG=modifier_test.conf - -export UDEV_TEST=yes -export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_FILE=$PWD/$CONFIG - -cat > $RULES << EOF -BUS="scsi", place="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" -EOF - -cat > $CONFIG << EOF -udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udevdb" -udev_rules="$PWD/$RULES" -udev_permissions="$PWD/udev.permissions" -EOF - -mkdir udev - -export ACTION=add -export DEVPATH=block/sda - -../udev block -ls udev - -export DEVPATH=block/sda/sda3 - -../udev block -ls udev - -export ACTION=remove -export DEVPATH=block/sda - -../udev block -ls udev - -export DEVPATH=block/sda/sda3 - -../udev block -ls udev - -rm $RULES -rm $CONFIG -rm -rf udev diff --git a/test/topo_test b/test/topo_test deleted file mode 100644 index 77333a978c..0000000000 --- a/test/topo_test +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -RULES=replace_test.rules -CONFIG=replace_test.conf - -export UDEV_TEST=yes -export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_FILE=$PWD/$CONFIG - -cat > $RULES << EOF -BUS="scsi", place="0:0:0:0", NAME="first_disk%n" -EOF - -cat > $CONFIG << EOF -udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udevdb" -udev_rules="$PWD/$RULES" -udev_permissions="$PWD/udev.permissions" -EOF - -mkdir udev - -export ACTION=add -export DEVPATH=block/sda - -../udev block -ls udev - -export DEVPATH=block/sda/sda3 - -../udev block -ls udev - -export ACTION=remove -export DEVPATH=block/sda - -../udev block -ls udev - -export DEVPATH=block/sda/sda3 - -../udev block -ls udev - -rm $RULES -rm $CONFIG -rm -rf udev diff --git a/test/udevd_test.sh b/test/udevd_test.sh deleted file mode 100644 index 981a39d01d..0000000000 --- a/test/udevd_test.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh - -# add/rem/add/rem/add sequence of sda/sdb/sdc -# a few days longer and the socket of my usb-flash-reader is gone :) - -export SEQNUM=0 -export ACTION=add -export DEVPATH=/test/init -./udevsend test - -export SEQNUM=3 -export ACTION=add -export DEVPATH=/test/sdc -./udevsend test - -export SEQNUM=1 -export ACTION=add -export DEVPATH=/test/sda -./udevsend test - -export SEQNUM=2 -export ACTION=add -export DEVPATH=/test/sdb -./udevsend test - -export SEQNUM=4 -export ACTION=remove -export DEVPATH=/test/sdc -./udevsend test - -export SEQNUM=5 -export ACTION=remove -export DEVPATH=/test/sdb -./udevsend test - -export SEQNUM=8 -export ACTION=add -export DEVPATH=/test/sdb -./udevsend test - -export SEQNUM=6 -export ACTION=remove -export DEVPATH=/test/sda -./udevsend test - -export SEQNUM=7 -export ACTION=add -export DEVPATH=/test/sda -#./udevsend test - -sleep 2 - -export SEQNUM=9 -export ACTION=add -export DEVPATH=/test/sdc -./udevsend test - -export SEQNUM=11 -export ACTION=remove -export DEVPATH=/test/sdb -./udevsend test - -export SEQNUM=10 -export ACTION=remove -export DEVPATH=/test/sdc -./udevsend test - -export SEQNUM=13 -export ACTION=add -export DEVPATH=/test/sda -./udevsend test - -export SEQNUM=14 -export ACTION=add -export DEVPATH=/test/sdb -./udevsend test - -export SEQNUM=15 -export ACTION=add -export DEVPATH=/test/sdc -./udevsend test - -sleep 2 - -export SEQNUM=12 -export ACTION=remove -export DEVPATH=/test/sda -./udevsend test diff --git a/test/wait_for_sysfs_test.sh b/test/wait_for_sysfs_test.sh deleted file mode 100644 index 9b80a42271..0000000000 --- a/test/wait_for_sysfs_test.sh +++ /dev/null @@ -1,44 +0,0 @@ -#! /bin/bash -# - -# Check for missing binaries (stale symlinks should not happen) -UDEV_BIN=../wait_for_sysfs -test -x $UDEV_BIN || exit 5 - -# Directory where sysfs is mounted -SYSFS_DIR=/sys - -run_udev () { - # handle block devices and their partitions - for i in ${SYSFS_DIR}/block/*; do - # add each drive - export DEVPATH=${i#${SYSFS_DIR}} - $UDEV_BIN block - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${SYSFS_DIR}} - $UDEV_BIN block - fi - done - done - # all other device classes - for i in ${SYSFS_DIR}/class/*; do - # try adding empty classes, just to test stuff... - export DEVPATH=${i#${SYSFS_DIR}} - CLASS=`echo ${i#${SYSFS_DIR}} | cut --delimiter='/' --fields=3-` - $UDEV_BIN $CLASS - - for j in `ls $i/`; do - x=$i/$j - export DEVPATH=${x#${SYSFS_DIR}} - CLASS=`echo ${i#${SYSFS_DIR}} | \ - cut --delimiter='/' --fields=3-` - $UDEV_BIN $CLASS - done - done -} - -export ACTION=add -run_udev -- cgit v1.2.3-54-g00ecf From d18c91df7fe7134b7aea6f68b183296ac94633ed Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sun, 5 Dec 2004 08:31:37 -0800 Subject: [PATCH] use udevstart for udev.init.* files. Thanks to Kay for pointing it out. --- etc/init.d/udev.init.LSB | 38 +++----------------------------------- etc/init.d/udev.init.lfs | 39 ++------------------------------------- 2 files changed, 5 insertions(+), 72 deletions(-) diff --git a/etc/init.d/udev.init.LSB b/etc/init.d/udev.init.LSB index 0f5881c416..0fb0f0c205 100644 --- a/etc/init.d/udev.init.LSB +++ b/etc/init.d/udev.init.LSB @@ -49,34 +49,6 @@ SYSFS_DIR=/sys # Source LSB init functions . /lib/lsb/init-functions -run_udev () { - # handle block devices and their partitions - for i in ${SYSFS_DIR}/block/*; do - # add each drive - export DEVPATH=${i#${SYSFS_DIR}} - $UDEV_BIN block & - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${SYSFS_DIR}} - $UDEV_BIN block & - fi - done - done - # all other device classes - for i in ${SYSFS_DIR}/class/*; do - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${SYSFS_DIR}} - CLASS=`echo ${i#${SYSFS_DIR}} | \ - cut --delimiter='/' --fields=3-` - $UDEV_BIN $CLASS & - fi - done - done -} - case "$1" in start) if [ ! -d $SYSFS_DIR ]; then @@ -91,16 +63,12 @@ case "$1" in # device bring up echo -n "Creating initial udev device nodes: " export ACTION=add - run_udev + udevstart log_success_msg ;; stop) - # be careful - echo -n "Removing udev device nodes: " - export ACTION=remove - run_udev - rm -f $udev_db || exit 1 - rmdir $udev_root || exit 1 + # nothing to do here + echo -n "Stopping udev: " log_success_msg ;; restart) diff --git a/etc/init.d/udev.init.lfs b/etc/init.d/udev.init.lfs index 41a3fecf0f..d4f64062b8 100644 --- a/etc/init.d/udev.init.lfs +++ b/etc/init.d/udev.init.lfs @@ -10,38 +10,6 @@ . /etc/udev/udev.conf sysfs_dir="/sys" -bin="/sbin/udev" - - -run_udev () -{ - # handle block devices and their partitions - for i in ${sysfs_dir}/block/*; do - # add each drive - export DEVPATH=${i#${sysfs_dir}} - $bin block & - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - $bin block & - fi - done - done - # all other device classes - for i in ${sysfs_dir}/class/*; do - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - CLASS=`echo ${i#${sysfs_dir}} | \ - cut --delimiter='/' --fields=3-` - $bin $CLASS & - fi - done - done - return 0 -} case "$1" in start) @@ -62,14 +30,11 @@ case "$1" in # propogate /udev from /sys - we only need this while we do not # have initramfs and an early user-space with which to do early # device bring up - export ACTION=add - run_udev + udevstart evaluate_retval ;; stop) - echo "Removing udev device nodes ..." - export ACTION=remove - run_udev + echo "Stopping udev ..." evaluate_retval ;; reload) -- cgit v1.2.3-54-g00ecf From 3efc93cc40464e83cc202b40e6290e8759130ca2 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 3 Dec 2004 01:04:53 -0800 Subject: [PATCH] Fix the multithreaded build again... --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 6494c1bf19..1fe5c23f58 100644 --- a/Makefile +++ b/Makefile @@ -297,6 +297,9 @@ GEN_MANPAGESIN = udev.8.in $(GEN_MANPAGES): $(GEN_MANPAGESIN) sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ +$(UDEV_OBJS): $(GEN_HEADERS) $(HOST_PROGS) +$(SYSFS_OBJS): $(HOST_PROGS) +$(KLIBC_FIXUP_OBJS): $(HOST_PROGS) $(OBJS): $(GEN_HEADERS) $(HOST_PROGS) $(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS) $(TESTER).o: $(GEN_HEADERS) $(HOST_PROGS) -- cgit v1.2.3-54-g00ecf From de5d2ee0a7192500b1c48f8d52a68b30258157a9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Fri, 3 Dec 2004 18:50:05 -0800 Subject: [PATCH] fix gentoo scsi cdrom rule http://bugs.gentoo.org/show_bug.cgi?id=73208 --- etc/udev/udev.rules.gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 1809232ed0..83407ea9d0 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -14,7 +14,7 @@ # cdrom symlinks and other good cdrom naming BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS="scsi", KERNEL="sr[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" # devfs-names for ide-devices (uncomment only one) -- cgit v1.2.3-54-g00ecf From 55b0508969652acc71114b0b1205226ad3d27f39 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 8 Dec 2004 16:55:27 -0800 Subject: [PATCH] added asterix rules to the gentoo file. --- etc/udev/udev.rules.gentoo | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 83407ea9d0..64e020f83e 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -140,3 +140,10 @@ KERNEL="radio[0-9]*", NAME="v4l/radio%n" KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" +# Asterix Zaptel devices +KERNEL="zapctl", NAME="zap/ctl" +KERNEL="zaptimer", NAME="zap/timer" +KERNEL="zapchannel", NAME="zap/channel" +KERNEL="zappseudo", NAME="zap/pseudo" +KERNEL="zap[0-9]*", NAME="zap/%n" + -- cgit v1.2.3-54-g00ecf From e0a17b749f00ef42dda0efe71f7f26637c4ca9a9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 8 Dec 2004 17:05:20 -0800 Subject: [PATCH] update debian rules files. --- etc/udev/udev.rules.debian | 58 +++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/etc/udev/udev.rules.debian b/etc/udev/udev.rules.debian index cdc0505418..65a89ae593 100644 --- a/etc/udev/udev.rules.debian +++ b/etc/udev/udev.rules.debian @@ -1,28 +1,28 @@ # There are a number of modifiers that are allowed to be used in some # of the different fields. They provide the following subsitutions: -# %n - the "kernel number" of the device. -# For example, 'sda3' has a "kernel number" of '3' -# %k - the kernel name for the device. -# %M - the kernel major number for the device -# %m - the kernel minor number for the device -# %b - the bus id for the device -# %c - the string returned by the PROGRAM. (Note, this doesn't work within -# the PROGRAM field for the obvious reason.) -# %s{filename} - the content of a sysfs attribute. -# %% - the '%' char itself. # - -# /dev/cdrom symlink -BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" - -# permissions for SCSI sg devices -BUS="scsi", KERNEL="s[grt][0-9]*", SYSFS{type}="5", NAME="%k", MODE="0660", GROUP="cdrom" +# %n the "kernel number" of the device. +# For example, 'sda3' has a "kernel number" of '3' +# %e the smallest number for that name which does not matches an existing node +# %k the kernel name for the device. +# %M the kernel major number for the device +# %m the kernel minor number for the device +# %b the bus id for the device +# %c the string returned by the PROGRAM +# %s{filename} the content of a sysfs attribute. +# %% the '%' char itself. +# # permissions for IDE CD devices -BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", MODE="0660", GROUP="cdrom" +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", MODE="0660", GROUP="cdrom" # permissions for IDE floppy devices -BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", NAME="%k", MODE="0660", GROUP="floppy" +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", NAME="%k", MODE="0660", GROUP="floppy" + +# permissions for SCSI CD devices +BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5", NAME="scd%n", MODE="0660", GROUP="cdrom", SYMLINK="sr%n" +BUS="scsi", KERNEL="sg[0-9]*", SYSFS{type}="5", NAME="%k", MODE="0660", GROUP="cdrom" + # USB devices BUS="usb", KERNEL="hiddev*", NAME="usb/%k" @@ -30,39 +30,49 @@ BUS="usb", KERNEL="auer*", NAME="usb/%k" BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" BUS="usb", KERNEL="dabusb*", NAME="usb/%k" BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" +BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" -KERNEL="dvb*", PROGRAM="/etc/udev/dvb.sh %k", NAME="%c" +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" KERNEL="card*", NAME="dri/card%n" KERNEL="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL="pktcdvd", NAME="pktcdvd/control" KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" KERNEL="msr[0-9]*", NAME="cpu/%n/msr" KERNEL="microcode", NAME="cpu/microcode" # ALSA devices KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="hwC[D0-9]*", NAME="snd/%k" +KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL="midiC[D0-9]*", NAME="snd/%k" KERNEL="timer", NAME="snd/%k" KERNEL="seq", NAME="snd/%k" # input devices KERNEL="mice", NAME="input/%k" KERNEL="mouse[0-9]*", NAME="input/%k" -KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/inputdev.sh %k", RESULT="inputdev", MODE="0664", GROUP="video" +KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", MODE="0664", GROUP="video" KERNEL="event[0-9]*", NAME="input/%k" KERNEL="js[0-9]*", NAME="input/%k" KERNEL="ts[0-9]*", NAME="input/%k" KERNEL="uinput", NAME="input/%k" -KERNEL="tap*", NAME="net/%k" +KERNEL="tap[0-9]*", NAME="net/%k" KERNEL="tun", NAME="net/%k" # CAPI devices KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" KERNEL="capi[0-9]*", NAME="capi/%n" +# Zaptel +KERNEL="zapctl", NAME="zap/ctl" +KERNEL="zaptimer", NAME="zap/timer" +KERNEL="zapchannel", NAME="zap/channel" +KERNEL="zappseudo", NAME="zap/pseudo" +KERNEL="zap[0-9]*", NAME="zap/%n" + # device mapper creates its own device nodes, so ignore these KERNEL="dm-[0-9]*", NAME="" KERNEL="device-mapper", NAME="mapper/control" -- cgit v1.2.3-54-g00ecf From 5e7d9f4060f0d1f11048c8735aa5d7ef6a4932e8 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 26 Apr 2005 23:10:15 -0700 Subject: more merge fixups --- etc/udev/udev.rules.gentoo | 2 +- extras/ide-devfs.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo index 64e020f83e..6a53e88d9d 100644 --- a/etc/udev/udev.rules.gentoo +++ b/etc/udev/udev.rules.gentoo @@ -19,7 +19,7 @@ BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYM # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" # dri devices KERNEL="card*", NAME="dri/card%n" diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 4f20259480..580a751abe 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -36,11 +36,11 @@ get_dev_number() { if [ -z "$3" ] && [ -f /proc/ide/${1}/media ]; then MEDIA=`cat /proc/ide/${1}/media` if [ "${MEDIA}" = "cdrom" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` ${MEDIA} elif [ "${MEDIA}" = "floppy" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc ${MEDIA} elif [ "${MEDIA}" = "disk" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc + echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc ${MEDIA} fi else echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/part$3 discs/disc`get_dev_number $1 disk`/part$3 -- cgit v1.2.3-54-g00ecf From f01a9ca1a2824e07908457ef01db238b77d21f96 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 8 Dec 2004 17:08:20 -0800 Subject: [PATCH] move distro specific config files into their own directories --- etc/udev/debian/udev.permissions | 121 +++++++++++++++++++++ etc/udev/debian/udev.rules | 79 ++++++++++++++ etc/udev/gentoo/udev.permissions | 205 ++++++++++++++++++++++++++++++++++++ etc/udev/gentoo/udev.rules | 149 ++++++++++++++++++++++++++ etc/udev/redhat/udev.permissions | 194 ++++++++++++++++++++++++++++++++++ etc/udev/redhat/udev.rules | 125 ++++++++++++++++++++++ etc/udev/slackware/udev.permissions | 133 +++++++++++++++++++++++ etc/udev/udev.permissions.debian | 121 --------------------- etc/udev/udev.permissions.gentoo | 205 ------------------------------------ etc/udev/udev.permissions.redhat | 194 ---------------------------------- etc/udev/udev.permissions.slackware | 133 ----------------------- etc/udev/udev.rules.debian | 79 -------------- etc/udev/udev.rules.gentoo | 149 -------------------------- etc/udev/udev.rules.redhat | 125 ---------------------- 14 files changed, 1006 insertions(+), 1006 deletions(-) create mode 100644 etc/udev/debian/udev.permissions create mode 100644 etc/udev/debian/udev.rules create mode 100644 etc/udev/gentoo/udev.permissions create mode 100644 etc/udev/gentoo/udev.rules create mode 100644 etc/udev/redhat/udev.permissions create mode 100644 etc/udev/redhat/udev.rules create mode 100644 etc/udev/slackware/udev.permissions delete mode 100644 etc/udev/udev.permissions.debian delete mode 100644 etc/udev/udev.permissions.gentoo delete mode 100644 etc/udev/udev.permissions.redhat delete mode 100644 etc/udev/udev.permissions.slackware delete mode 100644 etc/udev/udev.rules.debian delete mode 100644 etc/udev/udev.rules.gentoo delete mode 100644 etc/udev/udev.rules.redhat diff --git a/etc/udev/debian/udev.permissions b/etc/udev/debian/udev.permissions new file mode 100644 index 0000000000..6429519eec --- /dev/null +++ b/etc/udev/debian/udev.permissions @@ -0,0 +1,121 @@ +# name:user:group:mode + +# character devices + +ptmx:root:tty:0666 +random:root:root:0666 +urandom:root:root:0444 +kmem:root:kmem:0640 +mem:root:kmem:0640 +port:root:kmem:0640 +null:root:root:0666 +zero:root:root:0666 +full:root:root:0666 + +misc/nvram:root:nvram:660 +nvram:root:nvram:660 +misc/rtc:root:audio:0664 +rtc:root:audio:0664 + +tts/*:root:dialout:0660 +bluetooth/rfcomm/*:root:dialout:0660 +tty[BCDEFHILMPRSTUVWX][0-9]*:root:dialout:0660 +ttyS[ACIR][0-9]*:root:dialout:0660 +ttyUSB[0-9]*:root:dialout:0660 +ttyACM[0-9]*:root:dialout:0660 +ippp[0-9]*:root:dialout:0660 +isdn[0-9]*:root:dialout:0660 +isdnctrl[0-9]*:root:dialout:0660 +capi[0-9.]*:root:dialout:0660 +dcbri[0-9]*:root:dialout:0660 +ircomm[0-9]*:root:dialout:0660 +rfcomm[0-9]*:root:dialout:0660 +tty:root:tty:0666 + +snd/*:root:audio:0660 +sound/*:root:audio:0660 +admmidi*:root:audio:0660 +adsp*:root:audio:0660 +aload*:root:audio:0660 +amidi*:root:audio:0660 +amixer*:root:audio:0660 +audio*:root:audio:0660 +dmfm*:root:audio:0660 +dsp*:root:audio:0660 +audio*:root:audio:0660 +mixer*:root:audio:0660 +music:root:audio:0660 +sequencer*:root:audio:0660 + +printers/*:root:lp:0660 +usb/lp[0-9]*:root:lp:0660 +usb/legousbtower[0-9]*:root:root:666 +lp[0-9]*:root:lp:0660 +parport[0-9]*:root:lp:0660 +irlpt[0-9]*:root:lp:0660 +usblp[0-9]*:root:lp:0660 + +input/mice:root:root:0600 +input/mouse[0-9]*:root:root:0600 +input/js[0-9]*:root:root:0644 +input/*:root:root:0600 +mouse[0-9]*:root:root:0600 +js[0-9]*:root:root:0644 + +dri/card[0-9]*:root:video:0660 +fb/*:root:video:0660 +fb[0-9]*:root:video:0660 +agpgart:root:video:0660 +nvidia*:root:video:0660 + +v4l/*:root:video:0660 +video[0-9]*:root:video:0660 +radio[0-9]*:root:video:0660 +vbi[0-9]*:root:video:0660 +vtx[0-9]*:root:video:0660 +dvb/*:root:video:0660 + +# block devices + +floppy/*:root:floppy:0660 +fd[0-9]*:root:floppy:0660 +cdemu/*:root:cdrom:0660 +pktcdvd[0-9]*:root:cdrom:0660 + +ram[0-9]*:root:disk:0660 +raw/*:root:disk:0660 + +ide/*/cd:root:cdrom:0660 +ide/*:root:disk:0660 +hd[a-s]:root:disk:0660 +hd[a-s][0-9]*:root:disk:0660 + +scsi/*/cd:root:cdrom:0660 +scsi/*:root:disk:0660 +sd[a-z]:root:disk:0660 +sd[a-z][0-9]*:root:disk:0660 +sd[a-i][a-z]:root:disk:0660 +sd[a-i][a-z][0-9]*:root:disk:0660 +s[gr][0-9]*:root:disk:0660 +scd[0-9]*:root:cdrom:0660 + +dasd[0-9]*:root:disk:0660 +ataraid[0-9]*:root:disk:0660 + +loop/*:root:disk:0660 +loop[0-9]*:root:disk:0660 +md/*:root:disk:0660 +md[0-9]*:root:disk:0660 +dm-*:root:disk:0640 + +ht[0-9]*:root:tape:0660 +nht[0-9]*:root:tape:0660 +pt[0-9]*:root:tape:0660 +npt[0-9]*:root:tape:0660 +st[0-9]*:root:tape:0660 +nst[0-9]*:root:tape:0660 + +sgi_fetchop:root:root:666 +iseries/vcd*:root:disk:660 +iseries/vd*:root:disk:660 + diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules new file mode 100644 index 0000000000..65a89ae593 --- /dev/null +++ b/etc/udev/debian/udev.rules @@ -0,0 +1,79 @@ +# There are a number of modifiers that are allowed to be used in some +# of the different fields. They provide the following subsitutions: +# +# %n the "kernel number" of the device. +# For example, 'sda3' has a "kernel number" of '3' +# %e the smallest number for that name which does not matches an existing node +# %k the kernel name for the device. +# %M the kernel major number for the device +# %m the kernel minor number for the device +# %b the bus id for the device +# %c the string returned by the PROGRAM +# %s{filename} the content of a sysfs attribute. +# %% the '%' char itself. +# + +# permissions for IDE CD devices +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", MODE="0660", GROUP="cdrom" + +# permissions for IDE floppy devices +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", NAME="%k", MODE="0660", GROUP="floppy" + +# permissions for SCSI CD devices +BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5", NAME="scd%n", MODE="0660", GROUP="cdrom", SYMLINK="sr%n" +BUS="scsi", KERNEL="sg[0-9]*", SYSFS{type}="5", NAME="%k", MODE="0660", GROUP="cdrom" + + +# USB devices +BUS="usb", KERNEL="hiddev*", NAME="usb/%k" +BUS="usb", KERNEL="auer*", NAME="usb/%k" +BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" +BUS="usb", KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" +BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" + +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" + +KERNEL="card*", NAME="dri/card%n" +KERNEL="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL="pktcdvd", NAME="pktcdvd/control" +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL="microcode", NAME="cpu/microcode" + +# ALSA devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hwC[D0-9]*", NAME="snd/%k" +KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL="midiC[D0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + +# input devices +KERNEL="mice", NAME="input/%k" +KERNEL="mouse[0-9]*", NAME="input/%k" +KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", MODE="0664", GROUP="video" +KERNEL="event[0-9]*", NAME="input/%k" +KERNEL="js[0-9]*", NAME="input/%k" +KERNEL="ts[0-9]*", NAME="input/%k" +KERNEL="uinput", NAME="input/%k" + +KERNEL="tap[0-9]*", NAME="net/%k" +KERNEL="tun", NAME="net/%k" + +# CAPI devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi[0-9]*", NAME="capi/%n" + +# Zaptel +KERNEL="zapctl", NAME="zap/ctl" +KERNEL="zaptimer", NAME="zap/timer" +KERNEL="zapchannel", NAME="zap/channel" +KERNEL="zappseudo", NAME="zap/pseudo" +KERNEL="zap[0-9]*", NAME="zap/%n" + +# device mapper creates its own device nodes, so ignore these +KERNEL="dm-[0-9]*", NAME="" +KERNEL="device-mapper", NAME="mapper/control" + diff --git a/etc/udev/gentoo/udev.permissions b/etc/udev/gentoo/udev.permissions new file mode 100644 index 0000000000..51dd9f290e --- /dev/null +++ b/etc/udev/gentoo/udev.permissions @@ -0,0 +1,205 @@ +# /etc/udev/udev.permissions: permission/ownership map for udev +# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.permissions,v 1.3 2004/01/01 03:41:24 azarah Exp $ + +# console devices +console:root:tty:0600 +tty:root:tty:0666 +tty[0-9]*:root:tty:0660 +vc/[0-9]*:root:tty:0660 + +# pty devices +# Set this to 0660 if you only want users belonging to tty group +# to be able to allocate PTYs +ptmx:root:tty:0666 +pty[p-za-e][0-9a-f]*:root:tty:0660 +tty[p-za-e][0-9a-f]*:root:tty:0660 +pty/m*:root:tty:0660 +vc/s*:root:tty:0660 + +# serial+dialup devices +ttyS*:root:tty:0660 +ippp*:root:tty:0660 +isdn*:root:tty:0660 +isdnctrl*:root:tty:0660 +capi*:root:tty:0660 +dcbri*:root:tty:0660 +ircomm*:root:tty:0660 +ttyUSB*:root:usb:0660 +tts/[0-9]*:root:tty:0660 +tts/USB[0-9]*:root:usb:0660 + +# vc devices +vcs:root:root:0600 +vcs[0-9]*:root:root:0600 +vcsa:root:root:0600 +vcsa[0-9]*:root:root:0600 +vcc/*:root:root:0600 + +# memory devices +random:root:root:0666 +urandom:root:root:0444 +mem:root:kmem:0640 +kmem:root:kmem:0640 +port:root:kmem:0640 +full:root:root:0666 +null:root:root:0666 +zero:root:root:0666 + +# misc devices +misc/nvram:root:root:0660 +misc/rtc:root:root:0664 +misc/inotify:root:root:0666 + +# floppy devices +fd[01]*:root:floppy:0660 + +# audio devices +dsp*:root:audio:0660 +audio*:root:audio:0660 +midi*:root:audio:0660 +mixer*:root:audio:0660 +sequencer*:root:audio:0660 +sound/*:root:audio:0660 +snd/*:root:audio:0660 +beep:root:audio:0660 +admm*:root:audio:0660 +adsp*:root:audio:0660 +aload*:root:audio:0660 +amidi*:root:audio:0660 +dmfm*:root:audio:0660 +dmmidi*:root:audio:0660 +sndstat:root:audio:0660 + +# optical devices +sr*:root:cdrom:660 +scd*:root:cdrom:660 +pcd*:root:cdrom:0660 +cdrom*:root:cdrom:0660 +dvd:root:cdrom:0660 +rdvd:root:cdrom:0660 +cdroms/*:root:cdrom:0660 + +# pilot/palm devices +pilot:root:uucp:0660 + +# jaz devices +jaz*:root:disk:0660 + +# zip devices +pocketzip*:root:disk:0660 +zip*:root:disk:0660 + +# ls120 devices +ls120:root:disk:0660 +ls120*:root:disk:0660 + +# lp devices +lp*:root:lp:0660 +parport*:root:lp:0660 +irlpt*:root:lp:0660 +usblp*:root:lp:0660 +usb/lp*:root:lp:0660 + +# scanner devices +scanner:root:root:0600 +usb/scanner*:root:root:0600 + +# camera devices +camera*:root:root:0600 +usb/dc2xx*:root:root:0600 +usb/mdc800*:root:root:0600 + +# raw devices +ram*:root:disk:660 +raw/*:root:disk:660 + +# disk devices +hd*:root:disk:660 +sd*:root:disk:660 +dasd*:root:disk:660 +ataraid*:root:disk:660 +loop*:root:disk:660 +md*:root:disk:660 +ide/*/*/*/*/*:root:disk:660 +discs/*/*:root:disk:660 +loop/*:root:disk:660 +md/*:root:disk:660 + +# tape devices +ht*:root:tape:0660 +nht*:root:tape:0660 +pt[0-9]*:root:tape:0660 +npt*:root:tape:0660 +st*:root:tape:0660 +nst*:root:tape:0660 + +# dm devices +dm-*:root:root:0640 + +# memstick devices +memstick*:root:root:0600 + +# flash devices +flash*:root:root:0600 + +# diskonkey devices +diskonkey*:root:disk:0660 + +# rem_ide devices +microdrive*:root:disk:0660 + +# fb devices +fb:root:root:0600 +fb[0-9]*:root:root:0600 +fb/*:root:root:0600 + +# kbd devices +kbd:root:root:0644 + +# joystick devices +js[0-9]*:root:root:0644 +djs[0-9]*:root:root:0644 + +# v4l devices +video*:root:video:0660 +radio*:root:video:0660 +winradio*:root:video:0660 +vtx*:root:video:0660 +vbi*:root:video:0660 +video/*:root:video:0660 +vttuner:root:video:0660 +v4l/*:root:video:0660 + +# input devices +input/event*:root:root:600 +input/ts*:root:root:600 +input/*:root:root:644 + +# Sony Vaio Jogdial sonypi device +sonypi:root:root:0666 + +# gpm devices +gpmctl:root:root:0700 + +# dri devices +nvidia*:root:video:0660 +3dfx*:root:video:0660 +dri/*:root:video:0660 + +# mainboard devices +apm_bios:root:root:0600 + +# scsi devices +sg*:root:disk:0660 +pg*:root:disk:0660 +cdwriter:root:disk:0660 + +# usb devices +usb/dabusb*:root:usb:0660 +usb/mdc800*:root:usb:0660 +usb/rio500:root:usb:0660 +usb/legousbtower*:root:usb:0660 + +sgi_fetchop:root:root:666 +iseries/vcd*:root:disk:660 +iseries/vd*:root:disk:660 diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules new file mode 100644 index 0000000000..6a53e88d9d --- /dev/null +++ b/etc/udev/gentoo/udev.rules @@ -0,0 +1,149 @@ +# /etc/udev/udev.rules: device naming rules for udev +# +# Gentoo specific rules, based a bit on devfs rules, but much simpler. +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. + + +########################################################### +# +# For devfs similar /dev layout (neater) +# +########################################################### + +# cdrom symlinks and other good cdrom naming +BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" + +# devfs-names for ide-devices (uncomment only one) +# /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" + +# dri devices +KERNEL="card*", NAME="dri/card%n" + +# alsa devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midiC[D0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + +# capi devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi*", NAME="capi/%n" + +# cpu devices +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL="microcode", NAME="cpu/microcode" + +# dm devices (ignore them) +KERNEL="dm-[0-9]*", NAME="" +# create a symlink named after the device map name +# note devmap_name comes with extras/multipath +#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" +KERNEL="device-mapper", NAME="mapper/control" + +# fb devices +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" + +# floppy devices +KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" + +# i2c devices +KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" + +# input devices +KERNEL="mice", NAME="input/%k" +KERNEL="mouse*", NAME="input/%k" +KERNEL="event*", NAME="input/%k" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + +# loop devices +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" + +# md block devices +KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" + +# misc devices +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" +KERNEL="inotify", NAME="misc/%k", SYMLINK="%k" + +# netlink devices +KERNEL="route", NAME="netlink/%k" +KERNEL="skip", NAME="netlink/%k" +KERNEL="usersock", NAME="netlink/%k" +KERNEL="fwmonitor", NAME="netlink/%k" +KERNEL="tcpdiag", NAME="netlink/%k" +KERNEL="nflog", NAME="netlink/%k" +KERNEL="xfrm", NAME="netlink/%k" +KERNEL="arpd", NAME="netlink/%k" +KERNEL="route6", NAME="netlink/%k" +KERNEL="ip6_fw", NAME="netlink/%k" +KERNEL="dnrtmsg", NAME="netlink/%k" +KERNEL="tap*", NAME="netlink/%k" + +# network devices +KERNEL="tun", NAME="net/%k" + +# pty devices +KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k" + +# ramdisk devices +KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" + +# raw devices +KERNEL="raw[0-9]*", NAME="raw/%k" + +# sound devices +KERNEL="adsp", NAME="sound/%k", SYMLINK="%k" +KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="audio", NAME="sound/%k", SYMLINK="%k" +KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="dsp", NAME="sound/%k", SYMLINK="%k" +KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="mixer", NAME="sound/%k", SYMLINK="%k" +KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k" +KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k" + +# tty devices +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" + +# usb devices +KERNEL="hiddev*", NAME="usb/%k" +KERNEL="auer*", NAME="usb/%k" +KERNEL="legousbtower*", NAME="usb/%k" +KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" + +# vc devices +KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" +KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" +KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" + +# v4l devices +KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n" +KERNEL="radio[0-9]*", NAME="v4l/radio%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" + +# Asterix Zaptel devices +KERNEL="zapctl", NAME="zap/ctl" +KERNEL="zaptimer", NAME="zap/timer" +KERNEL="zapchannel", NAME="zap/channel" +KERNEL="zappseudo", NAME="zap/pseudo" +KERNEL="zap[0-9]*", NAME="zap/%n" + diff --git a/etc/udev/redhat/udev.permissions b/etc/udev/redhat/udev.permissions new file mode 100644 index 0000000000..c96663964f --- /dev/null +++ b/etc/udev/redhat/udev.permissions @@ -0,0 +1,194 @@ +# /etc/udev/udev.permissions: permission/ownership map for udev + +# console devices +console:root:root:0600 +tty[0-9][0-9]*:root:tty:0660 +vc/[0-9]*:root:tty:0660 + +# pty devices +# Set this to 0660 if you only want users belonging to tty group +# to be able to allocate PTYs +ptmx:root:tty:0666 +tty:root:tty:0666 +pty[p-za-e][0-9a-f]*:root:tty:0660 +tty[p-za-e][0-9a-f]*:root:tty:0660 +pty/m*:root:tty:0660 +vc/s*:root:tty:0660 + +# serial+dialup devices +ttyS*:root:uucp:0660 +ippp*:root:root:0660 +isdn*:root:root:0660 +isdnctrl*:root:root:0660 +capi*:root:root:0660 +dcbri*:root:root:0660 +ircomm*:root:uucp:0660 +ttyUSB*:root:uucp:0660 +tts/[0-9]*:root:uucp:0660 +tts/USB[0-9]*:root:uucp:0660 + +# vc devices +vcs:vcsa:tty:0600 +vcs[0-9]*:vcsa:tty:0600 +vcsa:vcsa:tty:0600 +vcsa[0-9]*:vcsa:tty:0600 +vcc/*:vcsa:tty:0600 + +# memory devices +random:root:root:0666 +urandom:root:root:0444 +mem:root:kmem:0640 +kmem:root:kmem:0640 +port:root:kmem:0640 +full:root:root:0666 +null:root:root:0666 +zero:root:root:0666 + +# misc devices +nvram:root:root:0660 +rtc:root:root:0660 + +# floppy devices +fd[01]*:root:floppy:0660 + +# audio devices +dsp*:root:root:0660 +audio*:root:root:0660 +midi*:root:root:0660 +mixer*:root:root:0660 +sequencer*:root:root:0660 +sound/*:root:root:0660 +snd/*:root:root:0660 +beep:root:root:0660 +admm*:root:root:0660 +adsp*:root:root:0660 +aload*:root:root:0660 +amidi*:root:root:0660 +dmfm*:root:root:0660 +dmmidi*:root:root:0660 +sndstat:root:root:0660 + +# optical devices +sr*:root:disk:660 +scd*:root:disk:660 +pcd*:root:disk:0660 +disk*:root:disk:0660 +dvd:root:disk:0660 +rdvd:root:disk:0660 +cdroms/*:root:disk:0660 + +# pilot/palm devices +pilot:root:uucp:0660 + +# jaz devices +jaz*:root:disk:0660 + +# zip devices +pocketzip*:root:disk:0660 +zip*:root:disk:0660 + +# ls120 devices +ls120:root:disk:0660 +ls120*:root:disk:0660 + +# lp devices +lp*:root:lp:0660 +parport*:root:lp:0660 +irlpt*:root:lp:0660 +usblp*:root:lp:0660 +usb/lp*:root:lp:0660 + +# scanner devices +scanner:root:root:0600 +usb/scanner*:root:root:0600 + +# camera devices +camera*:root:root:0600 +usb/dc2xx*:root:root:0600 +usb/mdc800*:root:root:0600 + +# raw devices +ram*:root:disk:660 +raw/*:root:disk:660 + +# disk devices +hd*:root:disk:660 +sd*:root:disk:660 +dasd*:root:disk:660 +ataraid*:root:disk:660 +loop*:root:disk:660 +md*:root:disk:660 +ide/*/*/*/*/*:root:disk:660 +discs/*/*:root:disk:660 +loop/*:root:disk:660 +md/*:root:disk:660 + +# tape devices +ht*:root:disk:0660 +nht*:root:disk:0660 +pt[0-9]*:root:disk:0660 +npt*:root:disk:0660 +st*:root:disk:0660 +nst*:root:disk:0660 + +# dm devices +dm-*:root:root:0640 + +# memstick devices +memstick*:root:root:0600 + +# flash devices +flash*:root:root:0600 + +# diskonkey devices +diskonkey*:root:disk:0660 + +# rem_ide devices +microdrive*:root:disk:0660 + +# fb devices +fb:root:root:0600 +fb[0-9]*:root:root:0600 +fb/*:root:root:0600 + +# kbd devices +kbd:root:root:0644 + +# joystick devices +js[0-9]*:root:root:0644 +djs[0-9]*:root:root:0644 + +# v4l devices +video*:root:root:0660 +radio*:root:root:0660 +winradio*:root:root:0660 +vtx*:root:root:0660 +vbi*:root:root:0660 +video/*:root:root:0660 +vttuner:root:root:0660 +v4l/*:root:root:0660 + +# input devices +input/*:root:root:644 + +# gpm devices +gpmctl:root:root:0700 + +# dri devices +nvidia*:root:root:0660 +3dfx*:root:root:0660 +dri/*:root:root:0660 + +# mainboard devices +apm_bios:root:root:0600 + +# scsi devices +sg*:root:disk:0660 +pg*:root:disk:0660 +cdwriter:root:disk:0660 + +# usb devices +usb/dabusb*:root:usb:0660 +usb/mdc800*:root:usb:0660 +usb/rio500:root:usb:0660 + diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules new file mode 100644 index 0000000000..0a43358bad --- /dev/null +++ b/etc/udev/redhat/udev.rules @@ -0,0 +1,125 @@ +# /etc/udev/udev.rules: device naming rules for udev +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. + +########################################################### +# +# Add your own rules here (examples are commented) +# +########################################################### + +# Looking for scsi bus id 42:0:0:1 +#BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" + +# A usb camera. +#BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" + +# USB Epson printer to be called lp_epson +#BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" + +# USB HP printer to be called lp_hp +#BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" + +# sound card with PCI bus id 00:0b.0 to be the first sound card +#BUS="pci", ID="00:0b.0", NAME="dsp" + +# sound card with PCI bus id 00:07.1 to be the second sound card +#BUS="pci", ID="00:07.1", NAME="dsp1" + +# USB mouse plugged into the third port of the first hub to be called mouse0 +#BUS="usb", PLACE="1.3", NAME="mouse0" + +# USB tablet plugged into the third port of the second hub to be called mouse1 +#BUS="usb", PLACE="2.3", NAME="mouse1" +#BUS="usb", PLACE="2.4", NAME="mouse2" + +# ttyUSB1 should always be called visor +#KERNEL="ttyUSB1", NAME="visor" +#KERNEL="ttyUSB0", NAME="pl2303" + + +########################################################### +# +# For devfs similar /dev layout (neater) +# +########################################################### + +# devfs-names for ide-devices (uncomment only one) +# /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" + +# alsa devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + +# dm devices (ignore them) +KERNEL="dm-[0-9]*", NAME="" +KERNEL="device-mapper", NAME="mapper/control" + +# fb devices +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" + +# floppy devices +KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" + +# i2c devices +KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" + +# input devices +KERNEL="mice", NAME="input/mice" +KERNEL="mouse[0-9]*", NAME="input/mouse%n" +KERNEL="event[0-9]*", NAME="input/event%n" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + +# loop devices +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" + +# md block devices +KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" + +# misc devices +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" + +# pty devices +KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" + +# ramdisk devices +KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" + +# sound devices +KERNEL="adsp", NAME="sound/adsp" SYMLINK="%k" +KERNEL="audio", NAME="sound/audio", SYMLINK="%k" +KERNEL="dsp", NAME="sound/dsp", SYMLINK="%k" +KERNEL="mixer", NAME="sound/mixer", SYMLINK="%k" +KERNEL="sequencer", NAME="sound/sequencer", SYMLINK="%k" +KERNEL="sequencer2", NAME="sound/sequencer2", SYMLINK="%k" + +# tty devices +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" + +# vc devices +KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" +KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" +KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" + +# v4l devices +KERNEL="video[0-9]*", NAME="v4l/video%n" +KERNEL="radio[0-9]*", NAME="v4l/radio%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" + diff --git a/etc/udev/slackware/udev.permissions b/etc/udev/slackware/udev.permissions new file mode 100644 index 0000000000..2edc1aaa53 --- /dev/null +++ b/etc/udev/slackware/udev.permissions @@ -0,0 +1,133 @@ +#name:user:group:mode +pl2303:500:500:0666 +visor:root:uucp:0666 +camera*:500:500:0666 + +# console devices +console:root:tty:0600 +tty[0-9][0-9]*:root:tty:0666 +vcs*:root:tty:0620 +tty[CIS]*:root:uucp:0660 +ttyUB[0-9]:root:uucp:0660 +ttyUSB0:root:uucp:0660 +ttyUSB1:root:uucp:0666 + +# pty devices +ptmx:root:tty:0666 +pty[p-za-e][0-9a-f]*:root:tty:0666 +tty[p-za-e][0-9a-f]*:root:tty:0666 +cu[abiu]*:root:uucp:0660 + +# sound devices +audio*:root:sys:0662 +beep:root:root:0644 +dsp*:root:sys:0662 +midi*:root:sys:0662 +mixer*:root:sys:0666 +music:root:sys:0662 +sequencer*:root:sys:0662 +snd/*:root:root:0666 +sndstat:root:sys:0662 +speaker:root:root:0644 +sound/*:root:root:0666 +admmidi*:root:root:0666 +adsp*:root:root:0666 +aload*:root:root:0666 +amidi*:root:root:0666 +amixer*:root:root:0666 + +# input devices (mouse, joystick, etc) +input/*:root:root:0644 +input/js*:root:games:0666 +djs[0-3]:root:games:0660 +psaux:root:sys:0660 +crash:roor:root:0660 +logibm:root:sys:0660 +jbm:root:sys:0660 +hwtrap:root:root:0644 +inportbm:root:sys:0660 +sexec:root:root:0660 +jsflash:roo:root:0660 + +# power manager device +apm_bios:root:root:0644 + +# printer device +lp[0-9]:root:lp:0660 +parport*:root:root:0660 + +# video devices +dri/card[0-9]*:root:root:0666 +fb[0-9]:root:tty:0660 +agpgart:root:root:0660 +nvidia*:root:root:0666 +video*:root:sys:0660 + +# DISK devices +ed[ab]*:root:disk:0640 +gscd0:root:disk:0640 +initrd:root:disk:0640 +lmscd:root:disk:0640 +mcd*:root:disk:0640 +md*:root:disk:0660 +mtd*:root:disk:0640 +userdma:root:root:0660 + +# floppy devices +fd[0-3]*:root:floppy:0660 + +# IDE devices (hd, cdrom) +hd*:root:disk:0660 +ht0:root:disk:0640 + +# RAID IDE +ataraid[0-9]*:root:disk:0660 +ataraid/*:root:disk:0660 + +# SCSI devices +scsi/*/cd:root:disk:0660 +scsi/*:root:disk:0660 +sd[a-h]*:root:disk:0640 +s[rt][0-9]*:root:disk:0640 +scd*:root:disk:0660 + +# generic scsi devices +sg*:root:root:0600 + +# old CD-ROM +sbpcd*:root:disk:0640 + +# loop devices +loop[0-9]*:root:disk:0660 + +# network block devices +nb[0-7]:root:disk:0660 +nht0:root:disk:0640 +npt[0-3]:root:disk:0660 +n[qrs]*:root:disk:0640 + +# memory access devices +kmem:root:kmem:0640 +mem:root:kmem:0640 +null:root:sys:0666 +nvram:root:root:0640 +port:root:kmem:0640 +ram[0-9]*:root:disk:0640 +random:root:root:0644 +rtc:root:root:0444 +urandom:root:root:0644 +full:root:sys:0666 +zero:root:root:0664 +raw/*:root:disk:0660 +modreq:root:root:0644 +msr:root:root:0660 +profile*:root:root:0640 + +# ISDN devices +isdn*:root:tty:0660 + +# net devices +ippp*:root:root:0644 +ipstate:root:root:0660 +spx:root:root:0644 +fwmonitor:root:root:0660 diff --git a/etc/udev/udev.permissions.debian b/etc/udev/udev.permissions.debian deleted file mode 100644 index 6429519eec..0000000000 --- a/etc/udev/udev.permissions.debian +++ /dev/null @@ -1,121 +0,0 @@ -# name:user:group:mode - -# character devices - -ptmx:root:tty:0666 -random:root:root:0666 -urandom:root:root:0444 -kmem:root:kmem:0640 -mem:root:kmem:0640 -port:root:kmem:0640 -null:root:root:0666 -zero:root:root:0666 -full:root:root:0666 - -misc/nvram:root:nvram:660 -nvram:root:nvram:660 -misc/rtc:root:audio:0664 -rtc:root:audio:0664 - -tts/*:root:dialout:0660 -bluetooth/rfcomm/*:root:dialout:0660 -tty[BCDEFHILMPRSTUVWX][0-9]*:root:dialout:0660 -ttyS[ACIR][0-9]*:root:dialout:0660 -ttyUSB[0-9]*:root:dialout:0660 -ttyACM[0-9]*:root:dialout:0660 -ippp[0-9]*:root:dialout:0660 -isdn[0-9]*:root:dialout:0660 -isdnctrl[0-9]*:root:dialout:0660 -capi[0-9.]*:root:dialout:0660 -dcbri[0-9]*:root:dialout:0660 -ircomm[0-9]*:root:dialout:0660 -rfcomm[0-9]*:root:dialout:0660 -tty:root:tty:0666 - -snd/*:root:audio:0660 -sound/*:root:audio:0660 -admmidi*:root:audio:0660 -adsp*:root:audio:0660 -aload*:root:audio:0660 -amidi*:root:audio:0660 -amixer*:root:audio:0660 -audio*:root:audio:0660 -dmfm*:root:audio:0660 -dsp*:root:audio:0660 -audio*:root:audio:0660 -mixer*:root:audio:0660 -music:root:audio:0660 -sequencer*:root:audio:0660 - -printers/*:root:lp:0660 -usb/lp[0-9]*:root:lp:0660 -usb/legousbtower[0-9]*:root:root:666 -lp[0-9]*:root:lp:0660 -parport[0-9]*:root:lp:0660 -irlpt[0-9]*:root:lp:0660 -usblp[0-9]*:root:lp:0660 - -input/mice:root:root:0600 -input/mouse[0-9]*:root:root:0600 -input/js[0-9]*:root:root:0644 -input/*:root:root:0600 -mouse[0-9]*:root:root:0600 -js[0-9]*:root:root:0644 - -dri/card[0-9]*:root:video:0660 -fb/*:root:video:0660 -fb[0-9]*:root:video:0660 -agpgart:root:video:0660 -nvidia*:root:video:0660 - -v4l/*:root:video:0660 -video[0-9]*:root:video:0660 -radio[0-9]*:root:video:0660 -vbi[0-9]*:root:video:0660 -vtx[0-9]*:root:video:0660 -dvb/*:root:video:0660 - -# block devices - -floppy/*:root:floppy:0660 -fd[0-9]*:root:floppy:0660 -cdemu/*:root:cdrom:0660 -pktcdvd[0-9]*:root:cdrom:0660 - -ram[0-9]*:root:disk:0660 -raw/*:root:disk:0660 - -ide/*/cd:root:cdrom:0660 -ide/*:root:disk:0660 -hd[a-s]:root:disk:0660 -hd[a-s][0-9]*:root:disk:0660 - -scsi/*/cd:root:cdrom:0660 -scsi/*:root:disk:0660 -sd[a-z]:root:disk:0660 -sd[a-z][0-9]*:root:disk:0660 -sd[a-i][a-z]:root:disk:0660 -sd[a-i][a-z][0-9]*:root:disk:0660 -s[gr][0-9]*:root:disk:0660 -scd[0-9]*:root:cdrom:0660 - -dasd[0-9]*:root:disk:0660 -ataraid[0-9]*:root:disk:0660 - -loop/*:root:disk:0660 -loop[0-9]*:root:disk:0660 -md/*:root:disk:0660 -md[0-9]*:root:disk:0660 -dm-*:root:disk:0640 - -ht[0-9]*:root:tape:0660 -nht[0-9]*:root:tape:0660 -pt[0-9]*:root:tape:0660 -npt[0-9]*:root:tape:0660 -st[0-9]*:root:tape:0660 -nst[0-9]*:root:tape:0660 - -sgi_fetchop:root:root:666 -iseries/vcd*:root:disk:660 -iseries/vd*:root:disk:660 - diff --git a/etc/udev/udev.permissions.gentoo b/etc/udev/udev.permissions.gentoo deleted file mode 100644 index 51dd9f290e..0000000000 --- a/etc/udev/udev.permissions.gentoo +++ /dev/null @@ -1,205 +0,0 @@ -# /etc/udev/udev.permissions: permission/ownership map for udev -# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.permissions,v 1.3 2004/01/01 03:41:24 azarah Exp $ - -# console devices -console:root:tty:0600 -tty:root:tty:0666 -tty[0-9]*:root:tty:0660 -vc/[0-9]*:root:tty:0660 - -# pty devices -# Set this to 0660 if you only want users belonging to tty group -# to be able to allocate PTYs -ptmx:root:tty:0666 -pty[p-za-e][0-9a-f]*:root:tty:0660 -tty[p-za-e][0-9a-f]*:root:tty:0660 -pty/m*:root:tty:0660 -vc/s*:root:tty:0660 - -# serial+dialup devices -ttyS*:root:tty:0660 -ippp*:root:tty:0660 -isdn*:root:tty:0660 -isdnctrl*:root:tty:0660 -capi*:root:tty:0660 -dcbri*:root:tty:0660 -ircomm*:root:tty:0660 -ttyUSB*:root:usb:0660 -tts/[0-9]*:root:tty:0660 -tts/USB[0-9]*:root:usb:0660 - -# vc devices -vcs:root:root:0600 -vcs[0-9]*:root:root:0600 -vcsa:root:root:0600 -vcsa[0-9]*:root:root:0600 -vcc/*:root:root:0600 - -# memory devices -random:root:root:0666 -urandom:root:root:0444 -mem:root:kmem:0640 -kmem:root:kmem:0640 -port:root:kmem:0640 -full:root:root:0666 -null:root:root:0666 -zero:root:root:0666 - -# misc devices -misc/nvram:root:root:0660 -misc/rtc:root:root:0664 -misc/inotify:root:root:0666 - -# floppy devices -fd[01]*:root:floppy:0660 - -# audio devices -dsp*:root:audio:0660 -audio*:root:audio:0660 -midi*:root:audio:0660 -mixer*:root:audio:0660 -sequencer*:root:audio:0660 -sound/*:root:audio:0660 -snd/*:root:audio:0660 -beep:root:audio:0660 -admm*:root:audio:0660 -adsp*:root:audio:0660 -aload*:root:audio:0660 -amidi*:root:audio:0660 -dmfm*:root:audio:0660 -dmmidi*:root:audio:0660 -sndstat:root:audio:0660 - -# optical devices -sr*:root:cdrom:660 -scd*:root:cdrom:660 -pcd*:root:cdrom:0660 -cdrom*:root:cdrom:0660 -dvd:root:cdrom:0660 -rdvd:root:cdrom:0660 -cdroms/*:root:cdrom:0660 - -# pilot/palm devices -pilot:root:uucp:0660 - -# jaz devices -jaz*:root:disk:0660 - -# zip devices -pocketzip*:root:disk:0660 -zip*:root:disk:0660 - -# ls120 devices -ls120:root:disk:0660 -ls120*:root:disk:0660 - -# lp devices -lp*:root:lp:0660 -parport*:root:lp:0660 -irlpt*:root:lp:0660 -usblp*:root:lp:0660 -usb/lp*:root:lp:0660 - -# scanner devices -scanner:root:root:0600 -usb/scanner*:root:root:0600 - -# camera devices -camera*:root:root:0600 -usb/dc2xx*:root:root:0600 -usb/mdc800*:root:root:0600 - -# raw devices -ram*:root:disk:660 -raw/*:root:disk:660 - -# disk devices -hd*:root:disk:660 -sd*:root:disk:660 -dasd*:root:disk:660 -ataraid*:root:disk:660 -loop*:root:disk:660 -md*:root:disk:660 -ide/*/*/*/*/*:root:disk:660 -discs/*/*:root:disk:660 -loop/*:root:disk:660 -md/*:root:disk:660 - -# tape devices -ht*:root:tape:0660 -nht*:root:tape:0660 -pt[0-9]*:root:tape:0660 -npt*:root:tape:0660 -st*:root:tape:0660 -nst*:root:tape:0660 - -# dm devices -dm-*:root:root:0640 - -# memstick devices -memstick*:root:root:0600 - -# flash devices -flash*:root:root:0600 - -# diskonkey devices -diskonkey*:root:disk:0660 - -# rem_ide devices -microdrive*:root:disk:0660 - -# fb devices -fb:root:root:0600 -fb[0-9]*:root:root:0600 -fb/*:root:root:0600 - -# kbd devices -kbd:root:root:0644 - -# joystick devices -js[0-9]*:root:root:0644 -djs[0-9]*:root:root:0644 - -# v4l devices -video*:root:video:0660 -radio*:root:video:0660 -winradio*:root:video:0660 -vtx*:root:video:0660 -vbi*:root:video:0660 -video/*:root:video:0660 -vttuner:root:video:0660 -v4l/*:root:video:0660 - -# input devices -input/event*:root:root:600 -input/ts*:root:root:600 -input/*:root:root:644 - -# Sony Vaio Jogdial sonypi device -sonypi:root:root:0666 - -# gpm devices -gpmctl:root:root:0700 - -# dri devices -nvidia*:root:video:0660 -3dfx*:root:video:0660 -dri/*:root:video:0660 - -# mainboard devices -apm_bios:root:root:0600 - -# scsi devices -sg*:root:disk:0660 -pg*:root:disk:0660 -cdwriter:root:disk:0660 - -# usb devices -usb/dabusb*:root:usb:0660 -usb/mdc800*:root:usb:0660 -usb/rio500:root:usb:0660 -usb/legousbtower*:root:usb:0660 - -sgi_fetchop:root:root:666 -iseries/vcd*:root:disk:660 -iseries/vd*:root:disk:660 diff --git a/etc/udev/udev.permissions.redhat b/etc/udev/udev.permissions.redhat deleted file mode 100644 index c96663964f..0000000000 --- a/etc/udev/udev.permissions.redhat +++ /dev/null @@ -1,194 +0,0 @@ -# /etc/udev/udev.permissions: permission/ownership map for udev - -# console devices -console:root:root:0600 -tty[0-9][0-9]*:root:tty:0660 -vc/[0-9]*:root:tty:0660 - -# pty devices -# Set this to 0660 if you only want users belonging to tty group -# to be able to allocate PTYs -ptmx:root:tty:0666 -tty:root:tty:0666 -pty[p-za-e][0-9a-f]*:root:tty:0660 -tty[p-za-e][0-9a-f]*:root:tty:0660 -pty/m*:root:tty:0660 -vc/s*:root:tty:0660 - -# serial+dialup devices -ttyS*:root:uucp:0660 -ippp*:root:root:0660 -isdn*:root:root:0660 -isdnctrl*:root:root:0660 -capi*:root:root:0660 -dcbri*:root:root:0660 -ircomm*:root:uucp:0660 -ttyUSB*:root:uucp:0660 -tts/[0-9]*:root:uucp:0660 -tts/USB[0-9]*:root:uucp:0660 - -# vc devices -vcs:vcsa:tty:0600 -vcs[0-9]*:vcsa:tty:0600 -vcsa:vcsa:tty:0600 -vcsa[0-9]*:vcsa:tty:0600 -vcc/*:vcsa:tty:0600 - -# memory devices -random:root:root:0666 -urandom:root:root:0444 -mem:root:kmem:0640 -kmem:root:kmem:0640 -port:root:kmem:0640 -full:root:root:0666 -null:root:root:0666 -zero:root:root:0666 - -# misc devices -nvram:root:root:0660 -rtc:root:root:0660 - -# floppy devices -fd[01]*:root:floppy:0660 - -# audio devices -dsp*:root:root:0660 -audio*:root:root:0660 -midi*:root:root:0660 -mixer*:root:root:0660 -sequencer*:root:root:0660 -sound/*:root:root:0660 -snd/*:root:root:0660 -beep:root:root:0660 -admm*:root:root:0660 -adsp*:root:root:0660 -aload*:root:root:0660 -amidi*:root:root:0660 -dmfm*:root:root:0660 -dmmidi*:root:root:0660 -sndstat:root:root:0660 - -# optical devices -sr*:root:disk:660 -scd*:root:disk:660 -pcd*:root:disk:0660 -disk*:root:disk:0660 -dvd:root:disk:0660 -rdvd:root:disk:0660 -cdroms/*:root:disk:0660 - -# pilot/palm devices -pilot:root:uucp:0660 - -# jaz devices -jaz*:root:disk:0660 - -# zip devices -pocketzip*:root:disk:0660 -zip*:root:disk:0660 - -# ls120 devices -ls120:root:disk:0660 -ls120*:root:disk:0660 - -# lp devices -lp*:root:lp:0660 -parport*:root:lp:0660 -irlpt*:root:lp:0660 -usblp*:root:lp:0660 -usb/lp*:root:lp:0660 - -# scanner devices -scanner:root:root:0600 -usb/scanner*:root:root:0600 - -# camera devices -camera*:root:root:0600 -usb/dc2xx*:root:root:0600 -usb/mdc800*:root:root:0600 - -# raw devices -ram*:root:disk:660 -raw/*:root:disk:660 - -# disk devices -hd*:root:disk:660 -sd*:root:disk:660 -dasd*:root:disk:660 -ataraid*:root:disk:660 -loop*:root:disk:660 -md*:root:disk:660 -ide/*/*/*/*/*:root:disk:660 -discs/*/*:root:disk:660 -loop/*:root:disk:660 -md/*:root:disk:660 - -# tape devices -ht*:root:disk:0660 -nht*:root:disk:0660 -pt[0-9]*:root:disk:0660 -npt*:root:disk:0660 -st*:root:disk:0660 -nst*:root:disk:0660 - -# dm devices -dm-*:root:root:0640 - -# memstick devices -memstick*:root:root:0600 - -# flash devices -flash*:root:root:0600 - -# diskonkey devices -diskonkey*:root:disk:0660 - -# rem_ide devices -microdrive*:root:disk:0660 - -# fb devices -fb:root:root:0600 -fb[0-9]*:root:root:0600 -fb/*:root:root:0600 - -# kbd devices -kbd:root:root:0644 - -# joystick devices -js[0-9]*:root:root:0644 -djs[0-9]*:root:root:0644 - -# v4l devices -video*:root:root:0660 -radio*:root:root:0660 -winradio*:root:root:0660 -vtx*:root:root:0660 -vbi*:root:root:0660 -video/*:root:root:0660 -vttuner:root:root:0660 -v4l/*:root:root:0660 - -# input devices -input/*:root:root:644 - -# gpm devices -gpmctl:root:root:0700 - -# dri devices -nvidia*:root:root:0660 -3dfx*:root:root:0660 -dri/*:root:root:0660 - -# mainboard devices -apm_bios:root:root:0600 - -# scsi devices -sg*:root:disk:0660 -pg*:root:disk:0660 -cdwriter:root:disk:0660 - -# usb devices -usb/dabusb*:root:usb:0660 -usb/mdc800*:root:usb:0660 -usb/rio500:root:usb:0660 - diff --git a/etc/udev/udev.permissions.slackware b/etc/udev/udev.permissions.slackware deleted file mode 100644 index 2edc1aaa53..0000000000 --- a/etc/udev/udev.permissions.slackware +++ /dev/null @@ -1,133 +0,0 @@ -#name:user:group:mode -pl2303:500:500:0666 -visor:root:uucp:0666 -camera*:500:500:0666 - -# console devices -console:root:tty:0600 -tty[0-9][0-9]*:root:tty:0666 -vcs*:root:tty:0620 -tty[CIS]*:root:uucp:0660 -ttyUB[0-9]:root:uucp:0660 -ttyUSB0:root:uucp:0660 -ttyUSB1:root:uucp:0666 - -# pty devices -ptmx:root:tty:0666 -pty[p-za-e][0-9a-f]*:root:tty:0666 -tty[p-za-e][0-9a-f]*:root:tty:0666 -cu[abiu]*:root:uucp:0660 - -# sound devices -audio*:root:sys:0662 -beep:root:root:0644 -dsp*:root:sys:0662 -midi*:root:sys:0662 -mixer*:root:sys:0666 -music:root:sys:0662 -sequencer*:root:sys:0662 -snd/*:root:root:0666 -sndstat:root:sys:0662 -speaker:root:root:0644 -sound/*:root:root:0666 -admmidi*:root:root:0666 -adsp*:root:root:0666 -aload*:root:root:0666 -amidi*:root:root:0666 -amixer*:root:root:0666 - -# input devices (mouse, joystick, etc) -input/*:root:root:0644 -input/js*:root:games:0666 -djs[0-3]:root:games:0660 -psaux:root:sys:0660 -crash:roor:root:0660 -logibm:root:sys:0660 -jbm:root:sys:0660 -hwtrap:root:root:0644 -inportbm:root:sys:0660 -sexec:root:root:0660 -jsflash:roo:root:0660 - -# power manager device -apm_bios:root:root:0644 - -# printer device -lp[0-9]:root:lp:0660 -parport*:root:root:0660 - -# video devices -dri/card[0-9]*:root:root:0666 -fb[0-9]:root:tty:0660 -agpgart:root:root:0660 -nvidia*:root:root:0666 -video*:root:sys:0660 - -# DISK devices -ed[ab]*:root:disk:0640 -gscd0:root:disk:0640 -initrd:root:disk:0640 -lmscd:root:disk:0640 -mcd*:root:disk:0640 -md*:root:disk:0660 -mtd*:root:disk:0640 -userdma:root:root:0660 - -# floppy devices -fd[0-3]*:root:floppy:0660 - -# IDE devices (hd, cdrom) -hd*:root:disk:0660 -ht0:root:disk:0640 - -# RAID IDE -ataraid[0-9]*:root:disk:0660 -ataraid/*:root:disk:0660 - -# SCSI devices -scsi/*/cd:root:disk:0660 -scsi/*:root:disk:0660 -sd[a-h]*:root:disk:0640 -s[rt][0-9]*:root:disk:0640 -scd*:root:disk:0660 - -# generic scsi devices -sg*:root:root:0600 - -# old CD-ROM -sbpcd*:root:disk:0640 - -# loop devices -loop[0-9]*:root:disk:0660 - -# network block devices -nb[0-7]:root:disk:0660 -nht0:root:disk:0640 -npt[0-3]:root:disk:0660 -n[qrs]*:root:disk:0640 - -# memory access devices -kmem:root:kmem:0640 -mem:root:kmem:0640 -null:root:sys:0666 -nvram:root:root:0640 -port:root:kmem:0640 -ram[0-9]*:root:disk:0640 -random:root:root:0644 -rtc:root:root:0444 -urandom:root:root:0644 -full:root:sys:0666 -zero:root:root:0664 -raw/*:root:disk:0660 -modreq:root:root:0644 -msr:root:root:0660 -profile*:root:root:0640 - -# ISDN devices -isdn*:root:tty:0660 - -# net devices -ippp*:root:root:0644 -ipstate:root:root:0660 -spx:root:root:0644 -fwmonitor:root:root:0660 diff --git a/etc/udev/udev.rules.debian b/etc/udev/udev.rules.debian deleted file mode 100644 index 65a89ae593..0000000000 --- a/etc/udev/udev.rules.debian +++ /dev/null @@ -1,79 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some -# of the different fields. They provide the following subsitutions: -# -# %n the "kernel number" of the device. -# For example, 'sda3' has a "kernel number" of '3' -# %e the smallest number for that name which does not matches an existing node -# %k the kernel name for the device. -# %M the kernel major number for the device -# %m the kernel minor number for the device -# %b the bus id for the device -# %c the string returned by the PROGRAM -# %s{filename} the content of a sysfs attribute. -# %% the '%' char itself. -# - -# permissions for IDE CD devices -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", MODE="0660", GROUP="cdrom" - -# permissions for IDE floppy devices -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", NAME="%k", MODE="0660", GROUP="floppy" - -# permissions for SCSI CD devices -BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5", NAME="scd%n", MODE="0660", GROUP="cdrom", SYMLINK="sr%n" -BUS="scsi", KERNEL="sg[0-9]*", SYSFS{type}="5", NAME="%k", MODE="0660", GROUP="cdrom" - - -# USB devices -BUS="usb", KERNEL="hiddev*", NAME="usb/%k" -BUS="usb", KERNEL="auer*", NAME="usb/%k" -BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" -BUS="usb", KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" -BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" - -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" - -KERNEL="card*", NAME="dri/card%n" -KERNEL="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL="pktcdvd", NAME="pktcdvd/control" -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL="microcode", NAME="cpu/microcode" - -# ALSA devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hwC[D0-9]*", NAME="snd/%k" -KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL="midiC[D0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" - -# input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse[0-9]*", NAME="input/%k" -KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", MODE="0664", GROUP="video" -KERNEL="event[0-9]*", NAME="input/%k" -KERNEL="js[0-9]*", NAME="input/%k" -KERNEL="ts[0-9]*", NAME="input/%k" -KERNEL="uinput", NAME="input/%k" - -KERNEL="tap[0-9]*", NAME="net/%k" -KERNEL="tun", NAME="net/%k" - -# CAPI devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi[0-9]*", NAME="capi/%n" - -# Zaptel -KERNEL="zapctl", NAME="zap/ctl" -KERNEL="zaptimer", NAME="zap/timer" -KERNEL="zapchannel", NAME="zap/channel" -KERNEL="zappseudo", NAME="zap/pseudo" -KERNEL="zap[0-9]*", NAME="zap/%n" - -# device mapper creates its own device nodes, so ignore these -KERNEL="dm-[0-9]*", NAME="" -KERNEL="device-mapper", NAME="mapper/control" - diff --git a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo deleted file mode 100644 index 6a53e88d9d..0000000000 --- a/etc/udev/udev.rules.gentoo +++ /dev/null @@ -1,149 +0,0 @@ -# /etc/udev/udev.rules: device naming rules for udev -# -# Gentoo specific rules, based a bit on devfs rules, but much simpler. -# -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. - - -########################################################### -# -# For devfs similar /dev layout (neater) -# -########################################################### - -# cdrom symlinks and other good cdrom naming -BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" - -# devfs-names for ide-devices (uncomment only one) -# /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" - -# dri devices -KERNEL="card*", NAME="dri/card%n" - -# alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midiC[D0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" - -# capi devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi*", NAME="capi/%n" - -# cpu devices -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL="microcode", NAME="cpu/microcode" - -# dm devices (ignore them) -KERNEL="dm-[0-9]*", NAME="" -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" -KERNEL="device-mapper", NAME="mapper/control" - -# fb devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" - -# floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" - -# i2c devices -KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" - -# input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse*", NAME="input/%k" -KERNEL="event*", NAME="input/%k" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" - -# loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" - -# md block devices -KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" - -# misc devices -KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" -KERNEL="inotify", NAME="misc/%k", SYMLINK="%k" - -# netlink devices -KERNEL="route", NAME="netlink/%k" -KERNEL="skip", NAME="netlink/%k" -KERNEL="usersock", NAME="netlink/%k" -KERNEL="fwmonitor", NAME="netlink/%k" -KERNEL="tcpdiag", NAME="netlink/%k" -KERNEL="nflog", NAME="netlink/%k" -KERNEL="xfrm", NAME="netlink/%k" -KERNEL="arpd", NAME="netlink/%k" -KERNEL="route6", NAME="netlink/%k" -KERNEL="ip6_fw", NAME="netlink/%k" -KERNEL="dnrtmsg", NAME="netlink/%k" -KERNEL="tap*", NAME="netlink/%k" - -# network devices -KERNEL="tun", NAME="net/%k" - -# pty devices -KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k" - -# ramdisk devices -KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" - -# raw devices -KERNEL="raw[0-9]*", NAME="raw/%k" - -# sound devices -KERNEL="adsp", NAME="sound/%k", SYMLINK="%k" -KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="audio", NAME="sound/%k", SYMLINK="%k" -KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="dsp", NAME="sound/%k", SYMLINK="%k" -KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="mixer", NAME="sound/%k", SYMLINK="%k" -KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k" -KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k" - -# tty devices -KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" -KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" - -# usb devices -KERNEL="hiddev*", NAME="usb/%k" -KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k" -KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" - -# vc devices -KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" -KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" -KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" - -# v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n" -KERNEL="radio[0-9]*", NAME="v4l/radio%n" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" - -# Asterix Zaptel devices -KERNEL="zapctl", NAME="zap/ctl" -KERNEL="zaptimer", NAME="zap/timer" -KERNEL="zapchannel", NAME="zap/channel" -KERNEL="zappseudo", NAME="zap/pseudo" -KERNEL="zap[0-9]*", NAME="zap/%n" - diff --git a/etc/udev/udev.rules.redhat b/etc/udev/udev.rules.redhat deleted file mode 100644 index 0a43358bad..0000000000 --- a/etc/udev/udev.rules.redhat +++ /dev/null @@ -1,125 +0,0 @@ -# /etc/udev/udev.rules: device naming rules for udev -# -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. - -########################################################### -# -# Add your own rules here (examples are commented) -# -########################################################### - -# Looking for scsi bus id 42:0:0:1 -#BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" - -# A usb camera. -#BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" - -# USB Epson printer to be called lp_epson -#BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" - -# USB HP printer to be called lp_hp -#BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" - -# sound card with PCI bus id 00:0b.0 to be the first sound card -#BUS="pci", ID="00:0b.0", NAME="dsp" - -# sound card with PCI bus id 00:07.1 to be the second sound card -#BUS="pci", ID="00:07.1", NAME="dsp1" - -# USB mouse plugged into the third port of the first hub to be called mouse0 -#BUS="usb", PLACE="1.3", NAME="mouse0" - -# USB tablet plugged into the third port of the second hub to be called mouse1 -#BUS="usb", PLACE="2.3", NAME="mouse1" -#BUS="usb", PLACE="2.4", NAME="mouse2" - -# ttyUSB1 should always be called visor -#KERNEL="ttyUSB1", NAME="visor" -#KERNEL="ttyUSB0", NAME="pl2303" - - -########################################################### -# -# For devfs similar /dev layout (neater) -# -########################################################### - -# devfs-names for ide-devices (uncomment only one) -# /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" - -# alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" - -# dm devices (ignore them) -KERNEL="dm-[0-9]*", NAME="" -KERNEL="device-mapper", NAME="mapper/control" - -# fb devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" - -# floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" - -# i2c devices -KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" - -# input devices -KERNEL="mice", NAME="input/mice" -KERNEL="mouse[0-9]*", NAME="input/mouse%n" -KERNEL="event[0-9]*", NAME="input/event%n" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" - -# loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" - -# md block devices -KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" - -# misc devices -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" - -# pty devices -KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" - -# ramdisk devices -KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" - -# sound devices -KERNEL="adsp", NAME="sound/adsp" SYMLINK="%k" -KERNEL="audio", NAME="sound/audio", SYMLINK="%k" -KERNEL="dsp", NAME="sound/dsp", SYMLINK="%k" -KERNEL="mixer", NAME="sound/mixer", SYMLINK="%k" -KERNEL="sequencer", NAME="sound/sequencer", SYMLINK="%k" -KERNEL="sequencer2", NAME="sound/sequencer2", SYMLINK="%k" - -# tty devices -KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" -KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" - -# vc devices -KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" -KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" -KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" - -# v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n" -KERNEL="radio[0-9]*", NAME="v4l/radio%n" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" - -- cgit v1.2.3-54-g00ecf From 06ed11be3ea3f7343ab8b027c121496f2075d3e8 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 8 Dec 2004 17:09:40 -0800 Subject: [PATCH] add more debian rules files. --- etc/udev/debian/cd-aliases.rules | 11 +++ etc/udev/debian/compat.rules | 37 ++++++++++ etc/udev/debian/devfs.rules | 126 ++++++++++++++++++++++++++++++++ etc/udev/debian/simple-cd-aliases.rules | 5 ++ 4 files changed, 179 insertions(+) create mode 100644 etc/udev/debian/cd-aliases.rules create mode 100644 etc/udev/debian/compat.rules create mode 100644 etc/udev/debian/devfs.rules create mode 100644 etc/udev/debian/simple-cd-aliases.rules diff --git a/etc/udev/debian/cd-aliases.rules b/etc/udev/debian/cd-aliases.rules new file mode 100644 index 0000000000..7137527628 --- /dev/null +++ b/etc/udev/debian/cd-aliases.rules @@ -0,0 +1,11 @@ +# These rules create the /dev/{cdrom,dvd,...} symlinks. Also see the +# /etc/udev/cdsymlinks.conf config file. +# +# If you would like to statically configure the aliases instead, you can +# use rules like: +# BUS="ide", ID="1.0", SYMLINK="cdrom" + +BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS="ide", KERNEL="pcd[0-9]*", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" + diff --git a/etc/udev/debian/compat.rules b/etc/udev/debian/compat.rules new file mode 100644 index 0000000000..ec386ea8c4 --- /dev/null +++ b/etc/udev/debian/compat.rules @@ -0,0 +1,37 @@ +# compatibility links for a devfs-style /dev + +KERNEL="md[0-9]*", SYMLINK="%k" +#KERNEL="loop[0-9]*", SYMLINK="%k" + +#KERNEL="tty[0-9]*", SYMLINK="%k" +#KERNEL="ttyS[0-9]*", SYMLINK="%k" +#KERNEL="ttyUSB[0-9]*", SYMLINK="%k" + +#KERNEL="vcs", SYMLINK="%k" +#KERNEL="vcs[0-9]*", SYMLINK="%k" +#KERNEL="vcsa", SYMLINK="%k" +#KERNEL="vcsa[0-9]*", SYMLINK="%k" + +KERNEL="video0", SYMLINK="%k" +KERNEL="radio0", SYMLINK="%k" +KERNEL="vbi0", SYMLINK="%k" +KERNEL="vtx0", SYMLINK="%k" + +KERNEL="apm_bios", SYMLINK="%k" +KERNEL="agpgart", SYMLINK="%k" +#KERNEL="psaux", SYMLINK="%k" +#KERNEL="nvram", SYMLINK="%k" +KERNEL="rtc", SYMLINK="%k" +#KERNEL="ram[0-9]*", SYMLINK="%k" + +#KERNEL="i2c-[0-9]*", SYMLINK="%k" +#KERNEL="lp[0-9]*", SYMLINK="%k" + +KERNEL="audio" SYMLINK="%k" +KERNEL="dsp" SYMLINK="%k" +KERNEL="mixer" SYMLINK="%k" + +#KERNEL="fb[0-9]*", SYMLINK="%k" +#KERNEL="fd[0-9]*", SYMLINK="%k" +#KERNEL="js[0-9]*", SYMLINK="%k" + diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules new file mode 100644 index 0000000000..8d305cd657 --- /dev/null +++ b/etc/udev/debian/devfs.rules @@ -0,0 +1,126 @@ +# There are a number of modifiers that are allowed to be used in some +# of the different fields. They provide the following subsitutions: +# +# %n the "kernel number" of the device. +# For example, 'sda3' has a "kernel number" of '3' +# %e the smallest number for that name which does not matches an existing node +# %k the kernel name for the device. +# %M the kernel major number for the device +# %m the kernel minor number for the device +# %b the bus id for the device +# %c the string returned by the PROGRAM +# %s{filename} the content of a sysfs attribute. +# %% the '%' char itself. +# + +# IDE block devices +BUS="ide", KERNEL="hd[a-z]*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" + +# permissions for SCSI CD devices +BUS="scsi", KERNEL="s[grt][0-9]*", SYSFS{type}="5", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}", MODE="0660", GROUP="cdrom" + +# SCSI block devices +BUS="scsi", KERNEL="sd[a-z]", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="sd[a-z][0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="sd[a-i][a-z]", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="sd[a-i][a-z][0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="s[grt][0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="st[0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="nst[0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" + +# USB devices +BUS="usb", KERNEL="hiddev*", NAME="usb/%k" +BUS="usb", KERNEL="auer*", NAME="usb/%k" +BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" +BUS="usb", KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" +BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" + +# block devices +KERNEL="md[0-9]*", NAME="md/%n", +KERNEL="loop[0-9]*", NAME="loop/%n" + +# tty devices +KERNEL="tty[0-9]*", NAME="vc/%n" +KERNEL="ttyS[0-9]*", NAME="tts/%n" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" +KERNEL="rfcomm[0-9]*", NAME="bluetooth/rfcomm/%n" + +# vc devices +KERNEL="vcs", NAME="vcc/0" +KERNEL="vcs[0-9]*", NAME="vcc/%n" +KERNEL="vcsa", NAME="vcc/a0" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n" +KERNEL="fb[0-9]*", NAME="fb/%n", + +# v4l devices +KERNEL="video[0-9]*", NAME="v4l/video%n" +KERNEL="radio[0-9]*", NAME="v4l/radio%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" + +# misc devices +KERNEL="apm_bios", NAME="misc/apm_bios", +KERNEL="agpgart", NAME="misc/agpgart", +KERNEL="nvram", NAME="misc/nvram" +KERNEL="psaux", NAME="misc/psaux" +KERNEL="rtc", NAME="misc/rtc" + +KERNEL="card[0-9]*", NAME="dri/card%n" +KERNEL="i2c-[0-9]*", NAME="i2c/%n" +KERNEL="ram[0-9]*", NAME="rd/%n" +KERNEL="lp[0-9]*", NAME="printers/%n" +KERNEL="fd[0-9]*", NAME="floppy/%n", +KERNEL="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL="pktcdvd", NAME="pktcdvd/control" +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL="microcode", NAME="cpu/microcode" + +# sound devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hwC[D0-9]*", NAME="snd/%k" +KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL="midiC[D0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" +KERNEL="audio*", NAME="sound/%k" +KERNEL="dsp*", NAME="sound/%k" +KERNEL="adsp*", NAME="sound/%k" +KERNEL="midi*", NAME="sound/%k" +KERNEL="mixer*", NAME="sound/%k" +KERNEL="sequencer*", NAME="sound/%k" +KERNEL="amidi*", NAME="sound/%k" +KERNEL="dmmidi*", NAME="sound/%k" +KERNEL="admmidi*", NAME="sound/%k" + +# input devices +KERNEL="mice", NAME="input/%k" +KERNEL="mouse[0-9]*", NAME="input/%k" +KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", MODE="0664", GROUP="video" +KERNEL="event[0-9]*", NAME="input/%k" +KERNEL="js[0-9]*", NAME="input/%k" +KERNEL="ts[0-9]*", NAME="input/%k" +KERNEL="uinput", NAME="input/%k" + +KERNEL="tap[0-9]*", NAME="net/%k" +KERNEL="tun", NAME="net/%k" + +# CAPI devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi[0-9]*", NAME="capi/%n" + +# Zaptel +KERNEL="zapctl", NAME="zap/ctl" +KERNEL="zaptimer", NAME="zap/timer" +KERNEL="zapchannel", NAME="zap/channel" +KERNEL="zappseudo", NAME="zap/pseudo" +KERNEL="zap[0-9]*", NAME="zap/%n" + +# device mapper creates its own device nodes, so ignore these +KERNEL="dm-[0-9]*", NAME="" +KERNEL="device-mapper", NAME="mapper/control" + diff --git a/etc/udev/debian/simple-cd-aliases.rules b/etc/udev/debian/simple-cd-aliases.rules new file mode 100644 index 0000000000..bd700bc29f --- /dev/null +++ b/etc/udev/debian/simple-cd-aliases.rules @@ -0,0 +1,5 @@ +# grouping of optical drives from multiple kernel subsystems +BUS="scsi", KERNEL="sr[0-9]*", SYMLINK="cdrom%e" +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", SYMLINK="cdrom%e", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom" +BUS="ide", KERNEL="pcd[0-9]*", SYSFS{removable}="1", SYMLINK="cdrom%e" + -- cgit v1.2.3-54-g00ecf From 6fbecf3547a02be2475f275d6862ed9dcfcce2fe Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 8 Dec 2004 18:29:04 -0800 Subject: [PATCH] 047 release --- ChangeLog | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 67 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6319845aa7..84c4ffab3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,68 @@ +Summary of changes from v046 to v047 +============================================ + +: + o Various typos and other litte errors in udev.8.in + +: + o DEVNAME on device removal + +: + o Allow GROUP to have modifiers in it + +Greg Kroah-Hartman: + o add more debian rules files + o move distro specific config files into their own directories + o update debian rules files + o added asterix rules to the gentoo file + o use udevstart for udev.init.* files + o delete a bunch of files no longer needed + o fix gentoo scsi cdrom rule + o Fix the multithreaded build again + o merge + o comment out ability to run udev-test.pl with valgrind + o fix spurious valgrind warning in udev + o fix udevinfo '-q path' option as it was not working + o merge + o fix parallel build error + +Kay Sievers: + o update Fedora dev.d/ example and remove unused conf.d/ directory + o don't install distribution specific init script on "make install" + o restore OWNER/GROUP assignment in rule coming from RESULT + o make gcov compile scripts working with recent gcc + o fix udev-test/udev-test.pl to work with again + o add net/atml and class/ppdev to the wait_for_sysfs exception list + o add net/nlv* devices to the exception list + o add "pcmcia" and "fc_transport" to the wait_for_sysfs lists + o remove unused timestamp field + o simplify permission handling + o handle /etc/hotplug.d/ only if the event comes from udevd + o trivial cleanups and change some comments + o remove unused variables + o udevsend/udevd handle events without a subsystem + o use blacklist on device "remove" and remove dev.d/ call code duplication + o update the man pages and correct Usage: hints + o don't call the hotplug scripts with a test run + o don't call dev.d/ scripts twice, if directory = subsystem + o remove archive file if we changed something + o link archive insted of objects + o rename udev_lib to udev_utils and dev_d to udev_multiplex + o handle whole hotplug event with udevd/udev + o integrate wait_for_sysfs in udev + o make the searched multiplex directories conditionally + o add MANAGED_EVENT to the forked udev environment + o export DEVNAME on remove event + o export udev_log flag to the environment + o remove my test code + o add support for /devices-devices without any file to wait for + o Patch from Alex Riesen + o add a bunch of busses to the list of what to wait for + o close connection to syslog in forked udevd child + o udevd exit path cleanup + o fix network device naming bug + + Summary of changes from v045 to v046 ============================================ diff --git a/Makefile b/Makefile index 1fe5c23f58..942c8ccb19 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 046 +VERSION = 047 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 05cee524c0..05cd4933b7 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 046 +Version: 047 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 09f275607119e848be4888518a6a3fcd58a32c6d Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 8 Dec 2004 19:30:41 -0800 Subject: [PATCH] fix scsi_id build errors due to changes in the main udev makefile also fixed up the QUIET issue when it was disabled for the extras programs --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 942c8ccb19..7d4396b9ed 100644 --- a/Makefile +++ b/Makefile @@ -183,7 +183,7 @@ all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(GEN_CONFIGS) LD="$(LD)" \ SYSFS="$(SYSFS)" \ KERNEL_DIR="$(KERNEL_DIR)" \ - QUIET="@$(PWD)/ccdv" \ + QUIET="$(QUIET)" \ -C $$target $@ ; \ done ; \ @@ -231,6 +231,8 @@ OBJS = \ libsysfs/sysfs.a \ udev.a +SYSFS = $(PWD)/libsysfs/sysfs.a + ifeq ($(strip $(USE_KLIBC)),true) HEADERS += \ klibc_fixups/klibc_fixups.h \ @@ -244,7 +246,7 @@ ifeq ($(strip $(USE_KLIBC)),true) endif ifeq ($(strip $(V)),false) - QUIET=@./ccdv + QUIET=@$(PWD)/ccdv HOST_PROGS=ccdv else QUIET= -- cgit v1.2.3-54-g00ecf From c93053663f2287b32549851f55798219b9b2d8d7 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 8 Dec 2004 19:35:29 -0800 Subject: [PATCH] fix udev_volume_id so it will now build properly. --- extras/volume_id/udev_volume_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 5d1ccf6a89..9e8c3bfb11 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -29,7 +29,7 @@ #include #include "../../libsysfs/sysfs/libsysfs.h" -#include "../../udev_lib.h" +#include "../../udev_utils.h" #include "../../logging.h" #include "volume_id.h" #include "dasdlabel.h" -- cgit v1.2.3-54-g00ecf From 7d92b28f3971f1d80a85964c1bbde6146e411379 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 8 Dec 2004 19:42:47 -0800 Subject: [PATCH] 048 release --- ChangeLog | 8 ++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84c4ffab3a..6ac004fd4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Summary of changes from v047 to v048 +============================================ + +Greg Kroah-Hartman: + o fix udev_volume_id so it will now build properly + o fix scsi_id build errors due to changes in the main udev makefile + + Summary of changes from v046 to v047 ============================================ diff --git a/Makefile b/Makefile index 7d4396b9ed..01ebcc22b5 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 047 +VERSION = 048 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 05cd4933b7..56ca479113 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 047 +Version: 048 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From c2fe814e305aaede3b03cfa2e86f1a317e1a66c4 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 9 Dec 2004 06:06:17 +0100 Subject: [PATCH] udev_volume_id: links sysfs.a instead of all objects cuts down the size from: dynamically linked: 48.030 -> 45.187 statically linked: 149.177 -> 142.362 --- extras/volume_id/Makefile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 8605811cf5..5c8adb065b 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -33,16 +33,6 @@ override CFLAGS+=-Wall -fno-builtin -Wchar-subscripts \ override CFLAGS+=-D_FILE_OFFSET_BITS=64 -override SYSFS = ../../libsysfs/sysfs_bus.o \ - ../../libsysfs/sysfs_class.o \ - ../../libsysfs/sysfs_device.o \ - ../../libsysfs/sysfs_dir.o \ - ../../libsysfs/sysfs_driver.o \ - ../../libsysfs/sysfs_utils.o \ - ../../libsysfs/dlist.o - - - OBJS = volume_id.o udev_volume_id.o dasdlabel.o $(SYSFS) HEADERS = volume_id.h dasdlabel.h -- cgit v1.2.3-54-g00ecf From 0dfbe9451b47cfa0464f5d3ba232ceccf26ae189 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 11 Dec 2004 06:07:31 +0100 Subject: [PATCH] add a class/fc_host file to the list of what to wait for --- udev_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 5f7c63d31d..ac8e4c1060 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -52,6 +52,7 @@ static const struct subsystem_file { { .subsystem = "ieee1394_host", .file = NULL }, { .subsystem = "ieee1394_node", .file = NULL }, { .subsystem = "fc_transport", .file = "port_id" }, + { .subsystem = "fc_host", .file = "port_id" }, { NULL, NULL } }; -- cgit v1.2.3-54-g00ecf From 79721e0a7770b1a5874ef96cbf93a4c6bd19e138 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 11 Dec 2004 21:43:08 +0100 Subject: [PATCH] udevd: serialization of the event sequence of a chain of devices Currently udevd delays only events for the same DEVPATH. Example of an "add" event sequence: /block/sda /block/sda/sda1 With this change, we make sure, that the udev process handling /block/sda has finished its work (waited for all attributes, created the node) before we fork the udev event for /block/sda/sda1. This way the event for sda1 can be sure, that the node for the main device is already created (may be useful for disk labels). It will not affect any parallel device handling, only the sequence of the devices directory chain is serialized. The 10.000 disks plugged in will still run as parallel events. :) The main motivation to do this is the program execution of the dev.d/ and hotplug.d/ directory. If we don't wait for the parent event to exit, we can't be sure that the executed scripts are run in the right order. On Thu, Dec 09, 2004 at 09:18:28AM +0100, Kay Sievers wrote: > On Wed, 2004-12-08 at 19:07 -0800, David Brownell wrote: > > Could that argument apply to the underlying hardware, too? > We now make sure that the sequence of events for a device > is serialized for every device chain and the class/block > devices which have a "device" link to a physical device are > handled after the physical device is fully populated and > notified to userspace. It will only work this way on kernels > later than 2.6.10-rc1 cause it depends on the PHYSDEVPATH > value in the hotplug environment. --- udevd.8 | 2 -- udevd.c | 33 +++++++++++++++++++++++++++------ udevd.h | 1 + 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/udevd.8 b/udevd.8 index 1a5940fef5..b06a2b7af1 100644 --- a/udevd.8 +++ b/udevd.8 @@ -28,8 +28,6 @@ running for a single device at the same time. .B udevd receives the events from .B udevsend -which is called by -.BR hotplug (8). If .B udevd isn't already running, diff --git a/udevd.c b/udevd.c index 58f5be94bc..2e6f5793d3 100644 --- a/udevd.c +++ b/udevd.c @@ -151,22 +151,40 @@ static void udev_run(struct hotplug_msg *msg) } } -/* returns already running task with devpath */ +/* returns still running task for the same event sequence */ static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) { struct hotplug_msg *loop_msg; + int i; + list_for_each_entry(loop_msg, &running_list, list) { if (loop_msg->devpath == NULL || msg->devpath == NULL) continue; - if (strcmp(loop_msg->devpath, msg->devpath) == 0) - return loop_msg; + /* is a parent or child device event still running */ + for (i = 0; i < DEVPATH_SIZE; i++) { + if (loop_msg->devpath[i] == '\0' || msg->devpath[i] == '\0') + return loop_msg; + + if (loop_msg->devpath[i] != msg->devpath[i]) + break; + } + + /* is the physical device event still running on an add sequence */ + if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) + for (i = 0; i < DEVPATH_SIZE; i++) { + if (loop_msg->devpath[i] == '\0' || msg->physdevpath[i] == '\0') + return loop_msg; + + if (loop_msg->devpath[i] != msg->physdevpath[i]) + break; + } } return NULL; } -/* exec queue management routine executes the events and delays events for the same devpath */ +/* exec queue management routine executes the events and serializes events in the same sequence */ static void exec_queue_manager(void) { struct hotplug_msg *loop_msg; @@ -181,8 +199,8 @@ static void exec_queue_manager(void) udev_run(loop_msg); dbg("moved seq %llu to running list", loop_msg->seqnum); } else { - dbg("delay seq %llu, cause seq %llu already working on '%s'", - loop_msg->seqnum, msg->seqnum, msg->devpath); + dbg("delay seq %llu (%s), cause seq %llu (%s) is still running", + loop_msg->seqnum, loop_msg->devpath, msg->seqnum, msg->devpath); } } } @@ -314,6 +332,9 @@ static void handle_udevsend_msg(int sock) if (strncmp(key, "SEQNUM=", 7) == 0) msg->seqnum = strtoull(&key[7], NULL, 10); + + if (strncmp(key, "PHYSDEVPATH=", 12) == 0) + msg->physdevpath = &key[12]; } msg->envp[i++] = "MANAGED_EVENT=1"; msg->envp[i] = NULL; diff --git a/udevd.h b/udevd.h index 31f07de826..1c4b1b88c2 100644 --- a/udevd.h +++ b/udevd.h @@ -47,6 +47,7 @@ struct hotplug_msg { char *devpath; char *subsystem; unsigned long long seqnum; + char *physdevpath; char *envp[HOTPLUG_NUM_ENVP+1]; char envbuf[]; }; -- cgit v1.2.3-54-g00ecf From 5ce120d366b54ea2bae12ec6ce01bb0d38ff1f50 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 12 Dec 2004 02:03:14 +0100 Subject: [PATCH] prevent udev node creatinon for "class" registration I've found a /dev/video4linux node and just realized, that libsysfs searches all subdirs for an attribute name. So it found /class/video4linux/video0/dev for the videodev class creation event /class/video4linux and created a node. Just ignore the SUBSYSTEM="class" events now. --- udev_sysfs.c | 1 + udevtest.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index ac8e4c1060..a4f293ef13 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -39,6 +39,7 @@ static const struct subsystem_file { const char *subsystem; const char *file; } subsystem_files[] = { + { .subsystem = "class", .file = NULL }, { .subsystem = "net", .file = "ifindex" }, { .subsystem = "scsi_host", .file = "unique_id" }, { .subsystem = "scsi_device", .file = NULL }, diff --git a/udevtest.c b/udevtest.c index 38e2bb7562..19cf9ec4f4 100644 --- a/udevtest.c +++ b/udevtest.c @@ -84,12 +84,6 @@ int main(int argc, char *argv[], char *envp[]) info("looking at '%s'", devpath); - /* we only care about class devices and block stuff */ - if (!strstr(devpath, "class") && !strstr(devpath, "block")) { - dbg("not a block or class device"); - return 2; - } - /* initialize the naming deamon */ namedev_init(); @@ -99,6 +93,12 @@ int main(int argc, char *argv[], char *envp[]) /* fill in values and test_run flag*/ udev_init_device(&udev, devpath, subsystem); + /* skip subsystems without "dev", but handle net devices */ + if (udev.type != 'n' && subsystem_expect_no_dev(udev.subsystem)) { + info("don't care about '%s' devices", udev.subsystem); + return 2; + } + /* open the device */ snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); class_dev = sysfs_open_class_device_path(path); @@ -107,7 +107,7 @@ int main(int argc, char *argv[], char *envp[]) return 1; } - dbg("opened class_dev->name='%s'", class_dev->name); + info("opened class_dev->name='%s'", class_dev->name); /* simulate node creation with test flag */ udev.test_run = 1; -- cgit v1.2.3-54-g00ecf From 51737eb8b8087d3d9c0cbad8caeaed9efde907fe Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 12 Dec 2004 02:27:50 +0100 Subject: [PATCH] add -V option to udev to print the version number On Sat, 2004-12-11 at 18:44 +0200, Martin Schlemmer [c] wrote: > > Any suggestions to determining the version of the installed udev? > This is now during startup, to see if we can make use of using > udevsend as hotplug agent. If the system was up, udevinfo could > be used, but that is in /usr/bin that might be on a seperate /usr. > I know we might move udevinfo to /bin, but that might be an issue > for some, and adding a -V switch to /sbin/udev might be a better > choice. --- udev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/udev.c b/udev.c index 507f2be943..b1ba1435e7 100644 --- a/udev.c +++ b/udev.c @@ -107,8 +107,14 @@ int main(int argc, char *argv[], char *envp[]) const char *devpath = getenv("DEVPATH"); const char *subsystem = argv[1]; - dbg("version %s", UDEV_VERSION); + if (argc == 2 && strcmp(argv[1], "-V") == 0) { + printf("%s\n", UDEV_VERSION); + exit(0); + } + logging_init("udev"); + dbg("version %s", UDEV_VERSION); + udev_init_config(); /* set signal handlers */ -- cgit v1.2.3-54-g00ecf From d7190b051391163187325a3d39d55893527270a4 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 12 Dec 2004 02:32:25 +0100 Subject: [PATCH] include missing header to udevtest.c --- udevtest.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevtest.c b/udevtest.c index 19cf9ec4f4..388818d495 100644 --- a/udevtest.c +++ b/udevtest.c @@ -29,6 +29,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" +#include "udev_sysfs.h" #include "udev_utils.h" #include "udev_version.h" #include "namedev.h" -- cgit v1.2.3-54-g00ecf From 8544c9ad4febef602d640905a70c350364f98967 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 12 Dec 2004 02:54:55 +0100 Subject: [PATCH] remove double initialization --- udev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev.c b/udev.c index b1ba1435e7..4d25ed267a 100644 --- a/udev.c +++ b/udev.c @@ -101,11 +101,11 @@ int main(int argc, char *argv[], char *envp[]) struct sysfs_device *devices_dev; struct udevice udev; char path[SYSFS_PATH_MAX]; - int retval = -EINVAL; const char *error; - const char *action = getenv("ACTION"); - const char *devpath = getenv("DEVPATH"); - const char *subsystem = argv[1]; + const char *action; + const char *devpath; + const char *subsystem; + int retval = -EINVAL; if (argc == 2 && strcmp(argv[1], "-V") == 0) { printf("%s\n", UDEV_VERSION); -- cgit v1.2.3-54-g00ecf From 7e0bd584756b87d57b3f3e62dcbac208476f1804 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 12 Dec 2004 03:29:59 +0100 Subject: [PATCH] check earlier if we should run as udevstart --- udev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/udev.c b/udev.c index 4d25ed267a..0ee70529c4 100644 --- a/udev.c +++ b/udev.c @@ -128,14 +128,6 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timeout to prevent hanging processes */ alarm(ALARM_TIMEOUT); - action = getenv("ACTION"); - devpath = getenv("DEVPATH"); - subsystem = getenv("SUBSYSTEM"); - /* older kernels passed the SUBSYSTEM only as argument */ - if (!subsystem && argc == 2) - subsystem = argv[1]; - udev_init_device(&udev, devpath, subsystem); - if (strstr(argv[0], "udevstart") || (argc == 2 && strstr(argv[1], "udevstart"))) { dbg("udevstart"); @@ -147,6 +139,14 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + action = getenv("ACTION"); + devpath = getenv("DEVPATH"); + subsystem = getenv("SUBSYSTEM"); + /* older kernels passed the SUBSYSTEM only as argument */ + if (!subsystem && argc == 2) + subsystem = argv[1]; + udev_init_device(&udev, devpath, subsystem); + if (!action) { dbg("no action"); goto hotplug; -- cgit v1.2.3-54-g00ecf From 98446db5533596fd4d32f5019479d37d9495f1a1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 12 Dec 2004 03:35:39 +0100 Subject: [PATCH] udevd-test.pl: remove wrong date calculation A hour wrap during the test run does not work :) Just remove all the useless date conversions as we are only interested in the seconds it takes to process. [root@pim udevd-test]# ./udevd-test.pl 9 ... device: /class/tty/console, action: remove forking udev time: Sat Dec 11 18:59:57 2004 the delay time is: 3 s device: /class/tty/ptmx, action: remove forking udev time: Sat Dec 11 19:00:07 2004 the delay time is: 4013 s the delay time is: 4013 udevd doesn't act properly. --- test/udevd-test/udev-log-amplify.pl | 32 ++------------ test/udevd-test/udev-log-script.pl | 32 ++------------ test/udevd-test/udevd-test.pl | 86 +++++++------------------------------ 3 files changed, 23 insertions(+), 127 deletions(-) diff --git a/test/udevd-test/udev-log-amplify.pl b/test/udevd-test/udev-log-amplify.pl index c2d4723974..9e2692ac0c 100644 --- a/test/udevd-test/udev-log-amplify.pl +++ b/test/udevd-test/udev-log-amplify.pl @@ -38,35 +38,11 @@ use strict; my $udev_exe_time = 5; my $log_file = "/tmp/udev_log.txt"; -# global variables -my $devpath; -my $action; -my $subsystem; - -# common functions -sub getDate { - # Get current date/time - # If we want GTM time, simply pass GMT as first argument to this function. - - my $format = @_; - my $date; - - if( $format =~ /GMT/i ) { - $date = gmtime() . " GMT"; - } else { - $date = localtime(); - } - return $date; -} - -# main program if ($ARGV[0]) { - $subsystem = $ARGV[0]; - $devpath = $ENV{DEVPATH}; - $action = $ENV{ACTION}; - - # Get current system date - my $time = getDate(); + my $subsystem = $ARGV[0]; + my $devpath = $ENV{DEVPATH}; + my $action = $ENV{ACTION}; + my $time = time(); # Logging if (open(LOGF, ">>$log_file")) { diff --git a/test/udevd-test/udev-log-script.pl b/test/udevd-test/udev-log-script.pl index 5f4f8a4495..5d7ca71181 100644 --- a/test/udevd-test/udev-log-script.pl +++ b/test/udevd-test/udev-log-script.pl @@ -36,35 +36,11 @@ use strict; # modifiable settings my $log_file = "/tmp/udev_log.txt"; -# global variables -my $devpath; -my $action; -my $subsystem; - -# common functions -sub getDate { - # Get current date/time - # If we want GTM time, simply pass GMT as first argument to this function. - my $format = @_; - my $date; - - if( $format =~ /GMT/i ) { - $date = gmtime() . " GMT"; - } else { - $date = localtime(); - } - return $date; -} - -# main program if ($ARGV[0]) { - # prepare - $subsystem = $ARGV[0]; - $devpath = $ENV{DEVPATH}; - $action = $ENV{ACTION}; - - # Get current system date - my $time = getDate(); + my $subsystem = $ARGV[0]; + my $devpath = $ENV{DEVPATH}; + my $action = $ENV{ACTION}; + my $time = time(); # Logging if (open(LOGF, ">>$log_file")) { diff --git a/test/udevd-test/udevd-test.pl b/test/udevd-test/udevd-test.pl index e81aadd938..2328de814f 100644 --- a/test/udevd-test/udevd-test.pl +++ b/test/udevd-test/udevd-test.pl @@ -85,62 +85,6 @@ sub udevsend { return system("$udevsend_bin $subsystem"); } -sub getDate { - # Get current date function - # If we want GTM time, simply pass GMT as first argument to this function. - - my $format = @_; - my $date; - - if( $format =~ /GMT/i ) { - $date = gmtime() . " GMT"; - } else { - $date = localtime(); - } - - return $date; -} - -sub cmpDate { - # This function should return a difference betweent date1 and date2 - - my ($date1, $date2) = @_; - my @monList = ( "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", - "Aug", "Sep", "Oct", "Nov", "Dec" ); - my ( $m1, $m2, $tmp ); - - $date1 =~ s/([\D]*)$//g; - $date2 =~ s/([\D]*)$//g; - - return if( (not $date1) or (not $date2) ); - - my $mon = 0; - - my ( @T1 ) = - ( $date1 =~ /([\d]+)[\s]+([\d]+):([\d]+):([\d]+)[\s]+([\d]+)/g ); - my ( @T2 ) = - ( $date2 =~ /([\d]+)[\s]+([\d]+):([\d]+):([\d]+)[\s]+([\d]+)/g ); - - foreach $tmp (@monList) { - $m1 = sprintf("%2.2d",$mon) if( $date1 =~ /$tmp/i ); - $m2 = sprintf("%2.2d",$mon) if( $date2 =~ /$tmp/i ); - $mon++; - } - - my $dt1 = sprintf("%4.4d%s%2.2d%2.2d%2.2d%2.2d", $T1[4], $m1, $T1[0], - $T1[1], $T1[2], $T1[3]); - my $dt2 = sprintf("%4.4d%s%2.2d%2.2d%2.2d%2.2d", $T2[4], $m2, $T2[0], - $T2[1], $T2[2], $T2[3]); - - my $ret = $dt1 - $dt2; - - if ( $ret > 40 ) { - $ret = abs($ret-40); - } - - return $ret; -} - sub check_count_and_time { my $event_recv_time; my $udev_fork_time; @@ -160,7 +104,7 @@ sub check_count_and_time { @line_items = split(/,/,$line); print " device: $line_items[0], action: $line_items[1] \n"; print " forking udev time: $line_items[-1]"; - $diff = cmpDate($line_items[-1], $event_recv_time); + $diff = $line_items[-1] - $event_recv_time; print " the delay time is: $diff s \n\n"; if ( $diff > $time_out+10 ) { print " the delay time is: $diff \n"; @@ -205,7 +149,7 @@ sub show_result { @line_items = split(/,/,$line); print " device: $line_items[0], action: $line_items[1] \n"; print " forking udev time: $line_items[-1]"; - $diff = cmpDate($line_items[-1], $event_recv_time); + $diff = $line_items[-1] - $event_recv_time; print " the delay time is: $diff s \n\n"; } close(LOGF); @@ -229,7 +173,7 @@ sub show_result_tm_out { @line_items = split(/,/,$line); print " device: $line_items[0], action: $line_items[1] \n"; print " forking udev time: $line_items[-1]"; - $diff = cmpDate($line_items[-1], $event_recv_time); + $diff = $line_items[-1] - $event_recv_time; print " the delay time is: $diff s \n\n"; if ( $diff < $time_out ) { print " the delay time is: $diff \n"; @@ -258,7 +202,7 @@ sub show_result_immediate { @line_items = split(/,/,$line); print " device: $line_items[0], action: $line_items[1] \n"; print " forking udev time: $line_items[-1]"; - $diff = cmpDate($line_items[-1], $event_recv_time); + $diff = $line_items[-1] - $event_recv_time; print " the delay time is: $diff s \n\n"; if ( $diff > $time_out ) { print " the delay time is: $diff \n"; @@ -285,7 +229,7 @@ sub check_exe_time { $exe_time[$i] = $line_items[-1]; $i++; } - $diff = cmpDate($exe_time[1], $exe_time[0]); + $diff = $exe_time[1] - $exe_time[0]; if ( $diff < $udev_exe_time ) { print " there are more than one udev instance for a single device at the same time. \n"; exit 1; @@ -313,7 +257,7 @@ sub run_no_seq_test { check_sysfs_device_exist("$sysfs/block/sda"); # log current system date/time - $time = getDate(); + $time = time(); udevsend(-1, "/block/sda", "add", "block"); @@ -328,7 +272,7 @@ sub run_no_seq_test { system("rm -f $log_file"); # log current system date/time - $time = getDate(); + $time = time(); udevsend(-1, "/block/sda", "remove", "block"); @@ -358,7 +302,7 @@ sub run_normal_seq_test { @file_list = glob "$sysfs/class/tty/*"; # log current system date/time for device add events - $time = getDate(); + $time = time(); # # add devices event test @@ -388,7 +332,7 @@ sub run_normal_seq_test { } # log current system date/time for device remove events - $time = getDate(); + $time = time(); # # remove devices event test @@ -443,7 +387,7 @@ sub run_random_seq_test { restart_daemon(); # log current system date/time for device remove events - $time = getDate(); + $time = time(); # parameters: 1 sequence number, 2 device, 3 action, 4 subsystem udevsend(3, "/class/tty/tty2", "add", "tty"); @@ -460,7 +404,7 @@ sub run_random_seq_test { restart_daemon(); # log current system date/time for device remove events - $time = getDate(); + $time = time(); udevsend(3, "/class/tty/tty2", "remove", "tty"); udevsend(2, "/class/tty/tty1", "remove", "tty"); @@ -503,7 +447,7 @@ sub run_expected_seq_test { system("rm -f $log_file"); # log current system date/time for device remove events - $time = getDate(); + $time = time(); # show results udevsend(7, "/class/tty/tty2", "add", "tty"); @@ -535,7 +479,7 @@ sub run_single_instance_test { check_sysfs_device_exist("$sysfs/block/sda"); # log current system date/time - $time = getDate(); + $time = time(); udevsend(-1, "/block/sda", "add", "block"); udevsend(-1, "/block/sda", "remove", "block"); @@ -568,7 +512,7 @@ sub run_same_events_test { # log current system date/time sleep 1; - $time = getDate(); + $time = time(); system("rm -f $log_file"); udevsend(1, "/block/sda", "remove", "block"); @@ -600,7 +544,7 @@ sub run_missing_seq_test { sleep 1; # log current system date/time - $time = getDate(); + $time = time(); system("rm -f $log_file"); udevsend(3, "/block/sda", "add", "block"); -- cgit v1.2.3-54-g00ecf From 4be25ce1d0e1cef62120a5605f8472761a26689e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 12 Dec 2004 08:34:46 +0100 Subject: [PATCH] add class specific files for class/spi_transport and class/spi_host --- udev_sysfs.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index a4f293ef13..d46f1f26d8 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -54,6 +54,8 @@ static const struct subsystem_file { { .subsystem = "ieee1394_node", .file = NULL }, { .subsystem = "fc_transport", .file = "port_id" }, { .subsystem = "fc_host", .file = "port_id" }, + { .subsystem = "spi_transport", .file = "width" }, + { .subsystem = "spi_host", .file = "width" }, { NULL, NULL } }; -- cgit v1.2.3-54-g00ecf From 9af175553d89d2a9fbc68d623f7ae213258e492b Mon Sep 17 00:00:00 2001 From: "azarah@nosferatu.za.org" Date: Tue, 14 Dec 2004 09:42:20 +0100 Subject: [PATCH] remove leftover from udevinfo's -d option --- udevinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 340496b42b..ce9804e216 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -242,7 +242,7 @@ static int print_sysfs_devices(void) static int process_options(int argc, char *argv[]) { - static const char short_options[] = "adn:p:q:rsVh"; + static const char short_options[] = "an:p:q:rsVh"; int option; int retval = 1; struct udevice udev; @@ -439,7 +439,7 @@ exit: } help: - printf("Usage: udevinfo [-anpqrdVh]\n" + printf("Usage: udevinfo [-anpqrVh]\n" " -q TYPE query database for the specified value:\n" " 'name' name of device node\n" " 'symlink' pointing to node\n" -- cgit v1.2.3-54-g00ecf From bc0410fdb64e295ae74d990185fa0bbc883e5432 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 14 Dec 2004 11:06:49 +0100 Subject: [PATCH] export DEVNAME regardless of the state of udev_dev_d --- udev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udev.c b/udev.c index 0ee70529c4..a9da014ea6 100644 --- a/udev.c +++ b/udev.c @@ -209,9 +209,10 @@ int main(int argc, char *argv[], char *envp[]) } /* run dev.d/ scripts if we created/deleted a node or changed a netif name */ - if (udev_dev_d && udev.devname[0] != '\0') { + if (udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); - udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); + if (udev_dev_d) + udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } } else if ((strncmp(devpath, "/devices/", 9) == 0)) { if (strcmp(action, "add") == 0) { -- cgit v1.2.3-54-g00ecf From 027263f0056e7cbd43c0860ba5dcafd9e4cac916 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 14 Dec 2004 11:42:06 +0100 Subject: [PATCH] update klibc to 0.194 --- klibc/MCONFIG | 14 ++++--- klibc/Makefile | 2 +- klibc/include/arch/m32r/klibc/archsetjmp.h | 21 ++++++++++ klibc/include/arch/m32r/klibc/archsignal.h | 13 +++++++ klibc/include/arch/m32r/klibc/archstat.h | 37 ++++++++++++++++++ klibc/include/arch/m32r/klibc/archsys.h | 12 ++++++ klibc/include/sched.h | 4 +- klibc/include/stdio.h | 4 +- klibc/include/stdlib.h | 1 + klibc/include/sys/mount.h | 23 +++++++++-- klibc/include/syslog.h | 9 +++++ klibc/klibc.spec | 2 +- klibc/klibc/MCONFIG | 2 +- klibc/klibc/Makefile | 12 +++--- klibc/klibc/README | 5 ++- klibc/klibc/SYSCALLS.def | 15 +++++--- klibc/klibc/arch/ia64/pipe.c | 2 +- klibc/klibc/arch/m32r/MCONFIG | 18 +++++++++ klibc/klibc/arch/m32r/Makefile.inc | 19 +++++++++ klibc/klibc/arch/m32r/crt0.S | 25 ++++++++++++ klibc/klibc/arch/m32r/setjmp.S | 47 ++++++++++++++++++++++ klibc/klibc/arch/m32r/syscall.S | 29 ++++++++++++++ klibc/klibc/arch/m32r/sysstub.ph | 25 ++++++++++++ klibc/klibc/arch/ppc/setjmp.S | 2 +- klibc/klibc/arch/ppc64/MCONFIG | 6 ++- klibc/klibc/arch/ppc64/Makefile.inc | 2 +- klibc/klibc/arch/ppc64/sysstub.ph | 5 +-- klibc/klibc/arch/x86_64/MCONFIG | 6 +++ klibc/klibc/asprintf.c | 4 +- klibc/klibc/atexit.h | 2 - klibc/klibc/exitc.c | 15 +------- klibc/klibc/fork.c | 3 +- klibc/klibc/jrand48.c | 12 +++--- klibc/klibc/makeerrlist.pl | 21 +++++++--- klibc/klibc/sbrk.c | 2 +- klibc/klibc/strcspn.c | 11 ++++++ klibc/klibc/strpbrk.c | 14 +++++++ klibc/klibc/strspn.c | 62 ++---------------------------- klibc/klibc/strxspn.c | 30 +++++++++++++++ klibc/klibc/strxspn.h | 13 +++++++ klibc/klibc/syslog.c | 13 +++++-- klibc/klibc/vasprintf.c | 4 +- klibc/version | 2 +- 43 files changed, 437 insertions(+), 133 deletions(-) create mode 100644 klibc/include/arch/m32r/klibc/archsetjmp.h create mode 100644 klibc/include/arch/m32r/klibc/archsignal.h create mode 100644 klibc/include/arch/m32r/klibc/archstat.h create mode 100644 klibc/include/arch/m32r/klibc/archsys.h create mode 100644 klibc/klibc/arch/m32r/MCONFIG create mode 100644 klibc/klibc/arch/m32r/Makefile.inc create mode 100644 klibc/klibc/arch/m32r/crt0.S create mode 100644 klibc/klibc/arch/m32r/setjmp.S create mode 100644 klibc/klibc/arch/m32r/syscall.S create mode 100644 klibc/klibc/arch/m32r/sysstub.ph create mode 100644 klibc/klibc/strcspn.c create mode 100644 klibc/klibc/strpbrk.c create mode 100644 klibc/klibc/strxspn.c create mode 100644 klibc/klibc/strxspn.h diff --git a/klibc/MCONFIG b/klibc/MCONFIG index d2aa23626c..7da150d031 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -6,19 +6,23 @@ # Eventually support separate compilation, but we don't have it yet... OBJROOT = $(SRCROOT) +# Kernel trees (source and obj) - can potentially be different +KRNLSRC = $(SRCROOT)/linux +KRNLOBJ = $(SRCROOT)/linux + ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) CROSS = CC = $(CROSS)gcc LD = $(CROSS)ld KLIBSRC = $(SRCROOT)/klibc KLIBOBJ = $(OBJROOT)/klibc -REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include \ - -D__KLIBC__ -DBITSIZE=$(BITSIZE) \ - -I$(SRCROOT)/include/arch/$(ARCH) \ +INCLUDE = -I$(SRCROOT)/include/arch/$(ARCH) \ -I$(SRCROOT)/include/bits$(BITSIZE) \ -I$(SRCROOT)/include \ - -I$(SRCROOT)/linux/include -I$(SRCROOT)/linux/include2 - + -I$(KRNLOBJ)/include -I$(KRNLOBJ)/include2 -I$(KRNLSRC)/include +REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include \ + -D__KLIBC__ -DBITSIZE=$(BITSIZE) \ + $(INCLUDE) LDFLAGS = AR = $(CROSS)ar RANLIB = $(CROSS)ranlib diff --git a/klibc/Makefile b/klibc/Makefile index 8823a33bfd..2506417ef5 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -1,5 +1,5 @@ VERSION := $(shell cat version) -SUBDIRS = klibc +SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip all: diff --git a/klibc/include/arch/m32r/klibc/archsetjmp.h b/klibc/include/arch/m32r/klibc/archsetjmp.h new file mode 100644 index 0000000000..e16a83517a --- /dev/null +++ b/klibc/include/arch/m32r/klibc/archsetjmp.h @@ -0,0 +1,21 @@ +/* + * arch/m32r/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + unsigned long __r8; + unsigned long __r9; + unsigned long __r10; + unsigned long __r11; + unsigned long __r12; + unsigned long __r13; + unsigned long __r14; + unsigned long __r15; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/m32r/klibc/archsignal.h b/klibc/include/arch/m32r/klibc/archsignal.h new file mode 100644 index 0000000000..02596e9a1c --- /dev/null +++ b/klibc/include/arch/m32r/klibc/archsignal.h @@ -0,0 +1,13 @@ +/* + * arch/m32r/include/klibc/archsignal.h + * + * Architecture-specific signal definitions + * + */ + +#ifndef _KLIBC_ARCHSIGNAL_H +#define _KLIBC_ARCHSIGNAL_H + +/* No special stuff for this architecture */ + +#endif diff --git a/klibc/include/arch/m32r/klibc/archstat.h b/klibc/include/arch/m32r/klibc/archstat.h new file mode 100644 index 0000000000..154820755f --- /dev/null +++ b/klibc/include/arch/m32r/klibc/archstat.h @@ -0,0 +1,37 @@ +#ifndef _KLIBC_ARCHSTAT_H +#define _KLIBC_ARCHSTAT_H + +#define _STATBUF_ST_NSEC + +/* This matches struct stat64 in glibc2.1, hence the absolutely + * insane amounts of padding around dev_t's. + */ +struct stat { + unsigned long long st_dev; + unsigned char __pad0[4]; + + unsigned long __st_ino; + + unsigned int st_mode; + unsigned int st_nlink; + + unsigned long st_uid; + unsigned long st_gid; + + unsigned long long st_rdev; + unsigned char __pad3[4]; + + long long st_size; + unsigned long st_blksize; + + unsigned long st_blocks; /* Number 512-byte blocks allocated. */ + unsigned long __pad4; /* future possible st_blocks high bits */ + + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + + unsigned long long st_ino; +}; + +#endif diff --git a/klibc/include/arch/m32r/klibc/archsys.h b/klibc/include/arch/m32r/klibc/archsys.h new file mode 100644 index 0000000000..386db8b505 --- /dev/null +++ b/klibc/include/arch/m32r/klibc/archsys.h @@ -0,0 +1,12 @@ +/* + * arch/m32r/include/klibc/archsys.h + * + * Architecture-specific syscall definitions + */ + +#ifndef _KLIBC_ARCHSYS_H +#define _KLIBC_ARCHSYS_H + +/* No special syscall definitions for this architecture */ + +#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/sched.h b/klibc/include/sched.h index fcf62a6e4f..3465b5705c 100644 --- a/klibc/include/sched.h +++ b/klibc/include/sched.h @@ -25,7 +25,9 @@ __extern int sched_yield(void); __extern pid_t __clone2(int, void *, void *); static __inline__ pid_t __clone(int _f, void *_sp) { - return __clone2(_f, _sp, 0); + /* If this is used with _sp != 0 it will have the effect of the sp + and rsp growing away from a single point in opposite directions. */ + return __clone2(_f, _sp, _sp); } #else __extern pid_t __clone(int, void *); diff --git a/klibc/include/stdio.h b/klibc/include/stdio.h index e00fac4d5e..d30622cfb2 100644 --- a/klibc/include/stdio.h +++ b/klibc/include/stdio.h @@ -90,7 +90,7 @@ fread(void *__p, size_t __s, size_t __n, FILE *__f) } extern __inline__ size_t -fwrite(void *__p, size_t __s, size_t __n, FILE *__f) +fwrite(const void *__p, size_t __s, size_t __n, FILE *__f) { return _fwrite(__p, __s*__n, __f)/__s; } @@ -104,6 +104,8 @@ __extern int sprintf(char *, const char *, ...); __extern int vsprintf(char *, const char *, va_list); __extern int snprintf(char *, size_t n, const char *, ...); __extern int vsnprintf(char *, size_t n, const char *, va_list); +__extern int asprintf(char **, const char *, ...); +__extern int vasprintf(char **, const char *, va_list); /* No buffering, so no flushing needed */ extern __inline__ int diff --git a/klibc/include/stdlib.h b/klibc/include/stdlib.h index be4e76ed9f..54d45043f7 100644 --- a/klibc/include/stdlib.h +++ b/klibc/include/stdlib.h @@ -21,6 +21,7 @@ __extern __noreturn abort(void); static __inline__ int abs(int __n) { return (__n < 0) ? -__n : __n; } +__extern int system(const char * string); __extern int atexit(void (*)(void)); __extern int on_exit(void (*)(int, void *), void *); __extern int atoi(const char *); diff --git a/klibc/include/sys/mount.h b/klibc/include/sys/mount.h index 313c90ec0e..0e1bce49bf 100644 --- a/klibc/include/sys/mount.h +++ b/klibc/include/sys/mount.h @@ -6,6 +6,7 @@ #define _SYS_MOUNT_H #include +#include /* * These are the fs-independent mount-flags: up to 32 flags are supported @@ -17,13 +18,16 @@ #define MS_SYNCHRONOUS 16 /* Writes are synced at once */ #define MS_REMOUNT 32 /* Alter flags of a mounted FS */ #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ -#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ +#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ #define MS_NOATIME 1024 /* Do not update access times. */ #define MS_NODIRATIME 2048 /* Do not update directory access times */ #define MS_BIND 4096 -#define MS_MOVE 8192 +#define MS_MOVE 8192 #define MS_REC 16384 #define MS_VERBOSE 32768 +#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ +#define MS_ONE_SECOND (1<<17) /* fs has 1 sec a/m/ctime resolution */ +#define MS_ACTIVE (1<<30) #define MS_NOUSER (1<<31) /* @@ -40,7 +44,20 @@ /* * umount2() flags */ -#define MNT_FORCE 1 +#define MNT_FORCE 1 /* Forcibly unmount */ +#define MNT_DETACH 2 /* Detach from tree only */ +#define MNT_EXPIRE 4 /* Mark for expiry */ + +/* + * Block device ioctls + */ +#define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */ +#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */ +#define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */ +#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */ +#define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */ +#define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */ +#define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */ /* * Prototypes diff --git a/klibc/include/syslog.h b/klibc/include/syslog.h index 551527a042..061dbcd5a7 100644 --- a/klibc/include/syslog.h +++ b/klibc/include/syslog.h @@ -47,6 +47,15 @@ #define LOG_FACMASK 01770 #define LOG_FAC(x) (((x) >> 3) & (LOG_FACMASK >> 3)) +/* openlog() flags; only LOG_PID and LOG_PERROR supported */ +#define LOG_PID 0x01 /* include pid with message */ +#define LOG_CONS 0x02 /* write to console on logger error */ +#define LOG_ODELAY 0x04 /* delay connection until syslog() */ +#define LOG_NDELAY 0x08 /* open connection immediately */ +#define LOG_NOWAIT 0x10 /* wait for child processes (unused on linux) */ +#define LOG_PERROR 0x20 /* additional logging to stderr */ + + __extern void openlog(const char *, int, int); __extern void syslog(int, const char *, ...); __extern void vsyslog(int, const char *, va_list); diff --git a/klibc/klibc.spec b/klibc/klibc.spec index 6166a35c4d..272e52bc1a 100644 --- a/klibc/klibc.spec +++ b/klibc/klibc.spec @@ -1,6 +1,6 @@ Summary: A minimal libc subset for use with initramfs. Name: klibc -Version: 0.181 +Version: 0.194 Release: 1 License: BSD/GPL Group: Development/Libraries diff --git a/klibc/klibc/MCONFIG b/klibc/klibc/MCONFIG index 5b6eecd037..499b6e8b56 100644 --- a/klibc/klibc/MCONFIG +++ b/klibc/klibc/MCONFIG @@ -13,6 +13,6 @@ ifeq ($(ERRLIST),1) REQFLAGS += -DWITH_ERRLIST endif -CFLAGS = -Wp,-MD,$(dir $*).$(notdir $*).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) +CFLAGS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) SOFLAGS = -fPIC diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index 3519b45089..0d44ce5494 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -34,8 +34,8 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ strcasecmp.o strncasecmp.o strndup.o strerror.o \ strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \ strncat.o strlcpy.o strlcat.o \ - strstr.o strncmp.o strncpy.o strrchr.o strspn.o \ - strsep.o strtok.o \ + strstr.o strncmp.o strncpy.o strrchr.o \ + strxspn.o strspn.o strcspn.o strpbrk.o strsep.o strtok.o \ gethostname.o getdomainname.o getcwd.o \ seteuid.o setegid.o \ getenv.o setenv.o putenv.o __put_env.o unsetenv.o \ @@ -59,7 +59,7 @@ LIB = libc.a INTERP_O = interp.o -all: $(CRT0) $(LIB) $(SOLIB) klibc.so +all: tests $(CRT0) $(LIB) $(SOLIB) klibc.so # Add any architecture-specific rules include arch/$(ARCH)/Makefile.inc @@ -120,14 +120,14 @@ crt0.o: arch/$(ARCH)/crt0.o cp arch/$(ARCH)/crt0.o . errlist.c: - $(PERL) makeerrlist.pl -errlist > $@ || rm -f $@ + $(PERL) makeerrlist.pl -q $(INCLUDE) -errlist > $@ || rm -f $@ # We pass -ansi to keep cpp from define e.g. "i386" as well as "__i386__" SYSCALLS.i: SYSCALLS.def $(CC) $(CFLAGS) -D__ASSEMBLY__ -ansi -x assembler-with-cpp -E -o $@ $< -syscalls.nrs: ../include/sys/syscall.h ../include/arch/$(ARCH)/klibc/archsys.h ../linux/include/asm/unistd.h - $(CC) $(CFLAGS) -Wp,-dM -x c -E -o $@ ../include/sys/syscall.h +syscalls.nrs: ../include/sys/syscall.h + $(CC) $(CFLAGS) -Wp,-dM -x c -E -o $@ $< syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscalls.nrs rm -rf syscalls diff --git a/klibc/klibc/README b/klibc/klibc/README index edc8524f22..3a53a8809f 100644 --- a/klibc/klibc/README +++ b/klibc/klibc/README @@ -38,10 +38,11 @@ b) If you're cross-compiling, change ARCH in the main MCONFIG file to arm-thumb: Untested arm26: Not yet ported arm: Working - cris: Untested + cris: Working h8300: Not yet ported i386: Working ia64: Working + m32r: Untested m68k: Not yet ported mips64: Not yet ported mips: Working @@ -51,7 +52,7 @@ b) If you're cross-compiling, change ARCH in the main MCONFIG file to s390: Working static, shared untested s390x: Working sh: Untested - sparc64: sigaction() fails in ash for unknown reason + sparc64: Untested sparc: Working v850: Not yet ported x86-64: Working diff --git a/klibc/klibc/SYSCALLS.def b/klibc/klibc/SYSCALLS.def index dbd7dc8434..4591d0b983 100644 --- a/klibc/klibc/SYSCALLS.def +++ b/klibc/klibc/SYSCALLS.def @@ -15,6 +15,7 @@ ; ; Process-related syscalls ; + void _exit,exit::_exit(int) pid_t clone::__clone(unsigned long, void *) pid_t clone::__clone2(unsigned long, void *, void *) pid_t fork() @@ -65,7 +66,7 @@ int setresuid32,setresuid::setresuid(int, uid_t, uid, uid_t) int mount(const char *, const char *, const char *, unsigned long, const void *) int umount2(const char *, int) int umount::umount2(const char *, int) - int pivot_root(const char *, const char *) + int pivot_root(const char *, const char *) int sync() #ifdef __NR_statfs64 int statfs64::__statfs64(const char *, size_t, struct statfs *) @@ -99,9 +100,12 @@ mode_t umask(mode_t) int chroot(const char *) int symlink(const char *, const char *) int readlink(const char *, char *, size_t) -int stat64,stat::stat(const char *, struct stat *) -int lstat64,lstat::lstat(const char *, struct stat *) -int fstat64,fstat::fstat(int, struct stat *) + int stat64,stat::stat(const char *, struct stat *) + int lstat64,lstat::lstat(const char *, struct stat *) + int fstat64,fstat::fstat(int, struct stat *) + int stat::stat(const char *, struct stat *) + int lstat::lstat(const char *, struct stat *) + int fstat::fstat(int, struct stat *) int getdents64,getdents::getdents(unsigned int, struct dirent *, unsigned int) int chown32,chown::chown(const char *, uid_t, gid_t) int fchown32,fchown::fchown(int, uid_t, gid_t) @@ -123,7 +127,8 @@ int close(int) int dup(int) int dup2(int, int) int fcntl64@varadic::fcntl(int, int, unsigned long) - int fcntl64,fcntl::fcntl(int, int, unsigned long) + int fcntl(int, int, unsigned long) + int fcntl64,fcntl::fcntl(int, int, unsigned long) int ioctl(int, int, void *) int flock(int, int) int _newselect,select::select(int, fd_set *, fd_set *, fd_set *, struct timeval *) diff --git a/klibc/klibc/arch/ia64/pipe.c b/klibc/klibc/arch/ia64/pipe.c index 0b641e8702..87a6981e55 100644 --- a/klibc/klibc/arch/ia64/pipe.c +++ b/klibc/klibc/arch/ia64/pipe.c @@ -2,7 +2,7 @@ * pipe.c */ -#include "syscommon.h" +#include #include #define ASM_CLOBBERS ,"out2", "out3", "out4", "out5", "out6", "out7", \ diff --git a/klibc/klibc/arch/m32r/MCONFIG b/klibc/klibc/arch/m32r/MCONFIG new file mode 100644 index 0000000000..6706d9ddc1 --- /dev/null +++ b/klibc/klibc/arch/m32r/MCONFIG @@ -0,0 +1,18 @@ +# -*- makefile -*- +# +# arch/m32r/MCONFIG +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 32 + +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 224 MB - normal binaries start at 0 (?) +# (lib?)gcc on cris seems to insist on producing .init and .fini sections +SHAREDFLAGS = --section-start .init=0x0e000100 diff --git a/klibc/klibc/arch/m32r/Makefile.inc b/klibc/klibc/arch/m32r/Makefile.inc new file mode 100644 index 0000000000..43cb44ef8f --- /dev/null +++ b/klibc/klibc/arch/m32r/Makefile.inc @@ -0,0 +1,19 @@ +# -*- makefile -*- +# +# arch/m32r/Makefile.inc +# +# Special rules for this architecture. Note that this is actually +# included from the main Makefile, and that pathnames should be +# accordingly. +# + +ARCHOBJS = \ + arch/$(ARCH)/setjmp.o \ + arch/$(ARCH)/syscall.o \ + libgcc/__divdi3.o \ + libgcc/__moddi3.o \ + libgcc/__udivdi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmoddi4.o + +archclean: diff --git a/klibc/klibc/arch/m32r/crt0.S b/klibc/klibc/arch/m32r/crt0.S new file mode 100644 index 0000000000..1589a774a2 --- /dev/null +++ b/klibc/klibc/arch/m32r/crt0.S @@ -0,0 +1,25 @@ +# +# arch/m32r/crt0.S +# +# Does arch-specific initialization and invokes __libc_init +# with the appropriate arguments. +# +# See __static_init.c or __shared_init.c for the expected +# arguments. +# + + .text + .balign 4 + .type _start,@function + .globl _start +_start: + /* Save the address of the ELF argument array */ + mv r0, sp + + /* atexit() function (assume null) */ + xor r1, r1 + + bl __libc_init + + .size _start, .-_start + diff --git a/klibc/klibc/arch/m32r/setjmp.S b/klibc/klibc/arch/m32r/setjmp.S new file mode 100644 index 0000000000..14ef7e3577 --- /dev/null +++ b/klibc/klibc/arch/m32r/setjmp.S @@ -0,0 +1,47 @@ +# +# arch/m32r/setjmp.S +# +# setjmp/longjmp for the M32R architecture +# + +# +# The jmp_buf is assumed to contain the following, in order: +# r8-r15 +# +# Note that r14 is the return address register and +# r15 is the stack pointer. +# + + .text + .balign 4 + .globl setjmp + .type setjmp, @function +setjmp: + st r8, @r0 + st r9, @+r0 + st r10, @+r0 + st r11, @+r0 + st r12, @+r0 + st r13, @+r0 + st r14, @+r0 + st r15, @+r0 + xor r0, r0 + jmp r14 + .size setjmp,.-setjmp + + .text + .balign 4 + .globl longjmp + .type longjmp, @function +longjmp: + ld r8, @r0+ + ld r9, @r0+ + ld r10, @r0+ + ld r11, @r0+ + ld r12, @r0+ + ld r13, @r0+ + ld r14, @r0+ + ld r15, @r0 + mv r0, r1 + jmp r14 + .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/m32r/syscall.S b/klibc/klibc/arch/m32r/syscall.S new file mode 100644 index 0000000000..a20a33667f --- /dev/null +++ b/klibc/klibc/arch/m32r/syscall.S @@ -0,0 +1,29 @@ +/* + * arch/m32r/syscall.S + * + * r7 contains the syscall number (set by stub); + * r0..r3 contains arguments 0-3 per standard calling convention; + * r4..r5 contains arguments 4-5, but we have to get those from + * the stack. + */ + + .section ".text","ax" + .balign 4 + .globl __syscall_common + .type __syscall_common,@function +__syscall_common: + ld r4,@sp + ld r5,@(4,sp) + trap #2 + cmpi r0, #-4096 + bnc 1f + jmp r14 +1: + seth r2,#high(errno) + or3 r2,r2,#low(errno) + neg r1,r0 + st r1,@r7 + ldi r0,#-1 + jmp r14 + + .size __syscall_common,.-__syscall_common diff --git a/klibc/klibc/arch/m32r/sysstub.ph b/klibc/klibc/arch/m32r/sysstub.ph new file mode 100644 index 0000000000..3813ea4144 --- /dev/null +++ b/klibc/klibc/arch/m32r/sysstub.ph @@ -0,0 +1,25 @@ +# -*- perl -*- +# +# arch/m32r/sysstub.ph +# +# Script to generate system call stubs +# + +sub make_sysstub($$$$@) { + my($fname, $type, $sname, $stype, @args) = @_; + + open(OUT, '>', "syscalls/${fname}.S"); + print OUT "#include \n"; + print OUT "\n"; + print OUT "\t.text\n"; + print OUT "\t.type\t${fname},\@function\n"; + print OUT "\t.globl\t${fname}\n"; + print OUT "\t.balign\t4\n"; + print OUT "${fname}:\n"; + print OUT "\tldi\tr7,#__NR_${sname}\n"; + print OUT "\tbra\t__syscall_common\n"; + print OUT "\t.size ${fname},.-${fname}\n"; + close(OUT); +} + +1; diff --git a/klibc/klibc/arch/ppc/setjmp.S b/klibc/klibc/arch/ppc/setjmp.S index 1c50301707..3012de3ea6 100644 --- a/klibc/klibc/arch/ppc/setjmp.S +++ b/klibc/klibc/arch/ppc/setjmp.S @@ -32,4 +32,4 @@ longjmp: blr /* return */ .size longjmp,.-longjmp - \ No newline at end of file + diff --git a/klibc/klibc/arch/ppc64/MCONFIG b/klibc/klibc/arch/ppc64/MCONFIG index 86526f895c..09881b8d40 100644 --- a/klibc/klibc/arch/ppc64/MCONFIG +++ b/klibc/klibc/arch/ppc64/MCONFIG @@ -7,8 +7,10 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer -BITSIZE = 64 +ARCHREQFLAGS = -m64 -mcall-aixdesc +OPTFLAGS = -Os -fomit-frame-pointer +BITSIZE = 64 +LDFLAGS = -m elf64ppc # Extra linkflags when building the shared version of the library # This address needs to be reachable using normal inter-module diff --git a/klibc/klibc/arch/ppc64/Makefile.inc b/klibc/klibc/arch/ppc64/Makefile.inc index 928df1aeb7..d1e128fdce 100644 --- a/klibc/klibc/arch/ppc64/Makefile.inc +++ b/klibc/klibc/arch/ppc64/Makefile.inc @@ -19,7 +19,7 @@ interp.o: interp1.o klibc.got $(LD) $(LDFLAGS) -r -o $@ interp1.o klibc.got klibc.got: $(SOHASH) - $(OBJCOPY) -j.got $< $@ + $(OBJCOPY) -j .got $< $@ archclean: rm -f klibc.got diff --git a/klibc/klibc/arch/ppc64/sysstub.ph b/klibc/klibc/arch/ppc64/sysstub.ph index 1469cc6071..0a379158e1 100644 --- a/klibc/klibc/arch/ppc64/sysstub.ph +++ b/klibc/klibc/arch/ppc64/sysstub.ph @@ -16,16 +16,13 @@ sub make_sysstub($$$$@) { print OUT "\t.align 3\n"; print OUT "${fname}:\n"; print OUT "\t.quad .${fname},.TOC.\@tocbase,0\n"; - print OUT "\t.size ${fname},24\n"; print OUT "\t.text\n"; print OUT "\t.type .${fname},\@function\n"; print OUT "\t.globl .${fname}\n"; print OUT ".${fname}:\n"; print OUT "\tli 0,__NR_${sname}\n"; print OUT "\tsc\n"; - print OUT "\tmfcr 0\n"; - print OUT "\trldicl. 9,0,36,63\n"; - print OUT "\tbeqlr- 0\n"; + print OUT "\tbnslr\n"; print OUT "\tb .__syscall_error\n"; print OUT "\t.size .${fname},.-.${fname}\n"; close(OUT); diff --git a/klibc/klibc/arch/x86_64/MCONFIG b/klibc/klibc/arch/x86_64/MCONFIG index f3c87410a6..a2a2367633 100644 --- a/klibc/klibc/arch/x86_64/MCONFIG +++ b/klibc/klibc/arch/x86_64/MCONFIG @@ -20,3 +20,9 @@ OPTFLAGS = -Os -fno-asynchronous-unwind-tables -fomit-frame-pointer \ BITSIZE = 64 LDFLAGS = -m elf_x86_64 +# Extra linkflags when building the shared version of the library +# This address needs to be reachable using normal inter-module +# calls, and work on the memory models for this architecture +# 2 MB - normal binaries start at 4 MB +SHAREDFLAGS = -Ttext 0x00200200 + diff --git a/klibc/klibc/asprintf.c b/klibc/klibc/asprintf.c index 457d34bb15..6002b576e1 100644 --- a/klibc/klibc/asprintf.c +++ b/klibc/klibc/asprintf.c @@ -16,10 +16,10 @@ int asprintf(char **bufp, const char *format, ...) va_start(ap, format); va_copy(ap1, ap); - bytes = vsnprintf(NULL, 0, format, ap1); + bytes = vsnprintf(NULL, 0, format, ap1) + 1; va_end(ap1); - *bufp = p = malloc(bytes+1); + *bufp = p = malloc(bytes); if ( !p ) return -1; diff --git a/klibc/klibc/atexit.h b/klibc/klibc/atexit.h index a60d641e23..792141def5 100644 --- a/klibc/klibc/atexit.h +++ b/klibc/klibc/atexit.h @@ -13,7 +13,5 @@ struct atexit { struct atexit *next; }; -extern struct atexit *__atexit_list; - #endif /* ATEXIT_H */ diff --git a/klibc/klibc/exitc.c b/klibc/klibc/exitc.c index 6e5d78979d..8819737fb7 100644 --- a/klibc/klibc/exitc.c +++ b/klibc/klibc/exitc.c @@ -1,9 +1,7 @@ /* * exit.c * - * Note: all programs need exit(), since it's invoked from - * crt0.o. Therefore there is no point in breaking apart - * exit() and _exit(). + * Implement exit() */ #include @@ -14,11 +12,6 @@ #if !defined(__i386__) && !defined(__x86_64__) -#define __NR___exit __NR_exit - -/* Syscalls can't return void... */ -static inline _syscall1(int,__exit,int,rv); - /* This allows atexit/on_exit to install a hook */ __noreturn (*__exit_handler)(int) = _exit; @@ -27,10 +20,4 @@ __noreturn exit(int rv) __exit_handler(rv); } -__noreturn _exit(int rv) -{ - __exit(rv); - for(;;); -} - #endif diff --git a/klibc/klibc/fork.c b/klibc/klibc/fork.c index daf313eaf2..fcd73bd60b 100644 --- a/klibc/klibc/fork.c +++ b/klibc/klibc/fork.c @@ -8,11 +8,10 @@ #include #include #include +#include #ifndef __NR_fork -extern pid_t __clone(unsigned long flags, void * newsp); - pid_t fork(void) { return __clone(SIGCHLD, 0); diff --git a/klibc/klibc/jrand48.c b/klibc/klibc/jrand48.c index a2ead11e5f..660a6e5a71 100644 --- a/klibc/klibc/jrand48.c +++ b/klibc/klibc/jrand48.c @@ -10,15 +10,15 @@ long jrand48(unsigned short xsubi[3]) uint64_t x; /* The xsubi[] array is littleendian by spec */ - x = (uint64_t)xsubi[0] + - ((uint64_t)xsubi[1] << 16) + - ((uint64_t)xsubi[2] << 32); + x = (uint64_t)(uint16_t)xsubi[0] + + ((uint64_t)(uint16_t)xsubi[1] << 16) + + ((uint64_t)(uint16_t)xsubi[2] << 32); x = (0x5deece66dULL * x) + 0xb; - xsubi[0] = (unsigned short)x; - xsubi[1] = (unsigned short)(x >> 16); - xsubi[2] = (unsigned short)(x >> 32); + xsubi[0] = (unsigned short)(uint16_t)x; + xsubi[1] = (unsigned short)(uint16_t)(x >> 16); + xsubi[2] = (unsigned short)(uint16_t)(x >> 32); return (long)(int32_t)(x >> 16); } diff --git a/klibc/klibc/makeerrlist.pl b/klibc/klibc/makeerrlist.pl index f42704f88a..14498d880a 100644 --- a/klibc/klibc/makeerrlist.pl +++ b/klibc/klibc/makeerrlist.pl @@ -10,20 +10,27 @@ use FileHandle; %errors = (); %errmsg = (); $maxerr = -1; -$rootdir = '../linux/include/'; # Must have trailing / +@includelist = (); # Include directories sub parse_file($) { my($file) = @_; my($fh) = new FileHandle; my($line, $error, $msg); my($kernelonly) = 0; - - $file = $rootdir.$file; + my($root); print STDERR "opening $file\n" unless ( $quiet ); - if ( !($fh->open("< ".$file)) ) { - die "$0: cannot open $file\n"; + $ok = 0; + foreach $root ( @includelist ) { + if ( $fh->open($root.'//'.$file, '<') ) { + $ok = 1; + last; + } + } + + if ( ! $ok ) { + die "$0: Cannot find file $file\n"; } while ( defined($line = <$fh>) ) { @@ -61,8 +68,10 @@ foreach $arg ( @ARGV ) { $quiet = 1; } elsif ( $arg =~ /^-(errlist|errnos|maxerr)$/ ) { $type = $arg; + } elsif ( $arg =~ '^\-I' ) { + push(@includelist, "$'"); } else { - die "$0: Unknown option: $arg\n"; + die "$0: Unknown option: $arg\n"; } } diff --git a/klibc/klibc/sbrk.c b/klibc/klibc/sbrk.c index f7401dcfe2..cb0efb21b9 100644 --- a/klibc/klibc/sbrk.c +++ b/klibc/klibc/sbrk.c @@ -37,5 +37,5 @@ void *sbrk(ptrdiff_t increment) } __current_brk = new_brk; - return end; + return start; } diff --git a/klibc/klibc/strcspn.c b/klibc/klibc/strcspn.c new file mode 100644 index 0000000000..87d644551e --- /dev/null +++ b/klibc/klibc/strcspn.c @@ -0,0 +1,11 @@ +/* + * strcspn + */ + +#include "strxspn.h" + +size_t +strcspn(const char *s, const char *reject) +{ + return __strxspn(s, reject, 1); +} diff --git a/klibc/klibc/strpbrk.c b/klibc/klibc/strpbrk.c new file mode 100644 index 0000000000..86ea236308 --- /dev/null +++ b/klibc/klibc/strpbrk.c @@ -0,0 +1,14 @@ +/* + * strpbrk + */ + +#include "strxspn.h" + +char * +strpbrk(const char *s, const char *accept) +{ + const char *ss = s+__strxspn(s, accept, 1); + + return *ss ? (char *)ss : NULL; +} + diff --git a/klibc/klibc/strspn.c b/klibc/klibc/strspn.c index 856a964197..10b1dfc5fa 100644 --- a/klibc/klibc/strspn.c +++ b/klibc/klibc/strspn.c @@ -1,67 +1,11 @@ /* - * strspn, strcspn + * strspn */ -#include -#include -#include -#include - -#ifndef LONG_BIT -#define LONG_BIT (CHAR_BIT*sizeof(long)) -#endif - -static inline void -set_bit(unsigned long *bitmap, unsigned int bit) -{ - bitmap[bit/LONG_BIT] |= 1UL << (bit%LONG_BIT); -} - -static inline int -test_bit(unsigned long *bitmap, unsigned int bit) -{ - return (int)(bitmap[bit/LONG_BIT] >> (bit%LONG_BIT)) & 1; -} - -static size_t -strxspn(const char *s, const char *map, int parity) -{ - unsigned long matchmap[((1 << CHAR_BIT)+LONG_BIT-1)/LONG_BIT]; - size_t n = 0; - - /* Create bitmap */ - memset(matchmap, 0, sizeof matchmap); - while ( *map ) - set_bit(matchmap, (unsigned char) *map++); - - /* Make sure the null character never matches */ - if ( parity ) - set_bit(matchmap, 0); - - /* Calculate span length */ - while ( test_bit(matchmap, (unsigned char) *s++)^parity ) - n++; - - return n; -} +#include "strxspn.h" size_t strspn(const char *s, const char *accept) { - return strxspn(s, accept, 0); + return __strxspn(s, accept, 0); } - -size_t -strcspn(const char *s, const char *reject) -{ - return strxspn(s, reject, 1); -} - -char * -strpbrk(const char *s, const char *accept) -{ - const char *ss = s+strxspn(s, accept, 1); - - return *ss ? (char *)ss : NULL; -} - diff --git a/klibc/klibc/strxspn.c b/klibc/klibc/strxspn.c new file mode 100644 index 0000000000..618c0bcdb5 --- /dev/null +++ b/klibc/klibc/strxspn.c @@ -0,0 +1,30 @@ +/* + * strpbrk + */ + +#include +#include +#include +#include +#include "strxspn.h" + +size_t +__strxspn(const char *s, const char *map, int parity) +{ + char matchmap[UCHAR_MAX+1]; + size_t n = 0; + + /* Create bitmap */ + memset(matchmap, 0, sizeof matchmap); + while ( *map ) + matchmap[(unsigned char) *map++] = 1; + + /* Make sure the null character never matches */ + matchmap[0] = parity; + + /* Calculate span length */ + while ( matchmap[(unsigned char) *s++] ^ parity ) + n++; + + return n; +} diff --git a/klibc/klibc/strxspn.h b/klibc/klibc/strxspn.h new file mode 100644 index 0000000000..5e1a21922f --- /dev/null +++ b/klibc/klibc/strxspn.h @@ -0,0 +1,13 @@ +/* + * strxspn.h + */ + +#ifndef STRXSPN_H +#define STRXSPN_H + +#include + +extern size_t +__strxspn(const char *s, const char *map, int parity); + +#endif diff --git a/klibc/klibc/syslog.c b/klibc/klibc/syslog.c index e9d84d9ddc..0cd296ab85 100644 --- a/klibc/klibc/syslog.c +++ b/klibc/klibc/syslog.c @@ -18,10 +18,11 @@ #define LOGDEV "/dev/kmsg" /* Max length of ID string */ -#define MAXID 31 /* MAXID+6 must be < BUFLEN */ +#define MAXID 31 /* MAXID+5 must be < BUFLEN */ int __syslog_fd = -1; static char id[MAXID+1]; +static int syslog_flags = 0; void openlog(const char *ident, int option, int facility) { @@ -36,8 +37,9 @@ void openlog(const char *ident, int option, int facility) fcntl(fd, F_SETFD, (long)FD_CLOEXEC); } + syslog_flags = option; + strncpy(id, ident?ident:"", MAXID); - id[MAXID] = '\0'; /* Make sure it's null-terminated */ } void vsyslog(int prio, const char *format, va_list ap) @@ -54,7 +56,9 @@ void vsyslog(int prio, const char *format, va_list ap) buf[2] = '>'; len = 3; - if ( *id ) + if ( syslog_flags & LOG_PID ) + len += sprintf(buf+3, "%s[%u]: ", id, getpid()); + else if ( *id ) len += sprintf(buf+3, "%s: ", id); len += vsnprintf(buf+len, BUFLEN-len, format, ap); @@ -68,6 +72,9 @@ void vsyslog(int prio, const char *format, va_list ap) fd = 2; /* Failed to open log, write to stderr */ write(fd, buf, len); + + if ( syslog_flags & LOG_PERROR ) + _fwrite(buf+3, len-3, stderr); } void syslog(int prio, const char *format, ...) diff --git a/klibc/klibc/vasprintf.c b/klibc/klibc/vasprintf.c index 5066dbbfaf..657bfdc3ef 100644 --- a/klibc/klibc/vasprintf.c +++ b/klibc/klibc/vasprintf.c @@ -14,10 +14,10 @@ int vasprintf(char **bufp, const char *format, va_list ap) va_copy(ap1, ap); - bytes = vsnprintf(NULL, 0, format, ap1); + bytes = vsnprintf(NULL, 0, format, ap1) + 1; va_end(ap1); - *bufp = p = malloc(bytes+1); + *bufp = p = malloc(bytes); if ( !p ) return -1; diff --git a/klibc/version b/klibc/version index 30a3f4aab8..b553d446e1 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.181 +0.194 -- cgit v1.2.3-54-g00ecf From c39f31e51d37feb711252cb580683a665db7af33 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 14 Dec 2004 17:51:58 -0800 Subject: [PATCH] fix 'make clean' error in klibc --- klibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/klibc/Makefile b/klibc/Makefile index 2506417ef5..8823a33bfd 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -1,5 +1,5 @@ VERSION := $(shell cat version) -SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip +SUBDIRS = klibc all: -- cgit v1.2.3-54-g00ecf From e3686a8858ff0797af5daf97eef8c0fe08b5f46f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 14 Dec 2004 23:00:33 -0800 Subject: [PATCH] 049 release --- ChangeLog | 24 ++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ac004fd4c..f0f01b5446 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +Summary of changes from v048 to v049 +============================================ + +Greg Kroah-Hartman: + o fix 'make clean' error in klibc + +Kay Sievers: + o update klibc to 0.194 + o export DEVNAME regardless of the state of udev_dev_d + o add class specific files for class/spi_transport and class/spi_host + o udevd-test.pl: remove wrong date calculation + o check earlier if we should run as udevstart + o remove double initialization + o include missing header to udevtest.c + o add -V option to udev to print the version number + o prevent udev node creatinon for "class" registration + o udevd: serialization of the event sequence of a chain of devices + o add a class/fc_host file to the list of what to wait for + o udev_volume_id: links sysfs.a instead of all objects + +Martin Schlemmer: + o remove leftover from udevinfo's -d option + + Summary of changes from v047 to v048 ============================================ diff --git a/Makefile b/Makefile index 01ebcc22b5..36c0b474ce 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 048 +VERSION = 049 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 56ca479113..cc6d53baa1 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 048 +Version: 049 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 0d9057a1cebf2058c36879278b7ba03a5c8ed81f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 15 Dec 2004 11:26:05 +0100 Subject: [PATCH] avoid building klibc test programs and pass SUBDIRS= to klibc clean --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 36c0b474ce..04ac59bcfc 100644 --- a/Makefile +++ b/Makefile @@ -193,7 +193,7 @@ $(CRT0): @if [ ! -r klibc/linux ]; then \ ln -f -s $(KERNEL_DIR) klibc/linux; \ fi - $(MAKE) -C klibc SUBDIRS=klibc + $(MAKE) -C klibc SUBDIRS=klibc TESTS= HEADERS = \ udev.h \ @@ -339,7 +339,7 @@ clean: | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) -rm -f ccdv - $(MAKE) -C klibc clean + $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ @@ -347,7 +347,7 @@ clean: done ; \ spotless: clean - $(MAKE) -C klibc spotless + $(MAKE) -C klibc SUBDIRS=klibc spotless -rm -f klibc/linux DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz" -e "\/\." -e releases -e BitKeeper -e SCCS -e test/sys | sort ) -- cgit v1.2.3-54-g00ecf From 18ebc4305034401648e343b27981ef1badafef1c Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 26 Apr 2005 23:15:56 -0700 Subject: bleah, more merge fixes... --- test/udev-test.pl | 4 +++- udev.c | 1 + udevinfo.c | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 593e34e885..3f9a848490 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -35,6 +35,9 @@ my $perm = "udev.permissions"; my $main_conf = "udev-test.conf"; my $conf_tmp = "udev-test.rules"; +# uncomment following line to run udev with valgrind. +# Should make this a runtime option to the script someday... +#my $udev_bin = "valgrind --tool=memcheck --leak-check=yes ../udev"; my @tests = ( { @@ -1260,7 +1263,6 @@ sub run_test { udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); - if ((-e "$PWD/$udev_root$config->{exp_name}") || (-l "$PWD/$udev_root$config->{exp_name}")) { diff --git a/udev.c b/udev.c index a9da014ea6..cf66e7cc89 100644 --- a/udev.c +++ b/udev.c @@ -118,6 +118,7 @@ int main(int argc, char *argv[], char *envp[]) udev_init_config(); /* set signal handlers */ + memset(&act, 0x00, sizeof(act)); act.sa_handler = (void (*) (int))sig_handler; sigemptyset (&act.sa_mask); act.sa_flags = 0; diff --git a/udevinfo.c b/udevinfo.c index ce9804e216..116aedbc21 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -401,7 +401,7 @@ print: break; case PATH: - strfieldcpy(result, path); + strfieldcpy(result, udev.devpath); break; case ALL: -- cgit v1.2.3-54-g00ecf From 82ca88904d1c9bf17f4434f54e12754c00eddcbd Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 15 Dec 2004 11:27:10 +0100 Subject: [PATCH] klibc supports LOG_PID now, so remove our own implementation --- logging.h | 24 +++++++++--------------- udev.c | 1 - udevd.c | 1 - udevinfo.c | 1 - udevsend.c | 1 - udevtest.c | 1 - 6 files changed, 9 insertions(+), 20 deletions(-) diff --git a/logging.h b/logging.h index 30f52c84ce..4f51217b9a 100644 --- a/logging.h +++ b/logging.h @@ -35,18 +35,16 @@ #include #include -#define LOGNAME_SIZE 42 - #undef info -#define info(format, arg...) \ - do { \ - log_message(LOG_INFO , format , ## arg); \ +#define info(format, arg...) \ + do { \ + log_message(LOG_INFO , format , ## arg); \ } while (0) #ifdef DEBUG #undef dbg -#define dbg(format, arg...) \ - do { \ +#define dbg(format, arg...) \ + do { \ log_message(LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ } while (0) #endif @@ -54,8 +52,8 @@ /* Parser needs it's own debugging statement, we usually don't care about this at all */ #ifdef DEBUG_PARSER #undef dbg_parse -#define dbg_parse(format, arg...) \ - do { \ +#define dbg_parse(format, arg...) \ + do { \ log_message(LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ } while (0) #endif @@ -63,14 +61,10 @@ extern void log_message(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); -/* each program that uses syslog must declare this variable somewhere */ -extern unsigned char logname[LOGNAME_SIZE]; - #undef logging_init -static inline void logging_init(char *program_name) +static inline void logging_init(const char *program_name) { - snprintf(logname, LOGNAME_SIZE,"%s[%d]", program_name, getpid()); - openlog(logname, 0, LOG_DAEMON); + openlog(program_name, LOG_PID, LOG_DAEMON); } #undef logging_close diff --git a/udev.c b/udev.c index cf66e7cc89..0895e437ba 100644 --- a/udev.c +++ b/udev.c @@ -41,7 +41,6 @@ #ifdef LOG -unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) { va_list args; diff --git a/udevd.c b/udevd.c index 2e6f5793d3..91189eb861 100644 --- a/udevd.c +++ b/udevd.c @@ -64,7 +64,6 @@ static void reap_sigchilds(void); char *udev_bin; #ifdef LOG -unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) { va_list args; diff --git a/udevinfo.c b/udevinfo.c index 116aedbc21..00af081eac 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -39,7 +39,6 @@ #define SYSFS_VALUE_SIZE 256 #ifdef LOG -unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) { va_list args; diff --git a/udevsend.c b/udevsend.c index 16174f5e46..74cc09b330 100644 --- a/udevsend.c +++ b/udevsend.c @@ -44,7 +44,6 @@ static int sock = -1; #ifdef LOG -unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) { va_list args; diff --git a/udevtest.c b/udevtest.c index 388818d495..4b94442608 100644 --- a/udevtest.c +++ b/udevtest.c @@ -37,7 +37,6 @@ #ifdef LOG -unsigned char logname[LOGNAME_SIZE]; void log_message (int level, const char *format, ...) { va_list args; -- cgit v1.2.3-54-g00ecf From 83c35223ed164b95f53633b97846d0963c7bcea9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 16 Dec 2004 16:05:01 +0100 Subject: [PATCH] update libsysfs to CVS version and fix segfaulting attribute reading --- libsysfs/sysfs_class.c | 3 +++ libsysfs/sysfs_device.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index db59aef90f..a132bb64cb 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -640,6 +640,9 @@ struct sysfs_attribute *sysfs_get_classdev_attr return cur; } + if (clsdev->directory == NULL) + return NULL; + if (clsdev->directory->subdirs == NULL) if ((sysfs_read_dir_subdirs(clsdev->directory)) != 0 || clsdev->directory->subdirs == NULL) diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index f2f8d2d611..83c3adc080 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -24,7 +24,9 @@ #include "sysfs.h" /** - * get_dev_driver: fills in the dev->driver_name field + * get_dev_driver: fills in the dev->driver_name field, but searches by + * opening subsystem. Only to be used if no driver link exists in + * device directory. * * Returns 0 on SUCCESS and 1 on error */ @@ -73,6 +75,32 @@ static int get_dev_driver(struct sysfs_device *dev) } return 1; } + +/* + * get_device_driver_name: gets device's driver name, searches for driver + * link first before going the brute force route. + * @dev: device to retrieve driver + * returns 0 with success and 1 with error + */ +static int get_device_driver_name(struct sysfs_device *dev) +{ + char devpath[SYSFS_PATH_MAX], drvpath[SYSFS_PATH_MAX]; + + if (dev == NULL) { + errno = EINVAL; + return 1; + } + memset(devpath, 0, SYSFS_PATH_MAX); + memset(drvpath, 0, SYSFS_PATH_MAX); + safestrcpy(devpath, dev->path); + safestrcat(devpath, "/driver"); + + if ((sysfs_get_link(devpath, drvpath, SYSFS_PATH_MAX)) != 0) + return(get_dev_driver(dev)); + + return (sysfs_get_name_from_path(drvpath, dev->driver_name, + SYSFS_NAME_LEN)); +} /** * sysfs_get_device_bus: retrieves the bus name the device is on, checks path @@ -262,7 +290,7 @@ struct sysfs_device *sysfs_open_device_path(const char *path) if (sysfs_get_device_bus(dev) != 0) dprintf("Could not get device bus\n"); - if (get_dev_driver(dev) != 0) { + if (get_device_driver_name(dev) != 0) { dprintf("Could not get device %s's driver\n", dev->bus_id); safestrcpy(dev->driver_name, SYSFS_UNKNOWN); } -- cgit v1.2.3-54-g00ecf From b817644b5b4bdb805c55cbec749258b7ff545f51 Mon Sep 17 00:00:00 2001 From: "harald@redhat.com" Date: Fri, 17 Dec 2004 03:59:22 +0100 Subject: [PATCH] selinux patch https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=142713 /sbin/udevstart segfaults on an ATIIXP chipset which is not supported well by the kernel yet. There, /proc/ide/hda/media can not be read (EIO error) and udevstart seems to give a null-pointer to an SELinux function checking the media-type. --- selinux.h | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/selinux.h b/selinux.h index 38c60a3588..df5bab69d7 100644 --- a/selinux.h +++ b/selinux.h @@ -30,31 +30,40 @@ static inline int selinux_get_media(char *path, int mode, char **media) FILE *fp; char buf[PATH_MAX]; char mediabuf[PATH_MAX]; + int ret = -1; *media = NULL; if (!(mode && S_IFBLK)) { return -1; } - snprintf(buf,sizeof(buf), "/proc/ide/%s/media", basename(path)); + + snprintf(buf, sizeof(buf), "/proc/ide/%s/media", basename(path)); + fp=fopen(buf,"r"); - if (fp) { - if (fgets(mediabuf,sizeof(mediabuf), fp)) { - int size = strlen(mediabuf); - while (size-- > 0) { - if (isspace(mediabuf[size])) { - mediabuf[size]='\0'; - } else { - break; - } - } - *media = strdup(mediabuf); - info("selinux_get_media(%s)->%s \n", path, *media); + if (!fp) + goto out; + + mediabuf[0] = '\0'; + + if (fgets(mediabuf, sizeof(mediabuf), fp) == NULL) + goto close_out; + + int size = strlen(mediabuf); + while (size-- > 0) { + if (isspace(mediabuf[size])) { + mediabuf[size]='\0'; + } else { + break; } - fclose(fp); - return 0; - } else { - return -1; } + *media = strdup(mediabuf); + info("selinux_get_media(%s)->%s \n", path, *media); + ret = 0; + +close_out: + fclose(fp); +out: + return ret; } static inline void selinux_setfilecon(char *file, unsigned int mode) -- cgit v1.2.3-54-g00ecf From 35413b2b88838de180ccfe6e2307c04caf24c393 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 18 Dec 2004 05:52:25 -0800 Subject: [PATCH] 050 release --- ChangeLog | 15 +++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f0f01b5446..4f34bacdb2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Summary of changes from v049 to v050 +============================================ + +: + o selinux patch + +: + o I made some more changes to the manpage of udev including + +Kay Sievers: + o update libsysfs to CVS version and fix segfaulting attribute reading + o klibc supports LOG_PID now, so remove our own implementation + o avoid building klibc test programs and pass SUBDIRS= to klibc clean + + Summary of changes from v048 to v049 ============================================ diff --git a/Makefile b/Makefile index 04ac59bcfc..4fc6ce72ef 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 049 +VERSION = 050 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index cc6d53baa1..c0aacc954c 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 049 +Version: 050 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From ce5c75b8e1ea17aeb4b7e117e934c6df0f550ee3 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Sat, 18 Dec 2004 06:19:12 -0800 Subject: [PATCH] fix udev_volume_id build error. bah, when will I remember to check the extras _before_ I do a release... --- extras/volume_id/udev_volume_id.c | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 9e8c3bfb11..3fab54786b 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -37,7 +37,6 @@ #define BLKGETSIZE64 _IOR(0x12,114,size_t) #ifdef LOG -unsigned char logname[LOGNAME_SIZE]; void log_message(int level, const char *format, ...) { va_list args; -- cgit v1.2.3-54-g00ecf From 3ac0326962c93f381bec325583e26f47fb7d4833 Mon Sep 17 00:00:00 2001 From: "tklauser@access.unizh.ch" Date: Sat, 18 Dec 2004 00:19:35 +0100 Subject: [PATCH] I made some more changes to the manpage of udev including: Patch-From: Tobias Klauser - Move the description of the environment variables to a new section called "ENVIRONMENT" (as stated in man(7)) - Pointer to the "official" udev homepage - Fixes for various typos and whitespace damages --- udev.8.in | 88 ++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/udev.8.in b/udev.8.in index 07bd7bce30..328f602e03 100644 --- a/udev.8.in +++ b/udev.8.in @@ -3,33 +3,6 @@ udev \- Linux configurable dynamic device naming support .SH SYNOPSIS .BI udev " hotplug-subsystem" -.P -The following variables are read from the environment: -.TP -.B ACTION -.IR add " or " remove -signifies the addition or the removal of a device. -.P -.B DEVPATH -The sysfs devpath of the device without the mountpoint but a leading slash. -.P -.B SUBSYSTEM -The subsystem the device belongs to. Alternatively the subsystem may -be passed as the first argument. -.P -.B UDEV_CONFIG_FILE -Overrides the default location of the -.B udev -config file. -.P -.B UDEV_NO_DEVD -The default behavior of -.B udev -is to execute programs in the -.I /etc/dev.d/ -directory after device handling. If set, -.B udev -will skip this step. .SH "DESCRIPTION" .B udev provides a dynamic device directory containing only the files for actually @@ -57,10 +30,9 @@ queries its database for the name of the device file to be deleted. .SH "CONFIGURATION" All .B udev -configuration files consist of a set of lines of text. All empty +configuration files consist of a set of lines of text. All empty lines or lines beginning with '#' will be ignored. .P - .B udev expects its main configuration file at .IR /etc/udev/udev.conf . @@ -111,7 +83,7 @@ file. The default value is .IR root . .br .P -.RI "A sample " udev.conf " might look like this: +.RI "A sample " udev.conf " file might look like this: .sp .nf # udev_root - where to place the device nodes in the filesystem @@ -186,7 +158,7 @@ Match the topological position on bus, like physical port of USB device .TP .BI SYSFS{ filename } Match sysfs device attribute like label, vendor, USB serial number, SCSI UUID -or file system label. Up to 5 different sysfs files can be checked, with +or file system label. Up to 5 different sysfs files can be checked, with all of the values being required to match the rule. .br Trailing whitespace characters in the sysfs attribute value are ignored, if @@ -215,12 +187,14 @@ should be renamed to. .br If given with the attribute .BR NAME{ all_partitions } -it will create all 15 partitions of a blockdevice. +.B udev +will create device nodes for all 15 partitions of a blockdevice. This may be useful for removable media devices. .br If given with the attribute .BR NAME{ ignore_remove } -it will will ignore any later remove event for this device. +.B udev +will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. .sp Multiple attributes may be separated by comma. @@ -293,7 +267,7 @@ The count of charcters to insert may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute. .P -.RI "A sample " udev.rules " might look like this:" +.RI "A sample " udev.rules " file might look like this:" .sp .nf # if /sbin/scsi_id returns "OEM 0815", the device will be called disk1 @@ -323,7 +297,6 @@ KERNEL="scd*", NAME="%k", SYMLINK="cdrom%e" KERNEL="pcd*", NAME="%k", SYMLINK="cdrom%e" KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom%e" - .fi .P The permissions and ownership of the created device file are read from @@ -339,7 +312,7 @@ Every line lists a device name followed by owner, group and permission mode. All values are separated by colons. The name field may contain a pattern to apply the values to a whole class of devices. .sp -.RI "A sample " udev.permissions " might look like this:" +.RI "A sample " udev.permissions " file might look like this:" .sp .nf #name:user:group:mode @@ -360,14 +333,14 @@ Matches any single character, but does not match zero characters. .TP .B [ ] Matches any single character specified within the brackets. For example, the -pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also -supported within this match with the '\-' character. For example, to match on +pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also +supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. .P After device node creation, removal, or network device renaming, .B udev -executes the programs in the directory tree under +executes the programs located in the directory tree under .IR /etc/dev.d/ . The name of a program must have the suffix .I .dev @@ -379,7 +352,7 @@ is set if udev is configured to use the syslog facility. Executed programs may want to follow that setting. .B DEVNAME is exported to make the name of the created node, or the name the network -device is renamed to, available to the executed program. The programs in every +device is renamed to, available to the executed program. The programs in every directory are sorted in lexical order, while the directories are searched in the following order: .sp @@ -388,6 +361,34 @@ the following order: /etc/dev.d/$(SUBSYSTEM)/*.dev /etc/dev.d/default/*.dev .fi +.SH "ENVIRONMENT" +.P +The following variables are read from the environment: +.TP +.B ACTION +.IR add " or " remove +signifies the addition or the removal of a device. +.TP +.B DEVPATH +The sysfs devpath of the device without the mountpoint but a leading slash. +.TP +.B SUBSYSTEM +The subsystem the device belongs to. Alternatively the subsystem may +be passed as the first argument. +.TP +.B UDEV_CONFIG_FILE +Overrides the default location of the +.B udev +config file. +.TP +.B UDEV_NO_DEVD +The default behavior of +.B udev +is to execute programs in the +.I /etc/dev.d/ +directory after device handling. If set, +.B udev +will skip this step. .SH "FILES" .nf /sbin/udev udev program @@ -395,15 +396,16 @@ the following order: /etc/hotplug.d/default/udev.hotplug hotplug symlink to udev program /etc/dev.d/* programs invoked by udev .fi -.LP .SH "SEE ALSO" .BR udevinfo (8), .BR udevd (8), .BR hotplug (8) .PP -The +.B Web resources: +.nf .I http://linux\-hotplug.sourceforge.net/ -web site. +.I http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html +.fi .SH AUTHORS .B udev was developed by Greg Kroah-Hartman with much help from -- cgit v1.2.3-54-g00ecf From 8b36cc0f179ee35176016ab67ae53078df4110fa Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 18 Dec 2004 11:34:17 +0100 Subject: [PATCH] complete removal of explicit udev permissions config file --- FAQ | 4 -- Makefile | 8 --- docs/rh_udev_for_dev.txt | 16 ++--- etc/udev/udev.conf.in | 9 +-- namedev.c | 47 +----------- namedev.h | 15 ---- namedev_parse.c | 170 +++---------------------------------------- test/devd_test | 1 - test/net_test | 1 - test/replace_test | 1 - test/udev-test.pl | 183 +++++------------------------------------------ test/udev.permissions | 22 ------ udev.8.in | 38 +--------- udev.c | 2 +- udev.h | 1 - udev.spec | 3 - udev_config.c | 10 --- 17 files changed, 38 insertions(+), 493 deletions(-) delete mode 100644 test/udev.permissions diff --git a/FAQ b/FAQ index 45337bf635..bd9d63a4d5 100644 --- a/FAQ +++ b/FAQ @@ -72,10 +72,6 @@ A: udev is entirely in userspace. If the kernel supports a greater number Q: Will udev support symlinks? A: Yes, It now does. Multiple symlinks per device node too. -Q: How will udev support changes to device permissions? -A: On shutdown, udev will save the state of existing device permissions to - its database, and then used the on the next boot time. - Q: How will udev handle the /dev filesystem? A: /dev can be a ramfs, or a backing filesystem. udev does not care what kind of filesystem it runs on. diff --git a/Makefile b/Makefile index 4fc6ce72ef..52c1d47b2d 100644 --- a/Makefile +++ b/Makefile @@ -284,7 +284,6 @@ udev_version.h: @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ - @echo \#define UDEV_PERMISSION_FILE \"$(configdir)/permissions.d\" >> $@ @echo \#define UDEV_LOG_DEFAULT \"yes\" >> $@ @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ @@ -381,7 +380,6 @@ small_release: $(DISTFILES) spotless install-config: $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d - $(INSTALL) -d $(DESTDIR)$(configdir)/permissions.d @if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ @@ -390,10 +388,6 @@ install-config: echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir)/rules.d/50-udev.rules; \ $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir)/rules.d/50-udev.rules; \ fi - @if [ ! -r $(DESTDIR)$(configdir)/permissions.d/50-udev.permissions ]; then \ - echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir)/permissions.d/50-udev.permissions; \ - $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.permissions $(DESTDIR)$(configdir)/permissions.d/50-udev.permissions; \ - fi install-dev.d: $(INSTALL) -d $(DESTDIR)$(dev_ddir)/default @@ -444,10 +438,8 @@ endif uninstall: uninstall-man uninstall-dev.d - rm $(hotplugdir)/10-udev.hotplug - rm $(configdir)/rules.d/50-udev.rules - - rm $(configdir)/permissions.d/50-udev.permissions - rm $(configdir)/udev.conf - rmdir $(configdir)/rules.d - - rmdir $(configdir)/permissions.d - rmdir $(configdir) - rm $(sbindir)/$(ROOT) - rm $(sbindir)/$(DAEMON) diff --git a/docs/rh_udev_for_dev.txt b/docs/rh_udev_for_dev.txt index 1a21c0e59b..0b66868d79 100644 --- a/docs/rh_udev_for_dev.txt +++ b/docs/rh_udev_for_dev.txt @@ -12,19 +12,13 @@ Q. I login as my normal self from the login screen and RH just hangs on an empty blue screen. What's wrong? A. You have some wrong permissions. I'm guessing you can probably log in as root - but not as your normal user. Basically you need to edit the - /etc/udev/udev.permissions file to set the correct permissions to the nodes - in /dev. I added the following: - - null:root:users:0666 - urandom:root:users:0644 - - setting the correct permissions to null and urandom allowed me to login - as myself and not at root. + but not as your normal user. Basically you need to set the right + permissions with a rule. Setting the correct permissions to null and urandom + allowed me to login as myself and not at root. While you are there you might want to set the permissions to ptmx as well - or you may have trouble getting a bash prompt in an xterm. i.e. - ptmx:root:users:0666 Also refer to the next question. + or you may have trouble getting a bash prompt in an xterm. Also refer to the + next question. Q. I'm having trouble getting a bash prompt from my xterm. i.e. I bring up a terminal and all I have is a blank screen with a blinking cursor. diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index bbbb1a93a2..295e39ffd2 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -14,19 +14,16 @@ udev_db="@udevdir@/.udevdb" # udev_rules - The name and location of the udev rules file udev_rules="@configdir@/rules.d" -# udev_permissions - The name and location of the udev permission file -udev_permissions="@configdir@/permissions.d" - # default_mode - set the default mode for all nodes that have no -# explicit match in the permissions file +# permissions specified default_mode="0600" # default_owner - set the default owner for all nodes that have no -# explicit match in the permissions file + # permissions specified default_owner="root" # default_group - set the default group for all nodes that have no -# explicit match in the permissions file + # permissions specified default_group="root" # udev_log - set to "yes" if you want logging, else "no" diff --git a/namedev.c b/namedev.c index 9cfc4283be..be7ae12cd5 100644 --- a/namedev.c +++ b/namedev.c @@ -43,10 +43,6 @@ static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr); -LIST_HEAD(config_device_list); -LIST_HEAD(perm_device_list); - - /* compare string with pattern (supports * ? [0-9] [!A-Z]) */ static int strcmp_pattern(const char *p, const char *s) { @@ -100,18 +96,6 @@ static int strcmp_pattern(const char *p, const char *s) return 1; } -static struct perm_device *find_perm_entry(const char *name) -{ - struct perm_device *perm; - - list_for_each_entry(perm, &perm_device_list, node) { - if (strcmp_pattern(perm->name, name)) - continue; - return perm; - } - return NULL; -} - /* extract possible {attr} and move str behind it */ static char *get_format_attribute(char **str) { @@ -694,7 +678,6 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d struct sysfs_class_device *class_dev_parent; struct sysfs_device *sysfs_device = NULL; struct config_device *dev; - struct perm_device *perm; char *pos; udev->mode = 0; @@ -792,18 +775,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d goto exit; perms: - /* apply permissions from permissions file to empty fields */ - perm = find_perm_entry(udev->name); - if (perm != NULL) { - if (udev->mode == 0000) - udev->mode = perm->mode; - if (udev->owner[0] == '\0') - strfieldcpy(udev->owner, perm->owner); - if (udev->group[0] == '\0') - strfieldcpy(udev->group, perm->group); - } - - /* apply permissions from config to empty fields */ + /* apply default permissions to empty fields */ if (udev->mode == 0000) udev->mode = default_mode; if (udev->owner[0] == '\0') @@ -817,20 +789,3 @@ perms: exit: return 0; } - -int namedev_init(void) -{ - int retval; - - retval = namedev_init_rules(); - if (retval) - return retval; - - retval = namedev_init_permissions(); - if (retval) - return retval; - - dump_config_dev_list(); - dump_perm_dev_list(); - return retval; -} diff --git a/namedev.h b/namedev.h index e29279243b..8a3569ec7c 100644 --- a/namedev.h +++ b/namedev.h @@ -58,7 +58,6 @@ struct sysfs_class_device; #define MAX_SYSFS_PAIRS 5 #define RULEFILE_SUFFIX ".rules" -#define PERMFILE_SUFFIX ".permissions" struct sysfs_pair { char file[FILE_SIZE]; @@ -88,26 +87,12 @@ struct config_device { int config_line; }; -struct perm_device { - struct list_head node; - - char name[NAME_SIZE]; - char owner[USER_SIZE]; - char group[USER_SIZE]; - unsigned int mode; -}; - extern struct list_head config_device_list; -extern struct list_head perm_device_list; extern int namedev_init(void); extern int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_dev); -extern int namedev_init_permissions(void); -extern int namedev_init_rules(void); extern void dump_config_dev(struct config_device *dev); extern void dump_config_dev_list(void); -extern void dump_perm_dev(struct perm_device *dev); -extern void dump_perm_dev_list(void); #endif diff --git a/namedev_parse.c b/namedev_parse.c index 5b8c5ab2d6..7190cdd1a8 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -40,6 +40,7 @@ #include "logging.h" #include "namedev.h" +LIST_HEAD(config_device_list); static int add_config_dev(struct config_device *new_dev) { @@ -74,53 +75,6 @@ void dump_config_dev_list(void) dump_config_dev(dev); } -static int add_perm_dev(struct perm_device *new_dev) -{ - struct perm_device *dev; - struct perm_device *tmp_dev; - - /* if we already have that entry, just update the values */ - list_for_each_entry(dev, &perm_device_list, node) { - if (strcmp(new_dev->name, dev->name) != 0) - continue; - - /* don't overwrite values from earlier entries */ - if (dev->mode == 0000) - dev->mode = new_dev->mode; - if (dev->owner[0] == '\0') - strfieldcpy(dev->owner, new_dev->owner); - if (dev->owner[0] == '\0') - strfieldcpy(dev->group, new_dev->group); - - return 0; - } - - /* not found, add new structure to the perm list */ - tmp_dev = malloc(sizeof(*tmp_dev)); - if (!tmp_dev) - return -ENOMEM; - - memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); - list_add_tail(&tmp_dev->node, &perm_device_list); - /* dump_perm_dev(tmp_dev); */ - - return 0; -} - -void dump_perm_dev(struct perm_device *dev) -{ - dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", - dev->name, dev->owner, dev->group, dev->mode); -} - -void dump_perm_dev_list(void) -{ - struct perm_device *dev; - - list_for_each_entry(dev, &perm_device_list, node) - dump_perm_dev(dev); -} - /* extract possible KEY{attr} */ static char *get_key_attribute(char *str) { @@ -143,7 +97,7 @@ static char *get_key_attribute(char *str) return NULL; } -static int namedev_parse_rules(const char *filename, void *data) +static int namedev_parse(const char *filename, void *data) { char line[LINE_SIZE]; char *bufline; @@ -362,124 +316,18 @@ error: return retval; } -static int namedev_parse_permissions(const char *filename, void *data) +int namedev_init(void) { - char line[LINE_SIZE]; - char *bufline; - char *temp; - char *temp2; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - int retval = 0; - struct perm_device dev; - int lineno; + struct stat stats; + int retval; - if (file_map(filename, &buf, &bufsize) == 0) { - dbg("reading '%s' as permissions file", filename); - } else { - dbg("can't open '%s' as permissions file", filename); + if (stat(udev_rules_filename, &stats) != 0) return -1; - } - - /* loop through the whole file */ - cur = 0; - lineno = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; - - if (count >= LINE_SIZE) { - info("line too long, rule skipped %s, line %d", - filename, lineno); - continue; - } - - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) - continue; - - /* see if this is a comment */ - if (bufline[0] == COMMENT_CHARACTER) - continue; - - strncpy(line, bufline, count); - line[count] = '\0'; - dbg_parse("read '%s'", line); - - /* parse the line */ - memset(&dev, 0x00, sizeof(struct perm_device)); - temp = line; - - temp2 = strsep(&temp, ":"); - if (!temp2) { - dbg("cannot parse line '%s'", line); - continue; - } - strfieldcpy(dev.name, temp2); - - temp2 = strsep(&temp, ":"); - if (!temp2) { - dbg("cannot parse line '%s'", line); - continue; - } - strfieldcpy(dev.owner, temp2); - temp2 = strsep(&temp, ":"); - if (!temp2) { - dbg("cannot parse line '%s'", line); - continue; - } - strfieldcpy(dev.group, temp2); - - if (!temp) { - dbg("cannot parse line '%s'", line); - continue; - } - dev.mode = strtol(temp, NULL, 8); - - dbg_parse("name='%s', owner='%s', group='%s', mode=%#o", - dev.name, dev.owner, dev.group, dev.mode); - - retval = add_perm_dev(&dev); - if (retval) { - dbg("add_perm_dev returned with error %d", retval); - goto exit; - } - } - -exit: - file_unmap(buf, bufsize); - return retval; -} - -int namedev_init_rules(void) -{ - struct stat stats; - - stat(udev_rules_filename, &stats); if ((stats.st_mode & S_IFMT) != S_IFDIR) - return namedev_parse_rules(udev_rules_filename, NULL); + retval = namedev_parse(udev_rules_filename, NULL); else - return call_foreach_file(namedev_parse_rules, udev_rules_filename, - RULEFILE_SUFFIX, NULL); -} + retval = call_foreach_file(namedev_parse, udev_rules_filename, RULEFILE_SUFFIX, NULL); -int namedev_init_permissions(void) -{ - struct stat stats; - - stat(udev_permissions_filename, &stats); - if ((stats.st_mode & S_IFMT) != S_IFDIR) - return namedev_parse_permissions(udev_permissions_filename, NULL); - else - return call_foreach_file(namedev_parse_permissions, udev_permissions_filename, - PERMFILE_SUFFIX, NULL); + return retval; } diff --git a/test/devd_test b/test/devd_test index 6e4c206352..269c2b11da 100644 --- a/test/devd_test +++ b/test/devd_test @@ -16,7 +16,6 @@ cat > $CONFIG << EOF udev_root="$PWD/udev/" udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" -udev_permissions="$PWD/udev.permissions" EOF mkdir udev diff --git a/test/net_test b/test/net_test index ec0dea4642..9686f99258 100644 --- a/test/net_test +++ b/test/net_test @@ -15,7 +15,6 @@ cat > $CONFIG << EOF udev_root="$PWD/udev/" udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" -udev_permissions="$PWD/udev.permissions" EOF mkdir udev diff --git a/test/replace_test b/test/replace_test index 9445b7262a..19260765ba 100644 --- a/test/replace_test +++ b/test/replace_test @@ -15,7 +15,6 @@ cat > $CONFIG << EOF udev_root="$PWD/udev/" udev_db="$PWD/udev/.udevdb" udev_rules="$PWD/$RULES" -udev_permissions="$PWD/udev.permissions" EOF mkdir udev diff --git a/test/udev-test.pl b/test/udev-test.pl index 3f9a848490..8ee8ba5414 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -31,7 +31,6 @@ my $sysfs = "sys/"; my $udev_bin = "../udev"; my $udev_root = "udev-root/"; # !!! directory will be removed !!! my $udev_db = ".udevdb"; -my $perm = "udev.permissions"; my $main_conf = "udev-test.conf"; my $conf_tmp = "udev-test.rules"; @@ -503,167 +502,17 @@ BUS="scsi", SYSFS{whitespace_test}="WHITE SPACE ", NAME="matched-with-space" EOF }, { - desc => "permissions test", - subsys => "block", - devpath => "/block/sda", - exp_name => "node", - exp_perms => "5000::0444", - conf => < "permissions ttyUSB0:root:uucp:0660", - subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "ttyUSB0", - exp_perms => "0:14:0660", - conf => < "permissions tty0::root:0444", - subsys => "tty", - devpath => "/class/tty/tty0", - exp_name => "tty0", - exp_perms => "0:0:0444", - conf => < "permissions tty1:root::0555", - subsys => "tty", - devpath => "/class/tty/tty1", - exp_name => "tty1", - exp_perms => "0:0:0555", - conf => < "permissions tty2:::0777", - subsys => "tty", - devpath => "/class/tty/tty2", - exp_name => "tty2", - exp_perms => "0:0:0777", - conf => < "permissions tty3::: (default mode applied)", - subsys => "tty", - devpath => "/class/tty/tty3", - exp_name => "tty3", - exp_perms => "0:0:600", - conf => < "permissions i2c-300:root:sys:0744", - subsys => "i2c-dev", - devpath => "/class/i2c-dev/i2c-300", - exp_name => "i2c-300", - exp_perms => "0:3:0744", - conf => < "permissions i2c-fake1:root:7:0007", - subsys => "i2c-dev", - devpath => "/class/i2c-dev/i2c-fake1", - exp_name => "i2c-fake1", - exp_perms => "0:7:0007", - conf => < "permissions ttyS[01]:0:5:0700", - subsys => "tty", - devpath => "/class/tty/ttyS1", - exp_name => "ttyS1", - exp_perms => "0:5:0700", - conf => < "permissions ttyS[4-9]:tty:5:0060", - subsys => "tty", - devpath => "/class/tty/ttyS7", - exp_name => "ttyS7", - exp_perms => "0:5:0060", - conf => < "permissions tty4:0:5:0707", - subsys => "ttyS4", - devpath => "/class/tty/tty4", - exp_name => "tty4", - exp_perms => "0:5:0707", - conf => < "permissions tty4?:0:5:0007", - subsys => "tty", - devpath => "/class/tty/tty44", - exp_name => "tty44", - exp_perms => "0:5:0007", - conf => < "permissions tty3[!3]:::0467", - subsys => "tty", - devpath => "/class/tty/tty35", - exp_name => "tty35", - exp_perms => "0:0:0467", - conf => < "permissions tty33:bad:name:0500", + desc => "permissions USER=bad GROUP=name", subsys => "tty", devpath => "/class/tty/tty33", exp_name => "tty33", - exp_perms => "0:0:0500", - conf => < "permissions rtc:0:users:0600", - subsys => "misc", - devpath => "/class/misc/rtc", - exp_name => "misc/rtc", - exp_perms => "0:100:0600", + exp_perms => "0:0:0600", conf => < "permissions misc:0:users:0600", - subsys => "misc", - devpath => "/class/misc/psaux", - exp_name => "misc/psaux", - exp_perms => "0:100:0600", - conf => < "permissions set OWNER=5000", + desc => "permissions OWNER=5000", subsys => "block", devpath => "/block/sda", exp_name => "node", @@ -673,7 +522,7 @@ BUS="scsi", KERNEL="sda", NAME="node", OWNER="5000" EOF }, { - desc => "permissions set GROUP=100", + desc => "permissions GROUP=100", subsys => "block", devpath => "/block/sda", exp_name => "node", @@ -683,7 +532,7 @@ BUS="scsi", KERNEL="sda", NAME="node", GROUP="100" EOF }, { - desc => "permissions set mode=0777", + desc => "permissions MODE=0777", subsys => "block", devpath => "/block/sda", exp_name => "node", @@ -693,7 +542,7 @@ BUS="scsi", KERNEL="sda", NAME="node", MODE="0777" EOF }, { - desc => "permissions set OWNER=5000 GROUP=100 MODE=0777", + desc => "permissions OWNER=5000 GROUP=100 MODE=0777", subsys => "block", devpath => "/block/sda", exp_name => "node", @@ -703,37 +552,37 @@ BUS="scsi", KERNEL="sda", NAME="node", OWNER="5000", GROUP="100", MODE="0777" EOF }, { - desc => "permissions override OWNER to 5000", + desc => "permissions OWNER to 5000", subsys => "tty", devpath => "/class/tty/ttyUSB0", exp_name => "ttyUSB0", - exp_perms => "5000:14:0660", + exp_perms => "5000::", conf => < "permissions override GROUP to 100", + desc => "permissions GROUP to 100", subsys => "tty", devpath => "/class/tty/ttyUSB0", exp_name => "ttyUSB0", - exp_perms => ":100:0660", + exp_perms => ":100:0600", conf => < "permissions override MODE to 0060", + desc => "permissions MODE to 0060", subsys => "tty", devpath => "/class/tty/ttyUSB0", exp_name => "ttyUSB0", - exp_perms => ":14:0060", + exp_perms => "::0060", conf => < "permissions override OWNER, GROUP, MODE", + desc => "permissions OWNER, GROUP, MODE", subsys => "tty", devpath => "/class/tty/ttyUSB0", exp_name => "ttyUSB0", @@ -1336,7 +1185,9 @@ open CONF, ">$main_conf" || die "unable to create config file: $main_conf"; print CONF "udev_root=\"$udev_root\"\n"; print CONF "udev_db=\"$udev_db\"\n"; print CONF "udev_rules=\"$conf_tmp\"\n"; -print CONF "udev_permissions=\"$perm\"\n"; +print CONF "default_mode=\"0600\"\n"; +print CONF "default_owner=\"root\"\n"; +print CONF "default_group=\"root\"\n"; close CONF; my $test_num = 1; diff --git a/test/udev.permissions b/test/udev.permissions deleted file mode 100644 index b7baeea7b4..0000000000 --- a/test/udev.permissions +++ /dev/null @@ -1,22 +0,0 @@ -#name:user:group:mode -ttyUSB0:root:uucp:0660 -ttyUSB1:root:uucp:0666 -visor:500:500:0666 -dsp1:::0666 -boot_disk?:::0666 - -#used for permissions tests in udev-test.pl -tty0::root:0444 -tty1:root::0555 -tty2:::0777 -tty3::: -rtc:0:6:0770 -misc/*:0:users:0600 -i2c-fake1:root:7:0007 -i2c*:root:sys:0744 -ttyS[01]:0:5:0700 -ttyS[5-9]:root:5:0060 -tty4::tty:0707 -tty4?::tty:0007 -tty3[!3]:::0467 -tty33:bad:name:0500 diff --git a/udev.8.in b/udev.8.in index 328f602e03..90b7d83309 100644 --- a/udev.8.in +++ b/udev.8.in @@ -55,13 +55,6 @@ The name of the udev rules file or directory to look for files with the suffix All rule files are read in lexical order. The default value is .IR /etc/udev/rules.d/ . .TP -.B udev_permissions -The name of the udev permission file or directory to look for files with the -suffix -.IR .permissions . -All permission files are read in lexical order. The default value is -.IR /etc/udev/permissions.d/ . -.TP .B udev_log The switch to enable/disable logging of udev information The default value is @@ -96,10 +89,6 @@ udev_db="/udev/.udevdb" for files with the suffix .rules udev_rules="/etc/udev/rules.d/" -# udev_permissions - The name of the udev permission file or directory - to look for files with the suffix .permissions -udev_permissions="/etc/udev/udev.permissions" - # udev_log - set to "yes" if you want logging, else "no" udev_log="yes" @@ -214,8 +203,8 @@ separate rules file, while the device nodes are maintained by the distribution provided rules file. .TP .B OWNER, GROUP, MODE -The permissions for this device. Every specified value overwrites the value -given in the permissions file. +The permissions for this device. Every specified value overwrites the default +value specified in the config file. .P .RB "The " NAME " ," SYMLINK " and " PROGRAM fields support simple printf-like string substitutions: @@ -299,29 +288,6 @@ KERNEL="hd[a-z]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom%e" .fi .P -The permissions and ownership of the created device file are read from -the files located in the -.I /etc/udev/permissions.d/ -directory, or at the location specified by the -.I udev_permission -value in the -.I /etc/udev/udev.conf -file. -.br -Every line lists a device name followed by owner, group and permission -mode. All values are separated by colons. The name field may contain a -pattern to apply the values to a whole class of devices. -.sp -.RI "A sample " udev.permissions " file might look like this:" -.sp -.nf -#name:user:group:mode -input/*:root:root:644 -ttyUSB1:0:8:0660 -video*:root:video:0660 -dsp1:::0666 -.fi -.P A number of different fields in the above configuration files support a simple form of shell style pattern matching. It supports the following pattern characters: .TP diff --git a/udev.c b/udev.c index 0895e437ba..e5d7800ecf 100644 --- a/udev.c +++ b/udev.c @@ -187,7 +187,7 @@ int main(int argc, char *argv[], char *envp[]) wait_for_class_device(class_dev, &error); - /* init rules, permissions */ + /* init rules */ namedev_init(); /* name, create node, store in db */ diff --git a/udev.h b/udev.h index 7038376b3c..0111644eff 100644 --- a/udev.h +++ b/udev.h @@ -80,7 +80,6 @@ extern void udev_multiplex_directory(struct udevice *udev, const char *basedir, extern char sysfs_path[SYSFS_PATH_MAX]; extern char udev_root[PATH_MAX]; extern char udev_db_path[PATH_MAX+NAME_MAX]; -extern char udev_permissions_filename[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; extern mode_t default_mode; diff --git a/udev.spec b/udev.spec index c0aacc954c..46eaf698f8 100644 --- a/udev.spec +++ b/udev.spec @@ -98,7 +98,6 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %doc COPYING README TODO ChangeLog HOWTO* docs/* %doc etc/udev/udev.rules.{examples,gentoo,redhat} -%doc etc/udev/udev.permissions.{gentoo,redhat} %attr(755,root,root) /sbin/udev %attr(755,root,root) /usr/bin/udevinfo %attr(755,root,root) /sbin/udevsend @@ -109,9 +108,7 @@ rm -rf $RPM_BUILD_ROOT %attr(755,root,root) %dir /etc/udev/ %config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf %attr(755,root,root) %dir /etc/udev/rules.d/ -%attr(755,root,root) %dir /etc/udev/permissions.d/ %config(noreplace) %attr(0644,root,root) /etc/udev/rules.d/50-udev.rules -%config(noreplace) %attr(0644,root,root) /etc/udev/permissions.d/50-udev.permissions %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(755,root,root) /etc/init.d/udev %attr(0644,root,root) %{_mandir}/man8/udev*.8* diff --git a/udev_config.c b/udev_config.c index 62eb728ea3..a5f6467748 100644 --- a/udev_config.c +++ b/udev_config.c @@ -43,7 +43,6 @@ char sysfs_path[SYSFS_PATH_MAX]; char udev_root[PATH_MAX]; char udev_db_path[PATH_MAX+NAME_MAX]; -char udev_permissions_filename[PATH_MAX+NAME_MAX]; char udev_rules_filename[PATH_MAX+NAME_MAX]; char udev_config_filename[PATH_MAX+NAME_MAX]; mode_t default_mode; @@ -74,7 +73,6 @@ static void init_variables(void) strcpy(udev_db_path, UDEV_DB); strcpy(udev_config_filename, UDEV_CONFIG_FILE); strcpy(udev_rules_filename, UDEV_RULES_FILE); - strcpy(udev_permissions_filename, UDEV_PERMISSION_FILE); strcpy(default_owner, "root"); strcpy(default_group, "root"); @@ -206,12 +204,6 @@ static int parse_config_file(void) continue; } - if (strcasecmp(variable, "udev_permissions") == 0) { - strfieldcpy(udev_permissions_filename, value); - no_trailing_slash(udev_permissions_filename); - continue; - } - if (strcasecmp(variable, "default_mode") == 0) { default_mode = strtol(value, NULL, 8); continue; @@ -267,7 +259,6 @@ static void get_dirs(void) dbg_parse("udev_config_filename = %s", udev_config_filename); dbg_parse("udev_db_path = %s", udev_db_path); dbg_parse("udev_rules_filename = %s", udev_rules_filename); - dbg_parse("udev_permissions_filename = %s", udev_permissions_filename); dbg_parse("udev_log = %d", udev_log); parse_config_file(); @@ -276,7 +267,6 @@ static void get_dirs(void) dbg("udev_config_filename = %s", udev_config_filename); dbg("udev_db_path = %s", udev_db_path); dbg("udev_rules_filename = %s", udev_rules_filename); - dbg("udev_permissions_filename = %s", udev_permissions_filename); dbg("udev_log = %d", udev_log); } -- cgit v1.2.3-54-g00ecf From 1e473f4c45f8cfd233f5731b2282074f5d8e054e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 18 Dec 2004 12:20:41 +0100 Subject: [PATCH] update Fedora config files --- etc/udev/redhat/udev.rules | 172 +++++++++++++++++---------------------------- 1 file changed, 63 insertions(+), 109 deletions(-) diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index 0a43358bad..6605915446 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -1,53 +1,15 @@ -# /etc/udev/udev.rules: device naming rules for udev -# # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. - -########################################################### # -# Add your own rules here (examples are commented) +# See the udev.rules.examples file for more examples of how to create rules # -########################################################### - -# Looking for scsi bus id 42:0:0:1 -#BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" - -# A usb camera. -#BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n" - -# USB Epson printer to be called lp_epson -#BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" - -# USB HP printer to be called lp_hp -#BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp" - -# sound card with PCI bus id 00:0b.0 to be the first sound card -#BUS="pci", ID="00:0b.0", NAME="dsp" - -# sound card with PCI bus id 00:07.1 to be the second sound card -#BUS="pci", ID="00:07.1", NAME="dsp1" - -# USB mouse plugged into the third port of the first hub to be called mouse0 -#BUS="usb", PLACE="1.3", NAME="mouse0" - -# USB tablet plugged into the third port of the second hub to be called mouse1 -#BUS="usb", PLACE="2.3", NAME="mouse1" -#BUS="usb", PLACE="2.4", NAME="mouse2" -# ttyUSB1 should always be called visor -#KERNEL="ttyUSB1", NAME="visor" -#KERNEL="ttyUSB0", NAME="pl2303" +# create a symlink named after the device map name +# note devmap_name comes with extras/multipath +#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" - -########################################################### -# -# For devfs similar /dev layout (neater) -# -########################################################### - -# devfs-names for ide-devices (uncomment only one) -# /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" +# DRI devices always go into a subdirectory (as per the LSB spec) +KERNEL="card*", NAME="dri/card%n" # alsa devices KERNEL="controlC[0-9]*", NAME="snd/%k" @@ -57,69 +19,61 @@ KERNEL="midi[CD0-9]*", NAME="snd/%k" KERNEL="timer", NAME="snd/%k" KERNEL="seq", NAME="snd/%k" -# dm devices (ignore them) -KERNEL="dm-[0-9]*", NAME="" -KERNEL="device-mapper", NAME="mapper/control" - -# fb devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" - -# floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" - -# i2c devices -KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" - # input devices -KERNEL="mice", NAME="input/mice" -KERNEL="mouse[0-9]*", NAME="input/mouse%n" -KERNEL="event[0-9]*", NAME="input/event%n" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" - -# loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" - -# md block devices -KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" - -# misc devices -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" - -# pty devices -KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="tty/s%n", SYMLINK="%k" - -# ramdisk devices -KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" - -# sound devices -KERNEL="adsp", NAME="sound/adsp" SYMLINK="%k" -KERNEL="audio", NAME="sound/audio", SYMLINK="%k" -KERNEL="dsp", NAME="sound/dsp", SYMLINK="%k" -KERNEL="mixer", NAME="sound/mixer", SYMLINK="%k" -KERNEL="sequencer", NAME="sound/sequencer", SYMLINK="%k" -KERNEL="sequencer2", NAME="sound/sequencer2", SYMLINK="%k" - -# tty devices -KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" -KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" - -# vc devices -KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" -KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" -KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" - -# v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n" -KERNEL="radio[0-9]*", NAME="v4l/radio%n" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" - +KERNEL="mice", NAME="input/%k" +KERNEL="mouse*", NAME="input/%k" +KERNEL="event*", NAME="input/%k" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + +KERNEL="raw[0-9]*", NAME="raw/%k" + +KERNEL="lp[0-9]*", SYMLINK="par%n" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" + +KERNEL="microcode", SYMLINK="cpu/0/%k" +KERNEL="ram1", SYMLINK="ram" +KERNEL="video0", SYMLINK="video" +KERNEL="radio0", SYMLINK="radio" +KERNEL="audio0", SYMLINK="audio" +KERNEL="dsp0", SYMLINK="dsp" +KERNEL="fb0", SYMLINK="fb" +KERNEL="qft0", SYMLINK="ftape" +KERNEL="isdnctrl0", SYMLINK="isdnctrl" +KERNEL="mixer0", SYMLINK="mixer" +KERNEL="ram0", SYMLINK="ramdisk" +KERNEL="sbpcd0", SYMLINK="sbpcd" +KERNEL="radio0", SYMLINK="radio" +KERNEL="tty0", SYMLINK="systty" +KERNEL="vbi0", SYMLINK="vbi" +KERNEL="null", SYMLINK="XOR" + +KERNEL="tun", NAME="net/%k" + +KERNEL="device-mapper", NAME="mapper/control" + +# old compat symlinks with enumeration +KERNEL="sr[0-9]*", SYMLINK="cdrom%e" +KERNEL="scd[0-9]*", SYMLINK="cdrom%e" +KERNEL="pcd[0-9]*", SYMLINK="cdrom%e" +KERNEL="fd[0-9]*", SYMLINK="floppy%e" +KERNEL="nst[0-9]*", SYMLINK="tape%e" + +KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/ide-media.sh %k", RESULT="floppy", SYMLINK="floppy%e, NAME{ignore_remove, all_partitions}="%k" + +KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", RESULT="cdrom", SYMLINK="cdrom%e" + +KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK="dvd%e" +KERNEL="sr[0-9]*", BUS="scsi", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK="dvd%e" + +KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK="cdwriter%e" +KERNEL="sr[0-9]*", BUS="scsi", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK="cdwriter%e" + +KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" +KERNEL="sr[0-9]*", BUS="scsi", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" + +# rename sr* to scd* +KERNEL="sr[0-9]*", BUS="scsi", NAME="scd%n" +KERNEL="hd[a-z]*", BUS="ide", SYSFS{removable}="1", NAME{ignore_remove}="%k" + +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" -- cgit v1.2.3-54-g00ecf From 09a9ba58c6eaa3a24652c5f1250b694cd6ba9494 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 18 Dec 2004 12:21:21 +0100 Subject: [PATCH] update Fedora config files --- etc/udev/redhat/udev.permissions | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/etc/udev/redhat/udev.permissions b/etc/udev/redhat/udev.permissions index c96663964f..00bdff4aaf 100644 --- a/etc/udev/redhat/udev.permissions +++ b/etc/udev/redhat/udev.permissions @@ -2,6 +2,8 @@ # console devices console:root:root:0600 +tty:root:root:0666 +tty[0-9]:root:tty:0660 tty[0-9][0-9]*:root:tty:0660 vc/[0-9]*:root:tty:0660 @@ -9,7 +11,6 @@ vc/[0-9]*:root:tty:0660 # Set this to 0660 if you only want users belonging to tty group # to be able to allocate PTYs ptmx:root:tty:0666 -tty:root:tty:0666 pty[p-za-e][0-9a-f]*:root:tty:0660 tty[p-za-e][0-9a-f]*:root:tty:0660 pty/m*:root:tty:0660 @@ -46,7 +47,7 @@ zero:root:root:0666 # misc devices nvram:root:root:0660 -rtc:root:root:0660 +rtc:root:root:0644 # floppy devices fd[01]*:root:floppy:0660 @@ -69,8 +70,8 @@ dmmidi*:root:root:0660 sndstat:root:root:0660 # optical devices -sr*:root:disk:660 -scd*:root:disk:660 +sr*:root:disk:0660 +scd*:root:disk:0660 pcd*:root:disk:0660 disk*:root:disk:0660 dvd:root:disk:0660 @@ -108,20 +109,20 @@ usb/dc2xx*:root:root:0600 usb/mdc800*:root:root:0600 # raw devices -ram*:root:disk:660 -raw/*:root:disk:660 +ram*:root:disk:0660 +raw/*:root:disk:0660 # disk devices -hd*:root:disk:660 -sd*:root:disk:660 -dasd*:root:disk:660 -ataraid*:root:disk:660 -loop*:root:disk:660 -md*:root:disk:660 -ide/*/*/*/*/*:root:disk:660 -discs/*/*:root:disk:660 -loop/*:root:disk:660 -md/*:root:disk:660 +hd*:root:disk:0660 +sd*:root:disk:0660 +dasd*:root:disk:0660 +ataraid*:root:disk:0660 +loop*:root:disk:0660 +md*:root:disk:0660 +ide/*/*/*/*/*:root:disk:0660 +discs/*/*:root:disk:0660 +loop/*:root:disk:0660 +md/*:root:disk:0660 # tape devices ht*:root:disk:0660 @@ -169,7 +170,7 @@ vttuner:root:root:0660 v4l/*:root:root:0660 # input devices -input/*:root:root:644 +input/*:root:root:0644 # gpm devices gpmctl:root:root:0700 @@ -192,3 +193,6 @@ usb/dabusb*:root:usb:0660 usb/mdc800*:root:usb:0660 usb/rio500:root:usb:0660 +# s390 devices +z90crypt:root:root:0666 + -- cgit v1.2.3-54-g00ecf From 878f3218e109df0afde4fe8936f6920295b282a4 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 18 Dec 2004 12:22:16 +0100 Subject: [PATCH] initial merge of gentoo udev.permissions into udev.rules --- etc/udev/gentoo/udev.rules | 151 ++++++++++++++++++++++++++++++++------------- 1 file changed, 109 insertions(+), 42 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 6a53e88d9d..0787bcc230 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -19,10 +19,17 @@ BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYM # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}", MODE="0660" + +# disk devices +KERNEL="sd*", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="dasd*", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="ataraid*", NAME="%k", GROUP="disk", MODE="0660" # dri devices -KERNEL="card*", NAME="dri/card%n" +KERNEL="card*", NAME="dri/card%n", GROUP="video", MODE="0660" +KERNEL="nvidia*", NAME="%k", GROUP="video", MODE="0660" +KERNEL="3dfx*", NAME="%k", GROUP="video", MODE="0660" # alsa devices KERNEL="controlC[0-9]*", NAME="snd/%k" @@ -52,30 +59,30 @@ KERNEL="device-mapper", NAME="mapper/control" KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" # floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k" +KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy", MODE="0660" # i2c devices KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" # input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse*", NAME="input/%k" -KERNEL="event*", NAME="input/%k" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" +KERNEL="mice", NAME="input/%k", MODE="0644" +KERNEL="mouse*", NAME="input/%k", MODE="0644" +KERNEL="event*", NAME="input/%k", MODE="0600" +KERNEL="js*", NAME="input/%k", MODE="664" +KERNEL="ts*", NAME="input/%k", MODE="0600" # loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k", GROUP="disk", MODE="0660" # md block devices -KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k" +KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k", GROUP="disk", MODE="0660" # misc devices KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k", MODE="0664" KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" -KERNEL="inotify", NAME="misc/%k", SYMLINK="%k" +KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666" # netlink devices KERNEL="route", NAME="netlink/%k" @@ -94,51 +101,69 @@ KERNEL="tap*", NAME="netlink/%k" # network devices KERNEL="tun", NAME="net/%k" -# pty devices -KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k" - # ramdisk devices KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" # raw devices -KERNEL="raw[0-9]*", NAME="raw/%k" +KERNEL="raw[0-9]*", NAME="raw/%k", GROUP="disk", MODE="0660" +KERNEL="ram*", NAME="%k", GROUP="disk", MODE="0660" # sound devices -KERNEL="adsp", NAME="sound/%k", SYMLINK="%k" -KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="audio", NAME="sound/%k", SYMLINK="%k" -KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="dsp", NAME="sound/%k", SYMLINK="%k" -KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="mixer", NAME="sound/%k", SYMLINK="%k" -KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k" -KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k" -KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k" +KERNEL="adsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="audio", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="dsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="mixer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" # tty devices -KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k" -KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" +KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" +KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty", MODE="0660" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty", MODE="0660" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0600" +KERNEL="ippp0", NAME="", GROUP="tty", MODE="0660" +KERNEL="isdn*", NAME="", GROUP="tty", MODE="0660" +KERNEL="dcbri*", NAME="", GROUP="tty", MODE="0660" +KERNEL="ircomm*", NAME="", GROUP="tty", MODE="0660" + +# pty devices +KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" +KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k", GROUP="tty", MODE="0660" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k", GROUP="tty", MODE="0660" + +# vc devices +KERNEL="vcs", NAME="vcc/0", SYMLINK="%k", GROUP="tty", MODE="0660" +KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k", GROUP="tty", MODE="0660" +KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k", GROUP="tty", MODE="0660" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k", GROUP="tty", MODE="0660" + +# memory devices¶ +KERNEL="random", NAME="%k", MODE="0666" +KERNEL="urandom", NAME="%k", MODE="0444" +KERNEL="mem", NAME="%k", MODE="0640" +KERNEL="kmem", NAME="%k", MODE="0640" +KERNEL="port", NAME="%k", MODE="0640" +KERNEL="full", NAME="%k", MODE="0666" +KERNEL="null", NAME="%k", MODE="0666" +KERNEL="zero", NAME="%k", MODE="0666" # usb devices KERNEL="hiddev*", NAME="usb/%k" KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k" +KERNEL="legousbtower*", NAME="usb/%k", GROUP="usb", MODE="0660" KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" - -# vc devices -KERNEL="vcs", NAME="vcc/0", SYMLINK="%k" -KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k" -KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k", GROUP="lp", MODE="0660" # v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n" -KERNEL="radio[0-9]*", NAME="v4l/radio%n" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" +KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n", GROUP="video", MODE="0660" +KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="video", MODE="0660" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video", MODE="0660" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video", MODE="0660" # Asterix Zaptel devices KERNEL="zapctl", NAME="zap/ctl" @@ -147,3 +172,45 @@ KERNEL="zapchannel", NAME="zap/channel" KERNEL="zappseudo", NAME="zap/pseudo" KERNEL="zap[0-9]*", NAME="zap/%n" +# pilot/palm devices +KERNEL="pilot", NAME="%k", GROUP="uucp", MODE="0660" +¶ +# jaz devices +KERNEL="jaz*", NAME="%k", GROUP="disk", MODE="0660" +¶ +# zip devices +KERNEL="pocketzip*", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="zip*", NAME="%k", GROUP="disk", MODE="0660" + +# ls120 devices +KERNEL="ls120", NAME="%k", GROUP="disk", MODE="0660" + +# lp devices +KERNEL="lp*", NAME="%k", GROUP="lp", MODE="0660" +KERNEL="irlpt", NAME="%k", GROUP="lp", MODE="0660" +KERNEL="usblp", NAME="%k", GROUP="lp", MODE="0660" +KERNEL="lp*", NAME="%k", GROUP="lp", MODE="0660" + +# tape devices +KERNEL="ht*", NAME="%k", GROUP="tape", MODE="0660" +KERNEL="nht*", NAME="%k", GROUP="tape", MODE="0660" +KERNEL="pt*", NAME="%k", GROUP="tape", MODE="0660" +KERNEL="npt*", NAME="%k", GROUP="tape", MODE="0660" +KERNEL="st*", NAME="%k", GROUP="tape", MODE="0660" +KERNEL="nst*", NAME="%k", GROUP="tape", MODE="0660" + +# diskonkey devices +KERNEL="diskonkey*", NAME="%k", GROUP="disk", MODE="0660" + +# rem_ide devices +KERNEL="microdrive*", NAME="%k", GROUP="disk", MODE="0660" + +# kbd devices +KERNEL="kbd", NAME="%k", MODE="0664" + +# Sony Vaio Jogdial sonypi device +KERNEL="sonypi", NAME="%k", MODE="0666" + +# gpm devices +KERNEL="gpmctl", NAME="%k", MODE="0700" + -- cgit v1.2.3-54-g00ecf From 90726e43c97721ae7367cb465ac7924813b59a9d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 18 Dec 2004 22:57:49 +0100 Subject: [PATCH] fix some typos in gentoo's udev.rules introduced by the merge --- etc/udev/gentoo/udev.rules | 70 +++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 0787bcc230..d91363c6d2 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -13,8 +13,8 @@ ########################################################### # cdrom symlinks and other good cdrom naming -BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" # devfs-names for ide-devices (uncomment only one) @@ -32,12 +32,12 @@ KERNEL="nvidia*", NAME="%k", GROUP="video", MODE="0660" KERNEL="3dfx*", NAME="%k", GROUP="video", MODE="0660" # alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midiC[D0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midiC[D0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" # capi devices KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" @@ -109,16 +109,16 @@ KERNEL="raw[0-9]*", NAME="raw/%k", GROUP="disk", MODE="0660" KERNEL="ram*", NAME="%k", GROUP="disk", MODE="0660" # sound devices -KERNEL="adsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="audio", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="dsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="mixer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="adsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="audio", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="dsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="mixer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" # tty devices KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" @@ -126,10 +126,10 @@ KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0600" -KERNEL="ippp0", NAME="", GROUP="tty", MODE="0660" -KERNEL="isdn*", NAME="", GROUP="tty", MODE="0660" -KERNEL="dcbri*", NAME="", GROUP="tty", MODE="0660" -KERNEL="ircomm*", NAME="", GROUP="tty", MODE="0660" +KERNEL="ippp0", NAME="%k", GROUP="tty", MODE="0660" +KERNEL="isdn*", NAME="%k", GROUP="tty", MODE="0660" +KERNEL="dcbri*", NAME="%k", GROUP="tty", MODE="0660" +KERNEL="ircomm*", NAME="%k", GROUP="tty", MODE="0660" # pty devices KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" @@ -142,15 +142,15 @@ KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k", GROUP="tty", MODE="0660" KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k", GROUP="tty", MODE="0660" -# memory devices¶ -KERNEL="random", NAME="%k", MODE="0666" -KERNEL="urandom", NAME="%k", MODE="0444" -KERNEL="mem", NAME="%k", MODE="0640" -KERNEL="kmem", NAME="%k", MODE="0640" -KERNEL="port", NAME="%k", MODE="0640" -KERNEL="full", NAME="%k", MODE="0666" -KERNEL="null", NAME="%k", MODE="0666" -KERNEL="zero", NAME="%k", MODE="0666" +# memory devices +KERNEL="random", NAME="%k", MODE="0666" +KERNEL="urandom", NAME="%k", MODE="0444" +KERNEL="mem", NAME="%k", MODE="0640" +KERNEL="kmem", NAME="%k", MODE="0640" +KERNEL="port", NAME="%k", MODE="0640" +KERNEL="full", NAME="%k", MODE="0666" +KERNEL="null", NAME="%k", MODE="0666" +KERNEL="zero", NAME="%k", MODE="0666" # usb devices KERNEL="hiddev*", NAME="usb/%k" @@ -160,9 +160,9 @@ KERNEL="dabusb*", NAME="usb/%k" BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k", GROUP="lp", MODE="0660" # v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n", GROUP="video", MODE="0660" +KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n", GROUP="video", MODE="0660" KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="video", MODE="0660" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video", MODE="0660" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video", MODE="0660" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video", MODE="0660" # Asterix Zaptel devices @@ -174,10 +174,10 @@ KERNEL="zap[0-9]*", NAME="zap/%n" # pilot/palm devices KERNEL="pilot", NAME="%k", GROUP="uucp", MODE="0660" -¶ + # jaz devices KERNEL="jaz*", NAME="%k", GROUP="disk", MODE="0660" -¶ + # zip devices KERNEL="pocketzip*", NAME="%k", GROUP="disk", MODE="0660" KERNEL="zip*", NAME="%k", GROUP="disk", MODE="0660" -- cgit v1.2.3-54-g00ecf From a866c0a305372305bc8363b8f3b24832082711aa Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 18 Dec 2004 22:58:37 +0100 Subject: [PATCH] remove permissions file mentioning from the udev man page --- udev.8.in | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/udev.8.in b/udev.8.in index 90b7d83309..581d6f4ed5 100644 --- a/udev.8.in +++ b/udev.8.in @@ -61,18 +61,18 @@ The default value is .IR yes . .TP .B default_mode -The default mode for all nodes not explicitly matching in the permissions -file. The default value is -.IR 0666 . +The default mode for all nodes where no explicit value is given by a rule. +The default value is +.IR 0600 . .TP .B default_owner -The default owner for all nodes not explicitly matching in the permissions -file. The default value is +The default owner for all nodes where no explicit value is given by a rule. +The default value is .IR root . .TP .B default_group -The default group for all nodes not explicitly matching in the permissions -file. The default value is +The default group for all nodes where no explicitly value is given by a rule. +The default value is .IR root . .br .P @@ -92,16 +92,16 @@ udev_rules="/etc/udev/rules.d/" # udev_log - set to "yes" if you want logging, else "no" udev_log="yes" -# default_mode - set the default mode for all nodes not -# explicitly matching in the permissions file +# default_mode - set the default mode for all nodes that have no +# permissions specified default_mode="0666" -# default_owner - set the default owner for all nodes not -# explicitly matching in the permissions file +# default_owner - set the default owner for all nodes that have no +# permissions specified default_owner="root" -# default_group - set the default group for all nodes not -# explicitly matching in the permissions file +# default_group - set the default group for all nodes that have no +# permissions specified default_group="root" .fi .P -- cgit v1.2.3-54-g00ecf From 2c97d705dc2550885ecc392765755511b549bfc7 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 18 Dec 2004 22:59:21 +0100 Subject: [PATCH] initial merge of fedora udev.permissions into udev.rules --- etc/udev/redhat/udev.rules | 50 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index 6605915446..f95d2c1a10 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -8,16 +8,44 @@ # note devmap_name comes with extras/multipath #KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" +KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" +KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" +KERNEL="tty[0-9]*", NAME="%k", GROUP="tty", MODE="0660 + +KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" +KERNEL="pty[p-za-e][0-9a-f]*", NAME="%k", GROUP="tty", MODE="0660" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="%k", GROUP="tty", MODE="0660" + +KERNEL="ttyS[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL="ttyUSB[0-9]*", NAME="%k", GROUP="uucp", MODE="0600" +KERNEL="ippp0", NAME="%k", MODE="0660" +KERNEL="isdn*", NAME="%k", MODE="0660" +KERNEL="dcbri*", NAME="%k", MODE="0660" +KERNEL="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" + +KERNEL="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", MODE="0600" +KERNEL="vcsa[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", MODE="0600 + +# memory devices¶ +KERNEL="random", NAME="%k", MODE="0666" +KERNEL="urandom", NAME="%k", MODE="0444" +KERNEL="mem", NAME="%k", MODE="0640" +KERNEL="kmem", NAME="%k", MODE="0640" +KERNEL="port", NAME="%k", MODE="0640" +KERNEL="full", NAME="%k", MODE="0666" +KERNEL="null", NAME="%k", MODE="0666" +KERNEL="zero", NAME="%k", MODE="0666" + # DRI devices always go into a subdirectory (as per the LSB spec) KERNEL="card*", NAME="dri/card%n" # alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" # input devices KERNEL="mice", NAME="input/%k" @@ -53,11 +81,11 @@ KERNEL="tun", NAME="net/%k" KERNEL="device-mapper", NAME="mapper/control" # old compat symlinks with enumeration -KERNEL="sr[0-9]*", SYMLINK="cdrom%e" -KERNEL="scd[0-9]*", SYMLINK="cdrom%e" -KERNEL="pcd[0-9]*", SYMLINK="cdrom%e" -KERNEL="fd[0-9]*", SYMLINK="floppy%e" -KERNEL="nst[0-9]*", SYMLINK="tape%e" +KERNEL="sr[0-9]*", SYMLINK="cdrom%e" +KERNEL="scd[0-9]*", SYMLINK="cdrom%e" +KERNEL="pcd[0-9]*", SYMLINK="cdrom%e" +KERNEL="fd[0-9]*", SYMLINK="floppy%e" +KERNEL="nst[0-9]*", SYMLINK="tape%e" KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/ide-media.sh %k", RESULT="floppy", SYMLINK="floppy%e, NAME{ignore_remove, all_partitions}="%k" -- cgit v1.2.3-54-g00ecf From 2a270316e4c0afa1efe98d665e2e329b7bae6c0a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 19 Dec 2004 02:39:52 +0100 Subject: [PATCH] I broke the extras/ again. Add simple build test script now. --- test/simple-build-check.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 test/simple-build-check.sh diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh new file mode 100644 index 0000000000..8919fcfcf0 --- /dev/null +++ b/test/simple-build-check.sh @@ -0,0 +1,26 @@ +#/bin/sh + +EXTRA="extras/chassis_id extras/scsi_id extras/volume_id" + +make spotless EXTRAS="$EXTRA" >/dev/null +make all EXTRAS="$EXTRA" || exit +echo -e "\n\n" + +make spotless EXTRAS="$EXTRA" >/dev/null +make all DEBUG=true EXTRAS="$EXTRA" || exit +echo -e "\n\n" + +make spotless EXTRAS="$EXTRA" >/dev/null +make all USE_LOG=false EXTRAS="$EXTRA" || exit +echo -e "\n\n" + +make spotless EXTRAS="$EXTRA" >/dev/null +make all USE_KLIBC=true DEBUG=true EXTRAS="$EXTRA" || exit +echo -e "\n\n" + +make spotless EXTRAS="$EXTRA" >/dev/null +make all USE_KLIBC=true USE_LOG=false EXTRAS="$EXTRA" || exit +echo -e "\n\n" + +make spotless EXTRAS="$EXTRA" >/dev/null + -- cgit v1.2.3-54-g00ecf From 65ab1334122b6ed427ce39f48fb40757d44f8d71 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 20 Dec 2004 01:31:56 +0100 Subject: [PATCH] simplify permission application We have only one source of permissions now, so apply the default permissions at udev init. --- namedev.c | 37 +++++++++++++++---------------------- udev_add.c | 2 +- udev_utils.c | 4 ++++ 3 files changed, 20 insertions(+), 23 deletions(-) diff --git a/namedev.c b/namedev.c index be7ae12cd5..3da783b55d 100644 --- a/namedev.c +++ b/namedev.c @@ -680,7 +680,6 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d struct config_device *dev; char *pos; - udev->mode = 0; dbg("class_dev->name='%s'", class_dev->name); /* Figure out where the "device"-symlink is at. For char devices this will @@ -757,34 +756,28 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d goto exit; udev->partitions = dev->partitions; - udev->mode = dev->mode; - strfieldcpy(udev->owner, dev->owner); - apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); - strfieldcpy(udev->group, dev->group); - apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); + if (dev->mode != 0000) + udev->mode = dev->mode; + if (dev->owner[0] != '\0') { + strfieldcpy(udev->owner, dev->owner); + apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); + } + if (dev->group[0] != '\0') { + strfieldcpy(udev->group, dev->group); + apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); + } + + dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", + udev->name, udev->owner, udev->group, udev->mode); - goto perms; + goto exit; } } } /* no rule matched, so we use the kernel name */ strfieldcpy(udev->name, udev->kernel_name); - - if (udev->type == 'n') - goto exit; - -perms: - /* apply default permissions to empty fields */ - if (udev->mode == 0000) - udev->mode = default_mode; - if (udev->owner[0] == '\0') - strfieldcpy(udev->owner, default_owner); - if (udev->group[0] == '\0') - strfieldcpy(udev->group, default_group); - - dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", - udev->name, udev->owner, udev->group, udev->mode); + dbg("no rule found, use kernel name '%s'", udev->name); exit: return 0; diff --git a/udev_add.c b/udev_add.c index f537f567cc..c9b30bad90 100644 --- a/udev_add.c +++ b/udev_add.c @@ -189,7 +189,7 @@ static int create_node(struct udevice *udev) } else { info("creating device node '%s', major = '%d', minor = '%d', " "mode = '%#o', uid = '%d', gid = '%d'", filename, - udev->major, udev->minor, (mode_t)udev->mode, uid, gid); + udev->major, udev->minor, udev->mode, uid, gid); } /* create all_partitions if requested */ diff --git a/udev_utils.c b/udev_utils.c index aa5c75f74d..0b730d565b 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -55,6 +55,10 @@ void udev_init_device(struct udevice *udev, const char* devpath, const char *sub udev->type = 'n'; else if (strncmp(udev->devpath, "/class/", 7) == 0) udev->type = 'c'; + + udev->mode = default_mode; + strfieldcpy(udev->owner, default_owner); + strfieldcpy(udev->group, default_group); } int kernel_release_satisfactory(int version, int patchlevel, int sublevel) -- cgit v1.2.3-54-g00ecf From 4ae6d03f394684722e7d5710fb2585e7c388f119 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 20 Dec 2004 03:04:11 +0100 Subject: [PATCH] simplify rules file by setting default mode to 0660 On Sun, 2004-12-19 at 18:31 +0100, Marco d'Itri wrote: > It may be better to use default_mode="0660", I do not think that there > are any mode 600 devices. This would allow setting only the group for > most of them. --- etc/udev/gentoo/udev.rules | 114 ++++++++++++++++++++++----------------------- etc/udev/redhat/udev.rules | 20 ++++---- etc/udev/udev.conf.in | 2 +- test/udev-test.pl | 10 ++-- udev.8.in | 4 +- udev_config.c | 2 +- 6 files changed, 76 insertions(+), 76 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index d91363c6d2..7d5aaa7d72 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -19,17 +19,17 @@ BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYM # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}", MODE="0660" +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" # disk devices -KERNEL="sd*", NAME="%k", GROUP="disk", MODE="0660" -KERNEL="dasd*", NAME="%k", GROUP="disk", MODE="0660" -KERNEL="ataraid*", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="sd*", NAME="%k", GROUP="disk" +KERNEL="dasd*", NAME="%k", GROUP="disk" +KERNEL="ataraid*", NAME="%k", GROUP="disk" # dri devices -KERNEL="card*", NAME="dri/card%n", GROUP="video", MODE="0660" -KERNEL="nvidia*", NAME="%k", GROUP="video", MODE="0660" -KERNEL="3dfx*", NAME="%k", GROUP="video", MODE="0660" +KERNEL="card*", NAME="dri/card%n", GROUP="video" +KERNEL="nvidia*", NAME="%k", GROUP="video" +KERNEL="3dfx*", NAME="%k", GROUP="video" # alsa devices KERNEL="controlC[0-9]*", NAME="snd/%k" @@ -59,7 +59,7 @@ KERNEL="device-mapper", NAME="mapper/control" KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" # floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy", MODE="0660" +KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy" # i2c devices KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" @@ -72,10 +72,10 @@ KERNEL="js*", NAME="input/%k", MODE="664" KERNEL="ts*", NAME="input/%k", MODE="0600" # loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k", GROUP="disk", MODE="0660" +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k", GROUP="disk" # md block devices -KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k", GROUP="disk", MODE="0660" +KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k", GROUP="disk" # misc devices KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" @@ -105,42 +105,42 @@ KERNEL="tun", NAME="net/%k" KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" # raw devices -KERNEL="raw[0-9]*", NAME="raw/%k", GROUP="disk", MODE="0660" -KERNEL="ram*", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL="ram*", NAME="%k", GROUP="disk" # sound devices -KERNEL="adsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="audio", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="dsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="mixer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" -KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0660" +KERNEL="adsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL="audio", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL="dsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL="mixer", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" # tty devices KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty", MODE="0660" -KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty", MODE="0660" +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty" KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0600" -KERNEL="ippp0", NAME="%k", GROUP="tty", MODE="0660" -KERNEL="isdn*", NAME="%k", GROUP="tty", MODE="0660" -KERNEL="dcbri*", NAME="%k", GROUP="tty", MODE="0660" -KERNEL="ircomm*", NAME="%k", GROUP="tty", MODE="0660" +KERNEL="ippp0", NAME="%k", GROUP="tty" +KERNEL="isdn*", NAME="%k", GROUP="tty" +KERNEL="dcbri*", NAME="%k", GROUP="tty" +KERNEL="ircomm*", NAME="%k", GROUP="tty" # pty devices KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k", GROUP="tty", MODE="0660" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k", GROUP="tty", MODE="0660" +KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k", GROUP="tty" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k", GROUP="tty" # vc devices -KERNEL="vcs", NAME="vcc/0", SYMLINK="%k", GROUP="tty", MODE="0660" -KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k", GROUP="tty", MODE="0660" -KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k", GROUP="tty", MODE="0660" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k", GROUP="tty", MODE="0660" +KERNEL="vcs", NAME="vcc/0", SYMLINK="%k", GROUP="tty" +KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k", GROUP="tty" +KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k", GROUP="tty" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k", GROUP="tty" # memory devices KERNEL="random", NAME="%k", MODE="0666" @@ -155,15 +155,15 @@ KERNEL="zero", NAME="%k", MODE="0666" # usb devices KERNEL="hiddev*", NAME="usb/%k" KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k", GROUP="usb", MODE="0660" +KERNEL="legousbtower*", NAME="usb/%k", GROUP="usb" KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k", GROUP="lp", MODE="0660" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k", GROUP="lp" # v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n", GROUP="video", MODE="0660" -KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="video", MODE="0660" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video", MODE="0660" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video", MODE="0660" +KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n", GROUP="video" +KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="video" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" # Asterix Zaptel devices KERNEL="zapctl", NAME="zap/ctl" @@ -173,37 +173,37 @@ KERNEL="zappseudo", NAME="zap/pseudo" KERNEL="zap[0-9]*", NAME="zap/%n" # pilot/palm devices -KERNEL="pilot", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL="pilot", NAME="%k", GROUP="uucp" # jaz devices -KERNEL="jaz*", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="jaz*", NAME="%k", GROUP="disk" # zip devices -KERNEL="pocketzip*", NAME="%k", GROUP="disk", MODE="0660" -KERNEL="zip*", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="pocketzip*", NAME="%k", GROUP="disk" +KERNEL="zip*", NAME="%k", GROUP="disk" # ls120 devices -KERNEL="ls120", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="ls120", NAME="%k", GROUP="disk" # lp devices -KERNEL="lp*", NAME="%k", GROUP="lp", MODE="0660" -KERNEL="irlpt", NAME="%k", GROUP="lp", MODE="0660" -KERNEL="usblp", NAME="%k", GROUP="lp", MODE="0660" -KERNEL="lp*", NAME="%k", GROUP="lp", MODE="0660" +KERNEL="lp*", NAME="%k", GROUP="lp" +KERNEL="irlpt", NAME="%k", GROUP="lp" +KERNEL="usblp", NAME="%k", GROUP="lp" +KERNEL="lp*", NAME="%k", GROUP="lp" # tape devices -KERNEL="ht*", NAME="%k", GROUP="tape", MODE="0660" -KERNEL="nht*", NAME="%k", GROUP="tape", MODE="0660" -KERNEL="pt*", NAME="%k", GROUP="tape", MODE="0660" -KERNEL="npt*", NAME="%k", GROUP="tape", MODE="0660" -KERNEL="st*", NAME="%k", GROUP="tape", MODE="0660" -KERNEL="nst*", NAME="%k", GROUP="tape", MODE="0660" +KERNEL="ht*", NAME="%k", GROUP="tape" +KERNEL="nht*", NAME="%k", GROUP="tape" +KERNEL="pt*", NAME="%k", GROUP="tape" +KERNEL="npt*", NAME="%k", GROUP="tape" +KERNEL="st*", NAME="%k", GROUP="tape" +KERNEL="nst*", NAME="%k", GROUP="tape" # diskonkey devices -KERNEL="diskonkey*", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="diskonkey*", NAME="%k", GROUP="disk" # rem_ide devices -KERNEL="microdrive*", NAME="%k", GROUP="disk", MODE="0660" +KERNEL="microdrive*", NAME="%k", GROUP="disk" # kbd devices KERNEL="kbd", NAME="%k", MODE="0664" diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index f95d2c1a10..5dc68237e7 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -10,18 +10,18 @@ KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="tty[0-9]*", NAME="%k", GROUP="tty", MODE="0660 +KERNEL="tty[0-9]*", NAME="%k", GROUP="tty" KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="pty[p-za-e][0-9a-f]*", NAME="%k", GROUP="tty", MODE="0660" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="%k", GROUP="tty", MODE="0660" - -KERNEL="ttyS[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL="ttyUSB[0-9]*", NAME="%k", GROUP="uucp", MODE="0600" -KERNEL="ippp0", NAME="%k", MODE="0660" -KERNEL="isdn*", NAME="%k", MODE="0660" -KERNEL="dcbri*", NAME="%k", MODE="0660" -KERNEL="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL="pty[p-za-e][0-9a-f]*", NAME="%k", GROUP="tty" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="%k", GROUP="tty" + +KERNEL="ttyS[0-9]*", NAME="%k", GROUP="uucp" +KERNEL="ttyUSB[0-9]*", NAME="%k", GROUP="uucp" +KERNEL="ippp0", NAME="%k" +KERNEL="isdn*", NAME="%k" +KERNEL="dcbri*", NAME="%k" +KERNEL="ircomm*", NAME="%k", GROUP="uucp" KERNEL="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", MODE="0600" KERNEL="vcsa[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", MODE="0600 diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index 295e39ffd2..a4a79ad5c2 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -16,7 +16,7 @@ udev_rules="@configdir@/rules.d" # default_mode - set the default mode for all nodes that have no # permissions specified -default_mode="0600" +default_mode="0660" # default_owner - set the default owner for all nodes that have no # permissions specified diff --git a/test/udev-test.pl b/test/udev-test.pl index 8ee8ba5414..9a581ce527 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -506,7 +506,7 @@ EOF subsys => "tty", devpath => "/class/tty/tty33", exp_name => "tty33", - exp_perms => "0:0:0600", + exp_perms => "0:0:0660", conf => < "block", devpath => "/block/sda", exp_name => "node", - exp_perms => "5000::0600", + exp_perms => "5000::0660", conf => < "block", devpath => "/block/sda", exp_name => "node", - exp_perms => ":100:0600", + exp_perms => ":100:0660", conf => < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "ttyUSB0", - exp_perms => ":100:0600", + exp_perms => ":100:0660", conf => <$main_conf" || die "unable to create config file: $main_conf"; print CONF "udev_root=\"$udev_root\"\n"; print CONF "udev_db=\"$udev_db\"\n"; print CONF "udev_rules=\"$conf_tmp\"\n"; -print CONF "default_mode=\"0600\"\n"; +print CONF "default_mode=\"0660\"\n"; print CONF "default_owner=\"root\"\n"; print CONF "default_group=\"root\"\n"; close CONF; diff --git a/udev.8.in b/udev.8.in index 581d6f4ed5..5d55b3282c 100644 --- a/udev.8.in +++ b/udev.8.in @@ -63,7 +63,7 @@ The default value is .B default_mode The default mode for all nodes where no explicit value is given by a rule. The default value is -.IR 0600 . +.IR 0660 . .TP .B default_owner The default owner for all nodes where no explicit value is given by a rule. @@ -94,7 +94,7 @@ udev_log="yes" # default_mode - set the default mode for all nodes that have no # permissions specified -default_mode="0666" +default_mode="0660" # default_owner - set the default owner for all nodes that have no # permissions specified diff --git a/udev_config.c b/udev_config.c index a5f6467748..31c2a86ed1 100644 --- a/udev_config.c +++ b/udev_config.c @@ -76,7 +76,7 @@ static void init_variables(void) strcpy(default_owner, "root"); strcpy(default_group, "root"); - default_mode = 0600; + default_mode = 0660; udev_log = string_is_true(UDEV_LOG_DEFAULT); -- cgit v1.2.3-54-g00ecf From a07dc29e602440541ce531e03737bc1f926a0ef3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 20 Dec 2004 03:11:22 +0100 Subject: [PATCH] add OnStream tape drive rules On Sun, 2004-12-19 at 17:36 +0000, Willem Riede wrote: Would you mind adding OnStream tape drives? > > KERNEL="osst*", NAME="%k", GROUP="tape", MODE="0660" > KERNEL="nosst*", NAME="%k", GROUP="tape", MODE="0660" --- etc/udev/gentoo/udev.rules | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 7d5aaa7d72..dbb0e6f51e 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -198,6 +198,8 @@ KERNEL="pt*", NAME="%k", GROUP="tape" KERNEL="npt*", NAME="%k", GROUP="tape" KERNEL="st*", NAME="%k", GROUP="tape" KERNEL="nst*", NAME="%k", GROUP="tape" +KERNEL="osst*", NAME="%k", GROUP="tape" +KERNEL="nosst*", NAME="%k", GROUP="tape" # diskonkey devices KERNEL="diskonkey*", NAME="%k", GROUP="disk" @@ -211,6 +213,3 @@ KERNEL="kbd", NAME="%k", MODE="0664" # Sony Vaio Jogdial sonypi device KERNEL="sonypi", NAME="%k", MODE="0666" -# gpm devices -KERNEL="gpmctl", NAME="%k", MODE="0700" - -- cgit v1.2.3-54-g00ecf From 9f8dfa19cfd2b502bf794f39a421cbb7c4cc0404 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 20 Dec 2004 07:38:33 +0100 Subject: [PATCH] allow multiline rules by backslash at the end of the line On Sun, 2004-12-19 at 18:31 +0100, Marco d'Itri wrote: > > On Dec 19, Kay Sievers wrote: > > > (Feature request: would it be possible to extend the rules files parser > > to support continuation lines? I'd like it to consider lines starting > > with white space as part of the previous line.) > > How about the usual backslash at the end of the line. Here is a simple > patch. --- namedev_parse.c | 15 +++++++++++---- test/udev-test.pl | 30 ++++++++++++++++++++++++++++++ udev.8.in | 6 +++--- udev.h | 3 +-- udev_config.c | 54 ++++++------------------------------------------------ udev_utils.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++++--- udev_utils.h | 3 ++- 7 files changed, 102 insertions(+), 61 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index 7190cdd1a8..3b14a6a500 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -126,14 +126,15 @@ static int namedev_parse(const char *filename, void *data) cur = 0; lineno = 0; while (cur < bufsize) { + int i, j; + count = buf_get_line(buf, bufsize, cur); bufline = &buf[cur]; cur += count+1; lineno++; if (count >= LINE_SIZE) { - info("line too long, rule skipped %s, line %d", - filename, lineno); + info("line too long, rule skipped %s, line %d", filename, lineno); continue; } @@ -149,8 +150,14 @@ static int namedev_parse(const char *filename, void *data) if (bufline[0] == COMMENT_CHARACTER) continue; - strncpy(line, bufline, count); - line[count] = '\0'; + /* skip backslash and newline from multi line rules */ + for (i = j = 0; i < count; i++) { + if (bufline[i] == '\\' || bufline[i] == '\n') + continue; + + line[j++] = bufline[i]; + } + line[j] = '\0'; dbg_parse("read '%s'", line); /* get all known keys */ diff --git a/test/udev-test.pl b/test/udev-test.pl index 9a581ce527..53eee35457 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -187,6 +187,36 @@ EOF KERNEL="ttyUSB0", NAME="visor" +EOF + }, + { + desc => "Handle backslashed multi lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "visor" , + conf => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "visor" , + conf => < #include #include +#include #include #include #include @@ -111,6 +112,41 @@ int create_path(const char *path) return mkdir(p, 0755); } +int parse_get_pair(char **orig_string, char **left, char **right) +{ + char *temp; + char *string = *orig_string; + + if (!string) + return -ENODEV; + + /* eat any whitespace */ + while (isspace(*string) || *string == ',') + ++string; + + /* split based on '=' */ + temp = strsep(&string, "="); + *left = temp; + if (!string) + return -ENODEV; + + /* take the right side and strip off the '"' */ + while (isspace(*string)) + ++string; + if (*string == '"') + ++string; + else + return -ENODEV; + + temp = strsep(&string, "\""); + if (!string || *temp == '\0') + return -ENODEV; + *right = temp; + *orig_string = string; + + return 0; +} + int file_map(const char *filename, char **buf, size_t *bufsize) { struct stat stats; @@ -143,11 +179,21 @@ void file_unmap(char *buf, size_t bufsize) munmap(buf, bufsize); } -size_t buf_get_line(char *buf, size_t buflen, size_t cur) +/* return number of chars until the next newline, skip escaped newline */ +size_t buf_get_line(const char *buf, size_t buflen, size_t cur) { - size_t count = 0; + int escape = 0; + size_t count; + + for (count = cur; count < buflen; count++) { + if (!escape && buf[count] == '\n') + break; - for (count = cur; count < buflen && buf[count] != '\n'; count++); + if (buf[count] == '\\') + escape = 1; + else + escape = 0; + } return count - cur; } diff --git a/udev_utils.h b/udev_utils.h index e36255f526..cc9dd704de 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -79,9 +79,10 @@ do { \ extern void udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); extern int kernel_release_satisfactory(int version, int patchlevel, int sublevel); extern int create_path(const char *path); +extern int parse_get_pair(char **orig_string, char **left, char **right); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); -extern size_t buf_get_line(char *buf, size_t buflen, size_t cur); +extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); extern void no_trailing_slash(char *path); typedef int (*file_fnct_t)(const char *filename, void *data); extern int call_foreach_file(file_fnct_t fnct, const char *dirname, -- cgit v1.2.3-54-g00ecf From eabfc9736703ce0dc81b233d78821d408aa565f2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 20 Dec 2004 08:57:31 +0100 Subject: [PATCH] handle renamed network interfaces properly if we manage hotplug.d/ If we take over the hotplug call and manage the events we don't need to call the event fake script in dev.d/. Just set all expected values to the new network interface name and call hotplug.d/. This way the device renaming is completely handled inside of udev and userspace can't get confused. --- etc/dev.d/net/hotplug.dev | 10 ++++------ udev.c | 23 +++++++++++++++-------- udev_add.c | 7 ++++--- udevd.c | 2 +- udevsend.c | 2 +- 5 files changed, 25 insertions(+), 19 deletions(-) diff --git a/etc/dev.d/net/hotplug.dev b/etc/dev.d/net/hotplug.dev index 15cc5cb52e..e195b0f034 100644 --- a/etc/dev.d/net/hotplug.dev +++ b/etc/dev.d/net/hotplug.dev @@ -8,15 +8,13 @@ # Copyright (C) 2004 Greg Kroah-Hartman # -# See if we really did rename this device. -if [ "$INTERFACE" = "$DEVNAME" ]; then +# Do nothing if udev handles hotplug.d. +if [ "$MANAGED_EVENT" == "1" ]; then exit 0 fi -# ok, we have renamed this device, so let's set $INTERFACE to the new name -# and call the network hotplug script to handle it properly... -INTERFACE=$DEVNAME -export INTERFACE +# ok, we have renamed this device, so let the network hotplug script +# know about it to setup the device properly... if [ -f /etc/hotplug.d/default/default.hotplug ]; then exec /etc/hotplug.d/default/default.hotplug net fi diff --git a/udev.c b/udev.c index e5d7800ecf..122d34c1a5 100644 --- a/udev.c +++ b/udev.c @@ -54,31 +54,32 @@ void log_message(int level, const char *format, ...) } #endif -/* (for now) true if udevsend is the helper */ +/* decide if we should manage the whole hotplug event + * for now look if the kernel calls udevsend instead of /sbin/hotplug + */ static int manage_hotplug_event(void) { char helper[256]; int fd; int len; - /* false, if we are called directly */ - if (!getenv("MANAGED_EVENT")) - goto exit; + /* don't handle hotplug.d if we are called directly */ + if (!getenv("UDEVD_EVENT")) + return 0; fd = open("/proc/sys/kernel/hotplug", O_RDONLY); if (fd < 0) - goto exit; + return 0; len = read(fd, helper, 256); close(fd); if (len < 0) - goto exit; + return 0; helper[len] = '\0'; if (strstr(helper, "udevsend")) return 1; -exit: return 0; } @@ -104,6 +105,7 @@ int main(int argc, char *argv[], char *envp[]) const char *action; const char *devpath; const char *subsystem; + int managed_event; int retval = -EINVAL; if (argc == 2 && strcmp(argv[1], "-V") == 0) { @@ -139,6 +141,11 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + /* let the executed programs know if we handle the whole hotplug event */ + managed_event = manage_hotplug_event(); + if (managed_event) + setenv("MANAGED_EVENT", "1", 1); + action = getenv("ACTION"); devpath = getenv("DEVPATH"); subsystem = getenv("SUBSYSTEM"); @@ -238,7 +245,7 @@ int main(int argc, char *argv[], char *envp[]) } hotplug: - if (udev_hotplug_d && manage_hotplug_event()) + if (udev_hotplug_d && managed_event) udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX); exit: diff --git a/udev_add.c b/udev_add.c index c9b30bad90..acd678ffba 100644 --- a/udev_add.c +++ b/udev_add.c @@ -318,15 +318,16 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) if (retval != 0) goto exit; - /* we've changed the name, now fake the devpath, - * cause original kernel name sleeps with the fishes - * and we don't get any event from the kernel now + /* we've changed the name, now fake the devpath, cause the + * original kernel name sleeps with the fishes and we don't + * get an event from the kernel with the new name */ pos = strrchr(udev->devpath, '/'); if (pos != NULL) { pos[1] = '\0'; strfieldcat(udev->devpath, udev->name); setenv("DEVPATH", udev->devpath, 1); + setenv("INTERFACE", udev->name, 1); } /* use netif name for the environment */ diff --git a/udevd.c b/udevd.c index 91189eb861..3c29c2be6e 100644 --- a/udevd.c +++ b/udevd.c @@ -335,7 +335,7 @@ static void handle_udevsend_msg(int sock) if (strncmp(key, "PHYSDEVPATH=", 12) == 0) msg->physdevpath = &key[12]; } - msg->envp[i++] = "MANAGED_EVENT=1"; + msg->envp[i++] = "UDEVD_EVENT=1"; msg->envp[i] = NULL; /* if no seqnum is given, we move straight to exec queue */ diff --git a/udevsend.c b/udevsend.c index 74cc09b330..05a50facc5 100644 --- a/udevsend.c +++ b/udevsend.c @@ -154,7 +154,7 @@ int main(int argc, char *argv[], char *envp[]) } /* prevent loops in the scripts we execute */ - if (strncmp(key, "MANAGED_EVENT=", 14) == 0) { + if (strncmp(key, "UDEVD_EVENT=", 12) == 0) { dbg("seems that the event source is not the kernel, just exit"); goto exit; } -- cgit v1.2.3-54-g00ecf From c07068d5e0b153634c4457aff3dd16700161be00 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 20 Dec 2004 09:53:32 +0100 Subject: [PATCH] update Fedora config files --- etc/udev/redhat/udev.permissions | 74 +++++++++++++++++++++------------------- etc/udev/redhat/udev.rules | 9 +++-- 2 files changed, 45 insertions(+), 38 deletions(-) diff --git a/etc/udev/redhat/udev.permissions b/etc/udev/redhat/udev.permissions index 00bdff4aaf..19de177c82 100644 --- a/etc/udev/redhat/udev.permissions +++ b/etc/udev/redhat/udev.permissions @@ -70,27 +70,27 @@ dmmidi*:root:root:0660 sndstat:root:root:0660 # optical devices -sr*:root:disk:0660 -scd*:root:disk:0660 -pcd*:root:disk:0660 -disk*:root:disk:0660 -dvd:root:disk:0660 -rdvd:root:disk:0660 -cdroms/*:root:disk:0660 +sr*:root:disk:0640 +scd*:root:disk:0640 +pcd*:root:disk:0640 +disk*:root:disk:0640 +dvd:root:disk:0640 +rdvd:root:disk:0640 +cdroms/*:root:disk:0640 # pilot/palm devices pilot:root:uucp:0660 # jaz devices -jaz*:root:disk:0660 +jaz*:root:disk:0640 # zip devices -pocketzip*:root:disk:0660 -zip*:root:disk:0660 +pocketzip*:root:disk:0640 +zip*:root:disk:0640 # ls120 devices -ls120:root:disk:0660 -ls120*:root:disk:0660 +ls120:root:disk:0640 +ls120*:root:disk:0640 # lp devices lp*:root:lp:0660 @@ -109,28 +109,28 @@ usb/dc2xx*:root:root:0600 usb/mdc800*:root:root:0600 # raw devices -ram*:root:disk:0660 -raw/*:root:disk:0660 +ram*:root:disk:0640 +raw/*:root:disk:0640 # disk devices -hd*:root:disk:0660 -sd*:root:disk:0660 -dasd*:root:disk:0660 -ataraid*:root:disk:0660 -loop*:root:disk:0660 -md*:root:disk:0660 -ide/*/*/*/*/*:root:disk:0660 -discs/*/*:root:disk:0660 -loop/*:root:disk:0660 -md/*:root:disk:0660 +hd*:root:disk:0640 +sd*:root:disk:0640 +dasd*:root:disk:0640 +ataraid*:root:disk:0640 +loop*:root:disk:0640 +md*:root:disk:0640 +ide/*/*/*/*/*:root:disk:0640 +discs/*/*:root:disk:0640 +loop/*:root:disk:0640 +md/*:root:disk:0640 # tape devices -ht*:root:disk:0660 -nht*:root:disk:0660 -pt[0-9]*:root:disk:0660 -npt*:root:disk:0660 -st*:root:disk:0660 -nst*:root:disk:0660 +ht*:root:disk:0640 +nht*:root:disk:0640 +pt[0-9]*:root:disk:0640 +npt*:root:disk:0640 +st*:root:disk:0640 +nst*:root:disk:0640 # dm devices dm-*:root:root:0640 @@ -142,10 +142,10 @@ memstick*:root:root:0600 flash*:root:root:0600 # diskonkey devices -diskonkey*:root:disk:0660 +diskonkey*:root:disk:0640 # rem_ide devices -microdrive*:root:disk:0660 +microdrive*:root:disk:0640 # fb devices fb:root:root:0600 @@ -184,9 +184,9 @@ dri/*:root:root:0660 apm_bios:root:root:0600 # scsi devices -sg*:root:disk:0660 -pg*:root:disk:0660 -cdwriter:root:disk:0660 +sg*:root:disk:0640 +pg*:root:disk:0640 +cdwriter:root:disk:0640 # usb devices usb/dabusb*:root:usb:0660 @@ -196,3 +196,7 @@ usb/rio500:root:usb:0660 # s390 devices z90crypt:root:root:0666 +# DVB +dvb/*:root:root:0660 +dvb:root:root:0660 +dvb/adapter*:root:root:0660 diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index 5dc68237e7..d394e99016 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -87,7 +87,7 @@ KERNEL="pcd[0-9]*", SYMLINK="cdrom%e" KERNEL="fd[0-9]*", SYMLINK="floppy%e" KERNEL="nst[0-9]*", SYMLINK="tape%e" -KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/ide-media.sh %k", RESULT="floppy", SYMLINK="floppy%e, NAME{ignore_remove, all_partitions}="%k" +KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/ide-media.sh %k", RESULT="floppy", SYMLINK="floppy%e, NAME{ignore_remove, all_partitions}="%k", GROUP="floppy" KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", RESULT="cdrom", SYMLINK="cdrom%e" @@ -101,7 +101,10 @@ KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/ch KERNEL="sr[0-9]*", BUS="scsi", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" # rename sr* to scd* -KERNEL="sr[0-9]*", BUS="scsi", NAME="scd%n" -KERNEL="hd[a-z]*", BUS="ide", SYSFS{removable}="1", NAME{ignore_remove}="%k" +KERNEL="sr[0-9]*", BUS="scsi", NAME="scd%n", GROUP="disk", MODE="0640" +KERNEL="hd[a-z]*", BUS="ide", SYSFS{removable}="1", NAME{ignore_remove}="%k", GROUP="disk", MODE="0640" + +KERNEL="hd[a-z]*", NAME="%k", GROUP="disk", MODE="0640" +KERNEL="sd[a-z]*", NAME="%k", GROUP="disk", MODE="0640" KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" -- cgit v1.2.3-54-g00ecf From 87da5b2c65e0a889093c27189212505328aea4ab Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 20 Dec 2004 22:24:19 +0100 Subject: [PATCH] add SUBSYSTEM rule to catch all block devices and apply the disk permissions --- etc/udev/gentoo/udev.rules | 3 +++ etc/udev/redhat/udev.rules | 4 ++-- test/udev-test.pl | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index dbb0e6f51e..d89d8d0a2c 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -207,6 +207,9 @@ KERNEL="diskonkey*", NAME="%k", GROUP="disk" # rem_ide devices KERNEL="microdrive*", NAME="%k", GROUP="disk" +# all block devices +SUBSYSTEM="block", NAME="%k", GROUP="disk" + # kbd devices KERNEL="kbd", NAME="%k", MODE="0664" diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index d394e99016..30d8ba7c98 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -104,7 +104,7 @@ KERNEL="sr[0-9]*", BUS="scsi", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD- KERNEL="sr[0-9]*", BUS="scsi", NAME="scd%n", GROUP="disk", MODE="0640" KERNEL="hd[a-z]*", BUS="ide", SYSFS{removable}="1", NAME{ignore_remove}="%k", GROUP="disk", MODE="0640" -KERNEL="hd[a-z]*", NAME="%k", GROUP="disk", MODE="0640" -KERNEL="sd[a-z]*", NAME="%k", GROUP="disk", MODE="0640" +# all block devices +SUBSYSTEM="block", NAME="%k", GROUP="disk", MODE="0640" KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" diff --git a/test/udev-test.pl b/test/udev-test.pl index 53eee35457..bc8c4560d3 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -215,7 +215,7 @@ EOF #\\ KERNEL="ttyUSB0", \\ -NAME="visor" + NAME="visor" EOF }, -- cgit v1.2.3-54-g00ecf From e93901468c668f3dda6f57ee7f4b953e287b1622 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 20 Dec 2004 23:44:57 +0100 Subject: [PATCH] allow permissions only rules On Mon, 2004-12-20 at 15:03 +0100, Marco d'Itri wrote: > +# all block devices > > +SUBSYSTEM="block", NAME="%k", GROUP="disk" > > + > NAME="%k" here and in similar rules does not add any new information, > what about making it optional, like it is for SYMLINK-only rules? --- namedev.c | 29 +++++++++++++++++++++++------ test/udev-test.pl | 12 ++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/namedev.c b/namedev.c index 3da783b55d..58615ad5d0 100644 --- a/namedev.c +++ b/namedev.c @@ -716,18 +716,35 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d list_for_each_entry(dev, &config_device_list, node) { dbg("process rule"); if (match_rule(udev, dev, class_dev, sysfs_device) == 0) { - /* empty name and symlink will not create any node */ if (dev->name[0] == '\0' && dev->symlink[0] == '\0') { - info("configured rule in '%s' at line %i applied, '%s' is ignored", - dev->config_file, dev->config_line, udev->kernel_name); - return -1; + /* empty name, symlink, perms will not create any node */ + if (dev->mode == 0000 && dev->owner[0] == '\0' && dev->group[0] == '\0') { + info("configured rule in '%s[%i]' applied, '%s' is ignored", + dev->config_file, dev->config_line, udev->kernel_name); + return -1; + } + + if (dev->mode != 0000) { + udev->mode = dev->mode; + dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name); + } + if (dev->owner[0] != '\0') { + strfieldcpy(udev->owner, dev->owner); + apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); + dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name); + } + if (dev->group[0] != '\0') { + strfieldcpy(udev->group, dev->group); + apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); + dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); + } } /* collect symlinks for the final matching rule */ if (dev->symlink[0] != '\0') { char temp[NAME_SIZE]; - info("configured rule in '%s' at line %i applied, added symlink '%s'", + info("configured symlink-only rule in '%s[%i]' applied, added symlink '%s'", dev->config_file, dev->config_line, dev->symlink); strfieldcpy(temp, dev->symlink); apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); @@ -743,7 +760,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d (udev->type != 'b' || udev->kernel_number[0] != '\0')) continue; - info("configured rule in '%s' at line %i applied, '%s' becomes '%s'", + info("configured rule in '%s[%i]' applied, '%s' becomes '%s'", dev->config_file, dev->config_line, udev->kernel_name, dev->name); strfieldcpy(udev->name, dev->name); diff --git a/test/udev-test.pl b/test/udev-test.pl index bc8c4560d3..578adc4df1 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -619,6 +619,18 @@ EOF exp_perms => "5000:100:0777", conf => < "permissions only rule", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => "5000:100:0777", + conf => < Date: Tue, 21 Dec 2004 00:19:34 +0100 Subject: [PATCH] update Fedora config files and add some more tests --- etc/udev/redhat/udev.rules | 10 +++++----- test/udev-test.pl | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index 30d8ba7c98..9df77b3339 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -87,6 +87,9 @@ KERNEL="pcd[0-9]*", SYMLINK="cdrom%e" KERNEL="fd[0-9]*", SYMLINK="floppy%e" KERNEL="nst[0-9]*", SYMLINK="tape%e" +# default permissions for all block devices +SUBSYSTEM="block", GROUP="disk", MODE="0640" + KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/ide-media.sh %k", RESULT="floppy", SYMLINK="floppy%e, NAME{ignore_remove, all_partitions}="%k", GROUP="floppy" KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", RESULT="cdrom", SYMLINK="cdrom%e" @@ -101,10 +104,7 @@ KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/ch KERNEL="sr[0-9]*", BUS="scsi", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" # rename sr* to scd* -KERNEL="sr[0-9]*", BUS="scsi", NAME="scd%n", GROUP="disk", MODE="0640" -KERNEL="hd[a-z]*", BUS="ide", SYSFS{removable}="1", NAME{ignore_remove}="%k", GROUP="disk", MODE="0640" - -# all block devices -SUBSYSTEM="block", NAME="%k", GROUP="disk", MODE="0640" +KERNEL="sr[0-9]*", BUS="scsi", NAME="scd%n" +KERNEL="hd[a-z]*", BUS="ide", SYSFS{removable}="1", NAME{ignore_remove}="%k" KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" diff --git a/test/udev-test.pl b/test/udev-test.pl index 578adc4df1..b50554ceb9 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -631,6 +631,34 @@ EOF KERNEL="ttyUSB[0-9]*", OWNER="5000", GROUP="100", MODE="0777" KERNEL="ttyUSX[0-9]*", OWNER="5001", GROUP="101", MODE="0444" KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n" +EOF + }, + { + desc => "multiple permissions only rule", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => "3000:4000:0777", + conf => < "permissions only rule with override at NAME rule", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "ttyUSB0", + exp_perms => "3000:8000:0777", + conf => < Date: Tue, 21 Dec 2004 06:10:57 +0100 Subject: [PATCH] remove default_* permissions from udev.conf file With the "permissions only rules" we can just place: MODE="0660", OWNER="root", GROUP="root" at the beginning of the rules file and get exactly the same behavior. If no values are given the compiled-in defaults are used. --- etc/udev/udev.conf.in | 12 ------------ test/udev-test.pl | 3 --- udev.8.in | 28 ---------------------------- udev.h | 3 --- udev_config.c | 22 ---------------------- udev_utils.c | 6 +++--- 6 files changed, 3 insertions(+), 71 deletions(-) diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index a4a79ad5c2..72e25ed482 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -14,18 +14,6 @@ udev_db="@udevdir@/.udevdb" # udev_rules - The name and location of the udev rules file udev_rules="@configdir@/rules.d" -# default_mode - set the default mode for all nodes that have no -# permissions specified -default_mode="0660" - -# default_owner - set the default owner for all nodes that have no - # permissions specified -default_owner="root" - -# default_group - set the default group for all nodes that have no - # permissions specified -default_group="root" - # udev_log - set to "yes" if you want logging, else "no" udev_log="yes" diff --git a/test/udev-test.pl b/test/udev-test.pl index b50554ceb9..67c0672759 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1255,9 +1255,6 @@ open CONF, ">$main_conf" || die "unable to create config file: $main_conf"; print CONF "udev_root=\"$udev_root\"\n"; print CONF "udev_db=\"$udev_db\"\n"; print CONF "udev_rules=\"$conf_tmp\"\n"; -print CONF "default_mode=\"0660\"\n"; -print CONF "default_owner=\"root\"\n"; -print CONF "default_group=\"root\"\n"; close CONF; my $test_num = 1; diff --git a/udev.8.in b/udev.8.in index 0cc2f939e3..4b8691f842 100644 --- a/udev.8.in +++ b/udev.8.in @@ -59,22 +59,6 @@ All rule files are read in lexical order. The default value is The switch to enable/disable logging of udev information The default value is .IR yes . -.TP -.B default_mode -The default mode for all nodes where no explicit value is given by a rule. -The default value is -.IR 0660 . -.TP -.B default_owner -The default owner for all nodes where no explicit value is given by a rule. -The default value is -.IR root . -.TP -.B default_group -The default group for all nodes where no explicitly value is given by a rule. -The default value is -.IR root . -.br .P .RI "A sample " udev.conf " file might look like this: .sp @@ -91,18 +75,6 @@ udev_rules="/etc/udev/rules.d/" # udev_log - set to "yes" if you want logging, else "no" udev_log="yes" - -# default_mode - set the default mode for all nodes that have no -# permissions specified -default_mode="0660" - -# default_owner - set the default owner for all nodes that have no -# permissions specified -default_owner="root" - -# default_group - set the default group for all nodes that have no -# permissions specified -default_group="root" .fi .P The rules for device naming are read from the files located in the diff --git a/udev.h b/udev.h index 80eafb0d46..07385ccec5 100644 --- a/udev.h +++ b/udev.h @@ -81,9 +81,6 @@ extern char udev_root[PATH_MAX]; extern char udev_db_path[PATH_MAX+NAME_MAX]; extern char udev_config_filename[PATH_MAX+NAME_MAX]; extern char udev_rules_filename[PATH_MAX+NAME_MAX]; -extern mode_t default_mode; -extern char default_owner[USER_SIZE]; -extern char default_group[USER_SIZE]; extern int udev_log; extern int udev_dev_d; extern int udev_hotplug_d; diff --git a/udev_config.c b/udev_config.c index da8c676d04..21b62488c0 100644 --- a/udev_config.c +++ b/udev_config.c @@ -45,9 +45,6 @@ char udev_root[PATH_MAX]; char udev_db_path[PATH_MAX+NAME_MAX]; char udev_rules_filename[PATH_MAX+NAME_MAX]; char udev_config_filename[PATH_MAX+NAME_MAX]; -mode_t default_mode; -char default_owner[USER_SIZE]; -char default_group[USER_SIZE]; int udev_log; int udev_dev_d; int udev_hotplug_d; @@ -74,10 +71,6 @@ static void init_variables(void) strcpy(udev_config_filename, UDEV_CONFIG_FILE); strcpy(udev_rules_filename, UDEV_RULES_FILE); - strcpy(default_owner, "root"); - strcpy(default_group, "root"); - default_mode = 0660; - udev_log = string_is_true(UDEV_LOG_DEFAULT); udev_dev_d = 1; @@ -169,21 +162,6 @@ static int parse_config_file(void) continue; } - if (strcasecmp(variable, "default_mode") == 0) { - default_mode = strtol(value, NULL, 8); - continue; - } - - if (strcasecmp(variable, "default_owner") == 0) { - strfieldcpy(default_owner, value); - continue; - } - - if (strcasecmp(variable, "default_group") == 0) { - strfieldcpy(default_group, value); - continue; - } - if (strcasecmp(variable, "udev_log") == 0) { udev_log = string_is_true(value); continue; diff --git a/udev_utils.c b/udev_utils.c index fe18892de1..3c5344a8f9 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -57,9 +57,9 @@ void udev_init_device(struct udevice *udev, const char* devpath, const char *sub else if (strncmp(udev->devpath, "/class/", 7) == 0) udev->type = 'c'; - udev->mode = default_mode; - strfieldcpy(udev->owner, default_owner); - strfieldcpy(udev->group, default_group); + udev->mode = 0660; + strcpy(udev->owner, "root"); + strcpy(udev->group, "root"); } int kernel_release_satisfactory(int version, int patchlevel, int sublevel) -- cgit v1.2.3-54-g00ecf From 3908058c10dea619e1c676ee8a167ef3e590a3bd Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 22 Dec 2004 01:41:03 +0100 Subject: [PATCH] correct log statement --- namedev.c | 3 ++- udev.8.in | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/namedev.c b/namedev.c index 58615ad5d0..26c68fadf6 100644 --- a/namedev.c +++ b/namedev.c @@ -724,6 +724,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d return -1; } + /* apply permissions only rule values */ if (dev->mode != 0000) { udev->mode = dev->mode; dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name); @@ -744,7 +745,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d if (dev->symlink[0] != '\0') { char temp[NAME_SIZE]; - info("configured symlink-only rule in '%s[%i]' applied, added symlink '%s'", + info("configured rule in '%s[%i]' applied, added symlink '%s'", dev->config_file, dev->config_line, dev->symlink); strfieldcpy(temp, dev->symlink); apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); diff --git a/udev.8.in b/udev.8.in index 4b8691f842..aaaf231636 100644 --- a/udev.8.in +++ b/udev.8.in @@ -176,7 +176,7 @@ distribution provided rules file. .TP .B OWNER, GROUP, MODE The permissions for the device node. Every specified value overwrites the -default value specified in the config file. +compiled-in default value. .P .RB "The " NAME ", " SYMLINK ", " PROGRAM ", " OWNER " and " GROUP fields support simple printf-like string substitutions: -- cgit v1.2.3-54-g00ecf From d3c3763530955a898e1d50c6844765e94ac957c2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 5 Jan 2005 05:31:42 +0100 Subject: [PATCH] correct detection of hotplug.d/ udevsend loop If udevsend is called from the commandline the env may be too big to fit in our buffer and we tag the message. --- udevsend.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/udevsend.c b/udevsend.c index 05a50facc5..d86004ba3b 100644 --- a/udevsend.c +++ b/udevsend.c @@ -148,10 +148,6 @@ int main(int argc, char *argv[], char *envp[]) key = envp[i]; keylen = strlen(key); - if (bufpos + keylen >= HOTPLUG_BUFFER_SIZE-1) { - dbg("environment buffer too small, probably not called by the kernel"); - continue; - } /* prevent loops in the scripts we execute */ if (strncmp(key, "UDEVD_EVENT=", 12) == 0) { @@ -159,6 +155,11 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + if (bufpos + keylen >= HOTPLUG_BUFFER_SIZE-1) { + dbg("environment buffer too small, probably not called by the kernel"); + continue; + } + /* remember the SUBSYSTEM */ if (strncmp(key, "SUBSYSTEM=", 10) == 0) subsystem = &key[10]; -- cgit v1.2.3-54-g00ecf From 8b72687876747186d5f1a5a45464bf64b1a166f5 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 5 Jan 2005 05:33:26 +0100 Subject: [PATCH] limit the initial timeout of the udevd event handling Define an inititialization phase, where we delay the events only for a short time to eventually recollect the event sequence instead of delaying the very first events for 10 seconds, which breaks the firmware loader. --- udevd.c | 21 ++++++++++++++++++--- udevd.h | 4 +++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/udevd.c b/udevd.c index 3c29c2be6e..c6642f4359 100644 --- a/udevd.c +++ b/udevd.c @@ -47,6 +47,7 @@ static int udevsendsock; static int pipefds[2]; +static long startup_time; static unsigned long long expected_seqnum = 0; static volatile int sigchilds_waiting; static volatile int run_msg_q; @@ -220,6 +221,8 @@ static void msg_queue_manager(void) struct hotplug_msg *tmp_msg; struct sysinfo info; long msg_age = 0; + static int timeout = EVENT_INIT_TIMEOUT_SEC; + static int init = 1; dbg("msg queue manager, next expected is %llu", expected_seqnum); recheck: @@ -230,11 +233,18 @@ recheck: continue; } + /* see if we are in the initialization phase and wait for the very first events */ + if (init && (info.uptime - startup_time >= INIT_TIME_SEC)) { + init = 0; + timeout = EVENT_TIMEOUT_SEC; + dbg("initialization phase passed, set timeout to %i seconds", EVENT_TIMEOUT_SEC); + } + /* move event with expired timeout to the exec list */ sysinfo(&info); msg_age = info.uptime - loop_msg->queue_time; dbg("seq %llu is %li seconds old", loop_msg->seqnum, msg_age); - if (msg_age > EVENT_TIMEOUT_SEC-1) { + if (msg_age >= timeout) { msg_move_exec(loop_msg); goto recheck; } else { @@ -246,8 +256,8 @@ recheck: /* set timeout for remaining queued events */ if (list_empty(&msg_list) == 0) { - struct itimerval itv = {{0, 0}, {EVENT_TIMEOUT_SEC - msg_age, 0}}; - dbg("next event expires in %li seconds", EVENT_TIMEOUT_SEC - msg_age); + struct itimerval itv = {{0, 0}, {timeout - msg_age, 0}}; + dbg("next event expires in %li seconds", timeout - msg_age); setitimer(ITIMER_REAL, &itv, NULL); } } @@ -429,6 +439,7 @@ static void user_sighandler(void) int main(int argc, char *argv[], char *envp[]) { + struct sysinfo info; int maxsockplus; struct sockaddr_un saddr; socklen_t addrlen; @@ -532,6 +543,10 @@ int main(int argc, char *argv[], char *envp[]) else udev_bin = UDEV_BIN; + /* handle special startup timeout*/ + sysinfo(&info); + startup_time = info.uptime; + FD_ZERO(&readfds); FD_SET(udevsendsock, &readfds); FD_SET(pipefds[0], &readfds); diff --git a/udevd.h b/udevd.h index 1c4b1b88c2..28f62cf528 100644 --- a/udevd.h +++ b/udevd.h @@ -25,10 +25,12 @@ #include "list.h" #define UDEV_MAGIC "udevd_" UDEV_VERSION -#define EVENT_TIMEOUT_SEC 10 #define UDEVD_SOCK_PATH "udevd" #define SEND_WAIT_MAX_SECONDS 3 #define SEND_WAIT_LOOP_PER_SECOND 10 +#define INIT_TIME_SEC 5 +#define EVENT_INIT_TIMEOUT_SEC 2 +#define EVENT_TIMEOUT_SEC 10 /* environment buffer, should match the kernel's size in lib/kobject_uevent.h */ #define HOTPLUG_BUFFER_SIZE 1024 -- cgit v1.2.3-54-g00ecf From e750d24b0552f4fb11672ab5bdf72f536a047446 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 5 Jan 2005 05:33:49 +0100 Subject: [PATCH] remove udevsend syslog noise on udevd startup --- udevsend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevsend.c b/udevsend.c index d86004ba3b..5fe0f456a1 100644 --- a/udevsend.c +++ b/udevsend.c @@ -195,10 +195,10 @@ int main(int argc, char *argv[], char *envp[]) dbg("try to start udevd daemon"); retval = start_daemon(); if (retval) { - info("error starting daemon"); + dbg("error starting daemon"); goto fallback; } - info("udevd daemon started"); + dbg("udevd daemon started"); started_daemon = 1; } else { dbg("retry to connect %d", SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND - loop); -- cgit v1.2.3-54-g00ecf From 7b6571a9fc1909a7231ec9018ddd6602389363d3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 5 Jan 2005 05:35:24 +0100 Subject: [PATCH] improve event sequence serialization We delay the execution of events if there is already an event running for the same device, a parent or a child device. "add" events with a reference to a physical device will also wait for the physical device to finish. Here we fix the devpath comparison logic to return "busy" only if a complete device names is matching. /block/sdaa will not longer block a /block/sda event. --- udevd.c | 55 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/udevd.c b/udevd.c index c6642f4359..5694584840 100644 --- a/udevd.c +++ b/udevd.c @@ -151,34 +151,51 @@ static void udev_run(struct hotplug_msg *msg) } } -/* returns still running task for the same event sequence */ +static int compare_devpath(const char *running, const char *waiting) +{ + int i; + + for (i = 0; i < DEVPATH_SIZE; i++) { + /* identical device event found */ + if (running[i] == '\0' && waiting[i] == '\0') + return 1; + + /* parent device event found */ + if (running[i] == '\0' && waiting[i] == '/') + return 2; + + /* child device event found */ + if (running[i] == '/' && waiting[i] == '\0') + return 3; + + /* no matching event */ + if (running[i] != waiting[i]) + break; + } + + return 0; +} + +/* returns still running task for the same device, its parent or its physical device */ static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) { struct hotplug_msg *loop_msg; - int i; + + if (msg->devpath == NULL) + return NULL; list_for_each_entry(loop_msg, &running_list, list) { - if (loop_msg->devpath == NULL || msg->devpath == NULL) + if (loop_msg->devpath == NULL) continue; - /* is a parent or child device event still running */ - for (i = 0; i < DEVPATH_SIZE; i++) { - if (loop_msg->devpath[i] == '\0' || msg->devpath[i] == '\0') - return loop_msg; + /* return running parent/child device event */ + if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) + return loop_msg; - if (loop_msg->devpath[i] != msg->devpath[i]) - break; - } - - /* is the physical device event still running on an add sequence */ + /* return running physical device event */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) - for (i = 0; i < DEVPATH_SIZE; i++) { - if (loop_msg->devpath[i] == '\0' || msg->physdevpath[i] == '\0') - return loop_msg; - - if (loop_msg->devpath[i] != msg->physdevpath[i]) - break; - } + if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) + return loop_msg; } return NULL; -- cgit v1.2.3-54-g00ecf From ddf695023f501001ad35fd8f7d9ecb72e6cea472 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 5 Jan 2005 05:37:01 +0100 Subject: [PATCH] remove useless warning if udev.conf contains keys not read by udev itself --- udev_config.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/udev_config.c b/udev_config.c index 21b62488c0..5e204488d2 100644 --- a/udev_config.c +++ b/udev_config.c @@ -166,9 +166,6 @@ static int parse_config_file(void) udev_log = string_is_true(value); continue; } - - info("%s:%d:%Zd: unknown key '%s'", - udev_config_filename, lineno, temp-line, temp); } file_unmap(buf, bufsize); -- cgit v1.2.3-54-g00ecf From 021a294c04ad9e96706914765fe83148c287aded Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 5 Jan 2005 05:37:50 +0100 Subject: [PATCH] udevd: split up message receiving an queueing --- udevd.c | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/udevd.c b/udevd.c index 5694584840..0049e696f1 100644 --- a/udevd.c +++ b/udevd.c @@ -101,9 +101,14 @@ static void msg_queue_insert(struct hotplug_msg *msg) struct hotplug_msg *loop_msg; struct sysinfo info; - /* sort message by sequence number into list. events - * will tend to come in order, so scan the list backwards - */ + if (msg->seqnum == 0) { + dbg("no SEQNUM, move straight to the exec queue"); + list_add(&msg->list, &exec_list); + run_exec_q = 1; + return; + } + + /* sort message by sequence number into list */ list_for_each_entry_reverse(loop_msg, &msg_list, list) if (loop_msg->seqnum < msg->seqnum) break; @@ -279,8 +284,8 @@ recheck: } } -/* receive the msg, do some basic sanity checks, and queue it */ -static void handle_udevsend_msg(int sock) +/* receive the udevsend message and do some sanity checks */ +static struct hotplug_msg *get_udevsend_msg(void) { static struct udevsend_msg usend_msg; struct hotplug_msg *msg; @@ -304,33 +309,36 @@ static void handle_udevsend_msg(int sock) smsg.msg_control = cred_msg; smsg.msg_controllen = sizeof(cred_msg); - size = recvmsg(sock, &smsg, 0); + size = recvmsg(udevsendsock, &smsg, 0); if (size < 0) { if (errno != EINTR) - dbg("unable to receive message"); - return; + dbg("unable to receive udevsend message"); + return NULL; } cmsg = CMSG_FIRSTHDR(&smsg); cred = (struct ucred *) CMSG_DATA(cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { dbg("no sender credentials received, message ignored"); - goto exit; + return NULL; } if (cred->uid != 0) { dbg("sender uid=%i, message ignored", cred->uid); - goto exit; + return NULL; } if (strncmp(usend_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { dbg("message magic '%s' doesn't match, ignore it", usend_msg.magic); - goto exit; + return NULL; } envbuf_size = size - offsetof(struct udevsend_msg, envbuf); dbg("envbuf_size=%i", envbuf_size); msg = malloc(sizeof(struct hotplug_msg) + envbuf_size); + if (msg == NULL) + return NULL; + memset(msg, 0x00, sizeof(struct hotplug_msg) + envbuf_size); /* copy environment buffer and reconstruct envp */ @@ -365,16 +373,7 @@ static void handle_udevsend_msg(int sock) msg->envp[i++] = "UDEVD_EVENT=1"; msg->envp[i] = NULL; - /* if no seqnum is given, we move straight to exec queue */ - if (msg->seqnum == 0) { - list_add(&msg->list, &exec_list); - run_exec_q = 1; - } else { - msg_queue_insert(msg); - } - -exit: - return; + return msg; } static void asmlinkage sig_handler(int signum) @@ -569,6 +568,8 @@ int main(int argc, char *argv[], char *envp[]) FD_SET(pipefds[0], &readfds); maxsockplus = udevsendsock+1; while (1) { + struct hotplug_msg *msg; + fd_set workreadfds = readfds; retval = select(maxsockplus, &workreadfds, NULL, NULL, NULL); @@ -578,8 +579,11 @@ int main(int argc, char *argv[], char *envp[]) continue; } - if (FD_ISSET(udevsendsock, &workreadfds)) - handle_udevsend_msg(udevsendsock); + if (FD_ISSET(udevsendsock, &workreadfds)) { + msg = get_udevsend_msg(); + if (msg) + msg_queue_insert(msg); + } if (FD_ISSET(pipefds[0], &workreadfds)) user_sighandler(); -- cgit v1.2.3-54-g00ecf From adf3af8c359775e00c6323fde61264ed15ee0721 Mon Sep 17 00:00:00 2001 From: "roland@digitalvampire.org" Date: Wed, 12 Jan 2005 10:34:02 +0100 Subject: [PATCH] This fixes a silly mistake in how udevinfo prints the major and minor --- udevinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 00af081eac..a80ca82e12 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -218,8 +218,8 @@ static int print_sysfs_devices(void) attr = sysfs_get_classdev_attr(class_dev, "dev"); if (attr) { sscanf(attr->value, "%u:%u", &major, &minor); - printf("MAJOR %u\n", minor); - printf("MINOR %u\n", major); + printf("MAJOR %u\n", major); + printf("MINOR %u\n", minor); } phys_dev = sysfs_get_classdev_device(class_dev); -- cgit v1.2.3-54-g00ecf From 240ce551799c78c6e77362e7b7feaaf09b72309b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 12 Jan 2005 10:44:52 +0100 Subject: [PATCH] udev_volume_id: version 27 Fix FAT label reading bug for very large volumes. Recognize FAT label at Win98 formatted volumes. Read iso9660 joliet descriptor for unicode labels. Support uuid/label of swap partitions. --- extras/volume_id/volume_id.c | 109 ++++++++++++++++++++++++++++++++----------- extras/volume_id/volume_id.h | 4 +- 2 files changed, 84 insertions(+), 29 deletions(-) diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index 42d658895f..e28c730326 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -78,7 +78,7 @@ /* size of superblock buffer, reiserfs block is at 64k */ #define SB_BUFFER_SIZE 0x11000 /* size of seek buffer 4k */ -#define SEEK_BUFFER_SIZE 0x1000 +#define SEEK_BUFFER_SIZE 0x10000 static void set_label_raw(struct volume_id *id, @@ -221,8 +221,10 @@ static __u8 *get_buffer(struct volume_id *id, __u64 off, unsigned int len) return &(id->sbbuf[off]); } else { - if (len > SEEK_BUFFER_SIZE) - len = SEEK_BUFFER_SIZE; + if (len > SEEK_BUFFER_SIZE) { + dbg("seek buffer too small %d", SEEK_BUFFER_SIZE); + return NULL; + } /* get seek buffer */ if (id->seekbuf == NULL) { @@ -232,8 +234,7 @@ static __u8 *get_buffer(struct volume_id *id, __u64 off, unsigned int len) } /* check if we need to read */ - if ((off < id->seekbuf_off) || - ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { + if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { dbg("read seekbuf off:0x%llx len:0x%x", off, len); if (lseek(id->fd, off, SEEK_SET) == -1) return NULL; @@ -241,8 +242,10 @@ static __u8 *get_buffer(struct volume_id *id, __u64 off, unsigned int len) dbg("got 0x%x (%i) bytes", buf_len, buf_len); id->seekbuf_off = off; id->seekbuf_len = buf_len; - if (buf_len < len) + if (buf_len < len) { + dbg("requested 0x%x bytes, got only 0x%x bytes", len, buf_len); return NULL; + } } return &(id->seekbuf[off - id->seekbuf_off]); @@ -571,7 +574,7 @@ static int probe_msdos_part_table(struct volume_id *id, __u64 off) p->partition_type_raw = part[i].sys_ind; if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { - dbg("to many partitions"); + dbg("too many partitions"); next = 0; } } @@ -769,7 +772,9 @@ static int probe_jfs(struct volume_id *id, __u64 off) #define FAT12_MAX 0xff5 #define FAT16_MAX 0xfff5 -#define FAT_ATTR_VOLUME 0x08 +#define FAT_ATTR_VOLUME_ID 0x08 +#define FAT_ATTR_DIR 0x10 +#define FAT_ENTRY_FREE 0xe5 static int probe_vfat(struct volume_id *id, __u64 off) { struct vfat_super_block { @@ -832,7 +837,7 @@ static int probe_vfat(struct volume_id *id, __u64 off) __u16 dir_entries; __u32 sect_count; __u16 reserved; - __u16 fat_size; + __u32 fat_size; __u32 root_cluster; __u32 dir_size; __u32 cluster_count; @@ -959,12 +964,13 @@ valid: } /* empty entry */ - if (dir[i].name[0] == 0xe5) + if (dir[i].name[0] == FAT_ENTRY_FREE) continue; - if (dir[i].attr == FAT_ATTR_VOLUME) { - dbg("found ATTR_VOLUME id in root dir"); + if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { + dbg("found ATTR_VOLUME_ID id in root dir"); label = dir[i].name; + break; } dbg("skip dir entry"); @@ -1017,11 +1023,11 @@ fat32: } /* empty entry */ - if (dir[i].name[0] == 0xe5) + if (dir[i].name[0] == FAT_ENTRY_FREE) continue; - if (dir[i].attr == FAT_ATTR_VOLUME) { - dbg("found ATTR_VOLUME id in root dir"); + if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { + dbg("found ATTR_VOLUME_ID id in root dir"); label = dir[i].name; goto fat32_label; } @@ -1047,7 +1053,7 @@ fat32_label: if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { set_label_raw(id, label, 11); set_label_string(id, label, 11); - } else if (strncmp(vs->type.fat32.label, "NO NAME ", 11) == 0) { + } else if (strncmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { set_label_raw(id, vs->type.fat32.label, 11); set_label_string(id, vs->type.fat32.label, 11); } @@ -1214,6 +1220,12 @@ found: } #define ISO_SUPERBLOCK_OFFSET 0x8000 +#define ISO_SECTOR_SIZE 0x800 +#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) +#define ISO_VD_PRIMARY 0x1 +#define ISO_VD_SUPPLEMENTARY 0x2 +#define ISO_VD_END 0xff +#define ISO_VD_MAX 16 static int probe_iso9660(struct volume_id *id, __u64 off) { union iso_super_block { @@ -1239,8 +1251,36 @@ static int probe_iso9660(struct volume_id *id, __u64 off) return -1; if (strncmp(is->iso.id, "CD001", 5) == 0) { - set_label_raw(id, is->iso.volume_id, 32); - set_label_string(id, is->iso.volume_id, 32); + int vd_offset; + int i; + int found_svd; + + found_svd = 0; + vd_offset = ISO_VD_OFFSET; + for (i = 0; i < ISO_VD_MAX; i++) { + is = (union iso_super_block *) + get_buffer (id, off + vd_offset, 0x200); + if (is == NULL || is->iso.type == ISO_VD_END) + break; + if (is->iso.type == ISO_VD_SUPPLEMENTARY) { + dbg("found ISO supplementary VD at offset 0x%llx", off + vd_offset); + found_svd = 1; + break; + } + vd_offset += ISO_SECTOR_SIZE; + } + + if (!found_svd) { + is = (union iso_super_block *) + get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); + if (is == NULL) + return -1; + set_label_raw(id, is->iso.volume_id, 32); + set_label_string(id, is->iso.volume_id, 32); + } else { + set_label_raw(id, is->iso.volume_id, 32); + set_label_unicode16(id, is->iso.volume_id, BE, 32); + } goto found; } if (strncmp(is->hs.id, "CDROM", 5) == 0) @@ -1978,21 +2018,37 @@ found: #define LARGEST_PAGESIZE 0x4000 static int probe_swap(struct volume_id *id, __u64 off) { - const __u8 *sig; + struct swap_header_v1_2 { + __u8 bootbits[1024]; + __u32 version; + __u32 last_page; + __u32 nr_badpages; + __u8 uuid[16]; + __u8 volume_name[16]; + } __attribute__((__packed__)) *sw; + + const __u8 *buf; unsigned int page; - /* huhh, the swap signature is on the end of the PAGE_SIZE */ + /* the swap signature is at the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { - sig = get_buffer(id, off + page-10, 10); - if (sig == NULL) + buf = get_buffer(id, off + page-10, 10); + if (buf == NULL) return -1; - if (strncmp(sig, "SWAP-SPACE", 10) == 0) { + if (strncmp(buf, "SWAP-SPACE", 10) == 0) { strcpy(id->type_version, "1"); goto found; } - if (strncmp(sig, "SWAPSPACE2", 10) == 0) { + + if (strncmp(buf, "SWAPSPACE2", 10) == 0) { + sw = (struct swap_header_v1_2 *) get_buffer(id, off, sizeof(struct swap_header_v1_2)); + if (sw == NULL) + return -1; strcpy(id->type_version, "2"); + set_label_raw(id, sw->volume_name, 16); + set_label_string(id, sw->volume_name, 16); + set_uuid(id, sw->uuid, UUID_DCE); goto found; } } @@ -2014,6 +2070,8 @@ int volume_id_probe(struct volume_id *id, { int rc; + dbg("called with size=0x%llx", size); + if (id == NULL) return -EINVAL; @@ -2088,9 +2146,6 @@ int volume_id_probe(struct volume_id *id, break; /* signature in the first block, only small buffer needed */ - rc = probe_msdos_part_table(id, off); - if (rc == 0) - break; rc = probe_vfat(id, off); if (rc == 0) break; diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h index d135f44e50..c26d1e4daf 100644 --- a/extras/volume_id/volume_id.h +++ b/extras/volume_id/volume_id.h @@ -21,14 +21,14 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 26 +#define VOLUME_ID_VERSION 27 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 #define VOLUME_ID_UUID_STRING_SIZE 37 #define VOLUME_ID_FORMAT_SIZE 32 #define VOLUME_ID_PATH_MAX 256 -#define VOLUME_ID_PARTITIONS_MAX 16 +#define VOLUME_ID_PARTITIONS_MAX 256 enum volume_id_usage { VOLUME_ID_UNUSED, -- cgit v1.2.3-54-g00ecf From 78b574cfcde57a93994f73ee6aca31e499b9dd09 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Jan 2005 07:38:49 -0800 Subject: [PATCH] add aoe block and char device rules to the gentoo rule file. --- etc/udev/gentoo/udev.rules | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index d89d8d0a2c..3c09d072da 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -77,6 +77,15 @@ KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k", GROUP="disk" # md block devices KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k", GROUP="disk" +# aoe char devices, +# we might have to add a "CLASS" type one of these days to make this a bit saner +KERNEL="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" +KERNEL="err", NAME="etherd/%k", GROUP="disk", MODE="0440" +KERNEL="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" + +# aoe block devices +KERNEL="etherd*", NAME="%k", GROUP="disk" + # misc devices KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From f15515b59ff373c3b9524a0842e96c1d105f5a62 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 16 Jan 2005 04:06:22 +0100 Subject: [PATCH] udevd: support -d switch to become a daemon --- udevd.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/udevd.c b/udevd.c index 0049e696f1..f1e28d9ca3 100644 --- a/udevd.c +++ b/udevd.c @@ -472,6 +472,24 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + /* daemonize on request */ + if (argc == 2 && strcmp(argv[1], "-d") == 0) { + pid_t pid; + + pid = fork(); + switch (pid) { + case 0: + dbg("damonized fork running"); + break; + case -1: + dbg("fork of daemon failed"); + goto exit; + default: + logging_close(); + exit(0); + } + } + /* make sure we don't lock any path */ chdir("/"); umask(umask(077) | 022); -- cgit v1.2.3-54-g00ecf From c2cf40123f836b0f24da2604aba177b86b93823d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 16 Jan 2005 04:08:54 +0100 Subject: [PATCH] udevd: separate socket handling to prepare for other event sources --- udevd.c | 73 +++++++++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/udevd.c b/udevd.c index f1e28d9ca3..7ae7a5b232 100644 --- a/udevd.c +++ b/udevd.c @@ -109,10 +109,16 @@ static void msg_queue_insert(struct hotplug_msg *msg) } /* sort message by sequence number into list */ - list_for_each_entry_reverse(loop_msg, &msg_list, list) + list_for_each_entry_reverse(loop_msg, &msg_list, list) { if (loop_msg->seqnum < msg->seqnum) break; + if (loop_msg->seqnum == msg->seqnum) { + dbg("ignoring duplicate message seq %llu", msg->seqnum); + return; + } + } + /* store timestamp of queuing */ sysinfo(&info); msg->queue_time = info.uptime; @@ -123,7 +129,7 @@ static void msg_queue_insert(struct hotplug_msg *msg) /* run msg queue manager */ run_msg_q = 1; - return ; + return; } /* forks event and removes event from run queue when finished */ @@ -453,14 +459,45 @@ static void user_sighandler(void) } } -int main(int argc, char *argv[], char *envp[]) +static int init_udevsend_socket(void) { - struct sysinfo info; - int maxsockplus; struct sockaddr_un saddr; socklen_t addrlen; - int retval, fd; const int feature_on = 1; + int retval; + + memset(&saddr, 0x00, sizeof(saddr)); + saddr.sun_family = AF_LOCAL; + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + + udevsendsock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udevsendsock == -1) { + dbg("error getting socket, %s", strerror(errno)); + return -1; + } + + /* the bind takes care of ensuring only one copy running */ + retval = bind(udevsendsock, (struct sockaddr *) &saddr, addrlen); + if (retval < 0) { + dbg("bind failed, %s", strerror(errno)); + close(udevsendsock); + return -1; + } + + /* enable receiving of the sender credentials */ + setsockopt(udevsendsock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); + + return 0; +} + +int main(int argc, char *argv[], char *envp[]) +{ + struct sysinfo info; + int maxsockplus; + int retval; + int fd; struct sigaction act; fd_set readfds; @@ -547,29 +584,15 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGALRM, &act, NULL); sigaction(SIGCHLD, &act, NULL); - memset(&saddr, 0x00, sizeof(saddr)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + if (init_udevsend_socket() < 0) { + if (errno == EADDRINUSE) + dbg("another udevd is running, exit"); + else + dbg("error initialising udevsend socket: %s", strerror(errno)); - udevsendsock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (udevsendsock == -1) { - dbg("error getting socket, exit"); - goto exit; - } - - /* the bind takes care of ensuring only one copy running */ - retval = bind(udevsendsock, (struct sockaddr *) &saddr, addrlen); - if (retval < 0) { - dbg("bind failed, exit"); - close(udevsendsock); goto exit; } - /* enable receiving of the sender credentials */ - setsockopt(udevsendsock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); - /* possible override of udev binary, used for testing */ udev_bin = getenv("UDEV_BIN"); if (udev_bin != NULL) -- cgit v1.2.3-54-g00ecf From ce043f851d4cb963cc0f566e590903dadb6c9fc1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 16 Jan 2005 04:39:02 +0100 Subject: [PATCH] udevd: it's obviously not the brightest idea to exit a device node manager if it doesn't find /dev/null --- udevd.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/udevd.c b/udevd.c index 7ae7a5b232..64abbe59a3 100644 --- a/udevd.c +++ b/udevd.c @@ -450,6 +450,7 @@ static void reap_sigchilds(void) static void user_sighandler(void) { int sig; + while(1) { int rc = read(pipefds[0], &sig, sizeof(sig)); if (rc < 0) @@ -533,15 +534,14 @@ int main(int argc, char *argv[], char *envp[]) /* Set fds to dev/null */ fd = open( "/dev/null", O_RDWR ); - if ( fd < 0 ) { + if (fd >= 0) { + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + if (fd > 2) + close(fd); + } else dbg("error opening /dev/null %s", strerror(errno)); - goto exit; - } - dup2(fd, 0); - dup2(fd, 1); - dup2(fd, 2); - if (fd > 2) - close(fd); /* become session leader */ setsid(); @@ -559,10 +559,8 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } retval = fcntl(pipefds[0], F_SETFD, FD_CLOEXEC); - if (retval < 0) { + if (retval < 0) dbg("error fcntl on read pipe: %s", strerror(errno)); - goto exit; - } retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK); if (retval < 0) { @@ -570,10 +568,8 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } retval = fcntl(pipefds[1], F_SETFD, FD_CLOEXEC); - if (retval < 0) { + if (retval < 0) dbg("error fcntl on write pipe: %s", strerror(errno)); - goto exit; - } /* set signal handlers */ act.sa_handler = (void (*) (int))sig_handler; @@ -586,7 +582,7 @@ int main(int argc, char *argv[], char *envp[]) if (init_udevsend_socket() < 0) { if (errno == EADDRINUSE) - dbg("another udevd is running, exit"); + dbg("another udevd running, exit"); else dbg("error initialising udevsend socket: %s", strerror(errno)); -- cgit v1.2.3-54-g00ecf From 1e26698933e89c11dc6806d8bd37fd4386814239 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 16 Jan 2005 05:53:29 +0100 Subject: [PATCH] udevd: add possible initialization of expected_seqnum UDEVD_EXPECTED_SEQNUM=$[`cat /sys/kernel/hotplug_seqnum` + 1] ./udevd -d will init udevd, so the next event will not wait for any timeout. --- udevd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/udevd.c b/udevd.c index 64abbe59a3..a8328bbb81 100644 --- a/udevd.c +++ b/udevd.c @@ -501,6 +501,7 @@ int main(int argc, char *argv[], char *envp[]) int fd; struct sigaction act; fd_set readfds; + const char *udevd_expected_seqnum; logging_init("udevd"); dbg("version %s", UDEV_VERSION); @@ -596,7 +597,14 @@ int main(int argc, char *argv[], char *envp[]) else udev_bin = UDEV_BIN; - /* handle special startup timeout*/ + /* possible set of expected_seqnum number */ + udevd_expected_seqnum = getenv("UDEVD_EXPECTED_SEQNUM"); + if (udevd_expected_seqnum != NULL) { + expected_seqnum = strtoull(udevd_expected_seqnum, NULL, 10); + dbg("initialize expected_seqnum to %llu", expected_seqnum); + } + + /* get current time to provide shorter startup timeout */ sysinfo(&info); startup_time = info.uptime; -- cgit v1.2.3-54-g00ecf From 085cce379a4256cd039ccda3c8198aba058c8720 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 17 Jan 2005 00:53:08 +0100 Subject: [PATCH] udevd: throttle the forking of processes If the system reaches a defined limit of processes in running state, udevd starts to count its own processes in running state from its session (all forked hotplug child processes, subprocesses and callouts) and throttles further process forking if the limit is reached. This should help setups with hundreds of events emitted hotplug events in parallel with hundreds of processes in "R" state. which makes the machine unresponsible. I placed a 100% cpu time consuming program in /etc/hotplug.d/ which runs for 5 seconds. With this patch I can load "scsi_debug add_host=100" without any major problem. Without the patch the box is completly unresponsible for many minutes. --- udevd.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- udevd.h | 10 +++++ 2 files changed, 136 insertions(+), 9 deletions(-) diff --git a/udevd.c b/udevd.c index a8328bbb81..53c7bf3df1 100644 --- a/udevd.c +++ b/udevd.c @@ -28,11 +28,13 @@ #include #include #include +#include +#include +#include #include #include #include #include -#include #include #include @@ -45,6 +47,7 @@ /* global variables*/ static int udevsendsock; +static pid_t sid; static int pipefds[2]; static long startup_time; @@ -144,6 +147,8 @@ static void udev_run(struct hotplug_msg *msg) /* child */ close(udevsendsock); logging_close(); + + setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); execve(udev_bin, argv, msg->envp); dbg("exec of child failed"); _exit(1); @@ -151,9 +156,6 @@ static void udev_run(struct hotplug_msg *msg) case -1: dbg("fork of child failed"); run_queue_delete(msg); - /* note: we never managed to run, so we had no impact on - * running_with_devpath(), so don't bother setting run_exec_q - */ break; default: /* get SIGCHLD in main loop */ @@ -162,6 +164,100 @@ static void udev_run(struct hotplug_msg *msg) } } +static int running_processes(void) +{ + int f; + static char buf[4096]; + int len; + int running; + const char *pos; + + f = open("/proc/stat", O_RDONLY); + if (f == -1) + return -1; + + len = read(f, buf, sizeof(buf)); + close(f); + + if (len <= 0) + return -1; + else + buf[len] = '\0'; + + pos = strstr(buf, "procs_running "); + if (pos == NULL) + return -1; + + if (sscanf(pos, "procs_running %u", &running) != 1) + return -1; + + return running; +} + +/* return the number of process es in our session, count only until limit */ +static int running_processes_in_session(pid_t session, int limit) +{ + DIR *dir; + struct dirent *dent; + int running = 0; + + dir = opendir("/proc"); + if (!dir) + return -1; + + /* read process info from /proc */ + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + int f; + char procdir[64]; + char line[256]; + const char *pos; + char state; + pid_t ppid, pgrp, sess; + int len; + + if (!isdigit(dent->d_name[0])) + continue; + + snprintf(procdir, sizeof(procdir), "/proc/%s/stat", dent->d_name); + procdir[sizeof(procdir)-1] = '\0'; + + f = open(procdir, O_RDONLY); + if (f == -1) + continue; + + len = read(f, line, sizeof(line)); + close(f); + + if (len <= 0) + continue; + else + line[len] = '\0'; + + /* skip ugly program name */ + pos = strrchr(line, ')') + 2; + if (pos == NULL) + continue; + + if (sscanf(pos, "%c %d %d %d ", &state, &ppid, &pgrp, &sess) != 4) + continue; + + /* count only processes in our session */ + if (sess != session) + continue; + + /* count only running, no sleeping processes */ + if (state != 'R') + continue; + + running++; + if (limit > 0 && running >= limit) + break; + } + closedir(dir); + + return running; +} + static int compare_devpath(const char *running, const char *waiting) { int i; @@ -218,13 +314,30 @@ static void exec_queue_manager(void) struct hotplug_msg *loop_msg; struct hotplug_msg *tmp_msg; struct hotplug_msg *msg; + int running; + + running = running_processes(); + dbg("%d processes runnning on system", running); + if (running < 0) + running = THROTTLE_MAX_RUNNING_CHILDS; list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, list) { + /* check running processes in our session and possibly throttle */ + if (running >= THROTTLE_MAX_RUNNING_CHILDS) { + running = running_processes_in_session(sid, THROTTLE_MAX_RUNNING_CHILDS+10); + dbg("%d processes running in session", running); + if (running >= THROTTLE_MAX_RUNNING_CHILDS) { + dbg("delay seq %llu, cause too many processes already running", loop_msg->seqnum); + return; + } + } + msg = running_with_devpath(loop_msg); if (!msg) { /* move event to run list */ list_move_tail(&loop_msg->list, &running_list); udev_run(loop_msg); + running++; dbg("moved seq %llu to running list", loop_msg->seqnum); } else { dbg("delay seq %llu (%s), cause seq %llu (%s) is still running", @@ -529,10 +642,17 @@ int main(int argc, char *argv[], char *envp[]) } } + /* become session leader */ + sid = setsid(); + dbg("our session is %d", sid); + /* make sure we don't lock any path */ chdir("/"); umask(umask(077) | 022); + /*set a reasonable scheduling priority for the daemon */ + setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); + /* Set fds to dev/null */ fd = open( "/dev/null", O_RDWR ); if (fd >= 0) { @@ -544,9 +664,6 @@ int main(int argc, char *argv[], char *envp[]) } else dbg("error opening /dev/null %s", strerror(errno)); - /* become session leader */ - setsid(); - /* setup signal handler pipe */ retval = pipe(pipefds); if (retval < 0) { @@ -597,14 +714,14 @@ int main(int argc, char *argv[], char *envp[]) else udev_bin = UDEV_BIN; - /* possible set of expected_seqnum number */ + /* possible init of expected_seqnum value */ udevd_expected_seqnum = getenv("UDEVD_EXPECTED_SEQNUM"); if (udevd_expected_seqnum != NULL) { expected_seqnum = strtoull(udevd_expected_seqnum, NULL, 10); dbg("initialize expected_seqnum to %llu", expected_seqnum); } - /* get current time to provide shorter startup timeout */ + /* get current time to provide shorter timeout on startup */ sysinfo(&info); startup_time = info.uptime; diff --git a/udevd.h b/udevd.h index 28f62cf528..ae1d20e5ec 100644 --- a/udevd.h +++ b/udevd.h @@ -28,10 +28,20 @@ #define UDEVD_SOCK_PATH "udevd" #define SEND_WAIT_MAX_SECONDS 3 #define SEND_WAIT_LOOP_PER_SECOND 10 + +#define UDEVD_PRIORITY -4 +#define UDEV_PRIORITY -2 + +/* duration of initialization phase with shorter timeout */ #define INIT_TIME_SEC 5 #define EVENT_INIT_TIMEOUT_SEC 2 + +/* timeout to wait for missing events */ #define EVENT_TIMEOUT_SEC 10 +/* start to throttle forking if maximum number of running childs in our session is reached */ +#define THROTTLE_MAX_RUNNING_CHILDS 10 + /* environment buffer, should match the kernel's size in lib/kobject_uevent.h */ #define HOTPLUG_BUFFER_SIZE 1024 #define HOTPLUG_NUM_ENVP 32 -- cgit v1.2.3-54-g00ecf From 5178355672901e2514e69cd0264f95ba155b8aba Mon Sep 17 00:00:00 2001 From: "tklauser@access.unizh.chbk" Date: Mon, 17 Jan 2005 03:54:26 +0100 Subject: [PATCH] I tried to compile udev 050plus with the GCC 4.0 snapshot 200412119 and --- udev_sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index d46f1f26d8..1b3603df6d 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -381,7 +381,7 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, struct sysfs_class_device *wait_class_device_open(const char *path) { - struct sysfs_class_device *class_dev; + struct sysfs_class_device *class_dev = NULL; int loop; loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; @@ -393,7 +393,7 @@ struct sysfs_class_device *wait_class_device_open(const char *path) usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - return (class_dev); + return class_dev; } int wait_for_class_device(struct sysfs_class_device *class_dev, @@ -450,7 +450,7 @@ int wait_for_class_device(struct sysfs_class_device *class_dev, struct sysfs_device *wait_devices_device_open(const char *path) { - struct sysfs_device *devices_dev; + struct sysfs_device *devices_dev = NULL; int loop; loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; @@ -462,5 +462,5 @@ struct sysfs_device *wait_devices_device_open(const char *path) usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - return(devices_dev); + return devices_dev; } -- cgit v1.2.3-54-g00ecf From c3a8dac6ff48eb52e3529b23f3db84021bbc2f4a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 17 Jan 2005 09:26:07 +0100 Subject: [PATCH] klibc: update to version 0.196 --- klibc/Makefile | 2 +- klibc/include/string.h | 3 ++- klibc/klibc/Makefile | 2 +- klibc/klibc/getopt.c | 1 + klibc/klibc/memchr.c | 1 + klibc/klibc/memrchr.c | 20 ++++++++++++++++++++ klibc/version | 2 +- 7 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 klibc/klibc/memrchr.c diff --git a/klibc/Makefile b/klibc/Makefile index 8823a33bfd..2506417ef5 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -1,5 +1,5 @@ VERSION := $(shell cat version) -SUBDIRS = klibc +SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip all: diff --git a/klibc/include/string.h b/klibc/include/string.h index 3bbb217e98..5608a3c963 100644 --- a/klibc/include/string.h +++ b/klibc/include/string.h @@ -10,6 +10,7 @@ __extern void *memccpy(void *, const void *, int, size_t); __extern void *memchr(const void *, int, size_t); +__extern void *memrchr(const void *, int, size_t); __extern int memcmp(const void *, const void *, size_t); __extern void *memcpy(void *, const void *, size_t); __extern void *memmove(void *, const void *, size_t); @@ -20,6 +21,7 @@ __extern int strcasecmp(const char *, const char *); __extern int strncasecmp(const char *, const char *, size_t); __extern char *strcat(char *, const char *); __extern char *strchr(const char *, int); +__extern char *strrchr(const char *, int); __extern int strcmp(const char *, const char *); __extern char *strcpy(char *, const char *); __extern size_t strcspn(const char *, const char *); @@ -34,7 +36,6 @@ __extern int strncmp(const char *, const char *, size_t); __extern char *strncpy(char *, const char *, size_t); __extern size_t strlcpy(char *, const char *, size_t); __extern char *strpbrk(const char *, const char *); -__extern char *strrchr(const char *, int); __extern char *strsep(char **, const char *); __extern size_t strspn(const char *, const char *); __extern char *strstr(const char *, const char *); diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index 0d44ce5494..d01b2e4326 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -30,7 +30,7 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ - memmove.o memchr.o \ + memmove.o memchr.o memrchr.o \ strcasecmp.o strncasecmp.o strndup.o strerror.o \ strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \ strncat.o strlcpy.o strlcat.o \ diff --git a/klibc/klibc/getopt.c b/klibc/klibc/getopt.c index 5a992dcdd7..cd534bf304 100644 --- a/klibc/klibc/getopt.c +++ b/klibc/klibc/getopt.c @@ -51,6 +51,7 @@ int getopt(int argc, char * const *argv, const char *optstring) optind += 2; } else { /* Missing argument */ + optind++; return (optstring[0] == ':') ? ':' : '?'; } } diff --git a/klibc/klibc/memchr.c b/klibc/klibc/memchr.c index c5c5fa2963..2e5e4cc7f2 100644 --- a/klibc/klibc/memchr.c +++ b/klibc/klibc/memchr.c @@ -12,6 +12,7 @@ void *memchr(const void *s, int c, size_t n) while ( n-- ) { if ( *sp == (unsigned char)c ) return (void *)sp; + sp++; } return NULL; diff --git a/klibc/klibc/memrchr.c b/klibc/klibc/memrchr.c new file mode 100644 index 0000000000..10d9c29851 --- /dev/null +++ b/klibc/klibc/memrchr.c @@ -0,0 +1,20 @@ +/* + * memrchr.c + */ + +#include +#include + +void *memrchr(const void *s, int c, size_t n) +{ + const unsigned char *sp = + (const unsigned char *)s + n - 1; + + while ( n-- ) { + if ( *sp == (unsigned char)c ) + return (void *)sp; + sp--; + } + + return NULL; +} diff --git a/klibc/version b/klibc/version index b553d446e1..3759b0aad0 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.194 +0.196 -- cgit v1.2.3-54-g00ecf From eb064000ca62e1f854db88c5011f308492d526d6 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 18 Jan 2005 09:13:01 +0100 Subject: [PATCH] udev_volume_id: fix FAT label reading --- extras/volume_id/volume_id.c | 54 ++++++++++++++++++++++++++++++++++---------- extras/volume_id/volume_id.h | 2 +- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c index e28c730326..3bf7886aaa 100644 --- a/extras/volume_id/volume_id.c +++ b/extras/volume_id/volume_id.c @@ -774,6 +774,8 @@ static int probe_jfs(struct volume_id *id, __u64 off) #define FAT16_MAX 0xfff5 #define FAT_ATTR_VOLUME_ID 0x08 #define FAT_ATTR_DIR 0x10 +#define FAT_ATTR_LONG_NAME 0x0f +#define FAT_ATTR_MASK 0x3f #define FAT_ENTRY_FREE 0xe5 static int probe_vfat(struct volume_id *id, __u64 off) { @@ -859,6 +861,9 @@ static int probe_vfat(struct volume_id *id, __u64 off) /* believe only that's fat, don't trust the version * the cluster_count will tell us */ + if (strncmp(vs->sysid, "NTFS", 4) == 0) + return -1; + if (strncmp(vs->type.fat32.magic, "MSWIN", 5) == 0) goto valid; @@ -956,7 +961,7 @@ valid: dir = (struct vfat_dir_entry*) buf; - for (i = 0; i <= root_dir_entries; i++) { + for (i = 0; i < root_dir_entries; i++) { /* end marker */ if (dir[i].name[0] == 0x00) { dbg("end of dir"); @@ -967,7 +972,15 @@ valid: if (dir[i].name[0] == FAT_ENTRY_FREE) continue; + /* long name */ + if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) + continue; + if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { + /* labels do not have file data */ + if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) + continue; + dbg("found ATTR_VOLUME_ID id in root dir"); label = dir[i].name; break; @@ -976,6 +989,10 @@ valid: dbg("skip dir entry"); } + vs = (struct vfat_super_block *) get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { set_label_raw(id, label, 11); set_label_string(id, label, 11); @@ -1015,7 +1032,7 @@ fat32: count = buf_size / sizeof(struct vfat_dir_entry); dbg("expected entries 0x%x", count); - for (i = 0; i <= count; i++) { + for (i = 0; i < count; i++) { /* end marker */ if (dir[i].name[0] == 0x00) { dbg("end of dir"); @@ -1026,7 +1043,15 @@ fat32: if (dir[i].name[0] == FAT_ENTRY_FREE) continue; + /* long name */ + if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) + continue; + if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { + /* labels do not have file data */ + if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) + continue; + dbg("found ATTR_VOLUME_ID id in root dir"); label = dir[i].name; goto fat32_label; @@ -1050,6 +1075,10 @@ fat32: dbg("reached maximum follow count of root cluster chain, give up"); fat32_label: + vs = (struct vfat_super_block *) get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { set_label_raw(id, label, 11); set_label_string(id, label, 11); @@ -1251,10 +1280,14 @@ static int probe_iso9660(struct volume_id *id, __u64 off) return -1; if (strncmp(is->iso.id, "CD001", 5) == 0) { + char root_label[VOLUME_ID_LABEL_SIZE+1]; int vd_offset; int i; int found_svd; + memset(root_label, 0, sizeof(root_label)); + strncpy(root_label, is->iso.volume_id, sizeof(root_label)-1); + found_svd = 0; vd_offset = ISO_VD_OFFSET; for (i = 0; i < ISO_VD_MAX; i++) { @@ -1264,22 +1297,19 @@ static int probe_iso9660(struct volume_id *id, __u64 off) break; if (is->iso.type == ISO_VD_SUPPLEMENTARY) { dbg("found ISO supplementary VD at offset 0x%llx", off + vd_offset); + set_label_raw(id, is->iso.volume_id, 32); + set_label_unicode16(id, is->iso.volume_id, BE, 32); found_svd = 1; break; } vd_offset += ISO_SECTOR_SIZE; } - if (!found_svd) { - is = (union iso_super_block *) - get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); - if (is == NULL) - return -1; - set_label_raw(id, is->iso.volume_id, 32); - set_label_string(id, is->iso.volume_id, 32); - } else { - set_label_raw(id, is->iso.volume_id, 32); - set_label_unicode16(id, is->iso.volume_id, BE, 32); + if (!found_svd || + (found_svd && !strncmp(root_label, id->label, 16))) + { + set_label_raw(id, root_label, 32); + set_label_string(id, root_label, 32); } goto found; } diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h index c26d1e4daf..9d66b196b7 100644 --- a/extras/volume_id/volume_id.h +++ b/extras/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 27 +#define VOLUME_ID_VERSION 28 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 -- cgit v1.2.3-54-g00ecf From 94f88ba5eebfcb45ecc99bc0c32b167204ad427a Mon Sep 17 00:00:00 2001 From: "hare@suse.de" Date: Thu, 20 Jan 2005 04:44:36 +0100 Subject: [PATCH] rearrange link order in Makefile The link-order in the main Makefile is not quite correct (sysfs should be linked after udev.a) which might cause the build to fail. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 52c1d47b2d..d56f22d0df 100644 --- a/Makefile +++ b/Makefile @@ -228,8 +228,8 @@ UDEV_OBJS = \ namedev_parse.o OBJS = \ - libsysfs/sysfs.a \ - udev.a + udev.a \ + libsysfs/sysfs.a SYSFS = $(PWD)/libsysfs/sysfs.a -- cgit v1.2.3-54-g00ecf From aa7f11f4709798d5173d289475103cb078996f58 Mon Sep 17 00:00:00 2001 From: "greg@bucket.kroah.org" Date: Wed, 12 Jan 2005 08:15:22 -0800 Subject: [PATCH] fix gcc 2.96 issue in libsysfs --- libsysfs/dlist.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c index 5f2c00be9b..c4ee324573 100644 --- a/libsysfs/dlist.c +++ b/libsysfs/dlist.c @@ -546,11 +546,14 @@ int _dlist_merge(struct dlist *listsource, struct dlist *listdest, unsigned int void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)) { - dlist_start(list); struct dlist *listsource, *listdest, *swap; - struct dlist *templist = dlist_new(list->data_size); + struct dlist *templist; unsigned int passcount = 1; unsigned int mergecount = 1; + + dlist_start(list); + templist = dlist_new(list->data_size); + // do nothing if there isn't anything to sort listsource = list; listdest = templist; -- cgit v1.2.3-54-g00ecf From 83e1f809c93c5d3770504e13ed06041af8252d20 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 12 Jan 2005 17:46:50 -0800 Subject: [PATCH] clean up the aoe char device rules, and delete the block one as it's not needed. --- etc/udev/gentoo/udev.rules | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 3c09d072da..6f71321fb8 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -78,13 +78,9 @@ KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k", GROUP="disk" KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k", GROUP="disk" # aoe char devices, -# we might have to add a "CLASS" type one of these days to make this a bit saner -KERNEL="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" -KERNEL="err", NAME="etherd/%k", GROUP="disk", MODE="0440" -KERNEL="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" - -# aoe block devices -KERNEL="etherd*", NAME="%k", GROUP="disk" +SUBSYSTEM="aoe", KERNEL="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM="aoe", KERNEL="err", NAME="etherd/%k", GROUP="disk", MODE="0440" +SUBSYSTEM="aoe", KERNEL="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" # misc devices KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -- cgit v1.2.3-54-g00ecf From 614238630687c6b7375f0adbc2692fcc0f3c7f9c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Wed, 19 Jan 2005 22:04:54 -0800 Subject: [PATCH] remove the lfs startup script on request of the author. The distro now has its own version, so this one is not needed. --- etc/init.d/udev.init.lfs | 60 ------------------------------------------------ 1 file changed, 60 deletions(-) delete mode 100644 etc/init.d/udev.init.lfs diff --git a/etc/init.d/udev.init.lfs b/etc/init.d/udev.init.lfs deleted file mode 100644 index d4f64062b8..0000000000 --- a/etc/init.d/udev.init.lfs +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# -# LinuxFromScratch udev init script -# derived from original RedHat udev init script -# 2003, 2004 by Michael Buesch -# - -. /etc/sysconfig/rc -. $rc_functions -. /etc/udev/udev.conf - -sysfs_dir="/sys" - -case "$1" in - start) - echo "Creating initial udev device nodes ..." - if [ ! -d $sysfs_dir ]; then - echo "sysfs_dir $sysfs_dir does not exist!" - print_status failure - exit 1 - fi - if [ ! -d $udev_root ]; then - mkdir $udev_root - if [ $? -ne 0 ]; then - print_status failure - exit 1 - fi - fi - - # propogate /udev from /sys - we only need this while we do not - # have initramfs and an early user-space with which to do early - # device bring up - udevstart - evaluate_retval - ;; - stop) - echo "Stopping udev ..." - evaluate_retval - ;; - reload) - # nothing to do here - ;; - restart) - $0 stop - sleep 1 - $0 start - ;; - status) - if [ -d $udev_dir ]; then - echo "the udev device node directory exists" - else - echo "the udev device node directory does not exist" - fi - ;; - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; -esac -exit 0 -- cgit v1.2.3-54-g00ecf From 43ca395e49c854b6c3bb9abb633e9e072e5df793 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 28 Jan 2005 07:53:22 +0100 Subject: [PATCH] klibc: update to version 0.198 --- klibc/klibc.spec | 2 +- klibc/klibc/Makefile | 2 +- klibc/klibc/fread.c | 5 +++-- klibc/klibc/fwrite.c | 7 ++++--- klibc/klibc/sha1hash.c | 2 +- klibc/klibc/strncat.c | 6 ++---- klibc/version | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/klibc/klibc.spec b/klibc/klibc.spec index 272e52bc1a..02131c7f25 100644 --- a/klibc/klibc.spec +++ b/klibc/klibc.spec @@ -1,6 +1,6 @@ Summary: A minimal libc subset for use with initramfs. Name: klibc -Version: 0.194 +Version: 0.198 Release: 1 License: BSD/GPL Group: Development/Libraries diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index d01b2e4326..8a9a68bcf7 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -59,7 +59,7 @@ LIB = libc.a INTERP_O = interp.o -all: tests $(CRT0) $(LIB) $(SOLIB) klibc.so +all: tests $(CRT0) $(LIB) $(SOLIB) $(SOHASH) $(INTERP_O) # Add any architecture-specific rules include arch/$(ARCH)/Makefile.inc diff --git a/klibc/klibc/fread.c b/klibc/klibc/fread.c index 8f7dba9c19..a49f0d8210 100644 --- a/klibc/klibc/fread.c +++ b/klibc/klibc/fread.c @@ -15,9 +15,10 @@ size_t _fread(void *buf, size_t count, FILE *f) while ( count ) { rv = read(fileno(f), p, count); if ( rv == -1 ) { - if ( errno == EINTR ) + if ( errno == EINTR ) { + errno = 0; continue; - else + } else break; } else if ( rv == 0 ) { break; diff --git a/klibc/klibc/fwrite.c b/klibc/klibc/fwrite.c index 0a73188c67..ad61c86b88 100644 --- a/klibc/klibc/fwrite.c +++ b/klibc/klibc/fwrite.c @@ -15,9 +15,10 @@ size_t _fwrite(const void *buf, size_t count, FILE *f) while ( count ) { rv = write(fileno(f), p, count); if ( rv == -1 ) { - if ( errno == EINTR ) - continue; - else + if ( errno == EINTR ) { + errno = 0; + continue; + } else break; } else if ( rv == 0 ) { break; diff --git a/klibc/klibc/sha1hash.c b/klibc/klibc/sha1hash.c index f81e08b17c..28e3399967 100644 --- a/klibc/klibc/sha1hash.c +++ b/klibc/klibc/sha1hash.c @@ -263,7 +263,7 @@ unsigned char finalcount[8]; char *mybase64(uint8_t digest[20]) { static const char charz[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; uint8_t input[21]; static char output[28]; int i, j; diff --git a/klibc/klibc/strncat.c b/klibc/klibc/strncat.c index 0dd9deb984..4d8458d5ec 100644 --- a/klibc/klibc/strncat.c +++ b/klibc/klibc/strncat.c @@ -12,14 +12,12 @@ char *strncat(char *dst, const char *src, size_t n) char ch; size_t nn = q-dst; - if ( __likely(nn <= n) ) - n -= nn; - while (n--) { *q++ = ch = *p++; if ( !ch ) - break; + return dst; } + *q = '\0'; return dst; } diff --git a/klibc/version b/klibc/version index 3759b0aad0..129efcc007 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.196 +0.198 -- cgit v1.2.3-54-g00ecf From 61b24e5e19fb189cfce7ff323c58e1bb1d7cce4d Mon Sep 17 00:00:00 2001 From: "cborntra@de.ibm.com" Date: Sun, 30 Jan 2005 13:09:38 +0100 Subject: [PATCH] udev_volume_id: fix -d option The -d option in udev_allows to go from a partition to the underlying disk for s390 dasd labels. If the device is already the disk itself, finding the parent will fail, therefore -d on /sys/block/dasda/ for example gives no result at all. --- extras/volume_id/udev_volume_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 3fab54786b..7b69856804 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) if (class_dev_parent != NULL) vid = open_classdev(class_dev_parent); else - vid = open_classdev(class_dev_parent); + vid = open_classdev(class_dev); if (vid == NULL) goto exit; -- cgit v1.2.3-54-g00ecf From c033fd9f01b3cd5771875069c26d3af06969a300 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 31 Jan 2005 05:28:44 +0100 Subject: [PATCH] udev_volume_id: new version of volume_id Every filesystem has its own subdirectory. The IBM dasd label reading is included into volume_id. --- extras/volume_id/Makefile | 47 +- extras/volume_id/dasdlabel.c | 178 -- extras/volume_id/dasdlabel.h | 26 - extras/volume_id/udev_volume_id.c | 35 +- extras/volume_id/volume_id.c | 2305 -------------------- extras/volume_id/volume_id.h | 112 - extras/volume_id/volume_id/dasd/dasd.c | 194 ++ extras/volume_id/volume_id/dasd/dasd.h | 26 + extras/volume_id/volume_id/ext/ext.c | 86 + extras/volume_id/volume_id/ext/ext.h | 26 + extras/volume_id/volume_id/fat/fat.c | 350 +++ extras/volume_id/volume_id/fat/fat.h | 26 + extras/volume_id/volume_id/hfs/hfs.c | 308 +++ extras/volume_id/volume_id/hfs/hfs.h | 26 + extras/volume_id/volume_id/highpoint/highpoint.c | 70 + extras/volume_id/volume_id/highpoint/highpoint.h | 26 + extras/volume_id/volume_id/iso9660/iso9660.c | 115 + extras/volume_id/volume_id/iso9660/iso9660.h | 26 + extras/volume_id/volume_id/jfs/jfs.c | 74 + extras/volume_id/volume_id/jfs/jfs.h | 26 + extras/volume_id/volume_id/linux_raid/linux_raid.c | 97 + extras/volume_id/volume_id/linux_raid/linux_raid.h | 26 + extras/volume_id/volume_id/linux_swap/linux_swap.c | 87 + extras/volume_id/volume_id/linux_swap/linux_swap.h | 26 + extras/volume_id/volume_id/logging.h | 21 + extras/volume_id/volume_id/lvm/lvm.c | 104 + extras/volume_id/volume_id/lvm/lvm.h | 27 + extras/volume_id/volume_id/mac/mac.c | 140 ++ extras/volume_id/volume_id/mac/mac.h | 26 + extras/volume_id/volume_id/msdos/msdos.c | 212 ++ extras/volume_id/volume_id/msdos/msdos.h | 26 + extras/volume_id/volume_id/ntfs/ntfs.c | 205 ++ extras/volume_id/volume_id/ntfs/ntfs.h | 26 + extras/volume_id/volume_id/reiserfs/reiserfs.c | 97 + extras/volume_id/volume_id/reiserfs/reiserfs.h | 26 + extras/volume_id/volume_id/udf/udf.c | 187 ++ extras/volume_id/volume_id/udf/udf.h | 26 + extras/volume_id/volume_id/ufs/ufs.c | 220 ++ extras/volume_id/volume_id/ufs/ufs.h | 26 + extras/volume_id/volume_id/util.c | 245 +++ extras/volume_id/volume_id/util.h | 91 + extras/volume_id/volume_id/volume_id.c | 202 ++ extras/volume_id/volume_id/volume_id.h | 81 + extras/volume_id/volume_id/xfs/xfs.c | 74 + extras/volume_id/volume_id/xfs/xfs.h | 26 + extras/volume_id/volume_id_logging.h | 21 - 46 files changed, 3752 insertions(+), 2675 deletions(-) delete mode 100644 extras/volume_id/dasdlabel.c delete mode 100644 extras/volume_id/dasdlabel.h delete mode 100644 extras/volume_id/volume_id.c delete mode 100644 extras/volume_id/volume_id.h create mode 100644 extras/volume_id/volume_id/dasd/dasd.c create mode 100644 extras/volume_id/volume_id/dasd/dasd.h create mode 100644 extras/volume_id/volume_id/ext/ext.c create mode 100644 extras/volume_id/volume_id/ext/ext.h create mode 100644 extras/volume_id/volume_id/fat/fat.c create mode 100644 extras/volume_id/volume_id/fat/fat.h create mode 100644 extras/volume_id/volume_id/hfs/hfs.c create mode 100644 extras/volume_id/volume_id/hfs/hfs.h create mode 100644 extras/volume_id/volume_id/highpoint/highpoint.c create mode 100644 extras/volume_id/volume_id/highpoint/highpoint.h create mode 100644 extras/volume_id/volume_id/iso9660/iso9660.c create mode 100644 extras/volume_id/volume_id/iso9660/iso9660.h create mode 100644 extras/volume_id/volume_id/jfs/jfs.c create mode 100644 extras/volume_id/volume_id/jfs/jfs.h create mode 100644 extras/volume_id/volume_id/linux_raid/linux_raid.c create mode 100644 extras/volume_id/volume_id/linux_raid/linux_raid.h create mode 100644 extras/volume_id/volume_id/linux_swap/linux_swap.c create mode 100644 extras/volume_id/volume_id/linux_swap/linux_swap.h create mode 100644 extras/volume_id/volume_id/logging.h create mode 100644 extras/volume_id/volume_id/lvm/lvm.c create mode 100644 extras/volume_id/volume_id/lvm/lvm.h create mode 100644 extras/volume_id/volume_id/mac/mac.c create mode 100644 extras/volume_id/volume_id/mac/mac.h create mode 100644 extras/volume_id/volume_id/msdos/msdos.c create mode 100644 extras/volume_id/volume_id/msdos/msdos.h create mode 100644 extras/volume_id/volume_id/ntfs/ntfs.c create mode 100644 extras/volume_id/volume_id/ntfs/ntfs.h create mode 100644 extras/volume_id/volume_id/reiserfs/reiserfs.c create mode 100644 extras/volume_id/volume_id/reiserfs/reiserfs.h create mode 100644 extras/volume_id/volume_id/udf/udf.c create mode 100644 extras/volume_id/volume_id/udf/udf.h create mode 100644 extras/volume_id/volume_id/ufs/ufs.c create mode 100644 extras/volume_id/volume_id/ufs/ufs.h create mode 100644 extras/volume_id/volume_id/util.c create mode 100644 extras/volume_id/volume_id/util.h create mode 100644 extras/volume_id/volume_id/volume_id.c create mode 100644 extras/volume_id/volume_id/volume_id.h create mode 100644 extras/volume_id/volume_id/xfs/xfs.c create mode 100644 extras/volume_id/volume_id/xfs/xfs.h delete mode 100644 extras/volume_id/volume_id_logging.h diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 5c8adb065b..f0c15b8fec 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -33,8 +33,50 @@ override CFLAGS+=-Wall -fno-builtin -Wchar-subscripts \ override CFLAGS+=-D_FILE_OFFSET_BITS=64 -OBJS = volume_id.o udev_volume_id.o dasdlabel.o $(SYSFS) -HEADERS = volume_id.h dasdlabel.h +VOLUME_ID_OBJS= \ + volume_id/ext/ext.o \ + volume_id/fat/fat.o \ + volume_id/hfs/hfs.o \ + volume_id/highpoint/highpoint.o \ + volume_id/iso9660/iso9660.o \ + volume_id/jfs/jfs.o \ + volume_id/linux_raid/linux_raid.o \ + volume_id/linux_swap/linux_swap.o \ + volume_id/lvm/lvm.o \ + volume_id/mac/mac.o \ + volume_id/msdos/msdos.o \ + volume_id/ntfs/ntfs.o \ + volume_id/reiserfs/reiserfs.o \ + volume_id/udf/udf.o \ + volume_id/ufs/ufs.o \ + volume_id/xfs/xfs.o \ + volume_id/dasd/dasd.o \ + volume_id/volume_id.o \ + volume_id/util.o + +VOLUME_ID_HEADERS= \ + volume_id/ext/ext.h \ + volume_id/fat/fat.h \ + volume_id/hfs/hfs.h \ + volume_id/highpoint/highpoint.h \ + volume_id/iso9660/iso9660.h \ + volume_id/jfs/jfs.h \ + volume_id/linux_raid/linux_raid.h \ + volume_id/linux_swap/linux_swap.h \ + volume_id/lvm/lvm.h \ + volume_id/mac/mac.h \ + volume_id/msdos/msdos.h \ + volume_id/ntfs/ntfs.h \ + volume_id/reiserfs/reiserfs.h \ + volume_id/udf/udf.h \ + volume_id/ufs/ufs.h \ + volume_id/xfs/xfs.h \ + volume_id/dasd/dasd.h \ + volume_id/volume_id.h \ + volume_id/util.h + +OBJS = udev_volume_id.o $(VOLUME_ID_OBJS) $(SYSFS) +HEADERS = $(VOLUME_ID_HEADERS) $(OBJS): $(HEADERS) @@ -54,4 +96,3 @@ install: all uninstall: - rm $(DESTDIR)$(sbindir)/$(PROG) - diff --git a/extras/volume_id/dasdlabel.c b/extras/volume_id/dasdlabel.c deleted file mode 100644 index cbbe88179d..0000000000 --- a/extras/volume_id/dasdlabel.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * dasdlabel - read label from s390 block device - * - * Copyright (C) 2004 Arnd Bergmann - * - * 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 02139, USA. - * - */ - - -#include -#include -#include -#include -#include -#include - -#include "dasdlabel.h" - -static unsigned char EBCtoASC[256] = -{ -/* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ - 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, -/* 0x08 -GE -SPS -RPT VT FF CR SO SI */ - 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -/* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC - -ENP ->LF */ - 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, -/* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB - -IUS */ - 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -/* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC - -INP */ - 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, -/* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL - -SW */ - 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, -/* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ - 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, -/* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ - 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, -/* 0x40 SP RSP ä ---- */ - 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, -/* 0x48 . < ( + | */ - 0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, -/* 0x50 & ---- */ - 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, -/* 0x58 ß ! $ * ) ; */ - 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, -/* 0x60 - / ---- Ä ---- ---- ---- */ - 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, -/* 0x68 ---- , % _ > ? */ - 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, -/* 0x70 --- ---- ---- ---- ---- ---- ---- */ - 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -/* 0x78 * ` : # @ ' = " */ - 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, -/* 0x80 * a b c d e f g */ - 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, -/* 0x88 h i ---- ---- ---- */ - 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, -/* 0x90 ° j k l m n o p */ - 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, -/* 0x98 q r ---- ---- */ - 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, -/* 0xA0 ~ s t u v w x */ - 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, -/* 0xA8 y z ---- ---- ---- ---- */ - 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, -/* 0xB0 ^ ---- § ---- */ - 0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, -/* 0xB8 ---- [ ] ---- ---- ---- ---- */ - 0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07, -/* 0xC0 { A B C D E F G */ - 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, -/* 0xC8 H I ---- ö ---- */ - 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, -/* 0xD0 } J K L M N O P */ - 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, -/* 0xD8 Q R ---- ü */ - 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, -/* 0xE0 \ S T U V W X */ - 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, -/* 0xE8 Y Z ---- Ö ---- ---- ---- */ - 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, -/* 0xF0 0 1 2 3 4 5 6 7 */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, -/* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ - 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 -}; - -static void vtoc_ebcdic_dec (unsigned char *source, unsigned char *target, int l) -{ - int i; - - for (i = 0; i < l; i++) - target[i]=EBCtoASC[(unsigned char)(source[i])]; -} - -/* - * struct dasd_information_t - * represents any data about the data, which is visible to userspace - */ -typedef struct dasd_information_t { - unsigned int devno; /* S/390 devno */ - unsigned int real_devno; /* for aliases */ - unsigned int schid; /* S/390 subchannel identifier */ - unsigned int cu_type : 16; /* from SenseID */ - unsigned int cu_model : 8; /* from SenseID */ - unsigned int dev_type : 16; /* from SenseID */ - unsigned int dev_model : 8; /* from SenseID */ - unsigned int open_count; - unsigned int req_queue_len; - unsigned int chanq_len; /* length of chanq */ - char type[4]; /* from discipline.name, 'none' for unknown */ - unsigned int status; /* current device level */ - unsigned int label_block; /* where to find the VOLSER */ - unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ - unsigned int characteristics_size; - unsigned int confdata_size; - char characteristics[64]; /* from read_device_characteristics */ - char configuration_data[256]; /* from read_configuration_data */ -} dasd_information_t; - -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 14 -#define _IOC_DIRBITS 2 -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) -#define DASD_IOCTL_LETTER 'D' - -#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) -#define BLKSSZGET _IO(0x12,104) - -int probe_ibm_partition(int fd, char *out) -{ - int blocksize; - dasd_information_t info; - char name[7] = {0,}; - unsigned char data[16]; - - if (ioctl(fd, BIODASDINFO, (unsigned long)&info) != 0) - return -1; - - if (ioctl(fd, BLKSSZGET, (unsigned long)&blocksize)) - return -1; - - lseek(fd, info.label_block * blocksize, SEEK_SET); - if (read(fd, &data, 16) != 16) - return -1; - - if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) - strncpy(name, data + 8, 6); - else - strncpy(name, data + 4, 6); - - vtoc_ebcdic_dec(name, out, 6); - - return 0; -} diff --git a/extras/volume_id/dasdlabel.h b/extras/volume_id/dasdlabel.h deleted file mode 100644 index 1501d3ff89..0000000000 --- a/extras/volume_id/dasdlabel.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * dasdlabel - read label from s390 block device - * - * Copyright (C) 2004 Arnd Bergmann - * - * 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 02139, USA. - * - */ - -#ifndef _DASDLABEL_H_ -#define _DASDLABEL_H_ - -extern int probe_ibm_partition(int fd, char *out); - -#endif diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 7b69856804..915c1c4117 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -31,8 +31,8 @@ #include "../../libsysfs/sysfs/libsysfs.h" #include "../../udev_utils.h" #include "../../logging.h" -#include "volume_id.h" -#include "dasdlabel.h" +#include "volume_id/volume_id.h" +#include "volume_id/dasd/dasd.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) @@ -74,26 +74,6 @@ static struct volume_id *open_classdev(struct sysfs_class_device *class_dev) return vid; } -static char *usage_id_name(enum volume_id_usage usage) -{ - switch(usage) { - case VOLUME_ID_UNUSED: - return "unused"; - case VOLUME_ID_UNPROBED: - return "unprobed"; - case VOLUME_ID_OTHER: - return "other"; - case VOLUME_ID_PARTITIONTABLE: - return "partitiontable"; - case VOLUME_ID_FILESYSTEM: - return "filesystem"; - case VOLUME_ID_RAID: - return "raid"; - default: - return "unknown type_id"; - } -} - int main(int argc, char *argv[]) { const char help[] = "usage: udev_volume_id [-t|-l|-u|-d]\n" @@ -111,7 +91,6 @@ int main(int argc, char *argv[]) char *devpath; char probe = 'p'; char print = 'a'; - char dasd_label[7]; static char name[VOLUME_ID_LABEL_SIZE]; int len, i, j; unsigned long long size; @@ -177,7 +156,7 @@ int main(int argc, char *argv[]) if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) size = 0; - if (volume_id_probe(vid, VOLUME_ID_ALL, 0, size) == 0) + if (volume_id_probe_all(vid, 0, size) == 0) goto print; break; case 'd' : @@ -190,12 +169,8 @@ int main(int argc, char *argv[]) if (vid == NULL) goto exit; - if (probe_ibm_partition(vid->fd, dasd_label) == 0) { - vid->type = "dasd"; - strncpy(vid->label, dasd_label, 6); - vid->label[6] = '\0'; + if (probe_ibm_partition(vid) == 0) goto print; - } break; } @@ -247,7 +222,7 @@ print: printf("%s\n", vid->uuid); break; case 'a': - printf("F:%s\n", usage_id_name(vid->usage_id)); + printf("F:%s\n", vid->usage); printf("T:%s\n", vid->type); printf("V:%s\n", vid->type_version); printf("L:%s\n", vid->label); diff --git a/extras/volume_id/volume_id.c b/extras/volume_id/volume_id.c deleted file mode 100644 index 3bf7886aaa..0000000000 --- a/extras/volume_id/volume_id.c +++ /dev/null @@ -1,2305 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * The superblock structs are taken from the linux kernel sources - * and the libblkid living inside the e2fsprogs. This is a simple - * straightforward implementation for reading the label strings of the - * most common filesystems. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "volume_id_logging.h" - -#define bswap16(x) (__u16)((((__u16)(x) & 0x00ffu) << 8) | \ - (((__u16)(x) & 0xff00u) >> 8)) - -#define bswap32(x) (__u32)((((__u32)(x) & 0xff000000u) >> 24) | \ - (((__u32)(x) & 0x00ff0000u) >> 8) | \ - (((__u32)(x) & 0x0000ff00u) << 8) | \ - (((__u32)(x) & 0x000000ffu) << 24)) - -#define bswap64(x) (__u64)((((__u64)(x) & 0xff00000000000000ull) >> 56) | \ - (((__u64)(x) & 0x00ff000000000000ull) >> 40) | \ - (((__u64)(x) & 0x0000ff0000000000ull) >> 24) | \ - (((__u64)(x) & 0x000000ff00000000ull) >> 8) | \ - (((__u64)(x) & 0x00000000ff000000ull) << 8) | \ - (((__u64)(x) & 0x0000000000ff0000ull) << 24) | \ - (((__u64)(x) & 0x000000000000ff00ull) << 40) | \ - (((__u64)(x) & 0x00000000000000ffull) << 56)) - -#if (__BYTE_ORDER == __LITTLE_ENDIAN) -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#define le64_to_cpu(x) (x) -#define be16_to_cpu(x) bswap16(x) -#define be32_to_cpu(x) bswap32(x) -#elif (__BYTE_ORDER == __BIG_ENDIAN) -#define le16_to_cpu(x) bswap16(x) -#define le32_to_cpu(x) bswap32(x) -#define le64_to_cpu(x) bswap64(x) -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) -#endif - -/* size of superblock buffer, reiserfs block is at 64k */ -#define SB_BUFFER_SIZE 0x11000 -/* size of seek buffer 4k */ -#define SEEK_BUFFER_SIZE 0x10000 - - -static void set_label_raw(struct volume_id *id, - const __u8 *buf, unsigned int count) -{ - memcpy(id->label_raw, buf, count); - id->label_raw_len = count; -} - -static void set_label_string(struct volume_id *id, - const __u8 *buf, unsigned int count) -{ - unsigned int i; - - memcpy(id->label, buf, count); - - /* remove trailing whitespace */ - i = strnlen(id->label, count); - while (i--) { - if (! isspace(id->label[i])) - break; - } - id->label[i+1] = '\0'; -} - -#define LE 0 -#define BE 1 -static void set_label_unicode16(struct volume_id *id, - const __u8 *buf, - unsigned int endianess, - unsigned int count) -{ - unsigned int i, j; - __u16 c; - - j = 0; - for (i = 0; i + 2 <= count; i += 2) { - if (endianess == LE) - c = (buf[i+1] << 8) | buf[i]; - else - c = (buf[i] << 8) | buf[i+1]; - if (c == 0) { - id->label[j] = '\0'; - break; - } else if (c < 0x80) { - id->label[j++] = (__u8) c; - } else if (c < 0x800) { - id->label[j++] = (__u8) (0xc0 | (c >> 6)); - id->label[j++] = (__u8) (0x80 | (c & 0x3f)); - } else { - id->label[j++] = (__u8) (0xe0 | (c >> 12)); - id->label[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f)); - id->label[j++] = (__u8) (0x80 | (c & 0x3f)); - } - } -} - -enum uuid_format { - UUID_DCE, - UUID_DOS, - UUID_NTFS, - UUID_HFS, -}; - -static void set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format format) -{ - unsigned int i; - unsigned int count = 0; - - switch(format) { - case UUID_DOS: - count = 4; - break; - case UUID_NTFS: - case UUID_HFS: - count = 8; - break; - case UUID_DCE: - count = 16; - } - memcpy(id->uuid_raw, buf, count); - - /* if set, create string in the same format, the native platform uses */ - for (i = 0; i < count; i++) - if (buf[i] != 0) - goto set; - return; - -set: - switch(format) { - case UUID_DOS: - sprintf(id->uuid, "%02X%02X-%02X%02X", - buf[3], buf[2], buf[1], buf[0]); - break; - case UUID_NTFS: - sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", - buf[7], buf[6], buf[5], buf[4], - buf[3], buf[2], buf[1], buf[0]); - break; - case UUID_HFS: - sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], buf[6], buf[7]); - break; - case UUID_DCE: - sprintf(id->uuid, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], - buf[6], buf[7], - buf[8], buf[9], - buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); - break; - } -} - -static __u8 *get_buffer(struct volume_id *id, __u64 off, unsigned int len) -{ - unsigned int buf_len; - - dbg("get buffer off 0x%llx, len 0x%x", off, len); - /* check if requested area fits in superblock buffer */ - if (off + len <= SB_BUFFER_SIZE) { - if (id->sbbuf == NULL) { - id->sbbuf = malloc(SB_BUFFER_SIZE); - if (id->sbbuf == NULL) - return NULL; - } - - /* check if we need to read */ - if ((off + len) > id->sbbuf_len) { - dbg("read sbbuf len:0x%llx", off + len); - lseek(id->fd, 0, SEEK_SET); - buf_len = read(id->fd, id->sbbuf, off + len); - dbg("got 0x%x (%i) bytes", buf_len, buf_len); - id->sbbuf_len = buf_len; - if (buf_len < off + len) - return NULL; - } - - return &(id->sbbuf[off]); - } else { - if (len > SEEK_BUFFER_SIZE) { - dbg("seek buffer too small %d", SEEK_BUFFER_SIZE); - return NULL; - } - - /* get seek buffer */ - if (id->seekbuf == NULL) { - id->seekbuf = malloc(SEEK_BUFFER_SIZE); - if (id->seekbuf == NULL) - return NULL; - } - - /* check if we need to read */ - if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - dbg("read seekbuf off:0x%llx len:0x%x", off, len); - if (lseek(id->fd, off, SEEK_SET) == -1) - return NULL; - buf_len = read(id->fd, id->seekbuf, len); - dbg("got 0x%x (%i) bytes", buf_len, buf_len); - id->seekbuf_off = off; - id->seekbuf_len = buf_len; - if (buf_len < len) { - dbg("requested 0x%x bytes, got only 0x%x bytes", len, buf_len); - return NULL; - } - } - - return &(id->seekbuf[off - id->seekbuf_off]); - } -} - -static void free_buffer(struct volume_id *id) -{ - if (id->sbbuf != NULL) { - free(id->sbbuf); - id->sbbuf = NULL; - id->sbbuf_len = 0; - } - if (id->seekbuf != NULL) { - free(id->seekbuf); - id->seekbuf = NULL; - id->seekbuf_len = 0; - } -} - -#define HPT37X_CONFIG_OFF 0x1200 -#define HPT37X_MAGIC_OK 0x5a7816f0 -#define HPT37X_MAGIC_BAD 0x5a7816fd -static int probe_highpoint_ataraid(struct volume_id *id, __u64 off) -{ - struct hpt37x { - __u8 filler1[32]; - __u32 magic; - __u32 magic_0; - __u32 magic_1; - } __attribute__((packed)) *hpt; - - const __u8 *buf; - - buf = get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); - if (buf == NULL) - return -1; - - hpt = (struct hpt37x *) buf; - - if (hpt->magic != HPT37X_MAGIC_OK && hpt->magic != HPT37X_MAGIC_BAD) - return -1; - - id->usage_id = VOLUME_ID_RAID; - id->type_id = VOLUME_ID_HPTRAID; - id->type = "hpt_ataraid_member"; - - return 0; -} - -#define LVM1_SB_OFF 0x400 -#define LVM1_MAGIC "HM" -static int probe_lvm1(struct volume_id *id, __u64 off) -{ - struct lvm2_super_block { - __u8 id[2]; - } __attribute__((packed)) *lvm; - - const __u8 *buf; - - buf = get_buffer(id, off + LVM1_SB_OFF, 0x800); - if (buf == NULL) - return -1; - - lvm = (struct lvm2_super_block *) buf; - - if (strncmp(lvm->id, LVM1_MAGIC, 2) != 0) - return -1; - - id->usage_id = VOLUME_ID_RAID; - id->type_id = VOLUME_ID_LVM1; - id->type = "LVM1_member"; - - return 0; -} - -#define LVM2_LABEL_ID "LABELONE" -#define LVM2LABEL_SCAN_SECTORS 4 -static int probe_lvm2(struct volume_id *id, __u64 off) -{ - struct lvm2_super_block { - __u8 id[8]; - __u64 sector_xl; - __u32 crc_xl; - __u32 offset_xl; - __u8 type[8]; - } __attribute__((packed)) *lvm; - - const __u8 *buf; - unsigned int soff; - - buf = get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); - if (buf == NULL) - return -1; - - - for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { - lvm = (struct lvm2_super_block *) &buf[soff]; - - if (strncmp(lvm->id, LVM2_LABEL_ID, 8) == 0) - goto found; - } - - return -1; - -found: - strncpy(id->type_version, lvm->type, 8); - id->usage_id = VOLUME_ID_RAID; - id->type_id = VOLUME_ID_LVM2; - id->type = "LVM2_member"; - - return 0; -} - -#define MD_RESERVED_BYTES 0x10000 -#define MD_MAGIC 0xa92b4efc -static int probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) -{ - struct mdp_super_block { - __u32 md_magic; - __u32 major_version; - __u32 minor_version; - __u32 patch_version; - __u32 gvalid_words; - __u32 set_uuid0; - __u32 ctime; - __u32 level; - __u32 size; - __u32 nr_disks; - __u32 raid_disks; - __u32 md_minor; - __u32 not_persistent; - __u32 set_uuid1; - __u32 set_uuid2; - __u32 set_uuid3; - } __attribute__((packed)) *mdp; - - const __u8 *buf; - __u64 sboff; - __u8 uuid[16]; - - if (size < 0x10000) - return -1; - - sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; - buf = get_buffer(id, off + sboff, 0x800); - if (buf == NULL) - return -1; - - mdp = (struct mdp_super_block *) buf; - - if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) - return -1; - - memcpy(uuid, &mdp->set_uuid0, 4); - memcpy(&uuid[4], &mdp->set_uuid1, 12); - set_uuid(id, uuid, UUID_DCE); - - snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u.%u.%u", - le32_to_cpu(mdp->major_version), - le32_to_cpu(mdp->minor_version), - le32_to_cpu(mdp->patch_version)); - - dbg("found raid signature"); - id->usage_id = VOLUME_ID_RAID; - id->type = "linux_raid_member"; - - return 0; -} - -#define MSDOS_MAGIC "\x55\xaa" -#define MSDOS_PARTTABLE_OFFSET 0x1be -#define MSDOS_SIG_OFF 0x1fe -#define BSIZE 0x200 -#define DOS_EXTENDED_PARTITION 0x05 -#define LINUX_EXTENDED_PARTITION 0x85 -#define WIN98_EXTENDED_PARTITION 0x0f -#define LINUX_RAID_PARTITION 0xfd -#define is_extended(type) \ - (type == DOS_EXTENDED_PARTITION || \ - type == WIN98_EXTENDED_PARTITION || \ - type == LINUX_EXTENDED_PARTITION) -#define is_raid(type) \ - (type == LINUX_RAID_PARTITION) -static int probe_msdos_part_table(struct volume_id *id, __u64 off) -{ - struct msdos_partition_entry { - __u8 boot_ind; - __u8 head; - __u8 sector; - __u8 cyl; - __u8 sys_ind; - __u8 end_head; - __u8 end_sector; - __u8 end_cyl; - __u32 start_sect; - __u32 nr_sects; - } __attribute__((packed)) *part; - - const __u8 *buf; - int i; - __u64 poff; - __u64 plen; - __u64 extended = 0; - __u64 current; - __u64 next; - int limit; - int empty = 1; - struct volume_id_partition *p; - - buf = get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - if (strncmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) - return -1; - - /* check flags on all entries for a valid partition table */ - part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; - for (i = 0; i < 4; i++) { - if (part[i].boot_ind != 0 && - part[i].boot_ind != 0x80) - return -1; - - if (le32_to_cpu(part[i].nr_sects) != 0) - empty = 0; - } - if (empty == 1) - return -1; - - if (id->partitions != NULL) - free(id->partitions); - id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX * - sizeof(struct volume_id_partition)); - if (id->partitions == NULL) - return -1; - memset(id->partitions, 0x00, - VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); - - for (i = 0; i < 4; i++) { - poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; - - if (plen == 0) - continue; - - p = &id->partitions[i]; - - p->partition_type_raw = part[i].sys_ind; - - if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", poff); - p->usage_id = VOLUME_ID_PARTITIONTABLE; - p->type_id = VOLUME_ID_MSDOSEXTENDED; - p->type = "msdos_extended_partition"; - if (extended == 0) - extended = off + poff; - } else { - dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, poff, plen); - - if (is_raid(part[i].sys_ind)) - p->usage_id = VOLUME_ID_RAID; - else - p->usage_id = VOLUME_ID_UNPROBED; - } - - p->off = off + poff; - p->len = plen; - id->partition_count = i+1; - } - - next = extended; - current = extended; - limit = 50; - - /* follow extended partition chain and add data partitions */ - while (next != 0) { - if (limit-- == 0) { - dbg("extended chain limit reached"); - break; - } - - buf = get_buffer(id, current, 0x200); - if (buf == NULL) - break; - - part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; - - if (strncmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) - break; - - next = 0; - - for (i = 0; i < 4; i++) { - poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; - - if (plen == 0) - continue; - - if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", poff); - if (next == 0) - next = extended + poff; - } else { - dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, poff, plen); - - /* we always start at the 5th entry */ - while (id->partition_count < 4) - id->partitions[id->partition_count++].usage_id = - VOLUME_ID_UNUSED; - - p = &id->partitions[id->partition_count]; - - if (is_raid(part[i].sys_ind)) - p->usage_id = VOLUME_ID_RAID; - else - p->usage_id = VOLUME_ID_UNPROBED; - - p->off = current + poff; - p->len = plen; - id->partition_count++; - - p->partition_type_raw = part[i].sys_ind; - - if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { - dbg("too many partitions"); - next = 0; - } - } - } - - current = next; - } - - id->usage_id = VOLUME_ID_PARTITIONTABLE; - id->type_id = VOLUME_ID_MSDOSPARTTABLE; - id->type = "msdos_partition_table"; - - return 0; -} - -#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 -#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 -#define EXT_SUPERBLOCK_OFFSET 0x400 -static int probe_ext(struct volume_id *id, __u64 off) -{ - struct ext2_super_block { - __u32 inodes_count; - __u32 blocks_count; - __u32 r_blocks_count; - __u32 free_blocks_count; - __u32 free_inodes_count; - __u32 first_data_block; - __u32 log_block_size; - __u32 dummy3[7]; - __u8 magic[2]; - __u16 state; - __u32 dummy5[8]; - __u32 feature_compat; - __u32 feature_incompat; - __u32 feature_ro_compat; - __u8 uuid[16]; - __u8 volume_name[16]; - } __attribute__((__packed__)) *es; - - es = (struct ext2_super_block *) - get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); - if (es == NULL) - return -1; - - if (es->magic[0] != 0123 || - es->magic[1] != 0357) - return -1; - - set_label_raw(id, es->volume_name, 16); - set_label_string(id, es->volume_name, 16); - set_uuid(id, es->uuid, UUID_DCE); - - if ((le32_to_cpu(es->feature_compat) & - EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) { - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_EXT3; - id->type = "ext3"; - } else { - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_EXT2; - id->type = "ext2"; - } - - return 0; -} - -#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 -#define REISERFS_SUPERBLOCK_OFFSET 0x10000 -static int probe_reiserfs(struct volume_id *id, __u64 off) -{ - struct reiserfs_super_block { - __u32 blocks_count; - __u32 free_blocks; - __u32 root_block; - __u32 journal_block; - __u32 journal_dev; - __u32 orig_journal_size; - __u32 dummy2[5]; - __u16 blocksize; - __u16 dummy3[3]; - __u8 magic[12]; - __u32 dummy4[5]; - __u8 uuid[16]; - __u8 label[16]; - } __attribute__((__packed__)) *rs; - - rs = (struct reiserfs_super_block *) - get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); - if (rs == NULL) - return -1; - - if (strncmp(rs->magic, "ReIsEr2Fs", 9) == 0) { - strcpy(id->type_version, "3.6"); - goto found; - } - - if (strncmp(rs->magic, "ReIsEr3Fs", 9) == 0) { - strcpy(id->type_version, "JR"); - goto found; - } - - rs = (struct reiserfs_super_block *) - get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); - if (rs == NULL) - return -1; - - if (strncmp(rs->magic, "ReIsErFs", 8) == 0) { - strcpy(id->type_version, "3.5"); - goto found; - } - - return -1; - -found: - set_label_raw(id, rs->label, 16); - set_label_string(id, rs->label, 16); - set_uuid(id, rs->uuid, UUID_DCE); - - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_REISERFS; - id->type = "reiserfs"; - - return 0; -} - -static int probe_xfs(struct volume_id *id, __u64 off) -{ - struct xfs_super_block { - __u8 magic[4]; - __u32 blocksize; - __u64 dblocks; - __u64 rblocks; - __u32 dummy1[2]; - __u8 uuid[16]; - __u32 dummy2[15]; - __u8 fname[12]; - __u32 dummy3[2]; - __u64 icount; - __u64 ifree; - __u64 fdblocks; - } __attribute__((__packed__)) *xs; - - xs = (struct xfs_super_block *) get_buffer(id, off, 0x200); - if (xs == NULL) - return -1; - - if (strncmp(xs->magic, "XFSB", 4) != 0) - return -1; - - set_label_raw(id, xs->fname, 12); - set_label_string(id, xs->fname, 12); - set_uuid(id, xs->uuid, UUID_DCE); - - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_XFS; - id->type = "xfs"; - - return 0; -} - -#define JFS_SUPERBLOCK_OFFSET 0x8000 -static int probe_jfs(struct volume_id *id, __u64 off) -{ - struct jfs_super_block { - __u8 magic[4]; - __u32 version; - __u64 size; - __u32 bsize; - __u32 dummy1; - __u32 pbsize; - __u32 dummy2[27]; - __u8 uuid[16]; - __u8 label[16]; - __u8 loguuid[16]; - } __attribute__((__packed__)) *js; - - js = (struct jfs_super_block *) - get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); - if (js == NULL) - return -1; - - if (strncmp(js->magic, "JFS1", 4) != 0) - return -1; - - set_label_raw(id, js->label, 16); - set_label_string(id, js->label, 16); - set_uuid(id, js->uuid, UUID_DCE); - - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_JFS; - id->type = "jfs"; - - return 0; -} - -#define FAT12_MAX 0xff5 -#define FAT16_MAX 0xfff5 -#define FAT_ATTR_VOLUME_ID 0x08 -#define FAT_ATTR_DIR 0x10 -#define FAT_ATTR_LONG_NAME 0x0f -#define FAT_ATTR_MASK 0x3f -#define FAT_ENTRY_FREE 0xe5 -static int probe_vfat(struct volume_id *id, __u64 off) -{ - struct vfat_super_block { - __u8 boot_jump[3]; - __u8 sysid[8]; - __u16 sector_size; - __u8 sectors_per_cluster; - __u16 reserved; - __u8 fats; - __u16 dir_entries; - __u16 sectors; - __u8 media; - __u16 fat_length; - __u16 secs_track; - __u16 heads; - __u32 hidden; - __u32 total_sect; - union { - struct fat_super_block { - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[192]; - __u8 pmagic[2]; - } __attribute__((__packed__)) fat; - struct fat32_super_block { - __u32 fat32_length; - __u16 flags; - __u8 version[2]; - __u32 root_cluster; - __u16 insfo_sector; - __u16 backup_boot; - __u16 reserved2[6]; - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[164]; - __u8 pmagic[2]; - } __attribute__((__packed__)) fat32; - } __attribute__((__packed__)) type; - } __attribute__((__packed__)) *vs; - - struct vfat_dir_entry { - __u8 name[11]; - __u8 attr; - __u16 time_creat; - __u16 date_creat; - __u16 time_acc; - __u16 date_acc; - __u16 cluster_high; - __u16 time_write; - __u16 date_write; - __u16 cluster_low; - __u32 size; - } __attribute__((__packed__)) *dir; - - __u16 sector_size; - __u16 dir_entries; - __u32 sect_count; - __u16 reserved; - __u32 fat_size; - __u32 root_cluster; - __u32 dir_size; - __u32 cluster_count; - __u32 fat_length; - __u64 root_start; - __u32 start_data_sect; - __u16 root_dir_entries; - __u8 *buf; - __u32 buf_size; - __u8 *label = NULL; - __u32 next; - int maxloop; - int i; - - vs = (struct vfat_super_block *) get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - /* believe only that's fat, don't trust the version - * the cluster_count will tell us - */ - if (strncmp(vs->sysid, "NTFS", 4) == 0) - return -1; - - if (strncmp(vs->type.fat32.magic, "MSWIN", 5) == 0) - goto valid; - - if (strncmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) - goto valid; - - if (strncmp(vs->type.fat.magic, "FAT16 ", 8) == 0) - goto valid; - - if (strncmp(vs->type.fat.magic, "MSDOS", 5) == 0) - goto valid; - - if (strncmp(vs->type.fat.magic, "FAT12 ", 8) == 0) - goto valid; - - /* - * There are old floppies out there without a magic, so we check - * for well known values and guess if it's a fat volume - */ - - /* boot jump address check */ - if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && - vs->boot_jump[0] != 0xe9) - return -1; - - /* heads check */ - if (vs->heads == 0) - return -1; - - /* cluster size check*/ - if (vs->sectors_per_cluster == 0 || - (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) - return -1; - - /* media check */ - if (vs->media < 0xf8 && vs->media != 0xf0) - return -1; - - /* fat count*/ - if (vs->fats != 2) - return -1; - -valid: - /* sector size check */ - sector_size = le16_to_cpu(vs->sector_size); - if (sector_size != 0x200 && sector_size != 0x400 && - sector_size != 0x800 && sector_size != 0x1000) - return -1; - - dbg("sector_size 0x%x", sector_size); - dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); - - dir_entries = le16_to_cpu(vs->dir_entries); - reserved = le16_to_cpu(vs->reserved); - dbg("reserved 0x%x", reserved); - - sect_count = le16_to_cpu(vs->sectors); - if (sect_count == 0) - sect_count = le32_to_cpu(vs->total_sect); - dbg("sect_count 0x%x", sect_count); - - fat_length = le16_to_cpu(vs->fat_length); - if (fat_length == 0) - fat_length = le32_to_cpu(vs->type.fat32.fat32_length); - dbg("fat_length 0x%x", fat_length); - - fat_size = fat_length * vs->fats; - dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + - (sector_size-1)) / sector_size; - dbg("dir_size 0x%x", dir_size); - - cluster_count = sect_count - (reserved + fat_size + dir_size); - cluster_count /= vs->sectors_per_cluster; - dbg("cluster_count 0x%x", cluster_count); - - if (cluster_count < FAT12_MAX) { - strcpy(id->type_version, "FAT12"); - } else if (cluster_count < FAT16_MAX) { - strcpy(id->type_version, "FAT16"); - } else { - strcpy(id->type_version, "FAT32"); - goto fat32; - } - - /* the label may be an attribute in the root directory */ - root_start = (reserved + fat_size) * sector_size; - dbg("root dir start 0x%llx", root_start); - root_dir_entries = le16_to_cpu(vs->dir_entries); - dbg("expected entries 0x%x", root_dir_entries); - - buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); - buf = get_buffer(id, off + root_start, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - - for (i = 0; i < root_dir_entries; i++) { - /* end marker */ - if (dir[i].name[0] == 0x00) { - dbg("end of dir"); - break; - } - - /* empty entry */ - if (dir[i].name[0] == FAT_ENTRY_FREE) - continue; - - /* long name */ - if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) - continue; - - if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { - /* labels do not have file data */ - if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) - continue; - - dbg("found ATTR_VOLUME_ID id in root dir"); - label = dir[i].name; - break; - } - - dbg("skip dir entry"); - } - - vs = (struct vfat_super_block *) get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { - set_label_raw(id, label, 11); - set_label_string(id, label, 11); - } else if (strncmp(vs->type.fat.label, "NO NAME ", 11) != 0) { - set_label_raw(id, vs->type.fat.label, 11); - set_label_string(id, vs->type.fat.label, 11); - } - set_uuid(id, vs->type.fat.serno, UUID_DOS); - goto found; - -fat32: - /* FAT32 root dir is a cluster chain like any other directory */ - buf_size = vs->sectors_per_cluster * sector_size; - root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); - dbg("root dir cluster %u", root_cluster); - start_data_sect = reserved + fat_size; - - next = root_cluster; - maxloop = 100; - while (--maxloop) { - __u32 next_sect_off; - __u64 next_off; - __u64 fat_entry_off; - int count; - - dbg("next cluster %u", next); - next_sect_off = (next - 2) * vs->sectors_per_cluster; - next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%llx", next_off); - - /* get cluster */ - buf = get_buffer(id, off + next_off, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - count = buf_size / sizeof(struct vfat_dir_entry); - dbg("expected entries 0x%x", count); - - for (i = 0; i < count; i++) { - /* end marker */ - if (dir[i].name[0] == 0x00) { - dbg("end of dir"); - goto fat32_label; - } - - /* empty entry */ - if (dir[i].name[0] == FAT_ENTRY_FREE) - continue; - - /* long name */ - if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) - continue; - - if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { - /* labels do not have file data */ - if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) - continue; - - dbg("found ATTR_VOLUME_ID id in root dir"); - label = dir[i].name; - goto fat32_label; - } - - dbg("skip dir entry"); - } - - /* get FAT entry */ - fat_entry_off = (reserved * sector_size) + (next * sizeof(__u32)); - buf = get_buffer(id, off + fat_entry_off, buf_size); - if (buf == NULL) - goto found; - - /* set next cluster */ - next = le32_to_cpu(*((__u32 *) buf) & 0x0fffffff); - if (next == 0) - break; - } - if (maxloop == 0) - dbg("reached maximum follow count of root cluster chain, give up"); - -fat32_label: - vs = (struct vfat_super_block *) get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { - set_label_raw(id, label, 11); - set_label_string(id, label, 11); - } else if (strncmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { - set_label_raw(id, vs->type.fat32.label, 11); - set_label_string(id, vs->type.fat32.label, 11); - } - set_uuid(id, vs->type.fat32.serno, UUID_DOS); - -found: - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_VFAT; - id->type = "vfat"; - - return 0; -} - -#define UDF_VSD_OFFSET 0x8000 -static int probe_udf(struct volume_id *id, __u64 off) -{ - struct volume_descriptor { - struct descriptor_tag { - __u16 id; - __u16 version; - __u8 checksum; - __u8 reserved; - __u16 serial; - __u16 crc; - __u16 crc_len; - __u32 location; - } __attribute__((__packed__)) tag; - union { - struct anchor_descriptor { - __u32 length; - __u32 location; - } __attribute__((__packed__)) anchor; - struct primary_descriptor { - __u32 seq_num; - __u32 desc_num; - struct dstring { - __u8 clen; - __u8 c[31]; - } __attribute__((__packed__)) ident; - } __attribute__((__packed__)) primary; - } __attribute__((__packed__)) type; - } __attribute__((__packed__)) *vd; - - struct volume_structure_descriptor { - __u8 type; - __u8 id[5]; - __u8 version; - } *vsd; - - unsigned int bs; - unsigned int b; - unsigned int type; - unsigned int count; - unsigned int loc; - unsigned int clen; - - vsd = (struct volume_structure_descriptor *) - get_buffer(id, off + UDF_VSD_OFFSET, 0x200); - if (vsd == NULL) - return -1; - - if (strncmp(vsd->id, "NSR02", 5) == 0) - goto blocksize; - if (strncmp(vsd->id, "NSR03", 5) == 0) - goto blocksize; - if (strncmp(vsd->id, "BEA01", 5) == 0) - goto blocksize; - if (strncmp(vsd->id, "BOOT2", 5) == 0) - goto blocksize; - if (strncmp(vsd->id, "CD001", 5) == 0) - goto blocksize; - if (strncmp(vsd->id, "CDW02", 5) == 0) - goto blocksize; - if (strncmp(vsd->id, "TEA03", 5) == 0) - goto blocksize; - return -1; - -blocksize: - /* search the next VSD to get the logical block size of the volume */ - for (bs = 0x800; bs < 0x8000; bs += 0x800) { - vsd = (struct volume_structure_descriptor *) - get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); - if (vsd == NULL) - return -1; - dbg("test for blocksize: 0x%x", bs); - if (vsd->id[0] != '\0') - goto nsr; - } - return -1; - -nsr: - /* search the list of VSDs for a NSR descriptor */ - for (b = 0; b < 64; b++) { - vsd = (struct volume_structure_descriptor *) - get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); - if (vsd == NULL) - return -1; - - dbg("vsd: %c%c%c%c%c", - vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); - - if (vsd->id[0] == '\0') - return -1; - if (strncmp(vsd->id, "NSR02", 5) == 0) - goto anchor; - if (strncmp(vsd->id, "NSR03", 5) == 0) - goto anchor; - } - return -1; - -anchor: - /* read anchor volume descriptor */ - vd = (struct volume_descriptor *) - get_buffer(id, off + (256 * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - if (type != 2) /* TAG_ID_AVDP */ - goto found; - - /* get desriptor list address and block count */ - count = le32_to_cpu(vd->type.anchor.length) / bs; - loc = le32_to_cpu(vd->type.anchor.location); - dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); - - /* pick the primary descriptor from the list */ - for (b = 0; b < count; b++) { - vd = (struct volume_descriptor *) - get_buffer(id, off + ((loc + b) * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - dbg("descriptor type %i", type); - - /* check validity */ - if (type == 0) - goto found; - if (le32_to_cpu(vd->tag.location) != loc + b) - goto found; - - if (type == 1) /* TAG_ID_PVD */ - goto pvd; - } - goto found; - -pvd: - set_label_raw(id, &(vd->type.primary.ident.clen), 32); - - clen = vd->type.primary.ident.clen; - dbg("label string charsize=%i bit", clen); - if (clen == 8) - set_label_string(id, vd->type.primary.ident.c, 31); - else if (clen == 16) - set_label_unicode16(id, vd->type.primary.ident.c, BE,31); - -found: - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_UDF; - id->type = "udf"; - - return 0; -} - -#define ISO_SUPERBLOCK_OFFSET 0x8000 -#define ISO_SECTOR_SIZE 0x800 -#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) -#define ISO_VD_PRIMARY 0x1 -#define ISO_VD_SUPPLEMENTARY 0x2 -#define ISO_VD_END 0xff -#define ISO_VD_MAX 16 -static int probe_iso9660(struct volume_id *id, __u64 off) -{ - union iso_super_block { - struct iso_header { - __u8 type; - __u8 id[5]; - __u8 version; - __u8 unused1; - __u8 system_id[32]; - __u8 volume_id[32]; - } __attribute__((__packed__)) iso; - struct hs_header { - __u8 foo[8]; - __u8 type; - __u8 id[4]; - __u8 version; - } __attribute__((__packed__)) hs; - } __attribute__((__packed__)) *is; - - is = (union iso_super_block *) - get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); - if (is == NULL) - return -1; - - if (strncmp(is->iso.id, "CD001", 5) == 0) { - char root_label[VOLUME_ID_LABEL_SIZE+1]; - int vd_offset; - int i; - int found_svd; - - memset(root_label, 0, sizeof(root_label)); - strncpy(root_label, is->iso.volume_id, sizeof(root_label)-1); - - found_svd = 0; - vd_offset = ISO_VD_OFFSET; - for (i = 0; i < ISO_VD_MAX; i++) { - is = (union iso_super_block *) - get_buffer (id, off + vd_offset, 0x200); - if (is == NULL || is->iso.type == ISO_VD_END) - break; - if (is->iso.type == ISO_VD_SUPPLEMENTARY) { - dbg("found ISO supplementary VD at offset 0x%llx", off + vd_offset); - set_label_raw(id, is->iso.volume_id, 32); - set_label_unicode16(id, is->iso.volume_id, BE, 32); - found_svd = 1; - break; - } - vd_offset += ISO_SECTOR_SIZE; - } - - if (!found_svd || - (found_svd && !strncmp(root_label, id->label, 16))) - { - set_label_raw(id, root_label, 32); - set_label_string(id, root_label, 32); - } - goto found; - } - if (strncmp(is->hs.id, "CDROM", 5) == 0) - goto found; - return -1; - -found: - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_ISO9660; - id->type = "iso9660"; - - return 0; -} - -#define UFS_MAGIC 0x00011954 -#define UFS2_MAGIC 0x19540119 -#define UFS_MAGIC_FEA 0x00195612 -#define UFS_MAGIC_LFN 0x00095014 - - -static int probe_ufs(struct volume_id *id, __u64 off) -{ - struct ufs_super_block { - __u32 fs_link; - __u32 fs_rlink; - __u32 fs_sblkno; - __u32 fs_cblkno; - __u32 fs_iblkno; - __u32 fs_dblkno; - __u32 fs_cgoffset; - __u32 fs_cgmask; - __u32 fs_time; - __u32 fs_size; - __u32 fs_dsize; - __u32 fs_ncg; - __u32 fs_bsize; - __u32 fs_fsize; - __u32 fs_frag; - __u32 fs_minfree; - __u32 fs_rotdelay; - __u32 fs_rps; - __u32 fs_bmask; - __u32 fs_fmask; - __u32 fs_bshift; - __u32 fs_fshift; - __u32 fs_maxcontig; - __u32 fs_maxbpg; - __u32 fs_fragshift; - __u32 fs_fsbtodb; - __u32 fs_sbsize; - __u32 fs_csmask; - __u32 fs_csshift; - __u32 fs_nindir; - __u32 fs_inopb; - __u32 fs_nspf; - __u32 fs_optim; - __u32 fs_npsect_state; - __u32 fs_interleave; - __u32 fs_trackskew; - __u32 fs_id[2]; - __u32 fs_csaddr; - __u32 fs_cssize; - __u32 fs_cgsize; - __u32 fs_ntrak; - __u32 fs_nsect; - __u32 fs_spc; - __u32 fs_ncyl; - __u32 fs_cpg; - __u32 fs_ipg; - __u32 fs_fpg; - struct ufs_csum { - __u32 cs_ndir; - __u32 cs_nbfree; - __u32 cs_nifree; - __u32 cs_nffree; - } __attribute__((__packed__)) fs_cstotal; - __s8 fs_fmod; - __s8 fs_clean; - __s8 fs_ronly; - __s8 fs_flags; - union { - struct { - __s8 fs_fsmnt[512]; - __u32 fs_cgrotor; - __u32 fs_csp[31]; - __u32 fs_maxcluster; - __u32 fs_cpc; - __u16 fs_opostbl[16][8]; - } __attribute__((__packed__)) fs_u1; - struct { - __s8 fs_fsmnt[468]; - __u8 fs_volname[32]; - __u64 fs_swuid; - __s32 fs_pad; - __u32 fs_cgrotor; - __u32 fs_ocsp[28]; - __u32 fs_contigdirs; - __u32 fs_csp; - __u32 fs_maxcluster; - __u32 fs_active; - __s32 fs_old_cpc; - __s32 fs_maxbsize; - __s64 fs_sparecon64[17]; - __s64 fs_sblockloc; - struct ufs2_csum_total { - __u64 cs_ndir; - __u64 cs_nbfree; - __u64 cs_nifree; - __u64 cs_nffree; - __u64 cs_numclusters; - __u64 cs_spare[3]; - } __attribute__((__packed__)) fs_cstotal; - struct ufs_timeval { - __s32 tv_sec; - __s32 tv_usec; - } __attribute__((__packed__)) fs_time; - __s64 fs_size; - __s64 fs_dsize; - __u64 fs_csaddr; - __s64 fs_pendingblocks; - __s32 fs_pendinginodes; - } __attribute__((__packed__)) fs_u2; - } fs_u11; - union { - struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __s32 fs_state; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - } __attribute__((__packed__)) fs_sun; - struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __u32 fs_npsect; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - } __attribute__((__packed__)) fs_sunx86; - struct { - __s32 fs_sparecon[50]; - __s32 fs_contigsumsize; - __s32 fs_maxsymlinklen; - __s32 fs_inodefmt; - __u32 fs_maxfilesize[2]; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - __s32 fs_state; - } __attribute__((__packed__)) fs_44; - } fs_u2; - __s32 fs_postblformat; - __s32 fs_nrpos; - __s32 fs_postbloff; - __s32 fs_rotbloff; - __u32 fs_magic; - __u8 fs_space[1]; - } __attribute__((__packed__)) *ufs; - - __u32 magic; - int i; - int offsets[] = {0, 8, 64, 256, -1}; - - for (i = 0; offsets[i] >= 0; i++) { - ufs = (struct ufs_super_block *) - get_buffer(id, off + (offsets[i] * 0x400), 0x800); - if (ufs == NULL) - return -1; - - dbg("offset 0x%x", offsets[i] * 0x400); - magic = be32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(be)", magic); - goto found; - } - magic = le32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(le)", magic); - goto found; - } - } - return -1; - -found: - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_UFS; - id->type = "ufs"; - - return 0; -} - -static int probe_mac_partition_map(struct volume_id *id, __u64 off) -{ - struct mac_driver_desc { - __u8 signature[2]; - __u16 block_size; - __u32 block_count; - } __attribute__((__packed__)) *driver; - - struct mac_partition { - __u8 signature[2]; - __u16 res1; - __u32 map_count; - __u32 start_block; - __u32 block_count; - __u8 name[32]; - __u8 type[32]; - } __attribute__((__packed__)) *part; - - const __u8 *buf; - - buf = get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if ((strncmp(part->signature, "PM", 2) == 0) && - (strncmp(part->type, "Apple_partition_map", 19) == 0)) { - /* linux creates an own subdevice for the map - * just return the type if the drive header is missing */ - id->usage_id = VOLUME_ID_PARTITIONTABLE; - id->type_id = VOLUME_ID_MACPARTMAP; - id->type = "mac_partition_map"; - return 0; - } - - driver = (struct mac_driver_desc *) buf; - if (strncmp(driver->signature, "ER", 2) == 0) { - /* we are on a main device, like a CD - * just try to probe the first partition from the map */ - unsigned int bsize = be16_to_cpu(driver->block_size); - int part_count; - int i; - - /* get first entry of partition table */ - buf = get_buffer(id, off + bsize, 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if (strncmp(part->signature, "PM", 2) != 0) - return -1; - - part_count = be32_to_cpu(part->map_count); - dbg("expecting %d partition entries", part_count); - - if (id->partitions != NULL) - free(id->partitions); - id->partitions = - malloc(part_count * sizeof(struct volume_id_partition)); - if (id->partitions == NULL) - return -1; - memset(id->partitions, 0x00, sizeof(struct volume_id_partition)); - - id->partition_count = part_count; - - for (i = 0; i < part_count; i++) { - __u64 poff; - __u64 plen; - - buf = get_buffer(id, off + ((i+1) * bsize), 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if (strncmp(part->signature, "PM", 2) != 0) - return -1; - - poff = be32_to_cpu(part->start_block) * bsize; - plen = be32_to_cpu(part->block_count) * bsize; - dbg("found '%s' partition entry at 0x%llx, len 0x%llx", - part->type, poff, plen); - - id->partitions[i].off = poff; - id->partitions[i].len = plen; - - if (strncmp(part->type, "Apple_Free", 10) == 0) { - id->partitions[i].usage_id = VOLUME_ID_UNUSED; - } else if (strncmp(part->type, "Apple_partition_map", 19) == 0) { - id->partitions[i].usage_id = VOLUME_ID_PARTITIONTABLE; - id->partitions[i].type_id = VOLUME_ID_MACPARTMAP; - } else { - id->partitions[i].usage_id = VOLUME_ID_UNPROBED; - } - } - id->usage_id = VOLUME_ID_PARTITIONTABLE; - id->type_id = VOLUME_ID_MACPARTMAP; - id->type = "mac_partition_map"; - return 0; - } - - return -1; -} - -#define HFS_SUPERBLOCK_OFFSET 0x400 -#define HFS_NODE_LEAF 0xff -#define HFSPLUS_POR_CNID 1 -#define HFSPLUS_EXTENT_COUNT 8 -static int probe_hfs_hfsplus(struct volume_id *id, __u64 off) -{ - struct hfs_finder_info{ - __u32 boot_folder; - __u32 start_app; - __u32 open_folder; - __u32 os9_folder; - __u32 reserved; - __u32 osx_folder; - __u8 id[8]; - } __attribute__((__packed__)); - - struct hfs_mdb { - __u8 signature[2]; - __u32 cr_date; - __u32 ls_Mod; - __u16 atrb; - __u16 nm_fls; - __u16 vbm_st; - __u16 alloc_ptr; - __u16 nm_al_blks; - __u32 al_blk_size; - __u32 clp_size; - __u16 al_bl_st; - __u32 nxt_cnid; - __u16 free_bks; - __u8 label_len; - __u8 label[27]; - __u32 vol_bkup; - __u16 vol_seq_num; - __u32 wr_cnt; - __u32 xt_clump_size; - __u32 ct_clump_size; - __u16 num_root_dirs; - __u32 file_count; - __u32 dir_count; - struct hfs_finder_info finder_info; - __u8 embed_sig[2]; - __u16 embed_startblock; - __u16 embed_blockcount; - } __attribute__((__packed__)) *hfs; - - struct hfsplus_bnode_descriptor { - __u32 next; - __u32 prev; - __u8 type; - __u8 height; - __u16 num_recs; - __u16 reserved; - } __attribute__((__packed__)); - - struct hfsplus_bheader_record { - __u16 depth; - __u32 root; - __u32 leaf_count; - __u32 leaf_head; - __u32 leaf_tail; - __u16 node_size; - } __attribute__((__packed__)); - - struct hfsplus_catalog_key { - __u16 key_len; - __u32 parent_id; - __u16 unicode_len; - __u8 unicode[255 * 2]; - } __attribute__((__packed__)); - - struct hfsplus_extent { - __u32 start_block; - __u32 block_count; - } __attribute__((__packed__)); - - struct hfsplus_fork { - __u64 total_size; - __u32 clump_size; - __u32 total_blocks; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; - } __attribute__((__packed__)); - - struct hfsplus_vol_header { - __u8 signature[2]; - __u16 version; - __u32 attributes; - __u32 last_mount_vers; - __u32 reserved; - __u32 create_date; - __u32 modify_date; - __u32 backup_date; - __u32 checked_date; - __u32 file_count; - __u32 folder_count; - __u32 blocksize; - __u32 total_blocks; - __u32 free_blocks; - __u32 next_alloc; - __u32 rsrc_clump_sz; - __u32 data_clump_sz; - __u32 next_cnid; - __u32 write_count; - __u64 encodings_bmp; - struct hfs_finder_info finder_info; - struct hfsplus_fork alloc_file; - struct hfsplus_fork ext_file; - struct hfsplus_fork cat_file; - struct hfsplus_fork attr_file; - struct hfsplus_fork start_file; - } __attribute__((__packed__)) *hfsplus; - - unsigned int blocksize; - unsigned int cat_block; - unsigned int ext_block_start; - unsigned int ext_block_count; - int ext; - unsigned int leaf_node_head; - unsigned int leaf_node_count; - unsigned int leaf_node_size; - unsigned int leaf_block; - __u64 leaf_off; - unsigned int alloc_block_size; - unsigned int alloc_first_block; - unsigned int embed_first_block; - unsigned int record_count; - struct hfsplus_bnode_descriptor *descr; - struct hfsplus_bheader_record *bnode; - struct hfsplus_catalog_key *key; - unsigned int label_len; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; - const __u8 *buf; - - buf = get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - hfs = (struct hfs_mdb *) buf; - if (strncmp(hfs->signature, "BD", 2) != 0) - goto checkplus; - - /* it may be just a hfs wrapper for hfs+ */ - if (strncmp(hfs->embed_sig, "H+", 2) == 0) { - alloc_block_size = be32_to_cpu(hfs->al_blk_size); - dbg("alloc_block_size 0x%x", alloc_block_size); - - alloc_first_block = be16_to_cpu(hfs->al_bl_st); - dbg("alloc_first_block 0x%x", alloc_first_block); - - embed_first_block = be16_to_cpu(hfs->embed_startblock); - dbg("embed_first_block 0x%x", embed_first_block); - - off += (alloc_first_block * 512) + - (embed_first_block * alloc_block_size); - dbg("hfs wrapped hfs+ found at offset 0x%llx", off); - - buf = get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - goto checkplus; - } - - if (hfs->label_len > 0 && hfs->label_len < 28) { - set_label_raw(id, hfs->label, hfs->label_len); - set_label_string(id, hfs->label, hfs->label_len) ; - } - - set_uuid(id, hfs->finder_info.id, UUID_HFS); - - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_HFS; - id->type = "hfs"; - - return 0; - -checkplus: - hfsplus = (struct hfsplus_vol_header *) buf; - if (strncmp(hfsplus->signature, "H+", 2) == 0) - goto hfsplus; - if (strncmp(hfsplus->signature, "HX", 2) == 0) - goto hfsplus; - return -1; - -hfsplus: - set_uuid(id, hfsplus->finder_info.id, UUID_HFS); - - blocksize = be32_to_cpu(hfsplus->blocksize); - dbg("blocksize %u", blocksize); - - memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); - cat_block = be32_to_cpu(extents[0].start_block); - dbg("catalog start block 0x%x", cat_block); - - buf = get_buffer(id, off + (cat_block * blocksize), 0x2000); - if (buf == NULL) - goto found; - - bnode = (struct hfsplus_bheader_record *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - leaf_node_head = be32_to_cpu(bnode->leaf_head); - dbg("catalog leaf node 0x%x", leaf_node_head); - - leaf_node_size = be16_to_cpu(bnode->node_size); - dbg("leaf node size 0x%x", leaf_node_size); - - leaf_node_count = be32_to_cpu(bnode->leaf_count); - dbg("leaf node count 0x%x", leaf_node_count); - if (leaf_node_count == 0) - goto found; - - leaf_block = (leaf_node_head * leaf_node_size) / blocksize; - - /* get physical location */ - for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { - ext_block_start = be32_to_cpu(extents[ext].start_block); - ext_block_count = be32_to_cpu(extents[ext].block_count); - dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); - - if (ext_block_count == 0) - goto found; - - /* this is our extent */ - if (leaf_block < ext_block_count) - break; - - leaf_block -= ext_block_count; - } - if (ext == HFSPLUS_EXTENT_COUNT) - goto found; - dbg("found block in extent %i", ext); - - leaf_off = (ext_block_start + leaf_block) * blocksize; - - buf = get_buffer(id, off + leaf_off, leaf_node_size); - if (buf == NULL) - goto found; - - descr = (struct hfsplus_bnode_descriptor *) buf; - dbg("descriptor type 0x%x", descr->type); - - record_count = be16_to_cpu(descr->num_recs); - dbg("number of records %u", record_count); - if (record_count == 0) - goto found; - - if (descr->type != HFS_NODE_LEAF) - goto found; - - key = (struct hfsplus_catalog_key *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); - if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) - goto found; - - label_len = be16_to_cpu(key->unicode_len) * 2; - dbg("label unicode16 len %i", label_len); - set_label_raw(id, key->unicode, label_len); - set_label_unicode16(id, key->unicode, BE, label_len); - -found: - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_HFSPLUS; - id->type = "hfsplus"; - - return 0; -} - -#define MFT_RECORD_VOLUME 3 -#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 -#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 -#define MFT_RECORD_ATTR_OBJECT_ID 0x40 -#define MFT_RECORD_ATTR_END 0xffffffffu -static int probe_ntfs(struct volume_id *id, __u64 off) -{ - struct ntfs_super_block { - __u8 jump[3]; - __u8 oem_id[8]; - __u16 bytes_per_sector; - __u8 sectors_per_cluster; - __u16 reserved_sectors; - __u8 fats; - __u16 root_entries; - __u16 sectors; - __u8 media_type; - __u16 sectors_per_fat; - __u16 sectors_per_track; - __u16 heads; - __u32 hidden_sectors; - __u32 large_sectors; - __u16 unused[2]; - __u64 number_of_sectors; - __u64 mft_cluster_location; - __u64 mft_mirror_cluster_location; - __s8 cluster_per_mft_record; - __u8 reserved1[3]; - __s8 cluster_per_index_record; - __u8 reserved2[3]; - __u8 volume_serial[8]; - __u16 checksum; - } __attribute__((__packed__)) *ns; - - struct master_file_table_record { - __u8 magic[4]; - __u16 usa_ofs; - __u16 usa_count; - __u64 lsn; - __u16 sequence_number; - __u16 link_count; - __u16 attrs_offset; - __u16 flags; - __u32 bytes_in_use; - __u32 bytes_allocated; - } __attribute__((__packed__)) *mftr; - - struct file_attribute { - __u32 type; - __u32 len; - __u8 non_resident; - __u8 name_len; - __u16 name_offset; - __u16 flags; - __u16 instance; - __u32 value_len; - __u16 value_offset; - } __attribute__((__packed__)) *attr; - - struct volume_info { - __u64 reserved; - __u8 major_ver; - __u8 minor_ver; - } __attribute__((__packed__)) *info; - - unsigned int sector_size; - unsigned int cluster_size; - __u64 mft_cluster; - __u64 mft_off; - unsigned int mft_record_size; - unsigned int attr_type; - unsigned int attr_off; - unsigned int attr_len; - unsigned int val_off; - unsigned int val_len; - const __u8 *buf; - const __u8 *val; - - ns = (struct ntfs_super_block *) get_buffer(id, off, 0x200); - if (ns == NULL) - return -1; - - if (strncmp(ns->oem_id, "NTFS", 4) != 0) - return -1; - - set_uuid(id, ns->volume_serial, UUID_NTFS); - - sector_size = le16_to_cpu(ns->bytes_per_sector); - cluster_size = ns->sectors_per_cluster * sector_size; - mft_cluster = le64_to_cpu(ns->mft_cluster_location); - mft_off = mft_cluster * cluster_size; - - if (ns->cluster_per_mft_record < 0) - /* size = -log2(mft_record_size); normally 1024 Bytes */ - mft_record_size = 1 << -ns->cluster_per_mft_record; - else - mft_record_size = ns->cluster_per_mft_record * cluster_size; - - dbg("sectorsize 0x%x", sector_size); - dbg("clustersize 0x%x", cluster_size); - dbg("mftcluster %lli", mft_cluster); - dbg("mftoffset 0x%llx", mft_off); - dbg("cluster per mft_record %i", ns->cluster_per_mft_record); - dbg("mft record size %i", mft_record_size); - - buf = get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), - mft_record_size); - if (buf == NULL) - goto found; - - mftr = (struct master_file_table_record*) buf; - - dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); - if (strncmp(mftr->magic, "FILE", 4) != 0) - goto found; - - attr_off = le16_to_cpu(mftr->attrs_offset); - dbg("file $Volume's attributes are at offset %i", attr_off); - - while (1) { - attr = (struct file_attribute*) &buf[attr_off]; - attr_type = le32_to_cpu(attr->type); - attr_len = le16_to_cpu(attr->len); - val_off = le16_to_cpu(attr->value_offset); - val_len = le32_to_cpu(attr->value_len); - attr_off += attr_len; - - if (attr_len == 0) - break; - - if (attr_off >= mft_record_size) - break; - - if (attr_type == MFT_RECORD_ATTR_END) - break; - - dbg("found attribute type 0x%x, len %i, at offset %i", - attr_type, attr_len, attr_off); - - if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { - dbg("found info, len %i", val_len); - info = (struct volume_info*) (((__u8 *) attr) + val_off); - snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, - "%u.%u", info->major_ver, info->minor_ver); - } - - if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { - dbg("found label, len %i", val_len); - if (val_len > VOLUME_ID_LABEL_SIZE) - val_len = VOLUME_ID_LABEL_SIZE; - - val = ((__u8 *) attr) + val_off; - set_label_raw(id, val, val_len); - set_label_unicode16(id, val, LE, val_len); - } - } - -found: - id->usage_id = VOLUME_ID_FILESYSTEM; - id->type_id = VOLUME_ID_NTFS; - id->type = "ntfs"; - - return 0; -} - -#define LARGEST_PAGESIZE 0x4000 -static int probe_swap(struct volume_id *id, __u64 off) -{ - struct swap_header_v1_2 { - __u8 bootbits[1024]; - __u32 version; - __u32 last_page; - __u32 nr_badpages; - __u8 uuid[16]; - __u8 volume_name[16]; - } __attribute__((__packed__)) *sw; - - const __u8 *buf; - unsigned int page; - - /* the swap signature is at the end of the PAGE_SIZE */ - for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { - buf = get_buffer(id, off + page-10, 10); - if (buf == NULL) - return -1; - - if (strncmp(buf, "SWAP-SPACE", 10) == 0) { - strcpy(id->type_version, "1"); - goto found; - } - - if (strncmp(buf, "SWAPSPACE2", 10) == 0) { - sw = (struct swap_header_v1_2 *) get_buffer(id, off, sizeof(struct swap_header_v1_2)); - if (sw == NULL) - return -1; - strcpy(id->type_version, "2"); - set_label_raw(id, sw->volume_name, 16); - set_label_string(id, sw->volume_name, 16); - set_uuid(id, sw->uuid, UUID_DCE); - goto found; - } - } - return -1; - -found: - id->usage_id = VOLUME_ID_OTHER; - id->type_id = VOLUME_ID_SWAP; - id->type = "swap"; - - return 0; -} - -/* probe volume for filesystem type and try to read label+uuid */ -int volume_id_probe(struct volume_id *id, - enum volume_id_type type, - unsigned long long off, - unsigned long long size) -{ - int rc; - - dbg("called with size=0x%llx", size); - - if (id == NULL) - return -EINVAL; - - switch (type) { - case VOLUME_ID_MSDOSPARTTABLE: - rc = probe_msdos_part_table(id, off); - break; - case VOLUME_ID_EXT3: - case VOLUME_ID_EXT2: - rc = probe_ext(id, off); - break; - case VOLUME_ID_REISERFS: - rc = probe_reiserfs(id, off); - break; - case VOLUME_ID_XFS: - rc = probe_xfs(id, off); - break; - case VOLUME_ID_JFS: - rc = probe_jfs(id, off); - break; - case VOLUME_ID_VFAT: - rc = probe_vfat(id, off); - break; - case VOLUME_ID_UDF: - rc = probe_udf(id, off); - break; - case VOLUME_ID_ISO9660: - rc = probe_iso9660(id, off); - break; - case VOLUME_ID_MACPARTMAP: - rc = probe_mac_partition_map(id, off); - break; - case VOLUME_ID_HFS: - case VOLUME_ID_HFSPLUS: - rc = probe_hfs_hfsplus(id, off); - break; - case VOLUME_ID_UFS: - rc = probe_ufs(id, off); - break; - case VOLUME_ID_NTFS: - rc = probe_ntfs(id, off); - break; - case VOLUME_ID_SWAP: - rc = probe_swap(id, off); - break; - case VOLUME_ID_LINUX_RAID: - rc = probe_linux_raid(id, off, size); - break; - case VOLUME_ID_LVM1: - rc = probe_lvm1(id, off); - break; - case VOLUME_ID_LVM2: - rc = probe_lvm2(id, off); - break; - case VOLUME_ID_HPTRAID: - rc = probe_highpoint_ataraid(id, off); - break; - case VOLUME_ID_ALL: - default: - /* probe for raid first, cause fs probes may be successful on raid members */ - rc = probe_linux_raid(id, off, size); - if (rc == 0) - break; - rc = probe_lvm1(id, off); - if (rc == 0) - break; - rc = probe_lvm2(id, off); - if (rc == 0) - break; - rc = probe_highpoint_ataraid(id, off); - if (rc == 0) - break; - - /* signature in the first block, only small buffer needed */ - rc = probe_vfat(id, off); - if (rc == 0) - break; - rc = probe_mac_partition_map(id, off); - if (rc == 0) - break; - rc = probe_xfs(id, off); - if (rc == 0) - break; - - /* fill buffer with maximum */ - get_buffer(id, 0, SB_BUFFER_SIZE); - - rc = probe_swap(id, off); - if (rc == 0) - break; - rc = probe_ext(id, off); - if (rc == 0) - break; - rc = probe_reiserfs(id, off); - if (rc == 0) - break; - rc = probe_jfs(id, off); - if (rc == 0) - break; - rc = probe_udf(id, off); - if (rc == 0) - break; - rc = probe_iso9660(id, off); - if (rc == 0) - break; - rc = probe_hfs_hfsplus(id, off); - if (rc == 0) - break; - rc = probe_ufs(id, off); - if (rc == 0) - break; - rc = probe_ntfs(id, off); - if (rc == 0) - break; - - rc = -1; - } - - /* If the filestystem in recognized, we free the allocated buffers, - otherwise they will stay in place for the possible next probe call */ - if (rc == 0) - free_buffer(id); - - return rc; -} - -/* open volume by already open file descriptor */ -struct volume_id *volume_id_open_fd(int fd) -{ - struct volume_id *id; - - id = malloc(sizeof(struct volume_id)); - if (id == NULL) - return NULL; - memset(id, 0x00, sizeof(struct volume_id)); - - id->fd = fd; - - return id; -} - -/* open volume by device node */ -struct volume_id *volume_id_open_node(const char *path) -{ - struct volume_id *id; - int fd; - - fd = open(path, O_RDONLY); - if (fd < 0) { - dbg("unable to open '%s'", path); - return NULL; - } - - id = volume_id_open_fd(fd); - if (id == NULL) - return NULL; - - /* close fd on device close */ - id->fd_close = 1; - - return id; -} - -/* open volume by major/minor */ -struct volume_id *volume_id_open_dev_t(dev_t devt) -{ - struct volume_id *id; - __u8 tmp_node[VOLUME_ID_PATH_MAX]; - - snprintf(tmp_node, VOLUME_ID_PATH_MAX, - "/tmp/volume-%u-%u-%u", getpid(), major(devt), minor(devt)); - tmp_node[VOLUME_ID_PATH_MAX] = '\0'; - - /* create tempory node to open the block device */ - unlink(tmp_node); - if (mknod(tmp_node, (S_IFBLK | 0600), devt) != 0) - return NULL; - - id = volume_id_open_node(tmp_node); - - unlink(tmp_node); - - return id; -} - -/* free allocated volume info */ -void volume_id_close(struct volume_id *id) -{ - if (id == NULL) - return; - - if (id->fd_close != 0) - close(id->fd); - - free_buffer(id); - - if (id->partitions != NULL) - free(id->partitions); - - free(id); -} diff --git a/extras/volume_id/volume_id.h b/extras/volume_id/volume_id.h deleted file mode 100644 index 9d66b196b7..0000000000 --- a/extras/volume_id/volume_id.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * volume_id - reads partition label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_H_ -#define _VOLUME_ID_H_ - -#define VOLUME_ID_VERSION 28 - -#define VOLUME_ID_LABEL_SIZE 64 -#define VOLUME_ID_UUID_SIZE 16 -#define VOLUME_ID_UUID_STRING_SIZE 37 -#define VOLUME_ID_FORMAT_SIZE 32 -#define VOLUME_ID_PATH_MAX 256 -#define VOLUME_ID_PARTITIONS_MAX 256 - -enum volume_id_usage { - VOLUME_ID_UNUSED, - VOLUME_ID_UNPROBED, - VOLUME_ID_OTHER, - VOLUME_ID_FILESYSTEM, - VOLUME_ID_PARTITIONTABLE, - VOLUME_ID_RAID, -}; - -enum volume_id_type { - VOLUME_ID_ALL, - VOLUME_ID_MSDOSPARTTABLE, - VOLUME_ID_MSDOSEXTENDED, - VOLUME_ID_SWAP, - VOLUME_ID_EXT2, - VOLUME_ID_EXT3, - VOLUME_ID_REISERFS, - VOLUME_ID_XFS, - VOLUME_ID_JFS, - VOLUME_ID_VFAT, - VOLUME_ID_UDF, - VOLUME_ID_ISO9660, - VOLUME_ID_NTFS, - VOLUME_ID_MACPARTMAP, - VOLUME_ID_HFS, - VOLUME_ID_HFSPLUS, - VOLUME_ID_UFS, - VOLUME_ID_LINUX_RAID, - VOLUME_ID_LVM1, - VOLUME_ID_LVM2, - VOLUME_ID_HPTRAID, -}; - -struct volume_id_partition { - enum volume_id_usage usage_id; - enum volume_id_type type_id; - char *type; - unsigned long long off; - unsigned long long len; - unsigned int partition_type_raw; -}; - -struct volume_id { - unsigned char label_raw[VOLUME_ID_LABEL_SIZE]; - unsigned int label_raw_len; - char label[VOLUME_ID_LABEL_SIZE+1]; - unsigned char uuid_raw[VOLUME_ID_UUID_SIZE]; - char uuid[VOLUME_ID_UUID_STRING_SIZE]; - enum volume_id_usage usage_id; - enum volume_id_type type_id; - char *type; - char type_version[VOLUME_ID_FORMAT_SIZE]; - struct volume_id_partition *partitions; - unsigned int partition_count; - int fd; - unsigned char *sbbuf; - unsigned int sbbuf_len; - unsigned char *seekbuf; - unsigned long long seekbuf_off; - unsigned int seekbuf_len; - int fd_close; -}; - -/* open volume by already open file descriptor */ -extern struct volume_id *volume_id_open_fd(int fd); - -/* open volume by device node */ -extern struct volume_id *volume_id_open_node(const char *path); - -/* open volume by major/minor */ -extern struct volume_id *volume_id_open_dev_t(dev_t devt); - -/* probe volume for filesystem type and try to read label/uuid */ -extern int volume_id_probe(struct volume_id *id, enum volume_id_type type, - unsigned long long off, unsigned long long size); - -/* free allocated device info */ -extern void volume_id_close(struct volume_id *id); - -#endif diff --git a/extras/volume_id/volume_id/dasd/dasd.c b/extras/volume_id/volume_id/dasd/dasd.c new file mode 100644 index 0000000000..6f045fe326 --- /dev/null +++ b/extras/volume_id/volume_id/dasd/dasd.c @@ -0,0 +1,194 @@ +/* + * dasdlabel - read label from s390 block device + * + * Copyright (C) 2004 Arnd Bergmann + * + * 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 02139, USA. + * + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../util.h" +#include "dasd.h" + +static unsigned char EBCtoASC[256] = +{ +/* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ + 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, +/* 0x08 -GE -SPS -RPT VT FF CR SO SI */ + 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, +/* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC + -ENP ->LF */ + 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, +/* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB + -IUS */ + 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +/* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC + -INP */ + 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, +/* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL + -SW */ + 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, +/* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ + 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, +/* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ + 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, +/* 0x40 SP RSP ä ---- */ + 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, +/* 0x48 . < ( + | */ + 0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, +/* 0x50 & ---- */ + 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, +/* 0x58 ß ! $ * ) ; */ + 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, +/* 0x60 - / ---- Ä ---- ---- ---- */ + 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, +/* 0x68 ---- , % _ > ? */ + 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, +/* 0x70 --- ---- ---- ---- ---- ---- ---- */ + 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +/* 0x78 * ` : # @ ' = " */ + 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, +/* 0x80 * a b c d e f g */ + 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, +/* 0x88 h i ---- ---- ---- */ + 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, +/* 0x90 ° j k l m n o p */ + 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, +/* 0x98 q r ---- ---- */ + 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, +/* 0xA0 ~ s t u v w x */ + 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, +/* 0xA8 y z ---- ---- ---- ---- */ + 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, +/* 0xB0 ^ ---- § ---- */ + 0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, +/* 0xB8 ---- [ ] ---- ---- ---- ---- */ + 0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07, +/* 0xC0 { A B C D E F G */ + 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, +/* 0xC8 H I ---- ö ---- */ + 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, +/* 0xD0 } J K L M N O P */ + 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, +/* 0xD8 Q R ---- ü */ + 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, +/* 0xE0 \ S T U V W X */ + 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, +/* 0xE8 Y Z ---- Ö ---- ---- ---- */ + 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, +/* 0xF0 0 1 2 3 4 5 6 7 */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, +/* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ + 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 +}; + +static void vtoc_ebcdic_dec (const unsigned char *source, unsigned char *target, int l) +{ + int i; + + for (i = 0; i < l; i++) + target[i]=EBCtoASC[(unsigned char)(source[i])]; +} + +/* + * struct dasd_information_t + * represents any data about the data, which is visible to userspace + */ +typedef struct dasd_information_t { + unsigned int devno; /* S/390 devno */ + unsigned int real_devno; /* for aliases */ + unsigned int schid; /* S/390 subchannel identifier */ + unsigned int cu_type : 16; /* from SenseID */ + unsigned int cu_model : 8; /* from SenseID */ + unsigned int dev_type : 16; /* from SenseID */ + unsigned int dev_model : 8; /* from SenseID */ + unsigned int open_count; + unsigned int req_queue_len; + unsigned int chanq_len; /* length of chanq */ + char type[4]; /* from discipline.name, 'none' for unknown */ + unsigned int status; /* current device level */ + unsigned int label_block; /* where to find the VOLSER */ + unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ + unsigned int characteristics_size; + unsigned int confdata_size; + char characteristics[64]; /* from read_device_characteristics */ + char configuration_data[256]; /* from read_configuration_data */ +} dasd_information_t; + +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 14 +#define _IOC_DIRBITS 2 +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) +#define DASD_IOCTL_LETTER 'D' + +#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) +#define BLKSSZGET _IO(0x12,104) + +int probe_ibm_partition(struct volume_id *id) +{ + int blocksize; + dasd_information_t info; + __u8 *data; + __u8 *label_raw; + unsigned char name[7]; + + if (ioctl(id->fd, BIODASDINFO, &info) != 0) + return -1; + + if (ioctl(id->fd, BLKSSZGET, &blocksize) != 0) + return -1; + + data = volume_id_get_buffer(id, info.label_block * blocksize, 16); + if (data == NULL) + return -1; + + if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) + label_raw = &data[8]; + else + label_raw = &data[4]; + + name[6] = '\0'; + volume_id_set_usage(id, VOLUME_ID_DISKLABEL); + id->type = "dasd"; + volume_id_set_label_raw(id, label_raw, 6); + vtoc_ebcdic_dec(label_raw, name, 6); + volume_id_set_label_string(id, name, 6); + + return 0; +} diff --git a/extras/volume_id/volume_id/dasd/dasd.h b/extras/volume_id/volume_id/dasd/dasd.h new file mode 100644 index 0000000000..eba73f1af0 --- /dev/null +++ b/extras/volume_id/volume_id/dasd/dasd.h @@ -0,0 +1,26 @@ +/* + * dasdlabel - read label from s390 block device + * + * Copyright (C) 2004 Arnd Bergmann + * + * 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 02139, USA. + * + */ + +#ifndef _VOLUME_ID_DASDLABEL_ +#define _VOLUME_ID_DASDLABEL_ + +extern int probe_ibm_partition(struct volume_id *id); + +#endif diff --git a/extras/volume_id/volume_id/ext/ext.c b/extras/volume_id/volume_id/ext/ext.c new file mode 100644 index 0000000000..50ffa85372 --- /dev/null +++ b/extras/volume_id/volume_id/ext/ext.c @@ -0,0 +1,86 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../util.h" +#include "../logging.h" +#include "ext.h" + +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 +#define EXT_SUPERBLOCK_OFFSET 0x400 + +int volume_id_probe_ext(struct volume_id *id, __u64 off) +{ + struct ext2_super_block { + __u32 inodes_count; + __u32 blocks_count; + __u32 r_blocks_count; + __u32 free_blocks_count; + __u32 free_inodes_count; + __u32 first_data_block; + __u32 log_block_size; + __u32 dummy3[7]; + __u8 magic[2]; + __u16 state; + __u32 dummy5[8]; + __u32 feature_compat; + __u32 feature_incompat; + __u32 feature_ro_compat; + __u8 uuid[16]; + __u8 volume_name[16]; + } __attribute__((__packed__)) *es; + + es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); + if (es == NULL) + return -1; + + if (es->magic[0] != 0123 || + es->magic[1] != 0357) + return -1; + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + volume_id_set_label_raw(id, es->volume_name, 16); + volume_id_set_label_string(id, es->volume_name, 16); + volume_id_set_uuid(id, es->uuid, UUID_DCE); + + if ((le32_to_cpu(es->feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) + id->type = "ext3"; + else + id->type = "ext2"; + + return 0; +} diff --git a/extras/volume_id/volume_id/ext/ext.h b/extras/volume_id/volume_id/ext/ext.h new file mode 100644 index 0000000000..6b9b85876b --- /dev/null +++ b/extras/volume_id/volume_id/ext/ext.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_EXT_ +#define _VOLUME_ID_EXT_ + +extern int volume_id_probe_ext(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/fat/fat.c b/extras/volume_id/volume_id/fat/fat.c new file mode 100644 index 0000000000..e6f01076ad --- /dev/null +++ b/extras/volume_id/volume_id/fat/fat.c @@ -0,0 +1,350 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "fat.h" + +#define FAT12_MAX 0xff5 +#define FAT16_MAX 0xfff5 +#define FAT_ATTR_VOLUME_ID 0x08 +#define FAT_ATTR_DIR 0x10 +#define FAT_ATTR_LONG_NAME 0x0f +#define FAT_ATTR_MASK 0x3f +#define FAT_ENTRY_FREE 0xe5 + +struct vfat_super_block { + __u8 boot_jump[3]; + __u8 sysid[8]; + __u16 sector_size; + __u8 sectors_per_cluster; + __u16 reserved; + __u8 fats; + __u16 dir_entries; + __u16 sectors; + __u8 media; + __u16 fat_length; + __u16 secs_track; + __u16 heads; + __u32 hidden; + __u32 total_sect; + union { + struct fat_super_block { + __u8 unknown[3]; + __u8 serno[4]; + __u8 label[11]; + __u8 magic[8]; + __u8 dummy2[192]; + __u8 pmagic[2]; + } __attribute__((__packed__)) fat; + struct fat32_super_block { + __u32 fat32_length; + __u16 flags; + __u8 version[2]; + __u32 root_cluster; + __u16 insfo_sector; + __u16 backup_boot; + __u16 reserved2[6]; + __u8 unknown[3]; + __u8 serno[4]; + __u8 label[11]; + __u8 magic[8]; + __u8 dummy2[164]; + __u8 pmagic[2]; + } __attribute__((__packed__)) fat32; + } __attribute__((__packed__)) type; +} __attribute__((__packed__)); + +struct vfat_dir_entry { + __u8 name[11]; + __u8 attr; + __u16 time_creat; + __u16 date_creat; + __u16 time_acc; + __u16 date_acc; + __u16 cluster_high; + __u16 time_write; + __u16 date_write; + __u16 cluster_low; + __u32 size; +} __attribute__((__packed__)); + +static char *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) +{ + unsigned int i; + + for (i = 0; i < count; i++) { + /* end marker */ + if (dir[i].name[0] == 0x00) { + dbg("end of dir"); + break; + } + + /* empty entry */ + if (dir[i].name[0] == FAT_ENTRY_FREE) + continue; + + /* long name */ + if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) + continue; + + if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { + /* labels do not have file data */ + if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) + continue; + + dbg("found ATTR_VOLUME_ID id in root dir"); + return dir[i].name; + } + + dbg("skip dir entry"); + } + + return NULL; +} + +int volume_id_probe_vfat(struct volume_id *id, __u64 off) +{ + struct vfat_super_block *vs; + struct vfat_dir_entry *dir; + __u16 sector_size; + __u16 dir_entries; + __u32 sect_count; + __u16 reserved; + __u32 fat_size; + __u32 root_cluster; + __u32 dir_size; + __u32 cluster_count; + __u32 fat_length; + __u64 root_start; + __u32 start_data_sect; + __u16 root_dir_entries; + __u8 *buf; + __u32 buf_size; + __u8 *label = NULL; + __u32 next; + int maxloop; + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + /* believe only that's fat, don't trust the version + * the cluster_count will tell us + */ + if (strncmp(vs->sysid, "NTFS", 4) == 0) + return -1; + + if (strncmp(vs->type.fat32.magic, "MSWIN", 5) == 0) + goto valid; + + if (strncmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) + goto valid; + + if (strncmp(vs->type.fat.magic, "FAT16 ", 8) == 0) + goto valid; + + if (strncmp(vs->type.fat.magic, "MSDOS", 5) == 0) + goto valid; + + if (strncmp(vs->type.fat.magic, "FAT12 ", 8) == 0) + goto valid; + + /* + * There are old floppies out there without a magic, so we check + * for well known values and guess if it's a fat volume + */ + + /* boot jump address check */ + if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && + vs->boot_jump[0] != 0xe9) + return -1; + + /* heads check */ + if (vs->heads == 0) + return -1; + + /* cluster size check*/ + if (vs->sectors_per_cluster == 0 || + (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) + return -1; + + /* media check */ + if (vs->media < 0xf8 && vs->media != 0xf0) + return -1; + + /* fat count*/ + if (vs->fats != 2) + return -1; + +valid: + /* sector size check */ + sector_size = le16_to_cpu(vs->sector_size); + if (sector_size != 0x200 && sector_size != 0x400 && + sector_size != 0x800 && sector_size != 0x1000) + return -1; + + dbg("sector_size 0x%x", sector_size); + dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); + + dir_entries = le16_to_cpu(vs->dir_entries); + reserved = le16_to_cpu(vs->reserved); + dbg("reserved 0x%x", reserved); + + sect_count = le16_to_cpu(vs->sectors); + if (sect_count == 0) + sect_count = le32_to_cpu(vs->total_sect); + dbg("sect_count 0x%x", sect_count); + + fat_length = le16_to_cpu(vs->fat_length); + if (fat_length == 0) + fat_length = le32_to_cpu(vs->type.fat32.fat32_length); + dbg("fat_length 0x%x", fat_length); + + fat_size = fat_length * vs->fats; + dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + + (sector_size-1)) / sector_size; + dbg("dir_size 0x%x", dir_size); + + cluster_count = sect_count - (reserved + fat_size + dir_size); + cluster_count /= vs->sectors_per_cluster; + dbg("cluster_count 0x%x", cluster_count); + + if (cluster_count < FAT12_MAX) { + strcpy(id->type_version, "FAT12"); + } else if (cluster_count < FAT16_MAX) { + strcpy(id->type_version, "FAT16"); + } else { + strcpy(id->type_version, "FAT32"); + goto fat32; + } + + /* the label may be an attribute in the root directory */ + root_start = (reserved + fat_size) * sector_size; + dbg("root dir start 0x%llx", root_start); + root_dir_entries = le16_to_cpu(vs->dir_entries); + dbg("expected entries 0x%x", root_dir_entries); + + buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); + buf = volume_id_get_buffer(id, off + root_start, buf_size); + if (buf == NULL) + goto found; + + dir = (struct vfat_dir_entry*) buf; + + label = get_attr_volume_id(dir, root_dir_entries); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, label, 11); + volume_id_set_label_string(id, label, 11); + } else if (strncmp(vs->type.fat.label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, vs->type.fat.label, 11); + volume_id_set_label_string(id, vs->type.fat.label, 11); + } + volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); + goto found; + +fat32: + /* FAT32 root dir is a cluster chain like any other directory */ + buf_size = vs->sectors_per_cluster * sector_size; + root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); + dbg("root dir cluster %u", root_cluster); + start_data_sect = reserved + fat_size; + + next = root_cluster; + maxloop = 100; + while (--maxloop) { + __u32 next_sect_off; + __u64 next_off; + __u64 fat_entry_off; + int count; + + dbg("next cluster %u", next); + next_sect_off = (next - 2) * vs->sectors_per_cluster; + next_off = (start_data_sect + next_sect_off) * sector_size; + dbg("cluster offset 0x%llx", next_off); + + /* get cluster */ + buf = volume_id_get_buffer(id, off + next_off, buf_size); + if (buf == NULL) + goto found; + + dir = (struct vfat_dir_entry*) buf; + count = buf_size / sizeof(struct vfat_dir_entry); + dbg("expected entries 0x%x", count); + + label = get_attr_volume_id(dir, count); + if (label) + break; + + /* get FAT entry */ + fat_entry_off = (reserved * sector_size) + (next * sizeof(__u32)); + buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); + if (buf == NULL) + goto found; + + /* set next cluster */ + next = le32_to_cpu(*((__u32 *) buf) & 0x0fffffff); + if (next == 0) + break; + } + if (maxloop == 0) + dbg("reached maximum follow count of root cluster chain, give up"); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, label, 11); + volume_id_set_label_string(id, label, 11); + } else if (strncmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, vs->type.fat32.label, 11); + volume_id_set_label_string(id, vs->type.fat32.label, 11); + } + volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); + +found: + volume_id_set_usage(id, VOLUME_ID_DISKLABEL); + id->type = "vfat"; + + return 0; +} diff --git a/extras/volume_id/volume_id/fat/fat.h b/extras/volume_id/volume_id/fat/fat.h new file mode 100644 index 0000000000..51ad94df85 --- /dev/null +++ b/extras/volume_id/volume_id/fat/fat.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_FAT_ +#define _VOLUME_ID_FAT_ + +extern int volume_id_probe_vfat(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/hfs/hfs.c b/extras/volume_id/volume_id/hfs/hfs.c new file mode 100644 index 0000000000..638aabadf2 --- /dev/null +++ b/extras/volume_id/volume_id/hfs/hfs.c @@ -0,0 +1,308 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "hfs.h" + +#define HFS_SUPERBLOCK_OFFSET 0x400 +#define HFS_NODE_LEAF 0xff +#define HFSPLUS_POR_CNID 1 +#define HFSPLUS_EXTENT_COUNT 8 + +int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) +{ + struct hfs_finder_info{ + __u32 boot_folder; + __u32 start_app; + __u32 open_folder; + __u32 os9_folder; + __u32 reserved; + __u32 osx_folder; + __u8 id[8]; + } __attribute__((__packed__)); + + struct hfs_mdb { + __u8 signature[2]; + __u32 cr_date; + __u32 ls_Mod; + __u16 atrb; + __u16 nm_fls; + __u16 vbm_st; + __u16 alloc_ptr; + __u16 nm_al_blks; + __u32 al_blk_size; + __u32 clp_size; + __u16 al_bl_st; + __u32 nxt_cnid; + __u16 free_bks; + __u8 label_len; + __u8 label[27]; + __u32 vol_bkup; + __u16 vol_seq_num; + __u32 wr_cnt; + __u32 xt_clump_size; + __u32 ct_clump_size; + __u16 num_root_dirs; + __u32 file_count; + __u32 dir_count; + struct hfs_finder_info finder_info; + __u8 embed_sig[2]; + __u16 embed_startblock; + __u16 embed_blockcount; + } __attribute__((__packed__)) *hfs; + + struct hfsplus_bnode_descriptor { + __u32 next; + __u32 prev; + __u8 type; + __u8 height; + __u16 num_recs; + __u16 reserved; + } __attribute__((__packed__)); + + struct hfsplus_bheader_record { + __u16 depth; + __u32 root; + __u32 leaf_count; + __u32 leaf_head; + __u32 leaf_tail; + __u16 node_size; + } __attribute__((__packed__)); + + struct hfsplus_catalog_key { + __u16 key_len; + __u32 parent_id; + __u16 unicode_len; + __u8 unicode[255 * 2]; + } __attribute__((__packed__)); + + struct hfsplus_extent { + __u32 start_block; + __u32 block_count; + } __attribute__((__packed__)); + + struct hfsplus_fork { + __u64 total_size; + __u32 clump_size; + __u32 total_blocks; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; + } __attribute__((__packed__)); + + struct hfsplus_vol_header { + __u8 signature[2]; + __u16 version; + __u32 attributes; + __u32 last_mount_vers; + __u32 reserved; + __u32 create_date; + __u32 modify_date; + __u32 backup_date; + __u32 checked_date; + __u32 file_count; + __u32 folder_count; + __u32 blocksize; + __u32 total_blocks; + __u32 free_blocks; + __u32 next_alloc; + __u32 rsrc_clump_sz; + __u32 data_clump_sz; + __u32 next_cnid; + __u32 write_count; + __u64 encodings_bmp; + struct hfs_finder_info finder_info; + struct hfsplus_fork alloc_file; + struct hfsplus_fork ext_file; + struct hfsplus_fork cat_file; + struct hfsplus_fork attr_file; + struct hfsplus_fork start_file; + } __attribute__((__packed__)) *hfsplus; + + unsigned int blocksize; + unsigned int cat_block; + unsigned int ext_block_start; + unsigned int ext_block_count; + int ext; + unsigned int leaf_node_head; + unsigned int leaf_node_count; + unsigned int leaf_node_size; + unsigned int leaf_block; + __u64 leaf_off; + unsigned int alloc_block_size; + unsigned int alloc_first_block; + unsigned int embed_first_block; + unsigned int record_count; + struct hfsplus_bnode_descriptor *descr; + struct hfsplus_bheader_record *bnode; + struct hfsplus_catalog_key *key; + unsigned int label_len; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; + const __u8 *buf; + + buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + hfs = (struct hfs_mdb *) buf; + if (strncmp(hfs->signature, "BD", 2) != 0) + goto checkplus; + + /* it may be just a hfs wrapper for hfs+ */ + if (strncmp(hfs->embed_sig, "H+", 2) == 0) { + alloc_block_size = be32_to_cpu(hfs->al_blk_size); + dbg("alloc_block_size 0x%x", alloc_block_size); + + alloc_first_block = be16_to_cpu(hfs->al_bl_st); + dbg("alloc_first_block 0x%x", alloc_first_block); + + embed_first_block = be16_to_cpu(hfs->embed_startblock); + dbg("embed_first_block 0x%x", embed_first_block); + + off += (alloc_first_block * 512) + + (embed_first_block * alloc_block_size); + dbg("hfs wrapped hfs+ found at offset 0x%llx", off); + + buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + goto checkplus; + } + + if (hfs->label_len > 0 && hfs->label_len < 28) { + volume_id_set_label_raw(id, hfs->label, hfs->label_len); + volume_id_set_label_string(id, hfs->label, hfs->label_len) ; + } + + volume_id_set_uuid(id, hfs->finder_info.id, UUID_HFS); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hfs"; + + return 0; + +checkplus: + hfsplus = (struct hfsplus_vol_header *) buf; + if (strncmp(hfsplus->signature, "H+", 2) == 0) + goto hfsplus; + if (strncmp(hfsplus->signature, "HX", 2) == 0) + goto hfsplus; + return -1; + +hfsplus: + volume_id_set_uuid(id, hfsplus->finder_info.id, UUID_HFS); + + blocksize = be32_to_cpu(hfsplus->blocksize); + dbg("blocksize %u", blocksize); + + memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); + cat_block = be32_to_cpu(extents[0].start_block); + dbg("catalog start block 0x%x", cat_block); + + buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); + if (buf == NULL) + goto found; + + bnode = (struct hfsplus_bheader_record *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + leaf_node_head = be32_to_cpu(bnode->leaf_head); + dbg("catalog leaf node 0x%x", leaf_node_head); + + leaf_node_size = be16_to_cpu(bnode->node_size); + dbg("leaf node size 0x%x", leaf_node_size); + + leaf_node_count = be32_to_cpu(bnode->leaf_count); + dbg("leaf node count 0x%x", leaf_node_count); + if (leaf_node_count == 0) + goto found; + + leaf_block = (leaf_node_head * leaf_node_size) / blocksize; + + /* get physical location */ + for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { + ext_block_start = be32_to_cpu(extents[ext].start_block); + ext_block_count = be32_to_cpu(extents[ext].block_count); + dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); + + if (ext_block_count == 0) + goto found; + + /* this is our extent */ + if (leaf_block < ext_block_count) + break; + + leaf_block -= ext_block_count; + } + if (ext == HFSPLUS_EXTENT_COUNT) + goto found; + dbg("found block in extent %i", ext); + + leaf_off = (ext_block_start + leaf_block) * blocksize; + + buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size); + if (buf == NULL) + goto found; + + descr = (struct hfsplus_bnode_descriptor *) buf; + dbg("descriptor type 0x%x", descr->type); + + record_count = be16_to_cpu(descr->num_recs); + dbg("number of records %u", record_count); + if (record_count == 0) + goto found; + + if (descr->type != HFS_NODE_LEAF) + goto found; + + key = (struct hfsplus_catalog_key *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); + if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) + goto found; + + label_len = be16_to_cpu(key->unicode_len) * 2; + dbg("label unicode16 len %i", label_len); + volume_id_set_label_raw(id, key->unicode, label_len); + volume_id_set_label_unicode16(id, key->unicode, BE, label_len); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hfsplus"; + + return 0; +} diff --git a/extras/volume_id/volume_id/hfs/hfs.h b/extras/volume_id/volume_id/hfs/hfs.h new file mode 100644 index 0000000000..b23ccd30c8 --- /dev/null +++ b/extras/volume_id/volume_id/hfs/hfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_HFS_ +#define _VOLUME_ID_HFS_ + +extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/highpoint/highpoint.c b/extras/volume_id/volume_id/highpoint/highpoint.c new file mode 100644 index 0000000000..3236d6b2fd --- /dev/null +++ b/extras/volume_id/volume_id/highpoint/highpoint.c @@ -0,0 +1,70 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "highpoint.h" + +#define HPT37X_CONFIG_OFF 0x1200 +#define HPT37X_MAGIC_OK 0x5a7816f0 +#define HPT37X_MAGIC_BAD 0x5a7816fd + +int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off) +{ + struct hpt37x { + __u8 filler1[32]; + __u32 magic; + __u32 magic_0; + __u32 magic_1; + } __attribute__((packed)) *hpt; + + const __u8 *buf; + + buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); + if (buf == NULL) + return -1; + + hpt = (struct hpt37x *) buf; + + if (hpt->magic != HPT37X_MAGIC_OK && hpt->magic != HPT37X_MAGIC_BAD) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "hpt_ataraid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/highpoint/highpoint.h b/extras/volume_id/volume_id/highpoint/highpoint.h new file mode 100644 index 0000000000..5a5614afef --- /dev/null +++ b/extras/volume_id/volume_id/highpoint/highpoint.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_HIGHPOINT_ +#define _VOLUME_ID_HIGHPOINT_ + +extern int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/iso9660/iso9660.c b/extras/volume_id/volume_id/iso9660/iso9660.c new file mode 100644 index 0000000000..6af9e8befc --- /dev/null +++ b/extras/volume_id/volume_id/iso9660/iso9660.c @@ -0,0 +1,115 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "iso9660.h" + +#define ISO_SUPERBLOCK_OFFSET 0x8000 +#define ISO_SECTOR_SIZE 0x800 +#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) +#define ISO_VD_PRIMARY 0x1 +#define ISO_VD_SUPPLEMENTARY 0x2 +#define ISO_VD_END 0xff +#define ISO_VD_MAX 16 + +int volume_id_probe_iso9660(struct volume_id *id, __u64 off) +{ + union iso_super_block { + struct iso_header { + __u8 type; + __u8 id[5]; + __u8 version; + __u8 unused1; + __u8 system_id[32]; + __u8 volume_id[32]; + } __attribute__((__packed__)) iso; + struct hs_header { + __u8 foo[8]; + __u8 type; + __u8 id[4]; + __u8 version; + } __attribute__((__packed__)) hs; + } __attribute__((__packed__)) *is; + + is = (union iso_super_block *) volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); + if (is == NULL) + return -1; + + if (strncmp(is->iso.id, "CD001", 5) == 0) { + char root_label[VOLUME_ID_LABEL_SIZE+1]; + int vd_offset; + int i; + int found_svd; + + memset(root_label, 0, sizeof(root_label)); + strncpy(root_label, is->iso.volume_id, sizeof(root_label)-1); + + found_svd = 0; + vd_offset = ISO_VD_OFFSET; + for (i = 0; i < ISO_VD_MAX; i++) { + is = (union iso_super_block *) volume_id_get_buffer(id, off + vd_offset, 0x200); + if (is == NULL || is->iso.type == ISO_VD_END) + break; + if (is->iso.type == ISO_VD_SUPPLEMENTARY) { + dbg("found ISO supplementary VD at offset 0x%llx", off + vd_offset); + volume_id_set_label_raw(id, is->iso.volume_id, 32); + volume_id_set_label_unicode16(id, is->iso.volume_id, BE, 32); + found_svd = 1; + break; + } + vd_offset += ISO_SECTOR_SIZE; + } + + if (!found_svd || + (found_svd && !strncmp(root_label, id->label, 16))) + { + volume_id_set_label_raw(id, root_label, 32); + volume_id_set_label_string(id, root_label, 32); + } + goto found; + } + if (strncmp(is->hs.id, "CDROM", 5) == 0) + goto found; + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "iso9660"; + + return 0; +} diff --git a/extras/volume_id/volume_id/iso9660/iso9660.h b/extras/volume_id/volume_id/iso9660/iso9660.h new file mode 100644 index 0000000000..c187e25f94 --- /dev/null +++ b/extras/volume_id/volume_id/iso9660/iso9660.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_ISO9660_ +#define _VOLUME_ID_ISO9660_ + +extern int volume_id_probe_iso9660(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/jfs/jfs.c b/extras/volume_id/volume_id/jfs/jfs.c new file mode 100644 index 0000000000..3e7e9d6aea --- /dev/null +++ b/extras/volume_id/volume_id/jfs/jfs.c @@ -0,0 +1,74 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "jfs.h" + +#define JFS_SUPERBLOCK_OFFSET 0x8000 + +int volume_id_probe_jfs(struct volume_id *id, __u64 off) +{ + struct jfs_super_block { + __u8 magic[4]; + __u32 version; + __u64 size; + __u32 bsize; + __u32 dummy1; + __u32 pbsize; + __u32 dummy2[27]; + __u8 uuid[16]; + __u8 label[16]; + __u8 loguuid[16]; + } __attribute__((__packed__)) *js; + + js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); + if (js == NULL) + return -1; + + if (strncmp(js->magic, "JFS1", 4) != 0) + return -1; + + volume_id_set_label_raw(id, js->label, 16); + volume_id_set_label_string(id, js->label, 16); + volume_id_set_uuid(id, js->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "jfs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/jfs/jfs.h b/extras/volume_id/volume_id/jfs/jfs.h new file mode 100644 index 0000000000..28c48ffe53 --- /dev/null +++ b/extras/volume_id/volume_id/jfs/jfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_JFS_ +#define _VOLUME_ID_JFS_ + +extern int volume_id_probe_jfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/linux_raid/linux_raid.c b/extras/volume_id/volume_id/linux_raid/linux_raid.c new file mode 100644 index 0000000000..b55c6ca6e8 --- /dev/null +++ b/extras/volume_id/volume_id/linux_raid/linux_raid.c @@ -0,0 +1,97 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "linux_raid.h" + +#define MD_RESERVED_BYTES 0x10000 +#define MD_MAGIC 0xa92b4efc + +int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) +{ + struct mdp_super_block { + __u32 md_magic; + __u32 major_version; + __u32 minor_version; + __u32 patch_version; + __u32 gvalid_words; + __u32 set_uuid0; + __u32 ctime; + __u32 level; + __u32 size; + __u32 nr_disks; + __u32 raid_disks; + __u32 md_minor; + __u32 not_persistent; + __u32 set_uuid1; + __u32 set_uuid2; + __u32 set_uuid3; + } __attribute__((packed)) *mdp; + + const __u8 *buf; + __u64 sboff; + __u8 uuid[16]; + + if (size < 0x10000) + return -1; + + sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; + buf = volume_id_get_buffer(id, off + sboff, 0x800); + if (buf == NULL) + return -1; + + mdp = (struct mdp_super_block *) buf; + + if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) + return -1; + + memcpy(uuid, &mdp->set_uuid0, 4); + memcpy(&uuid[4], &mdp->set_uuid1, 12); + volume_id_set_uuid(id, uuid, UUID_DCE); + + snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u.%u.%u", + le32_to_cpu(mdp->major_version), + le32_to_cpu(mdp->minor_version), + le32_to_cpu(mdp->patch_version)); + + dbg("found raid signature"); + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "linux_raid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/linux_raid/linux_raid.h b/extras/volume_id/volume_id/linux_raid/linux_raid.h new file mode 100644 index 0000000000..0aaaaa6ade --- /dev/null +++ b/extras/volume_id/volume_id/linux_raid/linux_raid.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_LINUX_RAID_ +#define _VOLUME_ID_LINUX_RAID_ + +extern int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size); + +#endif diff --git a/extras/volume_id/volume_id/linux_swap/linux_swap.c b/extras/volume_id/volume_id/linux_swap/linux_swap.c new file mode 100644 index 0000000000..7ca4976078 --- /dev/null +++ b/extras/volume_id/volume_id/linux_swap/linux_swap.c @@ -0,0 +1,87 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "linux_swap.h" + +#define LARGEST_PAGESIZE 0x4000 + +int volume_id_probe_linux_swap(struct volume_id *id, __u64 off) +{ + struct swap_header_v1_2 { + __u8 bootbits[1024]; + __u32 version; + __u32 last_page; + __u32 nr_badpages; + __u8 uuid[16]; + __u8 volume_name[16]; + } __attribute__((__packed__)) *sw; + + const __u8 *buf; + unsigned int page; + + /* the swap signature is at the end of the PAGE_SIZE */ + for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { + buf = volume_id_get_buffer(id, off + page-10, 10); + if (buf == NULL) + return -1; + + if (strncmp(buf, "SWAP-SPACE", 10) == 0) { + strcpy(id->type_version, "1"); + goto found; + } + + if (strncmp(buf, "SWAPSPACE2", 10) == 0) { + sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); + if (sw == NULL) + return -1; + strcpy(id->type_version, "2"); + volume_id_set_label_raw(id, sw->volume_name, 16); + volume_id_set_label_string(id, sw->volume_name, 16); + volume_id_set_uuid(id, sw->uuid, UUID_DCE); + goto found; + } + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_OTHER); + id->type = "swap"; + + return 0; +} diff --git a/extras/volume_id/volume_id/linux_swap/linux_swap.h b/extras/volume_id/volume_id/linux_swap/linux_swap.h new file mode 100644 index 0000000000..5de0f93849 --- /dev/null +++ b/extras/volume_id/volume_id/linux_swap/linux_swap.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_LINUX_SWAP_ +#define _VOLUME_ID_LINUX_SWAP_ + +extern int volume_id_probe_linux_swap(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/logging.h b/extras/volume_id/volume_id/logging.h new file mode 100644 index 0000000000..c81dc57567 --- /dev/null +++ b/extras/volume_id/volume_id/logging.h @@ -0,0 +1,21 @@ +/* + * volume_id_logging - this file is used to map the dbg() function + * to the user's logging facility + * + */ + +#ifndef _VOLUME_ID_LOGGING_H_ +#define _VOLUME_ID_LOGGING_H_ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* just use the udev version */ +#include "../../logging.h" + +#endif /* _VOLUME_ID_LOGGING_H_ */ diff --git a/extras/volume_id/volume_id/lvm/lvm.c b/extras/volume_id/volume_id/lvm/lvm.c new file mode 100644 index 0000000000..d95b6bf2d4 --- /dev/null +++ b/extras/volume_id/volume_id/lvm/lvm.c @@ -0,0 +1,104 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "lvm.h" + +#define LVM1_SB_OFF 0x400 +#define LVM1_MAGIC "HM" + +int volume_id_probe_lvm1(struct volume_id *id, __u64 off) +{ + struct lvm2_super_block { + __u8 id[2]; + } __attribute__((packed)) *lvm; + + const __u8 *buf; + + buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); + if (buf == NULL) + return -1; + + lvm = (struct lvm2_super_block *) buf; + + if (strncmp(lvm->id, LVM1_MAGIC, 2) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "LVM1_member"; + + return 0; +} + +#define LVM2_LABEL_ID "LABELONE" +#define LVM2LABEL_SCAN_SECTORS 4 + +int volume_id_probe_lvm2(struct volume_id *id, __u64 off) +{ + struct lvm2_super_block { + __u8 id[8]; + __u64 sector_xl; + __u32 crc_xl; + __u32 offset_xl; + __u8 type[8]; + } __attribute__((packed)) *lvm; + + const __u8 *buf; + unsigned int soff; + + buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); + if (buf == NULL) + return -1; + + + for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { + lvm = (struct lvm2_super_block *) &buf[soff]; + + if (strncmp(lvm->id, LVM2_LABEL_ID, 8) == 0) + goto found; + } + + return -1; + +found: + strncpy(id->type_version, lvm->type, 8); + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "LVM2_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/lvm/lvm.h b/extras/volume_id/volume_id/lvm/lvm.h new file mode 100644 index 0000000000..2e44cda75b --- /dev/null +++ b/extras/volume_id/volume_id/lvm/lvm.h @@ -0,0 +1,27 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_LVM_ +#define _VOLUME_ID_LVM_ + +extern int volume_id_probe_lvm1(struct volume_id *id, __u64 off); +extern int volume_id_probe_lvm2(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/mac/mac.c b/extras/volume_id/volume_id/mac/mac.c new file mode 100644 index 0000000000..7265b288ab --- /dev/null +++ b/extras/volume_id/volume_id/mac/mac.c @@ -0,0 +1,140 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "mac.h" + +int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) +{ + struct mac_driver_desc { + __u8 signature[2]; + __u16 block_size; + __u32 block_count; + } __attribute__((__packed__)) *driver; + + struct mac_partition { + __u8 signature[2]; + __u16 res1; + __u32 map_count; + __u32 start_block; + __u32 block_count; + __u8 name[32]; + __u8 type[32]; + } __attribute__((__packed__)) *part; + + const __u8 *buf; + + buf = volume_id_get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if ((strncmp(part->signature, "PM", 2) == 0) && + (strncmp(part->type, "Apple_partition_map", 19) == 0)) { + /* linux creates an own subdevice for the map + * just return the type if the drive header is missing */ + volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); + id->type = "mac_partition_map"; + return 0; + } + + driver = (struct mac_driver_desc *) buf; + if (strncmp(driver->signature, "ER", 2) == 0) { + /* we are on a main device, like a CD + * just try to probe the first partition from the map */ + unsigned int bsize = be16_to_cpu(driver->block_size); + int part_count; + int i; + + /* get first entry of partition table */ + buf = volume_id_get_buffer(id, off + bsize, 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if (strncmp(part->signature, "PM", 2) != 0) + return -1; + + part_count = be32_to_cpu(part->map_count); + dbg("expecting %d partition entries", part_count); + + if (id->partitions != NULL) + free(id->partitions); + id->partitions = + malloc(part_count * sizeof(struct volume_id_partition)); + if (id->partitions == NULL) + return -1; + memset(id->partitions, 0x00, sizeof(struct volume_id_partition)); + + id->partition_count = part_count; + + for (i = 0; i < part_count; i++) { + __u64 poff; + __u64 plen; + + buf = volume_id_get_buffer(id, off + ((i+1) * bsize), 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if (strncmp(part->signature, "PM", 2) != 0) + return -1; + + poff = be32_to_cpu(part->start_block) * bsize; + plen = be32_to_cpu(part->block_count) * bsize; + dbg("found '%s' partition entry at 0x%llx, len 0x%llx", + part->type, poff, plen); + + id->partitions[i].off = poff; + id->partitions[i].len = plen; + + if (strncmp(part->type, "Apple_Free", 10) == 0) { + volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED); + } else if (strncmp(part->type, "Apple_partition_map", 19) == 0) { + volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE); + } else { + volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED); + } + } + volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); + id->type = "mac_partition_map"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/volume_id/mac/mac.h b/extras/volume_id/volume_id/mac/mac.h new file mode 100644 index 0000000000..888c1c527d --- /dev/null +++ b/extras/volume_id/volume_id/mac/mac.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_MAC_ +#define _VOLUME_ID_MAC_ + +extern int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/msdos/msdos.c b/extras/volume_id/volume_id/msdos/msdos.c new file mode 100644 index 0000000000..915c1b2917 --- /dev/null +++ b/extras/volume_id/volume_id/msdos/msdos.c @@ -0,0 +1,212 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "msdos.h" + +#define MSDOS_MAGIC "\x55\xaa" +#define MSDOS_PARTTABLE_OFFSET 0x1be +#define MSDOS_SIG_OFF 0x1fe +#define BSIZE 0x200 +#define DOS_EXTENDED_PARTITION 0x05 +#define LINUX_EXTENDED_PARTITION 0x85 +#define WIN98_EXTENDED_PARTITION 0x0f +#define LINUX_RAID_PARTITION 0xfd +#define is_extended(type) \ + (type == DOS_EXTENDED_PARTITION || \ + type == WIN98_EXTENDED_PARTITION || \ + type == LINUX_EXTENDED_PARTITION) +#define is_raid(type) \ + (type == LINUX_RAID_PARTITION) + +int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) +{ + struct msdos_partition_entry { + __u8 boot_ind; + __u8 head; + __u8 sector; + __u8 cyl; + __u8 sys_ind; + __u8 end_head; + __u8 end_sector; + __u8 end_cyl; + __u32 start_sect; + __u32 nr_sects; + } __attribute__((packed)) *part; + + const __u8 *buf; + int i; + __u64 poff; + __u64 plen; + __u64 extended = 0; + __u64 current; + __u64 next; + int limit; + int empty = 1; + struct volume_id_partition *p; + + buf = volume_id_get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + if (strncmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + return -1; + + /* check flags on all entries for a valid partition table */ + part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; + for (i = 0; i < 4; i++) { + if (part[i].boot_ind != 0 && + part[i].boot_ind != 0x80) + return -1; + + if (le32_to_cpu(part[i].nr_sects) != 0) + empty = 0; + } + if (empty == 1) + return -1; + + if (id->partitions != NULL) + free(id->partitions); + id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX * + sizeof(struct volume_id_partition)); + if (id->partitions == NULL) + return -1; + memset(id->partitions, 0x00, + VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); + + for (i = 0; i < 4; i++) { + poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + + if (plen == 0) + continue; + + p = &id->partitions[i]; + + p->partition_type_raw = part[i].sys_ind; + + if (is_extended(part[i].sys_ind)) { + dbg("found extended partition at 0x%llx", poff); + volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE); + p->type = "msdos_extended_partition"; + if (extended == 0) + extended = off + poff; + } else { + dbg("found 0x%x data partition at 0x%llx, len 0x%llx", + part[i].sys_ind, poff, plen); + + if (is_raid(part[i].sys_ind)) + volume_id_set_usage_part(p, VOLUME_ID_RAID); + else + volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); + } + + p->off = off + poff; + p->len = plen; + id->partition_count = i+1; + } + + next = extended; + current = extended; + limit = 50; + + /* follow extended partition chain and add data partitions */ + while (next != 0) { + if (limit-- == 0) { + dbg("extended chain limit reached"); + break; + } + + buf = volume_id_get_buffer(id, current, 0x200); + if (buf == NULL) + break; + + part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; + + if (strncmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + break; + + next = 0; + + for (i = 0; i < 4; i++) { + poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + + if (plen == 0) + continue; + + if (is_extended(part[i].sys_ind)) { + dbg("found extended partition at 0x%llx", poff); + if (next == 0) + next = extended + poff; + } else { + dbg("found 0x%x data partition at 0x%llx, len 0x%llx", + part[i].sys_ind, poff, plen); + + /* we always start at the 5th entry */ + while (id->partition_count < 4) + volume_id_set_usage_part(&id->partitions[id->partition_count++], VOLUME_ID_UNUSED); + + p = &id->partitions[id->partition_count]; + + if (is_raid(part[i].sys_ind)) + volume_id_set_usage_part(p, VOLUME_ID_RAID); + else + volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); + + p->off = current + poff; + p->len = plen; + id->partition_count++; + + p->partition_type_raw = part[i].sys_ind; + + if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { + dbg("too many partitions"); + next = 0; + } + } + } + + current = next; + } + + volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); + id->type = "msdos_partition_table"; + + return 0; +} diff --git a/extras/volume_id/volume_id/msdos/msdos.h b/extras/volume_id/volume_id/msdos/msdos.h new file mode 100644 index 0000000000..55185c006b --- /dev/null +++ b/extras/volume_id/volume_id/msdos/msdos.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_MSDOS_ +#define _VOLUME_ID_MSDOS_ + +extern int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/ntfs/ntfs.c b/extras/volume_id/volume_id/ntfs/ntfs.c new file mode 100644 index 0000000000..4e1f508561 --- /dev/null +++ b/extras/volume_id/volume_id/ntfs/ntfs.c @@ -0,0 +1,205 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "ntfs.h" + +#define MFT_RECORD_VOLUME 3 +#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 +#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 +#define MFT_RECORD_ATTR_OBJECT_ID 0x40 +#define MFT_RECORD_ATTR_END 0xffffffffu + +int volume_id_probe_ntfs(struct volume_id *id, __u64 off) +{ + struct ntfs_super_block { + __u8 jump[3]; + __u8 oem_id[8]; + __u16 bytes_per_sector; + __u8 sectors_per_cluster; + __u16 reserved_sectors; + __u8 fats; + __u16 root_entries; + __u16 sectors; + __u8 media_type; + __u16 sectors_per_fat; + __u16 sectors_per_track; + __u16 heads; + __u32 hidden_sectors; + __u32 large_sectors; + __u16 unused[2]; + __u64 number_of_sectors; + __u64 mft_cluster_location; + __u64 mft_mirror_cluster_location; + __s8 cluster_per_mft_record; + __u8 reserved1[3]; + __s8 cluster_per_index_record; + __u8 reserved2[3]; + __u8 volume_serial[8]; + __u16 checksum; + } __attribute__((__packed__)) *ns; + + struct master_file_table_record { + __u8 magic[4]; + __u16 usa_ofs; + __u16 usa_count; + __u64 lsn; + __u16 sequence_number; + __u16 link_count; + __u16 attrs_offset; + __u16 flags; + __u32 bytes_in_use; + __u32 bytes_allocated; + } __attribute__((__packed__)) *mftr; + + struct file_attribute { + __u32 type; + __u32 len; + __u8 non_resident; + __u8 name_len; + __u16 name_offset; + __u16 flags; + __u16 instance; + __u32 value_len; + __u16 value_offset; + } __attribute__((__packed__)) *attr; + + struct volume_info { + __u64 reserved; + __u8 major_ver; + __u8 minor_ver; + } __attribute__((__packed__)) *info; + + unsigned int sector_size; + unsigned int cluster_size; + __u64 mft_cluster; + __u64 mft_off; + unsigned int mft_record_size; + unsigned int attr_type; + unsigned int attr_off; + unsigned int attr_len; + unsigned int val_off; + unsigned int val_len; + const __u8 *buf; + const __u8 *val; + + ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); + if (ns == NULL) + return -1; + + if (strncmp(ns->oem_id, "NTFS", 4) != 0) + return -1; + + volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS); + + sector_size = le16_to_cpu(ns->bytes_per_sector); + cluster_size = ns->sectors_per_cluster * sector_size; + mft_cluster = le64_to_cpu(ns->mft_cluster_location); + mft_off = mft_cluster * cluster_size; + + if (ns->cluster_per_mft_record < 0) + /* size = -log2(mft_record_size); normally 1024 Bytes */ + mft_record_size = 1 << -ns->cluster_per_mft_record; + else + mft_record_size = ns->cluster_per_mft_record * cluster_size; + + dbg("sectorsize 0x%x", sector_size); + dbg("clustersize 0x%x", cluster_size); + dbg("mftcluster %lli", mft_cluster); + dbg("mftoffset 0x%llx", mft_off); + dbg("cluster per mft_record %i", ns->cluster_per_mft_record); + dbg("mft record size %i", mft_record_size); + + buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), + mft_record_size); + if (buf == NULL) + goto found; + + mftr = (struct master_file_table_record*) buf; + + dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); + if (strncmp(mftr->magic, "FILE", 4) != 0) + goto found; + + attr_off = le16_to_cpu(mftr->attrs_offset); + dbg("file $Volume's attributes are at offset %i", attr_off); + + while (1) { + attr = (struct file_attribute*) &buf[attr_off]; + attr_type = le32_to_cpu(attr->type); + attr_len = le16_to_cpu(attr->len); + val_off = le16_to_cpu(attr->value_offset); + val_len = le32_to_cpu(attr->value_len); + attr_off += attr_len; + + if (attr_len == 0) + break; + + if (attr_off >= mft_record_size) + break; + + if (attr_type == MFT_RECORD_ATTR_END) + break; + + dbg("found attribute type 0x%x, len %i, at offset %i", + attr_type, attr_len, attr_off); + + if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { + dbg("found info, len %i", val_len); + info = (struct volume_info*) (((__u8 *) attr) + val_off); + snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, + "%u.%u", info->major_ver, info->minor_ver); + } + + if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { + dbg("found label, len %i", val_len); + if (val_len > VOLUME_ID_LABEL_SIZE) + val_len = VOLUME_ID_LABEL_SIZE; + + val = ((__u8 *) attr) + val_off; + volume_id_set_label_raw(id, val, val_len); + volume_id_set_label_unicode16(id, val, LE, val_len); + } + } + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "ntfs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/ntfs/ntfs.h b/extras/volume_id/volume_id/ntfs/ntfs.h new file mode 100644 index 0000000000..63b1161d51 --- /dev/null +++ b/extras/volume_id/volume_id/ntfs/ntfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_NTFS_ +#define _VOLUME_ID_NTFS_ + +extern int volume_id_probe_ntfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/reiserfs/reiserfs.c b/extras/volume_id/volume_id/reiserfs/reiserfs.c new file mode 100644 index 0000000000..8fd8b51b59 --- /dev/null +++ b/extras/volume_id/volume_id/reiserfs/reiserfs.c @@ -0,0 +1,97 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "reiserfs.h" + +#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 +#define REISERFS_SUPERBLOCK_OFFSET 0x10000 + +int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) +{ + struct reiserfs_super_block { + __u32 blocks_count; + __u32 free_blocks; + __u32 root_block; + __u32 journal_block; + __u32 journal_dev; + __u32 orig_journal_size; + __u32 dummy2[5]; + __u16 blocksize; + __u16 dummy3[3]; + __u8 magic[12]; + __u32 dummy4[5]; + __u8 uuid[16]; + __u8 label[16]; + } __attribute__((__packed__)) *rs; + + rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); + if (rs == NULL) + return -1; + + if (strncmp(rs->magic, "ReIsEr2Fs", 9) == 0) { + strcpy(id->type_version, "3.6"); + goto found; + } + + if (strncmp(rs->magic, "ReIsEr3Fs", 9) == 0) { + strcpy(id->type_version, "JR"); + goto found; + } + + rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); + if (rs == NULL) + return -1; + + if (strncmp(rs->magic, "ReIsErFs", 8) == 0) { + strcpy(id->type_version, "3.5"); + goto found; + } + + return -1; + +found: + volume_id_set_label_raw(id, rs->label, 16); + volume_id_set_label_string(id, rs->label, 16); + volume_id_set_uuid(id, rs->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "reiserfs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/reiserfs/reiserfs.h b/extras/volume_id/volume_id/reiserfs/reiserfs.h new file mode 100644 index 0000000000..14f094578f --- /dev/null +++ b/extras/volume_id/volume_id/reiserfs/reiserfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_REISERFS_ +#define _VOLUME_ID_REISERFS_ + +extern int volume_id_probe_reiserfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/udf/udf.c b/extras/volume_id/volume_id/udf/udf.c new file mode 100644 index 0000000000..b91e3cce4e --- /dev/null +++ b/extras/volume_id/volume_id/udf/udf.c @@ -0,0 +1,187 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "udf.h" + +#define UDF_VSD_OFFSET 0x8000 + +int volume_id_probe_udf(struct volume_id *id, __u64 off) +{ + struct volume_descriptor { + struct descriptor_tag { + __u16 id; + __u16 version; + __u8 checksum; + __u8 reserved; + __u16 serial; + __u16 crc; + __u16 crc_len; + __u32 location; + } __attribute__((__packed__)) tag; + union { + struct anchor_descriptor { + __u32 length; + __u32 location; + } __attribute__((__packed__)) anchor; + struct primary_descriptor { + __u32 seq_num; + __u32 desc_num; + struct dstring { + __u8 clen; + __u8 c[31]; + } __attribute__((__packed__)) ident; + } __attribute__((__packed__)) primary; + } __attribute__((__packed__)) type; + } __attribute__((__packed__)) *vd; + + struct volume_structure_descriptor { + __u8 type; + __u8 id[5]; + __u8 version; + } *vsd; + + unsigned int bs; + unsigned int b; + unsigned int type; + unsigned int count; + unsigned int loc; + unsigned int clen; + + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); + if (vsd == NULL) + return -1; + + if (strncmp(vsd->id, "NSR02", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "NSR03", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "BEA01", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "BOOT2", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "CD001", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "CDW02", 5) == 0) + goto blocksize; + if (strncmp(vsd->id, "TEA03", 5) == 0) + goto blocksize; + return -1; + +blocksize: + /* search the next VSD to get the logical block size of the volume */ + for (bs = 0x800; bs < 0x8000; bs += 0x800) { + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); + if (vsd == NULL) + return -1; + dbg("test for blocksize: 0x%x", bs); + if (vsd->id[0] != '\0') + goto nsr; + } + return -1; + +nsr: + /* search the list of VSDs for a NSR descriptor */ + for (b = 0; b < 64; b++) { + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); + if (vsd == NULL) + return -1; + + dbg("vsd: %c%c%c%c%c", + vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); + + if (vsd->id[0] == '\0') + return -1; + if (strncmp(vsd->id, "NSR02", 5) == 0) + goto anchor; + if (strncmp(vsd->id, "NSR03", 5) == 0) + goto anchor; + } + return -1; + +anchor: + /* read anchor volume descriptor */ + vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + if (type != 2) /* TAG_ID_AVDP */ + goto found; + + /* get desriptor list address and block count */ + count = le32_to_cpu(vd->type.anchor.length) / bs; + loc = le32_to_cpu(vd->type.anchor.location); + dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); + + /* pick the primary descriptor from the list */ + for (b = 0; b < count; b++) { + vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + dbg("descriptor type %i", type); + + /* check validity */ + if (type == 0) + goto found; + if (le32_to_cpu(vd->tag.location) != loc + b) + goto found; + + if (type == 1) /* TAG_ID_PVD */ + goto pvd; + } + goto found; + +pvd: + volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); + + clen = vd->type.primary.ident.clen; + dbg("label string charsize=%i bit", clen); + if (clen == 8) + volume_id_set_label_string(id, vd->type.primary.ident.c, 31); + else if (clen == 16) + volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "udf"; + + return 0; +} diff --git a/extras/volume_id/volume_id/udf/udf.h b/extras/volume_id/volume_id/udf/udf.h new file mode 100644 index 0000000000..b112e46ffc --- /dev/null +++ b/extras/volume_id/volume_id/udf/udf.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_UDF_ +#define _VOLUME_ID_UDF_ + +extern int volume_id_probe_udf(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/ufs/ufs.c b/extras/volume_id/volume_id/ufs/ufs.c new file mode 100644 index 0000000000..bab1d4cfad --- /dev/null +++ b/extras/volume_id/volume_id/ufs/ufs.c @@ -0,0 +1,220 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "ufs.h" + +#define UFS_MAGIC 0x00011954 +#define UFS2_MAGIC 0x19540119 +#define UFS_MAGIC_FEA 0x00195612 +#define UFS_MAGIC_LFN 0x00095014 + +int volume_id_probe_ufs(struct volume_id *id, __u64 off) +{ + struct ufs_super_block { + __u32 fs_link; + __u32 fs_rlink; + __u32 fs_sblkno; + __u32 fs_cblkno; + __u32 fs_iblkno; + __u32 fs_dblkno; + __u32 fs_cgoffset; + __u32 fs_cgmask; + __u32 fs_time; + __u32 fs_size; + __u32 fs_dsize; + __u32 fs_ncg; + __u32 fs_bsize; + __u32 fs_fsize; + __u32 fs_frag; + __u32 fs_minfree; + __u32 fs_rotdelay; + __u32 fs_rps; + __u32 fs_bmask; + __u32 fs_fmask; + __u32 fs_bshift; + __u32 fs_fshift; + __u32 fs_maxcontig; + __u32 fs_maxbpg; + __u32 fs_fragshift; + __u32 fs_fsbtodb; + __u32 fs_sbsize; + __u32 fs_csmask; + __u32 fs_csshift; + __u32 fs_nindir; + __u32 fs_inopb; + __u32 fs_nspf; + __u32 fs_optim; + __u32 fs_npsect_state; + __u32 fs_interleave; + __u32 fs_trackskew; + __u32 fs_id[2]; + __u32 fs_csaddr; + __u32 fs_cssize; + __u32 fs_cgsize; + __u32 fs_ntrak; + __u32 fs_nsect; + __u32 fs_spc; + __u32 fs_ncyl; + __u32 fs_cpg; + __u32 fs_ipg; + __u32 fs_fpg; + struct ufs_csum { + __u32 cs_ndir; + __u32 cs_nbfree; + __u32 cs_nifree; + __u32 cs_nffree; + } __attribute__((__packed__)) fs_cstotal; + __s8 fs_fmod; + __s8 fs_clean; + __s8 fs_ronly; + __s8 fs_flags; + union { + struct { + __s8 fs_fsmnt[512]; + __u32 fs_cgrotor; + __u32 fs_csp[31]; + __u32 fs_maxcluster; + __u32 fs_cpc; + __u16 fs_opostbl[16][8]; + } __attribute__((__packed__)) fs_u1; + struct { + __s8 fs_fsmnt[468]; + __u8 fs_volname[32]; + __u64 fs_swuid; + __s32 fs_pad; + __u32 fs_cgrotor; + __u32 fs_ocsp[28]; + __u32 fs_contigdirs; + __u32 fs_csp; + __u32 fs_maxcluster; + __u32 fs_active; + __s32 fs_old_cpc; + __s32 fs_maxbsize; + __s64 fs_sparecon64[17]; + __s64 fs_sblockloc; + struct ufs2_csum_total { + __u64 cs_ndir; + __u64 cs_nbfree; + __u64 cs_nifree; + __u64 cs_nffree; + __u64 cs_numclusters; + __u64 cs_spare[3]; + } __attribute__((__packed__)) fs_cstotal; + struct ufs_timeval { + __s32 tv_sec; + __s32 tv_usec; + } __attribute__((__packed__)) fs_time; + __s64 fs_size; + __s64 fs_dsize; + __u64 fs_csaddr; + __s64 fs_pendingblocks; + __s32 fs_pendinginodes; + } __attribute__((__packed__)) fs_u2; + } fs_u11; + union { + struct { + __s32 fs_sparecon[53]; + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __s32 fs_state; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + } __attribute__((__packed__)) fs_sun; + struct { + __s32 fs_sparecon[53]; + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __u32 fs_npsect; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + } __attribute__((__packed__)) fs_sunx86; + struct { + __s32 fs_sparecon[50]; + __s32 fs_contigsumsize; + __s32 fs_maxsymlinklen; + __s32 fs_inodefmt; + __u32 fs_maxfilesize[2]; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + __s32 fs_state; + } __attribute__((__packed__)) fs_44; + } fs_u2; + __s32 fs_postblformat; + __s32 fs_nrpos; + __s32 fs_postbloff; + __s32 fs_rotbloff; + __u32 fs_magic; + __u8 fs_space[1]; + } __attribute__((__packed__)) *ufs; + + __u32 magic; + int i; + int offsets[] = {0, 8, 64, 256, -1}; + + for (i = 0; offsets[i] >= 0; i++) { + ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); + if (ufs == NULL) + return -1; + + dbg("offset 0x%x", offsets[i] * 0x400); + magic = be32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(be)", magic); + goto found; + } + magic = le32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(le)", magic); + goto found; + } + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "ufs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/ufs/ufs.h b/extras/volume_id/volume_id/ufs/ufs.h new file mode 100644 index 0000000000..82b4e1d064 --- /dev/null +++ b/extras/volume_id/volume_id/ufs/ufs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_UFS_ +#define _VOLUME_ID_UFS_ + +extern int volume_id_probe_ufs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c new file mode 100644 index 0000000000..0cd2eadec1 --- /dev/null +++ b/extras/volume_id/volume_id/util.c @@ -0,0 +1,245 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +static char *usage_to_string(enum volume_id_usage usage_id) +{ + switch (usage_id) { + case VOLUME_ID_FILESYSTEM: + return "filesystem"; + case VOLUME_ID_PARTITIONTABLE: + return "partitiontable"; + case VOLUME_ID_OTHER: + return "other"; + case VOLUME_ID_RAID: + return "raid"; + case VOLUME_ID_DISKLABEL: + return "disklabel"; + case VOLUME_ID_UNPROBED: + return "unprobed"; + case VOLUME_ID_UNUSED: + return "unused"; + } + return NULL; +} + +void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id) +{ + part->usage_id = usage_id; + part->usage = usage_to_string(usage_id); +} + +void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) +{ + id->usage_id = usage_id; + id->usage = usage_to_string(usage_id); +} + +void volume_id_set_label_raw(struct volume_id *id, const __u8 *buf, unsigned int count) +{ + memcpy(id->label_raw, buf, count); + id->label_raw_len = count; +} + +void volume_id_set_label_string(struct volume_id *id, const __u8 *buf, unsigned int count) +{ + unsigned int i; + + memcpy(id->label, buf, count); + + /* remove trailing whitespace */ + i = strnlen(id->label, count); + while (i--) { + if (!isspace(id->label[i])) + break; + } + id->label[i+1] = '\0'; +} + +void volume_id_set_label_unicode16(struct volume_id *id, const __u8 *buf, enum endian endianess, unsigned int count) +{ + unsigned int i, j; + __u16 c; + + j = 0; + for (i = 0; i + 2 <= count; i += 2) { + if (endianess == LE) + c = (buf[i+1] << 8) | buf[i]; + else + c = (buf[i] << 8) | buf[i+1]; + if (c == 0) { + id->label[j] = '\0'; + break; + } else if (c < 0x80) { + id->label[j++] = (__u8) c; + } else if (c < 0x800) { + id->label[j++] = (__u8) (0xc0 | (c >> 6)); + id->label[j++] = (__u8) (0x80 | (c & 0x3f)); + } else { + id->label[j++] = (__u8) (0xe0 | (c >> 12)); + id->label[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f)); + id->label[j++] = (__u8) (0x80 | (c & 0x3f)); + } + } +} + +void volume_id_set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format format) +{ + unsigned int i; + unsigned int count = 0; + + switch(format) { + case UUID_DOS: + count = 4; + break; + case UUID_NTFS: + case UUID_HFS: + count = 8; + break; + case UUID_DCE: + count = 16; + } + memcpy(id->uuid_raw, buf, count); + + /* if set, create string in the same format, the native platform uses */ + for (i = 0; i < count; i++) + if (buf[i] != 0) + goto set; + return; + +set: + switch(format) { + case UUID_DOS: + sprintf(id->uuid, "%02X%02X-%02X%02X", + buf[3], buf[2], buf[1], buf[0]); + break; + case UUID_NTFS: + sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", + buf[7], buf[6], buf[5], buf[4], + buf[3], buf[2], buf[1], buf[0]); + break; + case UUID_HFS: + sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], buf[6], buf[7]); + break; + case UUID_DCE: + sprintf(id->uuid, + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], + buf[6], buf[7], + buf[8], buf[9], + buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); + break; + } +} + +__u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) +{ + unsigned int buf_len; + + dbg("get buffer off 0x%llx(%llu), len 0x%x", off, off, len); + /* check if requested area fits in superblock buffer */ + if (off + len <= SB_BUFFER_SIZE) { + if (id->sbbuf == NULL) { + id->sbbuf = malloc(SB_BUFFER_SIZE); + if (id->sbbuf == NULL) + return NULL; + } + + /* check if we need to read */ + if ((off + len) > id->sbbuf_len) { + dbg("read sbbuf len:0x%llx", off + len); + lseek(id->fd, 0, SEEK_SET); + buf_len = read(id->fd, id->sbbuf, off + len); + dbg("got 0x%x (%i) bytes", buf_len, buf_len); + id->sbbuf_len = buf_len; + if (buf_len < off + len) + return NULL; + } + + return &(id->sbbuf[off]); + } else { + if (len > SEEK_BUFFER_SIZE) { + dbg("seek buffer too small %d", SEEK_BUFFER_SIZE); + return NULL; + } + + /* get seek buffer */ + if (id->seekbuf == NULL) { + id->seekbuf = malloc(SEEK_BUFFER_SIZE); + if (id->seekbuf == NULL) + return NULL; + } + + /* check if we need to read */ + if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { + dbg("read seekbuf off:0x%llx len:0x%x", off, len); + if (lseek(id->fd, off, SEEK_SET) == -1) + return NULL; + buf_len = read(id->fd, id->seekbuf, len); + dbg("got 0x%x (%i) bytes", buf_len, buf_len); + id->seekbuf_off = off; + id->seekbuf_len = buf_len; + if (buf_len < len) { + dbg("requested 0x%x bytes, got only 0x%x bytes", len, buf_len); + return NULL; + } + } + + return &(id->seekbuf[off - id->seekbuf_off]); + } +} + +void volume_id_free_buffer(struct volume_id *id) +{ + if (id->sbbuf != NULL) { + free(id->sbbuf); + id->sbbuf = NULL; + id->sbbuf_len = 0; + } + if (id->seekbuf != NULL) { + free(id->seekbuf); + id->seekbuf = NULL; + id->seekbuf_len = 0; + } +} diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h new file mode 100644 index 0000000000..e5cd63e1aa --- /dev/null +++ b/extras/volume_id/volume_id/util.h @@ -0,0 +1,91 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_UTIL_ +#define _VOLUME_ID_UTIL_ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +/* size of superblock buffer, reiserfs block is at 64k */ +#define SB_BUFFER_SIZE 0x11000 +/* size of seek buffer, FAT cluster is 32k max */ +#define SEEK_BUFFER_SIZE 0x10000 + +/* probe volume for all known filesystems in specific order */ +#define bswap16(x) (__u16)((((__u16)(x) & 0x00ffu) << 8) | \ + (((__u16)(x) & 0xff00u) >> 8)) + +#define bswap32(x) (__u32)((((__u32)(x) & 0xff000000u) >> 24) | \ + (((__u32)(x) & 0x00ff0000u) >> 8) | \ + (((__u32)(x) & 0x0000ff00u) << 8) | \ + (((__u32)(x) & 0x000000ffu) << 24)) + +#define bswap64(x) (__u64)((((__u64)(x) & 0xff00000000000000ull) >> 56) | \ + (((__u64)(x) & 0x00ff000000000000ull) >> 40) | \ + (((__u64)(x) & 0x0000ff0000000000ull) >> 24) | \ + (((__u64)(x) & 0x000000ff00000000ull) >> 8) | \ + (((__u64)(x) & 0x00000000ff000000ull) << 8) | \ + (((__u64)(x) & 0x0000000000ff0000ull) << 24) | \ + (((__u64)(x) & 0x000000000000ff00ull) << 40) | \ + (((__u64)(x) & 0x00000000000000ffull) << 56)) + +#if (__BYTE_ORDER == __LITTLE_ENDIAN) +#define le16_to_cpu(x) (x) +#define le32_to_cpu(x) (x) +#define le64_to_cpu(x) (x) +#define be16_to_cpu(x) bswap16(x) +#define be32_to_cpu(x) bswap32(x) +#elif (__BYTE_ORDER == __BIG_ENDIAN) +#define le16_to_cpu(x) bswap16(x) +#define le32_to_cpu(x) bswap32(x) +#define le64_to_cpu(x) bswap64(x) +#define be16_to_cpu(x) (x) +#define be32_to_cpu(x) (x) +#endif + +enum uuid_format { + UUID_DCE, + UUID_DOS, + UUID_NTFS, + UUID_HFS, +}; + +enum endian { + LE = 0, + BE = 1 +}; + +extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); +extern void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id); +extern void volume_id_set_label_raw(struct volume_id *id, const __u8 *buf, unsigned int count); +extern void volume_id_set_label_string(struct volume_id *id, const __u8 *buf, unsigned int count); +extern void volume_id_set_label_unicode16(struct volume_id *id, const __u8 *buf, enum endian endianess, unsigned int count); +extern void volume_id_set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format format); +extern __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len); +extern void volume_id_free_buffer(struct volume_id *id); + +#endif /* _VOLUME_ID_UTIL_ */ + diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c new file mode 100644 index 0000000000..e1d4b1c922 --- /dev/null +++ b/extras/volume_id/volume_id/volume_id.c @@ -0,0 +1,202 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +#include "ext/ext.h" +#include "reiserfs/reiserfs.h" +#include "fat/fat.h" +#include "hfs/hfs.h" +#include "jfs/jfs.h" +#include "xfs/xfs.h" +#include "ufs/ufs.h" +#include "ntfs/ntfs.h" +#include "iso9660/iso9660.h" +#include "udf/udf.h" +#include "highpoint/highpoint.h" +#include "linux_swap/linux_swap.h" +#include "linux_raid/linux_raid.h" +#include "lvm/lvm.h" +#include "mac/mac.h" +#include "msdos/msdos.h" + +int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size) +{ + if (id == NULL) + return -EINVAL; + + /* probe for raid first, cause fs probes may be successful on raid members */ + if (volume_id_probe_linux_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_lvm1(id, off) == 0) + goto exit; + + if (volume_id_probe_lvm2(id, off) == 0) + goto exit; + + if (volume_id_probe_highpoint_ataraid(id, off) == 0) + goto exit; + + /* signature in the first block, only small buffer needed */ + if (volume_id_probe_vfat(id, off) == 0) + goto exit; + + if (volume_id_probe_mac_partition_map(id, off) == 0) + goto exit; + + if (volume_id_probe_xfs(id, off) == 0) + goto exit; + + /* fill buffer with maximum */ + volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); + + if (volume_id_probe_linux_swap(id, off) == 0) + goto exit; + + if (volume_id_probe_ext(id, off) == 0) + goto exit; + + if (volume_id_probe_reiserfs(id, off) == 0) + goto exit; + + if (volume_id_probe_jfs(id, off) == 0) + goto exit; + + if (volume_id_probe_udf(id, off) == 0) + goto exit; + + if (volume_id_probe_iso9660(id, off) == 0) + goto exit; + + if (volume_id_probe_hfs_hfsplus(id, off) == 0) + goto exit; + + if (volume_id_probe_ufs(id, off) == 0) + goto exit; + + if (volume_id_probe_ntfs(id, off) == 0) + goto exit; + + return -1; + +exit: + /* If the filestystem in recognized, we free the allocated buffers, + otherwise they will stay in place for the possible next probe call */ + volume_id_free_buffer(id); + + return 0; +} + +/* open volume by already open file descriptor */ +struct volume_id *volume_id_open_fd(int fd) +{ + struct volume_id *id; + + id = malloc(sizeof(struct volume_id)); + if (id == NULL) + return NULL; + memset(id, 0x00, sizeof(struct volume_id)); + + id->fd = fd; + + return id; +} + +/* open volume by device node */ +struct volume_id *volume_id_open_node(const char *path) +{ + struct volume_id *id; + int fd; + + fd = open(path, O_RDONLY); + if (fd < 0) { + dbg("unable to open '%s'", path); + return NULL; + } + + id = volume_id_open_fd(fd); + if (id == NULL) + return NULL; + + /* close fd on device close */ + id->fd_close = 1; + + return id; +} + +/* open volume by major/minor */ +struct volume_id *volume_id_open_dev_t(dev_t devt) +{ + struct volume_id *id; + __u8 tmp_node[VOLUME_ID_PATH_MAX]; + + snprintf(tmp_node, VOLUME_ID_PATH_MAX, + "/dev/.volume_id-%u-%u-%u", getpid(), major(devt), minor(devt)); + tmp_node[VOLUME_ID_PATH_MAX] = '\0'; + + /* create tempory node to open the block device */ + unlink(tmp_node); + if (mknod(tmp_node, (S_IFBLK | 0600), devt) != 0) + return NULL; + + id = volume_id_open_node(tmp_node); + + unlink(tmp_node); + + return id; +} + +void volume_id_close(struct volume_id *id) +{ + if (id == NULL) + return; + + if (id->fd_close != 0) + close(id->fd); + + volume_id_free_buffer(id); + + if (id->partitions != NULL) + free(id->partitions); + + free(id); +} diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h new file mode 100644 index 0000000000..6c25a243c3 --- /dev/null +++ b/extras/volume_id/volume_id/volume_id.h @@ -0,0 +1,81 @@ +/* + * volume_id - reads partition label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_H_ +#define _VOLUME_ID_H_ + +#define VOLUME_ID_VERSION 31 + +#define VOLUME_ID_LABEL_SIZE 64 +#define VOLUME_ID_UUID_SIZE 16 +#define VOLUME_ID_UUID_STRING_SIZE 37 +#define VOLUME_ID_FORMAT_SIZE 32 +#define VOLUME_ID_PATH_MAX 256 +#define VOLUME_ID_PARTITIONS_MAX 256 + +enum volume_id_usage { + VOLUME_ID_UNUSED, + VOLUME_ID_UNPROBED, + VOLUME_ID_OTHER, + VOLUME_ID_FILESYSTEM, + VOLUME_ID_PARTITIONTABLE, + VOLUME_ID_RAID, + VOLUME_ID_DISKLABEL, +}; + +struct volume_id_partition { + enum volume_id_usage usage_id; + char *usage; + char *type; + unsigned long long off; + unsigned long long len; + unsigned int partition_type_raw; +}; + +struct volume_id { + unsigned char label_raw[VOLUME_ID_LABEL_SIZE]; + unsigned int label_raw_len; + char label[VOLUME_ID_LABEL_SIZE+1]; + unsigned char uuid_raw[VOLUME_ID_UUID_SIZE]; + char uuid[VOLUME_ID_UUID_STRING_SIZE]; + enum volume_id_usage usage_id; + char *usage; + char *type; + char type_version[VOLUME_ID_FORMAT_SIZE]; + + struct volume_id_partition *partitions; + unsigned int partition_count; + + int fd; + unsigned char *sbbuf; + unsigned int sbbuf_len; + unsigned char *seekbuf; + unsigned long long seekbuf_off; + unsigned int seekbuf_len; + int fd_close; +}; + +extern struct volume_id *volume_id_open_fd(int fd); +extern struct volume_id *volume_id_open_node(const char *path); +extern struct volume_id *volume_id_open_dev_t(dev_t devt); +extern int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size); +extern void volume_id_close(struct volume_id *id); + +#endif diff --git a/extras/volume_id/volume_id/xfs/xfs.c b/extras/volume_id/volume_id/xfs/xfs.c new file mode 100644 index 0000000000..b73f565eee --- /dev/null +++ b/extras/volume_id/volume_id/xfs/xfs.c @@ -0,0 +1,74 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "xfs.h" + +int volume_id_probe_xfs(struct volume_id *id, __u64 off) +{ + struct xfs_super_block { + __u8 magic[4]; + __u32 blocksize; + __u64 dblocks; + __u64 rblocks; + __u32 dummy1[2]; + __u8 uuid[16]; + __u32 dummy2[15]; + __u8 fname[12]; + __u32 dummy3[2]; + __u64 icount; + __u64 ifree; + __u64 fdblocks; + } __attribute__((__packed__)) *xs; + + xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); + if (xs == NULL) + return -1; + + if (strncmp(xs->magic, "XFSB", 4) != 0) + return -1; + + volume_id_set_label_raw(id, xs->fname, 12); + volume_id_set_label_string(id, xs->fname, 12); + volume_id_set_uuid(id, xs->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "xfs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/xfs/xfs.h b/extras/volume_id/volume_id/xfs/xfs.h new file mode 100644 index 0000000000..76b1725664 --- /dev/null +++ b/extras/volume_id/volume_id/xfs/xfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID__ +#define _VOLUME_ID__ + +extern int volume_id_probe_xfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id_logging.h b/extras/volume_id/volume_id_logging.h deleted file mode 100644 index e978ce197c..0000000000 --- a/extras/volume_id/volume_id_logging.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * volume_id_logging - this file is used to map the dbg() function - * to the host logging facility - * - */ - -#ifndef _VOLUME_ID_LOGGING_H_ -#define _VOLUME_ID_LOGGING_H_ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - -/* just use the udev version*/ -#include "../../logging.h" - -#endif /* _VOLUME_ID_LOGGING_H_ */ -- cgit v1.2.3-54-g00ecf From 85a953c0eeb66260f77bd69a255034af18cdbba0 Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Tue, 1 Feb 2005 11:12:32 +0100 Subject: [PATCH] The attached patch fixes the code path if namedev_name_device() fails. --- udev_add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_add.c b/udev_add.c index acd678ffba..d4cccfc085 100644 --- a/udev_add.c +++ b/udev_add.c @@ -292,7 +292,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) } if (namedev_name_device(udev, class_dev) != 0) - goto exit; + return 0; dbg("adding name='%s'", udev->name); -- cgit v1.2.3-54-g00ecf From d25e14ae1ef476fdc1d2b690b9426bd45bafd34e Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 3 Feb 2005 00:22:31 -0800 Subject: [PATCH] gentoo fb permission fix. --- etc/udev/gentoo/udev.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 6f71321fb8..7f708b631f 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -56,7 +56,7 @@ KERNEL="dm-[0-9]*", NAME="" KERNEL="device-mapper", NAME="mapper/control" # fb devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", MODE="0600" # floppy devices KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy" -- cgit v1.2.3-54-g00ecf From 9badc83e4f6d67e7d646c5f438597154f34ad0ab Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 3 Feb 2005 00:24:38 -0800 Subject: [PATCH] 051 release --- ChangeLog | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4f34bacdb2..42d84563b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,63 @@ +Summary of changes from v050 to v051 +============================================ + +: + o This fixes a silly mistake in how udevinfo prints the major and minor numbers (right now it prints the minor next to "MAJOR" and the major next to "MINOR" ;) + +: + o I tried to compile udev 050plus with the GCC 4.0 snapshot 200412119 and got two errors about possibly uninitialized structs, so I fixed this. + +Christian Borntrger: + o udev_volume_id: fix -d option + +Greg Kroah-Hartman: + o gentoo fb permission fix + o fix gcc 2.96 issue in libsysfs + o remove the lfs startup script on request of the author + o clean up the aoe char device rules, and delete the block one as it's not needed + o add aoe block and char device rules to the gentoo rule file + o fix udev_volume_id build error + +Hannes Reinecke: + o rearrange link order in Makefile + +Kay Sievers: + o udev_volume_id: new version of volume_id + o klibc: update to version 0.198 + o udev_volume_id: fix FAT label reading + o klibc: update to version 0.196 + o udevd: throttle the forking of processes + o udevd: add possible initialization of expected_seqnum + o udevd: it's obviously not the brightest idea to exit a device node manager if it doesn't find /dev/null + o udevd: separate socket handling to prepare for other event sources + o udevd: support -d switch to become a daemon + o udev_volume_id: version 27 + o udevd: split up message receiving an queueing + o remove useless warning if udev.conf contains keys not read by udev itself + o improve event sequence serialization + o remove udevsend syslog noise on udevd startup + o limit the initial timeout of the udevd event handling + o correct detection of hotplug.d/ udevsend loop + o correct log statement + o remove default_* permissions from udev.conf file + o update Fedora config files and add some more tests + o allow permissions only rules + o add SUBSYSTEM rule to catch all block devices and apply the disk permissions + o update Fedora config files + o handle renamed network interfaces properly if we manage hotplug.d/ + o allow multiline rules by backslash at the end of the line + o add OnStream tape drive rules + o simplify rules file by setting default mode to 0660 + o simplify permission application + o I broke the extras/ again. Add simple build test script now + o Merge vrfy.org:/home/kay/src/udev into vrfy.org:/home/kay/src/udev.kay + o initial merge of fedora udev.permissions into udev.rules + o remove permissions file mentioning from the udev man page + o fix some typos in gentoo's udev.rules introduced by the merge + +Michael Buesch: + o The attached patch fixes the code path if namedev_name_device() fails + Summary of changes from v049 to v050 ============================================ diff --git a/Makefile b/Makefile index d56f22d0df..ece518f53e 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 050 +VERSION = 051 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 46eaf698f8..a0fd5b5426 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 050 +Version: 051 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From fbda4a34d846946bf8ed63deadfd6e65b2299792 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 4 Feb 2005 21:38:26 +0100 Subject: [PATCH] selinux: cleanup udev integration Move code into a .c-file instead of big inline functions in a header file. Pass the device name down instead of relying that the node name is equal to the kernel name. --- Makefile | 7 ++- selinux.h | 148 -------------------------------------------------- udev_add.c | 15 +++--- udev_selinux.c | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev_selinux.h | 38 +++++++++++++ 5 files changed, 217 insertions(+), 157 deletions(-) delete mode 100644 selinux.h create mode 100644 udev_selinux.c create mode 100644 udev_selinux.h diff --git a/Makefile b/Makefile index ece518f53e..47516b3e37 100644 --- a/Makefile +++ b/Makefile @@ -203,7 +203,7 @@ HEADERS = \ udev_db.h \ udev_sysfs.h \ logging.h \ - selinux.h \ + udev_selinux.h \ list.h SYSFS_OBJS = \ @@ -245,6 +245,11 @@ ifeq ($(strip $(USE_KLIBC)),true) OBJS += klibc_fixups/klibc_fixups.a endif +ifeq ($(strip $(USE_SELINUX)),true) + UDEV_OBJS += udev_selinux.o + LIB_OBJS += -lselinux +endif + ifeq ($(strip $(V)),false) QUIET=@$(PWD)/ccdv HOST_PROGS=ccdv diff --git a/selinux.h b/selinux.h deleted file mode 100644 index df5bab69d7..0000000000 --- a/selinux.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef SELINUX_H -#define SELINUX_H - -#ifndef USE_SELINUX - -static inline void selinux_setfilecon(char *file, unsigned int mode) {} -static inline void selinux_setfscreatecon(char *file, unsigned int mode) {} -static inline void selinux_init(void) {} -static inline void selinux_restore(void) {} - -#else - -#include -#include -#include -#include - -static int selinux_enabled=-1; -static security_context_t prev_scontext=NULL; - -static inline int is_selinux_running(void) -{ - if (selinux_enabled == -1) - return selinux_enabled = is_selinux_enabled() > 0; - return selinux_enabled; -} - -static inline int selinux_get_media(char *path, int mode, char **media) -{ - FILE *fp; - char buf[PATH_MAX]; - char mediabuf[PATH_MAX]; - int ret = -1; - - *media = NULL; - if (!(mode && S_IFBLK)) { - return -1; - } - - snprintf(buf, sizeof(buf), "/proc/ide/%s/media", basename(path)); - - fp=fopen(buf,"r"); - if (!fp) - goto out; - - mediabuf[0] = '\0'; - - if (fgets(mediabuf, sizeof(mediabuf), fp) == NULL) - goto close_out; - - int size = strlen(mediabuf); - while (size-- > 0) { - if (isspace(mediabuf[size])) { - mediabuf[size]='\0'; - } else { - break; - } - } - *media = strdup(mediabuf); - info("selinux_get_media(%s)->%s \n", path, *media); - ret = 0; - -close_out: - fclose(fp); -out: - return ret; -} - -static inline void selinux_setfilecon(char *file, unsigned int mode) -{ - if (is_selinux_running()) { - security_context_t scontext=NULL; - char *media; - int ret=selinux_get_media(file, mode, &media); - if (ret == 0) { - ret = matchmediacon(media, &scontext); - free(media); - } - if (ret == -1) - if (matchpathcon(file, mode, &scontext) < 0) { - dbg("matchpathcon(%s) failed\n", file); - return; - } - if (setfilecon(file, scontext) < 0) - dbg("setfiles %s failed with error '%s'", - file, strerror(errno)); - freecon(scontext); - } -} - -static inline void selinux_setfscreatecon(char *file, unsigned int mode) -{ - int retval = 0; - security_context_t scontext=NULL; - - if (is_selinux_running()) { - char *media; - int ret = selinux_get_media(file, mode, &media); - - if (ret == 0) { - ret = matchmediacon(media, &scontext); - free(media); - } - - if (ret == -1) - if (matchpathcon(file, mode, &scontext) < 0) { - dbg("matchpathcon(%s) failed\n", file); - return; - } - - retval = setfscreatecon(scontext); - if (retval < 0) - dbg("setfiles %s failed with error '%s'", - file, strerror(errno)); - freecon(scontext); - } -} - -static inline void selinux_init(void) -{ - /* - * record the present security context, for file-creation - * restoration creation purposes. - */ - if (is_selinux_running()) { - if (getfscreatecon(&prev_scontext) < 0) { - dbg("getfscreatecon failed\n"); - } - prev_scontext = NULL; - } -} - -static inline void selinux_restore(void) -{ - if (is_selinux_running()) { - /* reset the file create context to its former glory */ - if (setfscreatecon(prev_scontext) < 0) - dbg("setfscreatecon failed\n"); - if (prev_scontext) { - freecon(prev_scontext); - prev_scontext = NULL; - } - } -} - -#endif /* USE_SELINUX */ - -#endif /* SELINUX_H */ diff --git a/udev_add.c b/udev_add.c index d4cccfc085..24a20bba9b 100644 --- a/udev_add.c +++ b/udev_add.c @@ -43,8 +43,7 @@ #include "logging.h" #include "namedev.h" #include "udev_db.h" - -#include "selinux.h" +#include "udev_selinux.h" /* * the major/minor of a device is stored in a file called "dev" @@ -68,7 +67,7 @@ error: return -1; } -static int make_node(char *file, int major, int minor, unsigned int mode, uid_t uid, gid_t gid) +static int make_node(struct udevice *udev, char *file, int major, int minor, unsigned int mode, uid_t uid, gid_t gid) { struct stat stats; int retval = 0; @@ -80,7 +79,7 @@ static int make_node(char *file, int major, int minor, unsigned int mode, uid_t if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) && (stats.st_rdev == makedev(major, minor))) { dbg("preserve file '%s', cause it has correct dev_t", file); - selinux_setfilecon(file,stats.st_mode); + selinux_setfilecon(file, udev->kernel_name, stats.st_mode); goto perms; } @@ -90,7 +89,7 @@ static int make_node(char *file, int major, int minor, unsigned int mode, uid_t dbg("already present file '%s' unlinked", file); create: - selinux_setfscreatecon(file, mode); + selinux_setfscreatecon(file, udev->kernel_name, mode); retval = mknod(file, mode, makedev(major, minor)); if (retval != 0) { dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", @@ -184,7 +183,7 @@ static int create_node(struct udevice *udev) if (!udev->test_run) { info("creating device node '%s'", filename); - if (make_node(filename, udev->major, udev->minor, udev->mode, uid, gid) != 0) + if (make_node(udev, filename, udev->major, udev->minor, udev->mode, uid, gid) != 0) goto error; } else { info("creating device node '%s', major = '%d', minor = '%d', " @@ -199,7 +198,7 @@ static int create_node(struct udevice *udev) for (i = 1; i <= udev->partitions; i++) { strfieldcpy(partitionname, filename); strintcat(partitionname, i); - make_node(partitionname, udev->major, udev->minor + i, udev->mode, uid, gid); + make_node(udev, partitionname, udev->major, udev->minor + i, udev->mode, uid, gid); } } } @@ -237,7 +236,7 @@ static int create_node(struct udevice *udev) dbg("symlink(%s, %s)", linktarget, filename); if (!udev->test_run) { - selinux_setfscreatecon(filename, S_IFLNK); + selinux_setfscreatecon(filename, udev->kernel_name, S_IFLNK); unlink(filename); if (symlink(linktarget, filename) != 0) dbg("symlink(%s, %s) failed with error '%s'", diff --git a/udev_selinux.c b/udev_selinux.c new file mode 100644 index 0000000000..72381f0d0d --- /dev/null +++ b/udev_selinux.c @@ -0,0 +1,166 @@ +/* + * udev_selinux.h + * + * Copyright (C) 2004 Daniel Walsh + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev_selinux.h" +#include "logging.h" + +static security_context_t prev_scontext = NULL; + +static int is_selinux_running(void) +{ + static int selinux_enabled = -1; + + if (selinux_enabled == -1) + selinux_enabled = (is_selinux_enabled() > 0); + + dbg("selinux=%i", selinux_enabled); + return selinux_enabled; +} + +static char *get_media(const char *devname, int mode) +{ + FILE *fp; + char procfile[PATH_MAX]; + char mediabuf[256]; + int size; + char *media = NULL; + + if (!(mode && S_IFBLK)) + return NULL; + + snprintf(procfile, PATH_MAX, "/proc/ide/%s/media", devname); + procfile[PATH_MAX-1] = '\0'; + + fp = fopen(procfile, "r"); + if (!fp) + goto out; + + if (fgets(mediabuf, sizeof(mediabuf), fp) == NULL) + goto close_out; + + size = strlen(mediabuf); + while (size-- > 0) { + if (isspace(mediabuf[size])) { + mediabuf[size] = '\0'; + } else { + break; + } + } + + media = strdup(mediabuf); + info("selinux_get_media(%s)='%s'\n", devname, media); + +close_out: + fclose(fp); +out: + return media; +} + +void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) +{ + if (is_selinux_running()) { + security_context_t scontext = NULL; + char *media; + int ret = -1; + + media = get_media(devname, mode); + if (media) { + ret = matchmediacon(media, &scontext); + free(media); + } + + if (ret < 0) + if (matchpathcon(file, mode, &scontext) < 0) { + dbg("matchpathcon(%s) failed\n", file); + return; + } + + if (setfilecon(file, scontext) < 0) + dbg("setfiles %s failed with error '%s'", file, strerror(errno)); + + freecon(scontext); + } +} + +void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) +{ + if (is_selinux_running()) { + security_context_t scontext = NULL; + char *media; + int ret = -1; + + media = get_media(devname, mode); + if (media) { + ret = matchmediacon(media, &scontext); + free(media); + } + + if (ret < 0) + if (matchpathcon(file, mode, &scontext) < 0) { + dbg("matchpathcon(%s) failed\n", file); + return; + } + + if (setfscreatecon(scontext) < 0) + dbg("setfiles %s failed with error '%s'", file, strerror(errno)); + + freecon(scontext); + } +} + +void selinux_init(void) +{ + /* + * record the present security context, for file-creation + * restoration creation purposes. + */ + if (is_selinux_running()) { + if (getfscreatecon(&prev_scontext) < 0) + dbg("getfscreatecon failed\n"); + + prev_scontext = NULL; + } +} + +void selinux_restore(void) +{ + if (is_selinux_running()) { + /* reset the file create context to its former glory */ + if (setfscreatecon(prev_scontext) < 0) + dbg("setfscreatecon failed\n"); + + if (prev_scontext) { + freecon(prev_scontext); + prev_scontext = NULL; + } + } +} diff --git a/udev_selinux.h b/udev_selinux.h new file mode 100644 index 0000000000..132a9a6550 --- /dev/null +++ b/udev_selinux.h @@ -0,0 +1,38 @@ +/* + * udev_selinux.h + * + * Copyright (C) 2004 Daniel Walsh + * + * 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 02139, USA. + * + */ +#ifndef _UDEV_SELINUX_H +#define _UDEV_SELINUX_H + +#ifdef USE_SELINUX + +extern void selinux_setfilecon(const char *file, const char *devname, unsigned int mode); +extern void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode); +extern void selinux_init(void); +extern void selinux_restore(void); + +#else + +static inline void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) {} +static inline void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) {} +static inline void selinux_init(void) {} +static inline void selinux_restore(void) {} + +#endif /* USE_SELINUX */ +#endif /* _UDEV_USE_SELINUX */ -- cgit v1.2.3-54-g00ecf From 61599bdd06b059e7a5792b0417828d0a87541038 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 4 Feb 2005 21:57:39 +0100 Subject: [PATCH] simple_build_check: make it possible to pass KERNEL_DIR --- test/simple-build-check.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 8919fcfcf0..fa80db4c82 100644 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -1,26 +1,29 @@ #/bin/sh -EXTRA="extras/chassis_id extras/scsi_id extras/volume_id" +EXTRAS="extras/chassis_id extras/scsi_id extras/volume_id" -make spotless EXTRAS="$EXTRA" >/dev/null -make all EXTRAS="$EXTRA" || exit +[ -z "$KERNEL_DIR" ] && KERNEL_DIR=/lib/modules/`uname -r`/build +echo KERNEL_DIR: "$KERNEL_DIR" + +make spotless EXTRAS="$EXTRAS" >/dev/null +make all EXTRAS="$EXTRAS" || exit echo -e "\n\n" -make spotless EXTRAS="$EXTRA" >/dev/null -make all DEBUG=true EXTRAS="$EXTRA" || exit +make spotless EXTRAS="$EXTRAS" >/dev/null +make all DEBUG=true EXTRAS="$EXTRAS" || exit echo -e "\n\n" -make spotless EXTRAS="$EXTRA" >/dev/null -make all USE_LOG=false EXTRAS="$EXTRA" || exit +make spotless EXTRAS="$EXTRAS" >/dev/null +make all USE_LOG=false EXTRAS="$EXTRAS" || exit echo -e "\n\n" -make spotless EXTRAS="$EXTRA" >/dev/null -make all USE_KLIBC=true DEBUG=true EXTRAS="$EXTRA" || exit +make spotless EXTRAS="$EXTRAS" >/dev/null +make all USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit echo -e "\n\n" -make spotless EXTRAS="$EXTRA" >/dev/null -make all USE_KLIBC=true USE_LOG=false EXTRAS="$EXTRA" || exit +make spotless EXTRAS="$EXTRAS" >/dev/null +make all USE_KLIBC=true USE_LOG=false EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit echo -e "\n\n" -make spotless EXTRAS="$EXTRA" >/dev/null +make spotless EXTRAS="$EXTRAS" >/dev/null -- cgit v1.2.3-54-g00ecf From 9172c95c77e8f1377b6c8becc84995e6e28a61eb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Feb 2005 02:36:54 +0100 Subject: [PATCH] chassis_id: clean compilation and fix bad function parameter passing Adding prototypes for functions resulted in an error, cause: table_find_disk(disk_snum, &chassis_num, &slot_num); is called but the function is defined as: int table_find_disk(char *serialnumber , int *host_num, int *chassis_num, int *slot_num) which can obviously not work correctly. Using popen() is not klibc compatible, so skip the compilation if a klibc compile is requested. --- extras/chassis_id/Makefile | 24 ++++++++++++----- extras/chassis_id/chassis_id.c | 58 ++++++++++++++++++++---------------------- extras/chassis_id/chassis_id.h | 6 +++-- extras/chassis_id/table.c | 13 +++++++--- 4 files changed, 58 insertions(+), 43 deletions(-) diff --git a/extras/chassis_id/Makefile b/extras/chassis_id/Makefile index 141d23c7b8..ae5c95961c 100644 --- a/extras/chassis_id/Makefile +++ b/extras/chassis_id/Makefile @@ -20,7 +20,7 @@ # * Authors: Atul Sabharwal # * # * -CFLAGS = -g + TARGET = chassis_id exec_prefix = ${prefix} @@ -28,14 +28,24 @@ sbindir = ${exec_prefix}/sbin INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -all: chassis_id +all: chassis_id +ifneq ($(strip $(USE_KLIBC)),true) chassis_id: chassis_id.c table.c - gcc -o $(TARGET) $(CFLAGS) chassis_id.c table.c - -clean: - rm -rf core a.out $(TARGET) + $(QUIET) $(CC) -o $(TARGET) $(CFLAGS) chassis_id.c table.c install: all $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(sbindir)/$(TARGET) - +else +chassis_id: + @echo + @echo "!!! chassis_id is incompatible with klibc !!!" + @echo + @exit 0 + +install: all +endif + +clean: + rm -rf core a.out $(TARGET) + diff --git a/extras/chassis_id/chassis_id.c b/extras/chassis_id/chassis_id.c index 3fdfa96018..de86087921 100644 --- a/extras/chassis_id/chassis_id.c +++ b/extras/chassis_id/chassis_id.c @@ -18,7 +18,7 @@ * Boston, MA 021110-1307, USA. * * Authors: Atul Sabharwal - * + * */ #include @@ -29,7 +29,33 @@ //#define DEBUG 1 -int main(int argc, char **argv, char ** envp) +/* Run SCSI id to find serial number of the device */ +static int getserial_number(char * devpath, char * snumber) +{ + FILE *fp; + char vendor[255], model[255], cmd[255]; + int retval; + + sprintf(cmd, "/sbin/scsi_id -s %s -p 0x80", devpath); + + fp = popen(cmd, "r"); + + if (fp == NULL) + return -ERROR_BAD_SNUMBER; + + fscanf(fp, "%s %s %s", vendor, model, snumber); + #ifdef DEBUG + syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", snumber ); + #endif + + retval = pclose(fp); + if (retval == -1) + return -ERROR_BAD_SNUMBER; + else + return NO_ERROR; +} + +int main(int argc, char **argv, char **envp) { int chassis_num, slot_num, retval; char disk_snum[255], devpath[255]; @@ -63,31 +89,3 @@ int main(int argc, char **argv, char ** envp) } return 0; } - - -/* Run SCSI id to find serial number of the device */ -int getserial_number( char * devpath, char * snumber ) -{ - FILE *fp; - char vendor[255], model[255], cmd[255]; - int retval; - - sprintf(cmd, "/sbin/scsi_id -s %s -p 0x80", devpath); - - fp = popen(cmd, "r"); - - if (fp == NULL) - return -ERROR_BAD_SNUMBER; - - fscanf(fp, "%s %s %s", vendor, model, snumber); - #ifdef DEBUG - syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", snumber ); - #endif - - retval = pclose(fp); - if (retval == -1) - return -ERROR_BAD_SNUMBER; - else - return NO_ERROR; -} - diff --git a/extras/chassis_id/chassis_id.h b/extras/chassis_id/chassis_id.h index 9937e3dfac..1463bd22c7 100644 --- a/extras/chassis_id/chassis_id.h +++ b/extras/chassis_id/chassis_id.h @@ -18,7 +18,7 @@ * Boston, MA 021110-1307, USA. * * Authors: Atul Sabharwal - * + * */ #ifndef _CHASSIS_ID_H @@ -35,6 +35,8 @@ #define ERROR_BAD_SCAN 8 #define NO_ERROR 0 -extern int table_init(); +extern int table_init(void); +extern int table_find_disk(const char *serialnumber , int *chassis_num, int *slot_num); +extern int table_select_disk(int diskindex); #endif diff --git a/extras/chassis_id/table.c b/extras/chassis_id/table.c index f4689ae243..8d14cd1b59 100644 --- a/extras/chassis_id/table.c +++ b/extras/chassis_id/table.c @@ -18,10 +18,13 @@ * Boston, MA 021110-1307, USA. * * Authors: Atul Sabharwal - * + * */ #include +#include + +#include "chassis_id.h" #define TABLE_SIZE 100 #define PROVISION_DB "/usr/local/bin/provision.tbl" @@ -40,7 +43,7 @@ int ptable_size; /* Initialize the provisioning table by reading the data from special file provision.tbl * Return error if something does not work appropriately. */ -int table_init() +int table_init(void) { FILE *fp; char ptr[255]; @@ -70,7 +73,7 @@ int table_init() /* return -1 when no disk found. Otherwise return index of disk */ -int table_find_disk( char * serialnumber , int * host_num, int * chassis_num, int *slot_num) +int table_find_disk(const char *serialnumber , int *chassis_num, int *slot_num) { int i; @@ -92,10 +95,12 @@ int table_find_disk( char * serialnumber , int * host_num, int * chassis_num, in * so that it can create descriptive GDN for it. So, for that we need to output * this data to stdout. */ -int table_select_disk( int diskindex ) +int table_select_disk(int diskindex) { printf("%d ", ptable[diskindex].chassis_num); printf("%d ", ptable[diskindex].slot_num); printf("%s ", ptable[diskindex].name); + + return 0; } -- cgit v1.2.3-54-g00ecf From 1134a81b98e189a8ec99a1ea4aba8e52b358873b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Feb 2005 02:38:56 +0100 Subject: [PATCH] fix -Wsign-compare warnings --- extras/scsi_id/scsi_serial.c | 5 ++--- namedev_parse.c | 2 +- udev_db.c | 2 +- udev_sysfs.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 0db756404c..8b9fbe0681 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -553,7 +553,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, char *serial, int len) { int retval; - int id_ind, j; + unsigned int id_ind, j; unsigned char page_83[SCSI_INQ_BUFF_LEN]; memset(page_83, 0, SCSI_INQ_BUFF_LEN); @@ -584,8 +584,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, * Examine each descriptor returned. There is normally only * one or a small number of descriptors. */ - for (j = 4; j <= page_83[3] + 3; - j += page_83[j + 3] + 4) { + for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { retval = check_fill_0x83_id(scsi_dev, &page_83[j], &id_search_list[id_ind], serial, len); diff --git a/namedev_parse.c b/namedev_parse.c index 3b14a6a500..5bd59d83f2 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -126,7 +126,7 @@ static int namedev_parse(const char *filename, void *data) cur = 0; lineno = 0; while (cur < bufsize) { - int i, j; + unsigned int i, j; count = buf_get_line(buf, bufsize, cur); bufline = &buf[cur]; diff --git a/udev_db.c b/udev_db.c index 36da264716..df7cfbb259 100644 --- a/udev_db.c +++ b/udev_db.c @@ -195,7 +195,7 @@ int udev_db_get_device_byname(struct udevice *udev, const char *name) memset(&db_udev, 0x00, sizeof(struct udevice)); if (parse_db_file(&db_udev, filename) == 0) { char *pos; - int len; + unsigned int len; if (strncmp(name, db_udev.name, NAME_SIZE) == 0) { goto found; diff --git a/udev_sysfs.c b/udev_sysfs.c index 1b3603df6d..fd7330a161 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -211,7 +211,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { NULL, NULL } }; const struct class_device *classdevice; - int len; + unsigned int len; /* the kernel may tell us what to wait for */ if (kernel_release_satisfactory(2,6,10) > 0) -- cgit v1.2.3-54-g00ecf From 045b1f0f7a7af2182e7109f472d873f1cc0c5e4b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Feb 2005 02:43:16 +0100 Subject: [PATCH] Makefile: cleanup conditional config option sections --- Makefile | 129 ++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 61 insertions(+), 68 deletions(-) diff --git a/Makefile b/Makefile index 47516b3e37..052e41acc3 100644 --- a/Makefile +++ b/Makefile @@ -113,6 +113,47 @@ WARNINGS := -Wall CFLAGS := -pipe +HEADERS = \ + udev.h \ + udev_utils.h \ + namedev.h \ + udev_version.h \ + udev_db.h \ + udev_sysfs.h \ + logging.h \ + udev_selinux.h \ + list.h + +SYSFS_OBJS = \ + libsysfs/sysfs_bus.o \ + libsysfs/sysfs_class.o \ + libsysfs/sysfs_device.o \ + libsysfs/sysfs_dir.o \ + libsysfs/sysfs_driver.o \ + libsysfs/sysfs_utils.o \ + libsysfs/dlist.o + +UDEV_OBJS = \ + udev_utils.o \ + udev_config.o \ + udev_add.o \ + udev_remove.o \ + udev_start.o \ + udev_sysfs.o \ + udev_db.o \ + udev_multiplex.o \ + namedev.o \ + namedev_parse.o + +OBJS = \ + udev.a \ + libsysfs/sysfs.a + +SYSFS = $(PWD)/libsysfs/sysfs.a + +CFLAGS += -I$(PWD)/libsysfs/sysfs \ + -I$(PWD)/libsysfs + ifeq ($(strip $(USE_LOG)),true) CFLAGS += -DLOG endif @@ -129,8 +170,7 @@ else endif # If we are using our version of klibc, then we need to build, link it, and then -# link udev against it statically. -# Otherwise, use glibc and link dynamically. +# link udev against it statically. Otherwise, use glibc and link dynamically. ifeq ($(strip $(USE_KLIBC)),true) KLIBC_FIXUPS_DIR= $(PWD)/klibc_fixups KLIBC_BASE = $(PWD)/klibc @@ -156,6 +196,16 @@ ifeq ($(strip $(USE_KLIBC)),true) -I$(LINUX_INCLUDE_DIR) LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs + + HEADERS += \ + klibc_fixups/klibc_fixups.h \ + klibc_fixups/mntent.h \ + klibc_fixups/pwd.h + + KLIBC_FIXUP_OBJS = \ + klibc_fixups/klibc_fixups.o + + OBJS += klibc_fixups/klibc_fixups.a else WARNINGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations CRT0 = @@ -166,12 +216,18 @@ else endif ifeq ($(strip $(USE_SELINUX)),true) - CFLAGS += -DUSE_SELINUX + UDEV_OBJS += udev_selinux.o LIB_OBJS += -lselinux + CFLAGS += -DUSE_SELINUX endif -CFLAGS += -I$(PWD)/libsysfs/sysfs \ - -I$(PWD)/libsysfs +ifeq ($(strip $(V)),false) + QUIET=@$(PWD)/ccdv + HOST_PROGS=ccdv +else + QUIET= + HOST_PROGS= +endif # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf @@ -195,69 +251,6 @@ $(CRT0): fi $(MAKE) -C klibc SUBDIRS=klibc TESTS= -HEADERS = \ - udev.h \ - udev_utils.h \ - namedev.h \ - udev_version.h \ - udev_db.h \ - udev_sysfs.h \ - logging.h \ - udev_selinux.h \ - list.h - -SYSFS_OBJS = \ - libsysfs/sysfs_bus.o \ - libsysfs/sysfs_class.o \ - libsysfs/sysfs_device.o \ - libsysfs/sysfs_dir.o \ - libsysfs/sysfs_driver.o \ - libsysfs/sysfs_utils.o \ - libsysfs/dlist.o - -UDEV_OBJS = \ - udev_utils.o \ - udev_config.o \ - udev_add.o \ - udev_remove.o \ - udev_start.o \ - udev_sysfs.o \ - udev_db.o \ - udev_multiplex.o \ - namedev.o \ - namedev_parse.o - -OBJS = \ - udev.a \ - libsysfs/sysfs.a - -SYSFS = $(PWD)/libsysfs/sysfs.a - -ifeq ($(strip $(USE_KLIBC)),true) - HEADERS += \ - klibc_fixups/klibc_fixups.h \ - klibc_fixups/mntent.h \ - klibc_fixups/pwd.h - - KLIBC_FIXUP_OBJS = \ - klibc_fixups/klibc_fixups.o - - OBJS += klibc_fixups/klibc_fixups.a -endif - -ifeq ($(strip $(USE_SELINUX)),true) - UDEV_OBJS += udev_selinux.o - LIB_OBJS += -lselinux -endif - -ifeq ($(strip $(V)),false) - QUIET=@$(PWD)/ccdv - HOST_PROGS=ccdv -else - QUIET= - HOST_PROGS= -endif - udev.a: $(UDEV_OBJS) rm -f $@ $(QUIET) $(AR) cq $@ $(UDEV_OBJS) -- cgit v1.2.3-54-g00ecf From 51df9ee4965516b17dcd50647546ee970df87b32 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Feb 2005 02:44:37 +0100 Subject: [PATCH] Makefile: add some more warnings and prepare for clean gcc4 compile --- Makefile | 8 ++++++-- extras/volume_id/Makefile | 3 --- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 052e41acc3..dc907f6a81 100644 --- a/Makefile +++ b/Makefile @@ -108,8 +108,12 @@ GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ then echo "-Os"; else echo "-O2" ; fi} -# add -Wredundant-decls when libsysfs gets cleaned up -WARNINGS := -Wall +# check if compiler option is supported +cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} + +WARNINGS := -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith -Wstrict-prototypes -Wsign-compare +WARNINGS += $(call cc-supports,-Wno-pointer-sign) +WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) CFLAGS := -pipe diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index f0c15b8fec..d273ed795c 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -28,9 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-Wall -fno-builtin -Wchar-subscripts \ - -Wpointer-arith -Wcast-align -Wsign-compare - override CFLAGS+=-D_FILE_OFFSET_BITS=64 VOLUME_ID_OBJS= \ -- cgit v1.2.3-54-g00ecf From 7979e3d4b7c56acee2fe0e9a9fefb3fe0d83771e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Feb 2005 04:10:48 +0100 Subject: [PATCH] udev_volume_id: volume_id version 032 --- extras/volume_id/Makefile | 2 + extras/volume_id/volume_id/cramfs/cramfs.c | 75 ++++++++++++++++++++++ extras/volume_id/volume_id/cramfs/cramfs.h | 26 ++++++++ extras/volume_id/volume_id/fat/fat.c | 20 +++--- extras/volume_id/volume_id/hfs/hfs.c | 8 +-- extras/volume_id/volume_id/iso9660/iso9660.c | 6 +- extras/volume_id/volume_id/jfs/jfs.c | 2 +- extras/volume_id/volume_id/linux_swap/linux_swap.c | 4 +- extras/volume_id/volume_id/lvm/lvm.c | 4 +- extras/volume_id/volume_id/mac/mac.c | 14 ++-- extras/volume_id/volume_id/msdos/msdos.c | 4 +- extras/volume_id/volume_id/ntfs/ntfs.c | 4 +- extras/volume_id/volume_id/reiserfs/reiserfs.c | 6 +- extras/volume_id/volume_id/udf/udf.c | 18 +++--- extras/volume_id/volume_id/volume_id.c | 4 ++ extras/volume_id/volume_id/volume_id.h | 2 +- extras/volume_id/volume_id/xfs/xfs.c | 2 +- 17 files changed, 154 insertions(+), 47 deletions(-) create mode 100644 extras/volume_id/volume_id/cramfs/cramfs.c create mode 100644 extras/volume_id/volume_id/cramfs/cramfs.h diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index d273ed795c..bfe4cf74af 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -47,6 +47,7 @@ VOLUME_ID_OBJS= \ volume_id/udf/udf.o \ volume_id/ufs/ufs.o \ volume_id/xfs/xfs.o \ + volume_id/cramfs/cramfs.o \ volume_id/dasd/dasd.o \ volume_id/volume_id.o \ volume_id/util.o @@ -68,6 +69,7 @@ VOLUME_ID_HEADERS= \ volume_id/udf/udf.h \ volume_id/ufs/ufs.h \ volume_id/xfs/xfs.h \ + volume_id/cramfs/cramfs.h \ volume_id/dasd/dasd.h \ volume_id/volume_id.h \ volume_id/util.h diff --git a/extras/volume_id/volume_id/cramfs/cramfs.c b/extras/volume_id/volume_id/cramfs/cramfs.c new file mode 100644 index 0000000000..69ab2c7a44 --- /dev/null +++ b/extras/volume_id/volume_id/cramfs/cramfs.c @@ -0,0 +1,75 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "cramfs.h" + +struct cramfs_super { + __u8 magic[4]; + __u32 size; + __u32 flags; + __u32 future; + __u8 signature[16]; + struct cramfs_info { + __u32 crc; + __u32 edition; + __u32 blocks; + __u32 files; + } __attribute__((__packed__)) info; + __u8 name[16]; +} __attribute__((__packed__)); + +int volume_id_probe_cramfs(struct volume_id *id, __u64 off) +{ + struct cramfs_super *cs; + + cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); + if (cs == NULL) + return -1; + + if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0) { + volume_id_set_label_raw(id, cs->name, 16); + volume_id_set_label_string(id, cs->name, 16); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "cramfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/volume_id/cramfs/cramfs.h b/extras/volume_id/volume_id/cramfs/cramfs.h new file mode 100644 index 0000000000..b94445b8b7 --- /dev/null +++ b/extras/volume_id/volume_id/cramfs/cramfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_CRAMFS_ +#define _VOLUME_ID_CRAMFS_ + +extern int volume_id_probe_cramfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/fat/fat.c b/extras/volume_id/volume_id/fat/fat.c index e6f01076ad..219207e81d 100644 --- a/extras/volume_id/volume_id/fat/fat.c +++ b/extras/volume_id/volume_id/fat/fat.c @@ -166,22 +166,22 @@ int volume_id_probe_vfat(struct volume_id *id, __u64 off) /* believe only that's fat, don't trust the version * the cluster_count will tell us */ - if (strncmp(vs->sysid, "NTFS", 4) == 0) + if (memcmp(vs->sysid, "NTFS", 4) == 0) return -1; - if (strncmp(vs->type.fat32.magic, "MSWIN", 5) == 0) + if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) goto valid; - if (strncmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) + if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) goto valid; - if (strncmp(vs->type.fat.magic, "FAT16 ", 8) == 0) + if (memcmp(vs->type.fat.magic, "FAT16 ", 8) == 0) goto valid; - if (strncmp(vs->type.fat.magic, "MSDOS", 5) == 0) + if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0) goto valid; - if (strncmp(vs->type.fat.magic, "FAT12 ", 8) == 0) + if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) goto valid; /* @@ -272,10 +272,10 @@ valid: if (vs == NULL) return -1; - if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { + if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { volume_id_set_label_raw(id, label, 11); volume_id_set_label_string(id, label, 11); - } else if (strncmp(vs->type.fat.label, "NO NAME ", 11) != 0) { + } else if (memcmp(vs->type.fat.label, "NO NAME ", 11) != 0) { volume_id_set_label_raw(id, vs->type.fat.label, 11); volume_id_set_label_string(id, vs->type.fat.label, 11); } @@ -333,10 +333,10 @@ fat32: if (vs == NULL) return -1; - if (label != NULL && strncmp(label, "NO NAME ", 11) != 0) { + if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { volume_id_set_label_raw(id, label, 11); volume_id_set_label_string(id, label, 11); - } else if (strncmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { + } else if (memcmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { volume_id_set_label_raw(id, vs->type.fat32.label, 11); volume_id_set_label_string(id, vs->type.fat32.label, 11); } diff --git a/extras/volume_id/volume_id/hfs/hfs.c b/extras/volume_id/volume_id/hfs/hfs.c index 638aabadf2..a4ae86b56a 100644 --- a/extras/volume_id/volume_id/hfs/hfs.c +++ b/extras/volume_id/volume_id/hfs/hfs.c @@ -178,11 +178,11 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) return -1; hfs = (struct hfs_mdb *) buf; - if (strncmp(hfs->signature, "BD", 2) != 0) + if (memcmp(hfs->signature, "BD", 2) != 0) goto checkplus; /* it may be just a hfs wrapper for hfs+ */ - if (strncmp(hfs->embed_sig, "H+", 2) == 0) { + if (memcmp(hfs->embed_sig, "H+", 2) == 0) { alloc_block_size = be32_to_cpu(hfs->al_blk_size); dbg("alloc_block_size 0x%x", alloc_block_size); @@ -216,9 +216,9 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) checkplus: hfsplus = (struct hfsplus_vol_header *) buf; - if (strncmp(hfsplus->signature, "H+", 2) == 0) + if (memcmp(hfsplus->signature, "H+", 2) == 0) goto hfsplus; - if (strncmp(hfsplus->signature, "HX", 2) == 0) + if (memcmp(hfsplus->signature, "HX", 2) == 0) goto hfsplus; return -1; diff --git a/extras/volume_id/volume_id/iso9660/iso9660.c b/extras/volume_id/volume_id/iso9660/iso9660.c index 6af9e8befc..fa769d3ca3 100644 --- a/extras/volume_id/volume_id/iso9660/iso9660.c +++ b/extras/volume_id/volume_id/iso9660/iso9660.c @@ -70,7 +70,7 @@ int volume_id_probe_iso9660(struct volume_id *id, __u64 off) if (is == NULL) return -1; - if (strncmp(is->iso.id, "CD001", 5) == 0) { + if (memcmp(is->iso.id, "CD001", 5) == 0) { char root_label[VOLUME_ID_LABEL_SIZE+1]; int vd_offset; int i; @@ -96,14 +96,14 @@ int volume_id_probe_iso9660(struct volume_id *id, __u64 off) } if (!found_svd || - (found_svd && !strncmp(root_label, id->label, 16))) + (found_svd && !memcmp(root_label, id->label, 16))) { volume_id_set_label_raw(id, root_label, 32); volume_id_set_label_string(id, root_label, 32); } goto found; } - if (strncmp(is->hs.id, "CDROM", 5) == 0) + if (memcmp(is->hs.id, "CDROM", 5) == 0) goto found; return -1; diff --git a/extras/volume_id/volume_id/jfs/jfs.c b/extras/volume_id/volume_id/jfs/jfs.c index 3e7e9d6aea..c9dce84ecb 100644 --- a/extras/volume_id/volume_id/jfs/jfs.c +++ b/extras/volume_id/volume_id/jfs/jfs.c @@ -60,7 +60,7 @@ int volume_id_probe_jfs(struct volume_id *id, __u64 off) if (js == NULL) return -1; - if (strncmp(js->magic, "JFS1", 4) != 0) + if (memcmp(js->magic, "JFS1", 4) != 0) return -1; volume_id_set_label_raw(id, js->label, 16); diff --git a/extras/volume_id/volume_id/linux_swap/linux_swap.c b/extras/volume_id/volume_id/linux_swap/linux_swap.c index 7ca4976078..d34b22c590 100644 --- a/extras/volume_id/volume_id/linux_swap/linux_swap.c +++ b/extras/volume_id/volume_id/linux_swap/linux_swap.c @@ -61,12 +61,12 @@ int volume_id_probe_linux_swap(struct volume_id *id, __u64 off) if (buf == NULL) return -1; - if (strncmp(buf, "SWAP-SPACE", 10) == 0) { + if (memcmp(buf, "SWAP-SPACE", 10) == 0) { strcpy(id->type_version, "1"); goto found; } - if (strncmp(buf, "SWAPSPACE2", 10) == 0) { + if (memcmp(buf, "SWAPSPACE2", 10) == 0) { sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); if (sw == NULL) return -1; diff --git a/extras/volume_id/volume_id/lvm/lvm.c b/extras/volume_id/volume_id/lvm/lvm.c index d95b6bf2d4..e736f4ed4a 100644 --- a/extras/volume_id/volume_id/lvm/lvm.c +++ b/extras/volume_id/volume_id/lvm/lvm.c @@ -56,7 +56,7 @@ int volume_id_probe_lvm1(struct volume_id *id, __u64 off) lvm = (struct lvm2_super_block *) buf; - if (strncmp(lvm->id, LVM1_MAGIC, 2) != 0) + if (memcmp(lvm->id, LVM1_MAGIC, 2) != 0) return -1; volume_id_set_usage(id, VOLUME_ID_RAID); @@ -89,7 +89,7 @@ int volume_id_probe_lvm2(struct volume_id *id, __u64 off) for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { lvm = (struct lvm2_super_block *) &buf[soff]; - if (strncmp(lvm->id, LVM2_LABEL_ID, 8) == 0) + if (memcmp(lvm->id, LVM2_LABEL_ID, 8) == 0) goto found; } diff --git a/extras/volume_id/volume_id/mac/mac.c b/extras/volume_id/volume_id/mac/mac.c index 7265b288ab..5872b722b4 100644 --- a/extras/volume_id/volume_id/mac/mac.c +++ b/extras/volume_id/volume_id/mac/mac.c @@ -64,8 +64,8 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) return -1; part = (struct mac_partition *) buf; - if ((strncmp(part->signature, "PM", 2) == 0) && - (strncmp(part->type, "Apple_partition_map", 19) == 0)) { + if ((memcmp(part->signature, "PM", 2) == 0) && + (memcmp(part->type, "Apple_partition_map", 19) == 0)) { /* linux creates an own subdevice for the map * just return the type if the drive header is missing */ volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); @@ -74,7 +74,7 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) } driver = (struct mac_driver_desc *) buf; - if (strncmp(driver->signature, "ER", 2) == 0) { + if (memcmp(driver->signature, "ER", 2) == 0) { /* we are on a main device, like a CD * just try to probe the first partition from the map */ unsigned int bsize = be16_to_cpu(driver->block_size); @@ -87,7 +87,7 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) return -1; part = (struct mac_partition *) buf; - if (strncmp(part->signature, "PM", 2) != 0) + if (memcmp(part->signature, "PM", 2) != 0) return -1; part_count = be32_to_cpu(part->map_count); @@ -112,7 +112,7 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) return -1; part = (struct mac_partition *) buf; - if (strncmp(part->signature, "PM", 2) != 0) + if (memcmp(part->signature, "PM", 2) != 0) return -1; poff = be32_to_cpu(part->start_block) * bsize; @@ -123,9 +123,9 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) id->partitions[i].off = poff; id->partitions[i].len = plen; - if (strncmp(part->type, "Apple_Free", 10) == 0) { + if (memcmp(part->type, "Apple_Free", 10) == 0) { volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED); - } else if (strncmp(part->type, "Apple_partition_map", 19) == 0) { + } else if (memcmp(part->type, "Apple_partition_map", 19) == 0) { volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE); } else { volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED); diff --git a/extras/volume_id/volume_id/msdos/msdos.c b/extras/volume_id/volume_id/msdos/msdos.c index 915c1b2917..08124fad2d 100644 --- a/extras/volume_id/volume_id/msdos/msdos.c +++ b/extras/volume_id/volume_id/msdos/msdos.c @@ -84,7 +84,7 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) if (buf == NULL) return -1; - if (strncmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) return -1; /* check flags on all entries for a valid partition table */ @@ -158,7 +158,7 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; - if (strncmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) break; next = 0; diff --git a/extras/volume_id/volume_id/ntfs/ntfs.c b/extras/volume_id/volume_id/ntfs/ntfs.c index 4e1f508561..bf87f9d8d0 100644 --- a/extras/volume_id/volume_id/ntfs/ntfs.c +++ b/extras/volume_id/volume_id/ntfs/ntfs.c @@ -122,7 +122,7 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) if (ns == NULL) return -1; - if (strncmp(ns->oem_id, "NTFS", 4) != 0) + if (memcmp(ns->oem_id, "NTFS", 4) != 0) return -1; volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS); @@ -153,7 +153,7 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) mftr = (struct master_file_table_record*) buf; dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); - if (strncmp(mftr->magic, "FILE", 4) != 0) + if (memcmp(mftr->magic, "FILE", 4) != 0) goto found; attr_off = le16_to_cpu(mftr->attrs_offset); diff --git a/extras/volume_id/volume_id/reiserfs/reiserfs.c b/extras/volume_id/volume_id/reiserfs/reiserfs.c index 8fd8b51b59..5653214e9d 100644 --- a/extras/volume_id/volume_id/reiserfs/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs/reiserfs.c @@ -64,12 +64,12 @@ int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) if (rs == NULL) return -1; - if (strncmp(rs->magic, "ReIsEr2Fs", 9) == 0) { + if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { strcpy(id->type_version, "3.6"); goto found; } - if (strncmp(rs->magic, "ReIsEr3Fs", 9) == 0) { + if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { strcpy(id->type_version, "JR"); goto found; } @@ -78,7 +78,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) if (rs == NULL) return -1; - if (strncmp(rs->magic, "ReIsErFs", 8) == 0) { + if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { strcpy(id->type_version, "3.5"); goto found; } diff --git a/extras/volume_id/volume_id/udf/udf.c b/extras/volume_id/volume_id/udf/udf.c index b91e3cce4e..ff23b31039 100644 --- a/extras/volume_id/volume_id/udf/udf.c +++ b/extras/volume_id/volume_id/udf/udf.c @@ -87,19 +87,19 @@ int volume_id_probe_udf(struct volume_id *id, __u64 off) if (vsd == NULL) return -1; - if (strncmp(vsd->id, "NSR02", 5) == 0) + if (memcmp(vsd->id, "NSR02", 5) == 0) goto blocksize; - if (strncmp(vsd->id, "NSR03", 5) == 0) + if (memcmp(vsd->id, "NSR03", 5) == 0) goto blocksize; - if (strncmp(vsd->id, "BEA01", 5) == 0) + if (memcmp(vsd->id, "BEA01", 5) == 0) goto blocksize; - if (strncmp(vsd->id, "BOOT2", 5) == 0) + if (memcmp(vsd->id, "BOOT2", 5) == 0) goto blocksize; - if (strncmp(vsd->id, "CD001", 5) == 0) + if (memcmp(vsd->id, "CD001", 5) == 0) goto blocksize; - if (strncmp(vsd->id, "CDW02", 5) == 0) + if (memcmp(vsd->id, "CDW02", 5) == 0) goto blocksize; - if (strncmp(vsd->id, "TEA03", 5) == 0) + if (memcmp(vsd->id, "TEA03", 5) == 0) goto blocksize; return -1; @@ -127,9 +127,9 @@ nsr: if (vsd->id[0] == '\0') return -1; - if (strncmp(vsd->id, "NSR02", 5) == 0) + if (memcmp(vsd->id, "NSR02", 5) == 0) goto anchor; - if (strncmp(vsd->id, "NSR03", 5) == 0) + if (memcmp(vsd->id, "NSR03", 5) == 0) goto anchor; } return -1; diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index e1d4b1c922..78aae37ba0 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -55,6 +55,7 @@ #include "linux_swap/linux_swap.h" #include "linux_raid/linux_raid.h" #include "lvm/lvm.h" +#include "cramfs/cramfs.h" #include "mac/mac.h" #include "msdos/msdos.h" @@ -116,6 +117,9 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l if (volume_id_probe_ntfs(id, off) == 0) goto exit; + if (volume_id_probe_cramfs(id, off) == 0) + goto exit; + return -1; exit: diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 6c25a243c3..a8c47bc616 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 31 +#define VOLUME_ID_VERSION 32 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 diff --git a/extras/volume_id/volume_id/xfs/xfs.c b/extras/volume_id/volume_id/xfs/xfs.c index b73f565eee..67ae2f07d5 100644 --- a/extras/volume_id/volume_id/xfs/xfs.c +++ b/extras/volume_id/volume_id/xfs/xfs.c @@ -60,7 +60,7 @@ int volume_id_probe_xfs(struct volume_id *id, __u64 off) if (xs == NULL) return -1; - if (strncmp(xs->magic, "XFSB", 4) != 0) + if (memcmp(xs->magic, "XFSB", 4) != 0) return -1; volume_id_set_label_raw(id, xs->fname, 12); -- cgit v1.2.3-54-g00ecf From d9cf0b0a7c0b3549afe9cdcfc2d1d43a4bafe8a9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Feb 2005 05:23:26 +0100 Subject: [PATCH] udev_volume_id: rename probe_ibm into probe_dasd --- extras/volume_id/udev_volume_id.c | 13 +++++-------- extras/volume_id/volume_id/dasd/dasd.c | 2 +- extras/volume_id/volume_id/dasd/dasd.h | 2 +- extras/volume_id/volume_id/volume_id.h | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 915c1c4117..c2a37e8547 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) struct sysfs_class_device *class_dev_parent = NULL; struct volume_id *vid = NULL; char *devpath; - char probe = 'p'; + char probe_main_device = 0; char print = 'a'; static char name[VOLUME_ID_LABEL_SIZE]; int len, i, j; @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) print = 'u'; continue; case 'd': - probe = 'd'; + probe_main_device = 1; continue; case 'h': case '?': @@ -146,8 +146,7 @@ int main(int argc, char *argv[]) goto exit; } - switch(probe) { - case 'p' : + if (probe_main_device == 0) { /* open block device */ vid = open_classdev(class_dev); if (vid == NULL) @@ -158,8 +157,7 @@ int main(int argc, char *argv[]) if (volume_id_probe_all(vid, 0, size) == 0) goto print; - break; - case 'd' : + } else { /* if we are on a partition, open main block device instead */ class_dev_parent = sysfs_get_classdev_parent(class_dev); if (class_dev_parent != NULL) @@ -169,9 +167,8 @@ int main(int argc, char *argv[]) if (vid == NULL) goto exit; - if (probe_ibm_partition(vid) == 0) + if (volume_id_probe_dasd_partition(vid) == 0) goto print; - break; } printf("unknown volume type\n"); diff --git a/extras/volume_id/volume_id/dasd/dasd.c b/extras/volume_id/volume_id/dasd/dasd.c index 6f045fe326..5623f69d36 100644 --- a/extras/volume_id/volume_id/dasd/dasd.c +++ b/extras/volume_id/volume_id/dasd/dasd.c @@ -160,7 +160,7 @@ typedef struct dasd_information_t { #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) #define BLKSSZGET _IO(0x12,104) -int probe_ibm_partition(struct volume_id *id) +int volume_id_probe_dasd_partition(struct volume_id *id) { int blocksize; dasd_information_t info; diff --git a/extras/volume_id/volume_id/dasd/dasd.h b/extras/volume_id/volume_id/dasd/dasd.h index eba73f1af0..e7918948c9 100644 --- a/extras/volume_id/volume_id/dasd/dasd.h +++ b/extras/volume_id/volume_id/dasd/dasd.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_DASDLABEL_ #define _VOLUME_ID_DASDLABEL_ -extern int probe_ibm_partition(struct volume_id *id); +extern int volume_id_probe_dasd_partition(struct volume_id *id); #endif diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index a8c47bc616..5a4b136c32 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 32 +#define VOLUME_ID_VERSION 33 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 -- cgit v1.2.3-54-g00ecf From 0786e8e541dcc0a82a57c96569519815c38962f3 Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Sun, 6 Feb 2005 00:09:34 +0100 Subject: [PATCH] udevd: fix valgrind warning ==4304== Syscall param sigaction(act) contains uninitialised or unaddressable byte(s) ==4304== at 0x804A37B: (within /sbin/udevd) ==4304== Address 0x52BFE7FC is on thread 1's stack --- udevd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevd.c b/udevd.c index 53c7bf3df1..7d7fd63332 100644 --- a/udevd.c +++ b/udevd.c @@ -690,6 +690,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("error fcntl on write pipe: %s", strerror(errno)); /* set signal handlers */ + memset(&act, 0x00, sizeof(struct sigaction)); act.sa_handler = (void (*) (int))sig_handler; sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; -- cgit v1.2.3-54-g00ecf From 3887557706fed195d85c958d5a07eb744b179e4c Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Sun, 6 Feb 2005 00:13:18 +0100 Subject: [PATCH] namdev: allow symlink-only rules to specify node permissions First case without the patch: KERNEL="hd*", GROUP="disk", MODE="0660" KERNEL="hdc", SYMLINK="cdrecorder", MODE="0666" brw-rw---- 1 root disk 22, 0 Feb 5 14:08 /dev/hdc Second case without the patch: KERNEL="hd*", GROUP="disk", MODE="0660" KERNEL="hdc", MODE="0666" brw-rw-rw- 1 root disk 22, 0 Feb 5 14:08 /dev/hdc --- namedev.c | 61 +++++++++++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/namedev.c b/namedev.c index 26c68fadf6..0c5d0509f9 100644 --- a/namedev.c +++ b/namedev.c @@ -670,7 +670,6 @@ try_parent: dbg("sysfs_device->path='%s'", sysfs_device->path); dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); } - } int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_dev) @@ -716,32 +715,32 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d list_for_each_entry(dev, &config_device_list, node) { dbg("process rule"); if (match_rule(udev, dev, class_dev, sysfs_device) == 0) { - if (dev->name[0] == '\0' && dev->symlink[0] == '\0') { - /* empty name, symlink, perms will not create any node */ - if (dev->mode == 0000 && dev->owner[0] == '\0' && dev->group[0] == '\0') { - info("configured rule in '%s[%i]' applied, '%s' is ignored", - dev->config_file, dev->config_line, udev->kernel_name); - return -1; - } - /* apply permissions only rule values */ - if (dev->mode != 0000) { - udev->mode = dev->mode; - dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name); - } - if (dev->owner[0] != '\0') { - strfieldcpy(udev->owner, dev->owner); - apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); - dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name); - } - if (dev->group[0] != '\0') { - strfieldcpy(udev->group, dev->group); - apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); - dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); - } + /* empty name, symlink and perms will not create any node */ + if (dev->name[0] == '\0' && dev->symlink[0] == '\0' && + dev->mode == 0000 && dev->owner[0] == '\0' && dev->group[0] == '\0') { + info("configured rule in '%s[%i]' applied, '%s' is ignored", + dev->config_file, dev->config_line, udev->kernel_name); + return -1; } - /* collect symlinks for the final matching rule */ + /* apply permissions */ + if (dev->mode != 0000) { + udev->mode = dev->mode; + dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name); + } + if (dev->owner[0] != '\0') { + strfieldcpy(udev->owner, dev->owner); + apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); + dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name); + } + if (dev->group[0] != '\0') { + strfieldcpy(udev->group, dev->group); + apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); + dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); + } + + /* collect symlinks for this or the final matching rule */ if (dev->symlink[0] != '\0') { char temp[NAME_SIZE]; @@ -774,19 +773,9 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d goto exit; udev->partitions = dev->partitions; - if (dev->mode != 0000) - udev->mode = dev->mode; - if (dev->owner[0] != '\0') { - strfieldcpy(udev->owner, dev->owner); - apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); - } - if (dev->group[0] != '\0') { - strfieldcpy(udev->group, dev->group); - apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); - } - dbg("name, '%s' is going to have owner='%s', group='%s', mode = %#o", - udev->name, udev->owner, udev->group, udev->mode); + dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", + udev->name, udev->owner, udev->group, udev->mode, udev->partitions); goto exit; } -- cgit v1.2.3-54-g00ecf From c7a84d7556531f93c7f47f2bd9c820418cdad5d9 Mon Sep 17 00:00:00 2001 From: "sschweizer@gmail.com" Date: Sun, 6 Feb 2005 00:41:53 +0100 Subject: [PATCH] gentoo/udev.rules: add default permissions for sound devices --- etc/udev/gentoo/udev.rules | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 7f708b631f..b5f23902cb 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -12,6 +12,9 @@ # ########################################################### +# all block devices +SUBSYSTEM="block", GROUP="disk" + # cdrom symlinks and other good cdrom naming BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" @@ -32,6 +35,7 @@ KERNEL="nvidia*", NAME="%k", GROUP="video" KERNEL="3dfx*", NAME="%k", GROUP="video" # alsa devices +SUBSYSTEM="sound", GROUP="audio" KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hw[CD0-9]*", NAME="snd/%k" KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" @@ -212,9 +216,6 @@ KERNEL="diskonkey*", NAME="%k", GROUP="disk" # rem_ide devices KERNEL="microdrive*", NAME="%k", GROUP="disk" -# all block devices -SUBSYSTEM="block", NAME="%k", GROUP="disk" - # kbd devices KERNEL="kbd", NAME="%k", MODE="0664" -- cgit v1.2.3-54-g00ecf From 0c50db890e838b6fa21708836af93ea736fc047d Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Sun, 6 Feb 2005 01:00:04 +0100 Subject: [PATCH] cdsymlinks.sh: trivial fix, the variable is initialized to '', not 0 --- extras/cdsymlinks.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/cdsymlinks.sh b/extras/cdsymlinks.sh index e99be2e544..b2702e0063 100644 --- a/extras/cdsymlinks.sh +++ b/extras/cdsymlinks.sh @@ -159,7 +159,7 @@ output () { COUNT=$(($COUNT+1)) done # If the target dev ($1) is the current dev ($i), we output its name. - if test $(($NUMBERED_LINKS)) -ne 0 || test "$COUNT" -eq 0; then + if test $(($NUMBERED_LINKS)) -ne 0 || test "$COUNT" = ''; then test "$i" = "$1" && echo -n " $2$COUNT" fi # If the link isn't in our "existing links" list, add it and increment -- cgit v1.2.3-54-g00ecf From fd3eeb7502d9ed52569bdb3e01a50ecbc132035e Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Sun, 6 Feb 2005 01:01:29 +0100 Subject: [PATCH] scsi_id: when udevstart is started, /tmp is not writeable. --- extras/scsi_id/scsi_id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index d2155e6866..f45563d1b3 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -44,8 +44,8 @@ /* * temporary names for mknod. */ -#define TMP_DIR "/tmp" -#define TMP_PREFIX "scsi" +#define TMP_DIR "/dev" +#define TMP_PREFIX "tmp-scsi" /* * XXX Note the 'e' (send output to stderr in all cases), and 'c' (callout) -- cgit v1.2.3-54-g00ecf From 882b97455b4f8e3859abc6e6357b0e233cf4a0c8 Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Sun, 6 Feb 2005 01:07:13 +0100 Subject: [PATCH] raid-devfs.sh: devfs names for hardware RAID controllers --- extras/raid-devfs.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 extras/raid-devfs.sh diff --git a/extras/raid-devfs.sh b/extras/raid-devfs.sh new file mode 100644 index 0000000000..796232b497 --- /dev/null +++ b/extras/raid-devfs.sh @@ -0,0 +1,50 @@ +#!/bin/sh -e +# +# Copyright (c) 2004 Marco d'Itri +# Copyright (c) 2004 Piotr Roszatycki +# +# Usage: +# KERNEL="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" +# KERNEL="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" +# KERNEL="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" + +get_dev_number_cciss() { + grep '^cciss/' /proc/driver/cciss/* | cat -n | \ + sed -n "/cciss\/$1:/s/cciss.*//p" +} + +get_dev_number_ida() { + grep '^ida/' /proc/driver/cpqarray/* | cat -n | \ + sed -n "/ida\/$1:/s/ida.*//p" +} + +get_dev_number_rd() { + grep '^ */dev/rd/' /proc/rd/*/initial_status | cat -n | \ + sed -n "/rd\/$1:/s/\/dev\/rd.*//p" +} + +get_dev_number() { + dev=$1 + num=$(eval $(echo get_dev_number_$TYPE $dev)) + [ "$num" ] || exit 1 + echo $(($num - 1)) +} + +TYPE=${1%%/*} +NAME=${1#*/} + +# abort if there was no match +[ "$TYPE" != "$1" ] || exit 1 + +case "$NAME" in + *p*) + LONG_NAME=disc$(get_dev_number ${NAME%%p*})/part${NAME##*p} + ;; + *) + LONG_NAME=disc$(get_dev_number $NAME)/disc + ;; +esac + +echo "$TYPE/$LONG_NAME" +exit 0 + -- cgit v1.2.3-54-g00ecf From 36429eef378dd5666eca49a21460e7b61f0b61f3 Mon Sep 17 00:00:00 2001 From: "md@Linux.IT" Date: Sun, 6 Feb 2005 01:08:31 +0100 Subject: [PATCH] debian: update rules files --- etc/udev/debian/devfs.rules | 179 +++++++++++++++++++++++++++------------ etc/udev/debian/udev.permissions | 121 -------------------------- etc/udev/debian/udev.rules | 107 +++++++++++++++++------ 3 files changed, 209 insertions(+), 198 deletions(-) delete mode 100644 etc/udev/debian/udev.permissions diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index 8d305cd657..cffef1a2e2 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -13,74 +13,152 @@ # %% the '%' char itself. # -# IDE block devices -BUS="ide", KERNEL="hd[a-z]*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" - -# permissions for SCSI CD devices -BUS="scsi", KERNEL="s[grt][0-9]*", SYSFS{type}="5", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}", MODE="0660", GROUP="cdrom" - -# SCSI block devices -BUS="scsi", KERNEL="sd[a-z]", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="sd[a-z][0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="sd[a-i][a-z]", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="sd[a-i][a-z][0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="s[grt][0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="st[0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="nst[0-9]*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", NAME="%c{1}", SYMLINK="%k %c{2}" +# default permissions for block devices +SUBSYSTEM="block", GROUP="disk" +SUBSYSTEM="block", SYSFS{removable}="1", GROUP="floppy" + +# workaround for devices which do not report media changes +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ + PROGRAM="/bin/cat /proc/ide/%k/model", RESULT="IOMEGA ZIP *", \ + NAME{all_partitions}="%k%n", GROUP="floppy" + +# IDE devices +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ + PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", \ + GROUP="cdrom" +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ + PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", \ + GROUP="floppy" +BUS="ide", KERNEL="hd[a-z]*", \ + PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="ide", KERNEL="ht[0-9]*", GROUP="tape" +BUS="ide", KERNEL="nht[0-9]*", GROUP="tape" + +# SCSI devices +BUS="scsi", KERNEL="sd[a-z]", \ + PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="sd[a-z][0-9]*", \ + PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="sd[a-i][a-z]", \ + PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="sd[a-i][a-z][0-9]*", \ + PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="s[gr][0-9]*", SYSFS{type}="5", \ + PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}", GROUP="cdrom" +BUS="scsi", KERNEL="sr[0-9]*", \ + PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}", GROUP="cdrom" +BUS="scsi", KERNEL="sg[0-9]*", \ + PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}" +BUS="scsi", KERNEL="st[0-9]*", \ + PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}", GROUP="tape" +BUS="scsi", KERNEL="nst[0-9]*", \ + PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}", GROUP="tape" + +# RAID controllers +KERNEL="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ + NAME="%c{1}", SYMLINK="%k" +KERNEL="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ + NAME="%c{1}", SYMLINK="%k" +KERNEL="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ + NAME="%c{1}", SYMLINK="%k" + +# other block devices +KERNEL="md[0-9]*", NAME="md/%n", +KERNEL="loop[0-9]*", NAME="loop/%n" +KERNEL="ram[0-9]*", NAME="rd/%n" # USB devices BUS="usb", KERNEL="hiddev*", NAME="usb/%k" -BUS="usb", KERNEL="auer*", NAME="usb/%k" -BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" +BUS="usb", KERNEL="auer[0-9]*", NAME="usb/%k" +BUS="usb", KERNEL="legousbtower*", NAME="usb/%k", MODE="0666" BUS="usb", KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" +BUS="usb", KERNEL="ttyUSB*", SYSFS{product}="Palm Handheld*", SYMLINK="pilot" -# block devices -KERNEL="md[0-9]*", NAME="md/%n", -KERNEL="loop[0-9]*", NAME="loop/%n" - -# tty devices -KERNEL="tty[0-9]*", NAME="vc/%n" +# serial devices +SUBSYSTEM="tty", GROUP="dialout" KERNEL="ttyS[0-9]*", NAME="tts/%n" KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" -KERNEL="rfcomm[0-9]*", NAME="bluetooth/rfcomm/%n" +KERNEL="rfcomm[0-9]*", NAME="bluetooth/rfcomm/%n", +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi[0-9]*", NAME="capi/%n" # vc devices +KERNEL="ptmx", MODE="0666" +KERNEL="tty", MODE="0666" +KERNEL="tty[0-9]*", NAME="vc/%n" KERNEL="vcs", NAME="vcc/0" KERNEL="vcs[0-9]*", NAME="vcc/%n" KERNEL="vcsa", NAME="vcc/a0" KERNEL="vcsa[0-9]*", NAME="vcc/a%n" -KERNEL="fb[0-9]*", NAME="fb/%n", -# v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n" -KERNEL="radio[0-9]*", NAME="v4l/radio%n" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" +# video devices +SUBSYSTEM="video4linux", GROUP="video" +KERNEL="video[0-9]*", NAME="v4l/%k" +KERNEL="radio[0-9]*", NAME="v4l/%k" +KERNEL="vbi[0-9]*", NAME="v4l/%k" +KERNEL="vtx[0-9]*", NAME="v4l/%k" +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ + NAME="%c", GROUP="video" +KERNEL="fb[0-9]*", NAME="fb/%n", GROUP="video" +KERNEL="nvidia*", GROUP="video" +KERNEL="card[0-9]*", NAME="dri/%k", GROUP="video" # misc devices -KERNEL="apm_bios", NAME="misc/apm_bios", -KERNEL="agpgart", NAME="misc/agpgart", -KERNEL="nvram", NAME="misc/nvram" -KERNEL="psaux", NAME="misc/psaux" -KERNEL="rtc", NAME="misc/rtc" +KERNEL="random", MODE="0666" +KERNEL="urandom", MODE="0444" +KERNEL="mem", MODE="0640", GROUP="kmem" +KERNEL="kmem", MODE="0640", GROUP="kmem" +KERNEL="port", MODE="0640", GROUP="kmem" +KERNEL="full", MODE="0666" +KERNEL="null", MODE="0666" +KERNEL="zero", MODE="0666" +KERNEL="inotify", MODE="0666" +KERNEL="sgi_fetchop", MODE="0666" +KERNEL="sonypi", MODE="0666" +KERNEL="apm_bios", NAME="misc/%k", +KERNEL="agpgart", NAME="misc/%k", GROUP="video" +KERNEL="nvram", NAME="misc/%k", GROUP="nvram" +KERNEL="psaux", NAME="misc/%k" +KERNEL="rtc", NAME="misc/%k", MODE="0644", GROUP="audio" +KERNEL="hw_random", NAME="hwrng" + +# printers and parallel devices +SUBSYSTEM="printer", GROUP="lp" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" +KERNEL="lp[0-9]*", NAME="printers/%n" +KERNEL="pt[0-9]*", GROUP="tape" +KERNEL="pht[0-9]*", GROUP="tape" -KERNEL="card[0-9]*", NAME="dri/card%n" KERNEL="i2c-[0-9]*", NAME="i2c/%n" -KERNEL="ram[0-9]*", NAME="rd/%n" -KERNEL="lp[0-9]*", NAME="printers/%n" -KERNEL="fd[0-9]*", NAME="floppy/%n", -KERNEL="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL="pktcdvd", NAME="pktcdvd/control" +KERNEL="fd[0-9]*", NAME="floppy/%n", GROUP="floppy" + +KERNEL="cdemu[0-9]*", NAME="cdemu/%n", GROUP="cdrom" +KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n", GROUP="cdrom" +KERNEL="pktcdvd", NAME="pktcdvd/control", MODE="0644" + KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" KERNEL="msr[0-9]*", NAME="cpu/%n/msr" KERNEL="microcode", NAME="cpu/microcode" +KERNEL="umad*", NAME="infiniband/%k" +KERNEL="issm*", NAME="infiniband/%k" + +KERNEL="tap[0-9]*", NAME="net/%k" +KERNEL="tun", NAME="net/%k" + # sound devices +SUBSYSTEM="sound", GROUP="audio" KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hwC[D0-9]*", NAME="snd/%k" KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" @@ -100,19 +178,14 @@ KERNEL="admmidi*", NAME="sound/%k" # input devices KERNEL="mice", NAME="input/%k" KERNEL="mouse[0-9]*", NAME="input/%k" -KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", MODE="0664", GROUP="video" +KERNEL="event[0-9]*", NAME="input/%k", \ + PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", \ + MODE="0664", GROUP="video" KERNEL="event[0-9]*", NAME="input/%k" -KERNEL="js[0-9]*", NAME="input/%k" +KERNEL="js[0-9]*", NAME="input/%k", MODE="0664" KERNEL="ts[0-9]*", NAME="input/%k" KERNEL="uinput", NAME="input/%k" -KERNEL="tap[0-9]*", NAME="net/%k" -KERNEL="tun", NAME="net/%k" - -# CAPI devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi[0-9]*", NAME="capi/%n" - # Zaptel KERNEL="zapctl", NAME="zap/ctl" KERNEL="zaptimer", NAME="zap/timer" diff --git a/etc/udev/debian/udev.permissions b/etc/udev/debian/udev.permissions deleted file mode 100644 index 6429519eec..0000000000 --- a/etc/udev/debian/udev.permissions +++ /dev/null @@ -1,121 +0,0 @@ -# name:user:group:mode - -# character devices - -ptmx:root:tty:0666 -random:root:root:0666 -urandom:root:root:0444 -kmem:root:kmem:0640 -mem:root:kmem:0640 -port:root:kmem:0640 -null:root:root:0666 -zero:root:root:0666 -full:root:root:0666 - -misc/nvram:root:nvram:660 -nvram:root:nvram:660 -misc/rtc:root:audio:0664 -rtc:root:audio:0664 - -tts/*:root:dialout:0660 -bluetooth/rfcomm/*:root:dialout:0660 -tty[BCDEFHILMPRSTUVWX][0-9]*:root:dialout:0660 -ttyS[ACIR][0-9]*:root:dialout:0660 -ttyUSB[0-9]*:root:dialout:0660 -ttyACM[0-9]*:root:dialout:0660 -ippp[0-9]*:root:dialout:0660 -isdn[0-9]*:root:dialout:0660 -isdnctrl[0-9]*:root:dialout:0660 -capi[0-9.]*:root:dialout:0660 -dcbri[0-9]*:root:dialout:0660 -ircomm[0-9]*:root:dialout:0660 -rfcomm[0-9]*:root:dialout:0660 -tty:root:tty:0666 - -snd/*:root:audio:0660 -sound/*:root:audio:0660 -admmidi*:root:audio:0660 -adsp*:root:audio:0660 -aload*:root:audio:0660 -amidi*:root:audio:0660 -amixer*:root:audio:0660 -audio*:root:audio:0660 -dmfm*:root:audio:0660 -dsp*:root:audio:0660 -audio*:root:audio:0660 -mixer*:root:audio:0660 -music:root:audio:0660 -sequencer*:root:audio:0660 - -printers/*:root:lp:0660 -usb/lp[0-9]*:root:lp:0660 -usb/legousbtower[0-9]*:root:root:666 -lp[0-9]*:root:lp:0660 -parport[0-9]*:root:lp:0660 -irlpt[0-9]*:root:lp:0660 -usblp[0-9]*:root:lp:0660 - -input/mice:root:root:0600 -input/mouse[0-9]*:root:root:0600 -input/js[0-9]*:root:root:0644 -input/*:root:root:0600 -mouse[0-9]*:root:root:0600 -js[0-9]*:root:root:0644 - -dri/card[0-9]*:root:video:0660 -fb/*:root:video:0660 -fb[0-9]*:root:video:0660 -agpgart:root:video:0660 -nvidia*:root:video:0660 - -v4l/*:root:video:0660 -video[0-9]*:root:video:0660 -radio[0-9]*:root:video:0660 -vbi[0-9]*:root:video:0660 -vtx[0-9]*:root:video:0660 -dvb/*:root:video:0660 - -# block devices - -floppy/*:root:floppy:0660 -fd[0-9]*:root:floppy:0660 -cdemu/*:root:cdrom:0660 -pktcdvd[0-9]*:root:cdrom:0660 - -ram[0-9]*:root:disk:0660 -raw/*:root:disk:0660 - -ide/*/cd:root:cdrom:0660 -ide/*:root:disk:0660 -hd[a-s]:root:disk:0660 -hd[a-s][0-9]*:root:disk:0660 - -scsi/*/cd:root:cdrom:0660 -scsi/*:root:disk:0660 -sd[a-z]:root:disk:0660 -sd[a-z][0-9]*:root:disk:0660 -sd[a-i][a-z]:root:disk:0660 -sd[a-i][a-z][0-9]*:root:disk:0660 -s[gr][0-9]*:root:disk:0660 -scd[0-9]*:root:cdrom:0660 - -dasd[0-9]*:root:disk:0660 -ataraid[0-9]*:root:disk:0660 - -loop/*:root:disk:0660 -loop[0-9]*:root:disk:0660 -md/*:root:disk:0660 -md[0-9]*:root:disk:0660 -dm-*:root:disk:0640 - -ht[0-9]*:root:tape:0660 -nht[0-9]*:root:tape:0660 -pt[0-9]*:root:tape:0660 -npt[0-9]*:root:tape:0660 -st[0-9]*:root:tape:0660 -nst[0-9]*:root:tape:0660 - -sgi_fetchop:root:root:666 -iseries/vcd*:root:disk:660 -iseries/vd*:root:disk:660 - diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index 65a89ae593..0f7aeb73d4 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -13,36 +13,100 @@ # %% the '%' char itself. # -# permissions for IDE CD devices -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", MODE="0660", GROUP="cdrom" +# default permissions for block devices +SUBSYSTEM="block", GROUP="disk" +SUBSYSTEM="block", SYSFS{removable}="1", GROUP="floppy" -# permissions for IDE floppy devices -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", NAME="%k", MODE="0660", GROUP="floppy" +# workaround for devices which do not report media changes +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ + PROGRAM="/bin/cat /proc/ide/%k/model", RESULT="IOMEGA ZIP *", \ + NAME{all_partitions}="%k%n", GROUP="floppy" -# permissions for SCSI CD devices -BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5", NAME="scd%n", MODE="0660", GROUP="cdrom", SYMLINK="sr%n" -BUS="scsi", KERNEL="sg[0-9]*", SYSFS{type}="5", NAME="%k", MODE="0660", GROUP="cdrom" +# IDE devices +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ + PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", \ + GROUP="cdrom" +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ + PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", \ + GROUP="floppy" +BUS="ide", KERNEL="ht[0-9]*", GROUP="tape" +BUS="ide", KERNEL="nht[0-9]*", GROUP="tape" +# SCSI devices +BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5", \ + NAME="scd%n", SYMLINK="sr%n", GROUP="cdrom" +BUS="scsi", KERNEL="sg[0-9]*", SYSFS{type}="5", GROUP="cdrom" +BUS="scsi", KERNEL="st[0-9]*", GROUP="tape" +BUS="scsi", KERNEL="nst[0-9]*", GROUP="tape" +BUS="scsi", KERNEL="osst[0-9]*", GROUP="tape" +BUS="scsi", KERNEL="nosst[0-9]*", GROUP="tape" # USB devices BUS="usb", KERNEL="hiddev*", NAME="usb/%k" -BUS="usb", KERNEL="auer*", NAME="usb/%k" -BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" +BUS="usb", KERNEL="auer[0-9]*", NAME="usb/%k" +BUS="usb", KERNEL="legousbtower*", NAME="usb/%k", MODE="0666" BUS="usb", KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" +BUS="usb", KERNEL="ttyUSB*", SYSFS{product}="Palm Handheld*", SYMLINK="pilot" -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" +# serial devices +SUBSYSTEM="tty", GROUP="dialout" +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi[0-9]*", NAME="capi/%n" + +# vc devices +KERNEL="ptmx", MODE="0666" +KERNEL="tty", MODE="0666" + +# video devices +SUBSYSTEM="video4linux", GROUP="video" +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ + NAME="%c", GROUP="video" +KERNEL="fb[0-9]*", GROUP="video" +KERNEL="nvidia*", GROUP="video" +KERNEL="card[0-9]*", NAME="dri/%k", GROUP="video" + +# misc devices +KERNEL="random", MODE="0666" +KERNEL="urandom", MODE="0444" +KERNEL="mem", MODE="0640", GROUP="kmem" +KERNEL="kmem", MODE="0640", GROUP="kmem" +KERNEL="port", MODE="0640", GROUP="kmem" +KERNEL="full", MODE="0666" +KERNEL="null", MODE="0666" +KERNEL="zero", MODE="0666" +KERNEL="inotify", MODE="0666" +KERNEL="sgi_fetchop", MODE="0666" +KERNEL="sonypi", MODE="0666" +KERNEL="agpgart", GROUP="video" +KERNEL="nvram", GROUP="nvram" +KERNEL="rtc", MODE="0664", GROUP="audio" +KERNEL="hw_random", NAME="hwrng" + +# printers and parallel devices +SUBSYSTEM="printer", GROUP="lp" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" +KERNEL="pt[0-9]*", GROUP="tape" +KERNEL="pht[0-9]*", GROUP="tape" + +KERNEL="fd[0-9]*", GROUP="floppy" + +KERNEL="cdemu[0-9]*", NAME="cdemu/%n", GROUP="cdrom" +KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n", GROUP="cdrom" +KERNEL="pktcdvd", NAME="pktcdvd/control", MODE="0644" -KERNEL="card*", NAME="dri/card%n" -KERNEL="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL="pktcdvd", NAME="pktcdvd/control" KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" KERNEL="msr[0-9]*", NAME="cpu/%n/msr" KERNEL="microcode", NAME="cpu/microcode" +KERNEL="umad*", NAME="infiniband/%k" +KERNEL="issm*", NAME="infiniband/%k" + +KERNEL="tap[0-9]*", NAME="net/%k" +KERNEL="tun", NAME="net/%k" + # ALSA devices +SUBSYSTEM="sound", GROUP="audio" KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hwC[D0-9]*", NAME="snd/%k" KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" @@ -53,19 +117,14 @@ KERNEL="seq", NAME="snd/%k" # input devices KERNEL="mice", NAME="input/%k" KERNEL="mouse[0-9]*", NAME="input/%k" -KERNEL="event[0-9]*", NAME="input/%k", PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", MODE="0664", GROUP="video" +KERNEL="event[0-9]*", NAME="input/%k", \ + PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", \ + MODE="0664", GROUP="video" KERNEL="event[0-9]*", NAME="input/%k" -KERNEL="js[0-9]*", NAME="input/%k" +KERNEL="js[0-9]*", NAME="input/%k", MODE="0664" KERNEL="ts[0-9]*", NAME="input/%k" KERNEL="uinput", NAME="input/%k" -KERNEL="tap[0-9]*", NAME="net/%k" -KERNEL="tun", NAME="net/%k" - -# CAPI devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi[0-9]*", NAME="capi/%n" - # Zaptel KERNEL="zapctl", NAME="zap/ctl" KERNEL="zaptimer", NAME="zap/timer" -- cgit v1.2.3-54-g00ecf From 85925517e67b85c94180b1de5e2cbd6a1c67c54c Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Sun, 6 Feb 2005 01:39:25 +0100 Subject: [PATCH] trivial: fix signedness We are already using %u in the sscanf() format string. The patch replaces the int for the kernel release number with unsigned int, as we can never have negative release numbers. --- udev_utils.c | 8 ++++---- udev_utils.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/udev_utils.c b/udev_utils.c index 3c5344a8f9..364037f7a9 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -62,11 +62,11 @@ void udev_init_device(struct udevice *udev, const char* devpath, const char *sub strcpy(udev->group, "root"); } -int kernel_release_satisfactory(int version, int patchlevel, int sublevel) +int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel) { - static int kversion = 0; - static int kpatchlevel; - static int ksublevel; + static unsigned int kversion = 0; + static unsigned int kpatchlevel; + static unsigned int ksublevel; if (kversion == 0) { struct utsname uts; diff --git a/udev_utils.h b/udev_utils.h index cc9dd704de..5d2c9c580c 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -77,7 +77,7 @@ do { \ #endif extern void udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); -extern int kernel_release_satisfactory(int version, int patchlevel, int sublevel); +extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); extern int create_path(const char *path); extern int parse_get_pair(char **orig_string, char **left, char **right); extern int file_map(const char *filename, char **buf, size_t *bufsize); -- cgit v1.2.3-54-g00ecf From e39515ac1fd303c0263ee4bc91f2d7699617d0bf Mon Sep 17 00:00:00 2001 From: "mbuesch@freenet.de" Date: Sun, 6 Feb 2005 03:23:43 +0100 Subject: [PATCH] trivial: remove _all_ trailing slashes with no_trailing_slash() This changes no_trailing_slash() to remove all trailing slashes and not just the last one. --- udev_utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev_utils.c b/udev_utils.c index 364037f7a9..5b0355d0e9 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -200,11 +200,11 @@ size_t buf_get_line(const char *buf, size_t buflen, size_t cur) void no_trailing_slash(char *path) { - int len; + size_t len; len = strlen(path); - if (len > 0 && path[len-1] == '/') - path[len-1] = '\0'; + while (len > 0 && path[len-1] == '/') + path[--len] = '\0'; } struct files { -- cgit v1.2.3-54-g00ecf From 9d4791b66a7756421fc699be51a7be68a5aed329 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 9 Feb 2005 01:02:18 +0100 Subject: [PATCH] udev_volume_id: volume_id version 034 --- extras/volume_id/Makefile | 45 +--- extras/volume_id/volume_id/Makefile.inc | 48 ++++ extras/volume_id/volume_id/cramfs/cramfs.c | 2 + extras/volume_id/volume_id/dasd/dasd.c | 5 +- extras/volume_id/volume_id/ext/ext.c | 40 +-- extras/volume_id/volume_id/fat/fat.c | 2 + extras/volume_id/volume_id/hfs/hfs.c | 216 ++++++++-------- extras/volume_id/volume_id/highpoint/highpoint.c | 16 +- extras/volume_id/volume_id/hpfs/hpfs.c | 69 +++++ extras/volume_id/volume_id/hpfs/hpfs.h | 26 ++ extras/volume_id/volume_id/iso9660/iso9660.c | 36 +-- extras/volume_id/volume_id/jfs/jfs.c | 28 ++- extras/volume_id/volume_id/linux_raid/linux_raid.c | 40 +-- extras/volume_id/volume_id/linux_swap/linux_swap.c | 20 +- extras/volume_id/volume_id/lvm/lvm.c | 32 ++- extras/volume_id/volume_id/mac/mac.c | 36 +-- extras/volume_id/volume_id/msdos/msdos.c | 29 ++- extras/volume_id/volume_id/ntfs/ntfs.c | 118 ++++----- extras/volume_id/volume_id/reiserfs/reiserfs.c | 34 +-- extras/volume_id/volume_id/romfs/romfs.c | 73 ++++++ extras/volume_id/volume_id/romfs/romfs.h | 26 ++ extras/volume_id/volume_id/sysv/sysv.c | 146 +++++++++++ extras/volume_id/volume_id/sysv/sysv.h | 26 ++ extras/volume_id/volume_id/udf/udf.c | 70 +++--- extras/volume_id/volume_id/ufs/ufs.c | 277 +++++++++++---------- extras/volume_id/volume_id/util.h | 4 + extras/volume_id/volume_id/volume_id.c | 8 + extras/volume_id/volume_id/volume_id.h | 2 +- extras/volume_id/volume_id/xfs/xfs.c | 32 +-- 29 files changed, 974 insertions(+), 532 deletions(-) create mode 100644 extras/volume_id/volume_id/Makefile.inc create mode 100644 extras/volume_id/volume_id/hpfs/hpfs.c create mode 100644 extras/volume_id/volume_id/hpfs/hpfs.h create mode 100644 extras/volume_id/volume_id/romfs/romfs.c create mode 100644 extras/volume_id/volume_id/romfs/romfs.h create mode 100644 extras/volume_id/volume_id/sysv/sysv.c create mode 100644 extras/volume_id/volume_id/sysv/sysv.h diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index bfe4cf74af..9c274212a6 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -30,49 +30,8 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM} override CFLAGS+=-D_FILE_OFFSET_BITS=64 -VOLUME_ID_OBJS= \ - volume_id/ext/ext.o \ - volume_id/fat/fat.o \ - volume_id/hfs/hfs.o \ - volume_id/highpoint/highpoint.o \ - volume_id/iso9660/iso9660.o \ - volume_id/jfs/jfs.o \ - volume_id/linux_raid/linux_raid.o \ - volume_id/linux_swap/linux_swap.o \ - volume_id/lvm/lvm.o \ - volume_id/mac/mac.o \ - volume_id/msdos/msdos.o \ - volume_id/ntfs/ntfs.o \ - volume_id/reiserfs/reiserfs.o \ - volume_id/udf/udf.o \ - volume_id/ufs/ufs.o \ - volume_id/xfs/xfs.o \ - volume_id/cramfs/cramfs.o \ - volume_id/dasd/dasd.o \ - volume_id/volume_id.o \ - volume_id/util.o - -VOLUME_ID_HEADERS= \ - volume_id/ext/ext.h \ - volume_id/fat/fat.h \ - volume_id/hfs/hfs.h \ - volume_id/highpoint/highpoint.h \ - volume_id/iso9660/iso9660.h \ - volume_id/jfs/jfs.h \ - volume_id/linux_raid/linux_raid.h \ - volume_id/linux_swap/linux_swap.h \ - volume_id/lvm/lvm.h \ - volume_id/mac/mac.h \ - volume_id/msdos/msdos.h \ - volume_id/ntfs/ntfs.h \ - volume_id/reiserfs/reiserfs.h \ - volume_id/udf/udf.h \ - volume_id/ufs/ufs.h \ - volume_id/xfs/xfs.h \ - volume_id/cramfs/cramfs.h \ - volume_id/dasd/dasd.h \ - volume_id/volume_id.h \ - volume_id/util.h +VOLUME_ID_BASE=volume_id +include $(VOLUME_ID_BASE)/Makefile.inc OBJS = udev_volume_id.o $(VOLUME_ID_OBJS) $(SYSFS) HEADERS = $(VOLUME_ID_HEADERS) diff --git a/extras/volume_id/volume_id/Makefile.inc b/extras/volume_id/volume_id/Makefile.inc new file mode 100644 index 0000000000..d010f7778e --- /dev/null +++ b/extras/volume_id/volume_id/Makefile.inc @@ -0,0 +1,48 @@ +VOLUME_ID_OBJS= \ + $(VOLUME_ID_BASE)/ext/ext.o \ + $(VOLUME_ID_BASE)/fat/fat.o \ + $(VOLUME_ID_BASE)/hfs/hfs.o \ + $(VOLUME_ID_BASE)/highpoint/highpoint.o \ + $(VOLUME_ID_BASE)/iso9660/iso9660.o \ + $(VOLUME_ID_BASE)/jfs/jfs.o \ + $(VOLUME_ID_BASE)/linux_raid/linux_raid.o \ + $(VOLUME_ID_BASE)/linux_swap/linux_swap.o \ + $(VOLUME_ID_BASE)/lvm/lvm.o \ + $(VOLUME_ID_BASE)/mac/mac.o \ + $(VOLUME_ID_BASE)/msdos/msdos.o \ + $(VOLUME_ID_BASE)/ntfs/ntfs.o \ + $(VOLUME_ID_BASE)/reiserfs/reiserfs.o \ + $(VOLUME_ID_BASE)/udf/udf.o \ + $(VOLUME_ID_BASE)/ufs/ufs.o \ + $(VOLUME_ID_BASE)/xfs/xfs.o \ + $(VOLUME_ID_BASE)/cramfs/cramfs.o \ + $(VOLUME_ID_BASE)/hpfs/hpfs.o \ + $(VOLUME_ID_BASE)/romfs/romfs.o \ + $(VOLUME_ID_BASE)/sysv/sysv.o \ + $(VOLUME_ID_BASE)/dasd/dasd.o \ + $(VOLUME_ID_BASE)/volume_id.o \ + $(VOLUME_ID_BASE)/util.o + +VOLUME_ID_HEADERS= \ + $(VOLUME_ID_BASE)/ext/ext.h \ + $(VOLUME_ID_BASE)/fat/fat.h \ + $(VOLUME_ID_BASE)/hfs/hfs.h \ + $(VOLUME_ID_BASE)/highpoint/highpoint.h \ + $(VOLUME_ID_BASE)/iso9660/iso9660.h \ + $(VOLUME_ID_BASE)/jfs/jfs.h \ + $(VOLUME_ID_BASE)/linux_raid/linux_raid.h \ + $(VOLUME_ID_BASE)/linux_swap/linux_swap.h \ + $(VOLUME_ID_BASE)/lvm/lvm.h \ + $(VOLUME_ID_BASE)/mac/mac.h \ + $(VOLUME_ID_BASE)/msdos/msdos.h \ + $(VOLUME_ID_BASE)/ntfs/ntfs.h \ + $(VOLUME_ID_BASE)/reiserfs/reiserfs.h \ + $(VOLUME_ID_BASE)/udf/udf.h \ + $(VOLUME_ID_BASE)/ufs/ufs.h \ + $(VOLUME_ID_BASE)/xfs/xfs.h \ + $(VOLUME_ID_BASE)/cramfs/cramfs.h \ + $(VOLUME_ID_BASE)/sysv/sysv.h \ + $(VOLUME_ID_BASE)/romfs/romfs.h \ + $(VOLUME_ID_BASE)/dasd/dasd.h \ + $(VOLUME_ID_BASE)/volume_id.h \ + $(VOLUME_ID_BASE)/util.h diff --git a/extras/volume_id/volume_id/cramfs/cramfs.c b/extras/volume_id/volume_id/cramfs/cramfs.c index 69ab2c7a44..a1d51f107d 100644 --- a/extras/volume_id/volume_id/cramfs/cramfs.c +++ b/extras/volume_id/volume_id/cramfs/cramfs.c @@ -58,6 +58,8 @@ int volume_id_probe_cramfs(struct volume_id *id, __u64 off) { struct cramfs_super *cs; + dbg("probing at offset %llu", off); + cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); if (cs == NULL) return -1; diff --git a/extras/volume_id/volume_id/dasd/dasd.c b/extras/volume_id/volume_id/dasd/dasd.c index 5623f69d36..4548190ce2 100644 --- a/extras/volume_id/volume_id/dasd/dasd.c +++ b/extras/volume_id/volume_id/dasd/dasd.c @@ -35,6 +35,7 @@ #include #include "../volume_id.h" +#include "../logging.h" #include "../util.h" #include "dasd.h" @@ -141,7 +142,7 @@ typedef struct dasd_information_t { unsigned int confdata_size; char characteristics[64]; /* from read_device_characteristics */ char configuration_data[256]; /* from read_configuration_data */ -} dasd_information_t; +} __attribute__((__packed__)) dasd_information_t; #define _IOC_NRBITS 8 #define _IOC_TYPEBITS 8 @@ -168,6 +169,8 @@ int volume_id_probe_dasd_partition(struct volume_id *id) __u8 *label_raw; unsigned char name[7]; + dbg("probing"); + if (ioctl(id->fd, BIODASDINFO, &info) != 0) return -1; diff --git a/extras/volume_id/volume_id/ext/ext.c b/extras/volume_id/volume_id/ext/ext.c index 50ffa85372..0940e452fc 100644 --- a/extras/volume_id/volume_id/ext/ext.c +++ b/extras/volume_id/volume_id/ext/ext.c @@ -39,30 +39,34 @@ #include "../logging.h" #include "ext.h" +struct ext2_super_block { + __u32 inodes_count; + __u32 blocks_count; + __u32 r_blocks_count; + __u32 free_blocks_count; + __u32 free_inodes_count; + __u32 first_data_block; + __u32 log_block_size; + __u32 dummy3[7]; + __u8 magic[2]; + __u16 state; + __u32 dummy5[8]; + __u32 feature_compat; + __u32 feature_incompat; + __u32 feature_ro_compat; + __u8 uuid[16]; + __u8 volume_name[16]; +} __attribute__((__packed__)); + #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 #define EXT_SUPERBLOCK_OFFSET 0x400 int volume_id_probe_ext(struct volume_id *id, __u64 off) { - struct ext2_super_block { - __u32 inodes_count; - __u32 blocks_count; - __u32 r_blocks_count; - __u32 free_blocks_count; - __u32 free_inodes_count; - __u32 first_data_block; - __u32 log_block_size; - __u32 dummy3[7]; - __u8 magic[2]; - __u16 state; - __u32 dummy5[8]; - __u32 feature_compat; - __u32 feature_incompat; - __u32 feature_ro_compat; - __u8 uuid[16]; - __u8 volume_name[16]; - } __attribute__((__packed__)) *es; + struct ext2_super_block *es; + + dbg("probing at offset %llu", off); es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); if (es == NULL) diff --git a/extras/volume_id/volume_id/fat/fat.c b/extras/volume_id/volume_id/fat/fat.c index 219207e81d..c6bb491f70 100644 --- a/extras/volume_id/volume_id/fat/fat.c +++ b/extras/volume_id/volume_id/fat/fat.c @@ -159,6 +159,8 @@ int volume_id_probe_vfat(struct volume_id *id, __u64 off) __u32 next; int maxloop; + dbg("probing at offset %llu", off); + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); if (vs == NULL) return -1; diff --git a/extras/volume_id/volume_id/hfs/hfs.c b/extras/volume_id/volume_id/hfs/hfs.c index a4ae86b56a..905471cb35 100644 --- a/extras/volume_id/volume_id/hfs/hfs.c +++ b/extras/volume_id/volume_id/hfs/hfs.c @@ -39,119 +39,119 @@ #include "../util.h" #include "hfs.h" +struct hfs_finder_info{ + __u32 boot_folder; + __u32 start_app; + __u32 open_folder; + __u32 os9_folder; + __u32 reserved; + __u32 osx_folder; + __u8 id[8]; +} __attribute__((__packed__)); + +struct hfs_mdb { + __u8 signature[2]; + __u32 cr_date; + __u32 ls_Mod; + __u16 atrb; + __u16 nm_fls; + __u16 vbm_st; + __u16 alloc_ptr; + __u16 nm_al_blks; + __u32 al_blk_size; + __u32 clp_size; + __u16 al_bl_st; + __u32 nxt_cnid; + __u16 free_bks; + __u8 label_len; + __u8 label[27]; + __u32 vol_bkup; + __u16 vol_seq_num; + __u32 wr_cnt; + __u32 xt_clump_size; + __u32 ct_clump_size; + __u16 num_root_dirs; + __u32 file_count; + __u32 dir_count; + struct hfs_finder_info finder_info; + __u8 embed_sig[2]; + __u16 embed_startblock; + __u16 embed_blockcount; +} __attribute__((__packed__)) *hfs; + +struct hfsplus_bnode_descriptor { + __u32 next; + __u32 prev; + __u8 type; + __u8 height; + __u16 num_recs; + __u16 reserved; +} __attribute__((__packed__)); + +struct hfsplus_bheader_record { + __u16 depth; + __u32 root; + __u32 leaf_count; + __u32 leaf_head; + __u32 leaf_tail; + __u16 node_size; +} __attribute__((__packed__)); + +struct hfsplus_catalog_key { + __u16 key_len; + __u32 parent_id; + __u16 unicode_len; + __u8 unicode[255 * 2]; +} __attribute__((__packed__)); + +struct hfsplus_extent { + __u32 start_block; + __u32 block_count; +} __attribute__((__packed__)); + +#define HFSPLUS_EXTENT_COUNT 8 +struct hfsplus_fork { + __u64 total_size; + __u32 clump_size; + __u32 total_blocks; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; +} __attribute__((__packed__)); + +struct hfsplus_vol_header { + __u8 signature[2]; + __u16 version; + __u32 attributes; + __u32 last_mount_vers; + __u32 reserved; + __u32 create_date; + __u32 modify_date; + __u32 backup_date; + __u32 checked_date; + __u32 file_count; + __u32 folder_count; + __u32 blocksize; + __u32 total_blocks; + __u32 free_blocks; + __u32 next_alloc; + __u32 rsrc_clump_sz; + __u32 data_clump_sz; + __u32 next_cnid; + __u32 write_count; + __u64 encodings_bmp; + struct hfs_finder_info finder_info; + struct hfsplus_fork alloc_file; + struct hfsplus_fork ext_file; + struct hfsplus_fork cat_file; + struct hfsplus_fork attr_file; + struct hfsplus_fork start_file; +} __attribute__((__packed__)) *hfsplus; + #define HFS_SUPERBLOCK_OFFSET 0x400 #define HFS_NODE_LEAF 0xff #define HFSPLUS_POR_CNID 1 -#define HFSPLUS_EXTENT_COUNT 8 int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) { - struct hfs_finder_info{ - __u32 boot_folder; - __u32 start_app; - __u32 open_folder; - __u32 os9_folder; - __u32 reserved; - __u32 osx_folder; - __u8 id[8]; - } __attribute__((__packed__)); - - struct hfs_mdb { - __u8 signature[2]; - __u32 cr_date; - __u32 ls_Mod; - __u16 atrb; - __u16 nm_fls; - __u16 vbm_st; - __u16 alloc_ptr; - __u16 nm_al_blks; - __u32 al_blk_size; - __u32 clp_size; - __u16 al_bl_st; - __u32 nxt_cnid; - __u16 free_bks; - __u8 label_len; - __u8 label[27]; - __u32 vol_bkup; - __u16 vol_seq_num; - __u32 wr_cnt; - __u32 xt_clump_size; - __u32 ct_clump_size; - __u16 num_root_dirs; - __u32 file_count; - __u32 dir_count; - struct hfs_finder_info finder_info; - __u8 embed_sig[2]; - __u16 embed_startblock; - __u16 embed_blockcount; - } __attribute__((__packed__)) *hfs; - - struct hfsplus_bnode_descriptor { - __u32 next; - __u32 prev; - __u8 type; - __u8 height; - __u16 num_recs; - __u16 reserved; - } __attribute__((__packed__)); - - struct hfsplus_bheader_record { - __u16 depth; - __u32 root; - __u32 leaf_count; - __u32 leaf_head; - __u32 leaf_tail; - __u16 node_size; - } __attribute__((__packed__)); - - struct hfsplus_catalog_key { - __u16 key_len; - __u32 parent_id; - __u16 unicode_len; - __u8 unicode[255 * 2]; - } __attribute__((__packed__)); - - struct hfsplus_extent { - __u32 start_block; - __u32 block_count; - } __attribute__((__packed__)); - - struct hfsplus_fork { - __u64 total_size; - __u32 clump_size; - __u32 total_blocks; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; - } __attribute__((__packed__)); - - struct hfsplus_vol_header { - __u8 signature[2]; - __u16 version; - __u32 attributes; - __u32 last_mount_vers; - __u32 reserved; - __u32 create_date; - __u32 modify_date; - __u32 backup_date; - __u32 checked_date; - __u32 file_count; - __u32 folder_count; - __u32 blocksize; - __u32 total_blocks; - __u32 free_blocks; - __u32 next_alloc; - __u32 rsrc_clump_sz; - __u32 data_clump_sz; - __u32 next_cnid; - __u32 write_count; - __u64 encodings_bmp; - struct hfs_finder_info finder_info; - struct hfsplus_fork alloc_file; - struct hfsplus_fork ext_file; - struct hfsplus_fork cat_file; - struct hfsplus_fork attr_file; - struct hfsplus_fork start_file; - } __attribute__((__packed__)) *hfsplus; - unsigned int blocksize; unsigned int cat_block; unsigned int ext_block_start; @@ -173,6 +173,8 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; const __u8 *buf; + dbg("probing at offset %llu", off); + buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) return -1; diff --git a/extras/volume_id/volume_id/highpoint/highpoint.c b/extras/volume_id/volume_id/highpoint/highpoint.c index 3236d6b2fd..b301450086 100644 --- a/extras/volume_id/volume_id/highpoint/highpoint.c +++ b/extras/volume_id/volume_id/highpoint/highpoint.c @@ -39,21 +39,23 @@ #include "../util.h" #include "highpoint.h" +struct hpt37x { + __u8 filler1[32]; + __u32 magic; + __u32 magic_0; + __u32 magic_1; +} __attribute__((packed)) *hpt; + #define HPT37X_CONFIG_OFF 0x1200 #define HPT37X_MAGIC_OK 0x5a7816f0 #define HPT37X_MAGIC_BAD 0x5a7816fd int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off) { - struct hpt37x { - __u8 filler1[32]; - __u32 magic; - __u32 magic_0; - __u32 magic_1; - } __attribute__((packed)) *hpt; - const __u8 *buf; + dbg("probing at offset %llu", off); + buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); if (buf == NULL) return -1; diff --git a/extras/volume_id/volume_id/hpfs/hpfs.c b/extras/volume_id/volume_id/hpfs/hpfs.c new file mode 100644 index 0000000000..212e74ee41 --- /dev/null +++ b/extras/volume_id/volume_id/hpfs/hpfs.c @@ -0,0 +1,69 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "hpfs.h" + +struct hpfs_super +{ + __u8 magic[4]; + __u8 version; +} __attribute__((__packed__)); + +#define HPFS_SUPERBLOCK_OFFSET 0x2000 + +int volume_id_probe_hpfs(struct volume_id *id, __u64 off) +{ + struct hpfs_super *hs; + + dbg("probing at offset %llu", off); + + hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); + if (hs == NULL) + return -1; + + if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) { + snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u", hs->version); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hpfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/volume_id/hpfs/hpfs.h b/extras/volume_id/volume_id/hpfs/hpfs.h new file mode 100644 index 0000000000..bd8d4c90c9 --- /dev/null +++ b/extras/volume_id/volume_id/hpfs/hpfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_HPFS_ +#define _VOLUME_ID_HPFS_ + +extern int volume_id_probe_hpfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/iso9660/iso9660.c b/extras/volume_id/volume_id/iso9660/iso9660.c index fa769d3ca3..1d7cfd5037 100644 --- a/extras/volume_id/volume_id/iso9660/iso9660.c +++ b/extras/volume_id/volume_id/iso9660/iso9660.c @@ -47,24 +47,28 @@ #define ISO_VD_END 0xff #define ISO_VD_MAX 16 +union iso_super_block { + struct iso_header { + __u8 type; + __u8 id[5]; + __u8 version; + __u8 unused1; + __u8 system_id[32]; + __u8 volume_id[32]; + } __attribute__((__packed__)) iso; + struct hs_header { + __u8 foo[8]; + __u8 type; + __u8 id[4]; + __u8 version; + } __attribute__((__packed__)) hs; +} __attribute__((__packed__)); + int volume_id_probe_iso9660(struct volume_id *id, __u64 off) { - union iso_super_block { - struct iso_header { - __u8 type; - __u8 id[5]; - __u8 version; - __u8 unused1; - __u8 system_id[32]; - __u8 volume_id[32]; - } __attribute__((__packed__)) iso; - struct hs_header { - __u8 foo[8]; - __u8 type; - __u8 id[4]; - __u8 version; - } __attribute__((__packed__)) hs; - } __attribute__((__packed__)) *is; + union iso_super_block *is; + + dbg("probing at offset %llu", off); is = (union iso_super_block *) volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); if (is == NULL) diff --git a/extras/volume_id/volume_id/jfs/jfs.c b/extras/volume_id/volume_id/jfs/jfs.c index c9dce84ecb..ab0b83081c 100644 --- a/extras/volume_id/volume_id/jfs/jfs.c +++ b/extras/volume_id/volume_id/jfs/jfs.c @@ -39,22 +39,26 @@ #include "../util.h" #include "jfs.h" +struct jfs_super_block { + __u8 magic[4]; + __u32 version; + __u64 size; + __u32 bsize; + __u32 dummy1; + __u32 pbsize; + __u32 dummy2[27]; + __u8 uuid[16]; + __u8 label[16]; + __u8 loguuid[16]; +} __attribute__((__packed__)); + #define JFS_SUPERBLOCK_OFFSET 0x8000 int volume_id_probe_jfs(struct volume_id *id, __u64 off) { - struct jfs_super_block { - __u8 magic[4]; - __u32 version; - __u64 size; - __u32 bsize; - __u32 dummy1; - __u32 pbsize; - __u32 dummy2[27]; - __u8 uuid[16]; - __u8 label[16]; - __u8 loguuid[16]; - } __attribute__((__packed__)) *js; + struct jfs_super_block *js; + + dbg("probing at offset %llu", off); js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); if (js == NULL) diff --git a/extras/volume_id/volume_id/linux_raid/linux_raid.c b/extras/volume_id/volume_id/linux_raid/linux_raid.c index b55c6ca6e8..ca03030ee4 100644 --- a/extras/volume_id/volume_id/linux_raid/linux_raid.c +++ b/extras/volume_id/volume_id/linux_raid/linux_raid.c @@ -39,34 +39,36 @@ #include "../util.h" #include "linux_raid.h" +struct mdp_super_block { + __u32 md_magic; + __u32 major_version; + __u32 minor_version; + __u32 patch_version; + __u32 gvalid_words; + __u32 set_uuid0; + __u32 ctime; + __u32 level; + __u32 size; + __u32 nr_disks; + __u32 raid_disks; + __u32 md_minor; + __u32 not_persistent; + __u32 set_uuid1; + __u32 set_uuid2; + __u32 set_uuid3; +} __attribute__((packed)) *mdp; + #define MD_RESERVED_BYTES 0x10000 #define MD_MAGIC 0xa92b4efc int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) { - struct mdp_super_block { - __u32 md_magic; - __u32 major_version; - __u32 minor_version; - __u32 patch_version; - __u32 gvalid_words; - __u32 set_uuid0; - __u32 ctime; - __u32 level; - __u32 size; - __u32 nr_disks; - __u32 raid_disks; - __u32 md_minor; - __u32 not_persistent; - __u32 set_uuid1; - __u32 set_uuid2; - __u32 set_uuid3; - } __attribute__((packed)) *mdp; - const __u8 *buf; __u64 sboff; __u8 uuid[16]; + dbg("probing at offset %llu", off); + if (size < 0x10000) return -1; diff --git a/extras/volume_id/volume_id/linux_swap/linux_swap.c b/extras/volume_id/volume_id/linux_swap/linux_swap.c index d34b22c590..2fb16377a8 100644 --- a/extras/volume_id/volume_id/linux_swap/linux_swap.c +++ b/extras/volume_id/volume_id/linux_swap/linux_swap.c @@ -39,22 +39,24 @@ #include "../util.h" #include "linux_swap.h" +struct swap_header_v1_2 { + __u8 bootbits[1024]; + __u32 version; + __u32 last_page; + __u32 nr_badpages; + __u8 uuid[16]; + __u8 volume_name[16]; +} __attribute__((__packed__)) *sw; + #define LARGEST_PAGESIZE 0x4000 int volume_id_probe_linux_swap(struct volume_id *id, __u64 off) { - struct swap_header_v1_2 { - __u8 bootbits[1024]; - __u32 version; - __u32 last_page; - __u32 nr_badpages; - __u8 uuid[16]; - __u8 volume_name[16]; - } __attribute__((__packed__)) *sw; - const __u8 *buf; unsigned int page; + dbg("probing at offset %llu", off); + /* the swap signature is at the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { buf = volume_id_get_buffer(id, off + page-10, 10); diff --git a/extras/volume_id/volume_id/lvm/lvm.c b/extras/volume_id/volume_id/lvm/lvm.c index e736f4ed4a..ed1a83aeb4 100644 --- a/extras/volume_id/volume_id/lvm/lvm.c +++ b/extras/volume_id/volume_id/lvm/lvm.c @@ -39,22 +39,33 @@ #include "../util.h" #include "lvm.h" +struct lvm1_super_block { + __u8 id[2]; +} __attribute__((packed)); + +struct lvm2_super_block { + __u8 id[8]; + __u64 sector_xl; + __u32 crc_xl; + __u32 offset_xl; + __u8 type[8]; +} __attribute__((packed)); + #define LVM1_SB_OFF 0x400 #define LVM1_MAGIC "HM" int volume_id_probe_lvm1(struct volume_id *id, __u64 off) { - struct lvm2_super_block { - __u8 id[2]; - } __attribute__((packed)) *lvm; - const __u8 *buf; + struct lvm1_super_block *lvm; + + dbg("probing at offset %llu", off); buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); if (buf == NULL) return -1; - lvm = (struct lvm2_super_block *) buf; + lvm = (struct lvm1_super_block *) buf; if (memcmp(lvm->id, LVM1_MAGIC, 2) != 0) return -1; @@ -70,16 +81,11 @@ int volume_id_probe_lvm1(struct volume_id *id, __u64 off) int volume_id_probe_lvm2(struct volume_id *id, __u64 off) { - struct lvm2_super_block { - __u8 id[8]; - __u64 sector_xl; - __u32 crc_xl; - __u32 offset_xl; - __u8 type[8]; - } __attribute__((packed)) *lvm; - const __u8 *buf; unsigned int soff; + struct lvm2_super_block *lvm; + + dbg("probing at offset %llu", off); buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); if (buf == NULL) diff --git a/extras/volume_id/volume_id/mac/mac.c b/extras/volume_id/volume_id/mac/mac.c index 5872b722b4..895316d26c 100644 --- a/extras/volume_id/volume_id/mac/mac.c +++ b/extras/volume_id/volume_id/mac/mac.c @@ -39,25 +39,29 @@ #include "../util.h" #include "mac.h" +struct mac_driver_desc { + __u8 signature[2]; + __u16 block_size; + __u32 block_count; +} __attribute__((__packed__)); + +struct mac_partition { + __u8 signature[2]; + __u16 res1; + __u32 map_count; + __u32 start_block; + __u32 block_count; + __u8 name[32]; + __u8 type[32]; +} __attribute__((__packed__)); + int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) { - struct mac_driver_desc { - __u8 signature[2]; - __u16 block_size; - __u32 block_count; - } __attribute__((__packed__)) *driver; - - struct mac_partition { - __u8 signature[2]; - __u16 res1; - __u32 map_count; - __u32 start_block; - __u32 block_count; - __u8 name[32]; - __u8 type[32]; - } __attribute__((__packed__)) *part; - const __u8 *buf; + struct mac_driver_desc *driver; + struct mac_partition *part; + + dbg("probing at offset %llu", off); buf = volume_id_get_buffer(id, off, 0x200); if (buf == NULL) diff --git a/extras/volume_id/volume_id/msdos/msdos.c b/extras/volume_id/volume_id/msdos/msdos.c index 08124fad2d..a90b9efc33 100644 --- a/extras/volume_id/volume_id/msdos/msdos.c +++ b/extras/volume_id/volume_id/msdos/msdos.c @@ -39,6 +39,19 @@ #include "../util.h" #include "msdos.h" +struct msdos_partition_entry { + __u8 boot_ind; + __u8 head; + __u8 sector; + __u8 cyl; + __u8 sys_ind; + __u8 end_head; + __u8 end_sector; + __u8 end_cyl; + __u32 start_sect; + __u32 nr_sects; +} __attribute__((packed)); + #define MSDOS_MAGIC "\x55\xaa" #define MSDOS_PARTTABLE_OFFSET 0x1be #define MSDOS_SIG_OFF 0x1fe @@ -56,19 +69,6 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) { - struct msdos_partition_entry { - __u8 boot_ind; - __u8 head; - __u8 sector; - __u8 cyl; - __u8 sys_ind; - __u8 end_head; - __u8 end_sector; - __u8 end_cyl; - __u32 start_sect; - __u32 nr_sects; - } __attribute__((packed)) *part; - const __u8 *buf; int i; __u64 poff; @@ -78,8 +78,11 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) __u64 next; int limit; int empty = 1; + struct msdos_partition_entry *part; struct volume_id_partition *p; + dbg("probing at offset %llu", off); + buf = volume_id_get_buffer(id, off, 0x200); if (buf == NULL) return -1; diff --git a/extras/volume_id/volume_id/ntfs/ntfs.c b/extras/volume_id/volume_id/ntfs/ntfs.c index bf87f9d8d0..e46bc64bb2 100644 --- a/extras/volume_id/volume_id/ntfs/ntfs.c +++ b/extras/volume_id/volume_id/ntfs/ntfs.c @@ -39,6 +39,64 @@ #include "../util.h" #include "ntfs.h" +struct ntfs_super_block { + __u8 jump[3]; + __u8 oem_id[8]; + __u16 bytes_per_sector; + __u8 sectors_per_cluster; + __u16 reserved_sectors; + __u8 fats; + __u16 root_entries; + __u16 sectors; + __u8 media_type; + __u16 sectors_per_fat; + __u16 sectors_per_track; + __u16 heads; + __u32 hidden_sectors; + __u32 large_sectors; + __u16 unused[2]; + __u64 number_of_sectors; + __u64 mft_cluster_location; + __u64 mft_mirror_cluster_location; + __s8 cluster_per_mft_record; + __u8 reserved1[3]; + __s8 cluster_per_index_record; + __u8 reserved2[3]; + __u8 volume_serial[8]; + __u16 checksum; +} __attribute__((__packed__)) *ns; + +struct master_file_table_record { + __u8 magic[4]; + __u16 usa_ofs; + __u16 usa_count; + __u64 lsn; + __u16 sequence_number; + __u16 link_count; + __u16 attrs_offset; + __u16 flags; + __u32 bytes_in_use; + __u32 bytes_allocated; +} __attribute__((__packed__)) *mftr; + +struct file_attribute { + __u32 type; + __u32 len; + __u8 non_resident; + __u8 name_len; + __u16 name_offset; + __u16 flags; + __u16 instance; + __u32 value_len; + __u16 value_offset; +} __attribute__((__packed__)) *attr; + +struct volume_info { + __u64 reserved; + __u8 major_ver; + __u8 minor_ver; +} __attribute__((__packed__)) *info; + #define MFT_RECORD_VOLUME 3 #define MFT_RECORD_ATTR_VOLUME_NAME 0x60 #define MFT_RECORD_ATTR_VOLUME_INFO 0x70 @@ -47,64 +105,6 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) { - struct ntfs_super_block { - __u8 jump[3]; - __u8 oem_id[8]; - __u16 bytes_per_sector; - __u8 sectors_per_cluster; - __u16 reserved_sectors; - __u8 fats; - __u16 root_entries; - __u16 sectors; - __u8 media_type; - __u16 sectors_per_fat; - __u16 sectors_per_track; - __u16 heads; - __u32 hidden_sectors; - __u32 large_sectors; - __u16 unused[2]; - __u64 number_of_sectors; - __u64 mft_cluster_location; - __u64 mft_mirror_cluster_location; - __s8 cluster_per_mft_record; - __u8 reserved1[3]; - __s8 cluster_per_index_record; - __u8 reserved2[3]; - __u8 volume_serial[8]; - __u16 checksum; - } __attribute__((__packed__)) *ns; - - struct master_file_table_record { - __u8 magic[4]; - __u16 usa_ofs; - __u16 usa_count; - __u64 lsn; - __u16 sequence_number; - __u16 link_count; - __u16 attrs_offset; - __u16 flags; - __u32 bytes_in_use; - __u32 bytes_allocated; - } __attribute__((__packed__)) *mftr; - - struct file_attribute { - __u32 type; - __u32 len; - __u8 non_resident; - __u8 name_len; - __u16 name_offset; - __u16 flags; - __u16 instance; - __u32 value_len; - __u16 value_offset; - } __attribute__((__packed__)) *attr; - - struct volume_info { - __u64 reserved; - __u8 major_ver; - __u8 minor_ver; - } __attribute__((__packed__)) *info; - unsigned int sector_size; unsigned int cluster_size; __u64 mft_cluster; @@ -118,6 +118,8 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) const __u8 *buf; const __u8 *val; + dbg("probing at offset %llu", off); + ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (ns == NULL) return -1; diff --git a/extras/volume_id/volume_id/reiserfs/reiserfs.c b/extras/volume_id/volume_id/reiserfs/reiserfs.c index 5653214e9d..d54013e4c5 100644 --- a/extras/volume_id/volume_id/reiserfs/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs/reiserfs.c @@ -39,26 +39,30 @@ #include "../util.h" #include "reiserfs.h" +struct reiserfs_super_block { + __u32 blocks_count; + __u32 free_blocks; + __u32 root_block; + __u32 journal_block; + __u32 journal_dev; + __u32 orig_journal_size; + __u32 dummy2[5]; + __u16 blocksize; + __u16 dummy3[3]; + __u8 magic[12]; + __u32 dummy4[5]; + __u8 uuid[16]; + __u8 label[16]; +} __attribute__((__packed__)); + #define REISERFS1_SUPERBLOCK_OFFSET 0x2000 #define REISERFS_SUPERBLOCK_OFFSET 0x10000 int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) { - struct reiserfs_super_block { - __u32 blocks_count; - __u32 free_blocks; - __u32 root_block; - __u32 journal_block; - __u32 journal_dev; - __u32 orig_journal_size; - __u32 dummy2[5]; - __u16 blocksize; - __u16 dummy3[3]; - __u8 magic[12]; - __u32 dummy4[5]; - __u8 uuid[16]; - __u8 label[16]; - } __attribute__((__packed__)) *rs; + struct reiserfs_super_block *rs; + + dbg("probing at offset %llu", off); rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); if (rs == NULL) diff --git a/extras/volume_id/volume_id/romfs/romfs.c b/extras/volume_id/volume_id/romfs/romfs.c new file mode 100644 index 0000000000..c04dc98f10 --- /dev/null +++ b/extras/volume_id/volume_id/romfs/romfs.c @@ -0,0 +1,73 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "romfs.h" + +struct romfs_super { + __u8 magic[8]; + __u32 size; + __u32 checksum; + __u8 name[0]; +} __attribute__((__packed__)); + +int volume_id_probe_romfs(struct volume_id *id, __u64 off) +{ + struct romfs_super *rfs; + + dbg("probing at offset %llu", off); + + rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); + if (rfs == NULL) + return -1; + + if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { + size_t len = strlen(rfs->name); + + if (len) { + volume_id_set_label_raw(id, rfs->name, len); + volume_id_set_label_string(id, rfs->name, len); + } + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "romfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/volume_id/romfs/romfs.h b/extras/volume_id/volume_id/romfs/romfs.h new file mode 100644 index 0000000000..b0108f3dde --- /dev/null +++ b/extras/volume_id/volume_id/romfs/romfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_ROMFS_ +#define _VOLUME_ID_ROMFS_ + +extern int volume_id_probe_romfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/sysv/sysv.c b/extras/volume_id/volume_id/sysv/sysv.c new file mode 100644 index 0000000000..313ac1732a --- /dev/null +++ b/extras/volume_id/volume_id/sysv/sysv.c @@ -0,0 +1,146 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "../volume_id.h" +#include "../logging.h" +#include "../util.h" +#include "sysv.h" + +#define SYSV_NICINOD 100 +#define SYSV_NICFREE 50 + +struct sysv_super +{ + __u16 s_isize; + __u16 s_pad0; + __u32 s_fsize; + __u16 s_nfree; + __u16 s_pad1; + __u32 s_free[SYSV_NICFREE]; + __u16 s_ninode; + __u16 s_pad2; + __u16 s_inode[SYSV_NICINOD]; + __u8 s_flock; + __u8 s_ilock; + __u8 s_fmod; + __u8 s_ronly; + __u32 s_time; + __u16 s_dinfo[4]; + __u32 s_tfree; + __u16 s_tinode; + __u16 s_pad3; + __u8 s_fname[6]; + __u8 s_fpack[6]; + __u32 s_fill[12]; + __u32 s_state; + __u32 s_magic; + __u32 s_type; +} __attribute__((__packed__)); + +#define XENIX_NICINOD 100 +#define XENIX_NICFREE 100 + +struct xenix_super { + __u16 s_isize; + __u32 s_fsize; + __u16 s_nfree; + __u32 s_free[XENIX_NICFREE]; + __u16 s_ninode; + __u16 s_inode[XENIX_NICINOD]; + __u8 s_flock; + __u8 s_ilock; + __u8 s_fmod; + __u8 s_ronly; + __u32 s_time; + __u32 s_tfree; + __u16 s_tinode; + __u16 s_dinfo[4]; + __u8 s_fname[6]; + __u8 s_fpack[6]; + __u8 s_clean; + __u8 s_fill[371]; + __u32 s_magic; + __u32 s_type; +} __attribute__((__packed__)); + +#define SYSV_SUPERBLOCK_BLOCK 0x01 +#define SYSV_MAGIC 0xfd187e20 +#define XENIX_SUPERBLOCK_BLOCK 0x18 +#define XENIX_MAGIC 0x2b5544 +#define SYSV_MAX_BLOCKSIZE 0x800 + +int volume_id_probe_sysv(struct volume_id *id, __u64 off) +{ + struct sysv_super *vs; + struct xenix_super *xs; + unsigned int boff; + + dbg("probing at offset %llu", off); + + for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { + vs = (struct sysv_super *) + volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200); + if (vs == NULL) + return -1; + + if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) { + volume_id_set_label_raw(id, vs->s_fname, 6); + volume_id_set_label_string(id, vs->s_fname, 6); + id->type = "sysv"; + goto found; + } + } + + for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { + xs = (struct xenix_super *) + volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200); + if (xs == NULL) + return -1; + + if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) { + volume_id_set_label_raw(id, xs->s_fname, 6); + volume_id_set_label_string(id, xs->s_fname, 6); + id->type = "xenix"; + goto found; + } + } + + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + return 0; +} diff --git a/extras/volume_id/volume_id/sysv/sysv.h b/extras/volume_id/volume_id/sysv/sysv.h new file mode 100644 index 0000000000..bd5a3500fb --- /dev/null +++ b/extras/volume_id/volume_id/sysv/sysv.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_SYSV_ +#define _VOLUME_ID_SYSV_ + +extern int volume_id_probe_sysv(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/udf/udf.c b/extras/volume_id/volume_id/udf/udf.c index ff23b31039..79d25ad890 100644 --- a/extras/volume_id/volume_id/udf/udf.c +++ b/extras/volume_id/volume_id/udf/udf.c @@ -39,43 +39,45 @@ #include "../util.h" #include "udf.h" +struct volume_descriptor { + struct descriptor_tag { + __u16 id; + __u16 version; + __u8 checksum; + __u8 reserved; + __u16 serial; + __u16 crc; + __u16 crc_len; + __u32 location; + } __attribute__((__packed__)) tag; + union { + struct anchor_descriptor { + __u32 length; + __u32 location; + } __attribute__((__packed__)) anchor; + struct primary_descriptor { + __u32 seq_num; + __u32 desc_num; + struct dstring { + __u8 clen; + __u8 c[31]; + } __attribute__((__packed__)) ident; + } __attribute__((__packed__)) primary; + } __attribute__((__packed__)) type; +} __attribute__((__packed__)); + +struct volume_structure_descriptor { + __u8 type; + __u8 id[5]; + __u8 version; +} __attribute__((__packed__)); + #define UDF_VSD_OFFSET 0x8000 int volume_id_probe_udf(struct volume_id *id, __u64 off) { - struct volume_descriptor { - struct descriptor_tag { - __u16 id; - __u16 version; - __u8 checksum; - __u8 reserved; - __u16 serial; - __u16 crc; - __u16 crc_len; - __u32 location; - } __attribute__((__packed__)) tag; - union { - struct anchor_descriptor { - __u32 length; - __u32 location; - } __attribute__((__packed__)) anchor; - struct primary_descriptor { - __u32 seq_num; - __u32 desc_num; - struct dstring { - __u8 clen; - __u8 c[31]; - } __attribute__((__packed__)) ident; - } __attribute__((__packed__)) primary; - } __attribute__((__packed__)) type; - } __attribute__((__packed__)) *vd; - - struct volume_structure_descriptor { - __u8 type; - __u8 id[5]; - __u8 version; - } *vsd; - + struct volume_descriptor *vd; + struct volume_structure_descriptor *vsd; unsigned int bs; unsigned int b; unsigned int type; @@ -83,6 +85,8 @@ int volume_id_probe_udf(struct volume_id *id, __u64 off) unsigned int loc; unsigned int clen; + dbg("probing at offset %llu", off); + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); if (vsd == NULL) return -1; diff --git a/extras/volume_id/volume_id/ufs/ufs.c b/extras/volume_id/volume_id/ufs/ufs.c index bab1d4cfad..12672ffe01 100644 --- a/extras/volume_id/volume_id/ufs/ufs.c +++ b/extras/volume_id/volume_id/ufs/ufs.c @@ -39,6 +39,143 @@ #include "../util.h" #include "ufs.h" +struct ufs_super_block { + __u32 fs_link; + __u32 fs_rlink; + __u32 fs_sblkno; + __u32 fs_cblkno; + __u32 fs_iblkno; + __u32 fs_dblkno; + __u32 fs_cgoffset; + __u32 fs_cgmask; + __u32 fs_time; + __u32 fs_size; + __u32 fs_dsize; + __u32 fs_ncg; + __u32 fs_bsize; + __u32 fs_fsize; + __u32 fs_frag; + __u32 fs_minfree; + __u32 fs_rotdelay; + __u32 fs_rps; + __u32 fs_bmask; + __u32 fs_fmask; + __u32 fs_bshift; + __u32 fs_fshift; + __u32 fs_maxcontig; + __u32 fs_maxbpg; + __u32 fs_fragshift; + __u32 fs_fsbtodb; + __u32 fs_sbsize; + __u32 fs_csmask; + __u32 fs_csshift; + __u32 fs_nindir; + __u32 fs_inopb; + __u32 fs_nspf; + __u32 fs_optim; + __u32 fs_npsect_state; + __u32 fs_interleave; + __u32 fs_trackskew; + __u32 fs_id[2]; + __u32 fs_csaddr; + __u32 fs_cssize; + __u32 fs_cgsize; + __u32 fs_ntrak; + __u32 fs_nsect; + __u32 fs_spc; + __u32 fs_ncyl; + __u32 fs_cpg; + __u32 fs_ipg; + __u32 fs_fpg; + struct ufs_csum { + __u32 cs_ndir; + __u32 cs_nbfree; + __u32 cs_nifree; + __u32 cs_nffree; + } __attribute__((__packed__)) fs_cstotal; + __s8 fs_fmod; + __s8 fs_clean; + __s8 fs_ronly; + __s8 fs_flags; + union { + struct { + __s8 fs_fsmnt[512]; + __u32 fs_cgrotor; + __u32 fs_csp[31]; + __u32 fs_maxcluster; + __u32 fs_cpc; + __u16 fs_opostbl[16][8]; + } __attribute__((__packed__)) fs_u1; + struct { + __s8 fs_fsmnt[468]; + __u8 fs_volname[32]; + __u64 fs_swuid; + __s32 fs_pad; + __u32 fs_cgrotor; + __u32 fs_ocsp[28]; + __u32 fs_contigdirs; + __u32 fs_csp; + __u32 fs_maxcluster; + __u32 fs_active; + __s32 fs_old_cpc; + __s32 fs_maxbsize; + __s64 fs_sparecon64[17]; + __s64 fs_sblockloc; + struct ufs2_csum_total { + __u64 cs_ndir; + __u64 cs_nbfree; + __u64 cs_nifree; + __u64 cs_nffree; + __u64 cs_numclusters; + __u64 cs_spare[3]; + } __attribute__((__packed__)) fs_cstotal; + struct ufs_timeval { + __s32 tv_sec; + __s32 tv_usec; + } __attribute__((__packed__)) fs_time; + __s64 fs_size; + __s64 fs_dsize; + __u64 fs_csaddr; + __s64 fs_pendingblocks; + __s32 fs_pendinginodes; + } __attribute__((__packed__)) fs_u2; + } fs_u11; + union { + struct { + __s32 fs_sparecon[53]; + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __s32 fs_state; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + } __attribute__((__packed__)) fs_sun; + struct { + __s32 fs_sparecon[53]; + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __u32 fs_npsect; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + } __attribute__((__packed__)) fs_sunx86; + struct { + __s32 fs_sparecon[50]; + __s32 fs_contigsumsize; + __s32 fs_maxsymlinklen; + __s32 fs_inodefmt; + __u32 fs_maxfilesize[2]; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + __s32 fs_state; + } __attribute__((__packed__)) fs_44; + } fs_u2; + __s32 fs_postblformat; + __s32 fs_nrpos; + __s32 fs_postbloff; + __s32 fs_rotbloff; + __u32 fs_magic; + __u8 fs_space[1]; +} __attribute__((__packed__)); + #define UFS_MAGIC 0x00011954 #define UFS2_MAGIC 0x19540119 #define UFS_MAGIC_FEA 0x00195612 @@ -46,147 +183,13 @@ int volume_id_probe_ufs(struct volume_id *id, __u64 off) { - struct ufs_super_block { - __u32 fs_link; - __u32 fs_rlink; - __u32 fs_sblkno; - __u32 fs_cblkno; - __u32 fs_iblkno; - __u32 fs_dblkno; - __u32 fs_cgoffset; - __u32 fs_cgmask; - __u32 fs_time; - __u32 fs_size; - __u32 fs_dsize; - __u32 fs_ncg; - __u32 fs_bsize; - __u32 fs_fsize; - __u32 fs_frag; - __u32 fs_minfree; - __u32 fs_rotdelay; - __u32 fs_rps; - __u32 fs_bmask; - __u32 fs_fmask; - __u32 fs_bshift; - __u32 fs_fshift; - __u32 fs_maxcontig; - __u32 fs_maxbpg; - __u32 fs_fragshift; - __u32 fs_fsbtodb; - __u32 fs_sbsize; - __u32 fs_csmask; - __u32 fs_csshift; - __u32 fs_nindir; - __u32 fs_inopb; - __u32 fs_nspf; - __u32 fs_optim; - __u32 fs_npsect_state; - __u32 fs_interleave; - __u32 fs_trackskew; - __u32 fs_id[2]; - __u32 fs_csaddr; - __u32 fs_cssize; - __u32 fs_cgsize; - __u32 fs_ntrak; - __u32 fs_nsect; - __u32 fs_spc; - __u32 fs_ncyl; - __u32 fs_cpg; - __u32 fs_ipg; - __u32 fs_fpg; - struct ufs_csum { - __u32 cs_ndir; - __u32 cs_nbfree; - __u32 cs_nifree; - __u32 cs_nffree; - } __attribute__((__packed__)) fs_cstotal; - __s8 fs_fmod; - __s8 fs_clean; - __s8 fs_ronly; - __s8 fs_flags; - union { - struct { - __s8 fs_fsmnt[512]; - __u32 fs_cgrotor; - __u32 fs_csp[31]; - __u32 fs_maxcluster; - __u32 fs_cpc; - __u16 fs_opostbl[16][8]; - } __attribute__((__packed__)) fs_u1; - struct { - __s8 fs_fsmnt[468]; - __u8 fs_volname[32]; - __u64 fs_swuid; - __s32 fs_pad; - __u32 fs_cgrotor; - __u32 fs_ocsp[28]; - __u32 fs_contigdirs; - __u32 fs_csp; - __u32 fs_maxcluster; - __u32 fs_active; - __s32 fs_old_cpc; - __s32 fs_maxbsize; - __s64 fs_sparecon64[17]; - __s64 fs_sblockloc; - struct ufs2_csum_total { - __u64 cs_ndir; - __u64 cs_nbfree; - __u64 cs_nifree; - __u64 cs_nffree; - __u64 cs_numclusters; - __u64 cs_spare[3]; - } __attribute__((__packed__)) fs_cstotal; - struct ufs_timeval { - __s32 tv_sec; - __s32 tv_usec; - } __attribute__((__packed__)) fs_time; - __s64 fs_size; - __s64 fs_dsize; - __u64 fs_csaddr; - __s64 fs_pendingblocks; - __s32 fs_pendinginodes; - } __attribute__((__packed__)) fs_u2; - } fs_u11; - union { - struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __s32 fs_state; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - } __attribute__((__packed__)) fs_sun; - struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __u32 fs_npsect; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - } __attribute__((__packed__)) fs_sunx86; - struct { - __s32 fs_sparecon[50]; - __s32 fs_contigsumsize; - __s32 fs_maxsymlinklen; - __s32 fs_inodefmt; - __u32 fs_maxfilesize[2]; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - __s32 fs_state; - } __attribute__((__packed__)) fs_44; - } fs_u2; - __s32 fs_postblformat; - __s32 fs_nrpos; - __s32 fs_postbloff; - __s32 fs_rotbloff; - __u32 fs_magic; - __u8 fs_space[1]; - } __attribute__((__packed__)) *ufs; - __u32 magic; int i; + struct ufs_super_block *ufs; int offsets[] = {0, 8, 64, 256, -1}; + dbg("probing at offset %llu", off); + for (i = 0; offsets[i] >= 0; i++) { ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); if (ufs == NULL) diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h index e5cd63e1aa..22fd1b94e2 100644 --- a/extras/volume_id/volume_id/util.h +++ b/extras/volume_id/volume_id/util.h @@ -58,12 +58,16 @@ #define le64_to_cpu(x) (x) #define be16_to_cpu(x) bswap16(x) #define be32_to_cpu(x) bswap32(x) +#define cpu_to_le32(x) (x) +#define cpu_to_be32(x) bswap32(x) #elif (__BYTE_ORDER == __BIG_ENDIAN) #define le16_to_cpu(x) bswap16(x) #define le32_to_cpu(x) bswap32(x) #define le64_to_cpu(x) bswap64(x) #define be16_to_cpu(x) (x) #define be32_to_cpu(x) (x) +#define cpu_to_le32(x) bswap32(x) +#define cpu_to_be32(x) (x) #endif enum uuid_format { diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 78aae37ba0..95f7f5b127 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -56,6 +56,8 @@ #include "linux_raid/linux_raid.h" #include "lvm/lvm.h" #include "cramfs/cramfs.h" +#include "hpfs/hpfs.h" +#include "romfs/romfs.h" #include "mac/mac.h" #include "msdos/msdos.h" @@ -120,6 +122,12 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l if (volume_id_probe_cramfs(id, off) == 0) goto exit; + if (volume_id_probe_romfs(id, off) == 0) + goto exit; + + if (volume_id_probe_hpfs(id, off) == 0) + goto exit; + return -1; exit: diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 5a4b136c32..5b845602c6 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 33 +#define VOLUME_ID_VERSION 34 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 diff --git a/extras/volume_id/volume_id/xfs/xfs.c b/extras/volume_id/volume_id/xfs/xfs.c index 67ae2f07d5..efbe06ec58 100644 --- a/extras/volume_id/volume_id/xfs/xfs.c +++ b/extras/volume_id/volume_id/xfs/xfs.c @@ -39,22 +39,26 @@ #include "../util.h" #include "xfs.h" +struct xfs_super_block { + __u8 magic[4]; + __u32 blocksize; + __u64 dblocks; + __u64 rblocks; + __u32 dummy1[2]; + __u8 uuid[16]; + __u32 dummy2[15]; + __u8 fname[12]; + __u32 dummy3[2]; + __u64 icount; + __u64 ifree; + __u64 fdblocks; +} __attribute__((__packed__)); + int volume_id_probe_xfs(struct volume_id *id, __u64 off) { - struct xfs_super_block { - __u8 magic[4]; - __u32 blocksize; - __u64 dblocks; - __u64 rblocks; - __u32 dummy1[2]; - __u8 uuid[16]; - __u32 dummy2[15]; - __u8 fname[12]; - __u32 dummy3[2]; - __u64 icount; - __u64 ifree; - __u64 fdblocks; - } __attribute__((__packed__)) *xs; + struct xfs_super_block *xs; + + dbg("probing at offset %llu", off); xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (xs == NULL) -- cgit v1.2.3-54-g00ecf From bce52be81ec679bf080bb11f292c899d9fde084e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 9 Feb 2005 01:15:35 +0100 Subject: [PATCH] udev_volume_id: fix dasd disklabel reading with -l option --- extras/volume_id/udev_volume_id.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index c2a37e8547..d3c3fcd505 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) struct sysfs_class_device *class_dev_parent = NULL; struct volume_id *vid = NULL; char *devpath; - char probe_main_device = 0; + char probe_disk_label = 0; char print = 'a'; static char name[VOLUME_ID_LABEL_SIZE]; int len, i, j; @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) print = 'u'; continue; case 'd': - probe_main_device = 1; + probe_disk_label = 1; continue; case 'h': case '?': @@ -146,8 +146,7 @@ int main(int argc, char *argv[]) goto exit; } - if (probe_main_device == 0) { - /* open block device */ + if (probe_disk_label == 0) { vid = open_classdev(class_dev); if (vid == NULL) goto exit; @@ -205,7 +204,8 @@ print: printf("%s\n", vid->type); break; case 'l': - if (name[0] == '\0' || vid->usage_id != VOLUME_ID_FILESYSTEM) { + if (name[0] == '\0' || + (vid->usage_id != VOLUME_ID_FILESYSTEM && vid->usage_id != VOLUME_ID_DISKLABEL)) { rc = 2; goto exit; } -- cgit v1.2.3-54-g00ecf From c1ab046124ebef3c82950b91ccfd1678d9f7fe5b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 9 Feb 2005 04:37:32 +0100 Subject: [PATCH] provide temporary device node for callouts to access the device %N will create a temporary node for a callout a be sustituted with the name of the node. --- namedev.c | 21 +++++++++++++++++++++ test/udev-test.pl | 18 ++++++++++++++++++ udev.8.in | 7 +++++++ udev.h | 3 +++ udev_add.c | 6 +++--- udev_remove.c | 39 ++------------------------------------- udev_utils.c | 25 +++++++++++++++++++++++++ udev_utils.h | 1 + 8 files changed, 80 insertions(+), 40 deletions(-) diff --git a/namedev.c b/namedev.c index 0c5d0509f9..332e2d57d8 100644 --- a/namedev.c +++ b/namedev.c @@ -201,6 +201,12 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, switch (c) { + case 'p': + if (strlen(udev->devpath) == 0) + break; + strfieldcatmax(string, udev->devpath, maxsize); + dbg("substitute kernel name '%s'", udev->kernel_name); + break; case 'b': if (strlen(udev->bus_id) == 0) break; @@ -290,6 +296,15 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, strfieldcatmax(string, temp2, maxsize); } break; + case 'N': + if (udev->tmp_node[0] == '\0') { + dbg("create temporary device node for callout"); + snprintf(udev->tmp_node, NAME_SIZE-1, "%s/.tmp-%u-%u", udev_root, udev->major, udev->minor); + udev_make_node(udev, udev->tmp_node, udev->major, udev->minor, 0600, 0, 0); + } + strfieldcatmax(string, udev->tmp_node, maxsize); + dbg("substitute temporary device node name '%s'", udev->tmp_node); + break; default: dbg("unknown substitution type '%%%c'", c); break; @@ -787,5 +802,11 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg("no rule found, use kernel name '%s'", udev->name); exit: + if (udev->tmp_node[0] != '\0') { + dbg("removing temporary device node"); + unlink_secure(udev->tmp_node); + udev->tmp_node[0] = '\0'; + } + return 0; } diff --git a/test/udev-test.pl b/test/udev-test.pl index 67c0672759..fa1e4affc6 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1066,6 +1066,24 @@ EOF conf => < "temporary node creation test", + subsys => "block", + devpath => "/block/sda", + exp_name => "sda", + conf => < "devpath substitution test", + subsys => "block", + devpath => "/block/sda", + exp_name => "sda", + conf => < #include #include "libsysfs/sysfs/libsysfs.h" @@ -59,6 +60,7 @@ struct udevice { int minor; char devname[NAME_SIZE]; + char tmp_node[NAME_SIZE]; int partitions; int ignore_remove; int config_line; @@ -75,6 +77,7 @@ extern int udev_remove_device(struct udevice *udev); extern void udev_init_config(void); extern int udev_start(void); extern void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix); +extern int udev_make_node(struct udevice *udev, const char *file, int major, int minor, mode_t mode, uid_t uid, gid_t gid); extern char sysfs_path[SYSFS_PATH_MAX]; extern char udev_root[PATH_MAX]; diff --git a/udev_add.c b/udev_add.c index 24a20bba9b..a495902ab2 100644 --- a/udev_add.c +++ b/udev_add.c @@ -67,7 +67,7 @@ error: return -1; } -static int make_node(struct udevice *udev, char *file, int major, int minor, unsigned int mode, uid_t uid, gid_t gid) +int udev_make_node(struct udevice *udev, const char *file, int major, int minor, mode_t mode, uid_t uid, gid_t gid) { struct stat stats; int retval = 0; @@ -183,7 +183,7 @@ static int create_node(struct udevice *udev) if (!udev->test_run) { info("creating device node '%s'", filename); - if (make_node(udev, filename, udev->major, udev->minor, udev->mode, uid, gid) != 0) + if (udev_make_node(udev, filename, udev->major, udev->minor, udev->mode, uid, gid) != 0) goto error; } else { info("creating device node '%s', major = '%d', minor = '%d', " @@ -198,7 +198,7 @@ static int create_node(struct udevice *udev) for (i = 1; i <= udev->partitions; i++) { strfieldcpy(partitionname, filename); strintcat(partitionname, i); - make_node(udev, partitionname, udev->major, udev->minor + i, udev->mode, uid, gid); + udev_make_node(udev, partitionname, udev->major, udev->minor + i, udev->mode, uid, gid); } } } diff --git a/udev_remove.c b/udev_remove.c index 142503589a..e1af3dbef6 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -67,41 +67,6 @@ static int delete_path(const char *path) return 0; } -/** Remove all permissions on the device node, before - * unlinking it. This fixes a security issue. - * If the user created a hard-link to the device node, - * he can't use it any longer, because he lost permission - * to do so. - */ -static int secure_unlink(const char *filename) -{ - int retval; - - retval = chown(filename, 0, 0); - if (retval) { - dbg("chown(%s, 0, 0) failed with error '%s'", - filename, strerror(errno)); - /* We continue nevertheless. - * I think it's very unlikely for chown - * to fail here, if the file exists. - */ - } - retval = chmod(filename, 0000); - if (retval) { - dbg("chmod(%s, 0000) failed with error '%s'", - filename, strerror(errno)); - /* We continue nevertheless. */ - } - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - if (retval) { - dbg("unlink(%s) failed with error '%s'", - filename, strerror(errno)); - } - return retval; -} - static int delete_node(struct udevice *udev) { char filename[NAME_SIZE]; @@ -116,7 +81,7 @@ static int delete_node(struct udevice *udev) filename[NAME_SIZE-1] = '\0'; info("removing device node '%s'", filename); - retval = secure_unlink(filename); + retval = unlink_secure(filename); if (retval) return retval; @@ -131,7 +96,7 @@ static int delete_node(struct udevice *udev) for (i = 1; i <= num; i++) { strfieldcpy(partitionname, filename); strintcat(partitionname, i); - secure_unlink(partitionname); + unlink_secure(partitionname); } } diff --git a/udev_utils.c b/udev_utils.c index 5b0355d0e9..ca46258def 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -112,6 +112,31 @@ int create_path(const char *path) return mkdir(p, 0755); } +/* Reset permissions on the device node, before unlinking it to make sure, + * that permisions of possible hard links will be removed to. + */ +int unlink_secure(const char *filename) +{ + int retval; + + retval = chown(filename, 0, 0); + if (retval) + dbg("chown(%s, 0, 0) failed with error '%s'", filename, strerror(errno)); + + retval = chmod(filename, 0000); + if (retval) + dbg("chmod(%s, 0000) failed with error '%s'", filename, strerror(errno)); + + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; + + if (retval) + dbg("unlink(%s) failed with error '%s'", filename, strerror(errno)); + + return retval; +} + int parse_get_pair(char **orig_string, char **left, char **right) { char *temp; diff --git a/udev_utils.h b/udev_utils.h index 5d2c9c580c..19061f16f6 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -80,6 +80,7 @@ extern void udev_init_device(struct udevice *udev, const char* devpath, const ch extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); extern int create_path(const char *path); extern int parse_get_pair(char **orig_string, char **left, char **right); +extern int unlink_secure(const char *filename); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); -- cgit v1.2.3-54-g00ecf From 6d56416665863dc2b4fb107dbdc779e4791bdf9e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 9 Feb 2005 08:43:18 +0100 Subject: [PATCH] create /block/*/range count of partitons for all_partitions --- namedev.h | 2 +- namedev_parse.c | 13 ++++++++++++- udev.h | 2 ++ udev_add.c | 18 +++++++++++++++--- udev_remove.c | 2 +- 5 files changed, 31 insertions(+), 6 deletions(-) diff --git a/namedev.h b/namedev.h index 8a3569ec7c..43381bfbd6 100644 --- a/namedev.h +++ b/namedev.h @@ -53,7 +53,6 @@ struct sysfs_class_device; #define ATTR_PARTITIONS "all_partitions" #define ATTR_IGNORE_REMOVE "ignore_remove" -#define PARTITIONS_COUNT 15 #define MAX_SYSFS_PAIRS 5 @@ -91,6 +90,7 @@ extern struct list_head config_device_list; extern int namedev_init(void); extern int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_dev); +extern void namedev_close(void); extern void dump_config_dev(struct config_device *dev); extern void dump_config_dev_list(void); diff --git a/namedev_parse.c b/namedev_parse.c index 5bd59d83f2..7b5b963020 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -250,7 +250,7 @@ static int namedev_parse(const char *filename, void *data) if (attr != NULL) { if (strstr(attr, ATTR_PARTITIONS) != NULL) { dbg_parse("creation of partition nodes requested"); - dev.partitions = PARTITIONS_COUNT; + dev.partitions = DEFAULT_PARTITIONS_COUNT; } if (strstr(attr, ATTR_IGNORE_REMOVE) != NULL) { dbg_parse("remove event should be ignored"); @@ -338,3 +338,14 @@ int namedev_init(void) return retval; } + +void namedev_close(void) +{ + struct config_device *dev; + + list_for_each_entry(dev, &config_device_list, node) { + list_del(&dev->node); + free(dev); + } +} + diff --git a/udev.h b/udev.h index 5beec64557..c2f9859c5a 100644 --- a/udev.h +++ b/udev.h @@ -46,6 +46,8 @@ #define HOTPLUGD_DIR "/etc/hotplug.d" #define HOTPLUG_SUFFIX ".hotplug" +#define DEFAULT_PARTITIONS_COUNT 15 + struct udevice { char devpath[DEVPATH_SIZE]; char subsystem[SUBSYSTEM_SIZE]; diff --git a/udev_add.c b/udev_add.c index a495902ab2..c566571c1c 100644 --- a/udev_add.c +++ b/udev_add.c @@ -117,16 +117,16 @@ exit: return retval; } -static int create_node(struct udevice *udev) +static int create_node(struct udevice *udev, struct sysfs_class_device *class_dev) { char filename[NAME_SIZE]; char partitionname[NAME_SIZE]; uid_t uid = 0; gid_t gid = 0; - int i; int tail; char *pos; int len; + int i; snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); filename[NAME_SIZE-1] = '\0'; @@ -154,6 +154,7 @@ static int create_node(struct udevice *udev) if (udev->owner[0] != '\0') { char *endptr; unsigned long id = strtoul(udev->owner, &endptr, 10); + if (endptr[0] == '\0') uid = (uid_t) id; else { @@ -170,6 +171,7 @@ static int create_node(struct udevice *udev) if (udev->group[0] != '\0') { char *endptr; unsigned long id = strtoul(udev->group, &endptr, 10); + if (endptr[0] == '\0') gid = (gid_t) id; else { @@ -193,6 +195,16 @@ static int create_node(struct udevice *udev) /* create all_partitions if requested */ if (udev->partitions > 0) { + struct sysfs_attribute *attr; + int range; + + /* take the maximum registered minor range */ + attr = sysfs_get_classdev_attr(class_dev, "range"); + if (attr) { + range = atoi(attr->value); + if (range > 1) + udev->partitions = range-1; + } info("creating device partition nodes '%s[1-%i]'", filename, udev->partitions); if (!udev->test_run) { for (i = 1; i <= udev->partitions; i++) { @@ -298,7 +310,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) selinux_init(); if (udev->type == 'b' || udev->type == 'c') { - retval = create_node(udev); + retval = create_node(udev, class_dev); if (retval != 0) goto exit; diff --git a/udev_remove.c b/udev_remove.c index e1af3dbef6..172ec12690 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -89,7 +89,7 @@ static int delete_node(struct udevice *udev) num = udev->partitions; if (num > 0) { info("removing all_partitions '%s[1-%i]'", filename, num); - if (num > PARTITIONS_COUNT) { + if (num > 255) { info("garbage from udev database, skip all_partitions removal"); return -1; } -- cgit v1.2.3-54-g00ecf From fcbb427e0e54ee29a6d11a7130271de0c4edd9c1 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 8 Feb 2005 21:24:29 -0800 Subject: [PATCH] Fix gentoo bug #81102, device nodes for the pktcdvd device. --- etc/udev/gentoo/udev.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index b5f23902cb..c57e7d8239 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -222,3 +222,6 @@ KERNEL="kbd", NAME="%k", MODE="0664" # Sony Vaio Jogdial sonypi device KERNEL="sonypi", NAME="%k", MODE="0666" +# packet devices +KERNEL="pktcdvd", NAME="pktcdvd/control", GROUP="cdrw", MODE="0660" +KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" -- cgit v1.2.3-54-g00ecf From d35f580b25c20ccc965b00da2464f25c9a8fe62c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 8 Feb 2005 21:27:02 -0800 Subject: [PATCH] Fix gentoo bug #76056 (fb device group permissions.) --- etc/udev/gentoo/udev.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index c57e7d8239..9c267ebf8e 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -60,7 +60,7 @@ KERNEL="dm-[0-9]*", NAME="" KERNEL="device-mapper", NAME="mapper/control" # fb devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", MODE="0600" +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video", MODE="0600" # floppy devices KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy" -- cgit v1.2.3-54-g00ecf From 990f059b1eb8af21b978ec1e3f80a9ca7977571f Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 8 Feb 2005 21:32:55 -0800 Subject: [PATCH] Another gentoo fix, adding dvb support. --- etc/udev/gentoo/udev.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 9c267ebf8e..e7e17209d5 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -174,6 +174,9 @@ KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="video" KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video" KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" +# dvb devices +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video", MODE="0660" + # Asterix Zaptel devices KERNEL="zapctl", NAME="zap/ctl" KERNEL="zaptimer", NAME="zap/timer" -- cgit v1.2.3-54-g00ecf From ee2427d3daafa746649f361b0b464e40b95b8549 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 8 Feb 2005 21:39:54 -0800 Subject: [PATCH] Add infiniband to gentoo rules. --- etc/udev/gentoo/udev.rules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index e7e17209d5..52e12541f1 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -228,3 +228,7 @@ KERNEL="sonypi", NAME="%k", MODE="0666" # packet devices KERNEL="pktcdvd", NAME="pktcdvd/control", GROUP="cdrw", MODE="0660" KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" + +# infiniband devices +KERNEL="umad*", NAME="infiniband/%k" +KERNEL="issm*", NAME="infiniband/%k" -- cgit v1.2.3-54-g00ecf From 3a030b511f74348a67c413858713c6fe9c85605c Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 8 Feb 2005 21:40:06 -0800 Subject: [PATCH] fix example comment in ide-devfs.sh --- extras/ide-devfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh index 580a751abe..d4c05b5342 100644 --- a/extras/ide-devfs.sh +++ b/extras/ide-devfs.sh @@ -2,7 +2,7 @@ # udev external PROGRAM script # return devfs-names for ide-devices -# BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" +# BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" HOST="${2%\.[0-9]}" TARGET="${2#[0-9]\.}" -- cgit v1.2.3-54-g00ecf From 1d62f6e2decfe9085ea9c054a4d327adc8203e94 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Tue, 8 Feb 2005 22:53:37 -0800 Subject: [PATCH] 052 release --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 42d84563b2..de7f938f26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Summary of changes from v051 to v052 +============================================ + +: + o debian: update rules files + o raid-devfs.sh: devfs names for hardware RAID controllers + o scsi_id: when udevstart is started, /tmp is not writeable + o cdsymlinks.sh: trivial fix, the variable is initialized to '', not 0 + +: + o gentoo/udev.rules: add default permissions for sound devices + +Greg Kroah-Hartman: + o fix example comment in ide-devfs.sh + o Add infiniband to gentoo rules + o Another gentoo fix, adding dvb support + o Fix gentoo bug #76056 (fb device group permissions.) + o Fix gentoo bug #81102, device nodes for the pktcdvd device + +Kay Sievers: + o provide temporary device node for callouts to access the device + o udev_volume_id: fix dasd disklabel reading with -l option + o udev_volume_id: volume_id version 034 + o udev_volume_id: rename probe_ibm into probe_dasd + o udev_volume_id: volume_id version 032 + o Makefile: add some more warnings and prepare for clean gcc4 compile + o Makefile: cleanup conditional config option sections + o fix -Wsign-compare warnings + o chassis_id: clean compilation and fix bad function parameter passing + o simple_build_check: make it possible to pass KERNEL_DIR + o selinux: cleanup udev integration + +Michael Buesch: + o trivial: remove _all_ trailing slashes with no_trailing_slash() + o trivial: fix signedness + o namdev: allow symlink-only rules to specify node permissions + o udevd: fix valgrind warning + + Summary of changes from v050 to v051 ============================================ diff --git a/Makefile b/Makefile index dc907f6a81..b5698eec73 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 051 +VERSION = 052 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index a0fd5b5426..060ee3310c 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 051 +Version: 052 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 866bb54704e9d955318e0dd6089acfb67d36bfd2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 10 Feb 2005 05:51:41 +0100 Subject: [PATCH] udev_volume_id: remove __packed__ from dasd structure as it does not work --- extras/volume_id/udev_volume_id.c | 2 +- extras/volume_id/volume_id/dasd/dasd.c | 4 ++-- extras/volume_id/volume_id/dasd/dasd.h | 2 +- udev_utils.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index d3c3fcd505..f04f374c27 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -166,7 +166,7 @@ int main(int argc, char *argv[]) if (vid == NULL) goto exit; - if (volume_id_probe_dasd_partition(vid) == 0) + if (volume_id_probe_dasd(vid) == 0) goto print; } diff --git a/extras/volume_id/volume_id/dasd/dasd.c b/extras/volume_id/volume_id/dasd/dasd.c index 4548190ce2..2df6a09e81 100644 --- a/extras/volume_id/volume_id/dasd/dasd.c +++ b/extras/volume_id/volume_id/dasd/dasd.c @@ -142,7 +142,7 @@ typedef struct dasd_information_t { unsigned int confdata_size; char characteristics[64]; /* from read_device_characteristics */ char configuration_data[256]; /* from read_configuration_data */ -} __attribute__((__packed__)) dasd_information_t; +} dasd_information_t; #define _IOC_NRBITS 8 #define _IOC_TYPEBITS 8 @@ -161,7 +161,7 @@ typedef struct dasd_information_t { #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) #define BLKSSZGET _IO(0x12,104) -int volume_id_probe_dasd_partition(struct volume_id *id) +int volume_id_probe_dasd(struct volume_id *id) { int blocksize; dasd_information_t info; diff --git a/extras/volume_id/volume_id/dasd/dasd.h b/extras/volume_id/volume_id/dasd/dasd.h index e7918948c9..751b9fda60 100644 --- a/extras/volume_id/volume_id/dasd/dasd.h +++ b/extras/volume_id/volume_id/dasd/dasd.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_DASDLABEL_ #define _VOLUME_ID_DASDLABEL_ -extern int volume_id_probe_dasd_partition(struct volume_id *id); +extern int volume_id_probe_dasd(struct volume_id *id); #endif diff --git a/udev_utils.c b/udev_utils.c index ca46258def..fda1f42f7e 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -113,7 +113,7 @@ int create_path(const char *path) } /* Reset permissions on the device node, before unlinking it to make sure, - * that permisions of possible hard links will be removed to. + * that permisions of possible hard links will be removed too. */ int unlink_secure(const char *filename) { -- cgit v1.2.3-54-g00ecf From 69aa6dfb7081de376769cf712d1a8832f4346516 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 10 Feb 2005 09:03:55 +0100 Subject: [PATCH] add %P modifier to query the node name of the parent device Events for partition devies may want to read the main block device name to compose it's own name or read a disklabel from the main device. SUBSYSTEM="block", KERNEL="*[1-9]", NAME="%P-p%n" will append the partition number to the name of the main block device. --- namedev.c | 21 +++++++++++++++++++++ test/udev-test.pl | 32 +++++++++++++++++++++++++++++++- udev.8.in | 3 +++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/namedev.c b/namedev.c index 332e2d57d8..90d988311e 100644 --- a/namedev.c +++ b/namedev.c @@ -183,6 +183,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, int slen; struct sysfs_attribute *tmpattr; unsigned int next_free_number; + struct sysfs_class_device *class_dev_parent; pos = string; while (1) { @@ -296,6 +297,22 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, strfieldcatmax(string, temp2, maxsize); } break; + case 'P': + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent != NULL) { + struct udevice udev_parent; + + dbg("found parent '%s', get the node name", class_dev_parent->path); + memset(&udev_parent, 0x00, sizeof(struct udevice)); + /* lookup the name in the udev_db with the DEVPATH of the parent */ + strfieldcpy(udev_parent.devpath, &class_dev_parent->path[strlen(sysfs_path)]); + if (udev_db_get_device(&udev_parent) == 0) { + strfieldcatmax(string, udev_parent.name, maxsize); + dbg("substitute parent node name'%s'", udev_parent.name); + } else + dbg("parent not found in database"); + } + break; case 'N': if (udev->tmp_node[0] == '\0') { dbg("create temporary device node for callout"); @@ -305,6 +322,10 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, strfieldcatmax(string, udev->tmp_node, maxsize); dbg("substitute temporary device node name '%s'", udev->tmp_node); break; + case 'r': + strfieldcatmax(string, udev_root, maxsize); + dbg("substitute udev_root '%s'", udev_root); + break; default: dbg("unknown substitution type '%%%c'", c); break; diff --git a/test/udev-test.pl b/test/udev-test.pl index fa1e4affc6..5a519ef13b 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -968,7 +968,7 @@ KERNEL="sda", NAME="cdrom%e" EOF }, { - desc => "enumeration char test sequence (1/5 keep)", + desc => "enumeration char test sequence 1/5 (keep)", subsys => "block", devpath => "/block/sda", exp_name => "cdrom", @@ -1084,6 +1084,36 @@ EOF exp_name => "sda", conf => < "parent node name substitution test sequence 1/2 (keep)", + subsys => "block", + devpath => "/block/sda", + exp_name => "main_device", + option => "keep", + conf => < "parent node name substitution test sequence 2/2 (clean)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "main_device-part-1", + option => "clean", + conf => < "udev_root substitution", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "start-udev-root-end", + option => "clean", + conf => < Date: Thu, 10 Feb 2005 09:35:52 +0100 Subject: [PATCH] udev_volume_id: remove temporary node creation and parent handling udev can create the temporary node for us now. (On bootup we don't know where a writable filesystem is mounted). Also the parent handling is not needed anymore, cause udev is able to pass us the node name of the parent device. --- extras/volume_id/README | 18 +++---- extras/volume_id/udev_volume_id.c | 98 ++++++++------------------------------- 2 files changed, 25 insertions(+), 91 deletions(-) diff --git a/extras/volume_id/README b/extras/volume_id/README index 9d881a1a05..d570615e10 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -3,43 +3,37 @@ udev_volume_id - partition, filesystem, disklabel reader This program is normally called from a udev rule, to provide udev with the name, uuid or the filesystem type of a partition to name a device node. -udev_volume_id opens the blockdevice specified by the environment variable -DEVPATH and searches for a filesystem superblock to read the label. The -following commandline switches are supported to specify what udev_volume_id +udev_volume_id opens the blockdevice node specified at the commandline. +The following commandline switches are supported to specify what udev_volume_id should print to stdout: no option prints all values -h prints help text -l prints the label of the partition -u prints the uuid of the partition - -d read disk instead of partition - -If -d is specified udev_volume_id tries to read the label from the main -block device where the partition belongs to. For now this is only useful -for s390 dasd labels. udev_volume_id will only return successful if the string asked for, is not empty. All trailing whitespace will be removed, spaces replaced by underscore and slashes ignored. The following rule will create a symlink named with the label string: - KERNEL="[hs]d*", PROGRAM="/sbin/udev_volume_id -l", SYMLINK="%c" + KERNEL="[hs]d*", PROGRAM="/sbin/udev_volume_id -l %N", SYMLINK="%c" If no label is found udev_volume_id exits with nonzero and the rule will be ignored. To give it a try, you may call it on the commandline: - [root@pim udev.kay]# DEVPATH=/block/hda/hda3 extras/volume_id/udev_volume_id + [root@pim udev.kay]# extras/volume_id/udev_volume_id /dev/hda3 T:ext3 L:Music Store N:Music_Store U:d2da42b5-bbd9-44eb-a72c-cc4542fcb71e - [root@pim udev.kay]# DEVPATH=/block/hda/hda3 extras/volume_id/udev_volume_id -l + [root@pim udev.kay]# extras/volume_id/udev_volume_id -l /dev/hda3 Music_Store - [root@pim udev.kay]# DEVPATH=/block/hda/hda1 extras/volume_id/udev_volume_id -t + [root@pim udev.kay]# extras/volume_id/udev_volume_id -t /dev/hda3 swap diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index f04f374c27..843b70baf5 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -1,10 +1,10 @@ /* * udev_volume_id - udev callout to read filesystem label and uuid * - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2005 Kay Sievers * * sample udev rule for creation of a symlink with the filsystem uuid: - * KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -u", SYMLINK="%c" + * KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -u %N", SYMLINK="%c" * * 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 @@ -28,7 +28,6 @@ #include #include -#include "../../libsysfs/sysfs/libsysfs.h" #include "../../udev_utils.h" #include "../../logging.h" #include "volume_id/volume_id.h" @@ -47,49 +46,18 @@ void log_message(int level, const char *format, ...) } #endif -static struct volume_id *open_classdev(struct sysfs_class_device *class_dev) -{ - struct volume_id *vid; - struct sysfs_attribute *attr; - int major, minor; - - attr = sysfs_get_classdev_attr(class_dev, "dev"); - - if (attr == NULL) { - printf("error reading 'dev' attribute\n"); - return NULL; - } - - if (sscanf(attr->value, "%u:%u", &major, &minor) != 2) { - printf("error getting major/minor number\n"); - return NULL; - } - - vid = volume_id_open_dev_t(makedev(major, minor)); - if (vid == NULL) { - printf("error open volume\n"); - return NULL; - } - - return vid; -} +extern int optind; int main(int argc, char *argv[]) { - const char help[] = "usage: udev_volume_id [-t|-l|-u|-d]\n" + const char help[] = "usage: udev_volume_id [-t|-l|-u] \n" " -t filesystem type\n" " -l filesystem label\n" " -u filesystem uuid\n" - " -d disk label from main device\n" "\n"; - static const char short_options[] = "htlud"; - char sysfs_mnt_path[SYSFS_PATH_MAX]; - char dev_path[SYSFS_PATH_MAX]; - struct sysfs_class_device *class_dev = NULL; - struct sysfs_class_device *class_dev_parent = NULL; + static const char short_options[] = "htlu"; struct volume_id *vid = NULL; - char *devpath; - char probe_disk_label = 0; + const char *device; char print = 'a'; static char name[VOLUME_ID_LABEL_SIZE]; int len, i, j; @@ -115,9 +83,6 @@ int main(int argc, char *argv[]) case 'u': print = 'u'; continue; - case 'd': - probe_disk_label = 1; - continue; case 'h': case '?': default: @@ -126,49 +91,26 @@ int main(int argc, char *argv[]) } } - devpath = getenv("DEVPATH"); - if (devpath == NULL) { - printf("error DEVPATH empty\n"); - goto exit; - } - - if (sysfs_get_mnt_path(sysfs_mnt_path, SYSFS_PATH_MAX) != 0) { - printf("error getting sysfs mount path\n"); - goto exit; + device = argv[optind]; + if (device == NULL) { + printf(help); + exit(1); } - strfieldcpy(dev_path, sysfs_mnt_path); - strfieldcat(dev_path, devpath); - - class_dev = sysfs_open_class_device_path(dev_path); - if (class_dev == NULL) { - printf("error getting class device\n"); + vid = volume_id_open_node(device); + if (vid == NULL) { + printf("error open volume\n"); goto exit; } - if (probe_disk_label == 0) { - vid = open_classdev(class_dev); - if (vid == NULL) - goto exit; + if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) + size = 0; - if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) - size = 0; - - if (volume_id_probe_all(vid, 0, size) == 0) - goto print; - } else { - /* if we are on a partition, open main block device instead */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) - vid = open_classdev(class_dev_parent); - else - vid = open_classdev(class_dev); - if (vid == NULL) - goto exit; + if (volume_id_probe_all(vid, 0, size) == 0) + goto print; - if (volume_id_probe_dasd(vid) == 0) - goto print; - } + if (volume_id_probe_dasd(vid) == 0) + goto print; printf("unknown volume type\n"); goto exit; @@ -229,8 +171,6 @@ print: rc = 0; exit: - if (class_dev != NULL) - sysfs_close_class_device(class_dev); if (vid != NULL) volume_id_close(vid); -- cgit v1.2.3-54-g00ecf From f22e9686fd4f8e602e8dc11a4b06765206f26edf Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 10 Feb 2005 18:26:09 +0100 Subject: [PATCH] udevstart: simplify "dev" file searching Just stat() the "dev" file in the device directory instead of opening the directory and iterating over all entries. Make udevstart work with the settings in with udev.conf so we can run a test program. Add a test for udevstart. Remove changelog stuff from code. We should never start with this silly thing. --- test/udev-test.pl | 8 +-- test/udevstart-test.pl | 58 ++++++++++++++++++++ udev_start.c | 143 +++++++++++++++++++++++-------------------------- 3 files changed, 126 insertions(+), 83 deletions(-) create mode 100644 test/udevstart-test.pl diff --git a/test/udev-test.pl b/test/udev-test.pl index 5a519ef13b..992fc0019a 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -14,14 +14,8 @@ # After creation and removal the result is checked against the # expected value and the result is printed. # -# happy testing, # Kay Sievers , 2003 -# -# Modified April 9, 2004 by Leann Ogasawara -# - expanded @tests array to add more symlinks and permissions tests -# - some of the symlinks tests also test lack of node creation -# - added symlink_test() function -# - moved permissions and major_minor tests into their own functions +# Leann Ogasawara , 2004 use warnings; use strict; diff --git a/test/udevstart-test.pl b/test/udevstart-test.pl new file mode 100644 index 0000000000..b6f85bb38c --- /dev/null +++ b/test/udevstart-test.pl @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +# udevstart-test +# +# runs udevstart in a temporary directory with our test sysfs-tree +# and counts the created nodes to compare it with the expected numbers. +# +# Kay Sievers , 2005 +# + +use warnings; +use strict; + +my $PWD = $ENV{PWD}; +my $sysfs = "sys/"; +my $udev_bin = "../udev"; +my $udev_root = "udev-root/"; # !!! directory will be removed !!! +my $udev_db = ".udevdb"; +my $main_conf = "udev-test.conf"; +my $conf_tmp = "udev-test.rules"; + +# set env +$ENV{UDEV_TEST} = "yes"; +$ENV{SYSFS_PATH} = $sysfs; +$ENV{UDEV_CONFIG_FILE} = $main_conf; +$ENV{UDEV_NO_DEVD} = "yes"; +$ENV{UDEV_NO_HOTPLUGD} = "yes"; + +# due to mknod restrictions +if (!($<==0)) { + print "Must have root permissions to run properly.\n"; + exit; +} + +# prepare +system("rm -rf $udev_root"); +mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; + +# create initial config file +open CONF, ">$main_conf" || die "unable to create config file: $main_conf"; +print CONF "udev_root=\"$udev_root\"\n"; +print CONF "udev_db=\"$udev_db\"\n"; +print CONF "udev_rules=\"$conf_tmp\"\n"; +close CONF; + +system("$udev_bin udevstart"); +my $block = int( `find $udev_root -type b -print | wc -l`); +my $char = int( `find $udev_root -type c -print | wc -l`); + +print "block devices: $block/10\n"; +print "char devices: $char/91\n"; + +# cleanup +system("rm -rf $udev_db"); +system("rm -rf $udev_root"); +unlink($conf_tmp); +unlink($main_conf); + diff --git a/udev_start.c b/udev_start.c index 8c7a06b5af..dcb4293345 100644 --- a/udev_start.c +++ b/udev_start.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -40,22 +41,22 @@ #include "udev.h" -#define MAX_PATHLEN 1024 -#define SYSBLOCK "/sys/block" -#define SYSCLASS "/sys/class" +#define MAX_PATH_SIZE 512 struct device { struct list_head list; - char path[MAX_PATHLEN]; - char subsys[MAX_PATHLEN]; + char path[MAX_PATH_SIZE]; + char subsys[MAX_PATH_SIZE]; }; /* sort files in lexical order */ -static int device_list_insert(char *path, char *subsystem, struct list_head *device_list) +static int device_list_insert(const char *path, char *subsystem, struct list_head *device_list) { struct device *loop_device; struct device *new_device; + dbg("insert: '%s'\n", path); + list_for_each_entry(loop_device, device_list, list) { if (strcmp(loop_device->path, path) > 0) { break; @@ -87,18 +88,20 @@ static char *first_list[] = { NULL, }; -static int add_device(char *devpath, char *subsystem) +static int add_device(const char *path, const char *subsystem) { struct udevice udev; - char path[SYSFS_PATH_MAX]; struct sysfs_class_device *class_dev; + const char *devpath; + + devpath = &path[strlen(sysfs_path)]; /* set environment for callouts and dev.d/ */ setenv("DEVPATH", devpath, 1); setenv("SUBSYSTEM", subsystem, 1); - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); - path[SYSFS_PATH_MAX-1] = '\0'; + dbg("exec : '%s' (%s)\n", devpath, path); + class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { dbg ("sysfs_open_class_device_path failed"); @@ -127,7 +130,7 @@ static void exec_list(struct list_head *device_list) /* handle the "first" type devices first */ list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - for (i=0; first_list[i] != NULL; i++) { + for (i = 0; first_list[i] != NULL; i++) { if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { add_device(loop_device->path, loop_device->subsys); list_del(&loop_device->list); @@ -140,7 +143,7 @@ static void exec_list(struct list_head *device_list) /* handle the devices we are allowed to, excluding the "last" type devices */ list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { int found = 0; - for (i=0; last_list[i] != NULL; i++) { + for (i = 0; last_list[i] != NULL; i++) { if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) { found = 1; break; @@ -162,56 +165,61 @@ static void exec_list(struct list_head *device_list) } } +static int has_devt(const char *directory) +{ + char filename[MAX_PATH_SIZE]; + struct stat statbuf; + + snprintf(filename, MAX_PATH_SIZE, "%s/dev", directory); + filename[MAX_PATH_SIZE-1] = '\0'; + + if (stat(filename, &statbuf) == 0) + return 1; + + return 0; +} + static void udev_scan_block(void) { + char base[MAX_PATH_SIZE]; DIR *dir; struct dirent *dent; LIST_HEAD(device_list); - dir = opendir(SYSBLOCK); + snprintf(base, MAX_PATH_SIZE, "%s/block", sysfs_path); + base[MAX_PATH_SIZE-1] = '\0'; + + dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[MAX_PATHLEN]; + char dirname[MAX_PATH_SIZE]; DIR *dir2; struct dirent *dent2; - if ((strcmp(dent->d_name, ".") == 0) || - (strcmp(dent->d_name, "..") == 0)) + if (dent->d_name[0] == '.') continue; - snprintf(dirname, MAX_PATHLEN, "/block/%s", dent->d_name); - dirname[MAX_PATHLEN-1] = '\0'; - device_list_insert(dirname, "block", &device_list); + snprintf(dirname, MAX_PATH_SIZE, "%s/%s", base, dent->d_name); + dirname[MAX_PATH_SIZE-1] = '\0'; + if (has_devt(dirname)) + device_list_insert(dirname, "block", &device_list); + else + continue; - snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSBLOCK, dent->d_name); + snprintf(dirname, MAX_PATH_SIZE, "%s/%s", base, dent->d_name); dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN]; - DIR *dir3; - struct dirent *dent3; + char dirname2[MAX_PATH_SIZE]; - if ((strcmp(dent2->d_name, ".") == 0) || - (strcmp(dent2->d_name, "..") == 0)) + if (dent2->d_name[0] == '.') continue; - snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); - dirname2[MAX_PATHLEN-1] = '\0'; - - dir3 = opendir(dirname2); - if (dir3 != NULL) { - for (dent3 = readdir(dir3); dent3 != NULL; dent3 = readdir(dir3)) { - char filename[MAX_PATHLEN]; - - if (strcmp(dent3->d_name, "dev") == 0) { - snprintf(filename, MAX_PATHLEN, "/block/%s/%s", - dent->d_name, dent2->d_name); - filename[MAX_PATHLEN-1] = '\0'; - device_list_insert(filename, "block", &device_list); - } - } - closedir(dir3); - } + snprintf(dirname2, MAX_PATH_SIZE, "%s/%s", dirname, dent2->d_name); + dirname2[MAX_PATH_SIZE-1] = '\0'; + + if (has_devt(dirname2)) + device_list_insert(dirname2, "block", &device_list); } closedir(dir2); } @@ -224,59 +232,42 @@ static void udev_scan_block(void) static void udev_scan_class(void) { + char base[MAX_PATH_SIZE]; DIR *dir; struct dirent *dent; LIST_HEAD(device_list); - dir = opendir(SYSCLASS); + snprintf(base, MAX_PATH_SIZE, "%s/class", sysfs_path); + base[MAX_PATH_SIZE-1] = '\0'; + + dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[MAX_PATHLEN]; + char dirname[MAX_PATH_SIZE]; DIR *dir2; struct dirent *dent2; - if ((strcmp(dent->d_name, ".") == 0) || - (strcmp(dent->d_name, "..") == 0)) + if (dent->d_name[0] == '.') continue; - snprintf(dirname, MAX_PATHLEN, "%s/%s", SYSCLASS, dent->d_name); - dirname[MAX_PATHLEN-1] = '\0'; + snprintf(dirname, MAX_PATH_SIZE, "%s/%s", base, dent->d_name); + dirname[MAX_PATH_SIZE-1] = '\0'; dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATHLEN]; - DIR *dir3; - struct dirent *dent3; + char dirname2[MAX_PATH_SIZE]; - if ((strcmp(dent2->d_name, ".") == 0) || - (strcmp(dent2->d_name, "..") == 0)) + if (dent2->d_name[0] == '.') continue; + snprintf(dirname2, MAX_PATH_SIZE, "%s/%s", dirname, dent2->d_name); + dirname2[MAX_PATH_SIZE-1] = '\0'; + /* pass the net class as it is */ - if (strcmp(dent->d_name, "net") == 0) { - snprintf(dirname2, MAX_PATHLEN, "/class/net/%s", dent2->d_name); + if (strcmp(dent->d_name, "net") == 0) device_list_insert(dirname2, "net", &device_list); - continue; - } - - snprintf(dirname2, MAX_PATHLEN, "%s/%s", dirname, dent2->d_name); - dirname2[MAX_PATHLEN-1] = '\0'; - dir3 = opendir(dirname2); - if (dir3 != NULL) { - for (dent3 = readdir(dir3); dent3 != NULL; dent3 = readdir(dir3)) { - char filename[MAX_PATHLEN]; - - /* pass devices with a "dev" file */ - if (strcmp(dent3->d_name, "dev") == 0) { - snprintf(filename, MAX_PATHLEN, "/class/%s/%s", - dent->d_name, dent2->d_name); - filename[MAX_PATHLEN-1] = '\0'; - device_list_insert(filename, dent->d_name, &device_list); - break; - } - } - closedir(dir3); - } + else if (has_devt(dirname2)) + device_list_insert(dirname2, dent->d_name, &device_list); } closedir(dir2); } -- cgit v1.2.3-54-g00ecf From 6a24dc747788b6049ef35607ff252e3965af2ce5 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 10 Feb 2005 19:46:50 +0100 Subject: [PATCH] fix special file mode mask for temporary device node --- test/udev-test.pl | 2 +- udev_add.c | 34 +++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 992fc0019a..1b1ee90922 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1068,7 +1068,7 @@ EOF devpath => "/block/sda", exp_name => "sda", conf => <type) { + case 'b': + mode |= S_IFBLK; + break; + case 'c': + case 'u': + mode |= S_IFCHR; + break; + case 'p': + mode |= S_IFIFO; + break; + default: + dbg("unknown node type %c\n", udev->type); + return -EINVAL; + } + selinux_setfscreatecon(file, udev->kernel_name, mode); retval = mknod(file, mode, makedev(major, minor)); if (retval != 0) { @@ -131,24 +147,8 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); filename[NAME_SIZE-1] = '\0'; - switch (udev->type) { - case 'b': - udev->mode |= S_IFBLK; - break; - case 'c': - case 'u': - udev->mode |= S_IFCHR; - break; - case 'p': - udev->mode |= S_IFIFO; - break; - default: - dbg("unknown node type %c\n", udev->type); - return -EINVAL; - } - /* create parent directories if needed */ - if (strrchr(udev->name, '/')) + if (strchr(udev->name, '/')) create_path(filename); if (udev->owner[0] != '\0') { -- cgit v1.2.3-54-g00ecf From fd42f6a170cc9559d8524a248a3e5ab86535024c Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Fri, 11 Feb 2005 03:28:17 +0100 Subject: [PATCH] fix test for temporary nodes --- test/udev-test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 1b1ee90922..fc0e89eeb3 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1066,9 +1066,9 @@ EOF desc => "temporary node creation test", subsys => "block", devpath => "/block/sda", - exp_name => "sda", + exp_name => "node", conf => < Date: Fri, 11 Feb 2005 03:30:11 +0100 Subject: [PATCH] udev_volume_id: fix typo --- extras/volume_id/volume_id/fat/fat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/volume_id/fat/fat.c b/extras/volume_id/volume_id/fat/fat.c index c6bb491f70..7c658fe5f4 100644 --- a/extras/volume_id/volume_id/fat/fat.c +++ b/extras/volume_id/volume_id/fat/fat.c @@ -345,7 +345,7 @@ fat32: volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); found: - volume_id_set_usage(id, VOLUME_ID_DISKLABEL); + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "vfat"; return 0; -- cgit v1.2.3-54-g00ecf From 20da7623c7a2e0571e268c7b169f0b2aa958dbc9 Mon Sep 17 00:00:00 2001 From: "greg@kroah.com" Date: Thu, 10 Feb 2005 18:10:36 -0800 Subject: [PATCH] remove gentoo permission file as it's not valid anymore. --- etc/udev/gentoo/udev.permissions | 205 --------------------------------------- 1 file changed, 205 deletions(-) delete mode 100644 etc/udev/gentoo/udev.permissions diff --git a/etc/udev/gentoo/udev.permissions b/etc/udev/gentoo/udev.permissions deleted file mode 100644 index 51dd9f290e..0000000000 --- a/etc/udev/gentoo/udev.permissions +++ /dev/null @@ -1,205 +0,0 @@ -# /etc/udev/udev.permissions: permission/ownership map for udev -# $Header: /home/cvsroot/gentoo-x86/sys-fs/udev/files/udev.permissions,v 1.3 2004/01/01 03:41:24 azarah Exp $ - -# console devices -console:root:tty:0600 -tty:root:tty:0666 -tty[0-9]*:root:tty:0660 -vc/[0-9]*:root:tty:0660 - -# pty devices -# Set this to 0660 if you only want users belonging to tty group -# to be able to allocate PTYs -ptmx:root:tty:0666 -pty[p-za-e][0-9a-f]*:root:tty:0660 -tty[p-za-e][0-9a-f]*:root:tty:0660 -pty/m*:root:tty:0660 -vc/s*:root:tty:0660 - -# serial+dialup devices -ttyS*:root:tty:0660 -ippp*:root:tty:0660 -isdn*:root:tty:0660 -isdnctrl*:root:tty:0660 -capi*:root:tty:0660 -dcbri*:root:tty:0660 -ircomm*:root:tty:0660 -ttyUSB*:root:usb:0660 -tts/[0-9]*:root:tty:0660 -tts/USB[0-9]*:root:usb:0660 - -# vc devices -vcs:root:root:0600 -vcs[0-9]*:root:root:0600 -vcsa:root:root:0600 -vcsa[0-9]*:root:root:0600 -vcc/*:root:root:0600 - -# memory devices -random:root:root:0666 -urandom:root:root:0444 -mem:root:kmem:0640 -kmem:root:kmem:0640 -port:root:kmem:0640 -full:root:root:0666 -null:root:root:0666 -zero:root:root:0666 - -# misc devices -misc/nvram:root:root:0660 -misc/rtc:root:root:0664 -misc/inotify:root:root:0666 - -# floppy devices -fd[01]*:root:floppy:0660 - -# audio devices -dsp*:root:audio:0660 -audio*:root:audio:0660 -midi*:root:audio:0660 -mixer*:root:audio:0660 -sequencer*:root:audio:0660 -sound/*:root:audio:0660 -snd/*:root:audio:0660 -beep:root:audio:0660 -admm*:root:audio:0660 -adsp*:root:audio:0660 -aload*:root:audio:0660 -amidi*:root:audio:0660 -dmfm*:root:audio:0660 -dmmidi*:root:audio:0660 -sndstat:root:audio:0660 - -# optical devices -sr*:root:cdrom:660 -scd*:root:cdrom:660 -pcd*:root:cdrom:0660 -cdrom*:root:cdrom:0660 -dvd:root:cdrom:0660 -rdvd:root:cdrom:0660 -cdroms/*:root:cdrom:0660 - -# pilot/palm devices -pilot:root:uucp:0660 - -# jaz devices -jaz*:root:disk:0660 - -# zip devices -pocketzip*:root:disk:0660 -zip*:root:disk:0660 - -# ls120 devices -ls120:root:disk:0660 -ls120*:root:disk:0660 - -# lp devices -lp*:root:lp:0660 -parport*:root:lp:0660 -irlpt*:root:lp:0660 -usblp*:root:lp:0660 -usb/lp*:root:lp:0660 - -# scanner devices -scanner:root:root:0600 -usb/scanner*:root:root:0600 - -# camera devices -camera*:root:root:0600 -usb/dc2xx*:root:root:0600 -usb/mdc800*:root:root:0600 - -# raw devices -ram*:root:disk:660 -raw/*:root:disk:660 - -# disk devices -hd*:root:disk:660 -sd*:root:disk:660 -dasd*:root:disk:660 -ataraid*:root:disk:660 -loop*:root:disk:660 -md*:root:disk:660 -ide/*/*/*/*/*:root:disk:660 -discs/*/*:root:disk:660 -loop/*:root:disk:660 -md/*:root:disk:660 - -# tape devices -ht*:root:tape:0660 -nht*:root:tape:0660 -pt[0-9]*:root:tape:0660 -npt*:root:tape:0660 -st*:root:tape:0660 -nst*:root:tape:0660 - -# dm devices -dm-*:root:root:0640 - -# memstick devices -memstick*:root:root:0600 - -# flash devices -flash*:root:root:0600 - -# diskonkey devices -diskonkey*:root:disk:0660 - -# rem_ide devices -microdrive*:root:disk:0660 - -# fb devices -fb:root:root:0600 -fb[0-9]*:root:root:0600 -fb/*:root:root:0600 - -# kbd devices -kbd:root:root:0644 - -# joystick devices -js[0-9]*:root:root:0644 -djs[0-9]*:root:root:0644 - -# v4l devices -video*:root:video:0660 -radio*:root:video:0660 -winradio*:root:video:0660 -vtx*:root:video:0660 -vbi*:root:video:0660 -video/*:root:video:0660 -vttuner:root:video:0660 -v4l/*:root:video:0660 - -# input devices -input/event*:root:root:600 -input/ts*:root:root:600 -input/*:root:root:644 - -# Sony Vaio Jogdial sonypi device -sonypi:root:root:0666 - -# gpm devices -gpmctl:root:root:0700 - -# dri devices -nvidia*:root:video:0660 -3dfx*:root:video:0660 -dri/*:root:video:0660 - -# mainboard devices -apm_bios:root:root:0600 - -# scsi devices -sg*:root:disk:0660 -pg*:root:disk:0660 -cdwriter:root:disk:0660 - -# usb devices -usb/dabusb*:root:usb:0660 -usb/mdc800*:root:usb:0660 -usb/rio500:root:usb:0660 -usb/legousbtower*:root:usb:0660 - -sgi_fetchop:root:root:666 -iseries/vcd*:root:disk:660 -iseries/vd*:root:disk:660 -- cgit v1.2.3-54-g00ecf From 07544a93d6c75361b4906d90945755e34fd07565 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Fri, 11 Feb 2005 18:30:01 -0800 Subject: [PATCH] scsi_id changes for use with udev %N and %p Changes to scsi_id to support the udev %N and %p substitutions: - Update version from .7 to .8 - change TMP_DIR back to /tmp - if DEVPATH is set assume hotplug_mode (use syslog for logging, and does not output some warnings) - Always output a newline after the id is printed - Allow command line options to override settings when hotplug_mode is set - update man page - update generator script to use the %N and %p substitutions. --- extras/scsi_id/Makefile | 2 +- extras/scsi_id/gen_scsi_id_udev_rules.sh | 2 +- extras/scsi_id/scsi_id.8 | 23 ++++++++++-------- extras/scsi_id/scsi_id.c | 41 +++++++++++--------------------- 4 files changed, 29 insertions(+), 39 deletions(-) diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 610faac4b7..e832102e30 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.7 +SCSI_ID_VERSION=0.8 prefix = etcdir = ${prefix}/etc diff --git a/extras/scsi_id/gen_scsi_id_udev_rules.sh b/extras/scsi_id/gen_scsi_id_udev_rules.sh index 874e94e8bb..92fde5df1b 100644 --- a/extras/scsi_id/gen_scsi_id_udev_rules.sh +++ b/extras/scsi_id/gen_scsi_id_udev_rules.sh @@ -60,7 +60,7 @@ do if [ $first_line = "yes" ] then first_line=no - echo "BUS=\"scsi\", PROGRAM=\"${scsi_id}\", RESULT=\"${id}\", NAME=\"${prefix}${name}%n\"" + echo "BUS=\"scsi\", PROGRAM=\"${scsi_id} -d %N -s %p\", RESULT=\"${id}\", NAME=\"${prefix}${name}%n\"" echo echo "# Further RESULT keys use the result of the last PROGRAM rule." echo "# Be careful not to add any rules containing PROGRAM key between here" diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 591bb79366..68d4a1c041 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -53,9 +53,10 @@ identifier starts with the NAA value of 6): .SH OPTIONS .TP .BI subsystem -When called with only a single argument without a leading \-, runs in a hotplug -mode, and expects the environment variable DEVPATH to specify the -corresponding sysfs device. See section below on usage with \fBudev\fP. +Deprecated method: when called with only a single argument without a +leading \-, runs in a hotplug mode, and expects the environment variable +DEVPATH to specify the corresponding sysfs device. See section below on +usage with \fBudev\fP. .TP .BI \-b The default behaviour \- treat the device as black listed, and do nothing @@ -66,6 +67,8 @@ Instead of determining and creating a device node based on a sysfs dev entry as done for the \fB\-s\fP, send SG_IO commands to \fBdevice\fP, such as \fB/dev/sdc\fP. +This argument should also be used when invoked via udev to avoid problems +with creation of temporary files on not-yet writable directories. .TP .BI \-f "\| config\-file" Read configuration and black/white list entries from @@ -106,15 +109,15 @@ Display version number and exit. .RE .SH USAGE WITH UDEV + If \fBscsi_id\fP is invoked with one argument without a leading \-, it assumes it is called for a hotplug event, and looks for the sysfs device -in the DEVPATH environment variable. - -This mode is used when run via the \fBudev\fP PROGRAM key. Passing any -arguments or options as part of the PROGRAM rule breaks this assumption, -and the results will likely not be as expected. +in the DEVPATH environment variable. This mode is deprecated, but +available for backwards compatibility. -When in this mode, all errors and warnings are sent via syslog. +If the DEVPATH environment variable is set, scsi_id assumes it has been +invoked via udev (or some other hotplug program), and all errors or +warnings are sent using syslog. To determine the specific value needed in a RESULT key, use the \-s option, for example: @@ -131,7 +134,7 @@ of 312345: .sp .nf -BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="312345", NAME="disk%n" +BUS="scsi", PROGRAM="/sbin/scsi_id -d %N -s %p", RESULT="312345", NAME="disk%n" .fi .P diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index f45563d1b3..507fa27766 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -44,8 +44,8 @@ /* * temporary names for mknod. */ -#define TMP_DIR "/dev" -#define TMP_PREFIX "tmp-scsi" +#define TMP_DIR "/tmp" +#define TMP_PREFIX "scsi" /* * XXX Note the 'e' (send output to stderr in all cases), and 'c' (callout) @@ -736,9 +736,7 @@ static int scsi_id(const char *target_path, char *maj_min_dev) format_serial(serial); if (display_bus_id) printf("%s: ", scsi_dev->name); - printf("%s", serial); - if (!hotplug_mode) - printf("\n"); + printf("%s\n", serial); dprintf("%s\n", serial); retval = 0; } @@ -762,11 +760,6 @@ int main(int argc, char **argv) if (getenv("DEBUG")) debug++; - if ((argc == 2) && (argv[1][0] != '-')) { - hotplug_mode = 1; - dprintf("hotplug assumed\n"); - } - dprintf("argc is %d\n", argc); if (sysfs_get_mnt_path(sysfs_mnt_path, MAX_NAME_LEN)) { log_message(LOG_WARNING, "sysfs_get_mnt_path failed: %s\n", @@ -774,27 +767,19 @@ int main(int argc, char **argv) exit(1); } - if (hotplug_mode) { + devpath = getenv("DEVPATH"); + if (devpath) { /* - * There is a kernel race creating attributes, if called - * directly, uncomment the sleep. + * This implies that we were invoked via udev or hotplug. */ - /* sleep(1); */ - - devpath = getenv("DEVPATH"); - if (!devpath) { - log_message(LOG_WARNING, "DEVPATH is not set\n"); - exit(1); - } + hotplug_mode = 1; sys_specified = 1; - strncpy(target_path, sysfs_mnt_path, MAX_NAME_LEN); strncat(target_path, devpath, MAX_NAME_LEN); } /* - * Override any command line options set via the config file. This - * is the only way to set options when in hotplug mode. + * Get config file options. */ newargv = NULL; retval = get_file_options(NULL, NULL, &newargc, &newargv); @@ -806,11 +791,13 @@ int main(int argc, char **argv) exit(1); free(newargv); } - if (!hotplug_mode) { - if (set_options(argc, argv, short_options, target_path, - maj_min_dev) < 0) + /* + * Get command line options (overriding any config file or DEVPATH + * settings). + */ + if (set_options(argc, argv, short_options, target_path, + maj_min_dev) < 0) exit(1); - } if (!sys_specified) { log_message(LOG_WARNING, "-s must be specified\n"); -- cgit v1.2.3-54-g00ecf From 6b3df4310f38683ff24d23688d4941fb395682d1 Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Fri, 11 Feb 2005 18:37:58 -0800 Subject: [PATCH] make the release tarballs have writable files in them. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b5698eec73..7684a4030e 100644 --- a/Makefile +++ b/Makefile @@ -358,7 +358,7 @@ release: spotless -rm -rf $(DISTDIR) mkdir $(DISTDIR) chmod 777 $(DISTDIR) - bk export $(DISTDIR) + bk export -w $(DISTDIR) tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz rm -rf $(DISTDIR) @echo "$(RELEASE_NAME).tar.gz created" -- cgit v1.2.3-54-g00ecf From 5f2a5816cf6a67f8a39d082f119fe55c782b882b Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Fri, 11 Feb 2005 18:42:03 -0800 Subject: [PATCH] allow simple-build-check.sh to go faster if MAKEOPTS is set This lets my multiprocessor boxes do the testing quicker... --- test/simple-build-check.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index fa80db4c82..1ebe044b98 100644 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -6,24 +6,24 @@ EXTRAS="extras/chassis_id extras/scsi_id extras/volume_id" echo KERNEL_DIR: "$KERNEL_DIR" make spotless EXTRAS="$EXTRAS" >/dev/null -make all EXTRAS="$EXTRAS" || exit +make all $MAKEOPTS EXTRAS="$EXTRAS" || exit echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null -make all DEBUG=true EXTRAS="$EXTRAS" || exit +make all $MAKEOPTS DEBUG=true EXTRAS="$EXTRAS" || exit echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null -make all USE_LOG=false EXTRAS="$EXTRAS" || exit +make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null -make all USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit +make all $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null -make all USE_KLIBC=true USE_LOG=false EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit +make all $MAKEOPTS USE_KLIBC=true USE_LOG=false EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null - +echo "build test completed successfully" -- cgit v1.2.3-54-g00ecf From bc4235d38ea39593169f473267de2d49bf278844 Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Fri, 11 Feb 2005 19:48:04 -0800 Subject: [PATCH] fix gentoo fb permission issue. --- etc/udev/gentoo/udev.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 52e12541f1..9d109d0930 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -60,7 +60,7 @@ KERNEL="dm-[0-9]*", NAME="" KERNEL="device-mapper", NAME="mapper/control" # fb devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video", MODE="0600" +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video" # floppy devices KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy" -- cgit v1.2.3-54-g00ecf From 5d2d1e7e85de4ae363c96d1ab9de795b0f106e14 Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Fri, 11 Feb 2005 19:55:00 -0800 Subject: [PATCH] 053 release --- ChangeLog | 21 +++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index de7f938f26..68fc6ff2e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Summary of changes from v052 to v053 +============================================ + +Greg Kroah-Hartman: + o fix gentoo fb permission issue + o allow simple-build-check.sh to go faster if MAKEOPTS is set + o make the release tarballs have writable files in them + o remove gentoo permission file as it's not valid anymore + +Kay Sievers: + o fix special file mode mask for temporary device node + o udevstart: simplify "dev" file searching + o udev_volume_id: remove temporary node creation and parent handling + o add %P modifier to query the node name of the parent device + o udev_volume_id: remove __packed__ from dasd structure as it does not work + o create /block/*/range count of partitons for all_partitions + +Patrick Mansfield: + o scsi_id changes for use with udev %N and %p + + Summary of changes from v051 to v052 ============================================ diff --git a/Makefile b/Makefile index 7684a4030e..d696b8ea3b 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 052 +VERSION = 053 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 060ee3310c..f9dc8f3004 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 052 +Version: 053 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From f51d8ec66139fd907d971c64e951decdc20eeecb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 11 Feb 2005 04:59:28 +0100 Subject: [PATCH] udevinfo: print SUBSYSTEM and DRIVER --- udevinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udevinfo.c b/udevinfo.c index a80ca82e12..a6daf46be6 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -146,6 +146,7 @@ static int print_device_chain(const char *path) /* open sysfs class device directory and print all attributes */ printf(" looking at class device '%s':\n", class_dev->path); + printf(" SUBSYSTEM=\"%s\"\n", class_dev->classname); if (print_all_attributes(class_dev->path) != 0) { printf("couldn't open class device directory\n"); retval = -1; @@ -167,6 +168,7 @@ static int print_device_chain(const char *path) printf(" looking at the device chain at '%s':\n", sysfs_dev->path); printf(" BUS=\"%s\"\n", sysfs_dev->bus); printf(" ID=\"%s\"\n", sysfs_dev->bus_id); + printf(" DRIVER=\"%s\"\n", sysfs_dev->driver_name); /* open sysfs device directory and print all attributes */ print_all_attributes(sysfs_dev->path); -- cgit v1.2.3-54-g00ecf From 82b1698314f004b9d69a14c5054e5f7699aa33ad Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 11 Feb 2005 05:21:03 +0100 Subject: [PATCH] namedev: if SUBSYSTEM or KERNEL key doesn't match, give up immediately We don't need to look at the parents in the device chain. There will never be another kernel name or subsystem. --- namedev.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/namedev.c b/namedev.c index 90d988311e..bbc5b40069 100644 --- a/namedev.c +++ b/namedev.c @@ -583,32 +583,15 @@ static int match_rule(struct udevice *udev, struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { while (1) { - /* check for matching bus value */ - if (dev->bus[0] != '\0') { - if (sysfs_device == NULL) { - dbg("device has no bus"); - goto try_parent; - } - dbg("check for " FIELD_BUS " dev->bus='%s' sysfs_device->bus='%s'", - dev->bus, sysfs_device->bus); - if (strcmp_pattern(dev->bus, sysfs_device->bus) != 0) { - dbg(FIELD_BUS " is not matching"); - goto try_parent; - } else { - dbg(FIELD_BUS " matches"); - } - } - /* check for matching kernel name */ if (dev->kernel[0] != '\0') { dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", dev->kernel, class_dev->name); if (strcmp_pattern(dev->kernel, class_dev->name) != 0) { dbg(FIELD_KERNEL " is not matching"); - goto try_parent; - } else { - dbg(FIELD_KERNEL " matches"); + goto exit; } + dbg(FIELD_KERNEL " matches"); } /* check for matching subsystem */ @@ -617,10 +600,9 @@ static int match_rule(struct udevice *udev, struct config_device *dev, dev->subsystem, class_dev->name); if (strcmp_pattern(dev->subsystem, udev->subsystem) != 0) { dbg(FIELD_SUBSYSTEM " is not matching"); - goto try_parent; - } else { - dbg(FIELD_SUBSYSTEM " matches"); + goto exit; } + dbg(FIELD_SUBSYSTEM " matches"); } /* check for matching driver */ @@ -635,6 +617,21 @@ static int match_rule(struct udevice *udev, struct config_device *dev, } } + /* check for matching bus value */ + if (dev->bus[0] != '\0') { + if (sysfs_device == NULL) { + dbg("device has no bus"); + goto try_parent; + } + dbg("check for " FIELD_BUS " dev->bus='%s' sysfs_device->bus='%s'", + dev->bus, sysfs_device->bus); + if (strcmp_pattern(dev->bus, sysfs_device->bus) != 0) { + dbg(FIELD_BUS " is not matching"); + goto try_parent; + } + dbg(FIELD_BUS " matches"); + } + /* check for matching bus id */ if (dev->id[0] != '\0') { dbg("check " FIELD_ID); @@ -695,17 +692,20 @@ static int match_rule(struct udevice *udev, struct config_device *dev, } } - /* Yeah, we matched! */ + /* we matched */ return 0; try_parent: dbg("try parent sysfs device"); sysfs_device = sysfs_get_device_parent(sysfs_device); if (sysfs_device == NULL) - return -ENODEV; + goto exit; dbg("sysfs_device->path='%s'", sysfs_device->path); dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); } + +exit: + return -1; } int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_dev) -- cgit v1.2.3-54-g00ecf From 03a9875bc3ed3c0da226c31e6fe2590a862f6bfe Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 11 Feb 2005 18:33:40 +0100 Subject: [PATCH] namedev: move some matches out of the parent loop --- namedev.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/namedev.c b/namedev.c index bbc5b40069..c8e24db548 100644 --- a/namedev.c +++ b/namedev.c @@ -582,29 +582,29 @@ static int match_place(struct config_device *dev, struct sysfs_class_device *cla static int match_rule(struct udevice *udev, struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { - while (1) { - /* check for matching kernel name */ - if (dev->kernel[0] != '\0') { - dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", - dev->kernel, class_dev->name); - if (strcmp_pattern(dev->kernel, class_dev->name) != 0) { - dbg(FIELD_KERNEL " is not matching"); - goto exit; - } - dbg(FIELD_KERNEL " matches"); + /* check for matching kernel name */ + if (dev->kernel[0] != '\0') { + dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", + dev->kernel, class_dev->name); + if (strcmp_pattern(dev->kernel, class_dev->name) != 0) { + dbg(FIELD_KERNEL " is not matching"); + goto exit; } + dbg(FIELD_KERNEL " matches"); + } - /* check for matching subsystem */ - if (dev->subsystem[0] != '\0') { - dbg("check for " FIELD_SUBSYSTEM " dev->subsystem='%s' class_dev->name='%s'", - dev->subsystem, class_dev->name); - if (strcmp_pattern(dev->subsystem, udev->subsystem) != 0) { - dbg(FIELD_SUBSYSTEM " is not matching"); - goto exit; - } - dbg(FIELD_SUBSYSTEM " matches"); + /* check for matching subsystem */ + if (dev->subsystem[0] != '\0') { + dbg("check for " FIELD_SUBSYSTEM " dev->subsystem='%s' class_dev->name='%s'", + dev->subsystem, class_dev->name); + if (strcmp_pattern(dev->subsystem, udev->subsystem) != 0) { + dbg(FIELD_SUBSYSTEM " is not matching"); + goto exit; } + dbg(FIELD_SUBSYSTEM " matches"); + } + while (1) { /* check for matching driver */ if (dev->driver[0] != '\0') { dbg("check for " FIELD_DRIVER " dev->driver='%s' sysfs_device->driver_name='%s'", -- cgit v1.2.3-54-g00ecf From e57e7bc10811fa87e5775012da9e9b2fb67099c3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 14 Feb 2005 01:46:05 +0100 Subject: [PATCH] namedev: execute PROGRAM only once and not possibly for every physical device --- namedev.c | 73 ++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/namedev.c b/namedev.c index c8e24db548..42e8032be5 100644 --- a/namedev.c +++ b/namedev.c @@ -604,6 +604,7 @@ static int match_rule(struct udevice *udev, struct config_device *dev, dbg(FIELD_SUBSYSTEM " matches"); } + /* walk up the chain of physical devices and find a match */ while (1) { /* check for matching driver */ if (dev->driver[0] != '\0') { @@ -612,9 +613,8 @@ static int match_rule(struct udevice *udev, struct config_device *dev, if (strcmp_pattern(dev->driver, sysfs_device->driver_name) != 0) { dbg(FIELD_DRIVER " is not matching"); goto try_parent; - } else { - dbg(FIELD_DRIVER " matches"); } + dbg(FIELD_DRIVER " matches"); } /* check for matching bus value */ @@ -638,9 +638,8 @@ static int match_rule(struct udevice *udev, struct config_device *dev, if (match_id(dev, class_dev, sysfs_device) != 0) { dbg(FIELD_ID " is not matching"); goto try_parent; - } else { - dbg(FIELD_ID " matches"); } + dbg(FIELD_ID " matches"); } /* check for matching place of device */ @@ -649,9 +648,8 @@ static int match_rule(struct udevice *udev, struct config_device *dev, if (match_place(dev, class_dev, sysfs_device) != 0) { dbg(FIELD_PLACE " is not matching"); goto try_parent; - } else { - dbg(FIELD_PLACE " matches"); } + dbg(FIELD_PLACE " matches"); } /* check for matching sysfs pairs */ @@ -660,41 +658,12 @@ static int match_rule(struct udevice *udev, struct config_device *dev, if (match_sysfs_pairs(dev, class_dev, sysfs_device) != 0) { dbg(FIELD_SYSFS " is not matching"); goto try_parent; - } else { - dbg(FIELD_SYSFS " matches"); - } - } - - /* execute external program */ - if (dev->program[0] != '\0') { - char program[PROGRAM_SIZE]; - - dbg("check " FIELD_PROGRAM); - strfieldcpy(program, dev->program); - apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - if (execute_program(udev, program, udev->program_result, NAME_SIZE) != 0) { - dbg(FIELD_PROGRAM " returned nonzero"); - goto try_parent; - } else { - dbg(FIELD_PROGRAM " returned successful"); } + dbg(FIELD_SYSFS " matches"); } - /* check for matching result of external program */ - if (dev->result[0] != '\0') { - dbg("check for " FIELD_RESULT " dev->result='%s', udev->program_result='%s'", - dev->result, udev->program_result); - if (strcmp_pattern(dev->result, udev->program_result) != 0) { - dbg(FIELD_RESULT " is not matching"); - goto try_parent; - } else { - dbg(FIELD_RESULT " matches"); - } - } - - /* we matched */ - return 0; - + /* found matching physical device */ + break; try_parent: dbg("try parent sysfs device"); sysfs_device = sysfs_get_device_parent(sysfs_device); @@ -704,6 +673,34 @@ try_parent: dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); } + /* execute external program */ + if (dev->program[0] != '\0') { + char program[PROGRAM_SIZE]; + + dbg("check " FIELD_PROGRAM); + strfieldcpy(program, dev->program); + apply_format(udev, program, sizeof(program), class_dev, sysfs_device); + if (execute_program(udev, program, udev->program_result, NAME_SIZE) != 0) { + dbg(FIELD_PROGRAM " returned nonzero"); + goto try_parent; + } + dbg(FIELD_PROGRAM " returned successful"); + } + + /* check for matching result of external program */ + if (dev->result[0] != '\0') { + dbg("check for " FIELD_RESULT " dev->result='%s', udev->program_result='%s'", + dev->result, udev->program_result); + if (strcmp_pattern(dev->result, udev->program_result) != 0) { + dbg(FIELD_RESULT " is not matching"); + goto try_parent; + } + dbg(FIELD_RESULT " matches"); + } + + /* rule matches */ + return 0; + exit: return -1; } -- cgit v1.2.3-54-g00ecf From fd9efc00a2e477423185c993b8ec4570ef3ee07d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 14 Feb 2005 06:03:06 +0100 Subject: [PATCH] introduce OPTIONS=ignore_device, ignore_remove, all_partitions" key Here we move all possible options into a own key to make it possible to have options-only rules. The options on the NAME key are removed from the man page and will be removed from a future version of udev. For ignore rules, OPTIONS="ignore" should be used. The rule: SUBSYSTEM="block", SYSFS{removable}="1", OPTIONS="all_partitions" will create all partitions for a block device which is known to have removable media (a check for cdrom drives would be needed too). --- namedev.c | 38 +++++++++++++++++++++++--------------- namedev.h | 8 +++++++- namedev_parse.c | 19 +++++++++++++++++++ test/udev-test.pl | 35 +++++++++++++++++++++++++++++++++-- udev.8.in | 29 +++++++++++++++-------------- udev_add.c | 2 +- 6 files changed, 98 insertions(+), 33 deletions(-) diff --git a/namedev.c b/namedev.c index 42e8032be5..5c328594d4 100644 --- a/namedev.c +++ b/namedev.c @@ -4,6 +4,7 @@ * Userspace devfs * * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003-2005 Kay Sievers * * * This program is free software; you can redistribute it and/or modify it @@ -749,14 +750,31 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg("process rule"); if (match_rule(udev, dev, class_dev, sysfs_device) == 0) { - /* empty name, symlink and perms will not create any node */ + /* FIXME: remove old style ignore rule and make OPTION="ignore" mandatory */ if (dev->name[0] == '\0' && dev->symlink[0] == '\0' && - dev->mode == 0000 && dev->owner[0] == '\0' && dev->group[0] == '\0') { + dev->mode == 0000 && dev->owner[0] == '\0' && dev->group[0] == '\0' && + !dev->ignore_device && !dev->partitions && !dev->ignore_remove) { info("configured rule in '%s[%i]' applied, '%s' is ignored", dev->config_file, dev->config_line, udev->kernel_name); return -1; } + /* apply options */ + if (dev->ignore_device) { + info("configured rule in '%s[%i]' applied, '%s' is ignored", + dev->config_file, dev->config_line, udev->kernel_name); + return -1; + } + if (dev->ignore_remove) { + udev->ignore_remove = dev->ignore_remove; + dbg_parse("remove event should be ignored"); + } + /* apply all_partitions option only at a main block device */ + if (dev->partitions && udev->type == 'b' && udev->kernel_number[0] == '\0') { + udev->partitions = dev->partitions; + dbg("creation of partition nodes requested"); + } + /* apply permissions */ if (dev->mode != 0000) { udev->mode = dev->mode; @@ -788,11 +806,6 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d /* rule matches */ if (dev->name[0] != '\0') { - /* apply all_partitions flag only at a main block device */ - if (dev->partitions > 0 && - (udev->type != 'b' || udev->kernel_number[0] != '\0')) - continue; - info("configured rule in '%s[%i]' applied, '%s' becomes '%s'", dev->config_file, dev->config_line, udev->kernel_name, dev->name); @@ -800,15 +813,10 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); strfieldcpy(udev->config_file, dev->config_file); udev->config_line = dev->config_line; - udev->ignore_remove = dev->ignore_remove; - - if (udev->type == 'n') - goto exit; - - udev->partitions = dev->partitions; - dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", - udev->name, udev->owner, udev->group, udev->mode, udev->partitions); + if (udev->type != 'n') + dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", + udev->name, udev->owner, udev->group, udev->mode, udev->partitions); goto exit; } diff --git a/namedev.h b/namedev.h index 43381bfbd6..1e1a9bbc34 100644 --- a/namedev.h +++ b/namedev.h @@ -50,9 +50,11 @@ struct sysfs_class_device; #define FIELD_OWNER "OWNER" #define FIELD_GROUP "GROUP" #define FIELD_MODE "MODE" +#define FIELD_OPTIONS "OPTIONS" -#define ATTR_PARTITIONS "all_partitions" +#define ATTR_IGNORE_DEVICE "ignore_device" #define ATTR_IGNORE_REMOVE "ignore_remove" +#define ATTR_PARTITIONS "all_partitions" #define MAX_SYSFS_PAIRS 5 @@ -77,11 +79,15 @@ struct config_device { char name[NAME_SIZE]; char symlink[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; + char owner[USER_SIZE]; char group[USER_SIZE]; mode_t mode; + int partitions; + int ignore_device; int ignore_remove; + char config_file[NAME_SIZE]; int config_line; }; diff --git a/namedev_parse.c b/namedev_parse.c index 7b5b963020..981daa7b3b 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -4,6 +4,7 @@ * Userspace devfs * * Copyright (C) 2003,2004 Greg Kroah-Hartman + * Copyright (C) 2003-2005 Kay Sievers * * * This program is free software; you can redistribute it and/or modify it @@ -247,6 +248,7 @@ static int namedev_parse(const char *filename, void *data) if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) { attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1); + /* FIXME: remove old style options and make OPTIONS= mandatory */ if (attr != NULL) { if (strstr(attr, ATTR_PARTITIONS) != NULL) { dbg_parse("creation of partition nodes requested"); @@ -286,6 +288,23 @@ static int namedev_parse(const char *filename, void *data) continue; } + if (strcasecmp(temp2, FIELD_OPTIONS) == 0) { + if (strstr(temp3, ATTR_IGNORE_DEVICE) != NULL) { + dbg_parse("device should be ignored"); + dev.ignore_device = 1; + } + if (strstr(temp3, ATTR_IGNORE_REMOVE) != NULL) { + dbg_parse("remove event should be ignored"); + dev.ignore_remove = 1; + } + if (strstr(temp3, ATTR_PARTITIONS) != NULL) { + dbg_parse("creation of partition nodes requested"); + dev.partitions = DEFAULT_PARTITIONS_COUNT; + } + valid = 1; + continue; + } + dbg("unknown type of field '%s'", temp2); goto error; } diff --git a/test/udev-test.pl b/test/udev-test.pl index fc0e89eeb3..5f9c0cb9c5 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1018,6 +1018,37 @@ EOF exp_name => "cdrom", conf => < "ignore rule test", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + exp_error => "yes", + conf => < "all_partitions, option-only rule", + subsys => "block", + devpath => "/block/sda", + exp_name => "node6", + conf => < "all_partitions, option-only rule (fail on partition)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "node6", + exp_error => "yes", + conf => < "node", exp_error => "yes", conf => < "yes", option => "clear", conf => <partitions > 0) { + if (udev->partitions) { struct sysfs_attribute *attr; int range; -- cgit v1.2.3-54-g00ecf From 3f930093f9ac79dca6bcc2dcbc8714c143709478 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 16 Feb 2005 23:20:48 +0100 Subject: [PATCH] libsysfs: work around a klibc bug --- libsysfs/sysfs_class.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index a132bb64cb..4ea7f41c99 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -111,7 +111,7 @@ static void set_classdev_classname(struct sysfs_class_device *cdev) if (c == NULL) { c = strstr(cdev->path, SYSFS_BLOCK_NAME); } else { - c = strstr(c, "/"); + c = strchr(c, '/'); } if (c == NULL) -- cgit v1.2.3-54-g00ecf From 1cec1c241600fc11121f9504bc9e95836c03bd9c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 18 Feb 2005 03:30:03 +0100 Subject: [PATCH] remove the device node only if the major/minor number matches --- test/udev-test.pl | 37 +++++++++++++++---------------------- udev_db.c | 9 +++++++++ udev_remove.c | 10 ++++++++++ 3 files changed, 34 insertions(+), 22 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 5f9c0cb9c5..fe7b932669 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -755,17 +755,6 @@ EOF BUS="scsi", KERNEL="sda", SYMLINK="symlink-only1" BUS="scsi", KERNEL="sda", SYMLINK="symlink-only2" BUS="scsi", KERNEL="sda", NAME="link", SYMLINK="symlink0" -EOF - }, - { - desc => "symlink name empty", - subsys => "block", - devpath => "/block/sda", - exp_name => "", - exp_target => "link", - exp_error => "yes", - conf => < "/block/sda", exp_name => ".", exp_target => "link", - exp_error => "yes", + exp_add_error => "yes", + exp_rem_error => "yes", conf => < "/block/sda", exp_name => "symlink", exp_target => "", - exp_error => "yes", + exp_add_error => "yes", conf => < "/block/sda", exp_name => "", exp_target => "", - exp_error => "yes", + exp_add_error => "yes", + exp_rem_error => "yes", conf => < "/class/tty/tty0", exp_name => "link", exp_target => "link", + exp_rem_error => "yes", + option => "clear", conf => < "block", devpath => "/block/sda", exp_name => "node", - exp_error => "yes", + exp_add_error => "yes", conf => < "block", devpath => "/block/sda/sda1", exp_name => "node6", - exp_error => "yes", + exp_add_error => "yes", conf => < "block", devpath => "/block/sda", exp_name => "node", - exp_error => "yes", + exp_rem_error => "yes", conf => < "block", devpath => "/block/sda", exp_name => "node14", - exp_error => "yes", + exp_rem_error => "yes", option => "clear", conf => <{exp_name}\' to \'$config->{exp_target}\'\n"; print "created symlink from: \'$config->{exp_name}\' to \'$2\'\n"; - if ($config->{exp_error}) { + if ($config->{exp_add_error}) { print "as expected "; } else { $error++; @@ -1234,7 +1227,7 @@ sub symlink_test { } else { print "expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; print "symlink: not created "; - if ($config->{exp_error}) { + if ($config->{exp_add_error}) { print "as expected "; } else { $error++; @@ -1273,7 +1266,7 @@ sub run_test { print "add: ok "; } else { print "add: error "; - if ($config->{exp_error}) { + if ($config->{exp_add_error}) { print "as expected "; } else { print "\n\n"; @@ -1292,7 +1285,7 @@ sub run_test { if ((-e "$PWD/$udev_root$config->{exp_name}") || (-l "$PWD/$udev_root$config->{exp_name}")) { print "remove: error "; - if ($config->{exp_error}) { + if ($config->{exp_rem_error}) { print "as expected\n\n"; } else { print "\n\n"; diff --git a/udev_db.c b/udev_db.c index df7cfbb259..0be7620ad7 100644 --- a/udev_db.c +++ b/udev_db.c @@ -79,6 +79,7 @@ int udev_db_add_device(struct udevice *udev) fprintf(f, "P:%s\n", udev->devpath); fprintf(f, "N:%s\n", udev->name); fprintf(f, "S:%s\n", udev->symlink); + fprintf(f, "M:%u:%u\n", udev->major, udev->minor); fprintf(f, "A:%u\n", udev->partitions); fprintf(f, "R:%u\n", udev->ignore_remove); @@ -90,6 +91,7 @@ int udev_db_add_device(struct udevice *udev) static int parse_db_file(struct udevice *udev, const char *filename) { char line[NAME_SIZE]; + char temp[NAME_SIZE]; char *bufline; char *buf; size_t bufsize; @@ -120,6 +122,13 @@ static int parse_db_file(struct udevice *udev, const char *filename) strncpy(udev->name, &bufline[2], count-2); udev->name[count-2] = '\0'; break; + case 'M': + if (count > NAME_SIZE) + count = NAME_SIZE-1; + strncpy(temp, &bufline[2], count-2); + temp[count-2] = '\0'; + sscanf(temp, "%u:%u", &udev->major, &udev->minor); + break; case 'S': if (count > NAME_SIZE) count = NAME_SIZE-1; diff --git a/udev_remove.c b/udev_remove.c index 172ec12690..baafdea51a 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -71,6 +71,7 @@ static int delete_node(struct udevice *udev) { char filename[NAME_SIZE]; char partitionname[NAME_SIZE]; + struct stat stats; int retval; int i; char *pos; @@ -80,6 +81,15 @@ static int delete_node(struct udevice *udev) snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); filename[NAME_SIZE-1] = '\0'; + dbg("checking major/minor of device node '%s'", filename); + if (stat(filename, &stats) != 0) + return -1; + + if (udev->major && stats.st_rdev != makedev(udev->major, udev->minor)) { + info("device node '%s' points to a different device, skip removal", filename); + return -1; + } + info("removing device node '%s'", filename); retval = unlink_secure(filename); if (retval) -- cgit v1.2.3-54-g00ecf From 7e720bd4ad8257d81d273d98294ebbcc03ade9ba Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 21 Feb 2005 13:44:39 +0100 Subject: [PATCH] switch major/minor to dev_t --- namedev.c | 13 +++++++------ udev.h | 5 ++--- udev_add.c | 43 +++++++++++++------------------------------ udev_db.c | 6 ++++-- udev_remove.c | 2 +- udev_sysfs.c | 17 +++++++++++++++++ udev_sysfs.h | 1 + 7 files changed, 45 insertions(+), 42 deletions(-) diff --git a/namedev.c b/namedev.c index 5c328594d4..e317cc685b 100644 --- a/namedev.c +++ b/namedev.c @@ -228,12 +228,12 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("substitute kernel number '%s'", udev->kernel_number); break; case 'm': - strintcatmax(string, udev->minor, maxsize); - dbg("substitute minor number '%u'", udev->minor); + strintcatmax(string, minor(udev->devt), maxsize); + dbg("substitute minor number '%u'", minor(udev->devt)); break; case 'M': - strintcatmax(string, udev->major, maxsize); - dbg("substitute major number '%u'", udev->major); + strintcatmax(string, major(udev->devt), maxsize); + dbg("substitute major number '%u'", major(udev->devt)); break; case 'c': if (strlen(udev->program_result) == 0) @@ -317,8 +317,9 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, case 'N': if (udev->tmp_node[0] == '\0') { dbg("create temporary device node for callout"); - snprintf(udev->tmp_node, NAME_SIZE-1, "%s/.tmp-%u-%u", udev_root, udev->major, udev->minor); - udev_make_node(udev, udev->tmp_node, udev->major, udev->minor, 0600, 0, 0); + snprintf(udev->tmp_node, NAME_SIZE, "%s/.tmp-%u-%u", udev_root, major(udev->devt), minor(udev->devt)); + udev->tmp_node[NAME_SIZE] = '\0'; + udev_make_node(udev, udev->tmp_node, udev->devt, 0600, 0, 0); } strfieldcatmax(string, udev->tmp_node, maxsize); dbg("substitute temporary device node name '%s'", udev->tmp_node); diff --git a/udev.h b/udev.h index c2f9859c5a..2d2ef364b6 100644 --- a/udev.h +++ b/udev.h @@ -58,8 +58,7 @@ struct udevice { char group[USER_SIZE]; mode_t mode; char type; - int major; - int minor; + dev_t devt; char devname[NAME_SIZE]; char tmp_node[NAME_SIZE]; @@ -79,7 +78,7 @@ extern int udev_remove_device(struct udevice *udev); extern void udev_init_config(void); extern int udev_start(void); extern void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix); -extern int udev_make_node(struct udevice *udev, const char *file, int major, int minor, mode_t mode, uid_t uid, gid_t gid); +extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); extern char sysfs_path[SYSFS_PATH_MAX]; extern char udev_root[PATH_MAX]; diff --git a/udev_add.c b/udev_add.c index f384ea96e5..66264f06e0 100644 --- a/udev_add.c +++ b/udev_add.c @@ -39,35 +39,15 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" #include "udev_utils.h" +#include "udev_sysfs.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" #include "udev_db.h" #include "udev_selinux.h" -/* - * the major/minor of a device is stored in a file called "dev" - * The number is stored in decimal values in the format: M:m - */ -static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) -{ - struct sysfs_attribute *attr = NULL; - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr == NULL) - goto error; - dbg("dev='%s'", attr->value); - - if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2) - goto error; - dbg("found major=%d, minor=%d", udev->major, udev->minor); - - return 0; -error: - return -1; -} - -int udev_make_node(struct udevice *udev, const char *file, int major, int minor, mode_t mode, uid_t uid, gid_t gid) +int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) { struct stat stats; int retval = 0; @@ -77,7 +57,7 @@ int udev_make_node(struct udevice *udev, const char *file, int major, int minor, /* preserve node with already correct numbers, to not change the inode number */ if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) && - (stats.st_rdev == makedev(major, minor))) { + (stats.st_rdev == devt)) { dbg("preserve file '%s', cause it has correct dev_t", file); selinux_setfilecon(file, udev->kernel_name, stats.st_mode); goto perms; @@ -106,10 +86,10 @@ create: } selinux_setfscreatecon(file, udev->kernel_name, mode); - retval = mknod(file, mode, makedev(major, minor)); + retval = mknod(file, mode, devt); if (retval != 0) { dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", - file, mode, major, minor, strerror(errno)); + file, mode, major(devt), minor(devt), strerror(errno)); goto exit; } @@ -185,12 +165,12 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de if (!udev->test_run) { info("creating device node '%s'", filename); - if (udev_make_node(udev, filename, udev->major, udev->minor, udev->mode, uid, gid) != 0) + if (udev_make_node(udev, filename, udev->devt, udev->mode, uid, gid) != 0) goto error; } else { info("creating device node '%s', major = '%d', minor = '%d', " "mode = '%#o', uid = '%d', gid = '%d'", filename, - udev->major, udev->minor, udev->mode, uid, gid); + major(udev->devt), minor(udev->devt), udev->mode, uid, gid); } /* create all_partitions if requested */ @@ -208,9 +188,12 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de info("creating device partition nodes '%s[1-%i]'", filename, udev->partitions); if (!udev->test_run) { for (i = 1; i <= udev->partitions; i++) { + dev_t part_devt; + strfieldcpy(partitionname, filename); strintcat(partitionname, i); - udev_make_node(udev, partitionname, udev->major, udev->minor + i, udev->mode, uid, gid); + part_devt = makedev(major(udev->devt), minor(udev->devt)+1); + udev_make_node(udev, partitionname, part_devt, udev->mode, uid, gid); } } } @@ -295,8 +278,8 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) int retval = 0; if (udev->type == 'b' || udev->type == 'c') { - retval = get_major_minor(class_dev, udev); - if (retval != 0) { + udev->devt = get_devt(class_dev); + if (!udev->devt) { dbg("no dev-file found, do nothing"); return 0; } diff --git a/udev_db.c b/udev_db.c index 0be7620ad7..b9c504430f 100644 --- a/udev_db.c +++ b/udev_db.c @@ -79,7 +79,7 @@ int udev_db_add_device(struct udevice *udev) fprintf(f, "P:%s\n", udev->devpath); fprintf(f, "N:%s\n", udev->name); fprintf(f, "S:%s\n", udev->symlink); - fprintf(f, "M:%u:%u\n", udev->major, udev->minor); + fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); fprintf(f, "A:%u\n", udev->partitions); fprintf(f, "R:%u\n", udev->ignore_remove); @@ -92,6 +92,7 @@ static int parse_db_file(struct udevice *udev, const char *filename) { char line[NAME_SIZE]; char temp[NAME_SIZE]; + unsigned int major, minor; char *bufline; char *buf; size_t bufsize; @@ -127,7 +128,8 @@ static int parse_db_file(struct udevice *udev, const char *filename) count = NAME_SIZE-1; strncpy(temp, &bufline[2], count-2); temp[count-2] = '\0'; - sscanf(temp, "%u:%u", &udev->major, &udev->minor); + sscanf(temp, "%u:%u", &major, &minor); + udev->devt = makedev(major, minor); break; case 'S': if (count > NAME_SIZE) diff --git a/udev_remove.c b/udev_remove.c index baafdea51a..3a3db737c1 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -85,7 +85,7 @@ static int delete_node(struct udevice *udev) if (stat(filename, &stats) != 0) return -1; - if (udev->major && stats.st_rdev != makedev(udev->major, udev->minor)) { + if (udev->devt && stats.st_rdev != udev->devt) { info("device node '%s' points to a different device, skip removal", filename); return -1; } diff --git a/udev_sysfs.c b/udev_sysfs.c index fd7330a161..f0666509ea 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -59,6 +59,23 @@ static const struct subsystem_file { { NULL, NULL } }; +dev_t get_devt(struct sysfs_class_device *class_dev) +{ + struct sysfs_attribute *attr = NULL; + unsigned int major, minor; + + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr == NULL) + return 0; + dbg("dev='%s'", attr->value); + + if (sscanf(attr->value, "%u:%u", &major, &minor) != 2) + return 0; + dbg("found major=%d, minor=%d", major, minor); + + return makedev(major, minor); +} + int subsystem_expect_no_dev(const char *subsystem) { const struct subsystem_file *file; diff --git a/udev_sysfs.h b/udev_sysfs.h index 98ff53e11a..77c0e6a8ef 100644 --- a/udev_sysfs.h +++ b/udev_sysfs.h @@ -27,6 +27,7 @@ #define WAIT_MAX_SECONDS 5 #define WAIT_LOOP_PER_SECOND 20 +extern dev_t get_devt(struct sysfs_class_device *class_dev); extern int subsystem_expect_no_dev(const char *subsystem); /* /sys/class /sys/block devices */ -- cgit v1.2.3-54-g00ecf From 5ef42682053f57fc031d420f0a2ae3e204421b8d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 21 Feb 2005 13:45:04 +0100 Subject: [PATCH] switch device type to enum --- namedev.c | 4 ++-- udev.c | 2 +- udev.h | 8 ++++++++ udev_add.c | 14 +++++--------- udev_remove.c | 2 +- udev_utils.c | 10 +++++----- udevtest.c | 2 +- 7 files changed, 23 insertions(+), 19 deletions(-) diff --git a/namedev.c b/namedev.c index e317cc685b..146dad604b 100644 --- a/namedev.c +++ b/namedev.c @@ -771,7 +771,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg_parse("remove event should be ignored"); } /* apply all_partitions option only at a main block device */ - if (dev->partitions && udev->type == 'b' && udev->kernel_number[0] == '\0') { + if (dev->partitions && udev->type == BLOCK && udev->kernel_number[0] == '\0') { udev->partitions = dev->partitions; dbg("creation of partition nodes requested"); } @@ -815,7 +815,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d strfieldcpy(udev->config_file, dev->config_file); udev->config_line = dev->config_line; - if (udev->type != 'n') + if (udev->type != NET) dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", udev->name, udev->owner, udev->group, udev->mode, udev->partitions); diff --git a/udev.c b/udev.c index 122d34c1a5..5dbade3c6f 100644 --- a/udev.c +++ b/udev.c @@ -179,7 +179,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("udev add"); /* skip subsystems without "dev", but handle net devices */ - if (udev.type != 'n' && subsystem_expect_no_dev(udev.subsystem)) { + if (udev.type != NET && subsystem_expect_no_dev(udev.subsystem)) { dbg("don't care about '%s' devices", udev.subsystem); goto hotplug; } diff --git a/udev.h b/udev.h index 2d2ef364b6..17ff4031c9 100644 --- a/udev.h +++ b/udev.h @@ -48,6 +48,14 @@ #define DEFAULT_PARTITIONS_COUNT 15 +enum device_type { + UNKNOWN, + CLASS, + BLOCK, + NET, + PHYSDEV, +}; + struct udevice { char devpath[DEVPATH_SIZE]; char subsystem[SUBSYSTEM_SIZE]; diff --git a/udev_add.c b/udev_add.c index 66264f06e0..eeab1ca174 100644 --- a/udev_add.c +++ b/udev_add.c @@ -70,16 +70,12 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo create: switch (udev->type) { - case 'b': + case BLOCK: mode |= S_IFBLK; break; - case 'c': - case 'u': + case CLASS: mode |= S_IFCHR; break; - case 'p': - mode |= S_IFIFO; - break; default: dbg("unknown node type %c\n", udev->type); return -EINVAL; @@ -277,7 +273,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) char *pos; int retval = 0; - if (udev->type == 'b' || udev->type == 'c') { + if (udev->type == BLOCK || udev->type == CLASS) { udev->devt = get_devt(class_dev); if (!udev->devt) { dbg("no dev-file found, do nothing"); @@ -292,7 +288,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) selinux_init(); - if (udev->type == 'b' || udev->type == 'c') { + if (udev->type == BLOCK || udev->type == CLASS) { retval = create_node(udev, class_dev); if (retval != 0) goto exit; @@ -305,7 +301,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) snprintf(udev->devname, NAME_SIZE, "%s/%s", udev_root, udev->name); udev->devname[NAME_SIZE-1] = '\0'; - } else if (udev->type == 'n') { + } else if (udev->type == NET) { /* look if we want to change the name of the netif */ if (strcmp(udev->name, udev->kernel_name) != 0) { retval = rename_net_if(udev); diff --git a/udev_remove.c b/udev_remove.c index 3a3db737c1..0ba6962cad 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -147,7 +147,7 @@ int udev_remove_device(struct udevice *udev) const char *temp; int retval; - if (udev->type != 'b' && udev->type != 'c') + if (udev->type != BLOCK && udev->type != CLASS) return 0; retval = udev_db_get_device(udev); diff --git a/udev_utils.c b/udev_utils.c index fda1f42f7e..e6580d2c0a 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -47,15 +47,15 @@ void udev_init_device(struct udevice *udev, const char* devpath, const char *sub strfieldcpy(udev->subsystem, subsystem); if (strcmp(udev->subsystem, "block") == 0) - udev->type = 'b'; + udev->type = BLOCK; else if (strcmp(udev->subsystem, "net") == 0) - udev->type = 'n'; + udev->type = NET; else if (strncmp(udev->devpath, "/block/", 7) == 0) - udev->type = 'b'; + udev->type = BLOCK; else if (strncmp(udev->devpath, "/class/net/", 11) == 0) - udev->type = 'n'; + udev->type = NET; else if (strncmp(udev->devpath, "/class/", 7) == 0) - udev->type = 'c'; + udev->type = CLASS; udev->mode = 0660; strcpy(udev->owner, "root"); diff --git a/udevtest.c b/udevtest.c index 4b94442608..4e02ac7dbc 100644 --- a/udevtest.c +++ b/udevtest.c @@ -94,7 +94,7 @@ int main(int argc, char *argv[], char *envp[]) udev_init_device(&udev, devpath, subsystem); /* skip subsystems without "dev", but handle net devices */ - if (udev.type != 'n' && subsystem_expect_no_dev(udev.subsystem)) { + if (udev.type != NET && subsystem_expect_no_dev(udev.subsystem)) { info("don't care about '%s' devices", udev.subsystem); return 2; } -- cgit v1.2.3-54-g00ecf From 311a2b0a1d65a1bd02bbedda0dda90f10d6b6788 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 21 Feb 2005 13:45:33 +0100 Subject: [PATCH] clean up match_place() --- namedev.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/namedev.c b/namedev.c index 146dad604b..aa45b79b13 100644 --- a/namedev.c +++ b/namedev.c @@ -553,32 +553,27 @@ static int match_id(struct config_device *dev, struct sysfs_class_device *class_ static int match_place(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { char path[SYSFS_PATH_MAX]; - int found; - char *temp = NULL; + char *temp; /* we have to have a sysfs device for PLACE to work */ if (!sysfs_device) return -ENODEV; - found = 0; strfieldcpy(path, sysfs_device->path); temp = strrchr(path, '/'); dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); - if (strstr(temp, dev->place) != NULL) { - found = 1; - } else { - *temp = 0x00; - temp = strrchr(path, '/'); - dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); - if (strstr(temp, dev->place) != NULL) - found = 1; - } - if (!found) { - dbg("place doesn't match"); - return -ENODEV; - } + if (strstr(temp, dev->place) != NULL) + return 0; - return 0; + /* try the parent */ + temp[0] = '\0'; + temp = strrchr(path, '/'); + dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); + if (strstr(temp, dev->place) == NULL) + return 0; + + dbg("place doesn't match"); + return -ENODEV; } static int match_rule(struct udevice *udev, struct config_device *dev, -- cgit v1.2.3-54-g00ecf From 8f2f6e426fc4cc1fa39b864a1792428a4269b751 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 21 Feb 2005 13:48:10 +0100 Subject: [PATCH] cleanup db functions --- namedev.c | 5 +++-- udev_db.c | 30 ++++++++++++++++-------------- udev_db.h | 2 +- udev_remove.c | 2 +- udevinfo.c | 3 +-- 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/namedev.c b/namedev.c index aa45b79b13..c1c22a6cfb 100644 --- a/namedev.c +++ b/namedev.c @@ -299,6 +299,8 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, } break; case 'P': + if (!class_dev) + break; class_dev_parent = sysfs_get_classdev_parent(class_dev); if (class_dev_parent != NULL) { struct udevice udev_parent; @@ -306,8 +308,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("found parent '%s', get the node name", class_dev_parent->path); memset(&udev_parent, 0x00, sizeof(struct udevice)); /* lookup the name in the udev_db with the DEVPATH of the parent */ - strfieldcpy(udev_parent.devpath, &class_dev_parent->path[strlen(sysfs_path)]); - if (udev_db_get_device(&udev_parent) == 0) { + if (udev_db_get_device_by_devpath(&udev_parent, &class_dev_parent->path[strlen(sysfs_path)]) == 0) { strfieldcatmax(string, udev_parent.name, maxsize); dbg("substitute parent node name'%s'", udev_parent.name); } else diff --git a/udev_db.c b/udev_db.c index b9c504430f..df63bbe2ce 100644 --- a/udev_db.c +++ b/udev_db.c @@ -4,7 +4,7 @@ * Userspace devfs * * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004-2005 Kay Sievers * * 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 @@ -39,19 +39,19 @@ #define PATH_TO_NAME_CHAR '@' -static int get_db_filename(struct udevice *udev, char *filename, int len) +static int get_db_filename(const char *devpath, char *filename, int len) { - char devpath[SYSFS_PATH_MAX]; + char temp[SYSFS_PATH_MAX]; char *pos; /* replace '/' to transform path into a filename */ - strfieldcpy(devpath, udev->devpath); - pos = strchr(&devpath[1], '/'); + strfieldcpy(temp, devpath); + pos = strchr(&temp[1], '/'); while (pos) { pos[0] = PATH_TO_NAME_CHAR; pos = strchr(&pos[1], '/'); } - snprintf(filename, len, "%s%s", udev_db_path, devpath); + snprintf(filename, len, "%s%s", udev_db_path, temp); filename[len-1] = '\0'; return 0; @@ -65,7 +65,7 @@ int udev_db_add_device(struct udevice *udev) if (udev->test_run) return 0; - get_db_filename(udev, filename, SYSFS_PATH_MAX); + get_db_filename(udev->devpath, filename, SYSFS_PATH_MAX); create_path(filename); @@ -160,23 +160,23 @@ static int parse_db_file(struct udevice *udev, const char *filename) return 0; } -int udev_db_get_device(struct udevice *udev) +int udev_db_delete_device(struct udevice *udev) { char filename[SYSFS_PATH_MAX]; - get_db_filename(udev, filename, SYSFS_PATH_MAX); + get_db_filename(udev->devpath, filename, SYSFS_PATH_MAX); + unlink(filename); - return parse_db_file(udev, filename); + return 0; } -int udev_db_delete_device(struct udevice *udev) +int udev_db_get_device_by_devpath(struct udevice *udev, const char *devpath) { char filename[SYSFS_PATH_MAX]; - get_db_filename(udev, filename, SYSFS_PATH_MAX); - unlink(filename); + get_db_filename(devpath, filename, SYSFS_PATH_MAX); - return 0; + return parse_db_file(udev, filename); } int udev_db_get_device_byname(struct udevice *udev, const char *name) @@ -234,6 +234,8 @@ found: strfieldcpy(udev->name, db_udev.name); strfieldcpy(udev->symlink, db_udev.symlink); udev->partitions = db_udev.partitions; + udev->ignore_remove = db_udev.ignore_remove; + udev->devt = db_udev.devt; return 0; } diff --git a/udev_db.h b/udev_db.h index 141c586f24..75f1d98296 100644 --- a/udev_db.h +++ b/udev_db.h @@ -26,9 +26,9 @@ extern int udev_db_add_device(struct udevice *dev); -extern int udev_db_get_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); +extern int udev_db_get_device_by_devpath(struct udevice *dev, const char *devpath); extern int udev_db_get_device_byname(struct udevice *udev, const char *name); #endif /* _UDEV_DB_H_ */ diff --git a/udev_remove.c b/udev_remove.c index 0ba6962cad..22a363ed34 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -150,7 +150,7 @@ int udev_remove_device(struct udevice *udev) if (udev->type != BLOCK && udev->type != CLASS) return 0; - retval = udev_db_get_device(udev); + retval = udev_db_get_device_by_devpath(udev, udev->devpath); if (retval) { /* fall back to kernel name */ temp = strrchr(udev->devpath, '/'); diff --git a/udevinfo.c b/udevinfo.c index a6daf46be6..e9de6e5e09 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -341,8 +341,7 @@ static int process_options(int argc, char *argv[]) } } memset(&udev, 0x00, sizeof(struct udevice)); - strfieldcpy(udev.devpath, pos); - retval = udev_db_get_device(&udev); + retval = udev_db_get_device_by_devpath(&udev, pos); if (retval != 0) { printf("device not found in database\n"); goto exit; -- cgit v1.2.3-54-g00ecf From 5e39f90b14ccf242618086a0242000fc11317a75 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 21 Feb 2005 14:01:23 +0100 Subject: [PATCH] trivial namedev cleanup --- namedev.c | 44 +++++++++++++++++++++++--------------------- namedev.h | 6 +++--- namedev_parse.c | 24 ++++++++++++------------ 3 files changed, 38 insertions(+), 36 deletions(-) diff --git a/namedev.c b/namedev.c index c1c22a6cfb..0a37ef2fbc 100644 --- a/namedev.c +++ b/namedev.c @@ -264,28 +264,30 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, } break; case 's': - if (attr != NULL) { - tmpattr = find_sysfs_attribute(class_dev, sysfs_device, attr); - if (tmpattr == NULL) { - dbg("sysfa attribute '%s' not found", attr); - break; - } - /* strip trailing whitespace of matching value */ - if (isspace(tmpattr->value[strlen(tmpattr->value)-1])) { - i = len = strlen(tmpattr->value); - while (i > 0 && isspace(tmpattr->value[i-1])) - i--; - if (i < len) { - tmpattr->value[i] = '\0'; - dbg("remove %i trailing whitespace chars from '%s'", - len - i, tmpattr->value); - } - } - strfieldcatmax(string, tmpattr->value, maxsize); - dbg("substitute sysfs value '%s'", tmpattr->value); - } else { + if (!class_dev) + break; + if (attr == NULL) { dbg("missing attribute"); + break; } + tmpattr = find_sysfs_attribute(class_dev, sysfs_device, attr); + if (tmpattr == NULL) { + dbg("sysfa attribute '%s' not found", attr); + break; + } + /* strip trailing whitespace of matching value */ + if (isspace(tmpattr->value[strlen(tmpattr->value)-1])) { + i = len = strlen(tmpattr->value); + while (i > 0 && isspace(tmpattr->value[i-1])) + i--; + if (i < len) { + tmpattr->value[i] = '\0'; + dbg("remove %i trailing whitespace chars from '%s'", + len - i, tmpattr->value); + } + } + strfieldcatmax(string, tmpattr->value, maxsize); + dbg("substitute sysfs value '%s'", tmpattr->value); break; case '%': strfieldcatmax(string, "%", maxsize); @@ -535,7 +537,7 @@ static int match_sysfs_pairs(struct config_device *dev, struct sysfs_class_devic static int match_id(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { char path[SYSFS_PATH_MAX]; - char *temp = NULL; + char *temp; /* we have to have a sysfs device for ID to work */ if (!sysfs_device) diff --git a/namedev.h b/namedev.h index 1e1a9bbc34..a929e52756 100644 --- a/namedev.h +++ b/namedev.h @@ -68,17 +68,17 @@ struct sysfs_pair { struct config_device { struct list_head node; + char kernel[NAME_SIZE]; + char subsystem[SUBSYSTEM_SIZE]; char bus[BUS_SIZE]; char id[ID_SIZE]; char place[PLACE_SIZE]; - char kernel[NAME_SIZE]; + struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; char program[PROGRAM_SIZE]; char result[PROGRAM_SIZE]; - char subsystem[SUBSYSTEM_SIZE]; char driver[DRIVER_SIZE]; char name[NAME_SIZE]; char symlink[NAME_SIZE]; - struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; char owner[USER_SIZE]; char group[USER_SIZE]; diff --git a/namedev_parse.c b/namedev_parse.c index 981daa7b3b..eabd9c98bb 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -171,6 +171,18 @@ static int namedev_parse(const char *filename, void *data) if (retval) break; + if (strcasecmp(temp2, FIELD_KERNEL) == 0) { + strfieldcpy(dev.kernel, temp3); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) { + strfieldcpy(dev.subsystem, temp3); + valid = 1; + continue; + } + if (strcasecmp(temp2, FIELD_BUS) == 0) { strfieldcpy(dev.bus, temp3); valid = 1; @@ -215,18 +227,6 @@ static int namedev_parse(const char *filename, void *data) continue; } - if (strcasecmp(temp2, FIELD_KERNEL) == 0) { - strfieldcpy(dev.kernel, temp3); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) { - strfieldcpy(dev.subsystem, temp3); - valid = 1; - continue; - } - if (strcasecmp(temp2, FIELD_DRIVER) == 0) { strfieldcpy(dev.driver, temp3); valid = 1; -- cgit v1.2.3-54-g00ecf From 69f57c6a2b94ae3b70a0ca43b46c30f8dce0a295 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 21 Feb 2005 14:05:52 +0100 Subject: [PATCH] detect NAME="" as ignore_device rule --- namedev.c | 9 --------- namedev_parse.c | 5 ++++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/namedev.c b/namedev.c index 0a37ef2fbc..a5c711bdf6 100644 --- a/namedev.c +++ b/namedev.c @@ -749,15 +749,6 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg("process rule"); if (match_rule(udev, dev, class_dev, sysfs_device) == 0) { - /* FIXME: remove old style ignore rule and make OPTION="ignore" mandatory */ - if (dev->name[0] == '\0' && dev->symlink[0] == '\0' && - dev->mode == 0000 && dev->owner[0] == '\0' && dev->group[0] == '\0' && - !dev->ignore_device && !dev->partitions && !dev->ignore_remove) { - info("configured rule in '%s[%i]' applied, '%s' is ignored", - dev->config_file, dev->config_line, udev->kernel_name); - return -1; - } - /* apply options */ if (dev->ignore_device) { info("configured rule in '%s[%i]' applied, '%s' is ignored", diff --git a/namedev_parse.c b/namedev_parse.c index eabd9c98bb..7cd676c390 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -259,7 +259,10 @@ static int namedev_parse(const char *filename, void *data) dev.ignore_remove = 1; } } - strfieldcpy(dev.name, temp3); + if (temp3[0] != '\0') + strfieldcpy(dev.name, temp3); + else + dev.ignore_device = 1; valid = 1; continue; } -- cgit v1.2.3-54-g00ecf From 9ed47a9f2186b67c0127049fdb4886284bc8a33d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 21 Feb 2005 14:48:12 +0100 Subject: [PATCH] move kernel name/number evaluation into udev_init_device() --- namedev.c | 33 ++++------------------------ namedev.h | 4 ++-- udev.h | 1 + udev_utils.c | 72 +++++++++++++++++++++++++++++++++++++++++++----------------- udev_utils.h | 2 +- 5 files changed, 60 insertions(+), 52 deletions(-) diff --git a/namedev.c b/namedev.c index a5c711bdf6..0463d4df0b 100644 --- a/namedev.c +++ b/namedev.c @@ -343,19 +343,6 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, } } -static void fix_kernel_name(struct udevice *udev) -{ - char *temp = udev->kernel_name; - - while (*temp != 0x00) { - /* Some block devices have a ! in their name, - * we need to change that to / */ - if (*temp == '!') - *temp = '/'; - ++temp; - } -} - static int execute_program(struct udevice *udev, const char *path, char *value, int len) { int retval; @@ -549,8 +536,8 @@ static int match_id(struct config_device *dev, struct sysfs_class_device *class_ dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); if (strcmp_pattern(dev->id, temp) != 0) return -ENODEV; - else - return 0; + + return 0; } static int match_place(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) @@ -582,7 +569,6 @@ static int match_place(struct config_device *dev, struct sysfs_class_device *cla static int match_rule(struct udevice *udev, struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { - /* check for matching kernel name */ if (dev->kernel[0] != '\0') { dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", dev->kernel, class_dev->name); @@ -593,7 +579,6 @@ static int match_rule(struct udevice *udev, struct config_device *dev, dbg(FIELD_KERNEL " matches"); } - /* check for matching subsystem */ if (dev->subsystem[0] != '\0') { dbg("check for " FIELD_SUBSYSTEM " dev->subsystem='%s' class_dev->name='%s'", dev->subsystem, class_dev->name); @@ -710,7 +695,6 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d struct sysfs_class_device *class_dev_parent; struct sysfs_device *sysfs_device = NULL; struct config_device *dev; - char *pos; dbg("class_dev->name='%s'", class_dev->name); @@ -733,16 +717,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d strfieldcpy(udev->bus_id, sysfs_device->bus_id); } - strfieldcpy(udev->kernel_name, class_dev->name); - fix_kernel_name(udev); - dbg("udev->kernel_name = '%s'", udev->kernel_name); - - /* get kernel number */ - pos = class_dev->name + strlen(class_dev->name); - while (isdigit(*(pos-1))) - pos--; - strfieldcpy(udev->kernel_number, pos); - dbg("kernel_number='%s'", udev->kernel_number); + dbg("udev->kernel_name='%s'", udev->kernel_name); /* look for a matching rule to apply */ list_for_each_entry(dev, &config_device_list, node) { @@ -781,7 +756,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); } - /* collect symlinks for this or the final matching rule */ + /* collect symlinks */ if (dev->symlink[0] != '\0') { char temp[NAME_SIZE]; diff --git a/namedev.h b/namedev.h index a929e52756..3a16144169 100644 --- a/namedev.h +++ b/namedev.h @@ -36,14 +36,14 @@ struct sysfs_class_device; #define DRIVER_SIZE 64 #define PROGRAM_SIZE 128 +#define FIELD_KERNEL "KERNEL" +#define FIELD_SUBSYSTEM "SUBSYSTEM" #define FIELD_BUS "BUS" #define FIELD_SYSFS "SYSFS" #define FIELD_ID "ID" #define FIELD_PLACE "PLACE" #define FIELD_PROGRAM "PROGRAM" #define FIELD_RESULT "RESULT" -#define FIELD_KERNEL "KERNEL" -#define FIELD_SUBSYSTEM "SUBSYSTEM" #define FIELD_DRIVER "DRIVER" #define FIELD_NAME "NAME" #define FIELD_SYMLINK "SYMLINK" diff --git a/udev.h b/udev.h index 17ff4031c9..d6dbd7c332 100644 --- a/udev.h +++ b/udev.h @@ -26,6 +26,7 @@ #include #include #include "libsysfs/sysfs/libsysfs.h" +#include "list.h" #define ALARM_TIMEOUT 120 #define COMMENT_CHARACTER '#' diff --git a/udev_utils.c b/udev_utils.c index e6580d2c0a..ea4aa25c90 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -37,12 +37,16 @@ #include "list.h" -void udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem) +int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem) { + char *pos; + memset(udev, 0x00, sizeof(struct udevice)); - if (devpath) + if (devpath) { strfieldcpy(udev->devpath, devpath); + no_trailing_slash(udev->devpath); + } if (subsystem) strfieldcpy(udev->subsystem, subsystem); @@ -60,6 +64,30 @@ void udev_init_device(struct udevice *udev, const char* devpath, const char *sub udev->mode = 0660; strcpy(udev->owner, "root"); strcpy(udev->group, "root"); + + /* get kernel name */ + pos = strrchr(udev->devpath, '/'); + if (pos == NULL) + return -1; + strfieldcpy(udev->kernel_name, &pos[1]); + + /* get kernel number */ + pos = &udev->kernel_name[strlen(udev->kernel_name)]; + while (isdigit(pos[-1])) + pos--; + strfieldcpy(udev->kernel_number, pos); + dbg("kernel_number='%s'", udev->kernel_number); + + /* Some block devices have '!' in their name, change that to '/' */ + pos = udev->kernel_name; + while (pos[0] != '\0') { + if (pos[0] == '!') + pos[0] = '/'; + pos++; + } + + dbg("kernel_name='%s'", udev->kernel_name); + return 0; } int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel) @@ -232,31 +260,35 @@ void no_trailing_slash(char *path) path[--len] = '\0'; } -struct files { - struct list_head list; +struct name_entry { + struct list_head node; char name[NAME_SIZE]; }; /* sort files in lexical order */ -static int file_list_insert(char *filename, struct list_head *file_list) +static int name_list_add(struct list_head *name_list, const char *name, int sort) { - struct files *loop_file; - struct files *new_file; - - list_for_each_entry(loop_file, file_list, list) { - if (strcmp(loop_file->name, filename) > 0) { - break; + struct name_entry *loop_name; + struct name_entry *new_name; + + list_for_each_entry(loop_name, name_list, node) { + /* avoid doubles */ + if (strcmp(loop_name->name, name) == 0) { + dbg("'%s' is already in the list", name); + return 0; } + if (sort && strcmp(loop_name->name, name) > 0) + break; } - new_file = malloc(sizeof(struct files)); - if (new_file == NULL) { + new_name = malloc(sizeof(struct name_entry)); + if (new_name == NULL) { dbg("error malloc"); return -ENOMEM; } - strfieldcpy(new_file->name, filename); - list_add_tail(&new_file->list, &loop_file->list); + strfieldcpy(new_name->name, name); + list_add_tail(&new_name->node, &loop_name->node); return 0; } @@ -267,8 +299,8 @@ int call_foreach_file(file_fnct_t fnct, const char *dirname, struct dirent *ent; DIR *dir; char *ext; - struct files *loop_file; - struct files *tmp_file; + struct name_entry *loop_file; + struct name_entry *tmp_file; LIST_HEAD(file_list); dbg("open directory '%s'", dirname); @@ -295,11 +327,11 @@ int call_foreach_file(file_fnct_t fnct, const char *dirname, continue; dbg("put file '%s/%s' in list", dirname, ent->d_name); - file_list_insert(ent->d_name, &file_list); + name_list_add(&file_list, ent->d_name, 1); } /* call function for every file in the list */ - list_for_each_entry_safe(loop_file, tmp_file, &file_list, list) { + list_for_each_entry_safe(loop_file, tmp_file, &file_list, node) { char filename[NAME_SIZE]; snprintf(filename, NAME_SIZE, "%s/%s", dirname, loop_file->name); @@ -307,7 +339,7 @@ int call_foreach_file(file_fnct_t fnct, const char *dirname, fnct(filename, data); - list_del(&loop_file->list); + list_del(&loop_file->node); free(loop_file); } diff --git a/udev_utils.h b/udev_utils.h index 19061f16f6..268c2075de 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -76,7 +76,7 @@ do { \ # define asmlinkage /* nothing */ #endif -extern void udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); +extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); extern int create_path(const char *path); extern int parse_get_pair(char **orig_string, char **left, char **right); -- cgit v1.2.3-54-g00ecf From 2a9a19245bc5ac49e9f1e1f5d073c53f611fa9e2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 21 Feb 2005 15:01:53 +0100 Subject: [PATCH] determine device type in udev_init_device() --- namedev.c | 1 - udev.c | 9 ++++----- udev_utils.c | 5 +++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/namedev.c b/namedev.c index 0463d4df0b..a365574435 100644 --- a/namedev.c +++ b/namedev.c @@ -201,7 +201,6 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("format=%c, string='%s', tail='%s'",c , string, tail); attr = get_format_attribute(&tail); - switch (c) { case 'p': if (strlen(udev->devpath) == 0) diff --git a/udev.c b/udev.c index 5dbade3c6f..7854bc74d0 100644 --- a/udev.c +++ b/udev.c @@ -152,18 +152,15 @@ int main(int argc, char *argv[], char *envp[]) /* older kernels passed the SUBSYSTEM only as argument */ if (!subsystem && argc == 2) subsystem = argv[1]; - udev_init_device(&udev, devpath, subsystem); if (!action) { dbg("no action"); goto hotplug; } - if (!subsystem) { dbg("no subsystem"); goto hotplug; } - if (!devpath) { dbg("no devpath"); goto hotplug; @@ -173,7 +170,9 @@ int main(int argc, char *argv[], char *envp[]) if (udev_log) setenv("UDEV_LOG", "1", 1); - if ((strncmp(devpath, "/block/", 7) == 0) || (strncmp(devpath, "/class/", 7) == 0)) { + udev_init_device(&udev, devpath, subsystem); + + if (udev.type == BLOCK || udev.type == CLASS || udev.type == NET) { if (strcmp(action, "add") == 0) { /* wait for sysfs and possibly add node */ dbg("udev add"); @@ -221,7 +220,7 @@ int main(int argc, char *argv[], char *envp[]) if (udev_dev_d) udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } - } else if ((strncmp(devpath, "/devices/", 9) == 0)) { + } else if (udev.type == PHYSDEV) { if (strcmp(action, "add") == 0) { /* wait for sysfs */ dbg("devices add"); diff --git a/udev_utils.c b/udev_utils.c index ea4aa25c90..c1e497626e 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -60,6 +60,8 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs udev->type = NET; else if (strncmp(udev->devpath, "/class/", 7) == 0) udev->type = CLASS; + else if (strncmp(udev->devpath, "/devices/", 9) == 0) + udev->type = PHYSDEV; udev->mode = 0660; strcpy(udev->owner, "root"); @@ -293,8 +295,7 @@ static int name_list_add(struct list_head *name_list, const char *name, int sort } /* calls function for every file found in specified directory */ -int call_foreach_file(file_fnct_t fnct, const char *dirname, - const char *suffix, void *data) +int call_foreach_file(file_fnct_t fnct, const char *dirname, const char *suffix, void *data) { struct dirent *ent; DIR *dir; -- cgit v1.2.3-54-g00ecf From 9f6f8859b0d17b4df2b739b0b0096f62b34de87a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 22 Feb 2005 21:55:46 +0100 Subject: [PATCH] add "serio" to bus list --- udev_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index f0666509ea..94c0164dec 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -307,6 +307,7 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "bttv-sub", .file = NULL }, { .bus = "pnp", .file = "detach_state" }, { .bus = "eisa", .file = "detach_state" }, + { .bus = "serio", .file = "detach_state" }, { .bus = "pseudo", .file = "detach_state" }, { .bus = "mmc", .file = "detach_state" }, { .bus = "macio", .file = "detach_state" }, -- cgit v1.2.3-54-g00ecf From e4d4a557e53c3fbcf14bd1bb29686fd884905b53 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 23 Feb 2005 02:58:31 +0100 Subject: [PATCH] udev_volume_id: volume_id v35 --- extras/volume_id/udev_volume_id.c | 2 +- extras/volume_id/volume_id/Makefile.inc | 92 +++--- extras/volume_id/volume_id/cramfs.c | 77 +++++ extras/volume_id/volume_id/cramfs.h | 26 ++ extras/volume_id/volume_id/cramfs/cramfs.c | 77 ----- extras/volume_id/volume_id/cramfs/cramfs.h | 26 -- extras/volume_id/volume_id/dasd.c | 197 ++++++++++++ extras/volume_id/volume_id/dasd.h | 26 ++ extras/volume_id/volume_id/dasd/dasd.c | 197 ------------ extras/volume_id/volume_id/dasd/dasd.h | 26 -- extras/volume_id/volume_id/ext.c | 90 ++++++ extras/volume_id/volume_id/ext.h | 26 ++ extras/volume_id/volume_id/ext/ext.c | 90 ------ extras/volume_id/volume_id/ext/ext.h | 26 -- extras/volume_id/volume_id/fat.c | 352 +++++++++++++++++++++ extras/volume_id/volume_id/fat.h | 26 ++ extras/volume_id/volume_id/fat/fat.c | 352 --------------------- extras/volume_id/volume_id/fat/fat.h | 26 -- extras/volume_id/volume_id/hfs.c | 310 ++++++++++++++++++ extras/volume_id/volume_id/hfs.h | 26 ++ extras/volume_id/volume_id/hfs/hfs.c | 310 ------------------ extras/volume_id/volume_id/hfs/hfs.h | 26 -- extras/volume_id/volume_id/highpoint.c | 72 +++++ extras/volume_id/volume_id/highpoint.h | 26 ++ extras/volume_id/volume_id/highpoint/highpoint.c | 72 ----- extras/volume_id/volume_id/highpoint/highpoint.h | 26 -- extras/volume_id/volume_id/hpfs.c | 69 ++++ extras/volume_id/volume_id/hpfs.h | 26 ++ extras/volume_id/volume_id/hpfs/hpfs.c | 69 ---- extras/volume_id/volume_id/hpfs/hpfs.h | 26 -- extras/volume_id/volume_id/iso9660.c | 119 +++++++ extras/volume_id/volume_id/iso9660.h | 26 ++ extras/volume_id/volume_id/iso9660/iso9660.c | 119 ------- extras/volume_id/volume_id/iso9660/iso9660.h | 26 -- extras/volume_id/volume_id/jfs.c | 78 +++++ extras/volume_id/volume_id/jfs.h | 26 ++ extras/volume_id/volume_id/jfs/jfs.c | 78 ----- extras/volume_id/volume_id/jfs/jfs.h | 26 -- extras/volume_id/volume_id/linux_raid.c | 99 ++++++ extras/volume_id/volume_id/linux_raid.h | 26 ++ extras/volume_id/volume_id/linux_raid/linux_raid.c | 99 ------ extras/volume_id/volume_id/linux_raid/linux_raid.h | 26 -- extras/volume_id/volume_id/linux_swap.c | 89 ++++++ extras/volume_id/volume_id/linux_swap.h | 26 ++ extras/volume_id/volume_id/linux_swap/linux_swap.c | 89 ------ extras/volume_id/volume_id/linux_swap/linux_swap.h | 26 -- extras/volume_id/volume_id/luks.c | 106 +++++++ extras/volume_id/volume_id/luks.h | 26 ++ extras/volume_id/volume_id/lvm.c | 110 +++++++ extras/volume_id/volume_id/lvm.h | 27 ++ extras/volume_id/volume_id/lvm/lvm.c | 110 ------- extras/volume_id/volume_id/lvm/lvm.h | 27 -- extras/volume_id/volume_id/mac.c | 144 +++++++++ extras/volume_id/volume_id/mac.h | 26 ++ extras/volume_id/volume_id/mac/mac.c | 144 --------- extras/volume_id/volume_id/mac/mac.h | 26 -- extras/volume_id/volume_id/msdos.c | 215 +++++++++++++ extras/volume_id/volume_id/msdos.h | 26 ++ extras/volume_id/volume_id/msdos/msdos.c | 215 ------------- extras/volume_id/volume_id/msdos/msdos.h | 26 -- extras/volume_id/volume_id/ntfs.c | 207 ++++++++++++ extras/volume_id/volume_id/ntfs.h | 26 ++ extras/volume_id/volume_id/ntfs/ntfs.c | 207 ------------ extras/volume_id/volume_id/ntfs/ntfs.h | 26 -- extras/volume_id/volume_id/reiserfs.c | 101 ++++++ extras/volume_id/volume_id/reiserfs.h | 26 ++ extras/volume_id/volume_id/reiserfs/reiserfs.c | 101 ------ extras/volume_id/volume_id/reiserfs/reiserfs.h | 26 -- extras/volume_id/volume_id/romfs.c | 73 +++++ extras/volume_id/volume_id/romfs.h | 26 ++ extras/volume_id/volume_id/romfs/romfs.c | 73 ----- extras/volume_id/volume_id/romfs/romfs.h | 26 -- extras/volume_id/volume_id/sysv.c | 146 +++++++++ extras/volume_id/volume_id/sysv.h | 26 ++ extras/volume_id/volume_id/sysv/sysv.c | 146 --------- extras/volume_id/volume_id/sysv/sysv.h | 26 -- extras/volume_id/volume_id/udf.c | 191 +++++++++++ extras/volume_id/volume_id/udf.h | 26 ++ extras/volume_id/volume_id/udf/udf.c | 191 ----------- extras/volume_id/volume_id/udf/udf.h | 26 -- extras/volume_id/volume_id/ufs.c | 223 +++++++++++++ extras/volume_id/volume_id/ufs.h | 26 ++ extras/volume_id/volume_id/ufs/ufs.c | 223 ------------- extras/volume_id/volume_id/ufs/ufs.h | 26 -- extras/volume_id/volume_id/util.c | 2 + extras/volume_id/volume_id/volume_id.c | 47 +-- extras/volume_id/volume_id/volume_id.h | 3 +- extras/volume_id/volume_id/xfs.c | 78 +++++ extras/volume_id/volume_id/xfs.h | 26 ++ extras/volume_id/volume_id/xfs/xfs.c | 78 ----- extras/volume_id/volume_id/xfs/xfs.h | 26 -- 91 files changed, 3799 insertions(+), 3653 deletions(-) create mode 100644 extras/volume_id/volume_id/cramfs.c create mode 100644 extras/volume_id/volume_id/cramfs.h delete mode 100644 extras/volume_id/volume_id/cramfs/cramfs.c delete mode 100644 extras/volume_id/volume_id/cramfs/cramfs.h create mode 100644 extras/volume_id/volume_id/dasd.c create mode 100644 extras/volume_id/volume_id/dasd.h delete mode 100644 extras/volume_id/volume_id/dasd/dasd.c delete mode 100644 extras/volume_id/volume_id/dasd/dasd.h create mode 100644 extras/volume_id/volume_id/ext.c create mode 100644 extras/volume_id/volume_id/ext.h delete mode 100644 extras/volume_id/volume_id/ext/ext.c delete mode 100644 extras/volume_id/volume_id/ext/ext.h create mode 100644 extras/volume_id/volume_id/fat.c create mode 100644 extras/volume_id/volume_id/fat.h delete mode 100644 extras/volume_id/volume_id/fat/fat.c delete mode 100644 extras/volume_id/volume_id/fat/fat.h create mode 100644 extras/volume_id/volume_id/hfs.c create mode 100644 extras/volume_id/volume_id/hfs.h delete mode 100644 extras/volume_id/volume_id/hfs/hfs.c delete mode 100644 extras/volume_id/volume_id/hfs/hfs.h create mode 100644 extras/volume_id/volume_id/highpoint.c create mode 100644 extras/volume_id/volume_id/highpoint.h delete mode 100644 extras/volume_id/volume_id/highpoint/highpoint.c delete mode 100644 extras/volume_id/volume_id/highpoint/highpoint.h create mode 100644 extras/volume_id/volume_id/hpfs.c create mode 100644 extras/volume_id/volume_id/hpfs.h delete mode 100644 extras/volume_id/volume_id/hpfs/hpfs.c delete mode 100644 extras/volume_id/volume_id/hpfs/hpfs.h create mode 100644 extras/volume_id/volume_id/iso9660.c create mode 100644 extras/volume_id/volume_id/iso9660.h delete mode 100644 extras/volume_id/volume_id/iso9660/iso9660.c delete mode 100644 extras/volume_id/volume_id/iso9660/iso9660.h create mode 100644 extras/volume_id/volume_id/jfs.c create mode 100644 extras/volume_id/volume_id/jfs.h delete mode 100644 extras/volume_id/volume_id/jfs/jfs.c delete mode 100644 extras/volume_id/volume_id/jfs/jfs.h create mode 100644 extras/volume_id/volume_id/linux_raid.c create mode 100644 extras/volume_id/volume_id/linux_raid.h delete mode 100644 extras/volume_id/volume_id/linux_raid/linux_raid.c delete mode 100644 extras/volume_id/volume_id/linux_raid/linux_raid.h create mode 100644 extras/volume_id/volume_id/linux_swap.c create mode 100644 extras/volume_id/volume_id/linux_swap.h delete mode 100644 extras/volume_id/volume_id/linux_swap/linux_swap.c delete mode 100644 extras/volume_id/volume_id/linux_swap/linux_swap.h create mode 100644 extras/volume_id/volume_id/luks.c create mode 100644 extras/volume_id/volume_id/luks.h create mode 100644 extras/volume_id/volume_id/lvm.c create mode 100644 extras/volume_id/volume_id/lvm.h delete mode 100644 extras/volume_id/volume_id/lvm/lvm.c delete mode 100644 extras/volume_id/volume_id/lvm/lvm.h create mode 100644 extras/volume_id/volume_id/mac.c create mode 100644 extras/volume_id/volume_id/mac.h delete mode 100644 extras/volume_id/volume_id/mac/mac.c delete mode 100644 extras/volume_id/volume_id/mac/mac.h create mode 100644 extras/volume_id/volume_id/msdos.c create mode 100644 extras/volume_id/volume_id/msdos.h delete mode 100644 extras/volume_id/volume_id/msdos/msdos.c delete mode 100644 extras/volume_id/volume_id/msdos/msdos.h create mode 100644 extras/volume_id/volume_id/ntfs.c create mode 100644 extras/volume_id/volume_id/ntfs.h delete mode 100644 extras/volume_id/volume_id/ntfs/ntfs.c delete mode 100644 extras/volume_id/volume_id/ntfs/ntfs.h create mode 100644 extras/volume_id/volume_id/reiserfs.c create mode 100644 extras/volume_id/volume_id/reiserfs.h delete mode 100644 extras/volume_id/volume_id/reiserfs/reiserfs.c delete mode 100644 extras/volume_id/volume_id/reiserfs/reiserfs.h create mode 100644 extras/volume_id/volume_id/romfs.c create mode 100644 extras/volume_id/volume_id/romfs.h delete mode 100644 extras/volume_id/volume_id/romfs/romfs.c delete mode 100644 extras/volume_id/volume_id/romfs/romfs.h create mode 100644 extras/volume_id/volume_id/sysv.c create mode 100644 extras/volume_id/volume_id/sysv.h delete mode 100644 extras/volume_id/volume_id/sysv/sysv.c delete mode 100644 extras/volume_id/volume_id/sysv/sysv.h create mode 100644 extras/volume_id/volume_id/udf.c create mode 100644 extras/volume_id/volume_id/udf.h delete mode 100644 extras/volume_id/volume_id/udf/udf.c delete mode 100644 extras/volume_id/volume_id/udf/udf.h create mode 100644 extras/volume_id/volume_id/ufs.c create mode 100644 extras/volume_id/volume_id/ufs.h delete mode 100644 extras/volume_id/volume_id/ufs/ufs.c delete mode 100644 extras/volume_id/volume_id/ufs/ufs.h create mode 100644 extras/volume_id/volume_id/xfs.c create mode 100644 extras/volume_id/volume_id/xfs.h delete mode 100644 extras/volume_id/volume_id/xfs/xfs.c delete mode 100644 extras/volume_id/volume_id/xfs/xfs.h diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 843b70baf5..c36b89f8bd 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -31,7 +31,7 @@ #include "../../udev_utils.h" #include "../../logging.h" #include "volume_id/volume_id.h" -#include "volume_id/dasd/dasd.h" +#include "volume_id/dasd.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) diff --git a/extras/volume_id/volume_id/Makefile.inc b/extras/volume_id/volume_id/Makefile.inc index d010f7778e..9cadec20cc 100644 --- a/extras/volume_id/volume_id/Makefile.inc +++ b/extras/volume_id/volume_id/Makefile.inc @@ -1,48 +1,50 @@ -VOLUME_ID_OBJS= \ - $(VOLUME_ID_BASE)/ext/ext.o \ - $(VOLUME_ID_BASE)/fat/fat.o \ - $(VOLUME_ID_BASE)/hfs/hfs.o \ - $(VOLUME_ID_BASE)/highpoint/highpoint.o \ - $(VOLUME_ID_BASE)/iso9660/iso9660.o \ - $(VOLUME_ID_BASE)/jfs/jfs.o \ - $(VOLUME_ID_BASE)/linux_raid/linux_raid.o \ - $(VOLUME_ID_BASE)/linux_swap/linux_swap.o \ - $(VOLUME_ID_BASE)/lvm/lvm.o \ - $(VOLUME_ID_BASE)/mac/mac.o \ - $(VOLUME_ID_BASE)/msdos/msdos.o \ - $(VOLUME_ID_BASE)/ntfs/ntfs.o \ - $(VOLUME_ID_BASE)/reiserfs/reiserfs.o \ - $(VOLUME_ID_BASE)/udf/udf.o \ - $(VOLUME_ID_BASE)/ufs/ufs.o \ - $(VOLUME_ID_BASE)/xfs/xfs.o \ - $(VOLUME_ID_BASE)/cramfs/cramfs.o \ - $(VOLUME_ID_BASE)/hpfs/hpfs.o \ - $(VOLUME_ID_BASE)/romfs/romfs.o \ - $(VOLUME_ID_BASE)/sysv/sysv.o \ - $(VOLUME_ID_BASE)/dasd/dasd.o \ - $(VOLUME_ID_BASE)/volume_id.o \ +VOLUME_ID_OBJS= \ + $(VOLUME_ID_BASE)/ext.o \ + $(VOLUME_ID_BASE)/fat.o \ + $(VOLUME_ID_BASE)/hfs.o \ + $(VOLUME_ID_BASE)/highpoint.o \ + $(VOLUME_ID_BASE)/iso9660.o \ + $(VOLUME_ID_BASE)/jfs.o \ + $(VOLUME_ID_BASE)/linux_raid.o \ + $(VOLUME_ID_BASE)/linux_swap.o \ + $(VOLUME_ID_BASE)/lvm.o \ + $(VOLUME_ID_BASE)/mac.o \ + $(VOLUME_ID_BASE)/msdos.o \ + $(VOLUME_ID_BASE)/ntfs.o \ + $(VOLUME_ID_BASE)/reiserfs.o \ + $(VOLUME_ID_BASE)/udf.o \ + $(VOLUME_ID_BASE)/ufs.o \ + $(VOLUME_ID_BASE)/xfs.o \ + $(VOLUME_ID_BASE)/cramfs.o \ + $(VOLUME_ID_BASE)/hpfs.o \ + $(VOLUME_ID_BASE)/romfs.o \ + $(VOLUME_ID_BASE)/sysv.o \ + $(VOLUME_ID_BASE)/dasd.o \ + $(VOLUME_ID_BASE)/luks.o \ + $(VOLUME_ID_BASE)/volume_id.o \ $(VOLUME_ID_BASE)/util.o -VOLUME_ID_HEADERS= \ - $(VOLUME_ID_BASE)/ext/ext.h \ - $(VOLUME_ID_BASE)/fat/fat.h \ - $(VOLUME_ID_BASE)/hfs/hfs.h \ - $(VOLUME_ID_BASE)/highpoint/highpoint.h \ - $(VOLUME_ID_BASE)/iso9660/iso9660.h \ - $(VOLUME_ID_BASE)/jfs/jfs.h \ - $(VOLUME_ID_BASE)/linux_raid/linux_raid.h \ - $(VOLUME_ID_BASE)/linux_swap/linux_swap.h \ - $(VOLUME_ID_BASE)/lvm/lvm.h \ - $(VOLUME_ID_BASE)/mac/mac.h \ - $(VOLUME_ID_BASE)/msdos/msdos.h \ - $(VOLUME_ID_BASE)/ntfs/ntfs.h \ - $(VOLUME_ID_BASE)/reiserfs/reiserfs.h \ - $(VOLUME_ID_BASE)/udf/udf.h \ - $(VOLUME_ID_BASE)/ufs/ufs.h \ - $(VOLUME_ID_BASE)/xfs/xfs.h \ - $(VOLUME_ID_BASE)/cramfs/cramfs.h \ - $(VOLUME_ID_BASE)/sysv/sysv.h \ - $(VOLUME_ID_BASE)/romfs/romfs.h \ - $(VOLUME_ID_BASE)/dasd/dasd.h \ - $(VOLUME_ID_BASE)/volume_id.h \ +VOLUME_ID_HEADERS= \ + $(VOLUME_ID_BASE)/ext.h \ + $(VOLUME_ID_BASE)/fat.h \ + $(VOLUME_ID_BASE)/hfs.h \ + $(VOLUME_ID_BASE)/highpoint.h \ + $(VOLUME_ID_BASE)/iso9660.h \ + $(VOLUME_ID_BASE)/jfs.h \ + $(VOLUME_ID_BASE)/linux_raid.h \ + $(VOLUME_ID_BASE)/linux_swap.h \ + $(VOLUME_ID_BASE)/lvm.h \ + $(VOLUME_ID_BASE)/mac.h \ + $(VOLUME_ID_BASE)/msdos.h \ + $(VOLUME_ID_BASE)/ntfs.h \ + $(VOLUME_ID_BASE)/reiserfs.h \ + $(VOLUME_ID_BASE)/udf.h \ + $(VOLUME_ID_BASE)/ufs.h \ + $(VOLUME_ID_BASE)/xfs.h \ + $(VOLUME_ID_BASE)/cramfs.h \ + $(VOLUME_ID_BASE)/sysv.h \ + $(VOLUME_ID_BASE)/romfs.h \ + $(VOLUME_ID_BASE)/dasd.h \ + $(VOLUME_ID_BASE)/luks.h \ + $(VOLUME_ID_BASE)/volume_id.h \ $(VOLUME_ID_BASE)/util.h diff --git a/extras/volume_id/volume_id/cramfs.c b/extras/volume_id/volume_id/cramfs.c new file mode 100644 index 0000000000..a8058646d1 --- /dev/null +++ b/extras/volume_id/volume_id/cramfs.c @@ -0,0 +1,77 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "cramfs.h" + +struct cramfs_super { + __u8 magic[4]; + __u32 size; + __u32 flags; + __u32 future; + __u8 signature[16]; + struct cramfs_info { + __u32 crc; + __u32 edition; + __u32 blocks; + __u32 files; + } __attribute__((__packed__)) info; + __u8 name[16]; +} __attribute__((__packed__)); + +int volume_id_probe_cramfs(struct volume_id *id, __u64 off) +{ + struct cramfs_super *cs; + + dbg("probing at offset %llu", off); + + cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); + if (cs == NULL) + return -1; + + if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0) { + volume_id_set_label_raw(id, cs->name, 16); + volume_id_set_label_string(id, cs->name, 16); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "cramfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/volume_id/cramfs.h b/extras/volume_id/volume_id/cramfs.h new file mode 100644 index 0000000000..b94445b8b7 --- /dev/null +++ b/extras/volume_id/volume_id/cramfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_CRAMFS_ +#define _VOLUME_ID_CRAMFS_ + +extern int volume_id_probe_cramfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/cramfs/cramfs.c b/extras/volume_id/volume_id/cramfs/cramfs.c deleted file mode 100644 index a1d51f107d..0000000000 --- a/extras/volume_id/volume_id/cramfs/cramfs.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "cramfs.h" - -struct cramfs_super { - __u8 magic[4]; - __u32 size; - __u32 flags; - __u32 future; - __u8 signature[16]; - struct cramfs_info { - __u32 crc; - __u32 edition; - __u32 blocks; - __u32 files; - } __attribute__((__packed__)) info; - __u8 name[16]; -} __attribute__((__packed__)); - -int volume_id_probe_cramfs(struct volume_id *id, __u64 off) -{ - struct cramfs_super *cs; - - dbg("probing at offset %llu", off); - - cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); - if (cs == NULL) - return -1; - - if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0) { - volume_id_set_label_raw(id, cs->name, 16); - volume_id_set_label_string(id, cs->name, 16); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "cramfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/volume_id/cramfs/cramfs.h b/extras/volume_id/volume_id/cramfs/cramfs.h deleted file mode 100644 index b94445b8b7..0000000000 --- a/extras/volume_id/volume_id/cramfs/cramfs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_CRAMFS_ -#define _VOLUME_ID_CRAMFS_ - -extern int volume_id_probe_cramfs(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/dasd.c b/extras/volume_id/volume_id/dasd.c new file mode 100644 index 0000000000..6f403cb928 --- /dev/null +++ b/extras/volume_id/volume_id/dasd.c @@ -0,0 +1,197 @@ +/* + * dasdlabel - read label from s390 block device + * + * Copyright (C) 2004 Arnd Bergmann + * + * 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 02139, USA. + * + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "dasd.h" + +static unsigned char EBCtoASC[256] = +{ +/* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ + 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, +/* 0x08 -GE -SPS -RPT VT FF CR SO SI */ + 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, +/* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC + -ENP ->LF */ + 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, +/* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB + -IUS */ + 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +/* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC + -INP */ + 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, +/* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL + -SW */ + 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, +/* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ + 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, +/* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ + 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, +/* 0x40 SP RSP ä ---- */ + 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, +/* 0x48 . < ( + | */ + 0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, +/* 0x50 & ---- */ + 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, +/* 0x58 ß ! $ * ) ; */ + 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, +/* 0x60 - / ---- Ä ---- ---- ---- */ + 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, +/* 0x68 ---- , % _ > ? */ + 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, +/* 0x70 --- ---- ---- ---- ---- ---- ---- */ + 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +/* 0x78 * ` : # @ ' = " */ + 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, +/* 0x80 * a b c d e f g */ + 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, +/* 0x88 h i ---- ---- ---- */ + 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, +/* 0x90 ° j k l m n o p */ + 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, +/* 0x98 q r ---- ---- */ + 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, +/* 0xA0 ~ s t u v w x */ + 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, +/* 0xA8 y z ---- ---- ---- ---- */ + 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, +/* 0xB0 ^ ---- § ---- */ + 0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, +/* 0xB8 ---- [ ] ---- ---- ---- ---- */ + 0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07, +/* 0xC0 { A B C D E F G */ + 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, +/* 0xC8 H I ---- ö ---- */ + 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, +/* 0xD0 } J K L M N O P */ + 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, +/* 0xD8 Q R ---- ü */ + 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, +/* 0xE0 \ S T U V W X */ + 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, +/* 0xE8 Y Z ---- Ö ---- ---- ---- */ + 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, +/* 0xF0 0 1 2 3 4 5 6 7 */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, +/* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ + 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 +}; + +static void vtoc_ebcdic_dec (const unsigned char *source, unsigned char *target, int l) +{ + int i; + + for (i = 0; i < l; i++) + target[i]=EBCtoASC[(unsigned char)(source[i])]; +} + +/* + * struct dasd_information_t + * represents any data about the data, which is visible to userspace + */ +typedef struct dasd_information_t { + unsigned int devno; /* S/390 devno */ + unsigned int real_devno; /* for aliases */ + unsigned int schid; /* S/390 subchannel identifier */ + unsigned int cu_type : 16; /* from SenseID */ + unsigned int cu_model : 8; /* from SenseID */ + unsigned int dev_type : 16; /* from SenseID */ + unsigned int dev_model : 8; /* from SenseID */ + unsigned int open_count; + unsigned int req_queue_len; + unsigned int chanq_len; /* length of chanq */ + char type[4]; /* from discipline.name, 'none' for unknown */ + unsigned int status; /* current device level */ + unsigned int label_block; /* where to find the VOLSER */ + unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ + unsigned int characteristics_size; + unsigned int confdata_size; + char characteristics[64]; /* from read_device_characteristics */ + char configuration_data[256]; /* from read_configuration_data */ +} dasd_information_t; + +#define _IOC_NRBITS 8 +#define _IOC_TYPEBITS 8 +#define _IOC_SIZEBITS 14 +#define _IOC_DIRBITS 2 +#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) +#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) +#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) +#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) +#define _IOC_NRSHIFT 0 +#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) +#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) +#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) +#define DASD_IOCTL_LETTER 'D' + +#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) +#define BLKSSZGET _IO(0x12,104) + +int volume_id_probe_dasd(struct volume_id *id) +{ + int blocksize; + dasd_information_t info; + __u8 *data; + __u8 *label_raw; + unsigned char name[7]; + + dbg("probing"); + + if (ioctl(id->fd, BIODASDINFO, &info) != 0) + return -1; + + if (ioctl(id->fd, BLKSSZGET, &blocksize) != 0) + return -1; + + data = volume_id_get_buffer(id, info.label_block * blocksize, 16); + if (data == NULL) + return -1; + + if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) + label_raw = &data[8]; + else + label_raw = &data[4]; + + name[6] = '\0'; + volume_id_set_usage(id, VOLUME_ID_DISKLABEL); + id->type = "dasd"; + volume_id_set_label_raw(id, label_raw, 6); + vtoc_ebcdic_dec(label_raw, name, 6); + volume_id_set_label_string(id, name, 6); + + return 0; +} diff --git a/extras/volume_id/volume_id/dasd.h b/extras/volume_id/volume_id/dasd.h new file mode 100644 index 0000000000..751b9fda60 --- /dev/null +++ b/extras/volume_id/volume_id/dasd.h @@ -0,0 +1,26 @@ +/* + * dasdlabel - read label from s390 block device + * + * Copyright (C) 2004 Arnd Bergmann + * + * 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 02139, USA. + * + */ + +#ifndef _VOLUME_ID_DASDLABEL_ +#define _VOLUME_ID_DASDLABEL_ + +extern int volume_id_probe_dasd(struct volume_id *id); + +#endif diff --git a/extras/volume_id/volume_id/dasd/dasd.c b/extras/volume_id/volume_id/dasd/dasd.c deleted file mode 100644 index 2df6a09e81..0000000000 --- a/extras/volume_id/volume_id/dasd/dasd.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * dasdlabel - read label from s390 block device - * - * Copyright (C) 2004 Arnd Bergmann - * - * 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 02139, USA. - * - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "dasd.h" - -static unsigned char EBCtoASC[256] = -{ -/* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ - 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, -/* 0x08 -GE -SPS -RPT VT FF CR SO SI */ - 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -/* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC - -ENP ->LF */ - 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, -/* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB - -IUS */ - 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -/* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC - -INP */ - 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, -/* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL - -SW */ - 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, -/* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ - 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, -/* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ - 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, -/* 0x40 SP RSP ä ---- */ - 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, -/* 0x48 . < ( + | */ - 0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, -/* 0x50 & ---- */ - 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, -/* 0x58 ß ! $ * ) ; */ - 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, -/* 0x60 - / ---- Ä ---- ---- ---- */ - 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, -/* 0x68 ---- , % _ > ? */ - 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, -/* 0x70 --- ---- ---- ---- ---- ---- ---- */ - 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -/* 0x78 * ` : # @ ' = " */ - 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, -/* 0x80 * a b c d e f g */ - 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, -/* 0x88 h i ---- ---- ---- */ - 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, -/* 0x90 ° j k l m n o p */ - 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, -/* 0x98 q r ---- ---- */ - 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, -/* 0xA0 ~ s t u v w x */ - 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, -/* 0xA8 y z ---- ---- ---- ---- */ - 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, -/* 0xB0 ^ ---- § ---- */ - 0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, -/* 0xB8 ---- [ ] ---- ---- ---- ---- */ - 0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07, -/* 0xC0 { A B C D E F G */ - 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, -/* 0xC8 H I ---- ö ---- */ - 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, -/* 0xD0 } J K L M N O P */ - 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, -/* 0xD8 Q R ---- ü */ - 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, -/* 0xE0 \ S T U V W X */ - 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, -/* 0xE8 Y Z ---- Ö ---- ---- ---- */ - 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, -/* 0xF0 0 1 2 3 4 5 6 7 */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, -/* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ - 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 -}; - -static void vtoc_ebcdic_dec (const unsigned char *source, unsigned char *target, int l) -{ - int i; - - for (i = 0; i < l; i++) - target[i]=EBCtoASC[(unsigned char)(source[i])]; -} - -/* - * struct dasd_information_t - * represents any data about the data, which is visible to userspace - */ -typedef struct dasd_information_t { - unsigned int devno; /* S/390 devno */ - unsigned int real_devno; /* for aliases */ - unsigned int schid; /* S/390 subchannel identifier */ - unsigned int cu_type : 16; /* from SenseID */ - unsigned int cu_model : 8; /* from SenseID */ - unsigned int dev_type : 16; /* from SenseID */ - unsigned int dev_model : 8; /* from SenseID */ - unsigned int open_count; - unsigned int req_queue_len; - unsigned int chanq_len; /* length of chanq */ - char type[4]; /* from discipline.name, 'none' for unknown */ - unsigned int status; /* current device level */ - unsigned int label_block; /* where to find the VOLSER */ - unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ - unsigned int characteristics_size; - unsigned int confdata_size; - char characteristics[64]; /* from read_device_characteristics */ - char configuration_data[256]; /* from read_configuration_data */ -} dasd_information_t; - -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 14 -#define _IOC_DIRBITS 2 -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) -#define DASD_IOCTL_LETTER 'D' - -#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) -#define BLKSSZGET _IO(0x12,104) - -int volume_id_probe_dasd(struct volume_id *id) -{ - int blocksize; - dasd_information_t info; - __u8 *data; - __u8 *label_raw; - unsigned char name[7]; - - dbg("probing"); - - if (ioctl(id->fd, BIODASDINFO, &info) != 0) - return -1; - - if (ioctl(id->fd, BLKSSZGET, &blocksize) != 0) - return -1; - - data = volume_id_get_buffer(id, info.label_block * blocksize, 16); - if (data == NULL) - return -1; - - if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) - label_raw = &data[8]; - else - label_raw = &data[4]; - - name[6] = '\0'; - volume_id_set_usage(id, VOLUME_ID_DISKLABEL); - id->type = "dasd"; - volume_id_set_label_raw(id, label_raw, 6); - vtoc_ebcdic_dec(label_raw, name, 6); - volume_id_set_label_string(id, name, 6); - - return 0; -} diff --git a/extras/volume_id/volume_id/dasd/dasd.h b/extras/volume_id/volume_id/dasd/dasd.h deleted file mode 100644 index 751b9fda60..0000000000 --- a/extras/volume_id/volume_id/dasd/dasd.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * dasdlabel - read label from s390 block device - * - * Copyright (C) 2004 Arnd Bergmann - * - * 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 02139, USA. - * - */ - -#ifndef _VOLUME_ID_DASDLABEL_ -#define _VOLUME_ID_DASDLABEL_ - -extern int volume_id_probe_dasd(struct volume_id *id); - -#endif diff --git a/extras/volume_id/volume_id/ext.c b/extras/volume_id/volume_id/ext.c new file mode 100644 index 0000000000..b7bdf05d97 --- /dev/null +++ b/extras/volume_id/volume_id/ext.c @@ -0,0 +1,90 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "util.h" +#include "logging.h" +#include "ext.h" + +struct ext2_super_block { + __u32 inodes_count; + __u32 blocks_count; + __u32 r_blocks_count; + __u32 free_blocks_count; + __u32 free_inodes_count; + __u32 first_data_block; + __u32 log_block_size; + __u32 dummy3[7]; + __u8 magic[2]; + __u16 state; + __u32 dummy5[8]; + __u32 feature_compat; + __u32 feature_incompat; + __u32 feature_ro_compat; + __u8 uuid[16]; + __u8 volume_name[16]; +} __attribute__((__packed__)); + +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 +#define EXT_SUPERBLOCK_OFFSET 0x400 + +int volume_id_probe_ext(struct volume_id *id, __u64 off) +{ + struct ext2_super_block *es; + + dbg("probing at offset %llu", off); + + es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); + if (es == NULL) + return -1; + + if (es->magic[0] != 0123 || + es->magic[1] != 0357) + return -1; + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + volume_id_set_label_raw(id, es->volume_name, 16); + volume_id_set_label_string(id, es->volume_name, 16); + volume_id_set_uuid(id, es->uuid, UUID_DCE); + + if ((le32_to_cpu(es->feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) + id->type = "ext3"; + else + id->type = "ext2"; + + return 0; +} diff --git a/extras/volume_id/volume_id/ext.h b/extras/volume_id/volume_id/ext.h new file mode 100644 index 0000000000..6b9b85876b --- /dev/null +++ b/extras/volume_id/volume_id/ext.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_EXT_ +#define _VOLUME_ID_EXT_ + +extern int volume_id_probe_ext(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/ext/ext.c b/extras/volume_id/volume_id/ext/ext.c deleted file mode 100644 index 0940e452fc..0000000000 --- a/extras/volume_id/volume_id/ext/ext.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../util.h" -#include "../logging.h" -#include "ext.h" - -struct ext2_super_block { - __u32 inodes_count; - __u32 blocks_count; - __u32 r_blocks_count; - __u32 free_blocks_count; - __u32 free_inodes_count; - __u32 first_data_block; - __u32 log_block_size; - __u32 dummy3[7]; - __u8 magic[2]; - __u16 state; - __u32 dummy5[8]; - __u32 feature_compat; - __u32 feature_incompat; - __u32 feature_ro_compat; - __u8 uuid[16]; - __u8 volume_name[16]; -} __attribute__((__packed__)); - -#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 -#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 -#define EXT_SUPERBLOCK_OFFSET 0x400 - -int volume_id_probe_ext(struct volume_id *id, __u64 off) -{ - struct ext2_super_block *es; - - dbg("probing at offset %llu", off); - - es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); - if (es == NULL) - return -1; - - if (es->magic[0] != 0123 || - es->magic[1] != 0357) - return -1; - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - volume_id_set_label_raw(id, es->volume_name, 16); - volume_id_set_label_string(id, es->volume_name, 16); - volume_id_set_uuid(id, es->uuid, UUID_DCE); - - if ((le32_to_cpu(es->feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) - id->type = "ext3"; - else - id->type = "ext2"; - - return 0; -} diff --git a/extras/volume_id/volume_id/ext/ext.h b/extras/volume_id/volume_id/ext/ext.h deleted file mode 100644 index 6b9b85876b..0000000000 --- a/extras/volume_id/volume_id/ext/ext.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_EXT_ -#define _VOLUME_ID_EXT_ - -extern int volume_id_probe_ext(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/fat.c b/extras/volume_id/volume_id/fat.c new file mode 100644 index 0000000000..58aa2aba05 --- /dev/null +++ b/extras/volume_id/volume_id/fat.c @@ -0,0 +1,352 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "fat.h" + +#define FAT12_MAX 0xff5 +#define FAT16_MAX 0xfff5 +#define FAT_ATTR_VOLUME_ID 0x08 +#define FAT_ATTR_DIR 0x10 +#define FAT_ATTR_LONG_NAME 0x0f +#define FAT_ATTR_MASK 0x3f +#define FAT_ENTRY_FREE 0xe5 + +struct vfat_super_block { + __u8 boot_jump[3]; + __u8 sysid[8]; + __u16 sector_size; + __u8 sectors_per_cluster; + __u16 reserved; + __u8 fats; + __u16 dir_entries; + __u16 sectors; + __u8 media; + __u16 fat_length; + __u16 secs_track; + __u16 heads; + __u32 hidden; + __u32 total_sect; + union { + struct fat_super_block { + __u8 unknown[3]; + __u8 serno[4]; + __u8 label[11]; + __u8 magic[8]; + __u8 dummy2[192]; + __u8 pmagic[2]; + } __attribute__((__packed__)) fat; + struct fat32_super_block { + __u32 fat32_length; + __u16 flags; + __u8 version[2]; + __u32 root_cluster; + __u16 insfo_sector; + __u16 backup_boot; + __u16 reserved2[6]; + __u8 unknown[3]; + __u8 serno[4]; + __u8 label[11]; + __u8 magic[8]; + __u8 dummy2[164]; + __u8 pmagic[2]; + } __attribute__((__packed__)) fat32; + } __attribute__((__packed__)) type; +} __attribute__((__packed__)); + +struct vfat_dir_entry { + __u8 name[11]; + __u8 attr; + __u16 time_creat; + __u16 date_creat; + __u16 time_acc; + __u16 date_acc; + __u16 cluster_high; + __u16 time_write; + __u16 date_write; + __u16 cluster_low; + __u32 size; +} __attribute__((__packed__)); + +static char *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) +{ + unsigned int i; + + for (i = 0; i < count; i++) { + /* end marker */ + if (dir[i].name[0] == 0x00) { + dbg("end of dir"); + break; + } + + /* empty entry */ + if (dir[i].name[0] == FAT_ENTRY_FREE) + continue; + + /* long name */ + if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) + continue; + + if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { + /* labels do not have file data */ + if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) + continue; + + dbg("found ATTR_VOLUME_ID id in root dir"); + return dir[i].name; + } + + dbg("skip dir entry"); + } + + return NULL; +} + +int volume_id_probe_vfat(struct volume_id *id, __u64 off) +{ + struct vfat_super_block *vs; + struct vfat_dir_entry *dir; + __u16 sector_size; + __u16 dir_entries; + __u32 sect_count; + __u16 reserved; + __u32 fat_size; + __u32 root_cluster; + __u32 dir_size; + __u32 cluster_count; + __u32 fat_length; + __u64 root_start; + __u32 start_data_sect; + __u16 root_dir_entries; + __u8 *buf; + __u32 buf_size; + __u8 *label = NULL; + __u32 next; + int maxloop; + + dbg("probing at offset %llu", off); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + /* believe only that's fat, don't trust the version + * the cluster_count will tell us + */ + if (memcmp(vs->sysid, "NTFS", 4) == 0) + return -1; + + if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) + goto valid; + + if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) + goto valid; + + if (memcmp(vs->type.fat.magic, "FAT16 ", 8) == 0) + goto valid; + + if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0) + goto valid; + + if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) + goto valid; + + /* + * There are old floppies out there without a magic, so we check + * for well known values and guess if it's a fat volume + */ + + /* boot jump address check */ + if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && + vs->boot_jump[0] != 0xe9) + return -1; + + /* heads check */ + if (vs->heads == 0) + return -1; + + /* cluster size check*/ + if (vs->sectors_per_cluster == 0 || + (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) + return -1; + + /* media check */ + if (vs->media < 0xf8 && vs->media != 0xf0) + return -1; + + /* fat count*/ + if (vs->fats != 2) + return -1; + +valid: + /* sector size check */ + sector_size = le16_to_cpu(vs->sector_size); + if (sector_size != 0x200 && sector_size != 0x400 && + sector_size != 0x800 && sector_size != 0x1000) + return -1; + + dbg("sector_size 0x%x", sector_size); + dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); + + dir_entries = le16_to_cpu(vs->dir_entries); + reserved = le16_to_cpu(vs->reserved); + dbg("reserved 0x%x", reserved); + + sect_count = le16_to_cpu(vs->sectors); + if (sect_count == 0) + sect_count = le32_to_cpu(vs->total_sect); + dbg("sect_count 0x%x", sect_count); + + fat_length = le16_to_cpu(vs->fat_length); + if (fat_length == 0) + fat_length = le32_to_cpu(vs->type.fat32.fat32_length); + dbg("fat_length 0x%x", fat_length); + + fat_size = fat_length * vs->fats; + dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + + (sector_size-1)) / sector_size; + dbg("dir_size 0x%x", dir_size); + + cluster_count = sect_count - (reserved + fat_size + dir_size); + cluster_count /= vs->sectors_per_cluster; + dbg("cluster_count 0x%x", cluster_count); + + if (cluster_count < FAT12_MAX) { + strcpy(id->type_version, "FAT12"); + } else if (cluster_count < FAT16_MAX) { + strcpy(id->type_version, "FAT16"); + } else { + strcpy(id->type_version, "FAT32"); + goto fat32; + } + + /* the label may be an attribute in the root directory */ + root_start = (reserved + fat_size) * sector_size; + dbg("root dir start 0x%llx", root_start); + root_dir_entries = le16_to_cpu(vs->dir_entries); + dbg("expected entries 0x%x", root_dir_entries); + + buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); + buf = volume_id_get_buffer(id, off + root_start, buf_size); + if (buf == NULL) + goto found; + + dir = (struct vfat_dir_entry*) buf; + + label = get_attr_volume_id(dir, root_dir_entries); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, label, 11); + volume_id_set_label_string(id, label, 11); + } else if (memcmp(vs->type.fat.label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, vs->type.fat.label, 11); + volume_id_set_label_string(id, vs->type.fat.label, 11); + } + volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); + goto found; + +fat32: + /* FAT32 root dir is a cluster chain like any other directory */ + buf_size = vs->sectors_per_cluster * sector_size; + root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); + dbg("root dir cluster %u", root_cluster); + start_data_sect = reserved + fat_size; + + next = root_cluster; + maxloop = 100; + while (--maxloop) { + __u32 next_sect_off; + __u64 next_off; + __u64 fat_entry_off; + int count; + + dbg("next cluster %u", next); + next_sect_off = (next - 2) * vs->sectors_per_cluster; + next_off = (start_data_sect + next_sect_off) * sector_size; + dbg("cluster offset 0x%llx", next_off); + + /* get cluster */ + buf = volume_id_get_buffer(id, off + next_off, buf_size); + if (buf == NULL) + goto found; + + dir = (struct vfat_dir_entry*) buf; + count = buf_size / sizeof(struct vfat_dir_entry); + dbg("expected entries 0x%x", count); + + label = get_attr_volume_id(dir, count); + if (label) + break; + + /* get FAT entry */ + fat_entry_off = (reserved * sector_size) + (next * sizeof(__u32)); + buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); + if (buf == NULL) + goto found; + + /* set next cluster */ + next = le32_to_cpu(*((__u32 *) buf) & 0x0fffffff); + if (next == 0) + break; + } + if (maxloop == 0) + dbg("reached maximum follow count of root cluster chain, give up"); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, label, 11); + volume_id_set_label_string(id, label, 11); + } else if (memcmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, vs->type.fat32.label, 11); + volume_id_set_label_string(id, vs->type.fat32.label, 11); + } + volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "vfat"; + + return 0; +} diff --git a/extras/volume_id/volume_id/fat.h b/extras/volume_id/volume_id/fat.h new file mode 100644 index 0000000000..51ad94df85 --- /dev/null +++ b/extras/volume_id/volume_id/fat.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_FAT_ +#define _VOLUME_ID_FAT_ + +extern int volume_id_probe_vfat(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/fat/fat.c b/extras/volume_id/volume_id/fat/fat.c deleted file mode 100644 index 7c658fe5f4..0000000000 --- a/extras/volume_id/volume_id/fat/fat.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "fat.h" - -#define FAT12_MAX 0xff5 -#define FAT16_MAX 0xfff5 -#define FAT_ATTR_VOLUME_ID 0x08 -#define FAT_ATTR_DIR 0x10 -#define FAT_ATTR_LONG_NAME 0x0f -#define FAT_ATTR_MASK 0x3f -#define FAT_ENTRY_FREE 0xe5 - -struct vfat_super_block { - __u8 boot_jump[3]; - __u8 sysid[8]; - __u16 sector_size; - __u8 sectors_per_cluster; - __u16 reserved; - __u8 fats; - __u16 dir_entries; - __u16 sectors; - __u8 media; - __u16 fat_length; - __u16 secs_track; - __u16 heads; - __u32 hidden; - __u32 total_sect; - union { - struct fat_super_block { - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[192]; - __u8 pmagic[2]; - } __attribute__((__packed__)) fat; - struct fat32_super_block { - __u32 fat32_length; - __u16 flags; - __u8 version[2]; - __u32 root_cluster; - __u16 insfo_sector; - __u16 backup_boot; - __u16 reserved2[6]; - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[164]; - __u8 pmagic[2]; - } __attribute__((__packed__)) fat32; - } __attribute__((__packed__)) type; -} __attribute__((__packed__)); - -struct vfat_dir_entry { - __u8 name[11]; - __u8 attr; - __u16 time_creat; - __u16 date_creat; - __u16 time_acc; - __u16 date_acc; - __u16 cluster_high; - __u16 time_write; - __u16 date_write; - __u16 cluster_low; - __u32 size; -} __attribute__((__packed__)); - -static char *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) -{ - unsigned int i; - - for (i = 0; i < count; i++) { - /* end marker */ - if (dir[i].name[0] == 0x00) { - dbg("end of dir"); - break; - } - - /* empty entry */ - if (dir[i].name[0] == FAT_ENTRY_FREE) - continue; - - /* long name */ - if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) - continue; - - if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { - /* labels do not have file data */ - if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) - continue; - - dbg("found ATTR_VOLUME_ID id in root dir"); - return dir[i].name; - } - - dbg("skip dir entry"); - } - - return NULL; -} - -int volume_id_probe_vfat(struct volume_id *id, __u64 off) -{ - struct vfat_super_block *vs; - struct vfat_dir_entry *dir; - __u16 sector_size; - __u16 dir_entries; - __u32 sect_count; - __u16 reserved; - __u32 fat_size; - __u32 root_cluster; - __u32 dir_size; - __u32 cluster_count; - __u32 fat_length; - __u64 root_start; - __u32 start_data_sect; - __u16 root_dir_entries; - __u8 *buf; - __u32 buf_size; - __u8 *label = NULL; - __u32 next; - int maxloop; - - dbg("probing at offset %llu", off); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - /* believe only that's fat, don't trust the version - * the cluster_count will tell us - */ - if (memcmp(vs->sysid, "NTFS", 4) == 0) - return -1; - - if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) - goto valid; - - if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) - goto valid; - - if (memcmp(vs->type.fat.magic, "FAT16 ", 8) == 0) - goto valid; - - if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0) - goto valid; - - if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) - goto valid; - - /* - * There are old floppies out there without a magic, so we check - * for well known values and guess if it's a fat volume - */ - - /* boot jump address check */ - if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && - vs->boot_jump[0] != 0xe9) - return -1; - - /* heads check */ - if (vs->heads == 0) - return -1; - - /* cluster size check*/ - if (vs->sectors_per_cluster == 0 || - (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) - return -1; - - /* media check */ - if (vs->media < 0xf8 && vs->media != 0xf0) - return -1; - - /* fat count*/ - if (vs->fats != 2) - return -1; - -valid: - /* sector size check */ - sector_size = le16_to_cpu(vs->sector_size); - if (sector_size != 0x200 && sector_size != 0x400 && - sector_size != 0x800 && sector_size != 0x1000) - return -1; - - dbg("sector_size 0x%x", sector_size); - dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); - - dir_entries = le16_to_cpu(vs->dir_entries); - reserved = le16_to_cpu(vs->reserved); - dbg("reserved 0x%x", reserved); - - sect_count = le16_to_cpu(vs->sectors); - if (sect_count == 0) - sect_count = le32_to_cpu(vs->total_sect); - dbg("sect_count 0x%x", sect_count); - - fat_length = le16_to_cpu(vs->fat_length); - if (fat_length == 0) - fat_length = le32_to_cpu(vs->type.fat32.fat32_length); - dbg("fat_length 0x%x", fat_length); - - fat_size = fat_length * vs->fats; - dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + - (sector_size-1)) / sector_size; - dbg("dir_size 0x%x", dir_size); - - cluster_count = sect_count - (reserved + fat_size + dir_size); - cluster_count /= vs->sectors_per_cluster; - dbg("cluster_count 0x%x", cluster_count); - - if (cluster_count < FAT12_MAX) { - strcpy(id->type_version, "FAT12"); - } else if (cluster_count < FAT16_MAX) { - strcpy(id->type_version, "FAT16"); - } else { - strcpy(id->type_version, "FAT32"); - goto fat32; - } - - /* the label may be an attribute in the root directory */ - root_start = (reserved + fat_size) * sector_size; - dbg("root dir start 0x%llx", root_start); - root_dir_entries = le16_to_cpu(vs->dir_entries); - dbg("expected entries 0x%x", root_dir_entries); - - buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); - buf = volume_id_get_buffer(id, off + root_start, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - - label = get_attr_volume_id(dir, root_dir_entries); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, label, 11); - volume_id_set_label_string(id, label, 11); - } else if (memcmp(vs->type.fat.label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, vs->type.fat.label, 11); - volume_id_set_label_string(id, vs->type.fat.label, 11); - } - volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); - goto found; - -fat32: - /* FAT32 root dir is a cluster chain like any other directory */ - buf_size = vs->sectors_per_cluster * sector_size; - root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); - dbg("root dir cluster %u", root_cluster); - start_data_sect = reserved + fat_size; - - next = root_cluster; - maxloop = 100; - while (--maxloop) { - __u32 next_sect_off; - __u64 next_off; - __u64 fat_entry_off; - int count; - - dbg("next cluster %u", next); - next_sect_off = (next - 2) * vs->sectors_per_cluster; - next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%llx", next_off); - - /* get cluster */ - buf = volume_id_get_buffer(id, off + next_off, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - count = buf_size / sizeof(struct vfat_dir_entry); - dbg("expected entries 0x%x", count); - - label = get_attr_volume_id(dir, count); - if (label) - break; - - /* get FAT entry */ - fat_entry_off = (reserved * sector_size) + (next * sizeof(__u32)); - buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); - if (buf == NULL) - goto found; - - /* set next cluster */ - next = le32_to_cpu(*((__u32 *) buf) & 0x0fffffff); - if (next == 0) - break; - } - if (maxloop == 0) - dbg("reached maximum follow count of root cluster chain, give up"); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, label, 11); - volume_id_set_label_string(id, label, 11); - } else if (memcmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, vs->type.fat32.label, 11); - volume_id_set_label_string(id, vs->type.fat32.label, 11); - } - volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "vfat"; - - return 0; -} diff --git a/extras/volume_id/volume_id/fat/fat.h b/extras/volume_id/volume_id/fat/fat.h deleted file mode 100644 index 51ad94df85..0000000000 --- a/extras/volume_id/volume_id/fat/fat.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_FAT_ -#define _VOLUME_ID_FAT_ - -extern int volume_id_probe_vfat(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/hfs.c b/extras/volume_id/volume_id/hfs.c new file mode 100644 index 0000000000..327461c676 --- /dev/null +++ b/extras/volume_id/volume_id/hfs.c @@ -0,0 +1,310 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "hfs.h" + +struct hfs_finder_info{ + __u32 boot_folder; + __u32 start_app; + __u32 open_folder; + __u32 os9_folder; + __u32 reserved; + __u32 osx_folder; + __u8 id[8]; +} __attribute__((__packed__)); + +struct hfs_mdb { + __u8 signature[2]; + __u32 cr_date; + __u32 ls_Mod; + __u16 atrb; + __u16 nm_fls; + __u16 vbm_st; + __u16 alloc_ptr; + __u16 nm_al_blks; + __u32 al_blk_size; + __u32 clp_size; + __u16 al_bl_st; + __u32 nxt_cnid; + __u16 free_bks; + __u8 label_len; + __u8 label[27]; + __u32 vol_bkup; + __u16 vol_seq_num; + __u32 wr_cnt; + __u32 xt_clump_size; + __u32 ct_clump_size; + __u16 num_root_dirs; + __u32 file_count; + __u32 dir_count; + struct hfs_finder_info finder_info; + __u8 embed_sig[2]; + __u16 embed_startblock; + __u16 embed_blockcount; +} __attribute__((__packed__)) *hfs; + +struct hfsplus_bnode_descriptor { + __u32 next; + __u32 prev; + __u8 type; + __u8 height; + __u16 num_recs; + __u16 reserved; +} __attribute__((__packed__)); + +struct hfsplus_bheader_record { + __u16 depth; + __u32 root; + __u32 leaf_count; + __u32 leaf_head; + __u32 leaf_tail; + __u16 node_size; +} __attribute__((__packed__)); + +struct hfsplus_catalog_key { + __u16 key_len; + __u32 parent_id; + __u16 unicode_len; + __u8 unicode[255 * 2]; +} __attribute__((__packed__)); + +struct hfsplus_extent { + __u32 start_block; + __u32 block_count; +} __attribute__((__packed__)); + +#define HFSPLUS_EXTENT_COUNT 8 +struct hfsplus_fork { + __u64 total_size; + __u32 clump_size; + __u32 total_blocks; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; +} __attribute__((__packed__)); + +struct hfsplus_vol_header { + __u8 signature[2]; + __u16 version; + __u32 attributes; + __u32 last_mount_vers; + __u32 reserved; + __u32 create_date; + __u32 modify_date; + __u32 backup_date; + __u32 checked_date; + __u32 file_count; + __u32 folder_count; + __u32 blocksize; + __u32 total_blocks; + __u32 free_blocks; + __u32 next_alloc; + __u32 rsrc_clump_sz; + __u32 data_clump_sz; + __u32 next_cnid; + __u32 write_count; + __u64 encodings_bmp; + struct hfs_finder_info finder_info; + struct hfsplus_fork alloc_file; + struct hfsplus_fork ext_file; + struct hfsplus_fork cat_file; + struct hfsplus_fork attr_file; + struct hfsplus_fork start_file; +} __attribute__((__packed__)) *hfsplus; + +#define HFS_SUPERBLOCK_OFFSET 0x400 +#define HFS_NODE_LEAF 0xff +#define HFSPLUS_POR_CNID 1 + +int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) +{ + unsigned int blocksize; + unsigned int cat_block; + unsigned int ext_block_start; + unsigned int ext_block_count; + int ext; + unsigned int leaf_node_head; + unsigned int leaf_node_count; + unsigned int leaf_node_size; + unsigned int leaf_block; + __u64 leaf_off; + unsigned int alloc_block_size; + unsigned int alloc_first_block; + unsigned int embed_first_block; + unsigned int record_count; + struct hfsplus_bnode_descriptor *descr; + struct hfsplus_bheader_record *bnode; + struct hfsplus_catalog_key *key; + unsigned int label_len; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; + const __u8 *buf; + + dbg("probing at offset %llu", off); + + buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + hfs = (struct hfs_mdb *) buf; + if (memcmp(hfs->signature, "BD", 2) != 0) + goto checkplus; + + /* it may be just a hfs wrapper for hfs+ */ + if (memcmp(hfs->embed_sig, "H+", 2) == 0) { + alloc_block_size = be32_to_cpu(hfs->al_blk_size); + dbg("alloc_block_size 0x%x", alloc_block_size); + + alloc_first_block = be16_to_cpu(hfs->al_bl_st); + dbg("alloc_first_block 0x%x", alloc_first_block); + + embed_first_block = be16_to_cpu(hfs->embed_startblock); + dbg("embed_first_block 0x%x", embed_first_block); + + off += (alloc_first_block * 512) + + (embed_first_block * alloc_block_size); + dbg("hfs wrapped hfs+ found at offset 0x%llx", off); + + buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + goto checkplus; + } + + if (hfs->label_len > 0 && hfs->label_len < 28) { + volume_id_set_label_raw(id, hfs->label, hfs->label_len); + volume_id_set_label_string(id, hfs->label, hfs->label_len) ; + } + + volume_id_set_uuid(id, hfs->finder_info.id, UUID_HFS); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hfs"; + + return 0; + +checkplus: + hfsplus = (struct hfsplus_vol_header *) buf; + if (memcmp(hfsplus->signature, "H+", 2) == 0) + goto hfsplus; + if (memcmp(hfsplus->signature, "HX", 2) == 0) + goto hfsplus; + return -1; + +hfsplus: + volume_id_set_uuid(id, hfsplus->finder_info.id, UUID_HFS); + + blocksize = be32_to_cpu(hfsplus->blocksize); + dbg("blocksize %u", blocksize); + + memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); + cat_block = be32_to_cpu(extents[0].start_block); + dbg("catalog start block 0x%x", cat_block); + + buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); + if (buf == NULL) + goto found; + + bnode = (struct hfsplus_bheader_record *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + leaf_node_head = be32_to_cpu(bnode->leaf_head); + dbg("catalog leaf node 0x%x", leaf_node_head); + + leaf_node_size = be16_to_cpu(bnode->node_size); + dbg("leaf node size 0x%x", leaf_node_size); + + leaf_node_count = be32_to_cpu(bnode->leaf_count); + dbg("leaf node count 0x%x", leaf_node_count); + if (leaf_node_count == 0) + goto found; + + leaf_block = (leaf_node_head * leaf_node_size) / blocksize; + + /* get physical location */ + for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { + ext_block_start = be32_to_cpu(extents[ext].start_block); + ext_block_count = be32_to_cpu(extents[ext].block_count); + dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); + + if (ext_block_count == 0) + goto found; + + /* this is our extent */ + if (leaf_block < ext_block_count) + break; + + leaf_block -= ext_block_count; + } + if (ext == HFSPLUS_EXTENT_COUNT) + goto found; + dbg("found block in extent %i", ext); + + leaf_off = (ext_block_start + leaf_block) * blocksize; + + buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size); + if (buf == NULL) + goto found; + + descr = (struct hfsplus_bnode_descriptor *) buf; + dbg("descriptor type 0x%x", descr->type); + + record_count = be16_to_cpu(descr->num_recs); + dbg("number of records %u", record_count); + if (record_count == 0) + goto found; + + if (descr->type != HFS_NODE_LEAF) + goto found; + + key = (struct hfsplus_catalog_key *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); + if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) + goto found; + + label_len = be16_to_cpu(key->unicode_len) * 2; + dbg("label unicode16 len %i", label_len); + volume_id_set_label_raw(id, key->unicode, label_len); + volume_id_set_label_unicode16(id, key->unicode, BE, label_len); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hfsplus"; + + return 0; +} diff --git a/extras/volume_id/volume_id/hfs.h b/extras/volume_id/volume_id/hfs.h new file mode 100644 index 0000000000..b23ccd30c8 --- /dev/null +++ b/extras/volume_id/volume_id/hfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_HFS_ +#define _VOLUME_ID_HFS_ + +extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/hfs/hfs.c b/extras/volume_id/volume_id/hfs/hfs.c deleted file mode 100644 index 905471cb35..0000000000 --- a/extras/volume_id/volume_id/hfs/hfs.c +++ /dev/null @@ -1,310 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "hfs.h" - -struct hfs_finder_info{ - __u32 boot_folder; - __u32 start_app; - __u32 open_folder; - __u32 os9_folder; - __u32 reserved; - __u32 osx_folder; - __u8 id[8]; -} __attribute__((__packed__)); - -struct hfs_mdb { - __u8 signature[2]; - __u32 cr_date; - __u32 ls_Mod; - __u16 atrb; - __u16 nm_fls; - __u16 vbm_st; - __u16 alloc_ptr; - __u16 nm_al_blks; - __u32 al_blk_size; - __u32 clp_size; - __u16 al_bl_st; - __u32 nxt_cnid; - __u16 free_bks; - __u8 label_len; - __u8 label[27]; - __u32 vol_bkup; - __u16 vol_seq_num; - __u32 wr_cnt; - __u32 xt_clump_size; - __u32 ct_clump_size; - __u16 num_root_dirs; - __u32 file_count; - __u32 dir_count; - struct hfs_finder_info finder_info; - __u8 embed_sig[2]; - __u16 embed_startblock; - __u16 embed_blockcount; -} __attribute__((__packed__)) *hfs; - -struct hfsplus_bnode_descriptor { - __u32 next; - __u32 prev; - __u8 type; - __u8 height; - __u16 num_recs; - __u16 reserved; -} __attribute__((__packed__)); - -struct hfsplus_bheader_record { - __u16 depth; - __u32 root; - __u32 leaf_count; - __u32 leaf_head; - __u32 leaf_tail; - __u16 node_size; -} __attribute__((__packed__)); - -struct hfsplus_catalog_key { - __u16 key_len; - __u32 parent_id; - __u16 unicode_len; - __u8 unicode[255 * 2]; -} __attribute__((__packed__)); - -struct hfsplus_extent { - __u32 start_block; - __u32 block_count; -} __attribute__((__packed__)); - -#define HFSPLUS_EXTENT_COUNT 8 -struct hfsplus_fork { - __u64 total_size; - __u32 clump_size; - __u32 total_blocks; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; -} __attribute__((__packed__)); - -struct hfsplus_vol_header { - __u8 signature[2]; - __u16 version; - __u32 attributes; - __u32 last_mount_vers; - __u32 reserved; - __u32 create_date; - __u32 modify_date; - __u32 backup_date; - __u32 checked_date; - __u32 file_count; - __u32 folder_count; - __u32 blocksize; - __u32 total_blocks; - __u32 free_blocks; - __u32 next_alloc; - __u32 rsrc_clump_sz; - __u32 data_clump_sz; - __u32 next_cnid; - __u32 write_count; - __u64 encodings_bmp; - struct hfs_finder_info finder_info; - struct hfsplus_fork alloc_file; - struct hfsplus_fork ext_file; - struct hfsplus_fork cat_file; - struct hfsplus_fork attr_file; - struct hfsplus_fork start_file; -} __attribute__((__packed__)) *hfsplus; - -#define HFS_SUPERBLOCK_OFFSET 0x400 -#define HFS_NODE_LEAF 0xff -#define HFSPLUS_POR_CNID 1 - -int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) -{ - unsigned int blocksize; - unsigned int cat_block; - unsigned int ext_block_start; - unsigned int ext_block_count; - int ext; - unsigned int leaf_node_head; - unsigned int leaf_node_count; - unsigned int leaf_node_size; - unsigned int leaf_block; - __u64 leaf_off; - unsigned int alloc_block_size; - unsigned int alloc_first_block; - unsigned int embed_first_block; - unsigned int record_count; - struct hfsplus_bnode_descriptor *descr; - struct hfsplus_bheader_record *bnode; - struct hfsplus_catalog_key *key; - unsigned int label_len; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; - const __u8 *buf; - - dbg("probing at offset %llu", off); - - buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - hfs = (struct hfs_mdb *) buf; - if (memcmp(hfs->signature, "BD", 2) != 0) - goto checkplus; - - /* it may be just a hfs wrapper for hfs+ */ - if (memcmp(hfs->embed_sig, "H+", 2) == 0) { - alloc_block_size = be32_to_cpu(hfs->al_blk_size); - dbg("alloc_block_size 0x%x", alloc_block_size); - - alloc_first_block = be16_to_cpu(hfs->al_bl_st); - dbg("alloc_first_block 0x%x", alloc_first_block); - - embed_first_block = be16_to_cpu(hfs->embed_startblock); - dbg("embed_first_block 0x%x", embed_first_block); - - off += (alloc_first_block * 512) + - (embed_first_block * alloc_block_size); - dbg("hfs wrapped hfs+ found at offset 0x%llx", off); - - buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - goto checkplus; - } - - if (hfs->label_len > 0 && hfs->label_len < 28) { - volume_id_set_label_raw(id, hfs->label, hfs->label_len); - volume_id_set_label_string(id, hfs->label, hfs->label_len) ; - } - - volume_id_set_uuid(id, hfs->finder_info.id, UUID_HFS); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hfs"; - - return 0; - -checkplus: - hfsplus = (struct hfsplus_vol_header *) buf; - if (memcmp(hfsplus->signature, "H+", 2) == 0) - goto hfsplus; - if (memcmp(hfsplus->signature, "HX", 2) == 0) - goto hfsplus; - return -1; - -hfsplus: - volume_id_set_uuid(id, hfsplus->finder_info.id, UUID_HFS); - - blocksize = be32_to_cpu(hfsplus->blocksize); - dbg("blocksize %u", blocksize); - - memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); - cat_block = be32_to_cpu(extents[0].start_block); - dbg("catalog start block 0x%x", cat_block); - - buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); - if (buf == NULL) - goto found; - - bnode = (struct hfsplus_bheader_record *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - leaf_node_head = be32_to_cpu(bnode->leaf_head); - dbg("catalog leaf node 0x%x", leaf_node_head); - - leaf_node_size = be16_to_cpu(bnode->node_size); - dbg("leaf node size 0x%x", leaf_node_size); - - leaf_node_count = be32_to_cpu(bnode->leaf_count); - dbg("leaf node count 0x%x", leaf_node_count); - if (leaf_node_count == 0) - goto found; - - leaf_block = (leaf_node_head * leaf_node_size) / blocksize; - - /* get physical location */ - for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { - ext_block_start = be32_to_cpu(extents[ext].start_block); - ext_block_count = be32_to_cpu(extents[ext].block_count); - dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); - - if (ext_block_count == 0) - goto found; - - /* this is our extent */ - if (leaf_block < ext_block_count) - break; - - leaf_block -= ext_block_count; - } - if (ext == HFSPLUS_EXTENT_COUNT) - goto found; - dbg("found block in extent %i", ext); - - leaf_off = (ext_block_start + leaf_block) * blocksize; - - buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size); - if (buf == NULL) - goto found; - - descr = (struct hfsplus_bnode_descriptor *) buf; - dbg("descriptor type 0x%x", descr->type); - - record_count = be16_to_cpu(descr->num_recs); - dbg("number of records %u", record_count); - if (record_count == 0) - goto found; - - if (descr->type != HFS_NODE_LEAF) - goto found; - - key = (struct hfsplus_catalog_key *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); - if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) - goto found; - - label_len = be16_to_cpu(key->unicode_len) * 2; - dbg("label unicode16 len %i", label_len); - volume_id_set_label_raw(id, key->unicode, label_len); - volume_id_set_label_unicode16(id, key->unicode, BE, label_len); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hfsplus"; - - return 0; -} diff --git a/extras/volume_id/volume_id/hfs/hfs.h b/extras/volume_id/volume_id/hfs/hfs.h deleted file mode 100644 index b23ccd30c8..0000000000 --- a/extras/volume_id/volume_id/hfs/hfs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_HFS_ -#define _VOLUME_ID_HFS_ - -extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/highpoint.c b/extras/volume_id/volume_id/highpoint.c new file mode 100644 index 0000000000..e13fd6de61 --- /dev/null +++ b/extras/volume_id/volume_id/highpoint.c @@ -0,0 +1,72 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "highpoint.h" + +struct hpt37x { + __u8 filler1[32]; + __u32 magic; + __u32 magic_0; + __u32 magic_1; +} __attribute__((packed)) *hpt; + +#define HPT37X_CONFIG_OFF 0x1200 +#define HPT37X_MAGIC_OK 0x5a7816f0 +#define HPT37X_MAGIC_BAD 0x5a7816fd + +int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off) +{ + const __u8 *buf; + + dbg("probing at offset %llu", off); + + buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); + if (buf == NULL) + return -1; + + hpt = (struct hpt37x *) buf; + + if (hpt->magic != HPT37X_MAGIC_OK && hpt->magic != HPT37X_MAGIC_BAD) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "hpt_ataraid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/highpoint.h b/extras/volume_id/volume_id/highpoint.h new file mode 100644 index 0000000000..5a5614afef --- /dev/null +++ b/extras/volume_id/volume_id/highpoint.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_HIGHPOINT_ +#define _VOLUME_ID_HIGHPOINT_ + +extern int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/highpoint/highpoint.c b/extras/volume_id/volume_id/highpoint/highpoint.c deleted file mode 100644 index b301450086..0000000000 --- a/extras/volume_id/volume_id/highpoint/highpoint.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "highpoint.h" - -struct hpt37x { - __u8 filler1[32]; - __u32 magic; - __u32 magic_0; - __u32 magic_1; -} __attribute__((packed)) *hpt; - -#define HPT37X_CONFIG_OFF 0x1200 -#define HPT37X_MAGIC_OK 0x5a7816f0 -#define HPT37X_MAGIC_BAD 0x5a7816fd - -int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off) -{ - const __u8 *buf; - - dbg("probing at offset %llu", off); - - buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); - if (buf == NULL) - return -1; - - hpt = (struct hpt37x *) buf; - - if (hpt->magic != HPT37X_MAGIC_OK && hpt->magic != HPT37X_MAGIC_BAD) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "hpt_ataraid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/highpoint/highpoint.h b/extras/volume_id/volume_id/highpoint/highpoint.h deleted file mode 100644 index 5a5614afef..0000000000 --- a/extras/volume_id/volume_id/highpoint/highpoint.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_HIGHPOINT_ -#define _VOLUME_ID_HIGHPOINT_ - -extern int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/hpfs.c b/extras/volume_id/volume_id/hpfs.c new file mode 100644 index 0000000000..a8daea7892 --- /dev/null +++ b/extras/volume_id/volume_id/hpfs.c @@ -0,0 +1,69 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "hpfs.h" + +struct hpfs_super +{ + __u8 magic[4]; + __u8 version; +} __attribute__((__packed__)); + +#define HPFS_SUPERBLOCK_OFFSET 0x2000 + +int volume_id_probe_hpfs(struct volume_id *id, __u64 off) +{ + struct hpfs_super *hs; + + dbg("probing at offset %llu", off); + + hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); + if (hs == NULL) + return -1; + + if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) { + snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u", hs->version); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hpfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/volume_id/hpfs.h b/extras/volume_id/volume_id/hpfs.h new file mode 100644 index 0000000000..bd8d4c90c9 --- /dev/null +++ b/extras/volume_id/volume_id/hpfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_HPFS_ +#define _VOLUME_ID_HPFS_ + +extern int volume_id_probe_hpfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/hpfs/hpfs.c b/extras/volume_id/volume_id/hpfs/hpfs.c deleted file mode 100644 index 212e74ee41..0000000000 --- a/extras/volume_id/volume_id/hpfs/hpfs.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "hpfs.h" - -struct hpfs_super -{ - __u8 magic[4]; - __u8 version; -} __attribute__((__packed__)); - -#define HPFS_SUPERBLOCK_OFFSET 0x2000 - -int volume_id_probe_hpfs(struct volume_id *id, __u64 off) -{ - struct hpfs_super *hs; - - dbg("probing at offset %llu", off); - - hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); - if (hs == NULL) - return -1; - - if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) { - snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u", hs->version); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hpfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/volume_id/hpfs/hpfs.h b/extras/volume_id/volume_id/hpfs/hpfs.h deleted file mode 100644 index bd8d4c90c9..0000000000 --- a/extras/volume_id/volume_id/hpfs/hpfs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_HPFS_ -#define _VOLUME_ID_HPFS_ - -extern int volume_id_probe_hpfs(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/iso9660.c b/extras/volume_id/volume_id/iso9660.c new file mode 100644 index 0000000000..ffccf609dc --- /dev/null +++ b/extras/volume_id/volume_id/iso9660.c @@ -0,0 +1,119 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "iso9660.h" + +#define ISO_SUPERBLOCK_OFFSET 0x8000 +#define ISO_SECTOR_SIZE 0x800 +#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) +#define ISO_VD_PRIMARY 0x1 +#define ISO_VD_SUPPLEMENTARY 0x2 +#define ISO_VD_END 0xff +#define ISO_VD_MAX 16 + +union iso_super_block { + struct iso_header { + __u8 type; + __u8 id[5]; + __u8 version; + __u8 unused1; + __u8 system_id[32]; + __u8 volume_id[32]; + } __attribute__((__packed__)) iso; + struct hs_header { + __u8 foo[8]; + __u8 type; + __u8 id[4]; + __u8 version; + } __attribute__((__packed__)) hs; +} __attribute__((__packed__)); + +int volume_id_probe_iso9660(struct volume_id *id, __u64 off) +{ + union iso_super_block *is; + + dbg("probing at offset %llu", off); + + is = (union iso_super_block *) volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); + if (is == NULL) + return -1; + + if (memcmp(is->iso.id, "CD001", 5) == 0) { + char root_label[VOLUME_ID_LABEL_SIZE+1]; + int vd_offset; + int i; + int found_svd; + + memset(root_label, 0, sizeof(root_label)); + strncpy(root_label, is->iso.volume_id, sizeof(root_label)-1); + + found_svd = 0; + vd_offset = ISO_VD_OFFSET; + for (i = 0; i < ISO_VD_MAX; i++) { + is = (union iso_super_block *) volume_id_get_buffer(id, off + vd_offset, 0x200); + if (is == NULL || is->iso.type == ISO_VD_END) + break; + if (is->iso.type == ISO_VD_SUPPLEMENTARY) { + dbg("found ISO supplementary VD at offset 0x%llx", off + vd_offset); + volume_id_set_label_raw(id, is->iso.volume_id, 32); + volume_id_set_label_unicode16(id, is->iso.volume_id, BE, 32); + found_svd = 1; + break; + } + vd_offset += ISO_SECTOR_SIZE; + } + + if (!found_svd || + (found_svd && !memcmp(root_label, id->label, 16))) + { + volume_id_set_label_raw(id, root_label, 32); + volume_id_set_label_string(id, root_label, 32); + } + goto found; + } + if (memcmp(is->hs.id, "CDROM", 5) == 0) + goto found; + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "iso9660"; + + return 0; +} diff --git a/extras/volume_id/volume_id/iso9660.h b/extras/volume_id/volume_id/iso9660.h new file mode 100644 index 0000000000..c187e25f94 --- /dev/null +++ b/extras/volume_id/volume_id/iso9660.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_ISO9660_ +#define _VOLUME_ID_ISO9660_ + +extern int volume_id_probe_iso9660(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/iso9660/iso9660.c b/extras/volume_id/volume_id/iso9660/iso9660.c deleted file mode 100644 index 1d7cfd5037..0000000000 --- a/extras/volume_id/volume_id/iso9660/iso9660.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "iso9660.h" - -#define ISO_SUPERBLOCK_OFFSET 0x8000 -#define ISO_SECTOR_SIZE 0x800 -#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) -#define ISO_VD_PRIMARY 0x1 -#define ISO_VD_SUPPLEMENTARY 0x2 -#define ISO_VD_END 0xff -#define ISO_VD_MAX 16 - -union iso_super_block { - struct iso_header { - __u8 type; - __u8 id[5]; - __u8 version; - __u8 unused1; - __u8 system_id[32]; - __u8 volume_id[32]; - } __attribute__((__packed__)) iso; - struct hs_header { - __u8 foo[8]; - __u8 type; - __u8 id[4]; - __u8 version; - } __attribute__((__packed__)) hs; -} __attribute__((__packed__)); - -int volume_id_probe_iso9660(struct volume_id *id, __u64 off) -{ - union iso_super_block *is; - - dbg("probing at offset %llu", off); - - is = (union iso_super_block *) volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); - if (is == NULL) - return -1; - - if (memcmp(is->iso.id, "CD001", 5) == 0) { - char root_label[VOLUME_ID_LABEL_SIZE+1]; - int vd_offset; - int i; - int found_svd; - - memset(root_label, 0, sizeof(root_label)); - strncpy(root_label, is->iso.volume_id, sizeof(root_label)-1); - - found_svd = 0; - vd_offset = ISO_VD_OFFSET; - for (i = 0; i < ISO_VD_MAX; i++) { - is = (union iso_super_block *) volume_id_get_buffer(id, off + vd_offset, 0x200); - if (is == NULL || is->iso.type == ISO_VD_END) - break; - if (is->iso.type == ISO_VD_SUPPLEMENTARY) { - dbg("found ISO supplementary VD at offset 0x%llx", off + vd_offset); - volume_id_set_label_raw(id, is->iso.volume_id, 32); - volume_id_set_label_unicode16(id, is->iso.volume_id, BE, 32); - found_svd = 1; - break; - } - vd_offset += ISO_SECTOR_SIZE; - } - - if (!found_svd || - (found_svd && !memcmp(root_label, id->label, 16))) - { - volume_id_set_label_raw(id, root_label, 32); - volume_id_set_label_string(id, root_label, 32); - } - goto found; - } - if (memcmp(is->hs.id, "CDROM", 5) == 0) - goto found; - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "iso9660"; - - return 0; -} diff --git a/extras/volume_id/volume_id/iso9660/iso9660.h b/extras/volume_id/volume_id/iso9660/iso9660.h deleted file mode 100644 index c187e25f94..0000000000 --- a/extras/volume_id/volume_id/iso9660/iso9660.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_ISO9660_ -#define _VOLUME_ID_ISO9660_ - -extern int volume_id_probe_iso9660(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/jfs.c b/extras/volume_id/volume_id/jfs.c new file mode 100644 index 0000000000..ac4eab502d --- /dev/null +++ b/extras/volume_id/volume_id/jfs.c @@ -0,0 +1,78 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "jfs.h" + +struct jfs_super_block { + __u8 magic[4]; + __u32 version; + __u64 size; + __u32 bsize; + __u32 dummy1; + __u32 pbsize; + __u32 dummy2[27]; + __u8 uuid[16]; + __u8 label[16]; + __u8 loguuid[16]; +} __attribute__((__packed__)); + +#define JFS_SUPERBLOCK_OFFSET 0x8000 + +int volume_id_probe_jfs(struct volume_id *id, __u64 off) +{ + struct jfs_super_block *js; + + dbg("probing at offset %llu", off); + + js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); + if (js == NULL) + return -1; + + if (memcmp(js->magic, "JFS1", 4) != 0) + return -1; + + volume_id_set_label_raw(id, js->label, 16); + volume_id_set_label_string(id, js->label, 16); + volume_id_set_uuid(id, js->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "jfs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/jfs.h b/extras/volume_id/volume_id/jfs.h new file mode 100644 index 0000000000..28c48ffe53 --- /dev/null +++ b/extras/volume_id/volume_id/jfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_JFS_ +#define _VOLUME_ID_JFS_ + +extern int volume_id_probe_jfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/jfs/jfs.c b/extras/volume_id/volume_id/jfs/jfs.c deleted file mode 100644 index ab0b83081c..0000000000 --- a/extras/volume_id/volume_id/jfs/jfs.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "jfs.h" - -struct jfs_super_block { - __u8 magic[4]; - __u32 version; - __u64 size; - __u32 bsize; - __u32 dummy1; - __u32 pbsize; - __u32 dummy2[27]; - __u8 uuid[16]; - __u8 label[16]; - __u8 loguuid[16]; -} __attribute__((__packed__)); - -#define JFS_SUPERBLOCK_OFFSET 0x8000 - -int volume_id_probe_jfs(struct volume_id *id, __u64 off) -{ - struct jfs_super_block *js; - - dbg("probing at offset %llu", off); - - js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); - if (js == NULL) - return -1; - - if (memcmp(js->magic, "JFS1", 4) != 0) - return -1; - - volume_id_set_label_raw(id, js->label, 16); - volume_id_set_label_string(id, js->label, 16); - volume_id_set_uuid(id, js->uuid, UUID_DCE); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "jfs"; - - return 0; -} diff --git a/extras/volume_id/volume_id/jfs/jfs.h b/extras/volume_id/volume_id/jfs/jfs.h deleted file mode 100644 index 28c48ffe53..0000000000 --- a/extras/volume_id/volume_id/jfs/jfs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_JFS_ -#define _VOLUME_ID_JFS_ - -extern int volume_id_probe_jfs(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/linux_raid.c b/extras/volume_id/volume_id/linux_raid.c new file mode 100644 index 0000000000..0ea8596ad6 --- /dev/null +++ b/extras/volume_id/volume_id/linux_raid.c @@ -0,0 +1,99 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "linux_raid.h" + +struct mdp_super_block { + __u32 md_magic; + __u32 major_version; + __u32 minor_version; + __u32 patch_version; + __u32 gvalid_words; + __u32 set_uuid0; + __u32 ctime; + __u32 level; + __u32 size; + __u32 nr_disks; + __u32 raid_disks; + __u32 md_minor; + __u32 not_persistent; + __u32 set_uuid1; + __u32 set_uuid2; + __u32 set_uuid3; +} __attribute__((packed)) *mdp; + +#define MD_RESERVED_BYTES 0x10000 +#define MD_MAGIC 0xa92b4efc + +int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) +{ + const __u8 *buf; + __u64 sboff; + __u8 uuid[16]; + + dbg("probing at offset %llu", off); + + if (size < 0x10000) + return -1; + + sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; + buf = volume_id_get_buffer(id, off + sboff, 0x800); + if (buf == NULL) + return -1; + + mdp = (struct mdp_super_block *) buf; + + if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) + return -1; + + memcpy(uuid, &mdp->set_uuid0, 4); + memcpy(&uuid[4], &mdp->set_uuid1, 12); + volume_id_set_uuid(id, uuid, UUID_DCE); + + snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u.%u.%u", + le32_to_cpu(mdp->major_version), + le32_to_cpu(mdp->minor_version), + le32_to_cpu(mdp->patch_version)); + + dbg("found raid signature"); + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "linux_raid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/linux_raid.h b/extras/volume_id/volume_id/linux_raid.h new file mode 100644 index 0000000000..0aaaaa6ade --- /dev/null +++ b/extras/volume_id/volume_id/linux_raid.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_LINUX_RAID_ +#define _VOLUME_ID_LINUX_RAID_ + +extern int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size); + +#endif diff --git a/extras/volume_id/volume_id/linux_raid/linux_raid.c b/extras/volume_id/volume_id/linux_raid/linux_raid.c deleted file mode 100644 index ca03030ee4..0000000000 --- a/extras/volume_id/volume_id/linux_raid/linux_raid.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "linux_raid.h" - -struct mdp_super_block { - __u32 md_magic; - __u32 major_version; - __u32 minor_version; - __u32 patch_version; - __u32 gvalid_words; - __u32 set_uuid0; - __u32 ctime; - __u32 level; - __u32 size; - __u32 nr_disks; - __u32 raid_disks; - __u32 md_minor; - __u32 not_persistent; - __u32 set_uuid1; - __u32 set_uuid2; - __u32 set_uuid3; -} __attribute__((packed)) *mdp; - -#define MD_RESERVED_BYTES 0x10000 -#define MD_MAGIC 0xa92b4efc - -int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) -{ - const __u8 *buf; - __u64 sboff; - __u8 uuid[16]; - - dbg("probing at offset %llu", off); - - if (size < 0x10000) - return -1; - - sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; - buf = volume_id_get_buffer(id, off + sboff, 0x800); - if (buf == NULL) - return -1; - - mdp = (struct mdp_super_block *) buf; - - if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) - return -1; - - memcpy(uuid, &mdp->set_uuid0, 4); - memcpy(&uuid[4], &mdp->set_uuid1, 12); - volume_id_set_uuid(id, uuid, UUID_DCE); - - snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u.%u.%u", - le32_to_cpu(mdp->major_version), - le32_to_cpu(mdp->minor_version), - le32_to_cpu(mdp->patch_version)); - - dbg("found raid signature"); - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "linux_raid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/linux_raid/linux_raid.h b/extras/volume_id/volume_id/linux_raid/linux_raid.h deleted file mode 100644 index 0aaaaa6ade..0000000000 --- a/extras/volume_id/volume_id/linux_raid/linux_raid.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_LINUX_RAID_ -#define _VOLUME_ID_LINUX_RAID_ - -extern int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size); - -#endif diff --git a/extras/volume_id/volume_id/linux_swap.c b/extras/volume_id/volume_id/linux_swap.c new file mode 100644 index 0000000000..39a2c4aab3 --- /dev/null +++ b/extras/volume_id/volume_id/linux_swap.c @@ -0,0 +1,89 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "linux_swap.h" + +struct swap_header_v1_2 { + __u8 bootbits[1024]; + __u32 version; + __u32 last_page; + __u32 nr_badpages; + __u8 uuid[16]; + __u8 volume_name[16]; +} __attribute__((__packed__)) *sw; + +#define LARGEST_PAGESIZE 0x4000 + +int volume_id_probe_linux_swap(struct volume_id *id, __u64 off) +{ + const __u8 *buf; + unsigned int page; + + dbg("probing at offset %llu", off); + + /* the swap signature is at the end of the PAGE_SIZE */ + for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { + buf = volume_id_get_buffer(id, off + page-10, 10); + if (buf == NULL) + return -1; + + if (memcmp(buf, "SWAP-SPACE", 10) == 0) { + strcpy(id->type_version, "1"); + goto found; + } + + if (memcmp(buf, "SWAPSPACE2", 10) == 0) { + sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); + if (sw == NULL) + return -1; + strcpy(id->type_version, "2"); + volume_id_set_label_raw(id, sw->volume_name, 16); + volume_id_set_label_string(id, sw->volume_name, 16); + volume_id_set_uuid(id, sw->uuid, UUID_DCE); + goto found; + } + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_OTHER); + id->type = "swap"; + + return 0; +} diff --git a/extras/volume_id/volume_id/linux_swap.h b/extras/volume_id/volume_id/linux_swap.h new file mode 100644 index 0000000000..5de0f93849 --- /dev/null +++ b/extras/volume_id/volume_id/linux_swap.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_LINUX_SWAP_ +#define _VOLUME_ID_LINUX_SWAP_ + +extern int volume_id_probe_linux_swap(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/linux_swap/linux_swap.c b/extras/volume_id/volume_id/linux_swap/linux_swap.c deleted file mode 100644 index 2fb16377a8..0000000000 --- a/extras/volume_id/volume_id/linux_swap/linux_swap.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "linux_swap.h" - -struct swap_header_v1_2 { - __u8 bootbits[1024]; - __u32 version; - __u32 last_page; - __u32 nr_badpages; - __u8 uuid[16]; - __u8 volume_name[16]; -} __attribute__((__packed__)) *sw; - -#define LARGEST_PAGESIZE 0x4000 - -int volume_id_probe_linux_swap(struct volume_id *id, __u64 off) -{ - const __u8 *buf; - unsigned int page; - - dbg("probing at offset %llu", off); - - /* the swap signature is at the end of the PAGE_SIZE */ - for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { - buf = volume_id_get_buffer(id, off + page-10, 10); - if (buf == NULL) - return -1; - - if (memcmp(buf, "SWAP-SPACE", 10) == 0) { - strcpy(id->type_version, "1"); - goto found; - } - - if (memcmp(buf, "SWAPSPACE2", 10) == 0) { - sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); - if (sw == NULL) - return -1; - strcpy(id->type_version, "2"); - volume_id_set_label_raw(id, sw->volume_name, 16); - volume_id_set_label_string(id, sw->volume_name, 16); - volume_id_set_uuid(id, sw->uuid, UUID_DCE); - goto found; - } - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_OTHER); - id->type = "swap"; - - return 0; -} diff --git a/extras/volume_id/volume_id/linux_swap/linux_swap.h b/extras/volume_id/volume_id/linux_swap/linux_swap.h deleted file mode 100644 index 5de0f93849..0000000000 --- a/extras/volume_id/volume_id/linux_swap/linux_swap.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_LINUX_SWAP_ -#define _VOLUME_ID_LINUX_SWAP_ - -extern int volume_id_probe_linux_swap(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/luks.c b/extras/volume_id/volume_id/luks.c new file mode 100644 index 0000000000..2001692731 --- /dev/null +++ b/extras/volume_id/volume_id/luks.c @@ -0,0 +1,106 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 W. Michael Petullo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "util.h" +#include "logging.h" +#include "luks.h" + +/* from cryptsetup-luks internal.h */ +#define SECTOR_SHIFT 9 +#define SECTOR_SIZE (1 << SECTOR_SHIFT) + +/* from cryptsetup-luks luks.h */ +#define LUKS_CIPHERNAME_L 32 +#define LUKS_CIPHERMODE_L 32 +#define LUKS_HASHSPEC_L 32 +#define LUKS_DIGESTSIZE 20 /* since SHA1 */ +#define LUKS_SALTSIZE 32 +#define LUKS_NUMKEYS 8 + +/* from cryptsetup-luks luks.h */ +const unsigned char LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; +#define LUKS_MAGIC_L 6 + +/* from cryptsetup-luks luks.h */ +#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) + +/* from cryptsetup-luks luks.h */ +#define UUID_STRING_L 40 + +int volume_id_probe_luks(struct volume_id *id, __u64 off) +{ + /* from cryptsetup-luks luks.h */ + struct luks_phdr { + char magic[LUKS_MAGIC_L]; + uint16_t version; + char cipherName[LUKS_CIPHERNAME_L]; + char cipherMode[LUKS_CIPHERMODE_L]; + char hashSpec[LUKS_HASHSPEC_L]; + uint32_t payloadOffset; + uint32_t keyBytes; + char mkDigest[LUKS_DIGESTSIZE]; + char mkDigestSalt[LUKS_SALTSIZE]; + uint32_t mkDigestIterations; + char uuid[UUID_STRING_L]; + struct { + uint32_t active; + + /* parameters used for password processing */ + uint32_t passwordIterations; + char passwordSalt[LUKS_SALTSIZE]; + + /* parameters used for AF store/load */ + uint32_t keyMaterialOffset; + uint32_t stripes; + } keyblock[LUKS_NUMKEYS]; + } *header; + + header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE); + + if (header == NULL) + return -1; + + if (memcmp(header->magic, LUKS_MAGIC, LUKS_MAGIC_L)) + return -1; + + volume_id_set_usage(id, VOLUME_ID_CRYPTO); + volume_id_set_uuid(id, header->uuid, UUID_DCE); + id->type = "crypto_LUKS"; + + return 0; +} diff --git a/extras/volume_id/volume_id/luks.h b/extras/volume_id/volume_id/luks.h new file mode 100644 index 0000000000..180336f573 --- /dev/null +++ b/extras/volume_id/volume_id/luks.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 W. Michael Petullo + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_LUKS_ +#define _VOLUME_ID_LUKS_ + +extern int volume_id_probe_luks(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/lvm.c b/extras/volume_id/volume_id/lvm.c new file mode 100644 index 0000000000..bfc2ef2343 --- /dev/null +++ b/extras/volume_id/volume_id/lvm.c @@ -0,0 +1,110 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "lvm.h" + +struct lvm1_super_block { + __u8 id[2]; +} __attribute__((packed)); + +struct lvm2_super_block { + __u8 id[8]; + __u64 sector_xl; + __u32 crc_xl; + __u32 offset_xl; + __u8 type[8]; +} __attribute__((packed)); + +#define LVM1_SB_OFF 0x400 +#define LVM1_MAGIC "HM" + +int volume_id_probe_lvm1(struct volume_id *id, __u64 off) +{ + const __u8 *buf; + struct lvm1_super_block *lvm; + + dbg("probing at offset %llu", off); + + buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); + if (buf == NULL) + return -1; + + lvm = (struct lvm1_super_block *) buf; + + if (memcmp(lvm->id, LVM1_MAGIC, 2) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "LVM1_member"; + + return 0; +} + +#define LVM2_LABEL_ID "LABELONE" +#define LVM2LABEL_SCAN_SECTORS 4 + +int volume_id_probe_lvm2(struct volume_id *id, __u64 off) +{ + const __u8 *buf; + unsigned int soff; + struct lvm2_super_block *lvm; + + dbg("probing at offset %llu", off); + + buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); + if (buf == NULL) + return -1; + + + for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { + lvm = (struct lvm2_super_block *) &buf[soff]; + + if (memcmp(lvm->id, LVM2_LABEL_ID, 8) == 0) + goto found; + } + + return -1; + +found: + strncpy(id->type_version, lvm->type, 8); + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "LVM2_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/lvm.h b/extras/volume_id/volume_id/lvm.h new file mode 100644 index 0000000000..2e44cda75b --- /dev/null +++ b/extras/volume_id/volume_id/lvm.h @@ -0,0 +1,27 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_LVM_ +#define _VOLUME_ID_LVM_ + +extern int volume_id_probe_lvm1(struct volume_id *id, __u64 off); +extern int volume_id_probe_lvm2(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/lvm/lvm.c b/extras/volume_id/volume_id/lvm/lvm.c deleted file mode 100644 index ed1a83aeb4..0000000000 --- a/extras/volume_id/volume_id/lvm/lvm.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "lvm.h" - -struct lvm1_super_block { - __u8 id[2]; -} __attribute__((packed)); - -struct lvm2_super_block { - __u8 id[8]; - __u64 sector_xl; - __u32 crc_xl; - __u32 offset_xl; - __u8 type[8]; -} __attribute__((packed)); - -#define LVM1_SB_OFF 0x400 -#define LVM1_MAGIC "HM" - -int volume_id_probe_lvm1(struct volume_id *id, __u64 off) -{ - const __u8 *buf; - struct lvm1_super_block *lvm; - - dbg("probing at offset %llu", off); - - buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); - if (buf == NULL) - return -1; - - lvm = (struct lvm1_super_block *) buf; - - if (memcmp(lvm->id, LVM1_MAGIC, 2) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "LVM1_member"; - - return 0; -} - -#define LVM2_LABEL_ID "LABELONE" -#define LVM2LABEL_SCAN_SECTORS 4 - -int volume_id_probe_lvm2(struct volume_id *id, __u64 off) -{ - const __u8 *buf; - unsigned int soff; - struct lvm2_super_block *lvm; - - dbg("probing at offset %llu", off); - - buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); - if (buf == NULL) - return -1; - - - for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { - lvm = (struct lvm2_super_block *) &buf[soff]; - - if (memcmp(lvm->id, LVM2_LABEL_ID, 8) == 0) - goto found; - } - - return -1; - -found: - strncpy(id->type_version, lvm->type, 8); - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "LVM2_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/lvm/lvm.h b/extras/volume_id/volume_id/lvm/lvm.h deleted file mode 100644 index 2e44cda75b..0000000000 --- a/extras/volume_id/volume_id/lvm/lvm.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_LVM_ -#define _VOLUME_ID_LVM_ - -extern int volume_id_probe_lvm1(struct volume_id *id, __u64 off); -extern int volume_id_probe_lvm2(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/mac.c b/extras/volume_id/volume_id/mac.c new file mode 100644 index 0000000000..2e2db486f2 --- /dev/null +++ b/extras/volume_id/volume_id/mac.c @@ -0,0 +1,144 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "mac.h" + +struct mac_driver_desc { + __u8 signature[2]; + __u16 block_size; + __u32 block_count; +} __attribute__((__packed__)); + +struct mac_partition { + __u8 signature[2]; + __u16 res1; + __u32 map_count; + __u32 start_block; + __u32 block_count; + __u8 name[32]; + __u8 type[32]; +} __attribute__((__packed__)); + +int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) +{ + const __u8 *buf; + struct mac_driver_desc *driver; + struct mac_partition *part; + + dbg("probing at offset %llu", off); + + buf = volume_id_get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if ((memcmp(part->signature, "PM", 2) == 0) && + (memcmp(part->type, "Apple_partition_map", 19) == 0)) { + /* linux creates an own subdevice for the map + * just return the type if the drive header is missing */ + volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); + id->type = "mac_partition_map"; + return 0; + } + + driver = (struct mac_driver_desc *) buf; + if (memcmp(driver->signature, "ER", 2) == 0) { + /* we are on a main device, like a CD + * just try to probe the first partition from the map */ + unsigned int bsize = be16_to_cpu(driver->block_size); + int part_count; + int i; + + /* get first entry of partition table */ + buf = volume_id_get_buffer(id, off + bsize, 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if (memcmp(part->signature, "PM", 2) != 0) + return -1; + + part_count = be32_to_cpu(part->map_count); + dbg("expecting %d partition entries", part_count); + + if (id->partitions != NULL) + free(id->partitions); + id->partitions = + malloc(part_count * sizeof(struct volume_id_partition)); + if (id->partitions == NULL) + return -1; + memset(id->partitions, 0x00, sizeof(struct volume_id_partition)); + + id->partition_count = part_count; + + for (i = 0; i < part_count; i++) { + __u64 poff; + __u64 plen; + + buf = volume_id_get_buffer(id, off + ((i+1) * bsize), 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if (memcmp(part->signature, "PM", 2) != 0) + return -1; + + poff = be32_to_cpu(part->start_block) * bsize; + plen = be32_to_cpu(part->block_count) * bsize; + dbg("found '%s' partition entry at 0x%llx, len 0x%llx", + part->type, poff, plen); + + id->partitions[i].off = poff; + id->partitions[i].len = plen; + + if (memcmp(part->type, "Apple_Free", 10) == 0) { + volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED); + } else if (memcmp(part->type, "Apple_partition_map", 19) == 0) { + volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE); + } else { + volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED); + } + } + volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); + id->type = "mac_partition_map"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/volume_id/mac.h b/extras/volume_id/volume_id/mac.h new file mode 100644 index 0000000000..888c1c527d --- /dev/null +++ b/extras/volume_id/volume_id/mac.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_MAC_ +#define _VOLUME_ID_MAC_ + +extern int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/mac/mac.c b/extras/volume_id/volume_id/mac/mac.c deleted file mode 100644 index 895316d26c..0000000000 --- a/extras/volume_id/volume_id/mac/mac.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "mac.h" - -struct mac_driver_desc { - __u8 signature[2]; - __u16 block_size; - __u32 block_count; -} __attribute__((__packed__)); - -struct mac_partition { - __u8 signature[2]; - __u16 res1; - __u32 map_count; - __u32 start_block; - __u32 block_count; - __u8 name[32]; - __u8 type[32]; -} __attribute__((__packed__)); - -int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) -{ - const __u8 *buf; - struct mac_driver_desc *driver; - struct mac_partition *part; - - dbg("probing at offset %llu", off); - - buf = volume_id_get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if ((memcmp(part->signature, "PM", 2) == 0) && - (memcmp(part->type, "Apple_partition_map", 19) == 0)) { - /* linux creates an own subdevice for the map - * just return the type if the drive header is missing */ - volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); - id->type = "mac_partition_map"; - return 0; - } - - driver = (struct mac_driver_desc *) buf; - if (memcmp(driver->signature, "ER", 2) == 0) { - /* we are on a main device, like a CD - * just try to probe the first partition from the map */ - unsigned int bsize = be16_to_cpu(driver->block_size); - int part_count; - int i; - - /* get first entry of partition table */ - buf = volume_id_get_buffer(id, off + bsize, 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if (memcmp(part->signature, "PM", 2) != 0) - return -1; - - part_count = be32_to_cpu(part->map_count); - dbg("expecting %d partition entries", part_count); - - if (id->partitions != NULL) - free(id->partitions); - id->partitions = - malloc(part_count * sizeof(struct volume_id_partition)); - if (id->partitions == NULL) - return -1; - memset(id->partitions, 0x00, sizeof(struct volume_id_partition)); - - id->partition_count = part_count; - - for (i = 0; i < part_count; i++) { - __u64 poff; - __u64 plen; - - buf = volume_id_get_buffer(id, off + ((i+1) * bsize), 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if (memcmp(part->signature, "PM", 2) != 0) - return -1; - - poff = be32_to_cpu(part->start_block) * bsize; - plen = be32_to_cpu(part->block_count) * bsize; - dbg("found '%s' partition entry at 0x%llx, len 0x%llx", - part->type, poff, plen); - - id->partitions[i].off = poff; - id->partitions[i].len = plen; - - if (memcmp(part->type, "Apple_Free", 10) == 0) { - volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED); - } else if (memcmp(part->type, "Apple_partition_map", 19) == 0) { - volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE); - } else { - volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED); - } - } - volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); - id->type = "mac_partition_map"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/volume_id/mac/mac.h b/extras/volume_id/volume_id/mac/mac.h deleted file mode 100644 index 888c1c527d..0000000000 --- a/extras/volume_id/volume_id/mac/mac.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_MAC_ -#define _VOLUME_ID_MAC_ - -extern int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/msdos.c b/extras/volume_id/volume_id/msdos.c new file mode 100644 index 0000000000..fc2f99d4d0 --- /dev/null +++ b/extras/volume_id/volume_id/msdos.c @@ -0,0 +1,215 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "msdos.h" + +struct msdos_partition_entry { + __u8 boot_ind; + __u8 head; + __u8 sector; + __u8 cyl; + __u8 sys_ind; + __u8 end_head; + __u8 end_sector; + __u8 end_cyl; + __u32 start_sect; + __u32 nr_sects; +} __attribute__((packed)); + +#define MSDOS_MAGIC "\x55\xaa" +#define MSDOS_PARTTABLE_OFFSET 0x1be +#define MSDOS_SIG_OFF 0x1fe +#define BSIZE 0x200 +#define DOS_EXTENDED_PARTITION 0x05 +#define LINUX_EXTENDED_PARTITION 0x85 +#define WIN98_EXTENDED_PARTITION 0x0f +#define LINUX_RAID_PARTITION 0xfd +#define is_extended(type) \ + (type == DOS_EXTENDED_PARTITION || \ + type == WIN98_EXTENDED_PARTITION || \ + type == LINUX_EXTENDED_PARTITION) +#define is_raid(type) \ + (type == LINUX_RAID_PARTITION) + +int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) +{ + const __u8 *buf; + int i; + __u64 poff; + __u64 plen; + __u64 extended = 0; + __u64 current; + __u64 next; + int limit; + int empty = 1; + struct msdos_partition_entry *part; + struct volume_id_partition *p; + + dbg("probing at offset %llu", off); + + buf = volume_id_get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + return -1; + + /* check flags on all entries for a valid partition table */ + part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; + for (i = 0; i < 4; i++) { + if (part[i].boot_ind != 0 && + part[i].boot_ind != 0x80) + return -1; + + if (le32_to_cpu(part[i].nr_sects) != 0) + empty = 0; + } + if (empty == 1) + return -1; + + if (id->partitions != NULL) + free(id->partitions); + id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX * + sizeof(struct volume_id_partition)); + if (id->partitions == NULL) + return -1; + memset(id->partitions, 0x00, + VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); + + for (i = 0; i < 4; i++) { + poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + + if (plen == 0) + continue; + + p = &id->partitions[i]; + + p->partition_type_raw = part[i].sys_ind; + + if (is_extended(part[i].sys_ind)) { + dbg("found extended partition at 0x%llx", poff); + volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE); + p->type = "msdos_extended_partition"; + if (extended == 0) + extended = off + poff; + } else { + dbg("found 0x%x data partition at 0x%llx, len 0x%llx", + part[i].sys_ind, poff, plen); + + if (is_raid(part[i].sys_ind)) + volume_id_set_usage_part(p, VOLUME_ID_RAID); + else + volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); + } + + p->off = off + poff; + p->len = plen; + id->partition_count = i+1; + } + + next = extended; + current = extended; + limit = 50; + + /* follow extended partition chain and add data partitions */ + while (next != 0) { + if (limit-- == 0) { + dbg("extended chain limit reached"); + break; + } + + buf = volume_id_get_buffer(id, current, 0x200); + if (buf == NULL) + break; + + part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; + + if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + break; + + next = 0; + + for (i = 0; i < 4; i++) { + poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + + if (plen == 0) + continue; + + if (is_extended(part[i].sys_ind)) { + dbg("found extended partition at 0x%llx", poff); + if (next == 0) + next = extended + poff; + } else { + dbg("found 0x%x data partition at 0x%llx, len 0x%llx", + part[i].sys_ind, poff, plen); + + /* we always start at the 5th entry */ + while (id->partition_count < 4) + volume_id_set_usage_part(&id->partitions[id->partition_count++], VOLUME_ID_UNUSED); + + p = &id->partitions[id->partition_count]; + + if (is_raid(part[i].sys_ind)) + volume_id_set_usage_part(p, VOLUME_ID_RAID); + else + volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); + + p->off = current + poff; + p->len = plen; + id->partition_count++; + + p->partition_type_raw = part[i].sys_ind; + + if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { + dbg("too many partitions"); + next = 0; + } + } + } + + current = next; + } + + volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); + id->type = "msdos_partition_table"; + + return 0; +} diff --git a/extras/volume_id/volume_id/msdos.h b/extras/volume_id/volume_id/msdos.h new file mode 100644 index 0000000000..55185c006b --- /dev/null +++ b/extras/volume_id/volume_id/msdos.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_MSDOS_ +#define _VOLUME_ID_MSDOS_ + +extern int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/msdos/msdos.c b/extras/volume_id/volume_id/msdos/msdos.c deleted file mode 100644 index a90b9efc33..0000000000 --- a/extras/volume_id/volume_id/msdos/msdos.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "msdos.h" - -struct msdos_partition_entry { - __u8 boot_ind; - __u8 head; - __u8 sector; - __u8 cyl; - __u8 sys_ind; - __u8 end_head; - __u8 end_sector; - __u8 end_cyl; - __u32 start_sect; - __u32 nr_sects; -} __attribute__((packed)); - -#define MSDOS_MAGIC "\x55\xaa" -#define MSDOS_PARTTABLE_OFFSET 0x1be -#define MSDOS_SIG_OFF 0x1fe -#define BSIZE 0x200 -#define DOS_EXTENDED_PARTITION 0x05 -#define LINUX_EXTENDED_PARTITION 0x85 -#define WIN98_EXTENDED_PARTITION 0x0f -#define LINUX_RAID_PARTITION 0xfd -#define is_extended(type) \ - (type == DOS_EXTENDED_PARTITION || \ - type == WIN98_EXTENDED_PARTITION || \ - type == LINUX_EXTENDED_PARTITION) -#define is_raid(type) \ - (type == LINUX_RAID_PARTITION) - -int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) -{ - const __u8 *buf; - int i; - __u64 poff; - __u64 plen; - __u64 extended = 0; - __u64 current; - __u64 next; - int limit; - int empty = 1; - struct msdos_partition_entry *part; - struct volume_id_partition *p; - - dbg("probing at offset %llu", off); - - buf = volume_id_get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) - return -1; - - /* check flags on all entries for a valid partition table */ - part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; - for (i = 0; i < 4; i++) { - if (part[i].boot_ind != 0 && - part[i].boot_ind != 0x80) - return -1; - - if (le32_to_cpu(part[i].nr_sects) != 0) - empty = 0; - } - if (empty == 1) - return -1; - - if (id->partitions != NULL) - free(id->partitions); - id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX * - sizeof(struct volume_id_partition)); - if (id->partitions == NULL) - return -1; - memset(id->partitions, 0x00, - VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); - - for (i = 0; i < 4; i++) { - poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; - - if (plen == 0) - continue; - - p = &id->partitions[i]; - - p->partition_type_raw = part[i].sys_ind; - - if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", poff); - volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE); - p->type = "msdos_extended_partition"; - if (extended == 0) - extended = off + poff; - } else { - dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, poff, plen); - - if (is_raid(part[i].sys_ind)) - volume_id_set_usage_part(p, VOLUME_ID_RAID); - else - volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); - } - - p->off = off + poff; - p->len = plen; - id->partition_count = i+1; - } - - next = extended; - current = extended; - limit = 50; - - /* follow extended partition chain and add data partitions */ - while (next != 0) { - if (limit-- == 0) { - dbg("extended chain limit reached"); - break; - } - - buf = volume_id_get_buffer(id, current, 0x200); - if (buf == NULL) - break; - - part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; - - if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) - break; - - next = 0; - - for (i = 0; i < 4; i++) { - poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; - - if (plen == 0) - continue; - - if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", poff); - if (next == 0) - next = extended + poff; - } else { - dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, poff, plen); - - /* we always start at the 5th entry */ - while (id->partition_count < 4) - volume_id_set_usage_part(&id->partitions[id->partition_count++], VOLUME_ID_UNUSED); - - p = &id->partitions[id->partition_count]; - - if (is_raid(part[i].sys_ind)) - volume_id_set_usage_part(p, VOLUME_ID_RAID); - else - volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); - - p->off = current + poff; - p->len = plen; - id->partition_count++; - - p->partition_type_raw = part[i].sys_ind; - - if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { - dbg("too many partitions"); - next = 0; - } - } - } - - current = next; - } - - volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); - id->type = "msdos_partition_table"; - - return 0; -} diff --git a/extras/volume_id/volume_id/msdos/msdos.h b/extras/volume_id/volume_id/msdos/msdos.h deleted file mode 100644 index 55185c006b..0000000000 --- a/extras/volume_id/volume_id/msdos/msdos.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_MSDOS_ -#define _VOLUME_ID_MSDOS_ - -extern int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/ntfs.c b/extras/volume_id/volume_id/ntfs.c new file mode 100644 index 0000000000..84d6fbb843 --- /dev/null +++ b/extras/volume_id/volume_id/ntfs.c @@ -0,0 +1,207 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "ntfs.h" + +struct ntfs_super_block { + __u8 jump[3]; + __u8 oem_id[8]; + __u16 bytes_per_sector; + __u8 sectors_per_cluster; + __u16 reserved_sectors; + __u8 fats; + __u16 root_entries; + __u16 sectors; + __u8 media_type; + __u16 sectors_per_fat; + __u16 sectors_per_track; + __u16 heads; + __u32 hidden_sectors; + __u32 large_sectors; + __u16 unused[2]; + __u64 number_of_sectors; + __u64 mft_cluster_location; + __u64 mft_mirror_cluster_location; + __s8 cluster_per_mft_record; + __u8 reserved1[3]; + __s8 cluster_per_index_record; + __u8 reserved2[3]; + __u8 volume_serial[8]; + __u16 checksum; +} __attribute__((__packed__)) *ns; + +struct master_file_table_record { + __u8 magic[4]; + __u16 usa_ofs; + __u16 usa_count; + __u64 lsn; + __u16 sequence_number; + __u16 link_count; + __u16 attrs_offset; + __u16 flags; + __u32 bytes_in_use; + __u32 bytes_allocated; +} __attribute__((__packed__)) *mftr; + +struct file_attribute { + __u32 type; + __u32 len; + __u8 non_resident; + __u8 name_len; + __u16 name_offset; + __u16 flags; + __u16 instance; + __u32 value_len; + __u16 value_offset; +} __attribute__((__packed__)) *attr; + +struct volume_info { + __u64 reserved; + __u8 major_ver; + __u8 minor_ver; +} __attribute__((__packed__)) *info; + +#define MFT_RECORD_VOLUME 3 +#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 +#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 +#define MFT_RECORD_ATTR_OBJECT_ID 0x40 +#define MFT_RECORD_ATTR_END 0xffffffffu + +int volume_id_probe_ntfs(struct volume_id *id, __u64 off) +{ + unsigned int sector_size; + unsigned int cluster_size; + __u64 mft_cluster; + __u64 mft_off; + unsigned int mft_record_size; + unsigned int attr_type; + unsigned int attr_off; + unsigned int attr_len; + unsigned int val_off; + unsigned int val_len; + const __u8 *buf; + const __u8 *val; + + dbg("probing at offset %llu", off); + + ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); + if (ns == NULL) + return -1; + + if (memcmp(ns->oem_id, "NTFS", 4) != 0) + return -1; + + volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS); + + sector_size = le16_to_cpu(ns->bytes_per_sector); + cluster_size = ns->sectors_per_cluster * sector_size; + mft_cluster = le64_to_cpu(ns->mft_cluster_location); + mft_off = mft_cluster * cluster_size; + + if (ns->cluster_per_mft_record < 0) + /* size = -log2(mft_record_size); normally 1024 Bytes */ + mft_record_size = 1 << -ns->cluster_per_mft_record; + else + mft_record_size = ns->cluster_per_mft_record * cluster_size; + + dbg("sectorsize 0x%x", sector_size); + dbg("clustersize 0x%x", cluster_size); + dbg("mftcluster %lli", mft_cluster); + dbg("mftoffset 0x%llx", mft_off); + dbg("cluster per mft_record %i", ns->cluster_per_mft_record); + dbg("mft record size %i", mft_record_size); + + buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), + mft_record_size); + if (buf == NULL) + goto found; + + mftr = (struct master_file_table_record*) buf; + + dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); + if (memcmp(mftr->magic, "FILE", 4) != 0) + goto found; + + attr_off = le16_to_cpu(mftr->attrs_offset); + dbg("file $Volume's attributes are at offset %i", attr_off); + + while (1) { + attr = (struct file_attribute*) &buf[attr_off]; + attr_type = le32_to_cpu(attr->type); + attr_len = le16_to_cpu(attr->len); + val_off = le16_to_cpu(attr->value_offset); + val_len = le32_to_cpu(attr->value_len); + attr_off += attr_len; + + if (attr_len == 0) + break; + + if (attr_off >= mft_record_size) + break; + + if (attr_type == MFT_RECORD_ATTR_END) + break; + + dbg("found attribute type 0x%x, len %i, at offset %i", + attr_type, attr_len, attr_off); + + if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { + dbg("found info, len %i", val_len); + info = (struct volume_info*) (((__u8 *) attr) + val_off); + snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, + "%u.%u", info->major_ver, info->minor_ver); + } + + if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { + dbg("found label, len %i", val_len); + if (val_len > VOLUME_ID_LABEL_SIZE) + val_len = VOLUME_ID_LABEL_SIZE; + + val = ((__u8 *) attr) + val_off; + volume_id_set_label_raw(id, val, val_len); + volume_id_set_label_unicode16(id, val, LE, val_len); + } + } + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "ntfs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/ntfs.h b/extras/volume_id/volume_id/ntfs.h new file mode 100644 index 0000000000..63b1161d51 --- /dev/null +++ b/extras/volume_id/volume_id/ntfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_NTFS_ +#define _VOLUME_ID_NTFS_ + +extern int volume_id_probe_ntfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/ntfs/ntfs.c b/extras/volume_id/volume_id/ntfs/ntfs.c deleted file mode 100644 index e46bc64bb2..0000000000 --- a/extras/volume_id/volume_id/ntfs/ntfs.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "ntfs.h" - -struct ntfs_super_block { - __u8 jump[3]; - __u8 oem_id[8]; - __u16 bytes_per_sector; - __u8 sectors_per_cluster; - __u16 reserved_sectors; - __u8 fats; - __u16 root_entries; - __u16 sectors; - __u8 media_type; - __u16 sectors_per_fat; - __u16 sectors_per_track; - __u16 heads; - __u32 hidden_sectors; - __u32 large_sectors; - __u16 unused[2]; - __u64 number_of_sectors; - __u64 mft_cluster_location; - __u64 mft_mirror_cluster_location; - __s8 cluster_per_mft_record; - __u8 reserved1[3]; - __s8 cluster_per_index_record; - __u8 reserved2[3]; - __u8 volume_serial[8]; - __u16 checksum; -} __attribute__((__packed__)) *ns; - -struct master_file_table_record { - __u8 magic[4]; - __u16 usa_ofs; - __u16 usa_count; - __u64 lsn; - __u16 sequence_number; - __u16 link_count; - __u16 attrs_offset; - __u16 flags; - __u32 bytes_in_use; - __u32 bytes_allocated; -} __attribute__((__packed__)) *mftr; - -struct file_attribute { - __u32 type; - __u32 len; - __u8 non_resident; - __u8 name_len; - __u16 name_offset; - __u16 flags; - __u16 instance; - __u32 value_len; - __u16 value_offset; -} __attribute__((__packed__)) *attr; - -struct volume_info { - __u64 reserved; - __u8 major_ver; - __u8 minor_ver; -} __attribute__((__packed__)) *info; - -#define MFT_RECORD_VOLUME 3 -#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 -#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 -#define MFT_RECORD_ATTR_OBJECT_ID 0x40 -#define MFT_RECORD_ATTR_END 0xffffffffu - -int volume_id_probe_ntfs(struct volume_id *id, __u64 off) -{ - unsigned int sector_size; - unsigned int cluster_size; - __u64 mft_cluster; - __u64 mft_off; - unsigned int mft_record_size; - unsigned int attr_type; - unsigned int attr_off; - unsigned int attr_len; - unsigned int val_off; - unsigned int val_len; - const __u8 *buf; - const __u8 *val; - - dbg("probing at offset %llu", off); - - ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); - if (ns == NULL) - return -1; - - if (memcmp(ns->oem_id, "NTFS", 4) != 0) - return -1; - - volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS); - - sector_size = le16_to_cpu(ns->bytes_per_sector); - cluster_size = ns->sectors_per_cluster * sector_size; - mft_cluster = le64_to_cpu(ns->mft_cluster_location); - mft_off = mft_cluster * cluster_size; - - if (ns->cluster_per_mft_record < 0) - /* size = -log2(mft_record_size); normally 1024 Bytes */ - mft_record_size = 1 << -ns->cluster_per_mft_record; - else - mft_record_size = ns->cluster_per_mft_record * cluster_size; - - dbg("sectorsize 0x%x", sector_size); - dbg("clustersize 0x%x", cluster_size); - dbg("mftcluster %lli", mft_cluster); - dbg("mftoffset 0x%llx", mft_off); - dbg("cluster per mft_record %i", ns->cluster_per_mft_record); - dbg("mft record size %i", mft_record_size); - - buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), - mft_record_size); - if (buf == NULL) - goto found; - - mftr = (struct master_file_table_record*) buf; - - dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); - if (memcmp(mftr->magic, "FILE", 4) != 0) - goto found; - - attr_off = le16_to_cpu(mftr->attrs_offset); - dbg("file $Volume's attributes are at offset %i", attr_off); - - while (1) { - attr = (struct file_attribute*) &buf[attr_off]; - attr_type = le32_to_cpu(attr->type); - attr_len = le16_to_cpu(attr->len); - val_off = le16_to_cpu(attr->value_offset); - val_len = le32_to_cpu(attr->value_len); - attr_off += attr_len; - - if (attr_len == 0) - break; - - if (attr_off >= mft_record_size) - break; - - if (attr_type == MFT_RECORD_ATTR_END) - break; - - dbg("found attribute type 0x%x, len %i, at offset %i", - attr_type, attr_len, attr_off); - - if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { - dbg("found info, len %i", val_len); - info = (struct volume_info*) (((__u8 *) attr) + val_off); - snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, - "%u.%u", info->major_ver, info->minor_ver); - } - - if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { - dbg("found label, len %i", val_len); - if (val_len > VOLUME_ID_LABEL_SIZE) - val_len = VOLUME_ID_LABEL_SIZE; - - val = ((__u8 *) attr) + val_off; - volume_id_set_label_raw(id, val, val_len); - volume_id_set_label_unicode16(id, val, LE, val_len); - } - } - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "ntfs"; - - return 0; -} diff --git a/extras/volume_id/volume_id/ntfs/ntfs.h b/extras/volume_id/volume_id/ntfs/ntfs.h deleted file mode 100644 index 63b1161d51..0000000000 --- a/extras/volume_id/volume_id/ntfs/ntfs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_NTFS_ -#define _VOLUME_ID_NTFS_ - -extern int volume_id_probe_ntfs(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c new file mode 100644 index 0000000000..b74b8ae576 --- /dev/null +++ b/extras/volume_id/volume_id/reiserfs.c @@ -0,0 +1,101 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "reiserfs.h" + +struct reiserfs_super_block { + __u32 blocks_count; + __u32 free_blocks; + __u32 root_block; + __u32 journal_block; + __u32 journal_dev; + __u32 orig_journal_size; + __u32 dummy2[5]; + __u16 blocksize; + __u16 dummy3[3]; + __u8 magic[12]; + __u32 dummy4[5]; + __u8 uuid[16]; + __u8 label[16]; +} __attribute__((__packed__)); + +#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 +#define REISERFS_SUPERBLOCK_OFFSET 0x10000 + +int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) +{ + struct reiserfs_super_block *rs; + + dbg("probing at offset %llu", off); + + rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); + if (rs == NULL) + return -1; + + if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { + strcpy(id->type_version, "3.6"); + goto found; + } + + if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { + strcpy(id->type_version, "JR"); + goto found; + } + + rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); + if (rs == NULL) + return -1; + + if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { + strcpy(id->type_version, "3.5"); + goto found; + } + + return -1; + +found: + volume_id_set_label_raw(id, rs->label, 16); + volume_id_set_label_string(id, rs->label, 16); + volume_id_set_uuid(id, rs->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "reiserfs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/reiserfs.h b/extras/volume_id/volume_id/reiserfs.h new file mode 100644 index 0000000000..14f094578f --- /dev/null +++ b/extras/volume_id/volume_id/reiserfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_REISERFS_ +#define _VOLUME_ID_REISERFS_ + +extern int volume_id_probe_reiserfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/reiserfs/reiserfs.c b/extras/volume_id/volume_id/reiserfs/reiserfs.c deleted file mode 100644 index d54013e4c5..0000000000 --- a/extras/volume_id/volume_id/reiserfs/reiserfs.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "reiserfs.h" - -struct reiserfs_super_block { - __u32 blocks_count; - __u32 free_blocks; - __u32 root_block; - __u32 journal_block; - __u32 journal_dev; - __u32 orig_journal_size; - __u32 dummy2[5]; - __u16 blocksize; - __u16 dummy3[3]; - __u8 magic[12]; - __u32 dummy4[5]; - __u8 uuid[16]; - __u8 label[16]; -} __attribute__((__packed__)); - -#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 -#define REISERFS_SUPERBLOCK_OFFSET 0x10000 - -int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) -{ - struct reiserfs_super_block *rs; - - dbg("probing at offset %llu", off); - - rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); - if (rs == NULL) - return -1; - - if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { - strcpy(id->type_version, "3.6"); - goto found; - } - - if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { - strcpy(id->type_version, "JR"); - goto found; - } - - rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); - if (rs == NULL) - return -1; - - if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { - strcpy(id->type_version, "3.5"); - goto found; - } - - return -1; - -found: - volume_id_set_label_raw(id, rs->label, 16); - volume_id_set_label_string(id, rs->label, 16); - volume_id_set_uuid(id, rs->uuid, UUID_DCE); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "reiserfs"; - - return 0; -} diff --git a/extras/volume_id/volume_id/reiserfs/reiserfs.h b/extras/volume_id/volume_id/reiserfs/reiserfs.h deleted file mode 100644 index 14f094578f..0000000000 --- a/extras/volume_id/volume_id/reiserfs/reiserfs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_REISERFS_ -#define _VOLUME_ID_REISERFS_ - -extern int volume_id_probe_reiserfs(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/romfs.c b/extras/volume_id/volume_id/romfs.c new file mode 100644 index 0000000000..fe5e5a4827 --- /dev/null +++ b/extras/volume_id/volume_id/romfs.c @@ -0,0 +1,73 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "romfs.h" + +struct romfs_super { + __u8 magic[8]; + __u32 size; + __u32 checksum; + __u8 name[0]; +} __attribute__((__packed__)); + +int volume_id_probe_romfs(struct volume_id *id, __u64 off) +{ + struct romfs_super *rfs; + + dbg("probing at offset %llu", off); + + rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); + if (rfs == NULL) + return -1; + + if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { + size_t len = strlen(rfs->name); + + if (len) { + volume_id_set_label_raw(id, rfs->name, len); + volume_id_set_label_string(id, rfs->name, len); + } + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "romfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/volume_id/romfs.h b/extras/volume_id/volume_id/romfs.h new file mode 100644 index 0000000000..b0108f3dde --- /dev/null +++ b/extras/volume_id/volume_id/romfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_ROMFS_ +#define _VOLUME_ID_ROMFS_ + +extern int volume_id_probe_romfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/romfs/romfs.c b/extras/volume_id/volume_id/romfs/romfs.c deleted file mode 100644 index c04dc98f10..0000000000 --- a/extras/volume_id/volume_id/romfs/romfs.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "romfs.h" - -struct romfs_super { - __u8 magic[8]; - __u32 size; - __u32 checksum; - __u8 name[0]; -} __attribute__((__packed__)); - -int volume_id_probe_romfs(struct volume_id *id, __u64 off) -{ - struct romfs_super *rfs; - - dbg("probing at offset %llu", off); - - rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); - if (rfs == NULL) - return -1; - - if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { - size_t len = strlen(rfs->name); - - if (len) { - volume_id_set_label_raw(id, rfs->name, len); - volume_id_set_label_string(id, rfs->name, len); - } - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "romfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/volume_id/romfs/romfs.h b/extras/volume_id/volume_id/romfs/romfs.h deleted file mode 100644 index b0108f3dde..0000000000 --- a/extras/volume_id/volume_id/romfs/romfs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_ROMFS_ -#define _VOLUME_ID_ROMFS_ - -extern int volume_id_probe_romfs(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/sysv.c b/extras/volume_id/volume_id/sysv.c new file mode 100644 index 0000000000..6c4408d80c --- /dev/null +++ b/extras/volume_id/volume_id/sysv.c @@ -0,0 +1,146 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "sysv.h" + +#define SYSV_NICINOD 100 +#define SYSV_NICFREE 50 + +struct sysv_super +{ + __u16 s_isize; + __u16 s_pad0; + __u32 s_fsize; + __u16 s_nfree; + __u16 s_pad1; + __u32 s_free[SYSV_NICFREE]; + __u16 s_ninode; + __u16 s_pad2; + __u16 s_inode[SYSV_NICINOD]; + __u8 s_flock; + __u8 s_ilock; + __u8 s_fmod; + __u8 s_ronly; + __u32 s_time; + __u16 s_dinfo[4]; + __u32 s_tfree; + __u16 s_tinode; + __u16 s_pad3; + __u8 s_fname[6]; + __u8 s_fpack[6]; + __u32 s_fill[12]; + __u32 s_state; + __u32 s_magic; + __u32 s_type; +} __attribute__((__packed__)); + +#define XENIX_NICINOD 100 +#define XENIX_NICFREE 100 + +struct xenix_super { + __u16 s_isize; + __u32 s_fsize; + __u16 s_nfree; + __u32 s_free[XENIX_NICFREE]; + __u16 s_ninode; + __u16 s_inode[XENIX_NICINOD]; + __u8 s_flock; + __u8 s_ilock; + __u8 s_fmod; + __u8 s_ronly; + __u32 s_time; + __u32 s_tfree; + __u16 s_tinode; + __u16 s_dinfo[4]; + __u8 s_fname[6]; + __u8 s_fpack[6]; + __u8 s_clean; + __u8 s_fill[371]; + __u32 s_magic; + __u32 s_type; +} __attribute__((__packed__)); + +#define SYSV_SUPERBLOCK_BLOCK 0x01 +#define SYSV_MAGIC 0xfd187e20 +#define XENIX_SUPERBLOCK_BLOCK 0x18 +#define XENIX_MAGIC 0x2b5544 +#define SYSV_MAX_BLOCKSIZE 0x800 + +int volume_id_probe_sysv(struct volume_id *id, __u64 off) +{ + struct sysv_super *vs; + struct xenix_super *xs; + unsigned int boff; + + dbg("probing at offset %llu", off); + + for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { + vs = (struct sysv_super *) + volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200); + if (vs == NULL) + return -1; + + if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) { + volume_id_set_label_raw(id, vs->s_fname, 6); + volume_id_set_label_string(id, vs->s_fname, 6); + id->type = "sysv"; + goto found; + } + } + + for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { + xs = (struct xenix_super *) + volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200); + if (xs == NULL) + return -1; + + if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) { + volume_id_set_label_raw(id, xs->s_fname, 6); + volume_id_set_label_string(id, xs->s_fname, 6); + id->type = "xenix"; + goto found; + } + } + + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + return 0; +} diff --git a/extras/volume_id/volume_id/sysv.h b/extras/volume_id/volume_id/sysv.h new file mode 100644 index 0000000000..bd5a3500fb --- /dev/null +++ b/extras/volume_id/volume_id/sysv.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_SYSV_ +#define _VOLUME_ID_SYSV_ + +extern int volume_id_probe_sysv(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/sysv/sysv.c b/extras/volume_id/volume_id/sysv/sysv.c deleted file mode 100644 index 313ac1732a..0000000000 --- a/extras/volume_id/volume_id/sysv/sysv.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "sysv.h" - -#define SYSV_NICINOD 100 -#define SYSV_NICFREE 50 - -struct sysv_super -{ - __u16 s_isize; - __u16 s_pad0; - __u32 s_fsize; - __u16 s_nfree; - __u16 s_pad1; - __u32 s_free[SYSV_NICFREE]; - __u16 s_ninode; - __u16 s_pad2; - __u16 s_inode[SYSV_NICINOD]; - __u8 s_flock; - __u8 s_ilock; - __u8 s_fmod; - __u8 s_ronly; - __u32 s_time; - __u16 s_dinfo[4]; - __u32 s_tfree; - __u16 s_tinode; - __u16 s_pad3; - __u8 s_fname[6]; - __u8 s_fpack[6]; - __u32 s_fill[12]; - __u32 s_state; - __u32 s_magic; - __u32 s_type; -} __attribute__((__packed__)); - -#define XENIX_NICINOD 100 -#define XENIX_NICFREE 100 - -struct xenix_super { - __u16 s_isize; - __u32 s_fsize; - __u16 s_nfree; - __u32 s_free[XENIX_NICFREE]; - __u16 s_ninode; - __u16 s_inode[XENIX_NICINOD]; - __u8 s_flock; - __u8 s_ilock; - __u8 s_fmod; - __u8 s_ronly; - __u32 s_time; - __u32 s_tfree; - __u16 s_tinode; - __u16 s_dinfo[4]; - __u8 s_fname[6]; - __u8 s_fpack[6]; - __u8 s_clean; - __u8 s_fill[371]; - __u32 s_magic; - __u32 s_type; -} __attribute__((__packed__)); - -#define SYSV_SUPERBLOCK_BLOCK 0x01 -#define SYSV_MAGIC 0xfd187e20 -#define XENIX_SUPERBLOCK_BLOCK 0x18 -#define XENIX_MAGIC 0x2b5544 -#define SYSV_MAX_BLOCKSIZE 0x800 - -int volume_id_probe_sysv(struct volume_id *id, __u64 off) -{ - struct sysv_super *vs; - struct xenix_super *xs; - unsigned int boff; - - dbg("probing at offset %llu", off); - - for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { - vs = (struct sysv_super *) - volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200); - if (vs == NULL) - return -1; - - if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) { - volume_id_set_label_raw(id, vs->s_fname, 6); - volume_id_set_label_string(id, vs->s_fname, 6); - id->type = "sysv"; - goto found; - } - } - - for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { - xs = (struct xenix_super *) - volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200); - if (xs == NULL) - return -1; - - if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) { - volume_id_set_label_raw(id, xs->s_fname, 6); - volume_id_set_label_string(id, xs->s_fname, 6); - id->type = "xenix"; - goto found; - } - } - - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - return 0; -} diff --git a/extras/volume_id/volume_id/sysv/sysv.h b/extras/volume_id/volume_id/sysv/sysv.h deleted file mode 100644 index bd5a3500fb..0000000000 --- a/extras/volume_id/volume_id/sysv/sysv.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_SYSV_ -#define _VOLUME_ID_SYSV_ - -extern int volume_id_probe_sysv(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/udf.c b/extras/volume_id/volume_id/udf.c new file mode 100644 index 0000000000..06b521545f --- /dev/null +++ b/extras/volume_id/volume_id/udf.c @@ -0,0 +1,191 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "udf.h" + +struct volume_descriptor { + struct descriptor_tag { + __u16 id; + __u16 version; + __u8 checksum; + __u8 reserved; + __u16 serial; + __u16 crc; + __u16 crc_len; + __u32 location; + } __attribute__((__packed__)) tag; + union { + struct anchor_descriptor { + __u32 length; + __u32 location; + } __attribute__((__packed__)) anchor; + struct primary_descriptor { + __u32 seq_num; + __u32 desc_num; + struct dstring { + __u8 clen; + __u8 c[31]; + } __attribute__((__packed__)) ident; + } __attribute__((__packed__)) primary; + } __attribute__((__packed__)) type; +} __attribute__((__packed__)); + +struct volume_structure_descriptor { + __u8 type; + __u8 id[5]; + __u8 version; +} __attribute__((__packed__)); + +#define UDF_VSD_OFFSET 0x8000 + +int volume_id_probe_udf(struct volume_id *id, __u64 off) +{ + struct volume_descriptor *vd; + struct volume_structure_descriptor *vsd; + unsigned int bs; + unsigned int b; + unsigned int type; + unsigned int count; + unsigned int loc; + unsigned int clen; + + dbg("probing at offset %llu", off); + + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); + if (vsd == NULL) + return -1; + + if (memcmp(vsd->id, "NSR02", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "NSR03", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "BEA01", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "BOOT2", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "CD001", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "CDW02", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "TEA03", 5) == 0) + goto blocksize; + return -1; + +blocksize: + /* search the next VSD to get the logical block size of the volume */ + for (bs = 0x800; bs < 0x8000; bs += 0x800) { + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); + if (vsd == NULL) + return -1; + dbg("test for blocksize: 0x%x", bs); + if (vsd->id[0] != '\0') + goto nsr; + } + return -1; + +nsr: + /* search the list of VSDs for a NSR descriptor */ + for (b = 0; b < 64; b++) { + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); + if (vsd == NULL) + return -1; + + dbg("vsd: %c%c%c%c%c", + vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); + + if (vsd->id[0] == '\0') + return -1; + if (memcmp(vsd->id, "NSR02", 5) == 0) + goto anchor; + if (memcmp(vsd->id, "NSR03", 5) == 0) + goto anchor; + } + return -1; + +anchor: + /* read anchor volume descriptor */ + vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + if (type != 2) /* TAG_ID_AVDP */ + goto found; + + /* get desriptor list address and block count */ + count = le32_to_cpu(vd->type.anchor.length) / bs; + loc = le32_to_cpu(vd->type.anchor.location); + dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); + + /* pick the primary descriptor from the list */ + for (b = 0; b < count; b++) { + vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + dbg("descriptor type %i", type); + + /* check validity */ + if (type == 0) + goto found; + if (le32_to_cpu(vd->tag.location) != loc + b) + goto found; + + if (type == 1) /* TAG_ID_PVD */ + goto pvd; + } + goto found; + +pvd: + volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); + + clen = vd->type.primary.ident.clen; + dbg("label string charsize=%i bit", clen); + if (clen == 8) + volume_id_set_label_string(id, vd->type.primary.ident.c, 31); + else if (clen == 16) + volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "udf"; + + return 0; +} diff --git a/extras/volume_id/volume_id/udf.h b/extras/volume_id/volume_id/udf.h new file mode 100644 index 0000000000..b112e46ffc --- /dev/null +++ b/extras/volume_id/volume_id/udf.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_UDF_ +#define _VOLUME_ID_UDF_ + +extern int volume_id_probe_udf(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/udf/udf.c b/extras/volume_id/volume_id/udf/udf.c deleted file mode 100644 index 79d25ad890..0000000000 --- a/extras/volume_id/volume_id/udf/udf.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "udf.h" - -struct volume_descriptor { - struct descriptor_tag { - __u16 id; - __u16 version; - __u8 checksum; - __u8 reserved; - __u16 serial; - __u16 crc; - __u16 crc_len; - __u32 location; - } __attribute__((__packed__)) tag; - union { - struct anchor_descriptor { - __u32 length; - __u32 location; - } __attribute__((__packed__)) anchor; - struct primary_descriptor { - __u32 seq_num; - __u32 desc_num; - struct dstring { - __u8 clen; - __u8 c[31]; - } __attribute__((__packed__)) ident; - } __attribute__((__packed__)) primary; - } __attribute__((__packed__)) type; -} __attribute__((__packed__)); - -struct volume_structure_descriptor { - __u8 type; - __u8 id[5]; - __u8 version; -} __attribute__((__packed__)); - -#define UDF_VSD_OFFSET 0x8000 - -int volume_id_probe_udf(struct volume_id *id, __u64 off) -{ - struct volume_descriptor *vd; - struct volume_structure_descriptor *vsd; - unsigned int bs; - unsigned int b; - unsigned int type; - unsigned int count; - unsigned int loc; - unsigned int clen; - - dbg("probing at offset %llu", off); - - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); - if (vsd == NULL) - return -1; - - if (memcmp(vsd->id, "NSR02", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "NSR03", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "BEA01", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "BOOT2", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "CD001", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "CDW02", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "TEA03", 5) == 0) - goto blocksize; - return -1; - -blocksize: - /* search the next VSD to get the logical block size of the volume */ - for (bs = 0x800; bs < 0x8000; bs += 0x800) { - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); - if (vsd == NULL) - return -1; - dbg("test for blocksize: 0x%x", bs); - if (vsd->id[0] != '\0') - goto nsr; - } - return -1; - -nsr: - /* search the list of VSDs for a NSR descriptor */ - for (b = 0; b < 64; b++) { - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); - if (vsd == NULL) - return -1; - - dbg("vsd: %c%c%c%c%c", - vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); - - if (vsd->id[0] == '\0') - return -1; - if (memcmp(vsd->id, "NSR02", 5) == 0) - goto anchor; - if (memcmp(vsd->id, "NSR03", 5) == 0) - goto anchor; - } - return -1; - -anchor: - /* read anchor volume descriptor */ - vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - if (type != 2) /* TAG_ID_AVDP */ - goto found; - - /* get desriptor list address and block count */ - count = le32_to_cpu(vd->type.anchor.length) / bs; - loc = le32_to_cpu(vd->type.anchor.location); - dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); - - /* pick the primary descriptor from the list */ - for (b = 0; b < count; b++) { - vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - dbg("descriptor type %i", type); - - /* check validity */ - if (type == 0) - goto found; - if (le32_to_cpu(vd->tag.location) != loc + b) - goto found; - - if (type == 1) /* TAG_ID_PVD */ - goto pvd; - } - goto found; - -pvd: - volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); - - clen = vd->type.primary.ident.clen; - dbg("label string charsize=%i bit", clen); - if (clen == 8) - volume_id_set_label_string(id, vd->type.primary.ident.c, 31); - else if (clen == 16) - volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "udf"; - - return 0; -} diff --git a/extras/volume_id/volume_id/udf/udf.h b/extras/volume_id/volume_id/udf/udf.h deleted file mode 100644 index b112e46ffc..0000000000 --- a/extras/volume_id/volume_id/udf/udf.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_UDF_ -#define _VOLUME_ID_UDF_ - -extern int volume_id_probe_udf(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/ufs.c b/extras/volume_id/volume_id/ufs.c new file mode 100644 index 0000000000..37e74aee6f --- /dev/null +++ b/extras/volume_id/volume_id/ufs.c @@ -0,0 +1,223 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "ufs.h" + +struct ufs_super_block { + __u32 fs_link; + __u32 fs_rlink; + __u32 fs_sblkno; + __u32 fs_cblkno; + __u32 fs_iblkno; + __u32 fs_dblkno; + __u32 fs_cgoffset; + __u32 fs_cgmask; + __u32 fs_time; + __u32 fs_size; + __u32 fs_dsize; + __u32 fs_ncg; + __u32 fs_bsize; + __u32 fs_fsize; + __u32 fs_frag; + __u32 fs_minfree; + __u32 fs_rotdelay; + __u32 fs_rps; + __u32 fs_bmask; + __u32 fs_fmask; + __u32 fs_bshift; + __u32 fs_fshift; + __u32 fs_maxcontig; + __u32 fs_maxbpg; + __u32 fs_fragshift; + __u32 fs_fsbtodb; + __u32 fs_sbsize; + __u32 fs_csmask; + __u32 fs_csshift; + __u32 fs_nindir; + __u32 fs_inopb; + __u32 fs_nspf; + __u32 fs_optim; + __u32 fs_npsect_state; + __u32 fs_interleave; + __u32 fs_trackskew; + __u32 fs_id[2]; + __u32 fs_csaddr; + __u32 fs_cssize; + __u32 fs_cgsize; + __u32 fs_ntrak; + __u32 fs_nsect; + __u32 fs_spc; + __u32 fs_ncyl; + __u32 fs_cpg; + __u32 fs_ipg; + __u32 fs_fpg; + struct ufs_csum { + __u32 cs_ndir; + __u32 cs_nbfree; + __u32 cs_nifree; + __u32 cs_nffree; + } __attribute__((__packed__)) fs_cstotal; + __s8 fs_fmod; + __s8 fs_clean; + __s8 fs_ronly; + __s8 fs_flags; + union { + struct { + __s8 fs_fsmnt[512]; + __u32 fs_cgrotor; + __u32 fs_csp[31]; + __u32 fs_maxcluster; + __u32 fs_cpc; + __u16 fs_opostbl[16][8]; + } __attribute__((__packed__)) fs_u1; + struct { + __s8 fs_fsmnt[468]; + __u8 fs_volname[32]; + __u64 fs_swuid; + __s32 fs_pad; + __u32 fs_cgrotor; + __u32 fs_ocsp[28]; + __u32 fs_contigdirs; + __u32 fs_csp; + __u32 fs_maxcluster; + __u32 fs_active; + __s32 fs_old_cpc; + __s32 fs_maxbsize; + __s64 fs_sparecon64[17]; + __s64 fs_sblockloc; + struct ufs2_csum_total { + __u64 cs_ndir; + __u64 cs_nbfree; + __u64 cs_nifree; + __u64 cs_nffree; + __u64 cs_numclusters; + __u64 cs_spare[3]; + } __attribute__((__packed__)) fs_cstotal; + struct ufs_timeval { + __s32 tv_sec; + __s32 tv_usec; + } __attribute__((__packed__)) fs_time; + __s64 fs_size; + __s64 fs_dsize; + __u64 fs_csaddr; + __s64 fs_pendingblocks; + __s32 fs_pendinginodes; + } __attribute__((__packed__)) fs_u2; + } fs_u11; + union { + struct { + __s32 fs_sparecon[53]; + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __s32 fs_state; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + } __attribute__((__packed__)) fs_sun; + struct { + __s32 fs_sparecon[53]; + __s32 fs_reclaim; + __s32 fs_sparecon2[1]; + __u32 fs_npsect; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + } __attribute__((__packed__)) fs_sunx86; + struct { + __s32 fs_sparecon[50]; + __s32 fs_contigsumsize; + __s32 fs_maxsymlinklen; + __s32 fs_inodefmt; + __u32 fs_maxfilesize[2]; + __u32 fs_qbmask[2]; + __u32 fs_qfmask[2]; + __s32 fs_state; + } __attribute__((__packed__)) fs_44; + } fs_u2; + __s32 fs_postblformat; + __s32 fs_nrpos; + __s32 fs_postbloff; + __s32 fs_rotbloff; + __u32 fs_magic; + __u8 fs_space[1]; +} __attribute__((__packed__)); + +#define UFS_MAGIC 0x00011954 +#define UFS2_MAGIC 0x19540119 +#define UFS_MAGIC_FEA 0x00195612 +#define UFS_MAGIC_LFN 0x00095014 + +int volume_id_probe_ufs(struct volume_id *id, __u64 off) +{ + __u32 magic; + int i; + struct ufs_super_block *ufs; + int offsets[] = {0, 8, 64, 256, -1}; + + dbg("probing at offset %llu", off); + + for (i = 0; offsets[i] >= 0; i++) { + ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); + if (ufs == NULL) + return -1; + + dbg("offset 0x%x", offsets[i] * 0x400); + magic = be32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(be)", magic); + goto found; + } + magic = le32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(le)", magic); + goto found; + } + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "ufs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/ufs.h b/extras/volume_id/volume_id/ufs.h new file mode 100644 index 0000000000..82b4e1d064 --- /dev/null +++ b/extras/volume_id/volume_id/ufs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_UFS_ +#define _VOLUME_ID_UFS_ + +extern int volume_id_probe_ufs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/ufs/ufs.c b/extras/volume_id/volume_id/ufs/ufs.c deleted file mode 100644 index 12672ffe01..0000000000 --- a/extras/volume_id/volume_id/ufs/ufs.c +++ /dev/null @@ -1,223 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "ufs.h" - -struct ufs_super_block { - __u32 fs_link; - __u32 fs_rlink; - __u32 fs_sblkno; - __u32 fs_cblkno; - __u32 fs_iblkno; - __u32 fs_dblkno; - __u32 fs_cgoffset; - __u32 fs_cgmask; - __u32 fs_time; - __u32 fs_size; - __u32 fs_dsize; - __u32 fs_ncg; - __u32 fs_bsize; - __u32 fs_fsize; - __u32 fs_frag; - __u32 fs_minfree; - __u32 fs_rotdelay; - __u32 fs_rps; - __u32 fs_bmask; - __u32 fs_fmask; - __u32 fs_bshift; - __u32 fs_fshift; - __u32 fs_maxcontig; - __u32 fs_maxbpg; - __u32 fs_fragshift; - __u32 fs_fsbtodb; - __u32 fs_sbsize; - __u32 fs_csmask; - __u32 fs_csshift; - __u32 fs_nindir; - __u32 fs_inopb; - __u32 fs_nspf; - __u32 fs_optim; - __u32 fs_npsect_state; - __u32 fs_interleave; - __u32 fs_trackskew; - __u32 fs_id[2]; - __u32 fs_csaddr; - __u32 fs_cssize; - __u32 fs_cgsize; - __u32 fs_ntrak; - __u32 fs_nsect; - __u32 fs_spc; - __u32 fs_ncyl; - __u32 fs_cpg; - __u32 fs_ipg; - __u32 fs_fpg; - struct ufs_csum { - __u32 cs_ndir; - __u32 cs_nbfree; - __u32 cs_nifree; - __u32 cs_nffree; - } __attribute__((__packed__)) fs_cstotal; - __s8 fs_fmod; - __s8 fs_clean; - __s8 fs_ronly; - __s8 fs_flags; - union { - struct { - __s8 fs_fsmnt[512]; - __u32 fs_cgrotor; - __u32 fs_csp[31]; - __u32 fs_maxcluster; - __u32 fs_cpc; - __u16 fs_opostbl[16][8]; - } __attribute__((__packed__)) fs_u1; - struct { - __s8 fs_fsmnt[468]; - __u8 fs_volname[32]; - __u64 fs_swuid; - __s32 fs_pad; - __u32 fs_cgrotor; - __u32 fs_ocsp[28]; - __u32 fs_contigdirs; - __u32 fs_csp; - __u32 fs_maxcluster; - __u32 fs_active; - __s32 fs_old_cpc; - __s32 fs_maxbsize; - __s64 fs_sparecon64[17]; - __s64 fs_sblockloc; - struct ufs2_csum_total { - __u64 cs_ndir; - __u64 cs_nbfree; - __u64 cs_nifree; - __u64 cs_nffree; - __u64 cs_numclusters; - __u64 cs_spare[3]; - } __attribute__((__packed__)) fs_cstotal; - struct ufs_timeval { - __s32 tv_sec; - __s32 tv_usec; - } __attribute__((__packed__)) fs_time; - __s64 fs_size; - __s64 fs_dsize; - __u64 fs_csaddr; - __s64 fs_pendingblocks; - __s32 fs_pendinginodes; - } __attribute__((__packed__)) fs_u2; - } fs_u11; - union { - struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __s32 fs_state; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - } __attribute__((__packed__)) fs_sun; - struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __u32 fs_npsect; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - } __attribute__((__packed__)) fs_sunx86; - struct { - __s32 fs_sparecon[50]; - __s32 fs_contigsumsize; - __s32 fs_maxsymlinklen; - __s32 fs_inodefmt; - __u32 fs_maxfilesize[2]; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - __s32 fs_state; - } __attribute__((__packed__)) fs_44; - } fs_u2; - __s32 fs_postblformat; - __s32 fs_nrpos; - __s32 fs_postbloff; - __s32 fs_rotbloff; - __u32 fs_magic; - __u8 fs_space[1]; -} __attribute__((__packed__)); - -#define UFS_MAGIC 0x00011954 -#define UFS2_MAGIC 0x19540119 -#define UFS_MAGIC_FEA 0x00195612 -#define UFS_MAGIC_LFN 0x00095014 - -int volume_id_probe_ufs(struct volume_id *id, __u64 off) -{ - __u32 magic; - int i; - struct ufs_super_block *ufs; - int offsets[] = {0, 8, 64, 256, -1}; - - dbg("probing at offset %llu", off); - - for (i = 0; offsets[i] >= 0; i++) { - ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); - if (ufs == NULL) - return -1; - - dbg("offset 0x%x", offsets[i] * 0x400); - magic = be32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(be)", magic); - goto found; - } - magic = le32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(le)", magic); - goto found; - } - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "ufs"; - - return 0; -} diff --git a/extras/volume_id/volume_id/ufs/ufs.h b/extras/volume_id/volume_id/ufs/ufs.h deleted file mode 100644 index 82b4e1d064..0000000000 --- a/extras/volume_id/volume_id/ufs/ufs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID_UFS_ -#define _VOLUME_ID_UFS_ - -extern int volume_id_probe_ufs(struct volume_id *id, __u64 off); - -#endif diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 0cd2eadec1..6159a59928 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -53,6 +53,8 @@ static char *usage_to_string(enum volume_id_usage usage_id) return "raid"; case VOLUME_ID_DISKLABEL: return "disklabel"; + case VOLUME_ID_CRYPTO: + return "crypto"; case VOLUME_ID_UNPROBED: return "unprobed"; case VOLUME_ID_UNUSED: diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 95f7f5b127..f93cc91161 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -41,25 +41,28 @@ #include "logging.h" #include "util.h" -#include "ext/ext.h" -#include "reiserfs/reiserfs.h" -#include "fat/fat.h" -#include "hfs/hfs.h" -#include "jfs/jfs.h" -#include "xfs/xfs.h" -#include "ufs/ufs.h" -#include "ntfs/ntfs.h" -#include "iso9660/iso9660.h" -#include "udf/udf.h" -#include "highpoint/highpoint.h" -#include "linux_swap/linux_swap.h" -#include "linux_raid/linux_raid.h" -#include "lvm/lvm.h" -#include "cramfs/cramfs.h" -#include "hpfs/hpfs.h" -#include "romfs/romfs.h" -#include "mac/mac.h" -#include "msdos/msdos.h" +#include "ext.h" +#include "reiserfs.h" +#include "fat.h" +#include "hfs.h" +#include "jfs.h" +#include "xfs.h" +#include "ufs.h" +#include "ntfs.h" +#include "iso9660.h" +#include "udf.h" +#include "luks.h" +#include "highpoint.h" +#include "linux_swap.h" +#include "linux_raid.h" +#include "lvm.h" +#include "cramfs.h" +#include "hpfs.h" +#include "romfs.h" +#include "sysv.h" +#include "luks.h" +#include "mac.h" +#include "msdos.h" int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size) { @@ -79,6 +82,9 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l if (volume_id_probe_highpoint_ataraid(id, off) == 0) goto exit; + if (volume_id_probe_luks(id, off) == 0) + goto exit; + /* signature in the first block, only small buffer needed */ if (volume_id_probe_vfat(id, off) == 0) goto exit; @@ -128,6 +134,9 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l if (volume_id_probe_hpfs(id, off) == 0) goto exit; + if (volume_id_probe_sysv(id, off) == 0) + goto exit; + return -1; exit: diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 5b845602c6..c22a5e60ae 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 34 +#define VOLUME_ID_VERSION 35 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 @@ -38,6 +38,7 @@ enum volume_id_usage { VOLUME_ID_PARTITIONTABLE, VOLUME_ID_RAID, VOLUME_ID_DISKLABEL, + VOLUME_ID_CRYPTO, }; struct volume_id_partition { diff --git a/extras/volume_id/volume_id/xfs.c b/extras/volume_id/volume_id/xfs.c new file mode 100644 index 0000000000..12a89aafcb --- /dev/null +++ b/extras/volume_id/volume_id/xfs.c @@ -0,0 +1,78 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "xfs.h" + +struct xfs_super_block { + __u8 magic[4]; + __u32 blocksize; + __u64 dblocks; + __u64 rblocks; + __u32 dummy1[2]; + __u8 uuid[16]; + __u32 dummy2[15]; + __u8 fname[12]; + __u32 dummy3[2]; + __u64 icount; + __u64 ifree; + __u64 fdblocks; +} __attribute__((__packed__)); + +int volume_id_probe_xfs(struct volume_id *id, __u64 off) +{ + struct xfs_super_block *xs; + + dbg("probing at offset %llu", off); + + xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); + if (xs == NULL) + return -1; + + if (memcmp(xs->magic, "XFSB", 4) != 0) + return -1; + + volume_id_set_label_raw(id, xs->fname, 12); + volume_id_set_label_string(id, xs->fname, 12); + volume_id_set_uuid(id, xs->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "xfs"; + + return 0; +} diff --git a/extras/volume_id/volume_id/xfs.h b/extras/volume_id/volume_id/xfs.h new file mode 100644 index 0000000000..76b1725664 --- /dev/null +++ b/extras/volume_id/volume_id/xfs.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID__ +#define _VOLUME_ID__ + +extern int volume_id_probe_xfs(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/xfs/xfs.c b/extras/volume_id/volume_id/xfs/xfs.c deleted file mode 100644 index efbe06ec58..0000000000 --- a/extras/volume_id/volume_id/xfs/xfs.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../volume_id.h" -#include "../logging.h" -#include "../util.h" -#include "xfs.h" - -struct xfs_super_block { - __u8 magic[4]; - __u32 blocksize; - __u64 dblocks; - __u64 rblocks; - __u32 dummy1[2]; - __u8 uuid[16]; - __u32 dummy2[15]; - __u8 fname[12]; - __u32 dummy3[2]; - __u64 icount; - __u64 ifree; - __u64 fdblocks; -} __attribute__((__packed__)); - -int volume_id_probe_xfs(struct volume_id *id, __u64 off) -{ - struct xfs_super_block *xs; - - dbg("probing at offset %llu", off); - - xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); - if (xs == NULL) - return -1; - - if (memcmp(xs->magic, "XFSB", 4) != 0) - return -1; - - volume_id_set_label_raw(id, xs->fname, 12); - volume_id_set_label_string(id, xs->fname, 12); - volume_id_set_uuid(id, xs->uuid, UUID_DCE); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "xfs"; - - return 0; -} diff --git a/extras/volume_id/volume_id/xfs/xfs.h b/extras/volume_id/volume_id/xfs/xfs.h deleted file mode 100644 index 76b1725664..0000000000 --- a/extras/volume_id/volume_id/xfs/xfs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef _VOLUME_ID__ -#define _VOLUME_ID__ - -extern int volume_id_probe_xfs(struct volume_id *id, __u64 off); - -#endif -- cgit v1.2.3-54-g00ecf From 8d1b4df2192915dc94442c1ef3327a28a57b3615 Mon Sep 17 00:00:00 2001 From: "tklauser@access.unizh.ch" Date: Wed, 23 Feb 2005 04:35:26 +0100 Subject: [PATCH] udev_volume_id: add Reiser4 support --- extras/volume_id/volume_id/reiserfs.c | 33 +++++++++++++++++++++++++++------ extras/volume_id/volume_id/volume_id.h | 2 +- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c index b74b8ae576..094062dba2 100644 --- a/extras/volume_id/volume_id/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs.c @@ -2,6 +2,7 @@ * volume_id - reads filesystem label and uuid * * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2005 Tobias Klauser * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -55,26 +56,45 @@ struct reiserfs_super_block { __u8 label[16]; } __attribute__((__packed__)); +struct reiser4_super_block { + __u8 magic[16]; + __u16 dummy[2]; + __u8 uuid[16]; + __u8 label[16]; + __u64 dummy2; +} __attribute__((__packed__)); + #define REISERFS1_SUPERBLOCK_OFFSET 0x2000 #define REISERFS_SUPERBLOCK_OFFSET 0x10000 int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) { struct reiserfs_super_block *rs; + struct reiser4_super_block *rs4; + __u8 *buf; dbg("probing at offset %llu", off); - rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); - if (rs == NULL) + buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) return -1; + rs = (struct reiserfs_super_block *) buf;; if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { strcpy(id->type_version, "3.6"); - goto found; + goto found_v3; } - if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { strcpy(id->type_version, "JR"); + goto found_v3; + } + + rs4 = (struct reiser4_super_block *) buf; + if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) { + strcpy(id->type_version, "4"); + volume_id_set_label_raw(id, rs4->label, 16); + volume_id_set_label_string(id, rs4->label, 16); + volume_id_set_uuid(id, rs4->uuid, UUID_DCE); goto found; } @@ -84,16 +104,17 @@ int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { strcpy(id->type_version, "3.5"); - goto found; + goto found_v3; } return -1; -found: +found_v3: volume_id_set_label_raw(id, rs->label, 16); volume_id_set_label_string(id, rs->label, 16); volume_id_set_uuid(id, rs->uuid, UUID_DCE); +found: volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "reiserfs"; diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index c22a5e60ae..8fe4c3a5e5 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 35 +#define VOLUME_ID_VERSION 36 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 16 -- cgit v1.2.3-54-g00ecf From f385ff6512012a75b8381938dd3f55f991b53e9a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 23 Feb 2005 12:21:39 +0100 Subject: [PATCH] big libsysfs diet (pre 2.0 version) --- Makefile | 1 - libsysfs/sysfs.h | 24 +- libsysfs/sysfs/libsysfs.h | 177 ++------ libsysfs/sysfs_class.c | 519 ++++------------------- libsysfs/sysfs_device.c | 542 ++++++------------------ libsysfs/sysfs_dir.c | 1000 ++++++++++----------------------------------- libsysfs/sysfs_driver.c | 393 ++++++------------ libsysfs/sysfs_utils.c | 262 ++---------- udevinfo.8 | 4 - udevinfo.c | 99 +---- 10 files changed, 647 insertions(+), 2374 deletions(-) diff --git a/Makefile b/Makefile index d696b8ea3b..c2d35f7734 100644 --- a/Makefile +++ b/Makefile @@ -129,7 +129,6 @@ HEADERS = \ list.h SYSFS_OBJS = \ - libsysfs/sysfs_bus.o \ libsysfs/sysfs_class.o \ libsysfs/sysfs_device.o \ libsysfs/sysfs_dir.o \ diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 1e58e8abb4..30bd9b4089 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -27,19 +27,37 @@ #include #include #include +#include #include #include #include #include #include -/* external library functions */ -extern int isascii(int c); +#define safestrcpy(to, from) strncpy(to, from, sizeof(to)-1) +#define safestrcat(to, from) strncat(to, from, sizeof(to) - strlen(to)-1) + +#define safestrcpymax(to, from, max) \ +do { \ + to[max-1] = '\0'; \ + strncpy(to, from, max-1); \ +} while (0) + +#define safestrcatmax(to, from, max) \ +do { \ + to[max-1] = '\0'; \ + strncat(to, from, max - strlen(to)-1); \ +} while (0) + +extern struct sysfs_attribute *get_attribute(void *dev, const char *name); +extern struct dlist *read_dir_subdirs(const char *path); +extern struct dlist *read_dir_links(const char *path); +extern struct dlist *get_attributes_list(void *dev); /* Debugging */ #ifdef DEBUG #include "../logging.h" -#define dprintf(format, arg...) dbg(format, ##arg) +#define dprintf(format, arg...) dbg(format, ## arg) #else #define dprintf(format, arg...) do { } while (0) #endif diff --git a/libsysfs/sysfs/libsysfs.h b/libsysfs/sysfs/libsysfs.h index 29194f61a6..6140c3aecb 100644 --- a/libsysfs/sysfs/libsysfs.h +++ b/libsysfs/sysfs/libsysfs.h @@ -3,7 +3,7 @@ * * Header Definitions for libsysfs * - * Copyright (C) IBM Corp. 2003 + * Copyright (C) IBM Corp. 2004-2005 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,27 +27,6 @@ #include #include "dlist.h" -/* - * Defines to prevent buffer overruns - */ -#define safestrcpy(to, from) strncpy(to, from, sizeof(to)-1) -#define safestrcat(to, from) strncat(to, from, sizeof(to) - strlen(to)-1) - -#define safestrcpymax(to, from, max) \ -do { \ - to[max-1] = '\0'; \ - strncpy(to, from, max-1); \ -} while (0) - -#define safestrcatmax(to, from, max) \ -do { \ - to[max-1] = '\0'; \ - strncat(to, from, max - strlen(to)-1); \ -} while (0) - -/* - * Generic #defines go here.. - */ #define SYSFS_FSTYPE_NAME "sysfs" #define SYSFS_PROC_MNTS "/proc/mounts" #define SYSFS_BUS_NAME "bus" @@ -55,106 +34,92 @@ do { \ #define SYSFS_BLOCK_NAME "block" #define SYSFS_DEVICES_NAME "devices" #define SYSFS_DRIVERS_NAME "drivers" +#define SYSFS_MODULE_NAME "module" #define SYSFS_NAME_ATTRIBUTE "name" #define SYSFS_UNKNOWN "unknown" #define SYSFS_PATH_ENV "SYSFS_PATH" -#define SYSFS_PATH_MAX 255 -#define SYSFS_NAME_LEN 50 -#define SYSFS_BUS_ID_SIZE 20 +#define SYSFS_PATH_MAX 256 +#define SYSFS_NAME_LEN 64 +#define SYSFS_BUS_ID_SIZE 32 -#define SYSFS_METHOD_SHOW 0x01 /* attr can be read by user */ -#define SYSFS_METHOD_STORE 0x02 /* attr can be changed by user */ +enum sysfs_attribute_method { + SYSFS_METHOD_SHOW = 0x01, /* attr can be read by user */ + SYSFS_METHOD_STORE = 0x02, /* attr can be changed by user */ +}; + +/* NOTE: statically define mnt path for sysfs */ +#define SYSFS_MNT_PATH "/sys" /* - * NOTE: We have the statically allocated "name" as the first element of all + * NOTE: + * 1. We have the statically allocated "name" as the first element of all * the structures. This feature is used in the "sorter" function for dlists + * 2. As is the case with attrlist + * 3. As is the case with path */ - struct sysfs_attribute { char name[SYSFS_NAME_LEN]; char path[SYSFS_PATH_MAX]; char *value; - unsigned short len; /* value length */ - unsigned short method; /* show and store */ -}; - -struct sysfs_link { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - char target[SYSFS_PATH_MAX]; -}; - -struct sysfs_directory { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *subdirs; - struct dlist *links; - struct dlist *attributes; + unsigned short len; /* value length */ + enum sysfs_attribute_method method; /* show and store */ }; struct sysfs_driver { char name[SYSFS_NAME_LEN]; char path[SYSFS_PATH_MAX]; + struct dlist *attrlist; + char bus[SYSFS_NAME_LEN]; /* Private: for internal use only */ struct dlist *devices; - struct sysfs_directory *directory; }; struct sysfs_device { char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + struct dlist *attrlist; char bus_id[SYSFS_NAME_LEN]; char bus[SYSFS_NAME_LEN]; char driver_name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; /* Private: for internal use only */ struct sysfs_device *parent; + /* NOTE - we still don't populate this */ struct dlist *children; - struct sysfs_directory *directory; -}; - -struct sysfs_root_device { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; }; +/* NOTE: not used as of now */ struct sysfs_bus { char name[SYSFS_NAME_LEN]; char path[SYSFS_PATH_MAX]; + struct dlist *attrlist; /* Private: for internal use only */ struct dlist *drivers; struct dlist *devices; - struct sysfs_directory *directory; }; struct sysfs_class_device { char name[SYSFS_NAME_LEN]; - char classname[SYSFS_NAME_LEN]; char path[SYSFS_PATH_MAX]; + struct dlist *attrlist; + char classname[SYSFS_NAME_LEN]; /* Private: for internal use only */ struct sysfs_class_device *parent; struct sysfs_device *sysdevice; /* NULL if virtual */ - struct sysfs_driver *driver; /* NULL if not implemented */ - struct sysfs_directory *directory; }; +/* NOTE: not used as of now */ struct sysfs_class { char name[SYSFS_NAME_LEN]; char path[SYSFS_PATH_MAX]; + struct dlist *attrlist; /* Private: for internal use only */ struct dlist *devices; - struct sysfs_directory *directory; }; #ifdef __cplusplus @@ -171,43 +136,15 @@ extern int sysfs_path_is_dir(const char *path); extern int sysfs_path_is_link(const char *path); extern int sysfs_path_is_file(const char *path); extern int sysfs_get_link(const char *path, char *target, size_t len); -extern struct dlist *sysfs_open_subsystem_list(char *name); -extern struct dlist *sysfs_open_bus_devices_list(char *name); +extern struct dlist *sysfs_open_directory_list(const char *path); extern void sysfs_close_list(struct dlist *list); /* sysfs directory and file access */ extern void sysfs_close_attribute(struct sysfs_attribute *sysattr); extern struct sysfs_attribute *sysfs_open_attribute(const char *path); extern int sysfs_read_attribute(struct sysfs_attribute *sysattr); -extern int sysfs_read_attribute_value(const char *attrpath, - char *value, size_t vsize); extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, const char *new_value, size_t len); -extern char *sysfs_get_value_from_attributes(struct dlist *attr, - const char *name); -extern int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir); -extern int sysfs_refresh_dir_links(struct sysfs_directory *sysdir); -extern int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir); -extern void sysfs_close_directory(struct sysfs_directory *sysdir); -extern struct sysfs_directory *sysfs_open_directory(const char *path); -extern int sysfs_read_dir_attributes(struct sysfs_directory *sysdir); -extern int sysfs_read_dir_links(struct sysfs_directory *sysdir); -extern int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir); -extern int sysfs_read_directory(struct sysfs_directory *sysdir); -extern int sysfs_read_all_subdirs(struct sysfs_directory *sysdir); -extern struct sysfs_directory *sysfs_get_subdirectory - (struct sysfs_directory *dir, char *subname); -extern void sysfs_close_link(struct sysfs_link *ln); -extern struct sysfs_link *sysfs_open_link(const char *lnpath); -extern struct sysfs_link *sysfs_get_directory_link - (struct sysfs_directory *dir, char *linkname); -extern struct sysfs_link *sysfs_get_subdirectory_link - (struct sysfs_directory *dir, char *linkname); -extern struct sysfs_attribute *sysfs_get_directory_attribute - (struct sysfs_directory *dir, char *attrname); -extern struct dlist *sysfs_get_dir_attributes(struct sysfs_directory *dir); -extern struct dlist *sysfs_get_dir_links(struct sysfs_directory *dir); -extern struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir); /* sysfs driver access */ extern void sysfs_close_driver(struct sysfs_driver *driver); @@ -218,19 +155,8 @@ extern struct sysfs_attribute *sysfs_get_driver_attr (struct sysfs_driver *drv, const char *name); extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); extern struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver); -extern struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver); -extern struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver); -extern struct sysfs_device *sysfs_get_driver_device - (struct sysfs_driver *driver, const char *name); -extern struct dlist *sysfs_refresh_driver_attributes - (struct sysfs_driver *driver); -extern struct sysfs_attribute *sysfs_open_driver_attr - (const char *bus, const char *drv, const char *attrib); /* generic sysfs device access */ -extern void sysfs_close_root_device(struct sysfs_root_device *root); -extern struct sysfs_root_device *sysfs_open_root_device(const char *name); -extern struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root); extern void sysfs_close_device_tree(struct sysfs_device *device); extern struct sysfs_device *sysfs_open_device_tree(const char *path); extern void sysfs_close_device(struct sysfs_device *dev); @@ -241,27 +167,8 @@ extern struct sysfs_device *sysfs_open_device_path(const char *path); extern int sysfs_get_device_bus(struct sysfs_device *dev); extern struct sysfs_attribute *sysfs_get_device_attr (struct sysfs_device *dev, const char *name); -extern struct dlist *sysfs_get_device_attributes(struct sysfs_device *device); -extern struct dlist *sysfs_refresh_device_attributes - (struct sysfs_device *device); -extern struct sysfs_attribute *sysfs_open_device_attr(const char *bus, - const char *bus_id, const char *attrib); - -/* generic sysfs bus access */ -extern void sysfs_close_bus(struct sysfs_bus *bus); -extern struct sysfs_bus *sysfs_open_bus(const char *name); -extern struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, - char *id); -extern struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - char *drvname); -extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); -extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); -extern struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus); -extern struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus); -extern struct sysfs_attribute *sysfs_get_bus_attribute - (struct sysfs_bus *bus, char *attrname); -extern int sysfs_find_driver_bus(const char *driver, char *busname, - size_t bsize); +extern struct dlist *sysfs_get_device_attributes + (struct sysfs_device *dev); /* generic sysfs class access */ extern void sysfs_close_class_device(struct sysfs_class_device *dev); @@ -269,26 +176,14 @@ extern struct sysfs_class_device *sysfs_open_class_device_path (const char *path); extern struct sysfs_class_device *sysfs_open_class_device (const char *classname, const char *name); -extern struct sysfs_device *sysfs_get_classdev_device - (struct sysfs_class_device *clsdev); -extern struct sysfs_driver *sysfs_get_classdev_driver - (struct sysfs_class_device *clsdev); extern struct sysfs_class_device *sysfs_get_classdev_parent (struct sysfs_class_device *clsdev); -extern void sysfs_close_class(struct sysfs_class *cls); -extern struct sysfs_class *sysfs_open_class(const char *name); -extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); -extern struct sysfs_class_device *sysfs_get_class_device - (struct sysfs_class *cls, char *name); -extern struct dlist *sysfs_get_classdev_attributes - (struct sysfs_class_device *cdev); -extern struct dlist *sysfs_refresh_classdev_attributes - (struct sysfs_class_device *cdev); extern struct sysfs_attribute *sysfs_get_classdev_attr (struct sysfs_class_device *clsdev, const char *name); -extern struct sysfs_attribute *sysfs_open_classdev_attr - (const char *classname, const char *dev, - const char *attrib); +extern struct dlist *sysfs_get_classdev_attributes + (struct sysfs_class_device *clsdev); +extern struct sysfs_device *sysfs_get_classdev_device + (struct sysfs_class_device *clsdev); /** * sort_list: sorter function to keep list elements sorted in alphabetical diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index 4ea7f41c99..a93de573d4 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -3,7 +3,7 @@ * * Generic class utility functions for libsysfs * - * Copyright (C) IBM Corp. 2003 + * Copyright (C) IBM Corp. 2003-2005 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,95 +23,50 @@ #include "libsysfs.h" #include "sysfs.h" -static void sysfs_close_cls_dev(void *dev) -{ - sysfs_close_class_device((struct sysfs_class_device *)dev); -} - -/** - * class_name_equal: compares class_devices' name - * @a: class_name looking for - * @b: sysfs_class_device being compared - */ -static int class_name_equal(void *a, void *b) -{ - if (a == NULL || b == NULL) - return 0; - - if (strcmp(((char *)a), ((struct sysfs_class_device *)b)->name) == 0) - return 1; - - return 0; -} - /** * sysfs_close_class_device: closes a single class device. * @dev: class device to close. */ void sysfs_close_class_device(struct sysfs_class_device *dev) { - if (dev != NULL) { - if (dev->directory != NULL) - sysfs_close_directory(dev->directory); - if (dev->sysdevice != NULL) - sysfs_close_device(dev->sysdevice); - if (dev->driver != NULL) - sysfs_close_driver(dev->driver); - if (dev->parent != NULL) + if (dev) { + if (dev->parent) sysfs_close_class_device(dev->parent); + if (dev->sysdevice) + sysfs_close_device(dev->sysdevice); + if (dev->attrlist) + dlist_destroy(dev->attrlist); free(dev); } } -/** - * sysfs_close_class: close single class - * @cls: class structure - */ -void sysfs_close_class(struct sysfs_class *cls) -{ - if (cls != NULL) { - if (cls->directory != NULL) - sysfs_close_directory(cls->directory); - if (cls->devices != NULL) - dlist_destroy(cls->devices); - free(cls); - } -} - /** * alloc_class_device: mallocs and initializes new class device struct. * returns sysfs_class_device or NULL. */ static struct sysfs_class_device *alloc_class_device(void) { - return (struct sysfs_class_device *) - calloc(1, sizeof(struct sysfs_class_device)); -} + struct sysfs_class_device *dev; -/** - * alloc_class: mallocs new class structure - * returns sysfs_class struct or NULL - */ -static struct sysfs_class *alloc_class(void) -{ - return (struct sysfs_class *)calloc(1, sizeof(struct sysfs_class)); + dev = calloc(1, sizeof(struct sysfs_class_device)); + return dev; } -/** +/** * set_classdev_classname: Grabs classname from path * @cdev: class device to set * Returns nothing */ static void set_classdev_classname(struct sysfs_class_device *cdev) { - char *c = NULL, *e = NULL; + char *c, *e; int count = 0; c = strstr(cdev->path, SYSFS_CLASS_NAME); if (c == NULL) { c = strstr(cdev->path, SYSFS_BLOCK_NAME); } else { - c = strchr(c, '/'); + c = strstr(c, "/"); } if (c == NULL) @@ -135,9 +90,9 @@ static void set_classdev_classname(struct sysfs_class_device *cdev) */ struct sysfs_class_device *sysfs_open_class_device_path(const char *path) { - struct sysfs_class_device *cdev = NULL; + struct sysfs_class_device *cdev; - if (path == NULL) { + if (!path) { errno = EINVAL; return NULL; } @@ -146,11 +101,11 @@ struct sysfs_class_device *sysfs_open_class_device_path(const char *path) return NULL; } cdev = alloc_class_device(); - if (cdev == NULL) { + if (!cdev) { dprintf("calloc failed\n"); return NULL; } - if ((sysfs_get_name_from_path(path, cdev->name, SYSFS_NAME_LEN)) != 0) { + if (sysfs_get_name_from_path(path, cdev->name, SYSFS_NAME_LEN)) { errno = EINVAL; dprintf("Error getting class device name\n"); sysfs_close_class_device(cdev); @@ -168,245 +123,6 @@ struct sysfs_class_device *sysfs_open_class_device_path(const char *path) return cdev; } -/** - * sysfs_get_class_devices: gets all devices for class - * @cls: class to get devices for - * returns dlist of class_devices with success and NULL with error - */ -struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) -{ - struct sysfs_class_device *dev = NULL; - struct sysfs_directory *cur = NULL; - - if (cls == NULL) { - errno = EINVAL; - return NULL; - } - - if (cls->devices != NULL) - return cls->devices; - - if (cls->directory == NULL) { - cls->directory = sysfs_open_directory(cls->path); - if (cls->directory == NULL) - return NULL; - } - - if ((sysfs_read_dir_subdirs(cls->directory)) != 0) - return NULL; - - if (cls->directory->subdirs != NULL) { - dlist_for_each_data(cls->directory->subdirs, cur, - struct sysfs_directory) { - dev = sysfs_open_class_device_path(cur->path); - if (dev == NULL) { - dprintf("Error opening device at %s\n", - cur->path); - continue; - } - if (cls->devices == NULL) - cls->devices = dlist_new_with_delete - (sizeof(struct sysfs_class_device), - sysfs_close_cls_dev); - dlist_unshift_sorted(cls->devices, dev, sort_list); - } - } - return cls->devices; -} - -/** - * sysfs_open_class: opens specific class and all its devices on system - * returns sysfs_class structure with success or NULL with error. - */ -struct sysfs_class *sysfs_open_class(const char *name) -{ - struct sysfs_class *cls = NULL; - char classpath[SYSFS_PATH_MAX]; - - if (name == NULL) { - errno = EINVAL; - return NULL; - } - - memset(classpath, 0, SYSFS_PATH_MAX); - if ((sysfs_get_mnt_path(classpath, SYSFS_PATH_MAX)) != 0) { - dprintf("Sysfs not supported on this system\n"); - return NULL; - } - - /* - * We shall now treat "block" also as a class. Hence, check here - * if "name" is "block" and proceed accordingly - */ - if (strcmp(name, SYSFS_BLOCK_NAME) == 0) { - safestrcat(classpath, "/"); - safestrcat(classpath, SYSFS_BLOCK_NAME); - } else { - safestrcat(classpath, "/"); - safestrcat(classpath, SYSFS_CLASS_NAME); - safestrcat(classpath, "/"); - safestrcat(classpath, name); - } - if ((sysfs_path_is_dir(classpath)) != 0) { - dprintf("Class %s not found on the system\n", name); - return NULL; - } - - cls = alloc_class(); - if (cls == NULL) { - dprintf("calloc failed\n"); - return NULL; - } - safestrcpy(cls->name, name); - safestrcpy(cls->path, classpath); - if ((sysfs_remove_trailing_slash(cls->path)) != 0) { - dprintf("Invalid path to class device %s\n", cls->path); - sysfs_close_class(cls); - return NULL; - } - - return cls; -} - -/** - * sysfs_get_class_device: Get specific class device using the device's id - * @class: class to find device on - * @name: class name of the device - */ -struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *cls, - char *name) -{ - if (cls == NULL || name == NULL) { - errno = EINVAL; - return NULL; - } - - if (cls->devices == NULL) { - cls->devices = sysfs_get_class_devices(cls); - if (cls->devices == NULL) - return NULL; - } - return (struct sysfs_class_device *)dlist_find_custom(cls->devices, - name, class_name_equal); -} - -/** - * sysfs_get_classdev_device: returns the sysfs_device corresponding to - * sysfs_class_device, if present - * @clsdev: class device whose sysfs_device is required - * Returns sysfs_device on success, NULL on error or if device is not - * implemented - */ -struct sysfs_device *sysfs_get_classdev_device - (struct sysfs_class_device *clsdev) -{ - struct sysfs_link *devlink = NULL; - char devpath[SYSFS_PATH_MAX]; - - if (clsdev == NULL) { - errno = EINVAL; - return NULL; - } - safestrcpy(devpath, clsdev->path); - safestrcat(devpath, "/device"); - if ((sysfs_path_is_link(devpath)) != 0) { - if (clsdev->sysdevice != NULL) { - sysfs_close_device(clsdev->sysdevice); - clsdev->sysdevice = NULL; - } - return NULL; - } - - if (clsdev->directory == NULL) { - clsdev->directory = sysfs_open_directory(clsdev->path); - if (clsdev->directory == NULL) - return NULL; - } - devlink = sysfs_get_directory_link(clsdev->directory, "device"); - if (devlink == NULL) { - if (clsdev->sysdevice != NULL) { - dprintf("Device link no longer exists\n"); - sysfs_close_device(clsdev->sysdevice); - clsdev->sysdevice = NULL; - } - return NULL; - } - - if (clsdev->sysdevice != NULL) { - if (!strncmp(devlink->target, clsdev->sysdevice->path, - SYSFS_PATH_MAX)) - /* sysdevice hasn't changed */ - return (clsdev->sysdevice); - else - /* come here only if the device link for has changed */ - sysfs_close_device(clsdev->sysdevice); - } - - clsdev->sysdevice = sysfs_open_device_path(devlink->target); - if (clsdev->sysdevice == NULL) - return NULL; - - return (clsdev->sysdevice); -} - -/** - * sysfs_get_classdev_driver: returns the sysfs_driver corresponding to - * sysfs_class_device, if present - * @clsdev: class device whose sysfs_device is required - * Returns sysfs_driver on success, NULL on error or if driver is not - * implemented - */ -struct sysfs_driver *sysfs_get_classdev_driver - (struct sysfs_class_device *clsdev) -{ - struct sysfs_link *drvlink = NULL; - char drvpath[SYSFS_PATH_MAX]; - - if (clsdev == NULL) { - errno = EINVAL; - return NULL; - } - safestrcpy(drvpath, clsdev->path); - safestrcat(drvpath, "/driver"); - if ((sysfs_path_is_link(drvpath)) != 0) { - if (clsdev->driver != NULL) { - sysfs_close_driver(clsdev->driver); - clsdev->driver = NULL; - } - return NULL; - } - - if (clsdev->directory == NULL) { - clsdev->directory = sysfs_open_directory(clsdev->path); - if (clsdev->directory == NULL) - return NULL; - } - drvlink = sysfs_get_directory_link(clsdev->directory, "driver"); - if (drvlink == NULL) { - if (clsdev->driver != NULL) { - dprintf("Driver link no longer exists\n"); - sysfs_close_driver(clsdev->driver); - clsdev->driver = NULL; - } - return NULL; - } - if (clsdev->driver != NULL) { - if (!strncmp(drvlink->target, clsdev->driver->path, - SYSFS_PATH_MAX)) - /* driver hasn't changed */ - return (clsdev->driver); - else - /* come here only if the device link for has changed */ - sysfs_close_driver(clsdev->driver); - } - - clsdev->driver = sysfs_open_driver_path(drvlink->target); - if (clsdev->driver == NULL) - return NULL; - - return (clsdev->driver); -} - /** * get_blockdev_parent: Get the parent class device for a "block" subsystem * device if present @@ -415,7 +131,8 @@ struct sysfs_driver *sysfs_get_classdev_driver */ static int get_blockdev_parent(struct sysfs_class_device *clsdev) { - char parent_path[SYSFS_PATH_MAX], *c = NULL; + char parent_path[SYSFS_PATH_MAX]; + char *c; safestrcpy(parent_path, clsdev->path); c = strstr(parent_path, SYSFS_BLOCK_NAME); @@ -430,20 +147,20 @@ static int get_blockdev_parent(struct sysfs_class_device *clsdev) else goto errout; - /* validate whether the given class device is a partition or not */ - if ((strncmp(c, clsdev->name, strlen(clsdev->name))) == 0) { - dprintf("%s not a partition\n", clsdev->name); - return 1; - } - - c = strchr(c, '/'); + /* validate whether the given class device is a partition or not */ + if ((strncmp(c, clsdev->name, strlen(clsdev->name))) == 0) { + dprintf("%s not a partition\n", clsdev->name); + return 1; + } + + c = strchr(c, '/'); if (c == NULL) goto errout; *c = '\0'; - + clsdev->parent = sysfs_open_class_device_path(parent_path); - if (clsdev->parent == NULL) { + if (!clsdev->parent) { dprintf("Error opening the parent class device at %s\n", parent_path); return 1; @@ -466,19 +183,19 @@ errout: struct sysfs_class_device *sysfs_get_classdev_parent (struct sysfs_class_device *clsdev) { - if (clsdev == NULL) { + if (!clsdev) { errno = EINVAL; return NULL; } - if (clsdev->parent != NULL) + if (clsdev->parent) return (clsdev->parent); - - /* + + /* * As of now, only block devices have a parent child heirarchy in sysfs * We do not know, if, in the future, more classes will have a similar * structure. Hence, we now call a specialized function for block and * later we can add support functions for other subsystems as required. - */ + */ if (!(strncmp(clsdev->classname, SYSFS_BLOCK_NAME, sizeof(SYSFS_BLOCK_NAME)))) { if ((get_blockdev_parent(clsdev)) == 0) @@ -499,13 +216,13 @@ struct sysfs_class_device *sysfs_get_classdev_parent static int get_classdev_path(const char *classname, const char *clsdev, char *path, size_t len) { - if (classname == NULL || clsdev == NULL || path == NULL) { + if (!classname || !clsdev || !path) { errno = EINVAL; return -1; } - if (sysfs_get_mnt_path(path, len) != 0) { - dprintf("Error getting sysfs mount path\n"); - return -1; + if (sysfs_get_mnt_path(path, len) != 0) { + dprintf("Error getting sysfs mount path\n"); + return -1; } if (strncmp(classname, SYSFS_BLOCK_NAME, sizeof(SYSFS_BLOCK_NAME)) == 0) { @@ -535,9 +252,9 @@ struct sysfs_class_device *sysfs_open_class_device (const char *classname, const char *name) { char devpath[SYSFS_PATH_MAX]; - struct sysfs_class_device *cdev = NULL; + struct sysfs_class_device *cdev; - if (classname == NULL || name == NULL) { + if (!classname || !name) { errno = EINVAL; return NULL; } @@ -549,9 +266,9 @@ struct sysfs_class_device *sysfs_open_class_device name, classname); return NULL; } - + cdev = sysfs_open_class_device_path(devpath); - if (cdev == NULL) { + if (!cdev) { dprintf("Error getting class device %s from class %s\n", name, classname); return NULL; @@ -559,57 +276,6 @@ struct sysfs_class_device *sysfs_open_class_device return cdev; } -/** - * sysfs_get_classdev_attributes: returns a dlist of attributes for - * the requested class_device - * @cdev: sysfs_class_dev for which attributes are needed - * returns a dlist of attributes if exists, NULL otherwise - */ -struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev) -{ - if (cdev == NULL) - return NULL; - - if (cdev->directory == NULL) { - cdev->directory = sysfs_open_directory(cdev->path); - if (cdev->directory == NULL) - return NULL; - } - if (cdev->directory->attributes == NULL) { - if ((sysfs_read_dir_attributes(cdev->directory)) != 0) - return NULL; - } - return (cdev->directory->attributes); -} - -/** - * sysfs_refresh_clsassdev_attributes: refreshes the driver's list of attributes - * @clsdev: sysfs_class_device whose attributes to refresh - * - * NOTE: Upon return, prior references to sysfs_attributes for this classdev - * _may_ not be valid - * - * Returns list of attributes on success and NULL on failure - */ -struct dlist *sysfs_refresh_classdev_attributes - (struct sysfs_class_device *clsdev) -{ - if (clsdev == NULL) { - errno = EINVAL; - return NULL; - } - - if (clsdev->directory == NULL) - return (sysfs_get_classdev_attributes(clsdev)); - - if ((sysfs_refresh_dir_attributes(clsdev->directory)) != 0) { - dprintf("Error refreshing class_device attributes\n"); - return NULL; - } - - return (clsdev->directory->attributes); -} - /** * sysfs_get_classdev_attr: searches class device's attributes by name * @clsdev: class device to look through @@ -619,90 +285,53 @@ struct dlist *sysfs_refresh_classdev_attributes struct sysfs_attribute *sysfs_get_classdev_attr (struct sysfs_class_device *clsdev, const char *name) { - struct sysfs_attribute *cur = NULL; - struct sysfs_directory *sdir = NULL; - struct dlist *attrlist = NULL; - - if (clsdev == NULL || name == NULL) { + if (!clsdev || !name) { errno = EINVAL; return NULL; } - - /* - * First, see if it's in the current directory. Then look at - * subdirs since class devices can have subdirs of attributes. - */ - attrlist = sysfs_get_classdev_attributes(clsdev); - if (attrlist != NULL) { - cur = sysfs_get_directory_attribute(clsdev->directory, - (char *)name); - if (cur != NULL) - return cur; - } + return get_attribute(clsdev, (char *)name); +} - if (clsdev->directory == NULL) +/** + * sysfs_get_classdev_attributes: gets list of classdev attributes + * @clsdev: class device whose attributes list is needed + * returns dlist of attributes on success or NULL on error + */ +struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *clsdev) +{ + if (!clsdev) { + errno = EINVAL; return NULL; - - if (clsdev->directory->subdirs == NULL) - if ((sysfs_read_dir_subdirs(clsdev->directory)) != 0 || - clsdev->directory->subdirs == NULL) - return NULL; - - if (clsdev->directory->subdirs != NULL) { - dlist_for_each_data(clsdev->directory->subdirs, sdir, - struct sysfs_directory) { - if ((sysfs_path_is_dir(sdir->path)) != 0) - continue; - cur = sysfs_get_directory_attribute(sdir, - (char *)name); - if (cur == NULL) - continue; - } } - return cur; + return get_attributes_list(clsdev); } /** - * sysfs_open_classdev_attr: read an attribute for a given class device - * @classname: name of the class on which to look - * @dev: class device name for which the attribute has to be read - * @attrib: attribute to read - * Returns sysfs_attribute * on SUCCESS and NULL on error - * - * NOTE: - * A call to sysfs_close_attribute() is required to close the - * attribute returned and to free memory + * sysfs_get_classdev_device: gets the sysfs_device associated with the + * given sysfs_class_device + * @clsdev: class device whose associated sysfs_device is needed + * returns struct sysfs_device * on success or NULL on error */ -struct sysfs_attribute *sysfs_open_classdev_attr(const char *classname, - const char *dev, const char *attrib) +struct sysfs_device *sysfs_get_classdev_device + (struct sysfs_class_device *clsdev) { - struct sysfs_attribute *attribute = NULL; - char path[SYSFS_PATH_MAX]; + char linkpath[SYSFS_PATH_MAX], devpath[SYSFS_PATH_MAX]; - if (classname == NULL || dev == NULL || attrib == NULL) { + if (!clsdev) { errno = EINVAL; return NULL; } - memset(path, 0, SYSFS_PATH_MAX); - if ((get_classdev_path(classname, dev, path, SYSFS_PATH_MAX)) != 0) { - dprintf("Error getting to device %s on class %s\n", - dev, classname); - return NULL; - } - safestrcat(path, "/"); - safestrcat(path, attrib); - attribute = sysfs_open_attribute(path); - if (attribute == NULL) { - dprintf("Error opening attribute %s on class device %s\n", - attrib, dev); - return NULL; - } - if ((sysfs_read_attribute(attribute)) != 0) { - dprintf("Error reading attribute %s for class device %s\n", - attrib, dev); - sysfs_close_attribute(attribute); - return NULL; + + if (clsdev->sysdevice) + return clsdev->sysdevice; + + memset(linkpath, 0, SYSFS_PATH_MAX); + safestrcpy(linkpath, clsdev->path); + safestrcat(linkpath, "/device"); + if (!sysfs_path_is_link(linkpath)) { + memset(devpath, 0, SYSFS_PATH_MAX); + if (!sysfs_get_link(linkpath, devpath, SYSFS_PATH_MAX)) + clsdev->sysdevice = sysfs_open_device_path(devpath); } - return attribute; + return clsdev->sysdevice; } - diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 83c3adc080..7087730d5f 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -3,7 +3,7 @@ * * Generic device utility functions for libsysfs * - * Copyright (C) IBM Corp. 2003 + * Copyright (C) IBM Corp. 2003-2005 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,48 +24,64 @@ #include "sysfs.h" /** - * get_dev_driver: fills in the dev->driver_name field, but searches by - * opening subsystem. Only to be used if no driver link exists in - * device directory. - * - * Returns 0 on SUCCESS and 1 on error + * get_dev_driver: fills in the dev->driver_name field + * Returns 0 on SUCCESS and -1 on error */ static int get_dev_driver(struct sysfs_device *dev) { - struct dlist *drvlist = NULL; - char path[SYSFS_PATH_MAX], devpath[SYSFS_PATH_MAX]; - char *drv = NULL, *c = NULL; - - if (dev == NULL) { + struct dlist *drvlist; + char path[SYSFS_PATH_MAX]; + char devpath[SYSFS_PATH_MAX]; + char *drv = NULL, *c; + + if (!dev) { errno = EINVAL; - return 1; + return -1; + } + + memset(path, 0, SYSFS_PATH_MAX); + memset(devpath, 0, SYSFS_PATH_MAX); + safestrcpymax(path, dev->path, SYSFS_PATH_MAX); + safestrcatmax(path, "/driver", SYSFS_PATH_MAX); + if (!sysfs_path_is_link(path)) { + if (!sysfs_get_link(path, devpath, SYSFS_PATH_MAX)) { + if (sysfs_get_name_from_path(devpath, + dev->driver_name, SYSFS_NAME_LEN)) + return -1; + } + return 0; } + + /* + * Devices on on earlier kernels do not have the "driver" link. + * Look it up in the bus directory. + */ if (dev->bus[0] == '\0') - return 1; + return -1; memset(path, 0, SYSFS_PATH_MAX); memset(devpath, 0, SYSFS_PATH_MAX); - safestrcpy(path, SYSFS_BUS_NAME); + safestrcpy(path, dev->path); + c = strstr(path, SYSFS_DEVICES_NAME); + if (c == NULL) { + dprintf("Invalid path to device - %s\n", dev->path); + return -1; + } else + *c = '\0'; + safestrcat(path, SYSFS_BUS_NAME); safestrcat(path, "/"); safestrcat(path, dev->bus); safestrcat(path, "/"); safestrcat(path, SYSFS_DRIVERS_NAME); - safestrcpy(devpath, dev->path); - c = strstr(devpath, SYSFS_DEVICES_NAME); - if (c == NULL) - return 1; - *c = '\0'; - safestrcatmax(c, path, (sizeof(devpath) - strlen(devpath))); - - drvlist = sysfs_open_subsystem_list(path); - if (drvlist != NULL) { + drvlist = sysfs_open_directory_list(path); + if (drvlist) { dlist_for_each_data(drvlist, drv, char) { - safestrcpy(path, devpath); - safestrcat(path, "/"); - safestrcat(path, drv); - safestrcat(path, "/"); - safestrcat(path, dev->bus_id); - if (sysfs_path_is_link(path) == 0) { + safestrcpy(devpath, path); + safestrcat(devpath, "/"); + safestrcat(devpath, drv); + safestrcat(devpath, "/"); + safestrcat(devpath, dev->bus_id); + if (sysfs_path_is_link(devpath) == 0) { safestrcpy(dev->driver_name, drv); sysfs_close_list(drvlist); return 0; @@ -73,35 +89,9 @@ static int get_dev_driver(struct sysfs_device *dev) } sysfs_close_list(drvlist); } - return 1; + return -1; } -/* - * get_device_driver_name: gets device's driver name, searches for driver - * link first before going the brute force route. - * @dev: device to retrieve driver - * returns 0 with success and 1 with error - */ -static int get_device_driver_name(struct sysfs_device *dev) -{ - char devpath[SYSFS_PATH_MAX], drvpath[SYSFS_PATH_MAX]; - - if (dev == NULL) { - errno = EINVAL; - return 1; - } - memset(devpath, 0, SYSFS_PATH_MAX); - memset(drvpath, 0, SYSFS_PATH_MAX); - safestrcpy(devpath, dev->path); - safestrcat(devpath, "/driver"); - - if ((sysfs_get_link(devpath, drvpath, SYSFS_PATH_MAX)) != 0) - return(get_dev_driver(dev)); - - return (sysfs_get_name_from_path(drvpath, dev->driver_name, - SYSFS_NAME_LEN)); -} - /** * sysfs_get_device_bus: retrieves the bus name the device is on, checks path * to bus' link to make sure it has correct device. @@ -110,31 +100,49 @@ static int get_device_driver_name(struct sysfs_device *dev) */ int sysfs_get_device_bus(struct sysfs_device *dev) { - char subsys[SYSFS_NAME_LEN], path[SYSFS_PATH_MAX]; - char target[SYSFS_PATH_MAX], *bus = NULL, *c = NULL; - struct dlist *buslist = NULL; + char devpath[SYSFS_PATH_MAX]; + char subsys[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + char target[SYSFS_PATH_MAX]; + char *bus = NULL, *c; + struct dlist *buslist; - if (dev == NULL) { + if (!dev) { errno = EINVAL; return -1; } + memset(path, 0, SYSFS_PATH_MAX); + memset(devpath, 0, SYSFS_PATH_MAX); + safestrcpymax(path, dev->path, SYSFS_PATH_MAX); + safestrcatmax(path, "/bus", SYSFS_PATH_MAX); + if (!sysfs_path_is_link(path)) { + if (!sysfs_get_link(path, devpath, SYSFS_PATH_MAX)) { + if (sysfs_get_name_from_path(devpath, + dev->bus, SYSFS_NAME_LEN)) + return -1; + } + return 0; + } + + /* + * Devices on on earlier kernels do not have the "bus" link. + * Look it up in the bus directory. + */ memset(subsys, 0, SYSFS_NAME_LEN); - safestrcpy(subsys, SYSFS_BUS_NAME); /* subsys = bus */ - buslist = sysfs_open_subsystem_list(subsys); - if (buslist != NULL) { + safestrcpy(subsys, dev->path); + c = strstr(subsys, SYSFS_DEVICES_NAME); + if (c == NULL) { + dprintf("Invalid path to device - %s\n", dev->path); + return -1; + } else + *c = '\0'; + safestrcat(subsys, SYSFS_BUS_NAME); + buslist = sysfs_open_directory_list(subsys); + if (buslist) { dlist_for_each_data(buslist, bus, char) { memset(path, 0, SYSFS_PATH_MAX); - safestrcpy(path, dev->path); - c = strstr(path, "/devices"); - if (c == NULL) { - dprintf("Invalid path to device %s\n", path); - sysfs_close_list(buslist); - return -1; - } - *c = '\0'; - safestrcat(path, "/"); - safestrcat(path, SYSFS_BUS_NAME); + safestrcpy(path, subsys); safestrcat(path, "/"); safestrcat(path, bus); safestrcat(path, "/"); @@ -143,8 +151,8 @@ int sysfs_get_device_bus(struct sysfs_device *dev) safestrcat(path, dev->bus_id); if ((sysfs_path_is_link(path)) == 0) { memset(target, 0, SYSFS_PATH_MAX); - if ((sysfs_get_link(path, target, - SYSFS_PATH_MAX)) != 0) { + if (sysfs_get_link(path, target, + SYSFS_PATH_MAX)) { dprintf("Error getting link target\n"); sysfs_close_list(buslist); return -1; @@ -156,10 +164,10 @@ int sysfs_get_device_bus(struct sysfs_device *dev) return 0; } } - } - sysfs_close_list(buslist); - } - return -1; + } + sysfs_close_list(buslist); + } + return -1; } /** @@ -169,8 +177,8 @@ int sysfs_get_device_bus(struct sysfs_device *dev) */ void sysfs_close_device_tree(struct sysfs_device *devroot) { - if (devroot != NULL) { - if (devroot->children != NULL) { + if (devroot) { + if (devroot->children) { struct sysfs_device *child = NULL; dlist_for_each_data(devroot->children, child, @@ -182,27 +190,19 @@ void sysfs_close_device_tree(struct sysfs_device *devroot) } } -/** - * sysfs_close_dev_tree: routine for dlist integration - */ -static void sysfs_close_dev_tree(void *dev) -{ - sysfs_close_device_tree((struct sysfs_device *)dev); -} - /** * sysfs_close_device: closes and cleans up a device * @dev = device to clean up */ void sysfs_close_device(struct sysfs_device *dev) { - if (dev != NULL) { - if (dev->parent != NULL) + if (dev) { + if (dev->parent) sysfs_close_device(dev->parent); - if (dev->directory != NULL) - sysfs_close_directory(dev->directory); - if (dev->children != NULL && dev->children->count == 0) + if (dev->children && dev->children->count) dlist_destroy(dev->children); + if (dev->attrlist) + dlist_destroy(dev->attrlist); free(dev); } } @@ -213,36 +213,7 @@ void sysfs_close_device(struct sysfs_device *dev) */ static struct sysfs_device *alloc_device(void) { - return (struct sysfs_device *)calloc(1, sizeof(struct sysfs_device)); -} - -/** - * open_device_dir: opens up sysfs_directory for specific root dev - * @name: name of root - * returns struct sysfs_directory with success and NULL with error - */ -static struct sysfs_directory *open_device_dir(const char *path) -{ - struct sysfs_directory *rdir = NULL; - - if (path == NULL) { - errno = EINVAL; - return NULL; - } - - rdir = sysfs_open_directory(path); - if (rdir == NULL) { - errno = EINVAL; - dprintf ("Device %s not supported on this system\n", path); - return NULL; - } - if ((sysfs_read_dir_subdirs(rdir)) != 0) { - dprintf ("Error reading device at dir %s\n", path); - sysfs_close_directory(rdir); - return NULL; - } - - return rdir; + return (struct sysfs_device *) calloc(1, sizeof(struct sysfs_device)); } /** @@ -252,45 +223,44 @@ static struct sysfs_directory *open_device_dir(const char *path) */ struct sysfs_device *sysfs_open_device_path(const char *path) { - struct sysfs_device *dev = NULL; + struct sysfs_device *dev; - if (path == NULL) { + if (!path) { errno = EINVAL; return NULL; } - if ((sysfs_path_is_dir(path)) != 0) { + if (sysfs_path_is_dir(path)) { dprintf("Incorrect path to device: %s\n", path); return NULL; } - dev = alloc_device(); - if (dev == NULL) { + dev = alloc_device(); + if (!dev) { dprintf("Error allocating device at %s\n", path); return NULL; } - if ((sysfs_get_name_from_path(path, dev->bus_id, - SYSFS_NAME_LEN)) != 0) { + if (sysfs_get_name_from_path(path, dev->bus_id, SYSFS_NAME_LEN)) { errno = EINVAL; dprintf("Error getting device bus_id\n"); sysfs_close_device(dev); return NULL; } safestrcpy(dev->path, path); - if ((sysfs_remove_trailing_slash(dev->path)) != 0) { + if (sysfs_remove_trailing_slash(dev->path)) { dprintf("Invalid path to device %s\n", dev->path); sysfs_close_device(dev); return NULL; } - /* + /* * The "name" attribute no longer exists... return the device's * sysfs representation instead, in the "dev->name" field, which * implies that the dev->name and dev->bus_id contain same data. */ safestrcpy(dev->name, dev->bus_id); - - if (sysfs_get_device_bus(dev) != 0) + + if (sysfs_get_device_bus(dev)) dprintf("Could not get device bus\n"); - - if (get_device_driver_name(dev) != 0) { + + if (get_dev_driver(dev)) { dprintf("Could not get device %s's driver\n", dev->bus_id); safestrcpy(dev->driver_name, SYSFS_UNKNOWN); } @@ -299,227 +269,33 @@ struct sysfs_device *sysfs_open_device_path(const char *path) } /** - * sysfs_open_device_tree: opens root device and all of its children, - * creating a tree of devices. Only opens children. - * @path: sysfs path to devices - * returns struct sysfs_device and its children with success or NULL with - * error. - */ -struct sysfs_device *sysfs_open_device_tree(const char *path) -{ - struct sysfs_device *rootdev = NULL, *new = NULL; - struct sysfs_directory *cur = NULL; - - if (path == NULL) { - errno = EINVAL; - return NULL; - } - rootdev = sysfs_open_device_path(path); - if (rootdev == NULL) { - dprintf("Error opening root device at %s\n", path); - return NULL; - } - if (rootdev->directory == NULL) { - rootdev->directory = open_device_dir(rootdev->path); - if (rootdev->directory == NULL) - return NULL; - } - if (rootdev->directory->subdirs != NULL) { - dlist_for_each_data(rootdev->directory->subdirs, cur, - struct sysfs_directory) { - new = sysfs_open_device_tree(cur->path); - if (new == NULL) { - dprintf("Error opening device tree at %s\n", - cur->path); - sysfs_close_device_tree(rootdev); - return NULL; - } - if (rootdev->children == NULL) - rootdev->children = dlist_new_with_delete - (sizeof(struct sysfs_device), - sysfs_close_dev_tree); - dlist_unshift_sorted(rootdev->children, - new, sort_list); - } - } - - return rootdev; -} - -/** - * sysfs_close_root_device: closes root and all devices - * @root: root device to close - */ -void sysfs_close_root_device(struct sysfs_root_device *root) -{ - if (root != NULL) { - if (root->devices != NULL) - dlist_destroy(root->devices); - if (root->directory != NULL) - sysfs_close_directory(root->directory); - free(root); - } -} - -/** - * sysfs_get_root_devices: opens up all the devices under this root device - * @root: root device to open devices for - * returns dlist of devices with success and NULL with error - */ -struct dlist *sysfs_get_root_devices(struct sysfs_root_device *root) -{ - struct sysfs_device *dev = NULL; - struct sysfs_directory *cur = NULL; - - if (root == NULL) { - errno = EINVAL; - return NULL; - } - if (root->directory == NULL) { - root->directory = open_device_dir(root->path); - if (root->directory == NULL) - return NULL; - } - - if (root->directory->subdirs == NULL) - return 0; - - dlist_for_each_data(root->directory->subdirs, cur, - struct sysfs_directory) { - dev = sysfs_open_device_tree(cur->path); - if (dev == NULL) { - dprintf ("Error opening device at %s\n", cur->path); - continue; - } - if (root->devices == NULL) - root->devices = dlist_new_with_delete - (sizeof(struct sysfs_device), - sysfs_close_dev_tree); - dlist_unshift_sorted(root->devices, dev, sort_list); - } - - return root->devices; -} - -/** - * sysfs_open_root_device: opens sysfs devices root and all of its - * devices. - * @name: name of /sys/devices/root to open - * returns struct sysfs_root_device if success and NULL with error - */ -struct sysfs_root_device *sysfs_open_root_device(const char *name) -{ - struct sysfs_root_device *root = NULL; - char rootpath[SYSFS_PATH_MAX]; - - if (name == NULL) { - errno = EINVAL; - return NULL; - } - - memset(rootpath, 0, SYSFS_PATH_MAX); - if (sysfs_get_mnt_path(rootpath, SYSFS_PATH_MAX) != 0) { - dprintf ("Sysfs not supported on this system\n"); - return NULL; - } - - safestrcat(rootpath, "/"); - safestrcat(rootpath, SYSFS_DEVICES_NAME); - safestrcat(rootpath, "/"); - safestrcat(rootpath, name); - if ((sysfs_path_is_dir(rootpath)) != 0) { - errno = EINVAL; - dprintf("Invalid root device: %s\n", name); - return NULL; - } - root = (struct sysfs_root_device *)calloc - (1, sizeof(struct sysfs_root_device)); - if (root == NULL) { - dprintf("calloc failure\n"); - return NULL; - } - safestrcpy(root->name, name); - safestrcpy(root->path, rootpath); - if ((sysfs_remove_trailing_slash(root->path)) != 0) { - dprintf("Invalid path to root device %s\n", root->path); - sysfs_close_root_device(root); - return NULL; - } - return root; -} - -/** - * sysfs_get_device_attributes: returns a dlist of attributes corresponding to - * the specific device - * @device: struct sysfs_device * for which attributes are to be returned - */ -struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) -{ - if (device == NULL) { - errno = EINVAL; - return NULL; - } - - if (device->directory == NULL) { - device->directory = sysfs_open_directory(device->path); - if (device->directory == NULL) - return NULL; - } - if (device->directory->attributes == NULL) { - if ((sysfs_read_dir_attributes(device->directory)) != 0) - return NULL; - } - return (device->directory->attributes); -} - -/** - * sysfs_refresh_device_attributes: refreshes the device's list of attributes - * @device: sysfs_device whose attributes to refresh - * - * NOTE: Upon return, prior references to sysfs_attributes for this device - * _may_ not be valid - * - * Returns list of attributes on success and NULL on failure + * sysfs_get_device_attr: searches dev's attributes by name + * @dev: device to look through + * @name: attribute name to get + * returns sysfs_attribute reference with success or NULL with error. */ -struct dlist *sysfs_refresh_device_attributes(struct sysfs_device *device) +struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, + const char *name) { - if (device == NULL) { + if (!dev || !name) { errno = EINVAL; return NULL; } - - if (device->directory == NULL) - return (sysfs_get_device_attributes(device)); - - if ((sysfs_refresh_dir_attributes(device->directory)) != 0) { - dprintf("Error refreshing device attributes\n"); - return NULL; - } - - return (device->directory->attributes); + return get_attribute(dev, (char *)name); } /** - * sysfs_get_device_attr: searches dev's attributes by name - * @dev: device to look through - * @name: attribute name to get - * returns sysfs_attribute reference with success or NULL with error. + * sysfs_get_device_attributes: gets list of device attributes + * @dev: device whose attributes list is needed + * returns dlist of attributes on success or NULL on error */ -struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, - const char *name) +struct dlist *sysfs_get_device_attributes(struct sysfs_device *dev) { - struct dlist *attrlist = NULL; - - if (dev == NULL || name == NULL) { + if (!dev) { errno = EINVAL; return NULL; } - - attrlist = sysfs_get_device_attributes(dev); - if (attrlist == NULL) - return NULL; - - return sysfs_get_directory_attribute(dev->directory, (char *)name); + return get_attributes_list(dev); } /** @@ -535,13 +311,13 @@ static int get_device_absolute_path(const char *device, const char *bus, { char bus_path[SYSFS_PATH_MAX]; - if (device == NULL || path == NULL) { + if (!device || !path) { errno = EINVAL; return -1; } memset(bus_path, 0, SYSFS_PATH_MAX); - if (sysfs_get_mnt_path(bus_path, SYSFS_PATH_MAX) != 0) { + if (sysfs_get_mnt_path(bus_path, SYSFS_PATH_MAX)) { dprintf ("Sysfs not supported on this system\n"); return -1; } @@ -557,7 +333,7 @@ static int get_device_absolute_path(const char *device, const char *bus, * We now are at /sys/bus/"bus_name"/devices/"device" which is a link. * Now read this link to reach to the device. */ - if ((sysfs_get_link(bus_path, path, psize)) != 0) { + if (sysfs_get_link(bus_path, path, psize)) { dprintf("Error getting to device %s\n", device); return -1; } @@ -578,21 +354,21 @@ static int get_device_absolute_path(const char *device, const char *bus, struct sysfs_device *sysfs_open_device(const char *bus, const char *bus_id) { char sysfs_path[SYSFS_PATH_MAX]; - struct sysfs_device *device = NULL; + struct sysfs_device *device; - if (bus_id == NULL || bus == NULL) { + if (!bus_id || !bus) { errno = EINVAL; return NULL; } memset(sysfs_path, 0, SYSFS_PATH_MAX); - if ((get_device_absolute_path(bus_id, bus, sysfs_path, - SYSFS_PATH_MAX)) != 0) { + if (get_device_absolute_path(bus_id, bus, sysfs_path, + SYSFS_PATH_MAX)) { dprintf("Error getting to device %s\n", bus_id); return NULL; } device = sysfs_open_device_path(sysfs_path); - if (device == NULL) { + if (!device) { dprintf("Error opening device %s\n", bus_id); return NULL; } @@ -608,20 +384,20 @@ struct sysfs_device *sysfs_open_device(const char *bus, const char *bus_id) */ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) { - char ppath[SYSFS_PATH_MAX], *tmp = NULL; + char ppath[SYSFS_PATH_MAX], *tmp; - if (dev == NULL) { + if (!dev) { errno = EINVAL; return NULL; } - if (dev->parent != NULL) + if (dev->parent) return (dev->parent); memset(ppath, 0, SYSFS_PATH_MAX); safestrcpy(ppath, dev->path); tmp = strrchr(ppath, '/'); - if (tmp == NULL) { + if (!tmp) { dprintf("Invalid path to device %s\n", ppath); return NULL; } @@ -634,68 +410,22 @@ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) } } *tmp = '\0'; - + /* * All "devices" have the "detach_state" attribute - validate here */ safestrcat(ppath, "/detach_state"); - if ((sysfs_path_is_file(ppath)) != 0) { + if (sysfs_path_is_file(ppath)) { dprintf("Device at %s does not have a parent\n", dev->path); return NULL; } tmp = strrchr(ppath, '/'); *tmp = '\0'; dev->parent = sysfs_open_device_path(ppath); - if (dev->parent == NULL) { + if (!dev->parent) { dprintf("Error opening device %s's parent at %s\n", dev->bus_id, ppath); return NULL; } return (dev->parent); } - -/* - * sysfs_open_device_attr: open the given device's attribute - * @bus: Bus on which to look - * @dev_id: device for which attribute is required - * @attrname: name of the attribute to look for - * Returns struct sysfs_attribute on success and NULL on failure - * - * NOTE: - * A call to sysfs_close_attribute() is required to close - * the attribute returned and free memory. - */ -struct sysfs_attribute *sysfs_open_device_attr(const char *bus, - const char *bus_id, const char *attrib) -{ - struct sysfs_attribute *attribute = NULL; - char devpath[SYSFS_PATH_MAX]; - - if (bus == NULL || bus_id == NULL || attrib == NULL) { - errno = EINVAL; - return NULL; - } - - memset(devpath, 0, SYSFS_PATH_MAX); - if ((get_device_absolute_path(bus_id, bus, devpath, - SYSFS_PATH_MAX)) != 0) { - dprintf("Error getting to device %s\n", bus_id); - return NULL; - } - safestrcat(devpath, "/"); - safestrcat(devpath, attrib); - attribute = sysfs_open_attribute(devpath); - if (attribute == NULL) { - dprintf("Error opening attribute %s for device %s\n", - attrib, bus_id); - return NULL; - } - if ((sysfs_read_attribute(attribute)) != 0) { - dprintf("Error reading attribute %s for device %s\n", - attrib, bus_id); - sysfs_close_attribute(attribute); - return NULL; - } - return attribute; -} - diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index 52769916cc..c86617934b 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -3,7 +3,7 @@ * * Directory utility functions for libsysfs * - * Copyright (C) IBM Corp. 2003 + * Copyright (C) IBM Corp. 2003-2005 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,39 +23,38 @@ #include "libsysfs.h" #include "sysfs.h" -/** - * sysfs_del_attribute: routine for dlist integration - */ -static void sysfs_del_attribute(void *attr) +static int sort_char(void *new, void *old) { - sysfs_close_attribute((struct sysfs_attribute *)attr); + return ((strncmp((char *)new, (char *)old, + strlen((char *)new))) < 0 ? 1 : 0); } /** - * sysfs_del_link: routine for dlist integration + * sysfs_del_name: free function for sysfs_open_subsystem_list + * @name: memory area to be freed */ -static void sysfs_del_link(void *ln) +static void sysfs_del_name(void *name) { - sysfs_close_link((struct sysfs_link *)ln); + free(name); } /** - * sysfs_del_dir: routine for dlist integration + * sysfs_del_attribute: routine for dlist integration */ -static void sysfs_del_directory(void *dir) +static void sysfs_del_attribute(void *attr) { - sysfs_close_directory((struct sysfs_directory *)dir); + sysfs_close_attribute((struct sysfs_attribute *)attr); } /** - * dir_attribute_name_equal: compares dir attributes by name + * attr_name_equal: compares attributes by name * @a: attribute name for comparison * @b: sysfs_attribute to be compared. * returns 1 if a==b->name or 0 if not equal */ -static int dir_attribute_name_equal(void *a, void *b) +static int attr_name_equal(void *a, void *b) { - if (a == NULL || b == NULL) + if (!a || !b) return 0; if (strcmp(((char *)a), ((struct sysfs_attribute *)b)->name) == 0) @@ -64,48 +63,14 @@ static int dir_attribute_name_equal(void *a, void *b) return 0; } -/** - * dir_link_name_equal: compares dir links by name - * @a: link name for comparison - * @b: sysfs_link to be compared. - * returns 1 if a==b->name or 0 if not equal - */ -static int dir_link_name_equal(void *a, void *b) -{ - if (a == NULL || b == NULL) - return 0; - - if (strcmp(((char *)a), ((struct sysfs_link *)b)->name) == 0) - return 1; - - return 0; -} - -/** - * dir_subdir_name_equal: compares subdirs by name - * @a: name of subdirectory to compare - * @b: sysfs_directory subdirectory to be compared - * returns 1 if a==b->name or 0 if not equal - */ -static int dir_subdir_name_equal(void *a, void *b) -{ - if (a == NULL || b == NULL) - return 0; - - if (strcmp(((char *)a), ((struct sysfs_directory *)b)->name) == 0) - return 1; - - return 0; -} - /** * sysfs_close_attribute: closes and cleans up attribute * @sysattr: attribute to close. */ void sysfs_close_attribute(struct sysfs_attribute *sysattr) { - if (sysattr != NULL) { - if (sysattr->value != NULL) + if (sysattr) { + if (sysattr->value) free(sysattr->value); free(sysattr); } @@ -130,13 +95,13 @@ struct sysfs_attribute *sysfs_open_attribute(const char *path) { struct sysfs_attribute *sysattr = NULL; struct stat fileinfo; - - if (path == NULL) { + + if (!path) { errno = EINVAL; return NULL; } sysattr = alloc_attribute(); - if (sysattr == NULL) { + if (!sysattr) { dprintf("Error allocating attribute at %s\n", path); return NULL; } @@ -162,94 +127,6 @@ struct sysfs_attribute *sysfs_open_attribute(const char *path) return sysattr; } -/** - * sysfs_write_attribute: write value to the attribute - * @sysattr: attribute to write - * @new_value: value to write - * @len: length of "new_value" - * returns 0 with success and -1 with error. - */ -int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const char *new_value, size_t len) -{ - int fd; - int length; - - if (sysattr == NULL || new_value == NULL || len == 0) { - errno = EINVAL; - return -1; - } - - if (!(sysattr->method & SYSFS_METHOD_STORE)) { - dprintf ("Store method not supported for attribute %s\n", - sysattr->path); - errno = EACCES; - return -1; - } - if (sysattr->method & SYSFS_METHOD_SHOW) { - /* - * read attribute again to see if we can get an updated value - */ - if ((sysfs_read_attribute(sysattr)) != 0) { - dprintf("Error reading attribute\n"); - return -1; - } - if ((strncmp(sysattr->value, new_value, sysattr->len)) == 0) { - dprintf("Attr %s already has the requested value %s\n", - sysattr->name, new_value); - return 0; - } - } - /* - * open O_WRONLY since some attributes have no "read" but only - * "write" permission - */ - if ((fd = open(sysattr->path, O_WRONLY)) < 0) { - dprintf("Error reading attribute %s\n", sysattr->path); - return -1; - } - - length = write(fd, new_value, len); - if (length < 0) { - dprintf("Error writing to the attribute %s - invalid value?\n", - sysattr->name); - close(fd); - return -1; - } else if ((unsigned int)length != len) { - dprintf("Could not write %d bytes to attribute %s\n", - len, sysattr->name); - /* - * since we could not write user supplied number of bytes, - * restore the old value if one available - */ - if (sysattr->method & SYSFS_METHOD_SHOW) { - length = write(fd, sysattr->value, sysattr->len); - close(fd); - return -1; - } - } - - /* - * Validate length that has been copied. Alloc appropriate area - * in sysfs_attribute. Verify first if the attribute supports reading - * (show method). If it does not, do not bother - */ - if (sysattr->method & SYSFS_METHOD_SHOW) { - if (length != sysattr->len) { - sysattr->value = (char *)realloc - (sysattr->value, length); - sysattr->len = length; - safestrcpymax(sysattr->value, new_value, length); - } else { - /*"length" of the new value is same as old one */ - safestrcpymax(sysattr->value, new_value, length); - } - } - - close(fd); - return 0; -} - /** * sysfs_read_attribute: reads value from attribute * @sysattr: attribute to read @@ -263,7 +140,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) long pgsize = 0; int fd; - if (sysattr == NULL) { + if (!sysattr) { errno = EINVAL; return -1; } @@ -275,7 +152,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) } pgsize = sysconf(_SC_PAGESIZE); fbuf = (char *)calloc(1, pgsize+1); - if (fbuf == NULL) { + if (!fbuf) { dprintf("calloc failed\n"); return -1; } @@ -303,7 +180,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) sysattr->len = length; close(fd); vbuf = (char *)realloc(fbuf, length+1); - if (vbuf == NULL) { + if (!vbuf) { dprintf("realloc failed\n"); free(fbuf); return -1; @@ -314,758 +191,301 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) } /** - * sysfs_read_attribute_value: given path to attribute, return its value. - * values can be up to a pagesize, if buffer is smaller the value will - * be truncated. - * @attrpath: sysfs path to attribute - * @value: buffer to put value - * @vsize: size of value buffer + * sysfs_write_attribute: write value to the attribute + * @sysattr: attribute to write + * @new_value: value to write + * @len: length of "new_value" * returns 0 with success and -1 with error. */ -int sysfs_read_attribute_value(const char *attrpath, - char *value, size_t vsize) +int sysfs_write_attribute(struct sysfs_attribute *sysattr, + const char *new_value, size_t len) { - struct sysfs_attribute *attr = NULL; - size_t length = 0; + int fd; + int length; - if (attrpath == NULL || value == NULL || vsize == 0) { + if (!sysattr || !new_value || len == 0) { errno = EINVAL; return -1; } - attr = sysfs_open_attribute(attrpath); - if (attr == NULL) { - dprintf("Invalid attribute path %s\n", attrpath); - errno = EINVAL; - return -1; - } - if((sysfs_read_attribute(attr)) != 0 || attr->value == NULL) { - dprintf("Error reading from attribute %s\n", attrpath); - sysfs_close_attribute(attr); + if (!(sysattr->method & SYSFS_METHOD_STORE)) { + dprintf ("Store method not supported for attribute %s\n", + sysattr->path); + errno = EACCES; return -1; } - length = strlen(attr->value); - if (length > vsize) - dprintf("Value length %d is larger than supplied buffer %d\n", - length, vsize); - safestrcpymax(value, attr->value, vsize); - sysfs_close_attribute(attr); - - return 0; -} - -/** - * sysfs_get_value_from_attrbutes: given a linked list of attributes and an - * attribute name, return its value - * @attr: attribute to search - * @name: name to look for - * returns char * value - could be NULL - */ -char *sysfs_get_value_from_attributes(struct dlist *attr, const char *name) -{ - struct sysfs_attribute *cur = NULL; - - if (attr == NULL || name == NULL) { - errno = EINVAL; - return NULL; - } - dlist_for_each_data(attr, cur, struct sysfs_attribute) { - if (strcmp(cur->name, name) == 0) - return cur->value; + if (sysattr->method & SYSFS_METHOD_SHOW) { + /* + * read attribute again to see if we can get an updated value + */ + if ((sysfs_read_attribute(sysattr))) { + dprintf("Error reading attribute\n"); + return -1; + } + if ((strncmp(sysattr->value, new_value, sysattr->len)) == 0) { + dprintf("Attr %s already has the requested value %s\n", + sysattr->name, new_value); + return 0; + } } - return NULL; -} - -/** - * sysfs_close_link: closes and cleans up link. - * @ln: link to close. - */ -void sysfs_close_link(struct sysfs_link *ln) -{ - if (ln != NULL) - free(ln); -} - -/** - * sysfs_close_directory: closes directory, cleans up attributes and links - * @sysdir: sysfs_directory to close - */ -void sysfs_close_directory(struct sysfs_directory *sysdir) -{ - if (sysdir != NULL) { - if (sysdir->subdirs != NULL) - dlist_destroy(sysdir->subdirs); - if (sysdir->links != NULL) - dlist_destroy(sysdir->links); - if (sysdir->attributes != NULL) - dlist_destroy(sysdir->attributes); - free(sysdir); - sysdir = NULL; + /* + * open O_WRONLY since some attributes have no "read" but only + * "write" permission + */ + if ((fd = open(sysattr->path, O_WRONLY)) < 0) { + dprintf("Error reading attribute %s\n", sysattr->path); + return -1; } -} - -/** - * alloc_directory: allocates and initializes directory structure - * returns struct sysfs_directory with success or NULL with error. - */ -static struct sysfs_directory *alloc_directory(void) -{ - return (struct sysfs_directory *) - calloc(1, sizeof(struct sysfs_directory)); -} - -/** - * alloc_link: allocates and initializes link structure - * returns struct sysfs_link with success or NULL with error. - */ -static struct sysfs_link *alloc_link(void) -{ - return (struct sysfs_link *)calloc(1, sizeof(struct sysfs_link)); -} - -/** - * sysfs_read_all_subdirs: calls sysfs_read_directory for all subdirs - * @sysdir: directory whose subdirs need reading. - * returns 0 with success and -1 with error. - */ -int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) -{ - struct sysfs_directory *cursub = NULL; - int retval = 0; - if (sysdir == NULL) { - errno = EINVAL; + length = write(fd, new_value, len); + if (length < 0) { + dprintf("Error writing to the attribute %s - invalid value?\n", + sysattr->name); + close(fd); return -1; - } - if (sysdir->subdirs == NULL) - if ((sysfs_read_dir_subdirs(sysdir)) != 0) - return 0; - if (sysdir->subdirs != NULL) { - dlist_for_each_data(sysdir->subdirs, cursub, - struct sysfs_directory) { - if ((sysfs_read_dir_subdirs(cursub)) != 0) { - dprintf ("Error reading subdirectory %s\n", - cursub->name); - retval = -1; - } + } else if ((unsigned int)length != len) { + dprintf("Could not write %d bytes to attribute %s\n", + len, sysattr->name); + /* + * since we could not write user supplied number of bytes, + * restore the old value if one available + */ + if (sysattr->method & SYSFS_METHOD_SHOW) { + length = write(fd, sysattr->value, sysattr->len); + close(fd); + return -1; } } - if (!retval) - errno = 0; - return retval; -} -/** - * sysfs_open_directory: opens a sysfs directory, creates dir struct, and - * returns. - * @path: path of directory to open. - * returns: struct sysfs_directory * with success and NULL on error. - */ -struct sysfs_directory *sysfs_open_directory(const char *path) -{ - struct sysfs_directory *sdir = NULL; - - if (path == NULL) { - errno = EINVAL; - return NULL; - } - - if (sysfs_path_is_dir(path) != 0) { - dprintf("Invalid path to directory %s\n", path); - errno = EINVAL; - return NULL; - } - - sdir = alloc_directory(); - if (sdir == NULL) { - dprintf("Error allocating directory %s\n", path); - return NULL; - } - if (sysfs_get_name_from_path(path, sdir->name, SYSFS_NAME_LEN) != 0) { - dprintf("Error getting directory name from path: %s\n", path); - sysfs_close_directory(sdir); - return NULL; - } - safestrcpy(sdir->path, path); - - return sdir; -} - -/** - * sysfs_open_link: opens a sysfs link, creates struct, and returns - * @path: path of link to open. - * returns: struct sysfs_link * with success and NULL on error. - */ -struct sysfs_link *sysfs_open_link(const char *linkpath) -{ - struct sysfs_link *ln = NULL; - - if (linkpath == NULL || strlen(linkpath) > SYSFS_PATH_MAX) { - errno = EINVAL; - return NULL; - } - - ln = alloc_link(); - if (ln == NULL) { - dprintf("Error allocating link %s\n", linkpath); - return NULL; - } - safestrcpy(ln->path, linkpath); - if ((sysfs_get_name_from_path(linkpath, ln->name, SYSFS_NAME_LEN)) != 0 - || (sysfs_get_link(linkpath, ln->target, SYSFS_PATH_MAX)) != 0) { - sysfs_close_link(ln); - errno = EINVAL; - dprintf("Invalid link path %s\n", linkpath); - return NULL; + /* + * Validate length that has been copied. Alloc appropriate area + * in sysfs_attribute. Verify first if the attribute supports reading + * (show method). If it does not, do not bother + */ + if (sysattr->method & SYSFS_METHOD_SHOW) { + if (length != sysattr->len) { + sysattr->value = (char *)realloc + (sysattr->value, length); + sysattr->len = length; + safestrcpymax(sysattr->value, new_value, length); + } else { + /*"length" of the new value is same as old one */ + safestrcpymax(sysattr->value, new_value, length); + } } - - return ln; + + close(fd); + return 0; } /** * add_attribute: open and add attribute at path to given directory - * @sysdir: directory to add attribute to + * @dev: device whose attribute is to be added * @path: path to attribute - * returns 0 with success and -1 with error. + * returns pointer to attr added with success and NULL with error. */ -static int add_attribute(struct sysfs_directory *sysdir, const char *path) +static struct sysfs_attribute *add_attribute(void *dev, const char *path) { - struct sysfs_attribute *attr = NULL; + struct sysfs_attribute *attr; attr = sysfs_open_attribute(path); - if (attr == NULL) { + if (!attr) { dprintf("Error opening attribute %s\n", path); - return -1; + return NULL; } if (attr->method & SYSFS_METHOD_SHOW) { - if ((sysfs_read_attribute(attr)) != 0) { + if (sysfs_read_attribute(attr)) { dprintf("Error reading attribute %s\n", path); sysfs_close_attribute(attr); - return 0; + return NULL; } } - - if (sysdir->attributes == NULL) { - sysdir->attributes = dlist_new_with_delete - (sizeof(struct sysfs_attribute), sysfs_del_attribute); - } - dlist_unshift_sorted(sysdir->attributes, attr, sort_list); - - return 0; -} - -/** - * add_subdirectory: open and add subdirectory at path to given directory - * @sysdir: directory to add subdir to - * @path: path to subdirectory - * returns 0 with success and -1 with error. - */ -static int add_subdirectory(struct sysfs_directory *sysdir, const char *path) -{ - struct sysfs_directory *subdir = NULL; - subdir = sysfs_open_directory(path); - if (subdir == NULL) { - dprintf("Error opening directory %s\n", path); - return -1; + if (!((struct sysfs_device *)dev)->attrlist) { + ((struct sysfs_device *)dev)->attrlist = dlist_new_with_delete + (sizeof(struct sysfs_attribute), sysfs_del_attribute); } - if (sysdir->subdirs == NULL) - sysdir->subdirs = dlist_new_with_delete - (sizeof(struct sysfs_directory), sysfs_del_directory); - dlist_unshift_sorted(sysdir->subdirs, subdir, sort_list); - return 0; -} + dlist_unshift_sorted(((struct sysfs_device *)dev)->attrlist, + attr, sort_list); -/** - * add_link: open and add link at path to given directory - * @sysdir: directory to add link to - * @path: path to link - * returns 0 with success and -1 with error. - */ -static int add_link(struct sysfs_directory *sysdir, const char *path) -{ - struct sysfs_link *ln = NULL; - - ln = sysfs_open_link(path); - if (ln == NULL) { - dprintf("Error opening link %s\n", path); - return -1; - } - if (sysdir->links == NULL) - sysdir->links = dlist_new_with_delete - (sizeof(struct sysfs_link), sysfs_del_link); - dlist_unshift_sorted(sysdir->links, ln, sort_list); - return 0; + return attr; } -/** - * sysfs_read_dir_attributes: grabs attributes for the given directory - * @sysdir: sysfs directory to open - * returns 0 with success and -1 with error. +/* + * get_attribute - given a sysfs_* struct and a name, return the + * sysfs_attribute corresponding to "name" + * returns sysfs_attribute on success and NULL on error */ -int sysfs_read_dir_attributes(struct sysfs_directory *sysdir) +struct sysfs_attribute *get_attribute(void *dev, const char *name) { - DIR *dir = NULL; - struct dirent *dirent = NULL; - char file_path[SYSFS_PATH_MAX]; - int retval = 0; + struct sysfs_attribute *cur = NULL; + char path[SYSFS_PATH_MAX]; - if (sysdir == NULL) { + if (!dev || !name) { errno = EINVAL; - return -1; - } - dir = opendir(sysdir->path); - if (dir == NULL) { - dprintf("Error opening directory %s\n", sysdir->path); - return -1; + return NULL; } - while(((dirent = readdir(dir)) != NULL) && retval == 0) { - if (0 == strcmp(dirent->d_name, ".")) - continue; - if (0 == strcmp(dirent->d_name, "..")) - continue; - memset(file_path, 0, SYSFS_PATH_MAX); - safestrcpy(file_path, sysdir->path); - safestrcat(file_path, "/"); - safestrcat(file_path, dirent->d_name); - if ((sysfs_path_is_file(file_path)) == 0) - retval = add_attribute(sysdir, file_path); + + if (((struct sysfs_device *)dev)->attrlist) { + /* check if attr is already in the list */ + cur = (struct sysfs_attribute *)dlist_find_custom + ((((struct sysfs_device *)dev)->attrlist), + (void *)name, attr_name_equal); + if (cur) + return cur; } - closedir(dir); - if (!retval) - errno = 0; - return(retval); + safestrcpymax(path, ((struct sysfs_device *)dev)->path, + SYSFS_PATH_MAX); + safestrcatmax(path, "/", SYSFS_PATH_MAX); + safestrcatmax(path, name, SYSFS_PATH_MAX); + if (!(sysfs_path_is_file(path))) + cur = add_attribute((void *)dev, path); + return cur; } /** - * sysfs_read_dir_links: grabs links in a specific directory - * @sysdir: sysfs directory to read links - * returns 0 with success and -1 with error. + * read_dir_links: grabs links in a specific directory + * @sysdir: sysfs directory to read + * returns list of link names with success and NULL with error. */ -int sysfs_read_dir_links(struct sysfs_directory *sysdir) +struct dlist *read_dir_links(const char *path) { DIR *dir = NULL; struct dirent *dirent = NULL; - char file_path[SYSFS_PATH_MAX]; - int retval = 0; + char file_path[SYSFS_PATH_MAX], *linkname; + struct dlist *linklist = NULL; - if (sysdir == NULL) { + if (!path) { errno = EINVAL; - return -1; + return NULL; } - dir = opendir(sysdir->path); - if (dir == NULL) { - dprintf("Error opening directory %s\n", sysdir->path); - return -1; + dir = opendir(path); + if (!dir) { + dprintf("Error opening directory %s\n", path); + return NULL; } - while(((dirent = readdir(dir)) != NULL) && retval == 0) { + while ((dirent = readdir(dir)) != NULL) { if (0 == strcmp(dirent->d_name, ".")) continue; if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - safestrcpy(file_path, sysdir->path); + safestrcpy(file_path, path); safestrcat(file_path, "/"); safestrcat(file_path, dirent->d_name); if ((sysfs_path_is_link(file_path)) == 0) { - retval = add_link(sysdir, file_path); - if (retval != 0) - break; + if (!linklist) { + linklist = dlist_new_with_delete + (SYSFS_NAME_LEN, sysfs_del_name); + if (!linklist) { + dprintf("Error creating list\n"); + return NULL; + } + } + linkname = (char *)calloc(1, SYSFS_NAME_LEN); + safestrcpymax(linkname, dirent->d_name, SYSFS_NAME_LEN); + dlist_unshift_sorted(linklist, linkname, sort_char); } } closedir(dir); - if (!retval) - errno = 0; - return(retval); + return linklist; } /** - * sysfs_read_dir_subdirs: grabs subdirs in a specific directory - * @sysdir: sysfs directory to read links - * returns 0 with success and -1 with error. + * read_dir_subdirs: grabs subdirs in a specific directory + * @sysdir: sysfs directory to read + * returns list of directory names with success and NULL with error. */ -int sysfs_read_dir_subdirs(struct sysfs_directory *sysdir) +struct dlist *read_dir_subdirs(const char *path) { DIR *dir = NULL; struct dirent *dirent = NULL; - char file_path[SYSFS_PATH_MAX]; - int retval = 0; + char file_path[SYSFS_PATH_MAX], *dir_name; + struct dlist *dirlist = NULL; - if (sysdir == NULL) { + if (!path) { errno = EINVAL; - return -1; + return NULL; } - dir = opendir(sysdir->path); - if (dir == NULL) { - dprintf("Error opening directory %s\n", sysdir->path); - return -1; + dir = opendir(path); + if (!dir) { + dprintf("Error opening directory %s\n", path); + return NULL; } - while(((dirent = readdir(dir)) != NULL) && retval == 0) { + while ((dirent = readdir(dir)) != NULL) { if (0 == strcmp(dirent->d_name, ".")) continue; if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - safestrcpy(file_path, sysdir->path); + safestrcpy(file_path, path); safestrcat(file_path, "/"); safestrcat(file_path, dirent->d_name); - if ((sysfs_path_is_dir(file_path)) == 0) - retval = add_subdirectory(sysdir, file_path); + if ((sysfs_path_is_dir(file_path)) == 0) { + if (!dirlist) { + dirlist = dlist_new_with_delete + (SYSFS_NAME_LEN, sysfs_del_name); + if (!dirlist) { + dprintf("Error creating list\n"); + return NULL; + } + } + dir_name = (char *)calloc(1, SYSFS_NAME_LEN); + safestrcpymax(dir_name, dirent->d_name, SYSFS_NAME_LEN); + dlist_unshift_sorted(dirlist, dir_name, sort_char); + } } closedir(dir); - if (!retval) - errno = 0; - return(retval); + return dirlist; } /** - * sysfs_read_directory: grabs attributes, links, and subdirectories - * @sysdir: sysfs directory to open - * returns 0 with success and -1 with error. + * get_attributes_list: build a list of attributes for the given device + * @dev: devices whose attributes list is required + * returns dlist of attributes on success and NULL on failure */ -int sysfs_read_directory(struct sysfs_directory *sysdir) +struct dlist *get_attributes_list(void *dev) { DIR *dir = NULL; struct dirent *dirent = NULL; - struct stat astats; - char file_path[SYSFS_PATH_MAX]; - int retval = 0; + struct sysfs_attribute *attr = NULL; + char file_path[SYSFS_PATH_MAX], path[SYSFS_PATH_MAX]; - if (sysdir == NULL) { + if (!dev) { errno = EINVAL; - return -1; + return NULL; } - dir = opendir(sysdir->path); - if (dir == NULL) { - dprintf("Error opening directory %s\n", sysdir->path); - return -1; + memset(path, 0, SYSFS_PATH_MAX); + safestrcpy(path, ((struct sysfs_device *)dev)->path); + dir = opendir(path); + if (!dir) { + dprintf("Error opening directory %s\n", path); + return NULL; } - while(((dirent = readdir(dir)) != NULL) && retval == 0) { + while ((dirent = readdir(dir)) != NULL) { if (0 == strcmp(dirent->d_name, ".")) continue; if (0 == strcmp(dirent->d_name, "..")) continue; memset(file_path, 0, SYSFS_PATH_MAX); - safestrcpy(file_path, sysdir->path); + safestrcpy(file_path, path); safestrcat(file_path, "/"); safestrcat(file_path, dirent->d_name); - if ((lstat(file_path, &astats)) != 0) { - dprintf("stat failed\n"); - continue; - } - if (S_ISDIR(astats.st_mode)) - retval = add_subdirectory(sysdir, file_path); - - else if (S_ISLNK(astats.st_mode)) - retval = add_link(sysdir, file_path); - - else if (S_ISREG(astats.st_mode)) - retval = add_attribute(sysdir, file_path); - } - closedir(dir); - if (!retval) - errno = 0; - return(retval); -} - -/** - * sysfs_refresh_dir_attributes: Refresh attributes list - * @sysdir: directory whose list of attributes to refresh - * Returns 0 on success, 1 on failure - */ -int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir) -{ - if (sysdir == NULL) { - errno = EINVAL; - return 1; - } - if ((sysfs_path_is_dir(sysdir->path)) != 0) { - dprintf("Invalid path to directory %s\n", sysdir->path); - errno = EINVAL; - return 1; - } - if (sysdir->attributes != NULL) { - dlist_destroy(sysdir->attributes); - sysdir->attributes = NULL; - } - if ((sysfs_read_dir_attributes(sysdir)) != 0) { - dprintf("Error refreshing attributes for directory %s\n", - sysdir->path); - return 1; - } - errno = 0; - return 0; -} - -/** - * sysfs_refresh_dir_links: Refresh links list - * @sysdir: directory whose list of links to refresh - * Returns 0 on success, 1 on failure - */ -int sysfs_refresh_dir_links(struct sysfs_directory *sysdir) -{ - if (sysdir == NULL) { - errno = EINVAL; - return 1; - } - if ((sysfs_path_is_dir(sysdir->path)) != 0) { - dprintf("Invalid path to directory %s\n", sysdir->path); - errno = EINVAL; - return 1; - } - if (sysdir->links != NULL) { - dlist_destroy(sysdir->links); - sysdir->links = NULL; - } - if ((sysfs_read_dir_links(sysdir)) != 0) { - dprintf("Error refreshing links for directory %s\n", - sysdir->path); - return 1; - } - errno = 0; - return 0; -} - -/** - * sysfs_refresh_dir_subdirs: Refresh subdirs list - * @sysdir: directory whose list of subdirs to refresh - * Returns 0 on success, 1 on failure - */ -int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir) -{ - if (sysdir == NULL) { - errno = EINVAL; - return 1; - } - if ((sysfs_path_is_dir(sysdir->path)) != 0) { - dprintf("Invalid path to directory %s\n", sysdir->path); - errno = EINVAL; - return 1; - } - if (sysdir->subdirs != NULL) { - dlist_destroy(sysdir->subdirs); - sysdir->subdirs = NULL; - } - if ((sysfs_read_dir_subdirs(sysdir)) != 0) { - dprintf("Error refreshing subdirs for directory %s\n", - sysdir->path); - return 1; - } - errno = 0; - return 0; -} - -/** - * sysfs_get_directory_attribute: retrieves attribute attrname from current - * directory only - * @dir: directory to retrieve attribute from - * @attrname: name of attribute to look for - * - * NOTE: Since we know the attribute to look for, this routine looks for the - * attribute if it was created _after_ the attrlist was read initially. - * - * returns sysfs_attribute if found and NULL if not found - */ -struct sysfs_attribute *sysfs_get_directory_attribute - (struct sysfs_directory *dir, char *attrname) -{ - struct sysfs_attribute *attr = NULL; - char new_path[SYSFS_PATH_MAX]; - - if (dir == NULL || attrname == NULL) { - errno = EINVAL; - return NULL; - } - - if (dir->attributes == NULL) - if ((sysfs_read_dir_attributes(dir) != 0) - || (dir->attributes == NULL)) - return NULL; - - attr = (struct sysfs_attribute *)dlist_find_custom - (dir->attributes, attrname, dir_attribute_name_equal); - if (attr != NULL) { - if ((attr->method & SYSFS_METHOD_SHOW) && - (sysfs_read_attribute(attr)) != 0) { - dprintf("Error reading attribute %s\n", attr->name); - return NULL; - } - } else { - memset(new_path, 0, SYSFS_PATH_MAX); - safestrcpy(new_path, dir->path); - safestrcat(new_path, "/"); - safestrcat(new_path, attrname); - if ((sysfs_path_is_file(new_path)) == 0) { - if ((add_attribute(dir, new_path)) == 0) { + if ((sysfs_path_is_file(file_path)) == 0) { + if (((struct sysfs_device *)dev)->attrlist) { + /* check if attr is already in the list */ attr = (struct sysfs_attribute *) - dlist_find_custom(dir->attributes, - attrname, dir_attribute_name_equal); - } - } - } - - return attr; -} - -/** - * sysfs_get_directory_link: retrieves link from one directory list - * @dir: directory to retrieve link from - * @linkname: name of link to look for - * returns reference to sysfs_link if found and NULL if not found - */ -struct sysfs_link *sysfs_get_directory_link - (struct sysfs_directory *dir, char *linkname) -{ - if (dir == NULL || linkname == NULL) { - errno = EINVAL; - return NULL; - } - if (dir->links == NULL) { - if ((sysfs_read_dir_links(dir) != 0) || (dir->links == NULL)) - return NULL; - } else { - if ((sysfs_refresh_dir_links(dir)) != 0) - return NULL; - } - - return (struct sysfs_link *)dlist_find_custom(dir->links, - linkname, dir_link_name_equal); -} - -/** - * sysfs_get_subdirectory: retrieves subdirectory by name. - * @dir: directory to search for subdirectory. - * @subname: subdirectory name to get. - * returns reference to subdirectory or NULL if not found - */ -struct sysfs_directory *sysfs_get_subdirectory(struct sysfs_directory *dir, - char *subname) -{ - struct sysfs_directory *sub = NULL, *cursub = NULL; - - if (dir == NULL || subname == NULL) { - errno = EINVAL; - return NULL; - } - - if (dir->subdirs == NULL) - if (sysfs_read_dir_subdirs(dir) != 0) - return NULL; - - sub = (struct sysfs_directory *)dlist_find_custom(dir->subdirs, - subname, dir_subdir_name_equal); - if (sub != NULL) - return sub; - - if (dir->subdirs != NULL) { - dlist_for_each_data(dir->subdirs, cursub, - struct sysfs_directory) { - if (cursub->subdirs == NULL) { - if (sysfs_read_dir_subdirs(cursub) != 0) - continue; - if (cursub->subdirs == NULL) + dlist_find_custom + ((((struct sysfs_device *)dev)->attrlist), + (void *)dirent->d_name, attr_name_equal); + if (attr) continue; - } - sub = sysfs_get_subdirectory(cursub, subname); - if (sub != NULL) - return sub; - } - } - return NULL; -} - -/** - * sysfs_get_subdirectory_link: looks through all subdirs for specific link. - * @dir: directory and subdirectories to search for link. - * @linkname: link name to get. - * returns reference to link or NULL if not found - */ -struct sysfs_link *sysfs_get_subdirectory_link(struct sysfs_directory *dir, - char *linkname) -{ - struct sysfs_directory *cursub = NULL; - struct sysfs_link *ln = NULL; - - if (dir == NULL || linkname == NULL) { - errno = EINVAL; - return NULL; - } - - ln = sysfs_get_directory_link(dir, linkname); - if (ln != NULL) - return ln; - - if (dir->subdirs == NULL) - if (sysfs_read_dir_subdirs(dir) != 0) - return NULL; - - if (dir->subdirs != NULL) { - dlist_for_each_data(dir->subdirs, cursub, - struct sysfs_directory) { - ln = sysfs_get_subdirectory_link(cursub, linkname); - if (ln != NULL) - return ln; + else + add_attribute(dev, file_path); + } else + attr = add_attribute(dev, file_path); } } - return NULL; -} - -/** - * sysfs_get_dir_attributes: returns dlist of directory attributes - * @dir: directory to retrieve attributes from - * returns dlist of attributes or NULL - */ -struct dlist *sysfs_get_dir_attributes(struct sysfs_directory *dir) -{ - if (dir == NULL) { - errno = EINVAL; - return NULL; - } - - if (dir->attributes == NULL) { - if (sysfs_read_dir_attributes(dir) != 0) - return NULL; - } - - return (dir->attributes); -} - -/** - * sysfs_get_dir_links: returns dlist of directory links - * @dir: directory to return links for - * returns dlist of links or NULL - */ -struct dlist *sysfs_get_dir_links(struct sysfs_directory *dir) -{ - if (dir == NULL) { - errno = EINVAL; - return NULL; - } - - if (dir->links == NULL) { - if (sysfs_read_dir_links(dir) != 0) - return NULL; - } - - return (dir->links); -} - -/** - * sysfs_get_dir_subdirs: returns dlist of directory subdirectories - * @dir: directory to return subdirs for - * returns dlist of subdirs or NULL - */ -struct dlist *sysfs_get_dir_subdirs(struct sysfs_directory *dir) -{ - if (dir == NULL) { - errno = EINVAL; - return NULL; - } - - if (dir->subdirs == NULL) { - if (sysfs_read_dir_subdirs(dir) != 0) - return NULL; - } - - return (dir->subdirs); + closedir(dir); + return ((struct sysfs_device *)dev)->attrlist; } diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c index 88d26b56dd..c2464faa9e 100644 --- a/libsysfs/sysfs_driver.c +++ b/libsysfs/sysfs_driver.c @@ -3,7 +3,7 @@ * * Driver utility functions for libsysfs * - * Copyright (C) IBM Corp. 2003 + * Copyright (C) IBM Corp. 2003-2005 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -28,42 +28,20 @@ static void sysfs_close_driver_device(void *device) sysfs_close_device((struct sysfs_device *)device); } -/** +/** * sysfs_close_driver: closes driver and deletes device lists too * @driver: driver to close - */ + */ void sysfs_close_driver(struct sysfs_driver *driver) { - if (driver != NULL) { - if (driver->devices != NULL) + if (driver) { + if (driver->devices) dlist_destroy(driver->devices); - if (driver->directory != NULL) - sysfs_close_directory(driver->directory); + if (driver->attrlist) + dlist_destroy(driver->attrlist); free(driver); } } - -/** - * open_driver_dir: Open the sysfs_directory for this driver - * @driver: Driver whose directory to be opened - * Returns 0 on success and 1 on failure - */ -static int open_driver_dir(struct sysfs_driver *driver) -{ - if (driver == NULL) { - errno = EINVAL; - return 1; - } - if (driver->directory == NULL) { - driver->directory = sysfs_open_directory(driver->path); - if (driver->directory == NULL) { - dprintf("Error opening driver directory at %s\n", - driver->path); - return 1; - } - } - return 0; -} /** * alloc_driver: allocates and initializes driver @@ -75,244 +53,104 @@ static struct sysfs_driver *alloc_driver(void) } /** - * sysfs_open_driver_path: opens and initializes driver structure - * @path: path to driver directory - * returns struct sysfs_driver with success and NULL with error + * get_driver_bus: gets bus the driver is on + * Returns 0 on success and 1 on error */ -struct sysfs_driver *sysfs_open_driver_path(const char *path) +static int get_driver_bus(struct sysfs_driver *drv) { - struct sysfs_driver *driver = NULL; - - if (path == NULL) { - errno = EINVAL; - return NULL; - } - if ((sysfs_path_is_dir(path)) != 0) { - dprintf("Invalid path to driver: %s\n", path); - return NULL; - } - driver = alloc_driver(); - if (driver == NULL) { - dprintf("Error allocating driver at %s\n", path); - return NULL; - } - if ((sysfs_get_name_from_path(path, driver->name, - SYSFS_NAME_LEN)) != 0) { - dprintf("Error getting driver name from path\n"); - free(driver); - return NULL; - } - safestrcpy(driver->path, path); - if ((sysfs_remove_trailing_slash(driver->path)) != 0) { - dprintf("Invalid path to driver %s\n", driver->path); - sysfs_close_driver(driver); - return NULL; - } + char drvpath[SYSFS_PATH_MAX], *c = NULL; - return driver; -} - -/** - * sysfs_get_driver_attributes: gets list of attributes for the given driver - * @driver: sysfs_driver for which attributes are required - * returns a dlist of attributes corresponding to the driver if present - * NULL otherwise - */ -struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) -{ - if (driver == NULL) { + if (!drv) { errno = EINVAL; - return NULL; - } - - if (driver->directory == NULL) { - if ((open_driver_dir(driver)) == 1) - return NULL; - } - if (driver->directory->attributes == NULL) { - if ((sysfs_read_dir_attributes(driver->directory)) != 0) - return NULL; + return 1; } - return(driver->directory->attributes); -} -/** - * sysfs_refresh_driver_attributes: refreshes the driver's list of attributes - * @driver: sysfs_driver whose attributes to refresh - * - * NOTE: Upon return, prior references to sysfs_attributes for this driver - * _may_ not be valid - * - * Returns list of attributes on success and NULL on failure - */ -struct dlist *sysfs_refresh_driver_attributes(struct sysfs_driver *driver) -{ - if (driver == NULL) { - errno = EINVAL; - return NULL; - } - if (driver->directory == NULL) - return (sysfs_get_driver_attributes(driver)); - - if ((sysfs_refresh_dir_attributes(driver->directory)) != 0) { - dprintf("Error refreshing driver attributes\n"); - return NULL; - } - return (driver->directory->attributes); + safestrcpy(drvpath, drv->path); + c = strstr(drvpath, SYSFS_DRIVERS_NAME); + if (c == NULL) + return 1; + *--c = '\0'; + c = strstr(drvpath, SYSFS_BUS_NAME); + if (c == NULL) + return 1; + c = strstr(c, "/"); + if (c == NULL) + return 1; + c++; + safestrcpy(drv->bus, c); + return 0; } /** - * sysfs_get_driver_attr: searches driver's attributes by name + * sysfs_get_driver_attr: searches drv's attributes by name * @drv: driver to look through * @name: attribute name to get - * returns sysfs_attribute reference on success or NULL with error - */ + * returns sysfs_attribute reference with success or NULL with error. + */ struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, - const char *name) + const char *name) { - struct dlist *attrlist = NULL; - - if (drv == NULL) { - errno = EINVAL; - return NULL; - } - - attrlist = sysfs_get_driver_attributes(drv); - if (attrlist == NULL) + if (!drv || !name) { + errno = EINVAL; return NULL; - - return sysfs_get_directory_attribute(drv->directory, (char *)name); + } + return get_attribute(drv, (char *)name); } /** - * sysfs_get_driver_links: gets list of links from the given driver - * @driver: sysfs_driver for which links list is required - * returns a dlist of links corresponding to the driver if present - * NULL otherwise + * sysfs_get_driver_attributes: gets list of driver attributes + * @dev: driver whose attributes list is needed + * returns dlist of attributes on success or NULL on error */ -struct dlist *sysfs_get_driver_links(struct sysfs_driver *driver) +struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *drv) { - if (driver == NULL) { + if (!drv) { errno = EINVAL; return NULL; } - - if (driver->directory == NULL) - if ((open_driver_dir(driver)) == 1) - return NULL; - - if (driver->directory->links == NULL) - if ((sysfs_read_dir_links(driver->directory)) != 0) - return NULL; - - return(driver->directory->links); + return get_attributes_list(drv); } /** - * sysfs_get_driver_devices: open up the list of devices this driver supports - * @driver: sysfs_driver for which devices are needed - * Returns dlist of devices on SUCCESS or NULL with ERROR - */ -struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver) + * sysfs_open_driver_path: opens and initializes driver structure + * @path: path to driver directory + * returns struct sysfs_driver with success and NULL with error + */ +struct sysfs_driver *sysfs_open_driver_path(const char *path) { - struct sysfs_link *curlink = NULL; - struct sysfs_device *device = NULL; + struct sysfs_driver *driver = NULL; - if (driver == NULL) { + if (!path) { errno = EINVAL; return NULL; } - - if (driver->devices != NULL) - return (driver->devices); - - if (driver->directory == NULL || driver->directory->links == NULL) { - struct dlist *list = NULL; - list = sysfs_get_driver_links(driver); - } - - if (driver->directory->links != NULL) { - dlist_for_each_data(driver->directory->links, curlink, - struct sysfs_link) { - device = sysfs_open_device_path(curlink->target); - if (device == NULL) { - dprintf("Error opening device at %s\n", - curlink->target); - return NULL; - } - if (driver->devices == NULL) - driver->devices = dlist_new_with_delete - (sizeof(struct sysfs_device), - sysfs_close_driver_device); - dlist_unshift_sorted(driver->devices, device, - sort_list); - } + if (sysfs_path_is_dir(path)) { + dprintf("Invalid path to driver: %s\n", path); + return NULL; } - return (driver->devices); -} - -/** - * sysfs_refresh_driver_devices: Refreshes drivers list of devices - * @driver: sysfs_driver whose devices list needs to be refreshed - * - * NOTE: Upon return from this function, prior sysfs_device references from - * this driver's list of devices _may_ not be valid - * - * Returns dlist of devices on success and NULL on failure - */ -struct dlist *sysfs_refresh_driver_devices(struct sysfs_driver *driver) -{ - if (driver == NULL) { - errno = EINVAL; + driver = alloc_driver(); + if (!driver) { + dprintf("Error allocating driver at %s\n", path); return NULL; } - - if (driver->devices != NULL) { - dlist_destroy(driver->devices); - driver->devices = NULL; + if (sysfs_get_name_from_path(path, driver->name, SYSFS_NAME_LEN)) { + dprintf("Error getting driver name from path\n"); + free(driver); + return NULL; } - - if (driver->directory == NULL) - return (sysfs_get_driver_devices(driver)); - - if ((sysfs_refresh_dir_links(driver->directory)) != 0) { - dprintf("Error refreshing driver links\n"); + safestrcpy(driver->path, path); + if (sysfs_remove_trailing_slash(driver->path)) { + dprintf("Invalid path to driver %s\n", driver->path); + sysfs_close_driver(driver); return NULL; } - - return (sysfs_get_driver_devices(driver)); -} - -/** - * sysfs_get_driver_device: looks up a device from a list of driver's devices - * and returns its sysfs_device corresponding to it - * @driver: sysfs_driver on which to search - * @name: name of the device to search - * Returns a sysfs_device if found, NULL otherwise - */ -struct sysfs_device *sysfs_get_driver_device(struct sysfs_driver *driver, - const char *name) -{ - struct sysfs_device *device = NULL; - struct dlist *devlist = NULL; - - if (driver == NULL || name == NULL) { - errno = EINVAL; + if (get_driver_bus(driver)) { + dprintf("Could not get the bus driver is on\n"); + sysfs_close_driver(driver); return NULL; } - if (driver->devices == NULL) { - devlist = sysfs_get_driver_devices(driver); - if (devlist == NULL) { - dprintf("Error getting driver devices\n"); - return NULL; - } - } - dlist_for_each_data(driver->devices, device, struct sysfs_device) { - if (!(strncmp(device->name, name, SYSFS_NAME_LEN))) - return device; - } - return NULL; + return driver; } /** @@ -327,11 +165,11 @@ struct sysfs_device *sysfs_get_driver_device(struct sysfs_driver *driver, static int get_driver_path(const char *bus, const char *drv, char *path, size_t psize) { - if (bus == NULL || drv == NULL || path == NULL || psize == 0) { + if (!bus || !drv || !path || psize == 0) { errno = EINVAL; return -1; } - if (sysfs_get_mnt_path(path, psize) != 0) { + if (sysfs_get_mnt_path(path, psize)) { dprintf("Error getting sysfs mount path\n"); return -1; } @@ -346,50 +184,6 @@ static int get_driver_path(const char *bus, const char *drv, return 0; } -/** - * sysfs_open_driver_attr: read the user supplied driver attribute - * @bus: bus on which to look - * @drv: driver whose attribute has to be read - * @attrib: Attribute to be read - * Returns struct sysfs_attribute on success and NULL on failure - * - * NOTE: - * A call to sysfs_close_attribute() is required to close the - * attribute returned and to free memory - */ -struct sysfs_attribute *sysfs_open_driver_attr(const char *bus, - const char *drv, const char *attrib) -{ - struct sysfs_attribute *attribute = NULL; - char path[SYSFS_PATH_MAX]; - - if (bus == NULL || drv == NULL || attrib == NULL) { - errno = EINVAL; - return NULL; - } - - memset(path, 0, SYSFS_PATH_MAX); - if ((get_driver_path(bus, drv, path, SYSFS_PATH_MAX)) != 0) { - dprintf("Error getting to driver %s\n", drv); - return NULL; - } - safestrcat(path, "/"); - safestrcat(path, attrib); - attribute = sysfs_open_attribute(path); - if (attribute == NULL) { - dprintf("Error opening attribute %s for driver %s\n", - attrib, drv); - return NULL; - } - if ((sysfs_read_attribute(attribute)) != 0) { - dprintf("Error reading attribute %s for driver %s\n", - attrib, drv); - sysfs_close_attribute(attribute); - return NULL; - } - return attribute; -} - /** * sysfs_open_driver: open driver by name, given its bus * @bus_name: Name of the bus @@ -402,21 +196,66 @@ struct sysfs_driver *sysfs_open_driver(const char *bus_name, char path[SYSFS_PATH_MAX]; struct sysfs_driver *driver = NULL; - if (drv_name == NULL || bus_name == NULL) { + if (!drv_name || !bus_name) { errno = EINVAL; return NULL; } memset(path, 0, SYSFS_PATH_MAX); - if ((get_driver_path(bus_name, drv_name, path, SYSFS_PATH_MAX)) != 0) { + if (get_driver_path(bus_name, drv_name, path, SYSFS_PATH_MAX)) { dprintf("Error getting to driver %s\n", drv_name); return NULL; } driver = sysfs_open_driver_path(path); - if (driver == NULL) { + if (!driver) { dprintf("Error opening driver at %s\n", path); return NULL; } return driver; } +/** + * sysfs_get_driver_devices: gets list of devices that use the driver + * @drv: sysfs_driver whose device list is needed + * Returns dlist of struct sysfs_device on success and NULL on failure + */ +struct dlist *sysfs_get_driver_devices(struct sysfs_driver *drv) +{ + char *ln = NULL; + struct dlist *linklist = NULL; + struct sysfs_device *dev = NULL; + + if (!drv) { + errno = EINVAL; + return NULL; + } + + linklist = read_dir_links(drv->path); + if (linklist) { + dlist_for_each_data(linklist, ln, char) { + + if (!strncmp(ln, SYSFS_MODULE_NAME, strlen(ln))) + continue; + + dev = sysfs_open_device(drv->bus, ln); + if (!dev) { + dprintf("Error opening driver's device\n"); + sysfs_close_list(linklist); + return NULL; + } + if (!drv->devices) { + drv->devices = dlist_new_with_delete + (sizeof(struct sysfs_device), + sysfs_close_driver_device); + if (!drv->devices) { + dprintf("Error creating device list\n"); + sysfs_close_list(linklist); + return NULL; + } + } + dlist_unshift_sorted(drv->devices, dev, sort_list); + } + sysfs_close_list(linklist); + } + return drv->devices; +} diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 8b1f56ed14..9f6e18f665 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -23,12 +23,6 @@ #include "libsysfs.h" #include "sysfs.h" -static int sort_char(void *new, void *old) -{ - return ((strncmp((char *)new, (char *)old, - strlen((char *)new))) < 0 ? 1 : 0); -} - /** * sysfs_remove_trailing_slash: Removes any trailing '/' in the given path * @path: Path to look for the trailing '/' @@ -38,7 +32,7 @@ int sysfs_remove_trailing_slash(char *path) { char *c = NULL; - if (path == NULL) { + if (!path) { errno = EINVAL; return 1; } @@ -53,54 +47,6 @@ int sysfs_remove_trailing_slash(char *path) return 0; } -/** - * sysfs_get_fs_mnt_path: Gets the mount point for specified filesystem. - * @fs_type: filesystem type to retrieve mount point - * @mnt_path: place to put the retrieved mount path - * @len: size of mnt_path - * returns 0 with success and -1 with error. - */ -static int sysfs_get_fs_mnt_path(const char *fs_type, - char *mnt_path, size_t len) -{ - FILE *mnt; - struct mntent *mntent; - int ret = 0; - size_t dirlen = 0; - - /* check arg */ - if (fs_type == NULL || mnt_path == NULL || len == 0) { - errno = EINVAL; - return -1; - } - - if ((mnt = setmntent(SYSFS_PROC_MNTS, "r")) == NULL) { - dprintf("Error getting mount information\n"); - return -1; - } - while (ret == 0 && dirlen == 0 && (mntent = getmntent(mnt)) != NULL) { - if (strcmp(mntent->mnt_type, fs_type) == 0) { - dirlen = strlen(mntent->mnt_dir); - if (dirlen <= (len - 1)) { - safestrcpymax(mnt_path, mntent->mnt_dir, len); - } else { - dprintf("Error - mount path too long\n"); - ret = -1; - } - } - } - endmntent(mnt); - if (dirlen == 0 && ret == 0) { - dprintf("Filesystem %s not found!\n", fs_type); - errno = EINVAL; - ret = -1; - } - if ((sysfs_remove_trailing_slash(mnt_path)) != 0) - ret = -1; - - return ret; -} - /* * sysfs_get_mnt_path: Gets the sysfs mount point. * @mnt_path: place to put "sysfs" mount point @@ -109,22 +55,21 @@ static int sysfs_get_fs_mnt_path(const char *fs_type, */ int sysfs_get_mnt_path(char *mnt_path, size_t len) { - char *sysfs_path = NULL; - int ret = 0; - - if (mnt_path == NULL || len == 0) { - errno = EINVAL; - return -1; + static char sysfs_path[SYSFS_PATH_MAX] = ""; + const char *sysfs_path_env; + + /* evaluate only at the first call */ + if (sysfs_path[0] == '\0') { + /* possible overrride of real mount path */ + sysfs_path_env = getenv(SYSFS_PATH_ENV); + if (sysfs_path_env != NULL) { + safestrcpymax(mnt_path, sysfs_path_env, len); + return 0; + } + safestrcpymax(mnt_path, SYSFS_MNT_PATH, len); } - sysfs_path = getenv(SYSFS_PATH_ENV); - if (sysfs_path != NULL) { - safestrcpymax(mnt_path, sysfs_path, len); - if ((sysfs_remove_trailing_slash(mnt_path)) != 0) - return 1; - } else - ret = sysfs_get_fs_mnt_path(SYSFS_FSTYPE_NAME, mnt_path, len); - return ret; + return 0; } /** @@ -137,8 +82,8 @@ int sysfs_get_name_from_path(const char *path, char *name, size_t len) { char tmp[SYSFS_PATH_MAX]; char *n = NULL; - - if (path == NULL || name == NULL || len == 0) { + + if (!path || !name || len == 0) { errno = EINVAL; return -1; } @@ -161,7 +106,7 @@ int sysfs_get_name_from_path(const char *path, char *name, size_t len) safestrcpymax(name, n, len); return 0; } - + /** * sysfs_get_link: returns link source * @path: symbolic link's path @@ -176,7 +121,7 @@ int sysfs_get_link(const char *path, char *target, size_t len) char *d = NULL, *s = NULL; int slashes = 0, count = 0; - if (path == NULL || target == NULL || len == 0) { + if (!path || !target || len == 0) { errno = EINVAL; return -1; } @@ -190,15 +135,15 @@ int sysfs_get_link(const char *path, char *target, size_t len) return -1; } d = linkpath; - /* + /* * Three cases here: * 1. relative path => format ../.. * 2. absolute path => format /abcd/efgh * 3. relative path _from_ this dir => format abcd/efgh - */ + */ switch (*d) { case '.': - /* + /* * handle the case where link is of type ./abcd/xxx */ safestrcpy(temp_path, devdir); @@ -215,9 +160,8 @@ int sysfs_get_link(const char *path, char *target, size_t len) } safestrcpymax(target, temp_path, len); break; - /* - * relative path - * getting rid of leading "../.." + /* + * relative path, getting rid of leading "../.." */ parse_path: while (*d == '/' || *d == '.') { @@ -254,16 +198,6 @@ parse_path: return 0; } -/** - * sysfs_del_name: free function for sysfs_open_subsystem_list - * @name: memory area to be freed - */ -static void sysfs_del_name(void *name) -{ - free(name); -} - - /** * sysfs_close_list: generic list free routine * @list: dlist to free @@ -271,142 +205,22 @@ static void sysfs_del_name(void *name) */ void sysfs_close_list(struct dlist *list) { - if (list != NULL) + if (list) dlist_destroy(list); } /** - * sysfs_open_subsystem_list: gets a list of all supported "name" subsystem - * details from the system - * @name: name of the subsystem, eg., "bus", "class", "devices" - * Returns a dlist of supported names or NULL if subsystem not supported - */ -struct dlist *sysfs_open_subsystem_list(char *name) -{ - char sysfs_path[SYSFS_PATH_MAX], *subsys_name = NULL; - char *c = NULL; - struct sysfs_directory *dir = NULL, *cur = NULL; - struct dlist *list = NULL; - - if (name == NULL) - return NULL; - - if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) { - dprintf("Error getting sysfs mount point\n"); - return NULL; - } - - safestrcat(sysfs_path, "/"); - safestrcat(sysfs_path, name); - dir = sysfs_open_directory(sysfs_path); - if (dir == NULL) { - dprintf("Error opening sysfs_directory at %s\n", sysfs_path); - return NULL; - } - - if ((sysfs_read_dir_subdirs(dir)) != 0) { - dprintf("Error reading sysfs_directory at %s\n", sysfs_path); - sysfs_close_directory(dir); - return NULL; - } - - if (dir->subdirs != NULL) { - list = dlist_new_with_delete(SYSFS_NAME_LEN, - sysfs_del_name); - if (list == NULL) { - dprintf("Error creating list\n"); - sysfs_close_directory(dir); - return NULL; - } - - dlist_for_each_data(dir->subdirs, cur, - struct sysfs_directory) { - subsys_name = (char *)calloc(1, SYSFS_NAME_LEN); - safestrcpymax(subsys_name, cur->name, SYSFS_NAME_LEN); - dlist_unshift_sorted(list, subsys_name, sort_char); - } - } - sysfs_close_directory(dir); - /* - * We are now considering "block" as a "class". Hence, if the subsys - * name requested here is "class", verify if "block" is supported on - * this system and return the same. - */ - if (strcmp(name, SYSFS_CLASS_NAME) == 0) { - c = strstr(sysfs_path, SYSFS_CLASS_NAME); - if (c == NULL) - goto out; - *c = '\0'; - safestrcpymax(c, SYSFS_BLOCK_NAME, - sizeof(sysfs_path) - strlen(sysfs_path)); - if ((sysfs_path_is_dir(sysfs_path)) == 0) { - subsys_name = (char *)calloc(1, SYSFS_NAME_LEN); - safestrcpymax(subsys_name, SYSFS_BLOCK_NAME, - SYSFS_NAME_LEN); - dlist_unshift_sorted(list, subsys_name, sort_char); - } - } -out: - return list; -} - - -/** - * sysfs_open_bus_devices_list: gets a list of all devices on "name" bus - * @name: name of the subsystem, eg., "pci", "scsi", "usb" - * Returns a dlist of supported names or NULL if subsystem not supported - */ -struct dlist *sysfs_open_bus_devices_list(char *name) + * sysfs_open_directory_list: gets a list of all directories under "path" + * @path: path to read + * Returns a dlist of supported names or NULL no directories (errno is set + * in case of error + */ +struct dlist *sysfs_open_directory_list(const char *path) { - char sysfs_path[SYSFS_PATH_MAX], *device_name = NULL; - struct sysfs_directory *dir = NULL; - struct sysfs_link *cur = NULL; - struct dlist *list = NULL; - - if (name == NULL) - return NULL; - - if (sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX) != 0) { - dprintf("Error getting sysfs mount point\n"); - return NULL; - } - - safestrcat(sysfs_path, "/"); - safestrcat(sysfs_path, SYSFS_BUS_NAME); - safestrcat(sysfs_path, "/"); - safestrcat(sysfs_path, name); - safestrcat(sysfs_path, "/"); - safestrcat(sysfs_path, SYSFS_DEVICES_NAME); - dir = sysfs_open_directory(sysfs_path); - if (dir == NULL) { - dprintf("Error opening sysfs_directory at %s\n", sysfs_path); - return NULL; - } - - if ((sysfs_read_dir_links(dir)) != 0) { - dprintf("Error reading sysfs_directory at %s\n", sysfs_path); - sysfs_close_directory(dir); + if (!path) return NULL; - } - - if (dir->links != NULL) { - list = dlist_new_with_delete(SYSFS_NAME_LEN, - sysfs_del_name); - if (list == NULL) { - dprintf("Error creating list\n"); - sysfs_close_directory(dir); - return NULL; - } - dlist_for_each_data(dir->links, cur, - struct sysfs_link) { - device_name = (char *)calloc(1, SYSFS_NAME_LEN); - safestrcpymax(device_name, cur->name, SYSFS_NAME_LEN); - dlist_unshift_sorted(list, device_name, sort_char); - } - } - sysfs_close_directory(dir); - return list; + return (read_dir_subdirs(path)); } /** @@ -418,7 +232,7 @@ int sysfs_path_is_dir(const char *path) { struct stat astats; - if (path == NULL) { + if (!path) { errno = EINVAL; return 1; } @@ -428,7 +242,7 @@ int sysfs_path_is_dir(const char *path) } if (S_ISDIR(astats.st_mode)) return 0; - + return 1; } @@ -441,7 +255,7 @@ int sysfs_path_is_link(const char *path) { struct stat astats; - if (path == NULL) { + if (!path) { errno = EINVAL; return 1; } @@ -451,7 +265,7 @@ int sysfs_path_is_link(const char *path) } if (S_ISLNK(astats.st_mode)) return 0; - + return 1; } @@ -464,7 +278,7 @@ int sysfs_path_is_file(const char *path) { struct stat astats; - if (path == NULL) { + if (!path) { errno = EINVAL; return 1; } @@ -474,6 +288,6 @@ int sysfs_path_is_file(const char *path) } if (S_ISREG(astats.st_mode)) return 0; - + return 1; } diff --git a/udevinfo.8 b/udevinfo.8 index bbcc3d8f49..963b69aed2 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -47,10 +47,6 @@ attributes along the device chain. Useful for finding unique attributes to compose a rule. .RB Needs " \-p " specified. .TP -.B \-s -Print all sysfs devices with the major/minor number, the physical device and -the bus value. -.TP .B \-h Print help text. .SH "FILES" diff --git a/udevinfo.c b/udevinfo.c index e9de6e5e09..a4c17da3f0 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -49,26 +49,13 @@ void log_message (int level, const char *format, ...) } #endif -static int print_all_attributes(const char *path) +static void print_all_attributes(struct dlist *attr_list) { - struct dlist *attributes; struct sysfs_attribute *attr; - struct sysfs_directory *sysfs_dir; char value[SYSFS_VALUE_SIZE]; int len; - int retval = 0; - - sysfs_dir = sysfs_open_directory(path); - if (sysfs_dir == NULL) - return -1; - - attributes = sysfs_get_dir_attributes(sysfs_dir); - if (attributes == NULL) { - retval = -1; - goto exit; - } - dlist_for_each_data(attributes, attr, struct sysfs_attribute) { + dlist_for_each_data(attr_list, attr, struct sysfs_attribute) { if (attr->value != NULL) { strfieldcpy(value, attr->value); len = strlen(value); @@ -92,11 +79,6 @@ static int print_all_attributes(const char *path) } } printf("\n"); - -exit: - sysfs_close_directory(sysfs_dir); - - return retval; } static int print_record(struct udevice *udev) @@ -123,6 +105,7 @@ static int print_device_chain(const char *path) struct sysfs_attribute *attr; struct sysfs_device *sysfs_dev; struct sysfs_device *sysfs_dev_parent; + struct dlist *attr_list; int retval = 0; /* get the class dev */ @@ -147,11 +130,14 @@ static int print_device_chain(const char *path) /* open sysfs class device directory and print all attributes */ printf(" looking at class device '%s':\n", class_dev->path); printf(" SUBSYSTEM=\"%s\"\n", class_dev->classname); - if (print_all_attributes(class_dev->path) != 0) { + + attr_list = sysfs_get_classdev_attributes(class_dev); + if (attr_list == NULL) { printf("couldn't open class device directory\n"); retval = -1; goto exit; } + print_all_attributes(attr_list); /* get the device link (if parent exists look here) */ class_dev_parent = sysfs_get_classdev_parent(class_dev); @@ -165,13 +151,20 @@ static int print_device_chain(const char *path) /* look the device chain upwards */ while (sysfs_dev != NULL) { + attr_list = sysfs_get_device_attributes(sysfs_dev); + if (attr_list == NULL) { + printf("couldn't open device directory\n"); + retval = -1; + goto exit; + } + printf(" looking at the device chain at '%s':\n", sysfs_dev->path); printf(" BUS=\"%s\"\n", sysfs_dev->bus); printf(" ID=\"%s\"\n", sysfs_dev->bus_id); printf(" DRIVER=\"%s\"\n", sysfs_dev->driver_name); /* open sysfs device directory and print all attributes */ - print_all_attributes(sysfs_dev->path); + print_all_attributes(attr_list); sysfs_dev_parent = sysfs_get_device_parent(sysfs_dev); if (sysfs_dev_parent == NULL) @@ -185,65 +178,9 @@ exit: return retval; } -/* print all class/main block devices with major/minor, physical device, driver and bus */ -static int print_sysfs_devices(void) -{ - struct dlist *subsyslist; - char *class; - - subsyslist = sysfs_open_subsystem_list("class"); - if (!subsyslist) - return -1; - - dlist_for_each_data(subsyslist, class, char) { - struct sysfs_class *cls; - struct dlist *class_devices; - struct sysfs_class_device *class_dev; - struct sysfs_device *phys_dev; - unsigned int major, minor; - - cls = sysfs_open_class(class); - if (!cls) - continue; - - class_devices = sysfs_get_class_devices(cls); - if (!class_devices) - continue; - - dlist_for_each_data(class_devices, class_dev, struct sysfs_class_device) { - struct sysfs_attribute *attr; - - printf("\n"); - printf("DEVPATH '%s'\n", class_dev->path); - printf("SUBSYSTEM '%s'\n", class_dev->classname); - - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr) { - sscanf(attr->value, "%u:%u", &major, &minor); - printf("MAJOR %u\n", major); - printf("MINOR %u\n", minor); - } - - phys_dev = sysfs_get_classdev_device(class_dev); - if (phys_dev) { - printf("PHYSDEVPATH '%s'\n", phys_dev->path); - if (phys_dev->bus[0] != '\0') - printf("PHYSDEVBUS '%s'\n", phys_dev->bus); - - if (phys_dev->driver_name[0] != '\0') - printf("PHYSDEVDRIVER '%s'\n", phys_dev->driver_name); - } - } - sysfs_close_class(cls); - } - sysfs_close_list(subsyslist); - - return 0; -} - static int process_options(int argc, char *argv[]) { - static const char short_options[] = "an:p:q:rsVh"; + static const char short_options[] = "an:p:q:rVh"; int option; int retval = 1; struct udevice udev; @@ -304,10 +241,6 @@ static int process_options(int argc, char *argv[]) root = 1; break; - case 's': - print_sysfs_devices(); - exit(0); - case 'a': attributes = 1; break; -- cgit v1.2.3-54-g00ecf From 833aa0fab572536ebb680cc54bf95c50c3b36a0f Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 24 Feb 2005 19:54:47 +0100 Subject: [PATCH] klibc v0.199 --- klibc/MCONFIG | 5 +++ klibc/include/arch/parisc/klibc/archsetjmp.h | 14 ++++++++ klibc/klibc.spec | 2 +- klibc/klibc/arch/alpha/MCONFIG | 2 +- klibc/klibc/arch/arm/MCONFIG | 2 +- klibc/klibc/arch/ia64/MCONFIG | 2 +- klibc/klibc/arch/ia64/setjmp.S | 2 ++ klibc/klibc/arch/ia64/vfork.S | 3 +- klibc/klibc/arch/m32r/MCONFIG | 2 +- klibc/klibc/arch/mips/MCONFIG | 2 +- klibc/klibc/arch/mips64/MCONFIG | 2 +- klibc/klibc/arch/parisc/setjmp.S | 2 +- klibc/klibc/arch/parisc/sysstub.ph | 1 - klibc/klibc/arch/ppc/MCONFIG | 2 +- klibc/klibc/arch/ppc64/MCONFIG | 2 +- klibc/klibc/arch/s390/MCONFIG | 2 +- klibc/klibc/arch/s390x/MCONFIG | 2 +- klibc/klibc/arch/sparc/MCONFIG | 2 +- klibc/klibc/arch/sparc64/MCONFIG | 2 +- klibc/klibc/arch/sparc64/crt0.S | 2 +- klibc/klibc/memmem.c | 54 ++++++++++++++++------------ klibc/klibc/strncat.c | 1 - klibc/version | 2 +- 23 files changed, 70 insertions(+), 42 deletions(-) create mode 100644 klibc/include/arch/parisc/klibc/archsetjmp.h diff --git a/klibc/MCONFIG b/klibc/MCONFIG index 7da150d031..3fae2898c6 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -62,5 +62,10 @@ ERRLIST = 1 # include $(KLIBSRC)/arch/$(ARCH)/MCONFIG +ifeq ($(DEBUG),y) +STRIP = /bin/true -Since_we_are_debugging +OPTFLAGS += -O1 -g +endif + # How to tell the linker main() is the entrypoint EMAIN ?= -e main diff --git a/klibc/include/arch/parisc/klibc/archsetjmp.h b/klibc/include/arch/parisc/klibc/archsetjmp.h new file mode 100644 index 0000000000..e7444983ed --- /dev/null +++ b/klibc/include/arch/parisc/klibc/archsetjmp.h @@ -0,0 +1,14 @@ +/* + * arch/parisc/include/klibc/archsetjmp.h + */ + +#ifndef _KLIBC_ARCHSETJMP_H +#define _KLIBC_ARCHSETJMP_H + +struct __jmp_buf { + double regs[21]; +}; + +typedef struct __jmp_buf jmp_buf[1]; + +#endif /* _SETJMP_H */ diff --git a/klibc/klibc.spec b/klibc/klibc.spec index 02131c7f25..de0a14cf63 100644 --- a/klibc/klibc.spec +++ b/klibc/klibc.spec @@ -1,6 +1,6 @@ Summary: A minimal libc subset for use with initramfs. Name: klibc -Version: 0.198 +Version: 0.199 Release: 1 License: BSD/GPL Group: Development/Libraries diff --git a/klibc/klibc/arch/alpha/MCONFIG b/klibc/klibc/arch/alpha/MCONFIG index 5987ed5841..d7ab6c0b82 100644 --- a/klibc/klibc/arch/alpha/MCONFIG +++ b/klibc/klibc/arch/alpha/MCONFIG @@ -5,7 +5,7 @@ # Build configuration for this architecture # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/arm/MCONFIG b/klibc/klibc/arch/arm/MCONFIG index 6fbea32903..fe26b996a7 100644 --- a/klibc/klibc/arch/arm/MCONFIG +++ b/klibc/klibc/arch/arm/MCONFIG @@ -11,7 +11,7 @@ THUMB = n CPU_ARCH := armv4 CPU_TUNE := strongarm -OPTFLAGS = -Os -fomit-frame-pointer -march=$(CPU_ARCH) -mtune=$(CPU_TUNE) +OPTFLAGS = -Os -march=$(CPU_ARCH) -mtune=$(CPU_TUNE) BITSIZE = 32 ifeq ($(THUMB),y) diff --git a/klibc/klibc/arch/ia64/MCONFIG b/klibc/klibc/arch/ia64/MCONFIG index 631a478e4f..36b30ffb81 100644 --- a/klibc/klibc/arch/ia64/MCONFIG +++ b/klibc/klibc/arch/ia64/MCONFIG @@ -7,5 +7,5 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 diff --git a/klibc/klibc/arch/ia64/setjmp.S b/klibc/klibc/arch/ia64/setjmp.S index 50f91dc1d6..7859ba4143 100644 --- a/klibc/klibc/arch/ia64/setjmp.S +++ b/klibc/klibc/arch/ia64/setjmp.S @@ -61,6 +61,7 @@ // .align 32 .global setjmp + .proc setjmp setjmp: // // Make sure buffer is aligned at 16byte boundary @@ -190,6 +191,7 @@ setjmp: .align 32 .global longjmp + .proc longjmp longjmp: // // Make sure buffer is aligned at 16byte boundary diff --git a/klibc/klibc/arch/ia64/vfork.S b/klibc/klibc/arch/ia64/vfork.S index efcd03f7f1..f79bdc8234 100644 --- a/klibc/klibc/arch/ia64/vfork.S +++ b/klibc/klibc/arch/ia64/vfork.S @@ -19,6 +19,7 @@ /* pid_t vfork(void) */ /* Implemented as clone(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ + .align 32 .proc vfork .global vfork vfork: @@ -38,4 +39,4 @@ vfork: ;; (p7) mov r8=-1 br.ret.sptk.many b0 - .endp + .endp vfork diff --git a/klibc/klibc/arch/m32r/MCONFIG b/klibc/klibc/arch/m32r/MCONFIG index 6706d9ddc1..2673090fce 100644 --- a/klibc/klibc/arch/m32r/MCONFIG +++ b/klibc/klibc/arch/m32r/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/mips/MCONFIG b/klibc/klibc/arch/mips/MCONFIG index a248973815..0a98918987 100644 --- a/klibc/klibc/arch/mips/MCONFIG +++ b/klibc/klibc/arch/mips/MCONFIG @@ -8,7 +8,7 @@ # ARCHREQFLAGS = -fno-pic -mno-abicalls -G 0 -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/mips64/MCONFIG b/klibc/klibc/arch/mips64/MCONFIG index 6a817e54b6..66405e4373 100644 --- a/klibc/klibc/arch/mips64/MCONFIG +++ b/klibc/klibc/arch/mips64/MCONFIG @@ -7,5 +7,5 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 diff --git a/klibc/klibc/arch/parisc/setjmp.S b/klibc/klibc/arch/parisc/setjmp.S index 51b2b1a58b..aebe03a5ed 100644 --- a/klibc/klibc/arch/parisc/setjmp.S +++ b/klibc/klibc/arch/parisc/setjmp.S @@ -27,7 +27,7 @@ setjmp: stw %r17,60(%r26) stw %r18,64(%r26) stw %r19,68(%r26) - stw %dp,72(%r26) + stw %r27,72(%r26) stw %r30,76(%r26) stw %rp,80(%r26) ldo 88(%r26),%r19 diff --git a/klibc/klibc/arch/parisc/sysstub.ph b/klibc/klibc/arch/parisc/sysstub.ph index eb6b5dd92a..63b5e17fcf 100644 --- a/klibc/klibc/arch/parisc/sysstub.ph +++ b/klibc/klibc/arch/parisc/sysstub.ph @@ -16,7 +16,6 @@ sub make_sysstub($$$$@) { print OUT "\t.import __syscall_common, code\n"; print OUT "\t.global ${fname}\n"; print OUT "\t.export ${fname}, code\n"; - print OUT "\t.type ${fname}, @function\n"; print OUT "\t.proc\n"; print OUT "\.callinfo\n"; print OUT "${fname}:\n"; diff --git a/klibc/klibc/arch/ppc/MCONFIG b/klibc/klibc/arch/ppc/MCONFIG index ff7c44db9a..82c7107013 100644 --- a/klibc/klibc/arch/ppc/MCONFIG +++ b/klibc/klibc/arch/ppc/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/ppc64/MCONFIG b/klibc/klibc/arch/ppc64/MCONFIG index 09881b8d40..9aba2ddbb6 100644 --- a/klibc/klibc/arch/ppc64/MCONFIG +++ b/klibc/klibc/arch/ppc64/MCONFIG @@ -8,7 +8,7 @@ # ARCHREQFLAGS = -m64 -mcall-aixdesc -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 LDFLAGS = -m elf64ppc diff --git a/klibc/klibc/arch/s390/MCONFIG b/klibc/klibc/arch/s390/MCONFIG index e32c33faa1..640b395b54 100644 --- a/klibc/klibc/arch/s390/MCONFIG +++ b/klibc/klibc/arch/s390/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 SHAREDFLAGS = -Ttext 0x40000200 diff --git a/klibc/klibc/arch/s390x/MCONFIG b/klibc/klibc/arch/s390x/MCONFIG index 1c8232bed5..081a0bbb52 100644 --- a/klibc/klibc/arch/s390x/MCONFIG +++ b/klibc/klibc/arch/s390x/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 SHAREDFLAGS = -Ttext 0x40000200 diff --git a/klibc/klibc/arch/sparc/MCONFIG b/klibc/klibc/arch/sparc/MCONFIG index cb94f46c00..55f8b198c2 100644 --- a/klibc/klibc/arch/sparc/MCONFIG +++ b/klibc/klibc/arch/sparc/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 32 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/sparc64/MCONFIG b/klibc/klibc/arch/sparc64/MCONFIG index d490c63643..a8a742412e 100644 --- a/klibc/klibc/arch/sparc64/MCONFIG +++ b/klibc/klibc/arch/sparc64/MCONFIG @@ -8,7 +8,7 @@ # ARCHREQFLAGS = -m64 -mptr64 -OPTFLAGS = -Os -fomit-frame-pointer +OPTFLAGS = -Os BITSIZE = 64 LDFLAGS = -m elf64_sparc diff --git a/klibc/klibc/arch/sparc64/crt0.S b/klibc/klibc/arch/sparc64/crt0.S index 23af82ecc4..5faee7c6be 100644 --- a/klibc/klibc/arch/sparc64/crt0.S +++ b/klibc/klibc/arch/sparc64/crt0.S @@ -1,2 +1,2 @@ #define TARGET_PTR_SIZE 64 -#include "arch/sparc/crt0i.S" +#include "../sparc/crt0i.S" diff --git a/klibc/klibc/memmem.c b/klibc/klibc/memmem.c index 0f59938ffb..8b5faa0014 100644 --- a/klibc/klibc/memmem.c +++ b/klibc/klibc/memmem.c @@ -13,32 +13,40 @@ void *memmem(const void *haystack, size_t n, const void *needle, size_t m) { - const unsigned char *y = (const unsigned char *)haystack; - const unsigned char *x = (const unsigned char *)needle; + const unsigned char *y = (const unsigned char *)haystack; + const unsigned char *x = (const unsigned char *)needle; - size_t j, k, l; + size_t j, k, l; - if ( m > n ) - return NULL; + if (m > n || !m || !n) + return NULL; - if ( x[0] == x[1] ) { - k = 2; - l = 1; - } else { - k = 1; - l = 2; - } + if (1 != m) { + if (x[0] == x[1]) { + k = 2; + l = 1; + } else { + k = 1; + l = 2; + } - j = 0; - while ( j <= n-m ) { - if (x[1] != y[j+1]) { - j += k; - } else { - if ( !memcmp(x+2, y+j+2, m-2) && x[0] == y[j] ) - return (void *)&y[j]; - j += l; - } - } + j = 0; + while (j <= n - m) { + if (x[1] != y[j + 1]) { + j += k; + } else { + if (!memcmp(x + 2, y + j + 2, m - 2) + && x[0] == y[j]) + return (void *)&y[j]; + j += l; + } + } + } else + do { + if (*y == *x) + return (void *)y; + y++; + } while (--n); - return NULL; + return NULL; } diff --git a/klibc/klibc/strncat.c b/klibc/klibc/strncat.c index 4d8458d5ec..78223152c4 100644 --- a/klibc/klibc/strncat.c +++ b/klibc/klibc/strncat.c @@ -10,7 +10,6 @@ char *strncat(char *dst, const char *src, size_t n) char *q = strchr(dst, '\0'); const char *p = src; char ch; - size_t nn = q-dst; while (n--) { *q++ = ch = *p++; diff --git a/klibc/version b/klibc/version index 129efcc007..b4d2b300cd 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.198 +0.199 -- cgit v1.2.3-54-g00ecf From f8a178a35b8dee2ee46a3de298345aa4faa8f41e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 24 Feb 2005 20:13:25 +0100 Subject: [PATCH] trivial rename of some variables --- namedev.c | 2 +- udev_db.c | 2 +- udev_db.h | 2 +- udevd.c | 22 +++++++++++----------- udevd.h | 2 +- udevinfo.c | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/namedev.c b/namedev.c index a365574435..f0a5c34f79 100644 --- a/namedev.c +++ b/namedev.c @@ -152,7 +152,7 @@ static int find_free_number(struct udevice *udev, const char *name) while (1) { dbg("look for existing node '%s'", filename); memset(&db_udev, 0x00, sizeof(struct udevice)); - if (udev_db_get_device_byname(&db_udev, filename) != 0) { + if (udev_db_get_device_by_name(&db_udev, filename) != 0) { dbg("free num=%d", num); return num; } diff --git a/udev_db.c b/udev_db.c index df63bbe2ce..61d4b130d3 100644 --- a/udev_db.c +++ b/udev_db.c @@ -179,7 +179,7 @@ int udev_db_get_device_by_devpath(struct udevice *udev, const char *devpath) return parse_db_file(udev, filename); } -int udev_db_get_device_byname(struct udevice *udev, const char *name) +int udev_db_get_device_by_name(struct udevice *udev, const char *name) { struct dirent *ent; DIR *dir; diff --git a/udev_db.h b/udev_db.h index 75f1d98296..5065eaa6c6 100644 --- a/udev_db.h +++ b/udev_db.h @@ -29,6 +29,6 @@ extern int udev_db_add_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); extern int udev_db_get_device_by_devpath(struct udevice *dev, const char *devpath); -extern int udev_db_get_device_byname(struct udevice *udev, const char *name); +extern int udev_db_get_device_by_name(struct udevice *udev, const char *name); #endif /* _UDEV_DB_H_ */ diff --git a/udevd.c b/udevd.c index 7d7fd63332..bd21f15614 100644 --- a/udevd.c +++ b/udevd.c @@ -87,14 +87,14 @@ static void msg_dump_queue(void) #ifdef DEBUG struct hotplug_msg *msg; - list_for_each_entry(msg, &msg_list, list) + list_for_each_entry(msg, &msg_list, node) dbg("sequence %llu in queue", msg->seqnum); #endif } static void run_queue_delete(struct hotplug_msg *msg) { - list_del(&msg->list); + list_del(&msg->node); free(msg); } @@ -106,13 +106,13 @@ static void msg_queue_insert(struct hotplug_msg *msg) if (msg->seqnum == 0) { dbg("no SEQNUM, move straight to the exec queue"); - list_add(&msg->list, &exec_list); + list_add(&msg->node, &exec_list); run_exec_q = 1; return; } /* sort message by sequence number into list */ - list_for_each_entry_reverse(loop_msg, &msg_list, list) { + list_for_each_entry_reverse(loop_msg, &msg_list, node) { if (loop_msg->seqnum < msg->seqnum) break; @@ -126,7 +126,7 @@ static void msg_queue_insert(struct hotplug_msg *msg) sysinfo(&info); msg->queue_time = info.uptime; - list_add(&msg->list, &loop_msg->list); + list_add(&msg->node, &loop_msg->node); dbg("queued message seq %llu", msg->seqnum); /* run msg queue manager */ @@ -291,7 +291,7 @@ static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) if (msg->devpath == NULL) return NULL; - list_for_each_entry(loop_msg, &running_list, list) { + list_for_each_entry(loop_msg, &running_list, node) { if (loop_msg->devpath == NULL) continue; @@ -321,7 +321,7 @@ static void exec_queue_manager(void) if (running < 0) running = THROTTLE_MAX_RUNNING_CHILDS; - list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, list) { + list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, node) { /* check running processes in our session and possibly throttle */ if (running >= THROTTLE_MAX_RUNNING_CHILDS) { running = running_processes_in_session(sid, THROTTLE_MAX_RUNNING_CHILDS+10); @@ -335,7 +335,7 @@ static void exec_queue_manager(void) msg = running_with_devpath(loop_msg); if (!msg) { /* move event to run list */ - list_move_tail(&loop_msg->list, &running_list); + list_move_tail(&loop_msg->node, &running_list); udev_run(loop_msg); running++; dbg("moved seq %llu to running list", loop_msg->seqnum); @@ -348,7 +348,7 @@ static void exec_queue_manager(void) static void msg_move_exec(struct hotplug_msg *msg) { - list_move_tail(&msg->list, &exec_list); + list_move_tail(&msg->node, &exec_list); run_exec_q = 1; expected_seqnum = msg->seqnum+1; dbg("moved seq %llu to exec, next expected is %llu", @@ -367,7 +367,7 @@ static void msg_queue_manager(void) dbg("msg queue manager, next expected is %llu", expected_seqnum); recheck: - list_for_each_entry_safe(loop_msg, tmp_msg, &msg_list, list) { + list_for_each_entry_safe(loop_msg, tmp_msg, &msg_list, node) { /* move event with expected sequence to the exec list */ if (loop_msg->seqnum == expected_seqnum) { msg_move_exec(loop_msg); @@ -532,7 +532,7 @@ static void udev_done(int pid) /* find msg associated with pid and delete it */ struct hotplug_msg *msg; - list_for_each_entry(msg, &running_list, list) { + list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { dbg("<== exec seq %llu came back", msg->seqnum); run_queue_delete(msg); diff --git a/udevd.h b/udevd.h index ae1d20e5ec..64e1d6ad12 100644 --- a/udevd.h +++ b/udevd.h @@ -52,7 +52,7 @@ struct udevsend_msg { }; struct hotplug_msg { - struct list_head list; + struct list_head node; pid_t pid; long queue_time; char *action; diff --git a/udevinfo.c b/udevinfo.c index a4c17da3f0..e7417697cf 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -293,7 +293,7 @@ static int process_options(int argc, char *argv[]) memset(&udev, 0x00, sizeof(struct udevice)); strfieldcpy(udev.name, pos); - retval = udev_db_get_device_byname(&udev, pos); + retval = udev_db_get_device_by_name(&udev, pos); if (retval != 0) { printf("device not found in database\n"); goto exit; -- cgit v1.2.3-54-g00ecf From 9fe1a96d88b304af5f3315197800f6b3d16675e1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 25 Feb 2005 07:40:14 +0100 Subject: [PATCH] udevinfo: print devpath -> node relationship for all devices --- udev_db.c | 35 +++++++++++++++++++++++++++++++++++ udev_db.h | 1 + udevinfo.8 | 4 ++++ udevinfo.c | 14 ++++++++++++-- 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/udev_db.c b/udev_db.c index 61d4b130d3..4515998fcd 100644 --- a/udev_db.c +++ b/udev_db.c @@ -239,3 +239,38 @@ found: return 0; } + +int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)) +{ + struct dirent *ent; + DIR *dir; + char filename[NAME_SIZE]; + struct udevice db_udev; + + dir = opendir(udev_db_path); + if (dir == NULL) { + dbg("unable to udev db '%s'", udev_db_path); + return -1; + } + + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + + if (ent->d_name[0] == '.') + continue; + + snprintf(filename, NAME_SIZE, "%s/%s", udev_db_path, ent->d_name); + filename[NAME_SIZE-1] = '\0'; + + memset(&db_udev, 0x00, sizeof(struct udevice)); + if (parse_db_file(&db_udev, filename) == 0) { + if (handler_function(&db_udev) != 0) + break; + } + } + + closedir(dir); + return 0; +} diff --git a/udev_db.h b/udev_db.h index 5065eaa6c6..6a0647f200 100644 --- a/udev_db.h +++ b/udev_db.h @@ -30,5 +30,6 @@ extern int udev_db_delete_device(struct udevice *dev); extern int udev_db_get_device_by_devpath(struct udevice *dev, const char *devpath); extern int udev_db_get_device_by_name(struct udevice *udev, const char *name); +extern int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)); #endif /* _UDEV_DB_H_ */ diff --git a/udevinfo.8 b/udevinfo.8 index 963b69aed2..ac8cc7fda5 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -47,6 +47,10 @@ attributes along the device chain. Useful for finding unique attributes to compose a rule. .RB Needs " \-p " specified. .TP +.B \-d +Print the relationship between the devpath and the node name for all devices +currently available in the database. +.TP .B \-h Print help text. .SH "FILES" diff --git a/udevinfo.c b/udevinfo.c index e7417697cf..045395256d 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -178,9 +178,14 @@ exit: return retval; } +static int print_dump(struct udevice *udev) { + printf("%s:%s/%s\n", udev->devpath, udev_root, udev->name); + return 0; +} + static int process_options(int argc, char *argv[]) { - static const char short_options[] = "an:p:q:rVh"; + static const char short_options[] = "adn:p:q:rVh"; int option; int retval = 1; struct udevice udev; @@ -245,6 +250,10 @@ static int process_options(int argc, char *argv[]) attributes = 1; break; + case 'd': + udev_db_call_foreach(print_dump); + exit(0); + case 'V': printf("udevinfo, version %s\n", UDEV_VERSION); exit(0); @@ -384,7 +393,8 @@ help: "\n" " -r print udev root\n" " -a print all SYSFS_attributes along the device chain\n" - " -s print all sysfs devices with major/minor, physical device and bus\n" + " -d print the relationship of devpath and the node name for all\n" + " devices available in the database\n" " -V print udev version\n" " -h print this help text\n" "\n"); -- cgit v1.2.3-54-g00ecf From 9c020c60165997be842948d11f51ce6dd6b9b745 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 26 Feb 2005 01:08:44 +0100 Subject: [PATCH] wait_for_sysfs: add joydev --- udev_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 94c0164dec..8813bd5c47 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -172,6 +172,7 @@ static int class_device_expect_no_device_link(struct sysfs_class_device *class_d { .subsystem = "input", .device = "mice" }, { .subsystem = "input", .device = "mouse" }, { .subsystem = "input", .device = "ts" }, + { .subsystem = "input", .device = "js" }, { .subsystem = "vc", .device = NULL }, { .subsystem = "tty", .device = NULL }, { .subsystem = "cpuid", .device = "cpu" }, -- cgit v1.2.3-54-g00ecf From 77313cd0d13ed3682f25c745f71f648292b28215 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 26 Feb 2005 02:52:04 +0100 Subject: [PATCH] namedev: skip backslashes only if followed by newline Fix from: Hannes Reinecke namedev_parse is a bit overzealous when in comes to handling backspaces; it always eats up backspaces regardless of anything beyond that. This means it is impossible to enter '\t' in a rule. Quite a bit of fun when you're trying to write regexps. --- namedev_parse.c | 2 +- test/udev-test.pl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/namedev_parse.c b/namedev_parse.c index 7cd676c390..02d8a6520c 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -153,7 +153,7 @@ static int namedev_parse(const char *filename, void *data) /* skip backslash and newline from multi line rules */ for (i = j = 0; i < count; i++) { - if (bufline[i] == '\\' || bufline[i] == '\n') + if (bufline[i] == '\\' && bufline[i+1] == '\n') continue; line[j++] = bufline[i]; diff --git a/test/udev-test.pl b/test/udev-test.pl index fe7b932669..f442b162ec 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -192,6 +192,15 @@ EOF KERNEL="ttyUSB0", \\ NAME="visor" +EOF + }, + { + desc => "preserve backslashes, if they are not for a newline", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "aaa", + conf => < Date: Fri, 25 Feb 2005 23:51:17 -0800 Subject: [PATCH] update scsi_id to work with libsysfs changes Update scsi_id to work with the libsysfs changes in udev: use sysfs_get_classdev_attr and sysfs_get_device_attr in place of sysfs_read_attribute_value. --- extras/scsi_id/Makefile | 2 +- extras/scsi_id/scsi_id.c | 51 ++++++++++++++++++-------------------------- extras/scsi_id/scsi_id.h | 2 -- extras/scsi_id/scsi_serial.c | 21 ++++++++++-------- 4 files changed, 34 insertions(+), 42 deletions(-) diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index e832102e30..7aa3e83470 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.8 +SCSI_ID_VERSION=0.9 prefix = etcdir = ${prefix}/etc diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 507fa27766..32a96d8adb 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -100,23 +100,13 @@ void log_message (int level, const char *format, ...) return; } -int sysfs_get_attr(const char *devpath, const char *attr, char *value, - size_t bufsize) +static int get_major_minor(struct sysfs_class_device *class_dev, int *maj, + int *min) { - char attr_path[SYSFS_PATH_MAX]; + struct sysfs_attribute *dev_attr; - strncpy(attr_path, devpath, SYSFS_PATH_MAX); - strncat(attr_path, "/", SYSFS_PATH_MAX); - strncat(attr_path, attr, SYSFS_PATH_MAX); - dprintf("%s\n", attr_path); - return sysfs_read_attribute_value(attr_path, value, SYSFS_NAME_LEN); -} - -static int get_major_minor(const char *devpath, int *maj, int *min) -{ - char dev_value[MAX_ATTR_LEN]; - - if (sysfs_get_attr(devpath, "dev", dev_value, MAX_ATTR_LEN)) { + dev_attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (!dev_attr) { /* * XXX This happens a lot, since sg has no dev attr. * And now sysfsutils does not set a meaningful errno @@ -125,27 +115,28 @@ static int get_major_minor(const char *devpath, int *maj, int *min) * it separately. */ log_message(LOG_DEBUG, "%s: could not get dev attribute: %s\n", - devpath, strerror(errno)); + class_dev->name, strerror(errno)); return -1; } - dprintf("dev value %s", dev_value); /* dev_value has a trailing \n */ - if (sscanf(dev_value, "%u:%u", maj, min) != 2) { + dprintf("dev value %s", dev_attr->value); /* value has a trailing \n */ + if (sscanf(dev_attr->value, "%u:%u", maj, min) != 2) { log_message(LOG_WARNING, "%s: invalid dev major/minor\n", - devpath); + class_dev->name); return -1; } return 0; } -static int create_tmp_dev(const char *devpath, char *tmpdev, int dev_type) +static int create_tmp_dev(struct sysfs_class_device *class_dev, char *tmpdev, + int dev_type) { int maj, min; - dprintf("(%s)\n", devpath); + dprintf("(%s)\n", class_dev->name); - if (get_major_minor(devpath, &maj, &min)) + if (get_major_minor(class_dev, &maj, &min)) return -1; snprintf(tmpdev, MAX_NAME_LEN, "%s/%s-maj%d-min%d-%u", TMP_DIR, TMP_PREFIX, maj, min, getpid()); @@ -500,8 +491,7 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, int retval; int newargc; char **newargv = NULL; - char vendor[MAX_ATTR_LEN]; - char model[MAX_ATTR_LEN]; + struct sysfs_attribute *vendor, *model; int option; *good_bad = all_good; @@ -511,19 +501,22 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, else callout[0] = '\0'; - if (sysfs_get_attr(scsi_dev->path, "vendor", vendor, MAX_ATTR_LEN)) { + vendor = sysfs_get_device_attr(scsi_dev, "vendor"); + if (!vendor) { log_message(LOG_WARNING, "%s: cannot get vendor attribute\n", scsi_dev->name); return -1; } - if (sysfs_get_attr(scsi_dev->path, "model", model, MAX_ATTR_LEN)) { + model = sysfs_get_device_attr(scsi_dev, "model"); + if (!model) { log_message(LOG_WARNING, "%s: cannot get model attribute\n", scsi_dev->name); return -1; } - retval = get_file_options(vendor, model, &newargc, &newargv); + retval = get_file_options(vendor->value, model->value, &newargc, + &newargv); optind = 1; /* reset this global extern */ while (retval == 0) { @@ -694,10 +687,8 @@ static int scsi_id(const char *target_path, char *maj_min_dev) /* * mknod a temp dev to communicate with the device. - * - * XXX pass down class_dev or class_dev_parent. */ - if (!dev_specified && create_tmp_dev(target_path, maj_min_dev, + if (!dev_specified && create_tmp_dev(class_dev, maj_min_dev, dev_type)) { dprintf("create_tmp_dev failed\n"); return 1; diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 0ca7cd4206..74b449e984 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -44,8 +44,6 @@ */ #define MAX_BUFFER_LEN 256 -extern int sysfs_get_attr(const char *devpath, const char *attr, char *value, - size_t bufsize); extern int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, int page_code, char *serial, int len); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 8b9fbe0681..20a7928553 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -364,7 +364,7 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, char *buffer, int len) { int retval; - char vendor[MAX_ATTR_LEN]; + struct sysfs_attribute *vendor; memset(buffer, 0, len); retval = scsi_inquiry(scsi_dev, fd, 1, 0x0, buffer, len); @@ -394,14 +394,15 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, * If the vendor id appears in the page assume the page is * invalid. */ - if (sysfs_get_attr(scsi_dev->path, "vendor", vendor, - MAX_ATTR_LEN)) { + vendor = sysfs_get_device_attr(scsi_dev, "vendor"); + if (!vendor) { log_message(LOG_WARNING, "%s: cannot get model attribute\n", scsi_dev->name); return 1; } - if (!strncmp(&buffer[VENDOR_LENGTH], vendor, VENDOR_LENGTH)) { + if (!strncmp(&buffer[VENDOR_LENGTH], vendor->value, + VENDOR_LENGTH)) { log_message(LOG_WARNING, "%s: invalid page0 data\n", scsi_dev->name); return 1; @@ -416,15 +417,16 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, */ static int prepend_vendor_model(struct sysfs_device *scsi_dev, char *serial) { - char attr[MAX_ATTR_LEN]; + struct sysfs_attribute *attr; int ind; - if (sysfs_get_attr(scsi_dev->path, "vendor", attr, MAX_ATTR_LEN)) { + attr = sysfs_get_device_attr(scsi_dev, "vendor"); + if (!attr) { log_message(LOG_WARNING, "%s: cannot get vendor attribute\n", scsi_dev->name); return 1; } - strncpy(serial, attr, VENDOR_LENGTH); + strncpy(serial, attr->value, VENDOR_LENGTH); ind = strlen(serial) - 1; /* * Remove sysfs added newlines. @@ -432,12 +434,13 @@ static int prepend_vendor_model(struct sysfs_device *scsi_dev, char *serial) if (serial[ind] == '\n') serial[ind] = '\0'; - if (sysfs_get_attr(scsi_dev->path, "model", attr, MAX_ATTR_LEN)) { + attr = sysfs_get_device_attr(scsi_dev, "model"); + if (!attr) { log_message(LOG_WARNING, "%s: cannot get model attribute\n", scsi_dev->name); return 1; } - strncat(serial, attr, MODEL_LENGTH); + strncat(serial, attr->value, MODEL_LENGTH); ind = strlen(serial) - 1; if (serial[ind] == '\n') serial[ind] = '\0'; -- cgit v1.2.3-54-g00ecf From 6d7a6d08c2386611e4ccb62ce660ceb53b1bf79f Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Sat, 26 Feb 2005 03:14:42 -0800 Subject: [PATCH] 054 release --- ChangeLog | 32 ++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68fc6ff2e6..472df80dbc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +Summary of changes from v053 to v054 +============================================ + +: + o udev_volume_id: add Reiser4 support + +Kay Sievers: + o namedev: skip backslashes only if followed by newline + o wait_for_sysfs: add joydev + o udevinfo: print devpath -> node relationship for all devices + o trivial rename of some variables + o klibc v0.199 + o big libsysfs diet (pre 2.0 version) + o udev_volume_id: volume_id v35 + o add "serio" to bus list + o determine device type in udev_init_device() + o move kernel name/number evaluation into udev_init_device() + o detect NAME="" as ignore_device rule + o trivial namedev cleanup + o cleanup db functions + o clean up match_place() + o switch device type to enum + o switch major/minor to dev_t + o remove the device node only if the major/minor number matches + o libsysfs: work around a klibc bug + o introduce OPTIONS=ignore_device, ignore_remove, all_partitions" key + o namedev: execute PROGRAM only once and not possibly for every physical device + +Patrick Mansfield: + o update scsi_id to work with libsysfs changes + + Summary of changes from v052 to v053 ============================================ diff --git a/Makefile b/Makefile index c2d35f7734..99a7618795 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 053 +VERSION = 054 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index f9dc8f3004..32aca6196f 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 053 +Version: 054 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From e5f053b5312a0f8d62a2bcff8ddb095052d228bc Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 4 Mar 2005 04:26:44 +0100 Subject: [PATCH] klibc: update v0.205 --- klibc/MCONFIG | 24 +- klibc/Makefile | 54 +- klibc/include/arch/x86_64/klibc/archsignal.h | 6 +- klibc/include/bits32/bitsize.h | 3 + klibc/include/bits64/bitsize.h | 3 + klibc/include/signal.h | 11 + klibc/include/sys/select.h | 1 + klibc/include/sys/vfs.h | 7 +- klibc/klcc.1 | 81 ++ klibc/klcc.in | 207 ++++ klibc/klibc.spec | 143 +-- klibc/klibc.spec.in | 141 +-- klibc/klibc/MCONFIG | 2 + klibc/klibc/Makefile | 21 +- klibc/klibc/SYSCALLS.def | 4 +- klibc/klibc/arch/i386/MCONFIG | 4 +- klibc/klibc/include/sys/times.h | 14 - klibc/klibc/llseek.c | 3 +- klibc/klibc/mmap.c | 14 +- klibc/klibc/tests/rtsig.c | 12 + klibc/klibc/zlib/FAQ | 315 ++++++ klibc/klibc/zlib/INDEX | 48 + klibc/klibc/zlib/README | 126 +++ klibc/klibc/zlib/adler32.c | 74 ++ klibc/klibc/zlib/algorithm.txt | 209 ++++ klibc/klibc/zlib/compress.c | 79 ++ klibc/klibc/zlib/crc32.c | 311 ++++++ klibc/klibc/zlib/crc32.h | 441 ++++++++ klibc/klibc/zlib/deflate.c | 1502 ++++++++++++++++++++++++++ klibc/klibc/zlib/deflate.h | 326 ++++++ klibc/klibc/zlib/gzio.c | 1008 +++++++++++++++++ klibc/klibc/zlib/infback.c | 619 +++++++++++ klibc/klibc/zlib/inffast.c | 305 ++++++ klibc/klibc/zlib/inffast.h | 11 + klibc/klibc/zlib/inffixed.h | 94 ++ klibc/klibc/zlib/inflate.c | 1270 ++++++++++++++++++++++ klibc/klibc/zlib/inflate.h | 117 ++ klibc/klibc/zlib/inftrees.c | 321 ++++++ klibc/klibc/zlib/inftrees.h | 55 + klibc/klibc/zlib/trees.c | 1215 +++++++++++++++++++++ klibc/klibc/zlib/trees.h | 128 +++ klibc/klibc/zlib/uncompr.c | 61 ++ klibc/klibc/zlib/zconf.h | 323 ++++++ klibc/klibc/zlib/zconf.in.h | 323 ++++++ klibc/klibc/zlib/zlib.3 | 159 +++ klibc/klibc/zlib/zlib.h | 1200 ++++++++++++++++++++ klibc/klibc/zlib/zutil.c | 319 ++++++ klibc/klibc/zlib/zutil.h | 258 +++++ klibc/makeklcc.pl | 36 + klibc/version | 2 +- 50 files changed, 11773 insertions(+), 237 deletions(-) create mode 100644 klibc/include/bits32/bitsize.h create mode 100644 klibc/include/bits64/bitsize.h create mode 100644 klibc/klcc.1 create mode 100644 klibc/klcc.in delete mode 100644 klibc/klibc/include/sys/times.h create mode 100644 klibc/klibc/tests/rtsig.c create mode 100644 klibc/klibc/zlib/FAQ create mode 100644 klibc/klibc/zlib/INDEX create mode 100644 klibc/klibc/zlib/README create mode 100644 klibc/klibc/zlib/adler32.c create mode 100644 klibc/klibc/zlib/algorithm.txt create mode 100644 klibc/klibc/zlib/compress.c create mode 100644 klibc/klibc/zlib/crc32.c create mode 100644 klibc/klibc/zlib/crc32.h create mode 100644 klibc/klibc/zlib/deflate.c create mode 100644 klibc/klibc/zlib/deflate.h create mode 100644 klibc/klibc/zlib/gzio.c create mode 100644 klibc/klibc/zlib/infback.c create mode 100644 klibc/klibc/zlib/inffast.c create mode 100644 klibc/klibc/zlib/inffast.h create mode 100644 klibc/klibc/zlib/inffixed.h create mode 100644 klibc/klibc/zlib/inflate.c create mode 100644 klibc/klibc/zlib/inflate.h create mode 100644 klibc/klibc/zlib/inftrees.c create mode 100644 klibc/klibc/zlib/inftrees.h create mode 100644 klibc/klibc/zlib/trees.c create mode 100644 klibc/klibc/zlib/trees.h create mode 100644 klibc/klibc/zlib/uncompr.c create mode 100644 klibc/klibc/zlib/zconf.h create mode 100644 klibc/klibc/zlib/zconf.in.h create mode 100644 klibc/klibc/zlib/zlib.3 create mode 100644 klibc/klibc/zlib/zlib.h create mode 100644 klibc/klibc/zlib/zutil.c create mode 100644 klibc/klibc/zlib/zutil.h create mode 100644 klibc/makeklcc.pl diff --git a/klibc/MCONFIG b/klibc/MCONFIG index 3fae2898c6..a7b2cb1bf3 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -3,6 +3,17 @@ # Makefile configuration, without explicit rules # +# Location for installation +prefix = /usr +bindir = $(prefix)/bin +libdir = $(prefix)/lib +mandir = $(prefix)/man +INSTALLDIR = $(prefix)/lib/klibc +INSTALLROOT = + +INSTALL_EXEC = install -m 755 +INSTALL_DATA = install -m 644 + # Eventually support separate compilation, but we don't have it yet... OBJROOT = $(SRCROOT) @@ -20,17 +31,19 @@ INCLUDE = -I$(SRCROOT)/include/arch/$(ARCH) \ -I$(SRCROOT)/include/bits$(BITSIZE) \ -I$(SRCROOT)/include \ -I$(KRNLOBJ)/include -I$(KRNLOBJ)/include2 -I$(KRNLSRC)/include -REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include \ - -D__KLIBC__ -DBITSIZE=$(BITSIZE) \ - $(INCLUDE) +REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include -D__KLIBC__ \ + $(INCLUDE) LDFLAGS = AR = $(CROSS)ar RANLIB = $(CROSS)ranlib NM = $(CROSS)nm PERL = perl -STRIP = $(CROSS)strip --strip-all -R .comment -R .note OBJCOPY = $(CROSS)objcopy +STRIP = $(CROSS)strip +STRIPFLAGS = --strip-all -R .comment -R .note +STRIPCMD = $(STRIP) $(STRIPFLAGS) + HOST_CC = gcc HOST_CFLAGS = -g -O HOST_LDFLAGS = @@ -57,6 +70,9 @@ SHLIBDIR = /lib # about 4K bigger. ERRLIST = 1 +# Include zlib in klibc. This roughly triples the size of klibc! +ZLIB = 0 + # # Include arch-specific rule fragments # diff --git a/klibc/Makefile b/klibc/Makefile index 2506417ef5..eb8f55570d 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -1,5 +1,6 @@ VERSION := $(shell cat version) SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip +SRCROOT = . all: @@ -12,12 +13,55 @@ klibc.spec: klibc.spec.in version rpm: klibc.spec +$(rpmbuild) -bb klibc.spec --target=$(ARCH) -%: - @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done +$(CROSS)klibc.config: Makefile + rm -f $@ + echo 'ARCH=$(ARCH)' >> $@ + echo 'CROSS=$(CROSS)' >> $@ + echo "CC=$(shell bash -c 'type -p $(CC)')" >> $@ + echo "LD=$(shell bash -c 'type -p $(LD)')" >> $@ + echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@ + echo 'OPTFLAGS=$(OPTFLAGS)' >> $@ + echo 'LDFLAGS=$(LDFLAGS)' >> $@ + echo "STRIP=$(shell bash -c 'type -p $(STRIP)')" >> $@ + echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@ + echo 'EMAIN=$(EMAIN)' >> $@ + echo 'BITSIZE=$(BITSIZE)' >> $@ + echo 'INSTALLDIR=$(INSTALLDIR)' >> $@ -clean: - @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done +$(CROSS)klcc: klcc.in $(CROSS)klibc.config makeklcc.pl + $(PERL) makeklcc.pl klcc.in $(CROSS)klibc.config \ + $(shell bash -c 'type -p $(PERL)') > $@ || ( rm -f $@ ; exit 1 ) + chmod a+x $@ -spotless: +%: local-% @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done + +local-all: $(CROSS)klcc + +local-clean: + rm -f klibc.config klcc + +local-spotless: rm -f klibc.spec *~ tags + +local-install: $(CROSS)klcc + mkdir -p $(INSTALLROOT)$(bindir) + mkdir -p $(INSTALLROOT)$(mandir)/man1 + mkdir -p $(INSTALLROOT)$(SHLIBDIR) + mkdir -p $(INSTALLROOT)$(INSTALLDIR) + -rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin + set -xe ; for d in linux asm asm-generic ; do \ + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \ + cp -rfL $(KRNLSRC)/include/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ + cp -rfL $(KRNLOBJ)/include/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ + [ ! -d $(KRNLOBJ)/include2/$$d ] || \ + cp -rfL $(KRNLOBJ)/include2/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ + done + cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/. + $(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(CROSS)klcc.1 + $(INSTALL_EXEC) $(CROSS)klcc $(INSTALLROOT)$(bindir) + +-include MCONFIG diff --git a/klibc/include/arch/x86_64/klibc/archsignal.h b/klibc/include/arch/x86_64/klibc/archsignal.h index 74e82e1dd0..527241454e 100644 --- a/klibc/include/arch/x86_64/klibc/archsignal.h +++ b/klibc/include/arch/x86_64/klibc/archsignal.h @@ -8,6 +8,10 @@ #ifndef _KLIBC_ARCHSIGNAL_H #define _KLIBC_ARCHSIGNAL_H -/* No special stuff for this architecture */ +/* The x86-64 headers defines NSIG 32, but it's actually 64 */ +#undef _NSIG +#undef NSIG +#define _NSIG 64 +#define NSIG _NSIG #endif diff --git a/klibc/include/bits32/bitsize.h b/klibc/include/bits32/bitsize.h new file mode 100644 index 0000000000..06cc885983 --- /dev/null +++ b/klibc/include/bits32/bitsize.h @@ -0,0 +1,3 @@ +#ifndef _BITSIZE +#define _BITSIZE 32 +#endif diff --git a/klibc/include/bits64/bitsize.h b/klibc/include/bits64/bitsize.h new file mode 100644 index 0000000000..54696fd70e --- /dev/null +++ b/klibc/include/bits64/bitsize.h @@ -0,0 +1,3 @@ +#ifndef _BITSIZE +#define _BITSIZE 64 +#endif diff --git a/klibc/include/signal.h b/klibc/include/signal.h index 1b439077f2..e78318f5f7 100644 --- a/klibc/include/signal.h +++ b/klibc/include/signal.h @@ -27,9 +27,20 @@ typedef int sig_atomic_t; #ifndef SA_NODEFER # define SA_NODEFER SA_NOMASK #endif +/* Some architectures define NSIG and not _NSIG or vice versa */ #ifndef NSIG # define NSIG _NSIG #endif +#ifndef _NSIG +# define _NSIG NSIG +#endif + +/* If we don't have any real-time signals available to userspace, + hide them all */ +#if SIGRTMAX <= SIGRTMIN +# undef SIGRTMIN +# undef SIGRTMAX +#endif __extern const char * const sys_siglist[]; diff --git a/klibc/include/sys/select.h b/klibc/include/sys/select.h index 7caf8c931b..361a1a53b0 100644 --- a/klibc/include/sys/select.h +++ b/klibc/include/sys/select.h @@ -5,6 +5,7 @@ #ifndef _SYS_SELECT_H #define _SYS_SELECT_H +#include #include #include diff --git a/klibc/include/sys/vfs.h b/klibc/include/sys/vfs.h index b60d1a572f..cf5aaf9107 100644 --- a/klibc/include/sys/vfs.h +++ b/klibc/include/sys/vfs.h @@ -8,11 +8,12 @@ #include #include #include +#include /* struct statfs64 -- there seems to be two standards - one for 32 and one for 64 bits, and they're incompatible... */ -#if BITSIZE == 32 || defined(__s390__) +#if _BITSIZE == 32 || defined(__s390__) struct statfs { uint32_t f_type; @@ -28,7 +29,7 @@ struct statfs { uint32_t f_spare[5]; }; -#else /* BITSIZE == 64 */ +#else /* _BITSIZE == 64 */ struct statfs { uint64_t f_type; @@ -44,7 +45,7 @@ struct statfs { uint64_t f_spare[5]; }; -#endif /* BITSIZE */ +#endif /* _BITSIZE */ __extern int statfs(const char *, struct statfs *); __extern int fstatfs(int, struct statfs *); diff --git a/klibc/klcc.1 b/klibc/klcc.1 new file mode 100644 index 0000000000..a6f979c6c4 --- /dev/null +++ b/klibc/klcc.1 @@ -0,0 +1,81 @@ +.\" $Id: klcc.1,v 1.2 2005/03/02 02:24:17 hpa Exp $ +.\" ----------------------------------------------------------------------- +.\" +.\" Copyright 2005 H. Peter Anvin - All Rights Reserved +.\" +.\" Permission is hereby granted, free of charge, to any person +.\" obtaining a copy of this software and associated documentation +.\" files (the "Software"), to deal in the Software without +.\" restriction, including without limitation the rights to use, +.\" copy, modify, merge, publish, distribute, sublicense, and/or +.\" sell copies of the Software, and to permit persons to whom +.\" the Software is furnished to do so, subject to the following +.\" conditions: +.\" +.\" The above copyright notice and this permission notice shall +.\" be included in all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +.\" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +.\" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +.\" HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +.\" OTHER DEALINGS IN THE SOFTWARE. +.\" +.\" ----------------------------------------------------------------------- + +.TH klcc "1" "1 March 2005" "klibc" "H. Peter Anvin" +.SH NAME +klcc \- compile a program against klibc +.SH SYNOPSIS +.B klcc +[\fIgcc options\fP] +[\fB\-o\fP \fIoutfile\fP] +\fIinfile...\fP +.SH DESCRIPTION +.PP +.B klcc +is a wrapper around +.BR gcc (1) +to compile a program against the +.B klibc +tiny C library. It supports most +.B gcc +options. +.PP +Unlike +.BR gcc , +.B klcc +compiles with optimization on by default. Furthermore, the +optimization level used depends on whether or not +.B \-g +is specified, since +.B klcc +frequently uses options in the normal case which makes debugging +impossible. Therefore, compile without +.BR \-g , +.BR \-O , +.B \-f +or +.B \-m +option to use the default optimization level; this will generally +result in the smallest binaries. You may want to use +.B \-s +when linking, however. +.PP +Use the +.B \-shared +or +.B \-static +option to compile for and link against shared or static klibc. Note +that shared klibc only supports running against the exact same klibc +binary as the binary was linked with. +.SH AUTHOR +Written by H. Peter Anvin . +.SH COPYRIGHT +Copyright \(co 2005 H. Peter Anvin. +.SH "SEE ALSO" +.BR gcc (1) + diff --git a/klibc/klcc.in b/klibc/klcc.in new file mode 100644 index 0000000000..713843c37c --- /dev/null +++ b/klibc/klcc.in @@ -0,0 +1,207 @@ +# -*- perl -*- + +# Standard includes +@includes = ("-I${INSTALLDIR}/${CROSS}include/arch/${ARCH}", + "-I${INSTALLDIR}/${CROSS}include/bits${BITSIZE}", + "-I${INSTALLDIR}/${CROSS}include"); + +# Default optimization options (for compiles without -g) +@optopt = @OPTFLAGS; +@goptopt = ('-O'); + +# Options and libraries to pass to ld; shared versus static +@staticopt = ("$INSTALLDIR/${CROSS}lib/crt0.o"); +@staticlib = ("$INSTALLDIR/${CROSS}lib/libc.a"); +@sharedopt = (@EMAIN, "$INSTALLDIR/${CROSS}lib/interp.o"); +@sharedlib = ('-R', "$INSTALLDIR/lib/${CROSS}libc.so"); + +# Returns the language (-x option string) for a specific extension. +sub filename2lang($) { + my ($file) = @_; + + return 'c' if ( $file =~ /\.c$/ ); + return 'c-header' if ( $file =~ /\.h$/ ); + return 'cpp-output' if ( $file =~ /\.i$/ ); + return 'c++-cpp-output' if ( $file =~ /\.ii$/ ); + return 'objective-c' if ( $file =~ /\.m$/ ); + return 'objc-cpp-output' if ( $file =~ /\.mi$/ ); + return 'c++' if ( $file =~/\.(cc|cp|cxx|cpp|CPP|c\+\+|C)$/ ); + return 'c++-header' if ( $file =~ /\.(hh|H)$/ ); + return 'f77' if ( $file =~ /\.(f|for|FOR)$/ ); + return 'f77-cpp-input' if ( $file =~ /\.(F|fpp|FPP)$/ ); + return 'ratfor' if ( $file =~ /\.r$/ ); + + # Is this correct? + return 'ada' if ( $file =~ /\.(ads|adb)$/ ); + + return 'assembler' if ( $file =~ /\.s$/ ); + return 'assembler-with-cpp' if ( $file =~/ \.S$/ ); + + # Linker file; there is no option to gcc to assume something + # is a linker file, so we make up our own... + return 'obj'; +} + +# Produces a series of -x options and files +sub files_with_lang($$) { + my($files, $flang) = @_; + my(@as) = (); + my($xopt) = 'none'; + my($need); + + foreach $f ( @{$files} ) { + $need = ${$flang}{$f}; + $need = 'none' if ( $need eq 'obj' ); + unless ( $xopt eq $need || + ($xopt eq 'none' && filename2lang($f) eq $need) ) { + push(@as, '-x', $need); + $xopt = $need; + } + push(@as, $f); + } + + return @as; +} + +# Convert a return value from system() to an exit() code +sub syserr($) { + my($e) = @_; + + return ($e & 0x7f) | 0x80 if ( $e & 0xff ); + return $e >> 8; +} + +# Run a program; printing out the command line if $verbose is set +sub mysystem(@) { + print STDERR join(' ', @_), "\n" if ( $verbose ); + return system(@_); +} + +# +# Begin parsing options. +# + +@ccopt = (); +@ldopt = (); + +@files = (); # List of files +%flang = (); # Languages for files + +# This is 'c' for compile only, 'E' for preprocess only, +# 'S' for compile to assembly. +$operation = ''; # Compile and link + +# Current -x option. If undefined, it means autodetect. +undef $lang; + +$save_temps = 0; # The -save-temps option +$verbose = 0; # The -v option +$shared = 0; # Are we compiling shared? +$debugging = 0; # -g or -p option present? +$strip = 0; # -s option present? +undef $output; # -o option present? + +while ( defined($a = shift(@ARGV)) ) { + if ( $a !~ /^\-/ ) { + # Not an option. Must be a filename then. + push(@files, $a); + $flang{$a} = $lang || filename2lang($a); + } elsif ( $a =~ /^-Wl,(.*)$/ ) { + # -Wl used to pass options to the linker + push(@ldopt, split(/,/, $1)); + } elsif ( $a =~ /^-([fmwWQdO]|std=|ansi|pedantic)/ ) { + # Options to gcc + push(@ccopt, $a); + } elsif ( $a =~ /^-([DUI])(.*)$/ ) { + # Options to gcc, which can take either a conjoined argument + # (-DFOO) or a disjoint argument (-D FOO) + push(@ccopt, $a); + push(@ccopt, shift(@ARGV)) if ( $2 eq '' ); + } elsif ( $a eq '-include' ) { + # Options to gcc which always take a disjoint argument + push(@ccopt, $a, shift(@ARGV)); + } elsif ( $a =~ /^-[gp]/ ) { + # Debugging options to gcc *and* ld + push(@ccopt, $a); + push(@ldopt, $a); + $debugging = 1; + } elsif ( $a eq '-v' ) { + push(@ccopt, $a); + $verbose = 1; + } elsif ( $a eq '-save-temps' ) { + push(@ccopt, $a); + $save_temps = 1; + } elsif ( $a =~ '^-([cSE])$' ) { + push(@ccopt, $a); + $operation = $1; + } elsif ( $a eq '-shared' ) { + $shared = 1; + } elsif ( $a eq '-static' ) { + $shared = 0; + } elsif ( $a eq '-s' ) { + $strip = 1; + } elsif ( $a eq '-o' ) { + $output = shift(@ARGV); + } elsif ( $a eq '-nostdinc' ) { + push(@ccopt, $a); + @includes = (); + } elsif ( $a =~ /^(-print|--help)/ ) { + # Pseudo-operations; just pass to gcc and don't do anything else + push(@ccopt, $a); + $operation = 'c' if ( $operation eq '' ); + } else { + die "$0: unknown option: $a\n"; + } +} + +if ( $debugging ) { + @ccopt = (@REQFLAGS, @includes, @goptopt, @ccopt); +} else { + @ccopt = (@REQFLAGS, @includes, @optopt, @ccopt); +} + +if ( $operation ne '' ) { + # Just run gcc with the appropriate options + @outopt = ('-o', $output) if ( defined($output) ); + $rv = mysystem($CC, @ccopt, @outopt, files_with_lang(\@files, \%flang)); +} else { + @outopt = ('-o', $output || 'a.out'); + + @objs = (); + @rmobjs = (); + + foreach $f ( @files ) { + if ( $flang{$f} eq 'obj' ) { + push(@objs, $f); + } else { + $fo = $f; + $fo =~ s/\.[^\/.]+$/\.o/; + + die if ( $f eq $fo ); # safety check + + push(@objs, $fo); + push(@rmobjs, $fo) unless ( $save_temps ); + + $rv = mysystem($CC, @ccopt, '-c', '-o', $fo, '-x', $flang{$f}, $f); + + if ( $rv ) { + unlink(@rmobjs); + exit syserr($rv); + } + } + } + + if ( $shared ) { + $rv = mysystem($LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs, @sharedlib); + } else { + $rv = mysystem($LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs, @staticlib); + } + + unlink(@rmobjs); + + if ( $strip && !$rv ) { + $rv = mysystem($STRIP, @STRIPFLAGS, $output); + } +} + +exit syserr($rv); diff --git a/klibc/klibc.spec b/klibc/klibc.spec index de0a14cf63..65b0bf5439 100644 --- a/klibc/klibc.spec +++ b/klibc/klibc.spec @@ -1,50 +1,45 @@ Summary: A minimal libc subset for use with initramfs. Name: klibc -Version: 0.199 +Version: 0.205 Release: 1 License: BSD/GPL Group: Development/Libraries URL: http://www.zytor.com/mailman/listinfo/klibc Source: http://www.kernel.org/pub/linux/libs/klibc-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildRequires: kernel-source >= 2.6.0 +BuildRequires: kernel >= 2.6.0 Packager: H. Peter Anvin Prefix: /usr Vendor: Starving Linux Artists +%define klibcdir %{_prefix}/lib/klibc +%define libdocdir %{_docdir}/%{name}-%{version}-%{release} +%define bindocdir %{_docdir}/%{name}-utils-%{version}-%{release} + %description %{name} is intended to be a minimalistic libc subset for use with initramfs. It is deliberately written for small size, minimal entanglement, and portability, not speed. It is definitely a work in progress, and a lot of things are still missing. -%package kernheaders -Summary: Kernel headers used during the build of klibc. -Group: Development/Libraries - -%description kernheaders -This package contains the set of kernel headers that were required to -build %{name} and the utilities that ship with it. This may or may -not be a complete enough set to build other programs that link against -%{name}. If in doubt, use real kernel headers instead. - %package utils -Summary: Small statically-linked utilities built with klibc. +Summary: Small utilities built with klibc. Group: Utilities/System +Requires: klibc = %{version} %description utils - -This package contains a collection of programs that are statically -linked against klibc. These duplicate some of the functionality of a -regular Linux toolset, but are typically much smaller than their -full-function counterparts. They are intended for inclusion in -initramfs images and embedded systems. +This package contains a collection of programs that are linked against +klibc. These duplicate some of the functionality of a regular Linux +toolset, but are typically much smaller than their full-function +counterparts. They are intended for inclusion in initramfs images and +embedded systems. %prep %setup -q -cp -as /usr/src/linux-`rpm -q kernel-source | tail -1 | cut -d- -f3-` ./linux -make -C linux defconfig ARCH=%{_target_cpu} -make -C linux prepare ARCH=%{_target_cpu} +cp -dRs /lib/modules/`uname -r`/build ./linux +# Shouldn't need this when getting the build tree from /lib/modules +# make -C linux defconfig ARCH=%{_target_cpu} +# make -C linux prepare ARCH=%{_target_cpu} # Deal with braindamage in RedHat's kernel-source RPM rm -f linux/include/linux/config.h cat < linux/include/linux/config.h @@ -58,98 +53,48 @@ EOF mkdir -p %{buildroot} %build -make ARCH=%{_target_cpu} +make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ + INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} %install rm -rf %{buildroot} +make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ + INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} \ + install -dest=%{buildroot}/%{prefix} -lib=$dest/%{_lib}/klibc -inc=$dest/include/klibc -exe=$dest/libexec/klibc -doc=$dest/share/doc/%{name}-%{version} -udoc=$dest/share/doc/%{name}-utils-%{version} - -# First, the library. - -install -dD -m 755 $lib $inc/kernel $exe $doc $udoc -install -m 755 klibc/klibc.so $lib -install -m 644 klibc/libc.a $lib -install -m 644 klibc/crt0.o $lib -install -m 644 klibc/libc.so.hash $lib -ln $lib/klibc.so $lib/libc.so -ln $lib/klibc.so $lib/klibc-$(cat $lib/libc.so.hash).so - -# Next, the generated binaries. -# These are currently static binaries, should we go for shared? - -install -m 755 ash/sh $exe -install -m 755 gzip/gzip $exe -ln $exe/gzip $exe/gunzip -ln $exe/gzip $exe/zcat -install -m 755 ipconfig/ipconfig $exe -install -m 755 kinit/kinit $exe -install -m 755 nfsmount/nfsmount $exe -install -m 755 utils/static/* $exe - -# The docs. - -install -m 444 README $doc -install -m 444 klibc/README $doc/README.klibc -install -m 444 klibc/arch/README $doc/README.klibc.arch - -install -m 444 gzip/COPYING $udoc/COPYING.gzip -install -m 444 gzip/README $udoc/README.gzip -install -m 444 ipconfig/README $udoc/README.ipconfig -install -m 444 kinit/README $udoc/README.kinit - -# Finally, the include files. - -bitsize=$(make --no-print-directory -C klibc bitsize ARCH=%{_target_cpu}) -cp --parents $(find klibc/include \( -name CVS -o -name SCCS \) -prune \ - -o -name '*.h' -print) $inc -mv $inc/klibc $inc/klibc.$$ -mv $inc/klibc.$$/include/* $inc -mv $inc/bits$bitsize/bitsize $inc -rm -rf $inc/klibc.$$ $inc/bits[0-9]* -pushd klibc/arch/%{_arch}/include -cp --parents -f $(find . \( -name CVS -o -name SCCS \) -prune \ - -o -name '*.h' -print) $inc -popd - -# Yeugh. Find the transitive closure over all kernel headers included -# by klibc, and copy them into place. - -find . -name '.*.d' | xargs -r sed -e 's,[ \t][ \t]*,\n,g' | sed -n -e 's,^\.\./linux/include/,,p' | sort | uniq | (cd linux/include && xargs -ri cp --parents '{}' $inc/kernel) +# Install the docs + +mkdir -p %{buildroot}%{bindocdir} %{buildroot}%{libdocdir} +install -m 444 README %{buildroot}%{libdocdir} +install -m 444 klibc/README %{buildroot}%{libdocdir}/README.klibc +install -m 444 klibc/arch/README %{buildroot}%{libdocdir}/README.klibc.arch + +install -m 444 gzip/COPYING %{buildroot}%{bindocdir}/COPYING.gzip +install -m 444 gzip/README %{buildroot}%{bindocdir}/README.gzip +install -m 444 ipconfig/README %{buildroot}%{bindocdir}/README.ipconfig +install -m 444 kinit/README %{buildroot}%{bindocdir}/README.kinit %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%docdir %{prefix}/share/doc/%{name}-%{version} -%{prefix}/%{_lib}/klibc -%dir %{prefix}/include/klibc -%{prefix}/include/klibc/*.h -%{prefix}/include/klibc/arpa -%{prefix}/include/klibc/bitsize -%{prefix}/include/klibc/klibc -%{prefix}/include/klibc/net -%{prefix}/include/klibc/netinet -%{prefix}/include/klibc/sys -%{prefix}/share/doc/%{name}-%{version} - -%files kernheaders -%defattr(-,root,root,-) -%{prefix}/include/klibc/kernel +%{klibcdir}/lib +%{klibcdir}/include +%{_bindir}/klcc +/lib/klibc-*.so +%doc %{_mandir}/man1/* +%doc %{libdocdir}/* %files utils %defattr(-,root,root,-) -%{prefix}/libexec/klibc -%docdir %{prefix}/share/doc/%{name}-utils-%{version} -%{prefix}/share/doc/%{name}-utils-%{version} +%{klibcdir}/bin +%doc %{bindocdir}/* %changelog +* Tue Mar 1 2005 H. Peter Anvin +- New "make install" scheme, klcc + * Tue Jul 6 2004 H. Peter Anvin - Update to use kernel-source RPM for the kernel symlink. diff --git a/klibc/klibc.spec.in b/klibc/klibc.spec.in index 8f5b2618d0..237771532a 100644 --- a/klibc/klibc.spec.in +++ b/klibc/klibc.spec.in @@ -7,44 +7,39 @@ Group: Development/Libraries URL: http://www.zytor.com/mailman/listinfo/klibc Source: http://www.kernel.org/pub/linux/libs/klibc-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildRequires: kernel-source >= 2.6.0 +BuildRequires: kernel >= 2.6.0 Packager: H. Peter Anvin Prefix: /usr Vendor: Starving Linux Artists +%define klibcdir %{_prefix}/lib/klibc +%define libdocdir %{_docdir}/%{name}-%{version}-%{release} +%define bindocdir %{_docdir}/%{name}-utils-%{version}-%{release} + %description %{name} is intended to be a minimalistic libc subset for use with initramfs. It is deliberately written for small size, minimal entanglement, and portability, not speed. It is definitely a work in progress, and a lot of things are still missing. -%package kernheaders -Summary: Kernel headers used during the build of klibc. -Group: Development/Libraries - -%description kernheaders -This package contains the set of kernel headers that were required to -build %{name} and the utilities that ship with it. This may or may -not be a complete enough set to build other programs that link against -%{name}. If in doubt, use real kernel headers instead. - %package utils -Summary: Small statically-linked utilities built with klibc. +Summary: Small utilities built with klibc. Group: Utilities/System +Requires: klibc = %{version} %description utils - -This package contains a collection of programs that are statically -linked against klibc. These duplicate some of the functionality of a -regular Linux toolset, but are typically much smaller than their -full-function counterparts. They are intended for inclusion in -initramfs images and embedded systems. +This package contains a collection of programs that are linked against +klibc. These duplicate some of the functionality of a regular Linux +toolset, but are typically much smaller than their full-function +counterparts. They are intended for inclusion in initramfs images and +embedded systems. %prep %setup -q -cp -as /usr/src/linux-`rpm -q kernel-source | tail -1 | cut -d- -f3-` ./linux -make -C linux defconfig ARCH=%{_target_cpu} -make -C linux prepare ARCH=%{_target_cpu} +cp -dRs /lib/modules/`uname -r`/build ./linux +# Shouldn't need this when getting the build tree from /lib/modules +# make -C linux defconfig ARCH=%{_target_cpu} +# make -C linux prepare ARCH=%{_target_cpu} # Deal with braindamage in RedHat's kernel-source RPM rm -f linux/include/linux/config.h cat < linux/include/linux/config.h @@ -58,98 +53,48 @@ EOF mkdir -p %{buildroot} %build -make ARCH=%{_target_cpu} +make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ + INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} %install rm -rf %{buildroot} +make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ + INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} \ + install -dest=%{buildroot}/%{prefix} -lib=$dest/%{_lib}/klibc -inc=$dest/include/klibc -exe=$dest/libexec/klibc -doc=$dest/share/doc/%{name}-%{version} -udoc=$dest/share/doc/%{name}-utils-%{version} - -# First, the library. - -install -dD -m 755 $lib $inc/kernel $exe $doc $udoc -install -m 755 klibc/klibc.so $lib -install -m 644 klibc/libc.a $lib -install -m 644 klibc/crt0.o $lib -install -m 644 klibc/libc.so.hash $lib -ln $lib/klibc.so $lib/libc.so -ln $lib/klibc.so $lib/klibc-$(cat $lib/libc.so.hash).so - -# Next, the generated binaries. -# These are currently static binaries, should we go for shared? - -install -m 755 ash/sh $exe -install -m 755 gzip/gzip $exe -ln $exe/gzip $exe/gunzip -ln $exe/gzip $exe/zcat -install -m 755 ipconfig/ipconfig $exe -install -m 755 kinit/kinit $exe -install -m 755 nfsmount/nfsmount $exe -install -m 755 utils/static/* $exe - -# The docs. - -install -m 444 README $doc -install -m 444 klibc/README $doc/README.klibc -install -m 444 klibc/arch/README $doc/README.klibc.arch - -install -m 444 gzip/COPYING $udoc/COPYING.gzip -install -m 444 gzip/README $udoc/README.gzip -install -m 444 ipconfig/README $udoc/README.ipconfig -install -m 444 kinit/README $udoc/README.kinit - -# Finally, the include files. - -bitsize=$(make --no-print-directory -C klibc bitsize ARCH=%{_target_cpu}) -cp --parents $(find klibc/include \( -name CVS -o -name SCCS \) -prune \ - -o -name '*.h' -print) $inc -mv $inc/klibc $inc/klibc.$$ -mv $inc/klibc.$$/include/* $inc -mv $inc/bits$bitsize/bitsize $inc -rm -rf $inc/klibc.$$ $inc/bits[0-9]* -pushd klibc/arch/%{_arch}/include -cp --parents -f $(find . \( -name CVS -o -name SCCS \) -prune \ - -o -name '*.h' -print) $inc -popd - -# Yeugh. Find the transitive closure over all kernel headers included -# by klibc, and copy them into place. - -find . -name '.*.d' | xargs -r sed -e 's,[ \t][ \t]*,\n,g' | sed -n -e 's,^\.\./linux/include/,,p' | sort | uniq | (cd linux/include && xargs -ri cp --parents '{}' $inc/kernel) +# Install the docs + +mkdir -p %{buildroot}%{bindocdir} %{buildroot}%{libdocdir} +install -m 444 README %{buildroot}%{libdocdir} +install -m 444 klibc/README %{buildroot}%{libdocdir}/README.klibc +install -m 444 klibc/arch/README %{buildroot}%{libdocdir}/README.klibc.arch + +install -m 444 gzip/COPYING %{buildroot}%{bindocdir}/COPYING.gzip +install -m 444 gzip/README %{buildroot}%{bindocdir}/README.gzip +install -m 444 ipconfig/README %{buildroot}%{bindocdir}/README.ipconfig +install -m 444 kinit/README %{buildroot}%{bindocdir}/README.kinit %clean rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root,-) -%docdir %{prefix}/share/doc/%{name}-%{version} -%{prefix}/%{_lib}/klibc -%dir %{prefix}/include/klibc -%{prefix}/include/klibc/*.h -%{prefix}/include/klibc/arpa -%{prefix}/include/klibc/bitsize -%{prefix}/include/klibc/klibc -%{prefix}/include/klibc/net -%{prefix}/include/klibc/netinet -%{prefix}/include/klibc/sys -%{prefix}/share/doc/%{name}-%{version} - -%files kernheaders -%defattr(-,root,root,-) -%{prefix}/include/klibc/kernel +%{klibcdir}/lib +%{klibcdir}/include +%{_bindir}/klcc +/lib/klibc-*.so +%doc %{_mandir}/man1/* +%doc %{libdocdir}/* %files utils %defattr(-,root,root,-) -%{prefix}/libexec/klibc -%docdir %{prefix}/share/doc/%{name}-utils-%{version} -%{prefix}/share/doc/%{name}-utils-%{version} +%{klibcdir}/bin +%doc %{bindocdir}/* %changelog +* Tue Mar 1 2005 H. Peter Anvin +- New "make install" scheme, klcc + * Tue Jul 6 2004 H. Peter Anvin - Update to use kernel-source RPM for the kernel symlink. diff --git a/klibc/klibc/MCONFIG b/klibc/klibc/MCONFIG index 499b6e8b56..24af09d8e0 100644 --- a/klibc/klibc/MCONFIG +++ b/klibc/klibc/MCONFIG @@ -14,5 +14,7 @@ REQFLAGS += -DWITH_ERRLIST endif CFLAGS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) +INCLUDE += -I./zlib +CFLAGS += -DDYNAMIC_CRC_TABLE SOFLAGS = -fPIC diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index 8a9a68bcf7..a9aedc58f0 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -7,6 +7,8 @@ # Include configuration rules include MCONFIG +INCLUDE += -I./zlib + TESTS = $(patsubst %.c,%,$(wildcard tests/*.c)) \ $(patsubst %.c,%.shared,$(wildcard tests/*.c)) LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ @@ -47,10 +49,17 @@ LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ send.o recv.o + ifeq ($(ERRLIST),1) LIBOBJS += errlist.o endif +ifeq ($(ZLIB),1) +LIBOBJS += zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/gzio.o \ + zlib/uncompr.o zlib/deflate.o zlib/trees.o zlib/zutil.o \ + zlib/inflate.o zlib/infback.o zlib/inftrees.o zlib/inffast.o +endif + SOLIB = libc.so SOHASH = klibc.so @@ -79,12 +88,12 @@ tests/testvsnp.o : tests/testvsnp.c tests/% : tests/%.o $(LIB) $(CRT0) $(LD) $(LDFLAGS) -o $@ $(CRT0) $< $(LIB) $(LIBGCC) cp $@ $@.stripped - $(STRIP) $@.stripped + $(STRIPCMD) $@.stripped tests/%.shared : tests/%.o interp.o $(SOLIB) $(LD) $(LDFLAGS) -o $@ $(EMAIN) interp.o tests/$*.o -R $(SOLIB) $(LIBGCC) cp $@ $@.stripped - $(STRIP) $@.stripped + $(STRIPCMD) $@.stripped $(LIB): __static_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/static.obj socketcalls/static.obj rm -f $(LIB) @@ -168,6 +177,14 @@ spotless: clean bitsize: @echo $(BITSIZE) +install: all + $(INSTALL_DATA) $(LIB) $(SOLIB) $(CRT0) $(INTERP_O) \ + $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib + $(INSTALL_EXEC) klibc-`cat $(SOLIB).hash`.so \ + $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib + $(INSTALL_EXEC) klibc-`cat $(SOLIB).hash`.so \ + $(INSTALLROOT)/$(SHLIBDIR) + ifneq ($(wildcard $(DIR).*.d),) include $(wildcard $(DIR).*.d) endif diff --git a/klibc/klibc/SYSCALLS.def b/klibc/klibc/SYSCALLS.def index 4591d0b983..3918bcb012 100644 --- a/klibc/klibc/SYSCALLS.def +++ b/klibc/klibc/SYSCALLS.def @@ -11,6 +11,7 @@ ; #include +#include ; ; Process-related syscalls @@ -175,7 +176,8 @@ int munmap(void *, size_t) void * mremap(void *, size_t, size_t, unsigned long) int msync(const void *, size_t, int) int mprotect(const void *, size_t, int) -#if (BITSIZE == 32 && defined(__NR_mmap2)) || (BITSIZE == 64 && !defined(__NR_mmap)) +#if (_BITSIZE == 32 && defined(__NR_mmap2)) || \ + (_BITSIZE == 64 && !defined(__NR_mmap)) void * mmap2::__mmap2(void *, size_t, int, int, int, long) #else void * mmap(void *, size_t, int, int, int, long) diff --git a/klibc/klibc/arch/i386/MCONFIG b/klibc/klibc/arch/i386/MCONFIG index 2421452eea..67d8de4740 100644 --- a/klibc/klibc/arch/i386/MCONFIG +++ b/klibc/klibc/arch/i386/MCONFIG @@ -13,11 +13,13 @@ REGPARM_OPT := -mregparm=3 -DREGPARM=3 gcc_major := $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1) -OPTFLAGS = $(REGPARM) -march=i386 -Os -g +OPTFLAGS = -march=i386 -Os -g +LDFLAGS = -m elf_i386 ifeq ($(gcc_major),3) REGPARM := $(REGPARM_OPT) OPTFLAGS += -falign-functions=0 -falign-jumps=0 -falign-loops=0 +ARCHREQFLAGS += -m32 else OPTFLAGS += -malign-functions=0 -malign-jumps=0 -malign-loops=0 endif diff --git a/klibc/klibc/include/sys/times.h b/klibc/klibc/include/sys/times.h deleted file mode 100644 index 657f9c4b1c..0000000000 --- a/klibc/klibc/include/sys/times.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * sys/times.h - */ - -#ifndef _SYS_TIMES_H -#define _SYS_TIMES_H - -#include - -__extern clock_t times(struct tms *); -__extern int gettimeofday(struct timeval *, struct timezone *); -__extern int settimeofday(const struct timeval *, const struct timezone *); - -#endif /* _SYS_TIMES_H */ diff --git a/klibc/klibc/llseek.c b/klibc/klibc/llseek.c index 2102a503e9..857490b378 100644 --- a/klibc/klibc/llseek.c +++ b/klibc/klibc/llseek.c @@ -9,8 +9,9 @@ #include #include +#include -#if BITSIZE == 32 +#if _BITSIZE == 32 extern int __llseek(int fd, unsigned long hi, unsigned long lo, off_t *res, int whence); diff --git a/klibc/klibc/mmap.c b/klibc/klibc/mmap.c index 196f1c088f..11c540aed6 100644 --- a/klibc/klibc/mmap.c +++ b/klibc/klibc/mmap.c @@ -8,20 +8,20 @@ #include #include #include /* For PAGE_SHIFT */ +#include -#if defined(__sparc__) +/* + * MMAP2_SHIFT is definitely *NOT* equal to getpageshift() for + * many 32-bit architectures. Supposedly this is fixed to 12 + * for all 32-bit architectures. CHECK THIS!!! + */ # define MMAP2_SHIFT 12 /* Fixed by syscall definition */ -#elif defined(__mips__) || defined(__powerpc__) -# define MMAP2_SHIFT __getpageshift() /* Variable */ -#else -# define MMAP2_SHIFT PAGE_SHIFT -#endif /* * Set in SYSCALLS whether or not we should use an unadorned mmap() system * call (typical on 64-bit architectures). */ -#if (BITSIZE == 32 && defined(__NR_mmap2)) || (BITSIZE == 64 && !defined(__NR_mmap)) +#if (_BITSIZE == 32 && defined(__NR_mmap2)) || (_BITSIZE == 64 && !defined(__NR_mmap)) /* This architecture uses mmap2(). The Linux mmap2() system call takes a page offset as the offset argument. We need to make sure we have diff --git a/klibc/klibc/tests/rtsig.c b/klibc/klibc/tests/rtsig.c new file mode 100644 index 0000000000..a7f8eed088 --- /dev/null +++ b/klibc/klibc/tests/rtsig.c @@ -0,0 +1,12 @@ +#include +#include + +int main(void) +{ +#ifdef SIGRTMIN + printf("sigrtmin = %d, sigrtmax = %d\n", SIGRTMIN, SIGRTMAX); +#else + printf("No realtime signals\n"); +#endif + return 0; +} diff --git a/klibc/klibc/zlib/FAQ b/klibc/klibc/zlib/FAQ new file mode 100644 index 0000000000..7115ec38d6 --- /dev/null +++ b/klibc/klibc/zlib/FAQ @@ -0,0 +1,315 @@ + + Frequently Asked Questions about zlib + + +If your question is not there, please check the zlib home page +http://www.zlib.org which may have more recent information. +The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html + + + 1. Is zlib Y2K-compliant? + + Yes. zlib doesn't handle dates. + + 2. Where can I get a Windows DLL version? + + The zlib sources can be compiled without change to produce a DLL. + See the file win32/DLL_FAQ.txt in the zlib distribution. + Pointers to the precompiled DLL are found in the zlib web site at + http://www.zlib.org. + + 3. Where can I get a Visual Basic interface to zlib? + + See + * http://www.winimage.com/zLibDll/ + * http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm + * contrib/visual-basic.txt in the zlib distribution + + 4. compress() returns Z_BUF_ERROR + + Make sure that before the call of compress, the length of the compressed + buffer is equal to the total size of the compressed buffer and not + zero. For Visual Basic, check that this parameter is passed by reference + ("as any"), not by value ("as long"). + + 5. deflate() or inflate() returns Z_BUF_ERROR + + Before making the call, make sure that avail_in and avail_out are not + zero. When setting the parameter flush equal to Z_FINISH, also make sure + that avail_out is big enough to allow processing all pending input. + Note that a Z_BUF_ERROR is not fatal--another call to deflate() or + inflate() can be made with more input or output space. A Z_BUF_ERROR + may in fact be unavoidable depending on how the functions are used, since + it is not possible to tell whether or not there is more output pending + when strm.avail_out returns with zero. + + 6. Where's the zlib documentation (man pages, etc.)? + + It's in zlib.h for the moment, and Francis S. Lin has converted it to a + web page zlib.html. Volunteers to transform this to Unix-style man pages, + please contact Jean-loup Gailly (jloup@gzip.org). Examples of zlib usage + are in the files example.c and minigzip.c. + + 7. Why don't you use GNU autoconf or libtool or ...? + + Because we would like to keep zlib as a very small and simple + package. zlib is rather portable and doesn't need much configuration. + + 8. I found a bug in zlib. + + Most of the time, such problems are due to an incorrect usage of + zlib. Please try to reproduce the problem with a small program and send + the corresponding source to us at zlib@gzip.org . Do not send + multi-megabyte data files without prior agreement. + + 9. Why do I get "undefined reference to gzputc"? + + If "make test" produces something like + + example.o(.text+0x154): undefined reference to `gzputc' + + check that you don't have old files libz.* in /usr/lib, /usr/local/lib or + /usr/X11R6/lib. Remove any old versions, then do "make install". + +10. I need a Delphi interface to zlib. + + See the contrib/delphi directory in the zlib distribution. + +11. Can zlib handle .zip archives? + + See the directory contrib/minizip in the zlib distribution. + +12. Can zlib handle .Z files? + + No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt + the code of uncompress on your own. + +13. How can I make a Unix shared library? + + make clean + ./configure -s + make + +14. How do I install a shared zlib library on Unix? + + make install + + However, many flavors of Unix come with a shared zlib already installed. + Before going to the trouble of compiling a shared version of zlib and + trying to install it, you may want to check if it's already there! If you + can #include , it's there. The -lz option will probably link to it. + +15. I have a question about OttoPDF + + We are not the authors of OttoPDF. The real author is on the OttoPDF web + site Joel Hainley jhainley@myndkryme.com. + +16. Why does gzip give an error on a file I make with compress/deflate? + + The compress and deflate functions produce data in the zlib format, which + is different and incompatible with the gzip format. The gz* functions in + zlib on the other hand use the gzip format. Both the zlib and gzip + formats use the same compressed data format internally, but have different + headers and trailers around the compressed data. + +17. Ok, so why are there two different formats? + + The gzip format was designed to retain the directory information about + a single file, such as the name and last modification date. The zlib + format on the other hand was designed for in-memory and communication + channel applications, and has a much more compact header and trailer and + uses a faster integrity check than gzip. + +18. Well that's nice, but how do I make a gzip file in memory? + + You can request that deflate write the gzip format instead of the zlib + format using deflateInit2(). You can also request that inflate decode + the gzip format using inflateInit2(). Read zlib.h for more details. + + Note that you cannot specify special gzip header contents (e.g. a file + name or modification date), nor will inflate tell you what was in the + gzip header. If you need to customize the header or see what's in it, + you can use the raw deflate and inflate operations and the crc32() + function and roll your own gzip encoding and decoding. Read the gzip + RFC 1952 for details of the header and trailer format. + +19. Is zlib thread-safe? + + Yes. However any library routines that zlib uses and any application- + provided memory allocation routines must also be thread-safe. zlib's gz* + functions use stdio library routines, and most of zlib's functions use the + library memory allocation routines by default. zlib's Init functions allow + for the application to provide custom memory allocation routines. + + Of course, you should only operate on any given zlib or gzip stream from a + single thread at a time. + +20. Can I use zlib in my commercial application? + + Yes. Please read the license in zlib.h. + +21. Is zlib under the GNU license? + + No. Please read the license in zlib.h. + +22. The license says that altered source versions must be "plainly marked". So + what exactly do I need to do to meet that requirement? + + You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In + particular, the final version number needs to be changed to "f", and an + identification string should be appended to ZLIB_VERSION. Version numbers + x.x.x.f are reserved for modifications to zlib by others than the zlib + maintainers. For example, if the version of the base zlib you are altering + is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and + ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also + update the version strings in deflate.c and inftrees.c. + + For altered source distributions, you should also note the origin and + nature of the changes in zlib.h, as well as in ChangeLog and README, along + with the dates of the alterations. The origin should include at least your + name (or your company's name), and an email address to contact for help or + issues with the library. + + Note that distributing a compiled zlib library along with zlib.h and + zconf.h is also a source distribution, and so you should change + ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes + in zlib.h as you would for a full source distribution. + +23. Will zlib work on a big-endian or little-endian architecture, and can I + exchange compressed data between them? + + Yes and yes. + +24. Will zlib work on a 64-bit machine? + + It should. It has been tested on 64-bit machines, and has no dependence + on any data types being limited to 32-bits in length. If you have any + difficulties, please provide a complete problem report to zlib@gzip.org + +25. Will zlib decompress data from the PKWare Data Compression Library? + + No. The PKWare DCL uses a completely different compressed data format + than does PKZIP and zlib. However, you can look in zlib's contrib/blast + directory for a possible solution to your problem. + +26. Can I access data randomly in a compressed stream? + + No, not without some preparation. If when compressing you periodically + use Z_FULL_FLUSH, carefully write all the pending data at those points, + and keep an index of those locations, then you can start decompression + at those points. You have to be careful to not use Z_FULL_FLUSH too + often, since it can significantly degrade compression. + +27. Does zlib work on MVS, OS/390, CICS, etc.? + + We don't know for sure. We have heard occasional reports of success on + these systems. If you do use it on one of these, please provide us with + a report, instructions, and patches that we can reference when we get + these questions. Thanks. + +28. Is there some simpler, easier to read version of inflate I can look at + to understand the deflate format? + + First off, you should read RFC 1951. Second, yes. Look in zlib's + contrib/puff directory. + +29. Does zlib infringe on any patents? + + As far as we know, no. In fact, that was originally the whole point behind + zlib. Look here for some more information: + + http://www.gzip.org/#faq11 + +30. Can zlib work with greater than 4 GB of data? + + Yes. inflate() and deflate() will process any amount of data correctly. + Each call of inflate() or deflate() is limited to input and output chunks + of the maximum value that can be stored in the compiler's "unsigned int" + type, but there is no limit to the number of chunks. Note however that the + strm.total_in and strm_total_out counters may be limited to 4 GB. These + counters are provided as a convenience and are not used internally by + inflate() or deflate(). The application can easily set up its own counters + updated after each call of inflate() or deflate() to count beyond 4 GB. + compress() and uncompress() may be limited to 4 GB, since they operate in a + single call. gzseek() and gztell() may be limited to 4 GB depending on how + zlib is compiled. See the zlibCompileFlags() function in zlib.h. + + The word "may" appears several times above since there is a 4 GB limit + only if the compiler's "long" type is 32 bits. If the compiler's "long" + type is 64 bits, then the limit is 16 exabytes. + +31. Does zlib have any security vulnerabilities? + + The only one that we are aware of is potentially in gzprintf(). If zlib + is compiled to use sprintf() or vsprintf(), then there is no protection + against a buffer overflow of a 4K string space, other than the caller of + gzprintf() assuring that the output will not exceed 4K. On the other + hand, if zlib is compiled to use snprintf() or vsnprintf(), which should + normally be the case, then there is no vulnerability. The ./configure + script will display warnings if an insecure variation of sprintf() will + be used by gzprintf(). Also the zlibCompileFlags() function will return + information on what variant of sprintf() is used by gzprintf(). + + If you don't have snprintf() or vsnprintf() and would like one, you can + find a portable implementation here: + + http://www.ijs.si/software/snprintf/ + + Note that you should be using the most recent version of zlib. Versions + 1.1.3 and before were subject to a double-free vulnerability. + +32. Is there a Java version of zlib? + + Probably what you want is to use zlib in Java. zlib is already included + as part of the Java SDK in the java.util.zip package. If you really want + a version of zlib written in the Java language, look on the zlib home + page for links: http://www.zlib.org/ + +33. I get this or that compiler or source-code scanner warning when I crank it + up to maximally-pendantic. Can't you guys write proper code? + + Many years ago, we gave up attempting to avoid warnings on every compiler + in the universe. It just got to be a waste of time, and some compilers + were downright silly. So now, we simply make sure that the code always + works. + +34. Will zlib read the (insert any ancient or arcane format here) compressed + data format? + + Probably not. Look in the comp.compression FAQ for pointers to various + formats and associated software. + +35. How can I encrypt/decrypt zip files with zlib? + + zlib doesn't support encryption. The original PKZIP encryption is very weak + and can be broken with freely available programs. To get strong encryption, + use gpg ( http://www.gnupg.org/ ) which already includes zlib compression. + For PKZIP compatible "encryption", look at http://www.info-zip.org/ + +36. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? + + "gzip" is the gzip format, and "deflate" is the zlib format. They should + probably have called the second one "zlib" instead to avoid confusion + with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 + correctly points to the zlib specification in RFC 1950 for the "deflate" + transfer encoding, there have been reports of servers and browsers that + incorrectly produce or expect raw deflate data per the deflate + specficiation in RFC 1951, most notably Microsoft. So even though the + "deflate" transfer encoding using the zlib format would be the more + efficient approach (and in fact exactly what the zlib format was designed + for), using the "gzip" transfer encoding is probably more reliable due to + an unfortunate choice of name on the part of the HTTP 1.1 authors. + + Bottom line: use the gzip format for HTTP 1.1 encoding. + +37. Does zlib support the new "Deflate64" format introduced by PKWare? + + No. PKWare has apparently decided to keep that format proprietary, since + they have not documented it as they have previous compression formats. + In any case, the compression improvements are so modest compared to other + more modern approaches, that it's not worth the effort to implement. + +38. Can you please sign these lengthy legal documents and fax them back to us + so that we can use your software in our product? + + No. Go away. Shoo. diff --git a/klibc/klibc/zlib/INDEX b/klibc/klibc/zlib/INDEX new file mode 100644 index 0000000000..a9de7844d1 --- /dev/null +++ b/klibc/klibc/zlib/INDEX @@ -0,0 +1,48 @@ +ChangeLog history of changes +FAQ Frequently Asked Questions about zlib +INDEX this file +Makefile makefile for Unix (generated by configure) +Makefile.in makefile for Unix (template for configure) +README guess what +algorithm.txt description of the (de)compression algorithm +configure configure script for Unix +zconf.in.h template for zconf.h (used by configure) + +msdos/ makefiles for MSDOS +old/ makefiles for various architectures and zlib documentation + files that have not yet been updated for zlib 1.2.x +qnx/ makefiles for QNX +win32/ makefiles for Windows + + zlib public header files (must be kept): +zconf.h +zlib.h + + private source files used to build the zlib library: +adler32.c +compress.c +crc32.c +crc32.h +deflate.c +deflate.h +gzio.c +infback.c +inffast.c +inffast.h +inffixed.h +inflate.c +inflate.h +inftrees.c +inftrees.h +trees.c +trees.h +uncompr.c +zutil.c +zutil.h + + source files for sample programs: +example.c +minigzip.c + + unsupported contribution by third parties +See contrib/README.contrib diff --git a/klibc/klibc/zlib/README b/klibc/klibc/zlib/README new file mode 100644 index 0000000000..0f1205481c --- /dev/null +++ b/klibc/klibc/zlib/README @@ -0,0 +1,126 @@ +ZLIB DATA COMPRESSION LIBRARY + +zlib 1.2.1 is a general purpose data compression library. All the code is +thread safe. The data format used by the zlib library is described by RFCs +(Request for Comments) 1950 to 1952 in the files +http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) +and rfc1952.txt (gzip format). These documents are also available in other +formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html + +All functions of the compression library are documented in the file zlib.h +(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example +of the library is given in the file example.c which also tests that the library +is working correctly. Another example is given in the file minigzip.c. The +compression library itself is composed of all source files except example.c and +minigzip.c. + +To compile all files and run the test program, follow the instructions given at +the top of Makefile. In short "make test; make install" should work for most +machines. For Unix: "./configure; make test; make install" For MSDOS, use one +of the special makefiles such as Makefile.msc. For VMS, use Make_vms.com or +descrip.mms. + +Questions about zlib should be sent to , or to Gilles Vollant + for the Windows DLL version. The zlib home page is +http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, +please check this site to verify that you have the latest version of zlib; +otherwise get the latest version and check whether the problem still exists or +not. + +PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking +for help. + +Mark Nelson wrote an article about zlib for the Jan. 1997 +issue of Dr. Dobb's Journal; a copy of the article is available in +http://dogma.net/markn/articles/zlibtool/zlibtool.htm + +The changes made in version 1.2.1 are documented in the file ChangeLog. + +Unsupported third party contributions are provided in directory "contrib". + +A Java implementation of zlib is available in the Java Development Kit +http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html +See the zlib home page http://www.zlib.org for details. + +A Perl interface to zlib written by Paul Marquess is in the +CPAN (Comprehensive Perl Archive Network) sites +http://www.cpan.org/modules/by-module/Compress/ + +A Python interface to zlib written by A.M. Kuchling is +available in Python 1.5 and later versions, see +http://www.python.org/doc/lib/module-zlib.html + +A zlib binding for TCL written by Andreas Kupries is +availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html + +An experimental package to read and write files in .zip format, written on top +of zlib by Gilles Vollant , is available in the +contrib/minizip directory of zlib. + + +Notes for some targets: + +- For Windows DLL versions, please see win32/DLL_FAQ.txt + +- For 64-bit Irix, deflate.c must be compiled without any optimization. With + -O, one libpng test fails. The test works in 32 bit mode (with the -n32 + compiler flag). The compiler bug has been reported to SGI. + +- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works + when compiled with cc. + +- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is + necessary to get gzprintf working correctly. This is done by configure. + +- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with + other compilers. Use "make test" to check your compiler. + +- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. + +- For PalmOs, see http://palmzlib.sourceforge.net/ + +- When building a shared, i.e. dynamic library on Mac OS X, the library must be + installed before testing (do "make install" before "make test"), since the + library location is specified in the library. + + +Acknowledgments: + + The deflate format used by zlib was defined by Phil Katz. The deflate + and zlib specifications were written by L. Peter Deutsch. Thanks to all the + people who reported problems and suggested various improvements in zlib; + they are too numerous to cite here. + +Copyright notice: + + (C) 1995-2003 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + +If you use the zlib library in a product, we would appreciate *not* +receiving lengthy legal documents to sign. The sources are provided +for free but without warranty of any kind. The library has been +entirely written by Jean-loup Gailly and Mark Adler; it does not +include third-party code. + +If you redistribute modified sources, we would appreciate that you include +in the file ChangeLog history information documenting your changes. Please +read the FAQ for more information on the distribution of modified source +versions. diff --git a/klibc/klibc/zlib/adler32.c b/klibc/klibc/zlib/adler32.c new file mode 100644 index 0000000000..48c08f094a --- /dev/null +++ b/klibc/klibc/zlib/adler32.c @@ -0,0 +1,74 @@ +/* adler32.c -- compute the Adler-32 checksum of a data stream + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: adler32.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +#define BASE 65521UL /* largest prime smaller than 65536 */ +#define NMAX 5552 +/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ + +#define DO1(buf,i) {s1 += buf[i]; s2 += s1;} +#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); +#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); +#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); +#define DO16(buf) DO8(buf,0); DO8(buf,8); + +#ifdef NO_DIVIDE +# define MOD(a) \ + do { \ + if (a >= (BASE << 16)) a -= (BASE << 16); \ + if (a >= (BASE << 15)) a -= (BASE << 15); \ + if (a >= (BASE << 14)) a -= (BASE << 14); \ + if (a >= (BASE << 13)) a -= (BASE << 13); \ + if (a >= (BASE << 12)) a -= (BASE << 12); \ + if (a >= (BASE << 11)) a -= (BASE << 11); \ + if (a >= (BASE << 10)) a -= (BASE << 10); \ + if (a >= (BASE << 9)) a -= (BASE << 9); \ + if (a >= (BASE << 8)) a -= (BASE << 8); \ + if (a >= (BASE << 7)) a -= (BASE << 7); \ + if (a >= (BASE << 6)) a -= (BASE << 6); \ + if (a >= (BASE << 5)) a -= (BASE << 5); \ + if (a >= (BASE << 4)) a -= (BASE << 4); \ + if (a >= (BASE << 3)) a -= (BASE << 3); \ + if (a >= (BASE << 2)) a -= (BASE << 2); \ + if (a >= (BASE << 1)) a -= (BASE << 1); \ + if (a >= BASE) a -= BASE; \ + } while (0) +#else +# define MOD(a) a %= BASE +#endif + +/* ========================================================================= */ +uLong ZEXPORT adler32(adler, buf, len) + uLong adler; + const Bytef *buf; + uInt len; +{ + unsigned long s1 = adler & 0xffff; + unsigned long s2 = (adler >> 16) & 0xffff; + int k; + + if (buf == Z_NULL) return 1L; + + while (len > 0) { + k = len < NMAX ? (int)len : NMAX; + len -= k; + while (k >= 16) { + DO16(buf); + buf += 16; + k -= 16; + } + if (k != 0) do { + s1 += *buf++; + s2 += s1; + } while (--k); + MOD(s1); + MOD(s2); + } + return (s2 << 16) | s1; +} diff --git a/klibc/klibc/zlib/algorithm.txt b/klibc/klibc/zlib/algorithm.txt new file mode 100644 index 0000000000..b022dde312 --- /dev/null +++ b/klibc/klibc/zlib/algorithm.txt @@ -0,0 +1,209 @@ +1. Compression algorithm (deflate) + +The deflation algorithm used by gzip (also zip and zlib) is a variation of +LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in +the input data. The second occurrence of a string is replaced by a +pointer to the previous string, in the form of a pair (distance, +length). Distances are limited to 32K bytes, and lengths are limited +to 258 bytes. When a string does not occur anywhere in the previous +32K bytes, it is emitted as a sequence of literal bytes. (In this +description, `string' must be taken as an arbitrary sequence of bytes, +and is not restricted to printable characters.) + +Literals or match lengths are compressed with one Huffman tree, and +match distances are compressed with another tree. The trees are stored +in a compact form at the start of each block. The blocks can have any +size (except that the compressed data for one block must fit in +available memory). A block is terminated when deflate() determines that +it would be useful to start another block with fresh trees. (This is +somewhat similar to the behavior of LZW-based _compress_.) + +Duplicated strings are found using a hash table. All input strings of +length 3 are inserted in the hash table. A hash index is computed for +the next 3 bytes. If the hash chain for this index is not empty, all +strings in the chain are compared with the current input string, and +the longest match is selected. + +The hash chains are searched starting with the most recent strings, to +favor small distances and thus take advantage of the Huffman encoding. +The hash chains are singly linked. There are no deletions from the +hash chains, the algorithm simply discards matches that are too old. + +To avoid a worst-case situation, very long hash chains are arbitrarily +truncated at a certain length, determined by a runtime option (level +parameter of deflateInit). So deflate() does not always find the longest +possible match but generally finds a match which is long enough. + +deflate() also defers the selection of matches with a lazy evaluation +mechanism. After a match of length N has been found, deflate() searches for +a longer match at the next input byte. If a longer match is found, the +previous match is truncated to a length of one (thus producing a single +literal byte) and the process of lazy evaluation begins again. Otherwise, +the original match is kept, and the next match search is attempted only N +steps later. + +The lazy match evaluation is also subject to a runtime parameter. If +the current match is long enough, deflate() reduces the search for a longer +match, thus speeding up the whole process. If compression ratio is more +important than speed, deflate() attempts a complete second search even if +the first match is already long enough. + +The lazy match evaluation is not performed for the fastest compression +modes (level parameter 1 to 3). For these fast modes, new strings +are inserted in the hash table only when no match was found, or +when the match is not too long. This degrades the compression ratio +but saves time since there are both fewer insertions and fewer searches. + + +2. Decompression algorithm (inflate) + +2.1 Introduction + +The key question is how to represent a Huffman code (or any prefix code) so +that you can decode fast. The most important characteristic is that shorter +codes are much more common than longer codes, so pay attention to decoding the +short codes fast, and let the long codes take longer to decode. + +inflate() sets up a first level table that covers some number of bits of +input less than the length of longest code. It gets that many bits from the +stream, and looks it up in the table. The table will tell if the next +code is that many bits or less and how many, and if it is, it will tell +the value, else it will point to the next level table for which inflate() +grabs more bits and tries to decode a longer code. + +How many bits to make the first lookup is a tradeoff between the time it +takes to decode and the time it takes to build the table. If building the +table took no time (and if you had infinite memory), then there would only +be a first level table to cover all the way to the longest code. However, +building the table ends up taking a lot longer for more bits since short +codes are replicated many times in such a table. What inflate() does is +simply to make the number of bits in the first table a variable, and then +to set that variable for the maximum speed. + +For inflate, which has 286 possible codes for the literal/length tree, the size +of the first table is nine bits. Also the distance trees have 30 possible +values, and the size of the first table is six bits. Note that for each of +those cases, the table ended up one bit longer than the ``average'' code +length, i.e. the code length of an approximately flat code which would be a +little more than eight bits for 286 symbols and a little less than five bits +for 30 symbols. + + +2.2 More details on the inflate table lookup + +Ok, you want to know what this cleverly obfuscated inflate tree actually +looks like. You are correct that it's not a Huffman tree. It is simply a +lookup table for the first, let's say, nine bits of a Huffman symbol. The +symbol could be as short as one bit or as long as 15 bits. If a particular +symbol is shorter than nine bits, then that symbol's translation is duplicated +in all those entries that start with that symbol's bits. For example, if the +symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a +symbol is nine bits long, it appears in the table once. + +If the symbol is longer than nine bits, then that entry in the table points +to another similar table for the remaining bits. Again, there are duplicated +entries as needed. The idea is that most of the time the symbol will be short +and there will only be one table look up. (That's whole idea behind data +compression in the first place.) For the less frequent long symbols, there +will be two lookups. If you had a compression method with really long +symbols, you could have as many levels of lookups as is efficient. For +inflate, two is enough. + +So a table entry either points to another table (in which case nine bits in +the above example are gobbled), or it contains the translation for the symbol +and the number of bits to gobble. Then you start again with the next +ungobbled bit. + +You may wonder: why not just have one lookup table for how ever many bits the +longest symbol is? The reason is that if you do that, you end up spending +more time filling in duplicate symbol entries than you do actually decoding. +At least for deflate's output that generates new trees every several 10's of +kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code +would take too long if you're only decoding several thousand symbols. At the +other extreme, you could make a new table for every bit in the code. In fact, +that's essentially a Huffman tree. But then you spend two much time +traversing the tree while decoding, even for short symbols. + +So the number of bits for the first lookup table is a trade of the time to +fill out the table vs. the time spent looking at the second level and above of +the table. + +Here is an example, scaled down: + +The code being decoded, with 10 symbols, from 1 to 6 bits long: + +A: 0 +B: 10 +C: 1100 +D: 11010 +E: 11011 +F: 11100 +G: 11101 +H: 11110 +I: 111110 +J: 111111 + +Let's make the first table three bits long (eight entries): + +000: A,1 +001: A,1 +010: A,1 +011: A,1 +100: B,2 +101: B,2 +110: -> table X (gobble 3 bits) +111: -> table Y (gobble 3 bits) + +Each entry is what the bits decode as and how many bits that is, i.e. how +many bits to gobble. Or the entry points to another table, with the number of +bits to gobble implicit in the size of the table. + +Table X is two bits long since the longest code starting with 110 is five bits +long: + +00: C,1 +01: C,1 +10: D,2 +11: E,2 + +Table Y is three bits long since the longest code starting with 111 is six +bits long: + +000: F,2 +001: F,2 +010: G,2 +011: G,2 +100: H,2 +101: H,2 +110: I,3 +111: J,3 + +So what we have here are three tables with a total of 20 entries that had to +be constructed. That's compared to 64 entries for a single table. Or +compared to 16 entries for a Huffman tree (six two entry tables and one four +entry table). Assuming that the code ideally represents the probability of +the symbols, it takes on the average 1.25 lookups per symbol. That's compared +to one lookup for the single table, or 1.66 lookups per symbol for the +Huffman tree. + +There, I think that gives you a picture of what's going on. For inflate, the +meaning of a particular symbol is often more than just a letter. It can be a +byte (a "literal"), or it can be either a length or a distance which +indicates a base value and a number of bits to fetch after the code that is +added to the base value. Or it might be the special end-of-block code. The +data structures created in inftrees.c try to encode all that information +compactly in the tables. + + +Jean-loup Gailly Mark Adler +jloup@gzip.org madler@alumni.caltech.edu + + +References: + +[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data +Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3, +pp. 337-343. + +``DEFLATE Compressed Data Format Specification'' available in +http://www.ietf.org/rfc/rfc1951.txt diff --git a/klibc/klibc/zlib/compress.c b/klibc/klibc/zlib/compress.c new file mode 100644 index 0000000000..3f4b44266a --- /dev/null +++ b/klibc/klibc/zlib/compress.c @@ -0,0 +1,79 @@ +/* compress.c -- compress a memory buffer + * Copyright (C) 1995-2002 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: compress.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least 0.1% larger than sourceLen plus + 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ +int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; + int level; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; +#ifdef MAXSEG_64K + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; +#endif + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + stream.opaque = (voidpf)0; + + err = deflateInit(&stream, level); + if (err != Z_OK) return err; + + err = deflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + deflateEnd(&stream); + return err == Z_OK ? Z_BUF_ERROR : err; + } + *destLen = stream.total_out; + + err = deflateEnd(&stream); + return err; +} + +/* =========================================================================== + */ +int ZEXPORT compress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); +} + +/* =========================================================================== + If the default memLevel or windowBits for deflateInit() is changed, then + this function needs to be updated. + */ +uLong ZEXPORT compressBound (sourceLen) + uLong sourceLen; +{ + return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; +} diff --git a/klibc/klibc/zlib/crc32.c b/klibc/klibc/zlib/crc32.c new file mode 100644 index 0000000000..0bb9c49ab1 --- /dev/null +++ b/klibc/klibc/zlib/crc32.c @@ -0,0 +1,311 @@ +/* crc32.c -- compute the CRC-32 of a data stream + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Thanks to Rodney Brown for his contribution of faster + * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing + * tables for updating the shift register in one step with three exclusive-ors + * instead of four steps with four exclusive-ors. This results about a factor + * of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. + */ + +/* @(#) $Id: crc32.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#ifdef MAKECRCH +# include +# ifndef DYNAMIC_CRC_TABLE +# define DYNAMIC_CRC_TABLE +# endif /* !DYNAMIC_CRC_TABLE */ +#endif /* MAKECRCH */ + +#include "zutil.h" /* for STDC and FAR definitions */ + +#define local static + +/* Find a four-byte integer type for crc32_little() and crc32_big(). */ +#ifndef NOBYFOUR +# ifdef STDC /* need ANSI C limits.h to determine sizes */ +# include +# define BYFOUR +# if (UINT_MAX == 0xffffffffUL) + typedef unsigned int u4; +# else +# if (ULONG_MAX == 0xffffffffUL) + typedef unsigned long u4; +# else +# if (USHRT_MAX == 0xffffffffUL) + typedef unsigned short u4; +# else +# undef BYFOUR /* can't find a four-byte integer type! */ +# endif +# endif +# endif +# endif /* STDC */ +#endif /* !NOBYFOUR */ + +/* Definitions for doing the crc four data bytes at a time. */ +#ifdef BYFOUR +# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \ + (((w)&0xff00)<<8)+(((w)&0xff)<<24)) + local unsigned long crc32_little OF((unsigned long, + const unsigned char FAR *, unsigned)); + local unsigned long crc32_big OF((unsigned long, + const unsigned char FAR *, unsigned)); +# define TBLS 8 +#else +# define TBLS 1 +#endif /* BYFOUR */ + +#ifdef DYNAMIC_CRC_TABLE + +local int crc_table_empty = 1; +local unsigned long FAR crc_table[TBLS][256]; +local void make_crc_table OF((void)); +#ifdef MAKECRCH + local void write_table OF((FILE *, const unsigned long FAR *)); +#endif /* MAKECRCH */ + +/* + Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: + x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. + + Polynomials over GF(2) are represented in binary, one bit per coefficient, + with the lowest powers in the most significant bit. Then adding polynomials + is just exclusive-or, and multiplying a polynomial by x is a right shift by + one. If we call the above polynomial p, and represent a byte as the + polynomial q, also with the lowest power in the most significant bit (so the + byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, + where a mod b means the remainder after dividing a by b. + + This calculation is done using the shift-register method of multiplying and + taking the remainder. The register is initialized to zero, and for each + incoming bit, x^32 is added mod p to the register if the bit is a one (where + x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by + x (which is shifting right by one and adding x^32 mod p if the bit shifted + out is a one). We start with the highest power (least significant bit) of + q and repeat for all eight bits of q. + + The first table is simply the CRC of all possible eight bit values. This is + all the information needed to generate CRCs on data a byte at a time for all + combinations of CRC register values and incoming bytes. The remaining tables + allow for word-at-a-time CRC calculation for both big-endian and little- + endian machines, where a word is four bytes. +*/ +local void make_crc_table() +{ + unsigned long c; + int n, k; + unsigned long poly; /* polynomial exclusive-or pattern */ + /* terms of polynomial defining this crc (except x^32): */ + static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; + + /* make exclusive-or pattern from polynomial (0xedb88320UL) */ + poly = 0UL; + for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) + poly |= 1UL << (31 - p[n]); + + /* generate a crc for every 8-bit value */ + for (n = 0; n < 256; n++) { + c = (unsigned long)n; + for (k = 0; k < 8; k++) + c = c & 1 ? poly ^ (c >> 1) : c >> 1; + crc_table[0][n] = c; + } + +#ifdef BYFOUR + /* generate crc for each value followed by one, two, and three zeros, and + then the byte reversal of those as well as the first table */ + for (n = 0; n < 256; n++) { + c = crc_table[0][n]; + crc_table[4][n] = REV(c); + for (k = 1; k < 4; k++) { + c = crc_table[0][c & 0xff] ^ (c >> 8); + crc_table[k][n] = c; + crc_table[k + 4][n] = REV(c); + } + } +#endif /* BYFOUR */ + + crc_table_empty = 0; + +#ifdef MAKECRCH + /* write out CRC tables to crc32.h */ + { + FILE *out; + + out = fopen("crc32.h", "w"); + if (out == NULL) return; + fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); + fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); + fprintf(out, "local const unsigned long FAR "); + fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); + write_table(out, crc_table[0]); +# ifdef BYFOUR + fprintf(out, "#ifdef BYFOUR\n"); + for (k = 1; k < 8; k++) { + fprintf(out, " },\n {\n"); + write_table(out, crc_table[k]); + } + fprintf(out, "#endif\n"); +# endif /* BYFOUR */ + fprintf(out, " }\n};\n"); + fclose(out); + } +#endif /* MAKECRCH */ +} + +#ifdef MAKECRCH +local void write_table(out, table) + FILE *out; + const unsigned long FAR *table; +{ + int n; + + for (n = 0; n < 256; n++) + fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], + n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); +} +#endif /* MAKECRCH */ + +#else /* !DYNAMIC_CRC_TABLE */ +/* ======================================================================== + * Tables of CRC-32s of all single-byte values, made by make_crc_table(). + */ +#include "crc32.h" +#endif /* DYNAMIC_CRC_TABLE */ + +/* ========================================================================= + * This function can be used by asm versions of crc32() + */ +const unsigned long FAR * ZEXPORT get_crc_table() +{ +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + return (const unsigned long FAR *)crc_table; +} + +/* ========================================================================= */ +#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) +#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 + +/* ========================================================================= */ +unsigned long ZEXPORT crc32(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + if (buf == Z_NULL) return 0UL; + +#ifdef DYNAMIC_CRC_TABLE + if (crc_table_empty) + make_crc_table(); +#endif /* DYNAMIC_CRC_TABLE */ + +#ifdef BYFOUR + if (sizeof(void *) == sizeof(ptrdiff_t)) { + u4 endian; + + endian = 1; + if (*((unsigned char *)(&endian))) + return crc32_little(crc, buf, len); + else + return crc32_big(crc, buf, len); + } +#endif /* BYFOUR */ + crc = crc ^ 0xffffffffUL; + while (len >= 8) { + DO8; + len -= 8; + } + if (len) do { + DO1; + } while (--len); + return crc ^ 0xffffffffUL; +} + +#ifdef BYFOUR + +/* ========================================================================= */ +#define DOLIT4 c ^= *buf4++; \ + c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ + crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] +#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 + +/* ========================================================================= */ +local unsigned long crc32_little(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = (u4)crc; + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + len--; + } + + buf4 = (const u4 FAR *)buf; + while (len >= 32) { + DOLIT32; + len -= 32; + } + while (len >= 4) { + DOLIT4; + len -= 4; + } + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + } while (--len); + c = ~c; + return (unsigned long)c; +} + +/* ========================================================================= */ +#define DOBIG4 c ^= *++buf4; \ + c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] +#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 + +/* ========================================================================= */ +local unsigned long crc32_big(crc, buf, len) + unsigned long crc; + const unsigned char FAR *buf; + unsigned len; +{ + register u4 c; + register const u4 FAR *buf4; + + c = REV((u4)crc); + c = ~c; + while (len && ((ptrdiff_t)buf & 3)) { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + len--; + } + + buf4 = (const u4 FAR *)buf; + buf4--; + while (len >= 32) { + DOBIG32; + len -= 32; + } + while (len >= 4) { + DOBIG4; + len -= 4; + } + buf4++; + buf = (const unsigned char FAR *)buf4; + + if (len) do { + c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + } while (--len); + c = ~c; + return (unsigned long)(REV(c)); +} + +#endif /* BYFOUR */ diff --git a/klibc/klibc/zlib/crc32.h b/klibc/klibc/zlib/crc32.h new file mode 100644 index 0000000000..8053b6117c --- /dev/null +++ b/klibc/klibc/zlib/crc32.h @@ -0,0 +1,441 @@ +/* crc32.h -- tables for rapid CRC calculation + * Generated automatically by crc32.c + */ + +local const unsigned long FAR crc_table[TBLS][256] = +{ + { + 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, + 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, + 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, + 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, + 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, + 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, + 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, + 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, + 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, + 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, + 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, + 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, + 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, + 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, + 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, + 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, + 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, + 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, + 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, + 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, + 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, + 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, + 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, + 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, + 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, + 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, + 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, + 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, + 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, + 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, + 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, + 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, + 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, + 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, + 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, + 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, + 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, + 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, + 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, + 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, + 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, + 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, + 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, + 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, + 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, + 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, + 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, + 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, + 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, + 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, + 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, + 0x2d02ef8dUL +#ifdef BYFOUR + }, + { + 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, + 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, + 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, + 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, + 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, + 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, + 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, + 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, + 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, + 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, + 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, + 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, + 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, + 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, + 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, + 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, + 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, + 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, + 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, + 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, + 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, + 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, + 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, + 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, + 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, + 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, + 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, + 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, + 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, + 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, + 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, + 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, + 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, + 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, + 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, + 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, + 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, + 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, + 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, + 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, + 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, + 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, + 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, + 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, + 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, + 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, + 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, + 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, + 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, + 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, + 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, + 0x9324fd72UL + }, + { + 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, + 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, + 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, + 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, + 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, + 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, + 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, + 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, + 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, + 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, + 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, + 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, + 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, + 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, + 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, + 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, + 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, + 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, + 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, + 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, + 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, + 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, + 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, + 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, + 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, + 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, + 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, + 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, + 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, + 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, + 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, + 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, + 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, + 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, + 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, + 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, + 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, + 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, + 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, + 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, + 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, + 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, + 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, + 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, + 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, + 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, + 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, + 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, + 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, + 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, + 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, + 0xbe9834edUL + }, + { + 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, + 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, + 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, + 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, + 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, + 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, + 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, + 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, + 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, + 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, + 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, + 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, + 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, + 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, + 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, + 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, + 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, + 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, + 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, + 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, + 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, + 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, + 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, + 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, + 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, + 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, + 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, + 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, + 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, + 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, + 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, + 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, + 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, + 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, + 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, + 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, + 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, + 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, + 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, + 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, + 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, + 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, + 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, + 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, + 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, + 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, + 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, + 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, + 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, + 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, + 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, + 0xde0506f1UL + }, + { + 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, + 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, + 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, + 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, + 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, + 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, + 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, + 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, + 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, + 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, + 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, + 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, + 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, + 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, + 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, + 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, + 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, + 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, + 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, + 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, + 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, + 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, + 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, + 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, + 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, + 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, + 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, + 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, + 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, + 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, + 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, + 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, + 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, + 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, + 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, + 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, + 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, + 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, + 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, + 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, + 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, + 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, + 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, + 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, + 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, + 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, + 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, + 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, + 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, + 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, + 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, + 0x8def022dUL + }, + { + 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, + 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, + 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, + 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, + 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, + 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, + 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, + 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, + 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, + 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, + 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, + 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, + 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, + 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, + 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, + 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, + 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, + 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, + 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, + 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, + 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, + 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, + 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, + 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, + 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, + 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, + 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, + 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, + 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, + 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, + 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, + 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, + 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, + 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, + 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, + 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, + 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, + 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, + 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, + 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, + 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, + 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, + 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, + 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, + 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, + 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, + 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, + 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, + 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, + 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, + 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, + 0x72fd2493UL + }, + { + 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, + 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, + 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, + 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, + 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, + 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, + 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, + 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, + 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, + 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, + 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, + 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, + 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, + 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, + 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, + 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, + 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, + 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, + 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, + 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, + 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, + 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, + 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, + 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, + 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, + 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, + 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, + 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, + 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, + 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, + 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, + 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, + 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, + 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, + 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, + 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, + 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, + 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, + 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, + 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, + 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, + 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, + 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, + 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, + 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, + 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, + 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, + 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, + 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, + 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, + 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, + 0xed3498beUL + }, + { + 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, + 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, + 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, + 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, + 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, + 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, + 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, + 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, + 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, + 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, + 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, + 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, + 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, + 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, + 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, + 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, + 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, + 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, + 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, + 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, + 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, + 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, + 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, + 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, + 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, + 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, + 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, + 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, + 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, + 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, + 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, + 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, + 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, + 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, + 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, + 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, + 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, + 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, + 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, + 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, + 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, + 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, + 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, + 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, + 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, + 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, + 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, + 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, + 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, + 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, + 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, + 0xf10605deUL +#endif + } +}; diff --git a/klibc/klibc/zlib/deflate.c b/klibc/klibc/zlib/deflate.c new file mode 100644 index 0000000000..fe07dcb673 --- /dev/null +++ b/klibc/klibc/zlib/deflate.c @@ -0,0 +1,1502 @@ +/* deflate.c -- compress data using the deflation algorithm + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process depends on being able to identify portions + * of the input text which are identical to earlier input (within a + * sliding window trailing behind the input currently being processed). + * + * The most straightforward technique turns out to be the fastest for + * most input files: try all possible matches and select the longest. + * The key feature of this algorithm is that insertions into the string + * dictionary are very simple and thus fast, and deletions are avoided + * completely. Insertions are performed at each input character, whereas + * string matches are performed only when the previous match ends. So it + * is preferable to spend more time in matches to allow very fast string + * insertions and avoid deletions. The matching algorithm for small + * strings is inspired from that of Rabin & Karp. A brute force approach + * is used to find longer strings when a small match has been found. + * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze + * (by Leonid Broukhis). + * A previous version of this file used a more sophisticated algorithm + * (by Fiala and Greene) which is guaranteed to run in linear amortized + * time, but has a larger average cost, uses more memory and is patented. + * However the F&G algorithm may be faster for some highly redundant + * files if the parameter max_chain_length (described below) is too large. + * + * ACKNOWLEDGEMENTS + * + * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and + * I found it in 'freeze' written by Leonid Broukhis. + * Thanks to many people for bug reports and testing. + * + * REFERENCES + * + * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". + * Available in http://www.ietf.org/rfc/rfc1951.txt + * + * A description of the Rabin and Karp algorithm is given in the book + * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. + * + * Fiala,E.R., and Greene,D.H. + * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 + * + */ + +/* @(#) $Id: deflate.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#include "deflate.h" + +const char deflate_copyright[] = + " deflate 1.2.1 Copyright 1995-2003 Jean-loup Gailly "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* =========================================================================== + * Function prototypes. + */ +typedef enum { + need_more, /* block not completed, need more input or more output */ + block_done, /* block flush performed */ + finish_started, /* finish started, need only more output at next deflate */ + finish_done /* finish done, accept no more input or output */ +} block_state; + +typedef block_state (*compress_func) OF((deflate_state *s, int flush)); +/* Compression function. Returns the block state after the call. */ + +local void fill_window OF((deflate_state *s)); +local block_state deflate_stored OF((deflate_state *s, int flush)); +local block_state deflate_fast OF((deflate_state *s, int flush)); +#ifndef FASTEST +local block_state deflate_slow OF((deflate_state *s, int flush)); +#endif +local void lm_init OF((deflate_state *s)); +local void putShortMSB OF((deflate_state *s, uInt b)); +local void flush_pending OF((z_streamp strm)); +local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); +#ifndef FASTEST +#ifdef ASMV + void match_init OF((void)); /* asm code initialization */ + uInt longest_match OF((deflate_state *s, IPos cur_match)); +#else +local uInt longest_match OF((deflate_state *s, IPos cur_match)); +#endif +#endif +local uInt longest_match_fast OF((deflate_state *s, IPos cur_match)); + +#ifdef DEBUG +local void check_match OF((deflate_state *s, IPos start, IPos match, + int length)); +#endif + +/* =========================================================================== + * Local data + */ + +#define NIL 0 +/* Tail of hash chains */ + +#ifndef TOO_FAR +# define TOO_FAR 4096 +#endif +/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +typedef struct config_s { + ush good_length; /* reduce lazy search above this match length */ + ush max_lazy; /* do not perform lazy search above this match length */ + ush nice_length; /* quit search above this match length */ + ush max_chain; + compress_func func; +} config; + +#ifdef FASTEST +local const config configuration_table[2] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ +#else +local const config configuration_table[10] = { +/* good lazy nice chain */ +/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ +/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ +/* 2 */ {4, 5, 16, 8, deflate_fast}, +/* 3 */ {4, 6, 32, 32, deflate_fast}, + +/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ +/* 5 */ {8, 16, 32, 32, deflate_slow}, +/* 6 */ {8, 16, 128, 128, deflate_slow}, +/* 7 */ {8, 32, 128, 256, deflate_slow}, +/* 8 */ {32, 128, 258, 1024, deflate_slow}, +/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ +#endif + +/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 + * For deflate_fast() (levels <= 3) good is ignored and lazy has a different + * meaning. + */ + +#define EQUAL 0 +/* result of memcmp for equal strings */ + +#ifndef NO_DUMMY_DECL +struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ +#endif + +/* =========================================================================== + * Update a hash value with the given input byte + * IN assertion: all calls to to UPDATE_HASH are made with consecutive + * input characters, so that a running hash key can be computed from the + * previous key instead of complete recalculation each time. + */ +#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) + + +/* =========================================================================== + * Insert string str in the dictionary and set match_head to the previous head + * of the hash chain (the most recent string with same hash key). Return + * the previous length of the hash chain. + * If this file is compiled with -DFASTEST, the compression level is forced + * to 1, and no hash chains are maintained. + * IN assertion: all calls to to INSERT_STRING are made with consecutive + * input characters and the first MIN_MATCH bytes of str are valid + * (except for the last MIN_MATCH-1 bytes of the input file). + */ +#ifdef FASTEST +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#else +#define INSERT_STRING(s, str, match_head) \ + (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ + match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ + s->head[s->ins_h] = (Pos)(str)) +#endif + +/* =========================================================================== + * Initialize the hash table (avoiding 64K overflow for 16 bit systems). + * prev[] will be initialized on the fly. + */ +#define CLEAR_HASH(s) \ + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + +/* ========================================================================= */ +int ZEXPORT deflateInit_(strm, level, version, stream_size) + z_streamp strm; + int level; + const char *version; + int stream_size; +{ + return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, + Z_DEFAULT_STRATEGY, version, stream_size); + /* To do: ignore strm->next_in if we use it as window */ +} + +/* ========================================================================= */ +int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, + version, stream_size) + z_streamp strm; + int level; + int method; + int windowBits; + int memLevel; + int strategy; + const char *version; + int stream_size; +{ + deflate_state *s; + int wrap = 1; + static const char my_version[] = ZLIB_VERSION; + + ushf *overlay; + /* We overlay pending_buf and d_buf+l_buf. This works since the average + * output size for (length,distance) codes is <= 24 bits. + */ + + if (version == Z_NULL || version[0] != my_version[0] || + stream_size != sizeof(z_stream)) { + return Z_VERSION_ERROR; + } + if (strm == Z_NULL) return Z_STREAM_ERROR; + + strm->msg = Z_NULL; + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } +#ifdef GZIP + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } +#endif + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_RLE) { + return Z_STREAM_ERROR; + } + if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ + s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); + if (s == Z_NULL) return Z_MEM_ERROR; + strm->state = (struct internal_state FAR *)s; + s->strm = strm; + + s->wrap = wrap; + s->w_bits = windowBits; + s->w_size = 1 << s->w_bits; + s->w_mask = s->w_size - 1; + + s->hash_bits = memLevel + 7; + s->hash_size = 1 << s->hash_bits; + s->hash_mask = s->hash_size - 1; + s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); + + s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); + s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); + s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); + + s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + s->pending_buf = (uchf *) overlay; + s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); + + if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || + s->pending_buf == Z_NULL) { + s->status = FINISH_STATE; + strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); + deflateEnd (strm); + return Z_MEM_ERROR; + } + s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + + s->level = level; + s->strategy = strategy; + s->method = (Byte)method; + + return deflateReset(strm); +} + +/* ========================================================================= */ +int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) + z_streamp strm; + const Bytef *dictionary; + uInt dictLength; +{ + deflate_state *s; + uInt length = dictLength; + uInt n; + IPos hash_head = 0; + + if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || + strm->state->wrap == 2 || + (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) + return Z_STREAM_ERROR; + + s = strm->state; + if (s->wrap) + strm->adler = adler32(strm->adler, dictionary, dictLength); + + if (length < MIN_MATCH) return Z_OK; + if (length > MAX_DIST(s)) { + length = MAX_DIST(s); +#ifndef USE_DICT_HEAD + dictionary += dictLength - length; /* use the tail of the dictionary */ +#endif + } + zmemcpy(s->window, dictionary, length); + s->strstart = length; + s->block_start = (long)length; + + /* Insert all strings in the hash table (except for the last two bytes). + * s->lookahead stays null, so s->ins_h will be recomputed at the next + * call of fill_window. + */ + s->ins_h = s->window[0]; + UPDATE_HASH(s, s->ins_h, s->window[1]); + for (n = 0; n <= length - MIN_MATCH; n++) { + INSERT_STRING(s, n, hash_head); + } + if (hash_head) hash_head = 0; /* to make compiler happy */ + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateReset (strm) + z_streamp strm; +{ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { + return Z_STREAM_ERROR; + } + + strm->total_in = strm->total_out = 0; + strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ + strm->data_type = Z_UNKNOWN; + + s = (deflate_state *)strm->state; + s->pending = 0; + s->pending_out = s->pending_buf; + + if (s->wrap < 0) { + s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ + } + s->status = s->wrap ? INIT_STATE : BUSY_STATE; + strm->adler = +#ifdef GZIP + s->wrap == 2 ? crc32(0L, Z_NULL, 0) : +#endif + adler32(0L, Z_NULL, 0); + s->last_flush = Z_NO_FLUSH; + + _tr_init(s); + lm_init(s); + + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflatePrime (strm, bits, value) + z_streamp strm; + int bits; + int value; +{ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + strm->state->bi_valid = bits; + strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); + return Z_OK; +} + +/* ========================================================================= */ +int ZEXPORT deflateParams(strm, level, strategy) + z_streamp strm; + int level; + int strategy; +{ + deflate_state *s; + compress_func func; + int err = Z_OK; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + s = strm->state; + +#ifdef FASTEST + if (level != 0) level = 1; +#else + if (level == Z_DEFAULT_COMPRESSION) level = 6; +#endif + if (level < 0 || level > 9 || strategy < 0 || strategy > Z_RLE) { + return Z_STREAM_ERROR; + } + func = configuration_table[s->level].func; + + if (func != configuration_table[level].func && strm->total_in != 0) { + /* Flush the last buffer: */ + err = deflate(strm, Z_PARTIAL_FLUSH); + } + if (s->level != level) { + s->level = level; + s->max_lazy_match = configuration_table[level].max_lazy; + s->good_match = configuration_table[level].good_length; + s->nice_match = configuration_table[level].nice_length; + s->max_chain_length = configuration_table[level].max_chain; + } + s->strategy = strategy; + return err; +} + +/* ========================================================================= + * For the default windowBits of 15 and memLevel of 8, this function returns + * a close to exact, as well as small, upper bound on the compressed size. + * They are coded as constants here for a reason--if the #define's are + * changed, then this function needs to be changed as well. The return + * value for 15 and 8 only works for those exact settings. + * + * For any setting other than those defaults for windowBits and memLevel, + * the value returned is a conservative worst case for the maximum expansion + * resulting from using fixed blocks instead of stored blocks, which deflate + * can emit on compressed data for some combinations of the parameters. + * + * This function could be more sophisticated to provide closer upper bounds + * for every combination of windowBits and memLevel, as well as wrap. + * But even the conservative upper bound of about 14% expansion does not + * seem onerous for output buffer allocation. + */ +uLong ZEXPORT deflateBound(strm, sourceLen) + z_streamp strm; + uLong sourceLen; +{ + deflate_state *s; + uLong destLen; + + /* conservative upper bound */ + destLen = sourceLen + + ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11; + + /* if can't get parameters, return conservative bound */ + if (strm == Z_NULL || strm->state == Z_NULL) + return destLen; + + /* if not default parameters, return conservative bound */ + s = strm->state; + if (s->w_bits != 15 || s->hash_bits != 8 + 7) + return destLen; + + /* default settings: return tight bound for that case */ + return compressBound(sourceLen); +} + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +local void putShortMSB (s, b) + deflate_state *s; + uInt b; +{ + put_byte(s, (Byte)(b >> 8)); + put_byte(s, (Byte)(b & 0xff)); +} + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->next_out buffer and copying into it. + * (See also read_buf()). + */ +local void flush_pending(strm) + z_streamp strm; +{ + unsigned len = strm->state->pending; + + if (len > strm->avail_out) len = strm->avail_out; + if (len == 0) return; + + zmemcpy(strm->next_out, strm->state->pending_out, len); + strm->next_out += len; + strm->state->pending_out += len; + strm->total_out += len; + strm->avail_out -= len; + strm->state->pending -= len; + if (strm->state->pending == 0) { + strm->state->pending_out = strm->state->pending_buf; + } +} + +/* ========================================================================= */ +int ZEXPORT deflate (strm, flush) + z_streamp strm; + int flush; +{ + int old_flush; /* value of flush param for previous deflate call */ + deflate_state *s; + + if (strm == Z_NULL || strm->state == Z_NULL || + flush > Z_FINISH || flush < 0) { + return Z_STREAM_ERROR; + } + s = strm->state; + + if (strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0) || + (s->status == FINISH_STATE && flush != Z_FINISH)) { + ERR_RETURN(strm, Z_STREAM_ERROR); + } + if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); + + s->strm = strm; /* just in case */ + old_flush = s->last_flush; + s->last_flush = flush; + + /* Write the header */ + if (s->status == INIT_STATE) { +#ifdef GZIP + if (s->wrap == 2) { + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s->level == 9 ? 2 : + (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? + 4 : 0)); + put_byte(s, 255); + s->status = BUSY_STATE; + strm->adler = crc32(0L, Z_NULL, 0); + } + else +#endif + { + uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; + uInt level_flags; + + if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) + level_flags = 0; + else if (s->level < 6) + level_flags = 1; + else if (s->level == 6) + level_flags = 2; + else + level_flags = 3; + header |= (level_flags << 6); + if (s->strstart != 0) header |= PRESET_DICT; + header += 31 - (header % 31); + + s->status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s->strstart != 0) { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + strm->adler = adler32(0L, Z_NULL, 0); + } + } + + /* Flush as much pending output as possible */ + if (s->pending != 0) { + flush_pending(strm); + if (strm->avail_out == 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s->last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm->avail_in == 0 && flush <= old_flush && + flush != Z_FINISH) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s->status == FINISH_STATE && strm->avail_in != 0) { + ERR_RETURN(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm->avail_in != 0 || s->lookahead != 0 || + (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { + block_state bstate; + + bstate = (*(configuration_table[s->level].func))(s, flush); + + if (bstate == finish_started || bstate == finish_done) { + s->status = FINISH_STATE; + } + if (bstate == need_more || bstate == finish_started) { + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate == block_done) { + if (flush == Z_PARTIAL_FLUSH) { + _tr_align(s); + } else { /* FULL_FLUSH or SYNC_FLUSH */ + _tr_stored_block(s, (char*)0, 0L, 0); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush == Z_FULL_FLUSH) { + CLEAR_HASH(s); /* forget history */ + } + } + flush_pending(strm); + if (strm->avail_out == 0) { + s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + Assert(strm->avail_out > 0, "bug2"); + + if (flush != Z_FINISH) return Z_OK; + if (s->wrap <= 0) return Z_STREAM_END; + + /* Write the trailer */ +#ifdef GZIP + if (s->wrap == 2) { + put_byte(s, (Byte)(strm->adler & 0xff)); + put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); + put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); + put_byte(s, (Byte)(strm->total_in & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); + put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); + } + else +#endif + { + putShortMSB(s, (uInt)(strm->adler >> 16)); + putShortMSB(s, (uInt)(strm->adler & 0xffff)); + } + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ + return s->pending != 0 ? Z_OK : Z_STREAM_END; +} + +/* ========================================================================= */ +int ZEXPORT deflateEnd (strm) + z_streamp strm; +{ + int status; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + + status = strm->state->status; + if (status != INIT_STATE && status != BUSY_STATE && + status != FINISH_STATE) { + return Z_STREAM_ERROR; + } + + /* Deallocate in reverse order of allocations: */ + TRY_FREE(strm, strm->state->pending_buf); + TRY_FREE(strm, strm->state->head); + TRY_FREE(strm, strm->state->prev); + TRY_FREE(strm, strm->state->window); + + ZFREE(strm, strm->state); + strm->state = Z_NULL; + + return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; +} + +/* ========================================================================= + * Copy the source state to the destination state. + * To simplify the source, this is not supported for 16-bit MSDOS (which + * doesn't have enough memory anyway to duplicate compression states). + */ +int ZEXPORT deflateCopy (dest, source) + z_streamp dest; + z_streamp source; +{ +#ifdef MAXSEG_64K + return Z_STREAM_ERROR; +#else + deflate_state *ds; + deflate_state *ss; + ushf *overlay; + + + if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { + return Z_STREAM_ERROR; + } + + ss = source->state; + + *dest = *source; + + ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); + if (ds == Z_NULL) return Z_MEM_ERROR; + dest->state = (struct internal_state FAR *) ds; + *ds = *ss; + ds->strm = dest; + + ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); + ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); + ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); + overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); + ds->pending_buf = (uchf *) overlay; + + if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || + ds->pending_buf == Z_NULL) { + deflateEnd (dest); + return Z_MEM_ERROR; + } + /* following zmemcpy do not work for 16-bit MSDOS */ + zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); + zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); + zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); + zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); + + ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); + ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); + ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; + + ds->l_desc.dyn_tree = ds->dyn_ltree; + ds->d_desc.dyn_tree = ds->dyn_dtree; + ds->bl_desc.dyn_tree = ds->bl_tree; + + return Z_OK; +#endif /* MAXSEG_64K */ +} + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->next_in buffer and copying from it. + * (See also flush_pending()). + */ +local int read_buf(strm, buf, size) + z_streamp strm; + Bytef *buf; + unsigned size; +{ + unsigned len = strm->avail_in; + + if (len > size) len = size; + if (len == 0) return 0; + + strm->avail_in -= len; + + if (strm->state->wrap == 1) { + strm->adler = adler32(strm->adler, strm->next_in, len); + } +#ifdef GZIP + else if (strm->state->wrap == 2) { + strm->adler = crc32(strm->adler, strm->next_in, len); + } +#endif + zmemcpy(buf, strm->next_in, len); + strm->next_in += len; + strm->total_in += len; + + return (int)len; +} + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +local void lm_init (s) + deflate_state *s; +{ + s->window_size = (ulg)2L*s->w_size; + + CLEAR_HASH(s); + + /* Set the default configuration parameters: + */ + s->max_lazy_match = configuration_table[s->level].max_lazy; + s->good_match = configuration_table[s->level].good_length; + s->nice_match = configuration_table[s->level].nice_length; + s->max_chain_length = configuration_table[s->level].max_chain; + + s->strstart = 0; + s->block_start = 0L; + s->lookahead = 0; + s->match_length = s->prev_length = MIN_MATCH-1; + s->match_available = 0; + s->ins_h = 0; +#ifdef ASMV + match_init(); /* initialize the asm code */ +#endif +} + +#ifndef FASTEST +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +#ifndef ASMV +/* For 80x86 and 680x0, an optimized version will be provided in match.asm or + * match.S. The code will be functionally equivalent. + */ +local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + int best_len = s->prev_length; /* best match length so far */ + int nice_match = s->nice_match; /* stop if match long enough */ + IPos limit = s->strstart > (IPos)MAX_DIST(s) ? + s->strstart - (IPos)MAX_DIST(s) : NIL; + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + Posf *prev = s->prev; + uInt wmask = s->w_mask; + +#ifdef UNALIGNED_OK + /* Compare two bytes at a time. Note: this is not always beneficial. + * Try with and without -DUNALIGNED_OK to check. + */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; + register ush scan_start = *(ushf*)scan; + register ush scan_end = *(ushf*)(scan+best_len-1); +#else + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + register Byte scan_end1 = scan[best_len-1]; + register Byte scan_end = scan[best_len]; +#endif + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s->prev_length >= s->good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + Assert(cur_match < s->strstart, "no future"); + match = s->window + cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2: + */ +#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) + /* This code assumes sizeof(unsigned short) == 2. Do not use + * UNALIGNED_OK if your compiler uses a different size. + */ + if (*(ushf*)(match+best_len-1) != scan_end || + *(ushf*)match != scan_start) continue; + + /* It is not necessary to compare scan[2] and match[2] since they are + * always equal when the other bytes match, given that the hash keys + * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at + * strstart+3, +5, ... up to strstart+257. We check for insufficient + * lookahead only every 4th comparison; the 128th check will be made + * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is + * necessary to put more guard bytes at the end of the window, or + * to check more often for insufficient lookahead. + */ + Assert(scan[2] == match[2], "scan[2]?"); + scan++, match++; + do { + } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + *(ushf*)(scan+=2) == *(ushf*)(match+=2) && + scan < strend); + /* The funny "do {}" generates better code on most compilers */ + + /* Here, scan <= window+strstart+257 */ + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + if (*scan == *match) scan++; + + len = (MAX_MATCH - 1) - (int)(strend-scan); + scan = strend - (MAX_MATCH-1); + +#else /* UNALIGNED_OK */ + + if (match[best_len] != scan_end || + match[best_len-1] != scan_end1 || + *match != *scan || + *++match != scan[1]) continue; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match++; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + scan = strend - MAX_MATCH; + +#endif /* UNALIGNED_OK */ + + if (len > best_len) { + s->match_start = cur_match; + best_len = len; + if (len >= nice_match) break; +#ifdef UNALIGNED_OK + scan_end = *(ushf*)(scan+best_len-1); +#else + scan_end1 = scan[best_len-1]; + scan_end = scan[best_len]; +#endif + } + } while ((cur_match = prev[cur_match & wmask]) > limit + && --chain_length != 0); + + if ((uInt)best_len <= s->lookahead) return (uInt)best_len; + return s->lookahead; +} +#endif /* ASMV */ +#endif /* FASTEST */ + +/* --------------------------------------------------------------------------- + * Optimized version for level == 1 or strategy == Z_RLE only + */ +local uInt longest_match_fast(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ +{ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ + register int len; /* length of current match */ + register Bytef *strend = s->window + s->strstart + MAX_MATCH; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + Assert(cur_match < s->strstart, "no future"); + + match = s->window + cur_match; + + /* Return failure if the match length is less than 2: + */ + if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2, match += 2; + Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + } while (*++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + *++scan == *++match && *++scan == *++match && + scan < strend); + + Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (int)(strend - scan); + + if (len < MIN_MATCH) return MIN_MATCH - 1; + + s->match_start = cur_match; + return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; +} + +#ifdef DEBUG +/* =========================================================================== + * Check that the match at match_start is indeed a match. + */ +local void check_match(s, start, match, length) + deflate_state *s; + IPos start, match; + int length; +{ + /* check that the match is indeed a match */ + if (zmemcmp(s->window + match, + s->window + start, length) != EQUAL) { + fprintf(stderr, " start %u, match %u, length %d\n", + start, match, length); + do { + fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); + } while (--length != 0); + z_error("invalid match"); + } + if (z_verbose > 1) { + fprintf(stderr,"\\[%d,%d]", start-match, length); + do { putc(s->window[start++], stderr); } while (--length != 0); + } +} +#else +# define check_match(s, start, match, length) +#endif /* DEBUG */ + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +local void fill_window(s) + deflate_state *s; +{ + register unsigned n, m; + register Posf *p; + unsigned more; /* Amount of free space at the end of the window. */ + uInt wsize = s->w_size; + + do { + more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); + + /* Deal with !@#$% 64K limit: */ + if (sizeof(int) <= 2) { + if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + more = wsize; + + } else if (more == (unsigned)(-1)) { + /* Very unlikely, but possible on 16 bit machine if + * strstart == 0 && lookahead == 1 (input done a byte at time) + */ + more--; + } + } + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s->strstart >= wsize+MAX_DIST(s)) { + + zmemcpy(s->window, s->window+wsize, (unsigned)wsize); + s->match_start -= wsize; + s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ + s->block_start -= (long) wsize; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + n = s->hash_size; + p = &s->head[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + } while (--n); + + n = wsize; +#ifndef FASTEST + p = &s->prev[n]; + do { + m = *--p; + *p = (Pos)(m >= wsize ? m-wsize : NIL); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); +#endif + more += wsize; + } + if (s->strm->avail_in == 0) return; + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + Assert(more >= 2, "more < 2"); + + n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); + s->lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s->lookahead >= MIN_MATCH) { + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); +} + +/* =========================================================================== + * Flush the current block, with given end-of-file flag. + * IN assertion: strstart is set to the end of the current match. + */ +#define FLUSH_BLOCK_ONLY(s, eof) { \ + _tr_flush_block(s, (s->block_start >= 0L ? \ + (charf *)&s->window[(unsigned)s->block_start] : \ + (charf *)Z_NULL), \ + (ulg)((long)s->strstart - s->block_start), \ + (eof)); \ + s->block_start = s->strstart; \ + flush_pending(s->strm); \ + Tracev((stderr,"[FLUSH]")); \ +} + +/* Same but force premature exit if necessary. */ +#define FLUSH_BLOCK(s, eof) { \ + FLUSH_BLOCK_ONLY(s, eof); \ + if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \ +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +local block_state deflate_stored(s, flush) + deflate_state *s; + int flush; +{ + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + ulg max_block_size = 0xffff; + ulg max_start; + + if (max_block_size > s->pending_buf_size - 5) { + max_block_size = s->pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s->lookahead <= 1) { + + Assert(s->strstart < s->w_size+MAX_DIST(s) || + s->block_start >= (long)s->w_size, "slide too late"); + + fill_window(s); + if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; + + if (s->lookahead == 0) break; /* flush the current block */ + } + Assert(s->block_start >= 0L, "block gone"); + + s->strstart += s->lookahead; + s->lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + max_start = s->block_start + max_block_size; + if (s->strstart == 0 || (ulg)s->strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s->lookahead = (uInt)(s->strstart - max_start); + s->strstart = (uInt)max_start; + FLUSH_BLOCK(s, 0); + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { + FLUSH_BLOCK(s, 0); + } + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +local block_state deflate_fast(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head = NIL; /* head of the hash chain */ + int bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ +#ifdef FASTEST + if ((s->strategy < Z_HUFFMAN_ONLY) || + (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { + s->match_length = longest_match_fast (s, hash_head); + } +#else + if (s->strategy < Z_HUFFMAN_ONLY) { + s->match_length = longest_match (s, hash_head); + } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { + s->match_length = longest_match_fast (s, hash_head); + } +#endif + /* longest_match() or longest_match_fast() sets match_start */ + } + if (s->match_length >= MIN_MATCH) { + check_match(s, s->strstart, s->match_start, s->match_length); + + _tr_tally_dist(s, s->strstart - s->match_start, + s->match_length - MIN_MATCH, bflush); + + s->lookahead -= s->match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ +#ifndef FASTEST + if (s->match_length <= s->max_insert_length && + s->lookahead >= MIN_MATCH) { + s->match_length--; /* string at strstart already in table */ + do { + s->strstart++; + INSERT_STRING(s, s->strstart, hash_head); + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s->match_length != 0); + s->strstart++; + } else +#endif + { + s->strstart += s->match_length; + s->match_length = 0; + s->ins_h = s->window[s->strstart]; + UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); +#if MIN_MATCH != 3 + Call UPDATE_HASH() MIN_MATCH-3 more times +#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + Tracevv((stderr,"%c", s->window[s->strstart])); + _tr_tally_lit (s, s->window[s->strstart], bflush); + s->lookahead--; + s->strstart++; + } + if (bflush) FLUSH_BLOCK(s, 0); + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} + +#ifndef FASTEST +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +local block_state deflate_slow(s, flush) + deflate_state *s; + int flush; +{ + IPos hash_head = NIL; /* head of hash chain */ + int bflush; /* set if current block must be flushed */ + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s->lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { + return need_more; + } + if (s->lookahead == 0) break; /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + if (s->lookahead >= MIN_MATCH) { + INSERT_STRING(s, s->strstart, hash_head); + } + + /* Find the longest match, discarding those <= prev_length. + */ + s->prev_length = s->match_length, s->prev_match = s->match_start; + s->match_length = MIN_MATCH-1; + + if (hash_head != NIL && s->prev_length < s->max_lazy_match && + s->strstart - hash_head <= MAX_DIST(s)) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + if (s->strategy < Z_HUFFMAN_ONLY) { + s->match_length = longest_match (s, hash_head); + } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { + s->match_length = longest_match_fast (s, hash_head); + } + /* longest_match() or longest_match_fast() sets match_start */ + + if (s->match_length <= 5 && (s->strategy == Z_FILTERED +#if TOO_FAR <= 32767 + || (s->match_length == MIN_MATCH && + s->strstart - s->match_start > TOO_FAR) +#endif + )) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s->match_length = MIN_MATCH-1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { + uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + check_match(s, s->strstart-1, s->prev_match, s->prev_length); + + _tr_tally_dist(s, s->strstart -1 - s->prev_match, + s->prev_length - MIN_MATCH, bflush); + + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s->lookahead -= s->prev_length-1; + s->prev_length -= 2; + do { + if (++s->strstart <= max_insert) { + INSERT_STRING(s, s->strstart, hash_head); + } + } while (--s->prev_length != 0); + s->match_available = 0; + s->match_length = MIN_MATCH-1; + s->strstart++; + + if (bflush) FLUSH_BLOCK(s, 0); + + } else if (s->match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + if (bflush) { + FLUSH_BLOCK_ONLY(s, 0); + } + s->strstart++; + s->lookahead--; + if (s->strm->avail_out == 0) return need_more; + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s->match_available = 1; + s->strstart++; + s->lookahead--; + } + } + Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s->match_available) { + Tracevv((stderr,"%c", s->window[s->strstart-1])); + _tr_tally_lit(s, s->window[s->strstart-1], bflush); + s->match_available = 0; + } + FLUSH_BLOCK(s, flush == Z_FINISH); + return flush == Z_FINISH ? finish_done : block_done; +} +#endif /* FASTEST */ diff --git a/klibc/klibc/zlib/deflate.h b/klibc/klibc/zlib/deflate.h new file mode 100644 index 0000000000..bc79532e59 --- /dev/null +++ b/klibc/klibc/zlib/deflate.h @@ -0,0 +1,326 @@ +/* deflate.h -- internal compression state + * Copyright (C) 1995-2002 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id: deflate.h,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#ifndef DEFLATE_H +#define DEFLATE_H + +#include "zutil.h" + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer creation by deflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip encoding + should be left enabled. */ +#ifndef NO_GZIP +# define GZIP +#endif + +/* =========================================================================== + * Internal compression state. + */ + +#define LENGTH_CODES 29 +/* number of length codes, not counting the special END_BLOCK code */ + +#define LITERALS 256 +/* number of literal bytes 0..255 */ + +#define L_CODES (LITERALS+1+LENGTH_CODES) +/* number of Literal or Length codes, including the END_BLOCK code */ + +#define D_CODES 30 +/* number of distance codes */ + +#define BL_CODES 19 +/* number of codes used to transfer the bit lengths */ + +#define HEAP_SIZE (2*L_CODES+1) +/* maximum heap size */ + +#define MAX_BITS 15 +/* All codes must not exceed MAX_BITS bits */ + +#define INIT_STATE 42 +#define BUSY_STATE 113 +#define FINISH_STATE 666 +/* Stream status */ + + +/* Data structure describing a single value and its code string. */ +typedef struct ct_data_s { + union { + ush freq; /* frequency count */ + ush code; /* bit string */ + } fc; + union { + ush dad; /* father node in Huffman tree */ + ush len; /* length of bit string */ + } dl; +} FAR ct_data; + +#define Freq fc.freq +#define Code fc.code +#define Dad dl.dad +#define Len dl.len + +typedef struct static_tree_desc_s static_tree_desc; + +typedef struct tree_desc_s { + ct_data *dyn_tree; /* the dynamic tree */ + int max_code; /* largest code with non zero frequency */ + static_tree_desc *stat_desc; /* the corresponding static tree */ +} FAR tree_desc; + +typedef ush Pos; +typedef Pos FAR Posf; +typedef unsigned IPos; + +/* A Pos is an index in the character window. We use short instead of int to + * save space in the various tables. IPos is used only for parameter passing. + */ + +typedef struct internal_state { + z_streamp strm; /* pointer back to this zlib stream */ + int status; /* as the name implies */ + Bytef *pending_buf; /* output still pending */ + ulg pending_buf_size; /* size of pending_buf */ + Bytef *pending_out; /* next pending byte to output to the stream */ + int pending; /* nb of bytes in the pending buffer */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + Byte data_type; /* UNKNOWN, BINARY or ASCII */ + Byte method; /* STORED (for zip only) or DEFLATED */ + int last_flush; /* value of flush param for previous deflate call */ + + /* used by deflate.c: */ + + uInt w_size; /* LZ77 window size (32K by default) */ + uInt w_bits; /* log2(w_size) (8..16) */ + uInt w_mask; /* w_size - 1 */ + + Bytef *window; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. Also, it limits + * the window size to 64K, which is quite useful on MSDOS. + * To do: use the user input buffer as sliding window. + */ + + ulg window_size; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + Posf *prev; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + Posf *head; /* Heads of the hash chains or NIL. */ + + uInt ins_h; /* hash index of string to be inserted */ + uInt hash_size; /* number of elements in hash table */ + uInt hash_bits; /* log2(hash_size) */ + uInt hash_mask; /* hash_size-1 */ + + uInt hash_shift; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + long block_start; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + uInt match_length; /* length of best match */ + IPos prev_match; /* previous match */ + int match_available; /* set if previous match exists */ + uInt strstart; /* start of string to insert */ + uInt match_start; /* start of matching string */ + uInt lookahead; /* number of valid bytes ahead in window */ + + uInt prev_length; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + uInt max_chain_length; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + uInt max_lazy_match; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ +# define max_insert_length max_lazy_match + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + int level; /* compression level (1..9) */ + int strategy; /* favor or force Huffman coding*/ + + uInt good_match; + /* Use a faster search when the previous match is longer than this */ + + int nice_match; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + /* Didn't use ct_data typedef below to supress compiler warning */ + struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + struct tree_desc_s l_desc; /* desc. for literal tree */ + struct tree_desc_s d_desc; /* desc. for distance tree */ + struct tree_desc_s bl_desc; /* desc. for bit length tree */ + + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + int heap_len; /* number of elements in the heap */ + int heap_max; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + uch depth[2*L_CODES+1]; + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + uchf *l_buf; /* buffer for literals or lengths */ + + uInt lit_bufsize; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + uInt last_lit; /* running index in l_buf */ + + ushf *d_buf; + /* Buffer for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + ulg opt_len; /* bit length of current block with optimal trees */ + ulg static_len; /* bit length of current block with static trees */ + uInt matches; /* number of string matches in current block */ + int last_eob_len; /* bit length of EOB code for last block */ + +#ifdef DEBUG + ulg compressed_len; /* total bit length of compressed file mod 2^32 */ + ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ +#endif + + ush bi_buf; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + int bi_valid; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + +} FAR deflate_state; + +/* Output a byte on the stream. + * IN assertion: there is enough room in pending_buf. + */ +#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} + + +#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) +/* Minimum amount of lookahead, except at the end of the input file. + * See deflate.c for comments about the MIN_MATCH+1. + */ + +#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) +/* In order to simplify the code, particularly on 16 bit machines, match + * distances are limited to MAX_DIST instead of WSIZE. + */ + + /* in trees.c */ +void _tr_init OF((deflate_state *s)); +int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); +void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, + int eof)); +void _tr_align OF((deflate_state *s)); +void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, + int eof)); + +#define d_code(dist) \ + ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) +/* Mapping from a distance to a distance code. dist is the distance - 1 and + * must not have side effects. _dist_code[256] and _dist_code[257] are never + * used. + */ + +#ifndef DEBUG +/* Inline versions of _tr_tally for speed: */ + +#if defined(GEN_TREES_H) || !defined(STDC) + extern uch _length_code[]; + extern uch _dist_code[]; +#else + extern const uch _length_code[]; + extern const uch _dist_code[]; +#endif + +# define _tr_tally_lit(s, c, flush) \ + { uch cc = (c); \ + s->d_buf[s->last_lit] = 0; \ + s->l_buf[s->last_lit++] = cc; \ + s->dyn_ltree[cc].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +# define _tr_tally_dist(s, distance, length, flush) \ + { uch len = (length); \ + ush dist = (distance); \ + s->d_buf[s->last_lit] = dist; \ + s->l_buf[s->last_lit++] = len; \ + dist--; \ + s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ + s->dyn_dtree[d_code(dist)].Freq++; \ + flush = (s->last_lit == s->lit_bufsize-1); \ + } +#else +# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) +# define _tr_tally_dist(s, distance, length, flush) \ + flush = _tr_tally(s, distance, length) +#endif + +#endif /* DEFLATE_H */ diff --git a/klibc/klibc/zlib/gzio.c b/klibc/klibc/zlib/gzio.c new file mode 100644 index 0000000000..cb56b8d381 --- /dev/null +++ b/klibc/klibc/zlib/gzio.c @@ -0,0 +1,1008 @@ +/* gzio.c -- IO on .gz files + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + * + * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. + */ + +/* @(#) $Id: gzio.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#include + +#include "zutil.h" + +#ifdef NO_DEFLATE /* for compatiblity with old definition */ +# define NO_GZCOMPRESS +#endif + +#ifndef NO_DUMMY_DECL +struct internal_state {int dummy;}; /* for buggy compilers */ +#endif + +#ifndef Z_BUFSIZE +# ifdef MAXSEG_64K +# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ +# else +# define Z_BUFSIZE 16384 +# endif +#endif +#ifndef Z_PRINTF_BUFSIZE +# define Z_PRINTF_BUFSIZE 4096 +#endif + +#ifdef __MVS__ +# pragma map (fdopen , "\174\174FDOPEN") + FILE *fdopen(int, const char *); +#endif + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern void free OF((voidpf ptr)); +#endif + +#define ALLOC(size) malloc(size) +#define TRYFREE(p) {if (p) free(p);} + +static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ + +/* gzip flag byte */ +#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ +#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ +#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ +#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ +#define COMMENT 0x10 /* bit 4 set: file comment present */ +#define RESERVED 0xE0 /* bits 5..7: reserved */ + +typedef struct gz_stream { + z_stream stream; + int z_err; /* error code for last stream operation */ + int z_eof; /* set if end of input file */ + FILE *file; /* .gz file */ + Byte *inbuf; /* input buffer */ + Byte *outbuf; /* output buffer */ + uLong crc; /* crc32 of uncompressed data */ + char *msg; /* error message */ + char *path; /* path name for debugging only */ + int transparent; /* 1 if input file is not a .gz file */ + char mode; /* 'w' or 'r' */ + z_off_t start; /* start of compressed data in file (header skipped) */ + z_off_t in; /* bytes into deflate or inflate */ + z_off_t out; /* bytes out of deflate or inflate */ + int back; /* one character push-back */ + int last; /* true if push-back is last character */ +} gz_stream; + + +local gzFile gz_open OF((const char *path, const char *mode, int fd)); +local int do_flush OF((gzFile file, int flush)); +local int get_byte OF((gz_stream *s)); +local void check_header OF((gz_stream *s)); +local int destroy OF((gz_stream *s)); +local void putLong OF((FILE *file, uLong x)); +local uLong getLong OF((gz_stream *s)); + +/* =========================================================================== + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb"). The file is given either by file descriptor + or path name (if fd == -1). + gz_open returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). +*/ +local gzFile gz_open (path, mode, fd) + const char *path; + const char *mode; + int fd; +{ + int err; + int level = Z_DEFAULT_COMPRESSION; /* compression level */ + int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ + char *p = (char*)mode; + gz_stream *s; + char fmode[80]; /* copy of mode, without the compression level */ + char *m = fmode; + + if (!path || !mode) return Z_NULL; + + s = (gz_stream *)ALLOC(sizeof(gz_stream)); + if (!s) return Z_NULL; + + s->stream.zalloc = (alloc_func)0; + s->stream.zfree = (free_func)0; + s->stream.opaque = (voidpf)0; + s->stream.next_in = s->inbuf = Z_NULL; + s->stream.next_out = s->outbuf = Z_NULL; + s->stream.avail_in = s->stream.avail_out = 0; + s->file = NULL; + s->z_err = Z_OK; + s->z_eof = 0; + s->in = 0; + s->out = 0; + s->back = EOF; + s->crc = crc32(0L, Z_NULL, 0); + s->msg = NULL; + s->transparent = 0; + + s->path = (char*)ALLOC(strlen(path)+1); + if (s->path == NULL) { + return destroy(s), (gzFile)Z_NULL; + } + strcpy(s->path, path); /* do this early for debugging */ + + s->mode = '\0'; + do { + if (*p == 'r') s->mode = 'r'; + if (*p == 'w' || *p == 'a') s->mode = 'w'; + if (*p >= '0' && *p <= '9') { + level = *p - '0'; + } else if (*p == 'f') { + strategy = Z_FILTERED; + } else if (*p == 'h') { + strategy = Z_HUFFMAN_ONLY; + } else if (*p == 'R') { + strategy = Z_RLE; + } else { + *m++ = *p; /* copy the mode */ + } + } while (*p++ && m != fmode + sizeof(fmode)); + if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; + + if (s->mode == 'w') { +#ifdef NO_GZCOMPRESS + err = Z_STREAM_ERROR; +#else + err = deflateInit2(&(s->stream), level, + Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); + /* windowBits is passed < 0 to suppress zlib header */ + + s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); +#endif + if (err != Z_OK || s->outbuf == Z_NULL) { + return destroy(s), (gzFile)Z_NULL; + } + } else { + s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); + + err = inflateInit2(&(s->stream), -MAX_WBITS); + /* windowBits is passed < 0 to tell that there is no zlib header. + * Note that in this case inflate *requires* an extra "dummy" byte + * after the compressed stream in order to complete decompression and + * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are + * present after the compressed stream. + */ + if (err != Z_OK || s->inbuf == Z_NULL) { + return destroy(s), (gzFile)Z_NULL; + } + } + s->stream.avail_out = Z_BUFSIZE; + + errno = 0; + s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); + + if (s->file == NULL) { + return destroy(s), (gzFile)Z_NULL; + } + if (s->mode == 'w') { + /* Write a very simple .gz header: + */ + fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], + Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); + s->start = 10L; + /* We use 10L instead of ftell(s->file) to because ftell causes an + * fflush on some systems. This version of the library doesn't use + * start anyway in write mode, so this initialization is not + * necessary. + */ + } else { + check_header(s); /* skip the .gz header */ + s->start = ftell(s->file) - s->stream.avail_in; + } + + return (gzFile)s; +} + +/* =========================================================================== + Opens a gzip (.gz) file for reading or writing. +*/ +gzFile ZEXPORT gzopen (path, mode) + const char *path; + const char *mode; +{ + return gz_open (path, mode, -1); +} + +/* =========================================================================== + Associate a gzFile with the file descriptor fd. fd is not dup'ed here + to mimic the behavio(u)r of fdopen. +*/ +gzFile ZEXPORT gzdopen (fd, mode) + int fd; + const char *mode; +{ + char name[20]; + + if (fd < 0) return (gzFile)Z_NULL; + sprintf(name, "", fd); /* for debugging */ + + return gz_open (name, mode, fd); +} + +/* =========================================================================== + * Update the compression level and strategy + */ +int ZEXPORT gzsetparams (file, level, strategy) + gzFile file; + int level; + int strategy; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + /* Make room to allow flushing */ + if (s->stream.avail_out == 0) { + + s->stream.next_out = s->outbuf; + if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { + s->z_err = Z_ERRNO; + } + s->stream.avail_out = Z_BUFSIZE; + } + + return deflateParams (&(s->stream), level, strategy); +} + +/* =========================================================================== + Read a byte from a gz_stream; update next_in and avail_in. Return EOF + for end of file. + IN assertion: the stream s has been sucessfully opened for reading. +*/ +local int get_byte(s) + gz_stream *s; +{ + if (s->z_eof) return EOF; + if (s->stream.avail_in == 0) { + errno = 0; + s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); + if (s->stream.avail_in == 0) { + s->z_eof = 1; + /* klibc hack */ + if (errno) s->z_err = Z_ERRNO; + return EOF; + } + s->stream.next_in = s->inbuf; + } + s->stream.avail_in--; + return *(s->stream.next_in)++; +} + +/* =========================================================================== + Check the gzip header of a gz_stream opened for reading. Set the stream + mode to transparent if the gzip magic header is not present; set s->err + to Z_DATA_ERROR if the magic header is present but the rest of the header + is incorrect. + IN assertion: the stream s has already been created sucessfully; + s->stream.avail_in is zero for the first time, but may be non-zero + for concatenated .gz files. +*/ +local void check_header(s) + gz_stream *s; +{ + int method; /* method byte */ + int flags; /* flags byte */ + uInt len; + int c; + + /* Assure two bytes in the buffer so we can peek ahead -- handle case + where first byte of header is at the end of the buffer after the last + gzip segment */ + len = s->stream.avail_in; + if (len < 2) { + if (len) s->inbuf[0] = s->stream.next_in[0]; + errno = 0; + len = fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); + /* klibc hack */ + if (len == 0 && errno) s->z_err = Z_ERRNO; + s->stream.avail_in += len; + s->stream.next_in = s->inbuf; + if (s->stream.avail_in < 2) { + s->transparent = s->stream.avail_in; + return; + } + } + + /* Peek ahead to check the gzip magic header */ + if (s->stream.next_in[0] != gz_magic[0] || + s->stream.next_in[1] != gz_magic[1]) { + s->transparent = 1; + return; + } + s->stream.avail_in -= 2; + s->stream.next_in += 2; + + /* Check the rest of the gzip header */ + method = get_byte(s); + flags = get_byte(s); + if (method != Z_DEFLATED || (flags & RESERVED) != 0) { + s->z_err = Z_DATA_ERROR; + return; + } + + /* Discard time, xflags and OS code: */ + for (len = 0; len < 6; len++) (void)get_byte(s); + + if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ + len = (uInt)get_byte(s); + len += ((uInt)get_byte(s))<<8; + /* len is garbage if EOF but the loop below will quit anyway */ + while (len-- != 0 && get_byte(s) != EOF) ; + } + if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ + while ((c = get_byte(s)) != 0 && c != EOF) ; + } + if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ + while ((c = get_byte(s)) != 0 && c != EOF) ; + } + if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ + for (len = 0; len < 2; len++) (void)get_byte(s); + } + s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; +} + + /* =========================================================================== + * Cleanup then free the given gz_stream. Return a zlib error code. + Try freeing in the reverse order of allocations. + */ +local int destroy (s) + gz_stream *s; +{ + int err = Z_OK; + + if (!s) return Z_STREAM_ERROR; + + TRYFREE(s->msg); + + if (s->stream.state != NULL) { + if (s->mode == 'w') { +#ifdef NO_GZCOMPRESS + err = Z_STREAM_ERROR; +#else + err = deflateEnd(&(s->stream)); +#endif + } else if (s->mode == 'r') { + err = inflateEnd(&(s->stream)); + } + } + if (s->file != NULL && fclose(s->file)) { +#ifdef ESPIPE + if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ +#endif + err = Z_ERRNO; + } + if (s->z_err < 0) err = s->z_err; + + TRYFREE(s->inbuf); + TRYFREE(s->outbuf); + TRYFREE(s->path); + TRYFREE(s); + return err; +} + +/* =========================================================================== + Reads the given number of uncompressed bytes from the compressed file. + gzread returns the number of bytes actually read (0 for end of file). +*/ +int ZEXPORT gzread (file, buf, len) + gzFile file; + voidp buf; + unsigned len; +{ + gz_stream *s = (gz_stream*)file; + Bytef *start = (Bytef*)buf; /* starting point for crc computation */ + Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ + + if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; + + if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; + if (s->z_err == Z_STREAM_END) return 0; /* EOF */ + + next_out = (Byte*)buf; + s->stream.next_out = (Bytef*)buf; + s->stream.avail_out = len; + + if (s->stream.avail_out && s->back != EOF) { + *next_out++ = s->back; + s->stream.next_out++; + s->stream.avail_out--; + s->back = EOF; + s->out++; + if (s->last) { + s->z_err = Z_STREAM_END; + return 1; + } + } + + while (s->stream.avail_out != 0) { + + if (s->transparent) { + /* Copy first the lookahead bytes: */ + uInt n = s->stream.avail_in; + if (n > s->stream.avail_out) n = s->stream.avail_out; + if (n > 0) { + zmemcpy(s->stream.next_out, s->stream.next_in, n); + next_out += n; + s->stream.next_out = next_out; + s->stream.next_in += n; + s->stream.avail_out -= n; + s->stream.avail_in -= n; + } + if (s->stream.avail_out > 0) { + s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, + s->file); + } + len -= s->stream.avail_out; + s->in += len; + s->out += len; + if (len == 0) s->z_eof = 1; + return (int)len; + } + if (s->stream.avail_in == 0 && !s->z_eof) { + + errno = 0; + s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); + if (s->stream.avail_in == 0) { + s->z_eof = 1; + if (errno) { + s->z_err = Z_ERRNO; + break; + } + } + s->stream.next_in = s->inbuf; + } + s->in += s->stream.avail_in; + s->out += s->stream.avail_out; + s->z_err = inflate(&(s->stream), Z_NO_FLUSH); + s->in -= s->stream.avail_in; + s->out -= s->stream.avail_out; + + if (s->z_err == Z_STREAM_END) { + /* Check CRC and original size */ + s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + start = s->stream.next_out; + + if (getLong(s) != s->crc) { + s->z_err = Z_DATA_ERROR; + } else { + (void)getLong(s); + /* The uncompressed length returned by above getlong() may be + * different from s->out in case of concatenated .gz files. + * Check for such files: + */ + check_header(s); + if (s->z_err == Z_OK) { + inflateReset(&(s->stream)); + s->crc = crc32(0L, Z_NULL, 0); + } + } + } + if (s->z_err != Z_OK || s->z_eof) break; + } + s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); + + return (int)(len - s->stream.avail_out); +} + + +/* =========================================================================== + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ +int ZEXPORT gzgetc(file) + gzFile file; +{ + unsigned char c; + + return gzread(file, &c, 1) == 1 ? c : -1; +} + + +/* =========================================================================== + Push one byte back onto the stream. +*/ +int ZEXPORT gzungetc(c, file) + int c; + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; + s->back = c; + s->out--; + s->last = (s->z_err == Z_STREAM_END); + if (s->last) s->z_err = Z_OK; + s->z_eof = 0; + return c; +} + + +/* =========================================================================== + Reads bytes from the compressed file until len-1 characters are + read, or a newline character is read and transferred to buf, or an + end-of-file condition is encountered. The string is then terminated + with a null character. + gzgets returns buf, or Z_NULL in case of error. + + The current implementation is not optimized at all. +*/ +char * ZEXPORT gzgets(file, buf, len) + gzFile file; + char *buf; + int len; +{ + char *b = buf; + if (buf == Z_NULL || len <= 0) return Z_NULL; + + while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ; + *buf = '\0'; + return b == buf && len > 0 ? Z_NULL : b; +} + + +#ifndef NO_GZCOMPRESS +/* =========================================================================== + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of bytes actually written (0 in case of error). +*/ +int ZEXPORT gzwrite (file, buf, len) + gzFile file; + voidpc buf; + unsigned len; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + s->stream.next_in = (Bytef*)buf; + s->stream.avail_in = len; + + while (s->stream.avail_in != 0) { + + if (s->stream.avail_out == 0) { + + s->stream.next_out = s->outbuf; + if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { + s->z_err = Z_ERRNO; + break; + } + s->stream.avail_out = Z_BUFSIZE; + } + s->in += s->stream.avail_in; + s->out += s->stream.avail_out; + s->z_err = deflate(&(s->stream), Z_NO_FLUSH); + s->in -= s->stream.avail_in; + s->out -= s->stream.avail_out; + if (s->z_err != Z_OK) break; + } + s->crc = crc32(s->crc, (const Bytef *)buf, len); + + return (int)(len - s->stream.avail_in); +} + + +/* =========================================================================== + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). +*/ +#ifdef STDC +#include + +int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) +{ + char buf[Z_PRINTF_BUFSIZE]; + va_list va; + int len; + + buf[sizeof(buf) - 1] = 0; + va_start(va, format); +#ifdef NO_vsnprintf +# ifdef HAS_vsprintf_void + (void)vsprintf(buf, format, va); + va_end(va); + for (len = 0; len < sizeof(buf); len++) + if (buf[len] == 0) break; +# else + len = vsprintf(buf, format, va); + va_end(va); +# endif +#else +# ifdef HAS_vsnprintf_void + (void)vsnprintf(buf, sizeof(buf), format, va); + va_end(va); + len = strlen(buf); +# else + len = vsnprintf(buf, sizeof(buf), format, va); + va_end(va); +# endif +#endif + if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) + return 0; + return gzwrite(file, buf, (unsigned)len); +} +#else /* not ANSI C */ + +int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) + gzFile file; + const char *format; + int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, + a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; +{ + char buf[Z_PRINTF_BUFSIZE]; + int len; + + buf[sizeof(buf) - 1] = 0; +#ifdef NO_snprintf +# ifdef HAS_sprintf_void + sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + for (len = 0; len < sizeof(buf); len++) + if (buf[len] == 0) break; +# else + len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#else +# ifdef HAS_snprintf_void + snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); + len = strlen(buf); +# else + len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, + a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); +# endif +#endif + if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) + return 0; + return gzwrite(file, buf, len); +} +#endif + +/* =========================================================================== + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ +int ZEXPORT gzputc(file, c) + gzFile file; + int c; +{ + unsigned char cc = (unsigned char) c; /* required for big endian systems */ + + return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; +} + + +/* =========================================================================== + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ +int ZEXPORT gzputs(file, s) + gzFile file; + const char *s; +{ + return gzwrite(file, (char*)s, (unsigned)strlen(s)); +} + + +/* =========================================================================== + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. +*/ +local int do_flush (file, flush) + gzFile file; + int flush; +{ + uInt len; + int done = 0; + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; + + s->stream.avail_in = 0; /* should be zero already anyway */ + + for (;;) { + len = Z_BUFSIZE - s->stream.avail_out; + + if (len != 0) { + if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { + s->z_err = Z_ERRNO; + return Z_ERRNO; + } + s->stream.next_out = s->outbuf; + s->stream.avail_out = Z_BUFSIZE; + } + if (done) break; + s->out += s->stream.avail_out; + s->z_err = deflate(&(s->stream), flush); + s->out -= s->stream.avail_out; + + /* Ignore the second of two consecutive flushes: */ + if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; + + /* deflate has finished flushing only when it hasn't used up + * all the available space in the output buffer: + */ + done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); + + if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; + } + return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; +} + +int ZEXPORT gzflush (file, flush) + gzFile file; + int flush; +{ + gz_stream *s = (gz_stream*)file; + int err = do_flush (file, flush); + + if (err) return err; + fflush(s->file); + return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; +} +#endif /* NO_GZCOMPRESS */ + +/* =========================================================================== + Sets the starting position for the next gzread or gzwrite on the given + compressed file. The offset represents a number of bytes in the + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error. + SEEK_END is not implemented, returns error. + In this version of the library, gzseek can be extremely slow. +*/ +z_off_t ZEXPORT gzseek (file, offset, whence) + gzFile file; + z_off_t offset; + int whence; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || whence == SEEK_END || + s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { + return -1L; + } + + if (s->mode == 'w') { +#ifdef NO_GZCOMPRESS + return -1L; +#else + if (whence == SEEK_SET) { + offset -= s->in; + } + if (offset < 0) return -1L; + + /* At this point, offset is the number of zero bytes to write. */ + if (s->inbuf == Z_NULL) { + s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ + if (s->inbuf == Z_NULL) return -1L; + zmemzero(s->inbuf, Z_BUFSIZE); + } + while (offset > 0) { + uInt size = Z_BUFSIZE; + if (offset < Z_BUFSIZE) size = (uInt)offset; + + size = gzwrite(file, s->inbuf, size); + if (size == 0) return -1L; + + offset -= size; + } + return s->in; +#endif + } + /* Rest of function is for reading only */ + + /* compute absolute position */ + if (whence == SEEK_CUR) { + offset += s->out; + } + if (offset < 0) return -1L; + + if (s->transparent) { + /* map to fseek */ + s->back = EOF; + s->stream.avail_in = 0; + s->stream.next_in = s->inbuf; + if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; + + s->in = s->out = offset; + return offset; + } + + /* For a negative seek, rewind and use positive seek */ + if (offset >= s->out) { + offset -= s->out; + } else if (gzrewind(file) < 0) { + return -1L; + } + /* offset is now the number of bytes to skip. */ + + if (offset != 0 && s->outbuf == Z_NULL) { + s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); + if (s->outbuf == Z_NULL) return -1L; + } + if (offset && s->back != EOF) { + s->back = EOF; + s->out++; + offset--; + if (s->last) s->z_err = Z_STREAM_END; + } + while (offset > 0) { + int size = Z_BUFSIZE; + if (offset < Z_BUFSIZE) size = (int)offset; + + size = gzread(file, s->outbuf, (uInt)size); + if (size <= 0) return -1L; + offset -= size; + } + return s->out; +} + +/* =========================================================================== + Rewinds input file. +*/ +int ZEXPORT gzrewind (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL || s->mode != 'r') return -1; + + s->z_err = Z_OK; + s->z_eof = 0; + s->back = EOF; + s->stream.avail_in = 0; + s->stream.next_in = s->inbuf; + s->crc = crc32(0L, Z_NULL, 0); + if (!s->transparent) (void)inflateReset(&s->stream); + s->in = 0; + s->out = 0; + return fseek(s->file, s->start, SEEK_SET); +} + +/* =========================================================================== + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. +*/ +z_off_t ZEXPORT gztell (file) + gzFile file; +{ + return gzseek(file, 0L, SEEK_CUR); +} + +/* =========================================================================== + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ +int ZEXPORT gzeof (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + /* With concatenated compressed files that can have embedded + * crc trailers, z_eof is no longer the only/best indicator of EOF + * on a gz_stream. Handle end-of-stream error explicitly here. + */ + if (s == NULL || s->mode != 'r') return 0; + if (s->z_eof) return 1; + return s->z_err == Z_STREAM_END; +} + +/* =========================================================================== + Outputs a long in LSB order to the given file +*/ +local void putLong (file, x) + FILE *file; + uLong x; +{ + int n; + for (n = 0; n < 4; n++) { + fputc((int)(x & 0xff), file); + x >>= 8; + } +} + +/* =========================================================================== + Reads a long in LSB order from the given gz_stream. Sets z_err in case + of error. +*/ +local uLong getLong (s) + gz_stream *s; +{ + uLong x = (uLong)get_byte(s); + int c; + + x += ((uLong)get_byte(s))<<8; + x += ((uLong)get_byte(s))<<16; + c = get_byte(s); + if (c == EOF) s->z_err = Z_DATA_ERROR; + x += ((uLong)c)<<24; + return x; +} + +/* =========================================================================== + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. +*/ +int ZEXPORT gzclose (file) + gzFile file; +{ + int err; + gz_stream *s = (gz_stream*)file; + + if (s == NULL) return Z_STREAM_ERROR; + + if (s->mode == 'w') { +#ifdef NO_GZCOMPRESS + return Z_STREAM_ERROR; +#else + err = do_flush (file, Z_FINISH); + if (err != Z_OK) return destroy((gz_stream*)file); + + putLong (s->file, s->crc); + putLong (s->file, (uLong)(s->in & 0xffffffff)); +#endif + } + return destroy((gz_stream*)file); +} + +/* =========================================================================== + Returns the error message for the last error which occured on the + given compressed file. errnum is set to zlib error number. If an + error occured in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ +const char * ZEXPORT gzerror (file, errnum) + gzFile file; + int *errnum; +{ + char *m; + gz_stream *s = (gz_stream*)file; + + if (s == NULL) { + *errnum = Z_STREAM_ERROR; + return (const char*)ERR_MSG(Z_STREAM_ERROR); + } + *errnum = s->z_err; + if (*errnum == Z_OK) return (const char*)""; + + m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); + + if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); + + TRYFREE(s->msg); + s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); + if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR); + strcpy(s->msg, s->path); + strcat(s->msg, ": "); + strcat(s->msg, m); + return (const char*)s->msg; +} + +/* =========================================================================== + Clear the error and end-of-file flags, and do the same for the real file. +*/ +void ZEXPORT gzclearerr (file) + gzFile file; +{ + gz_stream *s = (gz_stream*)file; + + if (s == NULL) return; + if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; + s->z_eof = 0; + /* klibc hack */ + /* clearerr(s->file); */ +} diff --git a/klibc/klibc/zlib/infback.c b/klibc/klibc/zlib/infback.c new file mode 100644 index 0000000000..110b03b857 --- /dev/null +++ b/klibc/klibc/zlib/infback.c @@ -0,0 +1,619 @@ +/* infback.c -- inflate using a call-back interface + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + This code is largely copied from inflate.c. Normally either infback.o or + inflate.o would be linked into an application--not both. The interface + with inffast.c is retained so that optimized assembler-coded versions of + inflate_fast() can be used with either inflate.c or infback.c. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); + +/* + strm provides memory allocation functions in zalloc and zfree, or + Z_NULL to use the library memory allocation functions. + + windowBits is in the range 8..15, and window is a user-supplied + window and output buffer that is 2**windowBits bytes. + */ +int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) +z_stream FAR *strm; +int windowBits; +unsigned char FAR *window; +const char *version; +int stream_size; +{ + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL || window == Z_NULL || + windowBits < 8 || windowBits > 15) + return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *)ZALLOC(strm, 1, + sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (voidpf)state; + state->wbits = windowBits; + state->wsize = 1U << windowBits; + state->window = window; + state->write = 0; + state->whave = 0; + return Z_OK; +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +/* Macros for inflateBack(): */ + +/* Load returned state from inflate_fast() */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Set state from registers for inflate_fast() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Assure that some input is available. If input is requested, but denied, + then return a Z_BUF_ERROR from inflateBack(). */ +#define PULL() \ + do { \ + if (have == 0) { \ + have = in(in_desc, &next); \ + if (have == 0) { \ + next = Z_NULL; \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflateBack() + with an error if there is no input available. */ +#define PULLBYTE() \ + do { \ + PULL(); \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflateBack() with + an error. */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Assure that some output space is available, by writing out the window + if it's full. If the write fails, return from inflateBack() with a + Z_BUF_ERROR. */ +#define ROOM() \ + do { \ + if (left == 0) { \ + put = state->window; \ + left = state->wsize; \ + state->whave = left; \ + if (out(out_desc, put, left)) { \ + ret = Z_BUF_ERROR; \ + goto inf_leave; \ + } \ + } \ + } while (0) + +/* + strm provides the memory allocation functions and window buffer on input, + and provides information on the unused input on return. For Z_DATA_ERROR + returns, strm will also provide an error message. + + in() and out() are the call-back input and output functions. When + inflateBack() needs more input, it calls in(). When inflateBack() has + filled the window with output, or when it completes with data in the + window, it calls out() to write out the data. The application must not + change the provided input until in() is called again or inflateBack() + returns. The application must not change the window/output buffer until + inflateBack() returns. + + in() and out() are called with a descriptor parameter provided in the + inflateBack() call. This parameter can be a structure that provides the + information required to do the read or write, as well as accumulated + information on the input and output such as totals and check values. + + in() should return zero on failure. out() should return non-zero on + failure. If either in() or out() fails, than inflateBack() returns a + Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it + was in() or out() that caused in the error. Otherwise, inflateBack() + returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format + error, or Z_MEM_ERROR if it could not allocate memory for the state. + inflateBack() can also return Z_STREAM_ERROR if the input parameters + are not correct, i.e. strm is Z_NULL or the state was not initialized. + */ +int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) +z_stream FAR *strm; +in_func in; +void FAR *in_desc; +out_func out; +void FAR *out_desc; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code this; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + /* Check that the strm exists and that the state was initialized */ + if (strm == Z_NULL || strm->state == Z_NULL) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + + /* Reset the state */ + strm->msg = Z_NULL; + state->mode = TYPE; + state->last = 0; + state->whave = 0; + next = strm->next_in; + have = next != Z_NULL ? strm->avail_in : 0; + hold = 0; + bits = 0; + put = state->window; + left = state->wsize; + + /* Inflate until end of block marked as last */ + for (;;) + switch (state->mode) { + case TYPE: + /* determine and dispatch block type */ + if (state->last) { + BYTEBITS(); + state->mode = DONE; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN; /* decode codes */ + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + + case STORED: + /* get and verify stored block length */ + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + + /* copy stored block from input to output */ + while (state->length != 0) { + copy = state->length; + PULL(); + ROOM(); + if (copy > have) copy = have; + if (copy > left) copy = left; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + + case TABLE: + /* get dynamic table entries descriptor */ + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + + /* get code length code lengths (not a typo) */ + state->have = 0; + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + + /* get length and distance code code lengths */ + state->have = 0; + while (state->have < state->nlen + state->ndist) { + for (;;) { + this = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if (this.val < 16) { + NEEDBITS(this.bits); + DROPBITS(this.bits); + state->lens[state->have++] = this.val; + } + else { + if (this.val == 16) { + NEEDBITS(this.bits + 2); + DROPBITS(this.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = (unsigned)(state->lens[state->have - 1]); + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (this.val == 17) { + NEEDBITS(this.bits + 3); + DROPBITS(this.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(this.bits + 7); + DROPBITS(this.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* build code tables */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; + + case LEN: + /* use inflate_fast() if we have enough input and output */ + if (have >= 6 && left >= 258) { + RESTORE(); + if (state->whave < state->wsize) + state->whave = state->wsize - left; + inflate_fast(strm, state->wsize); + LOAD(); + break; + } + + /* get a literal, length, or end-of-block code */ + for (;;) { + this = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if (this.op && (this.op & 0xf0) == 0) { + last = this; + for (;;) { + this = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + this.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(this.bits); + state->length = (unsigned)this.val; + + /* process literal */ + if (this.op == 0) { + Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", this.val)); + ROOM(); + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + } + + /* process end of block */ + if (this.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + + /* invalid code */ + if (this.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + + /* length code -- get extra bits, if any */ + state->extra = (unsigned)(this.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + + /* get distance code */ + for (;;) { + this = state->distcode[BITS(state->distbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if ((this.op & 0xf0) == 0) { + last = this; + for (;;) { + this = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + this.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(this.bits); + if (this.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)this.val; + + /* get distance extra bits, if any */ + state->extra = (unsigned)(this.op) & 15; + if (state->extra != 0) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } + if (state->offset > state->wsize - (state->whave < state->wsize ? + left : 0)) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + + /* copy match from window to output */ + do { + ROOM(); + copy = state->wsize - state->offset; + if (copy < left) { + from = put + copy; + copy = left - copy; + } + else { + from = put - state->offset; + copy = left; + } + if (copy > state->length) copy = state->length; + state->length -= copy; + left -= copy; + do { + *put++ = *from++; + } while (--copy); + } while (state->length != 0); + break; + + case DONE: + /* inflate stream terminated properly -- write leftover output */ + ret = Z_STREAM_END; + if (left < state->wsize) { + if (out(out_desc, state->window, state->wsize - left)) + ret = Z_BUF_ERROR; + } + goto inf_leave; + + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + + default: /* can't happen, but makes compilers happy */ + ret = Z_STREAM_ERROR; + goto inf_leave; + } + + /* Return unused input */ + inf_leave: + strm->next_in = next; + strm->avail_in = have; + return ret; +} + +int ZEXPORT inflateBackEnd(strm) +z_stream FAR *strm; +{ + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} diff --git a/klibc/klibc/zlib/inffast.c b/klibc/klibc/zlib/inffast.c new file mode 100644 index 0000000000..c716440a92 --- /dev/null +++ b/klibc/klibc/zlib/inffast.c @@ -0,0 +1,305 @@ +/* inffast.c -- fast decoding + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifndef ASMINF + +/* Allow machine dependent optimization for post-increment or pre-increment. + Based on testing to date, + Pre-increment preferred for: + - PowerPC G3 (Adler) + - MIPS R5000 (Randers-Pehrson) + Post-increment preferred for: + - none + No measurable difference: + - Pentium III (Anderson) + - 68060 (Nikl) + */ +#ifdef POSTINC +# define OFF 0 +# define PUP(a) *(a)++ +#else +# define OFF 1 +# define PUP(a) *++(a) +#endif + +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. + + Entry assumptions: + + state->mode == LEN + strm->avail_in >= 6 + strm->avail_out >= 258 + start >= strm->avail_out + state->bits < 8 + + On return, state->mode is one of: + + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data + + Notes: + + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm->avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. + + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm->avail_out >= 258 for each loop to avoid checking for + output space. + */ +void inflate_fast(strm, start) +z_streamp strm; +unsigned start; /* inflate()'s starting value for strm->avail_out */ +{ + struct inflate_state FAR *state; + unsigned char FAR *in; /* local strm->next_in */ + unsigned char FAR *last; /* while in < last, enough input available */ + unsigned char FAR *out; /* local strm->next_out */ + unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ + unsigned char FAR *end; /* while out < end, enough space available */ + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned write; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ + unsigned long hold; /* local strm->hold */ + unsigned bits; /* local strm->bits */ + code const FAR *lcode; /* local strm->lencode */ + code const FAR *dcode; /* local strm->distcode */ + unsigned lmask; /* mask for first level of length codes */ + unsigned dmask; /* mask for first level of distance codes */ + code this; /* retrieved table entry */ + unsigned op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + unsigned len; /* match length, unused bytes */ + unsigned dist; /* match distance */ + unsigned char FAR *from; /* where to copy match from */ + + /* copy state to local variables */ + state = (struct inflate_state FAR *)strm->state; + in = strm->next_in - OFF; + last = in + (strm->avail_in - 5); + out = strm->next_out - OFF; + beg = out - (start - strm->avail_out); + end = out + (strm->avail_out - 257); + wsize = state->wsize; + whave = state->whave; + write = state->write; + window = state->window; + hold = state->hold; + bits = state->bits; + lcode = state->lencode; + dcode = state->distcode; + lmask = (1U << state->lenbits) - 1; + dmask = (1U << state->distbits) - 1; + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + do { + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + this = lcode[hold & lmask]; + dolen: + op = (unsigned)(this.bits); + hold >>= op; + bits -= op; + op = (unsigned)(this.op); + if (op == 0) { /* literal */ + Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", this.val)); + PUP(out) = (unsigned char)(this.val); + } + else if (op & 16) { /* length base */ + len = (unsigned)(this.val); + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + len += (unsigned)hold & ((1U << op) - 1); + hold >>= op; + bits -= op; + } + Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + this = dcode[hold & dmask]; + dodist: + op = (unsigned)(this.bits); + hold >>= op; + bits -= op; + op = (unsigned)(this.op); + if (op & 16) { /* distance base */ + dist = (unsigned)(this.val); + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + if (bits < op) { + hold += (unsigned long)(PUP(in)) << bits; + bits += 8; + } + } + dist += (unsigned)hold & ((1U << op) - 1); + hold >>= op; + bits -= op; + Tracevv((stderr, "inflate: distance %u\n", dist)); + op = (unsigned)(out - beg); /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + from = window - OFF; + if (write == 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + else if (write < op) { /* wrap around window */ + from += wsize + write - op; + op -= write; + if (op < len) { /* some from end of window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = window - OFF; + if (write < len) { /* some from start of window */ + op = write; + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + } + else { /* contiguous in window */ + from += write - op; + if (op < len) { /* some from window */ + len -= op; + do { + PUP(out) = PUP(from); + } while (--op); + from = out - dist; /* rest from output */ + } + } + while (len > 2) { + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + else { + from = out - dist; /* copy direct from output */ + do { /* minimum length is three */ + PUP(out) = PUP(from); + PUP(out) = PUP(from); + PUP(out) = PUP(from); + len -= 3; + } while (len > 2); + if (len) { + PUP(out) = PUP(from); + if (len > 1) + PUP(out) = PUP(from); + } + } + } + else if ((op & 64) == 0) { /* 2nd level distance code */ + this = dcode[this.val + (hold & ((1U << op) - 1))]; + goto dodist; + } + else { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + } + else if ((op & 64) == 0) { /* 2nd level length code */ + this = lcode[this.val + (hold & ((1U << op) - 1))]; + goto dolen; + } + else if (op & 32) { /* end-of-block */ + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + else { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + } while (in < last && out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + in -= len; + bits -= len << 3; + hold &= (1U << bits) - 1; + + /* update state and return */ + strm->next_in = in + OFF; + strm->next_out = out + OFF; + strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); + strm->avail_out = (unsigned)(out < end ? + 257 + (end - out) : 257 - (out - end)); + state->hold = hold; + state->bits = bits; + return; +} + +/* + inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): + - Using bit fields for code structure + - Different op definition to avoid & for extra bits (do & for table bits) + - Three separate decoding do-loops for direct, window, and write == 0 + - Special case for distance > 1 copies to do overlapped load and store copy + - Explicit branch predictions (based on measured branch probabilities) + - Deferring match copy and interspersed it with decoding subsequent codes + - Swapping literal/length else + - Swapping window/direct else + - Larger unrolled copy loops (three is about right) + - Moving len -= 3 statement into middle of loop + */ + +#endif /* !ASMINF */ diff --git a/klibc/klibc/zlib/inffast.h b/klibc/klibc/zlib/inffast.h new file mode 100644 index 0000000000..1e88d2d97b --- /dev/null +++ b/klibc/klibc/zlib/inffast.h @@ -0,0 +1,11 @@ +/* inffast.h -- header to use inffast.c + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +void inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/klibc/klibc/zlib/inffixed.h b/klibc/klibc/zlib/inffixed.h new file mode 100644 index 0000000000..75ed4b5978 --- /dev/null +++ b/klibc/klibc/zlib/inffixed.h @@ -0,0 +1,94 @@ + /* inffixed.h -- table for decoding fixed codes + * Generated automatically by makefixed(). + */ + + /* WARNING: this file should *not* be used by applications. It + is part of the implementation of the compression library and + is subject to change. Applications should only use zlib.h. + */ + + static const code lenfix[512] = { + {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, + {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, + {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, + {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, + {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, + {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, + {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, + {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, + {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, + {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, + {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, + {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, + {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, + {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, + {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, + {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, + {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, + {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, + {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, + {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, + {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, + {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, + {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, + {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, + {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, + {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, + {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, + {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, + {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, + {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, + {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, + {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, + {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, + {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, + {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, + {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, + {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, + {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, + {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, + {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, + {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, + {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, + {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, + {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, + {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, + {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, + {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, + {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, + {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, + {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, + {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, + {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, + {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, + {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, + {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, + {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, + {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, + {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, + {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, + {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, + {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, + {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, + {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, + {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, + {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, + {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, + {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, + {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, + {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, + {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, + {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, + {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, + {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, + {0,9,255} + }; + + static const code distfix[32] = { + {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, + {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, + {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, + {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, + {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, + {22,5,193},{64,5,0} + }; diff --git a/klibc/klibc/zlib/inflate.c b/klibc/klibc/zlib/inflate.c new file mode 100644 index 0000000000..a53b5c7446 --- /dev/null +++ b/klibc/klibc/zlib/inflate.c @@ -0,0 +1,1270 @@ +/* inflate.c -- zlib decompression + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * Change history: + * + * 1.2.beta0 24 Nov 2002 + * - First version -- complete rewrite of inflate to simplify code, avoid + * creation of window when not needed, minimize use of window when it is + * needed, make inffast.c even faster, implement gzip decoding, and to + * improve code readability and style over the previous zlib inflate code + * + * 1.2.beta1 25 Nov 2002 + * - Use pointers for available input and output checking in inffast.c + * - Remove input and output counters in inffast.c + * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 + * - Remove unnecessary second byte pull from length extra in inffast.c + * - Unroll direct copy to three copies per loop in inffast.c + * + * 1.2.beta2 4 Dec 2002 + * - Change external routine names to reduce potential conflicts + * - Correct filename to inffixed.h for fixed tables in inflate.c + * - Make hbuf[] unsigned char to match parameter type in inflate.c + * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) + * to avoid negation problem on Alphas (64 bit) in inflate.c + * + * 1.2.beta3 22 Dec 2002 + * - Add comments on state->bits assertion in inffast.c + * - Add comments on op field in inftrees.h + * - Fix bug in reuse of allocated window after inflateReset() + * - Remove bit fields--back to byte structure for speed + * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths + * - Change post-increments to pre-increments in inflate_fast(), PPC biased? + * - Add compile time option, POSTINC, to use post-increments instead (Intel?) + * - Make MATCH copy in inflate() much faster for when inflate_fast() not used + * - Use local copies of stream next and avail values, as well as local bit + * buffer and bit count in inflate()--for speed when inflate_fast() not used + * + * 1.2.beta4 1 Jan 2003 + * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings + * - Move a comment on output buffer sizes from inffast.c to inflate.c + * - Add comments in inffast.c to introduce the inflate_fast() routine + * - Rearrange window copies in inflate_fast() for speed and simplification + * - Unroll last copy for window match in inflate_fast() + * - Use local copies of window variables in inflate_fast() for speed + * - Pull out common write == 0 case for speed in inflate_fast() + * - Make op and len in inflate_fast() unsigned for consistency + * - Add FAR to lcode and dcode declarations in inflate_fast() + * - Simplified bad distance check in inflate_fast() + * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new + * source file infback.c to provide a call-back interface to inflate for + * programs like gzip and unzip -- uses window as output buffer to avoid + * window copying + * + * 1.2.beta5 1 Jan 2003 + * - Improved inflateBack() interface to allow the caller to provide initial + * input in strm. + * - Fixed stored blocks bug in inflateBack() + * + * 1.2.beta6 4 Jan 2003 + * - Added comments in inffast.c on effectiveness of POSTINC + * - Typecasting all around to reduce compiler warnings + * - Changed loops from while (1) or do {} while (1) to for (;;), again to + * make compilers happy + * - Changed type of window in inflateBackInit() to unsigned char * + * + * 1.2.beta7 27 Jan 2003 + * - Changed many types to unsigned or unsigned short to avoid warnings + * - Added inflateCopy() function + * + * 1.2.0 9 Mar 2003 + * - Changed inflateBack() interface to provide separate opaque descriptors + * for the in() and out() functions + * - Changed inflateBack() argument and in_func typedef to swap the length + * and buffer address return values for the input function + * - Check next_in and next_out for Z_NULL on entry to inflate() + * + * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. + */ + +#include "zutil.h" +#include "inftrees.h" +#include "inflate.h" +#include "inffast.h" + +#ifdef MAKEFIXED +# ifndef BUILDFIXED +# define BUILDFIXED +# endif +#endif + +/* function prototypes */ +local void fixedtables OF((struct inflate_state FAR *state)); +local int updatewindow OF((z_streamp strm, unsigned out)); +#ifdef BUILDFIXED + void makefixed OF((void)); +#endif +local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, + unsigned len)); + +int ZEXPORT inflateReset(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + strm->total_in = strm->total_out = state->total = 0; + strm->msg = Z_NULL; + state->mode = HEAD; + state->last = 0; + state->havedict = 0; + state->wsize = 0; + state->whave = 0; + state->hold = 0; + state->bits = 0; + state->lencode = state->distcode = state->next = state->codes; + Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) +z_streamp strm; +int windowBits; +const char *version; +int stream_size; +{ + struct inflate_state FAR *state; + + if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || + stream_size != (int)(sizeof(z_stream))) + return Z_VERSION_ERROR; + if (strm == Z_NULL) return Z_STREAM_ERROR; + strm->msg = Z_NULL; /* in case we return an error */ + if (strm->zalloc == (alloc_func)0) { + strm->zalloc = zcalloc; + strm->opaque = (voidpf)0; + } + if (strm->zfree == (free_func)0) strm->zfree = zcfree; + state = (struct inflate_state FAR *) + ZALLOC(strm, 1, sizeof(struct inflate_state)); + if (state == Z_NULL) return Z_MEM_ERROR; + Tracev((stderr, "inflate: allocated\n")); + strm->state = (voidpf)state; + if (windowBits < 0) { + state->wrap = 0; + windowBits = -windowBits; + } + else { + state->wrap = (windowBits >> 4) + 1; +#ifdef GUNZIP + if (windowBits < 48) windowBits &= 15; +#endif + } + if (windowBits < 8 || windowBits > 15) { + ZFREE(strm, state); + strm->state = Z_NULL; + return Z_STREAM_ERROR; + } + state->wbits = (unsigned)windowBits; + state->window = Z_NULL; + return inflateReset(strm); +} + +int ZEXPORT inflateInit_(strm, version, stream_size) +z_streamp strm; +const char *version; +int stream_size; +{ + return inflateInit2_(strm, DEF_WBITS, version, stream_size); +} + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +local void fixedtables(state) +struct inflate_state FAR *state; +{ +#ifdef BUILDFIXED + static int virgin = 1; + static code *lenfix, *distfix; + static code fixed[544]; + + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + unsigned sym, bits; + static code *next; + + /* literal/length table */ + sym = 0; + while (sym < 144) state->lens[sym++] = 8; + while (sym < 256) state->lens[sym++] = 9; + while (sym < 280) state->lens[sym++] = 7; + while (sym < 288) state->lens[sym++] = 8; + next = fixed; + lenfix = next; + bits = 9; + inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); + + /* distance table */ + sym = 0; + while (sym < 32) state->lens[sym++] = 5; + distfix = next; + bits = 5; + inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); + + /* do this just once */ + virgin = 0; + } +#else /* !BUILDFIXED */ +# include "inffixed.h" +#endif /* BUILDFIXED */ + state->lencode = lenfix; + state->lenbits = 9; + state->distcode = distfix; + state->distbits = 5; +} + +#ifdef MAKEFIXED +#include + +/* + Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also + defines BUILDFIXED, so the tables are built on the fly. makefixed() writes + those tables to stdout, which would be piped to inffixed.h. A small program + can simply call makefixed to do this: + + void makefixed(void); + + int main(void) + { + makefixed(); + return 0; + } + + Then that can be linked with zlib built with MAKEFIXED defined and run: + + a.out > inffixed.h + */ +void makefixed() +{ + unsigned low, size; + struct inflate_state state; + + fixedtables(&state); + puts(" /* inffixed.h -- table for decoding fixed codes"); + puts(" * Generated automatically by makefixed()."); + puts(" */"); + puts(""); + puts(" /* WARNING: this file should *not* be used by applications."); + puts(" It is part of the implementation of this library and is"); + puts(" subject to change. Applications should only use zlib.h."); + puts(" */"); + puts(""); + size = 1U << 9; + printf(" static const code lenfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 7) == 0) printf("\n "); + printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, + state.lencode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); + size = 1U << 5; + printf("\n static const code distfix[%u] = {", size); + low = 0; + for (;;) { + if ((low % 6) == 0) printf("\n "); + printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, + state.distcode[low].val); + if (++low == size) break; + putchar(','); + } + puts("\n };"); +} +#endif /* MAKEFIXED */ + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +local int updatewindow(strm, out) +z_streamp strm; +unsigned out; +{ + struct inflate_state FAR *state; + unsigned copy, dist; + + state = (struct inflate_state FAR *)strm->state; + + /* if it hasn't been done already, allocate space for the window */ + if (state->window == Z_NULL) { + state->window = (unsigned char FAR *) + ZALLOC(strm, 1U << state->wbits, + sizeof(unsigned char)); + if (state->window == Z_NULL) return 1; + } + + /* if window not in use yet, initialize */ + if (state->wsize == 0) { + state->wsize = 1U << state->wbits; + state->write = 0; + state->whave = 0; + } + + /* copy state->wsize or less output bytes into the circular window */ + copy = out - strm->avail_out; + if (copy >= state->wsize) { + zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); + state->write = 0; + state->whave = state->wsize; + } + else { + dist = state->wsize - state->write; + if (dist > copy) dist = copy; + zmemcpy(state->window + state->write, strm->next_out - copy, dist); + copy -= dist; + if (copy) { + zmemcpy(state->window, strm->next_out - copy, copy); + state->write = copy; + state->whave = state->wsize; + } + else { + state->write += dist; + if (state->write == state->wsize) state->write = 0; + if (state->whave < state->wsize) state->whave += dist; + } + } + return 0; +} + +/* Macros for inflate(): */ + +/* check function to use adler32() for zlib or crc32() for gzip */ +#ifdef GUNZIP +# define UPDATE(check, buf, len) \ + (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) +#else +# define UPDATE(check, buf, len) adler32(check, buf, len) +#endif + +/* check macros for header crc */ +#ifdef GUNZIP +# define CRC2(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + check = crc32(check, hbuf, 2); \ + } while (0) + +# define CRC4(check, word) \ + do { \ + hbuf[0] = (unsigned char)(word); \ + hbuf[1] = (unsigned char)((word) >> 8); \ + hbuf[2] = (unsigned char)((word) >> 16); \ + hbuf[3] = (unsigned char)((word) >> 24); \ + check = crc32(check, hbuf, 4); \ + } while (0) +#endif + +/* Load registers with state in inflate() for speed */ +#define LOAD() \ + do { \ + put = strm->next_out; \ + left = strm->avail_out; \ + next = strm->next_in; \ + have = strm->avail_in; \ + hold = state->hold; \ + bits = state->bits; \ + } while (0) + +/* Restore state from registers in inflate() */ +#define RESTORE() \ + do { \ + strm->next_out = put; \ + strm->avail_out = left; \ + strm->next_in = next; \ + strm->avail_in = have; \ + state->hold = hold; \ + state->bits = bits; \ + } while (0) + +/* Clear the input bit accumulator */ +#define INITBITS() \ + do { \ + hold = 0; \ + bits = 0; \ + } while (0) + +/* Get a byte of input into the bit accumulator, or return from inflate() + if there is no input available. */ +#define PULLBYTE() \ + do { \ + if (have == 0) goto inf_leave; \ + have--; \ + hold += (unsigned long)(*next++) << bits; \ + bits += 8; \ + } while (0) + +/* Assure that there are at least n bits in the bit accumulator. If there is + not enough available input to do that, then return from inflate(). */ +#define NEEDBITS(n) \ + do { \ + while (bits < (unsigned)(n)) \ + PULLBYTE(); \ + } while (0) + +/* Return the low n bits of the bit accumulator (n < 16) */ +#define BITS(n) \ + ((unsigned)hold & ((1U << (n)) - 1)) + +/* Remove n bits from the bit accumulator */ +#define DROPBITS(n) \ + do { \ + hold >>= (n); \ + bits -= (unsigned)(n); \ + } while (0) + +/* Remove zero to seven bits as needed to go to a byte boundary */ +#define BYTEBITS() \ + do { \ + hold >>= bits & 7; \ + bits -= bits & 7; \ + } while (0) + +/* Reverse the bytes in a 32-bit value */ +#define REVERSE(q) \ + ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ + (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) + +/* + inflate() uses a state machine to process as much input data and generate as + much output data as possible before returning. The state machine is + structured roughly as follows: + + for (;;) switch (state) { + ... + case STATEn: + if (not enough input data or output space to make progress) + return; + ... make progress ... + state = STATEm; + break; + ... + } + + so when inflate() is called again, the same case is attempted again, and + if the appropriate resources are provided, the machine proceeds to the + next state. The NEEDBITS() macro is usually the way the state evaluates + whether it can proceed or should return. NEEDBITS() does the return if + the requested bits are not available. The typical use of the BITS macros + is: + + NEEDBITS(n); + ... do something with BITS(n) ... + DROPBITS(n); + + where NEEDBITS(n) either returns from inflate() if there isn't enough + input left to load n bits into the accumulator, or it continues. BITS(n) + gives the low n bits in the accumulator. When done, DROPBITS(n) drops + the low n bits off the accumulator. INITBITS() clears the accumulator + and sets the number of available bits to zero. BYTEBITS() discards just + enough bits to put the accumulator on a byte boundary. After BYTEBITS() + and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. + + NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return + if there is no input available. The decoding of variable length codes uses + PULLBYTE() directly in order to pull just enough bytes to decode the next + code, and no more. + + Some states loop until they get enough input, making sure that enough + state information is maintained to continue the loop where it left off + if NEEDBITS() returns in the loop. For example, want, need, and keep + would all have to actually be part of the saved state in case NEEDBITS() + returns: + + case STATEw: + while (want < need) { + NEEDBITS(n); + keep[want++] = BITS(n); + DROPBITS(n); + } + state = STATEx; + case STATEx: + + As shown above, if the next state is also the next case, then the break + is omitted. + + A state may also return if there is not enough output space available to + complete that state. Those states are copying stored data, writing a + literal byte, and copying a matching string. + + When returning, a "goto inf_leave" is used to update the total counters, + update the check value, and determine whether any progress has been made + during that inflate() call in order to return the proper return code. + Progress is defined as a change in either strm->avail_in or strm->avail_out. + When there is a window, goto inf_leave will update the window with the last + output written. If a goto inf_leave occurs in the middle of decompression + and there is no window currently, goto inf_leave will create one and copy + output to the window for the next call of inflate(). + + In this implementation, the flush parameter of inflate() only affects the + return code (per zlib.h). inflate() always writes as much as possible to + strm->next_out, given the space available and the provided input--the effect + documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers + the allocation of and copying into a sliding window until necessary, which + provides the effect documented in zlib.h for Z_FINISH when the entire input + stream available. So the only thing the flush parameter actually does is: + when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it + will return Z_BUF_ERROR if it has not reached the end of the stream. + */ + +int ZEXPORT inflate(strm, flush) +z_streamp strm; +int flush; +{ + struct inflate_state FAR *state; + unsigned char FAR *next; /* next input */ + unsigned char FAR *put; /* next output */ + unsigned have, left; /* available input and output */ + unsigned long hold; /* bit buffer */ + unsigned bits; /* bits in bit buffer */ + unsigned in, out; /* save starting available input and output */ + unsigned copy; /* number of stored or match bytes to copy */ + unsigned char FAR *from; /* where to copy match bytes from */ + code this; /* current decoding table entry */ + code last; /* parent table entry */ + unsigned len; /* length to copy for repeats, bits to drop */ + int ret; /* return code */ +#ifdef GUNZIP + unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ +#endif + static const unsigned short order[19] = /* permutation of code lengths */ + {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; + + if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || + (strm->next_in == Z_NULL && strm->avail_in != 0)) + return Z_STREAM_ERROR; + + state = (struct inflate_state FAR *)strm->state; + if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ + LOAD(); + in = have; + out = left; + ret = Z_OK; + for (;;) + switch (state->mode) { + case HEAD: + if (state->wrap == 0) { + state->mode = TYPEDO; + break; + } + NEEDBITS(16); +#ifdef GUNZIP + if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ + state->check = crc32(0L, Z_NULL, 0); + CRC2(state->check, hold); + INITBITS(); + state->mode = FLAGS; + break; + } + state->flags = 0; /* expect zlib header */ + if (!(state->wrap & 1) || /* check if zlib header allowed */ +#else + if ( +#endif + ((BITS(8) << 8) + (hold >> 8)) % 31) { + strm->msg = (char *)"incorrect header check"; + state->mode = BAD; + break; + } + if (BITS(4) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + DROPBITS(4); + if (BITS(4) + 8 > state->wbits) { + strm->msg = (char *)"invalid window size"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: zlib header ok\n")); + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = hold & 0x200 ? DICTID : TYPE; + INITBITS(); + break; +#ifdef GUNZIP + case FLAGS: + NEEDBITS(16); + state->flags = (int)(hold); + if ((state->flags & 0xff) != Z_DEFLATED) { + strm->msg = (char *)"unknown compression method"; + state->mode = BAD; + break; + } + if (state->flags & 0xe000) { + strm->msg = (char *)"unknown header flags set"; + state->mode = BAD; + break; + } + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = TIME; + case TIME: + NEEDBITS(32); + if (state->flags & 0x0200) CRC4(state->check, hold); + INITBITS(); + state->mode = OS; + case OS: + NEEDBITS(16); + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + state->mode = EXLEN; + case EXLEN: + if (state->flags & 0x0400) { + NEEDBITS(16); + state->length = (unsigned)(hold); + if (state->flags & 0x0200) CRC2(state->check, hold); + INITBITS(); + } + state->mode = EXTRA; + case EXTRA: + if (state->flags & 0x0400) { + copy = state->length; + if (copy > have) copy = have; + if (copy) { + if (state->flags & 0x0200) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + state->length -= copy; + } + if (state->length) goto inf_leave; + } + state->mode = NAME; + case NAME: + if (state->flags & 0x0800) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + } while (len && copy < have); + if (state->flags & 0x02000) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + state->mode = COMMENT; + case COMMENT: + if (state->flags & 0x1000) { + if (have == 0) goto inf_leave; + copy = 0; + do { + len = (unsigned)(next[copy++]); + } while (len && copy < have); + if (state->flags & 0x02000) + state->check = crc32(state->check, next, copy); + have -= copy; + next += copy; + if (len) goto inf_leave; + } + state->mode = HCRC; + case HCRC: + if (state->flags & 0x0200) { + NEEDBITS(16); + if (hold != (state->check & 0xffff)) { + strm->msg = (char *)"header crc mismatch"; + state->mode = BAD; + break; + } + INITBITS(); + } + strm->adler = state->check = crc32(0L, Z_NULL, 0); + state->mode = TYPE; + break; +#endif + case DICTID: + NEEDBITS(32); + strm->adler = state->check = REVERSE(hold); + INITBITS(); + state->mode = DICT; + case DICT: + if (state->havedict == 0) { + RESTORE(); + return Z_NEED_DICT; + } + strm->adler = state->check = adler32(0L, Z_NULL, 0); + state->mode = TYPE; + case TYPE: + if (flush == Z_BLOCK) goto inf_leave; + case TYPEDO: + if (state->last) { + BYTEBITS(); + state->mode = CHECK; + break; + } + NEEDBITS(3); + state->last = BITS(1); + DROPBITS(1); + switch (BITS(2)) { + case 0: /* stored block */ + Tracev((stderr, "inflate: stored block%s\n", + state->last ? " (last)" : "")); + state->mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + Tracev((stderr, "inflate: fixed codes block%s\n", + state->last ? " (last)" : "")); + state->mode = LEN; /* decode codes */ + break; + case 2: /* dynamic block */ + Tracev((stderr, "inflate: dynamic codes block%s\n", + state->last ? " (last)" : "")); + state->mode = TABLE; + break; + case 3: + strm->msg = (char *)"invalid block type"; + state->mode = BAD; + } + DROPBITS(2); + break; + case STORED: + BYTEBITS(); /* go to byte boundary */ + NEEDBITS(32); + if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { + strm->msg = (char *)"invalid stored block lengths"; + state->mode = BAD; + break; + } + state->length = (unsigned)hold & 0xffff; + Tracev((stderr, "inflate: stored length %u\n", + state->length)); + INITBITS(); + state->mode = COPY; + case COPY: + copy = state->length; + if (copy) { + if (copy > have) copy = have; + if (copy > left) copy = left; + if (copy == 0) goto inf_leave; + zmemcpy(put, next, copy); + have -= copy; + next += copy; + left -= copy; + put += copy; + state->length -= copy; + break; + } + Tracev((stderr, "inflate: stored end\n")); + state->mode = TYPE; + break; + case TABLE: + NEEDBITS(14); + state->nlen = BITS(5) + 257; + DROPBITS(5); + state->ndist = BITS(5) + 1; + DROPBITS(5); + state->ncode = BITS(4) + 4; + DROPBITS(4); +#ifndef PKZIP_BUG_WORKAROUND + if (state->nlen > 286 || state->ndist > 30) { + strm->msg = (char *)"too many length or distance symbols"; + state->mode = BAD; + break; + } +#endif + Tracev((stderr, "inflate: table sizes ok\n")); + state->have = 0; + state->mode = LENLENS; + case LENLENS: + while (state->have < state->ncode) { + NEEDBITS(3); + state->lens[order[state->have++]] = (unsigned short)BITS(3); + DROPBITS(3); + } + while (state->have < 19) + state->lens[order[state->have++]] = 0; + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 7; + ret = inflate_table(CODES, state->lens, 19, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid code lengths set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: code lengths ok\n")); + state->have = 0; + state->mode = CODELENS; + case CODELENS: + while (state->have < state->nlen + state->ndist) { + for (;;) { + this = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if (this.val < 16) { + NEEDBITS(this.bits); + DROPBITS(this.bits); + state->lens[state->have++] = this.val; + } + else { + if (this.val == 16) { + NEEDBITS(this.bits + 2); + DROPBITS(this.bits); + if (state->have == 0) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + len = state->lens[state->have - 1]; + copy = 3 + BITS(2); + DROPBITS(2); + } + else if (this.val == 17) { + NEEDBITS(this.bits + 3); + DROPBITS(this.bits); + len = 0; + copy = 3 + BITS(3); + DROPBITS(3); + } + else { + NEEDBITS(this.bits + 7); + DROPBITS(this.bits); + len = 0; + copy = 11 + BITS(7); + DROPBITS(7); + } + if (state->have + copy > state->nlen + state->ndist) { + strm->msg = (char *)"invalid bit length repeat"; + state->mode = BAD; + break; + } + while (copy--) + state->lens[state->have++] = (unsigned short)len; + } + } + + /* build code tables */ + state->next = state->codes; + state->lencode = (code const FAR *)(state->next); + state->lenbits = 9; + ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), + &(state->lenbits), state->work); + if (ret) { + strm->msg = (char *)"invalid literal/lengths set"; + state->mode = BAD; + break; + } + state->distcode = (code const FAR *)(state->next); + state->distbits = 6; + ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, + &(state->next), &(state->distbits), state->work); + if (ret) { + strm->msg = (char *)"invalid distances set"; + state->mode = BAD; + break; + } + Tracev((stderr, "inflate: codes ok\n")); + state->mode = LEN; + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); + inflate_fast(strm, out); + LOAD(); + break; + } + for (;;) { + this = state->lencode[BITS(state->lenbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if (this.op && (this.op & 0xf0) == 0) { + last = this; + for (;;) { + this = state->lencode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + this.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(this.bits); + state->length = (unsigned)this.val; + if ((int)(this.op) == 0) { + Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? + "inflate: literal '%c'\n" : + "inflate: literal 0x%02x\n", this.val)); + state->mode = LIT; + break; + } + if (this.op & 32) { + Tracevv((stderr, "inflate: end of block\n")); + state->mode = TYPE; + break; + } + if (this.op & 64) { + strm->msg = (char *)"invalid literal/length code"; + state->mode = BAD; + break; + } + state->extra = (unsigned)(this.op) & 15; + state->mode = LENEXT; + case LENEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->length += BITS(state->extra); + DROPBITS(state->extra); + } + Tracevv((stderr, "inflate: length %u\n", state->length)); + state->mode = DIST; + case DIST: + for (;;) { + this = state->distcode[BITS(state->distbits)]; + if ((unsigned)(this.bits) <= bits) break; + PULLBYTE(); + } + if ((this.op & 0xf0) == 0) { + last = this; + for (;;) { + this = state->distcode[last.val + + (BITS(last.bits + last.op) >> last.bits)]; + if ((unsigned)(last.bits + this.bits) <= bits) break; + PULLBYTE(); + } + DROPBITS(last.bits); + } + DROPBITS(this.bits); + if (this.op & 64) { + strm->msg = (char *)"invalid distance code"; + state->mode = BAD; + break; + } + state->offset = (unsigned)this.val; + state->extra = (unsigned)(this.op) & 15; + state->mode = DISTEXT; + case DISTEXT: + if (state->extra) { + NEEDBITS(state->extra); + state->offset += BITS(state->extra); + DROPBITS(state->extra); + } + if (state->offset > state->whave + out - left) { + strm->msg = (char *)"invalid distance too far back"; + state->mode = BAD; + break; + } + Tracevv((stderr, "inflate: distance %u\n", state->offset)); + state->mode = MATCH; + case MATCH: + if (left == 0) goto inf_leave; + copy = out - left; + if (state->offset > copy) { /* copy from window */ + copy = state->offset - copy; + if (copy > state->write) { + copy -= state->write; + from = state->window + (state->wsize - copy); + } + else + from = state->window + (state->write - copy); + if (copy > state->length) copy = state->length; + } + else { /* copy from output */ + from = put - state->offset; + copy = state->length; + } + if (copy > left) copy = left; + left -= copy; + state->length -= copy; + do { + *put++ = *from++; + } while (--copy); + if (state->length == 0) state->mode = LEN; + break; + case LIT: + if (left == 0) goto inf_leave; + *put++ = (unsigned char)(state->length); + left--; + state->mode = LEN; + break; + case CHECK: + if (state->wrap) { + NEEDBITS(32); + out -= left; + strm->total_out += out; + state->total += out; + if (out) + strm->adler = state->check = + UPDATE(state->check, put - out, out); + out = left; + if (( +#ifdef GUNZIP + state->flags ? hold : +#endif + REVERSE(hold)) != state->check) { + strm->msg = (char *)"incorrect data check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: check matches trailer\n")); + } +#ifdef GUNZIP + state->mode = LENGTH; + case LENGTH: + if (state->wrap && state->flags) { + NEEDBITS(32); + if (hold != (state->total & 0xffffffffUL)) { + strm->msg = (char *)"incorrect length check"; + state->mode = BAD; + break; + } + INITBITS(); + Tracev((stderr, "inflate: length matches trailer\n")); + } +#endif + state->mode = DONE; + case DONE: + ret = Z_STREAM_END; + goto inf_leave; + case BAD: + ret = Z_DATA_ERROR; + goto inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + default: + return Z_STREAM_ERROR; + } + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: + RESTORE(); + if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) + if (updatewindow(strm, out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + in -= strm->avail_in; + out -= strm->avail_out; + strm->total_in += in; + strm->total_out += out; + state->total += out; + if (state->wrap && out) + strm->adler = state->check = + UPDATE(state->check, strm->next_out - out, out); + strm->data_type = state->bits + (state->last ? 64 : 0) + + (state->mode == TYPE ? 128 : 0); + if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) + ret = Z_BUF_ERROR; + return ret; +} + +int ZEXPORT inflateEnd(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->window != Z_NULL) ZFREE(strm, state->window); + ZFREE(strm, strm->state); + strm->state = Z_NULL; + Tracev((stderr, "inflate: end\n")); + return Z_OK; +} + +int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) +z_streamp strm; +const Bytef *dictionary; +uInt dictLength; +{ + struct inflate_state FAR *state; + unsigned long id; + + /* check state */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (state->mode != DICT) return Z_STREAM_ERROR; + + /* check for correct dictionary id */ + id = adler32(0L, Z_NULL, 0); + id = adler32(id, dictionary, dictLength); + if (id != state->check) return Z_DATA_ERROR; + + /* copy dictionary to window */ + if (updatewindow(strm, strm->avail_out)) { + state->mode = MEM; + return Z_MEM_ERROR; + } + if (dictLength > state->wsize) { + zmemcpy(state->window, dictionary + dictLength - state->wsize, + state->wsize); + state->whave = state->wsize; + } + else { + zmemcpy(state->window + state->wsize - dictLength, dictionary, + dictLength); + state->whave = dictLength; + } + state->havedict = 1; + Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +/* + Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found + or when out of input. When called, *have is the number of pattern bytes + found in order so far, in 0..3. On return *have is updated to the new + state. If on return *have equals four, then the pattern was found and the + return value is how many bytes were read including the last byte of the + pattern. If *have is less than four, then the pattern has not been found + yet and the return value is len. In the latter case, syncsearch() can be + called again with more data and the *have state. *have is initialized to + zero for the first call. + */ +local unsigned syncsearch(have, buf, len) +unsigned FAR *have; +unsigned char FAR *buf; +unsigned len; +{ + unsigned got; + unsigned next; + + got = *have; + next = 0; + while (next < len && got < 4) { + if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) + got++; + else if (buf[next]) + got = 0; + else + got = 4 - got; + next++; + } + *have = got; + return next; +} + +int ZEXPORT inflateSync(strm) +z_streamp strm; +{ + unsigned len; /* number of bytes to look at or looked at */ + unsigned long in, out; /* temporary to save total_in and total_out */ + unsigned char buf[4]; /* to restore bit buffer to byte string */ + struct inflate_state FAR *state; + + /* check parameters */ + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; + + /* if first time, start search in bit buffer */ + if (state->mode != SYNC) { + state->mode = SYNC; + state->hold <<= state->bits & 7; + state->bits -= state->bits & 7; + len = 0; + while (state->bits >= 8) { + buf[len++] = (unsigned char)(state->hold); + state->hold >>= 8; + state->bits -= 8; + } + state->have = 0; + syncsearch(&(state->have), buf, len); + } + + /* search available input */ + len = syncsearch(&(state->have), strm->next_in, strm->avail_in); + strm->avail_in -= len; + strm->next_in += len; + strm->total_in += len; + + /* return no joy or set up to restart inflate() on a new block */ + if (state->have != 4) return Z_DATA_ERROR; + in = strm->total_in; out = strm->total_out; + inflateReset(strm); + strm->total_in = in; strm->total_out = out; + state->mode = TYPE; + return Z_OK; +} + +/* + Returns true if inflate is currently at the end of a block generated by + Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP + implementation to provide an additional safety check. PPP uses + Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored + block. When decompressing, PPP checks that at the end of input packet, + inflate is waiting for these length bytes. + */ +int ZEXPORT inflateSyncPoint(strm) +z_streamp strm; +{ + struct inflate_state FAR *state; + + if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)strm->state; + return state->mode == STORED && state->bits == 0; +} + +int ZEXPORT inflateCopy(dest, source) +z_streamp dest; +z_streamp source; +{ + struct inflate_state FAR *state; + struct inflate_state FAR *copy; + unsigned char FAR *window; + + /* check input */ + if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || + source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) + return Z_STREAM_ERROR; + state = (struct inflate_state FAR *)source->state; + + /* allocate space */ + copy = (struct inflate_state FAR *) + ZALLOC(source, 1, sizeof(struct inflate_state)); + if (copy == Z_NULL) return Z_MEM_ERROR; + window = Z_NULL; + if (state->window != Z_NULL) { + window = (unsigned char FAR *) + ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); + if (window == Z_NULL) { + ZFREE(source, copy); + return Z_MEM_ERROR; + } + } + + /* copy state */ + *dest = *source; + *copy = *state; + copy->lencode = copy->codes + (state->lencode - state->codes); + copy->distcode = copy->codes + (state->distcode - state->codes); + copy->next = copy->codes + (state->next - state->codes); + if (window != Z_NULL) + zmemcpy(window, state->window, 1U << state->wbits); + copy->window = window; + dest->state = (voidpf)copy; + return Z_OK; +} diff --git a/klibc/klibc/zlib/inflate.h b/klibc/klibc/zlib/inflate.h new file mode 100644 index 0000000000..9a12c8fd29 --- /dev/null +++ b/klibc/klibc/zlib/inflate.h @@ -0,0 +1,117 @@ +/* inflate.h -- internal inflate state definition + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* define NO_GZIP when compiling if you want to disable gzip header and + trailer decoding by inflate(). NO_GZIP would be used to avoid linking in + the crc code when it is not needed. For shared libraries, gzip decoding + should be left enabled. */ +#ifndef NO_GZIP +# define GUNZIP +#endif + +/* Possible inflate modes between inflate() calls */ +typedef enum { + HEAD, /* i: waiting for magic header */ +#ifdef GUNZIP + FLAGS, /* i: waiting for method and flags (gzip) */ + TIME, /* i: waiting for modification time (gzip) */ + OS, /* i: waiting for extra flags and operating system (gzip) */ + EXLEN, /* i: waiting for extra length (gzip) */ + EXTRA, /* i: waiting for extra bytes (gzip) */ + NAME, /* i: waiting for end of file name (gzip) */ + COMMENT, /* i: waiting for end of comment (gzip) */ + HCRC, /* i: waiting for header crc (gzip) */ +#endif + DICTID, /* i: waiting for dictionary check value */ + DICT, /* waiting for inflateSetDictionary() call */ + TYPE, /* i: waiting for type bits, including last-flag bit */ + TYPEDO, /* i: same, but skip check to exit inflate on new block */ + STORED, /* i: waiting for stored size (length and complement) */ + COPY, /* i/o: waiting for input or output to copy stored block */ + TABLE, /* i: waiting for dynamic block table lengths */ + LENLENS, /* i: waiting for code length code lengths */ + CODELENS, /* i: waiting for length/lit and distance code lengths */ + LEN, /* i: waiting for length/lit code */ + LENEXT, /* i: waiting for length extra bits */ + DIST, /* i: waiting for distance code */ + DISTEXT, /* i: waiting for distance extra bits */ + MATCH, /* o: waiting for output space to copy string */ + LIT, /* o: waiting for output space to write literal */ + CHECK, /* i: waiting for 32-bit check value */ +#ifdef GUNZIP + LENGTH, /* i: waiting for 32-bit length (gzip) */ +#endif + DONE, /* finished check, done -- remain here until reset */ + BAD, /* got a data error -- remain here until reset */ + MEM, /* got an inflate() memory error -- remain here until reset */ + SYNC /* looking for synchronization bytes to restart inflate() */ +} inflate_mode; + +/* + State transitions between above modes - + + (most modes can go to the BAD or MEM mode -- not shown for clarity) + + Process header: + HEAD -> (gzip) or (zlib) + (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME + NAME -> COMMENT -> HCRC -> TYPE + (zlib) -> DICTID or TYPE + DICTID -> DICT -> TYPE + Read deflate blocks: + TYPE -> STORED or TABLE or LEN or CHECK + STORED -> COPY -> TYPE + TABLE -> LENLENS -> CODELENS -> LEN + Read deflate codes: + LEN -> LENEXT or LIT or TYPE + LENEXT -> DIST -> DISTEXT -> MATCH -> LEN + LIT -> LEN + Process trailer: + CHECK -> LENGTH -> DONE + */ + +/* state maintained between inflate() calls. Approximately 7K bytes. */ +struct inflate_state { + inflate_mode mode; /* current inflate mode */ + int last; /* true if processing last block */ + int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ + int havedict; /* true if dictionary provided */ + int flags; /* gzip header method and flags (0 if zlib) */ + unsigned long check; /* protected copy of check value */ + unsigned long total; /* protected copy of output count */ + /* sliding window */ + unsigned wbits; /* log base 2 of requested window size */ + unsigned wsize; /* window size or zero if not using window */ + unsigned whave; /* valid bytes in the window */ + unsigned write; /* window write index */ + unsigned char FAR *window; /* allocated sliding window, if needed */ + /* bit accumulator */ + unsigned long hold; /* input bit accumulator */ + unsigned bits; /* number of bits in "in" */ + /* for string and stored block copying */ + unsigned length; /* literal or length of data to copy */ + unsigned offset; /* distance back to copy string from */ + /* for table and code decoding */ + unsigned extra; /* extra bits needed */ + /* fixed and dynamic code tables */ + code const FAR *lencode; /* starting table for length/literal codes */ + code const FAR *distcode; /* starting table for distance codes */ + unsigned lenbits; /* index bits for lencode */ + unsigned distbits; /* index bits for distcode */ + /* dynamic table building */ + unsigned ncode; /* number of code length code lengths */ + unsigned nlen; /* number of length code lengths */ + unsigned ndist; /* number of distance code lengths */ + unsigned have; /* number of code lengths in lens[] */ + code FAR *next; /* next available space in codes[] */ + unsigned short lens[320]; /* temporary storage for code lengths */ + unsigned short work[288]; /* work area for code table building */ + code codes[ENOUGH]; /* space for code tables */ +}; diff --git a/klibc/klibc/zlib/inftrees.c b/klibc/klibc/zlib/inftrees.c new file mode 100644 index 0000000000..3bb56398e1 --- /dev/null +++ b/klibc/klibc/zlib/inftrees.c @@ -0,0 +1,321 @@ +/* inftrees.c -- generate Huffman trees for efficient decoding + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +#include "zutil.h" +#include "inftrees.h" + +#define MAXBITS 15 + +const char inflate_copyright[] = + " inflate 1.2.1 Copyright 1995-2003 Mark Adler "; +/* + If you use the zlib library in a product, an acknowledgment is welcome + in the documentation of your product. If for some reason you cannot + include such an acknowledgment, I would appreciate that you keep this + copyright string in the executable of your product. + */ + +/* + Build a set of tables to decode the provided canonical Huffman code. + The code lengths are lens[0..codes-1]. The result starts at *table, + whose indices are 0..2^bits-1. work is a writable array of at least + lens shorts, which is used as a work area. type is the type of code + to be generated, CODES, LENS, or DISTS. On return, zero is success, + -1 is an invalid code, and +1 means that ENOUGH isn't enough. table + on return points to the next available entry's address. bits is the + requested root table index bits, and on return it is the actual root + table index bits. It will differ if the request is greater than the + longest code or if it is less than the shortest code. + */ +int inflate_table(type, lens, codes, table, bits, work) +codetype type; +unsigned short FAR *lens; +unsigned codes; +code FAR * FAR *table; +unsigned FAR *bits; +unsigned short FAR *work; +{ + unsigned len; /* a code's length in bits */ + unsigned sym; /* index of code symbols */ + unsigned min, max; /* minimum and maximum code lengths */ + unsigned root; /* number of index bits for root table */ + unsigned curr; /* number of index bits for current table */ + unsigned drop; /* code bits to drop for sub-table */ + int left; /* number of prefix codes available */ + unsigned used; /* code entries in table used */ + unsigned huff; /* Huffman code */ + unsigned incr; /* for incrementing code, index */ + unsigned fill; /* index for replicating entries */ + unsigned low; /* low bits for current root entry */ + unsigned mask; /* mask for low root bits */ + code this; /* table entry for duplication */ + code FAR *next; /* next available space in table */ + const unsigned short FAR *base; /* base value table to use */ + const unsigned short FAR *extra; /* extra bits table to use */ + int end; /* use base and extra for symbol > end */ + unsigned short count[MAXBITS+1]; /* number of codes of each length */ + unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ + static const unsigned short lbase[31] = { /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; + static const unsigned short lext[31] = { /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 76, 66}; + static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0}; + static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64}; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) + count[len] = 0; + for (sym = 0; sym < codes; sym++) + count[lens[sym]]++; + + /* bound code lengths, force root to be within code lengths */ + root = *bits; + for (max = MAXBITS; max >= 1; max--) + if (count[max] != 0) break; + if (root > max) root = max; + if (max == 0) return -1; /* no codes! */ + for (min = 1; min <= MAXBITS; min++) + if (count[min] != 0) break; + if (root < min) root = min; + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) return -1; /* over-subscribed */ + } + if (left > 0 && (type == CODES || (codes - count[0] != 1))) + return -1; /* incomplete set */ + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) + offs[len + 1] = offs[len] + count[len]; + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) + if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked when a LENS table is being made + against the space in *table, ENOUGH, minus the maximum space needed by + the worst case distance code, MAXD. This should never happen, but the + sufficiency of ENOUGH has not been proven exhaustively, hence the check. + This assumes that when type == LENS, bits == 9. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + switch (type) { + case CODES: + base = extra = work; /* dummy value--not used */ + end = 19; + break; + case LENS: + base = lbase; + base -= 257; + extra = lext; + extra -= 257; + end = 256; + break; + default: /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize state for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = *table; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = (unsigned)(-1); /* trigger new sub-table when len > root */ + used = 1U << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if (type == LENS && used >= ENOUGH - MAXD) + return 1; + + /* process all codes and make table entries */ + for (;;) { + /* create table entry */ + this.bits = (unsigned char)(len - drop); + if ((int)(work[sym]) < end) { + this.op = (unsigned char)0; + this.val = work[sym]; + } + else if ((int)(work[sym]) > end) { + this.op = (unsigned char)(extra[work[sym]]); + this.val = base[work[sym]]; + } + else { + this.op = (unsigned char)(32 + 64); /* end of block */ + this.val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1U << (len - drop); + fill = 1U << curr; + do { + fill -= incr; + next[(huff >> drop) + fill] = this; + } while (fill != 0); + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + + /* go to next symbol, update count, len */ + sym++; + if (--(count[len]) == 0) { + if (len == max) break; + len = lens[work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) != low) { + /* if first time, transition to sub-tables */ + if (drop == 0) + drop = root; + + /* increment past last table */ + next += 1U << curr; + + /* determine length of next table */ + curr = len - drop; + left = (int)(1 << curr); + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) break; + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1U << curr; + if (type == LENS && used >= ENOUGH - MAXD) + return 1; + + /* point entry in root table to sub-table */ + low = huff & mask; + (*table)[low].op = (unsigned char)curr; + (*table)[low].bits = (unsigned char)root; + (*table)[low].val = (unsigned short)(next - *table); + } + } + + /* + Fill in rest of table for incomplete codes. This loop is similar to the + loop above in incrementing huff for table indices. It is assumed that + len is equal to curr + drop, so there is no loop needed to increment + through high index bits. When the current sub-table is filled, the loop + drops back to the root table to fill in any remaining entries there. + */ + this.op = (unsigned char)64; /* invalid code marker */ + this.bits = (unsigned char)(len - drop); + this.val = (unsigned short)0; + while (huff != 0) { + /* when done with sub-table, drop back to root table */ + if (drop != 0 && (huff & mask) != low) { + drop = 0; + len = root; + next = *table; + curr = root; + this.bits = (unsigned char)len; + } + + /* put invalid code marker in table */ + next[huff >> drop] = this; + + /* backwards increment the len-bit code huff */ + incr = 1U << (len - 1); + while (huff & incr) + incr >>= 1; + if (incr != 0) { + huff &= incr - 1; + huff += incr; + } + else + huff = 0; + } + + /* set return parameters */ + *table += used; + *bits = root; + return 0; +} diff --git a/klibc/klibc/zlib/inftrees.h b/klibc/klibc/zlib/inftrees.h new file mode 100644 index 0000000000..82d365a7e9 --- /dev/null +++ b/klibc/klibc/zlib/inftrees.h @@ -0,0 +1,55 @@ +/* inftrees.h -- header to use inftrees.c + * Copyright (C) 1995-2003 Mark Adler + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* Structure for decoding tables. Each entry provides either the + information needed to do the operation requested by the code that + indexed that table entry, or it provides a pointer to another + table that indexes more bits of the code. op indicates whether + the entry is a pointer to another table, a literal, a length or + distance, an end-of-block, or an invalid code. For a table + pointer, the low four bits of op is the number of index bits of + that table. For a length or distance, the low four bits of op + is the number of extra bits to get after the code. bits is + the number of bits in this code or part of the code to drop off + of the bit buffer. val is the actual byte to output in the case + of a literal, the base length or distance, or the offset from + the current table to the next table. Each entry is four bytes. */ +typedef struct { + unsigned char op; /* operation, extra bits, table bits */ + unsigned char bits; /* bits in this part of the code */ + unsigned short val; /* offset in table or code value */ +} code; + +/* op values as set by inflate_table(): + 00000000 - literal + 0000tttt - table link, tttt != 0 is the number of table index bits + 0001eeee - length or distance, eeee is the number of extra bits + 01100000 - end of block + 01000000 - invalid code + */ + +/* Maximum size of dynamic tree. The maximum found in a long but non- + exhaustive search was 1004 code structures (850 for length/literals + and 154 for distances, the latter actually the result of an + exhaustive search). The true maximum is not known, but the value + below is more than safe. */ +#define ENOUGH 1440 +#define MAXD 154 + +/* Type of code to build for inftable() */ +typedef enum { + CODES, + LENS, + DISTS +} codetype; + +extern int inflate_table OF((codetype type, unsigned short FAR *lens, + unsigned codes, code FAR * FAR *table, + unsigned FAR *bits, unsigned short FAR *work)); diff --git a/klibc/klibc/zlib/trees.c b/klibc/klibc/zlib/trees.c new file mode 100644 index 0000000000..f7748c4dcc --- /dev/null +++ b/klibc/klibc/zlib/trees.c @@ -0,0 +1,1215 @@ +/* trees.c -- output deflated data using Huffman coding + * Copyright (C) 1995-2003 Jean-loup Gailly + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* + * ALGORITHM + * + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. + * + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as described + * in the deflate specification. + * + * REFERENCES + * + * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". + * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. + */ + +/* @(#) $Id: trees.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +/* #define GEN_TREES_H */ + +#include "deflate.h" + +#ifdef DEBUG +# include +#endif + +/* =========================================================================== + * Constants + */ + +#define MAX_BL_BITS 7 +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +#define END_BLOCK 256 +/* end of block literal code */ + +#define REP_3_6 16 +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +#define REPZ_3_10 17 +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +#define REPZ_11_138 18 +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ + = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; + +local const int extra_dbits[D_CODES] /* extra bits for each distance code */ + = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; + +local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ + = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; + +local const uch bl_order[BL_CODES] + = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +#define Buf_size (8 * 2*sizeof(char)) +/* Number of bits used within bi_buf. (bi_buf might be implemented on + * more than 16 bits on some systems.) + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ + +#if defined(GEN_TREES_H) || !defined(STDC) +/* non ANSI compilers may not accept trees.h */ + +local ct_data static_ltree[L_CODES+2]; +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +local ct_data static_dtree[D_CODES]; +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +uch _dist_code[DIST_CODE_LEN]; +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +uch _length_code[MAX_MATCH-MIN_MATCH+1]; +/* length code for each normalized match length (0 == MIN_MATCH) */ + +local int base_length[LENGTH_CODES]; +/* First normalized length for each code (0 = MIN_MATCH) */ + +local int base_dist[D_CODES]; +/* First normalized distance for each code (0 = distance of 1) */ + +#else +# include "trees.h" +#endif /* GEN_TREES_H */ + +struct static_tree_desc_s { + const ct_data *static_tree; /* static tree or NULL */ + const intf *extra_bits; /* extra bits for each code or NULL */ + int extra_base; /* base index for extra_bits */ + int elems; /* max number of elements in the tree */ + int max_length; /* max bit length for the codes */ +}; + +local static_tree_desc static_l_desc = +{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; + +local static_tree_desc static_d_desc = +{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; + +local static_tree_desc static_bl_desc = +{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; + +/* =========================================================================== + * Local (static) routines in this file. + */ + +local void tr_static_init OF((void)); +local void init_block OF((deflate_state *s)); +local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); +local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); +local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); +local void build_tree OF((deflate_state *s, tree_desc *desc)); +local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); +local int build_bl_tree OF((deflate_state *s)); +local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, + int blcodes)); +local void compress_block OF((deflate_state *s, ct_data *ltree, + ct_data *dtree)); +local void set_data_type OF((deflate_state *s)); +local unsigned bi_reverse OF((unsigned value, int length)); +local void bi_windup OF((deflate_state *s)); +local void bi_flush OF((deflate_state *s)); +local void copy_block OF((deflate_state *s, charf *buf, unsigned len, + int header)); + +#ifdef GEN_TREES_H +local void gen_trees_header OF((void)); +#endif + +#ifndef DEBUG +# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) + /* Send a code of the given tree. c and tree must not have side effects */ + +#else /* DEBUG */ +# define send_code(s, c, tree) \ + { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ + send_bits(s, tree[c].Code, tree[c].Len); } +#endif + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +#define put_short(s, w) { \ + put_byte(s, (uch)((w) & 0xff)); \ + put_byte(s, (uch)((ush)(w) >> 8)); \ +} + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +#ifdef DEBUG +local void send_bits OF((deflate_state *s, int value, int length)); + +local void send_bits(s, value, length) + deflate_state *s; + int value; /* value to send */ + int length; /* number of bits */ +{ + Tracevv((stderr," l %2d v %4x ", length, value)); + Assert(length > 0 && length <= 15, "invalid length"); + s->bits_sent += (ulg)length; + + /* If not enough room in bi_buf, use (valid) bits from bi_buf and + * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) + * unused bits in value. + */ + if (s->bi_valid > (int)Buf_size - length) { + s->bi_buf |= (value << s->bi_valid); + put_short(s, s->bi_buf); + s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); + s->bi_valid += length - Buf_size; + } else { + s->bi_buf |= value << s->bi_valid; + s->bi_valid += length; + } +} +#else /* !DEBUG */ + +#define send_bits(s, value, length) \ +{ int len = length;\ + if (s->bi_valid > (int)Buf_size - len) {\ + int val = value;\ + s->bi_buf |= (val << s->bi_valid);\ + put_short(s, s->bi_buf);\ + s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ + s->bi_valid += len - Buf_size;\ + } else {\ + s->bi_buf |= (value) << s->bi_valid;\ + s->bi_valid += len;\ + }\ +} +#endif /* DEBUG */ + + +/* the arguments must not have side effects */ + +/* =========================================================================== + * Initialize the various 'constant' tables. + */ +local void tr_static_init() +{ +#if defined(GEN_TREES_H) || !defined(STDC) + static int static_init_done = 0; + int n; /* iterates over tree elements */ + int bits; /* bit counter */ + int length; /* length value */ + int code; /* code value */ + int dist; /* distance index */ + ush bl_count[MAX_BITS+1]; + /* number of codes at each bit length for an optimal tree */ + + if (static_init_done) return; + + /* For some embedded targets, global variables are not initialized: */ + static_l_desc.static_tree = static_ltree; + static_l_desc.extra_bits = extra_lbits; + static_d_desc.static_tree = static_dtree; + static_d_desc.extra_bits = extra_dbits; + static_bl_desc.extra_bits = extra_blbits; + + /* Initialize the mapping length (0..255) -> length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES-1; code++) { + base_length[code] = length; + for (n = 0; n < (1< dist code (0..29) */ + dist = 0; + for (code = 0 ; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ + for ( ; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { + _dist_code[256 + dist++] = (uch)code; + } + } + Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; + n = 0; + while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; + while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; + while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; + while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n].Len = 5; + static_dtree[n].Code = bi_reverse((unsigned)n, 5); + } + static_init_done = 1; + +# ifdef GEN_TREES_H + gen_trees_header(); +# endif +#endif /* defined(GEN_TREES_H) || !defined(STDC) */ +} + +/* =========================================================================== + * Genererate the file trees.h describing the static trees. + */ +#ifdef GEN_TREES_H +# ifndef DEBUG +# include +# endif + +# define SEPARATOR(i, last, width) \ + ((i) == (last)? "\n};\n\n" : \ + ((i) % (width) == (width)-1 ? ",\n" : ", ")) + +void gen_trees_header() +{ + FILE *header = fopen("trees.h", "w"); + int i; + + Assert (header != NULL, "Can't open trees.h"); + fprintf(header, + "/* header created automatically with -DGEN_TREES_H */\n\n"); + + fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); + for (i = 0; i < L_CODES+2; i++) { + fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, + static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); + } + + fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, + static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); + } + + fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); + for (i = 0; i < DIST_CODE_LEN; i++) { + fprintf(header, "%2u%s", _dist_code[i], + SEPARATOR(i, DIST_CODE_LEN-1, 20)); + } + + fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); + for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { + fprintf(header, "%2u%s", _length_code[i], + SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); + } + + fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); + for (i = 0; i < LENGTH_CODES; i++) { + fprintf(header, "%1u%s", base_length[i], + SEPARATOR(i, LENGTH_CODES-1, 20)); + } + + fprintf(header, "local const int base_dist[D_CODES] = {\n"); + for (i = 0; i < D_CODES; i++) { + fprintf(header, "%5u%s", base_dist[i], + SEPARATOR(i, D_CODES-1, 10)); + } + + fclose(header); +} +#endif /* GEN_TREES_H */ + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +void _tr_init(s) + deflate_state *s; +{ + tr_static_init(); + + s->l_desc.dyn_tree = s->dyn_ltree; + s->l_desc.stat_desc = &static_l_desc; + + s->d_desc.dyn_tree = s->dyn_dtree; + s->d_desc.stat_desc = &static_d_desc; + + s->bl_desc.dyn_tree = s->bl_tree; + s->bl_desc.stat_desc = &static_bl_desc; + + s->bi_buf = 0; + s->bi_valid = 0; + s->last_eob_len = 8; /* enough lookahead for inflate */ +#ifdef DEBUG + s->compressed_len = 0L; + s->bits_sent = 0L; +#endif + + /* Initialize the first block of the first file: */ + init_block(s); +} + +/* =========================================================================== + * Initialize a new block. + */ +local void init_block(s) + deflate_state *s; +{ + int n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; + for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; + for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; + + s->dyn_ltree[END_BLOCK].Freq = 1; + s->opt_len = s->static_len = 0L; + s->last_lit = s->matches = 0; +} + +#define SMALLEST 1 +/* Index within the heap array of least frequent node in the Huffman tree */ + + +/* =========================================================================== + * Remove the smallest element from the heap and recreate the heap with + * one less element. Updates heap and heap_len. + */ +#define pqremove(s, tree, top) \ +{\ + top = s->heap[SMALLEST]; \ + s->heap[SMALLEST] = s->heap[s->heap_len--]; \ + pqdownheap(s, tree, SMALLEST); \ +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +#define smaller(tree, n, m, depth) \ + (tree[n].Freq < tree[m].Freq || \ + (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +local void pqdownheap(s, tree, k) + deflate_state *s; + ct_data *tree; /* the tree to restore */ + int k; /* node to move down */ +{ + int v = s->heap[k]; + int j = k << 1; /* left son of k */ + while (j <= s->heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s->heap_len && + smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s->heap[j], s->depth)) break; + + /* Exchange v with the smallest son */ + s->heap[k] = s->heap[j]; k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s->heap[k] = v; +} + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +local void gen_bitlen(s, desc) + deflate_state *s; + tree_desc *desc; /* the tree descriptor */ +{ + ct_data *tree = desc->dyn_tree; + int max_code = desc->max_code; + const ct_data *stree = desc->stat_desc->static_tree; + const intf *extra = desc->stat_desc->extra_bits; + int base = desc->stat_desc->extra_base; + int max_length = desc->stat_desc->max_length; + int h; /* heap index */ + int n, m; /* iterate over the tree elements */ + int bits; /* bit length */ + int xbits; /* extra bits */ + ush f; /* frequency */ + int overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ + + for (h = s->heap_max+1; h < HEAP_SIZE; h++) { + n = s->heap[h]; + bits = tree[tree[n].Dad].Len + 1; + if (bits > max_length) bits = max_length, overflow++; + tree[n].Len = (ush)bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) continue; /* not a leaf node */ + + s->bl_count[bits]++; + xbits = 0; + if (n >= base) xbits = extra[n-base]; + f = tree[n].Freq; + s->opt_len += (ulg)f * (bits + xbits); + if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); + } + if (overflow == 0) return; + + Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length-1; + while (s->bl_count[bits] == 0) bits--; + s->bl_count[bits]--; /* move one leaf down the tree */ + s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ + s->bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits != 0; bits--) { + n = s->bl_count[bits]; + while (n != 0) { + m = s->heap[--h]; + if (m > max_code) continue; + if (tree[m].Len != (unsigned) bits) { + Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s->opt_len += ((long)bits - (long)tree[m].Len) + *(long)tree[m].Freq; + tree[m].Len = (ush)bits; + } + n--; + } + } +} + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +local void gen_codes (tree, max_code, bl_count) + ct_data *tree; /* the tree to decorate */ + int max_code; /* largest code with non zero frequency */ + ushf *bl_count; /* number of codes at each bit length */ +{ + ush next_code[MAX_BITS+1]; /* next code value for each bit length */ + ush code = 0; /* running code value */ + int bits; /* bit index */ + int n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits-1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; + const ct_data *stree = desc->stat_desc->static_tree; + int elems = desc->stat_desc->elems; + int n, m; /* iterate over heap elements */ + int max_code = -1; /* largest code with non zero frequency */ + int node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s->heap_len = 0, s->heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n].Freq != 0) { + s->heap[++(s->heap_len)] = max_code = n; + s->depth[n] = 0; + } else { + tree[n].Len = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s->heap_len < 2) { + node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); + tree[node].Freq = 1; + s->depth[node] = 0; + s->opt_len--; if (stree) s->static_len -= stree[node].Len; + /* node is 0 or 1 so it does not have extra bits */ + } + desc->max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + pqremove(s, tree, n); /* n = node of least frequency */ + m = s->heap[SMALLEST]; /* m = node of next least frequency */ + + s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ + s->heap[--(s->heap_max)] = m; + + /* Create a new node father of n and m */ + tree[node].Freq = tree[n].Freq + tree[m].Freq; + s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? + s->depth[n] : s->depth[m]) + 1); + tree[n].Dad = tree[m].Dad = (ush)node; +#ifdef DUMP_BL_TREE + if (tree == s->bl_tree) { + fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", + node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); + } +#endif + /* and insert the new node in the heap */ + s->heap[SMALLEST] = node++; + pqdownheap(s, tree, SMALLEST); + + } while (s->heap_len >= 2); + + s->heap[--(s->heap_max)] = s->heap[SMALLEST]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, (tree_desc *)desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes ((ct_data *)tree, max_code, s->bl_count); +} + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +local void scan_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + if (nextlen == 0) max_count = 138, min_count = 3; + tree[max_code+1].Len = (ush)0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + s->bl_tree[curlen].Freq += count; + } else if (curlen != 0) { + if (curlen != prevlen) s->bl_tree[curlen].Freq++; + s->bl_tree[REP_3_6].Freq++; + } else if (count <= 10) { + s->bl_tree[REPZ_3_10].Freq++; + } else { + s->bl_tree[REPZ_11_138].Freq++; + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +local void send_tree (s, tree, max_code) + deflate_state *s; + ct_data *tree; /* the tree to be scanned */ + int max_code; /* and its largest code of non zero frequency */ +{ + int n; /* iterates over all tree elements */ + int prevlen = -1; /* last emitted length */ + int curlen; /* length of current code */ + int nextlen = tree[0].Len; /* length of next code */ + int count = 0; /* repeat count of the current code */ + int max_count = 7; /* max repeat count */ + int min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen == 0) max_count = 138, min_count = 3; + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; nextlen = tree[n+1].Len; + if (++count < max_count && curlen == nextlen) { + continue; + } else if (count < min_count) { + do { send_code(s, curlen, s->bl_tree); } while (--count != 0); + + } else if (curlen != 0) { + if (curlen != prevlen) { + send_code(s, curlen, s->bl_tree); count--; + } + Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); + + } else { + send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); + } + count = 0; prevlen = curlen; + if (nextlen == 0) { + max_count = 138, min_count = 3; + } else if (curlen == nextlen) { + max_count = 6, min_count = 3; + } else { + max_count = 7, min_count = 4; + } + } +} + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +local int build_bl_tree(s) + deflate_state *s; +{ + int max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); + scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, (tree_desc *)(&(s->bl_desc))); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { + if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; + } + /* Update opt_len to include the bit length tree and counts */ + s->opt_len += 3*(max_blindex+1) + 5+5+4; + Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + s->opt_len, s->static_len)); + + return max_blindex; +} + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +local void send_all_trees(s, lcodes, dcodes, blcodes) + deflate_state *s; + int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + int rank; /* index in bl_order */ + + Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + "too many codes"); + Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes-1, 5); + send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); + } + Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ + Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ + Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + +/* =========================================================================== + * Send a stored block + */ +void _tr_stored_block(s, buf, stored_len, eof) + deflate_state *s; + charf *buf; /* input block */ + ulg stored_len; /* length of input block */ + int eof; /* true if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ +#ifdef DEBUG + s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; + s->compressed_len += (stored_len + 4) << 3; +#endif + copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ +} + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + * The current inflate code requires 9 bits of lookahead. If the + * last two codes for the previous block (real code plus EOB) were coded + * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode + * the last real code. In this case we send two empty static blocks instead + * of one. (There are no problems if the previous block is stored or fixed.) + * To simplify the code, we assume the worst case of last real code encoded + * on one bit only. + */ +void _tr_align(s) + deflate_state *s; +{ + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ +#endif + bi_flush(s); + /* Of the 10 bits for the empty block, we have already sent + * (10 - bi_valid) bits. The lookahead for the last real code (before + * the EOB of the previous block) was thus at least one plus the length + * of the EOB plus what we have just sent of the empty static block. + */ + if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { + send_bits(s, STATIC_TREES<<1, 3); + send_code(s, END_BLOCK, static_ltree); +#ifdef DEBUG + s->compressed_len += 10L; +#endif + bi_flush(s); + } + s->last_eob_len = 7; +} + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +void _tr_flush_block(s, buf, stored_len, eof) + deflate_state *s; + charf *buf; /* input block, or NULL if too old */ + ulg stored_len; /* length of input block */ + int eof; /* true if this is the last block for a file */ +{ + ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + int max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s->level > 0) { + + /* Check if the file is ascii or binary */ + if (s->data_type == Z_UNKNOWN) set_data_type(s); + + /* Construct the literal and distance trees */ + build_tree(s, (tree_desc *)(&(s->l_desc))); + Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + + build_tree(s, (tree_desc *)(&(s->d_desc))); + Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s->opt_len+3+7)>>3; + static_lenb = (s->static_len+3+7)>>3; + + Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + s->last_lit)); + + if (static_lenb <= opt_lenb) opt_lenb = static_lenb; + + } else { + Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + +#ifdef FORCE_STORED + if (buf != (char*)0) { /* force stored block */ +#else + if (stored_len+4 <= opt_lenb && buf != (char*)0) { + /* 4: two words for the lengths */ +#endif + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, eof); + +#ifdef FORCE_STATIC + } else if (static_lenb >= 0) { /* force static trees */ +#else + } else if (static_lenb == opt_lenb) { +#endif + send_bits(s, (STATIC_TREES<<1)+eof, 3); + compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->static_len; +#endif + } else { + send_bits(s, (DYN_TREES<<1)+eof, 3); + send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, + max_blindex+1); + compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); +#ifdef DEBUG + s->compressed_len += 3 + s->opt_len; +#endif + } + Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (eof) { + bi_windup(s); +#ifdef DEBUG + s->compressed_len += 7; /* align on byte boundary */ +#endif + } + Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + s->compressed_len-7*eof)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +int _tr_tally (s, dist, lc) + deflate_state *s; + unsigned dist; /* distance of matched string */ + unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + s->d_buf[s->last_lit] = (ush)dist; + s->l_buf[s->last_lit++] = (uch)lc; + if (dist == 0) { + /* lc is the unmatched char */ + s->dyn_ltree[lc].Freq++; + } else { + s->matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + Assert((ush)dist < (ush)MAX_DIST(s) && + (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; + s->dyn_dtree[d_code(dist)].Freq++; + } + +#ifdef TRUNCATE_BLOCK + /* Try to guess if it is profitable to stop the current block here */ + if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { + /* Compute an upper bound for the compressed length */ + ulg out_length = (ulg)s->last_lit*8L; + ulg in_length = (ulg)((long)s->strstart - s->block_start); + int dcode; + for (dcode = 0; dcode < D_CODES; dcode++) { + out_length += (ulg)s->dyn_dtree[dcode].Freq * + (5L+extra_dbits[dcode]); + } + out_length >>= 3; + Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", + s->last_lit, in_length, out_length, + 100L - out_length*100L/in_length)); + if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; + } +#endif + return (s->last_lit == s->lit_bufsize-1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +local void compress_block(s, ltree, dtree) + deflate_state *s; + ct_data *ltree; /* literal tree */ + ct_data *dtree; /* distance tree */ +{ + unsigned dist; /* distance of matched string */ + int lc; /* match length or unmatched char (if dist == 0) */ + unsigned lx = 0; /* running index in l_buf */ + unsigned code; /* the code to send */ + int extra; /* number of extra bits to send */ + + if (s->last_lit != 0) do { + dist = s->d_buf[lx]; + lc = s->l_buf[lx++]; + if (dist == 0) { + send_code(s, lc, ltree); /* send a literal byte */ + Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code+LITERALS+1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra != 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra != 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + "pendingBuf overflow"); + + } while (lx < s->last_lit); + + send_code(s, END_BLOCK, ltree); + s->last_eob_len = ltree[END_BLOCK].Len; +} + +/* =========================================================================== + * Set the data type to ASCII or BINARY, using a crude approximation: + * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise. + * IN assertion: the fields freq of dyn_ltree are set and the total of all + * frequencies does not exceed 64K (to fit in an int on 16 bit machines). + */ +local void set_data_type(s) + deflate_state *s; +{ + int n = 0; + unsigned ascii_freq = 0; + unsigned bin_freq = 0; + while (n < 7) bin_freq += s->dyn_ltree[n++].Freq; + while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq; + while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq; + s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII); +} + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +local unsigned bi_reverse(code, len) + unsigned code; /* the value to invert */ + int len; /* its bit length */ +{ + register unsigned res = 0; + do { + res |= code & 1; + code >>= 1, res <<= 1; + } while (--len > 0); + return res >> 1; +} + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +local void bi_flush(s) + deflate_state *s; +{ + if (s->bi_valid == 16) { + put_short(s, s->bi_buf); + s->bi_buf = 0; + s->bi_valid = 0; + } else if (s->bi_valid >= 8) { + put_byte(s, (Byte)s->bi_buf); + s->bi_buf >>= 8; + s->bi_valid -= 8; + } +} + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +local void bi_windup(s) + deflate_state *s; +{ + if (s->bi_valid > 8) { + put_short(s, s->bi_buf); + } else if (s->bi_valid > 0) { + put_byte(s, (Byte)s->bi_buf); + } + s->bi_buf = 0; + s->bi_valid = 0; +#ifdef DEBUG + s->bits_sent = (s->bits_sent+7) & ~7; +#endif +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +local void copy_block(s, buf, len, header) + deflate_state *s; + charf *buf; /* the input data */ + unsigned len; /* its length */ + int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + s->last_eob_len = 8; /* enough lookahead for inflate */ + + if (header) { + put_short(s, (ush)len); + put_short(s, (ush)~len); +#ifdef DEBUG + s->bits_sent += 2*16; +#endif + } +#ifdef DEBUG + s->bits_sent += (ulg)len<<3; +#endif + while (len--) { + put_byte(s, *buf++); + } +} diff --git a/klibc/klibc/zlib/trees.h b/klibc/klibc/zlib/trees.h new file mode 100644 index 0000000000..72facf900f --- /dev/null +++ b/klibc/klibc/zlib/trees.h @@ -0,0 +1,128 @@ +/* header created automatically with -DGEN_TREES_H */ + +local const ct_data static_ltree[L_CODES+2] = { +{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, +{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, +{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, +{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, +{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, +{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, +{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, +{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, +{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, +{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, +{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, +{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, +{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, +{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, +{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, +{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, +{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, +{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, +{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, +{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, +{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, +{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, +{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, +{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, +{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, +{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, +{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, +{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, +{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, +{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, +{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, +{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, +{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, +{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, +{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, +{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, +{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, +{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, +{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, +{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, +{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, +{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, +{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, +{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, +{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, +{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, +{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, +{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, +{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, +{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, +{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, +{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, +{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, +{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, +{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, +{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, +{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, +{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} +}; + +local const ct_data static_dtree[D_CODES] = { +{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, +{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, +{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, +{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, +{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, +{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} +}; + +const uch _dist_code[DIST_CODE_LEN] = { + 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, + 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, +10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, +11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, +12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, +13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, +14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, +15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, +18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, +28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, +29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 +}; + +const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, +13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, +17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, +19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, +21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, +22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, +23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, +25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, +26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, +27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 +}; + +local const int base_length[LENGTH_CODES] = { +0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, +64, 80, 96, 112, 128, 160, 192, 224, 0 +}; + +local const int base_dist[D_CODES] = { + 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, + 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, + 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 +}; + diff --git a/klibc/klibc/zlib/uncompr.c b/klibc/klibc/zlib/uncompr.c new file mode 100644 index 0000000000..debee4385e --- /dev/null +++ b/klibc/klibc/zlib/uncompr.c @@ -0,0 +1,61 @@ +/* uncompr.c -- decompress a memory buffer + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: uncompr.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#define ZLIB_INTERNAL +#include "zlib.h" + +/* =========================================================================== + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted. +*/ +int ZEXPORT uncompress (dest, destLen, source, sourceLen) + Bytef *dest; + uLongf *destLen; + const Bytef *source; + uLong sourceLen; +{ + z_stream stream; + int err; + + stream.next_in = (Bytef*)source; + stream.avail_in = (uInt)sourceLen; + /* Check for source > 64K on 16-bit machine: */ + if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; + + stream.next_out = dest; + stream.avail_out = (uInt)*destLen; + if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; + + stream.zalloc = (alloc_func)0; + stream.zfree = (free_func)0; + + err = inflateInit(&stream); + if (err != Z_OK) return err; + + err = inflate(&stream, Z_FINISH); + if (err != Z_STREAM_END) { + inflateEnd(&stream); + if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) + return Z_DATA_ERROR; + return err; + } + *destLen = stream.total_out; + + err = inflateEnd(&stream); + return err; +} diff --git a/klibc/klibc/zlib/zconf.h b/klibc/klibc/zlib/zconf.h new file mode 100644 index 0000000000..9b74ce7bd4 --- /dev/null +++ b/klibc/klibc/zlib/zconf.h @@ -0,0 +1,323 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: zconf.h,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflatePrime z_deflatePrime +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table + +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +# define WIN32 +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +#define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/klibc/klibc/zlib/zconf.in.h b/klibc/klibc/zlib/zconf.in.h new file mode 100644 index 0000000000..d96c85955c --- /dev/null +++ b/klibc/klibc/zlib/zconf.in.h @@ -0,0 +1,323 @@ +/* zconf.h -- configuration of the zlib compression library + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: zconf.in.h,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#ifndef ZCONF_H +#define ZCONF_H + +/* + * If you *really* need a unique prefix for all types and library functions, + * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. + */ +#ifdef Z_PREFIX +# define deflateInit_ z_deflateInit_ +# define deflate z_deflate +# define deflateEnd z_deflateEnd +# define inflateInit_ z_inflateInit_ +# define inflate z_inflate +# define inflateEnd z_inflateEnd +# define deflateInit2_ z_deflateInit2_ +# define deflateSetDictionary z_deflateSetDictionary +# define deflateCopy z_deflateCopy +# define deflateReset z_deflateReset +# define deflatePrime z_deflatePrime +# define deflateParams z_deflateParams +# define deflateBound z_deflateBound +# define inflateInit2_ z_inflateInit2_ +# define inflateSetDictionary z_inflateSetDictionary +# define inflateSync z_inflateSync +# define inflateSyncPoint z_inflateSyncPoint +# define inflateCopy z_inflateCopy +# define inflateReset z_inflateReset +# define compress z_compress +# define compress2 z_compress2 +# define compressBound z_compressBound +# define uncompress z_uncompress +# define adler32 z_adler32 +# define crc32 z_crc32 +# define get_crc_table z_get_crc_table + +# define Byte z_Byte +# define uInt z_uInt +# define uLong z_uLong +# define Bytef z_Bytef +# define charf z_charf +# define intf z_intf +# define uIntf z_uIntf +# define uLongf z_uLongf +# define voidpf z_voidpf +# define voidp z_voidp +#endif + +#if defined(__MSDOS__) && !defined(MSDOS) +# define MSDOS +#endif +#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) +# define OS2 +#endif +#if defined(_WINDOWS) && !defined(WINDOWS) +# define WINDOWS +#endif +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) +# define WIN32 +#endif +#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) +# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) +# ifndef SYS16BIT +# define SYS16BIT +# endif +# endif +#endif + +/* + * Compile with -DMAXSEG_64K if the alloc function cannot allocate more + * than 64k bytes at a time (needed on systems with 16-bit int). + */ +#ifdef SYS16BIT +# define MAXSEG_64K +#endif +#ifdef MSDOS +# define UNALIGNED_OK +#endif + +#ifdef __STDC_VERSION__ +# ifndef STDC +# define STDC +# endif +# if __STDC_VERSION__ >= 199901L +# ifndef STDC99 +# define STDC99 +# endif +# endif +#endif +#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) +# define STDC +#endif +#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) +# define STDC +#endif +#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) +# define STDC +#endif +#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) +# define STDC +#endif + +#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ +# define STDC +#endif + +#ifndef STDC +# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ +# define const /* note: need a more gentle solution here */ +# endif +#endif + +/* Some Mac compilers merge all .h files incorrectly: */ +#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) +# define NO_DUMMY_DECL +#endif + +/* Maximum value for memLevel in deflateInit2 */ +#ifndef MAX_MEM_LEVEL +# ifdef MAXSEG_64K +# define MAX_MEM_LEVEL 8 +# else +# define MAX_MEM_LEVEL 9 +# endif +#endif + +/* Maximum value for windowBits in deflateInit2 and inflateInit2. + * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files + * created by gzip. (Files created by minigzip can still be extracted by + * gzip.) + */ +#ifndef MAX_WBITS +# define MAX_WBITS 15 /* 32K LZ77 window */ +#endif + +/* The memory requirements for deflate are (in bytes): + (1 << (windowBits+2)) + (1 << (memLevel+9)) + that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) + plus a few kilobytes for small objects. For example, if you want to reduce + the default memory requirements from 256K to 128K, compile with + make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" + Of course this will generally degrade compression (there's no free lunch). + + The memory requirements for inflate are (in bytes) 1 << windowBits + that is, 32K for windowBits=15 (default value) plus a few kilobytes + for small objects. +*/ + + /* Type declarations */ + +#ifndef OF /* function prototypes */ +# ifdef STDC +# define OF(args) args +# else +# define OF(args) () +# endif +#endif + +/* The following definitions for FAR are needed only for MSDOS mixed + * model programming (small or medium model with some far allocations). + * This was tested only with MSC; for other MSDOS compilers you may have + * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, + * just define FAR to be empty. + */ +#ifdef SYS16BIT +# if defined(M_I86SM) || defined(M_I86MM) + /* MSC small or medium model */ +# define SMALL_MEDIUM +# ifdef _MSC_VER +# define FAR _far +# else +# define FAR far +# endif +# endif +# if (defined(__SMALL__) || defined(__MEDIUM__)) + /* Turbo C small or medium model */ +# define SMALL_MEDIUM +# ifdef __BORLANDC__ +# define FAR _far +# else +# define FAR far +# endif +# endif +#endif + +#if defined(WINDOWS) || defined(WIN32) + /* If building or using zlib as a DLL, define ZLIB_DLL. + * This is not mandatory, but it offers a little performance increase. + */ +# ifdef ZLIB_DLL +# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) +# ifdef ZLIB_INTERNAL +# define ZEXTERN extern __declspec(dllexport) +# else +# define ZEXTERN extern __declspec(dllimport) +# endif +# endif +# endif /* ZLIB_DLL */ + /* If building or using zlib with the WINAPI/WINAPIV calling convention, + * define ZLIB_WINAPI. + * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. + */ +# ifdef ZLIB_WINAPI +# ifdef FAR +# undef FAR +# endif +# include + /* No need for _export, use ZLIB.DEF instead. */ + /* For complete Windows compatibility, use WINAPI, not __stdcall. */ +# define ZEXPORT WINAPI +# ifdef WIN32 +# define ZEXPORTVA WINAPIV +# else +# define ZEXPORTVA FAR CDECL +# endif +# endif +#endif + +#if defined (__BEOS__) +# ifdef ZLIB_DLL +# ifdef ZLIB_INTERNAL +# define ZEXPORT __declspec(dllexport) +# define ZEXPORTVA __declspec(dllexport) +# else +# define ZEXPORT __declspec(dllimport) +# define ZEXPORTVA __declspec(dllimport) +# endif +# endif +#endif + +#ifndef ZEXTERN +# define ZEXTERN extern +#endif +#ifndef ZEXPORT +# define ZEXPORT +#endif +#ifndef ZEXPORTVA +# define ZEXPORTVA +#endif + +#ifndef FAR +# define FAR +#endif + +#if !defined(__MACTYPES__) +typedef unsigned char Byte; /* 8 bits */ +#endif +typedef unsigned int uInt; /* 16 bits or more */ +typedef unsigned long uLong; /* 32 bits or more */ + +#ifdef SMALL_MEDIUM + /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ +# define Bytef Byte FAR +#else + typedef Byte FAR Bytef; +#endif +typedef char FAR charf; +typedef int FAR intf; +typedef uInt FAR uIntf; +typedef uLong FAR uLongf; + +#ifdef STDC + typedef void const *voidpc; + typedef void FAR *voidpf; + typedef void *voidp; +#else + typedef Byte const *voidpc; + typedef Byte FAR *voidpf; + typedef Byte *voidp; +#endif + +#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ +# include /* for off_t */ +# include /* for SEEK_* and off_t */ +# ifdef VMS +# include /* for off_t */ +# endif +# define z_off_t off_t +#endif +#ifndef SEEK_SET +# define SEEK_SET 0 /* Seek from beginning of file. */ +# define SEEK_CUR 1 /* Seek from current position. */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif +#ifndef z_off_t +# define z_off_t long +#endif + +#if defined(__OS400__) +#define NO_vsnprintf +#endif + +#if defined(__MVS__) +# define NO_vsnprintf +# ifdef FAR +# undef FAR +# endif +#endif + +/* MVS linker does not support external names larger than 8 bytes */ +#if defined(__MVS__) +# pragma map(deflateInit_,"DEIN") +# pragma map(deflateInit2_,"DEIN2") +# pragma map(deflateEnd,"DEEND") +# pragma map(deflateBound,"DEBND") +# pragma map(inflateInit_,"ININ") +# pragma map(inflateInit2_,"ININ2") +# pragma map(inflateEnd,"INEND") +# pragma map(inflateSync,"INSY") +# pragma map(inflateSetDictionary,"INSEDI") +# pragma map(compressBound,"CMBND") +# pragma map(inflate_table,"INTABL") +# pragma map(inflate_fast,"INFA") +# pragma map(inflate_copyright,"INCOPY") +#endif + +#endif /* ZCONF_H */ diff --git a/klibc/klibc/zlib/zlib.3 b/klibc/klibc/zlib/zlib.3 new file mode 100644 index 0000000000..890098449d --- /dev/null +++ b/klibc/klibc/zlib/zlib.3 @@ -0,0 +1,159 @@ +.TH ZLIB 3 "17 November 2003" +.SH NAME +zlib \- compression/decompression library +.SH SYNOPSIS +[see +.I zlib.h +for full description] +.SH DESCRIPTION +The +.I zlib +library is a general purpose data compression library. +The code is thread safe. +It provides in-memory compression and decompression functions, +including integrity checks of the uncompressed data. +This version of the library supports only one compression method (deflation) +but other algorithms will be added later +and will have the same stream interface. +.LP +Compression can be done in a single step if the buffers are large enough +(for example if an input file is mmap'ed), +or can be done by repeated calls of the compression function. +In the latter case, +the application must provide more input and/or consume the output +(providing more output space) before each call. +.LP +The library also supports reading and writing files in +.IR gzip (1) +(.gz) format +with an interface similar to that of stdio. +.LP +The library does not install any signal handler. +The decoder checks the consistency of the compressed data, +so the library should never crash even in case of corrupted input. +.LP +All functions of the compression library are documented in the file +.IR zlib.h . +The distribution source includes examples of use of the library +in the files +.I example.c +and +.IR minigzip.c . +.LP +Changes to this version are documented in the file +.I ChangeLog +that accompanies the source, +and are concerned primarily with bug fixes and portability enhancements. +.LP +A Java implementation of +.I zlib +is available in the Java Development Kit 1.1: +.IP +http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html +.LP +A Perl interface to +.IR zlib , +written by Paul Marquess (pmqs@cpan.org), +is available at CPAN (Comprehensive Perl Archive Network) sites, +including: +.IP +http://www.cpan.org/modules/by-module/Compress/ +.LP +A Python interface to +.IR zlib , +written by A.M. Kuchling (amk@magnet.com), +is available in Python 1.5 and later versions: +.IP +http://www.python.org/doc/lib/module-zlib.html +.LP +A +.I zlib +binding for +.IR tcl (1), +written by Andreas Kupries (a.kupries@westend.com), +is availlable at: +.IP +http://www.westend.com/~kupries/doc/trf/man/man.html +.LP +An experimental package to read and write files in .zip format, +written on top of +.I zlib +by Gilles Vollant (info@winimage.com), +is available at: +.IP +http://www.winimage.com/zLibDll/unzip.html +and also in the +.I contrib/minizip +directory of the main +.I zlib +web site. +.SH "SEE ALSO" +The +.I zlib +web site can be found at either of these locations: +.IP +http://www.zlib.org +.br +http://www.gzip.org/zlib/ +.LP +The data format used by the zlib library is described by RFC +(Request for Comments) 1950 to 1952 in the files: +.IP +http://www.ietf.org/rfc/rfc1950.txt (concerning zlib format) +.br +http://www.ietf.org/rfc/rfc1951.txt (concerning deflate format) +.br +http://www.ietf.org/rfc/rfc1952.txt (concerning gzip format) +.LP +These documents are also available in other formats from: +.IP +ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html +.LP +Mark Nelson (markn@ieee.org) wrote an article about +.I zlib +for the Jan. 1997 issue of Dr. Dobb's Journal; +a copy of the article is available at: +.IP +http://dogma.net/markn/articles/zlibtool/zlibtool.htm +.SH "REPORTING PROBLEMS" +Before reporting a problem, +please check the +.I zlib +web site to verify that you have the latest version of +.IR zlib ; +otherwise, +obtain the latest version and see if the problem still exists. +Please read the +.I zlib +FAQ at: +.IP +http://www.gzip.org/zlib/zlib_faq.html +.LP +before asking for help. +Send questions and/or comments to zlib@gzip.org, +or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). +.SH AUTHORS +Version 1.2.1 +Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org) +and Mark Adler (madler@alumni.caltech.edu). +.LP +This software is provided "as-is," +without any express or implied warranty. +In no event will the authors be held liable for any damages +arising from the use of this software. +See the distribution directory with respect to requirements +governing redistribution. +The deflate format used by +.I zlib +was defined by Phil Katz. +The deflate and +.I zlib +specifications were written by L. Peter Deutsch. +Thanks to all the people who reported problems and suggested various +improvements in +.IR zlib ; +who are too numerous to cite here. +.LP +UNIX manual page by R. P. C. Rodgers, +U.S. National Library of Medicine (rodgers@nlm.nih.gov). +.\" end of man page diff --git a/klibc/klibc/zlib/zlib.h b/klibc/klibc/zlib/zlib.h new file mode 100644 index 0000000000..92edf96ff3 --- /dev/null +++ b/klibc/klibc/zlib/zlib.h @@ -0,0 +1,1200 @@ +/* zlib.h -- interface of the 'zlib' general purpose compression library + version 1.2.1, November 17th, 2003 + + Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + Jean-loup Gailly Mark Adler + jloup@gzip.org madler@alumni.caltech.edu + + + The data format used by the zlib library is described by RFCs (Request for + Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt + (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). +*/ + +#ifndef ZLIB_H +#define ZLIB_H + +#include "zconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ZLIB_VERSION "1.2.1" +#define ZLIB_VERNUM 0x1210 + +/* + The 'zlib' compression library provides in-memory compression and + decompression functions, including integrity checks of the uncompressed + data. This version of the library supports only one compression method + (deflation) but other algorithms will be added later and will have the same + stream interface. + + Compression can be done in a single step if the buffers are large + enough (for example if an input file is mmap'ed), or can be done by + repeated calls of the compression function. In the latter case, the + application must provide more input and/or consume the output + (providing more output space) before each call. + + The compressed data format used by the in-memory functions is the zlib + format, which is a zlib wrapper documented in RFC 1950, wrapped around a + deflate stream, which is itself documented in RFC 1951. + + The library also supports reading and writing files in gzip (.gz) format + with an interface similar to that of stdio using the functions that start + with "gz". The gzip format is different from the zlib format. gzip is a + gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. + + The zlib format was designed to be compact and fast for use in memory + and on communications channels. The gzip format was designed for single- + file compression on file systems, has a larger header than zlib to maintain + directory information, and uses a different, slower check method than zlib. + + This library does not provide any functions to write gzip files in memory. + However such functions could be easily written using zlib's deflate function, + the documentation in the gzip RFC, and the examples in gzio.c. + + The library does not install any signal handler. The decoder checks + the consistency of the compressed data, so the library should never + crash even in case of corrupted input. +*/ + +typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); +typedef void (*free_func) OF((voidpf opaque, voidpf address)); + +struct internal_state; + +typedef struct z_stream_s { + Bytef *next_in; /* next input byte */ + uInt avail_in; /* number of bytes available at next_in */ + uLong total_in; /* total nb of input bytes read so far */ + + Bytef *next_out; /* next output byte should be put there */ + uInt avail_out; /* remaining free space at next_out */ + uLong total_out; /* total nb of bytes output so far */ + + char *msg; /* last error message, NULL if no error */ + struct internal_state FAR *state; /* not visible by applications */ + + alloc_func zalloc; /* used to allocate the internal state */ + free_func zfree; /* used to free the internal state */ + voidpf opaque; /* private data object passed to zalloc and zfree */ + + int data_type; /* best guess about the data type: ascii or binary */ + uLong adler; /* adler32 value of the uncompressed data */ + uLong reserved; /* reserved for future use */ +} z_stream; + +typedef z_stream FAR *z_streamp; + +/* + The application must update next_in and avail_in when avail_in has + dropped to zero. It must update next_out and avail_out when avail_out + has dropped to zero. The application must initialize zalloc, zfree and + opaque before calling the init function. All other fields are set by the + compression library and must not be updated by the application. + + The opaque value provided by the application will be passed as the first + parameter for calls of zalloc and zfree. This can be useful for custom + memory management. The compression library attaches no meaning to the + opaque value. + + zalloc must return Z_NULL if there is not enough memory for the object. + If zlib is used in a multi-threaded application, zalloc and zfree must be + thread safe. + + On 16-bit systems, the functions zalloc and zfree must be able to allocate + exactly 65536 bytes, but will not be required to allocate more than this + if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, + pointers returned by zalloc for objects of exactly 65536 bytes *must* + have their offset normalized to zero. The default allocation function + provided by this library ensures this (see zutil.c). To reduce memory + requirements and avoid any allocation of 64K objects, at the expense of + compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). + + The fields total_in and total_out can be used for statistics or + progress reports. After compression, total_in holds the total size of + the uncompressed data and may be saved for use in the decompressor + (particularly if the decompressor wants to decompress everything in + a single step). +*/ + + /* constants */ + +#define Z_NO_FLUSH 0 +#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ +#define Z_SYNC_FLUSH 2 +#define Z_FULL_FLUSH 3 +#define Z_FINISH 4 +#define Z_BLOCK 5 +/* Allowed flush values; see deflate() and inflate() below for details */ + +#define Z_OK 0 +#define Z_STREAM_END 1 +#define Z_NEED_DICT 2 +#define Z_ERRNO (-1) +#define Z_STREAM_ERROR (-2) +#define Z_DATA_ERROR (-3) +#define Z_MEM_ERROR (-4) +#define Z_BUF_ERROR (-5) +#define Z_VERSION_ERROR (-6) +/* Return codes for the compression/decompression functions. Negative + * values are errors, positive values are used for special but normal events. + */ + +#define Z_NO_COMPRESSION 0 +#define Z_BEST_SPEED 1 +#define Z_BEST_COMPRESSION 9 +#define Z_DEFAULT_COMPRESSION (-1) +/* compression levels */ + +#define Z_FILTERED 1 +#define Z_HUFFMAN_ONLY 2 +#define Z_RLE 3 +#define Z_DEFAULT_STRATEGY 0 +/* compression strategy; see deflateInit2() below for details */ + +#define Z_BINARY 0 +#define Z_ASCII 1 +#define Z_UNKNOWN 2 +/* Possible values of the data_type field (though see inflate()) */ + +#define Z_DEFLATED 8 +/* The deflate compression method (the only one supported in this version) */ + +#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ + +#define zlib_version zlibVersion() +/* for compatibility with versions < 1.0.2 */ + + /* basic functions */ + +ZEXTERN const char * ZEXPORT zlibVersion OF((void)); +/* The application can compare zlibVersion and ZLIB_VERSION for consistency. + If the first character differs, the library code actually used is + not compatible with the zlib.h header file used by the application. + This check is automatically made by deflateInit and inflateInit. + */ + +/* +ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); + + Initializes the internal stream state for compression. The fields + zalloc, zfree and opaque must be initialized before by the caller. + If zalloc and zfree are set to Z_NULL, deflateInit updates them to + use default allocation functions. + + The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: + 1 gives best speed, 9 gives best compression, 0 gives no compression at + all (the input data is simply copied a block at a time). + Z_DEFAULT_COMPRESSION requests a default compromise between speed and + compression (currently equivalent to level 6). + + deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if level is not a valid compression level, + Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible + with the version assumed by the caller (ZLIB_VERSION). + msg is set to null if there is no error message. deflateInit does not + perform any compression: this will be done by deflate(). +*/ + + +ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); +/* + deflate compresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce some + output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. deflate performs one or both of the + following actions: + + - Compress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in and avail_in are updated and + processing will resume at this point for the next call of deflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. This action is forced if the parameter flush is non zero. + Forcing flush frequently degrades the compression ratio, so this parameter + should be set only when necessary (in interactive applications). + Some output may be provided even if flush is not set. + + Before the call of deflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating avail_in or avail_out accordingly; avail_out + should never be zero before the call. The application can consume the + compressed output when it wants, for example when the output buffer is full + (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK + and with zero avail_out, it must be called again after making room in the + output buffer because there might be more output pending. + + If the parameter flush is set to Z_SYNC_FLUSH, all pending output is + flushed to the output buffer and the output is aligned on a byte boundary, so + that the decompressor can get all input data available so far. (In particular + avail_in is zero after the call if enough output space has been provided + before the call.) Flushing may degrade compression for some compression + algorithms and so it should be used only when necessary. + + If flush is set to Z_FULL_FLUSH, all output is flushed as with + Z_SYNC_FLUSH, and the compression state is reset so that decompression can + restart from this point if previous compressed data has been damaged or if + random access is desired. Using Z_FULL_FLUSH too often can seriously degrade + the compression. + + If deflate returns with avail_out == 0, this function must be called again + with the same value of the flush parameter and more output space (updated + avail_out), until the flush is complete (deflate returns with non-zero + avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that + avail_out is greater than six to avoid repeated flush markers due to + avail_out == 0 on return. + + If the parameter flush is set to Z_FINISH, pending input is processed, + pending output is flushed and deflate returns with Z_STREAM_END if there + was enough output space; if deflate returns with Z_OK, this function must be + called again with Z_FINISH and more output space (updated avail_out) but no + more input data, until it returns with Z_STREAM_END or an error. After + deflate has returned Z_STREAM_END, the only possible operations on the + stream are deflateReset or deflateEnd. + + Z_FINISH can be used immediately after deflateInit if all the compression + is to be done in a single step. In this case, avail_out must be at least + the value returned by deflateBound (see below). If deflate does not return + Z_STREAM_END, then it must be called again as described above. + + deflate() sets strm->adler to the adler32 checksum of all input read + so far (that is, total_in bytes). + + deflate() may update data_type if it can make a good guess about + the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered + binary. This field is only for information purposes and does not affect + the compression algorithm in any manner. + + deflate() returns Z_OK if some progress has been made (more input + processed or more output produced), Z_STREAM_END if all input has been + consumed and all output has been produced (only when flush is set to + Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example + if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible + (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not + fatal, and deflate() can be called again with more input and more output + space to continue compressing. +*/ + + +ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the + stream state was inconsistent, Z_DATA_ERROR if the stream was freed + prematurely (some input or output was discarded). In the error case, + msg may be set but then points to a static string (which must not be + deallocated). +*/ + + +/* +ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); + + Initializes the internal stream state for decompression. The fields + next_in, avail_in, zalloc, zfree and opaque must be initialized before by + the caller. If next_in is not Z_NULL and avail_in is large enough (the exact + value depends on the compression method), inflateInit determines the + compression method from the zlib header and allocates all data structures + accordingly; otherwise the allocation will be deferred to the first call of + inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to + use default allocation functions. + + inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_VERSION_ERROR if the zlib library version is incompatible with the + version assumed by the caller. msg is set to null if there is no error + message. inflateInit does not perform any decompression apart from reading + the zlib header if present: this will be done by inflate(). (So next_in and + avail_in may be modified, but next_out and avail_out are unchanged.) +*/ + + +ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); +/* + inflate decompresses as much data as possible, and stops when the input + buffer becomes empty or the output buffer becomes full. It may introduce + some output latency (reading input without producing any output) except when + forced to flush. + + The detailed semantics are as follows. inflate performs one or both of the + following actions: + + - Decompress more input starting at next_in and update next_in and avail_in + accordingly. If not all input can be processed (because there is not + enough room in the output buffer), next_in is updated and processing + will resume at this point for the next call of inflate(). + + - Provide more output starting at next_out and update next_out and avail_out + accordingly. inflate() provides as much output as possible, until there + is no more input data or no more space in the output buffer (see below + about the flush parameter). + + Before the call of inflate(), the application should ensure that at least + one of the actions is possible, by providing more input and/or consuming + more output, and updating the next_* and avail_* values accordingly. + The application can consume the uncompressed output when it wants, for + example when the output buffer is full (avail_out == 0), or after each + call of inflate(). If inflate returns Z_OK and with zero avail_out, it + must be called again after making room in the output buffer because there + might be more output pending. + + The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, + Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much + output as possible to the output buffer. Z_BLOCK requests that inflate() stop + if and when it get to the next deflate block boundary. When decoding the zlib + or gzip format, this will cause inflate() to return immediately after the + header and before the first block. When doing a raw inflate, inflate() will + go ahead and process the first block, and will return when it gets to the end + of that block, or when it runs out of data. + + The Z_BLOCK option assists in appending to or combining deflate streams. + Also to assist in this, on return inflate() will set strm->data_type to the + number of unused bits in the last byte taken from strm->next_in, plus 64 + if inflate() is currently decoding the last block in the deflate stream, + plus 128 if inflate() returned immediately after decoding an end-of-block + code or decoding the complete header up to just before the first byte of the + deflate stream. The end-of-block will not be indicated until all of the + uncompressed data from that block has been written to strm->next_out. The + number of unused bits may in general be greater than seven, except when + bit 7 of data_type is set, in which case the number of unused bits will be + less than eight. + + inflate() should normally be called until it returns Z_STREAM_END or an + error. However if all decompression is to be performed in a single step + (a single call of inflate), the parameter flush should be set to + Z_FINISH. In this case all pending input is processed and all pending + output is flushed; avail_out must be large enough to hold all the + uncompressed data. (The size of the uncompressed data may have been saved + by the compressor for this purpose.) The next operation on this stream must + be inflateEnd to deallocate the decompression state. The use of Z_FINISH + is never required, but can be used to inform inflate that a faster approach + may be used for the single inflate() call. + + In this implementation, inflate() always flushes as much output as + possible to the output buffer, and always uses the faster approach on the + first call. So the only effect of the flush parameter in this implementation + is on the return value of inflate(), as noted below, or when it returns early + because Z_BLOCK is used. + + If a preset dictionary is needed after this call (see inflateSetDictionary + below), inflate sets strm-adler to the adler32 checksum of the dictionary + chosen by the compressor and returns Z_NEED_DICT; otherwise it sets + strm->adler to the adler32 checksum of all output produced so far (that is, + total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described + below. At the end of the stream, inflate() checks that its computed adler32 + checksum is equal to that saved by the compressor and returns Z_STREAM_END + only if the checksum is correct. + + inflate() will decompress and check either zlib-wrapped or gzip-wrapped + deflate data. The header type is detected automatically. Any information + contained in the gzip header is not retained, so applications that need that + information should instead use raw inflate, see inflateInit2() below, or + inflateBack() and perform their own processing of the gzip header and + trailer. + + inflate() returns Z_OK if some progress has been made (more input processed + or more output produced), Z_STREAM_END if the end of the compressed data has + been reached and all uncompressed output has been produced, Z_NEED_DICT if a + preset dictionary is needed at this point, Z_DATA_ERROR if the input data was + corrupted (input stream not conforming to the zlib format or incorrect check + value), Z_STREAM_ERROR if the stream structure was inconsistent (for example + if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, + Z_BUF_ERROR if no progress is possible or if there was not enough room in the + output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and + inflate() can be called again with more input and more output space to + continue decompressing. If Z_DATA_ERROR is returned, the application may then + call inflateSync() to look for a good compression block if a partial recovery + of the data is desired. +*/ + + +ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); +/* + All dynamically allocated data structures for this stream are freed. + This function discards any unprocessed input and does not flush any + pending output. + + inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state + was inconsistent. In the error case, msg may be set but then points to a + static string (which must not be deallocated). +*/ + + /* Advanced functions */ + +/* + The following functions are needed only in some special applications. +*/ + +/* +ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, + int level, + int method, + int windowBits, + int memLevel, + int strategy)); + + This is another version of deflateInit with more compression options. The + fields next_in, zalloc, zfree and opaque must be initialized before by + the caller. + + The method parameter is the compression method. It must be Z_DEFLATED in + this version of the library. + + The windowBits parameter is the base two logarithm of the window size + (the size of the history buffer). It should be in the range 8..15 for this + version of the library. Larger values of this parameter result in better + compression at the expense of memory usage. The default value is 15 if + deflateInit is used instead. + + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits + determines the window size. deflate() will then generate raw deflate data + with no zlib header or trailer, and will not compute an adler32 check value. + + windowBits can also be greater than 15 for optional gzip encoding. Add + 16 to windowBits to write a simple gzip header and trailer around the + compressed data instead of a zlib wrapper. The gzip header will have no + file name, no extra data, no comment, no modification time (set to zero), + no header crc, and the operating system will be set to 255 (unknown). + + The memLevel parameter specifies how much memory should be allocated + for the internal compression state. memLevel=1 uses minimum memory but + is slow and reduces compression ratio; memLevel=9 uses maximum memory + for optimal speed. The default value is 8. See zconf.h for total memory + usage as a function of windowBits and memLevel. + + The strategy parameter is used to tune the compression algorithm. Use the + value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a + filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no + string match), or Z_RLE to limit match distances to one (run-length + encoding). Filtered data consists mostly of small values with a somewhat + random distribution. In this case, the compression algorithm is tuned to + compress them better. The effect of Z_FILTERED is to force more Huffman + coding and less string matching; it is somewhat intermediate between + Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as + Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy + parameter only affects the compression ratio but not the correctness of the + compressed output even if it is not set appropriately. + + deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid + method). msg is set to null if there is no error message. deflateInit2 does + not perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the compression dictionary from the given byte sequence + without producing any compressed output. This function must be called + immediately after deflateInit, deflateInit2 or deflateReset, before any + call of deflate. The compressor and decompressor must use exactly the same + dictionary (see inflateSetDictionary). + + The dictionary should consist of strings (byte sequences) that are likely + to be encountered later in the data to be compressed, with the most commonly + used strings preferably put towards the end of the dictionary. Using a + dictionary is most useful when the data to be compressed is short and can be + predicted with good accuracy; the data can then be compressed better than + with the default empty dictionary. + + Depending on the size of the compression data structures selected by + deflateInit or deflateInit2, a part of the dictionary may in effect be + discarded, for example if the dictionary is larger than the window size in + deflate or deflate2. Thus the strings most likely to be useful should be + put at the end of the dictionary, not at the front. + + Upon return of this function, strm->adler is set to the adler32 value + of the dictionary; the decompressor may later use this value to determine + which dictionary has been used by the compressor. (The adler32 value + applies to the whole dictionary even if only a subset of the dictionary is + actually used by the compressor.) If a raw deflate was requested, then the + adler32 value is not computed and strm->adler is not set. + + deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent (for example if deflate has already been called for this stream + or if the compression method is bsort). deflateSetDictionary does not + perform any compression: this will be done by deflate(). +*/ + +ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when several compression strategies will be + tried, for example when there are several ways of pre-processing the input + data with a filter. The streams that will be discarded should then be freed + by calling deflateEnd. Note that deflateCopy duplicates the internal + compression state which can be quite large, so this strategy is slow and + can consume lots of memory. + + deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); +/* + This function is equivalent to deflateEnd followed by deflateInit, + but does not free and reallocate all the internal compression state. + The stream will keep the same compression level and any other attributes + that may have been set by deflateInit2. + + deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, + int level, + int strategy)); +/* + Dynamically update the compression level and compression strategy. The + interpretation of level and strategy is as in deflateInit2. This can be + used to switch between compression and straight copy of the input data, or + to switch to a different kind of input data requiring a different + strategy. If the compression level is changed, the input available so far + is compressed with the old level (and may be flushed); the new level will + take effect only at the next call of deflate(). + + Before the call of deflateParams, the stream state must be set as for + a call of deflate(), since the currently available input may have to + be compressed and flushed. In particular, strm->avail_out must be non-zero. + + deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source + stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR + if strm->avail_out was zero. +*/ + +ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, + uLong sourceLen)); +/* + deflateBound() returns an upper bound on the compressed size after + deflation of sourceLen bytes. It must be called after deflateInit() + or deflateInit2(). This would be used to allocate an output buffer + for deflation in a single pass, and so would be called before deflate(). +*/ + +ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, + int bits, + int value)); +/* + deflatePrime() inserts bits in the deflate output stream. The intent + is that this function is used to start off the deflate output with the + bits leftover from a previous deflate stream when appending to it. As such, + this function can only be used for raw deflate, and must be used before the + first deflate() call after a deflateInit2() or deflateReset(). bits must be + less than or equal to 16, and that many of the least significant bits of + value will be inserted in the output. + + deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent. +*/ + +/* +ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, + int windowBits)); + + This is another version of inflateInit with an extra parameter. The + fields next_in, avail_in, zalloc, zfree and opaque must be initialized + before by the caller. + + The windowBits parameter is the base two logarithm of the maximum window + size (the size of the history buffer). It should be in the range 8..15 for + this version of the library. The default value is 15 if inflateInit is used + instead. windowBits must be greater than or equal to the windowBits value + provided to deflateInit2() while compressing, or it must be equal to 15 if + deflateInit2() was not used. If a compressed stream with a larger window + size is given as input, inflate() will return with the error code + Z_DATA_ERROR instead of trying to allocate a larger window. + + windowBits can also be -8..-15 for raw inflate. In this case, -windowBits + determines the window size. inflate() will then process raw deflate data, + not looking for a zlib or gzip header, not generating a check value, and not + looking for any check values for comparison at the end of the stream. This + is for use with other formats that use the deflate compressed data format + such as zip. Those formats provide their own check values. If a custom + format is developed using the raw deflate format for compressed data, it is + recommended that a check value such as an adler32 or a crc32 be applied to + the uncompressed data as is done in the zlib, gzip, and zip formats. For + most applications, the zlib format should be used as is. Note that comments + above on the use in deflateInit2() applies to the magnitude of windowBits. + + windowBits can also be greater than 15 for optional gzip decoding. Add + 32 to windowBits to enable zlib and gzip decoding with automatic header + detection, or add 16 to decode only the gzip format (the zlib format will + return a Z_DATA_ERROR). + + inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative + memLevel). msg is set to null if there is no error message. inflateInit2 + does not perform any decompression apart from reading the zlib header if + present: this will be done by inflate(). (So next_in and avail_in may be + modified, but next_out and avail_out are unchanged.) +*/ + +ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, + const Bytef *dictionary, + uInt dictLength)); +/* + Initializes the decompression dictionary from the given uncompressed byte + sequence. This function must be called immediately after a call of inflate + if this call returned Z_NEED_DICT. The dictionary chosen by the compressor + can be determined from the adler32 value returned by this call of + inflate. The compressor and decompressor must use exactly the same + dictionary (see deflateSetDictionary). + + inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a + parameter is invalid (such as NULL dictionary) or the stream state is + inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the + expected one (incorrect adler32 value). inflateSetDictionary does not + perform any decompression: this will be done by subsequent calls of + inflate(). +*/ + +ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); +/* + Skips invalid compressed data until a full flush point (see above the + description of deflate with Z_FULL_FLUSH) can be found, or until all + available input is skipped. No output is provided. + + inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR + if no more input was provided, Z_DATA_ERROR if no flush point has been found, + or Z_STREAM_ERROR if the stream structure was inconsistent. In the success + case, the application may save the current current value of total_in which + indicates where valid compressed data was found. In the error case, the + application may repeatedly call inflateSync, providing more input each time, + until success or end of the input data. +*/ + +ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, + z_streamp source)); +/* + Sets the destination stream as a complete copy of the source stream. + + This function can be useful when randomly accessing a large stream. The + first pass through the stream can periodically record the inflate state, + allowing restarting inflate at those points when randomly accessing the + stream. + + inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_STREAM_ERROR if the source stream state was inconsistent + (such as zalloc being NULL). msg is left unchanged in both source and + destination. +*/ + +ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); +/* + This function is equivalent to inflateEnd followed by inflateInit, + but does not free and reallocate all the internal decompression state. + The stream will keep attributes that may have been set by inflateInit2. + + inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source + stream state was inconsistent (such as zalloc or state being NULL). +*/ + +/* +ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits, + unsigned char FAR *window)); + + Initialize the internal stream state for decompression using inflateBack() + calls. The fields zalloc, zfree and opaque in strm must be initialized + before the call. If zalloc and zfree are Z_NULL, then the default library- + derived memory allocation routines are used. windowBits is the base two + logarithm of the window size, in the range 8..15. window is a caller + supplied buffer of that size. Except for special applications where it is + assured that deflate was used with small window sizes, windowBits must be 15 + and a 32K byte window must be supplied to be able to decompress general + deflate streams. + + See inflateBack() for the usage of these routines. + + inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of + the paramaters are invalid, Z_MEM_ERROR if the internal state could not + be allocated, or Z_VERSION_ERROR if the version of the library does not + match the version of the header file. +*/ + +typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); +typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); + +ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm, + in_func in, void FAR *in_desc, + out_func out, void FAR *out_desc)); +/* + inflateBack() does a raw inflate with a single call using a call-back + interface for input and output. This is more efficient than inflate() for + file i/o applications in that it avoids copying between the output and the + sliding window by simply making the window itself the output buffer. This + function trusts the application to not change the output buffer passed by + the output function, at least until inflateBack() returns. + + inflateBackInit() must be called first to allocate the internal state + and to initialize the state with the user-provided window buffer. + inflateBack() may then be used multiple times to inflate a complete, raw + deflate stream with each call. inflateBackEnd() is then called to free + the allocated state. + + A raw deflate stream is one with no zlib or gzip header or trailer. + This routine would normally be used in a utility that reads zip or gzip + files and writes out uncompressed files. The utility would decode the + header and process the trailer on its own, hence this routine expects + only the raw deflate stream to decompress. This is different from the + normal behavior of inflate(), which expects either a zlib or gzip header and + trailer around the deflate stream. + + inflateBack() uses two subroutines supplied by the caller that are then + called by inflateBack() for input and output. inflateBack() calls those + routines until it reads a complete deflate stream and writes out all of the + uncompressed data, or until it encounters an error. The function's + parameters and return types are defined above in the in_func and out_func + typedefs. inflateBack() will call in(in_desc, &buf) which should return the + number of bytes of provided input, and a pointer to that input in buf. If + there is no input available, in() must return zero--buf is ignored in that + case--and inflateBack() will return a buffer error. inflateBack() will call + out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() + should return zero on success, or non-zero on failure. If out() returns + non-zero, inflateBack() will return with an error. Neither in() nor out() + are permitted to change the contents of the window provided to + inflateBackInit(), which is also the buffer that out() uses to write from. + The length written by out() will be at most the window size. Any non-zero + amount of input may be provided by in(). + + For convenience, inflateBack() can be provided input on the first call by + setting strm->next_in and strm->avail_in. If that input is exhausted, then + in() will be called. Therefore strm->next_in must be initialized before + calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called + immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in + must also be initialized, and then if strm->avail_in is not zero, input will + initially be taken from strm->next_in[0 .. strm->avail_in - 1]. + + The in_desc and out_desc parameters of inflateBack() is passed as the + first parameter of in() and out() respectively when they are called. These + descriptors can be optionally used to pass any information that the caller- + supplied in() and out() functions need to do their job. + + On return, inflateBack() will set strm->next_in and strm->avail_in to + pass back any unused input that was provided by the last in() call. The + return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR + if in() or out() returned an error, Z_DATA_ERROR if there was a format + error in the deflate stream (in which case strm->msg is set to indicate the + nature of the error), or Z_STREAM_ERROR if the stream was not properly + initialized. In the case of Z_BUF_ERROR, an input or output error can be + distinguished using strm->next_in which will be Z_NULL only if in() returned + an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to + out() returning non-zero. (in() will always be called before out(), so + strm->next_in is assured to be defined if out() returns non-zero.) Note + that inflateBack() cannot return Z_OK. +*/ + +ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm)); +/* + All memory allocated by inflateBackInit() is freed. + + inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream + state was inconsistent. +*/ + +ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); +/* Return flags indicating compile-time options. + + Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: + 1.0: size of uInt + 3.2: size of uLong + 5.4: size of voidpf (pointer) + 7.6: size of z_off_t + + Compiler, assembler, and debug options: + 8: DEBUG + 9: ASMV or ASMINF -- use ASM code + 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention + 11: 0 (reserved) + + One-time table building (smaller code, but not thread-safe if true): + 12: BUILDFIXED -- build static block decoding tables when needed + 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed + 14,15: 0 (reserved) + + Library content (indicates missing functionality): + 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking + deflate code when not needed) + 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect + and decode gzip streams (to avoid linking crc code) + 18-19: 0 (reserved) + + Operation variations (changes in library functionality): + 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate + 21: FASTEST -- deflate algorithm with only one, lowest compression level + 22,23: 0 (reserved) + + The sprintf variant used by gzprintf (zero is best): + 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format + 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! + 26: 0 = returns value, 1 = void -- 1 means inferred string length returned + + Remainder: + 27-31: 0 (reserved) + */ + + + /* utility functions */ + +/* + The following utility functions are implemented on top of the + basic stream-oriented functions. To simplify the interface, some + default options are assumed (compression level and memory usage, + standard memory allocation functions). The source code of these + utility functions can easily be modified if you need special options. +*/ + +ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Compresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be at least the value returned + by compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + This function can be used to compress a whole file at once if the + input file is mmap'ed. + compress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer. +*/ + +ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen, + int level)); +/* + Compresses the source buffer into the destination buffer. The level + parameter has the same meaning as in deflateInit. sourceLen is the byte + length of the source buffer. Upon entry, destLen is the total size of the + destination buffer, which must be at least the value returned by + compressBound(sourceLen). Upon exit, destLen is the actual size of the + compressed buffer. + + compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough + memory, Z_BUF_ERROR if there was not enough room in the output buffer, + Z_STREAM_ERROR if the level parameter is invalid. +*/ + +ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); +/* + compressBound() returns an upper bound on the compressed size after + compress() or compress2() on sourceLen bytes. It would be used before + a compress() or compress2() call to allocate the destination buffer. +*/ + +ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, + const Bytef *source, uLong sourceLen)); +/* + Decompresses the source buffer into the destination buffer. sourceLen is + the byte length of the source buffer. Upon entry, destLen is the total + size of the destination buffer, which must be large enough to hold the + entire uncompressed data. (The size of the uncompressed data must have + been saved previously by the compressor and transmitted to the decompressor + by some mechanism outside the scope of this compression library.) + Upon exit, destLen is the actual size of the compressed buffer. + This function can be used to decompress a whole file at once if the + input file is mmap'ed. + + uncompress returns Z_OK if success, Z_MEM_ERROR if there was not + enough memory, Z_BUF_ERROR if there was not enough room in the output + buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. +*/ + + +typedef voidp gzFile; + +ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); +/* + Opens a gzip (.gz) file for reading or writing. The mode parameter + is as in fopen ("rb" or "wb") but can also include a compression level + ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for + Huffman only compression as in "wb1h", or 'R' for run-length encoding + as in "wb1R". (See the description of deflateInit2 for more information + about the strategy parameter.) + + gzopen can be used to read a file which is not in gzip format; in this + case gzread will directly read from the file without decompression. + + gzopen returns NULL if the file could not be opened or if there was + insufficient memory to allocate the (de)compression state; errno + can be checked to distinguish the two cases (if errno is zero, the + zlib error is Z_MEM_ERROR). */ + +ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); +/* + gzdopen() associates a gzFile with the file descriptor fd. File + descriptors are obtained from calls like open, dup, creat, pipe or + fileno (in the file has been previously opened with fopen). + The mode parameter is as in gzopen. + The next call of gzclose on the returned gzFile will also close the + file descriptor fd, just like fclose(fdopen(fd), mode) closes the file + descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). + gzdopen returns NULL if there was insufficient memory to allocate + the (de)compression state. +*/ + +ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); +/* + Dynamically update the compression level or strategy. See the description + of deflateInit2 for the meaning of these parameters. + gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not + opened for writing. +*/ + +ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); +/* + Reads the given number of uncompressed bytes from the compressed file. + If the input file was not in gzip format, gzread copies the given number + of bytes into the buffer. + gzread returns the number of uncompressed bytes actually read (0 for + end of file, -1 for error). */ + +ZEXTERN int ZEXPORT gzwrite OF((gzFile file, + voidpc buf, unsigned len)); +/* + Writes the given number of uncompressed bytes into the compressed file. + gzwrite returns the number of uncompressed bytes actually written + (0 in case of error). +*/ + +ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); +/* + Converts, formats, and writes the args to the compressed file under + control of the format string, as in fprintf. gzprintf returns the number of + uncompressed bytes actually written (0 in case of error). The number of + uncompressed bytes written is limited to 4095. The caller should assure that + this limit is not exceeded. If it is exceeded, then gzprintf() will return + return an error (0) with nothing written. In this case, there may also be a + buffer overflow with unpredictable consequences, which is possible only if + zlib was compiled with the insecure functions sprintf() or vsprintf() + because the secure snprintf() or vsnprintf() functions were not available. +*/ + +ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); +/* + Writes the given null-terminated string to the compressed file, excluding + the terminating null character. + gzputs returns the number of characters written, or -1 in case of error. +*/ + +ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); +/* + Reads bytes from the compressed file until len-1 characters are read, or + a newline character is read and transferred to buf, or an end-of-file + condition is encountered. The string is then terminated with a null + character. + gzgets returns buf, or Z_NULL in case of error. +*/ + +ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); +/* + Writes c, converted to an unsigned char, into the compressed file. + gzputc returns the value that was written, or -1 in case of error. +*/ + +ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); +/* + Reads one byte from the compressed file. gzgetc returns this byte + or -1 in case of end of file or error. +*/ + +ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); +/* + Push one character back onto the stream to be read again later. + Only one character of push-back is allowed. gzungetc() returns the + character pushed, or -1 on failure. gzungetc() will fail if a + character has been pushed but not read yet, or if c is -1. The pushed + character will be discarded if the stream is repositioned with gzseek() + or gzrewind(). +*/ + +ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); +/* + Flushes all pending output into the compressed file. The parameter + flush is as in the deflate() function. The return value is the zlib + error number (see function gzerror below). gzflush returns Z_OK if + the flush parameter is Z_FINISH and all output could be flushed. + gzflush should be called only when strictly necessary because it can + degrade compression. +*/ + +ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, + z_off_t offset, int whence)); +/* + Sets the starting position for the next gzread or gzwrite on the + given compressed file. The offset represents a number of bytes in the + uncompressed data stream. The whence parameter is defined as in lseek(2); + the value SEEK_END is not supported. + If the file is opened for reading, this function is emulated but can be + extremely slow. If the file is opened for writing, only forward seeks are + supported; gzseek then compresses a sequence of zeroes up to the new + starting position. + + gzseek returns the resulting offset location as measured in bytes from + the beginning of the uncompressed stream, or -1 in case of error, in + particular if the file is opened for writing and the new starting position + would be before the current position. +*/ + +ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); +/* + Rewinds the given file. This function is supported only for reading. + + gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) +*/ + +ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); +/* + Returns the starting position for the next gzread or gzwrite on the + given compressed file. This position represents a number of bytes in the + uncompressed data stream. + + gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) +*/ + +ZEXTERN int ZEXPORT gzeof OF((gzFile file)); +/* + Returns 1 when EOF has previously been detected reading the given + input stream, otherwise zero. +*/ + +ZEXTERN int ZEXPORT gzclose OF((gzFile file)); +/* + Flushes all pending output if necessary, closes the compressed file + and deallocates all the (de)compression state. The return value is the zlib + error number (see function gzerror below). +*/ + +ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); +/* + Returns the error message for the last error which occurred on the + given compressed file. errnum is set to zlib error number. If an + error occurred in the file system and not in the compression library, + errnum is set to Z_ERRNO and the application may consult errno + to get the exact error code. +*/ + +ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); +/* + Clears the error and end-of-file flags for file. This is analogous to the + clearerr() function in stdio. This is useful for continuing to read a gzip + file that is being written concurrently. +*/ + + /* checksum functions */ + +/* + These functions are not related to compression but are exported + anyway because they might be useful in applications using the + compression library. +*/ + +ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); + +/* + Update a running Adler-32 checksum with the bytes buf[0..len-1] and + return the updated checksum. If buf is NULL, this function returns + the required initial value for the checksum. + An Adler-32 checksum is almost as reliable as a CRC32 but can be computed + much faster. Usage example: + + uLong adler = adler32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + adler = adler32(adler, buffer, length); + } + if (adler != original_adler) error(); +*/ + +ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); +/* + Update a running crc with the bytes buf[0..len-1] and return the updated + crc. If buf is NULL, this function returns the required initial value + for the crc. Pre- and post-conditioning (one's complement) is performed + within this function so it shouldn't be done by the application. + Usage example: + + uLong crc = crc32(0L, Z_NULL, 0); + + while (read_buffer(buffer, length) != EOF) { + crc = crc32(crc, buffer, length); + } + if (crc != original_crc) error(); +*/ + + + /* various hacks, don't look :) */ + +/* deflateInit and inflateInit are macros to allow checking the zlib version + * and the compiler's view of z_stream: + */ +ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, + int windowBits, int memLevel, + int strategy, const char *version, + int stream_size)); +ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, + const char *version, int stream_size)); +ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits, + unsigned char FAR *window, + const char *version, + int stream_size)); +#define deflateInit(strm, level) \ + deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit(strm) \ + inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) +#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ + deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ + (strategy), ZLIB_VERSION, sizeof(z_stream)) +#define inflateInit2(strm, windowBits) \ + inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) +#define inflateBackInit(strm, windowBits, window) \ + inflateBackInit_((strm), (windowBits), (window), \ + ZLIB_VERSION, sizeof(z_stream)) + + +#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) + struct internal_state {int dummy;}; /* hack for buggy compilers */ +#endif + +ZEXTERN const char * ZEXPORT zError OF((int err)); +ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); +ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); + +#ifdef __cplusplus +} +#endif + +#endif /* ZLIB_H */ diff --git a/klibc/klibc/zlib/zutil.c b/klibc/klibc/zlib/zutil.c new file mode 100644 index 0000000000..253a1cc7e1 --- /dev/null +++ b/klibc/klibc/zlib/zutil.c @@ -0,0 +1,319 @@ +/* zutil.c -- target dependent utility functions for the compression library + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* @(#) $Id: zutil.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#include "zutil.h" + +#ifndef NO_DUMMY_DECL +struct internal_state {int dummy;}; /* for buggy compilers */ +#endif + +#ifndef STDC +extern void exit OF((int)); +#endif + +const char * const z_errmsg[10] = { +"need dictionary", /* Z_NEED_DICT 2 */ +"stream end", /* Z_STREAM_END 1 */ +"", /* Z_OK 0 */ +"file error", /* Z_ERRNO (-1) */ +"stream error", /* Z_STREAM_ERROR (-2) */ +"data error", /* Z_DATA_ERROR (-3) */ +"insufficient memory", /* Z_MEM_ERROR (-4) */ +"buffer error", /* Z_BUF_ERROR (-5) */ +"incompatible version",/* Z_VERSION_ERROR (-6) */ +""}; + + +const char * ZEXPORT zlibVersion() +{ + return ZLIB_VERSION; +} + +uLong ZEXPORT zlibCompileFlags() +{ + uLong flags; + + flags = 0; + switch (sizeof(uInt)) { + case 2: break; + case 4: flags += 1; break; + case 8: flags += 2; break; + default: flags += 3; + } + switch (sizeof(uLong)) { + case 2: break; + case 4: flags += 1 << 2; break; + case 8: flags += 2 << 2; break; + default: flags += 3 << 2; + } + switch (sizeof(voidpf)) { + case 2: break; + case 4: flags += 1 << 4; break; + case 8: flags += 2 << 4; break; + default: flags += 3 << 4; + } + switch (sizeof(z_off_t)) { + case 2: break; + case 4: flags += 1 << 6; break; + case 8: flags += 2 << 6; break; + default: flags += 3 << 6; + } +#ifdef DEBUG + flags += 1 << 8; +#endif +#if defined(ASMV) || defined(ASMINF) + flags += 1 << 9; +#endif +#ifdef ZLIB_WINAPI + flags += 1 << 10; +#endif +#ifdef BUILDFIXED + flags += 1 << 12; +#endif +#ifdef DYNAMIC_CRC_TABLE + flags += 1 << 13; +#endif +#ifdef NO_GZCOMPRESS + flags += 1 << 16; +#endif +#ifdef NO_GZIP + flags += 1 << 17; +#endif +#ifdef PKZIP_BUG_WORKAROUND + flags += 1 << 20; +#endif +#ifdef FASTEST + flags += 1 << 21; +#endif +#ifdef STDC +# ifdef NO_vsnprintf + flags += 1 << 25; +# ifdef HAS_vsprintf_void + flags += 1 << 26; +# endif +# else +# ifdef HAS_vsnprintf_void + flags += 1 << 26; +# endif +# endif +#else + flags += 1 << 24; +# ifdef NO_snprintf + flags += 1 << 25; +# ifdef HAS_sprintf_void + flags += 1 << 26; +# endif +# else +# ifdef HAS_snprintf_void + flags += 1 << 26; +# endif +# endif +#endif + return flags; +} + +#ifdef DEBUG + +# ifndef verbose +# define verbose 0 +# endif +int z_verbose = verbose; + +void z_error (m) + char *m; +{ + fprintf(stderr, "%s\n", m); + exit(1); +} +#endif + +/* exported to allow conversion of error code to string for compress() and + * uncompress() + */ +const char * ZEXPORT zError(err) + int err; +{ + return ERR_MSG(err); +} + +#if defined(_WIN32_WCE) + /* does not exist on WCE */ + int errno = 0; +#endif + +#ifndef HAVE_MEMCPY + +void zmemcpy(dest, source, len) + Bytef* dest; + const Bytef* source; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = *source++; /* ??? to be unrolled */ + } while (--len != 0); +} + +int zmemcmp(s1, s2, len) + const Bytef* s1; + const Bytef* s2; + uInt len; +{ + uInt j; + + for (j = 0; j < len; j++) { + if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; + } + return 0; +} + +void zmemzero(dest, len) + Bytef* dest; + uInt len; +{ + if (len == 0) return; + do { + *dest++ = 0; /* ??? to be unrolled */ + } while (--len != 0); +} +#endif + + +#ifdef SYS16BIT + +#ifdef __TURBOC__ +/* Turbo C in 16-bit mode */ + +# define MY_ZCALLOC + +/* Turbo C malloc() does not allow dynamic allocation of 64K bytes + * and farmalloc(64K) returns a pointer with an offset of 8, so we + * must fix the pointer. Warning: the pointer must be put back to its + * original form in order to free it, use zcfree(). + */ + +#define MAX_PTR 10 +/* 10*64K = 640K */ + +local int next_ptr = 0; + +typedef struct ptr_table_s { + voidpf org_ptr; + voidpf new_ptr; +} ptr_table; + +local ptr_table table[MAX_PTR]; +/* This table is used to remember the original form of pointers + * to large buffers (64K). Such pointers are normalized with a zero offset. + * Since MSDOS is not a preemptive multitasking OS, this table is not + * protected from concurrent access. This hack doesn't work anyway on + * a protected system like OS/2. Use Microsoft C instead. + */ + +voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + voidpf buf = opaque; /* just to make some compilers happy */ + ulg bsize = (ulg)items*size; + + /* If we allocate less than 65520 bytes, we assume that farmalloc + * will return a usable pointer which doesn't have to be normalized. + */ + if (bsize < 65520L) { + buf = farmalloc(bsize); + if (*(ush*)&buf != 0) return buf; + } else { + buf = farmalloc(bsize + 16L); + } + if (buf == NULL || next_ptr >= MAX_PTR) return NULL; + table[next_ptr].org_ptr = buf; + + /* Normalize the pointer to seg:0 */ + *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; + *(ush*)&buf = 0; + table[next_ptr++].new_ptr = buf; + return buf; +} + +void zcfree (voidpf opaque, voidpf ptr) +{ + int n; + if (*(ush*)&ptr != 0) { /* object < 64K */ + farfree(ptr); + return; + } + /* Find the original pointer */ + for (n = 0; n < next_ptr; n++) { + if (ptr != table[n].new_ptr) continue; + + farfree(table[n].org_ptr); + while (++n < next_ptr) { + table[n-1] = table[n]; + } + next_ptr--; + return; + } + ptr = opaque; /* just to make some compilers happy */ + Assert(0, "zcfree: ptr not found"); +} + +#endif /* __TURBOC__ */ + + +#ifdef M_I86 +/* Microsoft C in 16-bit mode */ + +# define MY_ZCALLOC + +#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) +# define _halloc halloc +# define _hfree hfree +#endif + +voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + return _halloc((long)items, size); +} + +void zcfree (voidpf opaque, voidpf ptr) +{ + if (opaque) opaque = 0; /* to make compiler happy */ + _hfree(ptr); +} + +#endif /* M_I86 */ + +#endif /* SYS16BIT */ + + +#ifndef MY_ZCALLOC /* Any system without a special alloc function */ + +#ifndef STDC +extern voidp malloc OF((uInt size)); +extern voidp calloc OF((uInt items, uInt size)); +extern void free OF((voidpf ptr)); +#endif + +voidpf zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; +{ + if (opaque) items += size - size; /* make compiler happy */ + return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : + (voidpf)calloc(items, size); +} + +void zcfree (opaque, ptr) + voidpf opaque; + voidpf ptr; +{ + free(ptr); + if (opaque) return; /* make compiler happy */ +} + +#endif /* MY_ZCALLOC */ diff --git a/klibc/klibc/zlib/zutil.h b/klibc/klibc/zlib/zutil.h new file mode 100644 index 0000000000..129452806b --- /dev/null +++ b/klibc/klibc/zlib/zutil.h @@ -0,0 +1,258 @@ +/* zutil.h -- internal interface and configuration of the compression library + * Copyright (C) 1995-2003 Jean-loup Gailly. + * For conditions of distribution and use, see copyright notice in zlib.h + */ + +/* WARNING: this file should *not* be used by applications. It is + part of the implementation of the compression library and is + subject to change. Applications should only use zlib.h. + */ + +/* @(#) $Id: zutil.h,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ + +#ifndef ZUTIL_H +#define ZUTIL_H + +#define ZLIB_INTERNAL +#include "zlib.h" + +#ifdef STDC +# include +# include +# include +#endif +#ifdef NO_ERRNO_H + extern int errno; +#else +# include +#endif + +#ifndef local +# define local static +#endif +/* compile with -Dlocal if your debugger can't find static symbols */ + +typedef unsigned char uch; +typedef uch FAR uchf; +typedef unsigned short ush; +typedef ush FAR ushf; +typedef unsigned long ulg; + +extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ +/* (size given to avoid silly warnings with Visual C++) */ + +#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] + +#define ERR_RETURN(strm,err) \ + return (strm->msg = (char*)ERR_MSG(err), (err)) +/* To be used only when the state is known to be valid */ + + /* common constants */ + +#ifndef DEF_WBITS +# define DEF_WBITS MAX_WBITS +#endif +/* default windowBits for decompression. MAX_WBITS is for compression only */ + +#if MAX_MEM_LEVEL >= 8 +# define DEF_MEM_LEVEL 8 +#else +# define DEF_MEM_LEVEL MAX_MEM_LEVEL +#endif +/* default memLevel */ + +#define STORED_BLOCK 0 +#define STATIC_TREES 1 +#define DYN_TREES 2 +/* The three kinds of block type */ + +#define MIN_MATCH 3 +#define MAX_MATCH 258 +/* The minimum and maximum match lengths */ + +#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ + + /* target dependencies */ + +#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) +# define OS_CODE 0x00 +# if defined(__TURBOC__) || defined(__BORLANDC__) +# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) + /* Allow compilation with ANSI keywords only enabled */ + void _Cdecl farfree( void *block ); + void *_Cdecl farmalloc( unsigned long nbytes ); +# else +# include +# endif +# else /* MSC or DJGPP */ +# include +# endif +#endif + +#ifdef AMIGA +# define OS_CODE 0x01 +#endif + +#if defined(VAXC) || defined(VMS) +# define OS_CODE 0x02 +# define F_OPEN(name, mode) \ + fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") +#endif + +#if defined(ATARI) || defined(atarist) +# define OS_CODE 0x05 +#endif + +#ifdef OS2 +# define OS_CODE 0x06 +#endif + +#if defined(MACOS) || defined(TARGET_OS_MAC) +# define OS_CODE 0x07 +# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os +# include /* for fdopen */ +# else +# ifndef fdopen +# define fdopen(fd,mode) NULL /* No fdopen() */ +# endif +# endif +#endif + +#ifdef TOPS20 +# define OS_CODE 0x0a +#endif + +#ifdef WIN32 +# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ +# define OS_CODE 0x0b +# endif +#endif + +#ifdef __50SERIES /* Prime/PRIMOS */ +# define OS_CODE 0x0f +#endif + +#if defined(_BEOS_) || defined(RISCOS) +# define fdopen(fd,mode) NULL /* No fdopen() */ +#endif + +#if (defined(_MSC_VER) && (_MSC_VER > 600)) +# if defined(_WIN32_WCE) +# define fdopen(fd,mode) NULL /* No fdopen() */ +# ifndef _PTRDIFF_T_DEFINED + typedef int ptrdiff_t; +# define _PTRDIFF_T_DEFINED +# endif +# else +# define fdopen(fd,type) _fdopen(fd,type) +# endif +#endif + + /* common defaults */ + +#ifndef OS_CODE +# define OS_CODE 0x03 /* assume Unix */ +#endif + +#ifndef F_OPEN +# define F_OPEN(name, mode) fopen((name), (mode)) +#endif + + /* functions */ + +#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#if defined(__CYGWIN__) +# ifndef HAVE_VSNPRINTF +# define HAVE_VSNPRINTF +# endif +#endif +#ifndef HAVE_VSNPRINTF +# ifdef MSDOS + /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), + but for now we just assume it doesn't. */ +# define NO_vsnprintf +# endif +# ifdef __TURBOC__ +# define NO_vsnprintf +# endif +# ifdef WIN32 + /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ +# if !defined(vsnprintf) && !defined(NO_vsnprintf) +# define vsnprintf _vsnprintf +# endif +# endif +# ifdef __SASC +# define NO_vsnprintf +# endif +#endif + +#ifdef HAVE_STRERROR + extern char *strerror OF((int)); +# define zstrerror(errnum) strerror(errnum) +#else +# define zstrerror(errnum) "" +#endif + +#if defined(pyr) +# define NO_MEMCPY +#endif +#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) + /* Use our own functions for small and medium model with MSC <= 5.0. + * You may have to use the same strategy for Borland C (untested). + * The __SC__ check is for Symantec. + */ +# define NO_MEMCPY +#endif +#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) +# define HAVE_MEMCPY +#endif +#ifdef HAVE_MEMCPY +# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ +# define zmemcpy _fmemcpy +# define zmemcmp _fmemcmp +# define zmemzero(dest, len) _fmemset(dest, 0, len) +# else +# define zmemcpy memcpy +# define zmemcmp memcmp +# define zmemzero(dest, len) memset(dest, 0, len) +# endif +#else + extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); + extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); + extern void zmemzero OF((Bytef* dest, uInt len)); +#endif + +/* Diagnostic functions */ +#ifdef DEBUG +# include + extern int z_verbose; + extern void z_error OF((char *m)); +# define Assert(cond,msg) {if(!(cond)) z_error(msg);} +# define Trace(x) {if (z_verbose>=0) fprintf x ;} +# define Tracev(x) {if (z_verbose>0) fprintf x ;} +# define Tracevv(x) {if (z_verbose>1) fprintf x ;} +# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} +# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} +#else +# define Assert(cond,msg) +# define Trace(x) +# define Tracev(x) +# define Tracevv(x) +# define Tracec(c,x) +# define Tracecv(c,x) +#endif + + +voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); +void zcfree OF((voidpf opaque, voidpf ptr)); + +#define ZALLOC(strm, items, size) \ + (*((strm)->zalloc))((strm)->opaque, (items), (size)) +#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) +#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} + +#endif /* ZUTIL_H */ diff --git a/klibc/makeklcc.pl b/klibc/makeklcc.pl new file mode 100644 index 0000000000..ea3f8a8256 --- /dev/null +++ b/klibc/makeklcc.pl @@ -0,0 +1,36 @@ +#!/usr/bin/perl +# +# Combine klibc.config, klcc.in to produce a klcc script +# +# Usage: makeklcc klcc.in klibc.config perlpath +# + +($klccin, $klibcconf, $perlpath) = @ARGV; + +# This should probably handle quotes and escapes... +sub string2list($) +{ + my($s) = @_; + + $s =~ s/\s+/\',\'/g; + return "(\'".$s."\')"; +} + +print "#!${perlpath}\n"; + +open(KLIBCCONF, '<', $klibcconf) or die "$0: cannot open $klibcconf: $!\n"; +while ( defined($l = ) ) { + chomp $l; + if ( $l =~ /=/ ) { + print "\$$` = \"\Q$'\E\";\n"; + print "\@$` = ", string2list("$'"), ";\n"; + } +} +close(KLIBCCONF); + +open(KLCCIN, '<', $klccin) or die "$0: cannot open $klccin: $!\n"; +while ( defined($l = ) ) { + print $l; +} +close(KLCCIN); + diff --git a/klibc/version b/klibc/version index b4d2b300cd..58be07ab5e 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.199 +0.205 -- cgit v1.2.3-54-g00ecf From b55e6540260ac3e38d96a0b6c00514a72d5db218 Mon Sep 17 00:00:00 2001 From: "pebenito@gentoo.org" Date: Tue, 8 Mar 2005 06:57:25 -0800 Subject: [PATCH] udev selinux fix Here is a fix for the SELinux part of udev. Setfscreatecon() overrides the default labeling behavior of SELinux when creating files, so it should only be used for as short of a time as possible, around the mknod or symlink calls. Without this, the files in udev_db get the wrong label because the fscreatecon is reset after the udev_db file creation instead of before. I'm guessing the Redhat people missed this because they modify udev_db to be one big file instead of a directory of small files (at least that's what I'm told). I created selinux_resetfscreatecon() to reset the fscreatecon asap after the file/node is created. Fixed a memory leak in selinux_init. Getfscreatecon() allocates memory for the context, and the udev code was immediately setting the pointer (security_context_t is actually a typedef'ed char*) to NULL after the call regardless of success/failure. If you're wondering about the case where there's effectively a setfscreatecon(NULL), this is ok, as its used to tell SELinux to do the default labeling behavior. Renamed selinux_restore() to selinux_exit() due to the changed behavior. Fixed a couple of dbg() messages. --- udev_add.c | 10 +++++++--- udev_selinux.c | 32 +++++++++++++++++--------------- udev_selinux.h | 6 ++++-- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/udev_add.c b/udev_add.c index eeab1ca174..e5bd042a5c 100644 --- a/udev_add.c +++ b/udev_add.c @@ -83,6 +83,7 @@ create: selinux_setfscreatecon(file, udev->kernel_name, mode); retval = mknod(file, mode, devt); + selinux_resetfscreatecon(); if (retval != 0) { dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", file, mode, major(devt), minor(devt), strerror(errno)); @@ -196,6 +197,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de /* create symlink(s) if requested */ foreach_strpart(udev->symlink, " ", pos, len) { + int retval; char linkname[NAME_SIZE]; char linktarget[NAME_SIZE]; @@ -227,9 +229,11 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de dbg("symlink(%s, %s)", linktarget, filename); if (!udev->test_run) { - selinux_setfscreatecon(filename, udev->kernel_name, S_IFLNK); unlink(filename); - if (symlink(linktarget, filename) != 0) + selinux_setfscreatecon(filename, udev->kernel_name, S_IFLNK); + retval = symlink(linktarget, filename); + selinux_resetfscreatecon(); + if (retval != 0) dbg("symlink(%s, %s) failed with error '%s'", linktarget, filename, strerror(errno)); } @@ -326,7 +330,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) } exit: - selinux_restore(); + selinux_exit(); return retval; } diff --git a/udev_selinux.c b/udev_selinux.c index 72381f0d0d..cc6f4d7d3f 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -105,7 +105,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode } if (setfilecon(file, scontext) < 0) - dbg("setfiles %s failed with error '%s'", file, strerror(errno)); + dbg("setfilecon %s failed with error '%s'", file, strerror(errno)); freecon(scontext); } @@ -131,12 +131,20 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int } if (setfscreatecon(scontext) < 0) - dbg("setfiles %s failed with error '%s'", file, strerror(errno)); + dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); freecon(scontext); } } +void selinux_resetfscreatecon(void) +{ + if (is_selinux_running()) { + if (setfscreatecon(prev_scontext) < 0) + dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); + } +} + void selinux_init(void) { /* @@ -144,23 +152,17 @@ void selinux_init(void) * restoration creation purposes. */ if (is_selinux_running()) { - if (getfscreatecon(&prev_scontext) < 0) + if (getfscreatecon(&prev_scontext) < 0) { dbg("getfscreatecon failed\n"); - - prev_scontext = NULL; + prev_scontext = NULL; + } } } -void selinux_restore(void) +void selinux_exit(void) { - if (is_selinux_running()) { - /* reset the file create context to its former glory */ - if (setfscreatecon(prev_scontext) < 0) - dbg("setfscreatecon failed\n"); - - if (prev_scontext) { - freecon(prev_scontext); - prev_scontext = NULL; - } + if (is_selinux_running() && prev_scontext) { + freecon(prev_scontext); + prev_scontext = NULL; } } diff --git a/udev_selinux.h b/udev_selinux.h index 132a9a6550..d9dfeffad0 100644 --- a/udev_selinux.h +++ b/udev_selinux.h @@ -24,15 +24,17 @@ extern void selinux_setfilecon(const char *file, const char *devname, unsigned int mode); extern void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode); +extern void selinux_resetfscreatecon(void); extern void selinux_init(void); -extern void selinux_restore(void); +extern void selinux_exit(void); #else static inline void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) {} static inline void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) {} +static inline void selinux_resetfscreatecon(void) {} static inline void selinux_init(void) {} -static inline void selinux_restore(void) {} +static inline void selinux_exit(void) {} #endif /* USE_SELINUX */ #endif /* _UDEV_USE_SELINUX */ -- cgit v1.2.3-54-g00ecf From 084420316c7345478028b25fa85b66e39b4f793b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 4 Mar 2005 06:32:03 +0100 Subject: [PATCH] klibc: check for gcc4 --- klibc/klibc/arch/i386/MCONFIG | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/klibc/klibc/arch/i386/MCONFIG b/klibc/klibc/arch/i386/MCONFIG index 67d8de4740..8310e26381 100644 --- a/klibc/klibc/arch/i386/MCONFIG +++ b/klibc/klibc/arch/i386/MCONFIG @@ -16,7 +16,7 @@ gcc_major := $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1) OPTFLAGS = -march=i386 -Os -g LDFLAGS = -m elf_i386 -ifeq ($(gcc_major),3) +ifneq ($(shell if [ $(gcc_major) -gt 2 ] ; then echo "new"; fi ;),) REGPARM := $(REGPARM_OPT) OPTFLAGS += -falign-functions=0 -falign-jumps=0 -falign-loops=0 ARCHREQFLAGS += -m32 -- cgit v1.2.3-54-g00ecf From b821330f0fce374902a1c8e32064196276006bca Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 4 Mar 2005 20:52:19 +0100 Subject: [PATCH] trivial clenaup of namedev code --- namedev.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/namedev.c b/namedev.c index f0a5c34f79..41f0bc0f16 100644 --- a/namedev.c +++ b/namedev.c @@ -168,8 +168,7 @@ static int find_free_number(struct udevice *udev, const char *name) } static void apply_format(struct udevice *udev, char *string, size_t maxsize, - struct sysfs_class_device *class_dev, - struct sysfs_device *sysfs_device) + struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { char temp[NAME_SIZE]; char temp2[NAME_SIZE]; @@ -203,26 +202,18 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, switch (c) { case 'p': - if (strlen(udev->devpath) == 0) - break; strfieldcatmax(string, udev->devpath, maxsize); dbg("substitute kernel name '%s'", udev->kernel_name); break; case 'b': - if (strlen(udev->bus_id) == 0) - break; strfieldcatmax(string, udev->bus_id, maxsize); dbg("substitute bus_id '%s'", udev->bus_id); break; case 'k': - if (strlen(udev->kernel_name) == 0) - break; strfieldcatmax(string, udev->kernel_name, maxsize); dbg("substitute kernel name '%s'", udev->kernel_name); break; case 'n': - if (strlen(udev->kernel_number) == 0) - break; strfieldcatmax(string, udev->kernel_number, maxsize); dbg("substitute kernel number '%s'", udev->kernel_number); break; @@ -235,7 +226,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("substitute major number '%u'", major(udev->devt)); break; case 'c': - if (strlen(udev->program_result) == 0) + if (udev->program_result[0] == '\0') break; /* get part part of the result string */ i = 0; @@ -730,7 +721,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d return -1; } if (dev->ignore_remove) { - udev->ignore_remove = dev->ignore_remove; + udev->ignore_remove = 1; dbg_parse("remove event should be ignored"); } /* apply all_partitions option only at a main block device */ @@ -782,16 +773,17 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", udev->name, udev->owner, udev->group, udev->mode, udev->partitions); - goto exit; + break; } } } - /* no rule matched, so we use the kernel name */ - strfieldcpy(udev->name, udev->kernel_name); - dbg("no rule found, use kernel name '%s'", udev->name); + if (udev->name[0] == '\0') { + /* no rule matched, so we use the kernel name */ + strfieldcpy(udev->name, udev->kernel_name); + dbg("no rule found, use kernel name '%s'", udev->name); + } -exit: if (udev->tmp_node[0] != '\0') { dbg("removing temporary device node"); unlink_secure(udev->tmp_node); -- cgit v1.2.3-54-g00ecf From 75bc9b086fe0f212e52da8425e4a4cb2d8f38090 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 4 Mar 2005 20:56:51 +0100 Subject: [PATCH] kill stupid gcc4 warning --- udev_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index 8813bd5c47..fc7ee885b0 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -330,7 +330,7 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "iucv", .file = "detach_state" }, { NULL, NULL } }; - const struct device_file *devicefile; + const struct device_file *devicefile = NULL; int loop; /* the kernel may tell us what to wait for */ -- cgit v1.2.3-54-g00ecf From c98cb35eb5f24940cf8836be96de42c9e8795f27 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 4 Mar 2005 21:00:43 +0100 Subject: [PATCH] rename attributes to options --- namedev.h | 6 +++--- namedev_parse.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/namedev.h b/namedev.h index 3a16144169..1d6920cc7c 100644 --- a/namedev.h +++ b/namedev.h @@ -52,9 +52,9 @@ struct sysfs_class_device; #define FIELD_MODE "MODE" #define FIELD_OPTIONS "OPTIONS" -#define ATTR_IGNORE_DEVICE "ignore_device" -#define ATTR_IGNORE_REMOVE "ignore_remove" -#define ATTR_PARTITIONS "all_partitions" +#define OPTION_IGNORE_DEVICE "ignore_device" +#define OPTION_IGNORE_REMOVE "ignore_remove" +#define OPTION_PARTITIONS "all_partitions" #define MAX_SYSFS_PAIRS 5 diff --git a/namedev_parse.c b/namedev_parse.c index 02d8a6520c..ed38db4b14 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -250,11 +250,11 @@ static int namedev_parse(const char *filename, void *data) attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1); /* FIXME: remove old style options and make OPTIONS= mandatory */ if (attr != NULL) { - if (strstr(attr, ATTR_PARTITIONS) != NULL) { + if (strstr(attr, OPTION_PARTITIONS) != NULL) { dbg_parse("creation of partition nodes requested"); dev.partitions = DEFAULT_PARTITIONS_COUNT; } - if (strstr(attr, ATTR_IGNORE_REMOVE) != NULL) { + if (strstr(attr, OPTION_IGNORE_REMOVE) != NULL) { dbg_parse("remove event should be ignored"); dev.ignore_remove = 1; } @@ -292,15 +292,15 @@ static int namedev_parse(const char *filename, void *data) } if (strcasecmp(temp2, FIELD_OPTIONS) == 0) { - if (strstr(temp3, ATTR_IGNORE_DEVICE) != NULL) { + if (strstr(temp3, OPTION_IGNORE_DEVICE) != NULL) { dbg_parse("device should be ignored"); dev.ignore_device = 1; } - if (strstr(temp3, ATTR_IGNORE_REMOVE) != NULL) { + if (strstr(temp3, OPTION_IGNORE_REMOVE) != NULL) { dbg_parse("remove event should be ignored"); dev.ignore_remove = 1; } - if (strstr(temp3, ATTR_PARTITIONS) != NULL) { + if (strstr(temp3, OPTION_PARTITIONS) != NULL) { dbg_parse("creation of partition nodes requested"); dev.partitions = DEFAULT_PARTITIONS_COUNT; } -- cgit v1.2.3-54-g00ecf From 03cfa1394fcc2c4386f8af22e5a4d9fdd7cecc50 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 4 Mar 2005 21:13:18 +0100 Subject: [PATCH] correct udev_init_device --- udev.c | 18 +++++---------- udev.h | 5 ++--- udev_utils.c | 71 +++++++++++++++++++++++++++++------------------------------- 3 files changed, 41 insertions(+), 53 deletions(-) diff --git a/udev.c b/udev.c index 7854bc74d0..802e41d147 100644 --- a/udev.c +++ b/udev.c @@ -96,7 +96,6 @@ static void asmlinkage sig_handler(int signum) int main(int argc, char *argv[], char *envp[]) { - struct sigaction act; struct sysfs_class_device *class_dev; struct sysfs_device *devices_dev; struct udevice udev; @@ -106,6 +105,7 @@ int main(int argc, char *argv[], char *envp[]) const char *devpath; const char *subsystem; int managed_event; + struct sigaction act; int retval = -EINVAL; if (argc == 2 && strcmp(argv[1], "-V") == 0) { @@ -153,16 +153,10 @@ int main(int argc, char *argv[], char *envp[]) if (!subsystem && argc == 2) subsystem = argv[1]; - if (!action) { - dbg("no action"); - goto hotplug; - } - if (!subsystem) { - dbg("no subsystem"); - goto hotplug; - } - if (!devpath) { - dbg("no devpath"); + udev_init_device(&udev, devpath, subsystem); + + if (!action || !subsystem || !devpath) { + dbg("action, subsystem or devpath missing"); goto hotplug; } @@ -170,8 +164,6 @@ int main(int argc, char *argv[], char *envp[]) if (udev_log) setenv("UDEV_LOG", "1", 1); - udev_init_device(&udev, devpath, subsystem); - if (udev.type == BLOCK || udev.type == CLASS || udev.type == NET) { if (strcmp(action, "add") == 0) { /* wait for sysfs and possibly add node */ diff --git a/udev.h b/udev.h index d6dbd7c332..ddcfa81c8e 100644 --- a/udev.h +++ b/udev.h @@ -31,6 +31,7 @@ #define ALARM_TIMEOUT 120 #define COMMENT_CHARACTER '#' +#define LINE_SIZE 512 #define NAME_SIZE 256 #define USER_SIZE 32 @@ -39,8 +40,6 @@ #define SUBSYSTEM_SIZE 32 #define SEQNUM_SIZE 32 -#define LINE_SIZE 512 - #define DEVD_DIR "/etc/dev.d" #define DEVD_SUFFIX ".dev" @@ -62,6 +61,7 @@ struct udevice { char subsystem[SUBSYSTEM_SIZE]; char name[NAME_SIZE]; + char devname[NAME_SIZE]; char symlink[NAME_SIZE]; char owner[USER_SIZE]; char group[USER_SIZE]; @@ -69,7 +69,6 @@ struct udevice { char type; dev_t devt; - char devname[NAME_SIZE]; char tmp_node[NAME_SIZE]; int partitions; int ignore_remove; diff --git a/udev_utils.c b/udev_utils.c index c1e497626e..f2534dd331 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -43,52 +43,49 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs memset(udev, 0x00, sizeof(struct udevice)); + if (subsystem) + strfieldcpy(udev->subsystem, subsystem); + if (devpath) { strfieldcpy(udev->devpath, devpath); no_trailing_slash(udev->devpath); - } - if (subsystem) - strfieldcpy(udev->subsystem, subsystem); - if (strcmp(udev->subsystem, "block") == 0) - udev->type = BLOCK; - else if (strcmp(udev->subsystem, "net") == 0) - udev->type = NET; - else if (strncmp(udev->devpath, "/block/", 7) == 0) - udev->type = BLOCK; - else if (strncmp(udev->devpath, "/class/net/", 11) == 0) - udev->type = NET; - else if (strncmp(udev->devpath, "/class/", 7) == 0) - udev->type = CLASS; - else if (strncmp(udev->devpath, "/devices/", 9) == 0) - udev->type = PHYSDEV; + if (strncmp(udev->devpath, "/block/", 7) == 0) + udev->type = BLOCK; + else if (strncmp(udev->devpath, "/class/net/", 11) == 0) + udev->type = NET; + else if (strncmp(udev->devpath, "/class/", 7) == 0) + udev->type = CLASS; + else if (strncmp(udev->devpath, "/devices/", 9) == 0) + udev->type = PHYSDEV; + + /* get kernel name */ + pos = strrchr(udev->devpath, '/'); + if (pos) { + strfieldcpy(udev->kernel_name, &pos[1]); + dbg("kernel_name='%s'", udev->kernel_name); + + /* Some block devices have '!' in their name, change that to '/' */ + pos = udev->kernel_name; + while (pos[0] != '\0') { + if (pos[0] == '!') + pos[0] = '/'; + pos++; + } + + /* get kernel number */ + pos = &udev->kernel_name[strlen(udev->kernel_name)]; + while (isdigit(pos[-1])) + pos--; + strfieldcpy(udev->kernel_number, pos); + dbg("kernel_number='%s'", udev->kernel_number); + } + } udev->mode = 0660; strcpy(udev->owner, "root"); strcpy(udev->group, "root"); - /* get kernel name */ - pos = strrchr(udev->devpath, '/'); - if (pos == NULL) - return -1; - strfieldcpy(udev->kernel_name, &pos[1]); - - /* get kernel number */ - pos = &udev->kernel_name[strlen(udev->kernel_name)]; - while (isdigit(pos[-1])) - pos--; - strfieldcpy(udev->kernel_number, pos); - dbg("kernel_number='%s'", udev->kernel_number); - - /* Some block devices have '!' in their name, change that to '/' */ - pos = udev->kernel_name; - while (pos[0] != '\0') { - if (pos[0] == '!') - pos[0] = '/'; - pos++; - } - - dbg("kernel_name='%s'", udev->kernel_name); return 0; } -- cgit v1.2.3-54-g00ecf From f0308095c78fd68c29be9b3b391bc1c077afa04c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 4 Mar 2005 21:33:57 +0100 Subject: [PATCH] remove typedef for call_foreach_file() handler function --- namedev_parse.c | 9 +++++---- udev.h | 1 + udev_db.h | 2 +- udev_multiplex.c | 11 +++++------ udev_utils.c | 14 +++++--------- udev_utils.h | 12 ++++++++---- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/namedev_parse.c b/namedev_parse.c index ed38db4b14..e360565950 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -98,7 +98,7 @@ static char *get_key_attribute(char *str) return NULL; } -static int namedev_parse(const char *filename, void *data) +static int namedev_parse(struct udevice *udev, const char *filename) { char line[LINE_SIZE]; char *bufline; @@ -354,9 +354,9 @@ int namedev_init(void) return -1; if ((stats.st_mode & S_IFMT) != S_IFDIR) - retval = namedev_parse(udev_rules_filename, NULL); + retval = namedev_parse(NULL, udev_rules_filename); else - retval = call_foreach_file(namedev_parse, udev_rules_filename, RULEFILE_SUFFIX, NULL); + retval = call_foreach_file(namedev_parse, NULL, udev_rules_filename, RULEFILE_SUFFIX); return retval; } @@ -364,8 +364,9 @@ int namedev_init(void) void namedev_close(void) { struct config_device *dev; + struct config_device *temp_dev; - list_for_each_entry(dev, &config_device_list, node) { + list_for_each_entry_safe(dev, temp_dev, &config_device_list, node) { list_del(&dev->node); free(dev); } diff --git a/udev.h b/udev.h index ddcfa81c8e..f1236194d6 100644 --- a/udev.h +++ b/udev.h @@ -4,6 +4,7 @@ * Userspace devfs * * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003-2005 Kay Sievers * * 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 diff --git a/udev_db.h b/udev_db.h index 6a0647f200..2fce06be72 100644 --- a/udev_db.h +++ b/udev_db.h @@ -28,7 +28,7 @@ extern int udev_db_add_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); -extern int udev_db_get_device_by_devpath(struct udevice *dev, const char *devpath); +extern int udev_db_get_device_by_devpath(struct udevice *udev, const char *devpath); extern int udev_db_get_device_by_name(struct udevice *udev, const char *name); extern int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)); diff --git a/udev_multiplex.c b/udev_multiplex.c index 3a484068ff..6d7852dbc0 100644 --- a/udev_multiplex.c +++ b/udev_multiplex.c @@ -31,11 +31,10 @@ #include "udev_utils.h" #include "logging.h" -static int run_program(const char *filename, void *data) +static int run_program(struct udevice *udev, const char *filename) { pid_t pid; int fd; - struct udevice *udev = data; dbg("running %s", filename); @@ -89,7 +88,7 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c if (strcmp(devname, udev->subsystem) != 0) { snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname); dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); + call_foreach_file(run_program, udev, dirname, suffix); } temp[0] = '/'; @@ -101,16 +100,16 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c if (udev->name[0] != '\0') { snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->name); dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); + call_foreach_file(run_program, udev, dirname, suffix); } if (udev->subsystem[0] != '\0') { snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->subsystem); dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); + call_foreach_file(run_program, udev, dirname, suffix); } snprintf(dirname, PATH_MAX, "%s/default", basedir); dirname[PATH_MAX-1] = '\0'; - call_foreach_file(run_program, dirname, suffix, udev); + call_foreach_file(run_program, udev, dirname, suffix); } diff --git a/udev_utils.c b/udev_utils.c index f2534dd331..cfa4ab51b3 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -259,13 +259,7 @@ void no_trailing_slash(char *path) path[--len] = '\0'; } -struct name_entry { - struct list_head node; - char name[NAME_SIZE]; -}; - -/* sort files in lexical order */ -static int name_list_add(struct list_head *name_list, const char *name, int sort) +int name_list_add(struct list_head *name_list, const char *name, int sort) { struct name_entry *loop_name; struct name_entry *new_name; @@ -288,11 +282,13 @@ static int name_list_add(struct list_head *name_list, const char *name, int sort strfieldcpy(new_name->name, name); list_add_tail(&new_name->node, &loop_name->node); + return 0; } /* calls function for every file found in specified directory */ -int call_foreach_file(file_fnct_t fnct, const char *dirname, const char *suffix, void *data) +int call_foreach_file(int (*handler_function)(struct udevice *udev, const char *string), + struct udevice *udev, const char *dirname, const char *suffix) { struct dirent *ent; DIR *dir; @@ -335,7 +331,7 @@ int call_foreach_file(file_fnct_t fnct, const char *dirname, const char *suffix, snprintf(filename, NAME_SIZE, "%s/%s", dirname, loop_file->name); filename[NAME_SIZE-1] = '\0'; - fnct(filename, data); + handler_function(udev, filename); list_del(&loop_file->node); free(loop_file); diff --git a/udev_utils.h b/udev_utils.h index 268c2075de..1ab4752cd3 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -76,6 +76,11 @@ do { \ # define asmlinkage /* nothing */ #endif +struct name_entry { + struct list_head node; + char name[NAME_SIZE]; +}; + extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); extern int create_path(const char *path); @@ -85,8 +90,7 @@ extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); extern void no_trailing_slash(char *path); -typedef int (*file_fnct_t)(const char *filename, void *data); -extern int call_foreach_file(file_fnct_t fnct, const char *dirname, - const char *suffix, void *data); - +extern int name_list_add(struct list_head *name_list, const char *name, int sort); +extern int call_foreach_file(int (*handler_function)(struct udevice *udev, const char *string), + struct udevice *udev, const char *dirname, const char *suffix); #endif -- cgit v1.2.3-54-g00ecf From 237415b141ae2f3915160bc43ed76296588299f0 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Mar 2005 02:33:31 +0100 Subject: [PATCH] unmap db-file after use --- udev_db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_db.c b/udev_db.c index 4515998fcd..a423247d6b 100644 --- a/udev_db.c +++ b/udev_db.c @@ -153,6 +153,7 @@ static int parse_db_file(struct udevice *udev, const char *filename) break; } } + file_unmap(buf, bufsize); if (udev->name[0] == '\0') return -1; -- cgit v1.2.3-54-g00ecf From 7eb92135c61af77fff62eec5f396b9633a54b245 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 26 Apr 2005 23:48:29 -0700 Subject: more merge fixups, looks like i missed a selinux patch somewhere... --- udev_add.c | 10 +++------- udev_selinux.c | 32 +++++++++++++++----------------- udev_selinux.h | 6 ++---- 3 files changed, 20 insertions(+), 28 deletions(-) diff --git a/udev_add.c b/udev_add.c index e5bd042a5c..eeab1ca174 100644 --- a/udev_add.c +++ b/udev_add.c @@ -83,7 +83,6 @@ create: selinux_setfscreatecon(file, udev->kernel_name, mode); retval = mknod(file, mode, devt); - selinux_resetfscreatecon(); if (retval != 0) { dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", file, mode, major(devt), minor(devt), strerror(errno)); @@ -197,7 +196,6 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de /* create symlink(s) if requested */ foreach_strpart(udev->symlink, " ", pos, len) { - int retval; char linkname[NAME_SIZE]; char linktarget[NAME_SIZE]; @@ -229,11 +227,9 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de dbg("symlink(%s, %s)", linktarget, filename); if (!udev->test_run) { - unlink(filename); selinux_setfscreatecon(filename, udev->kernel_name, S_IFLNK); - retval = symlink(linktarget, filename); - selinux_resetfscreatecon(); - if (retval != 0) + unlink(filename); + if (symlink(linktarget, filename) != 0) dbg("symlink(%s, %s) failed with error '%s'", linktarget, filename, strerror(errno)); } @@ -330,7 +326,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) } exit: - selinux_exit(); + selinux_restore(); return retval; } diff --git a/udev_selinux.c b/udev_selinux.c index cc6f4d7d3f..72381f0d0d 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -105,7 +105,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode } if (setfilecon(file, scontext) < 0) - dbg("setfilecon %s failed with error '%s'", file, strerror(errno)); + dbg("setfiles %s failed with error '%s'", file, strerror(errno)); freecon(scontext); } @@ -131,20 +131,12 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int } if (setfscreatecon(scontext) < 0) - dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); + dbg("setfiles %s failed with error '%s'", file, strerror(errno)); freecon(scontext); } } -void selinux_resetfscreatecon(void) -{ - if (is_selinux_running()) { - if (setfscreatecon(prev_scontext) < 0) - dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); - } -} - void selinux_init(void) { /* @@ -152,17 +144,23 @@ void selinux_init(void) * restoration creation purposes. */ if (is_selinux_running()) { - if (getfscreatecon(&prev_scontext) < 0) { + if (getfscreatecon(&prev_scontext) < 0) dbg("getfscreatecon failed\n"); - prev_scontext = NULL; - } + + prev_scontext = NULL; } } -void selinux_exit(void) +void selinux_restore(void) { - if (is_selinux_running() && prev_scontext) { - freecon(prev_scontext); - prev_scontext = NULL; + if (is_selinux_running()) { + /* reset the file create context to its former glory */ + if (setfscreatecon(prev_scontext) < 0) + dbg("setfscreatecon failed\n"); + + if (prev_scontext) { + freecon(prev_scontext); + prev_scontext = NULL; + } } } diff --git a/udev_selinux.h b/udev_selinux.h index d9dfeffad0..132a9a6550 100644 --- a/udev_selinux.h +++ b/udev_selinux.h @@ -24,17 +24,15 @@ extern void selinux_setfilecon(const char *file, const char *devname, unsigned int mode); extern void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode); -extern void selinux_resetfscreatecon(void); extern void selinux_init(void); -extern void selinux_exit(void); +extern void selinux_restore(void); #else static inline void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) {} static inline void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) {} -static inline void selinux_resetfscreatecon(void) {} static inline void selinux_init(void) {} -static inline void selinux_exit(void) {} +static inline void selinux_restore(void) {} #endif /* USE_SELINUX */ #endif /* _UDEV_USE_SELINUX */ -- cgit v1.2.3-54-g00ecf From e48fc108d9731f6f091742fe6588c495d1948fac Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Mar 2005 05:35:31 +0100 Subject: [PATCH] allow unlimitied count of symlinks --- namedev.c | 27 +++++++++---- udev.c | 1 + udev.h | 2 +- udev_add.c | 19 ++++----- udev_db.c | 95 ++++++++++++++++++++++++++++----------------- udev_db.h | 4 +- udev_remove.c | 31 ++++++--------- udev_utils.c | 12 ++++++ udev_utils.h | 2 + udevinfo.c | 122 +++++++++++++++++++++++++--------------------------------- 10 files changed, 169 insertions(+), 146 deletions(-) diff --git a/namedev.c b/namedev.c index 41f0bc0f16..91841571c1 100644 --- a/namedev.c +++ b/namedev.c @@ -144,15 +144,14 @@ static int get_format_len(char **str) */ static int find_free_number(struct udevice *udev, const char *name) { + char devpath[NAME_SIZE]; char filename[NAME_SIZE]; int num = 0; - struct udevice db_udev; strfieldcpy(filename, name); while (1) { dbg("look for existing node '%s'", filename); - memset(&db_udev, 0x00, sizeof(struct udevice)); - if (udev_db_get_device_by_name(&db_udev, filename) != 0) { + if (udev_db_search_name(devpath, DEVPATH_SIZE, filename) != 0) { dbg("free num=%d", num); return num; } @@ -298,13 +297,14 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, struct udevice udev_parent; dbg("found parent '%s', get the node name", class_dev_parent->path); - memset(&udev_parent, 0x00, sizeof(struct udevice)); + udev_init_device(&udev_parent, NULL, NULL); /* lookup the name in the udev_db with the DEVPATH of the parent */ - if (udev_db_get_device_by_devpath(&udev_parent, &class_dev_parent->path[strlen(sysfs_path)]) == 0) { + if (udev_db_get_device(&udev_parent, &class_dev_parent->path[strlen(sysfs_path)]) == 0) { strfieldcatmax(string, udev_parent.name, maxsize); dbg("substitute parent node name'%s'", udev_parent.name); } else dbg("parent not found in database"); + udev_cleanup_device(&udev_parent); } break; case 'N': @@ -749,14 +749,25 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d /* collect symlinks */ if (dev->symlink[0] != '\0') { char temp[NAME_SIZE]; + char *pos, *next; info("configured rule in '%s[%i]' applied, added symlink '%s'", dev->config_file, dev->config_line, dev->symlink); strfieldcpy(temp, dev->symlink); apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); - if (udev->symlink[0] != '\0') - strfieldcat(udev->symlink, " "); - strfieldcat(udev->symlink, temp); + + /* add multiple symlinks separated by spaces */ + pos = temp; + next = strchr(temp, ' '); + while (next) { + next[0] = '\0'; + dbg("add symlink '%s'", pos); + name_list_add(&udev->symlink_list, pos, 0); + pos = &next[1]; + next = strchr(pos, ' '); + } + dbg("add symlink '%s'", pos); + name_list_add(&udev->symlink_list, pos, 0); } /* rule matches */ diff --git a/udev.c b/udev.c index 802e41d147..c26ce46b64 100644 --- a/udev.c +++ b/udev.c @@ -236,6 +236,7 @@ int main(int argc, char *argv[], char *envp[]) } hotplug: + udev_cleanup_device(&udev); if (udev_hotplug_d && managed_event) udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX); diff --git a/udev.h b/udev.h index f1236194d6..811439faf2 100644 --- a/udev.h +++ b/udev.h @@ -63,7 +63,7 @@ struct udevice { char name[NAME_SIZE]; char devname[NAME_SIZE]; - char symlink[NAME_SIZE]; + struct list_head symlink_list; char owner[USER_SIZE]; char group[USER_SIZE]; mode_t mode; diff --git a/udev_add.c b/udev_add.c index eeab1ca174..7e0c57fc63 100644 --- a/udev_add.c +++ b/udev_add.c @@ -113,12 +113,11 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de { char filename[NAME_SIZE]; char partitionname[NAME_SIZE]; + struct name_entry *name_loop; uid_t uid = 0; gid_t gid = 0; int tail; - char *pos; - int len; - int i; + int i; snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); filename[NAME_SIZE-1] = '\0'; @@ -195,30 +194,28 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de } /* create symlink(s) if requested */ - foreach_strpart(udev->symlink, " ", pos, len) { - char linkname[NAME_SIZE]; + list_for_each_entry(name_loop, &udev->symlink_list, node) { char linktarget[NAME_SIZE]; - strfieldcpymax(linkname, pos, len+1); - snprintf(filename, NAME_SIZE, "%s/%s", udev_root, linkname); + snprintf(filename, NAME_SIZE, "%s/%s", udev_root, name_loop->name); filename[NAME_SIZE-1] = '\0'; dbg("symlink '%s' to node '%s' requested", filename, udev->name); if (!udev->test_run) - if (strrchr(linkname, '/')) + if (strchr(filename, '/')) create_path(filename); /* optimize relative link */ linktarget[0] = '\0'; i = 0; tail = 0; - while ((udev->name[i] == linkname[i]) && udev->name[i]) { + while (udev->name[i] && (udev->name[i] == name_loop->name[i])) { if (udev->name[i] == '/') tail = i+1; i++; } - while (linkname[i] != '\0') { - if (linkname[i] == '/') + while (name_loop->name[i] != '\0') { + if (name_loop->name[i] == '/') strfieldcat(linktarget, "../"); i++; } diff --git a/udev_db.c b/udev_db.c index a423247d6b..1015d21221 100644 --- a/udev_db.c +++ b/udev_db.c @@ -60,6 +60,7 @@ static int get_db_filename(const char *devpath, char *filename, int len) int udev_db_add_device(struct udevice *udev) { char filename[SYSFS_PATH_MAX]; + struct name_entry *name_loop; FILE *f; if (udev->test_run) @@ -78,7 +79,8 @@ int udev_db_add_device(struct udevice *udev) fprintf(f, "P:%s\n", udev->devpath); fprintf(f, "N:%s\n", udev->name); - fprintf(f, "S:%s\n", udev->symlink); + list_for_each_entry(name_loop, &udev->symlink_list, node) + fprintf(f, "S:%s\n", name_loop->name); fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); fprintf(f, "A:%u\n", udev->partitions); fprintf(f, "R:%u\n", udev->ignore_remove); @@ -134,8 +136,9 @@ static int parse_db_file(struct udevice *udev, const char *filename) case 'S': if (count > NAME_SIZE) count = NAME_SIZE-1; - strncpy(udev->symlink, &bufline[2], count-2); - udev->symlink[count-2] = '\0'; + strncpy(temp, &bufline[2], count-2); + temp[count-2] = '\0'; + name_list_add(&udev->symlink_list, temp, 0); break; case 'A': if (count > NAME_SIZE) @@ -171,21 +174,23 @@ int udev_db_delete_device(struct udevice *udev) return 0; } -int udev_db_get_device_by_devpath(struct udevice *udev, const char *devpath) +int udev_db_get_device(struct udevice *udev, const char *devpath) { char filename[SYSFS_PATH_MAX]; get_db_filename(devpath, filename, SYSFS_PATH_MAX); - return parse_db_file(udev, filename); + if (parse_db_file(udev, filename) != 0) + return -1; + + return 0; } -int udev_db_get_device_by_name(struct udevice *udev, const char *name) +int udev_db_search_name(char *devpath, size_t len, const char *name) { struct dirent *ent; DIR *dir; char filename[NAME_SIZE]; - struct udevice db_udev; dir = opendir(udev_db_path); if (dir == NULL) { @@ -194,6 +199,14 @@ int udev_db_get_device_by_name(struct udevice *udev, const char *name) } while (1) { + char path[DEVPATH_SIZE]; + char nodename[NAME_SIZE]; + char *bufline; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') break; @@ -203,42 +216,50 @@ int udev_db_get_device_by_name(struct udevice *udev, const char *name) snprintf(filename, NAME_SIZE, "%s/%s", udev_db_path, ent->d_name); filename[NAME_SIZE-1] = '\0'; + dbg("looking at '%s'", filename); - memset(&db_udev, 0x00, sizeof(struct udevice)); - if (parse_db_file(&db_udev, filename) == 0) { - char *pos; - unsigned int len; - - if (strncmp(name, db_udev.name, NAME_SIZE) == 0) { - goto found; - } - - foreach_strpart(db_udev.symlink, " ", pos, len) { - if (strncmp(name, pos, len) != 0) - continue; + if (file_map(filename, &buf, &bufsize) != 0) { + dbg("unable to read db file '%s'", filename); + continue; + } - if (len == strlen(name)) - goto found; + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + + switch(bufline[0]) { + case 'P': + if (count > DEVPATH_SIZE) + count = DEVPATH_SIZE-1; + strncpy(path, &bufline[2], count-2); + path[count-2] = '\0'; + break; + case 'N': + case 'S': + if (count > NAME_SIZE) + count = NAME_SIZE-1; + strncpy(nodename, &bufline[2], count-2); + nodename[count-2] = '\0'; + dbg("compare '%s' '%s'", nodename, name); + if (strcmp(nodename, name) == 0) { + strncpy(devpath, path, len); + devpath[len] = '\0'; + file_unmap(buf, bufsize); + closedir(dir); + return 0; + } + break; + default: + continue; } - } + file_unmap(buf, bufsize); } closedir(dir); - return -1; - -found: - closedir(dir); - - strfieldcpy(udev->devpath, db_udev.devpath); - strfieldcpy(udev->name, db_udev.name); - strfieldcpy(udev->symlink, db_udev.symlink); - udev->partitions = db_udev.partitions; - udev->ignore_remove = db_udev.ignore_remove; - udev->devt = db_udev.devt; - - return 0; } int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)) @@ -265,7 +286,9 @@ int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)) snprintf(filename, NAME_SIZE, "%s/%s", udev_db_path, ent->d_name); filename[NAME_SIZE-1] = '\0'; - memset(&db_udev, 0x00, sizeof(struct udevice)); + dbg("found '%s'", filename); + + udev_init_device(&db_udev, NULL, NULL); if (parse_db_file(&db_udev, filename) == 0) { if (handler_function(&db_udev) != 0) break; diff --git a/udev_db.h b/udev_db.h index 2fce06be72..8840142fe3 100644 --- a/udev_db.h +++ b/udev_db.h @@ -28,8 +28,8 @@ extern int udev_db_add_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); -extern int udev_db_get_device_by_devpath(struct udevice *udev, const char *devpath); -extern int udev_db_get_device_by_name(struct udevice *udev, const char *name); +extern int udev_db_get_device(struct udevice *udev, const char *devpath); +extern int udev_db_search_name(char *devpath, size_t len, const char *name); extern int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)); #endif /* _UDEV_DB_H_ */ diff --git a/udev_remove.c b/udev_remove.c index 22a363ed34..756eef0476 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -71,11 +71,10 @@ static int delete_node(struct udevice *udev) { char filename[NAME_SIZE]; char partitionname[NAME_SIZE]; + struct name_entry *name_loop; struct stat stats; int retval; int i; - char *pos; - int len; int num; snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); @@ -114,11 +113,8 @@ static int delete_node(struct udevice *udev) if (strchr(udev->name, '/')) delete_path(filename); - foreach_strpart(udev->symlink, " ", pos, len) { - char linkname[NAME_SIZE]; - - strfieldcpymax(linkname, pos, len+1); - snprintf(filename, NAME_SIZE, "%s/%s", udev_root, linkname); + list_for_each_entry(name_loop, &udev->symlink_list, node) { + snprintf(filename, NAME_SIZE, "%s/%s", udev_root, name_loop->name); filename[NAME_SIZE-1] = '\0'; dbg("unlinking symlink '%s'", filename); @@ -130,7 +126,7 @@ static int delete_node(struct udevice *udev) filename, strerror(errno)); return retval; } - if (strchr(udev->symlink, '/')) { + if (strchr(filename, '/')) { delete_path(filename); } } @@ -145,13 +141,18 @@ static int delete_node(struct udevice *udev) int udev_remove_device(struct udevice *udev) { const char *temp; - int retval; if (udev->type != BLOCK && udev->type != CLASS) return 0; - retval = udev_db_get_device_by_devpath(udev, udev->devpath); - if (retval) { + if (udev_db_get_device(udev, udev->devpath) == 0) { + if (udev->ignore_remove) { + dbg("remove event for '%s' requested to be ignored by rule", udev->name); + return 0; + } + dbg("remove name='%s'", udev->name); + udev_db_delete_device(udev); + } else { /* fall back to kernel name */ temp = strrchr(udev->devpath, '/'); if (temp == NULL) @@ -160,14 +161,6 @@ int udev_remove_device(struct udevice *udev) dbg("'%s' not found in database, falling back on default name", udev->name); } - if (udev->ignore_remove) { - dbg("remove event for '%s' requested to be ignored by rule", udev->name); - return 0; - } - - dbg("remove name='%s'", udev->name); - udev_db_delete_device(udev); - /* use full path to the environment */ snprintf(udev->devname, NAME_SIZE, "%s/%s", udev_root, udev->name); diff --git a/udev_utils.c b/udev_utils.c index cfa4ab51b3..60f5ad859a 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -42,6 +42,7 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs char *pos; memset(udev, 0x00, sizeof(struct udevice)); + INIT_LIST_HEAD(&udev->symlink_list); if (subsystem) strfieldcpy(udev->subsystem, subsystem); @@ -89,6 +90,17 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs return 0; } +void udev_cleanup_device(struct udevice *udev) +{ + struct name_entry *name_loop; + struct name_entry *temp_loop; + + list_for_each_entry_safe(name_loop, temp_loop, &udev->symlink_list, node) { + list_del(&name_loop->node); + free(name_loop); + } +} + int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel) { static unsigned int kversion = 0; diff --git a/udev_utils.h b/udev_utils.h index 1ab4752cd3..2f2c2497cb 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -82,6 +82,8 @@ struct name_entry { }; extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); +extern void udev_cleanup_device(struct udevice *udev); + extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); extern int create_path(const char *path); extern int parse_get_pair(char **orig_string, char **left, char **right); diff --git a/udevinfo.c b/udevinfo.c index 045395256d..6dfb918de5 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -83,10 +83,13 @@ static void print_all_attributes(struct dlist *attr_list) static int print_record(struct udevice *udev) { + struct name_entry *name_loop; + printf("P: %s\n", udev->devpath); printf("N: %s\n", udev->name); - printf("S: %s\n", udev->symlink); - printf("\n"); + list_for_each_entry(name_loop, &udev->symlink_list, node) + printf("S: %s\n", name_loop->name); + return 0; } @@ -95,7 +98,7 @@ enum query_type { NAME, PATH, SYMLINK, - ALL + ALL, }; static int print_device_chain(const char *path) @@ -183,20 +186,25 @@ static int print_dump(struct udevice *udev) { return 0; } -static int process_options(int argc, char *argv[]) +int main(int argc, char *argv[], char *envp[]) { static const char short_options[] = "adn:p:q:rVh"; int option; - int retval = 1; struct udevice udev; int root = 0; int attributes = 0; enum query_type query = NONE; - char result[1024] = ""; char path[NAME_SIZE] = ""; char name[NAME_SIZE] = ""; char temp[NAME_SIZE]; + struct name_entry *name_loop; char *pos; + int retval = 0; + + logging_init("udevinfo"); + + udev_init_config(); + udev_init_device(&udev, NULL, NULL); /* get command line options */ while (1) { @@ -240,7 +248,8 @@ static int process_options(int argc, char *argv[]) } printf("unknown query type\n"); - exit(1); + retval = 1; + goto exit; case 'r': root = 1; @@ -252,14 +261,14 @@ static int process_options(int argc, char *argv[]) case 'd': udev_db_call_foreach(print_dump); - exit(0); + goto exit; case 'V': printf("udevinfo, version %s\n", UDEV_VERSION); - exit(0); + goto exit; case 'h': - retval = 0; + retval = 2; case '?': default: goto help; @@ -275,15 +284,14 @@ static int process_options(int argc, char *argv[]) } else { if (path[0] != '/') { /* prepend '/' if missing */ - strfieldcat(temp, "/"); + strcpy(temp, "/"); strfieldcat(temp, path); pos = temp; } else { pos = path; } } - memset(&udev, 0x00, sizeof(struct udevice)); - retval = udev_db_get_device_by_devpath(&udev, pos); + retval = udev_db_get_device(&udev, pos); if (retval != 0) { printf("device not found in database\n"); goto exit; @@ -292,77 +300,64 @@ static int process_options(int argc, char *argv[]) } if (name[0] != '\0') { - /* remove udev_root if given */ - int len = strlen(udev_root); + char devpath[NAME_SIZE]; + int len; + /* remove udev_root if given */ + len = strlen(udev_root); if (strncmp(name, udev_root, len) == 0) { pos = &name[len+1]; } else pos = name; - memset(&udev, 0x00, sizeof(struct udevice)); - strfieldcpy(udev.name, pos); - retval = udev_db_get_device_by_name(&udev, pos); + retval = udev_db_search_name(devpath, DEVPATH_SIZE, pos); if (retval != 0) { printf("device not found in database\n"); goto exit; } - + udev_db_get_device(&udev, devpath); goto print; } printf("query needs device path(-p) or node name(-n) specified\n"); + retval = 3; goto exit; print: switch(query) { case NAME: - if (root) { - snprintf(result, NAME_SIZE-1, "%s/%s", udev_root, udev.name); - result[NAME_SIZE-1] = '\0'; - } else { - strfieldcpy(result, udev.name); - } - break; - + if (root) + printf("%s/%s\n", udev_root, udev.name); + else + printf("%s\n", udev.name); + goto exit; case SYMLINK: - if (root) { - int slen; - char *spos; - char slink[NAME_SIZE]; - - pos = result; - foreach_strpart(udev.symlink, " \n\r", spos, slen) { - strncpy(slink, spos, slen); - slink[slen] = '\0'; - pos += sprintf(pos, "%s/%s ", udev_root, slink); - } - } else { - strfieldcpy(result, udev.symlink); - } - break; - + if (list_empty(&udev.symlink_list)) + break; + if (root) + list_for_each_entry(name_loop, &udev.symlink_list, node) + printf("%s/%s ", udev_root, name_loop->name); + else + list_for_each_entry(name_loop, &udev.symlink_list, node) + printf("%s ", name_loop->name); + printf("\n"); + goto exit; case PATH: - strfieldcpy(result, udev.devpath); - break; - + printf("%s\n", udev.devpath); + goto exit; case ALL: print_record(&udev); goto exit; - default: - goto exit; + goto help; } - printf("%s\n", result); - -exit: - return retval; } if (attributes) { if (path[0] == '\0') { printf("attribute walk on device chain needs path(-p) specified\n"); - return -EINVAL; + retval = 4; + goto exit; } else { if (strncmp(path, sysfs_path, strlen(sysfs_path)) != 0) { /* prepend sysfs mountpoint if not given */ @@ -371,13 +366,13 @@ exit: strfieldcat(path, temp); } print_device_chain(path); - return 0; + goto exit; } } if (root) { printf("%s\n", udev_root); - return 0; + goto exit; } help: @@ -398,20 +393,9 @@ help: " -V print udev version\n" " -h print this help text\n" "\n"); - return retval; -} - -int main(int argc, char *argv[], char *envp[]) -{ - int rc = 0; - - logging_init("udevinfo"); - - /* initialize our configuration */ - udev_init_config(); - - rc = process_options(argc, argv); +exit: + udev_cleanup_device(&udev); logging_close(); - exit(rc); + return retval; } -- cgit v1.2.3-54-g00ecf From 51015808dae77026ef6aae369be272289547fe72 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Mar 2005 05:39:19 +0100 Subject: [PATCH] udev-test.pl: remove useless tests --- test/udev-test.pl | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index f442b162ec..9699f2e8f5 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -776,29 +776,6 @@ EOF exp_rem_error => "yes", conf => < "symlink to empty name", - subsys => "block", - devpath => "/block/sda", - exp_name => "symlink", - exp_target => "", - exp_add_error => "yes", - conf => < "symlink and name empty", - subsys => "block", - devpath => "/block/sda", - exp_name => "", - exp_target => "", - exp_add_error => "yes", - exp_rem_error => "yes", - conf => < Date: Sat, 5 Mar 2005 06:50:09 +0100 Subject: [PATCH] replace weird defines by real code --- namedev.c | 39 +++++++++++++++++++++------------------ udev_add.c | 4 ++-- udev_remove.c | 4 ++-- udev_utils.h | 20 +------------------- 4 files changed, 26 insertions(+), 41 deletions(-) diff --git a/namedev.c b/namedev.c index 91841571c1..49f9e4b1f4 100644 --- a/namedev.c +++ b/namedev.c @@ -171,15 +171,10 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, { char temp[NAME_SIZE]; char temp2[NAME_SIZE]; - char *tail; - char *pos; - char *attr; + char *tail, *pos, *cpos, *attr, *rest; int len; int i; char c; - char *spos; - char *rest; - int slen; struct sysfs_attribute *tmpattr; unsigned int next_free_number; struct sysfs_class_device *class_dev_parent; @@ -217,12 +212,14 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("substitute kernel number '%s'", udev->kernel_number); break; case 'm': - strintcatmax(string, minor(udev->devt), maxsize); - dbg("substitute minor number '%u'", minor(udev->devt)); + sprintf(temp2, "%d", minor(udev->devt)); + strfieldcatmax(string, temp2, maxsize); + dbg("substitute minor number '%s'", temp2); break; case 'M': - strintcatmax(string, major(udev->devt), maxsize); - dbg("substitute major number '%u'", major(udev->devt)); + sprintf(temp2, "%d", major(udev->devt)); + strfieldcatmax(string, temp2, maxsize); + dbg("substitute major number '%s'", temp2); break; case 'c': if (udev->program_result[0] == '\0') @@ -232,19 +229,25 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, if (attr != NULL) i = strtoul(attr, &rest, 10); if (i > 0) { - foreach_strpart(udev->program_result, " \n\r", spos, slen) { - i--; - if (i == 0) - break; + dbg("request part #%d of result string", i); + cpos = udev->program_result; + while (--i) { + while (cpos[0] != '\0' && !isspace(cpos[0])) + cpos++; + while (isspace(cpos[0])) + cpos++; } if (i > 0) { dbg("requested part of result string not found"); break; } - if (rest[0] == '+') - strfieldcpy(temp2, spos); - else - strfieldcpymax(temp2, spos, slen+1); + strfieldcpy(temp2, cpos); + /* %{2+}c copies the whole string from the second part on */ + if (rest[0] != '+') { + cpos = strchr(temp2, ' '); + if (cpos) + cpos[0] = '\0'; + } strfieldcatmax(string, temp2, maxsize); dbg("substitute part of result string '%s'", temp2); } else { diff --git a/udev_add.c b/udev_add.c index 7e0c57fc63..aa19d874c3 100644 --- a/udev_add.c +++ b/udev_add.c @@ -185,8 +185,8 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de for (i = 1; i <= udev->partitions; i++) { dev_t part_devt; - strfieldcpy(partitionname, filename); - strintcat(partitionname, i); + snprintf(partitionname, NAME_SIZE, "%s%d", filename, i); + partitionname[NAME_SIZE-1] = '\0'; part_devt = makedev(major(udev->devt), minor(udev->devt)+1); udev_make_node(udev, partitionname, part_devt, udev->mode, uid, gid); } diff --git a/udev_remove.c b/udev_remove.c index 756eef0476..7a6c032d01 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -103,8 +103,8 @@ static int delete_node(struct udevice *udev) return -1; } for (i = 1; i <= num; i++) { - strfieldcpy(partitionname, filename); - strintcat(partitionname, i); + snprintf(partitionname, NAME_SIZE, "%s%d", filename, i); + partitionname[NAME_SIZE-1] = '\0'; unlink_secure(partitionname); } } diff --git a/udev_utils.h b/udev_utils.h index 2f2c2497cb..3bb1b25362 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -48,24 +48,6 @@ do { \ strncat(to, from, maxsize - strlen(to)-1); \ } while (0) -#define strintcat(to, i) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - snprintf((to) + strlen(to), sizeof(to) - strlen(to)-1, "%u", i); \ -} while (0) - -#define strintcatmax(to, i, maxsize) \ -do { \ - to[maxsize-1] = '\0'; \ - snprintf((to) + strlen(to), maxsize - strlen(to)-1, "%u", i); \ -} while (0) - -#define foreach_strpart(str, separator, pos, len) \ - for(pos = str, len = 0; \ - (pos) < ((str) + strlen(str)); \ - pos = pos + len + strspn(pos, separator), len = strcspn(pos, separator)) \ - if (len > 0) - #ifdef asmlinkage # undef asmlinkage #endif @@ -73,7 +55,7 @@ do { \ # define asmlinkage __attribute__((regparm(0))) #endif #ifndef asmlinkage -# define asmlinkage /* nothing */ +# define asmlinkage #endif struct name_entry { -- cgit v1.2.3-54-g00ecf From 733677e2c21b1ea3789c5296c84c1730d9ce498d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Mar 2005 07:16:21 +0100 Subject: [PATCH] klibc_fixups: remove unneeded stuff --- Makefile | 1 - klibc_fixups/malloc.h | 9 --------- klibc_fixups/mntent.h | 39 --------------------------------------- libsysfs/dlist.c | 1 + libsysfs/dlist.h | 5 +++-- libsysfs/sysfs.h | 1 - 6 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 klibc_fixups/malloc.h delete mode 100644 klibc_fixups/mntent.h diff --git a/Makefile b/Makefile index 99a7618795..7c159b3d31 100644 --- a/Makefile +++ b/Makefile @@ -202,7 +202,6 @@ ifeq ($(strip $(USE_KLIBC)),true) HEADERS += \ klibc_fixups/klibc_fixups.h \ - klibc_fixups/mntent.h \ klibc_fixups/pwd.h KLIBC_FIXUP_OBJS = \ diff --git a/klibc_fixups/malloc.h b/klibc_fixups/malloc.h deleted file mode 100644 index 439608e3c4..0000000000 --- a/klibc_fixups/malloc.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifdef __KLIBC__ - -#ifndef _MALLOC_H -#define _MALLOC_H - -#include - -#endif /* _MALLOC_H */ -#endif /* __KLIBC__ */ diff --git a/klibc_fixups/mntent.h b/klibc_fixups/mntent.h deleted file mode 100644 index ea79a2dd63..0000000000 --- a/klibc_fixups/mntent.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifdef __KLIBC__ - -#ifndef _MNTENT_H -#define _MNTENT_H - -#include - -struct mntent -{ - char *mnt_fsname; - char *mnt_dir; - char *mnt_type; - char *mnt_opts; - int mnt_freq; - int mnt_passno; -}; - -static inline FILE *setmntent (const char *file, const char *mode) -{ - return (FILE *) 1; -} - -static inline struct mntent *getmntent (FILE *stream) -{ - static struct mntent mntent = { - .mnt_dir = "/sys", - .mnt_type = "sysfs" - }; - - return &mntent; -} - -static inline int endmntent (FILE *stream) -{ - return 0; -} - -#endif /* _MNTENT_H */ -#endif /* __KLIBC__ */ diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c index c4ee324573..c44e9d5ff5 100644 --- a/libsysfs/dlist.c +++ b/libsysfs/dlist.c @@ -27,6 +27,7 @@ * delete function. Otherwise dlist will just use free. */ +#include "stdlib.h" #include "dlist.h" /* diff --git a/libsysfs/dlist.h b/libsysfs/dlist.h index 9e3a6c96de..62eaa9fec4 100644 --- a/libsysfs/dlist.h +++ b/libsysfs/dlist.h @@ -50,9 +50,10 @@ * Just use the dlist_(insert|delete)_(before|after) macros if you do not want * to think about it. - */ -#include + +#include + typedef struct dl_node { struct dl_node *prev; struct dl_node *next; diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 30bd9b4089..838427797d 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include -- cgit v1.2.3-54-g00ecf From fa548924d4bf723a310e040feaba3f417757de8a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Mar 2005 07:36:51 +0100 Subject: [PATCH] klibc: version 0.211 --- klibc/MCONFIG | 9 +++++++- klibc/Makefile | 26 +++++++++++---------- klibc/include/arch/sparc/klibc/archsignal.h | 27 +++++++++++++++++++++- klibc/include/sys/times.h | 4 ++-- klibc/klcc.in | 14 +++++------ klibc/klibc.spec.in | 36 ++++++++++++++++++++++++----- klibc/klibc/Makefile | 2 +- klibc/klibc/SYSCALLS.def | 8 ++++--- klibc/klibc/arch/i386/MCONFIG | 10 ++++---- klibc/klibc/arch/i386/crt0.S | 2 +- klibc/klibc/arch/i386/exits.S | 2 +- klibc/klibc/arch/i386/libgcc/__ashldi3.S | 2 +- klibc/klibc/arch/i386/libgcc/__ashrdi3.S | 2 +- klibc/klibc/arch/i386/libgcc/__lshrdi3.S | 2 +- klibc/klibc/arch/i386/libgcc/__muldi3.S | 2 +- klibc/klibc/arch/i386/libgcc/__negdi2.S | 2 +- klibc/klibc/arch/i386/open.S | 2 +- klibc/klibc/arch/i386/setjmp.S | 4 ++-- klibc/klibc/arch/i386/syscall.S | 4 ++-- klibc/klibc/arch/i386/sysstub.ph | 2 +- klibc/klibc/arch/x86_64/MCONFIG | 3 +++ klibc/klibc/open.c | 3 ++- klibc/klibc/sigaction.c | 2 +- klibc/version | 2 +- 24 files changed, 118 insertions(+), 54 deletions(-) diff --git a/klibc/MCONFIG b/klibc/MCONFIG index a7b2cb1bf3..c833499483 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -3,6 +3,14 @@ # Makefile configuration, without explicit rules # +# CROSS is the prefix used for system tools like gcc, ld etc. +CROSS = + +# KCROSS is the prefix we use for klibc installations. This is usually +# the same as CROSS, but may be different, e.g. to install an i386 +# cross-compilation suite on an x86-64 system, using the same gcc/binutils. +KCROSS ?= $(CROSS) + # Location for installation prefix = /usr bindir = $(prefix)/bin @@ -22,7 +30,6 @@ KRNLSRC = $(SRCROOT)/linux KRNLOBJ = $(SRCROOT)/linux ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) -CROSS = CC = $(CROSS)gcc LD = $(CROSS)ld KLIBSRC = $(SRCROOT)/klibc diff --git a/klibc/Makefile b/klibc/Makefile index eb8f55570d..812ea92f47 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -17,6 +17,7 @@ $(CROSS)klibc.config: Makefile rm -f $@ echo 'ARCH=$(ARCH)' >> $@ echo 'CROSS=$(CROSS)' >> $@ + echo 'KCROSS=$(KCROSS)' >> $@ echo "CC=$(shell bash -c 'type -p $(CC)')" >> $@ echo "LD=$(shell bash -c 'type -p $(LD)')" >> $@ echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@ @@ -49,19 +50,20 @@ local-install: $(CROSS)klcc mkdir -p $(INSTALLROOT)$(mandir)/man1 mkdir -p $(INSTALLROOT)$(SHLIBDIR) mkdir -p $(INSTALLROOT)$(INSTALLDIR) - -rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)bin - set -xe ; for d in linux asm asm-generic ; do \ + -rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin + set -xe ; for d in linux asm-$(ARCH) asm-generic $(ASMARCH); do \ mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \ - cp -rfL $(KRNLSRC)/include/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ - cp -rfL $(KRNLOBJ)/include/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ - [ ! -d $(KRNLOBJ)/include2/$$d ] || \ - cp -rfL $(KRNLOBJ)/include2/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d/. ; \ + for r in $(KRNLSRC)/include $(KRNLOBJ)/include $(KRNLOBJ)/include2 ; do \ + [ ! -d $$r/$$d ] || \ + cp -rfL $$r/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \ + done ; \ done - cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/. - $(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(CROSS)klcc.1 - $(INSTALL_EXEC) $(CROSS)klcc $(INSTALLROOT)$(bindir) + cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(ARCH) asm + cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. + $(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 + $(INSTALL_EXEC) $(KCROSS)klcc $(INSTALLROOT)$(bindir) -include MCONFIG diff --git a/klibc/include/arch/sparc/klibc/archsignal.h b/klibc/include/arch/sparc/klibc/archsignal.h index 6af3709033..3be67a2158 100644 --- a/klibc/include/arch/sparc/klibc/archsignal.h +++ b/klibc/include/arch/sparc/klibc/archsignal.h @@ -8,6 +8,31 @@ #ifndef _KLIBC_ARCHSIGNAL_H #define _KLIBC_ARCHSIGNAL_H -/* No special stuff for this architecture */ +/* Hidden definitions */ + +struct __new_sigaction { + __sighandler_t sa_handler; + unsigned long sa_flags; + void (*sa_restorer)(void); /* Not used by Linux/SPARC */ + __new_sigset_t sa_mask; +}; + +struct k_sigaction { + struct __new_sigaction sa; + void __user *ka_restorer; +}; + +struct __old_sigaction { + __sighandler_t sa_handler; + __old_sigset_t sa_mask; + unsigned long sa_flags; + void (*sa_restorer) (void); /* not used by Linux/SPARC */ +}; + +typedef struct sigaltstack { + void __user *ss_sp; + int ss_flags; + size_t ss_size; +} stack_t; #endif diff --git a/klibc/include/sys/times.h b/klibc/include/sys/times.h index 657f9c4b1c..dd86531669 100644 --- a/klibc/include/sys/times.h +++ b/klibc/include/sys/times.h @@ -5,10 +5,10 @@ #ifndef _SYS_TIMES_H #define _SYS_TIMES_H +#include +#include #include __extern clock_t times(struct tms *); -__extern int gettimeofday(struct timeval *, struct timezone *); -__extern int settimeofday(const struct timeval *, const struct timezone *); #endif /* _SYS_TIMES_H */ diff --git a/klibc/klcc.in b/klibc/klcc.in index 713843c37c..bdd03e73b3 100644 --- a/klibc/klcc.in +++ b/klibc/klcc.in @@ -1,19 +1,19 @@ # -*- perl -*- # Standard includes -@includes = ("-I${INSTALLDIR}/${CROSS}include/arch/${ARCH}", - "-I${INSTALLDIR}/${CROSS}include/bits${BITSIZE}", - "-I${INSTALLDIR}/${CROSS}include"); +@includes = ("-I${INSTALLDIR}/${KCROSS}include/arch/${ARCH}", + "-I${INSTALLDIR}/${KCROSS}include/bits${BITSIZE}", + "-I${INSTALLDIR}/${KCROSS}include"); # Default optimization options (for compiles without -g) @optopt = @OPTFLAGS; @goptopt = ('-O'); # Options and libraries to pass to ld; shared versus static -@staticopt = ("$INSTALLDIR/${CROSS}lib/crt0.o"); -@staticlib = ("$INSTALLDIR/${CROSS}lib/libc.a"); -@sharedopt = (@EMAIN, "$INSTALLDIR/${CROSS}lib/interp.o"); -@sharedlib = ('-R', "$INSTALLDIR/lib/${CROSS}libc.so"); +@staticopt = ("$INSTALLDIR/${KCROSS}lib/crt0.o"); +@staticlib = ("$INSTALLDIR/${KCROSS}lib/libc.a"); +@sharedopt = (@EMAIN, "$INSTALLDIR/${KCROSS}lib/interp.o"); +@sharedlib = ('-R', "$INSTALLDIR/${KCROSS}lib/libc.so"); # Returns the language (-x option string) for a specific extension. sub filename2lang($) { diff --git a/klibc/klibc.spec.in b/klibc/klibc.spec.in index 237771532a..cab496b917 100644 --- a/klibc/klibc.spec.in +++ b/klibc/klibc.spec.in @@ -19,13 +19,21 @@ Vendor: Starving Linux Artists %description %{name} is intended to be a minimalistic libc subset for use with initramfs. It is deliberately written for small size, minimal -entanglement, and portability, not speed. It is definitely a work in -progress, and a lot of things are still missing. +entanglement, and portability, not speed. + +%package devel +Summary: Libraries and tools needed to compile applications against klibc. +Group: Development/Libraries +Requires: klibc = %{version}-%{release} + +%description devel +This package contains the link libraries, header files, and gcc +wrapper scripts needed to compile applications against klibc. %package utils Summary: Small utilities built with klibc. Group: Utilities/System -Requires: klibc = %{version} +Requires: klibc = %{version}-%{release} %description utils This package contains a collection of programs that are linked against @@ -62,8 +70,11 @@ make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} \ install -# Install the docs +# Make the .so file in /lib a hardlink (they will be expanded as two +# files automatically if it crosses filesystems when extracted.) +ln -f %{buildroot}%{klibcdir}/lib/klibc-*.so %{buildroot}/lib +# Install the docs mkdir -p %{buildroot}%{bindocdir} %{buildroot}%{libdocdir} install -m 444 README %{buildroot}%{libdocdir} install -m 444 klibc/README %{buildroot}%{libdocdir}/README.klibc @@ -77,12 +88,25 @@ install -m 444 kinit/README %{buildroot}%{bindocdir}/README.kinit %clean rm -rf $RPM_BUILD_ROOT +# +# Note: libc.so and interp.o are technically -devel files, but +# put them in this package until we can make really, really sure +# the dependency system can avoid confusion. (In fact, it would be +# good to eventually get them out of here, so that multiple runtimes +# can be installed should it be necessary.) +# %files %defattr(-,root,root,-) -%{klibcdir}/lib +/lib/klibc-*.so +%{klibcdir}/lib/*.so +%{klibcdir}/lib/interp.o + +%files devel +%defattr(-,root,root,-) %{klibcdir}/include +%{klibcdir}/lib/*.a +%{klibcdir}/lib/crt0.o %{_bindir}/klcc -/lib/klibc-*.so %doc %{_mandir}/man1/* %doc %{libdocdir}/* diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index a9aedc58f0..c412a9ffea 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -116,7 +116,7 @@ $(SOLIB).hash: $(SOLIB) sha1hash $(SOHASH): $(SOLIB) $(SOLIB).hash cp -f $(SOLIB) $@ - $(STRIP) $@ + $(STRIPCMD) $@ rm -f klibc-??????????????????????.so ln -f $@ klibc-`cat $(SOLIB).hash`.so diff --git a/klibc/klibc/SYSCALLS.def b/klibc/klibc/SYSCALLS.def index 3918bcb012..e8b9a7f176 100644 --- a/klibc/klibc/SYSCALLS.def +++ b/klibc/klibc/SYSCALLS.def @@ -146,13 +146,15 @@ ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t) ; Signal operations ; int kill(pid_t, int) +; We really should get rid of the non-rt_* of these, but that takes +; sanitizing for all architectures, sigh... int sigaction(int, const struct sigaction *, struct sigaction *) -int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) int sigsuspend(const sigset_t *) + int sigpending(sigset_t *) + int sigprocmask(int, const sigset_t *, sigset_t *) +int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) int rt_sigsuspend(const sigset_t *, size_t) - int sigpending(sigset_t) int rt_sigpending(sigset_t *, size_t) - int sigprocmask(int, const sigset_t *, sigset_t *) int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t) unsigned int alarm(unsigned int) int getitimer(int, struct itimerval *) diff --git a/klibc/klibc/arch/i386/MCONFIG b/klibc/klibc/arch/i386/MCONFIG index 8310e26381..ecd1307d7f 100644 --- a/klibc/klibc/arch/i386/MCONFIG +++ b/klibc/klibc/arch/i386/MCONFIG @@ -8,16 +8,16 @@ # # Enable this to compile with register parameters; only safe for -# gcc > 3 -REGPARM_OPT := -mregparm=3 -DREGPARM=3 +# gcc >= 3 +REGPARM_OPT := -mregparm=3 -D_REGPARM=3 gcc_major := $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1) -OPTFLAGS = -march=i386 -Os -g +OPTFLAGS = -march=i386 -Os -g -fomit-frame-pointer LDFLAGS = -m elf_i386 -ifneq ($(shell if [ $(gcc_major) -gt 2 ] ; then echo "new"; fi ;),) -REGPARM := $(REGPARM_OPT) +ifneq ($(gcc_major),2) +REQFLAGS += $(REGPARM_OPT) OPTFLAGS += -falign-functions=0 -falign-jumps=0 -falign-loops=0 ARCHREQFLAGS += -m32 else diff --git a/klibc/klibc/arch/i386/crt0.S b/klibc/klibc/arch/i386/crt0.S index 0f3a7db35e..fb02c694c0 100644 --- a/klibc/klibc/arch/i386/crt0.S +++ b/klibc/klibc/arch/i386/crt0.S @@ -20,7 +20,7 @@ _start: push %ebp # Keep gdb from getting confused push %ebp # Keep gdb from getting confused # Push the arguments and called __libc_init() -#ifndef REGPARM +#ifndef _REGPARM push %edx # atexit() function push %eax # ELF array #endif diff --git a/klibc/klibc/arch/i386/exits.S b/klibc/klibc/arch/i386/exits.S index 59ff563ad8..ed23d98bcb 100644 --- a/klibc/klibc/arch/i386/exits.S +++ b/klibc/klibc/arch/i386/exits.S @@ -28,7 +28,7 @@ exit: .globl _exit .type _exit,@function _exit: -#ifdef REGPARM +#ifdef _REGPARM movl %eax,%ebx #else popl %ebx diff --git a/klibc/klibc/arch/i386/libgcc/__ashldi3.S b/klibc/klibc/arch/i386/libgcc/__ashldi3.S index 80ed4be3cf..61982eb0eb 100644 --- a/klibc/klibc/arch/i386/libgcc/__ashldi3.S +++ b/klibc/klibc/arch/i386/libgcc/__ashldi3.S @@ -8,7 +8,7 @@ .globl __ashldi3 .type __ashldi3,@function __ashldi3: -#ifndef REGPARM +#ifndef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx movb 12(%esp),%cl diff --git a/klibc/klibc/arch/i386/libgcc/__ashrdi3.S b/klibc/klibc/arch/i386/libgcc/__ashrdi3.S index ba43f9022a..4ac2af69a1 100644 --- a/klibc/klibc/arch/i386/libgcc/__ashrdi3.S +++ b/klibc/klibc/arch/i386/libgcc/__ashrdi3.S @@ -8,7 +8,7 @@ .globl __ashrdi3 .type __ashrdi3,@function __ashrdi3: -#ifndef REGPARM +#ifndef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx movb 12(%esp),%cl diff --git a/klibc/klibc/arch/i386/libgcc/__lshrdi3.S b/klibc/klibc/arch/i386/libgcc/__lshrdi3.S index 6e521ace2c..730ee43178 100644 --- a/klibc/klibc/arch/i386/libgcc/__lshrdi3.S +++ b/klibc/klibc/arch/i386/libgcc/__lshrdi3.S @@ -8,7 +8,7 @@ .globl __lshrdi3 .type __lshrdi3,@function __lshrdi3: -#ifndef REGPARM +#ifndef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx movb 12(%esp),%cl diff --git a/klibc/klibc/arch/i386/libgcc/__muldi3.S b/klibc/klibc/arch/i386/libgcc/__muldi3.S index c164588b16..81e23b190e 100644 --- a/klibc/klibc/arch/i386/libgcc/__muldi3.S +++ b/klibc/klibc/arch/i386/libgcc/__muldi3.S @@ -10,7 +10,7 @@ .type __muldi3,@function __muldi3: push %esi -#ifndef REGPARM +#ifndef _REGPARM movl 8(%esp),%eax movl %eax,%esi movl 16(%esp),%ecx diff --git a/klibc/klibc/arch/i386/libgcc/__negdi2.S b/klibc/klibc/arch/i386/libgcc/__negdi2.S index 6c95cb235c..c4f2cd517e 100644 --- a/klibc/klibc/arch/i386/libgcc/__negdi2.S +++ b/klibc/klibc/arch/i386/libgcc/__negdi2.S @@ -9,7 +9,7 @@ .globl __negdi2 .type __negdi2,@function __negdi2: -#ifndef REGPARM +#ifndef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx #endif diff --git a/klibc/klibc/arch/i386/open.S b/klibc/klibc/arch/i386/open.S index 4f492a1566..54dd6151d1 100644 --- a/klibc/klibc/arch/i386/open.S +++ b/klibc/klibc/arch/i386/open.S @@ -15,7 +15,7 @@ .type open,@function open: -#ifdef REGPARM +#ifdef _REGPARM movl 4(%esp),%eax movl 8(%esp),%edx movl 12(%esp),%ecx diff --git a/klibc/klibc/arch/i386/setjmp.S b/klibc/klibc/arch/i386/setjmp.S index bea900c519..2f3033f5bd 100644 --- a/klibc/klibc/arch/i386/setjmp.S +++ b/klibc/klibc/arch/i386/setjmp.S @@ -19,7 +19,7 @@ .globl setjmp .type setjmp, @function setjmp: -#ifdef REGPARM +#ifdef _REGPARM movl %eax,%edx #else movl 4(%esp),%edx @@ -42,7 +42,7 @@ setjmp: .globl longjmp .type longjmp, @function longjmp: -#ifdef REGPARM +#ifdef _REGPARM xchgl %eax,%edx #else movl 4(%esp),%edx # jmp_ptr address diff --git a/klibc/klibc/arch/i386/syscall.S b/klibc/klibc/arch/i386/syscall.S index f8fa7b4dd3..0634e8208a 100644 --- a/klibc/klibc/arch/i386/syscall.S +++ b/klibc/klibc/arch/i386/syscall.S @@ -14,7 +14,7 @@ .globl __syscall_common .type __syscall_common,@function __syscall_common: -#ifdef REGPARM +#ifdef _REGPARM xchgl %ebx,(%esp) #else popl %eax @@ -24,7 +24,7 @@ __syscall_common: pushl %edi pushl %ebp -#ifdef REGPARM +#ifdef _REGPARM xchgl %eax,%ebx xchgl %ecx,%edx movl ARG(0),%esi diff --git a/klibc/klibc/arch/i386/sysstub.ph b/klibc/klibc/arch/i386/sysstub.ph index eaa8180911..1ba7f36bac 100644 --- a/klibc/klibc/arch/i386/sysstub.ph +++ b/klibc/klibc/arch/i386/sysstub.ph @@ -16,7 +16,7 @@ sub make_sysstub($$$$@) { print OUT "${fname}:\n"; if ( $stype eq 'varadic' ) { - print OUT "#ifdef REGPARM\n"; + print OUT "#ifdef _REGPARM\n"; print OUT "\tmovl 4(%esp),%eax\n"; print OUT "\tmovl 8(%esp),%edx\n"; print OUT "\tmovl 12(%esp),%ecx\n"; diff --git a/klibc/klibc/arch/x86_64/MCONFIG b/klibc/klibc/arch/x86_64/MCONFIG index a2a2367633..13b6e391f9 100644 --- a/klibc/klibc/arch/x86_64/MCONFIG +++ b/klibc/klibc/arch/x86_64/MCONFIG @@ -26,3 +26,6 @@ LDFLAGS = -m elf_x86_64 # 2 MB - normal binaries start at 4 MB SHAREDFLAGS = -Ttext 0x00200200 +# Additional asm- directories needed during installation +ASMARCH = asm-i386 + diff --git a/klibc/klibc/open.c b/klibc/klibc/open.c index d52b53a699..cb1f5195db 100644 --- a/klibc/klibc/open.c +++ b/klibc/klibc/open.c @@ -8,8 +8,9 @@ #define _KLIBC_IN_OPEN_C #include #include +#include -#if BITSIZE == 32 && !defined(__i386__) +#if _BITSIZE == 32 && !defined(__i386__) extern int __open(const char *, int, mode_t); diff --git a/klibc/klibc/sigaction.c b/klibc/klibc/sigaction.c index 885bc6a4a4..819ffd4fe8 100644 --- a/klibc/klibc/sigaction.c +++ b/klibc/klibc/sigaction.c @@ -5,7 +5,7 @@ #include #include -#if !defined(__NR_sigaction) +#ifndef __NR_sigaction int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) { diff --git a/klibc/version b/klibc/version index 58be07ab5e..1f39702100 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.205 +0.211 -- cgit v1.2.3-54-g00ecf From 599e17a3e6678eecfd12874cbd35698591df068d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Mar 2005 11:55:59 +0100 Subject: [PATCH] udevinfo -d: speed-up device dump --- udev_db.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++---------- udev_db.h | 2 +- udevinfo.c | 6 +++--- 3 files changed, 52 insertions(+), 14 deletions(-) diff --git a/udev_db.c b/udev_db.c index 1015d21221..c12e88c3c4 100644 --- a/udev_db.c +++ b/udev_db.c @@ -188,9 +188,7 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) int udev_db_search_name(char *devpath, size_t len, const char *name) { - struct dirent *ent; DIR *dir; - char filename[NAME_SIZE]; dir = opendir(udev_db_path); if (dir == NULL) { @@ -199,6 +197,8 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) } while (1) { + struct dirent *ent; + char filename[NAME_SIZE]; char path[DEVPATH_SIZE]; char nodename[NAME_SIZE]; char *bufline; @@ -262,12 +262,9 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) return -1; } -int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)) +int udev_db_dump_names(int (*handler_function)(const char *path, const char *name)) { - struct dirent *ent; DIR *dir; - char filename[NAME_SIZE]; - struct udevice db_udev; dir = opendir(udev_db_path); if (dir == NULL) { @@ -276,6 +273,16 @@ int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)) } while (1) { + struct dirent *ent; + char filename[NAME_SIZE]; + char path[DEVPATH_SIZE]; + char nodename[NAME_SIZE]; + char *bufline; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') break; @@ -285,14 +292,45 @@ int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)) snprintf(filename, NAME_SIZE, "%s/%s", udev_db_path, ent->d_name); filename[NAME_SIZE-1] = '\0'; + dbg("looking at '%s'", filename); + + if (file_map(filename, &buf, &bufsize) != 0) { + dbg("unable to read db file '%s'", filename); + continue; + } - dbg("found '%s'", filename); + path[0] = '\0'; + nodename[0] = '\0'; + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; - udev_init_device(&db_udev, NULL, NULL); - if (parse_db_file(&db_udev, filename) == 0) { - if (handler_function(&db_udev) != 0) + switch(bufline[0]) { + case 'P': + if (count > DEVPATH_SIZE) + count = DEVPATH_SIZE-1; + strncpy(path, &bufline[2], count-2); + path[count-2] = '\0'; break; + case 'N': + if (count > NAME_SIZE) + count = NAME_SIZE-1; + strncpy(nodename, &bufline[2], count-2); + nodename[count-2] = '\0'; + break; + default: + continue; + } } + file_unmap(buf, bufsize); + + if (path[0] == '\0' || nodename[0] == '\0') + continue; + + if (handler_function(path, nodename) != 0) + break; } closedir(dir); diff --git a/udev_db.h b/udev_db.h index 8840142fe3..9420981944 100644 --- a/udev_db.h +++ b/udev_db.h @@ -30,6 +30,6 @@ extern int udev_db_delete_device(struct udevice *dev); extern int udev_db_get_device(struct udevice *udev, const char *devpath); extern int udev_db_search_name(char *devpath, size_t len, const char *name); -extern int udev_db_call_foreach(int (*handler_function)(struct udevice *udev)); +extern int udev_db_dump_names(int (*handler_function)(const char *path, const char *name)); #endif /* _UDEV_DB_H_ */ diff --git a/udevinfo.c b/udevinfo.c index 6dfb918de5..b2d22e984e 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -181,8 +181,8 @@ exit: return retval; } -static int print_dump(struct udevice *udev) { - printf("%s:%s/%s\n", udev->devpath, udev_root, udev->name); +static int print_dump(const char *devpath, const char *name) { + printf("%s:%s/%s\n", devpath, udev_root, name); return 0; } @@ -260,7 +260,7 @@ int main(int argc, char *argv[], char *envp[]) break; case 'd': - udev_db_call_foreach(print_dump); + udev_db_dump_names(print_dump); goto exit; case 'V': -- cgit v1.2.3-54-g00ecf From 9bad6028f738e78b69d18947d586dce7b9267785 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Mar 2005 22:26:15 +0100 Subject: [PATCH] fix up segfaulting binaries with new klibc --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7c159b3d31..ac60ade52a 100644 --- a/Makefile +++ b/Makefile @@ -188,7 +188,7 @@ ifeq ($(strip $(USE_KLIBC)),true) CRT0 = $(KLIBC_DIR)/crt0.o LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) CFLAGS += $(WARNINGS) -nostdinc \ - $(OPTFLAGS) \ + $(OPTFLAGS) $(REQFLAGS) \ -D__KLIBC__ -fno-builtin-printf \ -I$(KLIBC_FIXUPS_DIR) \ -include $(KLIBC_FIXUPS_DIR)/klibc_fixups.h \ -- cgit v1.2.3-54-g00ecf From 915a12adc2ea28dc2391788c66b829caefefcfb4 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 5 Mar 2005 22:41:00 +0100 Subject: [PATCH] use numeric owner/group as default values to avoid parsing userdb --- udev_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_utils.c b/udev_utils.c index 60f5ad859a..145f02b5e1 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -84,8 +84,8 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs } udev->mode = 0660; - strcpy(udev->owner, "root"); - strcpy(udev->group, "root"); + strcpy(udev->owner, "0"); + strcpy(udev->group, "0"); return 0; } -- cgit v1.2.3-54-g00ecf From 30c6b4c9a22edc76b2e8335edbdf157dd51241eb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 6 Mar 2005 02:02:45 +0100 Subject: [PATCH] udev_volume_id: volume_id v38 --- extras/volume_id/volume_id/luks.c | 77 +++++++++++++++------------------- extras/volume_id/volume_id/util.c | 9 ++++ extras/volume_id/volume_id/util.h | 1 + extras/volume_id/volume_id/volume_id.c | 3 +- extras/volume_id/volume_id/volume_id.h | 8 ++-- 5 files changed, 48 insertions(+), 50 deletions(-) diff --git a/extras/volume_id/volume_id/luks.c b/extras/volume_id/volume_id/luks.c index 2001692731..a00bf4041b 100644 --- a/extras/volume_id/volume_id/luks.c +++ b/extras/volume_id/volume_id/luks.c @@ -26,7 +26,6 @@ # include #endif -#include #include #include #include @@ -40,58 +39,47 @@ #include "logging.h" #include "luks.h" -/* from cryptsetup-luks internal.h */ -#define SECTOR_SHIFT 9 -#define SECTOR_SIZE (1 << SECTOR_SHIFT) +#define SECTOR_SHIFT 9 +#define SECTOR_SIZE (1 << SECTOR_SHIFT) -/* from cryptsetup-luks luks.h */ -#define LUKS_CIPHERNAME_L 32 -#define LUKS_CIPHERMODE_L 32 -#define LUKS_HASHSPEC_L 32 -#define LUKS_DIGESTSIZE 20 /* since SHA1 */ -#define LUKS_SALTSIZE 32 -#define LUKS_NUMKEYS 8 +#define LUKS_CIPHERNAME_L 32 +#define LUKS_CIPHERMODE_L 32 +#define LUKS_HASHSPEC_L 32 +#define LUKS_DIGESTSIZE 20 +#define LUKS_SALTSIZE 32 +#define LUKS_NUMKEYS 8 -/* from cryptsetup-luks luks.h */ -const unsigned char LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; +const __u8 LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; #define LUKS_MAGIC_L 6 - -/* from cryptsetup-luks luks.h */ #define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) - -/* from cryptsetup-luks luks.h */ #define UUID_STRING_L 40 +struct luks_phdr { + __u8 magic[LUKS_MAGIC_L]; + __u16 version; + __u8 cipherName[LUKS_CIPHERNAME_L]; + __u8 cipherMode[LUKS_CIPHERMODE_L]; + __u8 hashSpec[LUKS_HASHSPEC_L]; + __u32 payloadOffset; + __u32 keyBytes; + __u8 mkDigest[LUKS_DIGESTSIZE]; + __u8 mkDigestSalt[LUKS_SALTSIZE]; + __u32 mkDigestIterations; + __u8 uuid[UUID_STRING_L]; + struct { + __u32 active; + __u32 passwordIterations; + __u8 passwordSalt[LUKS_SALTSIZE]; + __u32 keyMaterialOffset; + __u32 stripes; + } keyblock[LUKS_NUMKEYS]; +}; + int volume_id_probe_luks(struct volume_id *id, __u64 off) { - /* from cryptsetup-luks luks.h */ - struct luks_phdr { - char magic[LUKS_MAGIC_L]; - uint16_t version; - char cipherName[LUKS_CIPHERNAME_L]; - char cipherMode[LUKS_CIPHERMODE_L]; - char hashSpec[LUKS_HASHSPEC_L]; - uint32_t payloadOffset; - uint32_t keyBytes; - char mkDigest[LUKS_DIGESTSIZE]; - char mkDigestSalt[LUKS_SALTSIZE]; - uint32_t mkDigestIterations; - char uuid[UUID_STRING_L]; - struct { - uint32_t active; - - /* parameters used for password processing */ - uint32_t passwordIterations; - char passwordSalt[LUKS_SALTSIZE]; - - /* parameters used for AF store/load */ - uint32_t keyMaterialOffset; - uint32_t stripes; - } keyblock[LUKS_NUMKEYS]; - } *header; + struct luks_phdr *header; header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE); - if (header == NULL) return -1; @@ -99,7 +87,8 @@ int volume_id_probe_luks(struct volume_id *id, __u64 off) return -1; volume_id_set_usage(id, VOLUME_ID_CRYPTO); - volume_id_set_uuid(id, header->uuid, UUID_DCE); + volume_id_set_uuid(id, header->uuid, UUID_DCE_STRING); + id->type = "crypto_LUKS"; return 0; diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 6159a59928..6ae4d09927 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -138,8 +138,13 @@ void volume_id_set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format break; case UUID_DCE: count = 16; + break; + case UUID_DCE_STRING: + count = 36; + break; } memcpy(id->uuid_raw, buf, count); + id->uuid_raw_len = count; /* if set, create string in the same format, the native platform uses */ for (i = 0; i < count; i++) @@ -172,6 +177,10 @@ set: buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); break; + case UUID_DCE_STRING: + memcpy(id->uuid, buf, count); + id->uuid[count] = '\0'; + break; } } diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h index 22fd1b94e2..0357b42062 100644 --- a/extras/volume_id/volume_id/util.h +++ b/extras/volume_id/volume_id/util.h @@ -71,6 +71,7 @@ #endif enum uuid_format { + UUID_DCE_STRING, UUID_DCE, UUID_DOS, UUID_NTFS, diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index f93cc91161..7a08be89d9 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -51,8 +51,8 @@ #include "ntfs.h" #include "iso9660.h" #include "udf.h" -#include "luks.h" #include "highpoint.h" +#include "luks.h" #include "linux_swap.h" #include "linux_raid.h" #include "lvm.h" @@ -60,7 +60,6 @@ #include "hpfs.h" #include "romfs.h" #include "sysv.h" -#include "luks.h" #include "mac.h" #include "msdos.h" diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 8fe4c3a5e5..22bb3ea487 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,11 +21,10 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 36 +#define VOLUME_ID_VERSION 38 #define VOLUME_ID_LABEL_SIZE 64 -#define VOLUME_ID_UUID_SIZE 16 -#define VOLUME_ID_UUID_STRING_SIZE 37 +#define VOLUME_ID_UUID_SIZE 36 #define VOLUME_ID_FORMAT_SIZE 32 #define VOLUME_ID_PATH_MAX 256 #define VOLUME_ID_PARTITIONS_MAX 256 @@ -55,7 +54,8 @@ struct volume_id { unsigned int label_raw_len; char label[VOLUME_ID_LABEL_SIZE+1]; unsigned char uuid_raw[VOLUME_ID_UUID_SIZE]; - char uuid[VOLUME_ID_UUID_STRING_SIZE]; + unsigned int uuid_raw_len; + char uuid[VOLUME_ID_UUID_SIZE+1]; enum volume_id_usage usage_id; char *usage; char *type; -- cgit v1.2.3-54-g00ecf From 5f335ca4afaa189799225f856f3af8b3d9fd2e1c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 6 Mar 2005 02:09:30 +0100 Subject: [PATCH] klibc_fixups: remove no longer needed stuff --- Makefile | 2 -- klibc_fixups/klibc_fixups.h | 24 ------------------------ libsysfs/sysfs_dir.c | 2 +- 3 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 klibc_fixups/klibc_fixups.h diff --git a/Makefile b/Makefile index ac60ade52a..8184620a2d 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,6 @@ ifeq ($(strip $(USE_KLIBC)),true) $(OPTFLAGS) $(REQFLAGS) \ -D__KLIBC__ -fno-builtin-printf \ -I$(KLIBC_FIXUPS_DIR) \ - -include $(KLIBC_FIXUPS_DIR)/klibc_fixups.h \ -I$(INCLUDE_DIR) \ -I$(INCLUDE_DIR)/arch/$(ARCH) \ -I$(INCLUDE_DIR)/bits$(BITSIZE) \ @@ -201,7 +200,6 @@ ifeq ($(strip $(USE_KLIBC)),true) LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs HEADERS += \ - klibc_fixups/klibc_fixups.h \ klibc_fixups/pwd.h KLIBC_FIXUP_OBJS = \ diff --git a/klibc_fixups/klibc_fixups.h b/klibc_fixups/klibc_fixups.h deleted file mode 100644 index 13011b6888..0000000000 --- a/klibc_fixups/klibc_fixups.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef __KLIBC__ - -#ifndef _KLIBC_FIXUPS_H -#define _KLIBC_FIXUPS_H - -#define _KLIBC_HAS_ARCH_SIG_ATOMIC_T -#include - -#define _SC_PAGESIZE 0x66 -static inline long int sysconf(int name) -{ - if (name == _SC_PAGESIZE) - return getpagesize(); - - return -1; -} - -struct exit_status { - short int e_termination; /* process termination status */ - short int e_exit; /* process exit status */ -}; - -#endif /* KLIBC_FIXUPS_H */ -#endif /* __KLIBC__ */ diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index c86617934b..63eec7bb9a 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -150,7 +150,7 @@ int sysfs_read_attribute(struct sysfs_attribute *sysattr) errno = EACCES; return -1; } - pgsize = sysconf(_SC_PAGESIZE); + pgsize = getpagesize(); fbuf = (char *)calloc(1, pgsize+1); if (!fbuf) { dprintf("calloc failed\n"); -- cgit v1.2.3-54-g00ecf From 57e1a2770c4d85edd377488906c437f6d1e9b369 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 6 Mar 2005 06:16:52 +0100 Subject: [PATCH] remove Makefile magic for klibc integration The new libsysfs and klibc don't need that anymore. Wrap getpwnam(), so we can use the built-in /etc/passwd parser for statically compiled glibc binaries too. --- Makefile | 38 ++++------- klibc_fixups/klibc_fixups.c | 127 ---------------------------------- klibc_fixups/pwd.h | 27 -------- udev_add.c | 22 ++---- udev_libc_wrapper.c | 162 ++++++++++++++++++++++++++++++++++++++++++++ udev_libc_wrapper.h | 28 ++++++++ 6 files changed, 207 insertions(+), 197 deletions(-) delete mode 100644 klibc_fixups/klibc_fixups.c delete mode 100644 klibc_fixups/pwd.h create mode 100644 udev_libc_wrapper.c create mode 100644 udev_libc_wrapper.h diff --git a/Makefile b/Makefile index 8184620a2d..baecda66f3 100644 --- a/Makefile +++ b/Makefile @@ -118,14 +118,15 @@ WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) CFLAGS := -pipe HEADERS = \ - udev.h \ - udev_utils.h \ - namedev.h \ - udev_version.h \ - udev_db.h \ - udev_sysfs.h \ - logging.h \ - udev_selinux.h \ + udev.h \ + udev_utils.h \ + namedev.h \ + udev_version.h \ + udev_db.h \ + udev_sysfs.h \ + logging.h \ + udev_libc_wrapper.h \ + udev_selinux.h \ list.h SYSFS_OBJS = \ @@ -146,7 +147,8 @@ UDEV_OBJS = \ udev_db.o \ udev_multiplex.o \ namedev.o \ - namedev_parse.o + namedev_parse.o \ + udev_libc_wrapper.o OBJS = \ udev.a \ @@ -158,7 +160,7 @@ CFLAGS += -I$(PWD)/libsysfs/sysfs \ -I$(PWD)/libsysfs ifeq ($(strip $(USE_LOG)),true) - CFLAGS += -DLOG + CFLAGS += -DLOG endif # if DEBUG is enabled, then we do not strip or optimize @@ -175,7 +177,6 @@ endif # If we are using our version of klibc, then we need to build, link it, and then # link udev against it statically. Otherwise, use glibc and link dynamically. ifeq ($(strip $(USE_KLIBC)),true) - KLIBC_FIXUPS_DIR= $(PWD)/klibc_fixups KLIBC_BASE = $(PWD)/klibc KLIBC_DIR = $(KLIBC_BASE)/klibc INCLUDE_DIR := $(KLIBC_BASE)/include @@ -190,7 +191,6 @@ ifeq ($(strip $(USE_KLIBC)),true) CFLAGS += $(WARNINGS) -nostdinc \ $(OPTFLAGS) $(REQFLAGS) \ -D__KLIBC__ -fno-builtin-printf \ - -I$(KLIBC_FIXUPS_DIR) \ -I$(INCLUDE_DIR) \ -I$(INCLUDE_DIR)/arch/$(ARCH) \ -I$(INCLUDE_DIR)/bits$(BITSIZE) \ @@ -199,20 +199,12 @@ ifeq ($(strip $(USE_KLIBC)),true) LIB_OBJS = LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs - HEADERS += \ - klibc_fixups/pwd.h - - KLIBC_FIXUP_OBJS = \ - klibc_fixups/klibc_fixups.o - - OBJS += klibc_fixups/klibc_fixups.a else WARNINGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations CRT0 = LIBC = CFLAGS += $(WARNINGS) -I$(GCCINCDIR) LIB_OBJS = -lc - LDFLAGS = endif ifeq ($(strip $(USE_SELINUX)),true) @@ -261,11 +253,6 @@ libsysfs/sysfs.a: $(SYSFS_OBJS) $(QUIET) $(AR) cq $@ $(SYSFS_OBJS) $(QUIET) $(RANLIB) $@ -klibc_fixups/klibc_fixups.a: $(KLIBC_FIXUP_OBJS) - rm -f $@ - $(QUIET) $(AR) cq $@ $(KLIBC_FIXUP_OBJS) - $(QUIET) $(RANLIB) $@ - # header files automatically generated GEN_HEADERS = udev_version.h @@ -298,7 +285,6 @@ $(GEN_MANPAGES): $(GEN_MANPAGESIN) $(UDEV_OBJS): $(GEN_HEADERS) $(HOST_PROGS) $(SYSFS_OBJS): $(HOST_PROGS) -$(KLIBC_FIXUP_OBJS): $(HOST_PROGS) $(OBJS): $(GEN_HEADERS) $(HOST_PROGS) $(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS) $(TESTER).o: $(GEN_HEADERS) $(HOST_PROGS) diff --git a/klibc_fixups/klibc_fixups.c b/klibc_fixups/klibc_fixups.c deleted file mode 100644 index 175cf27fe4..0000000000 --- a/klibc_fixups/klibc_fixups.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * klibc_fixups.c - very simple implementation of stuff missing in klibc - * - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers - * - * 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 02139, USA. - * - */ - -#ifdef __KLIBC__ - -#include -#include -#include -#include -#include -#include - -#include "pwd.h" -#include "../udev.h" -#include "../udev_utils.h" -#include "../logging.h" - -#define PW_FILE "/etc/passwd" -#define GR_FILE "/etc/group" - -/* return the id of a passwd style line, selected by the users name */ -static unsigned long get_id_by_name(const char *uname, const char *dbfile) -{ - unsigned long id = -1; - char line[LINE_SIZE]; - char *buf; - char *bufline; - size_t bufsize; - size_t cur; - size_t count; - char *pos; - char *name; - char *idstr; - char *tail; - - if (file_map(dbfile, &buf, &bufsize) == 0) { - dbg("reading '%s' as db file", dbfile); - } else { - dbg("can't open '%s' as db file", dbfile); - return -1; - } - - /* loop through the whole file */ - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - - if (count >= LINE_SIZE) - continue; - - strncpy(line, bufline, count); - line[count] = '\0'; - pos = line; - - /* get name */ - name = strsep(&pos, ":"); - if (name == NULL) - continue; - - /* skip pass */ - if (strsep(&pos, ":") == NULL) - continue; - - /* get id */ - idstr = strsep(&pos, ":"); - if (idstr == NULL) - continue; - - if (strcmp(uname, name) == 0) { - id = strtoul(idstr, &tail, 10); - if (tail[0] != '\0') - id = -1; - else - dbg("id for '%s' is '%li'", name, id); - break; - } - } - - file_unmap(buf, bufsize); - return id; -} - -struct passwd *getpwnam(const char *name) -{ - static struct passwd pw; - - memset(&pw, 0x00, sizeof(struct passwd)); - pw.pw_uid = (uid_t) get_id_by_name(name, PW_FILE); - if (pw.pw_uid < 0) - return NULL; - else - return &pw; -} - -struct group *getgrnam(const char *name) -{ - static struct group gr; - - memset(&gr, 0x00, sizeof(struct group)); - gr.gr_gid = (gid_t) get_id_by_name(name, GR_FILE); - if (gr.gr_gid < 0) - return NULL; - else - return &gr; -} - -#endif /* __KLIBC__ */ diff --git a/klibc_fixups/pwd.h b/klibc_fixups/pwd.h deleted file mode 100644 index f5de6c50b8..0000000000 --- a/klibc_fixups/pwd.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifdef __KLIBC__ - -#ifndef _PWD_H -#define _PWD_H - -struct passwd { - char *pw_name; /* user name */ - char *pw_passwd; /* user password */ - uid_t pw_uid; /* user id */ - gid_t pw_gid; /* group id */ - char *pw_gecos; /* real name */ - char *pw_dir; /* home directory */ - char *pw_shell; /* shell program */ -}; - -struct group { - char *gr_name; /* group name */ - char *gr_passwd; /* group password */ - gid_t gr_gid; /* group id */ - char **gr_mem; /* group members */ -}; - -struct passwd *getpwnam(const char *name); -struct group *getgrnam(const char *name); - -#endif /* _PWD_H */ -#endif /* __KLIBC__ */ diff --git a/udev_add.c b/udev_add.c index aa19d874c3..e05710ce81 100644 --- a/udev_add.c +++ b/udev_add.c @@ -34,9 +34,9 @@ #include #include #include -#include #include "libsysfs/sysfs/libsysfs.h" +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" #include "udev_sysfs.h" @@ -132,15 +132,8 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de if (endptr[0] == '\0') uid = (uid_t) id; - else { - struct passwd *pw; - - pw = getpwnam(udev->owner); - if (pw == NULL) - dbg("specified user unknown '%s'", udev->owner); - else - uid = pw->pw_uid; - } + else + uid = lookup_user(udev->owner); } if (udev->group[0] != '\0') { @@ -149,13 +142,8 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de if (endptr[0] == '\0') gid = (gid_t) id; - else { - struct group *gr = getgrnam(udev->group); - if (gr == NULL) - dbg("specified group unknown '%s'", udev->group); - else - gid = gr->gr_gid; - } + else + gid = lookup_group(udev->group); } if (!udev->test_run) { diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c new file mode 100644 index 0000000000..df54515206 --- /dev/null +++ b/udev_libc_wrapper.c @@ -0,0 +1,162 @@ +/* + * udev_libc_wrapper - wrapping of functions missing in a specific libc + * or not working in a statically compiled binary + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2005 Kay Sievers + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "../udev_libc_wrapper.h" +#include "../udev.h" +#include "../udev_utils.h" +#include "../logging.h" + + +#ifdef __KLIBC__ +#define __OWN_USERDB_PARSER__ +#endif +#ifdef USE_STATIC +#define __OWN_USERDB_PARSER__ +#endif + +#ifndef __OWN_USERDB_PARSER__ + +#include +#include +#include + +uid_t lookup_user(const char *user) +{ + struct passwd *pw; + uid_t uid = 0; + + pw = getpwnam(user); + if (pw == NULL) + dbg("specified user unknown '%s'", user); + else + uid = pw->pw_uid; + + return uid; +} + +gid_t lookup_group(const char *group) +{ + struct group *gr; + gid_t gid = 0; + + gr = getgrnam(group); + if (gr == NULL) + dbg("specified group unknown '%s'", group); + else + gid = gr->gr_gid; + + return gid; +} + +#else /* __OWN_USERDB_PARSER__ */ + +#define PASSWD_FILE "/etc/passwd" +#define GROUP_FILE "/etc/group" + +/* return the id of a passwd style line, selected by the users name */ +static unsigned long get_id_by_name(const char *uname, const char *dbfile) +{ + unsigned long id = 0; + char line[LINE_SIZE]; + char *buf; + char *bufline; + size_t bufsize; + size_t cur; + size_t count; + char *pos; + char *name; + char *idstr; + char *tail; + + if (file_map(dbfile, &buf, &bufsize) != 0) { + dbg("can't open '%s' as db file", dbfile); + return 0; + } + dbg("reading '%s' as db file", dbfile); + + /* loop through the whole file */ + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + + if (count >= LINE_SIZE) + continue; + + strncpy(line, bufline, count); + line[count] = '\0'; + pos = line; + + /* get name */ + name = strsep(&pos, ":"); + if (name == NULL) + continue; + + /* skip pass */ + if (strsep(&pos, ":") == NULL) + continue; + + /* get id */ + idstr = strsep(&pos, ":"); + if (idstr == NULL) + continue; + + if (strcmp(uname, name) == 0) { + id = strtoul(idstr, &tail, 10); + if (tail[0] != '\0') { + id = 0; + dbg("no id found for '%s'", name); + } else + dbg("id for '%s' is '%li'", name, id); + break; + } + } + + file_unmap(buf, bufsize); + return id; +} + +uid_t lookup_user(const char *user) +{ + unsigned long id; + + id = get_id_by_name(user, PASSWD_FILE); + return (uid_t) id; +} + +gid_t lookup_group(const char *group) +{ + unsigned long id; + + id = get_id_by_name(group, GROUP_FILE); + return (gid_t) id; +} + +#endif /* __OWN_USERDB_PARSER__ */ diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h new file mode 100644 index 0000000000..2df2f4429d --- /dev/null +++ b/udev_libc_wrapper.h @@ -0,0 +1,28 @@ +/* + * udev_libc_wrapper - wrapping of functions missing in a specific libc + * or not working in a statically compiled binary + * + * Copyright (C) 2005 Kay Sievers + * + * 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 02139, USA. + * + */ + +#ifndef _UDEV_LIBC_WRAPPER_H_ +#define _UDEV_LIBC_WRAPPER_H_ + +extern uid_t lookup_user(const char *user); +extern gid_t lookup_group(const char *group); + +#endif /* _UDEV_LIBC_WRAPPER_H_ */ -- cgit v1.2.3-54-g00ecf From 6c18b1fb8784606c83adab89e306534d3b943aa3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 6 Mar 2005 10:15:51 +0100 Subject: [PATCH] rename LOG to USE_LOG in all places --- Makefile | 50 +++++++++++++++++++-------------------- extras/volume_id/udev_volume_id.c | 2 +- logging.h | 4 ++-- make_gcov.sh | 2 +- udev.c | 2 +- udevd.c | 4 ++-- udevinfo.c | 3 +-- udevsend.c | 2 +- udevtest.c | 2 +- 9 files changed, 34 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index baecda66f3..f2d445d627 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # Makefile for udev # # Copyright (C) 2003,2004 Greg Kroah-Hartman +# Copyright (C) 2004-2005 Kay Sievers # # 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 @@ -16,18 +17,28 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Set the following to control the use of syslog -# Set it to `false' to remove all logging +# Set this to make use of syslog USE_LOG = true -# Set the following to `true' to log the debug -# and make a unstripped, unoptimized binary. -# Leave this set to `false' for production use. +# Set this to ad development debug messages DEBUG = false -# Set this to compile with Security-Enhanced Linux support. +# Set this to include Security-Enhanced Linux support. USE_SELINUX = false +# Set this to comile with the local version of klibc instead of glibc. +USE_KLIBC = false + +# Set this to create statically linked binaries. +USE_STATIC = false + +# To build any of the extras programs, run with: +# make EXTRAS="extras/a extras/b" +EXTRAS= + +# make the build silent. Set this to something else to make it noisy again. +V=false + ROOT = udev DAEMON = udevd SENDER = udevsend @@ -39,9 +50,7 @@ INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev HOTPLUG_EXEC = $(ROOT) - DESTDIR = - KERNEL_DIR = /lib/modules/${shell uname -r}/build # override this to make udev look in a different location for it's config files @@ -62,22 +71,10 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -# To build any of the extras programs, run with: -# make EXTRAS="extras/a extras/b" -EXTRAS= - # place to put our device nodes udevdir = ${prefix}/udev udevdb = ${udevdir}/.udevdb -# Comment out this line to build with something other -# than the local version of klibc -#USE_KLIBC = true - -# make the build silent (well, at least the udev part) Set this -# to something else to make it noisy again. -V=false - # set up PWD so that older versions of make will work with our build. PWD = $(shell pwd) @@ -160,7 +157,7 @@ CFLAGS += -I$(PWD)/libsysfs/sysfs \ -I$(PWD)/libsysfs ifeq ($(strip $(USE_LOG)),true) - CFLAGS += -DLOG + CFLAGS += -DUSE_LOG endif # if DEBUG is enabled, then we do not strip or optimize @@ -182,10 +179,7 @@ ifeq ($(strip $(USE_KLIBC)),true) INCLUDE_DIR := $(KLIBC_BASE)/include LINUX_INCLUDE_DIR := $(KERNEL_DIR)/include include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG - # arch specific objects ARCH_LIB_OBJS = $(KLIBC_DIR)/libc.a - - CRT0 = $(KLIBC_DIR)/crt0.o LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) CFLAGS += $(WARNINGS) -nostdinc \ @@ -197,8 +191,7 @@ ifeq ($(strip $(USE_KLIBC)),true) -I$(GCCINCDIR) \ -I$(LINUX_INCLUDE_DIR) LIB_OBJS = - LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs - + LDFLAGS = -static -nostdlib -nostartfiles -nodefaultlibs else WARNINGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations CRT0 = @@ -213,6 +206,11 @@ ifeq ($(strip $(USE_SELINUX)),true) CFLAGS += -DUSE_SELINUX endif +ifeq ($(strip $(USE_STATIC)),true) + CFLAGS += -DUSE_STATIC + LDFLAGS += -static +endif + ifeq ($(strip $(V)),false) QUIET=@$(PWD)/ccdv HOST_PROGS=ccdv diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index c36b89f8bd..54d95270d0 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -35,7 +35,7 @@ #define BLKGETSIZE64 _IOR(0x12,114,size_t) -#ifdef LOG +#ifdef USE_LOG void log_message(int level, const char *format, ...) { va_list args; diff --git a/logging.h b/logging.h index 4f51217b9a..3ff54ec974 100644 --- a/logging.h +++ b/logging.h @@ -30,7 +30,7 @@ #define logging_init(foo) do { } while (0) #define logging_close(foo) do { } while (0) -#ifdef LOG +#ifdef USE_LOG #include #include #include @@ -73,6 +73,6 @@ static inline void logging_close(void) closelog(); } -#endif /* LOG */ +#endif /* USE_LOG */ #endif diff --git a/make_gcov.sh b/make_gcov.sh index 4d5f63f1dd..e3ceb96d07 100644 --- a/make_gcov.sh +++ b/make_gcov.sh @@ -28,7 +28,7 @@ GCCINCDIR=`gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"` LIBSYSFS="-I$PWD/libsysfs/sysfs -I$PWD/libsysfs" WARNINGS="-Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" GCC="-I$GCCINCDIR" -USE_LOG="-DLOG" +USE_LOG="-DUSE_LOG" DEBUG="-D_GNU_SOURCE" GCOV_FLAGS="-pipe -fprofile-arcs -ftest-coverage" diff --git a/udev.c b/udev.c index c26ce46b64..76de8181d1 100644 --- a/udev.c +++ b/udev.c @@ -40,7 +40,7 @@ #include "logging.h" -#ifdef LOG +#ifdef USE_LOG void log_message(int level, const char *format, ...) { va_list args; diff --git a/udevd.c b/udevd.c index bd21f15614..1376cf05c7 100644 --- a/udevd.c +++ b/udevd.c @@ -1,7 +1,7 @@ /* * udevd.c - hotplug event serializer * - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004-2005 Kay Sievers * Copyright (C) 2004 Chris Friesen * * @@ -67,7 +67,7 @@ static void user_sighandler(void); static void reap_sigchilds(void); char *udev_bin; -#ifdef LOG +#ifdef USE_LOG void log_message (int level, const char *format, ...) { va_list args; diff --git a/udevinfo.c b/udevinfo.c index b2d22e984e..e30a036ac6 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -3,7 +3,6 @@ * * Copyright (C) 2004 Kay Sievers * - * * 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. @@ -38,7 +37,7 @@ #define SYSFS_VALUE_SIZE 256 -#ifdef LOG +#ifdef USE_LOG void log_message (int level, const char *format, ...) { va_list args; diff --git a/udevsend.c b/udevsend.c index 5fe0f456a1..dcd5a2ae93 100644 --- a/udevsend.c +++ b/udevsend.c @@ -43,7 +43,7 @@ /* global variables */ static int sock = -1; -#ifdef LOG +#ifdef USE_LOG void log_message (int level, const char *format, ...) { va_list args; diff --git a/udevtest.c b/udevtest.c index 4e02ac7dbc..084fde0706 100644 --- a/udevtest.c +++ b/udevtest.c @@ -36,7 +36,7 @@ #include "logging.h" -#ifdef LOG +#ifdef USE_LOG void log_message (int level, const char *format, ...) { va_list args; -- cgit v1.2.3-54-g00ecf From 845d4751acc26596b827c937b84a9566cd050707 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 6 Mar 2005 12:16:32 +0100 Subject: [PATCH] udev_volume_id: version 39 --- extras/volume_id/volume_id/Makefile.inc | 4 +- extras/volume_id/volume_id/hpfs.c | 2 +- extras/volume_id/volume_id/minix.c | 97 +++++++++++++++++++++++++++++++++ extras/volume_id/volume_id/minix.h | 26 +++++++++ extras/volume_id/volume_id/volume_id.c | 4 ++ extras/volume_id/volume_id/volume_id.h | 2 +- udev_db.c | 1 + 7 files changed, 133 insertions(+), 3 deletions(-) create mode 100644 extras/volume_id/volume_id/minix.c create mode 100644 extras/volume_id/volume_id/minix.h diff --git a/extras/volume_id/volume_id/Makefile.inc b/extras/volume_id/volume_id/Makefile.inc index 9cadec20cc..68d80d689c 100644 --- a/extras/volume_id/volume_id/Makefile.inc +++ b/extras/volume_id/volume_id/Makefile.inc @@ -19,6 +19,7 @@ VOLUME_ID_OBJS= \ $(VOLUME_ID_BASE)/hpfs.o \ $(VOLUME_ID_BASE)/romfs.o \ $(VOLUME_ID_BASE)/sysv.o \ + $(VOLUME_ID_BASE)/minix.o \ $(VOLUME_ID_BASE)/dasd.o \ $(VOLUME_ID_BASE)/luks.o \ $(VOLUME_ID_BASE)/volume_id.o \ @@ -42,8 +43,9 @@ VOLUME_ID_HEADERS= \ $(VOLUME_ID_BASE)/ufs.h \ $(VOLUME_ID_BASE)/xfs.h \ $(VOLUME_ID_BASE)/cramfs.h \ - $(VOLUME_ID_BASE)/sysv.h \ $(VOLUME_ID_BASE)/romfs.h \ + $(VOLUME_ID_BASE)/sysv.h \ + $(VOLUME_ID_BASE)/minix.h \ $(VOLUME_ID_BASE)/dasd.h \ $(VOLUME_ID_BASE)/luks.h \ $(VOLUME_ID_BASE)/volume_id.h \ diff --git a/extras/volume_id/volume_id/hpfs.c b/extras/volume_id/volume_id/hpfs.c index a8daea7892..3aa95fa839 100644 --- a/extras/volume_id/volume_id/hpfs.c +++ b/extras/volume_id/volume_id/hpfs.c @@ -58,7 +58,7 @@ int volume_id_probe_hpfs(struct volume_id *id, __u64 off) return -1; if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) { - snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u", hs->version); + sprintf(id->type_version, "%u", hs->version); volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "hpfs"; diff --git a/extras/volume_id/volume_id/minix.c b/extras/volume_id/volume_id/minix.c new file mode 100644 index 0000000000..d9c9ea8ca9 --- /dev/null +++ b/extras/volume_id/volume_id/minix.c @@ -0,0 +1,97 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "minix.h" + +struct minix_super_block +{ + __u16 s_ninodes; + __u16 s_nzones; + __u16 s_imap_blocks; + __u16 s_zmap_blocks; + __u16 s_firstdatazone; + __u16 s_log_zone_size; + __u32 s_max_size; + __u16 s_magic; + __u16 s_state; + __u32 s_zones; +} __attribute__((__packed__)); + +#define MINIX_SUPERBLOCK_OFFSET 0x400 + +int volume_id_probe_minix(struct volume_id *id, __u64 off) +{ + struct minix_super_block *ms; + + dbg("probing at offset %llu", off); + + ms = (struct minix_super_block *) volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); + if (ms == NULL) + return -1; + + if (le16_to_cpu(ms->s_magic) == 0x137f) { + strcpy(id->type_version, "1"); + goto found; + } + + if (le16_to_cpu(ms->s_magic) == 0x1387) { + strcpy(id->type_version, "1"); + goto found; + } + + if (le16_to_cpu(ms->s_magic) == 0x2468) { + strcpy(id->type_version, "2"); + goto found; + } + + if (le16_to_cpu(ms->s_magic) == 0x2478) { + strcpy(id->type_version, "2"); + goto found; + } + + goto exit; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "minix"; + return 0; + +exit: + return -1; +} diff --git a/extras/volume_id/volume_id/minix.h b/extras/volume_id/volume_id/minix.h new file mode 100644 index 0000000000..7a9d97ada2 --- /dev/null +++ b/extras/volume_id/volume_id/minix.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_MINIX_ +#define _VOLUME_ID_MINIX_ + +extern int volume_id_probe_minix(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 7a08be89d9..22d30ee741 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -60,6 +60,7 @@ #include "hpfs.h" #include "romfs.h" #include "sysv.h" +#include "minix.h" #include "mac.h" #include "msdos.h" @@ -136,6 +137,9 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l if (volume_id_probe_sysv(id, off) == 0) goto exit; + if (volume_id_probe_minix(id, off) == 0) + goto exit; + return -1; exit: diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 22bb3ea487..6719c1aa31 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 38 +#define VOLUME_ID_VERSION 39 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 diff --git a/udev_db.c b/udev_db.c index c12e88c3c4..653d7d0855 100644 --- a/udev_db.c +++ b/udev_db.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3-54-g00ecf From 56a8a624eef99f5324b54fad466b144aa4f882c2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 7 Mar 2005 00:01:34 +0100 Subject: [PATCH] split udev and udevstart --- Makefile | 9 +- udev.c | 12 --- udev_start.c | 291 ---------------------------------------------------- udevstart.c | 325 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 331 insertions(+), 306 deletions(-) delete mode 100644 udev_start.c create mode 100644 udevstart.c diff --git a/Makefile b/Makefile index f2d445d627..9b37402fb9 100644 --- a/Makefile +++ b/Makefile @@ -139,7 +139,6 @@ UDEV_OBJS = \ udev_config.o \ udev_add.o \ udev_remove.o \ - udev_start.o \ udev_sysfs.o \ udev_db.o \ udev_multiplex.o \ @@ -222,7 +221,7 @@ endif # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf -all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(GEN_CONFIGS) +all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -311,6 +310,10 @@ $(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(SENDER).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) $(QUIET) $(STRIPCMD) $@ +$(STARTER): $(LIBC) $(STARTER).o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(STARTER).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ + .c.o: $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< @@ -405,7 +408,7 @@ install: install-config install-man install-dev.d all $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) - - ln -f -s $(sbindir)/udev $(DESTDIR)$(sbindir)/$(STARTER) + $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/10-udev.hotplug ifndef DESTDIR - killall $(DAEMON) diff --git a/udev.c b/udev.c index 76de8181d1..c9461469e5 100644 --- a/udev.c +++ b/udev.c @@ -130,17 +130,6 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timeout to prevent hanging processes */ alarm(ALARM_TIMEOUT); - if (strstr(argv[0], "udevstart") || (argc == 2 && strstr(argv[1], "udevstart"))) { - dbg("udevstart"); - - /* disable all logging, as it's much too slow on some facilities */ - udev_log = 0; - - namedev_init(); - retval = udev_start(); - goto exit; - } - /* let the executed programs know if we handle the whole hotplug event */ managed_event = manage_hotplug_event(); if (managed_event) @@ -240,7 +229,6 @@ hotplug: if (udev_hotplug_d && managed_event) udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX); -exit: logging_close(); return retval; } diff --git a/udev_start.c b/udev_start.c deleted file mode 100644 index dcb4293345..0000000000 --- a/udev_start.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * udevstart.c - * - * Copyright (C) 2004 Greg Kroah-Hartman - * - * Quick and dirty way to populate a /dev with udev if your system - * does not have access to a shell. Based originally on a patch to udev - * from Harald Hoyer - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libsysfs/sysfs/libsysfs.h" -#include "logging.h" -#include "udev_utils.h" -#include "list.h" -#include "udev.h" - - -#define MAX_PATH_SIZE 512 - -struct device { - struct list_head list; - char path[MAX_PATH_SIZE]; - char subsys[MAX_PATH_SIZE]; -}; - -/* sort files in lexical order */ -static int device_list_insert(const char *path, char *subsystem, struct list_head *device_list) -{ - struct device *loop_device; - struct device *new_device; - - dbg("insert: '%s'\n", path); - - list_for_each_entry(loop_device, device_list, list) { - if (strcmp(loop_device->path, path) > 0) { - break; - } - } - - new_device = malloc(sizeof(struct device)); - if (new_device == NULL) { - dbg("error malloc"); - return -ENOMEM; - } - - strfieldcpy(new_device->path, path); - strfieldcpy(new_device->subsys, subsystem); - list_add_tail(&new_device->list, &loop_device->list); - dbg("add '%s' from subsys '%s'", new_device->path, new_device->subsys); - return 0; -} - -/* list of devices that we should run last due to any one of a number of reasons */ -static char *last_list[] = { - "/block/dm", /* on here because dm wants to have the block devices around before it */ - NULL, -}; - -/* list of devices that we should run first due to any one of a number of reasons */ -static char *first_list[] = { - "/class/mem", /* people tend to like their memory devices around first... */ - NULL, -}; - -static int add_device(const char *path, const char *subsystem) -{ - struct udevice udev; - struct sysfs_class_device *class_dev; - const char *devpath; - - devpath = &path[strlen(sysfs_path)]; - - /* set environment for callouts and dev.d/ */ - setenv("DEVPATH", devpath, 1); - setenv("SUBSYSTEM", subsystem, 1); - - dbg("exec : '%s' (%s)\n", devpath, path); - - class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) { - dbg ("sysfs_open_class_device_path failed"); - return -ENODEV; - } - - udev_init_device(&udev, devpath, subsystem); - udev_add_device(&udev, class_dev); - - /* run dev.d/ scripts if we created a node or changed a netif name */ - if (udev_dev_d && udev.devname[0] != '\0') { - setenv("DEVNAME", udev.devname, 1); - udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); - } - - sysfs_close_class_device(class_dev); - - return 0; -} - -static void exec_list(struct list_head *device_list) -{ - struct device *loop_device; - struct device *tmp_device; - int i; - - /* handle the "first" type devices first */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - for (i = 0; first_list[i] != NULL; i++) { - if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { - add_device(loop_device->path, loop_device->subsys); - list_del(&loop_device->list); - free(loop_device); - break; - } - } - } - - /* handle the devices we are allowed to, excluding the "last" type devices */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - int found = 0; - for (i = 0; last_list[i] != NULL; i++) { - if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) { - found = 1; - break; - } - } - if (found) - continue; - - add_device(loop_device->path, loop_device->subsys); - list_del(&loop_device->list); - free(loop_device); - } - - /* handle the rest of the devices left over, if any */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { - add_device(loop_device->path, loop_device->subsys); - list_del(&loop_device->list); - free(loop_device); - } -} - -static int has_devt(const char *directory) -{ - char filename[MAX_PATH_SIZE]; - struct stat statbuf; - - snprintf(filename, MAX_PATH_SIZE, "%s/dev", directory); - filename[MAX_PATH_SIZE-1] = '\0'; - - if (stat(filename, &statbuf) == 0) - return 1; - - return 0; -} - -static void udev_scan_block(void) -{ - char base[MAX_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - LIST_HEAD(device_list); - - snprintf(base, MAX_PATH_SIZE, "%s/block", sysfs_path); - base[MAX_PATH_SIZE-1] = '\0'; - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[MAX_PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - snprintf(dirname, MAX_PATH_SIZE, "%s/%s", base, dent->d_name); - dirname[MAX_PATH_SIZE-1] = '\0'; - if (has_devt(dirname)) - device_list_insert(dirname, "block", &device_list); - else - continue; - - snprintf(dirname, MAX_PATH_SIZE, "%s/%s", base, dent->d_name); - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - snprintf(dirname2, MAX_PATH_SIZE, "%s/%s", dirname, dent2->d_name); - dirname2[MAX_PATH_SIZE-1] = '\0'; - - if (has_devt(dirname2)) - device_list_insert(dirname2, "block", &device_list); - } - closedir(dir2); - } - } - closedir(dir); - } - - exec_list(&device_list); -} - -static void udev_scan_class(void) -{ - char base[MAX_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - LIST_HEAD(device_list); - - snprintf(base, MAX_PATH_SIZE, "%s/class", sysfs_path); - base[MAX_PATH_SIZE-1] = '\0'; - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[MAX_PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - snprintf(dirname, MAX_PATH_SIZE, "%s/%s", base, dent->d_name); - dirname[MAX_PATH_SIZE-1] = '\0'; - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[MAX_PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - snprintf(dirname2, MAX_PATH_SIZE, "%s/%s", dirname, dent2->d_name); - dirname2[MAX_PATH_SIZE-1] = '\0'; - - /* pass the net class as it is */ - if (strcmp(dent->d_name, "net") == 0) - device_list_insert(dirname2, "net", &device_list); - else if (has_devt(dirname2)) - device_list_insert(dirname2, dent->d_name, &device_list); - } - closedir(dir2); - } - } - closedir(dir); - } - - exec_list(&device_list); -} - -int udev_start(void) -{ - /* set environment for callouts and dev.d/ */ - setenv("ACTION", "add", 1); - setenv("UDEV_START", "1", 1); - - udev_scan_class(); - udev_scan_block(); - - return 0; -} diff --git a/udevstart.c b/udevstart.c new file mode 100644 index 0000000000..97d38490ae --- /dev/null +++ b/udevstart.c @@ -0,0 +1,325 @@ +/* + * udevstart.c + * + * Copyright (C) 2004 Greg Kroah-Hartman + * + * Quick and dirty way to populate a /dev with udev if your system + * does not have access to a shell. Based originally on a patch to udev + * from Harald Hoyer + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libsysfs/sysfs/libsysfs.h" +#include "logging.h" +#include "namedev.h" +#include "udev_utils.h" +#include "list.h" +#include "udev.h" + +#ifdef USE_LOG +void log_message(int level, const char *format, ...) +{ +} +#endif + +struct device { + struct list_head list; + char path[DEVPATH_SIZE]; + char subsys[SUBSYSTEM_SIZE]; +}; + +/* sort files in lexical order */ +static int device_list_insert(const char *path, char *subsystem, struct list_head *device_list) +{ + struct device *loop_device; + struct device *new_device; + + dbg("insert: '%s'\n", path); + + list_for_each_entry(loop_device, device_list, list) { + if (strcmp(loop_device->path, path) > 0) { + break; + } + } + + new_device = malloc(sizeof(struct device)); + if (new_device == NULL) { + dbg("error malloc"); + return -ENOMEM; + } + + strfieldcpy(new_device->path, path); + strfieldcpy(new_device->subsys, subsystem); + list_add_tail(&new_device->list, &loop_device->list); + dbg("add '%s' from subsys '%s'", new_device->path, new_device->subsys); + return 0; +} + +/* list of devices that we should run last due to any one of a number of reasons */ +static char *last_list[] = { + "/block/dm", /* on here because dm wants to have the block devices around before it */ + NULL, +}; + +/* list of devices that we should run first due to any one of a number of reasons */ +static char *first_list[] = { + "/class/mem", /* people tend to like their memory devices around first... */ + NULL, +}; + +static int add_device(const char *path, const char *subsystem) +{ + struct udevice udev; + struct sysfs_class_device *class_dev; + const char *devpath; + + devpath = &path[strlen(sysfs_path)]; + + /* set environment for callouts and dev.d/ */ + setenv("DEVPATH", devpath, 1); + setenv("SUBSYSTEM", subsystem, 1); + + dbg("exec: '%s' (%s)\n", devpath, path); + + class_dev = sysfs_open_class_device_path(path); + if (class_dev == NULL) { + dbg ("sysfs_open_class_device_path failed"); + return -ENODEV; + } + + udev_init_device(&udev, devpath, subsystem); + udev_add_device(&udev, class_dev); + + /* run dev.d/ scripts if we created a node or changed a netif name */ + if (udev_dev_d && udev.devname[0] != '\0') { + setenv("DEVNAME", udev.devname, 1); + udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); + } + + sysfs_close_class_device(class_dev); + udev_cleanup_device(&udev); + + return 0; +} + +static void exec_list(struct list_head *device_list) +{ + struct device *loop_device; + struct device *tmp_device; + int i; + + /* handle the "first" type devices first */ + list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + for (i = 0; first_list[i] != NULL; i++) { + if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { + add_device(loop_device->path, loop_device->subsys); + list_del(&loop_device->list); + free(loop_device); + break; + } + } + } + + /* handle the devices we are allowed to, excluding the "last" type devices */ + list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + int found = 0; + for (i = 0; last_list[i] != NULL; i++) { + if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) { + found = 1; + break; + } + } + if (found) + continue; + + add_device(loop_device->path, loop_device->subsys); + list_del(&loop_device->list); + free(loop_device); + } + + /* handle the rest of the devices left over, if any */ + list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + add_device(loop_device->path, loop_device->subsys); + list_del(&loop_device->list); + free(loop_device); + } +} + +static int has_devt(const char *directory) +{ + char filename[NAME_SIZE]; + struct stat statbuf; + + snprintf(filename, NAME_SIZE, "%s/dev", directory); + filename[NAME_SIZE-1] = '\0'; + + if (stat(filename, &statbuf) == 0) + return 1; + + return 0; +} + +static void udev_scan_block(void) +{ + char base[NAME_SIZE]; + DIR *dir; + struct dirent *dent; + LIST_HEAD(device_list); + + snprintf(base, DEVPATH_SIZE, "%s/block", sysfs_path); + base[DEVPATH_SIZE-1] = '\0'; + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[DEVPATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + snprintf(dirname, NAME_SIZE, "%s/%s", base, dent->d_name); + dirname[NAME_SIZE-1] = '\0'; + if (has_devt(dirname)) + device_list_insert(dirname, "block", &device_list); + else + continue; + + /* look for partitions */ + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[DEVPATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + snprintf(dirname2, DEVPATH_SIZE, "%s/%s", dirname, dent2->d_name); + dirname2[DEVPATH_SIZE-1] = '\0'; + + if (has_devt(dirname2)) + device_list_insert(dirname2, "block", &device_list); + } + closedir(dir2); + } + } + closedir(dir); + } + exec_list(&device_list); +} + +static void udev_scan_class(void) +{ + char base[DEVPATH_SIZE]; + DIR *dir; + struct dirent *dent; + LIST_HEAD(device_list); + + snprintf(base, DEVPATH_SIZE, "%s/class", sysfs_path); + base[DEVPATH_SIZE-1] = '\0'; + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[DEVPATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + snprintf(dirname, DEVPATH_SIZE, "%s/%s", base, dent->d_name); + dirname[DEVPATH_SIZE-1] = '\0'; + + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[DEVPATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + snprintf(dirname2, DEVPATH_SIZE, "%s/%s", dirname, dent2->d_name); + dirname2[DEVPATH_SIZE-1] = '\0'; + + /* pass the net class as it is */ + if (strcmp(dent->d_name, "net") == 0) + device_list_insert(dirname2, "net", &device_list); + else if (has_devt(dirname2)) + device_list_insert(dirname2, dent->d_name, &device_list); + } + closedir(dir2); + } + } + closedir(dir); + } + exec_list(&device_list); +} + +static void asmlinkage sig_handler(int signum) +{ + switch (signum) { + case SIGALRM: + exit(1); + case SIGINT: + case SIGTERM: + exit(20 + signum); + } +} + +int main(int argc, char *argv[], char *envp[]) +{ + struct sigaction act; + + udev_init_config(); + + /* set signal handlers */ + memset(&act, 0x00, sizeof(act)); + act.sa_handler = (void (*) (int))sig_handler; + sigemptyset (&act.sa_mask); + act.sa_flags = 0; + sigaction(SIGALRM, &act, NULL); + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + + /* trigger timeout to prevent hanging processes */ + alarm(ALARM_TIMEOUT); + + /* set environment for executed programs */ + setenv("ACTION", "add", 1); + setenv("UDEV_START", "1", 1); + + namedev_init(); + + udev_scan_block(); + udev_scan_class(); + + return 0; +} -- cgit v1.2.3-54-g00ecf From 63f61c5cf639953aa38e025485919b0aa1c49b59 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 7 Mar 2005 04:29:43 +0100 Subject: [PATCH] replace strncpy()/strncat() by strlcpy()/strlcat() --- namedev.c | 92 +++++++++++++++++++++-------------------- namedev.h | 30 +++++--------- namedev_parse.c | 33 ++++++++------- udev.c | 9 ++-- udev.h | 34 +++++++-------- udev_add.c | 34 +++++++-------- udev_config.c | 33 +++++++-------- udev_db.c | 117 ++++++++++++++++++++++++---------------------------- udev_libc_wrapper.c | 52 ++++++++++++++++++++--- udev_libc_wrapper.h | 20 +++++++++ udev_multiplex.c | 23 ++++++----- udev_remove.c | 22 +++++----- udev_sysfs.c | 10 +++-- udev_utils.c | 27 ++++++------ udev_utils.h | 36 +--------------- udevd.c | 3 +- udevinfo.c | 29 +++++++------ udevstart.c | 53 ++++++++++++------------ udevtest.c | 19 ++++----- 19 files changed, 346 insertions(+), 330 deletions(-) diff --git a/namedev.c b/namedev.c index 49f9e4b1f4..9c73c08149 100644 --- a/namedev.c +++ b/namedev.c @@ -35,6 +35,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "list.h" +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" #include "udev_version.h" @@ -144,14 +145,14 @@ static int get_format_len(char **str) */ static int find_free_number(struct udevice *udev, const char *name) { - char devpath[NAME_SIZE]; - char filename[NAME_SIZE]; + char devpath[PATH_SIZE]; + char filename[PATH_SIZE]; int num = 0; - strfieldcpy(filename, name); + strlcpy(filename, name, sizeof(filename)); while (1) { dbg("look for existing node '%s'", filename); - if (udev_db_search_name(devpath, DEVPATH_SIZE, filename) != 0) { + if (udev_db_search_name(devpath, sizeof(devpath), filename) != 0) { dbg("free num=%d", num); return num; } @@ -161,16 +162,16 @@ static int find_free_number(struct udevice *udev, const char *name) info("find_free_number gone crazy (num=%d), aborted", num); return -1; } - snprintf(filename, NAME_SIZE, "%s%d", name, num); - filename[NAME_SIZE-1] = '\0'; + snprintf(filename, sizeof(filename), "%s%d", name, num); + filename[sizeof(filename)-1] = '\0'; } } static void apply_format(struct udevice *udev, char *string, size_t maxsize, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { - char temp[NAME_SIZE]; - char temp2[NAME_SIZE]; + char temp[PATH_SIZE]; + char temp2[PATH_SIZE]; char *tail, *pos, *cpos, *attr, *rest; int len; int i; @@ -189,36 +190,36 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, tail = pos+1; len = get_format_len(&tail); c = tail[0]; - strfieldcpy(temp, tail+1); + strlcpy(temp, tail+1, sizeof(temp)); tail = temp; dbg("format=%c, string='%s', tail='%s'",c , string, tail); attr = get_format_attribute(&tail); switch (c) { case 'p': - strfieldcatmax(string, udev->devpath, maxsize); + strlcat(string, udev->devpath, maxsize); dbg("substitute kernel name '%s'", udev->kernel_name); break; case 'b': - strfieldcatmax(string, udev->bus_id, maxsize); + strlcat(string, udev->bus_id, maxsize); dbg("substitute bus_id '%s'", udev->bus_id); break; case 'k': - strfieldcatmax(string, udev->kernel_name, maxsize); + strlcat(string, udev->kernel_name, maxsize); dbg("substitute kernel name '%s'", udev->kernel_name); break; case 'n': - strfieldcatmax(string, udev->kernel_number, maxsize); + strlcat(string, udev->kernel_number, maxsize); dbg("substitute kernel number '%s'", udev->kernel_number); break; case 'm': sprintf(temp2, "%d", minor(udev->devt)); - strfieldcatmax(string, temp2, maxsize); + strlcat(string, temp2, maxsize); dbg("substitute minor number '%s'", temp2); break; case 'M': sprintf(temp2, "%d", major(udev->devt)); - strfieldcatmax(string, temp2, maxsize); + strlcat(string, temp2, maxsize); dbg("substitute major number '%s'", temp2); break; case 'c': @@ -241,17 +242,17 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("requested part of result string not found"); break; } - strfieldcpy(temp2, cpos); + strlcpy(temp2, cpos, sizeof(temp2)); /* %{2+}c copies the whole string from the second part on */ if (rest[0] != '+') { cpos = strchr(temp2, ' '); if (cpos) cpos[0] = '\0'; } - strfieldcatmax(string, temp2, maxsize); + strlcat(string, temp2, maxsize); dbg("substitute part of result string '%s'", temp2); } else { - strfieldcatmax(string, udev->program_result, maxsize); + strlcat(string, udev->program_result, maxsize); dbg("substitute result string '%s'", udev->program_result); } break; @@ -278,18 +279,18 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, len - i, tmpattr->value); } } - strfieldcatmax(string, tmpattr->value, maxsize); + strlcat(string, tmpattr->value, maxsize); dbg("substitute sysfs value '%s'", tmpattr->value); break; case '%': - strfieldcatmax(string, "%", maxsize); + strlcat(string, "%", maxsize); pos++; break; case 'e': next_free_number = find_free_number(udev, string); if (next_free_number > 0) { sprintf(temp2, "%d", next_free_number); - strfieldcatmax(string, temp2, maxsize); + strlcat(string, temp2, maxsize); } break; case 'P': @@ -303,7 +304,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, udev_init_device(&udev_parent, NULL, NULL); /* lookup the name in the udev_db with the DEVPATH of the parent */ if (udev_db_get_device(&udev_parent, &class_dev_parent->path[strlen(sysfs_path)]) == 0) { - strfieldcatmax(string, udev_parent.name, maxsize); + strlcat(string, udev_parent.name, maxsize); dbg("substitute parent node name'%s'", udev_parent.name); } else dbg("parent not found in database"); @@ -313,15 +314,16 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, case 'N': if (udev->tmp_node[0] == '\0') { dbg("create temporary device node for callout"); - snprintf(udev->tmp_node, NAME_SIZE, "%s/.tmp-%u-%u", udev_root, major(udev->devt), minor(udev->devt)); - udev->tmp_node[NAME_SIZE] = '\0'; + snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", + udev_root, major(udev->devt), minor(udev->devt)); + udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0'; udev_make_node(udev, udev->tmp_node, udev->devt, 0600, 0, 0); } - strfieldcatmax(string, udev->tmp_node, maxsize); + strlcat(string, udev->tmp_node, maxsize); dbg("substitute temporary device node name '%s'", udev->tmp_node); break; case 'r': - strfieldcatmax(string, udev_root, maxsize); + strlcat(string, udev_root, maxsize); dbg("substitute udev_root '%s'", udev_root); break; default: @@ -332,7 +334,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, if (len > 0) pos[len] = '\0'; - strfieldcatmax(string, tail, maxsize); + strlcat(string, tail, maxsize); } } @@ -344,11 +346,11 @@ static int execute_program(struct udevice *udev, const char *path, char *value, int fds[2]; pid_t pid; char *pos; - char arg[PROGRAM_SIZE]; - char *argv[(PROGRAM_SIZE / 2) + 1]; + char arg[PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; int i; - strfieldcpy(arg, path); + strlcpy(arg, path, sizeof(arg)); i = 0; if (strchr(path, ' ')) { pos = arg; @@ -516,14 +518,14 @@ static int match_sysfs_pairs(struct config_device *dev, struct sysfs_class_devic static int match_id(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { - char path[SYSFS_PATH_MAX]; + char path[PATH_SIZE]; char *temp; /* we have to have a sysfs device for ID to work */ if (!sysfs_device) return -ENODEV; - strfieldcpy(path, sysfs_device->path); + strlcpy(path, sysfs_device->path, sizeof(path)); temp = strrchr(path, '/'); temp++; dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); @@ -535,14 +537,14 @@ static int match_id(struct config_device *dev, struct sysfs_class_device *class_ static int match_place(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { - char path[SYSFS_PATH_MAX]; + char path[PATH_SIZE]; char *temp; /* we have to have a sysfs device for PLACE to work */ if (!sysfs_device) return -ENODEV; - strfieldcpy(path, sysfs_device->path); + strlcpy(path, sysfs_device->path, sizeof(path)); temp = strrchr(path, '/'); dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); if (strstr(temp, dev->place) != NULL) @@ -653,12 +655,12 @@ try_parent: /* execute external program */ if (dev->program[0] != '\0') { - char program[PROGRAM_SIZE]; + char program[PATH_SIZE]; dbg("check " FIELD_PROGRAM); - strfieldcpy(program, dev->program); + strlcpy(program, dev->program, sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - if (execute_program(udev, program, udev->program_result, NAME_SIZE) != 0) { + if (execute_program(udev, program, udev->program_result, sizeof(udev->program_result)) != 0) { dbg(FIELD_PROGRAM " returned nonzero"); goto try_parent; } @@ -707,7 +709,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d if (sysfs_device) { dbg("found devices device: path='%s', bus_id='%s', bus='%s'", sysfs_device->path, sysfs_device->bus_id, sysfs_device->bus); - strfieldcpy(udev->bus_id, sysfs_device->bus_id); + strlcpy(udev->bus_id, sysfs_device->bus_id, sizeof(udev->bus_id)); } dbg("udev->kernel_name='%s'", udev->kernel_name); @@ -739,24 +741,24 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name); } if (dev->owner[0] != '\0') { - strfieldcpy(udev->owner, dev->owner); + strlcpy(udev->owner, dev->owner, sizeof(udev->owner)); apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name); } if (dev->group[0] != '\0') { - strfieldcpy(udev->group, dev->group); + strlcpy(udev->group, dev->group, sizeof(udev->group)); apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); } /* collect symlinks */ if (dev->symlink[0] != '\0') { - char temp[NAME_SIZE]; + char temp[PATH_SIZE]; char *pos, *next; info("configured rule in '%s[%i]' applied, added symlink '%s'", dev->config_file, dev->config_line, dev->symlink); - strfieldcpy(temp, dev->symlink); + strlcpy(temp, dev->symlink, sizeof(temp)); apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); /* add multiple symlinks separated by spaces */ @@ -778,9 +780,9 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d info("configured rule in '%s[%i]' applied, '%s' becomes '%s'", dev->config_file, dev->config_line, udev->kernel_name, dev->name); - strfieldcpy(udev->name, dev->name); + strlcpy(udev->name, dev->name, sizeof(udev->name)); apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); - strfieldcpy(udev->config_file, dev->config_file); + strlcpy(udev->config_file, dev->config_file, sizeof(udev->config_file)); udev->config_line = dev->config_line; if (udev->type != NET) @@ -794,7 +796,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d if (udev->name[0] == '\0') { /* no rule matched, so we use the kernel name */ - strfieldcpy(udev->name, udev->kernel_name); + strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); dbg("no rule found, use kernel name '%s'", udev->name); } diff --git a/namedev.h b/namedev.h index 1d6920cc7c..76caaaa9f7 100644 --- a/namedev.h +++ b/namedev.h @@ -28,14 +28,6 @@ struct sysfs_class_device; -#define BUS_SIZE 32 -#define FILE_SIZE 64 -#define VALUE_SIZE 128 -#define ID_SIZE 64 -#define PLACE_SIZE 64 -#define DRIVER_SIZE 64 -#define PROGRAM_SIZE 128 - #define FIELD_KERNEL "KERNEL" #define FIELD_SUBSYSTEM "SUBSYSTEM" #define FIELD_BUS "BUS" @@ -61,7 +53,7 @@ struct sysfs_class_device; #define RULEFILE_SUFFIX ".rules" struct sysfs_pair { - char file[FILE_SIZE]; + char file[PATH_SIZE]; char value[VALUE_SIZE]; }; @@ -69,16 +61,16 @@ struct config_device { struct list_head node; char kernel[NAME_SIZE]; - char subsystem[SUBSYSTEM_SIZE]; - char bus[BUS_SIZE]; - char id[ID_SIZE]; - char place[PLACE_SIZE]; + char subsystem[NAME_SIZE]; + char bus[NAME_SIZE]; + char id[NAME_SIZE]; + char place[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; - char program[PROGRAM_SIZE]; - char result[PROGRAM_SIZE]; - char driver[DRIVER_SIZE]; - char name[NAME_SIZE]; - char symlink[NAME_SIZE]; + char program[PATH_SIZE]; + char result[PATH_SIZE]; + char driver[NAME_SIZE]; + char name[PATH_SIZE]; + char symlink[PATH_SIZE]; char owner[USER_SIZE]; char group[USER_SIZE]; @@ -88,7 +80,7 @@ struct config_device { int ignore_device; int ignore_remove; - char config_file[NAME_SIZE]; + char config_file[PATH_SIZE]; int config_line; }; diff --git a/namedev_parse.c b/namedev_parse.c index e360565950..942596121e 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -36,6 +36,7 @@ #include #include +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" #include "logging.h" @@ -134,7 +135,7 @@ static int namedev_parse(struct udevice *udev, const char *filename) cur += count+1; lineno++; - if (count >= LINE_SIZE) { + if (count >= sizeof(line)) { info("line too long, rule skipped %s, line %d", filename, lineno); continue; } @@ -172,31 +173,31 @@ static int namedev_parse(struct udevice *udev, const char *filename) break; if (strcasecmp(temp2, FIELD_KERNEL) == 0) { - strfieldcpy(dev.kernel, temp3); + strlcpy(dev.kernel, temp3, sizeof(dev.kernel)); valid = 1; continue; } if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) { - strfieldcpy(dev.subsystem, temp3); + strlcpy(dev.subsystem, temp3, sizeof(dev.subsystem)); valid = 1; continue; } if (strcasecmp(temp2, FIELD_BUS) == 0) { - strfieldcpy(dev.bus, temp3); + strlcpy(dev.bus, temp3, sizeof(dev.bus)); valid = 1; continue; } if (strcasecmp(temp2, FIELD_ID) == 0) { - strfieldcpy(dev.id, temp3); + strlcpy(dev.id, temp3, sizeof(dev.id)); valid = 1; continue; } if (strcasecmp(temp2, FIELD_PLACE) == 0) { - strfieldcpy(dev.place, temp3); + strlcpy(dev.place, temp3, sizeof(dev.place)); valid = 1; continue; } @@ -220,28 +221,28 @@ static int namedev_parse(struct udevice *udev, const char *filename) dbg("error parsing " FIELD_SYSFS " attribute"); continue; } - strfieldcpy(pair->file, attr); - strfieldcpy(pair->value, temp3); + strlcpy(pair->file, attr, sizeof(pair->file)); + strlcpy(pair->value, temp3, sizeof(pair->value)); valid = 1; } continue; } if (strcasecmp(temp2, FIELD_DRIVER) == 0) { - strfieldcpy(dev.driver, temp3); + strlcpy(dev.driver, temp3, sizeof(dev.driver)); valid = 1; continue; } if (strcasecmp(temp2, FIELD_PROGRAM) == 0) { program_given = 1; - strfieldcpy(dev.program, temp3); + strlcpy(dev.program, temp3, sizeof(dev.program)); valid = 1; continue; } if (strcasecmp(temp2, FIELD_RESULT) == 0) { - strfieldcpy(dev.result, temp3); + strlcpy(dev.result, temp3, sizeof(dev.result)); valid = 1; continue; } @@ -260,7 +261,7 @@ static int namedev_parse(struct udevice *udev, const char *filename) } } if (temp3[0] != '\0') - strfieldcpy(dev.name, temp3); + strlcpy(dev.name, temp3, sizeof(dev.name)); else dev.ignore_device = 1; valid = 1; @@ -268,19 +269,19 @@ static int namedev_parse(struct udevice *udev, const char *filename) } if (strcasecmp(temp2, FIELD_SYMLINK) == 0) { - strfieldcpy(dev.symlink, temp3); + strlcpy(dev.symlink, temp3, sizeof(dev.symlink)); valid = 1; continue; } if (strcasecmp(temp2, FIELD_OWNER) == 0) { - strfieldcpy(dev.owner, temp3); + strlcpy(dev.owner, temp3, sizeof(dev.owner)); valid = 1; continue; } if (strcasecmp(temp2, FIELD_GROUP) == 0) { - strfieldcpy(dev.group, temp3); + strlcpy(dev.group, temp3, sizeof(dev.group)); valid = 1; continue; } @@ -330,7 +331,7 @@ static int namedev_parse(struct udevice *udev, const char *filename) } dev.config_line = lineno; - strfieldcpy(dev.config_file, filename); + strlcpy(dev.config_file, filename, sizeof(dev.config_file)); retval = add_config_dev(&dev); if (retval) { dbg("add_config_dev returned with error %d", retval); diff --git a/udev.c b/udev.c index c9461469e5..bf2eb373f8 100644 --- a/udev.c +++ b/udev.c @@ -32,6 +32,7 @@ #include #include "libsysfs/sysfs/libsysfs.h" +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" #include "udev_sysfs.h" @@ -99,7 +100,7 @@ int main(int argc, char *argv[], char *envp[]) struct sysfs_class_device *class_dev; struct sysfs_device *devices_dev; struct udevice udev; - char path[SYSFS_PATH_MAX]; + char path[PATH_SIZE]; const char *error; const char *action; const char *devpath; @@ -164,7 +165,8 @@ int main(int argc, char *argv[], char *envp[]) goto hotplug; } - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); + snprintf(path, sizeof(path), "%s%s", sysfs_path, udev.devpath); + path[sizeof(path)-1] = '\0'; class_dev = wait_class_device_open(path); if (class_dev == NULL) { dbg ("open class device failed"); @@ -206,7 +208,8 @@ int main(int argc, char *argv[], char *envp[]) /* wait for sysfs */ dbg("devices add"); - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); + snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); + path[sizeof(path)-1] = '\0'; devices_dev = wait_devices_device_open(path); if (!devices_dev) { dbg("devices device unavailable (probably remove has beaten us)"); diff --git a/udev.h b/udev.h index 811439faf2..7eb07bf125 100644 --- a/udev.h +++ b/udev.h @@ -33,13 +33,11 @@ #define COMMENT_CHARACTER '#' #define LINE_SIZE 512 -#define NAME_SIZE 256 +#define NAME_SIZE 128 +#define PATH_SIZE 256 #define USER_SIZE 32 - -#define ACTION_SIZE 32 -#define DEVPATH_SIZE 256 -#define SUBSYSTEM_SIZE 32 #define SEQNUM_SIZE 32 +#define VALUE_SIZE 128 #define DEVD_DIR "/etc/dev.d" #define DEVD_SUFFIX ".dev" @@ -58,11 +56,11 @@ enum device_type { }; struct udevice { - char devpath[DEVPATH_SIZE]; - char subsystem[SUBSYSTEM_SIZE]; + char devpath[PATH_SIZE]; + char subsystem[NAME_SIZE]; - char name[NAME_SIZE]; - char devname[NAME_SIZE]; + char name[PATH_SIZE]; + char devname[PATH_SIZE]; struct list_head symlink_list; char owner[USER_SIZE]; char group[USER_SIZE]; @@ -70,13 +68,13 @@ struct udevice { char type; dev_t devt; - char tmp_node[NAME_SIZE]; + char tmp_node[PATH_SIZE]; int partitions; int ignore_remove; int config_line; - char config_file[NAME_SIZE]; - char bus_id[SYSFS_NAME_LEN]; - char program_result[NAME_SIZE]; + char config_file[PATH_SIZE]; + char bus_id[NAME_SIZE]; + char program_result[PATH_SIZE]; char kernel_number[NAME_SIZE]; char kernel_name[NAME_SIZE]; int test_run; @@ -89,11 +87,11 @@ extern int udev_start(void); extern void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix); extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); -extern char sysfs_path[SYSFS_PATH_MAX]; -extern char udev_root[PATH_MAX]; -extern char udev_db_path[PATH_MAX+NAME_MAX]; -extern char udev_config_filename[PATH_MAX+NAME_MAX]; -extern char udev_rules_filename[PATH_MAX+NAME_MAX]; +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]; extern int udev_log; extern int udev_dev_d; extern int udev_hotplug_d; diff --git a/udev_add.c b/udev_add.c index e05710ce81..f47ca25f74 100644 --- a/udev_add.c +++ b/udev_add.c @@ -111,16 +111,16 @@ exit: static int create_node(struct udevice *udev, struct sysfs_class_device *class_dev) { - char filename[NAME_SIZE]; - char partitionname[NAME_SIZE]; + char filename[PATH_SIZE]; + char partitionname[PATH_SIZE]; struct name_entry *name_loop; uid_t uid = 0; gid_t gid = 0; int tail; int i; - snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); - filename[NAME_SIZE-1] = '\0'; + snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); + filename[sizeof(filename)-1] = '\0'; /* create parent directories if needed */ if (strchr(udev->name, '/')) @@ -173,8 +173,8 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de for (i = 1; i <= udev->partitions; i++) { dev_t part_devt; - snprintf(partitionname, NAME_SIZE, "%s%d", filename, i); - partitionname[NAME_SIZE-1] = '\0'; + snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); + partitionname[sizeof(partitionname)-1] = '\0'; part_devt = makedev(major(udev->devt), minor(udev->devt)+1); udev_make_node(udev, partitionname, part_devt, udev->mode, uid, gid); } @@ -183,10 +183,10 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de /* create symlink(s) if requested */ list_for_each_entry(name_loop, &udev->symlink_list, node) { - char linktarget[NAME_SIZE]; + char linktarget[PATH_SIZE]; - snprintf(filename, NAME_SIZE, "%s/%s", udev_root, name_loop->name); - filename[NAME_SIZE-1] = '\0'; + snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); + filename[sizeof(filename)-1] = '\0'; dbg("symlink '%s' to node '%s' requested", filename, udev->name); if (!udev->test_run) @@ -204,11 +204,11 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de } while (name_loop->name[i] != '\0') { if (name_loop->name[i] == '/') - strfieldcat(linktarget, "../"); + strlcat(linktarget, "../", sizeof(linktarget)); i++; } - strfieldcat(linktarget, &udev->name[tail]); + strlcat(linktarget, &udev->name[tail], sizeof(linktarget)); dbg("symlink(%s, %s)", linktarget, filename); if (!udev->test_run) { @@ -242,8 +242,8 @@ static int rename_net_if(struct udevice *udev) } memset(&ifr, 0x00, sizeof(struct ifreq)); - strfieldcpy(ifr.ifr_name, udev->kernel_name); - strfieldcpy(ifr.ifr_newname, udev->name); + strlcpy(ifr.ifr_name, udev->kernel_name, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) @@ -283,8 +283,8 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) "remove might not work for custom names"); /* use full path to the environment */ - snprintf(udev->devname, NAME_SIZE, "%s/%s", udev_root, udev->name); - udev->devname[NAME_SIZE-1] = '\0'; + snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); + udev->devname[sizeof(udev->devname)-1] = '\0'; } else if (udev->type == NET) { /* look if we want to change the name of the netif */ @@ -300,13 +300,13 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) pos = strrchr(udev->devpath, '/'); if (pos != NULL) { pos[1] = '\0'; - strfieldcat(udev->devpath, udev->name); + strlcat(udev->devpath, udev->name, sizeof(udev->devpath)); setenv("DEVPATH", udev->devpath, 1); setenv("INTERFACE", udev->name, 1); } /* use netif name for the environment */ - strfieldcpy(udev->devname, udev->name); + strlcpy(udev->devname, udev->name, sizeof(udev->devname)); } } diff --git a/udev_config.c b/udev_config.c index 5e204488d2..26ecf6291c 100644 --- a/udev_config.c +++ b/udev_config.c @@ -33,6 +33,7 @@ #include #include "libsysfs/sysfs/libsysfs.h" +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" #include "udev_version.h" @@ -40,11 +41,11 @@ #include "namedev.h" /* global variables */ -char sysfs_path[SYSFS_PATH_MAX]; -char udev_root[PATH_MAX]; -char udev_db_path[PATH_MAX+NAME_MAX]; -char udev_rules_filename[PATH_MAX+NAME_MAX]; -char udev_config_filename[PATH_MAX+NAME_MAX]; +char sysfs_path[PATH_SIZE]; +char udev_root[PATH_SIZE]; +char udev_db_path[PATH_SIZE]; +char udev_rules_filename[PATH_SIZE]; +char udev_config_filename[PATH_SIZE]; int udev_log; int udev_dev_d; int udev_hotplug_d; @@ -98,12 +99,11 @@ static int parse_config_file(void) int lineno; int retval = 0; - if (file_map(udev_config_filename, &buf, &bufsize) == 0) { - dbg("reading '%s' as config file", udev_config_filename); - } else { + if (file_map(udev_config_filename, &buf, &bufsize) != 0) { dbg("can't open '%s' as config file", udev_config_filename); return -ENODEV; } + dbg("reading '%s' as config file", udev_config_filename); /* loop through the whole file */ lineno = 0; @@ -114,7 +114,7 @@ static int parse_config_file(void) cur += count+1; lineno++; - if (count >= LINE_SIZE) { + if (count >= sizeof(line)) { info("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); continue; @@ -132,8 +132,7 @@ static int parse_config_file(void) if (bufline[0] == COMMENT_CHARACTER) continue; - strncpy(line, bufline, count); - line[count] = '\0'; + strlcpy(line, bufline, count); temp = line; dbg_parse("read '%s'", temp); @@ -145,19 +144,19 @@ static int parse_config_file(void) dbg_parse("variable='%s', value='%s'", variable, value); if (strcasecmp(variable, "udev_root") == 0) { - strfieldcpy(udev_root, value); + strlcpy(udev_root, value, sizeof(udev_root)); no_trailing_slash(udev_root); continue; } if (strcasecmp(variable, "udev_db") == 0) { - strfieldcpy(udev_db_path, value); + strlcpy(udev_db_path, value, sizeof(udev_db_path)); no_trailing_slash(udev_db_path); continue; } if (strcasecmp(variable, "udev_rules") == 0) { - strfieldcpy(udev_rules_filename, value); + strlcpy(udev_rules_filename, value, sizeof(udev_rules_filename)); no_trailing_slash(udev_rules_filename); continue; } @@ -177,7 +176,7 @@ static void get_dirs(void) char *temp; int retval; - retval = sysfs_get_mnt_path(sysfs_path, SYSFS_PATH_MAX); + retval = sysfs_get_mnt_path(sysfs_path, sizeof(sysfs_path)); if (retval) dbg("sysfs_get_mnt_path failed"); @@ -185,13 +184,13 @@ static void get_dirs(void) if (getenv("UDEV_TEST") != NULL) { temp = getenv("SYSFS_PATH"); if (temp != NULL) { - strfieldcpy(sysfs_path, temp); + strlcpy(sysfs_path, temp, sizeof(sysfs_path)); no_trailing_slash(sysfs_path); } temp = getenv("UDEV_CONFIG_FILE"); if (temp != NULL) - strfieldcpy(udev_config_filename, temp); + strlcpy(udev_config_filename, temp, sizeof(udev_config_filename)); } parse_config_file(); diff --git a/udev_db.c b/udev_db.c index 653d7d0855..806fc71bce 100644 --- a/udev_db.c +++ b/udev_db.c @@ -33,6 +33,7 @@ #include #include "libsysfs/sysfs/libsysfs.h" +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" #include "logging.h" @@ -42,11 +43,11 @@ static int get_db_filename(const char *devpath, char *filename, int len) { - char temp[SYSFS_PATH_MAX]; + char temp[PATH_SIZE]; char *pos; /* replace '/' to transform path into a filename */ - strfieldcpy(temp, devpath); + strlcpy(temp, devpath, sizeof(temp)); pos = strchr(&temp[1], '/'); while (pos) { pos[0] = PATH_TO_NAME_CHAR; @@ -60,14 +61,14 @@ static int get_db_filename(const char *devpath, char *filename, int len) int udev_db_add_device(struct udevice *udev) { - char filename[SYSFS_PATH_MAX]; + char filename[PATH_SIZE]; struct name_entry *name_loop; FILE *f; if (udev->test_run) return 0; - get_db_filename(udev->devpath, filename, SYSFS_PATH_MAX); + get_db_filename(udev->devpath, filename, sizeof(filename)); create_path(filename); @@ -93,8 +94,7 @@ int udev_db_add_device(struct udevice *udev) static int parse_db_file(struct udevice *udev, const char *filename) { - char line[NAME_SIZE]; - char temp[NAME_SIZE]; + char line[PATH_SIZE]; unsigned int major, minor; char *bufline; char *buf; @@ -115,44 +115,38 @@ static int parse_db_file(struct udevice *udev, const char *filename) switch(bufline[0]) { case 'P': - if (count > DEVPATH_SIZE) - count = DEVPATH_SIZE-1; - strncpy(udev->devpath, &bufline[2], count-2); - udev->devpath[count-2] = '\0'; + if (count > sizeof(udev->devpath)) + count = sizeof(udev->devpath)-1; + strlcpy(udev->devpath, &bufline[2], count-2); break; case 'N': - if (count > NAME_SIZE) - count = NAME_SIZE-1; - strncpy(udev->name, &bufline[2], count-2); - udev->name[count-2] = '\0'; + if (count > sizeof(udev->name)) + count = sizeof(udev->name)-1; + strlcpy(udev->name, &bufline[2], count-2); break; case 'M': - if (count > NAME_SIZE) - count = NAME_SIZE-1; - strncpy(temp, &bufline[2], count-2); - temp[count-2] = '\0'; - sscanf(temp, "%u:%u", &major, &minor); + if (count > sizeof(line)) + count = sizeof(line)-1; + strlcpy(line, &bufline[2], count-2); + sscanf(line, "%u:%u", &major, &minor); udev->devt = makedev(major, minor); break; case 'S': - if (count > NAME_SIZE) - count = NAME_SIZE-1; - strncpy(temp, &bufline[2], count-2); - temp[count-2] = '\0'; - name_list_add(&udev->symlink_list, temp, 0); + if (count > sizeof(line)) + count = sizeof(line)-1; + strlcpy(line, &bufline[2], count-2); + name_list_add(&udev->symlink_list, line, 0); break; case 'A': - if (count > NAME_SIZE) - count = NAME_SIZE-1; - strncpy(line, &bufline[2], count-2); - line[count-2] = '\0'; + if (count > sizeof(line)) + count = sizeof(line)-1; + strlcpy(line, &bufline[2], count-2); udev->partitions = atoi(line); break; case 'R': - if (count > NAME_SIZE) - count = NAME_SIZE-1; - strncpy(line, &bufline[2], count-2); - line[count-2] = '\0'; + if (count > sizeof(line)) + count = sizeof(line)-1; + strlcpy(line, &bufline[2], count-2); udev->ignore_remove = atoi(line); break; } @@ -167,9 +161,9 @@ static int parse_db_file(struct udevice *udev, const char *filename) int udev_db_delete_device(struct udevice *udev) { - char filename[SYSFS_PATH_MAX]; + char filename[PATH_SIZE]; - get_db_filename(udev->devpath, filename, SYSFS_PATH_MAX); + get_db_filename(udev->devpath, filename, sizeof(filename)); unlink(filename); return 0; @@ -177,9 +171,9 @@ int udev_db_delete_device(struct udevice *udev) int udev_db_get_device(struct udevice *udev, const char *devpath) { - char filename[SYSFS_PATH_MAX]; + char filename[PATH_SIZE]; - get_db_filename(devpath, filename, SYSFS_PATH_MAX); + get_db_filename(devpath, filename, sizeof(filename)); if (parse_db_file(udev, filename) != 0) return -1; @@ -199,9 +193,9 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) while (1) { struct dirent *ent; - char filename[NAME_SIZE]; - char path[DEVPATH_SIZE]; - char nodename[NAME_SIZE]; + char filename[PATH_SIZE]; + char path[PATH_SIZE]; + char nodename[PATH_SIZE]; char *bufline; char *buf; size_t bufsize; @@ -215,8 +209,8 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) if (ent->d_name[0] == '.') continue; - snprintf(filename, NAME_SIZE, "%s/%s", udev_db_path, ent->d_name); - filename[NAME_SIZE-1] = '\0'; + snprintf(filename, sizeof(filename), "%s/%s", udev_db_path, ent->d_name); + filename[sizeof(filename)-1] = '\0'; dbg("looking at '%s'", filename); if (file_map(filename, &buf, &bufsize) != 0) { @@ -232,21 +226,18 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) switch(bufline[0]) { case 'P': - if (count > DEVPATH_SIZE) - count = DEVPATH_SIZE-1; - strncpy(path, &bufline[2], count-2); - path[count-2] = '\0'; + if (count > sizeof(path)) + count = sizeof(path)-1; + strlcpy(path, &bufline[2], count-2); break; case 'N': case 'S': - if (count > NAME_SIZE) - count = NAME_SIZE-1; - strncpy(nodename, &bufline[2], count-2); - nodename[count-2] = '\0'; + if (count > sizeof(nodename)) + count = sizeof(nodename)-1; + strlcpy(nodename, &bufline[2], count-2); dbg("compare '%s' '%s'", nodename, name); if (strcmp(nodename, name) == 0) { - strncpy(devpath, path, len); - devpath[len] = '\0'; + strlcpy(devpath, path, len); file_unmap(buf, bufsize); closedir(dir); return 0; @@ -275,9 +266,9 @@ int udev_db_dump_names(int (*handler_function)(const char *path, const char *nam while (1) { struct dirent *ent; - char filename[NAME_SIZE]; - char path[DEVPATH_SIZE]; - char nodename[NAME_SIZE]; + char filename[PATH_SIZE]; + char path[PATH_SIZE]; + char nodename[PATH_SIZE]; char *bufline; char *buf; size_t bufsize; @@ -291,8 +282,8 @@ int udev_db_dump_names(int (*handler_function)(const char *path, const char *nam if (ent->d_name[0] == '.') continue; - snprintf(filename, NAME_SIZE, "%s/%s", udev_db_path, ent->d_name); - filename[NAME_SIZE-1] = '\0'; + snprintf(filename, sizeof(filename), "%s/%s", udev_db_path, ent->d_name); + filename[sizeof(filename)-1] = '\0'; dbg("looking at '%s'", filename); if (file_map(filename, &buf, &bufsize) != 0) { @@ -310,16 +301,14 @@ int udev_db_dump_names(int (*handler_function)(const char *path, const char *nam switch(bufline[0]) { case 'P': - if (count > DEVPATH_SIZE) - count = DEVPATH_SIZE-1; - strncpy(path, &bufline[2], count-2); - path[count-2] = '\0'; + if (count > sizeof(path)) + count = sizeof(path)-1; + strlcpy(path, &bufline[2], count-2); break; case 'N': - if (count > NAME_SIZE) - count = NAME_SIZE-1; - strncpy(nodename, &bufline[2], count-2); - nodename[count-2] = '\0'; + if (count > sizeof(nodename)) + count = sizeof(nodename)-1; + strlcpy(nodename, &bufline[2], count-2); break; default: continue; diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index df54515206..0dafe4d077 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -32,16 +32,58 @@ #include "../udev_utils.h" #include "../logging.h" - #ifdef __KLIBC__ #define __OWN_USERDB_PARSER__ #endif + #ifdef USE_STATIC #define __OWN_USERDB_PARSER__ #endif -#ifndef __OWN_USERDB_PARSER__ +#ifndef strlcpy +size_t strlcpy(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ((ch = *p++)) { + if (bytes < size) + *q++ = ch; + bytes++; + } + + *q = '\0'; + return bytes; +} +#endif + +#ifndef strlcat +size_t strlcat(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while (bytes < size && *q) { + q++; + bytes++; + } + while ((ch = *p++)) { + if (bytes < size) + *q++ = ch; + bytes++; + } + + *q = '\0'; + return bytes; +} +#endif + +#ifndef __OWN_USERDB_PARSER__ #include #include #include @@ -107,11 +149,10 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) bufline = &buf[cur]; cur += count+1; - if (count >= LINE_SIZE) + if (count >= sizeof(line)) continue; - strncpy(line, bufline, count); - line[count] = '\0'; + strlcpy(line, bufline, count); pos = line; /* get name */ @@ -158,5 +199,4 @@ gid_t lookup_group(const char *group) id = get_id_by_name(group, GROUP_FILE); return (gid_t) id; } - #endif /* __OWN_USERDB_PARSER__ */ diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 2df2f4429d..65f4e01c23 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -22,7 +22,27 @@ #ifndef _UDEV_LIBC_WRAPPER_H_ #define _UDEV_LIBC_WRAPPER_H_ +#ifdef asmlinkage +# undef asmlinkage +#endif +#ifdef __i386__ +# define asmlinkage __attribute__((regparm(0))) +#endif +#ifndef asmlinkage +# define asmlinkage +#endif + +#include + extern uid_t lookup_user(const char *user); extern gid_t lookup_group(const char *group); +#ifndef strlcat +extern size_t strlcpy(char *dst, const char *src, size_t size); +#endif + +#ifndef strlcat +extern size_t strlcat(char *dst, const char *src, size_t size); +#endif + #endif /* _UDEV_LIBC_WRAPPER_H_ */ diff --git a/udev_multiplex.c b/udev_multiplex.c index 6d7852dbc0..3ef6e1707a 100644 --- a/udev_multiplex.c +++ b/udev_multiplex.c @@ -28,6 +28,7 @@ #include #include "udev.h" +#include "udev_libc_wrapper.h" #include "udev_utils.h" #include "logging.h" @@ -72,22 +73,22 @@ static int run_program(struct udevice *udev, const char *filename) */ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix) { - char dirname[PATH_MAX]; + char dirname[PATH_SIZE]; /* chop the device name up into pieces based on '/' */ if (udev->name[0] != '\0') { - char devname[NAME_SIZE]; + char devname[PATH_SIZE]; char *temp; - strfieldcpy(devname, udev->name); + strlcpy(devname, udev->name, sizeof(devname)); temp = strchr(devname, '/'); while (temp != NULL) { temp[0] = '\0'; /* don't call the subsystem directory here */ if (strcmp(devname, udev->subsystem) != 0) { - snprintf(dirname, PATH_MAX, "%s/%s", basedir, devname); - dirname[PATH_MAX-1] = '\0'; + snprintf(dirname, sizeof(dirname), "%s/%s", basedir, devname); + dirname[sizeof(dirname)-1] = '\0'; call_foreach_file(run_program, udev, dirname, suffix); } @@ -98,18 +99,18 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c } if (udev->name[0] != '\0') { - snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->name); - dirname[PATH_MAX-1] = '\0'; + snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->name); + dirname[sizeof(dirname)-1] = '\0'; call_foreach_file(run_program, udev, dirname, suffix); } if (udev->subsystem[0] != '\0') { - snprintf(dirname, PATH_MAX, "%s/%s", basedir, udev->subsystem); - dirname[PATH_MAX-1] = '\0'; + snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->subsystem); + dirname[sizeof(dirname)-1] = '\0'; call_foreach_file(run_program, udev, dirname, suffix); } - snprintf(dirname, PATH_MAX, "%s/default", basedir); - dirname[PATH_MAX-1] = '\0'; + snprintf(dirname, sizeof(dirname), "%s/default", basedir); + dirname[sizeof(dirname)-1] = '\0'; call_foreach_file(run_program, udev, dirname, suffix); } diff --git a/udev_remove.c b/udev_remove.c index 7a6c032d01..1fd36d24c5 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -30,6 +30,7 @@ #include #include +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" #include "udev_version.h" @@ -69,16 +70,16 @@ static int delete_path(const char *path) static int delete_node(struct udevice *udev) { - char filename[NAME_SIZE]; - char partitionname[NAME_SIZE]; + char filename[PATH_SIZE]; + char partitionname[PATH_SIZE]; struct name_entry *name_loop; struct stat stats; int retval; int i; int num; - snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name); - filename[NAME_SIZE-1] = '\0'; + snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); + filename[sizeof(filename)-1] = '\0'; dbg("checking major/minor of device node '%s'", filename); if (stat(filename, &stats) != 0) @@ -103,8 +104,8 @@ static int delete_node(struct udevice *udev) return -1; } for (i = 1; i <= num; i++) { - snprintf(partitionname, NAME_SIZE, "%s%d", filename, i); - partitionname[NAME_SIZE-1] = '\0'; + snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); + partitionname[sizeof(partitionname)-1] = '\0'; unlink_secure(partitionname); } } @@ -114,8 +115,8 @@ static int delete_node(struct udevice *udev) delete_path(filename); list_for_each_entry(name_loop, &udev->symlink_list, node) { - snprintf(filename, NAME_SIZE, "%s/%s", udev_root, name_loop->name); - filename[NAME_SIZE-1] = '\0'; + snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); + filename[sizeof(filename)-1] = '\0'; dbg("unlinking symlink '%s'", filename); retval = unlink(filename); @@ -157,12 +158,13 @@ int udev_remove_device(struct udevice *udev) temp = strrchr(udev->devpath, '/'); if (temp == NULL) return -ENODEV; - strfieldcpy(udev->name, &temp[1]); + strlcpy(udev->name, &temp[1], sizeof(udev->name)); dbg("'%s' not found in database, falling back on default name", udev->name); } /* use full path to the environment */ - snprintf(udev->devname, NAME_SIZE, "%s/%s", udev_root, udev->name); + snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); + udev->devname[sizeof(udev->devname)-1] = '\0'; return delete_node(udev); } diff --git a/udev_sysfs.c b/udev_sysfs.c index fc7ee885b0..f9ff1ed2f9 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -105,7 +105,7 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev const char **error) { const char *file; - char filename[SYSFS_PATH_MAX]; + char filename[PATH_SIZE]; int loop; file = get_subsystem_specific_file(class_dev->classname); @@ -114,7 +114,8 @@ static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev return 0; } - snprintf(filename, SYSFS_PATH_MAX-1, "%s/%s", class_dev->path, file); + snprintf(filename, sizeof(filename), "%s/%s", class_dev->path, file); + filename[sizeof(filename)-1] = '\0'; dbg("looking at class '%s' for specific file '%s'", class_dev->classname, filename); loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; @@ -363,7 +364,7 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, for (devicefile = device_files; devicefile->bus != NULL; devicefile++) { if (strcmp(devices_dev->bus, devicefile->bus) == 0) { - char filename[SYSFS_PATH_MAX]; + char filename[PATH_SIZE]; struct stat stats; if (devicefile->file == NULL) { @@ -372,7 +373,8 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, } found_bus_type = 1; - snprintf(filename, SYSFS_PATH_MAX-1, "%s/%s", devices_dev->path, devicefile->file); + snprintf(filename, sizeof(filename), "%s/%s", devices_dev->path, devicefile->file); + filename[sizeof(filename)-1] = '\0'; dbg("looking at bus '%s' device for specific file '%s'", devices_dev->bus, filename); if (stat(filename, &stats) == 0) { diff --git a/udev_utils.c b/udev_utils.c index 145f02b5e1..d572581f65 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -31,6 +31,7 @@ #include #include +#include "udev_libc_wrapper.h" #include "udev.h" #include "logging.h" #include "udev_utils.h" @@ -45,10 +46,10 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs INIT_LIST_HEAD(&udev->symlink_list); if (subsystem) - strfieldcpy(udev->subsystem, subsystem); + strlcpy(udev->subsystem, subsystem, sizeof(udev->subsystem)); if (devpath) { - strfieldcpy(udev->devpath, devpath); + strlcpy(udev->devpath, devpath, sizeof(udev->devpath)); no_trailing_slash(udev->devpath); if (strncmp(udev->devpath, "/block/", 7) == 0) @@ -63,7 +64,7 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs /* get kernel name */ pos = strrchr(udev->devpath, '/'); if (pos) { - strfieldcpy(udev->kernel_name, &pos[1]); + strlcpy(udev->kernel_name, &pos[1], sizeof(udev->kernel_name)); dbg("kernel_name='%s'", udev->kernel_name); /* Some block devices have '!' in their name, change that to '/' */ @@ -78,7 +79,7 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs pos = &udev->kernel_name[strlen(udev->kernel_name)]; while (isdigit(pos[-1])) pos--; - strfieldcpy(udev->kernel_number, pos); + strlcpy(udev->kernel_number, pos, sizeof(udev->kernel_number)); dbg("kernel_number='%s'", udev->kernel_number); } } @@ -126,7 +127,7 @@ int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, u int create_path(const char *path) { - char p[NAME_SIZE]; + char p[PATH_SIZE]; char *pos; struct stat stats; @@ -195,19 +196,19 @@ int parse_get_pair(char **orig_string, char **left, char **right) return -ENODEV; /* take the right side and strip off the '"' */ - while (isspace(*string)) + while (isspace(string[0])) ++string; - if (*string == '"') + if (string[0] == '"') ++string; else return -ENODEV; temp = strsep(&string, "\""); - if (!string || *temp == '\0') + if (!string || temp[0] == '\0') return -ENODEV; *right = temp; *orig_string = string; - + return 0; } @@ -292,7 +293,7 @@ int name_list_add(struct list_head *name_list, const char *name, int sort) return -ENOMEM; } - strfieldcpy(new_name->name, name); + strlcpy(new_name->name, name, sizeof(new_name->name)); list_add_tail(&new_name->node, &loop_name->node); return 0; @@ -338,10 +339,10 @@ int call_foreach_file(int (*handler_function)(struct udevice *udev, const char * /* call function for every file in the list */ list_for_each_entry_safe(loop_file, tmp_file, &file_list, node) { - char filename[NAME_SIZE]; + char filename[PATH_SIZE]; - snprintf(filename, NAME_SIZE, "%s/%s", dirname, loop_file->name); - filename[NAME_SIZE-1] = '\0'; + snprintf(filename, sizeof(filename), "%s/%s", dirname, loop_file->name); + filename[sizeof(filename)-1] = '\0'; handler_function(udev, filename); diff --git a/udev_utils.h b/udev_utils.h index 3bb1b25362..c7a41aaa44 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -24,43 +24,9 @@ #include "udev.h" -#define strfieldcpy(to, from) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - strncpy(to, from, sizeof(to)-1); \ -} while (0) - -#define strfieldcat(to, from) \ -do { \ - to[sizeof(to)-1] = '\0'; \ - strncat(to, from, sizeof(to) - strlen(to)-1); \ -} while (0) - -#define strfieldcpymax(to, from, maxsize) \ -do { \ - to[maxsize-1] = '\0'; \ - strncpy(to, from, maxsize-1); \ -} while (0) - -#define strfieldcatmax(to, from, maxsize) \ -do { \ - to[maxsize-1] = '\0'; \ - strncat(to, from, maxsize - strlen(to)-1); \ -} while (0) - -#ifdef asmlinkage -# undef asmlinkage -#endif -#ifdef __i386__ -# define asmlinkage __attribute__((regparm(0))) -#endif -#ifndef asmlinkage -# define asmlinkage -#endif - struct name_entry { struct list_head node; - char name[NAME_SIZE]; + char name[PATH_SIZE]; }; extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); diff --git a/udevd.c b/udevd.c index 1376cf05c7..c2f2dd048b 100644 --- a/udevd.c +++ b/udevd.c @@ -39,6 +39,7 @@ #include #include "list.h" +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_version.h" #include "udev_utils.h" @@ -262,7 +263,7 @@ static int compare_devpath(const char *running, const char *waiting) { int i; - for (i = 0; i < DEVPATH_SIZE; i++) { + for (i = 0; i < PATH_SIZE; i++) { /* identical device event found */ if (running[i] == '\0' && waiting[i] == '\0') return 1; diff --git a/udevinfo.c b/udevinfo.c index e30a036ac6..4d13a5f6dc 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -28,6 +28,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "libsysfs/dlist.h" +#include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" #include "udev_version.h" @@ -35,8 +36,6 @@ #include "logging.h" -#define SYSFS_VALUE_SIZE 256 - #ifdef USE_LOG void log_message (int level, const char *format, ...) { @@ -51,12 +50,12 @@ void log_message (int level, const char *format, ...) static void print_all_attributes(struct dlist *attr_list) { struct sysfs_attribute *attr; - char value[SYSFS_VALUE_SIZE]; + char value[VALUE_SIZE]; int len; dlist_for_each_data(attr_list, attr, struct sysfs_attribute) { if (attr->value != NULL) { - strfieldcpy(value, attr->value); + strlcpy(value, attr->value, sizeof(value)); len = strlen(value); if (len == 0) continue; @@ -193,9 +192,9 @@ int main(int argc, char *argv[], char *envp[]) int root = 0; int attributes = 0; enum query_type query = NONE; - char path[NAME_SIZE] = ""; - char name[NAME_SIZE] = ""; - char temp[NAME_SIZE]; + char path[PATH_SIZE] = ""; + char name[PATH_SIZE] = ""; + char temp[PATH_SIZE]; struct name_entry *name_loop; char *pos; int retval = 0; @@ -215,12 +214,12 @@ int main(int argc, char *argv[], char *envp[]) switch (option) { case 'n': dbg("udev name: %s\n", optarg); - strfieldcpy(name, optarg); + strlcpy(name, optarg, sizeof(name)); break; case 'p': dbg("udev path: %s\n", optarg); - strfieldcpy(path, optarg); + strlcpy(path, optarg, sizeof(path)); break; case 'q': @@ -284,7 +283,7 @@ int main(int argc, char *argv[], char *envp[]) if (path[0] != '/') { /* prepend '/' if missing */ strcpy(temp, "/"); - strfieldcat(temp, path); + strlcpy(temp, path, sizeof(temp)); pos = temp; } else { pos = path; @@ -299,7 +298,7 @@ int main(int argc, char *argv[], char *envp[]) } if (name[0] != '\0') { - char devpath[NAME_SIZE]; + char devpath[PATH_SIZE]; int len; /* remove udev_root if given */ @@ -309,7 +308,7 @@ int main(int argc, char *argv[], char *envp[]) } else pos = name; - retval = udev_db_search_name(devpath, DEVPATH_SIZE, pos); + retval = udev_db_search_name(devpath, sizeof(devpath), pos); if (retval != 0) { printf("device not found in database\n"); goto exit; @@ -360,9 +359,9 @@ print: } else { if (strncmp(path, sysfs_path, strlen(sysfs_path)) != 0) { /* prepend sysfs mountpoint if not given */ - strfieldcpy(temp, path); - strfieldcpy(path, sysfs_path); - strfieldcat(path, temp); + snprintf(temp, sizeof(temp), "%s%s", sysfs_path, path); + temp[sizeof(temp)-1] = '\0'; + strlcpy(path, temp, sizeof(temp)); } print_device_chain(path); goto exit; diff --git a/udevstart.c b/udevstart.c index 97d38490ae..6b032a1999 100644 --- a/udevstart.c +++ b/udevstart.c @@ -36,11 +36,12 @@ #include #include "libsysfs/sysfs/libsysfs.h" +#include "udev_libc_wrapper.h" +#include "udev.h" #include "logging.h" #include "namedev.h" #include "udev_utils.h" #include "list.h" -#include "udev.h" #ifdef USE_LOG void log_message(int level, const char *format, ...) @@ -50,8 +51,8 @@ void log_message(int level, const char *format, ...) struct device { struct list_head list; - char path[DEVPATH_SIZE]; - char subsys[SUBSYSTEM_SIZE]; + char path[PATH_SIZE]; + char subsys[NAME_SIZE]; }; /* sort files in lexical order */ @@ -74,8 +75,8 @@ static int device_list_insert(const char *path, char *subsystem, struct list_hea return -ENOMEM; } - strfieldcpy(new_device->path, path); - strfieldcpy(new_device->subsys, subsystem); + strlcpy(new_device->path, path, sizeof(new_device->path)); + strlcpy(new_device->subsys, subsystem, sizeof(new_device->subsys)); list_add_tail(&new_device->list, &loop_device->list); dbg("add '%s' from subsys '%s'", new_device->path, new_device->subsys); return 0; @@ -173,11 +174,11 @@ static void exec_list(struct list_head *device_list) static int has_devt(const char *directory) { - char filename[NAME_SIZE]; + char filename[PATH_SIZE]; struct stat statbuf; - snprintf(filename, NAME_SIZE, "%s/dev", directory); - filename[NAME_SIZE-1] = '\0'; + snprintf(filename, sizeof(filename), "%s/dev", directory); + filename[sizeof(filename)-1] = '\0'; if (stat(filename, &statbuf) == 0) return 1; @@ -187,26 +188,26 @@ static int has_devt(const char *directory) static void udev_scan_block(void) { - char base[NAME_SIZE]; + char base[PATH_SIZE]; DIR *dir; struct dirent *dent; LIST_HEAD(device_list); - snprintf(base, DEVPATH_SIZE, "%s/block", sysfs_path); - base[DEVPATH_SIZE-1] = '\0'; + snprintf(base, sizeof(base), "%s/block", sysfs_path); + base[sizeof(base)-1] = '\0'; dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[DEVPATH_SIZE]; + char dirname[PATH_SIZE]; DIR *dir2; struct dirent *dent2; if (dent->d_name[0] == '.') continue; - snprintf(dirname, NAME_SIZE, "%s/%s", base, dent->d_name); - dirname[NAME_SIZE-1] = '\0'; + snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); + dirname[sizeof(dirname)-1] = '\0'; if (has_devt(dirname)) device_list_insert(dirname, "block", &device_list); else @@ -216,13 +217,13 @@ static void udev_scan_block(void) dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[DEVPATH_SIZE]; + char dirname2[PATH_SIZE]; if (dent2->d_name[0] == '.') continue; - snprintf(dirname2, DEVPATH_SIZE, "%s/%s", dirname, dent2->d_name); - dirname2[DEVPATH_SIZE-1] = '\0'; + snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name); + dirname2[sizeof(dirname2)-1] = '\0'; if (has_devt(dirname2)) device_list_insert(dirname2, "block", &device_list); @@ -237,37 +238,37 @@ static void udev_scan_block(void) static void udev_scan_class(void) { - char base[DEVPATH_SIZE]; + char base[PATH_SIZE]; DIR *dir; struct dirent *dent; LIST_HEAD(device_list); - snprintf(base, DEVPATH_SIZE, "%s/class", sysfs_path); - base[DEVPATH_SIZE-1] = '\0'; + snprintf(base, sizeof(base), "%s/class", sysfs_path); + base[sizeof(base)-1] = '\0'; dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[DEVPATH_SIZE]; + char dirname[PATH_SIZE]; DIR *dir2; struct dirent *dent2; if (dent->d_name[0] == '.') continue; - snprintf(dirname, DEVPATH_SIZE, "%s/%s", base, dent->d_name); - dirname[DEVPATH_SIZE-1] = '\0'; + snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); + dirname[sizeof(dirname)-1] = '\0'; dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[DEVPATH_SIZE]; + char dirname2[PATH_SIZE]; if (dent2->d_name[0] == '.') continue; - snprintf(dirname2, DEVPATH_SIZE, "%s/%s", dirname, dent2->d_name); - dirname2[DEVPATH_SIZE-1] = '\0'; + snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name); + dirname2[sizeof(dirname2)-1] = '\0'; /* pass the net class as it is */ if (strcmp(dent->d_name, "net") == 0) diff --git a/udevtest.c b/udevtest.c index 084fde0706..5ce2570058 100644 --- a/udevtest.c +++ b/udevtest.c @@ -1,5 +1,5 @@ /* - * udev.c + * udevtest.c * * Userspace devfs * @@ -53,8 +53,8 @@ int main(int argc, char *argv[], char *envp[]) { struct sysfs_class_device *class_dev; char *devpath; - char path[SYSFS_PATH_MAX]; - char temp[NAME_SIZE]; + char path[PATH_SIZE]; + char temp[PATH_SIZE]; struct udevice udev; char *subsystem = NULL; @@ -69,18 +69,16 @@ int main(int argc, char *argv[], char *envp[]) udev_init_config(); /* remove sysfs_path if given */ - if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) { + if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) devpath = &argv[1][strlen(sysfs_path)] ; - } else if (argv[1][0] != '/') { /* prepend '/' if missing */ - strfieldcpy(temp, "/"); - strfieldcat(temp, argv[1]); + snprintf(temp, sizeof(temp), "/%s", argv[1]); + temp[sizeof(temp)-1] = '\0'; devpath = temp; - } else { + } else devpath = argv[1]; - } info("looking at '%s'", devpath); @@ -100,7 +98,8 @@ int main(int argc, char *argv[], char *envp[]) } /* open the device */ - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); + snprintf(path, sizeof(path), "%s%s", sysfs_path, udev.devpath); + path[sizeof(path)-1] = '\0'; class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { info("sysfs_open_class_device_path failed"); -- cgit v1.2.3-54-g00ecf From 472419869c387bb0963d8cfecca997b8154f4d44 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 7 Mar 2005 05:56:40 +0100 Subject: [PATCH] rename device_list->list to device_list->node --- udevstart.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/udevstart.c b/udevstart.c index 6b032a1999..7564c3de03 100644 --- a/udevstart.c +++ b/udevstart.c @@ -50,7 +50,7 @@ void log_message(int level, const char *format, ...) #endif struct device { - struct list_head list; + struct list_head node; char path[PATH_SIZE]; char subsys[NAME_SIZE]; }; @@ -63,7 +63,7 @@ static int device_list_insert(const char *path, char *subsystem, struct list_hea dbg("insert: '%s'\n", path); - list_for_each_entry(loop_device, device_list, list) { + list_for_each_entry(loop_device, device_list, node) { if (strcmp(loop_device->path, path) > 0) { break; } @@ -77,7 +77,7 @@ static int device_list_insert(const char *path, char *subsystem, struct list_hea strlcpy(new_device->path, path, sizeof(new_device->path)); strlcpy(new_device->subsys, subsystem, sizeof(new_device->subsys)); - list_add_tail(&new_device->list, &loop_device->list); + list_add_tail(&new_device->node, &loop_device->node); dbg("add '%s' from subsys '%s'", new_device->path, new_device->subsys); return 0; } @@ -136,11 +136,11 @@ static void exec_list(struct list_head *device_list) int i; /* handle the "first" type devices first */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { for (i = 0; first_list[i] != NULL; i++) { if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { add_device(loop_device->path, loop_device->subsys); - list_del(&loop_device->list); + list_del(&loop_device->node); free(loop_device); break; } @@ -148,7 +148,7 @@ static void exec_list(struct list_head *device_list) } /* handle the devices we are allowed to, excluding the "last" type devices */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { int found = 0; for (i = 0; last_list[i] != NULL; i++) { if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) { @@ -160,14 +160,14 @@ static void exec_list(struct list_head *device_list) continue; add_device(loop_device->path, loop_device->subsys); - list_del(&loop_device->list); + list_del(&loop_device->node); free(loop_device); } /* handle the rest of the devices left over, if any */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, list) { + list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { add_device(loop_device->path, loop_device->subsys); - list_del(&loop_device->list); + list_del(&loop_device->node); free(loop_device); } } -- cgit v1.2.3-54-g00ecf From 4272779706c53c635a3fa5431a4e8791402183b4 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 7 Mar 2005 07:04:46 +0100 Subject: [PATCH] klibc: version 0.214 --- klibc/MCONFIG | 2 +- klibc/Makefile | 2 +- klibc/include/klibc/compiler.h | 6 +++--- klibc/klcc.in | 16 ++++++++++++++-- klibc/klibc/arch/sparc/MCONFIG | 2 +- klibc/klibc/arch/sparc/Makefile.inc | 7 ++++++- klibc/klibc/arch/sparc/crt0.S | 2 +- klibc/version | 2 +- 8 files changed, 28 insertions(+), 11 deletions(-) diff --git a/klibc/MCONFIG b/klibc/MCONFIG index c833499483..7a24b821ad 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -59,7 +59,7 @@ HOST_LIBS = # Static library paths CRT0 = $(KLIBOBJ)/crt0.o KLIBC = $(KLIBOBJ)/libc.a -LIBGCC = $(shell $(CC) --print-libgcc) +LIBGCC = $(shell $(CC) $(REQFLAGS) $(OPTFLAGS) --print-libgcc) # Shared library paths CRTSHARED = $(KLIBOBJ)/interp.o diff --git a/klibc/Makefile b/klibc/Makefile index 812ea92f47..a512aa308a 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -54,7 +54,7 @@ local-install: $(CROSS)klcc mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin - set -xe ; for d in linux asm-$(ARCH) asm-generic $(ASMARCH); do \ + set -xe ; for d in linux scsi asm-$(ARCH) asm-generic $(ASMARCH); do \ mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \ for r in $(KRNLSRC)/include $(KRNLOBJ)/include $(KRNLOBJ)/include2 ; do \ [ ! -d $$r/$$d ] || \ diff --git a/klibc/include/klibc/compiler.h b/klibc/include/klibc/compiler.h index 823996e777..ee697adf08 100644 --- a/klibc/include/klibc/compiler.h +++ b/klibc/include/klibc/compiler.h @@ -22,7 +22,7 @@ /* How to declare a function that *must* be inlined */ #ifdef __GNUC__ -# if __GNUC_MAJOR__ >= 3 +# if __GNUC__ >= 3 # define __must_inline static __inline__ __attribute__((always_inline)) # else # define __must_inline extern __inline__ @@ -84,14 +84,14 @@ #endif /* malloc() function (returns unaliased pointer) */ -#if defined(__GNUC__) && (__GNUC_MAJOR__ >= 3) +#if defined(__GNUC__) && (__GNUC__ >= 3) # define __mallocfunc __attribute__((malloc)) #else # define __mallocfunc #endif /* likely/unlikely */ -#if defined(__GNUC__) && (__GNUC_MAJOR__ > 2 || (__GNUC_MAJOR__ == 2 && __GNUC_MINOR__ >= 95)) +#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) # define __likely(x) __builtin_expect((x), 1) # define __unlikely(x) __builtin_expect((x), 0) #else diff --git a/klibc/klcc.in b/klibc/klcc.in index bdd03e73b3..d8721c9a6b 100644 --- a/klibc/klcc.in +++ b/klibc/klcc.in @@ -77,6 +77,11 @@ sub mysystem(@) { return system(@_); } +# +# Initialization +# +open(NULL, '+<', '/dev/null') or die "$0: cannot open /dev/null\n"; + # # Begin parsing options. # @@ -191,10 +196,17 @@ if ( $operation ne '' ) { } } + # Get the libgcc pathname for the *current* gcc + open(LIBGCC, '-|', $CC, @ccopt, '-print-libgcc-file-name') + or die "$0: cannot get libgcc filename\n"; + $libgcc = ; + chomp $libgcc; + close(LIBGCC); + if ( $shared ) { - $rv = mysystem($LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs, @sharedlib); + $rv = mysystem($LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs, @sharedlib, $libgcc); } else { - $rv = mysystem($LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs, @staticlib); + $rv = mysystem($LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs, @staticlib, $libgcc); } unlink(@rmobjs); diff --git a/klibc/klibc/arch/sparc/MCONFIG b/klibc/klibc/arch/sparc/MCONFIG index 55f8b198c2..3a5cbaa2e7 100644 --- a/klibc/klibc/arch/sparc/MCONFIG +++ b/klibc/klibc/arch/sparc/MCONFIG @@ -7,7 +7,7 @@ # accordingly. # -OPTFLAGS = -Os +OPTFLAGS = -Os -m32 -mptr32 BITSIZE = 32 # Extra linkflags when building the shared version of the library diff --git a/klibc/klibc/arch/sparc/Makefile.inc b/klibc/klibc/arch/sparc/Makefile.inc index 6ea66114fa..bea1dbc94e 100644 --- a/klibc/klibc/arch/sparc/Makefile.inc +++ b/klibc/klibc/arch/sparc/Makefile.inc @@ -16,7 +16,12 @@ ARCHOBJS = \ arch/$(ARCH)/umul.o \ arch/$(ARCH)/setjmp.o \ arch/$(ARCH)/syscall.o \ - arch/$(ARCH)/sysfork.o + arch/$(ARCH)/sysfork.o \ + libgcc/__divdi3.o \ + libgcc/__moddi3.o \ + libgcc/__udivdi3.o \ + libgcc/__umoddi3.o \ + libgcc/__udivmoddi4.o arch/$(ARCH)/sdiv.S: arch/$(ARCH)/divrem.m4 @echo 'building $@ from $^' diff --git a/klibc/klibc/arch/sparc/crt0.S b/klibc/klibc/arch/sparc/crt0.S index 148cb4b4e9..63db188961 100644 --- a/klibc/klibc/arch/sparc/crt0.S +++ b/klibc/klibc/arch/sparc/crt0.S @@ -1,2 +1,2 @@ #define TARGET_PTR_SIZE 32 -#include "arch/sparc/crt0i.S" +#include "crt0i.S" diff --git a/klibc/version b/klibc/version index 1f39702100..136a629e2d 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.211 +0.214 -- cgit v1.2.3-54-g00ecf From 83b069c6e695446688715cc4404bcfaa3288e649 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 8 Mar 2005 01:09:45 +0100 Subject: [PATCH] cleanup list.h --- list.h | 195 +++++++---------------------------------------------------------- 1 file changed, 20 insertions(+), 175 deletions(-) diff --git a/list.h b/list.h index 07d474888e..8626630f6b 100644 --- a/list.h +++ b/list.h @@ -1,32 +1,25 @@ -/* +/* * Copied from the Linux kernel source tree, version 2.6.0-test1. * * Licensed under the GPL v2 as per the whole kernel source tree. * - * Ripped out the rcu stuff, as it's not needed. */ -#ifndef _LINUX_LIST_H -#define _LINUX_LIST_H +#ifndef _LIST_H +#define _LIST_H -//#include /** * container_of - cast a member of a structure out to the containing structure * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. * */ #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) -//#include -static inline void prefetch(const void *x) {;} - -//#include - /* * These are non-NULL pointers that will result in page faults * under normal circumstances, used to verify that nobody uses @@ -143,8 +136,8 @@ static inline void list_del_init(struct list_head *entry) */ static inline void list_move(struct list_head *list, struct list_head *head) { - __list_del(list->prev, list->next); - list_add(list, head); + __list_del(list->prev, list->next); + list_add(list, head); } /** @@ -155,8 +148,8 @@ static inline void list_move(struct list_head *list, struct list_head *head) static inline void list_move_tail(struct list_head *list, struct list_head *head) { - __list_del(list->prev, list->next); - list_add_tail(list, head); + __list_del(list->prev, list->next); + list_add_tail(list, head); } /** @@ -224,8 +217,8 @@ static inline void list_splice_init(struct list_head *list, * @head: the head for your list. */ #define list_for_each(pos, head) \ - for (pos = (head)->next, prefetch(pos->next); pos != (head); \ - pos = pos->next, prefetch(pos->next)) + for (pos = (head)->next; pos != (head); \ + pos = pos->next) /** * __list_for_each - iterate over a list @@ -233,7 +226,7 @@ static inline void list_splice_init(struct list_head *list, * @head: the head for your list. * * This variant differs from list_for_each() in that it's the - * simplest possible list iteration code, no prefetching is done. + * simplest possible list iteration code. * Use this for code that knows the list to be very short (empty * or 1 entry) most of the time. */ @@ -246,9 +239,8 @@ static inline void list_splice_init(struct list_head *list, * @head: the head for your list. */ #define list_for_each_prev(pos, head) \ - for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \ - pos = pos->prev, prefetch(pos->prev)) - + for (pos = (head)->prev; pos != (head); pos = pos->prev) + /** * list_for_each_safe - iterate over a list safe against removal of list entry * @pos: the &struct list_head to use as a loop counter. @@ -266,11 +258,9 @@ static inline void list_splice_init(struct list_head *list, * @member: the name of the list_struct within the struct. */ #define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - prefetch(pos->member.next); \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member), \ - prefetch(pos->member.next)) + pos = list_entry(pos->member.next, typeof(*pos), member)) /** * list_for_each_entry_reverse - iterate backwards over list of given type. @@ -279,12 +269,9 @@ static inline void list_splice_init(struct list_head *list, * @member: the name of the list_struct within the struct. */ #define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member), \ - prefetch(pos->member.prev); \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member), \ - prefetch(pos->member.prev)) - + pos = list_entry(pos->member.prev, typeof(*pos), member)) /** * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry @@ -299,146 +286,4 @@ static inline void list_splice_init(struct list_head *list, &pos->member != (head); \ pos = n, n = list_entry(n->member.next, typeof(*n), member)) -/* - * Double linked lists with a single pointer list head. - * Mostly useful for hash tables where the two pointer list head is - * too wasteful. - * You lose the ability to access the tail in O(1). - */ - -struct hlist_head { - struct hlist_node *first; -}; - -struct hlist_node { - struct hlist_node *next, **pprev; -}; - -#define HLIST_HEAD_INIT { .first = NULL } -#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } -#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) -#define INIT_HLIST_NODE(ptr) ((ptr)->next = NULL, (ptr)->pprev = NULL) - -static __inline__ int hlist_unhashed(struct hlist_node *h) -{ - return !h->pprev; -} - -static __inline__ int hlist_empty(struct hlist_head *h) -{ - return !h->first; -} - -static __inline__ void __hlist_del(struct hlist_node *n) -{ - struct hlist_node *next = n->next; - struct hlist_node **pprev = n->pprev; - *pprev = next; - if (next) - next->pprev = pprev; -} - -static __inline__ void hlist_del(struct hlist_node *n) -{ - __hlist_del(n); - n->next = LIST_POISON1; - n->pprev = LIST_POISON2; -} - -static __inline__ void hlist_del_init(struct hlist_node *n) -{ - if (n->pprev) { - __hlist_del(n); - INIT_HLIST_NODE(n); - } -} - -static __inline__ void hlist_add_head(struct hlist_node *n, struct hlist_head *h) -{ - struct hlist_node *first = h->first; - n->next = first; - if (first) - first->pprev = &n->next; - h->first = n; - n->pprev = &h->first; -} - -/* next must be != NULL */ -static __inline__ void hlist_add_before(struct hlist_node *n, struct hlist_node *next) -{ - n->pprev = next->pprev; - n->next = next; - next->pprev = &n->next; - *(n->pprev) = n; -} - -static __inline__ void hlist_add_after(struct hlist_node *n, - struct hlist_node *next) -{ - next->next = n->next; - *(next->pprev) = n; - n->next = next; -} - -#define hlist_entry(ptr, type, member) container_of(ptr,type,member) - -/* Cannot easily do prefetch unfortunately */ -#define hlist_for_each(pos, head) \ - for (pos = (head)->first; pos && ({ prefetch(pos->next); 1; }); \ - pos = pos->next) - -#define hlist_for_each_safe(pos, n, head) \ - for (pos = (head)->first; n = pos ? pos->next : 0, pos; \ - pos = n) - -/** - * hlist_for_each_entry - iterate over list of given type - * @tpos: the type * to use as a loop counter. - * @pos: the &struct hlist_node to use as a loop counter. - * @head: the head for your list. - * @member: the name of the hlist_node within the struct. - */ -#define hlist_for_each_entry(tpos, pos, head, member) \ - for (pos = (head)->first; \ - pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) - -/** - * hlist_for_each_entry_continue - iterate over a hlist continuing after existing point - * @tpos: the type * to use as a loop counter. - * @pos: the &struct hlist_node to use as a loop counter. - * @member: the name of the hlist_node within the struct. - */ -#define hlist_for_each_entry_continue(tpos, pos, member) \ - for (pos = (pos)->next; \ - pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) - -/** - * hlist_for_each_entry_from - iterate over a hlist continuing from existing point - * @tpos: the type * to use as a loop counter. - * @pos: the &struct hlist_node to use as a loop counter. - * @member: the name of the hlist_node within the struct. - */ -#define hlist_for_each_entry_from(tpos, pos, member) \ - for (; pos && ({ prefetch(pos->next); 1;}) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = pos->next) - -/** - * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @tpos: the type * to use as a loop counter. - * @pos: the &struct hlist_node to use as a loop counter. - * @n: another &struct hlist_node to use as temporary storage - * @head: the head for your list. - * @member: the name of the hlist_node within the struct. - */ -#define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ - for (pos = (head)->first; \ - pos && ({ n = pos->next; 1; }) && \ - ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ - pos = n) - -#endif +#endif /* _LIST_H */ -- cgit v1.2.3-54-g00ecf From 2b40452ab3146322a88ae201a2eb534204c75d63 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 9 Mar 2005 02:12:22 +0100 Subject: [PATCH] fix segfaulting udev while DRIVER matching Don't try to match against values of a nonexistent physical device. Discovered by: Thomas Breitner . --- namedev.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/namedev.c b/namedev.c index 9c73c08149..4b3674935a 100644 --- a/namedev.c +++ b/namedev.c @@ -516,15 +516,11 @@ static int match_sysfs_pairs(struct config_device *dev, struct sysfs_class_devic return 0; } -static int match_id(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) +static int match_id(struct config_device *dev, struct sysfs_device *sysfs_device) { char path[PATH_SIZE]; char *temp; - /* we have to have a sysfs device for ID to work */ - if (!sysfs_device) - return -ENODEV; - strlcpy(path, sysfs_device->path, sizeof(path)); temp = strrchr(path, '/'); temp++; @@ -535,15 +531,11 @@ static int match_id(struct config_device *dev, struct sysfs_class_device *class_ return 0; } -static int match_place(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) +static int match_place(struct config_device *dev, struct sysfs_device *sysfs_device) { char path[PATH_SIZE]; char *temp; - /* we have to have a sysfs device for PLACE to work */ - if (!sysfs_device) - return -ENODEV; - strlcpy(path, sysfs_device->path, sizeof(path)); temp = strrchr(path, '/'); dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); @@ -588,6 +580,10 @@ static int match_rule(struct udevice *udev, struct config_device *dev, while (1) { /* check for matching driver */ if (dev->driver[0] != '\0') { + if (sysfs_device == NULL) { + dbg("device has no sysfs_device"); + goto try_parent; + } dbg("check for " FIELD_DRIVER " dev->driver='%s' sysfs_device->driver_name='%s'", dev->driver, sysfs_device->driver_name); if (strcmp_pattern(dev->driver, sysfs_device->driver_name) != 0) { @@ -600,7 +596,7 @@ static int match_rule(struct udevice *udev, struct config_device *dev, /* check for matching bus value */ if (dev->bus[0] != '\0') { if (sysfs_device == NULL) { - dbg("device has no bus"); + dbg("device has no sysfs_device"); goto try_parent; } dbg("check for " FIELD_BUS " dev->bus='%s' sysfs_device->bus='%s'", @@ -614,8 +610,12 @@ static int match_rule(struct udevice *udev, struct config_device *dev, /* check for matching bus id */ if (dev->id[0] != '\0') { + if (sysfs_device == NULL) { + dbg("device has no sysfs_device"); + goto try_parent; + } dbg("check " FIELD_ID); - if (match_id(dev, class_dev, sysfs_device) != 0) { + if (match_id(dev, sysfs_device) != 0) { dbg(FIELD_ID " is not matching"); goto try_parent; } @@ -624,8 +624,12 @@ static int match_rule(struct udevice *udev, struct config_device *dev, /* check for matching place of device */ if (dev->place[0] != '\0') { + if (sysfs_device == NULL) { + dbg("device has no sysfs_device"); + goto try_parent; + } dbg("check " FIELD_PLACE); - if (match_place(dev, class_dev, sysfs_device) != 0) { + if (match_place(dev, sysfs_device) != 0) { dbg(FIELD_PLACE " is not matching"); goto try_parent; } -- cgit v1.2.3-54-g00ecf From 138068d690d79e71239d3e776f01560afbabc1cb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 10 Mar 2005 00:58:01 +0100 Subject: [PATCH] fix ia64 compile --- extras/volume_id/volume_id/cramfs.c | 2 +- extras/volume_id/volume_id/ext.c | 2 +- extras/volume_id/volume_id/fat.c | 6 +++--- extras/volume_id/volume_id/hfs.c | 4 ++-- extras/volume_id/volume_id/highpoint.c | 2 +- extras/volume_id/volume_id/hpfs.c | 2 +- extras/volume_id/volume_id/iso9660.c | 4 ++-- extras/volume_id/volume_id/jfs.c | 2 +- extras/volume_id/volume_id/linux_raid.c | 2 +- extras/volume_id/volume_id/linux_swap.c | 2 +- extras/volume_id/volume_id/lvm.c | 4 ++-- extras/volume_id/volume_id/mac.c | 4 ++-- extras/volume_id/volume_id/minix.c | 2 +- extras/volume_id/volume_id/msdos.c | 10 +++++----- extras/volume_id/volume_id/ntfs.c | 6 +++--- extras/volume_id/volume_id/reiserfs.c | 2 +- extras/volume_id/volume_id/romfs.c | 2 +- extras/volume_id/volume_id/sysv.c | 2 +- extras/volume_id/volume_id/udf.c | 2 +- extras/volume_id/volume_id/ufs.c | 2 +- extras/volume_id/volume_id/util.c | 6 +++--- extras/volume_id/volume_id/volume_id.h | 2 +- extras/volume_id/volume_id/xfs.c | 2 +- libsysfs/sysfs_dir.c | 2 +- namedev_parse.c | 2 +- udev_libc_wrapper.h | 22 ++++++++++++++++------ udevd.c | 3 ++- 27 files changed, 57 insertions(+), 46 deletions(-) diff --git a/extras/volume_id/volume_id/cramfs.c b/extras/volume_id/volume_id/cramfs.c index a8058646d1..0c76860013 100644 --- a/extras/volume_id/volume_id/cramfs.c +++ b/extras/volume_id/volume_id/cramfs.c @@ -58,7 +58,7 @@ int volume_id_probe_cramfs(struct volume_id *id, __u64 off) { struct cramfs_super *cs; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); if (cs == NULL) diff --git a/extras/volume_id/volume_id/ext.c b/extras/volume_id/volume_id/ext.c index b7bdf05d97..4783642114 100644 --- a/extras/volume_id/volume_id/ext.c +++ b/extras/volume_id/volume_id/ext.c @@ -66,7 +66,7 @@ int volume_id_probe_ext(struct volume_id *id, __u64 off) { struct ext2_super_block *es; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); if (es == NULL) diff --git a/extras/volume_id/volume_id/fat.c b/extras/volume_id/volume_id/fat.c index 58aa2aba05..f6d3699758 100644 --- a/extras/volume_id/volume_id/fat.c +++ b/extras/volume_id/volume_id/fat.c @@ -159,7 +159,7 @@ int volume_id_probe_vfat(struct volume_id *id, __u64 off) __u32 next; int maxloop; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); if (vs == NULL) @@ -257,7 +257,7 @@ valid: /* the label may be an attribute in the root directory */ root_start = (reserved + fat_size) * sector_size; - dbg("root dir start 0x%llx", root_start); + dbg("root dir start 0x%llx", (unsigned long long) root_start); root_dir_entries = le16_to_cpu(vs->dir_entries); dbg("expected entries 0x%x", root_dir_entries); @@ -302,7 +302,7 @@ fat32: dbg("next cluster %u", next); next_sect_off = (next - 2) * vs->sectors_per_cluster; next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%llx", next_off); + dbg("cluster offset 0x%llx", (unsigned long long) next_off); /* get cluster */ buf = volume_id_get_buffer(id, off + next_off, buf_size); diff --git a/extras/volume_id/volume_id/hfs.c b/extras/volume_id/volume_id/hfs.c index 327461c676..8c40975036 100644 --- a/extras/volume_id/volume_id/hfs.c +++ b/extras/volume_id/volume_id/hfs.c @@ -173,7 +173,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; const __u8 *buf; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) @@ -196,7 +196,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) off += (alloc_first_block * 512) + (embed_first_block * alloc_block_size); - dbg("hfs wrapped hfs+ found at offset 0x%llx", off); + dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/volume_id/highpoint.c b/extras/volume_id/volume_id/highpoint.c index e13fd6de61..72f7d28429 100644 --- a/extras/volume_id/volume_id/highpoint.c +++ b/extras/volume_id/volume_id/highpoint.c @@ -54,7 +54,7 @@ int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off) { const __u8 *buf; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); if (buf == NULL) diff --git a/extras/volume_id/volume_id/hpfs.c b/extras/volume_id/volume_id/hpfs.c index 3aa95fa839..96c63d5e1d 100644 --- a/extras/volume_id/volume_id/hpfs.c +++ b/extras/volume_id/volume_id/hpfs.c @@ -51,7 +51,7 @@ int volume_id_probe_hpfs(struct volume_id *id, __u64 off) { struct hpfs_super *hs; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); if (hs == NULL) diff --git a/extras/volume_id/volume_id/iso9660.c b/extras/volume_id/volume_id/iso9660.c index ffccf609dc..d4ccb9db9c 100644 --- a/extras/volume_id/volume_id/iso9660.c +++ b/extras/volume_id/volume_id/iso9660.c @@ -68,7 +68,7 @@ int volume_id_probe_iso9660(struct volume_id *id, __u64 off) { union iso_super_block *is; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); is = (union iso_super_block *) volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); if (is == NULL) @@ -90,7 +90,7 @@ int volume_id_probe_iso9660(struct volume_id *id, __u64 off) if (is == NULL || is->iso.type == ISO_VD_END) break; if (is->iso.type == ISO_VD_SUPPLEMENTARY) { - dbg("found ISO supplementary VD at offset 0x%llx", off + vd_offset); + dbg("found ISO supplementary VD at offset 0x%llx", (unsigned long long) (off + vd_offset)); volume_id_set_label_raw(id, is->iso.volume_id, 32); volume_id_set_label_unicode16(id, is->iso.volume_id, BE, 32); found_svd = 1; diff --git a/extras/volume_id/volume_id/jfs.c b/extras/volume_id/volume_id/jfs.c index ac4eab502d..77fa095357 100644 --- a/extras/volume_id/volume_id/jfs.c +++ b/extras/volume_id/volume_id/jfs.c @@ -58,7 +58,7 @@ int volume_id_probe_jfs(struct volume_id *id, __u64 off) { struct jfs_super_block *js; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); if (js == NULL) diff --git a/extras/volume_id/volume_id/linux_raid.c b/extras/volume_id/volume_id/linux_raid.c index 0ea8596ad6..e7db4031de 100644 --- a/extras/volume_id/volume_id/linux_raid.c +++ b/extras/volume_id/volume_id/linux_raid.c @@ -67,7 +67,7 @@ int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) __u64 sboff; __u8 uuid[16]; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); if (size < 0x10000) return -1; diff --git a/extras/volume_id/volume_id/linux_swap.c b/extras/volume_id/volume_id/linux_swap.c index 39a2c4aab3..e37a79be86 100644 --- a/extras/volume_id/volume_id/linux_swap.c +++ b/extras/volume_id/volume_id/linux_swap.c @@ -55,7 +55,7 @@ int volume_id_probe_linux_swap(struct volume_id *id, __u64 off) const __u8 *buf; unsigned int page; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); /* the swap signature is at the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { diff --git a/extras/volume_id/volume_id/lvm.c b/extras/volume_id/volume_id/lvm.c index bfc2ef2343..d1e337dc35 100644 --- a/extras/volume_id/volume_id/lvm.c +++ b/extras/volume_id/volume_id/lvm.c @@ -59,7 +59,7 @@ int volume_id_probe_lvm1(struct volume_id *id, __u64 off) const __u8 *buf; struct lvm1_super_block *lvm; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); if (buf == NULL) @@ -85,7 +85,7 @@ int volume_id_probe_lvm2(struct volume_id *id, __u64 off) unsigned int soff; struct lvm2_super_block *lvm; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); if (buf == NULL) diff --git a/extras/volume_id/volume_id/mac.c b/extras/volume_id/volume_id/mac.c index 2e2db486f2..dcfacc2a69 100644 --- a/extras/volume_id/volume_id/mac.c +++ b/extras/volume_id/volume_id/mac.c @@ -61,7 +61,7 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) struct mac_driver_desc *driver; struct mac_partition *part; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off, 0x200); if (buf == NULL) @@ -122,7 +122,7 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) poff = be32_to_cpu(part->start_block) * bsize; plen = be32_to_cpu(part->block_count) * bsize; dbg("found '%s' partition entry at 0x%llx, len 0x%llx", - part->type, poff, plen); + part->type, (unsigned long long) poff, (unsigned long long) plen); id->partitions[i].off = poff; id->partitions[i].len = plen; diff --git a/extras/volume_id/volume_id/minix.c b/extras/volume_id/volume_id/minix.c index d9c9ea8ca9..d2f2a336d4 100644 --- a/extras/volume_id/volume_id/minix.c +++ b/extras/volume_id/volume_id/minix.c @@ -59,7 +59,7 @@ int volume_id_probe_minix(struct volume_id *id, __u64 off) { struct minix_super_block *ms; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); ms = (struct minix_super_block *) volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); if (ms == NULL) diff --git a/extras/volume_id/volume_id/msdos.c b/extras/volume_id/volume_id/msdos.c index fc2f99d4d0..47c94456e4 100644 --- a/extras/volume_id/volume_id/msdos.c +++ b/extras/volume_id/volume_id/msdos.c @@ -81,7 +81,7 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) struct msdos_partition_entry *part; struct volume_id_partition *p; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off, 0x200); if (buf == NULL) @@ -124,14 +124,14 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) p->partition_type_raw = part[i].sys_ind; if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", poff); + dbg("found extended partition at 0x%llx", (unsigned long long) poff); volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE); p->type = "msdos_extended_partition"; if (extended == 0) extended = off + poff; } else { dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, poff, plen); + part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen); if (is_raid(part[i].sys_ind)) volume_id_set_usage_part(p, VOLUME_ID_RAID); @@ -174,12 +174,12 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) continue; if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", poff); + dbg("found extended partition at 0x%llx", (unsigned long long) poff); if (next == 0) next = extended + poff; } else { dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, poff, plen); + part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen); /* we always start at the 5th entry */ while (id->partition_count < 4) diff --git a/extras/volume_id/volume_id/ntfs.c b/extras/volume_id/volume_id/ntfs.c index 84d6fbb843..8f31735a2d 100644 --- a/extras/volume_id/volume_id/ntfs.c +++ b/extras/volume_id/volume_id/ntfs.c @@ -118,7 +118,7 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) const __u8 *buf; const __u8 *val; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (ns == NULL) @@ -142,8 +142,8 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) dbg("sectorsize 0x%x", sector_size); dbg("clustersize 0x%x", cluster_size); - dbg("mftcluster %lli", mft_cluster); - dbg("mftoffset 0x%llx", mft_off); + dbg("mftcluster %llu", (unsigned long long) mft_cluster); + dbg("mftoffset 0x%llx", (unsigned long long) mft_off); dbg("cluster per mft_record %i", ns->cluster_per_mft_record); dbg("mft record size %i", mft_record_size); diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c index 094062dba2..34cf167dc4 100644 --- a/extras/volume_id/volume_id/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs.c @@ -73,7 +73,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) struct reiser4_super_block *rs4; __u8 *buf; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/volume_id/romfs.c b/extras/volume_id/volume_id/romfs.c index fe5e5a4827..9c2b41bb86 100644 --- a/extras/volume_id/volume_id/romfs.c +++ b/extras/volume_id/volume_id/romfs.c @@ -50,7 +50,7 @@ int volume_id_probe_romfs(struct volume_id *id, __u64 off) { struct romfs_super *rfs; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); if (rfs == NULL) diff --git a/extras/volume_id/volume_id/sysv.c b/extras/volume_id/volume_id/sysv.c index 6c4408d80c..d4745daa22 100644 --- a/extras/volume_id/volume_id/sysv.c +++ b/extras/volume_id/volume_id/sysv.c @@ -108,7 +108,7 @@ int volume_id_probe_sysv(struct volume_id *id, __u64 off) struct xenix_super *xs; unsigned int boff; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { vs = (struct sysv_super *) diff --git a/extras/volume_id/volume_id/udf.c b/extras/volume_id/volume_id/udf.c index 06b521545f..a378fa9fd1 100644 --- a/extras/volume_id/volume_id/udf.c +++ b/extras/volume_id/volume_id/udf.c @@ -85,7 +85,7 @@ int volume_id_probe_udf(struct volume_id *id, __u64 off) unsigned int loc; unsigned int clen; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); if (vsd == NULL) diff --git a/extras/volume_id/volume_id/ufs.c b/extras/volume_id/volume_id/ufs.c index 37e74aee6f..d4f4db3d32 100644 --- a/extras/volume_id/volume_id/ufs.c +++ b/extras/volume_id/volume_id/ufs.c @@ -188,7 +188,7 @@ int volume_id_probe_ufs(struct volume_id *id, __u64 off) struct ufs_super_block *ufs; int offsets[] = {0, 8, 64, 256, -1}; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); for (i = 0; offsets[i] >= 0; i++) { ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 6ae4d09927..22abc9cbf8 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -188,7 +188,7 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) { unsigned int buf_len; - dbg("get buffer off 0x%llx(%llu), len 0x%x", off, off, len); + dbg("get buffer off 0x%llx(%llu), len 0x%x", (unsigned long long) off, (unsigned long long) off, len); /* check if requested area fits in superblock buffer */ if (off + len <= SB_BUFFER_SIZE) { if (id->sbbuf == NULL) { @@ -199,7 +199,7 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) /* check if we need to read */ if ((off + len) > id->sbbuf_len) { - dbg("read sbbuf len:0x%llx", off + len); + dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len)); lseek(id->fd, 0, SEEK_SET); buf_len = read(id->fd, id->sbbuf, off + len); dbg("got 0x%x (%i) bytes", buf_len, buf_len); @@ -224,7 +224,7 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - dbg("read seekbuf off:0x%llx len:0x%x", off, len); + dbg("read seekbuf off:0x%llx len:0x%x", (unsigned long long) off, len); if (lseek(id->fd, off, SEEK_SET) == -1) return NULL; buf_len = read(id->fd, id->seekbuf, len); diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 6719c1aa31..8287de28f6 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 39 +#define VOLUME_ID_VERSION 40 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 diff --git a/extras/volume_id/volume_id/xfs.c b/extras/volume_id/volume_id/xfs.c index 12a89aafcb..b8702a3fb3 100644 --- a/extras/volume_id/volume_id/xfs.c +++ b/extras/volume_id/volume_id/xfs.c @@ -58,7 +58,7 @@ int volume_id_probe_xfs(struct volume_id *id, __u64 off) { struct xfs_super_block *xs; - dbg("probing at offset %llu", off); + dbg("probing at offset 0x%llx", (unsigned long long) off); xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (xs == NULL) diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index 63eec7bb9a..ac3936656c 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -244,7 +244,7 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr, close(fd); return -1; } else if ((unsigned int)length != len) { - dprintf("Could not write %d bytes to attribute %s\n", + dprintf("Could not write %zd bytes to attribute %s\n", len, sysattr->name); /* * since we could not write user supplied number of bytes, diff --git a/namedev_parse.c b/namedev_parse.c index 942596121e..b19a5f26f5 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -338,7 +338,7 @@ static int namedev_parse(struct udevice *udev, const char *filename) continue; error: info("parse error %s, line %d:%d, rule skipped", - filename, lineno, temp - line); + filename, lineno, (int) (temp - line)); } } diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 65f4e01c23..4d6d332c69 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -22,14 +22,24 @@ #ifndef _UDEV_LIBC_WRAPPER_H_ #define _UDEV_LIBC_WRAPPER_H_ -#ifdef asmlinkage -# undef asmlinkage -#endif +#undef asmlinkage #ifdef __i386__ -# define asmlinkage __attribute__((regparm(0))) +#define asmlinkage __attribute__((regparm(0))) +#else +#define asmlinkage +#endif + +#ifndef __FD_SET +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) +#endif +#ifndef __FD_CLR +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) +#endif +#ifndef __FD_ISSET +#define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) #endif -#ifndef asmlinkage -# define asmlinkage +#ifndef __FD_ZERO +#define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) #endif #include diff --git a/udevd.c b/udevd.c index c2f2dd048b..2cd3622ce0 100644 --- a/udevd.c +++ b/udevd.c @@ -21,7 +21,6 @@ */ #include -#include #include #include #include @@ -31,6 +30,8 @@ #include #include #include +#include +#include #include #include #include -- cgit v1.2.3-54-g00ecf From 783272f045faf39325678eef0d55a41d7306e2d3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 10 Mar 2005 02:46:26 +0100 Subject: [PATCH] don't lookup "root" in the userdb --- udev_add.c | 20 +++++++++++++------- udev_utils.c | 4 ++-- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/udev_add.c b/udev_add.c index f47ca25f74..58f4ee1150 100644 --- a/udev_add.c +++ b/udev_add.c @@ -114,8 +114,8 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de char filename[PATH_SIZE]; char partitionname[PATH_SIZE]; struct name_entry *name_loop; - uid_t uid = 0; - gid_t gid = 0; + uid_t uid; + gid_t gid; int tail; int i; @@ -126,24 +126,30 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de if (strchr(udev->name, '/')) create_path(filename); - if (udev->owner[0] != '\0') { + if (strcmp(udev->owner, "root") == 0) + uid = 0; + else { char *endptr; - unsigned long id = strtoul(udev->owner, &endptr, 10); + unsigned long id; + id = strtoul(udev->owner, &endptr, 10); if (endptr[0] == '\0') uid = (uid_t) id; else uid = lookup_user(udev->owner); } - if (udev->group[0] != '\0') { + if (strcmp(udev->group, "root") == 0) + gid = 0; + else { char *endptr; - unsigned long id = strtoul(udev->group, &endptr, 10); + unsigned long id; + id = strtoul(udev->group, &endptr, 10); if (endptr[0] == '\0') gid = (gid_t) id; else - gid = lookup_group(udev->group); + gid = lookup_user(udev->group); } if (!udev->test_run) { diff --git a/udev_utils.c b/udev_utils.c index d572581f65..afa9790fdc 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -85,8 +85,8 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs } udev->mode = 0660; - strcpy(udev->owner, "0"); - strcpy(udev->group, "0"); + strcpy(udev->owner, "root"); + strcpy(udev->group, "root"); return 0; } -- cgit v1.2.3-54-g00ecf From 882af735ec18cb4e6ba6f59ca60f8266cc96c330 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 10 Mar 2005 05:15:07 +0100 Subject: [PATCH] remove PLACE key match ID should do the same, cause we walk up the chain of devices on the physical device and can match for the name of every device there with the ID key. --- namedev.c | 36 ------------------------------------ namedev.h | 2 -- namedev_parse.c | 10 ++-------- test/udev-test.pl | 6 +++--- udev.8.in | 5 +---- 5 files changed, 6 insertions(+), 53 deletions(-) diff --git a/namedev.c b/namedev.c index 4b3674935a..cd1f2de989 100644 --- a/namedev.c +++ b/namedev.c @@ -531,28 +531,6 @@ static int match_id(struct config_device *dev, struct sysfs_device *sysfs_device return 0; } -static int match_place(struct config_device *dev, struct sysfs_device *sysfs_device) -{ - char path[PATH_SIZE]; - char *temp; - - strlcpy(path, sysfs_device->path, sizeof(path)); - temp = strrchr(path, '/'); - dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); - if (strstr(temp, dev->place) != NULL) - return 0; - - /* try the parent */ - temp[0] = '\0'; - temp = strrchr(path, '/'); - dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); - if (strstr(temp, dev->place) == NULL) - return 0; - - dbg("place doesn't match"); - return -ENODEV; -} - static int match_rule(struct udevice *udev, struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { @@ -622,20 +600,6 @@ static int match_rule(struct udevice *udev, struct config_device *dev, dbg(FIELD_ID " matches"); } - /* check for matching place of device */ - if (dev->place[0] != '\0') { - if (sysfs_device == NULL) { - dbg("device has no sysfs_device"); - goto try_parent; - } - dbg("check " FIELD_PLACE); - if (match_place(dev, sysfs_device) != 0) { - dbg(FIELD_PLACE " is not matching"); - goto try_parent; - } - dbg(FIELD_PLACE " matches"); - } - /* check for matching sysfs pairs */ if (dev->sysfs_pair[0].file[0] != '\0') { dbg("check " FIELD_SYSFS " pairs"); diff --git a/namedev.h b/namedev.h index 76caaaa9f7..d0235996bc 100644 --- a/namedev.h +++ b/namedev.h @@ -33,7 +33,6 @@ struct sysfs_class_device; #define FIELD_BUS "BUS" #define FIELD_SYSFS "SYSFS" #define FIELD_ID "ID" -#define FIELD_PLACE "PLACE" #define FIELD_PROGRAM "PROGRAM" #define FIELD_RESULT "RESULT" #define FIELD_DRIVER "DRIVER" @@ -64,7 +63,6 @@ struct config_device { char subsystem[NAME_SIZE]; char bus[NAME_SIZE]; char id[NAME_SIZE]; - char place[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; char program[PATH_SIZE]; char result[PATH_SIZE]; diff --git a/namedev_parse.c b/namedev_parse.c index b19a5f26f5..3be408932b 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -59,11 +59,11 @@ static int add_config_dev(struct config_device *new_dev) void dump_config_dev(struct config_device *dev) { - dbg_parse("name='%s', symlink='%s', bus='%s', place='%s', id='%s', " + dbg_parse("name='%s', symlink='%s', bus='%s', id='%s', " "sysfs_file[0]='%s', sysfs_value[0]='%s', " "kernel='%s', program='%s', result='%s'" "owner='%s', group='%s', mode=%#o", - dev->name, dev->symlink, dev->bus, dev->place, dev->id, + dev->name, dev->symlink, dev->bus, dev->id, dev->sysfs_pair[0].file, dev->sysfs_pair[0].value, dev->kernel, dev->program, dev->result, dev->owner, dev->group, dev->mode); @@ -196,12 +196,6 @@ static int namedev_parse(struct udevice *udev, const char *filename) continue; } - if (strcasecmp(temp2, FIELD_PLACE) == 0) { - strlcpy(dev.place, temp3, sizeof(dev.place)); - valid = 1; - continue; - } - if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) { struct sysfs_pair *pair = &dev.sysfs_pair[0]; int sysfs_pair_num = 0; diff --git a/test/udev-test.pl b/test/udev-test.pl index 9699f2e8f5..c7e1a9d47e 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -237,7 +237,7 @@ EOF devpath => "/block/sda/sda3", exp_name => "first_disk3" , conf => < "/block/sda/sda3", exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "/block/sda/sda3", exp_name => "M8-m3-n3-b0:0-sIBM" , conf => < Date: Thu, 10 Mar 2005 05:28:41 +0100 Subject: [PATCH] add RELEASE-NOTES file --- RELEASE-NOTES | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 RELEASE-NOTES diff --git a/RELEASE-NOTES b/RELEASE-NOTES new file mode 100644 index 0000000000..870020c430 --- /dev/null +++ b/RELEASE-NOTES @@ -0,0 +1,10 @@ +udev 055 +======== +We support an unlimited count of symlinks now. + +If USE_STATIC=true is passed to a glibc build, we link statically and use +a built-in userdb parser to resolve user and group names. + +THE PLACE= key is gone. It can be replaced by an ID= for a long time, cause +we walk up the chain of physical devices to find a match. + -- cgit v1.2.3-54-g00ecf From 08183c4b90505866e806d308213d0a2d293b2659 Mon Sep 17 00:00:00 2001 From: "jkluebs@luebsphoto.com" Date: Thu, 10 Mar 2005 17:34:31 +0100 Subject: [PATCH] This patch causes the remove handler to check that each symlink --- udev_remove.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/udev_remove.c b/udev_remove.c index 1fd36d24c5..c3a7880b49 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -78,13 +78,33 @@ static int delete_node(struct udevice *udev) int i; int num; + list_for_each_entry(name_loop, &udev->symlink_list, node) { + snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); + filename[sizeof(filename)-1] = '\0'; + + if (stat(filename, &stats) != 0) { + dbg("symlink '%s' not found", filename); + continue; + } + if (udev->devt && stats.st_rdev != udev->devt) { + info("symlink '%s' points to a different device, skip removal", filename); + continue;; + } + + dbg("removing symlink '%s'", filename); + unlink(filename); + + if (strchr(filename, '/')) + delete_path(filename); + } + snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); filename[sizeof(filename)-1] = '\0'; - dbg("checking major/minor of device node '%s'", filename); - if (stat(filename, &stats) != 0) + if (stat(filename, &stats) != 0) { + dbg("device node '%s' not found", filename); return -1; - + } if (udev->devt && stats.st_rdev != udev->devt) { info("device node '%s' points to a different device, skip removal", filename); return -1; @@ -95,7 +115,6 @@ static int delete_node(struct udevice *udev) if (retval) return retval; - /* remove all_partitions nodes */ num = udev->partitions; if (num > 0) { info("removing all_partitions '%s[1-%i]'", filename, num); @@ -110,28 +129,9 @@ static int delete_node(struct udevice *udev) } } - /* remove subdirectories */ if (strchr(udev->name, '/')) delete_path(filename); - list_for_each_entry(name_loop, &udev->symlink_list, node) { - snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); - filename[sizeof(filename)-1] = '\0'; - - dbg("unlinking symlink '%s'", filename); - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - if (retval) { - dbg("unlink(%s) failed with error '%s'", - filename, strerror(errno)); - return retval; - } - if (strchr(filename, '/')) { - delete_path(filename); - } - } - return retval; } -- cgit v1.2.3-54-g00ecf From cb948532ff3cb7edf1d2eead7a5cce9e8a1a7a97 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 10 Mar 2005 17:51:43 +0100 Subject: [PATCH] klibc: version 1.0.3 --- klibc/MCONFIG | 6 +++- klibc/Makefile | 5 +++- klibc/include/stddef.h | 2 +- klibc/klcc.in | 76 ++++++++++++++++++++++++++++++++++---------------- klibc/makeklcc.pl | 17 ++++------- klibc/version | 2 +- 6 files changed, 68 insertions(+), 40 deletions(-) diff --git a/klibc/MCONFIG b/klibc/MCONFIG index 7a24b821ad..1141b78d47 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -29,6 +29,10 @@ OBJROOT = $(SRCROOT) KRNLSRC = $(SRCROOT)/linux KRNLOBJ = $(SRCROOT)/linux +# klibc version information +KLIBCVER = -D__KLIBC__=$(shell cut -d. -f1 < $(SRCROOT)/version) \ + -D__KLIBC_MINOR__=$(shell cut -d. -f2 < $(SRCROOT)/version) + ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) CC = $(CROSS)gcc LD = $(CROSS)ld @@ -38,7 +42,7 @@ INCLUDE = -I$(SRCROOT)/include/arch/$(ARCH) \ -I$(SRCROOT)/include/bits$(BITSIZE) \ -I$(SRCROOT)/include \ -I$(KRNLOBJ)/include -I$(KRNLOBJ)/include2 -I$(KRNLSRC)/include -REQFLAGS = $(ARCHREQFLAGS) -nostdinc -iwithprefix include -D__KLIBC__ \ +REQFLAGS = $(ARCHREQFLAGS) $(KLIBCVER) -nostdinc -iwithprefix include \ $(INCLUDE) LDFLAGS = AR = $(CROSS)ar diff --git a/klibc/Makefile b/klibc/Makefile index a512aa308a..7a9b92e8d6 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -27,7 +27,10 @@ $(CROSS)klibc.config: Makefile echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@ echo 'EMAIN=$(EMAIN)' >> $@ echo 'BITSIZE=$(BITSIZE)' >> $@ - echo 'INSTALLDIR=$(INSTALLDIR)' >> $@ + echo 'prefix=$(INSTALLDIR)' >> $@ + echo 'bindir=$(INSTALLDIR)/$(KCROSS)bin' >> $@ + echo 'libdir=$(INSTALLDIR)/$(KCROSS)lib' >> $@ + echo 'includedir=$(INSTALLDIR)/$(KCROSS)include' >> $@ $(CROSS)klcc: klcc.in $(CROSS)klibc.config makeklcc.pl $(PERL) makeklcc.pl klcc.in $(CROSS)klibc.config \ diff --git a/klibc/include/stddef.h b/klibc/include/stddef.h index 125d2352ec..e96f28c446 100644 --- a/klibc/include/stddef.h +++ b/klibc/include/stddef.h @@ -6,7 +6,7 @@ #define _STDDEF_H #ifndef __KLIBC__ -# define __KLIBC__ 1 +# error "__KLIBC__ not defined, compiler invocation error!" #endif #include diff --git a/klibc/klcc.in b/klibc/klcc.in index d8721c9a6b..36c4d9b3ee 100644 --- a/klibc/klcc.in +++ b/klibc/klcc.in @@ -1,19 +1,22 @@ # -*- perl -*- # Standard includes -@includes = ("-I${INSTALLDIR}/${KCROSS}include/arch/${ARCH}", - "-I${INSTALLDIR}/${KCROSS}include/bits${BITSIZE}", - "-I${INSTALLDIR}/${KCROSS}include"); +@includes = ("-I${prefix}/${KCROSS}include/arch/${ARCH}", + "-I${prefix}/${KCROSS}include/bits${BITSIZE}", + "-I${prefix}/${KCROSS}include"); # Default optimization options (for compiles without -g) @optopt = @OPTFLAGS; @goptopt = ('-O'); +# Standard library directories +@stdlibpath = ("-L${prefix}/${KCROSS}lib"); + # Options and libraries to pass to ld; shared versus static -@staticopt = ("$INSTALLDIR/${KCROSS}lib/crt0.o"); -@staticlib = ("$INSTALLDIR/${KCROSS}lib/libc.a"); -@sharedopt = (@EMAIN, "$INSTALLDIR/${KCROSS}lib/interp.o"); -@sharedlib = ('-R', "$INSTALLDIR/${KCROSS}lib/libc.so"); +@staticopt = ("${prefix}/${KCROSS}lib/crt0.o"); +@staticlib = ("${prefix}/${KCROSS}lib/libc.a"); +@sharedopt = (@EMAIN, "${prefix}/${KCROSS}lib/interp.o"); +@sharedlib = ('-R', "${prefix}/${KCROSS}lib/libc.so"); # Returns the language (-x option string) for a specific extension. sub filename2lang($) { @@ -51,13 +54,15 @@ sub files_with_lang($$) { foreach $f ( @{$files} ) { $need = ${$flang}{$f}; - $need = 'none' if ( $need eq 'obj' ); - unless ( $xopt eq $need || - ($xopt eq 'none' && filename2lang($f) eq $need) ) { - push(@as, '-x', $need); - $xopt = $need; + + # Skip object files + if ( $need ne 'obj' ) { + unless ( $xopt eq $need ) { + push(@as, '-x', $need); + $xopt = $need; + } + push(@as, $f); } - push(@as, $f); } return @as; @@ -88,6 +93,7 @@ open(NULL, '+<', '/dev/null') or die "$0: cannot open /dev/null\n"; @ccopt = (); @ldopt = (); +@libs = (); @files = (); # List of files %flang = (); # Languages for files @@ -111,13 +117,26 @@ while ( defined($a = shift(@ARGV)) ) { # Not an option. Must be a filename then. push(@files, $a); $flang{$a} = $lang || filename2lang($a); + } elsif ( $a =~ /^-print-klibc-(.*)$/ ) { + # This test must precede -print + if ( defined($conf{$1}) ) { + print ${$conf{$1}}, "\n"; + exit 0; + } else { + die "$0: unknown option: $a\n"; + } + } elsif ( $a =~ /^(-print|-dump|--help|--version)/ ) { + # These share prefixes with some other options, so put this test early! + # Pseudo-operations; just pass to gcc and don't do anything else + push(@ccopt, $a); + $operation = 'c' if ( $operation eq '' ); } elsif ( $a =~ /^-Wl,(.*)$/ ) { # -Wl used to pass options to the linker push(@ldopt, split(/,/, $1)); - } elsif ( $a =~ /^-([fmwWQdO]|std=|ansi|pedantic)/ ) { + } elsif ( $a =~ /^-([fmwWQdO]|std=|ansi|pedantic|M[GPD]|MMD)/ ) { # Options to gcc push(@ccopt, $a); - } elsif ( $a =~ /^-([DUI])(.*)$/ ) { + } elsif ( $a =~ /^-([DUI]|M[FQT])(.*)$/ ) { # Options to gcc, which can take either a conjoined argument # (-DFOO) or a disjoint argument (-D FOO) push(@ccopt, $a); @@ -125,10 +144,13 @@ while ( defined($a = shift(@ARGV)) ) { } elsif ( $a eq '-include' ) { # Options to gcc which always take a disjoint argument push(@ccopt, $a, shift(@ARGV)); - } elsif ( $a =~ /^-[gp]/ ) { - # Debugging options to gcc *and* ld + } elsif ( $a eq '-M' || $a eq '-MM' ) { + # gcc options, that force preprocessing mode + push(@ccopt, $a); + $operation = 'E'; + } elsif ( $a =~ /^-[gp]/ || $a eq '-p' ) { + # Debugging options to gcc push(@ccopt, $a); - push(@ldopt, $a); $debugging = 1; } elsif ( $a eq '-v' ) { push(@ccopt, $a); @@ -147,13 +169,15 @@ while ( defined($a = shift(@ARGV)) ) { $strip = 1; } elsif ( $a eq '-o' ) { $output = shift(@ARGV); + } elsif ( $a eq '-x' ) { + $lang = shift(@ARGV); } elsif ( $a eq '-nostdinc' ) { push(@ccopt, $a); @includes = (); - } elsif ( $a =~ /^(-print|--help)/ ) { - # Pseudo-operations; just pass to gcc and don't do anything else - push(@ccopt, $a); - $operation = 'c' if ( $operation eq '' ); + } elsif ( $a =~ /^-([lL])(.*)$/ ) { + # Libraries + push(@libs, $a); + push(@libs, shift(@ARGV)) if ( $2 eq '' ); } else { die "$0: unknown option: $a\n"; } @@ -170,6 +194,10 @@ if ( $operation ne '' ) { @outopt = ('-o', $output) if ( defined($output) ); $rv = mysystem($CC, @ccopt, @outopt, files_with_lang(\@files, \%flang)); } else { + if ( scalar(@files) == 0 ) { + die "$0: No input files!\n"; + } + @outopt = ('-o', $output || 'a.out'); @objs = (); @@ -204,9 +232,9 @@ if ( $operation ne '' ) { close(LIBGCC); if ( $shared ) { - $rv = mysystem($LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs, @sharedlib, $libgcc); + $rv = mysystem($LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs, @libs, @stdlibpath, @sharedlib, $libgcc); } else { - $rv = mysystem($LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs, @staticlib, $libgcc); + $rv = mysystem($LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs, @libs, @stdlibpath, @staticlib, $libgcc); } unlink(@rmobjs); diff --git a/klibc/makeklcc.pl b/klibc/makeklcc.pl index ea3f8a8256..f8a6294db3 100644 --- a/klibc/makeklcc.pl +++ b/klibc/makeklcc.pl @@ -7,23 +7,16 @@ ($klccin, $klibcconf, $perlpath) = @ARGV; -# This should probably handle quotes and escapes... -sub string2list($) -{ - my($s) = @_; - - $s =~ s/\s+/\',\'/g; - return "(\'".$s."\')"; -} - print "#!${perlpath}\n"; open(KLIBCCONF, '<', $klibcconf) or die "$0: cannot open $klibcconf: $!\n"; while ( defined($l = ) ) { chomp $l; - if ( $l =~ /=/ ) { - print "\$$` = \"\Q$'\E\";\n"; - print "\@$` = ", string2list("$'"), ";\n"; + if ( $l =~ /^([^=]+)\=(.*)$/ ) { + $n = $1; $s = $2; + print "\$$n = \"\Q$s\E\";\n"; + print "\@$n = qw($s);\n"; + print "\$conf{\'\L$n\E\'} = \\\$$n;\n"; } } close(KLIBCCONF); diff --git a/klibc/version b/klibc/version index 136a629e2d..21e8796a09 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -0.214 +1.0.3 -- cgit v1.2.3-54-g00ecf From 4d7726399bcaf74105f8f3c27ee37b5dbddc1fee Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 26 Apr 2005 23:52:14 -0700 Subject: selinux merge fixups again... --- udev_add.c | 10 +++++++--- udev_selinux.c | 32 +++++++++++++++++--------------- udev_selinux.h | 6 ++++-- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/udev_add.c b/udev_add.c index 58f4ee1150..42b8d2104c 100644 --- a/udev_add.c +++ b/udev_add.c @@ -83,6 +83,7 @@ create: selinux_setfscreatecon(file, udev->kernel_name, mode); retval = mknod(file, mode, devt); + selinux_resetfscreatecon(); if (retval != 0) { dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", file, mode, major(devt), minor(devt), strerror(errno)); @@ -189,6 +190,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de /* create symlink(s) if requested */ list_for_each_entry(name_loop, &udev->symlink_list, node) { + int retval; char linktarget[PATH_SIZE]; snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); @@ -218,9 +220,11 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de dbg("symlink(%s, %s)", linktarget, filename); if (!udev->test_run) { - selinux_setfscreatecon(filename, udev->kernel_name, S_IFLNK); unlink(filename); - if (symlink(linktarget, filename) != 0) + selinux_setfscreatecon(filename, udev->kernel_name, S_IFLNK); + retval = symlink(linktarget, filename); + selinux_resetfscreatecon(); + if (retval != 0) dbg("symlink(%s, %s) failed with error '%s'", linktarget, filename, strerror(errno)); } @@ -317,7 +321,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) } exit: - selinux_restore(); + selinux_exit(); return retval; } diff --git a/udev_selinux.c b/udev_selinux.c index 72381f0d0d..cc6f4d7d3f 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -105,7 +105,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode } if (setfilecon(file, scontext) < 0) - dbg("setfiles %s failed with error '%s'", file, strerror(errno)); + dbg("setfilecon %s failed with error '%s'", file, strerror(errno)); freecon(scontext); } @@ -131,12 +131,20 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int } if (setfscreatecon(scontext) < 0) - dbg("setfiles %s failed with error '%s'", file, strerror(errno)); + dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); freecon(scontext); } } +void selinux_resetfscreatecon(void) +{ + if (is_selinux_running()) { + if (setfscreatecon(prev_scontext) < 0) + dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); + } +} + void selinux_init(void) { /* @@ -144,23 +152,17 @@ void selinux_init(void) * restoration creation purposes. */ if (is_selinux_running()) { - if (getfscreatecon(&prev_scontext) < 0) + if (getfscreatecon(&prev_scontext) < 0) { dbg("getfscreatecon failed\n"); - - prev_scontext = NULL; + prev_scontext = NULL; + } } } -void selinux_restore(void) +void selinux_exit(void) { - if (is_selinux_running()) { - /* reset the file create context to its former glory */ - if (setfscreatecon(prev_scontext) < 0) - dbg("setfscreatecon failed\n"); - - if (prev_scontext) { - freecon(prev_scontext); - prev_scontext = NULL; - } + if (is_selinux_running() && prev_scontext) { + freecon(prev_scontext); + prev_scontext = NULL; } } diff --git a/udev_selinux.h b/udev_selinux.h index 132a9a6550..d9dfeffad0 100644 --- a/udev_selinux.h +++ b/udev_selinux.h @@ -24,15 +24,17 @@ extern void selinux_setfilecon(const char *file, const char *devname, unsigned int mode); extern void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode); +extern void selinux_resetfscreatecon(void); extern void selinux_init(void); -extern void selinux_restore(void); +extern void selinux_exit(void); #else static inline void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) {} static inline void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) {} +static inline void selinux_resetfscreatecon(void) {} static inline void selinux_init(void) {} -static inline void selinux_restore(void) {} +static inline void selinux_exit(void) {} #endif /* USE_SELINUX */ #endif /* _UDEV_USE_SELINUX */ -- cgit v1.2.3-54-g00ecf From 3810823b4410e0bfbaa46e5e63e36a0989ba37f3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 10 Mar 2005 18:35:50 +0100 Subject: [PATCH] udevinfo -d: use '=' as separator, cause ':' may be a part of the devpath --- udevinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index 4d13a5f6dc..930a7be0ae 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -180,7 +180,7 @@ exit: } static int print_dump(const char *devpath, const char *name) { - printf("%s:%s/%s\n", devpath, udev_root, name); + printf("%s=%s/%s\n", devpath, udev_root, name); return 0; } -- cgit v1.2.3-54-g00ecf From e296b1476e99150413d92c58e3b5e07e5bda9fd4 Mon Sep 17 00:00:00 2001 From: "tklauser@access.unizh.ch" Date: Fri, 11 Mar 2005 02:19:04 +0100 Subject: [PATCH] The following patch fixes a warning when compiling chassis_id --- extras/chassis_id/table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/chassis_id/table.c b/extras/chassis_id/table.c index 8d14cd1b59..ee64ecc774 100644 --- a/extras/chassis_id/table.c +++ b/extras/chassis_id/table.c @@ -59,7 +59,7 @@ int table_init(void) i = 0; while (!feof(fp)) { fgets(ptr, 80, fp); - sscanf(ptr, "%d %d %d %d %d %s %s", &ptable[i].id, + sscanf(ptr, "%d %d %d %d %s %s", &ptable[i].id, &ptable[i].num_disks, &ptable[i].chassis_num, &ptable[i].slot_num, ptable[i].serial_num, ptable[i].name); -- cgit v1.2.3-54-g00ecf From 9066c16adaf90888bc2ffe1a816f3638d58e0bdb Mon Sep 17 00:00:00 2001 From: "tklauser@access.unizh.ch" Date: Fri, 11 Mar 2005 02:31:58 +0100 Subject: [PATCH] The following patch fixes some warnings when compiling volume_id --- extras/volume_id/Makefile | 2 +- extras/volume_id/udev_volume_id.c | 4 ++++ extras/volume_id/volume_id/logging.h | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 9c274212a6..efec58f80e 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -28,7 +28,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-D_FILE_OFFSET_BITS=64 +override CFLAGS+=-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE VOLUME_ID_BASE=volume_id include $(VOLUME_ID_BASE)/Makefile.inc diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index 54d95270d0..a00b01a27d 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -21,6 +21,10 @@ * */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + #include #include #include diff --git a/extras/volume_id/volume_id/logging.h b/extras/volume_id/volume_id/logging.h index c81dc57567..ac30264158 100644 --- a/extras/volume_id/volume_id/logging.h +++ b/extras/volume_id/volume_id/logging.h @@ -16,6 +16,6 @@ #endif /* just use the udev version */ -#include "../../logging.h" +#include "../../../logging.h" #endif /* _VOLUME_ID_LOGGING_H_ */ -- cgit v1.2.3-54-g00ecf From bc68b28056bfd20c4fcf5030d5c22fd4548dd9fb Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 11 Mar 2005 02:45:26 +0100 Subject: [PATCH] The path to dlist.h is not correct. Pointed out by: Tobias Klauser --- libsysfs/dlist.h | 206 ------------------------------------------------- libsysfs/sysfs/dlist.h | 206 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+), 206 deletions(-) delete mode 100644 libsysfs/dlist.h create mode 100644 libsysfs/sysfs/dlist.h diff --git a/libsysfs/dlist.h b/libsysfs/dlist.h deleted file mode 100644 index 62eaa9fec4..0000000000 --- a/libsysfs/dlist.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - * dlist.h - * - * Copyright (C) 2003 Eric J Bohm - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#ifndef _DLIST_H_ -#define _DLIST_H_ - -/* Double linked list header. - -* navigate your list with DLIST_PREV and DLIST_NEXT. These are macros -* so function call overhead is minimized. - -* Supports perl style push, pop, shift, unshift list semantics. - -* You allocate the data and give dlist the pointer. If your data is -* complex set the dlist->del_func to a an appropriate delete using -* dlist_new_with_delete. Your delete function must match -(void * )(del(void *) -*Otherwise dlist will just use free. - -* NOTE: The small amount of pain involved in doing that allows us to -* avoid copy in copy out semantics. - -* Dlist uses an internal mark pointer to keep track of where you are -* in the list. - -* insert and delete take a directional parameter. Where direction -* corresponds to the direction in which you want the list to go. -* true direction corresponded to progressing forward in the last -* false to regressing in the list. -* so a dlist_insert(yourlist,item,1) will insert it after the mark -* so a dlist_insert(yourlist,item,0) will insert it before the mark -* any insert will move the mark to the new node regardless of the direction. - -* Just use the dlist_(insert|delete)_(before|after) macros if you do not want -* to think about it. -*/ - -#include - -typedef struct dl_node { - struct dl_node *prev; - struct dl_node *next; - void *data; -} DL_node; - -typedef struct dlist { - DL_node *marker; - unsigned long count; - size_t data_size; - void (*del_func)(void *); - DL_node headnode; - DL_node *head; -} Dlist; - -Dlist *dlist_new(size_t datasize); -Dlist *dlist_new_with_delete(size_t datasize,void (*del_func)(void*)); -void *_dlist_mark_move(Dlist *list,int direction); -void *dlist_mark(Dlist *); -void dlist_start(Dlist *); -void dlist_end(Dlist *); -void dlist_move(struct dlist *source, struct dlist *dest, struct dl_node *target,int direction); -void *dlist_insert(Dlist *,void *,int) ; - -void *dlist_insert_sorted(struct dlist *list, void *new_elem, int (*sorter)(void *, void *)); - -void dlist_delete(Dlist *,int); - -void dlist_push(Dlist *,void *); - -void dlist_unshift(Dlist *,void *); -void dlist_unshift_sorted(Dlist *,void *,int (*sorter)(void *, void *)); - -void *dlist_pop(Dlist *); - -void *dlist_shift(Dlist *); - -void dlist_destroy(Dlist *); - -int _dlist_merge(struct dlist *listsource, struct dlist *listdest, unsigned int passcount, int (*compare)(void *, void *)); - -void *dlist_find_custom(struct dlist *list, void *target, int (*comp)(void *, void *)); - -void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)); - - -void _dlist_swap(struct dlist *list, struct dl_node *a, struct dl_node *b); - -void dlist_transform(struct dlist *list, void (*node_operation)(void *)); - - -/* - * _dlist_remove is for internal use only - * _dlist_mark_move is for internal use only - */ -void *_dlist_remove(struct dlist *,struct dl_node *,int ); -void *_dlist_insert_dlnode(struct dlist *list,struct dl_node *new_node,int direction); - -#define dlist_prev(A) _dlist_mark_move((A),0) -#define dlist_next(A) _dlist_mark_move((A),1) - -#define dlist_insert_before(A,B) dlist_insert((A),(B),0) -#define dlist_insert_after(A,B) dlist_insert((A),(B),1) - -#define dlist_delete_before(A) dlist_delete((A),0) -#define dlist_delete_after(A) dlist_delete((A),1) - -/** - * provide for loop header which iterates the mark from start to end - * list: the dlist pointer, use dlist_mark(list) to get iterator - */ -#define dlist_for_each(list) \ - for(dlist_start(list),dlist_next(list); \ - (list)->marker!=(list)->head;dlist_next(list)) - -/** - * provide for loop header which iterates the mark from end to start - * list: the dlist pointer, use dlist_mark(list) to get iterator - */ -#define dlist_for_each_rev(list) \ - for(dlist_end(list),dlist_prev(list); \ - (list)->marker!=(list)->head;dlist_prev(list)) - -/** - * provide for loop header which iterates through the list without moving mark - * list: the dlist_pointer - * iterator: dl_node pointer to iterate - */ -#define dlist_for_each_nomark(list,iterator) \ - for((iterator)=(list)->head->next; (iterator)!=(list)->head; \ - (iterator)=(iterator)->next) - -/** - * provide for loop header which iterates through the list without moving mark - * in reverse - * list: the dlist_pointer - * iterator: dl_node pointer to iterate - */ -#define dlist_for_each_nomark_rev(list,iterator) \ - for((iterator)=(list)->head->prev; (iterator)!=(list)->head; \ - (iterator)=(iterator)->prev) -/** - * provide for loop header which iterates through the list providing a - * data iterator - * list: the dlist pointer - * data_iterator: the pointer of type datatype to iterate - * datatype: actual type of the contents in the dl_node->data - */ - -#define dlist_for_each_data(list,data_iterator,datatype) \ - for(dlist_start(list), (data_iterator)=(datatype *) dlist_next(list); \ - (list)->marker!=(list)->head;(data_iterator)=(datatype *) dlist_next(list)) - -/** - * provide for loop header which iterates through the list providing a - * data iterator in reverse - * list: the dlist pointer - * data_iterator: the pointer of type datatype to iterate - * datatype: actual type of the contents in the dl_node->data - */ -#define dlist_for_each_data_rev(list,data_iterator,datatype) \ - for(dlist_end(list), (data_iterator)=(datatype *) dlist_prev(list); \ - (list)->marker!=(list)->head;(data_iterator)=(datatype *) dlist_prev(list)) - -/** - * provide for loop header which iterates through the list providing a - * data iterator without moving the mark - * list: the dlist pointer - * iterator: the dl_node pointer to iterate - * data_iterator: the pointer of type datatype to iterate - * datatype: actual type of the contents in the dl_node->data - */ - -#define dlist_for_each_data_nomark(list,iterator,data_iterator,datatype) \ - for((iterator)=(list)->head->next, (data_iterator)=(datatype *) (iterator)->data; \ - (iterator)!=(list)->head;(iterator)=(iterator)->next,(data_iterator)=(datatype *) (iterator)) - -/** - * provide for loop header which iterates through the list providing a - * data iterator in reverse without moving the mark - * list: the dlist pointer - * iterator: the dl_node pointer to iterate - * data_iterator: the pointer of type datatype to iterate - * datatype: actual type of the contents in the dl_node->data - */ -#define dlist_for_each_data_nomark_rev(list,iterator, data_iterator,datatype) \ - for((iterator)=(list)->head->prev, (data_iterator)=(datatype *) (iterator)->data; \ - (iterator)!=(list)->head;(iterator)=(iterator)->prev,(data_iterator)=(datatype *) (iterator)) - -#endif /* _DLIST_H_ */ diff --git a/libsysfs/sysfs/dlist.h b/libsysfs/sysfs/dlist.h new file mode 100644 index 0000000000..62eaa9fec4 --- /dev/null +++ b/libsysfs/sysfs/dlist.h @@ -0,0 +1,206 @@ +/* + * dlist.h + * + * Copyright (C) 2003 Eric J Bohm + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#ifndef _DLIST_H_ +#define _DLIST_H_ + +/* Double linked list header. + +* navigate your list with DLIST_PREV and DLIST_NEXT. These are macros +* so function call overhead is minimized. + +* Supports perl style push, pop, shift, unshift list semantics. + +* You allocate the data and give dlist the pointer. If your data is +* complex set the dlist->del_func to a an appropriate delete using +* dlist_new_with_delete. Your delete function must match +(void * )(del(void *) +*Otherwise dlist will just use free. + +* NOTE: The small amount of pain involved in doing that allows us to +* avoid copy in copy out semantics. + +* Dlist uses an internal mark pointer to keep track of where you are +* in the list. + +* insert and delete take a directional parameter. Where direction +* corresponds to the direction in which you want the list to go. +* true direction corresponded to progressing forward in the last +* false to regressing in the list. +* so a dlist_insert(yourlist,item,1) will insert it after the mark +* so a dlist_insert(yourlist,item,0) will insert it before the mark +* any insert will move the mark to the new node regardless of the direction. + +* Just use the dlist_(insert|delete)_(before|after) macros if you do not want +* to think about it. +*/ + +#include + +typedef struct dl_node { + struct dl_node *prev; + struct dl_node *next; + void *data; +} DL_node; + +typedef struct dlist { + DL_node *marker; + unsigned long count; + size_t data_size; + void (*del_func)(void *); + DL_node headnode; + DL_node *head; +} Dlist; + +Dlist *dlist_new(size_t datasize); +Dlist *dlist_new_with_delete(size_t datasize,void (*del_func)(void*)); +void *_dlist_mark_move(Dlist *list,int direction); +void *dlist_mark(Dlist *); +void dlist_start(Dlist *); +void dlist_end(Dlist *); +void dlist_move(struct dlist *source, struct dlist *dest, struct dl_node *target,int direction); +void *dlist_insert(Dlist *,void *,int) ; + +void *dlist_insert_sorted(struct dlist *list, void *new_elem, int (*sorter)(void *, void *)); + +void dlist_delete(Dlist *,int); + +void dlist_push(Dlist *,void *); + +void dlist_unshift(Dlist *,void *); +void dlist_unshift_sorted(Dlist *,void *,int (*sorter)(void *, void *)); + +void *dlist_pop(Dlist *); + +void *dlist_shift(Dlist *); + +void dlist_destroy(Dlist *); + +int _dlist_merge(struct dlist *listsource, struct dlist *listdest, unsigned int passcount, int (*compare)(void *, void *)); + +void *dlist_find_custom(struct dlist *list, void *target, int (*comp)(void *, void *)); + +void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)); + + +void _dlist_swap(struct dlist *list, struct dl_node *a, struct dl_node *b); + +void dlist_transform(struct dlist *list, void (*node_operation)(void *)); + + +/* + * _dlist_remove is for internal use only + * _dlist_mark_move is for internal use only + */ +void *_dlist_remove(struct dlist *,struct dl_node *,int ); +void *_dlist_insert_dlnode(struct dlist *list,struct dl_node *new_node,int direction); + +#define dlist_prev(A) _dlist_mark_move((A),0) +#define dlist_next(A) _dlist_mark_move((A),1) + +#define dlist_insert_before(A,B) dlist_insert((A),(B),0) +#define dlist_insert_after(A,B) dlist_insert((A),(B),1) + +#define dlist_delete_before(A) dlist_delete((A),0) +#define dlist_delete_after(A) dlist_delete((A),1) + +/** + * provide for loop header which iterates the mark from start to end + * list: the dlist pointer, use dlist_mark(list) to get iterator + */ +#define dlist_for_each(list) \ + for(dlist_start(list),dlist_next(list); \ + (list)->marker!=(list)->head;dlist_next(list)) + +/** + * provide for loop header which iterates the mark from end to start + * list: the dlist pointer, use dlist_mark(list) to get iterator + */ +#define dlist_for_each_rev(list) \ + for(dlist_end(list),dlist_prev(list); \ + (list)->marker!=(list)->head;dlist_prev(list)) + +/** + * provide for loop header which iterates through the list without moving mark + * list: the dlist_pointer + * iterator: dl_node pointer to iterate + */ +#define dlist_for_each_nomark(list,iterator) \ + for((iterator)=(list)->head->next; (iterator)!=(list)->head; \ + (iterator)=(iterator)->next) + +/** + * provide for loop header which iterates through the list without moving mark + * in reverse + * list: the dlist_pointer + * iterator: dl_node pointer to iterate + */ +#define dlist_for_each_nomark_rev(list,iterator) \ + for((iterator)=(list)->head->prev; (iterator)!=(list)->head; \ + (iterator)=(iterator)->prev) +/** + * provide for loop header which iterates through the list providing a + * data iterator + * list: the dlist pointer + * data_iterator: the pointer of type datatype to iterate + * datatype: actual type of the contents in the dl_node->data + */ + +#define dlist_for_each_data(list,data_iterator,datatype) \ + for(dlist_start(list), (data_iterator)=(datatype *) dlist_next(list); \ + (list)->marker!=(list)->head;(data_iterator)=(datatype *) dlist_next(list)) + +/** + * provide for loop header which iterates through the list providing a + * data iterator in reverse + * list: the dlist pointer + * data_iterator: the pointer of type datatype to iterate + * datatype: actual type of the contents in the dl_node->data + */ +#define dlist_for_each_data_rev(list,data_iterator,datatype) \ + for(dlist_end(list), (data_iterator)=(datatype *) dlist_prev(list); \ + (list)->marker!=(list)->head;(data_iterator)=(datatype *) dlist_prev(list)) + +/** + * provide for loop header which iterates through the list providing a + * data iterator without moving the mark + * list: the dlist pointer + * iterator: the dl_node pointer to iterate + * data_iterator: the pointer of type datatype to iterate + * datatype: actual type of the contents in the dl_node->data + */ + +#define dlist_for_each_data_nomark(list,iterator,data_iterator,datatype) \ + for((iterator)=(list)->head->next, (data_iterator)=(datatype *) (iterator)->data; \ + (iterator)!=(list)->head;(iterator)=(iterator)->next,(data_iterator)=(datatype *) (iterator)) + +/** + * provide for loop header which iterates through the list providing a + * data iterator in reverse without moving the mark + * list: the dlist pointer + * iterator: the dl_node pointer to iterate + * data_iterator: the pointer of type datatype to iterate + * datatype: actual type of the contents in the dl_node->data + */ +#define dlist_for_each_data_nomark_rev(list,iterator, data_iterator,datatype) \ + for((iterator)=(list)->head->prev, (data_iterator)=(datatype *) (iterator)->data; \ + (iterator)!=(list)->head;(iterator)=(iterator)->prev,(data_iterator)=(datatype *) (iterator)) + +#endif /* _DLIST_H_ */ -- cgit v1.2.3-54-g00ecf From 911847864f1c9183cfca6e7255964d8ee622e943 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 11 Mar 2005 02:49:15 +0100 Subject: [PATCH] remove unneeded include --- udevinfo.c | 1 - 1 file changed, 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index 930a7be0ae..ccc3e58e2b 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -27,7 +27,6 @@ #include #include "libsysfs/sysfs/libsysfs.h" -#include "libsysfs/dlist.h" #include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" -- cgit v1.2.3-54-g00ecf From 7c492da7f7bb9eb69fdefab0430a0c3ef583d8a3 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 11 Mar 2005 08:02:47 +0100 Subject: [PATCH] volume_id: version 41 --- extras/volume_id/volume_id/iso9660.c | 98 ++++++++++++++++++++-------------- extras/volume_id/volume_id/util.c | 58 ++++++++++++-------- extras/volume_id/volume_id/util.h | 1 + extras/volume_id/volume_id/volume_id.h | 2 +- 4 files changed, 95 insertions(+), 64 deletions(-) diff --git a/extras/volume_id/volume_id/iso9660.c b/extras/volume_id/volume_id/iso9660.c index d4ccb9db9c..5d4ab92a79 100644 --- a/extras/volume_id/volume_id/iso9660.c +++ b/extras/volume_id/volume_id/iso9660.c @@ -47,68 +47,86 @@ #define ISO_VD_END 0xff #define ISO_VD_MAX 16 -union iso_super_block { - struct iso_header { - __u8 type; - __u8 id[5]; - __u8 version; - __u8 unused1; - __u8 system_id[32]; - __u8 volume_id[32]; - } __attribute__((__packed__)) iso; - struct hs_header { - __u8 foo[8]; - __u8 type; - __u8 id[4]; - __u8 version; - } __attribute__((__packed__)) hs; +struct iso_volume_descriptor { + __u8 vd_type; + __u8 vd_id[5]; + __u8 vd_version; + __u8 flags; + __u8 system_id[32]; + __u8 volume_id[32]; + __u8 unused[8]; + __u8 space_size[8]; + __u8 escape_sequences[8]; +} __attribute__((__packed__)); + +struct high_sierra_volume_descriptor { + __u8 foo[8]; + __u8 type; + __u8 id[4]; + __u8 version; } __attribute__((__packed__)); int volume_id_probe_iso9660(struct volume_id *id, __u64 off) { - union iso_super_block *is; + __u8 *buf; + struct iso_volume_descriptor *is; + struct high_sierra_volume_descriptor *hs; dbg("probing at offset 0x%llx", (unsigned long long) off); - is = (union iso_super_block *) volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); - if (is == NULL) + buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) return -1; - if (memcmp(is->iso.id, "CD001", 5) == 0) { - char root_label[VOLUME_ID_LABEL_SIZE+1]; + is = (struct iso_volume_descriptor *) buf; + + if (memcmp(is->vd_id, "CD001", 5) == 0) { int vd_offset; int i; - int found_svd; - memset(root_label, 0, sizeof(root_label)); - strncpy(root_label, is->iso.volume_id, sizeof(root_label)-1); + dbg("read label from PVD"); + volume_id_set_label_raw(id, is->volume_id, 32); + volume_id_set_label_string(id, is->volume_id, 32); - found_svd = 0; + dbg("looking for SVDs"); vd_offset = ISO_VD_OFFSET; for (i = 0; i < ISO_VD_MAX; i++) { - is = (union iso_super_block *) volume_id_get_buffer(id, off + vd_offset, 0x200); - if (is == NULL || is->iso.type == ISO_VD_END) - break; - if (is->iso.type == ISO_VD_SUPPLEMENTARY) { - dbg("found ISO supplementary VD at offset 0x%llx", (unsigned long long) (off + vd_offset)); - volume_id_set_label_raw(id, is->iso.volume_id, 32); - volume_id_set_label_unicode16(id, is->iso.volume_id, BE, 32); - found_svd = 1; + char svd_label[64]; + + is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200); + if (is == NULL || is->vd_type == ISO_VD_END) break; + if (is->vd_type != ISO_VD_SUPPLEMENTARY) + continue; + + dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset)); + if (memcmp(is->escape_sequences, "%/@", 3) == 0|| + memcmp(is->escape_sequences, "%/C", 3) == 0|| + memcmp(is->escape_sequences, "%/E", 3) == 0) { + dbg("Joliet extension found"); + volume_id_set_unicode16(svd_label, sizeof(svd_label), is->volume_id, BE, 32); + if (memcmp(id->label, svd_label, 16) == 0) { + dbg("SVD label is identical, use the possibly longer PVD one"); + break; + } + + volume_id_set_label_raw(id, is->volume_id, 32); + volume_id_set_label_string(id, svd_label, 32); + strcpy(id->type_version, "Joliet Extension"); + goto found; } vd_offset += ISO_SECTOR_SIZE; } - - if (!found_svd || - (found_svd && !memcmp(root_label, id->label, 16))) - { - volume_id_set_label_raw(id, root_label, 32); - volume_id_set_label_string(id, root_label, 32); - } goto found; } - if (memcmp(is->hs.id, "CDROM", 5) == 0) + + hs = (struct high_sierra_volume_descriptor *) buf; + + if (memcmp(hs->id, "CDROM", 5) == 0) { + strcpy(id->type_version, "High Sierra"); goto found; + } + return -1; found: diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 22abc9cbf8..7499fc121e 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -40,6 +40,40 @@ #include "logging.h" #include "util.h" +void volume_id_set_unicode16(char *str, unsigned int len, const __u8 *buf, enum endian endianess, unsigned int count) +{ + unsigned int i, j; + __u16 c; + + j = 0; + for (i = 0; i + 2 <= count; i += 2) { + if (endianess == LE) + c = (buf[i+1] << 8) | buf[i]; + else + c = (buf[i] << 8) | buf[i+1]; + if (c == 0) { + str[j] = '\0'; + break; + } else if (c < 0x80) { + if (j+1 >= len) + break; + str[j++] = (__u8) c; + } else if (c < 0x800) { + if (j+2 >= len) + break; + str[j++] = (__u8) (0xc0 | (c >> 6)); + str[j++] = (__u8) (0x80 | (c & 0x3f)); + } else { + if (j+3 >= len) + break; + str[j++] = (__u8) (0xe0 | (c >> 12)); + str[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f)); + str[j++] = (__u8) (0x80 | (c & 0x3f)); + } + } + str[j] = '\0'; +} + static char *usage_to_string(enum volume_id_usage usage_id) { switch (usage_id) { @@ -98,29 +132,7 @@ void volume_id_set_label_string(struct volume_id *id, const __u8 *buf, unsigned void volume_id_set_label_unicode16(struct volume_id *id, const __u8 *buf, enum endian endianess, unsigned int count) { - unsigned int i, j; - __u16 c; - - j = 0; - for (i = 0; i + 2 <= count; i += 2) { - if (endianess == LE) - c = (buf[i+1] << 8) | buf[i]; - else - c = (buf[i] << 8) | buf[i+1]; - if (c == 0) { - id->label[j] = '\0'; - break; - } else if (c < 0x80) { - id->label[j++] = (__u8) c; - } else if (c < 0x800) { - id->label[j++] = (__u8) (0xc0 | (c >> 6)); - id->label[j++] = (__u8) (0x80 | (c & 0x3f)); - } else { - id->label[j++] = (__u8) (0xe0 | (c >> 12)); - id->label[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f)); - id->label[j++] = (__u8) (0x80 | (c & 0x3f)); - } - } + volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count); } void volume_id_set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format format) diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h index 0357b42062..9cea8fc3a0 100644 --- a/extras/volume_id/volume_id/util.h +++ b/extras/volume_id/volume_id/util.h @@ -83,6 +83,7 @@ enum endian { BE = 1 }; +extern void volume_id_set_unicode16(char *str, unsigned int len, const __u8 *buf, enum endian endianess, unsigned int count); extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); extern void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id); extern void volume_id_set_label_raw(struct volume_id *id, const __u8 *buf, unsigned int count); diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 8287de28f6..0a273fba55 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 40 +#define VOLUME_ID_VERSION 41 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From afa3c553b1ff0ceb3e038cdf86d9261a8b8aa5d6 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 12 Mar 2005 00:14:38 +0100 Subject: [PATCH] volume_id: version 42 --- extras/volume_id/volume_id/Makefile.inc | 12 +++++ extras/volume_id/volume_id/highpoint.c | 53 +++++++++++++++--- extras/volume_id/volume_id/highpoint.h | 3 +- extras/volume_id/volume_id/isw_raid.c | 79 +++++++++++++++++++++++++++ extras/volume_id/volume_id/isw_raid.h | 26 +++++++++ extras/volume_id/volume_id/linux_raid.c | 5 +- extras/volume_id/volume_id/lsi_raid.c | 73 +++++++++++++++++++++++++ extras/volume_id/volume_id/lsi_raid.h | 26 +++++++++ extras/volume_id/volume_id/ntfs.c | 2 +- extras/volume_id/volume_id/nvidia_raid.c | 77 ++++++++++++++++++++++++++ extras/volume_id/volume_id/nvidia_raid.h | 26 +++++++++ extras/volume_id/volume_id/promise_raid.c | 83 ++++++++++++++++++++++++++++ extras/volume_id/volume_id/promise_raid.h | 26 +++++++++ extras/volume_id/volume_id/silicon_raid.c | 90 +++++++++++++++++++++++++++++++ extras/volume_id/volume_id/silicon_raid.h | 26 +++++++++ extras/volume_id/volume_id/via_raid.c | 88 ++++++++++++++++++++++++++++++ extras/volume_id/volume_id/via_raid.h | 26 +++++++++ extras/volume_id/volume_id/volume_id.c | 35 ++++++++++-- extras/volume_id/volume_id/volume_id.h | 2 +- 19 files changed, 742 insertions(+), 16 deletions(-) create mode 100644 extras/volume_id/volume_id/isw_raid.c create mode 100644 extras/volume_id/volume_id/isw_raid.h create mode 100644 extras/volume_id/volume_id/lsi_raid.c create mode 100644 extras/volume_id/volume_id/lsi_raid.h create mode 100644 extras/volume_id/volume_id/nvidia_raid.c create mode 100644 extras/volume_id/volume_id/nvidia_raid.h create mode 100644 extras/volume_id/volume_id/promise_raid.c create mode 100644 extras/volume_id/volume_id/promise_raid.h create mode 100644 extras/volume_id/volume_id/silicon_raid.c create mode 100644 extras/volume_id/volume_id/silicon_raid.h create mode 100644 extras/volume_id/volume_id/via_raid.c create mode 100644 extras/volume_id/volume_id/via_raid.h diff --git a/extras/volume_id/volume_id/Makefile.inc b/extras/volume_id/volume_id/Makefile.inc index 68d80d689c..acd26ff101 100644 --- a/extras/volume_id/volume_id/Makefile.inc +++ b/extras/volume_id/volume_id/Makefile.inc @@ -3,6 +3,12 @@ VOLUME_ID_OBJS= \ $(VOLUME_ID_BASE)/fat.o \ $(VOLUME_ID_BASE)/hfs.o \ $(VOLUME_ID_BASE)/highpoint.o \ + $(VOLUME_ID_BASE)/isw_raid.o \ + $(VOLUME_ID_BASE)/lsi_raid.o \ + $(VOLUME_ID_BASE)/via_raid.o \ + $(VOLUME_ID_BASE)/silicon_raid.o \ + $(VOLUME_ID_BASE)/nvidia_raid.o \ + $(VOLUME_ID_BASE)/promise_raid.o \ $(VOLUME_ID_BASE)/iso9660.o \ $(VOLUME_ID_BASE)/jfs.o \ $(VOLUME_ID_BASE)/linux_raid.o \ @@ -30,6 +36,12 @@ VOLUME_ID_HEADERS= \ $(VOLUME_ID_BASE)/fat.h \ $(VOLUME_ID_BASE)/hfs.h \ $(VOLUME_ID_BASE)/highpoint.h \ + $(VOLUME_ID_BASE)/isw_raid.h \ + $(VOLUME_ID_BASE)/lsi_raid.h \ + $(VOLUME_ID_BASE)/via_raid.h \ + $(VOLUME_ID_BASE)/silicon_raid.h \ + $(VOLUME_ID_BASE)/nvidia_raid.h \ + $(VOLUME_ID_BASE)/promise_raid.h \ $(VOLUME_ID_BASE)/iso9660.h \ $(VOLUME_ID_BASE)/jfs.h \ $(VOLUME_ID_BASE)/linux_raid.h \ diff --git a/extras/volume_id/volume_id/highpoint.c b/extras/volume_id/volume_id/highpoint.c index 72f7d28429..938a8934e5 100644 --- a/extras/volume_id/volume_id/highpoint.c +++ b/extras/volume_id/volume_id/highpoint.c @@ -39,20 +39,28 @@ #include "util.h" #include "highpoint.h" -struct hpt37x { +struct hpt37x_meta { __u8 filler1[32]; __u32 magic; - __u32 magic_0; - __u32 magic_1; -} __attribute__((packed)) *hpt; +} __attribute__((packed)); + +struct hpt45x_meta { + __u32 magic; +} __attribute__((packed)); #define HPT37X_CONFIG_OFF 0x1200 #define HPT37X_MAGIC_OK 0x5a7816f0 #define HPT37X_MAGIC_BAD 0x5a7816fd -int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off) +#define HPT45X_MAGIC_OK 0x5a7816f3 +#define HPT45X_MAGIC_BAD 0x5a7816fd + + +int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off) { const __u8 *buf; + struct hpt37x_meta *hpt; + __u32 magic; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -60,13 +68,42 @@ int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off) if (buf == NULL) return -1; - hpt = (struct hpt37x *) buf; + hpt = (struct hpt37x_meta *) buf; + magic = le32_to_cpu(hpt->magic); + if (magic != HPT37X_MAGIC_OK && magic != HPT37X_MAGIC_BAD) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "highpoint_raid_member"; + + return 0; +} + +int volume_id_probe_highpoint_45x_raid(struct volume_id *id, __u64 off, __u64 size) +{ + const __u8 *buf; + struct hpt45x_meta *hpt; + __u64 meta_off; + __u32 magic; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-11) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; - if (hpt->magic != HPT37X_MAGIC_OK && hpt->magic != HPT37X_MAGIC_BAD) + hpt = (struct hpt45x_meta *) buf; + magic = le32_to_cpu(hpt->magic); + if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD) return -1; volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "hpt_ataraid_member"; + id->type = "highpoint_raid_member"; return 0; } diff --git a/extras/volume_id/volume_id/highpoint.h b/extras/volume_id/volume_id/highpoint.h index 5a5614afef..7cc2ac0cb8 100644 --- a/extras/volume_id/volume_id/highpoint.h +++ b/extras/volume_id/volume_id/highpoint.h @@ -21,6 +21,7 @@ #ifndef _VOLUME_ID_HIGHPOINT_ #define _VOLUME_ID_HIGHPOINT_ -extern int volume_id_probe_highpoint_ataraid(struct volume_id *id, __u64 off); +extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off); +extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, __u64 off, __u64 size); #endif diff --git a/extras/volume_id/volume_id/isw_raid.c b/extras/volume_id/volume_id/isw_raid.c new file mode 100644 index 0000000000..c703f3fe27 --- /dev/null +++ b/extras/volume_id/volume_id/isw_raid.c @@ -0,0 +1,79 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "isw_raid.h" + +struct isw_meta { + __u8 sig[32]; + __u32 check_sum; + __u32 mpb_size; + __u32 family_num; + __u32 generation_num; +} __attribute__((packed)); + +#define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " + + +int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 size) +{ + const __u8 *buf; + __u64 meta_off; + struct isw_meta *isw; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-2) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + isw = (struct isw_meta *) buf; + if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + strncpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); + id->type = "isw_raid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/isw_raid.h b/extras/volume_id/volume_id/isw_raid.h new file mode 100644 index 0000000000..4bfd3bb529 --- /dev/null +++ b/extras/volume_id/volume_id/isw_raid.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_ISW_RAID_ +#define _VOLUME_ID_ISW_RAID_ + +extern int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 size); + +#endif diff --git a/extras/volume_id/volume_id/linux_raid.c b/extras/volume_id/volume_id/linux_raid.c index e7db4031de..598002ec4f 100644 --- a/extras/volume_id/volume_id/linux_raid.c +++ b/extras/volume_id/volume_id/linux_raid.c @@ -67,7 +67,8 @@ int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) __u64 sboff; __u8 uuid[16]; - dbg("probing at offset 0x%llx", (unsigned long long) off); + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) return -1; @@ -86,7 +87,7 @@ int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) memcpy(&uuid[4], &mdp->set_uuid1, 12); volume_id_set_uuid(id, uuid, UUID_DCE); - snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, "%u.%u.%u", + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", le32_to_cpu(mdp->major_version), le32_to_cpu(mdp->minor_version), le32_to_cpu(mdp->patch_version)); diff --git a/extras/volume_id/volume_id/lsi_raid.c b/extras/volume_id/volume_id/lsi_raid.c new file mode 100644 index 0000000000..e411fbc264 --- /dev/null +++ b/extras/volume_id/volume_id/lsi_raid.c @@ -0,0 +1,73 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "lsi_raid.h" + +struct lsi_meta { + __u8 sig[6]; +} __attribute__((packed)); + +#define LSI_SIGNATURE "$XIDE$" + +int volume_id_probe_lsi_mega_raid(struct volume_id *id, __u64 off, __u64 size) +{ + const __u8 *buf; + __u64 meta_off; + struct lsi_meta *lsi; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + lsi = (struct lsi_meta *) buf; + if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "lsi_mega_raid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/lsi_raid.h b/extras/volume_id/volume_id/lsi_raid.h new file mode 100644 index 0000000000..b3ee0bb7fb --- /dev/null +++ b/extras/volume_id/volume_id/lsi_raid.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_LSI_RAID_ +#define _VOLUME_ID_LSI_RAID_ + +extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, __u64 off, __u64 size); + +#endif diff --git a/extras/volume_id/volume_id/ntfs.c b/extras/volume_id/volume_id/ntfs.c index 8f31735a2d..f9df0e9cc3 100644 --- a/extras/volume_id/volume_id/ntfs.c +++ b/extras/volume_id/volume_id/ntfs.c @@ -184,7 +184,7 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { dbg("found info, len %i", val_len); info = (struct volume_info*) (((__u8 *) attr) + val_off); - snprintf(id->type_version, VOLUME_ID_FORMAT_SIZE-1, + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", info->major_ver, info->minor_ver); } diff --git a/extras/volume_id/volume_id/nvidia_raid.c b/extras/volume_id/volume_id/nvidia_raid.c new file mode 100644 index 0000000000..ad76631799 --- /dev/null +++ b/extras/volume_id/volume_id/nvidia_raid.c @@ -0,0 +1,77 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "nvidia_raid.h" + +struct nvidia_meta { + __u8 vendor[8]; + __u32 size; + __u32 chksum; + __u16 version; +} __attribute__((packed)); + +#define NVIDIA_SIGNATURE "NVIDIA" + +int volume_id_probe_nvidia_raid(struct volume_id *id, __u64 off, __u64 size) +{ + const __u8 *buf; + __u64 meta_off; + struct nvidia_meta *nv; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-2) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + nv = (struct nvidia_meta *) buf; + if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le16_to_cpu(nv->version)); + id->type = "nvidia_raid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/nvidia_raid.h b/extras/volume_id/volume_id/nvidia_raid.h new file mode 100644 index 0000000000..f892be5590 --- /dev/null +++ b/extras/volume_id/volume_id/nvidia_raid.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_NVIDIA_RAID_ +#define _VOLUME_ID_NVIDIA_RAID_ + +extern int volume_id_probe_nvidia_raid(struct volume_id *id, __u64 off, __u64 size); + +#endif diff --git a/extras/volume_id/volume_id/promise_raid.c b/extras/volume_id/volume_id/promise_raid.c new file mode 100644 index 0000000000..8fda14945f --- /dev/null +++ b/extras/volume_id/volume_id/promise_raid.c @@ -0,0 +1,83 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "promise_raid.h" + +struct promise_meta { + __u8 sig[24]; +} __attribute__((packed)); + +#define PDC_CONFIG_OFF 0x1200 +#define PDC_SIGNATURE "Promise Technology, Inc." + +int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u64 size) +{ + const __u8 *buf; + struct promise_meta *pdc; + unsigned int i; + static unsigned int sectors[] = { + 63, 255, 256, 16, 399, 0 + }; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x40000) + return -1; + + for (i = 0; sectors[i] != 0; i++) { + __u64 meta_off; + + meta_off = ((size / 0x200) - sectors[i]) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + pdc = (struct promise_meta *) buf; + if (memcmp(pdc->sig, PDC_SIGNATURE, sizeof(PDC_SIGNATURE)-1) == 0) + goto found; + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "promise_fasttrack_raid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/promise_raid.h b/extras/volume_id/volume_id/promise_raid.h new file mode 100644 index 0000000000..554bcb97d5 --- /dev/null +++ b/extras/volume_id/volume_id/promise_raid.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_PROMISE_RAID_ +#define _VOLUME_ID_PROMISE_RAID_ + +extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u64 size); + +#endif diff --git a/extras/volume_id/volume_id/silicon_raid.c b/extras/volume_id/volume_id/silicon_raid.c new file mode 100644 index 0000000000..e528a34ce0 --- /dev/null +++ b/extras/volume_id/volume_id/silicon_raid.c @@ -0,0 +1,90 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "silicon_raid.h" + +struct silicon_meta { + __u8 unknown0[0x2E]; + __u8 ascii_version[0x36 - 0x2E]; + __u8 diskname[0x56 - 0x36]; + __u8 unknown1[0x60 - 0x56]; + __u32 magic; + __u32 unknown1a[0x6C - 0x64]; + __u32 array_sectors_low; + __u32 array_sectors_high; + __u8 unknown2[0x78 - 0x74]; + __u32 thisdisk_sectors; + __u8 unknown3[0x100 - 0x7C]; + __u8 unknown4[0x104 - 0x100]; + __u16 product_id; + __u16 vendor_id; + __u16 minor_ver; + __u16 major_ver; +} __attribute__((packed)); + +#define SILICON_MAGIC 0x2F000000 + +int volume_id_probe_silicon_medley_raid(struct volume_id *id, __u64 off, __u64 size) +{ + const __u8 *buf; + __u64 meta_off; + struct silicon_meta *sil; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + sil = (struct silicon_meta *) buf; + if (le32_to_cpu(sil->magic) != SILICON_MAGIC) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", + le16_to_cpu(sil->major_ver), le16_to_cpu(sil->minor_ver)); + id->type = "silicon_medley_raid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/silicon_raid.h b/extras/volume_id/volume_id/silicon_raid.h new file mode 100644 index 0000000000..b88e80bb1c --- /dev/null +++ b/extras/volume_id/volume_id/silicon_raid.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_SILICON_RAID_ +#define _VOLUME_ID_SILICON_RAID_ + +extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, __u64 off, __u64 size); + +#endif diff --git a/extras/volume_id/volume_id/via_raid.c b/extras/volume_id/volume_id/via_raid.c new file mode 100644 index 0000000000..393890eb28 --- /dev/null +++ b/extras/volume_id/volume_id/via_raid.c @@ -0,0 +1,88 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "via_raid.h" + +struct via_meta { + __u16 signature; + __u8 version_number; + struct via_array { + __u16 disk_bits; + __u8 disk_array_ex; + __u32 capacity_low; + __u32 capacity_high; + __u32 serial_checksum; + } __attribute((packed)) array; + __u32 serial_checksum[8]; + __u8 checksum; +} __attribute__((packed)); + +#define VIA_SIGNATURE 0xAA55 + +int volume_id_probe_via_raid(struct volume_id *id, __u64 off, __u64 size) +{ + const __u8 *buf; + __u64 meta_off; + struct via_meta *via; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + via = (struct via_meta *) buf; + if (le16_to_cpu(via->signature) != VIA_SIGNATURE) + return -1; + + if (via->version_number > 1) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", via->version_number); + id->type = "via_raid_member"; + + return 0; +} diff --git a/extras/volume_id/volume_id/via_raid.h b/extras/volume_id/volume_id/via_raid.h new file mode 100644 index 0000000000..2d0651c413 --- /dev/null +++ b/extras/volume_id/volume_id/via_raid.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_VIA_RAID_ +#define _VOLUME_ID_VIA_RAID_ + +extern int volume_id_probe_via_raid(struct volume_id *id, __u64 off, __u64 size); + +#endif diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 22d30ee741..3fe8562e33 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -52,6 +52,12 @@ #include "iso9660.h" #include "udf.h" #include "highpoint.h" +#include "isw_raid.h" +#include "lsi_raid.h" +#include "via_raid.h" +#include "silicon_raid.h" +#include "nvidia_raid.h" +#include "promise_raid.h" #include "luks.h" #include "linux_swap.h" #include "linux_raid.h" @@ -70,8 +76,31 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l return -EINVAL; /* probe for raid first, cause fs probes may be successful on raid members */ - if (volume_id_probe_linux_raid(id, off, size) == 0) - goto exit; + if (size) { + if (volume_id_probe_linux_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_intel_software_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_lsi_mega_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_via_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_silicon_medley_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_nvidia_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_promise_fasttrack_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0) + goto exit; + } if (volume_id_probe_lvm1(id, off) == 0) goto exit; @@ -79,7 +108,7 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l if (volume_id_probe_lvm2(id, off) == 0) goto exit; - if (volume_id_probe_highpoint_ataraid(id, off) == 0) + if (volume_id_probe_highpoint_37x_raid(id, off) == 0) goto exit; if (volume_id_probe_luks(id, off) == 0) diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 0a273fba55..63f95132df 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 41 +#define VOLUME_ID_VERSION 42 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From 319112e295bbf1ed5d86389190abbe24ce251b14 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 12 Mar 2005 20:55:41 +0100 Subject: [PATCH] remove udevstart on make clean --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9b37402fb9..8e29f24e70 100644 --- a/Makefile +++ b/Makefile @@ -321,7 +321,8 @@ $(STARTER): $(LIBC) $(STARTER).o $(OBJS) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) $(SENDER) $(TESTER) + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) \ + $(SENDER) $(TESTER) $(STARTER) -rm -f ccdv $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ -- cgit v1.2.3-54-g00ecf From e6764498e7592f216a1895eacc485448fa4a1660 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 12 Mar 2005 21:41:57 +0100 Subject: [PATCH] correct enum device_type --- namedev.c | 4 ++-- udev.c | 6 +++--- udev.h | 12 ++++++------ udev_add.c | 10 +++++----- udev_remove.c | 2 +- udev_utils.c | 8 ++++---- udevtest.c | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/namedev.c b/namedev.c index cd1f2de989..fd1cf0458a 100644 --- a/namedev.c +++ b/namedev.c @@ -698,7 +698,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d dbg_parse("remove event should be ignored"); } /* apply all_partitions option only at a main block device */ - if (dev->partitions && udev->type == BLOCK && udev->kernel_number[0] == '\0') { + if (dev->partitions && udev->type == DEV_BLOCK && udev->kernel_number[0] == '\0') { udev->partitions = dev->partitions; dbg("creation of partition nodes requested"); } @@ -753,7 +753,7 @@ int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_d strlcpy(udev->config_file, dev->config_file, sizeof(udev->config_file)); udev->config_line = dev->config_line; - if (udev->type != NET) + if (udev->type != DEV_NET) dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", udev->name, udev->owner, udev->group, udev->mode, udev->partitions); diff --git a/udev.c b/udev.c index bf2eb373f8..8ce813fbf5 100644 --- a/udev.c +++ b/udev.c @@ -154,13 +154,13 @@ int main(int argc, char *argv[], char *envp[]) if (udev_log) setenv("UDEV_LOG", "1", 1); - if (udev.type == BLOCK || udev.type == CLASS || udev.type == NET) { + if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS || udev.type == DEV_NET) { if (strcmp(action, "add") == 0) { /* wait for sysfs and possibly add node */ dbg("udev add"); /* skip subsystems without "dev", but handle net devices */ - if (udev.type != NET && subsystem_expect_no_dev(udev.subsystem)) { + if (udev.type != DEV_NET && subsystem_expect_no_dev(udev.subsystem)) { dbg("don't care about '%s' devices", udev.subsystem); goto hotplug; } @@ -203,7 +203,7 @@ int main(int argc, char *argv[], char *envp[]) if (udev_dev_d) udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); } - } else if (udev.type == PHYSDEV) { + } else if (udev.type == DEV_DEVICE) { if (strcmp(action, "add") == 0) { /* wait for sysfs */ dbg("devices add"); diff --git a/udev.h b/udev.h index 7eb07bf125..6e41bb5d26 100644 --- a/udev.h +++ b/udev.h @@ -48,24 +48,24 @@ #define DEFAULT_PARTITIONS_COUNT 15 enum device_type { - UNKNOWN, - CLASS, - BLOCK, - NET, - PHYSDEV, + DEV_UNKNOWN, + DEV_CLASS, + DEV_BLOCK, + DEV_NET, + DEV_DEVICE, }; struct udevice { char devpath[PATH_SIZE]; char subsystem[NAME_SIZE]; + enum device_type type; char name[PATH_SIZE]; char devname[PATH_SIZE]; struct list_head symlink_list; char owner[USER_SIZE]; char group[USER_SIZE]; mode_t mode; - char type; dev_t devt; char tmp_node[PATH_SIZE]; diff --git a/udev_add.c b/udev_add.c index 42b8d2104c..bf5feb1b2d 100644 --- a/udev_add.c +++ b/udev_add.c @@ -70,10 +70,10 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo create: switch (udev->type) { - case BLOCK: + case DEV_BLOCK: mode |= S_IFBLK; break; - case CLASS: + case DEV_CLASS: mode |= S_IFCHR; break; default: @@ -268,7 +268,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) char *pos; int retval = 0; - if (udev->type == BLOCK || udev->type == CLASS) { + if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { udev->devt = get_devt(class_dev); if (!udev->devt) { dbg("no dev-file found, do nothing"); @@ -283,7 +283,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) selinux_init(); - if (udev->type == BLOCK || udev->type == CLASS) { + if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { retval = create_node(udev, class_dev); if (retval != 0) goto exit; @@ -296,7 +296,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); udev->devname[sizeof(udev->devname)-1] = '\0'; - } else if (udev->type == NET) { + } else if (udev->type == DEV_NET) { /* look if we want to change the name of the netif */ if (strcmp(udev->name, udev->kernel_name) != 0) { retval = rename_net_if(udev); diff --git a/udev_remove.c b/udev_remove.c index c3a7880b49..a81d20c98c 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -143,7 +143,7 @@ int udev_remove_device(struct udevice *udev) { const char *temp; - if (udev->type != BLOCK && udev->type != CLASS) + if (udev->type != DEV_BLOCK && udev->type != DEV_CLASS) return 0; if (udev_db_get_device(udev, udev->devpath) == 0) { diff --git a/udev_utils.c b/udev_utils.c index afa9790fdc..b650096593 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -53,13 +53,13 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs no_trailing_slash(udev->devpath); if (strncmp(udev->devpath, "/block/", 7) == 0) - udev->type = BLOCK; + udev->type = DEV_BLOCK; else if (strncmp(udev->devpath, "/class/net/", 11) == 0) - udev->type = NET; + udev->type = DEV_NET; else if (strncmp(udev->devpath, "/class/", 7) == 0) - udev->type = CLASS; + udev->type = DEV_CLASS; else if (strncmp(udev->devpath, "/devices/", 9) == 0) - udev->type = PHYSDEV; + udev->type = DEV_DEVICE; /* get kernel name */ pos = strrchr(udev->devpath, '/'); diff --git a/udevtest.c b/udevtest.c index 5ce2570058..1e0037978b 100644 --- a/udevtest.c +++ b/udevtest.c @@ -92,7 +92,7 @@ int main(int argc, char *argv[], char *envp[]) udev_init_device(&udev, devpath, subsystem); /* skip subsystems without "dev", but handle net devices */ - if (udev.type != NET && subsystem_expect_no_dev(udev.subsystem)) { + if (udev.type != DEV_NET && subsystem_expect_no_dev(udev.subsystem)) { info("don't care about '%s' devices", udev.subsystem); return 2; } -- cgit v1.2.3-54-g00ecf From e5e322bc627a07d29a07e08f7c96bd644a3ae057 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 12 Mar 2005 22:36:32 +0100 Subject: [PATCH] rename namedev_dev to udev_rule --- Makefile | 6 +- README | 2 +- logging.h | 10 - namedev.c | 778 ----------------------------------------------------- namedev.h | 94 ------- namedev_parse.c | 369 ------------------------- udev.c | 4 +- udev_add.c | 4 +- udev_config.c | 9 +- udev_remove.c | 1 - udev_rules.c | 778 +++++++++++++++++++++++++++++++++++++++++++++++++++++ udev_rules.h | 94 +++++++ udev_rules_parse.c | 365 +++++++++++++++++++++++++ udevstart.c | 4 +- udevtest.c | 4 +- 15 files changed, 1252 insertions(+), 1270 deletions(-) delete mode 100644 namedev.c delete mode 100644 namedev.h delete mode 100644 namedev_parse.c create mode 100644 udev_rules.c create mode 100644 udev_rules.h create mode 100644 udev_rules_parse.c diff --git a/Makefile b/Makefile index 8e29f24e70..556298a9f1 100644 --- a/Makefile +++ b/Makefile @@ -117,7 +117,7 @@ CFLAGS := -pipe HEADERS = \ udev.h \ udev_utils.h \ - namedev.h \ + udev_rules.h \ udev_version.h \ udev_db.h \ udev_sysfs.h \ @@ -142,8 +142,8 @@ UDEV_OBJS = \ udev_sysfs.o \ udev_db.o \ udev_multiplex.o \ - namedev.o \ - namedev_parse.o \ + udev_rules.o \ + udev_rules_parse.o \ udev_libc_wrapper.o OBJS = \ diff --git a/README b/README index c0475dc904..54cee659a8 100644 --- a/README +++ b/README @@ -65,7 +65,7 @@ To use: This will put the udev binary in /sbin, create the /udev and /etc/udev directories, and place the udev configuration files in /etc/udev. You - will probably want to edit the namedev.* files to create custom naming + will probably want to edit the *.rules files to create custom naming rules. More info on how the config files are set up are contained in comments in the files, and is located in the documentation. diff --git a/logging.h b/logging.h index 3ff54ec974..e7653ee1b8 100644 --- a/logging.h +++ b/logging.h @@ -26,7 +26,6 @@ #define info(format, arg...) do { } while (0) #define dbg(format, arg...) do { } while (0) -#define dbg_parse(format, arg...) do { } while (0) #define logging_init(foo) do { } while (0) #define logging_close(foo) do { } while (0) @@ -49,15 +48,6 @@ } while (0) #endif -/* Parser needs it's own debugging statement, we usually don't care about this at all */ -#ifdef DEBUG_PARSER -#undef dbg_parse -#define dbg_parse(format, arg...) \ - do { \ - log_message(LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ - } while (0) -#endif - extern void log_message(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); diff --git a/namedev.c b/namedev.c deleted file mode 100644 index fd1cf0458a..0000000000 --- a/namedev.c +++ /dev/null @@ -1,778 +0,0 @@ -/* - * namedev.c - * - * Userspace devfs - * - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2005 Kay Sievers - * - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libsysfs/sysfs/libsysfs.h" -#include "list.h" -#include "udev_libc_wrapper.h" -#include "udev.h" -#include "udev_utils.h" -#include "udev_version.h" -#include "logging.h" -#include "namedev.h" -#include "udev_db.h" - -static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr); - -/* compare string with pattern (supports * ? [0-9] [!A-Z]) */ -static int strcmp_pattern(const char *p, const char *s) -{ - if (s[0] == '\0') { - while (p[0] == '*') - p++; - return (p[0] != '\0'); - } - switch (p[0]) { - case '[': - { - int not = 0; - p++; - if (p[0] == '!') { - not = 1; - p++; - } - while ((p[0] != '\0') && (p[0] != ']')) { - int match = 0; - if (p[1] == '-') { - if ((s[0] >= p[0]) && (s[0] <= p[2])) - match = 1; - p += 3; - } else { - match = (p[0] == s[0]); - p++; - } - if (match ^ not) { - while ((p[0] != '\0') && (p[0] != ']')) - p++; - if (p[0] == ']') - return strcmp_pattern(p+1, s+1); - } - } - } - break; - case '*': - if (strcmp_pattern(p, s+1)) - return strcmp_pattern(p+1, s); - return 0; - case '\0': - if (s[0] == '\0') { - return 0; - } - break; - default: - if ((p[0] == s[0]) || (p[0] == '?')) - return strcmp_pattern(p+1, s+1); - break; - } - return 1; -} - -/* extract possible {attr} and move str behind it */ -static char *get_format_attribute(char **str) -{ - char *pos; - char *attr = NULL; - - if (*str[0] == '{') { - pos = strchr(*str, '}'); - if (pos == NULL) { - dbg("missing closing brace for format"); - return NULL; - } - pos[0] = '\0'; - attr = *str+1; - *str = pos+1; - dbg("attribute='%s', str='%s'", attr, *str); - } - return attr; -} - -/* extract possible format length and move str behind it*/ -static int get_format_len(char **str) -{ - int num; - char *tail; - - if (isdigit(*str[0])) { - num = (int) strtoul(*str, &tail, 10); - if (num > 0) { - *str = tail; - dbg("format length=%i", num); - return num; - } else { - dbg("format parsing error '%s'", *str); - } - } - return -1; -} - -/** Finds the lowest positive N such that N isn't present in - * $(udevroot) either as a file or a symlink. - * - * @param name Name to check for - * @return 0 if didn't exist and N otherwise. - */ -static int find_free_number(struct udevice *udev, const char *name) -{ - char devpath[PATH_SIZE]; - char filename[PATH_SIZE]; - int num = 0; - - strlcpy(filename, name, sizeof(filename)); - while (1) { - dbg("look for existing node '%s'", filename); - if (udev_db_search_name(devpath, sizeof(devpath), filename) != 0) { - dbg("free num=%d", num); - return num; - } - - num++; - if (num > 1000) { - info("find_free_number gone crazy (num=%d), aborted", num); - return -1; - } - snprintf(filename, sizeof(filename), "%s%d", name, num); - filename[sizeof(filename)-1] = '\0'; - } -} - -static void apply_format(struct udevice *udev, char *string, size_t maxsize, - struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) -{ - char temp[PATH_SIZE]; - char temp2[PATH_SIZE]; - char *tail, *pos, *cpos, *attr, *rest; - int len; - int i; - char c; - struct sysfs_attribute *tmpattr; - unsigned int next_free_number; - struct sysfs_class_device *class_dev_parent; - - pos = string; - while (1) { - pos = strchr(pos, '%'); - if (pos == NULL) - break; - - pos[0] = '\0'; - tail = pos+1; - len = get_format_len(&tail); - c = tail[0]; - strlcpy(temp, tail+1, sizeof(temp)); - tail = temp; - dbg("format=%c, string='%s', tail='%s'",c , string, tail); - attr = get_format_attribute(&tail); - - switch (c) { - case 'p': - strlcat(string, udev->devpath, maxsize); - dbg("substitute kernel name '%s'", udev->kernel_name); - break; - case 'b': - strlcat(string, udev->bus_id, maxsize); - dbg("substitute bus_id '%s'", udev->bus_id); - break; - case 'k': - strlcat(string, udev->kernel_name, maxsize); - dbg("substitute kernel name '%s'", udev->kernel_name); - break; - case 'n': - strlcat(string, udev->kernel_number, maxsize); - dbg("substitute kernel number '%s'", udev->kernel_number); - break; - case 'm': - sprintf(temp2, "%d", minor(udev->devt)); - strlcat(string, temp2, maxsize); - dbg("substitute minor number '%s'", temp2); - break; - case 'M': - sprintf(temp2, "%d", major(udev->devt)); - strlcat(string, temp2, maxsize); - dbg("substitute major number '%s'", temp2); - break; - case 'c': - if (udev->program_result[0] == '\0') - break; - /* get part part of the result string */ - i = 0; - if (attr != NULL) - i = strtoul(attr, &rest, 10); - if (i > 0) { - dbg("request part #%d of result string", i); - cpos = udev->program_result; - while (--i) { - while (cpos[0] != '\0' && !isspace(cpos[0])) - cpos++; - while (isspace(cpos[0])) - cpos++; - } - if (i > 0) { - dbg("requested part of result string not found"); - break; - } - strlcpy(temp2, cpos, sizeof(temp2)); - /* %{2+}c copies the whole string from the second part on */ - if (rest[0] != '+') { - cpos = strchr(temp2, ' '); - if (cpos) - cpos[0] = '\0'; - } - strlcat(string, temp2, maxsize); - dbg("substitute part of result string '%s'", temp2); - } else { - strlcat(string, udev->program_result, maxsize); - dbg("substitute result string '%s'", udev->program_result); - } - break; - case 's': - if (!class_dev) - break; - if (attr == NULL) { - dbg("missing attribute"); - break; - } - tmpattr = find_sysfs_attribute(class_dev, sysfs_device, attr); - if (tmpattr == NULL) { - dbg("sysfa attribute '%s' not found", attr); - break; - } - /* strip trailing whitespace of matching value */ - if (isspace(tmpattr->value[strlen(tmpattr->value)-1])) { - i = len = strlen(tmpattr->value); - while (i > 0 && isspace(tmpattr->value[i-1])) - i--; - if (i < len) { - tmpattr->value[i] = '\0'; - dbg("remove %i trailing whitespace chars from '%s'", - len - i, tmpattr->value); - } - } - strlcat(string, tmpattr->value, maxsize); - dbg("substitute sysfs value '%s'", tmpattr->value); - break; - case '%': - strlcat(string, "%", maxsize); - pos++; - break; - case 'e': - next_free_number = find_free_number(udev, string); - if (next_free_number > 0) { - sprintf(temp2, "%d", next_free_number); - strlcat(string, temp2, maxsize); - } - break; - case 'P': - if (!class_dev) - break; - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) { - struct udevice udev_parent; - - dbg("found parent '%s', get the node name", class_dev_parent->path); - udev_init_device(&udev_parent, NULL, NULL); - /* lookup the name in the udev_db with the DEVPATH of the parent */ - if (udev_db_get_device(&udev_parent, &class_dev_parent->path[strlen(sysfs_path)]) == 0) { - strlcat(string, udev_parent.name, maxsize); - dbg("substitute parent node name'%s'", udev_parent.name); - } else - dbg("parent not found in database"); - udev_cleanup_device(&udev_parent); - } - break; - case 'N': - if (udev->tmp_node[0] == '\0') { - dbg("create temporary device node for callout"); - snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", - udev_root, major(udev->devt), minor(udev->devt)); - udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0'; - udev_make_node(udev, udev->tmp_node, udev->devt, 0600, 0, 0); - } - strlcat(string, udev->tmp_node, maxsize); - dbg("substitute temporary device node name '%s'", udev->tmp_node); - break; - case 'r': - strlcat(string, udev_root, maxsize); - dbg("substitute udev_root '%s'", udev_root); - break; - default: - dbg("unknown substitution type '%%%c'", c); - break; - } - /* truncate to specified length */ - if (len > 0) - pos[len] = '\0'; - - strlcat(string, tail, maxsize); - } -} - -static int execute_program(struct udevice *udev, const char *path, char *value, int len) -{ - int retval; - int count; - int status; - int fds[2]; - pid_t pid; - char *pos; - char arg[PATH_SIZE]; - char *argv[(sizeof(arg) / 2) + 1]; - int i; - - strlcpy(arg, path, sizeof(arg)); - i = 0; - if (strchr(path, ' ')) { - pos = arg; - while (pos != NULL) { - if (pos[0] == '\'') { - /* don't separate if in apostrophes */ - pos++; - argv[i] = strsep(&pos, "\'"); - while (pos && pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - } - dbg("arg[%i] '%s'", i, argv[i]); - i++; - } - argv[i] = NULL; - dbg("execute '%s' with parsed arguments", arg); - } else { - argv[0] = arg; - argv[1] = udev->subsystem; - argv[2] = NULL; - dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); - } - - retval = pipe(fds); - if (retval != 0) { - dbg("pipe failed"); - return -1; - } - - pid = fork(); - switch(pid) { - case 0: - /* child */ - /* dup2 write side of pipe to STDOUT */ - dup2(fds[1], STDOUT_FILENO); - retval = execv(arg, argv); - - info(FIELD_PROGRAM " execution of '%s' failed", path); - exit(1); - case -1: - dbg("fork failed"); - return -1; - default: - /* parent reads from fds[0] */ - close(fds[1]); - retval = 0; - i = 0; - while (1) { - count = read(fds[0], value + i, len - i-1); - if (count <= 0) - break; - - i += count; - if (i >= len-1) { - dbg("result len %d too short", len); - retval = -1; - break; - } - } - - if (count < 0) { - dbg("read failed with '%s'", strerror(errno)); - retval = -1; - } - - if (i > 0 && value[i-1] == '\n') - i--; - value[i] = '\0'; - dbg("result is '%s'", value); - - close(fds[0]); - waitpid(pid, &status, 0); - - if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { - dbg("exec program status 0x%x", status); - retval = -1; - } - } - return retval; -} - -static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr) -{ - struct sysfs_attribute *tmpattr = NULL; - char *c; - - dbg("look for device attribute '%s'", attr); - /* try to find the attribute in the class device directory */ - tmpattr = sysfs_get_classdev_attr(class_dev, attr); - if (tmpattr) - goto attr_found; - - /* look in the class device directory if present */ - if (sysfs_device) { - tmpattr = sysfs_get_device_attr(sysfs_device, attr); - if (tmpattr) - goto attr_found; - } - - return NULL; - -attr_found: - c = strchr(tmpattr->value, '\n'); - if (c != NULL) - c[0] = '\0'; - - dbg("found attribute '%s'", tmpattr->path); - return tmpattr; -} - -static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair) -{ - struct sysfs_attribute *tmpattr; - int i; - int len; - - if ((pair == NULL) || (pair->file[0] == '\0') || (pair->value == '\0')) - return -ENODEV; - - tmpattr = find_sysfs_attribute(class_dev, sysfs_device, pair->file); - if (tmpattr == NULL) - return -ENODEV; - - /* strip trailing whitespace of value, if not asked to match for it */ - if (! isspace(pair->value[strlen(pair->value)-1])) { - i = len = strlen(tmpattr->value); - while (i > 0 && isspace(tmpattr->value[i-1])) - i--; - if (i < len) { - tmpattr->value[i] = '\0'; - dbg("remove %i trailing whitespace chars from '%s'", - len - i, tmpattr->value); - } - } - - dbg("compare attribute '%s' value '%s' with '%s'", - pair->file, tmpattr->value, pair->value); - if (strcmp_pattern(pair->value, tmpattr->value) != 0) - return -ENODEV; - - dbg("found matching attribute '%s' with value '%s'", - pair->file, pair->value); - return 0; -} - -static int match_sysfs_pairs(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) -{ - struct sysfs_pair *pair; - int i; - - for (i = 0; i < MAX_SYSFS_PAIRS; ++i) { - pair = &dev->sysfs_pair[i]; - if ((pair->file[0] == '\0') || (pair->value[0] == '\0')) - break; - if (compare_sysfs_attribute(class_dev, sysfs_device, pair) != 0) { - dbg("sysfs attribute doesn't match"); - return -ENODEV; - } - } - - return 0; -} - -static int match_id(struct config_device *dev, struct sysfs_device *sysfs_device) -{ - char path[PATH_SIZE]; - char *temp; - - strlcpy(path, sysfs_device->path, sizeof(path)); - temp = strrchr(path, '/'); - temp++; - dbg("search '%s' in '%s', path='%s'", dev->id, temp, path); - if (strcmp_pattern(dev->id, temp) != 0) - return -ENODEV; - - return 0; -} - -static int match_rule(struct udevice *udev, struct config_device *dev, - struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) -{ - if (dev->kernel[0] != '\0') { - dbg("check for " FIELD_KERNEL " dev->kernel='%s' class_dev->name='%s'", - dev->kernel, class_dev->name); - if (strcmp_pattern(dev->kernel, class_dev->name) != 0) { - dbg(FIELD_KERNEL " is not matching"); - goto exit; - } - dbg(FIELD_KERNEL " matches"); - } - - if (dev->subsystem[0] != '\0') { - dbg("check for " FIELD_SUBSYSTEM " dev->subsystem='%s' class_dev->name='%s'", - dev->subsystem, class_dev->name); - if (strcmp_pattern(dev->subsystem, udev->subsystem) != 0) { - dbg(FIELD_SUBSYSTEM " is not matching"); - goto exit; - } - dbg(FIELD_SUBSYSTEM " matches"); - } - - /* walk up the chain of physical devices and find a match */ - while (1) { - /* check for matching driver */ - if (dev->driver[0] != '\0') { - if (sysfs_device == NULL) { - dbg("device has no sysfs_device"); - goto try_parent; - } - dbg("check for " FIELD_DRIVER " dev->driver='%s' sysfs_device->driver_name='%s'", - dev->driver, sysfs_device->driver_name); - if (strcmp_pattern(dev->driver, sysfs_device->driver_name) != 0) { - dbg(FIELD_DRIVER " is not matching"); - goto try_parent; - } - dbg(FIELD_DRIVER " matches"); - } - - /* check for matching bus value */ - if (dev->bus[0] != '\0') { - if (sysfs_device == NULL) { - dbg("device has no sysfs_device"); - goto try_parent; - } - dbg("check for " FIELD_BUS " dev->bus='%s' sysfs_device->bus='%s'", - dev->bus, sysfs_device->bus); - if (strcmp_pattern(dev->bus, sysfs_device->bus) != 0) { - dbg(FIELD_BUS " is not matching"); - goto try_parent; - } - dbg(FIELD_BUS " matches"); - } - - /* check for matching bus id */ - if (dev->id[0] != '\0') { - if (sysfs_device == NULL) { - dbg("device has no sysfs_device"); - goto try_parent; - } - dbg("check " FIELD_ID); - if (match_id(dev, sysfs_device) != 0) { - dbg(FIELD_ID " is not matching"); - goto try_parent; - } - dbg(FIELD_ID " matches"); - } - - /* check for matching sysfs pairs */ - if (dev->sysfs_pair[0].file[0] != '\0') { - dbg("check " FIELD_SYSFS " pairs"); - if (match_sysfs_pairs(dev, class_dev, sysfs_device) != 0) { - dbg(FIELD_SYSFS " is not matching"); - goto try_parent; - } - dbg(FIELD_SYSFS " matches"); - } - - /* found matching physical device */ - break; -try_parent: - dbg("try parent sysfs device"); - sysfs_device = sysfs_get_device_parent(sysfs_device); - if (sysfs_device == NULL) - goto exit; - dbg("sysfs_device->path='%s'", sysfs_device->path); - dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); - } - - /* execute external program */ - if (dev->program[0] != '\0') { - char program[PATH_SIZE]; - - dbg("check " FIELD_PROGRAM); - strlcpy(program, dev->program, sizeof(program)); - apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - if (execute_program(udev, program, udev->program_result, sizeof(udev->program_result)) != 0) { - dbg(FIELD_PROGRAM " returned nonzero"); - goto try_parent; - } - dbg(FIELD_PROGRAM " returned successful"); - } - - /* check for matching result of external program */ - if (dev->result[0] != '\0') { - dbg("check for " FIELD_RESULT " dev->result='%s', udev->program_result='%s'", - dev->result, udev->program_result); - if (strcmp_pattern(dev->result, udev->program_result) != 0) { - dbg(FIELD_RESULT " is not matching"); - goto try_parent; - } - dbg(FIELD_RESULT " matches"); - } - - /* rule matches */ - return 0; - -exit: - return -1; -} - -int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_dev) -{ - struct sysfs_class_device *class_dev_parent; - struct sysfs_device *sysfs_device = NULL; - struct config_device *dev; - - dbg("class_dev->name='%s'", class_dev->name); - - /* Figure out where the "device"-symlink is at. For char devices this will - * always be in the class_dev->path. On block devices, only the main block - * device will have the device symlink in it's path. All partition devices - * need to look at the symlink in its parent directory. - */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) { - dbg("given class device has a parent, use this instead"); - sysfs_device = sysfs_get_classdev_device(class_dev_parent); - } else { - sysfs_device = sysfs_get_classdev_device(class_dev); - } - - if (sysfs_device) { - dbg("found devices device: path='%s', bus_id='%s', bus='%s'", - sysfs_device->path, sysfs_device->bus_id, sysfs_device->bus); - strlcpy(udev->bus_id, sysfs_device->bus_id, sizeof(udev->bus_id)); - } - - dbg("udev->kernel_name='%s'", udev->kernel_name); - - /* look for a matching rule to apply */ - list_for_each_entry(dev, &config_device_list, node) { - dbg("process rule"); - if (match_rule(udev, dev, class_dev, sysfs_device) == 0) { - - /* apply options */ - if (dev->ignore_device) { - info("configured rule in '%s[%i]' applied, '%s' is ignored", - dev->config_file, dev->config_line, udev->kernel_name); - return -1; - } - if (dev->ignore_remove) { - udev->ignore_remove = 1; - dbg_parse("remove event should be ignored"); - } - /* apply all_partitions option only at a main block device */ - if (dev->partitions && udev->type == DEV_BLOCK && udev->kernel_number[0] == '\0') { - udev->partitions = dev->partitions; - dbg("creation of partition nodes requested"); - } - - /* apply permissions */ - if (dev->mode != 0000) { - udev->mode = dev->mode; - dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name); - } - if (dev->owner[0] != '\0') { - strlcpy(udev->owner, dev->owner, sizeof(udev->owner)); - apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); - dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name); - } - if (dev->group[0] != '\0') { - strlcpy(udev->group, dev->group, sizeof(udev->group)); - apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); - dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); - } - - /* collect symlinks */ - if (dev->symlink[0] != '\0') { - char temp[PATH_SIZE]; - char *pos, *next; - - info("configured rule in '%s[%i]' applied, added symlink '%s'", - dev->config_file, dev->config_line, dev->symlink); - strlcpy(temp, dev->symlink, sizeof(temp)); - apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); - - /* add multiple symlinks separated by spaces */ - pos = temp; - next = strchr(temp, ' '); - while (next) { - next[0] = '\0'; - dbg("add symlink '%s'", pos); - name_list_add(&udev->symlink_list, pos, 0); - pos = &next[1]; - next = strchr(pos, ' '); - } - dbg("add symlink '%s'", pos); - name_list_add(&udev->symlink_list, pos, 0); - } - - /* rule matches */ - if (dev->name[0] != '\0') { - info("configured rule in '%s[%i]' applied, '%s' becomes '%s'", - dev->config_file, dev->config_line, udev->kernel_name, dev->name); - - strlcpy(udev->name, dev->name, sizeof(udev->name)); - apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); - strlcpy(udev->config_file, dev->config_file, sizeof(udev->config_file)); - udev->config_line = dev->config_line; - - if (udev->type != DEV_NET) - dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", - udev->name, udev->owner, udev->group, udev->mode, udev->partitions); - - break; - } - } - } - - if (udev->name[0] == '\0') { - /* no rule matched, so we use the kernel name */ - strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); - dbg("no rule found, use kernel name '%s'", udev->name); - } - - if (udev->tmp_node[0] != '\0') { - dbg("removing temporary device node"); - unlink_secure(udev->tmp_node); - udev->tmp_node[0] = '\0'; - } - - return 0; -} diff --git a/namedev.h b/namedev.h deleted file mode 100644 index d0235996bc..0000000000 --- a/namedev.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * namedev.h - * - * Userspace devfs - * - * Copyright (C) 2003,2004 Greg Kroah-Hartman - * - * 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 02139, USA. - * - */ - -#ifndef NAMEDEV_H -#define NAMEDEV_H - -#include "udev.h" -#include "list.h" - -struct sysfs_class_device; - -#define FIELD_KERNEL "KERNEL" -#define FIELD_SUBSYSTEM "SUBSYSTEM" -#define FIELD_BUS "BUS" -#define FIELD_SYSFS "SYSFS" -#define FIELD_ID "ID" -#define FIELD_PROGRAM "PROGRAM" -#define FIELD_RESULT "RESULT" -#define FIELD_DRIVER "DRIVER" -#define FIELD_NAME "NAME" -#define FIELD_SYMLINK "SYMLINK" -#define FIELD_OWNER "OWNER" -#define FIELD_GROUP "GROUP" -#define FIELD_MODE "MODE" -#define FIELD_OPTIONS "OPTIONS" - -#define OPTION_IGNORE_DEVICE "ignore_device" -#define OPTION_IGNORE_REMOVE "ignore_remove" -#define OPTION_PARTITIONS "all_partitions" - -#define MAX_SYSFS_PAIRS 5 - -#define RULEFILE_SUFFIX ".rules" - -struct sysfs_pair { - char file[PATH_SIZE]; - char value[VALUE_SIZE]; -}; - -struct config_device { - struct list_head node; - - char kernel[NAME_SIZE]; - char subsystem[NAME_SIZE]; - char bus[NAME_SIZE]; - char id[NAME_SIZE]; - struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; - char program[PATH_SIZE]; - char result[PATH_SIZE]; - char driver[NAME_SIZE]; - char name[PATH_SIZE]; - char symlink[PATH_SIZE]; - - char owner[USER_SIZE]; - char group[USER_SIZE]; - mode_t mode; - - int partitions; - int ignore_device; - int ignore_remove; - - char config_file[PATH_SIZE]; - int config_line; -}; - -extern struct list_head config_device_list; - -extern int namedev_init(void); -extern int namedev_name_device(struct udevice *udev, struct sysfs_class_device *class_dev); -extern void namedev_close(void); - -extern void dump_config_dev(struct config_device *dev); -extern void dump_config_dev_list(void); - -#endif diff --git a/namedev_parse.c b/namedev_parse.c deleted file mode 100644 index 3be408932b..0000000000 --- a/namedev_parse.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * namedev_parse.c - * - * Userspace devfs - * - * Copyright (C) 2003,2004 Greg Kroah-Hartman - * Copyright (C) 2003-2005 Kay Sievers - * - * - * 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 02139, USA. - * - */ - -#ifdef DEBUG -/* define this to enable parsing debugging also */ -/* #define DEBUG_PARSER */ -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev_libc_wrapper.h" -#include "udev.h" -#include "udev_utils.h" -#include "logging.h" -#include "namedev.h" - -LIST_HEAD(config_device_list); - -static int add_config_dev(struct config_device *new_dev) -{ - struct config_device *tmp_dev; - - tmp_dev = malloc(sizeof(*tmp_dev)); - if (tmp_dev == NULL) - return -ENOMEM; - memcpy(tmp_dev, new_dev, sizeof(*tmp_dev)); - list_add_tail(&tmp_dev->node, &config_device_list); - //dump_config_dev(tmp_dev); - return 0; -} - -void dump_config_dev(struct config_device *dev) -{ - dbg_parse("name='%s', symlink='%s', bus='%s', id='%s', " - "sysfs_file[0]='%s', sysfs_value[0]='%s', " - "kernel='%s', program='%s', result='%s'" - "owner='%s', group='%s', mode=%#o", - dev->name, dev->symlink, dev->bus, dev->id, - dev->sysfs_pair[0].file, dev->sysfs_pair[0].value, - dev->kernel, dev->program, dev->result, - dev->owner, dev->group, dev->mode); -} - -void dump_config_dev_list(void) -{ - struct config_device *dev; - - list_for_each_entry(dev, &config_device_list, node) - dump_config_dev(dev); -} - -/* extract possible KEY{attr} */ -static char *get_key_attribute(char *str) -{ - char *pos; - char *attr; - - attr = strchr(str, '{'); - if (attr != NULL) { - attr++; - pos = strchr(attr, '}'); - if (pos == NULL) { - dbg("missing closing brace for format"); - return NULL; - } - pos[0] = '\0'; - dbg("attribute='%s'", attr); - return attr; - } - - return NULL; -} - -static int namedev_parse(struct udevice *udev, const char *filename) -{ - char line[LINE_SIZE]; - char *bufline; - int lineno; - char *temp; - char *temp2; - char *temp3; - char *attr; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - int program_given = 0; - int valid; - int retval = 0; - struct config_device dev; - - if (file_map(filename, &buf, &bufsize) == 0) { - dbg("reading '%s' as rules file", filename); - } else { - dbg("can't open '%s' as rules file", filename); - return -1; - } - - /* loop through the whole file */ - cur = 0; - lineno = 0; - while (cur < bufsize) { - unsigned int i, j; - - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; - - if (count >= sizeof(line)) { - info("line too long, rule skipped %s, line %d", filename, lineno); - continue; - } - - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) - continue; - - /* see if this is a comment */ - if (bufline[0] == COMMENT_CHARACTER) - continue; - - /* skip backslash and newline from multi line rules */ - for (i = j = 0; i < count; i++) { - if (bufline[i] == '\\' && bufline[i+1] == '\n') - continue; - - line[j++] = bufline[i]; - } - line[j] = '\0'; - dbg_parse("read '%s'", line); - - /* get all known keys */ - memset(&dev, 0x00, sizeof(struct config_device)); - temp = line; - valid = 0; - - while (1) { - retval = parse_get_pair(&temp, &temp2, &temp3); - if (retval) - break; - - if (strcasecmp(temp2, FIELD_KERNEL) == 0) { - strlcpy(dev.kernel, temp3, sizeof(dev.kernel)); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) { - strlcpy(dev.subsystem, temp3, sizeof(dev.subsystem)); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_BUS) == 0) { - strlcpy(dev.bus, temp3, sizeof(dev.bus)); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_ID) == 0) { - strlcpy(dev.id, temp3, sizeof(dev.id)); - valid = 1; - continue; - } - - if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) { - struct sysfs_pair *pair = &dev.sysfs_pair[0]; - int sysfs_pair_num = 0; - - /* find first unused pair */ - while (pair->file[0] != '\0') { - ++sysfs_pair_num; - if (sysfs_pair_num >= MAX_SYSFS_PAIRS) { - pair = NULL; - break; - } - ++pair; - } - if (pair) { - attr = get_key_attribute(temp2 + sizeof(FIELD_SYSFS)-1); - if (attr == NULL) { - dbg("error parsing " FIELD_SYSFS " attribute"); - continue; - } - strlcpy(pair->file, attr, sizeof(pair->file)); - strlcpy(pair->value, temp3, sizeof(pair->value)); - valid = 1; - } - continue; - } - - if (strcasecmp(temp2, FIELD_DRIVER) == 0) { - strlcpy(dev.driver, temp3, sizeof(dev.driver)); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_PROGRAM) == 0) { - program_given = 1; - strlcpy(dev.program, temp3, sizeof(dev.program)); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_RESULT) == 0) { - strlcpy(dev.result, temp3, sizeof(dev.result)); - valid = 1; - continue; - } - - if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) { - attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1); - /* FIXME: remove old style options and make OPTIONS= mandatory */ - if (attr != NULL) { - if (strstr(attr, OPTION_PARTITIONS) != NULL) { - dbg_parse("creation of partition nodes requested"); - dev.partitions = DEFAULT_PARTITIONS_COUNT; - } - if (strstr(attr, OPTION_IGNORE_REMOVE) != NULL) { - dbg_parse("remove event should be ignored"); - dev.ignore_remove = 1; - } - } - if (temp3[0] != '\0') - strlcpy(dev.name, temp3, sizeof(dev.name)); - else - dev.ignore_device = 1; - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_SYMLINK) == 0) { - strlcpy(dev.symlink, temp3, sizeof(dev.symlink)); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_OWNER) == 0) { - strlcpy(dev.owner, temp3, sizeof(dev.owner)); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_GROUP) == 0) { - strlcpy(dev.group, temp3, sizeof(dev.group)); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_MODE) == 0) { - dev.mode = strtol(temp3, NULL, 8); - valid = 1; - continue; - } - - if (strcasecmp(temp2, FIELD_OPTIONS) == 0) { - if (strstr(temp3, OPTION_IGNORE_DEVICE) != NULL) { - dbg_parse("device should be ignored"); - dev.ignore_device = 1; - } - if (strstr(temp3, OPTION_IGNORE_REMOVE) != NULL) { - dbg_parse("remove event should be ignored"); - dev.ignore_remove = 1; - } - if (strstr(temp3, OPTION_PARTITIONS) != NULL) { - dbg_parse("creation of partition nodes requested"); - dev.partitions = DEFAULT_PARTITIONS_COUNT; - } - valid = 1; - continue; - } - - dbg("unknown type of field '%s'", temp2); - goto error; - } - - /* skip line if not any valid key was found */ - if (!valid) - goto error; - - /* simple plausibility checks for given keys */ - if ((dev.sysfs_pair[0].file[0] == '\0') ^ - (dev.sysfs_pair[0].value[0] == '\0')) { - info("inconsistency in " FIELD_SYSFS " key"); - goto error; - } - - if ((dev.result[0] != '\0') && (program_given == 0)) { - info(FIELD_RESULT " is only useful when " - FIELD_PROGRAM " is called in any rule before"); - goto error; - } - - dev.config_line = lineno; - strlcpy(dev.config_file, filename, sizeof(dev.config_file)); - retval = add_config_dev(&dev); - if (retval) { - dbg("add_config_dev returned with error %d", retval); - continue; -error: - info("parse error %s, line %d:%d, rule skipped", - filename, lineno, (int) (temp - line)); - } - } - - file_unmap(buf, bufsize); - return retval; -} - -int namedev_init(void) -{ - struct stat stats; - int retval; - - if (stat(udev_rules_filename, &stats) != 0) - return -1; - - if ((stats.st_mode & S_IFMT) != S_IFDIR) - retval = namedev_parse(NULL, udev_rules_filename); - else - retval = call_foreach_file(namedev_parse, NULL, udev_rules_filename, RULEFILE_SUFFIX); - - return retval; -} - -void namedev_close(void) -{ - struct config_device *dev; - struct config_device *temp_dev; - - list_for_each_entry_safe(dev, temp_dev, &config_device_list, node) { - list_del(&dev->node); - free(dev); - } -} - diff --git a/udev.c b/udev.c index 8ce813fbf5..069cecf973 100644 --- a/udev.c +++ b/udev.c @@ -37,7 +37,7 @@ #include "udev_utils.h" #include "udev_sysfs.h" #include "udev_version.h" -#include "namedev.h" +#include "udev_rules.h" #include "logging.h" @@ -177,7 +177,7 @@ int main(int argc, char *argv[], char *envp[]) wait_for_class_device(class_dev, &error); /* init rules */ - namedev_init(); + udev_rules_init(); /* name, create node, store in db */ retval = udev_add_device(&udev, class_dev); diff --git a/udev_add.c b/udev_add.c index bf5feb1b2d..8443f65e7c 100644 --- a/udev_add.c +++ b/udev_add.c @@ -42,7 +42,7 @@ #include "udev_sysfs.h" #include "udev_version.h" #include "logging.h" -#include "namedev.h" +#include "udev_rules.h" #include "udev_db.h" #include "udev_selinux.h" @@ -276,7 +276,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) } } - if (namedev_name_device(udev, class_dev) != 0) + if (udev_rules_get_name(udev, class_dev) != 0) return 0; dbg("adding name='%s'", udev->name); diff --git a/udev_config.c b/udev_config.c index 26ecf6291c..77ac38a791 100644 --- a/udev_config.c +++ b/udev_config.c @@ -21,9 +21,6 @@ * */ -/* define this to enable parsing debugging */ -/* #define DEBUG_PARSER */ - #include #include #include @@ -38,7 +35,7 @@ #include "udev_utils.h" #include "udev_version.h" #include "logging.h" -#include "namedev.h" +#include "udev_rules.h" /* global variables */ char sysfs_path[PATH_SIZE]; @@ -134,14 +131,14 @@ static int parse_config_file(void) strlcpy(line, bufline, count); temp = line; - dbg_parse("read '%s'", temp); + dbg("read '%s'", temp); retval = parse_get_pair(&temp, &variable, &value); if (retval != 0) info("%s:%d:%Zd: error parsing '%s'", udev_config_filename, lineno, temp-line, temp); - dbg_parse("variable='%s', value='%s'", variable, value); + dbg("variable='%s', value='%s'", variable, value); if (strcasecmp(variable, "udev_root") == 0) { strlcpy(udev_root, value, sizeof(udev_root)); diff --git a/udev_remove.c b/udev_remove.c index a81d20c98c..0a9996dc6a 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -34,7 +34,6 @@ #include "udev.h" #include "udev_utils.h" #include "udev_version.h" -#include "namedev.h" #include "udev_db.h" #include "logging.h" diff --git a/udev_rules.c b/udev_rules.c new file mode 100644 index 0000000000..cbdf7de317 --- /dev/null +++ b/udev_rules.c @@ -0,0 +1,778 @@ +/* + * udev_rules.c + * + * Userspace devfs + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003-2005 Kay Sievers + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libsysfs/sysfs/libsysfs.h" +#include "list.h" +#include "udev_libc_wrapper.h" +#include "udev.h" +#include "udev_utils.h" +#include "udev_version.h" +#include "logging.h" +#include "udev_rules.h" +#include "udev_db.h" + +static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr); + +/* compare string with pattern (supports * ? [0-9] [!A-Z]) */ +static int strcmp_pattern(const char *p, const char *s) +{ + if (s[0] == '\0') { + while (p[0] == '*') + p++; + return (p[0] != '\0'); + } + switch (p[0]) { + case '[': + { + int not = 0; + p++; + if (p[0] == '!') { + not = 1; + p++; + } + while ((p[0] != '\0') && (p[0] != ']')) { + int match = 0; + if (p[1] == '-') { + if ((s[0] >= p[0]) && (s[0] <= p[2])) + match = 1; + p += 3; + } else { + match = (p[0] == s[0]); + p++; + } + if (match ^ not) { + while ((p[0] != '\0') && (p[0] != ']')) + p++; + if (p[0] == ']') + return strcmp_pattern(p+1, s+1); + } + } + } + break; + case '*': + if (strcmp_pattern(p, s+1)) + return strcmp_pattern(p+1, s); + return 0; + case '\0': + if (s[0] == '\0') { + return 0; + } + break; + default: + if ((p[0] == s[0]) || (p[0] == '?')) + return strcmp_pattern(p+1, s+1); + break; + } + return 1; +} + +/* extract possible {attr} and move str behind it */ +static char *get_format_attribute(char **str) +{ + char *pos; + char *attr = NULL; + + if (*str[0] == '{') { + pos = strchr(*str, '}'); + if (pos == NULL) { + dbg("missing closing brace for format"); + return NULL; + } + pos[0] = '\0'; + attr = *str+1; + *str = pos+1; + dbg("attribute='%s', str='%s'", attr, *str); + } + return attr; +} + +/* extract possible format length and move str behind it*/ +static int get_format_len(char **str) +{ + int num; + char *tail; + + if (isdigit(*str[0])) { + num = (int) strtoul(*str, &tail, 10); + if (num > 0) { + *str = tail; + dbg("format length=%i", num); + return num; + } else { + dbg("format parsing error '%s'", *str); + } + } + return -1; +} + +/** Finds the lowest positive N such that N isn't present in + * $(udevroot) either as a file or a symlink. + * + * @param name Name to check for + * @return 0 if didn't exist and N otherwise. + */ +static int find_free_number(struct udevice *udev, const char *name) +{ + char devpath[PATH_SIZE]; + char filename[PATH_SIZE]; + int num = 0; + + strlcpy(filename, name, sizeof(filename)); + while (1) { + dbg("look for existing node '%s'", filename); + if (udev_db_search_name(devpath, sizeof(devpath), filename) != 0) { + dbg("free num=%d", num); + return num; + } + + num++; + if (num > 1000) { + info("find_free_number gone crazy (num=%d), aborted", num); + return -1; + } + snprintf(filename, sizeof(filename), "%s%d", name, num); + filename[sizeof(filename)-1] = '\0'; + } +} + +static void apply_format(struct udevice *udev, char *string, size_t maxsize, + struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) +{ + char temp[PATH_SIZE]; + char temp2[PATH_SIZE]; + char *tail, *pos, *cpos, *attr, *rest; + int len; + int i; + char c; + struct sysfs_attribute *tmpattr; + unsigned int next_free_number; + struct sysfs_class_device *class_dev_parent; + + pos = string; + while (1) { + pos = strchr(pos, '%'); + if (pos == NULL) + break; + + pos[0] = '\0'; + tail = pos+1; + len = get_format_len(&tail); + c = tail[0]; + strlcpy(temp, tail+1, sizeof(temp)); + tail = temp; + dbg("format=%c, string='%s', tail='%s'",c , string, tail); + attr = get_format_attribute(&tail); + + switch (c) { + case 'p': + strlcat(string, udev->devpath, maxsize); + dbg("substitute kernel name '%s'", udev->kernel_name); + break; + case 'b': + strlcat(string, udev->bus_id, maxsize); + dbg("substitute bus_id '%s'", udev->bus_id); + break; + case 'k': + strlcat(string, udev->kernel_name, maxsize); + dbg("substitute kernel name '%s'", udev->kernel_name); + break; + case 'n': + strlcat(string, udev->kernel_number, maxsize); + dbg("substitute kernel number '%s'", udev->kernel_number); + break; + case 'm': + sprintf(temp2, "%d", minor(udev->devt)); + strlcat(string, temp2, maxsize); + dbg("substitute minor number '%s'", temp2); + break; + case 'M': + sprintf(temp2, "%d", major(udev->devt)); + strlcat(string, temp2, maxsize); + dbg("substitute major number '%s'", temp2); + break; + case 'c': + if (udev->program_result[0] == '\0') + break; + /* get part part of the result string */ + i = 0; + if (attr != NULL) + i = strtoul(attr, &rest, 10); + if (i > 0) { + dbg("request part #%d of result string", i); + cpos = udev->program_result; + while (--i) { + while (cpos[0] != '\0' && !isspace(cpos[0])) + cpos++; + while (isspace(cpos[0])) + cpos++; + } + if (i > 0) { + dbg("requested part of result string not found"); + break; + } + strlcpy(temp2, cpos, sizeof(temp2)); + /* %{2+}c copies the whole string from the second part on */ + if (rest[0] != '+') { + cpos = strchr(temp2, ' '); + if (cpos) + cpos[0] = '\0'; + } + strlcat(string, temp2, maxsize); + dbg("substitute part of result string '%s'", temp2); + } else { + strlcat(string, udev->program_result, maxsize); + dbg("substitute result string '%s'", udev->program_result); + } + break; + case 's': + if (!class_dev) + break; + if (attr == NULL) { + dbg("missing attribute"); + break; + } + tmpattr = find_sysfs_attribute(class_dev, sysfs_device, attr); + if (tmpattr == NULL) { + dbg("sysfa attribute '%s' not found", attr); + break; + } + /* strip trailing whitespace of matching value */ + if (isspace(tmpattr->value[strlen(tmpattr->value)-1])) { + i = len = strlen(tmpattr->value); + while (i > 0 && isspace(tmpattr->value[i-1])) + i--; + if (i < len) { + tmpattr->value[i] = '\0'; + dbg("remove %i trailing whitespace chars from '%s'", + len - i, tmpattr->value); + } + } + strlcat(string, tmpattr->value, maxsize); + dbg("substitute sysfs value '%s'", tmpattr->value); + break; + case '%': + strlcat(string, "%", maxsize); + pos++; + break; + case 'e': + next_free_number = find_free_number(udev, string); + if (next_free_number > 0) { + sprintf(temp2, "%d", next_free_number); + strlcat(string, temp2, maxsize); + } + break; + case 'P': + if (!class_dev) + break; + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent != NULL) { + struct udevice udev_parent; + + dbg("found parent '%s', get the node name", class_dev_parent->path); + udev_init_device(&udev_parent, NULL, NULL); + /* lookup the name in the udev_db with the DEVPATH of the parent */ + if (udev_db_get_device(&udev_parent, &class_dev_parent->path[strlen(sysfs_path)]) == 0) { + strlcat(string, udev_parent.name, maxsize); + dbg("substitute parent node name'%s'", udev_parent.name); + } else + dbg("parent not found in database"); + udev_cleanup_device(&udev_parent); + } + break; + case 'N': + if (udev->tmp_node[0] == '\0') { + dbg("create temporary device node for callout"); + snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", + udev_root, major(udev->devt), minor(udev->devt)); + udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0'; + udev_make_node(udev, udev->tmp_node, udev->devt, 0600, 0, 0); + } + strlcat(string, udev->tmp_node, maxsize); + dbg("substitute temporary device node name '%s'", udev->tmp_node); + break; + case 'r': + strlcat(string, udev_root, maxsize); + dbg("substitute udev_root '%s'", udev_root); + break; + default: + dbg("unknown substitution type '%%%c'", c); + break; + } + /* truncate to specified length */ + if (len > 0) + pos[len] = '\0'; + + strlcat(string, tail, maxsize); + } +} + +static int execute_program(struct udevice *udev, const char *path, char *value, int len) +{ + int retval; + int count; + int status; + int fds[2]; + pid_t pid; + char *pos; + char arg[PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; + int i; + + strlcpy(arg, path, sizeof(arg)); + i = 0; + if (strchr(path, ' ')) { + pos = arg; + while (pos != NULL) { + if (pos[0] == '\'') { + /* don't separate if in apostrophes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos && pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg("arg[%i] '%s'", i, argv[i]); + i++; + } + argv[i] = NULL; + dbg("execute '%s' with parsed arguments", arg); + } else { + argv[0] = arg; + argv[1] = udev->subsystem; + argv[2] = NULL; + dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); + } + + retval = pipe(fds); + if (retval != 0) { + dbg("pipe failed"); + return -1; + } + + pid = fork(); + switch(pid) { + case 0: + /* child */ + /* dup2 write side of pipe to STDOUT */ + dup2(fds[1], STDOUT_FILENO); + retval = execv(arg, argv); + + info(FIELD_PROGRAM " execution of '%s' failed", path); + exit(1); + case -1: + dbg("fork failed"); + return -1; + default: + /* parent reads from fds[0] */ + close(fds[1]); + retval = 0; + i = 0; + while (1) { + count = read(fds[0], value + i, len - i-1); + if (count <= 0) + break; + + i += count; + if (i >= len-1) { + dbg("result len %d too short", len); + retval = -1; + break; + } + } + + if (count < 0) { + dbg("read failed with '%s'", strerror(errno)); + retval = -1; + } + + if (i > 0 && value[i-1] == '\n') + i--; + value[i] = '\0'; + dbg("result is '%s'", value); + + close(fds[0]); + waitpid(pid, &status, 0); + + if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { + dbg("exec program status 0x%x", status); + retval = -1; + } + } + return retval; +} + +static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr) +{ + struct sysfs_attribute *tmpattr = NULL; + char *c; + + dbg("look for device attribute '%s'", attr); + /* try to find the attribute in the class device directory */ + tmpattr = sysfs_get_classdev_attr(class_dev, attr); + if (tmpattr) + goto attr_found; + + /* look in the class device directory if present */ + if (sysfs_device) { + tmpattr = sysfs_get_device_attr(sysfs_device, attr); + if (tmpattr) + goto attr_found; + } + + return NULL; + +attr_found: + c = strchr(tmpattr->value, '\n'); + if (c != NULL) + c[0] = '\0'; + + dbg("found attribute '%s'", tmpattr->path); + return tmpattr; +} + +static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair) +{ + struct sysfs_attribute *tmpattr; + int i; + int len; + + if ((pair == NULL) || (pair->file[0] == '\0') || (pair->value == '\0')) + return -ENODEV; + + tmpattr = find_sysfs_attribute(class_dev, sysfs_device, pair->file); + if (tmpattr == NULL) + return -ENODEV; + + /* strip trailing whitespace of value, if not asked to match for it */ + if (! isspace(pair->value[strlen(pair->value)-1])) { + i = len = strlen(tmpattr->value); + while (i > 0 && isspace(tmpattr->value[i-1])) + i--; + if (i < len) { + tmpattr->value[i] = '\0'; + dbg("remove %i trailing whitespace chars from '%s'", + len - i, tmpattr->value); + } + } + + dbg("compare attribute '%s' value '%s' with '%s'", + pair->file, tmpattr->value, pair->value); + if (strcmp_pattern(pair->value, tmpattr->value) != 0) + return -ENODEV; + + dbg("found matching attribute '%s' with value '%s'", + pair->file, pair->value); + return 0; +} + +static int match_sysfs_pairs(struct udev_rule *rule, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) +{ + struct sysfs_pair *pair; + int i; + + for (i = 0; i < MAX_SYSFS_PAIRS; ++i) { + pair = &rule->sysfs_pair[i]; + if ((pair->file[0] == '\0') || (pair->value[0] == '\0')) + break; + if (compare_sysfs_attribute(class_dev, sysfs_device, pair) != 0) { + dbg("sysfs attribute doesn't match"); + return -ENODEV; + } + } + + return 0; +} + +static int match_id(struct udev_rule *rule, struct sysfs_device *sysfs_device) +{ + char path[PATH_SIZE]; + char *temp; + + strlcpy(path, sysfs_device->path, sizeof(path)); + temp = strrchr(path, '/'); + temp++; + dbg("search '%s' in '%s', path='%s'", rule->id, temp, path); + if (strcmp_pattern(rule->id, temp) != 0) + return -ENODEV; + + return 0; +} + +static int match_rule(struct udevice *udev, struct udev_rule *rule, + struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) +{ + if (rule->kernel[0] != '\0') { + dbg("check for " FIELD_KERNEL " rule->kernel='%s' class_dev->name='%s'", + rule->kernel, class_dev->name); + if (strcmp_pattern(rule->kernel, class_dev->name) != 0) { + dbg(FIELD_KERNEL " is not matching"); + goto exit; + } + dbg(FIELD_KERNEL " matches"); + } + + if (rule->subsystem[0] != '\0') { + dbg("check for " FIELD_SUBSYSTEM " rule->subsystem='%s' class_dev->name='%s'", + rule->subsystem, class_dev->name); + if (strcmp_pattern(rule->subsystem, udev->subsystem) != 0) { + dbg(FIELD_SUBSYSTEM " is not matching"); + goto exit; + } + dbg(FIELD_SUBSYSTEM " matches"); + } + + /* walk up the chain of physical devices and find a match */ + while (1) { + /* check for matching driver */ + if (rule->driver[0] != '\0') { + if (sysfs_device == NULL) { + dbg("device has no sysfs_device"); + goto try_parent; + } + dbg("check for " FIELD_DRIVER " rule->driver='%s' sysfs_device->driver_name='%s'", + rule->driver, sysfs_device->driver_name); + if (strcmp_pattern(rule->driver, sysfs_device->driver_name) != 0) { + dbg(FIELD_DRIVER " is not matching"); + goto try_parent; + } + dbg(FIELD_DRIVER " matches"); + } + + /* check for matching bus value */ + if (rule->bus[0] != '\0') { + if (sysfs_device == NULL) { + dbg("device has no sysfs_device"); + goto try_parent; + } + dbg("check for " FIELD_BUS " rule->bus='%s' sysfs_device->bus='%s'", + rule->bus, sysfs_device->bus); + if (strcmp_pattern(rule->bus, sysfs_device->bus) != 0) { + dbg(FIELD_BUS " is not matching"); + goto try_parent; + } + dbg(FIELD_BUS " matches"); + } + + /* check for matching bus id */ + if (rule->id[0] != '\0') { + if (sysfs_device == NULL) { + dbg("device has no sysfs_device"); + goto try_parent; + } + dbg("check " FIELD_ID); + if (match_id(rule, sysfs_device) != 0) { + dbg(FIELD_ID " is not matching"); + goto try_parent; + } + dbg(FIELD_ID " matches"); + } + + /* check for matching sysfs pairs */ + if (rule->sysfs_pair[0].file[0] != '\0') { + dbg("check " FIELD_SYSFS " pairs"); + if (match_sysfs_pairs(rule, class_dev, sysfs_device) != 0) { + dbg(FIELD_SYSFS " is not matching"); + goto try_parent; + } + dbg(FIELD_SYSFS " matches"); + } + + /* found matching physical device */ + break; +try_parent: + dbg("try parent sysfs device"); + sysfs_device = sysfs_get_device_parent(sysfs_device); + if (sysfs_device == NULL) + goto exit; + dbg("sysfs_device->path='%s'", sysfs_device->path); + dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); + } + + /* execute external program */ + if (rule->program[0] != '\0') { + char program[PATH_SIZE]; + + dbg("check " FIELD_PROGRAM); + strlcpy(program, rule->program, sizeof(program)); + apply_format(udev, program, sizeof(program), class_dev, sysfs_device); + if (execute_program(udev, program, udev->program_result, sizeof(udev->program_result)) != 0) { + dbg(FIELD_PROGRAM " returned nonzero"); + goto try_parent; + } + dbg(FIELD_PROGRAM " returned successful"); + } + + /* check for matching result of external program */ + if (rule->result[0] != '\0') { + dbg("check for " FIELD_RESULT "rule->result='%s', udev->program_result='%s'", + rule->result, udev->program_result); + if (strcmp_pattern(rule->result, udev->program_result) != 0) { + dbg(FIELD_RESULT " is not matching"); + goto try_parent; + } + dbg(FIELD_RESULT " matches"); + } + + /* rule matches */ + return 0; + +exit: + return -1; +} + +int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_dev) +{ + struct sysfs_class_device *class_dev_parent; + struct sysfs_device *sysfs_device = NULL; + struct udev_rule *rule; + + dbg("class_dev->name='%s'", class_dev->name); + + /* Figure out where the "device"-symlink is at. For char devices this will + * always be in the class_dev->path. On block devices, only the main block + * device will have the device symlink in it's path. All partition devices + * need to look at the symlink in its parent directory. + */ + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent != NULL) { + dbg("given class device has a parent, use this instead"); + sysfs_device = sysfs_get_classdev_device(class_dev_parent); + } else { + sysfs_device = sysfs_get_classdev_device(class_dev); + } + + if (sysfs_device) { + dbg("found devices device: path='%s', bus_id='%s', bus='%s'", + sysfs_device->path, sysfs_device->bus_id, sysfs_device->bus); + strlcpy(udev->bus_id, sysfs_device->bus_id, sizeof(udev->bus_id)); + } + + dbg("udev->kernel_name='%s'", udev->kernel_name); + + /* look for a matching rule to apply */ + list_for_each_entry(rule, &udev_rule_list, node) { + dbg("process rule"); + if (match_rule(udev, rule, class_dev, sysfs_device) == 0) { + + /* apply options */ + if (rule->ignore_device) { + info("configured rule in '%s[%i]' applied, '%s' is ignored", + rule->config_file, rule->config_line, udev->kernel_name); + return -1; + } + if (rule->ignore_remove) { + udev->ignore_remove = 1; + dbg("remove event should be ignored"); + } + /* apply all_partitions option only at a main block device */ + if (rule->partitions && udev->type == DEV_BLOCK && udev->kernel_number[0] == '\0') { + udev->partitions = rule->partitions; + dbg("creation of partition nodes requested"); + } + + /* apply permissions */ + if (rule->mode != 0000) { + udev->mode = rule->mode; + dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name); + } + if (rule->owner[0] != '\0') { + strlcpy(udev->owner, rule->owner, sizeof(udev->owner)); + apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); + dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name); + } + if (rule->group[0] != '\0') { + strlcpy(udev->group, rule->group, sizeof(udev->group)); + apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); + dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); + } + + /* collect symlinks */ + if (rule->symlink[0] != '\0') { + char temp[PATH_SIZE]; + char *pos, *next; + + info("configured rule in '%s[%i]' applied, added symlink '%s'", + rule->config_file, rule->config_line, rule->symlink); + strlcpy(temp, rule->symlink, sizeof(temp)); + apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); + + /* add multiple symlinks separated by spaces */ + pos = temp; + next = strchr(temp, ' '); + while (next) { + next[0] = '\0'; + dbg("add symlink '%s'", pos); + name_list_add(&udev->symlink_list, pos, 0); + pos = &next[1]; + next = strchr(pos, ' '); + } + dbg("add symlink '%s'", pos); + name_list_add(&udev->symlink_list, pos, 0); + } + + /* rule matches */ + if (rule->name[0] != '\0') { + info("configured rule in '%s[%i]' applied, '%s' becomes '%s'", + rule->config_file, rule->config_line, udev->kernel_name, rule->name); + + strlcpy(udev->name, rule->name, sizeof(udev->name)); + apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); + strlcpy(udev->config_file, rule->config_file, sizeof(udev->config_file)); + udev->config_line = rule->config_line; + + if (udev->type != DEV_NET) + dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", + udev->name, udev->owner, udev->group, udev->mode, udev->partitions); + + break; + } + } + } + + if (udev->name[0] == '\0') { + /* no rule matched, so we use the kernel name */ + strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); + dbg("no rule found, use kernel name '%s'", udev->name); + } + + if (udev->tmp_node[0] != '\0') { + dbg("removing temporary device node"); + unlink_secure(udev->tmp_node); + udev->tmp_node[0] = '\0'; + } + + return 0; +} diff --git a/udev_rules.h b/udev_rules.h new file mode 100644 index 0000000000..71c510bce5 --- /dev/null +++ b/udev_rules.h @@ -0,0 +1,94 @@ +/* + * udev_rules.h + * + * Userspace devfs + * + * Copyright (C) 2003,2004 Greg Kroah-Hartman + * + * 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 02139, USA. + * + */ + +#ifndef NAMEDEV_H +#define NAMEDEV_H + +#include "libsysfs/sysfs/libsysfs.h" +#include "udev.h" +#include "list.h" + + +#define FIELD_KERNEL "KERNEL" +#define FIELD_SUBSYSTEM "SUBSYSTEM" +#define FIELD_BUS "BUS" +#define FIELD_SYSFS "SYSFS" +#define FIELD_ID "ID" +#define FIELD_PROGRAM "PROGRAM" +#define FIELD_RESULT "RESULT" +#define FIELD_DRIVER "DRIVER" +#define FIELD_NAME "NAME" +#define FIELD_SYMLINK "SYMLINK" +#define FIELD_OWNER "OWNER" +#define FIELD_GROUP "GROUP" +#define FIELD_MODE "MODE" +#define FIELD_OPTIONS "OPTIONS" + +#define OPTION_IGNORE_DEVICE "ignore_device" +#define OPTION_IGNORE_REMOVE "ignore_remove" +#define OPTION_PARTITIONS "all_partitions" + +#define MAX_SYSFS_PAIRS 5 + +#define RULEFILE_SUFFIX ".rules" + +struct sysfs_pair { + char file[PATH_SIZE]; + char value[VALUE_SIZE]; +}; + +struct udev_rule { + struct list_head node; + + char kernel[NAME_SIZE]; + char subsystem[NAME_SIZE]; + char bus[NAME_SIZE]; + char id[NAME_SIZE]; + struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; + char program[PATH_SIZE]; + char result[PATH_SIZE]; + char driver[NAME_SIZE]; + char name[PATH_SIZE]; + char symlink[PATH_SIZE]; + + char owner[USER_SIZE]; + char group[USER_SIZE]; + mode_t mode; + + int partitions; + int ignore_device; + int ignore_remove; + + char config_file[PATH_SIZE]; + int config_line; +}; + +extern struct list_head udev_rule_list; + +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); + +extern void udev_rule_dump(struct udev_rule *rule); +extern void udev_rule_list_dump(void); + +#endif diff --git a/udev_rules_parse.c b/udev_rules_parse.c new file mode 100644 index 0000000000..4f431decf5 --- /dev/null +++ b/udev_rules_parse.c @@ -0,0 +1,365 @@ +/* + * udev_rules_parse.c + * + * Userspace devfs + * + * Copyright (C) 2003,2004 Greg Kroah-Hartman + * Copyright (C) 2003-2005 Kay Sievers + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev_libc_wrapper.h" +#include "udev.h" +#include "udev_utils.h" +#include "logging.h" +#include "udev_rules.h" + +LIST_HEAD(udev_rule_list); + +static int add_config_dev(struct udev_rule *new_rule) +{ + struct udev_rule *tmp_rule; + + tmp_rule = malloc(sizeof(*tmp_rule)); + if (tmp_rule == NULL) + return -ENOMEM; + memcpy(tmp_rule, new_rule, sizeof(*tmp_rule)); + list_add_tail(&tmp_rule->node, &udev_rule_list); + udev_rule_dump(tmp_rule); + + return 0; +} + +void udev_rule_dump(struct udev_rule *rule) +{ + dbg("name='%s', symlink='%s', bus='%s', id='%s', " + "sysfs_file[0]='%s', sysfs_value[0]='%s', " + "kernel='%s', program='%s', result='%s'" + "owner='%s', group='%s', mode=%#o", + rule->name, rule->symlink, rule->bus, rule->id, + rule->sysfs_pair[0].file, rule->sysfs_pair[0].value, + rule->kernel, rule->program, rule->result, + rule->owner, rule->group, rule->mode); +} + +void udev_rule_list_dump(void) +{ + struct udev_rule *rule; + + list_for_each_entry(rule, &udev_rule_list, node) + udev_rule_dump(rule); +} + +/* extract possible KEY{attr} */ +static char *get_key_attribute(char *str) +{ + char *pos; + char *attr; + + attr = strchr(str, '{'); + if (attr != NULL) { + attr++; + pos = strchr(attr, '}'); + if (pos == NULL) { + dbg("missing closing brace for format"); + return NULL; + } + pos[0] = '\0'; + dbg("attribute='%s'", attr); + return attr; + } + + return NULL; +} + +static int rules_parse(struct udevice *udev, const char *filename) +{ + char line[LINE_SIZE]; + char *bufline; + int lineno; + char *temp; + char *temp2; + char *temp3; + char *attr; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + int program_given = 0; + int valid; + int retval = 0; + struct udev_rule rule; + + if (file_map(filename, &buf, &bufsize) == 0) { + dbg("reading '%s' as rules file", filename); + } else { + dbg("can't open '%s' as rules file", filename); + return -1; + } + + /* loop through the whole file */ + cur = 0; + lineno = 0; + while (cur < bufsize) { + unsigned int i, j; + + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + lineno++; + + if (count >= sizeof(line)) { + info("line too long, rule skipped %s, line %d", filename, lineno); + continue; + } + + /* eat the whitespace */ + while ((count > 0) && isspace(bufline[0])) { + bufline++; + count--; + } + if (count == 0) + continue; + + /* see if this is a comment */ + if (bufline[0] == COMMENT_CHARACTER) + continue; + + /* skip backslash and newline from multi line rules */ + for (i = j = 0; i < count; i++) { + if (bufline[i] == '\\' && bufline[i+1] == '\n') + continue; + + line[j++] = bufline[i]; + } + line[j] = '\0'; + dbg("read '%s'", line); + + /* get all known keys */ + memset(&rule, 0x00, sizeof(struct udev_rule)); + temp = line; + valid = 0; + + while (1) { + retval = parse_get_pair(&temp, &temp2, &temp3); + if (retval) + break; + + if (strcasecmp(temp2, FIELD_KERNEL) == 0) { + strlcpy(rule.kernel, temp3, sizeof(rule.kernel)); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) { + strlcpy(rule.subsystem, temp3, sizeof(rule.subsystem)); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_BUS) == 0) { + strlcpy(rule.bus, temp3, sizeof(rule.bus)); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_ID) == 0) { + strlcpy(rule.id, temp3, sizeof(rule.id)); + valid = 1; + continue; + } + + if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) { + struct sysfs_pair *pair = &rule.sysfs_pair[0]; + int sysfs_pair_num = 0; + + /* find first unused pair */ + while (pair->file[0] != '\0') { + ++sysfs_pair_num; + if (sysfs_pair_num >= MAX_SYSFS_PAIRS) { + pair = NULL; + break; + } + ++pair; + } + if (pair) { + attr = get_key_attribute(temp2 + sizeof(FIELD_SYSFS)-1); + if (attr == NULL) { + dbg("error parsing " FIELD_SYSFS " attribute"); + continue; + } + strlcpy(pair->file, attr, sizeof(pair->file)); + strlcpy(pair->value, temp3, sizeof(pair->value)); + valid = 1; + } + continue; + } + + if (strcasecmp(temp2, FIELD_DRIVER) == 0) { + strlcpy(rule.driver, temp3, sizeof(rule.driver)); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_PROGRAM) == 0) { + program_given = 1; + strlcpy(rule.program, temp3, sizeof(rule.program)); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_RESULT) == 0) { + strlcpy(rule.result, temp3, sizeof(rule.result)); + valid = 1; + continue; + } + + if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) { + attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1); + /* FIXME: remove old style options and make OPTIONS= mandatory */ + if (attr != NULL) { + if (strstr(attr, OPTION_PARTITIONS) != NULL) { + dbg("creation of partition nodes requested"); + rule.partitions = DEFAULT_PARTITIONS_COUNT; + } + if (strstr(attr, OPTION_IGNORE_REMOVE) != NULL) { + dbg("remove event should be ignored"); + rule.ignore_remove = 1; + } + } + if (temp3[0] != '\0') + strlcpy(rule.name, temp3, sizeof(rule.name)); + else + rule.ignore_device = 1; + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_SYMLINK) == 0) { + strlcpy(rule.symlink, temp3, sizeof(rule.symlink)); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_OWNER) == 0) { + strlcpy(rule.owner, temp3, sizeof(rule.owner)); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_GROUP) == 0) { + strlcpy(rule.group, temp3, sizeof(rule.group)); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_MODE) == 0) { + rule.mode = strtol(temp3, NULL, 8); + valid = 1; + continue; + } + + if (strcasecmp(temp2, FIELD_OPTIONS) == 0) { + if (strstr(temp3, OPTION_IGNORE_DEVICE) != NULL) { + dbg("device should be ignored"); + rule.ignore_device = 1; + } + if (strstr(temp3, OPTION_IGNORE_REMOVE) != NULL) { + dbg("remove event should be ignored"); + rule.ignore_remove = 1; + } + if (strstr(temp3, OPTION_PARTITIONS) != NULL) { + dbg("creation of partition nodes requested"); + rule.partitions = DEFAULT_PARTITIONS_COUNT; + } + valid = 1; + continue; + } + + dbg("unknown type of field '%s'", temp2); + goto error; + } + + /* skip line if not any valid key was found */ + if (!valid) + goto error; + + /* simple plausibility checks for given keys */ + if ((rule.sysfs_pair[0].file[0] == '\0') ^ + (rule.sysfs_pair[0].value[0] == '\0')) { + info("inconsistency in " FIELD_SYSFS " key"); + goto error; + } + + if ((rule.result[0] != '\0') && (program_given == 0)) { + info(FIELD_RESULT " is only useful when " + FIELD_PROGRAM " is called in any rule before"); + goto error; + } + + rule.config_line = lineno; + strlcpy(rule.config_file, filename, sizeof(rule.config_file)); + retval = add_config_dev(&rule); + if (retval) { + dbg("add_config_dev returned with error %d", retval); + continue; +error: + info("parse error %s, line %d:%d, rule skipped", + filename, lineno, (int) (temp - line)); + } + } + + file_unmap(buf, bufsize); + return retval; +} + +int udev_rules_init(void) +{ + struct stat stats; + int retval; + + if (stat(udev_rules_filename, &stats) != 0) + return -1; + + if ((stats.st_mode & S_IFMT) != S_IFDIR) + retval = rules_parse(NULL, udev_rules_filename); + else + retval = call_foreach_file(rules_parse, NULL, udev_rules_filename, RULEFILE_SUFFIX); + + return retval; +} + +void udev_rules_close(void) +{ + struct udev_rule *rule; + struct udev_rule *temp_rule; + + list_for_each_entry_safe(rule, temp_rule, &udev_rule_list, node) { + list_del(&rule->node); + free(rule); + } +} + diff --git a/udevstart.c b/udevstart.c index 7564c3de03..7765661fe4 100644 --- a/udevstart.c +++ b/udevstart.c @@ -39,7 +39,7 @@ #include "udev_libc_wrapper.h" #include "udev.h" #include "logging.h" -#include "namedev.h" +#include "udev_rules.h" #include "udev_utils.h" #include "list.h" @@ -317,7 +317,7 @@ int main(int argc, char *argv[], char *envp[]) setenv("ACTION", "add", 1); setenv("UDEV_START", "1", 1); - namedev_init(); + udev_rules_init(); udev_scan_block(); udev_scan_class(); diff --git a/udevtest.c b/udevtest.c index 1e0037978b..006d55510e 100644 --- a/udevtest.c +++ b/udevtest.c @@ -32,7 +32,7 @@ #include "udev_sysfs.h" #include "udev_utils.h" #include "udev_version.h" -#include "namedev.h" +#include "udev_rules.h" #include "logging.h" @@ -83,7 +83,7 @@ int main(int argc, char *argv[], char *envp[]) info("looking at '%s'", devpath); /* initialize the naming deamon */ - namedev_init(); + udev_rules_init(); if (argc == 3) subsystem = argv[2]; -- cgit v1.2.3-54-g00ecf From 3b6ed8bb06d18a2855d530dcb9034e9d37114827 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 12 Mar 2005 22:55:08 +0100 Subject: [PATCH] add OPTION="last_rule" to skip any later rule --- test/udev-test.pl | 11 ++++++++++- udev_rules.c | 6 ++++++ udev_rules.h | 4 +++- udev_rules_parse.c | 4 ++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index c7e1a9d47e..52c5c8d481 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1115,9 +1115,18 @@ EOF subsys => "block", devpath => "/block/sda/sda1", exp_name => "start-udev-root-end", - option => "clean", conf => < "last_rule option", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "last", + conf => <last_rule) { + dbg("last rule to be applied"); + break; + } + } } diff --git a/udev_rules.h b/udev_rules.h index 71c510bce5..42552cfa41 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -43,6 +43,7 @@ #define FIELD_MODE "MODE" #define FIELD_OPTIONS "OPTIONS" +#define OPTION_LAST_RULE "last_rule" #define OPTION_IGNORE_DEVICE "ignore_device" #define OPTION_IGNORE_REMOVE "ignore_remove" #define OPTION_PARTITIONS "all_partitions" @@ -74,9 +75,10 @@ struct udev_rule { char group[USER_SIZE]; mode_t mode; - int partitions; + int last_rule; int ignore_device; int ignore_remove; + int partitions; char config_file[PATH_SIZE]; int config_line; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 4f431decf5..f77f3db915 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -283,6 +283,10 @@ static int rules_parse(struct udevice *udev, const char *filename) } if (strcasecmp(temp2, FIELD_OPTIONS) == 0) { + if (strstr(temp3, OPTION_LAST_RULE) != NULL) { + dbg("last rule to be applied"); + rule.last_rule = 1; + } if (strstr(temp3, OPTION_IGNORE_DEVICE) != NULL) { dbg("device should be ignored"); rule.ignore_device = 1; -- cgit v1.2.3-54-g00ecf From 28ce66de1750320d7f09547d8910d42ae580fe5e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 13 Mar 2005 05:46:31 +0100 Subject: [PATCH] support =, ==, !=, += for the key match and assignment --- RELEASE-NOTES | 10 ++ test/udev-test.pl | 354 +++++++++++++++++++++++++++++------------------------ udev.8.in | 42 ++++--- udev_config.c | 80 +++++++++--- udev_rules.c | 108 +++++++++++----- udev_rules.h | 50 +++++--- udev_rules_parse.c | 191 +++++++++++++++++++++-------- udev_utils.c | 35 ------ 8 files changed, 537 insertions(+), 333 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 870020c430..ee77d845be 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -8,3 +8,13 @@ a built-in userdb parser to resolve user and group names. THE PLACE= key is gone. It can be replaced by an ID= for a long time, cause we walk up the chain of physical devices to find a match. +The KEY="" format supports '=', '==', '!=,' , '+=' now. This makes it +easier to skip certain devices without composing rules with weird character +class negations like: + KERNEL="[!s][!c][!d]*" + +this can be replaced by: + KERNEL!="scd*" + +The simple '=' is still supported, but the rules should be converted if +possible, to be better human-readable. diff --git a/test/udev-test.pl b/test/udev-test.pl index 52c5c8d481..8d66536b94 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -39,8 +39,8 @@ my @tests = ( devpath => "/block/sda", exp_name => "boot_disk" , conf => < "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "/block/sda/sda1", exp_name => "boot_disk1" , conf => < "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "/class/tty/ttyUSB0", exp_name => "visor/0" , conf => < "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "visor" , conf => < "visor" , conf => < "visor" , conf => < "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "/class/tty/ttyUSB0", exp_name => "aaa", conf => < "/class/tty/ttyUSB0", exp_name => "sub/direct/ory/visor" , conf => < "/block/sda/sda3", exp_name => "first_disk3" , conf => < "/block/sda/sda3", exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "/block/sda/sda3", exp_name => "M8-m3-n3-b0:0-sIBM" , conf => < "/block/sda", exp_name => "good" , conf => < "/block/sda", exp_name => "disk-IBM-ESXS-sda" , conf => < "/block/sda/sda3", exp_name => "special-device-3" , conf => < "/block/sda/sda3", exp_name => "subsys_block" , conf => < "/block/sda/sda3", exp_name => "newline_removed" , conf => < "/block/sda/sda3", exp_name => "test-0:0:0:0" , conf => < "/block/sda/sda3", exp_name => "escape-3" , conf => < "/block/sda/sda3", exp_name => "foo9" , conf => < "/block/sda/sda3", exp_name => "bar9" , conf => < "/block/sda/sda3", exp_name => "foo7" , conf => < "/block/sda/sda3", exp_name => "my-foo9" , conf => < "/block/sda/sda3", exp_name => "my-foo8" , conf => < "/class/tty/console", exp_name => "TTY" , conf => < "/class/tty/console", exp_name => "foo" , conf => < "/class/tty/console", exp_name => "TTY" , conf => < "/class/tty/console", exp_name => "foo" , conf => < "/block/sda", exp_name => "scsi-0:0:0:0" , conf => < "/block/sda", exp_name => "boot_disk15" , conf => < "/class/tty/ttyUSB0", exp_name => "visor" , conf => < "/block/rd!c0d0", exp_name => "rd/c0d0" , conf => < "/block/rd!c0d0", exp_name => "rd/c0d0" , conf => < "/block/cciss!c0d0/cciss!c0d0p1", exp_name => "cciss/c0d0p1" , conf => < "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "/block/sda", exp_name => "scsi-0:0:0:0", conf => < "/block/sda", exp_name => "ignored", conf => < "/block/sda", exp_name => "matched-with-space", conf => < "tty33", exp_perms => "0:0:0660", conf => < "node", exp_perms => "5000::0660", conf => < "node", exp_perms => ":100:0660", conf => < "node", exp_perms => "::0777", conf => < "node", exp_perms => "5000:100:0777", conf => < "ttyUSB0", exp_perms => "5000::", conf => < "ttyUSB0", exp_perms => ":100:0660", conf => < "ttyUSB0", exp_perms => "::0060", conf => < "ttyUSB0", exp_perms => "5000:100:0777", conf => < "ttyUSB0", exp_perms => "5000:100:0777", conf => < "ttyUSB0", exp_perms => "3000:4000:0777", conf => < "ttyUSB0", exp_perms => "3000:8000:0777", conf => < "node", exp_majorminor => "8:0", conf => < "node", exp_majorminor => "89:300", conf => < "node", exp_majorminor => "4095:1", conf => < "node", exp_majorminor => "4094:89999", conf => < "symlink2-ttyUSB0", exp_target => "ttyUSB0", conf => < "visor0", exp_target => "ttyUSB0", conf => < "1/2/symlink" , exp_target => "a/b/node", conf => < "1/2/c/d/symlink" , exp_target => "../../a/b/node", conf => < "second-0" , exp_target => "visor" , conf => < "symlink-only2", exp_target => "link", conf => < "yes", exp_rem_error => "yes", conf => < "yes", option => "clear", conf => < "symlink0", exp_target => "ttyUSB0", conf => < "symlink-ttyUSB0", exp_target => "ttyUSB0", conf => < "major-188:0", exp_target => "ttyUSB0", conf => < "symlink-0:0:0:0", exp_target => "node", conf => < "test", exp_target => "ttyUSB0", conf => < "test", exp_target => "ttyUSB0", conf => < "this", exp_target => "ttyUSB0", conf => < "test", exp_target => "link", conf => < "188:0", exp_target => "ttyUSB0", conf => < "188", exp_target => "ttyUSB0", conf => < "percent%sign", exp_target => "ttyUSB0", conf => < "%ttyUSB0_name", exp_target => "ttyUSB0", conf => < "link1", exp_target => "node", conf => < "link4", exp_target => "node", conf => < "/block/sda", exp_name => "cdrom", conf => < "cdrom", option => "keep", conf => < "enum", option => "keep", conf => < "cdrom1", option => "keep", conf => < "enum1", option => "keep", conf => < "cdrom2", option => "clear", conf => < "/block/sda", exp_name => "cdrom", conf => < "node", exp_add_error => "yes", conf => < "/block/sda", exp_name => "node6", conf => < "node6", exp_add_error => "yes", conf => < "node", exp_rem_error => "yes", conf => < "yes", option => "clear", conf => < "/block/sda", exp_name => "node", conf => < "/block/sda", exp_name => "node", conf => < "/block/sda", exp_name => "node", conf => < "/block/sda", exp_name => "sda", conf => < "main_device", option => "keep", conf => < "main_device-part-1", option => "clean", conf => < "/block/sda/sda1", exp_name => "start-udev-root-end", conf => < "/block/sda/sda1", exp_name => "last", conf => < "negation KERNEL!=", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "match", + conf => < "negation SUBSYSTEM!=", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "not-anything", + conf => < "negation PROGRAM!= exit code", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "nonzero-program", + conf => <file[0] == '\0') || (pair->value[0] == '\0')) break; if (compare_sysfs_attribute(class_dev, sysfs_device, pair) != 0) { - dbg("sysfs attribute doesn't match"); - return -ENODEV; + dbg("sysfs pair #%u does not match", i); + if (pair->operation != KEY_OP_NOMATCH) + return -1; + } else { + dbg("sysfs pair #%u matches", i); + if (pair->operation == KEY_OP_NOMATCH) + return -1; } } @@ -535,23 +540,33 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { if (rule->kernel[0] != '\0') { - dbg("check for " FIELD_KERNEL " rule->kernel='%s' class_dev->name='%s'", + dbg("check for " KEY_KERNEL " rule->kernel='%s' class_dev->name='%s'", rule->kernel, class_dev->name); if (strcmp_pattern(rule->kernel, class_dev->name) != 0) { - dbg(FIELD_KERNEL " is not matching"); - goto exit; + dbg(KEY_KERNEL " is not matching"); + if (rule->kernel_operation != KEY_OP_NOMATCH) + goto exit; + } else { + dbg(KEY_KERNEL " matches"); + if (rule->kernel_operation == KEY_OP_NOMATCH) + goto exit; } - dbg(FIELD_KERNEL " matches"); + dbg(KEY_KERNEL " key is true"); } if (rule->subsystem[0] != '\0') { - dbg("check for " FIELD_SUBSYSTEM " rule->subsystem='%s' class_dev->name='%s'", + dbg("check for " KEY_SUBSYSTEM " rule->subsystem='%s' class_dev->name='%s'", rule->subsystem, class_dev->name); if (strcmp_pattern(rule->subsystem, udev->subsystem) != 0) { - dbg(FIELD_SUBSYSTEM " is not matching"); - goto exit; + dbg(KEY_SUBSYSTEM " is not matching"); + if (rule->subsystem_operation != KEY_OP_NOMATCH) + goto exit; + } else { + dbg(KEY_SUBSYSTEM " matches"); + if (rule->subsystem_operation == KEY_OP_NOMATCH) + goto exit; } - dbg(FIELD_SUBSYSTEM " matches"); + dbg(KEY_SUBSYSTEM " key is true"); } /* walk up the chain of physical devices and find a match */ @@ -562,13 +577,18 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("device has no sysfs_device"); goto try_parent; } - dbg("check for " FIELD_DRIVER " rule->driver='%s' sysfs_device->driver_name='%s'", + dbg("check for " KEY_DRIVER " rule->driver='%s' sysfs_device->driver_name='%s'", rule->driver, sysfs_device->driver_name); if (strcmp_pattern(rule->driver, sysfs_device->driver_name) != 0) { - dbg(FIELD_DRIVER " is not matching"); - goto try_parent; + dbg(KEY_DRIVER " is not matching"); + if (rule->driver_operation != KEY_OP_NOMATCH) + goto try_parent; + } else { + dbg(KEY_DRIVER " matches"); + if (rule->driver_operation == KEY_OP_NOMATCH) + goto try_parent; } - dbg(FIELD_DRIVER " matches"); + dbg(KEY_DRIVER " key is true"); } /* check for matching bus value */ @@ -577,13 +597,18 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("device has no sysfs_device"); goto try_parent; } - dbg("check for " FIELD_BUS " rule->bus='%s' sysfs_device->bus='%s'", + dbg("check for " KEY_BUS " rule->bus='%s' sysfs_device->bus='%s'", rule->bus, sysfs_device->bus); if (strcmp_pattern(rule->bus, sysfs_device->bus) != 0) { - dbg(FIELD_BUS " is not matching"); - goto try_parent; + dbg(KEY_BUS " is not matching"); + if (rule->bus_operation != KEY_OP_NOMATCH) + goto try_parent; + } else { + dbg(KEY_BUS " matches"); + if (rule->bus_operation == KEY_OP_NOMATCH) + goto try_parent; } - dbg(FIELD_BUS " matches"); + dbg(KEY_BUS " key is true"); } /* check for matching bus id */ @@ -592,22 +617,27 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("device has no sysfs_device"); goto try_parent; } - dbg("check " FIELD_ID); + dbg("check " KEY_ID); if (match_id(rule, sysfs_device) != 0) { - dbg(FIELD_ID " is not matching"); - goto try_parent; + dbg(KEY_ID " is not matching"); + if (rule->id_operation != KEY_OP_NOMATCH) + goto try_parent; + } else { + dbg(KEY_ID " matches"); + if (rule->id_operation == KEY_OP_NOMATCH) + goto try_parent; } - dbg(FIELD_ID " matches"); + dbg(KEY_ID " key is true"); } /* check for matching sysfs pairs */ if (rule->sysfs_pair[0].file[0] != '\0') { - dbg("check " FIELD_SYSFS " pairs"); + dbg("check " KEY_SYSFS " pairs"); if (match_sysfs_pairs(rule, class_dev, sysfs_device) != 0) { - dbg(FIELD_SYSFS " is not matching"); + dbg(KEY_SYSFS " is not matching"); goto try_parent; } - dbg(FIELD_SYSFS " matches"); + dbg(KEY_SYSFS " keys are true"); } /* found matching physical device */ @@ -625,25 +655,35 @@ try_parent: if (rule->program[0] != '\0') { char program[PATH_SIZE]; - dbg("check " FIELD_PROGRAM); + dbg("check " KEY_PROGRAM); strlcpy(program, rule->program, sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); if (execute_program(udev, program, udev->program_result, sizeof(udev->program_result)) != 0) { - dbg(FIELD_PROGRAM " returned nonzero"); - goto try_parent; + dbg(KEY_PROGRAM " returned nonzero"); + if (rule->program_operation != KEY_OP_NOMATCH) + goto exit; + } else { + dbg(KEY_PROGRAM " returned successful"); + if (rule->program_operation == KEY_OP_NOMATCH) + goto exit; } - dbg(FIELD_PROGRAM " returned successful"); + dbg(KEY_PROGRAM " key is true"); } /* check for matching result of external program */ if (rule->result[0] != '\0') { - dbg("check for " FIELD_RESULT "rule->result='%s', udev->program_result='%s'", + dbg("check for " KEY_RESULT " rule->result='%s', udev->program_result='%s'", rule->result, udev->program_result); if (strcmp_pattern(rule->result, udev->program_result) != 0) { - dbg(FIELD_RESULT " is not matching"); - goto try_parent; + dbg(KEY_RESULT " is not matching"); + if (rule->result_operation != KEY_OP_NOMATCH) + goto exit; + } else { + dbg(KEY_RESULT " matches"); + if (rule->result_operation == KEY_OP_NOMATCH) + goto exit; } - dbg(FIELD_RESULT " matches"); + dbg(KEY_RESULT " key is true"); } /* rule matches */ diff --git a/udev_rules.h b/udev_rules.h index 42552cfa41..d0142031e7 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -28,20 +28,20 @@ #include "list.h" -#define FIELD_KERNEL "KERNEL" -#define FIELD_SUBSYSTEM "SUBSYSTEM" -#define FIELD_BUS "BUS" -#define FIELD_SYSFS "SYSFS" -#define FIELD_ID "ID" -#define FIELD_PROGRAM "PROGRAM" -#define FIELD_RESULT "RESULT" -#define FIELD_DRIVER "DRIVER" -#define FIELD_NAME "NAME" -#define FIELD_SYMLINK "SYMLINK" -#define FIELD_OWNER "OWNER" -#define FIELD_GROUP "GROUP" -#define FIELD_MODE "MODE" -#define FIELD_OPTIONS "OPTIONS" +#define KEY_KERNEL "KERNEL" +#define KEY_SUBSYSTEM "SUBSYSTEM" +#define KEY_BUS "BUS" +#define KEY_SYSFS "SYSFS" +#define KEY_ID "ID" +#define KEY_PROGRAM "PROGRAM" +#define KEY_RESULT "RESULT" +#define KEY_DRIVER "DRIVER" +#define KEY_NAME "NAME" +#define KEY_SYMLINK "SYMLINK" +#define KEY_OWNER "OWNER" +#define KEY_GROUP "GROUP" +#define KEY_MODE "MODE" +#define KEY_OPTIONS "OPTIONS" #define OPTION_LAST_RULE "last_rule" #define OPTION_IGNORE_DEVICE "ignore_device" @@ -52,25 +52,41 @@ #define RULEFILE_SUFFIX ".rules" +enum key_operation { + KEY_OP_UNKNOWN, + KEY_OP_MATCH, + KEY_OP_NOMATCH, + KEY_OP_ADD, + KEY_OP_ASSIGN, +}; + struct sysfs_pair { char file[PATH_SIZE]; char value[VALUE_SIZE]; + enum key_operation operation; }; struct udev_rule { struct list_head node; char kernel[NAME_SIZE]; + enum key_operation kernel_operation; char subsystem[NAME_SIZE]; + enum key_operation subsystem_operation; char bus[NAME_SIZE]; + enum key_operation bus_operation; char id[NAME_SIZE]; - struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; + enum key_operation id_operation; + char driver[NAME_SIZE]; + enum key_operation driver_operation; char program[PATH_SIZE]; + enum key_operation program_operation; char result[PATH_SIZE]; - char driver[NAME_SIZE]; + enum key_operation result_operation; + struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; + char name[PATH_SIZE]; char symlink[PATH_SIZE]; - char owner[USER_SIZE]; char group[USER_SIZE]; mode_t mode; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index f77f3db915..ac4755fd37 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -73,6 +73,90 @@ void udev_rule_list_dump(void) udev_rule_dump(rule); } +static int get_key(char **line, char **key, enum key_operation *operation, char **value) +{ + char *linepos; + char *temp; + + linepos = *line; + if (!linepos) + return -1; + + /* skip whitespace */ + while (isspace(linepos[0]) || linepos[0] == ',') + linepos++; + + /* get the key */ + *key = linepos; + while (1) { + linepos++; + if (linepos[0] == '\0') + return -1; + if (isspace(linepos[0])) + break; + if (linepos[0] == '=') + break; + if (linepos[0] == '+') + break; + if (linepos[0] == '!') + break; + } + + /* remember end of key */ + temp = linepos; + + /* skip whitespace after key */ + while (isspace(linepos[0])) + linepos++; + + /* get operation type */ + if (linepos[0] == '=' && linepos[1] == '=') { + *operation = KEY_OP_MATCH; + linepos += 2; + dbg("operator=match"); + } else if (linepos[0] == '!' && linepos[1] == '=') { + *operation = KEY_OP_NOMATCH; + linepos += 2; + dbg("operator=nomatch"); + } else if (linepos[0] == '+' && linepos[1] == '=') { + *operation = KEY_OP_ADD; + linepos += 2; + dbg("operator=add"); + } else if (linepos[0] == '=') { + *operation = KEY_OP_ASSIGN; + linepos++; + dbg("operator=assign"); + } else + return -1; + + /* terminate key */ + temp[0] = '\0'; + dbg("key='%s'", *key); + + /* skip whitespace after operator */ + while (isspace(linepos[0])) + linepos++; + + /* get the value*/ + if (linepos[0] == '"') + linepos++; + else + return -1; + *value = linepos; + + temp = strchr(linepos, '"'); + if (!temp) + return -1; + temp[0] = '\0'; + temp++; + dbg("value='%s'", *value); + + /* move line to next key */ + *line = temp; + + return 0; +} + /* extract possible KEY{attr} */ static char *get_key_attribute(char *str) { @@ -100,9 +184,7 @@ static int rules_parse(struct udevice *udev, const char *filename) char line[LINE_SIZE]; char *bufline; int lineno; - char *temp; - char *temp2; - char *temp3; + char *linepos; char *attr; char *buf; size_t bufsize; @@ -113,12 +195,11 @@ static int rules_parse(struct udevice *udev, const char *filename) int retval = 0; struct udev_rule rule; - if (file_map(filename, &buf, &bufsize) == 0) { - dbg("reading '%s' as rules file", filename); - } else { + if (file_map(filename, &buf, &bufsize) != 0) { dbg("can't open '%s' as rules file", filename); return -1; } + dbg("reading '%s' as rules file", filename); /* loop through the whole file */ cur = 0; @@ -160,39 +241,47 @@ static int rules_parse(struct udevice *udev, const char *filename) /* get all known keys */ memset(&rule, 0x00, sizeof(struct udev_rule)); - temp = line; + linepos = line; valid = 0; while (1) { - retval = parse_get_pair(&temp, &temp2, &temp3); + char *key; + char *value; + enum key_operation operation = KEY_OP_UNKNOWN; + + retval = get_key(&linepos, &key, &operation, &value); if (retval) break; - if (strcasecmp(temp2, FIELD_KERNEL) == 0) { - strlcpy(rule.kernel, temp3, sizeof(rule.kernel)); + if (strcasecmp(key, KEY_KERNEL) == 0) { + strlcpy(rule.kernel, value, sizeof(rule.kernel)); + rule.kernel_operation = operation; valid = 1; continue; } - if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) { - strlcpy(rule.subsystem, temp3, sizeof(rule.subsystem)); + if (strcasecmp(key, KEY_SUBSYSTEM) == 0) { + strlcpy(rule.subsystem, value, sizeof(rule.subsystem)); + rule.subsystem_operation = operation; valid = 1; continue; } - if (strcasecmp(temp2, FIELD_BUS) == 0) { - strlcpy(rule.bus, temp3, sizeof(rule.bus)); + if (strcasecmp(key, KEY_BUS) == 0) { + strlcpy(rule.bus, value, sizeof(rule.bus)); + rule.bus_operation = operation; valid = 1; continue; } - if (strcasecmp(temp2, FIELD_ID) == 0) { - strlcpy(rule.id, temp3, sizeof(rule.id)); + if (strcasecmp(key, KEY_ID) == 0) { + strlcpy(rule.id, value, sizeof(rule.id)); + rule.id_operation = operation; valid = 1; continue; } - if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) { + if (strncasecmp(key, KEY_SYSFS, sizeof(KEY_SYSFS)-1) == 0) { struct sysfs_pair *pair = &rule.sysfs_pair[0]; int sysfs_pair_num = 0; @@ -206,39 +295,43 @@ static int rules_parse(struct udevice *udev, const char *filename) ++pair; } if (pair) { - attr = get_key_attribute(temp2 + sizeof(FIELD_SYSFS)-1); + attr = get_key_attribute(key + sizeof(KEY_SYSFS)-1); if (attr == NULL) { - dbg("error parsing " FIELD_SYSFS " attribute"); + dbg("error parsing " KEY_SYSFS " attribute"); continue; } strlcpy(pair->file, attr, sizeof(pair->file)); - strlcpy(pair->value, temp3, sizeof(pair->value)); + strlcpy(pair->value, value, sizeof(pair->value)); + pair->operation = operation; valid = 1; } continue; } - if (strcasecmp(temp2, FIELD_DRIVER) == 0) { - strlcpy(rule.driver, temp3, sizeof(rule.driver)); + if (strcasecmp(key, KEY_DRIVER) == 0) { + strlcpy(rule.driver, value, sizeof(rule.driver)); + rule.driver_operation = operation; valid = 1; continue; } - if (strcasecmp(temp2, FIELD_PROGRAM) == 0) { - program_given = 1; - strlcpy(rule.program, temp3, sizeof(rule.program)); + if (strcasecmp(key, KEY_RESULT) == 0) { + strlcpy(rule.result, value, sizeof(rule.result)); + rule.result_operation = operation; valid = 1; continue; } - if (strcasecmp(temp2, FIELD_RESULT) == 0) { - strlcpy(rule.result, temp3, sizeof(rule.result)); + if (strcasecmp(key, KEY_PROGRAM) == 0) { + strlcpy(rule.program, value, sizeof(rule.program)); + rule.program_operation = operation; + program_given = 1; valid = 1; continue; } - if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) { - attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1); + if (strncasecmp(key, KEY_NAME, sizeof(KEY_NAME)-1) == 0) { + attr = get_key_attribute(key + sizeof(KEY_NAME)-1); /* FIXME: remove old style options and make OPTIONS= mandatory */ if (attr != NULL) { if (strstr(attr, OPTION_PARTITIONS) != NULL) { @@ -250,52 +343,52 @@ static int rules_parse(struct udevice *udev, const char *filename) rule.ignore_remove = 1; } } - if (temp3[0] != '\0') - strlcpy(rule.name, temp3, sizeof(rule.name)); + if (value[0] != '\0') + strlcpy(rule.name, value, sizeof(rule.name)); else rule.ignore_device = 1; valid = 1; continue; } - if (strcasecmp(temp2, FIELD_SYMLINK) == 0) { - strlcpy(rule.symlink, temp3, sizeof(rule.symlink)); + if (strcasecmp(key, KEY_SYMLINK) == 0) { + strlcpy(rule.symlink, value, sizeof(rule.symlink)); valid = 1; continue; } - if (strcasecmp(temp2, FIELD_OWNER) == 0) { - strlcpy(rule.owner, temp3, sizeof(rule.owner)); + if (strcasecmp(key, KEY_OWNER) == 0) { + strlcpy(rule.owner, value, sizeof(rule.owner)); valid = 1; continue; } - if (strcasecmp(temp2, FIELD_GROUP) == 0) { - strlcpy(rule.group, temp3, sizeof(rule.group)); + if (strcasecmp(key, KEY_GROUP) == 0) { + strlcpy(rule.group, value, sizeof(rule.group)); valid = 1; continue; } - if (strcasecmp(temp2, FIELD_MODE) == 0) { - rule.mode = strtol(temp3, NULL, 8); + if (strcasecmp(key, KEY_MODE) == 0) { + rule.mode = strtol(value, NULL, 8); valid = 1; continue; } - if (strcasecmp(temp2, FIELD_OPTIONS) == 0) { - if (strstr(temp3, OPTION_LAST_RULE) != NULL) { + if (strcasecmp(key, KEY_OPTIONS) == 0) { + if (strstr(value, OPTION_LAST_RULE) != NULL) { dbg("last rule to be applied"); rule.last_rule = 1; } - if (strstr(temp3, OPTION_IGNORE_DEVICE) != NULL) { + if (strstr(value, OPTION_IGNORE_DEVICE) != NULL) { dbg("device should be ignored"); rule.ignore_device = 1; } - if (strstr(temp3, OPTION_IGNORE_REMOVE) != NULL) { + if (strstr(value, OPTION_IGNORE_REMOVE) != NULL) { dbg("remove event should be ignored"); rule.ignore_remove = 1; } - if (strstr(temp3, OPTION_PARTITIONS) != NULL) { + if (strstr(value, OPTION_PARTITIONS) != NULL) { dbg("creation of partition nodes requested"); rule.partitions = DEFAULT_PARTITIONS_COUNT; } @@ -303,7 +396,7 @@ static int rules_parse(struct udevice *udev, const char *filename) continue; } - dbg("unknown type of field '%s'", temp2); + dbg("unknown key '%s'", key); goto error; } @@ -314,13 +407,13 @@ static int rules_parse(struct udevice *udev, const char *filename) /* simple plausibility checks for given keys */ if ((rule.sysfs_pair[0].file[0] == '\0') ^ (rule.sysfs_pair[0].value[0] == '\0')) { - info("inconsistency in " FIELD_SYSFS " key"); + info("inconsistency in " KEY_SYSFS " key"); goto error; } if ((rule.result[0] != '\0') && (program_given == 0)) { - info(FIELD_RESULT " is only useful when " - FIELD_PROGRAM " is called in any rule before"); + info(KEY_RESULT " is only useful when " + KEY_PROGRAM " is called in any rule before"); goto error; } @@ -332,7 +425,7 @@ static int rules_parse(struct udevice *udev, const char *filename) continue; error: info("parse error %s, line %d:%d, rule skipped", - filename, lineno, (int) (temp - line)); + filename, lineno, (int) (linepos - line)); } } diff --git a/udev_utils.c b/udev_utils.c index b650096593..c6658e6933 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -177,41 +177,6 @@ int unlink_secure(const char *filename) return retval; } -int parse_get_pair(char **orig_string, char **left, char **right) -{ - char *temp; - char *string = *orig_string; - - if (!string) - return -ENODEV; - - /* eat any whitespace */ - while (isspace(*string) || *string == ',') - ++string; - - /* split based on '=' */ - temp = strsep(&string, "="); - *left = temp; - if (!string) - return -ENODEV; - - /* take the right side and strip off the '"' */ - while (isspace(string[0])) - ++string; - if (string[0] == '"') - ++string; - else - return -ENODEV; - - temp = strsep(&string, "\""); - if (!string || temp[0] == '\0') - return -ENODEV; - *right = temp; - *orig_string = string; - - return 0; -} - int file_map(const char *filename, char **buf, size_t *bufsize) { struct stat stats; -- cgit v1.2.3-54-g00ecf From 38285d23d702258d3b219532a9874555e797a292 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 13 Mar 2005 07:14:49 +0100 Subject: [PATCH] add a test and simplify debug statement --- RELEASE-NOTES | 11 ++++++----- test/udev-test.pl | 10 ++++++++++ udev_rules.h | 7 ++----- udev_rules_parse.c | 27 ++++++++------------------- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ee77d845be..8895f46215 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -9,12 +9,13 @@ THE PLACE= key is gone. It can be replaced by an ID= for a long time, cause we walk up the chain of physical devices to find a match. The KEY="" format supports '=', '==', '!=,' , '+=' now. This makes it -easier to skip certain devices without composing rules with weird character -class negations like: +easy to skip certain attribute matches without composing rules with weird +character class negations like: KERNEL="[!s][!c][!d]*" -this can be replaced by: +this can now be replaced with: KERNEL!="scd*" -The simple '=' is still supported, but the rules should be converted if -possible, to be better human-readable. +The current simple '=' is still supported, and should work as it does today, +but existing rules should be converted if possible, to be better readable. + diff --git a/test/udev-test.pl b/test/udev-test.pl index 8d66536b94..ebceccecb2 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1159,6 +1159,16 @@ EOF conf => < "test for whitespace between the operator", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "true", + conf => <node, &udev_rule_list); - udev_rule_dump(tmp_rule); - return 0; -} - -void udev_rule_dump(struct udev_rule *rule) -{ dbg("name='%s', symlink='%s', bus='%s', id='%s', " "sysfs_file[0]='%s', sysfs_value[0]='%s', " - "kernel='%s', program='%s', result='%s'" - "owner='%s', group='%s', mode=%#o", + "kernel='%s', program='%s', result='%s', " + "owner='%s', group='%s', mode=%#o, " + "all_partions=%u, ignore_remove=%u, ignore_device=%u, last_rule=%u", rule->name, rule->symlink, rule->bus, rule->id, rule->sysfs_pair[0].file, rule->sysfs_pair[0].value, - rule->kernel, rule->program, rule->result, - rule->owner, rule->group, rule->mode); -} + rule->kernel, rule->program, rule->result, rule->owner, rule->group, rule->mode, + rule->partitions, rule->ignore_remove, rule->ignore_device, rule->last_rule); -void udev_rule_list_dump(void) -{ - struct udev_rule *rule; - - list_for_each_entry(rule, &udev_rule_list, node) - udev_rule_dump(rule); + return 0; } static int get_key(char **line, char **key, enum key_operation *operation, char **value) -- cgit v1.2.3-54-g00ecf From 79f651f4bd2fb395a705792eb8ce551a6021bcd6 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 13 Mar 2005 08:15:10 +0100 Subject: [PATCH] simplify sysfs_pair handling --- udev_rules.c | 19 ++++++++++--------- udev_rules.h | 9 +++++---- udev_rules_parse.c | 41 ++++++++++++++++++----------------------- 3 files changed, 33 insertions(+), 36 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 3a55270791..d1192614aa 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -463,16 +463,16 @@ attr_found: return tmpattr; } -static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct sysfs_pair *pair) +static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct key_pair *pair) { struct sysfs_attribute *tmpattr; int i; int len; - if ((pair == NULL) || (pair->file[0] == '\0') || (pair->value == '\0')) + if ((pair == NULL) || (pair->name[0] == '\0') || (pair->value == '\0')) return -ENODEV; - tmpattr = find_sysfs_attribute(class_dev, sysfs_device, pair->file); + tmpattr = find_sysfs_attribute(class_dev, sysfs_device, pair->name); if (tmpattr == NULL) return -ENODEV; @@ -489,23 +489,24 @@ static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct } dbg("compare attribute '%s' value '%s' with '%s'", - pair->file, tmpattr->value, pair->value); + pair->name, tmpattr->value, pair->value); if (strcmp_pattern(pair->value, tmpattr->value) != 0) return -ENODEV; dbg("found matching attribute '%s' with value '%s'", - pair->file, pair->value); + pair->name, pair->value); return 0; } static int match_sysfs_pairs(struct udev_rule *rule, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { - struct sysfs_pair *pair; int i; - for (i = 0; i < MAX_SYSFS_PAIRS; ++i) { + for (i = 0; i < rule->sysfs_pair_count; i++) { + struct key_pair *pair; + pair = &rule->sysfs_pair[i]; - if ((pair->file[0] == '\0') || (pair->value[0] == '\0')) + if ((pair->name[0] == '\0') || (pair->value[0] == '\0')) break; if (compare_sysfs_attribute(class_dev, sysfs_device, pair) != 0) { dbg("sysfs pair #%u does not match", i); @@ -631,7 +632,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, } /* check for matching sysfs pairs */ - if (rule->sysfs_pair[0].file[0] != '\0') { + if (rule->sysfs_pair[0].name[0] != '\0') { dbg("check " KEY_SYSFS " pairs"); if (match_sysfs_pairs(rule, class_dev, sysfs_device) != 0) { dbg(KEY_SYSFS " is not matching"); diff --git a/udev_rules.h b/udev_rules.h index 688d4798e1..94a5d9d5fd 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -48,7 +48,7 @@ #define OPTION_IGNORE_REMOVE "ignore_remove" #define OPTION_PARTITIONS "all_partitions" -#define MAX_SYSFS_PAIRS 5 +#define KEY_SYSFS_PAIRS_MAX 5 #define RULEFILE_SUFFIX ".rules" @@ -60,8 +60,8 @@ enum key_operation { KEY_OP_ASSIGN, }; -struct sysfs_pair { - char file[PATH_SIZE]; +struct key_pair { + char name[NAME_SIZE]; char value[VALUE_SIZE]; enum key_operation operation; }; @@ -83,7 +83,8 @@ struct udev_rule { enum key_operation program_operation; char result[PATH_SIZE]; enum key_operation result_operation; - struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; + struct key_pair sysfs_pair[KEY_SYSFS_PAIRS_MAX]; + int sysfs_pair_count; char name[PATH_SIZE]; char symlink[PATH_SIZE]; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index db83a67953..c4c684d059 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -55,7 +55,7 @@ static int add_config_dev(struct udev_rule *rule) "owner='%s', group='%s', mode=%#o, " "all_partions=%u, ignore_remove=%u, ignore_device=%u, last_rule=%u", rule->name, rule->symlink, rule->bus, rule->id, - rule->sysfs_pair[0].file, rule->sysfs_pair[0].value, + rule->sysfs_pair[0].name, rule->sysfs_pair[0].value, rule->kernel, rule->program, rule->result, rule->owner, rule->group, rule->mode, rule->partitions, rule->ignore_remove, rule->ignore_device, rule->last_rule); @@ -271,29 +271,24 @@ static int rules_parse(struct udevice *udev, const char *filename) } if (strncasecmp(key, KEY_SYSFS, sizeof(KEY_SYSFS)-1) == 0) { - struct sysfs_pair *pair = &rule.sysfs_pair[0]; - int sysfs_pair_num = 0; - - /* find first unused pair */ - while (pair->file[0] != '\0') { - ++sysfs_pair_num; - if (sysfs_pair_num >= MAX_SYSFS_PAIRS) { - pair = NULL; - break; - } - ++pair; + struct key_pair *pair; + + if (rule.sysfs_pair_count >= KEY_SYSFS_PAIRS_MAX) { + dbg("skip rule, to many " KEY_SYSFS " keys in a single rule"); + goto error; } - if (pair) { - attr = get_key_attribute(key + sizeof(KEY_SYSFS)-1); - if (attr == NULL) { - dbg("error parsing " KEY_SYSFS " attribute"); - continue; - } - strlcpy(pair->file, attr, sizeof(pair->file)); - strlcpy(pair->value, value, sizeof(pair->value)); - pair->operation = operation; - valid = 1; + pair = &rule.sysfs_pair[rule.sysfs_pair_count]; + rule.sysfs_pair_count++; + + attr = get_key_attribute(key + sizeof(KEY_SYSFS)-1); + if (attr == NULL) { + dbg("error parsing " KEY_SYSFS " attribute"); + continue; } + strlcpy(pair->name, attr, sizeof(pair->name)); + strlcpy(pair->value, value, sizeof(pair->value)); + pair->operation = operation; + valid = 1; continue; } @@ -394,7 +389,7 @@ static int rules_parse(struct udevice *udev, const char *filename) goto error; /* simple plausibility checks for given keys */ - if ((rule.sysfs_pair[0].file[0] == '\0') ^ + if ((rule.sysfs_pair[0].name[0] == '\0') ^ (rule.sysfs_pair[0].value[0] == '\0')) { info("inconsistency in " KEY_SYSFS " key"); goto error; -- cgit v1.2.3-54-g00ecf From 3e5958dee5f24283eb5c6a2d2d95e1a39428a3b8 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 13 Mar 2005 11:40:32 +0100 Subject: [PATCH] add ENV{} key to match agains environment variables --- test/udev-test.pl | 32 +++++++++++++++++------- udev.8.in | 10 +++++--- udev_rules.c | 71 +++++++++++++++++++++++++++++++++--------------------- udev_rules.h | 6 ++++- udev_rules_parse.c | 24 ++++++++++++++++-- 5 files changed, 100 insertions(+), 43 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index ebceccecb2..2ece431735 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -256,15 +256,6 @@ EOF exp_name => "M8-m3-n3-b0:0-sIBM" , conf => < "old style SYSFS_ attribute", - subsys => "block", - devpath => "/block/sda", - exp_name => "good" , - conf => < < "ENV{} test", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "true", + conf => < "ENV{} test", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "true", + conf => <sysfs_pair_count; i++) { - struct key_pair *pair; - - pair = &rule->sysfs_pair[i]; - if ((pair->name[0] == '\0') || (pair->value[0] == '\0')) - break; - if (compare_sysfs_attribute(class_dev, sysfs_device, pair) != 0) { - dbg("sysfs pair #%u does not match", i); - if (pair->operation != KEY_OP_NOMATCH) - return -1; - } else { - dbg("sysfs pair #%u matches", i); - if (pair->operation == KEY_OP_NOMATCH) - return -1; - } - } - - return 0; -} - static int match_id(struct udev_rule *rule, struct sysfs_device *sysfs_device) { char path[PATH_SIZE]; @@ -570,6 +546,33 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg(KEY_SUBSYSTEM " key is true"); } + if (rule->env_pair_count) { + int i; + + dbg("check for " KEY_ENV " pairs"); + for (i = 0; i < rule->env_pair_count; i++) { + struct key_pair *pair; + const char *value; + + pair = &rule->env_pair[i]; + value = getenv(pair->name); + if (!value) { + dbg(KEY_ENV "{'%s'} is not found", pair->name); + goto exit; + } + if (strcmp_pattern(pair->value, value) != 0) { + dbg(KEY_ENV "{'%s'} is not matching", pair->name); + if (pair->operation != KEY_OP_NOMATCH) + goto exit; + } else { + dbg(KEY_ENV "{'%s'} matches", pair->name); + if (pair->operation == KEY_OP_NOMATCH) + goto exit; + } + } + dbg(KEY_ENV " key is true"); + } + /* walk up the chain of physical devices and find a match */ while (1) { /* check for matching driver */ @@ -632,11 +635,23 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, } /* check for matching sysfs pairs */ - if (rule->sysfs_pair[0].name[0] != '\0') { + if (rule->sysfs_pair_count) { + int i; + dbg("check " KEY_SYSFS " pairs"); - if (match_sysfs_pairs(rule, class_dev, sysfs_device) != 0) { - dbg(KEY_SYSFS " is not matching"); - goto try_parent; + for (i = 0; i < rule->sysfs_pair_count; i++) { + struct key_pair *pair; + + pair = &rule->sysfs_pair[i]; + if (compare_sysfs_attribute(class_dev, sysfs_device, pair) != 0) { + dbg(KEY_SYSFS "{'%s'} is not matching", pair->name); + if (pair->operation != KEY_OP_NOMATCH) + goto try_parent; + } else { + dbg(KEY_SYSFS "{'%s'} matches", pair->name); + if (pair->operation == KEY_OP_NOMATCH) + goto try_parent; + } } dbg(KEY_SYSFS " keys are true"); } diff --git a/udev_rules.h b/udev_rules.h index 94a5d9d5fd..423a6f641e 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -31,11 +31,12 @@ #define KEY_KERNEL "KERNEL" #define KEY_SUBSYSTEM "SUBSYSTEM" #define KEY_BUS "BUS" -#define KEY_SYSFS "SYSFS" #define KEY_ID "ID" #define KEY_PROGRAM "PROGRAM" #define KEY_RESULT "RESULT" #define KEY_DRIVER "DRIVER" +#define KEY_SYSFS "SYSFS" +#define KEY_ENV "ENV" #define KEY_NAME "NAME" #define KEY_SYMLINK "SYMLINK" #define KEY_OWNER "OWNER" @@ -49,6 +50,7 @@ #define OPTION_PARTITIONS "all_partitions" #define KEY_SYSFS_PAIRS_MAX 5 +#define KEY_ENV_PAIRS_MAX 5 #define RULEFILE_SUFFIX ".rules" @@ -85,6 +87,8 @@ struct udev_rule { enum key_operation result_operation; struct key_pair sysfs_pair[KEY_SYSFS_PAIRS_MAX]; int sysfs_pair_count; + struct key_pair env_pair[KEY_ENV_PAIRS_MAX]; + int env_pair_count; char name[PATH_SIZE]; char symlink[PATH_SIZE]; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index c4c684d059..face496ab3 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -278,16 +278,36 @@ static int rules_parse(struct udevice *udev, const char *filename) goto error; } pair = &rule.sysfs_pair[rule.sysfs_pair_count]; - rule.sysfs_pair_count++; - attr = get_key_attribute(key + sizeof(KEY_SYSFS)-1); if (attr == NULL) { dbg("error parsing " KEY_SYSFS " attribute"); + goto error; + } + strlcpy(pair->name, attr, sizeof(pair->name)); + strlcpy(pair->value, value, sizeof(pair->value)); + pair->operation = operation; + rule.sysfs_pair_count++; + valid = 1; + continue; + } + + if (strncasecmp(key, KEY_ENV, sizeof(KEY_ENV)-1) == 0) { + struct key_pair *pair; + + if (rule.env_pair_count >= KEY_ENV_PAIRS_MAX) { + dbg("skip rule, to many " KEY_ENV " keys in a single rule"); + goto error; + } + pair = &rule.env_pair[rule.env_pair_count]; + attr = get_key_attribute(key + sizeof(KEY_ENV)-1); + if (attr == NULL) { + dbg("error parsing " KEY_ENV " attribute"); continue; } strlcpy(pair->name, attr, sizeof(pair->name)); strlcpy(pair->value, value, sizeof(pair->value)); pair->operation = operation; + rule.env_pair_count++; valid = 1; continue; } -- cgit v1.2.3-54-g00ecf From fc90ce812d052b4c766d91769456b42ba0051cb1 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 13 Mar 2005 11:43:50 +0100 Subject: [PATCH] add final release note --- RELEASE-NOTES | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8895f46215..958ad39b8a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -5,17 +5,17 @@ We support an unlimited count of symlinks now. If USE_STATIC=true is passed to a glibc build, we link statically and use a built-in userdb parser to resolve user and group names. -THE PLACE= key is gone. It can be replaced by an ID= for a long time, cause +The PLACE= key is gone. It can be replaced by an ID= for a long time, cause we walk up the chain of physical devices to find a match. The KEY="" format supports '=', '==', '!=,' , '+=' now. This makes it easy to skip certain attribute matches without composing rules with weird character class negations like: KERNEL="[!s][!c][!d]*" - this can now be replaced with: KERNEL!="scd*" - The current simple '=' is still supported, and should work as it does today, but existing rules should be converted if possible, to be better readable. +We have new ENV{}== key now, to match against a maximum of 5 environment +variables. -- cgit v1.2.3-54-g00ecf From d6d1a18d7245b8065df95775c6d45fe2d8f2e66a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 14 Mar 2005 04:01:54 +0100 Subject: [PATCH] remove unneeded code, libsysfs does this for us --- udev_rules.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 551c06131b..f09d6d47bf 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -498,21 +498,6 @@ static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct return 0; } -static int match_id(struct udev_rule *rule, struct sysfs_device *sysfs_device) -{ - char path[PATH_SIZE]; - char *temp; - - strlcpy(path, sysfs_device->path, sizeof(path)); - temp = strrchr(path, '/'); - temp++; - dbg("search '%s' in '%s', path='%s'", rule->id, temp, path); - if (strcmp_pattern(rule->id, temp) != 0) - return -ENODEV; - - return 0; -} - static int match_rule(struct udevice *udev, struct udev_rule *rule, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { @@ -622,7 +607,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, goto try_parent; } dbg("check " KEY_ID); - if (match_id(rule, sysfs_device) != 0) { + if (strcmp_pattern(rule->id, sysfs_device->bus_id) != 0) { dbg(KEY_ID " is not matching"); if (rule->id_operation != KEY_OP_NOMATCH) goto try_parent; -- cgit v1.2.3-54-g00ecf From ca4c984cf5a2ee3e8d61d16bb3391ed6ff5f4cc7 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 14 Mar 2005 04:18:20 +0100 Subject: [PATCH] correct rule match for devices without a physical device --- udev_rules.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index f09d6d47bf..3dc77855da 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -564,7 +564,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, if (rule->driver[0] != '\0') { if (sysfs_device == NULL) { dbg("device has no sysfs_device"); - goto try_parent; + goto exit; } dbg("check for " KEY_DRIVER " rule->driver='%s' sysfs_device->driver_name='%s'", rule->driver, sysfs_device->driver_name); @@ -584,7 +584,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, if (rule->bus[0] != '\0') { if (sysfs_device == NULL) { dbg("device has no sysfs_device"); - goto try_parent; + goto exit; } dbg("check for " KEY_BUS " rule->bus='%s' sysfs_device->bus='%s'", rule->bus, sysfs_device->bus); @@ -604,7 +604,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, if (rule->id[0] != '\0') { if (sysfs_device == NULL) { dbg("device has no sysfs_device"); - goto try_parent; + goto exit; } dbg("check " KEY_ID); if (strcmp_pattern(rule->id, sysfs_device->bus_id) != 0) { @@ -648,8 +648,8 @@ try_parent: sysfs_device = sysfs_get_device_parent(sysfs_device); if (sysfs_device == NULL) goto exit; - dbg("sysfs_device->path='%s'", sysfs_device->path); - dbg("sysfs_device->bus_id='%s'", sysfs_device->bus_id); + dbg("look at sysfs_device->path='%s'", sysfs_device->path); + dbg("look at sysfs_device->bus_id='%s'", sysfs_device->bus_id); } /* execute external program */ -- cgit v1.2.3-54-g00ecf From 29e8ed4c27a311be32cc039f3d284d9836f3021d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 14 Mar 2005 04:40:12 +0100 Subject: [PATCH] clarify the shortcomings of %e --- udev.8.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/udev.8.in b/udev.8.in index 84d8a313da..a246efdb45 100644 --- a/udev.8.in +++ b/udev.8.in @@ -238,6 +238,14 @@ decimal integer N is substituted such that the resulting name doesn't match an existing device node. Otherwise nothing is substituted. This can be used to create compatibility symlinks and enumerate devices of the same type originating from different kernel subsystems. +.sp +Note: The use of the enumeration facility is unreliable outside of +udevstart where the node creation is serialized and predictable. +The returned numbers rely on the order devices are probed on the +system. If more than one device requests an enumeration for the same +name at the same time, it may be possible that both requests receive the +same name back from the database. The use of enumerations in todays setups +where device can come and go at any time is not recomended. .TP .B %% The '%' character itself. -- cgit v1.2.3-54-g00ecf From cc44094d6353f9af4d8b485e5d7027a190200cb7 Mon Sep 17 00:00:00 2001 From: "hare@suse.de" Date: Wed, 16 Mar 2005 00:46:44 +0100 Subject: [PATCH] volume_id: Fix label/uuid reading for reiserfs Well, I just asked our resident reiserfs guru (thx mason :-). Reiser v3.5 does not support labels nor uuids. --- extras/volume_id/volume_id/reiserfs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c index 34cf167dc4..091c68aaf4 100644 --- a/extras/volume_id/volume_id/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs.c @@ -80,6 +80,10 @@ int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) return -1; rs = (struct reiserfs_super_block *) buf;; + if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { + strcpy(id->type_version, "3.5"); + goto found; + } if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { strcpy(id->type_version, "3.6"); goto found_v3; @@ -104,7 +108,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { strcpy(id->type_version, "3.5"); - goto found_v3; + goto found; } return -1; -- cgit v1.2.3-54-g00ecf From 7d227c5f34d96a560baed6dc1b9d9865db2e678d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 16 Mar 2005 00:52:00 +0100 Subject: [PATCH] volume_id: version 43 --- extras/volume_id/volume_id/reiserfs.c | 6 +++--- extras/volume_id/volume_id/volume_id.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c index 091c68aaf4..a53fc4a5a9 100644 --- a/extras/volume_id/volume_id/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs.c @@ -86,11 +86,11 @@ int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) } if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { strcpy(id->type_version, "3.6"); - goto found_v3; + goto found_label; } if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { strcpy(id->type_version, "JR"); - goto found_v3; + goto found_label; } rs4 = (struct reiser4_super_block *) buf; @@ -113,7 +113,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) return -1; -found_v3: +found_label: volume_id_set_label_raw(id, rs->label, 16); volume_id_set_label_string(id, rs->label, 16); volume_id_set_uuid(id, rs->uuid, UUID_DCE); diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 63f95132df..c7fa0d9bea 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 42 +#define VOLUME_ID_VERSION 43 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From 0e33828a76ccf88e9f5e4111df7c02860d307285 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 16 Mar 2005 00:54:28 +0100 Subject: [PATCH] add udevstart to the RELEASE-NOTES --- RELEASE-NOTES | 3 +++ 1 file changed, 3 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 958ad39b8a..0bddab4189 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -19,3 +19,6 @@ but existing rules should be converted if possible, to be better readable. We have new ENV{}== key now, to match against a maximum of 5 environment variables. + +udevstart is its own binary again, cause we don't need co carry this araound +with every forked event. -- cgit v1.2.3-54-g00ecf From 677a6a84bd16bdae229830a731800efc5de64b0f Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Wed, 16 Mar 2005 22:45:14 -0800 Subject: [PATCH] gentoo rule update for raid devices. From Thierry Vignaud --- etc/udev/gentoo/udev.rules | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 9d109d0930..71e39e1e11 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -29,6 +29,13 @@ KERNEL="sd*", NAME="%k", GROUP="disk" KERNEL="dasd*", NAME="%k", GROUP="disk" KERNEL="ataraid*", NAME="%k", GROUP="disk" +# compaq smart array +KERNEL="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" +KERNEL="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" + +# mylex +KERNEL="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" + # dri devices KERNEL="card*", NAME="dri/card%n", GROUP="video" KERNEL="nvidia*", NAME="%k", GROUP="video" -- cgit v1.2.3-54-g00ecf From c29125aebb439f906def956c09fb39efd787ca3a Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Wed, 16 Mar 2005 22:51:56 -0800 Subject: [PATCH] added frugalware udev ruleset. --- etc/udev/frugalware/udev.rules | 170 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 etc/udev/frugalware/udev.rules diff --git a/etc/udev/frugalware/udev.rules b/etc/udev/frugalware/udev.rules new file mode 100644 index 0000000000..a7c19cb967 --- /dev/null +++ b/etc/udev/frugalware/udev.rules @@ -0,0 +1,170 @@ +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# See the udev.rules.examples file for more examples of how to create rules +# + +# if this is a ide cdrom, name it the default name, and create a symlink to cdrom +# BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" + +# create a symlink named after the device map name +# note devmap_name comes with extras/multipath +KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" + +# USB devices +KERNEL="hiddev*", NAME="usb/%k" +KERNEL="auer*", NAME="usb/%k" +KERNEL="legousbtower*", NAME="usb/%k" +KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" + +# CAPI devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi*", NAME="capi/%n" + +# Network devices +KERNEL="tun", NAME="net/%k" + +# permissions +KERNEL="pl2303", NAME="%k", OWNER="500", GROUP="500", MODE="0666" +KERNEL="visor", NAME="%k", OWNER="root", GROUP="uucp", MODE="0666" +KERNEL="camera*" NAME="%k", OWNER="500", GROUP="500", MODE="0666" + +# console devices +KERNEL="console" NAME="%k", OWNER="root", GROUP="tty", MODE="0600" +KERNEL="tty", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL="tty[0-9]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" +KERNEL="vcs*", NAME="%k", OWNER="root", GROUP="tty", MODE="0620" +KERNEL="tty[CIS]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL="ttyUB[0-9]", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL="ttyUSB0", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL="ttyUSB1", NAME="%k", OWNER="root" GROUP="uucp", MODE="0666" + +# pty devices +KERNEL="ptmx" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL="pty[p-za-e][0-9a-f]*" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL="tty[p-za-e][0-9a-f]*" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL="cu[abiu]*" NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" + +# sound devices +KERNEL="audio*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="beep" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="dsp*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="midi*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="mixer*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="music" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="sequencer*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="controlC[0-9]*", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="hw[CD0-9]*", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="midiC[D0-9]*", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="timer", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="seq", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="sndstat" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="speaker" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="sound/*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" +KERNEL="admmidi*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" +KERNEL="adsp*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" +KERNEL="aload*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="amidi*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" +KERNEL="amixer*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" + +# input devices (mouse, joystick, etc) +KERNEL="mice", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="mouse*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="event*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="js*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="ts*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="input/js*" NAME="%k", OWNER="root", GROUP="games",0 MODE="0666" +KERNEL="djs[0-3]" NAME="%k", OWNER="root", GROUP="games", MODE="0660" +KERNEL="psaux" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL="crash" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL="logibm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL="jbm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL="hwtrap" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="inportbm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL="sexec" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL="jsflash" NAME="%k", OWNER="root", GROUP="root", MODE="0660" + +# power manager device +KERNEL="apm_bios" NAME="%k", OWNER="root", GROUP="root", MODE="0644" + +# printer device +KERNEL="lp[0-9]" NAME="%k", OWNER="root", GROUP="lp", MODE="0660" +KERNEL="parport*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" + +# video devices +KERNEL="card*" NAME="dri/card%n", OWNER="root", GROUP="root", MODE="0666" +KERNEL="fb[0-9]" NAME="%k", OWNER="root", GROUP="tty", MODE="0660" +KERNEL="agpgart" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL="nvidia*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" +KERNEL="video*" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" + +# DISK devices +KERNEL="ed[ab]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="gscd0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="initrd" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="lmscd" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="mcd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="md*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="mtd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="userdma" NAME="%k", OWNER="root", GROUP="root", MODE="0660" + +# floppy devices +KERNEL="fd[0-3]*" NAME="%k", OWNER="root", GROUP="floppy", MODE="0660" + +# IDE devices (hd, cdrom) +KERNEL="hd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL="ht0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" + +# RAID IDE +KERNEL="ataraid[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL="ataraid/*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" + +# SCSI devices +KERNEL="scsi/*/cd" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL="scsi/*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL="sd[a-h]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="s[rt][0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="scd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" + +# generic scsi devices +KERNEL="sg*" NAME="%k", OWNER="root", GROUP="root", MODE="0600" + +# old CD-ROM +KERNEL="sbpcd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" + +# loop devices +KERNEL="loop[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" + +# network block devices +KERNEL="nb[0-7]" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL="nht0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="npt[0-3]" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL="n[qrs]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" + +# memory access devices +KERNEL="kmem" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL="mem" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL="null" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="nvram" NAME="%k", OWNER="root", GROUP="root", MODE="0640" +KERNEL="port" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL="ram[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL="random" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="rtc" NAME="%k", OWNER="root", GROUP="root", MODE="0444" +KERNEL="urandom" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="full" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL="zero" NAME="%k", OWNER="root", GROUP="root", MODE="0666" +KERNEL="raw[0-9]*" NAME="raw/%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL="modreq" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="msr" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL="profile*" NAME="%k", OWNER="root", GROUP="root", MODE="0640" + +# ISDN devices +KERNEL="isdn*" NAME="%k", OWNER="root", GROUP="tty", MODE="0660" + +# net devices +KERNEL="ippp*" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="ipstate*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL="spx" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL="fwmonitor*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -- cgit v1.2.3-54-g00ecf From c262aa49840f4821b5769bbfa9930a4bf4981a06 Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Wed, 16 Mar 2005 23:23:03 -0800 Subject: [PATCH] fix raid rules. Thanks to Kay for pointing it out. --- etc/udev/gentoo/udev.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 71e39e1e11..db8c5d9263 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -30,11 +30,11 @@ KERNEL="dasd*", NAME="%k", GROUP="disk" KERNEL="ataraid*", NAME="%k", GROUP="disk" # compaq smart array -KERNEL="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" -KERNEL="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" +KERNEL="cciss*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" +KERNEL="ida*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" # mylex -KERNEL="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" +KERNEL="rd*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" # dri devices KERNEL="card*", NAME="dri/card%n", GROUP="video" -- cgit v1.2.3-54-g00ecf From 2861655484df31fdeb2a8d04b5abf8fe9bc8a2f8 Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Thu, 17 Mar 2005 00:45:02 -0800 Subject: [PATCH] 055 release --- ChangeLog | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 472df80dbc..9c1ee1f889 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,82 @@ +Summary of changes from v054 to v055 +============================================ + +: + o This patch causes the remove handler to check that each symlink actually points to the correct devnode and skip it if it does not. + +: + o udev selinux fix + +: + o The following patch fixes some warnings when compiling volume_id from udev with the -Wall compiler flag. Define _GNU_SOURCE for strnlen() and correct the path to logging.h + o The following patch fixes a warning when compiling chassis_id from udev with the -Wall compiler flag. There are too much conversions in the format string of sscanf(). One %d can be dropped. + +Greg Kroah-Hartman: + o fix raid rules + o added frugalware udev ruleset + o merge selinux and Kay's symlink fixes together + +Hannes Reinecke: + o volume_id: Fix label/uuid reading for reiserfs + +Kay Sievers: + o add udevstart to the RELEASE-NOTES + o volume_id: version 43 + o clarify the shortcomings of %e + o correct rule match for devices without a physical device + o remove unneeded code, libsysfs does this for us + o add final release note + o add ENV{} key to match agains environment variables + o simplify sysfs_pair handling + o add a test and simplify debug statement + o support =, ==, !=, += for the key match and assignment + o add OPTION="last_rule" to skip any later rule + o rename namedev_dev to udev_rule + o correct enum device_type + o remove udevstart on make clean + o volume_id: version 42 + o volume_id: version 41 + o remove unneeded include + o The path to dlist.h is not correct + o udevinfo -d: use '=' as separator, cause ':' may be a part of the devpath + o klibc: version 1.0.3 + o add RELEASE-NOTES file + o test suite: move "driver" link to physical device + o remove PLACE key match + o don't lookup "root" in the userdb + o fix ia64 compile + o fix segfaulting udev while DRIVER matching + o cleanup list.h + o klibc: version 0.214 + o rename device_list->list to device_list->node + o replace strncpy()/strncat() by strlcpy()/strlcat() + o split udev and udevstart + o udev_volume_id: version 39 + o rename LOG to USE_LOG in all places + o remove Makefile magic for klibc integration + o klibc_fixups: remove no longer needed stuff + o udev_volume_id: volume_id v38 + o use numeric owner/group as default values to avoid parsing userdb + o fix up segfaulting binaries with new klibc + o udevinfo -d: speed-up device dump + o klibc: version 0.211 + o klibc_fixups: remove unneeded stuff + o replace weird defines by real code + o udev-test.pl: remove useless tests + o allow unlimitied count of symlinks + o unmap db-file after use + o remove typedef for call_foreach_file() handler function + o correct udev_init_device + o rename attributes to options + o kill stupid gcc4 warning + o trivial clenaup of namedev code + o klibc: check for gcc4 + o klibc: update v0.205 + +Thierry Vignaud: + o gentoo rule update for raid devices + + Summary of changes from v053 to v054 ============================================ diff --git a/Makefile b/Makefile index 556298a9f1..2be255ef27 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 054 +VERSION = 055 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 32aca6196f..3a03099799 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 054 +Version: 055 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 7e3e23925b139075746c015eaffaba509d5eb304 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 17 Mar 2005 00:38:43 +0100 Subject: [PATCH] remove unneeded file from libsysfs --- libsysfs/sysfs_bus.c | 400 --------------------------------------------------- 1 file changed, 400 deletions(-) delete mode 100644 libsysfs/sysfs_bus.c diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c deleted file mode 100644 index d47b94ca24..0000000000 --- a/libsysfs/sysfs_bus.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * sysfs_bus.c - * - * Generic bus utility functions for libsysfs - * - * Copyright (C) IBM Corp. 2003 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include "libsysfs.h" -#include "sysfs.h" - -static void sysfs_close_dev(void *dev) -{ - sysfs_close_device((struct sysfs_device *)dev); -} - -static void sysfs_close_drv(void *drv) -{ - sysfs_close_driver((struct sysfs_driver *)drv); -} - -/* - * compares devices' bus ids. - * @a: device id looking for - * @b: sysfs_device comparing being compared - * returns 1 if a==b->bus_id or 0 not equal - */ -static int bus_device_id_equal(void *a, void *b) -{ - if (a == NULL || b == NULL) - return 0; - - if (strcmp(((char *)a), ((struct sysfs_device *)b)->bus_id) - == 0) - return 1; - return 0; -} - -/* - * compares drivers' names. - * @a: driver name looking for - * @b: sysfs_driver comparing being compared - * returns 1 if a==b->name or 0 not equal - */ -static int bus_driver_name_equal(void *a, void *b) -{ - if (a == NULL || b == NULL) - return 0; - - if (strcmp(((char *)a), ((struct sysfs_driver *)b)->name) == 0) - return 1; - return 0; -} - -/** - * sysfs_close_bus: close single bus - * @bus: bus structure - */ -void sysfs_close_bus(struct sysfs_bus *bus) -{ - if (bus != NULL) { - if (bus->directory != NULL) - sysfs_close_directory(bus->directory); - if (bus->devices) - dlist_destroy(bus->devices); - if (bus->drivers) - dlist_destroy(bus->drivers); - free(bus); - } -} - -/** - * alloc_bus: mallocs new bus structure - * returns sysfs_bus_bus struct or NULL - */ -static struct sysfs_bus *alloc_bus(void) -{ - return (struct sysfs_bus *)calloc(1, sizeof(struct sysfs_bus)); -} - -/** - * sysfs_get_bus_devices: gets all devices for bus - * @bus: bus to get devices for - * returns dlist of devices with success and NULL with failure - */ -struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) -{ - struct sysfs_device *bdev = NULL; - struct sysfs_directory *devdir = NULL; - struct sysfs_link *curl = NULL; - char path[SYSFS_PATH_MAX]; - - if (bus == NULL) { - errno = EINVAL; - return NULL; - } - memset(path, 0, SYSFS_PATH_MAX); - safestrcpy(path, bus->path); - safestrcat(path, "/"); - safestrcat(path, SYSFS_DEVICES_NAME); - devdir = sysfs_open_directory(path); - if (devdir == NULL) - return NULL; - - if (sysfs_read_dir_links(devdir) != 0) { - sysfs_close_directory(devdir); - return NULL; - } - - if (devdir->links != NULL) { - dlist_for_each_data(devdir->links, curl, struct sysfs_link) { - bdev = sysfs_open_device_path(curl->target); - if (bdev == NULL) { - dprintf("Error opening device at %s\n", - curl->target); - continue; - } - if (bus->devices == NULL) - bus->devices = dlist_new_with_delete - (sizeof(struct sysfs_device), - sysfs_close_dev); - dlist_unshift_sorted(bus->devices, bdev, sort_list); - } - } - sysfs_close_directory(devdir); - - return (bus->devices); -} - -/** - * sysfs_get_bus_drivers: get all pci drivers - * @bus: pci bus to add drivers to - * returns dlist of drivers with success and NULL with error - */ -struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) -{ - struct sysfs_driver *driver = NULL; - struct sysfs_directory *drvdir = NULL; - struct sysfs_directory *cursub = NULL; - char path[SYSFS_PATH_MAX]; - - if (bus == NULL) { - errno = EINVAL; - return NULL; - } - memset(path, 0, SYSFS_PATH_MAX); - safestrcpy(path, bus->path); - safestrcat(path, "/"); - safestrcat(path, SYSFS_DRIVERS_NAME); - drvdir = sysfs_open_directory(path); - if (drvdir == NULL) - return NULL; - - if (sysfs_read_dir_subdirs(drvdir) != 0) { - sysfs_close_directory(drvdir); - return NULL; - } - if (drvdir->subdirs != NULL) { - dlist_for_each_data(drvdir->subdirs, cursub, - struct sysfs_directory) { - driver = sysfs_open_driver_path(cursub->path); - if (driver == NULL) { - dprintf("Error opening driver at %s\n", - cursub->path); - continue; - } - if (bus->drivers == NULL) - bus->drivers = dlist_new_with_delete - (sizeof(struct sysfs_driver), - sysfs_close_drv); - dlist_unshift_sorted(bus->drivers, driver, sort_list); - } - } - sysfs_close_directory(drvdir); - return (bus->drivers); -} - -/** - * sysfs_open_bus: opens specific bus and all its devices on system - * returns sysfs_bus structure with success or NULL with error. - */ -struct sysfs_bus *sysfs_open_bus(const char *name) -{ - struct sysfs_bus *bus = NULL; - char buspath[SYSFS_PATH_MAX]; - - if (name == NULL) { - errno = EINVAL; - return NULL; - } - - memset(buspath, 0, SYSFS_PATH_MAX); - if ((sysfs_get_mnt_path(buspath, SYSFS_PATH_MAX)) != 0) { - dprintf("Sysfs not supported on this system\n"); - return NULL; - } - - safestrcat(buspath, "/"); - safestrcat(buspath, SYSFS_BUS_NAME); - safestrcat(buspath, "/"); - safestrcat(buspath, name); - if ((sysfs_path_is_dir(buspath)) != 0) { - dprintf("Invalid path to bus: %s\n", buspath); - return NULL; - } - bus = alloc_bus(); - if (bus == NULL) { - dprintf("calloc failed\n"); - return NULL; - } - safestrcpy(bus->name, name); - safestrcpy(bus->path, buspath); - if ((sysfs_remove_trailing_slash(bus->path)) != 0) { - dprintf("Incorrect path to bus %s\n", bus->path); - sysfs_close_bus(bus); - return NULL; - } - - return bus; -} - -/** - * sysfs_get_bus_device: Get specific device on bus using device's id - * @bus: bus to find device on - * @id: bus_id for device - * returns struct sysfs_device reference or NULL if not found. - */ -struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, char *id) -{ - if (bus == NULL || id == NULL) { - errno = EINVAL; - return NULL; - } - - if (bus->devices == NULL) { - bus->devices = sysfs_get_bus_devices(bus); - if (bus->devices == NULL) - return NULL; - } - - return (struct sysfs_device *)dlist_find_custom(bus->devices, id, - bus_device_id_equal); -} - -/** - * sysfs_get_bus_driver: Get specific driver on bus using driver name - * @bus: bus to find driver on - * @drvname: name of driver - * returns struct sysfs_driver reference or NULL if not found. - */ -struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - char *drvname) -{ - if (bus == NULL || drvname == NULL) { - errno = EINVAL; - return NULL; - } - - if (bus->drivers == NULL) { - bus->drivers = sysfs_get_bus_drivers(bus); - if (bus->drivers == NULL) - return NULL; - } - - return (struct sysfs_driver *)dlist_find_custom(bus->drivers, drvname, - bus_driver_name_equal); -} - -/** - * sysfs_get_bus_attributes: returns bus' dlist of attributes - * @bus: bus to get attributes for. - * returns dlist of attributes or NULL if there aren't any. - */ -struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) -{ - if (bus == NULL) - return NULL; - - if (bus->directory == NULL) { - bus->directory = sysfs_open_directory(bus->path); - if (bus->directory == NULL) - return NULL; - } - if (bus->directory->attributes == NULL) { - if ((sysfs_read_dir_attributes(bus->directory)) != 0) - return NULL; - } - return bus->directory->attributes; -} - -/** - * sysfs_refresh_bus_attributes: refreshes the bus's list of attributes - * @bus: sysfs_bus whose attributes to refresh - * - * NOTE: Upon return, prior references to sysfs_attributes for this bus - * _may_ not be valid - * - * Returns list of attributes on success and NULL on failure - */ -struct dlist *sysfs_refresh_bus_attributes(struct sysfs_bus *bus) -{ - if (bus == NULL) { - errno = EINVAL; - return NULL; - } - - if (bus->directory == NULL) - return (sysfs_get_bus_attributes(bus)); - - if ((sysfs_refresh_dir_attributes(bus->directory)) != 0) { - dprintf("Error refreshing bus attributes\n"); - return NULL; - } - - return (bus->directory->attributes); -} - -/** - * sysfs_get_bus_attribute: gets a specific bus attribute, if buses had - * attributes. - * @bus: bus to retrieve attribute from - * @attrname: attribute name to retrieve - * returns reference to sysfs_attribute if found or NULL if not found - */ -struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, - char *attrname) -{ - struct dlist *attrlist = NULL; - - if (bus == NULL) { - errno = EINVAL; - return NULL; - } - attrlist = sysfs_get_bus_attributes(bus); - if (attrlist == NULL) - return NULL; - - return sysfs_get_directory_attribute(bus->directory, attrname); -} - -/** - * sysfs_find_driver_bus: locates the bus the driver is on. - * @driver: name of the driver to locate - * @busname: buffer to copy name to - * @bsize: buffer size - * returns 0 with success, -1 with error - */ -int sysfs_find_driver_bus(const char *driver, char *busname, size_t bsize) -{ - char subsys[SYSFS_PATH_MAX], *bus = NULL, *curdrv = NULL; - struct dlist *buslist = NULL, *drivers = NULL; - - if (driver == NULL || busname == NULL) { - errno = EINVAL; - return -1; - } - - memset(subsys, 0, SYSFS_PATH_MAX); - safestrcpy(subsys, SYSFS_BUS_NAME); - buslist = sysfs_open_subsystem_list(subsys); - if (buslist != NULL) { - dlist_for_each_data(buslist, bus, char) { - memset(subsys, 0, SYSFS_PATH_MAX); - safestrcpy(subsys, SYSFS_BUS_NAME); - safestrcat(subsys, "/"); - safestrcat(subsys, bus); - safestrcat(subsys, "/"); - safestrcat(subsys, SYSFS_DRIVERS_NAME); - drivers = sysfs_open_subsystem_list(subsys); - if (drivers != NULL) { - dlist_for_each_data(drivers, curdrv, char) { - if (strcmp(driver, curdrv) == 0) { - safestrcpymax(busname, - bus, bsize); - sysfs_close_list(drivers); - sysfs_close_list(buslist); - return 0; - } - } - sysfs_close_list(drivers); - } - } - sysfs_close_list(buslist); - } - return -1; -} -- cgit v1.2.3-54-g00ecf From 67747e1de37158cd58782f432ccba8db55251592 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 17 Mar 2005 09:59:32 +0100 Subject: [PATCH] change call_foreach_file to return a list --- udev_multiplex.c | 16 ++++++++++++---- udev_rules_parse.c | 17 +++++++++++++---- udev_utils.c | 23 +++++------------------ udev_utils.h | 4 ++-- 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/udev_multiplex.c b/udev_multiplex.c index 3ef6e1707a..9ab11e6bea 100644 --- a/udev_multiplex.c +++ b/udev_multiplex.c @@ -74,6 +74,8 @@ static int run_program(struct udevice *udev, const char *filename) void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix) { char dirname[PATH_SIZE]; + struct name_entry *name_loop, *name_tmp; + LIST_HEAD(name_list); /* chop the device name up into pieces based on '/' */ if (udev->name[0] != '\0') { @@ -89,7 +91,7 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c if (strcmp(devname, udev->subsystem) != 0) { snprintf(dirname, sizeof(dirname), "%s/%s", basedir, devname); dirname[sizeof(dirname)-1] = '\0'; - call_foreach_file(run_program, udev, dirname, suffix); + add_matching_files(&name_list, dirname, suffix); } temp[0] = '/'; @@ -101,16 +103,22 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c if (udev->name[0] != '\0') { snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->name); dirname[sizeof(dirname)-1] = '\0'; - call_foreach_file(run_program, udev, dirname, suffix); + add_matching_files(&name_list, dirname, suffix); } if (udev->subsystem[0] != '\0') { snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->subsystem); dirname[sizeof(dirname)-1] = '\0'; - call_foreach_file(run_program, udev, dirname, suffix); + add_matching_files(&name_list, dirname, suffix); } snprintf(dirname, sizeof(dirname), "%s/default", basedir); dirname[sizeof(dirname)-1] = '\0'; - call_foreach_file(run_program, udev, dirname, suffix); + add_matching_files(&name_list, dirname, suffix); + + list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { + run_program(udev, name_loop->name); + list_del(&name_loop->node); + } + } diff --git a/udev_rules_parse.c b/udev_rules_parse.c index face496ab3..55412dba3c 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -168,7 +168,7 @@ static char *get_key_attribute(char *str) return NULL; } -static int rules_parse(struct udevice *udev, const char *filename) +static int rules_parse(const char *filename) { char line[LINE_SIZE]; char *bufline; @@ -446,9 +446,18 @@ int udev_rules_init(void) return -1; if ((stats.st_mode & S_IFMT) != S_IFDIR) - retval = rules_parse(NULL, udev_rules_filename); - else - retval = call_foreach_file(rules_parse, NULL, udev_rules_filename, RULEFILE_SUFFIX); + retval = rules_parse(udev_rules_filename); + else { + struct name_entry *name_loop, *name_tmp; + LIST_HEAD(name_list); + + retval = add_matching_files(&name_list, udev_rules_filename, RULEFILE_SUFFIX); + + list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { + rules_parse(name_loop->name); + list_del(&name_loop->node); + } + } return retval; } diff --git a/udev_utils.c b/udev_utils.c index c6658e6933..2b5683fda6 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -265,15 +265,12 @@ int name_list_add(struct list_head *name_list, const char *name, int sort) } /* calls function for every file found in specified directory */ -int call_foreach_file(int (*handler_function)(struct udevice *udev, const char *string), - struct udevice *udev, const char *dirname, const char *suffix) +int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix) { struct dirent *ent; DIR *dir; char *ext; - struct name_entry *loop_file; - struct name_entry *tmp_file; - LIST_HEAD(file_list); + char filename[PATH_SIZE]; dbg("open directory '%s'", dirname); dir = opendir(dirname); @@ -290,7 +287,7 @@ int call_foreach_file(int (*handler_function)(struct udevice *udev, const char * if ((ent->d_name[0] == '.') || (ent->d_name[0] == COMMENT_CHARACTER)) continue; - /* look for file with specified suffix */ + /* look for file matching with specified suffix */ ext = strrchr(ent->d_name, '.'); if (ext == NULL) continue; @@ -299,20 +296,10 @@ int call_foreach_file(int (*handler_function)(struct udevice *udev, const char * continue; dbg("put file '%s/%s' in list", dirname, ent->d_name); - name_list_add(&file_list, ent->d_name, 1); - } - - /* call function for every file in the list */ - list_for_each_entry_safe(loop_file, tmp_file, &file_list, node) { - char filename[PATH_SIZE]; - snprintf(filename, sizeof(filename), "%s/%s", dirname, loop_file->name); + snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); filename[sizeof(filename)-1] = '\0'; - - handler_function(udev, filename); - - list_del(&loop_file->node); - free(loop_file); + name_list_add(name_list, filename, 1); } closedir(dir); diff --git a/udev_utils.h b/udev_utils.h index c7a41aaa44..b45500dcff 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -41,6 +41,6 @@ extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); extern void no_trailing_slash(char *path); extern int name_list_add(struct list_head *name_list, const char *name, int sort); -extern int call_foreach_file(int (*handler_function)(struct udevice *udev, const char *string), - struct udevice *udev, const char *dirname, const char *suffix); +extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); + #endif -- cgit v1.2.3-54-g00ecf From 92ebb398ed004348d5f92a242f323fb25dc7d6e5 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 17 Mar 2005 11:02:53 +0100 Subject: [PATCH] klibc: use klcc wrapper instead of our own Makefile --- Makefile | 91 +++++++++++++++++++---------------------------- extras/volume_id/Makefile | 4 +-- 2 files changed, 38 insertions(+), 57 deletions(-) diff --git a/Makefile b/Makefile index 2be255ef27..63d33d36ec 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,7 @@ STRIP = $(CROSS)strip RANLIB = $(CROSS)ranlib HOSTCC = gcc -export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS ARCH_LIB_OBJS CRT0 +export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS # code taken from uClibc to determine the current arch ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ @@ -108,11 +108,11 @@ OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2> # check if compiler option is supported cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} -WARNINGS := -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith -Wstrict-prototypes -Wsign-compare -WARNINGS += $(call cc-supports,-Wno-pointer-sign) -WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) - -CFLAGS := -pipe +CFLAGS += -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith -Wstrict-prototypes -Wsign-compare +CFLAGS += $(call cc-supports,-Wno-pointer-sign) +CFLAGS += $(call cc-supports,-Wdeclaration-after-statement) +CFLAGS += -pipe +CFLAGS += -D_GNU_SOURCE HEADERS = \ udev.h \ @@ -161,42 +161,25 @@ endif # if DEBUG is enabled, then we do not strip or optimize ifeq ($(strip $(DEBUG)),true) - CFLAGS += -O1 -g -DDEBUG -D_GNU_SOURCE - LDFLAGS += -Wl,-warn-common + CFLAGS += -O1 -g -DDEBUG + LDFLAGS += -Wl STRIPCMD = /bin/true -Since_we_are_debugging else - CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer -D_GNU_SOURCE - LDFLAGS += -s -Wl,-warn-common + CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer + LDFLAGS += -s -Wl STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment endif # If we are using our version of klibc, then we need to build, link it, and then # link udev against it statically. Otherwise, use glibc and link dynamically. ifeq ($(strip $(USE_KLIBC)),true) - KLIBC_BASE = $(PWD)/klibc - KLIBC_DIR = $(KLIBC_BASE)/klibc - INCLUDE_DIR := $(KLIBC_BASE)/include - LINUX_INCLUDE_DIR := $(KERNEL_DIR)/include - include $(KLIBC_DIR)/arch/$(ARCH)/MCONFIG - ARCH_LIB_OBJS = $(KLIBC_DIR)/libc.a - CRT0 = $(KLIBC_DIR)/crt0.o - LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0) - CFLAGS += $(WARNINGS) -nostdinc \ - $(OPTFLAGS) $(REQFLAGS) \ - -D__KLIBC__ -fno-builtin-printf \ - -I$(INCLUDE_DIR) \ - -I$(INCLUDE_DIR)/arch/$(ARCH) \ - -I$(INCLUDE_DIR)/bits$(BITSIZE) \ - -I$(GCCINCDIR) \ - -I$(LINUX_INCLUDE_DIR) - LIB_OBJS = - LDFLAGS = -static -nostdlib -nostartfiles -nodefaultlibs + KLIBC_INSTALL = $(PWD)/klibc/.install + KLCC = $(KLIBC_INSTALL)/bin/klcc + CC = $(KLCC) + LD = $(KLCC) + LDFLAGS += -static else - WARNINGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations - CRT0 = - LIBC = - CFLAGS += $(WARNINGS) -I$(GCCINCDIR) - LIB_OBJS = -lc + CFLAGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations endif ifeq ($(strip $(USE_SELINUX)),true) @@ -221,7 +204,7 @@ endif # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf -all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) +all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -232,13 +215,12 @@ all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) -C $$target $@ ; \ done ; \ -$(ARCH_LIB_OBJS) : $(CRT0) - -$(CRT0): - @if [ ! -r klibc/linux ]; then \ - ln -f -s $(KERNEL_DIR) klibc/linux; \ - fi - $(MAKE) -C klibc SUBDIRS=klibc TESTS= +$(KLCC): + $(MAKE) -C klibc KRNLSRC=$(KERNEL_DIR) SUBDIRS=klibc TESTS= \ + SHLIBDIR=$(KLIBC_INSTALL)/lib \ + INSTALLDIR=$(KLIBC_INSTALL) \ + bindir=$(KLIBC_INSTALL)/bin \ + mandir=$(KLIBC_INSTALL)/man all install udev.a: $(UDEV_OBJS) rm -f $@ @@ -290,34 +272,33 @@ $(DAEMON).o: $(GEN_HEADERS) $(HOST_PROGS) $(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) -$(ROOT): $(LIBC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(ROOT).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(ROOT): $(KLCC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(ROOT).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ -$(TESTER): $(LIBC) $(TESTER).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(TESTER).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(TESTER): $(KLCC) $(TESTER).o $(OBJS) $(HEADERS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(TESTER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ -$(INFO): $(LIBC) $(INFO).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(INFO).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(INFO): $(KLCC) $(INFO).o $(OBJS) $(HEADERS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(INFO).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ -$(DAEMON): $(LIBC) $(DAEMON).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(DAEMON).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(DAEMON): $(KLCC) $(DAEMON).o $(OBJS) udevd.h + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(DAEMON).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ -$(SENDER): $(LIBC) $(SENDER).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(SENDER).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(SENDER): $(KLCC) $(SENDER).o $(OBJS) udevd.h + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(SENDER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ -$(STARTER): $(LIBC) $(STARTER).o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CRT0) $(STARTER).o $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) +$(STARTER): $(KLCC) $(STARTER).o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(STARTER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ .c.o: $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< - clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f @@ -333,7 +314,7 @@ clean: spotless: clean $(MAKE) -C klibc SUBDIRS=klibc spotless - -rm -f klibc/linux + rm -rf klibc/.install DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz" -e "\/\." -e releases -e BitKeeper -e SCCS -e test/sys | sort ) DISTDIR := $(RELEASE_NAME) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index efec58f80e..91527cc9f5 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -28,7 +28,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE +override CFLAGS+=-D_FILE_OFFSET_BITS=64 VOLUME_ID_BASE=volume_id include $(VOLUME_ID_BASE)/Makefile.inc @@ -42,7 +42,7 @@ $(OBJS): $(HEADERS) $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< $(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) clean: rm -f $(PROG) $(OBJS) -- cgit v1.2.3-54-g00ecf From 7f7ae03a6290ccc1e4ca57416fe871dae4b865d2 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Thu, 17 Mar 2005 11:51:37 +0100 Subject: [PATCH] udevd: don't delay events with TIMEOUT in the environment On Tue, 2005-03-15 at 09:25 +0100, Hannes Reinecke wrote: > The current implementation of the firmware class breaks a fundamental > assumption in udevd: that the physical device can be initialised fully > prior to executing the next event for that device. Thanks to Hannes for the patch. --- RELEASE-NOTES | 6 ++++++ udevd.c | 15 +++++++++++++++ udevd.h | 1 + 3 files changed, 22 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0bddab4189..2defd7117b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,9 @@ +udev 056 +======== +Possible use of a system-wide klibc: + make USE_KLIB=true KLCC=/usr/bin/klcc all +will link against an external klibc and our own version will be ignored. + udev 055 ======== We support an unlimited count of symlinks now. diff --git a/udevd.c b/udevd.c index 2cd3622ce0..6e27c8a0d1 100644 --- a/udevd.c +++ b/udevd.c @@ -113,6 +113,14 @@ static void msg_queue_insert(struct hotplug_msg *msg) return; } + /* don't delay messages with timeout set */ + if (msg->timeout) { + dbg("move seq %llu with timeout %u to exec queue", msg->seqnum, msg->timeout); + list_add(&msg->node, &exec_list); + run_exec_q = 1; + return; + } + /* sort message by sequence number into list */ list_for_each_entry_reverse(loop_msg, &msg_list, node) { if (loop_msg->seqnum < msg->seqnum) @@ -293,6 +301,10 @@ static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) if (msg->devpath == NULL) return NULL; + /* skip any events with a timeout set */ + if (msg->timeout) + return NULL; + list_for_each_entry(loop_msg, &running_list, node) { if (loop_msg->devpath == NULL) continue; @@ -490,6 +502,9 @@ static struct hotplug_msg *get_udevsend_msg(void) if (strncmp(key, "PHYSDEVPATH=", 12) == 0) msg->physdevpath = &key[12]; + + if (strncmp(key, "TIMEOUT=", 8) == 0) + msg->timeout = strtoull(&key[8], NULL, 10); } msg->envp[i++] = "UDEVD_EVENT=1"; msg->envp[i] = NULL; diff --git a/udevd.h b/udevd.h index 64e1d6ad12..b3e998b04c 100644 --- a/udevd.h +++ b/udevd.h @@ -60,6 +60,7 @@ struct hotplug_msg { char *subsystem; unsigned long long seqnum; char *physdevpath; + unsigned int timeout; char *envp[HOTPLUG_NUM_ENVP+1]; char envbuf[]; }; -- cgit v1.2.3-54-g00ecf From a5b9e2994a6d34cb169eaa0e2cf16d0a7c4f197a Mon Sep 17 00:00:00 2001 From: "tklauser@access.unizh.ch" Date: Fri, 18 Mar 2005 09:27:31 +0100 Subject: [PATCH] fix header paths in udev_libc_wrapper.c In udev_libc_wrapper.c the paths to the local header files are wrong. The attached patch fixes this. --- udev_libc_wrapper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index 0dafe4d077..4b39b6f476 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -27,10 +27,10 @@ #include #include -#include "../udev_libc_wrapper.h" -#include "../udev.h" -#include "../udev_utils.h" -#include "../logging.h" +#include "udev_libc_wrapper.h" +#include "udev.h" +#include "udev_utils.h" +#include "logging.h" #ifdef __KLIBC__ #define __OWN_USERDB_PARSER__ -- cgit v1.2.3-54-g00ecf From 68c2c0b5b1dedfe0fd3346560999791efdf48c25 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 18 Mar 2005 10:00:25 +0100 Subject: [PATCH] fix bad typo that prevents the GROUP to be applied Thanks to Jim Gifford for catching it. --- udev_add.c | 2 +- udev_libc_wrapper.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_add.c b/udev_add.c index 8443f65e7c..15c6bf9fbc 100644 --- a/udev_add.c +++ b/udev_add.c @@ -150,7 +150,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de if (endptr[0] == '\0') gid = (gid_t) id; else - gid = lookup_user(udev->group); + gid = lookup_group(udev->group); } if (!udev->test_run) { diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index 4b39b6f476..16d90913cf 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -140,7 +140,7 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) dbg("can't open '%s' as db file", dbfile); return 0; } - dbg("reading '%s' as db file", dbfile); + dbg("search '%s' in '%s'", uname, dbfile); /* loop through the whole file */ cur = 0; -- cgit v1.2.3-54-g00ecf From 9b434de102c8d4f74842bc6533c92cb3a4887d8d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 18 Mar 2005 23:52:41 +0100 Subject: [PATCH] udev-test.pl: add check for textual uid/gid --- test/udev-test.pl | 87 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 24 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 2ece431735..0f010991ac 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -553,6 +553,26 @@ EOF exp_perms => ":100:0660", conf => < "textual user id", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + exp_perms => "adm::0660", + conf => < "textual group id", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + exp_perms => ":daemon:0660", + conf => <{exp_perms} =~ m/^(.*):(.*):(.*)$/; if ($1 ne "") { - if ($uid != $1) { $wrong = 1; }; + if (defined(getpwnam($1))) { + $userid = int(getpwnam($1)); + } else { + $userid = $1; + } + if ($uid != $userid) { $wrong = 1; } } if ($2 ne "") { - if ($gid != $2) { $wrong = 1; }; + if (defined(getgrnam($2))) { + $groupid = int(getgrnam($2)); + } else { + $groupid = $2; + } + if ($gid != $groupid) { $wrong = 1; } } if ($3 ne "") { if (($mode & 07777) != oct($3)) { $wrong = 1; }; } if ($wrong == 0) { - print "permissions: ok "; + print "permissions: ok\n"; } else { - printf "expected permissions are: %i:%i:%#o\n", $1, $2, oct($3); - printf "created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; + printf " expected permissions are: %s:%s:%#o\n", $1, $2, oct($3); + printf " created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; + print "permissions: error\n"; $error++; } } @@ -1249,11 +1283,11 @@ sub major_minor_test { if ($minor != $2) { $wrong = 1; }; } if ($wrong == 0) { - print "major:minor: ok "; + print "major:minor: ok\n"; } else { - printf "expected major:minor is: %i:%i\n", $1, $2; - printf "created major:minor is : %i:%i\n", $major, $minor; - print "major:minor: error "; + printf " expected major:minor is: %i:%i\n", $1, $2; + printf " created major:minor is : %i:%i\n", $major, $minor; + print "major:minor: error\n"; $error++; } } @@ -1265,22 +1299,25 @@ sub symlink_test { if ($output =~ m/(.*)-> (.*)/) { if ($2 eq $config->{exp_target}) { - print "symlink: ok "; + print "symlink: ok\n"; } else { - print "expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; - print "created symlink from: \'$config->{exp_name}\' to \'$2\'\n"; + print " expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; + print " created symlink from: \'$config->{exp_name}\' to \'$2\'\n"; + print "symlink: error"; if ($config->{exp_add_error}) { - print "as expected "; + print " as expected\n"; } else { + print "\n"; $error++; } } } else { - print "expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; - print "symlink: not created "; + print " expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; + print "symlink: not created"; if ($config->{exp_add_error}) { - print "as expected "; + print " as expected\n"; } else { + print "\n"; $error++; } } @@ -1314,13 +1351,13 @@ sub run_test { if (defined($config->{exp_target})) { symlink_test($config); } - print "add: ok "; + print "add: ok\n"; } else { - print "add: error "; + print "add: error"; if ($config->{exp_add_error}) { - print "as expected "; + print " as expected\n"; } else { - print "\n\n"; + print "\n"; system("tree $udev_root"); print "\n"; $error++; @@ -1335,19 +1372,21 @@ sub run_test { udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf}); if ((-e "$PWD/$udev_root$config->{exp_name}") || (-l "$PWD/$udev_root$config->{exp_name}")) { - print "remove: error "; + print "remove: error"; if ($config->{exp_rem_error}) { - print "as expected\n\n"; + print " as expected\n"; } else { - print "\n\n"; + print "\n"; system("tree $udev_root"); print "\n"; $error++; } } else { - print "remove: ok\n\n"; + print "remove: ok\n"; } + print "\n"; + if (defined($config->{option}) && $config->{option} eq "clear") { system("rm -rf $udev_db"); system("rm -rf $udev_root"); -- cgit v1.2.3-54-g00ecf From c827876312bde7809f5f08b89b9223391da0e3b4 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 19 Mar 2005 01:45:03 +0100 Subject: [PATCH] udev-test.pl: add a test where the group cannot be found in /etc/passwd --- test/udev-test.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 0f010991ac..11d1d2877b 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -573,6 +573,16 @@ EOF exp_perms => ":daemon:0660", conf => < "textual user/group id", + subsys => "block", + devpath => "/block/sda", + exp_name => "node", + exp_perms => "root:wheel:0660", + conf => < Date: Sat, 19 Mar 2005 02:15:43 +0100 Subject: [PATCH] klibc: remove SCCS directories from the temporary klibc install --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 63d33d36ec..97d20b2146 100644 --- a/Makefile +++ b/Makefile @@ -221,6 +221,7 @@ $(KLCC): INSTALLDIR=$(KLIBC_INSTALL) \ bindir=$(KLIBC_INSTALL)/bin \ mandir=$(KLIBC_INSTALL)/man all install + -find $(KLIBC_INSTALL)/include -name SCCS -print| xargs rm -rf udev.a: $(UDEV_OBJS) rm -f $@ -- cgit v1.2.3-54-g00ecf From 0bb438770742815c5839f3fbf1aca967fa6e4a15 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 19 Mar 2005 03:11:48 +0100 Subject: [PATCH] udev-test.pl: use more common user/group names --- test/udev-test.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 11d1d2877b..6cde54ffab 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -560,9 +560,9 @@ EOF subsys => "block", devpath => "/block/sda", exp_name => "node", - exp_perms => "adm::0660", + exp_perms => "nobody::0660", conf => < "block", devpath => "/block/sda", exp_name => "node", - exp_perms => "root:wheel:0660", + exp_perms => "root:mail:0660", conf => < Date: Sat, 19 Mar 2005 07:39:19 -0800 Subject: [PATCH] 056 release --- ChangeLog | 17 +++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c1ee1f889..c7d7269400 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Summary of changes from v055 to v056 +============================================ + +: + o fix header paths in udev_libc_wrapper.c + +Kay Sievers: + o udev-test.pl: use more common user/group names + o klibc: remove SCCS directories from the temporary klibc install + o udev-test.pl: add a test where the group cannot be found in /etc/passwd + o udev-test.pl: add check for textual uid/gid + o fix bad typo that prevents the GROUP to be applied + o udevd: don't delay events with TIMEOUT in the environment + o klibc: use klcc wrapper instead of our own Makefile + o change call_foreach_file to return a list + + Summary of changes from v054 to v055 ============================================ diff --git a/Makefile b/Makefile index 97d20b2146..1424cf0315 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 055 +VERSION = 056 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index 3a03099799..a9d1c5fb22 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 055 +Version: 056 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 93ca11e4be8f4414f09ba60d9d8c77ec8ff2ec3b Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 27 Mar 2005 00:09:05 +0100 Subject: [PATCH] libsysfs: remove trailing slash on SYSFS_PATH override --- libsysfs/sysfs/libsysfs.h | 6 +++--- libsysfs/sysfs_utils.c | 15 ++++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/libsysfs/sysfs/libsysfs.h b/libsysfs/sysfs/libsysfs.h index 6140c3aecb..2f122405d7 100644 --- a/libsysfs/sysfs/libsysfs.h +++ b/libsysfs/sysfs/libsysfs.h @@ -43,14 +43,14 @@ #define SYSFS_NAME_LEN 64 #define SYSFS_BUS_ID_SIZE 32 +/* mount path for sysfs, can be overridden by exporting SYSFS_PATH */ +#define SYSFS_MNT_PATH "/sys" + enum sysfs_attribute_method { SYSFS_METHOD_SHOW = 0x01, /* attr can be read by user */ SYSFS_METHOD_STORE = 0x02, /* attr can be changed by user */ }; -/* NOTE: statically define mnt path for sysfs */ -#define SYSFS_MNT_PATH "/sys" - /* * NOTE: * 1. We have the statically allocated "name" as the first element of all diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 9f6e18f665..210c2a086d 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -30,20 +30,16 @@ */ int sysfs_remove_trailing_slash(char *path) { - char *c = NULL; + size_t len; if (!path) { errno = EINVAL; return 1; } - c = strrchr(path, '/'); - if (c == NULL) { - dprintf("Invalid path %s\n", path); - errno = EINVAL; - return 1; - } - if (*(c+1) == '\0') - *c = '\0'; + + len = strlen(path); + while (len > 0 && path[len-1] == '/') + path[--len] = '\0'; return 0; } @@ -64,6 +60,7 @@ int sysfs_get_mnt_path(char *mnt_path, size_t len) sysfs_path_env = getenv(SYSFS_PATH_ENV); if (sysfs_path_env != NULL) { safestrcpymax(mnt_path, sysfs_path_env, len); + sysfs_remove_trailing_slash(mnt_path); return 0; } safestrcpymax(mnt_path, SYSFS_MNT_PATH, len); -- cgit v1.2.3-54-g00ecf From 65005a7f81f86590f7f03bd3d4019c485d0e3c77 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 27 Mar 2005 00:10:03 +0100 Subject: [PATCH] test-suite: remove UDEV_TEST, it's not needed anymore --- test/devd_test | 1 - test/net_test | 1 - test/replace_test | 1 - test/udev-test.pl | 354 ++++++++++++++++++++++++------------------------- test/udevstart-test.pl | 31 +++-- udev_config.c | 18 +-- 6 files changed, 199 insertions(+), 207 deletions(-) diff --git a/test/devd_test b/test/devd_test index 269c2b11da..534e787f24 100644 --- a/test/devd_test +++ b/test/devd_test @@ -3,7 +3,6 @@ RULES=label_test.rules CONFIG=label_test.conf -export UDEV_TEST=yes export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG diff --git a/test/net_test b/test/net_test index 9686f99258..9daf8da082 100644 --- a/test/net_test +++ b/test/net_test @@ -3,7 +3,6 @@ RULES=label_test.rules CONFIG=label_test.conf -export UDEV_TEST=yes export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG diff --git a/test/replace_test b/test/replace_test index 19260765ba..6e01f28ed5 100644 --- a/test/replace_test +++ b/test/replace_test @@ -3,7 +3,6 @@ RULES=replace_test.rules CONFIG=replace_test.conf -export UDEV_TEST=yes export SYSFS_PATH=$PWD/sys/ export UDEV_CONFIG_FILE=$PWD/$CONFIG diff --git a/test/udev-test.pl b/test/udev-test.pl index 6cde54ffab..50ea5858a4 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -9,7 +9,7 @@ # Every test is driven by its own temporary config file. # This program prepares the environment, creates the config and calls udev. # -# udev reads the config, looks at the provided sysfs and +# udev parses the rules, looks at the provided sysfs and # first creates and then removes the device node. # After creation and removal the result is checked against the # expected value and the result is printed. @@ -20,13 +20,13 @@ use warnings; use strict; -my $PWD = $ENV{PWD}; -my $sysfs = "sys/"; -my $udev_bin = "../udev"; -my $udev_root = "udev-root/"; # !!! directory will be removed !!! -my $udev_db = ".udevdb"; -my $main_conf = "udev-test.conf"; -my $conf_tmp = "udev-test.rules"; +my $PWD = $ENV{PWD}; +my $sysfs = "sys/"; +my $udev_bin = "../udev"; +my $udev_root = "udev-root/"; # !!! directory will be removed !!! +my $udev_db = ".udevdb"; +my $udev_conf = "udev-test.conf"; +my $udev_rules = "udev-test.rules"; # uncomment following line to run udev with valgrind. # Should make this a runtime option to the script someday... @@ -38,7 +38,7 @@ my @tests = ( subsys => "block", devpath => "/block/sda", exp_name => "boot_disk" , - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "boot_disk1" , - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "boot_disk1" , - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "boot_disk1" , - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "boot_disk1" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor/0" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor/0" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor/0" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor/0" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "whitespace" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "aaa", - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "sub/direct/ory/visor" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "first_disk3" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "M8-m3-n3-b0:0-sIBM" , - conf => < < "block", devpath => "/block/sda", exp_name => "disk-IBM-ESXS-sda" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "special-device-3" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "subsys_block" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "newline_removed" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "test-0:0:0:0" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "escape-3" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "foo9" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "bar9" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "foo7" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "my-foo9" , - conf => < < "block", devpath => "/block/sda/sda3", exp_name => "my-foo8" , - conf => < < "tty", devpath => "/class/tty/console", exp_name => "TTY" , - conf => < < "tty", devpath => "/class/tty/console", exp_name => "foo" , - conf => < < "tty", devpath => "/class/tty/console", exp_name => "TTY" , - conf => < < "tty", devpath => "/class/tty/console", exp_name => "foo" , - conf => < < "block", devpath => "/block/sda", exp_name => "scsi-0:0:0:0" , - conf => < < "block", devpath => "/block/sda", exp_name => "boot_disk15" , - conf => < < "tty", devpath => "/class/tty/ttyUSB0", exp_name => "visor" , - conf => < < "block", devpath => "/block/rd!c0d0", exp_name => "rd/c0d0" , - conf => < < "block", devpath => "/block/rd!c0d0", exp_name => "rd/c0d0" , - conf => < < "block", devpath => "/block/cciss!c0d0/cciss!c0d0p1", exp_name => "cciss/c0d0p1" , - conf => < < "block", devpath => "/block/sda", exp_name => "scsi-0:0:0:0", - conf => < < "block", devpath => "/block/sda", exp_name => "scsi-0:0:0:0", - conf => < < "block", devpath => "/block/sda", exp_name => "scsi-0:0:0:0", - conf => < < "block", devpath => "/block/sda", exp_name => "scsi-0:0:0:0", - conf => < < "block", devpath => "/block/sda", exp_name => "ignored", - conf => < < "block", devpath => "/block/sda", exp_name => "matched-with-space", - conf => < < "/class/tty/tty33", exp_name => "tty33", exp_perms => "0:0:0660", - conf => < < "/block/sda", exp_name => "node", exp_perms => "5000::0660", - conf => < < "/block/sda", exp_name => "node", exp_perms => ":100:0660", - conf => < < "/block/sda", exp_name => "node", exp_perms => "nobody::0660", - conf => < < "/block/sda", exp_name => "node", exp_perms => ":daemon:0660", - conf => < < "/block/sda", exp_name => "node", exp_perms => "root:mail:0660", - conf => < < "/block/sda", exp_name => "node", exp_perms => "::0777", - conf => < < "/block/sda", exp_name => "node", exp_perms => "5000:100:0777", - conf => < < "/class/tty/ttyUSB0", exp_name => "ttyUSB0", exp_perms => "5000::", - conf => < < "/class/tty/ttyUSB0", exp_name => "ttyUSB0", exp_perms => ":100:0660", - conf => < < "/class/tty/ttyUSB0", exp_name => "ttyUSB0", exp_perms => "::0060", - conf => < < "/class/tty/ttyUSB0", exp_name => "ttyUSB0", exp_perms => "5000:100:0777", - conf => < < "/class/tty/ttyUSB0", exp_name => "ttyUSB0", exp_perms => "5000:100:0777", - conf => < < "/class/tty/ttyUSB0", exp_name => "ttyUSB0", exp_perms => "3000:4000:0777", - conf => < < "/class/tty/ttyUSB0", exp_name => "ttyUSB0", exp_perms => "3000:8000:0777", - conf => < < "/block/sda", exp_name => "node", exp_majorminor => "8:0", - conf => < < "/class/i2c-dev/i2c-300", exp_name => "node", exp_majorminor => "89:300", - conf => < < "/class/i2c-dev/i2c-fake1", exp_name => "node", exp_majorminor => "4095:1", - conf => < < "/class/i2c-dev/i2c-fake2", exp_name => "node", exp_majorminor => "4094:89999", - conf => < < "/class/tty/ttyUSB0", exp_name => "symlink2-ttyUSB0", exp_target => "ttyUSB0", - conf => < < "/class/tty/ttyUSB0", exp_name => "visor0", exp_target => "ttyUSB0", - conf => < < "/block/sda/sda2", exp_name => "1/2/symlink" , exp_target => "a/b/node", - conf => < < "/block/sda/sda2", exp_name => "1/2/c/d/symlink" , exp_target => "../../a/b/node", - conf => < < "/class/tty/ttyUSB0", exp_name => "second-0" , exp_target => "visor" , - conf => < < "/block/sda", exp_name => "symlink-only2", exp_target => "link", - conf => < < "link", exp_add_error => "yes", exp_rem_error => "yes", - conf => < < "link", exp_rem_error => "yes", option => "clear", - conf => < < "/class/tty/ttyUSB0", exp_name => "symlink0", exp_target => "ttyUSB0", - conf => < < "/class/tty/ttyUSB0", exp_name => "symlink-ttyUSB0", exp_target => "ttyUSB0", - conf => < < "/class/tty/ttyUSB0", exp_name => "major-188:0", exp_target => "ttyUSB0", - conf => < < "/block/sda", exp_name => "symlink-0:0:0:0", exp_target => "node", - conf => < < "/class/tty/ttyUSB0", exp_name => "test", exp_target => "ttyUSB0", - conf => < < "/class/tty/ttyUSB0", exp_name => "test", exp_target => "ttyUSB0", - conf => < < "/class/tty/ttyUSB0", exp_name => "this", exp_target => "ttyUSB0", - conf => < < "/block/sda", exp_name => "test", exp_target => "link", - conf => < < "/class/tty/ttyUSB0", exp_name => "188:0", exp_target => "ttyUSB0", - conf => < < "/class/tty/ttyUSB0", exp_name => "188", exp_target => "ttyUSB0", - conf => < < "/class/tty/ttyUSB0", exp_name => "percent%sign", exp_target => "ttyUSB0", - conf => < < "/class/tty/ttyUSB0", exp_name => "%ttyUSB0_name", exp_target => "ttyUSB0", - conf => < < "/block/sda/sda3", exp_name => "link1", exp_target => "node", - conf => < < "/block/sda/sda3", exp_name => "link4", exp_target => "node", - conf => < < "block", devpath => "/block/sda", exp_name => "cdrom", - conf => < < "/block/sda", exp_name => "cdrom", option => "keep", - conf => < < "/block/sda/sda1", exp_name => "enum", option => "keep", - conf => < < "/block/sda/sda2", exp_name => "cdrom1", option => "keep", - conf => < < "/block/sda/sda3", exp_name => "enum1", option => "keep", - conf => < < "/block/sda/sda4", exp_name => "cdrom2", option => "clear", - conf => < < "block", devpath => "/block/sda", exp_name => "cdrom", - conf => < < "/block/sda", exp_name => "node", exp_add_error => "yes", - conf => < < "block", devpath => "/block/sda", exp_name => "node6", - conf => < < "/block/sda/sda1", exp_name => "node6", exp_add_error => "yes", - conf => < < "/block/sda", exp_name => "node", exp_rem_error => "yes", - conf => < < "node14", exp_rem_error => "yes", option => "clear", - conf => < < "block", devpath => "/block/sda", exp_name => "node", - conf => < < "block", devpath => "/block/sda", exp_name => "node", - conf => < < "block", devpath => "/block/sda", exp_name => "node", - conf => < < "block", devpath => "/block/sda", exp_name => "sda", - conf => < < "/block/sda", exp_name => "main_device", option => "keep", - conf => < < "/block/sda/sda1", exp_name => "main_device-part-1", option => "clean", - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "start-udev-root-end", - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "last", - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "match", - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "not-anything", - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "nonzero-program", - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "true", - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "true", - conf => < < "block", devpath => "/block/sda/sda1", exp_name => "true", - conf => < <$conf_tmp" || die "unable to create config file: $conf_tmp"; - print CONF $$config; + # create temporary rules + open CONF, ">$udev_rules" || die "unable to create rules file: $udev_rules"; + print CONF $$rules; close CONF; $ENV{ACTION} = $action; @@ -1242,13 +1242,13 @@ sub udev { my $error = 0; sub permissions_test { - my($config, $uid, $gid, $mode) = @_; + my($rules, $uid, $gid, $mode) = @_; my $wrong = 0; my $userid; my $groupid; - $config->{exp_perms} =~ m/^(.*):(.*):(.*)$/; + $rules->{exp_perms} =~ m/^(.*):(.*):(.*)$/; if ($1 ne "") { if (defined(getpwnam($1))) { $userid = int(getpwnam($1)); @@ -1279,13 +1279,13 @@ sub permissions_test { } sub major_minor_test { - my($config, $rdev) = @_; + my($rules, $rdev) = @_; my $major = ($rdev >> 8) & 0xfff; my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); my $wrong = 0; - $config->{exp_majorminor} =~ m/^(.*):(.*)$/; + $rules->{exp_majorminor} =~ m/^(.*):(.*)$/; if ($1 ne "") { if ($major != $1) { $wrong = 1; }; } @@ -1303,18 +1303,18 @@ sub major_minor_test { } sub symlink_test { - my ($config) = @_; + my ($rules) = @_; - my $output = `ls -l $PWD/$udev_root$config->{exp_name}`; + my $output = `ls -l $PWD/$udev_root$rules->{exp_name}`; if ($output =~ m/(.*)-> (.*)/) { - if ($2 eq $config->{exp_target}) { + if ($2 eq $rules->{exp_target}) { print "symlink: ok\n"; } else { - print " expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; - print " created symlink from: \'$config->{exp_name}\' to \'$2\'\n"; + print " expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n"; + print " created symlink from: \'$rules->{exp_name}\' to \'$2\'\n"; print "symlink: error"; - if ($config->{exp_add_error}) { + if ($rules->{exp_add_error}) { print " as expected\n"; } else { print "\n"; @@ -1322,9 +1322,9 @@ sub symlink_test { } } } else { - print " expected symlink from: \'$config->{exp_name}\' to \'$config->{exp_target}\'\n"; + print " expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n"; print "symlink: not created"; - if ($config->{exp_add_error}) { + if ($rules->{exp_add_error}) { print " as expected\n"; } else { print "\n"; @@ -1334,37 +1334,37 @@ sub symlink_test { } sub run_test { - my ($config, $number) = @_; + my ($rules, $number) = @_; - print "TEST $number: $config->{desc}\n"; + print "TEST $number: $rules->{desc}\n"; - if ($config->{exp_target}) { - print "device \'$config->{devpath}\' expecting symlink '$config->{exp_name}' to node \'$config->{exp_target}\'\n"; + if ($rules->{exp_target}) { + print "device \'$rules->{devpath}\' expecting symlink '$rules->{exp_name}' to node \'$rules->{exp_target}\'\n"; } else { - print "device \'$config->{devpath}\' expecting node \'$config->{exp_name}\'\n"; + print "device \'$rules->{devpath}\' expecting node \'$rules->{exp_name}\'\n"; } - udev("add", $config->{subsys}, $config->{devpath}, \$config->{conf}); - if ((-e "$PWD/$udev_root$config->{exp_name}") || - (-l "$PWD/$udev_root$config->{exp_name}")) { + udev("add", $rules->{subsys}, $rules->{devpath}, \$rules->{rules}); + if ((-e "$PWD/$udev_root$rules->{exp_name}") || + (-l "$PWD/$udev_root$rules->{exp_name}")) { my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, - $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$config->{exp_name}"); + $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$rules->{exp_name}"); - if (defined($config->{exp_perms})) { - permissions_test($config, $uid, $gid, $mode); + if (defined($rules->{exp_perms})) { + permissions_test($rules, $uid, $gid, $mode); } - if (defined($config->{exp_majorminor})) { - major_minor_test($config, $rdev); + if (defined($rules->{exp_majorminor})) { + major_minor_test($rules, $rdev); } - if (defined($config->{exp_target})) { - symlink_test($config); + if (defined($rules->{exp_target})) { + symlink_test($rules); } print "add: ok\n"; } else { print "add: error"; - if ($config->{exp_add_error}) { + if ($rules->{exp_add_error}) { print " as expected\n"; } else { print "\n"; @@ -1374,16 +1374,16 @@ sub run_test { } } - if (defined($config->{option}) && $config->{option} eq "keep") { + if (defined($rules->{option}) && $rules->{option} eq "keep") { print "\n\n"; return; } - udev("remove", $config->{subsys}, $config->{devpath}, \$config->{conf}); - if ((-e "$PWD/$udev_root$config->{exp_name}") || - (-l "$PWD/$udev_root$config->{exp_name}")) { + udev("remove", $rules->{subsys}, $rules->{devpath}, \$rules->{rules}); + if ((-e "$PWD/$udev_root$rules->{exp_name}") || + (-l "$PWD/$udev_root$rules->{exp_name}")) { print "remove: error"; - if ($config->{exp_rem_error}) { + if ($rules->{exp_rem_error}) { print " as expected\n"; } else { print "\n"; @@ -1397,7 +1397,7 @@ sub run_test { print "\n"; - if (defined($config->{option}) && $config->{option} eq "clear") { + if (defined($rules->{option}) && $rules->{option} eq "clear") { system("rm -rf $udev_db"); system("rm -rf $udev_root"); mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; @@ -1416,11 +1416,11 @@ if (!($<==0)) { system("rm -rf $udev_root"); mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; -# create initial config file -open CONF, ">$main_conf" || die "unable to create config file: $main_conf"; +# create config file +open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; print CONF "udev_root=\"$udev_root\"\n"; print CONF "udev_db=\"$udev_db\"\n"; -print CONF "udev_rules=\"$conf_tmp\"\n"; +print CONF "udev_rules=\"$udev_rules\"\n"; close CONF; my $test_num = 1; @@ -1439,8 +1439,8 @@ if ($ARGV[0]) { # test all print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; - foreach my $config (@tests) { - run_test($config, $test_num); + foreach my $rules (@tests) { + run_test($rules, $test_num); $test_num++; } } @@ -1450,6 +1450,6 @@ print "$error errors occured\n\n"; # cleanup system("rm -rf $udev_db"); system("rm -rf $udev_root"); -unlink($conf_tmp); -unlink($main_conf); +unlink($udev_rules); +unlink($udev_conf); diff --git a/test/udevstart-test.pl b/test/udevstart-test.pl index b6f85bb38c..1862ffea42 100644 --- a/test/udevstart-test.pl +++ b/test/udevstart-test.pl @@ -13,16 +13,15 @@ use strict; my $PWD = $ENV{PWD}; my $sysfs = "sys/"; -my $udev_bin = "../udev"; +my $udevstart_bin = "../udevstart"; my $udev_root = "udev-root/"; # !!! directory will be removed !!! my $udev_db = ".udevdb"; -my $main_conf = "udev-test.conf"; -my $conf_tmp = "udev-test.rules"; +my $udev_conf = "udev-test.conf"; +my $udev_rules = "udev-test.rules"; # set env -$ENV{UDEV_TEST} = "yes"; $ENV{SYSFS_PATH} = $sysfs; -$ENV{UDEV_CONFIG_FILE} = $main_conf; +$ENV{UDEV_CONFIG_FILE} = $udev_conf; $ENV{UDEV_NO_DEVD} = "yes"; $ENV{UDEV_NO_HOTPLUGD} = "yes"; @@ -36,23 +35,29 @@ if (!($<==0)) { system("rm -rf $udev_root"); mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; -# create initial config file -open CONF, ">$main_conf" || die "unable to create config file: $main_conf"; +# create config file +open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; print CONF "udev_root=\"$udev_root\"\n"; print CONF "udev_db=\"$udev_db\"\n"; -print CONF "udev_rules=\"$conf_tmp\"\n"; +print CONF "udev_rules=\"$udev_rules\"\n"; close CONF; -system("$udev_bin udevstart"); -my $block = int( `find $udev_root -type b -print | wc -l`); -my $char = int( `find $udev_root -type c -print | wc -l`); +# create rules file +open RULES, ">$udev_rules" || die "unable to create rules file: $udev_rules"; +print RULES "\n"; +close RULES; + +system("$udevstart_bin"); +my $block = int(`find $udev_root -type b -print | wc -l`); +my $char = int(`find $udev_root -type c -print | wc -l`); print "block devices: $block/10\n"; print "char devices: $char/91\n"; +print "\n"; # cleanup system("rm -rf $udev_db"); system("rm -rf $udev_root"); -unlink($conf_tmp); -unlink($main_conf); +unlink($udev_rules); +unlink($udev_conf); diff --git a/udev_config.c b/udev_config.c index 45b11de2aa..1b6b614260 100644 --- a/udev_config.c +++ b/udev_config.c @@ -219,24 +219,14 @@ static int parse_config_file(void) void udev_init_config(void) { + const char *config; init_variables(); sysfs_get_mnt_path(sysfs_path, sizeof(sysfs_path)); - /* see if we should try to override any of the default values */ - if (getenv("UDEV_TEST") != NULL) { - char *temp; - - temp = getenv("SYSFS_PATH"); - if (temp != NULL) { - strlcpy(sysfs_path, temp, sizeof(sysfs_path)); - no_trailing_slash(sysfs_path); - } - - temp = getenv("UDEV_CONFIG_FILE"); - if (temp != NULL) - strlcpy(udev_config_filename, temp, sizeof(udev_config_filename)); - } + config = getenv("UDEV_CONFIG_FILE"); + if (config != NULL) + strlcpy(udev_config_filename, config, sizeof(udev_config_filename)); parse_config_file(); dbg("sysfs_path='%s'", sysfs_path); -- cgit v1.2.3-54-g00ecf From 6b493a20e1dbf90a4e54d3be37027fa906220c31 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 27 Mar 2005 00:11:03 +0100 Subject: [PATCH] support log-priority levels in udev.conf --- Makefile | 9 +++-- RELEASE-NOTES | 11 ++++++ etc/udev/udev.conf.in | 14 +++---- logging.h | 13 +++++-- udev.8.in | 45 +++++++++++----------- udev.c | 24 ++++++------ udev.h | 2 +- udev_add.c | 6 +-- udev_config.c | 102 ++++++++++++++++++++++++++++---------------------- udev_db.c | 12 +++--- udev_remove.c | 2 +- udev_rules.c | 24 ++++++------ udev_rules_parse.c | 21 +++++------ udevd.8 | 2 +- udevd.c | 52 ++++++++++++------------- udevinfo.c | 7 +++- udevsend.c | 32 +++++++++------- udevstart.c | 17 ++++++++- udevtest.8 | 2 +- udevtest.c | 12 ++++-- 20 files changed, 233 insertions(+), 176 deletions(-) diff --git a/Makefile b/Makefile index 1424cf0315..9d9caec7f7 100644 --- a/Makefile +++ b/Makefile @@ -17,16 +17,18 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Set this to make use of syslog +# Set this to make use of syslog. USE_LOG = true -# Set this to ad development debug messages +# Set this to compile-in development debug messages. Pass UDEV_LOG="debug" +# to the executed binary or set the value in the udev configuration file to +# let udev print the debug messages to syslog. DEBUG = false # Set this to include Security-Enhanced Linux support. USE_SELINUX = false -# Set this to comile with the local version of klibc instead of glibc. +# Set this to comile with klibc instead of glibc. USE_KLIBC = false # Set this to create statically linked binaries. @@ -249,7 +251,6 @@ udev_version.h: @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ - @echo \#define UDEV_LOG_DEFAULT \"yes\" >> $@ @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2defd7117b..17d6097abf 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,14 @@ +udev 057 +======== +We support log priority levels now. The value udev_log in udev.conf is used +to determine what is printed to syslog. This makes it possible to +run a version with compiled-in debug messages in a production environment +which is sometimes needed to find a bug. +It is still possible to supress the inclusion of _any_ syslog usage with +USE_LOG=false to create the smallest possible binaries if needed. +The configured udev_log value can be overridden with the environment variable +UDEV_LOG. + udev 056 ======== Possible use of a system-wide klibc: diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index 72e25ed482..9d5300a861 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -1,19 +1,15 @@ # udev.conf -# The main config file for udev # -# This file can be used to override some of udev's default values -# for where it looks for files, and where it places device nodes. - -# udev_root - where in the filesystem to place the device nodes +# Where in the filesystem to place the device nodes udev_root="@udevdir@" -# udev_db - The name and location of the udev database. +# The name and location of the udev database. udev_db="@udevdir@/.udevdb" -# udev_rules - The name and location of the udev rules file +# The name and location of the udev rules file(s). udev_rules="@configdir@/rules.d" -# udev_log - set to "yes" if you want logging, else "no" -udev_log="yes" +# The syslog(3) priority: "err", "info", or the numerical value. +udev_log="err" diff --git a/logging.h b/logging.h index e7653ee1b8..904355cb2c 100644 --- a/logging.h +++ b/logging.h @@ -24,6 +24,7 @@ #ifndef LOGGING_H #define LOGGING_H +#define err(format, arg...) do { } while (0) #define info(format, arg...) do { } while (0) #define dbg(format, arg...) do { } while (0) #define logging_init(foo) do { } while (0) @@ -34,21 +35,27 @@ #include #include +#undef err +#define err(format, arg...) \ + do { \ + log_message(LOG_INFO ,"%s: " format ,__FILE__ ,## arg); \ + } while (0) + #undef info #define info(format, arg...) \ do { \ - log_message(LOG_INFO , format , ## arg); \ + log_message(LOG_INFO ,"%s: " format ,__FILE__ ,## arg); \ } while (0) #ifdef DEBUG #undef dbg #define dbg(format, arg...) \ do { \ - log_message(LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg); \ + log_message(LOG_DEBUG ,"%s: " format ,__FUNCTION__ ,## arg); \ } while (0) #endif -extern void log_message(int level, const char *format, ...) +extern void log_message(int priority, const char *format, ...) __attribute__ ((format (printf, 2, 3))); #undef logging_init diff --git a/udev.8.in b/udev.8.in index a246efdb45..7b061a8c2b 100644 --- a/udev.8.in +++ b/udev.8.in @@ -2,7 +2,7 @@ .SH NAME udev \- Linux configurable dynamic device naming support .SH SYNOPSIS -.BI udev " hotplug-subsystem" +.BI udev .SH "DESCRIPTION" .B udev provides a dynamic device directory containing only the files for actually @@ -56,25 +56,28 @@ All rule files are read in lexical order. The default value is .IR /etc/udev/rules.d/ . .TP .B udev_log -The switch to enable/disable logging of udev information +The logging priority which can be set to +.IR "err " , "info " +or the corresponding numerical +.BR syslog (3) +value. The default value is -.IR yes . +.IR err . .P .RI "A sample " udev.conf " file might look like this: .sp .nf -# udev_root - where to place the device nodes in the filesystem -udev_root="/udev" +# Where in the filesystem to place the device nodes +udev_root="@udevdir@" -# udev_db - The name and location of the udev database -udev_db="/udev/.udevdb" +# The name and location of the udev database. +udev_db="@udevdir@/.udevdb" -# udev_rules - The name of the udev rules file or directory to look - for files with the suffix .rules -udev_rules="/etc/udev/rules.d/" +# The name and location of the udev rules file(s). +udev_rules="@configdir@/rules.d" -# udev_log - set to "yes" if you want logging, else "no" -udev_log="yes" +# The syslog(3) priority: "err", "info", or the numerical value. +udev_log="err" .fi .P The rules for device naming are read from the files located in the @@ -171,7 +174,6 @@ compiled-in default value. .B last_rule will be the last rule applied. No later rules will have any effect. .sp -.B OPTIONS .B ignore_device will ignore this device. No node will be created. .sp @@ -277,13 +279,6 @@ KERNEL=="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" # multiple USB webcams with symlinks to be called webcam0, webcam1, ... BUS=="usb", SYSFS{model}=="XV3", NAME=="video%n", SYMLINK="webcam%n" - -# grouping of optical drives from multiple kernel subsystems -KERNEL=="sr*", NAME="%k", SYMLINK="cdrom%e" -KERNEL=="scd*", NAME="%k", SYMLINK="cdrom%e" -KERNEL=="pcd*", NAME="%k", SYMLINK="cdrom%e" -KERNEL=="hd[a-z]", PROGRAM=="/bin/cat /proc/ide/%k/media", RESULT=="cdrom", - NAME="%k", SYMLINK="cdrom%e" .fi .P A number of different fields in the above configuration files support a simple @@ -312,8 +307,9 @@ to be recognized. .br In addition to the hotplug environment variables, .B UDEV_LOG -is set if udev is configured to use the syslog facility. Executed programs may -want to follow that setting. +is set and contains the numerical priority value, if udev is configured to use +.BR syslog (3). +Executed programs may want to follow that setting. .B DEVNAME is exported to make the name of the created node, or the name the network device is renamed to, available to the executed program. The programs in every @@ -345,6 +341,9 @@ Overrides the default location of the .B udev config file. .TP +.B UDEV_LOG +Overrides the log priority specified in the config file. +.TP .B UDEV_NO_DEVD The default behavior of .B udev @@ -367,8 +366,8 @@ will skip this step. .PP .B Web resources: .nf -.I http://linux\-hotplug.sourceforge.net/ .I http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html +.I http://linux\-hotplug.sourceforge.net/ .fi .SH AUTHORS .B udev diff --git a/udev.c b/udev.c index 069cecf973..6d1d679d9a 100644 --- a/udev.c +++ b/udev.c @@ -40,17 +40,16 @@ #include "udev_rules.h" #include "logging.h" - #ifdef USE_LOG -void log_message(int level, const char *format, ...) +void log_message(int priority, const char *format, ...) { va_list args; - if (!udev_log) + if (priority > udev_log_priority) return; va_start(args, format); - vsyslog(level, format, args); + vsyslog(priority, format, args); va_end(args); } #endif @@ -115,13 +114,12 @@ int main(int argc, char *argv[], char *envp[]) } logging_init("udev"); - dbg("version %s", UDEV_VERSION); - udev_init_config(); + dbg("version %s", UDEV_VERSION); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); - act.sa_handler = (void (*) (int))sig_handler; + act.sa_handler = (void (*)(int)) sig_handler; sigemptyset (&act.sa_mask); act.sa_flags = 0; sigaction(SIGALRM, &act, NULL); @@ -146,13 +144,17 @@ int main(int argc, char *argv[], char *envp[]) udev_init_device(&udev, devpath, subsystem); if (!action || !subsystem || !devpath) { - dbg("action, subsystem or devpath missing"); + err("action, subsystem or devpath missing"); goto hotplug; } /* export logging flag, as called scripts may want to do the same as udev */ - if (udev_log) - setenv("UDEV_LOG", "1", 1); + if (udev_log_priority) { + char priority[32]; + + sprintf(priority, "%i", udev_log_priority); + setenv("UDEV_LOG", priority, 1); + } if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS || udev.type == DEV_NET) { if (strcmp(action, "add") == 0) { @@ -169,7 +171,7 @@ int main(int argc, char *argv[], char *envp[]) path[sizeof(path)-1] = '\0'; class_dev = wait_class_device_open(path); if (class_dev == NULL) { - dbg ("open class device failed"); + dbg("open class device failed"); goto hotplug; } dbg("opened class_dev->name='%s'", class_dev->name); diff --git a/udev.h b/udev.h index 6e41bb5d26..c2706f4593 100644 --- a/udev.h +++ b/udev.h @@ -92,7 +92,7 @@ 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]; -extern int udev_log; +extern int udev_log_priority; extern int udev_dev_d; extern int udev_hotplug_d; diff --git a/udev_add.c b/udev_add.c index 15c6bf9fbc..d0d9eab913 100644 --- a/udev_add.c +++ b/udev_add.c @@ -58,7 +58,7 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo /* preserve node with already correct numbers, to not change the inode number */ if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) && (stats.st_rdev == devt)) { - dbg("preserve file '%s', cause it has correct dev_t", file); + info("preserve file '%s', cause it has correct dev_t", file); selinux_setfilecon(file, udev->kernel_name, stats.st_mode); goto perms; } @@ -85,7 +85,7 @@ create: retval = mknod(file, mode, devt); selinux_resetfscreatecon(); if (retval != 0) { - dbg("mknod(%s, %#o, %u, %u) failed with error '%s'", + err("mknod(%s, %#o, %u, %u) failed with error '%s'", file, mode, major(devt), minor(devt), strerror(errno)); goto exit; } @@ -241,7 +241,7 @@ static int rename_net_if(struct udevice *udev) struct ifreq ifr; int retval; - dbg("changing net interface name from '%s' to '%s'", udev->kernel_name, udev->name); + info("changing net interface name from '%s' to '%s'", udev->kernel_name, udev->name); if (udev->test_run) return 0; diff --git a/udev_config.c b/udev_config.c index 1b6b614260..54eedb980a 100644 --- a/udev_config.c +++ b/udev_config.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "libsysfs/sysfs/libsysfs.h" #include "udev_libc_wrapper.h" @@ -35,19 +36,17 @@ #include "udev_utils.h" #include "udev_version.h" #include "logging.h" -#include "udev_rules.h" /* global variables */ char sysfs_path[PATH_SIZE]; char udev_root[PATH_SIZE]; char udev_db_path[PATH_SIZE]; -char udev_rules_filename[PATH_SIZE]; char udev_config_filename[PATH_SIZE]; -int udev_log; +char udev_rules_filename[PATH_SIZE]; +int udev_log_priority; int udev_dev_d; int udev_hotplug_d; - static int string_is_true(const char *str) { if (strcasecmp(str, "true") == 0) @@ -59,6 +58,26 @@ static int string_is_true(const char *str) return 0; } +static int log_priority(const char *priority) +{ + char *endptr; + int prio; + + prio = strtol(priority, &endptr, 10); + if (endptr[0] == '\0') + return prio; + if (strncasecmp(priority, "err", 3) == 0) + return LOG_ERR; + if (strcasecmp(priority, "info") == 0) + return LOG_INFO; + if (strcasecmp(priority, "debug") == 0) + return LOG_DEBUG; + if (string_is_true(priority)) + return LOG_ERR; + + return 0; +} + static int get_key(char **line, char **key, char **value) { char *linepos; @@ -107,29 +126,6 @@ static int get_key(char **line, char **key, char **value) return 0; } -static void init_variables(void) -{ - const char *env; - - /* If any config values are specified, they will override these values. */ - strcpy(udev_root, UDEV_ROOT); - strcpy(udev_db_path, UDEV_DB); - strcpy(udev_config_filename, UDEV_CONFIG_FILE); - strcpy(udev_rules_filename, UDEV_RULES_FILE); - - udev_log = string_is_true(UDEV_LOG_DEFAULT); - - udev_dev_d = 1; - env = getenv("UDEV_NO_DEVD"); - if (env && string_is_true(env)) - udev_dev_d = 0; - - udev_hotplug_d = 1; - env = getenv("UDEV_NO_HOTPLUGD"); - if (env && string_is_true(env)) - udev_hotplug_d = 0; -} - static int parse_config_file(void) { char line[LINE_SIZE]; @@ -145,10 +141,9 @@ static int parse_config_file(void) int retval = 0; if (file_map(udev_config_filename, &buf, &bufsize) != 0) { - dbg("can't open '%s' as config file", udev_config_filename); + err("can't open '%s' as config file", udev_config_filename); return -ENODEV; } - dbg("reading '%s' as config file", udev_config_filename); /* loop through the whole file */ lineno = 0; @@ -160,8 +155,7 @@ static int parse_config_file(void) lineno++; if (count >= sizeof(line)) { - info("line too long, conf line skipped %s, line %d", - udev_config_filename, lineno); + err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); continue; } @@ -178,17 +172,14 @@ static int parse_config_file(void) continue; strlcpy(line, bufline, count); - dbg("read '%s'", line); linepos = line; retval = get_key(&linepos, &variable, &value); if (retval != 0) { - info("error parsing %s, line %d:%d", udev_config_filename, lineno, (int) (linepos-line)); + err("error parsing %s, line %d:%d", udev_config_filename, lineno, (int) (linepos-line)); continue; } - dbg("variable='%s', value='%s'", variable, value); - if (strcasecmp(variable, "udev_root") == 0) { strlcpy(udev_root, value, sizeof(udev_root)); no_trailing_slash(udev_root); @@ -208,7 +199,7 @@ static int parse_config_file(void) } if (strcasecmp(variable, "udev_log") == 0) { - udev_log = string_is_true(value); + udev_log_priority = log_priority(value); continue; } } @@ -219,20 +210,41 @@ static int parse_config_file(void) void udev_init_config(void) { - const char *config; + const char *env; - init_variables(); + strcpy(udev_root, UDEV_ROOT); + strcpy(udev_db_path, UDEV_DB); + strcpy(udev_config_filename, UDEV_CONFIG_FILE); + strcpy(udev_rules_filename, UDEV_RULES_FILE); + udev_log_priority = LOG_ERR; + udev_dev_d = 1; + udev_hotplug_d = 1; sysfs_get_mnt_path(sysfs_path, sizeof(sysfs_path)); - config = getenv("UDEV_CONFIG_FILE"); - if (config != NULL) - strlcpy(udev_config_filename, config, sizeof(udev_config_filename)); + env = getenv("UDEV_NO_DEVD"); + if (env && string_is_true(env)) + udev_dev_d = 0; + + env = getenv("UDEV_NO_HOTPLUGD"); + if (env && string_is_true(env)) + udev_hotplug_d = 0; + + env = getenv("UDEV_CONFIG_FILE"); + if (env) { + strlcpy(udev_config_filename, env, sizeof(udev_config_filename)); + no_trailing_slash(udev_config_filename); + } parse_config_file(); + + env = getenv("UDEV_LOG"); + if (env) + udev_log_priority = log_priority(env); + dbg("sysfs_path='%s'", sysfs_path); + dbg("UDEV_CONFIG_FILE='%s'", udev_config_filename); dbg("udev_root='%s'", udev_root); - dbg("udev_config_filename='%s'", udev_config_filename); - dbg("udev_db_path='%s'", udev_db_path); - dbg("udev_rules_filename='%s'", udev_rules_filename); - dbg("udev_log=%d", udev_log); + dbg("udev_db='%s'", udev_db_path); + dbg("udev_rules='%s'", udev_rules_filename); + dbg("udev_log=%d", udev_log_priority); } diff --git a/udev_db.c b/udev_db.c index 806fc71bce..f606b5e05c 100644 --- a/udev_db.c +++ b/udev_db.c @@ -74,7 +74,7 @@ int udev_db_add_device(struct udevice *udev) f = fopen(filename, "w"); if (f == NULL) { - dbg("unable to create db file '%s'", filename); + err("unable to create db file '%s'", filename); return -1; } dbg("storing data for device '%s' in '%s'", udev->devpath, filename); @@ -103,7 +103,7 @@ static int parse_db_file(struct udevice *udev, const char *filename) size_t count; if (file_map(filename, &buf, &bufsize) != 0) { - dbg("unable to read db file '%s'", filename); + err("unable to read db file '%s'", filename); return -1; } @@ -187,7 +187,7 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) dir = opendir(udev_db_path); if (dir == NULL) { - dbg("unable to udev db '%s'", udev_db_path); + err("unable to open udev_db '%s'", udev_db_path); return -1; } @@ -214,7 +214,7 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) dbg("looking at '%s'", filename); if (file_map(filename, &buf, &bufsize) != 0) { - dbg("unable to read db file '%s'", filename); + err("unable to read db file '%s'", filename); continue; } @@ -260,7 +260,7 @@ int udev_db_dump_names(int (*handler_function)(const char *path, const char *nam dir = opendir(udev_db_path); if (dir == NULL) { - dbg("unable to udev db '%s'", udev_db_path); + err("unable to open udev_db '%s'", udev_db_path); return -1; } @@ -287,7 +287,7 @@ int udev_db_dump_names(int (*handler_function)(const char *path, const char *nam dbg("looking at '%s'", filename); if (file_map(filename, &buf, &bufsize) != 0) { - dbg("unable to read db file '%s'", filename); + err("unable to read db file '%s'", filename); continue; } diff --git a/udev_remove.c b/udev_remove.c index 0a9996dc6a..2df555327b 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -158,7 +158,7 @@ int udev_remove_device(struct udevice *udev) if (temp == NULL) return -ENODEV; strlcpy(udev->name, &temp[1], sizeof(udev->name)); - dbg("'%s' not found in database, falling back on default name", udev->name); + info("'%s' not found in database, falling back on default name", udev->name); } /* use full path to the environment */ diff --git a/udev_rules.c b/udev_rules.c index 3dc77855da..4eb8fd4411 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -107,7 +107,7 @@ static char *get_format_attribute(char **str) if (*str[0] == '{') { pos = strchr(*str, '}'); if (pos == NULL) { - dbg("missing closing brace for format"); + err("missing closing brace for format"); return NULL; } pos[0] = '\0'; @@ -131,7 +131,7 @@ static int get_format_len(char **str) dbg("format length=%i", num); return num; } else { - dbg("format parsing error '%s'", *str); + err("format parsing error '%s'", *str); } } return -1; @@ -239,7 +239,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, cpos++; } if (i > 0) { - dbg("requested part of result string not found"); + err("requested part of result string not found"); break; } strlcpy(temp2, cpos, sizeof(temp2)); @@ -265,7 +265,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, } tmpattr = find_sysfs_attribute(class_dev, sysfs_device, attr); if (tmpattr == NULL) { - dbg("sysfa attribute '%s' not found", attr); + dbg("sysfs attribute '%s' not found", attr); break; } /* strip trailing whitespace of matching value */ @@ -327,7 +327,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("substitute udev_root '%s'", udev_root); break; default: - dbg("unknown substitution type '%%%c'", c); + err("unknown substitution type '%%%c'", c); break; } /* truncate to specified length */ @@ -378,7 +378,7 @@ static int execute_program(struct udevice *udev, const char *path, char *value, retval = pipe(fds); if (retval != 0) { - dbg("pipe failed"); + err("pipe failed"); return -1; } @@ -393,7 +393,7 @@ static int execute_program(struct udevice *udev, const char *path, char *value, info(KEY_PROGRAM " execution of '%s' failed", path); exit(1); case -1: - dbg("fork failed"); + err("fork of '%s' failed", path); return -1; default: /* parent reads from fds[0] */ @@ -407,14 +407,14 @@ static int execute_program(struct udevice *udev, const char *path, char *value, i += count; if (i >= len-1) { - dbg("result len %d too short", len); + err("result len %d too short", len); retval = -1; break; } } if (count < 0) { - dbg("read failed with '%s'", strerror(errno)); + err("read failed with '%s'", strerror(errno)); retval = -1; } @@ -775,12 +775,12 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d next = strchr(temp, ' '); while (next) { next[0] = '\0'; - dbg("add symlink '%s'", pos); + info("add symlink '%s'", pos); name_list_add(&udev->symlink_list, pos, 0); pos = &next[1]; next = strchr(pos, ' '); } - dbg("add symlink '%s'", pos); + info("add symlink '%s'", pos); name_list_add(&udev->symlink_list, pos, 0); } @@ -812,7 +812,7 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d if (udev->name[0] == '\0') { /* no rule matched, so we use the kernel name */ strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); - dbg("no rule found, use kernel name '%s'", udev->name); + info("no rule found, use kernel name '%s'", udev->name); } if (udev->tmp_node[0] != '\0') { diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 55412dba3c..71ca482728 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -157,7 +157,7 @@ static char *get_key_attribute(char *str) attr++; pos = strchr(attr, '}'); if (pos == NULL) { - dbg("missing closing brace for format"); + err("missing closing brace for format"); return NULL; } pos[0] = '\0'; @@ -185,7 +185,7 @@ static int rules_parse(const char *filename) struct udev_rule rule; if (file_map(filename, &buf, &bufsize) != 0) { - dbg("can't open '%s' as rules file", filename); + err("can't open '%s' as rules file", filename); return -1; } dbg("reading '%s' as rules file", filename); @@ -274,13 +274,13 @@ static int rules_parse(const char *filename) struct key_pair *pair; if (rule.sysfs_pair_count >= KEY_SYSFS_PAIRS_MAX) { - dbg("skip rule, to many " KEY_SYSFS " keys in a single rule"); + err("skip rule, to many " KEY_SYSFS " keys in a single rule"); goto error; } pair = &rule.sysfs_pair[rule.sysfs_pair_count]; attr = get_key_attribute(key + sizeof(KEY_SYSFS)-1); if (attr == NULL) { - dbg("error parsing " KEY_SYSFS " attribute"); + err("error parsing " KEY_SYSFS " attribute"); goto error; } strlcpy(pair->name, attr, sizeof(pair->name)); @@ -295,13 +295,13 @@ static int rules_parse(const char *filename) struct key_pair *pair; if (rule.env_pair_count >= KEY_ENV_PAIRS_MAX) { - dbg("skip rule, to many " KEY_ENV " keys in a single rule"); + err("skip rule, to many " KEY_ENV " keys in a single rule"); goto error; } pair = &rule.env_pair[rule.env_pair_count]; attr = get_key_attribute(key + sizeof(KEY_ENV)-1); if (attr == NULL) { - dbg("error parsing " KEY_ENV " attribute"); + err("error parsing " KEY_ENV " attribute"); continue; } strlcpy(pair->name, attr, sizeof(pair->name)); @@ -400,7 +400,7 @@ static int rules_parse(const char *filename) continue; } - dbg("unknown key '%s'", key); + err("unknown key '%s'", key); goto error; } @@ -411,13 +411,12 @@ static int rules_parse(const char *filename) /* simple plausibility checks for given keys */ if ((rule.sysfs_pair[0].name[0] == '\0') ^ (rule.sysfs_pair[0].value[0] == '\0')) { - info("inconsistency in " KEY_SYSFS " key"); + err("inconsistency in " KEY_SYSFS " key"); goto error; } if ((rule.result[0] != '\0') && (program_given == 0)) { - info(KEY_RESULT " is only useful when " - KEY_PROGRAM " is called in any rule before"); + info(KEY_RESULT " is only useful when " KEY_PROGRAM " is called in any rule before"); goto error; } @@ -428,7 +427,7 @@ static int rules_parse(const char *filename) dbg("add_config_dev returned with error %d", retval); continue; error: - info("parse error %s, line %d:%d, rule skipped", + err("parse error %s, line %d:%d, rule skipped", filename, lineno, (int) (linepos - line)); } } diff --git a/udevd.8 b/udevd.8 index b06a2b7af1..02e2e2c5f8 100644 --- a/udevd.8 +++ b/udevd.8 @@ -2,7 +2,7 @@ .SH NAME udevd, udevdsend \- udev event serializer daemon and udev event sender .SH SYNOPSIS -.BI udevsend " hotplug-subsystem" +.BI udevsend .SH "DESCRIPTION" .B udevd allows the serialization of diff --git a/udevd.c b/udevd.c index 6e27c8a0d1..6c4d8b8693 100644 --- a/udevd.c +++ b/udevd.c @@ -70,20 +70,19 @@ static void reap_sigchilds(void); char *udev_bin; #ifdef USE_LOG -void log_message (int level, const char *format, ...) +void log_message (int priority, const char *format, ...) { - va_list args; + va_list args; + + if (priority > udev_log_priority) + return; va_start(args, format); - vsyslog(level, format, args); + vsyslog(priority, format, args); va_end(args); } #endif -#define msg_dump(msg) \ - dbg("msg_dump: sequence %llu, '%s', '%s', '%s'", \ - msg->seqnum, msg->action, msg->devpath, msg->subsystem); - static void msg_dump_queue(void) { #ifdef DEBUG @@ -127,7 +126,7 @@ static void msg_queue_insert(struct hotplug_msg *msg) break; if (loop_msg->seqnum == msg->seqnum) { - dbg("ignoring duplicate message seq %llu", msg->seqnum); + info("ignoring duplicate message seq %llu", msg->seqnum); return; } } @@ -160,11 +159,11 @@ static void udev_run(struct hotplug_msg *msg) setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); execve(udev_bin, argv, msg->envp); - dbg("exec of child failed"); + err("exec of child failed"); _exit(1); break; case -1: - dbg("fork of child failed"); + err("fork of child failed"); run_queue_delete(msg); break; default: @@ -452,17 +451,17 @@ static struct hotplug_msg *get_udevsend_msg(void) cred = (struct ucred *) CMSG_DATA(cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - dbg("no sender credentials received, message ignored"); + info("no sender credentials received, message ignored"); return NULL; } if (cred->uid != 0) { - dbg("sender uid=%i, message ignored", cred->uid); + info("sender uid=%i, message ignored", cred->uid); return NULL; } if (strncmp(usend_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { - dbg("message magic '%s' doesn't match, ignore it", usend_msg.magic); + info("message magic '%s' doesn't match, ignore it", usend_msg.magic); return NULL; } @@ -605,14 +604,14 @@ static int init_udevsend_socket(void) udevsendsock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udevsendsock == -1) { - dbg("error getting socket, %s", strerror(errno)); + err("error getting socket, %s", strerror(errno)); return -1; } /* the bind takes care of ensuring only one copy running */ retval = bind(udevsendsock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { - dbg("bind failed, %s", strerror(errno)); + err("bind failed, %s", strerror(errno)); close(udevsendsock); return -1; } @@ -634,10 +633,11 @@ int main(int argc, char *argv[], char *envp[]) const char *udevd_expected_seqnum; logging_init("udevd"); + udev_init_config(); dbg("version %s", UDEV_VERSION); if (getuid() != 0) { - dbg("need to be root, exit"); + err("need to be root, exit"); goto exit; } @@ -651,7 +651,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("damonized fork running"); break; case -1: - dbg("fork of daemon failed"); + err("fork of daemon failed"); goto exit; default: logging_close(); @@ -679,36 +679,36 @@ int main(int argc, char *argv[], char *envp[]) if (fd > 2) close(fd); } else - dbg("error opening /dev/null %s", strerror(errno)); + err("error opening /dev/null %s", strerror(errno)); /* setup signal handler pipe */ retval = pipe(pipefds); if (retval < 0) { - dbg("error getting pipes: %s", strerror(errno)); + err("error getting pipes: %s", strerror(errno)); goto exit; } retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK); if (retval < 0) { - dbg("error fcntl on read pipe: %s", strerror(errno)); + err("error fcntl on read pipe: %s", strerror(errno)); goto exit; } retval = fcntl(pipefds[0], F_SETFD, FD_CLOEXEC); if (retval < 0) - dbg("error fcntl on read pipe: %s", strerror(errno)); + err("error fcntl on read pipe: %s", strerror(errno)); retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK); if (retval < 0) { - dbg("error fcntl on write pipe: %s", strerror(errno)); + err("error fcntl on write pipe: %s", strerror(errno)); goto exit; } retval = fcntl(pipefds[1], F_SETFD, FD_CLOEXEC); if (retval < 0) - dbg("error fcntl on write pipe: %s", strerror(errno)); + err("error fcntl on write pipe: %s", strerror(errno)); /* set signal handlers */ memset(&act, 0x00, sizeof(struct sigaction)); - act.sa_handler = (void (*) (int))sig_handler; + act.sa_handler = (void (*)(int)) sig_handler; sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); @@ -728,7 +728,7 @@ int main(int argc, char *argv[], char *envp[]) /* possible override of udev binary, used for testing */ udev_bin = getenv("UDEV_BIN"); if (udev_bin != NULL) - dbg("udev binary is set to '%s'", udev_bin); + info("udev binary is set to '%s'", udev_bin); else udev_bin = UDEV_BIN; @@ -736,7 +736,7 @@ int main(int argc, char *argv[], char *envp[]) udevd_expected_seqnum = getenv("UDEVD_EXPECTED_SEQNUM"); if (udevd_expected_seqnum != NULL) { expected_seqnum = strtoull(udevd_expected_seqnum, NULL, 10); - dbg("initialize expected_seqnum to %llu", expected_seqnum); + info("initialize expected_seqnum to %llu", expected_seqnum); } /* get current time to provide shorter timeout on startup */ diff --git a/udevinfo.c b/udevinfo.c index ccc3e58e2b..3fb37b41e9 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -36,12 +36,15 @@ #ifdef USE_LOG -void log_message (int level, const char *format, ...) +void log_message (int priority, const char *format, ...) { va_list args; + if (priority > udev_log_priority) + return; + va_start(args, format); - vsyslog(level, format, args); + vsyslog(priority, format, args); va_end(args); } #endif diff --git a/udevsend.c b/udevsend.c index dcd5a2ae93..8915edacc8 100644 --- a/udevsend.c +++ b/udevsend.c @@ -44,12 +44,15 @@ static int sock = -1; #ifdef USE_LOG -void log_message (int level, const char *format, ...) +void log_message (int priority, const char *format, ...) { - va_list args; + va_list args; + + if (priority > udev_log_priority) + return; va_start(args, format); - vsyslog(level, format, args); + vsyslog(priority, format, args); va_end(args); } #endif @@ -71,17 +74,17 @@ static int start_daemon(void) /* daemon with empty environment */ close(sock); execve(UDEVD_BIN, argv, envp); - dbg("exec of daemon failed"); + err("exec of daemon failed"); _exit(1); case -1: - dbg("fork of daemon failed"); + err("fork of daemon failed"); return -1; default: exit(0); } break; case -1: - dbg("fork of helper failed"); + err("fork of helper failed"); return -1; default: waitpid(pid, NULL, 0); @@ -99,11 +102,11 @@ static void run_udev(const char *subsystem) case 0: /* child */ execv(UDEV_BIN, argv); - dbg("exec of child failed"); + err("exec of udev child failed"); _exit(1); break; case -1: - dbg("fork of child failed"); + err("fork of udev child failed"); break; default: waitpid(pid, NULL, 0); @@ -124,11 +127,14 @@ int main(int argc, char *argv[], char *envp[]) const char *subsystem = NULL; logging_init("udevsend"); +#ifdef USE_LOG + udev_init_config(); +#endif dbg("version %s", UDEV_VERSION); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { - dbg("error getting socket"); + err("error getting socket"); goto fallback; } @@ -156,7 +162,7 @@ int main(int argc, char *argv[], char *envp[]) } if (bufpos + keylen >= HOTPLUG_BUFFER_SIZE-1) { - dbg("environment buffer too small, probably not called by the kernel"); + err("environment buffer too small, probably not called by the kernel"); continue; } @@ -187,12 +193,12 @@ int main(int argc, char *argv[], char *envp[]) } if (errno != ECONNREFUSED) { - dbg("error sending message (%s)", strerror(errno)); + err("error sending message (%s)", strerror(errno)); goto fallback; } if (!started_daemon) { - dbg("try to start udevd daemon"); + info("try to start udevd daemon"); retval = start_daemon(); if (retval) { dbg("error starting daemon"); @@ -207,7 +213,7 @@ int main(int argc, char *argv[], char *envp[]) } fallback: - info("unable to connect to event daemon, try to call udev directly"); + err("unable to connect to event daemon, try to call udev directly"); run_udev(subsystem); exit: diff --git a/udevstart.c b/udevstart.c index 7765661fe4..a862dadf88 100644 --- a/udevstart.c +++ b/udevstart.c @@ -38,14 +38,23 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev_libc_wrapper.h" #include "udev.h" +#include "udev_version.h" #include "logging.h" #include "udev_rules.h" #include "udev_utils.h" #include "list.h" #ifdef USE_LOG -void log_message(int level, const char *format, ...) +void log_message(int priority, const char *format, ...) { + va_list args; + + if (priority > udev_log_priority) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); } #endif @@ -299,7 +308,12 @@ int main(int argc, char *argv[], char *envp[]) { struct sigaction act; + logging_init("udev"); udev_init_config(); + /* disable all logging if not explicitely requested */ + if (getenv("UDEV_LOG") == NULL) + udev_log_priority = 0; + dbg("version %s", UDEV_VERSION); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); @@ -322,5 +336,6 @@ int main(int argc, char *argv[], char *envp[]) udev_scan_block(); udev_scan_class(); + logging_close(); return 0; } diff --git a/udevtest.8 b/udevtest.8 index 13b57f03b6..a595a30d41 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -3,7 +3,7 @@ udevtest \- simulates a udev run to test the configured rules .SH SYNOPSIS .B udevtest -.IR "sysfs_device_path " [ subsystem ] +.I sysfs_device_path subsystem .SH "DESCRIPTION" .B udevtest simulates a diff --git a/udevtest.c b/udevtest.c index 006d55510e..f0c38b3a51 100644 --- a/udevtest.c +++ b/udevtest.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" @@ -37,10 +38,13 @@ #ifdef USE_LOG -void log_message (int level, const char *format, ...) +void log_message (int priority, const char *format, ...) { va_list args; + if (priority > udev_log_priority) + return; + va_start(args, format); vprintf(format, args); va_end(args); @@ -60,13 +64,15 @@ int main(int argc, char *argv[], char *envp[]) info("version %s", UDEV_VERSION); - if (argc < 2 || argc > 3) { - info("Usage: udevtest [subsystem]"); + if (argc != 3) { + info("Usage: udevtest "); return 1; } /* initialize our configuration */ udev_init_config(); + if (udev_log_priority < LOG_INFO) + udev_log_priority = LOG_INFO; /* remove sysfs_path if given */ if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) -- cgit v1.2.3-54-g00ecf From a6bece643c9e1132052c246eab099e7d9071ab63 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 27 Mar 2005 00:11:52 +0100 Subject: [PATCH] klibc: version 1.0.4 --- klibc/include/signal.h | 2 +- klibc/klibc/tests/environ.c | 24 - klibc/klibc/tests/fcntl.c | 53 - klibc/klibc/tests/getopttest.c | 31 - klibc/klibc/tests/getpagesize.c | 11 - klibc/klibc/tests/hello.c | 7 - klibc/klibc/tests/idtest.c | 14 - klibc/klibc/tests/malloctest.c | 4145 --------------------------------------- klibc/klibc/tests/malloctest2.c | 60 - klibc/klibc/tests/memstrtest.c | 29 - klibc/klibc/tests/microhello.c | 9 - klibc/klibc/tests/minihello.c | 7 - klibc/klibc/tests/mmaptest.c | 28 - klibc/klibc/tests/nfs_no_rpc.c | 538 ----- klibc/klibc/tests/opentest.c | 17 - klibc/klibc/tests/rtsig.c | 12 - klibc/klibc/tests/setenvtest.c | 38 - klibc/klibc/tests/setjmptest.c | 36 - klibc/klibc/tests/stat.c | 65 - klibc/klibc/tests/statfs.c | 43 - klibc/klibc/tests/strtoimax.c | 24 - klibc/klibc/tests/strtotime.c | 27 - klibc/klibc/tests/testrand48.c | 19 - klibc/klibc/tests/testvsnp.c | 115 -- klibc/version | 2 +- 25 files changed, 2 insertions(+), 5354 deletions(-) delete mode 100644 klibc/klibc/tests/environ.c delete mode 100644 klibc/klibc/tests/fcntl.c delete mode 100644 klibc/klibc/tests/getopttest.c delete mode 100644 klibc/klibc/tests/getpagesize.c delete mode 100644 klibc/klibc/tests/hello.c delete mode 100644 klibc/klibc/tests/idtest.c delete mode 100644 klibc/klibc/tests/malloctest.c delete mode 100644 klibc/klibc/tests/malloctest2.c delete mode 100644 klibc/klibc/tests/memstrtest.c delete mode 100644 klibc/klibc/tests/microhello.c delete mode 100644 klibc/klibc/tests/minihello.c delete mode 100644 klibc/klibc/tests/mmaptest.c delete mode 100644 klibc/klibc/tests/nfs_no_rpc.c delete mode 100644 klibc/klibc/tests/opentest.c delete mode 100644 klibc/klibc/tests/rtsig.c delete mode 100644 klibc/klibc/tests/setenvtest.c delete mode 100644 klibc/klibc/tests/setjmptest.c delete mode 100644 klibc/klibc/tests/stat.c delete mode 100644 klibc/klibc/tests/statfs.c delete mode 100644 klibc/klibc/tests/strtoimax.c delete mode 100644 klibc/klibc/tests/strtotime.c delete mode 100644 klibc/klibc/tests/testrand48.c delete mode 100644 klibc/klibc/tests/testvsnp.c diff --git a/klibc/include/signal.h b/klibc/include/signal.h index e78318f5f7..ab3c98d6e4 100644 --- a/klibc/include/signal.h +++ b/klibc/include/signal.h @@ -16,7 +16,7 @@ /* glibc seems to use sig_atomic_t as "int" pretty much on all architectures. Do the same, but allow the architecture to override. */ -#ifdef _KLIBC_HAS_ARCH_SIG_ATOMIC_T +#ifndef _KLIBC_HAS_ARCH_SIG_ATOMIC_T typedef int sig_atomic_t; #endif diff --git a/klibc/klibc/tests/environ.c b/klibc/klibc/tests/environ.c deleted file mode 100644 index 6eeeb9197e..0000000000 --- a/klibc/klibc/tests/environ.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -int main(int argc, char *argv[], char *envp[]) -{ - int i; - - /* Verify envp == environ */ - printf("Verifying envp == environ... %s\n", - (envp == environ) ? "ok" : "ERROR"); - - /* Test argc/argv */ - printf("argc = %d, argv = %p\n", argc, argv); - for ( i = 0 ; i < argc ; i++ ) { - printf("argv[%2d] = %s\n", i, argv[i]); - } - - /* Test environ */ - for ( i = 0 ; envp[i] ; i++ ) - printf("%s\n", envp[i]); - - return 0; -} diff --git a/klibc/klibc/tests/fcntl.c b/klibc/klibc/tests/fcntl.c deleted file mode 100644 index f504ad90f7..0000000000 --- a/klibc/klibc/tests/fcntl.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Simple test of fcntl - */ - -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - int fd = open(argv[0], O_RDONLY); - struct flock l; - long flags; - - (void)argc; - - if ( fd < 0 ) { - perror("open"); - exit(1); - } - - /* Get the flags on this FD */ - - if ( (flags = fcntl(fd, F_GETFL)) == -1 ) { - perror("F_GETFL"); - exit(1); - } - - if ( flags != (O_RDONLY|O_LARGEFILE) ) - fprintf(stderr, "flags = %#lx\n", flags); - - /* Set a lock on this FD */ - memset(&l, 0, sizeof l); - l.l_type = F_RDLCK; - l.l_whence = SEEK_SET; - l.l_start = 123; - l.l_len = 456; - - if ( fcntl(fd, F_SETLK, &l) == -1 ) { - perror("F_SETLK"); - exit(1); - } - - /* Eventually, fork and try to conflict with this lock... */ - - return 0; -} - - - diff --git a/klibc/klibc/tests/getopttest.c b/klibc/klibc/tests/getopttest.c deleted file mode 100644 index 90ceaa2c58..0000000000 --- a/klibc/klibc/tests/getopttest.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * getopttest.c - * - * Simple test for getopt, set the environment variable GETOPTTEST - * to give the argument string to getopt() - */ - -#include -#include -#include - -int main(int argc, char * const *argv) -{ - const char *parser; - char showchar[] = "\'?\'"; - int c; - - parser = getenv("GETOPTTEST"); - if ( !parser ) parser = "abzf:o:"; - - do { - c = getopt(argc, argv, parser); - showchar[1] = c; - printf("c = %s, optind = %d (%s), optarg = \"%s\", optopt = \'%c\'\n", - (c == EOF) ? "EOF" : showchar, - optind, argv[optind], optarg, optopt); - } while ( c != -1 ); - - return 0; -} - diff --git a/klibc/klibc/tests/getpagesize.c b/klibc/klibc/tests/getpagesize.c deleted file mode 100644 index bda37e1f6b..0000000000 --- a/klibc/klibc/tests/getpagesize.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include - -int main(void) -{ - printf("getpagesize() = %d\n" - "__getpageshift() = %d\n", - getpagesize(), __getpageshift()); - - return 0; -} diff --git a/klibc/klibc/tests/hello.c b/klibc/klibc/tests/hello.c deleted file mode 100644 index 20457af153..0000000000 --- a/klibc/klibc/tests/hello.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(void) -{ - printf("Hello, World!\n"); - return 0; -} diff --git a/klibc/klibc/tests/idtest.c b/klibc/klibc/tests/idtest.c deleted file mode 100644 index c3c44479c5..0000000000 --- a/klibc/klibc/tests/idtest.c +++ /dev/null @@ -1,14 +0,0 @@ -#include -#include - -int main(void) -{ - printf("pid = %u\n", getpid()); - printf("ppid = %u\n", getppid()); - printf("uid = %u\n", getuid()); - printf("euid = %u\n", geteuid()); - printf("gid = %u\n", getgid()); - printf("egid = %u\n", getegid()); - sleep(10); - return 0; -} diff --git a/klibc/klibc/tests/malloctest.c b/klibc/klibc/tests/malloctest.c deleted file mode 100644 index 64e8e79851..0000000000 --- a/klibc/klibc/tests/malloctest.c +++ /dev/null @@ -1,4145 +0,0 @@ -#include -#include -#include - -#define NCYCLES 4096 - -int sizes[NCYCLES] = { - 11986, - 277806, - 2659, - 46, - 0, - 775553, - 1991, - 21, - 7638, - 250197, - 155828, - 5777, - 9, - 315006, - 900788, - 0, - 24893, - 119996, - 72299, - 171266, - 357, - 560, - 368, - 22952, - 54058, - 12638, - 39155, - 2738, - 217563, - 26853, - 47, - 75, - 1167, - 16917, - 1899, - 2905, - 9337, - 62243, - 14214, - 270523, - 4024, - 21, - 32, - 14892, - 625144, - 13, - 21700, - 8804, - 254147, - 0, - 6, - 836004, - 1718, - 2289, - 15554, - 412857, - 185097, - 806709, - 64, - 18602, - 17064, - 1779, - 78153, - 170600, - 199100, - 546528, - 0, - 21, - 20609, - 16514, - 548196, - 311446, - 53484, - 0, - 551, - 22225, - 24, - 153989, - 457309, - 526833, - 227979, - 757167, - 429560, - 0, - 835, - 1702, - 475275, - 798416, - 753, - 0, - 11126, - 145779, - 2006, - 0, - 8182, - 0, - 569432, - 9671, - 36, - 5523, - 407325, - 0, - 65, - 9293, - 0, - 6793, - 468701, - 73, - 0, - 186236, - 0, - 328405, - 125616, - 508013, - 380519, - 599518, - 83, - 151973, - 466906, - 9029, - 159725, - 1316, - 1, - 911532, - 1508, - 19050, - 972850, - 126, - 439377, - 29, - 37928, - 149628, - 54, - 130248, - 2, - 143, - 0, - 716873, - 3327, - 5, - 116131, - 5124, - 559621, - 2886, - 534, - 186432, - 441, - 7348, - 10331, - 1, - 260935, - 7, - 4370, - 405415, - 2, - 84518, - 1970, - 1, - 281910, - 46, - 274, - 2273, - 370565, - 4190, - 820641, - 577970, - 32809, - 974893, - 398067, - 380698, - 4, - 25978, - 153, - 882668, - 312365, - 9523, - 156421, - 0, - 268143, - 6, - 2, - 42987, - 212, - 12303, - 6723, - 1179, - 0, - 120924, - 3877, - 330421, - 310445, - 39264, - 8, - 85380, - 464716, - 0, - 33657, - 6285, - 0, - 4491, - 229, - 50, - 373197, - 6029, - 19, - 86884, - 243745, - 335656, - 90945, - 38973, - 572950, - 164129, - 0, - 3, - 17, - 13579, - 4448, - 47, - 3, - 132966, - 726249, - 498503, - 256, - 0, - 25841, - 0, - 7, - 945380, - 11872, - 69, - 3799, - 77223, - 1914, - 73, - 810968, - 10223, - 257918, - 184252, - 350, - 8101, - 725, - 9, - 2, - 2089, - 175, - 247, - 185964, - 36517, - 3723, - 313465, - 209, - 1300, - 128071, - 7425, - 2436, - 62, - 13753, - 9514, - 41, - 409141, - 46643, - 20866, - 15664, - 388548, - 84692, - 9549, - 610, - 7213, - 14, - 14930, - 244719, - 4748, - 41682, - 401098, - 102506, - 176535, - 0, - 5133, - 548, - 5234, - 56, - 11101, - 87638, - 336579, - 291705, - 640250, - 768165, - 370, - 2809, - 3, - 0, - 445122, - 47190, - 24885, - 143556, - 84, - 504726, - 610020, - 40355, - 902230, - 4360, - 1747, - 3496, - 489501, - 19, - 801601, - 62189, - 48, - 2645, - 320601, - 27304, - 17740, - 344, - 10, - 991, - 925503, - 0, - 315, - 251, - 3611, - 1756, - 683, - 165, - 380132, - 181101, - 453041, - 892056, - 67191, - 252592, - 32407, - 56242, - 8, - 297173, - 542903, - 830334, - 585236, - 422555, - 44769, - 0, - 68, - 4143, - 38754, - 73539, - 44579, - 94001, - 428537, - 38554, - 106612, - 0, - 182987, - 831731, - 3605, - 752851, - 52, - 72, - 120872, - 963754, - 31, - 764, - 240592, - 99101, - 328538, - 440325, - 12211, - 151282, - 353436, - 2991, - 40710, - 5212, - 5106, - 139122, - 148915, - 498505, - 1366, - 516, - 29190, - 17, - 224208, - 40, - 89, - 19190, - 8, - 25377, - 10029, - 720, - 97963, - 0, - 614, - 244567, - 2113, - 903675, - 8388, - 6, - 390705, - 325006, - 284272, - 108086, - 17, - 2628, - 952530, - 20474, - 898276, - 138661, - 3883, - 903, - 569993, - 376918, - 5849, - 103404, - 794499, - 35388, - 5, - 0, - 961626, - 27415, - 1927, - 92036, - 46241, - 35978, - 7426, - 399884, - 29490, - 252655, - 675971, - 3509, - 54170, - 170790, - 831341, - 134579, - 0, - 790422, - 35, - 930830, - 97394, - 20265, - 670, - 38497, - 1759, - 71209, - 93, - 736, - 11, - 886, - 1961, - 7, - 210607, - 62226, - 186736, - 1518, - 5, - 5, - 13, - 66989, - 442321, - 0, - 607939, - 11253, - 210875, - 495530, - 2, - 221136, - 377663, - 372, - 200658, - 18591, - 129783, - 803411, - 867506, - 757446, - 48836, - 34, - 200, - 114983, - 7287, - 22849, - 226669, - 13, - 0, - 20164, - 7828, - 39, - 49448, - 26740, - 185566, - 9927, - 36192, - 91068, - 338368, - 926, - 27746, - 534794, - 936132, - 2922, - 5, - 183162, - 256846, - 242551, - 134318, - 212959, - 167162, - 470, - 477045, - 532116, - 483794, - 733, - 5335, - 83074, - 4686, - 9567, - 1, - 195100, - 40354, - 87338, - 369, - 800, - 0, - 194504, - 469051, - 363532, - 850574, - 5085, - 167027, - 794511, - 124320, - 303231, - 132195, - 13225, - 46333, - 4313, - 89, - 799, - 51482, - 0, - 26, - 12659, - 1045, - 23621, - 0, - 74926, - 490979, - 6, - 3188, - 9448, - 174730, - 38982, - 102317, - 189621, - 853, - 29227, - 43374, - 423, - 420951, - 686, - 128, - 31291, - 0, - 402819, - 663143, - 55903, - 142, - 2, - 331584, - 197164, - 7, - 671983, - 53, - 5020, - 9782, - 123, - 743407, - 1276, - 1115, - 1169, - 122752, - 824690, - 292030, - 2094, - 144626, - 0, - 297278, - 440, - 742, - 95879, - 17682, - 10654, - 31, - 22183, - 746, - 0, - 0, - 11185, - 28, - 394987, - 36, - 474, - 243749, - 1431, - 56702, - 76, - 15619, - 33071, - 12181, - 158647, - 261786, - 1, - 119783, - 48816, - 6278, - 4121, - 61122, - 69, - 48790, - 345335, - 275917, - 964393, - 424, - 586433, - 20519, - 18156, - 756400, - 27736, - 458706, - 1, - 3286, - 929624, - 1883, - 2, - 1086, - 439501, - 552, - 157132, - 5565, - 105061, - 8199, - 23, - 178797, - 0, - 130644, - 1, - 6952, - 754, - 500, - 647683, - 0, - 959079, - 622561, - 1131, - 559783, - 6862, - 175420, - 408671, - 463461, - 55908, - 606496, - 169, - 49060, - 247, - 953, - 333030, - 0, - 23399, - 29193, - 9303, - 15, - 515402, - 34961, - 365856, - 633043, - 173, - 556089, - 1809, - 12215, - 14, - 316, - 20642, - 9, - 15, - 190391, - 951463, - 25059, - 13654, - 385040, - 4272, - 929033, - 208813, - 35166, - 42849, - 662648, - 254811, - 4230, - 812459, - 681, - 390168, - 5381, - 4662, - 173257, - 478863, - 103, - 89332, - 0, - 0, - 589484, - 19369, - 94, - 9, - 639917, - 1110, - 393, - 101040, - 911, - 152899, - 0, - 2, - 0, - 0, - 335691, - 43694, - 62273, - 200121, - 2250, - 621004, - 149918, - 41063, - 218229, - 0, - 497924, - 16832, - 587071, - 0, - 0, - 729918, - 2, - 808513, - 9417, - 718, - 0, - 2769, - 28704, - 1335, - 734726, - 219157, - 786230, - 981004, - 350788, - 884529, - 0, - 87872, - 34647, - 85469, - 4524, - 339838, - 38228, - 0, - 4151, - 1145, - 0, - 351, - 167956, - 810075, - 689, - 251212, - 583068, - 2929, - 189456, - 2089, - 48749, - 278952, - 77134, - 0, - 0, - 45595, - 281829, - 969602, - 43999, - 69824, - 856982, - 61732, - 336, - 25488, - 213, - 46683, - 1909, - 174097, - 57930, - 91466, - 828418, - 95740, - 378828, - 128065, - 68068, - 0, - 13312, - 26006, - 6760, - 51, - 276081, - 640068, - 634985, - 7131, - 784882, - 790126, - 628585, - 205824, - 764965, - 17793, - 3159, - 649924, - 0, - 37383, - 9919, - 353, - 0, - 149003, - 620629, - 95928, - 2560, - 504343, - 1000, - 32, - 43836, - 407031, - 207, - 800894, - 3222, - 51028, - 7, - 6, - 22010, - 0, - 21174, - 12893, - 824932, - 7305, - 70, - 624258, - 372139, - 21504, - 387996, - 418931, - 914268, - 576, - 0, - 0, - 618224, - 787516, - 133014, - 422, - 383124, - 656318, - 4420, - 6082, - 244813, - 38585, - 3200, - 1, - 2, - 11882, - 113, - 45581, - 13121, - 95475, - 807219, - 8195, - 995116, - 13, - 2146, - 369925, - 60103, - 25, - 125165, - 51300, - 4894, - 173261, - 74186, - 1044, - 122992, - 1243, - 21703, - 26294, - 197, - 333825, - 426872, - 719580, - 3598, - 106, - 0, - 9932, - 61509, - 146, - 721428, - 964781, - 319850, - 573802, - 7458, - 317889, - 0, - 133086, - 87836, - 60496, - 304249, - 1565, - 27, - 42, - 899324, - 189637, - 8648, - 104570, - 901598, - 447765, - 24, - 108, - 120127, - 828626, - 8, - 899514, - 28, - 13, - 7576, - 163390, - 1625, - 3023, - 155175, - 2, - 391, - 1, - 493073, - 398, - 210771, - 26266, - 287999, - 38255, - 249666, - 598202, - 119601, - 216933, - 91205, - 0, - 7247, - 77077, - 565383, - 29102, - 253641, - 48855, - 19722, - 463536, - 40182, - 65393, - 829444, - 598402, - 1590, - 798, - 467, - 834847, - 3007, - 13711, - 0, - 195, - 101662, - 255749, - 129201, - 11965, - 1781, - 13349, - 3100, - 718066, - 99, - 712450, - 888215, - 42503, - 43171, - 494946, - 0, - 2175, - 12387, - 25662, - 78, - 739030, - 0, - 19, - 427526, - 4275, - 5583, - 0, - 2447, - 132398, - 26437, - 3873, - 440035, - 21, - 6, - 35432, - 41523, - 7179, - 712703, - 428868, - 2793, - 6, - 286277, - 1882, - 95116, - 2959, - 86, - 115425, - 81386, - 59836, - 37, - 247598, - 34732, - 249, - 500110, - 5589, - 40319, - 575, - 12145, - 385829, - 565600, - 582150, - 92, - 223209, - 0, - 910, - 1048, - 47329, - 90944, - 235, - 8739, - 686685, - 1753, - 126, - 434, - 609477, - 25021, - 6610, - 52675, - 4, - 717846, - 150864, - 418583, - 17751, - 513794, - 181362, - 329556, - 10426, - 717019, - 457, - 616, - 388984, - 17, - 8338, - 59531, - 32, - 99565, - 376146, - 134578, - 966, - 0, - 0, - 174, - 2105, - 555, - 8990, - 298, - 169932, - 247281, - 240918, - 298655, - 158743, - 15994, - 95708, - 51, - 2985, - 4294, - 731934, - 185640, - 1483, - 87, - 742033, - 9, - 1345, - 3680, - 133530, - 9355, - 800111, - 28508, - 0, - 369, - 31681, - 24, - 8237, - 313380, - 4732, - 275423, - 951592, - 0, - 41381, - 225515, - 393004, - 526, - 187, - 19515, - 6006, - 28923, - 310151, - 2390, - 374, - 0, - 19142, - 72, - 114, - 193305, - 24035, - 397067, - 18, - 14839, - 3473, - 164, - 104622, - 378958, - 2218, - 0, - 89053, - 105183, - 312265, - 82146, - 147210, - 3419, - 5178, - 34948, - 46836, - 41319, - 842825, - 595972, - 0, - 249625, - 325, - 608, - 372328, - 119634, - 7504, - 920214, - 7302, - 444532, - 359213, - 27265, - 1755, - 48, - 126799, - 651270, - 818220, - 799493, - 724024, - 64047, - 73699, - 206999, - 209, - 1581, - 0, - 42937, - 301144, - 73416, - 0, - 242058, - 29660, - 3, - 34709, - 162719, - 2863, - 3992, - 5212, - 151814, - 3092, - 198001, - 44331, - 36, - 407, - 364771, - 1349, - 502772, - 214726, - 607, - 388583, - 137660, - 337124, - 13279, - 10549, - 943075, - 164068, - 19157, - 38443, - 26351, - 0, - 67167, - 735, - 46486, - 130305, - 232330, - 744, - 882337, - 2, - 69275, - 126354, - 9370, - 2845, - 299, - 38988, - 37834, - 0, - 306433, - 9139, - 237132, - 0, - 500, - 13462, - 373684, - 107453, - 381924, - 347915, - 4329, - 1668, - 3960, - 370661, - 3614, - 636048, - 0, - 487449, - 64925, - 333894, - 11, - 52192, - 531200, - 155554, - 461, - 1547, - 994361, - 11955, - 321056, - 37425, - 14249, - 69151, - 621862, - 174, - 79607, - 34, - 77577, - 13723, - 267550, - 13801, - 698, - 12, - 171556, - 57354, - 676845, - 0, - 24965, - 908955, - 570483, - 0, - 296387, - 983966, - 85012, - 130298, - 151946, - 384474, - 731455, - 150699, - 772, - 216131, - 346, - 130935, - 3472, - 18, - 426045, - 677262, - 808, - 17030, - 5188, - 0, - 491153, - 67299, - 19, - 60342, - 69, - 0, - 76478, - 95763, - 0, - 28778, - 147869, - 335927, - 27846, - 2163, - 22750, - 162, - 23, - 11391, - 469099, - 5852, - 63, - 0, - 0, - 22193, - 165, - 489007, - 9249, - 12477, - 2841, - 223532, - 13877, - 173, - 3570, - 45477, - 233073, - 23296, - 64377, - 4910, - 8, - 76246, - 411147, - 287411, - 10450, - 3667, - 1, - 500933, - 31363, - 257, - 1705, - 6036, - 49934, - 13738, - 13485, - 61608, - 561978, - 76493, - 16377, - 1817, - 0, - 235600, - 0, - 16347, - 680478, - 5115, - 895607, - 138270, - 369912, - 53110, - 0, - 647083, - 85, - 458681, - 163227, - 52767, - 196, - 267719, - 14047, - 147293, - 814457, - 174896, - 0, - 34138, - 36, - 21575, - 3, - 0, - 0, - 38391, - 2597, - 2, - 1433, - 3807, - 36476, - 287, - 141530, - 29389, - 495655, - 30014, - 0, - 550766, - 11958, - 348, - 226760, - 15, - 251353, - 675788, - 518308, - 215, - 81987, - 409862, - 559596, - 114283, - 4925, - 0, - 17, - 14221, - 0, - 162, - 766370, - 4898, - 998, - 493, - 138418, - 265159, - 12152, - 5229, - 1204, - 1814, - 432530, - 2889, - 144, - 1149, - 35886, - 636931, - 6640, - 1508, - 414118, - 858, - 20039, - 17398, - 3, - 5094, - 6, - 13996, - 6754, - 362, - 451487, - 11471, - 7896, - 330009, - 244269, - 99928, - 0, - 14311, - 9949, - 15251, - 283923, - 123754, - 188360, - 93902, - 854384, - 548001, - 531788, - 26298, - 328479, - 941, - 246535, - 106320, - 28769, - 440, - 4, - 61262, - 55615, - 170, - 989327, - 692534, - 8063, - 445842, - 4434, - 255349, - 117781, - 6, - 9249, - 136216, - 38165, - 307012, - 12, - 2341, - 18062, - 371882, - 662154, - 12623, - 176847, - 332220, - 590935, - 33682, - 0, - 121374, - 67, - 46841, - 495890, - 640, - 19, - 14737, - 11032, - 17, - 5993, - 302562, - 827710, - 165346, - 49607, - 87863, - 308513, - 735300, - 1914, - 2900, - 207308, - 9068, - 83494, - 179, - 417, - 41605, - 74681, - 652171, - 4013, - 29811, - 13966, - 8136, - 78, - 61182, - 674187, - 0, - 331121, - 0, - 18559, - 386, - 77, - 348439, - 975358, - 18, - 33700, - 47396, - 204751, - 2350, - 26503, - 0, - 83653, - 446, - 10844, - 485, - 9241, - 88347, - 232419, - 936900, - 43250, - 2, - 26112, - 811955, - 20723, - 102069, - 42255, - 8431, - 119508, - 4080, - 13565, - 12, - 46110, - 62096, - 638777, - 44025, - 152985, - 13362, - 3, - 12331, - 193337, - 56419, - 14593, - 3837, - 282314, - 403454, - 48589, - 135, - 18350, - 2160, - 90, - 918216, - 7083, - 105534, - 742826, - 399028, - 1470, - 23770, - 480, - 677884, - 340472, - 107406, - 0, - 5002, - 445, - 748948, - 534012, - 592464, - 6539, - 819632, - 3138, - 4, - 39397, - 229683, - 12204, - 2439, - 65131, - 817226, - 22596, - 0, - 1046, - 94638, - 0, - 95403, - 1230, - 790056, - 19976, - 43085, - 14251, - 139187, - 20232, - 693, - 3058, - 27654, - 65690, - 40948, - 15001, - 21089, - 14425, - 322459, - 13571, - 228154, - 536814, - 761221, - 28030, - 2322, - 921, - 1, - 1137, - 187815, - 8, - 34911, - 4527, - 15, - 46, - 78801, - 0, - 73605, - 44, - 28233, - 1370, - 73409, - 198159, - 66586, - 3, - 2576, - 15, - 35460, - 263237, - 44997, - 2873, - 240, - 1781, - 269, - 46, - 272778, - 28404, - 8232, - 417073, - 234591, - 9, - 720349, - 1176, - 16195, - 0, - 9705, - 0, - 14, - 947048, - 163, - 76288, - 1115, - 267020, - 3416, - 414217, - 441004, - 95131, - 765002, - 6196, - 9069, - 27017, - 137039, - 65247, - 266489, - 484945, - 187008, - 45405, - 5700, - 9, - 7751, - 12, - 294, - 3093, - 6350, - 103303, - 6045, - 252345, - 140207, - 22390, - 234867, - 443326, - 1, - 0, - 89972, - 8637, - 427150, - 22146, - 0, - 310432, - 390333, - 10461, - 1632, - 31403, - 908653, - 0, - 6543, - 163479, - 67608, - 195543, - 315889, - 822964, - 383536, - 954954, - 1619, - 241, - 96053, - 104556, - 767302, - 2469, - 12, - 164330, - 78, - 141, - 170519, - 268214, - 53338, - 48342, - 721, - 58980, - 4345, - 1, - 856265, - 87289, - 57219, - 775679, - 123992, - 695804, - 113025, - 832, - 117420, - 16634, - 352, - 24729, - 14973, - 25622, - 131290, - 0, - 22, - 87740, - 5917, - 533, - 2934, - 34261, - 9174, - 0, - 1656, - 764587, - 54652, - 35597, - 36389, - 577889, - 63957, - 26808, - 34556, - 56, - 15641, - 137, - 1, - 3, - 11724, - 197397, - 39027, - 87902, - 320, - 791479, - 7, - 487864, - 0, - 433, - 25733, - 6956, - 15407, - 312557, - 526302, - 383019, - 340215, - 96, - 276158, - 6493, - 135613, - 2000, - 1218, - 930, - 276808, - 273249, - 8896, - 397, - 735095, - 20648, - 2079, - 5349, - 205, - 356313, - 841954, - 8255, - 266874, - 0, - 965, - 287993, - 1549, - 207833, - 75, - 178180, - 39072, - 0, - 43254, - 3847, - 227, - 2712, - 161043, - 463264, - 74720, - 795789, - 12, - 6812, - 202804, - 29379, - 64241, - 132121, - 790622, - 493588, - 0, - 48, - 147352, - 925197, - 38149, - 18380, - 0, - 270280, - 633, - 3373, - 31294, - 7830, - 0, - 0, - 11371, - 56143, - 5393, - 74724, - 495109, - 0, - 18993, - 21524, - 0, - 53889, - 400509, - 204563, - 0, - 11625, - 9635, - 0, - 1678, - 12096, - 59, - 817112, - 10002, - 128209, - 11593, - 17313, - 15200, - 106796, - 261401, - 707077, - 0, - 314030, - 798591, - 14175, - 5668, - 2766, - 0, - 566, - 5543, - 24112, - 154482, - 5642, - 0, - 38410, - 3, - 4, - 700724, - 25024, - 5, - 407, - 564150, - 672, - 143, - 2049, - 574708, - 65858, - 213412, - 3797, - 511, - 30907, - 1212, - 765, - 2127, - 481, - 130048, - 113816, - 39861, - 153169, - 503378, - 523944, - 111, - 55083, - 698, - 275, - 3, - 3195, - 1657, - 0, - 317881, - 6672, - 543, - 153011, - 77240, - 9338, - 889850, - 29518, - 872485, - 181927, - 376086, - 266, - 409, - 4, - 14856, - 31943, - 2448, - 8, - 75, - 383097, - 294366, - 0, - 173084, - 753160, - 66457, - 725783, - 51, - 127651, - 1073, - 12598, - 140080, - 0, - 296375, - 581720, - 217346, - 8272, - 2051, - 185390, - 520645, - 1260, - 13873, - 168040, - 19690, - 103347, - 295011, - 548404, - 48, - 4, - 916417, - 1948, - 621365, - 263245, - 2792, - 86803, - 181193, - 558081, - 50907, - 442770, - 51448, - 340276, - 1346, - 607, - 459627, - 0, - 30, - 73298, - 15389, - 12264, - 2719, - 2936, - 143043, - 209970, - 0, - 42, - 6657, - 317419, - 0, - 32622, - 524000, - 0, - 310331, - 303778, - 268710, - 9, - 10410, - 25343, - 949506, - 784353, - 3861, - 46823, - 251292, - 75008, - 269798, - 87731, - 112813, - 571679, - 385, - 3, - 2811, - 36025, - 9243, - 935128, - 906, - 10688, - 25, - 86757, - 307, - 55, - 22, - 2, - 61, - 620426, - 484530, - 633806, - 0, - 1342, - 9293, - 992181, - 503, - 195433, - 46150, - 893091, - 3207, - 2865, - 72894, - 830299, - 355, - 327479, - 0, - 35573, - 3068, - 15699, - 31187, - 55378, - 416067, - 91721, - 159, - 0, - 255139, - 2104, - 19, - 606757, - 323, - 902659, - 365655, - 400, - 903, - 408, - 385, - 21774, - 701290, - 234426, - 17020, - 950, - 0, - 0, - 429, - 1245, - 405871, - 1097, - 280634, - 74, - 158233, - 1583, - 180333, - 42114, - 575973, - 539327, - 59252, - 121928, - 165, - 148501, - 55757, - 7494, - 127728, - 7832, - 68504, - 619770, - 70995, - 312816, - 7307, - 38265, - 46248, - 363304, - 269442, - 77112, - 448331, - 910442, - 474418, - 152752, - 752, - 104912, - 408492, - 691709, - 632381, - 48519, - 20524, - 344294, - 14670, - 0, - 21607, - 81162, - 181458, - 0, - 908322, - 7261, - 10888, - 58054, - 1788, - 970933, - 5925, - 121553, - 36152, - 588267, - 23615, - 1850, - 30728, - 3599, - 1319, - 6027, - 0, - 32141, - 984156, - 436781, - 15003, - 621407, - 9412, - 562911, - 189740, - 377895, - 656800, - 197, - 14413, - 99382, - 384, - 11480, - 0, - 86118, - 881961, - 1905, - 82061, - 4140, - 741153, - 26, - 687, - 12251, - 10945, - 209267, - 220602, - 135881, - 6, - 237945, - 158, - 5, - 76303, - 81344, - 986042, - 956063, - 30282, - 186055, - 357802, - 12492, - 577476, - 838, - 0, - 11, - 117602, - 0, - 187928, - 96860, - 4268, - 3478, - 818264, - 1649, - 17175, - 272, - 158951, - 440987, - 677594, - 14935, - 37953, - 0, - 198, - 160404, - 12, - 287803, - 2386, - 10, - 271663, - 319152, - 361322, - 68370, - 428, - 182707, - 387429, - 1152, - 360065, - 25218, - 2790, - 42228, - 13, - 110942, - 452491, - 1, - 665638, - 2308, - 1196, - 87306, - 66, - 219, - 0, - 130736, - 334, - 605, - 5979, - 2681, - 0, - 123463, - 11219, - 283681, - 19269, - 553, - 6217, - 130965, - 714409, - 242, - 674833, - 237581, - 133284, - 683, - 1758, - 278193, - 518726, - 44, - 420361, - 325228, - 14955, - 10, - 11994, - 64157, - 1937, - 20214, - 848, - 27804, - 151341, - 79236, - 316393, - 158883, - 1196, - 334, - 22797, - 185955, - 13857, - 397357, - 7948, - 6038, - 0, - 2621, - 16, - 155267, - 44809, - 9171, - 21328, - 12212, - 40200, - 2600, - 439, - 804014, - 10938, - 96135, - 43696, - 158715, - 4, - 284558, - 191, - 270254, - 7923, - 880603, - 21032, - 107700, - 172, - 700823, - 5613, - 78816, - 258290, - 214398, - 821856, - 295325, - 0, - 1, - 23559, - 63895, - 21249, - 717490, - 956952, - 944819, - 793, - 356, - 757716, - 111773, - 394826, - 25665, - 4358, - 640216, - 1152, - 37175, - 150192, - 106071, - 28992, - 67, - 1685, - 134242, - 2, - 102045, - 1457, - 419589, - 6789, - 677, - 94675, - 11300, - 2595, - 8, - 926535, - 265194, - 0, - 886048, - 246242, - 1494, - 191, - 169985, - 649765, - 0, - 201, - 1069, - 679163, - 16627, - 274639, - 84438, - 3, - 1301, - 247496, - 5879, - 710904, - 403652, - 958241, - 361, - 139732, - 6042, - 15985, - 2378, - 267031, - 223767, - 9656, - 241717, - 33863, - 14314, - 205697, - 1274, - 168000, - 621777, - 837913, - 89654, - 659829, - 69, - 503884, - 432717, - 70443, - 110891, - 19655, - 132432, - 620401, - 428, - 0, - 425662, - 0, - 0, - 0, - 194489, - 7601, - 26870, - 0, - 63, - 594, - 12278, - 582479, - 213723, - 424489, - 96446, - 990664, - 46966, - 44137, - 829810, - 104, - 19707, - 16, - 0, - 2499, - 167075, - 140972, - 249283, - 6620, - 68368, - 856414, - 9255, - 14315, - 0, - 11432, - 24329, - 216463, - 299556, - 818401, - 246607, - 697733, - 229, - 144, - 389394, - 664634, - 0, - 19393, - 657903, - 52912, - 952177, - 536931, - 187271, - 17687, - 970155, - 232571, - 234016, - 159980, - 13510, - 32952, - 0, - 0, - 24132, - 18806, - 15624, - 28364, - 472126, - 626978, - 599, - 112843, - 502933, - 915660, - 63920, - 0, - 84, - 10899, - 904823, - 126, - 469132, - 590052, - 195831, - 443113, - 294149, - 15944, - 2271, - 282974, - 211, - 0, - 22934, - 82283, - 49973, - 41707, - 87530, - 0, - 910528, - 0, - 36029, - 423337, - 817512, - 223671, - 27800, - 398847, - 198528, - 1, - 560679, - 518270, - 23033, - 501059, - 0, - 3909, - 272062, - 261581, - 187, - 52043, - 334, - 24354, - 3947, - 8549, - 37863, - 328851, - 963771, - 1, - 3930, - 82416, - 6, - 2943, - 122101, - 82577, - 85, - 89540, - 5135, - 109236, - 18297, - 1, - 177371, - 4541, - 769577, - 178, - 417, - 960566, - 33803, - 911651, - 248160, - 153725, - 43981, - 809174, - 116, - 486900, - 4842, - 148490, - 131534, - 4347, - 239949, - 984096, - 749756, - 429499, - 2794, - 78209, - 18812, - 21111, - 490, - 328042, - 12, - 132119, - 505103, - 353148, - 0, - 373656, - 951244, - 491, - 355778, - 30620, - 317, - 60175, - 220, - 214496, - 41249, - 5169, - 78367, - 506804, - 0, - 1368, - 407, - 295126, - 1288, - 86, - 97614, - 61640, - 244723, - 3, - 0, - 869827, - 527246, - 52, - 107036, - 240739, - 780281, - 113084, - 62009, - 740343, - 483201, - 8649, - 16419, - 1, - 801574, - 95524, - 326126, - 26912, - 877040, - 10262, - 5895, - 0, - 132633, - 59171, - 306347, - 702701, - 196245, - 12642, - 32723, - 24608, - 30287, - 45775, - 18281, - 7587, - 144532, - 5, - 35, - 99862, - 215127, - 170875, - 61461, - 77790, - 5, - 0, - 129358, - 0, - 105084, - 21399, - 42233, - 85397, - 480654, - 555988, - 89575, - 42346, - 20004, - 11102, - 21321, - 185, - 379267, - 849147, - 121514, - 3388, - 33662, - 12, - 164898, - 226, - 274, - 385003, - 365052, - 693376, - 41245, - 9010, - 41594, - 89835, - 10490, - 272, - 128437, - 0, - 122648, - 277, - 116505, - 38372, - 4, - 1376, - 0, - 46317, - 139368, - 36398, - 193899, - 30632, - 26371, - 7548, - 367643, - 954849, - 25889, - 36567, - 176, - 140631, - 4690, - 975031, - 80965, - 500471, - 8442, - 43, - 27758, - 301501, - 3797, - 80, - 384440, - 928477, - 4960, - 24566, - 33245, - 14638, - 228354, - 54347, - 861285, - 12841, - 2, - 157402, - 646747, - 53763, - 1, - 214732, - 49471, - 49757, - 998, - 201135, - 566, - 73512, - 194240, - 391773, - 21510, - 13, - 829894, - 783200, - 565329, - 2101, - 12, - 191043, - 1621, - 18443, - 279, - 294135, - 526503, - 729735, - 4639, - 444138, - 5835, - 12372, - 46362, - 1543, - 870907, - 83262, - 0, - 38331, - 95, - 1194, - 909, - 8053, - 453066, - 845561, - 411, - 3229, - 1, - 158, - 1431, - 835137, - 21774, - 7298, - 148388, - 224649, - 379318, - 520138, - 39781, - 172130, - 362634, - 487495, - 51957, - 158, - 1770, - 7, - 18010, - 1063, - 171484, - 19924, - 279867, - 469956, - 189785, - 0, - 814, - 60580, - 944349, - 18743, - 553235, - 0, - 95475, - 99, - 0, - 5, - 42623, - 178418, - 398940, - 5700, - 69023, - 5786, - 0, - 10531, - 551, - 86308, - 63451, - 32704, - 176903, - 0, - 251689, - 11589, - 25711, - 43437, - 1431, - 304, - 52965, - 34816, - 268688, - 47756, - 825323, - 122608, - 81246, - 69974, - 360515, - 99973, - 143015, - 5063, - 4499, - 34459, - 171982, - 677943, - 489082, - 257515, - 3765, - 5, - 7416, - 602206, - 74122, - 3, - 686204, - 5493, - 28901, - 11349, - 549668, - 257082, - 82000, - 17031, - 1517, - 7442, - 937160, - 722, - 0, - 72952, - 377192, - 438266, - 555, - 31436, - 284, - 56390, - 0, - 585856, - 27635, - 519344, - 126131, - 360273, - 845073, - 0, - 191965, - 55652, - 23, - 112773, - 639025, - 84749, - 0, - 330822, - 7173, - 126217, - 871, - 112112, - 0, - 664, - 530474, - 1, - 379564, - 172617, - 647308, - 0, - 356, - 17, - 84345, - 457, - 0, - 8, - 6, - 136602, - 634424, - 0, - 177298, - 100726, - 91661, - 383792, - 1665, - 43583, - 15775, - 4083, - 4277, - 345749, - 969599, - 65804, - 19327, - 0, - 352514, - 4225, - 9, - 103767, - 0, - 0, - 148436, - 850, - 33, - 2146, - 20153, - 50, - 9063, - 50329, - 348379, - 2569, - 83697, - 37073, - 715486, - 629, - 4753, - 442, - 259203, - 287223, - 48625, - 9, - 70184, - 45946, - 144947, - 0, - 60285, - 28640, - 7626, - 134159, - 33, - 12452, - 150566, - 348293, - 124426, - 353952, - 11, - 22, - 776742, - 29072, - 132168, - 254533, - 319957, - 1602, - 1659, - 209341, - 32847, - 92392, - 753005, - 1392, - 10271, - 28557, - 6717, - 941745, - 0, - 0, - 0, - 78645, - 45320, - 11193, - 1448, - 130626, - 377907, - 795535, - 24285, - 26094, - 266691, - 64449, - 77400, - 191410, - 1, - 1346, - 25224, - 489637, - 47052, - 248592, - 76689, - 0, - 7722, - 47285, - 3152, - 285577, - 0, - 149366, - 264346, - 1, - 208602, - 320459, - 131771, - 1421, - 350, - 723283, - 714934, - 0, - 566439, - 11656, - 34189, - 125484, - 943273, - 15, - 7789, - 0, - 7427, - 464278, - 680924, - 651102, - 87794, - 39640, - 838644, - 964500, - 1, - 1765, - 272604, - 10, - 837347, - 44845, - 130, - 163357, - 4150, - 403331, - 839132, - 44876, - 272792, - 592527, - 57225, - 128826, - 2915, - 2, - 3570, - 2410, - 199, - 171358, - 5931, - 53620, - 55299, - 1868, - 24123, - 165, - 346513, - 16527, - 133, - 517412, - 195700, - 730365, - 896209, - 152760, - 24577, - 65, - 8218, - 349642, - 901345, - 5127, - 5102, - 238318, - 955, - 631921, - 12218, - 55101, - 930381, - 219503, - 469237, - 132, - 16701, - 494, - 199729, - 0, - 32139, - 314, - 172, - 2947, - 106997, - 4871, - 236, - 6146, - 1843, - 128, - 0, - 254240, - 2964, - 14825, - 60624, - 2108, - 286953, - 654931, - 0, - 0, - 396587, - 19852, - 70311, - 363561, - 282, - 17966, - 924254, - 104173, - 130816, - 179096, - 105466, - 136, - 618261, - 358433, - 25587, - 49357, - 102, - 133746, - 620776, - 17084, - 406881, - 802675, - 349, - 69, - 8761, - 278482, - 16336, - 128, - 160096, - 25857, - 280, - 39639, - 726299, - 293905, - 4621, - 41, - 649, - 3655, - 269286, - 578026, - 0, - 11156, - 1, - 744858, - 531, - 48155, - 28435, - 7991, - 447, - 10201, - 379341, - 0, - 5773, - 0, - 295, - 228592, - 331155, - 104089, - 628069, - 29693, - 22, - 13, - 0, - 0, - 554349, - 6082, - 238, - 23, - 151873, - 805937, - 0, - 194076, - 6450, - 3, - 128322, - 69149, - 95511, - 86, - 844368, - 415964, - 51985, - 308686, - 553403, - 624943, - 365800, - 4, - 120263, - 91239, - 195248, - 58010, - 19, - 415112, - 136806, - 42, - 571848, - 55306, - 29454, - 3, - 144926, - 189, - 0, - 161943, - 592155, - 10930, - 279297, - 56932, - 957430, - 10244, - 190296, - 807209, - 781, - 1466, - 235055, - 33, - 196, - 58280, - 436, - 408649, - 221, - 711143, - 10495, - 2441, - 275720, - 2, - 15391, - 132107, - 102610, - 688549, - 237142, - 3041, - 14, - 308623, - 0, - 0, - 287, - 295147, - 61443, - 229, - 207, - 2051, - 64, - 13479, - 55656, - 570134, - 50387, - 225869, - 20615, - 258465, - 64932, - 112461, - 164521, - 907269, - 758563, - 22901, - 0, - 7944, - 48, - 154921, - 2784, - 548608, - 0, - 12524, - 142556, - 0, - 13882, - 507227, - 316598, - 987551, - 0, - 894687, - 1964, - 364, - 10316, - 440269, - 9, - 776723, - 72288, - 54604, - 185101, - 142, - 362, - 11679, - 77, - 79, - 529321, - 364, - 42387, - 0, - 570879, - 417503, - 604871, - 578806, - 1102, - 66584, - 615440, - 146744, - 19441, - 170478, - 144069, - 36170, - 145376, - 842283, - 193612, - 3, - 359429, - 368596, - 0, - 11064, - 7726, - 229410, - 63569, - 67402, - 91, - 203201, - 213513, - 0, - 704479, - 1325, - 0, - 385154, - 13, - 806763, - 197132, - 6183, - 45760, - 99377, - 0, - 972077, - 4043, - 195700, - 34229, - 0, - 154027, - 633, - 6, - 32142, - 0, - 29, - 620842, - 14099, - 495465, - 26937, - 0, - 0, - 432, - 227704, - 0, - 63, - 0, - 19, - 863491, - 20, - 1, - 160713, - 24607, - 85800, - 3566, - 37854, - 81913, - 121573, - 816, - 20, - 133253, - 692231, - 4869, - 255175, - 15028, - 9383, - 542877, - 4608, - 369610, - 243635, - 385285, - 391565, - 286009, - 0, - 61685, - 416318, - 208, - 67019, - 788416, - 88, - 165056, - 0, - 439589, - 160, - 105528, - 152, - 160624, - 865, - 390229, - 714086, - 6007, - 30229, - 481306, - 173266, - 1135, - 2266, - 8, - 59, - 104722, - 647885, - 579471, - 21309, - 230834, - 140278, - 31858, - 3288, - 36011, - 151387, - 594217, - 22439, - 418638, - 76859, - 29363, - 154809, - 275533, - 39, - 472996, - 22076, - 7481, - 155705, - 10406, - 214779, - 223, - 1312, - 16391, - 17203, - 55605, - 44579, - 69332, - 303, - 19217, - 26288, - 126212, - 316, - 98, - 114, - 37382, - 137591, - 439749, - 12972, - 54, - 154879, - 0, - 102680, - 7639, - 309119, - 263550, - 766, - 1124, - 56, - 686608, - 123767, - 518054, - 18, - 672385, - 3161, - 53791, - 26769, - 451670, - 61, - 148245, - 2713, - 96725, - 4794, - 33247, - 297946, - 33380, - 0, - 20034, - 5647, - 17227, - 76444, - 0, - 21011, - 675, - 13226, - 1027, - 990842, - 124459, - 34406, - 53, - 69540, - 134, - 0, - 168521, - 6, - 4075, - 1137, - 63740, - 220, - 10434, - 1171, - 28950, - 0, - 79680, - 993269, - 355622, - 15, - 0, - 1452, - 21667, - 22208, - 494484, - 33984, - 691308, - 10, - 693686, - 196, - 9, - 70676, - 157660, - 775, - 165, - 468432, - 1083, - 515154, - 778344, - 70241, - 42, - 40931, - 277125, - 43837, - 301881, - 1332, - 56712, - 9013, - 1299, - 7564, - 31092, - 1975, - 113517, - 833295, - 245021, - 36503, - 23586, - 149327, - 89175, - 10512, - 484348, - 187793, - 954609, - 53199, - 792175, - 126, - 12369, - 405, - 0, - 6614, - 322857, - 166, - 571874, - 60839, - 180975, - 146722, - 411565, - 1536, - 1, - 11, - 116230, - 60514, - 9003, - 2325, - 43763, - 63, - 355553, - 0, - 389876, - 14672, - 11526, - 160209, - 65, - 10283, - 966, - 10, - 58333, - 129920, - 2850, - 83346, - 0, - 14, - 295819, - 679550, - 143928, - 29489, - 82324, - 36558, - 267118, - 143313, - 90107, - 12789, - 951, - 0, - 187619, - 295317, - 82, - 41326, - 309682, - 907327, - 809358, - 324, - 139157, - 12, - 78366, - 671811, - 354, - 131, - 70525, - 35830, - 281018, - 91456, - 92523, - 54874, - 48273, - 2423, - 0, - 81, - 361314, - 374811, - 394758, - 15350, - 795, - 3, - 16779, - 796684, - 477556, - 73927, - 26643, - 119281, - 62692, - 17039, - 454778, - 952, - 48973, - 19529, - 151, - 239121, - 93509, - 254702, - 1307, - 10029, - 7973, - 546706, - 806644, - 680517, - 223, - 0, - 2, - 0, - 402421, - 619193, - 15685, - 2, - 939715, - 519198, - 0, - 444312, - 23204, - 35669, - 32467, - 0, - 799725, - 5883, - 2217, - 32292, - 355557, - 22179, - 1066, - 15704, - 610, - 37819, - 403626, - 83101, - 10989, - 311607, - 43394, - 72576, - 335450, - 85964, - 73734, - 105142, - 38292, - 0, - 181516, - 33959, - 611797, - 221838, - 5931, - 7666, - 1044, - 477173, - 13591, - 405, - 521, - 190653, - 184191, - 0, - 215, - 847195, - 22782, - 11912, - 27345, - 2572, - 0, - 566350, - 7, - 52302, - 26641, - 587826, - 127, - 2, - 44449, - 153198, - 14, - 926, - 285, - 0, - 938196, - 52255, - 9153, - 807, - 12548, - 358324, - 18521, - 104956, - 42738, - 116, - 135772, - 189554, - 38, - 54, - 36, - 89768, - 17170, - 75, - 34502, - 45489, - 172796, - 971810, - 16153, - 499280, - 1, - 879663, - 53830, - 186, - 539, - 242059, - 268, - 402, - 2732, - 68057, - 18463, - 198560, - 10068, - 591753, - 6116, - 699280, - 1, - 0, - 114258, - 277, - 149, - 283821, - 352561, - 88172, - 684476, - 3450, - 87, - 99936, - 3155, - 72983, - 31619, - 8832, - 58666, - 0, - 59023, - 306091, - 352150, - 255063, - 992708, - 23, - 4896, - 18165, - 424401, - 227613, - 5175, - 347, - 139846, - 11962, - 714, - 3501, - 82367, - 11110, - 10, - 12874, - 0, - 0, - 222712, - 169, - 123281, - 0, - 268149, - 101, - 17446, - 4262, - 489, - 0, - 30, - 0, - 277235, - 28, - 71, - 23, - 61219, - 953631, - 477548, - 662491, - 273, - 44787, - 4130, - 14483, - 470571, - 735977, - 406648, - 815898, - 5985, - 462696, - 937510, - 9, - 0, - 111727, - 93, - 331435, - 336402, - 78690, - 49, - 0, - 87422, - 1242, - 0, - 8783, - 8540, - 314, - 33411, - 805718, - 247, - 6870, - 523743, - 8323, - 612593, - 430, - 354048, - 264913, - 83, - 114063, - 202825, - 35202, - 32823, - 185554, - 85760, - 45159, - 5971, - 267733, - 4545, - 116, - 6910, - 24833, - 218, - 922362, - 221735, - 740, - 7112, - 31, - 15739, - 523589, - 4, - 95996, - 936, - 823951, - 0, - 88, - 160, - 375419, - 663627, - 3741, - 22896, - 114326, - 415962, - 880100, - 6222, - 18650, - 35524, - 195076, - 506, - 451640, - 541336, - 70903, - 3946, - 1, - 61765, - 1, - 2696, - 753129, - 289, - 225234, - 378692, - 1703, - 6751, - 1, - 820, - 7677, - 589, - 12412, - 317, - 69, - 226031, - 134523, - 318253, - 66677, - 111025, - 96, - 0, - 96, - 523528, - 1017, - 0, - 258740, - 420947, - 4600, - 400684, - 12174, - 11770, - 52, - 5959, - 82658, - 531787, - 202, - 548430, - 964, - 1054, - 34, - 96897, - 25445, - 47609, - 386052, - 97004, - 1935, - 30074, - 13458, - 494105, - 54, - 65575, - 594698, - 2340, - 20259, - 84, - 2774, - 534, - 972534, - 115057, - 0, - 11379, - 0, - 271, - 266305, - 132595, - 2, - 773561, - 52365, - 3585, - 351, - 148206, - 778964, - 149379, - 596, - 284914, - 2900, - 35596, - 1547, - 212027, - 8100, - 12248, - 3013, - 1814, - 183415, - 273633, - 15812, - 0, - 966680, - 14830, - 134309, - 0, - 416450, - 206611, - 816, - 82258, - 9873, - 3155, - 53485, - 779805, - 107690, - 254475, - 102504, - 72495, - 17301, - 472130, - 6895, - 245420, - 7299, - 110508, - 27776, - 246134, - 0, - 330853, - 0, - 271767, - 61886, - 24123, - 309681, - 58325, - 608865, - 20666, - 87349, - 229228, - 246, - 457768, - 5374, - 69643, - 148, - 618375, - 45236, - 352565, - 133904, - 152, - 10688, - 18, - 0, - 276036, - 493281, - 11156, - 12566, - 5762, - 113, - 24179, - 98, - 327, - 893, - 209180, - 140805, - 0, - 2341, - 66309, - 30305, - 630559, - 3682, - 152767, - 265822, - 142868, - 1535, - 728603, - 69081, - 353151, - 237995, - 1075, - 925071, - 86, - 6748, - 0, - 684186, - 735, - 13793, - 4790, - 73175, - 69677, - 367627, - 238650, - 303543, - 1, - 26059, - 21392, - 10, - 288609, - 0, - 76345, - 158496, - 7000, - 1865, - 20385, - 0, - 54213, - 9948, - 102667, - 6963, - 71, - 555744, - 5626, - 2512, - 1124, - 7171, - 628, - 29225, - 321687, - 61519, - 4, - 8352, - 9156, -}; - -char *pointers[NCYCLES]; - -int main(void) -{ - int r, i, j, sp, sq; - char *p, *q, *ep, *eq; - int ok; - int err = 0; - - for ( r = 0 ; r < 4 ; r++ ) { - for ( i = 0 ; i < NCYCLES ; i++ ) { - pointers[i] = p = malloc(sp = sizes[i]); - ep = p+sp; - ok = 1; - for ( j = 0 ; j < i ; j++ ) { - q = pointers[j]; - sq = sizes[j]; - eq = q+sq; - - if ( (p < q && ep > q) || (p >= q && p < eq) ) { - ok = 0; - err = 1; - break; - } - } - printf("Allocated %6d bytes at %p, ok = %d\n", sp, p, ok); - - if ( p ) - memset(p, 0xee, sp); /* Poison this memory */ - } - - for ( i = 0 ; i < NCYCLES ; i++ ) { - free(pointers[i]); - printf("Freed %6d bytes at %p\n", sizes[i], pointers[i]); - } - } - - return err; -} - diff --git a/klibc/klibc/tests/malloctest2.c b/klibc/klibc/tests/malloctest2.c deleted file mode 100644 index b392046929..0000000000 --- a/klibc/klibc/tests/malloctest2.c +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include - -#define NCYCLES 32768 -#define NSLOTS 4096 - -struct slot { - char *ptr; - size_t size; -}; - -struct slot s[NSLOTS]; - -int main(void) -{ - size_t sp, sq; - char *p, *ep, *q, *eq; - int r, i, j; - int ok; - int err = 0; - - for ( r = 0 ; r < NCYCLES ; r++ ) { - i = lrand48() % NSLOTS; - - if ( s[i].ptr ) { - free(s[i].ptr); - printf("Freed %8zu bytes at %p\n", s[i].size, s[i].ptr); - s[i].ptr = NULL; - s[i].size = 0; - } else { - sp = lrand48(); /* 32-bit random number */ - sp >>= 12+(lrand48() % 20); - - s[i].size = sp; - s[i].ptr = p = malloc(sp); - ep = p+sp; - ok = 1; - for ( j = 0 ; j < NSLOTS ; j++ ) { - q = s[j].ptr; - if ( i != j && q ) { - sq = s[j].size; - eq = q+sq; - - if ( (p < q && ep > q) || (p >= q && p < eq) ) { - ok = 0; - err = 1; - break; - } - } - } - printf("Allocated %8zu bytes at %p, ok = %d\n", sp, p, ok); - - if ( p ) - memset(p, 0xee, sp); /* Poison this memory */ - } - } - return err; -} - diff --git a/klibc/klibc/tests/memstrtest.c b/klibc/klibc/tests/memstrtest.c deleted file mode 100644 index 70c642c067..0000000000 --- a/klibc/klibc/tests/memstrtest.c +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include - -int main(void) -{ - unsigned char t1[256], t2[256]; - int i; - int r; - - for(i = 0; i < (int)sizeof(t1); i++) - t1[i] = t2[i] = (unsigned char)i; - - r = memcmp(t1, t2, sizeof(t1)); - printf("memcmp r = %d\n", r); - r = memcmp(t1, t2, sizeof(t1)/2); - printf("memcmp r = %d\n", r); - t1[255] = 0; - r = memcmp(t1, t2, sizeof(t1)); - printf("memcmp r = %d\n", r); - - for (i = 0; i < (int)sizeof(t1); i++) - t1[i] = 0xaa; - memset(t2, 0xaa, sizeof(t2)); - r = memcmp(t1, t2, sizeof(t1)); - printf("memcmp r = %d\n", r); - return 0; -} - diff --git a/klibc/klibc/tests/microhello.c b/klibc/klibc/tests/microhello.c deleted file mode 100644 index f0f5a40379..0000000000 --- a/klibc/klibc/tests/microhello.c +++ /dev/null @@ -1,9 +0,0 @@ -#include -#include - -int main(void) -{ - static const char hello[] = "Hello, World!\n"; - _fwrite(hello, sizeof hello-1, stdout); - return 0; -} diff --git a/klibc/klibc/tests/minihello.c b/klibc/klibc/tests/minihello.c deleted file mode 100644 index 7698e0666b..0000000000 --- a/klibc/klibc/tests/minihello.c +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(void) -{ - fputs("Hello, World!\n", stdout); - return 0; -} diff --git a/klibc/klibc/tests/mmaptest.c b/klibc/klibc/tests/mmaptest.c deleted file mode 100644 index a654affb83..0000000000 --- a/klibc/klibc/tests/mmaptest.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * mmaptest.c - * - * Test some simple cases of mmap() - */ - -#include -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) -{ - void *foo; - - (void)argc; (void)argv; - - /* Important case, this is how we get memory for malloc() */ - errno = 0; - foo = mmap(0, 65536, PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); - - printf("mmap() returned %p, errno = %d\n", foo, errno); - - return 0; -} diff --git a/klibc/klibc/tests/nfs_no_rpc.c b/klibc/klibc/tests/nfs_no_rpc.c deleted file mode 100644 index 5c17706b63..0000000000 --- a/klibc/klibc/tests/nfs_no_rpc.c +++ /dev/null @@ -1,538 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Default path we try to mount. "%s" gets replaced by our IP address */ -#define NFS_ROOT "/tftpboot/%s" -#define NFS_DEF_FILE_IO_BUFFER_SIZE 4096 -#define NFS_MAXPATHLEN 1024 -#define NFS_MNT_PROGRAM 100005 -#define NFS_MNT_PORT 627 -#define NFS_PROGRAM 100003 -#define NFS_PORT 2049 -#define NFS2_VERSION 2 -#define NFS3_VERSION 3 -#define NFS_MNT_PROGRAM 100005 -#define NFS_MNT_VERSION 1 -#define NFS_MNT3_VERSION 3 -#define MNTPROC_MNT 1 -#define MOUNTPROC3_MNT 1 -#define RPC_PMAP_PROGRAM 100000 -#define RPC_PMAP_VERSION 2 -#define RPC_PMAP_PORT 111 - -#define NFS2_FHSIZE 32 -#define NFS3_FHSIZE 64 - -#define RPC_VERSION 2 - -enum rpc_msg_type { - RPC_CALL = 0, - RPC_REPLY = 1 -}; - -enum rpc_auth_flavor { - RPC_AUTH_NULL = 0, - RPC_AUTH_UNIX = 1, - RPC_AUTH_SHORT = 2, - RPC_AUTH_DES = 3, - RPC_AUTH_KRB = 4, -}; - -enum rpc_reply_stat { - RPC_MSG_ACCEPTED = 0, - RPC_MSG_DENIED = 1 -}; - -#define NFS_MAXFHSIZE 64 -struct nfs_fh { - unsigned short size; - unsigned char data[NFS_MAXFHSIZE]; -}; - -struct nfs2_fh { - char data[NFS2_FHSIZE]; -}; - -#define NFS_MOUNT_VERSION 4 - -struct nfs_mount_data { - int version; - int fd; - struct nfs2_fh old_root; - int flags; - int rsize; - int wsize; - int timeo; - int retrans; - int acregmin; - int acregmax; - int acdirmin; - int acdirmax; - struct sockaddr_in addr; - char hostname[256]; - int namlen; - unsigned int bsize; - struct nfs_fh root; -}; - -#define NFS_MOUNT_SOFT 0x0001 /* 1 */ -#define NFS_MOUNT_INTR 0x0002 /* 1 */ -#define NFS_MOUNT_SECURE 0x0004 /* 1 */ -#define NFS_MOUNT_POSIX 0x0008 /* 1 */ -#define NFS_MOUNT_NOCTO 0x0010 /* 1 */ -#define NFS_MOUNT_NOAC 0x0020 /* 1 */ -#define NFS_MOUNT_TCP 0x0040 /* 2 */ -#define NFS_MOUNT_VER3 0x0080 /* 3 */ -#define NFS_MOUNT_KERBEROS 0x0100 /* 3 */ -#define NFS_MOUNT_NONLM 0x0200 /* 3 */ -#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ -#define NFS_MOUNT_FLAGMASK 0xFFFF - -static char nfs_root_name[256]; -static u_int32_t root_server_addr; -static char root_server_path[256]; - -/* Address of NFS server */ -static u_int32_t servaddr; - -/* Name of directory to mount */ -static char nfs_path[NFS_MAXPATHLEN]; - -/* NFS-related data */ -static struct nfs_mount_data nfs_data = { - .version = NFS_MOUNT_VERSION, - .flags = NFS_MOUNT_NONLM, /* No lockd in nfs root yet */ - .rsize = NFS_DEF_FILE_IO_BUFFER_SIZE, - .wsize = NFS_DEF_FILE_IO_BUFFER_SIZE, - .bsize = 0, - .timeo = 7, - .retrans = 3, - .acregmin = 3, - .acregmax = 60, - .acdirmin = 30, - .acdirmax = 60, -}; -static int nfs_port = -1; -static int mount_port; - -/*************************************************************************** - - Parsing of options - - ***************************************************************************/ - -/* - * The following integer options are recognized - */ -static struct nfs_int_opts { - const char *name; - int *val; -} root_int_opts[] = { - { "port", &nfs_port }, - { "rsize", &nfs_data.rsize }, - { "wsize", &nfs_data.wsize }, - { "timeo", &nfs_data.timeo }, - { "retrans", &nfs_data.retrans }, - { "acregmin", &nfs_data.acregmin }, - { "acregmax", &nfs_data.acregmax }, - { "acdirmin", &nfs_data.acdirmin }, - { "acdirmax", &nfs_data.acdirmax }, - { NULL, NULL } -}; - -/* - * And now the flag options - */ -static struct nfs_bool_opts { - const char *name; - int and_mask; - int or_mask; -} root_bool_opts[] = { - { "soft", ~NFS_MOUNT_SOFT, NFS_MOUNT_SOFT }, - { "hard", ~NFS_MOUNT_SOFT, 0 }, - { "intr", ~NFS_MOUNT_INTR, NFS_MOUNT_INTR }, - { "nointr", ~NFS_MOUNT_INTR, 0 }, - { "posix", ~NFS_MOUNT_POSIX, NFS_MOUNT_POSIX }, - { "noposix", ~NFS_MOUNT_POSIX, 0 }, - { "cto", ~NFS_MOUNT_NOCTO, 0 }, - { "nocto", ~NFS_MOUNT_NOCTO, NFS_MOUNT_NOCTO }, - { "ac", ~NFS_MOUNT_NOAC, 0 }, - { "noac", ~NFS_MOUNT_NOAC, NFS_MOUNT_NOAC }, - { "lock", ~NFS_MOUNT_NONLM, 0 }, - { "nolock", ~NFS_MOUNT_NONLM, NFS_MOUNT_NONLM }, -#ifdef CONFIG_NFS_V3 - { "v2", ~NFS_MOUNT_VER3, 0 }, - { "v3", ~NFS_MOUNT_VER3, NFS_MOUNT_VER3 }, -#endif - { "udp", ~NFS_MOUNT_TCP, 0 }, - { "tcp", ~NFS_MOUNT_TCP, NFS_MOUNT_TCP }, - { "broken_suid",~NFS_MOUNT_BROKEN_SUID, NFS_MOUNT_BROKEN_SUID }, - { NULL, 0, 0 } -}; -/* - * Parse option string. - */ -static void root_nfs_parse(char *name, char *buf) -{ - char *options, *val, *cp; - - if ((options = strchr(name, ','))) { - *options++ = 0; - cp = strtok(options, ","); - while (cp) { - if ((val = strchr(cp, '='))) { - struct nfs_int_opts *opts = root_int_opts; - *val++ = '\0'; - while (opts->name && strcmp(opts->name, cp)) - opts++; - if (opts->name) - *(opts->val) = (int) strtoul(val, NULL, 10); - } else { - struct nfs_bool_opts *opts = root_bool_opts; - while (opts->name && strcmp(opts->name, cp)) - opts++; - if (opts->name) { - nfs_data.flags &= opts->and_mask; - nfs_data.flags |= opts->or_mask; - } - } - cp = strtok(NULL, ","); - } - } - if (name[0] && strcmp(name, "default")) { - strncpy(buf, name, NFS_MAXPATHLEN-1); - buf[NFS_MAXPATHLEN-1] = 0; - } -} - -/* - * Prepare the NFS data structure and parse all options. - */ -static int root_nfs_name(char *name) -{ - char buf[NFS_MAXPATHLEN]; - struct utsname uname_buf; - - /* Set some default values */ - strcpy(buf, NFS_ROOT); - - /* Process options received from the remote server */ - root_nfs_parse(root_server_path, buf); - - /* Override them by options set on kernel command-line */ - root_nfs_parse(name, buf); - - uname(&uname_buf); - if (strlen(buf) + strlen(uname_buf.nodename) > NFS_MAXPATHLEN) { - printf("nfsroot: Pathname for remote directory too long.\n"); - return -1; - } - sprintf(nfs_path, buf, uname_buf.nodename); - - return 1; -} - -/*************************************************************************** - - Routines to actually mount the root directory - - ***************************************************************************/ - -/* - * Construct sockaddr_in from address and port number. - */ -static inline void -set_sockaddr(struct sockaddr_in *sin, u_int32_t addr, u_int16_t port) -{ - memset(sin, 0, sizeof(*sin)); - sin->sin_family = AF_INET; - sin->sin_addr.s_addr = addr; - sin->sin_port = port; -} - -/* - * Extremely crude RPC-over-UDP call. We get an already encoded request - * to pass, we do that and put the reply into buffer. That (and callers - * below - getport, getfh2 and getfh3) should be replaced with proper - * librpc use. Now, if we only had one that wasn't bloated as a dead - * gnu that had lied for a while under the sun... - */ - -static u_int32_t XID; -static int flag; -static void timeout(int n) -{ - (void)n; - flag = 1; -} -static int do_call(struct sockaddr_in *sin, u_int32_t msg[], u_int32_t rmsg[], - u_int32_t len, u_int32_t rlen) -{ - struct sockaddr_in from; - int slen = sizeof(struct sockaddr_in); - struct timeval tv = {1, 0}; - int n; - int fd; - - sysv_signal(SIGALRM, timeout); - fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (fd < 0) - goto Esocket; - setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (void*)&tv, sizeof(tv)); - len *= 4; - if (sendto(fd, msg, len, 0, (struct sockaddr *)sin, slen)!=(int)len) - goto Esend; - setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (void*)&tv, sizeof(tv)); - alarm(0); - flag = 0; - alarm(5); - rlen *= 4; - do { - slen = sizeof(from); - n = recvfrom(fd, rmsg, rlen, 0, (struct sockaddr*)&from, &slen); - if (flag || n < 0) - goto Erecv; - } while (memcmp(&from, sin, sizeof(from)) || rmsg[0] != msg[0]); - - if (n < 6*4 || n % 4 || ntohl(rmsg[1]) != 1 || rmsg[2] || - rmsg[3] || rmsg[4] || rmsg[5]) - goto Einval; - alarm(0); - close(fd); - return n / 4 - 6; - -Esend: printf("rpc: write failed\n"); - goto out; -Erecv: printf("rpc: read failed\n"); - goto out; -Einval: printf("rpc: invalid response\n"); - goto out; -Esocket:printf("rpc: can't create socket\n"); - return -1; -out: - alarm(0); - close(fd); - return -1; -} - -enum { - PMAP_GETPORT = 3 -}; - -static void do_header(u_int32_t msg[], u_int32_t prog, u_int32_t vers, u_int32_t proc) -{ - msg[0] = XID++; - msg[1] = htonl(RPC_CALL); - msg[2] = htonl(RPC_VERSION); - msg[3] = htonl(prog); - msg[4] = htonl(vers); - msg[5] = htonl(proc); - msg[6] = htonl(RPC_AUTH_NULL); - msg[7] = htonl(0); - msg[8] = htonl(RPC_AUTH_NULL); - msg[9] = htonl(0); -} - -static int getport(u_int32_t prog, u_int32_t vers, u_int32_t prot) -{ - struct sockaddr_in sin; - unsigned msg[14]; - unsigned rmsg[7]; - int n; - set_sockaddr(&sin, servaddr, htons(RPC_PMAP_PORT)); - do_header(msg, RPC_PMAP_PROGRAM, RPC_PMAP_VERSION, PMAP_GETPORT); - msg[10] = htonl(prog); - msg[11] = htonl(vers); - msg[12] = htonl(prot); - msg[13] = htonl(0); - n = do_call(&sin, msg, rmsg, 14, 7); - if (n <= 0) - return -1; - else - return ntohl(rmsg[6]); -} - -static int getfh2(void) -{ - struct sockaddr_in sin; - unsigned msg[10+1+256/4]; - unsigned rmsg[6 + 1 + NFS2_FHSIZE/4]; - int n; - int len = strlen(nfs_path); - set_sockaddr(&sin, servaddr, mount_port); - - if (len > 255) { - printf("nfsroot: pathname is too long"); - return -1; - } - memset(msg, 0, sizeof(msg)); - do_header(msg, NFS_MNT_PROGRAM, NFS_MNT_VERSION, MNTPROC_MNT); - msg[10] = htonl(len); - strcpy((char*)&msg[11], nfs_path); - n = do_call(&sin, msg, rmsg, 11 + (len + 3)/4, 7 + NFS2_FHSIZE/4); - if (n < 0) - return -1; - if (n != NFS2_FHSIZE/4 + 1) - goto Esize; - if (rmsg[6]) { - printf("nfsroot: mountd returned an error (%d)",htonl(rmsg[6])); - return -1; - } - nfs_data.root.size = NFS2_FHSIZE; - memcpy(nfs_data.root.data, &rmsg[7], NFS2_FHSIZE); - return 0; -Esize: - printf("nfsroot: bad fhandle size"); - return -1; -} - -static int getfh3(void) -{ - struct sockaddr_in sin; - unsigned msg[10+1+256/4]; - unsigned rmsg[6 + 1 + 1 + NFS3_FHSIZE/4]; - int n; - int len = strlen(nfs_path); - int size; - set_sockaddr(&sin, servaddr, mount_port); - - if (len > 255) { - printf("nfsroot: pathname is too long"); - return -1; - } - memset(msg, 0, sizeof(msg)); - do_header(msg, NFS_MNT_PROGRAM, NFS_MNT3_VERSION, MOUNTPROC3_MNT); - msg[10] = htonl(len); - strcpy((char*)&msg[11], nfs_path); - n = do_call(&sin, msg, rmsg, 11 + (len + 3)/4, 8 + NFS3_FHSIZE/4); - if (n < 0) - return -1; - if (n <= 2) - goto Esize; - if (rmsg[6]) { - printf("nfsroot: mountd returned an error (%d)",htonl(rmsg[6])); - return -1; - } - size = ntohl(rmsg[7]); - if (size > NFS3_FHSIZE || n != 2 + size/4) - goto Esize; - nfs_data.root.size = size; - memcpy(nfs_data.root.data, &rmsg[8], size); - return 0; -Esize: - printf("nfsroot: bad fhandle size"); - return -1; -} - -/* - * Use portmapper to find mountd and nfsd port numbers if not overriden - * by the user. Use defaults if portmapper is not available. - * XXX: Is there any nfs server with no portmapper? - */ -static int root_nfs_ports(void) -{ - int port; - int nfsd_ver, mountd_ver; - int proto; - - if (nfs_data.flags & NFS_MOUNT_VER3) { - nfsd_ver = NFS3_VERSION; - mountd_ver = NFS_MNT3_VERSION; - } else { - nfsd_ver = NFS2_VERSION; - mountd_ver = NFS_MNT_VERSION; - } - - proto = (nfs_data.flags & NFS_MOUNT_TCP) ? IPPROTO_TCP : IPPROTO_UDP; - - if (nfs_port < 0) { - if ((port = getport(NFS_PROGRAM, nfsd_ver, proto)) < 0) { - printf("nfsroot: Unable to get nfsd port " - "number from server, using default\n"); - port = NFS_PORT; - } - nfs_port = htons(port); - printf("nfsroot: Portmapper on server returned %d " - "as nfsd port\n", port); - } - - if ((port = getport(NFS_MNT_PROGRAM, mountd_ver, proto)) < 0) { - printf("nfsroot: Unable to get mountd port " - "number from server, using default\n"); - port = NFS_MNT_PORT; - } - mount_port = htons(port); - printf("nfsroot: mountd port is %d\n", port); - - return 0; -} - -int main(void) -{ - unsigned char *p; - struct timeval tv; - char *s; - - /* FIX: use getopt() instead of this */ - - s = getenv("root_server_addr"); - if (s) - root_server_addr = strtoul(s, NULL, 10); - s = getenv("root_server_path"); - if (s) - strncpy(root_server_path, s, 255); - s = getenv("nfs_root_name"); - if (s) - strncpy(nfs_root_name, s, 255); - - /* - * Decode the root directory path name and NFS options from - * the kernel command line. This has to go here in order to - * be able to use the client IP address for the remote root - * directory (necessary for pure RARP booting). - */ - if (root_nfs_name(nfs_root_name) < 0) - return 0; - if ((servaddr = root_server_addr) == INADDR_NONE) { - printf("nfsroot: No NFS server available, giving up.\n"); - return 0; - } - - p = (char *) &servaddr; - sprintf(nfs_data.hostname, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); - -#ifdef NFSROOT_DEBUG - printf("nfsroot: Mounting %s on server %s as root\n", - nfs_path, nfs_data.hostname); - printf("nfsroot: rsize = %d, wsize = %d, timeo = %d, retrans = %d\n", - nfs_data.rsize, nfs_data.wsize, nfs_data.timeo, nfs_data.retrans); - printf("nfsroot: acreg (min,max) = (%d,%d), acdir (min,max) = (%d,%d)\n", - nfs_data.acregmin, nfs_data.acregmax, - nfs_data.acdirmin, nfs_data.acdirmax); - printf("nfsroot: nfsd port = %d, mountd port = %d, flags = %08x\n", - nfs_port, mount_port, nfs_data.flags); -#endif - - gettimeofday(&tv, NULL); - XID = (tv.tv_sec << 15) ^ tv.tv_usec; - - if (root_nfs_ports() < 0) - return 0; - if (nfs_data.flags & NFS_MOUNT_VER3) { - if (getfh3()) - return 0; - } else { - if (getfh2()) - return 0; - } - set_sockaddr((struct sockaddr_in *) &nfs_data.addr, servaddr, nfs_port); - return mount("/dev/root", "/mnt", "nfs", 0, &nfs_data) == 0; -} diff --git a/klibc/klibc/tests/opentest.c b/klibc/klibc/tests/opentest.c deleted file mode 100644 index 5a54d2fce2..0000000000 --- a/klibc/klibc/tests/opentest.c +++ /dev/null @@ -1,17 +0,0 @@ -#include - -int main(void) -{ - char buffer[1024]; - FILE *f; - - f = fopen("/etc/passwd", "r"); - fgets(buffer, 1024, f); - fclose(f); - - printf("Line 1 = %s", buffer); - - return 0; -} - - diff --git a/klibc/klibc/tests/rtsig.c b/klibc/klibc/tests/rtsig.c deleted file mode 100644 index a7f8eed088..0000000000 --- a/klibc/klibc/tests/rtsig.c +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include - -int main(void) -{ -#ifdef SIGRTMIN - printf("sigrtmin = %d, sigrtmax = %d\n", SIGRTMIN, SIGRTMAX); -#else - printf("No realtime signals\n"); -#endif - return 0; -} diff --git a/klibc/klibc/tests/setenvtest.c b/klibc/klibc/tests/setenvtest.c deleted file mode 100644 index 111bef9dfe..0000000000 --- a/klibc/klibc/tests/setenvtest.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include -#include - -int main(int argc, char *argv[]) -{ - (void)argc; (void)argv; - - /* Set SETENV */ - setenv("SETENV", "setenv", 1); - - /* Set PUTENV */ - putenv("PUTENV=putenv"); - - /* Print the results... */ - printf("SETENV = %s\n", getenv("SETENV")); - printf("PUTENV = %s\n", getenv("PUTENV")); - - /* Override tests */ - setenv("SETENV", "setenv_good", 1); - putenv("PUTENV=putenv_good"); - printf("SETENV = %s\n", getenv("SETENV")); - printf("PUTENV = %s\n", getenv("PUTENV")); - - /* Non-override test */ - setenv("SETENV", "setenv_bad", 0); - setenv("NEWENV", "newenv_good", 0); - printf("SETENV = %s\n", getenv("SETENV")); - printf("NEWENV = %s\n", getenv("NEWENV")); - - /* Undef test */ - unsetenv("SETENV"); - unsetenv("NEWENV"); - printf("SETENV = %s\n", getenv("SETENV")); - printf("NEWENV = %s\n", getenv("NEWENV")); - - return 0; -} diff --git a/klibc/klibc/tests/setjmptest.c b/klibc/klibc/tests/setjmptest.c deleted file mode 100644 index a199eedab8..0000000000 --- a/klibc/klibc/tests/setjmptest.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * setjmptest.c - */ - -#include -#include - -static jmp_buf buf; - -void do_stuff(int v) -{ - printf("setjmp returned %d\n", v); - longjmp(buf, v+1); -} - -void recurse(int ctr, int v) -{ - if ( ctr-- ) { - recurse(ctr, v); - } else { - do_stuff(v); - } - _fwrite(".", 1, stdout); -} - -int main(void) -{ - int v; - - v = setjmp(buf); - - if ( v < 256 ) - recurse(v,v); - - return 0; -} diff --git a/klibc/klibc/tests/stat.c b/klibc/klibc/tests/stat.c deleted file mode 100644 index 74b0bddf44..0000000000 --- a/klibc/klibc/tests/stat.c +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include -#include -#include -#include -#include - -static void do_stat(const char *path) -{ - struct stat st; - - if ( stat(path, &st) ) { - perror(path); - exit(1); - } - - printf("Path = %s\n" - " st_dev = %#jx (%u,%u)\n" - " st_ino = %ju\n" - " st_mode = %#jo\n" - " st_nlink = %ju\n" - " st_uid = %ju\n" - " st_gid = %ju\n" - " st_rdev = %#jx (%u,%u)\n" - " st_size = %ju\n" - " st_blksize = %ju\n" - " st_blocks = %ju\n", - path, - (uintmax_t)st.st_dev, major(st.st_dev), minor(st.st_dev), - (uintmax_t)st.st_ino, - (uintmax_t)st.st_mode, - (uintmax_t)st.st_nlink, - (uintmax_t)st.st_uid, - (uintmax_t)st.st_gid, - (uintmax_t)st.st_rdev, major(st.st_rdev), minor(st.st_rdev), - (uintmax_t)st.st_size, - (uintmax_t)st.st_blksize, - (uintmax_t)st.st_blocks); - -#ifdef _STATBUF_ST_NSEC - printf(" st_atim = %jd.%09u\n" - " st.mtim = %jd.%09u\n" - " st.ctim = %jd.%09u\n", - (uintmax_t)st.st_atim.tv_sec, (unsigned int)st.st_atim.tv_nsec, - (uintmax_t)st.st_mtim.tv_sec, (unsigned int)st.st_mtim.tv_nsec, - (uintmax_t)st.st_ctim.tv_sec, (unsigned int)st.st_ctim.tv_nsec); -#else - printf(" st_atime = %jd\n" - " st.mtime = %jd\n" - " st.ctime = %jd\n", - (uintmax_t)st.st_atime, - (uintmax_t)st.st_mtime, - (uintmax_t)st.st_ctime); -#endif -} - -int main(int argc, char *argv[]) -{ - int i; - - for ( i = 1 ; i < argc ; i++ ) - do_stat(argv[i]); - - return 0; -} diff --git a/klibc/klibc/tests/statfs.c b/klibc/klibc/tests/statfs.c deleted file mode 100644 index 9b7a26d916..0000000000 --- a/klibc/klibc/tests/statfs.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include -#include - -static void do_statfs(const char *path) -{ - struct statfs sfs; - - if ( statfs(path, &sfs) ) { - perror(path); - exit(1); - } - - printf("Path = %s\n" - " f_type = %#jx\n" - " f_bsize = %jd\n" - " f_blocks = %jd\n" - " f_bfree = %jd\n" - " f_bavail = %jd\n" - " f_files = %jd\n" - " f_ffree = %jd\n" - " f_namelen = %jd\n", - path, - (uintmax_t)sfs.f_type, - (intmax_t)sfs.f_bsize, - (intmax_t)sfs.f_blocks, - (intmax_t)sfs.f_bfree, - (intmax_t)sfs.f_bavail, - (intmax_t)sfs.f_files, - (intmax_t)sfs.f_ffree, - (intmax_t)sfs.f_namelen); -} - -int main(int argc, char *argv[]) -{ - int i; - - for ( i = 1 ; i < argc ; i++ ) - do_statfs(argv[i]); - - return 0; -} diff --git a/klibc/klibc/tests/strtoimax.c b/klibc/klibc/tests/strtoimax.c deleted file mode 100644 index 5af0d7912b..0000000000 --- a/klibc/klibc/tests/strtoimax.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * strtoimaxtest.c - */ - -#include -#include -#include - -int main(int argc, char *argv[]) -{ - int i; - char *ep; - intmax_t iv; - - for ( i = 1 ; i < argc ; i++ ) { - iv = strtoimax(argv[i], &ep, 0); - printf("strtoimax(\"%s\") = %jd\n", argv[i], iv); - if ( *ep ) - printf(" ep = \"%s\"\n", ep); - } - - return 0; -} - diff --git a/klibc/klibc/tests/strtotime.c b/klibc/klibc/tests/strtotime.c deleted file mode 100644 index 815d40da99..0000000000 --- a/klibc/klibc/tests/strtotime.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) -{ - struct timeval tv; - struct timespec ts; - int i; - const char *rv, *rs; - - for ( i = 1 ; i < argc ; i++ ) { - rs = strtotimespec(argv[i], &ts); - rv = strtotimeval(argv[i], &tv); - printf("String: \"%s\"\n" - "Timespec: %ld.%09ld\n" - "Residual: \"%s\"\n" - "Timeval: %ld.%06ld\n" - "Residual: \"%s\"\n", - argv[i], - (long)ts.tv_sec, (long)ts.tv_nsec, rs, - (long)tv.tv_sec, (long)tv.tv_usec, rv); - } - - return 0; -} - - diff --git a/klibc/klibc/tests/testrand48.c b/klibc/klibc/tests/testrand48.c deleted file mode 100644 index bf046b6bda..0000000000 --- a/klibc/klibc/tests/testrand48.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -int main(void) -{ - unsigned short seed1[] = { 0x1234, 0x5678, 0x9abc }; - unsigned short *oldseed; - - oldseed = seed48(seed1); - printf("Initial seed: %#06x %#06x %#06x\n", - oldseed[0], oldseed[1], oldseed[2]); - - printf("lrand48() = %ld\n", lrand48()); - - seed48(seed1); - printf("mrand48() = %ld\n", mrand48()); - - return 1; -} diff --git a/klibc/klibc/tests/testvsnp.c b/klibc/klibc/tests/testvsnp.c deleted file mode 100644 index c86e8b30fb..0000000000 --- a/klibc/klibc/tests/testvsnp.c +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include -#include -#include - -int main(void) -{ - int r, i; - char buffer[512]; - - r = snprintf(buffer, 512, "Hello, %d", 37); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %'d", 37373737); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %'x", 0xdeadbeef); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %'#X", 0xdeadbeef); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %'#llo", 0123456701234567ULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - /* Make sure overflow works correctly */ - memset(buffer, '\xff', 512); - r = snprintf(buffer, 16, "Hello, %'#llo", 0123456701234567ULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - for ( i = 16 ; i < 512 ; i++ ) - assert ( buffer[i] == '\xff' ); - - r = snprintf(buffer, 512, "Hello, %'#40.20llo", 0123456701234567ULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %'#-40.20llo", 0123456701234567ULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %'#*.*llo", 40, 20, 0123456701234567ULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %'#*.*llo", -40, 20, 0123456701234567ULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %'#*.*llo", -40, -20, 0123456701234567ULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %'#*.*llx", -40, -20, 0123456701234567ULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %p", &buffer); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %P", &buffer); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %20p", &buffer); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %-20p", &buffer); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 512, "Hello, %-20p", NULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 20, "Hello, %'-20p", NULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 15, "Hello, %'-20p", NULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 3, "Hello, %'-20p", NULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - /* This shouldn't change buffer in any way! */ - r = snprintf(buffer, 0, "Hello, %'-20p", NULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - for ( i = -30 ; i <= 30 ; i++ ) { - r = snprintf(buffer, 40, "Hello, %'*p", i, NULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - } - - r = snprintf(buffer, 40, "Hello, %'-20s", "String"); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 40, "Hello, %'20s", "String"); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 40, "Hello, %'020s", "String"); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 40, "Hello, %'-20s", NULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 40, "Hello, %'20s", NULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 40, "Hello, %'020s", NULL); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 40, "Hello, %'-20c", '*'); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 40, "Hello, %'20c", '*'); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - r = snprintf(buffer, 40, "Hello, %'020c", '*'); - printf("buffer = \"%s\" (%d), r = %d\n", buffer, strlen(buffer), r); - - return 0; -} - diff --git a/klibc/version b/klibc/version index 21e8796a09..ee90284c27 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -1.0.3 +1.0.4 -- cgit v1.2.3-54-g00ecf From 61b1b7069f7a640e1952dce3c6de97034ef7c4fe Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 27 Mar 2005 00:12:55 +0100 Subject: [PATCH] udevinfo: print errors to stderr instead of stdout On Wed, 2005-03-23 at 13:55 +0100, Dieter Stueken wrote: > I noticed a few funny synlinks within /dev: > lrwxrwxrwx 1 root root 4 2005-03-21 15:33:54.196950896 +0100 device2 -> hda2 > lrwxrwxrwx 1 root root 4 2005-03-21 15:33:54.196950896 +0100 not2 -> hda2 > lrwxrwxrwx 1 root root 4 2005-03-21 15:33:54.196950896 +0100 found2 -> hda2 > lrwxrwxrwx 1 root root 4 2005-03-21 15:33:54.196950896 +0100 in2 -> hda2 > lrwxrwxrwx 1 root root 4 2005-03-21 15:33:54.196950896 +0100 database2 -> hda2 > I don't know exactly, what caused this in depth. But I found udevinfo > prints all error messages to stdout instead of using stderr. --- udevinfo.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 3fb37b41e9..d1dd663d81 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -75,7 +75,7 @@ static void print_all_attributes(struct dlist *attr_list) len--; } if (len == 0) - printf(" SYSFS{%s}=\"%s\"\n", attr->name, value); + printf(" SYSFS{%s}==\"%s\"\n", attr->name, value); } } printf("\n"); @@ -114,7 +114,7 @@ static int print_device_chain(const char *path) /* get the class dev */ class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { - printf("couldn't get the class device\n"); + fprintf(stderr, "couldn't get the class device\n"); return -1; } @@ -132,11 +132,11 @@ static int print_device_chain(const char *path) /* open sysfs class device directory and print all attributes */ printf(" looking at class device '%s':\n", class_dev->path); - printf(" SUBSYSTEM=\"%s\"\n", class_dev->classname); + printf(" SUBSYSTEM==\"%s\"\n", class_dev->classname); attr_list = sysfs_get_classdev_attributes(class_dev); if (attr_list == NULL) { - printf("couldn't open class device directory\n"); + fprintf(stderr, "couldn't open class device directory\n"); retval = -1; goto exit; } @@ -156,15 +156,15 @@ static int print_device_chain(const char *path) while (sysfs_dev != NULL) { attr_list = sysfs_get_device_attributes(sysfs_dev); if (attr_list == NULL) { - printf("couldn't open device directory\n"); + fprintf(stderr, "couldn't open device directory\n"); retval = -1; goto exit; } printf(" looking at the device chain at '%s':\n", sysfs_dev->path); - printf(" BUS=\"%s\"\n", sysfs_dev->bus); - printf(" ID=\"%s\"\n", sysfs_dev->bus_id); - printf(" DRIVER=\"%s\"\n", sysfs_dev->driver_name); + printf(" BUS==\"%s\"\n", sysfs_dev->bus); + printf(" ID==\"%s\"\n", sysfs_dev->bus_id); + printf(" DRIVER==\"%s\"\n", sysfs_dev->driver_name); /* open sysfs device directory and print all attributes */ print_all_attributes(attr_list); @@ -247,7 +247,7 @@ int main(int argc, char *argv[], char *envp[]) break; } - printf("unknown query type\n"); + fprintf(stderr, "unknown query type\n"); retval = 1; goto exit; @@ -293,7 +293,7 @@ int main(int argc, char *argv[], char *envp[]) } retval = udev_db_get_device(&udev, pos); if (retval != 0) { - printf("device not found in database\n"); + fprintf(stderr, "device not found in database\n"); goto exit; } goto print; @@ -312,14 +312,14 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_db_search_name(devpath, sizeof(devpath), pos); if (retval != 0) { - printf("device not found in database\n"); + fprintf(stderr, "device not found in database\n"); goto exit; } udev_db_get_device(&udev, devpath); goto print; } - printf("query needs device path(-p) or node name(-n) specified\n"); + fprintf(stderr, "query needs device path(-p) or node name(-n) specified\n"); retval = 3; goto exit; @@ -355,7 +355,7 @@ print: if (attributes) { if (path[0] == '\0') { - printf("attribute walk on device chain needs path(-p) specified\n"); + fprintf(stderr, "attribute walk on device chain needs path(-p) specified\n"); retval = 4; goto exit; } else { @@ -376,7 +376,7 @@ print: } help: - printf("Usage: udevinfo [-anpqrVh]\n" + fprintf(stderr, "Usage: udevinfo [-anpqrVh]\n" " -q TYPE query database for the specified value:\n" " 'name' name of device node\n" " 'symlink' pointing to node\n" -- cgit v1.2.3-54-g00ecf From 18614ab25d4208749a3d85ced33acc6679c60fce Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 27 Mar 2005 00:15:07 +0100 Subject: [PATCH] remove untrusted chars read from sysfs-values or returned by PROGRAM Better remove characters that are useless in a device node name. It may be a security risk to pass any character read from e.g. a sysfs attribute to a shell script we execute later. Prevent the modification of the libsysfs attribute value cache. Clear PROGRAM result if the execution encountered an error. --- test/udev-test.pl | 9 ++++ udev_config.c | 8 +-- udev_rules.c | 143 +++++++++++++++++++++++------------------------------- udev_utils.c | 18 +++++-- udev_utils.h | 3 +- 5 files changed, 91 insertions(+), 90 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 50ea5858a4..5d7c5e5b81 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1213,6 +1213,15 @@ BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="go", NAME="wrong" BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="yes", ENV{ACTION}=="add", ENV{DEVPATH}=="/block/sda/sdax1", NAME="no" BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="test", ENV{ACTION}=="add", ENV{DEVPATH}=="/block/sda/sda1", NAME="true" BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="bad", NAME="bad" +EOF + }, + { + desc => "untrusted string sanitize", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "sane", + rules => <value, len); + remove_trailing_char(value, '\n'); + + dbg("found attribute '%s'", tmpattr->path); + return 0; +} + static void apply_format(struct udevice *udev, char *string, size_t maxsize, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { @@ -176,7 +202,6 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, int len; int i; char c; - struct sysfs_attribute *tmpattr; unsigned int next_free_number; struct sysfs_class_device *class_dev_parent; @@ -257,30 +282,21 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, } break; case 's': - if (!class_dev) - break; if (attr == NULL) { dbg("missing attribute"); break; } - tmpattr = find_sysfs_attribute(class_dev, sysfs_device, attr); - if (tmpattr == NULL) { + if (find_sysfs_attribute(class_dev, sysfs_device, attr, temp2, sizeof(temp2)) != 0) { dbg("sysfs attribute '%s' not found", attr); break; } - /* strip trailing whitespace of matching value */ - if (isspace(tmpattr->value[strlen(tmpattr->value)-1])) { - i = len = strlen(tmpattr->value); - while (i > 0 && isspace(tmpattr->value[i-1])) - i--; - if (i < len) { - tmpattr->value[i] = '\0'; - dbg("remove %i trailing whitespace chars from '%s'", - len - i, tmpattr->value); - } - } - strlcat(string, tmpattr->value, maxsize); - dbg("substitute sysfs value '%s'", tmpattr->value); + /* strip trailing whitespace of sysfs value */ + i = strlen(temp2); + while (i > 0 && isspace(temp2[i-1])) + temp2[--i] = '\0'; + replace_untrusted_chars(temp2); + strlcat(string, temp2, maxsize); + dbg("substitute sysfs value '%s'", temp2); break; case '%': strlcat(string, "%", maxsize); @@ -385,8 +401,7 @@ static int execute_program(struct udevice *udev, const char *path, char *value, pid = fork(); switch(pid) { case 0: - /* child */ - /* dup2 write side of pipe to STDOUT */ + /* child dup2 write side of pipe to STDOUT */ dup2(fds[1], STDOUT_FILENO); retval = execv(arg, argv); @@ -402,7 +417,12 @@ static int execute_program(struct udevice *udev, const char *path, char *value, i = 0; while (1) { count = read(fds[0], value + i, len - i-1); - if (count <= 0) + if (count < 0) { + err("read failed with '%s'", strerror(errno)); + retval = -1; + } + + if (count == 0) break; i += count; @@ -412,16 +432,7 @@ static int execute_program(struct udevice *udev, const char *path, char *value, break; } } - - if (count < 0) { - err("read failed with '%s'", strerror(errno)); - retval = -1; - } - - if (i > 0 && value[i-1] == '\n') - i--; value[i] = '\0'; - dbg("result is '%s'", value); close(fds[0]); waitpid(pid, &status, 0); @@ -431,70 +442,38 @@ static int execute_program(struct udevice *udev, const char *path, char *value, retval = -1; } } - return retval; -} - -static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr) -{ - struct sysfs_attribute *tmpattr = NULL; - char *c; - - dbg("look for device attribute '%s'", attr); - /* try to find the attribute in the class device directory */ - tmpattr = sysfs_get_classdev_attr(class_dev, attr); - if (tmpattr) - goto attr_found; - /* look in the class device directory if present */ - if (sysfs_device) { - tmpattr = sysfs_get_device_attr(sysfs_device, attr); - if (tmpattr) - goto attr_found; - } - - return NULL; - -attr_found: - c = strchr(tmpattr->value, '\n'); - if (c != NULL) - c[0] = '\0'; + if (!retval) { + remove_trailing_char(value, '\n'); + dbg("result is '%s'", value); + replace_untrusted_chars(value); + } else + value[0] = '\0'; - dbg("found attribute '%s'", tmpattr->path); - return tmpattr; + return retval; } static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct key_pair *pair) { - struct sysfs_attribute *tmpattr; + char value[VALUE_SIZE]; int i; - int len; - - if ((pair == NULL) || (pair->name[0] == '\0') || (pair->value == '\0')) - return -ENODEV; - tmpattr = find_sysfs_attribute(class_dev, sysfs_device, pair->name); - if (tmpattr == NULL) - return -ENODEV; + if (find_sysfs_attribute(class_dev, sysfs_device, pair->name, value, sizeof(value)) != 0) + return -1; /* strip trailing whitespace of value, if not asked to match for it */ - if (! isspace(pair->value[strlen(pair->value)-1])) { - i = len = strlen(tmpattr->value); - while (i > 0 && isspace(tmpattr->value[i-1])) - i--; - if (i < len) { - tmpattr->value[i] = '\0'; - dbg("remove %i trailing whitespace chars from '%s'", - len - i, tmpattr->value); - } + if (!isspace(pair->value[strlen(pair->value)-1])) { + i = strlen(value); + while (i > 0 && isspace(value[i-1])) + value[--i] = '\0'; + dbg("removed %i trailing whitespace chars from '%s'", strlen(value)-i, value); } - dbg("compare attribute '%s' value '%s' with '%s'", - pair->name, tmpattr->value, pair->value); - if (strcmp_pattern(pair->value, tmpattr->value) != 0) - return -ENODEV; + dbg("compare attribute '%s' value '%s' with '%s'", pair->name, value, pair->value); + if (strcmp_pattern(pair->value, value) != 0) + return -1; - dbg("found matching attribute '%s' with value '%s'", - pair->name, pair->value); + dbg("found matching attribute '%s' with value '%s'", pair->name, pair->value); return 0; } diff --git a/udev_utils.c b/udev_utils.c index 2b5683fda6..37607492ac 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -50,7 +50,7 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs if (devpath) { strlcpy(udev->devpath, devpath, sizeof(udev->devpath)); - no_trailing_slash(udev->devpath); + remove_trailing_char(udev->devpath, '/'); if (strncmp(udev->devpath, "/block/", 7) == 0) udev->type = DEV_BLOCK; @@ -228,12 +228,24 @@ size_t buf_get_line(const char *buf, size_t buflen, size_t cur) return count - cur; } -void no_trailing_slash(char *path) +void replace_untrusted_chars(char *string) +{ + size_t len; + + for (len = 0; string[len] != '\0'; len++) { + if (strchr(";,~\\()\'", string[len])) { + info("replace '%c' in '%s'", string[len], string); + string[len] = '_'; + } + } +} + +void remove_trailing_char(char *path, char c) { size_t len; len = strlen(path); - while (len > 0 && path[len-1] == '/') + while (len > 0 && path[len-1] == c) path[--len] = '\0'; } diff --git a/udev_utils.h b/udev_utils.h index b45500dcff..5ebc9e5bb6 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -39,7 +39,8 @@ extern int unlink_secure(const char *filename); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(char *buf, size_t bufsize); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); -extern void no_trailing_slash(char *path); +extern void remove_trailing_char(char *path, char c); +extern void replace_untrusted_chars(char *string); extern int name_list_add(struct list_head *name_list, const char *name, int sort); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); -- cgit v1.2.3-54-g00ecf From 6276fdd2ab9c0cbfd0fba3e0261a074e81932156 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 27 Mar 2005 00:29:10 +0100 Subject: [PATCH] udevinfo: print SYSFS attribute the same way we match it --- udevinfo.c | 51 +++++++++++++++++++++++---------------------------- 1 file changed, 23 insertions(+), 28 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index d1dd663d81..788dd519a8 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -53,30 +53,29 @@ static void print_all_attributes(struct dlist *attr_list) { struct sysfs_attribute *attr; char value[VALUE_SIZE]; - int len; + size_t len; dlist_for_each_data(attr_list, attr, struct sysfs_attribute) { - if (attr->value != NULL) { - strlcpy(value, attr->value, sizeof(value)); - len = strlen(value); - if (len == 0) - continue; - - /* remove trailing newline */ - if (value[len-1] == '\n') { - value[len-1] = '\0'; - len--; - } + if (attr->value == NULL) + continue; + len = strlcpy(value, attr->value, sizeof(value)); + if (len >= sizeof(value)) { + dbg("attribute value of '%s' too long, skip", attr->name); + continue; + } - /* skip nonprintable values */ - while (len) { - if (isprint(value[len-1]) == 0) - break; - len--; - } - if (len == 0) - printf(" SYSFS{%s}==\"%s\"\n", attr->name, value); + /* remove trailing newlines */ + while (len && value[len-1] == '\n') + value[--len] = '\0'; + /* skip nonprintable attributes */ + while (len && isprint(value[len-1])) + len--; + if (len) { + dbg("attribute value of '%s' non-printable, skip", attr->name); + continue; } + replace_untrusted_chars(value); + printf(" SYSFS{%s}==\"%s\"\n", attr->name, value); } printf("\n"); } @@ -107,7 +106,6 @@ static int print_device_chain(const char *path) struct sysfs_class_device *class_dev_parent; struct sysfs_attribute *attr; struct sysfs_device *sysfs_dev; - struct sysfs_device *sysfs_dev_parent; struct dlist *attr_list; int retval = 0; @@ -144,13 +142,13 @@ static int print_device_chain(const char *path) /* get the device link (if parent exists look here) */ class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) + if (class_dev_parent != NULL) sysfs_dev = sysfs_get_classdev_device(class_dev_parent); else sysfs_dev = sysfs_get_classdev_device(class_dev); if (sysfs_dev != NULL) - printf("follow the class device's \"device\"\n"); + printf("follow the \"device\"-link to the physical device:\n"); /* look the device chain upwards */ while (sysfs_dev != NULL) { @@ -166,14 +164,11 @@ static int print_device_chain(const char *path) printf(" ID==\"%s\"\n", sysfs_dev->bus_id); printf(" DRIVER==\"%s\"\n", sysfs_dev->driver_name); - /* open sysfs device directory and print all attributes */ print_all_attributes(attr_list); - sysfs_dev_parent = sysfs_get_device_parent(sysfs_dev); - if (sysfs_dev_parent == NULL) + sysfs_dev = sysfs_get_device_parent(sysfs_dev); + if (sysfs_dev == NULL) break; - - sysfs_dev = sysfs_dev_parent; } exit: -- cgit v1.2.3-54-g00ecf From 8a4c0c32f4252efb0f0adbf5cdc0261d359cd568 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 27 Mar 2005 12:39:12 +0200 Subject: [PATCH] fix klibc's broken strlcpy/strlcat udevinfo segfaults cause klibc's strlcpy writes behind the specified size of the destination string. strlcat truncates the destination string which is also not what you expect from a concatenation function. --- klibc/klibc/strlcat.c | 4 +++- klibc/klibc/strlcpy.c | 2 +- udev_config.c | 2 +- udev_db.c | 46 +++++++++++++++++++++++----------------------- udev_libc_wrapper.c | 16 ++++++++++------ 5 files changed, 38 insertions(+), 32 deletions(-) diff --git a/klibc/klibc/strlcat.c b/klibc/klibc/strlcat.c index 6111445f06..f397857e76 100644 --- a/klibc/klibc/strlcat.c +++ b/klibc/klibc/strlcat.c @@ -16,9 +16,11 @@ size_t strlcat(char *dst, const char *src, size_t size) q++; bytes++; } + if (bytes == size) + return (bytes + strlen(src)); while ( (ch = *p++) ) { - if ( bytes < size ) + if ( bytes+1 < size ) *q++ = ch; bytes++; diff --git a/klibc/klibc/strlcpy.c b/klibc/klibc/strlcpy.c index eb384c9885..8b36c43c00 100644 --- a/klibc/klibc/strlcpy.c +++ b/klibc/klibc/strlcpy.c @@ -13,7 +13,7 @@ size_t strlcpy(char *dst, const char *src, size_t size) char ch; while ( (ch = *p++) ) { - if ( bytes < size ) + if ( bytes+1 < size ) *q++ = ch; bytes++; diff --git a/udev_config.c b/udev_config.c index 7d6bb77e5b..b6f578b27d 100644 --- a/udev_config.c +++ b/udev_config.c @@ -171,7 +171,7 @@ static int parse_config_file(void) if (bufline[0] == COMMENT_CHARACTER) continue; - strlcpy(line, bufline, count); + strlcpy(line, bufline, count+1); linepos = line; retval = get_key(&linepos, &variable, &value); diff --git a/udev_db.c b/udev_db.c index f606b5e05c..afbd50e50f 100644 --- a/udev_db.c +++ b/udev_db.c @@ -116,37 +116,37 @@ static int parse_db_file(struct udevice *udev, const char *filename) switch(bufline[0]) { case 'P': if (count > sizeof(udev->devpath)) - count = sizeof(udev->devpath)-1; - strlcpy(udev->devpath, &bufline[2], count-2); + count = sizeof(udev->devpath); + strlcpy(udev->devpath, &bufline[2], count-1); break; case 'N': if (count > sizeof(udev->name)) - count = sizeof(udev->name)-1; - strlcpy(udev->name, &bufline[2], count-2); + count = sizeof(udev->name); + strlcpy(udev->name, &bufline[2], count-1); break; case 'M': if (count > sizeof(line)) - count = sizeof(line)-1; - strlcpy(line, &bufline[2], count-2); + count = sizeof(line); + strlcpy(line, &bufline[2], count-1); sscanf(line, "%u:%u", &major, &minor); udev->devt = makedev(major, minor); break; case 'S': - if (count > sizeof(line)) - count = sizeof(line)-1; - strlcpy(line, &bufline[2], count-2); + if (count > sizeof(line)) + count = sizeof(line); + strlcpy(line, &bufline[2], count-1); name_list_add(&udev->symlink_list, line, 0); break; case 'A': - if (count > sizeof(line)) - count = sizeof(line)-1; - strlcpy(line, &bufline[2], count-2); + if (count > sizeof(line)) + count = sizeof(line); + strlcpy(line, &bufline[2], count-1); udev->partitions = atoi(line); break; case 'R': - if (count > sizeof(line)) - count = sizeof(line)-1; - strlcpy(line, &bufline[2], count-2); + if (count > sizeof(line)) + count = sizeof(line); + strlcpy(line, &bufline[2], count-1); udev->ignore_remove = atoi(line); break; } @@ -227,14 +227,14 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) switch(bufline[0]) { case 'P': if (count > sizeof(path)) - count = sizeof(path)-1; - strlcpy(path, &bufline[2], count-2); + count = sizeof(path); + strlcpy(path, &bufline[2], count-1); break; case 'N': case 'S': if (count > sizeof(nodename)) - count = sizeof(nodename)-1; - strlcpy(nodename, &bufline[2], count-2); + count = sizeof(nodename); + strlcpy(nodename, &bufline[2], count-1); dbg("compare '%s' '%s'", nodename, name); if (strcmp(nodename, name) == 0) { strlcpy(devpath, path, len); @@ -302,13 +302,13 @@ int udev_db_dump_names(int (*handler_function)(const char *path, const char *nam switch(bufline[0]) { case 'P': if (count > sizeof(path)) - count = sizeof(path)-1; - strlcpy(path, &bufline[2], count-2); + count = sizeof(path); + strlcpy(path, &bufline[2], count-1); break; case 'N': if (count > sizeof(nodename)) - count = sizeof(nodename)-1; - strlcpy(nodename, &bufline[2], count-2); + count = sizeof(nodename); + strlcpy(nodename, &bufline[2], count-1); break; default: continue; diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index 16d90913cf..23cb7b4316 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -36,11 +36,15 @@ #define __OWN_USERDB_PARSER__ #endif +#ifdef __GLIBC__ +#define __OWN_STRLCPYCAT__ +#endif + #ifdef USE_STATIC #define __OWN_USERDB_PARSER__ #endif -#ifndef strlcpy +#ifdef __OWN_STRLCPYCAT__ size_t strlcpy(char *dst, const char *src, size_t size) { size_t bytes = 0; @@ -49,7 +53,7 @@ size_t strlcpy(char *dst, const char *src, size_t size) char ch; while ((ch = *p++)) { - if (bytes < size) + if (bytes+1 < size) *q++ = ch; bytes++; } @@ -57,9 +61,7 @@ size_t strlcpy(char *dst, const char *src, size_t size) *q = '\0'; return bytes; } -#endif -#ifndef strlcat size_t strlcat(char *dst, const char *src, size_t size) { size_t bytes = 0; @@ -71,9 +73,11 @@ size_t strlcat(char *dst, const char *src, size_t size) q++; bytes++; } + if (bytes == size) + return (bytes + strlen(src)); while ((ch = *p++)) { - if (bytes < size) + if (bytes+1 < size) *q++ = ch; bytes++; } @@ -81,7 +85,7 @@ size_t strlcat(char *dst, const char *src, size_t size) *q = '\0'; return bytes; } -#endif +#endif /* __OWN_STRLCPYCAT__ */ #ifndef __OWN_USERDB_PARSER__ #include -- cgit v1.2.3-54-g00ecf From 4f8d44c220d811352b63c65b5a66403339005aac Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 28 Mar 2005 00:18:49 +0200 Subject: [PATCH] klibc: strlcpy/strlcat - don't alter destination if size == 0 --- klibc/klibc/strlcat.c | 3 ++- klibc/klibc/strlcpy.c | 3 ++- udev_libc_wrapper.c | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/klibc/klibc/strlcat.c b/klibc/klibc/strlcat.c index f397857e76..fdd72ac392 100644 --- a/klibc/klibc/strlcat.c +++ b/klibc/klibc/strlcat.c @@ -26,7 +26,8 @@ size_t strlcat(char *dst, const char *src, size_t size) bytes++; } - *q = '\0'; + if (size) + *q = '\0'; return bytes; } diff --git a/klibc/klibc/strlcpy.c b/klibc/klibc/strlcpy.c index 8b36c43c00..9e7b6bf91f 100644 --- a/klibc/klibc/strlcpy.c +++ b/klibc/klibc/strlcpy.c @@ -19,7 +19,8 @@ size_t strlcpy(char *dst, const char *src, size_t size) bytes++; } - *q = '\0'; + if (size) + *q = '\0'; return bytes; } diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index 23cb7b4316..d69f2ac48e 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -58,7 +58,8 @@ size_t strlcpy(char *dst, const char *src, size_t size) bytes++; } - *q = '\0'; + if (size) + *q = '\0'; return bytes; } @@ -82,7 +83,8 @@ size_t strlcat(char *dst, const char *src, size_t size) bytes++; } - *q = '\0'; + if (size) + *q = '\0'; return bytes; } #endif /* __OWN_STRLCPYCAT__ */ -- cgit v1.2.3-54-g00ecf From aa341f21ebad3cf82fa8ff4f644f80d65ff27a40 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 28 Mar 2005 02:12:39 +0200 Subject: [PATCH] udev_rules.c: don't change sysfs_device while walking up the device chain --- udev_rules.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 2581dc2a78..2fca33d063 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -480,6 +480,8 @@ static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct static int match_rule(struct udevice *udev, struct udev_rule *rule, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { + struct sysfs_device *parent_device = sysfs_device; + if (rule->kernel[0] != '\0') { dbg("check for " KEY_KERNEL " rule->kernel='%s' class_dev->name='%s'", rule->kernel, class_dev->name); @@ -541,13 +543,13 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, while (1) { /* check for matching driver */ if (rule->driver[0] != '\0') { - if (sysfs_device == NULL) { + if (parent_device == NULL) { dbg("device has no sysfs_device"); goto exit; } dbg("check for " KEY_DRIVER " rule->driver='%s' sysfs_device->driver_name='%s'", - rule->driver, sysfs_device->driver_name); - if (strcmp_pattern(rule->driver, sysfs_device->driver_name) != 0) { + rule->driver, parent_device->driver_name); + if (strcmp_pattern(rule->driver, parent_device->driver_name) != 0) { dbg(KEY_DRIVER " is not matching"); if (rule->driver_operation != KEY_OP_NOMATCH) goto try_parent; @@ -561,13 +563,13 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, /* check for matching bus value */ if (rule->bus[0] != '\0') { - if (sysfs_device == NULL) { + if (parent_device == NULL) { dbg("device has no sysfs_device"); goto exit; } dbg("check for " KEY_BUS " rule->bus='%s' sysfs_device->bus='%s'", - rule->bus, sysfs_device->bus); - if (strcmp_pattern(rule->bus, sysfs_device->bus) != 0) { + rule->bus, parent_device->bus); + if (strcmp_pattern(rule->bus, parent_device->bus) != 0) { dbg(KEY_BUS " is not matching"); if (rule->bus_operation != KEY_OP_NOMATCH) goto try_parent; @@ -581,12 +583,12 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, /* check for matching bus id */ if (rule->id[0] != '\0') { - if (sysfs_device == NULL) { + if (parent_device == NULL) { dbg("device has no sysfs_device"); goto exit; } dbg("check " KEY_ID); - if (strcmp_pattern(rule->id, sysfs_device->bus_id) != 0) { + if (strcmp_pattern(rule->id, parent_device->bus_id) != 0) { dbg(KEY_ID " is not matching"); if (rule->id_operation != KEY_OP_NOMATCH) goto try_parent; @@ -607,7 +609,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, struct key_pair *pair; pair = &rule->sysfs_pair[i]; - if (compare_sysfs_attribute(class_dev, sysfs_device, pair) != 0) { + if (compare_sysfs_attribute(class_dev, parent_device, pair) != 0) { dbg(KEY_SYSFS "{'%s'} is not matching", pair->name); if (pair->operation != KEY_OP_NOMATCH) goto try_parent; @@ -624,11 +626,11 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, break; try_parent: dbg("try parent sysfs device"); - sysfs_device = sysfs_get_device_parent(sysfs_device); - if (sysfs_device == NULL) + parent_device = sysfs_get_device_parent(parent_device); + if (parent_device == NULL) goto exit; - dbg("look at sysfs_device->path='%s'", sysfs_device->path); - dbg("look at sysfs_device->bus_id='%s'", sysfs_device->bus_id); + dbg("look at sysfs_device->path='%s'", parent_device->path); + dbg("look at sysfs_device->bus_id='%s'", parent_device->bus_id); } /* execute external program */ -- cgit v1.2.3-54-g00ecf From 98bbc835f584ed6792e895519326cc637f64f411 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 28 Mar 2005 11:22:17 +0200 Subject: [PATCH] read %s{}-sysfs values at any device in the chain --- test/udev-test.pl | 9 +++++++++ udev_rules.c | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 5d7c5e5b81..ed94629dd1 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1222,6 +1222,15 @@ EOF exp_name => "sane", rules => < "read sysfs value from device down in the chain", + subsys => "block", + devpath => "/class/tty/ttyUSB0", + exp_name => "serial-0000:00:09.0", + rules => <path); + if (find_sysfs_attribute(NULL, parent_device, attr, temp2, sizeof(temp2)) == 0) + break; + parent_device = sysfs_get_device_parent(parent_device); + } + if (!parent_device) + break; } /* strip trailing whitespace of sysfs value */ i = strlen(temp2); -- cgit v1.2.3-54-g00ecf From db949b02489f521e32a052280f913e06b7c87e37 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 28 Mar 2005 12:20:05 +0200 Subject: [PATCH] allow to match against empty key values --- test/udev-test.pl | 20 ++++++++++++++++---- udev_rules.c | 54 ++++++++++++++++++++++-------------------------------- udev_rules.h | 2 +- udev_rules_parse.c | 9 +-------- 4 files changed, 40 insertions(+), 45 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index ed94629dd1..27ca37115c 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -806,7 +806,7 @@ EOF exp_name => "link", exp_target => "link", exp_rem_error => "yes", - option => "clear", + option => "clean", rules => < "block", devpath => "/block/sda/sda4", exp_name => "cdrom2", - option => "clear", + option => "clean", rules => < "/block/sda", exp_name => "node14", exp_rem_error => "yes", - option => "clear", + option => "clean", rules => < "serial-0000:00:09.0", rules => < "match against empty key string", + subsys => "block", + devpath => "/block/sda", + exp_name => "ok", + rules => <{option}) && $rules->{option} eq "clear") { + if (defined($rules->{option}) && $rules->{option} eq "clean") { system("rm -rf $udev_db"); system("rm -rf $udev_root"); mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; diff --git a/udev_rules.c b/udev_rules.c index 00199a062f..b7905477de 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -463,36 +463,12 @@ static int execute_program(struct udevice *udev, const char *path, char *value, return retval; } -static int compare_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, struct key_pair *pair) -{ - char value[VALUE_SIZE]; - int i; - - if (find_sysfs_attribute(class_dev, sysfs_device, pair->name, value, sizeof(value)) != 0) - return -1; - - /* strip trailing whitespace of value, if not asked to match for it */ - if (!isspace(pair->value[strlen(pair->value)-1])) { - i = strlen(value); - while (i > 0 && isspace(value[i-1])) - value[--i] = '\0'; - dbg("removed %i trailing whitespace chars from '%s'", strlen(value)-i, value); - } - - dbg("compare attribute '%s' value '%s' with '%s'", pair->name, value, pair->value); - if (strcmp_pattern(pair->value, value) != 0) - return -1; - - dbg("found matching attribute '%s' with value '%s'", pair->name, pair->value); - return 0; -} - static int match_rule(struct udevice *udev, struct udev_rule *rule, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { struct sysfs_device *parent_device = sysfs_device; - if (rule->kernel[0] != '\0') { + if (rule->kernel_operation != KEY_OP_UNSET) { dbg("check for " KEY_KERNEL " rule->kernel='%s' class_dev->name='%s'", rule->kernel, class_dev->name); if (strcmp_pattern(rule->kernel, class_dev->name) != 0) { @@ -507,7 +483,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg(KEY_KERNEL " key is true"); } - if (rule->subsystem[0] != '\0') { + if (rule->subsystem_operation != KEY_OP_UNSET) { dbg("check for " KEY_SUBSYSTEM " rule->subsystem='%s' class_dev->name='%s'", rule->subsystem, class_dev->name); if (strcmp_pattern(rule->subsystem, udev->subsystem) != 0) { @@ -552,7 +528,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, /* walk up the chain of physical devices and find a match */ while (1) { /* check for matching driver */ - if (rule->driver[0] != '\0') { + if (rule->driver_operation != KEY_OP_UNSET) { if (parent_device == NULL) { dbg("device has no sysfs_device"); goto exit; @@ -572,7 +548,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, } /* check for matching bus value */ - if (rule->bus[0] != '\0') { + if (rule->bus_operation != KEY_OP_UNSET) { if (parent_device == NULL) { dbg("device has no sysfs_device"); goto exit; @@ -592,7 +568,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, } /* check for matching bus id */ - if (rule->id[0] != '\0') { + if (rule->id_operation != KEY_OP_UNSET) { if (parent_device == NULL) { dbg("device has no sysfs_device"); goto exit; @@ -617,9 +593,23 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("check " KEY_SYSFS " pairs"); for (i = 0; i < rule->sysfs_pair_count; i++) { struct key_pair *pair; + char value[VALUE_SIZE]; pair = &rule->sysfs_pair[i]; - if (compare_sysfs_attribute(class_dev, parent_device, pair) != 0) { + if (find_sysfs_attribute(class_dev, parent_device, pair->name, value, sizeof(value)) != 0) + goto try_parent; + + /* strip trailing whitespace of value, if not asked to match for it */ + if (!isspace(pair->value[strlen(pair->value)-1])) { + size_t len = strlen(value); + + while (len > 0 && isspace(value[len-1])) + value[--len] = '\0'; + dbg("removed %i trailing whitespace chars from '%s'", strlen(value)-len, value); + } + + dbg("compare attribute '%s' value '%s' with '%s'", pair->name, value, pair->value); + if (strcmp_pattern(pair->value, value) != 0) { dbg(KEY_SYSFS "{'%s'} is not matching", pair->name); if (pair->operation != KEY_OP_NOMATCH) goto try_parent; @@ -644,7 +634,7 @@ try_parent: } /* execute external program */ - if (rule->program[0] != '\0') { + if (rule->program_operation != KEY_OP_UNSET) { char program[PATH_SIZE]; dbg("check " KEY_PROGRAM); @@ -663,7 +653,7 @@ try_parent: } /* check for matching result of external program */ - if (rule->result[0] != '\0') { + if (rule->result_operation != KEY_OP_UNSET) { dbg("check for " KEY_RESULT " rule->result='%s', udev->program_result='%s'", rule->result, udev->program_result); if (strcmp_pattern(rule->result, udev->program_result) != 0) { diff --git a/udev_rules.h b/udev_rules.h index 423a6f641e..561ba1687d 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -55,7 +55,7 @@ #define RULEFILE_SUFFIX ".rules" enum key_operation { - KEY_OP_UNKNOWN, + KEY_OP_UNSET, KEY_OP_MATCH, KEY_OP_NOMATCH, KEY_OP_ADD, diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 71ca482728..3c1631ab49 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -236,7 +236,7 @@ static int rules_parse(const char *filename) while (1) { char *key; char *value; - enum key_operation operation = KEY_OP_UNKNOWN; + enum key_operation operation = KEY_OP_UNSET; retval = get_key(&linepos, &key, &operation, &value); if (retval) @@ -408,13 +408,6 @@ static int rules_parse(const char *filename) if (!valid) goto error; - /* simple plausibility checks for given keys */ - if ((rule.sysfs_pair[0].name[0] == '\0') ^ - (rule.sysfs_pair[0].value[0] == '\0')) { - err("inconsistency in " KEY_SYSFS " key"); - goto error; - } - if ((rule.result[0] != '\0') && (program_given == 0)) { info(KEY_RESULT " is only useful when " KEY_PROGRAM " is called in any rule before"); goto error; -- cgit v1.2.3-54-g00ecf From bb1a77d34cd004b44b30a79d7521957c3881e497 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 28 Mar 2005 12:37:54 +0200 Subject: [PATCH] check for strlen()==0 before accessing strlen()-1 --- udev_rules.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index b7905477de..c07abb9be0 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -594,15 +594,16 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, for (i = 0; i < rule->sysfs_pair_count; i++) { struct key_pair *pair; char value[VALUE_SIZE]; + size_t len; pair = &rule->sysfs_pair[i]; if (find_sysfs_attribute(class_dev, parent_device, pair->name, value, sizeof(value)) != 0) goto try_parent; /* strip trailing whitespace of value, if not asked to match for it */ - if (!isspace(pair->value[strlen(pair->value)-1])) { - size_t len = strlen(value); - + len = strlen(pair->value); + if (len && !isspace(pair->value[len-1])) { + len = strlen(value); while (len > 0 && isspace(value[len-1])) value[--len] = '\0'; dbg("removed %i trailing whitespace chars from '%s'", strlen(value)-len, value); -- cgit v1.2.3-54-g00ecf From 12340f41085c5ab9f5f049eab640835e39de8286 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 29 Mar 2005 03:53:45 +0200 Subject: [PATCH] klibc: version 1.0.5 --- klibc/klibc/strlcat.c | 3 +-- klibc/klibc/strlcpy.c | 4 +++- klibc/version | 2 +- udev_libc_wrapper.c | 5 +++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/klibc/klibc/strlcat.c b/klibc/klibc/strlcat.c index fdd72ac392..f397857e76 100644 --- a/klibc/klibc/strlcat.c +++ b/klibc/klibc/strlcat.c @@ -26,8 +26,7 @@ size_t strlcat(char *dst, const char *src, size_t size) bytes++; } - if (size) - *q = '\0'; + *q = '\0'; return bytes; } diff --git a/klibc/klibc/strlcpy.c b/klibc/klibc/strlcpy.c index 9e7b6bf91f..e6937445cd 100644 --- a/klibc/klibc/strlcpy.c +++ b/klibc/klibc/strlcpy.c @@ -19,8 +19,10 @@ size_t strlcpy(char *dst, const char *src, size_t size) bytes++; } - if (size) + /* If size == 0 there is no space for a final null... */ + if ( size ) *q = '\0'; + return bytes; } diff --git a/klibc/version b/klibc/version index ee90284c27..90a27f9cea 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -1.0.4 +1.0.5 diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index d69f2ac48e..1852141c93 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -58,8 +58,10 @@ size_t strlcpy(char *dst, const char *src, size_t size) bytes++; } + /* If size == 0 there is no space for a final null... */ if (size) *q = '\0'; + return bytes; } @@ -83,8 +85,7 @@ size_t strlcat(char *dst, const char *src, size_t size) bytes++; } - if (size) - *q = '\0'; + *q = '\0'; return bytes; } #endif /* __OWN_STRLCPYCAT__ */ -- cgit v1.2.3-54-g00ecf From 584d412bf0584704dc93a7a7595e273c15b3e457 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 29 Mar 2005 03:56:42 +0200 Subject: [PATCH] correct error path for PROGRAM execution --- udev_rules.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index c07abb9be0..9a0ee833e2 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -415,11 +415,13 @@ static int execute_program(struct udevice *udev, const char *path, char *value, dup2(fds[1], STDOUT_FILENO); retval = execv(arg, argv); - info(KEY_PROGRAM " execution of '%s' failed", path); - exit(1); + err(KEY_PROGRAM " execution of '%s' failed", path); + retval = -1; + break; case -1: err("fork of '%s' failed", path); - return -1; + retval = -1; + break; default: /* parent reads from fds[0] */ close(fds[1]); -- cgit v1.2.3-54-g00ecf From 7ff56624f84d1616470ab6cbeab17c1367e775d7 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 29 Mar 2005 04:23:56 +0200 Subject: [PATCH] correct correction for error path for PROGRAM execution --- udev_rules.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 9a0ee833e2..2b5c411d96 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -415,9 +415,8 @@ static int execute_program(struct udevice *udev, const char *path, char *value, dup2(fds[1], STDOUT_FILENO); retval = execv(arg, argv); - err(KEY_PROGRAM " execution of '%s' failed", path); - retval = -1; - break; + err("exec of program failed"); + _exit(1); case -1: err("fork of '%s' failed", path); retval = -1; -- cgit v1.2.3-54-g00ecf From fb39f0566e248c09772ed15a3218ef2381700b6a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 29 Mar 2005 11:25:52 +0200 Subject: [PATCH] move execute_program to utils + add action to init_device --- udev.c | 5 +++-- udev_multiplex.c | 34 +----------------------------- udev_rules.c | 48 +++++++++++++++++++++++------------------- udev_utils.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- udev_utils.h | 3 ++- udevinfo.c | 2 +- udevstart.c | 2 +- udevtest.c | 11 +++++----- 8 files changed, 104 insertions(+), 65 deletions(-) diff --git a/udev.c b/udev.c index 6d1d679d9a..23375b7a3e 100644 --- a/udev.c +++ b/udev.c @@ -141,7 +141,7 @@ int main(int argc, char *argv[], char *envp[]) if (!subsystem && argc == 2) subsystem = argv[1]; - udev_init_device(&udev, devpath, subsystem); + udev_init_device(&udev, devpath, subsystem, action); if (!action || !subsystem || !devpath) { err("action, subsystem or devpath missing"); @@ -230,10 +230,11 @@ int main(int argc, char *argv[], char *envp[]) } hotplug: - udev_cleanup_device(&udev); if (udev_hotplug_d && managed_event) udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX); + udev_cleanup_device(&udev); + logging_close(); return retval; } diff --git a/udev_multiplex.c b/udev_multiplex.c index 9ab11e6bea..22bbaf7b61 100644 --- a/udev_multiplex.c +++ b/udev_multiplex.c @@ -32,38 +32,6 @@ #include "udev_utils.h" #include "logging.h" -static int run_program(struct udevice *udev, const char *filename) -{ - pid_t pid; - int fd; - - dbg("running %s", filename); - - pid = fork(); - switch (pid) { - case 0: - /* child */ - fd = open("/dev/null", O_RDWR); - if ( fd >= 0) { - dup2(fd, STDOUT_FILENO); - dup2(fd, STDIN_FILENO); - dup2(fd, STDERR_FILENO); - } - close(fd); - - execl(filename, filename, udev->subsystem, NULL); - dbg("exec of child failed"); - _exit(1); - case -1: - dbg("fork of child failed"); - break; - return -1; - default: - waitpid(pid, NULL, 0); - } - - return 0; -} /* * runs files in these directories in order: @@ -117,7 +85,7 @@ void udev_multiplex_directory(struct udevice *udev, const char *basedir, const c add_matching_files(&name_list, dirname, suffix); list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - run_program(udev, name_loop->name); + execute_command(name_loop->name, udev->subsystem); list_del(&name_loop->node); } diff --git a/udev_rules.c b/udev_rules.c index 2b5c411d96..069dec7d04 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -31,7 +31,6 @@ #include #include #include -#include #include "libsysfs/sysfs/libsysfs.h" #include "list.h" @@ -327,7 +326,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, struct udevice udev_parent; dbg("found parent '%s', get the node name", class_dev_parent->path); - udev_init_device(&udev_parent, NULL, NULL); + udev_init_device(&udev_parent, NULL, NULL, NULL); /* lookup the name in the udev_db with the DEVPATH of the parent */ if (udev_db_get_device(&udev_parent, &class_dev_parent->path[strlen(sysfs_path)]) == 0) { strlcat(string, udev_parent.name, maxsize); @@ -364,21 +363,22 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, } } -static int execute_program(struct udevice *udev, const char *path, char *value, int len) +static int execute_program_pipe(const char *command, const char *subsystem, char *value, int len) { int retval; int count; int status; - int fds[2]; + int pipefds[2]; pid_t pid; char *pos; char arg[PATH_SIZE]; char *argv[(sizeof(arg) / 2) + 1]; + int devnull; int i; - strlcpy(arg, path, sizeof(arg)); + strlcpy(arg, command, sizeof(arg)); i = 0; - if (strchr(path, ' ')) { + if (strchr(arg, ' ')) { pos = arg; while (pos != NULL) { if (pos[0] == '\'') { @@ -397,12 +397,12 @@ static int execute_program(struct udevice *udev, const char *path, char *value, dbg("execute '%s' with parsed arguments", arg); } else { argv[0] = arg; - argv[1] = udev->subsystem; + argv[1] = (char *) subsystem; argv[2] = NULL; dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); } - retval = pipe(fds); + retval = pipe(pipefds); if (retval != 0) { err("pipe failed"); return -1; @@ -412,22 +412,27 @@ static int execute_program(struct udevice *udev, const char *path, char *value, switch(pid) { case 0: /* child dup2 write side of pipe to STDOUT */ - dup2(fds[1], STDOUT_FILENO); + devnull = open("/dev/null", O_RDWR); + if (devnull >= 0) { + dup2(devnull, STDIN_FILENO); + dup2(devnull, STDERR_FILENO); + close(devnull); + } + dup2(pipefds[1], STDOUT_FILENO); retval = execv(arg, argv); - err("exec of program failed"); _exit(1); case -1: - err("fork of '%s' failed", path); + err("fork of '%s' failed", arg); retval = -1; break; default: - /* parent reads from fds[0] */ - close(fds[1]); + /* parent reads from pipefds[0] */ + close(pipefds[1]); retval = 0; i = 0; while (1) { - count = read(fds[0], value + i, len - i-1); + count = read(pipefds[0], value + i, len - i-1); if (count < 0) { err("read failed with '%s'", strerror(errno)); retval = -1; @@ -445,7 +450,7 @@ static int execute_program(struct udevice *udev, const char *path, char *value, } value[i] = '\0'; - close(fds[0]); + close(pipefds[0]); waitpid(pid, &status, 0); if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { @@ -470,9 +475,9 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, struct sysfs_device *parent_device = sysfs_device; if (rule->kernel_operation != KEY_OP_UNSET) { - dbg("check for " KEY_KERNEL " rule->kernel='%s' class_dev->name='%s'", - rule->kernel, class_dev->name); - if (strcmp_pattern(rule->kernel, class_dev->name) != 0) { + dbg("check for " KEY_KERNEL " rule->kernel='%s' udev_kernel_name='%s'", + rule->kernel, udev->kernel_name); + if (strcmp_pattern(rule->kernel, udev->kernel_name) != 0) { dbg(KEY_KERNEL " is not matching"); if (rule->kernel_operation != KEY_OP_NOMATCH) goto exit; @@ -485,8 +490,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, } if (rule->subsystem_operation != KEY_OP_UNSET) { - dbg("check for " KEY_SUBSYSTEM " rule->subsystem='%s' class_dev->name='%s'", - rule->subsystem, class_dev->name); + dbg("check for " KEY_SUBSYSTEM " rule->subsystem='%s' udev->subsystem='%s'", + rule->subsystem, udev->subsystem); if (strcmp_pattern(rule->subsystem, udev->subsystem) != 0) { dbg(KEY_SUBSYSTEM " is not matching"); if (rule->subsystem_operation != KEY_OP_NOMATCH) @@ -642,7 +647,8 @@ try_parent: dbg("check " KEY_PROGRAM); strlcpy(program, rule->program, sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - if (execute_program(udev, program, udev->program_result, sizeof(udev->program_result)) != 0) { + if (execute_program_pipe(program, udev->subsystem, + udev->program_result, sizeof(udev->program_result)) != 0) { dbg(KEY_PROGRAM " returned nonzero"); if (rule->program_operation != KEY_OP_NOMATCH) goto exit; diff --git a/udev_utils.c b/udev_utils.c index 37607492ac..4695ef0d72 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -38,7 +39,7 @@ #include "list.h" -int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem) +int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem, const char *action) { char *pos; @@ -317,3 +318,64 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c closedir(dir); return 0; } + +int execute_command(const char *command, const char *subsystem) +{ + int retval; + pid_t pid; + char arg[PATH_SIZE]; + char *argv[(PATH_SIZE / 2) + 1]; + char *pos; + int devnull; + int i; + + strlcpy(arg, command, sizeof(arg)); + i = 0; + if (strchr(arg, ' ')) { + pos = arg; + while (pos != NULL) { + if (pos[0] == '\'') { + /* don't separate if in apostrophes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos && pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg("arg[%i] '%s'", i, argv[i]); + i++; + } + argv[i] = NULL; + dbg("execute '%s' with parsed arguments", arg); + } else { + argv[0] = arg; + argv[1] = (char *) subsystem; + argv[2] = NULL; + dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); + } + + pid = fork(); + switch (pid) { + case 0: + /* child */ + devnull = open("/dev/null", O_RDWR); + if (devnull >= 0) { + dup2(devnull, STDIN_FILENO); + dup2(devnull, STDOUT_FILENO); + dup2(devnull, STDERR_FILENO); + close(devnull); + } + retval = execv(arg, argv); + err("exec of child failed"); + _exit(1); + case -1: + dbg("fork of child failed"); + break; + return -1; + default: + waitpid(pid, NULL, 0); + } + + return 0; +} diff --git a/udev_utils.h b/udev_utils.h index 5ebc9e5bb6..9cdae6db57 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -29,7 +29,7 @@ struct name_entry { char name[PATH_SIZE]; }; -extern int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem); +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 kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); @@ -43,5 +43,6 @@ extern void remove_trailing_char(char *path, char c); extern void replace_untrusted_chars(char *string); extern int name_list_add(struct list_head *name_list, const char *name, int sort); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); +extern int execute_command(const char *command, const char *subsystem); #endif diff --git a/udevinfo.c b/udevinfo.c index 788dd519a8..31e719fe35 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -199,7 +199,7 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevinfo"); udev_init_config(); - udev_init_device(&udev, NULL, NULL); + udev_init_device(&udev, NULL, NULL, NULL); /* get command line options */ while (1) { diff --git a/udevstart.c b/udevstart.c index a862dadf88..4bd4795874 100644 --- a/udevstart.c +++ b/udevstart.c @@ -123,7 +123,7 @@ static int add_device(const char *path, const char *subsystem) return -ENODEV; } - udev_init_device(&udev, devpath, subsystem); + udev_init_device(&udev, devpath, subsystem, "add"); udev_add_device(&udev, class_dev); /* run dev.d/ scripts if we created a node or changed a netif name */ diff --git a/udevtest.c b/udevtest.c index f0c38b3a51..2caa654d4c 100644 --- a/udevtest.c +++ b/udevtest.c @@ -86,16 +86,17 @@ int main(int argc, char *argv[], char *envp[]) } else devpath = argv[1]; - info("looking at '%s'", devpath); + subsystem = argv[2]; + setenv("DEVPATH", devpath, 1); + setenv("SUBSYSTEM", subsystem, 1); + setenv("ACTION", "add", 1); + info("looking at device '%s' from subsystem '%s'", devpath, subsystem); /* initialize the naming deamon */ udev_rules_init(); - if (argc == 3) - subsystem = argv[2]; - /* fill in values and test_run flag*/ - udev_init_device(&udev, devpath, subsystem); + udev_init_device(&udev, devpath, subsystem, "add"); /* skip subsystems without "dev", but handle net devices */ if (udev.type != DEV_NET && subsystem_expect_no_dev(udev.subsystem)) { -- cgit v1.2.3-54-g00ecf From e03a196a0d0680868ea230ab8f8d100ee90d0fa4 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 29 Mar 2005 11:30:51 +0200 Subject: [PATCH] fix udevtest to print the error if logging is disabled --- udevtest.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/udevtest.c b/udevtest.c index 2caa654d4c..93387f76d0 100644 --- a/udevtest.c +++ b/udevtest.c @@ -64,16 +64,16 @@ int main(int argc, char *argv[], char *envp[]) info("version %s", UDEV_VERSION); - if (argc != 3) { - info("Usage: udevtest "); - return 1; - } - /* initialize our configuration */ udev_init_config(); if (udev_log_priority < LOG_INFO) udev_log_priority = LOG_INFO; + if (argc != 3) { + info("Usage: udevtest "); + return 1; + } + /* remove sysfs_path if given */ if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) devpath = &argv[1][strlen(sysfs_path)] ; -- cgit v1.2.3-54-g00ecf From 821d0ec803a72841f173739f5b713fe847edab75 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 2 Apr 2005 17:45:35 +0200 Subject: [PATCH] add RUN key to be able to run rule based notification SUBSYSTEM=="block", RUN="/sbin/program" will execute the program only for block device events. ACTION="remove", SUBSYSTEM=="block", RUN"/sbin/program" will execute the program, if a block device is removed. --- Makefile | 1 - test/udev-test.pl | 47 +++++++++++++++++ udev.8.in | 13 ++++- udev.c | 19 +++++-- udev.h | 4 ++ udev_add.c | 5 +- udev_config.c | 7 +++ udev_rules.c | 148 +++++++++++++++++++++++++++++++++++++++++++++++++++-- udev_rules.h | 6 +++ udev_rules_parse.c | 13 +++++ udev_utils.c | 4 ++ udevd.c | 4 +- udevstart.c | 8 +++ 13 files changed, 266 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 9d9caec7f7..bc3425e278 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,6 @@ VERSION = 056 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev -HOTPLUG_EXEC = $(ROOT) DESTDIR = KERNEL_DIR = /lib/modules/${shell uname -r}/build diff --git a/test/udev-test.pl b/test/udev-test.pl index 27ca37115c..91e91bb2ae 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1243,6 +1243,53 @@ KERNEL=="sda", SYSFS{nothing}!="", NAME="not-1-ok" KERNEL=="sda", SYSFS{nothing}=="", NAME="not-2-ok" KERNEL=="sda", SYSFS{vendor}!="", NAME="ok" KERNEL=="sda", SYSFS{vendor}=="", NAME="not-3-ok" +EOF + }, + { + desc => "check ACTION value", + subsys => "block", + devpath => "/block/sda", + exp_name => "ok", + rules => < "apply NAME only once", + subsys => "block", + devpath => "/block/sda", + exp_name => "link", + exp_target => "ok", + rules => < "test RUN key", + subsys => "block", + devpath => "/block/sda", + exp_name => "testsymlink", + exp_target => "ok", + exp_rem_error => "yes", + option => "clean", + rules => < "test RUN key remove", + subsys => "block", + devpath => "/block/sda", + exp_name => "testsymlink2", + exp_target => "ok2", + rules => <name, udev.subsystem); + } + /* run dev.d/ scripts if we created/deleted a node or changed a netif name */ if (udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); diff --git a/udev.h b/udev.h index c2706f4593..f7a65c60d8 100644 --- a/udev.h +++ b/udev.h @@ -58,6 +58,7 @@ enum device_type { struct udevice { char devpath[PATH_SIZE]; char subsystem[NAME_SIZE]; + char action[NAME_SIZE]; enum device_type type; char name[PATH_SIZE]; @@ -67,9 +68,11 @@ struct udevice { char group[USER_SIZE]; mode_t mode; dev_t devt; + struct list_head run_list; char tmp_node[PATH_SIZE]; int partitions; + int ignore_device; int ignore_remove; int config_line; char config_file[PATH_SIZE]; @@ -93,6 +96,7 @@ extern char udev_db_path[PATH_SIZE]; extern char udev_config_filename[PATH_SIZE]; extern char udev_rules_filename[PATH_SIZE]; extern int udev_log_priority; +extern int udev_run; extern int udev_dev_d; extern int udev_hotplug_d; diff --git a/udev_add.c b/udev_add.c index d0d9eab913..5fff3836e3 100644 --- a/udev_add.c +++ b/udev_add.c @@ -276,8 +276,11 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) } } - if (udev_rules_get_name(udev, class_dev) != 0) + udev_rules_get_name(udev, class_dev); + if (udev->ignore_device) { + dbg("device event will be ignored"); return 0; + } dbg("adding name='%s'", udev->name); diff --git a/udev_config.c b/udev_config.c index b6f578b27d..6bc070d63a 100644 --- a/udev_config.c +++ b/udev_config.c @@ -44,6 +44,7 @@ char udev_db_path[PATH_SIZE]; char udev_config_filename[PATH_SIZE]; char udev_rules_filename[PATH_SIZE]; int udev_log_priority; +int udev_run; int udev_dev_d; int udev_hotplug_d; @@ -217,10 +218,16 @@ void udev_init_config(void) strcpy(udev_config_filename, UDEV_CONFIG_FILE); strcpy(udev_rules_filename, UDEV_RULES_FILE); udev_log_priority = LOG_ERR; + udev_run = 1; udev_dev_d = 1; udev_hotplug_d = 1; sysfs_get_mnt_path(sysfs_path, sizeof(sysfs_path)); + /* disable RUN key execution */ + env = getenv("UDEV_RUN"); + if (env && !string_is_true(env)) + udev_run = 0; + env = getenv("UDEV_NO_DEVD"); if (env && string_is_true(env)) udev_dev_d = 0; diff --git a/udev_rules.c b/udev_rules.c index 069dec7d04..6f82fac841 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -474,6 +474,21 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, { struct sysfs_device *parent_device = sysfs_device; + if (rule->action_operation != KEY_OP_UNSET) { + dbg("check for " KEY_ACTION " rule->action='%s' udev->action='%s'", + rule->action, udev->action); + if (strcmp_pattern(rule->action, udev->action) != 0) { + dbg(KEY_ACTION " is not matching"); + if (rule->action_operation != KEY_OP_NOMATCH) + goto exit; + } else { + dbg(KEY_ACTION " matches"); + if (rule->action_operation == KEY_OP_NOMATCH) + goto exit; + } + dbg(KEY_ACTION " key is true"); + } + if (rule->kernel_operation != KEY_OP_UNSET) { dbg("check for " KEY_KERNEL " rule->kernel='%s' udev_kernel_name='%s'", rule->kernel, udev->kernel_name); @@ -716,12 +731,17 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d list_for_each_entry(rule, &udev_rule_list, node) { dbg("process rule"); if (match_rule(udev, rule, class_dev, sysfs_device) == 0) { + if (udev->name[0] != '\0' && rule->name[0] != '\0') { + dbg("node name already set, rule ignored"); + continue; + } /* apply options */ if (rule->ignore_device) { info("configured rule in '%s[%i]' applied, '%s' is ignored", rule->config_file, rule->config_line, udev->kernel_name); - return -1; + udev->ignore_device = 1; + return 0; } if (rule->ignore_remove) { udev->ignore_remove = 1; @@ -773,7 +793,7 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d name_list_add(&udev->symlink_list, pos, 0); } - /* rule matches */ + /* set name, later rules with name set will be ignored */ if (rule->name[0] != '\0') { info("configured rule in '%s[%i]' applied, '%s' becomes '%s'", rule->config_file, rule->config_line, udev->kernel_name, rule->name); @@ -786,20 +806,25 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d if (udev->type != DEV_NET) dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", udev->name, udev->owner, udev->group, udev->mode, udev->partitions); + } - break; + if (rule->run[0] != '\0') { + char program[PATH_SIZE]; + + strlcpy(program, rule->run, sizeof(program)); + apply_format(udev, program, sizeof(program), class_dev, sysfs_device); + dbg("add run '%s'", program); + name_list_add(&udev->run_list, program, 0); } if (rule->last_rule) { dbg("last rule to be applied"); break; } - } } if (udev->name[0] == '\0') { - /* no rule matched, so we use the kernel name */ strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); info("no rule found, use kernel name '%s'", udev->name); } @@ -812,3 +837,116 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d return 0; } + +int udev_rules_get_run(struct udevice *udev) +{ + struct udev_rule *rule; + char program[PATH_SIZE]; + + /* look for a matching rule to apply */ + list_for_each_entry(rule, &udev_rule_list, node) { + dbg("process rule"); + + if (rule->run[0] == '\0') + continue; + + if (rule->name[0] != '\0' || rule->symlink[0] != '\0' || + rule->mode != 0000 || rule->owner[0] != '\0' || rule->group[0] != '\0') { + dbg("skip rule that names a device"); + continue; + } + + if (rule->action_operation != KEY_OP_UNSET) { + dbg("check for " KEY_ACTION " rule->action='%s' udev->action='%s'", + rule->action, udev->action); + if (strcmp_pattern(rule->action, udev->action) != 0) { + dbg(KEY_ACTION " is not matching"); + if (rule->action_operation != KEY_OP_NOMATCH) + continue; + } else { + dbg(KEY_ACTION " matches"); + if (rule->action_operation == KEY_OP_NOMATCH) + continue; + } + dbg(KEY_ACTION " key is true"); + } + + if (rule->kernel_operation != KEY_OP_UNSET) { + dbg("check for " KEY_KERNEL " rule->kernel='%s' udev->kernel_name='%s'", + rule->kernel, udev->kernel_name); + if (strcmp_pattern(rule->kernel, udev->kernel_name) != 0) { + dbg(KEY_KERNEL " is not matching"); + if (rule->kernel_operation != KEY_OP_NOMATCH) + continue; + } else { + dbg(KEY_KERNEL " matches"); + if (rule->kernel_operation == KEY_OP_NOMATCH) + continue; + } + dbg(KEY_KERNEL " key is true"); + } + + if (rule->subsystem_operation != KEY_OP_UNSET) { + dbg("check for " KEY_SUBSYSTEM " rule->subsystem='%s' udev->subsystem='%s'", + rule->subsystem, udev->subsystem); + if (strcmp_pattern(rule->subsystem, udev->subsystem) != 0) { + dbg(KEY_SUBSYSTEM " is not matching"); + if (rule->subsystem_operation != KEY_OP_NOMATCH) + continue; + } else { + dbg(KEY_SUBSYSTEM " matches"); + if (rule->subsystem_operation == KEY_OP_NOMATCH) + continue; + } + dbg(KEY_SUBSYSTEM " key is true"); + } + + if (rule->env_pair_count) { + int i; + + dbg("check for " KEY_ENV " pairs"); + for (i = 0; i < rule->env_pair_count; i++) { + struct key_pair *pair; + const char *value; + + pair = &rule->env_pair[i]; + value = getenv(pair->name); + if (!value) { + dbg(KEY_ENV "{'%s'} is not found", pair->name); + continue; + } + if (strcmp_pattern(pair->value, value) != 0) { + dbg(KEY_ENV "{'%s'} is not matching", pair->name); + if (pair->operation != KEY_OP_NOMATCH) + continue; + } else { + dbg(KEY_ENV "{'%s'} matches", pair->name); + if (pair->operation == KEY_OP_NOMATCH) + continue; + } + } + dbg(KEY_ENV " key is true"); + } + + /* rule matches */ + + if (rule->ignore_device) { + info("configured rule in '%s[%i]' applied, '%s' is ignored", + rule->config_file, rule->config_line, udev->kernel_name); + udev->ignore_device = 1; + return 0; + } + + strlcpy(program, rule->run, sizeof(program)); + apply_format(udev, program, sizeof(program), NULL, NULL); + dbg("add run '%s'", program); + name_list_add(&udev->run_list, program, 0); + + if (rule->last_rule) { + dbg("last rule to be applied"); + break; + } + } + + return 0; +} diff --git a/udev_rules.h b/udev_rules.h index 561ba1687d..5fba2d5571 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -30,6 +30,7 @@ #define KEY_KERNEL "KERNEL" #define KEY_SUBSYSTEM "SUBSYSTEM" +#define KEY_ACTION "ACTION" #define KEY_BUS "BUS" #define KEY_ID "ID" #define KEY_PROGRAM "PROGRAM" @@ -42,6 +43,7 @@ #define KEY_OWNER "OWNER" #define KEY_GROUP "GROUP" #define KEY_MODE "MODE" +#define KEY_RUN "RUN" #define KEY_OPTIONS "OPTIONS" #define OPTION_LAST_RULE "last_rule" @@ -75,6 +77,8 @@ struct udev_rule { enum key_operation kernel_operation; char subsystem[NAME_SIZE]; enum key_operation subsystem_operation; + char action[NAME_SIZE]; + enum key_operation action_operation; char bus[NAME_SIZE]; enum key_operation bus_operation; char id[NAME_SIZE]; @@ -95,6 +99,7 @@ struct udev_rule { char owner[USER_SIZE]; char group[USER_SIZE]; mode_t mode; + char run[PATH_SIZE]; int last_rule; int ignore_device; @@ -109,6 +114,7 @@ extern struct list_head udev_rule_list; extern int udev_rules_init(void); extern int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_dev); +extern int udev_rules_get_run(struct udevice *udev); extern void udev_rules_close(void); #endif diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 3c1631ab49..e665957b81 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -256,6 +256,13 @@ static int rules_parse(const char *filename) continue; } + if (strcasecmp(key, KEY_ACTION) == 0) { + strlcpy(rule.action, value, sizeof(rule.action)); + rule.action_operation = operation; + valid = 1; + continue; + } + if (strcasecmp(key, KEY_BUS) == 0) { strlcpy(rule.bus, value, sizeof(rule.bus)); rule.bus_operation = operation; @@ -379,6 +386,12 @@ static int rules_parse(const char *filename) continue; } + if (strcasecmp(key, KEY_RUN) == 0) { + strlcpy(rule.run, value, sizeof(rule.run)); + valid = 1; + continue; + } + if (strcasecmp(key, KEY_OPTIONS) == 0) { if (strstr(value, OPTION_LAST_RULE) != NULL) { dbg("last rule to be applied"); diff --git a/udev_utils.c b/udev_utils.c index 4695ef0d72..5cdfb1421d 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -45,10 +45,14 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs memset(udev, 0x00, sizeof(struct udevice)); INIT_LIST_HEAD(&udev->symlink_list); + INIT_LIST_HEAD(&udev->run_list); if (subsystem) strlcpy(udev->subsystem, subsystem, sizeof(udev->subsystem)); + if (action) + strlcpy(udev->action, action, sizeof(udev->action)); + if (devpath) { strlcpy(udev->devpath, devpath, sizeof(udev->devpath)); remove_trailing_char(udev->devpath, '/'); diff --git a/udevd.c b/udevd.c index 6c4d8b8693..91033b0688 100644 --- a/udevd.c +++ b/udevd.c @@ -145,7 +145,7 @@ static void msg_queue_insert(struct hotplug_msg *msg) } /* forks event and removes event from run queue when finished */ -static void udev_run(struct hotplug_msg *msg) +static void execute_udev(struct hotplug_msg *msg) { char *const argv[] = { "udev", msg->subsystem, NULL }; pid_t pid; @@ -349,7 +349,7 @@ static void exec_queue_manager(void) if (!msg) { /* move event to run list */ list_move_tail(&loop_msg->node, &running_list); - udev_run(loop_msg); + execute_udev(loop_msg); running++; dbg("moved seq %llu to running list", loop_msg->seqnum); } else { diff --git a/udevstart.c b/udevstart.c index 4bd4795874..d41702efd1 100644 --- a/udevstart.c +++ b/udevstart.c @@ -126,6 +126,14 @@ static int add_device(const char *path, const char *subsystem) udev_init_device(&udev, devpath, subsystem, "add"); udev_add_device(&udev, class_dev); + if (udev_run && !list_empty(&udev.run_list)) { + struct name_entry *name_loop; + + dbg("executing run list"); + list_for_each_entry(name_loop, &udev.run_list, node) + execute_command(name_loop->name, udev.subsystem); + } + /* run dev.d/ scripts if we created a node or changed a netif name */ if (udev_dev_d && udev.devname[0] != '\0') { setenv("DEVNAME", udev.devname, 1); -- cgit v1.2.3-54-g00ecf From e4388fb3700146c3bf5cb6ee8b69232101e26f7c Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 2 Apr 2005 18:03:59 +0200 Subject: [PATCH] update RELEASE-NOTES --- RELEASE-NOTES | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 17d6097abf..67b4a6caa1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,5 +1,23 @@ udev 057 ======== +All rules are applied now, but only the first matching rule with a NAME-key +will be applied. All later rules with NAME-key are ignored. This way system +supplied symlinks or permissions gets applied to user-defined naming rules. +Note: +Please check your rules setup, if you may need to add OPTIONS="last_rule" +to some rules, to keep the old behavior. + +The rules are read on "remove"-events too. That makes is possible to match +with keys that are available on remove (KERNEL, SUBSYSTEM, ID, ENV, ...) to +instruct udev to ignore a event (OPTIONS="ignore_device"). +The new ACTION-key may be used to match a rule only at a "remove"-event. + +The new RUN-key supports rule-based execution of programs after device-node +handling. This can replace the dev.d/-rules to make them more efficient. + +The %s{}-sysfs format char replacement values are searched at any of the +devices in the device chain now, not only at the class-device. + We support log priority levels now. The value udev_log in udev.conf is used to determine what is printed to syslog. This makes it possible to run a version with compiled-in debug messages in a production environment -- cgit v1.2.3-54-g00ecf From 87b60f72b762fddad92c83856ebe05b5aa05fc76 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sat, 2 Apr 2005 18:06:26 +0200 Subject: [PATCH] fix make -j4 and the local klibc-install --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index bc3425e278..9c755ba4de 100644 --- a/Makefile +++ b/Makefile @@ -217,7 +217,7 @@ all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(K done ; \ $(KLCC): - $(MAKE) -C klibc KRNLSRC=$(KERNEL_DIR) SUBDIRS=klibc TESTS= \ + $(MAKE) -j1 -C klibc KRNLSRC=$(KERNEL_DIR) SUBDIRS=klibc TESTS= \ SHLIBDIR=$(KLIBC_INSTALL)/lib \ INSTALLDIR=$(KLIBC_INSTALL) \ bindir=$(KLIBC_INSTALL)/bin \ @@ -263,15 +263,15 @@ GEN_MANPAGESIN = udev.8.in $(GEN_MANPAGES): $(GEN_MANPAGESIN) sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ -$(UDEV_OBJS): $(GEN_HEADERS) $(HOST_PROGS) -$(SYSFS_OBJS): $(HOST_PROGS) -$(OBJS): $(GEN_HEADERS) $(HOST_PROGS) -$(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS) -$(TESTER).o: $(GEN_HEADERS) $(HOST_PROGS) -$(INFO).o: $(GEN_HEADERS) $(HOST_PROGS) -$(DAEMON).o: $(GEN_HEADERS) $(HOST_PROGS) -$(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) -$(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) +$(UDEV_OBJS): $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(SYSFS_OBJS): $(HOST_PROGS) $(KLCC) +$(OBJS): $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(TESTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(INFO).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(DAEMON).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(ROOT): $(KLCC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) $(QUIET) $(LD) $(LDFLAGS) -o $@ $(ROOT).o $(OBJS) $(LIB_OBJS) -- cgit v1.2.3-54-g00ecf From 81af4e0519498fdbf75ad1e4250bfa3278262bde Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 3 Apr 2005 00:29:05 +0200 Subject: [PATCH] export DEVNAME to RUN-key executed programs --- udev.8.in | 2 +- udev.c | 11 ++++++----- udevstart.c | 7 ++++--- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/udev.8.in b/udev.8.in index 4beab0d355..3527d6912f 100644 --- a/udev.8.in +++ b/udev.8.in @@ -314,7 +314,7 @@ The name of a program must have the suffix .I .dev to be recognized. .br -In addition to the hotplug environment variables, +In addition to the kernel provided hotplug environment variables, .B UDEV_LOG is set and contains the numerical priority value, if udev is configured to use .BR syslog (3). diff --git a/udev.c b/udev.c index 5728be59e0..ce9b42f30d 100644 --- a/udev.c +++ b/udev.c @@ -204,6 +204,9 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_remove_device(&udev); } + if (udev.devname[0] != '\0') + setenv("DEVNAME", udev.devname, 1); + if (udev_run && !list_empty(&udev.run_list)) { struct name_entry *name_loop; @@ -213,11 +216,9 @@ int main(int argc, char *argv[], char *envp[]) } /* run dev.d/ scripts if we created/deleted a node or changed a netif name */ - if (udev.devname[0] != '\0') { - setenv("DEVNAME", udev.devname, 1); - if (udev_dev_d) - udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); - } + if (udev_dev_d && udev.devname[0] != '\0') + udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); + } else if (udev.type == DEV_DEVICE) { if (strcmp(action, "add") == 0) { /* wait for sysfs */ diff --git a/udevstart.c b/udevstart.c index d41702efd1..60e63c5ad8 100644 --- a/udevstart.c +++ b/udevstart.c @@ -126,6 +126,9 @@ static int add_device(const char *path, const char *subsystem) udev_init_device(&udev, devpath, subsystem, "add"); udev_add_device(&udev, class_dev); + if (udev.devname[0] != '\0') + setenv("DEVNAME", udev.devname, 1); + if (udev_run && !list_empty(&udev.run_list)) { struct name_entry *name_loop; @@ -135,10 +138,8 @@ static int add_device(const char *path, const char *subsystem) } /* run dev.d/ scripts if we created a node or changed a netif name */ - if (udev_dev_d && udev.devname[0] != '\0') { - setenv("DEVNAME", udev.devname, 1); + if (udev_dev_d && udev.devname[0] != '\0') udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); - } sysfs_close_class_device(class_dev); udev_cleanup_device(&udev); -- cgit v1.2.3-54-g00ecf From 5165d1dcb71899aca01783e9edc4ad11528acab9 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 3 Apr 2005 01:15:44 +0200 Subject: [PATCH] update the man page to reflect the recent changes --- udev.8.in | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/udev.8.in b/udev.8.in index 3527d6912f..5be9308af4 100644 --- a/udev.8.in +++ b/udev.8.in @@ -15,18 +15,23 @@ As part of the subsystem, .B udev is executed if a kernel device is added or removed from the system. -On device creation, +A list of rules is used to match against specific device attributes. +.br +On device addition, .B udev -reads the sysfs directory of the given device to collect device attributes -like label, serial number or bus device number. -These attributes may be used as keys to determine a -unique name for the device. +matches its configured rules against the available device attributes to +uniquely name the device. .B udev -maintains a database for devices present on the system. +maintains its own database for devices present on the system. This database +can be queried for the relationship of the kernel device path and the +name of the device file. .br On device removal, .B udev queries its database for the name of the device file to be deleted. +.br +After the device node handling, a list of collected programs specific to this +device is executed. .SH "CONFIGURATION" All .B udev @@ -156,18 +161,10 @@ The name of the node to be created, or the name, the network interface should be renamed to. .TP .B SYMLINK -The name of a symlink targeting the node. Multiple symlinks may be -specified by separating the names by the space character. -.br -If both the name and the symlink fields are omitted or its -values are empty, the device will be ignored and no node will be created. -.br -If only the symlink field is given and the name field is omitted, -the rule will not be applied immediately, but the symlink field is added -to the symlink list of the rule which will create the node. -This makes it possible to specify additional symlinks in a possibly -separate rules file, while the device nodes are maintained by the -distribution provided rules file. +The name of a symlink targeting the node. Every matching rule can add +this value to the list of symlinks to be created along with the device node. +Multiple symlinks may be specified by separating the names by the space +character. .TP .B OWNER, GROUP, MODE The permissions for the device node. Every specified value overwrites the @@ -178,10 +175,10 @@ Add a program to the list of programs to be executed for a specific device. .TP .B OPTIONS .B last_rule -will be the last rule applied. No later rules will have any effect. +stops further rules application. No later rules will have any effect. .sp .B ignore_device -will ignore this device. No node will be created. +will ignore this device. No node will be created or program executed. .sp .B ignore_remove will ignore any later remove event for this device. @@ -261,7 +258,7 @@ where device can come and go at any time is not recomended. .B %% The '%' character itself. .P -The count of charcters to insert may be limited by specifying +The count of characters to insert may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute. .P -- cgit v1.2.3-54-g00ecf From f040a4a271dd093413303158efb027fe9e891e80 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 4 Apr 2005 15:20:48 +0200 Subject: [PATCH] udev-test.pl: add test for DEVNAME export to RUN environment --- test/udev-test.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 91e91bb2ae..c1dc8b2f1b 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1278,6 +1278,19 @@ EOF rules => < "test RUN key and DEVNAME", + subsys => "block", + devpath => "/block/sda", + exp_name => "testsymlink", + exp_target => "ok", + exp_rem_error => "yes", + option => "clean", + rules => < Date: Tue, 5 Apr 2005 04:01:08 +0200 Subject: [PATCH] udev_volume_id: fix endianess macros --- extras/volume_id/volume_id/util.h | 4 ++++ extras/volume_id/volume_id/volume_id.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h index 9cea8fc3a0..e18efe2f21 100644 --- a/extras/volume_id/volume_id/util.h +++ b/extras/volume_id/volume_id/util.h @@ -29,6 +29,8 @@ # include #endif +#include + /* size of superblock buffer, reiserfs block is at 64k */ #define SB_BUFFER_SIZE 0x11000 /* size of seek buffer, FAT cluster is 32k max */ @@ -52,6 +54,7 @@ (((__u64)(x) & 0x000000000000ff00ull) << 40) | \ (((__u64)(x) & 0x00000000000000ffull) << 56)) +#ifdef __BYTE_ORDER #if (__BYTE_ORDER == __LITTLE_ENDIAN) #define le16_to_cpu(x) (x) #define le32_to_cpu(x) (x) @@ -69,6 +72,7 @@ #define cpu_to_le32(x) bswap32(x) #define cpu_to_be32(x) (x) #endif +#endif /* __BYTE_ORDER */ enum uuid_format { UUID_DCE_STRING, diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index c7fa0d9bea..2266694f5e 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 43 +#define VOLUME_ID_VERSION 44 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From 16eb35d16e4c897f8d0bf7accce5c8ad066e8774 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Wed, 6 Apr 2005 06:47:06 +0200 Subject: [PATCH] adapt RELEASE-NOTES --- RELEASE-NOTES | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 67b4a6caa1..9b7fa31330 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,19 +1,22 @@ udev 057 ======== All rules are applied now, but only the first matching rule with a NAME-key -will be applied. All later rules with NAME-key are ignored. This way system -supplied symlinks or permissions gets applied to user-defined naming rules. +will be applied. All later rules with NAME-key are completely ignored. This +way system supplied symlinks or permissions gets applied to user-defined +naming rules. + Note: Please check your rules setup, if you may need to add OPTIONS="last_rule" to some rules, to keep the old behavior. The rules are read on "remove"-events too. That makes is possible to match with keys that are available on remove (KERNEL, SUBSYSTEM, ID, ENV, ...) to -instruct udev to ignore a event (OPTIONS="ignore_device"). -The new ACTION-key may be used to match a rule only at a "remove"-event. +instruct udev to ignore an event (OPTIONS="ignore_device"). +The new ACTION-key may be used to let a rule act only at a "remove"-event. The new RUN-key supports rule-based execution of programs after device-node -handling. This can replace the dev.d/-rules to make them more efficient. +handling. This is meant as a general replacement for the dev.d/-directories +to give fine grained control over the execution of programs. The %s{}-sysfs format char replacement values are searched at any of the devices in the device chain now, not only at the class-device. @@ -30,7 +33,7 @@ UDEV_LOG. udev 056 ======== Possible use of a system-wide klibc: - make USE_KLIB=true KLCC=/usr/bin/klcc all + make USE_KLIBC=true KLCC=/usr/bin/klcc all will link against an external klibc and our own version will be ignored. udev 055 -- cgit v1.2.3-54-g00ecf From 1bbff4f03584dc0ba830d8cb0fc91d10bd79ac94 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 10 Apr 2005 21:15:12 +0200 Subject: [PATCH] apply default permissions only for devices that will need it --- udev_utils.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udev_utils.c b/udev_utils.c index 5cdfb1421d..74b55ed406 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -89,9 +89,11 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs } } - udev->mode = 0660; - strcpy(udev->owner, "root"); - strcpy(udev->group, "root"); + if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { + udev->mode = 0660; + strcpy(udev->owner, "root"); + strcpy(udev->group, "root"); + } return 0; } -- cgit v1.2.3-54-g00ecf From 7ab16233831bb90b2ee14e7ee98c3dde77276a9e Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Sun, 10 Apr 2005 21:19:51 +0200 Subject: [PATCH] update Debian rules --- etc/udev/debian/devfs.rules | 111 ++++++++++---------------------------- etc/udev/debian/permissions.rules | 73 +++++++++++++++++++++++++ etc/udev/debian/udev.rules | 83 ++++++---------------------- 3 files changed, 118 insertions(+), 149 deletions(-) create mode 100644 etc/udev/debian/permissions.rules diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index cffef1a2e2..0453e66d5f 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -13,56 +13,19 @@ # %% the '%' char itself. # -# default permissions for block devices -SUBSYSTEM="block", GROUP="disk" -SUBSYSTEM="block", SYSFS{removable}="1", GROUP="floppy" - # workaround for devices which do not report media changes BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/bin/cat /proc/ide/%k/model", RESULT="IOMEGA ZIP *", \ - NAME{all_partitions}="%k%n", GROUP="floppy" + PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT="IOMEGA ZIP *", \ + OPTIONS="all_partitions", NAME="%k" # IDE devices -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", \ - GROUP="cdrom" -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", \ - GROUP="floppy" BUS="ide", KERNEL="hd[a-z]*", \ - PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="ide", KERNEL="ht[0-9]*", GROUP="tape" -BUS="ide", KERNEL="nht[0-9]*", GROUP="tape" + PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}" # SCSI devices -BUS="scsi", KERNEL="sd[a-z]", \ - PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="sd[a-z][0-9]*", \ - PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="sd[a-i][a-z]", \ - PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="sd[a-i][a-z][0-9]*", \ - PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="s[gr][0-9]*", SYSFS{type}="5", \ - PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}", GROUP="cdrom" -BUS="scsi", KERNEL="sr[0-9]*", \ - PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}", GROUP="cdrom" -BUS="scsi", KERNEL="sg[0-9]*", \ - PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}" -BUS="scsi", KERNEL="st[0-9]*", \ - PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}", GROUP="tape" -BUS="scsi", KERNEL="nst[0-9]*", \ - PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}", GROUP="tape" +BUS="scsi", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK="%k %c{2}" # RAID controllers KERNEL="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ @@ -78,15 +41,15 @@ KERNEL="loop[0-9]*", NAME="loop/%n" KERNEL="ram[0-9]*", NAME="rd/%n" # USB devices -BUS="usb", KERNEL="hiddev*", NAME="usb/%k" BUS="usb", KERNEL="auer[0-9]*", NAME="usb/%k" -BUS="usb", KERNEL="legousbtower*", NAME="usb/%k", MODE="0666" -BUS="usb", KERNEL="dabusb*", NAME="usb/%k" BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" +BUS="usb", KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="hiddev*", NAME="usb/%k" +BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" BUS="usb", KERNEL="ttyUSB*", SYSFS{product}="Palm Handheld*", SYMLINK="pilot" # serial devices -SUBSYSTEM="tty", GROUP="dialout" KERNEL="ttyS[0-9]*", NAME="tts/%n" KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" KERNEL="rfcomm[0-9]*", NAME="bluetooth/rfcomm/%n", @@ -94,8 +57,6 @@ KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" KERNEL="capi[0-9]*", NAME="capi/%n" # vc devices -KERNEL="ptmx", MODE="0666" -KERNEL="tty", MODE="0666" KERNEL="tty[0-9]*", NAME="vc/%n" KERNEL="vcs", NAME="vcc/0" KERNEL="vcs[0-9]*", NAME="vcc/%n" @@ -103,49 +64,32 @@ KERNEL="vcsa", NAME="vcc/a0" KERNEL="vcsa[0-9]*", NAME="vcc/a%n" # video devices -SUBSYSTEM="video4linux", GROUP="video" KERNEL="video[0-9]*", NAME="v4l/%k" KERNEL="radio[0-9]*", NAME="v4l/%k" KERNEL="vbi[0-9]*", NAME="v4l/%k" KERNEL="vtx[0-9]*", NAME="v4l/%k" -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ - NAME="%c", GROUP="video" -KERNEL="fb[0-9]*", NAME="fb/%n", GROUP="video" -KERNEL="nvidia*", GROUP="video" -KERNEL="card[0-9]*", NAME="dri/%k", GROUP="video" +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" +KERNEL="fb[0-9]*", NAME="fb/%n" +KERNEL="card[0-9]*", NAME="dri/%k" # misc devices -KERNEL="random", MODE="0666" -KERNEL="urandom", MODE="0444" -KERNEL="mem", MODE="0640", GROUP="kmem" -KERNEL="kmem", MODE="0640", GROUP="kmem" -KERNEL="port", MODE="0640", GROUP="kmem" -KERNEL="full", MODE="0666" -KERNEL="null", MODE="0666" -KERNEL="zero", MODE="0666" -KERNEL="inotify", MODE="0666" -KERNEL="sgi_fetchop", MODE="0666" -KERNEL="sonypi", MODE="0666" KERNEL="apm_bios", NAME="misc/%k", -KERNEL="agpgart", NAME="misc/%k", GROUP="video" -KERNEL="nvram", NAME="misc/%k", GROUP="nvram" +KERNEL="agpgart", NAME="misc/%k" +KERNEL="nvram", NAME="misc/%k" KERNEL="psaux", NAME="misc/%k" -KERNEL="rtc", NAME="misc/%k", MODE="0644", GROUP="audio" +KERNEL="rtc", NAME="misc/%k" KERNEL="hw_random", NAME="hwrng" # printers and parallel devices -SUBSYSTEM="printer", GROUP="lp" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" KERNEL="lp[0-9]*", NAME="printers/%n" -KERNEL="pt[0-9]*", GROUP="tape" -KERNEL="pht[0-9]*", GROUP="tape" +KERNEL="parport[0-9]*", NAME="parports/%n" KERNEL="i2c-[0-9]*", NAME="i2c/%n" -KERNEL="fd[0-9]*", NAME="floppy/%n", GROUP="floppy" +KERNEL="fd[0-9]*", NAME="floppy/%n" -KERNEL="cdemu[0-9]*", NAME="cdemu/%n", GROUP="cdrom" -KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n", GROUP="cdrom" -KERNEL="pktcdvd", NAME="pktcdvd/control", MODE="0644" +KERNEL="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL="pktcdvd", NAME="pktcdvd/control" KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" KERNEL="msr[0-9]*", NAME="cpu/%n/msr" @@ -158,7 +102,6 @@ KERNEL="tap[0-9]*", NAME="net/%k" KERNEL="tun", NAME="net/%k" # sound devices -SUBSYSTEM="sound", GROUP="audio" KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hwC[D0-9]*", NAME="snd/%k" KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" @@ -178,11 +121,8 @@ KERNEL="admmidi*", NAME="sound/%k" # input devices KERNEL="mice", NAME="input/%k" KERNEL="mouse[0-9]*", NAME="input/%k" -KERNEL="event[0-9]*", NAME="input/%k", \ - PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", \ - MODE="0664", GROUP="video" KERNEL="event[0-9]*", NAME="input/%k" -KERNEL="js[0-9]*", NAME="input/%k", MODE="0664" +KERNEL="js[0-9]*", NAME="input/%k" KERNEL="ts[0-9]*", NAME="input/%k" KERNEL="uinput", NAME="input/%k" @@ -193,7 +133,12 @@ KERNEL="zapchannel", NAME="zap/channel" KERNEL="zappseudo", NAME="zap/pseudo" KERNEL="zap[0-9]*", NAME="zap/%n" +# AOE character devices +SUBSYSTEM="aoe", KERNEL="discover", NAME="etherd/%k" +SUBSYSTEM="aoe", KERNEL="err", NAME="etherd/%k" +SUBSYSTEM="aoe", KERNEL="interfaces", NAME="etherd/%k" + # device mapper creates its own device nodes, so ignore these -KERNEL="dm-[0-9]*", NAME="" +KERNEL="dm-[0-9]*", OPTIONS="ignore_device" KERNEL="device-mapper", NAME="mapper/control" diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules new file mode 100644 index 0000000000..48510e67f6 --- /dev/null +++ b/etc/udev/debian/permissions.rules @@ -0,0 +1,73 @@ +# default permissions for block devices +SUBSYSTEM="block", GROUP="disk" +SUBSYSTEM="block", SYSFS{removable}="1", GROUP="floppy" + +# IDE devices +BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ + PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", GROUP="cdrom" +BUS="ide", KERNEL="ht[0-9]*", GROUP="tape" +BUS="ide", KERNEL="nht[0-9]*", GROUP="tape" + +# SCSI devices +BUS="scsi", SYSFS{type}="1", GROUP="tape" +BUS="scsi", SYSFS{type}="5", GROUP="cdrom" +BUS="scsi", SYSFS{type}="6", GROUP="scanner" + +# USB devices +BUS="usb", KERNEL="legousbtower*", MODE="0666" + +# serial devices +SUBSYSTEM="tty", GROUP="dialout" +SUBSYSTEM="capi", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL="ptmx", MODE="0666", GROUP="root" +KERNEL="console", MODE="0600", GROUP="root" +KERNEL="tty", MODE="0666", GROUP="root" +KERNEL="tty[0-9]*", GROUP="root" + +# video devices +SUBSYSTEM="video4linux", GROUP="video" +SUBSYSTEM="dvb", GROUP="video" +SUBSYSTEM="graphics", GROUP="video" +SUBSYSTEM="nvidia", GROUP="video" +SUBSYSTEM="drm", GROUP="video" + +# misc devices +KERNEL="random", MODE="0666" +KERNEL="urandom", MODE="0444" +KERNEL="mem", MODE="0640", GROUP="kmem" +KERNEL="kmem", MODE="0640", GROUP="kmem" +KERNEL="port", MODE="0640", GROUP="kmem" +KERNEL="full", MODE="0666" +KERNEL="null", MODE="0666" +KERNEL="zero", MODE="0666" +KERNEL="inotify", MODE="0666" +KERNEL="sgi_fetchop", MODE="0666" +KERNEL="sonypi", MODE="0666" +KERNEL="agpgart", GROUP="video" +KERNEL="nvram", GROUP="nvram" +KERNEL="rtc", MODE="0660", GROUP="audio" + +KERNEL="cdemu[0-9]*", GROUP="cdrom" +KERNEL="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL="pktcdvd", MODE="0644" + +# printers and parallel devices +SUBSYSTEM="printer", GROUP="lp" +SUBSYSTEM="ppdev", GROUP="lp" +KERNEL="pt[0-9]*", GROUP="tape" +KERNEL="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM="sound", GROUP="audio" + +# input devices +KERNEL="event[0-9]*", PROGRAM="/etc/udev/scripts/inputdev.sh %k", \ + RESULT="inputdev", MODE="0664", GROUP="video" +KERNEL="js[0-9]*", MODE="0664" + +# AOE character devices +SUBSYSTEM="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM="aoe", KERNEL="err", MODE="0440" + diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index 0f7aeb73d4..a506a02ad3 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -13,87 +13,37 @@ # %% the '%' char itself. # -# default permissions for block devices -SUBSYSTEM="block", GROUP="disk" -SUBSYSTEM="block", SYSFS{removable}="1", GROUP="floppy" - # workaround for devices which do not report media changes BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/bin/cat /proc/ide/%k/model", RESULT="IOMEGA ZIP *", \ - NAME{all_partitions}="%k%n", GROUP="floppy" - -# IDE devices -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", \ - GROUP="cdrom" -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", \ - GROUP="floppy" -BUS="ide", KERNEL="ht[0-9]*", GROUP="tape" -BUS="ide", KERNEL="nht[0-9]*", GROUP="tape" + PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT="IOMEGA ZIP *", \ + OPTIONS="all_partitions", NAME="%k" # SCSI devices -BUS="scsi", KERNEL="sr[0-9]*", SYSFS{type}="5", \ - NAME="scd%n", SYMLINK="sr%n", GROUP="cdrom" -BUS="scsi", KERNEL="sg[0-9]*", SYSFS{type}="5", GROUP="cdrom" -BUS="scsi", KERNEL="st[0-9]*", GROUP="tape" -BUS="scsi", KERNEL="nst[0-9]*", GROUP="tape" -BUS="scsi", KERNEL="osst[0-9]*", GROUP="tape" -BUS="scsi", KERNEL="nosst[0-9]*", GROUP="tape" +BUS="scsi", KERNEL="sr[0-9]*", NAME="scd%n", SYMLINK="sr%n" # USB devices BUS="usb", KERNEL="hiddev*", NAME="usb/%k" BUS="usb", KERNEL="auer[0-9]*", NAME="usb/%k" -BUS="usb", KERNEL="legousbtower*", NAME="usb/%k", MODE="0666" +BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" BUS="usb", KERNEL="dabusb*", NAME="usb/%k" BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" BUS="usb", KERNEL="ttyUSB*", SYSFS{product}="Palm Handheld*", SYMLINK="pilot" # serial devices -SUBSYSTEM="tty", GROUP="dialout" KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" KERNEL="capi[0-9]*", NAME="capi/%n" -# vc devices -KERNEL="ptmx", MODE="0666" -KERNEL="tty", MODE="0666" - # video devices -SUBSYSTEM="video4linux", GROUP="video" -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ - NAME="%c", GROUP="video" -KERNEL="fb[0-9]*", GROUP="video" -KERNEL="nvidia*", GROUP="video" -KERNEL="card[0-9]*", NAME="dri/%k", GROUP="video" +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" +KERNEL="card[0-9]*", NAME="dri/%k" # misc devices -KERNEL="random", MODE="0666" -KERNEL="urandom", MODE="0444" -KERNEL="mem", MODE="0640", GROUP="kmem" -KERNEL="kmem", MODE="0640", GROUP="kmem" -KERNEL="port", MODE="0640", GROUP="kmem" -KERNEL="full", MODE="0666" -KERNEL="null", MODE="0666" -KERNEL="zero", MODE="0666" -KERNEL="inotify", MODE="0666" -KERNEL="sgi_fetchop", MODE="0666" -KERNEL="sonypi", MODE="0666" -KERNEL="agpgart", GROUP="video" -KERNEL="nvram", GROUP="nvram" -KERNEL="rtc", MODE="0664", GROUP="audio" KERNEL="hw_random", NAME="hwrng" -# printers and parallel devices -SUBSYSTEM="printer", GROUP="lp" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" -KERNEL="pt[0-9]*", GROUP="tape" -KERNEL="pht[0-9]*", GROUP="tape" - -KERNEL="fd[0-9]*", GROUP="floppy" - -KERNEL="cdemu[0-9]*", NAME="cdemu/%n", GROUP="cdrom" -KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n", GROUP="cdrom" -KERNEL="pktcdvd", NAME="pktcdvd/control", MODE="0644" +KERNEL="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL="pktcdvd", NAME="pktcdvd/control" KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" KERNEL="msr[0-9]*", NAME="cpu/%n/msr" @@ -106,7 +56,6 @@ KERNEL="tap[0-9]*", NAME="net/%k" KERNEL="tun", NAME="net/%k" # ALSA devices -SUBSYSTEM="sound", GROUP="audio" KERNEL="controlC[0-9]*", NAME="snd/%k" KERNEL="hwC[D0-9]*", NAME="snd/%k" KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" @@ -117,11 +66,8 @@ KERNEL="seq", NAME="snd/%k" # input devices KERNEL="mice", NAME="input/%k" KERNEL="mouse[0-9]*", NAME="input/%k" -KERNEL="event[0-9]*", NAME="input/%k", \ - PROGRAM="/etc/udev/scripts/inputdev.sh %k", RESULT="inputdev", \ - MODE="0664", GROUP="video" KERNEL="event[0-9]*", NAME="input/%k" -KERNEL="js[0-9]*", NAME="input/%k", MODE="0664" +KERNEL="js[0-9]*", NAME="input/%k" KERNEL="ts[0-9]*", NAME="input/%k" KERNEL="uinput", NAME="input/%k" @@ -132,7 +78,12 @@ KERNEL="zapchannel", NAME="zap/channel" KERNEL="zappseudo", NAME="zap/pseudo" KERNEL="zap[0-9]*", NAME="zap/%n" +# AOE character devices +SUBSYSTEM="aoe", KERNEL="discover", NAME="etherd/%k" +SUBSYSTEM="aoe", KERNEL="err", NAME="etherd/%k" +SUBSYSTEM="aoe", KERNEL="interfaces", NAME="etherd/%k" + # device mapper creates its own device nodes, so ignore these -KERNEL="dm-[0-9]*", NAME="" +KERNEL="dm-[0-9]*", OPTIONS="ignore_device" KERNEL="device-mapper", NAME="mapper/control" -- cgit v1.2.3-54-g00ecf From d3743cfb3bd605a8ccb52d30eeaad6a00e6d2123 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 11 Apr 2005 04:51:03 +0200 Subject: [PATCH] klibc: version 1.0.6 --- klibc/Makefile | 8 ++++---- klibc/klibc/Makefile | 6 ++++-- klibc/klibc/arch/alpha/sysstub.ph | 6 +++--- klibc/klibc/arch/arm/sysstub.ph | 6 +++--- klibc/klibc/arch/cris/sysstub.ph | 6 +++--- klibc/klibc/arch/i386/sysstub.ph | 6 +++--- klibc/klibc/arch/ia64/sysstub.ph | 6 +++--- klibc/klibc/arch/m32r/sysstub.ph | 6 +++--- klibc/klibc/arch/mips/sysstub.ph | 6 +++--- klibc/klibc/arch/parisc/sysstub.ph | 6 +++--- klibc/klibc/arch/ppc/sysstub.ph | 6 +++--- klibc/klibc/arch/ppc64/sysstub.ph | 6 +++--- klibc/klibc/arch/s390/sysstub.ph | 6 +++--- klibc/klibc/arch/s390x/sysstub.ph | 6 +++--- klibc/klibc/arch/sh/sysstub.ph | 6 +++--- klibc/klibc/arch/sparc/sysstub.ph | 6 +++--- klibc/klibc/arch/sparc64/sysstub.ph | 6 +++--- klibc/klibc/arch/x86_64/sysstub.ph | 6 +++--- klibc/klibc/socketcalls.pl | 16 ++++++++++------ klibc/klibc/syscalls.pl | 12 +++++++++--- klibc/makeklcc.pl | 26 ++++++++++++++++++++++++++ klibc/version | 2 +- 22 files changed, 102 insertions(+), 64 deletions(-) diff --git a/klibc/Makefile b/klibc/Makefile index 7a9b92e8d6..5071e60da4 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -18,12 +18,12 @@ $(CROSS)klibc.config: Makefile echo 'ARCH=$(ARCH)' >> $@ echo 'CROSS=$(CROSS)' >> $@ echo 'KCROSS=$(KCROSS)' >> $@ - echo "CC=$(shell bash -c 'type -p $(CC)')" >> $@ - echo "LD=$(shell bash -c 'type -p $(LD)')" >> $@ + echo 'CC=$(CC)' >> $@ + echo 'LD=$(LD)' >> $@ echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@ echo 'OPTFLAGS=$(OPTFLAGS)' >> $@ echo 'LDFLAGS=$(LDFLAGS)' >> $@ - echo "STRIP=$(shell bash -c 'type -p $(STRIP)')" >> $@ + echo 'STRIP=$(STRIP)' >> $@ echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@ echo 'EMAIN=$(EMAIN)' >> $@ echo 'BITSIZE=$(BITSIZE)' >> $@ @@ -45,7 +45,7 @@ local-all: $(CROSS)klcc local-clean: rm -f klibc.config klcc -local-spotless: +local-spotless: local-clean rm -f klibc.spec *~ tags local-install: $(CROSS)klcc diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index c412a9ffea..181a226151 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -141,7 +141,9 @@ syscalls.nrs: ../include/sys/syscall.h syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscalls.nrs rm -rf syscalls mkdir syscalls - $(PERL) syscalls.pl SYSCALLS.i $(ARCH) $(BITSIZE) syscalls.nrs ../include/klibc/havesyscall.h + $(PERL) syscalls.pl SYSCALLS.i arch/$(ARCH)/sysstub.ph $(ARCH) \ + $(BITSIZE) syscalls.nrs \ + syscalls ../include/klibc/havesyscall.h touch $@ ../include/klibc/havesyscall.h: syscalls.dir @@ -150,7 +152,7 @@ syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscall socketcalls.dir: SOCKETCALLS.def socketcalls.pl socketcommon.h rm -rf socketcalls mkdir socketcalls - $(PERL) socketcalls.pl SOCKETCALLS.def $(ARCH) + $(PERL) socketcalls.pl SOCKETCALLS.def $(ARCH) socketcalls touch $@ %/static.obj: %.dir diff --git a/klibc/klibc/arch/alpha/sysstub.ph b/klibc/klibc/arch/alpha/sysstub.ph index a24b6c07dc..08b97e807e 100644 --- a/klibc/klibc/arch/alpha/sysstub.ph +++ b/klibc/klibc/arch/alpha/sysstub.ph @@ -12,13 +12,13 @@ # A few system calls are dual-return with the second return value in # r20 (a4). -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; $stype = $stype || 'common'; $stype = 'common' if ( $stype eq 'dual0' ); - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "#include \n"; print OUT "\n"; diff --git a/klibc/klibc/arch/arm/sysstub.ph b/klibc/klibc/arch/arm/sysstub.ph index bf953ccd80..256ea3d534 100644 --- a/klibc/klibc/arch/arm/sysstub.ph +++ b/klibc/klibc/arch/arm/sysstub.ph @@ -6,10 +6,10 @@ # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/cris/sysstub.ph b/klibc/klibc/arch/cris/sysstub.ph index 6c894f62f5..182ad73f8c 100644 --- a/klibc/klibc/arch/cris/sysstub.ph +++ b/klibc/klibc/arch/cris/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/i386/sysstub.ph b/klibc/klibc/arch/i386/sysstub.ph index 1ba7f36bac..e2649e283e 100644 --- a/klibc/klibc/arch/i386/sysstub.ph +++ b/klibc/klibc/arch/i386/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/ia64/sysstub.ph b/klibc/klibc/arch/ia64/sysstub.ph index 34031a29ae..8e686c68a3 100644 --- a/klibc/klibc/arch/ia64/sysstub.ph +++ b/klibc/klibc/arch/ia64/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/m32r/sysstub.ph b/klibc/klibc/arch/m32r/sysstub.ph index 3813ea4144..98dfb9d0a8 100644 --- a/klibc/klibc/arch/m32r/sysstub.ph +++ b/klibc/klibc/arch/m32r/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/mips/sysstub.ph b/klibc/klibc/arch/mips/sysstub.ph index abe599c17d..a71d5d02ef 100644 --- a/klibc/klibc/arch/mips/sysstub.ph +++ b/klibc/klibc/arch/mips/sysstub.ph @@ -9,11 +9,11 @@ # system call number in r0 (v0), return an error value in r19 (a3) as # well as the return value in r0 (v0). -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; $stype = $stype || 'common'; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "#include \n"; print OUT "#include \n"; diff --git a/klibc/klibc/arch/parisc/sysstub.ph b/klibc/klibc/arch/parisc/sysstub.ph index 63b5e17fcf..e2196acaf3 100644 --- a/klibc/klibc/arch/parisc/sysstub.ph +++ b/klibc/klibc/arch/parisc/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.text\n"; diff --git a/klibc/klibc/arch/ppc/sysstub.ph b/klibc/klibc/arch/ppc/sysstub.ph index 542ab5575c..3b3916c726 100644 --- a/klibc/klibc/arch/ppc/sysstub.ph +++ b/klibc/klibc/arch/ppc/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/ppc64/sysstub.ph b/klibc/klibc/arch/ppc64/sysstub.ph index 0a379158e1..9ee93701f6 100644 --- a/klibc/klibc/arch/ppc64/sysstub.ph +++ b/klibc/klibc/arch/ppc64/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.globl ${fname}\n"; diff --git a/klibc/klibc/arch/s390/sysstub.ph b/klibc/klibc/arch/s390/sysstub.ph index 3838a1f1b2..35f40a0865 100644 --- a/klibc/klibc/arch/s390/sysstub.ph +++ b/klibc/klibc/arch/s390/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/s390x/sysstub.ph b/klibc/klibc/arch/s390x/sysstub.ph index 10a47f7b07..55c721b558 100644 --- a/klibc/klibc/arch/s390x/sysstub.ph +++ b/klibc/klibc/arch/s390x/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/sh/sysstub.ph b/klibc/klibc/arch/sh/sysstub.ph index add5d35892..ce04b739e9 100644 --- a/klibc/klibc/arch/sh/sysstub.ph +++ b/klibc/klibc/arch/sh/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.section\t\".text.syscall\",\"ax\"\n"; diff --git a/klibc/klibc/arch/sparc/sysstub.ph b/klibc/klibc/arch/sparc/sysstub.ph index baad9e3d82..d8cedb5ae5 100644 --- a/klibc/klibc/arch/sparc/sysstub.ph +++ b/klibc/klibc/arch/sparc/sysstub.ph @@ -5,12 +5,12 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; $stype = $stype || 'common'; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/sparc64/sysstub.ph b/klibc/klibc/arch/sparc64/sysstub.ph index 2ef2c6b66e..deeb88ce07 100644 --- a/klibc/klibc/arch/sparc64/sysstub.ph +++ b/klibc/klibc/arch/sparc64/sysstub.ph @@ -5,12 +5,12 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; $stype = $stype || 'common'; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/arch/x86_64/sysstub.ph b/klibc/klibc/arch/x86_64/sysstub.ph index 07af1227ca..e2d797b166 100644 --- a/klibc/klibc/arch/x86_64/sysstub.ph +++ b/klibc/klibc/arch/x86_64/sysstub.ph @@ -5,10 +5,10 @@ # Script to generate system call stubs # -sub make_sysstub($$$$@) { - my($fname, $type, $sname, $stype, @args) = @_; +sub make_sysstub($$$$$@) { + my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - open(OUT, '>', "syscalls/${fname}.S"); + open(OUT, '>', "${outputdir}/${fname}.S"); print OUT "#include \n"; print OUT "\n"; print OUT "\t.type ${fname},\@function\n"; diff --git a/klibc/klibc/socketcalls.pl b/klibc/klibc/socketcalls.pl index fd82b2b49f..024483f716 100644 --- a/klibc/klibc/socketcalls.pl +++ b/klibc/klibc/socketcalls.pl @@ -15,12 +15,13 @@ for $arg ( @ARGV ) { push(@args, $arg); } } -($file, $arch) = @args; +($file, $arch, $outputdir) = @args; if (!open(FILE, "< $file")) { die "$file: $!\n"; } +print "socketcall-objs := "; while ( defined($line = ) ) { chomp $line; $line =~ s/\s*[\#\;].*$//; # Strip comments and trailing blanks @@ -39,10 +40,11 @@ while ( defined($line = ) ) { push(@cargs, "$arg a".$i++); } $nargs = $i; + print " \\\n\tsocketcalls/${name}.o"; if ( $arch eq 'i386' ) { - open(OUT, '>', "socketcalls/${name}.S") - or die "$0: Cannot open socketcalls/${name}.S\n"; + open(OUT, '>', "${outputdir}/${name}.S") + or die "$0: Cannot open ${outputdir}/${name}.S\n"; print OUT "#include \n"; print OUT "\n"; @@ -56,10 +58,10 @@ while ( defined($line = ) ) { print OUT "\t.size ${name},.-${name}\n"; close(OUT); } else { - open(OUT, '>', "socketcalls/${name}.c") - or die "$0: Cannot open socketcalls/${name}.c\n"; + open(OUT, '>', "${outputdir}/${name}.c") + or die "$0: Cannot open ${outputdir}/${name}.c\n"; - print OUT "#include \"../socketcommon.h\"\n"; + print OUT "#include \"socketcommon.h\"\n"; print OUT "\n"; print OUT "#ifndef __NR_${name}\n\n"; @@ -82,3 +84,5 @@ while ( defined($line = ) ) { die "$file:$.: Could not parse input\n"; } } + +print "\n"; diff --git a/klibc/klibc/syscalls.pl b/klibc/klibc/syscalls.pl index 1c48ce58ff..9cea63097b 100644 --- a/klibc/klibc/syscalls.pl +++ b/klibc/klibc/syscalls.pl @@ -18,13 +18,14 @@ for $arg ( @ARGV ) { push(@args, $arg); } } -($file, $arch, $bits, $unistd, $havesyscall) = @args; +($file, $sysstub, $arch, $bits, $unistd, $outputdir, $havesyscall) = @args; -require "arch/$arch/sysstub.ph"; +require "$sysstub"; if (!open(UNISTD, '<', $unistd)) { die "$0: $unistd: $!\n"; } + while ( defined($line = ) ) { chomp $line; @@ -46,6 +47,8 @@ if (!open(FILE, '<', $file)) { die "$0: $file: $!\n"; } +print "syscall-objs := "; + while ( defined($line = ) ) { chomp $line; $line =~ s/\s*(|[\#;].*)$//; # Strip comments and trailing blanks @@ -104,11 +107,14 @@ while ( defined($line = ) ) { @args = split(/\s*\,\s*/, $argv); print HAVESYS "#define _KLIBC_HAVE_SYSCALL_${fname} ${sname}\n"; - make_sysstub($fname, $type, $sname, $stype, @args); + print " \\\n\tsyscalls/${fname}.o"; + make_sysstub($outputdir, $fname, $type, $sname, $stype, @args); } else { die "$file:$.: Could not parse input: \"$line\"\n"; } } +print "\n"; + print HAVESYS "\n#endif\n"; close(HAVESYS); diff --git a/klibc/makeklcc.pl b/klibc/makeklcc.pl index f8a6294db3..74045955fd 100644 --- a/klibc/makeklcc.pl +++ b/klibc/makeklcc.pl @@ -5,8 +5,27 @@ # Usage: makeklcc klcc.in klibc.config perlpath # +use File::Spec; + ($klccin, $klibcconf, $perlpath) = @ARGV; +sub pathsearch($) { + my($file) = @_; + my(@path); + my($p,$pp); + + if ( $file =~ /\// ) { + return File::Spec->rel2abs($file); + } + + foreach $p ( split(/\:/, $ENV{'PATH'}) ) { + $pp = File::Spec->rel2abs(File::Spec->catpath(undef, $p, $file)); + return $pp if ( -x $pp ); + } + + return undef; +} + print "#!${perlpath}\n"; open(KLIBCCONF, '<', $klibcconf) or die "$0: cannot open $klibcconf: $!\n"; @@ -14,6 +33,13 @@ while ( defined($l = ) ) { chomp $l; if ( $l =~ /^([^=]+)\=(.*)$/ ) { $n = $1; $s = $2; + + if ( $n eq 'CC' || $n eq 'LD' || $n eq 'STRIP' ) { + $s1 = pathsearch($s); + die "$0: Cannot find $n: $s\n" unless ( defined($s1) ); + $s = $s1; + } + print "\$$n = \"\Q$s\E\";\n"; print "\@$n = qw($s);\n"; print "\$conf{\'\L$n\E\'} = \\\$$n;\n"; diff --git a/klibc/version b/klibc/version index 90a27f9cea..af0b7ddbff 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -1.0.5 +1.0.6 -- cgit v1.2.3-54-g00ecf From 05bd6efb41b6a80378cc4f6e7427a302b4953541 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 11 Apr 2005 22:38:41 +0200 Subject: [PATCH] add test for make -j4 to build-check --- Makefile | 1 + test/simple-build-check.sh | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9c755ba4de..8520b5cc50 100644 --- a/Makefile +++ b/Makefile @@ -427,3 +427,4 @@ uninstall: uninstall-man uninstall-dev.d test: all @ cd test && ./udev-test.pl + @ cd test && ./udevstart-test.pl diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 1ebe044b98..d1e13e69ed 100644 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -10,7 +10,7 @@ make all $MAKEOPTS EXTRAS="$EXTRAS" || exit echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null -make all $MAKEOPTS DEBUG=true EXTRAS="$EXTRAS" || exit +make all -j4 $MAKEOPTS DEBUG=true EXTRAS="$EXTRAS" || exit echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null @@ -18,7 +18,7 @@ make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null -make all $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit +make all -j4 $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null -- cgit v1.2.3-54-g00ecf From 15139b8a623748e7d24b18f12e920d94743d8c52 Mon Sep 17 00:00:00 2001 From: "tklauser@access.unizh.ch" Date: Tue, 12 Apr 2005 01:05:03 +0200 Subject: [PATCH] fix stupid all_partitions bug > On Mon, 2005-04-11 at 14:55 +0200, Norbert Preining wrote: > > On Mon, 11 Apr 2005, Kay Sievers wrote: > > > > brw-rw---- 1 root root 8, 0 2005-04-10 14:58 /dev/sdcard > > > > brw-rw---- 1 root root 8, 1 2005-04-10 14:58 /dev/sdcard1 > > > > brw-rw---- 1 root root 8, 1 2005-04-10 14:58 /dev/sdcard2 > > > > brw-rw---- 1 root root 8, 1 2005-04-10 14:58 /dev/sdcard3 > > > > > > This looks broken. > > > > Good to hear. Yeah, I guess it's broken. In create_node() in udev_add.c there is always added 1 to the minor number, thus the error. The attached patch should fix this. --- test/udev-test.pl | 1 + udev_add.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index c1dc8b2f1b..3172d3302f 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -418,6 +418,7 @@ EOF subsys => "block", devpath => "/block/sda", exp_name => "boot_disk15" , + exp_majorminor => "8:15", rules => <devt), minor(udev->devt)+1); + part_devt = makedev(major(udev->devt), minor(udev->devt) + i); udev_make_node(udev, partitionname, part_devt, udev->mode, uid, gid); } } -- cgit v1.2.3-54-g00ecf From 9530f1fe19529e1acb31adf5a834fa6cb0a27e6a Mon Sep 17 00:00:00 2001 From: "gregkh@suse.de" Date: Thu, 14 Apr 2005 22:39:01 -0700 Subject: [PATCH] 057 relelease --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c7d7269400..5eb72461ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Summary of changes from v056 to v057 +============================================ + +: + o fix stupid all_partitions bug + +Kay Sievers: + o add test for make -j4 to build-check + o klibc: version 1.0.6 + o update Debian rules + o apply default permissions only for devices that will need it + o adapt RELEASE-NOTES + o udev_volume_id: fix endianess macros + o udev-test.pl: add test for DEVNAME export to RUN environment + o update the man page to reflect the recent changes + o export DEVNAME to RUN-key executed programs + o fix make -j4 and the local klibc-install + o update RELEASE-NOTES + o add RUN key to be able to run rule based notification + o fix udevtest to print the error if logging is disabled + o move execute_program to utils + add action to init_device + o correct correction for error path for PROGRAM execution + o correct error path for PROGRAM execution + o klibc: version 1.0.5 + o check for strlen()==0 before accessing strlen()-1 + o allow to match against empty key values + o read %s{}-sysfs values at any device in the chain + o udev_rules.c: don't change sysfs_device while walking up the device chain + o klibc: strlcpy/strlcat - don't alter destination if size == 0 + o fix klibc's broken strlcpy/strlcat + o udevinfo: print SYSFS attribute the same way we match it + o remove untrusted chars read from sysfs-values or returned by PROGRAM + o udevinfo: print errors to stderr instead of stdout + o klibc: version 1.0.4 + o support log-priority levels in udev.conf + o test-suite: remove UDEV_TEST, it's not needed anymore + o libsysfs: remove trailing slash on SYSFS_PATH override + + Summary of changes from v055 to v056 ============================================ diff --git a/Makefile b/Makefile index 8520b5cc50..2e5dd5d9cb 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 056 +VERSION = 057 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev -- cgit v1.2.3-54-g00ecf From d4b611430083674ee1d3aa19b87c9894ac3e39d8 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 15 Apr 2005 16:28:21 +0200 Subject: [PATCH] klibc: version 1.0.7 --- klibc/klibc/Makefile | 12 ++++++------ klibc/klibc/socketcalls.pl | 4 ++-- klibc/klibc/syscalls.pl | 2 +- klibc/version | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile index 181a226151..dff813fc59 100644 --- a/klibc/klibc/Makefile +++ b/klibc/klibc/Makefile @@ -139,8 +139,8 @@ syscalls.nrs: ../include/sys/syscall.h $(CC) $(CFLAGS) -Wp,-dM -x c -E -o $@ $< syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscalls.nrs - rm -rf syscalls - mkdir syscalls + rm -f syscalls/*.[Ssco] syscalls/*.obj + mkdir -p syscalls $(PERL) syscalls.pl SYSCALLS.i arch/$(ARCH)/sysstub.ph $(ARCH) \ $(BITSIZE) syscalls.nrs \ syscalls ../include/klibc/havesyscall.h @@ -150,8 +150,8 @@ syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscall : Generated by side effect socketcalls.dir: SOCKETCALLS.def socketcalls.pl socketcommon.h - rm -rf socketcalls - mkdir socketcalls + rm -f socketcalls/*.[Ssco] socketcalls/*.obj + mkdir -p socketcalls $(PERL) socketcalls.pl SOCKETCALLS.def $(ARCH) socketcalls touch $@ @@ -167,8 +167,8 @@ clean: archclean find . -type f -a \( -name \*.[isoa] -o -name \*.l[iso] \) -print0 | xargs -0rt rm -f rm -f *.a *.so *.hash *.syms *.stripped rm -f $(TESTS) tests/*.stripped - rm -rf syscalls syscalls.dir - rm -rf socketcalls socketcalls.dir + rm -f syscalls/*.[Ssco] syscalls/*.obj syscalls.dir + rm -f socketcalls/*.[Ssco] socketcalls/*.obj socketcalls.dir rm -f sha1hash errlist.c spotless: clean diff --git a/klibc/klibc/socketcalls.pl b/klibc/klibc/socketcalls.pl index 024483f716..68f0fa164b 100644 --- a/klibc/klibc/socketcalls.pl +++ b/klibc/klibc/socketcalls.pl @@ -40,7 +40,7 @@ while ( defined($line = ) ) { push(@cargs, "$arg a".$i++); } $nargs = $i; - print " \\\n\tsocketcalls/${name}.o"; + print " \\\n\t${name}.o"; if ( $arch eq 'i386' ) { open(OUT, '>', "${outputdir}/${name}.S") @@ -61,7 +61,7 @@ while ( defined($line = ) ) { open(OUT, '>', "${outputdir}/${name}.c") or die "$0: Cannot open ${outputdir}/${name}.c\n"; - print OUT "#include \"socketcommon.h\"\n"; + print OUT "#include \"../socketcommon.h\"\n"; print OUT "\n"; print OUT "#ifndef __NR_${name}\n\n"; diff --git a/klibc/klibc/syscalls.pl b/klibc/klibc/syscalls.pl index 9cea63097b..0575fa6648 100644 --- a/klibc/klibc/syscalls.pl +++ b/klibc/klibc/syscalls.pl @@ -107,7 +107,7 @@ while ( defined($line = ) ) { @args = split(/\s*\,\s*/, $argv); print HAVESYS "#define _KLIBC_HAVE_SYSCALL_${fname} ${sname}\n"; - print " \\\n\tsyscalls/${fname}.o"; + print " \\\n\t${fname}.o"; make_sysstub($outputdir, $fname, $type, $sname, $stype, @args); } else { die "$file:$.: Could not parse input: \"$line\"\n"; diff --git a/klibc/version b/klibc/version index af0b7ddbff..238d6e882a 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -1.0.6 +1.0.7 -- cgit v1.2.3-54-g00ecf From 197178360f5c4253aeb743b32224125e58e2fd5d Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 15 Apr 2005 16:28:56 +0200 Subject: [PATCH] libsysfs: version 2.0 --- libsysfs/dlist.c | 2 +- libsysfs/sysfs.h | 2 +- libsysfs/sysfs/dlist.h | 1 + libsysfs/sysfs/libsysfs.h | 15 +++ libsysfs/sysfs_bus.c | 317 ++++++++++++++++++++++++++++++++++++++++++++++ libsysfs/sysfs_class.c | 188 ++++++++++++++++++++++++++- libsysfs/sysfs_device.c | 9 +- libsysfs/sysfs_dir.c | 8 +- libsysfs/sysfs_utils.c | 2 +- 9 files changed, 530 insertions(+), 14 deletions(-) create mode 100644 libsysfs/sysfs_bus.c diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c index c44e9d5ff5..5579602bbc 100644 --- a/libsysfs/dlist.c +++ b/libsysfs/dlist.c @@ -551,7 +551,7 @@ void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)) struct dlist *templist; unsigned int passcount = 1; unsigned int mergecount = 1; - + dlist_start(list); templist = dlist_new(list->data_size); diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h index 838427797d..2add8227a4 100644 --- a/libsysfs/sysfs.h +++ b/libsysfs/sysfs.h @@ -3,7 +3,7 @@ * * Internal Header Definitions for libsysfs * - * Copyright (C) IBM Corp. 2003 + * Copyright (C) IBM Corp. 2003-2005 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/libsysfs/sysfs/dlist.h b/libsysfs/sysfs/dlist.h index 62eaa9fec4..335a490a0a 100644 --- a/libsysfs/sysfs/dlist.h +++ b/libsysfs/sysfs/dlist.h @@ -50,6 +50,7 @@ * Just use the dlist_(insert|delete)_(before|after) macros if you do not want * to think about it. + */ #include diff --git a/libsysfs/sysfs/libsysfs.h b/libsysfs/sysfs/libsysfs.h index 2f122405d7..12e7cc5f99 100644 --- a/libsysfs/sysfs/libsysfs.h +++ b/libsysfs/sysfs/libsysfs.h @@ -184,6 +184,21 @@ extern struct dlist *sysfs_get_classdev_attributes (struct sysfs_class_device *clsdev); extern struct sysfs_device *sysfs_get_classdev_device (struct sysfs_class_device *clsdev); +extern void sysfs_close_class(struct sysfs_class *cls); +extern struct sysfs_class *sysfs_open_class(const char *name); +extern struct sysfs_class_device *sysfs_get_class_device + (struct sysfs_class *cls, const char *name); +extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); + +/* generic sysfs bus access */ +extern void sysfs_close_bus(struct sysfs_bus *bus); +extern struct sysfs_bus *sysfs_open_bus(const char *name); +extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); +extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); +extern struct sysfs_device *sysfs_get_bus_device + (struct sysfs_bus *bus, const char *id); +extern struct sysfs_driver *sysfs_get_bus_driver + (struct sysfs_bus *bus, const char *drvname); /** * sort_list: sorter function to keep list elements sorted in alphabetical diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c new file mode 100644 index 0000000000..921ef32094 --- /dev/null +++ b/libsysfs/sysfs_bus.c @@ -0,0 +1,317 @@ +/* + * sysfs_bus.c + * + * Generic bus utility functions for libsysfs + * + * Copyright (C) IBM Corp. 2003-2005 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +#include "libsysfs.h" +#include "sysfs.h" + +static void sysfs_close_dev(void *dev) +{ + sysfs_close_device((struct sysfs_device *)dev); +} + +static void sysfs_close_drv(void *drv) +{ + sysfs_close_driver((struct sysfs_driver *)drv); +} + +/* + * compares names. + * @a: name looked for + * @b: sysfs_device comparing being compared + * returns 1 if a==b->name or 0 not equal + */ +static int name_equal(void *a, void *b) +{ + if (!a || !b) + return 0; + + if (strcmp(((char *)a), ((struct sysfs_device *)b)->name) == 0) + return 1; + + return 0; +} + +/** + * sysfs_close_bus: close single bus + * @bus: bus structure + */ +void sysfs_close_bus(struct sysfs_bus *bus) +{ + if (bus) { + if (bus->attrlist) + dlist_destroy(bus->attrlist); + if (bus->devices) + dlist_destroy(bus->devices); + if (bus->drivers) + dlist_destroy(bus->drivers); + free(bus); + } +} + +/** + * alloc_bus: mallocs new bus structure + * returns sysfs_bus_bus struct or NULL + */ +static struct sysfs_bus *alloc_bus(void) +{ + return (struct sysfs_bus *)calloc(1, sizeof(struct sysfs_bus)); +} + +/** + * sysfs_get_bus_devices: gets all devices for bus + * @bus: bus to get devices for + * returns dlist of devices with success and NULL with failure + */ +struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) +{ + struct sysfs_device *dev; + struct dlist *linklist; + char path[SYSFS_PATH_MAX], devpath[SYSFS_PATH_MAX]; + char target[SYSFS_PATH_MAX]; + char *curlink; + + if (!bus) { + errno = EINVAL; + return NULL; + } + memset(path, 0, SYSFS_PATH_MAX); + safestrcpy(path, bus->path); + safestrcat(path, "/"); + safestrcat(path, SYSFS_DEVICES_NAME); + + linklist = read_dir_links(path); + if (linklist) { + dlist_for_each_data(linklist, curlink, char) { + if (bus->devices) { + dev = (struct sysfs_device *) + dlist_find_custom(bus->devices, + (void *)curlink, name_equal); + if (dev) + continue; + } + safestrcpy(devpath, path); + safestrcat(devpath, "/"); + safestrcat(devpath, curlink); + if (sysfs_get_link(devpath, target, SYSFS_PATH_MAX)) { + dprintf("Error getting link - %s\n", devpath); + continue; + } + dev = sysfs_open_device_path(target); + if (!dev) { + dprintf("Error opening device at %s\n", + target); + continue; + } + if (!bus->devices) + bus->devices = dlist_new_with_delete + (sizeof(struct sysfs_device), + sysfs_close_dev); + dlist_unshift_sorted(bus->devices, dev, sort_list); + } + sysfs_close_list(linklist); + } + return (bus->devices); +} + +/** + * sysfs_get_bus_drivers: gets all drivers for bus + * @bus: bus to get devices for + * returns dlist of devices with success and NULL with failure + */ +struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) +{ + struct sysfs_driver *drv; + struct dlist *dirlist; + char path[SYSFS_PATH_MAX], drvpath[SYSFS_PATH_MAX]; + char *curdir; + + if (!bus) { + errno = EINVAL; + return NULL; + } + memset(path, 0, SYSFS_PATH_MAX); + safestrcpy(path, bus->path); + safestrcat(path, "/"); + safestrcat(path, SYSFS_DRIVERS_NAME); + + dirlist = read_dir_subdirs(path); + if (dirlist) { + dlist_for_each_data(dirlist, curdir, char) { + if (bus->drivers) { + drv = (struct sysfs_driver *) + dlist_find_custom(bus->drivers, + (void *)curdir, name_equal); + if (drv) + continue; + } + safestrcpy(drvpath, path); + safestrcat(drvpath, "/"); + safestrcat(drvpath, curdir); + drv = sysfs_open_driver_path(drvpath); + if (!drv) { + dprintf("Error opening driver at %s\n", + drvpath); + continue; + } + if (!bus->drivers) + bus->drivers = dlist_new_with_delete + (sizeof(struct sysfs_driver), + sysfs_close_drv); + dlist_unshift_sorted(bus->drivers, drv, sort_list); + } + sysfs_close_list(dirlist); + } + return (bus->drivers); +} + +/** + * sysfs_open_bus: opens specific bus and all its devices on system + * returns sysfs_bus structure with success or NULL with error. + */ +struct sysfs_bus *sysfs_open_bus(const char *name) +{ + struct sysfs_bus *bus; + char buspath[SYSFS_PATH_MAX]; + + if (!name) { + errno = EINVAL; + return NULL; + } + + memset(buspath, 0, SYSFS_PATH_MAX); + if (sysfs_get_mnt_path(buspath, SYSFS_PATH_MAX)) { + dprintf("Sysfs not supported on this system\n"); + return NULL; + } + + safestrcat(buspath, "/"); + safestrcat(buspath, SYSFS_BUS_NAME); + safestrcat(buspath, "/"); + safestrcat(buspath, name); + if (sysfs_path_is_dir(buspath)) { + dprintf("Invalid path to bus: %s\n", buspath); + return NULL; + } + bus = alloc_bus(); + if (!bus) { + dprintf("calloc failed\n"); + return NULL; + } + safestrcpy(bus->name, name); + safestrcpy(bus->path, buspath); + if (sysfs_remove_trailing_slash(bus->path)) { + dprintf("Incorrect path to bus %s\n", bus->path); + sysfs_close_bus(bus); + return NULL; + } + + return bus; +} + +/** + * sysfs_get_bus_device: Get specific device on bus using device's id + * @bus: bus to find device on + * @id: bus_id for device + * returns struct sysfs_device reference or NULL if not found. + */ +struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, + const char *id) +{ + struct sysfs_device *dev = NULL; + char devpath[SYSFS_PATH_MAX], target[SYSFS_PATH_MAX]; + + if (!bus || !id) { + errno = EINVAL; + return NULL; + } + + if (bus->devices) { + dev = (struct sysfs_device *)dlist_find_custom + (bus->devices, (void *)id, name_equal); + if (dev) + return dev; + } + safestrcpy(devpath, bus->path); + safestrcat(devpath, "/"); + safestrcat(devpath, SYSFS_DEVICES_NAME); + safestrcat(devpath, "/"); + safestrcat(devpath, id); + if (sysfs_path_is_link(devpath)) { + dprintf("No such device %s on bus %s?\n", id, bus->name); + return NULL; + } + if (!sysfs_get_link(devpath, target, SYSFS_PATH_MAX)) { + dev = sysfs_open_device_path(target); + if (!dev) { + dprintf("Error opening device at %s\n", target); + return NULL; + } + if (!bus->devices) + bus->devices = dlist_new_with_delete + (sizeof(struct sysfs_device), + sysfs_close_dev); + dlist_unshift_sorted(bus->devices, dev, sort_list); + } + return dev; +} + +/** + * sysfs_get_bus_driver: Get specific driver on bus using driver name + * @bus: bus to find driver on + * @drvname: name of driver + * returns struct sysfs_driver reference or NULL if not found. + */ +struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, + const char *drvname) +{ + struct sysfs_driver *drv; + char drvpath[SYSFS_PATH_MAX]; + + if (!bus || !drvname) { + errno = EINVAL; + return NULL; + } + + if (bus->drivers) { + drv = (struct sysfs_driver *)dlist_find_custom + (bus->drivers, (void *)drvname, name_equal); + if (drv) + return drv; + } + safestrcpy(drvpath, bus->path); + safestrcat(drvpath, "/"); + safestrcat(drvpath, SYSFS_DRIVERS_NAME); + safestrcat(drvpath, "/"); + safestrcat(drvpath, drvname); + drv = sysfs_open_driver_path(drvpath); + if (!drv) { + dprintf("Error opening driver at %s\n", drvpath); + return NULL; + } + if (!bus->drivers) + bus->drivers = dlist_new_with_delete + (sizeof(struct sysfs_driver), + sysfs_close_drv); + dlist_unshift_sorted(bus->drivers, drv, sort_list); + return drv; +} + diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index a93de573d4..edf751b124 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -40,6 +40,43 @@ void sysfs_close_class_device(struct sysfs_class_device *dev) } } +static void sysfs_close_cls_dev(void *dev) +{ + sysfs_close_class_device((struct sysfs_class_device *)dev); +} + +/** + * sysfs_close_class: close the given class + * @cls: sysfs_class to close + */ +void sysfs_close_class(struct sysfs_class *cls) +{ + if (cls) { + if (cls->devices) + dlist_destroy(cls->devices); + if (cls->attrlist) + dlist_destroy(cls->attrlist); + free(cls); + } +} + +static int cdev_name_equal(void *a, void *b) +{ + if (!a || !b) + return 0; + + if (strncmp((char *)a, ((struct sysfs_class_device *)b)->name, + strlen((char *)a)) == 0) + return 1; + + return 0; +} + +static struct sysfs_class *alloc_class(void) +{ + return (struct sysfs_class *) calloc(1, sizeof(struct sysfs_class)); +} + /** * alloc_class_device: mallocs and initializes new class device struct. * returns sysfs_class_device or NULL. @@ -96,7 +133,7 @@ struct sysfs_class_device *sysfs_open_class_device_path(const char *path) errno = EINVAL; return NULL; } - if ((sysfs_path_is_dir(path)) != 0) { + if (sysfs_path_is_dir(path)) { dprintf("%s is not a valid path to a class device\n", path); return NULL; } @@ -113,7 +150,7 @@ struct sysfs_class_device *sysfs_open_class_device_path(const char *path) } safestrcpy(cdev->path, path); - if ((sysfs_remove_trailing_slash(cdev->path)) != 0) { + if (sysfs_remove_trailing_slash(cdev->path)) { dprintf("Invalid path to class device %s\n", cdev->path); sysfs_close_class_device(cdev); return NULL; @@ -335,3 +372,150 @@ struct sysfs_device *sysfs_get_classdev_device } return clsdev->sysdevice; } + +/** + * sysfs_open_class: opens specific class and all its devices on system + * returns sysfs_class structure with success or NULL with error. + */ +struct sysfs_class *sysfs_open_class(const char *name) +{ + struct sysfs_class *cls = NULL; + char classpath[SYSFS_PATH_MAX]; + + if (!name) { + errno = EINVAL; + return NULL; + } + + memset(classpath, 0, SYSFS_PATH_MAX); + if ((sysfs_get_mnt_path(classpath, SYSFS_PATH_MAX)) != 0) { + dprintf("Sysfs not supported on this system\n"); + return NULL; + } + + /* + * We shall now treat "block" also as a class. Hence, check here + * if "name" is "block" and proceed accordingly + */ + if (strcmp(name, SYSFS_BLOCK_NAME) == 0) { + safestrcat(classpath, "/"); + safestrcat(classpath, SYSFS_BLOCK_NAME); + } else { + safestrcat(classpath, "/"); + safestrcat(classpath, SYSFS_CLASS_NAME); + safestrcat(classpath, "/"); + safestrcat(classpath, name); + } + if (sysfs_path_is_dir(classpath)) { + dprintf("Class %s not found on the system\n", name); + return NULL; + } + + cls = alloc_class(); + if (cls == NULL) { + dprintf("calloc failed\n"); + return NULL; + } + safestrcpy(cls->name, name); + safestrcpy(cls->path, classpath); + if ((sysfs_remove_trailing_slash(cls->path)) != 0) { + dprintf("Invalid path to class device %s\n", cls->path); + sysfs_close_class(cls); + return NULL; + } + + return cls; +} + +/** + * sysfs_get_class_device: get specific class device using the device's id + * @cls: sysfs_class to find the device on + * @name: name of the class device to look for + * + * Returns sysfs_class_device * on success and NULL on failure + */ +struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *cls, + const char *name) +{ + char path[SYSFS_PATH_MAX]; + struct sysfs_class_device *cdev = NULL; + + if (!cls || !name) { + errno = EINVAL; + return NULL; + } + + if (cls->devices) { + cdev = (struct sysfs_class_device *)dlist_find_custom + (cls->devices, (void *)name, cdev_name_equal); + if (cdev) + return cdev; + } + + safestrcpy(path, cls->path); + safestrcat(path, "/"); + safestrcat(path, name); + if (!sysfs_path_is_dir(path)) { + cdev = sysfs_open_class_device_path(path); + if (!cdev) { + dprintf("Error opening class device at %s\n", path); + return NULL; + } + } + if (!cls->devices) + cls->devices = dlist_new_with_delete + (sizeof(struct sysfs_class_device), + sysfs_close_cls_dev); + + dlist_unshift_sorted(cls->devices, cdev, sort_list); + return cdev; +} + +/** + * sysfs_get_class_devices: get all class devices in the given class + * @cls: sysfs_class whose devices list is needed + * + * Returns a dlist of sysfs_class_device * on success and NULL on failure + */ +struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) +{ + char path[SYSFS_PATH_MAX]; + char *cdev_name; + struct sysfs_class_device *cdev = NULL; + struct dlist *dirlist; + + if (!cls) { + errno = EINVAL; + return NULL; + } + + safestrcpy(path, cls->path); + dirlist = read_dir_subdirs(path); + if (dirlist) { + dlist_for_each_data(dirlist, cdev_name, char) { + if (cls->devices) { + cdev = (struct sysfs_class_device *) + dlist_find_custom(cls->devices, + (void *)cdev_name, cdev_name_equal); + if (cdev) + continue; + } + safestrcpy(path, cls->path); + safestrcat(path, "/"); + safestrcat(path, cdev_name); + cdev = sysfs_open_class_device_path(path); + if (cdev) { + if (!cls->devices) + cls->devices = dlist_new_with_delete + (sizeof(struct sysfs_class_device), + sysfs_close_cls_dev); + dlist_unshift_sorted(cls->devices, cdev, + sort_list); + } + } + sysfs_close_list(dirlist); + } + + return cls->devices; +} + diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 7087730d5f..d1c5b321f0 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -38,7 +38,6 @@ static int get_dev_driver(struct sysfs_device *dev) errno = EINVAL; return -1; } - memset(path, 0, SYSFS_PATH_MAX); memset(devpath, 0, SYSFS_PATH_MAX); safestrcpymax(path, dev->path, SYSFS_PATH_MAX); @@ -53,9 +52,9 @@ static int get_dev_driver(struct sysfs_device *dev) } /* - * Devices on on earlier kernels do not have the "driver" link. + * Devices on earlier kernels do not have the "driver" link. * Look it up in the bus directory. - */ + */ if (dev->bus[0] == '\0') return -1; memset(path, 0, SYSFS_PATH_MAX); @@ -81,7 +80,7 @@ static int get_dev_driver(struct sysfs_device *dev) safestrcat(devpath, drv); safestrcat(devpath, "/"); safestrcat(devpath, dev->bus_id); - if (sysfs_path_is_link(devpath) == 0) { + if (!sysfs_path_is_link(devpath)) { safestrcpy(dev->driver_name, drv); sysfs_close_list(drvlist); return 0; @@ -149,7 +148,7 @@ int sysfs_get_device_bus(struct sysfs_device *dev) safestrcat(path, SYSFS_DEVICES_NAME); safestrcat(path, "/"); safestrcat(path, dev->bus_id); - if ((sysfs_path_is_link(path)) == 0) { + if (!sysfs_path_is_link(path)) { memset(target, 0, SYSFS_PATH_MAX); if (sysfs_get_link(path, target, SYSFS_PATH_MAX)) { diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c index ac3936656c..7d98c669c6 100644 --- a/libsysfs/sysfs_dir.c +++ b/libsysfs/sysfs_dir.c @@ -338,7 +338,7 @@ struct sysfs_attribute *get_attribute(void *dev, const char *name) SYSFS_PATH_MAX); safestrcatmax(path, "/", SYSFS_PATH_MAX); safestrcatmax(path, name, SYSFS_PATH_MAX); - if (!(sysfs_path_is_file(path))) + if (!sysfs_path_is_file(path)) cur = add_attribute((void *)dev, path); return cur; } @@ -373,7 +373,7 @@ struct dlist *read_dir_links(const char *path) safestrcpy(file_path, path); safestrcat(file_path, "/"); safestrcat(file_path, dirent->d_name); - if ((sysfs_path_is_link(file_path)) == 0) { + if (!sysfs_path_is_link(file_path)) { if (!linklist) { linklist = dlist_new_with_delete (SYSFS_NAME_LEN, sysfs_del_name); @@ -421,7 +421,7 @@ struct dlist *read_dir_subdirs(const char *path) safestrcpy(file_path, path); safestrcat(file_path, "/"); safestrcat(file_path, dirent->d_name); - if ((sysfs_path_is_dir(file_path)) == 0) { + if (!sysfs_path_is_dir(file_path)) { if (!dirlist) { dirlist = dlist_new_with_delete (SYSFS_NAME_LEN, sysfs_del_name); @@ -471,7 +471,7 @@ struct dlist *get_attributes_list(void *dev) safestrcpy(file_path, path); safestrcat(file_path, "/"); safestrcat(file_path, dirent->d_name); - if ((sysfs_path_is_file(file_path)) == 0) { + if (!sysfs_path_is_file(file_path)) { if (((struct sysfs_device *)dev)->attrlist) { /* check if attr is already in the list */ attr = (struct sysfs_attribute *) diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index 210c2a086d..c5558a43a1 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -3,7 +3,7 @@ * * System utility functions for libsysfs * - * Copyright (C) IBM Corp. 2003 + * Copyright (C) IBM Corp. 2003-2005 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public -- cgit v1.2.3-54-g00ecf From 11a598f7ef4c263a6546b512806358970dfe5010 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Apr 2005 23:59:43 +0200 Subject: [PATCH] Fedora udev.rules update --- etc/udev/redhat/udev.permissions | 202 ---------------------------- etc/udev/redhat/udev.rules | 283 +++++++++++++++++++++++++++------------ 2 files changed, 196 insertions(+), 289 deletions(-) delete mode 100644 etc/udev/redhat/udev.permissions diff --git a/etc/udev/redhat/udev.permissions b/etc/udev/redhat/udev.permissions deleted file mode 100644 index 19de177c82..0000000000 --- a/etc/udev/redhat/udev.permissions +++ /dev/null @@ -1,202 +0,0 @@ -# /etc/udev/udev.permissions: permission/ownership map for udev - -# console devices -console:root:root:0600 -tty:root:root:0666 -tty[0-9]:root:tty:0660 -tty[0-9][0-9]*:root:tty:0660 -vc/[0-9]*:root:tty:0660 - -# pty devices -# Set this to 0660 if you only want users belonging to tty group -# to be able to allocate PTYs -ptmx:root:tty:0666 -pty[p-za-e][0-9a-f]*:root:tty:0660 -tty[p-za-e][0-9a-f]*:root:tty:0660 -pty/m*:root:tty:0660 -vc/s*:root:tty:0660 - -# serial+dialup devices -ttyS*:root:uucp:0660 -ippp*:root:root:0660 -isdn*:root:root:0660 -isdnctrl*:root:root:0660 -capi*:root:root:0660 -dcbri*:root:root:0660 -ircomm*:root:uucp:0660 -ttyUSB*:root:uucp:0660 -tts/[0-9]*:root:uucp:0660 -tts/USB[0-9]*:root:uucp:0660 - -# vc devices -vcs:vcsa:tty:0600 -vcs[0-9]*:vcsa:tty:0600 -vcsa:vcsa:tty:0600 -vcsa[0-9]*:vcsa:tty:0600 -vcc/*:vcsa:tty:0600 - -# memory devices -random:root:root:0666 -urandom:root:root:0444 -mem:root:kmem:0640 -kmem:root:kmem:0640 -port:root:kmem:0640 -full:root:root:0666 -null:root:root:0666 -zero:root:root:0666 - -# misc devices -nvram:root:root:0660 -rtc:root:root:0644 - -# floppy devices -fd[01]*:root:floppy:0660 - -# audio devices -dsp*:root:root:0660 -audio*:root:root:0660 -midi*:root:root:0660 -mixer*:root:root:0660 -sequencer*:root:root:0660 -sound/*:root:root:0660 -snd/*:root:root:0660 -beep:root:root:0660 -admm*:root:root:0660 -adsp*:root:root:0660 -aload*:root:root:0660 -amidi*:root:root:0660 -dmfm*:root:root:0660 -dmmidi*:root:root:0660 -sndstat:root:root:0660 - -# optical devices -sr*:root:disk:0640 -scd*:root:disk:0640 -pcd*:root:disk:0640 -disk*:root:disk:0640 -dvd:root:disk:0640 -rdvd:root:disk:0640 -cdroms/*:root:disk:0640 - -# pilot/palm devices -pilot:root:uucp:0660 - -# jaz devices -jaz*:root:disk:0640 - -# zip devices -pocketzip*:root:disk:0640 -zip*:root:disk:0640 - -# ls120 devices -ls120:root:disk:0640 -ls120*:root:disk:0640 - -# lp devices -lp*:root:lp:0660 -parport*:root:lp:0660 -irlpt*:root:lp:0660 -usblp*:root:lp:0660 -usb/lp*:root:lp:0660 - -# scanner devices -scanner:root:root:0600 -usb/scanner*:root:root:0600 - -# camera devices -camera*:root:root:0600 -usb/dc2xx*:root:root:0600 -usb/mdc800*:root:root:0600 - -# raw devices -ram*:root:disk:0640 -raw/*:root:disk:0640 - -# disk devices -hd*:root:disk:0640 -sd*:root:disk:0640 -dasd*:root:disk:0640 -ataraid*:root:disk:0640 -loop*:root:disk:0640 -md*:root:disk:0640 -ide/*/*/*/*/*:root:disk:0640 -discs/*/*:root:disk:0640 -loop/*:root:disk:0640 -md/*:root:disk:0640 - -# tape devices -ht*:root:disk:0640 -nht*:root:disk:0640 -pt[0-9]*:root:disk:0640 -npt*:root:disk:0640 -st*:root:disk:0640 -nst*:root:disk:0640 - -# dm devices -dm-*:root:root:0640 - -# memstick devices -memstick*:root:root:0600 - -# flash devices -flash*:root:root:0600 - -# diskonkey devices -diskonkey*:root:disk:0640 - -# rem_ide devices -microdrive*:root:disk:0640 - -# fb devices -fb:root:root:0600 -fb[0-9]*:root:root:0600 -fb/*:root:root:0600 - -# kbd devices -kbd:root:root:0644 - -# joystick devices -js[0-9]*:root:root:0644 -djs[0-9]*:root:root:0644 - -# v4l devices -video*:root:root:0660 -radio*:root:root:0660 -winradio*:root:root:0660 -vtx*:root:root:0660 -vbi*:root:root:0660 -video/*:root:root:0660 -vttuner:root:root:0660 -v4l/*:root:root:0660 - -# input devices -input/*:root:root:0644 - -# gpm devices -gpmctl:root:root:0700 - -# dri devices -nvidia*:root:root:0660 -3dfx*:root:root:0660 -dri/*:root:root:0660 - -# mainboard devices -apm_bios:root:root:0600 - -# scsi devices -sg*:root:disk:0640 -pg*:root:disk:0640 -cdwriter:root:disk:0640 - -# usb devices -usb/dabusb*:root:usb:0660 -usb/mdc800*:root:usb:0660 -usb/rio500:root:usb:0660 - -# s390 devices -z90crypt:root:root:0666 - -# DVB -dvb/*:root:root:0660 -dvb:root:root:0660 -dvb/adapter*:root:root:0660 diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index 9df77b3339..ad60d1a81d 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -1,110 +1,219 @@ # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. # -# See the udev.rules.examples file for more examples of how to create rules +# default is OWNER="root" GROUP="root", MODE="0600" # +# all block devices +SUBSYSTEM=="block", GROUP="disk", MODE="0640" + +# console devices +KERNEL=="tty", MODE="0666" +KERNEL=="tty[0-9]", GROUP="tty", MODE="0660" +KERNEL=="tty[0-9][0-9]*", GROUP="tty", MODE="0660" +KERNEL=="vc/[0-9]*", GROUP="tty", MODE="0660" + +# pty devices +# Set this to 0660 if you only want users belonging to tty group +# to be able to allocate PTYs +KERNEL=="ptmx", GROUP="tty", MODE="0666" +KERNEL=="pty[p-za-e][0-9a-f]*", GROUP="tty", MODE="0660" +KERNEL=="tty[p-za-e][0-9a-f]*", GROUP="tty", MODE="0660" +KERNEL=="pty/m*", GROUP="tty", MODE="0660" +KERNEL=="vc/s*", GROUP="tty", MODE="0660" + +# serial+dialup devices +KERNEL=="ttyS*", GROUP="uucp", MODE="0660" +KERNEL=="ippp*", MODE="0660" +KERNEL=="isdn*", MODE="0660" +KERNEL=="isdnctrl*", MODE="0660" +KERNEL=="capi*", MODE="0660" +KERNEL=="dcbri*", MODE="0660" +KERNEL=="ircomm*", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB*", GROUP="uucp", MODE="0660" +KERNEL=="tts/[0-9]*", GROUP="uucp", MODE="0660" +KERNEL=="tts/USB[0-9]*", GROUP="uucp", MODE="0660" + +# vc devices +KERNEL=="vcs", OWNER="vcsa", GROUP="tty" +KERNEL=="vcs[0-9]*", OWNER="vcsa", GROUP="tty" +KERNEL=="vcsa", OWNER="vcsa", GROUP="tty" +KERNEL=="vcsa[0-9]*", OWNER="vcsa", GROUP="tty" +KERNEL=="vcc/*", OWNER="vcsa", GROUP="tty" + +# memory devices +KERNEL=="random", MODE="0666" +KERNEL=="urandom", MODE="0444" +KERNEL=="mem", GROUP="kmem", MODE="0640" +KERNEL=="kmem", GROUP="kmem", MODE="0640" +KERNEL=="port", GROUP="kmem", MODE="0640" +KERNEL=="full", MODE="0666" +KERNEL=="null", MODE="0666" +KERNEL=="zero", MODE="0666" + +# misc devices +KERNEL=="nvram", MODE="0660" +KERNEL=="rtc", MODE="0644" + +# floppy devices +KERNEL=="fd[01]*", GROUP="floppy", MODE="0660" + +# audio devices +KERNEL=="dsp*", MODE="0660" +KERNEL=="audio*", MODE="0660" +KERNEL=="midi*", MODE="0660" +KERNEL=="mixer*", MODE="0660" +KERNEL=="sequencer*", MODE="0660" +KERNEL=="sound/*", MODE="0660" +KERNEL=="snd/*", MODE="0660" +KERNEL=="beep", MODE="0660" +KERNEL=="admm*", MODE="0660" +KERNEL=="adsp*", MODE="0660" +KERNEL=="aload*", MODE="0660" +KERNEL=="amidi*", MODE="0660" +KERNEL=="dmfm*", MODE="0660" +KERNEL=="dmmidi*", MODE="0660" +KERNEL=="sndstat", MODE="0660" + +# pilot/palm devices +KERNEL=="pilot", GROUP="uucp", MODE="0660" + +# lp devices +KERNEL=="lp*", GROUP="lp", MODE="0660" +KERNEL=="parport*", GROUP="lp", MODE="0660" +KERNEL=="irlpt*", GROUP="lp", MODE="0660" +KERNEL=="usblp*", GROUP="lp", MODE="0660" +KERNEL=="usb/lp*", GROUP="lp", MODE="0660" + +# tape devices +KERNEL=="ht*", GROUP="disk", MODE="0640" +KERNEL=="nht*", GROUP="disk", MODE="0640" +KERNEL=="pt[0-9]*", GROUP="disk", MODE="0640" +KERNEL=="npt*", GROUP="disk", MODE="0640" +KERNEL=="st*", GROUP="disk", MODE="0640" +KERNEL=="nst*", GROUP="disk", MODE="0640" +KERNEL=="osst*", GROUP="disk", MODE="0640" +KERNEL=="nosst*", GROUP="disk", MODE="0640" + +# diskonkey devices +KERNEL=="diskonkey*", GROUP="disk", MODE="0640" + +# rem_ide devices +KERNEL=="microdrive*", GROUP="disk", MODE="0640" + +# kbd devices +KERNEL=="kbd", MODE="0644" + +# joystick devices +KERNEL=="js[0-9]*", MODE="0644" +KERNEL=="djs[0-9]*", MODE="0644" + +# v4l devices +KERNEL=="video*", MODE="0660" +KERNEL=="radio*", MODE="0660" +KERNEL=="winradio*", MODE="0660" +KERNEL=="vtx*", MODE="0660" +KERNEL=="vbi*", MODE="0660" +KERNEL=="video/*", MODE="0660" +KERNEL=="vttuner", MODE="0660" +KERNEL=="v4l/*", MODE="0660" + +# input devices +KERNEL=="input/*", MODE="0644" + +# gpm devices +KERNEL=="gpmctl", MODE="0700" + +# dri devices +KERNEL=="nvidia*", MODE="0660" +KERNEL=="3dfx*", MODE="0660" +KERNEL=="dri/*", MODE="0666" + +# usb devices +KERNEL=="usb/dabusb*", GROUP="usb", MODE="0660" +KERNEL=="usb/mdc800*", GROUP="usb", MODE="0660" +KERNEL=="usb/rio500", GROUP="usb", MODE="0660" + +# s390 devices +KERNEL=="z90crypt", MODE="0666" + +# DVB +KERNEL=="dvb/*", MODE="0660" +KERNEL=="dvb", MODE="0660" +KERNEL=="dvb/adapter*", MODE="0660" + # create a symlink named after the device map name # note devmap_name comes with extras/multipath -#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" - -KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" -KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="tty[0-9]*", NAME="%k", GROUP="tty" - -KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="pty[p-za-e][0-9a-f]*", NAME="%k", GROUP="tty" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="%k", GROUP="tty" - -KERNEL="ttyS[0-9]*", NAME="%k", GROUP="uucp" -KERNEL="ttyUSB[0-9]*", NAME="%k", GROUP="uucp" -KERNEL="ippp0", NAME="%k" -KERNEL="isdn*", NAME="%k" -KERNEL="dcbri*", NAME="%k" -KERNEL="ircomm*", NAME="%k", GROUP="uucp" - -KERNEL="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", MODE="0600" -KERNEL="vcsa[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", MODE="0600 - -# memory devices¶ -KERNEL="random", NAME="%k", MODE="0666" -KERNEL="urandom", NAME="%k", MODE="0444" -KERNEL="mem", NAME="%k", MODE="0640" -KERNEL="kmem", NAME="%k", MODE="0640" -KERNEL="port", NAME="%k", MODE="0640" -KERNEL="full", NAME="%k", MODE="0666" -KERNEL="null", NAME="%k", MODE="0666" -KERNEL="zero", NAME="%k", MODE="0666" +#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" # DRI devices always go into a subdirectory (as per the LSB spec) -KERNEL="card*", NAME="dri/card%n" +KERNEL=="card*", NAME="dri/card%n" # alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hw[CD0-9]*", NAME="snd/%k" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL=="midi[CD0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" # input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse*", NAME="input/%k" -KERNEL="event*", NAME="input/%k" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" - -KERNEL="raw[0-9]*", NAME="raw/%k" - -KERNEL="lp[0-9]*", SYMLINK="par%n" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" - -KERNEL="microcode", SYMLINK="cpu/0/%k" -KERNEL="ram1", SYMLINK="ram" -KERNEL="video0", SYMLINK="video" -KERNEL="radio0", SYMLINK="radio" -KERNEL="audio0", SYMLINK="audio" -KERNEL="dsp0", SYMLINK="dsp" -KERNEL="fb0", SYMLINK="fb" -KERNEL="qft0", SYMLINK="ftape" -KERNEL="isdnctrl0", SYMLINK="isdnctrl" -KERNEL="mixer0", SYMLINK="mixer" -KERNEL="ram0", SYMLINK="ramdisk" -KERNEL="sbpcd0", SYMLINK="sbpcd" -KERNEL="radio0", SYMLINK="radio" -KERNEL="tty0", SYMLINK="systty" -KERNEL="vbi0", SYMLINK="vbi" -KERNEL="null", SYMLINK="XOR" - -KERNEL="tun", NAME="net/%k" - -KERNEL="device-mapper", NAME="mapper/control" +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse*", NAME="input/%k" +KERNEL=="event*", NAME="input/%k" +KERNEL=="js*", NAME="input/%k" +KERNEL=="ts*", NAME="input/%k" + +KERNEL=="raw[0-9]*", NAME="raw/%k" + +KERNEL=="lp[0-9]*", SYMLINK="par%n" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" + +KERNEL=="microcode", NAME="cpu/%k" +KERNEL=="ram1", SYMLINK="ram" +KERNEL=="video0", SYMLINK="video" +KERNEL=="radio0", SYMLINK="radio" +KERNEL=="audio0", SYMLINK="audio" +KERNEL=="dsp0", SYMLINK="dsp" +KERNEL=="fb0", SYMLINK="fb" +KERNEL=="qft0", SYMLINK="ftape" +KERNEL=="isdnctrl0", SYMLINK="isdnctrl" +KERNEL=="mixer0", SYMLINK="mixer" +KERNEL=="ram0", SYMLINK="ramdisk" +KERNEL=="sbpcd0", SYMLINK="sbpcd" +KERNEL=="radio0", SYMLINK="radio" +KERNEL=="tty0", SYMLINK="systty" +KERNEL=="vbi0", SYMLINK="vbi" +KERNEL=="null", SYMLINK="XOR" + +KERNEL=="tun", NAME="net/%k" + +KERNEL=="device-mapper", NAME="mapper/control" # old compat symlinks with enumeration -KERNEL="sr[0-9]*", SYMLINK="cdrom%e" -KERNEL="scd[0-9]*", SYMLINK="cdrom%e" -KERNEL="pcd[0-9]*", SYMLINK="cdrom%e" -KERNEL="fd[0-9]*", SYMLINK="floppy%e" -KERNEL="nst[0-9]*", SYMLINK="tape%e" - -# default permissions for all block devices -SUBSYSTEM="block", GROUP="disk", MODE="0640" +KERNEL=="sr[0-9]*", SYMLINK="cdrom%e" +KERNEL=="scd[0-9]*", SYMLINK="cdrom%e" +KERNEL=="pcd[0-9]*", SYMLINK="cdrom%e" +KERNEL=="fd[0-9]*", SYMLINK="floppy%e" +KERNEL=="nst[0-9]", SYMLINK="tape%e" +KERNEL=="nosst[0-9]*", SYMLINK="tape%e" -KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/ide-media.sh %k", RESULT="floppy", SYMLINK="floppy%e, NAME{ignore_remove, all_partitions}="%k", GROUP="floppy" +# do not seperate the next 2 lines!! +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/ide-media.sh %k", RESULT=="floppy", SYMLINK="floppy%e", NAME{ignore_remove, all_partitions}="%k" -KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", RESULT="cdrom", SYMLINK="cdrom%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", RESULT=="cdrom", SYMLINK="cdrom%e" -KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK="dvd%e" -KERNEL="sr[0-9]*", BUS="scsi", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK="dvd%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK="dvd%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK="dvd%e" -KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK="cdwriter%e" -KERNEL="sr[0-9]*", BUS="scsi", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK="cdwriter%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK="cdwriter%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK="cdwriter%e" -KERNEL="hd[a-z]", BUS="ide", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" -KERNEL="sr[0-9]*", BUS="scsi", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" # rename sr* to scd* -KERNEL="sr[0-9]*", BUS="scsi", NAME="scd%n" -KERNEL="hd[a-z]*", BUS="ide", SYSFS{removable}="1", NAME{ignore_remove}="%k" +KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n" +KERNEL=="hd[a-z]*", BUS=="ide", SYSFS{removable}=="1", NAME{ignore_remove}="%k" -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" +KERNEL=="dvb*", PROGRAM=="/etc/udev/scripts/dvb.sh %k", NAME="%c" -- cgit v1.2.3-54-g00ecf From 024780c2ed8efacb65cc8597b6cf79d54abbd735 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Tue, 19 Apr 2005 00:07:01 +0200 Subject: [PATCH] selinux: fix handling during creation of symlinks Patch from: Dan Walsh --- udev_add.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_add.c b/udev_add.c index b1e7265a3c..9764cb9bcd 100644 --- a/udev_add.c +++ b/udev_add.c @@ -221,7 +221,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de dbg("symlink(%s, %s)", linktarget, filename); if (!udev->test_run) { unlink(filename); - selinux_setfscreatecon(filename, udev->kernel_name, S_IFLNK); + selinux_setfscreatecon(filename, NULL, S_IFLNK); retval = symlink(linktarget, filename); selinux_resetfscreatecon(); if (retval != 0) -- cgit v1.2.3-54-g00ecf From 27a71e49c208a10eed83d5b37dc89d20429ea714 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 5 May 2005 21:47:57 -0700 Subject: Added symlinks thanks to Kay's script and git hacking. Now the tests should work again... --- test/sys/block/cciss!c0d0/device | 1 + test/sys/block/rd!c0d0/device | 1 + test/sys/block/sda/device | 1 + test/sys/bus/pci/devices/0000:00:09.0 | 1 + test/sys/bus/pci/devices/0000:00:1e.0 | 1 + test/sys/bus/pci/devices/0000:02:05.0 | 1 + test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 | 1 + test/sys/bus/scsi/devices/0:0:0:0 | 1 + test/sys/bus/scsi/drivers/sd/0:0:0:0 | 1 + test/sys/bus/usb-serial/devices/ttyUSB0 | 1 + test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 | 1 + test/sys/bus/usb/devices/3-0:1.0 | 1 + test/sys/bus/usb/devices/3-1 | 1 + test/sys/bus/usb/devices/3-1:1.0 | 1 + test/sys/bus/usb/devices/usb3 | 1 + test/sys/bus/usb/drivers/hub/3-0:1.0 | 1 + test/sys/bus/usb/drivers/pl2303/3-1:1.0 | 1 + test/sys/bus/usb/drivers/usb/3-1 | 1 + test/sys/bus/usb/drivers/usb/usb3 | 1 + test/sys/class/tty/ttyUSB0/device | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver | 1 + 21 files changed, 21 insertions(+) create mode 120000 test/sys/block/cciss!c0d0/device create mode 120000 test/sys/block/rd!c0d0/device create mode 120000 test/sys/block/sda/device create mode 120000 test/sys/bus/pci/devices/0000:00:09.0 create mode 120000 test/sys/bus/pci/devices/0000:00:1e.0 create mode 120000 test/sys/bus/pci/devices/0000:02:05.0 create mode 120000 test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 create mode 120000 test/sys/bus/scsi/devices/0:0:0:0 create mode 120000 test/sys/bus/scsi/drivers/sd/0:0:0:0 create mode 120000 test/sys/bus/usb-serial/devices/ttyUSB0 create mode 120000 test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 create mode 120000 test/sys/bus/usb/devices/3-0:1.0 create mode 120000 test/sys/bus/usb/devices/3-1 create mode 120000 test/sys/bus/usb/devices/3-1:1.0 create mode 120000 test/sys/bus/usb/devices/usb3 create mode 120000 test/sys/bus/usb/drivers/hub/3-0:1.0 create mode 120000 test/sys/bus/usb/drivers/pl2303/3-1:1.0 create mode 120000 test/sys/bus/usb/drivers/usb/3-1 create mode 120000 test/sys/bus/usb/drivers/usb/usb3 create mode 120000 test/sys/class/tty/ttyUSB0/device create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver diff --git a/test/sys/block/cciss!c0d0/device b/test/sys/block/cciss!c0d0/device new file mode 120000 index 0000000000..2d78258b1a --- /dev/null +++ b/test/sys/block/cciss!c0d0/device @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/rd!c0d0/device b/test/sys/block/rd!c0d0/device new file mode 120000 index 0000000000..2d78258b1a --- /dev/null +++ b/test/sys/block/rd!c0d0/device @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/sda/device b/test/sys/block/sda/device new file mode 120000 index 0000000000..2d78258b1a --- /dev/null +++ b/test/sys/block/sda/device @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:09.0 b/test/sys/bus/pci/devices/0000:00:09.0 new file mode 120000 index 0000000000..1c776568bd --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:09.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1e.0 b/test/sys/bus/pci/devices/0000:00:1e.0 new file mode 120000 index 0000000000..e000c77614 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1e.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:02:05.0 b/test/sys/bus/pci/devices/0000:02:05.0 new file mode 120000 index 0000000000..630d35bf61 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:02:05.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 b/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 new file mode 120000 index 0000000000..bd644e0e9d --- /dev/null +++ b/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/0:0:0:0 b/test/sys/bus/scsi/devices/0:0:0:0 new file mode 120000 index 0000000000..ebb65b3bac --- /dev/null +++ b/test/sys/bus/scsi/devices/0:0:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/0:0:0:0 b/test/sys/bus/scsi/drivers/sd/0:0:0:0 new file mode 120000 index 0000000000..239003f712 --- /dev/null +++ b/test/sys/bus/scsi/drivers/sd/0:0:0:0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/devices/ttyUSB0 b/test/sys/bus/usb-serial/devices/ttyUSB0 new file mode 120000 index 0000000000..b7733a68e0 --- /dev/null +++ b/test/sys/bus/usb-serial/devices/ttyUSB0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 b/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 new file mode 120000 index 0000000000..177f109e48 --- /dev/null +++ b/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-0:1.0 b/test/sys/bus/usb/devices/3-0:1.0 new file mode 120000 index 0000000000..9137978832 --- /dev/null +++ b/test/sys/bus/usb/devices/3-0:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1 b/test/sys/bus/usb/devices/3-1 new file mode 120000 index 0000000000..e47b4d58c4 --- /dev/null +++ b/test/sys/bus/usb/devices/3-1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1:1.0 b/test/sys/bus/usb/devices/3-1:1.0 new file mode 120000 index 0000000000..f519185eb3 --- /dev/null +++ b/test/sys/bus/usb/devices/3-1:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb3 b/test/sys/bus/usb/devices/usb3 new file mode 120000 index 0000000000..fb1919e7c9 --- /dev/null +++ b/test/sys/bus/usb/devices/usb3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/3-0:1.0 b/test/sys/bus/usb/drivers/hub/3-0:1.0 new file mode 120000 index 0000000000..2bc160c20c --- /dev/null +++ b/test/sys/bus/usb/drivers/hub/3-0:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/pl2303/3-1:1.0 b/test/sys/bus/usb/drivers/pl2303/3-1:1.0 new file mode 120000 index 0000000000..49d32d5abd --- /dev/null +++ b/test/sys/bus/usb/drivers/pl2303/3-1:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/3-1 b/test/sys/bus/usb/drivers/usb/3-1 new file mode 120000 index 0000000000..03c76193e9 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/3-1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb3 b/test/sys/bus/usb/drivers/usb/usb3 new file mode 120000 index 0000000000..61dc52a613 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/usb3 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/class/tty/ttyUSB0/device b/test/sys/class/tty/ttyUSB0/device new file mode 120000 index 0000000000..b7733a68e0 --- /dev/null +++ b/test/sys/class/tty/ttyUSB0/device @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver new file mode 120000 index 0000000000..9ff2c81f52 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver @@ -0,0 +1 @@ +../../../../../../bus/usb-serial/drivers/PL-2303 \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 0ca6adfed9603e63bd42f9af9d1a73bd661a36da Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Mon, 9 May 2005 23:44:27 +0100 Subject: [PATCH] Writing udev rules docs update Here's a long overdue update to the udev rules docs, based on lots of user feedback from the last few months. Mostly updates to keep up with the new udev features, some clarifications and wording improvements. I added a section on rules for palm pilots due to the excessive amount of mail I get about them. I removed the nvidia stuff because it's out of date. Added another section about debugging using logs and udevtest. Removed the thanks list because I haven't been updating it and there are too many people to name now, sorry..! --- docs/writing_udev_rules/index.html | 153 ++++++++++++--------- test/sys/block/cciss!c0d0/device | 0 test/sys/block/rd!c0d0/device | 0 test/sys/block/sda/device | 0 test/sys/bus/pci/devices/0000:00:09.0 | 0 test/sys/bus/pci/devices/0000:00:1e.0 | 0 test/sys/bus/pci/devices/0000:02:05.0 | 0 test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 | 0 test/sys/bus/scsi/devices/0:0:0:0 | 0 test/sys/bus/scsi/drivers/sd/0:0:0:0 | 0 test/sys/bus/usb-serial/devices/ttyUSB0 | 0 test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 | 0 test/sys/bus/usb/devices/3-0:1.0 | 0 test/sys/bus/usb/devices/3-1 | 0 test/sys/bus/usb/devices/3-1:1.0 | 0 test/sys/bus/usb/devices/usb3 | 0 test/sys/bus/usb/drivers/hub/3-0:1.0 | 0 test/sys/bus/usb/drivers/pl2303/3-1:1.0 | 0 test/sys/bus/usb/drivers/usb/3-1 | 0 test/sys/bus/usb/drivers/usb/usb3 | 0 test/sys/class/tty/ttyUSB0/device | 0 .../0000:00:09.0/usb3/3-1/ttyUSB0/driver | 0 22 files changed, 89 insertions(+), 64 deletions(-) mode change 120000 => 100644 test/sys/block/cciss!c0d0/device mode change 120000 => 100644 test/sys/block/rd!c0d0/device mode change 120000 => 100644 test/sys/block/sda/device mode change 120000 => 100644 test/sys/bus/pci/devices/0000:00:09.0 mode change 120000 => 100644 test/sys/bus/pci/devices/0000:00:1e.0 mode change 120000 => 100644 test/sys/bus/pci/devices/0000:02:05.0 mode change 120000 => 100644 test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 mode change 120000 => 100644 test/sys/bus/scsi/devices/0:0:0:0 mode change 120000 => 100644 test/sys/bus/scsi/drivers/sd/0:0:0:0 mode change 120000 => 100644 test/sys/bus/usb-serial/devices/ttyUSB0 mode change 120000 => 100644 test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 mode change 120000 => 100644 test/sys/bus/usb/devices/3-0:1.0 mode change 120000 => 100644 test/sys/bus/usb/devices/3-1 mode change 120000 => 100644 test/sys/bus/usb/devices/3-1:1.0 mode change 120000 => 100644 test/sys/bus/usb/devices/usb3 mode change 120000 => 100644 test/sys/bus/usb/drivers/hub/3-0:1.0 mode change 120000 => 100644 test/sys/bus/usb/drivers/pl2303/3-1:1.0 mode change 120000 => 100644 test/sys/bus/usb/drivers/usb/3-1 mode change 120000 => 100644 test/sys/bus/usb/drivers/usb/usb3 mode change 120000 => 100644 test/sys/class/tty/ttyUSB0/device mode change 120000 => 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index 9396184366..1ba43678c0 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -8,7 +8,7 @@

    Writing udev rules

    by Daniel Drake (dsd)
    -Version 0.55

    +Version 0.6

    The most recent version of this document can always be found at:
    http://www.reactivated.net/udevrules.php @@ -27,6 +27,8 @@ The most recent version of this document can always be found at:
  • Key-writing basics
  • Identifying devices through basic keys
  • Identifying devices through SYSFS files
  • +
  • Using multiple SYMLINK style rules
  • +
  • Controlling ownership and permissions
  • Example: Writing a rule for my USB printer
  • Example: Writing a rule for my USB-Storage digital camera
  • @@ -34,8 +36,7 @@ The most recent version of this document can always be found at:
  • Example: Writing convenience rules for my CD drives
  • Example: Writing a rule to name my network interface
  • Tips for finding the appropriate places in SYSFS
  • -
  • Using multiple SYMLINK style rules
  • -
  • udev vs Nvidia's graphics drivers
  • +
  • Debugging your rules
  • Author and credits
  • @@ -53,6 +54,7 @@ This document assumes that you have udev/hotplug installed and running OK with d

    History

    +May 9th 2005 v0.6: Misc updates, including information about udevinfo, groups and permissions, logging, and udevtest.

    June 20th 2004 v0.55: Added info on multiple symlinks, and some minor changes/updates.

    April 26th 2004 v0.54: Added some Debian info. Minor corrections. Re-reverted information about what to call your rule file. Added info about naming network interfaces.

    April 15th 2004 v0.53: Minor corrections. Added info about NAME{all_partitions}. Added info about other udevinfo tricks.

    @@ -66,9 +68,8 @@ February 15th 2004 v0.1: Initial publication.

    Software versions used at time of writing

    -Linux Kernel 2.6.7
    -udev 027
    -hotplug 20040401

    +Linux Kernel 2.6.11
    +udev 056

    Terminology: devfs, sysfs, nodes, etc.

    @@ -97,6 +98,8 @@ However, if my HP laser printer got named lp_hp (as well as lpX) and my other pr For external mass-storage devices (e.g. usb hard disks), persistent naming is very helpful in that it allows you to hardcode accurate device paths into your /etc/fstab.

    +It is important to understand that writing rules is simply a means of customizing udev behaviour. Writing rules is not a workaround for the problem where no device nodes for your particular device exist. If no matching rules exist, udev will create the node anyway, using the name that was supplied by the kernel.

    +

    The basics of writing rules

    @@ -104,31 +107,32 @@ When populating /dev, udev decides which nodes to include, and how to nam Default udev rules are stored in /etc/udev/rules.d/50-udev.rules. You may find it interesting to look over this file - it includes a few examples, and then some default rules proving a devfs-style /dev layout. However, you should not write rules into this file directly, to reduce hassle while updating your udev installation in the future.

    -Files in /etc/udev/rules.d/ are parsed in lexical order. udev will stop processing rules as soon as it finds a matching rule in a file for the new item of hardware that has been detected. It is important that your own rules get processed before the udev defaults, otherwise your own naming schemes will not take effect! I suggest that you keep your own rules in a file at /etc/udev/rules.d/10-local.rules (this doesn't exist by default - create it). As 10 comes before 50, you know that your rules will be looked at first.

    +Files in /etc/udev/rules.d/ are parsed in lexical order. udev will stop processing rules as soon as it finds a matching rule in a file for the new item of hardware that has been detected. It is important that your own rules get processed before the udev defaults, otherwise your own naming schemes will not take effect! I suggest that you keep your own rules in a file at /etc/udev/rules.d/10-local.rules (this doesn't exist by default - create it). As 10 comes before 50, you know that your rules will be looked at first. It is important that the filenames of your rule files end with the .rules suffix, otherwise they will not be used.

    As your own rules will effectively mask out the udev defaults which create the base /dev layout, it is recommended that you also specify devfs-style names/symlinks for the rules you write, so that you get the sensible defaults plus your own names.

    In rule files, lines starting with a "#" are treated as comments. Every uncommented line in the file corresponds to a rule.

    -The basic form for a rule is: -
    key,[key,...] name [, symlink]
    +Rules are composed of keys. Keys are seperated by commas. Some keys are used for reading and matching information, others are used for assigning information and performing actions.
      -
    1. At least one key must be specified. Keys are used to identify which devices the rule matches.
    2. -
    3. The name parameter is required. It tells udev what that device should be named as in the /dev tree. It is written in the format NAME="X", where X is what the node will be named. You can specify multiple symlinks here, seperate them with a space.
    4. -
    5. The symlink parameter (optional) allows for you to specify additional places where this node will be linked.
    6. +
    7. At least one identification key should be provided, which will match the rule to any number of devices in the system. These are listed in the later section: Identifying devices through basic keys.
    8. +
    9. At least one assignment key should be provided, to control how the resultant device node is created. These include NAME, SYMLINK, OWNER, GROUP and MODE, all of which are described in this document.
    -Remember that udev will only create one node for one device. If you want it to be accessible through multiple nodes, then you have to specify the other nodes in the SYMLINK parameter.

    +Common rules will use basic identification keys to determine the device to name, and then have a NAME assignement key to define the device node name. udev will only create one node for one device, so if you want it to be accessible through multiple nodes, then you have to specify the other nodes in the SYMLINK assignment key.

    I'll take a slightly modified udev example rule to illustrate this:
    BUS="usb", SYSFS{serial}="HXOLL0012202323480", NAME="lp_epson", SYMLINK="printers/epson_stylus"
    -The keys here are the BUS and SYSFS{serial} parameters. udev will match this rule against a device that is connected through the USB bus and with a serial number of HXOLL0012202323480. Note that all (as opposed to any) specified keys must be matched for udev to use the rule to name a device.
    +The identification keys here are BUS and SYSFS{serial}. The assignment keys here are NAME and SYMLINK. udev will match this rule against a device that is connected through the USB bus and with a serial number of HXOLL0012202323480. Note that all (as opposed to any) specified keys must be matched for udev to use the rule to name a device.
    udev will name this node lp_epson, and it will be located at /dev/lp_epson.
    udev will also create a symlink to /dev/lp_epson, located at /dev/printers/epson_stylus (the printers directory will be automatically created). You can now print to your Epson printer by sending data to /dev/printers/epson_stylus or /dev/lp_epson.

    +Any rules that you have added or modified will not take effect until you notify udev of this. Make sure you remember to run the following every time you modify any rule files: +
    # udevstart
    +

    Additional automated customisation for NAME and SYMLINK parameters

    @@ -187,6 +191,8 @@ You may be wondering, "How do I find the serial number of my printer? What is th The valid keys are:
    • BUS - match the bus type of the device.
    • KERNEL - match the kernel device name.
    • +
    • DRIVER - match the name of the kernel driver.
    • +
    • SUBSYSTEM - match the kernel subsystem name.
    • ID - match the device number on the bus (e.g. PCI bus ID).
    • PLACE - match the physical position where the device is plugged into (useful for USB).
    • @@ -194,7 +200,7 @@ The valid keys are: The ID and PLACE keys do have their uses, but they are not commonly used in rules. This document focuses on using BUS and KERNEL keys, as well as SYSFS{...} keys (detailed in the next section). I will show how to use these keys by example.

      -For extra flexibility, udev also provides keys to call external scripts and examine their result. This is out of scope of this document. Look at the udev man page for more details. +For extra flexibility, udev also provides keys to call external scripts and examine their result, and to examine environment variables. This is out of scope of this document. Look at the udev man page for more details.

      Identifying devices through SYSFS files

      @@ -220,9 +226,11 @@ You may find that finding the correct place in /sys to run udevinfo on is /block/sda
    -The output of the command (shown above) is telling me that the sysfs path to start at is /sys/block/sda. I would now run "udevinfo -a -p /sys/block/sda". These two commands can be stringed together, like so: +The output of the command (shown above) is telling me that the sysfs path to start at is /sys/block/sda. I would now run "udevinfo -a -p /sys/block/sda". These two commands can be chained together, like so: -
    # udevinfo -a -p `udevinfo -q path -n /dev/sda`
    +
    # udevinfo -a -p $(udevinfo -q path -n /dev/sda)
    + +Sidenote: You may notice that we previously provided full paths (/sys/some/path) to udevinfo beforehand, but now we are providing sysfs-relative paths (/some/path) by chaining these commands. This does not matter - both types of path are accepted.

    Moving on to rule-writing, some snipped output of the results of my "udevinfo -a -p /sys/block/sda" command is shown below, with colour added.
    @@ -280,6 +288,43 @@ The behaviour of your own rules masking the defaults can be overcome if you writ
    + +

    Using multiple SYMLINK style rules

    +Another recent feature is the ability to write rules that do not specify a NAME, but instead they simply specify SYMLINK keys. This allows you to avoid the issue where your own rules effectively mask the udev defaults.

    + +Take the rule:
    +
    KERNEL="hdc", SYMLINK="dvd"
    + +When udev finds this rule, it will take a mental note of it. Upon finding another rule matching the same device which also includes a NAME parameter, udev will create the node as specified by the NAME parameter, plus symbolic links as specified by the SYMLINK parameters of both rules.
    +To put it into practical terms, when udev is naming nodes for my hdc device, it will use the default rules for block devices as usual, with the addition of my personal symlink "dvd".

    + +Similarly to normal rules, rules of this type will only take effect if udev is able to find them before it finds a rule specifying a NAME parameter.

    + + +

    Controlling ownership and permissions

    + +As well as controlling the naming of the device nodes which are created, udev rules also allow you to control ownership and permission attributes on that device node.

    + +The GROUP key allows you to define which unix group should own the device node. Here's an example from the udev defaults, which defines that the video group will own framebuffer (fb) devices: + +
    KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video"
    + +The OWNER key, perhaps less useful, allows you to define which unix user should own the device node. Assuming the slightly odd situation where you would want "john" to own your floppy devices, you could use: + +
    KERNEL="fd[0-9]*", OWNER="john"
    + +You'll notice in the above rule that we didn't specify any NAME or SYMLINK keys. This is similar to the multiple symlink style where udev will take a mental note that we want john to own floppy nodes, and will apply that ownership once it finds a rule which defines a NAME for the floppy device nodes.

    + +Building on the style mentioned above, you can do even more flashy things. The udev defaults use the following rule to define that all the sound device nodes shall be owned by the "audio" group: + +
    SUBSYSTEM="sound", GROUP="audio"
    + +This prevents the need to excessively provide a GROUP="audio" key on every following rule which names sound devices.

    + +udev defaults to creating nodes with unix permissions of 0660 (read/write to owner and group), which is configured by the default_mode setting inside /etc/udev/udev.conf. There may be some situations where you do not want to use the default permissions on your device node. Fortunately, you can easily override the permissions in your rules using the MODE assignment key. As an example, the following rule defines that the inotify node shall be readable and writable to everyone: + +
    KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666"
    +

    Example: Writing a rule for my USB printer

    @@ -368,9 +413,18 @@ BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n" You may have noticed that the default 50-udev.rules file contains a rule which runs a script to produces names for block devices. Do not be confused by this - as usual, because your own rules are located in a file which is processed before the default rules, the defaults will not be used when naming the hardware you have written rules for.

    + +

    Example: Writing a rule for your USB Visor Palm Pilot

    + +These devices work as USB-serial devices, so by default, you only get the ttyUSB1 node. The user-space palm utilities rely on /dev/pilot, so you need to use a rule to create this. The following rule will do the job:

    + +
    BUS="usb", SYSFS{product}="Palm Handheld", KERNEL="ttyUSB*", SYMLINK="pilot"
    + +This was adapted from Carsten Clasohm's blog entry, which includes a useful discussion of the situation. You may also wish to add ownership and permission keys to the rule to suit your setup.

    +

    Example: Writing a rule to name my network interface

    -An interesting new feature in recent udev versions is the ability to write rules to name your network interfaces. Network interfaces do not show up in /dev, but they are generally referenced by names (e.g. with ifconfig). Despite the differences, the rule writing process is almost identical.

    +An interesting new feature in recent udev versions is the ability to rename your network interfaces, like the nameif utility does. Network interfaces do not show up in /dev, but they are generally referenced by names (e.g. with ifconfig). Despite the differences, the rule writing process is almost identical.

    As usual, udevinfo comes to our aid in rule-writing. In my example, I wish to rename my "eth0" network device (the following output is snipped): @@ -380,7 +434,9 @@ As usual, udevinfo comes to our aid in rule-writing. In my example, I wish to re SYSFS{address}="00:52:8b:d5:04:48" -Every network adapter has its own unique MAC-address, so I chose to use this when writing my rule. This will not change, unless you change your network card. An example rule is shown below: +Every network adapter has its own unique MAC-address, so I chose to use this when writing my rule. This will not change, unless you change your network card. There is one caveat here: make sure you use the MAC address you obtain from udevinfo (as above), because it is case sensitive. Be careful when using utilities such as ifconfig as they will capitalize the letters.

    + +An example rule is shown below:
    KERNEL="eth*", SYSFS{address}="00:52:8b:d5:04:48", NAME="lan"
    @@ -403,62 +459,31 @@ After that, you should be able to use "lan" instead of "eth0" in any calls to Remember that unfortunately, the kernel does not export information for all devices into sysfs, meaning that you simply can't write rules for some devices yet. On 20/02/04, the udev author stated that there are 162 drivers left to convert to sysfs. - -

    Using multiple SYMLINK style rules

    -Another recent feature is the ability to write rules that do not specify a NAME, but instead they simply specify SYMLINK keys. This allows you to avoid the issue where your own rules effectively mask the udev defaults.

    - -Take the rule:
    -
    KERNEL="hdc", SYMLINK="dvd"
    - -When udev finds this rule, it will take a mental note of it. Upon finding another rule matching the same device which also includes a NAME parameter, udev will create the node as specified by the NAME parameter, plus symbolic links as specified by the SYMLINK parameters of both rules.
    -To put it into practical terms, when udev is naming nodes for my hdc device, it will use the default rules for block devices as usual, with the addition of my personal symlink "dvd".

    + +

    Debugging your rules

    -Similarly to normal rules, rules of this type will only take effect if udev is able to find them before it finds a rule specifying a NAME parameter.

    - - -

    udev vs Nvidia's graphics drivers

    +If you have written rules and remembered to run udevstart but they do not appear to be taking effect, there are a couple of ways you can debug them.

    -This section isn't really relevant to the purpose of this document, but judging from the hits I get from google, this is a hot topic. I will leave it here for now.

    +The file /etc/udev/udev.conf contains a udev_log option. Setting this option to yes will cause udev to log some useful information about which rules are being applied to which nodes into the system logger. The logs will be included in /var/log/messages for most users.

    -Nvidia's graphics drivers (the closed-source ones, not the ones that come with XFree) do not work with a default installation of udev - you are unable to start X. This is because the nvidia module is loaded by X, but the /dev/nvidia* nodes are not created quick enough, so X bails out.

    +Additionally, if you know the path in sysfs for the node you want to create, you can use udevtest to see a rundown on what udev would do with the node. For example: -The solution to this problem is to autoload the nvidia module on bootup. Yes - you are *supposed* to do this - the NVidia FAQ confirms this! On devfs-based systems, devfs did this automatically at bootup anyway. Your linux distribution will have created a file which you can list modules to be loaded on bootup (e.g. /etc/modules.autoload.d/kernel-2.6 for Gentoo, /etc/modules for Debian).

    +
    # udevtest /sys/class/sound/dsp/
    +version 056
    +looking at '/class/sound/dsp/'
    +opened class_dev->name='dsp'
    +configured rule in '/etc/udev/rules.d/50-udev.rules[132]' applied, added symlink '%k'
    +configured rule in '/etc/udev/rules.d/50-udev.rules[132]' applied, 'dsp' becomes 'sound/%k'
    +creating device node '/dev/sound/dsp', major = '14', minor = '3', mode = '0660', uid = '0', gid = '18'
    -This isn't all - you will also need to patch the nvidia kernel interface to export some basic info to SYSFS so that udev will create the devices. Martin Schlemmer has written a patch against the 1.0.5336 version of the nvidia drivers, which can be found here. The Gentoo package nvidia-kernel-1.0.5336-r4 contains this patch.

    - -Another solution is to simply create the nvidia specific nodes on bootup. X will then load the module when required, and as the nodes are already in existance, you will not run into the problem described above. Place these commands in a file that is automatically executed on bootup (e.g. /etc/conf.d/local.start for Gentoo): -
    -mknod /dev/nvidia0 c 195 0
    -mknod /dev/nvidiactl c 195 255
    -
    - -You should now be able to get into X with no problems.

    +udevtest is only a debugging/testing tool - it does not actually create the device node, even though it says it doing so!

    Author and Credits

    This document is written by Daniel Drake <dan@reactivated.net>
    Please do not hesitate to send feedback!

    -Additional thanks to: -
      -
    • The udev developers!
    • -
    • agrippa_cash (usb-storage info)
    • -
    • Carl Streeter (usb-storage info)
    • -
    • David Watson
    • -
    • Decibels
    • -
    • Frank Pieczynski
    • -
    • Feth Arezki
    • -
    • Jim (KDE info)
    • -
    • Johannes Jordens
    • -
    • Kay Sievers
    • -
    • Patrick Dreker
    • -
    • Todd Musall
    • -
    • Tuna
    • -
    • Ueli Schlpfer
    • -
    • ...and anyone else who provided information or feedback
    • -
    - -

    Copyright (C) 2003-2004 Daniel Drake
    +Copyright (C) 2003-2005 Daniel Drake
    This document is licensed under the GNU General Public License, Version 2. diff --git a/test/sys/block/cciss!c0d0/device b/test/sys/block/cciss!c0d0/device deleted file mode 120000 index 2d78258b1a..0000000000 --- a/test/sys/block/cciss!c0d0/device +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/cciss!c0d0/device b/test/sys/block/cciss!c0d0/device new file mode 100644 index 0000000000..2d78258b1a --- /dev/null +++ b/test/sys/block/cciss!c0d0/device @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/rd!c0d0/device b/test/sys/block/rd!c0d0/device deleted file mode 120000 index 2d78258b1a..0000000000 --- a/test/sys/block/rd!c0d0/device +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/rd!c0d0/device b/test/sys/block/rd!c0d0/device new file mode 100644 index 0000000000..2d78258b1a --- /dev/null +++ b/test/sys/block/rd!c0d0/device @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/sda/device b/test/sys/block/sda/device deleted file mode 120000 index 2d78258b1a..0000000000 --- a/test/sys/block/sda/device +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/sda/device b/test/sys/block/sda/device new file mode 100644 index 0000000000..2d78258b1a --- /dev/null +++ b/test/sys/block/sda/device @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:09.0 b/test/sys/bus/pci/devices/0000:00:09.0 deleted file mode 120000 index 1c776568bd..0000000000 --- a/test/sys/bus/pci/devices/0000:00:09.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:09.0 b/test/sys/bus/pci/devices/0000:00:09.0 new file mode 100644 index 0000000000..1c776568bd --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:09.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1e.0 b/test/sys/bus/pci/devices/0000:00:1e.0 deleted file mode 120000 index e000c77614..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1e.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1e.0 b/test/sys/bus/pci/devices/0000:00:1e.0 new file mode 100644 index 0000000000..e000c77614 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1e.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:02:05.0 b/test/sys/bus/pci/devices/0000:02:05.0 deleted file mode 120000 index 630d35bf61..0000000000 --- a/test/sys/bus/pci/devices/0000:02:05.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:02:05.0 b/test/sys/bus/pci/devices/0000:02:05.0 new file mode 100644 index 0000000000..630d35bf61 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:02:05.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 b/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 deleted file mode 120000 index bd644e0e9d..0000000000 --- a/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 b/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 new file mode 100644 index 0000000000..bd644e0e9d --- /dev/null +++ b/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/0:0:0:0 b/test/sys/bus/scsi/devices/0:0:0:0 deleted file mode 120000 index ebb65b3bac..0000000000 --- a/test/sys/bus/scsi/devices/0:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/0:0:0:0 b/test/sys/bus/scsi/devices/0:0:0:0 new file mode 100644 index 0000000000..ebb65b3bac --- /dev/null +++ b/test/sys/bus/scsi/devices/0:0:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/0:0:0:0 b/test/sys/bus/scsi/drivers/sd/0:0:0:0 deleted file mode 120000 index 239003f712..0000000000 --- a/test/sys/bus/scsi/drivers/sd/0:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/0:0:0:0 b/test/sys/bus/scsi/drivers/sd/0:0:0:0 new file mode 100644 index 0000000000..239003f712 --- /dev/null +++ b/test/sys/bus/scsi/drivers/sd/0:0:0:0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/devices/ttyUSB0 b/test/sys/bus/usb-serial/devices/ttyUSB0 deleted file mode 120000 index b7733a68e0..0000000000 --- a/test/sys/bus/usb-serial/devices/ttyUSB0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/devices/ttyUSB0 b/test/sys/bus/usb-serial/devices/ttyUSB0 new file mode 100644 index 0000000000..b7733a68e0 --- /dev/null +++ b/test/sys/bus/usb-serial/devices/ttyUSB0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 b/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 deleted file mode 120000 index 177f109e48..0000000000 --- a/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 b/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 new file mode 100644 index 0000000000..177f109e48 --- /dev/null +++ b/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-0:1.0 b/test/sys/bus/usb/devices/3-0:1.0 deleted file mode 120000 index 9137978832..0000000000 --- a/test/sys/bus/usb/devices/3-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-0:1.0 b/test/sys/bus/usb/devices/3-0:1.0 new file mode 100644 index 0000000000..9137978832 --- /dev/null +++ b/test/sys/bus/usb/devices/3-0:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1 b/test/sys/bus/usb/devices/3-1 deleted file mode 120000 index e47b4d58c4..0000000000 --- a/test/sys/bus/usb/devices/3-1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1 b/test/sys/bus/usb/devices/3-1 new file mode 100644 index 0000000000..e47b4d58c4 --- /dev/null +++ b/test/sys/bus/usb/devices/3-1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1:1.0 b/test/sys/bus/usb/devices/3-1:1.0 deleted file mode 120000 index f519185eb3..0000000000 --- a/test/sys/bus/usb/devices/3-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1:1.0 b/test/sys/bus/usb/devices/3-1:1.0 new file mode 100644 index 0000000000..f519185eb3 --- /dev/null +++ b/test/sys/bus/usb/devices/3-1:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb3 b/test/sys/bus/usb/devices/usb3 deleted file mode 120000 index fb1919e7c9..0000000000 --- a/test/sys/bus/usb/devices/usb3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb3 b/test/sys/bus/usb/devices/usb3 new file mode 100644 index 0000000000..fb1919e7c9 --- /dev/null +++ b/test/sys/bus/usb/devices/usb3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/3-0:1.0 b/test/sys/bus/usb/drivers/hub/3-0:1.0 deleted file mode 120000 index 2bc160c20c..0000000000 --- a/test/sys/bus/usb/drivers/hub/3-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/3-0:1.0 b/test/sys/bus/usb/drivers/hub/3-0:1.0 new file mode 100644 index 0000000000..2bc160c20c --- /dev/null +++ b/test/sys/bus/usb/drivers/hub/3-0:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/pl2303/3-1:1.0 b/test/sys/bus/usb/drivers/pl2303/3-1:1.0 deleted file mode 120000 index 49d32d5abd..0000000000 --- a/test/sys/bus/usb/drivers/pl2303/3-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/pl2303/3-1:1.0 b/test/sys/bus/usb/drivers/pl2303/3-1:1.0 new file mode 100644 index 0000000000..49d32d5abd --- /dev/null +++ b/test/sys/bus/usb/drivers/pl2303/3-1:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/3-1 b/test/sys/bus/usb/drivers/usb/3-1 deleted file mode 120000 index 03c76193e9..0000000000 --- a/test/sys/bus/usb/drivers/usb/3-1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/3-1 b/test/sys/bus/usb/drivers/usb/3-1 new file mode 100644 index 0000000000..03c76193e9 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/3-1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb3 b/test/sys/bus/usb/drivers/usb/usb3 deleted file mode 120000 index 61dc52a613..0000000000 --- a/test/sys/bus/usb/drivers/usb/usb3 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb3 b/test/sys/bus/usb/drivers/usb/usb3 new file mode 100644 index 0000000000..61dc52a613 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/usb3 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/class/tty/ttyUSB0/device b/test/sys/class/tty/ttyUSB0/device deleted file mode 120000 index b7733a68e0..0000000000 --- a/test/sys/class/tty/ttyUSB0/device +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/class/tty/ttyUSB0/device b/test/sys/class/tty/ttyUSB0/device new file mode 100644 index 0000000000..b7733a68e0 --- /dev/null +++ b/test/sys/class/tty/ttyUSB0/device @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver deleted file mode 120000 index 9ff2c81f52..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb-serial/drivers/PL-2303 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver new file mode 100644 index 0000000000..9ff2c81f52 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver @@ -0,0 +1 @@ +../../../../../../bus/usb-serial/drivers/PL-2303 \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 17f2b1a7e0d10334af7f9622848788add125dea8 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 10 May 2005 10:09:29 -0700 Subject: Removed klibc/klibc.spec as it is autogenerated --- klibc/klibc.spec | 102 ------------------------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 klibc/klibc.spec diff --git a/klibc/klibc.spec b/klibc/klibc.spec deleted file mode 100644 index 65b0bf5439..0000000000 --- a/klibc/klibc.spec +++ /dev/null @@ -1,102 +0,0 @@ -Summary: A minimal libc subset for use with initramfs. -Name: klibc -Version: 0.205 -Release: 1 -License: BSD/GPL -Group: Development/Libraries -URL: http://www.zytor.com/mailman/listinfo/klibc -Source: http://www.kernel.org/pub/linux/libs/klibc-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildRequires: kernel >= 2.6.0 -Packager: H. Peter Anvin -Prefix: /usr -Vendor: Starving Linux Artists - -%define klibcdir %{_prefix}/lib/klibc -%define libdocdir %{_docdir}/%{name}-%{version}-%{release} -%define bindocdir %{_docdir}/%{name}-utils-%{version}-%{release} - -%description -%{name} is intended to be a minimalistic libc subset for use with -initramfs. It is deliberately written for small size, minimal -entanglement, and portability, not speed. It is definitely a work in -progress, and a lot of things are still missing. - -%package utils -Summary: Small utilities built with klibc. -Group: Utilities/System -Requires: klibc = %{version} - -%description utils -This package contains a collection of programs that are linked against -klibc. These duplicate some of the functionality of a regular Linux -toolset, but are typically much smaller than their full-function -counterparts. They are intended for inclusion in initramfs images and -embedded systems. - -%prep -%setup -q -cp -dRs /lib/modules/`uname -r`/build ./linux -# Shouldn't need this when getting the build tree from /lib/modules -# make -C linux defconfig ARCH=%{_target_cpu} -# make -C linux prepare ARCH=%{_target_cpu} -# Deal with braindamage in RedHat's kernel-source RPM -rm -f linux/include/linux/config.h -cat < linux/include/linux/config.h -#ifndef _LINUX_CONFIG_H -#define _LINUX_CONFIG_H - -#include - -#endif -EOF -mkdir -p %{buildroot} - -%build -make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ - INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} - -%install -rm -rf %{buildroot} -make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ - INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} \ - install - -# Install the docs - -mkdir -p %{buildroot}%{bindocdir} %{buildroot}%{libdocdir} -install -m 444 README %{buildroot}%{libdocdir} -install -m 444 klibc/README %{buildroot}%{libdocdir}/README.klibc -install -m 444 klibc/arch/README %{buildroot}%{libdocdir}/README.klibc.arch - -install -m 444 gzip/COPYING %{buildroot}%{bindocdir}/COPYING.gzip -install -m 444 gzip/README %{buildroot}%{bindocdir}/README.gzip -install -m 444 ipconfig/README %{buildroot}%{bindocdir}/README.ipconfig -install -m 444 kinit/README %{buildroot}%{bindocdir}/README.kinit - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root,-) -%{klibcdir}/lib -%{klibcdir}/include -%{_bindir}/klcc -/lib/klibc-*.so -%doc %{_mandir}/man1/* -%doc %{libdocdir}/* - -%files utils -%defattr(-,root,root,-) -%{klibcdir}/bin -%doc %{bindocdir}/* - -%changelog -* Tue Mar 1 2005 H. Peter Anvin -- New "make install" scheme, klcc - -* Tue Jul 6 2004 H. Peter Anvin -- Update to use kernel-source RPM for the kernel symlink. - -* Sat Nov 29 2003 Bryan O'Sullivan - -- Initial build. -- cgit v1.2.3-54-g00ecf From 49cedafaf893bfe348eb7598227f1a11ae24bfd6 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 10 May 2005 10:11:15 -0700 Subject: hopefully fix up the symlinks in the test directory Thanks to Kay for pointing this out. Signed-off-by: Greg Kroah-Hartman --- test/sys/block/cciss!c0d0/device | 0 test/sys/block/rd!c0d0/device | 0 test/sys/block/sda/device | 0 test/sys/bus/pci/devices/0000:00:09.0 | 0 test/sys/bus/pci/devices/0000:00:1e.0 | 0 test/sys/bus/pci/devices/0000:02:05.0 | 0 test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 | 0 test/sys/bus/scsi/devices/0:0:0:0 | 0 test/sys/bus/scsi/drivers/sd/0:0:0:0 | 0 test/sys/bus/usb-serial/devices/ttyUSB0 | 0 test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 | 0 test/sys/bus/usb/devices/3-0:1.0 | 0 test/sys/bus/usb/devices/3-1 | 0 test/sys/bus/usb/devices/3-1:1.0 | 0 test/sys/bus/usb/devices/usb3 | 0 test/sys/bus/usb/drivers/hub/3-0:1.0 | 0 test/sys/bus/usb/drivers/pl2303/3-1:1.0 | 0 test/sys/bus/usb/drivers/usb/3-1 | 0 test/sys/bus/usb/drivers/usb/usb3 | 0 test/sys/class/tty/ttyUSB0/device | 0 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver | 0 21 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 120000 test/sys/block/cciss!c0d0/device mode change 100644 => 120000 test/sys/block/rd!c0d0/device mode change 100644 => 120000 test/sys/block/sda/device mode change 100644 => 120000 test/sys/bus/pci/devices/0000:00:09.0 mode change 100644 => 120000 test/sys/bus/pci/devices/0000:00:1e.0 mode change 100644 => 120000 test/sys/bus/pci/devices/0000:02:05.0 mode change 100644 => 120000 test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 mode change 100644 => 120000 test/sys/bus/scsi/devices/0:0:0:0 mode change 100644 => 120000 test/sys/bus/scsi/drivers/sd/0:0:0:0 mode change 100644 => 120000 test/sys/bus/usb-serial/devices/ttyUSB0 mode change 100644 => 120000 test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 mode change 100644 => 120000 test/sys/bus/usb/devices/3-0:1.0 mode change 100644 => 120000 test/sys/bus/usb/devices/3-1 mode change 100644 => 120000 test/sys/bus/usb/devices/3-1:1.0 mode change 100644 => 120000 test/sys/bus/usb/devices/usb3 mode change 100644 => 120000 test/sys/bus/usb/drivers/hub/3-0:1.0 mode change 100644 => 120000 test/sys/bus/usb/drivers/pl2303/3-1:1.0 mode change 100644 => 120000 test/sys/bus/usb/drivers/usb/3-1 mode change 100644 => 120000 test/sys/bus/usb/drivers/usb/usb3 mode change 100644 => 120000 test/sys/class/tty/ttyUSB0/device mode change 100644 => 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver diff --git a/test/sys/block/cciss!c0d0/device b/test/sys/block/cciss!c0d0/device deleted file mode 100644 index 2d78258b1a..0000000000 --- a/test/sys/block/cciss!c0d0/device +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/cciss!c0d0/device b/test/sys/block/cciss!c0d0/device new file mode 120000 index 0000000000..2d78258b1a --- /dev/null +++ b/test/sys/block/cciss!c0d0/device @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/rd!c0d0/device b/test/sys/block/rd!c0d0/device deleted file mode 100644 index 2d78258b1a..0000000000 --- a/test/sys/block/rd!c0d0/device +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/rd!c0d0/device b/test/sys/block/rd!c0d0/device new file mode 120000 index 0000000000..2d78258b1a --- /dev/null +++ b/test/sys/block/rd!c0d0/device @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/sda/device b/test/sys/block/sda/device deleted file mode 100644 index 2d78258b1a..0000000000 --- a/test/sys/block/sda/device +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/sda/device b/test/sys/block/sda/device new file mode 120000 index 0000000000..2d78258b1a --- /dev/null +++ b/test/sys/block/sda/device @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:09.0 b/test/sys/bus/pci/devices/0000:00:09.0 deleted file mode 100644 index 1c776568bd..0000000000 --- a/test/sys/bus/pci/devices/0000:00:09.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:09.0 b/test/sys/bus/pci/devices/0000:00:09.0 new file mode 120000 index 0000000000..1c776568bd --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:09.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1e.0 b/test/sys/bus/pci/devices/0000:00:1e.0 deleted file mode 100644 index e000c77614..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1e.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1e.0 b/test/sys/bus/pci/devices/0000:00:1e.0 new file mode 120000 index 0000000000..e000c77614 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1e.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:02:05.0 b/test/sys/bus/pci/devices/0000:02:05.0 deleted file mode 100644 index 630d35bf61..0000000000 --- a/test/sys/bus/pci/devices/0000:02:05.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:02:05.0 b/test/sys/bus/pci/devices/0000:02:05.0 new file mode 120000 index 0000000000..630d35bf61 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:02:05.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 b/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 deleted file mode 100644 index bd644e0e9d..0000000000 --- a/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 b/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 new file mode 120000 index 0000000000..bd644e0e9d --- /dev/null +++ b/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/0:0:0:0 b/test/sys/bus/scsi/devices/0:0:0:0 deleted file mode 100644 index ebb65b3bac..0000000000 --- a/test/sys/bus/scsi/devices/0:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/0:0:0:0 b/test/sys/bus/scsi/devices/0:0:0:0 new file mode 120000 index 0000000000..ebb65b3bac --- /dev/null +++ b/test/sys/bus/scsi/devices/0:0:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/0:0:0:0 b/test/sys/bus/scsi/drivers/sd/0:0:0:0 deleted file mode 100644 index 239003f712..0000000000 --- a/test/sys/bus/scsi/drivers/sd/0:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/0:0:0:0 b/test/sys/bus/scsi/drivers/sd/0:0:0:0 new file mode 120000 index 0000000000..239003f712 --- /dev/null +++ b/test/sys/bus/scsi/drivers/sd/0:0:0:0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/devices/ttyUSB0 b/test/sys/bus/usb-serial/devices/ttyUSB0 deleted file mode 100644 index b7733a68e0..0000000000 --- a/test/sys/bus/usb-serial/devices/ttyUSB0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/devices/ttyUSB0 b/test/sys/bus/usb-serial/devices/ttyUSB0 new file mode 120000 index 0000000000..b7733a68e0 --- /dev/null +++ b/test/sys/bus/usb-serial/devices/ttyUSB0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 b/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 deleted file mode 100644 index 177f109e48..0000000000 --- a/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 b/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 new file mode 120000 index 0000000000..177f109e48 --- /dev/null +++ b/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-0:1.0 b/test/sys/bus/usb/devices/3-0:1.0 deleted file mode 100644 index 9137978832..0000000000 --- a/test/sys/bus/usb/devices/3-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-0:1.0 b/test/sys/bus/usb/devices/3-0:1.0 new file mode 120000 index 0000000000..9137978832 --- /dev/null +++ b/test/sys/bus/usb/devices/3-0:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1 b/test/sys/bus/usb/devices/3-1 deleted file mode 100644 index e47b4d58c4..0000000000 --- a/test/sys/bus/usb/devices/3-1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1 b/test/sys/bus/usb/devices/3-1 new file mode 120000 index 0000000000..e47b4d58c4 --- /dev/null +++ b/test/sys/bus/usb/devices/3-1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1:1.0 b/test/sys/bus/usb/devices/3-1:1.0 deleted file mode 100644 index f519185eb3..0000000000 --- a/test/sys/bus/usb/devices/3-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1:1.0 b/test/sys/bus/usb/devices/3-1:1.0 new file mode 120000 index 0000000000..f519185eb3 --- /dev/null +++ b/test/sys/bus/usb/devices/3-1:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb3 b/test/sys/bus/usb/devices/usb3 deleted file mode 100644 index fb1919e7c9..0000000000 --- a/test/sys/bus/usb/devices/usb3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb3 b/test/sys/bus/usb/devices/usb3 new file mode 120000 index 0000000000..fb1919e7c9 --- /dev/null +++ b/test/sys/bus/usb/devices/usb3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/3-0:1.0 b/test/sys/bus/usb/drivers/hub/3-0:1.0 deleted file mode 100644 index 2bc160c20c..0000000000 --- a/test/sys/bus/usb/drivers/hub/3-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/3-0:1.0 b/test/sys/bus/usb/drivers/hub/3-0:1.0 new file mode 120000 index 0000000000..2bc160c20c --- /dev/null +++ b/test/sys/bus/usb/drivers/hub/3-0:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/pl2303/3-1:1.0 b/test/sys/bus/usb/drivers/pl2303/3-1:1.0 deleted file mode 100644 index 49d32d5abd..0000000000 --- a/test/sys/bus/usb/drivers/pl2303/3-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/pl2303/3-1:1.0 b/test/sys/bus/usb/drivers/pl2303/3-1:1.0 new file mode 120000 index 0000000000..49d32d5abd --- /dev/null +++ b/test/sys/bus/usb/drivers/pl2303/3-1:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/3-1 b/test/sys/bus/usb/drivers/usb/3-1 deleted file mode 100644 index 03c76193e9..0000000000 --- a/test/sys/bus/usb/drivers/usb/3-1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/3-1 b/test/sys/bus/usb/drivers/usb/3-1 new file mode 120000 index 0000000000..03c76193e9 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/3-1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb3 b/test/sys/bus/usb/drivers/usb/usb3 deleted file mode 100644 index 61dc52a613..0000000000 --- a/test/sys/bus/usb/drivers/usb/usb3 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb3 b/test/sys/bus/usb/drivers/usb/usb3 new file mode 120000 index 0000000000..61dc52a613 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/usb3 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file diff --git a/test/sys/class/tty/ttyUSB0/device b/test/sys/class/tty/ttyUSB0/device deleted file mode 100644 index b7733a68e0..0000000000 --- a/test/sys/class/tty/ttyUSB0/device +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/class/tty/ttyUSB0/device b/test/sys/class/tty/ttyUSB0/device new file mode 120000 index 0000000000..b7733a68e0 --- /dev/null +++ b/test/sys/class/tty/ttyUSB0/device @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver deleted file mode 100644 index 9ff2c81f52..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb-serial/drivers/PL-2303 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver new file mode 120000 index 0000000000..9ff2c81f52 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver @@ -0,0 +1 @@ +../../../../../../bus/usb-serial/drivers/PL-2303 \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 1e50c2dee7401055a0e76c116de939f0893e7429 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 10 May 2005 10:22:56 -0700 Subject: Update permissions on test scripts so they will run properly now. Signed-off-by: Greg Kroah-Hartman --- test/udev-test.pl | 0 test/udevstart-test.pl | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 test/udev-test.pl mode change 100644 => 100755 test/udevstart-test.pl diff --git a/test/udev-test.pl b/test/udev-test.pl old mode 100644 new mode 100755 diff --git a/test/udevstart-test.pl b/test/udevstart-test.pl old mode 100644 new mode 100755 -- cgit v1.2.3-54-g00ecf From 60f44733522cca3a619db598e4c83b8e8d0750b6 Mon Sep 17 00:00:00 2001 From: Date: Mon, 16 May 2005 12:26:41 -0700 Subject: added translated (jp) version of writing udev rules file. From Masanao Igarashi --- docs/writing_udev_rules/index.jp.html | 598 ++++++++++++++++++++++++++++++++++ 1 file changed, 598 insertions(+) create mode 100644 docs/writing_udev_rules/index.jp.html diff --git a/docs/writing_udev_rules/index.jp.html b/docs/writing_udev_rules/index.jp.html new file mode 100644 index 0000000000..e94eae8a46 --- /dev/null +++ b/docs/writing_udev_rules/index.jp.html @@ -0,0 +1,598 @@ +udevルールの書き方 + + + + + +

    udevルールの書き方

    +Daniel Drake (dsd) 著
    +バージョン 0.6

    + +この文書の最新バージョンは、常に以下のサイトにあります。
    +http://www.reactivated.net/udevrules.php(英語オリジナルサイト)
    +http://www.gentoo.gr.jp/transdocs/udevrules/udevrules.html(日本語翻訳版)

    + +日本語翻訳版は、著者に許可を得て、五十嵐 正尚(igarashi@gentoo.gr.jp)が翻訳し、GentooJPで公開しているものです。翻訳版に関することは訳者に連絡してください。
    +日本語翻訳版 最終更新日 2005-05-16 + +

    内容

    +
      +
    1. この文書について
    2. +
    3. 更新履歴
    4. +
    5. 執筆時に使用したソフトウェアのバージョン
    6. +
    7. 用語紹介: devfs、sysfs、ノードなど
    8. + +
    9. なぜルールを書く必要がありますか? (この文書の目的)
    10. +
    11. ルールを書く上での基本事項
    12. +
    13. NAMEとSYMLINKパラメータでの設定自動化のための付加機能
    14. +
    15. キーでのシェル形式パターン照合の使い方
    16. +
    17. キーを書く上での基本事項
    18. +
    19. 基本キーによるデバイス識別方法
    20. +
    21. SYSFSファイルによるデバイス識別方法
    22. +
    23. 複数SYMLINK形式の使い方
    24. +
    25. 所有権とパーミッション制御
    26. +
    27. 例: 著者所有のUSBプリンタ向けのルールの書き方
    28. +
    29. 例: USBストレージ方式対応デジカメ向けのルールの書き方
    30. + +
    31. USBストレージ向けルールの書き方に関する追記
    32. +
    33. 例: 著者所有のCDドライブに便利なルールの書き方
    34. +
    35. 例: 著者所有のネットワークインターフェースに名前を付けるルールの書き方
    36. +
    37. SYSFS内におけるudevinfoを実行すべき場所を探し出すコツ
    38. +
    39. ルールのデバッグ方法
    40. +
    41. 著者と謝辞
    42. +
    + + +

    この文書について

    +udevはLinuxカーネル2.6以降を対象とし、デバイス名を固定する機能を備え、動的な/devディレクトリをユーザスペースで実現する方法を提供します。 +これまでの/devの実装であるdevfsは、現在後方互換のためだけに残されており、udevはその後任と考えられています。 +udevとdevfsではどちらが良いかということは、慎重に議論されるべき問題です。 +ご自分で比較する前に、まずこの文書を読むべきです。

    +udevはよく考え抜かれていますが、私は最初、自分のシステムではどのように調整すればよいのかとても戸惑いました。この文書では、ルールを書く手順がもう少し明確になることを目指しています。

    + +いつでも意見や感想をお待ちしております。どんな意見、問題、改善案でも連絡先にお願いします。

    +この文書は、udev/hotplugをインストール済みであり、初期設定で問題なく動作していることを想定しています。まだudevを設定しておらず、動作していないなら、Decibels udev Primer(日本語訳)に従ってその作業を行うことをお勧めします(少しGentoo Linux固有のことが含まれていますが、他のディストリビューションにも有用なはずです)。

    + + + +

    更新履歴

    + +2005年5月9日 v0.6: udevinfo、グループとパーミッション、ログ取り、udevtestに関する情報を含む様々な更新。

    +2004年6月20日 v0.55: 複数シンボリックリンク形式に関する情報を追加。細かい変更/更新。

    +2004年4月26日 v0.54: Debian情報を追加。細かい修正。 +ルールファイルをなんと呼ぶべきかに関しての情報を過去ものに戻した。 +ネットワークインターフェースの名前付けに関する情報を追加。

    +2004年4月15日 v0.53: 細かい修正。NAME{all_partitions}に関する情報を追加。udevinfoを使用する際のコツに関する別の情報を追加。

    +2004年4月14日 v0.52: udevの初期設定が他のファイルを考慮するようになるまで、udev.rulesの使用を推奨するように戻した。細かい作業。

    +2004年4月6日 v0.51: udev.rulesの先頭に追加するより、各自のlocal.rulesファイルの使用を推奨するように書いた。

    +2004年4月3日 v0.5: ちょっとした整理とudev配布物に含まれる可能性があるため、その準備。

    +2004年3月20日 v0.4: 全体的に改良、明確化、および整理。USBストレージ向けのルールの書き方に関する情報をさらに追加。

    +2004年2月23日 v0.3: sysfsの名前付け動作方法とそれにどのように一致させるかを強調するために、いろんな部分を書き直し。 +udev 018の新しいSYSFS{filename}名前付け規則を説明するルールの書き方を更新。 +セクションの体裁を改良と、いろんな箇所をわかりやすくした。KDEに関する情報を追加。

    +2004年2月18日 v0.2: 例の中のちょっとした間違いを修正。 +マスストレージデバイスの識別に関するセクションを更新。nvidiaのセクションを更新

    +2004年2月15日 v0.1: 最初の公開。

    + + +

    執筆時に使用したソフトウェアのバージョン

    +Linuxカーネル 2.6.11
    +udev 056

    + + +

    用語紹介: devfs、sysfs、ノードなど

    +基本的な紹介だけです。完全に正確ではないかもしれません。

    + +標準的なlinuxを基本とするシステムでは、/devディレクトリは、ファイルに似たデバイスノードを保持するために使用されます。 +デバイスノードは、システムに含まれる特定のデバイスに対応します。 +各ノードは、システム構成の一部(デバイス)を指します。デバイスは、実際に存在するかもしれないし、存在しないかもしれません。 +ユーザスペースで動作するアプリケーションは、システムハードウェアとやり取りをするためにこれらのデバイスノードを使用できます。例えば、ユーザが行うマウス動作を、画面上のマウスポインタの動きに結びつけるために、XFree86は/dev/input/miceを監視します。

    + +もともとの/devディレクトリは、システムに組み込まれる可能性のある全てのデバイスが配置されていました。 +そんなわけで/devディレクトリは、一般的にとても大きくなっていました。 +devfsは、もろもろの機能に加え、より扱いやすい手法(特に目を引くのは、システムに接続されたハードウェアだけが/devに配置されたことでした)を提供するために登場しました。 +しかし、devfsには簡単に解決することができない問題があることが判明しました。

    + +udevは、/devディレクトリを管理する新しい手法です。 +過去の/dev実装にある問題を解決するように設計され、将来にわたって破綻しないものを提供します。 +udevは、ユーザが指定するルールsysfsによって提供される情報を照合して、システムに組み込まれたデバイスに相当する/devデバイスノードを作成し命名します。 +ルールを書く工程は、ユーザが(選択的に)行う必要がある数少ないudevに関係する作業のうちの一つです。 +この文書は、そのルールを書く工程を詳しく説明することが目的です。

    + +sysfsは、2.6カーネル向けの新しいファイルシステムです。 +sysfsはカーネルによって管理され、システムに接続されているデバイスに関する基本情報をユーザスペースに提供します。 +udevは、ハードウェアに相当するデバイスノードを作成するために、この情報を使用します。 +sysfsは/sysにマウントされることで、情報を読み出せる状態になります。 +udevに取り組む前に、まず/sysにあるファイル群を調査したいとお思いになるでしょう。この文書全体に渡って、用語/sysSYSFSを使用します。どちらにも読み替え可能です。


    + + +

    なぜルールを書く必要がありますか?

    +上で述べたように、udevのルールを書くかどうかは、自由に選択できます。 +初期設定でも、デバイスを接続することができ、過去の/dev実装でのように、そのデバイスに適切なノード(例えば、マスストレージデバイス用である/dev/sdaなど)が作成されるでしょう。

    +しかし、udevはデバイスノードの名前を自由に変えることができます。 +名前を変更したくなる理由には、利便性とデバイス名の固定化の二つが考えられます。

    + +プリンタが接続されたときに、/dev/printerとして命名され、さらにいつもの/dev/lp0も存在するようにする場合のudevの使用例を挙げます。 +この例は、利便性(例えば、lp0ではなくprinterに読み替える)だけではなく、変更になる可能性のある名前への対策であることを意図しています。 +私は二つのプリンタ(HPのレーザプリンタと、EPSONのインクジェット)を持っています。 +それらプリンタの両方が接続され、システムに組み込まれるた場合、/dev/lp0と/dev/lp1になります。
    +どうすれば、どちらのノードがどちらのプリンタを指しているかを知ることができるでしょう。 +簡単な方法はありません。接続された順で、最初のプリンタがlp0を割り当てられ、二番目がlp1に割り当てられます。異なる順番でプリンタが接続されると、この名前は逆になります。そして、それは常にHPのレーザプリンタがlp1であることを想定している私のスクリプトを混乱させるでしょう。

    +しかし、もしHPレーザプリンタに(lpXに加えて)lp_hpの名前が与えられ、一方のプリンタに(lpYに加えて)lp_epsonの名前が与えられるなら、私のスクリプトは、これらの名前を使えるでしょう。udevの魔法は、このようなことを制御でき、このような固定された名前が常に意図するデバイスを指すことを確実にします。

    +この名前の固定化機能は、外部マスストレージデバイス(例えば、USBハードディスク)において、/etc/fstabに正確なデバイスを書き込むことを可能にするのに、とても役に立ちます。

    + +ルールを書くことは、udevの動作を調整する一つの手段でしかないという認識を持つことが大切です。 +ルールを書くことは、既存の特定デバイスに対応するデバイスノードがない場合の問題に対する回避策ではありません。 +該当する既存のルールがない場合、udevはカーネルが提供する名前を使ってとにかくノードを作成します。

    + + +

    ルールを書く上での基本事項

    + +udevは、/devの下を配置するときに、一連のルールファイルを読んで、どのノードを含めるかと、それらのノードにどのような名前を付けるかを決定します。

    + +初期設定のudevルールは、/etc/udev/rules.d/50-udev.rulesにあります。 +このファイルにざっと目を通すとおもしろいことが分かるかもしれません。 +そこには少しの例や、いくつかのdevfs形式の/devレイアウトを提供する初期設定ルールが含まれています。 +しかし、今後udevを更新するときに起こりうる面倒を軽減するために、このファイルにルールを直接書くべきではありません。

    + +/etc/udev/rules.d/にあるファイルは、辞書順で解析されます。 +udevは、ファイル中に新しく検出されたハードウェアに一致するルールを見つけるとすぐに、ルール処理を止めます。 +udevの初期設定と照合される前に、ユーザが用意したルールが処理されることが重要です。そうでないと、ユーザの命名規則は無効になってしまうでしょう。 +/etc/udev/rules.d/10-local.rulesファイル(デフォルトでは存在しないので、作成してください)の中にユーザ指定のルールを保持しておくことを推奨します。 +10は50より前なので、ユーザ指定のルールが最初に評価されることがおわかりでしょう。 +ユーザ指定のルールファイルの名前は、.rulesサフィックスで終わっている必要があります。そうしないと利用されません。

    + +ユーザ指定のルールは、基本の/devレイアウトを作成するudevの初期設定を、事実上無効にしてしまいます。したがって、ユーザが記述するルールには、実用的である初期設定の名前とユーザ指定の名前両方を得るために、devfs形式の名前やシンボリックリンクも指定することをお勧めします。

    + +ルールファイルでは、"#"で始まる行は、コメントとして扱われます。 +ルールファイルの中のコメントされてない全ての行が、ルールに相当します。

    + +ルールは複数のキーで構成されます。複数のキーはコンマによって区切られます。 +一部のキーは情報の読み込みと照合用で、その他のものは、情報の割当てやアクションの実行用です。 +
      +
    1. システムにあるいろいろなデバイスに一致する、少なくとも一つの識別キー(identification key)を指定する必要があります。 +識別キーついては、後にある基本キーによるデバイス識別方法セクションに記載されています。
    2. +
    3. 結果としてデバイスノードがどのようにして作成されるかを制御するための、少なくとも一つの割当てキー(assignment key)を指定する必要があります。 +割当てキーには、NAME、SYMLINK、OWNER、GROUP、MODEがあり、このドキュメントですべて説明しています。
    4. +
    + +一般的なルールは、デバイスに名前を付けることを決定するために、複数の基本識別キーが使われます。そして、デバイスノード名を決めるために一つのNAME割当てキーが指定されます。 +udevは、一つのデバイスに対し一つのノードだけを作成します。 +したがって、一つのデバイスに対し複数のノードを通してアクセスしたい場合は、SYMLINK割当てキーに、別のノードを指定する必要があります。

    + +以下に例を示すためにudevの例にあるルールをちょっと修正したものを取り上げます。 +
    BUS="usb", SYSFS{serial}="HXOLL0012202323480", NAME="lp_epson", SYMLINK="printers/epson_stylus"
    + +この場合の識別キーは、BUSSYSFS{serial}で、割当てキーは、NAMESYMLINKです。 +udevは、このルールをUSBバスによって接続されかつHXOLL0012202323480のシリアルナンバーを持つデバイスに対して一致させます。 +udevがデバイスに名前を付けるルールとして採用するには、(どれか一つではなく)すべての指定されたキーが一致する必要があります。
    + +udevは、このノードをlp_epsonと命名し、/dev/lp_epsonに作成するでしょう。
    +udevは、さらに/dev/lp_epsonへのシンボリックリンクを、/dev/printers/epson_stylusに作成します(printersディレクトリは、自動的に作成されます。)。 +これで、/dev/printers/epson_stylusもしくは/dev/lp_epsonにデータを送ることで、EPSONプリンタで印刷することができます。

    + +ユーザが追加または修正したどんなルールも、udevに通知するまで有効にはなりません。 +何かルールファイルを修正した場合は常に以下のコマンドを確実に実行することを忘れないでくささい。 +
    # udevstart
    + + +

    NAMEとSYMLINKパラメータでの設定自動化のための付加機能

    +ルールのNAMEとSYMLINKパラメータに、デバイスの名前づけを支援する基本オペレータを使用することができます。 +プログラム言語が分かる人は、この種のものをprintf形式に似た文字列置換として知っていると思います。 +NAME/SYMLINKパラメータの一部もしくは全てを組み立てることが可能な、いくつかのオペレータがあります。 +これらオペレータは、デバイスに関するカーネルデータを参照します。 +以下の例を見てみましょう。 +
    BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n"
    + +%nオペレータは、camera0、camera1、などのようなNAMEを作成するために、カメラデバイスに対する"カーネル番号"に置き換えられます。

    + +他にはよく使われるオペレータとして、%kがあります。 +これは、例えば"hda1"などのような、カーネルがデバイスに付けると予想される名前を表します。 +ハードウェアのデフォルトの名前を作成するための、NAME="%k"が指定されているルールをよく見るでしょう。 +このようなルールでは、ユーザ指定のものは通常SYMLINKパラメータによって設定されます。

    + +udevのmanページに説明付きでオペレータの全リストがあります。

    + + +

    キーでのシェル形式パターン照合の使い方

    + +キーを書く場合、より柔軟性を高めるためにシェル形式のパターン照合を使用することができます。以下に初期設定のudevルールを取り上げます。 + +
    KERNEL="ts*", NAME="input/%k"
    +ここでは*オペレータが使われています。これは、文字列長が0以上のすべての種類の文字で構成される文字列全体に一致します。 +このルールの書き方は、以下のことを意味します。 + +
    "ts"の文字列で始まり、その後に任意で何かの文字が続くKERNEL名によって識別されるデバイスに一致し、指定ディレクトリの下にKERNEL名(%k)で名前をつけます。
    + +?オペレータはよく似ており、何かの一文字に一致します(0文字には一致しません)。

    + +どれかの一文字に一致する、かぎ括弧[ ]も使用できます。以下にudevのmanページから直接引用します。
    +
    例えば, パターン文字列"tty[SR]"は、"ttyS"か"ttyR"に一致します。
    +一致範囲を指定することもできます。 +例えば、[0-9]はいずれかの一文字の数字に一致します。 +以下にudevインストール直後の初期設定にあるルール例を示します。 +
    KERNEL="fd[0-9]*", NAME="floppy/%n"
    + +このルールは以下のことを意味します。
    + +
    "fd"で始まり、それに一文字の何かの数字が続き、その後に任意で何かの文字が続くKERNEL名によって識別されるデバイスに一致します。フロッピーのディレクトリの下にデバイスのカーネル番号(%n)でデバイスに名前をつけます。
    +これらのワイルドカード/パターン一致は、基本キーとsysfsでの識別情報の両方を含め、どのキータイプででも使用できます(キータイプに関しては後の説明を参照してください)。

    + +ここでは、ルールの書き方に関する基本事項の範囲外である一部の情報(特に[ ]オペレータの柔軟性)をわざと割愛しています。 +これに関する詳しい情報は、udevのmanページにあります。

    + + +

    キーを書く上での基本事項

    +udevは、いくつかの基本キーを照合する仕組みを提供しています。さらにSYSFS内のデバイス情報と照合するための柔軟な方法も提供します。 +標準的なルールは、普通のキー(BUSとKERNELなど)と、 +同一ポートに接続された異なるハードウェア間で区別をするSYSFSキーの両方が一致します。

    +「自分のプリンタのシリアルナンバーをどうやって探せばいいの? 私のカメラのモデルは何だろう?」と疑問に思うかもしれません。 +ルールの書き方は、思うほど難しくありません。 +一番やっかいなのは/sys内で対象のデバイスを探して、どの情報を使うかを決めることです。

    + + +

    基本キーによるデバイス識別方法

    + +基本キーに関するより詳しい情報はudevのmanページを参照してください。

    + +有効なキーは次のとおりです。 +
    • BUS - デバイスのバスの種類と照合されます。
    • +
    • KERNEL - カーネルデバイス名と照合されます。
    • +
    • DRIVER - カーネルドライバの名前と照合されます。
    • +
    • SUBSYSTEM -カーネルサブシステム名と照合されます。
    • +
    • ID - バス上のデバイスナンバー(PCIバスIDなど)と照合されます。
    • +
    • PLACE - デバイスが接続された物理的な位置と照合されます(USBに役に立ちます)。
    • + +
    +IDとPLACEキーは、役に立つこともありますが、一般的にルールでは使用されません。 +この文書は、BUSとKERNELキーやSYSFS{...}キー(次のセクションで説明します)の使い方に重点を置きます。 +例を使ってこれらのキーの使い方を示します。

    + +さらに柔軟な方法として、udevは外部のスクリプトを呼び出してその結果を使うためのキーや、環境変数を使うためのキーも準備しています。 +これは、この文書の範囲外とします。より詳細な説明は、udevのmanページを見てください。 + + +

    SYSFSファイルによるデバイス識別方法

    + +前提となる知識: SYSFSは、ディレクトリツリーの下にハードウェアに関する情報を提供するたくさんの小さなファイルを保持しています。 +一つのファイルは、一般に一つだけ"データ項目"を持ちます。- 例えば、デバイス名や製造者情報やプロダクトIDがあります。

    +SYSFS{...}キーは、前のセクションで説明した基本キーと組み合わせることができます。


    + +特定のSYSFSの情報と照合するために、SYSFS{ファイル名}形式のキーを使えます。ファイル名は、SYSFSツリーの中のファイルに相当します。 +例としては、私のカメラが接続された場合、"USB 2.0M DSC"という内容で/sys/block/sda/device/modelにファイルが存在します。これと照合するために、次のようなキーを使えます。SYSFS{model} = "USB 2.0M DSC"

    + +sysfsにあるすべてのファイルが、この方法で照合することができます。 +ただ、(複数のキーを使って)一つ以上のファイルと照合させる場合、同一ディレクトリにあるファイルとだけに照合させる必要があります。 +一般的には、一つのデバイスに関する情報を提供するディレクトリは、いくつか存在します。 +(後の例で示すとおり、)それらを混合して照合することはできません。

    + +幸いにして、ルールを書く過程において、SYSFSにある無数のファイルを探し回る必要はありません。udevinfoユーティリティがその大変な作業を代わりにやってくれます。このプログラムはudevの配布物の中に含まれています。

    +まず始めにしなければならないことは、対象のハードウェアに対応する、"dev"というファイルを含むディレクトリが/sysのどこにあるかを見つけることです。 +udevinfoは、そのようなディレクトリ上でだけ動作可能です。 +これらのディレクトリは、すべてが/sys/block/sys/classのどちらか一方の下で見つかります。 +- その他の場所は、どこも参照する意味がありません! +しかし、udevinfoはこれらのディレクトリを経由してリンクを辿って、sysfsの別のセクションで見つかる情報を読み出します。

    +一度だけこのようなディレクトリを見つければ、udevルールのキーを書く作業を手助けしてくれる以下のコマンドが使えます。 +
    # udevinfo -a -p /sys/path/to/hardware/info
    + +udevinfoを実行するための/sys内の適切な位置を見つけることについては、まだ明確になっていないことが分かるでしょう。 +接続したデバイスに対し既にデバイスノード(例えば、/dev/sda)が作成されている可能性があり、その場合はudevinfoが役に立ちます! +私の/dev/sdaノードの例でいうと、以下のコマンドを実行するとsysfsの適切な位置を示してくれます。 +
    # udevinfo -q path -n /dev/sda
    +
    +/block/sda
    +
    + +(上記で示した)このコマンドの出力は、sysfsパスが/sys/block/sdaで始まることを示しています。 +これで私は"udevinfo -a -p /sys/block/sda"を実行できます。 +これらの二つのコマンドは、以下のように連ねることができます。 + +
    # udevinfo -a -p $(udevinfo -q path -n /dev/sda)
    + +注記: 前に示したものには、udevinfoにあらかじめフルパス(/sys/なんとか/パス)を指定していて、今回はこれらのコマンドを連結することでsysfsに関係するパスを指定していることに気が付くかもしれません。 +どちらでも特に問題はありません。どちらのパス形式も受け付けられます。

    +ここでルールの書き方に移り、私の環境での"udevinfo -a -p /sys/block/sda"の実行結果の抜粋を、色づけをして以下に示します。
    + +
    
    +follow the class device's "device"
    +  looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3/3-3:1.0/host0/0:0:0:0':
    +    BUS="scsi"
    +    ID="0:0:0:0"
    +    SYSFS{detach_state}="0"
    +    SYSFS{type}="0"
    +    SYSFS{max_sectors}="240"
    +    SYSFS{device_blocked}="0"
    +    SYSFS{queue_depth}="1"
    +    SYSFS{scsi_level}="3"
    +    SYSFS{vendor}="        "
    +    SYSFS{model}="USB 2.0M DSC    "
    +    SYSFS{rev}="1.00"
    +    SYSFS{online}="1"
    +
    +  looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
    +    BUS="usb"
    +    ID="3-3"
    +    SYSFS{detach_state}="0"
    +    SYSFS{bNumInterfaces}=" 1"
    +    SYSFS{bConfigurationValue}="1"
    +    SYSFS{bmAttributes}="c0"
    +    SYSFS{bMaxPower}="  0mA"
    +    SYSFS{idVendor}="052b"
    +    SYSFS{idProduct}="1514"
    +    SYSFS{bcdDevice}="0100"
    +    SYSFS{bDeviceClass}="00"
    +    SYSFS{bDeviceSubClass}="00"
    +    SYSFS{bDeviceProtocol}="00"
    +    SYSFS{bNumConfigurations}="1"
    +    SYSFS{speed}="12"
    +    SYSFS{manufacturer}="Tekom Technologies, Inc"
    +    SYSFS{product}="USB 2.0M DSC"
    +
    + +udevinfoツールは、udevルールにそのままコピーペーストして使うことができる多くの情報を提供してくれます。 +上記の出力結果に色をつけた理由は、 +通常はudevinfoの出力の異なる箇所からの情報を組み合わせて照合することができないことを示すためです。 +上記の出力結果で、異なる色が付いているセクションの情報を組み合わせることはできません。 - 出力結果の各セクションが、SYSFS内での異なるディレクトリを参照している情報だからです。 +例えば、以下のルールは機能しません。 +
    BUS="scsi", SYSFS{manufacturer}="Tekom Technologies, Inc", NAME="%k"
    このルールは、青いセクションにだけ存在する情報とBUS="scsi"(緑)で始まるセクションにある情報と組み合わさっているので機能しません。 +BUS="usb"と、上記の青いセクションにある情報だけを使用しているならちゃんと機能するでしょう。

    +多くの情報が、基本的なルールの書き方には関係ないことがわかるでしょう(本当にたくさんあります!)。 +一般的には、変更にならないことが分かっている情報(例えばモデル名)を探すべきです。

    + +デバイスを識別するユーザ指定のルールを記述すると、初期設定のdevfs形式のルールが機能しなくなることに注意してください。 +たいていの場合、NAME="%k"を使用するのが賢明で、初期設定の実用的な名前がなくならないように、SYMLINKパラメータに追加の名前を指定してください。

    + +以下にudevinfoの出力を基にしたルールの書き方の手順を三つの例で示します。 +その後、正確な情報を提供するために各デバイス固有の小技やコツをいくつか記述しようと思います。

    + +読者の一人が、KDEのコントロールセンターがルールを書くのに役に立つということを、知らせてきました。 +USBデバイス(やその他)に関する情報が、KDEコントロールセンターの"Info Centre"セクションで見つかるということです。 +このインターフェースは、シリアルナンバー、ベンダIDなどのような情報を表示します。 +GUI的なやり方が好ましいなら、こちらを調査したいと思うでしょう。

    +現在リリースされているGNOMEボリューム管理は、実デバイスとしてシンボリックリンクノードを扱うことができません。 +上記で説明したのとは反対に、NAMEパラメータにユーザ指定の名前を指定して、SYMLINKパラメータに%kを指定しようと思うかもしれません。

    + +複数SYMLINK形式を使えば、ユーザ指定ルールが初期設定を上書きする仕様に対処できます。 + +
    + + +

    複数SYMLINK形式の使い方

    +最近取り入れられた機能の一つに、NAMEを指定せずに、複数のSYMLINKキーを単純に指定するルールが書けるようになったことがあります。 +これで、ユーザ指定ルールがudevの初期設定を実質的に無効にする問題を避けることができます。

    + +そのルールを以下に取り上げます。
    +
    KERNEL="hdc", SYMLINK="dvd"
    +udevはこのルールを見つけると、記憶しておきます。 +そして、NAMEパラメータも含む同一デバイスに一致する別のルールを見つけたときに、そのNAMEパラメータで指定されているノードに加え、両方のルールにあるSYMLINKパラメータで指定されているシンボリックリンクも作成します。
    +実際問題として、udevは私のhdcデバイスのノードを命名する際に、いつものようにブロックデバイス用の初期設定ルールを使い、追加の私個人指定の"dvd"シンボリックリンクを作成します。

    + +普通のルールと同様に、udevがNAMEパラメータを指定しているルールを見つける前にこの形式のルールを見つけたときだけ有効になります。

    + + +

    所有権とパーミッション制御

    +作成されるデバイスノードの名前付け制御と同様に、udevルールは、そのデバイスノードの所有権とパーミッション属性の制御も可能にします。

    + +GROUPキーは、どのunixグループにデバイスノードを所有させるかを定義できます。 +ここにudevの初期設定から例を示します。 +この例は、フレームバッファ(fb)デバイスをvideoグループにするように定義しています。 + +
    KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video"
    + +おそらくあまり使えないOWNERキーは、どのunixユーザにデバイスノードを所有させるかを定義できます。 +フロッピーデバイスを"john"の所有にする場合のちょっと変な状況を仮定すると、次のように使います。 +
    KERNEL="fd[0-9]*", OWNER="john"
    + +上記のルールには、NAMESYMLINKが一つも指定されていないことがわかるでしょう。 +これは、udevが、フロッピーノードをjohnの所有にしたいということを記憶しておき、フロッピーデバイスノードに対するNAMEが定義されたルールを見つけると、所有者を適用する点で、複数シンボリック形式に似ています。

    +上で記述した形式を使用すると、もっと華麗なこともできます。 +udevの初期設定では、すべてのサウンドデバイスノードが"audio"グループによって所有されるように定義するのに以下のルールを使用しています。 +
    SUBSYSTEM="sound", GROUP="audio"
    + +これに続くサウンドデバイスに名前を付ける全てのルールにGROUP="audio"キーをやたらと指定する必要をなくします。

    + +udevのデフォルトでは、unixパーミッションに0660(所有者とグループだけが読み書き可能)を持つノードを作成するようになっています。 +これは、/etc/udev/udev.confの中のdefault_mode設定によって設定されています。 +デバイスノードにデフォルトパーミッションを適用したくない場合もあるかもしれません。幸いにして、ルールにMODE割当てキーを使うことで簡単にデフォルト設定より優先させることができます。 +例として、以下のルールはinotifyノードが全てのユーザに読み書き可能になるように定義しています。 + +
    KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666"
    + + +

    例: 著者所有のUSBプリンタ向けのルールの書き方

    +私は、プリンタを接続した後、ルールを書くために/sysディレクトリから関連する位置を探し始めました。 +どこにも見つからなかったのですが、私のプリンタにデバイスノード/dev/lp0が割り当てられていることに気づきました。 +udevinfoは、便利なpathを指定すると以下のように教えてくれます。 +
    # udevinfo -q path -n /dev/lp0
    +/class/usb/lp0
    +
    +"udevinfo -a -p /sys/class/usb/lp0"を実行すると、通常通りに多くの情報を提供してくれます。 +デバイスを識別する以下の固有の情報を選択しました。 +
    looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
    +BUS="usb"
    +SYSFS{manufacturer}="EPSON"
    +SYSFS{product}="USB Printer"
    +SYSFS{serial}="L72010011070626380"
    +
    + +この場合のudevルールは以下のようになります。 +
    BUS="usb", SYSFS{serial}="L72010011070626380", NAME="%k", SYMLINK="epson_680"
    + +そうすると、私のプリンタのノードは/dev/lp0(または、別のプリンタが前もって接続されている場合は/dev/lp1)で存在し、/dev/epson_680常にそのプリンタのためのデバイスノードを指します。

    + + +

    例: 著者所有のUSBストレージ方式対応デジカメ向けのルールの書き方

    + +簡単な説明: 私のカメラは外付けSCSIハードディスクとして認識されます(USBハードディスクやフラッシュメモリカードリーダのようなデバイスにも使用されるusb-strageドライバを使います)。 +そして、そのディスク上のパーティションをマウントして、画像ファイルをコピーできます。すべてのカメラがこのように動作するわけではありません。ほとんどのカメラは、画像ファイルを扱うために、さらにソフトウェア(gphoto2など)を必要とします。

    + +これにはちょっとしたコツがあります。私のカメラが接続されると、デフォルトでいくつかのノードが作成されます。 +/dev/sda/dev/sda1/dev/sg1さえも作成されるかもしれません。 +この例が示しているものは重要です。もしルールが上手に指定されなければ、上記3つのノードすべてに一致することがありえます。

    + +sda1は、私がマウント用に/dev/cameraとして使用しようと思うノードです。 +udevinfoはsda、sda1、sg1の間に利用できそうな差異は何も提示してくれません。 +これら3つのノードを区別するために信頼できる方法は、KERNEL名を見ることであると私は判断しました。

    + +KERNEL="sd?1"のようなキーは、"sda1"、"sda1"、"sdc1"のようなKERNEL名に一致し、そして同様に重要なことに、それは、sda、sdb、sg1のようなKERNEL名に一致しないであろうということです。 +このようなキー指定には、/dev/sda/dev/sg1ノードに一致させないという目的があります。 +対象のデバイスはデジタルカメラです。その上ではfdiskやその類の操作をしようなんて夢にも思わないので、私にとってこれらの2つのノードは、まったく使いものになりません。 +このキーは/dev/sda1ノードを捕捉しようとします。これはマウント可能なので、使いものになります!

    + +このノード(sda1)は、ブロックデバイスとして扱われるので、/sys/blockから探すことは、作業を始めるのに向いています。

    + +私の環境での/sys/blockには、sdaというディレクトリがあります。 +/sys/block/sdaには、sda1というディレクトリがあります。 +これら両方のディレクトリにdevファイルがあるので、そこでudevinfoを実行できます。 +以下を実行すると、私のカメラとそれが接続されているUSBポートに関するたくさんの情報を表示してくれます。 + +
    # udevinfo -a -p /sys/block/sda/sda1
    + +udevinfoの出力に、以下のちょっと役に立つ意味がわかりやすい情報を見つけました。
    SYSFS{product}="USB 2.0M DSC"
    + +よってこれで私のルールを書くことができます。ルールを完全にするために、BUSキーも加えます(これもudevinfoの出力で見つかります)。 +
    BUS="usb", SYSFS{product}="USB 2.0M DSC", KERNEL="sd?1", NAME="%k", SYMLINK="camera"
    + +こうして、私のカメラを接続すると、/dev/sda1(もしくは、sda1が利用できないなら、/dev/sdb1になるかもしれません)という名前で、常に間違いなく/dev/cameraからリンクされます。 +/dev/sda(もしくはsdb)ノードは、いつものようにまだ出現します。 +しかし私が指定する不変の"camera"シンボリックが、マウント可能パーティションを指しているということが重要です。

    + + +

    USBストレージ向けルールの書き方に関する追記

    + +大容量のUSBハードディスクを所持するCarl Streeterが、/dev/sdaノードが役に立たなかった私のデジタルカメラの例とは違った説明をメールしてきました。 +/dev/sdaのようなノード上でfdiskhdparmなどのツールをちょくちょく使う必要があることを指摘しています。

    + +以下にCarlのルールを示します。 +
    BUS="usb", KERNEL="sd*", SYSFS{product}="USB 2.0 Storage Device", NAME="%k", SYMLINK="usbhd%n"
    + +このルールは、以下のようなシンボリックリンクを作成します。 +
      +
    • /dev/usbhd - fdiskすることができるノード
    • +
    • /dev/usbhd1 - 一つ目のパーティション (マウント可能)
    • +
    • /dev/usbhd2 - 二つ目のパーティション (マウント可能)
    • + +
    +Carlとはマウント不可の/dev/sdaノードが必要かどうかは、状況と対象のデバイスに依存するということで共通認識を持っています。 +どちらの設定方法にしろ都合のよい方を使用してください。

    +これとは別の複雑な状況として、複数のスロットを持つUSBストレージカードリーダを持っている場合があります。 +新しいカードが刺されたり抜かれたりしたときに、一般的にこのような種類のデバイスはその情報を通知しません。 +よって、リーダが接続されている間に未使用スロットにカードを刺しても、マウントする必要がある追加のデバイスノードは、作成されないでしょう!
    +この問題は、他のUSBディスクにも当てはまります。 +例えば、新しいパーティションを作成した場合、デバイスを再接続するまで、新しいパーティションノードは出現しないでしょう。

    +udevは、これに対する一つの解決方法を提供します。 +ブロックデバイスのすべてのパーティション用のノードを作成することができます。 +指定したすべてのルールに対して、ブロックデバイスで16個のパーティションノードを作成します。 +これをするには、以下に示すように単にNAMEキーを修正します。
    + +
    BUS="usb", SYSFS{product}="USB 2.0 Storage Device", NAME{all_partitions}="usbhd"
    + +こうすることで、usbhd、usbhd1、usbhd2、usbhd3、...、usbhd15というノードが作成されるでしょう。

    + + +

    例: 著者所有のCDドライブ向けの有用なルールの書き方

    +私のPCには二つのCDドライブがあります。一つは、DVD読み込み対応で、一つはCD読み書き対応のものです。 +DVDのノードはhdcで、CDRWのノードはhddです。 +あえてシステムの結線を変更する場合を除いて、これを変更するつもりはありません。

    + +でも、利便性のために/dev/dvd/dev/cdrwのようなノードを好む人が(私自身も含めて)います。 +これらドライバの"hdX"の値がわかっているので、ルールを書くのは簡単です。 +以下の例は、それだけで自明でしょう。 +
    BUS="ide", KERNEL="hdc", NAME="%k", SYMLINK="dvd cdroms/cdrom%n"
    +BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n"
    +
    + +デフォルトの50-udev.rulesファイルにブロックデバイス用の名前を生成するスクリプトを実行するルールがあることに気が付くかもしれません。 +これに惑わされないでください。やはりユーザ指定のルールは、デフォルトルールの前に処理されるファイルに設定するので、デフォルト設定は、ルールを設定済みのハードウェアに名前をつけるときには使用されません。

    + + +

    例: USB Visor Palm Pilot向けのルールの書き方

    + +これらのデバイスは、USBシリアルデバイスのように動作します。よってデフォルトではttyUSB1ノードだけが得られます。 +ユーザスペースのpalmユーティリティは、/dev/pilotがあることを前提としています。 +よってそのノードを作成するルールを使う必要があります。 +以下のルールはこれを行います。

    + +
    BUS="usb", SYSFS{product}="Palm Handheld", KERNEL="ttyUSB*", SYMLINK="pilot"
    + +この状況に関する有用な議論があるCarsten Clasohm's blog entry(訳注: Carsten Clasohmのブロブ)から応用しました。 +さらに個々の設定に合わせるために、上記ルールに所有権とパーミッションキーを追加したいと思うかもしれません。

    + + +

    例: 著者所有のネットワークインターフェースに名前を付けるルールの書き方

    +最近のバージョンのudevにある興味深い新しい機能に、nameifユーティリティのように、ネットワークインタフェースの名前を付け直す機能があります。 +ネットワークインターフェースは、/devに出現しませんが、一般的にはそれらは名前によって参照されます(例えば、ifconfigで使用される場合)。 +ネットワークデバイスには様々ありますが、ルールを書く工程はほとんど同じです。

    +やはりudevinfoはルールを書く手がかりになります。 +以下は私の"eth0"のネットワークデバイスの名前を変更したい場合の例です(以下の出力結果は省略されています)。 +
    # udevinfo -a -p /sys/class/net/eth0/
    +  looking at class device '/sys/class/net/eth0':
    +    SYSFS{address}="00:52:8b:d5:04:48"
    +
    +すべてのネットワークアダプタには固有のMACアドレスがありますので、ルールを書く場合にはこれを使うことを選択しました。 +この値は、ネットワークカードを変更しない限り変更がありません。 +以下に一つ警告があります。 +大文字小文字を区別しますので、必ず(上記のように)udevinfoから取得したMACアドレスを使ってください。 +ifconfigのようなユーティリティを使う場合は、それらは大文字を使うので、気をつけてください。

    + +ルールの例を以下に示します。 +
    KERNEL="eth*", SYSFS{address}="00:52:8b:d5:04:48", NAME="lan"
    +このルールを有効にするためにネットワークドライバをリロードしなければならないでしょう。 +モジュールをアンロードして再度ロードするか、もしくは単にシステムをリブートすればよいです。 +"eth0"ではなく"lan"を使うようにシステムを構成しなおす必要もあります。 +私の場合、eth0を参照するものすべてを完全に削除しないで、これを進めてしまい、少々苦労をしました。
    +これが完了すれば、ifconfigやそれに似たユーティリティのどれにでも"eth0"の代わりに"lan"を使えるはずです。

    + + +

    SYSFS内におけるudevinfoを実行すべき場所を探すためのコツ

    +ここではより多くのデバイス固有のコツを求めています。 +提供できることならなんでも連絡してください + +
      +
    • ルールを書こうとしているデバイスに対し、すでに/devの下にデバイスノードが作成されているなら、運がよいです! +適切な/sysのパスを得るために、次のコマンドを実行してください。udevinfo -q path -n /dev/ノード名
    • +
    • ルールを書く手間を軽くするために、常にudevinfoを使用してください。 +/sys/blockや/sys/classの下を参照するために、常にudevinfoを使用してください(別のところから、チェイン情報を読むことはありません)。
    • +
    • 何も手がかりがなければ、/sysの下のすべて"dev"ファイルを探すために、次のコマンドを使用してくだい(udevinfoは、このファイルがあるディレクトリ上でのみ動作します。)。find /sys -iname dev
    • +
    • 対象のデバイスが、フラッシュカードリーダや、USBフラッシュドライブ、/dev/sdXが作成されるUSBストレージとして振舞うデジタルカメラの場合、/sys/block/sdXを探してみてください。
    • +
    • 上記の状況に該当する場合、必ずsdXとsdX1とを区別して下さい。sdX1に一致するキーKERNEL="sd?1"もしくは、sdXに一致するKERNEL="sd?"で区別できます。
    • +
    • /dev/lpXとして作成されるUSBプリンタについては、/sys/class/usb/lpXから探すべきです。
    • + +
    • USBスキャナドライバは、最近カーネルから削除され、(SANEパッケージの一部として)ユーザスペースで再実装されました。 +特定のカーネルドライバに依存しないように、この種のハードウェア用のルールを書いてはいけません(し、書けないでしょう)。
    • +
    • あいにくカーネルはsysfsですべてのデバイスの情報を開示するわけではありません。 +よって、まだ一部のデバイスに対してはルールを簡単に書くことができません。 +2004年2月20日時点で、udevの作者はsysfsに未対応のドライバが162個残っていると言っています。
    • +
    + + +

    ルールのデバッグ方法

    + +ルールを書き終わって忘れずにudevstartを実行しても、有効にならないなら、それをデバッグするのには二つの方法があります。

    + +/etc/udev/udev.confには、udev_logオプションがあります。 +そのオプションをyesに設定すると、udevはどのノードにどのルールを適用したかに関するいくつかの役に立つ情報をシステムロガーに出力します。 +そのログ情報は、ほとんどの場合/var/log/messagesにあるでしょう。

    + +さらに、ユーザが作成したいノードのsysfsにおけるパスを調べたいなら、ノードに対しudevがするはずであったことを一つずつ追って確認するために、udevtestを使用できます。 +以下に例を示します。 + +
    # udevtest /sys/class/sound/dsp/
    +version 056
    +looking at '/class/sound/dsp/'
    +opened class_dev->name='dsp'
    +configured rule in '/etc/udev/rules.d/50-udev.rules[132]' applied, added symlink '%k'
    +configured rule in '/etc/udev/rules.d/50-udev.rules[132]' applied, 'dsp' becomes 'sound/%k'
    +creating device node '/dev/sound/dsp', major = '14', minor = '3', mode = '0660', uid = '0', gid = '18'
    + +udevtestは、デバッグ/テストだけをするツールです。たとえ作成しているように表示しても、実際にはデバイスノードを作成しません!

    + + +

    著者と謝辞

    +この文書はDaniel Drake <dan@reactivated.net>
    によって書かれました。 +ご意見ご感想などなんなりと送ってください!

    + +Copyright (C) 2003-2005 Daniel Drake
    +この文書はGNU General Public License, Version 2の下に公開されています。 + + \ No newline at end of file -- cgit v1.2.3-54-g00ecf From b479b4887f5a0eb69b801645ab1b14636c4b06a2 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Wed, 18 May 2005 23:32:28 -0700 Subject: Fix libsysfs issue with relying on the detach_state file to be present in order to traverse the tree properly. Based on a patch from Daniel Stekloff Signed-off-by: Greg Kroah-Hartman --- libsysfs/sysfs_device.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index d1c5b321f0..1c59403edd 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -383,7 +383,7 @@ struct sysfs_device *sysfs_open_device(const char *bus, const char *bus_id) */ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) { - char ppath[SYSFS_PATH_MAX], *tmp; + char ppath[SYSFS_PATH_MAX], dpath[SYSFS_PATH_MAX], *tmp; if (!dev) { errno = EINVAL; @@ -394,6 +394,7 @@ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) return (dev->parent); memset(ppath, 0, SYSFS_PATH_MAX); + memset(dpath, 0, SYSFS_PATH_MAX); safestrcpy(ppath, dev->path); tmp = strrchr(ppath, '/'); if (!tmp) { @@ -410,16 +411,14 @@ struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) } *tmp = '\0'; - /* - * All "devices" have the "detach_state" attribute - validate here - */ - safestrcat(ppath, "/detach_state"); - if (sysfs_path_is_file(ppath)) { + /* Make sure we're not at the top of the device tree */ + sysfs_get_mnt_path(dpath, SYSFS_PATH_MAX); + safestrcat(dpath, "/" SYSFS_DEVICES_NAME); + if (strcmp(dpath, ppath) == 0) { dprintf("Device at %s does not have a parent\n", dev->path); return NULL; } - tmp = strrchr(ppath, '/'); - *tmp = '\0'; + dev->parent = sysfs_open_device_path(ppath); if (!dev->parent) { dprintf("Error opening device %s's parent at %s\n", -- cgit v1.2.3-54-g00ecf From 13ca17798cd69dd384ddade607ae3a9878622965 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Wed, 18 May 2005 23:33:12 -0700 Subject: remove detach_state files from the sysfs test tree. Signed-off-by: Greg Kroah-Hartman --- test/sys/devices/pci0000:00/0000:00:09.0/detach_state | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state | 1 - 6 files changed, 6 deletions(-) delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/detach_state delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/detach_state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/detach_state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/detach_state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/detach_state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/detach_state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/detach_state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/detach_state +++ /dev/null @@ -1 +0,0 @@ -0 -- cgit v1.2.3-54-g00ecf From 8d9e468f125ae28d7cd6a0545ecb2a67311cdc1a Mon Sep 17 00:00:00 2001 From: Greg KH Date: Wed, 18 May 2005 23:34:45 -0700 Subject: Update Red Hat default udev rules. Signed-off-by: Greg Kroah-Hartman --- etc/udev/redhat/udev.rules | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index ad60d1a81d..2d4819f8c3 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -119,7 +119,7 @@ KERNEL=="vttuner", MODE="0660" KERNEL=="v4l/*", MODE="0660" # input devices -KERNEL=="input/*", MODE="0644" +KERNEL=="input/*", MODE="0660" # gpm devices KERNEL=="gpmctl", MODE="0700" @@ -195,8 +195,18 @@ KERNEL=="sr[0-9]*", SYMLINK="cdrom%e" KERNEL=="scd[0-9]*", SYMLINK="cdrom%e" KERNEL=="pcd[0-9]*", SYMLINK="cdrom%e" KERNEL=="fd[0-9]*", SYMLINK="floppy%e" -KERNEL=="nst[0-9]", SYMLINK="tape%e" -KERNEL=="nosst[0-9]*", SYMLINK="tape%e" +KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK="tape%e" +KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK="tape%e" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" + +# Section for zaptel device +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" # do not seperate the next 2 lines!! KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/ide-media.sh %k", RESULT=="floppy", SYMLINK="floppy%e", NAME{ignore_remove, all_partitions}="%k" -- cgit v1.2.3-54-g00ecf From 539876083d15cef50f284f54a6b0cd6b7c911afa Mon Sep 17 00:00:00 2001 From: Greg KH Date: Wed, 18 May 2005 23:37:22 -0700 Subject: add Red Hat/Fedora html documenation Signed-off-by: Greg Kroah-Hartman --- docs/fedora_udev.html | 258 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 docs/fedora_udev.html diff --git a/docs/fedora_udev.html b/docs/fedora_udev.html new file mode 100644 index 0000000000..5d5048766d --- /dev/null +++ b/docs/fedora_udev.html @@ -0,0 +1,258 @@ + + + + + Fedora Project, sponsored by Red Hat + + + + + + + + + + + +
    + + +
    + +  Download +  Projects +  FAQ +
    +
    + +
    + + + +
    +
    Site Navigation:
    +
    + + + + +
    +
     
    +
     
    +
    + +

    Udev on Fedora

    +

    by Harald Hoyer

    +

    + This document tries to reveal the secrets of udev and how it works on Fedora. +

    +

    + udev was developed by Greg Kroah-Hartman <greg@kroah.com> with much + help from Dan Stekloff <dsteklof@us.ibm.com>, Kay Sievers <kay.sievers@vrfy.org>, + and many others. +

    +

    + The udev homepage and the + Linux-hotplug-devel mailing list https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel are the main development sources. +

    +

    + +

    What Does Udev Do?

    +

    + udev provides a dynamic device directory containing only the files for + actually present devices. It creates or removes device node files usually + located in the /dev/ directory, or it renames network interfaces. +

    + As part of the hotplug subsystem, udev is executed if a kernel device + is added or removed from the system. On device creation, udev reads + the sysfs directory of the given device to collect device attributes + like label, serial number or bus device number. These attributes may + be used as keys to determine a unique name for the device. udev maintains + a database for devices present on the system. + On device removal, udev queries its database for the name of the device + file to be deleted. +

    + udev gets called by hotplug, if a module is loaded, and a device is added + or removed. udev looks in /sys/, if the driver provides a "dev" file, which + contains the major and minor number for a device node to communicate with + the driver. After looking in the udev rules (in the /etc/udev/rules.d/ directory), which + specify the device node filename and symlinks, a device node is created + in /dev/ with the permissions, which are specified in /etc/udev/permissions.d/. +

    + After device node creation, removal, or network device renaming, udev + executes the programs in the directory tree under /etc/dev.d/. The + name of a program must end with the .dev suffix, to be recognized. + In addition to the hotplug environment variables, DEVNAME is exported + to make the name of the created node or the name the network device is + renamed to, available to the executed program. The programs in every + directory are sorted in lexical order, while the directories are + searched in the following order: +
      +
    • /etc/dev.d/$(DEVNAME)/*.dev
    • +
    • /etc/dev.d/$(SUBSYSTEM)/*.dev
    • +
    • /etc/dev.d/default/*.dev
    • +
    + +

    How is Udev Integrated on Fedora?

    +

    initrd / initfs

    +

    + mkinitrd copies /sbin/udev.static + to the initrd /sbin/udev and symlinks it to + /sbin/udevstart. +

    +After the kernel boots, it executes the nash script of the initrd. This +mounts a tmpfs filesystem on /dev/. Instead of hotplug /sbin/udev is +called in the initrd phase. udevstart creates all device nodes for the +devices, which are compiled in the kernel and for the modules, which +are loaded by nash.

    + +

    Problems

    + +The whole udev and hotplug infrastructure is +not available in initrd. Thus no hotplug scripts, udev rules, and +permissions and no /etc/dev.d/ scripts are executed for any hotplug +event, which is sent from the kernel. + +

    rc.sysinit

    +

    First, if SELinux is loaded and enabled, +the context of /dev/ is set. rc.sysinit calls /sbin/start_udev. +start_udev mounts a tmpfs filesystem on /dev/, if there is none already +mounted. Then it creates some device nodes, which need module +autoloading, or where there is no kernel module. After that +/sbin/udevstart is called again, which simulates the hotplug events in +the initrd phase, to apply the whole udev rules and permissions. After +that rc.sysinit parses the ouput of /sbin/kmodule and loads every +module. This should provide device nodes for all hardware found on your +computer.

    +

    Console User Permissions

    +

    +/etc/dev.d/default/pam_console.dev is called whenever a device node is +created and calls /sbin/pam_console_setowner with the filename (and an +optional symlink) of the device node. This sets the permissions for +console users like specified in /etc/security/console.perms.

    +

    Customizing Udev on Fedora

    +

    + Read the manpage of udev and udevinfo. + Please try not to modify the files of RPM packages. +

    +

    New Rules

    +

    +New rules should be placed in a file, which ends in .rules in +/etc/udev/rules.d/. Please do not use 50-udev.rules. The supported and +preferred way is to create rules without the "NAME" tag and only +create "SYMLINK"s.

    + A nice document describing how to write rules can be found on http://www.reactivated.net/udevrules.php. +

    + +

    Permissions

    +New permissions should be placed in a file, which ends in +.permissions in /etc/udev/permissions.d/. Please do not use +50-udev.permissions. + +

    But I Really Want My Device Node!

    +

    + Put them in /etc/udev/devices/, and they will get copied to /dev/. File a bugzilla entry, if you think that should be done per default. +

    + +

    Updating to udev Without /dev/

    +

    + The steps to upgrade without Anaconda or a rescue CD are (NOT recommended): +

    + +
      +
    • start from a kernel-2.6 +
    • Make sure /sys/ is mounted +
    • Install the latest initscripts package +
    • Install the latest udev package +
    • Execute /sbin/start_udev +
    • Install the latest mkinitrd package +
    • Install the latest kernel package +
    • Or execute mkinitrd for your existing kernel(s) +
    + +

    Udev without initrd

    + +

    Install Fedore Core as usual and reboot. Execute the following commands +

    + +
    +
    +mkdir /tmp/dev
    +mount --move /dev /tmp/dev
    +sbin/MAKEDEV null console zero
    +mount --move /tmp/dev /dev
    +
    + Install your kernel without an initrd. Reboot. +

    + You will get some SELinux errors, and syslogd will not work as expected. +

    +

    Current Problems on Fedora

    +

    + All open bugs for udev +

    +

    Nvidia

    +

    Quick solution: If you do not need rhgb, just load the nvidia module in /etc/rc.local +

    + If you have udev >= 032-5, load the nvidia module: +

    +
    +
    +cp -a /dev/nvidia* /etc/udev/devices
    +chown root.root /etc/udev/devices/nvidia*
    +
    + +

    The Bugzilla for this problem is 133900.

    +

    Palm Pilot

    +

    + If you have udev >= 032-5, execute the command: +

    +
    +
    +ln -s ttyUSB1 /etc/udev/devices/pilot
    +
    + +

    ISDN

    +

    + If you have udev >= 032-5: +

    +
    +
    +/sbin/MAKEDEV -d /etc/udev/devices isdn
    +
    + + + + + +
    +
     
    +
     
    +
    + + + + + + + + -- cgit v1.2.3-54-g00ecf From d514329ee2d5614078649a425674d83e0211c1b9 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Thu, 19 May 2005 22:24:38 +0100 Subject: [PATCH] update cdsymlinks to latest version diff -ur udev-057.orig/extras/cdsymlinks.c udev-057/extras/cdsymlinks.c --- extras/cdsymlinks.c | 149 ++++++++++++++++++++++++++++--------------------- extras/cdsymlinks.conf | 11 +++- extras/cdsymlinks.sh | 50 ++++++++++++----- 3 files changed, 131 insertions(+), 79 deletions(-) diff --git a/extras/cdsymlinks.c b/extras/cdsymlinks.c index 2889ff446c..b6bc96dc6f 100644 --- a/extras/cdsymlinks.c +++ b/extras/cdsymlinks.c @@ -11,7 +11,12 @@ * BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" * (this last one is "just in case") * - * (c) 2004 Darren Salt + * (c) 2004, 2005 Darren Salt + * + * Contributors: + * - J A Magallon (bug fixes) + * + * Last modified: 2005-02-15 */ #define _GNU_SOURCE @@ -56,6 +61,7 @@ struct list_t { /* Configuration variables */ static struct list_t allowed_output = {0}; static int numbered_links = 1; +static int link_zero = 0; /* Available devices */ static struct list_t Devices = {0}; @@ -65,14 +71,40 @@ static struct list_t Devices = {0}; */ static struct list_t cap_DVDRAM = {0}, cap_DVDRW = {0}, cap_DVD = {0}, cap_CDRW = {0}, cap_CDR = {0}, cap_CDWMRW = {0}, - cap_CDMRW = {0}; + cap_CDMRW = {0}, cap_CDRAM = {0}; /* Device capabilities by name */ static struct list_t dev_DVDRAM = {0}, dev_DVDRW = {0}, dev_DVD = {0}, dev_CDRW = {0}, dev_CDR = {0}, dev_CDWMRW = {0}, - dev_CDMRW = {0}; + dev_CDMRW = {0}, dev_CDRAM = {0}; #define dev_CD Devices +typedef struct { + struct list_t *cap, *dev; + const char label[8], symlink[8]; + const char *captext; + int captextlen; +} cap_dev_t; + +#define CAPDEV(X) &cap_##X, &dev_##X + +static const cap_dev_t cap_dev_info[] = { + { NULL, &dev_CD, "CD", "cdrom", NULL, 0 }, + { CAPDEV(CDR), "CDR", "cd-r", "Can write CD-R:", 15 }, + { CAPDEV(CDRW), "CDRW", "cdrw", "Can write CD-RW:", 16 }, + { CAPDEV(DVD), "DVD", "dvd", "Can read DVD:", 13 }, + { CAPDEV(DVDRW), "DVDRW", "dvdrw", "Can write DVD-R:", 16 }, + { CAPDEV(DVDRAM), "DVDRAM", "dvdram", "Can write DVD-RAM:", 18 }, + { CAPDEV(CDMRW), "CDMRW", "cdm", "Can read MRW:", 13 }, /* CDC-MRW R */ + { CAPDEV(CDWMRW), "CDWMRW", "cdmrw", "Can write MRW:", 14 }, /* CDC-MRW W */ + { CAPDEV(CDRAM), "CDRAM", "cdram", "Can write RAM:", 14 }, /* CDC-RAM W */ + { NULL } +}; + +#define foreach_cap_dev(loop) \ + for ((loop) = cap_dev_info; (loop)->label[0]; ++(loop)) +#define foreach_cap_dev_noCD(loop) \ + for ((loop) = cap_dev_info + 1; (loop)->label[0]; ++(loop)) /* * Some library-like bits first... @@ -218,7 +250,7 @@ static void list_assign_split (struct list_t *list, char *text) { char *token = strchr (text, ':'); - token = strtok (token ? token + 1 : text, " \t"); + token = strtok (token ? token + 1 : text, " \t\n"); while (token) { list_prepend (list, token); @@ -267,8 +299,10 @@ read_defaults (void) list_delete (&allowed_output); list_assign_split (&allowed_output, p.we_wordv[0] + 7); } - else if (!strncmp (p.we_wordv[0], "NUMBERED_LINKS=", 14)) - numbered_links = atoi (p.we_wordv[0] + 14); + else if (!strncmp (p.we_wordv[0], "NUMBERED_LINKS=", 15)) + numbered_links = atoi (p.we_wordv[0] + 15); + else if (!strncmp (p.we_wordv[0], "LINK_ZERO=", 15)) + link_zero = atoi (p.we_wordv[0] + 15); break; } /* fall through */ @@ -315,20 +349,16 @@ populate_capability_lists (void) { if (!strncasecmp (text, "drive name", 10)) list_assign_split (&Devices, text); - else if (!strncasecmp (text, "Can write DVD-RAM", 17)) - list_assign_split (&cap_DVDRAM, text); - else if (!strncasecmp (text, "Can write DVD-R", 15)) - list_assign_split (&cap_DVDRW, text); - else if (!strncasecmp (text, "Can read DVD", 12)) - list_assign_split (&cap_DVD, text); - else if (!strncasecmp (text, "Can write CD-RW", 15)) - list_assign_split (&cap_CDRW, text); - else if (!strncasecmp (text, "Can write CD-R", 14)) - list_assign_split (&cap_CDR, text); - else if (!strncasecmp (text, "Can read MRW", 14)) - list_assign_split (&cap_CDMRW, text); - else if (!strncasecmp (text, "Can write MRW", 14)) - list_assign_split (&cap_CDWMRW, text); + else + { + const cap_dev_t *cap; + foreach_cap_dev_noCD (cap) + if (!strncasecmp (text, cap->captext, cap->captextlen)) + { + list_assign_split (cap->cap, text); + break; + } + } } if (!feof (info)) errexit ("error accessing CD/DVD info"); @@ -341,7 +371,8 @@ populate_capability_lists (void) * taking into account existing links and the capability list for type LINK. */ static void -do_output (const char *name, const char *link, const struct list_t *dev) +do_output (const char *name, const char *link, const struct list_t *dev, + int do_link_zero) { const struct list_item_t *i = (const struct list_item_t *)dev; if (!i->next) @@ -406,6 +437,8 @@ do_output (const char *name, const char *link, const struct list_t *dev) /* Existing symlink found - don't output a new one. * If ISDEV, we output the name of the existing symlink. */ + if (do_link_zero) + return; present = 1; if (isdev) printf (" %s", list_nth (&devls, li)->data); @@ -415,14 +448,19 @@ do_output (const char *name, const char *link, const struct list_t *dev) if (!present) { char buf[256]; - snprintf (buf, sizeof (buf), count ? "%s%d" : "%s", link, count); + snprintf (buf, sizeof (buf), count || do_link_zero ? "%s%d" : "%s", + link, count); /* Find the next available (not present) symlink name. * We always need to do this for reasons of output consistency: if a * symlink is created by udev as a result of use of this program, we * DON'T want different output! */ while (list_search (&devls, buf)) + { + if (do_link_zero) + return; snprintf (buf, sizeof (buf), "%s%d", link, ++count); + } /* If ISDEV, output it. */ if (isdev && (numbered_links || count == 0)) printf (" %s", buf); @@ -431,6 +469,8 @@ do_output (const char *name, const char *link, const struct list_t *dev) */ if (!list_search (&devls, buf)) { + if (do_link_zero) + return; list_append (&devls, buf); ++count; } @@ -458,6 +498,8 @@ populate_device_list (struct list_t *out, const struct list_t *caps) int main (int argc, char *argv[]) { + const cap_dev_t *capdev; + progname = argv[0]; debug = argc > 2 && !strcmp (argv[2], "-d"); @@ -470,62 +512,43 @@ main (int argc, char *argv[]) read_defaults (); populate_capability_lists (); - /* Construct the device lists from the capability lists. */ - populate_device_list (&dev_DVDRAM, &cap_DVDRAM); - populate_device_list (&dev_DVDRW, &cap_DVDRW); - populate_device_list (&dev_DVD, &cap_DVD); - populate_device_list (&dev_CDRW, &cap_CDRW); - populate_device_list (&dev_CDR, &cap_CDR); - populate_device_list (&dev_CDWMRW, &cap_CDWMRW); - populate_device_list (&dev_CDMRW, &cap_CDMRW); - /* (All devices can read CDs.) */ + /* Construct the device lists from the capability lists. + * (We assume that all relevant devices can read CDs.) + */ + foreach_cap_dev_noCD (capdev) + populate_device_list (capdev->dev, capdev->cap); if (debug) { -#define printdev(DEV) \ - printf ("%-7s:", #DEV); \ - list_print (&cap_##DEV, stdout); \ - list_print (&dev_##DEV, stdout); \ - puts (""); - printf ("Devices:"); const struct list_item_t *item = (const struct list_item_t *)&Devices; while ((item = item->next) != NULL) printf (" %s", item->data); - puts (""); - printdev (DVDRAM); - printdev (DVDRW); - printdev (DVD); - printdev (CDRW); - printdev (CDR); - printdev (CDWMRW); - printdev (CDMRW); - - printf ("CDROM : (all)"); + printf ("\nCDROM : (all)"); item = (const struct list_item_t *)&dev_CD; while ((item = item->next) != NULL) printf (" %s", item->data); puts (""); + + foreach_cap_dev_noCD (capdev) + { + printf ("%-10s:", capdev->label); + list_print (capdev->cap, stdout); + list_print (capdev->dev, stdout); + puts (""); + } + } /* Write the symlink names. */ - if (list_search (&allowed_output, "CD")) - do_output (argv[1], "cdrom", &dev_CD); - if (list_search (&allowed_output, "CDR")) - do_output (argv[1], "cd-r", &dev_CDR); - if (list_search (&allowed_output, "CDRW")) - do_output (argv[1], "cdrw", &dev_CDRW); - if (list_search (&allowed_output, "DVD")) - do_output (argv[1], "dvd", &dev_DVD); - if (list_search (&allowed_output, "DVDRW")) - do_output (argv[1], "dvdrw", &dev_DVDRW); - if (list_search (&allowed_output, "DVDRAM")) - do_output (argv[1], "dvdram", &dev_DVDRAM); - if (list_search (&allowed_output, "CDMRW")) - do_output (argv[1], "cdmrw", &dev_CDMRW); - if (list_search (&allowed_output, "CDWMRW")) - do_output (argv[1], "cdwmrw", &dev_CDWMRW); + foreach_cap_dev (capdev) + if (list_search (&allowed_output, capdev->label)) + { + do_output (argv[1], capdev->symlink, capdev->dev, 0); + if (link_zero) + do_output (argv[1], capdev->symlink, capdev->dev, 1); + } puts (""); return 0; diff --git a/extras/cdsymlinks.conf b/extras/cdsymlinks.conf index e50a2e6082..e4c5ee2231 100644 --- a/extras/cdsymlinks.conf +++ b/extras/cdsymlinks.conf @@ -1,8 +1,13 @@ # Configuration file for cdsymlinks # Output links for these types of devices. -# Allowed keywords are CD, CDR, CDRW, DVD, DVDRW, DVDRAM, CDMRW, CDWMRW. +# Allowed keywords are: corresponding to device names: +# CD CDR CDRW cdrom cd-r cdrw +# DVD DVDRW DVDRAM dvd dvdrw dvdram +# CDMRW CDWMRW cdm cdmrw +# CDRAM cdram # Other words are accepted but ignored. +# Devices with multiple recognised capabilities WILL get multiple links. #OUTPUT="CD CDRW DVD DVDRW DVDRAM" # Whether to output numbered links. @@ -10,3 +15,7 @@ # 0 = don't output 'cdrom1', 'dvd1' etc. # We always output 'cdrom', 'dvd' etc. for the best-match devices. #NUMBERED_LINKS=1 + +# Whether to output link 0 along with each unnumbered link. +# (No effect if NUMBERED_LINKS=0.) +#LINK_ZERO=0 diff --git a/extras/cdsymlinks.sh b/extras/cdsymlinks.sh index b2702e0063..592de365cb 100644 --- a/extras/cdsymlinks.sh +++ b/extras/cdsymlinks.sh @@ -1,6 +1,7 @@ #! /bin/sh -e # -# Map cdrom, cdm, cdmrw, cd-r, cdrw, dvd, dvdrw, dvdram to suitable devices. +# Map cdrom, cd-r, cdrw, dvd, dvdrw, dvdram, cdm, cdmrw, cdram +# to suitable devices. # Prefers cd* for DVD-incapable and cdrom and dvd for read-only devices. # First parameter is the kernel device name. # Second parameter, if present, must be "-d" => output the full mapping. @@ -11,13 +12,16 @@ # BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" # (this last one is "just in case") # -# (c) 2004 Darren Salt +# (c) 2004, 2005 Darren Salt +# +# Last modified: 2005-02-15 test -e /proc/sys/dev/cdrom/info || exit 0 # Defaults; it's better that you alter them in /etc/udev/cdsymlinks.conf OUTPUT='CD CDRW DVD DVDRW DVDRAM' NUMBERED_LINKS=1 +LINK_ZERO=0 test -e /etc/udev/cdsymlinks.conf && . /etc/udev/cdsymlinks.conf @@ -61,6 +65,7 @@ setArray CDRWs `sed -re '/^Can write CD-RW:/I! d; s/.*://' /proc/sys/dev/cdr setArray CDRs `sed -re '/^Can write CD-R:/I! d; s/.*://' /proc/sys/dev/cdrom/info` setArray CDMRWs `sed -re '/^Can write MRW:/I! d; s/.*://' /proc/sys/dev/cdrom/info` setArray CDMs `sed -re '/^Can read MRW:/I! d; s/.*://' /proc/sys/dev/cdrom/info` +setArray CDRAMs `sed -re '/^Can write RAM:/I! d; s/.*://' /proc/sys/dev/cdrom/info` # How many devices do we have? NumDevs=$(($DEVICES-1)) @@ -80,6 +85,7 @@ for i in $Count; do test "`ix CDRs $i`" != '' || ixs CDRs $i 0 test "`ix CDMRWs $i`" != '' || ixs CDMRWs $i 0 test "`ix CDMs $i`" != '' || ixs CDMs $i 0 + test "`ix CDRAMs $i`" != '' || ixs CDRAMs $i 0 done DVDRAM='' @@ -89,6 +95,7 @@ CDRW='' CDR='' CDMRW='' CDM='' +CDRAM='' CD='' # Calculate symlink->device mappings. @@ -116,6 +123,9 @@ done for i in $Count; do test "`ix CDMs $i`" = 1 && CDM="$CDM `ix DEVICES $i`" done +for i in $Count; do + test "`ix CDRAMs $i`" = 1 && CDRAM="$CDRAM `ix DEVICES $i`" +done for i in $Count; do CD="$CD `ix DEVICES $i`" done @@ -123,21 +133,22 @@ done # Debug output if test "$DEBUG" = 1; then echo 'Devices:' `for i in $Count; do ix DEVICES $i; echo -n \ ; done` - echo 'DVDRAM :' `for i in $Count; do ix DVDRAMs $i; echo -n \ ; done` $DVDRAM - echo 'DVDRW :' `for i in $Count; do ix DVDRWs $i; echo -n \ ; done` $DVDRW - echo 'DVD :' `for i in $Count; do ix DVDs $i; echo -n \ ; done` $DVD - echo 'CDRW :' `for i in $Count; do ix CDRWs $i; echo -n \ ; done` $CDRW + echo 'CDROM : (all)' $CD echo 'CD-R :' `for i in $Count; do ix CDRs $i; echo -n \ ; done` $CDR + echo 'CDRW :' `for i in $Count; do ix CDRWs $i; echo -n \ ; done` $CDRW + echo 'DVD :' `for i in $Count; do ix DVDs $i; echo -n \ ; done` $DVD + echo 'DVDRW :' `for i in $Count; do ix DVDRWs $i; echo -n \ ; done` $DVDRW + echo 'DVDRAM :' `for i in $Count; do ix DVDRAMs $i; echo -n \ ; done` $DVDRAM echo 'CDMRW :' `for i in $Count; do ix CDMRWs $i; echo -n \ ; done` $CDMRW - echo 'CDM :' `for i in $Count; do ix CDMs $i; echo -n \ ; done` $CDM - echo 'CDROM : (all)' $CD + echo 'CDWMRW :' `for i in $Count; do ix CDMs $i; echo -n \ ; done` $CDM + echo 'CDRAM :' `for i in $Count; do ix CDRAMs $i; echo -n \ ; done` $CDRAM fi # Prepare symlink names output -output () { +do_output () { test "`eval echo '$'$3`" = '' && return local i - local COUNT='' + local COUNT=$4 local DEVLS="`ls -dl \"/dev/$2\" \"/dev/$2\"[0-9]* 2>/dev/null`" local PRESENT="`echo "$DEVLS" | sed -re 's!^.* /dev/('$2'[[:digit:]]*) -> [^[:space:]]+$!\1!'`" @@ -148,6 +159,7 @@ output () { if test "$DEVPRESENT" != ""; then # Existing symlinks found - don't output a new one. # If the target dev ($1) is the current dev ($i), we output their names. + test -z "$4" || return; test "$1" = "$i" && echo " $DEVPRESENT" | sed -e 'N; $ s/\n/ /' else # If we found no existing symlinks for the target device... @@ -156,15 +168,17 @@ output () { # symlink is created by udev as a result of use of this program, we # DON'T want different output! until notin PRESENT "$2$COUNT"; do + test -z "$4" || return; COUNT=$(($COUNT+1)) done # If the target dev ($1) is the current dev ($i), we output its name. - if test $(($NUMBERED_LINKS)) -ne 0 || test "$COUNT" = ''; then - test "$i" = "$1" && echo -n " $2$COUNT" + if test $(($NUMBERED_LINKS)) -ne 0 || test -z "$COUNT"; then + test "$i" != "$1" || echo -n " $2$COUNT" fi # If the link isn't in our "existing links" list, add it and increment # our counter. - if test ! -e "/dev/$2$COUNT"; then + if notin PRESENT "$2$COUNT"; then + test -z "$4" || return; PRESENT="$PRESENT\n$2$COUNT" COUNT=$(($COUNT+1)) fi @@ -172,13 +186,19 @@ output () { done } +output () { + do_output "$@" + test $(($LINK_ZERO)) -eq 0 || do_output "$@" 0 +} + # And output it notin OUTPUT CD || echo -n "`output "$1" cdrom CD`" -notin OUTPUT CDMRW || echo -n "`output "$1" cdmrw CDM`" -notin OUTPUT CDWMRW || echo -n "`output "$1" cdwmrw CDMRW`" notin OUTPUT CDR || echo -n "`output "$1" cd-r CDR`" notin OUTPUT CDRW || echo -n "`output "$1" cdrw CDRW`" notin OUTPUT DVD || echo -n "`output "$1" dvd DVD`" notin OUTPUT DVDRW || echo -n "`output "$1" dvdrw DVDRW`" notin OUTPUT DVDRAM || echo -n "`output "$1" dvdram DVDRAM`" +notin OUTPUT CDMRW || echo -n "`output "$1" cdmrw CDM`" +notin OUTPUT CDWMRW || echo -n "`output "$1" cdwmrw CDMRW`" +notin OUTPUT CDRAM || echo -n "`output "$1" cdram CDRAM`" echo -- cgit v1.2.3-54-g00ecf From db60d377b0c2a6d3d64b9775c581309f04c11b8e Mon Sep 17 00:00:00 2001 From: Greg KH Date: Fri, 20 May 2005 13:18:28 -0700 Subject: 058 release --- ChangeLog | 27 +++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5eb72461ec..3942d319d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +Summary of changes from v057 to v058 +============================================ + +Daniel Drake: + o Writing udev rules docs update + +Darren Salt: + o update cdsymlinks to latest version + +Greg Kroah-Hartman: + o remove detach_state files from the sysfs test tree + o Update permissions on test scripts so they will run properly now + o hopefully fix up the symlinks in the test directory + o Removed klibc/klibc.spec as it is autogenerated + o Added symlinks thanks to Kay's script and git hacking + o add Red Hat/Fedora html documenation + o Update Red Hat default udev rules + +Kay Sievers: + o selinux: fix handling during creation of symlinks + o Fedora udev.rules update + o libsysfs: version 2.0 + o klibc: version 1.0.7 + +Masanao Igarashi: + o Fix libsysfs issue with relying on the detach_state file to be + Summary of changes from v056 to v057 ============================================ diff --git a/Makefile b/Makefile index 2e5dd5d9cb..470ab9927f 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ SENDER = udevsend INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 057 +VERSION = 058 INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev diff --git a/udev.spec b/udev.spec index a9d1c5fb22..28f19565da 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 056 +Version: 058 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 5e65ab9a191268fec7cddf6b7d8c0fefd2a6b920 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Fri, 20 May 2005 13:22:05 -0700 Subject: Fix makefile to allow 'make release' to work with git --- Makefile | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 470ab9927f..dc3930b46b 100644 --- a/Makefile +++ b/Makefile @@ -317,35 +317,10 @@ spotless: clean $(MAKE) -C klibc SUBDIRS=klibc spotless rm -rf klibc/.install -DISTFILES = $(shell find . \( -not -name '.' \) -print | grep -v -e CVS -e "\.tar\.gz" -e "\/\." -e releases -e BitKeeper -e SCCS -e test/sys | sort ) -DISTDIR := $(RELEASE_NAME) -srcdir = . release: spotless - -rm -rf $(DISTDIR) - mkdir $(DISTDIR) - chmod 777 $(DISTDIR) - bk export -w $(DISTDIR) - tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz - rm -rf $(DISTDIR) + git-tar-tree HEAD $(RELEASE_NAME) | gzip -9v > $(RELEASE_NAME).tar.gz @echo "$(RELEASE_NAME).tar.gz created" - -small_release: $(DISTFILES) spotless -# @echo $(DISTFILES) - @-rm -rf $(DISTDIR) - @mkdir $(DISTDIR) - @-chmod 777 $(DISTDIR) - @for file in $(DISTFILES); do \ - if test -d $$file; then \ - mkdir $(DISTDIR)/$$file; \ - else \ - cp -p $$file $(DISTDIR)/$$file; \ - fi; \ - done - @tar -c $(DISTDIR) | gzip -9 > $(RELEASE_NAME).tar.gz - @rm -rf $(DISTDIR) - @echo "Built $(RELEASE_NAME).tar.gz" - install-config: $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d @if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ -- cgit v1.2.3-54-g00ecf From 88f4b6485e2a551de55fd9d39aeef89debf3121c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 04:38:10 +0200 Subject: udevd: listen for netlink events After the first valid netlink-event all event with a serial number received on the udevsend socket will be ignored. Signed-off-by: Kay Sievers --- udev.c | 10 ++-- udevd.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 160 insertions(+), 36 deletions(-) diff --git a/udev.c b/udev.c index ce9b42f30d..2be4c35740 100644 --- a/udev.c +++ b/udev.c @@ -54,8 +54,10 @@ void log_message(int priority, const char *format, ...) } #endif -/* decide if we should manage the whole hotplug event - * for now look if the kernel calls udevsend instead of /sbin/hotplug +/* Decide if we should manage the whole uevent, including multiplexing + * of the hotplug directories. + * For now look if the kernel calls udevsend instead of /sbin/hotplug, + * or the uevent-helper in /proc/sys/kernel/hotplug is empty. */ static int manage_hotplug_event(void) { char helper[256]; @@ -70,13 +72,15 @@ static int manage_hotplug_event(void) { if (fd < 0) return 0; - len = read(fd, helper, 256); + len = read(fd, helper, sizeof(helper)-1); close(fd); if (len < 0) return 0; helper[len] = '\0'; + if (helper[0] == '\0' || helper[0] == '\n') + return 1; if (strstr(helper, "udevsend")) return 1; diff --git a/udevd.c b/udevd.c index 91033b0688..68e3a75f33 100644 --- a/udevd.c +++ b/udevd.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "list.h" #include "udev_libc_wrapper.h" @@ -49,6 +50,7 @@ /* global variables*/ static int udevsendsock; +static int ueventsock; static pid_t sid; static int pipefds[2]; @@ -126,7 +128,8 @@ static void msg_queue_insert(struct hotplug_msg *msg) break; if (loop_msg->seqnum == msg->seqnum) { - info("ignoring duplicate message seq %llu", msg->seqnum); + dbg("ignoring duplicate message seq %llu", msg->seqnum); + free(msg); return; } } @@ -154,6 +157,8 @@ static void execute_udev(struct hotplug_msg *msg) switch (pid) { case 0: /* child */ + if (ueventsock != -1) + close(ueventsock); close(udevsendsock); logging_close(); @@ -416,13 +421,60 @@ recheck: } } +static struct hotplug_msg *get_msg_from_envbuf(const char *buf, int buf_size) +{ + int bufpos; + int i; + struct hotplug_msg *msg; + + msg = malloc(sizeof(struct hotplug_msg) + buf_size); + if (msg == NULL) + return NULL; + memset(msg, 0x00, sizeof(struct hotplug_msg) + buf_size); + + /* copy environment buffer and reconstruct envp */ + memcpy(msg->envbuf, buf, buf_size); + bufpos = 0; + for (i = 0; (bufpos < buf_size) && (i < HOTPLUG_NUM_ENVP-2); i++) { + int keylen; + char *key; + + key = &msg->envbuf[bufpos]; + keylen = strlen(key); + msg->envp[i] = key; + bufpos += keylen + 1; + dbg("add '%s' to msg.envp[%i]", msg->envp[i], i); + + /* remember some keys for further processing */ + if (strncmp(key, "ACTION=", 7) == 0) + msg->action = &key[7]; + + if (strncmp(key, "DEVPATH=", 8) == 0) + msg->devpath = &key[8]; + + if (strncmp(key, "SUBSYSTEM=", 10) == 0) + msg->subsystem = &key[10]; + + if (strncmp(key, "SEQNUM=", 7) == 0) + msg->seqnum = strtoull(&key[7], NULL, 10); + + if (strncmp(key, "PHYSDEVPATH=", 12) == 0) + msg->physdevpath = &key[12]; + + if (strncmp(key, "TIMEOUT=", 8) == 0) + msg->timeout = strtoull(&key[8], NULL, 10); + } + msg->envp[i++] = "UDEVD_EVENT=1"; + msg->envp[i] = NULL; + + return msg; +} + /* receive the udevsend message and do some sanity checks */ static struct hotplug_msg *get_udevsend_msg(void) { static struct udevsend_msg usend_msg; struct hotplug_msg *msg; - int bufpos; - int i; ssize_t size; struct msghdr smsg; struct cmsghdr *cmsg; @@ -467,46 +519,60 @@ static struct hotplug_msg *get_udevsend_msg(void) envbuf_size = size - offsetof(struct udevsend_msg, envbuf); dbg("envbuf_size=%i", envbuf_size); - msg = malloc(sizeof(struct hotplug_msg) + envbuf_size); + msg = get_msg_from_envbuf(usend_msg.envbuf, envbuf_size); if (msg == NULL) return NULL; - memset(msg, 0x00, sizeof(struct hotplug_msg) + envbuf_size); - - /* copy environment buffer and reconstruct envp */ - memcpy(msg->envbuf, usend_msg.envbuf, envbuf_size); - bufpos = 0; - for (i = 0; (bufpos < envbuf_size) && (i < HOTPLUG_NUM_ENVP-2); i++) { - int keylen; - char *key; + return msg; +} - key = &msg->envbuf[bufpos]; - keylen = strlen(key); - msg->envp[i] = key; - bufpos += keylen + 1; - dbg("add '%s' to msg.envp[%i]", msg->envp[i], i); +/* receive the kernel user event message and do some sanity checks */ +static struct hotplug_msg *get_uevent_msg(void) +{ + struct hotplug_msg *msg; + int bufpos; + ssize_t size; + static char buffer[HOTPLUG_BUFFER_SIZE + 512]; + char *pos; - /* remember some keys for further processing */ - if (strncmp(key, "ACTION=", 7) == 0) - msg->action = &key[7]; + size = recv(ueventsock, &buffer, sizeof(buffer), 0); + if (size < 0) { + if (errno != EINTR) + dbg("unable to receive udevsend message"); + return NULL; + } - if (strncmp(key, "DEVPATH=", 8) == 0) - msg->devpath = &key[8]; + if ((size_t)size > sizeof(buffer)-1) + size = sizeof(buffer)-1; + buffer[size] = '\0'; + dbg("uevent_size=%i", size); - if (strncmp(key, "SUBSYSTEM=", 10) == 0) - msg->subsystem = &key[10]; + /* start of event payload */ + bufpos = strlen(buffer)+1; + msg = get_msg_from_envbuf(&buffer[bufpos], size-bufpos); + if (msg == NULL) + return NULL; - if (strncmp(key, "SEQNUM=", 7) == 0) - msg->seqnum = strtoull(&key[7], NULL, 10); + /* validate message */ + pos = strchr(buffer, '@'); + if (pos == NULL) { + dbg("invalid uevent '%s'", buffer); + free(msg); + return NULL; + } + pos[0] = '\0'; - if (strncmp(key, "PHYSDEVPATH=", 12) == 0) - msg->physdevpath = &key[12]; + if (msg->action == NULL) { + dbg("no ACTION in payload found, skip event '%s'", buffer); + free(msg); + return NULL; + } - if (strncmp(key, "TIMEOUT=", 8) == 0) - msg->timeout = strtoull(&key[8], NULL, 10); + if (strcmp(msg->action, buffer) != 0) { + dbg("ACTION in payload does not match uevent, skip event '%s'", buffer); + free(msg); + return NULL; } - msg->envp[i++] = "UDEVD_EVENT=1"; - msg->envp[i] = NULL; return msg; } @@ -622,6 +688,34 @@ static int init_udevsend_socket(void) return 0; } +static int init_uevent_socket(void) +{ + struct sockaddr_nl snl; + int retval; + + memset(&snl, 0x00, sizeof(struct sockaddr_nl)); + snl.nl_family = AF_NETLINK; + snl.nl_pid = getpid(); + snl.nl_groups = 0xffffffff; + + ueventsock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + if (ueventsock == -1) { + dbg("error getting socket, %s", strerror(errno)); + return -1; + } + + retval = bind(ueventsock, (struct sockaddr *) &snl, + sizeof(struct sockaddr_nl)); + if (retval < 0) { + dbg("bind failed, %s", strerror(errno)); + close(ueventsock); + ueventsock = -1; + return -1; + } + + return 0; +} + int main(int argc, char *argv[], char *envp[]) { struct sysinfo info; @@ -631,6 +725,7 @@ int main(int argc, char *argv[], char *envp[]) struct sigaction act; fd_set readfds; const char *udevd_expected_seqnum; + int uevent_active = 0; logging_init("udevd"); udev_init_config(); @@ -716,6 +811,10 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGALRM, &act, NULL); sigaction(SIGCHLD, &act, NULL); + if (init_uevent_socket() < 0) { + dbg("uevent socket not available"); + } + if (init_udevsend_socket() < 0) { if (errno == EADDRINUSE) dbg("another udevd running, exit"); @@ -745,6 +844,8 @@ int main(int argc, char *argv[], char *envp[]) FD_ZERO(&readfds); FD_SET(udevsendsock, &readfds); + if (ueventsock != -1) + FD_SET(ueventsock, &readfds); FD_SET(pipefds[0], &readfds); maxsockplus = udevsendsock+1; while (1) { @@ -761,8 +862,27 @@ int main(int argc, char *argv[], char *envp[]) if (FD_ISSET(udevsendsock, &workreadfds)) { msg = get_udevsend_msg(); - if (msg) + if (msg) { + /* discard kernel messages if netlink is active */ + if (uevent_active && msg->seqnum != 0) { + dbg("skip kernel udevsend message, netlink is active"); + free(msg); + continue; + } + msg_queue_insert(msg); + } + } + + if (FD_ISSET(ueventsock, &workreadfds)) { + msg = get_uevent_msg(); + if (msg) { msg_queue_insert(msg); + /* disable udevsend with first netlink message */ + if (!uevent_active) { + info("netlink message received, disable kernel udevsend messages"); + uevent_active = 1; + } + } } if (FD_ISSET(pipefds[0], &workreadfds)) -- cgit v1.2.3-54-g00ecf From 3b47c7394d042b8a3fcf426920a926d4ffedacad Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 04:41:09 +0200 Subject: udevd: add udevcontrol Controls the behavior of the running daemon. Currently only stopping and starting of the execution queue is supported. Signed-off-by: Kay Sievers --- Makefile | 12 ++++- udevcontrol.c | 107 +++++++++++++++++++++++++++++++++++++ udevd.c | 167 ++++++++++++++++++++++++++++++++-------------------------- udevd.h | 23 +++++--- udevsend.c | 9 ++-- 5 files changed, 230 insertions(+), 88 deletions(-) create mode 100644 udevcontrol.c diff --git a/Makefile b/Makefile index dc3930b46b..896a58a306 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,7 @@ V=false ROOT = udev DAEMON = udevd SENDER = udevsend +CONTROL = udevcontrol INFO = udevinfo TESTER = udevtest STARTER = udevstart @@ -205,7 +206,7 @@ endif # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf -all: $(ROOT) $(SENDER) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) +all: $(ROOT) $(SENDER) $(CONTROL) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -271,6 +272,7 @@ $(TESTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(INFO).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(DAEMON).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(CONTROL).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(ROOT): $(KLCC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) @@ -293,6 +295,10 @@ $(SENDER): $(KLCC) $(SENDER).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(SENDER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ +$(CONTROL): $(KLCC) $(CONTROL).o $(OBJS) udevd.h + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CONTROL).o $(OBJS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ + $(STARTER): $(KLCC) $(STARTER).o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) -o $@ $(STARTER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ @@ -304,7 +310,7 @@ clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) \ - $(SENDER) $(TESTER) $(STARTER) + $(SENDER) $(CONTROL) $(TESTER) $(STARTER) -rm -f ccdv $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ @@ -364,6 +370,7 @@ install: install-config install-man install-dev.d all $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) + $(INSTALL_PROGRAM) -D $(CONTROL) $(DESTDIR)$(sbindir)/$(CONTROL) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) @@ -387,6 +394,7 @@ uninstall: uninstall-man uninstall-dev.d - rm $(sbindir)/$(ROOT) - rm $(sbindir)/$(DAEMON) - rm $(sbindir)/$(SENDER) + - rm $(sbindir)/$(CONTROL) - rm $(sbindir)/$(STARTER) - rm $(usrbindir)/$(INFO) - rm $(usrbindir)/$(TESTER) diff --git a/udevcontrol.c b/udevcontrol.c new file mode 100644 index 0000000000..6a278a04c1 --- /dev/null +++ b/udevcontrol.c @@ -0,0 +1,107 @@ +/* + * udevcontrol.c + * + * Userspace devfs + * + * Copyright (C) 2005 Kay Sievers + * + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_version.h" +#include "udevd.h" +#include "logging.h" + +/* global variables */ +static int sock = -1; + +#ifdef USE_LOG +void log_message (int level, const char *format, ...) +{ + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif + + +int main(int argc, char *argv[], char *envp[]) +{ + static struct udevd_msg usend_msg; + struct sockaddr_un saddr; + socklen_t addrlen; + int retval = 1; + + logging_init("udevcontrol"); + dbg("version %s", UDEV_VERSION); + + if (argc != 2) { + info("usage: udevcontrol \n"); + goto exit; + } + + memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); + strcpy(usend_msg.magic, UDEV_MAGIC); + + if (strstr(argv[1], "stop_exec_queue")) + usend_msg.type = UDEVD_STOP_EXEC_QUEUE; + else if (strstr(argv[1], "start_exec_queue")) + usend_msg.type = UDEVD_START_EXEC_QUEUE; + else { + info("unknown command\n"); + goto exit; + } + + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (sock == -1) { + info("error getting socket"); + goto exit; + } + + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + + + retval = sendto(sock, &usend_msg, sizeof(usend_msg), 0, (struct sockaddr *)&saddr, addrlen); + if (retval == -1) + info("error sending message (%s)", strerror(errno)); + + close(sock); + +exit: + logging_close(); + + return retval; +} diff --git a/udevd.c b/udevd.c index 68e3a75f33..371d715716 100644 --- a/udevd.c +++ b/udevd.c @@ -49,17 +49,18 @@ #include "logging.h" /* global variables*/ -static int udevsendsock; -static int ueventsock; +static int udevd_sock; +static int uevent_nl_sock; static pid_t sid; static int pipefds[2]; static long startup_time; -static unsigned long long expected_seqnum = 0; +static unsigned long long expected_seqnum; static volatile int sigchilds_waiting; static volatile int run_msg_q; static volatile int sig_flag; static int run_exec_q; +static int stop_exec_q; static LIST_HEAD(msg_list); static LIST_HEAD(exec_list); @@ -88,23 +89,23 @@ void log_message (int priority, const char *format, ...) static void msg_dump_queue(void) { #ifdef DEBUG - struct hotplug_msg *msg; + struct uevent_msg *msg; list_for_each_entry(msg, &msg_list, node) dbg("sequence %llu in queue", msg->seqnum); #endif } -static void run_queue_delete(struct hotplug_msg *msg) +static void run_queue_delete(struct uevent_msg *msg) { list_del(&msg->node); free(msg); } /* orders the message in the queue by sequence number */ -static void msg_queue_insert(struct hotplug_msg *msg) +static void msg_queue_insert(struct uevent_msg *msg) { - struct hotplug_msg *loop_msg; + struct uevent_msg *loop_msg; struct sysinfo info; if (msg->seqnum == 0) { @@ -148,7 +149,7 @@ static void msg_queue_insert(struct hotplug_msg *msg) } /* forks event and removes event from run queue when finished */ -static void execute_udev(struct hotplug_msg *msg) +static void execute_udev(struct uevent_msg *msg) { char *const argv[] = { "udev", msg->subsystem, NULL }; pid_t pid; @@ -157,9 +158,9 @@ static void execute_udev(struct hotplug_msg *msg) switch (pid) { case 0: /* child */ - if (ueventsock != -1) - close(ueventsock); - close(udevsendsock); + if (uevent_nl_sock != -1) + close(uevent_nl_sock); + close(udevd_sock); logging_close(); setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); @@ -298,9 +299,9 @@ static int compare_devpath(const char *running, const char *waiting) } /* returns still running task for the same device, its parent or its physical device */ -static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) +static struct uevent_msg *running_with_devpath(struct uevent_msg *msg) { - struct hotplug_msg *loop_msg; + struct uevent_msg *loop_msg; if (msg->devpath == NULL) return NULL; @@ -329,9 +330,9 @@ static struct hotplug_msg *running_with_devpath(struct hotplug_msg *msg) /* exec queue management routine executes the events and serializes events in the same sequence */ static void exec_queue_manager(void) { - struct hotplug_msg *loop_msg; - struct hotplug_msg *tmp_msg; - struct hotplug_msg *msg; + struct uevent_msg *loop_msg; + struct uevent_msg *tmp_msg; + struct uevent_msg *msg; int running; running = running_processes(); @@ -364,7 +365,7 @@ static void exec_queue_manager(void) } } -static void msg_move_exec(struct hotplug_msg *msg) +static void msg_move_exec(struct uevent_msg *msg) { list_move_tail(&msg->node, &exec_list); run_exec_q = 1; @@ -376,8 +377,8 @@ static void msg_move_exec(struct hotplug_msg *msg) /* msg queue management routine handles the timeouts and dispatches the events */ static void msg_queue_manager(void) { - struct hotplug_msg *loop_msg; - struct hotplug_msg *tmp_msg; + struct uevent_msg *loop_msg; + struct uevent_msg *tmp_msg; struct sysinfo info; long msg_age = 0; static int timeout = EVENT_INIT_TIMEOUT_SEC; @@ -421,21 +422,21 @@ recheck: } } -static struct hotplug_msg *get_msg_from_envbuf(const char *buf, int buf_size) +static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) { int bufpos; int i; - struct hotplug_msg *msg; + struct uevent_msg *msg; - msg = malloc(sizeof(struct hotplug_msg) + buf_size); + msg = malloc(sizeof(struct uevent_msg) + buf_size); if (msg == NULL) return NULL; - memset(msg, 0x00, sizeof(struct hotplug_msg) + buf_size); + memset(msg, 0x00, sizeof(struct uevent_msg) + buf_size); /* copy environment buffer and reconstruct envp */ memcpy(msg->envbuf, buf, buf_size); bufpos = 0; - for (i = 0; (bufpos < buf_size) && (i < HOTPLUG_NUM_ENVP-2); i++) { + for (i = 0; (bufpos < buf_size) && (i < UEVENT_NUM_ENVP-2); i++) { int keylen; char *key; @@ -470,11 +471,11 @@ static struct hotplug_msg *get_msg_from_envbuf(const char *buf, int buf_size) return msg; } -/* receive the udevsend message and do some sanity checks */ -static struct hotplug_msg *get_udevsend_msg(void) +/* receive the udevd message from userspace */ +static struct uevent_msg *get_udevd_msg(void) { - static struct udevsend_msg usend_msg; - struct hotplug_msg *msg; + static struct udevd_msg usend_msg; + struct uevent_msg *msg; ssize_t size; struct msghdr smsg; struct cmsghdr *cmsg; @@ -483,9 +484,9 @@ static struct hotplug_msg *get_udevsend_msg(void) char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; int envbuf_size; - memset(&usend_msg, 0x00, sizeof(struct udevsend_msg)); + memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); iov.iov_base = &usend_msg; - iov.iov_len = sizeof(struct udevsend_msg); + iov.iov_len = sizeof(struct udevd_msg); memset(&smsg, 0x00, sizeof(struct msghdr)); smsg.msg_iov = &iov; @@ -493,10 +494,10 @@ static struct hotplug_msg *get_udevsend_msg(void) smsg.msg_control = cred_msg; smsg.msg_controllen = sizeof(cred_msg); - size = recvmsg(udevsendsock, &smsg, 0); + size = recvmsg(udevd_sock, &smsg, 0); if (size < 0) { if (errno != EINTR) - dbg("unable to receive udevsend message"); + dbg("unable to receive udevd message"); return NULL; } cmsg = CMSG_FIRSTHDR(&smsg); @@ -517,28 +518,43 @@ static struct hotplug_msg *get_udevsend_msg(void) return NULL; } - envbuf_size = size - offsetof(struct udevsend_msg, envbuf); - dbg("envbuf_size=%i", envbuf_size); - msg = get_msg_from_envbuf(usend_msg.envbuf, envbuf_size); - if (msg == NULL) - return NULL; - - return msg; +switch (usend_msg.type) { + case UDEVD_UEVENT: + dbg("udevd message (UEVENT) received"); + envbuf_size = size - offsetof(struct udevd_msg, envbuf); + dbg("envbuf_size=%i", envbuf_size); + msg = get_msg_from_envbuf(usend_msg.envbuf, envbuf_size); + if (msg == NULL) + return NULL; + return msg; + case UDEVD_STOP_EXEC_QUEUE: + dbg("udevd message (STOP_EXEC_QUEUE) received"); + stop_exec_q = 1; + break; + case UDEVD_START_EXEC_QUEUE: + dbg("udevd message (START_EXEC_QUEUE) received"); + stop_exec_q = 0; + exec_queue_manager(); + break; + default: + dbg("unknown message type"); + } + return NULL; } /* receive the kernel user event message and do some sanity checks */ -static struct hotplug_msg *get_uevent_msg(void) +static struct uevent_msg *get_uevent_msg(void) { - struct hotplug_msg *msg; + struct uevent_msg *msg; int bufpos; ssize_t size; - static char buffer[HOTPLUG_BUFFER_SIZE + 512]; + static char buffer[UEVENT_BUFFER_SIZE + 512]; char *pos; - size = recv(ueventsock, &buffer, sizeof(buffer), 0); + size = recv(uevent_nl_sock, &buffer, sizeof(buffer), 0); if (size < 0) { if (errno != EINTR) - dbg("unable to receive udevsend message"); + dbg("unable to receive udevd message"); return NULL; } @@ -612,7 +628,7 @@ do_write: static void udev_done(int pid) { /* find msg associated with pid and delete it */ - struct hotplug_msg *msg; + struct uevent_msg *msg; list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { @@ -655,7 +671,7 @@ static void user_sighandler(void) } } -static int init_udevsend_socket(void) +static int init_udevd_socket(void) { struct sockaddr_un saddr; socklen_t addrlen; @@ -668,27 +684,27 @@ static int init_udevsend_socket(void) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - udevsendsock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (udevsendsock == -1) { + udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udevd_sock == -1) { err("error getting socket, %s", strerror(errno)); return -1; } /* the bind takes care of ensuring only one copy running */ - retval = bind(udevsendsock, (struct sockaddr *) &saddr, addrlen); + retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { err("bind failed, %s", strerror(errno)); - close(udevsendsock); + close(udevd_sock); return -1; } /* enable receiving of the sender credentials */ - setsockopt(udevsendsock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); + setsockopt(udevd_sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); return 0; } -static int init_uevent_socket(void) +static int init_uevent_nl_sock(void) { struct sockaddr_nl snl; int retval; @@ -698,18 +714,18 @@ static int init_uevent_socket(void) snl.nl_pid = getpid(); snl.nl_groups = 0xffffffff; - ueventsock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); - if (ueventsock == -1) { + uevent_nl_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + if (uevent_nl_sock == -1) { dbg("error getting socket, %s", strerror(errno)); return -1; } - retval = bind(ueventsock, (struct sockaddr *) &snl, + retval = bind(uevent_nl_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { dbg("bind failed, %s", strerror(errno)); - close(ueventsock); - ueventsock = -1; + close(uevent_nl_sock); + uevent_nl_sock = -1; return -1; } @@ -725,7 +741,7 @@ int main(int argc, char *argv[], char *envp[]) struct sigaction act; fd_set readfds; const char *udevd_expected_seqnum; - int uevent_active = 0; + int uevent_nl_active = 0; logging_init("udevd"); udev_init_config(); @@ -811,15 +827,15 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGALRM, &act, NULL); sigaction(SIGCHLD, &act, NULL); - if (init_uevent_socket() < 0) { + if (init_uevent_nl_sock() < 0) { dbg("uevent socket not available"); } - if (init_udevsend_socket() < 0) { + if (init_udevd_socket() < 0) { if (errno == EADDRINUSE) dbg("another udevd running, exit"); else - dbg("error initialising udevsend socket: %s", strerror(errno)); + dbg("error initialising udevd socket: %s", strerror(errno)); goto exit; } @@ -843,13 +859,13 @@ int main(int argc, char *argv[], char *envp[]) startup_time = info.uptime; FD_ZERO(&readfds); - FD_SET(udevsendsock, &readfds); - if (ueventsock != -1) - FD_SET(ueventsock, &readfds); + FD_SET(udevd_sock, &readfds); + if (uevent_nl_sock != -1) + FD_SET(uevent_nl_sock, &readfds); FD_SET(pipefds[0], &readfds); - maxsockplus = udevsendsock+1; + maxsockplus = udevd_sock+1; while (1) { - struct hotplug_msg *msg; + struct uevent_msg *msg; fd_set workreadfds = readfds; retval = select(maxsockplus, &workreadfds, NULL, NULL, NULL); @@ -860,12 +876,12 @@ int main(int argc, char *argv[], char *envp[]) continue; } - if (FD_ISSET(udevsendsock, &workreadfds)) { - msg = get_udevsend_msg(); + if (FD_ISSET(udevd_sock, &workreadfds)) { + msg = get_udevd_msg(); if (msg) { /* discard kernel messages if netlink is active */ - if (uevent_active && msg->seqnum != 0) { - dbg("skip kernel udevsend message, netlink is active"); + if (uevent_nl_active && msg->seqnum != 0) { + dbg("skip uevent_helper message, netlink is active"); free(msg); continue; } @@ -873,14 +889,14 @@ int main(int argc, char *argv[], char *envp[]) } } - if (FD_ISSET(ueventsock, &workreadfds)) { + if (FD_ISSET(uevent_nl_sock, &workreadfds)) { msg = get_uevent_msg(); if (msg) { msg_queue_insert(msg); /* disable udevsend with first netlink message */ - if (!uevent_active) { - info("netlink message received, disable kernel udevsend messages"); - uevent_active = 1; + if (!uevent_nl_active) { + info("uevent_nl message received, disable uevent_helper messages"); + uevent_nl_active = 1; } } } @@ -906,7 +922,8 @@ int main(int argc, char *argv[], char *envp[]) } run_exec_q = 0; - exec_queue_manager(); + if (!stop_exec_q) + exec_queue_manager(); } } diff --git a/udevd.h b/udevd.h index b3e998b04c..b782d7aacd 100644 --- a/udevd.h +++ b/udevd.h @@ -43,15 +43,24 @@ #define THROTTLE_MAX_RUNNING_CHILDS 10 /* environment buffer, should match the kernel's size in lib/kobject_uevent.h */ -#define HOTPLUG_BUFFER_SIZE 1024 -#define HOTPLUG_NUM_ENVP 32 +#define UEVENT_BUFFER_SIZE 1024 +#define UEVENT_NUM_ENVP 32 -struct udevsend_msg { - char magic[20]; - char envbuf[HOTPLUG_BUFFER_SIZE+256]; +enum udevd_msg_type { + UDEVD_UNKNOWN, + UDEVD_UEVENT, + UDEVD_STOP_EXEC_QUEUE, + UDEVD_START_EXEC_QUEUE, }; -struct hotplug_msg { + +struct udevd_msg { + char magic[32]; + enum udevd_msg_type type; + char envbuf[UEVENT_BUFFER_SIZE+512]; +}; + +struct uevent_msg { struct list_head node; pid_t pid; long queue_time; @@ -61,6 +70,6 @@ struct hotplug_msg { unsigned long long seqnum; char *physdevpath; unsigned int timeout; - char *envp[HOTPLUG_NUM_ENVP+1]; + char *envp[UEVENT_NUM_ENVP+1]; char envbuf[]; }; diff --git a/udevsend.c b/udevsend.c index 8915edacc8..2b92e659e2 100644 --- a/udevsend.c +++ b/udevsend.c @@ -115,7 +115,7 @@ static void run_udev(const char *subsystem) int main(int argc, char *argv[], char *envp[]) { - static struct udevsend_msg usend_msg; + static struct udevd_msg usend_msg; int usend_msg_len; int i; int loop; @@ -144,8 +144,9 @@ int main(int argc, char *argv[], char *envp[]) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - memset(&usend_msg, 0x00, sizeof(struct udevsend_msg)); + memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); strcpy(usend_msg.magic, UDEV_MAGIC); + usend_msg.type = UDEVD_UEVENT; /* copy all keys to send buffer */ for (i = 0; envp[i]; i++) { @@ -161,7 +162,7 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - if (bufpos + keylen >= HOTPLUG_BUFFER_SIZE-1) { + if (bufpos + keylen >= UEVENT_BUFFER_SIZE-1) { err("environment buffer too small, probably not called by the kernel"); continue; } @@ -180,7 +181,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("add 'SUBSYSTEM=%s' to env[%i] buffer from argv", argv[1], i); } - usend_msg_len = offsetof(struct udevsend_msg, envbuf) + bufpos; + usend_msg_len = offsetof(struct udevd_msg, envbuf) + bufpos; dbg("usend_msg_len=%i", usend_msg_len); /* If we can't send, try to start daemon and resend message */ -- cgit v1.2.3-54-g00ecf From 0590abd720f0ddc8204539feef4df8987d7a1f8c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 04:44:07 +0200 Subject: udevd: add initsend Transfer stored events from initramfs to the running udevd to replay events after userspace is ready. Signed-off-by: Kay Sievers --- Makefile | 32 +++++--- udev.8.in | 3 +- udevinitsend.c | 231 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 253 insertions(+), 13 deletions(-) create mode 100644 udevinitsend.c diff --git a/Makefile b/Makefile index 896a58a306..2a832f7054 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,7 @@ V=false ROOT = udev DAEMON = udevd SENDER = udevsend +INITSENDER = udevinitsend CONTROL = udevcontrol INFO = udevinfo TESTER = udevtest @@ -206,7 +207,7 @@ endif # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf -all: $(ROOT) $(SENDER) $(CONTROL) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) +all: $(ROOT) $(SENDER) $(INITSENDER) $(CONTROL) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -264,16 +265,17 @@ GEN_MANPAGESIN = udev.8.in $(GEN_MANPAGES): $(GEN_MANPAGESIN) sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ -$(UDEV_OBJS): $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(SYSFS_OBJS): $(HOST_PROGS) $(KLCC) -$(OBJS): $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(ROOT).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(TESTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(INFO).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(DAEMON).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(SENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(CONTROL).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(STARTER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(UDEV_OBJS): $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(SYSFS_OBJS): $(HEADERS) $(HOST_PROGS) $(KLCC) +$(OBJS): $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(ROOT).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(TESTER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(INFO).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(DAEMON).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(SENDER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(INITSENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(CONTROL).o: $(HEADERS) $( $(HEADERS)GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(STARTER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(ROOT): $(KLCC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) $(QUIET) $(LD) $(LDFLAGS) -o $@ $(ROOT).o $(OBJS) $(LIB_OBJS) @@ -295,6 +297,10 @@ $(SENDER): $(KLCC) $(SENDER).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(SENDER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ +$(INITSENDER): $(KLCC) $(INITSENDER).o $(OBJS) udevd.h + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(INITSENDER).o $(OBJS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ + $(CONTROL): $(KLCC) $(CONTROL).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CONTROL).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ @@ -310,7 +316,7 @@ clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) \ - $(SENDER) $(CONTROL) $(TESTER) $(STARTER) + $(SENDER) $(INITSENDER) $(CONTROL) $(TESTER) $(STARTER) -rm -f ccdv $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ @@ -370,6 +376,7 @@ install: install-config install-man install-dev.d all $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) + $(INSTALL_PROGRAM) -D $(INITSENDER) $(DESTDIR)$(sbindir)/$(INITSENDER) $(INSTALL_PROGRAM) -D $(CONTROL) $(DESTDIR)$(sbindir)/$(CONTROL) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) @@ -394,6 +401,7 @@ uninstall: uninstall-man uninstall-dev.d - rm $(sbindir)/$(ROOT) - rm $(sbindir)/$(DAEMON) - rm $(sbindir)/$(SENDER) + - rm $(sbindir)/$(INITSENDER) - rm $(sbindir)/$(CONTROL) - rm $(sbindir)/$(STARTER) - rm $(usrbindir)/$(INFO) diff --git a/udev.8.in b/udev.8.in index 5be9308af4..79c4a83d16 100644 --- a/udev.8.in +++ b/udev.8.in @@ -158,7 +158,8 @@ The following keys can get values assigned: .TP .B NAME The name of the node to be created, or the name, the network interface -should be renamed to. +should be renamed to. Only one rule can set the a name, all later rules +with a NAME key will be ignored. .TP .B SYMLINK The name of a symlink targeting the node. Every matching rule can add diff --git a/udevinitsend.c b/udevinitsend.c new file mode 100644 index 0000000000..05c39b99b3 --- /dev/null +++ b/udevinitsend.c @@ -0,0 +1,231 @@ +/* + * udevinitsend.c + * + * Userspace devfs + * + * Copyright (C) 2004, 2005 Hannes Reinecke + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_version.h" +#include "udevd.h" +#include "logging.h" + + +#ifdef USE_LOG +void log_message (int level, const char *format, ...) +{ + va_list args; + + va_start(args, format); + vsyslog(level, format, args); + va_end(args); +} +#endif + +/* + * udevsend + * + * Scan a file, write all variables into the msgbuf and + * fires the message to udevd. + */ +static int udevsend(char *filename, int sock, int ignore_loops) +{ + struct stat statbuf; + int fd, bufpos; + char *fdmap, *ls, *le, *ch; + struct udevd_msg usend_msg; + int retval = 0; + int usend_msg_len; + struct sockaddr_un saddr; + socklen_t addrlen; + + if (stat(filename,&statbuf) < 0) { + dbg("cannot stat %s: %s\n", filename, strerror(errno)); + return 1; + } + fd = open(filename,O_RDONLY); + if (fd < 0) + return 1; + + fdmap = mmap(0, statbuf.st_size, + PROT_READ, MAP_PRIVATE, fd, 0); + close(fd); + if (fdmap == MAP_FAILED) { + dbg("mmap failed, errno %d\n", errno); + return 1; + } + + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + + memset(usend_msg.envbuf, 0, UEVENT_BUFFER_SIZE+256); + bufpos = 0; + memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); + strcpy(usend_msg.magic, UDEV_MAGIC); + + ls = fdmap; + ch = le = ls; + while (*ch && ch < fdmap + statbuf.st_size) { + le = strchr(ch,'\n'); + if (!le) + break; + ch = strchr(ch,'='); + if (!ch) + break; + + /* prevent loops in the scripts we execute */ + if (strncmp(ls, "UDEVD_EVENT=", 12) == 0) { + if (!ignore_loops) { + dbg("event already handled by udev\n"); + retval = -1; + break; + } + goto loop_end; + } + + /* omit shell-generated keys */ + if (ls[0] == '_' && ls[1] == '=') { + goto loop_end; + } + + if (ch < le) { + + strncpy(&usend_msg.envbuf[bufpos],ls,(ch - ls) + 1); + bufpos += (ch - ls) + 1; + if (ch[1] == '\'' && le[-1] == '\'') { + strncpy(&usend_msg.envbuf[bufpos],ch + 2, (le - ch) -3); + bufpos += (le - ch) - 3; + } else { + strncpy(&usend_msg.envbuf[bufpos],ch, (le - ch)); + bufpos += (le - ch); + } + bufpos++; + } +loop_end: + ch = le + 1; + ls = ch; + } + munmap(fdmap, statbuf.st_size); + + usend_msg_len = offsetof(struct udevd_msg, envbuf) + bufpos; + dbg("usend_msg_len=%i", usend_msg_len); + + if (!retval) { + retval = sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen); + if (retval < 0) { + dbg("error sending message (%s)", strerror(errno)); + } + } + + return retval; +} + +int main(int argc, char *argv[], char *envp[]) +{ + static const char short_options[] = "d:f:lVh"; + int option; + char *event_dir = NULL; + char *event_file = NULL; + DIR *dirstream; + struct dirent *direntry; + int retval = 1, ignore_loops = 0; + int sock; + + logging_init("udevinitsend"); + dbg("version %s", UDEV_VERSION); + + /* get command line options */ + while (1) { + option = getopt(argc, argv, short_options); + if (option == -1) + break; + + dbg("option '%c': ", option); + switch (option) { + case 'd': + dbg("scan directory %s\n", optarg); + event_dir = optarg; + break; + + case 'f': + dbg("use event file %s\n", optarg); + event_file = optarg; + break; + + case 'l': + dbg("ignoring loops\n"); + ignore_loops = 1; + break; + + case 'V': + printf("udevinitsend, version 0.1\n"); + return 0; + + case 'h': + retval = 0; + } + } + + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (sock == -1) { + dbg("error getting socket"); + return 1; + } + + if (event_dir) { + dirstream = opendir(event_dir); + if (!dirstream) { + info("error opening directory %s: %s\n", + event_dir, strerror(errno)); + return 1; + } + chdir(event_dir); + while ((direntry = readdir(dirstream)) != NULL) { + if (!strcmp(direntry->d_name,".") || + !strcmp(direntry->d_name,"..")) + continue; + retval = udevsend(direntry->d_name, sock, ignore_loops); + } + closedir(dirstream); + } else if (event_file) { + retval = udevsend(event_file, sock, ignore_loops); + } + + if (sock != -1) + close(sock); + + return retval; +} -- cgit v1.2.3-54-g00ecf From 1682c8c4a3909f9d80f17544bcfc6fb73379bc7e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 04:48:09 +0200 Subject: Makefile: fix DESTDIR Patch from: Vassilis Virvilis Signed-off-by: Kay Sievers --- Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 2a832f7054..1cf3e54fb7 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,6 @@ INFO = udevinfo TESTER = udevtest STARTER = udevstart VERSION = 058 -INSTALL_DIR = /usr/local/bin RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev DESTDIR = @@ -180,7 +179,6 @@ ifeq ($(strip $(USE_KLIBC)),true) KLCC = $(KLIBC_INSTALL)/bin/klcc CC = $(KLCC) LD = $(KLCC) - LDFLAGS += -static else CFLAGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations endif @@ -252,8 +250,8 @@ udev_version.h: @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ - @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ - @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ + @echo \#define UDEV_BIN \"$(sbindir)/udev\" >> $@ + @echo \#define UDEVD_BIN \"$(sbindir)/udevd\" >> $@ # Rules on how to create the generated config files $(LOCAL_CFG_DIR)/udev.conf: -- cgit v1.2.3-54-g00ecf From a15f42c46a7b9ceb5850ea4334c95f099ce74a6f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 04:53:17 +0200 Subject: udevd: improve timeout handling Allow to override some parameters by environment keys. Signed-off-by: Kay Sievers --- udevd.c | 149 +++++++++++++++++++++++++++++++++++++++---------------------- udevd.h | 14 +++--- udevsend.c | 6 +-- 3 files changed, 107 insertions(+), 62 deletions(-) diff --git a/udevd.c b/udevd.c index 371d715716..b5597eab40 100644 --- a/udevd.c +++ b/udevd.c @@ -54,11 +54,10 @@ static int uevent_nl_sock; static pid_t sid; static int pipefds[2]; -static long startup_time; -static unsigned long long expected_seqnum; static volatile int sigchilds_waiting; static volatile int run_msg_q; static volatile int sig_flag; +static int init_phase = 1; static int run_exec_q; static int stop_exec_q; @@ -70,7 +69,13 @@ static void exec_queue_manager(void); static void msg_queue_manager(void); static void user_sighandler(void); static void reap_sigchilds(void); -char *udev_bin; + +static char *udev_bin; +static unsigned long long expected_seqnum; +static int event_timeout; +static int max_childs; +static int max_childs_running; + #ifdef USE_LOG void log_message (int priority, const char *format, ...) @@ -115,6 +120,20 @@ static void msg_queue_insert(struct uevent_msg *msg) return; } + /* store timestamp of queuing */ + sysinfo(&info); + msg->queue_time = info.uptime; + + /* with the first event we provide a phase of shorter timeout */ + if (init_phase) { + static long init_time; + + if (init_time == 0) + init_time = info.uptime; + if (info.uptime - init_time >= UDEVD_INIT_TIME) + init_phase = 0; + } + /* don't delay messages with timeout set */ if (msg->timeout) { dbg("move seq %llu with timeout %u to exec queue", msg->seqnum, msg->timeout); @@ -134,13 +153,8 @@ static void msg_queue_insert(struct uevent_msg *msg) return; } } - - /* store timestamp of queuing */ - sysinfo(&info); - msg->queue_time = info.uptime; - list_add(&msg->node, &loop_msg->node); - dbg("queued message seq %llu", msg->seqnum); + info("seq %llu queued, devpath '%s'", msg->seqnum, msg->devpath); /* run msg queue manager */ run_msg_q = 1; @@ -153,6 +167,7 @@ static void execute_udev(struct uevent_msg *msg) { char *const argv[] = { "udev", msg->subsystem, NULL }; pid_t pid; + struct sysinfo info; pid = fork(); switch (pid) { @@ -174,7 +189,9 @@ static void execute_udev(struct uevent_msg *msg) break; default: /* get SIGCHLD in main loop */ - dbg("==> exec seq %llu [%d] working at '%s'", msg->seqnum, pid, msg->devpath); + sysinfo(&info); + info("seq %llu forked, pid %d, %ld seconds old", + msg->seqnum, pid, info.uptime - msg->queue_time); msg->pid = pid; } } @@ -299,32 +316,43 @@ static int compare_devpath(const char *running, const char *waiting) } /* returns still running task for the same device, its parent or its physical device */ -static struct uevent_msg *running_with_devpath(struct uevent_msg *msg) +static int running_with_devpath(struct uevent_msg *msg, int limit) { struct uevent_msg *loop_msg; + int childs_count = 0; if (msg->devpath == NULL) - return NULL; + return 0; /* skip any events with a timeout set */ - if (msg->timeout) - return NULL; + if (msg->timeout != 0) + return 0; list_for_each_entry(loop_msg, &running_list, node) { + if (limit && childs_count++ > limit) { + dbg("%llu, maximum number (%i) of child reached", msg->seqnum, childs_count); + return 1; + } if (loop_msg->devpath == NULL) continue; /* return running parent/child device event */ - if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) - return loop_msg; + if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { + dbg("%llu, child device event still running %llu (%s)", + msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + return 2; + } /* return running physical device event */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) - if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) - return loop_msg; + if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { + dbg("%llu, physical device event still running %llu (%s)", + msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + return 3; + } } - return NULL; + return 0; } /* exec queue management routine executes the events and serializes events in the same sequence */ @@ -332,36 +360,33 @@ static void exec_queue_manager(void) { struct uevent_msg *loop_msg; struct uevent_msg *tmp_msg; - struct uevent_msg *msg; int running; running = running_processes(); dbg("%d processes runnning on system", running); if (running < 0) - running = THROTTLE_MAX_RUNNING_CHILDS; + running = max_childs_running; list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, node) { /* check running processes in our session and possibly throttle */ - if (running >= THROTTLE_MAX_RUNNING_CHILDS) { - running = running_processes_in_session(sid, THROTTLE_MAX_RUNNING_CHILDS+10); - dbg("%d processes running in session", running); - if (running >= THROTTLE_MAX_RUNNING_CHILDS) { - dbg("delay seq %llu, cause too many processes already running", loop_msg->seqnum); + if (running >= max_childs_running) { + running = running_processes_in_session(sid, max_childs_running+10); + dbg("at least %d processes running in session", running); + if (running >= max_childs_running) { + dbg("delay seq %llu, cause too many processes already running", + loop_msg->seqnum); return; } } - msg = running_with_devpath(loop_msg); - if (!msg) { + if (running_with_devpath(loop_msg, max_childs) == 0) { /* move event to run list */ list_move_tail(&loop_msg->node, &running_list); execute_udev(loop_msg); running++; dbg("moved seq %llu to running list", loop_msg->seqnum); - } else { - dbg("delay seq %llu (%s), cause seq %llu (%s) is still running", - loop_msg->seqnum, loop_msg->devpath, msg->seqnum, msg->devpath); - } + } else + dbg("delay seq %llu (%s)", loop_msg->seqnum, loop_msg->devpath); } } @@ -381,11 +406,11 @@ static void msg_queue_manager(void) struct uevent_msg *tmp_msg; struct sysinfo info; long msg_age = 0; - static int timeout = EVENT_INIT_TIMEOUT_SEC; - static int init = 1; + int timeout = event_timeout; dbg("msg queue manager, next expected is %llu", expected_seqnum); recheck: + sysinfo(&info); list_for_each_entry_safe(loop_msg, tmp_msg, &msg_list, node) { /* move event with expected sequence to the exec list */ if (loop_msg->seqnum == expected_seqnum) { @@ -393,15 +418,13 @@ recheck: continue; } - /* see if we are in the initialization phase and wait for the very first events */ - if (init && (info.uptime - startup_time >= INIT_TIME_SEC)) { - init = 0; - timeout = EVENT_TIMEOUT_SEC; - dbg("initialization phase passed, set timeout to %i seconds", EVENT_TIMEOUT_SEC); + /* limit timeout during initialization phase */ + if (init_phase) { + timeout = UDEVD_INIT_EVENT_TIMEOUT; + dbg("initialization phase, limit timeout to %i seconds", UDEVD_INIT_EVENT_TIMEOUT); } /* move event with expired timeout to the exec list */ - sysinfo(&info); msg_age = info.uptime - loop_msg->queue_time; dbg("seq %llu is %li seconds old", loop_msg->seqnum, msg_age); if (msg_age >= timeout) { @@ -629,10 +652,12 @@ static void udev_done(int pid) { /* find msg associated with pid and delete it */ struct uevent_msg *msg; + struct sysinfo info; list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { - dbg("<== exec seq %llu came back", msg->seqnum); + sysinfo(&info); + info("seq %llu exit, %ld sec old", msg->seqnum, info.uptime - msg->queue_time); run_queue_delete(msg); /* we want to run the exec queue manager since there may @@ -734,13 +759,12 @@ static int init_uevent_nl_sock(void) int main(int argc, char *argv[], char *envp[]) { - struct sysinfo info; int maxsockplus; int retval; int fd; struct sigaction act; fd_set readfds; - const char *udevd_expected_seqnum; + const char *value; int uevent_nl_active = 0; logging_init("udevd"); @@ -774,7 +798,6 @@ int main(int argc, char *argv[], char *envp[]) sid = setsid(); dbg("our session is %d", sid); - /* make sure we don't lock any path */ chdir("/"); umask(umask(077) | 022); @@ -840,23 +863,43 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - /* possible override of udev binary, used for testing */ + /* override of forked udev binary, used for testing */ udev_bin = getenv("UDEV_BIN"); if (udev_bin != NULL) info("udev binary is set to '%s'", udev_bin); else udev_bin = UDEV_BIN; - /* possible init of expected_seqnum value */ - udevd_expected_seqnum = getenv("UDEVD_EXPECTED_SEQNUM"); - if (udevd_expected_seqnum != NULL) { - expected_seqnum = strtoull(udevd_expected_seqnum, NULL, 10); + /* init of expected_seqnum value */ + value = getenv("UDEVD_EXPECTED_SEQNUM"); + if (value) { + expected_seqnum = strtoull(value, NULL, 10); info("initialize expected_seqnum to %llu", expected_seqnum); } - /* get current time to provide shorter timeout on startup */ - sysinfo(&info); - startup_time = info.uptime; + /* timeout to wait for missing events */ + value = getenv("UDEVD_EVENT_TIMEOUT"); + if (value) + event_timeout = strtoul(value, NULL, 10); + else + event_timeout = UDEVD_EVENT_TIMEOUT; + info("initialize event_timeout to %u", event_timeout); + + /* maximum limit of forked childs */ + value = getenv("UDEVD_MAX_CHILDS"); + if (value) + max_childs = strtoul(value, NULL, 10); + else + max_childs = UDEVD_MAX_CHILDS; + info("initialize max_childs to %u", max_childs); + + /* start to throttle forking if maximum number of _running_ childs is reached */ + value = getenv("UDEVD_MAX_CHILDS_RUNNING"); + if (value) + max_childs_running = strtoull(value, NULL, 10); + else + max_childs_running = UDEVD_MAX_CHILDS_RUNNING; + info("initialize max_childs_running to %u", max_childs_running); FD_ZERO(&readfds); FD_SET(udevd_sock, &readfds); @@ -893,7 +936,7 @@ int main(int argc, char *argv[], char *envp[]) msg = get_uevent_msg(); if (msg) { msg_queue_insert(msg); - /* disable udevsend with first netlink message */ + /* disable kernel uevent_helper with first netlink message */ if (!uevent_nl_active) { info("uevent_nl message received, disable uevent_helper messages"); uevent_nl_active = 1; diff --git a/udevd.h b/udevd.h index b782d7aacd..60732fe052 100644 --- a/udevd.h +++ b/udevd.h @@ -26,21 +26,23 @@ #define UDEV_MAGIC "udevd_" UDEV_VERSION #define UDEVD_SOCK_PATH "udevd" -#define SEND_WAIT_MAX_SECONDS 3 -#define SEND_WAIT_LOOP_PER_SECOND 10 +#define UDEVSEND_WAIT_MAX_SECONDS 3 +#define UDEVSEND_WAIT_LOOP_PER_SECOND 10 #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 /* duration of initialization phase with shorter timeout */ -#define INIT_TIME_SEC 5 -#define EVENT_INIT_TIMEOUT_SEC 2 +#define UDEVD_INIT_TIME 5 +#define UDEVD_INIT_EVENT_TIMEOUT 2 /* timeout to wait for missing events */ -#define EVENT_TIMEOUT_SEC 10 +#define UDEVD_EVENT_TIMEOUT 5 +/* maximum limit of runnig childs */ +#define UDEVD_MAX_CHILDS 64 /* start to throttle forking if maximum number of running childs in our session is reached */ -#define THROTTLE_MAX_RUNNING_CHILDS 10 +#define UDEVD_MAX_CHILDS_RUNNING 8 /* environment buffer, should match the kernel's size in lib/kobject_uevent.h */ #define UEVENT_BUFFER_SIZE 1024 diff --git a/udevsend.c b/udevsend.c index 2b92e659e2..888a88daa0 100644 --- a/udevsend.c +++ b/udevsend.c @@ -185,7 +185,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("usend_msg_len=%i", usend_msg_len); /* If we can't send, try to start daemon and resend message */ - loop = SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND; + loop = UDEVSEND_WAIT_MAX_SECONDS * UDEVSEND_WAIT_LOOP_PER_SECOND; while (--loop) { retval = sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen); if (retval != -1) { @@ -208,8 +208,8 @@ int main(int argc, char *argv[], char *envp[]) dbg("udevd daemon started"); started_daemon = 1; } else { - dbg("retry to connect %d", SEND_WAIT_MAX_SECONDS * SEND_WAIT_LOOP_PER_SECOND - loop); - usleep(1000 * 1000 / SEND_WAIT_LOOP_PER_SECOND); + dbg("retry to connect %d", UDEVSEND_WAIT_MAX_SECONDS * UDEVSEND_WAIT_LOOP_PER_SECOND - loop); + usleep(1000 * 1000 / UDEVSEND_WAIT_LOOP_PER_SECOND); } } -- cgit v1.2.3-54-g00ecf From c974742bf4d6d8fab1e1c90e2e57dae0a2f297a1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 04:57:03 +0200 Subject: udev: allow final assignments := The use of KEY:= will make the key unchangeable by later rules. Signed-off-by: Kay Sievers --- test/udev-test.pl | 23 +++++++++++++++++++++++ udev.h | 5 +++++ udev_rules.c | 20 +++++++++++++++----- udev_rules.h | 6 ++++++ udev_rules_parse.c | 11 +++++++++++ 5 files changed, 60 insertions(+), 5 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 3172d3302f..27fe35456e 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1304,6 +1304,29 @@ EOF KERNEL=="sda", NAME="ok2", RUN+="/bin/ln -s ok2 %r/testsymlink2" KERNEL=="sda", ACTION=="remove", RUN+="/bin/rm -f %r/testsymlink2" KERNEL=="sda", NAME="not-ok2" +EOF + }, + { + desc => "final assignment", + subsys => "block", + devpath => "/block/sda", + exp_name => "ok", + exp_perms => "root:nobody:0640", + rules => < "final assignment", + subsys => "block", + devpath => "/block/sda", + exp_name => "ok", + exp_perms => "root:nobody:0640", + rules => <mode != 0000) { + if (!udev->mode_final && rule->mode != 0000) { + if (rule->mode_operation == KEY_OP_ASSIGN_FINAL) + udev->mode_final = 1; udev->mode = rule->mode; dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name); } - if (rule->owner[0] != '\0') { + if (!udev->owner_final && rule->owner[0] != '\0') { + if (rule->owner_operation == KEY_OP_ASSIGN_FINAL) + udev->owner_final = 1; strlcpy(udev->owner, rule->owner, sizeof(udev->owner)); apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name); } - if (rule->group[0] != '\0') { + if (!udev->group_final && rule->group[0] != '\0') { + if (rule->group_operation == KEY_OP_ASSIGN_FINAL) + udev->group_final = 1; strlcpy(udev->group, rule->group, sizeof(udev->group)); apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); } /* collect symlinks */ - if (rule->symlink[0] != '\0') { + if (!udev->symlink_final && rule->symlink[0] != '\0') { char temp[PATH_SIZE]; char *pos, *next; + if (rule->symlink_operation == KEY_OP_ASSIGN_FINAL) + udev->symlink_final = 1; info("configured rule in '%s[%i]' applied, added symlink '%s'", rule->config_file, rule->config_line, rule->symlink); strlcpy(temp, rule->symlink, sizeof(temp)); @@ -808,9 +816,11 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d udev->name, udev->owner, udev->group, udev->mode, udev->partitions); } - if (rule->run[0] != '\0') { + if (!udev->run_final && rule->run[0] != '\0') { char program[PATH_SIZE]; + if (rule->run_operation == KEY_OP_ASSIGN_FINAL) + udev->run_final = 1; strlcpy(program, rule->run, sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); dbg("add run '%s'", program); diff --git a/udev_rules.h b/udev_rules.h index 5fba2d5571..f4a74bba45 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -62,6 +62,7 @@ enum key_operation { KEY_OP_NOMATCH, KEY_OP_ADD, KEY_OP_ASSIGN, + KEY_OP_ASSIGN_FINAL, }; struct key_pair { @@ -96,10 +97,15 @@ struct udev_rule { char name[PATH_SIZE]; char symlink[PATH_SIZE]; + enum key_operation symlink_operation; char owner[USER_SIZE]; + enum key_operation owner_operation; char group[USER_SIZE]; + enum key_operation group_operation; mode_t mode; + enum key_operation mode_operation; char run[PATH_SIZE]; + enum key_operation run_operation; int last_rule; int ignore_device; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index e665957b81..3f07521ccb 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -89,6 +89,8 @@ static int get_key(char **line, char **key, enum key_operation *operation, char break; if (linepos[0] == '!') break; + if (linepos[0] == ':') + break; } /* remember end of key */ @@ -115,6 +117,10 @@ static int get_key(char **line, char **key, enum key_operation *operation, char *operation = KEY_OP_ASSIGN; linepos++; dbg("operator=assign"); + } else if (linepos[0] == ':' && linepos[1] == '=') { + *operation = KEY_OP_ASSIGN_FINAL; + linepos += 2; + dbg("operator=assign_final"); } else return -1; @@ -364,30 +370,35 @@ static int rules_parse(const char *filename) if (strcasecmp(key, KEY_SYMLINK) == 0) { strlcpy(rule.symlink, value, sizeof(rule.symlink)); + rule.symlink_operation = operation; valid = 1; continue; } if (strcasecmp(key, KEY_OWNER) == 0) { strlcpy(rule.owner, value, sizeof(rule.owner)); + rule.owner_operation = operation; valid = 1; continue; } if (strcasecmp(key, KEY_GROUP) == 0) { strlcpy(rule.group, value, sizeof(rule.group)); + rule.group_operation = operation; valid = 1; continue; } if (strcasecmp(key, KEY_MODE) == 0) { rule.mode = strtol(value, NULL, 8); + rule.mode_operation = operation; valid = 1; continue; } if (strcasecmp(key, KEY_RUN) == 0) { strlcpy(rule.run, value, sizeof(rule.run)); + rule.run_operation = operation; valid = 1; continue; } -- cgit v1.2.3-54-g00ecf From 6a522681e1438bbd9c317654cc35d5d206d378ad Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 05:11:29 +0200 Subject: udev: move dev.d/ handling to external helper Modern rules are expected to call notification and postprocessing with the RUN key. For compatibility the current behavior can be emulated with an external helper. Signed-off-by: Kay Sievers --- etc/udev/udev.rules | 51 ++++++++++----------- etc/udev/udev.rules.examples | 63 +++++++++++-------------- extras/run_directory/Makefile | 55 ++++++++++++++++++++++ extras/run_directory/run_directory.c | 79 ++++++++++++++++++++++++++++++++ extras/run_directory/udev_run_devd.c | 78 +++++++++++++++++++++++++++++++ extras/run_directory/udev_run_hotplugd.c | 79 ++++++++++++++++++++++++++++++++ test/simple-build-check.sh | 2 +- udev.c | 4 -- udev.h | 1 - udev_config.c | 37 --------------- udev_utils.c | 32 +++++++++++++ udev_utils.h | 2 + udevstart.c | 4 -- 13 files changed, 378 insertions(+), 109 deletions(-) create mode 100644 extras/run_directory/Makefile create mode 100644 extras/run_directory/run_directory.c create mode 100644 extras/run_directory/udev_run_devd.c create mode 100644 extras/run_directory/udev_run_hotplugd.c diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules index bc8c8bdd6c..bebf74802f 100644 --- a/etc/udev/udev.rules +++ b/etc/udev/udev.rules @@ -5,43 +5,42 @@ # # if this is a ide cdrom, name it the default name, and create a symlink to cdrom -BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" - -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" +BUS=="ide", KERNEL=="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK+="cdrom" # DRI devices always go into a subdirectory (as per the LSB spec) -KERNEL="card*", NAME="dri/card%n" +KERNEL=="card*", NAME="dri/card%n" # alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midiC[D0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hw[CD0-9]*", NAME="snd/%k" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" # input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse*", NAME="input/%k" -KERNEL="event*", NAME="input/%k" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse*", NAME="input/%k" +KERNEL=="event*", NAME="input/%k" +KERNEL=="js*", NAME="input/%k" +KERNEL=="ts*", NAME="input/%k" # USB devices -KERNEL="hiddev*", NAME="usb/%k" -KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k" -KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="auer*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k" +KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" # CAPI devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi*", NAME="capi/%n" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" # Network devices -KERNEL="tun", NAME="net/%k" +KERNEL=="tun", NAME="net/%k" # raw devices -KERNEL="raw[0-9]*", NAME="raw/%k" +KERNEL=="raw[0-9]*", NAME="raw/%k" + +# emulate dev.d/ +RUN="/sbin/udev_run_devd" diff --git a/etc/udev/udev.rules.examples b/etc/udev/udev.rules.examples index a464b6ba57..1c4527891a 100644 --- a/etc/udev/udev.rules.examples +++ b/etc/udev/udev.rules.examples @@ -9,64 +9,55 @@ # # Looking for scsi bus id 42:0:0:1 -BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c" +BUS=="scsi", PROGRAM="/bin/echo -n test-%b", RESULT=="test-42:0:0:1", NAME="%c" # A usb camera. -BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n" +BUS=="usb", SYSFS{vendor}=="FUJIFILM", SYSFS{model}=="M100", NAME="camera%n" # USB Epson printer to be called lp_epson -BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson" +BUS=="usb", SYSFS_serial=="HXOLL0012202323480", NAME="lp_epson" # USB HP printer to be called lp_hp -BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_hp" +BUS=="usb", SYSFS{serial}=="W09090207101241330", NAME="lp_hp" # sound card with PCI bus id 00:0b.0 to be the first sound card -BUS="pci", ID="00:0b.0", NAME="dsp" +BUS=="pci", ID=="00:0b.0", NAME="dsp" # sound card with PCI bus id 00:07.1 to be the second sound card -BUS="pci", ID="00:07.1", NAME="dsp1" - -# USB mouse plugged into the third port of the first hub to be called mouse0 -BUS="usb", PLACE="1.3", NAME="mouse0" - -# USB tablet plugged into the third port of the second hub to be called mouse1 -BUS="usb", PLACE="2.3", NAME="mouse1" -BUS="usb", PLACE="2.4", NAME="mouse2" +BUS=="pci", ID=="00:07.1", NAME="dsp1" # ttyUSB1 should always be called visor -KERNEL="ttyUSB1", NAME="visor" -KERNEL="ttyUSB0", NAME="pl2303" +KERNEL=="ttyUSB1", NAME="visor" +KERNEL=="ttyUSB0", NAME="pl2303" # a devfs like way to name some tty devices -KERNEL="ttyS*", NAME="tts/%n" -KERNEL="tty*", NAME="vc/%n" +KERNEL=="ttyS*", NAME="tts/%n" +KERNEL=="tty*", NAME="vc/%n" # if this is a ide cdrom, name it the default name, and create a symlink to cdrom -BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" - -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" +BUS=="ide", KERNEL=="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom", NAME="%k", SYMLINK+="cdrom" # DRI devices always go into a subdirectory (as per the LSB spec) -KERNEL="card*", NAME="dri/card%n" +KERNEL=="card*", NAME="dri/card%n" # create all 15 partitions of a USB flash card reader -# note the trailing spaces in the attribute, use udevinfo(8) to examine your device -BUS="scsi", SYSFS{model}="CF/MD ", NAME{all_partitions}="compactflash" +BUS=="scsi", SYSFS{model}=="CF/MD", NAME{all_partitions}="compactflash" # alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hw[CD0-9]*", NAME="snd/%k" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL=="midi[CD0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" # input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse*", NAME="input/%k" -KERNEL="event*", NAME="input/%k" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse*", NAME="input/%k" +KERNEL=="event*", NAME="input/%k" +KERNEL=="js*", NAME="input/%k" +KERNEL=="ts*", NAME="input/%k" + +# emulate dev.d/ +RUN="/sbin/udev_run_devd" diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile new file mode 100644 index 0000000000..12dccf0749 --- /dev/null +++ b/extras/run_directory/Makefile @@ -0,0 +1,55 @@ +# Makefile for udev_volume_id +# +# Copyright (C) 2004 Kay Sievers +# +# 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. +# + +DEVD = udev_run_devd +HOTPLUGD = udev_run_hotplugd + +all: $(DEVD) $(HOTPLUGD) + +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin +mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +override CFLAGS+=-D_FILE_OFFSET_BITS=64 + +OBJS = ../../udev.a ../../libsysfs/sysfs.a + +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + +$(DEVD): $(HEADERS) $(DEVD).o run_directory.o + $(QUIET) $(LD) $(LDFLAGS) -o $(DEVD) $(DEVD).o run_directory.o $(OBJS) + +$(HOTPLUGD): $(HEADERS) $(HOTPLUGD).o run_directory.o + $(QUIET) $(LD) $(LDFLAGS) -o $(HOTPLUGD) $(HOTPLUGD).o run_directory.o $(OBJS) + +clean: + rm -f $(DEVD) $(HOTPLUGD) run_directory.o + +spotless: clean + +install: all + $(INSTALL_PROGRAM) $(DEVD) $(DESTDIR)$(sbindir)/$(DEVD) + $(INSTALL_PROGRAM) $(HOTPLUGD) $(DESTDIR)$(sbindir)/$(HOTPLUGD) + +uninstall: + - rm $(DESTDIR)$(sbindir)/$(DEVD) diff --git a/extras/run_directory/run_directory.c b/extras/run_directory/run_directory.c new file mode 100644 index 0000000000..e6c6173eca --- /dev/null +++ b/extras/run_directory/run_directory.c @@ -0,0 +1,79 @@ +/* + * udev_run_directory.c - directory multiplexer + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../udev_utils.h" +#include "../../list.h" +#include "../../logging.h" + +int run_directory(const char *dir, const char *suffix, const char *subsystem); + +static int run_program(const char *filename, const char *subsystem) +{ + pid_t pid; + + dbg("running %s", filename); + pid = fork(); + switch (pid) { + case 0: + /* child */ + execl(filename, filename, subsystem, NULL); + dbg("exec of child failed"); + _exit(1); + case -1: + dbg("fork of child failed"); + break; + return -1; + default: + waitpid(pid, NULL, 0); + } + + return 0; +} + +int run_directory(const char *dir, const char *suffix, const char *subsystem) +{ + char dirname[NAME_SIZE]; + struct name_entry *name_loop, *name_tmp; + LIST_HEAD(name_list); + + if (subsystem) { + snprintf(dirname, sizeof(dirname), "%s/%s", dir, subsystem); + dirname[sizeof(dirname)-1] = '\0'; + dbg("looking at '%s'", dirname); + add_matching_files(&name_list, dirname, suffix); + } + + snprintf(dirname, sizeof(dirname), "%s/default", dir); + dirname[sizeof(dirname)-1] = '\0'; + dbg("looking at '%s'", dirname); + add_matching_files(&name_list, dirname, suffix); + + list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { + run_program(name_loop->name, subsystem); + list_del(&name_loop->node); + } + + logging_close(); + return 0; +} diff --git a/extras/run_directory/udev_run_devd.c b/extras/run_directory/udev_run_devd.c new file mode 100644 index 0000000000..02bbc8c353 --- /dev/null +++ b/extras/run_directory/udev_run_devd.c @@ -0,0 +1,78 @@ +/* + * udev_run_devd.c - directory multiplexer + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../udev_utils.h" +#include "../../list.h" +#include "../../logging.h" + +extern int run_directory(const char *dir, const char *suffix, const char *subsystem); + +#ifdef USE_LOG +void log_message (int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +int main(int argc, char *argv[], char *envp[]) +{ + const char *subsystem; + int fd; + + if (getenv("DEVNAME") == NULL) + exit(0); + + subsystem = argv[1]; + logging_init("udev_run_devd"); + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDOUT_FILENO); + dup2(fd, STDIN_FILENO); + dup2(fd, STDERR_FILENO); + close(fd); + } + dbg("running dev.d directory"); + + run_directory("/etc/dev.d", ".dev", subsystem); + exit(0); +} diff --git a/extras/run_directory/udev_run_hotplugd.c b/extras/run_directory/udev_run_hotplugd.c new file mode 100644 index 0000000000..463473d7c7 --- /dev/null +++ b/extras/run_directory/udev_run_hotplugd.c @@ -0,0 +1,79 @@ +/* + * udev_run_hotplugd.c - directory multiplexer + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../udev_utils.h" +#include "../../list.h" +#include "../../logging.h" + +extern int run_directory(const char *dir, const char *suffix, const char *subsystem); + +#ifdef USE_LOG +void log_message (int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +int main(int argc, char *argv[], char *envp[]) +{ + const char *subsystem; + int fd; + + if (getenv("DEVNAME") == NULL) + exit(0); + + subsystem = argv[1]; + logging_init("udev_run_hotplugd"); + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDOUT_FILENO); + dup2(fd, STDIN_FILENO); + dup2(fd, STDERR_FILENO); + close(fd); + } + + dbg("running dev.d directory"); + + run_directory("/etc/hotplug.d", ".hotplug", subsystem); + exit(0); +} diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index d1e13e69ed..b653185b26 100644 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -1,6 +1,6 @@ #/bin/sh -EXTRAS="extras/chassis_id extras/scsi_id extras/volume_id" +EXTRAS="extras/chassis_id extras/scsi_id extras/volume_id extras/run_directory" [ -z "$KERNEL_DIR" ] && KERNEL_DIR=/lib/modules/`uname -r`/build echo KERNEL_DIR: "$KERNEL_DIR" diff --git a/udev.c b/udev.c index 2be4c35740..999d25d4e5 100644 --- a/udev.c +++ b/udev.c @@ -219,10 +219,6 @@ int main(int argc, char *argv[], char *envp[]) execute_command(name_loop->name, udev.subsystem); } - /* run dev.d/ scripts if we created/deleted a node or changed a netif name */ - if (udev_dev_d && udev.devname[0] != '\0') - udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); - } else if (udev.type == DEV_DEVICE) { if (strcmp(action, "add") == 0) { /* wait for sysfs */ diff --git a/udev.h b/udev.h index c6f26b3bfb..2c3377ad2e 100644 --- a/udev.h +++ b/udev.h @@ -102,7 +102,6 @@ extern char udev_config_filename[PATH_SIZE]; extern char udev_rules_filename[PATH_SIZE]; extern int udev_log_priority; extern int udev_run; -extern int udev_dev_d; extern int udev_hotplug_d; #endif diff --git a/udev_config.c b/udev_config.c index 6bc070d63a..0701d37e84 100644 --- a/udev_config.c +++ b/udev_config.c @@ -45,40 +45,8 @@ char udev_config_filename[PATH_SIZE]; char udev_rules_filename[PATH_SIZE]; int udev_log_priority; int udev_run; -int udev_dev_d; int udev_hotplug_d; -static int string_is_true(const char *str) -{ - if (strcasecmp(str, "true") == 0) - return 1; - if (strcasecmp(str, "yes") == 0) - return 1; - if (strcasecmp(str, "1") == 0) - return 1; - return 0; -} - -static int log_priority(const char *priority) -{ - char *endptr; - int prio; - - prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0') - return prio; - if (strncasecmp(priority, "err", 3) == 0) - return LOG_ERR; - if (strcasecmp(priority, "info") == 0) - return LOG_INFO; - if (strcasecmp(priority, "debug") == 0) - return LOG_DEBUG; - if (string_is_true(priority)) - return LOG_ERR; - - return 0; -} - static int get_key(char **line, char **key, char **value) { char *linepos; @@ -219,7 +187,6 @@ void udev_init_config(void) strcpy(udev_rules_filename, UDEV_RULES_FILE); udev_log_priority = LOG_ERR; udev_run = 1; - udev_dev_d = 1; udev_hotplug_d = 1; sysfs_get_mnt_path(sysfs_path, sizeof(sysfs_path)); @@ -228,10 +195,6 @@ void udev_init_config(void) if (env && !string_is_true(env)) udev_run = 0; - env = getenv("UDEV_NO_DEVD"); - if (env && string_is_true(env)) - udev_dev_d = 0; - env = getenv("UDEV_NO_HOTPLUGD"); if (env && string_is_true(env)) udev_hotplug_d = 0; diff --git a/udev_utils.c b/udev_utils.c index 74b55ed406..70b20e3a28 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -109,6 +110,37 @@ void udev_cleanup_device(struct udevice *udev) } } +int string_is_true(const char *str) +{ + if (strcasecmp(str, "true") == 0) + return 1; + if (strcasecmp(str, "yes") == 0) + return 1; + if (strcasecmp(str, "1") == 0) + return 1; + return 0; +} + +int log_priority(const char *priority) +{ + char *endptr; + int prio; + + prio = strtol(priority, &endptr, 10); + if (endptr[0] == '\0') + return prio; + if (strncasecmp(priority, "err", 3) == 0) + return LOG_ERR; + if (strcasecmp(priority, "info") == 0) + return LOG_INFO; + if (strcasecmp(priority, "debug") == 0) + return LOG_DEBUG; + if (string_is_true(priority)) + return LOG_ERR; + + return 0; +} + int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel) { static unsigned int kversion = 0; diff --git a/udev_utils.h b/udev_utils.h index 9cdae6db57..b3e604fb98 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -34,6 +34,8 @@ extern void udev_cleanup_device(struct udevice *udev); extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); extern int create_path(const char *path); +extern int log_priority(const char *priority); +extern int string_is_true(const char *str); extern int parse_get_pair(char **orig_string, char **left, char **right); extern int unlink_secure(const char *filename); extern int file_map(const char *filename, char **buf, size_t *bufsize); diff --git a/udevstart.c b/udevstart.c index 60e63c5ad8..34f3835d65 100644 --- a/udevstart.c +++ b/udevstart.c @@ -137,10 +137,6 @@ static int add_device(const char *path, const char *subsystem) execute_command(name_loop->name, udev.subsystem); } - /* run dev.d/ scripts if we created a node or changed a netif name */ - if (udev_dev_d && udev.devname[0] != '\0') - udev_multiplex_directory(&udev, DEVD_DIR, DEVD_SUFFIX); - sysfs_close_class_device(class_dev); udev_cleanup_device(&udev); -- cgit v1.2.3-54-g00ecf From 995aec875973e29caf42b037736349fc8839ee40 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 05:13:33 +0200 Subject: udev: clear lists if a new value is assigned Former values are cleared if SYMLINK= is used. To add a value SYMLINK+= is now needed. Signed-off-by: Kay Sievers --- test/udev-test.pl | 63 ++++++++++++++++++++++++++++++++++++------------------- udev_rules.c | 18 ++++++++++++++++ udev_utils.c | 4 ++++ 3 files changed, 64 insertions(+), 21 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 27fe35456e..884abf9e8b 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -783,9 +783,9 @@ EOF exp_name => "symlink-only2", exp_target => "link", rules => < "yes", exp_rem_error => "yes", rules => < "yes", option => "clean", rules => < "symlink0", exp_target => "ttyUSB0", rules => < "symlink-ttyUSB0", exp_target => "ttyUSB0", rules => < "major-188:0", exp_target => "ttyUSB0", rules => < "symlink-0:0:0:0", exp_target => "node", rules => < "test", exp_target => "ttyUSB0", rules => < "test", exp_target => "ttyUSB0", rules => < "this", exp_target => "ttyUSB0", rules => < "test", exp_target => "link", rules => < "188:0", exp_target => "ttyUSB0", rules => < "188", exp_target => "ttyUSB0", rules => < "percent%sign", exp_target => "ttyUSB0", rules => < "%ttyUSB0_name", exp_target => "ttyUSB0", rules => < "link1", exp_target => "node", rules => < "link4", exp_target => "node", rules => < "/block/sda/sda1", exp_name => "last", rules => < "reset list to current value", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "three", + not_exp_name => "two", + exp_target => "node", + rules => <{exp_name}"); + if (defined($rules->{not_exp_name})) { + if ((-e "$PWD/$udev_root$rules->{not_exp_name}") || + (-l "$PWD/$udev_root$rules->{not_exp_name}")) { + print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; + $error++ + } + } if (defined($rules->{exp_perms})) { permissions_test($rules, $uid, $gid, $mode); } diff --git a/udev_rules.c b/udev_rules.c index 42509f16ce..631cc4270a 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -782,6 +782,15 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d if (rule->symlink_operation == KEY_OP_ASSIGN_FINAL) udev->symlink_final = 1; + else if (rule->symlink_operation == KEY_OP_ASSIGN) { + struct name_entry *name_loop; + struct name_entry *temp_loop; + + list_for_each_entry_safe(name_loop, temp_loop, &udev->symlink_list, node) { + list_del(&name_loop->node); + free(name_loop); + } + } info("configured rule in '%s[%i]' applied, added symlink '%s'", rule->config_file, rule->config_line, rule->symlink); strlcpy(temp, rule->symlink, sizeof(temp)); @@ -821,6 +830,15 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d if (rule->run_operation == KEY_OP_ASSIGN_FINAL) udev->run_final = 1; + else if (rule->run_operation == KEY_OP_ASSIGN) { + struct name_entry *name_loop; + struct name_entry *temp_loop; + + list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) { + list_del(&name_loop->node); + free(name_loop); + } + } strlcpy(program, rule->run, sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); dbg("add run '%s'", program); diff --git a/udev_utils.c b/udev_utils.c index 70b20e3a28..d605631088 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -108,6 +108,10 @@ void udev_cleanup_device(struct udevice *udev) list_del(&name_loop->node); free(name_loop); } + list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) { + list_del(&name_loop->node); + free(name_loop); + } } int string_is_true(const char *str) -- cgit v1.2.3-54-g00ecf From c2401132bf72cbda6555f1ef4403851c14faeba5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 05:17:21 +0200 Subject: volume_id: use udev-provided log-level Signed-off-by: Kay Sievers --- extras/volume_id/Makefile | 2 +- extras/volume_id/udev_volume_id.c | 18 ++++++++++++++++-- udev.c | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 91527cc9f5..56fdf278b9 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -33,7 +33,7 @@ override CFLAGS+=-D_FILE_OFFSET_BITS=64 VOLUME_ID_BASE=volume_id include $(VOLUME_ID_BASE)/Makefile.inc -OBJS = udev_volume_id.o $(VOLUME_ID_OBJS) $(SYSFS) +OBJS = udev_volume_id.o $(VOLUME_ID_OBJS) ../../udev.a HEADERS = $(VOLUME_ID_HEADERS) $(OBJS): $(HEADERS) diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c index a00b01a27d..7c6fc4050d 100644 --- a/extras/volume_id/udev_volume_id.c +++ b/extras/volume_id/udev_volume_id.c @@ -40,12 +40,26 @@ #define BLKGETSIZE64 _IOR(0x12,114,size_t) #ifdef USE_LOG -void log_message(int level, const char *format, ...) +void log_message(int priority, const char *format, ...) { va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; va_start(args, format); - vsyslog(level, format, args); + vsyslog(priority, format, args); va_end(args); } #endif diff --git a/udev.c b/udev.c index 999d25d4e5..3f76e98b24 100644 --- a/udev.c +++ b/udev.c @@ -152,7 +152,7 @@ int main(int argc, char *argv[], char *envp[]) goto hotplug; } - /* export logging flag, as called scripts may want to do the same as udev */ + /* export logging flag, as called programs may want to do the same as udev */ if (udev_log_priority) { char priority[32]; -- cgit v1.2.3-54-g00ecf From c07669bd663d780e4957691e488798aa0178e76b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 15:55:29 +0200 Subject: udev: handle all events - not only class and block devices Handle all events with rules. If udev is expected to handle hotplug.d/ the exernal helper must be called. Signed-off-by: Kay Sievers --- Makefile | 2 +- extras/run_directory/udev_run_hotplugd.c | 3 - udev.8.in | 28 +---- udev.c | 155 ++++++++++-------------- udev.h | 9 +- udev.spec | 3 - udev_add.c | 16 --- udev_config.c | 6 - udev_multiplex.c | 92 --------------- udev_remove.c | 26 ++-- udev_rules.c | 196 ++++++++++++------------------- udev_rules.h | 3 +- udev_rules_parse.c | 8 +- udevstart.c | 24 +++- 14 files changed, 180 insertions(+), 391 deletions(-) delete mode 100644 udev_multiplex.c diff --git a/Makefile b/Makefile index 1cf3e54fb7..d36bd5866c 100644 --- a/Makefile +++ b/Makefile @@ -143,7 +143,6 @@ UDEV_OBJS = \ udev_remove.o \ udev_sysfs.o \ udev_db.o \ - udev_multiplex.o \ udev_rules.o \ udev_rules_parse.o \ udev_libc_wrapper.o @@ -382,6 +381,7 @@ install: install-config install-man install-dev.d all - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/10-udev.hotplug ifndef DESTDIR - killall $(DAEMON) + - $(sbindir)/$(DAEMON) -d - rm -rf $(udevdb) endif @extras="$(EXTRAS)" ; for target in $$extras ; do \ diff --git a/extras/run_directory/udev_run_hotplugd.c b/extras/run_directory/udev_run_hotplugd.c index 463473d7c7..54b6bf44e3 100644 --- a/extras/run_directory/udev_run_hotplugd.c +++ b/extras/run_directory/udev_run_hotplugd.c @@ -58,9 +58,6 @@ int main(int argc, char *argv[], char *envp[]) const char *subsystem; int fd; - if (getenv("DEVNAME") == NULL) - exit(0); - subsystem = argv[1]; logging_init("udev_run_hotplugd"); diff --git a/udev.8.in b/udev.8.in index 79c4a83d16..e4c1c11af2 100644 --- a/udev.8.in +++ b/udev.8.in @@ -306,11 +306,9 @@ following the '[' is a '!', any characters not enclosed are matched. .P After device node creation, removal, or network device renaming, .B udev -executes the programs located in the directory tree under -.IR /etc/dev.d/ . -The name of a program must have the suffix -.I .dev -to be recognized. +executes the programs specified by the +.B RUN +key. .br In addition to the kernel provided hotplug environment variables, .B UDEV_LOG @@ -319,15 +317,7 @@ is set and contains the numerical priority value, if udev is configured to use Executed programs may want to follow that setting. .B DEVNAME is exported to make the name of the created node, or the name the network -device is renamed to, available to the executed program. The programs in every -directory are sorted in lexical order, while the directories are searched in -the following order: -.sp -.nf -/etc/dev.d/$(DEVNAME)/*.dev -/etc/dev.d/$(SUBSYSTEM)/*.dev -/etc/dev.d/default/*.dev -.fi +device is renamed to, available to the executed programs. .SH "ENVIRONMENT" .P The following variables are read from the environment: @@ -353,20 +343,10 @@ Overrides the log priority specified in the config file. .TP .B UDEV_RUN If set to "0", it disables the execution of programs added by rules. -.TP -.B UDEV_NO_DEVD -The default behavior of -.B udev -is to execute programs in the -.I /etc/dev.d/ -directory after device handling. If set, -.B udev -will skip this step. .SH "FILES" .nf /sbin/udev udev program /etc/udev/* udev config files -/etc/dev.d/* programs invoked by udev .fi .SH "SEE ALSO" .BR udevinfo (8), diff --git a/udev.c b/udev.c index 3f76e98b24..d623cbcc67 100644 --- a/udev.c +++ b/udev.c @@ -54,39 +54,6 @@ void log_message(int priority, const char *format, ...) } #endif -/* Decide if we should manage the whole uevent, including multiplexing - * of the hotplug directories. - * For now look if the kernel calls udevsend instead of /sbin/hotplug, - * or the uevent-helper in /proc/sys/kernel/hotplug is empty. - */ -static int manage_hotplug_event(void) { - char helper[256]; - int fd; - int len; - - /* don't handle hotplug.d if we are called directly */ - if (!getenv("UDEVD_EVENT")) - return 0; - - fd = open("/proc/sys/kernel/hotplug", O_RDONLY); - if (fd < 0) - return 0; - - len = read(fd, helper, sizeof(helper)-1); - close(fd); - - if (len < 0) - return 0; - helper[len] = '\0'; - - if (helper[0] == '\0' || helper[0] == '\n') - return 1; - if (strstr(helper, "udevsend")) - return 1; - - return 0; -} - static void asmlinkage sig_handler(int signum) { switch (signum) { @@ -100,15 +67,12 @@ static void asmlinkage sig_handler(int signum) int main(int argc, char *argv[], char *envp[]) { - struct sysfs_class_device *class_dev; - struct sysfs_device *devices_dev; struct udevice udev; char path[PATH_SIZE]; const char *error; const char *action; const char *devpath; const char *subsystem; - int managed_event; struct sigaction act; int retval = -EINVAL; @@ -133,11 +97,6 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timeout to prevent hanging processes */ alarm(ALARM_TIMEOUT); - /* let the executed programs know if we handle the whole hotplug event */ - managed_event = manage_hotplug_event(); - if (managed_event) - setenv("MANAGED_EVENT", "1", 1); - action = getenv("ACTION"); devpath = getenv("DEVPATH"); subsystem = getenv("SUBSYSTEM"); @@ -145,14 +104,12 @@ int main(int argc, char *argv[], char *envp[]) if (!subsystem && argc == 2) subsystem = argv[1]; - udev_init_device(&udev, devpath, subsystem, action); - if (!action || !subsystem || !devpath) { err("action, subsystem or devpath missing"); - goto hotplug; + goto exit; } - /* export logging flag, as called programs may want to do the same as udev */ + /* export log_level , as called programs may want to do the same as udev */ if (udev_log_priority) { char priority[32]; @@ -160,93 +117,109 @@ int main(int argc, char *argv[], char *envp[]) setenv("UDEV_LOG", priority, 1); } - if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS || udev.type == DEV_NET) { - udev_rules_init(); + udev_init_device(&udev, devpath, subsystem, action); + udev_rules_init(); + if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS || udev.type == DEV_NET) { + /* handle device node */ if (strcmp(action, "add") == 0) { - /* wait for sysfs and possibly add node */ - dbg("udev add"); - - /* skip subsystems without "dev", but handle net devices */ - if (udev.type != DEV_NET && subsystem_expect_no_dev(udev.subsystem)) { - dbg("don't care about '%s' devices", udev.subsystem); - goto hotplug; - } + struct sysfs_class_device *class_dev; + /* wait for sysfs of /sys/class /sys/block */ + dbg("node add"); snprintf(path, sizeof(path), "%s%s", sysfs_path, udev.devpath); path[sizeof(path)-1] = '\0'; class_dev = wait_class_device_open(path); if (class_dev == NULL) { dbg("open class device failed"); - goto hotplug; + goto run; } dbg("opened class_dev->name='%s'", class_dev->name); - wait_for_class_device(class_dev, &error); - /* name, create node, store in db */ - retval = udev_add_device(&udev, class_dev); - + /* get major/minor */ + if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS) { + udev.devt = get_devt(class_dev); + if (udev.devt) { + /* name device */ + udev_rules_get_name(&udev, class_dev); + if (udev.ignore_device) { + info("device event will be ignored"); + goto exit; + } + if (udev.name[0] == '\0') { + info("device node creation supressed"); + goto run; + } + + /* create node, store in db */ + retval = udev_add_device(&udev, class_dev); + } else { + dbg("no dev-file found"); + udev_rules_get_run(&udev, NULL); + if (udev.ignore_device) { + info("device event will be ignored"); + goto exit; + } + } + } sysfs_close_class_device(class_dev); } else if (strcmp(action, "remove") == 0) { - /* possibly remove a node */ - dbg("udev remove"); - - /* skip subsystems without "dev" */ - if (subsystem_expect_no_dev(udev.subsystem)) { - dbg("don't care about '%s' devices", udev.subsystem); - goto hotplug; - } - - udev_rules_get_run(&udev); + dbg("node remove"); + udev_rules_get_run(&udev, NULL); if (udev.ignore_device) { dbg("device event will be ignored"); - goto hotplug; + goto exit; } - /* get node from db, remove db-entry, delete created node */ + /* get name from db, remove db-entry, delete node */ retval = udev_remove_device(&udev); } + /* export name of device node or netif */ if (udev.devname[0] != '\0') setenv("DEVNAME", udev.devname, 1); - - if (udev_run && !list_empty(&udev.run_list)) { - struct name_entry *name_loop; - - dbg("executing run list"); - list_for_each_entry(name_loop, &udev.run_list, node) - execute_command(name_loop->name, udev.subsystem); - } - } else if (udev.type == DEV_DEVICE) { if (strcmp(action, "add") == 0) { - /* wait for sysfs */ - dbg("devices add"); + struct sysfs_device *devices_dev; + /* wait for sysfs of /sys/devices/ */ + dbg("devices add"); snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); path[sizeof(path)-1] = '\0'; devices_dev = wait_devices_device_open(path); if (!devices_dev) { dbg("devices device unavailable (probably remove has beaten us)"); - goto hotplug; + goto run; } dbg("devices device opened '%s'", path); - wait_for_devices_device(devices_dev, &error); - + udev_rules_get_run(&udev, devices_dev); sysfs_close_device(devices_dev); + if (udev.ignore_device) { + info("device event will be ignored"); + goto exit; + } } else if (strcmp(action, "remove") == 0) { dbg("devices remove"); + udev_rules_get_run(&udev, NULL); + if (udev.ignore_device) { + info("device event will be ignored"); + goto exit; + } } - } else { - dbg("unhandled"); } -hotplug: - if (udev_hotplug_d && managed_event) - udev_multiplex_directory(&udev, HOTPLUGD_DIR, HOTPLUG_SUFFIX); +run: + if (udev_run && !list_empty(&udev.run_list)) { + struct name_entry *name_loop; + + dbg("executing run list"); + list_for_each_entry(name_loop, &udev.run_list, node) + execute_command(name_loop->name, udev.subsystem); + } +exit: udev_cleanup_device(&udev); logging_close(); diff --git a/udev.h b/udev.h index 2c3377ad2e..11fbe02460 100644 --- a/udev.h +++ b/udev.h @@ -39,12 +39,6 @@ #define SEQNUM_SIZE 32 #define VALUE_SIZE 128 -#define DEVD_DIR "/etc/dev.d" -#define DEVD_SUFFIX ".dev" - -#define HOTPLUGD_DIR "/etc/hotplug.d" -#define HOTPLUG_SUFFIX ".hotplug" - #define DEFAULT_PARTITIONS_COUNT 15 enum device_type { @@ -62,6 +56,7 @@ struct udevice { enum device_type type; char name[PATH_SIZE]; + int name_set; char devname[PATH_SIZE]; struct list_head symlink_list; int symlink_final; @@ -92,7 +87,6 @@ extern int udev_add_device(struct udevice *udev, struct sysfs_class_device *clas extern int udev_remove_device(struct udevice *udev); extern void udev_init_config(void); extern int udev_start(void); -extern void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix); extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); extern char sysfs_path[PATH_SIZE]; @@ -102,6 +96,5 @@ extern char udev_config_filename[PATH_SIZE]; extern char udev_rules_filename[PATH_SIZE]; extern int udev_log_priority; extern int udev_run; -extern int udev_hotplug_d; #endif diff --git a/udev.spec b/udev.spec index 28f19565da..0430a1259d 100644 --- a/udev.spec +++ b/udev.spec @@ -112,9 +112,6 @@ rm -rf $RPM_BUILD_ROOT %attr(-,root,root) /etc/hotplug.d/default/udev.hotplug %attr(755,root,root) /etc/init.d/udev %attr(0644,root,root) %{_mandir}/man8/udev*.8* -%attr(755,root,root) %dir /etc/dev.d/ -%attr(755,root,root) %dir /etc/dev.d/net/ -%attr(0755,root,root) /etc/dev.d/net/hotplug.dev %if %{scsi_id} %attr(755,root,root) /sbin/scsi_id diff --git a/udev_add.c b/udev_add.c index 9764cb9bcd..2081e503c7 100644 --- a/udev_add.c +++ b/udev_add.c @@ -268,22 +268,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) char *pos; int retval = 0; - if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { - udev->devt = get_devt(class_dev); - if (!udev->devt) { - dbg("no dev-file found, do nothing"); - return 0; - } - } - - udev_rules_get_name(udev, class_dev); - if (udev->ignore_device) { - dbg("device event will be ignored"); - return 0; - } - dbg("adding name='%s'", udev->name); - selinux_init(); if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { @@ -325,6 +310,5 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) exit: selinux_exit(); - return retval; } diff --git a/udev_config.c b/udev_config.c index 0701d37e84..773ee67f9e 100644 --- a/udev_config.c +++ b/udev_config.c @@ -45,7 +45,6 @@ char udev_config_filename[PATH_SIZE]; char udev_rules_filename[PATH_SIZE]; int udev_log_priority; int udev_run; -int udev_hotplug_d; static int get_key(char **line, char **key, char **value) { @@ -187,7 +186,6 @@ void udev_init_config(void) strcpy(udev_rules_filename, UDEV_RULES_FILE); udev_log_priority = LOG_ERR; udev_run = 1; - udev_hotplug_d = 1; sysfs_get_mnt_path(sysfs_path, sizeof(sysfs_path)); /* disable RUN key execution */ @@ -195,10 +193,6 @@ void udev_init_config(void) if (env && !string_is_true(env)) udev_run = 0; - env = getenv("UDEV_NO_HOTPLUGD"); - if (env && string_is_true(env)) - udev_hotplug_d = 0; - env = getenv("UDEV_CONFIG_FILE"); if (env) { strlcpy(udev_config_filename, env, sizeof(udev_config_filename)); diff --git a/udev_multiplex.c b/udev_multiplex.c deleted file mode 100644 index 22bbaf7b61..0000000000 --- a/udev_multiplex.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * udev_multiplex.c directory multiplexer - * - * Copyright (C) 2004 Greg Kroah-Hartman - * - * 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 essentially emulates the following shell script logic in C: - * DIR="/etc/dev.d" - * export DEVNAME="whatever_dev_name_udev_just_gave" - * for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do - * if [ -f $I ]; then $I $1 ; fi - * done - * exit 1; - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_libc_wrapper.h" -#include "udev_utils.h" -#include "logging.h" - - -/* - * runs files in these directories in order: - * / - * subsystem/ - * default/ - */ -void udev_multiplex_directory(struct udevice *udev, const char *basedir, const char *suffix) -{ - char dirname[PATH_SIZE]; - struct name_entry *name_loop, *name_tmp; - LIST_HEAD(name_list); - - /* chop the device name up into pieces based on '/' */ - if (udev->name[0] != '\0') { - char devname[PATH_SIZE]; - char *temp; - - strlcpy(devname, udev->name, sizeof(devname)); - temp = strchr(devname, '/'); - while (temp != NULL) { - temp[0] = '\0'; - - /* don't call the subsystem directory here */ - if (strcmp(devname, udev->subsystem) != 0) { - snprintf(dirname, sizeof(dirname), "%s/%s", basedir, devname); - dirname[sizeof(dirname)-1] = '\0'; - add_matching_files(&name_list, dirname, suffix); - } - - temp[0] = '/'; - ++temp; - temp = strchr(temp, '/'); - } - } - - if (udev->name[0] != '\0') { - snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->name); - dirname[sizeof(dirname)-1] = '\0'; - add_matching_files(&name_list, dirname, suffix); - } - - if (udev->subsystem[0] != '\0') { - snprintf(dirname, sizeof(dirname), "%s/%s", basedir, udev->subsystem); - dirname[sizeof(dirname)-1] = '\0'; - add_matching_files(&name_list, dirname, suffix); - } - - snprintf(dirname, sizeof(dirname), "%s/default", basedir); - dirname[sizeof(dirname)-1] = '\0'; - add_matching_files(&name_list, dirname, suffix); - - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - execute_command(name_loop->name, udev->subsystem); - list_del(&name_loop->node); - } - -} diff --git a/udev_remove.c b/udev_remove.c index 2df555327b..cf28ff37a9 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -140,26 +140,20 @@ static int delete_node(struct udevice *udev) */ int udev_remove_device(struct udevice *udev) { - const char *temp; - if (udev->type != DEV_BLOCK && udev->type != DEV_CLASS) return 0; - if (udev_db_get_device(udev, udev->devpath) == 0) { - if (udev->ignore_remove) { - dbg("remove event for '%s' requested to be ignored by rule", udev->name); - return 0; - } - dbg("remove name='%s'", udev->name); - udev_db_delete_device(udev); - } else { - /* fall back to kernel name */ - temp = strrchr(udev->devpath, '/'); - if (temp == NULL) - return -ENODEV; - strlcpy(udev->name, &temp[1], sizeof(udev->name)); - info("'%s' not found in database, falling back on default name", udev->name); + /* remove node only if we can find it in our database */ + if (udev_db_get_device(udev, udev->devpath) != 0) { + dbg("'%s' not found in database, ignore event", udev->name); + return -1; + } + if (udev->ignore_remove) { + dbg("remove event for '%s' requested to be ignored by rule", udev->name); + return 0; } + dbg("remove name='%s'", udev->name); + udev_db_delete_device(udev); /* use full path to the environment */ snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); diff --git a/udev_rules.c b/udev_rules.c index 631cc4270a..cbd76e66eb 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -731,7 +731,7 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d list_for_each_entry(rule, &udev_rule_list, node) { dbg("process rule"); if (match_rule(udev, rule, class_dev, sysfs_device) == 0) { - if (udev->name[0] != '\0' && rule->name[0] != '\0') { + if (udev->name_set && rule->name_operation != KEY_OP_UNSET) { dbg("node name already set, rule ignored"); continue; } @@ -776,73 +776,84 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d } /* collect symlinks */ - if (!udev->symlink_final && rule->symlink[0] != '\0') { + if (!udev->symlink_final && rule->symlink_operation != KEY_OP_UNSET) { char temp[PATH_SIZE]; char *pos, *next; if (rule->symlink_operation == KEY_OP_ASSIGN_FINAL) udev->symlink_final = 1; - else if (rule->symlink_operation == KEY_OP_ASSIGN) { + if (rule->symlink_operation == KEY_OP_ASSIGN || rule->symlink_operation == KEY_OP_ASSIGN_FINAL) { struct name_entry *name_loop; struct name_entry *temp_loop; + info("reset symlink list"); list_for_each_entry_safe(name_loop, temp_loop, &udev->symlink_list, node) { list_del(&name_loop->node); free(name_loop); } } - info("configured rule in '%s[%i]' applied, added symlink '%s'", - rule->config_file, rule->config_line, rule->symlink); - strlcpy(temp, rule->symlink, sizeof(temp)); - apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); - - /* add multiple symlinks separated by spaces */ - pos = temp; - next = strchr(temp, ' '); - while (next) { - next[0] = '\0'; + if (rule->symlink[0] != '\0') { + info("configured rule in '%s[%i]' applied, added symlink '%s'", + rule->config_file, rule->config_line, rule->symlink); + strlcpy(temp, rule->symlink, sizeof(temp)); + apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); + + /* add multiple symlinks separated by spaces */ + pos = temp; + next = strchr(temp, ' '); + while (next) { + next[0] = '\0'; + info("add symlink '%s'", pos); + name_list_add(&udev->symlink_list, pos, 0); + pos = &next[1]; + next = strchr(pos, ' '); + } info("add symlink '%s'", pos); name_list_add(&udev->symlink_list, pos, 0); - pos = &next[1]; - next = strchr(pos, ' '); } - info("add symlink '%s'", pos); - name_list_add(&udev->symlink_list, pos, 0); } /* set name, later rules with name set will be ignored */ - if (rule->name[0] != '\0') { - info("configured rule in '%s[%i]' applied, '%s' becomes '%s'", - rule->config_file, rule->config_line, udev->kernel_name, rule->name); - - strlcpy(udev->name, rule->name, sizeof(udev->name)); - apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); - strlcpy(udev->config_file, rule->config_file, sizeof(udev->config_file)); - udev->config_line = rule->config_line; - - if (udev->type != DEV_NET) - dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", - udev->name, udev->owner, udev->group, udev->mode, udev->partitions); + if (rule->name_operation != KEY_OP_UNSET) { + udev->name_set = 1; + if (rule->name[0] == '\0') { + info("configured rule in '%s[%i]' applied, node handling for '%s' supressed", + rule->config_file, rule->config_line, udev->kernel_name); + } else { + strlcpy(udev->name, rule->name, sizeof(udev->name)); + apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); + strlcpy(udev->config_file, rule->config_file, sizeof(udev->config_file)); + udev->config_line = rule->config_line; + + info("configured rule in '%s:%i' applied, '%s' becomes '%s'", + rule->config_file, rule->config_line, udev->kernel_name, rule->name); + if (udev->type != DEV_NET) + dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", + udev->name, udev->owner, udev->group, udev->mode, udev->partitions); + } } - if (!udev->run_final && rule->run[0] != '\0') { + if (!udev->run_final && rule->run_operation != KEY_OP_UNSET) { char program[PATH_SIZE]; if (rule->run_operation == KEY_OP_ASSIGN_FINAL) udev->run_final = 1; - else if (rule->run_operation == KEY_OP_ASSIGN) { + if (rule->run_operation == KEY_OP_ASSIGN || rule->run_operation == KEY_OP_ASSIGN_FINAL) { struct name_entry *name_loop; struct name_entry *temp_loop; + info("reset run list"); list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) { list_del(&name_loop->node); free(name_loop); } } - strlcpy(program, rule->run, sizeof(program)); - apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - dbg("add run '%s'", program); - name_list_add(&udev->run_list, program, 0); + if (rule->run[0] != '\0') { + strlcpy(program, rule->run, sizeof(program)); + apply_format(udev, program, sizeof(program), class_dev, sysfs_device); + dbg("add run '%s'", program); + name_list_add(&udev->run_list, program, 0); + } } if (rule->last_rule) { @@ -866,113 +877,58 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d return 0; } -int udev_rules_get_run(struct udevice *udev) +int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device) { struct udev_rule *rule; - char program[PATH_SIZE]; /* look for a matching rule to apply */ list_for_each_entry(rule, &udev_rule_list, node) { dbg("process rule"); - if (rule->run[0] == '\0') + if (rule->run_operation == KEY_OP_UNSET) continue; - if (rule->name[0] != '\0' || rule->symlink[0] != '\0' || + if (rule->name_operation != KEY_OP_UNSET || rule->symlink_operation != KEY_OP_UNSET || rule->mode != 0000 || rule->owner[0] != '\0' || rule->group[0] != '\0') { dbg("skip rule that names a device"); continue; } - if (rule->action_operation != KEY_OP_UNSET) { - dbg("check for " KEY_ACTION " rule->action='%s' udev->action='%s'", - rule->action, udev->action); - if (strcmp_pattern(rule->action, udev->action) != 0) { - dbg(KEY_ACTION " is not matching"); - if (rule->action_operation != KEY_OP_NOMATCH) - continue; - } else { - dbg(KEY_ACTION " matches"); - if (rule->action_operation == KEY_OP_NOMATCH) - continue; - } - dbg(KEY_ACTION " key is true"); - } - - if (rule->kernel_operation != KEY_OP_UNSET) { - dbg("check for " KEY_KERNEL " rule->kernel='%s' udev->kernel_name='%s'", - rule->kernel, udev->kernel_name); - if (strcmp_pattern(rule->kernel, udev->kernel_name) != 0) { - dbg(KEY_KERNEL " is not matching"); - if (rule->kernel_operation != KEY_OP_NOMATCH) - continue; - } else { - dbg(KEY_KERNEL " matches"); - if (rule->kernel_operation == KEY_OP_NOMATCH) - continue; - } - dbg(KEY_KERNEL " key is true"); - } - - if (rule->subsystem_operation != KEY_OP_UNSET) { - dbg("check for " KEY_SUBSYSTEM " rule->subsystem='%s' udev->subsystem='%s'", - rule->subsystem, udev->subsystem); - if (strcmp_pattern(rule->subsystem, udev->subsystem) != 0) { - dbg(KEY_SUBSYSTEM " is not matching"); - if (rule->subsystem_operation != KEY_OP_NOMATCH) - continue; - } else { - dbg(KEY_SUBSYSTEM " matches"); - if (rule->subsystem_operation == KEY_OP_NOMATCH) - continue; + if (match_rule(udev, rule, NULL, sysfs_device) == 0) { + if (rule->ignore_device) { + info("configured rule in '%s[%i]' applied, '%s' is ignored", + rule->config_file, rule->config_line, udev->kernel_name); + udev->ignore_device = 1; + return 0; } - dbg(KEY_SUBSYSTEM " key is true"); - } - if (rule->env_pair_count) { - int i; + if (!udev->run_final && rule->run_operation != KEY_OP_UNSET) { + char program[PATH_SIZE]; - dbg("check for " KEY_ENV " pairs"); - for (i = 0; i < rule->env_pair_count; i++) { - struct key_pair *pair; - const char *value; + if (rule->run_operation == KEY_OP_ASSIGN || rule->run_operation == KEY_OP_ASSIGN_FINAL) { + struct name_entry *name_loop; + struct name_entry *temp_loop; - pair = &rule->env_pair[i]; - value = getenv(pair->name); - if (!value) { - dbg(KEY_ENV "{'%s'} is not found", pair->name); - continue; + info("reset run list"); + list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) { + list_del(&name_loop->node); + free(name_loop); + } } - if (strcmp_pattern(pair->value, value) != 0) { - dbg(KEY_ENV "{'%s'} is not matching", pair->name); - if (pair->operation != KEY_OP_NOMATCH) - continue; - } else { - dbg(KEY_ENV "{'%s'} matches", pair->name); - if (pair->operation == KEY_OP_NOMATCH) - continue; + if (rule->run[0] != '\0') { + strlcpy(program, rule->run, sizeof(program)); + apply_format(udev, program, sizeof(program), NULL, NULL); + dbg("add run '%s'", program); + name_list_add(&udev->run_list, program, 0); } + if (rule->run_operation == KEY_OP_ASSIGN_FINAL) + break; } - dbg(KEY_ENV " key is true"); - } - - /* rule matches */ - - if (rule->ignore_device) { - info("configured rule in '%s[%i]' applied, '%s' is ignored", - rule->config_file, rule->config_line, udev->kernel_name); - udev->ignore_device = 1; - return 0; - } - - strlcpy(program, rule->run, sizeof(program)); - apply_format(udev, program, sizeof(program), NULL, NULL); - dbg("add run '%s'", program); - name_list_add(&udev->run_list, program, 0); - if (rule->last_rule) { - dbg("last rule to be applied"); - break; + if (rule->last_rule) { + dbg("last rule to be applied"); + break; + } } } diff --git a/udev_rules.h b/udev_rules.h index f4a74bba45..75ffd5cb0f 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -96,6 +96,7 @@ struct udev_rule { int env_pair_count; char name[PATH_SIZE]; + enum key_operation name_operation; char symlink[PATH_SIZE]; enum key_operation symlink_operation; char owner[USER_SIZE]; @@ -120,7 +121,7 @@ extern struct list_head udev_rule_list; extern int udev_rules_init(void); extern int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_dev); -extern int udev_rules_get_run(struct udevice *udev); +extern int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device); extern void udev_rules_close(void); #endif diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 3f07521ccb..57c797dd31 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -349,21 +349,19 @@ static int rules_parse(const char *filename) if (strncasecmp(key, KEY_NAME, sizeof(KEY_NAME)-1) == 0) { attr = get_key_attribute(key + sizeof(KEY_NAME)-1); - /* FIXME: remove old style options and make OPTIONS= mandatory */ if (attr != NULL) { if (strstr(attr, OPTION_PARTITIONS) != NULL) { dbg("creation of partition nodes requested"); rule.partitions = DEFAULT_PARTITIONS_COUNT; } + /* FIXME: remove old style option and make OPTIONS= mandatory */ if (strstr(attr, OPTION_IGNORE_REMOVE) != NULL) { dbg("remove event should be ignored"); rule.ignore_remove = 1; } } - if (value[0] != '\0') - strlcpy(rule.name, value, sizeof(rule.name)); - else - rule.ignore_device = 1; + rule.name_operation = operation; + strlcpy(rule.name, value, sizeof(rule.name)); valid = 1; continue; } diff --git a/udevstart.c b/udevstart.c index 34f3835d65..d1a0a8379c 100644 --- a/udevstart.c +++ b/udevstart.c @@ -37,6 +37,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev_libc_wrapper.h" +#include "udev_sysfs.h" #include "udev.h" #include "udev_version.h" #include "logging.h" @@ -110,25 +111,37 @@ static int add_device(const char *path, const char *subsystem) const char *devpath; devpath = &path[strlen(sysfs_path)]; - - /* set environment for callouts and dev.d/ */ setenv("DEVPATH", devpath, 1); setenv("SUBSYSTEM", subsystem, 1); - dbg("exec: '%s' (%s)\n", devpath, path); class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { dbg ("sysfs_open_class_device_path failed"); - return -ENODEV; + return -1; } udev_init_device(&udev, devpath, subsystem, "add"); - udev_add_device(&udev, class_dev); + udev.devt = get_devt(class_dev); + if (!udev.devt) { + dbg ("sysfs_open_class_device_path failed"); + return -1; + } + udev_rules_get_name(&udev, class_dev); + if (udev.ignore_device) { + info("device event will be ignored"); + goto exit; + } + if (udev.name[0] == '\0') { + info("device node creation supressed"); + goto run; + } + udev_add_device(&udev, class_dev); if (udev.devname[0] != '\0') setenv("DEVNAME", udev.devname, 1); +run: if (udev_run && !list_empty(&udev.run_list)) { struct name_entry *name_loop; @@ -137,6 +150,7 @@ static int add_device(const char *path, const char *subsystem) execute_command(name_loop->name, udev.subsystem); } +exit: sysfs_close_class_device(class_dev); udev_cleanup_device(&udev); -- cgit v1.2.3-54-g00ecf From 9607c4222c08c2d3def2faeac62f6cca5d3ce119 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jun 2005 17:11:09 +0200 Subject: klibc: version 1.0.14 Signed-off-by: Kay Sievers --- klibc/Makefile | 5 +++++ klibc/include/net/if_ether.h | 1 - klibc/include/netinet/if_ether.h | 1 + klibc/include/netpacket/packet.h | 1 + klibc/include/signal.h | 4 ---- klibc/klcc.1 | 43 ++++++++++++++++++++++++++++++++---- klibc/klcc.in | 15 +++++++++++-- klibc/klibc/SYSCALLS.def | 32 ++++++++++++++++++--------- klibc/klibc/arch/i386/Makefile.inc | 1 + klibc/klibc/arch/x86_64/MCONFIG | 5 +++++ klibc/klibc/arch/x86_64/Makefile.inc | 3 ++- klibc/klibc/arch/x86_64/syscall.S | 6 ++--- klibc/klibc/fgets.c | 1 + klibc/klibc/sigaction.c | 35 ++++++++++++++++++++++++++--- klibc/klibc/sigpending.c | 4 +++- klibc/klibc/sigprocmask.c | 4 +++- klibc/klibc/sigsuspend.c | 4 +++- klibc/klibc/strntoumax.c | 13 ++++++----- klibc/makeklcc.pl | 0 klibc/version | 2 +- 20 files changed, 142 insertions(+), 38 deletions(-) delete mode 100644 klibc/include/net/if_ether.h create mode 100644 klibc/include/netinet/if_ether.h create mode 100644 klibc/include/netpacket/packet.h mode change 100644 => 100755 klibc/makeklcc.pl diff --git a/klibc/Makefile b/klibc/Makefile index 5071e60da4..e634aaccb5 100644 --- a/klibc/Makefile +++ b/klibc/Makefile @@ -69,4 +69,9 @@ local-install: $(CROSS)klcc $(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 $(INSTALL_EXEC) $(KCROSS)klcc $(INSTALLROOT)$(bindir) +# This does all the prep work needed to turn a freshly exported git repository +# into a release tarball tree +release: klibc.spec + rm -f maketar.sh + -include MCONFIG diff --git a/klibc/include/net/if_ether.h b/klibc/include/net/if_ether.h deleted file mode 100644 index 060ef22070..0000000000 --- a/klibc/include/net/if_ether.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/include/netinet/if_ether.h b/klibc/include/netinet/if_ether.h new file mode 100644 index 0000000000..060ef22070 --- /dev/null +++ b/klibc/include/netinet/if_ether.h @@ -0,0 +1 @@ +#include diff --git a/klibc/include/netpacket/packet.h b/klibc/include/netpacket/packet.h new file mode 100644 index 0000000000..b5e8e0e11f --- /dev/null +++ b/klibc/include/netpacket/packet.h @@ -0,0 +1 @@ +#include diff --git a/klibc/include/signal.h b/klibc/include/signal.h index ab3c98d6e4..05930bdea1 100644 --- a/klibc/include/signal.h +++ b/klibc/include/signal.h @@ -82,10 +82,6 @@ __extern int sigaction(int, const struct sigaction *, struct sigaction *); __extern int sigprocmask(int, const sigset_t *, sigset_t *); __extern int sigpending(sigset_t *); __extern int sigsuspend(const sigset_t *); -__extern int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t); -__extern int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t); -__extern int rt_sigpending(sigset_t *, size_t); -__extern int rt_sigsuspend(const sigset_t *, size_t); __extern int raise(int); __extern int kill(pid_t, int); diff --git a/klibc/klcc.1 b/klibc/klcc.1 index a6f979c6c4..76334a3a54 100644 --- a/klibc/klcc.1 +++ b/klibc/klcc.1 @@ -1,4 +1,4 @@ -.\" $Id: klcc.1,v 1.2 2005/03/02 02:24:17 hpa Exp $ +.\" $Id: klcc.1,v 1.3 2005/04/19 23:27:46 hpa Exp $ .\" ----------------------------------------------------------------------- .\" .\" Copyright 2005 H. Peter Anvin - All Rights Reserved @@ -39,7 +39,9 @@ klcc \- compile a program against klibc .B klcc is a wrapper around .BR gcc (1) -to compile a program against the +and +.BR ld (1) +which compiles and links a program against the .B klibc tiny C library. It supports most .B gcc @@ -63,7 +65,12 @@ or option to use the default optimization level; this will generally result in the smallest binaries. You may want to use .B \-s -when linking, however. +when linking, however. Use +.B \-O0 +to compile without any optimization whatsoever; this may not work depending +on the version of +.B gcc +used. .PP Use the .B \-shared @@ -72,10 +79,38 @@ or option to compile for and link against shared or static klibc. Note that shared klibc only supports running against the exact same klibc binary as the binary was linked with. +.PP +In addition to standard +.B gcc +options, +.B klcc +supports options of the form \fB\-print-klibc-\fP\fIoption\fP, +which prints the corresponding klibc configuration option. .SH AUTHOR Written by H. Peter Anvin . .SH COPYRIGHT -Copyright \(co 2005 H. Peter Anvin. +Copyright \(co 2005 H. Peter Anvin \- All Rights Reserved +.PP +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom +the Software is furnished to do so, subject to the following +conditions: +.PP +The above copyright notice and this permission notice shall +be included in all copies or substantial portions of the Software. +.PP +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. .SH "SEE ALSO" .BR gcc (1) diff --git a/klibc/klcc.in b/klibc/klcc.in index 36c4d9b3ee..5629f24f1c 100644 --- a/klibc/klcc.in +++ b/klibc/klcc.in @@ -1,5 +1,7 @@ # -*- perl -*- +use IPC::Open3; + # Standard includes @includes = ("-I${prefix}/${KCROSS}include/arch/${ARCH}", "-I${prefix}/${KCROSS}include/bits${BITSIZE}", @@ -57,7 +59,7 @@ sub files_with_lang($$) { # Skip object files if ( $need ne 'obj' ) { - unless ( $xopt eq $need ) { + unless ( $xopt eq $need || $need eq 'stdin') { push(@as, '-x', $need); $xopt = $need; } @@ -79,7 +81,11 @@ sub syserr($) { # Run a program; printing out the command line if $verbose is set sub mysystem(@) { print STDERR join(' ', @_), "\n" if ( $verbose ); - return system(@_); + my $cmd = shift; + open(INPUT, "<&STDIN"); # dup STDIN filehandle to INPUT + my $childpid = open3("<&INPUT", ">&STDOUT", ">&STDERR", $cmd, @_); + waitpid ($childpid, 0); + return $?; } # @@ -117,6 +123,11 @@ while ( defined($a = shift(@ARGV)) ) { # Not an option. Must be a filename then. push(@files, $a); $flang{$a} = $lang || filename2lang($a); + } elsif ( $a eq '-' ) { + # gcc gets its input from stdin + push(@files, $a); + # prevent setting -x + $flang{$a} = 'stdin' } elsif ( $a =~ /^-print-klibc-(.*)$/ ) { # This test must precede -print if ( defined($conf{$1}) ) { diff --git a/klibc/klibc/SYSCALLS.def b/klibc/klibc/SYSCALLS.def index e8b9a7f176..11d8c9a47e 100644 --- a/klibc/klibc/SYSCALLS.def +++ b/klibc/klibc/SYSCALLS.def @@ -145,17 +145,29 @@ ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t) ; ; Signal operations ; -int kill(pid_t, int) ; We really should get rid of the non-rt_* of these, but that takes -; sanitizing for all architectures, sigh... - int sigaction(int, const struct sigaction *, struct sigaction *) - int sigsuspend(const sigset_t *) - int sigpending(sigset_t *) - int sigprocmask(int, const sigset_t *, sigset_t *) -int rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) -int rt_sigsuspend(const sigset_t *, size_t) -int rt_sigpending(sigset_t *, size_t) -int rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t) +; sanitizing for all architectures, sigh. +#ifdef __NR_sigaction +int sigaction::__sigaction(int, const struct sigaction *, struct sigaction *) +#else +int rt_sigaction::__rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) +#endif +#ifdef __NR_sigsuspend +int sigsuspend(const sigset_t *) +#else +int rt_sigsuspend::__rt_sigsuspend(const sigset_t *, size_t) +#endif +#ifdef __NR_sigpending +int sigpending(sigset_t *) +#else +int rt_sigpending::__rt_sigpending(sigset_t *, size_t) +#endif +#ifdef __NR_sigprocmask +int sigprocmask(int, const sigset_t *, sigset_t *) +#else +int rt_sigprocmask::__rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t) +#endif +int kill(pid_t, int) unsigned int alarm(unsigned int) int getitimer(int, struct itimerval *) int setitimer(int, const struct itimerval *, struct itimerval *) diff --git a/klibc/klibc/arch/i386/Makefile.inc b/klibc/klibc/arch/i386/Makefile.inc index 5c320cb453..80344bd0a5 100644 --- a/klibc/klibc/arch/i386/Makefile.inc +++ b/klibc/klibc/arch/i386/Makefile.inc @@ -13,6 +13,7 @@ ARCHOBJS = \ arch/$(ARCH)/setjmp.o \ arch/$(ARCH)/syscall.o \ arch/$(ARCH)/open.o \ + arch/$(ARCH)/sigreturn.o \ arch/$(ARCH)/libgcc/__ashldi3.o \ arch/$(ARCH)/libgcc/__ashrdi3.o \ arch/$(ARCH)/libgcc/__lshrdi3.o \ diff --git a/klibc/klibc/arch/x86_64/MCONFIG b/klibc/klibc/arch/x86_64/MCONFIG index 13b6e391f9..c9b5da8bd6 100644 --- a/klibc/klibc/arch/x86_64/MCONFIG +++ b/klibc/klibc/arch/x86_64/MCONFIG @@ -15,8 +15,13 @@ # debugging using gdb. # ARCHREQFLAGS = -m64 +ifeq ($(DEBUG),y) +OPTFLAGS = -Os -fomit-frame-pointer \ + -falign-functions=0 -falign-jumps=0 -falign-loops=0 +else OPTFLAGS = -Os -fno-asynchronous-unwind-tables -fomit-frame-pointer \ -falign-functions=0 -falign-jumps=0 -falign-loops=0 +endif BITSIZE = 64 LDFLAGS = -m elf_x86_64 diff --git a/klibc/klibc/arch/x86_64/Makefile.inc b/klibc/klibc/arch/x86_64/Makefile.inc index d6cc1204e4..26d880d7c7 100644 --- a/klibc/klibc/arch/x86_64/Makefile.inc +++ b/klibc/klibc/arch/x86_64/Makefile.inc @@ -10,7 +10,8 @@ ARCHOBJS = \ arch/$(ARCH)/exits.o \ arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o + arch/$(ARCH)/syscall.o \ + arch/$(ARCH)/sigreturn.o ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) diff --git a/klibc/klibc/arch/x86_64/syscall.S b/klibc/klibc/arch/x86_64/syscall.S index f2c74ae974..17977978b9 100644 --- a/klibc/klibc/arch/x86_64/syscall.S +++ b/klibc/klibc/arch/x86_64/syscall.S @@ -15,14 +15,14 @@ __syscall_common: syscall cmpq $-4095,%rax - jb 1f + jnb 1f + ret # Error return, must set errno +1: negl %eax movl %eax,errno(%rip) # errno is type int, so 32 bits orq $-1,%rax # orq $-1 smaller than movq $-1 - -1: ret .size __syscall_common,.-__syscall_common diff --git a/klibc/klibc/fgets.c b/klibc/klibc/fgets.c index 88a145a63f..72f8a13cf1 100644 --- a/klibc/klibc/fgets.c +++ b/klibc/klibc/fgets.c @@ -20,6 +20,7 @@ char *fgets(char *s, int n, FILE *f) return NULL; } *p++ = ch; + n--; if ( ch == '\n' ) break; } diff --git a/klibc/klibc/sigaction.c b/klibc/klibc/sigaction.c index 819ffd4fe8..85f42a244c 100644 --- a/klibc/klibc/sigaction.c +++ b/klibc/klibc/sigaction.c @@ -5,11 +5,40 @@ #include #include -#ifndef __NR_sigaction +__extern void __sigreturn(void); +__extern int __sigaction(int, const struct sigaction *, struct sigaction *); +__extern int __rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t); int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) { - return rt_sigaction(sig, act, oact, sizeof(sigset_t)); -} + int rv; + +#if defined(__i386__) || defined(__x86_64__) + /* x86-64, and the Fedora i386 kernel, are broken without SA_RESTORER */ + struct sigaction sa; + + if ( act && !(act->sa_flags & SA_RESTORER) ) { + sa = *act; + act = &sa; + + /* The kernel can't be trusted to have a valid default restorer */ + sa.sa_flags |= SA_RESTORER; + sa.sa_restorer = &__sigreturn; + } +#endif +#ifdef __NR_sigaction + rv = __sigaction(sig, act, oact); +#else + rv = __rt_sigaction(sig, act, oact, sizeof(sigset_t)); #endif + + +#if defined(__i386__) || defined(__x86_64__) + if ( oact && (oact->sa_restorer == &__sigreturn) ) { + oact->sa_flags &= ~SA_RESTORER; + } +#endif + + return rv; +} diff --git a/klibc/klibc/sigpending.c b/klibc/klibc/sigpending.c index 76d2b1a7f6..decfe32b1b 100644 --- a/klibc/klibc/sigpending.c +++ b/klibc/klibc/sigpending.c @@ -7,9 +7,11 @@ #ifndef __NR_sigpending +__extern __rt_sigpending(sigset_t *, size_t); + int sigpending(sigset_t *set) { - return rt_sigpending(set, sizeof(sigset_t)); + return __rt_sigpending(set, sizeof(sigset_t)); } #endif diff --git a/klibc/klibc/sigprocmask.c b/klibc/klibc/sigprocmask.c index b5e58b28b8..372e0fd90d 100644 --- a/klibc/klibc/sigprocmask.c +++ b/klibc/klibc/sigprocmask.c @@ -7,9 +7,11 @@ #ifndef __NR_sigprocmask +__extern __rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t); + int sigprocmask(int how, const sigset_t *set, sigset_t *oset) { - return rt_sigprocmask(how, set, oset, sizeof(sigset_t)); + return __rt_sigprocmask(how, set, oset, sizeof(sigset_t)); } #endif diff --git a/klibc/klibc/sigsuspend.c b/klibc/klibc/sigsuspend.c index a927999ae6..22f9a46681 100644 --- a/klibc/klibc/sigsuspend.c +++ b/klibc/klibc/sigsuspend.c @@ -7,9 +7,11 @@ #ifndef __NR_sigsuspend +__extern int __rt_sigsuspend(const sigset_t *, size_t); + int sigsuspend(const sigset_t *mask) { - return rt_sigsuspend(mask, sizeof *mask); + return __rt_sigsuspend(mask, sizeof *mask); } #endif diff --git a/klibc/klibc/strntoumax.c b/klibc/klibc/strntoumax.c index 4e30637d2c..4c47fe8662 100644 --- a/klibc/klibc/strntoumax.c +++ b/klibc/klibc/strntoumax.c @@ -33,12 +33,13 @@ uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n) } /* Single optional + or - */ - if ( n && *nptr == '-' ) { - minus = 1; - nptr++; - n--; - } else if ( n && *nptr == '+' ) { - nptr++; + if ( n ) { + char c = *nptr; + if ( c == '-' || c == '+' ) { + minus = (c == '-'); + nptr++; + n--; + } } if ( base == 0 ) { diff --git a/klibc/makeklcc.pl b/klibc/makeklcc.pl old mode 100644 new mode 100755 diff --git a/klibc/version b/klibc/version index 238d6e882a..5b09c67c20 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -1.0.7 +1.0.14 -- cgit v1.2.3-54-g00ecf From e2bd03ff63789e0ffcc1955f15d9927f3ce87465 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Mon, 6 Jun 2005 13:46:19 -0700 Subject: Fix udevinfo for empty sysfs directories udevinfo would die if it ran into a sysfs directory with no attributes. This is valid for a lot of scsi devices, so now we just continue on up the chain. Signed-off-by: Greg Kroah-Hartman --- udevinfo.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 31e719fe35..69e5335b7c 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -152,19 +152,16 @@ static int print_device_chain(const char *path) /* look the device chain upwards */ while (sysfs_dev != NULL) { - attr_list = sysfs_get_device_attributes(sysfs_dev); - if (attr_list == NULL) { - fprintf(stderr, "couldn't open device directory\n"); - retval = -1; - goto exit; - } - printf(" looking at the device chain at '%s':\n", sysfs_dev->path); printf(" BUS==\"%s\"\n", sysfs_dev->bus); printf(" ID==\"%s\"\n", sysfs_dev->bus_id); printf(" DRIVER==\"%s\"\n", sysfs_dev->driver_name); - print_all_attributes(attr_list); + attr_list = sysfs_get_device_attributes(sysfs_dev); + if (attr_list != NULL) + print_all_attributes(attr_list); + else + printf("\n"); sysfs_dev = sysfs_get_device_parent(sysfs_dev); if (sysfs_dev == NULL) -- cgit v1.2.3-54-g00ecf From 561d4c5a3a66830ecfb92fdfd7ccee19cf01c2a7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Jun 2005 11:57:53 +0200 Subject: udevd: allow starting of udevd with stopped exec-queue Signed-off-by: Kay Sievers --- test/simple-build-check.sh | 0 udevd.c | 16 ++++++++++++++-- udevstart.c | 10 ++++------ 3 files changed, 18 insertions(+), 8 deletions(-) mode change 100644 => 100755 test/simple-build-check.sh diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh old mode 100644 new mode 100755 diff --git a/udevd.c b/udevd.c index b5597eab40..6fb0bd9433 100644 --- a/udevd.c +++ b/udevd.c @@ -766,6 +766,8 @@ int main(int argc, char *argv[], char *envp[]) fd_set readfds; const char *value; int uevent_nl_active = 0; + int daemonize = 0; + int i; logging_init("udevd"); udev_init_config(); @@ -776,8 +778,18 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - /* daemonize on request */ - if (argc == 2 && strcmp(argv[1], "-d") == 0) { + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + if (strcmp(arg, "--daemon") == 0 || strcmp(arg, "-d") == 0) { + info("will daemonize"); + daemonize = 1; + } + if (strcmp(arg, "--stop-exec-queue") == 0) { + info("will not execute event until START_EXEC_QUEUE is received"); + stop_exec_q = 1; + } + } + if (daemonize) { pid_t pid; pid = fork(); diff --git a/udevstart.c b/udevstart.c index d1a0a8379c..bd91e96f6a 100644 --- a/udevstart.c +++ b/udevstart.c @@ -117,30 +117,29 @@ static int add_device(const char *path, const char *subsystem) class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { - dbg ("sysfs_open_class_device_path failed"); + dbg("sysfs_open_class_device_path failed"); return -1; } udev_init_device(&udev, devpath, subsystem, "add"); udev.devt = get_devt(class_dev); if (!udev.devt) { - dbg ("sysfs_open_class_device_path failed"); + dbg("sysfs_open_class_device_path failed"); return -1; } udev_rules_get_name(&udev, class_dev); if (udev.ignore_device) { - info("device event will be ignored"); + dbg("device event will be ignored"); goto exit; } if (udev.name[0] == '\0') { - info("device node creation supressed"); + dbg("device node creation supressed"); goto run; } udev_add_device(&udev, class_dev); if (udev.devname[0] != '\0') setenv("DEVNAME", udev.devname, 1); - run: if (udev_run && !list_empty(&udev.run_list)) { struct name_entry *name_loop; @@ -149,7 +148,6 @@ run: list_for_each_entry(name_loop, &udev.run_list, node) execute_command(name_loop->name, udev.subsystem); } - exit: sysfs_close_class_device(class_dev); udev_cleanup_device(&udev); -- cgit v1.2.3-54-g00ecf From 60d7b201008edb3c6d9226ef336c7ae0daa5742f Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Mon, 13 Jun 2005 22:38:42 +0200 Subject: udevcontrol: fix exit code Kay is lazy! :) Signed-off-by: Kay Sievers --- udevcontrol.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/udevcontrol.c b/udevcontrol.c index 6a278a04c1..4a54af805e 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -95,8 +95,13 @@ int main(int argc, char *argv[], char *envp[]) retval = sendto(sock, &usend_msg, sizeof(usend_msg), 0, (struct sockaddr *)&saddr, addrlen); - if (retval == -1) + if (retval == -1) { info("error sending message (%s)", strerror(errno)); + retval = 1; + } else { + dbg("sent message '%x' (%u bytes sent)\n", usend_msg.type, retval); + retval = 0; + } close(sock); -- cgit v1.2.3-54-g00ecf From 0fa98832b5be9893e1b26252c20b68d730b77173 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Jun 2005 13:28:24 +0200 Subject: udev man page: add operators Patch from: Hannes Reinecke Signed-off-by: Kay Sievers --- udev.8.in | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/udev.8.in b/udev.8.in index e4c1c11af2..b4edd5aebd 100644 --- a/udev.8.in +++ b/udev.8.in @@ -104,6 +104,36 @@ Every rule consists of a list of comma separated key value fields: .sp .IR "key " ,[ "key " ,...] .P +Each key has the following format: +.sp +.IR "name op value" +.P +There are distinct key operation types, depending on the type of the key, it +does a comparison or an assignment. +.P +Comparison operators are: +.TP +.B == +Compare for equality. +.TP +.B != +Compare for non-equality. +.P +Assignment operators are: +.TP +.B += +Add the value to a key that holds a list of entries. +.TP +.B := +Assign a value to a key finally; disallow any later changes, which +is useful to prevent changes by any later rules. +.TP +.B = +Asign a value to a key. Keys that represent a list, are reset and only this +single value is assigned. While this operator still works inplicitely as +comparison on keys that can't get a value assigned, its usage as an comparison +operator is deprecated. +.P The following key names can be used to match against device properties: .TP .B BUS -- cgit v1.2.3-54-g00ecf From d27d8d6a8d63ffce768842324dd53067b9b0e905 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 14 Jun 2005 16:12:31 +0200 Subject: udev: fix netdev RUN handling Signed-off-by: Kay Sievers --- udev.c | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/udev.c b/udev.c index d623cbcc67..3eb788f4c1 100644 --- a/udev.c +++ b/udev.c @@ -138,29 +138,29 @@ int main(int argc, char *argv[], char *envp[]) wait_for_class_device(class_dev, &error); /* get major/minor */ - if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS) { + if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS) udev.devt = get_devt(class_dev); - if (udev.devt) { - /* name device */ - udev_rules_get_name(&udev, class_dev); - if (udev.ignore_device) { - info("device event will be ignored"); - goto exit; - } - if (udev.name[0] == '\0') { - info("device node creation supressed"); - goto run; - } - - /* create node, store in db */ - retval = udev_add_device(&udev, class_dev); - } else { - dbg("no dev-file found"); - udev_rules_get_run(&udev, NULL); - if (udev.ignore_device) { - info("device event will be ignored"); - goto exit; - } + + if (udev.type == DEV_NET || udev.devt) { + /* name device */ + udev_rules_get_name(&udev, class_dev); + if (udev.ignore_device) { + info("device event will be ignored"); + goto cleanup; + } + if (udev.name[0] == '\0') { + info("device node creation supressed"); + goto cleanup; + } + + /* create node, store in db */ + retval = udev_add_device(&udev, class_dev); + } else { + dbg("no dev-file found"); + udev_rules_get_run(&udev, NULL); + if (udev.ignore_device) { + info("device event will be ignored"); + goto cleanup; } } sysfs_close_class_device(class_dev); @@ -169,7 +169,7 @@ int main(int argc, char *argv[], char *envp[]) udev_rules_get_run(&udev, NULL); if (udev.ignore_device) { dbg("device event will be ignored"); - goto exit; + goto cleanup; } /* get name from db, remove db-entry, delete node */ @@ -198,14 +198,14 @@ int main(int argc, char *argv[], char *envp[]) sysfs_close_device(devices_dev); if (udev.ignore_device) { info("device event will be ignored"); - goto exit; + goto cleanup; } } else if (strcmp(action, "remove") == 0) { dbg("devices remove"); udev_rules_get_run(&udev, NULL); if (udev.ignore_device) { info("device event will be ignored"); - goto exit; + goto cleanup; } } } @@ -219,9 +219,10 @@ run: execute_command(name_loop->name, udev.subsystem); } -exit: +cleanup: udev_cleanup_device(&udev); +exit: logging_close(); return retval; } -- cgit v1.2.3-54-g00ecf From 510de9c9e40c27b1eb224dc49ac439997bfe4db6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Jun 2005 17:02:55 +0200 Subject: udevinitsend: handle replay messages correctly Signed-off-by: Kay Sievers --- udevd.c | 13 ++++++++----- udevd.h | 5 ++++- udevinitsend.c | 37 +++++++++++++++++-------------------- udevsend.c | 2 +- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/udevd.c b/udevd.c index 6fb0bd9433..873b05d946 100644 --- a/udevd.c +++ b/udevd.c @@ -542,13 +542,15 @@ static struct uevent_msg *get_udevd_msg(void) } switch (usend_msg.type) { - case UDEVD_UEVENT: - dbg("udevd message (UEVENT) received"); + case UDEVD_UDEVSEND: + case UDEVD_INITSEND: + dbg("udevd event message received"); envbuf_size = size - offsetof(struct udevd_msg, envbuf); dbg("envbuf_size=%i", envbuf_size); msg = get_msg_from_envbuf(usend_msg.envbuf, envbuf_size); if (msg == NULL) return NULL; + msg->type = usend_msg.type; return msg; case UDEVD_STOP_EXEC_QUEUE: dbg("udevd message (STOP_EXEC_QUEUE) received"); @@ -566,7 +568,7 @@ switch (usend_msg.type) { } /* receive the kernel user event message and do some sanity checks */ -static struct uevent_msg *get_uevent_msg(void) +static struct uevent_msg *get_nl_msg(void) { struct uevent_msg *msg; int bufpos; @@ -591,6 +593,7 @@ static struct uevent_msg *get_uevent_msg(void) msg = get_msg_from_envbuf(&buffer[bufpos], size-bufpos); if (msg == NULL) return NULL; + msg->type = UDEVD_NL; /* validate message */ pos = strchr(buffer, '@'); @@ -935,7 +938,7 @@ int main(int argc, char *argv[], char *envp[]) msg = get_udevd_msg(); if (msg) { /* discard kernel messages if netlink is active */ - if (uevent_nl_active && msg->seqnum != 0) { + if (uevent_nl_active && msg->type == UDEVD_UDEVSEND && msg->seqnum != 0) { dbg("skip uevent_helper message, netlink is active"); free(msg); continue; @@ -945,7 +948,7 @@ int main(int argc, char *argv[], char *envp[]) } if (FD_ISSET(uevent_nl_sock, &workreadfds)) { - msg = get_uevent_msg(); + msg = get_nl_msg(); if (msg) { msg_queue_insert(msg); /* disable kernel uevent_helper with first netlink message */ diff --git a/udevd.h b/udevd.h index 60732fe052..b8fb6913c9 100644 --- a/udevd.h +++ b/udevd.h @@ -50,7 +50,9 @@ enum udevd_msg_type { UDEVD_UNKNOWN, - UDEVD_UEVENT, + UDEVD_UDEVSEND, + UDEVD_INITSEND, + UDEVD_NL, UDEVD_STOP_EXEC_QUEUE, UDEVD_START_EXEC_QUEUE, }; @@ -63,6 +65,7 @@ struct udevd_msg { }; struct uevent_msg { + enum udevd_msg_type type; struct list_head node; pid_t pid; long queue_time; diff --git a/udevinitsend.c b/udevinitsend.c index 05c39b99b3..c7d56fc259 100644 --- a/udevinitsend.c +++ b/udevinitsend.c @@ -58,17 +58,18 @@ void log_message (int level, const char *format, ...) * Scan a file, write all variables into the msgbuf and * fires the message to udevd. */ -static int udevsend(char *filename, int sock, int ignore_loops) +static int udevsend(char *filename, int sock, int disable_loop_detection) { + static struct udevd_msg usend_msg; + int usend_msg_len; + int bufpos = 0; struct stat statbuf; - int fd, bufpos; + int fd; char *fdmap, *ls, *le, *ch; - struct udevd_msg usend_msg; - int retval = 0; - int usend_msg_len; struct sockaddr_un saddr; socklen_t addrlen; - + int retval = 0; + if (stat(filename,&statbuf) < 0) { dbg("cannot stat %s: %s\n", filename, strerror(errno)); return 1; @@ -91,24 +92,23 @@ static int udevsend(char *filename, int sock, int ignore_loops) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - memset(usend_msg.envbuf, 0, UEVENT_BUFFER_SIZE+256); - bufpos = 0; memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); strcpy(usend_msg.magic, UDEV_MAGIC); + usend_msg.type = UDEVD_INITSEND; ls = fdmap; ch = le = ls; while (*ch && ch < fdmap + statbuf.st_size) { - le = strchr(ch,'\n'); + le = strchr(ch, '\n'); if (!le) break; - ch = strchr(ch,'='); + ch = strchr(ch, '='); if (!ch) break; /* prevent loops in the scripts we execute */ if (strncmp(ls, "UDEVD_EVENT=", 12) == 0) { - if (!ignore_loops) { + if (!disable_loop_detection) { dbg("event already handled by udev\n"); retval = -1; break; @@ -161,7 +161,8 @@ int main(int argc, char *argv[], char *envp[]) char *event_file = NULL; DIR *dirstream; struct dirent *direntry; - int retval = 1, ignore_loops = 0; + int retval = 1; + int disable_loop_detection = 0; int sock; logging_init("udevinitsend"); @@ -186,14 +187,10 @@ int main(int argc, char *argv[], char *envp[]) break; case 'l': - dbg("ignoring loops\n"); - ignore_loops = 1; + dbg("disable loop detection, ignore UDEVD_EVENT\n"); + disable_loop_detection = 1; break; - case 'V': - printf("udevinitsend, version 0.1\n"); - return 0; - case 'h': retval = 0; } @@ -217,11 +214,11 @@ int main(int argc, char *argv[], char *envp[]) if (!strcmp(direntry->d_name,".") || !strcmp(direntry->d_name,"..")) continue; - retval = udevsend(direntry->d_name, sock, ignore_loops); + retval = udevsend(direntry->d_name, sock, disable_loop_detection); } closedir(dirstream); } else if (event_file) { - retval = udevsend(event_file, sock, ignore_loops); + retval = udevsend(event_file, sock, disable_loop_detection); } if (sock != -1) diff --git a/udevsend.c b/udevsend.c index 888a88daa0..42ef0271dd 100644 --- a/udevsend.c +++ b/udevsend.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[], char *envp[]) memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); strcpy(usend_msg.magic, UDEV_MAGIC); - usend_msg.type = UDEVD_UEVENT; + usend_msg.type = UDEVD_UDEVSEND; /* copy all keys to send buffer */ for (i = 0; envp[i]; i++) { -- cgit v1.2.3-54-g00ecf From e5b7f7b83428cb50f165b49408c2f7559dcfefef Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Jun 2005 20:27:08 +0200 Subject: klibc: add missing files Signed-off-by: Kay Sievers --- klibc/include/net/route.h | 1 + klibc/klibc/Kbuild | 149 ++++++++++++++++++++++++++++++++++++ klibc/klibc/arch/i386/sigreturn.S | 15 ++++ klibc/klibc/arch/x86_64/sigreturn.S | 15 ++++ 4 files changed, 180 insertions(+) create mode 100644 klibc/include/net/route.h create mode 100644 klibc/klibc/Kbuild create mode 100644 klibc/klibc/arch/i386/sigreturn.S create mode 100644 klibc/klibc/arch/x86_64/sigreturn.S diff --git a/klibc/include/net/route.h b/klibc/include/net/route.h new file mode 100644 index 0000000000..a60df24c0a --- /dev/null +++ b/klibc/include/net/route.h @@ -0,0 +1 @@ +#include diff --git a/klibc/klibc/Kbuild b/klibc/klibc/Kbuild new file mode 100644 index 0000000000..be239a6647 --- /dev/null +++ b/klibc/klibc/Kbuild @@ -0,0 +1,149 @@ +# +# Kbuild file for klibc +# + +libc-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \ + asprintf.o vasprintf.o \ + vsscanf.o sscanf.o ctypes.o \ + strntoumax.o strntoimax.o \ + atoi.o atol.o atoll.o \ + strtol.o strtoll.o strtoul.o strtoull.o \ + strtoimax.o strtoumax.o \ + globals.o exitc.o atexit.o onexit.o \ + execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \ + fork.o wait.o wait3.o waitpid.o system.o setpgrp.o getpgrp.o \ + daemon.o \ + printf.o vprintf.o fprintf.o vfprintf.o perror.o \ + statfs.o fstatfs.o umount.o \ + open.o fopen.o fread.o fread2.o fgetc.o fgets.o \ + fwrite.o fwrite2.o fputc.o fputs.o puts.o putchar.o \ + sleep.o usleep.o strtotimespec.o strtotimeval.o \ + raise.o abort.o assert.o alarm.o pause.o \ + __signal.o sysv_signal.o bsd_signal.o siglist.o siglongjmp.o \ + sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ + brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ + memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ + memmove.o memchr.o memrchr.o \ + strcasecmp.o strncasecmp.o strndup.o strerror.o \ + strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \ + strncat.o strlcpy.o strlcat.o \ + strstr.o strncmp.o strncpy.o strrchr.o \ + strxspn.o strspn.o strcspn.o strpbrk.o strsep.o strtok.o \ + gethostname.o getdomainname.o getcwd.o \ + seteuid.o setegid.o \ + getenv.o setenv.o putenv.o __put_env.o unsetenv.o \ + getopt.o readdir.o \ + syslog.o closelog.o pty.o getpt.o isatty.o reboot.o \ + time.o utime.o llseek.o nice.o getpriority.o \ + qsort.o \ + lrand48.o jrand48.o mrand48.o nrand48.o srand48.o seed48.o \ + inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ + inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ + send.o recv.o + +libc-$(CONFIG_KLIBC_ERRLIST) += errlist.o + +libc-$(CONFIG_KLIBC_ZLIB) += \ + zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/gzio.o \ + zlib/uncompr.o zlib/deflate.o zlib/trees.o zlib/zutil.o \ + zlib/inflate.o zlib/infback.o zlib/inftrees.o zlib/inffast.o + +##### +# Add any architecture-specific rules +include $(obj)/arch/$(ARCH)/Makefile.inc + +##### +# Shared definitions +LIB := libc.a +SOLIB := libc.so +SOHASH := klibc.so +CRT0 := arch/$(ARCH)/crt0.o +INTERP_O := interp.o + +always := $(CRT0) $(LIB) $(SOLIB) $(SOHASH) $(INTERP_O) +LIB := $(call objectify,$(LIB)) +SOLIB := $(call objectify,$(SOLIB)) +SOHASH := $(call objectify,$(SOHASH)) +CRT0 := $(call objectify,$(CRT0)) +INTERP_O := $(call objectify,$(INTERP_O)) + +targets := arch/$(ARCH)/crt0.o +targets += $(libc-y) $(ARCHOBJS) + +# Generate syscall stubs +subdir-y += syscalls +# Generate socket calls stubs +subdir-y += socketcalls + +# Tell make to descend before building libs +$(obj)/syscalls/syscalls.o: $(obj)/syscalls +$(obj)/socketcalls/socketcalls.o: $(obj)/socketcalls + +##### +# Readable errormessages extracted from src.. +targets += errlist.c +quiet_cmd_errlist = GEN $@ + cmd_errlist = $(PERL) $< $(LINUXINCLUDE) -errlist > $@ || rm -f $@ + +$(obj)/errlist.c: $(srctree)/$(src)/makeerrlist.pl + $(call cmd,errlist) + +# full list of dependencies for klibc +libc-deps = $(call objectify, $(libc-y) $(ARCHOBJS)) \ + $(call objectify, syscalls/syscalls.o socketcalls/socketcalls.o) + +###### +# Build static library: libc.a +targets += libc.a __static_init.o +quiet_cmd_libc = USERAR $@ + cmd_libc = rm -f $@; \ + $(USERAR) cq $@ $(filter-out FORCE,$^); \ + $(USERRANLIB) $@ + +$(LIB): $(call objectify,__static_init.o) $(libc-deps) FORCE + $(call if_changed,libc) + +###### +# Build shared library +targets += libc.so __shared_init.o + +quiet_cmd_libcso = LD $@ + cmd_libcso = $(USERLD) $(USERLDFLAGS) $(USERSHAREDFLAGS) \ + -o $@ $(filter-out FORCE,$^) $(USERLIBGCC) + +$(SOLIB): $(CRT0) $(call objectify,__shared_init.o) $(libc-deps) FORCE + $(call if_changed,libcso) + + +##### +# Build sha1 hash values +targets += klibc.so libc.so.hash +hostprogs-y := sha1hash + +quiet_cmd_solibhash = HASH $@ + cmd_solibhash = $(USERNM) $< | egrep '^[0-9a-fA-F]+ [ADRTW] ' | \ + sort | $(obj)/sha1hash > $@ +$(SOLIB).hash: $(SOLIB) $(obj)/sha1hash FORCE + $(call if_changed,solibhash) + +quiet_cmd_sohash = GEN $@ + cmd_sohash = cat $< > $@; \ + $(USERSTRIP) $(USERSTRIPFLAGS) $@; \ + rm -f $(obj)/klibc-??????????????????????.so; \ + ln -f $@ $(obj)/klibc-`cat $(SOLIB).hash`.so +$(SOHASH): $(SOLIB) $(SOLIB).hash + $(call cmd,sohash) + + +##### +# build interp.o +targets += interp.o + +quiet_cmd_interp = BUILD $@ + cmd_interp = $(USERCC) $(usercflags) -D__ASSEMBLY__ \ + -DLIBDIR=\"$(SHLIBDIR)\" \ + -DSOHASH=\"`cat $(SOLIB).hash`\" \ + -c -o $@ $< + +$(INTERP_O): $(obj)/interp.S $(SOLIB).hash + $(call if_changed,interp) diff --git a/klibc/klibc/arch/i386/sigreturn.S b/klibc/klibc/arch/i386/sigreturn.S new file mode 100644 index 0000000000..f2a32419d3 --- /dev/null +++ b/klibc/klibc/arch/i386/sigreturn.S @@ -0,0 +1,15 @@ +# +# arch/i386/sigreturn.S +# + +#include + + .text + .align 4 + .globl __sigreturn + .type __sigreturn,@function +__sigreturn: + pop %eax # Have no idea why this is needed... + movl $__NR_sigreturn,%eax + int $0x80 + .size __sigreturn,.-__sigreturn diff --git a/klibc/klibc/arch/x86_64/sigreturn.S b/klibc/klibc/arch/x86_64/sigreturn.S new file mode 100644 index 0000000000..66e7152344 --- /dev/null +++ b/klibc/klibc/arch/x86_64/sigreturn.S @@ -0,0 +1,15 @@ +/* + * arch/x86_64/sigreturn.S + */ + +#include + + .text + .align 4 + .globl __sigreturn + .type __sigreturn,@function +__sigreturn: + movl $__NR_rt_sigreturn,%eax + syscall + + .size __sigreturn,.-__sigreturn -- cgit v1.2.3-54-g00ecf From 3632a3685883d3270145c59d5764de6246547943 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Jun 2005 03:07:14 +0200 Subject: udeveventrecorder: add small program that writes an event to disk Used for debugging and event replay from initramfs. Signed-off-by: Kay Sievers --- Makefile | 12 ++++- udevd.c | 6 +-- udeveventrecorder.c | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++ udevinitsend.c | 15 ++++++- 4 files changed, 153 insertions(+), 7 deletions(-) create mode 100644 udeveventrecorder.c diff --git a/Makefile b/Makefile index d36bd5866c..9ad6ee103b 100644 --- a/Makefile +++ b/Makefile @@ -45,6 +45,7 @@ ROOT = udev DAEMON = udevd SENDER = udevsend INITSENDER = udevinitsend +RECORDER = udeveventrecorder CONTROL = udevcontrol INFO = udevinfo TESTER = udevtest @@ -204,7 +205,7 @@ endif # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf -all: $(ROOT) $(SENDER) $(INITSENDER) $(CONTROL) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) +all: $(ROOT) $(SENDER) $(INITSENDER) $(RECORDER) $(CONTROL) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -271,6 +272,7 @@ $(INFO).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(DAEMON).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(SENDER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(INITSENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(RECORDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(CONTROL).o: $(HEADERS) $( $(HEADERS)GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(STARTER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) @@ -298,6 +300,10 @@ $(INITSENDER): $(KLCC) $(INITSENDER).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(INITSENDER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ +$(RECORDER): $(KLCC) $(RECORDER).o $(OBJS) udevd.h + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(RECORDER).o $(OBJS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ + $(CONTROL): $(KLCC) $(CONTROL).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CONTROL).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ @@ -313,7 +319,7 @@ clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) \ - $(SENDER) $(INITSENDER) $(CONTROL) $(TESTER) $(STARTER) + $(SENDER) $(INITSENDER) $(RECORDER) $(CONTROL) $(TESTER) $(STARTER) -rm -f ccdv $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ @@ -374,6 +380,7 @@ install: install-config install-man install-dev.d all $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(INITSENDER) $(DESTDIR)$(sbindir)/$(INITSENDER) + $(INSTALL_PROGRAM) -D $(RECORDER) $(DESTDIR)$(sbindir)/$(RECORDER) $(INSTALL_PROGRAM) -D $(CONTROL) $(DESTDIR)$(sbindir)/$(CONTROL) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) @@ -400,6 +407,7 @@ uninstall: uninstall-man uninstall-dev.d - rm $(sbindir)/$(DAEMON) - rm $(sbindir)/$(SENDER) - rm $(sbindir)/$(INITSENDER) + - rm $(sbindir)/$(RECORDER) - rm $(sbindir)/$(CONTROL) - rm $(sbindir)/$(STARTER) - rm $(usrbindir)/$(INFO) diff --git a/udevd.c b/udevd.c index 873b05d946..f4c986b870 100644 --- a/udevd.c +++ b/udevd.c @@ -660,7 +660,7 @@ static void udev_done(int pid) list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { sysinfo(&info); - info("seq %llu exit, %ld sec old", msg->seqnum, info.uptime - msg->queue_time); + info("seq %llu exit, %ld seconds old", msg->seqnum, info.uptime - msg->queue_time); run_queue_delete(msg); /* we want to run the exec queue manager since there may @@ -951,9 +951,9 @@ int main(int argc, char *argv[], char *envp[]) msg = get_nl_msg(); if (msg) { msg_queue_insert(msg); - /* disable kernel uevent_helper with first netlink message */ + /* disable udevsend with first netlink message */ if (!uevent_nl_active) { - info("uevent_nl message received, disable uevent_helper messages"); + info("uevent_nl message received, disable udevsend messages"); uevent_nl_active = 1; } } diff --git a/udeveventrecorder.c b/udeveventrecorder.c new file mode 100644 index 0000000000..af7ea7c15c --- /dev/null +++ b/udeveventrecorder.c @@ -0,0 +1,127 @@ +/* + * udeveventrecorder.c + * + * Userspace devfs + * + * Copyright (C) 2004, 2005 Olaf Hering + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_version.h" +#include "udev_utils.h" +#include "logging.h" + +#define BUFSIZE 12345 +#define FNSIZE 123 + +static int log = 0; + +#ifdef USE_LOG +void log_message (int priority, const char *format, ...) +{ + va_list args; + + if (priority > log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +int main(int argc, char **argv, char **envp) +{ + int fd, i; + unsigned long seq; + char **ep = envp; + char *buf, *p, *a; + struct stat sb; + const char *env; + + if (stat("/events", &sb) || !(S_ISDIR(sb.st_mode))) + return 1; + + env = getenv("UDEV_LOG"); + if (env) + log = log_priority(env); + + logging_init("udeveventrecorder"); + dbg("version %s", UDEV_VERSION); + + p = getenv("SEQNUM"); + a = getenv("ACTION"); + buf = malloc(FNSIZE); + if (!(buf && a && argv[1])) + goto error; + if (p) + seq = strtoul(p, NULL, 0); + else + seq = 0; + + snprintf(buf, FNSIZE, "/events/debug.%05lu.%s.%s.%u", seq, argv[1], a ? a : "", getpid()); + if ((fd = open(buf, O_CREAT | O_WRONLY | O_TRUNC, 0644)) < 0) { + err("error creating '%s'", buf); + goto error; + } + free(buf); + p = malloc(BUFSIZE); + buf = p; + buf += snprintf(buf, p + BUFSIZE - buf, "set --"); + for (i = 1; i < argc; ++i) { + buf += snprintf(buf, p + BUFSIZE - buf, " %s", argv[i]); + if (buf > p + BUFSIZE) + goto full; + } + buf += snprintf(buf, p + BUFSIZE - buf, "\n"); + if (buf > p + BUFSIZE) + goto full; + while (*ep) { + unsigned char *t; + t = memchr(*ep, '=', strlen(*ep)); + if (t) { + *t = '\0'; + t++; + buf += snprintf(buf, p + BUFSIZE - buf, "%s='%s'\n", *ep, t); + --t; + *t = '='; + } + ep++; + if (buf > p + BUFSIZE) + break; + } + +full: + buf = p; + write(fd, buf, strlen(buf)); + close(fd); + free(buf); + return 0; + +error: + fprintf(stderr, "record enviroment to /events, to be called from udev context\n"); + return 1; +} diff --git a/udevinitsend.c b/udevinitsend.c index c7d56fc259..31a7109d1b 100644 --- a/udevinitsend.c +++ b/udevinitsend.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -38,16 +39,21 @@ #include "udev.h" #include "udev_version.h" #include "udevd.h" +#include "udev_utils.h" #include "logging.h" +static int log = 0; #ifdef USE_LOG -void log_message (int level, const char *format, ...) +void log_message (int priority, const char *format, ...) { va_list args; + if (priority > log) + return; + va_start(args, format); - vsyslog(level, format, args); + vsyslog(priority, format, args); va_end(args); } #endif @@ -164,6 +170,11 @@ int main(int argc, char *argv[], char *envp[]) int retval = 1; int disable_loop_detection = 0; int sock; + const char *env; + + env = getenv("UDEV_LOG"); + if (env) + log = log_priority(env); logging_init("udevinitsend"); dbg("version %s", UDEV_VERSION); -- cgit v1.2.3-54-g00ecf From 8ab44e3fd0b8fd4555db973d4c2c305ca09e787d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Jun 2005 01:58:47 +0200 Subject: udevd: control log-priority of the running daemon with udevcontrol Signed-off-by: Kay Sievers --- Makefile | 2 +- etc/udev/udev.conf.in | 1 - udev.c | 2 +- udev_utils.c | 4 +-- udevcontrol.c | 33 ++++++++++++++++++------ udevd.c | 70 ++++++++++++++++++++++++++++++--------------------- udevd.h | 8 +++--- udevinitsend.c | 2 +- udevsend.c | 2 +- 9 files changed, 78 insertions(+), 46 deletions(-) diff --git a/Makefile b/Makefile index 9ad6ee103b..bdb87e5651 100644 --- a/Makefile +++ b/Makefile @@ -388,7 +388,7 @@ install: install-config install-man install-dev.d all - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/10-udev.hotplug ifndef DESTDIR - killall $(DAEMON) - - $(sbindir)/$(DAEMON) -d + - $(sbindir)/$(DAEMON) --daemon - rm -rf $(udevdb) endif @extras="$(EXTRAS)" ; for target in $$extras ; do \ diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index 9d5300a861..efdb1d1808 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -1,5 +1,4 @@ # udev.conf -# # Where in the filesystem to place the device nodes udev_root="@udevdir@" diff --git a/udev.c b/udev.c index 3eb788f4c1..f7b9bf3573 100644 --- a/udev.c +++ b/udev.c @@ -109,7 +109,7 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - /* export log_level , as called programs may want to do the same as udev */ + /* export log_priority , as called programs may want to do the same as udev */ if (udev_log_priority) { char priority[32]; diff --git a/udev_utils.c b/udev_utils.c index d605631088..64a7ba9caa 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -409,10 +409,10 @@ int execute_command(const char *command, const char *subsystem) close(devnull); } retval = execv(arg, argv); - err("exec of child failed"); + err("exec of child '%s' failed", command); _exit(1); case -1: - dbg("fork of child failed"); + dbg("fork of child '%s' failed", command); break; return -1; default: diff --git a/udevcontrol.c b/udevcontrol.c index 4a54af805e..98776ccefd 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -37,18 +37,23 @@ #include "udev.h" #include "udev_version.h" #include "udevd.h" +#include "udev_utils.h" #include "logging.h" /* global variables */ static int sock = -1; +static int log = 0; #ifdef USE_LOG -void log_message (int level, const char *format, ...) +void log_message (int priority, const char *format, ...) { va_list args; + if (priority > log) + return; + va_start(args, format); - vsyslog(level, format, args); + vsyslog(priority, format, args); va_end(args); } #endif @@ -59,25 +64,37 @@ int main(int argc, char *argv[], char *envp[]) static struct udevd_msg usend_msg; struct sockaddr_un saddr; socklen_t addrlen; + const char *env; int retval = 1; + env = getenv("UDEV_LOG"); + if (env) + log = log_priority(env); + logging_init("udevcontrol"); dbg("version %s", UDEV_VERSION); if (argc != 2) { - info("usage: udevcontrol \n"); + info("usage: udevcontrol "); goto exit; } memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); strcpy(usend_msg.magic, UDEV_MAGIC); - if (strstr(argv[1], "stop_exec_queue")) + if (!strcmp(argv[1], "stop_exec_queue")) usend_msg.type = UDEVD_STOP_EXEC_QUEUE; - else if (strstr(argv[1], "start_exec_queue")) + else if (!strcmp(argv[1], "start_exec_queue")) usend_msg.type = UDEVD_START_EXEC_QUEUE; - else { - info("unknown command\n"); + else if (!strncmp(argv[1], "log_priority=", strlen("log_priority="))) { + int *level = (int *) usend_msg.envbuf; + char *prio = &argv[1][strlen("log_priority=")]; + + usend_msg.type = UDEVD_SET_LOG_LEVEL; + *level = log_priority(prio); + dbg("send log_priority=%i", *level); + } else { + err("unknown command\n"); goto exit; } @@ -99,7 +116,7 @@ int main(int argc, char *argv[], char *envp[]) info("error sending message (%s)", strerror(errno)); retval = 1; } else { - dbg("sent message '%x' (%u bytes sent)\n", usend_msg.type, retval); + dbg("sent message '%x' (%u bytes sent)", usend_msg.type, retval); retval = 0; } diff --git a/udevd.c b/udevd.c index f4c986b870..209b9fcd87 100644 --- a/udevd.c +++ b/udevd.c @@ -50,7 +50,7 @@ /* global variables*/ static int udevd_sock; -static int uevent_nl_sock; +static int uevent_netlink_sock; static pid_t sid; static int pipefds[2]; @@ -173,8 +173,8 @@ static void execute_udev(struct uevent_msg *msg) switch (pid) { case 0: /* child */ - if (uevent_nl_sock != -1) - close(uevent_nl_sock); + if (uevent_netlink_sock != -1) + close(uevent_netlink_sock); close(udevd_sock); logging_close(); @@ -362,6 +362,9 @@ static void exec_queue_manager(void) struct uevent_msg *tmp_msg; int running; + if (list_empty(&exec_list)) + return; + running = running_processes(); dbg("%d processes runnning on system", running); if (running < 0) @@ -506,6 +509,7 @@ static struct uevent_msg *get_udevd_msg(void) struct ucred *cred; char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; int envbuf_size; + int *intval; memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); iov.iov_base = &usend_msg; @@ -541,10 +545,10 @@ static struct uevent_msg *get_udevd_msg(void) return NULL; } -switch (usend_msg.type) { - case UDEVD_UDEVSEND: - case UDEVD_INITSEND: - dbg("udevd event message received"); + switch (usend_msg.type) { + case UDEVD_UEVENT_UDEVSEND: + case UDEVD_UEVENT_INITSEND: + info("udevd event message received"); envbuf_size = size - offsetof(struct udevd_msg, envbuf); dbg("envbuf_size=%i", envbuf_size); msg = get_msg_from_envbuf(usend_msg.envbuf, envbuf_size); @@ -553,14 +557,24 @@ switch (usend_msg.type) { msg->type = usend_msg.type; return msg; case UDEVD_STOP_EXEC_QUEUE: - dbg("udevd message (STOP_EXEC_QUEUE) received"); + info("udevd message (STOP_EXEC_QUEUE) received"); stop_exec_q = 1; break; case UDEVD_START_EXEC_QUEUE: - dbg("udevd message (START_EXEC_QUEUE) received"); + info("udevd message (START_EXEC_QUEUE) received"); stop_exec_q = 0; exec_queue_manager(); break; + case UDEVD_SET_LOG_LEVEL: + intval = (int *) usend_msg.envbuf; + info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i", *intval); + udev_log_priority = *intval; + break; + case UDEVD_SET_MAX_CHILDS: + intval = (int *) usend_msg.envbuf; + info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i", *intval); + max_childs = *intval; + break; default: dbg("unknown message type"); } @@ -568,7 +582,7 @@ switch (usend_msg.type) { } /* receive the kernel user event message and do some sanity checks */ -static struct uevent_msg *get_nl_msg(void) +static struct uevent_msg *get_netlink_msg(void) { struct uevent_msg *msg; int bufpos; @@ -576,7 +590,7 @@ static struct uevent_msg *get_nl_msg(void) static char buffer[UEVENT_BUFFER_SIZE + 512]; char *pos; - size = recv(uevent_nl_sock, &buffer, sizeof(buffer), 0); + size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); if (size < 0) { if (errno != EINTR) dbg("unable to receive udevd message"); @@ -593,7 +607,7 @@ static struct uevent_msg *get_nl_msg(void) msg = get_msg_from_envbuf(&buffer[bufpos], size-bufpos); if (msg == NULL) return NULL; - msg->type = UDEVD_NL; + msg->type = UDEVD_UEVENT_NETLINK; /* validate message */ pos = strchr(buffer, '@'); @@ -732,7 +746,7 @@ static int init_udevd_socket(void) return 0; } -static int init_uevent_nl_sock(void) +static int init_uevent_netlink_sock(void) { struct sockaddr_nl snl; int retval; @@ -742,18 +756,18 @@ static int init_uevent_nl_sock(void) snl.nl_pid = getpid(); snl.nl_groups = 0xffffffff; - uevent_nl_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); - if (uevent_nl_sock == -1) { + uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + if (uevent_netlink_sock == -1) { dbg("error getting socket, %s", strerror(errno)); return -1; } - retval = bind(uevent_nl_sock, (struct sockaddr *) &snl, + retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { dbg("bind failed, %s", strerror(errno)); - close(uevent_nl_sock); - uevent_nl_sock = -1; + close(uevent_netlink_sock); + uevent_netlink_sock = -1; return -1; } @@ -768,7 +782,7 @@ int main(int argc, char *argv[], char *envp[]) struct sigaction act; fd_set readfds; const char *value; - int uevent_nl_active = 0; + int uevent_netlink_active = 0; int daemonize = 0; int i; @@ -788,7 +802,7 @@ int main(int argc, char *argv[], char *envp[]) daemonize = 1; } if (strcmp(arg, "--stop-exec-queue") == 0) { - info("will not execute event until START_EXEC_QUEUE is received"); + info("will not execute events until START_EXEC_QUEUE is received"); stop_exec_q = 1; } } @@ -865,7 +879,7 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGALRM, &act, NULL); sigaction(SIGCHLD, &act, NULL); - if (init_uevent_nl_sock() < 0) { + if (init_uevent_netlink_sock() < 0) { dbg("uevent socket not available"); } @@ -918,8 +932,8 @@ int main(int argc, char *argv[], char *envp[]) FD_ZERO(&readfds); FD_SET(udevd_sock, &readfds); - if (uevent_nl_sock != -1) - FD_SET(uevent_nl_sock, &readfds); + if (uevent_netlink_sock != -1) + FD_SET(uevent_netlink_sock, &readfds); FD_SET(pipefds[0], &readfds); maxsockplus = udevd_sock+1; while (1) { @@ -938,7 +952,7 @@ int main(int argc, char *argv[], char *envp[]) msg = get_udevd_msg(); if (msg) { /* discard kernel messages if netlink is active */ - if (uevent_nl_active && msg->type == UDEVD_UDEVSEND && msg->seqnum != 0) { + if (uevent_netlink_active && msg->type == UDEVD_UEVENT_UDEVSEND && msg->seqnum != 0) { dbg("skip uevent_helper message, netlink is active"); free(msg); continue; @@ -947,14 +961,14 @@ int main(int argc, char *argv[], char *envp[]) } } - if (FD_ISSET(uevent_nl_sock, &workreadfds)) { - msg = get_nl_msg(); + if (FD_ISSET(uevent_netlink_sock, &workreadfds)) { + msg = get_netlink_msg(); if (msg) { msg_queue_insert(msg); /* disable udevsend with first netlink message */ - if (!uevent_nl_active) { + if (!uevent_netlink_active) { info("uevent_nl message received, disable udevsend messages"); - uevent_nl_active = 1; + uevent_netlink_active = 1; } } } diff --git a/udevd.h b/udevd.h index b8fb6913c9..34bfe931ba 100644 --- a/udevd.h +++ b/udevd.h @@ -50,11 +50,13 @@ enum udevd_msg_type { UDEVD_UNKNOWN, - UDEVD_UDEVSEND, - UDEVD_INITSEND, - UDEVD_NL, + UDEVD_UEVENT_UDEVSEND, + UDEVD_UEVENT_INITSEND, + UDEVD_UEVENT_NETLINK, UDEVD_STOP_EXEC_QUEUE, UDEVD_START_EXEC_QUEUE, + UDEVD_SET_LOG_LEVEL, + UDEVD_SET_MAX_CHILDS, }; diff --git a/udevinitsend.c b/udevinitsend.c index 31a7109d1b..26ae5c8418 100644 --- a/udevinitsend.c +++ b/udevinitsend.c @@ -100,7 +100,7 @@ static int udevsend(char *filename, int sock, int disable_loop_detection) memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); strcpy(usend_msg.magic, UDEV_MAGIC); - usend_msg.type = UDEVD_INITSEND; + usend_msg.type = UDEVD_UEVENT_INITSEND; ls = fdmap; ch = le = ls; diff --git a/udevsend.c b/udevsend.c index 42ef0271dd..bdc69d0508 100644 --- a/udevsend.c +++ b/udevsend.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[], char *envp[]) memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); strcpy(usend_msg.magic, UDEV_MAGIC); - usend_msg.type = UDEVD_UDEVSEND; + usend_msg.type = UDEVD_UEVENT_UDEVSEND; /* copy all keys to send buffer */ for (i = 0; envp[i]; i++) { -- cgit v1.2.3-54-g00ecf From 7628ff6e144a94c48e463d0188022f5661e0ba40 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Jun 2005 03:22:27 +0200 Subject: udevcontrol: add max_childs command Signed-off-by: Kay Sievers --- udevcontrol.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/udevcontrol.c b/udevcontrol.c index 98776ccefd..f19ae98fba 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -65,6 +65,8 @@ int main(int argc, char *argv[], char *envp[]) struct sockaddr_un saddr; socklen_t addrlen; const char *env; + const char *val; + int *intval; int retval = 1; env = getenv("UDEV_LOG"); @@ -75,7 +77,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("version %s", UDEV_VERSION); if (argc != 2) { - info("usage: udevcontrol "); + err("error finding comand"); goto exit; } @@ -87,20 +89,25 @@ int main(int argc, char *argv[], char *envp[]) else if (!strcmp(argv[1], "start_exec_queue")) usend_msg.type = UDEVD_START_EXEC_QUEUE; else if (!strncmp(argv[1], "log_priority=", strlen("log_priority="))) { - int *level = (int *) usend_msg.envbuf; - char *prio = &argv[1][strlen("log_priority=")]; - + intval = (int *) usend_msg.envbuf; + val = &argv[1][strlen("log_priority=")]; usend_msg.type = UDEVD_SET_LOG_LEVEL; - *level = log_priority(prio); - dbg("send log_priority=%i", *level); + *intval = log_priority(val); + info("send log_priority=%i", *intval); + } else if (!strncmp(argv[1], "max_childs=", strlen("max_childs="))) { + intval = (int *) usend_msg.envbuf; + val = &argv[1][strlen("max_childs=")]; + usend_msg.type = UDEVD_SET_MAX_CHILDS; + *intval = atoi(val); + info("send max_childs=%i", *intval); } else { - err("unknown command\n"); + err("error parsing command\n"); goto exit; } sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { - info("error getting socket"); + err("error getting socket"); goto exit; } @@ -116,7 +123,7 @@ int main(int argc, char *argv[], char *envp[]) info("error sending message (%s)", strerror(errno)); retval = 1; } else { - dbg("sent message '%x' (%u bytes sent)", usend_msg.type, retval); + dbg("sent message type=0x%02x, %u bytes sent", usend_msg.type, retval); retval = 0; } -- cgit v1.2.3-54-g00ecf From e33d1515e2d22fe8f872556dd649e0db3b601057 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Jun 2005 03:26:16 +0200 Subject: Makefile: remove dev.d/ hotplug.d/ from install target Signed-off-by: Kay Sievers --- Makefile | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index bdb87e5651..8694b917a2 100644 --- a/Makefile +++ b/Makefile @@ -63,10 +63,7 @@ etcdir = ${prefix}/etc sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin mandir = ${prefix}/usr/share/man -hotplugdir = ${etcdir}/hotplug.d/default configdir = ${etcdir}/udev -initdir = ${etcdir}/init.d -dev_ddir = ${etcdir}/dev.d srcdir = . INSTALL = /usr/bin/install -c @@ -347,16 +344,6 @@ install-config: $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir)/rules.d/50-udev.rules; \ fi -install-dev.d: - $(INSTALL) -d $(DESTDIR)$(dev_ddir)/default - $(INSTALL_PROGRAM) -D etc/dev.d/net/hotplug.dev $(DESTDIR)$(dev_ddir)/net/hotplug.dev - -uninstall-dev.d: - - rm $(dev_ddir)/net/hotplug.dev - - rmdir $(dev_ddir)/net - - rmdir $(dev_ddir)/default - - rmdir $(dev_ddir) - install-man: $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 @@ -373,19 +360,15 @@ uninstall-man: - rm $(mandir)/man8/udevd.8 - rm $(mandir)/man8/udevsend.8 -install: install-config install-man install-dev.d all +install: install-config install-man all $(INSTALL) -d $(DESTDIR)$(udevdir) - $(INSTALL) -d $(DESTDIR)$(hotplugdir) $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) - $(INSTALL_PROGRAM) -D $(INITSENDER) $(DESTDIR)$(sbindir)/$(INITSENDER) - $(INSTALL_PROGRAM) -D $(RECORDER) $(DESTDIR)$(sbindir)/$(RECORDER) $(INSTALL_PROGRAM) -D $(CONTROL) $(DESTDIR)$(sbindir)/$(CONTROL) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) - - ln -f -s $(sbindir)/$(SENDER) $(DESTDIR)$(hotplugdir)/10-udev.hotplug ifndef DESTDIR - killall $(DAEMON) - $(sbindir)/$(DAEMON) --daemon @@ -397,8 +380,7 @@ endif -C $$target $@ ; \ done ; \ -uninstall: uninstall-man uninstall-dev.d - - rm $(hotplugdir)/10-udev.hotplug +uninstall: uninstall-man - rm $(configdir)/rules.d/50-udev.rules - rm $(configdir)/udev.conf - rmdir $(configdir)/rules.d @@ -412,7 +394,6 @@ uninstall: uninstall-man uninstall-dev.d - rm $(sbindir)/$(STARTER) - rm $(usrbindir)/$(INFO) - rm $(usrbindir)/$(TESTER) - - rmdir $(hotplugdir) - rm -rf $(udevdb) - rmdir $(udevdir) - killall $(DAEMON) -- cgit v1.2.3-54-g00ecf From ae8d5e161fe916e39f226ce53f2c5f8b31f582a0 Mon Sep 17 00:00:00 2001 From: Stefan Schweizer Date: Sat, 11 Jun 2005 08:09:00 +0200 Subject: [PATCH] Dialout group fix for capi devices in the gentoo rules file currently it is not possible to use the capi devices for users even when the user is in the dialout group. Please apply the attached patch and fix the issue. There is also a gentoo bug about this: http://bugs.gentoo.org/show_bug.cgi?id=92445 diff -ur udev-056.orig/etc/udev/gentoo/udev.rules udev-056/etc/udev/gentoo/udev.rules --- etc/udev/gentoo/udev.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index db8c5d9263..65113aebf7 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -51,8 +51,8 @@ KERNEL="timer", NAME="snd/%k" KERNEL="seq", NAME="snd/%k" # capi devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi*", NAME="capi/%n" +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20", GROUP="dialout" +KERNEL="capi*", NAME="capi/%n", GROUP="dialout" # cpu devices KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" -- cgit v1.2.3-54-g00ecf From 57663b364beda200ec189c889e7d9c9fede37c9a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Jun 2005 10:57:10 +0200 Subject: remove device node, when type block/char has changed Signed-off-by: Kay Sievers --- README | 3 +-- udev_add.c | 27 +++++++++++++-------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/README b/README index 54cee659a8..a2ce9c7d36 100644 --- a/README +++ b/README @@ -10,8 +10,7 @@ To use: - Your 2.6 kernel must have had CONFIG_HOTPLUG enabled when it was built. -- Make sure sysfs is mounted. udev will figure out where sysfs is mounted, but - the traditional place for it is at /sys. You can mount it by hand by running: +- Make sure sysfs is mounted at /sys. You can mount it by running: mount -t sysfs none /sys - Make sure you have the latest version of the linux-hotplug scripts. They are diff --git a/udev_add.c b/udev_add.c index 2081e503c7..89af96570f 100644 --- a/udev_add.c +++ b/udev_add.c @@ -52,12 +52,23 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo struct stat stats; int retval = 0; + switch (udev->type) { + case DEV_BLOCK: + mode |= S_IFBLK; + break; + case DEV_CLASS: + mode |= S_IFCHR; + break; + default: + dbg("unknown node type %c\n", udev->type); + return -EINVAL; + } + if (stat(file, &stats) != 0) goto create; /* preserve node with already correct numbers, to not change the inode number */ - if (((stats.st_mode & S_IFMT) == S_IFBLK || (stats.st_mode & S_IFMT) == S_IFCHR) && - (stats.st_rdev == devt)) { + if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { info("preserve file '%s', cause it has correct dev_t", file); selinux_setfilecon(file, udev->kernel_name, stats.st_mode); goto perms; @@ -69,18 +80,6 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo dbg("already present file '%s' unlinked", file); create: - switch (udev->type) { - case DEV_BLOCK: - mode |= S_IFBLK; - break; - case DEV_CLASS: - mode |= S_IFCHR; - break; - default: - dbg("unknown node type %c\n", udev->type); - return -EINVAL; - } - selinux_setfscreatecon(file, udev->kernel_name, mode); retval = mknod(file, mode, devt); selinux_resetfscreatecon(); -- cgit v1.2.3-54-g00ecf From bf5d2964730e63316861e310d1f24c165b11e961 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 20 Jun 2005 00:29:38 +0200 Subject: prepare for module loading rules and add MODALIAS key Signed-off-by: Kay Sievers --- test/udev-test.pl | 51 ++++++++++++- udev_rules.c | 216 +++++++++++++++++++++++++++++++++++++++++------------ udev_rules.h | 6 ++ udev_rules_parse.c | 14 ++++ udev_sysfs.c | 54 +++++++------- 5 files changed, 262 insertions(+), 79 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 884abf9e8b..9225352130 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -241,7 +241,7 @@ BUS=="scsi", ID=="0:0:0:0", NAME="first_disk%n" EOF }, { - desc => "test NAME substitution chars", + desc => "test substitution chars", subsys => "block", devpath => "/block/sda/sda3", exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , @@ -250,7 +250,7 @@ BUS=="scsi", ID=="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" EOF }, { - desc => "test NAME substitution chars (with length limit)", + desc => "test substitution chars (with length limit)", subsys => "block", devpath => "/block/sda/sda3", exp_name => "M8-m3-n3-b0:0-sIBM" , @@ -360,6 +360,51 @@ EOF exp_name => "my-foo8" , rules => < "test substitution by variable name", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "Major:8-minor:3-kernelnumber:3-bus:0:0:0:0" , + rules => < "test substitution by variable name 2", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "Major:8-minor:3-kernelnumber:3-bus:0:0:0:0" , + rules => < "test substitution by variable name 3", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "830:0:0:03" , + rules => < "test substitution by variable name 4", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "833" , + rules => < "test substitution by variable name 5", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "8330:0:0:0" , + rules => < "yes", option => "clean", rules => <path, name); tmpattr = sysfs_get_classdev_attr(class_dev, name); if (tmpattr) goto attr_found; } if (sysfs_device) { + dbg("look for devices attribute '%s/%s'", sysfs_device->path, name); tmpattr = sysfs_get_device_attr(sysfs_device, name); if (tmpattr) goto attr_found; } - return -1; attr_found: @@ -197,56 +198,133 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, { char temp[PATH_SIZE]; char temp2[PATH_SIZE]; - char *tail, *pos, *cpos, *attr, *rest; + char *head, *tail, *cpos, *attr, *rest; int len; int i; - char c; unsigned int next_free_number; struct sysfs_class_device *class_dev_parent; - - pos = string; + enum subst_type { + SUBST_UNKNOWN, + SUBST_DEVPATH, + SUBST_ID, + SUBST_KERNEL_NUMBER, + SUBST_KERNEL_NAME, + SUBST_MAJOR, + SUBST_MINOR, + SUBST_RESULT, + SUBST_SYSFS, + SUBST_ENUM, + SUBST_PARENT, + SUBST_TEMP_NODE, + SUBST_ROOT, + SUBST_MODALIAS, + }; + static const struct subst_map { + char *name; + char fmt; + enum subst_type type; + } map[] = { + { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, + { .name = "id", .fmt = 'b', .type = SUBST_ID }, + { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, + { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL_NAME }, + { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, + { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, + { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, + { .name = "sysfs", .fmt = 's', .type = SUBST_SYSFS }, + { .name = "enum", .fmt = 'e', .type = SUBST_ENUM }, + { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, + { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, + { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, + { .name = "modalias", .fmt = 'A', .type = SUBST_MODALIAS }, + {} + }; + enum subst_type type; + const struct subst_map *subst; + + head = string; while (1) { - pos = strchr(pos, '%'); - if (pos == NULL) - break; - - pos[0] = '\0'; - tail = pos+1; - len = get_format_len(&tail); - c = tail[0]; - strlcpy(temp, tail+1, sizeof(temp)); - tail = temp; - dbg("format=%c, string='%s', tail='%s'",c , string, tail); + len = -1; + while (head[0] != '\0') { + if (head[0] == '$') { + /* substitute named variable */ + if (head[1] == '\0') + break; + if (head[1] == '$') { + strlcpy(temp, head+2, sizeof(temp)); + strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + for (subst = map; subst->name; subst++) { + if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { + type = subst->type; + tail = head + strlen(subst->name)+1; + dbg("will substitute format name '%s'", subst->name); + goto found; + } + } + } + else if (head[0] == '%') { + /* substitute format char */ + if (head[1] == '\0') + break; + if (head[1] == '%') { + strlcpy(temp, head+2, sizeof(temp)); + strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + tail = head+1; + len = get_format_len(&tail); + for (subst = map; subst->name; subst++) { + if (tail[0] == subst->fmt) { + type = subst->type; + tail++; + dbg("will substitute format char '%c'", subst->fmt); + goto found; + } + } + } + head++; + } + break; +found: attr = get_format_attribute(&tail); + strlcpy(temp, tail, sizeof(temp)); + dbg("format=%i, string='%s', tail='%s', class_dev=%p, sysfs_dev=%p", + type ,string, tail, class_dev, sysfs_device); - switch (c) { - case 'p': + switch (type) { + case SUBST_DEVPATH: strlcat(string, udev->devpath, maxsize); - dbg("substitute kernel name '%s'", udev->kernel_name); + dbg("substitute devpath '%s'", udev->devpath); break; - case 'b': + case SUBST_ID: strlcat(string, udev->bus_id, maxsize); dbg("substitute bus_id '%s'", udev->bus_id); break; - case 'k': + case SUBST_KERNEL_NAME: strlcat(string, udev->kernel_name, maxsize); dbg("substitute kernel name '%s'", udev->kernel_name); break; - case 'n': + case SUBST_KERNEL_NUMBER: strlcat(string, udev->kernel_number, maxsize); dbg("substitute kernel number '%s'", udev->kernel_number); - break; - case 'm': - sprintf(temp2, "%d", minor(udev->devt)); - strlcat(string, temp2, maxsize); - dbg("substitute minor number '%s'", temp2); break; - case 'M': + case SUBST_MAJOR: sprintf(temp2, "%d", major(udev->devt)); strlcat(string, temp2, maxsize); dbg("substitute major number '%s'", temp2); break; - case 'c': + case SUBST_MINOR: + sprintf(temp2, "%d", minor(udev->devt)); + strlcat(string, temp2, maxsize); + dbg("substitute minor number '%s'", temp2); + break; + case SUBST_RESULT: if (udev->program_result[0] == '\0') break; /* get part part of the result string */ @@ -280,7 +358,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, dbg("substitute result string '%s'", udev->program_result); } break; - case 's': + case SUBST_SYSFS: if (attr == NULL) { dbg("missing attribute"); break; @@ -307,18 +385,14 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, strlcat(string, temp2, maxsize); dbg("substitute sysfs value '%s'", temp2); break; - case '%': - strlcat(string, "%", maxsize); - pos++; - break; - case 'e': + case SUBST_ENUM: next_free_number = find_free_number(udev, string); if (next_free_number > 0) { sprintf(temp2, "%d", next_free_number); strlcat(string, temp2, maxsize); } break; - case 'P': + case SUBST_PARENT: if (!class_dev) break; class_dev_parent = sysfs_get_classdev_parent(class_dev); @@ -336,7 +410,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, udev_cleanup_device(&udev_parent); } break; - case 'N': + case SUBST_TEMP_NODE: if (udev->tmp_node[0] == '\0') { dbg("create temporary device node for callout"); snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", @@ -347,19 +421,27 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, strlcat(string, udev->tmp_node, maxsize); dbg("substitute temporary device node name '%s'", udev->tmp_node); break; - case 'r': + case SUBST_ROOT: strlcat(string, udev_root, maxsize); dbg("substitute udev_root '%s'", udev_root); break; + case SUBST_MODALIAS: + if (find_sysfs_attribute(NULL, sysfs_device, "modalias", temp2, sizeof(temp2)) != 0) + break; + strlcat(string, temp2, maxsize); + dbg("substitute MODALIAS '%s'", temp2); + break; default: - err("unknown substitution type '%%%c'", c); + err("unknown substitution type=%i", type); break; } - /* truncate to specified length */ - if (len > 0) - pos[len] = '\0'; + /* possibly truncate to format-char specified length */ + if (len != -1) { + head[len] = '\0'; + dbg("truncate to %i chars, subtitution string becomes '%s'", len, head); + } - strlcat(string, tail, maxsize); + strlcat(string, temp, maxsize); } } @@ -519,6 +601,42 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg(KEY_SUBSYSTEM " key is true"); } + if (rule->devpath_operation != KEY_OP_UNSET) { + dbg("check for " KEY_DEVPATH " rule->devpath='%s' udev->devpath='%s'", + rule->devpath, udev->devpath); + if (strcmp_pattern(rule->devpath, udev->devpath) != 0) { + dbg(KEY_DEVPATH " is not matching"); + if (rule->devpath_operation != KEY_OP_NOMATCH) + goto exit; + } else { + dbg(KEY_DEVPATH " matches"); + if (rule->devpath_operation == KEY_OP_NOMATCH) + goto exit; + } + dbg(KEY_DEVPATH " key is true"); + } + + if (rule->modalias_operation != KEY_OP_UNSET) { + char value[NAME_SIZE]; + + if (find_sysfs_attribute(NULL, sysfs_device, "modalias", value, sizeof(value)) != 0) { + dbg(KEY_MODALIAS " value not found"); + goto exit; + } + dbg("check for " KEY_MODALIAS " rule->modalias='%s' modalias='%s'", + rule->modalias, value); + if (strcmp_pattern(rule->modalias, value) != 0) { + dbg(KEY_MODALIAS " is not matching"); + if (rule->modalias_operation != KEY_OP_NOMATCH) + goto exit; + } else { + dbg(KEY_MODALIAS " matches"); + if (rule->modalias_operation == KEY_OP_NOMATCH) + goto exit; + } + dbg(KEY_MODALIAS " key is true"); + } + if (rule->env_pair_count) { int i; @@ -729,13 +847,13 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d /* look for a matching rule to apply */ list_for_each_entry(rule, &udev_rule_list, node) { + if (udev->name_set && rule->name_operation != KEY_OP_UNSET) { + dbg("node name already set, rule ignored"); + continue; + } + dbg("process rule"); if (match_rule(udev, rule, class_dev, sysfs_device) == 0) { - if (udev->name_set && rule->name_operation != KEY_OP_UNSET) { - dbg("node name already set, rule ignored"); - continue; - } - /* apply options */ if (rule->ignore_device) { info("configured rule in '%s[%i]' applied, '%s' is ignored", @@ -917,7 +1035,7 @@ int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device) } if (rule->run[0] != '\0') { strlcpy(program, rule->run, sizeof(program)); - apply_format(udev, program, sizeof(program), NULL, NULL); + apply_format(udev, program, sizeof(program), NULL, sysfs_device); dbg("add run '%s'", program); name_list_add(&udev->run_list, program, 0); } diff --git a/udev_rules.h b/udev_rules.h index 75ffd5cb0f..2bf8107543 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -31,6 +31,7 @@ #define KEY_KERNEL "KERNEL" #define KEY_SUBSYSTEM "SUBSYSTEM" #define KEY_ACTION "ACTION" +#define KEY_DEVPATH "DEVPATH" #define KEY_BUS "BUS" #define KEY_ID "ID" #define KEY_PROGRAM "PROGRAM" @@ -38,6 +39,7 @@ #define KEY_DRIVER "DRIVER" #define KEY_SYSFS "SYSFS" #define KEY_ENV "ENV" +#define KEY_MODALIAS "MODALIAS" #define KEY_NAME "NAME" #define KEY_SYMLINK "SYMLINK" #define KEY_OWNER "OWNER" @@ -80,6 +82,8 @@ struct udev_rule { enum key_operation subsystem_operation; char action[NAME_SIZE]; enum key_operation action_operation; + char devpath[PATH_SIZE]; + enum key_operation devpath_operation; char bus[NAME_SIZE]; enum key_operation bus_operation; char id[NAME_SIZE]; @@ -94,6 +98,8 @@ struct udev_rule { int sysfs_pair_count; struct key_pair env_pair[KEY_ENV_PAIRS_MAX]; int env_pair_count; + enum key_operation modalias_operation; + char modalias[PATH_SIZE]; char name[PATH_SIZE]; enum key_operation name_operation; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 57c797dd31..89925a35e4 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -269,6 +269,13 @@ static int rules_parse(const char *filename) continue; } + if (strcasecmp(key, KEY_DEVPATH) == 0) { + strlcpy(rule.devpath, value, sizeof(rule.devpath)); + rule.devpath_operation = operation; + valid = 1; + continue; + } + if (strcasecmp(key, KEY_BUS) == 0) { strlcpy(rule.bus, value, sizeof(rule.bus)); rule.bus_operation = operation; @@ -325,6 +332,13 @@ static int rules_parse(const char *filename) continue; } + if (strcasecmp(key, KEY_MODALIAS) == 0) { + strlcpy(rule.modalias, value, sizeof(rule.modalias)); + rule.modalias_operation = operation; + valid = 1; + continue; + } + if (strcasecmp(key, KEY_DRIVER) == 0) { strlcpy(rule.driver, value, sizeof(rule.driver)); rule.driver_operation = operation; diff --git a/udev_sysfs.c b/udev_sysfs.c index f9ff1ed2f9..5c43190644 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -297,38 +297,38 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "usb", .file = "idVendor" }, { .bus = "usb", .file = "iInterface" }, { .bus = "usb", .file = "bNumEndpoints" }, - { .bus = "usb-serial", .file = "detach_state" }, - { .bus = "ide", .file = "detach_state" }, + { .bus = "usb-serial", .file = "power" }, + { .bus = "ide", .file = "power" }, { .bus = "pci", .file = "vendor" }, - { .bus = "platform", .file = "detach_state" }, - { .bus = "pcmcia", .file = "detach_state" }, - { .bus = "i2c", .file = "detach_state" }, + { .bus = "platform", .file = "power" }, + { .bus = "pcmcia", .file = "power" }, + { .bus = "i2c", .file = "power" }, { .bus = "ieee1394", .file = "node_count" }, { .bus = "ieee1394", .file = "nodeid" }, { .bus = "ieee1394", .file = "address" }, { .bus = "bttv-sub", .file = NULL }, - { .bus = "pnp", .file = "detach_state" }, - { .bus = "eisa", .file = "detach_state" }, - { .bus = "serio", .file = "detach_state" }, - { .bus = "pseudo", .file = "detach_state" }, - { .bus = "mmc", .file = "detach_state" }, - { .bus = "macio", .file = "detach_state" }, - { .bus = "of_platform", .file = "detach_state" }, - { .bus = "vio", .file = "detach_state" }, - { .bus = "ecard", .file = "detach_state" }, - { .bus = "sa1111-rab", .file = "detach_state" }, - { .bus = "amba", .file = "detach_state" }, - { .bus = "locomo-bus", .file = "detach_state" }, - { .bus = "logicmodule", .file = "detach_state" }, - { .bus = "parisc", .file = "detach_state" }, - { .bus = "ocp", .file = "detach_state" }, - { .bus = "dio", .file = "detach_state" }, - { .bus = "MCA", .file = "detach_state" }, - { .bus = "wl", .file = "detach_state" }, - { .bus = "ccwgroup", .file = "detach_state" }, - { .bus = "css", .file = "detach_state" }, - { .bus = "ccw", .file = "detach_state" }, - { .bus = "iucv", .file = "detach_state" }, + { .bus = "pnp", .file = "power" }, + { .bus = "eisa", .file = "power" }, + { .bus = "serio", .file = "power" }, + { .bus = "pseudo", .file = "power" }, + { .bus = "mmc", .file = "power" }, + { .bus = "macio", .file = "power" }, + { .bus = "of_platform", .file = "power" }, + { .bus = "vio", .file = "power" }, + { .bus = "ecard", .file = "power" }, + { .bus = "sa1111-rab", .file = "power" }, + { .bus = "amba", .file = "power" }, + { .bus = "locomo-bus", .file = "power" }, + { .bus = "logicmodule", .file = "power" }, + { .bus = "parisc", .file = "power" }, + { .bus = "ocp", .file = "power" }, + { .bus = "dio", .file = "power" }, + { .bus = "MCA", .file = "power" }, + { .bus = "wl", .file = "power" }, + { .bus = "ccwgroup", .file = "power" }, + { .bus = "css", .file = "power" }, + { .bus = "ccw", .file = "power" }, + { .bus = "iucv", .file = "power" }, { NULL, NULL } }; const struct device_file *devicefile = NULL; -- cgit v1.2.3-54-g00ecf From d27d3bb05288fb5e70bc3f3fc7da1dc8ee5413a8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 22 Jun 2005 01:31:24 +0200 Subject: fix udevstart and let all events trvel trough udev Signed-off-by: Kay Sievers --- udev.c | 14 +++++++------- udevtest.c | 17 ++++++++--------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/udev.c b/udev.c index f7b9bf3573..67d081d005 100644 --- a/udev.c +++ b/udev.c @@ -200,13 +200,13 @@ int main(int argc, char *argv[], char *envp[]) info("device event will be ignored"); goto cleanup; } - } else if (strcmp(action, "remove") == 0) { - dbg("devices remove"); - udev_rules_get_run(&udev, NULL); - if (udev.ignore_device) { - info("device event will be ignored"); - goto cleanup; - } + } + } else { + dbg("default handling"); + udev_rules_get_run(&udev, NULL); + if (udev.ignore_device) { + info("device event will be ignored"); + goto cleanup; } } diff --git a/udevtest.c b/udevtest.c index 93387f76d0..d3e43593bf 100644 --- a/udevtest.c +++ b/udevtest.c @@ -98,12 +98,6 @@ int main(int argc, char *argv[], char *envp[]) /* fill in values and test_run flag*/ udev_init_device(&udev, devpath, subsystem, "add"); - /* skip subsystems without "dev", but handle net devices */ - if (udev.type != DEV_NET && subsystem_expect_no_dev(udev.subsystem)) { - info("don't care about '%s' devices", udev.subsystem); - return 2; - } - /* open the device */ snprintf(path, sizeof(path), "%s%s", sysfs_path, udev.devpath); path[sizeof(path)-1] = '\0'; @@ -112,13 +106,18 @@ int main(int argc, char *argv[], char *envp[]) info("sysfs_open_class_device_path failed"); return 1; } - info("opened class_dev->name='%s'", class_dev->name); + if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS) + udev.devt = get_devt(class_dev); + /* simulate node creation with test flag */ udev.test_run = 1; - udev_add_device(&udev, class_dev); - + if (udev.type == DEV_NET || udev.devt) { + udev_rules_get_name(&udev, class_dev); + udev_add_device(&udev, class_dev); + } else + info("only char and block devices with a dev-file are supported by this test program"); sysfs_close_class_device(class_dev); return 0; -- cgit v1.2.3-54-g00ecf From c9b8dbfb652a10d2f1c1b122a3806c21cab87ab4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 22 Jun 2005 02:11:59 +0200 Subject: fix the fix and change the file to wait for to the "bus" link Signed-off-by: Kay Sievers --- udev.c | 40 +++++++++++++++++++--------------------- udev_sysfs.c | 54 +++++++++++++++++++++++++++--------------------------- udev_sysfs.h | 2 +- 3 files changed, 47 insertions(+), 49 deletions(-) diff --git a/udev.c b/udev.c index 67d081d005..36ff21d5b7 100644 --- a/udev.c +++ b/udev.c @@ -179,27 +179,25 @@ int main(int argc, char *argv[], char *envp[]) /* export name of device node or netif */ if (udev.devname[0] != '\0') setenv("DEVNAME", udev.devname, 1); - } else if (udev.type == DEV_DEVICE) { - if (strcmp(action, "add") == 0) { - struct sysfs_device *devices_dev; - - /* wait for sysfs of /sys/devices/ */ - dbg("devices add"); - snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); - path[sizeof(path)-1] = '\0'; - devices_dev = wait_devices_device_open(path); - if (!devices_dev) { - dbg("devices device unavailable (probably remove has beaten us)"); - goto run; - } - dbg("devices device opened '%s'", path); - wait_for_devices_device(devices_dev, &error); - udev_rules_get_run(&udev, devices_dev); - sysfs_close_device(devices_dev); - if (udev.ignore_device) { - info("device event will be ignored"); - goto cleanup; - } + } else if (udev.type == DEV_DEVICE && strcmp(action, "add") == 0) { + struct sysfs_device *devices_dev; + + /* wait for sysfs of /sys/devices/ */ + dbg("devices add"); + snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); + path[sizeof(path)-1] = '\0'; + devices_dev = wait_devices_device_open(path); + if (!devices_dev) { + dbg("devices device unavailable (probably remove has beaten us)"); + goto run; + } + dbg("devices device opened '%s'", path); + wait_for_devices_device(devices_dev, &error); + udev_rules_get_run(&udev, devices_dev); + sysfs_close_device(devices_dev); + if (udev.ignore_device) { + info("device event will be ignored"); + goto cleanup; } } else { dbg("default handling"); diff --git a/udev_sysfs.c b/udev_sysfs.c index 5c43190644..90ce48caea 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -297,38 +297,38 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "usb", .file = "idVendor" }, { .bus = "usb", .file = "iInterface" }, { .bus = "usb", .file = "bNumEndpoints" }, - { .bus = "usb-serial", .file = "power" }, - { .bus = "ide", .file = "power" }, + { .bus = "usb-serial", .file = "bus" }, + { .bus = "ide", .file = "bus" }, { .bus = "pci", .file = "vendor" }, - { .bus = "platform", .file = "power" }, - { .bus = "pcmcia", .file = "power" }, - { .bus = "i2c", .file = "power" }, + { .bus = "platform", .file = "bus" }, + { .bus = "pcmcia", .file = "bus" }, + { .bus = "i2c", .file = "bus" }, { .bus = "ieee1394", .file = "node_count" }, { .bus = "ieee1394", .file = "nodeid" }, { .bus = "ieee1394", .file = "address" }, { .bus = "bttv-sub", .file = NULL }, - { .bus = "pnp", .file = "power" }, - { .bus = "eisa", .file = "power" }, - { .bus = "serio", .file = "power" }, - { .bus = "pseudo", .file = "power" }, - { .bus = "mmc", .file = "power" }, - { .bus = "macio", .file = "power" }, - { .bus = "of_platform", .file = "power" }, - { .bus = "vio", .file = "power" }, - { .bus = "ecard", .file = "power" }, - { .bus = "sa1111-rab", .file = "power" }, - { .bus = "amba", .file = "power" }, - { .bus = "locomo-bus", .file = "power" }, - { .bus = "logicmodule", .file = "power" }, - { .bus = "parisc", .file = "power" }, - { .bus = "ocp", .file = "power" }, - { .bus = "dio", .file = "power" }, - { .bus = "MCA", .file = "power" }, - { .bus = "wl", .file = "power" }, - { .bus = "ccwgroup", .file = "power" }, - { .bus = "css", .file = "power" }, - { .bus = "ccw", .file = "power" }, - { .bus = "iucv", .file = "power" }, + { .bus = "pnp", .file = "bus" }, + { .bus = "eisa", .file = "bus" }, + { .bus = "serio", .file = "bus" }, + { .bus = "pseudo", .file = "bus" }, + { .bus = "mmc", .file = "bus" }, + { .bus = "macio", .file = "bus" }, + { .bus = "of_platform", .file = "bus" }, + { .bus = "vio", .file = "bus" }, + { .bus = "ecard", .file = "bus" }, + { .bus = "sa1111-rab", .file = "bus" }, + { .bus = "amba", .file = "bus" }, + { .bus = "locomo-bus", .file = "bus" }, + { .bus = "logicmodule", .file = "bus" }, + { .bus = "parisc", .file = "bus" }, + { .bus = "ocp", .file = "bus" }, + { .bus = "dio", .file = "bus" }, + { .bus = "MCA", .file = "bus" }, + { .bus = "wl", .file = "bus" }, + { .bus = "ccwgroup", .file = "bus" }, + { .bus = "css", .file = "bus" }, + { .bus = "ccw", .file = "bus" }, + { .bus = "iucv", .file = "bus" }, { NULL, NULL } }; const struct device_file *devicefile = NULL; diff --git a/udev_sysfs.h b/udev_sysfs.h index 77c0e6a8ef..8078f62d82 100644 --- a/udev_sysfs.h +++ b/udev_sysfs.h @@ -24,7 +24,7 @@ #include "libsysfs/sysfs/libsysfs.h" -#define WAIT_MAX_SECONDS 5 +#define WAIT_MAX_SECONDS 3 #define WAIT_LOOP_PER_SECOND 20 extern dev_t get_devt(struct sysfs_class_device *class_dev); -- cgit v1.2.3-54-g00ecf From 6bf0ffe8fd312c1e6549cb1721d7a7efeee77185 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Jun 2005 18:05:32 +0200 Subject: allow rules to be compiled to one binary file All the rule files can be compiled into a single file, which can be mapped into the udev process to avoid parsing the rules with every event. Signed-off-by: Kay Sievers --- Makefile | 11 +++- test/devd_test | 0 test/net_test | 0 test/replace_test | 0 test/show_all_devices.sh | 0 test/test.all | 0 test/test.block | 0 test/test.tty | 0 test/testd.block | 0 udev_rules.c | 15 ++++-- udev_rules.h | 8 +-- udev_rules_parse.c | 89 ++++++++++++++++++++++++++++----- udev_utils.c | 2 +- udev_utils.h | 2 +- udevrulescompile.c | 127 +++++++++++++++++++++++++++++++++++++++++++++++ 15 files changed, 232 insertions(+), 22 deletions(-) mode change 100644 => 100755 test/devd_test mode change 100644 => 100755 test/net_test mode change 100644 => 100755 test/replace_test mode change 100644 => 100755 test/show_all_devices.sh mode change 100644 => 100755 test/test.all mode change 100644 => 100755 test/test.block mode change 100644 => 100755 test/test.tty mode change 100644 => 100755 test/testd.block create mode 100644 udevrulescompile.c diff --git a/Makefile b/Makefile index 8694b917a2..32e057b1cb 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,7 @@ V=false ROOT = udev DAEMON = udevd SENDER = udevsend +COMPILE = udevrulescompile INITSENDER = udevinitsend RECORDER = udeveventrecorder CONTROL = udevcontrol @@ -202,7 +203,8 @@ endif # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf -all: $(ROOT) $(SENDER) $(INITSENDER) $(RECORDER) $(CONTROL) $(DAEMON) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) +all: $(ROOT) $(SENDER) $(COMPILE) $(INITSENDER) $(RECORDER) $(CONTROL) \ + $(DAEMON) $(COMPILE) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ $(MAKE) prefix=$(prefix) \ @@ -268,6 +270,7 @@ $(TESTER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(INFO).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(DAEMON).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(SENDER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(COMPILE).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(INITSENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(RECORDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(CONTROL).o: $(HEADERS) $( $(HEADERS)GEN_HEADERS) $(HOST_PROGS) $(KLCC) @@ -293,6 +296,10 @@ $(SENDER): $(KLCC) $(SENDER).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(SENDER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ +$(COMPILE): $(KLCC) $(COMPILE).o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(COMPILE).o $(OBJS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ + $(INITSENDER): $(KLCC) $(INITSENDER).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(INITSENDER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ @@ -316,7 +323,7 @@ clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) \ - $(SENDER) $(INITSENDER) $(RECORDER) $(CONTROL) $(TESTER) $(STARTER) + $(SENDER) $(COMPILE) $(INITSENDER) $(RECORDER) $(CONTROL) $(TESTER) $(STARTER) -rm -f ccdv $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ diff --git a/test/devd_test b/test/devd_test old mode 100644 new mode 100755 diff --git a/test/net_test b/test/net_test old mode 100644 new mode 100755 diff --git a/test/replace_test b/test/replace_test old mode 100644 new mode 100755 diff --git a/test/show_all_devices.sh b/test/show_all_devices.sh old mode 100644 new mode 100755 diff --git a/test/test.all b/test/test.all old mode 100644 new mode 100755 diff --git a/test/test.block b/test/test.block old mode 100644 new mode 100755 diff --git a/test/test.tty b/test/test.tty old mode 100644 new mode 100755 diff --git a/test/testd.block b/test/testd.block old mode 100644 new mode 100755 diff --git a/udev_rules.c b/udev_rules.c index 52e0712d35..c416128b62 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -846,7 +846,12 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d dbg("udev->kernel_name='%s'", udev->kernel_name); /* look for a matching rule to apply */ - list_for_each_entry(rule, &udev_rule_list, node) { + udev_rules_iter_init(); + while (1) { + rule = udev_rules_iter_next(); + if (rule == NULL) + break; + if (udev->name_set && rule->name_operation != KEY_OP_UNSET) { dbg("node name already set, rule ignored"); continue; @@ -1000,9 +1005,13 @@ int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device) struct udev_rule *rule; /* look for a matching rule to apply */ - list_for_each_entry(rule, &udev_rule_list, node) { - dbg("process rule"); + udev_rules_iter_init(); + while (1) { + rule = udev_rules_iter_next(); + if (rule == NULL) + break; + dbg("process rule"); if (rule->run_operation == KEY_OP_UNSET) continue; diff --git a/udev_rules.h b/udev_rules.h index 2bf8107543..cb62839802 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -123,11 +123,13 @@ struct udev_rule { int config_line; }; -extern struct list_head udev_rule_list; - extern int udev_rules_init(void); +extern void udev_rules_close(void); + +extern int udev_rules_iter_init(void); +extern struct udev_rule *udev_rules_iter_next(void); + extern int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_dev); extern int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device); -extern void udev_rules_close(void); #endif diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 89925a35e4..36bf97177d 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -37,9 +37,45 @@ #include "logging.h" #include "udev_rules.h" -LIST_HEAD(udev_rule_list); +/* rules parsed from .rules files*/ +static LIST_HEAD(rules_list); +static struct list_head *rules_list_current; -static int add_config_dev(struct udev_rule *rule) +/* mapped compiled rules stored on disk */ +static struct udev_rule *rules_array = NULL; +static size_t rules_array_current; +static size_t rules_array_size = 0; + +static size_t rules_count = 0; + +int udev_rules_iter_init(void) +{ + rules_list_current = rules_list.next; + rules_array_current = 0; + + return 0; +} + +struct udev_rule *udev_rules_iter_next(void) +{ + static struct udev_rule *rule; + + if (rules_array) { + if (rules_array_current >= rules_count) + return NULL; + rule = &rules_array[rules_array_current]; + rules_array_current++; + } else { + dbg("head=%p current=%p next=%p", &rules_list, rules_list_current, rules_list_current->next); + if (rules_list_current == &rules_list) + return NULL; + rule = list_entry(rules_list_current, struct udev_rule, node); + rules_list_current = rules_list_current->next; + } + return rule; +} + +static int add_rule_to_list(struct udev_rule *rule) { struct udev_rule *tmp_rule; @@ -47,7 +83,7 @@ static int add_config_dev(struct udev_rule *rule) if (tmp_rule == NULL) return -ENOMEM; memcpy(tmp_rule, rule, sizeof(struct udev_rule)); - list_add_tail(&tmp_rule->node, &udev_rule_list); + list_add_tail(&tmp_rule->node, &rules_list); dbg("name='%s', symlink='%s', bus='%s', id='%s', " "sysfs_file[0]='%s', sysfs_value[0]='%s', " @@ -451,9 +487,9 @@ static int rules_parse(const char *filename) rule.config_line = lineno; strlcpy(rule.config_file, filename, sizeof(rule.config_file)); - retval = add_config_dev(&rule); + retval = add_rule_to_list(&rule); if (retval) { - dbg("add_config_dev returned with error %d", retval); + dbg("add_rule_to_list returned with error %d", retval); continue; error: err("parse error %s, line %d:%d, rule skipped", @@ -465,20 +501,47 @@ error: return retval; } +static int rules_map(const char *filename) +{ + char *buf; + size_t size; + + if (file_map(filename, &buf, &size)) + return -1; + if (size == 0) + return -1; + rules_array = (struct udev_rule *) buf; + rules_array_size = size; + rules_count = size / sizeof(struct udev_rule); + dbg("found %zi compiled rules", rules_count); + + return 0; +} + int udev_rules_init(void) { + char comp[PATH_SIZE]; struct stat stats; int retval; + strlcpy(comp, udev_rules_filename, sizeof(comp)); + strlcat(comp, ".compiled", sizeof(comp)); + if (stat(comp, &stats) == 0) { + dbg("parse compiled rules '%s'", comp); + return rules_map(comp); + } + if (stat(udev_rules_filename, &stats) != 0) return -1; - if ((stats.st_mode & S_IFMT) != S_IFDIR) + if ((stats.st_mode & S_IFMT) != S_IFDIR) { + dbg("parse single rules file '%s'", udev_rules_filename); retval = rules_parse(udev_rules_filename); - else { + } else { struct name_entry *name_loop, *name_tmp; LIST_HEAD(name_list); + dbg("parse rules directory '%s'", udev_rules_filename); retval = add_matching_files(&name_list, udev_rules_filename, RULEFILE_SUFFIX); list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { @@ -495,9 +558,11 @@ void udev_rules_close(void) struct udev_rule *rule; struct udev_rule *temp_rule; - list_for_each_entry_safe(rule, temp_rule, &udev_rule_list, node) { - list_del(&rule->node); - free(rule); - } + if (rules_array) + file_unmap(rules_array, rules_array_size); + else + list_for_each_entry_safe(rule, temp_rule, &rules_list, node) { + list_del(&rule->node); + free(rule); + } } - diff --git a/udev_utils.c b/udev_utils.c index 64a7ba9caa..c35b287881 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -247,7 +247,7 @@ int file_map(const char *filename, char **buf, size_t *bufsize) return 0; } -void file_unmap(char *buf, size_t bufsize) +void file_unmap(void *buf, size_t bufsize) { munmap(buf, bufsize); } diff --git a/udev_utils.h b/udev_utils.h index b3e604fb98..3e372dd948 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -39,7 +39,7 @@ extern int string_is_true(const char *str); extern int parse_get_pair(char **orig_string, char **left, char **right); extern int unlink_secure(const char *filename); extern int file_map(const char *filename, char **buf, size_t *bufsize); -extern void file_unmap(char *buf, size_t bufsize); +extern void file_unmap(void *buf, size_t bufsize); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); extern void remove_trailing_char(char *path, char c); extern void replace_untrusted_chars(char *string); diff --git a/udevrulescompile.c b/udevrulescompile.c new file mode 100644 index 0000000000..ff9dd79fd4 --- /dev/null +++ b/udevrulescompile.c @@ -0,0 +1,127 @@ +/* + * udevrulescompile.c - store already parsed config on disk + * + * Copyright (C) 2005 Kay Sievers + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "udev_libc_wrapper.h" +#include "udev_sysfs.h" +#include "udev.h" +#include "udev_version.h" +#include "logging.h" +#include "udev_rules.h" +#include "udev_utils.h" +#include "list.h" + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + + if (priority > udev_log_priority) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +int main(int argc, char *argv[], char *envp[]) +{ + struct udev_rule *rule; + FILE *f; + char comp[PATH_SIZE]; + char comp_tmp[PATH_SIZE]; + int retval = 0; + + logging_init("udevrulescompile"); + udev_init_config(); + dbg("version %s", UDEV_VERSION); + + strlcpy(comp, udev_rules_filename, sizeof(comp)); + strlcat(comp, ".compiled", sizeof(comp)); + strlcpy(comp_tmp, comp, sizeof(comp_tmp)); + strlcat(comp_tmp, ".tmp", sizeof(comp_tmp)); + + /* remove old version, otherwise we would read it + * instead of the real rules */ + unlink(comp); + unlink(comp_tmp); + + udev_rules_init(); + + f = fopen(comp_tmp, "w"); + if (f == NULL) { + err("unable to create db file '%s'", comp_tmp); + unlink(comp_tmp); + retval = 1; + goto exit; + } + dbg("storing compiled rules in '%s'", comp_tmp); + + udev_rules_iter_init(); + while (1) { + char *endptr; + unsigned long id; + + rule = udev_rules_iter_next(); + if (rule == NULL) + break; + + id = strtoul(rule->owner, &endptr, 10); + if (endptr[0] != '\0') { + uid_t uid; + + uid = lookup_user(rule->owner); + dbg("replacing username='%s' by id=%i", rule->owner, uid); + sprintf(rule->owner, "%li", uid); + } + + id = strtoul(rule->group, &endptr, 10); + if (endptr[0] != '\0') { + gid_t gid; + + gid = lookup_group(rule->group); + dbg("replacing groupname='%s' by id=%i", rule->group, gid); + sprintf(rule->group, "%li", gid); + } + + dbg("kernel='%s' name='%s'", rule->kernel, rule->name); + fwrite(rule, sizeof(struct udev_rule), 1, f); + } + + fclose(f); + dbg("activating compiled rules in '%s'", comp); + if (rename(comp_tmp, comp) != 0) { + err("unable to write file"); + unlink(comp); + unlink(comp_tmp); + retval = 2; + } + +exit: + logging_close(); + return retval; +} -- cgit v1.2.3-54-g00ecf From bd0ed2ffbec325512c3131ce0db896234e36c923 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 25 Jun 2005 13:10:16 +0200 Subject: IMPORT= allow to import a shell-var style config-file This allows to source-in a file into the udev environment to have the defined keys available for later processing by udev itself or the forked helper programs. Signed-off-by: Kay Sievers --- test/udev-test.pl | 19 +++++++ udev_rules.c | 155 ++++++++++++++++++++++++++++++++++++++++++++++++++++- udev_rules.h | 3 ++ udev_rules_parse.c | 7 +++ 4 files changed, 182 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 9225352130..c7a99e517d 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -256,6 +256,16 @@ EOF exp_name => "M8-m3-n3-b0:0-sIBM" , rules => < "import of shellvalue file", + subsys => "block", + devpath => "/block/sda", + exp_name => "subdir/sys/node" , + rules => < "env substitution", + subsys => "block", + devpath => "/block/sda", + exp_name => "node-add-me", + rules => <= sizeof(line)) { + err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); + continue; + } + + /* eat the whitespace */ + while ((count > 0) && isspace(bufline[0])) { + bufline++; + count--; + } + if (count == 0) + continue; + + /* see if this is a comment */ + if (bufline[0] == COMMENT_CHARACTER) + continue; + + strlcpy(line, bufline, count+1); + + linepos = line; + if (get_key(&linepos, &variable, &value) == 0) { + dbg("import %s=%s", variable, value); + setenv(variable, value, 0); + } + } + + file_unmap(buf, bufsize); + return retval; +} + /** Finds the lowest positive N such that N isn't present in * $(udevroot) either as a file or a symlink. * @@ -198,7 +321,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, { char temp[PATH_SIZE]; char temp2[PATH_SIZE]; - char *head, *tail, *cpos, *attr, *rest; + char *head, *tail, *pos, *cpos, *attr, *rest; int len; int i; unsigned int next_free_number; @@ -218,6 +341,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, SUBST_TEMP_NODE, SUBST_ROOT, SUBST_MODALIAS, + SUBST_ENV, }; static const struct subst_map { char *name; @@ -237,6 +361,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, { .name = "modalias", .fmt = 'A', .type = SUBST_MODALIAS }, + { .name = "env", .fmt = 'E', .type = SUBST_ENV }, {} }; enum subst_type type; @@ -431,6 +556,17 @@ found: strlcat(string, temp2, maxsize); dbg("substitute MODALIAS '%s'", temp2); break; + case SUBST_ENV: + if (attr == NULL) { + dbg("missing attribute"); + break; + } + pos = getenv(attr); + if (pos == NULL) + break; + strlcat(string, pos, maxsize); + dbg("substitute env '%s=%s'", attr, pos); + break; default: err("unknown substitution type=%i", type); break; @@ -773,13 +909,28 @@ try_parent: dbg("look at sysfs_device->bus_id='%s'", parent_device->bus_id); } + if (rule->import_operation != KEY_OP_UNSET) { + char import[PATH_SIZE]; + + strlcpy(import, rule->import, sizeof(import)); + apply_format(udev, import, sizeof(import), class_dev, sysfs_device); + dbg("check for " KEY_IMPORT " import='%s", import); + if (import_file_into_env(import) == 0) { + dbg(KEY_IMPORT " file '%s' imported", rule->import); + if (rule->import_operation == KEY_OP_NOMATCH) + goto exit; + } else + goto exit; + dbg(KEY_IMPORT " key is true"); + } + /* execute external program */ if (rule->program_operation != KEY_OP_UNSET) { char program[PATH_SIZE]; - dbg("check " KEY_PROGRAM); strlcpy(program, rule->program, sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); + dbg("check for " KEY_PROGRAM " program='%s", program); if (execute_program_pipe(program, udev->subsystem, udev->program_result, sizeof(udev->program_result)) != 0) { dbg(KEY_PROGRAM " returned nonzero"); diff --git a/udev_rules.h b/udev_rules.h index cb62839802..f4b0a6f12f 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -40,6 +40,7 @@ #define KEY_SYSFS "SYSFS" #define KEY_ENV "ENV" #define KEY_MODALIAS "MODALIAS" +#define KEY_IMPORT "IMPORT" #define KEY_NAME "NAME" #define KEY_SYMLINK "SYMLINK" #define KEY_OWNER "OWNER" @@ -100,6 +101,8 @@ struct udev_rule { int env_pair_count; enum key_operation modalias_operation; char modalias[PATH_SIZE]; + enum key_operation import_operation; + char import[PATH_SIZE]; char name[PATH_SIZE]; enum key_operation name_operation; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 36bf97177d..121236820b 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -375,6 +375,13 @@ static int rules_parse(const char *filename) continue; } + if (strcasecmp(key, KEY_IMPORT) == 0) { + strlcpy(rule.import, value, sizeof(rule.import)); + rule.import_operation = operation; + valid = 1; + continue; + } + if (strcasecmp(key, KEY_DRIVER) == 0) { strlcpy(rule.driver, value, sizeof(rule.driver)); rule.driver_operation = operation; -- cgit v1.2.3-54-g00ecf From be4bedd16b934c8663f8c231f07f23091cde8261 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 25 Jun 2005 15:35:14 +0200 Subject: unify execute_command() and execute_program() Signed-off-by: Kay Sievers --- udev.c | 2 +- udev_rules.c | 155 ++++++++++++----------------------------------------------- udev_utils.c | 72 ++++++++++++++++++++++----- udev_utils.h | 3 +- udevstart.c | 2 +- 5 files changed, 93 insertions(+), 141 deletions(-) diff --git a/udev.c b/udev.c index 36ff21d5b7..1c55ec14b8 100644 --- a/udev.c +++ b/udev.c @@ -214,7 +214,7 @@ run: dbg("executing run list"); list_for_each_entry(name_loop, &udev.run_list, node) - execute_command(name_loop->name, udev.subsystem); + execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); } cleanup: diff --git a/udev_rules.c b/udev_rules.c index 6ed67c2672..aa66c7ad30 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -200,24 +200,16 @@ static int get_key(char **line, char **key, char **value) return 0; } -static int import_file_into_env(const char *filename) +static int import_keys_into_env(const char *buf, size_t bufsize) { char line[LINE_SIZE]; - char *bufline; + const char *bufline; char *linepos; char *variable; char *value; - char *buf; - size_t bufsize; size_t cur; size_t count; int lineno; - int retval = 0; - - if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s'", filename); - return -1; - } /* loop through the whole file */ lineno = 0; @@ -254,8 +246,22 @@ static int import_file_into_env(const char *filename) } } + return 0; +} + +static int import_file_into_env(const char *filename) +{ + char *buf; + size_t bufsize; + + if (file_map(filename, &buf, &bufsize) != 0) { + err("can't open '%s'", filename); + return -1; + } + import_keys_into_env(buf, bufsize); file_unmap(buf, bufsize); - return retval; + + return 0; } /** Finds the lowest positive N such that N isn't present in @@ -576,117 +582,10 @@ found: head[len] = '\0'; dbg("truncate to %i chars, subtitution string becomes '%s'", len, head); } - strlcat(string, temp, maxsize); } } -static int execute_program_pipe(const char *command, const char *subsystem, char *value, int len) -{ - int retval; - int count; - int status; - int pipefds[2]; - pid_t pid; - char *pos; - char arg[PATH_SIZE]; - char *argv[(sizeof(arg) / 2) + 1]; - int devnull; - int i; - - strlcpy(arg, command, sizeof(arg)); - i = 0; - if (strchr(arg, ' ')) { - pos = arg; - while (pos != NULL) { - if (pos[0] == '\'') { - /* don't separate if in apostrophes */ - pos++; - argv[i] = strsep(&pos, "\'"); - while (pos && pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - } - dbg("arg[%i] '%s'", i, argv[i]); - i++; - } - argv[i] = NULL; - dbg("execute '%s' with parsed arguments", arg); - } else { - argv[0] = arg; - argv[1] = (char *) subsystem; - argv[2] = NULL; - dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); - } - - retval = pipe(pipefds); - if (retval != 0) { - err("pipe failed"); - return -1; - } - - pid = fork(); - switch(pid) { - case 0: - /* child dup2 write side of pipe to STDOUT */ - devnull = open("/dev/null", O_RDWR); - if (devnull >= 0) { - dup2(devnull, STDIN_FILENO); - dup2(devnull, STDERR_FILENO); - close(devnull); - } - dup2(pipefds[1], STDOUT_FILENO); - retval = execv(arg, argv); - err("exec of program failed"); - _exit(1); - case -1: - err("fork of '%s' failed", arg); - retval = -1; - break; - default: - /* parent reads from pipefds[0] */ - close(pipefds[1]); - retval = 0; - i = 0; - while (1) { - count = read(pipefds[0], value + i, len - i-1); - if (count < 0) { - err("read failed with '%s'", strerror(errno)); - retval = -1; - } - - if (count == 0) - break; - - i += count; - if (i >= len-1) { - err("result len %d too short", len); - retval = -1; - break; - } - } - value[i] = '\0'; - - close(pipefds[0]); - waitpid(pid, &status, 0); - - if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { - dbg("exec program status 0x%x", status); - retval = -1; - } - } - - if (!retval) { - remove_trailing_char(value, '\n'); - dbg("result is '%s'", value); - replace_untrusted_chars(value); - } else - value[0] = '\0'; - - return retval; -} - static int match_rule(struct udevice *udev, struct udev_rule *rule, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { @@ -909,34 +808,40 @@ try_parent: dbg("look at sysfs_device->bus_id='%s'", parent_device->bus_id); } + /* import variables from file into environment */ if (rule->import_operation != KEY_OP_UNSET) { char import[PATH_SIZE]; strlcpy(import, rule->import, sizeof(import)); apply_format(udev, import, sizeof(import), class_dev, sysfs_device); dbg("check for " KEY_IMPORT " import='%s", import); - if (import_file_into_env(import) == 0) { - dbg(KEY_IMPORT " file '%s' imported", rule->import); - if (rule->import_operation == KEY_OP_NOMATCH) + if (import_file_into_env(import) != 0) { + dbg(KEY_IMPORT " failed"); + if (rule->import_operation != KEY_OP_NOMATCH) goto exit; } else - goto exit; + dbg(KEY_IMPORT " file '%s' imported", rule->import); dbg(KEY_IMPORT " key is true"); } /* execute external program */ if (rule->program_operation != KEY_OP_UNSET) { char program[PATH_SIZE]; + char result[PATH_SIZE]; strlcpy(program, rule->program, sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); dbg("check for " KEY_PROGRAM " program='%s", program); - if (execute_program_pipe(program, udev->subsystem, - udev->program_result, sizeof(udev->program_result)) != 0) { - dbg(KEY_PROGRAM " returned nonzero"); + if (execute_program(program, udev->subsystem, result, sizeof(result), NULL) != 0) { + dbg(KEY_PROGRAM " is not matching"); if (rule->program_operation != KEY_OP_NOMATCH) goto exit; } else { + dbg(KEY_PROGRAM " matches"); + remove_trailing_char(result, '\n'); + replace_untrusted_chars(result); + dbg("result is '%s'", result); + strlcpy(udev->program_result, result, sizeof(udev->program_result)); dbg(KEY_PROGRAM " returned successful"); if (rule->program_operation == KEY_OP_NOMATCH) goto exit; diff --git a/udev_utils.c b/udev_utils.c index c35b287881..9e2e152763 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -361,15 +361,20 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c return 0; } -int execute_command(const char *command, const char *subsystem) +int execute_program(const char *command, const char *subsystem, + char *result, size_t ressize, size_t *reslen) { - int retval; + int retval = 0; + int count; + int status; + int pipefds[2]; pid_t pid; - char arg[PATH_SIZE]; - char *argv[(PATH_SIZE / 2) + 1]; char *pos; + char arg[PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; int devnull; int i; + size_t len; strlcpy(arg, command, sizeof(arg)); i = 0; @@ -397,27 +402,68 @@ int execute_command(const char *command, const char *subsystem) dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); } + if (result) { + if (pipe(pipefds) != 0) { + err("pipe failed"); + return -1; + } + } + pid = fork(); - switch (pid) { + switch(pid) { case 0: - /* child */ + /* child dup2 write side of pipe to STDOUT */ devnull = open("/dev/null", O_RDWR); if (devnull >= 0) { dup2(devnull, STDIN_FILENO); - dup2(devnull, STDOUT_FILENO); + if (!result) + dup2(devnull, STDOUT_FILENO); dup2(devnull, STDERR_FILENO); close(devnull); } - retval = execv(arg, argv); - err("exec of child '%s' failed", command); + if (result) + dup2(pipefds[1], STDOUT_FILENO); + execv(arg, argv); + err("exec of program failed"); _exit(1); case -1: - dbg("fork of child '%s' failed", command); - break; + err("fork of '%s' failed", arg); return -1; default: - waitpid(pid, NULL, 0); + /* parent reads from pipefds[0] */ + if (result) { + close(pipefds[1]); + len = 0; + while (1) { + count = read(pipefds[0], result + len, ressize - len-1); + if (count < 0) { + err("read failed with '%s'", strerror(errno)); + retval = -1; + break; + } + + if (count == 0) + break; + + len += count; + if (len >= ressize-1) { + err("ressize %d too short", ressize); + retval = -1; + break; + } + } + result[len] = '\0'; + close(pipefds[0]); + if (reslen) + *reslen = len; + } + waitpid(pid, &status, 0); + + if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { + dbg("exec program status 0x%x", status); + retval = -1; + } } - return 0; + return retval; } diff --git a/udev_utils.h b/udev_utils.h index 3e372dd948..999a4fcf55 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -45,6 +45,7 @@ extern void remove_trailing_char(char *path, char c); extern void replace_untrusted_chars(char *string); extern int name_list_add(struct list_head *name_list, const char *name, int sort); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); -extern int execute_command(const char *command, const char *subsystem); +extern int execute_program(const char *command, const char *subsystem, + char *result, size_t ressize, size_t *reslen); #endif diff --git a/udevstart.c b/udevstart.c index bd91e96f6a..b65a28aab6 100644 --- a/udevstart.c +++ b/udevstart.c @@ -146,7 +146,7 @@ run: dbg("executing run list"); list_for_each_entry(name_loop, &udev.run_list, node) - execute_command(name_loop->name, udev.subsystem); + execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); } exit: sysfs_close_class_device(class_dev); -- cgit v1.2.3-54-g00ecf From 319c6700165dc38d7f813ff646bff0196f2aafe6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 25 Jun 2005 18:58:49 +0200 Subject: IMPORT allow to import program returned keys into the env Signed-off-by: Kay Sievers --- test/udev-test.pl | 12 +++++++++++- udev_rules.c | 35 +++++++++++++++++++++++++---------- udev_rules.h | 5 +++-- udev_rules_parse.c | 8 ++++++-- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index c7a99e517d..bf6b62f10a 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -259,13 +259,23 @@ BUS=="scsi", ID=="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}" EOF }, { - desc => "import of shellvalue file", + desc => "import of shell-value file", subsys => "block", devpath => "/block/sda", exp_name => "subdir/sys/node" , rules => < "import of shell-value returned from program", + subsys => "block", + devpath => "/block/sda", + exp_name => "node12345678", + rules => <N isn't present in - * $(udevroot) either as a file or a symlink. - * - * @param name Name to check for - * @return 0 if didn't exist and N otherwise. +static int import_program_into_env(struct udevice *udev, const char *program) +{ + char result[1024]; + size_t reslen; + + if (execute_program(program, udev->subsystem, result, sizeof(result), &reslen) != 0) + return -1; + return import_keys_into_env(result, reslen); +} + +/* finds the lowest positive N such that N isn't present in the udevdb + * if doesn't exist, 0 is returned, N otherwise */ static int find_free_number(struct udevice *udev, const char *name) { @@ -811,16 +818,24 @@ try_parent: /* import variables from file into environment */ if (rule->import_operation != KEY_OP_UNSET) { char import[PATH_SIZE]; + int rc = -1; strlcpy(import, rule->import, sizeof(import)); apply_format(udev, import, sizeof(import), class_dev, sysfs_device); - dbg("check for " KEY_IMPORT " import='%s", import); - if (import_file_into_env(import) != 0) { + dbg("check for " KEY_IMPORT " import='%s'", import); + if (rule->import_exec) { + dbg("run executable file import='%s'", import); + rc = import_program_into_env(udev, import); + } else { + dbg("import file import='%s'", import); + rc = import_file_into_env(import); + } + if (rc) { dbg(KEY_IMPORT " failed"); if (rule->import_operation != KEY_OP_NOMATCH) goto exit; } else - dbg(KEY_IMPORT " file '%s' imported", rule->import); + dbg(KEY_IMPORT " '%s' imported", rule->import); dbg(KEY_IMPORT " key is true"); } diff --git a/udev_rules.h b/udev_rules.h index f4b0a6f12f..bad8406cf4 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -99,10 +99,11 @@ struct udev_rule { int sysfs_pair_count; struct key_pair env_pair[KEY_ENV_PAIRS_MAX]; int env_pair_count; + char modalias[NAME_SIZE]; enum key_operation modalias_operation; - char modalias[PATH_SIZE]; - enum key_operation import_operation; char import[PATH_SIZE]; + enum key_operation import_operation; + int import_exec; char name[PATH_SIZE]; enum key_operation name_operation; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 121236820b..4979feddc1 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -375,7 +375,12 @@ static int rules_parse(const char *filename) continue; } - if (strcasecmp(key, KEY_IMPORT) == 0) { + if (strncasecmp(key, KEY_IMPORT, sizeof(KEY_IMPORT)-1) == 0) { + attr = get_key_attribute(key + sizeof(KEY_IMPORT)-1); + if (attr && strstr(attr, "exec")) { + dbg(KEY_IMPORT" will be executed"); + rule.import_exec = 1; + } strlcpy(rule.import, value, sizeof(rule.import)); rule.import_operation = operation; valid = 1; @@ -411,7 +416,6 @@ static int rules_parse(const char *filename) dbg("creation of partition nodes requested"); rule.partitions = DEFAULT_PARTITIONS_COUNT; } - /* FIXME: remove old style option and make OPTIONS= mandatory */ if (strstr(attr, OPTION_IGNORE_REMOVE) != NULL) { dbg("remove event should be ignored"); rule.ignore_remove = 1; -- cgit v1.2.3-54-g00ecf From 670e470543e02937979e1c879d97f474d5b6fbd1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 25 Jun 2005 23:54:28 +0200 Subject: add ata_id to read serial numbers from ATA drives Signed-off-by: Kay Sievers --- extras/ata_id/Makefile | 52 ++++++++++++++++ extras/ata_id/ata_id.c | 150 +++++++++++++++++++++++++++++++++++++++++++++ test/simple-build-check.sh | 2 +- 3 files changed, 203 insertions(+), 1 deletion(-) create mode 100644 extras/ata_id/Makefile create mode 100644 extras/ata_id/ata_id.c diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile new file mode 100644 index 0000000000..ad79a0d836 --- /dev/null +++ b/extras/ata_id/Makefile @@ -0,0 +1,52 @@ +# Makefile for udev_volume_id +# +# Copyright (C) 2004 Kay Sievers +# +# 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. +# + +PROG = ata_id + +all: $(PROG) + +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin +mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +override CFLAGS+=-D_FILE_OFFSET_BITS=64 + +OBJS = ata_id.o ../../udev.a + +$(OBJS): $(HEADERS) + +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + +$(PROG): $(OBJS) $(HEADERS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + +install: all + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + +uninstall: + - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c new file mode 100644 index 0000000000..e26cb6bd2d --- /dev/null +++ b/extras/ata_id/ata_id.c @@ -0,0 +1,150 @@ +/* + * ata_id - reads product/serial number from ATA drives + * + * Copyright (C) 2005 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../logging.h" +#include "../../udev_utils.h" + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +static void set_str(char *to, const unsigned char *from, int count) +{ + int i, j; + int len; + + len = strnlen(from, count); + while (isspace(from[len-1])) + len--; + + i = 0; + while (isspace(from[i]) && (i < len)) + i++; + + j = 0; + while (i < len) { + switch(from[i]) { + case '/': + case ' ': + to[j++] = '_'; + default: + to[j++] = from[i]; + } + i++; + } + to[j] = '\0'; +} + +int main(int argc, char *argv[]) +{ + struct hd_driveid id; + char model[41]; + char serial[21]; + char revision[9]; + const char *node = NULL; + int i; + int export = 0; + int fd; + int rc = 0; + + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--export") == 0) { + export = 1; + } else + node = arg; + } + if (!node) { + err("no node specified"); + rc = 1; + goto exit; + } + + fd = open(node, O_RDONLY); + if (fd < 0) + if (errno == ENOMEDIUM) + fd = open(node, O_RDONLY|O_NONBLOCK); + if (fd < 0) { + err("unable to open '%s'", node); + rc = 1; + goto exit; + } + + if (ioctl(fd, HDIO_GET_IDENTITY, &id)) { + err("HDIO_GET_IDENTITY failed for '%s'", node); + rc = 3; + goto close; + } + + set_str(model, id.model, 40); + set_str(serial, id.serial_no, 20); + set_str(revision, id.fw_rev, 8); + + if (export) { + printf("ID_MODEL=%s\n", model); + printf("ID_SERIAL=%s\n", serial); + printf("ID_REVISION=%s\n", revision); + } else + printf("%s_%s\n", model, serial); + +close: + close(fd); +exit: + logging_close(); + return rc; +} diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index b653185b26..b5a0dcdaa1 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -1,6 +1,6 @@ #/bin/sh -EXTRAS="extras/chassis_id extras/scsi_id extras/volume_id extras/run_directory" +EXTRAS="extras/chassis_id extras/scsi_id extras/ata_id extras/volume_id extras/run_directory" [ -z "$KERNEL_DIR" ] && KERNEL_DIR=/lib/modules/`uname -r`/build echo KERNEL_DIR: "$KERNEL_DIR" -- cgit v1.2.3-54-g00ecf From 208f6aba21199ff4f93002eeb948d564f76843e6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Jun 2005 01:54:47 +0200 Subject: rename udev_volume_id to vol_id and add --export option Signed-off-by: Kay Sievers --- extras/ata_id/ata_id.c | 1 + extras/volume_id/Makefile | 8 +- extras/volume_id/README | 68 +++++++++---- extras/volume_id/s390-dasd.rules | 7 -- extras/volume_id/udev_volume_id.c | 198 -------------------------------------- extras/volume_id/vol_id.c | 198 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 252 insertions(+), 228 deletions(-) delete mode 100644 extras/volume_id/s390-dasd.rules delete mode 100644 extras/volume_id/udev_volume_id.c create mode 100644 extras/volume_id/vol_id.c diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index e26cb6bd2d..59e2b3987b 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -81,6 +81,7 @@ static void set_str(char *to, const unsigned char *from, int count) case '/': case ' ': to[j++] = '_'; + break; default: to[j++] = from[i]; } diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 56fdf278b9..eca9cfdbd4 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -1,13 +1,13 @@ -# Makefile for udev_volume_id +# Makefile for volume_id # -# Copyright (C) 2004 Kay Sievers +# Copyright (C) 2004, 2005 Kay Sievers # # 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. # -PROG = udev_volume_id +PROG = vol_id all: $(PROG) @@ -33,7 +33,7 @@ override CFLAGS+=-D_FILE_OFFSET_BITS=64 VOLUME_ID_BASE=volume_id include $(VOLUME_ID_BASE)/Makefile.inc -OBJS = udev_volume_id.o $(VOLUME_ID_OBJS) ../../udev.a +OBJS = vol_id.o $(VOLUME_ID_OBJS) ../../udev.a HEADERS = $(VOLUME_ID_HEADERS) $(OBJS): $(HEADERS) diff --git a/extras/volume_id/README b/extras/volume_id/README index d570615e10..a7635ff612 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -1,43 +1,73 @@ - -udev_volume_id - partition, filesystem, disklabel reader +vol_id - partition, filesystem, disklabel reader This program is normally called from a udev rule, to provide udev with the name, uuid or the filesystem type of a partition to name a device node. -udev_volume_id opens the blockdevice node specified at the commandline. -The following commandline switches are supported to specify what udev_volume_id -should print to stdout: +vol_id opens the blockdevice node specified at the commandline. +The following commandline switches are supported to specify what vol_id +should print: - no option prints all values - -h prints help text - -l prints the label of the partition - -u prints the uuid of the partition + --export prints all values + -h prints help text + -l prints the label of the partition + -u prints the uuid of the partition -udev_volume_id will only return successful if the string asked for, is not +vol_id will only return successful if the string asked for, is not empty. All trailing whitespace will be removed, spaces replaced by underscore and slashes ignored. +fstype probe label uuid fsversion +---------------------------------------------------- +ext * * * * +reiserfs jr/3.5/3.6/4 * * * * +fat (12, 16, 32) * * * * +ntfs * * * * +jfs * * * - +xfs * * * - +hfs (plus, wrapped) * * * - +udf * * - - +iso9660 * * n/a - +ufs * - - - +linux swap * * * * +LVM 1 * - - - +LVM 2 * - - * +linux raid * - * * +cramfs * * - - +sysv * * - * +luks * - * - +hpfs * - - - +romfs * +minix * +dasd * +highpoint * +isw_raid * +lsi_raid * +nvidia_raid * +promise_raid * +silicon_raid * +via_raid * +mac partitons * +msdos partitions * + + The following rule will create a symlink named with the label string: - KERNEL="[hs]d*", PROGRAM="/sbin/udev_volume_id -l %N", SYMLINK="%c" + KERNEL=="[hs]d*", PROGRAM=="/sbin/vol_id -l %N", SYMLINK+="%c" -If no label is found udev_volume_id exits with nonzero and the rule will be +If no label is found vol_id exits with nonzero and the rule will be ignored. To give it a try, you may call it on the commandline: - - [root@pim udev.kay]# extras/volume_id/udev_volume_id /dev/hda3 + [root@pim udev.kay]# extras/volume_id/vol_id /dev/hda3 T:ext3 L:Music Store N:Music_Store U:d2da42b5-bbd9-44eb-a72c-cc4542fcb71e - [root@pim udev.kay]# extras/volume_id/udev_volume_id -l /dev/hda3 + [root@pim udev.kay]# extras/volume_id/vol_id -l /dev/hda3 Music_Store - [root@pim udev.kay]# extras/volume_id/udev_volume_id -t /dev/hda3 + [root@pim udev.kay]# extras/volume_id/vol_id -t /dev/hda3 swap -Please send any comment/questions/concerns to me or: - linux-hotplug-devel@lists.sourceforge.net - +Any comment/questions/concerns to me: Kay Sievers diff --git a/extras/volume_id/s390-dasd.rules b/extras/volume_id/s390-dasd.rules deleted file mode 100644 index a870d87e04..0000000000 --- a/extras/volume_id/s390-dasd.rules +++ /dev/null @@ -1,7 +0,0 @@ -# s390 block devices named by disk label -KERNEL="dasd*[a-z]", PROGRAM="/sbin/udev_volume_id -d -l" RESULT="[0-9A-Z]*", SYMLINK="dasd/%c/disc dasd/%b/disc" -KERNEL="dasd*[0-9]", PROGRAM="/sbin/udev_volume_id -d -l" RESULT="[0-9A-Z]*", SYMLINK="dasd/%c/part%n dasd/%b/part%n" -KERNEL="dasd*[a-z]", SYMLINK="dasd/%b/disc" -KERNEL="dasd*[0-9]", SYMLINK="dasd/%b/part%n" -KERNEL="dcssblk*", NAME="%k", SYMLINK="dcssblk/%b" - diff --git a/extras/volume_id/udev_volume_id.c b/extras/volume_id/udev_volume_id.c deleted file mode 100644 index 7c6fc4050d..0000000000 --- a/extras/volume_id/udev_volume_id.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * udev_volume_id - udev callout to read filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * sample udev rule for creation of a symlink with the filsystem uuid: - * KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -u %N", SYMLINK="%c" - * - * 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 02139, USA. - * - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "../../udev_utils.h" -#include "../../logging.h" -#include "volume_id/volume_id.h" -#include "volume_id/dasd.h" - -#define BLKGETSIZE64 _IOR(0x12,114,size_t) - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -extern int optind; - -int main(int argc, char *argv[]) -{ - const char help[] = "usage: udev_volume_id [-t|-l|-u] \n" - " -t filesystem type\n" - " -l filesystem label\n" - " -u filesystem uuid\n" - "\n"; - static const char short_options[] = "htlu"; - struct volume_id *vid = NULL; - const char *device; - char print = 'a'; - static char name[VOLUME_ID_LABEL_SIZE]; - int len, i, j; - unsigned long long size; - int rc = 1; - - logging_init("udev_volume_id"); - - while (1) { - int option; - - option = getopt(argc, argv, short_options); - if (option == -1) - break; - - switch (option) { - case 't': - print = 't'; - continue; - case 'l': - print = 'l'; - continue; - case 'u': - print = 'u'; - continue; - case 'h': - case '?': - default: - printf(help); - exit(1); - } - } - - device = argv[optind]; - if (device == NULL) { - printf(help); - exit(1); - } - - vid = volume_id_open_node(device); - if (vid == NULL) { - printf("error open volume\n"); - goto exit; - } - - if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) - size = 0; - - if (volume_id_probe_all(vid, 0, size) == 0) - goto print; - - if (volume_id_probe_dasd(vid) == 0) - goto print; - - printf("unknown volume type\n"); - goto exit; - - -print: - len = strnlen(vid->label, VOLUME_ID_LABEL_SIZE); - - /* remove trailing spaces */ - while (len > 0 && isspace(vid->label[len-1])) - len--; - name[len] = '\0'; - - /* substitute chars */ - i = 0; - j = 0; - while (j < len) { - switch(vid->label[j]) { - case '/' : - break; - case ' ' : - name[i++] = '_'; - break; - default : - name[i++] = vid->label[j]; - } - j++; - } - name[i] = '\0'; - - switch (print) { - case 't': - printf("%s\n", vid->type); - break; - case 'l': - if (name[0] == '\0' || - (vid->usage_id != VOLUME_ID_FILESYSTEM && vid->usage_id != VOLUME_ID_DISKLABEL)) { - rc = 2; - goto exit; - } - printf("%s\n", name); - break; - case 'u': - if (vid->uuid[0] == '\0' || vid->usage_id != VOLUME_ID_FILESYSTEM) { - rc = 2; - goto exit; - } - printf("%s\n", vid->uuid); - break; - case 'a': - printf("F:%s\n", vid->usage); - printf("T:%s\n", vid->type); - printf("V:%s\n", vid->type_version); - printf("L:%s\n", vid->label); - printf("N:%s\n", name); - printf("U:%s\n", vid->uuid); - } - rc = 0; - -exit: - if (vid != NULL) - volume_id_close(vid); - - logging_close(); - - exit(rc); -} diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c new file mode 100644 index 0000000000..3048fd8062 --- /dev/null +++ b/extras/volume_id/vol_id.c @@ -0,0 +1,198 @@ +/* + * udev_volume_id - udev callout to read filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * sample udev rule for creation of a symlink with the filsystem uuid: + * KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -u %N", SYMLINK="%c" + * + * 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 02139, USA. + * + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include + +#include "../../udev_utils.h" +#include "../../logging.h" +#include "volume_id/volume_id.h" +#include "volume_id/dasd.h" + +#define BLKGETSIZE64 _IOR(0x12,114,size_t) + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +static void set_str(char *to, const unsigned char *from, int count) +{ + int i, j; + int len; + + len = strnlen(from, count); + while (isspace(from[len-1])) + len--; + + i = 0; + while (isspace(from[i]) && (i < len)) + i++; + + j = 0; + while (i < len) { + switch(from[i]) { + case '/': + break; + case ' ': + to[j++] = '_'; + break; + default: + to[j++] = from[i]; + } + i++; + } + to[j] = '\0'; +} + +int main(int argc, char *argv[]) +{ + const char help[] = "usage: udev_volume_id [--export|-t|-l|-u] \n" + " --export\n" + " -t filesystem type\n" + " -l filesystem label\n" + " -u filesystem uuid\n" + "\n"; + enum print_type { + PRINT_EXPORT, + PRINT_TYPE, + PRINT_LABEL, + PRINT_UUID, + } print = PRINT_EXPORT; + struct volume_id *vid = NULL; + static char name[VOLUME_ID_LABEL_SIZE]; + int i; + unsigned long long size; + const char *node = NULL; + int rc = 0; + + logging_init("udev_volume_id"); + + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--export") == 0) { + print = PRINT_EXPORT; + } else if (strcmp(arg, "-t") == 0) { + print = PRINT_TYPE; + } else if (strcmp(arg, "-l") == 0) { + print = PRINT_LABEL; + } else if (strcmp(arg, "-u") == 0) { + print = PRINT_UUID; + } else + node = arg; + } + if (!node) { + err("no node specified"); + fprintf(stderr, help); + rc = 1; + goto exit; + } + + vid = volume_id_open_node(node); + if (vid == NULL) { + fprintf(stderr, "error open volume\n"); + rc = 2; + goto exit; + } + + if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) + size = 0; + + if (volume_id_probe_all(vid, 0, size) == 0) + goto print; + + if (volume_id_probe_dasd(vid) == 0) + goto print; + + fprintf(stderr, "unknown volume type\n"); + rc = 3; + goto exit; + +print: + set_str(name, vid->label, sizeof(vid->label)); + + switch (print) { + case PRINT_EXPORT: + printf("ID_FS_USAGE=%s\n", vid->usage); + printf("ID_FS_TYPE=%s\n", vid->type); + printf("ID_FS_VERSION=%s\n", vid->type_version); + printf("ID_FS_UUID=%s\n", vid->uuid); + printf("ID_FS_LABEL=%s\n", vid->label); + printf("ID_FS_LABEL_SAFE=%s\n", name); + break; + case PRINT_TYPE: + printf("%s\n", vid->type); + break; + case PRINT_LABEL: + if (name[0] == '\0' || + (vid->usage_id != VOLUME_ID_FILESYSTEM && vid->usage_id != VOLUME_ID_DISKLABEL)) { + rc = 3; + goto exit; + } + printf("%s\n", name); + break; + case PRINT_UUID: + if (vid->uuid[0] == '\0' || vid->usage_id != VOLUME_ID_FILESYSTEM) { + rc = 4; + goto exit; + } + printf("%s\n", vid->uuid); + break; + } + +exit: + if (vid != NULL) + volume_id_close(vid); + + logging_close(); + return rc; +} -- cgit v1.2.3-54-g00ecf From b8476286d62c82a1a0bd8de318aa3f7d835222a0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Jun 2005 18:55:24 +0200 Subject: store the imported device information in the udevdb Any program can query with udevinfo for persistent device attributes evaluated on device discovery now. Signed-off-by: Kay Sievers --- extras/ata_id/Makefile | 2 +- extras/run_directory/Makefile | 4 ++-- extras/volume_id/vol_id.c | 9 +++------ udev.h | 1 + udev_db.c | 9 ++++++++- udev_libc_wrapper.h | 13 ++++++++----- udev_rules.c | 28 ++++++++++++++++----------- udev_utils.c | 42 ++++++++++++++++++++++++++++++++++++++-- udev_utils.h | 1 + udevinfo.c | 45 ++++++++++++++++++++++++++----------------- udevstart.c | 24 +++++++++++++++++------ 11 files changed, 126 insertions(+), 52 deletions(-) diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index ad79a0d836..a19c4b2289 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -1,4 +1,4 @@ -# Makefile for udev_volume_id +# Makefile for ata_id # # Copyright (C) 2004 Kay Sievers # diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 12dccf0749..0562073c8f 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -1,6 +1,6 @@ -# Makefile for udev_volume_id +# Makefile for run_directory # -# Copyright (C) 2004 Kay Sievers +# Copyright (C) 2005 Kay Sievers # # 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 diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 3048fd8062..451fd355c1 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -1,11 +1,8 @@ /* - * udev_volume_id - udev callout to read filesystem label and uuid + * vol_id - udev callout to read filesystem label and uuid * * Copyright (C) 2005 Kay Sievers * - * sample udev rule for creation of a symlink with the filsystem uuid: - * KERNEL="sd*", PROGRAM="/sbin/udev_volume_id -u %N", SYMLINK="%c" - * * 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. @@ -95,7 +92,7 @@ static void set_str(char *to, const unsigned char *from, int count) int main(int argc, char *argv[]) { - const char help[] = "usage: udev_volume_id [--export|-t|-l|-u] \n" + const char help[] = "usage: vol_id [--export|-t|-l|-u] \n" " --export\n" " -t filesystem type\n" " -l filesystem label\n" @@ -114,7 +111,7 @@ int main(int argc, char *argv[]) const char *node = NULL; int rc = 0; - logging_init("udev_volume_id"); + logging_init("vol_id"); for (i = 1 ; i < argc; i++) { char *arg = argv[i]; diff --git a/udev.h b/udev.h index 11fbe02460..b5287bb53f 100644 --- a/udev.h +++ b/udev.h @@ -69,6 +69,7 @@ struct udevice { dev_t devt; struct list_head run_list; int run_final; + struct list_head env_list; char tmp_node[PATH_SIZE]; int partitions; diff --git a/udev_db.c b/udev_db.c index afbd50e50f..264af79d06 100644 --- a/udev_db.c +++ b/udev_db.c @@ -86,7 +86,8 @@ int udev_db_add_device(struct udevice *udev) fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); fprintf(f, "A:%u\n", udev->partitions); fprintf(f, "R:%u\n", udev->ignore_remove); - + list_for_each_entry(name_loop, &udev->env_list, node) + fprintf(f, "E:%s\n", name_loop->name); fclose(f); return 0; @@ -149,6 +150,12 @@ static int parse_db_file(struct udevice *udev, const char *filename) strlcpy(line, &bufline[2], count-1); udev->ignore_remove = atoi(line); break; + case 'E': + if (count > sizeof(line)) + count = sizeof(line); + strlcpy(line, &bufline[2], count-1); + name_list_add(&udev->env_list, line, 0); + break; } } file_unmap(buf, bufsize); diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 4d6d332c69..4bb68913a9 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -44,15 +44,18 @@ #include +#ifdef __KLIBC__ +static inline int clearenv(void) +{ + environ[0] = NULL; + return 0; +} +#endif + extern uid_t lookup_user(const char *user); extern gid_t lookup_group(const char *group); -#ifndef strlcat extern size_t strlcpy(char *dst, const char *src, size_t size); -#endif - -#ifndef strlcat extern size_t strlcat(char *dst, const char *src, size_t size); -#endif #endif /* _UDEV_LIBC_WRAPPER_H_ */ diff --git a/udev_rules.c b/udev_rules.c index b81943a17c..9b9454e8fb 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -174,21 +174,26 @@ static int get_key(char **line, char **key, char **value) linepos++; /* get the value*/ - if (linepos[0] == '\0') - return -1; - if (linepos[0] == '"') { linepos++; temp = strchr(linepos, '"'); - if (!temp) + if (!temp) { + dbg("missing closing quote"); return -1; + } + dbg("value is quoted"); temp[0] = '\0'; } else if (linepos[0] == '\'') { linepos++; temp = strchr(linepos, '\''); - if (!temp) + if (!temp) { + dbg("missing closing quote"); return -1; + } + dbg("value is quoted"); temp[0] = '\0'; + } else if (linepos[0] == '\0') { + dbg("value is empty"); } else { temp = linepos; while (temp[0] && !isspace(temp[0])) @@ -200,7 +205,7 @@ static int get_key(char **line, char **key, char **value) return 0; } -static int import_keys_into_env(const char *buf, size_t bufsize) +static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bufsize) { char line[LINE_SIZE]; const char *bufline; @@ -211,7 +216,7 @@ static int import_keys_into_env(const char *buf, size_t bufsize) size_t count; int lineno; - /* loop through the whole file */ + /* loop through the whole buffer */ lineno = 0; cur = 0; while (cur < bufsize) { @@ -242,6 +247,7 @@ static int import_keys_into_env(const char *buf, size_t bufsize) linepos = line; if (get_key(&linepos, &variable, &value) == 0) { dbg("import '%s=%s'", variable, value); + name_list_key_add(&udev->env_list, variable, value); setenv(variable, value, 1); } } @@ -249,7 +255,7 @@ static int import_keys_into_env(const char *buf, size_t bufsize) return 0; } -static int import_file_into_env(const char *filename) +static int import_file_into_env(struct udevice *udev, const char *filename) { char *buf; size_t bufsize; @@ -258,7 +264,7 @@ static int import_file_into_env(const char *filename) err("can't open '%s'", filename); return -1; } - import_keys_into_env(buf, bufsize); + import_keys_into_env(udev, buf, bufsize); file_unmap(buf, bufsize); return 0; @@ -271,7 +277,7 @@ static int import_program_into_env(struct udevice *udev, const char *program) if (execute_program(program, udev->subsystem, result, sizeof(result), &reslen) != 0) return -1; - return import_keys_into_env(result, reslen); + return import_keys_into_env(udev, result, reslen); } /* finds the lowest positive N such that N isn't present in the udevdb @@ -828,7 +834,7 @@ try_parent: rc = import_program_into_env(udev, import); } else { dbg("import file import='%s'", import); - rc = import_file_into_env(import); + rc = import_file_into_env(udev, import); } if (rc) { dbg(KEY_IMPORT " failed"); diff --git a/udev_utils.c b/udev_utils.c index 9e2e152763..3ab9e43348 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -47,6 +47,7 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs memset(udev, 0x00, sizeof(struct udevice)); INIT_LIST_HEAD(&udev->symlink_list); INIT_LIST_HEAD(&udev->run_list); + INIT_LIST_HEAD(&udev->env_list); if (subsystem) strlcpy(udev->subsystem, subsystem, sizeof(udev->subsystem)); @@ -112,6 +113,10 @@ void udev_cleanup_device(struct udevice *udev) list_del(&name_loop->node); free(name_loop); } + list_for_each_entry_safe(name_loop, temp_loop, &udev->env_list, node) { + list_del(&name_loop->node); + free(name_loop); + } } int string_is_true(const char *str) @@ -303,10 +308,14 @@ int name_list_add(struct list_head *name_list, const char *name, int sort) dbg("'%s' is already in the list", name); return 0; } - if (sort && strcmp(loop_name->name, name) > 0) - break; } + if (sort) + list_for_each_entry(loop_name, name_list, node) { + if (sort && strcmp(loop_name->name, name) > 0) + break; + } + new_name = malloc(sizeof(struct name_entry)); if (new_name == NULL) { dbg("error malloc"); @@ -314,6 +323,35 @@ int name_list_add(struct list_head *name_list, const char *name, int sort) } strlcpy(new_name->name, name, sizeof(new_name->name)); + dbg("adding '%s'", new_name->name); + list_add_tail(&new_name->node, &loop_name->node); + + return 0; +} + +int name_list_key_add(struct list_head *name_list, const char *key, const char *value) +{ + struct name_entry *loop_name; + struct name_entry *new_name; + + list_for_each_entry(loop_name, name_list, node) { + if (strncmp(loop_name->name, key, strlen(key)) == 0) { + dbg("key already present '%s', replace it", loop_name->name); + snprintf(loop_name->name, sizeof(loop_name->name), "%s=%s", key, value); + loop_name->name[sizeof(loop_name->name)-1] = '\0'; + return 0; + } + } + + new_name = malloc(sizeof(struct name_entry)); + if (new_name == NULL) { + dbg("error malloc"); + return -ENOMEM; + } + + snprintf(new_name->name, sizeof(new_name->name), "%s=%s", key, value); + new_name->name[sizeof(new_name->name)-1] = '\0'; + dbg("adding '%s'", new_name->name); list_add_tail(&new_name->node, &loop_name->node); return 0; diff --git a/udev_utils.h b/udev_utils.h index 999a4fcf55..655c764fc8 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -44,6 +44,7 @@ extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); extern void remove_trailing_char(char *path, char c); extern void replace_untrusted_chars(char *string); extern int name_list_add(struct list_head *name_list, const char *name, int sort); +extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); extern int execute_program(const char *command, const char *subsystem, char *result, size_t ressize, size_t *reslen); diff --git a/udevinfo.c b/udevinfo.c index 69e5335b7c..db562eee49 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -92,14 +92,6 @@ static int print_record(struct udevice *udev) return 0; } -enum query_type { - NONE, - NAME, - PATH, - SYMLINK, - ALL, -}; - static int print_device_chain(const char *path) { struct sysfs_class_device *class_dev; @@ -185,7 +177,14 @@ int main(int argc, char *argv[], char *envp[]) struct udevice udev; int root = 0; int attributes = 0; - enum query_type query = NONE; + enum query_type { + QUERY_NONE, + QUERY_NAME, + QUERY_PATH, + QUERY_SYMLINK, + QUERY_ENV, + QUERY_ALL, + } query = QUERY_NONE; char path[PATH_SIZE] = ""; char name[PATH_SIZE] = ""; char temp[PATH_SIZE]; @@ -220,22 +219,27 @@ int main(int argc, char *argv[], char *envp[]) dbg("udev query: %s\n", optarg); if (strcmp(optarg, "name") == 0) { - query = NAME; + query = QUERY_NAME; break; } if (strcmp(optarg, "symlink") == 0) { - query = SYMLINK; + query = QUERY_SYMLINK; break; } if (strcmp(optarg, "path") == 0) { - query = PATH; + query = QUERY_PATH; + break; + } + + if (strcmp(optarg, "env") == 0) { + query = QUERY_ENV; break; } if (strcmp(optarg, "all") == 0) { - query = ALL; + query = QUERY_ALL; break; } @@ -268,7 +272,7 @@ int main(int argc, char *argv[], char *envp[]) } /* process options */ - if (query != NONE) { + if (query != QUERY_NONE) { if (path[0] != '\0') { /* remove sysfs_path if given */ if (strncmp(path, sysfs_path, strlen(sysfs_path)) == 0) { @@ -317,13 +321,13 @@ int main(int argc, char *argv[], char *envp[]) print: switch(query) { - case NAME: + case QUERY_NAME: if (root) printf("%s/%s\n", udev_root, udev.name); else printf("%s\n", udev.name); goto exit; - case SYMLINK: + case QUERY_SYMLINK: if (list_empty(&udev.symlink_list)) break; if (root) @@ -334,10 +338,14 @@ print: printf("%s ", name_loop->name); printf("\n"); goto exit; - case PATH: + case QUERY_PATH: printf("%s\n", udev.devpath); goto exit; - case ALL: + case QUERY_ENV: + list_for_each_entry(name_loop, &udev.env_list, node) + printf("%s\n", name_loop->name); + goto exit; + case QUERY_ALL: print_record(&udev); goto exit; default: @@ -373,6 +381,7 @@ help: " 'name' name of device node\n" " 'symlink' pointing to node\n" " 'path' sysfs device path\n" + " 'env' the device related imported environment\n" " 'all' all values\n" "\n" " -p PATH sysfs device path used for query or chain\n" diff --git a/udevstart.c b/udevstart.c index b65a28aab6..4e922bb716 100644 --- a/udevstart.c +++ b/udevstart.c @@ -45,6 +45,9 @@ #include "udev_utils.h" #include "list.h" +static const char *udev_run_str; +static const char *udev_log_str; + #ifdef USE_LOG void log_message(int priority, const char *format, ...) { @@ -111,8 +114,17 @@ static int add_device(const char *path, const char *subsystem) const char *devpath; devpath = &path[strlen(sysfs_path)]; + + /* clear and set environment for next event */ + clearenv(); + setenv("ACTION", "add", 1); setenv("DEVPATH", devpath, 1); setenv("SUBSYSTEM", subsystem, 1); + setenv("UDEV_START", "1", 1); + if (udev_log_str) + setenv("UDEV_LOG", udev_log_str, 1); + if (udev_run_str) + setenv("UDEV_RUN", udev_run_str, 1); dbg("exec: '%s' (%s)\n", devpath, path); class_dev = sysfs_open_class_device_path(path); @@ -327,10 +339,14 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udev"); udev_init_config(); + dbg("version %s", UDEV_VERSION); + + udev_run_str = getenv("UDEV_RUN"); + udev_log_str = getenv("UDEV_LOG"); + /* disable all logging if not explicitely requested */ - if (getenv("UDEV_LOG") == NULL) + if (udev_log_str == NULL) udev_log_priority = 0; - dbg("version %s", UDEV_VERSION); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); @@ -344,10 +360,6 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timeout to prevent hanging processes */ alarm(ALARM_TIMEOUT); - /* set environment for executed programs */ - setenv("ACTION", "add", 1); - setenv("UDEV_START", "1", 1); - udev_rules_init(); udev_scan_block(); -- cgit v1.2.3-54-g00ecf From 34129109a1f5dca72af2f3f2d3d14a9a0d0c43f6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 27 Jun 2005 02:51:49 +0200 Subject: add -x to scsi_id to export the queried values in env format Signed-off-by: Kay Sievers --- extras/scsi_id/scsi_id.c | 66 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 32a96d8adb..86b84bee30 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -52,7 +52,7 @@ * options are not supported, but other code is still left in place for * now. */ -static const char short_options[] = "bd:f:gip:s:uvV"; +static const char short_options[] = "bd:f:gip:s:uvVx"; /* * Just duplicate per dev options. */ @@ -71,6 +71,9 @@ static int use_stderr; static int debug; static int hotplug_mode; static int reformat_serial; +static int export; +static char vendor_str[64]; +static char model_str[64]; void log_message (int level, const char *format, ...) { @@ -84,13 +87,8 @@ void log_message (int level, const char *format, ...) vfprintf(stderr, format, args); } else { static int logging_init = 0; - static unsigned char logname[32]; if (!logging_init) { - /* - * klibc does not have LOG_PID. - */ - snprintf(logname, 32, "scsi_id[%d]", getpid()); - openlog (logname, 0, LOG_DAEMON); + openlog ("scsi_id", LOG_PID, LOG_DAEMON); logging_init = 1; } @@ -100,6 +98,34 @@ void log_message (int level, const char *format, ...) return; } +static void set_str(char *to, const unsigned char *from, int count) +{ + int i, j; + int len; + + len = strnlen(from, count); + while (isspace(from[len-1])) + len--; + + i = 0; + while (isspace(from[i]) && (i < len)) + i++; + + j = 0; + while (i < len) { + switch(from[i]) { + case '/': + case ' ': + to[j++] = '_'; + break; + default: + to[j++] = from[i]; + } + i++; + } + to[j] = '\0'; +} + static int get_major_minor(struct sysfs_class_device *class_dev, int *maj, int *min) { @@ -465,6 +491,10 @@ static int set_options(int argc, char **argv, const char *short_opts, reformat_serial = 1; break; + case 'x': + export = 1; + break; + case 'v': debug++; break; @@ -507,6 +537,7 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, scsi_dev->name); return -1; } + set_str(vendor_str, vendor->value, sizeof(vendor_str)-1); model = sysfs_get_device_attr(scsi_dev, "model"); if (!model) { @@ -514,6 +545,7 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, scsi_dev->name); return -1; } + set_str(model_str, model->value, sizeof(model_str)-1); retval = get_file_options(vendor->value, model->value, &newargc, &newargv); @@ -584,7 +616,7 @@ static void format_serial(char *serial) *p = '_'; p++; } - return; +return; } /* @@ -723,11 +755,19 @@ static int scsi_id(const char *target_path, char *maj_min_dev) retval = 0; } if (!retval) { - if (reformat_serial) - format_serial(serial); - if (display_bus_id) - printf("%s: ", scsi_dev->name); - printf("%s\n", serial); + if (export) { + static char serial_str[64]; + printf("ID_VENDOR=%s\n", vendor_str); + printf("ID_MODEL=%s\n", model_str); + set_str(serial_str, serial, sizeof(serial_str)); + printf("ID_SERIAL=%s\n", serial_str); + } else { + if (reformat_serial) + format_serial(serial); + if (display_bus_id) + printf("%s: ", scsi_dev->name); + printf("%s\n", serial); + } dprintf("%s\n", serial); retval = 0; } -- cgit v1.2.3-54-g00ecf From aaff09a30ab849186c0d4ad8bde83876d7a1a63d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 27 Jun 2005 17:04:56 +0200 Subject: add ID_TYPE to the id probers Export the type of device from ata_id and scsi_id, also strip leading and trailing whitespace and substitute consecutive whitespace with a single underline char. From: Hannes Reinecke Signed-off-by: Kay Sievers --- extras/ata_id/ata_id.c | 41 ++++++++++++++++++++----- extras/scsi_id/scsi_id.c | 78 +++++++++++++++++++++++++++++++++++++++++++----- udev_rules.c | 2 +- udev_utils.c | 2 +- udevd.c | 2 +- 5 files changed, 107 insertions(+), 18 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 59e2b3987b..34b1ccdff1 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -67,25 +67,30 @@ static void set_str(char *to, const unsigned char *from, int count) int i, j; int len; + /* strip trailing whitespace */ len = strnlen(from, count); while (isspace(from[len-1])) len--; + /* strip leading whitespace */ i = 0; while (isspace(from[i]) && (i < len)) i++; j = 0; while (i < len) { - switch(from[i]) { - case '/': - case ' ': + /* substitute multiple whitespace */ + if (isspace(from[i])) { + while (isspace(from[i])) + i++; to[j++] = '_'; - break; - default: - to[j++] = from[i]; } - i++; + /* skip chars */ + if (from[i] == '/') { + i++; + continue; + } + to[j++] = from[i++]; } to[j] = '\0'; } @@ -137,6 +142,28 @@ int main(int argc, char *argv[]) set_str(revision, id.fw_rev, 8); if (export) { + if ((id.config >> 8) & 0x80) { + /* This is an ATAPI device */ + switch ((id.config >> 8) & 0x1f) { + case 0: + printf("ID_TYPE=cd\n"); + break; + case 1: + printf("ID_TYPE=tape\n"); + break; + case 5: + printf("ID_TYPE=cd\n"); + break; + case 7: + printf("ID_TYPE=optical\n"); + break; + default: + printf("ID_TYPE=generic\n"); + break; + } + } else { + printf("ID_TYPE=disk\n"); + } printf("ID_MODEL=%s\n", model); printf("ID_SERIAL=%s\n", serial); printf("ID_REVISION=%s\n", revision); diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 86b84bee30..4003ee6af5 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -74,6 +74,8 @@ static int reformat_serial; static int export; static char vendor_str[64]; static char model_str[64]; +static char revision_str[16]; +static char type_str[16]; void log_message (int level, const char *format, ...) { @@ -103,27 +105,70 @@ static void set_str(char *to, const unsigned char *from, int count) int i, j; int len; + /* strip trailing whitespace */ len = strnlen(from, count); while (isspace(from[len-1])) len--; + /* strip leading whitespace */ i = 0; while (isspace(from[i]) && (i < len)) i++; j = 0; while (i < len) { - switch(from[i]) { - case '/': - case ' ': + /* substitute multiple whitespace */ + if (isspace(from[i])) { + while (isspace(from[i])) + i++; to[j++] = '_'; + } + /* skip chars */ + if (from[i] == '/') { + i++; + continue; + } + to[j++] = from[i++]; + } + to[j] = '\0'; +} + +static void set_type(char *to, const char *from, int count) +{ + int type_num; + char *eptr; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 0: + sprintf(to, "disk"); + break; + case 1: + sprintf(to, "tape"); + break; + case 4: + sprintf(to, "optical"); + break; + case 5: + sprintf(to, "cd"); + break; + case 7: + sprintf(to, "optical"); + break; + case 0xe: + sprintf(to, "disk"); + break; + case 0xf: + sprintf(to, "optical"); break; default: - to[j++] = from[i]; + sprintf(to, "generic"); + break; } - i++; + } else { + sprintf(to, "generic"); } - to[j] = '\0'; } static int get_major_minor(struct sysfs_class_device *class_dev, int *maj, @@ -521,7 +566,7 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, int retval; int newargc; char **newargv = NULL; - struct sysfs_attribute *vendor, *model; + struct sysfs_attribute *vendor, *model, *type; int option; *good_bad = all_good; @@ -547,6 +592,22 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, } set_str(model_str, model->value, sizeof(model_str)-1); + type = sysfs_get_device_attr(scsi_dev, "type"); + if (!type) { + log_message(LOG_WARNING, "%s: cannot get type attribute\n", + scsi_dev->name); + return -1; + } + set_type(type_str, type->value, sizeof(type_str)-1); + + type = sysfs_get_device_attr(scsi_dev, "rev"); + if (!type) { + log_message(LOG_WARNING, "%s: cannot get type attribute\n", + scsi_dev->name); + return -1; + } + set_str(revision_str, type->value, sizeof(revision_str)-1); + retval = get_file_options(vendor->value, model->value, &newargc, &newargv); @@ -616,7 +677,6 @@ static void format_serial(char *serial) *p = '_'; p++; } -return; } /* @@ -759,8 +819,10 @@ static int scsi_id(const char *target_path, char *maj_min_dev) static char serial_str[64]; printf("ID_VENDOR=%s\n", vendor_str); printf("ID_MODEL=%s\n", model_str); + printf("ID_REVISION=%s\n", revision_str); set_str(serial_str, serial, sizeof(serial_str)); printf("ID_SERIAL=%s\n", serial_str); + printf("ID_TYPE=%s\n", type_str); } else { if (reformat_serial) format_serial(serial); diff --git a/udev_rules.c b/udev_rules.c index 9b9454e8fb..9606f04d3d 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -793,7 +793,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, len = strlen(value); while (len > 0 && isspace(value[len-1])) value[--len] = '\0'; - dbg("removed %i trailing whitespace chars from '%s'", strlen(value)-len, value); + dbg("removed %zi trailing whitespace chars from '%s'", strlen(value)-len, value); } dbg("compare attribute '%s' value '%s' with '%s'", pair->name, value, pair->value); diff --git a/udev_utils.c b/udev_utils.c index 3ab9e43348..073cde1074 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -485,7 +485,7 @@ int execute_program(const char *command, const char *subsystem, len += count; if (len >= ressize-1) { - err("ressize %d too short", ressize); + err("ressize %ld too short", (long)ressize); retval = -1; break; } diff --git a/udevd.c b/udevd.c index 209b9fcd87..e3ee1457cb 100644 --- a/udevd.c +++ b/udevd.c @@ -600,7 +600,7 @@ static struct uevent_msg *get_netlink_msg(void) if ((size_t)size > sizeof(buffer)-1) size = sizeof(buffer)-1; buffer[size] = '\0'; - dbg("uevent_size=%i", size); + dbg("uevent_size=%li", (long)size); /* start of event payload */ bufpos = strlen(buffer)+1; -- cgit v1.2.3-54-g00ecf From be0856c841e248c491e0fdea013a7af0f61a76b1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Jun 2005 21:50:22 +0200 Subject: prepare RELEASE-NOTES Signed-off-by: Kay Sievers --- RELEASE-NOTES | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/udev-test.pl | 4 +-- udev_rules_parse.c | 19 ++++++++++- 3 files changed, 119 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9b7fa31330..46787704ce 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,102 @@ +udev 059 +======== +Major changes happened with this release. The goal is to take over the +complete kernel-event handling and provide a more efficient way to dispatch +kernel events. Replacing most of the current shell script logic and the +kernel forked helper with a netlink-daemon and a rule-based event handling. + +o udevd listens to netlink events now. The first valid netlink event + will make udevd ignore any message from udevsend that contains a + SEQNUM, to avoid duplicate events. The forked events can be disabled + with: + echo "" > /proc/sys/kernel/hotplug + For full support, the broken input-subsytem needs to be fixed, not to + bypass the driver core. + +o /etc/dev.d/ + /etc/hotplug.d/ directory multiplexing is completely + removed from udev itself and must be emulated by calling small + helper binaries provided in the extras folder: + make EXTRAS=extras/run_directory/ + will build udev_run_devd and udev_run_hotplugd, which can be called + from a rule if needed: + RUN+="/sbin/udev_run_hotplugd" + The recommended way to handle this is to convert all the calls from + the directories to explicit udev rules and get completely rid of the + multiplexing. (To catch a ttyUSB event, you now no longer need to + fork and exit 300 tty script instances you are not interested in, it + is just one rule that matches exactly the device.) + +o udev handles now _all_ events not just events for class and block + devices, this way it is possible to control the complete event + behavior with udev rules. Especially useful for rules like: + ACTION="add", DEVPATH="/devices/*", MODALIAS=="?*", RUN+="/sbin/modprobe $modalias" + +o As used in the modalias rule, udev supports now textual + substitution placeholder along with the usual format chars. This + needs to be documented, for now it's only visible in udev_rules_parse.c. + +o The rule keys support now more operations. This is documented in the + man page. It is possible to add values to list-keys like the SYMLINK + and RUN list with KEY+="value" and to clear the list by assigning KEY="". + Also "final"-assignments are supported by using KEY:="value", which will + prevent changing the key by any later rule. + +o kernel 2.6.12 has the "detached_state" attribute removed from + sysfs, which was used to recognize sysfs population. We switched that + to wait for the "bus" link, which is only available in kernels after 2.6.11. + Running this udev version on older kernels may cause a short delay for + some events. + +o To provide infrastructure for persistent device naming, the id programs: + scsi_id, vol_id (former udev_volume_id), and ata_id (new) are able now + to export the probed data in environment key format: + pim:~ # /sbin/ata_id --export /dev/hda + ID_MODEL=HTS726060M9AT00 + ID_SERIAL=MRH401M4G6UM9B + ID_REVISION=MH4OA6BA + + The following rules: + KERNEL="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" + KERNEL="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_MODEL}_$env{ID_SERIAL}" + + Will create: + kay@pim:~> tree /dev/disk + /dev/disk + |-- by-id + | |-- HTS726060M9AT00_MRH401M4G6UM9B -> ../../hda + | `-- IBM-Memory_Key -> ../../sda + |-- by-label + | |-- swap -> ../../hda1 + | |-- date -> ../../sda1 + | `-- home -> ../../hda3 + `-- by-uuid + |-- 2E08712B0870F2E7 -> ../../hda3 + |-- 9352cfef-7687-47bc-a2a3-34cf136f72e1 -> ../../hda1 + |-- E845-7A89 -> ../../sda1 + `-- b2a61681-3812-4f13-a4ff-920d70604299 -> ../../hda2 + + The IMPORT= operation will import these keys in the environment and make + it available for later PROGRAM= and RUN= executed programs. The keys are + also stored in the udevdb and can be queried from there with one of the + next udev versions. + +o A few binaries are silently added to the repository, which can be used + to replay kernel events from initramfs instead of using coldplug. udevd + can be instructed now to queue-up events while the stored events from + initramfs are filled into the udevd-queue. This code is still under + development and there is no documentation now besides the code itself. + The additional binaries get compiled, but are not installed by default. + +o There is also a temporary fix for a performance problem where too many + events happen in parallel and every event needs to parse the rules. + udev can now read precompiled rules stored on disk. This is likely to be + replaced by a more elegant solution in a future udev version. + +udev 058 +======== +With kernel version 2.6.12, the sysfs file "detached_state" was removed. +Fix for libsysfs not to expect this file was added. + udev 057 ======== All rules are applied now, but only the first matching rule with a NAME-key diff --git a/test/udev-test.pl b/test/udev-test.pl index bf6b62f10a..5210471474 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -264,7 +264,7 @@ EOF devpath => "/block/sda", exp_name => "subdir/sys/node" , rules => < "/block/sda", exp_name => "node12345678", rules => < Date: Thu, 30 Jun 2005 16:26:43 -0700 Subject: Update the gentoo rule file --- etc/udev/gentoo/udev.rules | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 65113aebf7..6698aa6fd9 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -141,7 +141,7 @@ KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty" KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0600" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" KERNEL="ippp0", NAME="%k", GROUP="tty" KERNEL="isdn*", NAME="%k", GROUP="tty" KERNEL="dcbri*", NAME="%k", GROUP="tty" @@ -184,7 +184,7 @@ KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" # dvb devices KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video", MODE="0660" -# Asterix Zaptel devices +# Asterisk Zaptel devices KERNEL="zapctl", NAME="zap/ctl" KERNEL="zaptimer", NAME="zap/timer" KERNEL="zapchannel", NAME="zap/channel" @@ -238,4 +238,12 @@ KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" # infiniband devices KERNEL="umad*", NAME="infiniband/%k" -KERNEL="issm*", NAME="infiniband/%k" +KERNEL="issm*", NAME="infiniband/%k" + +# tpm devices +KERNEL="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" + +# be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems +RUN += "/sbin/udev_run_devd" +RUN += "/sbin/udev_run_hotplugd" + -- cgit v1.2.3-54-g00ecf From 4d8c16072a2d529b40bcc392396c0dc215236f01 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 30 Jun 2005 16:27:52 -0700 Subject: 059 release --- Makefile | 2 +- udev.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 32e057b1cb..b04321ff4e 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ CONTROL = udevcontrol INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 058 +VERSION = 059 RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev DESTDIR = diff --git a/udev.spec b/udev.spec index 0430a1259d..d56a43ce7d 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 058 +Version: 059 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From a105fe495bdc95a24eaf2db557104534f6e1db34 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Thu, 23 Jun 2005 00:28:54 +0200 Subject: [PATCH] #define NETLINK_KOBJECT_UEVENT On many systems the system kernel headers are not recent enough to compile udev. --- udevd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udevd.c b/udevd.c index e3ee1457cb..f69abc4c09 100644 --- a/udevd.c +++ b/udevd.c @@ -48,6 +48,10 @@ #include "udevd.h" #include "logging.h" +#ifndef NETLINK_KOBJECT_UEVENT +#define NETLINK_KOBJECT_UEVENT 15 +#endif + /* global variables*/ static int udevd_sock; static int uevent_netlink_sock; -- cgit v1.2.3-54-g00ecf From 3cf745e128ba02fcea33bd13190b713f00119150 Mon Sep 17 00:00:00 2001 From: Gustavo Zacarias Date: Mon, 27 Jun 2005 12:46:53 -0300 Subject: [PATCH] Udev doesn't properly build with $CROSS Patch attached - basically you're always invoking klcc for the udev build itself, but klibc builds $(CROSS)klcc. Thus static cross builds don't work. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b04321ff4e..665f75a29e 100644 --- a/Makefile +++ b/Makefile @@ -174,7 +174,7 @@ endif # link udev against it statically. Otherwise, use glibc and link dynamically. ifeq ($(strip $(USE_KLIBC)),true) KLIBC_INSTALL = $(PWD)/klibc/.install - KLCC = $(KLIBC_INSTALL)/bin/klcc + KLCC = $(KLIBC_INSTALL)/bin/$(CROSS)klcc CC = $(KLCC) LD = $(KLCC) else -- cgit v1.2.3-54-g00ecf From 1fcc2a36fd0de4c268963ae9dc9402c73f3320bd Mon Sep 17 00:00:00 2001 From: Greg KH Date: Sat, 2 Jul 2005 23:47:43 -0700 Subject: Fix the gentoo udev rules to allow the box to boot properly --- etc/udev/gentoo/udev.rules | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 6698aa6fd9..9feed3ea4b 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -244,6 +244,8 @@ KERNEL="issm*", NAME="infiniband/%k" KERNEL="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems -RUN += "/sbin/udev_run_devd" -RUN += "/sbin/udev_run_hotplugd" +# run hotplug.d stuff only if we came from a hotplug event, not for udevstart +ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" +# always run etc.d stuff for now. +RUN += "/sbin/udev_run_devd" -- cgit v1.2.3-54-g00ecf From 66f74a2d1411e9761ac90c5a2f81d70b22ec936d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 2 Jul 2005 22:29:46 +0200 Subject: [PATCH] Keep udevstart from skipping devices without a 'dev' file --- udevstart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevstart.c b/udevstart.c index 4e922bb716..22b781d52a 100644 --- a/udevstart.c +++ b/udevstart.c @@ -135,7 +135,7 @@ static int add_device(const char *path, const char *subsystem) udev_init_device(&udev, devpath, subsystem, "add"); udev.devt = get_devt(class_dev); - if (!udev.devt) { + if (!udev.devt && udev.type != DEV_NET) { dbg("sysfs_open_class_device_path failed"); return -1; } @@ -337,7 +337,7 @@ int main(int argc, char *argv[], char *envp[]) { struct sigaction act; - logging_init("udev"); + logging_init("udevstart"); udev_init_config(); dbg("version %s", UDEV_VERSION); -- cgit v1.2.3-54-g00ecf From 281c368b8f00fbe70ea45c3c5f8d152ae7f1e077 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Sat, 2 Jul 2005 23:55:08 -0700 Subject: 060 release --- ChangeLog | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 3942d319d5..4f784bf252 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,69 @@ +Summary of changes from v058 to v059 +============================================ + +Greg Kroah-Hartman: + Fix the gentoo udev rules to allow the box to boot properly + +Gustavo Zacarias: + Udev doesn't properly build with $CROSS + +Kay Sievers: + Keep udevstart from skipping devices without a 'dev' file + +Marco d'Itri: + #define NETLINK_KOBJECT_UEVENT + + +Summary of changes from v058 to v059 +============================================ + +Greg Kroah-Hartman: + Update the gentoo rule file + Fix udevinfo for empty sysfs directories + Fix makefile to allow 'make release' to work with git + +Hannes Reinecke: + udev: fix netdev RUN handling + udevcontrol: fix exit code + +Kay Sievers: + prepare RELEASE-NOTES + add ID_TYPE to the id probers + add -x to scsi_id to export the queried values in env format + store the imported device information in the udevdb + rename udev_volume_id to vol_id and add --export option + add ata_id to read serial numbers from ATA drives + IMPORT allow to import program returned keys into the env + unify execute_command() and execute_program() + IMPORT= allow to import a shell-var style config-file + allow rules to be compiled to one binary file + fix the fix and change the file to wait for to the "bus" link + fix udevstart and let all events trvel trough udev + prepare for module loading rules and add MODALIAS key + remove device node, when type block/char has changed + Makefile: remove dev.d/ hotplug.d/ from install target + udevcontrol: add max_childs command + udevd: control log-priority of the running daemon with udevcontrol + udeveventrecorder: add small program that writes an event to disk + klibc: add missing files + udevinitsend: handle replay messages correctly + udev man page: add operators + udevd: allow starting of udevd with stopped exec-queue + klibc: version 1.0.14 + udev: handle all events - not only class and block devices + volume_id: use udev-provided log-level + udev: clear lists if a new value is assigned + udev: move dev.d/ handling to external helper + udev: allow final assignments := + udevd: improve timeout handling + Makefile: fix DESTDIR + udevd: add initsend + udevd: add udevcontrol + udevd: listen for netlink events + +Stefan Schweizer: + Dialout group fix for capi devices in the gentoo rules file + Summary of changes from v057 to v058 ============================================ diff --git a/Makefile b/Makefile index 665f75a29e..302bb3da14 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ CONTROL = udevcontrol INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 059 +VERSION = 060 RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev DESTDIR = -- cgit v1.2.3-54-g00ecf From 46763d59dc210e22c611547776363b021c421467 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Sat, 2 Jul 2005 23:55:38 -0700 Subject: Fix ChangeLog titles --- ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4f784bf252..d2e641fc4a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,4 @@ -Summary of changes from v058 to v059 +Summary of changes from v059 to v060 ============================================ Greg Kroah-Hartman: -- cgit v1.2.3-54-g00ecf From 7c26d9eb432b173ccd61b998ab5a4a8debf51d68 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Jul 2005 14:01:48 +0200 Subject: switch gentoo rules to new operators Signed-off-by: Kay Sievers --- etc/udev/gentoo/udev.rules | 288 +++++++++++++++++++++++---------------------- 1 file changed, 147 insertions(+), 141 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 9feed3ea4b..7136f6a4bb 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -13,239 +13,245 @@ ########################################################### # all block devices -SUBSYSTEM="block", GROUP="disk" +SUBSYSTEM=="block", GROUP="disk" # cdrom symlinks and other good cdrom naming -BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS=="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS=="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS=="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" +BUS=="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" # disk devices -KERNEL="sd*", NAME="%k", GROUP="disk" -KERNEL="dasd*", NAME="%k", GROUP="disk" -KERNEL="ataraid*", NAME="%k", GROUP="disk" +KERNEL=="sd*", NAME="%k", GROUP="disk" +KERNEL=="dasd*", NAME="%k", GROUP="disk" +KERNEL=="ataraid*", NAME="%k", GROUP="disk" # compaq smart array -KERNEL="cciss*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" -KERNEL="ida*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" +KERNEL=="cciss*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +KERNEL=="ida*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" # mylex -KERNEL="rd*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" +KERNEL=="rd*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" # dri devices -KERNEL="card*", NAME="dri/card%n", GROUP="video" -KERNEL="nvidia*", NAME="%k", GROUP="video" -KERNEL="3dfx*", NAME="%k", GROUP="video" +KERNEL=="card*", NAME="dri/card%n", GROUP="video" +KERNEL=="nvidia*", NAME="%k", GROUP="video" +KERNEL=="3dfx*", NAME="%k", GROUP="video" # alsa devices -SUBSYSTEM="sound", GROUP="audio" -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midiC[D0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" +SUBSYSTEM=="sound", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hw[CD0-9]*", NAME="snd/%k" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" # capi devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20", GROUP="dialout" -KERNEL="capi*", NAME="capi/%n", GROUP="dialout" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20", GROUP="dialout" +KERNEL=="capi*", NAME="capi/%n", GROUP="dialout" # cpu devices -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL="microcode", NAME="cpu/microcode" +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" # dm devices (ignore them) -KERNEL="dm-[0-9]*", NAME="" +KERNEL=="dm-[0-9]*", OPTIONS="ignore_device" # create a symlink named after the device map name # note devmap_name comes with extras/multipath -#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" -KERNEL="device-mapper", NAME="mapper/control" +#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" +KERNEL=="device-mapper", NAME="mapper/control" # fb devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video" +KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" # floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy" +KERNEL=="fd[0-9]*", NAME="floppy/%n", SYMLINK+="%k", GROUP="floppy" # i2c devices -KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" +KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" # input devices -KERNEL="mice", NAME="input/%k", MODE="0644" -KERNEL="mouse*", NAME="input/%k", MODE="0644" -KERNEL="event*", NAME="input/%k", MODE="0600" -KERNEL="js*", NAME="input/%k", MODE="664" -KERNEL="ts*", NAME="input/%k", MODE="0600" +KERNEL=="mice", NAME="input/%k", MODE="0644" +KERNEL=="mouse*", NAME="input/%k", MODE="0644" +KERNEL=="event*", NAME="input/%k", MODE="0600" +KERNEL=="js*", NAME="input/%k", MODE="664" +KERNEL=="ts*", NAME="input/%k", MODE="0600" # loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k", GROUP="disk" +KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k", GROUP="disk" # md block devices -KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k", GROUP="disk" +KERNEL=="md[0-9]*", NAME="md/%n", SYMLINK+="%k", GROUP="disk" # aoe char devices, -SUBSYSTEM="aoe", KERNEL="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" -SUBSYSTEM="aoe", KERNEL="err", NAME="etherd/%k", GROUP="disk", MODE="0440" -SUBSYSTEM="aoe", KERNEL="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" # misc devices -KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k", MODE="0664" -KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" -KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666" +KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="rtc", NAME="misc/%k", SYMLINK+="%k", MODE="0664" +KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" # netlink devices -KERNEL="route", NAME="netlink/%k" -KERNEL="skip", NAME="netlink/%k" -KERNEL="usersock", NAME="netlink/%k" -KERNEL="fwmonitor", NAME="netlink/%k" -KERNEL="tcpdiag", NAME="netlink/%k" -KERNEL="nflog", NAME="netlink/%k" -KERNEL="xfrm", NAME="netlink/%k" -KERNEL="arpd", NAME="netlink/%k" -KERNEL="route6", NAME="netlink/%k" -KERNEL="ip6_fw", NAME="netlink/%k" -KERNEL="dnrtmsg", NAME="netlink/%k" -KERNEL="tap*", NAME="netlink/%k" +KERNEL=="route", NAME="netlink/%k" +KERNEL=="skip", NAME="netlink/%k" +KERNEL=="usersock", NAME="netlink/%k" +KERNEL=="fwmonitor", NAME="netlink/%k" +KERNEL=="tcpdiag", NAME="netlink/%k" +KERNEL=="nflog", NAME="netlink/%k" +KERNEL=="xfrm", NAME="netlink/%k" +KERNEL=="arpd", NAME="netlink/%k" +KERNEL=="route6", NAME="netlink/%k" +KERNEL=="ip6_fw", NAME="netlink/%k" +KERNEL=="dnrtmsg", NAME="netlink/%k" +KERNEL=="tap*", NAME="netlink/%k" # network devices -KERNEL="tun", NAME="net/%k" +KERNEL=="tun", NAME="net/%k" # ramdisk devices -KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" +KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" # raw devices -KERNEL="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL="ram*", NAME="%k", GROUP="disk" +KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="ram*", NAME="%k", GROUP="disk" # sound devices -KERNEL="adsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio" -KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" -KERNEL="audio", NAME="sound/%k", SYMLINK="%k", GROUP="audio" -KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" -KERNEL="dsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio" -KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" -KERNEL="mixer", NAME="sound/%k", SYMLINK="%k", GROUP="audio" -KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" -KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k", GROUP="audio" -KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio" +KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" # tty devices -KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" -KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty" -KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" -KERNEL="ippp0", NAME="%k", GROUP="tty" -KERNEL="isdn*", NAME="%k", GROUP="tty" -KERNEL="dcbri*", NAME="%k", GROUP="tty" -KERNEL="ircomm*", NAME="%k", GROUP="tty" +KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" +KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty" +KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty" +KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" +KERNEL=="ippp0", NAME="%k", GROUP="tty" +KERNEL=="isdn*" NAME="%k", GROUP="tty" +KERNEL=="dcbri*", NAME="%k", GROUP="tty" +KERNEL=="ircomm*", NAME="%k", GROUP="tty" # pty devices -KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k", GROUP="tty" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k", GROUP="tty" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" +KERNEL=="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK+="%k", GROUP="tty" # vc devices -KERNEL="vcs", NAME="vcc/0", SYMLINK="%k", GROUP="tty" -KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k", GROUP="tty" -KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k", GROUP="tty" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k", GROUP="tty" +KERNEL=="vcs", NAME="vcc/0", SYMLINK+="%k", GROUP="tty" +KERNEL=="vcs[0-9]*", NAME="vcc/%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="vcsa", NAME="vcc/a0", SYMLINK+="%k", GROUP="tty" +KERNEL=="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK+="%k", GROUP="tty" # memory devices -KERNEL="random", NAME="%k", MODE="0666" -KERNEL="urandom", NAME="%k", MODE="0444" -KERNEL="mem", NAME="%k", MODE="0640" -KERNEL="kmem", NAME="%k", MODE="0640" -KERNEL="port", NAME="%k", MODE="0640" -KERNEL="full", NAME="%k", MODE="0666" -KERNEL="null", NAME="%k", MODE="0666" -KERNEL="zero", NAME="%k", MODE="0666" +KERNEL=="random", NAME="%k", MODE="0666" +KERNEL=="urandom", NAME="%k", MODE="0444" +KERNEL=="mem", NAME="%k", MODE="0640" +KERNEL=="kmem", NAME="%k", MODE="0640" +KERNEL=="port", NAME="%k", MODE="0640" +KERNEL=="full", NAME="%k", MODE="0666" +KERNEL=="null", NAME="%k", MODE="0666" +KERNEL=="zero", NAME="%k", MODE="0666" # usb devices -KERNEL="hiddev*", NAME="usb/%k" -KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k", GROUP="usb" -KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k", GROUP="lp" +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="auer*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k", GROUP="usb" +KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" # v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n", GROUP="video" -KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="video" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" +KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" +KERNEL=="radio[0-9]*", NAME="v4l/radio%n", GROUP="video" +KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" +KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" # dvb devices -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video", MODE="0660" +KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video", MODE="0660" # Asterisk Zaptel devices -KERNEL="zapctl", NAME="zap/ctl" -KERNEL="zaptimer", NAME="zap/timer" -KERNEL="zapchannel", NAME="zap/channel" -KERNEL="zappseudo", NAME="zap/pseudo" -KERNEL="zap[0-9]*", NAME="zap/%n" +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" # pilot/palm devices -KERNEL="pilot", NAME="%k", GROUP="uucp" +KERNEL=="pilot", NAME="%k", GROUP="uucp" # jaz devices -KERNEL="jaz*", NAME="%k", GROUP="disk" +KERNEL=="jaz*", NAME="%k", GROUP="disk" # zip devices -KERNEL="pocketzip*", NAME="%k", GROUP="disk" -KERNEL="zip*", NAME="%k", GROUP="disk" +KERNEL=="pocketzip*", NAME="%k", GROUP="disk" +KERNEL=="zip*", NAME="%k", GROUP="disk" # ls120 devices -KERNEL="ls120", NAME="%k", GROUP="disk" +KERNEL=="ls120", NAME="%k", GROUP="disk" # lp devices -KERNEL="lp*", NAME="%k", GROUP="lp" -KERNEL="irlpt", NAME="%k", GROUP="lp" -KERNEL="usblp", NAME="%k", GROUP="lp" -KERNEL="lp*", NAME="%k", GROUP="lp" +KERNEL=="lp*", NAME="%k", GROUP="lp" +KERNEL=="irlpt", NAME="%k", GROUP="lp" +KERNEL=="usblp", NAME="%k", GROUP="lp" +KERNEL=="lp*", NAME="%k", GROUP="lp" # tape devices -KERNEL="ht*", NAME="%k", GROUP="tape" -KERNEL="nht*", NAME="%k", GROUP="tape" -KERNEL="pt*", NAME="%k", GROUP="tape" -KERNEL="npt*", NAME="%k", GROUP="tape" -KERNEL="st*", NAME="%k", GROUP="tape" -KERNEL="nst*", NAME="%k", GROUP="tape" -KERNEL="osst*", NAME="%k", GROUP="tape" -KERNEL="nosst*", NAME="%k", GROUP="tape" +KERNEL=="ht*", NAME="%k", GROUP="tape" +KERNEL=="nht*", NAME="%k", GROUP="tape" +KERNEL=="pt*", NAME="%k", GROUP="tape" +KERNEL=="npt*", NAME="%k", GROUP="tape" +KERNEL=="st*", NAME="%k", GROUP="tape" +KERNEL=="nst*", NAME="%k", GROUP="tape" +KERNEL=="osst*", NAME="%k", GROUP="tape" +KERNEL=="nosst*", NAME="%k", GROUP="tape" # diskonkey devices -KERNEL="diskonkey*", NAME="%k", GROUP="disk" +KERNEL=="diskonkey*", NAME="%k", GROUP="disk" # rem_ide devices -KERNEL="microdrive*", NAME="%k", GROUP="disk" +KERNEL=="microdrive*", NAME="%k", GROUP="disk" # kbd devices -KERNEL="kbd", NAME="%k", MODE="0664" +KERNEL=="kbd", NAME="%k", MODE="0664" # Sony Vaio Jogdial sonypi device -KERNEL="sonypi", NAME="%k", MODE="0666" +KERNEL=="sonypi", NAME="%k", MODE="0666" # packet devices -KERNEL="pktcdvd", NAME="pktcdvd/control", GROUP="cdrw", MODE="0660" -KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" +KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrw", MODE="0660" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" # infiniband devices -KERNEL="umad*", NAME="infiniband/%k" -KERNEL="issm*", NAME="infiniband/%k" +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" # tpm devices -KERNEL="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" +KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" + +# firewire devices +KERNEL="raw1394", NAME="%k" +KERNEL="dv1394*", NAME="dv1394/%n" +KERNEL="video1394*", NAME="video1394/%n" # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems -# run hotplug.d stuff only if we came from a hotplug event, not for udevstart +# run hotplug.d/ stuff only if we came from a hotplug event, not for udevstart ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" -# always run etc.d stuff for now. -RUN += "/sbin/udev_run_devd" +# always run dev.d/ stuff for now. +RUN+="/sbin/udev_run_devd" + -- cgit v1.2.3-54-g00ecf From ffd5c6893756af43daf2a9a30bdcff13784a1ec4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Jul 2005 14:31:17 +0200 Subject: allow OPTIONS to be recognized for /sys/modules /sys/devices events Signed-off-by: Kay Sievers --- udev_rules.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 9606f04d3d..cd60c6d1ff 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1089,9 +1089,6 @@ int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device) break; dbg("process rule"); - if (rule->run_operation == KEY_OP_UNSET) - continue; - if (rule->name_operation != KEY_OP_UNSET || rule->symlink_operation != KEY_OP_UNSET || rule->mode != 0000 || rule->owner[0] != '\0' || rule->group[0] != '\0') { dbg("skip rule that names a device"); -- cgit v1.2.3-54-g00ecf From c44563817a9eea73a5fac914dd7bd7aa4cbcdbb6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Jul 2005 14:32:22 +0200 Subject: fake also kernel-name if we renamed a netif Signed-off-by: Kay Sievers --- udev_add.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_add.c b/udev_add.c index 89af96570f..e9ae150180 100644 --- a/udev_add.c +++ b/udev_add.c @@ -290,6 +290,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) if (retval != 0) goto exit; + info("renamed netif to '%s'", udev->name); /* we've changed the name, now fake the devpath, cause the * original kernel name sleeps with the fishes and we don't * get an event from the kernel with the new name @@ -298,6 +299,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) if (pos != NULL) { pos[1] = '\0'; strlcat(udev->devpath, udev->name, sizeof(udev->devpath)); + strlcpy(udev->kernel_name, udev->name, sizeof(udev->kernel_name)); setenv("DEVPATH", udev->devpath, 1); setenv("INTERFACE", udev->name, 1); } -- cgit v1.2.3-54-g00ecf From 8deae6aa342cae01f75a5a269e1a49fdd6de6cc8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Jul 2005 16:11:17 +0200 Subject: add IEEE1394 rules to the gentoo rule file --- etc/udev/gentoo/udev.rules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 7136f6a4bb..de74c088f0 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -243,10 +243,10 @@ KERNEL=="issm*", NAME="infiniband/%k" # tpm devices KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" -# firewire devices -KERNEL="raw1394", NAME="%k" -KERNEL="dv1394*", NAME="dv1394/%n" -KERNEL="video1394*", NAME="video1394/%n" +# IEEE1394 (firewire) devices +KERNEL=="raw1394", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems # run hotplug.d/ stuff only if we came from a hotplug event, not for udevstart -- cgit v1.2.3-54-g00ecf From 7618e112b44e1ea3b7d0fa790eff9fbab452ae4f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 4 Jul 2005 17:02:25 +0200 Subject: add usb_id program to generate usb-storage device identifiers Signed-off-by: Hannes Reinecke --- extras/usb_id/Makefile | 53 +++++ extras/usb_id/usb_id.c | 480 +++++++++++++++++++++++++++++++++++++++++++++ test/simple-build-check.sh | 8 +- 3 files changed, 540 insertions(+), 1 deletion(-) create mode 100644 extras/usb_id/Makefile create mode 100644 extras/usb_id/usb_id.c diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile new file mode 100644 index 0000000000..4324f95c76 --- /dev/null +++ b/extras/usb_id/Makefile @@ -0,0 +1,53 @@ +# Makefile for usb_id +# +# Copyright (C) 2005 Kay Sievers +# +# 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. +# + +PROG = usb_id + +all: $(PROG) + +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin +mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +override CFLAGS+=-D_FILE_OFFSET_BITS=64 + +OBJS = $(PROG).o $(VOLUME_ID_OBJS) ../../udev.a ../../libsysfs/sysfs.a +HEADERS = + +$(OBJS): $(HEADERS) + +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + +$(PROG): $(OBJS) $(HEADERS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + +install: all + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + +uninstall: + - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c new file mode 100644 index 0000000000..bca80f8de1 --- /dev/null +++ b/extras/usb_id/usb_id.c @@ -0,0 +1,480 @@ +/* + * usb_id.c + * + * Identify an USB (block) device + * + * Copyright (c) 2005 SUSE Linux Products GmbH, Germany + * Author: + * Hannes Reinecke + * + * This library is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of the + * License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +#include +#include +#include +#include +#include +#include +#include + +#include <../../libsysfs/sysfs/libsysfs.h> +#include "../../udev_utils.h" +#include "../../logging.h" + +#define MAX_NAME_LEN 72 +#define MAX_SERIAL_LEN 256 +#define BLKGETSIZE64 _IOR(0x12,114,size_t) + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +char sysfs_mnt_path[SYSFS_PATH_MAX]; +static char vendor_str[64]; +static char model_str[64]; +static char serial_str[MAX_SERIAL_LEN]; +static char revision_str[16]; +static char type_str[16]; + +static int use_usb_info; +static int export; + +static void set_str(char *to, const unsigned char *from, int count) +{ + int i, j; + int len; + + /* strip trailing whitespace */ + len = strnlen(from, count); + while (isspace(from[len-1])) + len--; + + /* strip leading whitespace */ + i = 0; + while (isspace(from[i]) && (i < len)) + i++; + + j = 0; + while (i < len) { + /* substitute multiple whitespace */ + if (isspace(from[i])) { + while (isspace(from[i])) + i++; + to[j++] = '_'; + } + /* Replace '/' with '.' */ + if (from[i] == '/') { + to[j++] = '.'; + i++; + continue; + } + /* skip non-printable chars */ + if (!isalnum(from[i]) && !ispunct(from[i])) { + i++; + continue; + } + to[j++] = from[i++]; + } + to[j] = '\0'; +} + +/* + * set_usb_iftype + * + * Set the type based on the USB interface class + */ +static void set_usb_iftype(char *to, const char *from, int count) +{ + int type_num; + char *eptr; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 1: + sprintf(to, "audio"); + break; + case 3: + sprintf(to, "hid"); + break; + case 7: + sprintf(to, "printer"); + break; + case 8: + sprintf(to, "disk"); + break; + case 2: /* CDC-Control */ + case 5: /* Physical */ + case 6: /* Image */ + case 9: /* HUB */ + case 0x0a: /* CDC-Data */ + case 0x0b: /* Chip/Smart Card */ + case 0x0d: /* Content Security */ + case 0x0e: /* Video */ + case 0xdc: /* Diagnostic Device */ + case 0xe0: /* Wireless Controller */ + case 0xf2: /* Application-specific */ + case 0xff: /* Vendor-specific */ + default: + sprintf(to, "generic"); + break; + } + } else { + sprintf(to, "generic"); + } +} + +/* + * set_usb_ifsybtype + * + * Set the type base on the interfaceSubClass. + * Valid for Mass-Storage devices (type 8) only. + */ +static int set_usb_ifsubtype(char *to, const char *from, int count) +{ + int type_num = 0; + char *eptr; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 2: + sprintf(to, "cd"); + break; + case 3: + sprintf(to, "tape"); + break; + case 4: /* UFI */ + case 5: /* SFF-8070i */ + sprintf(to, "floppy"); + break; + case 1: /* RBC devices */ + case 6: /* Transparent SPC-2 devices */ + sprintf(to, "disk"); + break; + } + } else { + sprintf(to, "generic"); + } + + return type_num; +} + +static void set_scsi_type(char *to, const char *from, int count) +{ + int type_num; + char *eptr; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 0: + sprintf(to, "disk"); + break; + case 1: + sprintf(to, "tape"); + break; + case 4: + sprintf(to, "optical"); + break; + case 5: + sprintf(to, "cd"); + break; + case 7: + sprintf(to, "optical"); + break; + case 0xe: + sprintf(to, "disk"); + break; + case 0xf: + sprintf(to, "optical"); + break; + default: + sprintf(to, "generic"); + break; + } + } else { + sprintf(to, "generic"); + } +} + +/* + * A unique USB identification is generated like this: + * + * 1.) Get the USB device type from DeviceClass, InterfaceClass + * and InterfaceSubClass + * 2.) If the device type is 'Mass-Storage/SPC-2' or 'Mass-Storage/RBC' + * use the SCSI vendor and model as USB-Vendor and USB-model. + * 3.) Otherwise use the USB manufacturer and product as + * USB-Vendor and USB-model. Any non-printable characters + * in those strings will be skipped; a slash '/' will be converted + * into a full stop '.'. + * 4.) If that fails, too, we will use idVendor and idProduct + * as USB-Vendor and USB-model. + * 5.) The USB identification is the USB-vendor and USB-model + * string concatenated with an underscore '_'. + * 6.) If the device supplies a serial number, this number + * is concatenated with the identification with an underscore '_'. + */ +static int usb_id(const char *target_path) +{ + struct sysfs_class_device *class_dev; /* of target_path */ + struct sysfs_class_device *class_dev_parent; /* for partitions */ + struct sysfs_device *scsi_dev; /* the scsi_device */ + struct sysfs_device *target_dev; + struct sysfs_device *host_dev, *interface_dev, *usb_dev; + struct sysfs_attribute *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; + struct sysfs_attribute *usb_model, *usb_vendor, *usb_rev, *usb_serial; + struct sysfs_attribute *if_class, *if_subclass; + int if_class_num; + int protocol = 0; + + class_dev = sysfs_open_class_device_path(target_path); + if (!class_dev) { + info("open class %s failed: %s", target_path, strerror(errno)); + return 1; + } + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent) { + scsi_dev = sysfs_get_classdev_device(class_dev_parent); + } else { + scsi_dev = sysfs_get_classdev_device(class_dev); + } + + /* + * The close of scsi_dev will close class_dev or class_dev_parent. + */ + + /* + * We assume we are called after the device is completely ready, + * so we don't have to loop here like udev. (And we are usually + * called via udev.) + */ + if (!scsi_dev) { + /* + * errno is not set if we can't find the device link, so + * don't print it out here. + */ + info("Cannot find sysfs device associated with %s", target_path); + return 1; + } + + /* + * Allow only scsi devices. + * + * Other block devices can support SG IO, but only ide-cd does, so + * for now, don't bother with anything else. + */ + if (strcmp(scsi_dev->bus, "scsi") != 0) { + info("%s is not a scsi device", target_path); + return 1; + } + + /* target directory */ + target_dev = sysfs_get_device_parent(scsi_dev); + /* host directory */ + host_dev = sysfs_get_device_parent(target_dev); + /* usb interface directory */ + interface_dev = sysfs_get_device_parent(host_dev); + /* usb device directory */ + usb_dev = sysfs_get_device_parent(interface_dev); + + if (!strcmp(interface_dev->bus, "bus") != 0) { + info("%s is not an usb device", target_path); + return 1; + } + + if_class = sysfs_get_device_attr(interface_dev, "bInterfaceClass"); + if (!if_class) { + info("%s: cannot get bInterfaceClass attribute", interface_dev->name); + return -1; + } + if_class_num = strtoul(if_class->value, NULL, 16); + if (if_class_num != 8) { + set_usb_iftype(type_str, if_class->value, sizeof(type_str) - 1); + } else { + if_subclass = sysfs_get_device_attr(interface_dev, + "bInterfaceSubClass"); + protocol = set_usb_ifsubtype(type_str, if_subclass->value, + sizeof(type_str) -1 ); + } + + if (!use_usb_info && protocol == 6) { + /* Generic SPC-2 device */ + scsi_vendor = sysfs_get_device_attr(scsi_dev, "vendor"); + if (!scsi_vendor) { + info("%s: cannot get vendor attribute", scsi_dev->name); + return -1; + } + set_str(vendor_str, scsi_vendor->value, sizeof(vendor_str)-1); + + scsi_model = sysfs_get_device_attr(scsi_dev, "model"); + if (!scsi_model) { + info("%s: cannot get model attribute", scsi_dev->name); + return -1; + } + set_str(model_str, scsi_model->value, sizeof(model_str)-1); + + scsi_type = sysfs_get_device_attr(scsi_dev, "type"); + if (!scsi_type) { + info("%s: cannot get type attribute", scsi_dev->name); + return -1; + } + set_scsi_type(type_str, scsi_type->value, sizeof(type_str)-1); + + scsi_rev = sysfs_get_device_attr(scsi_dev, "rev"); + if (!scsi_rev) { + info("%s: cannot get type attribute", scsi_dev->name); + return -1; + } + set_str(revision_str, scsi_rev->value, sizeof(revision_str)-1); + + } + + /* Fallback to USB vendor & device */ + if (vendor_str[0] == '\0') { + usb_vendor = sysfs_get_device_attr(usb_dev, "manufacturer"); + if (!usb_vendor) { + dbg("No USB vendor string found, using idVendor"); + usb_vendor = sysfs_get_device_attr(usb_dev, "idVendor"); + } + set_str(vendor_str,usb_vendor->value, sizeof(vendor_str) - 1); + } + + if (model_str[0] == '\0') { + usb_model = sysfs_get_device_attr(usb_dev, "product"); + if (!usb_model) { + dbg("No USB model string found, using idProduct"); + usb_model = sysfs_get_device_attr(usb_dev, "idProduct"); + } + set_str(model_str, usb_model->value, sizeof(model_str) - 1); + } + + if (revision_str[0] == '\0') { + usb_rev = sysfs_get_device_attr(usb_dev, "bcdDevice"); + if (usb_rev) { + set_str(revision_str, usb_rev->value, + sizeof(revision_str) - 1); + } + } + + if (serial_str[0] == '\0') { + usb_serial = sysfs_get_device_attr(usb_dev, "serial"); + if (usb_serial) { + set_str(serial_str, usb_serial->value, + sizeof(serial_str) - 1); + } + } + return 0; +} + +int main(int argc, char **argv) +{ + int retval; + char *devpath; + char target_path[MAX_NAME_LEN]; + int option; + + dbg("argc is %d", argc); + if (sysfs_get_mnt_path(sysfs_mnt_path, MAX_NAME_LEN)) { + info("sysfs_get_mnt_path failed: %s", + strerror(errno)); + exit(1); + } + + while ((option = getopt(argc, argv, "ux")) != -1 ) { + if (optarg) + dbg("option '%c' arg '%s'", option, optarg); + else + dbg("option '%c'", option); + + switch (option) { + case 'u': + use_usb_info=1; + break; + case 'x': + export=1; + break; + default: + info("Unknown or bad option '%c' (0x%x)", option, option); + retval = -1; + break; + } + } + + devpath = getenv("DEVPATH"); + if (devpath) { + strncpy(target_path, sysfs_mnt_path, MAX_NAME_LEN); + strncat(target_path, devpath, MAX_NAME_LEN); + } else { + if (optind == argc) { + fprintf(stderr, "No device specified\n"); + exit(1); + } + devpath = argv[optind]; + strncpy(target_path, devpath, MAX_NAME_LEN); + } + + retval = usb_id(target_path); + + if (export) { + printf("ID_VENDOR=%s\n", vendor_str); + printf("ID_MODEL=%s\n", model_str); + printf("ID_REVISION=%s\n", revision_str); + if (serial_str[0] == '\0') { + printf("ID_SERIAL=%s_%s\n", + vendor_str, model_str); + } else { + printf("ID_SERIAL=%s_%s_%s\n", + vendor_str, model_str, serial_str); + } + printf("ID_TYPE=%s\n", type_str); + } else { + if (serial_str[0] == '\0') { + printf("%s_%s\n", + vendor_str, model_str); + } else { + printf("%s_%s_%s\n", + vendor_str, model_str, serial_str); + } + } + exit(retval); +} + + + diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index b5a0dcdaa1..c5b429d98d 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -1,6 +1,12 @@ #/bin/sh -EXTRAS="extras/chassis_id extras/scsi_id extras/ata_id extras/volume_id extras/run_directory" +EXTRAS="\ + extras/chassis_id \ + extras/scsi_id \ + extras/ata_id \ + extras/volume_id \ + extras/usb_id \ + extras/run_directory" [ -z "$KERNEL_DIR" ] && KERNEL_DIR=/lib/modules/`uname -r`/build echo KERNEL_DIR: "$KERNEL_DIR" -- cgit v1.2.3-54-g00ecf From a0e5382d66567cc91c1a1f571e9fb5288106e876 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 4 Jul 2005 19:44:25 +0200 Subject: move rule matches to function Signed-off-by: Kay Sievers --- udev_rules.c | 186 ++++++++++++++--------------------------------------- udev_rules.h | 2 +- udev_rules_parse.c | 6 +- udevrulescompile.c | 2 +- 4 files changed, 53 insertions(+), 143 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index cd60c6d1ff..117ffdc2d0 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -599,70 +599,44 @@ found: } } +static int match_key(const char *key, const char *key_val, enum key_operation key_op, const char *val) +{ + int match; + + if (key_op == KEY_OP_UNSET) + return 0; + + dbg("check for %s '%s' <-> '%s'", key, key_val, val); + match = (strcmp_pattern(key_val, val) == 0); + if (match && (key_op != KEY_OP_NOMATCH)) { + dbg("%s key is matching (matching value)", key); + return 0; + } + if (!match && (key_op == KEY_OP_NOMATCH)) { + dbg("%s key is matching, (non matching value)", key); + return 0; + } + + dbg("%s key is not matching", key); + return -1; +} + static int match_rule(struct udevice *udev, struct udev_rule *rule, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { struct sysfs_device *parent_device = sysfs_device; - if (rule->action_operation != KEY_OP_UNSET) { - dbg("check for " KEY_ACTION " rule->action='%s' udev->action='%s'", - rule->action, udev->action); - if (strcmp_pattern(rule->action, udev->action) != 0) { - dbg(KEY_ACTION " is not matching"); - if (rule->action_operation != KEY_OP_NOMATCH) - goto exit; - } else { - dbg(KEY_ACTION " matches"); - if (rule->action_operation == KEY_OP_NOMATCH) - goto exit; - } - dbg(KEY_ACTION " key is true"); - } + if (match_key(KEY_ACTION, rule->action, rule->action_operation, udev->action)) + goto exit; - if (rule->kernel_operation != KEY_OP_UNSET) { - dbg("check for " KEY_KERNEL " rule->kernel='%s' udev_kernel_name='%s'", - rule->kernel, udev->kernel_name); - if (strcmp_pattern(rule->kernel, udev->kernel_name) != 0) { - dbg(KEY_KERNEL " is not matching"); - if (rule->kernel_operation != KEY_OP_NOMATCH) - goto exit; - } else { - dbg(KEY_KERNEL " matches"); - if (rule->kernel_operation == KEY_OP_NOMATCH) - goto exit; - } - dbg(KEY_KERNEL " key is true"); - } + if (match_key(KEY_KERNEL, rule->kernel_name, rule->kernel_operation, udev->kernel_name)) + goto exit; - if (rule->subsystem_operation != KEY_OP_UNSET) { - dbg("check for " KEY_SUBSYSTEM " rule->subsystem='%s' udev->subsystem='%s'", - rule->subsystem, udev->subsystem); - if (strcmp_pattern(rule->subsystem, udev->subsystem) != 0) { - dbg(KEY_SUBSYSTEM " is not matching"); - if (rule->subsystem_operation != KEY_OP_NOMATCH) - goto exit; - } else { - dbg(KEY_SUBSYSTEM " matches"); - if (rule->subsystem_operation == KEY_OP_NOMATCH) - goto exit; - } - dbg(KEY_SUBSYSTEM " key is true"); - } + if (match_key(KEY_SUBSYSTEM, rule->subsystem, rule->subsystem_operation, udev->subsystem)) + goto exit; - if (rule->devpath_operation != KEY_OP_UNSET) { - dbg("check for " KEY_DEVPATH " rule->devpath='%s' udev->devpath='%s'", - rule->devpath, udev->devpath); - if (strcmp_pattern(rule->devpath, udev->devpath) != 0) { - dbg(KEY_DEVPATH " is not matching"); - if (rule->devpath_operation != KEY_OP_NOMATCH) - goto exit; - } else { - dbg(KEY_DEVPATH " matches"); - if (rule->devpath_operation == KEY_OP_NOMATCH) - goto exit; - } - dbg(KEY_DEVPATH " key is true"); - } + if (match_key(KEY_DEVPATH, rule->devpath, rule->devpath_operation, udev->devpath)) + goto exit; if (rule->modalias_operation != KEY_OP_UNSET) { char value[NAME_SIZE]; @@ -671,18 +645,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg(KEY_MODALIAS " value not found"); goto exit; } - dbg("check for " KEY_MODALIAS " rule->modalias='%s' modalias='%s'", - rule->modalias, value); - if (strcmp_pattern(rule->modalias, value) != 0) { - dbg(KEY_MODALIAS " is not matching"); - if (rule->modalias_operation != KEY_OP_NOMATCH) - goto exit; - } else { - dbg(KEY_MODALIAS " matches"); - if (rule->modalias_operation == KEY_OP_NOMATCH) - goto exit; - } - dbg(KEY_MODALIAS " key is true"); + if (match_key(KEY_MODALIAS, rule->modalias, rule->modalias_operation, value)) + goto exit; } if (rule->env_pair_count) { @@ -699,17 +663,11 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg(KEY_ENV "{'%s'} is not found", pair->name); goto exit; } - if (strcmp_pattern(pair->value, value) != 0) { - dbg(KEY_ENV "{'%s'} is not matching", pair->name); - if (pair->operation != KEY_OP_NOMATCH) - goto exit; - } else { - dbg(KEY_ENV "{'%s'} matches", pair->name); - if (pair->operation == KEY_OP_NOMATCH) - goto exit; - } + dbg("check %i " KEY_ENV " keys", rule->env_pair_count); + if (match_key(pair->name, pair->value, pair->operation, value)) + goto exit; } - dbg(KEY_ENV " key is true"); + dbg("all %i " KEY_ENV " keys matched", rule->env_pair_count); } /* walk up the chain of physical devices and find a match */ @@ -720,18 +678,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("device has no sysfs_device"); goto exit; } - dbg("check for " KEY_DRIVER " rule->driver='%s' sysfs_device->driver_name='%s'", - rule->driver, parent_device->driver_name); - if (strcmp_pattern(rule->driver, parent_device->driver_name) != 0) { - dbg(KEY_DRIVER " is not matching"); - if (rule->driver_operation != KEY_OP_NOMATCH) - goto try_parent; - } else { - dbg(KEY_DRIVER " matches"); - if (rule->driver_operation == KEY_OP_NOMATCH) - goto try_parent; - } - dbg(KEY_DRIVER " key is true"); + if (match_key(KEY_BUS, rule->driver, rule->driver_operation, parent_device->driver_name)) + goto try_parent; } /* check for matching bus value */ @@ -740,18 +688,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("device has no sysfs_device"); goto exit; } - dbg("check for " KEY_BUS " rule->bus='%s' sysfs_device->bus='%s'", - rule->bus, parent_device->bus); - if (strcmp_pattern(rule->bus, parent_device->bus) != 0) { - dbg(KEY_BUS " is not matching"); - if (rule->bus_operation != KEY_OP_NOMATCH) - goto try_parent; - } else { - dbg(KEY_BUS " matches"); - if (rule->bus_operation == KEY_OP_NOMATCH) - goto try_parent; - } - dbg(KEY_BUS " key is true"); + if (match_key(KEY_BUS, rule->bus, rule->bus_operation, parent_device->bus)) + goto try_parent; } /* check for matching bus id */ @@ -760,17 +698,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("device has no sysfs_device"); goto exit; } - dbg("check " KEY_ID); - if (strcmp_pattern(rule->id, parent_device->bus_id) != 0) { - dbg(KEY_ID " is not matching"); - if (rule->id_operation != KEY_OP_NOMATCH) - goto try_parent; - } else { - dbg(KEY_ID " matches"); - if (rule->id_operation == KEY_OP_NOMATCH) - goto try_parent; - } - dbg(KEY_ID " key is true"); + if (match_key(KEY_ID, rule->id, rule->id_operation, parent_device->bus_id)) + goto try_parent; } /* check for matching sysfs pairs */ @@ -796,18 +725,11 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("removed %zi trailing whitespace chars from '%s'", strlen(value)-len, value); } - dbg("compare attribute '%s' value '%s' with '%s'", pair->name, value, pair->value); - if (strcmp_pattern(pair->value, value) != 0) { - dbg(KEY_SYSFS "{'%s'} is not matching", pair->name); - if (pair->operation != KEY_OP_NOMATCH) - goto try_parent; - } else { - dbg(KEY_SYSFS "{'%s'} matches", pair->name); - if (pair->operation == KEY_OP_NOMATCH) - goto try_parent; - } + dbg("check %i " KEY_SYSFS " keys", rule->sysfs_pair_count); + if (match_key(pair->name, pair->value, pair->operation, value)) + goto try_parent; } - dbg(KEY_SYSFS " keys are true"); + dbg("all %i " KEY_SYSFS " keys matched", rule->sysfs_pair_count); } /* found matching physical device */ @@ -871,20 +793,8 @@ try_parent: } /* check for matching result of external program */ - if (rule->result_operation != KEY_OP_UNSET) { - dbg("check for " KEY_RESULT " rule->result='%s', udev->program_result='%s'", - rule->result, udev->program_result); - if (strcmp_pattern(rule->result, udev->program_result) != 0) { - dbg(KEY_RESULT " is not matching"); - if (rule->result_operation != KEY_OP_NOMATCH) - goto exit; - } else { - dbg(KEY_RESULT " matches"); - if (rule->result_operation == KEY_OP_NOMATCH) - goto exit; - } - dbg(KEY_RESULT " key is true"); - } + if (match_key(KEY_RESULT, rule->result, rule->result_operation, udev->program_result)) + goto exit; /* rule matches */ return 0; diff --git a/udev_rules.h b/udev_rules.h index bad8406cf4..14e40abc2c 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -77,7 +77,7 @@ struct key_pair { struct udev_rule { struct list_head node; - char kernel[NAME_SIZE]; + char kernel_name[NAME_SIZE]; enum key_operation kernel_operation; char subsystem[NAME_SIZE]; enum key_operation subsystem_operation; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 929a5e6f4c..4bc00dda5a 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -87,12 +87,12 @@ static int add_rule_to_list(struct udev_rule *rule) dbg("name='%s', symlink='%s', bus='%s', id='%s', " "sysfs_file[0]='%s', sysfs_value[0]='%s', " - "kernel='%s', program='%s', result='%s', " + "kernel_name='%s', program='%s', result='%s', " "owner='%s', group='%s', mode=%#o, " "all_partions=%u, ignore_remove=%u, ignore_device=%u, last_rule=%u", rule->name, rule->symlink, rule->bus, rule->id, rule->sysfs_pair[0].name, rule->sysfs_pair[0].value, - rule->kernel, rule->program, rule->result, rule->owner, rule->group, rule->mode, + rule->kernel_name, rule->program, rule->result, rule->owner, rule->group, rule->mode, rule->partitions, rule->ignore_remove, rule->ignore_device, rule->last_rule); return 0; @@ -285,7 +285,7 @@ static int rules_parse(const char *filename) break; if (strcasecmp(key, KEY_KERNEL) == 0) { - strlcpy(rule.kernel, value, sizeof(rule.kernel)); + strlcpy(rule.kernel_name, value, sizeof(rule.kernel_name)); rule.kernel_operation = operation; valid = 1; continue; diff --git a/udevrulescompile.c b/udevrulescompile.c index ff9dd79fd4..9162a16327 100644 --- a/udevrulescompile.c +++ b/udevrulescompile.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[], char *envp[]) sprintf(rule->group, "%li", gid); } - dbg("kernel='%s' name='%s'", rule->kernel, rule->name); + dbg("kernel_name='%s' name='%s'", rule->kernel_name, rule->name); fwrite(rule, sizeof(struct udev_rule), 1, f); } -- cgit v1.2.3-54-g00ecf From 6369839195d7572151d986ddc2050162e6879585 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 4 Jul 2005 20:42:04 +0200 Subject: replace useless defines by inline text Signed-off-by: Kay Sievers --- udev_rules.c | 50 +++++++++++++++++----------------- udev_rules.h | 27 ------------------- udev_rules_parse.c | 78 +++++++++++++++++++++++++++--------------------------- 3 files changed, 63 insertions(+), 92 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 117ffdc2d0..48e22ad3e8 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -626,33 +626,32 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, { struct sysfs_device *parent_device = sysfs_device; - if (match_key(KEY_ACTION, rule->action, rule->action_operation, udev->action)) + if (match_key("ACTION", rule->action, rule->action_operation, udev->action)) goto exit; - if (match_key(KEY_KERNEL, rule->kernel_name, rule->kernel_operation, udev->kernel_name)) + if (match_key("KERNEL", rule->kernel_name, rule->kernel_operation, udev->kernel_name)) goto exit; - if (match_key(KEY_SUBSYSTEM, rule->subsystem, rule->subsystem_operation, udev->subsystem)) + if (match_key("SUBSYSTEM", rule->subsystem, rule->subsystem_operation, udev->subsystem)) goto exit; - if (match_key(KEY_DEVPATH, rule->devpath, rule->devpath_operation, udev->devpath)) + if (match_key("DEVPATH", rule->devpath, rule->devpath_operation, udev->devpath)) goto exit; if (rule->modalias_operation != KEY_OP_UNSET) { char value[NAME_SIZE]; if (find_sysfs_attribute(NULL, sysfs_device, "modalias", value, sizeof(value)) != 0) { - dbg(KEY_MODALIAS " value not found"); + dbg("MODALIAS value not found"); goto exit; } - if (match_key(KEY_MODALIAS, rule->modalias, rule->modalias_operation, value)) + if (match_key("MODALIAS", rule->modalias, rule->modalias_operation, value)) goto exit; } if (rule->env_pair_count) { int i; - dbg("check for " KEY_ENV " pairs"); for (i = 0; i < rule->env_pair_count; i++) { struct key_pair *pair; const char *value; @@ -660,14 +659,14 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, pair = &rule->env_pair[i]; value = getenv(pair->name); if (!value) { - dbg(KEY_ENV "{'%s'} is not found", pair->name); + dbg("ENV{'%s'} is not found", pair->name); goto exit; } - dbg("check %i " KEY_ENV " keys", rule->env_pair_count); + dbg("check %i ENV keys", rule->env_pair_count); if (match_key(pair->name, pair->value, pair->operation, value)) goto exit; } - dbg("all %i " KEY_ENV " keys matched", rule->env_pair_count); + dbg("all %i ENV keys matched", rule->env_pair_count); } /* walk up the chain of physical devices and find a match */ @@ -678,7 +677,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("device has no sysfs_device"); goto exit; } - if (match_key(KEY_BUS, rule->driver, rule->driver_operation, parent_device->driver_name)) + if (match_key("DRIVER", rule->driver, rule->driver_operation, parent_device->driver_name)) goto try_parent; } @@ -688,7 +687,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("device has no sysfs_device"); goto exit; } - if (match_key(KEY_BUS, rule->bus, rule->bus_operation, parent_device->bus)) + if (match_key("BUS", rule->bus, rule->bus_operation, parent_device->bus)) goto try_parent; } @@ -698,7 +697,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("device has no sysfs_device"); goto exit; } - if (match_key(KEY_ID, rule->id, rule->id_operation, parent_device->bus_id)) + if (match_key("ID", rule->id, rule->id_operation, parent_device->bus_id)) goto try_parent; } @@ -706,7 +705,6 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, if (rule->sysfs_pair_count) { int i; - dbg("check " KEY_SYSFS " pairs"); for (i = 0; i < rule->sysfs_pair_count; i++) { struct key_pair *pair; char value[VALUE_SIZE]; @@ -725,11 +723,11 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("removed %zi trailing whitespace chars from '%s'", strlen(value)-len, value); } - dbg("check %i " KEY_SYSFS " keys", rule->sysfs_pair_count); + dbg("check %i SYSFS keys", rule->sysfs_pair_count); if (match_key(pair->name, pair->value, pair->operation, value)) goto try_parent; } - dbg("all %i " KEY_SYSFS " keys matched", rule->sysfs_pair_count); + dbg("all %i SYSFS keys matched", rule->sysfs_pair_count); } /* found matching physical device */ @@ -750,7 +748,7 @@ try_parent: strlcpy(import, rule->import, sizeof(import)); apply_format(udev, import, sizeof(import), class_dev, sysfs_device); - dbg("check for " KEY_IMPORT " import='%s'", import); + dbg("check for IMPORT import='%s'", import); if (rule->import_exec) { dbg("run executable file import='%s'", import); rc = import_program_into_env(udev, import); @@ -759,12 +757,12 @@ try_parent: rc = import_file_into_env(udev, import); } if (rc) { - dbg(KEY_IMPORT " failed"); + dbg("IMPORT failed"); if (rule->import_operation != KEY_OP_NOMATCH) goto exit; } else - dbg(KEY_IMPORT " '%s' imported", rule->import); - dbg(KEY_IMPORT " key is true"); + dbg("IMPORT '%s' imported", rule->import); + dbg("IMPORT key is true"); } /* execute external program */ @@ -774,26 +772,26 @@ try_parent: strlcpy(program, rule->program, sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - dbg("check for " KEY_PROGRAM " program='%s", program); + dbg("check for PROGRAM program='%s", program); if (execute_program(program, udev->subsystem, result, sizeof(result), NULL) != 0) { - dbg(KEY_PROGRAM " is not matching"); + dbg("PROGRAM is not matching"); if (rule->program_operation != KEY_OP_NOMATCH) goto exit; } else { - dbg(KEY_PROGRAM " matches"); + dbg("PROGRAM matches"); remove_trailing_char(result, '\n'); replace_untrusted_chars(result); dbg("result is '%s'", result); strlcpy(udev->program_result, result, sizeof(udev->program_result)); - dbg(KEY_PROGRAM " returned successful"); + dbg("PROGRAM returned successful"); if (rule->program_operation == KEY_OP_NOMATCH) goto exit; } - dbg(KEY_PROGRAM " key is true"); + dbg("PROGRAM key is true"); } /* check for matching result of external program */ - if (match_key(KEY_RESULT, rule->result, rule->result_operation, udev->program_result)) + if (match_key("RESULT", rule->result, rule->result_operation, udev->program_result)) goto exit; /* rule matches */ diff --git a/udev_rules.h b/udev_rules.h index 14e40abc2c..fb77509cce 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -27,33 +27,6 @@ #include "udev.h" #include "list.h" - -#define KEY_KERNEL "KERNEL" -#define KEY_SUBSYSTEM "SUBSYSTEM" -#define KEY_ACTION "ACTION" -#define KEY_DEVPATH "DEVPATH" -#define KEY_BUS "BUS" -#define KEY_ID "ID" -#define KEY_PROGRAM "PROGRAM" -#define KEY_RESULT "RESULT" -#define KEY_DRIVER "DRIVER" -#define KEY_SYSFS "SYSFS" -#define KEY_ENV "ENV" -#define KEY_MODALIAS "MODALIAS" -#define KEY_IMPORT "IMPORT" -#define KEY_NAME "NAME" -#define KEY_SYMLINK "SYMLINK" -#define KEY_OWNER "OWNER" -#define KEY_GROUP "GROUP" -#define KEY_MODE "MODE" -#define KEY_RUN "RUN" -#define KEY_OPTIONS "OPTIONS" - -#define OPTION_LAST_RULE "last_rule" -#define OPTION_IGNORE_DEVICE "ignore_device" -#define OPTION_IGNORE_REMOVE "ignore_remove" -#define OPTION_PARTITIONS "all_partitions" - #define KEY_SYSFS_PAIRS_MAX 5 #define KEY_ENV_PAIRS_MAX 5 diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 4bc00dda5a..cf69783c2d 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -284,59 +284,59 @@ static int rules_parse(const char *filename) if (retval) break; - if (strcasecmp(key, KEY_KERNEL) == 0) { + if (strcasecmp(key, "KERNEL") == 0) { strlcpy(rule.kernel_name, value, sizeof(rule.kernel_name)); rule.kernel_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_SUBSYSTEM) == 0) { + if (strcasecmp(key, "SUBSYSTEM") == 0) { strlcpy(rule.subsystem, value, sizeof(rule.subsystem)); rule.subsystem_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_ACTION) == 0) { + if (strcasecmp(key, "ACTION") == 0) { strlcpy(rule.action, value, sizeof(rule.action)); rule.action_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_DEVPATH) == 0) { + if (strcasecmp(key, "DEVPATH") == 0) { strlcpy(rule.devpath, value, sizeof(rule.devpath)); rule.devpath_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_BUS) == 0) { + if (strcasecmp(key, "BUS") == 0) { strlcpy(rule.bus, value, sizeof(rule.bus)); rule.bus_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_ID) == 0) { + if (strcasecmp(key, "ID") == 0) { strlcpy(rule.id, value, sizeof(rule.id)); rule.id_operation = operation; valid = 1; continue; } - if (strncasecmp(key, KEY_SYSFS, sizeof(KEY_SYSFS)-1) == 0) { + if (strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) { struct key_pair *pair; if (rule.sysfs_pair_count >= KEY_SYSFS_PAIRS_MAX) { - err("skip rule, to many " KEY_SYSFS " keys in a single rule"); + err("skip rule, to many SYSFS keys in a single rule"); goto error; } pair = &rule.sysfs_pair[rule.sysfs_pair_count]; - attr = get_key_attribute(key + sizeof(KEY_SYSFS)-1); + attr = get_key_attribute(key + sizeof("SYSFS")-1); if (attr == NULL) { - err("error parsing " KEY_SYSFS " attribute"); + err("error parsing SYSFS attribute"); goto error; } strlcpy(pair->name, attr, sizeof(pair->name)); @@ -347,17 +347,17 @@ static int rules_parse(const char *filename) continue; } - if (strncasecmp(key, KEY_ENV, sizeof(KEY_ENV)-1) == 0) { + if (strncasecmp(key, "ENV", sizeof("ENV")-1) == 0) { struct key_pair *pair; if (rule.env_pair_count >= KEY_ENV_PAIRS_MAX) { - err("skip rule, to many " KEY_ENV " keys in a single rule"); + err("skip rule, to many ENV keys in a single rule"); goto error; } pair = &rule.env_pair[rule.env_pair_count]; - attr = get_key_attribute(key + sizeof(KEY_ENV)-1); + attr = get_key_attribute(key + sizeof("ENV")-1); if (attr == NULL) { - err("error parsing " KEY_ENV " attribute"); + err("error parsing ENV attribute"); continue; } strlcpy(pair->name, attr, sizeof(pair->name)); @@ -368,20 +368,20 @@ static int rules_parse(const char *filename) continue; } - if (strcasecmp(key, KEY_MODALIAS) == 0) { + if (strcasecmp(key, "MODALIAS") == 0) { strlcpy(rule.modalias, value, sizeof(rule.modalias)); rule.modalias_operation = operation; valid = 1; continue; } - if (strncasecmp(key, KEY_IMPORT, sizeof(KEY_IMPORT)-1) == 0) { - attr = get_key_attribute(key + sizeof(KEY_IMPORT)-1); + if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { + attr = get_key_attribute(key + sizeof("IMPORT")-1); if (attr && strstr(attr, "program")) { - dbg(KEY_IMPORT" will be executed"); + dbg("IMPORT will be executed"); rule.import_exec = 1; } else if (attr && strstr(attr, "file")) { - dbg(KEY_IMPORT" will be included as file"); + dbg("IMPORT will be included as file"); } else { /* figure it out if it is executable */ char file[PATH_SIZE]; @@ -392,9 +392,9 @@ static int rules_parse(const char *filename) pos = strchr(file, ' '); if (pos) pos[0] = '\0'; - dbg(KEY_IMPORT" auto mode for '%s'", file); + dbg("IMPORT auto mode for '%s'", file); if (!lstat(file, &stats) && (stats.st_mode & S_IXUSR)) { - dbg(KEY_IMPORT" is executable, will be executed"); + dbg("IMPORT is executable, will be executed"); rule.import_exec = 1; } } @@ -404,21 +404,21 @@ static int rules_parse(const char *filename) continue; } - if (strcasecmp(key, KEY_DRIVER) == 0) { + if (strcasecmp(key, "DRIVER") == 0) { strlcpy(rule.driver, value, sizeof(rule.driver)); rule.driver_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_RESULT) == 0) { + if (strcasecmp(key, "RESULT") == 0) { strlcpy(rule.result, value, sizeof(rule.result)); rule.result_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_PROGRAM) == 0) { + if (strcasecmp(key, "PROGRAM") == 0) { strlcpy(rule.program, value, sizeof(rule.program)); rule.program_operation = operation; program_given = 1; @@ -426,14 +426,14 @@ static int rules_parse(const char *filename) continue; } - if (strncasecmp(key, KEY_NAME, sizeof(KEY_NAME)-1) == 0) { - attr = get_key_attribute(key + sizeof(KEY_NAME)-1); + if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { + attr = get_key_attribute(key + sizeof("NAME")-1); if (attr != NULL) { - if (strstr(attr, OPTION_PARTITIONS) != NULL) { + if (strstr(attr, "all_partitions") != NULL) { dbg("creation of partition nodes requested"); rule.partitions = DEFAULT_PARTITIONS_COUNT; } - if (strstr(attr, OPTION_IGNORE_REMOVE) != NULL) { + if (strstr(attr, "ignore_remove") != NULL) { dbg("remove event should be ignored"); rule.ignore_remove = 1; } @@ -444,55 +444,55 @@ static int rules_parse(const char *filename) continue; } - if (strcasecmp(key, KEY_SYMLINK) == 0) { + if (strcasecmp(key, "SYMLINK") == 0) { strlcpy(rule.symlink, value, sizeof(rule.symlink)); rule.symlink_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_OWNER) == 0) { + if (strcasecmp(key, "OWNER") == 0) { strlcpy(rule.owner, value, sizeof(rule.owner)); rule.owner_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_GROUP) == 0) { + if (strcasecmp(key, "GROUP") == 0) { strlcpy(rule.group, value, sizeof(rule.group)); rule.group_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_MODE) == 0) { + if (strcasecmp(key, "MODE") == 0) { rule.mode = strtol(value, NULL, 8); rule.mode_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_RUN) == 0) { + if (strcasecmp(key, "RUN") == 0) { strlcpy(rule.run, value, sizeof(rule.run)); rule.run_operation = operation; valid = 1; continue; } - if (strcasecmp(key, KEY_OPTIONS) == 0) { - if (strstr(value, OPTION_LAST_RULE) != NULL) { + if (strcasecmp(key, "OPTIONS") == 0) { + if (strstr(value, "last_rule") != NULL) { dbg("last rule to be applied"); rule.last_rule = 1; } - if (strstr(value, OPTION_IGNORE_DEVICE) != NULL) { + if (strstr(value, "ignore_device") != NULL) { dbg("device should be ignored"); rule.ignore_device = 1; } - if (strstr(value, OPTION_IGNORE_REMOVE) != NULL) { + if (strstr(value, "ignore_remove") != NULL) { dbg("remove event should be ignored"); rule.ignore_remove = 1; } - if (strstr(value, OPTION_PARTITIONS) != NULL) { + if (strstr(value, "all_partitions") != NULL) { dbg("creation of partition nodes requested"); rule.partitions = DEFAULT_PARTITIONS_COUNT; } @@ -509,7 +509,7 @@ static int rules_parse(const char *filename) goto error; if ((rule.result[0] != '\0') && (program_given == 0)) { - info(KEY_RESULT " is only useful when " KEY_PROGRAM " is called in any rule before"); + info("RESULT is only useful when PROGRAM is called in any rule before"); goto error; } -- cgit v1.2.3-54-g00ecf From 8bd41f36f793f7fc208ef6beb4b2b84e35a5e728 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 5 Jul 2005 15:24:41 +0200 Subject: pack parsed rules list This cuts down our 600 rules file to 98 kb instead of 1.9 Mb memory or file-size with precompiled rules. Signed-off-by: Kay Sievers --- udev.c | 13 +- udev_rules.c | 246 ++++++++++---------- udev_rules.h | 113 +++++----- udev_rules_parse.c | 648 ++++++++++++++++++++++++++--------------------------- udevrulescompile.c | 42 +--- udevstart.c | 6 +- udevtest.c | 5 +- 7 files changed, 517 insertions(+), 556 deletions(-) diff --git a/udev.c b/udev.c index 1c55ec14b8..7a0484472a 100644 --- a/udev.c +++ b/udev.c @@ -68,6 +68,7 @@ static void asmlinkage sig_handler(int signum) int main(int argc, char *argv[], char *envp[]) { struct udevice udev; + struct udev_rules rules; char path[PATH_SIZE]; const char *error; const char *action; @@ -118,7 +119,7 @@ int main(int argc, char *argv[], char *envp[]) } udev_init_device(&udev, devpath, subsystem, action); - udev_rules_init(); + udev_rules_init(&rules, 0); if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS || udev.type == DEV_NET) { /* handle device node */ @@ -143,7 +144,7 @@ int main(int argc, char *argv[], char *envp[]) if (udev.type == DEV_NET || udev.devt) { /* name device */ - udev_rules_get_name(&udev, class_dev); + udev_rules_get_name(&rules, &udev, class_dev); if (udev.ignore_device) { info("device event will be ignored"); goto cleanup; @@ -157,7 +158,7 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_add_device(&udev, class_dev); } else { dbg("no dev-file found"); - udev_rules_get_run(&udev, NULL); + udev_rules_get_run(&rules, &udev, NULL); if (udev.ignore_device) { info("device event will be ignored"); goto cleanup; @@ -166,7 +167,7 @@ int main(int argc, char *argv[], char *envp[]) sysfs_close_class_device(class_dev); } else if (strcmp(action, "remove") == 0) { dbg("node remove"); - udev_rules_get_run(&udev, NULL); + udev_rules_get_run(&rules, &udev, NULL); if (udev.ignore_device) { dbg("device event will be ignored"); goto cleanup; @@ -193,7 +194,7 @@ int main(int argc, char *argv[], char *envp[]) } dbg("devices device opened '%s'", path); wait_for_devices_device(devices_dev, &error); - udev_rules_get_run(&udev, devices_dev); + udev_rules_get_run(&rules, &udev, devices_dev); sysfs_close_device(devices_dev); if (udev.ignore_device) { info("device event will be ignored"); @@ -201,7 +202,7 @@ int main(int argc, char *argv[], char *envp[]) } } else { dbg("default handling"); - udev_rules_get_run(&udev, NULL); + udev_rules_get_run(&rules, &udev, NULL); if (udev.ignore_device) { info("device event will be ignored"); goto cleanup; diff --git a/udev_rules.c b/udev_rules.c index 48e22ad3e8..48397ac1c7 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -599,25 +599,38 @@ found: } } -static int match_key(const char *key, const char *key_val, enum key_operation key_op, const char *val) +static char *key_val(struct udev_rule *rule, struct key *key) +{ + return rule->buf + key->val_off; +} + +static char *key_pair_name(struct udev_rule *rule, struct key_pair *pair) +{ + return rule->buf + pair->key_name_off; +} + +static int match_key(const char *key_name, struct udev_rule *rule, struct key *key, const char *val) { int match; + char *key_value; - if (key_op == KEY_OP_UNSET) + if (key->operation == KEY_OP_UNSET) return 0; - dbg("check for %s '%s' <-> '%s'", key, key_val, val); - match = (strcmp_pattern(key_val, val) == 0); - if (match && (key_op != KEY_OP_NOMATCH)) { - dbg("%s key is matching (matching value)", key); + key_value = rule->buf + key->val_off; + + dbg("check for %s '%s' <-> '%s'", key_name, key_value, val); + match = (strcmp_pattern(key_value, val) == 0); + if (match && (key->operation != KEY_OP_NOMATCH)) { + dbg("%s key is matching (matching value)", key_name); return 0; } - if (!match && (key_op == KEY_OP_NOMATCH)) { - dbg("%s key is matching, (non matching value)", key); + if (!match && (key->operation == KEY_OP_NOMATCH)) { + dbg("%s key is matching, (non matching value)", key_name); return 0; } - dbg("%s key is not matching", key); + dbg("%s key is not matching", key_name); return -1; } @@ -626,108 +639,108 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, { struct sysfs_device *parent_device = sysfs_device; - if (match_key("ACTION", rule->action, rule->action_operation, udev->action)) + if (match_key("ACTION", rule, &rule->action, udev->action)) goto exit; - if (match_key("KERNEL", rule->kernel_name, rule->kernel_operation, udev->kernel_name)) + if (match_key("KERNEL", rule, &rule->kernel_name, udev->kernel_name)) goto exit; - if (match_key("SUBSYSTEM", rule->subsystem, rule->subsystem_operation, udev->subsystem)) + if (match_key("SUBSYSTEM", rule, &rule->subsystem, udev->subsystem)) goto exit; - if (match_key("DEVPATH", rule->devpath, rule->devpath_operation, udev->devpath)) + if (match_key("DEVPATH", rule, &rule->devpath, udev->devpath)) goto exit; - if (rule->modalias_operation != KEY_OP_UNSET) { + if (rule->modalias.operation != KEY_OP_UNSET) { char value[NAME_SIZE]; if (find_sysfs_attribute(NULL, sysfs_device, "modalias", value, sizeof(value)) != 0) { dbg("MODALIAS value not found"); goto exit; } - if (match_key("MODALIAS", rule->modalias, rule->modalias_operation, value)) + if (match_key("MODALIAS", rule, &rule->modalias, value)) goto exit; } - if (rule->env_pair_count) { + if (rule->env.count) { int i; - for (i = 0; i < rule->env_pair_count; i++) { - struct key_pair *pair; - const char *value; + dbg("check %i ENV keys", rule->env.count); + for (i = 0; i < rule->env.count; i++) { + struct key_pair *pair = &rule->env.keys[i]; + const char *key_name = key_pair_name(rule, pair); + const char *value = getenv(key_name); - pair = &rule->env_pair[i]; - value = getenv(pair->name); if (!value) { - dbg("ENV{'%s'} is not found", pair->name); + dbg("ENV{'%s'} is not found", key_name); goto exit; } - dbg("check %i ENV keys", rule->env_pair_count); - if (match_key(pair->name, pair->value, pair->operation, value)) + if (match_key("ENV", rule, &pair->key, value)) goto exit; } - dbg("all %i ENV keys matched", rule->env_pair_count); + dbg("all %i ENV keys matched", rule->env.count); } /* walk up the chain of physical devices and find a match */ while (1) { /* check for matching driver */ - if (rule->driver_operation != KEY_OP_UNSET) { + if (rule->driver.operation != KEY_OP_UNSET) { if (parent_device == NULL) { dbg("device has no sysfs_device"); goto exit; } - if (match_key("DRIVER", rule->driver, rule->driver_operation, parent_device->driver_name)) + if (match_key("DRIVER", rule, &rule->driver, parent_device->driver_name)) goto try_parent; } /* check for matching bus value */ - if (rule->bus_operation != KEY_OP_UNSET) { + if (rule->bus.operation != KEY_OP_UNSET) { if (parent_device == NULL) { dbg("device has no sysfs_device"); goto exit; } - if (match_key("BUS", rule->bus, rule->bus_operation, parent_device->bus)) + if (match_key("BUS", rule, &rule->bus, parent_device->bus)) goto try_parent; } /* check for matching bus id */ - if (rule->id_operation != KEY_OP_UNSET) { + if (rule->id.operation != KEY_OP_UNSET) { if (parent_device == NULL) { dbg("device has no sysfs_device"); goto exit; } - if (match_key("ID", rule->id, rule->id_operation, parent_device->bus_id)) + if (match_key("ID", rule, &rule->id, parent_device->bus_id)) goto try_parent; } /* check for matching sysfs pairs */ - if (rule->sysfs_pair_count) { + if (rule->sysfs.count) { int i; - for (i = 0; i < rule->sysfs_pair_count; i++) { - struct key_pair *pair; + dbg("check %i SYSFS keys", rule->sysfs.count); + for (i = 0; i < rule->sysfs.count; i++) { + struct key_pair *pair = &rule->sysfs.keys[i]; + const char *key_name = key_pair_name(rule, pair); + const char *key_value = key_val(rule, &pair->key); char value[VALUE_SIZE]; size_t len; - pair = &rule->sysfs_pair[i]; - if (find_sysfs_attribute(class_dev, parent_device, pair->name, value, sizeof(value)) != 0) + if (find_sysfs_attribute(class_dev, parent_device, key_name, value, sizeof(value)) != 0) goto try_parent; /* strip trailing whitespace of value, if not asked to match for it */ - len = strlen(pair->value); - if (len && !isspace(pair->value[len-1])) { + len = strlen(key_value); + if (len && !isspace(key_value[len-1])) { len = strlen(value); while (len > 0 && isspace(value[len-1])) value[--len] = '\0'; dbg("removed %zi trailing whitespace chars from '%s'", strlen(value)-len, value); } - dbg("check %i SYSFS keys", rule->sysfs_pair_count); - if (match_key(pair->name, pair->value, pair->operation, value)) + if (match_key("SYSFS", rule, &pair->key, value)) goto try_parent; } - dbg("all %i SYSFS keys matched", rule->sysfs_pair_count); + dbg("all %i SYSFS keys matched", rule->sysfs.count); } /* found matching physical device */ @@ -742,11 +755,11 @@ try_parent: } /* import variables from file into environment */ - if (rule->import_operation != KEY_OP_UNSET) { + if (rule->import.operation != KEY_OP_UNSET) { char import[PATH_SIZE]; int rc = -1; - strlcpy(import, rule->import, sizeof(import)); + strlcpy(import, key_val(rule, &rule->import), sizeof(import)); apply_format(udev, import, sizeof(import), class_dev, sysfs_device); dbg("check for IMPORT import='%s'", import); if (rule->import_exec) { @@ -758,24 +771,24 @@ try_parent: } if (rc) { dbg("IMPORT failed"); - if (rule->import_operation != KEY_OP_NOMATCH) + if (rule->import.operation != KEY_OP_NOMATCH) goto exit; } else - dbg("IMPORT '%s' imported", rule->import); + dbg("IMPORT '%s' imported", key_val(rule, &rule->import)); dbg("IMPORT key is true"); } /* execute external program */ - if (rule->program_operation != KEY_OP_UNSET) { + if (rule->program.operation != KEY_OP_UNSET) { char program[PATH_SIZE]; char result[PATH_SIZE]; - strlcpy(program, rule->program, sizeof(program)); + strlcpy(program, key_val(rule, &rule->program), sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); dbg("check for PROGRAM program='%s", program); if (execute_program(program, udev->subsystem, result, sizeof(result), NULL) != 0) { dbg("PROGRAM is not matching"); - if (rule->program_operation != KEY_OP_NOMATCH) + if (rule->program.operation != KEY_OP_NOMATCH) goto exit; } else { dbg("PROGRAM matches"); @@ -784,14 +797,14 @@ try_parent: dbg("result is '%s'", result); strlcpy(udev->program_result, result, sizeof(udev->program_result)); dbg("PROGRAM returned successful"); - if (rule->program_operation == KEY_OP_NOMATCH) + if (rule->program.operation == KEY_OP_NOMATCH) goto exit; } dbg("PROGRAM key is true"); } /* check for matching result of external program */ - if (match_key("RESULT", rule->result, rule->result_operation, udev->program_result)) + if (match_key("RESULT", rule, &rule->result, udev->program_result)) goto exit; /* rule matches */ @@ -801,7 +814,7 @@ exit: return -1; } -int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_dev) +int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct sysfs_class_device *class_dev) { struct sysfs_class_device *class_dev_parent; struct sysfs_device *sysfs_device = NULL; @@ -831,13 +844,13 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d dbg("udev->kernel_name='%s'", udev->kernel_name); /* look for a matching rule to apply */ - udev_rules_iter_init(); + udev_rules_iter_init(rules); while (1) { - rule = udev_rules_iter_next(); + rule = udev_rules_iter_next(rules); if (rule == NULL) break; - if (udev->name_set && rule->name_operation != KEY_OP_UNSET) { + if (udev->name_set && rule->name.operation != KEY_OP_UNSET) { dbg("node name already set, rule ignored"); continue; } @@ -846,8 +859,7 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d if (match_rule(udev, rule, class_dev, sysfs_device) == 0) { /* apply options */ if (rule->ignore_device) { - info("configured rule in '%s[%i]' applied, '%s' is ignored", - rule->config_file, rule->config_line, udev->kernel_name); + info("rule applied, '%s' is ignored", udev->kernel_name); udev->ignore_device = 1; return 0; } @@ -866,31 +878,31 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d if (rule->mode_operation == KEY_OP_ASSIGN_FINAL) udev->mode_final = 1; udev->mode = rule->mode; - dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name); + dbg("applied mode=%#o to '%s'", rule->mode, udev->kernel_name); } - if (!udev->owner_final && rule->owner[0] != '\0') { - if (rule->owner_operation == KEY_OP_ASSIGN_FINAL) + if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { + if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) udev->owner_final = 1; - strlcpy(udev->owner, rule->owner, sizeof(udev->owner)); + strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner)); apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name); } - if (!udev->group_final && rule->group[0] != '\0') { - if (rule->group_operation == KEY_OP_ASSIGN_FINAL) + if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) { + if (rule->group.operation == KEY_OP_ASSIGN_FINAL) udev->group_final = 1; - strlcpy(udev->group, rule->group, sizeof(udev->group)); - apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); + strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); + apply_format(udev, key_val(rule, &rule->group), sizeof(udev->group), class_dev, sysfs_device); dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); } /* collect symlinks */ - if (!udev->symlink_final && rule->symlink_operation != KEY_OP_UNSET) { + if (!udev->symlink_final && rule->symlink.operation != KEY_OP_UNSET) { char temp[PATH_SIZE]; char *pos, *next; - if (rule->symlink_operation == KEY_OP_ASSIGN_FINAL) + if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) udev->symlink_final = 1; - if (rule->symlink_operation == KEY_OP_ASSIGN || rule->symlink_operation == KEY_OP_ASSIGN_FINAL) { + if (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { struct name_entry *name_loop; struct name_entry *temp_loop; @@ -900,53 +912,42 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d free(name_loop); } } - if (rule->symlink[0] != '\0') { - info("configured rule in '%s[%i]' applied, added symlink '%s'", - rule->config_file, rule->config_line, rule->symlink); - strlcpy(temp, rule->symlink, sizeof(temp)); - apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); - - /* add multiple symlinks separated by spaces */ - pos = temp; - next = strchr(temp, ' '); - while (next) { - next[0] = '\0'; - info("add symlink '%s'", pos); - name_list_add(&udev->symlink_list, pos, 0); - pos = &next[1]; - next = strchr(pos, ' '); - } + strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); + apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); + info("rule applied, added symlink '%s'", temp); + + /* add multiple symlinks separated by spaces */ + pos = temp; + next = strchr(temp, ' '); + while (next) { + next[0] = '\0'; info("add symlink '%s'", pos); name_list_add(&udev->symlink_list, pos, 0); + pos = &next[1]; + next = strchr(pos, ' '); } + info("add symlink '%s'", pos); + name_list_add(&udev->symlink_list, pos, 0); } /* set name, later rules with name set will be ignored */ - if (rule->name_operation != KEY_OP_UNSET) { + if (rule->name.operation != KEY_OP_UNSET) { udev->name_set = 1; - if (rule->name[0] == '\0') { - info("configured rule in '%s[%i]' applied, node handling for '%s' supressed", - rule->config_file, rule->config_line, udev->kernel_name); - } else { - strlcpy(udev->name, rule->name, sizeof(udev->name)); - apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); - strlcpy(udev->config_file, rule->config_file, sizeof(udev->config_file)); - udev->config_line = rule->config_line; - - info("configured rule in '%s:%i' applied, '%s' becomes '%s'", - rule->config_file, rule->config_line, udev->kernel_name, rule->name); - if (udev->type != DEV_NET) - dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", - udev->name, udev->owner, udev->group, udev->mode, udev->partitions); - } + strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); + apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); + + info("rule applied, '%s' becomes '%s'", udev->kernel_name, udev->name); + if (udev->type != DEV_NET) + dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", + udev->name, udev->owner, udev->group, udev->mode, udev->partitions); } - if (!udev->run_final && rule->run_operation != KEY_OP_UNSET) { + if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { char program[PATH_SIZE]; - if (rule->run_operation == KEY_OP_ASSIGN_FINAL) + if (rule->run.operation == KEY_OP_ASSIGN_FINAL) udev->run_final = 1; - if (rule->run_operation == KEY_OP_ASSIGN || rule->run_operation == KEY_OP_ASSIGN_FINAL) { + if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { struct name_entry *name_loop; struct name_entry *temp_loop; @@ -956,12 +957,10 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d free(name_loop); } } - if (rule->run[0] != '\0') { - strlcpy(program, rule->run, sizeof(program)); - apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - dbg("add run '%s'", program); - name_list_add(&udev->run_list, program, 0); - } + strlcpy(program, key_val(rule, &rule->run), sizeof(program)); + apply_format(udev, program, sizeof(program), class_dev, sysfs_device); + dbg("add run '%s'", program); + name_list_add(&udev->run_list, program, 0); } if (rule->last_rule) { @@ -973,7 +972,7 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d if (udev->name[0] == '\0') { strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); - info("no rule found, use kernel name '%s'", udev->name); + info("no rule found, will use kernel name '%s'", udev->name); } if (udev->tmp_node[0] != '\0') { @@ -985,36 +984,35 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d return 0; } -int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device) +int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, struct sysfs_device *sysfs_device) { struct udev_rule *rule; /* look for a matching rule to apply */ - udev_rules_iter_init(); + udev_rules_iter_init(rules); while (1) { - rule = udev_rules_iter_next(); + rule = udev_rules_iter_next(rules); if (rule == NULL) break; dbg("process rule"); - if (rule->name_operation != KEY_OP_UNSET || rule->symlink_operation != KEY_OP_UNSET || - rule->mode != 0000 || rule->owner[0] != '\0' || rule->group[0] != '\0') { + if (rule->name.operation != KEY_OP_UNSET || rule->symlink.operation != KEY_OP_UNSET || + rule->mode_operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { dbg("skip rule that names a device"); continue; } if (match_rule(udev, rule, NULL, sysfs_device) == 0) { if (rule->ignore_device) { - info("configured rule in '%s[%i]' applied, '%s' is ignored", - rule->config_file, rule->config_line, udev->kernel_name); + info("rule applied, '%s' is ignored", udev->kernel_name); udev->ignore_device = 1; return 0; } - if (!udev->run_final && rule->run_operation != KEY_OP_UNSET) { + if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { char program[PATH_SIZE]; - if (rule->run_operation == KEY_OP_ASSIGN || rule->run_operation == KEY_OP_ASSIGN_FINAL) { + if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { struct name_entry *name_loop; struct name_entry *temp_loop; @@ -1024,13 +1022,11 @@ int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device) free(name_loop); } } - if (rule->run[0] != '\0') { - strlcpy(program, rule->run, sizeof(program)); - apply_format(udev, program, sizeof(program), NULL, sysfs_device); - dbg("add run '%s'", program); - name_list_add(&udev->run_list, program, 0); - } - if (rule->run_operation == KEY_OP_ASSIGN_FINAL) + strlcpy(program, key_val(rule, &rule->run), sizeof(program)); + apply_format(udev, program, sizeof(program), NULL, sysfs_device); + dbg("add run '%s'", program); + name_list_add(&udev->run_list, program, 0); + if (rule->run.operation == KEY_OP_ASSIGN_FINAL) break; } diff --git a/udev_rules.h b/udev_rules.h index fb77509cce..4ecada1c03 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -27,9 +27,7 @@ #include "udev.h" #include "list.h" -#define KEY_SYSFS_PAIRS_MAX 5 -#define KEY_ENV_PAIRS_MAX 5 - +#define PAIRS_MAX 5 #define RULEFILE_SUFFIX ".rules" enum key_operation { @@ -41,72 +39,69 @@ enum key_operation { KEY_OP_ASSIGN_FINAL, }; -struct key_pair { - char name[NAME_SIZE]; - char value[VALUE_SIZE]; +struct key { enum key_operation operation; + size_t val_off; +}; + +struct key_pair { + struct key key; + size_t key_name_off; +}; + +struct key_pairs { + int count; + struct key_pair keys[PAIRS_MAX]; }; struct udev_rule { - struct list_head node; - - char kernel_name[NAME_SIZE]; - enum key_operation kernel_operation; - char subsystem[NAME_SIZE]; - enum key_operation subsystem_operation; - char action[NAME_SIZE]; - enum key_operation action_operation; - char devpath[PATH_SIZE]; - enum key_operation devpath_operation; - char bus[NAME_SIZE]; - enum key_operation bus_operation; - char id[NAME_SIZE]; - enum key_operation id_operation; - char driver[NAME_SIZE]; - enum key_operation driver_operation; - char program[PATH_SIZE]; - enum key_operation program_operation; - char result[PATH_SIZE]; - enum key_operation result_operation; - struct key_pair sysfs_pair[KEY_SYSFS_PAIRS_MAX]; - int sysfs_pair_count; - struct key_pair env_pair[KEY_ENV_PAIRS_MAX]; - int env_pair_count; - char modalias[NAME_SIZE]; - enum key_operation modalias_operation; - char import[PATH_SIZE]; - enum key_operation import_operation; - int import_exec; - - char name[PATH_SIZE]; - enum key_operation name_operation; - char symlink[PATH_SIZE]; - enum key_operation symlink_operation; - char owner[USER_SIZE]; - enum key_operation owner_operation; - char group[USER_SIZE]; - enum key_operation group_operation; - mode_t mode; + struct key kernel_name; + struct key subsystem; + struct key action; + struct key devpath; + struct key bus; + struct key id; + struct key driver; + struct key program; + struct key result; + struct key modalias; + struct key import; + struct key_pairs sysfs; + struct key_pairs env; + + struct key name; + struct key symlink; + struct key run; + struct key owner; + struct key group; enum key_operation mode_operation; - char run[PATH_SIZE]; - enum key_operation run_operation; + mode_t mode; + + unsigned int partitions; + unsigned int last_rule:1, + ignore_device:1, + ignore_remove:1, + import_exec:1; - int last_rule; - int ignore_device; - int ignore_remove; - int partitions; + size_t bufsize; + char buf[]; +}; - char config_file[PATH_SIZE]; - int config_line; +struct udev_rules { + char *buf; + size_t bufsize; + size_t current; + int mapped; + int resolve_names; }; -extern int udev_rules_init(void); -extern void udev_rules_close(void); +extern int udev_rules_init(struct udev_rules *rules, int resolve_names); +extern void udev_rules_close(struct udev_rules *rules); -extern int udev_rules_iter_init(void); -extern struct udev_rule *udev_rules_iter_next(void); +extern void udev_rules_iter_init(struct udev_rules *rules); +extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); -extern int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_dev); -extern int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device); +extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct sysfs_class_device *class_dev); +extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, struct sysfs_device *sysfs_device); #endif diff --git a/udev_rules_parse.c b/udev_rules_parse.c index cf69783c2d..2ec9348b01 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -37,65 +37,29 @@ #include "logging.h" #include "udev_rules.h" -/* rules parsed from .rules files*/ -static LIST_HEAD(rules_list); -static struct list_head *rules_list_current; -/* mapped compiled rules stored on disk */ -static struct udev_rule *rules_array = NULL; -static size_t rules_array_current; -static size_t rules_array_size = 0; - -static size_t rules_count = 0; - -int udev_rules_iter_init(void) +void udev_rules_iter_init(struct udev_rules *rules) { - rules_list_current = rules_list.next; - rules_array_current = 0; - - return 0; + dbg("bufsize=%zi", rules->bufsize); + rules->current = 0; } -struct udev_rule *udev_rules_iter_next(void) +struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) { static struct udev_rule *rule; - if (rules_array) { - if (rules_array_current >= rules_count) - return NULL; - rule = &rules_array[rules_array_current]; - rules_array_current++; - } else { - dbg("head=%p current=%p next=%p", &rules_list, rules_list_current, rules_list_current->next); - if (rules_list_current == &rules_list) - return NULL; - rule = list_entry(rules_list_current, struct udev_rule, node); - rules_list_current = rules_list_current->next; - } - return rule; -} + if (!rules) + return NULL; -static int add_rule_to_list(struct udev_rule *rule) -{ - struct udev_rule *tmp_rule; - - tmp_rule = malloc(sizeof(*tmp_rule)); - if (tmp_rule == NULL) - return -ENOMEM; - memcpy(tmp_rule, rule, sizeof(struct udev_rule)); - list_add_tail(&tmp_rule->node, &rules_list); - - dbg("name='%s', symlink='%s', bus='%s', id='%s', " - "sysfs_file[0]='%s', sysfs_value[0]='%s', " - "kernel_name='%s', program='%s', result='%s', " - "owner='%s', group='%s', mode=%#o, " - "all_partions=%u, ignore_remove=%u, ignore_device=%u, last_rule=%u", - rule->name, rule->symlink, rule->bus, rule->id, - rule->sysfs_pair[0].name, rule->sysfs_pair[0].value, - rule->kernel_name, rule->program, rule->result, rule->owner, rule->group, rule->mode, - rule->partitions, rule->ignore_remove, rule->ignore_device, rule->last_rule); + dbg("current=%zi", rules->current); + if (rules->current >= rules->bufsize) + return NULL; - return 0; + /* get next rule */ + rule = (struct udev_rule *) (rules->buf + rules->current); + rules->current += sizeof(struct udev_rule) + rule->bufsize; + + return rule; } static int get_key(char **line, char **key, enum key_operation *operation, char **value) @@ -210,353 +174,389 @@ static char *get_key_attribute(char *str) return NULL; } -static int rules_parse(const char *filename) +static int add_rule_key(struct udev_rule *rule, struct key *key, + enum key_operation operation, const char *value) { - char line[LINE_SIZE]; - char *bufline; - int lineno; + size_t val_len = strnlen(value, PATH_SIZE); + + key->operation = operation; + + key->val_off = rule->bufsize; + strlcpy(rule->buf + rule->bufsize, value, val_len+1); + rule->bufsize += val_len+1; + + return 0; +} + +static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs, + enum key_operation operation, const char *key, const char *value) +{ + size_t key_len = strnlen(key, PATH_SIZE); + + if (pairs->count >= PAIRS_MAX) { + err("skip, too many keys in a single rule"); + return -1; + } + + add_rule_key(rule, &pairs->keys[pairs->count].key, operation, value); + + /* add the key-name of the pair */ + pairs->keys[pairs->count].key_name_off = rule->bufsize; + strlcpy(rule->buf + rule->bufsize, key, key_len+1); + rule->bufsize += key_len+1; + + pairs->count++; + + return 0; +} + +static int add_to_rules(struct udev_rules *rules, char *line) +{ + struct udev_rule *rule; + size_t rule_size; + int valid; char *linepos; char *attr; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - int program_given = 0; - int valid; - int retval = 0; - struct udev_rule rule; + int retval; - if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s' as rules file", filename); + /* get all the keys */ + rule = calloc(1, sizeof (struct udev_rule) + LINE_SIZE); + if (!rule) { + err("malloc failed"); return -1; } - dbg("reading '%s' as rules file", filename); + linepos = line; + valid = 0; - /* loop through the whole file */ - cur = 0; - lineno = 0; - while (cur < bufsize) { - unsigned int i, j; + while (1) { + char *key; + char *value; + enum key_operation operation = KEY_OP_UNSET; - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; + retval = get_key(&linepos, &key, &operation, &value); + if (retval) + break; - if (count >= sizeof(line)) { - info("line too long, rule skipped %s, line %d", filename, lineno); + if (strcasecmp(key, "KERNEL") == 0) { + add_rule_key(rule, &rule->kernel_name, operation, value); + valid = 1; continue; } - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) + if (strcasecmp(key, "SUBSYSTEM") == 0) { + add_rule_key(rule, &rule->subsystem, operation, value); + valid = 1; continue; + } - /* see if this is a comment */ - if (bufline[0] == COMMENT_CHARACTER) + if (strcasecmp(key, "ACTION") == 0) { + add_rule_key(rule, &rule->action, operation, value); + valid = 1; continue; - - /* skip backslash and newline from multi line rules */ - for (i = j = 0; i < count; i++) { - if (bufline[i] == '\\' && bufline[i+1] == '\n') - continue; - - line[j++] = bufline[i]; } - line[j] = '\0'; - dbg("read '%s'", line); - /* get all known keys */ - memset(&rule, 0x00, sizeof(struct udev_rule)); - linepos = line; - valid = 0; + if (strcasecmp(key, "DEVPATH") == 0) { + add_rule_key(rule, &rule->devpath, operation, value); + valid = 1; + continue; + } - while (1) { - char *key; - char *value; - enum key_operation operation = KEY_OP_UNSET; + if (strcasecmp(key, "BUS") == 0) { + add_rule_key(rule, &rule->bus, operation, value); + valid = 1; + continue; + } - retval = get_key(&linepos, &key, &operation, &value); - if (retval) - break; + if (strcasecmp(key, "ID") == 0) { + add_rule_key(rule, &rule->id, operation, value); + valid = 1; + continue; + } - if (strcasecmp(key, "KERNEL") == 0) { - strlcpy(rule.kernel_name, value, sizeof(rule.kernel_name)); - rule.kernel_operation = operation; - valid = 1; + if (strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) { + attr = get_key_attribute(key + sizeof("SYSFS")-1); + if (attr == NULL) { + err("error parsing SYSFS attribute in '%s'", line); continue; } + add_rule_key_pair(rule, &rule->sysfs, operation, attr, value); + valid = 1; + continue; + } - if (strcasecmp(key, "SUBSYSTEM") == 0) { - strlcpy(rule.subsystem, value, sizeof(rule.subsystem)); - rule.subsystem_operation = operation; - valid = 1; + if (strncasecmp(key, "ENV", sizeof("ENV")-1) == 0) { + attr = get_key_attribute(key + sizeof("ENV")-1); + if (attr == NULL) { + err("error parsing ENV attribute"); continue; } + add_rule_key_pair(rule, &rule->env, operation, attr, value); + valid = 1; + continue; + } - if (strcasecmp(key, "ACTION") == 0) { - strlcpy(rule.action, value, sizeof(rule.action)); - rule.action_operation = operation; - valid = 1; - continue; - } + if (strcasecmp(key, "MODALIAS") == 0) { + add_rule_key(rule, &rule->modalias, operation, value); + valid = 1; + continue; + } - if (strcasecmp(key, "DEVPATH") == 0) { - strlcpy(rule.devpath, value, sizeof(rule.devpath)); - rule.devpath_operation = operation; - valid = 1; - continue; + if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { + attr = get_key_attribute(key + sizeof("IMPORT")-1); + if (attr && strstr(attr, "program")) { + dbg("IMPORT will be executed"); + rule->import_exec = 1; + } else if (attr && strstr(attr, "file")) { + dbg("IMPORT will be included as file"); + } else { + /* figure it out if it is executable */ + char file[PATH_SIZE]; + char *pos; + struct stat stats; + + strlcpy(file, value, sizeof(file)); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + dbg("IMPORT auto mode for '%s'", file); + if (!lstat(file, &stats) && (stats.st_mode & S_IXUSR)) { + dbg("IMPORT is executable, will be executed"); + rule->import_exec = 1; + } } + add_rule_key(rule, &rule->import, operation, value); + valid = 1; + continue; + } - if (strcasecmp(key, "BUS") == 0) { - strlcpy(rule.bus, value, sizeof(rule.bus)); - rule.bus_operation = operation; - valid = 1; - continue; - } + if (strcasecmp(key, "DRIVER") == 0) { + add_rule_key(rule, &rule->driver, operation, value); + valid = 1; + continue; + } - if (strcasecmp(key, "ID") == 0) { - strlcpy(rule.id, value, sizeof(rule.id)); - rule.id_operation = operation; - valid = 1; - continue; - } + if (strcasecmp(key, "RESULT") == 0) { + add_rule_key(rule, &rule->result, operation, value); + valid = 1; + continue; + } - if (strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) { - struct key_pair *pair; + if (strcasecmp(key, "PROGRAM") == 0) { + add_rule_key(rule, &rule->program, operation, value); + valid = 1; + continue; + } - if (rule.sysfs_pair_count >= KEY_SYSFS_PAIRS_MAX) { - err("skip rule, to many SYSFS keys in a single rule"); - goto error; + if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { + attr = get_key_attribute(key + sizeof("NAME")-1); + if (attr != NULL) { + if (strstr(attr, "all_partitions") != NULL) { + dbg("creation of partition nodes requested"); + rule->partitions = DEFAULT_PARTITIONS_COUNT; } - pair = &rule.sysfs_pair[rule.sysfs_pair_count]; - attr = get_key_attribute(key + sizeof("SYSFS")-1); - if (attr == NULL) { - err("error parsing SYSFS attribute"); - goto error; + if (strstr(attr, "ignore_remove") != NULL) { + dbg("remove event should be ignored"); + rule->ignore_remove = 1; } - strlcpy(pair->name, attr, sizeof(pair->name)); - strlcpy(pair->value, value, sizeof(pair->value)); - pair->operation = operation; - rule.sysfs_pair_count++; - valid = 1; - continue; } + add_rule_key(rule, &rule->name, operation, value); + continue; + } - if (strncasecmp(key, "ENV", sizeof("ENV")-1) == 0) { - struct key_pair *pair; + if (strcasecmp(key, "SYMLINK") == 0) { + add_rule_key(rule, &rule->symlink, operation, value); + valid = 1; + continue; + } - if (rule.env_pair_count >= KEY_ENV_PAIRS_MAX) { - err("skip rule, to many ENV keys in a single rule"); - goto error; - } - pair = &rule.env_pair[rule.env_pair_count]; - attr = get_key_attribute(key + sizeof("ENV")-1); - if (attr == NULL) { - err("error parsing ENV attribute"); + if (strcasecmp(key, "OWNER") == 0) { + valid = 1; + if (rules->resolve_names) { + char *endptr; + strtoul(value, &endptr, 10); + if (endptr[0] != '\0') { + char owner[32]; + uid_t uid = lookup_user(value); + dbg("replacing username='%s' by id=%i", value, uid); + sprintf(owner, "%li", uid); + add_rule_key(rule, &rule->owner, operation, owner); continue; } - strlcpy(pair->name, attr, sizeof(pair->name)); - strlcpy(pair->value, value, sizeof(pair->value)); - pair->operation = operation; - rule.env_pair_count++; - valid = 1; - continue; } - if (strcasecmp(key, "MODALIAS") == 0) { - strlcpy(rule.modalias, value, sizeof(rule.modalias)); - rule.modalias_operation = operation; - valid = 1; - continue; - } + add_rule_key(rule, &rule->owner, operation, value); + continue; + } - if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { - attr = get_key_attribute(key + sizeof("IMPORT")-1); - if (attr && strstr(attr, "program")) { - dbg("IMPORT will be executed"); - rule.import_exec = 1; - } else if (attr && strstr(attr, "file")) { - dbg("IMPORT will be included as file"); - } else { - /* figure it out if it is executable */ - char file[PATH_SIZE]; - char *pos; - struct stat stats; - - strlcpy(file, value, sizeof(file)); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - dbg("IMPORT auto mode for '%s'", file); - if (!lstat(file, &stats) && (stats.st_mode & S_IXUSR)) { - dbg("IMPORT is executable, will be executed"); - rule.import_exec = 1; - } + if (strcasecmp(key, "GROUP") == 0) { + valid = 1; + if (rules->resolve_names) { + char *endptr; + strtoul(value, &endptr, 10); + if (endptr[0] != '\0') { + char group[32]; + gid_t gid = lookup_group(value); + dbg("replacing groupname='%s' by id=%i", value, gid); + sprintf(group, "%li", gid); + add_rule_key(rule, &rule->owner, operation, group); + continue; } - strlcpy(rule.import, value, sizeof(rule.import)); - rule.import_operation = operation; - valid = 1; - continue; } - if (strcasecmp(key, "DRIVER") == 0) { - strlcpy(rule.driver, value, sizeof(rule.driver)); - rule.driver_operation = operation; - valid = 1; - continue; - } + add_rule_key(rule, &rule->group, operation, value); + continue; + } - if (strcasecmp(key, "RESULT") == 0) { - strlcpy(rule.result, value, sizeof(rule.result)); - rule.result_operation = operation; - valid = 1; - continue; - } + if (strcasecmp(key, "MODE") == 0) { + rule->mode = strtol(value, NULL, 8); + rule->mode_operation = operation; + valid = 1; + continue; + } - if (strcasecmp(key, "PROGRAM") == 0) { - strlcpy(rule.program, value, sizeof(rule.program)); - rule.program_operation = operation; - program_given = 1; - valid = 1; - continue; - } + if (strcasecmp(key, "RUN") == 0) { + add_rule_key(rule, &rule->run, operation, value); + valid = 1; + continue; + } - if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { - attr = get_key_attribute(key + sizeof("NAME")-1); - if (attr != NULL) { - if (strstr(attr, "all_partitions") != NULL) { - dbg("creation of partition nodes requested"); - rule.partitions = DEFAULT_PARTITIONS_COUNT; - } - if (strstr(attr, "ignore_remove") != NULL) { - dbg("remove event should be ignored"); - rule.ignore_remove = 1; - } - } - rule.name_operation = operation; - strlcpy(rule.name, value, sizeof(rule.name)); - valid = 1; - continue; + if (strcasecmp(key, "OPTIONS") == 0) { + if (strstr(value, "last_rule") != NULL) { + dbg("last rule to be applied"); + rule->last_rule = 1; } - - if (strcasecmp(key, "SYMLINK") == 0) { - strlcpy(rule.symlink, value, sizeof(rule.symlink)); - rule.symlink_operation = operation; - valid = 1; - continue; + if (strstr(value, "ignore_device") != NULL) { + dbg("device should be ignored"); + rule->ignore_device = 1; } - - if (strcasecmp(key, "OWNER") == 0) { - strlcpy(rule.owner, value, sizeof(rule.owner)); - rule.owner_operation = operation; - valid = 1; - continue; + if (strstr(value, "ignore_remove") != NULL) { + dbg("remove event should be ignored"); + rule->ignore_remove = 1; } - - if (strcasecmp(key, "GROUP") == 0) { - strlcpy(rule.group, value, sizeof(rule.group)); - rule.group_operation = operation; - valid = 1; - continue; + if (strstr(value, "all_partitions") != NULL) { + dbg("creation of partition nodes requested"); + rule->partitions = DEFAULT_PARTITIONS_COUNT; } + valid = 1; + continue; + } - if (strcasecmp(key, "MODE") == 0) { - rule.mode = strtol(value, NULL, 8); - rule.mode_operation = operation; - valid = 1; - continue; - } + err("unknown key '%s', in '%s'", key, line); + } - if (strcasecmp(key, "RUN") == 0) { - strlcpy(rule.run, value, sizeof(rule.run)); - rule.run_operation = operation; - valid = 1; - continue; - } + /* skip line if not any valid key was found */ + if (!valid) { + err("invalid rule '%s'", line); + goto exit; + } - if (strcasecmp(key, "OPTIONS") == 0) { - if (strstr(value, "last_rule") != NULL) { - dbg("last rule to be applied"); - rule.last_rule = 1; - } - if (strstr(value, "ignore_device") != NULL) { - dbg("device should be ignored"); - rule.ignore_device = 1; - } - if (strstr(value, "ignore_remove") != NULL) { - dbg("remove event should be ignored"); - rule.ignore_remove = 1; - } - if (strstr(value, "all_partitions") != NULL) { - dbg("creation of partition nodes requested"); - rule.partitions = DEFAULT_PARTITIONS_COUNT; - } - valid = 1; - continue; - } + /* grow buffer and add rule */ + rule_size = sizeof(struct udev_rule) + rule->bufsize; + rules->buf = realloc(rules->buf, rules->bufsize + rule_size); + if (!rules->buf) { + err("realloc failed"); + goto exit; + } + memcpy(rules->buf + rules->bufsize, rule, rule_size); + rules->bufsize += rule_size; +exit: + free(rule); + return 0; +} - err("unknown key '%s'", key); - goto error; - } +static int parse_file(struct udev_rules *rules, const char *filename) +{ + char line[LINE_SIZE]; + char *bufline; + int lineno; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + int retval = 0; + + if (file_map(filename, &buf, &bufsize) != 0) { + err("can't open '%s' as rules file", filename); + return -1; + } + dbg("reading '%s' as rules file", filename); - /* skip line if not any valid key was found */ - if (!valid) - goto error; + /* loop through the whole file */ + cur = 0; + lineno = 0; + while (cur < bufsize) { + unsigned int i, j; + + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + lineno++; + + if (count >= sizeof(line)) { + info("line too long, rule skipped %s, line %d", filename, lineno); + continue; + } - if ((rule.result[0] != '\0') && (program_given == 0)) { - info("RESULT is only useful when PROGRAM is called in any rule before"); - goto error; + /* eat the whitespace */ + while ((count > 0) && isspace(bufline[0])) { + bufline++; + count--; } + if (count == 0) + continue; - rule.config_line = lineno; - strlcpy(rule.config_file, filename, sizeof(rule.config_file)); - retval = add_rule_to_list(&rule); - if (retval) { - dbg("add_rule_to_list returned with error %d", retval); + /* see if this is a comment */ + if (bufline[0] == COMMENT_CHARACTER) continue; -error: - err("parse error %s, line %d:%d, rule skipped", - filename, lineno, (int) (linepos - line)); + + /* skip backslash and newline from multi line rules */ + for (i = j = 0; i < count; i++) { + if (bufline[i] == '\\' && bufline[i+1] == '\n') + continue; + + line[j++] = bufline[i]; } + line[j] = '\0'; + + dbg("read '%s'", line); + add_to_rules(rules, line); } file_unmap(buf, bufsize); return retval; } -static int rules_map(const char *filename) +static int rules_map(struct udev_rules *rules, const char *filename) { - char *buf; - size_t size; - - if (file_map(filename, &buf, &size)) + if (file_map(filename, &rules->buf, &rules->bufsize)) { + rules->buf = NULL; return -1; - if (size == 0) + } + if (rules->bufsize == 0) { + file_unmap(rules->buf, rules->bufsize); + rules->buf = NULL; return -1; - rules_array = (struct udev_rule *) buf; - rules_array_size = size; - rules_count = size / sizeof(struct udev_rule); - dbg("found %zi compiled rules", rules_count); + } return 0; } -int udev_rules_init(void) +int udev_rules_init(struct udev_rules *rules, int resolve_names) { char comp[PATH_SIZE]; struct stat stats; int retval; + memset(rules, 0x00, sizeof(struct udev_rules)); + rules->resolve_names = resolve_names; + + /* check for precompiled rules */ strlcpy(comp, udev_rules_filename, sizeof(comp)); strlcat(comp, ".compiled", sizeof(comp)); if (stat(comp, &stats) == 0) { - dbg("parse compiled rules '%s'", comp); - return rules_map(comp); + dbg("map compiled rules '%s'", comp); + if (rules_map(rules, comp) == 0) + return 0; } if (stat(udev_rules_filename, &stats) != 0) @@ -564,7 +564,7 @@ int udev_rules_init(void) if ((stats.st_mode & S_IFMT) != S_IFDIR) { dbg("parse single rules file '%s'", udev_rules_filename); - retval = rules_parse(udev_rules_filename); + retval = parse_file(rules, udev_rules_filename); } else { struct name_entry *name_loop, *name_tmp; LIST_HEAD(name_list); @@ -573,7 +573,7 @@ int udev_rules_init(void) retval = add_matching_files(&name_list, udev_rules_filename, RULEFILE_SUFFIX); list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - rules_parse(name_loop->name); + parse_file(rules, name_loop->name); list_del(&name_loop->node); } } @@ -581,16 +581,12 @@ int udev_rules_init(void) return retval; } -void udev_rules_close(void) +void udev_rules_close(struct udev_rules *rules) { - struct udev_rule *rule; - struct udev_rule *temp_rule; - - if (rules_array) - file_unmap(rules_array, rules_array_size); + if (rules->mapped) + file_unmap(rules->buf, rules->bufsize); else - list_for_each_entry_safe(rule, temp_rule, &rules_list, node) { - list_del(&rule->node); - free(rule); - } + free(rules->buf); + + rules->buf = NULL; } diff --git a/udevrulescompile.c b/udevrulescompile.c index 9162a16327..a71286abe7 100644 --- a/udevrulescompile.c +++ b/udevrulescompile.c @@ -50,7 +50,7 @@ void log_message(int priority, const char *format, ...) int main(int argc, char *argv[], char *envp[]) { - struct udev_rule *rule; + struct udev_rules rules; FILE *f; char comp[PATH_SIZE]; char comp_tmp[PATH_SIZE]; @@ -65,12 +65,11 @@ int main(int argc, char *argv[], char *envp[]) strlcpy(comp_tmp, comp, sizeof(comp_tmp)); strlcat(comp_tmp, ".tmp", sizeof(comp_tmp)); - /* remove old version, otherwise we would read it - * instead of the real rules */ + /* remove old version, otherwise we would read it instead of the real rules */ unlink(comp); unlink(comp_tmp); - udev_rules_init(); + udev_rules_init(&rules, 1); f = fopen(comp_tmp, "w"); if (f == NULL) { @@ -79,40 +78,11 @@ int main(int argc, char *argv[], char *envp[]) retval = 1; goto exit; } - dbg("storing compiled rules in '%s'", comp_tmp); - - udev_rules_iter_init(); - while (1) { - char *endptr; - unsigned long id; - - rule = udev_rules_iter_next(); - if (rule == NULL) - break; - - id = strtoul(rule->owner, &endptr, 10); - if (endptr[0] != '\0') { - uid_t uid; - - uid = lookup_user(rule->owner); - dbg("replacing username='%s' by id=%i", rule->owner, uid); - sprintf(rule->owner, "%li", uid); - } - - id = strtoul(rule->group, &endptr, 10); - if (endptr[0] != '\0') { - gid_t gid; - - gid = lookup_group(rule->group); - dbg("replacing groupname='%s' by id=%i", rule->group, gid); - sprintf(rule->group, "%li", gid); - } - - dbg("kernel_name='%s' name='%s'", rule->kernel_name, rule->name); - fwrite(rule, sizeof(struct udev_rule), 1, f); - } + dbg("storing compiled rules in '%s' size=%zi", comp_tmp, rules.bufsize); + fwrite(rules.buf, rules.bufsize, 1, f); fclose(f); + dbg("activating compiled rules in '%s'", comp); if (rename(comp_tmp, comp) != 0) { err("unable to write file"); diff --git a/udevstart.c b/udevstart.c index 22b781d52a..4ef92fd537 100644 --- a/udevstart.c +++ b/udevstart.c @@ -47,6 +47,7 @@ static const char *udev_run_str; static const char *udev_log_str; +static struct udev_rules rules; #ifdef USE_LOG void log_message(int priority, const char *format, ...) @@ -139,7 +140,7 @@ static int add_device(const char *path, const char *subsystem) dbg("sysfs_open_class_device_path failed"); return -1; } - udev_rules_get_name(&udev, class_dev); + udev_rules_get_name(&rules, &udev, class_dev); if (udev.ignore_device) { dbg("device event will be ignored"); goto exit; @@ -360,11 +361,12 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timeout to prevent hanging processes */ alarm(ALARM_TIMEOUT); - udev_rules_init(); + udev_rules_init(&rules, 1); udev_scan_block(); udev_scan_class(); + udev_rules_close(&rules); logging_close(); return 0; } diff --git a/udevtest.c b/udevtest.c index d3e43593bf..3e17b94715 100644 --- a/udevtest.c +++ b/udevtest.c @@ -55,6 +55,7 @@ void log_message (int priority, const char *format, ...) int main(int argc, char *argv[], char *envp[]) { + struct udev_rules rules; struct sysfs_class_device *class_dev; char *devpath; char path[PATH_SIZE]; @@ -93,7 +94,7 @@ int main(int argc, char *argv[], char *envp[]) info("looking at device '%s' from subsystem '%s'", devpath, subsystem); /* initialize the naming deamon */ - udev_rules_init(); + udev_rules_init(&rules, 0); /* fill in values and test_run flag*/ udev_init_device(&udev, devpath, subsystem, "add"); @@ -114,7 +115,7 @@ int main(int argc, char *argv[], char *envp[]) /* simulate node creation with test flag */ udev.test_run = 1; if (udev.type == DEV_NET || udev.devt) { - udev_rules_get_name(&udev, class_dev); + udev_rules_get_name(&rules, &udev, class_dev); udev_add_device(&udev, class_dev); } else info("only char and block devices with a dev-file are supported by this test program"); -- cgit v1.2.3-54-g00ecf From 25103c4849d3bdee38d22e08c65cd60cf5d5bcc4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 5 Jul 2005 22:40:42 +0200 Subject: create udevdb files only if somehting interesting happened Device nodes created with the default rule, without any symlink or option are no longer saved to the udevdb. This saves us ~3 MB RAM for pretty much useless files on tmpfs. Note: HAL needs a fix to handle this correctly. It's already available on the list. Signed-off-by: Kay Sievers --- udev_db.c | 19 +++++++++++++++---- udev_remove.c | 21 ++++++++++----------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/udev_db.c b/udev_db.c index 264af79d06..6f10b1e58d 100644 --- a/udev_db.c +++ b/udev_db.c @@ -68,10 +68,18 @@ int udev_db_add_device(struct udevice *udev) if (udev->test_run) return 0; - get_db_filename(udev->devpath, filename, sizeof(filename)); + /* don't write anything if udev created only the node with the + * kernel name without any interesting data to remember + */ + if (strcmp(udev->name, udev->kernel_name) == 0 && + list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && + !udev->partitions && !udev->ignore_remove) { + dbg("nothing interesting to store in udevdb, skip"); + goto exit; + } + get_db_filename(udev->devpath, filename, sizeof(filename)); create_path(filename); - f = fopen(filename, "w"); if (f == NULL) { err("unable to create db file '%s'", filename); @@ -84,12 +92,15 @@ int udev_db_add_device(struct udevice *udev) list_for_each_entry(name_loop, &udev->symlink_list, node) fprintf(f, "S:%s\n", name_loop->name); fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); - fprintf(f, "A:%u\n", udev->partitions); - fprintf(f, "R:%u\n", udev->ignore_remove); + if (udev->partitions) + fprintf(f, "A:%u\n", udev->partitions); + if (udev->ignore_remove) + fprintf(f, "R:%u\n", udev->ignore_remove); list_for_each_entry(name_loop, &udev->env_list, node) fprintf(f, "E:%s\n", name_loop->name); fclose(f); +exit: return 0; } diff --git a/udev_remove.c b/udev_remove.c index cf28ff37a9..b9a4384ee0 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -143,18 +143,17 @@ int udev_remove_device(struct udevice *udev) if (udev->type != DEV_BLOCK && udev->type != DEV_CLASS) return 0; - /* remove node only if we can find it in our database */ - if (udev_db_get_device(udev, udev->devpath) != 0) { - dbg("'%s' not found in database, ignore event", udev->name); - return -1; - } - if (udev->ignore_remove) { - dbg("remove event for '%s' requested to be ignored by rule", udev->name); - return 0; + if (udev_db_get_device(udev, udev->devpath) == 0) { + if (udev->ignore_remove) { + dbg("remove event for '%s' requested to be ignored by rule", udev->name); + return 0; + } + dbg("remove name='%s'", udev->name); + udev_db_delete_device(udev); + } else { + dbg("'%s' not found in database, using kernel name '%s'", udev->devpath, udev->kernel_name); + strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); } - dbg("remove name='%s'", udev->name); - udev_db_delete_device(udev); - /* use full path to the environment */ snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); udev->devname[sizeof(udev->devname)-1] = '\0'; -- cgit v1.2.3-54-g00ecf From f41951c8407ab39f4c514e8751457857a7fb5722 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Jul 2005 01:44:34 +0200 Subject: set default device node to /dev Using prefix seems pretty useless and the empty /udev with every "make install" is annoying. Signed-off-by: Kay Sievers --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 302bb3da14..25e0825247 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} # place to put our device nodes -udevdir = ${prefix}/udev +udevdir = /dev udevdb = ${udevdir}/.udevdb # set up PWD so that older versions of make will work with our build. -- cgit v1.2.3-54-g00ecf From 2858b86c6a2cabe809088c545e39de76ae906ee7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Jul 2005 02:01:16 +0200 Subject: don't resolve OWNER, GROUP on precompile if string contains %, $ Signed-off-by: Kay Sievers --- udev_rules_parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 2ec9348b01..c36fc8224c 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -371,7 +371,7 @@ static int add_to_rules(struct udev_rules *rules, char *line) if (strcasecmp(key, "OWNER") == 0) { valid = 1; - if (rules->resolve_names) { + if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { char *endptr; strtoul(value, &endptr, 10); if (endptr[0] != '\0') { @@ -390,7 +390,7 @@ static int add_to_rules(struct udev_rules *rules, char *line) if (strcasecmp(key, "GROUP") == 0) { valid = 1; - if (rules->resolve_names) { + if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { char *endptr; strtoul(value, &endptr, 10); if (endptr[0] != '\0') { -- cgit v1.2.3-54-g00ecf From ebfc1acd48606d9f2967d92f265010edf010634b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Jul 2005 02:02:05 +0200 Subject: udevd: optimize env-key parsing Signed-off-by: Kay Sievers --- udevd.c | 30 ++++++++++++++++-------------- udevd.h | 1 + 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/udevd.c b/udevd.c index f69abc4c09..8782c615e3 100644 --- a/udevd.c +++ b/udevd.c @@ -105,7 +105,7 @@ static void msg_dump_queue(void) #endif } -static void run_queue_delete(struct uevent_msg *msg) +static void msg_queue_delete(struct uevent_msg *msg) { list_del(&msg->node); free(msg); @@ -189,7 +189,7 @@ static void execute_udev(struct uevent_msg *msg) break; case -1: err("fork of child failed"); - run_queue_delete(msg); + msg_queue_delete(msg); break; default: /* get SIGCHLD in main loop */ @@ -457,6 +457,8 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) int bufpos; int i; struct uevent_msg *msg; + int major = 0; + int minor = 0; msg = malloc(sizeof(struct uevent_msg) + buf_size); if (msg == NULL) @@ -479,22 +481,22 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) /* remember some keys for further processing */ if (strncmp(key, "ACTION=", 7) == 0) msg->action = &key[7]; - - if (strncmp(key, "DEVPATH=", 8) == 0) + else if (strncmp(key, "DEVPATH=", 8) == 0) msg->devpath = &key[8]; - - if (strncmp(key, "SUBSYSTEM=", 10) == 0) + else if (strncmp(key, "SUBSYSTEM=", 10) == 0) msg->subsystem = &key[10]; - - if (strncmp(key, "SEQNUM=", 7) == 0) + else if (strncmp(key, "SEQNUM=", 7) == 0) msg->seqnum = strtoull(&key[7], NULL, 10); - - if (strncmp(key, "PHYSDEVPATH=", 12) == 0) + else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) msg->physdevpath = &key[12]; - - if (strncmp(key, "TIMEOUT=", 8) == 0) + else if (strncmp(key, "MAJOR=", 6) == 0) + major = strtoull(&key[6], NULL, 10); + else if (strncmp(key, "MINOR=", 6) == 0) + minor = strtoull(&key[6], NULL, 10); + else if (strncmp(key, "TIMEOUT=", 8) == 0) msg->timeout = strtoull(&key[8], NULL, 10); } + msg->devt = makedev(major, minor); msg->envp[i++] = "UDEVD_EVENT=1"; msg->envp[i] = NULL; @@ -604,7 +606,7 @@ static struct uevent_msg *get_netlink_msg(void) if ((size_t)size > sizeof(buffer)-1) size = sizeof(buffer)-1; buffer[size] = '\0'; - dbg("uevent_size=%li", (long)size); + dbg("uevent_size=%zi", size); /* start of event payload */ bufpos = strlen(buffer)+1; @@ -679,7 +681,7 @@ static void udev_done(int pid) if (msg->pid == pid) { sysinfo(&info); info("seq %llu exit, %ld seconds old", msg->seqnum, info.uptime - msg->queue_time); - run_queue_delete(msg); + msg_queue_delete(msg); /* we want to run the exec queue manager since there may * be events waiting with the devpath of the one that diff --git a/udevd.h b/udevd.h index 34bfe931ba..c60fb139c0 100644 --- a/udevd.h +++ b/udevd.h @@ -74,6 +74,7 @@ struct uevent_msg { char *action; char *devpath; char *subsystem; + dev_t devt; unsigned long long seqnum; char *physdevpath; unsigned int timeout; -- cgit v1.2.3-54-g00ecf From 8815afa1df0dbb0b366156d4cebc56468906118c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Jul 2005 14:42:26 +0200 Subject: rename ALARM_TIMEOUT to UDEV_ALARM_TIMEOUT Signed-off-by: Kay Sievers --- udev.c | 2 +- udev.h | 3 +-- udevstart.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/udev.c b/udev.c index 7a0484472a..d44f73081d 100644 --- a/udev.c +++ b/udev.c @@ -96,7 +96,7 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGTERM, &act, NULL); /* trigger timeout to prevent hanging processes */ - alarm(ALARM_TIMEOUT); + alarm(UDEV_ALARM_TIMEOUT); action = getenv("ACTION"); devpath = getenv("DEVPATH"); diff --git a/udev.h b/udev.h index b5287bb53f..a8be0ed400 100644 --- a/udev.h +++ b/udev.h @@ -29,9 +29,7 @@ #include "libsysfs/sysfs/libsysfs.h" #include "list.h" -#define ALARM_TIMEOUT 120 #define COMMENT_CHARACTER '#' - #define LINE_SIZE 512 #define NAME_SIZE 128 #define PATH_SIZE 256 @@ -40,6 +38,7 @@ #define VALUE_SIZE 128 #define DEFAULT_PARTITIONS_COUNT 15 +#define UDEV_ALARM_TIMEOUT 120 enum device_type { DEV_UNKNOWN, diff --git a/udevstart.c b/udevstart.c index 4ef92fd537..d9912466ca 100644 --- a/udevstart.c +++ b/udevstart.c @@ -359,7 +359,7 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGTERM, &act, NULL); /* trigger timeout to prevent hanging processes */ - alarm(ALARM_TIMEOUT); + alarm(UDEV_ALARM_TIMEOUT); udev_rules_init(&rules, 1); -- cgit v1.2.3-54-g00ecf From 1196e46c339e0df96ee972a5bae5cc8f84bf8990 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Jul 2005 21:36:21 +0200 Subject: we want to provide OPTFLAGS Signed-off-by: Kay Sievers --- Makefile | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 25e0825247..fd2a3f2b4a 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,7 @@ EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false +VERSION = 060 ROOT = udev DAEMON = udevd SENDER = udevsend @@ -51,7 +52,6 @@ CONTROL = udevcontrol INFO = udevinfo TESTER = udevtest STARTER = udevstart -VERSION = 060 RELEASE_NAME = $(ROOT)-$(VERSION) LOCAL_CFG_DIR = etc/udev DESTDIR = @@ -102,19 +102,18 @@ GCCINCDIR := ${shell LC_ALL=C $(CC) -print-search-dirs | sed -ne "s/install: \(. # code taken from uClibc to determine the libgcc.a filename GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) -# use '-Os' optimization if available, else use -O2 -OPTIMIZATION := ${shell if $(CC) -Os -S -o /dev/null -xc /dev/null >/dev/null 2>&1; \ - then echo "-Os"; else echo "-O2" ; fi} - # check if compiler option is supported -cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; fi;} +cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;} CFLAGS += -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith -Wstrict-prototypes -Wsign-compare -CFLAGS += $(call cc-supports,-Wno-pointer-sign) -CFLAGS += $(call cc-supports,-Wdeclaration-after-statement) +CFLAGS += $(call cc-supports, -Wno-pointer-sign, ) +CFLAGS += $(call cc-supports, -Wdeclaration-after-statement, ) CFLAGS += -pipe CFLAGS += -D_GNU_SOURCE +# use '-Os' optimization if available, else use -O2 +OPTFLAGS := $(call cc-supports, -Os, -O2) + HEADERS = \ udev.h \ udev_utils.h \ @@ -165,7 +164,7 @@ ifeq ($(strip $(DEBUG)),true) LDFLAGS += -Wl STRIPCMD = /bin/true -Since_we_are_debugging else - CFLAGS += $(OPTIMIZATION) -fomit-frame-pointer + CFLAGS += $(OPTFLAGS) -fomit-frame-pointer LDFLAGS += -s -Wl STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment endif -- cgit v1.2.3-54-g00ecf From 040e26dc99b84a122ddc4a5bee75f4772766078c Mon Sep 17 00:00:00 2001 From: Greg KH Date: Wed, 6 Jul 2005 13:09:05 -0700 Subject: Sync up the Debian rules files --- etc/udev/debian/cd-aliases.rules | 14 ++- etc/udev/debian/compat.rules | 68 +++++------ etc/udev/debian/devfs.rules | 196 ++++++++++++++++---------------- etc/udev/debian/hotplugd.rules | 8 ++ etc/udev/debian/permissions.rules | 104 +++++++++-------- etc/udev/debian/run.rules | 7 ++ etc/udev/debian/simple-cd-aliases.rules | 8 +- etc/udev/debian/udev.rules | 108 +++++++++--------- 8 files changed, 276 insertions(+), 237 deletions(-) create mode 100644 etc/udev/debian/hotplugd.rules create mode 100644 etc/udev/debian/run.rules diff --git a/etc/udev/debian/cd-aliases.rules b/etc/udev/debian/cd-aliases.rules index 7137527628..b96d3a571d 100644 --- a/etc/udev/debian/cd-aliases.rules +++ b/etc/udev/debian/cd-aliases.rules @@ -3,9 +3,15 @@ # # If you would like to statically configure the aliases instead, you can # use rules like: -# BUS="ide", ID="1.0", SYMLINK="cdrom" +# BUS=="ide", ID=="1.0", SYMLINK+="cdrom" -BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS="ide", KERNEL="pcd[0-9]*", SYSFS{removable}="1", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS=="scsi", KERNEL=="sr[0-9]*", \ + PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", \ + SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ + PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", \ + SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS=="ide", KERNEL=="pcd[0-9]*", SYSFS{removable}=="1", \ + PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", \ + SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" diff --git a/etc/udev/debian/compat.rules b/etc/udev/debian/compat.rules index ec386ea8c4..09bb07441b 100644 --- a/etc/udev/debian/compat.rules +++ b/etc/udev/debian/compat.rules @@ -1,37 +1,37 @@ # compatibility links for a devfs-style /dev -KERNEL="md[0-9]*", SYMLINK="%k" -#KERNEL="loop[0-9]*", SYMLINK="%k" - -#KERNEL="tty[0-9]*", SYMLINK="%k" -#KERNEL="ttyS[0-9]*", SYMLINK="%k" -#KERNEL="ttyUSB[0-9]*", SYMLINK="%k" - -#KERNEL="vcs", SYMLINK="%k" -#KERNEL="vcs[0-9]*", SYMLINK="%k" -#KERNEL="vcsa", SYMLINK="%k" -#KERNEL="vcsa[0-9]*", SYMLINK="%k" - -KERNEL="video0", SYMLINK="%k" -KERNEL="radio0", SYMLINK="%k" -KERNEL="vbi0", SYMLINK="%k" -KERNEL="vtx0", SYMLINK="%k" - -KERNEL="apm_bios", SYMLINK="%k" -KERNEL="agpgart", SYMLINK="%k" -#KERNEL="psaux", SYMLINK="%k" -#KERNEL="nvram", SYMLINK="%k" -KERNEL="rtc", SYMLINK="%k" -#KERNEL="ram[0-9]*", SYMLINK="%k" - -#KERNEL="i2c-[0-9]*", SYMLINK="%k" -#KERNEL="lp[0-9]*", SYMLINK="%k" - -KERNEL="audio" SYMLINK="%k" -KERNEL="dsp" SYMLINK="%k" -KERNEL="mixer" SYMLINK="%k" - -#KERNEL="fb[0-9]*", SYMLINK="%k" -#KERNEL="fd[0-9]*", SYMLINK="%k" -#KERNEL="js[0-9]*", SYMLINK="%k" +KERNEL=="md[0-9]*", SYMLINK+="%k" +#KERNEL=="loop[0-9]*", SYMLINK+="%k" + +#KERNEL=="tty[0-9]*", SYMLINK+="%k" +#KERNEL=="ttyS[0-9]*", SYMLINK+="%k" +#KERNEL=="ttyUSB[0-9]*", SYMLINK+="%k" + +#KERNEL=="vcs", SYMLINK+="%k" +#KERNEL=="vcs[0-9]*", SYMLINK+="%k" +#KERNEL=="vcsa", SYMLINK+="%k" +#KERNEL=="vcsa[0-9]*", SYMLINK+="%k" + +KERNEL=="video*", SYMLINK+="%k" +KERNEL=="radio*", SYMLINK+="%k" +KERNEL=="vbi*", SYMLINK+="%k" +KERNEL=="vtx*", SYMLINK+="%k" + +KERNEL=="apm_bios", SYMLINK+="%k" +KERNEL=="agpgart", SYMLINK+="%k" +#KERNEL=="psaux", SYMLINK+="%k" +#KERNEL=="nvram", SYMLINK+="%k" +KERNEL=="rtc", SYMLINK+="%k" +#KERNEL=="ram[0-9]*", SYMLINK+="%k" + +#KERNEL=="i2c-[0-9]*", SYMLINK+="%k" +#KERNEL=="lp[0-9]*", SYMLINK+="%k" + +KERNEL=="audio*" SYMLINK+="%k" +KERNEL=="dsp*" SYMLINK+="%k" +KERNEL=="mixer*" SYMLINK+="%k" + +#KERNEL=="fb[0-9]*", SYMLINK+="%k" +#KERNEL=="fd[0-9]*", SYMLINK+="%k" +#KERNEL=="js[0-9]*", SYMLINK+="%k" diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index 0453e66d5f..89e0db2aac 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -4,141 +4,145 @@ # %n the "kernel number" of the device. # For example, 'sda3' has a "kernel number" of '3' # %e the smallest number for that name which does not matches an existing node -# %k the kernel name for the device. +# %k the kernel name for the device # %M the kernel major number for the device # %m the kernel minor number for the device # %b the bus id for the device # %c the string returned by the PROGRAM -# %s{filename} the content of a sysfs attribute. -# %% the '%' char itself. +# %s{filename} the content of a sysfs attribute +# %% the '%' char itself # # workaround for devices which do not report media changes -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT="IOMEGA ZIP *", \ - OPTIONS="all_partitions", NAME="%k" +BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ + PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT=="IOMEGA ZIP *", \ + NAME="%k", OPTIONS+="all_partitions" # IDE devices -BUS="ide", KERNEL="hd[a-z]*", \ - PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}" +BUS=="ide", KERNEL=="hd[a-z]*", \ + PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK+="%k %c{2}" # SCSI devices -BUS="scsi", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK="%k %c{2}" +BUS=="scsi", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK+="%k %c{2}" # RAID controllers -KERNEL="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ - NAME="%c{1}", SYMLINK="%k" -KERNEL="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ - NAME="%c{1}", SYMLINK="%k" -KERNEL="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ - NAME="%c{1}", SYMLINK="%k" +KERNEL=="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ + NAME="%c{1}", SYMLINK+="%k" +KERNEL=="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ + NAME="%c{1}", SYMLINK+="%k" +KERNEL=="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ + NAME="%c{1}", SYMLINK+="%k" # other block devices -KERNEL="md[0-9]*", NAME="md/%n", -KERNEL="loop[0-9]*", NAME="loop/%n" -KERNEL="ram[0-9]*", NAME="rd/%n" +KERNEL=="md[0-9]*", NAME="md/%n", +KERNEL=="loop[0-9]*", NAME="loop/%n" +KERNEL=="ram[0-9]*", NAME="rd/%n" # USB devices -BUS="usb", KERNEL="auer[0-9]*", NAME="usb/%k" -BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" -BUS="usb", KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="hiddev*", NAME="usb/%k" -BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" -BUS="usb", KERNEL="ttyUSB*", SYSFS{product}="Palm Handheld*", SYMLINK="pilot" +BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ + SYMLINK+="pilot" # serial devices -KERNEL="ttyS[0-9]*", NAME="tts/%n" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" -KERNEL="rfcomm[0-9]*", NAME="bluetooth/rfcomm/%n", -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi[0-9]*", NAME="capi/%n" +KERNEL=="ttyS[0-9]*", NAME="tts/%n" +KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n" +KERNEL=="rfcomm[0-9]*", NAME="bluetooth/rfcomm/%n", +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" # vc devices -KERNEL="tty[0-9]*", NAME="vc/%n" -KERNEL="vcs", NAME="vcc/0" -KERNEL="vcs[0-9]*", NAME="vcc/%n" -KERNEL="vcsa", NAME="vcc/a0" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n" +KERNEL=="tty[0-9]*", NAME="vc/%n" +KERNEL=="vcs", NAME="vcc/0" +KERNEL=="vcs[0-9]*", NAME="vcc/%n" +KERNEL=="vcsa", NAME="vcc/a0" +KERNEL=="vcsa[0-9]*", NAME="vcc/a%n" # video devices -KERNEL="video[0-9]*", NAME="v4l/%k" -KERNEL="radio[0-9]*", NAME="v4l/%k" -KERNEL="vbi[0-9]*", NAME="v4l/%k" -KERNEL="vtx[0-9]*", NAME="v4l/%k" -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" -KERNEL="fb[0-9]*", NAME="fb/%n" -KERNEL="card[0-9]*", NAME="dri/%k" +KERNEL=="video[0-9]*", NAME="v4l/%k" +KERNEL=="radio[0-9]*", NAME="v4l/%k" +KERNEL=="vbi[0-9]*", NAME="v4l/%k" +KERNEL=="vtx[0-9]*", NAME="v4l/%k" +KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ + NAME="%c" +KERNEL=="fb[0-9]*", NAME="fb/%n" +KERNEL=="card[0-9]*", NAME="dri/%k" # misc devices -KERNEL="apm_bios", NAME="misc/%k", -KERNEL="agpgart", NAME="misc/%k" -KERNEL="nvram", NAME="misc/%k" -KERNEL="psaux", NAME="misc/%k" -KERNEL="rtc", NAME="misc/%k" -KERNEL="hw_random", NAME="hwrng" +KERNEL=="apm_bios", NAME="misc/%k", +KERNEL=="agpgart", NAME="misc/%k" +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="nvram", NAME="misc/%k" +KERNEL=="psaux", NAME="misc/%k" +KERNEL=="rtc", NAME="misc/%k" +KERNEL=="tun", NAME="net/%k" # printers and parallel devices -KERNEL="lp[0-9]*", NAME="printers/%n" -KERNEL="parport[0-9]*", NAME="parports/%n" +KERNEL=="lp[0-9]*", NAME="printers/%n" +KERNEL=="parport[0-9]*", NAME="parports/%n" -KERNEL="i2c-[0-9]*", NAME="i2c/%n" -KERNEL="fd[0-9]*", NAME="floppy/%n" +KERNEL=="i2c-[0-9]*", NAME="i2c/%n" +KERNEL=="fd[0-9]*", NAME="floppy/%n" -KERNEL="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL="pktcdvd", NAME="pktcdvd/control" +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL="microcode", NAME="cpu/microcode" +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" -KERNEL="umad*", NAME="infiniband/%k" -KERNEL="issm*", NAME="infiniband/%k" - -KERNEL="tap[0-9]*", NAME="net/%k" -KERNEL="tun", NAME="net/%k" +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" # sound devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hwC[D0-9]*", NAME="snd/%k" -KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL="midiC[D0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" -KERNEL="audio*", NAME="sound/%k" -KERNEL="dsp*", NAME="sound/%k" -KERNEL="adsp*", NAME="sound/%k" -KERNEL="midi*", NAME="sound/%k" -KERNEL="mixer*", NAME="sound/%k" -KERNEL="sequencer*", NAME="sound/%k" -KERNEL="amidi*", NAME="sound/%k" -KERNEL="dmmidi*", NAME="sound/%k" -KERNEL="admmidi*", NAME="sound/%k" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" +KERNEL=="audio*", NAME="sound/%k" +KERNEL=="dsp*", NAME="sound/%k" +KERNEL=="adsp*", NAME="sound/%k" +KERNEL=="midi*", NAME="sound/%k" +KERNEL=="mixer*", NAME="sound/%k" +KERNEL=="sequencer*", NAME="sound/%k" +KERNEL=="amidi*", NAME="sound/%k" +KERNEL=="dmmidi*", NAME="sound/%k" +KERNEL=="admmidi*", NAME="sound/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" # input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse[0-9]*", NAME="input/%k" -KERNEL="event[0-9]*", NAME="input/%k" -KERNEL="js[0-9]*", NAME="input/%k" -KERNEL="ts[0-9]*", NAME="input/%k" -KERNEL="uinput", NAME="input/%k" +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" # Zaptel -KERNEL="zapctl", NAME="zap/ctl" -KERNEL="zaptimer", NAME="zap/timer" -KERNEL="zapchannel", NAME="zap/channel" -KERNEL="zappseudo", NAME="zap/pseudo" -KERNEL="zap[0-9]*", NAME="zap/%n" +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" # AOE character devices -SUBSYSTEM="aoe", KERNEL="discover", NAME="etherd/%k" -SUBSYSTEM="aoe", KERNEL="err", NAME="etherd/%k" -SUBSYSTEM="aoe", KERNEL="interfaces", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" # device mapper creates its own device nodes, so ignore these -KERNEL="dm-[0-9]*", OPTIONS="ignore_device" -KERNEL="device-mapper", NAME="mapper/control" +KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="device-mapper", NAME="mapper/control" diff --git a/etc/udev/debian/hotplugd.rules b/etc/udev/debian/hotplugd.rules new file mode 100644 index 0000000000..cf84682abf --- /dev/null +++ b/etc/udev/debian/hotplugd.rules @@ -0,0 +1,8 @@ +# do not call hotplug.d and dev.d for "drivers" and "module" events +SUBSYSTEM=="drivers", OPTIONS="last_rule" +SUBSYSTEM=="module", OPTIONS="last_rule" + +# compatibility support for the obsolete hotplug.d and dev.d directories +ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" +RUN+="/sbin/udev_run_devd" + diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index 48510e67f6..aab6fdbd08 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -1,73 +1,81 @@ # default permissions for block devices -SUBSYSTEM="block", GROUP="disk" -SUBSYSTEM="block", SYSFS{removable}="1", GROUP="floppy" +SUBSYSTEM=="block", GROUP="disk" +SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" # IDE devices -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", GROUP="cdrom" -BUS="ide", KERNEL="ht[0-9]*", GROUP="tape" -BUS="ide", KERNEL="nht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}="1", \ + PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom*", GROUP="cdrom" +BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" # SCSI devices -BUS="scsi", SYSFS{type}="1", GROUP="tape" -BUS="scsi", SYSFS{type}="5", GROUP="cdrom" -BUS="scsi", SYSFS{type}="6", GROUP="scanner" +BUS=="scsi", SYSFS{type}=="1", GROUP="tape" +BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom" +BUS=="scsi", SYSFS{type}=="6", GROUP="scanner" # USB devices -BUS="usb", KERNEL="legousbtower*", MODE="0666" +BUS=="usb", KERNEL=="legousbtower*", MODE="0666" +BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" # serial devices -SUBSYSTEM="tty", GROUP="dialout" -SUBSYSTEM="capi", GROUP="dialout" +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" # vc devices (all members of the tty subsystem) -KERNEL="ptmx", MODE="0666", GROUP="root" -KERNEL="console", MODE="0600", GROUP="root" -KERNEL="tty", MODE="0666", GROUP="root" -KERNEL="tty[0-9]*", GROUP="root" +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" # video devices -SUBSYSTEM="video4linux", GROUP="video" -SUBSYSTEM="dvb", GROUP="video" -SUBSYSTEM="graphics", GROUP="video" -SUBSYSTEM="nvidia", GROUP="video" -SUBSYSTEM="drm", GROUP="video" +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" # misc devices -KERNEL="random", MODE="0666" -KERNEL="urandom", MODE="0444" -KERNEL="mem", MODE="0640", GROUP="kmem" -KERNEL="kmem", MODE="0640", GROUP="kmem" -KERNEL="port", MODE="0640", GROUP="kmem" -KERNEL="full", MODE="0666" -KERNEL="null", MODE="0666" -KERNEL="zero", MODE="0666" -KERNEL="inotify", MODE="0666" -KERNEL="sgi_fetchop", MODE="0666" -KERNEL="sonypi", MODE="0666" -KERNEL="agpgart", GROUP="video" -KERNEL="nvram", GROUP="nvram" -KERNEL="rtc", MODE="0660", GROUP="audio" +KERNEL=="random", MODE="0666" +KERNEL=="urandom", MODE="0444" +KERNEL=="mem", MODE="0640", GROUP="kmem" +KERNEL=="kmem", MODE="0640", GROUP="kmem" +KERNEL=="port", MODE="0640", GROUP="kmem" +KERNEL=="full", MODE="0666" +KERNEL=="null", MODE="0666" +KERNEL=="zero", MODE="0666" +KERNEL=="inotify", MODE="0666" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="nvram", GROUP="nvram" +KERNEL=="rtc", MODE="0660", GROUP="audio" -KERNEL="cdemu[0-9]*", GROUP="cdrom" -KERNEL="pktcdvd[0-9]*", GROUP="cdrom" -KERNEL="pktcdvd", MODE="0644" +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" # printers and parallel devices -SUBSYSTEM="printer", GROUP="lp" -SUBSYSTEM="ppdev", GROUP="lp" -KERNEL="pt[0-9]*", GROUP="tape" -KERNEL="pht[0-9]*", GROUP="tape" +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" # sound devices -SUBSYSTEM="sound", GROUP="audio" +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" # input devices -KERNEL="event[0-9]*", PROGRAM="/etc/udev/scripts/inputdev.sh %k", \ - RESULT="inputdev", MODE="0664", GROUP="video" -KERNEL="js[0-9]*", MODE="0664" +KERNEL=="event[0-9]*", PROGRAM="/etc/udev/scripts/inputdev.sh %k", \ + RESULT=="inputdev", MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" # AOE character devices -SUBSYSTEM="aoe", MODE="0220", GROUP="disk" -SUBSYSTEM="aoe", KERNEL="err", MODE="0440" +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" diff --git a/etc/udev/debian/run.rules b/etc/udev/debian/run.rules new file mode 100644 index 0000000000..0e28d189be --- /dev/null +++ b/etc/udev/debian/run.rules @@ -0,0 +1,7 @@ +# ignore the events generated by virtual consoles +KERNEL=="ptmx", OPTIONS+="last_rule" +KERNEL=="console", OPTIONS+="last_rule" +KERNEL=="tty" , OPTIONS+="last_rule" +KERNEL=="tty[0-9]*", OPTIONS+="last_rule" +SUBSYSTEM=="vc", OPTIONS+="last_rule" + diff --git a/etc/udev/debian/simple-cd-aliases.rules b/etc/udev/debian/simple-cd-aliases.rules index bd700bc29f..45ffeeac6b 100644 --- a/etc/udev/debian/simple-cd-aliases.rules +++ b/etc/udev/debian/simple-cd-aliases.rules @@ -1,5 +1,7 @@ # grouping of optical drives from multiple kernel subsystems -BUS="scsi", KERNEL="sr[0-9]*", SYMLINK="cdrom%e" -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", SYMLINK="cdrom%e", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom" -BUS="ide", KERNEL="pcd[0-9]*", SYSFS{removable}="1", SYMLINK="cdrom%e" +BUS=="scsi", KERNEL=="sr[0-9]*", SYMLINK+="cdrom%e" +BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ + PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom", \ + SYMLINK+="cdrom%e" +BUS=="ide", KERNEL=="pcd[0-9]*", SYSFS{removable}=="1", SYMLINK+="cdrom%e" diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index a506a02ad3..07087a3a36 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -4,86 +4,90 @@ # %n the "kernel number" of the device. # For example, 'sda3' has a "kernel number" of '3' # %e the smallest number for that name which does not matches an existing node -# %k the kernel name for the device. +# %k the kernel name for the device # %M the kernel major number for the device # %m the kernel minor number for the device # %b the bus id for the device # %c the string returned by the PROGRAM -# %s{filename} the content of a sysfs attribute. -# %% the '%' char itself. +# %s{filename} the content of a sysfs attribute +# %% the '%' char itself # # workaround for devices which do not report media changes -BUS="ide", KERNEL="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT="IOMEGA ZIP *", \ - OPTIONS="all_partitions", NAME="%k" +BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ + PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT=="IOMEGA ZIP *", \ + NAME="%k", OPTIONS+="all_partitions" # SCSI devices -BUS="scsi", KERNEL="sr[0-9]*", NAME="scd%n", SYMLINK="sr%n" +BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" # USB devices -BUS="usb", KERNEL="hiddev*", NAME="usb/%k" -BUS="usb", KERNEL="auer[0-9]*", NAME="usb/%k" -BUS="usb", KERNEL="legousbtower*", NAME="usb/%k" -BUS="usb", KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="cpad[0-9]*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" -BUS="usb", KERNEL="ttyUSB*", SYSFS{product}="Palm Handheld*", SYMLINK="pilot" +BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ + SYMLINK+=="pilot" # serial devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi[0-9]*", NAME="capi/%n" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" # video devices -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c" -KERNEL="card[0-9]*", NAME="dri/%k" +KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ + NAME="%c" +KERNEL=="card[0-9]*", NAME="dri/%k" # misc devices -KERNEL="hw_random", NAME="hwrng" +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" -KERNEL="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL="pktcdvd", NAME="pktcdvd/control" +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL="microcode", NAME="cpu/microcode" +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" -KERNEL="umad*", NAME="infiniband/%k" -KERNEL="issm*", NAME="infiniband/%k" - -KERNEL="tap[0-9]*", NAME="net/%k" -KERNEL="tun", NAME="net/%k" +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" # ALSA devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hwC[D0-9]*", NAME="snd/%k" -KERNEL="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL="midiC[D0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" # input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse[0-9]*", NAME="input/%k" -KERNEL="event[0-9]*", NAME="input/%k" -KERNEL="js[0-9]*", NAME="input/%k" -KERNEL="ts[0-9]*", NAME="input/%k" -KERNEL="uinput", NAME="input/%k" +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" # Zaptel -KERNEL="zapctl", NAME="zap/ctl" -KERNEL="zaptimer", NAME="zap/timer" -KERNEL="zapchannel", NAME="zap/channel" -KERNEL="zappseudo", NAME="zap/pseudo" -KERNEL="zap[0-9]*", NAME="zap/%n" +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" # AOE character devices -SUBSYSTEM="aoe", KERNEL="discover", NAME="etherd/%k" -SUBSYSTEM="aoe", KERNEL="err", NAME="etherd/%k" -SUBSYSTEM="aoe", KERNEL="interfaces", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" # device mapper creates its own device nodes, so ignore these -KERNEL="dm-[0-9]*", OPTIONS="ignore_device" -KERNEL="device-mapper", NAME="mapper/control" +KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="device-mapper", NAME="mapper/control" -- cgit v1.2.3-54-g00ecf From 0cc976eeaf6370490e1f40faf7926180cfeb85fe Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 6 Jul 2005 13:15:23 -0700 Subject: fix cdrom symlink problem in gentoo rules --- etc/udev/gentoo/udev.rules | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index de74c088f0..a0e17359ba 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -16,13 +16,13 @@ SUBSYSTEM=="block", GROUP="disk" # cdrom symlinks and other good cdrom naming -BUS=="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS=="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS=="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS=="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS=="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +BUS=="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" # devfs-names for ide-devices (uncomment only one) # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS=="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" +BUS=="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK+="%c{1} %c{2}", GROUP="%c{3}" # disk devices KERNEL=="sd*", NAME="%k", GROUP="disk" @@ -139,8 +139,8 @@ KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" # tty devices KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty" -KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty" +KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="tty" KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" KERNEL=="ippp0", NAME="%k", GROUP="tty" KERNEL=="isdn*" NAME="%k", GROUP="tty" @@ -249,9 +249,9 @@ KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems -# run hotplug.d/ stuff only if we came from a hotplug event, not for udevstart +# run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" -# always run dev.d/ stuff for now. +# always run /etc/dev.d/ stuff for now. RUN+="/sbin/udev_run_devd" -- cgit v1.2.3-54-g00ecf From 133dd3ce3361fdb03b5761d0b980b9e70f7cfca7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Jul 2005 22:17:06 +0200 Subject: update RELEASE-NOTES Signed-off-by: Kay Sievers --- RELEASE-NOTES | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 46787704ce..248944bd51 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,18 @@ +udev 061 +======== +We changed the internal rule storage format. Our large rule files took +2 MB of RAM, with the change we are down to 99kB. + +If the device-node has been created with default name and no symlink or +options are to remenber, it is not longer stored in the udevdb. HAL will +need to be updated to work correctly with that change. + +To overrride optimization flags, OPTFLAGS may be used now. + +udev 060 +======== +Bugfix release. + udev 059 ======== Major changes happened with this release. The goal is to take over the -- cgit v1.2.3-54-g00ecf From a82f23bf96bf6e05ae7e986678f411dfa2ad65cc Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 6 Jul 2005 14:24:08 -0700 Subject: 061 release --- ChangeLog | 26 ++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2e641fc4a..4ecd186f90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +Summary of changes from v060 to v061 +============================================ + +Greg Kroah-Hartman: + Sync up the Debian rules files + fix cdrom symlink problem in gentoo rules + Fix ChangeLog titles + +Kay Sievers: + update RELEASE-NOTES + we want to provide OPTFLAGS + rename ALARM_TIMEOUT to UDEV_ALARM_TIMEOUT + udevd: optimize env-key parsing + don't resolve OWNER, GROUP on precompile if string contains %, $ + set default device node to /dev + create udevdb files only if somehting interesting happened + pack parsed rules list + replace useless defines by inline text + move rule matches to function + add usb_id program to generate usb-storage device identifiers + add IEEE1394 rules to the gentoo rule file + fake also kernel-name if we renamed a netif + allow OPTIONS to be recognized for /sys/modules /sys/devices events + switch gentoo rules to new operators + + Summary of changes from v059 to v060 ============================================ diff --git a/Makefile b/Makefile index fd2a3f2b4a..1db74b038b 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false -VERSION = 060 +VERSION = 061 ROOT = udev DAEMON = udevd SENDER = udevsend diff --git a/udev.spec b/udev.spec index d56a43ce7d..11cc2430f9 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 059 +Version: 061 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 5f79d72c436e9433080feff93be965ec79b17ec2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2005 16:02:03 +0200 Subject: fix unquoted strings in udevinitsend Signed-off-by: Kay Sievers --- udevinitsend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udevinitsend.c b/udevinitsend.c index 26ae5c8418..204e9cecd5 100644 --- a/udevinitsend.c +++ b/udevinitsend.c @@ -132,11 +132,11 @@ static int udevsend(char *filename, int sock, int disable_loop_detection) strncpy(&usend_msg.envbuf[bufpos],ls,(ch - ls) + 1); bufpos += (ch - ls) + 1; if (ch[1] == '\'' && le[-1] == '\'') { - strncpy(&usend_msg.envbuf[bufpos],ch + 2, (le - ch) -3); + strncpy(&usend_msg.envbuf[bufpos],ch + 2, (le - ch) - 3); bufpos += (le - ch) - 3; } else { - strncpy(&usend_msg.envbuf[bufpos],ch, (le - ch)); - bufpos += (le - ch); + strncpy(&usend_msg.envbuf[bufpos],ch + 1, (le - ch) - 1); + bufpos += (le - ch) - 1; } bufpos++; } -- cgit v1.2.3-54-g00ecf From b2fe4b9ac96c254efa68d747bfb9843c438919a0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2005 20:05:51 +0200 Subject: add WAIT_FOR_SYSFS key to loop until a file in sysfs arrives Signed-off-by: Kay Sievers --- udev_rules.c | 44 +++++++++++++++++++++++++++++++++++++++++--- udev_rules.h | 1 + udev_rules_parse.c | 6 ++++++ 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 48397ac1c7..932a5b9c6f 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -335,6 +335,28 @@ attr_found: return 0; } +#define WAIT_LOOP_PER_SECOND 20 +static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) +{ + char filename[PATH_SIZE]; + struct stat stats; + int loop = timeout * WAIT_LOOP_PER_SECOND; + + snprintf(filename, sizeof(filename), "%s%s/%s", sysfs_path, udev->devpath, file); + filename[sizeof(filename)-1] = '\0'; + dbg("wait %i sec for '%s'", timeout, filename); + + while (--loop) { + if (stat(filename, &stats) == 0) { + dbg("file appeared after %i loops", (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + return 0; + } + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + dbg("waiting for '%s' failed", filename); + return -1; +} + static void apply_format(struct udevice *udev, char *string, size_t maxsize, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { @@ -622,15 +644,15 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k dbg("check for %s '%s' <-> '%s'", key_name, key_value, val); match = (strcmp_pattern(key_value, val) == 0); if (match && (key->operation != KEY_OP_NOMATCH)) { - dbg("%s key is matching (matching value)", key_name); + dbg("%s is matching (matching value)", key_name); return 0; } if (!match && (key->operation == KEY_OP_NOMATCH)) { - dbg("%s key is matching, (non matching value)", key_name); + dbg("%s is matching, (non matching value)", key_name); return 0; } - dbg("%s key is not matching", key_name); + dbg("%s is not matching", key_name); return -1; } @@ -681,6 +703,22 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, dbg("all %i ENV keys matched", rule->env.count); } + if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { + int match; + + match = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0); + if (match && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) { + dbg("WAIT_FOR_SYSFS is matching (matching value)"); + return 0; + } + if (!match && (rule->wait_for_sysfs.operation == KEY_OP_NOMATCH)) { + dbg("WAIT_FOR_SYSFS is matching, (non matching value)"); + return 0; + } + dbg("WAIT_FOR_SYSFS is not matching"); + return -1; + } + /* walk up the chain of physical devices and find a match */ while (1) { /* check for matching driver */ diff --git a/udev_rules.h b/udev_rules.h index 4ecada1c03..959524a802 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -66,6 +66,7 @@ struct udev_rule { struct key result; struct key modalias; struct key import; + struct key wait_for_sysfs; struct key_pairs sysfs; struct key_pairs env; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index c36fc8224c..2add91fa9f 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -284,6 +284,12 @@ static int add_to_rules(struct udev_rules *rules, char *line) continue; } + if (strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { + add_rule_key(rule, &rule->wait_for_sysfs, operation, value); + valid = 1; + continue; + } + if (strncasecmp(key, "ENV", sizeof("ENV")-1) == 0) { attr = get_key_attribute(key + sizeof("ENV")-1); if (attr == NULL) { -- cgit v1.2.3-54-g00ecf From 613ffbeb15e0507581e5037850c1ea5d56cd0928 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2005 22:32:48 +0200 Subject: fix default-name handling and NAME="" rules Signed-off-by: Kay Sievers --- udev.h | 1 - udev_rules.c | 7 ++++--- udev_rules_parse.c | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/udev.h b/udev.h index a8be0ed400..391dc2c41c 100644 --- a/udev.h +++ b/udev.h @@ -55,7 +55,6 @@ struct udevice { enum device_type type; char name[PATH_SIZE]; - int name_set; char devname[PATH_SIZE]; struct list_head symlink_list; int symlink_final; diff --git a/udev_rules.c b/udev_rules.c index 932a5b9c6f..27fb0a89a6 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -857,6 +857,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s struct sysfs_class_device *class_dev_parent; struct sysfs_device *sysfs_device = NULL; struct udev_rule *rule; + int name_set = 0; dbg("class_dev->name='%s'", class_dev->name); @@ -888,7 +889,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s if (rule == NULL) break; - if (udev->name_set && rule->name.operation != KEY_OP_UNSET) { + if (name_set && rule->name.operation != KEY_OP_UNSET) { dbg("node name already set, rule ignored"); continue; } @@ -970,7 +971,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s /* set name, later rules with name set will be ignored */ if (rule->name.operation != KEY_OP_UNSET) { - udev->name_set = 1; + name_set = 1; strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); @@ -1008,7 +1009,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s } } - if (udev->name[0] == '\0') { + if (!name_set) { strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); info("no rule found, will use kernel name '%s'", udev->name); } diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 2add91fa9f..0021ec40be 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -365,7 +365,12 @@ static int add_to_rules(struct udev_rules *rules, char *line) rule->ignore_remove = 1; } } - add_rule_key(rule, &rule->name, operation, value); + if (value[0] == '\0') { + dbg("name empty device should be ignored"); + rule->name.operation = operation; + rule->ignore_device = 1; + } else + add_rule_key(rule, &rule->name, operation, value); continue; } -- cgit v1.2.3-54-g00ecf From a72e3f666b897f94a64547ace3af74785d2f6771 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2005 22:40:09 +0200 Subject: fix typo in group assignment Thanks to: Georgi Georgiev --- test/udev-test.pl | 26 +++++++++++++++++++++++++- udev_rules_parse.c | 2 +- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 5210471474..6fbc23e557 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1090,7 +1090,8 @@ EOF desc => "ignore rule test", subsys => "block", devpath => "/block/sda", - exp_name => "node", + exp_name => "nothing", + not_exp_name => "node", exp_add_error => "yes", rules => < "test empty NAME", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "node", + not_exp_name => "wrong", + exp_add_error => "yes", + rules => < "test empty NAME 2", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "right", + rules => <owner, operation, group); + add_rule_key(rule, &rule->group, operation, group); continue; } } -- cgit v1.2.3-54-g00ecf From 97c0448d9a5626a28a60cc3306e9360f45409fd9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2005 23:01:04 +0200 Subject: update RELEASE-NOTES Signed-off-by: Kay Sievers --- RELEASE-NOTES | 7 +++++++ udev_rules.c | 1 + 2 files changed, 8 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 248944bd51..db1e6b838f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,10 @@ +udev 062 +======== +Mostly a Bugfix release. + +Added WAIT_FOR_SYSFS="" to be able to fight against the sysfs +timing with custom rules. + udev 061 ======== We changed the internal rule storage format. Our large rule files took diff --git a/udev_rules.c b/udev_rules.c index 27fb0a89a6..41855eb9d7 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "libsysfs/sysfs/libsysfs.h" #include "list.h" -- cgit v1.2.3-54-g00ecf From 7b2bdb4b1bd9e273ea67e4538be3f7d3545331fa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2005 23:43:13 +0200 Subject: fix symlink values separated by multiple spaces Signed-off-by: Kay Sievers --- test/udev-test.pl | 11 +++++++++++ udev_rules.c | 12 +++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 6fbc23e557..873780d70a 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -799,6 +799,17 @@ EOF exp_target => "ttyUSB0", rules => < "multiple symlinks with a lot of s p a c e s", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "one", + not_exp_name => " ", + exp_target => "ttyUSB0", + rules => <symlink_list, pos, 0); + while (isspace(next[1])) + next++; pos = &next[1]; next = strchr(pos, ' '); } - info("add symlink '%s'", pos); - name_list_add(&udev->symlink_list, pos, 0); + if (pos[0] != '\0') { + info("add symlink '%s'", pos); + name_list_add(&udev->symlink_list, pos, 0); + } } /* set name, later rules with name set will be ignored */ -- cgit v1.2.3-54-g00ecf From face198a5f21027fefe796dc01e19e349a2d36ce Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 7 Jul 2005 15:00:50 -0700 Subject: 062 release --- ChangeLog | 11 +++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4ecd186f90..db2f0b0057 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Summary of changes from v061 to v062 +============================================ + +Kay Sievers: + fix symlink values separated by multiple spaces + update RELEASE-NOTES + fix typo in group assignment + fix default-name handling and NAME="" rules + add WAIT_FOR_SYSFS key to loop until a file in sysfs arrives + fix unquoted strings in udevinitsend + Summary of changes from v060 to v061 ============================================ diff --git a/Makefile b/Makefile index 1db74b038b..48ecbd7428 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false -VERSION = 061 +VERSION = 062 ROOT = udev DAEMON = udevd SENDER = udevsend diff --git a/udev.spec b/udev.spec index 11cc2430f9..496065a79b 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 061 +Version: 062 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From b4a2906bf1921cd6cbc25621a6db0bae906616c8 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Fri, 8 Jul 2005 03:29:19 +0200 Subject: fix usb_id and let scsi_id ignore "illegal request" --- extras/scsi_id/scsi_id.c | 8 +++- extras/scsi_id/scsi_serial.c | 6 +++ extras/usb_id/usb_id.c | 94 +++++++++++++++++++++++++++----------------- 3 files changed, 70 insertions(+), 38 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 4003ee6af5..cbefb445df 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -52,7 +52,7 @@ * options are not supported, but other code is still left in place for * now. */ -static const char short_options[] = "bd:f:gip:s:uvVx"; +static const char short_options[] = "abd:f:gip:s:uvVx"; /* * Just duplicate per dev options. */ @@ -61,6 +61,7 @@ static const char dev_short_options[] = "bgp:"; char sysfs_mnt_path[SYSFS_PATH_MAX]; static int all_good; +static int always_info; static char *default_callout; static int dev_specified; static int sys_specified; @@ -485,6 +486,9 @@ static int set_options(int argc, char **argv, const char *short_opts, dprintf("option '%c'\n", option); switch (option) { + case 'a': + always_info = 1; + break; case 'b': all_good = 0; break; @@ -810,7 +814,7 @@ static int scsi_id(const char *target_path, char *maj_min_dev) retval = 1; } else if (scsi_get_serial(scsi_dev, maj_min_dev, page_code, serial, MAX_SERIAL_LEN)) { - retval = 1; + retval = always_info?0:1; } else { retval = 0; } diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 20a7928553..7bfa9d1812 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -89,6 +89,7 @@ static const char hex_str[]="0123456789abcdef"; #define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ #define SG_ERR_CAT_TIMEOUT 3 #define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ #define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ #define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ @@ -130,6 +131,8 @@ static int sg_err_category_new(int scsi_status, int msg_status, int return SG_ERR_CAT_MEDIA_CHANGED; if (0x29 == asc) return SG_ERR_CAT_RESET; + } else if (sense_key == ILLEGAL_REQUEST) { + return SG_ERR_CAT_NOTSUPPORTED; } } return SG_ERR_CAT_SENSE; @@ -331,6 +334,9 @@ resend: retval = sg_err_category3(&io_hdr); switch (retval) { + case SG_ERR_CAT_NOTSUPPORTED: + buf[1] = 0; + /* Fallthrough */ case SG_ERR_CAT_CLEAN: case SG_ERR_CAT_RECOVERED: retval = 0; diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index bca80f8de1..f4011ee899 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -72,7 +72,9 @@ static char revision_str[16]; static char type_str[16]; static int use_usb_info; +static int use_num_info; static int export; +static int debug; static void set_str(char *to, const unsigned char *from, int count) { @@ -259,7 +261,7 @@ static int usb_id(const char *target_path) struct sysfs_device *target_dev; struct sysfs_device *host_dev, *interface_dev, *usb_dev; struct sysfs_attribute *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; - struct sysfs_attribute *usb_model, *usb_vendor, *usb_rev, *usb_serial; + struct sysfs_attribute *usb_model = NULL, *usb_vendor = NULL, *usb_rev, *usb_serial; struct sysfs_attribute *if_class, *if_subclass; int if_class_num; int protocol = 0; @@ -322,11 +324,12 @@ static int usb_id(const char *target_path) if_class = sysfs_get_device_attr(interface_dev, "bInterfaceClass"); if (!if_class) { info("%s: cannot get bInterfaceClass attribute", interface_dev->name); - return -1; + return 1; } if_class_num = strtoul(if_class->value, NULL, 16); if (if_class_num != 8) { set_usb_iftype(type_str, if_class->value, sizeof(type_str) - 1); + protocol = 0; } else { if_subclass = sysfs_get_device_attr(interface_dev, "bInterfaceSubClass"); @@ -338,29 +341,29 @@ static int usb_id(const char *target_path) /* Generic SPC-2 device */ scsi_vendor = sysfs_get_device_attr(scsi_dev, "vendor"); if (!scsi_vendor) { - info("%s: cannot get vendor attribute", scsi_dev->name); - return -1; + info("%s: cannot get SCSI vendor attribute", scsi_dev->name); + return 1; } set_str(vendor_str, scsi_vendor->value, sizeof(vendor_str)-1); scsi_model = sysfs_get_device_attr(scsi_dev, "model"); if (!scsi_model) { - info("%s: cannot get model attribute", scsi_dev->name); - return -1; + info("%s: cannot get SCSI model attribute", scsi_dev->name); + return 1; } set_str(model_str, scsi_model->value, sizeof(model_str)-1); scsi_type = sysfs_get_device_attr(scsi_dev, "type"); if (!scsi_type) { - info("%s: cannot get type attribute", scsi_dev->name); - return -1; + info("%s: cannot get SCSI type attribute", scsi_dev->name); + return 1; } set_scsi_type(type_str, scsi_type->value, sizeof(type_str)-1); scsi_rev = sysfs_get_device_attr(scsi_dev, "rev"); if (!scsi_rev) { - info("%s: cannot get type attribute", scsi_dev->name); - return -1; + info("%s: cannot get SCSI revision attribute", scsi_dev->name); + return 1; } set_str(revision_str, scsi_rev->value, sizeof(revision_str)-1); @@ -368,19 +371,29 @@ static int usb_id(const char *target_path) /* Fallback to USB vendor & device */ if (vendor_str[0] == '\0') { - usb_vendor = sysfs_get_device_attr(usb_dev, "manufacturer"); + if (!use_num_info) + if (!(usb_vendor = sysfs_get_device_attr(usb_dev, "manufacturer"))) + dbg("No USB vendor string found, using idVendor"); + if (!usb_vendor) { - dbg("No USB vendor string found, using idVendor"); - usb_vendor = sysfs_get_device_attr(usb_dev, "idVendor"); + if (!(usb_vendor = sysfs_get_device_attr(usb_dev, "idVendor"))) { + dbg("No USB vendor information available\n"); + sprintf(vendor_str,"0000"); + } } set_str(vendor_str,usb_vendor->value, sizeof(vendor_str) - 1); } if (model_str[0] == '\0') { - usb_model = sysfs_get_device_attr(usb_dev, "product"); + if (!use_num_info) + if (!(usb_model = sysfs_get_device_attr(usb_dev, "product"))) + dbg("No USB model string found, using idProduct"); + if (!usb_model) { - dbg("No USB model string found, using idProduct"); - usb_model = sysfs_get_device_attr(usb_dev, "idProduct"); + if (!(usb_model = sysfs_get_device_attr(usb_dev, "idProduct"))) { + dbg("No USB model information available\n"); + sprintf(model_str,"0000"); + } } set_str(model_str, usb_model->value, sizeof(model_str) - 1); } @@ -417,13 +430,20 @@ int main(int argc, char **argv) exit(1); } - while ((option = getopt(argc, argv, "ux")) != -1 ) { + while ((option = getopt(argc, argv, "dnux")) != -1 ) { if (optarg) dbg("option '%c' arg '%s'", option, optarg); else dbg("option '%c'", option); switch (option) { + case 'd': + debug = 1; + break; + case 'n': + use_num_info=1; + use_usb_info=1; + break; case 'u': use_usb_info=1; break; @@ -432,7 +452,7 @@ int main(int argc, char **argv) break; default: info("Unknown or bad option '%c' (0x%x)", option, option); - retval = -1; + retval = 1; break; } } @@ -452,25 +472,27 @@ int main(int argc, char **argv) retval = usb_id(target_path); - if (export) { - printf("ID_VENDOR=%s\n", vendor_str); - printf("ID_MODEL=%s\n", model_str); - printf("ID_REVISION=%s\n", revision_str); - if (serial_str[0] == '\0') { - printf("ID_SERIAL=%s_%s\n", - vendor_str, model_str); - } else { - printf("ID_SERIAL=%s_%s_%s\n", - vendor_str, model_str, serial_str); - } - printf("ID_TYPE=%s\n", type_str); - } else { - if (serial_str[0] == '\0') { - printf("%s_%s\n", - vendor_str, model_str); + if (retval == 0) { + if (export) { + printf("ID_VENDOR=%s\n", vendor_str); + printf("ID_MODEL=%s\n", model_str); + printf("ID_REVISION=%s\n", revision_str); + if (serial_str[0] == '\0') { + printf("ID_SERIAL=%s_%s\n", + vendor_str, model_str); + } else { + printf("ID_SERIAL=%s_%s_%s\n", + vendor_str, model_str, serial_str); + } + printf("ID_TYPE=%s\n", type_str); } else { - printf("%s_%s_%s\n", - vendor_str, model_str, serial_str); + if (serial_str[0] == '\0') { + printf("%s_%s\n", + vendor_str, model_str); + } else { + printf("%s_%s_%s\n", + vendor_str, model_str, serial_str); + } } } exit(retval); -- cgit v1.2.3-54-g00ecf From 4431072fb8a95005976cd3316fb978ef6fb588ca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 Jul 2005 11:39:56 +0200 Subject: compile dasd only on s390 Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/dasd.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/extras/volume_id/volume_id/dasd.c b/extras/volume_id/volume_id/dasd.c index 6f403cb928..e02b15ce8a 100644 --- a/extras/volume_id/volume_id/dasd.c +++ b/extras/volume_id/volume_id/dasd.c @@ -39,8 +39,8 @@ #include "util.h" #include "dasd.h" -static unsigned char EBCtoASC[256] = -{ +#ifdef __s390__ +static unsigned char EBCtoASC[256] = { /* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, /* 0x08 -GE -SPS -RPT VT FF CR SO SI */ @@ -144,20 +144,7 @@ typedef struct dasd_information_t { char configuration_data[256]; /* from read_configuration_data */ } dasd_information_t; -#define _IOC_NRBITS 8 -#define _IOC_TYPEBITS 8 -#define _IOC_SIZEBITS 14 -#define _IOC_DIRBITS 2 -#define _IOC_NRMASK ((1 << _IOC_NRBITS)-1) -#define _IOC_TYPEMASK ((1 << _IOC_TYPEBITS)-1) -#define _IOC_SIZEMASK ((1 << _IOC_SIZEBITS)-1) -#define _IOC_DIRMASK ((1 << _IOC_DIRBITS)-1) -#define _IOC_NRSHIFT 0 -#define _IOC_TYPESHIFT (_IOC_NRSHIFT+_IOC_NRBITS) -#define _IOC_SIZESHIFT (_IOC_TYPESHIFT+_IOC_TYPEBITS) -#define _IOC_DIRSHIFT (_IOC_SIZESHIFT+_IOC_SIZEBITS) #define DASD_IOCTL_LETTER 'D' - #define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) #define BLKSSZGET _IO(0x12,104) @@ -170,7 +157,6 @@ int volume_id_probe_dasd(struct volume_id *id) unsigned char name[7]; dbg("probing"); - if (ioctl(id->fd, BIODASDINFO, &info) != 0) return -1; @@ -195,3 +181,11 @@ int volume_id_probe_dasd(struct volume_id *id) return 0; } + +#else +int volume_id_probe_dasd(struct volume_id *id) +{ + return -1; +} +#endif /* __s390__ */ + -- cgit v1.2.3-54-g00ecf From e03bce632196dea1f6b18885225b46daaba7fa30 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 Jul 2005 11:41:09 +0200 Subject: ata_id: check for empty serial number Signed-off-by: Kay Sievers --- extras/ata_id/ata_id.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 34b1ccdff1..54c3c29feb 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -167,8 +167,12 @@ int main(int argc, char *argv[]) printf("ID_MODEL=%s\n", model); printf("ID_SERIAL=%s\n", serial); printf("ID_REVISION=%s\n", revision); - } else - printf("%s_%s\n", model, serial); + } else { + if (serial[0] != '\0') + printf("%s_%s\n", model, serial); + else + printf("%s\n", model); + } close: close(fd); -- cgit v1.2.3-54-g00ecf From ef520ba25f540a3c552e941351f772fbba7be5d9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 Jul 2005 11:42:39 +0200 Subject: remember mapped rules state Signed-off-by: Kay Sievers --- udev_rules.c | 2 +- udev_rules_parse.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/udev_rules.c b/udev_rules.c index a25c2e90a8..77b97d7f99 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -606,8 +606,8 @@ found: pos = getenv(attr); if (pos == NULL) break; - strlcat(string, pos, maxsize); dbg("substitute env '%s=%s'", attr, pos); + strlcat(string, pos, maxsize); break; default: err("unknown substitution type=%i", type); diff --git a/udev_rules_parse.c b/udev_rules_parse.c index a2f2f1804b..9483bcd71f 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -548,6 +548,7 @@ static int rules_map(struct udev_rules *rules, const char *filename) rules->buf = NULL; return -1; } + rules->mapped = 1; return 0; } -- cgit v1.2.3-54-g00ecf From cbbde2ba6c19d6515f09a2ed0955eb2808c91198 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 Jul 2005 11:44:51 +0200 Subject: udevd: set incoming socket buffer SO_RCVBUF to maximum Signed-off-by: Kay Sievers --- udevd.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/udevd.c b/udevd.c index 8782c615e3..110d8e7c4d 100644 --- a/udevd.c +++ b/udevd.c @@ -167,7 +167,7 @@ static void msg_queue_insert(struct uevent_msg *msg) } /* forks event and removes event from run queue when finished */ -static void execute_udev(struct uevent_msg *msg) +static void udev_event_fork(struct uevent_msg *msg) { char *const argv[] = { "udev", msg->subsystem, NULL }; pid_t pid; @@ -181,12 +181,10 @@ static void execute_udev(struct uevent_msg *msg) close(uevent_netlink_sock); close(udevd_sock); logging_close(); - setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); execve(udev_bin, argv, msg->envp); err("exec of child failed"); _exit(1); - break; case -1: err("fork of child failed"); msg_queue_delete(msg); @@ -389,7 +387,7 @@ static void exec_queue_manager(void) if (running_with_devpath(loop_msg, max_childs) == 0) { /* move event to run list */ list_move_tail(&loop_msg->node, &running_list); - execute_udev(loop_msg); + udev_event_fork(loop_msg); running++; dbg("moved seq %llu to running list", loop_msg->seqnum); } else @@ -722,6 +720,7 @@ static void user_sighandler(void) static int init_udevd_socket(void) { struct sockaddr_un saddr; + const int buffersize = 1024 * 1024; socklen_t addrlen; const int feature_on = 1; int retval; @@ -738,6 +737,9 @@ static int init_udevd_socket(void) return -1; } + /* set receive buffersize */ + setsockopt(udevd_sock, SOL_SOCKET, SO_RCVBUF, &buffersize, sizeof(buffersize)); + /* the bind takes care of ensuring only one copy running */ retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { @@ -755,6 +757,7 @@ static int init_udevd_socket(void) static int init_uevent_netlink_sock(void) { struct sockaddr_nl snl; + const int buffersize = 1024 * 1024; int retval; memset(&snl, 0x00, sizeof(struct sockaddr_nl)); @@ -768,6 +771,9 @@ static int init_uevent_netlink_sock(void) return -1; } + /* set receive buffersize */ + setsockopt(uevent_netlink_sock, SOL_SOCKET, SO_RCVBUF, &buffersize, sizeof(buffersize)); + retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { -- cgit v1.2.3-54-g00ecf From 0cd4ac473a51577e33e700beccb3479e5565d661 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 Jul 2005 12:52:56 +0200 Subject: allow multiple values to be matched with KEY=="value1|value2" Signed-off-by: Kay Sievers --- test/udev-test.pl | 21 +++++++++++++++++++++ udev_rules.c | 43 +++++++++++++++++++++++++++---------------- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 873780d70a..e8cb7c48a9 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1450,6 +1450,27 @@ EOF KERNEL=="ttyUSB[0-9]*", NAME="right" KERNEL=="ttyUSB[0-9]*", NAME="" KERNEL=="ttyUSB[0-9]*", NAME="wrong" +EOF + }, + { + desc => "test multi matches", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "right", + rules => < "test multi matches 2", + subsys => "tty", + devpath => "/class/tty/ttyUSB0", + exp_name => "right", + rules => <operation == KEY_OP_UNSET) return 0; - key_value = rule->buf + key->val_off; + strlcpy(value, rule->buf + key->val_off, sizeof(value)); + key_value = value; - dbg("check for %s '%s' <-> '%s'", key_name, key_value, val); - match = (strcmp_pattern(key_value, val) == 0); - if (match && (key->operation != KEY_OP_NOMATCH)) { - dbg("%s is matching (matching value)", key_name); - return 0; - } - if (!match && (key->operation == KEY_OP_NOMATCH)) { - dbg("%s is matching, (non matching value)", key_name); - return 0; + dbg("key %s value='%s'", key_name, key_value); + while (key_value) { + pos = strchr(key_value, '|'); + if (pos) { + pos[0] = '\0'; + pos++; + } + dbg("match %s '%s' <-> '%s'", key_name, key_value, val); + match = (strcmp_pattern(key_value, val) == 0); + if (match && (key->operation != KEY_OP_NOMATCH)) { + dbg("%s is true (matching value)", key_name); + return 0; + } + if (!match && (key->operation == KEY_OP_NOMATCH)) { + dbg("%s is true (non-matching value)", key_name); + return 0; + } + key_value = pos; } - - dbg("%s is not matching", key_name); + dbg("%s is false", key_name); return -1; } @@ -709,14 +720,14 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, match = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0); if (match && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) { - dbg("WAIT_FOR_SYSFS is matching (matching value)"); + dbg("WAIT_FOR_SYSFS is true (matching value)"); return 0; } if (!match && (rule->wait_for_sysfs.operation == KEY_OP_NOMATCH)) { - dbg("WAIT_FOR_SYSFS is matching, (non matching value)"); + dbg("WAIT_FOR_SYSFS is true, (non matching value)"); return 0; } - dbg("WAIT_FOR_SYSFS is not matching"); + dbg("WAIT_FOR_SYSFS is false"); return -1; } @@ -826,7 +837,7 @@ try_parent: apply_format(udev, program, sizeof(program), class_dev, sysfs_device); dbg("check for PROGRAM program='%s", program); if (execute_program(program, udev->subsystem, result, sizeof(result), NULL) != 0) { - dbg("PROGRAM is not matching"); + dbg("PROGRAM is false"); if (rule->program.operation != KEY_OP_NOMATCH) goto exit; } else { -- cgit v1.2.3-54-g00ecf From 0bfb84e1edd96b1e82ffd74c43b865e5d6dbf204 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 Jul 2005 14:46:36 +0200 Subject: IMPORT: add {parent} to import the persistent data of the parent device Signed-off-by: Kay Sievers --- test/udev-test.pl | 21 +++++++++++++++++++++ udev_rules.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- udev_rules.h | 11 +++++++++-- udev_rules_parse.c | 13 ++++++++++--- 4 files changed, 88 insertions(+), 8 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index e8cb7c48a9..1bb60bb76e 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1471,6 +1471,27 @@ EOF KERNEL=="dontknow*|*nothing", NAME="nomatch" KERNEL=="dontknow*|ttyUSB*|nothing*", NAME="right" KERNEL=="ttyUSB*", NAME="wrong" +EOF + }, + { + desc => "IMPORT parent test sequence 1/2 (keep)", + subsys => "block", + devpath => "/block/sda", + exp_name => "parent", + option => "keep", + rules => < "IMPORT parent test sequence 2/2 (keep)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "parentenv-parent_right", + option => "clean", + rules => <path); + udev_init_device(&udev_parent, NULL, NULL, NULL); + /* import the udev_db of the parent */ + if (udev_db_get_device(&udev_parent, &parent->path[strlen(sysfs_path)]) == 0) { + dbg("import stored parent env '%s'", udev_parent.name); + list_for_each_entry(name_loop, &udev_parent.env_list, node) { + char name[NAME_SIZE]; + char *pos; + + strlcpy(name, name_loop->name, sizeof(name)); + pos = strchr(name, '='); + if (pos) { + pos[0] = '\0'; + pos++; + if (strcmp_pattern(filter, name) == 0) { + dbg("import key '%s'", name_loop->name); + name_list_add(&udev->env_list, name_loop->name, 0); + setenv(name, pos, 1); + } else + dbg("skip key '%s'", name_loop->name); + } + } + rc = 0; + } else + dbg("parent not found in database"); + udev_cleanup_device(&udev_parent); + } + + return rc; +} + /* finds the lowest positive N such that N isn't present in the udevdb * if doesn't exist, 0 is returned, N otherwise */ @@ -604,8 +644,10 @@ found: break; } pos = getenv(attr); - if (pos == NULL) + if (pos == NULL) { + dbg("env '%s' not avialable", attr); break; + } dbg("substitute env '%s=%s'", attr, pos); strlcat(string, pos, maxsize); break; @@ -812,12 +854,15 @@ try_parent: strlcpy(import, key_val(rule, &rule->import), sizeof(import)); apply_format(udev, import, sizeof(import), class_dev, sysfs_device); dbg("check for IMPORT import='%s'", import); - if (rule->import_exec) { + if (rule->import_type == IMPORT_PROGRAM) { dbg("run executable file import='%s'", import); rc = import_program_into_env(udev, import); - } else { + } else if (rule->import_type == IMPORT_FILE) { dbg("import file import='%s'", import); rc = import_file_into_env(udev, import); + } else if (rule->import_type == IMPORT_PARENT && class_dev) { + dbg("import parent import='%s'", import); + rc = import_parent_into_env(udev, class_dev, import); } if (rc) { dbg("IMPORT failed"); diff --git a/udev_rules.h b/udev_rules.h index 959524a802..3f37d4b0b4 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -54,6 +54,13 @@ struct key_pairs { struct key_pair keys[PAIRS_MAX]; }; +enum import_type { + IMPORT_UNSET, + IMPORT_PROGRAM, + IMPORT_FILE, + IMPORT_PARENT, +}; + struct udev_rule { struct key kernel_name; struct key subsystem; @@ -66,6 +73,7 @@ struct udev_rule { struct key result; struct key modalias; struct key import; + enum import_type import_type; struct key wait_for_sysfs; struct key_pairs sysfs; struct key_pairs env; @@ -81,8 +89,7 @@ struct udev_rule { unsigned int partitions; unsigned int last_rule:1, ignore_device:1, - ignore_remove:1, - import_exec:1; + ignore_remove:1; size_t bufsize; char buf[]; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 9483bcd71f..7c3c2e7fc2 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -311,9 +311,13 @@ static int add_to_rules(struct udev_rules *rules, char *line) attr = get_key_attribute(key + sizeof("IMPORT")-1); if (attr && strstr(attr, "program")) { dbg("IMPORT will be executed"); - rule->import_exec = 1; + rule->import_type = IMPORT_PROGRAM; } else if (attr && strstr(attr, "file")) { dbg("IMPORT will be included as file"); + rule->import_type = IMPORT_FILE; + } else if (attr && strstr(attr, "parent")) { + dbg("IMPORT will include the parent values"); + rule->import_type = IMPORT_PARENT; } else { /* figure it out if it is executable */ char file[PATH_SIZE]; @@ -326,8 +330,11 @@ static int add_to_rules(struct udev_rules *rules, char *line) pos[0] = '\0'; dbg("IMPORT auto mode for '%s'", file); if (!lstat(file, &stats) && (stats.st_mode & S_IXUSR)) { - dbg("IMPORT is executable, will be executed"); - rule->import_exec = 1; + dbg("IMPORT is executable, will be executed (autotype)"); + rule->import_type = IMPORT_PROGRAM; + } else { + dbg("IMPORT is not executable, will be included as file (autotype)"); + rule->import_type = IMPORT_FILE; } } add_rule_key(rule, &rule->import, operation, value); -- cgit v1.2.3-54-g00ecf From afd6b4acc8ce76f1187bf852b1404a82047d8f97 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 12 Jul 2005 15:46:54 -0700 Subject: fix position of raw rules in gentoo config file this solve issue of raw1394 device nodes showing up in the proper place. Signed-off-by: Greg Kroah-Hartman --- etc/udev/gentoo/udev.rules | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index a0e17359ba..572e5c8ce1 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -120,6 +120,11 @@ KERNEL=="tun", NAME="net/%k" # ramdisk devices KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" +# IEEE1394 (firewire) devices (must be before raw devices below) +KERNEL=="raw1394", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" + # raw devices KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="ram*", NAME="%k", GROUP="disk" @@ -243,11 +248,6 @@ KERNEL=="issm*", NAME="infiniband/%k" # tpm devices KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" -# IEEE1394 (firewire) devices -KERNEL=="raw1394", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" - # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems # run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" -- cgit v1.2.3-54-g00ecf From 5f84d7264d752c9eff91e80070fa199286c25b12 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Jul 2005 11:23:21 +0200 Subject: trivial fixes for *_id programs Signed-off-by: Kay Sievers --- extras/ata_id/ata_id.c | 2 ++ extras/volume_id/vol_id.c | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 54c3c29feb..9df0fdb107 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -107,6 +107,8 @@ int main(int argc, char *argv[]) int fd; int rc = 0; + logging_init("ata_id"); + for (i = 1 ; i < argc; i++) { char *arg = argv[i]; diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 451fd355c1..1b180a7734 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) vid = volume_id_open_node(node); if (vid == NULL) { - fprintf(stderr, "error open volume\n"); + fprintf(stderr, "%s: error open volume\n", node); rc = 2; goto exit; } @@ -149,8 +149,9 @@ int main(int argc, char *argv[]) if (volume_id_probe_dasd(vid) == 0) goto print; - - fprintf(stderr, "unknown volume type\n"); + + if (print != PRINT_EXPORT) + fprintf(stderr, "%s: unknown volume type\n", node); rc = 3; goto exit; -- cgit v1.2.3-54-g00ecf From 15e5209b8e93eacfcc3440d383d5b05b5e054934 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Wed, 13 Jul 2005 11:35:51 +0200 Subject: dasd_id: add s390 disk-label prober Signed-off-by: Hannes Reinecke --- extras/dasd_id/Makefile | 52 +++++++++ extras/dasd_id/dasd_id.c | 273 +++++++++++++++++++++++++++++++++++++++++++++ test/simple-build-check.sh | 1 + 3 files changed, 326 insertions(+) create mode 100644 extras/dasd_id/Makefile create mode 100644 extras/dasd_id/dasd_id.c diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile new file mode 100644 index 0000000000..33bb6965cd --- /dev/null +++ b/extras/dasd_id/Makefile @@ -0,0 +1,52 @@ +# Makefile for dasd_id +# +# Copyright (C) 2004 Kay Sievers +# +# 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. +# + +PROG = dasd_id + +all: $(PROG) + +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin +mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +CFLAGS+=-D_FILE_OFFSET_BITS=64 + +OBJS = dasd_id.o ../../udev.a + +$(OBJS): $(HEADERS) + +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + +$(PROG): $(OBJS) $(HEADERS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + +install: all + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + +uninstall: + - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/dasd_id/dasd_id.c b/extras/dasd_id/dasd_id.c new file mode 100644 index 0000000000..5c2143f45d --- /dev/null +++ b/extras/dasd_id/dasd_id.c @@ -0,0 +1,273 @@ +/* + * dasdlabel - read label from s390 block device + * + * Copyright (C) 2004 Arnd Bergmann + * + * 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 02139, USA. + * + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../logging.h" +#include "../../udev_utils.h" + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +/* + * Only compile this on S/390. Doesn't make any sense + * for other architectures. + */ + +static unsigned char EBCtoASC[256] = +{ +/* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ + 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, +/* 0x08 -GE -SPS -RPT VT FF CR SO SI */ + 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, +/* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC + -ENP ->LF */ + 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, +/* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB + -IUS */ + 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +/* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC + -INP */ + 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, +/* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL + -SW */ + 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, +/* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ + 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, +/* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ + 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, +/* 0x40 SP RSP ä ---- */ + 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, +/* 0x48 . < ( + | */ + 0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, +/* 0x50 & ---- */ + 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, +/* 0x58 ß ! $ * ) ; */ + 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, +/* 0x60 - / ---- Ä ---- ---- ---- */ + 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, +/* 0x68 ---- , % _ > ? */ + 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, +/* 0x70 --- ---- ---- ---- ---- ---- ---- */ + 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, +/* 0x78 * ` : # @ ' = " */ + 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, +/* 0x80 * a b c d e f g */ + 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, +/* 0x88 h i ---- ---- ---- */ + 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, +/* 0x90 ° j k l m n o p */ + 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, +/* 0x98 q r ---- ---- */ + 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, +/* 0xA0 ~ s t u v w x */ + 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, +/* 0xA8 y z ---- ---- ---- ---- */ + 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, +/* 0xB0 ^ ---- § ---- */ + 0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, +/* 0xB8 ---- [ ] ---- ---- ---- ---- */ + 0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07, +/* 0xC0 { A B C D E F G */ + 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, +/* 0xC8 H I ---- ö ---- */ + 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, +/* 0xD0 } J K L M N O P */ + 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, +/* 0xD8 Q R ---- ü */ + 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, +/* 0xE0 \ S T U V W X */ + 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, +/* 0xE8 Y Z ---- Ö ---- ---- ---- */ + 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, +/* 0xF0 0 1 2 3 4 5 6 7 */ + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, +/* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ + 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 +}; + +static void vtoc_ebcdic_dec (const unsigned char *source, char *target, int l) +{ + int i; + + for (i = 0; i < l; i++) + target[i]=(char)EBCtoASC[(unsigned char)(source[i])]; +} + +/* + * struct dasd_information_t + * represents any data about the data, which is visible to userspace + */ +typedef struct dasd_information_t { + unsigned int devno; /* S/390 devno */ + unsigned int real_devno; /* for aliases */ + unsigned int schid; /* S/390 subchannel identifier */ + unsigned int cu_type : 16; /* from SenseID */ + unsigned int cu_model : 8; /* from SenseID */ + unsigned int dev_type : 16; /* from SenseID */ + unsigned int dev_model : 8; /* from SenseID */ + unsigned int open_count; + unsigned int req_queue_len; + unsigned int chanq_len; /* length of chanq */ + char type[4]; /* from discipline.name, 'none' for unknown */ + unsigned int status; /* current device level */ + unsigned int label_block; /* where to find the VOLSER */ + unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ + unsigned int characteristics_size; + unsigned int confdata_size; + char characteristics[64]; /* from read_device_characteristics */ + char configuration_data[256]; /* from read_configuration_data */ +} dasd_information_t; + +#define DASD_IOCTL_LETTER 'D' +#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) +#define BLKSSZGET _IO(0x12,104) + +unsigned char serial[8]; + +static int dasd_id(int fd) +{ + int blocksize; + dasd_information_t info; + __u8 *data; + __u8 *label_raw; + + if (ioctl(fd, BIODASDINFO, &info) != 0) { + dbg("not a dasd"); + return -1; + } + + if (ioctl(fd, BLKSSZGET, &blocksize) != 0) { + err("failed to get blocksize"); + return -1; + } + + if (lseek(fd,info.label_block * blocksize, SEEK_SET) == -1) { + err("seek failed on dasd"); + return -1; + } + + data = malloc(blocksize); + if (data == NULL) + return -1; + + if (read(fd, data, blocksize) == -1) { + err("read disklabel failed"); + free(data); + return -1; + } + + if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) + label_raw = &data[8]; + else + label_raw = &data[4]; + serial[6] = '\0'; + + vtoc_ebcdic_dec(label_raw, serial, 6); + free(data); + + return 0; + } + +int main(int argc, char *argv[]) +{ + const char *node = NULL; + int i; + int export = 0; + int fd; + int rc = 0; + + logging_init("dasd_id"); + + for (i = 1; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--export") == 0) { + export = 1; + } else + node = arg; + } + if (!node) { + err("no node specified"); + rc = 1; + goto exit; + } + + fd = open(node, O_RDONLY); + if (fd < 0) { + err("unable to open '%s'", node); + rc = 1; + goto exit; + } + + if (dasd_id(fd) < 0) { + err("dasd_id failed: %s", strerror(errno)); + rc = 1; + } + + if (export) { + printf("ID_TYPE=disk\n"); + printf("ID_SERIAL=%s\n",serial); + } else + printf("%s\n", serial); + + close(fd); +exit: + logging_close(); + return rc; +} + diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index c5b429d98d..7e9a940f85 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -6,6 +6,7 @@ EXTRAS="\ extras/ata_id \ extras/volume_id \ extras/usb_id \ + extras/dasd_id \ extras/run_directory" [ -z "$KERNEL_DIR" ] && KERNEL_DIR=/lib/modules/`uname -r`/build -- cgit v1.2.3-54-g00ecf From b0f57eb066cd897dab536ee37daab4239d136d4c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Jul 2005 12:01:53 +0200 Subject: volume_id: remove s390 dasd handling, it is dasd_id now Signed-off-by: Kay Sievers --- extras/volume_id/README | 1 - extras/volume_id/vol_id.c | 4 - extras/volume_id/volume_id/Makefile.inc | 2 - extras/volume_id/volume_id/dasd.c | 191 -------------------------------- extras/volume_id/volume_id/dasd.h | 26 ----- extras/volume_id/volume_id/volume_id.h | 2 +- 6 files changed, 1 insertion(+), 225 deletions(-) delete mode 100644 extras/volume_id/volume_id/dasd.c delete mode 100644 extras/volume_id/volume_id/dasd.h diff --git a/extras/volume_id/README b/extras/volume_id/README index a7635ff612..974a5016d9 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -37,7 +37,6 @@ luks * - * - hpfs * - - - romfs * minix * -dasd * highpoint * isw_raid * lsi_raid * diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 1b180a7734..a4a866cfcf 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -32,7 +32,6 @@ #include "../../udev_utils.h" #include "../../logging.h" #include "volume_id/volume_id.h" -#include "volume_id/dasd.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) @@ -147,9 +146,6 @@ int main(int argc, char *argv[]) if (volume_id_probe_all(vid, 0, size) == 0) goto print; - if (volume_id_probe_dasd(vid) == 0) - goto print; - if (print != PRINT_EXPORT) fprintf(stderr, "%s: unknown volume type\n", node); rc = 3; diff --git a/extras/volume_id/volume_id/Makefile.inc b/extras/volume_id/volume_id/Makefile.inc index acd26ff101..266d1e4872 100644 --- a/extras/volume_id/volume_id/Makefile.inc +++ b/extras/volume_id/volume_id/Makefile.inc @@ -26,7 +26,6 @@ VOLUME_ID_OBJS= \ $(VOLUME_ID_BASE)/romfs.o \ $(VOLUME_ID_BASE)/sysv.o \ $(VOLUME_ID_BASE)/minix.o \ - $(VOLUME_ID_BASE)/dasd.o \ $(VOLUME_ID_BASE)/luks.o \ $(VOLUME_ID_BASE)/volume_id.o \ $(VOLUME_ID_BASE)/util.o @@ -58,7 +57,6 @@ VOLUME_ID_HEADERS= \ $(VOLUME_ID_BASE)/romfs.h \ $(VOLUME_ID_BASE)/sysv.h \ $(VOLUME_ID_BASE)/minix.h \ - $(VOLUME_ID_BASE)/dasd.h \ $(VOLUME_ID_BASE)/luks.h \ $(VOLUME_ID_BASE)/volume_id.h \ $(VOLUME_ID_BASE)/util.h diff --git a/extras/volume_id/volume_id/dasd.c b/extras/volume_id/volume_id/dasd.c deleted file mode 100644 index e02b15ce8a..0000000000 --- a/extras/volume_id/volume_id/dasd.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * dasdlabel - read label from s390 block device - * - * Copyright (C) 2004 Arnd Bergmann - * - * 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 02139, USA. - * - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "dasd.h" - -#ifdef __s390__ -static unsigned char EBCtoASC[256] = { -/* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ - 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, -/* 0x08 -GE -SPS -RPT VT FF CR SO SI */ - 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -/* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC - -ENP ->LF */ - 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, -/* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB - -IUS */ - 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -/* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC - -INP */ - 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, -/* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL - -SW */ - 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, -/* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ - 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, -/* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ - 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, -/* 0x40 SP RSP ä ---- */ - 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, -/* 0x48 . < ( + | */ - 0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, -/* 0x50 & ---- */ - 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, -/* 0x58 ß ! $ * ) ; */ - 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, -/* 0x60 - / ---- Ä ---- ---- ---- */ - 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, -/* 0x68 ---- , % _ > ? */ - 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, -/* 0x70 --- ---- ---- ---- ---- ---- ---- */ - 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -/* 0x78 * ` : # @ ' = " */ - 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, -/* 0x80 * a b c d e f g */ - 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, -/* 0x88 h i ---- ---- ---- */ - 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, -/* 0x90 ° j k l m n o p */ - 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, -/* 0x98 q r ---- ---- */ - 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, -/* 0xA0 ~ s t u v w x */ - 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, -/* 0xA8 y z ---- ---- ---- ---- */ - 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, -/* 0xB0 ^ ---- § ---- */ - 0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, -/* 0xB8 ---- [ ] ---- ---- ---- ---- */ - 0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07, -/* 0xC0 { A B C D E F G */ - 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, -/* 0xC8 H I ---- ö ---- */ - 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, -/* 0xD0 } J K L M N O P */ - 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, -/* 0xD8 Q R ---- ü */ - 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, -/* 0xE0 \ S T U V W X */ - 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, -/* 0xE8 Y Z ---- Ö ---- ---- ---- */ - 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, -/* 0xF0 0 1 2 3 4 5 6 7 */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, -/* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ - 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 -}; - -static void vtoc_ebcdic_dec (const unsigned char *source, unsigned char *target, int l) -{ - int i; - - for (i = 0; i < l; i++) - target[i]=EBCtoASC[(unsigned char)(source[i])]; -} - -/* - * struct dasd_information_t - * represents any data about the data, which is visible to userspace - */ -typedef struct dasd_information_t { - unsigned int devno; /* S/390 devno */ - unsigned int real_devno; /* for aliases */ - unsigned int schid; /* S/390 subchannel identifier */ - unsigned int cu_type : 16; /* from SenseID */ - unsigned int cu_model : 8; /* from SenseID */ - unsigned int dev_type : 16; /* from SenseID */ - unsigned int dev_model : 8; /* from SenseID */ - unsigned int open_count; - unsigned int req_queue_len; - unsigned int chanq_len; /* length of chanq */ - char type[4]; /* from discipline.name, 'none' for unknown */ - unsigned int status; /* current device level */ - unsigned int label_block; /* where to find the VOLSER */ - unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ - unsigned int characteristics_size; - unsigned int confdata_size; - char characteristics[64]; /* from read_device_characteristics */ - char configuration_data[256]; /* from read_configuration_data */ -} dasd_information_t; - -#define DASD_IOCTL_LETTER 'D' -#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) -#define BLKSSZGET _IO(0x12,104) - -int volume_id_probe_dasd(struct volume_id *id) -{ - int blocksize; - dasd_information_t info; - __u8 *data; - __u8 *label_raw; - unsigned char name[7]; - - dbg("probing"); - if (ioctl(id->fd, BIODASDINFO, &info) != 0) - return -1; - - if (ioctl(id->fd, BLKSSZGET, &blocksize) != 0) - return -1; - - data = volume_id_get_buffer(id, info.label_block * blocksize, 16); - if (data == NULL) - return -1; - - if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) - label_raw = &data[8]; - else - label_raw = &data[4]; - - name[6] = '\0'; - volume_id_set_usage(id, VOLUME_ID_DISKLABEL); - id->type = "dasd"; - volume_id_set_label_raw(id, label_raw, 6); - vtoc_ebcdic_dec(label_raw, name, 6); - volume_id_set_label_string(id, name, 6); - - return 0; -} - -#else -int volume_id_probe_dasd(struct volume_id *id) -{ - return -1; -} -#endif /* __s390__ */ - diff --git a/extras/volume_id/volume_id/dasd.h b/extras/volume_id/volume_id/dasd.h deleted file mode 100644 index 751b9fda60..0000000000 --- a/extras/volume_id/volume_id/dasd.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * dasdlabel - read label from s390 block device - * - * Copyright (C) 2004 Arnd Bergmann - * - * 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 02139, USA. - * - */ - -#ifndef _VOLUME_ID_DASDLABEL_ -#define _VOLUME_ID_DASDLABEL_ - -extern int volume_id_probe_dasd(struct volume_id *id); - -#endif diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 2266694f5e..c6aef50876 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 44 +#define VOLUME_ID_VERSION 45 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From 8cf97fb046ddcfaea48ab6182b0f69996158d280 Mon Sep 17 00:00:00 2001 From: Anton Farygin Date: Thu, 14 Jul 2005 11:39:55 +0200 Subject: fix typo in GROUP value application --- udev_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_rules.c b/udev_rules.c index d08edf7782..5669a8593e 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -987,7 +987,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s if (rule->group.operation == KEY_OP_ASSIGN_FINAL) udev->group_final = 1; strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); - apply_format(udev, key_val(rule, &rule->group), sizeof(udev->group), class_dev, sysfs_device); + apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); } -- cgit v1.2.3-54-g00ecf From 7fe082a8a42baa45ef45d82edde4f893410ebeea Mon Sep 17 00:00:00 2001 From: Ville Skyttä Date: Thu, 14 Jul 2005 11:43:05 +0200 Subject: correct default mode documentation in udev --- docs/writing_udev_rules/index.html | 2 +- etc/udev/redhat/udev.rules | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index 1ba43678c0..c2ccdc3663 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -321,7 +321,7 @@ Building on the style mentioned above, you can do even more flashy things. The u This prevents the need to excessively provide a GROUP="audio" key on every following rule which names sound devices.

    -udev defaults to creating nodes with unix permissions of 0660 (read/write to owner and group), which is configured by the default_mode setting inside /etc/udev/udev.conf. There may be some situations where you do not want to use the default permissions on your device node. Fortunately, you can easily override the permissions in your rules using the MODE assignment key. As an example, the following rule defines that the inotify node shall be readable and writable to everyone: +udev defaults to creating nodes with unix permissions of 0660 (read/write to owner and group). There may be some situations where you do not want to use the default permissions on your device node. Fortunately, you can easily override the permissions in your rules using the MODE assignment key. As an example, the following rule defines that the inotify node shall be readable and writable to everyone:
    KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666"
    diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index 2d4819f8c3..5bed782280 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -1,7 +1,7 @@ # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. # -# default is OWNER="root" GROUP="root", MODE="0600" +# default is OWNER="root" GROUP="root", MODE="0660" # # all block devices -- cgit v1.2.3-54-g00ecf From 78e21e3ed4a038a8aa358eb109b6029ca9c3cdd1 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 14 Jul 2005 15:19:37 -0700 Subject: Fixed udev_run_devd to run the /etc/dev.d/DEVNAME/ files too Note, this assumes that you are putting your device nodes in /dev/, the better thing to do is use the RUN= rule and not rely on this program at all. Signed-off-by: Greg Kroah-Hartman --- extras/run_directory/run_directory.h | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 extras/run_directory/run_directory.h diff --git a/extras/run_directory/run_directory.h b/extras/run_directory/run_directory.h new file mode 100644 index 0000000000..edb46ddd73 --- /dev/null +++ b/extras/run_directory/run_directory.h @@ -0,0 +1,3 @@ + +extern int run_directory(const char *dir, const char *suffix, const char *subsystem); + -- cgit v1.2.3-54-g00ecf From 04b90b7e256762bb6eecf0567ca33ceec03621f5 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 14 Jul 2005 15:24:59 -0700 Subject: Really commit the udev_run_devd changes... --- extras/run_directory/run_directory.c | 17 +++-------------- extras/run_directory/udev_run_devd.c | 25 ++++++++++++++++++++++--- extras/run_directory/udev_run_hotplugd.c | 7 +++++-- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/extras/run_directory/run_directory.c b/extras/run_directory/run_directory.c index e6c6173eca..770d8d84a1 100644 --- a/extras/run_directory/run_directory.c +++ b/extras/run_directory/run_directory.c @@ -25,8 +25,7 @@ #include "../../udev_utils.h" #include "../../list.h" #include "../../logging.h" - -int run_directory(const char *dir, const char *suffix, const char *subsystem); +#include "run_directory.h" static int run_program(const char *filename, const char *subsystem) { @@ -53,21 +52,11 @@ static int run_program(const char *filename, const char *subsystem) int run_directory(const char *dir, const char *suffix, const char *subsystem) { - char dirname[NAME_SIZE]; struct name_entry *name_loop, *name_tmp; LIST_HEAD(name_list); - if (subsystem) { - snprintf(dirname, sizeof(dirname), "%s/%s", dir, subsystem); - dirname[sizeof(dirname)-1] = '\0'; - dbg("looking at '%s'", dirname); - add_matching_files(&name_list, dirname, suffix); - } - - snprintf(dirname, sizeof(dirname), "%s/default", dir); - dirname[sizeof(dirname)-1] = '\0'; - dbg("looking at '%s'", dirname); - add_matching_files(&name_list, dirname, suffix); + dbg("looking at '%s'", dir); + add_matching_files(&name_list, dir, suffix); list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { run_program(name_loop->name, subsystem); diff --git a/extras/run_directory/udev_run_devd.c b/extras/run_directory/udev_run_devd.c index 02bbc8c353..e708de8aa4 100644 --- a/extras/run_directory/udev_run_devd.c +++ b/extras/run_directory/udev_run_devd.c @@ -25,8 +25,8 @@ #include "../../udev_utils.h" #include "../../list.h" #include "../../logging.h" +#include "run_directory.h" -extern int run_directory(const char *dir, const char *suffix, const char *subsystem); #ifdef USE_LOG void log_message (int priority, const char *format, ...) @@ -55,11 +55,25 @@ void log_message (int priority, const char *format, ...) int main(int argc, char *argv[], char *envp[]) { + char dirname[NAME_SIZE]; + const char *devname; + const char *my_devname; const char *subsystem; int fd; - if (getenv("DEVNAME") == NULL) + devname = getenv("DEVNAME"); + if (devname == NULL) exit(0); + /* + * Hack, we are assuming that the device nodes are in /dev, + * if not, this will not work, but you should be using the + * RUN= rule anyway... + */ + my_devname = strstr(devname, "/dev/"); + if (my_devname != NULL) + my_devname = &my_devname[5]; + else + my_devname = devname; subsystem = argv[1]; logging_init("udev_run_devd"); @@ -73,6 +87,11 @@ int main(int argc, char *argv[], char *envp[]) } dbg("running dev.d directory"); - run_directory("/etc/dev.d", ".dev", subsystem); + sprintf(dirname, "/etc/dev.d/%s", my_devname); + run_directory(dirname, ".dev", subsystem); + sprintf(dirname, "/etc/dev.d/%s", subsystem); + run_directory(dirname, ".dev", subsystem); + run_directory("/etc/dev.d/default", ".dev", subsystem); + exit(0); } diff --git a/extras/run_directory/udev_run_hotplugd.c b/extras/run_directory/udev_run_hotplugd.c index 54b6bf44e3..a21835ae4e 100644 --- a/extras/run_directory/udev_run_hotplugd.c +++ b/extras/run_directory/udev_run_hotplugd.c @@ -25,8 +25,8 @@ #include "../../udev_utils.h" #include "../../list.h" #include "../../logging.h" +#include "run_directory.h" -extern int run_directory(const char *dir, const char *suffix, const char *subsystem); #ifdef USE_LOG void log_message (int priority, const char *format, ...) @@ -55,6 +55,7 @@ void log_message (int priority, const char *format, ...) int main(int argc, char *argv[], char *envp[]) { + char dirname[NAME_SIZE]; const char *subsystem; int fd; @@ -71,6 +72,8 @@ int main(int argc, char *argv[], char *envp[]) dbg("running dev.d directory"); - run_directory("/etc/hotplug.d", ".hotplug", subsystem); + sprintf(dirname, "/etc/hotplug.d/%s", subsystem); + run_directory(dirname, ".hotplug", subsystem); + run_directory("/etc/hotplug.d/default", ".hotplug", subsystem); exit(0); } -- cgit v1.2.3-54-g00ecf From 0de3c3edebeaab08c2697d13c33e0049f6371706 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 14 Jul 2005 15:27:30 -0700 Subject: add 'make tests' as I'm always typing that one wrong... Signed-off-by: Greg Kroah-Hartman --- Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile b/Makefile index 48ecbd7428..c3485c0472 100644 --- a/Makefile +++ b/Makefile @@ -412,3 +412,5 @@ uninstall: uninstall-man test: all @ cd test && ./udev-test.pl @ cd test && ./udevstart-test.pl + +tests: test -- cgit v1.2.3-54-g00ecf From 8365854ccda3d0f36333b699454238cff111e169 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 14 Jul 2005 16:09:21 -0700 Subject: 063 release --- ChangeLog | 30 ++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index db2f0b0057..159437240f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +Summary of changes from v062 to v063 +============================================ + +Anton Farygin: + fix typo in GROUP value application + +Greg Kroah-Hartman: + add 'make tests' as I'm always typing that one wrong... + Really commit the udev_run_devd changes... + Fixed udev_run_devd to run the /etc/dev.d/DEVNAME/ files too + fix position of raw rules in gentoo config file + +Hannes Reinecke: + dasd_id: add s390 disk-label prober + fix usb_id and let scsi_id ignore "illegal request" + +Kay Sievers: + volume_id: remove s390 dasd handling, it is dasd_id now + trivial fixes for *_id programs + IMPORT: add {parent} to import the persistent data of the parent device + allow multiple values to be matched with KEY=="value1|value2" + udevd: set incoming socket buffer SO_RCVBUF to maximum + remember mapped rules state + ata_id: check for empty serial number + compile dasd only on s390 + +Ville Skytt: + correct default mode documentation in udev + + Summary of changes from v061 to v062 ============================================ diff --git a/Makefile b/Makefile index c3485c0472..a8f2851cab 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false -VERSION = 062 +VERSION = 063 ROOT = udev DAEMON = udevd SENDER = udevsend diff --git a/udev.spec b/udev.spec index 496065a79b..22d9160529 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace implementation of devfs Name: udev -Version: 062 +Version: 063 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From c609f627fae97bef5f163eb2eb993d3c8211f768 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 16 Jul 2005 05:50:34 +0200 Subject: thread unknown ENV{key} match as empty value This way we can run a rule if a certain key is not set by: ENV{key}="" or ENV{key}!="?*" Signed-off-by: Kay Sievers --- udev_rules.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 5669a8593e..4bf05cd437 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -748,8 +748,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, const char *value = getenv(key_name); if (!value) { - dbg("ENV{'%s'} is not found", key_name); - goto exit; + dbg("ENV{'%s'} is not set", key_name); + value = ""; } if (match_key("ENV", rule, &pair->key, value)) goto exit; -- cgit v1.2.3-54-g00ecf From 594dd610252923591ed0f310695e82d3fb87e581 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 16 Jul 2005 07:46:31 +0200 Subject: allow rules to have labels and skip to next label This will allow us to have whole blocks of rules to skip conditionally. The following section creates the node "yes": GOTO="TEST" NAME="no" NAME="no2", LABEL="NO" NAME="yes", LABEL="TEST" NAME="no3" --- Makefile | 2 +- test/udev-test.pl | 13 +++++++++++++ udev_rules.c | 5 +++++ udev_rules.h | 3 +++ udev_rules_parse.c | 39 ++++++++++++++++++++++++++++++++++++++- 5 files changed, 60 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a8f2851cab..b740838ace 100644 --- a/Makefile +++ b/Makefile @@ -377,8 +377,8 @@ install: install-config install-man all $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) ifndef DESTDIR - killall $(DAEMON) - - $(sbindir)/$(DAEMON) --daemon - rm -rf $(udevdb) + - $(sbindir)/$(DAEMON) --daemon endif @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ diff --git a/test/udev-test.pl b/test/udev-test.pl index 1bb60bb76e..94cffeab07 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1492,6 +1492,19 @@ EOF option => "clean", rules => < "GOTO test", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "right", + rules => <goto_label.operation != KEY_OP_UNSET) { + dbg("moving forward to label '%s'", key_val(rule, &rule->goto_label)); + udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); + } } } diff --git a/udev_rules.h b/udev_rules.h index 3f37d4b0b4..d22d31f7e1 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -62,6 +62,8 @@ enum import_type { }; struct udev_rule { + struct key label; + struct key goto_label; struct key kernel_name; struct key subsystem; struct key action; @@ -108,6 +110,7 @@ extern void udev_rules_close(struct udev_rules *rules); extern void udev_rules_iter_init(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); +extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label); extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct sysfs_class_device *class_dev); extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, struct sysfs_device *sysfs_device); diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 7c3c2e7fc2..0259268c8f 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -52,8 +52,10 @@ struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) return NULL; dbg("current=%zi", rules->current); - if (rules->current >= rules->bufsize) + if (rules->current >= rules->bufsize) { + dbg("no more rules"); return NULL; + } /* get next rule */ rule = (struct udev_rule *) (rules->buf + rules->current); @@ -62,6 +64,28 @@ struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) return rule; } +struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label) +{ + static struct udev_rule *rule; + +next: + dbg("current=%zi", rules->current); + if (rules->current >= rules->bufsize) { + dbg("no more rules"); + return NULL; + } + rule = (struct udev_rule *) (rules->buf + rules->current); + + if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { + dbg("moving forward, looking for label '%s'", label); + rules->current += sizeof(struct udev_rule) + rule->bufsize; + goto next; + } + + dbg("found label '%s'", label); + return rule; +} + static int get_key(char **line, char **key, enum key_operation *operation, char **value) { char *linepos; @@ -237,6 +261,18 @@ static int add_to_rules(struct udev_rules *rules, char *line) if (retval) break; + if (strcasecmp(key, "LABEL") == 0) { + add_rule_key(rule, &rule->label, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "GOTO") == 0) { + add_rule_key(rule, &rule->goto_label, operation, value); + valid = 1; + continue; + } + if (strcasecmp(key, "KERNEL") == 0) { add_rule_key(rule, &rule->kernel_name, operation, value); valid = 1; @@ -475,6 +511,7 @@ static int add_to_rules(struct udev_rules *rules, char *line) err("realloc failed"); goto exit; } + dbg("adding rule to offset %zi", rules->bufsize); memcpy(rules->buf + rules->bufsize, rule, rule_size); rules->bufsize += rule_size; exit: -- cgit v1.2.3-54-g00ecf From 422d5becc339304805bbe1e359f6389633036a98 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 17 Jul 2005 09:40:29 -0400 Subject: add padding to rules structure Some architectures really want well alingned structures. Thanks to Jim Gifford for help finding it. Signed-off-by: Kay Sievers --- extras/usb_id/usb_id.c | 3 --- udev_rules_parse.c | 6 ++++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index f4011ee899..ab116e9d03 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -497,6 +497,3 @@ int main(int argc, char **argv) } exit(retval); } - - - diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 0259268c8f..e708f35558 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -241,6 +241,7 @@ static int add_to_rules(struct udev_rules *rules, char *line) int valid; char *linepos; char *attr; + size_t padding; int retval; /* get all the keys */ @@ -506,6 +507,11 @@ static int add_to_rules(struct udev_rules *rules, char *line) /* grow buffer and add rule */ rule_size = sizeof(struct udev_rule) + rule->bufsize; + padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); + dbg("add %zi padding bytes", padding); + rule_size += padding; + rule->bufsize += padding; + rules->buf = realloc(rules->buf, rules->bufsize + rule_size); if (!rules->buf) { err("realloc failed"); -- cgit v1.2.3-54-g00ecf From 6a5aac78f4d04490fc1d0178b1d7c0cb415c2944 Mon Sep 17 00:00:00 2001 From: Andre Masella Date: Sun, 17 Jul 2005 09:54:40 -0400 Subject: volume_id: add OCFS (Oracle Cluster File System) support --- extras/volume_id/Makefile | 3 +- extras/volume_id/volume_id/Makefile.inc | 2 + extras/volume_id/volume_id/ocfs2.c | 125 ++++++++++++++++++++++++++++++++ extras/volume_id/volume_id/ocfs2.h | 26 +++++++ extras/volume_id/volume_id/volume_id.c | 4 + extras/volume_id/volume_id/volume_id.h | 2 +- 6 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 extras/volume_id/volume_id/ocfs2.c create mode 100644 extras/volume_id/volume_id/ocfs2.h diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index eca9cfdbd4..014bf8713d 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -33,7 +33,8 @@ override CFLAGS+=-D_FILE_OFFSET_BITS=64 VOLUME_ID_BASE=volume_id include $(VOLUME_ID_BASE)/Makefile.inc -OBJS = vol_id.o $(VOLUME_ID_OBJS) ../../udev.a +OBJS = vol_id.o $(VOLUME_ID_OBJS) +LIB_OBJS=../../udev.a HEADERS = $(VOLUME_ID_HEADERS) $(OBJS): $(HEADERS) diff --git a/extras/volume_id/volume_id/Makefile.inc b/extras/volume_id/volume_id/Makefile.inc index 266d1e4872..71f4ea2862 100644 --- a/extras/volume_id/volume_id/Makefile.inc +++ b/extras/volume_id/volume_id/Makefile.inc @@ -27,6 +27,7 @@ VOLUME_ID_OBJS= \ $(VOLUME_ID_BASE)/sysv.o \ $(VOLUME_ID_BASE)/minix.o \ $(VOLUME_ID_BASE)/luks.o \ + $(VOLUME_ID_BASE)/ocfs2.o \ $(VOLUME_ID_BASE)/volume_id.o \ $(VOLUME_ID_BASE)/util.o @@ -58,5 +59,6 @@ VOLUME_ID_HEADERS= \ $(VOLUME_ID_BASE)/sysv.h \ $(VOLUME_ID_BASE)/minix.h \ $(VOLUME_ID_BASE)/luks.h \ + $(VOLUME_ID_BASE)/ocfs2.h \ $(VOLUME_ID_BASE)/volume_id.h \ $(VOLUME_ID_BASE)/util.h diff --git a/extras/volume_id/volume_id/ocfs2.c b/extras/volume_id/volume_id/ocfs2.c new file mode 100644 index 0000000000..1f2819c0cc --- /dev/null +++ b/extras/volume_id/volume_id/ocfs2.c @@ -0,0 +1,125 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) Andre Masella + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "ocfs2.h" + + +/* All these values are taken from ocfs2-tools's ocfs2_fs.h */ +#define OCFS2_VOL_UUID_LEN 16 +#define OCFS2_MAX_VOL_LABEL_LEN 64 +#define OCFS2_SUPERBLOCK_OFFSET 0x2000 + + +/* This is the superblock. The OCFS2 header files have structs in structs. +This is one has been simplified since we only care about the superblock. +*/ + +struct ocfs2_super_block { + __u8 i_signature[8]; /* Signature for validation */ + __u32 i_generation; /* Generation number */ + __s16 i_suballoc_slot; /* Slot suballocator this inode belongs to */ + __u16 i_suballoc_bit; /* Bit offset in suballocator block group */ + __u32 i_reserved0; + __u32 i_clusters; /* Cluster count */ + __u32 i_uid; /* Owner UID */ + __u32 i_gid; /* Owning GID */ + __u64 i_size; /* Size in bytes */ + __u16 i_mode; /* File mode */ + __u16 i_links_count; /* Links count */ + __u32 i_flags; /* File flags */ + __u64 i_atime; /* Access time */ + __u64 i_ctime; /* Creation time */ + __u64 i_mtime; /* Modification time */ + __u64 i_dtime; /* Deletion time */ + __u64 i_blkno; /* Offset on disk, in blocks */ + __u64 i_last_eb_blk; /* Pointer to last extent block */ + __u32 i_fs_generation; /* Generation per fs-instance */ + __u32 i_atime_nsec; + __u32 i_ctime_nsec; + __u32 i_mtime_nsec; + __u64 i_reserved1[9]; + __u64 i_pad1; /* Generic way to refer to this 64bit union */ + /* Normally there is a union of the different block types, but we only care about the superblock. */ + __u16 s_major_rev_level; + __u16 s_minor_rev_level; + __u16 s_mnt_count; + __s16 s_max_mnt_count; + __u16 s_state; /* File system state */ + __u16 s_errors; /* Behaviour when detecting errors */ + __u32 s_checkinterval; /* Max time between checks */ + __u64 s_lastcheck; /* Time of last check */ + __u32 s_creator_os; /* OS */ + __u32 s_feature_compat; /* Compatible feature set */ + __u32 s_feature_incompat; /* Incompatible feature set */ + __u32 s_feature_ro_compat; /* Readonly-compatible feature set */ + __u64 s_root_blkno; /* Offset, in blocks, of root directory dinode */ + __u64 s_system_dir_blkno; /* Offset, in blocks, of system directory dinode */ + __u32 s_blocksize_bits; /* Blocksize for this fs */ + __u32 s_clustersize_bits; /* Clustersize for this fs */ + __u16 s_max_slots; /* Max number of simultaneous mounts before tunefs required */ + __u16 s_reserved1; + __u32 s_reserved2; + __u64 s_first_cluster_group; /* Block offset of 1st cluster group header */ + __u8 s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */ + __u8 s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ +} __attribute__((__packed__)); + +int volume_id_probe_ocfs2(struct volume_id *id, __u64 off) +{ + struct ocfs2_super_block *os; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + os = (struct ocsf2_super_block *) volume_id_get_buffer(id, off + OCFS2_SUPERBLOCK_OFFSET, 0x200); + if (os == NULL) + return -1; + + if (strcmp(os->i_signature, "OCFSV2") != 0) { + return -1; + } + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + volume_id_set_label_raw(id, os->s_label, OCFS2_MAX_VOL_LABEL_LEN < VOLUME_ID_LABEL_SIZE ? + OCFS2_MAX_VOL_LABEL_LEN : VOLUME_ID_LABEL_SIZE); + volume_id_set_label_string(id, os->s_label, OCFS2_MAX_VOL_LABEL_LEN < VOLUME_ID_LABEL_SIZE ? + OCFS2_MAX_VOL_LABEL_LEN : VOLUME_ID_LABEL_SIZE); + volume_id_set_uuid(id, os->s_uuid, UUID_DCE); + id->type = "ocfs2"; + return 0; +} diff --git a/extras/volume_id/volume_id/ocfs2.h b/extras/volume_id/volume_id/ocfs2.h new file mode 100644 index 0000000000..128348133c --- /dev/null +++ b/extras/volume_id/volume_id/ocfs2.h @@ -0,0 +1,26 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) Andre Masella + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef _VOLUME_ID_OCFS2_ +#define _VOLUME_ID_OCFS2_ + +extern int volume_id_probe_ocfs2(struct volume_id *id, __u64 off); + +#endif diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 3fe8562e33..8e944be0b1 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -69,6 +69,7 @@ #include "minix.h" #include "mac.h" #include "msdos.h" +#include "ocfs2.h" int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size) { @@ -169,6 +170,9 @@ int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned l if (volume_id_probe_minix(id, off) == 0) goto exit; + if (volume_id_probe_ocfs2(id, off) == 0) + goto exit; + return -1; exit: diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index c6aef50876..4e0defdadd 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 45 +#define VOLUME_ID_VERSION 46 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From bf375e3af65f0e9728516a3627613fb95288c1d1 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 19 Jul 2005 11:14:12 -0400 Subject: create_floppy_devices: add tool to create floppy nodes based on sysfs info --- extras/floppy/Makefile | 52 +++++++++++++ extras/floppy/create_floppy_devices.c | 136 ++++++++++++++++++++++++++++++++++ test/simple-build-check.sh | 1 + 3 files changed, 189 insertions(+) create mode 100644 extras/floppy/Makefile create mode 100644 extras/floppy/create_floppy_devices.c diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile new file mode 100644 index 0000000000..2601eeeb55 --- /dev/null +++ b/extras/floppy/Makefile @@ -0,0 +1,52 @@ +# Makefile for create_floppy_devices +# +# Copyright (C) 2004 Kay Sievers +# +# 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. +# + +PROG = create_floppy_devices + +all: $(PROG) + +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin +mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +CFLAGS+=-D_FILE_OFFSET_BITS=64 + +OBJS = $(PROG).o ../../udev.a + +$(OBJS): $(HEADERS) + +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + +$(PROG): $(OBJS) $(HEADERS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + +install: all + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + +uninstall: + - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c new file mode 100644 index 0000000000..f4003c2ce2 --- /dev/null +++ b/extras/floppy/create_floppy_devices.c @@ -0,0 +1,136 @@ +/* + * create_floppy_devices + * + * Create all possible floppy device based on the CMOS type. + * Based upon code from drivers/block/floppy.c + * + * Copyright(C) 2005, SUSE Linux Products GmbH + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Hannes Reinecke + * + */ + +#include +#include +#include +#include +#include +#include +#include + +static char *table[] = { + "", "d360", "h1200", "u360", "u720", "h360", "h720", + "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410", + "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743", + "h880", "u1040", "u1120", "h1600", "u1760", "u1920", + "u3200", "u3520", "u3840", "u1840", "u800", "u1600", + NULL +}; + +static int t360[] = { 1 }; +static int t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23 }; +static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, 17, 21, 22, 30 }; + +static int *table_sup[] = { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in }; + +int main(int argc, char **argv) +{ + char *dev; + char node[64]; + int type = 0, i, fdnum, c; + int major = 2, minor; + int mode = 0; + int create_nodes = 0; + int print_nodes = 0; + int unlink_nodes = 0; + int is_err = 0; + + while ((c = getopt(argc, argv, "cdm:M:t:u")) != -1) { + switch (c) { + case 'c': + create_nodes = 1; + unlink_nodes = 0; + break; + case 'd': + print_nodes = 1; + break; + case 'M': + mode = strtol(optarg, NULL, 10); + break; + case 'm': + major = strtol(optarg, NULL, 10); + break; + case 't': + type = strtol(optarg, NULL, 10); + break; + case 'u': + unlink_nodes = 1; + create_nodes = 0; + break; + default: + is_err++; + break; + } + } + + if (is_err || optind >= argc) { + fprintf(stderr,"Usage: %s [-d|-c|-u|-m |-t ] \n", + argv[0]); + return 1; + } + + dev = argv[optind]; + if (dev[strlen(dev) - 3] != 'f' || dev[strlen(dev) -2 ] != 'd') { + fprintf(stderr,"Device '%s' is not a floppy device\n", dev); + return 1; + } + + fdnum = strtol(dev + 2, NULL, 10); + if (fdnum < 0 || fdnum > 7) { + fprintf(stderr,"Floppy device number %d out of range (0-7)\n", fdnum); + return 1; + } + if (fdnum > 3) + fdnum += 128; + + if (major < 1) { + fprintf(stderr,"Invalid major number %d\n", major); + return 1; + } + + if (type < 0 || type > (int) sizeof(table)) { + fprintf(stderr,"Invalid CMOS type %d\n", type); + return 1; + } + + if (type == 0) + return 0; + + i = 0; + while (table_sup[type][i]) { + sprintf(node,"%s%s",dev,table[table_sup[type][i]]); + minor = (table_sup[type][i] << 2) + fdnum; + if (print_nodes) + printf("%s b %d %d %d\n", node, mode, major, minor); + if (create_nodes) + mknod(node, S_IFBLK | mode, makedev(major,minor)); + i++; + } + + return 0; +} + diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 7e9a940f85..742b28ec1c 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -7,6 +7,7 @@ EXTRAS="\ extras/volume_id \ extras/usb_id \ extras/dasd_id \ + extras/floppy \ extras/run_directory" [ -z "$KERNEL_DIR" ] && KERNEL_DIR=/lib/modules/`uname -r`/build -- cgit v1.2.3-54-g00ecf From 46f01c6dc44ba516e42d5c8c1ada98a743f916f2 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 19 Jul 2005 11:18:19 -0400 Subject: add ID_BUS to *_id programs --- extras/ata_id/ata_id.c | 1 + extras/dasd_id/dasd_id.c | 1 + extras/scsi_id/scsi_id.c | 1 + extras/usb_id/usb_id.c | 1 + 4 files changed, 4 insertions(+) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 9df0fdb107..1e99b9df9c 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -169,6 +169,7 @@ int main(int argc, char *argv[]) printf("ID_MODEL=%s\n", model); printf("ID_SERIAL=%s\n", serial); printf("ID_REVISION=%s\n", revision); + printf("ID_BUS=ata\n"); } else { if (serial[0] != '\0') printf("%s_%s\n", model, serial); diff --git a/extras/dasd_id/dasd_id.c b/extras/dasd_id/dasd_id.c index 5c2143f45d..e2df65d6ec 100644 --- a/extras/dasd_id/dasd_id.c +++ b/extras/dasd_id/dasd_id.c @@ -262,6 +262,7 @@ int main(int argc, char *argv[]) if (export) { printf("ID_TYPE=disk\n"); printf("ID_SERIAL=%s\n",serial); + printf("ID_BUS=ccw\n"); } else printf("%s\n", serial); diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index cbefb445df..1b4234a40e 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -827,6 +827,7 @@ static int scsi_id(const char *target_path, char *maj_min_dev) set_str(serial_str, serial, sizeof(serial_str)); printf("ID_SERIAL=%s\n", serial_str); printf("ID_TYPE=%s\n", type_str); + printf("ID_BUS=scsi\n"); } else { if (reformat_serial) format_serial(serial); diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index ab116e9d03..1eb45b9114 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -485,6 +485,7 @@ int main(int argc, char **argv) vendor_str, model_str, serial_str); } printf("ID_TYPE=%s\n", type_str); + printf("ID_BUS=usb\n"); } else { if (serial_str[0] == '\0') { printf("%s_%s\n", -- cgit v1.2.3-54-g00ecf From 33aa91b1befa3e4f8da57714ac09b7044cf54451 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 19 Jul 2005 14:36:34 -0400 Subject: usb_id: fix typo --- extras/scsi_id/scsi_id.8 | 4 ++++ extras/usb_id/usb_id.c | 4 ++-- extras/volume_id/volume_id/ocfs2.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 68d4a1c041..26df0d3e66 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -58,6 +58,10 @@ leading \-, runs in a hotplug mode, and expects the environment variable DEVPATH to specify the corresponding sysfs device. See section below on usage with \fBudev\fP. .TP +.BI \-a +Always print information (model, vendor strings) about the device even +if it does not support VPD pages. +.TP .BI \-b The default behaviour \- treat the device as black listed, and do nothing unless a white listed device is found in the scsi_id config\-file. diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 1eb45b9114..720a0f5df7 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -316,11 +316,11 @@ static int usb_id(const char *target_path) /* usb device directory */ usb_dev = sysfs_get_device_parent(interface_dev); - if (!strcmp(interface_dev->bus, "bus") != 0) { + if (strcmp(interface_dev->bus, "usb") != 0) { info("%s is not an usb device", target_path); return 1; } - + if_class = sysfs_get_device_attr(interface_dev, "bInterfaceClass"); if (!if_class) { info("%s: cannot get bInterfaceClass attribute", interface_dev->name); diff --git a/extras/volume_id/volume_id/ocfs2.c b/extras/volume_id/volume_id/ocfs2.c index 1f2819c0cc..90a6bd531c 100644 --- a/extras/volume_id/volume_id/ocfs2.c +++ b/extras/volume_id/volume_id/ocfs2.c @@ -51,7 +51,7 @@ This is one has been simplified since we only care about the superblock. */ struct ocfs2_super_block { - __u8 i_signature[8]; /* Signature for validation */ + __u8 i_signature[8]; /* Signature for validation */ __u32 i_generation; /* Generation number */ __s16 i_suballoc_slot; /* Slot suballocator this inode belongs to */ __u16 i_suballoc_bit; /* Bit offset in suballocator block group */ -- cgit v1.2.3-54-g00ecf From 761e5b476f8e69f41958a62ed787f5d886fa212e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Jul 2005 12:12:56 -0400 Subject: make SYSFS{} usable for all devices Patch from: Hannes Reinecke --- udev.c | 12 +++++++----- udev_rules.c | 22 +++++++++++++++++++--- udev_rules.h | 6 ++++-- udevd.c | 1 + 4 files changed, 31 insertions(+), 10 deletions(-) diff --git a/udev.c b/udev.c index d44f73081d..6e0f7f1d0c 100644 --- a/udev.c +++ b/udev.c @@ -147,27 +147,29 @@ int main(int argc, char *argv[], char *envp[]) udev_rules_get_name(&rules, &udev, class_dev); if (udev.ignore_device) { info("device event will be ignored"); + sysfs_close_class_device(class_dev); goto cleanup; } if (udev.name[0] == '\0') { info("device node creation supressed"); + sysfs_close_class_device(class_dev); goto cleanup; } - /* create node, store in db */ retval = udev_add_device(&udev, class_dev); } else { dbg("no dev-file found"); - udev_rules_get_run(&rules, &udev, NULL); + udev_rules_get_run(&rules, &udev, class_dev, NULL); if (udev.ignore_device) { info("device event will be ignored"); + sysfs_close_class_device(class_dev); goto cleanup; } } sysfs_close_class_device(class_dev); } else if (strcmp(action, "remove") == 0) { dbg("node remove"); - udev_rules_get_run(&rules, &udev, NULL); + udev_rules_get_run(&rules, &udev, NULL, NULL); if (udev.ignore_device) { dbg("device event will be ignored"); goto cleanup; @@ -194,7 +196,7 @@ int main(int argc, char *argv[], char *envp[]) } dbg("devices device opened '%s'", path); wait_for_devices_device(devices_dev, &error); - udev_rules_get_run(&rules, &udev, devices_dev); + udev_rules_get_run(&rules, &udev, NULL, devices_dev); sysfs_close_device(devices_dev); if (udev.ignore_device) { info("device event will be ignored"); @@ -202,7 +204,7 @@ int main(int argc, char *argv[], char *envp[]) } } else { dbg("default handling"); - udev_rules_get_run(&rules, &udev, NULL); + udev_rules_get_run(&rules, &udev, NULL, NULL); if (udev.ignore_device) { info("device event will be ignored"); goto cleanup; diff --git a/udev_rules.c b/udev_rules.c index 939febe8f6..6cbaa781f6 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1091,10 +1091,21 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s return 0; } -int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, struct sysfs_device *sysfs_device) +int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, + struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_dev) { struct udev_rule *rule; + if (class_dev && !sysfs_dev) + sysfs_dev = sysfs_get_classdev_device(class_dev); + if (sysfs_dev) { + dbg("found devices device: path='%s', bus_id='%s', bus='%s'", + sysfs_dev->path, sysfs_dev->bus_id, sysfs_dev->bus); + strlcpy(udev->bus_id, sysfs_dev->bus_id, sizeof(udev->bus_id)); + } + + dbg("udev->kernel_name='%s'", udev->kernel_name); + /* look for a matching rule to apply */ udev_rules_iter_init(rules); while (1) { @@ -1109,7 +1120,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, struct sy continue; } - if (match_rule(udev, rule, NULL, sysfs_device) == 0) { + if (match_rule(udev, rule, class_dev, sysfs_dev) == 0) { if (rule->ignore_device) { info("rule applied, '%s' is ignored", udev->kernel_name); udev->ignore_device = 1; @@ -1130,7 +1141,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, struct sy } } strlcpy(program, key_val(rule, &rule->run), sizeof(program)); - apply_format(udev, program, sizeof(program), NULL, sysfs_device); + apply_format(udev, program, sizeof(program), class_dev, sysfs_dev); dbg("add run '%s'", program); name_list_add(&udev->run_list, program, 0); if (rule->run.operation == KEY_OP_ASSIGN_FINAL) @@ -1141,6 +1152,11 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, struct sy dbg("last rule to be applied"); break; } + + if (rule->goto_label.operation != KEY_OP_UNSET) { + dbg("moving forward to label '%s'", key_val(rule, &rule->goto_label)); + udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); + } } } diff --git a/udev_rules.h b/udev_rules.h index d22d31f7e1..bfcb3f23d5 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -112,7 +112,9 @@ extern void udev_rules_iter_init(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label); -extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct sysfs_class_device *class_dev); -extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, struct sysfs_device *sysfs_device); +extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, + struct sysfs_class_device *class_dev); +extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, + struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_dev); #endif diff --git a/udevd.c b/udevd.c index 110d8e7c4d..be401bec30 100644 --- a/udevd.c +++ b/udevd.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "list.h" -- cgit v1.2.3-54-g00ecf From e8d569b4145a358775e87058829133fa725b32fd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 22 Jul 2005 12:35:58 -0400 Subject: move code to its own files Signed-off-by: Kay Sievers --- Makefile | 48 +++++++++-------- extras/usb_id/Makefile | 2 +- udev.c | 102 ++--------------------------------- udev.h | 7 ++- udev.spec | 7 +-- udev_add.c | 4 +- udev_config.c | 4 +- udev_db.c | 2 - udev_db.h | 4 +- udev_device.c | 121 ++++++++++++++++++++++++++++++++++++++++++ udev_event.c | 141 +++++++++++++++++++++++++++++++++++++++++++++++++ udev_remove.c | 4 +- udev_rules.c | 56 -------------------- udev_rules.h | 8 +-- udev_rules_parse.c | 3 -- udev_utils.c | 125 +++++++++++++++++-------------------------- udev_utils.h | 14 +++-- udevcontrol.c | 3 -- udevd.h | 5 +- udeveventrecorder.c | 6 +-- udevinfo.c | 2 +- udevinitsend.c | 6 +-- udevsend.c | 3 -- udevstart.c | 10 ++-- udevtest.c | 4 +- 25 files changed, 380 insertions(+), 311 deletions(-) create mode 100644 udev_device.c create mode 100644 udev_event.c diff --git a/Makefile b/Makefile index b740838ace..881ef85ad6 100644 --- a/Makefile +++ b/Makefile @@ -115,34 +115,36 @@ CFLAGS += -D_GNU_SOURCE OPTFLAGS := $(call cc-supports, -Os, -O2) HEADERS = \ - udev.h \ - udev_utils.h \ - udev_rules.h \ - udev_version.h \ - udev_db.h \ - udev_sysfs.h \ - logging.h \ - udev_libc_wrapper.h \ - udev_selinux.h \ + udev.h \ + udev_utils.h \ + udev_rules.h \ + udev_version.h \ + udev_db.h \ + udev_sysfs.h \ + logging.h \ + udev_libc_wrapper.h \ + udev_selinux.h \ list.h SYSFS_OBJS = \ - libsysfs/sysfs_class.o \ - libsysfs/sysfs_device.o \ - libsysfs/sysfs_dir.o \ - libsysfs/sysfs_driver.o \ - libsysfs/sysfs_utils.o \ + libsysfs/sysfs_class.o \ + libsysfs/sysfs_device.o \ + libsysfs/sysfs_dir.o \ + libsysfs/sysfs_driver.o \ + libsysfs/sysfs_utils.o \ libsysfs/dlist.o UDEV_OBJS = \ - udev_utils.o \ - udev_config.o \ - udev_add.o \ - udev_remove.o \ - udev_sysfs.o \ - udev_db.o \ - udev_rules.o \ - udev_rules_parse.o \ + udev_utils.o \ + udev_event.o \ + udev_device.o \ + udev_config.o \ + udev_add.o \ + udev_remove.o \ + udev_sysfs.o \ + udev_db.o \ + udev_rules.o \ + udev_rules_parse.o \ udev_libc_wrapper.o OBJS = \ @@ -151,7 +153,7 @@ OBJS = \ SYSFS = $(PWD)/libsysfs/sysfs.a -CFLAGS += -I$(PWD)/libsysfs/sysfs \ +CFLAGS += -I$(PWD)/libsysfs/sysfs \ -I$(PWD)/libsysfs ifeq ($(strip $(USE_LOG)),true) diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 4324f95c76..e319a4fee8 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -28,7 +28,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-D_FILE_OFFSET_BITS=64 +CFLAGS+=-D_FILE_OFFSET_BITS=64 OBJS = $(PROG).o $(VOLUME_ID_OBJS) ../../udev.a ../../libsysfs/sysfs.a HEADERS = diff --git a/udev.c b/udev.c index 6e0f7f1d0c..4096b8b348 100644 --- a/udev.c +++ b/udev.c @@ -1,10 +1,8 @@ /* * udev.c * - * Userspace devfs - * - * Copyright (C) 2003,2004 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2005 Kay Sievers * * 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 @@ -69,8 +67,6 @@ int main(int argc, char *argv[], char *envp[]) { struct udevice udev; struct udev_rules rules; - char path[PATH_SIZE]; - const char *error; const char *action; const char *devpath; const char *subsystem; @@ -121,98 +117,9 @@ int main(int argc, char *argv[], char *envp[]) udev_init_device(&udev, devpath, subsystem, action); udev_rules_init(&rules, 0); - if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS || udev.type == DEV_NET) { - /* handle device node */ - if (strcmp(action, "add") == 0) { - struct sysfs_class_device *class_dev; - - /* wait for sysfs of /sys/class /sys/block */ - dbg("node add"); - snprintf(path, sizeof(path), "%s%s", sysfs_path, udev.devpath); - path[sizeof(path)-1] = '\0'; - class_dev = wait_class_device_open(path); - if (class_dev == NULL) { - dbg("open class device failed"); - goto run; - } - dbg("opened class_dev->name='%s'", class_dev->name); - wait_for_class_device(class_dev, &error); - - /* get major/minor */ - if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS) - udev.devt = get_devt(class_dev); - - if (udev.type == DEV_NET || udev.devt) { - /* name device */ - udev_rules_get_name(&rules, &udev, class_dev); - if (udev.ignore_device) { - info("device event will be ignored"); - sysfs_close_class_device(class_dev); - goto cleanup; - } - if (udev.name[0] == '\0') { - info("device node creation supressed"); - sysfs_close_class_device(class_dev); - goto cleanup; - } - /* create node, store in db */ - retval = udev_add_device(&udev, class_dev); - } else { - dbg("no dev-file found"); - udev_rules_get_run(&rules, &udev, class_dev, NULL); - if (udev.ignore_device) { - info("device event will be ignored"); - sysfs_close_class_device(class_dev); - goto cleanup; - } - } - sysfs_close_class_device(class_dev); - } else if (strcmp(action, "remove") == 0) { - dbg("node remove"); - udev_rules_get_run(&rules, &udev, NULL, NULL); - if (udev.ignore_device) { - dbg("device event will be ignored"); - goto cleanup; - } - - /* get name from db, remove db-entry, delete node */ - retval = udev_remove_device(&udev); - } - - /* export name of device node or netif */ - if (udev.devname[0] != '\0') - setenv("DEVNAME", udev.devname, 1); - } else if (udev.type == DEV_DEVICE && strcmp(action, "add") == 0) { - struct sysfs_device *devices_dev; - - /* wait for sysfs of /sys/devices/ */ - dbg("devices add"); - snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); - path[sizeof(path)-1] = '\0'; - devices_dev = wait_devices_device_open(path); - if (!devices_dev) { - dbg("devices device unavailable (probably remove has beaten us)"); - goto run; - } - dbg("devices device opened '%s'", path); - wait_for_devices_device(devices_dev, &error); - udev_rules_get_run(&rules, &udev, NULL, devices_dev); - sysfs_close_device(devices_dev); - if (udev.ignore_device) { - info("device event will be ignored"); - goto cleanup; - } - } else { - dbg("default handling"); - udev_rules_get_run(&rules, &udev, NULL, NULL); - if (udev.ignore_device) { - info("device event will be ignored"); - goto cleanup; - } - } + retval = udev_process_event(&rules, &udev); -run: - if (udev_run && !list_empty(&udev.run_list)) { + if (!retval && udev_run && !list_empty(&udev.run_list)) { struct name_entry *name_loop; dbg("executing run list"); @@ -220,7 +127,6 @@ run: execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); } -cleanup: udev_cleanup_device(&udev); exit: diff --git a/udev.h b/udev.h index 391dc2c41c..66edfd66bf 100644 --- a/udev.h +++ b/udev.h @@ -1,8 +1,6 @@ /* * udev.h * - * Userspace devfs - * * Copyright (C) 2003 Greg Kroah-Hartman * Copyright (C) 2003-2005 Kay Sievers * @@ -40,6 +38,8 @@ #define DEFAULT_PARTITIONS_COUNT 15 #define UDEV_ALARM_TIMEOUT 120 +struct udev_rules; + enum device_type { DEV_UNKNOWN, DEV_CLASS, @@ -82,6 +82,9 @@ struct udevice { int test_run; }; +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); extern int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev); extern int udev_remove_device(struct udevice *udev); extern void udev_init_config(void); diff --git a/udev.spec b/udev.spec index 22d9160529..09f95f1317 100644 --- a/udev.spec +++ b/udev.spec @@ -27,7 +27,7 @@ # 1 - build it %define volume_id 1 -Summary: A userspace implementation of devfs +Summary: A userspace device manager providing devfs functionality Name: udev Version: 063 Release: 1 @@ -41,8 +41,9 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Prereq: /bin/sh, fileutils, hotplug %description -udev is a implementation of devfs in userspace using sysfs and -/sbin/hotplug. It requires a 2.6 kernel to run properly. +udev is a userspace device manager, using sysfs and uevents +to provide a devfs-like device directory management and uevent +dispatching. %prep %setup -q diff --git a/udev_add.c b/udev_add.c index e9ae150180..9d872bf039 100644 --- a/udev_add.c +++ b/udev_add.c @@ -1,10 +1,8 @@ /* * udev-add.c * - * Userspace devfs - * * Copyright (C) 2003 Greg Kroah-Hartman - * + * Copyright (C) 2004 Kay Sievers * * 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 diff --git a/udev_config.c b/udev_config.c index 773ee67f9e..c57e36cd8c 100644 --- a/udev_config.c +++ b/udev_config.c @@ -1,10 +1,8 @@ /* * udev_config.c * - * Userspace devfs - * * Copyright (C) 2003,2004 Greg Kroah-Hartman - * + * Copyright (C) 2004, 2005 Kay Sievers * * 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 diff --git a/udev_db.c b/udev_db.c index 6f10b1e58d..ef0e9a71ae 100644 --- a/udev_db.c +++ b/udev_db.c @@ -1,8 +1,6 @@ /* * udev_db.c * - * Userspace devfs - * * Copyright (C) 2003 Greg Kroah-Hartman * Copyright (C) 2004-2005 Kay Sievers * diff --git a/udev_db.h b/udev_db.h index 9420981944..b961c87102 100644 --- a/udev_db.h +++ b/udev_db.h @@ -1,10 +1,8 @@ /* * udev_db.h * - * Userspace devfs - * * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004-2005 Kay Sievers * * 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 diff --git a/udev_device.c b/udev_device.c new file mode 100644 index 0000000000..45bb6a2876 --- /dev/null +++ b/udev_device.c @@ -0,0 +1,121 @@ +/* + * udev_utils.c - generic stuff used by udev + * + * Copyright (C) 2004, 2005 Kay Sievers + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev_libc_wrapper.h" +#include "udev.h" +#include "logging.h" +#include "udev_utils.h" +#include "udev_sysfs.h" +#include "list.h" + + +int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem, const char *action) +{ + char *pos; + + memset(udev, 0x00, sizeof(struct udevice)); + INIT_LIST_HEAD(&udev->symlink_list); + INIT_LIST_HEAD(&udev->run_list); + INIT_LIST_HEAD(&udev->env_list); + + if (subsystem) + strlcpy(udev->subsystem, subsystem, sizeof(udev->subsystem)); + + if (action) + strlcpy(udev->action, action, sizeof(udev->action)); + + if (devpath) { + strlcpy(udev->devpath, devpath, sizeof(udev->devpath)); + remove_trailing_char(udev->devpath, '/'); + + if (strncmp(udev->devpath, "/block/", 7) == 0) + udev->type = DEV_BLOCK; + else if (strncmp(udev->devpath, "/class/net/", 11) == 0) + udev->type = DEV_NET; + else if (strncmp(udev->devpath, "/class/", 7) == 0) + udev->type = DEV_CLASS; + else if (strncmp(udev->devpath, "/devices/", 9) == 0) + udev->type = DEV_DEVICE; + + /* get kernel name */ + pos = strrchr(udev->devpath, '/'); + if (pos) { + strlcpy(udev->kernel_name, &pos[1], sizeof(udev->kernel_name)); + dbg("kernel_name='%s'", udev->kernel_name); + + /* Some block devices have '!' in their name, change that to '/' */ + pos = udev->kernel_name; + while (pos[0] != '\0') { + if (pos[0] == '!') + pos[0] = '/'; + pos++; + } + + /* get kernel number */ + pos = &udev->kernel_name[strlen(udev->kernel_name)]; + while (isdigit(pos[-1])) + pos--; + strlcpy(udev->kernel_number, pos, sizeof(udev->kernel_number)); + dbg("kernel_number='%s'", udev->kernel_number); + } + } + + if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { + udev->mode = 0660; + strcpy(udev->owner, "root"); + strcpy(udev->group, "root"); + } + + return 0; +} + +void udev_cleanup_device(struct udevice *udev) +{ + struct name_entry *name_loop; + struct name_entry *temp_loop; + + list_for_each_entry_safe(name_loop, temp_loop, &udev->symlink_list, node) { + list_del(&name_loop->node); + free(name_loop); + } + list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) { + list_del(&name_loop->node); + free(name_loop); + } + list_for_each_entry_safe(name_loop, temp_loop, &udev->env_list, node) { + list_del(&name_loop->node); + free(name_loop); + } +} diff --git a/udev_event.c b/udev_event.c new file mode 100644 index 0000000000..8a3ed29315 --- /dev/null +++ b/udev_event.c @@ -0,0 +1,141 @@ +/* + * udev_event.c - udev event process + * + * Copyright (C) 2004, 2005 Kay Sievers + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev_libc_wrapper.h" +#include "udev.h" +#include "logging.h" +#include "udev_rules.h" +#include "udev_utils.h" +#include "udev_sysfs.h" +#include "list.h" + + +int udev_process_event(struct udev_rules *rules, struct udevice *udev) +{ + int retval; + char path[PATH_SIZE]; + const char *error; + + if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS || udev->type == DEV_NET) { + /* handle device node */ + if (strcmp(udev->action, "add") == 0) { + struct sysfs_class_device *class_dev; + + /* wait for sysfs of /sys/class /sys/block */ + dbg("node add"); + snprintf(path, sizeof(path), "%s%s", sysfs_path, udev->devpath); + path[sizeof(path)-1] = '\0'; + class_dev = wait_class_device_open(path); + if (class_dev == NULL) { + dbg("open class device failed"); + return 0; + } + dbg("opened class_dev->name='%s'", class_dev->name); + wait_for_class_device(class_dev, &error); + + /* get major/minor */ + if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) + udev->devt = get_devt(class_dev); + + if (udev->type == DEV_NET || udev->devt) { + /* name device */ + udev_rules_get_name(rules, udev, class_dev); + if (udev->ignore_device) { + info("device event will be ignored"); + sysfs_close_class_device(class_dev); + return -1; + } + if (udev->name[0] == '\0') { + info("device node creation supressed"); + sysfs_close_class_device(class_dev); + return -1; + } + /* create node, store in db */ + retval = udev_add_device(udev, class_dev); + } else { + dbg("no dev-file found"); + udev_rules_get_run(rules, udev, class_dev, NULL); + if (udev->ignore_device) { + info("device event will be ignored"); + sysfs_close_class_device(class_dev); + return -1; + } + } + sysfs_close_class_device(class_dev); + } else if (strcmp(udev->action, "remove") == 0) { + dbg("node remove"); + udev_rules_get_run(rules, udev, NULL, NULL); + if (udev->ignore_device) { + dbg("device event will be ignored"); + return -1; + } + + /* get name from db, remove db-entry, delete node */ + retval = udev_remove_device(udev); + } + + /* export name of device node or netif */ + if (udev->devname[0] != '\0') + setenv("DEVNAME", udev->devname, 1); + } else if (udev->type == DEV_DEVICE && strcmp(udev->action, "add") == 0) { + struct sysfs_device *devices_dev; + + /* wait for sysfs of /sys/devices/ */ + dbg("devices add"); + snprintf(path, sizeof(path), "%s%s", sysfs_path, udev->devpath); + path[sizeof(path)-1] = '\0'; + devices_dev = wait_devices_device_open(path); + if (!devices_dev) { + dbg("devices device unavailable (probably remove has beaten us)"); + return 0; + } + dbg("devices device opened '%s'", path); + wait_for_devices_device(devices_dev, &error); + udev_rules_get_run(rules, udev, NULL, devices_dev); + sysfs_close_device(devices_dev); + if (udev->ignore_device) { + info("device event will be ignored"); + return -1; + } + } else { + dbg("default handling"); + udev_rules_get_run(rules, udev, NULL, NULL); + if (udev->ignore_device) { + info("device event will be ignored"); + return -1; + } + } + return 0; +} diff --git a/udev_remove.c b/udev_remove.c index b9a4384ee0..28885d4710 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -1,10 +1,8 @@ /* * udev-remove.c * - * Userspace devfs - * * Copyright (C) 2003 Greg Kroah-Hartman - * + * Copyright (C) 2004 Kay Sievers * * 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 diff --git a/udev_rules.c b/udev_rules.c index 6cbaa781f6..6a485f08af 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1,12 +1,9 @@ /* * udev_rules.c * - * Userspace devfs - * * Copyright (C) 2003 Greg Kroah-Hartman * Copyright (C) 2003-2005 Kay Sievers * - * * 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. @@ -44,59 +41,6 @@ #include "udev_db.h" -/* compare string with pattern (supports * ? [0-9] [!A-Z]) */ -static int strcmp_pattern(const char *p, const char *s) -{ - if (s[0] == '\0') { - while (p[0] == '*') - p++; - return (p[0] != '\0'); - } - switch (p[0]) { - case '[': - { - int not = 0; - p++; - if (p[0] == '!') { - not = 1; - p++; - } - while ((p[0] != '\0') && (p[0] != ']')) { - int match = 0; - if (p[1] == '-') { - if ((s[0] >= p[0]) && (s[0] <= p[2])) - match = 1; - p += 3; - } else { - match = (p[0] == s[0]); - p++; - } - if (match ^ not) { - while ((p[0] != '\0') && (p[0] != ']')) - p++; - if (p[0] == ']') - return strcmp_pattern(p+1, s+1); - } - } - } - break; - case '*': - if (strcmp_pattern(p, s+1)) - return strcmp_pattern(p+1, s); - return 0; - case '\0': - if (s[0] == '\0') { - return 0; - } - break; - default: - if ((p[0] == s[0]) || (p[0] == '?')) - return strcmp_pattern(p+1, s+1); - break; - } - return 1; -} - /* extract possible {attr} and move str behind it */ static char *get_format_attribute(char **str) { diff --git a/udev_rules.h b/udev_rules.h index bfcb3f23d5..9e3931129f 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -1,9 +1,8 @@ /* * udev_rules.h * - * Userspace devfs - * - * Copyright (C) 2003,2004 Greg Kroah-Hartman + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2005 Kay Sievers * * 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 @@ -108,6 +107,9 @@ struct udev_rules { extern int udev_rules_init(struct udev_rules *rules, int resolve_names); extern void udev_rules_close(struct udev_rules *rules); +extern void udev_apply_format(struct udevice *udev, char *string, size_t maxsize, + struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device); + extern void udev_rules_iter_init(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label); diff --git a/udev_rules_parse.c b/udev_rules_parse.c index e708f35558..be0757374e 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -1,12 +1,9 @@ /* * udev_rules_parse.c * - * Userspace devfs - * * Copyright (C) 2003,2004 Greg Kroah-Hartman * Copyright (C) 2003-2005 Kay Sievers * - * * 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. diff --git a/udev_utils.c b/udev_utils.c index 073cde1074..2524baf592 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -1,7 +1,7 @@ /* - * udev_lib - generic stuff used by udev + * udev_utils.c - generic stuff used by udev * - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004-2005 Kay Sievers * * 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 @@ -39,84 +39,57 @@ #include "udev_utils.h" #include "list.h" - -int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem, const char *action) +/* compare string with pattern (supports * ? [0-9] [!A-Z]) */ +int strcmp_pattern(const char *p, const char *s) { - char *pos; - - memset(udev, 0x00, sizeof(struct udevice)); - INIT_LIST_HEAD(&udev->symlink_list); - INIT_LIST_HEAD(&udev->run_list); - INIT_LIST_HEAD(&udev->env_list); - - if (subsystem) - strlcpy(udev->subsystem, subsystem, sizeof(udev->subsystem)); - - if (action) - strlcpy(udev->action, action, sizeof(udev->action)); - - if (devpath) { - strlcpy(udev->devpath, devpath, sizeof(udev->devpath)); - remove_trailing_char(udev->devpath, '/'); - - if (strncmp(udev->devpath, "/block/", 7) == 0) - udev->type = DEV_BLOCK; - else if (strncmp(udev->devpath, "/class/net/", 11) == 0) - udev->type = DEV_NET; - else if (strncmp(udev->devpath, "/class/", 7) == 0) - udev->type = DEV_CLASS; - else if (strncmp(udev->devpath, "/devices/", 9) == 0) - udev->type = DEV_DEVICE; - - /* get kernel name */ - pos = strrchr(udev->devpath, '/'); - if (pos) { - strlcpy(udev->kernel_name, &pos[1], sizeof(udev->kernel_name)); - dbg("kernel_name='%s'", udev->kernel_name); - - /* Some block devices have '!' in their name, change that to '/' */ - pos = udev->kernel_name; - while (pos[0] != '\0') { - if (pos[0] == '!') - pos[0] = '/'; - pos++; + if (s[0] == '\0') { + while (p[0] == '*') + p++; + return (p[0] != '\0'); + } + switch (p[0]) { + case '[': + { + int not = 0; + p++; + if (p[0] == '!') { + not = 1; + p++; + } + while ((p[0] != '\0') && (p[0] != ']')) { + int match = 0; + if (p[1] == '-') { + if ((s[0] >= p[0]) && (s[0] <= p[2])) + match = 1; + p += 3; + } else { + match = (p[0] == s[0]); + p++; + } + if (match ^ not) { + while ((p[0] != '\0') && (p[0] != ']')) + p++; + if (p[0] == ']') + return strcmp_pattern(p+1, s+1); + } } - - /* get kernel number */ - pos = &udev->kernel_name[strlen(udev->kernel_name)]; - while (isdigit(pos[-1])) - pos--; - strlcpy(udev->kernel_number, pos, sizeof(udev->kernel_number)); - dbg("kernel_number='%s'", udev->kernel_number); } + break; + case '*': + if (strcmp_pattern(p, s+1)) + return strcmp_pattern(p+1, s); + return 0; + case '\0': + if (s[0] == '\0') { + return 0; + } + break; + default: + if ((p[0] == s[0]) || (p[0] == '?')) + return strcmp_pattern(p+1, s+1); + break; } - - if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { - udev->mode = 0660; - strcpy(udev->owner, "root"); - strcpy(udev->group, "root"); - } - - return 0; -} - -void udev_cleanup_device(struct udevice *udev) -{ - struct name_entry *name_loop; - struct name_entry *temp_loop; - - list_for_each_entry_safe(name_loop, temp_loop, &udev->symlink_list, node) { - list_del(&name_loop->node); - free(name_loop); - } - list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) { - list_del(&name_loop->node); - free(name_loop); - } - list_for_each_entry_safe(name_loop, temp_loop, &udev->env_list, node) { - list_del(&name_loop->node); - free(name_loop); - } + return 1; } int string_is_true(const char *str) diff --git a/udev_utils.h b/udev_utils.h index 655c764fc8..5f4152df82 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -1,8 +1,7 @@ /* - * udev_lib - generic stuff used by udev - * - * Copyright (C) 2004 Kay Sievers + * udev_utils.c - generic stuff used by udev * + * Copyright (C) 2004-2005 Kay Sievers * * 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 @@ -19,19 +18,18 @@ * */ -#ifndef _UDEV_LIB_H_ -#define _UDEV_LIB_H_ +#ifndef _UDEV_COMMON_H_ +#define _UDEV_COMMON_H_ #include "udev.h" +#include "list.h" struct name_entry { struct list_head node; char name[PATH_SIZE]; }; -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 strcmp_pattern(const char *p, const char *s); extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); extern int create_path(const char *path); extern int log_priority(const char *priority); diff --git a/udevcontrol.c b/udevcontrol.c index f19ae98fba..5d8fa77683 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -1,11 +1,8 @@ /* * udevcontrol.c * - * Userspace devfs - * * Copyright (C) 2005 Kay Sievers * - * * 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. diff --git a/udevd.h b/udevd.h index c60fb139c0..aadae31e57 100644 --- a/udevd.h +++ b/udevd.h @@ -1,11 +1,8 @@ /* * udevd.h * - * Userspace devfs - * * Copyright (C) 2004 Ling, Xiaofeng - * Copyright (C) 2004 Kay Sievers - * + * Copyright (C) 2004-2005 Kay Sievers * * 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 diff --git a/udeveventrecorder.c b/udeveventrecorder.c index af7ea7c15c..711f467307 100644 --- a/udeveventrecorder.c +++ b/udeveventrecorder.c @@ -1,9 +1,9 @@ /* * udeveventrecorder.c * - * Userspace devfs - * - * Copyright (C) 2004, 2005 Olaf Hering + * Copyright (C) 2004-2005 SuSE Linux Products GmbH + * Author: + * Olaf Hering * * 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 diff --git a/udevinfo.c b/udevinfo.c index db562eee49..d2c3e1ab7f 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -1,5 +1,5 @@ /* - * udevinfo - fetches attributes for a device + * udevinfo.c - fetches attributes for a device * * Copyright (C) 2004 Kay Sievers * diff --git a/udevinitsend.c b/udevinitsend.c index 204e9cecd5..5abf3d4bd3 100644 --- a/udevinitsend.c +++ b/udevinitsend.c @@ -1,9 +1,9 @@ /* * udevinitsend.c * - * Userspace devfs - * - * Copyright (C) 2004, 2005 Hannes Reinecke + * Copyright (C) 2004, 2005 SuSE Linux Products GmbH + * Author: + * Hannes Reinecke * * 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 diff --git a/udevsend.c b/udevsend.c index bdc69d0508..94ab6ff625 100644 --- a/udevsend.c +++ b/udevsend.c @@ -1,12 +1,9 @@ /* * udevsend.c * - * Userspace devfs - * * Copyright (C) 2004 Ling, Xiaofeng * Copyright (C) 2004 Kay Sievers * - * * 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. diff --git a/udevstart.c b/udevstart.c index d9912466ca..0bcbc39737 100644 --- a/udevstart.c +++ b/udevstart.c @@ -2,10 +2,12 @@ * udevstart.c * * Copyright (C) 2004 Greg Kroah-Hartman - * + * Copyright (C) 2004 Kay Sievers + * * Quick and dirty way to populate a /dev with udev if your system - * does not have access to a shell. Based originally on a patch to udev - * from Harald Hoyer + * does not have access to a shell. Based originally on a patch + * from: + * Harald Hoyer * * 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 @@ -41,8 +43,8 @@ #include "udev.h" #include "udev_version.h" #include "logging.h" -#include "udev_rules.h" #include "udev_utils.h" +#include "udev_rules.h" #include "list.h" static const char *udev_run_str; diff --git a/udevtest.c b/udevtest.c index 3e17b94715..4890b6837c 100644 --- a/udevtest.c +++ b/udevtest.c @@ -1,9 +1,7 @@ /* * udevtest.c * - * Userspace devfs - * - * Copyright (C) 2003,2004 Greg Kroah-Hartman + * Copyright (C) 2003-2004 Greg Kroah-Hartman * * 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 -- cgit v1.2.3-54-g00ecf From fa5c98ab9c9fa86e7078011c6c95597b74be2103 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 23 Jul 2005 12:26:28 -0400 Subject: 063 release --- ChangeLog | 19 +++++++++++++++++++ Makefile | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 159437240f..0ce54a817d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Summary of changes from v063 to v064 +============================================ + +Andre Masella: + volume_id: add OCFS (Oracle Cluster File System) support + +Hannes Reinecke: + usb_id: fix typo + add ID_BUS to *_id programs + create_floppy_devices: add tool to create floppy nodes based on sysfs info + +Kay Sievers: + move code to its own files + make SYSFS{} usable for all devices + add padding to rules structure + allow rules to have labels and skip to next label + thread unknown ENV{key} match as empty value + + Summary of changes from v062 to v063 ============================================ diff --git a/Makefile b/Makefile index 881ef85ad6..4b312806eb 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false -VERSION = 063 +VERSION = 064 ROOT = udev DAEMON = udevd SENDER = udevsend -- cgit v1.2.3-54-g00ecf From 62a22c8d75550d5720019468c7a881a573bff22b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 23 Jul 2005 12:27:02 -0400 Subject: Oops, 064 release, not 063 --- udev.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.spec b/udev.spec index 09f95f1317..2027725674 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace device manager providing devfs functionality Name: udev -Version: 063 +Version: 064 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 70721db6d7ba0d4f3ac5c17f2cedac056065ad8a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Aug 2005 01:33:36 +0200 Subject: fix GGC signed pointer warnings and switch volume_id to stdint Solaris uses volume_id now and they fiddled around with configure scripts to map the linux kernel int types. Adding the types locally to volume_id breaks the klibc build, so just switch to these ugly types and forget it. :) Signed-off-by: Kay Sievers --- Makefile | 6 +- extras/ata_id/Makefile | 2 - extras/ata_id/ata_id.c | 11 +- extras/dasd_id/Makefile | 2 - extras/dasd_id/dasd_id.c | 7 +- extras/floppy/Makefile | 2 - extras/run_directory/Makefile | 2 - extras/scsi_id/Makefile | 3 +- extras/scsi_id/scsi_id.c | 5 +- extras/scsi_id/scsi_serial.c | 15 +- extras/usb_id/Makefile | 2 - extras/usb_id/usb_id.c | 5 +- extras/volume_id/Makefile | 2 - extras/volume_id/vol_id.c | 27 ++-- extras/volume_id/volume_id/cramfs.c | 23 ++- extras/volume_id/volume_id/cramfs.h | 2 +- extras/volume_id/volume_id/ext.c | 35 +++-- extras/volume_id/volume_id/ext.h | 2 +- extras/volume_id/volume_id/fat.c | 135 +++++++++-------- extras/volume_id/volume_id/fat.h | 2 +- extras/volume_id/volume_id/hfs.c | 157 ++++++++++---------- extras/volume_id/volume_id/hfs.h | 2 +- extras/volume_id/volume_id/highpoint.c | 21 ++- extras/volume_id/volume_id/highpoint.h | 4 +- extras/volume_id/volume_id/hpfs.c | 7 +- extras/volume_id/volume_id/hpfs.h | 2 +- extras/volume_id/volume_id/iso9660.c | 35 +++-- extras/volume_id/volume_id/iso9660.h | 2 +- extras/volume_id/volume_id/isw_raid.c | 19 ++- extras/volume_id/volume_id/isw_raid.h | 2 +- extras/volume_id/volume_id/jfs.c | 23 ++- extras/volume_id/volume_id/jfs.h | 2 +- extras/volume_id/volume_id/linux_raid.c | 41 +++--- extras/volume_id/volume_id/linux_raid.h | 2 +- extras/volume_id/volume_id/linux_swap.c | 17 +-- extras/volume_id/volume_id/linux_swap.h | 2 +- extras/volume_id/volume_id/lsi_raid.c | 9 +- extras/volume_id/volume_id/lsi_raid.h | 2 +- extras/volume_id/volume_id/luks.c | 37 +++-- extras/volume_id/volume_id/luks.h | 2 +- extras/volume_id/volume_id/lvm.c | 23 ++- extras/volume_id/volume_id/lvm.h | 4 +- extras/volume_id/volume_id/mac.c | 28 ++-- extras/volume_id/volume_id/mac.h | 2 +- extras/volume_id/volume_id/minix.c | 23 ++- extras/volume_id/volume_id/minix.h | 2 +- extras/volume_id/volume_id/msdos.c | 43 +++--- extras/volume_id/volume_id/msdos.h | 2 +- extras/volume_id/volume_id/ntfs.c | 107 +++++++------- extras/volume_id/volume_id/ntfs.h | 2 +- extras/volume_id/volume_id/nvidia_raid.c | 15 +- extras/volume_id/volume_id/nvidia_raid.h | 2 +- extras/volume_id/volume_id/ocfs2.c | 98 ++++++------ extras/volume_id/volume_id/ocfs2.h | 2 +- extras/volume_id/volume_id/promise_raid.c | 9 +- extras/volume_id/volume_id/promise_raid.h | 2 +- extras/volume_id/volume_id/reiserfs.c | 40 ++--- extras/volume_id/volume_id/reiserfs.h | 2 +- extras/volume_id/volume_id/romfs.c | 13 +- extras/volume_id/volume_id/romfs.h | 2 +- extras/volume_id/volume_id/silicon_raid.c | 39 +++-- extras/volume_id/volume_id/silicon_raid.h | 2 +- extras/volume_id/volume_id/sysv.c | 90 ++++++------ extras/volume_id/volume_id/sysv.h | 2 +- extras/volume_id/volume_id/udf.c | 37 +++-- extras/volume_id/volume_id/udf.h | 2 +- extras/volume_id/volume_id/ufs.c | 237 +++++++++++++++--------------- extras/volume_id/volume_id/ufs.h | 2 +- extras/volume_id/volume_id/util.c | 47 +++--- extras/volume_id/volume_id/util.h | 40 ++--- extras/volume_id/volume_id/via_raid.c | 25 ++-- extras/volume_id/volume_id/via_raid.h | 2 +- extras/volume_id/volume_id/volume_id.c | 5 +- extras/volume_id/volume_id/volume_id.h | 34 +++-- extras/volume_id/volume_id/xfs.c | 27 ++-- extras/volume_id/volume_id/xfs.h | 2 +- 76 files changed, 831 insertions(+), 861 deletions(-) diff --git a/Makefile b/Makefile index 4b312806eb..c9807de4bc 100644 --- a/Makefile +++ b/Makefile @@ -105,11 +105,11 @@ GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) # check if compiler option is supported cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;} -CFLAGS += -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith -Wstrict-prototypes -Wsign-compare -CFLAGS += $(call cc-supports, -Wno-pointer-sign, ) +CFLAGS += -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith \ + -Wstrict-prototypes -Wsign-compare CFLAGS += $(call cc-supports, -Wdeclaration-after-statement, ) CFLAGS += -pipe -CFLAGS += -D_GNU_SOURCE +CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 # use '-Os' optimization if available, else use -O2 OPTFLAGS := $(call cc-supports, -Os, -O2) diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index a19c4b2289..fb45bcca64 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = ata_id.o ../../udev.a $(OBJS): $(HEADERS) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 1e99b9df9c..2840e91457 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -62,10 +62,9 @@ void log_message(int priority, const char *format, ...) } #endif -static void set_str(char *to, const unsigned char *from, int count) +static void set_str(char *to, const char *from, size_t count) { - int i, j; - int len; + size_t i, j, len; /* strip trailing whitespace */ len = strnlen(from, count); @@ -139,9 +138,9 @@ int main(int argc, char *argv[]) goto close; } - set_str(model, id.model, 40); - set_str(serial, id.serial_no, 20); - set_str(revision, id.fw_rev, 8); + set_str(model, (char *) id.model, 40); + set_str(serial, (char *) id.serial_no, 20); + set_str(revision, (char *) id.fw_rev, 8); if (export) { if ((id.config >> 8) & 0x80) { diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 33bb6965cd..3b0a35f75f 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = dasd_id.o ../../udev.a $(OBJS): $(HEADERS) diff --git a/extras/dasd_id/dasd_id.c b/extras/dasd_id/dasd_id.c index e2df65d6ec..a6f2de0db7 100644 --- a/extras/dasd_id/dasd_id.c +++ b/extras/dasd_id/dasd_id.c @@ -33,7 +33,6 @@ #include #include #include -#include #include "../../logging.h" #include "../../udev_utils.h" @@ -140,7 +139,7 @@ static unsigned char EBCtoASC[256] = 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 }; -static void vtoc_ebcdic_dec (const unsigned char *source, char *target, int l) +static void vtoc_ebcdic_dec (const unsigned char *source, unsigned char *target, int l) { int i; @@ -183,8 +182,8 @@ static int dasd_id(int fd) { int blocksize; dasd_information_t info; - __u8 *data; - __u8 *label_raw; + unsigned char *data; + unsigned char *label_raw; if (ioctl(fd, BIODASDINFO, &info) != 0) { dbg("not a dasd"); diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 2601eeeb55..ab0cd17e58 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = $(PROG).o ../../udev.a $(OBJS): $(HEADERS) diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 0562073c8f..14b4725dae 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -29,8 +29,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = ../../udev.a ../../libsysfs/sysfs.a .c.o: diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 7aa3e83470..24c1b32128 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -28,7 +28,7 @@ INSTALL_DATA = ${INSTALL} -m 644 # Note some of the variables used here are set when built under udev, and # otherwise might not be set. -override CFLAGS+=-Wall -fno-builtin +CFLAGS+=-Wall -fno-builtin PROG=scsi_id SYSFS=-lsysfs @@ -77,3 +77,4 @@ spotless: clean $(PROG): $(OBJS) $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 1b4234a40e..8e5172f93c 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -101,10 +101,9 @@ void log_message (int level, const char *format, ...) return; } -static void set_str(char *to, const unsigned char *from, int count) +static void set_str(char *to, const char *from, size_t count) { - int i, j; - int len; + size_t i, j, len; /* strip trailing whitespace */ len = strnlen(from, count); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 7bfa9d1812..73d66ee615 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -294,9 +294,9 @@ static int scsi_dump(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) return -1; } -static int scsi_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned - char evpd, unsigned char page, unsigned char *buf, - unsigned int buflen) +static int scsi_inquiry(struct sysfs_device *scsi_dev, int fd, + unsigned char evpd, unsigned char page, + unsigned char *buf, unsigned int buflen) { unsigned char inq_cmd[INQUIRY_CMDLEN] = { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; @@ -367,7 +367,7 @@ error: /* Get list of supported EVPD pages */ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, - char *buffer, int len) + unsigned char *buffer, unsigned int len) { int retval; struct sysfs_attribute *vendor; @@ -407,7 +407,7 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, scsi_dev->name); return 1; } - if (!strncmp(&buffer[VENDOR_LENGTH], vendor->value, + if (!strncmp((char *)&buffer[VENDOR_LENGTH], vendor->value, VENDOR_LENGTH)) { log_message(LOG_WARNING, "%s: invalid page0 data\n", scsi_dev->name); @@ -470,8 +470,9 @@ static int prepend_vendor_model(struct sysfs_device *scsi_dev, char *serial) * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill * serial number. **/ -static int check_fill_0x83_id(struct sysfs_device *scsi_dev, char - *page_83, const struct scsi_id_search_values +static int check_fill_0x83_id(struct sysfs_device *scsi_dev, + unsigned char *page_83, + const struct scsi_id_search_values *id_search, char *serial, int max_len) { int i, j, len; diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index e319a4fee8..0635e91cc5 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -CFLAGS+=-D_FILE_OFFSET_BITS=64 - OBJS = $(PROG).o $(VOLUME_ID_OBJS) ../../udev.a ../../libsysfs/sysfs.a HEADERS = diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 720a0f5df7..37db6d14db 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -76,10 +76,9 @@ static int use_num_info; static int export; static int debug; -static void set_str(char *to, const unsigned char *from, int count) +static void set_str(char *to, const char *from, size_t count) { - int i, j; - int len; + size_t i, j, len; /* strip trailing whitespace */ len = strnlen(from, count); diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 014bf8713d..0fadbf5b0e 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -28,8 +28,6 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -override CFLAGS+=-D_FILE_OFFSET_BITS=64 - VOLUME_ID_BASE=volume_id include $(VOLUME_ID_BASE)/Makefile.inc diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index a4a866cfcf..6a9d1120e0 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -60,31 +60,34 @@ void log_message(int priority, const char *format, ...) } #endif -static void set_str(char *to, const unsigned char *from, int count) +static void set_str(char *to, const char *from, size_t count) { - int i, j; - int len; + size_t i, j, len; + /* strip trailing whitespace */ len = strnlen(from, count); while (isspace(from[len-1])) len--; + /* strip leading whitespace */ i = 0; while (isspace(from[i]) && (i < len)) i++; j = 0; while (i < len) { - switch(from[i]) { - case '/': - break; - case ' ': + /* substitute multiple whitespace */ + if (isspace(from[i])) { + while (isspace(from[i])) + i++; to[j++] = '_'; - break; - default: - to[j++] = from[i]; } - i++; + /* skip chars */ + if (from[i] == '/') { + i++; + continue; + } + to[j++] = from[i++]; } to[j] = '\0'; } @@ -106,7 +109,7 @@ int main(int argc, char *argv[]) struct volume_id *vid = NULL; static char name[VOLUME_ID_LABEL_SIZE]; int i; - unsigned long long size; + uint64_t size; const char *node = NULL; int rc = 0; diff --git a/extras/volume_id/volume_id/cramfs.c b/extras/volume_id/volume_id/cramfs.c index 0c76860013..9a71b0265c 100644 --- a/extras/volume_id/volume_id/cramfs.c +++ b/extras/volume_id/volume_id/cramfs.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,21 +39,21 @@ #include "cramfs.h" struct cramfs_super { - __u8 magic[4]; - __u32 size; - __u32 flags; - __u32 future; - __u8 signature[16]; + uint8_t magic[4]; + uint32_t size; + uint32_t flags; + uint32_t future; + uint8_t signature[16]; struct cramfs_info { - __u32 crc; - __u32 edition; - __u32 blocks; - __u32 files; + uint32_t crc; + uint32_t edition; + uint32_t blocks; + uint32_t files; } __attribute__((__packed__)) info; - __u8 name[16]; + uint8_t name[16]; } __attribute__((__packed__)); -int volume_id_probe_cramfs(struct volume_id *id, __u64 off) +int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) { struct cramfs_super *cs; diff --git a/extras/volume_id/volume_id/cramfs.h b/extras/volume_id/volume_id/cramfs.h index b94445b8b7..a40cec199d 100644 --- a/extras/volume_id/volume_id/cramfs.h +++ b/extras/volume_id/volume_id/cramfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_CRAMFS_ #define _VOLUME_ID_CRAMFS_ -extern int volume_id_probe_cramfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/ext.c b/extras/volume_id/volume_id/ext.c index 4783642114..64e5ff7cbf 100644 --- a/extras/volume_id/volume_id/ext.c +++ b/extras/volume_id/volume_id/ext.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "util.h" @@ -40,29 +39,29 @@ #include "ext.h" struct ext2_super_block { - __u32 inodes_count; - __u32 blocks_count; - __u32 r_blocks_count; - __u32 free_blocks_count; - __u32 free_inodes_count; - __u32 first_data_block; - __u32 log_block_size; - __u32 dummy3[7]; - __u8 magic[2]; - __u16 state; - __u32 dummy5[8]; - __u32 feature_compat; - __u32 feature_incompat; - __u32 feature_ro_compat; - __u8 uuid[16]; - __u8 volume_name[16]; + uint32_t inodes_count; + uint32_t blocks_count; + uint32_t r_blocks_count; + uint32_t free_blocks_count; + uint32_t free_inodes_count; + uint32_t first_data_block; + uint32_t log_block_size; + uint32_t dummy3[7]; + uint8_t magic[2]; + uint16_t state; + uint32_t dummy5[8]; + uint32_t feature_compat; + uint32_t feature_incompat; + uint32_t feature_ro_compat; + uint8_t uuid[16]; + uint8_t volume_name[16]; } __attribute__((__packed__)); #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 #define EXT_SUPERBLOCK_OFFSET 0x400 -int volume_id_probe_ext(struct volume_id *id, __u64 off) +int volume_id_probe_ext(struct volume_id *id, uint64_t off) { struct ext2_super_block *es; diff --git a/extras/volume_id/volume_id/ext.h b/extras/volume_id/volume_id/ext.h index 6b9b85876b..aa931a02a8 100644 --- a/extras/volume_id/volume_id/ext.h +++ b/extras/volume_id/volume_id/ext.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_EXT_ #define _VOLUME_ID_EXT_ -extern int volume_id_probe_ext(struct volume_id *id, __u64 off); +extern int volume_id_probe_ext(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/fat.c b/extras/volume_id/volume_id/fat.c index f6d3699758..9fa0387afe 100644 --- a/extras/volume_id/volume_id/fat.c +++ b/extras/volume_id/volume_id/fat.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -48,62 +47,62 @@ #define FAT_ENTRY_FREE 0xe5 struct vfat_super_block { - __u8 boot_jump[3]; - __u8 sysid[8]; - __u16 sector_size; - __u8 sectors_per_cluster; - __u16 reserved; - __u8 fats; - __u16 dir_entries; - __u16 sectors; - __u8 media; - __u16 fat_length; - __u16 secs_track; - __u16 heads; - __u32 hidden; - __u32 total_sect; + uint8_t boot_jump[3]; + uint8_t sysid[8]; + uint16_t sector_size; + uint8_t sectors_per_cluster; + uint16_t reserved; + uint8_t fats; + uint16_t dir_entries; + uint16_t sectors; + uint8_t media; + uint16_t fat_length; + uint16_t secs_track; + uint16_t heads; + uint32_t hidden; + uint32_t total_sect; union { struct fat_super_block { - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[192]; - __u8 pmagic[2]; + uint8_t unknown[3]; + uint8_t serno[4]; + uint8_t label[11]; + uint8_t magic[8]; + uint8_t dummy2[192]; + uint8_t pmagic[2]; } __attribute__((__packed__)) fat; struct fat32_super_block { - __u32 fat32_length; - __u16 flags; - __u8 version[2]; - __u32 root_cluster; - __u16 insfo_sector; - __u16 backup_boot; - __u16 reserved2[6]; - __u8 unknown[3]; - __u8 serno[4]; - __u8 label[11]; - __u8 magic[8]; - __u8 dummy2[164]; - __u8 pmagic[2]; + uint32_t fat32_length; + uint16_t flags; + uint8_t version[2]; + uint32_t root_cluster; + uint16_t insfo_sector; + uint16_t backup_boot; + uint16_t reserved2[6]; + uint8_t unknown[3]; + uint8_t serno[4]; + uint8_t label[11]; + uint8_t magic[8]; + uint8_t dummy2[164]; + uint8_t pmagic[2]; } __attribute__((__packed__)) fat32; } __attribute__((__packed__)) type; } __attribute__((__packed__)); struct vfat_dir_entry { - __u8 name[11]; - __u8 attr; - __u16 time_creat; - __u16 date_creat; - __u16 time_acc; - __u16 date_acc; - __u16 cluster_high; - __u16 time_write; - __u16 date_write; - __u16 cluster_low; - __u32 size; + uint8_t name[11]; + uint8_t attr; + uint16_t time_creat; + uint16_t date_creat; + uint16_t time_acc; + uint16_t date_acc; + uint16_t cluster_high; + uint16_t time_write; + uint16_t date_write; + uint16_t cluster_low; + uint32_t size; } __attribute__((__packed__)); -static char *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) +static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) { unsigned int i; @@ -137,26 +136,26 @@ static char *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) return NULL; } -int volume_id_probe_vfat(struct volume_id *id, __u64 off) +int volume_id_probe_vfat(struct volume_id *id, uint64_t off) { struct vfat_super_block *vs; struct vfat_dir_entry *dir; - __u16 sector_size; - __u16 dir_entries; - __u32 sect_count; - __u16 reserved; - __u32 fat_size; - __u32 root_cluster; - __u32 dir_size; - __u32 cluster_count; - __u32 fat_length; - __u64 root_start; - __u32 start_data_sect; - __u16 root_dir_entries; - __u8 *buf; - __u32 buf_size; - __u8 *label = NULL; - __u32 next; + uint16_t sector_size; + uint16_t dir_entries; + uint32_t sect_count; + uint16_t reserved; + uint32_t fat_size; + uint32_t root_cluster; + uint32_t dir_size; + uint32_t cluster_count; + uint32_t fat_length; + uint64_t root_start; + uint32_t start_data_sect; + uint16_t root_dir_entries; + uint8_t *buf; + uint32_t buf_size; + uint8_t *label = NULL; + uint32_t next; int maxloop; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -294,9 +293,9 @@ fat32: next = root_cluster; maxloop = 100; while (--maxloop) { - __u32 next_sect_off; - __u64 next_off; - __u64 fat_entry_off; + uint32_t next_sect_off; + uint64_t next_off; + uint64_t fat_entry_off; int count; dbg("next cluster %u", next); @@ -318,13 +317,13 @@ fat32: break; /* get FAT entry */ - fat_entry_off = (reserved * sector_size) + (next * sizeof(__u32)); + fat_entry_off = (reserved * sector_size) + (next * sizeof(uint32_t)); buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); if (buf == NULL) goto found; /* set next cluster */ - next = le32_to_cpu(*((__u32 *) buf) & 0x0fffffff); + next = le32_to_cpu(*((uint32_t *) buf) & 0x0fffffff); if (next == 0) break; } diff --git a/extras/volume_id/volume_id/fat.h b/extras/volume_id/volume_id/fat.h index 51ad94df85..0043210d5a 100644 --- a/extras/volume_id/volume_id/fat.h +++ b/extras/volume_id/volume_id/fat.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_FAT_ #define _VOLUME_ID_FAT_ -extern int volume_id_probe_vfat(struct volume_id *id, __u64 off); +extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/hfs.c b/extras/volume_id/volume_id/hfs.c index 8c40975036..ab1bc2ec39 100644 --- a/extras/volume_id/volume_id/hfs.c +++ b/extras/volume_id/volume_id/hfs.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,104 +39,104 @@ #include "hfs.h" struct hfs_finder_info{ - __u32 boot_folder; - __u32 start_app; - __u32 open_folder; - __u32 os9_folder; - __u32 reserved; - __u32 osx_folder; - __u8 id[8]; + uint32_t boot_folder; + uint32_t start_app; + uint32_t open_folder; + uint32_t os9_folder; + uint32_t reserved; + uint32_t osx_folder; + uint8_t id[8]; } __attribute__((__packed__)); struct hfs_mdb { - __u8 signature[2]; - __u32 cr_date; - __u32 ls_Mod; - __u16 atrb; - __u16 nm_fls; - __u16 vbm_st; - __u16 alloc_ptr; - __u16 nm_al_blks; - __u32 al_blk_size; - __u32 clp_size; - __u16 al_bl_st; - __u32 nxt_cnid; - __u16 free_bks; - __u8 label_len; - __u8 label[27]; - __u32 vol_bkup; - __u16 vol_seq_num; - __u32 wr_cnt; - __u32 xt_clump_size; - __u32 ct_clump_size; - __u16 num_root_dirs; - __u32 file_count; - __u32 dir_count; + uint8_t signature[2]; + uint32_t cr_date; + uint32_t ls_Mod; + uint16_t atrb; + uint16_t nm_fls; + uint16_t vbm_st; + uint16_t alloc_ptr; + uint16_t nm_al_blks; + uint32_t al_blk_size; + uint32_t clp_size; + uint16_t al_bl_st; + uint32_t nxt_cnid; + uint16_t free_bks; + uint8_t label_len; + uint8_t label[27]; + uint32_t vol_bkup; + uint16_t vol_seq_num; + uint32_t wr_cnt; + uint32_t xt_clump_size; + uint32_t ct_clump_size; + uint16_t num_root_dirs; + uint32_t file_count; + uint32_t dir_count; struct hfs_finder_info finder_info; - __u8 embed_sig[2]; - __u16 embed_startblock; - __u16 embed_blockcount; + uint8_t embed_sig[2]; + uint16_t embed_startblock; + uint16_t embed_blockcount; } __attribute__((__packed__)) *hfs; struct hfsplus_bnode_descriptor { - __u32 next; - __u32 prev; - __u8 type; - __u8 height; - __u16 num_recs; - __u16 reserved; + uint32_t next; + uint32_t prev; + uint8_t type; + uint8_t height; + uint16_t num_recs; + uint16_t reserved; } __attribute__((__packed__)); struct hfsplus_bheader_record { - __u16 depth; - __u32 root; - __u32 leaf_count; - __u32 leaf_head; - __u32 leaf_tail; - __u16 node_size; + uint16_t depth; + uint32_t root; + uint32_t leaf_count; + uint32_t leaf_head; + uint32_t leaf_tail; + uint16_t node_size; } __attribute__((__packed__)); struct hfsplus_catalog_key { - __u16 key_len; - __u32 parent_id; - __u16 unicode_len; - __u8 unicode[255 * 2]; + uint16_t key_len; + uint32_t parent_id; + uint16_t unicode_len; + uint8_t unicode[255 * 2]; } __attribute__((__packed__)); struct hfsplus_extent { - __u32 start_block; - __u32 block_count; + uint32_t start_block; + uint32_t block_count; } __attribute__((__packed__)); #define HFSPLUS_EXTENT_COUNT 8 struct hfsplus_fork { - __u64 total_size; - __u32 clump_size; - __u32 total_blocks; + uint64_t total_size; + uint32_t clump_size; + uint32_t total_blocks; struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; } __attribute__((__packed__)); struct hfsplus_vol_header { - __u8 signature[2]; - __u16 version; - __u32 attributes; - __u32 last_mount_vers; - __u32 reserved; - __u32 create_date; - __u32 modify_date; - __u32 backup_date; - __u32 checked_date; - __u32 file_count; - __u32 folder_count; - __u32 blocksize; - __u32 total_blocks; - __u32 free_blocks; - __u32 next_alloc; - __u32 rsrc_clump_sz; - __u32 data_clump_sz; - __u32 next_cnid; - __u32 write_count; - __u64 encodings_bmp; + uint8_t signature[2]; + uint16_t version; + uint32_t attributes; + uint32_t last_mount_vers; + uint32_t reserved; + uint32_t create_date; + uint32_t modify_date; + uint32_t backup_date; + uint32_t checked_date; + uint32_t file_count; + uint32_t folder_count; + uint32_t blocksize; + uint32_t total_blocks; + uint32_t free_blocks; + uint32_t next_alloc; + uint32_t rsrc_clump_sz; + uint32_t data_clump_sz; + uint32_t next_cnid; + uint32_t write_count; + uint64_t encodings_bmp; struct hfs_finder_info finder_info; struct hfsplus_fork alloc_file; struct hfsplus_fork ext_file; @@ -150,7 +149,7 @@ struct hfsplus_vol_header { #define HFS_NODE_LEAF 0xff #define HFSPLUS_POR_CNID 1 -int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) +int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off) { unsigned int blocksize; unsigned int cat_block; @@ -161,7 +160,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) unsigned int leaf_node_count; unsigned int leaf_node_size; unsigned int leaf_block; - __u64 leaf_off; + uint64_t leaf_off; unsigned int alloc_block_size; unsigned int alloc_first_block; unsigned int embed_first_block; @@ -169,9 +168,9 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off) struct hfsplus_bnode_descriptor *descr; struct hfsplus_bheader_record *bnode; struct hfsplus_catalog_key *key; - unsigned int label_len; + unsigned int label_len; struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; - const __u8 *buf; + const uint8_t *buf; dbg("probing at offset 0x%llx", (unsigned long long) off); diff --git a/extras/volume_id/volume_id/hfs.h b/extras/volume_id/volume_id/hfs.h index b23ccd30c8..42dc449e29 100644 --- a/extras/volume_id/volume_id/hfs.h +++ b/extras/volume_id/volume_id/hfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_HFS_ #define _VOLUME_ID_HFS_ -extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, __u64 off); +extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/highpoint.c b/extras/volume_id/volume_id/highpoint.c index 938a8934e5..baa278ba80 100644 --- a/extras/volume_id/volume_id/highpoint.c +++ b/extras/volume_id/volume_id/highpoint.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,12 +39,12 @@ #include "highpoint.h" struct hpt37x_meta { - __u8 filler1[32]; - __u32 magic; + uint8_t filler1[32]; + uint32_t magic; } __attribute__((packed)); struct hpt45x_meta { - __u32 magic; + uint32_t magic; } __attribute__((packed)); #define HPT37X_CONFIG_OFF 0x1200 @@ -56,11 +55,11 @@ struct hpt45x_meta { #define HPT45X_MAGIC_BAD 0x5a7816fd -int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off) +int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; struct hpt37x_meta *hpt; - __u32 magic; + uint32_t magic; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -79,12 +78,12 @@ int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off) return 0; } -int volume_id_probe_highpoint_45x_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; + const uint8_t *buf; struct hpt45x_meta *hpt; - __u64 meta_off; - __u32 magic; + uint64_t meta_off; + uint32_t magic; dbg("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); diff --git a/extras/volume_id/volume_id/highpoint.h b/extras/volume_id/volume_id/highpoint.h index 7cc2ac0cb8..b0462f0525 100644 --- a/extras/volume_id/volume_id/highpoint.h +++ b/extras/volume_id/volume_id/highpoint.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_HIGHPOINT_ #define _VOLUME_ID_HIGHPOINT_ -extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, __u64 off); -extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); +extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/hpfs.c b/extras/volume_id/volume_id/hpfs.c index 96c63d5e1d..8cd65cd6e9 100644 --- a/extras/volume_id/volume_id/hpfs.c +++ b/extras/volume_id/volume_id/hpfs.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -41,13 +40,13 @@ struct hpfs_super { - __u8 magic[4]; - __u8 version; + uint8_t magic[4]; + uint8_t version; } __attribute__((__packed__)); #define HPFS_SUPERBLOCK_OFFSET 0x2000 -int volume_id_probe_hpfs(struct volume_id *id, __u64 off) +int volume_id_probe_hpfs(struct volume_id *id, uint64_t off) { struct hpfs_super *hs; diff --git a/extras/volume_id/volume_id/hpfs.h b/extras/volume_id/volume_id/hpfs.h index bd8d4c90c9..d496829033 100644 --- a/extras/volume_id/volume_id/hpfs.h +++ b/extras/volume_id/volume_id/hpfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_HPFS_ #define _VOLUME_ID_HPFS_ -extern int volume_id_probe_hpfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/iso9660.c b/extras/volume_id/volume_id/iso9660.c index 5d4ab92a79..8811ffbc03 100644 --- a/extras/volume_id/volume_id/iso9660.c +++ b/extras/volume_id/volume_id/iso9660.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -48,27 +47,27 @@ #define ISO_VD_MAX 16 struct iso_volume_descriptor { - __u8 vd_type; - __u8 vd_id[5]; - __u8 vd_version; - __u8 flags; - __u8 system_id[32]; - __u8 volume_id[32]; - __u8 unused[8]; - __u8 space_size[8]; - __u8 escape_sequences[8]; + uint8_t vd_type; + uint8_t vd_id[5]; + uint8_t vd_version; + uint8_t flags; + uint8_t system_id[32]; + uint8_t volume_id[32]; + uint8_t unused[8]; + uint8_t space_size[8]; + uint8_t escape_sequences[8]; } __attribute__((__packed__)); struct high_sierra_volume_descriptor { - __u8 foo[8]; - __u8 type; - __u8 id[4]; - __u8 version; + uint8_t foo[8]; + uint8_t type; + uint8_t id[4]; + uint8_t version; } __attribute__((__packed__)); -int volume_id_probe_iso9660(struct volume_id *id, __u64 off) +int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) { - __u8 *buf; + uint8_t *buf; struct iso_volume_descriptor *is; struct high_sierra_volume_descriptor *hs; @@ -91,7 +90,7 @@ int volume_id_probe_iso9660(struct volume_id *id, __u64 off) dbg("looking for SVDs"); vd_offset = ISO_VD_OFFSET; for (i = 0; i < ISO_VD_MAX; i++) { - char svd_label[64]; + uint8_t svd_label[64]; is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200); if (is == NULL || is->vd_type == ISO_VD_END) @@ -104,7 +103,7 @@ int volume_id_probe_iso9660(struct volume_id *id, __u64 off) memcmp(is->escape_sequences, "%/C", 3) == 0|| memcmp(is->escape_sequences, "%/E", 3) == 0) { dbg("Joliet extension found"); - volume_id_set_unicode16(svd_label, sizeof(svd_label), is->volume_id, BE, 32); + volume_id_set_unicode16((char *)svd_label, sizeof(svd_label), is->volume_id, BE, 32); if (memcmp(id->label, svd_label, 16) == 0) { dbg("SVD label is identical, use the possibly longer PVD one"); break; diff --git a/extras/volume_id/volume_id/iso9660.h b/extras/volume_id/volume_id/iso9660.h index c187e25f94..0119acac6c 100644 --- a/extras/volume_id/volume_id/iso9660.h +++ b/extras/volume_id/volume_id/iso9660.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_ISO9660_ #define _VOLUME_ID_ISO9660_ -extern int volume_id_probe_iso9660(struct volume_id *id, __u64 off); +extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/isw_raid.c b/extras/volume_id/volume_id/isw_raid.c index c703f3fe27..9c3082dbbf 100644 --- a/extras/volume_id/volume_id/isw_raid.c +++ b/extras/volume_id/volume_id/isw_raid.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,20 +39,20 @@ #include "isw_raid.h" struct isw_meta { - __u8 sig[32]; - __u32 check_sum; - __u32 mpb_size; - __u32 family_num; - __u32 generation_num; + uint8_t sig[32]; + uint32_t check_sum; + uint32_t mpb_size; + uint32_t family_num; + uint32_t generation_num; } __attribute__((packed)); #define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " -int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct isw_meta *isw; dbg("probing at offset 0x%llx, size 0x%llx", @@ -72,7 +71,7 @@ int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 s return -1; volume_id_set_usage(id, VOLUME_ID_RAID); - strncpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); + memcpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); id->type = "isw_raid_member"; return 0; diff --git a/extras/volume_id/volume_id/isw_raid.h b/extras/volume_id/volume_id/isw_raid.h index 4bfd3bb529..7f48b0196f 100644 --- a/extras/volume_id/volume_id/isw_raid.h +++ b/extras/volume_id/volume_id/isw_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_ISW_RAID_ #define _VOLUME_ID_ISW_RAID_ -extern int volume_id_probe_intel_software_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/jfs.c b/extras/volume_id/volume_id/jfs.c index 77fa095357..6899e939ac 100644 --- a/extras/volume_id/volume_id/jfs.c +++ b/extras/volume_id/volume_id/jfs.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,21 +39,21 @@ #include "jfs.h" struct jfs_super_block { - __u8 magic[4]; - __u32 version; - __u64 size; - __u32 bsize; - __u32 dummy1; - __u32 pbsize; - __u32 dummy2[27]; - __u8 uuid[16]; - __u8 label[16]; - __u8 loguuid[16]; + uint8_t magic[4]; + uint32_t version; + uint64_t size; + uint32_t bsize; + uint32_t dummy1; + uint32_t pbsize; + uint32_t dummy2[27]; + uint8_t uuid[16]; + uint8_t label[16]; + uint8_t loguuid[16]; } __attribute__((__packed__)); #define JFS_SUPERBLOCK_OFFSET 0x8000 -int volume_id_probe_jfs(struct volume_id *id, __u64 off) +int volume_id_probe_jfs(struct volume_id *id, uint64_t off) { struct jfs_super_block *js; diff --git a/extras/volume_id/volume_id/jfs.h b/extras/volume_id/volume_id/jfs.h index 28c48ffe53..e979eb740c 100644 --- a/extras/volume_id/volume_id/jfs.h +++ b/extras/volume_id/volume_id/jfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_JFS_ #define _VOLUME_ID_JFS_ -extern int volume_id_probe_jfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/linux_raid.c b/extras/volume_id/volume_id/linux_raid.c index 598002ec4f..ece3e46f6d 100644 --- a/extras/volume_id/volume_id/linux_raid.c +++ b/extras/volume_id/volume_id/linux_raid.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,32 +39,32 @@ #include "linux_raid.h" struct mdp_super_block { - __u32 md_magic; - __u32 major_version; - __u32 minor_version; - __u32 patch_version; - __u32 gvalid_words; - __u32 set_uuid0; - __u32 ctime; - __u32 level; - __u32 size; - __u32 nr_disks; - __u32 raid_disks; - __u32 md_minor; - __u32 not_persistent; - __u32 set_uuid1; - __u32 set_uuid2; - __u32 set_uuid3; + uint32_t md_magic; + uint32_t major_version; + uint32_t minor_version; + uint32_t patch_version; + uint32_t gvalid_words; + uint32_t set_uuid0; + uint32_t ctime; + uint32_t level; + uint32_t size; + uint32_t nr_disks; + uint32_t raid_disks; + uint32_t md_minor; + uint32_t not_persistent; + uint32_t set_uuid1; + uint32_t set_uuid2; + uint32_t set_uuid3; } __attribute__((packed)) *mdp; #define MD_RESERVED_BYTES 0x10000 #define MD_MAGIC 0xa92b4efc -int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 sboff; - __u8 uuid[16]; + const uint8_t *buf; + uint64_t sboff; + uint8_t uuid[16]; dbg("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); diff --git a/extras/volume_id/volume_id/linux_raid.h b/extras/volume_id/volume_id/linux_raid.h index 0aaaaa6ade..adf6ebaacd 100644 --- a/extras/volume_id/volume_id/linux_raid.h +++ b/extras/volume_id/volume_id/linux_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_LINUX_RAID_ #define _VOLUME_ID_LINUX_RAID_ -extern int volume_id_probe_linux_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/linux_swap.c b/extras/volume_id/volume_id/linux_swap.c index e37a79be86..1ffc2a8cb5 100644 --- a/extras/volume_id/volume_id/linux_swap.c +++ b/extras/volume_id/volume_id/linux_swap.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,19 +39,19 @@ #include "linux_swap.h" struct swap_header_v1_2 { - __u8 bootbits[1024]; - __u32 version; - __u32 last_page; - __u32 nr_badpages; - __u8 uuid[16]; - __u8 volume_name[16]; + uint8_t bootbits[1024]; + uint32_t version; + uint32_t last_page; + uint32_t nr_badpages; + uint8_t uuid[16]; + uint8_t volume_name[16]; } __attribute__((__packed__)) *sw; #define LARGEST_PAGESIZE 0x4000 -int volume_id_probe_linux_swap(struct volume_id *id, __u64 off) +int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; unsigned int page; dbg("probing at offset 0x%llx", (unsigned long long) off); diff --git a/extras/volume_id/volume_id/linux_swap.h b/extras/volume_id/volume_id/linux_swap.h index 5de0f93849..c8fa90d5c5 100644 --- a/extras/volume_id/volume_id/linux_swap.h +++ b/extras/volume_id/volume_id/linux_swap.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_LINUX_SWAP_ #define _VOLUME_ID_LINUX_SWAP_ -extern int volume_id_probe_linux_swap(struct volume_id *id, __u64 off); +extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/lsi_raid.c b/extras/volume_id/volume_id/lsi_raid.c index e411fbc264..bb2ac7f9c5 100644 --- a/extras/volume_id/volume_id/lsi_raid.c +++ b/extras/volume_id/volume_id/lsi_raid.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,15 +39,15 @@ #include "lsi_raid.h" struct lsi_meta { - __u8 sig[6]; + uint8_t sig[6]; } __attribute__((packed)); #define LSI_SIGNATURE "$XIDE$" -int volume_id_probe_lsi_mega_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct lsi_meta *lsi; dbg("probing at offset 0x%llx, size 0x%llx", diff --git a/extras/volume_id/volume_id/lsi_raid.h b/extras/volume_id/volume_id/lsi_raid.h index b3ee0bb7fb..2c2758bdb4 100644 --- a/extras/volume_id/volume_id/lsi_raid.h +++ b/extras/volume_id/volume_id/lsi_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_LSI_RAID_ #define _VOLUME_ID_LSI_RAID_ -extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/luks.c b/extras/volume_id/volume_id/luks.c index a00bf4041b..22d2a94ac7 100644 --- a/extras/volume_id/volume_id/luks.c +++ b/extras/volume_id/volume_id/luks.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "util.h" @@ -49,33 +48,33 @@ #define LUKS_SALTSIZE 32 #define LUKS_NUMKEYS 8 -const __u8 LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; +const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; #define LUKS_MAGIC_L 6 #define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) #define UUID_STRING_L 40 struct luks_phdr { - __u8 magic[LUKS_MAGIC_L]; - __u16 version; - __u8 cipherName[LUKS_CIPHERNAME_L]; - __u8 cipherMode[LUKS_CIPHERMODE_L]; - __u8 hashSpec[LUKS_HASHSPEC_L]; - __u32 payloadOffset; - __u32 keyBytes; - __u8 mkDigest[LUKS_DIGESTSIZE]; - __u8 mkDigestSalt[LUKS_SALTSIZE]; - __u32 mkDigestIterations; - __u8 uuid[UUID_STRING_L]; + uint8_t magic[LUKS_MAGIC_L]; + uint16_t version; + uint8_t cipherName[LUKS_CIPHERNAME_L]; + uint8_t cipherMode[LUKS_CIPHERMODE_L]; + uint8_t hashSpec[LUKS_HASHSPEC_L]; + uint32_t payloadOffset; + uint32_t keyBytes; + uint8_t mkDigest[LUKS_DIGESTSIZE]; + uint8_t mkDigestSalt[LUKS_SALTSIZE]; + uint32_t mkDigestIterations; + uint8_t uuid[UUID_STRING_L]; struct { - __u32 active; - __u32 passwordIterations; - __u8 passwordSalt[LUKS_SALTSIZE]; - __u32 keyMaterialOffset; - __u32 stripes; + uint32_t active; + uint32_t passwordIterations; + uint8_t passwordSalt[LUKS_SALTSIZE]; + uint32_t keyMaterialOffset; + uint32_t stripes; } keyblock[LUKS_NUMKEYS]; }; -int volume_id_probe_luks(struct volume_id *id, __u64 off) +int volume_id_probe_luks(struct volume_id *id, uint64_t off) { struct luks_phdr *header; diff --git a/extras/volume_id/volume_id/luks.h b/extras/volume_id/volume_id/luks.h index 180336f573..f53a1558ec 100644 --- a/extras/volume_id/volume_id/luks.h +++ b/extras/volume_id/volume_id/luks.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_LUKS_ #define _VOLUME_ID_LUKS_ -extern int volume_id_probe_luks(struct volume_id *id, __u64 off); +extern int volume_id_probe_luks(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/lvm.c b/extras/volume_id/volume_id/lvm.c index d1e337dc35..b2e2e421d0 100644 --- a/extras/volume_id/volume_id/lvm.c +++ b/extras/volume_id/volume_id/lvm.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,23 +39,23 @@ #include "lvm.h" struct lvm1_super_block { - __u8 id[2]; + uint8_t id[2]; } __attribute__((packed)); struct lvm2_super_block { - __u8 id[8]; - __u64 sector_xl; - __u32 crc_xl; - __u32 offset_xl; - __u8 type[8]; + uint8_t id[8]; + uint64_t sector_xl; + uint32_t crc_xl; + uint32_t offset_xl; + uint8_t type[8]; } __attribute__((packed)); #define LVM1_SB_OFF 0x400 #define LVM1_MAGIC "HM" -int volume_id_probe_lvm1(struct volume_id *id, __u64 off) +int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; struct lvm1_super_block *lvm; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -79,9 +78,9 @@ int volume_id_probe_lvm1(struct volume_id *id, __u64 off) #define LVM2_LABEL_ID "LABELONE" #define LVM2LABEL_SCAN_SECTORS 4 -int volume_id_probe_lvm2(struct volume_id *id, __u64 off) +int volume_id_probe_lvm2(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; unsigned int soff; struct lvm2_super_block *lvm; @@ -102,7 +101,7 @@ int volume_id_probe_lvm2(struct volume_id *id, __u64 off) return -1; found: - strncpy(id->type_version, lvm->type, 8); + memcpy(id->type_version, lvm->type, 8); volume_id_set_usage(id, VOLUME_ID_RAID); id->type = "LVM2_member"; diff --git a/extras/volume_id/volume_id/lvm.h b/extras/volume_id/volume_id/lvm.h index 2e44cda75b..555f18d904 100644 --- a/extras/volume_id/volume_id/lvm.h +++ b/extras/volume_id/volume_id/lvm.h @@ -21,7 +21,7 @@ #ifndef _VOLUME_ID_LVM_ #define _VOLUME_ID_LVM_ -extern int volume_id_probe_lvm1(struct volume_id *id, __u64 off); -extern int volume_id_probe_lvm2(struct volume_id *id, __u64 off); +extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off); +extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/mac.c b/extras/volume_id/volume_id/mac.c index dcfacc2a69..7ebd749e4f 100644 --- a/extras/volume_id/volume_id/mac.c +++ b/extras/volume_id/volume_id/mac.c @@ -40,24 +40,24 @@ #include "mac.h" struct mac_driver_desc { - __u8 signature[2]; - __u16 block_size; - __u32 block_count; + uint8_t signature[2]; + uint16_t block_size; + uint32_t block_count; } __attribute__((__packed__)); struct mac_partition { - __u8 signature[2]; - __u16 res1; - __u32 map_count; - __u32 start_block; - __u32 block_count; - __u8 name[32]; - __u8 type[32]; + uint8_t signature[2]; + uint16_t res1; + uint32_t map_count; + uint32_t start_block; + uint32_t block_count; + uint8_t name[32]; + uint8_t type[32]; } __attribute__((__packed__)); -int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) +int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; struct mac_driver_desc *driver; struct mac_partition *part; @@ -108,8 +108,8 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off) id->partition_count = part_count; for (i = 0; i < part_count; i++) { - __u64 poff; - __u64 plen; + uint64_t poff; + uint64_t plen; buf = volume_id_get_buffer(id, off + ((i+1) * bsize), 0x200); if (buf == NULL) diff --git a/extras/volume_id/volume_id/mac.h b/extras/volume_id/volume_id/mac.h index 888c1c527d..0ab0d4489d 100644 --- a/extras/volume_id/volume_id/mac.h +++ b/extras/volume_id/volume_id/mac.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_MAC_ #define _VOLUME_ID_MAC_ -extern int volume_id_probe_mac_partition_map(struct volume_id *id, __u64 off); +extern int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/minix.c b/extras/volume_id/volume_id/minix.c index d2f2a336d4..97aa83a3dc 100644 --- a/extras/volume_id/volume_id/minix.c +++ b/extras/volume_id/volume_id/minix.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -41,21 +40,21 @@ struct minix_super_block { - __u16 s_ninodes; - __u16 s_nzones; - __u16 s_imap_blocks; - __u16 s_zmap_blocks; - __u16 s_firstdatazone; - __u16 s_log_zone_size; - __u32 s_max_size; - __u16 s_magic; - __u16 s_state; - __u32 s_zones; + uint16_t s_ninodes; + uint16_t s_nzones; + uint16_t s_imap_blocks; + uint16_t s_zmap_blocks; + uint16_t s_firstdatazone; + uint16_t s_log_zone_size; + uint32_t s_max_size; + uint16_t s_magic; + uint16_t s_state; + uint32_t s_zones; } __attribute__((__packed__)); #define MINIX_SUPERBLOCK_OFFSET 0x400 -int volume_id_probe_minix(struct volume_id *id, __u64 off) +int volume_id_probe_minix(struct volume_id *id, uint64_t off) { struct minix_super_block *ms; diff --git a/extras/volume_id/volume_id/minix.h b/extras/volume_id/volume_id/minix.h index 7a9d97ada2..2a3fd7292b 100644 --- a/extras/volume_id/volume_id/minix.h +++ b/extras/volume_id/volume_id/minix.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_MINIX_ #define _VOLUME_ID_MINIX_ -extern int volume_id_probe_minix(struct volume_id *id, __u64 off); +extern int volume_id_probe_minix(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/msdos.c b/extras/volume_id/volume_id/msdos.c index 47c94456e4..0b8dbbeaec 100644 --- a/extras/volume_id/volume_id/msdos.c +++ b/extras/volume_id/volume_id/msdos.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,16 +39,16 @@ #include "msdos.h" struct msdos_partition_entry { - __u8 boot_ind; - __u8 head; - __u8 sector; - __u8 cyl; - __u8 sys_ind; - __u8 end_head; - __u8 end_sector; - __u8 end_cyl; - __u32 start_sect; - __u32 nr_sects; + uint8_t boot_ind; + uint8_t head; + uint8_t sector; + uint8_t cyl; + uint8_t sys_ind; + uint8_t end_head; + uint8_t end_sector; + uint8_t end_cyl; + uint32_t start_sect; + uint32_t nr_sects; } __attribute__((packed)); #define MSDOS_MAGIC "\x55\xaa" @@ -67,15 +66,15 @@ struct msdos_partition_entry { #define is_raid(type) \ (type == LINUX_RAID_PARTITION) -int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) +int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off) { - const __u8 *buf; + const uint8_t *buf; int i; - __u64 poff; - __u64 plen; - __u64 extended = 0; - __u64 current; - __u64 next; + uint64_t poff; + uint64_t plen; + uint64_t extended = 0; + uint64_t current; + uint64_t next; int limit; int empty = 1; struct msdos_partition_entry *part; @@ -113,8 +112,8 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); for (i = 0; i < 4; i++) { - poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; if (plen == 0) continue; @@ -167,8 +166,8 @@ int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off) next = 0; for (i = 0; i < 4; i++) { - poff = (__u64) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (__u64) le32_to_cpu(part[i].nr_sects) * BSIZE; + poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; if (plen == 0) continue; diff --git a/extras/volume_id/volume_id/msdos.h b/extras/volume_id/volume_id/msdos.h index 55185c006b..29be629845 100644 --- a/extras/volume_id/volume_id/msdos.h +++ b/extras/volume_id/volume_id/msdos.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_MSDOS_ #define _VOLUME_ID_MSDOS_ -extern int volume_id_probe_msdos_part_table(struct volume_id *id, __u64 off); +extern int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/ntfs.c b/extras/volume_id/volume_id/ntfs.c index f9df0e9cc3..f59da48165 100644 --- a/extras/volume_id/volume_id/ntfs.c +++ b/extras/volume_id/volume_id/ntfs.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,61 +39,61 @@ #include "ntfs.h" struct ntfs_super_block { - __u8 jump[3]; - __u8 oem_id[8]; - __u16 bytes_per_sector; - __u8 sectors_per_cluster; - __u16 reserved_sectors; - __u8 fats; - __u16 root_entries; - __u16 sectors; - __u8 media_type; - __u16 sectors_per_fat; - __u16 sectors_per_track; - __u16 heads; - __u32 hidden_sectors; - __u32 large_sectors; - __u16 unused[2]; - __u64 number_of_sectors; - __u64 mft_cluster_location; - __u64 mft_mirror_cluster_location; - __s8 cluster_per_mft_record; - __u8 reserved1[3]; - __s8 cluster_per_index_record; - __u8 reserved2[3]; - __u8 volume_serial[8]; - __u16 checksum; + uint8_t jump[3]; + uint8_t oem_id[8]; + uint16_t bytes_per_sector; + uint8_t sectors_per_cluster; + uint16_t reserved_sectors; + uint8_t fats; + uint16_t root_entries; + uint16_t sectors; + uint8_t media_type; + uint16_t sectors_per_fat; + uint16_t sectors_per_track; + uint16_t heads; + uint32_t hidden_sectors; + uint32_t large_sectors; + uint16_t unused[2]; + uint64_t number_of_sectors; + uint64_t mft_cluster_location; + uint64_t mft_mirror_cluster_location; + int8_t cluster_per_mft_record; + uint8_t reserved1[3]; + int8_t cluster_per_index_record; + uint8_t reserved2[3]; + uint8_t volume_serial[8]; + uint16_t checksum; } __attribute__((__packed__)) *ns; struct master_file_table_record { - __u8 magic[4]; - __u16 usa_ofs; - __u16 usa_count; - __u64 lsn; - __u16 sequence_number; - __u16 link_count; - __u16 attrs_offset; - __u16 flags; - __u32 bytes_in_use; - __u32 bytes_allocated; + uint8_t magic[4]; + uint16_t usa_ofs; + uint16_t usa_count; + uint64_t lsn; + uint16_t sequence_number; + uint16_t link_count; + uint16_t attrs_offset; + uint16_t flags; + uint32_t bytes_in_use; + uint32_t bytes_allocated; } __attribute__((__packed__)) *mftr; struct file_attribute { - __u32 type; - __u32 len; - __u8 non_resident; - __u8 name_len; - __u16 name_offset; - __u16 flags; - __u16 instance; - __u32 value_len; - __u16 value_offset; + uint32_t type; + uint32_t len; + uint8_t non_resident; + uint8_t name_len; + uint16_t name_offset; + uint16_t flags; + uint16_t instance; + uint32_t value_len; + uint16_t value_offset; } __attribute__((__packed__)) *attr; struct volume_info { - __u64 reserved; - __u8 major_ver; - __u8 minor_ver; + uint64_t reserved; + uint8_t major_ver; + uint8_t minor_ver; } __attribute__((__packed__)) *info; #define MFT_RECORD_VOLUME 3 @@ -103,20 +102,20 @@ struct volume_info { #define MFT_RECORD_ATTR_OBJECT_ID 0x40 #define MFT_RECORD_ATTR_END 0xffffffffu -int volume_id_probe_ntfs(struct volume_id *id, __u64 off) +int volume_id_probe_ntfs(struct volume_id *id, uint64_t off) { unsigned int sector_size; unsigned int cluster_size; - __u64 mft_cluster; - __u64 mft_off; + uint64_t mft_cluster; + uint64_t mft_off; unsigned int mft_record_size; unsigned int attr_type; unsigned int attr_off; unsigned int attr_len; unsigned int val_off; unsigned int val_len; - const __u8 *buf; - const __u8 *val; + const uint8_t *buf; + const uint8_t *val; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -183,7 +182,7 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { dbg("found info, len %i", val_len); - info = (struct volume_info*) (((__u8 *) attr) + val_off); + info = (struct volume_info*) (((uint8_t *) attr) + val_off); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", info->major_ver, info->minor_ver); } @@ -193,7 +192,7 @@ int volume_id_probe_ntfs(struct volume_id *id, __u64 off) if (val_len > VOLUME_ID_LABEL_SIZE) val_len = VOLUME_ID_LABEL_SIZE; - val = ((__u8 *) attr) + val_off; + val = ((uint8_t *) attr) + val_off; volume_id_set_label_raw(id, val, val_len); volume_id_set_label_unicode16(id, val, LE, val_len); } diff --git a/extras/volume_id/volume_id/ntfs.h b/extras/volume_id/volume_id/ntfs.h index 63b1161d51..2a84db3653 100644 --- a/extras/volume_id/volume_id/ntfs.h +++ b/extras/volume_id/volume_id/ntfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_NTFS_ #define _VOLUME_ID_NTFS_ -extern int volume_id_probe_ntfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/nvidia_raid.c b/extras/volume_id/volume_id/nvidia_raid.c index ad76631799..d49ffe3010 100644 --- a/extras/volume_id/volume_id/nvidia_raid.c +++ b/extras/volume_id/volume_id/nvidia_raid.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,18 +39,18 @@ #include "nvidia_raid.h" struct nvidia_meta { - __u8 vendor[8]; - __u32 size; - __u32 chksum; - __u16 version; + uint8_t vendor[8]; + uint32_t size; + uint32_t chksum; + uint16_t version; } __attribute__((packed)); #define NVIDIA_SIGNATURE "NVIDIA" -int volume_id_probe_nvidia_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct nvidia_meta *nv; dbg("probing at offset 0x%llx, size 0x%llx", diff --git a/extras/volume_id/volume_id/nvidia_raid.h b/extras/volume_id/volume_id/nvidia_raid.h index f892be5590..250c1f8214 100644 --- a/extras/volume_id/volume_id/nvidia_raid.h +++ b/extras/volume_id/volume_id/nvidia_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_NVIDIA_RAID_ #define _VOLUME_ID_NVIDIA_RAID_ -extern int volume_id_probe_nvidia_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/ocfs2.c b/extras/volume_id/volume_id/ocfs2.c index 90a6bd531c..08138472ce 100644 --- a/extras/volume_id/volume_id/ocfs2.c +++ b/extras/volume_id/volume_id/ocfs2.c @@ -51,66 +51,66 @@ This is one has been simplified since we only care about the superblock. */ struct ocfs2_super_block { - __u8 i_signature[8]; /* Signature for validation */ - __u32 i_generation; /* Generation number */ - __s16 i_suballoc_slot; /* Slot suballocator this inode belongs to */ - __u16 i_suballoc_bit; /* Bit offset in suballocator block group */ - __u32 i_reserved0; - __u32 i_clusters; /* Cluster count */ - __u32 i_uid; /* Owner UID */ - __u32 i_gid; /* Owning GID */ - __u64 i_size; /* Size in bytes */ - __u16 i_mode; /* File mode */ - __u16 i_links_count; /* Links count */ - __u32 i_flags; /* File flags */ - __u64 i_atime; /* Access time */ - __u64 i_ctime; /* Creation time */ - __u64 i_mtime; /* Modification time */ - __u64 i_dtime; /* Deletion time */ - __u64 i_blkno; /* Offset on disk, in blocks */ - __u64 i_last_eb_blk; /* Pointer to last extent block */ - __u32 i_fs_generation; /* Generation per fs-instance */ - __u32 i_atime_nsec; - __u32 i_ctime_nsec; - __u32 i_mtime_nsec; - __u64 i_reserved1[9]; - __u64 i_pad1; /* Generic way to refer to this 64bit union */ + uint8_t i_signature[8]; /* Signature for validation */ + uint32_t i_generation; /* Generation number */ + int16_t i_suballoc_slot; /* Slot suballocator this inode belongs to */ + uint16_t i_suballoc_bit; /* Bit offset in suballocator block group */ + uint32_t i_reserved0; + uint32_t i_clusters; /* Cluster count */ + uint32_t i_uid; /* Owner UID */ + uint32_t i_gid; /* Owning GID */ + uint64_t i_size; /* Size in bytes */ + uint16_t i_mode; /* File mode */ + uint16_t i_links_count; /* Links count */ + uint32_t i_flags; /* File flags */ + uint64_t i_atime; /* Access time */ + uint64_t i_ctime; /* Creation time */ + uint64_t i_mtime; /* Modification time */ + uint64_t i_dtime; /* Deletion time */ + uint64_t i_blkno; /* Offset on disk, in blocks */ + uint64_t i_last_eb_blk; /* Pointer to last extent block */ + uint32_t i_fs_generation; /* Generation per fs-instance */ + uint32_t i_atime_nsec; + uint32_t i_ctime_nsec; + uint32_t i_mtime_nsec; + uint64_t i_reserved1[9]; + uint64_t i_pad1; /* Generic way to refer to this 64bit union */ /* Normally there is a union of the different block types, but we only care about the superblock. */ - __u16 s_major_rev_level; - __u16 s_minor_rev_level; - __u16 s_mnt_count; - __s16 s_max_mnt_count; - __u16 s_state; /* File system state */ - __u16 s_errors; /* Behaviour when detecting errors */ - __u32 s_checkinterval; /* Max time between checks */ - __u64 s_lastcheck; /* Time of last check */ - __u32 s_creator_os; /* OS */ - __u32 s_feature_compat; /* Compatible feature set */ - __u32 s_feature_incompat; /* Incompatible feature set */ - __u32 s_feature_ro_compat; /* Readonly-compatible feature set */ - __u64 s_root_blkno; /* Offset, in blocks, of root directory dinode */ - __u64 s_system_dir_blkno; /* Offset, in blocks, of system directory dinode */ - __u32 s_blocksize_bits; /* Blocksize for this fs */ - __u32 s_clustersize_bits; /* Clustersize for this fs */ - __u16 s_max_slots; /* Max number of simultaneous mounts before tunefs required */ - __u16 s_reserved1; - __u32 s_reserved2; - __u64 s_first_cluster_group; /* Block offset of 1st cluster group header */ - __u8 s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */ - __u8 s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ + uint16_t s_major_rev_level; + uint16_t s_minor_rev_level; + uint16_t s_mnt_count; + int16_t s_max_mnt_count; + uint16_t s_state; /* File system state */ + uint16_t s_errors; /* Behaviour when detecting errors */ + uint32_t s_checkinterval; /* Max time between checks */ + uint64_t s_lastcheck; /* Time of last check */ + uint32_t s_creator_os; /* OS */ + uint32_t s_feature_compat; /* Compatible feature set */ + uint32_t s_feature_incompat; /* Incompatible feature set */ + uint32_t s_feature_ro_compat; /* Readonly-compatible feature set */ + uint64_t s_root_blkno; /* Offset, in blocks, of root directory dinode */ + uint64_t s_system_dir_blkno; /* Offset, in blocks, of system directory dinode */ + uint32_t s_blocksize_bits; /* Blocksize for this fs */ + uint32_t s_clustersize_bits; /* Clustersize for this fs */ + uint16_t s_max_slots; /* Max number of simultaneous mounts before tunefs required */ + uint16_t s_reserved1; + uint32_t s_reserved2; + uint64_t s_first_cluster_group; /* Block offset of 1st cluster group header */ + uint8_t s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */ + uint8_t s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ } __attribute__((__packed__)); -int volume_id_probe_ocfs2(struct volume_id *id, __u64 off) +int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) { struct ocfs2_super_block *os; dbg("probing at offset 0x%llx", (unsigned long long) off); - os = (struct ocsf2_super_block *) volume_id_get_buffer(id, off + OCFS2_SUPERBLOCK_OFFSET, 0x200); + os = (struct ocfs2_super_block *) volume_id_get_buffer(id, off + OCFS2_SUPERBLOCK_OFFSET, 0x200); if (os == NULL) return -1; - if (strcmp(os->i_signature, "OCFSV2") != 0) { + if (memcmp(os->i_signature, "OCFSV2", 6) != 0) { return -1; } diff --git a/extras/volume_id/volume_id/ocfs2.h b/extras/volume_id/volume_id/ocfs2.h index 128348133c..b4b7cc4469 100644 --- a/extras/volume_id/volume_id/ocfs2.h +++ b/extras/volume_id/volume_id/ocfs2.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_OCFS2_ #define _VOLUME_ID_OCFS2_ -extern int volume_id_probe_ocfs2(struct volume_id *id, __u64 off); +extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/promise_raid.c b/extras/volume_id/volume_id/promise_raid.c index 8fda14945f..ed72809acb 100644 --- a/extras/volume_id/volume_id/promise_raid.c +++ b/extras/volume_id/volume_id/promise_raid.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,15 +39,15 @@ #include "promise_raid.h" struct promise_meta { - __u8 sig[24]; + uint8_t sig[24]; } __attribute__((packed)); #define PDC_CONFIG_OFF 0x1200 #define PDC_SIGNATURE "Promise Technology, Inc." -int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; + const uint8_t *buf; struct promise_meta *pdc; unsigned int i; static unsigned int sectors[] = { @@ -62,7 +61,7 @@ int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u6 return -1; for (i = 0; sectors[i] != 0; i++) { - __u64 meta_off; + uint64_t meta_off; meta_off = ((size / 0x200) - sectors[i]) * 0x200; buf = volume_id_get_buffer(id, off + meta_off, 0x200); diff --git a/extras/volume_id/volume_id/promise_raid.h b/extras/volume_id/volume_id/promise_raid.h index 554bcb97d5..f1a9925d72 100644 --- a/extras/volume_id/volume_id/promise_raid.h +++ b/extras/volume_id/volume_id/promise_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_PROMISE_RAID_ #define _VOLUME_ID_PROMISE_RAID_ -extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c index a53fc4a5a9..75d1be05dc 100644 --- a/extras/volume_id/volume_id/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs.c @@ -41,37 +41,37 @@ #include "reiserfs.h" struct reiserfs_super_block { - __u32 blocks_count; - __u32 free_blocks; - __u32 root_block; - __u32 journal_block; - __u32 journal_dev; - __u32 orig_journal_size; - __u32 dummy2[5]; - __u16 blocksize; - __u16 dummy3[3]; - __u8 magic[12]; - __u32 dummy4[5]; - __u8 uuid[16]; - __u8 label[16]; + uint32_t blocks_count; + uint32_t free_blocks; + uint32_t root_block; + uint32_t journal_block; + uint32_t journal_dev; + uint32_t orig_journal_size; + uint32_t dummy2[5]; + uint16_t blocksize; + uint16_t dummy3[3]; + uint8_t magic[12]; + uint32_t dummy4[5]; + uint8_t uuid[16]; + uint8_t label[16]; } __attribute__((__packed__)); struct reiser4_super_block { - __u8 magic[16]; - __u16 dummy[2]; - __u8 uuid[16]; - __u8 label[16]; - __u64 dummy2; + uint8_t magic[16]; + uint16_t dummy[2]; + uint8_t uuid[16]; + uint8_t label[16]; + uint64_t dummy2; } __attribute__((__packed__)); #define REISERFS1_SUPERBLOCK_OFFSET 0x2000 #define REISERFS_SUPERBLOCK_OFFSET 0x10000 -int volume_id_probe_reiserfs(struct volume_id *id, __u64 off) +int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) { struct reiserfs_super_block *rs; struct reiser4_super_block *rs4; - __u8 *buf; + uint8_t *buf; dbg("probing at offset 0x%llx", (unsigned long long) off); diff --git a/extras/volume_id/volume_id/reiserfs.h b/extras/volume_id/volume_id/reiserfs.h index 14f094578f..2ef1d255b7 100644 --- a/extras/volume_id/volume_id/reiserfs.h +++ b/extras/volume_id/volume_id/reiserfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_REISERFS_ #define _VOLUME_ID_REISERFS_ -extern int volume_id_probe_reiserfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/romfs.c b/extras/volume_id/volume_id/romfs.c index 9c2b41bb86..3d7df2443f 100644 --- a/extras/volume_id/volume_id/romfs.c +++ b/extras/volume_id/volume_id/romfs.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,13 +39,13 @@ #include "romfs.h" struct romfs_super { - __u8 magic[8]; - __u32 size; - __u32 checksum; - __u8 name[0]; + uint8_t magic[8]; + uint32_t size; + uint32_t checksum; + uint8_t name[0]; } __attribute__((__packed__)); -int volume_id_probe_romfs(struct volume_id *id, __u64 off) +int volume_id_probe_romfs(struct volume_id *id, uint64_t off) { struct romfs_super *rfs; @@ -57,7 +56,7 @@ int volume_id_probe_romfs(struct volume_id *id, __u64 off) return -1; if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { - size_t len = strlen(rfs->name); + size_t len = strlen((char *)rfs->name); if (len) { volume_id_set_label_raw(id, rfs->name, len); diff --git a/extras/volume_id/volume_id/romfs.h b/extras/volume_id/volume_id/romfs.h index b0108f3dde..5a8e900b08 100644 --- a/extras/volume_id/volume_id/romfs.h +++ b/extras/volume_id/volume_id/romfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_ROMFS_ #define _VOLUME_ID_ROMFS_ -extern int volume_id_probe_romfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/silicon_raid.c b/extras/volume_id/volume_id/silicon_raid.c index e528a34ce0..0d5ce043da 100644 --- a/extras/volume_id/volume_id/silicon_raid.c +++ b/extras/volume_id/volume_id/silicon_raid.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,30 +39,30 @@ #include "silicon_raid.h" struct silicon_meta { - __u8 unknown0[0x2E]; - __u8 ascii_version[0x36 - 0x2E]; - __u8 diskname[0x56 - 0x36]; - __u8 unknown1[0x60 - 0x56]; - __u32 magic; - __u32 unknown1a[0x6C - 0x64]; - __u32 array_sectors_low; - __u32 array_sectors_high; - __u8 unknown2[0x78 - 0x74]; - __u32 thisdisk_sectors; - __u8 unknown3[0x100 - 0x7C]; - __u8 unknown4[0x104 - 0x100]; - __u16 product_id; - __u16 vendor_id; - __u16 minor_ver; - __u16 major_ver; + uint8_t unknown0[0x2E]; + uint8_t ascii_version[0x36 - 0x2E]; + uint8_t diskname[0x56 - 0x36]; + uint8_t unknown1[0x60 - 0x56]; + uint32_t magic; + uint32_t unknown1a[0x6C - 0x64]; + uint32_t array_sectors_low; + uint32_t array_sectors_high; + uint8_t unknown2[0x78 - 0x74]; + uint32_t thisdisk_sectors; + uint8_t unknown3[0x100 - 0x7C]; + uint8_t unknown4[0x104 - 0x100]; + uint16_t product_id; + uint16_t vendor_id; + uint16_t minor_ver; + uint16_t major_ver; } __attribute__((packed)); #define SILICON_MAGIC 0x2F000000 -int volume_id_probe_silicon_medley_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct silicon_meta *sil; dbg("probing at offset 0x%llx, size 0x%llx", diff --git a/extras/volume_id/volume_id/silicon_raid.h b/extras/volume_id/volume_id/silicon_raid.h index b88e80bb1c..0816125d7f 100644 --- a/extras/volume_id/volume_id/silicon_raid.h +++ b/extras/volume_id/volume_id/silicon_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_SILICON_RAID_ #define _VOLUME_ID_SILICON_RAID_ -extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/sysv.c b/extras/volume_id/volume_id/sysv.c index d4745daa22..9645ef8004 100644 --- a/extras/volume_id/volume_id/sysv.c +++ b/extras/volume_id/volume_id/sysv.c @@ -44,56 +44,56 @@ struct sysv_super { - __u16 s_isize; - __u16 s_pad0; - __u32 s_fsize; - __u16 s_nfree; - __u16 s_pad1; - __u32 s_free[SYSV_NICFREE]; - __u16 s_ninode; - __u16 s_pad2; - __u16 s_inode[SYSV_NICINOD]; - __u8 s_flock; - __u8 s_ilock; - __u8 s_fmod; - __u8 s_ronly; - __u32 s_time; - __u16 s_dinfo[4]; - __u32 s_tfree; - __u16 s_tinode; - __u16 s_pad3; - __u8 s_fname[6]; - __u8 s_fpack[6]; - __u32 s_fill[12]; - __u32 s_state; - __u32 s_magic; - __u32 s_type; + uint16_t s_isize; + uint16_t s_pad0; + uint32_t s_fsize; + uint16_t s_nfree; + uint16_t s_pad1; + uint32_t s_free[SYSV_NICFREE]; + uint16_t s_ninode; + uint16_t s_pad2; + uint16_t s_inode[SYSV_NICINOD]; + uint8_t s_flock; + uint8_t s_ilock; + uint8_t s_fmod; + uint8_t s_ronly; + uint32_t s_time; + uint16_t s_dinfo[4]; + uint32_t s_tfree; + uint16_t s_tinode; + uint16_t s_pad3; + uint8_t s_fname[6]; + uint8_t s_fpack[6]; + uint32_t s_fill[12]; + uint32_t s_state; + uint32_t s_magic; + uint32_t s_type; } __attribute__((__packed__)); #define XENIX_NICINOD 100 #define XENIX_NICFREE 100 struct xenix_super { - __u16 s_isize; - __u32 s_fsize; - __u16 s_nfree; - __u32 s_free[XENIX_NICFREE]; - __u16 s_ninode; - __u16 s_inode[XENIX_NICINOD]; - __u8 s_flock; - __u8 s_ilock; - __u8 s_fmod; - __u8 s_ronly; - __u32 s_time; - __u32 s_tfree; - __u16 s_tinode; - __u16 s_dinfo[4]; - __u8 s_fname[6]; - __u8 s_fpack[6]; - __u8 s_clean; - __u8 s_fill[371]; - __u32 s_magic; - __u32 s_type; + uint16_t s_isize; + uint32_t s_fsize; + uint16_t s_nfree; + uint32_t s_free[XENIX_NICFREE]; + uint16_t s_ninode; + uint16_t s_inode[XENIX_NICINOD]; + uint8_t s_flock; + uint8_t s_ilock; + uint8_t s_fmod; + uint8_t s_ronly; + uint32_t s_time; + uint32_t s_tfree; + uint16_t s_tinode; + uint16_t s_dinfo[4]; + uint8_t s_fname[6]; + uint8_t s_fpack[6]; + uint8_t s_clean; + uint8_t s_fill[371]; + uint32_t s_magic; + uint32_t s_type; } __attribute__((__packed__)); #define SYSV_SUPERBLOCK_BLOCK 0x01 @@ -102,7 +102,7 @@ struct xenix_super { #define XENIX_MAGIC 0x2b5544 #define SYSV_MAX_BLOCKSIZE 0x800 -int volume_id_probe_sysv(struct volume_id *id, __u64 off) +int volume_id_probe_sysv(struct volume_id *id, uint64_t off) { struct sysv_super *vs; struct xenix_super *xs; diff --git a/extras/volume_id/volume_id/sysv.h b/extras/volume_id/volume_id/sysv.h index bd5a3500fb..1cb2bf9f43 100644 --- a/extras/volume_id/volume_id/sysv.h +++ b/extras/volume_id/volume_id/sysv.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_SYSV_ #define _VOLUME_ID_SYSV_ -extern int volume_id_probe_sysv(struct volume_id *id, __u64 off); +extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/udf.c b/extras/volume_id/volume_id/udf.c index a378fa9fd1..ecb6b9743d 100644 --- a/extras/volume_id/volume_id/udf.c +++ b/extras/volume_id/volume_id/udf.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -41,40 +40,40 @@ struct volume_descriptor { struct descriptor_tag { - __u16 id; - __u16 version; - __u8 checksum; - __u8 reserved; - __u16 serial; - __u16 crc; - __u16 crc_len; - __u32 location; + uint16_t id; + uint16_t version; + uint8_t checksum; + uint8_t reserved; + uint16_t serial; + uint16_t crc; + uint16_t crc_len; + uint32_t location; } __attribute__((__packed__)) tag; union { struct anchor_descriptor { - __u32 length; - __u32 location; + uint32_t length; + uint32_t location; } __attribute__((__packed__)) anchor; struct primary_descriptor { - __u32 seq_num; - __u32 desc_num; + uint32_t seq_num; + uint32_t desc_num; struct dstring { - __u8 clen; - __u8 c[31]; + uint8_t clen; + uint8_t c[31]; } __attribute__((__packed__)) ident; } __attribute__((__packed__)) primary; } __attribute__((__packed__)) type; } __attribute__((__packed__)); struct volume_structure_descriptor { - __u8 type; - __u8 id[5]; - __u8 version; + uint8_t type; + uint8_t id[5]; + uint8_t version; } __attribute__((__packed__)); #define UDF_VSD_OFFSET 0x8000 -int volume_id_probe_udf(struct volume_id *id, __u64 off) +int volume_id_probe_udf(struct volume_id *id, uint64_t off) { struct volume_descriptor *vd; struct volume_structure_descriptor *vsd; diff --git a/extras/volume_id/volume_id/udf.h b/extras/volume_id/volume_id/udf.h index b112e46ffc..5a784ad068 100644 --- a/extras/volume_id/volume_id/udf.h +++ b/extras/volume_id/volume_id/udf.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_UDF_ #define _VOLUME_ID_UDF_ -extern int volume_id_probe_udf(struct volume_id *id, __u64 off); +extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/ufs.c b/extras/volume_id/volume_id/ufs.c index d4f4db3d32..763b79cb0b 100644 --- a/extras/volume_id/volume_id/ufs.c +++ b/extras/volume_id/volume_id/ufs.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,140 +39,140 @@ #include "ufs.h" struct ufs_super_block { - __u32 fs_link; - __u32 fs_rlink; - __u32 fs_sblkno; - __u32 fs_cblkno; - __u32 fs_iblkno; - __u32 fs_dblkno; - __u32 fs_cgoffset; - __u32 fs_cgmask; - __u32 fs_time; - __u32 fs_size; - __u32 fs_dsize; - __u32 fs_ncg; - __u32 fs_bsize; - __u32 fs_fsize; - __u32 fs_frag; - __u32 fs_minfree; - __u32 fs_rotdelay; - __u32 fs_rps; - __u32 fs_bmask; - __u32 fs_fmask; - __u32 fs_bshift; - __u32 fs_fshift; - __u32 fs_maxcontig; - __u32 fs_maxbpg; - __u32 fs_fragshift; - __u32 fs_fsbtodb; - __u32 fs_sbsize; - __u32 fs_csmask; - __u32 fs_csshift; - __u32 fs_nindir; - __u32 fs_inopb; - __u32 fs_nspf; - __u32 fs_optim; - __u32 fs_npsect_state; - __u32 fs_interleave; - __u32 fs_trackskew; - __u32 fs_id[2]; - __u32 fs_csaddr; - __u32 fs_cssize; - __u32 fs_cgsize; - __u32 fs_ntrak; - __u32 fs_nsect; - __u32 fs_spc; - __u32 fs_ncyl; - __u32 fs_cpg; - __u32 fs_ipg; - __u32 fs_fpg; + uint32_t fs_link; + uint32_t fs_rlink; + uint32_t fs_sblkno; + uint32_t fs_cblkno; + uint32_t fs_iblkno; + uint32_t fs_dblkno; + uint32_t fs_cgoffset; + uint32_t fs_cgmask; + uint32_t fs_time; + uint32_t fs_size; + uint32_t fs_dsize; + uint32_t fs_ncg; + uint32_t fs_bsize; + uint32_t fs_fsize; + uint32_t fs_frag; + uint32_t fs_minfree; + uint32_t fs_rotdelay; + uint32_t fs_rps; + uint32_t fs_bmask; + uint32_t fs_fmask; + uint32_t fs_bshift; + uint32_t fs_fshift; + uint32_t fs_maxcontig; + uint32_t fs_maxbpg; + uint32_t fs_fragshift; + uint32_t fs_fsbtodb; + uint32_t fs_sbsize; + uint32_t fs_csmask; + uint32_t fs_csshift; + uint32_t fs_nindir; + uint32_t fs_inopb; + uint32_t fs_nspf; + uint32_t fs_optim; + uint32_t fs_npsect_state; + uint32_t fs_interleave; + uint32_t fs_trackskew; + uint32_t fs_id[2]; + uint32_t fs_csaddr; + uint32_t fs_cssize; + uint32_t fs_cgsize; + uint32_t fs_ntrak; + uint32_t fs_nsect; + uint32_t fs_spc; + uint32_t fs_ncyl; + uint32_t fs_cpg; + uint32_t fs_ipg; + uint32_t fs_fpg; struct ufs_csum { - __u32 cs_ndir; - __u32 cs_nbfree; - __u32 cs_nifree; - __u32 cs_nffree; + uint32_t cs_ndir; + uint32_t cs_nbfree; + uint32_t cs_nifree; + uint32_t cs_nffree; } __attribute__((__packed__)) fs_cstotal; - __s8 fs_fmod; - __s8 fs_clean; - __s8 fs_ronly; - __s8 fs_flags; + int8_t fs_fmod; + int8_t fs_clean; + int8_t fs_ronly; + int8_t fs_flags; union { struct { - __s8 fs_fsmnt[512]; - __u32 fs_cgrotor; - __u32 fs_csp[31]; - __u32 fs_maxcluster; - __u32 fs_cpc; - __u16 fs_opostbl[16][8]; + int8_t fs_fsmnt[512]; + uint32_t fs_cgrotor; + uint32_t fs_csp[31]; + uint32_t fs_maxcluster; + uint32_t fs_cpc; + uint16_t fs_opostbl[16][8]; } __attribute__((__packed__)) fs_u1; struct { - __s8 fs_fsmnt[468]; - __u8 fs_volname[32]; - __u64 fs_swuid; - __s32 fs_pad; - __u32 fs_cgrotor; - __u32 fs_ocsp[28]; - __u32 fs_contigdirs; - __u32 fs_csp; - __u32 fs_maxcluster; - __u32 fs_active; - __s32 fs_old_cpc; - __s32 fs_maxbsize; - __s64 fs_sparecon64[17]; - __s64 fs_sblockloc; + int8_t fs_fsmnt[468]; + uint8_t fs_volname[32]; + uint64_t fs_swuid; + int32_t fs_pad; + uint32_t fs_cgrotor; + uint32_t fs_ocsp[28]; + uint32_t fs_contigdirs; + uint32_t fs_csp; + uint32_t fs_maxcluster; + uint32_t fs_active; + int32_t fs_old_cpc; + int32_t fs_maxbsize; + int64_t fs_sparecon64[17]; + int64_t fs_sblockloc; struct ufs2_csum_total { - __u64 cs_ndir; - __u64 cs_nbfree; - __u64 cs_nifree; - __u64 cs_nffree; - __u64 cs_numclusters; - __u64 cs_spare[3]; + uint64_t cs_ndir; + uint64_t cs_nbfree; + uint64_t cs_nifree; + uint64_t cs_nffree; + uint64_t cs_numclusters; + uint64_t cs_spare[3]; } __attribute__((__packed__)) fs_cstotal; struct ufs_timeval { - __s32 tv_sec; - __s32 tv_usec; + int32_t tv_sec; + int32_t tv_usec; } __attribute__((__packed__)) fs_time; - __s64 fs_size; - __s64 fs_dsize; - __u64 fs_csaddr; - __s64 fs_pendingblocks; - __s32 fs_pendinginodes; + int64_t fs_size; + int64_t fs_dsize; + uint64_t fs_csaddr; + int64_t fs_pendingblocks; + int32_t fs_pendinginodes; } __attribute__((__packed__)) fs_u2; } fs_u11; union { struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __s32 fs_state; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; + int32_t fs_sparecon[53]; + int32_t fs_reclaim; + int32_t fs_sparecon2[1]; + int32_t fs_state; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; } __attribute__((__packed__)) fs_sun; struct { - __s32 fs_sparecon[53]; - __s32 fs_reclaim; - __s32 fs_sparecon2[1]; - __u32 fs_npsect; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; + int32_t fs_sparecon[53]; + int32_t fs_reclaim; + int32_t fs_sparecon2[1]; + uint32_t fs_npsect; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; } __attribute__((__packed__)) fs_sunx86; struct { - __s32 fs_sparecon[50]; - __s32 fs_contigsumsize; - __s32 fs_maxsymlinklen; - __s32 fs_inodefmt; - __u32 fs_maxfilesize[2]; - __u32 fs_qbmask[2]; - __u32 fs_qfmask[2]; - __s32 fs_state; + int32_t fs_sparecon[50]; + int32_t fs_contigsumsize; + int32_t fs_maxsymlinklen; + int32_t fs_inodefmt; + uint32_t fs_maxfilesize[2]; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; + int32_t fs_state; } __attribute__((__packed__)) fs_44; } fs_u2; - __s32 fs_postblformat; - __s32 fs_nrpos; - __s32 fs_postbloff; - __s32 fs_rotbloff; - __u32 fs_magic; - __u8 fs_space[1]; + int32_t fs_postblformat; + int32_t fs_nrpos; + int32_t fs_postbloff; + int32_t fs_rotbloff; + uint32_t fs_magic; + uint8_t fs_space[1]; } __attribute__((__packed__)); #define UFS_MAGIC 0x00011954 @@ -181,12 +180,12 @@ struct ufs_super_block { #define UFS_MAGIC_FEA 0x00195612 #define UFS_MAGIC_LFN 0x00095014 -int volume_id_probe_ufs(struct volume_id *id, __u64 off) +int volume_id_probe_ufs(struct volume_id *id, uint64_t off) { - __u32 magic; - int i; + uint32_t magic; + int i; struct ufs_super_block *ufs; - int offsets[] = {0, 8, 64, 256, -1}; + int offsets[] = {0, 8, 64, 256, -1}; dbg("probing at offset 0x%llx", (unsigned long long) off); diff --git a/extras/volume_id/volume_id/ufs.h b/extras/volume_id/volume_id/ufs.h index 82b4e1d064..8f0af18897 100644 --- a/extras/volume_id/volume_id/ufs.h +++ b/extras/volume_id/volume_id/ufs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_UFS_ #define _VOLUME_ID_UFS_ -extern int volume_id_probe_ufs(struct volume_id *id, __u64 off); +extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); #endif diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 7499fc121e..a145a8aa2f 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -34,16 +34,15 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" #include "util.h" -void volume_id_set_unicode16(char *str, unsigned int len, const __u8 *buf, enum endian endianess, unsigned int count) +void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) { unsigned int i, j; - __u16 c; + uint16_t c; j = 0; for (i = 0; i + 2 <= count; i += 2) { @@ -57,18 +56,18 @@ void volume_id_set_unicode16(char *str, unsigned int len, const __u8 *buf, enum } else if (c < 0x80) { if (j+1 >= len) break; - str[j++] = (__u8) c; + str[j++] = (uint8_t) c; } else if (c < 0x800) { if (j+2 >= len) break; - str[j++] = (__u8) (0xc0 | (c >> 6)); - str[j++] = (__u8) (0x80 | (c & 0x3f)); + str[j++] = (uint8_t) (0xc0 | (c >> 6)); + str[j++] = (uint8_t) (0x80 | (c & 0x3f)); } else { if (j+3 >= len) break; - str[j++] = (__u8) (0xe0 | (c >> 12)); - str[j++] = (__u8) (0x80 | ((c >> 6) & 0x3f)); - str[j++] = (__u8) (0x80 | (c & 0x3f)); + str[j++] = (uint8_t) (0xe0 | (c >> 12)); + str[j++] = (uint8_t) (0x80 | ((c >> 6) & 0x3f)); + str[j++] = (uint8_t) (0x80 | (c & 0x3f)); } } str[j] = '\0'; @@ -109,20 +108,26 @@ void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) id->usage = usage_to_string(usage_id); } -void volume_id_set_label_raw(struct volume_id *id, const __u8 *buf, unsigned int count) +void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count) { memcpy(id->label_raw, buf, count); id->label_raw_len = count; } -void volume_id_set_label_string(struct volume_id *id, const __u8 *buf, unsigned int count) +static size_t my_strnlen(const char *s, size_t max) { + const char *p = s; + for (; *p && max--; ++p); + return(p - s); +} + +void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) { unsigned int i; memcpy(id->label, buf, count); /* remove trailing whitespace */ - i = strnlen(id->label, count); + i = my_strnlen(id->label, count); while (i--) { if (!isspace(id->label[i])) break; @@ -130,12 +135,12 @@ void volume_id_set_label_string(struct volume_id *id, const __u8 *buf, unsigned id->label[i+1] = '\0'; } -void volume_id_set_label_unicode16(struct volume_id *id, const __u8 *buf, enum endian endianess, unsigned int count) +void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count) { volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count); } -void volume_id_set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format format) +void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) { unsigned int i; unsigned int count = 0; @@ -196,11 +201,11 @@ set: } } -__u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) +uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) { - unsigned int buf_len; + size_t buf_len; - dbg("get buffer off 0x%llx(%llu), len 0x%x", (unsigned long long) off, (unsigned long long) off, len); + dbg("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); /* check if requested area fits in superblock buffer */ if (off + len <= SB_BUFFER_SIZE) { if (id->sbbuf == NULL) { @@ -214,7 +219,7 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len)); lseek(id->fd, 0, SEEK_SET); buf_len = read(id->fd, id->sbbuf, off + len); - dbg("got 0x%x (%i) bytes", buf_len, buf_len); + dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->sbbuf_len = buf_len; if (buf_len < off + len) return NULL; @@ -236,15 +241,15 @@ __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len) /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - dbg("read seekbuf off:0x%llx len:0x%x", (unsigned long long) off, len); + dbg("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); if (lseek(id->fd, off, SEEK_SET) == -1) return NULL; buf_len = read(id->fd, id->seekbuf, len); - dbg("got 0x%x (%i) bytes", buf_len, buf_len); + dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->seekbuf_off = off; id->seekbuf_len = buf_len; if (buf_len < len) { - dbg("requested 0x%x bytes, got only 0x%x bytes", len, buf_len); + dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); return NULL; } } diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h index e18efe2f21..0c94fea051 100644 --- a/extras/volume_id/volume_id/util.h +++ b/extras/volume_id/volume_id/util.h @@ -37,22 +37,22 @@ #define SEEK_BUFFER_SIZE 0x10000 /* probe volume for all known filesystems in specific order */ -#define bswap16(x) (__u16)((((__u16)(x) & 0x00ffu) << 8) | \ - (((__u16)(x) & 0xff00u) >> 8)) +#define bswap16(x) (uint16_t) ((((uint16_t)(x) & 0x00ffu) << 8) | \ + (((uint16_t)(x) & 0xff00u) >> 8)) -#define bswap32(x) (__u32)((((__u32)(x) & 0xff000000u) >> 24) | \ - (((__u32)(x) & 0x00ff0000u) >> 8) | \ - (((__u32)(x) & 0x0000ff00u) << 8) | \ - (((__u32)(x) & 0x000000ffu) << 24)) +#define bswap32(x) (uint32_t) ((((uint32_t)(x) & 0xff000000u) >> 24) | \ + (((uint32_t)(x) & 0x00ff0000u) >> 8) | \ + (((uint32_t)(x) & 0x0000ff00u) << 8) | \ + (((uint32_t)(x) & 0x000000ffu) << 24)) -#define bswap64(x) (__u64)((((__u64)(x) & 0xff00000000000000ull) >> 56) | \ - (((__u64)(x) & 0x00ff000000000000ull) >> 40) | \ - (((__u64)(x) & 0x0000ff0000000000ull) >> 24) | \ - (((__u64)(x) & 0x000000ff00000000ull) >> 8) | \ - (((__u64)(x) & 0x00000000ff000000ull) << 8) | \ - (((__u64)(x) & 0x0000000000ff0000ull) << 24) | \ - (((__u64)(x) & 0x000000000000ff00ull) << 40) | \ - (((__u64)(x) & 0x00000000000000ffull) << 56)) +#define bswap64(x) (uint64_t) ((((uint64_t)(x) & 0xff00000000000000ull) >> 56) | \ + (((uint64_t)(x) & 0x00ff000000000000ull) >> 40) | \ + (((uint64_t)(x) & 0x0000ff0000000000ull) >> 24) | \ + (((uint64_t)(x) & 0x000000ff00000000ull) >> 8) | \ + (((uint64_t)(x) & 0x00000000ff000000ull) << 8) | \ + (((uint64_t)(x) & 0x0000000000ff0000ull) << 24) | \ + (((uint64_t)(x) & 0x000000000000ff00ull) << 40) | \ + (((uint64_t)(x) & 0x00000000000000ffull) << 56)) #ifdef __BYTE_ORDER #if (__BYTE_ORDER == __LITTLE_ENDIAN) @@ -87,14 +87,14 @@ enum endian { BE = 1 }; -extern void volume_id_set_unicode16(char *str, unsigned int len, const __u8 *buf, enum endian endianess, unsigned int count); +extern void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); extern void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id); -extern void volume_id_set_label_raw(struct volume_id *id, const __u8 *buf, unsigned int count); -extern void volume_id_set_label_string(struct volume_id *id, const __u8 *buf, unsigned int count); -extern void volume_id_set_label_unicode16(struct volume_id *id, const __u8 *buf, enum endian endianess, unsigned int count); -extern void volume_id_set_uuid(struct volume_id *id, const __u8 *buf, enum uuid_format format); -extern __u8 *volume_id_get_buffer(struct volume_id *id, __u64 off, unsigned int len); +extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); +extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format); +extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); extern void volume_id_free_buffer(struct volume_id *id); #endif /* _VOLUME_ID_UTIL_ */ diff --git a/extras/volume_id/volume_id/via_raid.c b/extras/volume_id/volume_id/via_raid.c index 393890eb28..2f167dcbcc 100644 --- a/extras/volume_id/volume_id/via_raid.c +++ b/extras/volume_id/volume_id/via_raid.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,25 +39,25 @@ #include "via_raid.h" struct via_meta { - __u16 signature; - __u8 version_number; + uint16_t signature; + uint8_t version_number; struct via_array { - __u16 disk_bits; - __u8 disk_array_ex; - __u32 capacity_low; - __u32 capacity_high; - __u32 serial_checksum; + uint16_t disk_bits; + uint8_t disk_array_ex; + uint32_t capacity_low; + uint32_t capacity_high; + uint32_t serial_checksum; } __attribute((packed)) array; - __u32 serial_checksum[8]; - __u8 checksum; + uint32_t serial_checksum[8]; + uint8_t checksum; } __attribute__((packed)); #define VIA_SIGNATURE 0xAA55 -int volume_id_probe_via_raid(struct volume_id *id, __u64 off, __u64 size) +int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) { - const __u8 *buf; - __u64 meta_off; + const uint8_t *buf; + uint64_t meta_off; struct via_meta *via; dbg("probing at offset 0x%llx, size 0x%llx", diff --git a/extras/volume_id/volume_id/via_raid.h b/extras/volume_id/volume_id/via_raid.h index 2d0651c413..429375dcc9 100644 --- a/extras/volume_id/volume_id/via_raid.h +++ b/extras/volume_id/volume_id/via_raid.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID_VIA_RAID_ #define _VOLUME_ID_VIA_RAID_ -extern int volume_id_probe_via_raid(struct volume_id *id, __u64 off, __u64 size); +extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 8e944be0b1..4c4a42a00d 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -35,7 +35,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -71,7 +70,7 @@ #include "msdos.h" #include "ocfs2.h" -int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size) +int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) { if (id == NULL) return -EINVAL; @@ -224,7 +223,7 @@ struct volume_id *volume_id_open_node(const char *path) struct volume_id *volume_id_open_dev_t(dev_t devt) { struct volume_id *id; - __u8 tmp_node[VOLUME_ID_PATH_MAX]; + char tmp_node[VOLUME_ID_PATH_MAX]; snprintf(tmp_node, VOLUME_ID_PATH_MAX, "/dev/.volume_id-%u-%u-%u", getpid(), major(devt), minor(devt)); diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 4e0defdadd..a82b221028 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -21,7 +21,9 @@ #ifndef _VOLUME_ID_H_ #define _VOLUME_ID_H_ -#define VOLUME_ID_VERSION 46 +#include + +#define VOLUME_ID_VERSION 47 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 @@ -44,17 +46,17 @@ struct volume_id_partition { enum volume_id_usage usage_id; char *usage; char *type; - unsigned long long off; - unsigned long long len; - unsigned int partition_type_raw; + uint64_t off; + uint64_t len; + uint8_t partition_type_raw; }; struct volume_id { - unsigned char label_raw[VOLUME_ID_LABEL_SIZE]; - unsigned int label_raw_len; + uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; + size_t label_raw_len; char label[VOLUME_ID_LABEL_SIZE+1]; - unsigned char uuid_raw[VOLUME_ID_UUID_SIZE]; - unsigned int uuid_raw_len; + uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; + size_t uuid_raw_len; char uuid[VOLUME_ID_UUID_SIZE+1]; enum volume_id_usage usage_id; char *usage; @@ -62,21 +64,21 @@ struct volume_id { char type_version[VOLUME_ID_FORMAT_SIZE]; struct volume_id_partition *partitions; - unsigned int partition_count; + size_t partition_count; int fd; - unsigned char *sbbuf; - unsigned int sbbuf_len; - unsigned char *seekbuf; - unsigned long long seekbuf_off; - unsigned int seekbuf_len; - int fd_close; + uint8_t *sbbuf; + size_t sbbuf_len; + uint8_t *seekbuf; + uint64_t seekbuf_off; + size_t seekbuf_len; + int fd_close:1; }; extern struct volume_id *volume_id_open_fd(int fd); extern struct volume_id *volume_id_open_node(const char *path); extern struct volume_id *volume_id_open_dev_t(dev_t devt); -extern int volume_id_probe_all(struct volume_id *id, unsigned long long off, unsigned long long size); +extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); extern void volume_id_close(struct volume_id *id); #endif diff --git a/extras/volume_id/volume_id/xfs.c b/extras/volume_id/volume_id/xfs.c index b8702a3fb3..e631e23ead 100644 --- a/extras/volume_id/volume_id/xfs.c +++ b/extras/volume_id/volume_id/xfs.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" @@ -40,21 +39,21 @@ #include "xfs.h" struct xfs_super_block { - __u8 magic[4]; - __u32 blocksize; - __u64 dblocks; - __u64 rblocks; - __u32 dummy1[2]; - __u8 uuid[16]; - __u32 dummy2[15]; - __u8 fname[12]; - __u32 dummy3[2]; - __u64 icount; - __u64 ifree; - __u64 fdblocks; + uint8_t magic[4]; + uint32_t blocksize; + uint64_t dblocks; + uint64_t rblocks; + uint32_t dummy1[2]; + uint8_t uuid[16]; + uint32_t dummy2[15]; + uint8_t fname[12]; + uint32_t dummy3[2]; + uint64_t icount; + uint64_t ifree; + uint64_t fdblocks; } __attribute__((__packed__)); -int volume_id_probe_xfs(struct volume_id *id, __u64 off) +int volume_id_probe_xfs(struct volume_id *id, uint64_t off) { struct xfs_super_block *xs; diff --git a/extras/volume_id/volume_id/xfs.h b/extras/volume_id/volume_id/xfs.h index 76b1725664..537617f7e5 100644 --- a/extras/volume_id/volume_id/xfs.h +++ b/extras/volume_id/volume_id/xfs.h @@ -21,6 +21,6 @@ #ifndef _VOLUME_ID__ #define _VOLUME_ID__ -extern int volume_id_probe_xfs(struct volume_id *id, __u64 off); +extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); #endif -- cgit v1.2.3-54-g00ecf From d455b0085d65cd25915a34d84f894a4950d313a2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Aug 2005 05:07:19 +0200 Subject: allow RUN to send the environment to a local socket RUN="socket:" will send the environment in the kernel uevent format to the named destination. Using the socket instead of the program to pass the hotplug events to the HAL daemon, cuts down the running time of udevstart from 0.8 to 0.4 seconds on my box. env -i ACTION=add DEVPATH=/block/hda/hda1 strace -s10000 ./udev block sendto(3, "add@/block/hda/hda1\0 ACTION=add\0DEVPATH=/block/hda/hda1\0UDEV_LOG=3\0 ID_TYPE=disk\0ID_MODEL=HTS726060M9AT00\0ID_SERIAL=MRH401M4G6UM9B\0 ID_REVISION=MH4OA6BA\0ID_BUS=ata\0ID_PATH=pci-0000:00:1f.1-ide-0:0\0 ID_FS_USAGE=other\0ID_FS_TYPE=swap\0ID_FS_VERSION=2\0 ID_FS_UUID=9352cfef-7687-47bc-a2a3-34cf136f72e1\0 ID_FS_LABEL=ThisIsSwap\0ID_FS_LABEL_SAFE=ThisIsSwap\0 DEVNAME=/dev/hda1\0" Signed-off-by: Kay Sievers --- udev.c | 8 ++++++-- udev_utils.c | 34 ++++++++++++++++++++++++++++++++++ udev_utils.h | 1 + udevsend.c | 14 +++++++------- udevstart.c | 8 ++++++-- 5 files changed, 54 insertions(+), 11 deletions(-) diff --git a/udev.c b/udev.c index 4096b8b348..2a6e1efc99 100644 --- a/udev.c +++ b/udev.c @@ -123,8 +123,12 @@ int main(int argc, char *argv[], char *envp[]) struct name_entry *name_loop; dbg("executing run list"); - list_for_each_entry(name_loop, &udev.run_list, node) - execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); + list_for_each_entry(name_loop, &udev.run_list, node) { + if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) + pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action); + else + execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); + } } udev_cleanup_device(&udev); diff --git a/udev_utils.c b/udev_utils.c index 2524baf592..fd4cd13e5d 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include #include @@ -372,6 +374,38 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c return 0; } +int pass_env_to_socket(const char *sockname, const char *devpath, const char *action) +{ + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; + char buf[2048]; + size_t bufpos = 0; + int i; + int retval; + + dbg("pass environment to socket '%s'", sockname); + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + /* only abstract namespace is supported */ + strcpy(&saddr.sun_path[1], sockname); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + + bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); + bufpos++; + for (i = 0; environ[i] != NULL && bufpos < sizeof(buf); i++) { + bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); + bufpos++; + } + + retval = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, addrlen); + if (retval != -1) + retval = 0; + + return retval; +} + int execute_program(const char *command, const char *subsystem, char *result, size_t ressize, size_t *reslen) { diff --git a/udev_utils.h b/udev_utils.h index 5f4152df82..5b223855b6 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -44,6 +44,7 @@ extern void replace_untrusted_chars(char *string); extern int name_list_add(struct list_head *name_list, const char *name, int sort); extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); +extern int pass_env_to_socket(const char *name, const char *devpath, const char *action); extern int execute_program(const char *command, const char *subsystem, char *result, size_t ressize, size_t *reslen); diff --git a/udevsend.c b/udevsend.c index 94ab6ff625..0ba1b58a4b 100644 --- a/udevsend.c +++ b/udevsend.c @@ -19,17 +19,17 @@ * */ -#include -#include -#include -#include -#include -#include #include #include #include -#include #include +#include +#include +#include +#include +#include +#include +#include #include #include "udev.h" diff --git a/udevstart.c b/udevstart.c index 0bcbc39737..5f3ba711f0 100644 --- a/udevstart.c +++ b/udevstart.c @@ -160,8 +160,12 @@ run: struct name_entry *name_loop; dbg("executing run list"); - list_for_each_entry(name_loop, &udev.run_list, node) - execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); + list_for_each_entry(name_loop, &udev.run_list, node) { + if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) + pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, "add"); + else + execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); + } } exit: sysfs_close_class_device(class_dev); -- cgit v1.2.3-54-g00ecf From 1bc33626787f089523192c270790f9f878a4edd7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Aug 2005 20:22:46 +0200 Subject: add udevmonitor, to debug netlink+udev events at the same time This rule: RUN+="socket:/org/kernel/udev/monitor" send the event to the running monitor. Running udevstart give a nice monitor output. Also the delay between the kernel uevent and the udev udev event can be investigated: pim:/home/kay/src/udev-kay # ./udevmonitor UEVENT[1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1 UEVENT[1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0 UEVENT[1122920113] add@/class/scsi_host/host12 UEVENT[1122920113] add@/class/usb_device/usbdev2.99 UEVENT[1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0/host12/target12:0:0/12:0:0:0 UDEV [1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1 UEVENT[1122920113] add@/block/sda UEVENT[1122920113] add@/class/scsi_generic/sg0 UEVENT[1122920113] add@/class/scsi_device/12:0:0:0 UDEV [1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0 UDEV [1122920113] add@/class/scsi_host/host12 UDEV [1122920113] add@/class/usb_device/usbdev2.99 UDEV [1122920113] add@/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0/host12/target12:0:0/12:0:0:0 UDEV [1122920113] add@/block/sda UDEV [1122920113] add@/class/scsi_generic/sg0 UDEV [1122920113] add@/class/scsi_device/12:0:0:0 UEVENT[1122920115] add@/block/sda/sda1 UDEV [1122920115] add@/block/sda/sda1 pim:/home/kay/src/udev-kay # ./udevmonitor --env UDEV [1122920185] add@/block/sda/sda1 ACTION=add DEVPATH=/block/sda/sda1 SUBSYSTEM=block SEQNUM=2159 MINOR=1 MAJOR=8 PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb2/2-1/2-1:1.0/host13/target13:0:0/13:0:0:0 PHYSDEVBUS=scsi PHYSDEVDRIVER=sd UDEVD_EVENT=1 UDEV_LOG=3 ID_VENDOR=IBM ID_MODEL=Memory_Key ID_REVISION=3.04 ID_SERIAL=IBM_Memory_Key_0218B301030027E8 ID_TYPE=disk ID_BUS=usb ID_PATH=usb-0218B301030027E8:0:0:0 ID_FS_USAGE=filesystem ID_FS_TYPE=vfat ID_FS_VERSION=FAT16 ID_FS_UUID=42D8-9E02 ID_FS_LABEL_SAFE=s_p_c DEVNAME=/dev/sda1 Signed-off-by: Kay Sievers --- Makefile | 12 +++- udevd.h | 2 +- udevmonitor.c | 185 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 196 insertions(+), 3 deletions(-) create mode 100644 udevmonitor.c diff --git a/Makefile b/Makefile index c9807de4bc..5eb93bd500 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,7 @@ COMPILE = udevrulescompile INITSENDER = udevinitsend RECORDER = udeveventrecorder CONTROL = udevcontrol +MONITOR = udevmonitor INFO = udevinfo TESTER = udevtest STARTER = udevstart @@ -204,7 +205,7 @@ endif # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf -all: $(ROOT) $(SENDER) $(COMPILE) $(INITSENDER) $(RECORDER) $(CONTROL) \ +all: $(ROOT) $(SENDER) $(COMPILE) $(INITSENDER) $(RECORDER) $(CONTROL) $(MONITOR)\ $(DAEMON) $(COMPILE) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) @extras="$(EXTRAS)" ; for target in $$extras ; do \ echo $$target ; \ @@ -275,6 +276,7 @@ $(COMPILE).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(INITSENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(RECORDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(CONTROL).o: $(HEADERS) $( $(HEADERS)GEN_HEADERS) $(HOST_PROGS) $(KLCC) +$(MONITOR).o: $(HEADERS) $( $(HEADERS)GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(STARTER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(ROOT): $(KLCC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) @@ -313,6 +315,10 @@ $(CONTROL): $(KLCC) $(CONTROL).o $(OBJS) udevd.h $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CONTROL).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ +$(MONITOR): $(KLCC) $(MONITOR).o $(OBJS) udevd.h + $(QUIET) $(LD) $(LDFLAGS) -o $@ $(MONITOR).o $(OBJS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ + $(STARTER): $(KLCC) $(STARTER).o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) -o $@ $(STARTER).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ @@ -324,7 +330,7 @@ clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) \ - $(SENDER) $(COMPILE) $(INITSENDER) $(RECORDER) $(CONTROL) $(TESTER) $(STARTER) + $(SENDER) $(COMPILE) $(INITSENDER) $(RECORDER) $(CONTROL) $(MONITOR) $(TESTER) $(STARTER) -rm -f ccdv $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)" ; for target in $$extras ; do \ @@ -374,6 +380,7 @@ install: install-config install-man all $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(CONTROL) $(DESTDIR)$(sbindir)/$(CONTROL) + $(INSTALL_PROGRAM) -D $(MONITOR) $(DESTDIR)$(sbindir)/$(MONITOR) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) @@ -399,6 +406,7 @@ uninstall: uninstall-man - rm $(sbindir)/$(INITSENDER) - rm $(sbindir)/$(RECORDER) - rm $(sbindir)/$(CONTROL) + - rm $(sbindir)/$(MONITOR) - rm $(sbindir)/$(STARTER) - rm $(usrbindir)/$(INFO) - rm $(usrbindir)/$(TESTER) diff --git a/udevd.h b/udevd.h index aadae31e57..da5f6b94f9 100644 --- a/udevd.h +++ b/udevd.h @@ -22,7 +22,7 @@ #include "list.h" #define UDEV_MAGIC "udevd_" UDEV_VERSION -#define UDEVD_SOCK_PATH "udevd" +#define UDEVD_SOCK_PATH "/org/kernel/udev/udevd" #define UDEVSEND_WAIT_MAX_SECONDS 3 #define UDEVSEND_WAIT_LOOP_PER_SECOND 10 diff --git a/udevmonitor.c b/udevmonitor.c new file mode 100644 index 0000000000..f4f28b1659 --- /dev/null +++ b/udevmonitor.c @@ -0,0 +1,185 @@ +/* + * udevmonitor.c + * + * Copyright (C) 2004-2005 Kay Sievers + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" + +static int uevent_netlink_sock; +static int udev_monitor_sock; + +static int init_udev_monitor_socket(void) +{ + struct sockaddr_un saddr; + socklen_t addrlen; + const int feature_on = 1; + int retval; + + memset(&saddr, 0x00, sizeof(saddr)); + saddr.sun_family = AF_LOCAL; + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], "/org/kernel/udev/monitor"); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + + udev_monitor_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udev_monitor_sock == -1) { + fprintf(stderr, "error getting socket, %s\n", strerror(errno)); + return -1; + } + + /* the bind takes care of ensuring only one copy running */ + retval = bind(udev_monitor_sock, (struct sockaddr *) &saddr, addrlen); + if (retval < 0) { + fprintf(stderr, "bind failed, %s\n", strerror(errno)); + close(udev_monitor_sock); + return -1; + } + + /* enable receiving of the sender credentials */ + setsockopt(udev_monitor_sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); + + return 0; +} + +static int init_uevent_netlink_sock(void) +{ + struct sockaddr_nl snl; + int retval; + + memset(&snl, 0x00, sizeof(struct sockaddr_nl)); + snl.nl_family = AF_NETLINK; + snl.nl_pid = getpid(); + snl.nl_groups = 0xffffffff; + + uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + if (uevent_netlink_sock == -1) { + fprintf(stderr, "error getting socket, %s\n", strerror(errno)); + return -1; + } + + retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, + sizeof(struct sockaddr_nl)); + if (retval < 0) { + fprintf(stderr, "bind failed, %s\n", strerror(errno)); + close(uevent_netlink_sock); + uevent_netlink_sock = -1; + return -1; + } + + return 0; +} + +int main(int argc, char *argv[]) +{ + int env = 0; + int maxsockplus; + fd_set readfds; + int retval; + + if (getuid() != 0) { + printf("need to be root, exit\n"); + exit(1); + } + + if (argc == 2 && strstr(argv[1], "--env")) + env = 1; + + init_uevent_netlink_sock(); + init_udev_monitor_socket(); + + FD_ZERO(&readfds); + FD_SET(uevent_netlink_sock, &readfds); + FD_SET(udev_monitor_sock, &readfds); + maxsockplus = udev_monitor_sock+1; + + while (1) { + static char buf[UEVENT_BUFFER_SIZE*2]; + ssize_t buflen; + fd_set workreadfds; + + buflen = 0; + workreadfds = readfds; + + retval = select(maxsockplus, &workreadfds, NULL, NULL, NULL); + if (retval < 0) { + if (errno != EINTR) + fprintf(stderr, "error receiving uevent message\n"); + continue; + } + + if (FD_ISSET(uevent_netlink_sock, &workreadfds)) { + buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); + if (buflen <= 0) { + fprintf(stderr, "error receiving uevent message\n"); + continue; + } + printf("UEVENT[%i] %s\n", time(NULL), buf); + } + + if (FD_ISSET(udev_monitor_sock, &workreadfds)) { + buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); + if (buflen <= 0) { + fprintf(stderr, "error receiving udev message\n"); + continue; + } + printf("UDEV [%i] %s\n", time(NULL), buf); + } + + if (buflen == 0) + continue; + + /* print environment */ + if (env) { + size_t bufpos; + + /* start of payload */ + bufpos = strlen(buf) + 1; + + while (bufpos < (size_t)buflen) { + int keylen; + char *key; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + printf("%s\n", key); + bufpos += keylen + 1; + } + printf("\n"); + } + } + + close(uevent_netlink_sock); + close(udev_monitor_sock); + exit(1); +} -- cgit v1.2.3-54-g00ecf From be962ec9a8fa6e7bd5328b29894e7b6186496cc6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 1 Aug 2005 15:44:02 -0700 Subject: Update gentoo rules file. Signed-off-by: Greg Kroah-Hartman --- etc/udev/gentoo/udev.rules | 53 +++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 572e5c8ce1..75c192ffaa 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -1,16 +1,33 @@ -# /etc/udev/udev.rules: device naming rules for udev +# /etc/udev/rules/50-udev.rules: device naming rules for udev # -# Gentoo specific rules, based a bit on devfs rules, but much simpler. +# Gentoo specific rules # # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. - - -########################################################### # -# For devfs similar /dev layout (neater) +# Try not to modify this file, if you wish to change things, create a new rule +# file that can be run before this one. # -########################################################### + + +# console +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcs*", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcsa*", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty[0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="tty[0-9][0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" + +# tty devices +KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" +KERNEL=="ippp0", NAME="%k", GROUP="tty" +KERNEL=="isdn*" NAME="%k", GROUP="tty" +KERNEL=="dcbri*", NAME="%k", GROUP="tty" +KERNEL=="ircomm*", NAME="%k", GROUP="tty" # all block devices SUBSYSTEM=="block", GROUP="disk" @@ -141,28 +158,6 @@ KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -# tty devices -KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" -KERNEL=="ippp0", NAME="%k", GROUP="tty" -KERNEL=="isdn*" NAME="%k", GROUP="tty" -KERNEL=="dcbri*", NAME="%k", GROUP="tty" -KERNEL=="ircomm*", NAME="%k", GROUP="tty" - -# pty devices -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" -KERNEL=="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK+="%k", GROUP="tty" - -# vc devices -KERNEL=="vcs", NAME="vcc/0", SYMLINK+="%k", GROUP="tty" -KERNEL=="vcs[0-9]*", NAME="vcc/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="vcsa", NAME="vcc/a0", SYMLINK+="%k", GROUP="tty" -KERNEL=="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK+="%k", GROUP="tty" - # memory devices KERNEL=="random", NAME="%k", MODE="0666" KERNEL=="urandom", NAME="%k", MODE="0444" -- cgit v1.2.3-54-g00ecf From 97b7aa1f7813cbe26f5fb928d44956ddb7bc70a9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 1 Aug 2005 16:37:41 -0700 Subject: Added horrible (but fun) path_id script to extras. Signed-off-by: Greg Kroah-Hartman --- extras/path_id | 390 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 390 insertions(+) create mode 100755 extras/path_id diff --git a/extras/path_id b/extras/path_id new file mode 100755 index 0000000000..8391f2e586 --- /dev/null +++ b/extras/path_id @@ -0,0 +1,390 @@ +#!/bin/sh +#set -x + +# this script should provide the shortest possible unique hardware path +# to a block device +# + +# Horrible script. Handle with extreme care. + +# to be called from udev +# DEVPATH=/block/sda/sda3 $0 (or similar) +# $0 /block/sda +# $0 /sys/block/sda + +# example for all: +# for i in `find /sys/block -name dev` ;do DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`" $0 ; done + +# examples: +# SCSI cdrom +# /block/sr0 -> /devices/pci0002:30/0002:30:0c.0/host0/0:0:1:0 +# result: pci-0002:30:0c.0-scsi-0:0:1:0 +# SCSI disk +# /block/sda -> /devices/pci0002:30/0002:30:0c.0/host0/0:0:4:0 +# result: pci-0002:30:0c.0-scsi-0:0:4:0 +# SATA disk, 4 channels per controller +# /block/sda -> /devices/pci0001:00/0001:00:07.0/0001:05:0c.0/host0/0:0:0:0 +# result: pci-0001:05:0c.0-scsi-0:0:0:0 +# IDE disk +# /block/hda -> /devices/pci0002:02/0002:02:0d.0/ide0/0.0 +# result: pci-0002:02:0d.0-ide-0.0 +# IDE cdrom on a Mac ASIC: +# /block/hdc -> /devices/pci0001:01/0001:01:17.0/0.80000000:mac-io/0.00020000:ata-3/ide1/1.0 +# result: mac-io_ata-3_master +# IDE cdrom on a Mac ASIC, with ide-scsi: +# /block/sr0 -> /devices/pci0001:01/0001:01:17.0/0.80000000:mac-io/0.0001f000:ata-4/ide0/0.1/host2/2:0:0:0 +# result: mac-io_ata-4_slave + +# USB CDrom drive without 'serial' number: +# reusing 'product' and 'manufacturer' string, if available +# /block/sr0 -> /devices/pci0001:00/0001:00:04.0/0001:02:0b.0/usb4/4-2/4-2:1.0/host4/4:0:0:0 +# result: usb-storage-odd-Freecom-USIDERev930:0:0:0 + +# devices may have several interfaces on one PCI device, like IDE: +# pci-0001:00:04.0_ide1-master +# pci-0001:00:04.0_ide2-master +# pci-0001:00:04.0_ide2-slave +# they are marked as ports, it is expected that the driver shows +# ide1 even if there is nothing connected to either master or slave +# interface +# +# match order is important. +# first IDE to find ide-scsi devices. +# then SCSI +# first usb-storage +# then firewire sbp2 +# then the rest + +PATH=/lib/klibc/bin #/usr:/usr/sbin:/usr/bin:/sbin:/bin +SYSFS=/sys +export PATH +RESULT=1 +CDROM= +TYPE= +OPWD="`pwd`" +# Check for 'pwd -P' +if $(pwd -P > /dev/null 2>&1); then + pwd_cmd="pwd -P" +else + pwd_cmd="pwd" +fi +full_sysfs_class_path= +full_sysfs_device_path= + +if [ -z "$DEVPATH" -a -z "$1" ] ; then + exit 1 +fi + +if [ -z "$DEVPATH" ] ; then + case "$1" in + $SYSFS/*) + DEVPATH="${1#$SYSFS}" + ;; + *) + DEVPATH=$1 + ;; + esac +fi + +if [ ! -d $SYSFS$DEVPATH ] ; then + exit 1 +fi +if [ ! -f $SYSFS$DEVPATH/dev ] ; then + exit 1 +fi + +case "$DEVPATH" in + /block/*) + TYPE=block + ;; + /class/*) + TYPE="${DEVPATH#/class/}" + TYPE="${TYPE%%/*}" + ;; + *) + exit 1 + ;; +esac + +# +## +# + +get_port () { + local type offset port + type=$1 + offset=$2 + for i in $type[0-9]* ; do + : i $i + port="${i#$type}" + if [ "$port" -lt "$offset" ] ; then offset=$port ; fi + done + if [ "$port" != "0" ] ; then + echo $(($2 - $offset)) + fi +} + +handle_block_ide () { +: handle_block_ide $* + local DEV=$1 + local port idedev idecontroller + # IDE + : DEV $DEV + d=$DEV + case "$DEV" in + # remove ide-scsi part, leave only channel info + */ide[0-9]*/host[0-9]*) + while [ ! -z "$d" ] ; do + case "$d" in + */host[0-9]*) + d="${d%/*}" + continue + ;; + *) + break + ;; + esac + done + ;; + esac + idedev=$d + while [ ! -z "$d" ] ; do + case "$d" in + */ide[0-9]*) + port="${d##*/}" + d="${d%/*}" + continue + ;; + *) + break + ;; + esac + done + idecontroller=$d + # port info if the controller has more than one interface + port="${port#ide}" + : port $port d $d + : idedev $idedev kernel_port $port + case "${idedev##*.}" in + 0) + channel=0 + ;; + 1) + channel=1 + ;; + *) + echo "Error: $idedev is neither master or slave" >&2 + esac + case "$d" in + *:mac-io/*) + : mac-io: $d + d="`echo $d | sed -e 's@^.*:mac-io[^:]\+:\([^/]\+\).*@mac-io_\1@'`" + ;; + /sys/devices) + # PCMCIA devices + ifname=${full_sysfs_class_path##*/} + set -- `sed -n "/$ifname/p" /var/lib/pcmcia/stab` + d="pcmcia-$1" + ;; + *) + d="pci-${d##*/}" + # d="`echo $d | sed -e 's@^.*/\([^/]\{1,\}\)/.@pci-\1@'`" + ;; + esac + + cd $idecontroller + port="`get_port ide $port`" + cd "$OPWD" + : hardware_port $port + if [ -z "$port" ] ; then + d="${d}-ide-0:$channel" + else + d="${d}-ide-${port}:$channel" + fi + + RESULT=0 +} + +handle_block_scsi () { +: handle_block_scsi $* + local DEV=$1 + local cil controller_port controller_dev + # SCSI device + cil="${DEV##*/}" + cil="${cil#*:}" + controller_dev=$DEV + while [ ! -z "$controller_dev" ] ; do + case "$controller_dev" in + */host[0-9]*) + controller_port=$controller_dev + controller_dev="${controller_dev%/*}" + ;; + *) break ;; + esac + done + : controller_dev $controller_dev + : controller_port $controller_port + # a host controller may have more than one interface/port + controller_port="${controller_port##*/}" + controller_port="${controller_port##host}" + # + case "$controller_dev" in + # grand central, old powermacs + *:gc/*) + adapter="`echo $controller_dev | sed -e 's@/[^/]\{1,\}$@@;s@^.*/@@;s@^.*:@@'`" + bus="gc" + ;; + *) + adapter="${controller_dev##*/}" + bus="pci" + ;; + esac + cd "$controller_dev" + controller_port="`get_port host $controller_port`" + cd "$OPWD" + d="$bus-$adapter" + if [ -z "$controller_port" ] ; then + controller_port=0 + fi + d="${d}-scsi-${controller_port}:${cil}" + RESULT=0 +} + +handle_block_usb_storage () { +: handle_block_usb_storage $* + local DEV=$1 + cil="${DEV##*/}" + cil="${cil#*:}" + controller_dev=$DEV + while [ ! -z "$controller_dev" ] ; do + case "$controller_dev" in + */host[0-9]*) + controller_dev="${controller_dev%/*}" + ;; + *) break ;; + esac + done + : controller_dev $controller_dev + # + # usb-storage devs have a serial number, hopefully unique + serial= + if [ -f $controller_dev/../serial ] ; then + serial="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_0123456789]@@g' < $controller_dev/../serial`" + : serial XXX_${serial}_XXX + d="usb-$serial" + serial="`echo $serial | sed -e 's@[ 0]\{1,\}@@g'`" + fi + if [ -z "$serial" ] ; then + # no serial, broken device + # has eventually binary junk in vpd + identifier= + if [ -f $controller_dev/../product ] ; then + product="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_0123456789]@@g' < $controller_dev/../product`" + fi + if [ -f $controller_dev/../manufacturer ] ; then + manufacturer="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_0123456789]@@g' < $controller_dev/../manufacturer`" + fi + if [ -z "$product" -o -z "$manufacturer" ] ; then + read idvendor < $controller_dev/../idVendor + read idproduct < $controller_dev/../idProduct + identifier="0x${idvendor}-0x${idproduct}" + else + identifier="${manufacturer}-${product}" + fi + d="usb-${identifier}" + fi + d="$d:$cil" + RESULT=0 + + +} + +handle_block () { + full_sysfs_class_path="$SYSFS$DEVPATH" + if [ ! -f $full_sysfs_class_path/dev ] ; then return ; fi + # the main device has (hopefully) a symlink to the real device + # a partition is a subdir of the main (raw) device + if [ ! -L $full_sysfs_class_path/device ] ; then + if [ -f $full_sysfs_class_path/range ] ; then return ; fi + full_sysfs_class_path="${full_sysfs_class_path%/*}" + : full_sysfs_class_path "$full_sysfs_class_path" + if [ ! -L $full_sysfs_class_path/device -o ! -f $full_sysfs_class_path/dev ] ; then + return + fi + fi + cd $full_sysfs_class_path/device + full_sysfs_device_path="`$pwd_cmd`" + cd "$OPWD" + D=$full_sysfs_device_path + case "$D" in + */ide[0-9]/[0-9].[0-9]*|*/ide[0-9][0-9]/[0-9][0-9].[0-9]*) + handle_block_ide "$D" + ;; + */usb[0-9]*/[0-9]*/host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) + handle_block_usb_storage "$D" + ;; + */css0/*) + if [ -r $full_sysfs_device_path/wwpn ]; then + read wwpn < $full_sysfs_device_path/wwpn + fi + if [ -r $full_sysfs_device_path/fcp_lun ]; then + read lun < $full_sysfs_device_path/fcp_lun + fi + if [ -r $full_sysfs_device_path/hba_id ]; then + read bus_id < $full_sysfs_device_path/hba_id + fi + if [ "$bus_id" -a "$wwpn" -a "$lun" ]; then + # S/390 zfcp adapter + d="ccw-$bus_id-zfcp-$wwpn:$lun" + RESULT=0 + else + # DASD devices + bus="ccw" + adapter=${D##*/} + d="$bus-$adapter" + RESULT=0 + fi + ;; + */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) + # check for ieee1394 sbp2 + if test -f $D/ieee1394_id ; then + read ieee1394_id < $D/ieee1394_id + d="`echo ieee1394-${ieee1394_id} | sed -e 's@:@-@g'`" + RESULT=0 + else + handle_block_scsi "$D" + fi + ;; + + *) + : not handled + RESULT=1 + return + + ;; + esac + # look for a partition + if [ "$full_sysfs_class_path" != "$SYSFS$DEVPATH" ] ; then + dp="`echo $SYSFS$DEVPATH | sed -e 's@^/.*/@@;s@^[^0-9]\{1,\}@@;s@.*_@@'`" + case "$d" in + *[0-9]) + d="${d}p${dp}" + ;; + *) + d="${d}${dp}" + ;; + esac + fi + # done + echo "ID_PATH=$d" +} + +case "$TYPE" in + block) + handle_block + ;; + *) + RESULT=1 + ;; +esac +exit $RESULT -- cgit v1.2.3-54-g00ecf From 61341fae4f84917d3963fff205e9efc31a4cbd16 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Aug 2005 04:32:19 +0200 Subject: update release notes for next version Signed-off-by: Kay Sievers --- RELEASE-NOTES | 22 ++++++++++++++++++++++ udev_utils.c | 1 + 2 files changed, 23 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index db1e6b838f..09d29c8b0a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,25 @@ +udev 065 +======== +We can use socket communication now to pass events from udev to +other programs: + RUN+="socket:/org/freedesktop/hal/udev_event" +will pass the whole udev event to the HAL daemon without the need +for a forked helper. (See ChangeLog for udevmonitor, as an example) + +udev 064 +======== +Mostly bugfixes and see ChangeLog. + +The test for the existence of an environment value should be +switched from: + ENV{KEY}=="*" to ENV{KEY}=="?*" +cause "*" will not fail anymore, if the key does not exist or +is empty. + +udev 063 +======== +Bugfixes and a few tweaks described in the ChangeLog. + udev 062 ======== Mostly a Bugfix release. diff --git a/udev_utils.c b/udev_utils.c index fd4cd13e5d..500d595c01 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -403,6 +403,7 @@ int pass_env_to_socket(const char *sockname, const char *devpath, const char *ac if (retval != -1) retval = 0; + close(sock); return retval; } -- cgit v1.2.3-54-g00ecf From 74f1ce92c462a8df8927a121b3b7a43fdcfdecaa Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 2 Aug 2005 12:28:50 -0700 Subject: Added persistent name rules for block devices to gentoo rule file. Copied from Kay's rules from the SuSE package. Let the fun begin... Signed-off-by: Greg Kroah-Hartman --- etc/udev/gentoo/udev.rules | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 75c192ffaa..0c96969dbc 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -243,6 +243,38 @@ KERNEL=="issm*", NAME="infiniband/%k" # tpm devices KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" +# block device disk id's +SUBSYSTEM=="block", GROUP="disk", MODE="0640" +KERNEL=="hd*[!0-9]", ACTION=="add", IMPORT="/etc/udev/scripts/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]", ACTION=="add", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" +KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/etc/udev/scripts/usb_id -x" +KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/etc/udev/scripts/scsi_id -g -x -s %p" +KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/etc/udev/scripts/scsi_id -g -x -a -s %p" +KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# Skip id for ram / loop / fd +SUBSYSTEM=="block", KERNEL=="ram*", GOTO="no_volume_id" +SUBSYSTEM=="block", KERNEL=="loop*", GOTO="no_volume_id" +SUBSYSTEM=="block", KERNEL=="fd*", GOTO="no_volume_id" + +SUBSYSTEM=="block", KERNEL=="*[!0-9]", ACTION=="add", ENV{ID_TYPE}=="?*", IMPORT="/etc/udev/scripts/path_id %p", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}" +SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*" +SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", ENV{ID_PATH}=="?*", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n" + +# volume-label/uuid +SUBSYSTEM=="block", KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" +SUBSYSTEM=="block", KERNEL=="sr*", GOTO="no_volume_id" +SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT="/etc/udev/scripts/vol_id --export $tempnode" +SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +SUBSYSTEM=="block", LABEL="no_volume_id" + + # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems # run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" @@ -250,3 +282,5 @@ ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" # always run /etc/dev.d/ stuff for now. RUN+="/sbin/udev_run_devd" +# debugging monitor +RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From cfb7ac2b5b3ff38cd9be8a515eaa31696cca7941 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 2 Aug 2005 13:56:41 -0700 Subject: 065 release --- ChangeLog | 15 +++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ce54a817d..bc62f95c61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Summary of changes from v064 to v065 +============================================ + +Greg Kroah-Hartman: + Added persistent name rules for block devices to gentoo rule file. + Added horrible (but fun) path_id script to extras. + Update gentoo rules file. + +Kay Sievers: + update release notes for next version + add udevmonitor, to debug netlink+udev events at the same time + allow RUN to send the environment to a local socket + fix GGC signed pointer warnings and switch volume_id to stdint + + Summary of changes from v063 to v064 ============================================ diff --git a/Makefile b/Makefile index 5eb93bd500..7618d0f7fd 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false -VERSION = 064 +VERSION = 065 ROOT = udev DAEMON = udevd SENDER = udevsend diff --git a/udev.spec b/udev.spec index 2027725674..52bfa2ffae 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace device manager providing devfs functionality Name: udev -Version: 064 +Version: 065 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 47e353f9b9c1a95d4e7cdf0e9be3d746585851f1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Aug 2005 12:24:41 +0200 Subject: add NETLINK define for the lazy distros Signed-off-by: Kay Sievers --- udev_libc_wrapper.h | 4 ++++ udevd.c | 4 ---- udevmonitor.c | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 4bb68913a9..a12af64c24 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -42,6 +42,10 @@ #define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) #endif +#ifndef NETLINK_KOBJECT_UEVENT +#define NETLINK_KOBJECT_UEVENT 15 +#endif + #include #ifdef __KLIBC__ diff --git a/udevd.c b/udevd.c index be401bec30..fa14c56073 100644 --- a/udevd.c +++ b/udevd.c @@ -49,10 +49,6 @@ #include "udevd.h" #include "logging.h" -#ifndef NETLINK_KOBJECT_UEVENT -#define NETLINK_KOBJECT_UEVENT 15 -#endif - /* global variables*/ static int udevd_sock; static int uevent_netlink_sock; diff --git a/udevmonitor.c b/udevmonitor.c index f4f28b1659..51e8a2ab0b 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -33,6 +33,7 @@ #include "udev.h" #include "udevd.h" +#include "udev_libc_wrapper.h" static int uevent_netlink_sock; static int udev_monitor_sock; -- cgit v1.2.3-54-g00ecf From 52dbd80e783adaa0a66d4cf981f5b34d2af66f60 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 4 Aug 2005 16:33:53 -0700 Subject: updated gentoo rule file to handle removable ide devices. Thanks to Kay for the quick fix. Signed-off-by: Greg Kroah-Hartman --- etc/udev/gentoo/udev.rules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 0c96969dbc..d208f5068d 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -245,6 +245,12 @@ KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" # block device disk id's SUBSYSTEM=="block", GROUP="disk", MODE="0640" + +# skip accessing removable ide devices, cause the ide drivers are horrible broken +SUBSYSTEM=="block", BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" +SUBSYSTEM=="block", BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id" + +# persistent disk device links /dev/disk/ KERNEL=="hd*[!0-9]", ACTION=="add", IMPORT="/etc/udev/scripts/ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From 738428b4499211247dafa394805ecaa2cb313f03 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 5 Aug 2005 01:52:57 +0200 Subject: read sysfs attribute also from parent class device Signed-off-by: Kay Sievers --- udev_rules.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/udev_rules.c b/udev_rules.c index 6a485f08af..d86b8e8599 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -295,6 +295,7 @@ static int find_free_number(struct udevice *udev, const char *name) static int find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, const char *name, char *value, size_t len) { + struct sysfs_class_device *class_dev_parent; struct sysfs_attribute *tmpattr; dbg("look for device attribute '%s'", name); @@ -303,6 +304,12 @@ static int find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sys tmpattr = sysfs_get_classdev_attr(class_dev, name); if (tmpattr) goto attr_found; + class_dev_parent = sysfs_get_classdev_parent(class_dev); + if (class_dev_parent) { + tmpattr = sysfs_get_classdev_attr(class_dev_parent, name); + if (tmpattr) + goto attr_found; + } } if (sysfs_device) { dbg("look for devices attribute '%s/%s'", sysfs_device->path, name); -- cgit v1.2.3-54-g00ecf From 13d11705bf0117365afc3f9210f4d568a2baa69c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Aug 2005 02:21:55 +0200 Subject: switch some strlcpy's to memcpy strlcpy counts the sourec string lengt and is therefore not suitable to copy a defined length of characters from one string to another. Signed-off-by: Kay Sievers --- udev.c | 1 + udev_config.c | 3 ++- udev_db.c | 36 ++++++++++++++++++++++++------------ udev_libc_wrapper.c | 3 ++- udev_rules.c | 3 ++- udev_rules_parse.c | 10 +++++++++- 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/udev.c b/udev.c index 2a6e1efc99..6a0beda1c2 100644 --- a/udev.c +++ b/udev.c @@ -131,6 +131,7 @@ int main(int argc, char *argv[], char *envp[]) } } + udev_rules_close(&rules); udev_cleanup_device(&udev); exit: diff --git a/udev_config.c b/udev_config.c index c57e36cd8c..f0b409b067 100644 --- a/udev_config.c +++ b/udev_config.c @@ -137,7 +137,8 @@ static int parse_config_file(void) if (bufline[0] == COMMENT_CHARACTER) continue; - strlcpy(line, bufline, count+1); + memcpy(line, bufline, count); + line[count] = '\0'; linepos = line; retval = get_key(&linepos, &variable, &value); diff --git a/udev_db.c b/udev_db.c index ef0e9a71ae..f9adf5c631 100644 --- a/udev_db.c +++ b/udev_db.c @@ -127,42 +127,49 @@ static int parse_db_file(struct udevice *udev, const char *filename) case 'P': if (count > sizeof(udev->devpath)) count = sizeof(udev->devpath); - strlcpy(udev->devpath, &bufline[2], count-1); + memcpy(udev->devpath, &bufline[2], count-2); + udev->devpath[count-2] = '\0'; break; case 'N': if (count > sizeof(udev->name)) count = sizeof(udev->name); - strlcpy(udev->name, &bufline[2], count-1); + memcpy(udev->name, &bufline[2], count-2); + udev->name[count-2] = '\0'; break; case 'M': if (count > sizeof(line)) count = sizeof(line); - strlcpy(line, &bufline[2], count-1); + memcpy(line, &bufline[2], count-2); + line[count-2] = '\0'; sscanf(line, "%u:%u", &major, &minor); udev->devt = makedev(major, minor); break; case 'S': if (count > sizeof(line)) count = sizeof(line); - strlcpy(line, &bufline[2], count-1); + memcpy(line, &bufline[2], count-2); + line[count-2] = '\0'; name_list_add(&udev->symlink_list, line, 0); break; case 'A': if (count > sizeof(line)) count = sizeof(line); - strlcpy(line, &bufline[2], count-1); + memcpy(line, &bufline[2], count-2); + line[count-2] = '\0'; udev->partitions = atoi(line); break; case 'R': if (count > sizeof(line)) count = sizeof(line); - strlcpy(line, &bufline[2], count-1); + memcpy(line, &bufline[2], count-2); + line[count-2] = '\0'; udev->ignore_remove = atoi(line); break; case 'E': if (count > sizeof(line)) count = sizeof(line); - strlcpy(line, &bufline[2], count-1); + memcpy(line, &bufline[2], count-2); + line[count-2] = '\0'; name_list_add(&udev->env_list, line, 0); break; } @@ -244,16 +251,19 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) case 'P': if (count > sizeof(path)) count = sizeof(path); - strlcpy(path, &bufline[2], count-1); + memcpy(path, &bufline[2], count-2); + path[count-2] = '\0'; break; case 'N': case 'S': if (count > sizeof(nodename)) count = sizeof(nodename); - strlcpy(nodename, &bufline[2], count-1); + memcpy(nodename, &bufline[2], count-2); + nodename[count-2] = '\0'; dbg("compare '%s' '%s'", nodename, name); if (strcmp(nodename, name) == 0) { - strlcpy(devpath, path, len); + memcpy(devpath, &bufline[2], count-2); + devpath[count-2] = '\0'; file_unmap(buf, bufsize); closedir(dir); return 0; @@ -319,12 +329,14 @@ int udev_db_dump_names(int (*handler_function)(const char *path, const char *nam case 'P': if (count > sizeof(path)) count = sizeof(path); - strlcpy(path, &bufline[2], count-1); + memcpy(path, &bufline[2], count-2); + path[count-2] = '\0'; break; case 'N': if (count > sizeof(nodename)) count = sizeof(nodename); - strlcpy(nodename, &bufline[2], count-1); + memcpy(nodename, &bufline[2], count-2); + nodename[count-2] = '\0'; break; default: continue; diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index 1852141c93..4e9f9f1fe8 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -159,7 +159,8 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) if (count >= sizeof(line)) continue; - strlcpy(line, bufline, count); + memcpy(line, bufline, count-1); + line[count-1] = '\0'; pos = line; /* get name */ diff --git a/udev_rules.c b/udev_rules.c index d86b8e8599..d42b219d7d 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -187,7 +187,8 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu if (bufline[0] == COMMENT_CHARACTER) continue; - strlcpy(line, bufline, count+1); + memcpy(line, bufline, count); + line[count] = '\0'; linepos = line; if (get_key(&linepos, &variable, &value) == 0) { diff --git a/udev_rules_parse.c b/udev_rules_parse.c index be0757374e..4580a779c6 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -89,7 +89,7 @@ static int get_key(char **line, char **key, enum key_operation *operation, char char *temp; linepos = *line; - if (!linepos) + if (linepos == NULL && linepos[0] == '\0') return -1; /* skip whitespace */ @@ -97,7 +97,10 @@ static int get_key(char **line, char **key, enum key_operation *operation, char linepos++; /* get the key */ + if (linepos[0] == '\0') + return -1; *key = linepos; + while (1) { linepos++; if (linepos[0] == '\0') @@ -120,6 +123,8 @@ static int get_key(char **line, char **key, enum key_operation *operation, char /* skip whitespace after key */ while (isspace(linepos[0])) linepos++; + if (linepos[0] == '\0') + return -1; /* get operation type */ if (linepos[0] == '=' && linepos[1] == '=') { @@ -152,6 +157,8 @@ static int get_key(char **line, char **key, enum key_operation *operation, char /* skip whitespace after operator */ while (isspace(linepos[0])) linepos++; + if (linepos[0] == '\0') + return -1; /* get the value*/ if (linepos[0] == '"') @@ -634,6 +641,7 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { parse_file(rules, name_loop->name); list_del(&name_loop->node); + free(name_loop); } } -- cgit v1.2.3-54-g00ecf From 63cc8f049100c9b76ca4e37fc5c8976b6e92a207 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Aug 2005 05:07:36 +0200 Subject: allow clean shutdown of udevd Signed-off-by: Kay Sievers --- udev_rules_parse.c | 14 ++++++++------ udevd.c | 30 ++++++++++++++++++++---------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 4580a779c6..cededf002d 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -650,10 +650,12 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) void udev_rules_close(struct udev_rules *rules) { - if (rules->mapped) - file_unmap(rules->buf, rules->bufsize); - else - free(rules->buf); - - rules->buf = NULL; + if (rules->buf) { + if (rules->mapped) { + rules->mapped = 0; + file_unmap(rules->buf, rules->bufsize); + } else + free(rules->buf); + rules->buf = NULL; + } } diff --git a/udevd.c b/udevd.c index fa14c56073..9242acce31 100644 --- a/udevd.c +++ b/udevd.c @@ -58,6 +58,7 @@ static int pipefds[2]; static volatile int sigchilds_waiting; static volatile int run_msg_q; static volatile int sig_flag; +static volatile int udev_exit; static int init_phase = 1; static int run_exec_q; static int stop_exec_q; @@ -641,23 +642,20 @@ static void asmlinkage sig_handler(int signum) switch (signum) { case SIGINT: case SIGTERM: - exit(20 + signum); + udev_exit = 1; break; case SIGALRM: /* set flag, then write to pipe if needed */ run_msg_q = 1; - goto do_write; break; case SIGCHLD: /* set flag, then write to pipe if needed */ sigchilds_waiting = 1; - goto do_write; break; } -do_write: - /* if pipe is empty, write to pipe to force select to return - * immediately when it gets called + /* if pipe is empty, write to pipe to force select to return, + * which will wakeup our mainloop */ if (!sig_flag) { rc = write(pipefds[1],&signum,sizeof(signum)); @@ -839,7 +837,7 @@ int main(int argc, char *argv[], char *envp[]) chdir("/"); umask(umask(077) | 022); - /*set a reasonable scheduling priority for the daemon */ + /* set a reasonable scheduling priority for the daemon */ setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); /* Set fds to dev/null */ @@ -887,6 +885,7 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGTERM, &act, NULL); sigaction(SIGALRM, &act, NULL); sigaction(SIGCHLD, &act, NULL); + sigaction(SIGHUP, &act, NULL); if (init_uevent_netlink_sock() < 0) { dbg("uevent socket not available"); @@ -941,11 +940,11 @@ int main(int argc, char *argv[], char *envp[]) FD_ZERO(&readfds); FD_SET(udevd_sock, &readfds); - if (uevent_netlink_sock != -1) + if (uevent_netlink_sock > 0) FD_SET(uevent_netlink_sock, &readfds); FD_SET(pipefds[0], &readfds); maxsockplus = udevd_sock+1; - while (1) { + while (!udev_exit) { struct uevent_msg *msg; fd_set workreadfds = readfds; @@ -957,6 +956,7 @@ int main(int argc, char *argv[], char *envp[]) continue; } + /* get user socket message */ if (FD_ISSET(udevd_sock, &workreadfds)) { msg = get_udevd_msg(); if (msg) { @@ -970,6 +970,7 @@ int main(int argc, char *argv[], char *envp[]) } } + /* get kernel netlink message */ if (FD_ISSET(uevent_netlink_sock, &workreadfds)) { msg = get_netlink_msg(); if (msg) { @@ -982,9 +983,11 @@ int main(int argc, char *argv[], char *envp[]) } } + /* received a signal, clear our notification pipe */ if (FD_ISSET(pipefds[0], &workreadfds)) user_sighandler(); + /* forked child have returned */ if (sigchilds_waiting) { sigchilds_waiting = 0; reap_sigchilds(); @@ -1009,6 +1012,13 @@ int main(int argc, char *argv[], char *envp[]) } exit: + if (udevd_sock > 0) + close(udevd_sock); + + if (uevent_netlink_sock > 0) + close(uevent_netlink_sock); + logging_close(); - return 1; + + return 0; } -- cgit v1.2.3-54-g00ecf From bfd12948927b84b3ce990403969c1d10081c1fed Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Aug 2005 17:43:42 +0200 Subject: add flag for reading of precompiled rules Rules can be precompiled and stored on disk for initramfs, to avoid parsing the rules with every event again and again. Also the OWNER and GROUP names are already resolved to numerical values in the compiled rules. This flag is used for the upcoming move of the rules parsing into udevd: If the real root is mounted udevd is started and parses the rules only once. The event processes will inherit the already parsed rules from the daemon, so we want to ignore any precompiled rules and use the real rules files and watch the filesystem for changes to reload the rules automatically. Signed-off-by: Kay Sievers --- udev.c | 2 +- udev_rules.h | 2 +- udev_rules_parse.c | 17 ++++++++++------- udevrulescompile.c | 2 +- udevstart.c | 2 +- udevtest.c | 2 +- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/udev.c b/udev.c index 6a0beda1c2..ecfd5644ec 100644 --- a/udev.c +++ b/udev.c @@ -115,7 +115,7 @@ int main(int argc, char *argv[], char *envp[]) } udev_init_device(&udev, devpath, subsystem, action); - udev_rules_init(&rules, 0); + udev_rules_init(&rules, 1, 0); retval = udev_process_event(&rules, &udev); diff --git a/udev_rules.h b/udev_rules.h index 9e3931129f..be13378e4e 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -104,7 +104,7 @@ struct udev_rules { int resolve_names; }; -extern int udev_rules_init(struct udev_rules *rules, int resolve_names); +extern int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_names); extern void udev_rules_close(struct udev_rules *rules); extern void udev_apply_format(struct udevice *udev, char *string, size_t maxsize, diff --git a/udev_rules_parse.c b/udev_rules_parse.c index cededf002d..488b7a7ff0 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -607,7 +607,7 @@ static int rules_map(struct udev_rules *rules, const char *filename) return 0; } -int udev_rules_init(struct udev_rules *rules, int resolve_names) +int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_names) { char comp[PATH_SIZE]; struct stat stats; @@ -617,14 +617,17 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) rules->resolve_names = resolve_names; /* check for precompiled rules */ - strlcpy(comp, udev_rules_filename, sizeof(comp)); - strlcat(comp, ".compiled", sizeof(comp)); - if (stat(comp, &stats) == 0) { - dbg("map compiled rules '%s'", comp); - if (rules_map(rules, comp) == 0) - return 0; + if (read_compiled) { + strlcpy(comp, udev_rules_filename, sizeof(comp)); + strlcat(comp, ".compiled", sizeof(comp)); + if (stat(comp, &stats) == 0) { + dbg("map compiled rules '%s'", comp); + if (rules_map(rules, comp) == 0) + return 0; + } } + /* parse rules file or all matching files in directory */ if (stat(udev_rules_filename, &stats) != 0) return -1; diff --git a/udevrulescompile.c b/udevrulescompile.c index a71286abe7..a2c5f2e9fc 100644 --- a/udevrulescompile.c +++ b/udevrulescompile.c @@ -69,7 +69,7 @@ int main(int argc, char *argv[], char *envp[]) unlink(comp); unlink(comp_tmp); - udev_rules_init(&rules, 1); + udev_rules_init(&rules, 0, 1); f = fopen(comp_tmp, "w"); if (f == NULL) { diff --git a/udevstart.c b/udevstart.c index 5f3ba711f0..4288db9d38 100644 --- a/udevstart.c +++ b/udevstart.c @@ -367,7 +367,7 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timeout to prevent hanging processes */ alarm(UDEV_ALARM_TIMEOUT); - udev_rules_init(&rules, 1); + udev_rules_init(&rules, 0, 1); udev_scan_block(); udev_scan_class(); diff --git a/udevtest.c b/udevtest.c index 4890b6837c..6e973e31e6 100644 --- a/udevtest.c +++ b/udevtest.c @@ -92,7 +92,7 @@ int main(int argc, char *argv[], char *envp[]) info("looking at device '%s' from subsystem '%s'", devpath, subsystem); /* initialize the naming deamon */ - udev_rules_init(&rules, 0); + udev_rules_init(&rules, 0, 0); /* fill in values and test_run flag*/ udev_init_device(&udev, devpath, subsystem, "add"); -- cgit v1.2.3-54-g00ecf From b7299fd904d33bc2d6845be535666b528fd18948 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Aug 2005 11:58:11 +0200 Subject: update distro rules files Signed-off-by: Kay Sievers --- etc/udev/debian/compat-full.rules | 37 ++++++++++++ etc/udev/debian/permissions.rules | 1 + etc/udev/debian/persistent.rules | 49 ++++++++++++++++ etc/udev/debian/run.rules | 1 + etc/udev/redhat/udev.rules | 120 +++++++++++++++++++++++++------------- 5 files changed, 168 insertions(+), 40 deletions(-) create mode 100644 etc/udev/debian/compat-full.rules create mode 100644 etc/udev/debian/persistent.rules diff --git a/etc/udev/debian/compat-full.rules b/etc/udev/debian/compat-full.rules new file mode 100644 index 0000000000..50e24bc64a --- /dev/null +++ b/etc/udev/debian/compat-full.rules @@ -0,0 +1,37 @@ +# compatibility links for a devfs-style /dev + +KERNEL=="md[0-9]*", SYMLINK+="%k" +KERNEL=="loop[0-9]*", SYMLINK+="%k" + +KERNEL=="tty[0-9]*", SYMLINK+="%k" +KERNEL=="ttyS[0-9]*", SYMLINK+="%k" +KERNEL=="ttyUSB[0-9]*", SYMLINK+="%k" + +KERNEL=="vcs", SYMLINK+="%k" +KERNEL=="vcs[0-9]*", SYMLINK+="%k" +KERNEL=="vcsa", SYMLINK+="%k" +KERNEL=="vcsa[0-9]*", SYMLINK+="%k" + +KERNEL=="video*", SYMLINK+="%k" +KERNEL=="radio*", SYMLINK+="%k" +KERNEL=="vbi*", SYMLINK+="%k" +KERNEL=="vtx*", SYMLINK+="%k" + +KERNEL=="apm_bios", SYMLINK+="%k" +KERNEL=="agpgart", SYMLINK+="%k" +KERNEL=="psaux", SYMLINK+="%k" +KERNEL=="nvram", SYMLINK+="%k" +KERNEL=="rtc", SYMLINK+="%k" +KERNEL=="ram[0-9]*", SYMLINK+="%k" + +KERNEL=="i2c-[0-9]*", SYMLINK+="%k" +KERNEL=="lp[0-9]*", SYMLINK+="%k" + +KERNEL=="audio*" SYMLINK+="%k" +KERNEL=="dsp*" SYMLINK+="%k" +KERNEL=="mixer*" SYMLINK+="%k" + +KERNEL=="fb[0-9]*", SYMLINK+="%k" +KERNEL=="fd[0-9]*", SYMLINK+="%k" +KERNEL=="js[0-9]*", SYMLINK+="%k" + diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index aab6fdbd08..52d7aa9536 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -27,6 +27,7 @@ KERNEL=="ptmx", MODE="0666", GROUP="root" KERNEL=="console", MODE="0600", GROUP="root" KERNEL=="tty", MODE="0666", GROUP="root" KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" # video devices SUBSYSTEM=="video4linux", GROUP="video" diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules new file mode 100644 index 0000000000..b444a27bf6 --- /dev/null +++ b/etc/udev/debian/persistent.rules @@ -0,0 +1,49 @@ +# This file contains the rules needed to create persistent device names. + +# we are only interested in add actions for block devices +ACTION!="add", GOTO="no_volume_id" +SUBSYSTEM!="block", GOTO="no_volume_id" + +# and we can safely ignore these kinds of devices +KERNEL=="ram*|loop*|fd*|sr*", GOTO="no_volume_id" + +# disk id +KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" + +KERNEL=="hd*[0-9]", IMPORT{parent}="ID_*" +KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", \ + IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", \ + IMPORT="/sbin/scsi_id -g -x -a -s %p" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +KERNEL=="sd*[0-9]", IMPORT{parent}="ID_*" +KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# path +KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", \ + SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}" + +KERNEL=="*[0-9]", IMPORT{parent}="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ + SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n" + +# volume label and uuid +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" +KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" +KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", \ + SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", \ + SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# end of processing +SUBSYSTEM=="block", LABEL="no_volume_id" + diff --git a/etc/udev/debian/run.rules b/etc/udev/debian/run.rules index 0e28d189be..23fa43c051 100644 --- a/etc/udev/debian/run.rules +++ b/etc/udev/debian/run.rules @@ -3,5 +3,6 @@ KERNEL=="ptmx", OPTIONS+="last_rule" KERNEL=="console", OPTIONS+="last_rule" KERNEL=="tty" , OPTIONS+="last_rule" KERNEL=="tty[0-9]*", OPTIONS+="last_rule" +KERNEL=="pty*", OPTIONS+="last_rule" SUBSYSTEM=="vc", OPTIONS+="last_rule" diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index 5bed782280..0f6e6ffb73 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -1,7 +1,7 @@ # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. # -# default is OWNER="root" GROUP="root", MODE="0660" +# default is OWNER="root" GROUP="root", MODE="0600" # # all block devices @@ -86,14 +86,14 @@ KERNEL=="usblp*", GROUP="lp", MODE="0660" KERNEL=="usb/lp*", GROUP="lp", MODE="0660" # tape devices -KERNEL=="ht*", GROUP="disk", MODE="0640" -KERNEL=="nht*", GROUP="disk", MODE="0640" -KERNEL=="pt[0-9]*", GROUP="disk", MODE="0640" -KERNEL=="npt*", GROUP="disk", MODE="0640" -KERNEL=="st*", GROUP="disk", MODE="0640" -KERNEL=="nst*", GROUP="disk", MODE="0640" -KERNEL=="osst*", GROUP="disk", MODE="0640" -KERNEL=="nosst*", GROUP="disk", MODE="0640" +KERNEL=="ht*", GROUP="disk", MODE="0660" +KERNEL=="nht*", GROUP="disk", MODE="0660" +KERNEL=="pt[0-9]*", GROUP="disk", MODE="0660" +KERNEL=="npt*", GROUP="disk", MODE="0660" +KERNEL=="st*", GROUP="disk", MODE="0660" +KERNEL=="nst*", GROUP="disk", MODE="0660" +KERNEL=="osst*", GROUP="disk", MODE="0660" +KERNEL=="nosst*", GROUP="disk", MODE="0660" # diskonkey devices KERNEL=="diskonkey*", GROUP="disk", MODE="0640" @@ -144,7 +144,7 @@ KERNEL=="dvb/adapter*", MODE="0660" # create a symlink named after the device map name # note devmap_name comes with extras/multipath -#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" +#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" # DRI devices always go into a subdirectory (as per the LSB spec) KERNEL=="card*", NAME="dri/card%n" @@ -166,37 +166,42 @@ KERNEL=="ts*", NAME="input/%k" KERNEL=="raw[0-9]*", NAME="raw/%k" -KERNEL=="lp[0-9]*", SYMLINK="par%n" +KERNEL=="lp[0-9]*", SYMLINK+="par%n" BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" KERNEL=="microcode", NAME="cpu/%k" -KERNEL=="ram1", SYMLINK="ram" -KERNEL=="video0", SYMLINK="video" -KERNEL=="radio0", SYMLINK="radio" -KERNEL=="audio0", SYMLINK="audio" -KERNEL=="dsp0", SYMLINK="dsp" -KERNEL=="fb0", SYMLINK="fb" -KERNEL=="qft0", SYMLINK="ftape" -KERNEL=="isdnctrl0", SYMLINK="isdnctrl" -KERNEL=="mixer0", SYMLINK="mixer" -KERNEL=="ram0", SYMLINK="ramdisk" -KERNEL=="sbpcd0", SYMLINK="sbpcd" -KERNEL=="radio0", SYMLINK="radio" -KERNEL=="tty0", SYMLINK="systty" -KERNEL=="vbi0", SYMLINK="vbi" -KERNEL=="null", SYMLINK="XOR" +# provide symlinks for backwards compatibility +KERNEL="msr[0-9]*", NAME="cpu/%n/msr", SYMLINK+="cpu/%k" +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpu", SYMLINK+="cpu/%k", SYMLINK+="%k" + +KERNEL=="ram1", SYMLINK+="ram" +KERNEL=="video0", SYMLINK+="video" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="audio0", SYMLINK+="audio" +KERNEL=="dsp0", SYMLINK+="dsp" +KERNEL=="fb0", SYMLINK+="fb" +KERNEL=="qft0", SYMLINK+="ftape" +KERNEL=="isdnctrl0", SYMLINK+="isdnctrl" +KERNEL=="mixer0", SYMLINK+="mixer" +KERNEL=="ram0", SYMLINK+="ramdisk" +KERNEL=="sbpcd0", SYMLINK+="sbpcd" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="tty0", SYMLINK+="systty" +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="null", SYMLINK+="XOR" KERNEL=="tun", NAME="net/%k" KERNEL=="device-mapper", NAME="mapper/control" # old compat symlinks with enumeration -KERNEL=="sr[0-9]*", SYMLINK="cdrom%e" -KERNEL=="scd[0-9]*", SYMLINK="cdrom%e" -KERNEL=="pcd[0-9]*", SYMLINK="cdrom%e" -KERNEL=="fd[0-9]*", SYMLINK="floppy%e" -KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK="tape%e" -KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK="tape%e" +KERNEL=="sr[0-9]*", SYMLINK+="cdrom%e" +KERNEL=="scd[0-9]*", SYMLINK+="cdrom%e" +KERNEL=="pcd[0-9]*", SYMLINK+="cdrom%e" +KERNEL=="fd[0-9]*", SYMLINK+="floppy%e" +KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK+="tape%e", MODE="0660" +KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK+="tape%e", MODE="0660" +KERNEL=="sg[0-9]*", BUS="scsi", SYSFS{type}=="6", SYMLINK+="scanner%e", MODE="0660" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" @@ -208,22 +213,57 @@ KERNEL=="zapchannel", NAME="zap/channel" KERNEL=="zappseudo", NAME="zap/pseudo" KERNEL=="zap[0-9]*", NAME="zap/%n" +BUS=="scsi", KERNEL=="sg[0-9]*", SYSFS{type}=="6", NAME="%k", SYMLINK="scanner%e", MODE="0660" + # do not seperate the next 2 lines!! -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/ide-media.sh %k", RESULT=="floppy", SYMLINK="floppy%e", NAME{ignore_remove, all_partitions}="%k" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/ide-media.sh %k", RESULT=="floppy", SYMLINK+="floppy%e", NAME{ignore_remove, all_partitions}="%k" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", RESULT=="cdrom", SYMLINK="cdrom%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", RESULT=="cdrom", SYMLINK+="cdrom%e" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK="dvd%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK="dvd%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK+="dvd%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK+="dvd%e" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK="cdwriter%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK="cdwriter%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK="dvdwriter%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" # rename sr* to scd* KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n" KERNEL=="hd[a-z]*", BUS=="ide", SYSFS{removable}=="1", NAME{ignore_remove}="%k" KERNEL=="dvb*", PROGRAM=="/etc/udev/scripts/dvb.sh %k", NAME="%c" + + +# Perhaps this should just be for all subsystems? + +ACTION=="add", SUBSYSTEM=="pci", MODALIAS=="*", \ + RUN+="/sbin/modprobe $modalias" +ACTION=="add", SUBSYSTEM=="usb", MODALIAS=="*", \ + RUN+="/sbin/modprobe $modalias" +ACTION=="add", SUBSYSTEM=="pcmcia", MODALIAS=="*", \ + RUN+="/sbin/modprobe $modalias" +ACTION=="add", SUBSYSTEM=="pcmcia", MODALIAS=="*", \ + RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" + +ACTION=="add", SUBSYSTEM=="ieee1394", MODALIAS=="*", \ + RUN+="/sbin/modprobe $modalias" + +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[07]", \ + RUN+="/sbin/modprobe sd_mod" +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="14", \ + RUN+="/sbin/modprobe sd_mod" +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[45]", \ + RUN+="/sbin/modprobe sr_mod" +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="Onstream", \ + SYSFS{model}!="ADR*", RUN+="/sbin/modprobe osst" +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="Onstream", \ + SYSFS{model}=="ADR*", RUN+="/sbin/modprobe st" +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}!="Onstream", \ + RUN+="/sbin/modprobe st" +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[23689]", \ + RUN+="/sbin/modprobe sg" + +ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}="*", \ + RUN+="/sbin/firmware_helper" -- cgit v1.2.3-54-g00ecf From 80489e6395581911c35104f3fc11bfe62a0b785a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Aug 2005 12:29:12 +0200 Subject: add SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/50-udev.rules | 257 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 257 insertions(+) create mode 100644 etc/udev/suse/50-udev.rules diff --git a/etc/udev/suse/50-udev.rules b/etc/udev/suse/50-udev.rules new file mode 100644 index 0000000000..63be8812b1 --- /dev/null +++ b/etc/udev/suse/50-udev.rules @@ -0,0 +1,257 @@ +# console +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="console", NAME="%k", MODE="600" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666" + +# serial devices +KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" +KERNEL=="pppox*", NAME="%k", GROUP="uucp" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp" +KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" +KERNEL=="hvc*", NAME="%k", GROUP="uucp" +KERNEL=="hvsi*", NAME="%k", GROUP="uucp" +KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" + +# video/graphics +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="graphics" GROUP="video" +KERNEL=="video*", NAME="%k", GROUP="video" +KERNEL=="vtx*", NAME="%k", GROUP="video" +KERNEL=="vbi*", NAME="%k", GROUP="video" +KERNEL=="winradio*", NAME="%k", GROUP="video" +KERNEL=="vttuner*", NAME="%k", GROUP="video" +KERNEL=="nvidia*", NAME="%k", GROUP="video" +KERNEL=="nvidiactl*", NAME="%k", GROUP="video" + +# dvb +KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video" + +# ALSA/sound +SUBSYSTEM="sound", GROUP="audio" +SUBSYSTEM="snd", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8000/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us428fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8004/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us224fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8006/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us122fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8001/*", RUN+="/sbin/startproc /usr/bin/us428control" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startproc /usr/bin/us428control" +SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" +SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/dev.d/snd/hwC0D2/alsa" + +# OpenCT (SmartCard) +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="973/1*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="529/50c*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="529/514*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="73d/5*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b9/1200*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b9/1300*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="76b/596*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="76b/1784*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="8d4/9*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{INTERFACE}=="11/*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" + +# CAPI devices +SUBSYSTEM="capi", GROUP="dialout" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# ISDN +KERNEL=="isdn*", NAME="%k", MODE="600" +KERNEL=="isdnctrl*", NAME="%k", MODE="600" +KERNEL=="ippp*", NAME="%k", MODE="600" +KERNEL=="isdninfo*", NAME="%k", MODE="444" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/c00*", IMPORT="/bin/echo 'DRV=fcusb'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/1000*", IMPORT="/bin/echo -e 'DRV=fcusb2\nFIRMWARE=fus2base.frm'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/1900*", IMPORT="/bin/echo -e 'DRV=fcusb2\nFIRMWARE=fus3base.frm'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2000*", IMPORT="/bin/echo DRV=fxusb", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2200*", IMPORT="/bin/echo DRV=bfusb", RUN+="/etc/sysconfig/isdn/scripts/load-bfusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2300*", IMPORT="/bin/echo -e 'DRV=fcdslusb\nFIRMWARE=fdsubase.frm\nDSL_CONTR=dslisdn'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2800*", IMPORT="/bin/echo DRV=fxusb_CZ", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3000*", IMPORT="/bin/echo -e 'DRV=fcdslusba\nFIRMWARE=fdsabase.frm\nDSL_CONTR=dslonly\nISDNLOG_START=no'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3500*", IMPORT="/bin/echo -e 'DRV=fcdslslusb\nFIRMWARE=fdlubase.frm\nDSL_CONTR=dslonly\nISDNLOG_START=no'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3600*", IMPORT="/bin/echo -e 'DRV=fcdslusb2\nFIRMWARE=fds2base.frm\nDSL_CONTR=dslisdn'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2805*", IMPORT="/bin/echo 'DRV=e2220pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2806*", IMPORT="/bin/echo 'DRV=e5520pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/4401*", IMPORT="/bin/echo 'DRV=e2220pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/4601*", IMPORT="/bin/echo 'DRV=e5520pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="483/4810*", IMPORT="/bin/echo 'DRV=hisax_st5481'", RUN+="/etc/sysconfig/isdn/scripts/load-hisaxusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="959/2bd0*", IMPORT="/bin/echo 'DRV=hfc_usb'", RUN+="/etc/sysconfig/isdn/scripts/load-hisaxusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="9bf/*", IMPORT="/bin/echo 'DRV=auerswald'", RUN+="/etc/sysconfig/isdn/scripts/load-auerswald" + +# input devices +KERNEL=="mice", NAME="input/%k", MODE="0640" +KERNEL=="mouse*", NAME="input/%k", MODE="0640" +KERNEL=="event*", NAME="input/%k", MODE="0640" +KERNEL=="js*", NAME="input/%k", MODE="0644" +KERNEL=="ts*", NAME="input/%k", MODE="0600" +KERNEL=="uinput", NAME="input/%k", MODE="0600" +KERNEL=="event*", PROGRAM="/sbin/udev.get_input_lirc.sh %k", RESULT="*IR*", NAME="input/%k", SYMLINK+="input/ir" +KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" +SUBSYSTEM=="input_device", RUN+="/etc/hotplug.d/input_device/50-input_device.hotplug" + +# printer +SUBSYSTEM=="usb", KERNEL=="lp*", ACTION=="add", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", ACTION=="add", NAME="%k", GROUP="lp" +KERNEL=="irlpt*", NAME="%k", GROUP="lp" + +# cpu devices +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# IEEE1394 devices +KERNEL=="raw1394*", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" + +# 183 = /dev/hwrng Generic random number generator +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +# 219 /dev/modems/mwave MWave modem firmware upload +KERNEL=="mwave", NAME="modems/%k" +# 169 /dev/specialix_rioctl Specialix RIO serial control +KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" +# 167 /dev/specialix_sxctl Specialix serial control +KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" + +# misc devices +KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="nvram", NAME="%k", GROUP="kmem" +KERNEL=="null", NAME="%k", MODE="666" +KERNEL=="zero", NAME="%k", MODE="666" +KERNEL=="full", NAME="%k", MODE="622" +KERNEL=="random", NAME="%k", MODE="666" +KERNEL=="urandom", NAME="%k", MODE="644" +KERNEL=="rtc", GROUP="audio" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", MODE="0600", GROUP="video" +KERNEL=="djs*", NAME="%k", MODE="644" +KERNEL=="sgi_*", NAME="%k", MODE="666" +KERNEL=="rrom*", NAME="%k", MODE="400" +KERNEL=="rflash*", NAME="%k", MODE="400" +KERNEL=="usbscanner*", NAME="%k", MODE="644" +KERNEL=="3270/ttycons*", NAME="%k", MODE="600" +KERNEL=="3270/tub*", NAME="%k", MODE="666" +KERNEL=="3270/tubcons*", NAME="%k", MODE="600" +KERNEL=="ica", NAME="%k", MODE="666" +KERNEL=="z90crypt", NAME="%k", MODE="666" +KERNEL=="mmtimer", NAME="%k", MODE="444" + +# fix floppy devices +KERNEL=="nvram", ACTION=="add", NAME="%k", MODE="600", RUN="/sbin/load_floppy_module" +KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN="/sbin/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd*", ACTION=="remove", RUN="/sbin/remove_floppy_devices /dev/%k" + +# block devices +SUBSYSTEM=="block", GROUP="disk", MODE="0640" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[345]", RUN+="/sbin/modprobe sr_mod" + +# misc storage devices (non-block) +KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" +KERNEL=="st*", NAME="%k", GROUP="disk" +KERNEL=="nst*", NAME="%k", GROUP="disk" +KERNEL=="initrd", NAME="%k", GROUP="disk" +KERNEL=="qft*", NAME="%k", GROUP="disk" +KERNEL=="nqft*", NAME="%k", GROUP="disk" +KERNEL=="zqft*", NAME="%k", GROUP="disk" +KERNEL=="nzqft*", NAME="%k", GROUP="disk" +KERNEL=="rawqft*", NAME="%k", GROUP="disk" +KERNEL=="nrawqft*", NAME="%k", GROUP="disk" +KERNEL=="pf*", NAME="%k", GROUP="disk" +KERNEL=="sch*", NAME="%k", GROUP="disk" +KERNEL=="pt*", NAME="%k", GROUP="disk" +KERNEL=="npt*", NAME="%k", GROUP="disk" +KERNEL=="pg*", NAME="%k", GROUP="disk" +KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" +KERNEL=="rawctl*", NAME="%k", GROUP="disk" +KERNEL=="osst*", NAME="%k", GROUP="disk" +KERNEL=="nosst*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" + +# device mapper targets +KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control" +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/udev.devmap_name.sh %M %m | /bin/sed 's.--._.;s.-./.;s._.-.'", SYMLINK+="%c" +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/udev.devmap_name.sh %M %m", NAME="mapper/%c" + +# persistent disk device links /dev/disk/ +# skip rules for for ram/loop/fd +SUBSYSTEM=="block", KERNEL=="ram*|loop*|fd*", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" +ACTION!="add", GOTO="persistent_end" + +# never access removable ide devices, the drivers are causing event loops on open() +SUBSYSTEM=="block", BUS=="ide", SYSFS{removable}="1", GOTO="persistent_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +KERNEL=="dasd*[!0-9]", IMPORT="/sbin/dasd_id --export $tempnode" +KERNEL=="dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +KERNEL=="sr*", GOTO="persistent_end" +KERNEL=="*[0-9]", ACTION=="add", IMPORT="/sbin/vol_id --export $tempnode" +KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +LABEL="persistent_end" + +# network devices +KERNEL=="tun", NAME="net/%k", MODE="0600" +SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug" +SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" + +# mount usbfs +DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb" + +# firmware loader +SUBSYSTEM=="firmware", ACTION=="add", RUN+="/etc/hotplug.d/firmware/50-firmware.hotplug" + +# SUSE system integration +SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" +SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-/sys%p -o hotplug" +SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-/sys%p -o hotplug" +SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-/sys%p -o hotplug" +SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-/sys%p -o hotplug" +SUBSYSTEM=="scsi", DEVPATH=="/devices/css*", ACTION=="remove", RUN+="/sbin/hwdown scsi-devpath-/sys%p -o hotplug" +SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{device/cutype}=="*", RUN+="/sbin/hwup scsi__host-devpath-/sys%p -o hotplug" + +# default +RUN+="/usr/sbin/hal.hotplug" +RUN+="socket:/org/kernel/udev/monitor" + +# debug events to /events, but not on default udev_log="err" +ENV{UDEV_LOG}=="[4567]", RUN+="/sbin/hotplugeventrecorder" + -- cgit v1.2.3-54-g00ecf From 1bcac4e483ace30b90b79a14b2f4c75d4f7ab3bc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Aug 2005 15:53:17 +0200 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/50-udev.rules | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/etc/udev/suse/50-udev.rules b/etc/udev/suse/50-udev.rules index 63be8812b1..be5a2478ba 100644 --- a/etc/udev/suse/50-udev.rules +++ b/etc/udev/suse/50-udev.rules @@ -191,7 +191,6 @@ KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/udev.devmap_name.sh %M %m", N # persistent disk device links /dev/disk/ # skip rules for for ram/loop/fd SUBSYSTEM=="block", KERNEL=="ram*|loop*|fd*", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" ACTION!="add", GOTO="persistent_end" # never access removable ide devices, the drivers are causing event loops on open() @@ -202,11 +201,13 @@ KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" @@ -223,7 +224,8 @@ KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PA # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" KERNEL=="sr*", GOTO="persistent_end" -KERNEL=="*[0-9]", ACTION=="add", IMPORT="/sbin/vol_id --export $tempnode" +SUBSYSTEM!="block", GOTO="persistent_end" +KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="persistent_end" @@ -253,5 +255,5 @@ RUN+="/usr/sbin/hal.hotplug" RUN+="socket:/org/kernel/udev/monitor" # debug events to /events, but not on default udev_log="err" -ENV{UDEV_LOG}=="[4567]", RUN+="/sbin/hotplugeventrecorder" +ENV{UDEV_LOG}=="[4-9]", RUN+="/sbin/hotplugeventrecorder" -- cgit v1.2.3-54-g00ecf From bebbc31b90056f5b0eafb52fc965f0cc713f0d4f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Aug 2005 19:00:37 +0200 Subject: add firmware_helper to load firmware From: Bill Nottingham Changed reading of firmware blob to mmap and let firmware_helper follow the setting of the log level with UDEV_LOG. --- extras/firmware/Makefile | 51 +++++++++++++ extras/firmware/firmware_helper.c | 147 ++++++++++++++++++++++++++++++++++++++ logging.h | 2 +- test/simple-build-check.sh | 3 +- 4 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 extras/firmware/Makefile create mode 100644 extras/firmware/firmware_helper.c diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile new file mode 100644 index 0000000000..6417bbf185 --- /dev/null +++ b/extras/firmware/Makefile @@ -0,0 +1,51 @@ +# Makefile for usb_id +# +# Copyright (C) 2005 Kay Sievers +# +# 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. +# + +PROG = firmware_helper + +all: $(PROG) + +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin +mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +OBJS = $(PROG).o $(VOLUME_ID_OBJS) ../../udev.a ../../libsysfs/sysfs.a +HEADERS = + +$(OBJS): $(HEADERS) + +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + +$(PROG): $(OBJS) $(HEADERS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + +install: all + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + +uninstall: + - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/firmware/firmware_helper.c b/extras/firmware/firmware_helper.c new file mode 100644 index 0000000000..283ea9f76f --- /dev/null +++ b/extras/firmware/firmware_helper.c @@ -0,0 +1,147 @@ +/* + * A simple firmware helper program. + * + * Copyright 2005 Red Hat, Inc. + * + * This software may be freely redistributed under the terms of the GNU + * public license. + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../udev_utils.h" +#include "../../logging.h" + +#define FIRMWARE_PATH "/lib/firmware" +#define PATH_SIZE 256 + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +/* Set the 'loading' attribute for a firmware device. + * 1 == currently loading + * 0 == done loading + * -1 == error + */ +static int set_loading(const char *device, int value) { + char loading_path[PATH_SIZE]; + int rc; + FILE *f; + + snprintf(loading_path, sizeof(loading_path), "/sys/%s/loading", device); + loading_path[sizeof(loading_path)-1] = '\0'; + f = fopen(loading_path, "w"); + if (!f) + return -1; + rc = fprintf(f, "%d", value); + fclose(f); + if (rc < 0) + return rc; + return 0; +} + +int main(int argc, char **argv) { + char *devpath, *firmware, *action, *driver; + char fw_path[PATH_SIZE]; + char data_path[PATH_SIZE]; + int fw_fd; + char *fw_buffer; + size_t fw_buffer_size; + size_t count; + int rc = 0; + + logging_init("firmware_helper"); + + driver = getenv("PHYSDEVDRIVER"); + if (!driver) + driver = "(unknown)"; + devpath = getenv("DEVPATH"); + firmware = getenv("FIRMWARE"); + action = getenv("ACTION"); + if (!devpath || !firmware || !action || strcmp(action,"add") != 0) { + err("missing devpath, action or firmware"); + exit(1); + } + + dbg("try to load firmware '%s' for '%s'", firmware, devpath); + set_loading(devpath, 1); + + snprintf(fw_path, sizeof(fw_path), "%s/%s", FIRMWARE_PATH, firmware); + fw_path[sizeof(fw_path)-1] = '\0'; + if (file_map(fw_path, &fw_buffer, &fw_buffer_size) != 0 || fw_buffer_size == 0) { + err("could not load firmware '%s' for '%s'", fw_path, devpath); + fw_buffer = NULL; + goto out_err; + } + + snprintf(data_path, sizeof(data_path), "/sys/%s/data", devpath); + fw_path[sizeof(data_path)-1] = '\0'; + fw_fd = open(data_path, O_RDWR); + if (fw_fd < 0) { + rc = errno; + goto out_err; + } + + count = 0; + while (count < fw_buffer_size) { + int c; + + c = write(fw_fd, fw_buffer+count, fw_buffer_size); + if (c <= 0) { + rc = errno; + close(fw_fd); + goto out_err; + } + count += c; + } + + close(fw_fd); + file_unmap(fw_buffer, fw_buffer_size); + set_loading(devpath, 0); + info("loaded '%s' for device '%s'", fw_path, devpath); + logging_close(); + return 0; + +out_err: + if (fw_buffer) + file_unmap(fw_buffer, fw_buffer_size); + set_loading(devpath, -1); + + err("error loading '%s' for device '%s' with driver '%s'", fw_path, devpath, driver); + logging_close(); + return rc; +} diff --git a/logging.h b/logging.h index 904355cb2c..0126de99eb 100644 --- a/logging.h +++ b/logging.h @@ -38,7 +38,7 @@ #undef err #define err(format, arg...) \ do { \ - log_message(LOG_INFO ,"%s: " format ,__FILE__ ,## arg); \ + log_message(LOG_ERR ,"%s: " format ,__FILE__ ,## arg); \ } while (0) #undef info diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 742b28ec1c..521691618a 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -8,7 +8,8 @@ EXTRAS="\ extras/usb_id \ extras/dasd_id \ extras/floppy \ - extras/run_directory" + extras/run_directory \ + extras/firmware" [ -z "$KERNEL_DIR" ] && KERNEL_DIR=/lib/modules/`uname -r`/build echo KERNEL_DIR: "$KERNEL_DIR" -- cgit v1.2.3-54-g00ecf From 6214290df56de85772bdd62f8f646863306b39f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Aug 2005 19:17:25 +0200 Subject: more distro rules updates Signed-off-by: Kay Sievers --- RELEASE-NOTES | 6 + etc/udev/slackware/udev.permissions | 133 ------------------- etc/udev/slackware/udev.rules | 248 ++++++++++++++++++++++++++++++++++++ etc/udev/suse/50-udev.rules | 4 +- etc/udev/udev.permissions | 10 -- extras/firmware/Makefile | 2 +- 6 files changed, 257 insertions(+), 146 deletions(-) delete mode 100644 etc/udev/slackware/udev.permissions create mode 100644 etc/udev/slackware/udev.rules delete mode 100644 etc/udev/udev.permissions diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 09d29c8b0a..91cef0ccd4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,9 @@ +udev 066 +======== +Minor bugfixes and some distro rules updates. If you don't have the +persistent disk rules in /dev/disk/by-*/* on your distro, just +grab it from here. :) + udev 065 ======== We can use socket communication now to pass events from udev to diff --git a/etc/udev/slackware/udev.permissions b/etc/udev/slackware/udev.permissions deleted file mode 100644 index 2edc1aaa53..0000000000 --- a/etc/udev/slackware/udev.permissions +++ /dev/null @@ -1,133 +0,0 @@ -#name:user:group:mode -pl2303:500:500:0666 -visor:root:uucp:0666 -camera*:500:500:0666 - -# console devices -console:root:tty:0600 -tty[0-9][0-9]*:root:tty:0666 -vcs*:root:tty:0620 -tty[CIS]*:root:uucp:0660 -ttyUB[0-9]:root:uucp:0660 -ttyUSB0:root:uucp:0660 -ttyUSB1:root:uucp:0666 - -# pty devices -ptmx:root:tty:0666 -pty[p-za-e][0-9a-f]*:root:tty:0666 -tty[p-za-e][0-9a-f]*:root:tty:0666 -cu[abiu]*:root:uucp:0660 - -# sound devices -audio*:root:sys:0662 -beep:root:root:0644 -dsp*:root:sys:0662 -midi*:root:sys:0662 -mixer*:root:sys:0666 -music:root:sys:0662 -sequencer*:root:sys:0662 -snd/*:root:root:0666 -sndstat:root:sys:0662 -speaker:root:root:0644 -sound/*:root:root:0666 -admmidi*:root:root:0666 -adsp*:root:root:0666 -aload*:root:root:0666 -amidi*:root:root:0666 -amixer*:root:root:0666 - -# input devices (mouse, joystick, etc) -input/*:root:root:0644 -input/js*:root:games:0666 -djs[0-3]:root:games:0660 -psaux:root:sys:0660 -crash:roor:root:0660 -logibm:root:sys:0660 -jbm:root:sys:0660 -hwtrap:root:root:0644 -inportbm:root:sys:0660 -sexec:root:root:0660 -jsflash:roo:root:0660 - -# power manager device -apm_bios:root:root:0644 - -# printer device -lp[0-9]:root:lp:0660 -parport*:root:root:0660 - -# video devices -dri/card[0-9]*:root:root:0666 -fb[0-9]:root:tty:0660 -agpgart:root:root:0660 -nvidia*:root:root:0666 -video*:root:sys:0660 - -# DISK devices -ed[ab]*:root:disk:0640 -gscd0:root:disk:0640 -initrd:root:disk:0640 -lmscd:root:disk:0640 -mcd*:root:disk:0640 -md*:root:disk:0660 -mtd*:root:disk:0640 -userdma:root:root:0660 - -# floppy devices -fd[0-3]*:root:floppy:0660 - -# IDE devices (hd, cdrom) -hd*:root:disk:0660 -ht0:root:disk:0640 - -# RAID IDE -ataraid[0-9]*:root:disk:0660 -ataraid/*:root:disk:0660 - -# SCSI devices -scsi/*/cd:root:disk:0660 -scsi/*:root:disk:0660 -sd[a-h]*:root:disk:0640 -s[rt][0-9]*:root:disk:0640 -scd*:root:disk:0660 - -# generic scsi devices -sg*:root:root:0600 - -# old CD-ROM -sbpcd*:root:disk:0640 - -# loop devices -loop[0-9]*:root:disk:0660 - -# network block devices -nb[0-7]:root:disk:0660 -nht0:root:disk:0640 -npt[0-3]:root:disk:0660 -n[qrs]*:root:disk:0640 - -# memory access devices -kmem:root:kmem:0640 -mem:root:kmem:0640 -null:root:sys:0666 -nvram:root:root:0640 -port:root:kmem:0640 -ram[0-9]*:root:disk:0640 -random:root:root:0644 -rtc:root:root:0444 -urandom:root:root:0644 -full:root:sys:0666 -zero:root:root:0664 -raw/*:root:disk:0660 -modreq:root:root:0644 -msr:root:root:0660 -profile*:root:root:0640 - -# ISDN devices -isdn*:root:tty:0660 - -# net devices -ippp*:root:root:0644 -ipstate:root:root:0660 -spx:root:root:0644 -fwmonitor:root:root:0660 diff --git a/etc/udev/slackware/udev.rules b/etc/udev/slackware/udev.rules new file mode 100644 index 0000000000..ac43657cc6 --- /dev/null +++ b/etc/udev/slackware/udev.rules @@ -0,0 +1,248 @@ +# /etc/udev/udev.rules: device naming rules for udev +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. + +# all block devices +SUBSYSTEM="block", GROUP="disk" + +### cdrom symlinks and other good cdrom naming +##BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +##BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +##BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +## +### devfs-names for ide-devices (uncomment only one) +### /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names +##BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" + +# permissions for IDE CD devices +BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", GROUP="cdrom", MODE="0660" + +# permissions for IDE floppy devices +BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", NAME="%k", GROUP="floppy", MODE="0660" + +# permissions for SCSI cd/sg/tape devices +BUS="scsi", KERNEL="s[grt][0-9]*", SYSFS_type="5", NAME="%k", GROUP="cdrom", MODE="0660" + +# disk devices +KERNEL="sd*", NAME="%k", GROUP="disk" +KERNEL="dasd*", NAME="%k", GROUP="disk" +KERNEL="ataraid*", NAME="%k", GROUP="disk" + +# DRI devices +KERNEL="card*", NAME="dri/card%n", GROUP="video" +KERNEL="nvidia*", NAME="%k", GROUP="video" +KERNEL="3dfx*", NAME="%k", GROUP="video" + +# ALSA devices +SUBSYSTEM="sound", GROUP="audio" +KERNEL="controlC[0-9]*", NAME="snd/%k", MODE="0666" +KERNEL="hw[CD0-9]*", NAME="snd/%k", MODE="0662" +KERNEL="pcm[CD0-9]*c", NAME="snd/%k", MODE="0662" +KERNEL="pcm[CD0-9]*p", NAME="snd/%k", MODE="0666" +KERNEL="midiC[D0-9]*", NAME="snd/%k", MODE="0666" +KERNEL="timer", NAME="snd/%k", MODE="0666" +KERNEL="seq", NAME="snd/%k", MODE="0666" + +# capi devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi*", NAME="capi/%n" + +# cpu devices +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL="microcode", NAME="cpu/microcode" + +# dm devices (ignore them) +KERNEL="dm-[0-9]*", NAME="" +# create a symlink named after the device map name +# note devmap_name comes with extras/multipath +#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" +KERNEL="device-mapper", NAME="mapper/control" + +# fb devices +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video" + +# floppy devices +KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy", PROGRAM="/etc/udev/scripts/floppy-extra-devs.sh %k %b %n" + +# i2c devices +KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" + +# input devices +KERNEL="mice", NAME="input/%k", MODE="0644" +KERNEL="mouse*", NAME="input/%k", MODE="0644" +KERNEL="event*", NAME="input/%k", MODE="0600" +KERNEL="js*", NAME="input/%k", MODE="664" +KERNEL="ts*", NAME="input/%k", MODE="0600" + +# loop devices +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k", GROUP="disk" + +# md block devices +KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k", GROUP="disk" + +# aoe char devices, +SUBSYSTEM="aoe", KERNEL="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM="aoe", KERNEL="err", NAME="etherd/%k", GROUP="disk", MODE="0440" +SUBSYSTEM="aoe", KERNEL="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" + +# misc devices +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k", MODE="0664" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" +KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666" + +# netlink devices +KERNEL="route", NAME="netlink/%k" +KERNEL="skip", NAME="netlink/%k" +KERNEL="usersock", NAME="netlink/%k" +KERNEL="fwmonitor", NAME="netlink/%k" +KERNEL="tcpdiag", NAME="netlink/%k" +KERNEL="nflog", NAME="netlink/%k" +KERNEL="xfrm", NAME="netlink/%k" +KERNEL="arpd", NAME="netlink/%k" +KERNEL="route6", NAME="netlink/%k" +KERNEL="ip6_fw", NAME="netlink/%k" +KERNEL="dnrtmsg", NAME="netlink/%k" +KERNEL="tap*", NAME="netlink/%k" + +# network devices +KERNEL="tun", NAME="net/%k" + +# ramdisk devices +KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" + +# raw devices +KERNEL="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL="ram*", NAME="%k", GROUP="disk" + +# sound devices +KERNEL="adsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL="audio", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL="dsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL="mixer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" + +# tty devices +KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" +KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" +KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty" +KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0600" +KERNEL="ippp0", NAME="%k", GROUP="tty" +KERNEL="isdn*", NAME="%k", GROUP="tty" +KERNEL="dcbri*", NAME="%k", GROUP="tty" +KERNEL="ircomm*", NAME="%k", GROUP="tty" + +# pty devices +KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" +KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k", GROUP="tty" +KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k", GROUP="tty" + +# vc devices +KERNEL="vcs", NAME="vcc/0", SYMLINK="%k", GROUP="tty" +KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k", GROUP="tty" +KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k", GROUP="tty" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k", GROUP="tty" + +# memory devices +KERNEL="random", NAME="%k", MODE="0664" +KERNEL="urandom", NAME="%k", MODE="0664" +KERNEL="mem", NAME="%k", GROUP="kmem", MODE="0640" +KERNEL="kmem", NAME="%k", GROUP="kmem", MODE="0640" +KERNEL="port", NAME="%k", GROUP="kmem", MODE="0640" +KERNEL="full", NAME="%k", MODE="0666" +KERNEL="null", NAME="%k", MODE="0666" +KERNEL="zero", NAME="%k", MODE="0666" + +# usb devices +KERNEL="hiddev*", NAME="usb/%k" +KERNEL="auer*", NAME="usb/%k" +KERNEL="legousbtower*", NAME="usb/%k" +KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k", GROUP="lp" + +# v4l devices +KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n", GROUP="video" +KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="video" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" + +# dvb devices +KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video", MODE="0660" + +# Asterix Zaptel devices +KERNEL="zapctl", NAME="zap/ctl" +KERNEL="zaptimer", NAME="zap/timer" +KERNEL="zapchannel", NAME="zap/channel" +KERNEL="zappseudo", NAME="zap/pseudo" +KERNEL="zap[0-9]*", NAME="zap/%n" + +# pilot/palm devices +KERNEL="pilot", NAME="%k", GROUP="uucp" + +# jaz devices +KERNEL="jaz*", NAME="%k", GROUP="disk" + +# zip devices +KERNEL="pocketzip*", NAME="%k", GROUP="disk" +KERNEL="zip*", NAME="%k", GROUP="disk" + +# ls120 devices +KERNEL="ls120", NAME="%k", GROUP="disk" + +# lp devices +KERNEL="lp*", NAME="%k", GROUP="lp" +KERNEL="irlpt", NAME="%k", GROUP="lp" +KERNEL="usblp", NAME="%k", GROUP="lp" +KERNEL="lp*", NAME="%k", GROUP="lp" + +# tape devices +KERNEL="ht*", NAME="%k" +KERNEL="nht*", NAME="%k" +KERNEL="pt*", NAME="%k" +KERNEL="npt*", NAME="%k" +KERNEL="st*", NAME="%k" +KERNEL="nst*", NAME="%k" +KERNEL="osst*", NAME="%k" +KERNEL="nosst*", NAME="%k" + +# diskonkey devices +KERNEL="diskonkey*", NAME="%k", GROUP="disk" + +# rem_ide devices +KERNEL="microdrive*", NAME="%k", GROUP="disk" + +# kbd devices +KERNEL="kbd", NAME="%k", MODE="0664" + +# Sony Vaio Jogdial sonypi device +KERNEL="sonypi", NAME="%k", MODE="0666" + +# packet devices +KERNEL="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom", MODE="0660" +KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrom", MODE="0660" + +# infiniband devices +KERNEL="umad*", NAME="infiniband/%k" +KERNEL="issm*", NAME="infiniband/%k" + +## These lines are causing race conditions with the symlink to udevstart in +## /etc/hotplug.d/default/, so they are being commented out for now. Udev +## seems to work better that way... YMMV. +# +## be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/. +## systems run /etc/hotplug.d/ stuff only if we came from a hotplug event, +## not for udevstart +#ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" +# +## always run /etc/dev.d/ stuff for now +#RUN+="/sbin/udev_run_devd" + diff --git a/etc/udev/suse/50-udev.rules b/etc/udev/suse/50-udev.rules index be5a2478ba..515b572e75 100644 --- a/etc/udev/suse/50-udev.rules +++ b/etc/udev/suse/50-udev.rules @@ -185,7 +185,6 @@ KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" # device mapper targets KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control" -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/udev.devmap_name.sh %M %m | /bin/sed 's.--._.;s.-./.;s._.-.'", SYMLINK+="%c" KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/udev.devmap_name.sh %M %m", NAME="mapper/%c" # persistent disk device links /dev/disk/ @@ -235,8 +234,9 @@ KERNEL=="tun", NAME="net/%k", MODE="0600" SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug" SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" -# mount usbfs +# libusb device access (mount usbfs or usbdev nodes) DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb" +SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK="%c" # firmware loader SUBSYSTEM=="firmware", ACTION=="add", RUN+="/etc/hotplug.d/firmware/50-firmware.hotplug" diff --git a/etc/udev/udev.permissions b/etc/udev/udev.permissions deleted file mode 100644 index dd56bbec4c..0000000000 --- a/etc/udev/udev.permissions +++ /dev/null @@ -1,10 +0,0 @@ -#name:user:group:mode -ttyUSB0:root:uucp:0660 -ttyUSB1:root:uucp:0666 -pl2303:500:500:0666 -visor:root:uucp:0666 -dsp1:::0666 -camera*:500:500:0666 -sgi_fetchop:root:root:666 -iseries/vcd*:root:disk:660 -iseries/vd*:root:disk:660 diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index 6417bbf185..913a88db06 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -1,4 +1,4 @@ -# Makefile for usb_id +# Makefile for firmware_helper # # Copyright (C) 2005 Kay Sievers # -- cgit v1.2.3-54-g00ecf From 34c00c915c6dd9d063551732169cb3c3126376ad Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Aug 2005 19:45:08 +0200 Subject: update README Signed-off-by: Kay Sievers --- README | 42 ++++++++++++++++++++++++------------------ udev.8.in | 1 - udevd.c | 2 +- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/README b/README index a2ce9c7d36..139c6e1a6f 100644 --- a/README +++ b/README @@ -1,5 +1,5 @@ -udev - a userspace implementation of devfs +udev - a userspace device manager For more information on the design, and structure of this project, see the files in the docs/ directory. @@ -10,19 +10,25 @@ To use: - Your 2.6 kernel must have had CONFIG_HOTPLUG enabled when it was built. -- Make sure sysfs is mounted at /sys. You can mount it by running: +- Make sure sysfs is mounted at /sys. No other location is supported. + You can mount it by running: mount -t sysfs none /sys -- Make sure you have the latest version of the linux-hotplug scripts. They are - available at linux-hotplug.sf.net or from your local kernel.org mirror at: - kernel.org/pub/linux/utils/kernel/hotplug/ - They are required in order for udev to work properly. +- Make sure you integrate udev with your hotplug setup. There is a copy of + the rules files for all major distros in the etc/udev folder. You may look + there how others are doing it. - If for some reason you do not install the hotplug scripts, you must tell the - kernel to point the hotplug binary at wherever you install udev at. This can - be done by: +- Make sure you integrate with the kernel hotplug events. Later versions of + udev are able to listen directly to a netlink socket, older versions used + udevsend to feed the udev daemon with the kernel event. The most basic + setup to run udev is to let the kernel for the udev binary directly: echo "/sbin/udev" > /proc/sys/kernel/hotplug + While this may work in some setups, it is not recommended to do. A recent + kernel and udev version is able to operate with the event serializing daemon + udevd, that makes sure, that no "remove" event will beat a "add" event for + the same device. + - Build the project: make @@ -59,31 +65,31 @@ To use: would do: make USE_KLIBC=true DEBUG=true + udev will follow the setting of the debug level in udev.conf. Adapt this + value to see the debug in syslog. + - Install the project: make install - This will put the udev binary in /sbin, create the /udev and /etc/udev - directories, and place the udev configuration files in /etc/udev. You + This will put the udev binaries in /sbin, create the and /etc/udev + directories, and place the udev configuration files in /etc/udev/. You will probably want to edit the *.rules files to create custom naming rules. More info on how the config files are set up are contained in comments in the files, and is located in the documentation. - Add and remove devices from the system and marvel as nodes are created - and removed in /udev/ based on the device types. + and removed in /dev based on the device types. - If you later get sick of it, uninstall it: make uninstall - -Things are still quite rough, but it should work properly. If nothing -seems to happen, make sure your build worked properly by running the -udev-test.pl script as root in the test/ subdirectory of the udev source -tree. +If nothing seems to happen, make sure your build worked properly by +running the udev-test.pl script as root in the test/ subdirectory of the +udev source tree. Development and documentation help is very much appreciated, see the TODO file for a list of things left to be done. - Any comment/questions/concerns please let me and the other udev developers know by sending a message to the linux-hotplug-devel mailing list at: linux-hotplug-devel@lists.sourceforge.net diff --git a/udev.8.in b/udev.8.in index b4edd5aebd..9dae378086 100644 --- a/udev.8.in +++ b/udev.8.in @@ -381,7 +381,6 @@ If set to "0", it disables the execution of programs added by rules. .SH "SEE ALSO" .BR udevinfo (8), .BR udevd (8), -.BR hotplug (8) .PP .B Web resources: .nf diff --git a/udevd.c b/udevd.c index 9242acce31..d51ed2f7b0 100644 --- a/udevd.c +++ b/udevd.c @@ -1,5 +1,5 @@ /* - * udevd.c - hotplug event serializer + * udevd.c - event listener and serializer * * Copyright (C) 2004-2005 Kay Sievers * Copyright (C) 2004 Chris Friesen -- cgit v1.2.3-54-g00ecf From a37610d0f885ee301fd99757beb9fd7af729307f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Aug 2005 20:11:26 +0200 Subject: remove example rules and put the dev.d stuff into the run_directory folder The distro rules are the best example you can get and the use of dev.d/ is no longer recommended. Signed-off-by: Kay Sievers --- docs/RFC-dev.d | 50 ----------------- etc/dev.d/default/pam_console.dev | 52 ------------------ etc/dev.d/net/hotplug.dev | 21 -------- etc/dev.d/snd/controlC0/alsa.dev | 2 - etc/udev/udev.rules | 46 ---------------- etc/udev/udev.rules.devfs | 6 +++ etc/udev/udev.rules.examples | 63 ---------------------- extras/run_directory/README | 17 ++++++ extras/run_directory/RFC-dev.d | 50 +++++++++++++++++ extras/run_directory/dev.d/default/pam_console.dev | 52 ++++++++++++++++++ extras/run_directory/dev.d/net/hotplug.dev | 21 ++++++++ extras/run_directory/dev.d/snd/controlC0/alsa.dev | 2 + 12 files changed, 148 insertions(+), 234 deletions(-) delete mode 100644 docs/RFC-dev.d delete mode 100644 etc/dev.d/default/pam_console.dev delete mode 100644 etc/dev.d/net/hotplug.dev delete mode 100644 etc/dev.d/snd/controlC0/alsa.dev delete mode 100644 etc/udev/udev.rules delete mode 100644 etc/udev/udev.rules.examples create mode 100644 extras/run_directory/README create mode 100644 extras/run_directory/RFC-dev.d create mode 100644 extras/run_directory/dev.d/default/pam_console.dev create mode 100644 extras/run_directory/dev.d/net/hotplug.dev create mode 100644 extras/run_directory/dev.d/snd/controlC0/alsa.dev diff --git a/docs/RFC-dev.d b/docs/RFC-dev.d deleted file mode 100644 index 1aca1aa393..0000000000 --- a/docs/RFC-dev.d +++ /dev/null @@ -1,50 +0,0 @@ - /etc/dev.d/ How it works, and what it is for - - by Greg Kroah-Hartman March 2004 - -The /etc/dev.d directory works much like the /etc/hotplug.d/ directory -in that it is a place to put symlinks or programs that get called when -an event happens in the system. Programs will get called whenever the -device naming program in the system has either named a new device and -created a /dev node for it, or when a /dev node has been removed from -the system due to a device being removed. - -The directory tree under /etc/dev.d/ dictate which program is run first, -and when some programs will be run or not. The device naming program -calls the programs in the following order: - /etc/dev.d/DEVNAME/*.dev - /etc/dev.d/SUBSYSTEM/*.dev - /etc/dev.d/default/*.dev - -The .dev extension is needed to allow automatic package managers to -deposit backup files in these directories safely. - -The DEVNAME name is the name of the /dev file that has been created, or -for network devices, the name of the newly named network device. This -value, including the /dev path, will also be exported to userspace in -the DEVNAME environment variable. - -The SUBSYSTEM name is the name of the sysfs subsystem that originally -generated the hotplug event that caused the device naming program to -create or remove the /dev node originally. This value is passed to -userspace as the first argument to the program. - -The default directory will always be run, to enable programs to catch -every device add and remove in a single place. - -All environment variables that were originally passed by the hotplug -call that caused this device action will also be passed to the program -called in the /etc/dev.d/ directories. Examples of these variables are -ACTION, DEVPATH, and others. See the hotplug documentation for full -description of this - -An equivalent shell script that would do this same kind of action would -be: - DIR="/etc/dev.d" - export DEVNAME="whatever_dev_name_udev_just_gave" - for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do - if [ -f $I ]; then $I $1 ; fi - done - exit 1; - - diff --git a/etc/dev.d/default/pam_console.dev b/etc/dev.d/default/pam_console.dev deleted file mode 100644 index 4c69ea3576..0000000000 --- a/etc/dev.d/default/pam_console.dev +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# Fedora solution to set the ownership/permissions of s device to the local -# logged in user. Uses the program pam_console_setowner to match the names of -# the device node and the symlinks against a device list and applies the -# configured ownership and permission to the node. - -[ "$ACTION" != "add" ] && exit 0 - -# we do not have console users in rc.sysinit -[ -n "$IN_INITLOG" ] && exit 0 - -if [ -x /sbin/pam_console_setowner -a -f /var/run/console/console.lock \ - -a -e "$DEVNAME" ]; then - - if [ -x /usr/bin/logger ]; then - LOGGER=/usr/bin/logger - elif [ -x /bin/logger ]; then - LOGGER=/bin/logger - else - unset LOGGER - fi - # - # for diagnostics - # - if [ -t 1 -o -z "$LOGGER" ]; then - mesg () { - echo "$@" - } - else - mesg () { - $LOGGER -t $(basename $0)"[$$]" "$@" - } - fi - - debug_mesg () { - test "$udev_log" = "" -o "$udev_log" = "no" && return - mesg "$@" - } - - if [ -f /etc/udev/udev.conf ]; then - . /etc/udev/udev.conf - fi - - SYMLINKS="" - for i in $(/usr/bin/udevinfo -q symlink -p "$DEVPATH"); do - [ $? -gt 0 ] && break - SYMLINKS="$SYMLINKS ${udev_root%%/}/$i" - done - debug_mesg "Restoring console permissions for $DEVNAME $SYMLINKS" - /sbin/pam_console_setowner "$DEVNAME" $SYMLINKS -fi diff --git a/etc/dev.d/net/hotplug.dev b/etc/dev.d/net/hotplug.dev deleted file mode 100644 index e195b0f034..0000000000 --- a/etc/dev.d/net/hotplug.dev +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Script to ensure that any network device that udev renames -# still gets the hotplug script run with the proper name. -# -# Released under the GPL v2 -# -# Copyright (C) 2004 Greg Kroah-Hartman -# - -# Do nothing if udev handles hotplug.d. -if [ "$MANAGED_EVENT" == "1" ]; then - exit 0 -fi - -# ok, we have renamed this device, so let the network hotplug script -# know about it to setup the device properly... -if [ -f /etc/hotplug.d/default/default.hotplug ]; then - exec /etc/hotplug.d/default/default.hotplug net -fi - diff --git a/etc/dev.d/snd/controlC0/alsa.dev b/etc/dev.d/snd/controlC0/alsa.dev deleted file mode 100644 index 642dde4f36..0000000000 --- a/etc/dev.d/snd/controlC0/alsa.dev +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -e -exec /usr/sbin/alsactl restore 0 diff --git a/etc/udev/udev.rules b/etc/udev/udev.rules deleted file mode 100644 index bebf74802f..0000000000 --- a/etc/udev/udev.rules +++ /dev/null @@ -1,46 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# See the udev.rules.examples file for more examples of how to create rules -# - -# if this is a ide cdrom, name it the default name, and create a symlink to cdrom -BUS=="ide", KERNEL=="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK+="cdrom" - -# DRI devices always go into a subdirectory (as per the LSB spec) -KERNEL=="card*", NAME="dri/card%n" - -# alsa devices -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hw[CD0-9]*", NAME="snd/%k" -KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# input devices -KERNEL=="mice", NAME="input/%k" -KERNEL=="mouse*", NAME="input/%k" -KERNEL=="event*", NAME="input/%k" -KERNEL=="js*", NAME="input/%k" -KERNEL=="ts*", NAME="input/%k" - -# USB devices -KERNEL=="hiddev*", NAME="usb/%k" -KERNEL=="auer*", NAME="usb/%k" -KERNEL=="legousbtower*", NAME="usb/%k" -KERNEL=="dabusb*", NAME="usb/%k" -BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" - -# CAPI devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# Network devices -KERNEL=="tun", NAME="net/%k" - -# raw devices -KERNEL=="raw[0-9]*", NAME="raw/%k" - -# emulate dev.d/ -RUN="/sbin/udev_run_devd" diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs index 867f95029c..b7b2c4e12d 100644 --- a/etc/udev/udev.rules.devfs +++ b/etc/udev/udev.rules.devfs @@ -1,3 +1,9 @@ +# The use of these rules is not recommended or supported. +# In a world where devices can come and go at any time, the devfs scheme +# of simple device enumeration does not help _anything_. Just forget about +# it. Use custom rules to name your device or look at the persistent device +# naming scheme, which is implemented for disks and add your subsystem. + # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. diff --git a/etc/udev/udev.rules.examples b/etc/udev/udev.rules.examples deleted file mode 100644 index 1c4527891a..0000000000 --- a/etc/udev/udev.rules.examples +++ /dev/null @@ -1,63 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# -# These are some example rules that you could use to name your devices. -# -# If anyone has any other examples that they think should be in here for others -# to use, please send them to greg@kroah.com -# - -# Looking for scsi bus id 42:0:0:1 -BUS=="scsi", PROGRAM="/bin/echo -n test-%b", RESULT=="test-42:0:0:1", NAME="%c" - -# A usb camera. -BUS=="usb", SYSFS{vendor}=="FUJIFILM", SYSFS{model}=="M100", NAME="camera%n" - -# USB Epson printer to be called lp_epson -BUS=="usb", SYSFS_serial=="HXOLL0012202323480", NAME="lp_epson" - -# USB HP printer to be called lp_hp -BUS=="usb", SYSFS{serial}=="W09090207101241330", NAME="lp_hp" - -# sound card with PCI bus id 00:0b.0 to be the first sound card -BUS=="pci", ID=="00:0b.0", NAME="dsp" - -# sound card with PCI bus id 00:07.1 to be the second sound card -BUS=="pci", ID=="00:07.1", NAME="dsp1" - -# ttyUSB1 should always be called visor -KERNEL=="ttyUSB1", NAME="visor" -KERNEL=="ttyUSB0", NAME="pl2303" - -# a devfs like way to name some tty devices -KERNEL=="ttyS*", NAME="tts/%n" -KERNEL=="tty*", NAME="vc/%n" - -# if this is a ide cdrom, name it the default name, and create a symlink to cdrom -BUS=="ide", KERNEL=="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom", NAME="%k", SYMLINK+="cdrom" - -# DRI devices always go into a subdirectory (as per the LSB spec) -KERNEL=="card*", NAME="dri/card%n" - -# create all 15 partitions of a USB flash card reader -BUS=="scsi", SYSFS{model}=="CF/MD", NAME{all_partitions}="compactflash" - -# alsa devices -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hw[CD0-9]*", NAME="snd/%k" -KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL=="midi[CD0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# input devices -KERNEL=="mice", NAME="input/%k" -KERNEL=="mouse*", NAME="input/%k" -KERNEL=="event*", NAME="input/%k" -KERNEL=="js*", NAME="input/%k" -KERNEL=="ts*", NAME="input/%k" - -# emulate dev.d/ -RUN="/sbin/udev_run_devd" - diff --git a/extras/run_directory/README b/extras/run_directory/README new file mode 100644 index 0000000000..022c66451c --- /dev/null +++ b/extras/run_directory/README @@ -0,0 +1,17 @@ +Use these binaries only if you need backward compatibility with +older udev versions. The use of /etc/dev.d/ is no longer recommended +Use explicit udev rules with RUN keys to hook into the processing. + + /etc/dev.d/ + /etc/hotplug.d/ directory multiplexing is completely + removed from udev itself and must be emulated by calling small + helper binaries provided by these helpers: + make EXTRAS=extras/run_directory/ + will build udev_run_devd and udev_run_hotplugd, which can be called + from a rule if needed: + RUN+="/sbin/udev_run_hotplugd" + The recommended way to handle this is to convert all the calls from + the directories to explicit udev rules and get completely rid of the + multiplexing. (To catch a ttyUSB event, you now no longer need to + fork and exit 300 tty script instances you are not interested in, it + is just one rule that matches exactly the device.) + diff --git a/extras/run_directory/RFC-dev.d b/extras/run_directory/RFC-dev.d new file mode 100644 index 0000000000..1aca1aa393 --- /dev/null +++ b/extras/run_directory/RFC-dev.d @@ -0,0 +1,50 @@ + /etc/dev.d/ How it works, and what it is for + + by Greg Kroah-Hartman March 2004 + +The /etc/dev.d directory works much like the /etc/hotplug.d/ directory +in that it is a place to put symlinks or programs that get called when +an event happens in the system. Programs will get called whenever the +device naming program in the system has either named a new device and +created a /dev node for it, or when a /dev node has been removed from +the system due to a device being removed. + +The directory tree under /etc/dev.d/ dictate which program is run first, +and when some programs will be run or not. The device naming program +calls the programs in the following order: + /etc/dev.d/DEVNAME/*.dev + /etc/dev.d/SUBSYSTEM/*.dev + /etc/dev.d/default/*.dev + +The .dev extension is needed to allow automatic package managers to +deposit backup files in these directories safely. + +The DEVNAME name is the name of the /dev file that has been created, or +for network devices, the name of the newly named network device. This +value, including the /dev path, will also be exported to userspace in +the DEVNAME environment variable. + +The SUBSYSTEM name is the name of the sysfs subsystem that originally +generated the hotplug event that caused the device naming program to +create or remove the /dev node originally. This value is passed to +userspace as the first argument to the program. + +The default directory will always be run, to enable programs to catch +every device add and remove in a single place. + +All environment variables that were originally passed by the hotplug +call that caused this device action will also be passed to the program +called in the /etc/dev.d/ directories. Examples of these variables are +ACTION, DEVPATH, and others. See the hotplug documentation for full +description of this + +An equivalent shell script that would do this same kind of action would +be: + DIR="/etc/dev.d" + export DEVNAME="whatever_dev_name_udev_just_gave" + for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do + if [ -f $I ]; then $I $1 ; fi + done + exit 1; + + diff --git a/extras/run_directory/dev.d/default/pam_console.dev b/extras/run_directory/dev.d/default/pam_console.dev new file mode 100644 index 0000000000..4c69ea3576 --- /dev/null +++ b/extras/run_directory/dev.d/default/pam_console.dev @@ -0,0 +1,52 @@ +#!/bin/sh + +# Fedora solution to set the ownership/permissions of s device to the local +# logged in user. Uses the program pam_console_setowner to match the names of +# the device node and the symlinks against a device list and applies the +# configured ownership and permission to the node. + +[ "$ACTION" != "add" ] && exit 0 + +# we do not have console users in rc.sysinit +[ -n "$IN_INITLOG" ] && exit 0 + +if [ -x /sbin/pam_console_setowner -a -f /var/run/console/console.lock \ + -a -e "$DEVNAME" ]; then + + if [ -x /usr/bin/logger ]; then + LOGGER=/usr/bin/logger + elif [ -x /bin/logger ]; then + LOGGER=/bin/logger + else + unset LOGGER + fi + # + # for diagnostics + # + if [ -t 1 -o -z "$LOGGER" ]; then + mesg () { + echo "$@" + } + else + mesg () { + $LOGGER -t $(basename $0)"[$$]" "$@" + } + fi + + debug_mesg () { + test "$udev_log" = "" -o "$udev_log" = "no" && return + mesg "$@" + } + + if [ -f /etc/udev/udev.conf ]; then + . /etc/udev/udev.conf + fi + + SYMLINKS="" + for i in $(/usr/bin/udevinfo -q symlink -p "$DEVPATH"); do + [ $? -gt 0 ] && break + SYMLINKS="$SYMLINKS ${udev_root%%/}/$i" + done + debug_mesg "Restoring console permissions for $DEVNAME $SYMLINKS" + /sbin/pam_console_setowner "$DEVNAME" $SYMLINKS +fi diff --git a/extras/run_directory/dev.d/net/hotplug.dev b/extras/run_directory/dev.d/net/hotplug.dev new file mode 100644 index 0000000000..e195b0f034 --- /dev/null +++ b/extras/run_directory/dev.d/net/hotplug.dev @@ -0,0 +1,21 @@ +#!/bin/sh +# +# Script to ensure that any network device that udev renames +# still gets the hotplug script run with the proper name. +# +# Released under the GPL v2 +# +# Copyright (C) 2004 Greg Kroah-Hartman +# + +# Do nothing if udev handles hotplug.d. +if [ "$MANAGED_EVENT" == "1" ]; then + exit 0 +fi + +# ok, we have renamed this device, so let the network hotplug script +# know about it to setup the device properly... +if [ -f /etc/hotplug.d/default/default.hotplug ]; then + exec /etc/hotplug.d/default/default.hotplug net +fi + diff --git a/extras/run_directory/dev.d/snd/controlC0/alsa.dev b/extras/run_directory/dev.d/snd/controlC0/alsa.dev new file mode 100644 index 0000000000..642dde4f36 --- /dev/null +++ b/extras/run_directory/dev.d/snd/controlC0/alsa.dev @@ -0,0 +1,2 @@ +#!/bin/sh -e +exec /usr/sbin/alsactl restore 0 -- cgit v1.2.3-54-g00ecf From d47fd445bd9ade720776f661a4ad7c4b2202d6f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Aug 2005 22:11:44 +0200 Subject: trivial text cleanups Signed-off-by: Kay Sievers --- README | 3 +- etc/udev/udev-devfs.rules | 108 ++++++++++++++++++++++++++++++++++++++++++ etc/udev/udev.rules.devfs | 111 -------------------------------------------- extras/run_directory/README | 6 +-- 4 files changed, 113 insertions(+), 115 deletions(-) create mode 100644 etc/udev/udev-devfs.rules delete mode 100644 etc/udev/udev.rules.devfs diff --git a/README b/README index 139c6e1a6f..5dc1e46c89 100644 --- a/README +++ b/README @@ -85,7 +85,8 @@ To use: If nothing seems to happen, make sure your build worked properly by running the udev-test.pl script as root in the test/ subdirectory of the -udev source tree. +udev source tree. Running udevstart should populate an empty /dev +directory. You may test, if a node is recreated after running udevstart. Development and documentation help is very much appreciated, see the TODO file for a list of things left to be done. diff --git a/etc/udev/udev-devfs.rules b/etc/udev/udev-devfs.rules new file mode 100644 index 0000000000..1e71ae1a17 --- /dev/null +++ b/etc/udev/udev-devfs.rules @@ -0,0 +1,108 @@ +# The use of these rules is not recommended or supported. +# In a world where devices can come and go at any time, the devfs scheme +# of simple device enumeration does not help _anything_. Just forget about +# it. Use custom rules to name your device or look at the persistent device +# naming scheme, which is implemented for disks and add your subsystem. + +# ide block devices +BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" + +# md block devices +KERNEL="md[0-9]*", NAME="md/%n" + +# floppy devices +KERNEL="fd[0-9]*", NAME="floppy/%n" + +# tty devices +KERNEL="tty[0-9]*", NAME="vc/%n" +KERNEL="ttyS[0-9]*", NAME="tts/%n" +KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" + +# vc devices +KERNEL="vcs", NAME="vcc/0" +KERNEL="vcs[0-9]*", NAME="vcc/%n" +KERNEL="vcsa", NAME="vcc/a0" +KERNEL="vcsa[0-9]*", NAME="vcc/a%n" + +# v4l devices +KERNEL="video[0-9]*", NAME="v4l/video%n" +KERNEL="radio[0-9]*", NAME="v4l/radio%n" +KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" +KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" + +# dm devices (ignore them) +KERNEL="dm-[0-9]*", NAME="" + +# i2c devices +KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" + +# loop devices +KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" + +# ramdisks +KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" + +# framebuffer devices +KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" + +# misc +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" +KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" +KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" +KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" + +# alsa devices +KERNEL="controlC[0-9]*", NAME="snd/%k" +KERNEL="hw[CD0-9]*", NAME="snd/%k" +KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL="midi[CD0-9]*", NAME="snd/%k" +KERNEL="timer", NAME="snd/%k" +KERNEL="seq", NAME="snd/%k" + +# oss devices +KERNEL="audio*", NAME="sound/%k", SYMLINK="%k" +KERNEL="dmmidi", NAME="sound/%k", SYMLINK="%k" +KERNEL="dsp*", NAME="sound/%k", SYMLINK="%k" +KERNEL="midi*", NAME="sound/%k", SYMLINK="%k" +KERNEL="mixer*", NAME="sound/%k", SYMLINK="%k" +KERNEL="sequencer*", NAME="sound/%k", SYMLINK="%k" + +# input devices +KERNEL="mice", NAME="input/%k" +KERNEL="mouse*", NAME="input/%k" +KERNEL="event*", NAME="input/%k" +KERNEL="js*", NAME="input/%k" +KERNEL="ts*", NAME="input/%k" + +# USB devices +KERNEL="hiddev*", NAME="usb/%k" +KERNEL="auer*", NAME="usb/%k" +KERNEL="legousbtower*", NAME="usb/%k" +KERNEL="dabusb*", NAME="usb/%k" +BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" + +# netlink devices +KERNEL="route", NAME="netlink/%k" +KERNEL="skip", NAME="netlink/%k" +KERNEL="usersock", NAME="netlink/%k" +KERNEL="fwmonitor", NAME="netlink/%k" +KERNEL="tcpdiag", NAME="netlink/%k" +KERNEL="nflog", NAME="netlink/%k" +KERNEL="xfrm", NAME="netlink/%k" +KERNEL="arpd", NAME="netlink/%k" +KERNEL="route6", NAME="netlink/%k" +KERNEL="ip6_fw", NAME="netlink/%k" +KERNEL="dnrtmsg", NAME="netlink/%k" +KERNEL="tap*", NAME="netlink/%k" + +# CAPI devices +KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL="capi*", NAME="capi/%n" + +# Network devices +KERNEL="tun", NAME="net/%k" + +# raw devices +KERNEL="raw[0-9]*", NAME="raw/%k" diff --git a/etc/udev/udev.rules.devfs b/etc/udev/udev.rules.devfs deleted file mode 100644 index b7b2c4e12d..0000000000 --- a/etc/udev/udev.rules.devfs +++ /dev/null @@ -1,111 +0,0 @@ -# The use of these rules is not recommended or supported. -# In a world where devices can come and go at any time, the devfs scheme -# of simple device enumeration does not help _anything_. Just forget about -# it. Use custom rules to name your device or look at the persistent device -# naming scheme, which is implemented for disks and add your subsystem. - -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. - -# ide block devices -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" - -# md block devices -KERNEL="md[0-9]*", NAME="md/%n" - -# floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n" - -# tty devices -KERNEL="tty[0-9]*", NAME="vc/%n" -KERNEL="ttyS[0-9]*", NAME="tts/%n" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" - -# vc devices -KERNEL="vcs", NAME="vcc/0" -KERNEL="vcs[0-9]*", NAME="vcc/%n" -KERNEL="vcsa", NAME="vcc/a0" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n" - -# v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n" -KERNEL="radio[0-9]*", NAME="v4l/radio%n" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" - -# dm devices (ignore them) -KERNEL="dm-[0-9]*", NAME="" - -# i2c devices -KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" - -# loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" - -# ramdisks -KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" - -# framebuffer devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" - -# misc -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" - -# alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" - -# oss devices -KERNEL="audio*", NAME="sound/%k", SYMLINK="%k" -KERNEL="dmmidi", NAME="sound/%k", SYMLINK="%k" -KERNEL="dsp*", NAME="sound/%k", SYMLINK="%k" -KERNEL="midi*", NAME="sound/%k", SYMLINK="%k" -KERNEL="mixer*", NAME="sound/%k", SYMLINK="%k" -KERNEL="sequencer*", NAME="sound/%k", SYMLINK="%k" - -# input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse*", NAME="input/%k" -KERNEL="event*", NAME="input/%k" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" - -# USB devices -KERNEL="hiddev*", NAME="usb/%k" -KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k" -KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" - -# netlink devices -KERNEL="route", NAME="netlink/%k" -KERNEL="skip", NAME="netlink/%k" -KERNEL="usersock", NAME="netlink/%k" -KERNEL="fwmonitor", NAME="netlink/%k" -KERNEL="tcpdiag", NAME="netlink/%k" -KERNEL="nflog", NAME="netlink/%k" -KERNEL="xfrm", NAME="netlink/%k" -KERNEL="arpd", NAME="netlink/%k" -KERNEL="route6", NAME="netlink/%k" -KERNEL="ip6_fw", NAME="netlink/%k" -KERNEL="dnrtmsg", NAME="netlink/%k" -KERNEL="tap*", NAME="netlink/%k" - -# CAPI devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi*", NAME="capi/%n" - -# Network devices -KERNEL="tun", NAME="net/%k" - -# raw devices -KERNEL="raw[0-9]*", NAME="raw/%k" diff --git a/extras/run_directory/README b/extras/run_directory/README index 022c66451c..feae2f81bf 100644 --- a/extras/run_directory/README +++ b/extras/run_directory/README @@ -1,5 +1,5 @@ Use these binaries only if you need backward compatibility with -older udev versions. The use of /etc/dev.d/ is no longer recommended +older udev versions. The use of /etc/dev.d/ is no longer recommended. Use explicit udev rules with RUN keys to hook into the processing. /etc/dev.d/ + /etc/hotplug.d/ directory multiplexing is completely @@ -12,6 +12,6 @@ Use explicit udev rules with RUN keys to hook into the processing. The recommended way to handle this is to convert all the calls from the directories to explicit udev rules and get completely rid of the multiplexing. (To catch a ttyUSB event, you now no longer need to - fork and exit 300 tty script instances you are not interested in, it - is just one rule that matches exactly the device.) + fork and exit 300 tty script instances on bootup you are not interested + in, it is just one rule that matches exactly that single device.) -- cgit v1.2.3-54-g00ecf From d33c51c24531b602c9f45a8914c6b1db82c003ec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Aug 2005 15:27:25 +0200 Subject: update SUSE rules Tape naming is harder than expected, go back to block devices only. Signed-off-by: Kay Sievers --- etc/udev/suse/50-udev.rules | 259 ------------------------------------------- etc/udev/suse/udev.rules | 260 ++++++++++++++++++++++++++++++++++++++++++++ udevmonitor.c | 2 +- 3 files changed, 261 insertions(+), 260 deletions(-) delete mode 100644 etc/udev/suse/50-udev.rules create mode 100644 etc/udev/suse/udev.rules diff --git a/etc/udev/suse/50-udev.rules b/etc/udev/suse/50-udev.rules deleted file mode 100644 index 515b572e75..0000000000 --- a/etc/udev/suse/50-udev.rules +++ /dev/null @@ -1,259 +0,0 @@ -# console -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", MODE="600" -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666" - -# serial devices -KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" -KERNEL=="pppox*", NAME="%k", GROUP="uucp" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp" -KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" -KERNEL=="hvc*", NAME="%k", GROUP="uucp" -KERNEL=="hvsi*", NAME="%k", GROUP="uucp" -KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" - -# video/graphics -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="graphics" GROUP="video" -KERNEL=="video*", NAME="%k", GROUP="video" -KERNEL=="vtx*", NAME="%k", GROUP="video" -KERNEL=="vbi*", NAME="%k", GROUP="video" -KERNEL=="winradio*", NAME="%k", GROUP="video" -KERNEL=="vttuner*", NAME="%k", GROUP="video" -KERNEL=="nvidia*", NAME="%k", GROUP="video" -KERNEL=="nvidiactl*", NAME="%k", GROUP="video" - -# dvb -KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video" - -# ALSA/sound -SUBSYSTEM="sound", GROUP="audio" -SUBSYSTEM="snd", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8000/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us428fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8004/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us224fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8006/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us122fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8001/*", RUN+="/sbin/startproc /usr/bin/us428control" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startproc /usr/bin/us428control" -SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" -SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/dev.d/snd/hwC0D2/alsa" - -# OpenCT (SmartCard) -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="973/1*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="529/50c*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="529/514*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="73d/5*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b9/1200*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b9/1300*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="76b/596*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="76b/1784*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="8d4/9*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{INTERFACE}=="11/*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" - -# CAPI devices -SUBSYSTEM="capi", GROUP="dialout" -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# ISDN -KERNEL=="isdn*", NAME="%k", MODE="600" -KERNEL=="isdnctrl*", NAME="%k", MODE="600" -KERNEL=="ippp*", NAME="%k", MODE="600" -KERNEL=="isdninfo*", NAME="%k", MODE="444" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/c00*", IMPORT="/bin/echo 'DRV=fcusb'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/1000*", IMPORT="/bin/echo -e 'DRV=fcusb2\nFIRMWARE=fus2base.frm'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/1900*", IMPORT="/bin/echo -e 'DRV=fcusb2\nFIRMWARE=fus3base.frm'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2000*", IMPORT="/bin/echo DRV=fxusb", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2200*", IMPORT="/bin/echo DRV=bfusb", RUN+="/etc/sysconfig/isdn/scripts/load-bfusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2300*", IMPORT="/bin/echo -e 'DRV=fcdslusb\nFIRMWARE=fdsubase.frm\nDSL_CONTR=dslisdn'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2800*", IMPORT="/bin/echo DRV=fxusb_CZ", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3000*", IMPORT="/bin/echo -e 'DRV=fcdslusba\nFIRMWARE=fdsabase.frm\nDSL_CONTR=dslonly\nISDNLOG_START=no'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3500*", IMPORT="/bin/echo -e 'DRV=fcdslslusb\nFIRMWARE=fdlubase.frm\nDSL_CONTR=dslonly\nISDNLOG_START=no'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3600*", IMPORT="/bin/echo -e 'DRV=fcdslusb2\nFIRMWARE=fds2base.frm\nDSL_CONTR=dslisdn'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2805*", IMPORT="/bin/echo 'DRV=e2220pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2806*", IMPORT="/bin/echo 'DRV=e5520pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/4401*", IMPORT="/bin/echo 'DRV=e2220pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/4601*", IMPORT="/bin/echo 'DRV=e5520pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="483/4810*", IMPORT="/bin/echo 'DRV=hisax_st5481'", RUN+="/etc/sysconfig/isdn/scripts/load-hisaxusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="959/2bd0*", IMPORT="/bin/echo 'DRV=hfc_usb'", RUN+="/etc/sysconfig/isdn/scripts/load-hisaxusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="9bf/*", IMPORT="/bin/echo 'DRV=auerswald'", RUN+="/etc/sysconfig/isdn/scripts/load-auerswald" - -# input devices -KERNEL=="mice", NAME="input/%k", MODE="0640" -KERNEL=="mouse*", NAME="input/%k", MODE="0640" -KERNEL=="event*", NAME="input/%k", MODE="0640" -KERNEL=="js*", NAME="input/%k", MODE="0644" -KERNEL=="ts*", NAME="input/%k", MODE="0600" -KERNEL=="uinput", NAME="input/%k", MODE="0600" -KERNEL=="event*", PROGRAM="/sbin/udev.get_input_lirc.sh %k", RESULT="*IR*", NAME="input/%k", SYMLINK+="input/ir" -KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" -SUBSYSTEM=="input_device", RUN+="/etc/hotplug.d/input_device/50-input_device.hotplug" - -# printer -SUBSYSTEM=="usb", KERNEL=="lp*", ACTION=="add", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", ACTION=="add", NAME="%k", GROUP="lp" -KERNEL=="irlpt*", NAME="%k", GROUP="lp" - -# cpu devices -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" - -# IEEE1394 devices -KERNEL=="raw1394*", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" - -# 183 = /dev/hwrng Generic random number generator -KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" -# 219 /dev/modems/mwave MWave modem firmware upload -KERNEL=="mwave", NAME="modems/%k" -# 169 /dev/specialix_rioctl Specialix RIO serial control -KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" -# 167 /dev/specialix_sxctl Specialix serial control -KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" - -# misc devices -KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="nvram", NAME="%k", GROUP="kmem" -KERNEL=="null", NAME="%k", MODE="666" -KERNEL=="zero", NAME="%k", MODE="666" -KERNEL=="full", NAME="%k", MODE="622" -KERNEL=="random", NAME="%k", MODE="666" -KERNEL=="urandom", NAME="%k", MODE="644" -KERNEL=="rtc", GROUP="audio" -KERNEL=="sonypi", MODE="0666" -KERNEL=="agpgart", MODE="0600", GROUP="video" -KERNEL=="djs*", NAME="%k", MODE="644" -KERNEL=="sgi_*", NAME="%k", MODE="666" -KERNEL=="rrom*", NAME="%k", MODE="400" -KERNEL=="rflash*", NAME="%k", MODE="400" -KERNEL=="usbscanner*", NAME="%k", MODE="644" -KERNEL=="3270/ttycons*", NAME="%k", MODE="600" -KERNEL=="3270/tub*", NAME="%k", MODE="666" -KERNEL=="3270/tubcons*", NAME="%k", MODE="600" -KERNEL=="ica", NAME="%k", MODE="666" -KERNEL=="z90crypt", NAME="%k", MODE="666" -KERNEL=="mmtimer", NAME="%k", MODE="444" - -# fix floppy devices -KERNEL=="nvram", ACTION=="add", NAME="%k", MODE="600", RUN="/sbin/load_floppy_module" -KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN="/sbin/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" -KERNEL=="fd*", ACTION=="remove", RUN="/sbin/remove_floppy_devices /dev/%k" - -# block devices -SUBSYSTEM=="block", GROUP="disk", MODE="0640" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[345]", RUN+="/sbin/modprobe sr_mod" - -# misc storage devices (non-block) -KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" -KERNEL=="st*", NAME="%k", GROUP="disk" -KERNEL=="nst*", NAME="%k", GROUP="disk" -KERNEL=="initrd", NAME="%k", GROUP="disk" -KERNEL=="qft*", NAME="%k", GROUP="disk" -KERNEL=="nqft*", NAME="%k", GROUP="disk" -KERNEL=="zqft*", NAME="%k", GROUP="disk" -KERNEL=="nzqft*", NAME="%k", GROUP="disk" -KERNEL=="rawqft*", NAME="%k", GROUP="disk" -KERNEL=="nrawqft*", NAME="%k", GROUP="disk" -KERNEL=="pf*", NAME="%k", GROUP="disk" -KERNEL=="sch*", NAME="%k", GROUP="disk" -KERNEL=="pt*", NAME="%k", GROUP="disk" -KERNEL=="npt*", NAME="%k", GROUP="disk" -KERNEL=="pg*", NAME="%k", GROUP="disk" -KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" -KERNEL=="rawctl*", NAME="%k", GROUP="disk" -KERNEL=="osst*", NAME="%k", GROUP="disk" -KERNEL=="nosst*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" - -# device mapper targets -KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control" -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/udev.devmap_name.sh %M %m", NAME="mapper/%c" - -# persistent disk device links /dev/disk/ -# skip rules for for ram/loop/fd -SUBSYSTEM=="block", KERNEL=="ram*|loop*|fd*", GOTO="persistent_end" -ACTION!="add", GOTO="persistent_end" - -# never access removable ide devices, the drivers are causing event loops on open() -SUBSYSTEM=="block", BUS=="ide", SYSFS{removable}="1", GOTO="persistent_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -KERNEL=="dasd*[!0-9]", IMPORT="/sbin/dasd_id --export $tempnode" -KERNEL=="dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -KERNEL=="sr*", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" -KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -LABEL="persistent_end" - -# network devices -KERNEL=="tun", NAME="net/%k", MODE="0600" -SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug" -SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" - -# libusb device access (mount usbfs or usbdev nodes) -DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb" -SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK="%c" - -# firmware loader -SUBSYSTEM=="firmware", ACTION=="add", RUN+="/etc/hotplug.d/firmware/50-firmware.hotplug" - -# SUSE system integration -SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" -SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-/sys%p -o hotplug" -SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-/sys%p -o hotplug" -SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-/sys%p -o hotplug" -SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-/sys%p -o hotplug" -SUBSYSTEM=="scsi", DEVPATH=="/devices/css*", ACTION=="remove", RUN+="/sbin/hwdown scsi-devpath-/sys%p -o hotplug" -SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{device/cutype}=="*", RUN+="/sbin/hwup scsi__host-devpath-/sys%p -o hotplug" - -# default -RUN+="/usr/sbin/hal.hotplug" -RUN+="socket:/org/kernel/udev/monitor" - -# debug events to /events, but not on default udev_log="err" -ENV{UDEV_LOG}=="[4-9]", RUN+="/sbin/hotplugeventrecorder" - diff --git a/etc/udev/suse/udev.rules b/etc/udev/suse/udev.rules new file mode 100644 index 0000000000..8791e42fc7 --- /dev/null +++ b/etc/udev/suse/udev.rules @@ -0,0 +1,260 @@ +# console +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="console", NAME="%k", MODE="600" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666" + +# serial devices +KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" +KERNEL=="pppox*", NAME="%k", GROUP="uucp" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp" +KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" +KERNEL=="hvc*", NAME="%k", GROUP="uucp" +KERNEL=="hvsi*", NAME="%k", GROUP="uucp" +KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" + +# video/graphics +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="graphics" GROUP="video" +KERNEL=="video*", NAME="%k", GROUP="video" +KERNEL=="vtx*", NAME="%k", GROUP="video" +KERNEL=="vbi*", NAME="%k", GROUP="video" +KERNEL=="winradio*", NAME="%k", GROUP="video" +KERNEL=="vttuner*", NAME="%k", GROUP="video" +KERNEL=="nvidia*", NAME="%k", GROUP="video" +KERNEL=="nvidiactl*", NAME="%k", GROUP="video" + +# dvb +KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video" + +# ALSA/sound +SUBSYSTEM="sound", GROUP="audio" +SUBSYSTEM="snd", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8000/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us428fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8004/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us224fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8006/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us122fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8001/*", RUN+="/sbin/startproc /usr/bin/us428control" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startproc /usr/bin/us428control" +SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" +SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/dev.d/snd/hwC0D2/alsa" + +# OpenCT (SmartCard) +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="973/1*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="529/50c*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="529/514*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="73d/5*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b9/1200*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b9/1300*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="76b/596*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="76b/1784*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="8d4/9*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" +SUBSYSTEM=="usb", ACTION=="add", ENV{INTERFACE}=="11/*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" + +# CAPI devices +SUBSYSTEM="capi", GROUP="dialout" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# ISDN +KERNEL=="isdn*", NAME="%k", MODE="600" +KERNEL=="isdnctrl*", NAME="%k", MODE="600" +KERNEL=="ippp*", NAME="%k", MODE="600" +KERNEL=="isdninfo*", NAME="%k", MODE="444" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/c00*", IMPORT="/bin/echo 'DRV=fcusb'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/1000*", IMPORT="/bin/echo -e 'DRV=fcusb2\nFIRMWARE=fus2base.frm'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/1900*", IMPORT="/bin/echo -e 'DRV=fcusb2\nFIRMWARE=fus3base.frm'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2000*", IMPORT="/bin/echo DRV=fxusb", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2200*", IMPORT="/bin/echo DRV=bfusb", RUN+="/etc/sysconfig/isdn/scripts/load-bfusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2300*", IMPORT="/bin/echo -e 'DRV=fcdslusb\nFIRMWARE=fdsubase.frm\nDSL_CONTR=dslisdn'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2800*", IMPORT="/bin/echo DRV=fxusb_CZ", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3000*", IMPORT="/bin/echo -e 'DRV=fcdslusba\nFIRMWARE=fdsabase.frm\nDSL_CONTR=dslonly\nISDNLOG_START=no'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3500*", IMPORT="/bin/echo -e 'DRV=fcdslslusb\nFIRMWARE=fdlubase.frm\nDSL_CONTR=dslonly\nISDNLOG_START=no'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3600*", IMPORT="/bin/echo -e 'DRV=fcdslusb2\nFIRMWARE=fds2base.frm\nDSL_CONTR=dslisdn'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2805*", IMPORT="/bin/echo 'DRV=e2220pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2806*", IMPORT="/bin/echo 'DRV=e5520pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/4401*", IMPORT="/bin/echo 'DRV=e2220pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/4601*", IMPORT="/bin/echo 'DRV=e5520pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="483/4810*", IMPORT="/bin/echo 'DRV=hisax_st5481'", RUN+="/etc/sysconfig/isdn/scripts/load-hisaxusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="959/2bd0*", IMPORT="/bin/echo 'DRV=hfc_usb'", RUN+="/etc/sysconfig/isdn/scripts/load-hisaxusb" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="9bf/*", IMPORT="/bin/echo 'DRV=auerswald'", RUN+="/etc/sysconfig/isdn/scripts/load-auerswald" + +# input devices +KERNEL=="mice", NAME="input/%k", MODE="0640" +KERNEL=="mouse*", NAME="input/%k", MODE="0640" +KERNEL=="event*", NAME="input/%k", MODE="0640" +KERNEL=="js*", NAME="input/%k", MODE="0644" +KERNEL=="ts*", NAME="input/%k", MODE="0600" +KERNEL=="uinput", NAME="input/%k", MODE="0600" +KERNEL=="event*", PROGRAM="/sbin/udev.get_input_lirc.sh %k", RESULT="*IR*", NAME="input/%k", SYMLINK+="input/ir" +KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" +SUBSYSTEM=="input_device", RUN+="/etc/hotplug.d/input_device/50-input_device.hotplug" + +# printer +SUBSYSTEM=="usb", KERNEL=="lp*", ACTION=="add", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", ACTION=="add", NAME="%k", GROUP="lp" +KERNEL=="irlpt*", NAME="%k", GROUP="lp" + +# cpu devices +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# IEEE1394 devices +KERNEL=="raw1394*", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" + +# 183 = /dev/hwrng Generic random number generator +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +# 219 /dev/modems/mwave MWave modem firmware upload +KERNEL=="mwave", NAME="modems/%k" +# 169 /dev/specialix_rioctl Specialix RIO serial control +KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" +# 167 /dev/specialix_sxctl Specialix serial control +KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" + +# misc devices +KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="nvram", NAME="%k", GROUP="kmem" +KERNEL=="null", NAME="%k", MODE="666" +KERNEL=="zero", NAME="%k", MODE="666" +KERNEL=="full", NAME="%k", MODE="622" +KERNEL=="random", NAME="%k", MODE="666" +KERNEL=="urandom", NAME="%k", MODE="644" +KERNEL=="rtc", GROUP="audio" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", MODE="0600", GROUP="video" +KERNEL=="djs*", NAME="%k", MODE="644" +KERNEL=="sgi_*", NAME="%k", MODE="666" +KERNEL=="rrom*", NAME="%k", MODE="400" +KERNEL=="rflash*", NAME="%k", MODE="400" +KERNEL=="usbscanner*", NAME="%k", MODE="644" +KERNEL=="3270/ttycons*", NAME="%k", MODE="600" +KERNEL=="3270/tub*", NAME="%k", MODE="666" +KERNEL=="3270/tubcons*", NAME="%k", MODE="600" +KERNEL=="ica", NAME="%k", MODE="666" +KERNEL=="z90crypt", NAME="%k", MODE="666" +KERNEL=="mmtimer", NAME="%k", MODE="444" + +# fix floppy devices +KERNEL=="nvram", ACTION=="add", NAME="%k", MODE="600", RUN="/sbin/load_floppy_module" +KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN="/sbin/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd*", ACTION=="remove", RUN="/sbin/remove_floppy_devices /dev/%k" + +# block devices +SUBSYSTEM=="block", GROUP="disk", MODE="0640" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[345]", RUN+="/sbin/modprobe sr_mod" + +# misc storage devices (non-block) +KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" +KERNEL=="st*", NAME="%k", GROUP="disk" +KERNEL=="nst*", NAME="%k", GROUP="disk" +KERNEL=="initrd", NAME="%k", GROUP="disk" +KERNEL=="qft*", NAME="%k", GROUP="disk" +KERNEL=="nqft*", NAME="%k", GROUP="disk" +KERNEL=="zqft*", NAME="%k", GROUP="disk" +KERNEL=="nzqft*", NAME="%k", GROUP="disk" +KERNEL=="rawqft*", NAME="%k", GROUP="disk" +KERNEL=="nrawqft*", NAME="%k", GROUP="disk" +KERNEL=="pf*", NAME="%k", GROUP="disk" +KERNEL=="sch*", NAME="%k", GROUP="disk" +KERNEL=="pt*", NAME="%k", GROUP="disk" +KERNEL=="npt*", NAME="%k", GROUP="disk" +KERNEL=="pg*", NAME="%k", GROUP="disk" +KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" +KERNEL=="rawctl*", NAME="%k", GROUP="disk" +KERNEL=="osst*", NAME="%k", GROUP="disk" +KERNEL=="nosst*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" + +# device mapper targets +KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control" +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/udev.devmap_name.sh %M %m", NAME="mapper/%c" + +# persistent disk device links /dev/disk/ +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + +# skip rules for for ram/loop/fd +KERNEL=="ram*|loop*|fd*", GOTO="persistent_end" + +# never access removable ide devices, the drivers are causing event loops on open() +SUBSYSTEM=="block", BUS=="ide", SYSFS{removable}="1", GOTO="persistent_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" +KERNEL=="dasd*[!0-9]", IMPORT="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +KERNEL=="sr*", GOTO="persistent_end" +IMPORT="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +LABEL="persistent_end" + +# network devices +KERNEL=="tun", NAME="net/%k", MODE="0600" +SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug" +SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" + +# libusb device access (mount usbfs or usbdev nodes) +DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb" +SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK="%c" + +# firmware loader +SUBSYSTEM=="firmware", ACTION=="add", RUN+="/etc/hotplug.d/firmware/50-firmware.hotplug" + +# SUSE system integration +SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" +SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-/sys%p -o hotplug" +SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-/sys%p -o hotplug" +SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-/sys%p -o hotplug" +SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-/sys%p -o hotplug" +SUBSYSTEM=="scsi", DEVPATH=="/devices/css*", ACTION=="remove", RUN+="/sbin/hwdown scsi-devpath-/sys%p -o hotplug" +SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{device/cutype}=="*", RUN+="/sbin/hwup scsi__host-devpath-/sys%p -o hotplug" + +# default +RUN+="/usr/sbin/hal.hotplug" +RUN+="socket:/org/kernel/udev/monitor" + +# debug events to /events, but not on default udev_log="err" +ENV{UDEV_LOG}=="[4-9]", RUN+="/sbin/hotplugeventrecorder" + +# for backward compatibility with older udev versions and hotplug (no longer supported) +# RUN+="/sbin/udev_run_hotplugd" +# RUN+="/sbin/udev_run_devd" + diff --git a/udevmonitor.c b/udevmonitor.c index 51e8a2ab0b..3a71d002f5 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -28,8 +28,8 @@ #include #include #include +#include #include -#include #include "udev.h" #include "udevd.h" -- cgit v1.2.3-54-g00ecf From 59d6bfefceac1a31b0408e60cd251b5035cf3b50 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Aug 2005 16:54:14 +0200 Subject: split udev_util in several files It too big for the small tools to link against for only the log function. Signed-off-by: Kay Sievers --- Makefile | 4 +- udev_event.c | 4 - udev_utils.c | 248 ------------------------------------------------------ udev_utils_file.c | 140 ++++++++++++++++++++++++++++++ udev_utils_run.c | 179 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 322 insertions(+), 253 deletions(-) create mode 100644 udev_utils_file.c create mode 100644 udev_utils_run.c diff --git a/Makefile b/Makefile index 7618d0f7fd..ecc798de89 100644 --- a/Makefile +++ b/Makefile @@ -136,7 +136,6 @@ SYSFS_OBJS = \ libsysfs/dlist.o UDEV_OBJS = \ - udev_utils.o \ udev_event.o \ udev_device.o \ udev_config.o \ @@ -146,6 +145,9 @@ UDEV_OBJS = \ udev_db.o \ udev_rules.o \ udev_rules_parse.o \ + udev_utils.o \ + udev_utils_file.o \ + udev_utils_run.o \ udev_libc_wrapper.o OBJS = \ diff --git a/udev_event.c b/udev_event.c index 8a3ed29315..3580ab937f 100644 --- a/udev_event.c +++ b/udev_event.c @@ -28,10 +28,6 @@ #include #include #include -#include -#include -#include -#include #include "udev_libc_wrapper.h" #include "udev.h" diff --git a/udev_utils.c b/udev_utils.c index 500d595c01..de43dee30d 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -28,11 +28,6 @@ #include #include #include -#include -#include -#include -#include -#include #include #include "udev_libc_wrapper.h" @@ -148,109 +143,6 @@ int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, u return 0; } -int create_path(const char *path) -{ - char p[PATH_SIZE]; - char *pos; - struct stat stats; - - strcpy (p, path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (pos[-1] == '/') - pos--; - - pos[0] = '\0'; - - dbg("stat '%s'\n", p); - if (stat (p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - - if (create_path (p) != 0) - return -1; - - dbg("mkdir '%s'\n", p); - return mkdir(p, 0755); -} - -/* Reset permissions on the device node, before unlinking it to make sure, - * that permisions of possible hard links will be removed too. - */ -int unlink_secure(const char *filename) -{ - int retval; - - retval = chown(filename, 0, 0); - if (retval) - dbg("chown(%s, 0, 0) failed with error '%s'", filename, strerror(errno)); - - retval = chmod(filename, 0000); - if (retval) - dbg("chmod(%s, 0000) failed with error '%s'", filename, strerror(errno)); - - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - - if (retval) - dbg("unlink(%s) failed with error '%s'", filename, strerror(errno)); - - return retval; -} - -int file_map(const char *filename, char **buf, size_t *bufsize) -{ - struct stat stats; - int fd; - - fd = open(filename, O_RDONLY); - if (fd < 0) { - return -1; - } - - if (fstat(fd, &stats) < 0) { - close(fd); - return -1; - } - - *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (*buf == MAP_FAILED) { - close(fd); - return -1; - } - *bufsize = stats.st_size; - - close(fd); - - return 0; -} - -void file_unmap(void *buf, size_t bufsize) -{ - munmap(buf, bufsize); -} - -/* return number of chars until the next newline, skip escaped newline */ -size_t buf_get_line(const char *buf, size_t buflen, size_t cur) -{ - int escape = 0; - size_t count; - - for (count = cur; count < buflen; count++) { - if (!escape && buf[count] == '\n') - break; - - if (buf[count] == '\\') - escape = 1; - else - escape = 0; - } - - return count - cur; -} - void replace_untrusted_chars(char *string) { size_t len; @@ -373,143 +265,3 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c closedir(dir); return 0; } - -int pass_env_to_socket(const char *sockname, const char *devpath, const char *action) -{ - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; - char buf[2048]; - size_t bufpos = 0; - int i; - int retval; - - dbg("pass environment to socket '%s'", sockname); - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - /* only abstract namespace is supported */ - strcpy(&saddr.sun_path[1], sockname); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - - bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); - bufpos++; - for (i = 0; environ[i] != NULL && bufpos < sizeof(buf); i++) { - bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); - bufpos++; - } - - retval = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, addrlen); - if (retval != -1) - retval = 0; - - close(sock); - return retval; -} - -int execute_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen) -{ - int retval = 0; - int count; - int status; - int pipefds[2]; - pid_t pid; - char *pos; - char arg[PATH_SIZE]; - char *argv[(sizeof(arg) / 2) + 1]; - int devnull; - int i; - size_t len; - - strlcpy(arg, command, sizeof(arg)); - i = 0; - if (strchr(arg, ' ')) { - pos = arg; - while (pos != NULL) { - if (pos[0] == '\'') { - /* don't separate if in apostrophes */ - pos++; - argv[i] = strsep(&pos, "\'"); - while (pos && pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - } - dbg("arg[%i] '%s'", i, argv[i]); - i++; - } - argv[i] = NULL; - dbg("execute '%s' with parsed arguments", arg); - } else { - argv[0] = arg; - argv[1] = (char *) subsystem; - argv[2] = NULL; - dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); - } - - if (result) { - if (pipe(pipefds) != 0) { - err("pipe failed"); - return -1; - } - } - - pid = fork(); - switch(pid) { - case 0: - /* child dup2 write side of pipe to STDOUT */ - devnull = open("/dev/null", O_RDWR); - if (devnull >= 0) { - dup2(devnull, STDIN_FILENO); - if (!result) - dup2(devnull, STDOUT_FILENO); - dup2(devnull, STDERR_FILENO); - close(devnull); - } - if (result) - dup2(pipefds[1], STDOUT_FILENO); - execv(arg, argv); - err("exec of program failed"); - _exit(1); - case -1: - err("fork of '%s' failed", arg); - return -1; - default: - /* parent reads from pipefds[0] */ - if (result) { - close(pipefds[1]); - len = 0; - while (1) { - count = read(pipefds[0], result + len, ressize - len-1); - if (count < 0) { - err("read failed with '%s'", strerror(errno)); - retval = -1; - break; - } - - if (count == 0) - break; - - len += count; - if (len >= ressize-1) { - err("ressize %ld too short", (long)ressize); - retval = -1; - break; - } - } - result[len] = '\0'; - close(pipefds[0]); - if (reslen) - *reslen = len; - } - waitpid(pid, &status, 0); - - if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { - dbg("exec program status 0x%x", status); - retval = -1; - } - } - - return retval; -} diff --git a/udev_utils_file.c b/udev_utils_file.c new file mode 100644 index 0000000000..f8518f64ad --- /dev/null +++ b/udev_utils_file.c @@ -0,0 +1,140 @@ +/* + * udev_utils_file.c - files operations + * + * Copyright (C) 2004-2005 Kay Sievers + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev_libc_wrapper.h" +#include "udev.h" +#include "logging.h" +#include "udev_utils.h" +#include "list.h" + +int create_path(const char *path) +{ + char p[PATH_SIZE]; + char *pos; + struct stat stats; + + strcpy (p, path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (pos[-1] == '/') + pos--; + + pos[0] = '\0'; + + dbg("stat '%s'\n", p); + if (stat (p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + + if (create_path (p) != 0) + return -1; + + dbg("mkdir '%s'\n", p); + return mkdir(p, 0755); +} + +/* Reset permissions on the device node, before unlinking it to make sure, + * that permisions of possible hard links will be removed too. + */ +int unlink_secure(const char *filename) +{ + int retval; + + retval = chown(filename, 0, 0); + if (retval) + dbg("chown(%s, 0, 0) failed with error '%s'", filename, strerror(errno)); + + retval = chmod(filename, 0000); + if (retval) + dbg("chmod(%s, 0000) failed with error '%s'", filename, strerror(errno)); + + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; + + if (retval) + dbg("unlink(%s) failed with error '%s'", filename, strerror(errno)); + + return retval; +} + +int file_map(const char *filename, char **buf, size_t *bufsize) +{ + struct stat stats; + int fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) { + return -1; + } + + if (fstat(fd, &stats) < 0) { + close(fd); + return -1; + } + + *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); + if (*buf == MAP_FAILED) { + close(fd); + return -1; + } + *bufsize = stats.st_size; + + close(fd); + + return 0; +} + +void file_unmap(void *buf, size_t bufsize) +{ + munmap(buf, bufsize); +} + +/* return number of chars until the next newline, skip escaped newline */ +size_t buf_get_line(const char *buf, size_t buflen, size_t cur) +{ + int escape = 0; + size_t count; + + for (count = cur; count < buflen; count++) { + if (!escape && buf[count] == '\n') + break; + + if (buf[count] == '\\') + escape = 1; + else + escape = 0; + } + + return count - cur; +} diff --git a/udev_utils_run.c b/udev_utils_run.c new file mode 100644 index 0000000000..c2e77cbbcc --- /dev/null +++ b/udev_utils_run.c @@ -0,0 +1,179 @@ +/* + * udev_utils_run.c - execute programs from udev and read its output + * + * Copyright (C) 2004-2005 Kay Sievers + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev_libc_wrapper.h" +#include "udev.h" +#include "logging.h" +#include "udev_utils.h" +#include "list.h" + + +int pass_env_to_socket(const char *sockname, const char *devpath, const char *action) +{ + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; + char buf[2048]; + size_t bufpos = 0; + int i; + int retval; + + dbg("pass environment to socket '%s'", sockname); + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + /* only abstract namespace is supported */ + strcpy(&saddr.sun_path[1], sockname); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + + bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); + bufpos++; + for (i = 0; environ[i] != NULL && bufpos < sizeof(buf); i++) { + bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); + bufpos++; + } + + retval = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, addrlen); + if (retval != -1) + retval = 0; + + close(sock); + return retval; +} + +int execute_program(const char *command, const char *subsystem, + char *result, size_t ressize, size_t *reslen) +{ + int retval = 0; + int count; + int status; + int pipefds[2]; + pid_t pid; + char *pos; + char arg[PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; + int devnull; + int i; + size_t len; + + strlcpy(arg, command, sizeof(arg)); + i = 0; + if (strchr(arg, ' ')) { + pos = arg; + while (pos != NULL) { + if (pos[0] == '\'') { + /* don't separate if in apostrophes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos && pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg("arg[%i] '%s'", i, argv[i]); + i++; + } + argv[i] = NULL; + dbg("execute '%s' with parsed arguments", arg); + } else { + argv[0] = arg; + argv[1] = (char *) subsystem; + argv[2] = NULL; + dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); + } + + if (result) { + if (pipe(pipefds) != 0) { + err("pipe failed"); + return -1; + } + } + + pid = fork(); + switch(pid) { + case 0: + /* child dup2 write side of pipe to STDOUT */ + devnull = open("/dev/null", O_RDWR); + if (devnull >= 0) { + dup2(devnull, STDIN_FILENO); + if (!result) + dup2(devnull, STDOUT_FILENO); + dup2(devnull, STDERR_FILENO); + close(devnull); + } + if (result) + dup2(pipefds[1], STDOUT_FILENO); + execv(arg, argv); + err("exec of program failed"); + _exit(1); + case -1: + err("fork of '%s' failed", arg); + return -1; + default: + /* parent reads from pipefds[0] */ + if (result) { + close(pipefds[1]); + len = 0; + while (1) { + count = read(pipefds[0], result + len, ressize - len-1); + if (count < 0) { + err("read failed with '%s'", strerror(errno)); + retval = -1; + break; + } + + if (count == 0) + break; + + len += count; + if (len >= ressize-1) { + err("ressize %ld too short", (long)ressize); + retval = -1; + break; + } + } + result[len] = '\0'; + close(pipefds[0]); + if (reslen) + *reslen = len; + } + waitpid(pid, &status, 0); + + if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { + dbg("exec program status 0x%x", status); + retval = -1; + } + } + + return retval; +} + -- cgit v1.2.3-54-g00ecf From a1ea706a1e3dfa1bb86ebcfcd0b819311526b2e2 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 10 Aug 2005 17:06:01 +0200 Subject: fix udevinfo output --- udevinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index d2c3e1ab7f..58584d62f8 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -289,7 +289,7 @@ int main(int argc, char *argv[], char *envp[]) } retval = udev_db_get_device(&udev, pos); if (retval != 0) { - fprintf(stderr, "device not found in database\n"); + fprintf(stderr, "no record for '%s' in database\n", pos); goto exit; } goto print; @@ -329,7 +329,7 @@ print: goto exit; case QUERY_SYMLINK: if (list_empty(&udev.symlink_list)) - break; + goto exit; if (root) list_for_each_entry(name_loop, &udev.symlink_list, node) printf("%s/%s ", udev_root, name_loop->name); -- cgit v1.2.3-54-g00ecf From 7fd0de4984deac2e51f9b85c156f200beadbc7ef Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Aug 2005 17:19:05 +0200 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/udev.rules | 5 +++-- udevstart.c | 5 +---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/etc/udev/suse/udev.rules b/etc/udev/suse/udev.rules index 8791e42fc7..b0c1f1adcb 100644 --- a/etc/udev/suse/udev.rules +++ b/etc/udev/suse/udev.rules @@ -46,7 +46,7 @@ SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8006/*", RUN+="/sbin/fxload SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8001/*", RUN+="/sbin/startproc /usr/bin/us428control" SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startproc /usr/bin/us428control" SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" -SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/dev.d/snd/hwC0D2/alsa" +SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" # OpenCT (SmartCard) SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="973/1*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" @@ -221,7 +221,8 @@ KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PA # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" KERNEL=="sr*", GOTO="persistent_end" -IMPORT="/sbin/vol_id --export $tempnode" +KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" +KERNEL=="*[!0-9]", SYSFS{range}=="[1-9]*", IMPORT="/sbin/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="persistent_end" diff --git a/udevstart.c b/udevstart.c index 4288db9d38..23a13e08ff 100644 --- a/udevstart.c +++ b/udevstart.c @@ -315,10 +315,7 @@ static void udev_scan_class(void) snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name); dirname2[sizeof(dirname2)-1] = '\0'; - /* pass the net class as it is */ - if (strcmp(dent->d_name, "net") == 0) - device_list_insert(dirname2, "net", &device_list); - else if (has_devt(dirname2)) + if (has_devt(dirname2) || strcmp(dent->d_name, "net") == 0) device_list_insert(dirname2, dent->d_name, &device_list); } closedir(dir2); -- cgit v1.2.3-54-g00ecf From 27f877e60f1c1793d6fafdd888e7e367c44b2eb9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Aug 2005 17:32:59 +0200 Subject: allow logging of all output from executed tools If USE_DEBUG=true and udev_log="debug", all output of the forked programs to stdout and stderr is send to syslog. Signed-off-by: Kay Sievers --- extras/run_directory/run_directory.c | 4 +- udev.c | 3 +- udev_rules.c | 6 +- udev_utils.h | 6 +- udev_utils_run.c | 156 ++++++++++++++++++++++++++--------- udevstart.c | 3 +- 6 files changed, 132 insertions(+), 46 deletions(-) diff --git a/extras/run_directory/run_directory.c b/extras/run_directory/run_directory.c index 770d8d84a1..5107f85aef 100644 --- a/extras/run_directory/run_directory.c +++ b/extras/run_directory/run_directory.c @@ -27,7 +27,7 @@ #include "../../logging.h" #include "run_directory.h" -static int run_program(const char *filename, const char *subsystem) +static int exec_program(const char *filename, const char *subsystem) { pid_t pid; @@ -59,7 +59,7 @@ int run_directory(const char *dir, const char *suffix, const char *subsystem) add_matching_files(&name_list, dir, suffix); list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - run_program(name_loop->name, subsystem); + exec_program(name_loop->name, subsystem); list_del(&name_loop->node); } diff --git a/udev.c b/udev.c index ecfd5644ec..d50f81ea5e 100644 --- a/udev.c +++ b/udev.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "libsysfs/sysfs/libsysfs.h" #include "udev_libc_wrapper.h" @@ -127,7 +128,7 @@ int main(int argc, char *argv[], char *envp[]) if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action); else - execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); + run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_DEBUG)); } } diff --git a/udev_rules.c b/udev_rules.c index d42b219d7d..8587b02549 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -221,7 +222,7 @@ static int import_program_into_env(struct udevice *udev, const char *program) char result[1024]; size_t reslen; - if (execute_program(program, udev->subsystem, result, sizeof(result), &reslen) != 0) + if (run_program(program, udev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_DEBUG)) != 0) return -1; return import_keys_into_env(udev, result, reslen); } @@ -833,8 +834,9 @@ try_parent: strlcpy(program, key_val(rule, &rule->program), sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); dbg("check for PROGRAM program='%s", program); - if (execute_program(program, udev->subsystem, result, sizeof(result), NULL) != 0) { + if (run_program(program, udev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_DEBUG)) != 0) { dbg("PROGRAM is false"); + udev->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) goto exit; } else { diff --git a/udev_utils.h b/udev_utils.h index 5b223855b6..a3fc283203 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -24,6 +24,8 @@ #include "udev.h" #include "list.h" +#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) + struct name_entry { struct list_head node; char name[PATH_SIZE]; @@ -45,7 +47,7 @@ extern int name_list_add(struct list_head *name_list, const char *name, int sort extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); extern int pass_env_to_socket(const char *name, const char *devpath, const char *action); -extern int execute_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen); +extern int run_program(const char *command, const char *subsystem, + char *result, size_t ressize, size_t *reslen, int log); #endif diff --git a/udev_utils_run.c b/udev_utils_run.c index c2e77cbbcc..50b31781e7 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "udev_libc_wrapper.h" #include "udev.h" @@ -70,20 +71,19 @@ int pass_env_to_socket(const char *sockname, const char *devpath, const char *ac return retval; } -int execute_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen) +int run_program(const char *command, const char *subsystem, + char *result, size_t ressize, size_t *reslen, int dbg) { int retval = 0; - int count; int status; - int pipefds[2]; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; pid_t pid; char *pos; char arg[PATH_SIZE]; char *argv[(sizeof(arg) / 2) + 1]; int devnull; int i; - size_t len; strlcpy(arg, command, sizeof(arg)); i = 0; @@ -102,7 +102,7 @@ int execute_program(const char *command, const char *subsystem, dbg("arg[%i] '%s'", i, argv[i]); i++; } - argv[i] = NULL; + argv[i] = NULL; dbg("execute '%s' with parsed arguments", arg); } else { argv[0] = arg; @@ -111,8 +111,15 @@ int execute_program(const char *command, const char *subsystem, dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); } - if (result) { - if (pipe(pipefds) != 0) { + /* prepare pipes from child to parent */ + if (result || dbg) { + if (pipe(outpipe) != 0) { + err("pipe failed"); + return -1; + } + } + if (dbg) { + if (pipe(errpipe) != 0) { err("pipe failed"); return -1; } @@ -121,53 +128,127 @@ int execute_program(const char *command, const char *subsystem, pid = fork(); switch(pid) { case 0: - /* child dup2 write side of pipe to STDOUT */ + /* child closes parent ends of pipes */ + if (outpipe[0] > 0) + close(outpipe[0]); + if (errpipe[0] > 0) + close(errpipe[0]); + + /* discard child output or connect to pipe */ devnull = open("/dev/null", O_RDWR); - if (devnull >= 0) { - dup2(devnull, STDIN_FILENO); - if (!result) - dup2(devnull, STDOUT_FILENO); - dup2(devnull, STDERR_FILENO); - close(devnull); + if (devnull < 0) { + err("open /dev/null failed"); + exit(1); } - if (result) - dup2(pipefds[1], STDOUT_FILENO); + dup2(devnull, STDIN_FILENO); + + if (outpipe[1] > 0) + dup2(outpipe[1], STDOUT_FILENO); + else + dup2(devnull, STDOUT_FILENO); + + if (errpipe[1] > 0) + dup2(errpipe[1], STDERR_FILENO); + else + dup2(devnull, STDERR_FILENO); + + close(devnull); execv(arg, argv); + + /* we should never reach this */ err("exec of program failed"); _exit(1); case -1: err("fork of '%s' failed", arg); return -1; default: - /* parent reads from pipefds[0] */ - if (result) { - close(pipefds[1]); - len = 0; - while (1) { - count = read(pipefds[0], result + len, ressize - len-1); - if (count < 0) { - err("read failed with '%s'", strerror(errno)); + /* read from child if requested */ + if (outpipe[0] > 0 || errpipe[0] > 0) { + size_t count; + size_t respos = 0; + + /* parent closes child ends of pipes */ + if (outpipe[1] > 0) + close(outpipe[1]); + if (errpipe[1] > 0) + close(errpipe[1]); + + /* read child output */ + while (outpipe[0] > 0 || errpipe[0] > 0) { + int fdcount; + fd_set readfds; + + FD_ZERO(&readfds); + if (outpipe[0] > 0) + FD_SET(outpipe[0], &readfds); + if (errpipe[0] > 0) + FD_SET(errpipe[0], &readfds); + fdcount = select(UDEV_MAX(outpipe[0], errpipe[0])+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno == EINTR) + continue; retval = -1; break; } - if (count == 0) - break; + /* get stdout */ + if (outpipe[0] > 0 && FD_ISSET(outpipe[0], &readfds)) { + char inbuf[1024]; - len += count; - if (len >= ressize-1) { - err("ressize %ld too short", (long)ressize); - retval = -1; - break; + count = read(outpipe[0], inbuf, sizeof(inbuf)-1); + if (count <= 0) { + close(outpipe[0]); + outpipe[0] = -1; + if (count < 0) { + err("stdin read failed with '%s'", strerror(errno)); + retval = -1; + } + continue; + } + inbuf[count] = '\0'; + dbg("stdout: '%s'", inbuf); + + if (result) { + if (respos + count >= ressize) { + err("ressize %ld too short", (long)ressize); + retval = -1; + continue; + } + memcpy(&result[respos], inbuf, count); + respos += count; + } + } + + /* get stderr */ + if (errpipe[0] > 0 && FD_ISSET(errpipe[0], &readfds)) { + char errbuf[1024]; + + count = read(errpipe[0], errbuf, sizeof(errbuf)-1); + if (count <= 0) { + close(errpipe[0]); + errpipe[0] = -1; + if (count < 0) + err("stderr read failed with '%s'", strerror(errno)); + continue; + } + errbuf[count] = '\0'; + dbg("stderr: '%s'", errbuf); } } - result[len] = '\0'; - close(pipefds[0]); - if (reslen) - *reslen = len; + if (outpipe[0] > 0) + close(outpipe[0]); + if (errpipe[0] > 0) + close(errpipe[0]); + + /* return the childs stdout string */ + if (result) { + result[respos] = '\0'; + dbg("result='%s'", result); + if (reslen) + *reslen = respos; + } } waitpid(pid, &status, 0); - if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { dbg("exec program status 0x%x", status); retval = -1; @@ -176,4 +257,3 @@ int execute_program(const char *command, const char *subsystem, return retval; } - diff --git a/udevstart.c b/udevstart.c index 23a13e08ff..90b87b8377 100644 --- a/udevstart.c +++ b/udevstart.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -164,7 +165,7 @@ run: if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, "add"); else - execute_program(name_loop->name, udev.subsystem, NULL, 0, NULL); + run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_DEBUG)); } } exit: -- cgit v1.2.3-54-g00ecf From 2b996ad19339858ab702c27c9976581ca6784628 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Aug 2005 20:34:24 +0200 Subject: add Usage: to udevmonitor and udevcontrol Signed-off-by: Kay Sievers --- udevcontrol.c | 60 ++++++++++++++++++++++++++++++++++++++--------------------- udevd.c | 16 ++++++++++------ udevmonitor.c | 46 ++++++++++++++++++++++++++++++++------------- 3 files changed, 82 insertions(+), 40 deletions(-) diff --git a/udevcontrol.c b/udevcontrol.c index 5d8fa77683..f16f6a125a 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -64,6 +64,7 @@ int main(int argc, char *argv[], char *envp[]) const char *env; const char *val; int *intval; + int i; int retval = 1; env = getenv("UDEV_LOG"); @@ -73,33 +74,50 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevcontrol"); dbg("version %s", UDEV_VERSION); - if (argc != 2) { - err("error finding comand"); + if (argc < 2) { + fprintf(stderr, "missing command\n\n"); goto exit; } memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); strcpy(usend_msg.magic, UDEV_MAGIC); - if (!strcmp(argv[1], "stop_exec_queue")) - usend_msg.type = UDEVD_STOP_EXEC_QUEUE; - else if (!strcmp(argv[1], "start_exec_queue")) - usend_msg.type = UDEVD_START_EXEC_QUEUE; - else if (!strncmp(argv[1], "log_priority=", strlen("log_priority="))) { - intval = (int *) usend_msg.envbuf; - val = &argv[1][strlen("log_priority=")]; - usend_msg.type = UDEVD_SET_LOG_LEVEL; - *intval = log_priority(val); - info("send log_priority=%i", *intval); - } else if (!strncmp(argv[1], "max_childs=", strlen("max_childs="))) { - intval = (int *) usend_msg.envbuf; - val = &argv[1][strlen("max_childs=")]; - usend_msg.type = UDEVD_SET_MAX_CHILDS; - *intval = atoi(val); - info("send max_childs=%i", *intval); - } else { - err("error parsing command\n"); - goto exit; + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (!strcmp(arg, "stop_exec_queue")) + usend_msg.type = UDEVD_STOP_EXEC_QUEUE; + else if (!strcmp(arg, "start_exec_queue")) + usend_msg.type = UDEVD_START_EXEC_QUEUE; + else if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { + intval = (int *) usend_msg.envbuf; + val = &arg[strlen("log_priority=")]; + usend_msg.type = UDEVD_SET_LOG_LEVEL; + *intval = log_priority(val); + info("send log_priority=%i", *intval); + } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { + intval = (int *) usend_msg.envbuf; + val = &arg[strlen("max_childs=")]; + usend_msg.type = UDEVD_SET_MAX_CHILDS; + *intval = atoi(val); + info("send max_childs=%i", *intval); + } else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + printf("Usage: udevcontrol COMMAND\n" + " log_priority= set the udev log level for the daemon\n" + " stop_exec_queue keep udevd from executing events, queue only\n" + " start_exec_queue execute events, flush queue\n" + " max_childs= maximum number of childs running at the same time\n" + " --help print this help text\n\n"); + exit(0); + } else { + fprintf(stderr, "unknown option\n\n"); + exit(1); + } + } + + if (getuid() != 0) { + fprintf(stderr, "need to be root, exit\n\n"); + exit(1); } sock = socket(AF_LOCAL, SOCK_DGRAM, 0); diff --git a/udevd.c b/udevd.c index d51ed2f7b0..1575da8d5a 100644 --- a/udevd.c +++ b/udevd.c @@ -54,7 +54,7 @@ static int udevd_sock; static int uevent_netlink_sock; static pid_t sid; -static int pipefds[2]; +static int pipefds[2] = {-1, -1}; static volatile int sigchilds_waiting; static volatile int run_msg_q; static volatile int sig_flag; @@ -843,11 +843,10 @@ int main(int argc, char *argv[], char *envp[]) /* Set fds to dev/null */ fd = open( "/dev/null", O_RDWR ); if (fd >= 0) { - dup2(fd, 0); - dup2(fd, 1); - dup2(fd, 2); - if (fd > 2) - close(fd); + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + close(fd); } else err("error opening /dev/null %s", strerror(errno)); @@ -1012,6 +1011,11 @@ int main(int argc, char *argv[], char *envp[]) } exit: + if (pipefds[0] > 0) + close(pipefds[0]); + if (pipefds[1] > 0) + close(pipefds[1]); + if (udevd_sock > 0) close(udevd_sock); diff --git a/udevmonitor.c b/udevmonitor.c index 3a71d002f5..2efb705b6d 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -33,6 +33,7 @@ #include "udev.h" #include "udevd.h" +#include "udev_utils.h" #include "udev_libc_wrapper.h" static int uevent_netlink_sock; @@ -102,25 +103,42 @@ static int init_uevent_netlink_sock(void) int main(int argc, char *argv[]) { int env = 0; - int maxsockplus; fd_set readfds; + int i; int retval; + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + if (strcmp(arg, "--env") == 0 || strcmp(arg, "-e") == 0) { + env = 1; + } + else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0){ + printf("Usage: udevmonitor [--env]\n" + " --env print the whole event environment\n" + " --help print this help text\n\n"); + exit(0); + } else { + fprintf(stderr, "unknown option\n\n"); + exit(1); + } + } + if (getuid() != 0) { - printf("need to be root, exit\n"); + fprintf(stderr, "need to be root, exit\n\n"); exit(1); } - if (argc == 2 && strstr(argv[1], "--env")) - env = 1; - init_uevent_netlink_sock(); init_udev_monitor_socket(); + printf("udevmonitor prints received from the kernel [UEVENT] and after\n" + "the udev processing, the event which udev [UDEV] has generated\n\n"); + FD_ZERO(&readfds); - FD_SET(uevent_netlink_sock, &readfds); - FD_SET(udev_monitor_sock, &readfds); - maxsockplus = udev_monitor_sock+1; + if (uevent_netlink_sock > 0) + FD_SET(uevent_netlink_sock, &readfds); + if (udev_monitor_sock > 0) + FD_SET(udev_monitor_sock, &readfds); while (1) { static char buf[UEVENT_BUFFER_SIZE*2]; @@ -130,14 +148,14 @@ int main(int argc, char *argv[]) buflen = 0; workreadfds = readfds; - retval = select(maxsockplus, &workreadfds, NULL, NULL, NULL); + retval = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &workreadfds, NULL, NULL, NULL); if (retval < 0) { if (errno != EINTR) fprintf(stderr, "error receiving uevent message\n"); continue; } - if (FD_ISSET(uevent_netlink_sock, &workreadfds)) { + if ((uevent_netlink_sock > 0) && FD_ISSET(uevent_netlink_sock, &workreadfds)) { buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); if (buflen <= 0) { fprintf(stderr, "error receiving uevent message\n"); @@ -146,7 +164,7 @@ int main(int argc, char *argv[]) printf("UEVENT[%i] %s\n", time(NULL), buf); } - if (FD_ISSET(udev_monitor_sock, &workreadfds)) { + if ((udev_monitor_sock > 0) && FD_ISSET(udev_monitor_sock, &workreadfds)) { buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); if (buflen <= 0) { fprintf(stderr, "error receiving udev message\n"); @@ -180,7 +198,9 @@ int main(int argc, char *argv[]) } } - close(uevent_netlink_sock); - close(udev_monitor_sock); + if (uevent_netlink_sock > 0) + close(uevent_netlink_sock); + if (udev_monitor_sock > 0) + close(udev_monitor_sock); exit(1); } -- cgit v1.2.3-54-g00ecf From 4937afa402bf142429f0ac6dfc7e1bf8172faa62 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Aug 2005 21:01:46 +0200 Subject: move some logging to the info level Signed-off-by: Kay Sievers --- etc/udev/suse/udev.rules | 2 +- udev.c | 1 + udev_rules.c | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/etc/udev/suse/udev.rules b/etc/udev/suse/udev.rules index b0c1f1adcb..0e3d06817a 100644 --- a/etc/udev/suse/udev.rules +++ b/etc/udev/suse/udev.rules @@ -234,7 +234,7 @@ SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" # libusb device access (mount usbfs or usbdev nodes) DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb" -SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK="%c" +SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" # firmware loader SUBSYSTEM=="firmware", ACTION=="add", RUN+="/etc/hotplug.d/firmware/50-firmware.hotplug" diff --git a/udev.c b/udev.c index d50f81ea5e..f0b2800a91 100644 --- a/udev.c +++ b/udev.c @@ -125,6 +125,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("executing run list"); list_for_each_entry(name_loop, &udev.run_list, node) { + info("RUN key executes '%s'", name_loop->name); if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action); else diff --git a/udev_rules.c b/udev_rules.c index 8587b02549..40c010c63f 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -808,7 +808,7 @@ try_parent: apply_format(udev, import, sizeof(import), class_dev, sysfs_device); dbg("check for IMPORT import='%s'", import); if (rule->import_type == IMPORT_PROGRAM) { - dbg("run executable file import='%s'", import); + info("IMPORT executes '%s'", import); rc = import_program_into_env(udev, import); } else if (rule->import_type == IMPORT_FILE) { dbg("import file import='%s'", import); @@ -833,7 +833,7 @@ try_parent: strlcpy(program, key_val(rule, &rule->program), sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - dbg("check for PROGRAM program='%s", program); + info("PROGRAM key executes '%s", program); if (run_program(program, udev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_DEBUG)) != 0) { dbg("PROGRAM is false"); udev->program_result[0] = '\0'; @@ -1033,7 +1033,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s if (!name_set) { strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); - info("no rule found, will use kernel name '%s'", udev->name); + info("no node name set, will use kernel name '%s'", udev->name); } if (udev->tmp_node[0] != '\0') { -- cgit v1.2.3-54-g00ecf From 02a9a08fb7c37c1142441ba74333b2c7a1084a99 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 11 Aug 2005 13:02:44 -0700 Subject: update gentoo rule file. This fixes the issue of cdroms not showing up in the proper group, and them showing up in /dev/cd/ for the persistant names. Signed-off-by: Greg Kroah-Hartman --- etc/udev/gentoo/udev.rules | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index d208f5068d..1c1bfed81d 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -37,7 +37,8 @@ BUS=="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYM BUS=="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" BUS=="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -# devfs-names for ide-devices (uncomment only one) +# devfs-names for ide-devices +# Note, this is going away soon... # /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names BUS=="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK+="%c{1} %c{2}", GROUP="%c{3}" @@ -243,8 +244,9 @@ KERNEL=="issm*", NAME="infiniband/%k" # tpm devices KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" -# block device disk id's -SUBSYSTEM=="block", GROUP="disk", MODE="0640" +####################################### +# Persistant block device stuff - begin +####################################### # skip accessing removable ide devices, cause the ide drivers are horrible broken SUBSYSTEM=="block", BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" @@ -252,25 +254,25 @@ SUBSYSTEM=="block", BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id" # persistent disk device links /dev/disk/ KERNEL=="hd*[!0-9]", ACTION=="add", IMPORT="/etc/udev/scripts/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]", ACTION=="add", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" +KERNEL=="sd*[!0-9]", ACTION=="add", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/etc/udev/scripts/usb_id -x" KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/etc/udev/scripts/scsi_id -g -x -s %p" KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/etc/udev/scripts/scsi_id -g -x -a -s %p" -KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # Skip id for ram / loop / fd SUBSYSTEM=="block", KERNEL=="ram*", GOTO="no_volume_id" SUBSYSTEM=="block", KERNEL=="loop*", GOTO="no_volume_id" SUBSYSTEM=="block", KERNEL=="fd*", GOTO="no_volume_id" -SUBSYSTEM=="block", KERNEL=="*[!0-9]", ACTION=="add", ENV{ID_TYPE}=="?*", IMPORT="/etc/udev/scripts/path_id %p", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}" +SUBSYSTEM=="block", KERNEL=="*[!0-9]", ACTION=="add", ENV{ID_TYPE}=="?*", IMPORT="/etc/udev/scripts/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*" -SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", ENV{ID_PATH}=="?*", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n" +SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # volume-label/uuid SUBSYSTEM=="block", KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" @@ -280,6 +282,9 @@ SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-u SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" SUBSYSTEM=="block", LABEL="no_volume_id" +##################################### +# Persistant block device stuff - end +##################################### # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems # run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart -- cgit v1.2.3-54-g00ecf From 8f6919e6390d79a2765e1dc9b0057412e987dce2 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 11 Aug 2005 13:59:21 -0700 Subject: Created cdrom_id program to make it easier to determine cdrom types Based on the framework from ata_id by Kay. Now we can drop the cdsymlinks.sh and .c files Signed-off-by: Greg Kroah-Hartman --- extras/cdrom_id/Makefile | 51 ++++++++++++++++++ extras/cdrom_id/cdrom_id.c | 129 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 180 insertions(+) create mode 100644 extras/cdrom_id/Makefile create mode 100644 extras/cdrom_id/cdrom_id.c diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile new file mode 100644 index 0000000000..44c9ba2b08 --- /dev/null +++ b/extras/cdrom_id/Makefile @@ -0,0 +1,51 @@ +# Makefile for cdrom_id +# +# Copyright (C) 2004 Kay Sievers +# Copyright (C) 2005 Greg Kroah-Hartman +# +# 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. +# + +PROG = cdrom_id + +all: $(PROG) + +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin +mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +OBJS = cdrom_id.o ../../udev.a + +$(OBJS): $(HEADERS) + +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + +$(PROG): $(OBJS) $(HEADERS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + +install: all + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + +uninstall: + - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c new file mode 100644 index 0000000000..7d97d0b07b --- /dev/null +++ b/extras/cdrom_id/cdrom_id.c @@ -0,0 +1,129 @@ +/* + * cdrom_id - determines the capabilities of cdrom drives + * + * Copyright (C) 2005 Greg Kroah-Hartman + * + * 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. + * + * Framework based on ata_id which is: + * Copyright (C) 2005 Kay Sievers + * + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../logging.h" +#include "../../udev_utils.h" + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +int main(int argc, char *argv[]) +{ + const char *node = NULL; + int i; + int export = 0; + int fd; + int rc = 0; + int result; + + logging_init("cdrom_id"); + + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--export") == 0) { + export = 1; + } else + node = arg; + } + if (!node) { + err("no node specified"); + rc = 1; + goto exit; + } + + fd = open(node, O_RDONLY); + if (fd < 0) + if (errno == ENOMEDIUM) + fd = open(node, O_RDONLY|O_NONBLOCK); + if (fd < 0) { + err("unable to open '%s'", node); + rc = 1; + goto exit; + } + + result = ioctl(fd, CDROM_GET_CAPABILITY); + if (result < 0) { + err("CDROM_GET_CABILITY failed for '%s'", node); + rc = 3; + goto close; + } + + printf("ID_CDC=true\n"); + + if (result & CDC_CD_R) + printf("ID_CDC_CD_R=true\n"); + if (result & CDC_CD_RW) + printf("ID_CDC_CD_RW=true\n"); + + if (result & CDC_DVD) + printf("ID_CDC_DVD=true\n"); + if (result & CDC_DVD_R) + printf("ID_CDC_DVD_R=true\n"); + if (result & CDC_DVD_RAM) + printf("ID_CDC_DVD_RAM=true\n"); + + if (result & CDC_MRW) + printf("ID_CDC_MRW=true\n"); + if (result & CDC_MRW_W) + printf("ID_CDC_MRW_W=true\n"); + + if (result & CDC_RAM) + printf("ID_CDC_RAM=true\n"); + goto close; + +close: + close(fd); +exit: + logging_close(); + return rc; +} -- cgit v1.2.3-54-g00ecf From 8ee99e32799956f23bfd898c48b1276ed47d5c1d Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 11 Aug 2005 14:04:24 -0700 Subject: changed cdrom_id exports to be easier to understand and consistant with other _id programs. Signed-off-by: Greg Kroah-Hartman --- extras/cdrom_id/cdrom_id.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 7d97d0b07b..f0acedd1cc 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -98,27 +98,27 @@ int main(int argc, char *argv[]) goto close; } - printf("ID_CDC=true\n"); + printf("ID_CDROM=1\n"); if (result & CDC_CD_R) - printf("ID_CDC_CD_R=true\n"); + printf("ID_CDROM_CD_R=1\n"); if (result & CDC_CD_RW) - printf("ID_CDC_CD_RW=true\n"); + printf("ID_CDROM_CD_RW=1\n"); if (result & CDC_DVD) - printf("ID_CDC_DVD=true\n"); + printf("ID_CDROM_DVD=1\n"); if (result & CDC_DVD_R) - printf("ID_CDC_DVD_R=true\n"); + printf("ID_CDROM_DVD_R=1\n"); if (result & CDC_DVD_RAM) - printf("ID_CDC_DVD_RAM=true\n"); + printf("ID_CDROM_DVD_RAM=1\n"); if (result & CDC_MRW) - printf("ID_CDC_MRW=true\n"); + printf("ID_CDROM_MRW=1\n"); if (result & CDC_MRW_W) - printf("ID_CDC_MRW_W=true\n"); + printf("ID_CDROM_MRW_W=1\n"); if (result & CDC_RAM) - printf("ID_CDC_RAM=true\n"); + printf("ID_CDROM_RAM=1\n"); goto close; close: -- cgit v1.2.3-54-g00ecf From c1986ea33c26fc285688cfbc0a8473cd10c733ca Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 11 Aug 2005 14:37:54 -0700 Subject: added cdrom_id to the build check --- test/simple-build-check.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 521691618a..0112ef78e2 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -7,6 +7,7 @@ EXTRAS="\ extras/volume_id \ extras/usb_id \ extras/dasd_id \ + extras/cdrom_id \ extras/floppy \ extras/run_directory \ extras/firmware" -- cgit v1.2.3-54-g00ecf From 5a64cea1e18dd4e62b6388c8bed86192a1e0c731 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 11 Aug 2005 14:38:33 -0700 Subject: fix klibc build issue in cdrom_id.c Signed-off-by: Greg Kroah-Hartman --- extras/cdrom_id/cdrom_id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index f0acedd1cc..556499b811 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) goto exit; } - result = ioctl(fd, CDROM_GET_CAPABILITY); + result = ioctl(fd, CDROM_GET_CAPABILITY, NULL); if (result < 0) { err("CDROM_GET_CABILITY failed for '%s'", node); rc = 3; @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) printf("ID_CDROM_MRW=1\n"); if (result & CDC_MRW_W) printf("ID_CDROM_MRW_W=1\n"); - + if (result & CDC_RAM) printf("ID_CDROM_RAM=1\n"); goto close; -- cgit v1.2.3-54-g00ecf From 55ac5dad09ce1b7663e17c6f166e6ef74153f93d Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 11 Aug 2005 15:08:08 -0700 Subject: Change the gentoo rules to use cdrom_id instead of cdsymlink.sh Signed-off-by: Greg Kroah-Hartman --- etc/udev/gentoo/udev.rules | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 1c1bfed81d..f8f7b45bb0 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -33,14 +33,13 @@ KERNEL=="ircomm*", NAME="%k", GROUP="tty" SUBSYSTEM=="block", GROUP="disk" # cdrom symlinks and other good cdrom naming -BUS=="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS=="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS=="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" - -# devfs-names for ide-devices -# Note, this is going away soon... -# /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -BUS=="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK+="%c{1} %c{2}", GROUP="%c{3}" +BUS=="ide", KERNEL=="hd[a-z]", ACTION=="add", IMPORT="/etc/udev/scripts/cdrom_id --export $tempnode" +BUS=="scsi", KERNEL="sr[0-9]*", ACTION=="add", IMPORT="/etc/udev/scripts/cdrom_id --export $tempnode" +BUS=="scsi", KERNEL="scd[a-z]", ACTION=="add", IMPORT="/etc/udev/scripts/cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%e", GROUP="cdrom" +ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%e" +ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%e" +ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw%e" # disk devices KERNEL=="sd*", NAME="%k", GROUP="disk" -- cgit v1.2.3-54-g00ecf From 91a8b5315930e18e912a7858e2415d77ec7cf4db Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 11 Aug 2005 15:10:10 -0700 Subject: changed location of gentoo helper apps to be /sbin instead of in scripts dir Signed-off-by: Greg Kroah-Hartman --- etc/udev/gentoo/udev.rules | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index f8f7b45bb0..d3f6c9b63f 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -33,9 +33,9 @@ KERNEL=="ircomm*", NAME="%k", GROUP="tty" SUBSYSTEM=="block", GROUP="disk" # cdrom symlinks and other good cdrom naming -BUS=="ide", KERNEL=="hd[a-z]", ACTION=="add", IMPORT="/etc/udev/scripts/cdrom_id --export $tempnode" -BUS=="scsi", KERNEL="sr[0-9]*", ACTION=="add", IMPORT="/etc/udev/scripts/cdrom_id --export $tempnode" -BUS=="scsi", KERNEL="scd[a-z]", ACTION=="add", IMPORT="/etc/udev/scripts/cdrom_id --export $tempnode" +BUS=="ide", KERNEL=="hd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" +BUS=="scsi", KERNEL="sr[0-9]*", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" +BUS=="scsi", KERNEL="scd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%e", GROUP="cdrom" ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%e" ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%e" @@ -252,14 +252,14 @@ SUBSYSTEM=="block", BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" SUBSYSTEM=="block", BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id" # persistent disk device links /dev/disk/ -KERNEL=="hd*[!0-9]", ACTION=="add", IMPORT="/etc/udev/scripts/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ACTION=="add", IMPORT="/sbin/ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]", ACTION=="add", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" -KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/etc/udev/scripts/usb_id -x" -KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/etc/udev/scripts/scsi_id -g -x -s %p" -KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/etc/udev/scripts/scsi_id -g -x -a -s %p" +KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" +KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" @@ -269,14 +269,14 @@ SUBSYSTEM=="block", KERNEL=="ram*", GOTO="no_volume_id" SUBSYSTEM=="block", KERNEL=="loop*", GOTO="no_volume_id" SUBSYSTEM=="block", KERNEL=="fd*", GOTO="no_volume_id" -SUBSYSTEM=="block", KERNEL=="*[!0-9]", ACTION=="add", ENV{ID_TYPE}=="?*", IMPORT="/etc/udev/scripts/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +SUBSYSTEM=="block", KERNEL=="*[!0-9]", ACTION=="add", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*" SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # volume-label/uuid SUBSYSTEM=="block", KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" SUBSYSTEM=="block", KERNEL=="sr*", GOTO="no_volume_id" -SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT="/etc/udev/scripts/vol_id --export $tempnode" +SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT="/sbin/vol_id --export $tempnode" SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" SUBSYSTEM=="block", LABEL="no_volume_id" -- cgit v1.2.3-54-g00ecf From a3f47f6319188e45604f42280652b9027323e7b3 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 11 Aug 2005 15:32:14 -0700 Subject: tweak the gentoo rules some more. - make the persistant rules smaller - add usbfs-like device node support Signed-off-by: Greg Kroah-Hartman --- etc/udev/gentoo/udev.rules | 56 +++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 23 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index d3f6c9b63f..f1e38b8d87 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -247,44 +247,54 @@ KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" # Persistant block device stuff - begin ####################################### +# Skip all of this if we are not adding a block device +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + # skip accessing removable ide devices, cause the ide drivers are horrible broken -SUBSYSTEM=="block", BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" -SUBSYSTEM=="block", BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id" +BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" +BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id" # persistent disk device links /dev/disk/ -KERNEL=="hd*[!0-9]", ACTION=="add", IMPORT="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]", ACTION=="add", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" -KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" -KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" -KERNEL=="sd*[!0-9]", ACTION=="add", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # Skip id for ram / loop / fd -SUBSYSTEM=="block", KERNEL=="ram*", GOTO="no_volume_id" -SUBSYSTEM=="block", KERNEL=="loop*", GOTO="no_volume_id" -SUBSYSTEM=="block", KERNEL=="fd*", GOTO="no_volume_id" +KERNEL=="ram*", GOTO="no_volume_id" +KERNEL=="loop*", GOTO="no_volume_id" +KERNEL=="fd*", GOTO="no_volume_id" -SUBSYSTEM=="block", KERNEL=="*[!0-9]", ACTION=="add", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT{parent}=="ID_*" -SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" +KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # volume-label/uuid -SUBSYSTEM=="block", KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" -SUBSYSTEM=="block", KERNEL=="sr*", GOTO="no_volume_id" -SUBSYSTEM=="block", KERNEL=="*[0-9]", ACTION=="add", IMPORT="/sbin/vol_id --export $tempnode" -SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -SUBSYSTEM=="block", LABEL="no_volume_id" +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" +KERNEL=="sr*", GOTO="no_volume_id" +KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" +KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +LABEL="no_volume_id" + +LABEL="persistent_end" ##################################### # Persistant block device stuff - end ##################################### +# usbfs-like device nodes +SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" + + # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems # run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" -- cgit v1.2.3-54-g00ecf From f5bed72a53c16e203d5f822167778355530c362a Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 11 Aug 2005 15:44:08 -0700 Subject: 066 release --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index bc62f95c61..d8c81f67b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Summary of changes from v065 to v066 +============================================ + +Greg Kroah-Hartman: + update gentoo rule file. + Created cdrom_id program to make it easier to determine cdrom types + added cdrom_id to the build check + updated gentoo rule file to handle removable ide devices. + changed cdrom_id exports to be easier to understand and consistant with other _id programs. + fix klibc build issue in cdrom_id.c + Change the gentoo rules to use cdrom_id instead of cdsymlink.sh + changed location of gentoo helper apps to be /sbin instead of in scripts dir + tweak the gentoo rules some more. + +Kay Sievers: + add NETLINK define for the lazy distros + read sysfs attribute also from parent class device + switch some strlcpy's to memcpy + allow clean shutdown of udevd + add flag for reading of precompiled rules + update distro rules files + add SUSE rules + update SUSE rules + add firmware_helper to load firmware + more distro rules updates + update README + remove example rules and put the dev.d stuff into the run_directory folder + trivial text cleanups + update SUSE rules + split udev_util in several files + update SUSE rules + allow logging of all output from executed tools + add Usage: to udevmonitor and udevcontrol + move some logging to the info level + +Thierry Vignaud: + fix udevinfo output + + Summary of changes from v064 to v065 ============================================ diff --git a/Makefile b/Makefile index ecc798de89..53811703d0 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false -VERSION = 065 +VERSION = 066 ROOT = udev DAEMON = udevd SENDER = udevsend diff --git a/udev.spec b/udev.spec index 52bfa2ffae..d64d32c535 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace device manager providing devfs functionality Name: udev -Version: 065 +Version: 066 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 5590ace308dc57821a5704bdf4a6f586ae2fd698 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 12 Aug 2005 00:50:48 +0200 Subject: update SUSE rules don't use ID_TYPE, so cdroms will be in /dev/disk/ Signed-off-by: Kay Sievers --- etc/udev/suse/udev.rules | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/etc/udev/suse/udev.rules b/etc/udev/suse/udev.rules index 0e3d06817a..683a22a2bb 100644 --- a/etc/udev/suse/udev.rules +++ b/etc/udev/suse/udev.rules @@ -195,34 +195,33 @@ SUBSYSTEM!="block", GOTO="persistent_end" KERNEL=="ram*|loop*|fd*", GOTO="persistent_end" # never access removable ide devices, the drivers are causing event loops on open() -SUBSYSTEM=="block", BUS=="ide", SYSFS{removable}="1", GOTO="persistent_end" +SUBSYSTEM=="block", BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\n'" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" KERNEL=="dasd*[!0-9]", IMPORT="/sbin/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # for partitions import parent information KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # by-path (shortest physical path) -KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" KERNEL=="sr*", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" -KERNEL=="*[!0-9]", SYSFS{range}=="[1-9]*", IMPORT="/sbin/vol_id --export $tempnode" +IMPORT="/sbin/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="persistent_end" -- cgit v1.2.3-54-g00ecf From d2e8d41b9c7bacd8169c4cb1d15b7bc95445d34b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 12 Aug 2005 02:07:50 +0200 Subject: fix make install, as we don't provide a default rule set anymore Several people complained about the "default" rules and the "default" setup. Here we start to remove things where we can't hava a "default". The best examples for rules are in the distro folders, just pick the one that matches your needs and start from there. Signed-off-by: Kay Sievers --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 53811703d0..e14cb18981 100644 --- a/Makefile +++ b/Makefile @@ -356,8 +356,9 @@ install-config: $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ fi @if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \ - echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir)/rules.d/50-udev.rules; \ - $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.rules $(DESTDIR)$(configdir)/rules.d/50-udev.rules; \ + echo ; \ + echo "pick a udev rules file from the etc/udev directory that matches your distribution"; \ + echo ; \ fi install-man: -- cgit v1.2.3-54-g00ecf From 903a36495f2c796f15464943ad26bfd76f548b6a Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 12 Aug 2005 11:37:56 -0700 Subject: added the cdrom.h #defines directly into the cdrom_id.c file This solves the problem with building the file against old kernel header files. Signed-off-by: Greg Kroah-Hartman --- extras/cdrom_id/cdrom_id.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 556499b811..3d62781186 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -26,11 +26,42 @@ #include #include #include -#include #include "../../logging.h" #include "../../udev_utils.h" +/* + * Taken from the cdrom.h kernel include file. + * Included here as some distros don't have an updated version + * with all of the DVD flags. So we just include our own, aren't + * we so nice... + */ +#define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ + +/* capability flags used with the uniform CD-ROM driver */ +#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ +#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ +#define CDC_LOCK 0x4 /* disable manual eject */ +#define CDC_SELECT_SPEED 0x8 /* programmable speed */ +#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ +#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ +#define CDC_MCN 0x40 /* Medium Catalog Number */ +#define CDC_MEDIA_CHANGED 0x80 /* media changed */ +#define CDC_PLAY_AUDIO 0x100 /* audio functions */ +#define CDC_RESET 0x200 /* hard reset device */ +#define CDC_IOCTLS 0x400 /* driver has non-standard ioctls */ +#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ +#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ +#define CDC_CD_R 0x2000 /* drive is a CD-R */ +#define CDC_CD_RW 0x4000 /* drive is a CD-RW */ +#define CDC_DVD 0x8000 /* drive is a DVD */ +#define CDC_DVD_R 0x10000 /* drive can write DVD-R */ +#define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */ +#define CDC_MO_DRIVE 0x40000 /* drive is an MO device */ +#define CDC_MRW 0x80000 /* drive can read MRW */ +#define CDC_MRW_W 0x100000 /* drive can write MRW */ +#define CDC_RAM 0x200000 /* ok to open for WRITE */ + #ifdef USE_LOG void log_message(int priority, const char *format, ...) { -- cgit v1.2.3-54-g00ecf From 853ccc433c4d45c3e1da4336f87b458ed10311ca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 13 Aug 2005 00:18:44 +0200 Subject: fix more compiler warnings ... Signed-off-by: Kay Sievers --- extras/scsi_id/scsi_id.c | 26 +++++++++++++------------- extras/usb_id/usb_id.c | 33 ++++++++++++++++++--------------- extras/volume_id/volume_id/util.c | 8 +------- extras/volume_id/volume_id/volume_id.c | 2 +- udev_db.c | 2 +- udev_rules.c | 6 +++--- udev_utils_run.c | 2 +- 7 files changed, 38 insertions(+), 41 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 8e5172f93c..a46d1b377d 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -133,42 +133,42 @@ static void set_str(char *to, const char *from, size_t count) to[j] = '\0'; } -static void set_type(char *to, const char *from, int count) +static void set_type(char *to, const char *from, size_t len) { int type_num; char *eptr; + char *type = "generic"; type_num = strtoul(from, &eptr, 0); if (eptr != from) { switch (type_num) { case 0: - sprintf(to, "disk"); + type = "disk"; break; case 1: - sprintf(to, "tape"); + type = "tape"; break; case 4: - sprintf(to, "optical"); + type = "optical"; break; case 5: - sprintf(to, "cd"); + type = "cd"; break; case 7: - sprintf(to, "optical"); + type = "optical"; break; case 0xe: - sprintf(to, "disk"); + type = "disk"; break; case 0xf: - sprintf(to, "optical"); + type = "optical"; break; default: - sprintf(to, "generic"); break; } - } else { - sprintf(to, "generic"); } + strncpy(to, type, len); + to[len-1] = '\0'; } static int get_major_minor(struct sysfs_class_device *class_dev, int *maj, @@ -475,7 +475,7 @@ static int set_options(int argc, char **argv, const char *short_opts, */ optind = 1; while (1) { - option = getopt(argc, argv, short_options); + option = getopt(argc, argv, short_opts); if (option == -1) break; @@ -601,7 +601,7 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, scsi_dev->name); return -1; } - set_type(type_str, type->value, sizeof(type_str)-1); + set_type(type_str, type->value, sizeof(type_str)); type = sysfs_get_device_attr(scsi_dev, "rev"); if (!type) { diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 37db6d14db..f5ee795924 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -119,25 +119,26 @@ static void set_str(char *to, const char *from, size_t count) * * Set the type based on the USB interface class */ -static void set_usb_iftype(char *to, const char *from, int count) +static void set_usb_iftype(char *to, const char *from, size_t len) { int type_num; char *eptr; + char *type = "generic"; type_num = strtoul(from, &eptr, 0); if (eptr != from) { switch (type_num) { case 1: - sprintf(to, "audio"); + type = "audio"; break; case 3: - sprintf(to, "hid"); + type = "hid"; break; case 7: - sprintf(to, "printer"); + type = "printer"; break; case 8: - sprintf(to, "disk"); + type = "disk"; break; case 2: /* CDC-Control */ case 5: /* Physical */ @@ -152,12 +153,11 @@ static void set_usb_iftype(char *to, const char *from, int count) case 0xf2: /* Application-specific */ case 0xff: /* Vendor-specific */ default: - sprintf(to, "generic"); break; } - } else { - sprintf(to, "generic"); } + strncpy(to, type, len); + to[len-1] = '\0'; } /* @@ -166,32 +166,35 @@ static void set_usb_iftype(char *to, const char *from, int count) * Set the type base on the interfaceSubClass. * Valid for Mass-Storage devices (type 8) only. */ -static int set_usb_ifsubtype(char *to, const char *from, int count) +static int set_usb_ifsubtype(char *to, const char *from, size_t len) { int type_num = 0; char *eptr; + char *type = "generic"; type_num = strtoul(from, &eptr, 0); if (eptr != from) { switch (type_num) { case 2: - sprintf(to, "cd"); + type = "cd"; break; case 3: - sprintf(to, "tape"); + type = "tape"; break; case 4: /* UFI */ case 5: /* SFF-8070i */ - sprintf(to, "floppy"); + type = "floppy"; break; case 1: /* RBC devices */ case 6: /* Transparent SPC-2 devices */ - sprintf(to, "disk"); + type = "disk"; + break; + default: break; } - } else { - sprintf(to, "generic"); } + strncpy(to, type, len); + to[len-1] = '\0'; return type_num; } diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index a145a8aa2f..868d67306c 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -114,12 +114,6 @@ void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t co id->label_raw_len = count; } -static size_t my_strnlen(const char *s, size_t max) { - const char *p = s; - for (; *p && max--; ++p); - return(p - s); -} - void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) { unsigned int i; @@ -127,7 +121,7 @@ void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t memcpy(id->label, buf, count); /* remove trailing whitespace */ - i = my_strnlen(id->label, count); + i = strnlen(id->label, count); while (i--) { if (!isspace(id->label[i])) break; diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 4c4a42a00d..e7d4d75666 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -227,7 +227,7 @@ struct volume_id *volume_id_open_dev_t(dev_t devt) snprintf(tmp_node, VOLUME_ID_PATH_MAX, "/dev/.volume_id-%u-%u-%u", getpid(), major(devt), minor(devt)); - tmp_node[VOLUME_ID_PATH_MAX] = '\0'; + tmp_node[VOLUME_ID_PATH_MAX-1] = '\0'; /* create tempory node to open the block device */ unlink(tmp_node); diff --git a/udev_db.c b/udev_db.c index f9adf5c631..ac5a7e6d65 100644 --- a/udev_db.c +++ b/udev_db.c @@ -262,7 +262,7 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) nodename[count-2] = '\0'; dbg("compare '%s' '%s'", nodename, name); if (strcmp(nodename, name) == 0) { - memcpy(devpath, &bufline[2], count-2); + strlcpy(devpath, nodename, len); devpath[count-2] = '\0'; file_unmap(buf, bufsize); closedir(dir); diff --git a/udev_rules.c b/udev_rules.c index 40c010c63f..791e98ec07 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -270,7 +270,7 @@ static int import_parent_into_env(struct udevice *udev, struct sysfs_class_devic /* finds the lowest positive N such that N isn't present in the udevdb * if doesn't exist, 0 is returned, N otherwise */ -static int find_free_number(struct udevice *udev, const char *name) +static int find_free_number(const char *name) { char devpath[PATH_SIZE]; char filename[PATH_SIZE]; @@ -397,7 +397,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, { .name = "modalias", .fmt = 'A', .type = SUBST_MODALIAS }, { .name = "env", .fmt = 'E', .type = SUBST_ENV }, - {} + { NULL, '\0', 0 } }; enum subst_type type; const struct subst_map *subst; @@ -546,7 +546,7 @@ found: dbg("substitute sysfs value '%s'", temp2); break; case SUBST_ENUM: - next_free_number = find_free_number(udev, string); + next_free_number = find_free_number(string); if (next_free_number > 0) { sprintf(temp2, "%d", next_free_number); strlcat(string, temp2, maxsize); diff --git a/udev_utils_run.c b/udev_utils_run.c index 50b31781e7..44fb7f8316 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -164,7 +164,7 @@ int run_program(const char *command, const char *subsystem, default: /* read from child if requested */ if (outpipe[0] > 0 || errpipe[0] > 0) { - size_t count; + ssize_t count; size_t respos = 0; /* parent closes child ends of pipes */ -- cgit v1.2.3-54-g00ecf From 7d38d2287c882ffee02b5f285f2ee5bb60de0efa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 13 Aug 2005 02:19:22 +0200 Subject: fix udevstart event ordering, we want /dev/null very early --- udevstart.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/udevstart.c b/udevstart.c index 90b87b8377..3a715a609f 100644 --- a/udevstart.c +++ b/udevstart.c @@ -77,11 +77,12 @@ static int device_list_insert(const char *path, char *subsystem, struct list_hea { struct device *loop_device; struct device *new_device; + const char *devpath = &path[strlen(sysfs_path)]; - dbg("insert: '%s'\n", path); + dbg("insert: '%s'\n", devpath); list_for_each_entry(loop_device, device_list, node) { - if (strcmp(loop_device->path, path) > 0) { + if (strcmp(loop_device->path, devpath) > 0) { break; } } @@ -92,7 +93,7 @@ static int device_list_insert(const char *path, char *subsystem, struct list_hea return -ENOMEM; } - strlcpy(new_device->path, path, sizeof(new_device->path)); + strlcpy(new_device->path, devpath, sizeof(new_device->path)); strlcpy(new_device->subsys, subsystem, sizeof(new_device->subsys)); list_add_tail(&new_device->node, &loop_device->node); dbg("add '%s' from subsys '%s'", new_device->path, new_device->subsys); @@ -107,17 +108,16 @@ static char *last_list[] = { /* list of devices that we should run first due to any one of a number of reasons */ static char *first_list[] = { - "/class/mem", /* people tend to like their memory devices around first... */ + "/class/mem", + "/class/tty", NULL, }; -static int add_device(const char *path, const char *subsystem) +static int add_device(const char *devpath, const char *subsystem) { struct udevice udev; struct sysfs_class_device *class_dev; - const char *devpath; - - devpath = &path[strlen(sysfs_path)]; + char path[PATH_SIZE]; /* clear and set environment for next event */ clearenv(); @@ -129,8 +129,10 @@ static int add_device(const char *path, const char *subsystem) setenv("UDEV_LOG", udev_log_str, 1); if (udev_run_str) setenv("UDEV_RUN", udev_run_str, 1); - dbg("exec: '%s' (%s)\n", devpath, path); + dbg("add '%s'", devpath); + snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); + path[sizeof(path)-1] = '\0'; class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { dbg("sysfs_open_class_device_path failed"); @@ -218,12 +220,12 @@ static void exec_list(struct list_head *device_list) } } -static int has_devt(const char *directory) +static int has_devt(const char *path) { char filename[PATH_SIZE]; struct stat statbuf; - snprintf(filename, sizeof(filename), "%s/dev", directory); + snprintf(filename, sizeof(filename), "%s/dev", path); filename[sizeof(filename)-1] = '\0'; if (stat(filename, &statbuf) == 0) @@ -232,12 +234,11 @@ static int has_devt(const char *directory) return 0; } -static void udev_scan_block(void) +static void udev_scan_block(struct list_head *device_list) { char base[PATH_SIZE]; DIR *dir; struct dirent *dent; - LIST_HEAD(device_list); snprintf(base, sizeof(base), "%s/block", sysfs_path); base[sizeof(base)-1] = '\0'; @@ -255,7 +256,7 @@ static void udev_scan_block(void) snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); dirname[sizeof(dirname)-1] = '\0'; if (has_devt(dirname)) - device_list_insert(dirname, "block", &device_list); + device_list_insert(dirname, "block", device_list); else continue; @@ -272,22 +273,20 @@ static void udev_scan_block(void) dirname2[sizeof(dirname2)-1] = '\0'; if (has_devt(dirname2)) - device_list_insert(dirname2, "block", &device_list); + device_list_insert(dirname2, "block", device_list); } closedir(dir2); } } closedir(dir); } - exec_list(&device_list); } -static void udev_scan_class(void) +static void udev_scan_class(struct list_head *device_list) { char base[PATH_SIZE]; DIR *dir; struct dirent *dent; - LIST_HEAD(device_list); snprintf(base, sizeof(base), "%s/class", sysfs_path); base[sizeof(base)-1] = '\0'; @@ -317,14 +316,13 @@ static void udev_scan_class(void) dirname2[sizeof(dirname2)-1] = '\0'; if (has_devt(dirname2) || strcmp(dent->d_name, "net") == 0) - device_list_insert(dirname2, dent->d_name, &device_list); + device_list_insert(dirname2, dent->d_name, device_list); } closedir(dir2); } } closedir(dir); } - exec_list(&device_list); } static void asmlinkage sig_handler(int signum) @@ -340,6 +338,7 @@ static void asmlinkage sig_handler(int signum) int main(int argc, char *argv[], char *envp[]) { + LIST_HEAD(device_list); struct sigaction act; logging_init("udevstart"); @@ -367,8 +366,9 @@ int main(int argc, char *argv[], char *envp[]) udev_rules_init(&rules, 0, 1); - udev_scan_block(); - udev_scan_class(); + udev_scan_class(&device_list); + udev_scan_block(&device_list); + exec_list(&device_list); udev_rules_close(&rules); logging_close(); -- cgit v1.2.3-54-g00ecf From af5461f72f86bc00fd40a11a8ac2b6979f8cd61a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 13 Aug 2005 02:36:12 +0200 Subject: don't fail too bad, if /dev/null does not exist Signed-off-by: Kay Sievers --- udev_utils_run.c | 20 ++++++++------------ udevd.c | 14 +++++++------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/udev_utils_run.c b/udev_utils_run.c index 44fb7f8316..cf633661e4 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -136,23 +136,19 @@ int run_program(const char *command, const char *subsystem, /* discard child output or connect to pipe */ devnull = open("/dev/null", O_RDWR); - if (devnull < 0) { + if (devnull > 0) { + dup2(devnull, STDIN_FILENO); + if (outpipe[1] < 0) + dup2(devnull, STDOUT_FILENO); + if (errpipe[1] < 0) + dup2(devnull, STDERR_FILENO); + close(devnull); + } else err("open /dev/null failed"); - exit(1); - } - dup2(devnull, STDIN_FILENO); - if (outpipe[1] > 0) dup2(outpipe[1], STDOUT_FILENO); - else - dup2(devnull, STDOUT_FILENO); - if (errpipe[1] > 0) dup2(errpipe[1], STDERR_FILENO); - else - dup2(devnull, STDERR_FILENO); - - close(devnull); execv(arg, argv); /* we should never reach this */ diff --git a/udevd.c b/udevd.c index 1575da8d5a..8423278d6c 100644 --- a/udevd.c +++ b/udevd.c @@ -785,7 +785,7 @@ int main(int argc, char *argv[], char *envp[]) { int maxsockplus; int retval; - int fd; + int devnull; struct sigaction act; fd_set readfds; const char *value; @@ -841,12 +841,12 @@ int main(int argc, char *argv[], char *envp[]) setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); /* Set fds to dev/null */ - fd = open( "/dev/null", O_RDWR ); - if (fd >= 0) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - close(fd); + devnull = open( "/dev/null", O_RDWR ); + if (devnull > 0) { + dup2(devnull, STDIN_FILENO); + dup2(devnull, STDOUT_FILENO); + dup2(devnull, STDERR_FILENO); + close(devnull); } else err("error opening /dev/null %s", strerror(errno)); -- cgit v1.2.3-54-g00ecf From 8aafc06d943e98dfa4ff8410eb85686e49feccbf Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 13 Aug 2005 10:10:50 -0700 Subject: 067 release --- ChangeLog | 14 ++++++++++++++ Makefile | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d8c81f67b7..f1cf451c44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Summary of changes from v066 to v067 +============================================ + +Greg Kroah-Hartman: + added the cdrom.h #defines directly into the cdrom_id.c file + +Kay Sievers: + update SUSE rules + fix make install, as we don't provide a default rule set anymore + fix more compiler warnings ... + fix udevstart event ordering, we want /dev/null very early + don't fail too bad, if /dev/null does not exist + + Summary of changes from v065 to v066 ============================================ diff --git a/Makefile b/Makefile index e14cb18981..dcfac9cf9d 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false -VERSION = 066 +VERSION = 067 ROOT = udev DAEMON = udevd SENDER = udevsend -- cgit v1.2.3-54-g00ecf From 40caaeec51f5d8f65245932a85396ac85265cbe5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Aug 2005 11:57:04 +0200 Subject: cleanup some debug output and move to info level + unify select() loops Signed-off-by: Kay Sievers --- logging.h | 4 +- udev.c | 3 +- udev_add.c | 2 +- udev_db.c | 2 +- udev_libc_wrapper.h | 9 ++++- udev_remove.c | 2 +- udev_rules.c | 8 ++-- udev_rules_parse.c | 8 +++- udev_utils_run.c | 58 +++++++++++++++++---------- udevd.c | 113 ++++++++++++++++++++++++---------------------------- udeveventrecorder.c | 2 +- udevmonitor.c | 34 ++++++++-------- udevstart.c | 2 +- 13 files changed, 133 insertions(+), 114 deletions(-) diff --git a/logging.h b/logging.h index 0126de99eb..e0dcb80305 100644 --- a/logging.h +++ b/logging.h @@ -38,13 +38,13 @@ #undef err #define err(format, arg...) \ do { \ - log_message(LOG_ERR ,"%s: " format ,__FILE__ ,## arg); \ + log_message(LOG_ERR ,"%s: " format ,__FUNCTION__ ,## arg); \ } while (0) #undef info #define info(format, arg...) \ do { \ - log_message(LOG_INFO ,"%s: " format ,__FILE__ ,## arg); \ + log_message(LOG_INFO ,"%s: " format ,__FUNCTION__ ,## arg); \ } while (0) #ifdef DEBUG diff --git a/udev.c b/udev.c index f0b2800a91..beaa191c04 100644 --- a/udev.c +++ b/udev.c @@ -125,11 +125,10 @@ int main(int argc, char *argv[], char *envp[]) dbg("executing run list"); list_for_each_entry(name_loop, &udev.run_list, node) { - info("RUN key executes '%s'", name_loop->name); if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action); else - run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_DEBUG)); + run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); } } diff --git a/udev_add.c b/udev_add.c index 9d872bf039..9420b4fe14 100644 --- a/udev_add.c +++ b/udev_add.c @@ -215,7 +215,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de strlcat(linktarget, &udev->name[tail], sizeof(linktarget)); - dbg("symlink(%s, %s)", linktarget, filename); + info("creating symlink '%s' to '%s'", filename, linktarget); if (!udev->test_run) { unlink(filename); selinux_setfscreatecon(filename, NULL, S_IFLNK); diff --git a/udev_db.c b/udev_db.c index ac5a7e6d65..632f6f7b2a 100644 --- a/udev_db.c +++ b/udev_db.c @@ -113,7 +113,7 @@ static int parse_db_file(struct udevice *udev, const char *filename) size_t count; if (file_map(filename, &buf, &bufsize) != 0) { - err("unable to read db file '%s'", filename); + dbg("no db file to read '%s'", filename); return -1; } diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index a12af64c24..9dd22175cd 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -22,6 +22,11 @@ #ifndef _UDEV_LIBC_WRAPPER_H_ #define _UDEV_LIBC_WRAPPER_H_ +#include +#include +#include + +/* needed for our signal handlers to work */ #undef asmlinkage #ifdef __i386__ #define asmlinkage __attribute__((regparm(0))) @@ -29,6 +34,7 @@ #define asmlinkage #endif +/* headers are broken on some lazy platforms */ #ifndef __FD_SET #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) #endif @@ -42,12 +48,11 @@ #define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) #endif +/* missing in some lazy distros */ #ifndef NETLINK_KOBJECT_UEVENT #define NETLINK_KOBJECT_UEVENT 15 #endif -#include - #ifdef __KLIBC__ static inline int clearenv(void) { diff --git a/udev_remove.c b/udev_remove.c index 28885d4710..cff940ccfe 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -88,7 +88,7 @@ static int delete_node(struct udevice *udev) continue;; } - dbg("removing symlink '%s'", filename); + info("removing symlink '%s'", filename); unlink(filename); if (strchr(filename, '/')) diff --git a/udev_rules.c b/udev_rules.c index 791e98ec07..7ecca9468e 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -222,7 +222,7 @@ static int import_program_into_env(struct udevice *udev, const char *program) char result[1024]; size_t reslen; - if (run_program(program, udev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_DEBUG)) != 0) + if (run_program(program, udev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_INFO)) != 0) return -1; return import_keys_into_env(udev, result, reslen); } @@ -808,7 +808,6 @@ try_parent: apply_format(udev, import, sizeof(import), class_dev, sysfs_device); dbg("check for IMPORT import='%s'", import); if (rule->import_type == IMPORT_PROGRAM) { - info("IMPORT executes '%s'", import); rc = import_program_into_env(udev, import); } else if (rule->import_type == IMPORT_FILE) { dbg("import file import='%s'", import); @@ -833,8 +832,7 @@ try_parent: strlcpy(program, key_val(rule, &rule->program), sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - info("PROGRAM key executes '%s", program); - if (run_program(program, udev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_DEBUG)) != 0) { + if (run_program(program, udev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_INFO)) != 0) { dbg("PROGRAM is false"); udev->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) @@ -964,7 +962,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s } strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); - info("rule applied, added symlink '%s'", temp); + dbg("rule applied, added symlink '%s'", temp); /* add multiple symlinks separated by spaces */ pos = temp; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 488b7a7ff0..c14164f1cc 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -642,7 +642,13 @@ int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_nam retval = add_matching_files(&name_list, udev_rules_filename, RULEFILE_SUFFIX); list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - parse_file(rules, name_loop->name); + if (stat(name_loop->name, &stats) == 0) { + if (stats.st_size) + parse_file(rules, name_loop->name); + else + dbg("empty rules file '%s'", name_loop->name); + } else + dbg("could not read '%s'", name_loop->name); list_del(&name_loop->node); free(name_loop); } diff --git a/udev_utils_run.c b/udev_utils_run.c index cf633661e4..0ee36d6848 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -46,7 +46,8 @@ int pass_env_to_socket(const char *sockname, const char *devpath, const char *ac char buf[2048]; size_t bufpos = 0; int i; - int retval; + ssize_t count; + int retval = 0; dbg("pass environment to socket '%s'", sockname); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); @@ -63,23 +64,23 @@ int pass_env_to_socket(const char *sockname, const char *devpath, const char *ac bufpos++; } - retval = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, addrlen); - if (retval != -1) - retval = 0; + count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, addrlen); + if (count < 0) + retval = -1; + info("passed %zi bytes to socket '%s', ", count, sockname); close(sock); return retval; } int run_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen, int dbg) + char *result, size_t ressize, size_t *reslen, int log) { int retval = 0; int status; int outpipe[2] = {-1, -1}; int errpipe[2] = {-1, -1}; pid_t pid; - char *pos; char arg[PATH_SIZE]; char *argv[(sizeof(arg) / 2) + 1]; int devnull; @@ -88,7 +89,7 @@ int run_program(const char *command, const char *subsystem, strlcpy(arg, command, sizeof(arg)); i = 0; if (strchr(arg, ' ')) { - pos = arg; + char *pos = arg; while (pos != NULL) { if (pos[0] == '\'') { /* don't separate if in apostrophes */ @@ -103,22 +104,22 @@ int run_program(const char *command, const char *subsystem, i++; } argv[i] = NULL; - dbg("execute '%s' with parsed arguments", arg); + info("'%s'", command); } else { argv[0] = arg; argv[1] = (char *) subsystem; argv[2] = NULL; - dbg("execute '%s' with subsystem '%s' argument", arg, argv[1]); + info("'%s' '%s'", arg, argv[1]); } /* prepare pipes from child to parent */ - if (result || dbg) { + if (result || log) { if (pipe(outpipe) != 0) { err("pipe failed"); return -1; } } - if (dbg) { + if (log) { if (pipe(errpipe) != 0) { err("pipe failed"); return -1; @@ -149,13 +150,13 @@ int run_program(const char *command, const char *subsystem, dup2(outpipe[1], STDOUT_FILENO); if (errpipe[1] > 0) dup2(errpipe[1], STDERR_FILENO); - execv(arg, argv); + execv(argv[0], argv); /* we should never reach this */ err("exec of program failed"); _exit(1); case -1: - err("fork of '%s' failed", arg); + err("fork of '%s' failed", argv[0]); return -1; default: /* read from child if requested */ @@ -190,6 +191,8 @@ int run_program(const char *command, const char *subsystem, /* get stdout */ if (outpipe[0] > 0 && FD_ISSET(outpipe[0], &readfds)) { char inbuf[1024]; + char *pos; + char *line; count = read(outpipe[0], inbuf, sizeof(inbuf)-1); if (count <= 0) { @@ -202,22 +205,28 @@ int run_program(const char *command, const char *subsystem, continue; } inbuf[count] = '\0'; - dbg("stdout: '%s'", inbuf); + /* store result for rule processing */ if (result) { - if (respos + count >= ressize) { + if (respos + count < ressize) { + memcpy(&result[respos], inbuf, count); + respos += count; + } else { err("ressize %ld too short", (long)ressize); retval = -1; - continue; } - memcpy(&result[respos], inbuf, count); - respos += count; } + pos = inbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info("'%s' (stdout) '%s'", argv[0], line); } /* get stderr */ if (errpipe[0] > 0 && FD_ISSET(errpipe[0], &readfds)) { char errbuf[1024]; + char *pos; + char *line; count = read(errpipe[0], errbuf, sizeof(errbuf)-1); if (count <= 0) { @@ -228,7 +237,10 @@ int run_program(const char *command, const char *subsystem, continue; } errbuf[count] = '\0'; - dbg("stderr: '%s'", errbuf); + pos = errbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info("'%s' (stderr) '%s'", argv[0], line); } } if (outpipe[0] > 0) @@ -245,8 +257,12 @@ int run_program(const char *command, const char *subsystem, } } waitpid(pid, &status, 0); - if (!WIFEXITED(status) || (WEXITSTATUS(status) != 0)) { - dbg("exec program status 0x%x", status); + if (WIFEXITED(status)) { + info("'%s' returned with status %i", argv[0], WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + retval = -1; + } else { + err("'%s' abnormal exit", argv[0]); retval = -1; } } diff --git a/udevd.c b/udevd.c index 8423278d6c..79d3e82550 100644 --- a/udevd.c +++ b/udevd.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -62,21 +63,16 @@ static volatile int udev_exit; static int init_phase = 1; static int run_exec_q; static int stop_exec_q; - -static LIST_HEAD(msg_list); -static LIST_HEAD(exec_list); -static LIST_HEAD(running_list); - -static void exec_queue_manager(void); -static void msg_queue_manager(void); -static void user_sighandler(void); -static void reap_sigchilds(void); - static char *udev_bin; -static unsigned long long expected_seqnum; static int event_timeout; static int max_childs; static int max_childs_running; +static unsigned long long expected_seqnum; +static char log[32]; + +static LIST_HEAD(msg_list); +static LIST_HEAD(exec_list); +static LIST_HEAD(running_list); #ifdef USE_LOG @@ -138,7 +134,8 @@ static void msg_queue_insert(struct uevent_msg *msg) /* don't delay messages with timeout set */ if (msg->timeout) { - dbg("move seq %llu with timeout %u to exec queue", msg->seqnum, msg->timeout); + info("seq %llu with timeout %u seconds will be execute without queuing, '%s' '%s'", + msg->seqnum, msg->timeout, msg->action, msg->devpath); list_add(&msg->node, &exec_list); run_exec_q = 1; return; @@ -156,7 +153,7 @@ static void msg_queue_insert(struct uevent_msg *msg) } } list_add(&msg->node, &loop_msg->node); - info("seq %llu queued, devpath '%s'", msg->seqnum, msg->devpath); + info("seq %llu queued, '%s' '%s'", msg->seqnum, msg->action, msg->devpath); /* run msg queue manager */ run_msg_q = 1; @@ -165,7 +162,7 @@ static void msg_queue_insert(struct uevent_msg *msg) } /* forks event and removes event from run queue when finished */ -static void udev_event_fork(struct uevent_msg *msg) +static void udev_event_run(struct uevent_msg *msg) { char *const argv[] = { "udev", msg->subsystem, NULL }; pid_t pid; @@ -190,8 +187,8 @@ static void udev_event_fork(struct uevent_msg *msg) default: /* get SIGCHLD in main loop */ sysinfo(&info); - info("seq %llu forked, pid %d, %ld seconds old", - msg->seqnum, pid, info.uptime - msg->queue_time); + info("seq %llu forked, pid [%d], '%s' '%s', %ld seconds old", + msg->seqnum, pid, msg->action, msg->subsystem, info.uptime - msg->queue_time); msg->pid = pid; } } @@ -385,7 +382,7 @@ static void exec_queue_manager(void) if (running_with_devpath(loop_msg, max_childs) == 0) { /* move event to run list */ list_move_tail(&loop_msg->node, &running_list); - udev_event_fork(loop_msg); + udev_event_run(loop_msg); running++; dbg("moved seq %llu to running list", loop_msg->seqnum); } else @@ -441,7 +438,7 @@ recheck: msg_dump_queue(); /* set timeout for remaining queued events */ - if (list_empty(&msg_list) == 0) { + if (!list_empty(&msg_list)) { struct itimerval itv = {{0, 0}, {timeout - msg_age, 0}}; dbg("next event expires in %li seconds", timeout - msg_age); setitimer(ITIMER_REAL, &itv, NULL); @@ -550,7 +547,7 @@ static struct uevent_msg *get_udevd_msg(void) switch (usend_msg.type) { case UDEVD_UEVENT_UDEVSEND: case UDEVD_UEVENT_INITSEND: - info("udevd event message received"); + dbg("udevd event message received"); envbuf_size = size - offsetof(struct udevd_msg, envbuf); dbg("envbuf_size=%i", envbuf_size); msg = get_msg_from_envbuf(usend_msg.envbuf, envbuf_size); @@ -571,6 +568,8 @@ static struct uevent_msg *get_udevd_msg(void) intval = (int *) usend_msg.envbuf; info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i", *intval); udev_log_priority = *intval; + sprintf(log, "UDEV_LOG=%i", udev_log_priority); + putenv(log); break; case UDEVD_SET_MAX_CHILDS: intval = (int *) usend_msg.envbuf; @@ -658,7 +657,7 @@ static void asmlinkage sig_handler(int signum) * which will wakeup our mainloop */ if (!sig_flag) { - rc = write(pipefds[1],&signum,sizeof(signum)); + rc = write(pipefds[1], &signum, sizeof(signum)); if (rc >= 0) sig_flag = 1; } @@ -688,27 +687,13 @@ static void udev_done(int pid) static void reap_sigchilds(void) { - while(1) { - int pid = waitpid(-1, NULL, WNOHANG); - if ((pid == -1) || (pid == 0)) - break; - udev_done(pid); - } -} - -/* just read everything from the pipe and clear the flag, - * the flags was set in the signal handler - */ -static void user_sighandler(void) -{ - int sig; + pid_t pid; - while(1) { - int rc = read(pipefds[0], &sig, sizeof(sig)); - if (rc < 0) + while (1) { + pid = waitpid(-1, NULL, WNOHANG); + if (pid <= 0) break; - - sig_flag = 0; + udev_done(pid); } } @@ -783,7 +768,6 @@ static int init_uevent_netlink_sock(void) int main(int argc, char *argv[], char *envp[]) { - int maxsockplus; int retval; int devnull; struct sigaction act; @@ -813,6 +797,7 @@ int main(int argc, char *argv[], char *envp[]) stop_exec_q = 1; } } + if (daemonize) { pid_t pid; @@ -856,7 +841,6 @@ int main(int argc, char *argv[], char *envp[]) err("error getting pipes: %s", strerror(errno)); goto exit; } - retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK); if (retval < 0) { err("error fcntl on read pipe: %s", strerror(errno)); @@ -865,7 +849,6 @@ int main(int argc, char *argv[], char *envp[]) retval = fcntl(pipefds[0], F_SETFD, FD_CLOEXEC); if (retval < 0) err("error fcntl on read pipe: %s", strerror(errno)); - retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK); if (retval < 0) { err("error fcntl on write pipe: %s", strerror(errno)); @@ -886,10 +869,6 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGCHLD, &act, NULL); sigaction(SIGHUP, &act, NULL); - if (init_uevent_netlink_sock() < 0) { - dbg("uevent socket not available"); - } - if (init_udevd_socket() < 0) { if (errno == EADDRINUSE) dbg("another udevd running, exit"); @@ -899,6 +878,9 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + if (init_uevent_netlink_sock() < 0) + info("uevent socket not available"); + /* override of forked udev binary, used for testing */ udev_bin = getenv("UDEV_BIN"); if (udev_bin != NULL) @@ -937,26 +919,29 @@ int main(int argc, char *argv[], char *envp[]) max_childs_running = UDEVD_MAX_CHILDS_RUNNING; info("initialize max_childs_running to %u", max_childs_running); - FD_ZERO(&readfds); - FD_SET(udevd_sock, &readfds); - if (uevent_netlink_sock > 0) - FD_SET(uevent_netlink_sock, &readfds); - FD_SET(pipefds[0], &readfds); - maxsockplus = udevd_sock+1; + /* export log_priority , as called programs may want to follow that setting */ + sprintf(log, "UDEV_LOG=%i", udev_log_priority); + putenv(log); + while (!udev_exit) { struct uevent_msg *msg; + int fdcount; - fd_set workreadfds = readfds; - retval = select(maxsockplus, &workreadfds, NULL, NULL, NULL); + FD_ZERO(&readfds); + FD_SET(pipefds[0], &readfds); + FD_SET(udevd_sock, &readfds); + if (uevent_netlink_sock > 0) + FD_SET(uevent_netlink_sock, &readfds); - if (retval < 0) { + fdcount = select(UDEV_MAX(udevd_sock, uevent_netlink_sock)+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { if (errno != EINTR) dbg("error in select: %s", strerror(errno)); continue; } /* get user socket message */ - if (FD_ISSET(udevd_sock, &workreadfds)) { + if (FD_ISSET(udevd_sock, &readfds)) { msg = get_udevd_msg(); if (msg) { /* discard kernel messages if netlink is active */ @@ -970,7 +955,7 @@ int main(int argc, char *argv[], char *envp[]) } /* get kernel netlink message */ - if (FD_ISSET(uevent_netlink_sock, &workreadfds)) { + if ((uevent_netlink_sock > 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { msg = get_netlink_msg(); if (msg) { msg_queue_insert(msg); @@ -983,8 +968,17 @@ int main(int argc, char *argv[], char *envp[]) } /* received a signal, clear our notification pipe */ - if (FD_ISSET(pipefds[0], &workreadfds)) - user_sighandler(); + if (FD_ISSET(pipefds[0], &readfds)) { + int sig; + ssize_t rlen; + + while(1) { + rlen = read(pipefds[0], &sig, sizeof(sig)); + if (rlen <= 0) + break; + } + sig_flag = 0; + } /* forked child have returned */ if (sigchilds_waiting) { @@ -1018,7 +1012,6 @@ exit: if (udevd_sock > 0) close(udevd_sock); - if (uevent_netlink_sock > 0) close(uevent_netlink_sock); diff --git a/udeveventrecorder.c b/udeveventrecorder.c index 711f467307..9a3c3e197c 100644 --- a/udeveventrecorder.c +++ b/udeveventrecorder.c @@ -63,7 +63,7 @@ int main(int argc, char **argv, char **envp) const char *env; if (stat("/events", &sb) || !(S_ISDIR(sb.st_mode))) - return 1; + return 0; env = getenv("UDEV_LOG"); if (env) diff --git a/udevmonitor.c b/udevmonitor.c index 2efb705b6d..c1538883c9 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) int env = 0; fd_set readfds; int i; - int retval; + int retval = 0; for (i = 1 ; i < argc; i++) { char *arg = argv[i]; @@ -128,34 +128,34 @@ int main(int argc, char *argv[]) exit(1); } + retval = init_udev_monitor_socket(); + if (retval) + goto out; init_uevent_netlink_sock(); - init_udev_monitor_socket(); printf("udevmonitor prints received from the kernel [UEVENT] and after\n" "the udev processing, the event which udev [UDEV] has generated\n\n"); - FD_ZERO(&readfds); - if (uevent_netlink_sock > 0) - FD_SET(uevent_netlink_sock, &readfds); - if (udev_monitor_sock > 0) - FD_SET(udev_monitor_sock, &readfds); - while (1) { static char buf[UEVENT_BUFFER_SIZE*2]; ssize_t buflen; - fd_set workreadfds; + int fdcount; buflen = 0; - workreadfds = readfds; - - retval = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &workreadfds, NULL, NULL, NULL); - if (retval < 0) { + FD_ZERO(&readfds); + if (uevent_netlink_sock > 0) + FD_SET(uevent_netlink_sock, &readfds); + if (udev_monitor_sock > 0) + FD_SET(udev_monitor_sock, &readfds); + + fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { if (errno != EINTR) fprintf(stderr, "error receiving uevent message\n"); continue; } - if ((uevent_netlink_sock > 0) && FD_ISSET(uevent_netlink_sock, &workreadfds)) { + if ((uevent_netlink_sock > 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); if (buflen <= 0) { fprintf(stderr, "error receiving uevent message\n"); @@ -164,7 +164,7 @@ int main(int argc, char *argv[]) printf("UEVENT[%i] %s\n", time(NULL), buf); } - if ((udev_monitor_sock > 0) && FD_ISSET(udev_monitor_sock, &workreadfds)) { + if ((udev_monitor_sock > 0) && FD_ISSET(udev_monitor_sock, &readfds)) { buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); if (buflen <= 0) { fprintf(stderr, "error receiving udev message\n"); @@ -198,9 +198,11 @@ int main(int argc, char *argv[]) } } +out: if (uevent_netlink_sock > 0) close(uevent_netlink_sock); if (udev_monitor_sock > 0) close(udev_monitor_sock); - exit(1); + + return retval; } diff --git a/udevstart.c b/udevstart.c index 3a715a609f..ce96f38879 100644 --- a/udevstart.c +++ b/udevstart.c @@ -167,7 +167,7 @@ run: if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, "add"); else - run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_DEBUG)); + run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); } } exit: -- cgit v1.2.3-54-g00ecf From beb9f9ccb83b2c6f367b34e28ed6841141a42d48 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Aug 2005 12:00:43 +0200 Subject: move udevmonitor to /usr/sbin Signed-off-by: Kay Sievers --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index dcfac9cf9d..e9544f4510 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,7 @@ exec_prefix = ${prefix} etcdir = ${prefix}/etc sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev srcdir = . @@ -383,7 +384,7 @@ install: install-config install-man all $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) $(INSTALL_PROGRAM) -D $(CONTROL) $(DESTDIR)$(sbindir)/$(CONTROL) - $(INSTALL_PROGRAM) -D $(MONITOR) $(DESTDIR)$(sbindir)/$(MONITOR) + $(INSTALL_PROGRAM) -D $(MONITOR) $(DESTDIR)$(usrsbindir)/$(MONITOR) $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) @@ -409,8 +410,8 @@ uninstall: uninstall-man - rm $(sbindir)/$(INITSENDER) - rm $(sbindir)/$(RECORDER) - rm $(sbindir)/$(CONTROL) - - rm $(sbindir)/$(MONITOR) - rm $(sbindir)/$(STARTER) + - rm $(usrsbindir)/$(MONITOR) - rm $(usrbindir)/$(INFO) - rm $(usrbindir)/$(TESTER) - rm -rf $(udevdb) -- cgit v1.2.3-54-g00ecf From 5618b5611bccf64a1e22f8cbcebe8ecba9713c9c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Aug 2005 04:25:20 +0200 Subject: ENV{TEST}=="1" compares and ENV{TEST}="1" sets the environment This can be uses to export stuff to the event environment or to carry a state from one rule to another, like enabling/disabling later rules conditionally. Signed-off-by: Kay Sievers --- test/udev-test.pl | 25 +++++++++++++++++ udev_rules.c | 81 ++++++++++++++++++++++++++++++------------------------- 2 files changed, 70 insertions(+), 36 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 94cffeab07..c32cfe7eeb 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1291,6 +1291,31 @@ BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="go", NAME="wrong" BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="yes", ENV{ACTION}=="add", ENV{DEVPATH}=="/block/sda/sdax1", NAME="no" BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="test", ENV{ACTION}=="add", ENV{DEVPATH}=="/block/sda/sda1", NAME="true" BUS=="scsi", KERNEL=="sda1", ENV{ENV_KEY_TEST}=="bad", NAME="bad" +EOF + }, + { + desc => "ENV{} test (assign)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign2)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "part", + rules => <action, udev->action)) goto exit; @@ -691,23 +692,21 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, goto exit; } - if (rule->env.count) { - int i; + for (i = 0; i < rule->env.count; i++) { + struct key_pair *pair = &rule->env.keys[i]; - dbg("check %i ENV keys", rule->env.count); - for (i = 0; i < rule->env.count; i++) { - struct key_pair *pair = &rule->env.keys[i]; + /* we only check for matches, assignments will be handled later */ + if (pair->key.operation != KEY_OP_ASSIGN) { const char *key_name = key_pair_name(rule, pair); const char *value = getenv(key_name); if (!value) { - dbg("ENV{'%s'} is not set", key_name); + dbg("ENV{'%s'} is not set, treat as empty", key_name); value = ""; } if (match_key("ENV", rule, &pair->key, value)) goto exit; } - dbg("all %i ENV keys matched", rule->env.count); } if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { @@ -760,8 +759,6 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, /* check for matching sysfs pairs */ if (rule->sysfs.count) { - int i; - dbg("check %i SYSFS keys", rule->sysfs.count); for (i = 0; i < rule->sysfs.count; i++) { struct key_pair *pair = &rule->sysfs.keys[i]; @@ -799,32 +796,6 @@ try_parent: dbg("look at sysfs_device->bus_id='%s'", parent_device->bus_id); } - /* import variables from file into environment */ - if (rule->import.operation != KEY_OP_UNSET) { - char import[PATH_SIZE]; - int rc = -1; - - strlcpy(import, key_val(rule, &rule->import), sizeof(import)); - apply_format(udev, import, sizeof(import), class_dev, sysfs_device); - dbg("check for IMPORT import='%s'", import); - if (rule->import_type == IMPORT_PROGRAM) { - rc = import_program_into_env(udev, import); - } else if (rule->import_type == IMPORT_FILE) { - dbg("import file import='%s'", import); - rc = import_file_into_env(udev, import); - } else if (rule->import_type == IMPORT_PARENT && class_dev) { - dbg("import parent import='%s'", import); - rc = import_parent_into_env(udev, class_dev, import); - } - if (rc) { - dbg("IMPORT failed"); - if (rule->import.operation != KEY_OP_NOMATCH) - goto exit; - } else - dbg("IMPORT '%s' imported", key_val(rule, &rule->import)); - dbg("IMPORT key is true"); - } - /* execute external program */ if (rule->program.operation != KEY_OP_UNSET) { char program[PATH_SIZE]; @@ -854,7 +825,45 @@ try_parent: if (match_key("RESULT", rule, &rule->result, udev->program_result)) goto exit; - /* rule matches */ + /* import variables returned from program or or file into environment */ + if (rule->import.operation != KEY_OP_UNSET) { + char import[PATH_SIZE]; + int rc = -1; + + strlcpy(import, key_val(rule, &rule->import), sizeof(import)); + apply_format(udev, import, sizeof(import), class_dev, sysfs_device); + dbg("check for IMPORT import='%s'", import); + if (rule->import_type == IMPORT_PROGRAM) { + rc = import_program_into_env(udev, import); + } else if (rule->import_type == IMPORT_FILE) { + dbg("import file import='%s'", import); + rc = import_file_into_env(udev, import); + } else if (rule->import_type == IMPORT_PARENT && class_dev) { + dbg("import parent import='%s'", import); + rc = import_parent_into_env(udev, class_dev, import); + } + if (rc) { + dbg("IMPORT failed"); + if (rule->import.operation != KEY_OP_NOMATCH) + goto exit; + } else + dbg("IMPORT '%s' imported", key_val(rule, &rule->import)); + dbg("IMPORT key is true"); + } + + /* rule matches, if we have ENV assignments export it */ + for (i = 0; i < rule->env.count; i++) { + struct key_pair *pair = &rule->env.keys[i]; + + if (pair->key.operation == KEY_OP_ASSIGN) { + const char *key_name = key_pair_name(rule, pair); + const char *value = key_val(rule, &pair->key); + + setenv(key_name, value, 1); + dbg("export ENV '%s=%s'", key_name, value); + } + } + return 0; exit: -- cgit v1.2.3-54-g00ecf From f7a144a5be4af01c8bce13632c9a46b2653e3398 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Aug 2005 16:58:19 +0200 Subject: vol_id: fix sloppy error handling vol_id segfaults if read() fails on broken devices reporting the wrong size. Thanks to Erhard Schultchen for the debugging. Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/util.c | 29 ++++++++++++++++++++++++----- extras/volume_id/volume_id/volume_id.h | 2 +- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 868d67306c..62b96a3657 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -204,19 +204,30 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) if (off + len <= SB_BUFFER_SIZE) { if (id->sbbuf == NULL) { id->sbbuf = malloc(SB_BUFFER_SIZE); - if (id->sbbuf == NULL) + if (id->sbbuf == NULL) { + dbg("error malloc"); return NULL; + } } /* check if we need to read */ if ((off + len) > id->sbbuf_len) { dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len)); - lseek(id->fd, 0, SEEK_SET); + if (lseek(id->fd, 0, SEEK_SET) < 0) { + dbg("lseek failed (%s)", strerror(errno)); + return NULL; + } buf_len = read(id->fd, id->sbbuf, off + len); + if (buf_len < 0) { + dbg("read failed (%s)", strerror(errno)); + return NULL; + } dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->sbbuf_len = buf_len; - if (buf_len < off + len) + if (buf_len < off + len) { + dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); return NULL; + } } return &(id->sbbuf[off]); @@ -229,16 +240,24 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) /* get seek buffer */ if (id->seekbuf == NULL) { id->seekbuf = malloc(SEEK_BUFFER_SIZE); - if (id->seekbuf == NULL) + if (id->seekbuf == NULL) { + dbg("error malloc"); return NULL; + } } /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { dbg("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); - if (lseek(id->fd, off, SEEK_SET) == -1) + if (lseek(id->fd, off, SEEK_SET) < 0) { + dbg("lseek failed (%s)", strerror(errno)); return NULL; + } buf_len = read(id->fd, id->seekbuf, len); + if (buf_len < 0) { + dbg("read failed (%s)", strerror(errno)); + return NULL; + } dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->seekbuf_off = off; id->seekbuf_len = buf_len; diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index a82b221028..84f8fb6740 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -23,7 +23,7 @@ #include -#define VOLUME_ID_VERSION 47 +#define VOLUME_ID_VERSION 48 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From fc046d4d08f686bcdb91c015b5b35c35e2c205a0 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 17 Aug 2005 16:09:03 -0700 Subject: Always open the cdrom drive in non-blocking mode in cdrom_id Signed-off-by: Greg Kroah-Hartman --- extras/cdrom_id/cdrom_id.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 3d62781186..c561112d30 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -112,10 +112,7 @@ int main(int argc, char *argv[]) goto exit; } - fd = open(node, O_RDONLY); - if (fd < 0) - if (errno == ENOMEDIUM) - fd = open(node, O_RDONLY|O_NONBLOCK); + fd = open(node, O_RDONLY|O_NONBLOCK); if (fd < 0) { err("unable to open '%s'", node); rc = 1; -- cgit v1.2.3-54-g00ecf From a961dcbf0dabc91c0c6f9fde6195fe8209574d48 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 17 Aug 2005 16:10:32 -0700 Subject: cdrom_id: change err() to info() to help with debugging problems Signed-off-by: Greg Kroah-Hartman --- extras/cdrom_id/cdrom_id.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index c561112d30..941a2facfe 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -107,21 +107,21 @@ int main(int argc, char *argv[]) node = arg; } if (!node) { - err("no node specified"); + info("no node specified"); rc = 1; goto exit; } fd = open(node, O_RDONLY|O_NONBLOCK); if (fd < 0) { - err("unable to open '%s'", node); + info("unable to open '%s'", node); rc = 1; goto exit; } result = ioctl(fd, CDROM_GET_CAPABILITY, NULL); if (result < 0) { - err("CDROM_GET_CABILITY failed for '%s'", node); + info("CDROM_GET_CABILITY failed for '%s'", node); rc = 3; goto close; } -- cgit v1.2.3-54-g00ecf From e331c54dc58a8228018e1a29e84eff76cd9f8fe1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Aug 2005 04:54:59 +0200 Subject: fix typo in cdrom_id syslog Signed-off-by: Kay Sievers --- extras/cdrom_id/cdrom_id.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 941a2facfe..091bf91559 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) result = ioctl(fd, CDROM_GET_CAPABILITY, NULL); if (result < 0) { - info("CDROM_GET_CABILITY failed for '%s'", node); + info("CDROM_GET_CAPABILITY failed for '%s'", node); rc = 3; goto close; } @@ -147,8 +147,6 @@ int main(int argc, char *argv[]) if (result & CDC_RAM) printf("ID_CDROM_RAM=1\n"); - goto close; - close: close(fd); exit: -- cgit v1.2.3-54-g00ecf From 3f9f8de4de49135476644297585bd910b14d0ea7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Aug 2005 13:07:15 +0200 Subject: bring std(in|out|err) fd's in a sane state If the kernel forks us as an usermodhelper, we don't have any of the standard fd's and the first open() will start with fd=0. This is inherited to all forked childs and confuses later forked helpers where we want to read from a pipe connected to the helpers stdout/stderr. # ls -l /proc/$(pidof udevd)/fd total 6 dr-x------ 2 root root 0 2005-08-18 12:44 . dr-xr-xr-x 4 root root 0 2005-08-18 12:44 .. lrwx------ 1 root root 64 2005-08-18 12:44 0 -> /dev/null lrwx------ 1 root root 64 2005-08-18 12:44 1 -> socket:[1274617] lr-x------ 1 root root 64 2005-08-18 12:44 2 -> pipe:[1274618] l-wx------ 1 root root 64 2005-08-18 12:44 3 -> pipe:[1274618] lrwx------ 1 root root 64 2005-08-18 12:44 4 -> socket:[1274619] lrwx------ 1 root root 64 2005-08-18 12:44 5 -> socket:[1274620] Ouch! This will obviously not redirect sterr, it will kill the pipe we established between the parent and the child: devnull = open("/dev/null", O_RDWR); dup2(devnull, STDERR_FILENO); Signed-off-by: Kay Sievers --- udev.c | 16 ++++++++++++++++ udevd.c | 26 ++++++++++++++++---------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/udev.c b/udev.c index beaa191c04..926c4b526a 100644 --- a/udev.c +++ b/udev.c @@ -72,6 +72,7 @@ int main(int argc, char *argv[], char *envp[]) const char *devpath; const char *subsystem; struct sigaction act; + int devnull; int retval = -EINVAL; if (argc == 2 && strcmp(argv[1], "-V") == 0) { @@ -79,7 +80,22 @@ int main(int argc, char *argv[], char *envp[]) exit(0); } + /* set std fd's to /dev/null, if the kernel forks us, we don't have them at all */ + devnull = open("/dev/null", O_RDWR); + if (devnull >= 0) { + if (devnull != STDIN_FILENO) + dup2(devnull, STDIN_FILENO); + if (devnull != STDOUT_FILENO) + dup2(devnull, STDOUT_FILENO); + if (devnull != STDERR_FILENO) + dup2(devnull, STDERR_FILENO); + if (devnull > STDERR_FILENO) + close(devnull); + } + logging_init("udev"); + if (devnull < 0) + err("fatal, could not open /dev/null"); udev_init_config(); dbg("version %s", UDEV_VERSION); diff --git a/udevd.c b/udevd.c index 79d3e82550..ffd2b1ff3b 100644 --- a/udevd.c +++ b/udevd.c @@ -777,7 +777,23 @@ int main(int argc, char *argv[], char *envp[]) int daemonize = 0; int i; + /* set std fd's to /dev/null, if the kernel forks us, we don't have them at all */ + devnull = open("/dev/null", O_RDWR); + if (devnull >= 0) { + if (devnull != STDIN_FILENO) + dup2(devnull, STDIN_FILENO); + if (devnull != STDOUT_FILENO) + dup2(devnull, STDOUT_FILENO); + if (devnull != STDERR_FILENO) + dup2(devnull, STDERR_FILENO); + if (devnull > STDERR_FILENO) + close(devnull); + } + logging_init("udevd"); + if (devnull < 0) + err("fatal, could not open /dev/null"); + udev_init_config(); dbg("version %s", UDEV_VERSION); @@ -825,16 +841,6 @@ int main(int argc, char *argv[], char *envp[]) /* set a reasonable scheduling priority for the daemon */ setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); - /* Set fds to dev/null */ - devnull = open( "/dev/null", O_RDWR ); - if (devnull > 0) { - dup2(devnull, STDIN_FILENO); - dup2(devnull, STDOUT_FILENO); - dup2(devnull, STDERR_FILENO); - close(devnull); - } else - err("error opening /dev/null %s", strerror(errno)); - /* setup signal handler pipe */ retval = pipe(pipefds); if (retval < 0) { -- cgit v1.2.3-54-g00ecf From 24a12dcbb81e364723cee065d7471b4d03a9db86 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Aug 2005 13:43:27 +0200 Subject: fix printed udevmonitor header Signed-off-by: Kay Sievers --- RELEASE-NOTES | 13 +++++++++++++ udevmonitor.c | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 91cef0ccd4..ee992d1e60 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,16 @@ +udev 068 +======== +More bugfixes. If udevd was started from the kernel, we don't +have stdin/stdout/stderr, which broke the forked tools in some +situations. + +udev 067 +======== +Bugfix. udevstart event ordering was broken for a long time. +The new run_program() uncovered it, cause /dev/null was not +available while we try to run external programs. +Now udevstart should create it before we run anything. + udev 066 ======== Minor bugfixes and some distro rules updates. If you don't have the diff --git a/udevmonitor.c b/udevmonitor.c index c1538883c9..2775b295ce 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -133,8 +133,8 @@ int main(int argc, char *argv[]) goto out; init_uevent_netlink_sock(); - printf("udevmonitor prints received from the kernel [UEVENT] and after\n" - "the udev processing, the event which udev [UDEV] has generated\n\n"); + printf("udevmonitor prints the received event from the kernel [UEVENT]\n" + "and the event which udev sends out after rule processing [UDEV]\n\n"); while (1) { static char buf[UEVENT_BUFFER_SIZE*2]; -- cgit v1.2.3-54-g00ecf From da4aec2fb4e3c9f1f73a67a5e326c90220fb0c59 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 18 Aug 2005 10:02:27 -0700 Subject: add EXTRAS documentation to the README file. Signed-off-by: Greg Kroah-Hartman --- README | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README b/README index 5dc1e46c89..9891c696d3 100644 --- a/README +++ b/README @@ -60,11 +60,18 @@ To use: This is used if USE_KLIBC=true to find the kernel include directory that klibc needs to build against. This must be set if you are not building udev while running a 2.6 kernel. + EXTRAS + if set, will build the "extra" helper programs as specified + as listed (see below for an example.) So, if you want to build udev using klibc with debugging messages, you would do: make USE_KLIBC=true DEBUG=true + If you want to build the udev helper program cdrom_id and scsi_id you + would do: + make EXTRAS="extras/cdrom_id extras/scsi_id" + udev will follow the setting of the debug level in udev.conf. Adapt this value to see the debug in syslog. -- cgit v1.2.3-54-g00ecf From 8c11a2f0ff27264513033691bb818262f009fe4e Mon Sep 17 00:00:00 2001 From: Greg KH Date: Thu, 18 Aug 2005 10:04:49 -0700 Subject: 068 release --- ChangeLog | 18 ++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1cf451c44..b18208e245 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +Summary of changes from v067 to v068 +============================================ + +Greg Kroah-Hartman: + add EXTRAS documentation to the README file. + Always open the cdrom drive in non-blocking mode in cdrom_id + cdrom_id: change err() to info() to help with debugging problems + +Kay Sievers: + cleanup some debug output and move to info level + unify select() loops + move udevmonitor to /usr/sbin + ENV{TEST}=="1" compares and ENV{TEST}="1" sets the environment + vol_id: fix sloppy error handling + fix typo in cdrom_id syslog + bring std(in|out|err) fd's in a sane state + fix printed udevmonitor header + + Summary of changes from v066 to v067 ============================================ diff --git a/Makefile b/Makefile index e9544f4510..1c1280a7dc 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false -VERSION = 067 +VERSION = 068 ROOT = udev DAEMON = udevd SENDER = udevsend diff --git a/udev.spec b/udev.spec index d64d32c535..25bc2d7f2c 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace device manager providing devfs functionality Name: udev -Version: 066 +Version: 068 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From c907c823c388dfbdfa7054cfb2f4e9b92eb31e2e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Aug 2005 11:37:12 +0200 Subject: *_id: fix zero length in set_str() Thanks to Olaf Hering Signed-off-by: Kay Sievers --- extras/ata_id/ata_id.c | 2 +- extras/scsi_id/scsi_id.c | 2 +- extras/usb_id/usb_id.c | 2 +- extras/volume_id/vol_id.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 2840e91457..9579db3105 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -68,7 +68,7 @@ static void set_str(char *to, const char *from, size_t count) /* strip trailing whitespace */ len = strnlen(from, count); - while (isspace(from[len-1])) + while (len && isspace(from[len-1])) len--; /* strip leading whitespace */ diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index a46d1b377d..a86b004709 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -107,7 +107,7 @@ static void set_str(char *to, const char *from, size_t count) /* strip trailing whitespace */ len = strnlen(from, count); - while (isspace(from[len-1])) + while (len && isspace(from[len-1])) len--; /* strip leading whitespace */ diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index f5ee795924..c4ce0c6103 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -82,7 +82,7 @@ static void set_str(char *to, const char *from, size_t count) /* strip trailing whitespace */ len = strnlen(from, count); - while (isspace(from[len-1])) + while (len && isspace(from[len-1])) len--; /* strip leading whitespace */ diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 6a9d1120e0..fe0b3a0ed0 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -66,7 +66,7 @@ static void set_str(char *to, const char *from, size_t count) /* strip trailing whitespace */ len = strnlen(from, count); - while (isspace(from[len-1])) + while (len && isspace(from[len-1])) len--; /* strip leading whitespace */ -- cgit v1.2.3-54-g00ecf From 66691c6e6c22820f645e3e1e104a9b5178031d3b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Aug 2005 11:42:58 +0200 Subject: add program name to logged error Signed-off-by: Kay Sievers --- udev_utils_run.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_utils_run.c b/udev_utils_run.c index 0ee36d6848..fb37a05830 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -153,7 +153,7 @@ int run_program(const char *command, const char *subsystem, execv(argv[0], argv); /* we should never reach this */ - err("exec of program failed"); + err("exec of program '%s' failed", argv[0]); _exit(1); case -1: err("fork of '%s' failed", argv[0]); -- cgit v1.2.3-54-g00ecf From 9bbcdb56d8221e2e839a2cf03fc071952fe7bc3c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Aug 2005 12:01:55 +0200 Subject: fix exit code of udevinitsend and udevmonitor Thanks to: Marco d'Itri for the initial patch. Signed-off-by: Kay Sievers --- udevinitsend.c | 12 +++++++----- udevmonitor.c | 11 ++++++++--- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/udevinitsend.c b/udevinitsend.c index 5abf3d4bd3..ea05734a00 100644 --- a/udevinitsend.c +++ b/udevinitsend.c @@ -128,7 +128,6 @@ static int udevsend(char *filename, int sock, int disable_loop_detection) } if (ch < le) { - strncpy(&usend_msg.envbuf[bufpos],ls,(ch - ls) + 1); bufpos += (ch - ls) + 1; if (ch[1] == '\'' && le[-1] == '\'') { @@ -153,9 +152,10 @@ loop_end: retval = sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen); if (retval < 0) { dbg("error sending message (%s)", strerror(errno)); + retval = -1; } } - + return retval; } @@ -167,7 +167,7 @@ int main(int argc, char *argv[], char *envp[]) char *event_file = NULL; DIR *dirstream; struct dirent *direntry; - int retval = 1; + int retval = 0; int disable_loop_detection = 0; int sock; const char *env; @@ -218,7 +218,7 @@ int main(int argc, char *argv[], char *envp[]) if (!dirstream) { info("error opening directory %s: %s\n", event_dir, strerror(errno)); - return 1; + return 2; } chdir(event_dir); while ((direntry = readdir(dirstream)) != NULL) { @@ -235,5 +235,7 @@ int main(int argc, char *argv[], char *envp[]) if (sock != -1) close(sock); - return retval; + if (retval) + return 3; + return 0; } diff --git a/udevmonitor.c b/udevmonitor.c index 2775b295ce..9fe6da906f 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -63,6 +63,7 @@ static int init_udev_monitor_socket(void) if (retval < 0) { fprintf(stderr, "bind failed, %s\n", strerror(errno)); close(udev_monitor_sock); + udev_monitor_sock = -1; return -1; } @@ -125,13 +126,15 @@ int main(int argc, char *argv[]) if (getuid() != 0) { fprintf(stderr, "need to be root, exit\n\n"); - exit(1); + exit(2); } retval = init_udev_monitor_socket(); if (retval) goto out; - init_uevent_netlink_sock(); + retval = init_uevent_netlink_sock(); + if (retval) + goto out; printf("udevmonitor prints the received event from the kernel [UEVENT]\n" "and the event which udev sends out after rule processing [UDEV]\n\n"); @@ -204,5 +207,7 @@ out: if (udev_monitor_sock > 0) close(udev_monitor_sock); - return retval; + if (retval) + return 3; + return 0; } -- cgit v1.2.3-54-g00ecf From e7f247503c63764e4ffb255acb3e99faf91f2214 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 23 Aug 2005 00:57:46 +0200 Subject: udevd: keep the right order for messages without SEQNUM Signed-off-by: Kay Sievers --- udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevd.c b/udevd.c index ffd2b1ff3b..e4880c9814 100644 --- a/udevd.c +++ b/udevd.c @@ -113,7 +113,7 @@ static void msg_queue_insert(struct uevent_msg *msg) if (msg->seqnum == 0) { dbg("no SEQNUM, move straight to the exec queue"); - list_add(&msg->node, &exec_list); + list_add_tail(&msg->node, &exec_list); run_exec_q = 1; return; } -- cgit v1.2.3-54-g00ecf From 8d77c6a383ed1b308ce73e97b9f02f767b012921 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 25 Aug 2005 00:37:46 +0200 Subject: volume_id: don't probe for mac_partition_maps Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/volume_id.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index e7d4d75666..32b91e65ca 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -118,9 +118,6 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) if (volume_id_probe_vfat(id, off) == 0) goto exit; - if (volume_id_probe_mac_partition_map(id, off) == 0) - goto exit; - if (volume_id_probe_xfs(id, off) == 0) goto exit; -- cgit v1.2.3-54-g00ecf From 9ae611be33c29d5d9b51bca281408d407dcf007f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 25 Aug 2005 00:38:25 +0200 Subject: udevmonitor: cleanup on exit We want to write the output buffer before we exit, otherwise redirection to a file does not work correctly. Signed-off-by: Kay Sievers --- udevmonitor.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/udevmonitor.c b/udevmonitor.c index 9fe6da906f..33dff2a13c 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,7 @@ static int uevent_netlink_sock; static int udev_monitor_sock; +static volatile int udev_exit; static int init_udev_monitor_socket(void) { @@ -101,8 +103,15 @@ static int init_uevent_netlink_sock(void) return 0; } +static void asmlinkage sig_handler(int signum) +{ + if (signum == SIGINT || signum == SIGTERM) + udev_exit = 1; +} + int main(int argc, char *argv[]) { + struct sigaction act; int env = 0; fd_set readfds; int i; @@ -129,6 +138,14 @@ int main(int argc, char *argv[]) exit(2); } + /* set signal handlers */ + memset(&act, 0x00, sizeof(struct sigaction)); + act.sa_handler = (void (*)(int)) sig_handler; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_RESTART; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + retval = init_udev_monitor_socket(); if (retval) goto out; @@ -139,7 +156,7 @@ int main(int argc, char *argv[]) printf("udevmonitor prints the received event from the kernel [UEVENT]\n" "and the event which udev sends out after rule processing [UDEV]\n\n"); - while (1) { + while (!udev_exit) { static char buf[UEVENT_BUFFER_SIZE*2]; ssize_t buflen; int fdcount; -- cgit v1.2.3-54-g00ecf From 440103fcfc99626c4705f879b63ad710de0209de Mon Sep 17 00:00:00 2001 From: Amir Shalem Date: Thu, 25 Aug 2005 00:39:45 +0200 Subject: fix typo in firmware_helper The wrong string is being nullifed. --- extras/firmware/firmware_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/firmware/firmware_helper.c b/extras/firmware/firmware_helper.c index 283ea9f76f..7b7a307298 100644 --- a/extras/firmware/firmware_helper.c +++ b/extras/firmware/firmware_helper.c @@ -109,7 +109,7 @@ int main(int argc, char **argv) { } snprintf(data_path, sizeof(data_path), "/sys/%s/data", devpath); - fw_path[sizeof(data_path)-1] = '\0'; + data_path[sizeof(data_path)-1] = '\0'; fw_fd = open(data_path, O_RDWR); if (fw_fd < 0) { rc = errno; -- cgit v1.2.3-54-g00ecf From cf7cad9dc90c15ac13baeae85db5e0e25b59ed0e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 25 Aug 2005 00:40:41 +0200 Subject: path_id: remove SUSE specific PATH Signed-off-by: Kay Sievers --- extras/path_id | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/extras/path_id b/extras/path_id index 8391f2e586..c7f50687fe 100755 --- a/extras/path_id +++ b/extras/path_id @@ -1,13 +1,12 @@ #!/bin/sh -#set -x -# this script should provide the shortest possible unique hardware path -# to a block device +# provide the shortest possible unique hardware path to a block device +# for the udev persistent disk device naming scheme # - -# Horrible script. Handle with extreme care. - -# to be called from udev +# Copyright (C) 2005 SUSE Linux Products GmbH +# Licensed under the GPL v2. +# +# to be called from a udev rule to return the name for a symlink # DEVPATH=/block/sda/sda3 $0 (or similar) # $0 /block/sda # $0 /sys/block/sda @@ -55,9 +54,7 @@ # then firewire sbp2 # then the rest -PATH=/lib/klibc/bin #/usr:/usr/sbin:/usr/bin:/sbin:/bin SYSFS=/sys -export PATH RESULT=1 CDROM= TYPE= -- cgit v1.2.3-54-g00ecf From 879d1946735e17c84984de9c090b5a3f4293046e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 25 Aug 2005 02:30:01 +0200 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/isdn.rules | 54 ++++++++++++++++++++++++++++++++++++++++++++++ etc/udev/suse/pcmcia.rules | 5 +++++ etc/udev/suse/udev.rules | 42 ++++++++---------------------------- 3 files changed, 68 insertions(+), 33 deletions(-) create mode 100644 etc/udev/suse/isdn.rules create mode 100644 etc/udev/suse/pcmcia.rules diff --git a/etc/udev/suse/isdn.rules b/etc/udev/suse/isdn.rules new file mode 100644 index 0000000000..29f993adab --- /dev/null +++ b/etc/udev/suse/isdn.rules @@ -0,0 +1,54 @@ +# +# Very important !!! +# These rules must be processed befor 50-pcmcia and 50-udev +# if not here 'll be a endless loop !!! +# +# CAPI devices +SUBSYSTEM="capi", GROUP="dialout" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# ISDN +KERNEL=="isdn*", NAME="%k", MODE="600" +KERNEL=="isdnctrl*", NAME="%k", MODE="600" +KERNEL=="ippp*", NAME="%k", MODE="600" +KERNEL=="isdninfo*", NAME="%k", MODE="444" +# USB +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/c00*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/1000*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/1900*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2000*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2200*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2300*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2800*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3000*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3500*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3600*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2805*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2806*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/4401*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/4601*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="483/4810*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="959/2bd0*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" +SUBSYSTEM=="usb", ENV{PRODUCT}=="9bf/*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" + +# ISDN PCMCIA +# AVM B1 models +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb845DC335pc*pd*", RUN+="/sbin/udev.isdn.sh b1 1", GOTO="after_pcmcia" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb81E10430pc*pd*", RUN+="/sbin/udev.isdn.sh b1 2", GOTO="after_pcmcia" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb18E8558Apc*pd*", RUN+="/sbin/udev.isdn.sh b1 3", GOTO="after_pcmcia" +# AVM A1 models (aka Fritz!Card PCMCIA) +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pbADC9D4BBpc*pd*", RUN+="/sbin/udev.isdn.sh a1 1", GOTO="after_pcmcia" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa8D9761C8pb01C5AA7Bpc*pd*", RUN+="/sbin/udev.isdn.sh a1 2", GOTO="after_pcmcia" +# teles +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa67B50EAEpbE9E70119pc*pd*", RUN+="/sbin/udev.isdn.sh teles 1", GOTO="after_pcmcia" +# sedlbauer +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbF3612E1Dpc6B95C78Apd*", RUN+="/sbin/udev.isdn.sh sedlbauer 1", GOTO="after_pcmcia" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc397B7E90pd*", RUN+="/sbin/udev.isdn.sh sedlbauer 2", GOTO="after_pcmcia" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc2E5C7FCEpd*", RUN+="/sbin/udev.isdn.sh sedlbauer 3", GOTO="after_pcmcia" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc8DB143FEpd*", RUN+="/sbin/udev.isdn.sh sedlbauer 4", GOTO="after_pcmcia" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pcB391AB4Cpd*", RUN+="/sbin/udev.isdn.sh sedlbauer 5", GOTO="after_pcmcia" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*paD79E0B84pb21D083AEpc*pd*", RUN+="/sbin/udev.isdn.sh sedlbauer 6", GOTO="after_pcmcia" +# elsa +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa983DE2C4pb333BA257pc*pd*", RUN+="/sbin/udev.isdn.sh elsa 1", GOTO="after_pcmcia" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa639E5718pb333BA257pc*pd*", RUN+="/sbin/udev.isdn.sh elsa 2", GOTO="after_pcmcia" diff --git a/etc/udev/suse/pcmcia.rules b/etc/udev/suse/pcmcia.rules new file mode 100644 index 0000000000..11ccde56e7 --- /dev/null +++ b/etc/udev/suse/pcmcia.rules @@ -0,0 +1,5 @@ +SUBSYSTEM=="pcmcia_socket", ACTION=="add", RUN+="/sbin/hwup pcmcia_socket-devpath-%p -o hotplug" +SUBSYSTEM=="pcmcia", ACTION=="add", RUN+="/sbin/hwup pcmcia-devpath-%p -o hotplug" + +LABEL="after_pcmcia" + diff --git a/etc/udev/suse/udev.rules b/etc/udev/suse/udev.rules index 683a22a2bb..8ffd645257 100644 --- a/etc/udev/suse/udev.rules +++ b/etc/udev/suse/udev.rules @@ -27,8 +27,11 @@ KERNEL=="winradio*", NAME="%k", GROUP="video" KERNEL=="vttuner*", NAME="%k", GROUP="video" KERNEL=="nvidia*", NAME="%k", GROUP="video" KERNEL=="nvidiactl*", NAME="%k", GROUP="video" +KERNEL=="video0", SYMLINK+="video" +KERNEL=="radi0", SYMLINK+="radio" # dvb +#SUBSYSTEM="dvb", PROGRAM="/bin/sh -c 'X=%k X=$${X#dvb} A=$${X%%%%.*} D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video" # ALSA/sound @@ -60,34 +63,6 @@ SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="76b/1784*", RUN+="/usr/sbin/open SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="8d4/9*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" SUBSYSTEM=="usb", ACTION=="add", ENV{INTERFACE}=="11/*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -# CAPI devices -SUBSYSTEM="capi", GROUP="dialout" -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# ISDN -KERNEL=="isdn*", NAME="%k", MODE="600" -KERNEL=="isdnctrl*", NAME="%k", MODE="600" -KERNEL=="ippp*", NAME="%k", MODE="600" -KERNEL=="isdninfo*", NAME="%k", MODE="444" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/c00*", IMPORT="/bin/echo 'DRV=fcusb'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/1000*", IMPORT="/bin/echo -e 'DRV=fcusb2\nFIRMWARE=fus2base.frm'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/1900*", IMPORT="/bin/echo -e 'DRV=fcusb2\nFIRMWARE=fus3base.frm'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2000*", IMPORT="/bin/echo DRV=fxusb", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2200*", IMPORT="/bin/echo DRV=bfusb", RUN+="/etc/sysconfig/isdn/scripts/load-bfusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2300*", IMPORT="/bin/echo -e 'DRV=fcdslusb\nFIRMWARE=fdsubase.frm\nDSL_CONTR=dslisdn'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2800*", IMPORT="/bin/echo DRV=fxusb_CZ", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3000*", IMPORT="/bin/echo -e 'DRV=fcdslusba\nFIRMWARE=fdsabase.frm\nDSL_CONTR=dslonly\nISDNLOG_START=no'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3500*", IMPORT="/bin/echo -e 'DRV=fcdslslusb\nFIRMWARE=fdlubase.frm\nDSL_CONTR=dslonly\nISDNLOG_START=no'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/3600*", IMPORT="/bin/echo -e 'DRV=fcdslusb2\nFIRMWARE=fds2base.frm\nDSL_CONTR=dslisdn'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2805*", IMPORT="/bin/echo 'DRV=e2220pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/2806*", IMPORT="/bin/echo 'DRV=e5520pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/4401*", IMPORT="/bin/echo 'DRV=e2220pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="57c/4601*", IMPORT="/bin/echo 'DRV=e5520pc'", RUN+="/etc/sysconfig/isdn/scripts/load-avmusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="483/4810*", IMPORT="/bin/echo 'DRV=hisax_st5481'", RUN+="/etc/sysconfig/isdn/scripts/load-hisaxusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="959/2bd0*", IMPORT="/bin/echo 'DRV=hfc_usb'", RUN+="/etc/sysconfig/isdn/scripts/load-hisaxusb" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="9bf/*", IMPORT="/bin/echo 'DRV=auerswald'", RUN+="/etc/sysconfig/isdn/scripts/load-auerswald" - # input devices KERNEL=="mice", NAME="input/%k", MODE="0640" KERNEL=="mouse*", NAME="input/%k", MODE="0640" @@ -127,7 +102,7 @@ KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="nvram", NAME="%k", GROUP="kmem" +KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" KERNEL=="null", NAME="%k", MODE="666" KERNEL=="zero", NAME="%k", MODE="666" KERNEL=="full", NAME="%k", MODE="622" @@ -149,9 +124,9 @@ KERNEL=="z90crypt", NAME="%k", MODE="666" KERNEL=="mmtimer", NAME="%k", MODE="444" # fix floppy devices -KERNEL=="nvram", ACTION=="add", NAME="%k", MODE="600", RUN="/sbin/load_floppy_module" -KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN="/sbin/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" -KERNEL=="fd*", ACTION=="remove", RUN="/sbin/remove_floppy_devices /dev/%k" +KERNEL=="nvram", ACTION=="add", RUN+="/sbin/load_floppy_module" +KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="/sbin/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd*", ACTION=="remove", RUN+="/sbin/remove_floppy_devices %k" # block devices SUBSYSTEM=="block", GROUP="disk", MODE="0640" @@ -236,11 +211,12 @@ DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" # firmware loader -SUBSYSTEM=="firmware", ACTION=="add", RUN+="/etc/hotplug.d/firmware/50-firmware.hotplug" +SUBSYSTEM=="firmware", ACTION=="add", RUN+="/sbin/firmware.hotplug.sh" # SUSE system integration SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-/sys%p -o hotplug" +LABEL="after_usb_default" SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-/sys%p -o hotplug" SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-/sys%p -o hotplug" SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-/sys%p -o hotplug" -- cgit v1.2.3-54-g00ecf From bcd9fc8f474bbe6ec0bbca139b3356ae5198441e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 25 Aug 2005 03:37:38 +0200 Subject: add pci_express to bus list Hopefully that wait_for_sysfs crap can go away some day... Signed-off-by: Kay Sievers --- udev_sysfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 90ce48caea..75e275d500 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -300,6 +300,7 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, { .bus = "usb-serial", .file = "bus" }, { .bus = "ide", .file = "bus" }, { .bus = "pci", .file = "vendor" }, + { .bus = "pci_express", .file = "bus" }, { .bus = "platform", .file = "bus" }, { .bus = "pcmcia", .file = "bus" }, { .bus = "i2c", .file = "bus" }, -- cgit v1.2.3-54-g00ecf From 97dd82b9a7cced2568c99b500b1e31187604dcb7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 26 Aug 2005 14:27:13 +0200 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/udev.rules | 63 +++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/etc/udev/suse/udev.rules b/etc/udev/suse/udev.rules index 8ffd645257..1ed2c6cd50 100644 --- a/etc/udev/suse/udev.rules +++ b/etc/udev/suse/udev.rules @@ -28,11 +28,10 @@ KERNEL=="vttuner*", NAME="%k", GROUP="video" KERNEL=="nvidia*", NAME="%k", GROUP="video" KERNEL=="nvidiactl*", NAME="%k", GROUP="video" KERNEL=="video0", SYMLINK+="video" -KERNEL=="radi0", SYMLINK+="radio" +KERNEL=="radio0", SYMLINK+="radio" # dvb -#SUBSYSTEM="dvb", PROGRAM="/bin/sh -c 'X=%k X=$${X#dvb} A=$${X%%%%.*} D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" -KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video" +SUBSYSTEM="dvb", PROGRAM="/bin/sh -c 'X=%k X=$${X#dvb} A=$${X%%%%.*} D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" # ALSA/sound SUBSYSTEM="sound", GROUP="audio" @@ -51,18 +50,6 @@ SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startp SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" -# OpenCT (SmartCard) -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="973/1*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="529/50c*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="529/514*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="73d/5*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b9/1200*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="4b9/1300*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="76b/596*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="76b/1784*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="8d4/9*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" -SUBSYSTEM=="usb", ACTION=="add", ENV{INTERFACE}=="11/*", RUN+="/usr/sbin/openct-control attach $env{DEVICE} usb:$env{PRODUCT}" - # input devices KERNEL=="mice", NAME="input/%k", MODE="0640" KERNEL=="mouse*", NAME="input/%k", MODE="0640" @@ -130,9 +117,29 @@ KERNEL=="fd*", ACTION=="remove", RUN+="/sbin/remove_floppy_devices %k" # block devices SUBSYSTEM=="block", GROUP="disk", MODE="0640" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0", RUN+="/sbin/modprobe sd_mod" + +# SCSI types: +# sd / block values: +# 0 TYPE_DISK +# 7 TYPE_MOD +# 14 TYPE_RBC +# +# st/osst tape: +# 1 TYPE_TAPE +# +# sr cd like ones: +# 4 TYPE_WORM +# 5 TYPE_ROM +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +# Treat osst as a unique case, that is, osst will load more often than +# actually required, but the osst and st drivers will do the right thing. +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="Onstream", RUN+="/sbin/modprobe osst" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[345]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" + +# IDE/ATAPI handling +SUBSYSTEM=="ide", ACTION=="add", RUN+="/sbin/udev.load_ide_modules.sh" # misc storage devices (non-block) KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" @@ -173,15 +180,15 @@ KERNEL=="ram*|loop*|fd*", GOTO="persistent_end" SUBSYSTEM=="block", BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" # by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\n'" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" -KERNEL=="dasd*[!0-9]", IMPORT="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # for partitions import parent information @@ -189,14 +196,14 @@ KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # by-path (shortest physical path) -KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" KERNEL=="sr*", GOTO="persistent_end" -IMPORT="/sbin/vol_id --export $tempnode" +IMPORT{program}="/sbin/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="persistent_end" @@ -211,7 +218,7 @@ DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" # firmware loader -SUBSYSTEM=="firmware", ACTION=="add", RUN+="/sbin/firmware.hotplug.sh" +SUBSYSTEM=="firmware", ACTION=="add", RUN+="/sbin/udev.firmware.sh" # SUSE system integration SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" @@ -230,7 +237,3 @@ RUN+="socket:/org/kernel/udev/monitor" # debug events to /events, but not on default udev_log="err" ENV{UDEV_LOG}=="[4-9]", RUN+="/sbin/hotplugeventrecorder" -# for backward compatibility with older udev versions and hotplug (no longer supported) -# RUN+="/sbin/udev_run_hotplugd" -# RUN+="/sbin/udev_run_devd" - -- cgit v1.2.3-54-g00ecf From c4ef16f92c56d2f4d8990625212fd27c805425cb Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Fri, 26 Aug 2005 14:52:57 +0200 Subject: switch to '==' in raid-devfs.sh --- extras/raid-devfs.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/raid-devfs.sh b/extras/raid-devfs.sh index 796232b497..ca279d45c0 100644 --- a/extras/raid-devfs.sh +++ b/extras/raid-devfs.sh @@ -4,9 +4,9 @@ # Copyright (c) 2004 Piotr Roszatycki # # Usage: -# KERNEL="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" -# KERNEL="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" -# KERNEL="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK="%k" +# KERNEL=="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +# KERNEL=="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +# KERNEL=="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" get_dev_number_cciss() { grep '^cciss/' /proc/driver/cciss/* | cat -n | \ -- cgit v1.2.3-54-g00ecf From 8f847bb8455f7db8f26893b167fbf8a09cf8f41b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 26 Aug 2005 21:38:18 +0200 Subject: store ENV{key}="value" exported keys in the database Just like the IMPORT values are stored in the udev database the exported keys are stored in the udev database. The database is also imported on a remove event before the rules are matched. So it is possible to do: ACTION=="add", KERNEL=="sda", ENV{MY_DEVICE}="1234", RUN+="/bin/logger add $devpath" ACTION=="remove", ENV{MY_DEVICE}=="1234", RUN+="/bin/logger remove $devpath" Signed-off-by: Kay Sievers --- udev_event.c | 12 +++++++++--- udev_rules.c | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/udev_event.c b/udev_event.c index 3580ab937f..fae5a46597 100644 --- a/udev_event.c +++ b/udev_event.c @@ -91,15 +91,21 @@ int udev_process_event(struct udev_rules *rules, struct udevice *udev) } sysfs_close_class_device(class_dev); } else if (strcmp(udev->action, "remove") == 0) { + struct name_entry *name_loop; + + /* get data from db, remove db-entry, delete node */ dbg("node remove"); + retval = udev_remove_device(udev); + + /* restore stored persistent data */ + list_for_each_entry(name_loop, &udev->env_list, node) + putenv(name_loop->name); + udev_rules_get_run(rules, udev, NULL, NULL); if (udev->ignore_device) { dbg("device event will be ignored"); return -1; } - - /* get name from db, remove db-entry, delete node */ - retval = udev_remove_device(udev); } /* export name of device node or netif */ diff --git a/udev_rules.c b/udev_rules.c index 647875d9a9..6c6aa0f091 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -859,6 +859,7 @@ try_parent: const char *key_name = key_pair_name(rule, pair); const char *value = key_val(rule, &pair->key); + name_list_key_add(&udev->env_list, key_name, value); setenv(key_name, value, 1); dbg("export ENV '%s=%s'", key_name, value); } -- cgit v1.2.3-54-g00ecf From 3ad7a5b1a562ba71bea91ae3fba48e5b5947e285 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 26 Aug 2005 22:43:49 +0200 Subject: fix lookup for name in the udevdb, it should return the devpath Signed-off-by: Kay Sievers --- udev_db.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/udev_db.c b/udev_db.c index 632f6f7b2a..9b40a5904e 100644 --- a/udev_db.c +++ b/udev_db.c @@ -207,6 +207,8 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) int udev_db_search_name(char *devpath, size_t len, const char *name) { DIR *dir; + char path[PATH_SIZE]; + int found = 0; dir = opendir(udev_db_path); if (dir == NULL) { @@ -214,10 +216,9 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) return -1; } - while (1) { + while (!found) { struct dirent *ent; char filename[PATH_SIZE]; - char path[PATH_SIZE]; char nodename[PATH_SIZE]; char *bufline; char *buf; @@ -242,7 +243,7 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) } cur = 0; - while (cur < bufsize) { + while (cur < bufsize && !found) { count = buf_get_line(buf, bufsize, cur); bufline = &buf[cur]; cur += count+1; @@ -262,11 +263,8 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) nodename[count-2] = '\0'; dbg("compare '%s' '%s'", nodename, name); if (strcmp(nodename, name) == 0) { - strlcpy(devpath, nodename, len); - devpath[count-2] = '\0'; - file_unmap(buf, bufsize); - closedir(dir); - return 0; + found = 1; + break; } break; default: @@ -277,7 +275,11 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) } closedir(dir); - return -1; + if (found) { + strlcpy(devpath, path, len); + return 0; + } else + return -1; } int udev_db_dump_names(int (*handler_function)(const char *path, const char *name)) -- cgit v1.2.3-54-g00ecf From db481105c2cf2092e1499736d6619bf194f91711 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 27 Aug 2005 02:59:20 +0200 Subject: prepare for new HAL udevdb dump HAL soon wants to read the whole content of the udevdatabase while starting up. This makes the whole udev structure available to the udevinfo "dump". Signed-off-by: Kay Sievers --- udev_db.c | 81 +++++++++++++++----------------------------------------------- udev_db.h | 2 +- udevinfo.c | 21 ++++++++++++---- 3 files changed, 37 insertions(+), 67 deletions(-) diff --git a/udev_db.c b/udev_db.c index 9b40a5904e..d958c6173b 100644 --- a/udev_db.c +++ b/udev_db.c @@ -39,20 +39,19 @@ #define PATH_TO_NAME_CHAR '@' -static int get_db_filename(const char *devpath, char *filename, int len) +static int get_db_filename(const char *devpath, char *filename, size_t len) { - char temp[PATH_SIZE]; - char *pos; + size_t start, end, i; + + start = strlcpy(filename, udev_db_path, len); + end = strlcat(filename, devpath, len); + if (end > len) + end = len; /* replace '/' to transform path into a filename */ - strlcpy(temp, devpath, sizeof(temp)); - pos = strchr(&temp[1], '/'); - while (pos) { - pos[0] = PATH_TO_NAME_CHAR; - pos = strchr(&pos[1], '/'); - } - snprintf(filename, len, "%s%s", udev_db_path, temp); - filename[len-1] = '\0'; + for (i = start+1; i < end; i++) + if (filename[i] == '/') + filename[i] = PATH_TO_NAME_CHAR; return 0; } @@ -197,7 +196,6 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) char filename[PATH_SIZE]; get_db_filename(devpath, filename, sizeof(filename)); - if (parse_db_file(udev, filename) != 0) return -1; @@ -282,7 +280,7 @@ int udev_db_search_name(char *devpath, size_t len, const char *name) return -1; } -int udev_db_dump_names(int (*handler_function)(const char *path, const char *name)) +int udev_db_get_all_entries(struct list_head *name_list) { DIR *dir; @@ -294,14 +292,8 @@ int udev_db_dump_names(int (*handler_function)(const char *path, const char *nam while (1) { struct dirent *ent; - char filename[PATH_SIZE]; - char path[PATH_SIZE]; - char nodename[PATH_SIZE]; - char *bufline; - char *buf; - size_t bufsize; - size_t cur; - size_t count; + char filename[PATH_SIZE] = "/"; + size_t end, i; ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') @@ -310,47 +302,12 @@ int udev_db_dump_names(int (*handler_function)(const char *path, const char *nam if (ent->d_name[0] == '.') continue; - snprintf(filename, sizeof(filename), "%s/%s", udev_db_path, ent->d_name); - filename[sizeof(filename)-1] = '\0'; - dbg("looking at '%s'", filename); - - if (file_map(filename, &buf, &bufsize) != 0) { - err("unable to read db file '%s'", filename); - continue; - } - - path[0] = '\0'; - nodename[0] = '\0'; - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - - switch(bufline[0]) { - case 'P': - if (count > sizeof(path)) - count = sizeof(path); - memcpy(path, &bufline[2], count-2); - path[count-2] = '\0'; - break; - case 'N': - if (count > sizeof(nodename)) - count = sizeof(nodename); - memcpy(nodename, &bufline[2], count-2); - nodename[count-2] = '\0'; - break; - default: - continue; - } - } - file_unmap(buf, bufsize); - - if (path[0] == '\0' || nodename[0] == '\0') - continue; - - if (handler_function(path, nodename) != 0) - break; + end = strlcat(filename, ent->d_name, sizeof(filename)); + for (i = 1; i < end; i++) + if (filename[i] == PATH_TO_NAME_CHAR) + filename[i] = '/'; + name_list_add(name_list, filename, 1); + dbg("added '%s'", filename); } closedir(dir); diff --git a/udev_db.h b/udev_db.h index b961c87102..61ea5b47fc 100644 --- a/udev_db.h +++ b/udev_db.h @@ -28,6 +28,6 @@ extern int udev_db_delete_device(struct udevice *dev); extern int udev_db_get_device(struct udevice *udev, const char *devpath); extern int udev_db_search_name(char *devpath, size_t len, const char *name); -extern int udev_db_dump_names(int (*handler_function)(const char *path, const char *name)); +extern int udev_db_get_all_entries(struct list_head *name_list); #endif /* _UDEV_DB_H_ */ diff --git a/udevinfo.c b/udevinfo.c index 58584d62f8..814bd1e90a 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -165,9 +165,22 @@ exit: return retval; } -static int print_dump(const char *devpath, const char *name) { - printf("%s=%s/%s\n", devpath, udev_root, name); - return 0; +static void dump_names(void) { + LIST_HEAD(name_list); + struct name_entry *name_loop; + struct name_entry *tmp_loop; + + udev_db_get_all_entries(&name_list); + list_for_each_entry_safe(name_loop, tmp_loop, &name_list, node) { + struct udevice udev_db; + + udev_init_device(&udev_db, NULL, NULL, NULL); + if (udev_db_get_device(&udev_db, name_loop->name) == 0) { + printf("%s=%s/%s\n", udev_db.devpath, udev_root, udev_db.name); + free(name_loop); + } + udev_cleanup_device(&udev_db); + } } int main(int argc, char *argv[], char *envp[]) @@ -256,7 +269,7 @@ int main(int argc, char *argv[], char *envp[]) break; case 'd': - udev_db_dump_names(print_dump); + dump_names(); goto exit; case 'V': -- cgit v1.2.3-54-g00ecf From 64d735e652e949dae5bcaf2bd2004a2d67e627cf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 27 Aug 2005 15:37:03 +0200 Subject: print persistent data with "udevinfo -q all" Signed-off-by: Kay Sievers --- udevinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index 814bd1e90a..11b0104581 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -88,6 +88,8 @@ static int print_record(struct udevice *udev) printf("N: %s\n", udev->name); list_for_each_entry(name_loop, &udev->symlink_list, node) printf("S: %s\n", name_loop->name); + list_for_each_entry(name_loop, &udev->env_list, node) + printf("E: %s\n", name_loop->name); return 0; } @@ -321,7 +323,7 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_db_search_name(devpath, sizeof(devpath), pos); if (retval != 0) { - fprintf(stderr, "device not found in database\n"); + fprintf(stderr, "no record for '%s' in database\n", pos); goto exit; } udev_db_get_device(&udev, devpath); -- cgit v1.2.3-54-g00ecf From 314edf3ca44b268fa70a7a87a106322e2dd461af Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 27 Aug 2005 15:46:58 +0200 Subject: change parameter order of udev_db_search_name() Signed-off-by: Kay Sievers --- udev_db.c | 2 +- udev_db.h | 2 +- udev_rules.c | 19 +++++++++++-------- udevinfo.c | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/udev_db.c b/udev_db.c index d958c6173b..5377a3b373 100644 --- a/udev_db.c +++ b/udev_db.c @@ -202,7 +202,7 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) return 0; } -int udev_db_search_name(char *devpath, size_t len, const char *name) +int udev_db_search_name(const char *name, char *devpath, size_t len) { DIR *dir; char path[PATH_SIZE]; diff --git a/udev_db.h b/udev_db.h index 61ea5b47fc..b0bc51a2c7 100644 --- a/udev_db.h +++ b/udev_db.h @@ -27,7 +27,7 @@ extern int udev_db_add_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); extern int udev_db_get_device(struct udevice *udev, const char *devpath); -extern int udev_db_search_name(char *devpath, size_t len, const char *name); +extern int udev_db_search_name(const char *name, char *devpath, size_t len); extern int udev_db_get_all_entries(struct list_head *name_list); #endif /* _UDEV_DB_H_ */ diff --git a/udev_rules.c b/udev_rules.c index 6c6aa0f091..8db7fd377a 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -270,28 +270,31 @@ static int import_parent_into_env(struct udevice *udev, struct sysfs_class_devic /* finds the lowest positive N such that N isn't present in the udevdb * if doesn't exist, 0 is returned, N otherwise */ -static int find_free_number(const char *name) +static int find_free_number(const char *name, const char *devpath) { - char devpath[PATH_SIZE]; + char db_devpath[PATH_SIZE]; char filename[PATH_SIZE]; int num = 0; strlcpy(filename, name, sizeof(filename)); while (1) { dbg("look for existing node '%s'", filename); - if (udev_db_search_name(devpath, sizeof(devpath), filename) != 0) { + if (udev_db_search_name(filename, db_devpath, sizeof(db_devpath)) != 0) { dbg("free num=%d", num); - return num; + break; } num++; - if (num > 1000) { - info("find_free_number gone crazy (num=%d), aborted", num); - return -1; + if (num > 100000) { + err("find_free_number aborted at num=%d", num); + num = -1; + break; } snprintf(filename, sizeof(filename), "%s%d", name, num); filename[sizeof(filename)-1] = '\0'; } + + return num; } static int find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, @@ -546,7 +549,7 @@ found: dbg("substitute sysfs value '%s'", temp2); break; case SUBST_ENUM: - next_free_number = find_free_number(string); + next_free_number = find_free_number(string, udev->devpath); if (next_free_number > 0) { sprintf(temp2, "%d", next_free_number); strlcat(string, temp2, maxsize); diff --git a/udevinfo.c b/udevinfo.c index 11b0104581..b546488c7e 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -321,7 +321,7 @@ int main(int argc, char *argv[], char *envp[]) } else pos = name; - retval = udev_db_search_name(devpath, sizeof(devpath), pos); + retval = udev_db_search_name(pos, devpath, sizeof(devpath)); if (retval != 0) { fprintf(stderr, "no record for '%s' in database\n", pos); goto exit; -- cgit v1.2.3-54-g00ecf From fb17920701dcba0d94e3fde566788a868e41d1ad Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 27 Aug 2005 16:15:41 +0200 Subject: add and use name_list_cleanup() for cleaning up the string lists Signed-off-by: Kay Sievers --- udev_device.c | 18 +++--------------- udev_rules.c | 24 +++--------------------- udev_utils.c | 11 +++++++++++ udev_utils.h | 1 + udevinfo.c | 8 +++----- 5 files changed, 21 insertions(+), 41 deletions(-) diff --git a/udev_device.c b/udev_device.c index 45bb6a2876..db72d3007d 100644 --- a/udev_device.c +++ b/udev_device.c @@ -103,19 +103,7 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs void udev_cleanup_device(struct udevice *udev) { - struct name_entry *name_loop; - struct name_entry *temp_loop; - - list_for_each_entry_safe(name_loop, temp_loop, &udev->symlink_list, node) { - list_del(&name_loop->node); - free(name_loop); - } - list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) { - list_del(&name_loop->node); - free(name_loop); - } - list_for_each_entry_safe(name_loop, temp_loop, &udev->env_list, node) { - list_del(&name_loop->node); - free(name_loop); - } + name_list_cleanup(&udev->symlink_list); + name_list_cleanup(&udev->run_list); + name_list_cleanup(&udev->env_list); } diff --git a/udev_rules.c b/udev_rules.c index 8db7fd377a..3cbcad55c1 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -964,14 +964,8 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) udev->symlink_final = 1; if (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { - struct name_entry *name_loop; - struct name_entry *temp_loop; - info("reset symlink list"); - list_for_each_entry_safe(name_loop, temp_loop, &udev->symlink_list, node) { - list_del(&name_loop->node); - free(name_loop); - } + name_list_cleanup(&udev->symlink_list); } strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); @@ -1015,14 +1009,8 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s if (rule->run.operation == KEY_OP_ASSIGN_FINAL) udev->run_final = 1; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - struct name_entry *name_loop; - struct name_entry *temp_loop; - info("reset run list"); - list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) { - list_del(&name_loop->node); - free(name_loop); - } + name_list_cleanup(&udev->run_list); } strlcpy(program, key_val(rule, &rule->run), sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_device); @@ -1096,14 +1084,8 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, char program[PATH_SIZE]; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - struct name_entry *name_loop; - struct name_entry *temp_loop; - info("reset run list"); - list_for_each_entry_safe(name_loop, temp_loop, &udev->run_list, node) { - list_del(&name_loop->node); - free(name_loop); - } + name_list_cleanup(&udev->run_list); } strlcpy(program, key_val(rule, &rule->run), sizeof(program)); apply_format(udev, program, sizeof(program), class_dev, sysfs_dev); diff --git a/udev_utils.c b/udev_utils.c index de43dee30d..fc1e2e1f7e 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -224,6 +224,17 @@ int name_list_key_add(struct list_head *name_list, const char *key, const char * return 0; } +void name_list_cleanup(struct list_head *name_list) +{ + struct name_entry *name_loop; + struct name_entry *temp_loop; + + list_for_each_entry_safe(name_loop, temp_loop, name_list, node) { + list_del(&name_loop->node); + free(name_loop); + } +} + /* calls function for every file found in specified directory */ int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix) { diff --git a/udev_utils.h b/udev_utils.h index a3fc283203..0a307526b7 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -45,6 +45,7 @@ extern void remove_trailing_char(char *path, char c); extern void replace_untrusted_chars(char *string); extern int name_list_add(struct list_head *name_list, const char *name, int sort); extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); +extern void name_list_cleanup(struct list_head *name_list); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); extern int pass_env_to_socket(const char *name, const char *devpath, const char *action); extern int run_program(const char *command, const char *subsystem, diff --git a/udevinfo.c b/udevinfo.c index b546488c7e..fadfaec945 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -170,19 +170,17 @@ exit: static void dump_names(void) { LIST_HEAD(name_list); struct name_entry *name_loop; - struct name_entry *tmp_loop; udev_db_get_all_entries(&name_list); - list_for_each_entry_safe(name_loop, tmp_loop, &name_list, node) { + list_for_each_entry(name_loop, &name_list, node) { struct udevice udev_db; udev_init_device(&udev_db, NULL, NULL, NULL); - if (udev_db_get_device(&udev_db, name_loop->name) == 0) { + if (udev_db_get_device(&udev_db, name_loop->name) == 0) printf("%s=%s/%s\n", udev_db.devpath, udev_root, udev_db.name); - free(name_loop); - } udev_cleanup_device(&udev_db); } + name_list_cleanup(&name_list); } int main(int argc, char *argv[], char *envp[]) -- cgit v1.2.3-54-g00ecf From 7104c558dad47ee85860ebb891bdc8820d95154d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 27 Aug 2005 23:27:43 +0200 Subject: don't store devpath in udevdb, we don't need it Signed-off-by: Kay Sievers --- udev_db.c | 63 ++++++++++++++++++++++++++---------------------------------- udev_db.h | 2 +- udev_rules.c | 2 +- udevinfo.c | 2 +- 4 files changed, 30 insertions(+), 39 deletions(-) diff --git a/udev_db.c b/udev_db.c index 5377a3b373..bf369ac2e6 100644 --- a/udev_db.c +++ b/udev_db.c @@ -39,10 +39,11 @@ #define PATH_TO_NAME_CHAR '@' -static int get_db_filename(const char *devpath, char *filename, size_t len) +static int devpath_to_db_path(const char *devpath, char *filename, size_t len) { size_t start, end, i; + /* add location of db files */ start = strlcpy(filename, udev_db_path, len); end = strlcat(filename, devpath, len); if (end > len) @@ -56,6 +57,21 @@ static int get_db_filename(const char *devpath, char *filename, size_t len) return 0; } +static int db_file_to_devpath(const char *filename, char *devpath, size_t len) +{ + size_t end, i; + + strlcpy(devpath, "/", len); + end = strlcat(devpath, filename, len); + + /* replace PATH_TO_NAME_CHAR to transform name into devpath */ + for (i = 1; i < end; i++) + if (devpath[i] == PATH_TO_NAME_CHAR) + devpath[i] = '/'; + + return 0; +} + int udev_db_add_device(struct udevice *udev) { char filename[PATH_SIZE]; @@ -75,7 +91,7 @@ int udev_db_add_device(struct udevice *udev) goto exit; } - get_db_filename(udev->devpath, filename, sizeof(filename)); + devpath_to_db_path(udev->devpath, filename, sizeof(filename)); create_path(filename); f = fopen(filename, "w"); if (f == NULL) { @@ -84,7 +100,6 @@ int udev_db_add_device(struct udevice *udev) } dbg("storing data for device '%s' in '%s'", udev->devpath, filename); - fprintf(f, "P:%s\n", udev->devpath); fprintf(f, "N:%s\n", udev->name); list_for_each_entry(name_loop, &udev->symlink_list, node) fprintf(f, "S:%s\n", name_loop->name); @@ -101,8 +116,9 @@ exit: return 0; } -static int parse_db_file(struct udevice *udev, const char *filename) +int udev_db_get_device(struct udevice *udev, const char *devpath) { + char filename[PATH_SIZE]; char line[PATH_SIZE]; unsigned int major, minor; char *bufline; @@ -111,11 +127,13 @@ static int parse_db_file(struct udevice *udev, const char *filename) size_t cur; size_t count; + devpath_to_db_path(devpath, filename, sizeof(filename)); if (file_map(filename, &buf, &bufsize) != 0) { dbg("no db file to read '%s'", filename); return -1; } + strlcpy(udev->devpath, devpath, sizeof(udev->devpath)); cur = 0; while (cur < bufsize) { count = buf_get_line(buf, bufsize, cur); @@ -123,12 +141,6 @@ static int parse_db_file(struct udevice *udev, const char *filename) cur += count+1; switch(bufline[0]) { - case 'P': - if (count > sizeof(udev->devpath)) - count = sizeof(udev->devpath); - memcpy(udev->devpath, &bufline[2], count-2); - udev->devpath[count-2] = '\0'; - break; case 'N': if (count > sizeof(udev->name)) count = sizeof(udev->name); @@ -185,27 +197,15 @@ int udev_db_delete_device(struct udevice *udev) { char filename[PATH_SIZE]; - get_db_filename(udev->devpath, filename, sizeof(filename)); + devpath_to_db_path(udev->devpath, filename, sizeof(filename)); unlink(filename); return 0; } -int udev_db_get_device(struct udevice *udev, const char *devpath) -{ - char filename[PATH_SIZE]; - - get_db_filename(devpath, filename, sizeof(filename)); - if (parse_db_file(udev, filename) != 0) - return -1; - - return 0; -} - -int udev_db_search_name(const char *name, char *devpath, size_t len) +int udev_db_lookup_name(const char *name, char *devpath, size_t len) { DIR *dir; - char path[PATH_SIZE]; int found = 0; dir = opendir(udev_db_path); @@ -227,7 +227,6 @@ int udev_db_search_name(const char *name, char *devpath, size_t len) ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') break; - if (ent->d_name[0] == '.') continue; @@ -247,12 +246,6 @@ int udev_db_search_name(const char *name, char *devpath, size_t len) cur += count+1; switch(bufline[0]) { - case 'P': - if (count > sizeof(path)) - count = sizeof(path); - memcpy(path, &bufline[2], count-2); - path[count-2] = '\0'; - break; case 'N': case 'S': if (count > sizeof(nodename)) @@ -261,8 +254,8 @@ int udev_db_search_name(const char *name, char *devpath, size_t len) nodename[count-2] = '\0'; dbg("compare '%s' '%s'", nodename, name); if (strcmp(nodename, name) == 0) { + db_file_to_devpath(ent->d_name, devpath, len); found = 1; - break; } break; default: @@ -273,10 +266,9 @@ int udev_db_search_name(const char *name, char *devpath, size_t len) } closedir(dir); - if (found) { - strlcpy(devpath, path, len); + if (found) return 0; - } else + else return -1; } @@ -298,7 +290,6 @@ int udev_db_get_all_entries(struct list_head *name_list) ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') break; - if (ent->d_name[0] == '.') continue; diff --git a/udev_db.h b/udev_db.h index b0bc51a2c7..89513932b3 100644 --- a/udev_db.h +++ b/udev_db.h @@ -27,7 +27,7 @@ extern int udev_db_add_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); extern int udev_db_get_device(struct udevice *udev, const char *devpath); -extern int udev_db_search_name(const char *name, char *devpath, size_t len); +extern int udev_db_lookup_name(const char *name, char *devpath, size_t len); extern int udev_db_get_all_entries(struct list_head *name_list); #endif /* _UDEV_DB_H_ */ diff --git a/udev_rules.c b/udev_rules.c index 3cbcad55c1..41a7291d79 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -279,7 +279,7 @@ static int find_free_number(const char *name, const char *devpath) strlcpy(filename, name, sizeof(filename)); while (1) { dbg("look for existing node '%s'", filename); - if (udev_db_search_name(filename, db_devpath, sizeof(db_devpath)) != 0) { + if (udev_db_lookup_name(filename, db_devpath, sizeof(db_devpath)) != 0) { dbg("free num=%d", num); break; } diff --git a/udevinfo.c b/udevinfo.c index fadfaec945..c7d801b87c 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -319,7 +319,7 @@ int main(int argc, char *argv[], char *envp[]) } else pos = name; - retval = udev_db_search_name(pos, devpath, sizeof(devpath)); + retval = udev_db_lookup_name(pos, devpath, sizeof(devpath)); if (retval != 0) { fprintf(stderr, "no record for '%s' in database\n", pos); goto exit; -- cgit v1.2.3-54-g00ecf From 5b13ecb830cdec338b514b9ed8c2c559c2f05223 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Aug 2005 13:49:32 +0200 Subject: add uft8 validation for safe volume label exporting We will not support any other character encoding than plain ascii or utf8 for volume labels. All invalid utf8 and non-ascii characters are substituted for security reasons. No options, no fancy heuristics. Signed-off-by: Kay Sievers --- Makefile | 1 + udev_utils.c | 84 ------------------ udev_utils.h | 29 ++++--- udev_utils_string.c | 243 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 262 insertions(+), 95 deletions(-) create mode 100644 udev_utils_string.c diff --git a/Makefile b/Makefile index 1c1280a7dc..8f99330967 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,7 @@ UDEV_OBJS = \ udev_rules.o \ udev_rules_parse.o \ udev_utils.o \ + udev_utils_string.o \ udev_utils_file.o \ udev_utils_run.o \ udev_libc_wrapper.o diff --git a/udev_utils.c b/udev_utils.c index fc1e2e1f7e..c7292d0f04 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -36,69 +36,6 @@ #include "udev_utils.h" #include "list.h" -/* compare string with pattern (supports * ? [0-9] [!A-Z]) */ -int strcmp_pattern(const char *p, const char *s) -{ - if (s[0] == '\0') { - while (p[0] == '*') - p++; - return (p[0] != '\0'); - } - switch (p[0]) { - case '[': - { - int not = 0; - p++; - if (p[0] == '!') { - not = 1; - p++; - } - while ((p[0] != '\0') && (p[0] != ']')) { - int match = 0; - if (p[1] == '-') { - if ((s[0] >= p[0]) && (s[0] <= p[2])) - match = 1; - p += 3; - } else { - match = (p[0] == s[0]); - p++; - } - if (match ^ not) { - while ((p[0] != '\0') && (p[0] != ']')) - p++; - if (p[0] == ']') - return strcmp_pattern(p+1, s+1); - } - } - } - break; - case '*': - if (strcmp_pattern(p, s+1)) - return strcmp_pattern(p+1, s); - return 0; - case '\0': - if (s[0] == '\0') { - return 0; - } - break; - default: - if ((p[0] == s[0]) || (p[0] == '?')) - return strcmp_pattern(p+1, s+1); - break; - } - return 1; -} - -int string_is_true(const char *str) -{ - if (strcasecmp(str, "true") == 0) - return 1; - if (strcasecmp(str, "yes") == 0) - return 1; - if (strcasecmp(str, "1") == 0) - return 1; - return 0; -} int log_priority(const char *priority) { @@ -143,27 +80,6 @@ int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, u return 0; } -void replace_untrusted_chars(char *string) -{ - size_t len; - - for (len = 0; string[len] != '\0'; len++) { - if (strchr(";,~\\()\'", string[len])) { - info("replace '%c' in '%s'", string[len], string); - string[len] = '_'; - } - } -} - -void remove_trailing_char(char *path, char c) -{ - size_t len; - - len = strlen(path); - while (len > 0 && path[len-1] == c) - path[--len] = '\0'; -} - int name_list_add(struct list_head *name_list, const char *name, int sort) { struct name_entry *loop_name; diff --git a/udev_utils.h b/udev_utils.h index 0a307526b7..a07d8d2b7c 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -31,22 +31,29 @@ struct name_entry { char name[PATH_SIZE]; }; -extern int strcmp_pattern(const char *p, const char *s); -extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); -extern int create_path(const char *path); +/* udev_utils.c */ extern int log_priority(const char *priority); -extern int string_is_true(const char *str); -extern int parse_get_pair(char **orig_string, char **left, char **right); -extern int unlink_secure(const char *filename); -extern int file_map(const char *filename, char **buf, size_t *bufsize); -extern void file_unmap(void *buf, size_t bufsize); -extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); -extern void remove_trailing_char(char *path, char c); -extern void replace_untrusted_chars(char *string); +extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); extern int name_list_add(struct list_head *name_list, const char *name, int sort); extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); extern void name_list_cleanup(struct list_head *name_list); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); + +/* udev_utils_string.c */ +extern int strcmp_pattern(const char *p, const char *s); +extern int string_is_true(const char *str); +extern void replace_untrusted_chars(char *string); +extern void remove_trailing_char(char *path, char c); +extern int utf8_encoded_valid_unichar(const char *str); + +/* udev_utils_file.c */ +extern int create_path(const char *path); +extern int file_map(const char *filename, char **buf, size_t *bufsize); +extern void file_unmap(void *buf, size_t bufsize); +extern int unlink_secure(const char *filename); +extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); + +/* udev_utils_run.c */ extern int pass_env_to_socket(const char *name, const char *devpath, const char *action); extern int run_program(const char *command, const char *subsystem, char *result, size_t ressize, size_t *reslen, int log); diff --git a/udev_utils_string.c b/udev_utils_string.c new file mode 100644 index 0000000000..a30181e760 --- /dev/null +++ b/udev_utils_string.c @@ -0,0 +1,243 @@ +/* + * udev_utils_string.c - string manipulation + * + * Copyright (C) 2004-2005 Kay Sievers + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev_libc_wrapper.h" +#include "udev.h" +#include "logging.h" +#include "udev_utils.h" +#include "list.h" + +/* compare string with pattern (like fnmatch(), supports * ? [0-9] [!A-Z]) */ +int strcmp_pattern(const char *p, const char *s) +{ + if (s[0] == '\0') { + while (p[0] == '*') + p++; + return (p[0] != '\0'); + } + switch (p[0]) { + case '[': + { + int not = 0; + p++; + if (p[0] == '!') { + not = 1; + p++; + } + while ((p[0] != '\0') && (p[0] != ']')) { + int match = 0; + if (p[1] == '-') { + if ((s[0] >= p[0]) && (s[0] <= p[2])) + match = 1; + p += 3; + } else { + match = (p[0] == s[0]); + p++; + } + if (match ^ not) { + while ((p[0] != '\0') && (p[0] != ']')) + p++; + if (p[0] == ']') + return strcmp_pattern(p+1, s+1); + } + } + } + break; + case '*': + if (strcmp_pattern(p, s+1)) + return strcmp_pattern(p+1, s); + return 0; + case '\0': + if (s[0] == '\0') { + return 0; + } + break; + default: + if ((p[0] == s[0]) || (p[0] == '?')) + return strcmp_pattern(p+1, s+1); + break; + } + return 1; +} + +int string_is_true(const char *str) +{ + if (strcasecmp(str, "true") == 0) + return 1; + if (strcasecmp(str, "yes") == 0) + return 1; + if (strcasecmp(str, "1") == 0) + return 1; + return 0; +} + +void remove_trailing_char(char *path, char c) +{ + size_t len; + + len = strlen(path); + while (len > 0 && path[len-1] == c) + path[--len] = '\0'; +} + +/* count of characters used to encode one unicode char */ +static int utf8_encoded_expected_len(const char *str) +{ + unsigned char c = (unsigned char)str[0]; + + if (c < 0x80) + return 1; + if ((c & 0xe0) == 0xc0) + return 2; + if ((c & 0xf0) == 0xe0) + return 3; + if ((c & 0xf8) == 0xf0) + return 4; + if ((c & 0xfc) == 0xf8) + return 5; + if ((c & 0xfe) == 0xfc) + return 6; + return 0; +} + +/* decode one unicode char */ +static int utf8_encoded_to_unichar(const char *str) +{ + int unichar; + int len; + int i; + + len = utf8_encoded_expected_len(str); + switch (len) { + case 1: + return (int)str[0]; + case 2: + unichar = str[0] & 0x1f; + break; + case 3: + unichar = (int)str[0] & 0x0f; + break; + case 4: + unichar = (int)str[0] & 0x07; + break; + case 5: + unichar = (int)str[0] & 0x03; + break; + case 6: + unichar = (int)str[0] & 0x01; + break; + default: + return -1; + } + + for (i = 1; i < len; i++) { + if (((int)str[i] & 0xc0) != 0x80) + return -1; + unichar <<= 6; + unichar |= (int)str[i] & 0x3f; + } + + return unichar; +} + +/* expected size used to encode one unicode char */ +static int utf8_unichar_to_encoded_len(int unichar) +{ + if (unichar < 0x80) + return 1; + if (unichar < 0x800) + return 2; + if (unichar < 0x10000) + return 3; + if (unichar < 0x200000) + return 4; + if (unichar < 0x4000000) + return 5; + return 6; +} + +/* check if unicode char has a valid numeric range */ +static int utf8_unichar_valid_range(int unichar) +{ + if (unichar > 0x10ffff) + return 0; + if ((unichar & 0xfffff800) == 0xd800) + return 0; + if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) + return 0; + if ((unichar & 0xffff) == 0xffff) + return 0; + return 1; +} + +/* validate one encoded unicode char and return its length */ +int utf8_encoded_valid_unichar(const char *str) +{ + int len; + int unichar; + int i; + + len = utf8_encoded_expected_len(str); + if (len == 0) + return -1; + + /* ascii is valid */ + if (len == 1) + return 1; + + /* check if expected encoded chars are available */ + for (i = 0; i < len; i++) + if ((str[i] & 0x80) != 0x80) + return -1; + + unichar = utf8_encoded_to_unichar(str); + + /* check if encoded length matches encoded value */ + if (utf8_unichar_to_encoded_len(unichar) != len) + return -1; + + /* check if value has valid range */ + if (!utf8_unichar_valid_range(unichar)) + return -1; + + return len; +} + +void replace_untrusted_chars(char *string) +{ + size_t len; + + for (len = 0; string[len] != '\0'; len++) { + if (strchr(";,~\\()\'", string[len])) + string[len] = '_'; + } +} -- cgit v1.2.3-54-g00ecf From 764ce7f2ab526c084f005186e0dcbabe59070247 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Aug 2005 15:55:58 +0200 Subject: start to enforce plain ascii or valid utf8 No device node or symlink can have other characters as plain readable ascii or valid utf8. The /dev/disk/by-label/* symlinks can no longer contain weird stuff read from untrusted sources. Signed-off-by: Kay Sievers --- test/udev-test.pl | 20 +++++++++++++++++++- udev_rules.c | 21 ++++++++++++++++++--- udev_utils.h | 2 +- udev_utils_string.c | 33 ++++++++++++++++++++++++++++----- 4 files changed, 66 insertions(+), 10 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index c32cfe7eeb..e7c00e29e6 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1324,7 +1324,25 @@ EOF devpath => "/block/sda/sda1", exp_name => "sane", rules => < "untrusted string sanitize (don't replace utf8)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "uber", + rules => < "untrusted string sanitize (replace invalid utf8)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "replaced", + rules => < 0 && isspace(temp2[i-1])) temp2[--i] = '\0'; - replace_untrusted_chars(temp2); + count = replace_untrusted_chars(temp2); + if (count) + info("%i untrusted character(s) replaced" , count); strlcat(string, temp2, maxsize); dbg("substitute sysfs value '%s'", temp2); break; @@ -812,9 +815,13 @@ try_parent: if (rule->program.operation != KEY_OP_NOMATCH) goto exit; } else { + int count; + dbg("PROGRAM matches"); remove_trailing_char(result, '\n'); - replace_untrusted_chars(result); + count = replace_untrusted_chars(result); + if (count) + info("%i untrusted character(s) replaced" , count); dbg("result is '%s'", result); strlcpy(udev->program_result, result, sizeof(udev->program_result)); dbg("PROGRAM returned successful"); @@ -960,6 +967,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s if (!udev->symlink_final && rule->symlink.operation != KEY_OP_UNSET) { char temp[PATH_SIZE]; char *pos, *next; + int count; if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) udev->symlink_final = 1; @@ -969,7 +977,10 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s } strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); - dbg("rule applied, added symlink '%s'", temp); + count = replace_untrusted_chars(temp); + if (count) + info("%i untrusted character(s) replaced" , count); + dbg("rule applied, added symlink(s) '%s'", temp); /* add multiple symlinks separated by spaces */ pos = temp; @@ -993,9 +1004,13 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s /* set name, later rules with name set will be ignored */ if (rule->name.operation != KEY_OP_UNSET) { + int count; name_set = 1; strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); + count = replace_untrusted_chars(udev->name); + if (count) + info("%i untrusted character(s) replaced", count); info("rule applied, '%s' becomes '%s'", udev->kernel_name, udev->name); if (udev->type != DEV_NET) diff --git a/udev_utils.h b/udev_utils.h index a07d8d2b7c..ad415641d8 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -42,9 +42,9 @@ extern int add_matching_files(struct list_head *name_list, const char *dirname, /* udev_utils_string.c */ extern int strcmp_pattern(const char *p, const char *s); extern int string_is_true(const char *str); -extern void replace_untrusted_chars(char *string); extern void remove_trailing_char(char *path, char c); extern int utf8_encoded_valid_unichar(const char *str); +extern int replace_untrusted_chars(char *str); /* udev_utils_file.c */ extern int create_path(const char *path); diff --git a/udev_utils_string.c b/udev_utils_string.c index a30181e760..bb5677d46e 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -232,12 +232,35 @@ int utf8_encoded_valid_unichar(const char *str) return len; } -void replace_untrusted_chars(char *string) +/* replace everything but whitelisted plain ascii and valid utf8 */ +int replace_untrusted_chars(char *str) { - size_t len; + size_t i = 0; + int replaced = 0; + + while (str[i] != '\0') { + int len; + + /* valid printable ascii char */ + if ((str[i] >= '0' && str[i] <= '9') || + (str[i] >= 'A' && str[i] <= 'Z') || + (str[i] >= 'a' && str[i] <= 'z') || + strchr(" #$%+-./:=?@_", str[i])) { + i++; + continue; + } + /* valid utf8 is accepted */ + len = utf8_encoded_valid_unichar(&str[i]); + if (len > 1) { + i += len; + continue; + } - for (len = 0; string[len] != '\0'; len++) { - if (strchr(";,~\\()\'", string[len])) - string[len] = '_'; + /* everything else is garbage */ + str[i] = '_'; + i++; + replaced++; } + + return replaced; } -- cgit v1.2.3-54-g00ecf From f1ff8d7b4ad1f95385d42c3fa1b2a997b9e6d5f5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Aug 2005 20:25:37 +0200 Subject: use WRITE_END/READ_END for the pipe index Signed-off-by: Kay Sievers --- udev_utils.h | 4 ++++ udev_utils_run.c | 66 ++++++++++++++++++++++++++++---------------------------- udevd.c | 28 ++++++++++++------------ 3 files changed, 51 insertions(+), 47 deletions(-) diff --git a/udev_utils.h b/udev_utils.h index ad415641d8..9ff79113b1 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -26,6 +26,10 @@ #define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) +/* pipes */ +#define READ_END 0 +#define WRITE_END 1 + struct name_entry { struct list_head node; char name[PATH_SIZE]; diff --git a/udev_utils_run.c b/udev_utils_run.c index fb37a05830..1315154c26 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -130,26 +130,26 @@ int run_program(const char *command, const char *subsystem, switch(pid) { case 0: /* child closes parent ends of pipes */ - if (outpipe[0] > 0) - close(outpipe[0]); - if (errpipe[0] > 0) - close(errpipe[0]); + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); /* discard child output or connect to pipe */ devnull = open("/dev/null", O_RDWR); if (devnull > 0) { dup2(devnull, STDIN_FILENO); - if (outpipe[1] < 0) + if (outpipe[WRITE_END] < 0) dup2(devnull, STDOUT_FILENO); - if (errpipe[1] < 0) + if (errpipe[WRITE_END] < 0) dup2(devnull, STDERR_FILENO); close(devnull); } else err("open /dev/null failed"); - if (outpipe[1] > 0) - dup2(outpipe[1], STDOUT_FILENO); - if (errpipe[1] > 0) - dup2(errpipe[1], STDERR_FILENO); + if (outpipe[WRITE_END] > 0) + dup2(outpipe[WRITE_END], STDOUT_FILENO); + if (errpipe[WRITE_END] > 0) + dup2(errpipe[WRITE_END], STDERR_FILENO); execv(argv[0], argv); /* we should never reach this */ @@ -160,27 +160,27 @@ int run_program(const char *command, const char *subsystem, return -1; default: /* read from child if requested */ - if (outpipe[0] > 0 || errpipe[0] > 0) { + if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { ssize_t count; size_t respos = 0; /* parent closes child ends of pipes */ - if (outpipe[1] > 0) - close(outpipe[1]); - if (errpipe[1] > 0) - close(errpipe[1]); + if (outpipe[WRITE_END] > 0) + close(outpipe[WRITE_END]); + if (errpipe[WRITE_END] > 0) + close(errpipe[WRITE_END]); /* read child output */ - while (outpipe[0] > 0 || errpipe[0] > 0) { + while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { int fdcount; fd_set readfds; FD_ZERO(&readfds); - if (outpipe[0] > 0) - FD_SET(outpipe[0], &readfds); - if (errpipe[0] > 0) - FD_SET(errpipe[0], &readfds); - fdcount = select(UDEV_MAX(outpipe[0], errpipe[0])+1, &readfds, NULL, NULL, NULL); + if (outpipe[READ_END] > 0) + FD_SET(outpipe[READ_END], &readfds); + if (errpipe[READ_END] > 0) + FD_SET(errpipe[READ_END], &readfds); + fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno == EINTR) continue; @@ -189,15 +189,15 @@ int run_program(const char *command, const char *subsystem, } /* get stdout */ - if (outpipe[0] > 0 && FD_ISSET(outpipe[0], &readfds)) { + if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { char inbuf[1024]; char *pos; char *line; - count = read(outpipe[0], inbuf, sizeof(inbuf)-1); + count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); if (count <= 0) { - close(outpipe[0]); - outpipe[0] = -1; + close(outpipe[READ_END]); + outpipe[READ_END] = -1; if (count < 0) { err("stdin read failed with '%s'", strerror(errno)); retval = -1; @@ -223,15 +223,15 @@ int run_program(const char *command, const char *subsystem, } /* get stderr */ - if (errpipe[0] > 0 && FD_ISSET(errpipe[0], &readfds)) { + if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { char errbuf[1024]; char *pos; char *line; - count = read(errpipe[0], errbuf, sizeof(errbuf)-1); + count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); if (count <= 0) { - close(errpipe[0]); - errpipe[0] = -1; + close(errpipe[READ_END]); + errpipe[READ_END] = -1; if (count < 0) err("stderr read failed with '%s'", strerror(errno)); continue; @@ -243,10 +243,10 @@ int run_program(const char *command, const char *subsystem, info("'%s' (stderr) '%s'", argv[0], line); } } - if (outpipe[0] > 0) - close(outpipe[0]); - if (errpipe[0] > 0) - close(errpipe[0]); + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); /* return the childs stdout string */ if (result) { diff --git a/udevd.c b/udevd.c index e4880c9814..d26d53fe0b 100644 --- a/udevd.c +++ b/udevd.c @@ -55,7 +55,7 @@ static int udevd_sock; static int uevent_netlink_sock; static pid_t sid; -static int pipefds[2] = {-1, -1}; +static int signal_pipe[2] = {-1, -1}; static volatile int sigchilds_waiting; static volatile int run_msg_q; static volatile int sig_flag; @@ -657,7 +657,7 @@ static void asmlinkage sig_handler(int signum) * which will wakeup our mainloop */ if (!sig_flag) { - rc = write(pipefds[1], &signum, sizeof(signum)); + rc = write(signal_pipe[1], &signum, sizeof(signum)); if (rc >= 0) sig_flag = 1; } @@ -842,25 +842,25 @@ int main(int argc, char *argv[], char *envp[]) setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); /* setup signal handler pipe */ - retval = pipe(pipefds); + retval = pipe(signal_pipe); if (retval < 0) { err("error getting pipes: %s", strerror(errno)); goto exit; } - retval = fcntl(pipefds[0], F_SETFL, O_NONBLOCK); + retval = fcntl(signal_pipe[READ_END], F_SETFL, O_NONBLOCK); if (retval < 0) { err("error fcntl on read pipe: %s", strerror(errno)); goto exit; } - retval = fcntl(pipefds[0], F_SETFD, FD_CLOEXEC); + retval = fcntl(signal_pipe[READ_END], F_SETFD, FD_CLOEXEC); if (retval < 0) err("error fcntl on read pipe: %s", strerror(errno)); - retval = fcntl(pipefds[1], F_SETFL, O_NONBLOCK); + retval = fcntl(signal_pipe[WRITE_END], F_SETFL, O_NONBLOCK); if (retval < 0) { err("error fcntl on write pipe: %s", strerror(errno)); goto exit; } - retval = fcntl(pipefds[1], F_SETFD, FD_CLOEXEC); + retval = fcntl(signal_pipe[WRITE_END], F_SETFD, FD_CLOEXEC); if (retval < 0) err("error fcntl on write pipe: %s", strerror(errno)); @@ -934,7 +934,7 @@ int main(int argc, char *argv[], char *envp[]) int fdcount; FD_ZERO(&readfds); - FD_SET(pipefds[0], &readfds); + FD_SET(signal_pipe[READ_END], &readfds); FD_SET(udevd_sock, &readfds); if (uevent_netlink_sock > 0) FD_SET(uevent_netlink_sock, &readfds); @@ -974,12 +974,12 @@ int main(int argc, char *argv[], char *envp[]) } /* received a signal, clear our notification pipe */ - if (FD_ISSET(pipefds[0], &readfds)) { + if (FD_ISSET(signal_pipe[0], &readfds)) { int sig; ssize_t rlen; while(1) { - rlen = read(pipefds[0], &sig, sizeof(sig)); + rlen = read(signal_pipe[0], &sig, sizeof(sig)); if (rlen <= 0) break; } @@ -1011,10 +1011,10 @@ int main(int argc, char *argv[], char *envp[]) } exit: - if (pipefds[0] > 0) - close(pipefds[0]); - if (pipefds[1] > 0) - close(pipefds[1]); + if (signal_pipe[READ_END] > 0) + close(signal_pipe[READ_END]); + if (signal_pipe[WRITE_END] > 0) + close(signal_pipe[WRITE_END]); if (udevd_sock > 0) close(udevd_sock); -- cgit v1.2.3-54-g00ecf From c6303c1316e967ae2c52792b0560ee055ce4276e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Aug 2005 23:13:14 +0200 Subject: remove not needed sig_flag for state of signal_pipe Less internal state is better. And, we don't need to call read() twice with every signal handling. Signed-off-by: Kay Sievers --- udevd.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/udevd.c b/udevd.c index d26d53fe0b..3392eea1a1 100644 --- a/udevd.c +++ b/udevd.c @@ -636,8 +636,6 @@ static struct uevent_msg *get_netlink_msg(void) static void asmlinkage sig_handler(int signum) { - int rc; - switch (signum) { case SIGINT: case SIGTERM: @@ -653,14 +651,8 @@ static void asmlinkage sig_handler(int signum) break; } - /* if pipe is empty, write to pipe to force select to return, - * which will wakeup our mainloop - */ - if (!sig_flag) { - rc = write(signal_pipe[1], &signum, sizeof(signum)); - if (rc >= 0) - sig_flag = 1; - } + /* write to pipe, which will wakeup select() in our mainloop */ + write(signal_pipe[WRITE_END], "", 1); } static void udev_done(int pid) @@ -974,16 +966,10 @@ int main(int argc, char *argv[], char *envp[]) } /* received a signal, clear our notification pipe */ - if (FD_ISSET(signal_pipe[0], &readfds)) { - int sig; - ssize_t rlen; - - while(1) { - rlen = read(signal_pipe[0], &sig, sizeof(sig)); - if (rlen <= 0) - break; - } - sig_flag = 0; + if (FD_ISSET(signal_pipe[READ_END], &readfds)) { + char buf[256]; + + read(signal_pipe[READ_END], &buf, sizeof(buf)); } /* forked child have returned */ -- cgit v1.2.3-54-g00ecf From d2ecd6a19d147ede317995cce1b21042291a6b19 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Aug 2005 23:14:59 +0200 Subject: don't reenter get_udevd_msg() if message is ignored Check all event sources with every iteration. Signed-off-by: Kay Sievers --- udevd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/udevd.c b/udevd.c index 3392eea1a1..c75141f9fa 100644 --- a/udevd.c +++ b/udevd.c @@ -946,9 +946,8 @@ int main(int argc, char *argv[], char *envp[]) if (uevent_netlink_active && msg->type == UDEVD_UEVENT_UDEVSEND && msg->seqnum != 0) { dbg("skip uevent_helper message, netlink is active"); free(msg); - continue; - } - msg_queue_insert(msg); + } else + msg_queue_insert(msg); } } -- cgit v1.2.3-54-g00ecf From b2c6818dc35f7b149bba7bf963d1a3afb8daa867 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Aug 2005 23:15:51 +0200 Subject: rename ...trailing_char() to ...trailing_chars() Signed-off-by: Kay Sievers --- udev_config.c | 8 ++++---- udev_device.c | 2 +- udev_rules.c | 4 ++-- udev_utils.h | 2 +- udev_utils_string.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/udev_config.c b/udev_config.c index f0b409b067..b8c4ffc8ed 100644 --- a/udev_config.c +++ b/udev_config.c @@ -149,19 +149,19 @@ static int parse_config_file(void) if (strcasecmp(variable, "udev_root") == 0) { strlcpy(udev_root, value, sizeof(udev_root)); - remove_trailing_char(udev_root, '/'); + remove_trailing_chars(udev_root, '/'); continue; } if (strcasecmp(variable, "udev_db") == 0) { strlcpy(udev_db_path, value, sizeof(udev_db_path)); - remove_trailing_char(udev_db_path, '/'); + remove_trailing_chars(udev_db_path, '/'); continue; } if (strcasecmp(variable, "udev_rules") == 0) { strlcpy(udev_rules_filename, value, sizeof(udev_rules_filename)); - remove_trailing_char(udev_rules_filename, '/'); + remove_trailing_chars(udev_rules_filename, '/'); continue; } @@ -195,7 +195,7 @@ void udev_init_config(void) env = getenv("UDEV_CONFIG_FILE"); if (env) { strlcpy(udev_config_filename, env, sizeof(udev_config_filename)); - remove_trailing_char(udev_config_filename, '/'); + remove_trailing_chars(udev_config_filename, '/'); } parse_config_file(); diff --git a/udev_device.c b/udev_device.c index db72d3007d..ad6f706366 100644 --- a/udev_device.c +++ b/udev_device.c @@ -58,7 +58,7 @@ int udev_init_device(struct udevice *udev, const char* devpath, const char *subs if (devpath) { strlcpy(udev->devpath, devpath, sizeof(udev->devpath)); - remove_trailing_char(udev->devpath, '/'); + remove_trailing_chars(udev->devpath, '/'); if (strncmp(udev->devpath, "/block/", 7) == 0) udev->type = DEV_BLOCK; diff --git a/udev_rules.c b/udev_rules.c index c1482c34b5..459c27b4d5 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -326,7 +326,7 @@ static int find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sys attr_found: strlcpy(value, tmpattr->value, len); - remove_trailing_char(value, '\n'); + remove_trailing_chars(value, '\n'); dbg("found attribute '%s'", tmpattr->path); return 0; @@ -818,7 +818,7 @@ try_parent: int count; dbg("PROGRAM matches"); - remove_trailing_char(result, '\n'); + remove_trailing_chars(result, '\n'); count = replace_untrusted_chars(result); if (count) info("%i untrusted character(s) replaced" , count); diff --git a/udev_utils.h b/udev_utils.h index 9ff79113b1..ea39a028f5 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -46,7 +46,7 @@ extern int add_matching_files(struct list_head *name_list, const char *dirname, /* udev_utils_string.c */ extern int strcmp_pattern(const char *p, const char *s); extern int string_is_true(const char *str); -extern void remove_trailing_char(char *path, char c); +extern void remove_trailing_chars(char *path, char c); extern int utf8_encoded_valid_unichar(const char *str); extern int replace_untrusted_chars(char *str); diff --git a/udev_utils_string.c b/udev_utils_string.c index bb5677d46e..37db8dbc85 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -100,7 +100,7 @@ int string_is_true(const char *str) return 0; } -void remove_trailing_char(char *path, char c) +void remove_trailing_chars(char *path, char c) { size_t len; -- cgit v1.2.3-54-g00ecf From e79952c59854e6d5fab638262498d8395acd33ff Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Aug 2005 23:16:56 +0200 Subject: vol_id: ID_LABEL_SAFE will no longer contain fancy characters Signed-off-by: Kay Sievers --- extras/volume_id/vol_id.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index fe0b3a0ed0..3c75bdaa2f 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -156,6 +156,7 @@ int main(int argc, char *argv[]) print: set_str(name, vid->label, sizeof(vid->label)); + replace_untrusted_chars(name); switch (print) { case PRINT_EXPORT: -- cgit v1.2.3-54-g00ecf From 199cdd8675379768c69bf789e2159c360ae0332e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Aug 2005 23:19:45 +0200 Subject: udevd: move some logging to "info" and "err" Signed-off-by: Kay Sievers --- udevd.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/udevd.c b/udevd.c index c75141f9fa..3a8ac639bd 100644 --- a/udevd.c +++ b/udevd.c @@ -58,7 +58,6 @@ static pid_t sid; static int signal_pipe[2] = {-1, -1}; static volatile int sigchilds_waiting; static volatile int run_msg_q; -static volatile int sig_flag; static volatile int udev_exit; static int init_phase = 1; static int run_exec_q; @@ -440,7 +439,7 @@ recheck: /* set timeout for remaining queued events */ if (!list_empty(&msg_list)) { struct itimerval itv = {{0, 0}, {timeout - msg_age, 0}}; - dbg("next event expires in %li seconds", timeout - msg_age); + info("next event expires in %li seconds", timeout - msg_age); setitimer(ITIMER_REAL, &itv, NULL); } } @@ -523,31 +522,31 @@ static struct uevent_msg *get_udevd_msg(void) size = recvmsg(udevd_sock, &smsg, 0); if (size < 0) { if (errno != EINTR) - dbg("unable to receive udevd message"); + err("unable to receive udevd message"); return NULL; } cmsg = CMSG_FIRSTHDR(&smsg); cred = (struct ucred *) CMSG_DATA(cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - info("no sender credentials received, message ignored"); + err("no sender credentials received, message ignored"); return NULL; } if (cred->uid != 0) { - info("sender uid=%i, message ignored", cred->uid); + err("sender uid=%i, message ignored", cred->uid); return NULL; } if (strncmp(usend_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { - info("message magic '%s' doesn't match, ignore it", usend_msg.magic); + err("message magic '%s' doesn't match, ignore it", usend_msg.magic); return NULL; } switch (usend_msg.type) { case UDEVD_UEVENT_UDEVSEND: case UDEVD_UEVENT_INITSEND: - dbg("udevd event message received"); + info("udevd event message received"); envbuf_size = size - offsetof(struct udevd_msg, envbuf); dbg("envbuf_size=%i", envbuf_size); msg = get_msg_from_envbuf(usend_msg.envbuf, envbuf_size); @@ -594,7 +593,7 @@ static struct uevent_msg *get_netlink_msg(void) size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); if (size < 0) { if (errno != EINTR) - dbg("unable to receive udevd message"); + err("unable to receive udevd message"); return NULL; } @@ -613,20 +612,20 @@ static struct uevent_msg *get_netlink_msg(void) /* validate message */ pos = strchr(buffer, '@'); if (pos == NULL) { - dbg("invalid uevent '%s'", buffer); + err("invalid uevent '%s'", buffer); free(msg); return NULL; } pos[0] = '\0'; if (msg->action == NULL) { - dbg("no ACTION in payload found, skip event '%s'", buffer); + err("no ACTION in payload found, skip event '%s'", buffer); free(msg); return NULL; } if (strcmp(msg->action, buffer) != 0) { - dbg("ACTION in payload does not match uevent, skip event '%s'", buffer); + err("ACTION in payload does not match uevent, skip event '%s'", buffer); free(msg); return NULL; } @@ -664,7 +663,10 @@ static void udev_done(int pid) list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { sysinfo(&info); - info("seq %llu exit, %ld seconds old", msg->seqnum, info.uptime - msg->queue_time); + if (msg->queue_time) + info("seq %llu, pid [%d] exit, %ld seconds old", msg->seqnum, msg->pid, info.uptime - msg->queue_time); + else + info("seq 0, pid [%d] exit", msg->pid); msg_queue_delete(msg); /* we want to run the exec queue manager since there may @@ -739,7 +741,7 @@ static int init_uevent_netlink_sock(void) uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_netlink_sock == -1) { - dbg("error getting socket, %s", strerror(errno)); + err("error getting socket, %s", strerror(errno)); return -1; } @@ -749,7 +751,7 @@ static int init_uevent_netlink_sock(void) retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { - dbg("bind failed, %s", strerror(errno)); + err("bind failed, %s", strerror(errno)); close(uevent_netlink_sock); uevent_netlink_sock = -1; return -1; @@ -944,7 +946,7 @@ int main(int argc, char *argv[], char *envp[]) if (msg) { /* discard kernel messages if netlink is active */ if (uevent_netlink_active && msg->type == UDEVD_UEVENT_UDEVSEND && msg->seqnum != 0) { - dbg("skip uevent_helper message, netlink is active"); + info("skip uevent_helper message with SEQNUM, netlink is active"); free(msg); } else msg_queue_insert(msg); -- cgit v1.2.3-54-g00ecf From 69348b66ff4163a2fbf974bde649e5bc963462b4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Aug 2005 01:19:02 +0200 Subject: remove special TIMEOUT handling from incoming queue Moving events directly to the exec queue instead of the reordering incoming queue, leaves holes in the sequence, that lead to timeouts for all other events. Remove that part of the special handling. (With netlink, events can't get out-of-order and the maximum timeout is 5 seconds and should not cause any trouble with the 10 sec timout for the firmware class anyway. Events with timeouts are still prioritized for execution, but don't bypass the incoming queue anymore.) Many thanks to: Uberto Barbini for his endless debugging and sending all the traces, that showed this failure with his DVB device: UEVENT[1124474094] add@/module/stv0299 UEVENT[1124474094] add@/module/ves1x93 UEVENT[1124474094] add@/module/ttpci_eeprom UEVENT[1124474094] add@/module/saa7146 UEVENT[1124474094] add@/module/video_buf UEVENT[1124474094] add@/module/saa7146_vv UEVENT[1124474094] add@/module/dvb_core UEVENT[1124474094] add@/module/dvb_ttpci UEVENT[1124474094] add@/bus/pci/drivers/dvb UEVENT[1124474094] add@/class/firmware/0000:00:14.0 UDEV [1124474094] add@/module/dvb_core UDEV [1124474094] add@/module/saa7146_vv UDEV [1124474094] add@/module/dvb_ttpci UDEV [1124474094] add@/module/ves1x93 UDEV [1124474094] add@/module/ttpci_eeprom UDEV [1124474094] add@/module/saa7146 UDEV [1124474094] add@/module/stv0299 UDEV [1124474094] add@/module/video_buf UDEV [1124474094] add@/bus/pci/drivers/dvb UEVENT[1124474094] remove@/class/firmware/0000:00:14.0 <- event with TIMEOUT will leave a hole in the incoming UDEV [1124474094] add@/class/firmware/0000:00:14.0 sequence, which will cause a wait for the alarm() UEVENT[1124474094] add@/class/i2c-adapter/i2c-1 that flushes the queue UEVENT[1124474094] add@/class/i2c-dev/i2c-1 UDEV [1124474094] remove@/class/firmware/0000:00:14.0 <- event also has TIMEOUT and is executed immediately UEVENT[1124474095] add@/class/dvb/dvb0.demux0 UEVENT[1124474095] add@/class/dvb/dvb0.dvr0 UEVENT[1124474095] add@/class/dvb/dvb0.video0 UEVENT[1124474095] add@/class/dvb/dvb0.audio0 UEVENT[1124474095] add@/class/dvb/dvb0.ca0 UEVENT[1124474095] add@/class/dvb/dvb0.osd0 UEVENT[1124474095] add@/class/dvb/dvb0.net0 UEVENT[1124474095] add@/class/video4linux/video1 UEVENT[1124474095] add@/class/dvb/dvb0.frontend0 UDEV [1124474099] add@/class/i2c-adapter/i2c-1 <- all others have 5 seconds delay cause of the missing event UDEV [1124474099] add@/class/dvb/dvb0.ca0 missing events UDEV [1124474099] add@/class/dvb/dvb0.osd0 UDEV [1124474099] add@/class/video4linux/video1 UDEV [1124474099] add@/class/dvb/dvb0.frontend0 UDEV [1124474099] add@/class/dvb/dvb0.video0 UDEV [1124474099] add@/class/dvb/dvb0.audio0 UDEV [1124474099] add@/class/i2c-dev/i2c-1 UDEV [1124474099] add@/class/dvb/dv My test program that simulates a similar sequence, runs without any delay now. (With one of the next versions we will make netlink mandatory, then we can remove the whole input queue crap with the reordering anyway.) Signed-off-by: Kay Sievers --- udevd.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/udevd.c b/udevd.c index 3a8ac639bd..96d4fbb3be 100644 --- a/udevd.c +++ b/udevd.c @@ -131,15 +131,6 @@ static void msg_queue_insert(struct uevent_msg *msg) init_phase = 0; } - /* don't delay messages with timeout set */ - if (msg->timeout) { - info("seq %llu with timeout %u seconds will be execute without queuing, '%s' '%s'", - msg->seqnum, msg->timeout, msg->action, msg->devpath); - list_add(&msg->node, &exec_list); - run_exec_q = 1; - return; - } - /* sort message by sequence number into list */ list_for_each_entry_reverse(loop_msg, &msg_list, node) { if (loop_msg->seqnum < msg->seqnum) -- cgit v1.2.3-54-g00ecf From a8586078fc768e930624f29347fedcbb5c5f41cf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Aug 2005 02:19:36 +0200 Subject: udev_test.pl: we replace untrusted chars with '_' Signed-off-by: Kay Sievers --- test/udev-test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index e7c00e29e6..44bc483cf1 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1342,7 +1342,7 @@ EOF devpath => "/block/sda/sda1", exp_name => "replaced", rules => < Date: Mon, 29 Aug 2005 03:48:17 +0200 Subject: check the udevdb before assigning a new %e A second "add" event created a new enumeration with %e. Check the udevdb first and if a matching name is already used. Signed-off-by: Kay Sievers --- udev_rules.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 459c27b4d5..7c73356831 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -267,16 +267,58 @@ static int import_parent_into_env(struct udevice *udev, struct sysfs_class_devic return rc; } -/* finds the lowest positive N such that N isn't present in the udevdb - * if doesn't exist, 0 is returned, N otherwise - */ -static int find_free_number(const char *name, const char *devpath) +static int match_name_and_get_number(const char *base, const char *devname) +{ + size_t baselen; + char *endptr; + int num; + + baselen = strlen(base); + if (strncmp(base, devname, baselen) != 0) + return -1; + if (devname[baselen] == '\0') + return 0; + if (!isdigit(devname[baselen])) + return -1; + num = strtoul(&devname[baselen], &endptr, 10); + if (endptr[0] != '\0') + return -1; + return num; +} + +/* finds the lowest positive device number such that N isn't present in the udevdb + * if doesn't exist, 0 is returned, N otherwise */ +static int find_free_number(const char *base, const char *devpath) { char db_devpath[PATH_SIZE]; char filename[PATH_SIZE]; + struct udevice udev_db; int num = 0; - strlcpy(filename, name, sizeof(filename)); + /* check if the device already owns a matching name */ + udev_init_device(&udev_db, NULL, NULL, NULL); + if (udev_db_get_device(&udev_db, devpath) == 0) { + struct name_entry *name_loop; + int devnum; + + devnum = match_name_and_get_number(base, udev_db.name); + if (devnum >= 0) { + num = devnum; + dbg("device '%s', already has the node '%s' with num %u, use it", devpath, base, num); + goto out; + } + list_for_each_entry(name_loop, &udev_db.symlink_list, node) { + devnum = match_name_and_get_number(base, name_loop->name); + if (devnum >= 0) { + num = devnum; + dbg("device '%s', already has a symlink '%s' with num %u, use it", devpath, base, num); + goto out; + } + } + } + + /* just search the database again and again until a free name is found */ + strlcpy(filename, base, sizeof(filename)); while (1) { dbg("look for existing node '%s'", filename); if (udev_db_lookup_name(filename, db_devpath, sizeof(db_devpath)) != 0) { @@ -290,10 +332,12 @@ static int find_free_number(const char *name, const char *devpath) num = -1; break; } - snprintf(filename, sizeof(filename), "%s%d", name, num); + snprintf(filename, sizeof(filename), "%s%d", base, num); filename[sizeof(filename)-1] = '\0'; } +out: + udev_cleanup_device(&udev_db); return num; } @@ -345,12 +389,12 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) while (--loop) { if (stat(filename, &stats) == 0) { - dbg("file appeared after %i loops", (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + info("file appeared after %i loops", (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - dbg("waiting for '%s' failed", filename); + info("waiting for '%s' failed", filename); return -1; } @@ -669,6 +713,7 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k return -1; } +/* match a single rule against a given device and possibly its parent devices */ static int match_rule(struct udevice *udev, struct udev_rule *rule, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { -- cgit v1.2.3-54-g00ecf From b581515ce8ab4760ba9a4095a7eb98fa352e02a7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Aug 2005 03:49:40 +0200 Subject: update RELEASE-NOTES Signed-off-by: Kay Sievers --- RELEASE-NOTES | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ee992d1e60..76d945e2e0 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,11 @@ +udev 069 +======== +A bunch of mostly trivial bugfixes. From now on no node name or +symlink name can contain any character than plain whitelisted ascii +characters or validated utf8 byte-streams. This is needed for the +/dev/disk/by-label/* links, cause we import untrusted data and +export it to the filesystem. + udev 068 ======== More bugfixes. If udevd was started from the kernel, we don't -- cgit v1.2.3-54-g00ecf From 24ca5c3398eb61380e0add8b9ffac1651a008bb3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Aug 2005 15:01:08 +0200 Subject: udevinfo: add database export Signed-off-by: Kay Sievers --- udevinfo.8 | 3 ++ udevinfo.c | 156 +++++++++++++++++++++++++++++++++---------------------------- 2 files changed, 87 insertions(+), 72 deletions(-) diff --git a/udevinfo.8 b/udevinfo.8 index ac8cc7fda5..28904fef47 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -51,6 +51,9 @@ unique attributes to compose a rule. Print the relationship between the devpath and the node name for all devices currently available in the database. .TP +.B \-e +Print all attributes for all devices curently available in the database. +.TP .B \-h Print help text. .SH "FILES" diff --git a/udevinfo.c b/udevinfo.c index c7d801b87c..0089df46b6 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -1,7 +1,7 @@ /* - * udevinfo.c - fetches attributes for a device + * udevinfo.c - fetches stored device information or sysfs attributes * - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004-2005 Kay Sievers * * 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 @@ -80,7 +80,7 @@ static void print_all_attributes(struct dlist *attr_list) printf("\n"); } -static int print_record(struct udevice *udev) +static void print_record(struct udevice *udev) { struct name_entry *name_loop; @@ -90,8 +90,6 @@ static int print_record(struct udevice *udev) printf("S: %s\n", name_loop->name); list_for_each_entry(name_loop, &udev->env_list, node) printf("E: %s\n", name_loop->name); - - return 0; } static int print_device_chain(const char *path) @@ -124,6 +122,7 @@ static int print_device_chain(const char *path) /* open sysfs class device directory and print all attributes */ printf(" looking at class device '%s':\n", class_dev->path); + printf(" KERNEL==\"%s\"\n", class_dev->name); printf(" SUBSYSTEM==\"%s\"\n", class_dev->classname); attr_list = sysfs_get_classdev_attributes(class_dev); @@ -167,7 +166,16 @@ exit: return retval; } -static void dump_names(void) { +static void dump_name_devpath(struct udevice *udev) { + printf("%s=%s/%s\n", udev->devpath, udev_root, udev->name); +} + +static void dump_record(struct udevice *udev) { + print_record(udev); + printf("\n"); +} + +static void dump_db(void fnct(struct udevice *udev)) { LIST_HEAD(name_list); struct name_entry *name_loop; @@ -177,19 +185,48 @@ static void dump_names(void) { udev_init_device(&udev_db, NULL, NULL, NULL); if (udev_db_get_device(&udev_db, name_loop->name) == 0) - printf("%s=%s/%s\n", udev_db.devpath, udev_root, udev_db.name); + fnct(&udev_db); udev_cleanup_device(&udev_db); } name_list_cleanup(&name_list); } +static void print_help(void) +{ + fprintf(stderr, "Usage: udevinfo [-anpqrVh]\n" + " -q TYPE query database for the specified value:\n" + " 'name' name of device node\n" + " 'symlink' pointing to node\n" + " 'path' sysfs device path\n" + " 'env' the device related imported environment\n" + " 'all' all values\n" + "\n" + " -p PATH sysfs device path used for query or chain\n" + " -n NAME node/symlink name used for query\n" + "\n" + " -r print udev root\n" + " -a print all SYSFS_attributes along the device chain\n" + " -d print the relationship of devpath and the node name for all\n" + " -e print the content of the udev database\n" + " -V print udev version\n" + " -h print this help text\n" + "\n"); +} + int main(int argc, char *argv[], char *envp[]) { - static const char short_options[] = "adn:p:q:rVh"; + static const char short_options[] = "aden:p:q:rVh"; int option; struct udevice udev; int root = 0; - int attributes = 0; + + enum action_type { + ACTION_NONE, + ACTION_QUERY, + ACTION_ATTRIBUTE_WALK, + ACTION_ROOT, + } action = ACTION_NONE; + enum query_type { QUERY_NONE, QUERY_NAME, @@ -198,6 +235,7 @@ int main(int argc, char *argv[], char *envp[]) QUERY_ENV, QUERY_ALL, } query = QUERY_NONE; + char path[PATH_SIZE] = ""; char name[PATH_SIZE] = ""; char temp[PATH_SIZE]; @@ -222,70 +260,65 @@ int main(int argc, char *argv[], char *envp[]) dbg("udev name: %s\n", optarg); strlcpy(name, optarg, sizeof(name)); break; - case 'p': dbg("udev path: %s\n", optarg); strlcpy(path, optarg, sizeof(path)); break; - case 'q': dbg("udev query: %s\n", optarg); - + action = ACTION_QUERY; if (strcmp(optarg, "name") == 0) { query = QUERY_NAME; break; } - if (strcmp(optarg, "symlink") == 0) { query = QUERY_SYMLINK; break; } - if (strcmp(optarg, "path") == 0) { query = QUERY_PATH; break; } - if (strcmp(optarg, "env") == 0) { query = QUERY_ENV; break; } - if (strcmp(optarg, "all") == 0) { query = QUERY_ALL; break; } - fprintf(stderr, "unknown query type\n"); - retval = 1; + retval = 2; goto exit; - case 'r': + if (action == ACTION_NONE) + action = ACTION_ROOT; root = 1; break; - case 'a': - attributes = 1; + action = ACTION_ATTRIBUTE_WALK; break; - case 'd': - dump_names(); + dump_db(dump_name_devpath); + goto exit; + case 'e': + dump_db(dump_record); goto exit; - case 'V': printf("udevinfo, version %s\n", UDEV_VERSION); goto exit; - case 'h': - retval = 2; case '?': default: - goto help; + print_help(); + goto exit; } } - /* process options */ - if (query != QUERY_NONE) { + /* run action */ + switch (action) { + case ACTION_QUERY: + /* need devpath or node/symlink name for query */ if (path[0] != '\0') { /* remove sysfs_path if given */ if (strncmp(path, sysfs_path, strlen(sysfs_path)) == 0) { @@ -303,12 +336,10 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_db_get_device(&udev, pos); if (retval != 0) { fprintf(stderr, "no record for '%s' in database\n", pos); + retval = 3; goto exit; } - goto print; - } - - if (name[0] != '\0') { + } else if (name[0] != '\0') { char devpath[PATH_SIZE]; int len; @@ -322,24 +353,23 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_db_lookup_name(pos, devpath, sizeof(devpath)); if (retval != 0) { fprintf(stderr, "no record for '%s' in database\n", pos); + retval = 3; goto exit; } udev_db_get_device(&udev, devpath); - goto print; + } else { + fprintf(stderr, "query needs device path(-p) or node name(-n) specified\n"); + retval = 4; + goto exit; } - fprintf(stderr, "query needs device path(-p) or node name(-n) specified\n"); - retval = 3; - goto exit; - -print: switch(query) { case QUERY_NAME: if (root) printf("%s/%s\n", udev_root, udev.name); else printf("%s\n", udev.name); - goto exit; + break; case QUERY_SYMLINK: if (list_empty(&udev.symlink_list)) goto exit; @@ -350,23 +380,23 @@ print: list_for_each_entry(name_loop, &udev.symlink_list, node) printf("%s ", name_loop->name); printf("\n"); - goto exit; + break; case QUERY_PATH: printf("%s\n", udev.devpath); goto exit; case QUERY_ENV: list_for_each_entry(name_loop, &udev.env_list, node) printf("%s\n", name_loop->name); - goto exit; + break; case QUERY_ALL: print_record(&udev); - goto exit; + break; default: - goto help; + print_help(); + break; } - } - - if (attributes) { + break; + case ACTION_ATTRIBUTE_WALK: if (path[0] == '\0') { fprintf(stderr, "attribute walk on device chain needs path(-p) specified\n"); retval = 4; @@ -379,35 +409,17 @@ print: strlcpy(path, temp, sizeof(temp)); } print_device_chain(path); - goto exit; } - } - - if (root) { + break; + case ACTION_ROOT: printf("%s\n", udev_root); - goto exit; + break; + default: + print_help(); + retval = 1; + break; } -help: - fprintf(stderr, "Usage: udevinfo [-anpqrVh]\n" - " -q TYPE query database for the specified value:\n" - " 'name' name of device node\n" - " 'symlink' pointing to node\n" - " 'path' sysfs device path\n" - " 'env' the device related imported environment\n" - " 'all' all values\n" - "\n" - " -p PATH sysfs device path used for query or chain\n" - " -n NAME node/symlink name used for query\n" - "\n" - " -r print udev root\n" - " -a print all SYSFS_attributes along the device chain\n" - " -d print the relationship of devpath and the node name for all\n" - " devices available in the database\n" - " -V print udev version\n" - " -h print this help text\n" - "\n"); - exit: udev_cleanup_device(&udev); logging_close(); -- cgit v1.2.3-54-g00ecf From 420a506ef00b011ddb50249c0c53c07cbc37e04c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Aug 2005 04:41:42 +0200 Subject: write man page masters in DocBook XML The troff man pages will still be checked into the tree but the source is DocBook XML format living in the docs/ directory now. Start with the easy ones, the main udev page is still left to rewrite. Signed-off-by: Kay Sievers --- Makefile | 23 ++- docs/udevd.xml | 99 +++++++++++++ docs/udevinfo.xml | 131 +++++++++++++++++ docs/udevmonitor.xml | 76 ++++++++++ docs/udevstart.xml | 62 ++++++++ docs/udevtest.xml | 62 ++++++++ udev.8 | 394 +++++++++++++++++++++++++++++++++++++++++++++++++++ udev.8.in | 394 --------------------------------------------------- udevd.8 | 80 +++++------ udevinfo.8 | 119 +++++++--------- udevstart.8 | 36 +++-- udevtest.8 | 39 ++--- 12 files changed, 977 insertions(+), 538 deletions(-) create mode 100644 docs/udevd.xml create mode 100644 docs/udevinfo.xml create mode 100644 docs/udevmonitor.xml create mode 100644 docs/udevstart.xml create mode 100644 docs/udevtest.xml create mode 100644 udev.8 delete mode 100644 udev.8.in diff --git a/Makefile b/Makefile index 8f99330967..1e6dd55ee9 100644 --- a/Makefile +++ b/Makefile @@ -158,6 +158,13 @@ OBJS = \ SYSFS = $(PWD)/libsysfs/sysfs.a +MAN_PAGES = \ + udevmonitor.8 \ + udevd.8 \ + udevtest.8 \ + udevinfo.8 \ + udevstart.8 + CFLAGS += -I$(PWD)/libsysfs/sysfs \ -I$(PWD)/libsysfs @@ -262,11 +269,9 @@ udev_version.h: $(LOCAL_CFG_DIR)/udev.conf: sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ -GEN_MANPAGES = udev.8 -GEN_MANPAGESIN = udev.8.in -# Rules on how to create the man pages -$(GEN_MANPAGES): $(GEN_MANPAGESIN) - sed -e "s:@udevdir@:$(udevdir):" < $@.in > $@ +# man pages +%.8: docs/%.xml + xmlto man $? $(UDEV_OBJS): $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(SYSFS_OBJS): $(HEADERS) $(HOST_PROGS) $(KLCC) @@ -283,7 +288,7 @@ $(CONTROL).o: $(HEADERS) $( $(HEADERS)GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(MONITOR).o: $(HEADERS) $( $(HEADERS)GEN_HEADERS) $(HOST_PROGS) $(KLCC) $(STARTER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(ROOT): $(KLCC) $(ROOT).o $(OBJS) $(HEADERS) $(GEN_MANPAGES) +$(ROOT): $(KLCC) $(ROOT).o $(OBJS) $(HEADERS) $(MAN_PAGES) $(QUIET) $(LD) $(LDFLAGS) -o $@ $(ROOT).o $(OBJS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ @@ -333,7 +338,7 @@ $(STARTER): $(KLCC) $(STARTER).o $(OBJS) clean: -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(GEN_MANPAGES) $(INFO) $(DAEMON) \ + -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) \ $(SENDER) $(COMPILE) $(INITSENDER) $(RECORDER) $(CONTROL) $(MONITOR) $(TESTER) $(STARTER) -rm -f ccdv $(MAKE) -C klibc SUBDIRS=klibc clean @@ -369,7 +374,9 @@ install-man: $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 $(INSTALL_DATA) -D udevstart.8 $(DESTDIR)$(mandir)/man8/udevstart.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 + $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 + - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 uninstall-man: - rm $(mandir)/man8/udev.8 @@ -377,7 +384,9 @@ uninstall-man: - rm $(mandir)/man8/udevtest.8 - rm $(mandir)/man8/udevstart.8 - rm $(mandir)/man8/udevd.8 + - rm $(mandir)/man8/udevmonitor.8 - rm $(mandir)/man8/udevsend.8 + - rm $(mandir)/man8/udevcontrol.8 install: install-config install-man all $(INSTALL) -d $(DESTDIR)$(udevdir) diff --git a/docs/udevd.xml b/docs/udevd.xml new file mode 100644 index 0000000000..eeaec4402f --- /dev/null +++ b/docs/udevd.xml @@ -0,0 +1,99 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevd, udevsend, udevcontrol + + + udevd + August 2005 + udev + + + + udevd + 8 + + + + udevdevent managing daemon + + + + + udevd + + + + udevcontrol command + + + udevsend subsystem + + + + DESCRIPTION + udevd listens to kernel uevents and passes the incoming events to + udev. It ensures the right event order and takes care, that events for child + devices are delayed until the parent has finished the device handling. + + + OPTIONS + + + + + Detach and run in the background. + + + + + + udevcontrol can dynamically set the log level of udevd. + Valid values are the numerical syslog priorities or their textual + representations: err, info and debug. + + + + + + udevcontrol stops the execution of events from udevd. + + + + + + udevcontrol starts the execution of events from udevd. + + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev8 + + + +
    +
    diff --git a/docs/udevinfo.xml b/docs/udevinfo.xml new file mode 100644 index 0000000000..b8ced7f174 --- /dev/null +++ b/docs/udevinfo.xml @@ -0,0 +1,131 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevinfo + + + udevinfo + August 2005 + udev + + + + udevinfo + 8 + + + + udevinfoquery device information from the udev database + + + + + udevinfo + + + + + + + + + + + + DESCRIPTION + udevinfo queries the udev database for device information + stored in the udev database. udevinfo also queries the properties + of a device from its sysfs representation to help creating udev + rules to match this device. + + + OPTIONS + + + + + Query the database for specified type of device data. It needs the + or to identify the specified + device. Valid queries are: + name, symlink, path, + env, all. + + + + + + + Print all sysfs properties of the specified device that can be used + in udev rules to match the specified device. It prints all devices + along the chain, up to the root of sysfs that can be used in udev rules. + + + + + + + The sysfs path of the device to query. + + + + + + + The name of the device node or a symlink to query + + + + + + + The udev root directory: /dev. If used in conjunction + with a name or symlink query, the + query returns the absolute path. + + + + + + + Export the content of the udev database. + + + + + + + Print help text. + + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev8 + + + +
    +
    diff --git a/docs/udevmonitor.xml b/docs/udevmonitor.xml new file mode 100644 index 0000000000..6f1e347f84 --- /dev/null +++ b/docs/udevmonitor.xml @@ -0,0 +1,76 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevmonitor + + + udevmonitor + August 2005 + udev + + + + udevmonitor + 8 + + + + udevmonitor + print the kernel and udev event sequence to the console + + + + + udevmonitor + + + + + DESCRIPTION + udevmonitor listens to the kernel uevents and events send out by a udev rule + and prints the devpath of the event to the console. It can be used analyze to the + event timing by comparing the timestamps of the kernel uevent with the udev event. + + + + OPTIONS + + + + + Print the complete environment for all events. Can be used to compare the + kernel supplied and the udev added environment values. + + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev8 + + + +
    +
    diff --git a/docs/udevstart.xml b/docs/udevstart.xml new file mode 100644 index 0000000000..f917287086 --- /dev/null +++ b/docs/udevstart.xml @@ -0,0 +1,62 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevstart + + + udevstart + August 2005 + udev + + + + udevstart + 8 + + + + udevstartpopulate initial device directory + + + + + udevstart + + + + DESCRIPTION + udevstart scans the kernel exported device information available in + sysfs for devices which require a device node to operate and creates the node + using the specified udev rules. udevstart is used to create the initial + device directory after system bootup. + + + AUTHOR + Written by Harald Hoyer harald@redhat.com. + + + + SEE ALSO + + udev8 + + + +
    +
    diff --git a/docs/udevtest.xml b/docs/udevtest.xml new file mode 100644 index 0000000000..ceea0413c5 --- /dev/null +++ b/docs/udevtest.xml @@ -0,0 +1,62 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevtest + + + udevtest + August 2005 + udev + + + + udevtest + 8 + + + + udevtest + simulate a udev run and print the action to the console + + + + + udevtest device-path subsystem + + + + DESCRIPTION + udevtest simulates a udev run for the given device and prints out the + name of the node udev would have created, or the name of the network interface, + that would have been renamend. + + + AUTHOR + Written by Greg Kroah-Hartman greg@kroah.com. + + + + SEE ALSO + + udev8 + + + +
    +
    diff --git a/udev.8 b/udev.8 new file mode 100644 index 0000000000..9dae378086 --- /dev/null +++ b/udev.8 @@ -0,0 +1,394 @@ +.TH UDEV 8 "October 2003" "" "Linux Administrator's Manual" +.SH NAME +udev \- Linux configurable dynamic device naming support +.SH SYNOPSIS +.BI udev +.SH "DESCRIPTION" +.B udev +provides a dynamic device directory containing only the files for actually +present devices. It creates or removes device node files usually located in +the /dev directory, or it renames network interfaces. +.br +.P +As part of the +.B hotplug +subsystem, +.B udev +is executed if a kernel device is added or removed from the system. +A list of rules is used to match against specific device attributes. +.br +On device addition, +.B udev +matches its configured rules against the available device attributes to +uniquely name the device. +.B udev +maintains its own database for devices present on the system. This database +can be queried for the relationship of the kernel device path and the +name of the device file. +.br +On device removal, +.B udev +queries its database for the name of the device file to be deleted. +.br +After the device node handling, a list of collected programs specific to this +device is executed. +.SH "CONFIGURATION" +All +.B udev +configuration files consist of a set of lines of text. All empty +lines or lines beginning with '#' will be ignored. +.P +.B udev +expects its main configuration file at +.IR /etc/udev/udev.conf . +The file consists of a set of variables and values allowing the user to +override default udev values. The following variables can be overridden +in this file: +.TP +.B udev_root +Indicates where to place the device nodes in the filesystem. The default +value is +.IR @udevdir@/ . +.TP +.B udev_db +The name and location of the udev database. The default value is +.IR @udevdir@/.udevdb . +.TP +.B udev_rules +The name of the udev rules file or directory to look for files with the suffix +.IR .rules . +All rule files are read in lexical order. The default value is +.IR /etc/udev/rules.d/ . +.TP +.B udev_log +The logging priority which can be set to +.IR "err " , "info " +or the corresponding numerical +.BR syslog (3) +value. +The default value is +.IR err . +.P +.RI "A sample " udev.conf " file might look like this: +.sp +.nf +# Where in the filesystem to place the device nodes +udev_root="@udevdir@" + +# The name and location of the udev database. +udev_db="@udevdir@/.udevdb" + +# The name and location of the udev rules file(s). +udev_rules="@configdir@/rules.d" + +# The syslog(3) priority: "err", "info", or the numerical value. +udev_log="err" +.fi +.P +The rules for device naming are read from the files located in the +.I /etc/udev/rules.d/ +directory, or at the location specified by the +.I udev_rules +value in the +.I /etc/udev/udev.conf +file. +.br +Every line in the rules file defines the mapping between device attributes +and the device name. One or more keys are specified to match a rule with +the current device. If all keys are matching, the rule will be applied and +the name is used to name the device file or the network interface. +.br +If no matching rule is found, the default kernel device name is used. +.P +Every rule consists of a list of comma separated key value fields: +.sp +.IR "key " ,[ "key " ,...] +.P +Each key has the following format: +.sp +.IR "name op value" +.P +There are distinct key operation types, depending on the type of the key, it +does a comparison or an assignment. +.P +Comparison operators are: +.TP +.B == +Compare for equality. +.TP +.B != +Compare for non-equality. +.P +Assignment operators are: +.TP +.B += +Add the value to a key that holds a list of entries. +.TP +.B := +Assign a value to a key finally; disallow any later changes, which +is useful to prevent changes by any later rules. +.TP +.B = +Asign a value to a key. Keys that represent a list, are reset and only this +single value is assigned. While this operator still works inplicitely as +comparison on keys that can't get a value assigned, its usage as an comparison +operator is deprecated. +.P +The following key names can be used to match against device properties: +.TP +.B BUS +Match the bus type of the device. +(The sysfs device bus must be able to be determined by a "device" symlink.) +.TP +.B KERNEL +Match the kernel device name. +.TP +.B SUBSYSTEM +Match the kernel subsystem name. +.TP +.B ACTION +Match the kernel action name. +.TP +.B DRIVER +Match the kernel driver name. +.TP +.B ID +Match the device number on the bus, like PCI bus id. +.TP +.BI SYSFS{ filename } +Match sysfs device attribute like vendor and product id's, USB serial number +or the SCSI disk model number. Up to 5 different sysfs files can be checked, +with all of the values being required to match the rule. +.br +Trailing whitespace characters in the sysfs attribute value are ignored, if +the key doesn't have any trailing whitespace characters by itself. +.TP +.BI ENV{ variable } +Match an environment variable. Up to 5 different environment variables can be +checked, with all of the values being required to match the rule. +.TP +.B PROGRAM +Call external program. This key is valid if the program returns successful. +The environment variables of +.B udev +are also available to the program. +.br +The string returned by the program may be additionally matched with the +.B RESULT +key in the same or any later rule. +.TP +.B RESULT +Match the returned string of the last +.B PROGRAM +call. This key can be used in the same or in any later rule after a +.B PROGRAM +call. +.P +The following keys can get values assigned: +.TP +.B NAME +The name of the node to be created, or the name, the network interface +should be renamed to. Only one rule can set the a name, all later rules +with a NAME key will be ignored. +.TP +.B SYMLINK +The name of a symlink targeting the node. Every matching rule can add +this value to the list of symlinks to be created along with the device node. +Multiple symlinks may be specified by separating the names by the space +character. +.TP +.B OWNER, GROUP, MODE +The permissions for the device node. Every specified value overwrites the +compiled-in default value. +.TP +.B RUN +Add a program to the list of programs to be executed for a specific device. +.TP +.B OPTIONS +.B last_rule +stops further rules application. No later rules will have any effect. +.sp +.B ignore_device +will ignore this device. No node will be created or program executed. +.sp +.B ignore_remove +will ignore any later remove event for this device. +This may be useful as a workaround for broken device drivers. +.sp +.B all_partitions +will create device nodes for all available partitions of a blockdevice. +This may be useful for removable media devices which do not detect a media +change. +.sp +Multiple attributes may be separated by comma. +.P +.RB "The " NAME ", " SYMLINK ", " PROGRAM ", " OWNER " and " GROUP +fields support simple printf-like string substitutions: +.TP +.B %n +The "kernel number" of the device. +For example, 'sda3' has a "kernel number" of '3'. +.TP +.B %k +The "kernel name" for the device. +.TP +.B %p +The devpath for the device. +.TP +.B %M +The kernel major number for the device. +.TP +.B %m +The kernel minor number for the device. +.TP +.B %b +The bus id for the device. +.TP +.B %c +The string returned by the external program, specified in +.B PROGRAM +(This does not work within the +.B PROGRAM +field for the obvious reason.) +.br +A single part of the string, separated by a space character +may be selected by specifying the part number as an attribute: +.BI %c{ N } +If the number is followed by the + char this part plus +all remaining parts of the result string are substituted: +.BI %c{ N+ } +.TP +.B %N +The name of a created temporary device node to provide access to the +device from a external program. +.TP +.B %P +The node name of the parent device. +.TP +.BI %s{ filename } +The content of a sysfs attribute. +.TP +.B %r +The udev_root value. +.TP +.B %e +If a device node already exists with the name, the smallest positive +decimal integer N is substituted such that the resulting name doesn't +match an existing device node. Otherwise nothing is substituted. This +can be used to create compatibility symlinks and enumerate devices of +the same type originating from different kernel subsystems. +.sp +Note: The use of the enumeration facility is unreliable outside of +udevstart where the node creation is serialized and predictable. +The returned numbers rely on the order devices are probed on the +system. If more than one device requests an enumeration for the same +name at the same time, it may be possible that both requests receive the +same name back from the database. The use of enumerations in todays setups +where device can come and go at any time is not recomended. +.TP +.B %% +The '%' character itself. +.P +The count of characters to insert may be limited by specifying +the format length value. For example, '%3s{file}' will only insert +the first three characters of the sysfs attribute. +.P +.RI "A sample " udev.rules " file might look like this:" +.sp +.nf +# if /sbin/scsi_id returns "OEM 0815", the device will be called disk1 +BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="OEM 0815", NAME="disk1" + +# USB printer to be called lp_color +BUS=="usb", SYSFS{serial}=="W09090207101241330", NAME="lp_color" + +# SCSI disk with a specific vendor and model number will be called boot +BUS=="scsi", SYSFS{vendor}=="IBM", SYSFS{model}=="ST336", NAME="boot%n" + +# sound card with PCI bus id 00:0b.0 to be called dsp +BUS=="pci", ID=="00:0b.0", NAME="dsp" + +# USB mouse at third port of the second hub to be called mouse1 +BUS=="usb", ID=="2.3", NAME="mouse1" + +# ttyUSB1 should always be called pda with two additional symlinks +KERNEL=="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" + +# multiple USB webcams with symlinks to be called webcam0, webcam1, ... +BUS=="usb", SYSFS{model}=="XV3", NAME=="video%n", SYMLINK="webcam%n" +.fi +.P +A number of different fields in the above configuration files support a simple +form of shell style pattern matching. It supports the following pattern characters: +.TP +.B * +Matches zero, one, or more characters. +.TP +.B ? +Matches any single character, but does not match zero characters. +.TP +.B [ ] +Matches any single character specified within the brackets. For example, the +pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also +supported within this match with the '\-' character. For example, to match on +the range of all digits, the pattern [0\-9] would be used. If the first character +following the '[' is a '!', any characters not enclosed are matched. +.P +After device node creation, removal, or network device renaming, +.B udev +executes the programs specified by the +.B RUN +key. +.br +In addition to the kernel provided hotplug environment variables, +.B UDEV_LOG +is set and contains the numerical priority value, if udev is configured to use +.BR syslog (3). +Executed programs may want to follow that setting. +.B DEVNAME +is exported to make the name of the created node, or the name the network +device is renamed to, available to the executed programs. +.SH "ENVIRONMENT" +.P +The following variables are read from the environment: +.TP +.B ACTION +.IR add " or " remove +signifies the addition or the removal of a device. +.TP +.B DEVPATH +The sysfs devpath of the device without the mountpoint but a leading slash. +.TP +.B SUBSYSTEM +The subsystem the device belongs to. Alternatively the subsystem may +be passed as the first argument. +.TP +.B UDEV_CONFIG_FILE +Overrides the default location of the +.B udev +config file. +.TP +.B UDEV_LOG +Overrides the log priority specified in the config file. +.TP +.B UDEV_RUN +If set to "0", it disables the execution of programs added by rules. +.SH "FILES" +.nf +/sbin/udev udev program +/etc/udev/* udev config files +.fi +.SH "SEE ALSO" +.BR udevinfo (8), +.BR udevd (8), +.PP +.B Web resources: +.nf +.I http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html +.I http://linux\-hotplug.sourceforge.net/ +.fi +.SH AUTHORS +.B udev +was developed by Greg Kroah-Hartman with much help from +Dan Stekloff , Kay Sievers , and +many others. diff --git a/udev.8.in b/udev.8.in deleted file mode 100644 index 9dae378086..0000000000 --- a/udev.8.in +++ /dev/null @@ -1,394 +0,0 @@ -.TH UDEV 8 "October 2003" "" "Linux Administrator's Manual" -.SH NAME -udev \- Linux configurable dynamic device naming support -.SH SYNOPSIS -.BI udev -.SH "DESCRIPTION" -.B udev -provides a dynamic device directory containing only the files for actually -present devices. It creates or removes device node files usually located in -the /dev directory, or it renames network interfaces. -.br -.P -As part of the -.B hotplug -subsystem, -.B udev -is executed if a kernel device is added or removed from the system. -A list of rules is used to match against specific device attributes. -.br -On device addition, -.B udev -matches its configured rules against the available device attributes to -uniquely name the device. -.B udev -maintains its own database for devices present on the system. This database -can be queried for the relationship of the kernel device path and the -name of the device file. -.br -On device removal, -.B udev -queries its database for the name of the device file to be deleted. -.br -After the device node handling, a list of collected programs specific to this -device is executed. -.SH "CONFIGURATION" -All -.B udev -configuration files consist of a set of lines of text. All empty -lines or lines beginning with '#' will be ignored. -.P -.B udev -expects its main configuration file at -.IR /etc/udev/udev.conf . -The file consists of a set of variables and values allowing the user to -override default udev values. The following variables can be overridden -in this file: -.TP -.B udev_root -Indicates where to place the device nodes in the filesystem. The default -value is -.IR @udevdir@/ . -.TP -.B udev_db -The name and location of the udev database. The default value is -.IR @udevdir@/.udevdb . -.TP -.B udev_rules -The name of the udev rules file or directory to look for files with the suffix -.IR .rules . -All rule files are read in lexical order. The default value is -.IR /etc/udev/rules.d/ . -.TP -.B udev_log -The logging priority which can be set to -.IR "err " , "info " -or the corresponding numerical -.BR syslog (3) -value. -The default value is -.IR err . -.P -.RI "A sample " udev.conf " file might look like this: -.sp -.nf -# Where in the filesystem to place the device nodes -udev_root="@udevdir@" - -# The name and location of the udev database. -udev_db="@udevdir@/.udevdb" - -# The name and location of the udev rules file(s). -udev_rules="@configdir@/rules.d" - -# The syslog(3) priority: "err", "info", or the numerical value. -udev_log="err" -.fi -.P -The rules for device naming are read from the files located in the -.I /etc/udev/rules.d/ -directory, or at the location specified by the -.I udev_rules -value in the -.I /etc/udev/udev.conf -file. -.br -Every line in the rules file defines the mapping between device attributes -and the device name. One or more keys are specified to match a rule with -the current device. If all keys are matching, the rule will be applied and -the name is used to name the device file or the network interface. -.br -If no matching rule is found, the default kernel device name is used. -.P -Every rule consists of a list of comma separated key value fields: -.sp -.IR "key " ,[ "key " ,...] -.P -Each key has the following format: -.sp -.IR "name op value" -.P -There are distinct key operation types, depending on the type of the key, it -does a comparison or an assignment. -.P -Comparison operators are: -.TP -.B == -Compare for equality. -.TP -.B != -Compare for non-equality. -.P -Assignment operators are: -.TP -.B += -Add the value to a key that holds a list of entries. -.TP -.B := -Assign a value to a key finally; disallow any later changes, which -is useful to prevent changes by any later rules. -.TP -.B = -Asign a value to a key. Keys that represent a list, are reset and only this -single value is assigned. While this operator still works inplicitely as -comparison on keys that can't get a value assigned, its usage as an comparison -operator is deprecated. -.P -The following key names can be used to match against device properties: -.TP -.B BUS -Match the bus type of the device. -(The sysfs device bus must be able to be determined by a "device" symlink.) -.TP -.B KERNEL -Match the kernel device name. -.TP -.B SUBSYSTEM -Match the kernel subsystem name. -.TP -.B ACTION -Match the kernel action name. -.TP -.B DRIVER -Match the kernel driver name. -.TP -.B ID -Match the device number on the bus, like PCI bus id. -.TP -.BI SYSFS{ filename } -Match sysfs device attribute like vendor and product id's, USB serial number -or the SCSI disk model number. Up to 5 different sysfs files can be checked, -with all of the values being required to match the rule. -.br -Trailing whitespace characters in the sysfs attribute value are ignored, if -the key doesn't have any trailing whitespace characters by itself. -.TP -.BI ENV{ variable } -Match an environment variable. Up to 5 different environment variables can be -checked, with all of the values being required to match the rule. -.TP -.B PROGRAM -Call external program. This key is valid if the program returns successful. -The environment variables of -.B udev -are also available to the program. -.br -The string returned by the program may be additionally matched with the -.B RESULT -key in the same or any later rule. -.TP -.B RESULT -Match the returned string of the last -.B PROGRAM -call. This key can be used in the same or in any later rule after a -.B PROGRAM -call. -.P -The following keys can get values assigned: -.TP -.B NAME -The name of the node to be created, or the name, the network interface -should be renamed to. Only one rule can set the a name, all later rules -with a NAME key will be ignored. -.TP -.B SYMLINK -The name of a symlink targeting the node. Every matching rule can add -this value to the list of symlinks to be created along with the device node. -Multiple symlinks may be specified by separating the names by the space -character. -.TP -.B OWNER, GROUP, MODE -The permissions for the device node. Every specified value overwrites the -compiled-in default value. -.TP -.B RUN -Add a program to the list of programs to be executed for a specific device. -.TP -.B OPTIONS -.B last_rule -stops further rules application. No later rules will have any effect. -.sp -.B ignore_device -will ignore this device. No node will be created or program executed. -.sp -.B ignore_remove -will ignore any later remove event for this device. -This may be useful as a workaround for broken device drivers. -.sp -.B all_partitions -will create device nodes for all available partitions of a blockdevice. -This may be useful for removable media devices which do not detect a media -change. -.sp -Multiple attributes may be separated by comma. -.P -.RB "The " NAME ", " SYMLINK ", " PROGRAM ", " OWNER " and " GROUP -fields support simple printf-like string substitutions: -.TP -.B %n -The "kernel number" of the device. -For example, 'sda3' has a "kernel number" of '3'. -.TP -.B %k -The "kernel name" for the device. -.TP -.B %p -The devpath for the device. -.TP -.B %M -The kernel major number for the device. -.TP -.B %m -The kernel minor number for the device. -.TP -.B %b -The bus id for the device. -.TP -.B %c -The string returned by the external program, specified in -.B PROGRAM -(This does not work within the -.B PROGRAM -field for the obvious reason.) -.br -A single part of the string, separated by a space character -may be selected by specifying the part number as an attribute: -.BI %c{ N } -If the number is followed by the + char this part plus -all remaining parts of the result string are substituted: -.BI %c{ N+ } -.TP -.B %N -The name of a created temporary device node to provide access to the -device from a external program. -.TP -.B %P -The node name of the parent device. -.TP -.BI %s{ filename } -The content of a sysfs attribute. -.TP -.B %r -The udev_root value. -.TP -.B %e -If a device node already exists with the name, the smallest positive -decimal integer N is substituted such that the resulting name doesn't -match an existing device node. Otherwise nothing is substituted. This -can be used to create compatibility symlinks and enumerate devices of -the same type originating from different kernel subsystems. -.sp -Note: The use of the enumeration facility is unreliable outside of -udevstart where the node creation is serialized and predictable. -The returned numbers rely on the order devices are probed on the -system. If more than one device requests an enumeration for the same -name at the same time, it may be possible that both requests receive the -same name back from the database. The use of enumerations in todays setups -where device can come and go at any time is not recomended. -.TP -.B %% -The '%' character itself. -.P -The count of characters to insert may be limited by specifying -the format length value. For example, '%3s{file}' will only insert -the first three characters of the sysfs attribute. -.P -.RI "A sample " udev.rules " file might look like this:" -.sp -.nf -# if /sbin/scsi_id returns "OEM 0815", the device will be called disk1 -BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="OEM 0815", NAME="disk1" - -# USB printer to be called lp_color -BUS=="usb", SYSFS{serial}=="W09090207101241330", NAME="lp_color" - -# SCSI disk with a specific vendor and model number will be called boot -BUS=="scsi", SYSFS{vendor}=="IBM", SYSFS{model}=="ST336", NAME="boot%n" - -# sound card with PCI bus id 00:0b.0 to be called dsp -BUS=="pci", ID=="00:0b.0", NAME="dsp" - -# USB mouse at third port of the second hub to be called mouse1 -BUS=="usb", ID=="2.3", NAME="mouse1" - -# ttyUSB1 should always be called pda with two additional symlinks -KERNEL=="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" - -# multiple USB webcams with symlinks to be called webcam0, webcam1, ... -BUS=="usb", SYSFS{model}=="XV3", NAME=="video%n", SYMLINK="webcam%n" -.fi -.P -A number of different fields in the above configuration files support a simple -form of shell style pattern matching. It supports the following pattern characters: -.TP -.B * -Matches zero, one, or more characters. -.TP -.B ? -Matches any single character, but does not match zero characters. -.TP -.B [ ] -Matches any single character specified within the brackets. For example, the -pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also -supported within this match with the '\-' character. For example, to match on -the range of all digits, the pattern [0\-9] would be used. If the first character -following the '[' is a '!', any characters not enclosed are matched. -.P -After device node creation, removal, or network device renaming, -.B udev -executes the programs specified by the -.B RUN -key. -.br -In addition to the kernel provided hotplug environment variables, -.B UDEV_LOG -is set and contains the numerical priority value, if udev is configured to use -.BR syslog (3). -Executed programs may want to follow that setting. -.B DEVNAME -is exported to make the name of the created node, or the name the network -device is renamed to, available to the executed programs. -.SH "ENVIRONMENT" -.P -The following variables are read from the environment: -.TP -.B ACTION -.IR add " or " remove -signifies the addition or the removal of a device. -.TP -.B DEVPATH -The sysfs devpath of the device without the mountpoint but a leading slash. -.TP -.B SUBSYSTEM -The subsystem the device belongs to. Alternatively the subsystem may -be passed as the first argument. -.TP -.B UDEV_CONFIG_FILE -Overrides the default location of the -.B udev -config file. -.TP -.B UDEV_LOG -Overrides the log priority specified in the config file. -.TP -.B UDEV_RUN -If set to "0", it disables the execution of programs added by rules. -.SH "FILES" -.nf -/sbin/udev udev program -/etc/udev/* udev config files -.fi -.SH "SEE ALSO" -.BR udevinfo (8), -.BR udevd (8), -.PP -.B Web resources: -.nf -.I http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html -.I http://linux\-hotplug.sourceforge.net/ -.fi -.SH AUTHORS -.B udev -was developed by Greg Kroah-Hartman with much help from -Dan Stekloff , Kay Sievers , and -many others. diff --git a/udevd.8 b/udevd.8 index 02e2e2c5f8..01b90ccfb3 100644 --- a/udevd.8 +++ b/udevd.8 @@ -1,43 +1,41 @@ -.TH UDEVD 8 "February 2004" "" "Linux Administrator's Manual" -.SH NAME -udevd, udevdsend \- udev event serializer daemon and udev event sender -.SH SYNOPSIS -.BI udevsend +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEVD" "8" "August 2005" "udev" "udevd, udevsend, udevcontrol" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udevd \- event managing daemon +.SH "SYNOPSIS" +.HP 6 +\fBudevd\fR [\fB\-\-daemon\fR] +.HP 20 +\fBudevcontrol \fR\fB\fIcommand\fR\fR +.HP 19 +\fBudevsend \fR\fB\fIsubsystem\fR\fR .SH "DESCRIPTION" -.B udevd -allows the serialization of -.BR hotplug (8) -events. The events generated by the kernel may arrive in random order -in userspace, that makes it neccessary to reorder them. -.br -.B udevd -takes care of the kernel supplied -.B SEQNUM -sequence number and arranges the events for execution in the correct order. -Missing sequences delay the execution of the following events until a timeout -is reached. Events without any sequence number are bypassing the queue and -will be executed immediately. -.br -For each event a -.BR udev (8) -instance is executed in the background with the complete environment received -by the hotplug event. All further events for the same device are delayed until -the execution is finished. This way there will never be more than one instance -running for a single device at the same time. -.br -.B udevd -receives the events from -.B udevsend -If -.B udevd -isn't already running, -.B udevsend -will start it. +.PP +udevd listens to kernel uevents and passes the incoming events to udev. It ensures the right event order and takes care, that events for child devices are delayed until the parent has finished the device handling. +.SH "OPTIONS" +.TP +\fB\-\-daemon\fR +Detach and run in the background. +.TP +\fBlog_priority=\fR\fB\fIvalue\fR\fR +udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: err, info and debug. +.TP +\fBstop_exec_queue\fR +udevcontrol stops the execution of events from udevd. +.TP +\fBstart_exec_queue\fR +udevcontrol starts the execution of events from udevd. +.SH "AUTHOR" +.PP +Written by Kay Sievers +. .SH "SEE ALSO" -.BR udev (8), -.BR udevinfo (8), -.BR hotplug (8) -.SH AUTHORS -.B udevd -was developed primarily by Kay Sievers , with much help -from others. +.PP +\fBudev\fR(8) diff --git a/udevinfo.8 b/udevinfo.8 index 28904fef47..d8f7bbe629 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -1,69 +1,60 @@ -.TH UDEVINFO 8 "January 2004" "" "Linux Administrator's Manual" -.SH NAME -udevinfo \- retrieve information from udev -.SH SYNOPSIS -.B udevinfo -.RI "[\-q " query_type " \-p " sysfs_path "] [\-drVh]" +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEVINFO" "8" "August 2005" "udev" "udevinfo" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udevinfo \- query device information from the udev database +.SH "SYNOPSIS" +.HP 9 +\fBudevinfo\fR [\fB\-q\ \fR\fB\fIquery\-type\fR\fR] [\fB\-a\ \fR] [\fB\-p\ \fR\fB\fIdevice\-path\fR\fR] [\fB\-n\ \fR\fB\fInode\-name\fR\fR] [\fB\-r\fR] [\fB\-e\fR] [\fB\-V\fR] [\fB\-h\fR] .SH "DESCRIPTION" -.B udevinfo -allows users to query the udev database for information on any device -currently present on the system. It also provides a way to query any device -in the sysfs tree to help creating -.B udev -rules. +.PP +udevinfo queries the udev database for device information stored in the udev database. udevinfo also queries the properties of a device from its sysfs representation to help creating udev rules to match this device. .SH "OPTIONS" .TP -.B \-V -Print the version information. -.TP -.B \-r -Print the -.B udev_root -directory. When used in conjunction with a query for the node name or the -symlink names, the -.B udev_root -will be prepended to query result. -.TP -.BI \-q " query_type" -Query the database for specified value of a created device node or network -interface. -.RB Needs " \-p " or " \-n " specified. -.br -Valid types are: -.BR name ", " symlink ", " path " or " all. -.TP -.BI \-p " sysfs_path" -Specify the sysfs path of the device to query. -.TP -.BI \-n " name" -Specify the name of the node, the symlink or the network interface for the -device to query. Partition names generated with the NAME{all_partitons} option -can not be queried, the main device must be used instead. -.TP -.B \-a -Print all -.BI SYSFS{ filename } -attributes along the device chain. Useful for finding -unique attributes to compose a rule. -.RB Needs " \-p " specified. -.TP -.B \-d -Print the relationship between the devpath and the node name for all devices -currently available in the database. -.TP -.B \-e -Print all attributes for all devices curently available in the database. -.TP -.B \-h +\fB\-q\fR +Query the database for specified type of device data. It needs the +\fB\-p\fR +or +\fB\-n\fR +to identify the specified device. Valid queries are: +\fBname\fR, +\fBsymlink\fR, +\fBpath\fR, +\fBenv\fR, +\fBall\fR. +.TP +\fB\-a\fR +Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules. +.TP +\fB\-p \fR\fB\fIdevice\-path\fR\fR +The sysfs path of the device to query. +.TP +\fB\-n \fR\fB\fInode\-name\fR\fR +The name of the device node or a symlink to query +.TP +\fB\-r\fR +The udev root directory: +\fI/dev\fR. If used in conjunction with a +\fBname\fR +or +\fBsymlink\fR +query, the query returns the absolute path. +.TP +\fB\-e\fR +Export the content of the udev database. +.TP +\fB\-h\fR Print help text. -.SH "FILES" -.nf -/etc/udev/* udev config files -.fi -.LP +.SH "AUTHOR" +.PP +Written by Kay Sievers +. .SH "SEE ALSO" -.BR udev (8) -.SH AUTHORS -.B udevinfo -was developed primarily by Kay Sievers , with help -from others. +.PP +\fBudev\fR(8) diff --git a/udevstart.8 b/udevstart.8 index c64400cc4f..ea7a59ea8b 100644 --- a/udevstart.8 +++ b/udevstart.8 @@ -1,18 +1,24 @@ -.TH UDEVSTART 8 "March 2004" "" "Linux Administrator's Manual" -.SH NAME +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEVSTART" "8" "August 2005" "udev" "udevstart" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" udevstart \- populate initial device directory -.SH SYNOPSIS -.B udevstart +.SH "SYNOPSIS" +.HP 10 +\fBudevstart\fR .SH "DESCRIPTION" -.B udevstart -walks trough the sysfs device tree and calls -.B udev -to create the nodes for every valid device found. It can be used to fill a -empty device directory with nodes for all devices currently available on -the system. +.PP +udevstart scans the kernel exported device information available in sysfs for devices which require a device node to operate and creates the node using the specified udev rules. udevstart is used to create the initial device directory after system bootup. +.SH "AUTHOR" +.PP +Written by Harald Hoyer +. .SH "SEE ALSO" -.BR udev (8) -.SH AUTHORS -.B udevstart -was developed primarily by Harald Hoyer , with much help -from others. +.PP +\fBudev\fR(8) diff --git a/udevtest.8 b/udevtest.8 index a595a30d41..e547811a8b 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -1,19 +1,24 @@ -.TH UDEVTEST 8 "March 2004" "" "Linux Administrator's Manual" -.SH NAME -udevtest \- simulates a udev run to test the configured rules -.SH SYNOPSIS -.B udevtest -.I sysfs_device_path subsystem +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEVTEST" "8" "August 2005" "udev" "udevtest" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udevtest \- simulate a udev run and print the action to the console +.SH "SYNOPSIS" +.HP 31 +\fBudevtest \fR\fB\fIdevice\-path\fR\fR\fB \fR\fB\fIsubsystem\fR\fR .SH "DESCRIPTION" -.B udevtest -simulates a -.B udev -run for the given device, and prints out the name of the node -the real udev would have created, or the name of the renamed network -interface. +.PP +udevtest simulates a udev run for the given device and prints out the name of the node udev would have created, or the name of the network interface, that would have been renamend. +.SH "AUTHOR" +.PP +Written by Greg Kroah\-Hartman +. .SH "SEE ALSO" -.BR udev (8) -.SH AUTHORS -.B udevtest -was developed by Greg Kroah-Hartman with much help -from others. +.PP +\fBudev\fR(8) -- cgit v1.2.3-54-g00ecf From ae8cc07b2a954dc55f6cc90eea64f281e3421e76 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Aug 2005 04:56:24 +0200 Subject: udevinfo: rename dump() to export() Signed-off-by: Kay Sievers --- udevinfo.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 0089df46b6..6b368fcfe8 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -166,16 +166,16 @@ exit: return retval; } -static void dump_name_devpath(struct udevice *udev) { +static void export_name_devpath(struct udevice *udev) { printf("%s=%s/%s\n", udev->devpath, udev_root, udev->name); } -static void dump_record(struct udevice *udev) { +static void export_record(struct udevice *udev) { print_record(udev); printf("\n"); } -static void dump_db(void fnct(struct udevice *udev)) { +static void export_db(void fnct(struct udevice *udev)) { LIST_HEAD(name_list); struct name_entry *name_loop; @@ -204,10 +204,9 @@ static void print_help(void) " -p PATH sysfs device path used for query or chain\n" " -n NAME node/symlink name used for query\n" "\n" - " -r print udev root\n" + " -r prepend to query result or print udev_root\n" " -a print all SYSFS_attributes along the device chain\n" - " -d print the relationship of devpath and the node name for all\n" - " -e print the content of the udev database\n" + " -e export the content of the udev database\n" " -V print udev version\n" " -h print this help text\n" "\n"); @@ -215,7 +214,7 @@ static void print_help(void) int main(int argc, char *argv[], char *envp[]) { - static const char short_options[] = "aden:p:q:rVh"; + static const char short_options[] = "aen:p:q:rVh"; int option; struct udevice udev; int root = 0; @@ -299,10 +298,10 @@ int main(int argc, char *argv[], char *envp[]) action = ACTION_ATTRIBUTE_WALK; break; case 'd': - dump_db(dump_name_devpath); + export_db(export_name_devpath); goto exit; case 'e': - dump_db(dump_record); + export_db(export_record); goto exit; case 'V': printf("udevinfo, version %s\n", UDEV_VERSION); -- cgit v1.2.3-54-g00ecf From 264ccb68ee070adcb7b38b3a139adf018ba9089e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Aug 2005 05:02:11 +0200 Subject: test the automatic man page rebuild and checkin Signed-off-by: Kay Sievers --- docs/udevinfo.xml | 4 ++-- udevinfo.8 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/udevinfo.xml b/docs/udevinfo.xml index b8ced7f174..d6eecfb70d 100644 --- a/docs/udevinfo.xml +++ b/docs/udevinfo.xml @@ -50,9 +50,9 @@ DESCRIPTION udevinfo queries the udev database for device information - stored in the udev database. udevinfo also queries the properties + stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev - rules to match this device. + rules that match this device. OPTIONS diff --git a/udevinfo.8 b/udevinfo.8 index d8f7bbe629..fc7001dc21 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -14,7 +14,7 @@ udevinfo \- query device information from the udev database \fBudevinfo\fR [\fB\-q\ \fR\fB\fIquery\-type\fR\fR] [\fB\-a\ \fR] [\fB\-p\ \fR\fB\fIdevice\-path\fR\fR] [\fB\-n\ \fR\fB\fInode\-name\fR\fR] [\fB\-r\fR] [\fB\-e\fR] [\fB\-V\fR] [\fB\-h\fR] .SH "DESCRIPTION" .PP -udevinfo queries the udev database for device information stored in the udev database. udevinfo also queries the properties of a device from its sysfs representation to help creating udev rules to match this device. +udevinfo queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device. .SH "OPTIONS" .TP \fB\-q\fR -- cgit v1.2.3-54-g00ecf From 0e47c219fc5c509f277c9a44f2d29362fff88193 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Aug 2005 17:03:25 +0200 Subject: Makefile: remove all the duplicated rules Signed-off-by: Kay Sievers --- Makefile | 378 ++++++++++++++++++------------------------ extras/ata_id/Makefile | 2 +- extras/cdrom_id/Makefile | 2 +- extras/dasd_id/Makefile | 2 +- extras/firmware/Makefile | 2 +- extras/floppy/Makefile | 2 +- extras/run_directory/Makefile | 2 +- extras/usb_id/Makefile | 2 +- extras/volume_id/Makefile | 5 +- test/simple-build-check.sh | 1 - 10 files changed, 172 insertions(+), 226 deletions(-) diff --git a/Makefile b/Makefile index 1e6dd55ee9..f34befd999 100644 --- a/Makefile +++ b/Makefile @@ -17,46 +17,96 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# Set this to make use of syslog. +VERSION = 068 + +# set this to make use of syslog USE_LOG = true -# Set this to compile-in development debug messages. Pass UDEV_LOG="debug" -# to the executed binary or set the value in the udev configuration file to -# let udev print the debug messages to syslog. +# compile-in development debug messages +# (export UDEV_LOG="debug" or set udev_log="debug" in udev.conf +# to print the debug messages to syslog) DEBUG = false -# Set this to include Security-Enhanced Linux support. +# include Security-Enhanced Linux support USE_SELINUX = false -# Set this to comile with klibc instead of glibc. +# comile with klibc instead of glibc USE_KLIBC = false -# Set this to create statically linked binaries. +# set this to create statically linked binaries USE_STATIC = false -# To build any of the extras programs, run with: -# make EXTRAS="extras/a extras/b" +# to build any of the extras programs pass: +# make EXTRAS="extras/ extras/" EXTRAS= # make the build silent. Set this to something else to make it noisy again. V=false -VERSION = 068 -ROOT = udev -DAEMON = udevd -SENDER = udevsend -COMPILE = udevrulescompile -INITSENDER = udevinitsend -RECORDER = udeveventrecorder -CONTROL = udevcontrol -MONITOR = udevmonitor -INFO = udevinfo -TESTER = udevtest -STARTER = udevstart -RELEASE_NAME = $(ROOT)-$(VERSION) -LOCAL_CFG_DIR = etc/udev -DESTDIR = -KERNEL_DIR = /lib/modules/${shell uname -r}/build +PROGRAMS = \ + udev \ + udevd \ + udevsend \ + udevrulescompile \ + udevinitsend \ + udeveventrecorder \ + udevcontrol \ + udevmonitor \ + udevinfo \ + udevtest \ + udevstart + +HEADERS = \ + udev.h \ + udev_utils.h \ + udev_rules.h \ + udev_version.h \ + udev_db.h \ + udev_sysfs.h \ + logging.h \ + udev_libc_wrapper.h \ + udev_selinux.h \ + list.h + +UDEV_OBJS = \ + udev_event.o \ + udev_device.o \ + udev_config.o \ + udev_add.o \ + udev_remove.o \ + udev_sysfs.o \ + udev_db.o \ + udev_rules.o \ + udev_rules_parse.o \ + udev_utils.o \ + udev_utils_string.o \ + udev_utils_file.o \ + udev_utils_run.o \ + udev_libc_wrapper.o +LIBUDEV = libudev.a + +MAN_PAGES = \ + udevmonitor.8 \ + udevd.8 \ + udevtest.8 \ + udevinfo.8 \ + udevstart.8 + +SYSFS_OBJS = \ + libsysfs/sysfs_class.o \ + libsysfs/sysfs_device.o \ + libsysfs/sysfs_dir.o \ + libsysfs/sysfs_driver.o \ + libsysfs/sysfs_utils.o \ + libsysfs/dlist.o +LIBSYSFS = libsysfs/libsysfs.a + +# config files automatically generated +GEN_CONFIGS = \ + $(LOCAL_CFG_DIR)/udev.conf + +GEN_HEADERS = \ + udev_version.h # override this to make udev look in a different location for it's config files prefix = @@ -67,18 +117,18 @@ usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev +udevdir = /dev +udevdb = ${udevdir}/.udevdb +LOCAL_CFG_DIR = etc/udev +KERNEL_DIR = /lib/modules/${shell uname -r}/build srcdir = . +DESTDIR = +RELEASE_NAME = udev-$(VERSION) INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} - -# place to put our device nodes -udevdir = /dev -udevdb = ${udevdir}/.udevdb - -# set up PWD so that older versions of make will work with our build. PWD = $(shell pwd) # If you are running a cross compiler, you may want to set this @@ -98,10 +148,10 @@ export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/powerpc/ppc/g'} -# code taken from uClibc to determine the gcc include dir +# determine the gcc include dir GCCINCDIR := ${shell LC_ALL=C $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} -# code taken from uClibc to determine the libgcc.a filename +# determine the libgcc.a filename GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) # check if compiler option is supported @@ -116,55 +166,7 @@ CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 # use '-Os' optimization if available, else use -O2 OPTFLAGS := $(call cc-supports, -Os, -O2) -HEADERS = \ - udev.h \ - udev_utils.h \ - udev_rules.h \ - udev_version.h \ - udev_db.h \ - udev_sysfs.h \ - logging.h \ - udev_libc_wrapper.h \ - udev_selinux.h \ - list.h - -SYSFS_OBJS = \ - libsysfs/sysfs_class.o \ - libsysfs/sysfs_device.o \ - libsysfs/sysfs_dir.o \ - libsysfs/sysfs_driver.o \ - libsysfs/sysfs_utils.o \ - libsysfs/dlist.o - -UDEV_OBJS = \ - udev_event.o \ - udev_device.o \ - udev_config.o \ - udev_add.o \ - udev_remove.o \ - udev_sysfs.o \ - udev_db.o \ - udev_rules.o \ - udev_rules_parse.o \ - udev_utils.o \ - udev_utils_string.o \ - udev_utils_file.o \ - udev_utils_run.o \ - udev_libc_wrapper.o - -OBJS = \ - udev.a \ - libsysfs/sysfs.a - -SYSFS = $(PWD)/libsysfs/sysfs.a - -MAN_PAGES = \ - udevmonitor.8 \ - udevd.8 \ - udevtest.8 \ - udevinfo.8 \ - udevstart.8 - +# include our local copy of libsysfs CFLAGS += -I$(PWD)/libsysfs/sysfs \ -I$(PWD)/libsysfs @@ -183,8 +185,7 @@ else STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment endif -# If we are using our version of klibc, then we need to build, link it, and then -# link udev against it statically. Otherwise, use glibc and link dynamically. +# if our own version of klibc is used, we need to build it ifeq ($(strip $(USE_KLIBC)),true) KLIBC_INSTALL = $(PWD)/klibc/.install KLCC = $(KLIBC_INSTALL)/bin/$(CROSS)klcc @@ -213,21 +214,25 @@ else HOST_PROGS= endif -# config files automatically generated -GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf - -all: $(ROOT) $(SENDER) $(COMPILE) $(INITSENDER) $(RECORDER) $(CONTROL) $(MONITOR)\ - $(DAEMON) $(COMPILE) $(INFO) $(TESTER) $(STARTER) $(GEN_CONFIGS) $(KLCC) - @extras="$(EXTRAS)" ; for target in $$extras ; do \ - echo $$target ; \ +all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) + @extras="$(EXTRAS)"; for target in $$extras; do \ + echo $$target; \ $(MAKE) prefix=$(prefix) \ LD="$(LD)" \ - SYSFS="$(SYSFS)" \ + LIBUDEV="$(PWD)/$(LIBUDEV)" \ + LIBSYSFS="$(PWD)/$(LIBSYSFS)" \ KERNEL_DIR="$(KERNEL_DIR)" \ QUIET="$(QUIET)" \ - -C $$target $@ ; \ - done ; \ + -C $$target $@; \ + done; +.PHONY: all +$(PROGRAMS): $(HOST_PROGS) $(KLCC) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) + $(QUIET) $(CC) $(CFLAGS) -c -o $@.o $@.c + $(QUIET) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ + +# our own copy of klibc if KLCC is specified it will not be used $(KLCC): $(MAKE) -j1 -C klibc KRNLSRC=$(KERNEL_DIR) SUBDIRS=klibc TESTS= \ SHLIBDIR=$(KLIBC_INSTALL)/lib \ @@ -236,24 +241,23 @@ $(KLCC): mandir=$(KLIBC_INSTALL)/man all install -find $(KLIBC_INSTALL)/include -name SCCS -print| xargs rm -rf -udev.a: $(UDEV_OBJS) - rm -f $@ +$(UDEV_OBJS): $(KLCC) +$(LIBUDEV): $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS) + @rm -f $@ $(QUIET) $(AR) cq $@ $(UDEV_OBJS) $(QUIET) $(RANLIB) $@ -libsysfs/sysfs.a: $(SYSFS_OBJS) - rm -f $@ +$(SYSFS_OBJS): $(KLCC) +$(LIBSYSFS): $(HOST_PROGS) $(SYSFS_OBJS) + @rm -f $@ $(QUIET) $(AR) cq $@ $(SYSFS_OBJS) $(QUIET) $(RANLIB) $@ -# header files automatically generated -GEN_HEADERS = udev_version.h - -ccdv: - @echo "Building ccdv" - @$(HOSTCC) -O1 ccdv.c -o ccdv +# generate config files +$(GEN_CONFIGS): + sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $@.in > $@ -# Rules on how to create the generated header files +# generate config header file udev_version.h: @echo "Creating udev_version.h" @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ @@ -265,108 +269,50 @@ udev_version.h: @echo \#define UDEV_BIN \"$(sbindir)/udev\" >> $@ @echo \#define UDEVD_BIN \"$(sbindir)/udevd\" >> $@ -# Rules on how to create the generated config files -$(LOCAL_CFG_DIR)/udev.conf: - sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $(LOCAL_CFG_DIR)/udev.conf.in > $@ - # man pages %.8: docs/%.xml xmlto man $? - -$(UDEV_OBJS): $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(SYSFS_OBJS): $(HEADERS) $(HOST_PROGS) $(KLCC) -$(OBJS): $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(ROOT).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(TESTER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(INFO).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(DAEMON).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(SENDER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(COMPILE).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(INITSENDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(RECORDER).o: $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(CONTROL).o: $(HEADERS) $( $(HEADERS)GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(MONITOR).o: $(HEADERS) $( $(HEADERS)GEN_HEADERS) $(HOST_PROGS) $(KLCC) -$(STARTER).o: $(HEADERS) $(GEN_HEADERS) $(HOST_PROGS) $(KLCC) - -$(ROOT): $(KLCC) $(ROOT).o $(OBJS) $(HEADERS) $(MAN_PAGES) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(ROOT).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(TESTER): $(KLCC) $(TESTER).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(TESTER).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(INFO): $(KLCC) $(INFO).o $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(INFO).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(DAEMON): $(KLCC) $(DAEMON).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(DAEMON).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(SENDER): $(KLCC) $(SENDER).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(SENDER).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(COMPILE): $(KLCC) $(COMPILE).o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(COMPILE).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(INITSENDER): $(KLCC) $(INITSENDER).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(INITSENDER).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(RECORDER): $(KLCC) $(RECORDER).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(RECORDER).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(CONTROL): $(KLCC) $(CONTROL).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(CONTROL).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(MONITOR): $(KLCC) $(MONITOR).o $(OBJS) udevd.h - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(MONITOR).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ - -$(STARTER): $(KLCC) $(STARTER).o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) -o $@ $(STARTER).o $(OBJS) $(LIB_OBJS) - $(QUIET) $(STRIPCMD) $@ +.PRECIOUS: %.8 .c.o: $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +ccdv: ccdv.c + @$(HOSTCC) -O1 ccdv.c -o ccdv +.SILENT: ccdv + clean: - -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print \ - | xargs rm -f - -rm -f core $(ROOT) $(GEN_HEADERS) $(GEN_CONFIGS) $(INFO) $(DAEMON) \ - $(SENDER) $(COMPILE) $(INITSENDER) $(RECORDER) $(CONTROL) $(MONITOR) $(TESTER) $(STARTER) - -rm -f ccdv + -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print | xargs rm -f + -rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS) $(MAKE) -C klibc SUBDIRS=klibc clean - @extras="$(EXTRAS)" ; for target in $$extras ; do \ - echo $$target ; \ - $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ - -C $$target $@ ; \ - done ; \ + @extras="$(EXTRAS)"; for target in $$extras; do \ + echo $$target; \ + $(MAKE) prefix=$(prefix) -C $$target $@; \ + done; +.PHONY: clean spotless: clean $(MAKE) -C klibc SUBDIRS=klibc spotless rm -rf klibc/.install +.PHONY: spotless release: spotless git-tar-tree HEAD $(RELEASE_NAME) | gzip -9v > $(RELEASE_NAME).tar.gz @echo "$(RELEASE_NAME).tar.gz created" +.PHONY: release -install-config: +install-config: $(GEN_CONFIGS) $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d @if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ fi @if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \ - echo ; \ + echo; \ echo "pick a udev rules file from the etc/udev directory that matches your distribution"; \ - echo ; \ + echo; \ fi +.PHONY: install-config install-man: $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 @@ -377,6 +323,7 @@ install-man: $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 +.PHONY: install-man uninstall-man: - rm $(mandir)/man8/udev.8 @@ -387,54 +334,55 @@ uninstall-man: - rm $(mandir)/man8/udevmonitor.8 - rm $(mandir)/man8/udevsend.8 - rm $(mandir)/man8/udevcontrol.8 +.PHONY: uninstall-man install: install-config install-man all $(INSTALL) -d $(DESTDIR)$(udevdir) - $(INSTALL_PROGRAM) -D $(ROOT) $(DESTDIR)$(sbindir)/$(ROOT) - $(INSTALL_PROGRAM) -D $(DAEMON) $(DESTDIR)$(sbindir)/$(DAEMON) - $(INSTALL_PROGRAM) -D $(SENDER) $(DESTDIR)$(sbindir)/$(SENDER) - $(INSTALL_PROGRAM) -D $(CONTROL) $(DESTDIR)$(sbindir)/$(CONTROL) - $(INSTALL_PROGRAM) -D $(MONITOR) $(DESTDIR)$(usrsbindir)/$(MONITOR) - $(INSTALL_PROGRAM) -D $(INFO) $(DESTDIR)$(usrbindir)/$(INFO) - $(INSTALL_PROGRAM) -D $(TESTER) $(DESTDIR)$(usrbindir)/$(TESTER) - $(INSTALL_PROGRAM) -D $(STARTER) $(DESTDIR)$(sbindir)/$(STARTER) + $(INSTALL_PROGRAM) -D udev $(DESTDIR)$(sbindir)/udev + $(INSTALL_PROGRAM) -D udevd $(DESTDIR)$(sbindir)/udevd + $(INSTALL_PROGRAM) -D udevsend $(DESTDIR)$(sbindir)/udevsend + $(INSTALL_PROGRAM) -D udevcontrol $(DESTDIR)$(sbindir)/udevcontrol + $(INSTALL_PROGRAM) -D udevmonitor $(DESTDIR)$(usrsbindir)/udevmonitor + $(INSTALL_PROGRAM) -D udevinfo $(DESTDIR)$(usrbindir)/udevinfo + $(INSTALL_PROGRAM) -D udevtest $(DESTDIR)$(usrbindir)/udevtest + $(INSTALL_PROGRAM) -D udevstart $(DESTDIR)$(sbindir)/udevstart ifndef DESTDIR - - killall $(DAEMON) + - killall udevd - rm -rf $(udevdb) - - $(sbindir)/$(DAEMON) --daemon + - $(sbindir)/udevd --daemon endif - @extras="$(EXTRAS)" ; for target in $$extras ; do \ - echo $$target ; \ - $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ - -C $$target $@ ; \ - done ; \ + @extras="$(EXTRAS)"; for target in $$extras; do \ + echo $$target; \ + $(MAKE) prefix=$(prefix) -C $$target $@; \ + done; +.PHONY: install uninstall: uninstall-man - rm $(configdir)/rules.d/50-udev.rules - rm $(configdir)/udev.conf - rmdir $(configdir)/rules.d - rmdir $(configdir) - - rm $(sbindir)/$(ROOT) - - rm $(sbindir)/$(DAEMON) - - rm $(sbindir)/$(SENDER) - - rm $(sbindir)/$(INITSENDER) - - rm $(sbindir)/$(RECORDER) - - rm $(sbindir)/$(CONTROL) - - rm $(sbindir)/$(STARTER) - - rm $(usrsbindir)/$(MONITOR) - - rm $(usrbindir)/$(INFO) - - rm $(usrbindir)/$(TESTER) + - rm $(sbindir)/udev + - rm $(sbindir)/udevd + - rm $(sbindir)/udevsend + - rm $(sbindir)/udevinitsend + - rm $(sbindir)/udeveventrecoreder + - rm $(sbindir)/udevcontrol + - rm $(sbindir)/udevstart + - rm $(usrsbindir)/udevmonitor + - rm $(usrbindir)/udevinfo + - rm $(usrbindir)/udevtest - rm -rf $(udevdb) - rmdir $(udevdir) - - killall $(DAEMON) - @extras="$(EXTRAS)" ; for target in $$extras ; do \ - echo $$target ; \ - $(MAKE) prefix=$(prefix) LD="$(LD)" SYSFS="$(SYSFS)" \ - -C $$target $@ ; \ - done ; \ - -test: all + - killall udevd + @extras="$(EXTRAS)"; for target in $$extras; do \ + echo $$target; \ + $(MAKE) prefix=$(prefix) -C $$target $@; \ + done; +.PHONY: uninstall-man + +test tests: all @ cd test && ./udev-test.pl @ cd test && ./udevstart-test.pl +.PHONY: test tests -tests: test diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index fb45bcca64..eab01ad9ab 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -28,7 +28,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = ata_id.o ../../udev.a +OBJS = ata_id.o $(LIBUDEV) $(OBJS): $(HEADERS) diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index 44c9ba2b08..6ea5f14ec1 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -29,7 +29,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = cdrom_id.o ../../udev.a +OBJS = cdrom_id.o $(LIBUDEV) $(OBJS): $(HEADERS) diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 3b0a35f75f..f2c0595de0 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -28,7 +28,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = dasd_id.o ../../udev.a +OBJS = dasd_id.o $(LIBUDEV) $(OBJS): $(HEADERS) diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index 913a88db06..343d5295f1 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -28,7 +28,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = $(PROG).o $(VOLUME_ID_OBJS) ../../udev.a ../../libsysfs/sysfs.a +OBJS = $(PROG).o $(LIBUDEV) $(LIBSYSFS) HEADERS = $(OBJS): $(HEADERS) diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index ab0cd17e58..5380590c9b 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -28,7 +28,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = $(PROG).o ../../udev.a +OBJS = $(PROG).o $(LIBUDEV) $(OBJS): $(HEADERS) diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 14b4725dae..c1a83e3c0b 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -29,7 +29,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = ../../udev.a ../../libsysfs/sysfs.a +OBJS = $(LIBUDEV) .c.o: $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 0635e91cc5..4347fba407 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -28,7 +28,7 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = $(PROG).o $(VOLUME_ID_OBJS) ../../udev.a ../../libsysfs/sysfs.a +OBJS = $(PROG).o $(VOLUME_ID_OBJS) $(LIBUDEV) $(LIBSYSFS) HEADERS = $(OBJS): $(HEADERS) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 0fadbf5b0e..8ca3bd1333 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -31,8 +31,7 @@ INSTALL_SCRIPT = ${INSTALL_PROGRAM} VOLUME_ID_BASE=volume_id include $(VOLUME_ID_BASE)/Makefile.inc -OBJS = vol_id.o $(VOLUME_ID_OBJS) -LIB_OBJS=../../udev.a +OBJS = vol_id.o $(VOLUME_ID_OBJS) $(LIBUDEV) HEADERS = $(VOLUME_ID_HEADERS) $(OBJS): $(HEADERS) @@ -41,7 +40,7 @@ $(OBJS): $(HEADERS) $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< $(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) clean: rm -f $(PROG) $(OBJS) diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 0112ef78e2..ec18e51a0c 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -36,4 +36,3 @@ make all $MAKEOPTS USE_KLIBC=true USE_LOG=false EXTRAS="$EXTRAS" KERNEL_DIR="$KE echo -e "\n\n" make spotless EXTRAS="$EXTRAS" >/dev/null -echo "build test completed successfully" -- cgit v1.2.3-54-g00ecf From 7b86ada7d4a6b2597299912964d1b8da3d059691 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Aug 2005 23:30:52 +0200 Subject: all man pages rewritten to use DocBook XML Signed-off-by: Kay Sievers --- Makefile | 4 +- docs/udev.xml | 545 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ docs/udevd.xml | 19 +- udev.8 | 569 ++++++++++++++++++++++----------------------------------- udevd.8 | 14 +- 5 files changed, 786 insertions(+), 365 deletions(-) create mode 100644 docs/udev.xml diff --git a/Makefile b/Makefile index f34befd999..80364c2a7a 100644 --- a/Makefile +++ b/Makefile @@ -86,8 +86,10 @@ UDEV_OBJS = \ LIBUDEV = libudev.a MAN_PAGES = \ + udev.8 \ udevmonitor.8 \ udevd.8 \ + udevsend.8 \ udevtest.8 \ udevinfo.8 \ udevstart.8 @@ -320,8 +322,8 @@ install-man: $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 $(INSTALL_DATA) -D udevstart.8 $(DESTDIR)$(mandir)/man8/udevstart.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 + $(INSTALL_DATA) -D udevsend.8 $(DESTDIR)$(mandir)/man8/udevsend.8 $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevsend.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 .PHONY: install-man diff --git a/docs/udev.xml b/docs/udev.xml new file mode 100644 index 0000000000..02dcd2586a --- /dev/null +++ b/docs/udev.xml @@ -0,0 +1,545 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udev + + + udev + August 2005 + udev + + + + udev + 8 + + + + udev + dynamic device management + + + DESCRIPTION + udev provides a dynamic device directory containing only the files for + actually present devices. It creates or removes device node files in the + /dev directory, or it renames network interfaces. + + Usually udev runs as udevd + 8 and receives uevents directly from the + kernel if a device is added or removed form the system. The program + udev itself may be used as an event handler in situations, + where running the daemon is not appropriate, like in initramfs. + + If udev receives a device event, it matches its configured rules + against the available device attributes provided in sysfs to identify the device. + Rules that match, may provide additional device information or specify a device + node name and multiple symlink names and instruct udev to run additional programs + as part of the device event handling. + + + CONFIGURATION + All udev configuration files are placed in /etc/udev/*. + Every file consist of a set of lines of text. All empty lines or lines beginning + with '#' will be ignored. + + Configuration file + udev expects its main configuration file at /etc/udev/udev.conf. + It consists of a set of variables allowing the user to override default udev values. + The following variables can be set: + + + + + Specifies where to place the device nodes in the filesystem. + The default value is /dev. + + + + + + + The name and location of the udev database. The default value is + /dev/.udevdb. + + + + + + + The name of the udev rules file or directory to look for files + with the suffix .rules. Multiple rule files are + read in lexical order. The default value is + /etc/udev/rules.d. + + + + + + + The logging priority. Valid values are the numerical syslog priorities + or their textual representations: , + and . + + + + + + Rules files + The udev rules are read from the files located in the + /etc/udev/rules.d directory or at the location specified + value in the configuraton file. Every line in the rules file contains at least + one key value pair. There are two kind of keys, match and assignement keys. + If all match keys are matching against its value, the rule gets applied and the + assign keys get the specified value assigned. A matching rule may specify the + name of the device node, add a symlink pointing to the node, or run a specified + program as part of the event handling. If no matching rule is found, the default + device node name is used. + + A rule may consists of a list of one or more key value pairs separated by + a comma. Each key has a distinct operation, depending on the used operator. Valid + operators are: + + + + + Compare for equality. + + + + + + + Compare for non-equality. + + + + + + + Asign a value to a key. Keys that represent a list, are reset + and only this single value is assigned. + + + + + + + Add the value to a key that holds a list of entries. + + + + + + + Assign a value to a key finally; disallow any later changes, + which may be used to prevent changes by any later rules. + + + + + The following key names can be used to match against device properties: + + + + + Match the kernel action name. + + + + + + + Match the kernel device name + + + + + + + Match the kernel devpath. + + + + + + + Match the kernel subsystem name + + + + + + + Match the typ of bus the device is connected to. + + + + + + + Match the kernel driver name. + + + + + + + Match the device number on the bus. + + + + + + + Match against the value of an environment key. Depending on + the specified operation, this key is also used as a assignment. + + + + + + + Match the sysfs attribute value. Up to five values can be specified. + Trailing whitespace is ignored, if the specified match value does not contain + trailing whitespace itself. + + + + + + + Execute external program. The key is true, if the program returns + without exit code zero. The whole event environment is available to the + executed program. The program's output printed to stdout is available for + the RESULT key. + + + + + + + Match the returned string of the last PROGRAM call. This key can + be used in the same or in any later rule after a PROGRAM call. + + + + + Most of the fields support a shell style pattern matching. The following + pattern characters are supported: + + + + + Matches zero, or any number of characters. + + + + + + Matches any single character. + + + + + + Matches any single character specified within the brackets. + example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. + Ranges are also supported within this match with the '-' character. + For example, to match on the range of all digits, the pattern [0-9] would + be used. If the first character following the '[' is a '!', any characters + not enclosed are matched. + + + + + The following keys can get values assigned: + + + + + The name of the node to be created, or the name, the network interface + should be renamed to. Only one rule can set the a name, all later rules with + a NAME key will be ignored. + + + + + + + The name of a symlink targeting the node. Every matching rule can add + this value to the list of symlinks to be created along with the device node. + Multiple symlinks may be specified by separating the names by the space + character. + + + + + + + The permissions for the device node. Every specified value over writes + the compiled-in default value. + + + + + + + Export the key to the environment. Depending on the specified + operation, this key is also used as a match. + + + + + + + Add a program to the list of programs to be executed for a specific + device. + + + + + + + Named label where a GOTO can jump to. + + + + + + + Jumps to the next LABEL with a matching gname + + + + + + + Import the printed result or the content of a file in environment key + format into the event environment. will execute an + external program and read its output. will inport a + text file. If no option is given, udev will determine it from the executable + bit of of the file permissions. + + + + + + + Wait for the specified sysfs file of the device to be created. May be used + to fight agains timing issues wth the kernel. + + + + + + + stops further rules application. No later rules + will have any effect. + will ignore this event completely. + will ignore any later remove event for this + device. This may be useful as a workaround for broken device drivers. + will create device nodes for all available partitions of + a block device. This may be useful for removable media. + + + + + The , , , + and fields support simple + printf-like string substitutions: + + + , + + The kernel name for this device. + + + + + , + + The kernel bus id for this device. + + + + + , + + The kernel number for this device. For example, 'sda3' has + kernel number of '3' + + + + + , + + The devpath of the device. + + + + + , + + The content of a sysfs attribute. + + + + + , + + The value of an environment variable. + + + + + , + + The kernel major number for the device. + + + + + + + The kernel minor number for the device. + + + + + , + + The string returned by the external program requested with PROGRAM. + A single part of the string, separated by a space character may be selected + by specifying the part number as an attribute: . + If the number is followed by the '+' char this part plus all remaining parts + of the result string are substituted: + + + + + , + + If a device node already exists with the name, the smallest next free + number is used. This can be used to create compatibility symlinks and enumerate + devices of the same type originating from different kernel subsystems. + Note: The use of the enumeration facility is unreliable for events that + request a number at the same time. The use of enumerations in todays setups + where devices can come and go at any time is not recomended. + + + + + , + + The node name of the parent device. + + + + + , + + The udev_root value. + + + + + , + + The name of a created temporary device node to provide access to + the device from a external program before the real node is created. + + + + + + + The '%' character itself. + + + + + + + The '$' character itself. + + + + The count of characters to be substituted may be limited by specifying + the format length value. For example, '%3s{file}' will only + insert the first three characters of the sysfs attribute + + + + ENVIRONMENT + + + + + add or remove signifies + the addition or the removal of a device. + + + + + + + The sysfs devpath without the mountpoint but a leading slash. + + + + + + + The kernel subsystem the device belongs to. + + + + + + + Overrides the syslog priority specified in the config file. + + + + + + AUTHOR + Written by Greg Kroah-Hartman greg@kroah.com and + Kay Sievers kay.sievers@vrfy.org. With much help from + Dan Stekloff dsteklof@us.ibm.com and many others. + + + + SEE ALSO + + udev8 + , + + udevinfo8 + , + + udevd8 + , + + udevmonitor8 + + + +
    +
    diff --git a/docs/udevd.xml b/docs/udevd.xml index eeaec4402f..76df707519 100644 --- a/docs/udevd.xml +++ b/docs/udevd.xml @@ -17,7 +17,7 @@
    - udevd, udevsend, udevcontrol + udevd, udevcontrol udevd @@ -42,9 +42,6 @@ udevcontrol command - - udevsend subsystem - DESCRIPTION @@ -66,7 +63,8 @@ udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual - representations: err, info and debug. + representations: , + and . @@ -84,6 +82,17 @@ + ENVIRONMENT + + + + + Overrides the syslog priority specified in the config file. + + + + + AUTHOR Written by Kay Sievers kay.sievers@vrfy.org. diff --git a/udev.8 b/udev.8 index 9dae378086..9b74ae23bf 100644 --- a/udev.8 +++ b/udev.8 @@ -1,394 +1,253 @@ -.TH UDEV 8 "October 2003" "" "Linux Administrator's Manual" -.SH NAME -udev \- Linux configurable dynamic device naming support -.SH SYNOPSIS -.BI udev +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEV" "8" "August 2005" "udev" "udev" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udev \- dynamic device management .SH "DESCRIPTION" -.B udev -provides a dynamic device directory containing only the files for actually -present devices. It creates or removes device node files usually located in -the /dev directory, or it renames network interfaces. -.br -.P -As part of the -.B hotplug -subsystem, -.B udev -is executed if a kernel device is added or removed from the system. -A list of rules is used to match against specific device attributes. -.br -On device addition, -.B udev -matches its configured rules against the available device attributes to -uniquely name the device. -.B udev -maintains its own database for devices present on the system. This database -can be queried for the relationship of the kernel device path and the -name of the device file. -.br -On device removal, -.B udev -queries its database for the name of the device file to be deleted. -.br -After the device node handling, a list of collected programs specific to this -device is executed. +.PP +udev provides a dynamic device directory containing only the files for actually present devices. It creates or removes device node files in the +\fI/dev\fR +directory, or it renames network interfaces. +.PP +Usually udev runs as +\fBudevd\fR(8) +and receives uevents directly from the kernel if a device is added or removed form the system. The program +\fBudev\fR +itself may be used as an event handler in situations, where running the daemon is not appropriate, like in initramfs. +.PP +If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. Rules that match, may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling. .SH "CONFIGURATION" -All -.B udev -configuration files consist of a set of lines of text. All empty -lines or lines beginning with '#' will be ignored. -.P -.B udev -expects its main configuration file at -.IR /etc/udev/udev.conf . -The file consists of a set of variables and values allowing the user to -override default udev values. The following variables can be overridden -in this file: -.TP -.B udev_root -Indicates where to place the device nodes in the filesystem. The default -value is -.IR @udevdir@/ . -.TP -.B udev_db -The name and location of the udev database. The default value is -.IR @udevdir@/.udevdb . -.TP -.B udev_rules -The name of the udev rules file or directory to look for files with the suffix -.IR .rules . -All rule files are read in lexical order. The default value is -.IR /etc/udev/rules.d/ . -.TP -.B udev_log -The logging priority which can be set to -.IR "err " , "info " -or the corresponding numerical -.BR syslog (3) -value. -The default value is -.IR err . -.P -.RI "A sample " udev.conf " file might look like this: -.sp -.nf -# Where in the filesystem to place the device nodes -udev_root="@udevdir@" - -# The name and location of the udev database. -udev_db="@udevdir@/.udevdb" - -# The name and location of the udev rules file(s). -udev_rules="@configdir@/rules.d" - -# The syslog(3) priority: "err", "info", or the numerical value. -udev_log="err" -.fi -.P -The rules for device naming are read from the files located in the -.I /etc/udev/rules.d/ -directory, or at the location specified by the -.I udev_rules -value in the -.I /etc/udev/udev.conf -file. -.br -Every line in the rules file defines the mapping between device attributes -and the device name. One or more keys are specified to match a rule with -the current device. If all keys are matching, the rule will be applied and -the name is used to name the device file or the network interface. -.br -If no matching rule is found, the default kernel device name is used. -.P -Every rule consists of a list of comma separated key value fields: -.sp -.IR "key " ,[ "key " ,...] -.P -Each key has the following format: -.sp -.IR "name op value" -.P -There are distinct key operation types, depending on the type of the key, it -does a comparison or an assignment. -.P -Comparison operators are: -.TP -.B == +.PP +All udev configuration files are placed in +\fI/etc/udev/*\fR. Every file consist of a set of lines of text. All empty lines or lines beginning with '#' will be ignored. +.SS "Configuration file" +.PP +udev expects its main configuration file at +\fI/etc/udev/udev.conf\fR. It consists of a set of variables allowing the user to override default udev values. The following variables can be set: +.TP +\fBudev_root\fR +Specifies where to place the device nodes in the filesystem. The default value is +\fI/dev\fR. +.TP +\fBudev_db\fR +The name and location of the udev database. The default value is +\fI/dev/.udevdb\fR. +.TP +\fBudev_rules\fR +The name of the udev rules file or directory to look for files with the suffix +\fI.rules\fR. Multiple rule files are read in lexical order. The default value is +\fI/etc/udev/rules.d\fR. +.TP +\fBudev_log\fR +The logging priority. Valid values are the numerical syslog priorities or their textual representations: +\fBerr\fR, +\fBinfo\fR +and +\fBdebug\fR. +.SS "Rules files" +.PP +The udev rules are read from the files located in the +\fI/etc/udev/rules.d\fR +directory or at the location specified value in the configuraton file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignement keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. +.PP +A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: +.TP +\fB==\fR Compare for equality. .TP -.B != -Compare for non-equality. -.P -Assignment operators are: +\fB!=\fR +Compare for non\-equality. .TP -.B += -Add the value to a key that holds a list of entries. +\fB=\fR +Asign a value to a key. Keys that represent a list, are reset and only this single value is assigned. .TP -.B := -Assign a value to a key finally; disallow any later changes, which -is useful to prevent changes by any later rules. +\fB+=\fR +Add the value to a key that holds a list of entries. .TP -.B = -Asign a value to a key. Keys that represent a list, are reset and only this -single value is assigned. While this operator still works inplicitely as -comparison on keys that can't get a value assigned, its usage as an comparison -operator is deprecated. -.P +\fB:=\fR +Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules. +.PP The following key names can be used to match against device properties: .TP -.B BUS -Match the bus type of the device. -(The sysfs device bus must be able to be determined by a "device" symlink.) +\fBACTION\fR +Match the kernel action name. .TP -.B KERNEL -Match the kernel device name. +\fBKERNEL\fR +Match the kernel device name .TP -.B SUBSYSTEM -Match the kernel subsystem name. +\fBDEVPATH\fR +Match the kernel devpath. .TP -.B ACTION -Match the kernel action name. +\fBSUBSYSTEM\fR +Match the kernel subsystem name .TP -.B DRIVER +\fBBUS\fR +Match the typ of bus the device is connected to. +.TP +\fBDRIVER\fR Match the kernel driver name. .TP -.B ID -Match the device number on the bus, like PCI bus id. -.TP -.BI SYSFS{ filename } -Match sysfs device attribute like vendor and product id's, USB serial number -or the SCSI disk model number. Up to 5 different sysfs files can be checked, -with all of the values being required to match the rule. -.br -Trailing whitespace characters in the sysfs attribute value are ignored, if -the key doesn't have any trailing whitespace characters by itself. -.TP -.BI ENV{ variable } -Match an environment variable. Up to 5 different environment variables can be -checked, with all of the values being required to match the rule. -.TP -.B PROGRAM -Call external program. This key is valid if the program returns successful. -The environment variables of -.B udev -are also available to the program. -.br -The string returned by the program may be additionally matched with the -.B RESULT -key in the same or any later rule. -.TP -.B RESULT -Match the returned string of the last -.B PROGRAM -call. This key can be used in the same or in any later rule after a -.B PROGRAM -call. -.P +\fBID\fR +Match the device number on the bus. +.TP +\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR +Match against the value of an environment key. Depending on the specified operation, this key is also used as a assignment. +.TP +\fBSYSFS{\fR\fB\fIfilename\fR\fR\fB}\fR +Match the sysfs attribute value. Up to five values can be specified. Trailing whitespace is ignored, if the specified match value does not contain trailing whitespace itself. +.TP +\fBPROGRAM\fR +Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key. +.TP +\fBRESULT\fR +Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call. +.PP +Most of the fields support a shell style pattern matching. The following pattern characters are supported: +.TP +\fB*\fR +Matches zero, or any number of characters. +.TP +\fB?\fR +Matches any single character. +.TP +\fB[]\fR +Matches any single character specified within the brackets. example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. +.PP The following keys can get values assigned: .TP -.B NAME -The name of the node to be created, or the name, the network interface -should be renamed to. Only one rule can set the a name, all later rules -with a NAME key will be ignored. +\fBNAME\fR +The name of the node to be created, or the name, the network interface should be renamed to. Only one rule can set the a name, all later rules with a NAME key will be ignored. +.TP +\fBSYMLINK\fR +The name of a symlink targeting the node. Every matching rule can add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character. .TP -.B SYMLINK -The name of a symlink targeting the node. Every matching rule can add -this value to the list of symlinks to be created along with the device node. -Multiple symlinks may be specified by separating the names by the space -character. +\fBOWNER, GROUP, MODE\fR +The permissions for the device node. Every specified value over writes the compiled\-in default value. .TP -.B OWNER, GROUP, MODE -The permissions for the device node. Every specified value overwrites the -compiled-in default value. +\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR +Export the key to the environment. Depending on the specified operation, this key is also used as a match. .TP -.B RUN +\fBRUN\fR Add a program to the list of programs to be executed for a specific device. .TP -.B OPTIONS -.B last_rule -stops further rules application. No later rules will have any effect. -.sp -.B ignore_device -will ignore this device. No node will be created or program executed. -.sp -.B ignore_remove -will ignore any later remove event for this device. -This may be useful as a workaround for broken device drivers. -.sp -.B all_partitions -will create device nodes for all available partitions of a blockdevice. -This may be useful for removable media devices which do not detect a media -change. -.sp -Multiple attributes may be separated by comma. -.P -.RB "The " NAME ", " SYMLINK ", " PROGRAM ", " OWNER " and " GROUP -fields support simple printf-like string substitutions: -.TP -.B %n -The "kernel number" of the device. -For example, 'sda3' has a "kernel number" of '3'. -.TP -.B %k -The "kernel name" for the device. -.TP -.B %p -The devpath for the device. -.TP -.B %M +\fBLABEL\fR +Named label where a GOTO can jump to. +.TP +\fBGOTO\fR +Jumps to the next LABEL with a matching gname +.TP +\fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR +Import the printed result or the content of a file in environment key format into the event environment. +\fBprogram\fR +will execute an external program and read its output. +\fBfile\fR +will inport a text file. If no option is given, udev will determine it from the executable bit of of the file permissions. +.TP +\fBWAIT_FOR_SYSFS\fR +Wait for the specified sysfs file of the device to be created. May be used to fight agains timing issues wth the kernel. +.TP +\fBOPTIONS\fR +\fBlast_rule\fR +stops further rules application. No later rules will have any effect. +\fBignore_device\fR +will ignore this event completely. +\fBignore_remove\fR +will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. +\fBall_partitions\fR +will create device nodes for all available partitions of a block device. This may be useful for removable media. +.PP +The +\fBNAME\fR, +\fBSYMLINK\fR, +\fBPROGRAM\fR, +\fBOWNER\fR +and +\fBGROUP\fR +fields support simple printf\-like string substitutions: +.TP +\fB%k\fR, \fB$kernel\fR +The kernel name for this device. +.TP +\fB%b\fR, \fB$id\fR +The kernel bus id for this device. +.TP +\fB%n\fR, \fB$number\fR +The kernel number for this device. For example, 'sda3' has kernel number of '3' +.TP +\fB%p\fR, \fB$devpath\fR +The devpath of the device. +.TP +\fB%s{\fR\fB\fIfile\fR\fR\fB}\fR, \fB$sysfs{\fR\fB\fIfile\fR\fR\fB}\fR +The content of a sysfs attribute. +.TP +\fB%e{\fR\fB\fIkey\fR\fR\fB}\fR, \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR +The value of an environment variable. +.TP +\fB%m\fR, \fB$major\fR The kernel major number for the device. .TP -.B %m +\fB%M\fR \fB$minor\fR The kernel minor number for the device. .TP -.B %b -The bus id for the device. -.TP -.B %c -The string returned by the external program, specified in -.B PROGRAM -(This does not work within the -.B PROGRAM -field for the obvious reason.) -.br -A single part of the string, separated by a space character -may be selected by specifying the part number as an attribute: -.BI %c{ N } -If the number is followed by the + char this part plus -all remaining parts of the result string are substituted: -.BI %c{ N+ } -.TP -.B %N -The name of a created temporary device node to provide access to the -device from a external program. -.TP -.B %P -The node name of the parent device. +\fB%c\fR, \fB$result\fR +The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: +\fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: +\fB%c{N+}\fR .TP -.BI %s{ filename } -The content of a sysfs attribute. +\fB%e\fR, \fB$enum\fR +If a device node already exists with the name, the smallest next free number is used. This can be used to create compatibility symlinks and enumerate devices of the same type originating from different kernel subsystems. + +Note: The use of the enumeration facility is unreliable for events that request a number at the same time. The use of enumerations in todays setups where devices can come and go at any time is not recomended. +.TP +\fB%P\fR, \fB$parent\fR +The node name of the parent device. .TP -.B %r +\fB%r\fR, \fB$root\fR The udev_root value. .TP -.B %e -If a device node already exists with the name, the smallest positive -decimal integer N is substituted such that the resulting name doesn't -match an existing device node. Otherwise nothing is substituted. This -can be used to create compatibility symlinks and enumerate devices of -the same type originating from different kernel subsystems. -.sp -Note: The use of the enumeration facility is unreliable outside of -udevstart where the node creation is serialized and predictable. -The returned numbers rely on the order devices are probed on the -system. If more than one device requests an enumeration for the same -name at the same time, it may be possible that both requests receive the -same name back from the database. The use of enumerations in todays setups -where device can come and go at any time is not recomended. -.TP -.B %% +\fB%N\fR, \fB$tempnode\fR +The name of a created temporary device node to provide access to the device from a external program before the real node is created. +.TP +\fB%%\fR The '%' character itself. -.P -The count of characters to insert may be limited by specifying -the format length value. For example, '%3s{file}' will only insert -the first three characters of the sysfs attribute. -.P -.RI "A sample " udev.rules " file might look like this:" -.sp -.nf -# if /sbin/scsi_id returns "OEM 0815", the device will be called disk1 -BUS=="scsi", PROGRAM=="/sbin/scsi_id", RESULT=="OEM 0815", NAME="disk1" - -# USB printer to be called lp_color -BUS=="usb", SYSFS{serial}=="W09090207101241330", NAME="lp_color" - -# SCSI disk with a specific vendor and model number will be called boot -BUS=="scsi", SYSFS{vendor}=="IBM", SYSFS{model}=="ST336", NAME="boot%n" - -# sound card with PCI bus id 00:0b.0 to be called dsp -BUS=="pci", ID=="00:0b.0", NAME="dsp" - -# USB mouse at third port of the second hub to be called mouse1 -BUS=="usb", ID=="2.3", NAME="mouse1" - -# ttyUSB1 should always be called pda with two additional symlinks -KERNEL=="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" - -# multiple USB webcams with symlinks to be called webcam0, webcam1, ... -BUS=="usb", SYSFS{model}=="XV3", NAME=="video%n", SYMLINK="webcam%n" -.fi -.P -A number of different fields in the above configuration files support a simple -form of shell style pattern matching. It supports the following pattern characters: -.TP -.B * -Matches zero, one, or more characters. -.TP -.B ? -Matches any single character, but does not match zero characters. -.TP -.B [ ] -Matches any single character specified within the brackets. For example, the -pattern string "tty[SR]" would match either "ttyS" or "ttyR". Ranges are also -supported within this match with the '\-' character. For example, to match on -the range of all digits, the pattern [0\-9] would be used. If the first character -following the '[' is a '!', any characters not enclosed are matched. -.P -After device node creation, removal, or network device renaming, -.B udev -executes the programs specified by the -.B RUN -key. -.br -In addition to the kernel provided hotplug environment variables, -.B UDEV_LOG -is set and contains the numerical priority value, if udev is configured to use -.BR syslog (3). -Executed programs may want to follow that setting. -.B DEVNAME -is exported to make the name of the created node, or the name the network -device is renamed to, available to the executed programs. +.TP +\fB$$\fR +The '$' character itself. +.PP +The count of characters to be substituted may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute .SH "ENVIRONMENT" -.P -The following variables are read from the environment: .TP -.B ACTION -.IR add " or " remove +\fBACTION\fR +\fIadd\fR +or +\fIremove\fR signifies the addition or the removal of a device. .TP -.B DEVPATH -The sysfs devpath of the device without the mountpoint but a leading slash. +\fBDEVPATH\fR +The sysfs devpath without the mountpoint but a leading slash. .TP -.B SUBSYSTEM -The subsystem the device belongs to. Alternatively the subsystem may -be passed as the first argument. +\fBSUBSYSTEM\fR +The kernel subsystem the device belongs to. .TP -.B UDEV_CONFIG_FILE -Overrides the default location of the -.B udev -config file. -.TP -.B UDEV_LOG -Overrides the log priority specified in the config file. -.TP -.B UDEV_RUN -If set to "0", it disables the execution of programs added by rules. -.SH "FILES" -.nf -/sbin/udev udev program -/etc/udev/* udev config files -.fi +\fBUDEV_LOG\fR +Overrides the syslog priority specified in the config file. +.SH "AUTHOR" +.PP +Written by Greg Kroah\-Hartman + +and Kay Sievers +. With much help from Dan Stekloff + +and many others. .SH "SEE ALSO" -.BR udevinfo (8), -.BR udevd (8), .PP -.B Web resources: -.nf -.I http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html -.I http://linux\-hotplug.sourceforge.net/ -.fi -.SH AUTHORS -.B udev -was developed by Greg Kroah-Hartman with much help from -Dan Stekloff , Kay Sievers , and -many others. +\fBudev\fR(8), +\fBudevinfo\fR(8), +\fBudevd\fR(8), +\fBudevmonitor\fR(8) diff --git a/udevd.8 b/udevd.8 index 01b90ccfb3..c6efe9a03a 100644 --- a/udevd.8 +++ b/udevd.8 @@ -2,7 +2,7 @@ .\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. -.TH "UDEVD" "8" "August 2005" "udev" "udevd, udevsend, udevcontrol" +.TH "UDEVD" "8" "August 2005" "udev" "udevd, udevcontrol" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -14,8 +14,6 @@ udevd \- event managing daemon \fBudevd\fR [\fB\-\-daemon\fR] .HP 20 \fBudevcontrol \fR\fB\fIcommand\fR\fR -.HP 19 -\fBudevsend \fR\fB\fIsubsystem\fR\fR .SH "DESCRIPTION" .PP udevd listens to kernel uevents and passes the incoming events to udev. It ensures the right event order and takes care, that events for child devices are delayed until the parent has finished the device handling. @@ -25,13 +23,21 @@ udevd listens to kernel uevents and passes the incoming events to udev. It ensur Detach and run in the background. .TP \fBlog_priority=\fR\fB\fIvalue\fR\fR -udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: err, info and debug. +udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: +\fBerr\fR, +\fBinfo\fR +and +\fBdebug\fR. .TP \fBstop_exec_queue\fR udevcontrol stops the execution of events from udevd. .TP \fBstart_exec_queue\fR udevcontrol starts the execution of events from udevd. +.SH "ENVIRONMENT" +.TP +\fBUDEV_LOG\fR +Overrides the syslog priority specified in the config file. .SH "AUTHOR" .PP Written by Kay Sievers -- cgit v1.2.3-54-g00ecf From 0599b4a25fdeffd7eb3acbd4c9783f40fa70f759 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 31 Aug 2005 00:00:22 +0200 Subject: add missing udevsend man page Signed-off-by: Kay Sievers --- docs/udevsend.xml | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ udevsend.8 | 38 +++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 docs/udevsend.xml create mode 100644 udevsend.8 diff --git a/docs/udevsend.xml b/docs/udevsend.xml new file mode 100644 index 0000000000..aa76eea845 --- /dev/null +++ b/docs/udevsend.xml @@ -0,0 +1,90 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevsend + + + udevsend + August 2005 + udev + + + + udevsend + 8 + + + + udevsend + send the current environment to the udev daemon + + + + + udevsend + + + + DESCRIPTION + Usually the udev daemon listens directly to the kernel uevents. + udevsend may be used to pass events for already existing devices from + a userspace application to the daemon. + + + ENVIRONMENT + + + + + add or remove signifies + the addition or the removal of a device. + + + + + + + The sysfs devpath without the mountpoint but a leading slash. + + + + + + + The kernel subsystem the device belongs to. + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev8 + , + + udevd8 + + + +
    +
    diff --git a/udevsend.8 b/udevsend.8 new file mode 100644 index 0000000000..d483f22133 --- /dev/null +++ b/udevsend.8 @@ -0,0 +1,38 @@ +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEVSEND" "8" "August 2005" "udev" "udevsend" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udevsend \- send the current environment to the udev daemon +.SH "SYNOPSIS" +.HP 9 +\fBudevsend\fR +.SH "DESCRIPTION" +.PP +Usually the udev daemon listens directly to the kernel uevents. udevsend may be used to pass events for already existing devices from a userspace application to the daemon. +.SH "ENVIRONMENT" +.TP +\fBACTION\fR +\fIadd\fR +or +\fIremove\fR +signifies the addition or the removal of a device. +.TP +\fBDEVPATH\fR +The sysfs devpath without the mountpoint but a leading slash. +.TP +\fBSUBSYSTEM\fR +The kernel subsystem the device belongs to. +.SH "AUTHOR" +.PP +Written by Kay Sievers +. +.SH "SEE ALSO" +.PP +\fBudev\fR(8), +\fBudevd\fR(8) -- cgit v1.2.3-54-g00ecf From f336ff8003a547f162bfc27ad6fe6417a9035fed Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 31 Aug 2005 00:03:20 +0200 Subject: also forgot udevmonitor.8 Signed-off-by: Kay Sievers --- udevmonitor.8 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 udevmonitor.8 diff --git a/udevmonitor.8 b/udevmonitor.8 new file mode 100644 index 0000000000..6f60130cc7 --- /dev/null +++ b/udevmonitor.8 @@ -0,0 +1,28 @@ +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEVMONITOR" "8" "August 2005" "udev" "udevmonitor" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udevmonitor \- print the kernel and udev event sequence to the console +.SH "SYNOPSIS" +.HP 12 +\fBudevmonitor\fR [\fB\-\-env\fR] +.SH "DESCRIPTION" +.PP +udevmonitor listens to the kernel uevents and events send out by a udev rule and prints the devpath of the event to the console. It can be used analyze to the event timing by comparing the timestamps of the kernel uevent with the udev event. +.SH "OPTIONS" +.TP +\fB\-\-env\fR +Print the complete environment for all events. Can be used to compare the kernel supplied and the udev added environment values. +.SH "AUTHOR" +.PP +Written by Kay Sievers +. +.SH "SEE ALSO" +.PP +\fBudev\fR(8) -- cgit v1.2.3-54-g00ecf From 7b4f33ce60246ad1ba518cf054ec3322ea6f9954 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 31 Aug 2005 02:35:35 +0200 Subject: udevinfo: restore -d option Signed-off-by: Kay Sievers --- udevinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index 6b368fcfe8..b668655f29 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -214,7 +214,7 @@ static void print_help(void) int main(int argc, char *argv[], char *envp[]) { - static const char short_options[] = "aen:p:q:rVh"; + static const char short_options[] = "aden:p:q:rVh"; int option; struct udevice udev; int root = 0; -- cgit v1.2.3-54-g00ecf From 7596a562988b45b62dcac6daac3663524cc8f930 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 31 Aug 2005 23:36:25 +0200 Subject: scsi_id: rename SYSFS to LIBSYSFS Signed-off-by: Kay Sievers --- extras/scsi_id/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 24c1b32128..3c38d6171e 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -31,7 +31,7 @@ INSTALL_DATA = ${INSTALL} -m 644 CFLAGS+=-Wall -fno-builtin PROG=scsi_id -SYSFS=-lsysfs +LIBSYSFS=-lsysfs # # Built static and stripped when built with udev. @@ -76,5 +76,5 @@ spotless: clean $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< $(PROG): $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(SYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(LIBSYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) -- cgit v1.2.3-54-g00ecf From 077ed27c55a9ea661262d7b3ec8be184445ab82e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 6 Sep 2005 12:18:04 +0200 Subject: add edd_id tool to match BIOS EDD disk information Thanks to: John Hull Matt Domsch Signed-off-by: Kay Sievers --- extras/edd_id/Makefile | 50 ++++++++++++ extras/edd_id/edd_id.c | 184 +++++++++++++++++++++++++++++++++++++++++++++ test/simple-build-check.sh | 1 + 3 files changed, 235 insertions(+) create mode 100644 extras/edd_id/Makefile create mode 100644 extras/edd_id/edd_id.c diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile new file mode 100644 index 0000000000..627884a329 --- /dev/null +++ b/extras/edd_id/Makefile @@ -0,0 +1,50 @@ +# Makefile for edd_id +# +# Copyright (C) 2004 Kay Sievers +# +# 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. +# + +PROG = edd_id + +all: $(PROG) + +prefix = +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin +mandir = ${prefix}/usr/share/man +devddir = ${etcdir}/dev.d/default +configdir = ${etcdir}/udev/ +initdir = ${etcdir}/init.d/ +srcdir = . + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +OBJS = $(PROG).o $(LIBUDEV) + +$(OBJS): $(HEADERS) + +.c.o: + $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< + +$(PROG): $(OBJS) $(HEADERS) + $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) + +clean: + rm -f $(PROG) $(OBJS) + +spotless: clean + +install: all + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + +uninstall: + - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c new file mode 100644 index 0000000000..504aac36e6 --- /dev/null +++ b/extras/edd_id/edd_id.c @@ -0,0 +1,184 @@ +/* + * edd_id - naming of BIOS disk devices via EDD + * + * Copyright (C) 2005 John Hull + * Copyright (C) 2005 Kay Sievers + * + * 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. + * + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../logging.h" +#include "../../udev_utils.h" + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +int main(int argc, char *argv[]) +{ + const char *node = NULL; + int i; + int export = 0; + uint32_t disk_id; + uint16_t mbr_valid; + struct dirent *dent; + int disk_fd; + int sysfs_fd; + DIR *dir = NULL; + int rc = 1; + + logging_init("edd_id"); + + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--export") == 0) { + export = 1; + } else + node = arg; + } + if (!node) { + err("no node specified"); + fprintf(stderr, "no node specified\n"); + goto exit; + } + + /* check for kernel support */ + dir = opendir("/sys/firmware/edd"); + if (!dir) { + info("no kernel EDD support"); + fprintf(stderr, "no kernel EDD support\n"); + rc = 2; + goto exit; + } + + disk_fd = open(node, O_RDONLY); + if (disk_fd < 0) { + info("unable to open '%s'", node); + fprintf(stderr, "unable to open '%s'\n", node); + rc = 3; + goto closedir; + } + + /* check for valid MBR signature */ + if (lseek(disk_fd, 510, SEEK_SET) < 0) { + info("seek to MBR validity failed '%s'", node); + rc = 4; + goto close; + } + if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { + info("read MBR validity failed '%s'", node); + rc = 5; + goto close; + } + if (mbr_valid != 0xAA55) { + fprintf(stderr, "no valid MBR signature '%s'\n", node); + info("no valid MBR signature '%s'", node); + rc=6; + goto close; + } + + /* read EDD signature */ + if (lseek(disk_fd, 440, SEEK_SET) < 0) { + info("seek to signature failed '%s'", node); + rc = 7; + goto close; + } + if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { + info("read signature failed '%s'", node); + rc = 8; + goto close; + } + /* all zero is invalid */ + info("read id 0x%08x from '%s'", disk_id, node); + if (disk_id == 0) { + fprintf(stderr, "no EDD signature '%s'\n", node); + info("'%s' signature is zero", node); + rc = 9; + goto close; + } + + /* lookup signature in sysfs to determine the name */ + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char file[PATH_SIZE]; + char sysfs_id_buf[256]; + uint32_t sysfs_id; + ssize_t size; + + if (dent->d_name[0] == '.') + continue; + + snprintf(file, sizeof(file), "/sys/firmware/edd/%s/mbr_signature", dent->d_name); + file[sizeof(file)-1] = '\0'; + + sysfs_fd = open(file, O_RDONLY); + if (sysfs_fd < 0) { + info("unable to open sysfs '%s'", file); + continue; + } + + size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); + close(sysfs_fd); + if (size < 0) { + info("read sysfs '%s' failed", file); + continue; + } + sysfs_id_buf[size] = '\0'; + info("read '%s' from '%s'", sysfs_id_buf, file); + + sysfs_id = strtoul(sysfs_id_buf, NULL, 16); + if (disk_id == sysfs_id) { + if (export) + printf("ID_EDD=%s\n", dent->d_name); + else + printf("%s\n", dent->d_name); + rc = 0; + break; + } + } + +close: + close(disk_fd); +closedir: + closedir(dir); +exit: + logging_close(); + return rc; +} diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index ec18e51a0c..27e5c93d90 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -8,6 +8,7 @@ EXTRAS="\ extras/usb_id \ extras/dasd_id \ extras/cdrom_id \ + extras/edd_id \ extras/floppy \ extras/run_directory \ extras/firmware" -- cgit v1.2.3-54-g00ecf From 3ce0d7b202ecb6896fe2ee5dd7b0c090ca675760 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 6 Sep 2005 20:33:59 +0200 Subject: move and update libsysfs.txt Signed-off-by: Kay Sievers --- docs/libsysfs.txt | 1687 --------------------------------------- etc/udev/suse/udev.rules | 10 +- libsysfs/libsysfs.txt | 1954 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 1962 insertions(+), 1689 deletions(-) delete mode 100644 docs/libsysfs.txt create mode 100644 libsysfs/libsysfs.txt diff --git a/docs/libsysfs.txt b/docs/libsysfs.txt deleted file mode 100644 index 2d68ee4648..0000000000 --- a/docs/libsysfs.txt +++ /dev/null @@ -1,1687 +0,0 @@ - - System Utilities sysfs Library - libsysfs - ========================================= - -Version: 0.4.0 -December 16, 2003 - -Contents --------- -1. Introduction -2. Requirements -3. Definitions -4. Overview -5. Data Structures - 5.1 Directory and Attribute Data Structures - 5.1.1 Attribute Structure - 5.1.2 Link Structure - 5.1.3 Directory Structure - 5.2 Bus Data Structure - 5.3 Class Data Structures - 5.4 Root Device Data Structure - 5.5 Device Data Structure - 5.6 Driver Data Structure -6. Functions - 6.1 Utility Functions - 6.2 Filesystem Functions - 6.2.1 Attribute Functions - 6.2.2 Directory Link Functions - 6.2.3 Directory Functions - 6.3 Bus Functions - 6.4 Class Functions - 6.5 Device Functions - 6.6 Driver Functions -7. Navigating a dlist -8. Usage -9. Conclusion - - -1. Introduction ---------------- - -Libsysfs' purpose is to provide a consistent and stable interface for -querying system device information exposed through the sysfs filesystem. -The library implements functions for querying filesystem information, -such as reading directories and files. It also contains routines for -working with buses, classes, and the device tree. - - -2. Requirements ---------------- - -The library must satisfy the following requirements: - -- It must provide a stable programming interfaces that applications can - be built upon. - -- It must provide functions to retrieve device Vital Product Data (VPD) - information for Error Log Analysis (ELA) support. ELA will provide - device driver and device bus address information. - -- It must provide access to all system devices and information exposed - by sysfs. - -- It must provide a function to find sysfs' current mount point. - -- It must provide a function for udev to retrieve a device's major and - minor numbers. - - -3. Definitions --------------- - -- sysfs: Sysfs is a virtual filesystem in 2.5+ Linux kernels that - presents a hierarchical representation of all system physical and - virtual devices. It presents system devices by bus, by class, and - by topology. Callbacks to device drivers are exposed as files in - device directories. Sysfs, for all purposes, is our tree of system - devices. For more information, please see: - - http://www.kernel.org/pub/linux/kernel/people/mochel/doc/ - -- udev: Udev is Greg Kroah-Hartman's User Space implementation of devfs. - Udev creates /dev nodes for devices upon Hotplug events. The Hotplug - event provides udev with a sysfs directory location of the device. Udev - must use that directory to grab device's major and minor number, which it - will use to create the /dev node. For more information, please see: - - http://www.kernel.org/pub/linux/utils/kernel/hotplug/ - - -4. Overview ------------ - -Libsysfs grew from a common need. There are several applications under -development that need access to sysfs and system devices. Udev, on a -hotplug event, must take a sysfs device path and create a /dev node. Our -diagnostic client needs to list all system devices. Finally, our Error -Log Analysis piece is required to retrieve VPD information for a -failing device. We divided to create a single library interface rather -than having these separate applications create their own accesses to -sysfs involving reading directories and files. - -Libsysfs will also provide stability for applications to be built upon. Sysfs -currently doesn't enforce any standards for callback or file names. File -names change depending on bus or class. Sysfs is also changing, it is -currently being developed. Libsysfs will provide a stable interface to -applications while allowing sysfs to change underneath it. - -Like sysfs, the library will provide devices to applications by bus, by -class, and by topology. The library will function similar to directories -and files that lie underneath it. To query a device on a PCI bus, one would -"open" the bus to scan or read devices and "close" the bus when -completed. Besides supplying functions to retrieve devices, the library -will also provide some utility functions like getting sysfs mount point. - - -5. Data Structures ------------------- - -Libsysfs will classify system devices following sysfs' example, dividing -them by bus, class, and devices. The library presents this information -generically. It doesn't, for example, differentiate between PCI and USB -buses. Device attributes are presented with values as they are exposed -by sysfs, the values are not formatted. - -The library will provide standard definitions for working with sysfs -and devices, here's some examples: - -#define SYSFS_FSTYPE_NAME "sysfs" -#define SYSFS_PROC_MNTS "/proc/mounts" -#define SYSFS_BUS_DIR "/bus" -#define SYSFS_BUS_NAME "bus" -#define SYSFS_CLASS_DIR "/class" -#define SYSFS_CLASS_NAME "class" -#define SYSFS_BLOCK_DIR "/block" -#define SYSFS_BLOCK_NAME "block" -#define SYSFS_DEVICES_DIR "/devices" -#define SYSFS_DEVICES_NAME "devices" -#define SYSFS_DRIVERS_DIR "/drivers" -#define SYSFS_DRIVERS_NAME "drivers" -#define SYSFS_NAME_ATTRIBUTE "name" - -The library uses some definitions to mark maximum size of a sysfs name or -path length: - -#define SYSFS_PATH_MAX 255 -#define SYSFS_NAME_LEN 50 -#define SYSFS_BUS_ID_SIZE 20 - - -NOTE: - As of release 0.4.0 of libsysfs, a number of changes have been made - so that the dlists and "directory" references in all libsysfs's - structures are not populated until such time that it is absolutely - necessary. Hence, these elements may not contain valid data at all - times (as was the case before). - -5.1 Directory and Attribute Data Structures -------------------------------------------- - -The library implements structures to represent sysfs directories, links, -and files. - - -5.1.1 Attribute Structure -------------------------- - -A file in sysfs represents a device or driver attribute. Attributes can be -read only, write only, or read and write. File data can be ASCII and -binary. The library has the following structure to represent files: - -struct sysfs_attribute { - unsigned char *value; - unsigned short len; /* value length */ - unsigned short method; /* show and store */ - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; -}; - -Path represents the file/attribute's full path. Value is used when reading -from or writing to an attribute. "len" is the length of data in "value". -Method is a bitmask for defining if the attribute supports show(read) -and/or store(write). - - -5.1.2 Link Structure --------------------- - -Symbolic links are used in sysfs to link bus or class views with -particular devices. - -struct sysfs_link { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - unsigned char target[SYSFS_PATH_MAX]; -}; - -Link's name is stored in "name' and it's target stored in "target". Absolute -path to the link is stored in "path". - - -5.1.3 Directory Structure -------------------------- - -The directory structure represents a sysfs directory: - -struct sysfs_directory { - struct dlist *subdirs; - struct dlist *links; - struct dlist *attributes; - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; -}; - -The sysfs_directory structure includes the list of subdirectories, links and -attributes. The "name" and absolute "path" are also stored in the structure. -The sysfs_directory structure is intended for use internal to the library. -Applications needing access to attributes and links from the directory -will need to make appropriate calls (described below) to get the same. - - -5.2 Bus Data Structure ----------------------- - -All buses look similar in sysfs including lists of devices and drivers, -therefore we use the following structure to represent all sysfs buses: - -struct sysfs_bus { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* internal use only */ - struct dlist *drivers; - struct dlist *devices; - struct sysfs_directory *directory; -}; - -The sysfs_bus structure contains the bus "name", while the "path" to bus -directory is also stored. It also contains lists of devices on the bus -and drivers that are registered on it. The bus' directory is represented -by the sysfs_directory structure and it contains references to all the -subdirectories, links, and attributes. The sysfs_directory structure -is for internal use only. The following functions may be used by -applications to retrieve data from the sysfs_directory structure: - -struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) -struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, - unsigned char *attrname) - - -5.3 Class Data Structures -------------------------- - -The library uses two data structures to represent classes in sysfs. Sysfs -classes contains a class directory like "net" or "scsi_host" and then -class devices like "eth0", "lo", or "eth1" for the "net" class. - -struct sysfs_class { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; -}; - -The sysfs_class represents device classes in sysfs like "net". It contains -the class "name", "path" to the class, a list of class devices and the -directory representation (for internal use only). - -struct sysfs_class_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char classname[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* for internal use only */ - struct sysfs_class_device *parent; - struct sysfs_device *sysdevice; /* NULL if virtual */ - struct sysfs_driver *driver; /* NULL if not implemented */ - struct sysfs_directory *directory; -}; - -A class device isn't the same as a sysfs_device, it's specific to the class in -which it belongs. The class device structure contains the name of the class -the class device belongs to, its sysfs_device reference and that device's -driver reference (if any). It also contains the name of the class device -- like "eth0", its parent point (if present) and its sysfs directory -information including links and attributes (for internal use only). -The following function may be used by applications to retrieve data -from the sysfs_directory structure: - -struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev); - - -5.4 Root Device Data Structure ------------------------------- - -Device hierarchies in sysfs are represented under the /sys/devices directory -structure. Sysfs devices typically spawn off from base devices which are -represented by a sysfs_root_device. - -struct sysfs_root_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; -}; - -The sysfs_root_device structure contains a list of "devices" that spawn off it. -The name of the root device as represented under /sys/devices is read into -"name" and the absolute path into "path" and its sysfs_directory information -intended to be used internal to the library. - - -5.5 Device Data Structure -------------------------- - -The sysfs_device structure represents a system device that's exposed -in sysfs under the /sys/devices directory structure. - -struct sysfs_device { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char bus_id[SYSFS_NAME_LEN]; - unsigned char bus[SYSFS_NAME_LEN]; - unsigned char driver_name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* for internal use only */ - struct sysfs_device *parent; - struct dlist *children; - struct sysfs_directory *directory; -}; - -The sysfs_device structure contains a "parent" pointer, a list of child -devices, if any, device's directory, its bus id - which is the name of -device's directory, the bus name on which this device is registered and -its driver name. The device structure also contains the absolute path -to the device and a directory structure, which contains a list of the -device's attributes (for internal use only). The following functions -may be used to obtain information from sysfs_directory structure: - -struct sysfs_attribute *sysfs_get_device_attribute(struct sysfs_device *dev, - const unsigned char *name) -struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) - - -5.6 Driver Data Structure -------------------------- - -The sysfs_driver structure represents a device driver. - -struct sysfs_driver { - unsigned char name[SYSFS_NAME_LEN]; - unsigned char path[SYSFS_PATH_MAX]; - - /* for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; -}; - -The sysfs_driver structure contains a list of devices that use this driver, -the name of the driver, its path, and its directory information, which -includes the driver's attributes (for internal use only). The following -function may be used to retrieve driver attribute information from the -sysfs_directory structure: - -struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) - - -6. Functions ------------- - -Libsysfs will provide functions to access system devices by bus, by class, -and by device. Functions will act like accessing directories and files, -using "open" and "close". Open returns a structure and close is used -to clean that structure up. - - -6.1 Utility Functions ---------------------- - -The library will provide a few utility functions for working with sysfs. - -------------------------------------------------------------------------------- -Name: sysfs_get_mnt_path - -Description: Function finds the mount path for filesystem type "sysfs". - -Arguments: unsigned char *mnt_path Mount path buffer - size_t len Size of mount path buffer - -Returns: Zero with success. - -1 with error. Errno will be set with error: - - EINVAL for invalid argument, if buffer is NULL. - -Prototype: sysfs_get_mnt_path(unsigned char *mnt_path, size_t len); -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_name_from_path - -Description: Function returns the last directory or file name from the - included path. - -Arguments: const unsigned char *path Path to parse name from - unsigned char *name Buffer to put parsed name into - size_t *len Size of name buffer - -Returns: 0 with success. - -1 on Error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_get_name_from_path(const unsigned char *path, - unsigned char *name, size_t *len) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_link - -Description: Sysfs readlink function, reads the link at supplied path - and returns its target path. - -Arguments: const unsigned char *path Link's path - unsigned char *target Buffer to place link's target path - size_t len Size of target buffer - -Returns: 0 with success - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_get_link(const unsigned char *path, - unsigned char *target, size_t len) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_subsystem_list - -Description: Function returns the list of entries for the given subsystem. If - the argument is "bus", this function will return a list of buses - ("pci", "scsi", etc) supported on the system. - - sysfs_close_list() has to be called to free the list obtained - from this call. - -Arguments: unsigned char *name Subsystem to open, like "bus".. - -Returns: dlist of entries for the subsystem on success - NULL with error indicating the "name" subsystem is invalid. - -Prototype: struct dlist *sysfs_open_subsystem_list(unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_bus_devices_list - -Description: Function returns the list of devices on the given bus. - - sysfs_close_list() has to be called to free the list obtained - from this call. - -Arguments: unsigned char *name Bus name to open "pci"/"scsi"/"usb".. - -Returns: dlist of device names for the given bus on success - NULL with error indicating the bus is not supported. - -Prototype: struct dlist *sysfs_open_bus_devices_list(unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_list - -Description: Closes a given dlist. This can be used as a generic list close - routine. - -Arguments: struct dlist *list List to be closed - -Prototype: void sysfs_close_list(struct dlist *list) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_path_is_dir - -Description: Utility function to verify if a given path is to a directory. - -Arguments: unsigned char *path Path to verify - -Returns: 0 on success, 1 on error - - EINVAL for invalid arguments - -Prototype: int sysfs_path_is_dir(unsigned char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_path_is_file - -Description: Utility function to verify if a given path is to a file. - -Arguments: unsigned char *path Path to verify - -Returns: 0 on success, 1 on error - - EINVAL for invalid arguments - -Prototype: int sysfs_path_is_file(unsigned char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_path_is_link - -Description: Utility function to verify if a given path is to a link. - -Arguments: unsigned char *path Path to verify - -Returns: 0 on success, 1 on error - - EINVAL for invalid arguments - -Prototype: int sysfs_path_is_link(unsigned char *path) -------------------------------------------------------------------------------- - -6.2 Filesystem Functions ------------------------- - -Libsysfs provides a set of functions to open, read, and close directories -and attributes/files in sysfs. These functions mirror their filesystem -function counterparts. - -6.2.1 Attribute Functions -------------------------- - -Along with the usual open, read, and close functions, libsysfs provides -a couple other functions for accessing attribute values. - -------------------------------------------------------------------------------- -Name: sysfs_open_attribute - -Description: Opens up a file in sysfs and creates a sysfs_attribute - structure. File isn't read with this function. - -Arguments: const unsigned char *path File/Attribute's path - -Returns: struct sysfs_attribute * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_open_attribute - (const unsigned char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_attribute - -Description: Cleans up and closes sysfs_attribute structure. - -Arguments: struct sysfs_attribute *sysattr Attribute to close - -Prototype: void sysfs_close_attribute(struct sysfs_attribute *sysattr) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_dir_attributes - -Description: Reads the given sysfs_directory to create a list of attributes. - -Arguments: struct sysfs_directory *sysdir sysfs_directory whose - attributes to read - -Returns: struct dlist * of attributes on success - NULL with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: struct dlist *sysfs_read_dir_attributes - (struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_refresh_attributes - -Description: Given a list of attributes, this function refreshes the values - of attributes in the list. - -Arguments: struct dlist *attrlist list of attributes to refresh - -Returns: 0 with success. - 1 with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: int sysfs_refresh_attributes(struct dlist *attrlist) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_attribute - -Description: Reads the supplied attribute. Since the maximum transfer - from a sysfs attribute is a pagesize, function reads in - up to a page from the file and stores it in the "value" - field in the attribute. - -Arguments: struct sysfs_attribute *sysattr Attribute to read - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_read_attribute(struct sysfs_attribute *sysattr) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_write_attribute - -Description: Writes to the supplied attribute. Function validates if attribute - is writable, and writes the new value to the attribute. Value to - write as well as its length is user supplied. In case the length - written is not equal to the length requested to be written, the - original value is restored and an error is returned. - -Arguments: struct sysfs_attribute *sysattr Attribute to write to - const unsigned char *new_value New value for the attribute - size_t len Length of "new_value" - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const unsigned char *new_value, size_t len) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_attribute_value - -Description: Given a path to a specific attribute, function reads and - returns its value to the supplied value buffer. - -Arguments: const unsigned char *attrpath Attribute path to read - unsigned char *value Buffer to place attribute's value - size_t vsize Size of buffer - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_read_attribute_value(const unsigned char *attrpath, - unsigned char *value, size_t vsize) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_value_from_attributes - -Description: Function takes a single or linked list of sysfs attribute - structures and returns the value of the specified attribute - name. - -Arguments: struct sysfs_attribute *attr - Attribute list to search through - const unsigned char *name Name of attribute to return value - -Returns: unsigned char * attribute value with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: unsigned char *sysfs_get_value_from_attributes - (struct sysfs_attribute *attr, const unsigned char * name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_directory_attribute - -Description: Function walks the list of attributes for the given sysfs - directory and returns the sysfs_attribute structure for - the specified attribute name. - -Arguments: struct sysfs_directory *dir Directory in which to search - unsigned char *attrname Attribute name to look for - -Returns: struct sysfs_attribute on success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_directory_attribute - (struct sysfs_directory *dir, unsigned char *attrname) -------------------------------------------------------------------------------- - - -6.2.2 Link Functions --------------------- - -Sysfs contains many symbolic links, like bus links to bus devices. Libsysfs -treats links differently than directories due to processing differences. A -link in the /sys/bus/"busname"/devices/ directory indicates a device in the -/sys/devices directory. Through links we give the functionality to know -what is and what isn't a link and the ability to query the links target. - -------------------------------------------------------------------------------- -Name: sysfs_open_link - -Description: Opens a directory link. - -Arguments: const unsigned char *linkpath Path to link - -Returns: struct sysfs_link * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_link *sysfs_open_link - (const unsigned char *linkpath) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_link - -Description: Closes a directory link structure. - -Arguments: struct sysfs_link *ln Link to close - -Prototype: void sysfs_close_link(struct sysfs_link *ln) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_dir_links - -Description: Reads the given sysfs_directory to create a list of links. - -Arguments: struct sysfs_directory *sysdir sysfs_directory whose - links to read - -Returns: struct dlist * of links with success - NULL with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: struct dlist *sysfs_read_dir_links - (struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_directory_link - -Description: Function walks the list of links for the given sysfs directory - and returns the sysfs_link structure for the specified link - name. - -Arguments: struct sysfs_directory *dir Directory in which to search - unsigned char *linkname Link name to look for - -Returns: struct sysfs_link * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_link *sysfs_get_directory_link - (struct sysfs_directory *dir, unsigned char *linkname) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_subdirectory_link - -Description: Function walks the list of links for the given sysfs directory - and its subdirectories returns the sysfs_link structure for - the specified link name. - -Arguments: struct sysfs_directory *dir Directory in which to search - unsigned char *linkname Link name to look for - -Returns: struct sysfs_link * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_link *sysfs_get_subdirectory_link - (struct sysfs_directory *dir, unsigned char *linkname) -------------------------------------------------------------------------------- - - -6.2.3 Directory Functions -------------------------- - -Sysfs directories can represent every directory under sysfs. The structures -keep track of subdirectories, links, and files. Like opendir, readdir, and -closedir, libsysfs provides open, read, and close functions for working with -sysfs directories. Open creates the sysfs_directory structure. Read reads in -its contents - like subdirectories, links, and files. Close cleans it all -up. - -------------------------------------------------------------------------------- -Name: sysfs_open_directory - -Description: Opens a sysfs directory at a specific path - -Arguments: const unsigned char *path Directory path to open - -Returns: struct sysfs_directory * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_directory *sysfs_open_directory - (const unsigned char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_directory - -Description: Closes specific directory, its subdirectories, links, and - files. - -Arguments: struct sysfs_directory *sysdir Directory to close - -Prototype: void sysfs_close_directory(struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_dir_subdirs - -Description: Reads the given sysfs_directory to create a list of subdirs. - -Arguments: struct sysfs_directory *sysdir sysfs_directory whose - subdirs have to be read - -Returns: struct dlist * of links with success - NULL with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: struct dlist *sysfs_read_dir_subdirs - (struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_directory - -Description: Read the supplied directory. Reading fills in the directory's - contents like subdirectories, links, and attributes. - -Arguments: struct sysfs_directory *sysdir Directory to read - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_read_directory(struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_all_subdirs - -Description: Reads all subdirs under a given supplied directory. - -Arguments: struct sysfs_directory *sysdir Directory to read - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_subdirectory - -Description: Function walks the directory tree for the given directory and - returns a sysfs_directory structure for the specified directory - name. - -Arguments: struct sysfs_directory *dir Directory in which to search - unsigned char *subname Name of directory to look for - -Returns: struct sysfs_directory with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments -------------------------------------------------------------------------------- - - -6.3 Bus Functions ------------------ - -The library provides a functions for viewing buses represented in sysfs. -The sysfs_open_bus opens a bus in the /sys/bus directory, such as "pci", -"usb", or "scsi". The open command returns a sysfs_bus structure that -contains a list of the bus' devices. The sysfs_close_bus function is -used to clean up the bus structure. Given a device or a driver, -functions are provided to determine what bus they are on. - -------------------------------------------------------------------------------- -Name: sysfs_open_bus - -Description: Function opens up one of the buses represented in sysfs in - the /sys/bus directory. It returns a sysfs_bus structure - that includes a list of bus devices and drivers. - -Arguments: const unsigned char *name Bus name to open, like "pci"... - -Returns: struct sysfs_bus * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_bus *sysfs_open_bus(const unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_bus - -Description: Function closes up the sysfs_bus structure including its - devices, drivers, and directory. - -Arguments: sysfs_bus *bus Bus structure to close - -Prototype: void sysfs_close_bus(struct sysfs_bus *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_devices - -Description: Function returns a list of devices that are registered with - this bus. - -Arguments: struct sysfs_bus *bus Bus whose devices list to return - -Returns: struct dlist * of sysfs_devices on success - NULL with error. Errno will be sent with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_drivers - -Description: Function returns a list of drivers that are registered with - this bus. - -Arguments: struct sysfs_bus *bus Bus whose drivers list to return - -Returns: struct dlist * of sysfs_drivers on success - NULL with error. Errno will be sent with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_device - -Description: Function takes a sysfs_bus structure(obtained on a successful - return from a sysfs_open_bus() call) and looks for the given - device on this bus. On success, it returns a sysfs_device - structure corresponding to the device. - -Arguments: struct sysfs_bus *bus Bus structure on which to search - unsigned char *id Device to look for - -Returns: struct sysfs_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_get_bus_device - (struct sysfs_bus *bus, unsigned char *id) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_driver - -Description: Function takes a sysfs_bus structure (obtained on a successful - return from a sysfs_open_bus() call) and looks for the given - driver on this bus. On success, it returns a sysfs_driver - structure corresponding to the driver. - -Arguments: struct sysfs_bus *bus Bus structure on which to search - unsigned char *drvname Driver to look for - -Returns: struct sysfs_driver * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_get_bus_driver - (struct sysfs_bus *bus, unsigned char *drvname) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_attributes - -Description: Function takes a sysfs_bus structure and returns a list of - attributes for the bus. - -Arguments: struct sysfs_bus *bus Bus for which attributes are required - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_attribute - -Description: Function takes a sysfs_bus structure and looks for the required - attribute on the bus. On success, it returns a sysfs_attribute - structure corresponding to the given attribute. - -Arguments: struct sysfs_bus *bus Bus structure on which to search - unsigned char *attrname Attribute to look for - -Returns: struct sysfs_attribute * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_bus_attribute - (struct sysfs_bus *bus, unsigned char *attrname) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_bus_device - -Description: Given the name of the bus on which to look for, this function - locates a given device on the bus and returns a sysfs_device - structure corresponding to the requested device. - - NOTE: - 1. The sysfs_device structure obtained upon successful return - from this function has to be closed by calling - sysfs_close_device(). - -Arguments: unsigned char *busname Bus on which to search - unsigned char *dev_id Name of the device to look for - -Returns: struct sysfs_device * on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_open_bus_device - (unsigned char *busname, unsigned char *dev_id) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_find_driver_bus - -Description: Given the name of a driver, this function finds the name of the - bus the driver is on - -Arguments: const unsigned char *driver Name of the driver to look for - unsigned char *busname Buffer to return the bus name - size_t bsize Size of the "busname" buffer - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_find_driver_bus(const unsigned char *driver, - unsigned char *busname, size_t bsize) -------------------------------------------------------------------------------- - - -6.4 Class Functions -------------------- - -Libsysfs provides functions to open sysfs classes and their class devices. -These functions too operate with open and close, close must be called to -clean up the class structures. Given a class device name, functions are -provided to determine what class they belong to. Once a class device -name and the class it belongs to is known, a function to open the -class device is provided. This method can be used when details of -a single class device is required. - -------------------------------------------------------------------------------- -Name: sysfs_open_class - -Description: Function opens up one of the classes represented in sysfs in - the /sys/class directory. It returns a sysfs_class structure - that includes a list of class devices. - -Arguments: const unsigned char *name Class name to open, like "net".. - -Returns: struct sysfs_class * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class *sysfs_open_class(const unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_class - -Description: Function closes up the sysfs_class structure including its - class devices. - -Arguments: sysfs_class *class Class structure to close - -Prototype: void sysfs_close_class(struct sysfs_class *class); -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_class_device_path - -Description: Function opens up one of the class devices represented in - sysfs in sysfs/class/"class"/ directory. It returns a - sysfs_class_device structure. - -Arguments: const unsigned char *path Path to class device - -Returns: struct sysfs_class_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class_device *sysfs_open_class_device_path - (const unsigned char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_class_device - -Description: Function closes up the sysfs_class_device structure. - -Arguments: sysfs_class_device *dev Class device structure to close - -Prototype: void sysfs_close_class_device(struct sysfs_class_device *dev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_class_device - -Description: Function takes a sysfs_class structure(obtained on a successful - return from a sysfs_open_class() call) and looks for the given - device in this class. On success, it returns a sysfs_class_device - structure corresponding to the class device. - -Arguments: struct sysfs_class *class Class on which to search - unsigned_char *name Class device "name" to look for - -Returns: struct sysfs_class_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class_device *sysfs_get_class_device - (struct sysfs_class *class, unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_class_devices - -Description: Function returns a list of class devices for the given class. - -Arguments: struct sysfs_class *cls Class whose class device list - is required - -Returns: struct dlist * of sysfs_class_devices on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_class_device - -Description: Given the name of the class on which to look for, this function - locates a given class device and returns a sysfs_class_device - structure corresponding to the requested class device. - - NOTE: - 1. The sysfs_class_device structure obtained upon successful - return from this function has to be closed by calling - sysfs_close_class_device(). - 2. Class this device belongs to must be known prior to calling - this function. - -Arguments: const unsigned char *classname Class on which to search - unsigned char *name Class device "name" to open - -Returns: struct sysfs_class_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class_device *sysfs_open_class_device - (const unsigned char *classname, unsigned char *class) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_device - -Description: Function returns the sysfs_device reference (if present) for the - given class device. - -Arguments: struct sysfs_class_device *clsdev Class device whose - sysfs_device reference - is required - -Returns: struct sysfs_device * on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_get_classdev_device - (struct sysfs_class_device *clsdev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_driver - -Description: Function returns the sysfs_driver reference (if present) for the - given class device. - -Arguments: struct sysfs_class_device *clsdev Class device whose - sysfs_driver reference - is required - -Returns: struct sysfs_driver * on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_driver *sysfs_get_classdev_driver - (struct sysfs_class_device *clsdev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_parent - -Description: Function returns the sysfs_class_device reference for the parent - (if present) of the given class device. - -Arguments: struct sysfs_class_device *clsdev Class device whose - parent reference - is required - -Returns: struct sysfs_class_device * on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class_device *sysfs_get_classdev_parent - (struct sysfs_class_device *clsdev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_attributes - -Description: Function takes a sysfs_class_device structure and returns a list - of attributes for the class device. - -Arguments: struct sysfs_class_device *cdev Class device for which - attributes are required - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_classdev_attributes - (struct sysfs_class_device *cdev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_attr - -Description: Searches supplied class device's attributes by name and returns - the attribute. - -Arguments: struct sysfs_class_device *clsdev Device to search - const unsigned char *name Attribute name to find - -Returns: struct sysfs_attribute * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_classdev_attr - (struct sysfs_class_device *clsdev, const unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_classdev_attr - -Description: Function takes as arguments, a the name of the class, the class - device name and the name of the required attribute. - - NOTE: - 1. The struct sysfs_attribute * obtained upon successful - return from this function has to be closed by making - a call to sysfs_close_attribute() - -Arguments: unsigned char *classname Class name on which to search - unsigned char *dev Name of the class device - unsigned char *attrib Attribute to open - -Returns: struct sysfs_attribute * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_write_classdev_attr - (const unsigned char *classname, const unsigned char *dev, - const unsigned char *attrib) -------------------------------------------------------------------------------- - - -6.5 Device Functions --------------------- - -Devices represent everything in sysfs under /sys/devices, which is a -hierarchical view of system devices. Besides the expected open and -close functions, libsysfs provides open and close functions for -root devices. These functions recursively open or close a device -and all of its children. - -------------------------------------------------------------------------------- -Name: sysfs_open_device_path - -Description: Opens up a device at a specific path. It opens the device's - directory, reads the directory, and returns a sysfs_device - structure. - -Arguments: const unsigned char *path Path to device - -Returns: struct sysfs_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_open_device_path - (const unsigned char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_device - -Description: Function closes up the sysfs_device structure. - -Arguments: sysfs_device *dev Device structure to close - -Prototype: void sysfs_close_device(struct sysfs_device *dev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_root_device - -Description: Function opens up one of the root devices represented in sysfs - in the /sys/devices directory. It returns a sysfs_root_device - structure that includes a list of devices in the tree. - -Arguments: const unsigned char *name Name of the root device to open - -Returns: struct sysfs_root_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_open_root_device - (const unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_root_device - -Description: Function closes up the sysfs_root_device structure including the - devices in the root device tree. - -Arguments: sysfs_device *root Root device structure to close - -Prototype: void sysfs_close_root_device(struct sysfs_root_device *root) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_device_parent - -Description: Function returns the sysfs_device reference for the parent - (if present) of the given sysfs_device. - -Arguments: struct sysfs_device *dev sysfs_device whose parent - reference is required - -Returns: struct sysfs_device * on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_get_device_parent - (struct sysfs_device *dev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_root_devices - -Description: Function returns a list of devices under the given root device. - -Arguments: struct sysfs_root_device *root sysfs_root_device whose devices - list is required - -Returns: struct dlist * of sysfs_devices on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_root_devices - (struct sysfs_root_device *root) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_device_attr - -Description: Searches supplied device's attributes by name and returns - the attribute. - -Arguments: struct sysfs_device *dev Device to search - const unsigned char *name Attribute name to find - -Returns: struct sysfs_attribute * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_device_attr - (struct sysfs_device *dev, const unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_device_attributes - -Description: Function takes a sysfs_device structure and returns a list - of attributes for the device. - -Arguments: struct sysfs_device *device Device for which - attributes are required - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_device_attributes - (struct sysfs_device *device) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_device - -Description: Given the name of the bus on which to look for, this function - locates a given device and returns a sysfs_device structure - corresponding to the requested device. - -Arguments: const unsigned char *bus_id Device to look for - const unsigned char *bus Bus on which to search - -Returns: struct sysfs_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_open_device - (const unsigned char *bus_id, const unsigned char *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_device_attr - -Description: Function takes as arguments, the bus on which to search for a - device, and an attribute of the device to open. - - NOTE: - 1. The struct sysfs_attribute * obtained upon successful - return from this function has to be closed by making - a call to sysfs_close_attribute() - -Arguments: unsigned char *bus Bus on which to search - unsigned char *bus_id Device to look for - unsigned char *attrib Name of the attribute to open - -Returns: struct sysfs_attribute * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_open_device_attr - (const unsigned char *bus, const unsigned char *bus_id, - const unsigned char *attrib) -------------------------------------------------------------------------------- - - -6.6 Driver Functions --------------------- - -Drivers are represented in sysfs under the /sys/bus/xxx/drivers (xxx being -the bus type, such as "pci", "usb, and so on). Functions are provided to -open and close drivers. - -------------------------------------------------------------------------------- -Name: sysfs_open_driver_path - -Description: Opens driver at specific path. - -Arguments: const unsigned char *path Path to driver - -Returns: struct sysfs_driver * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_driver *sysfs_open_driver_path - (const unsigned char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_driver - -Description: Closes and cleans up sysfs_driver structure. - -Arguments: sysfs_driver *driver Driver structure to close - -Prototype: void sysfs_close_driver(struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_devices - -Description: Function returns a list of devices that use this driver. - -Arguments: struct sysfs_driver *driver Driver whose devices list is - required - -Returns: struct dlist * of sysfs_devices on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_driver_devices - (struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_device - -Description: Function returns a sysfs_device reference for the device with - "name" that uses this driver - -Arguments: struct sysfs_driver *driver Driver on which to search - const unsigned char *name Name of the device to look for - -Returns: struct sysfs_device * corresponding to "name" on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_driver_device - (struct sysfs_driver *driver, const unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_attr - -Description: Searches supplied driver's attributes by name and returns - the attribute. - -Arguments: struct sysfs_driver *drv Driver to search - const unsigned char *name Attribute name to find - -Returns: struct sysfs_attribute * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_driver_attr - (struct sysfs_driver *drv, const unsigned char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_attributes - -Description: Function takes a sysfs_driver structure and returns a list - of attributes for the driver. - -Arguments: struct sysfs_driver *driver Driver for which - attributes are required - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_driver_attributes - (struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_driver - -Description: Given the name of the bus on which to look for, this function - locates a given driver and returns a sysfs_driver structure - corresponding to the requested device. - - NOTE: - 1. The sysfs_driver structure obtained upon successful return - from this function has to be closed by calling - sysfs_close_driver_by_name(). - 2. Bus on which to look for this driver should be known prior - to calling this function. Use sysfs_find_driver_bus() - to determine this. - -Arguments: const unsigned char *drv_name Driver to look for - const unsigned char *bus Bus on which to search - size_t bsize Size of "bus" - -Returns: struct sysfs_driver * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_driver *sysfs_open_driver - (const unsigned char *drv_name, - const unsigned char *bus, size_t bsize) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_links - -Description: Function returns a list of links for a given driver - -Arguments: struct sysfs_driver *driver Driver to get links from - -Returns: struct dlist * of links on success - NULL with error - -Prototype: struct dlist *sysfs_get_driver_links - (struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_driver_attr - -Description: Function takes as arguments, the bus the driver is registered - on, the driver name and the name of the attribute to open. - - NOTE: - 1. The struct sysfs_attribute * obtained upon successful - return from this function has to be closed by making - a call to sysfs_close_attribute() - -Arguments: unsigned char *bus Bus on which driver is present - unsigned char *drv Driver to look for - unsigned char *attrib Name of the attribute to open - -Returns: struct sysfs_attribute * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_open_driver_attr - (const unsigned char *bus, const unsigned char *drv, - const unsigned char *attrib) -------------------------------------------------------------------------------- - - -7. Navigating a dlist ---------------------- - -Libsysfs uses (yet another) list implementation thanks to Eric J Bohm. - -Some library functions return a dlist of devices/drivers/attributes, etc. -To navigate the list returned the macro "dlist_for_each_data" is to be used. - ------------------------------------------------------------------------------- -Function/Macro name: dlist_for_each_data - -Description: Walk the given list, returning a known data type/ - structure in each iteration. - -Arguments: struct dlist *list List pointer - data_iterator Data type/structure variable - contained in the list - datatype Data type/structure contained - in the list - -Returns: On each iteration, "data_iterator" will contain a list - element of "datatype" - -Usage example: The function sysfs_get_classdev_attributes() returns a - dlist of attributes. To navigate the list: - - struct sysfs_attribute *attr = NULL; - struct dlist *attrlist = NULL; - . - . - . - attrlist = sysfs_get_classdev_attributes - (struct sysfs_class_device *cdev) - if (attrlist != NULL) { - dlist_for_each_data(attrlist, attr, - struct sysfs_attribute) { - . - . - . - } - } -------------------------------------------------------------------------------- - - -8. Usage --------- - -Accessing devices through libsysfs is supposed to mirror accessing devices -in the filesystem it represents. Here's a typical order of operation: - - - get sysfs mount point - - "open" sysfs category, ie. bus, class, or device - - work with category - - "close" sysfs category - - -9. Conclusion -------------- - -Libsysfs is meant to provide a stable application programming interface to -sysfs. Applications can depend upon the library to access system devices -and functions exposed through sysfs. diff --git a/etc/udev/suse/udev.rules b/etc/udev/suse/udev.rules index 1ed2c6cd50..51d182a307 100644 --- a/etc/udev/suse/udev.rules +++ b/etc/udev/suse/udev.rules @@ -50,6 +50,10 @@ SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startp SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" +# Kino jogshuttle support +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="b33/10/*", RUN+="/usr/bin/killall --quiet -USR2 kino" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="5f3/240/*", RUN+="/usr/bin/killall --quiet -USR2 kino" + # input devices KERNEL=="mice", NAME="input/%k", MODE="0640" KERNEL=="mouse*", NAME="input/%k", MODE="0640" @@ -57,9 +61,8 @@ KERNEL=="event*", NAME="input/%k", MODE="0640" KERNEL=="js*", NAME="input/%k", MODE="0644" KERNEL=="ts*", NAME="input/%k", MODE="0600" KERNEL=="uinput", NAME="input/%k", MODE="0600" -KERNEL=="event*", PROGRAM="/sbin/udev.get_input_lirc.sh %k", RESULT="*IR*", NAME="input/%k", SYMLINK+="input/ir" KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" -SUBSYSTEM=="input_device", RUN+="/etc/hotplug.d/input_device/50-input_device.hotplug" +SUBSYSTEM=="input_device", RUN+="/sbin/udev.input_device.sh" # printer SUBSYSTEM=="usb", KERNEL=="lp*", ACTION=="add", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" @@ -208,6 +211,8 @@ ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="persistent_end" +SUBSYSTEM=="block", KERNEL=="sd*[0-9]|hd*[0-9]", ACTION=="add", RUN+="/sbin/udev.mount.sh" + # network devices KERNEL=="tun", NAME="net/%k", MODE="0600" SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug" @@ -222,6 +227,7 @@ SUBSYSTEM=="firmware", ACTION=="add", RUN+="/sbin/udev.firmware.sh" # SUSE system integration SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" +SUBSYSTEM=="macio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-/sys%p -o hotplug" LABEL="after_usb_default" SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-/sys%p -o hotplug" diff --git a/libsysfs/libsysfs.txt b/libsysfs/libsysfs.txt new file mode 100644 index 0000000000..b877cb8030 --- /dev/null +++ b/libsysfs/libsysfs.txt @@ -0,0 +1,1954 @@ + + System Utilities sysfs Library - libsysfs + ========================================= + +Version: 1.2.0 +September 13, 2004 + +Contents +-------- +1. Introduction +2. Requirements +3. Definitions +4. Overview +5. Data Structures + 5.1 Directory and Attribute Data Structures + 5.1.1 Attribute Structure + 5.1.2 Link Structure + 5.1.3 Directory Structure + 5.2 Bus Data Structure + 5.3 Class Data Structures + 5.4 Root Device Data Structure + 5.5 Device Data Structure + 5.6 Driver Data Structure +6. Functions + 6.1 Calling Conventions in Libsysfs + 6.2 Utility Functions + 6.3 Filesystem Functions + 6.3.1 Attribute Functions + 6.3.2 Directory Link Functions + 6.3.3 Directory Functions + 6.4 Bus Functions + 6.5 Class Functions + 6.6 Device Functions + 6.7 Driver Functions +7. Dlists + 7.1 Navigating a dlist + 7.2 Custom sorting using dlist_sort_custom() +8. Usage +9. Testsuite +10. Conclusion + + +1. Introduction +--------------- + +Libsysfs' purpose is to provide a consistent and stable interface for +querying system device information exposed through the sysfs filesystem. +The library implements functions for querying filesystem information, +such as reading directories and files. It also contains routines for +working with buses, classes, and the device tree. + + +2. Requirements +--------------- + +The library must satisfy the following requirements: + +- It must provide a stable programming interfaces that applications can + be built upon. + +- It must provide functions to retrieve device Vital Product Data (VPD) + information for Error Log Analysis (ELA) support. ELA will provide + device driver and device bus address information. + +- It must provide access to all system devices and information exposed + by sysfs. + +- It must provide a function to find sysfs' current mount point. + +- It must provide a function for udev to retrieve a device's major and + minor numbers. + + +3. Definitions +-------------- + +- sysfs: Sysfs is a virtual filesystem in 2.5+ Linux kernels that + presents a hierarchical representation of all system physical and + virtual devices. It presents system devices by bus, by class, and + by topology. Callbacks to device drivers are exposed as files in + device directories. Sysfs, for all purposes, is our tree of system + devices. For more information, please see: + + http://www.kernel.org/pub/linux/kernel/people/mochel/doc/ + +- udev: Udev is Greg Kroah-Hartman's User Space implementation of devfs. + Udev creates /dev nodes for devices upon Hotplug events. The Hotplug + event provides udev with a sysfs directory location of the device. Udev + must use that directory to grab device's major and minor number, which it + will use to create the /dev node. For more information, please see: + + http://www.kernel.org/pub/linux/utils/kernel/hotplug/ + + Udev provides persistent device naming based on a set of user specified + rules. The rules a device name is based on could one or a combination of a + number of parameters such as the bus the device is on, the serial number + of the device (in case of USB), the vendor name (in case of SCSI) and so + on. Udev uses Libsysfs to retrieve relevent information to appropriately + name devices. + + +4. Overview +----------- + +Libsysfs grew from a common need. There are several applications under +development that need access to sysfs and system devices. Udev, on a +hotplug event, must take a sysfs device path and create a /dev node. Our +diagnostic client needs to list all system devices. Finally, our Error +Log Analysis piece is required to retrieve VPD information for a +failing device. We divided to create a single library interface rather +than having these separate applications create their own accesses to +sysfs involving reading directories and files. + +Libsysfs will also provide stability for applications to be built upon. Sysfs +currently doesn't enforce any standards for callback or file names. File +names change depending on bus or class. Sysfs is also changing, it is +currently being developed. Libsysfs will provide a stable interface to +applications while allowing sysfs to change underneath it. + +Like sysfs, the library will provide devices to applications by bus, by +class, and by topology. The library will function similar to directories +and files that lie underneath it. To query a device on a PCI bus, one would +"open" the bus to scan or read devices and "close" the bus when +completed. Besides supplying functions to retrieve devices, the library +will also provide some utility functions like getting sysfs mount point. + +A paper on Libsysfs was presented at Linux.Conf.Au 2004 (Adelaide, January +2004). The paper is available online at: + +http://oss.software.ibm.com/linux/papers/libsysfs/libsysfs-linuxconfau2004.pdf + + +5. Data Structures +------------------ + +Libsysfs will classify system devices following sysfs' example, dividing +them by bus, class, and devices. The library presents this information +generically. It doesn't, for example, differentiate between PCI and USB +buses. Device attributes are presented with values as they are exposed +by sysfs, the values are not formatted. + +The library will provide standard definitions for working with sysfs +and devices, here's some examples: + +#define SYSFS_FSTYPE_NAME "sysfs" +#define SYSFS_PROC_MNTS "/proc/mounts" +#define SYSFS_BUS_NAME "bus" +#define SYSFS_CLASS_NAME "class" +#define SYSFS_BLOCK_NAME "block" +#define SYSFS_DEVICES_NAME "devices" +#define SYSFS_DRIVERS_NAME "drivers" +#define SYSFS_NAME_ATTRIBUTE "name" + +The library uses some definitions to mark maximum size of a sysfs name or +path length: + +#define SYSFS_PATH_MAX 255 +#define SYSFS_NAME_LEN 50 +#define SYSFS_BUS_ID_SIZE 20 + + +NOTE: + a. As of release 0.4.0 of sysfsutils, a number of changes have been + made so that the dlists and "directory" references in all libsysfs's + structures are not populated until such time that it is absolutely + necessary. Hence, these elements may not contain valid data at all + times (as was the case before). + b. As of release 1.0.0 of sysfsutils, all dlists in the library are + sorted in alphabetical order. It is now a requirement that the + "name" and "path" be the first two elements of all libsysfs + structures. + + +5.1 Directory and Attribute Data Structures +------------------------------------------- + +The library implements structures to represent sysfs directories, links, +and files. + + +5.1.1 Attribute Structure +------------------------- + +A file in sysfs represents a device or driver attribute. Attributes can be +read only, write only, or read and write. File data can be ASCII and +binary. The library has the following structure to represent files: + +struct sysfs_attribute { + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + char *value; + unsigned short len; /* value length */ + unsigned short method; /* show and store */ +}; + +Path represents the file/attribute's full path. Value is used when reading +from or writing to an attribute. "len" is the length of data in "value". +Method is a bitmask for defining if the attribute supports show(read) +and/or store(write). + + +5.1.2 Link Structure +-------------------- + +Symbolic links are used in sysfs to link bus or class views with +particular devices. + +struct sysfs_link { + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + char target[SYSFS_PATH_MAX]; +}; + +Link's name is stored in "name' and it's target stored in "target". Absolute +path to the link is stored in "path". + + +5.1.3 Directory Structure +------------------------- + +The directory structure represents a sysfs directory: + +struct sysfs_directory { + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *subdirs; + struct dlist *links; + struct dlist *attributes; +}; + +The sysfs_directory structure includes the list of subdirectories, links and +attributes. The "name" and absolute "path" are also stored in the structure. +The sysfs_directory structure is intended for use internal to the library. +Applications needing access to attributes and links from the directory +will need to make appropriate calls (described below) to get the same. + + +5.2 Bus Data Structure +---------------------- + +All buses look similar in sysfs including lists of devices and drivers, +therefore we use the following structure to represent all sysfs buses: + +struct sysfs_bus { + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *drivers; + struct dlist *devices; + struct sysfs_directory *directory; +}; + +The sysfs_bus structure contains the bus "name", while the "path" to bus +directory is also stored. It also contains lists of devices on the bus +and drivers that are registered on it. The bus' directory is represented +by the sysfs_directory structure and it contains references to all the +subdirectories, links, and attributes. The sysfs_directory structure +is for internal use only. The following functions may be used by +applications to retrieve data from the sysfs_directory structure: + +struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) +struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, + char *attrname) + + +5.3 Class Data Structures +------------------------- + +The library uses two data structures to represent classes in sysfs. Sysfs +classes contains a class directory like "net" or "scsi_host" and then +class devices like "eth0", "lo", or "eth1" for the "net" class. + +struct sysfs_class { + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *devices; + struct sysfs_directory *directory; +}; + +The sysfs_class represents device classes in sysfs like "net". It contains +the class "name", "path" to the class, a list of class devices and the +directory representation (for internal use only). + +struct sysfs_class_device { + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + char classname[SYSFS_NAME_LEN]; + + /* Private: for internal use only */ + struct sysfs_class_device *parent; + struct sysfs_device *sysdevice; /* NULL if virtual */ + struct sysfs_driver *driver; /* NULL if not implemented */ + struct sysfs_directory *directory; +}; + +A class device isn't the same as a sysfs_device, it's specific to the class in +which it belongs. The class device structure contains the name of the class +the class device belongs to, its sysfs_device reference and that device's +driver reference (if any). It also contains the name of the class device +- like "eth0", its parent point (if present) and its sysfs directory +information including links and attributes (for internal use only). +The following function may be used by applications to retrieve data +from the sysfs_directory structure: + +struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev); + + +5.4 Root Device Data Structure +------------------------------ + +Device hierarchies in sysfs are represented under the /sys/devices directory +structure. Sysfs devices typically spawn off from base devices which are +represented by a sysfs_root_device. + +struct sysfs_root_device { + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *devices; + struct sysfs_directory *directory; +}; + +The sysfs_root_device structure contains a list of "devices" that spawn off it. +The name of the root device as represented under /sys/devices is read into +"name" and the absolute path into "path" and its sysfs_directory information +intended to be used internal to the library. + + +5.5 Device Data Structure +------------------------- + +The sysfs_device structure represents a system device that's exposed +in sysfs under the /sys/devices directory structure. + +struct sysfs_device { + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + char bus_id[SYSFS_NAME_LEN]; + char bus[SYSFS_NAME_LEN]; + char driver_name[SYSFS_NAME_LEN]; + + /* Private: for internal use only */ + struct sysfs_device *parent; + struct dlist *children; + struct sysfs_directory *directory; +}; + +The sysfs_device structure contains a "parent" pointer, a list of child +devices, if any, device's directory, its bus id - which is the name of +device's directory, the bus name on which this device is registered and +its driver name. The device structure also contains the absolute path +to the device and a directory structure, which contains a list of the +device's attributes (for internal use only). The following functions +may be used to obtain information from sysfs_directory structure: + +struct sysfs_attribute *sysfs_get_device_attribute(struct sysfs_device *dev, + const char *name) +struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) + + +5.6 Driver Data Structure +------------------------- + +The sysfs_driver structure represents a device driver. + +struct sysfs_driver { + char name[SYSFS_NAME_LEN]; + char path[SYSFS_PATH_MAX]; + + /* Private: for internal use only */ + struct dlist *devices; + struct sysfs_directory *directory; +}; + +The sysfs_driver structure contains a list of devices that use this driver, +the name of the driver, its path, and its directory information, which +includes the driver's attributes (for internal use only). The following +function may be used to retrieve driver attribute information from the +sysfs_directory structure: + +struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) + + +6. Functions +------------ + +Libsysfs will provide functions to access system devices by bus, by class, +and by device. Functions will act like accessing directories and files, +using "open" and "close". Open returns a structure and close is used +to clean that structure up. + + +6.1 Calling Conventions in Libsysfs +----------------------------------- + +Libsysfs uses a simple API calling convention. APIs are classified to be +one of "open", "get", "close" types. The convention is as follows: + + a. All "open" APIs have a corresponding "close" API. + b. References obtained using "get" calls should not be closed + explicitly. + c. All "opened" references have to be closed with a call to + their corresponding "close" call. This takes care of + freeing structure references obtained with "get" calls. + + +6.2 Utility Functions +--------------------- + +The library will provide a few utility functions for working with sysfs. + +------------------------------------------------------------------------------- +Name: sysfs_get_mnt_path + +Description: Function finds the mount path for filesystem type "sysfs". + +Arguments: char *mnt_path Mount path buffer + size_t len Size of mount path buffer + +Returns: Zero with success. + -1 with error. Errno will be set with error: + - EINVAL for invalid argument, if buffer is NULL or + if len is zero + +Prototype: sysfs_get_mnt_path(char *mnt_path, size_t len); +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_name_from_path + +Description: Function returns the last directory or file name from the + included path. + +Arguments: const char *path Path to parse name from + char *name Buffer to put parsed name into + size_t *len Size of name buffer + +Returns: 0 with success. + -1 on Error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_get_name_from_path(const char *path, + char *name, size_t *len) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_link + +Description: Sysfs readlink function, reads the link at supplied path + and returns its target path. + +Arguments: const char *path Link's path + char *target Buffer to place link's target + size_t len Size of target buffer + +Returns: 0 with success + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_get_link(const char *path, char *target, size_t len) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_subsystem_list + +Description: Function returns the list of entries for the given subsystem. If + the argument is "bus", this function will return a list of buses + ("pci", "scsi", etc) supported on the system. + + sysfs_close_list() has to be called to free the list obtained + from this call. + +Arguments: char *name Subsystem to open, like "bus".. + +Returns: dlist of entries for the subsystem on success + NULL with error indicating the "name" subsystem is invalid. + +Prototype: struct dlist *sysfs_open_subsystem_list(char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_bus_devices_list + +Description: Function returns the list of devices on the given bus. + + sysfs_close_list() has to be called to free the list obtained + from this call. + +Arguments: char *name Bus name to open "pci"/"scsi"/"usb".. + +Returns: dlist of device names for the given bus on success + NULL with error indicating the bus is not supported. + +Prototype: struct dlist *sysfs_open_bus_devices_list(char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_list + +Description: Closes a given dlist. This can be used as a generic list close + routine. + +Arguments: struct dlist *list List to be closed + +Prototype: void sysfs_close_list(struct dlist *list) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_path_is_dir + +Description: Utility function to verify if a given path is to a directory. + +Arguments: const char *path Path to verify + +Returns: 0 on success, 1 on error + - EINVAL for invalid arguments + +Prototype: int sysfs_path_is_dir(const char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_path_is_file + +Description: Utility function to verify if a given path is to a file. + +Arguments: const char *path Path to verify + +Returns: 0 on success, 1 on error + - EINVAL for invalid arguments + +Prototype: int sysfs_path_is_file(const char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_path_is_link + +Description: Utility function to verify if a given path is to a link. + +Arguments: const char *path Path to verify + +Returns: 0 on success, 1 on error + - EINVAL for invalid arguments + +Prototype: int sysfs_path_is_link(const char *path) +------------------------------------------------------------------------------- + + +6.3 Filesystem Functions +------------------------ + +Libsysfs provides a set of functions to open, read, and close directories +and attributes/files in sysfs. These functions mirror their filesystem +function counterparts. + + +6.3.1 Attribute Functions +------------------------- + +Along with the usual open, read, and close functions, libsysfs provides +a couple other functions for accessing attribute values. + +------------------------------------------------------------------------------- +Name: sysfs_open_attribute + +Description: Opens up a file in sysfs and creates a sysfs_attribute + structure. File isn't read with this function. + +Arguments: const char *path File/Attribute's path + +Returns: struct sysfs_attribute * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_open_attribute(const char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_attribute + +Description: Cleans up and closes sysfs_attribute structure. + +Arguments: struct sysfs_attribute *sysattr Attribute to close + +Prototype: void sysfs_close_attribute(struct sysfs_attribute *sysattr) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_dir_attributes + +Description: Reads the given sysfs_directory to create a list of attributes. + +Arguments: struct sysfs_directory *sysdir sysfs_directory whose + attributes to read + +Returns: struct dlist * of attributes on success + NULL with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: struct dlist *sysfs_read_dir_attributes + (struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_refresh_dir_attributes + +Description: Given a list sysfs_directory, this function refreshes the list + of attributes for the given directory. + +Arguments: struct sysfs_directory *sysdir sysfs_ directory whose + attributes list to refresh + +Returns: 0 with success. + 1 with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_dir_attributes + +Description: Returns a list of attributes for the given sysfs_directory. + +Arguments: struct sysfs_directory *sysdir sysfs_directory whose + attributes list to return + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: struct dlist *sysfs_read_dir_attributes + (struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_attribute + +Description: Reads the supplied attribute. Since the maximum transfer + from a sysfs attribute is a pagesize, function reads in + up to a page from the file and stores it in the "value" + field in the attribute. + +Arguments: struct sysfs_attribute *sysattr Attribute to read + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_read_attribute(struct sysfs_attribute *sysattr) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_write_attribute + +Description: Writes to the supplied attribute. Function validates if the + given attribute is writable, and writes the new value to the + attribute. Value to write as well as its length is user + supplied. In case the length written is not equal to the + length requested to be written, the original value is + restored and an error is returned. + +Arguments: struct sysfs_attribute *sysattr Attribute to write to + const char *new_value sysattr's new value + size_t len Length of "new_value" + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_write_attribute(struct sysfs_attribute *sysattr, + const char *new_value, size_t len) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_attribute_value + +Description: Given a path to a specific attribute, function reads and + returns its value to the supplied value buffer. + +Arguments: const char *attrpath Attribute path to read + char *value Buffer to read in attribute's value + size_t vsize Size of buffer + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_read_attribute_value(const char *attrpath, + char *value, size_t vsize) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_value_from_attributes + +Description: Function takes a single or linked list of sysfs attribute + structures and returns the value of the specified attribute + name. + +Arguments: struct dlist *attr Attribute list to search through + const char *name Name of attribute whose value + to retrieve + +Returns: char * attribute value with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: char *sysfs_get_value_from_attributes + (struct sysfs_attribute *attr, const char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_directory_attribute + +Description: Function walks the list of attributes for the given sysfs + directory and returns the sysfs_attribute structure for + the specified attribute name. + +Arguments: struct sysfs_directory *dir Directory in which to search + char *attrname Attribute name to look for + +Returns: struct sysfs_attribute on success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_directory_attribute + (struct sysfs_directory *dir, char *attrname) +------------------------------------------------------------------------------- + + +6.3.2 Link Functions +-------------------- + +Sysfs contains many symbolic links, like bus links to bus devices. Libsysfs +treats links differently than directories due to processing differences. A +link in the /sys/bus/"busname"/devices/ directory indicates a device in the +/sys/devices directory. Through links we give the functionality to know +what is and what isn't a link and the ability to query the links target. + +------------------------------------------------------------------------------- +Name: sysfs_open_link + +Description: Opens a directory link. + +Arguments: const char *linkpath Path to link + +Returns: struct sysfs_link * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_link *sysfs_open_link(const char *linkpath) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_link + +Description: Closes a directory link structure. + +Arguments: struct sysfs_link *ln Link to close + +Prototype: void sysfs_close_link(struct sysfs_link *ln) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_dir_links + +Description: Reads the given sysfs_directory to create a list of links. + +Arguments: struct sysfs_directory *sysdir sysfs_directory whose + links to read + +Returns: struct dlist * of links with success + NULL with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: struct dlist *sysfs_read_dir_links + (struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_dir_links + +Description: Returns a list of links for the given sysfs_directory. + +Arguments: struct sysfs_directory *sysdir sysfs_directory whose + list of links to return + +Returns: struct dlist * of links with success + NULL with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: struct dlist *sysfs_read_dir_links + (struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_directory_link + +Description: Function walks the list of links for the given sysfs directory + and returns the sysfs_link structure for the specified link + name. + +Arguments: struct sysfs_directory *dir Directory in which to search + char *linkname Link name to look for + +Returns: struct sysfs_link * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_link *sysfs_get_directory_link + (struct sysfs_directory *dir, char *linkname) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_subdirectory_link + +Description: Function walks the list of links for the given sysfs directory + and its subdirectories returns the sysfs_link structure for + the specified link name. + +Arguments: struct sysfs_directory *dir Directory in which to search + char *linkname Link name to look for + +Returns: struct sysfs_link * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_link *sysfs_get_subdirectory_link + (struct sysfs_directory *dir, char *linkname) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_refresh_dir_links + +Description: Given a list sysfs_directory, this function refreshes the list + of links under the given directory. + +Arguments: struct sysfs_directory *sysdir sysfs_ directory whose + links list to refresh + +Returns: 0 with success. + 1 with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: int sysfs_refresh_dir_links(struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + + +6.3.3 Directory Functions +------------------------- + +Sysfs directories can represent every directory under sysfs. The structures +keep track of subdirectories, links, and files. Like opendir, readdir, and +closedir, libsysfs provides open, read, and close functions for working with +sysfs directories. Open creates the sysfs_directory structure. Read reads in +its contents - like subdirectories, links, and files. Close cleans it all +up. + +------------------------------------------------------------------------------- +Name: sysfs_open_directory + +Description: Opens a sysfs directory at a specific path + +Arguments: const char *path Directory path to open + +Returns: struct sysfs_directory * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_directory *sysfs_open_directory(const char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_directory + +Description: Closes specific directory, its subdirectories, links, and + files. + +Arguments: struct sysfs_directory *sysdir Directory to close + +Prototype: void sysfs_close_directory(struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_dir_subdirs + +Description: Reads the given sysfs_directory to create a list of subdirs. + +Arguments: struct sysfs_directory *sysdir sysfs_directory whose + subdirs have to be read + +Returns: struct dlist * of links with success + NULL with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: struct dlist *sysfs_read_dir_subdirs + (struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_directory + +Description: Read the supplied directory. Reading fills in the directory's + contents like subdirectories, links, and attributes. + +Arguments: struct sysfs_directory *sysdir Directory to read + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_read_directory(struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_read_all_subdirs + +Description: Reads all subdirs under a given supplied directory. + +Arguments: struct sysfs_directory *sysdir Directory to read + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_subdirectory + +Description: Function walks the directory tree for the given directory and + returns a sysfs_directory structure for the specified directory + name. + +Arguments: struct sysfs_directory *dir Directory in which to search + char *subname Name of directory to look for + +Returns: struct sysfs_directory with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_directory *sysfs_get_subdirectory + (struct sysfs_directory *dir, char *subname) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_dir_subdirs + +Description: Returns a list of subdirs for the given sysfs_directory. + +Arguments: struct sysfs_directory *sysdir sysfs_directory whose + subdirectories list to return + +Returns: struct dlist * of directories with success + NULL with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: struct dlist *sysfs_read_dir_subdirs + (struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_refresh_dir_subdirs + +Description: Given a list sysfs_directory, this function refreshes the list + of subdirectories under the given directory. + +Arguments: struct sysfs_directory *sysdir sysfs_ directory whose + subdirs list to refresh + +Returns: 0 with success. + 1 with error. Errno will be set on error, returning EINVAL + for invalid arguments + +Prototype: int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir) +------------------------------------------------------------------------------- + + +6.4 Bus Functions +----------------- + +The library provides a functions for viewing buses represented in sysfs. +The sysfs_open_bus opens a bus in the /sys/bus directory, such as "pci", +"usb", or "scsi". The open command returns a sysfs_bus structure that +contains a list of the bus' devices. The sysfs_close_bus function is +used to clean up the bus structure. Given a device or a driver, +functions are provided to determine what bus they are on. + +------------------------------------------------------------------------------- +Name: sysfs_open_bus + +Description: Function opens up one of the buses represented in sysfs in + the /sys/bus directory. It returns a sysfs_bus structure + that includes a list of bus devices and drivers. + +Arguments: const char *name Bus name to open, like "pci"... + +Returns: struct sysfs_bus * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_bus *sysfs_open_bus(const char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_bus + +Description: Function closes up the sysfs_bus structure including its + devices, drivers, and directory. + +Arguments: sysfs_bus *bus Bus structure to close + +Prototype: void sysfs_close_bus(struct sysfs_bus *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_devices + +Description: Function returns a list of devices that are registered with + this bus. + +Arguments: struct sysfs_bus *bus Bus whose devices list to return + +Returns: struct dlist * of sysfs_devices on success + NULL with error. Errno will be sent with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_drivers + +Description: Function returns a list of drivers that are registered with + this bus. + +Arguments: struct sysfs_bus *bus Bus whose drivers list to return + +Returns: struct dlist * of sysfs_drivers on success + NULL with error. Errno will be sent with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_device + +Description: Function takes a sysfs_bus structure(obtained on a successful + return from a sysfs_open_bus() call) and looks for the given + device on this bus. On success, it returns a sysfs_device + structure corresponding to the device. + +Arguments: struct sysfs_bus *bus Bus structure on which to search + char *id Device to look for + +Returns: struct sysfs_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_get_bus_device + (struct sysfs_bus *bus, char *id) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_driver + +Description: Function takes a sysfs_bus structure (obtained on a successful + return from a sysfs_open_bus() call) and looks for the given + driver on this bus. On success, it returns a sysfs_driver + structure corresponding to the driver. + +Arguments: struct sysfs_bus *bus Bus structure on which to search + char *drvname Driver to look for + +Returns: struct sysfs_driver * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_get_bus_driver + (struct sysfs_bus *bus, char *drvname) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_attributes + +Description: Function takes a sysfs_bus structure and returns a list of + attributes for the bus. + +Arguments: struct sysfs_bus *bus Bus for which attributes are required + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_bus_attribute + +Description: Function takes a sysfs_bus structure and looks for the required + attribute on the bus. On success, it returns a sysfs_attribute + structure corresponding to the given attribute. + +Arguments: struct sysfs_bus *bus Bus structure on which to search + char *attrname Attribute to look for + +Returns: struct sysfs_attribute * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_bus_attribute + (struct sysfs_bus *bus, char *attrname) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_refresh_bus_attributes + +Description: Function refreshes the list of attributes for a given sysfs_bus + +Arguments: struct sysfs_bus *bus Bus whose attributes list to refresh + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_find_driver_bus + +Description: Given the name of a driver, this function finds the name of the + bus the driver is on + +Arguments: const char *driver Name of the driver to look for + char *busname Buffer to return the bus name + size_t bsize Size of the "busname" buffer + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_find_driver_bus(const char *driver, + char *busname, size_t bsize) +------------------------------------------------------------------------------- + + +6.5 Class Functions +------------------- + +Libsysfs provides functions to open sysfs classes and their class devices. +These functions too operate with open and close, close must be called to +clean up the class structures. Given a class device name, functions are +provided to determine what class they belong to. Once a class device +name and the class it belongs to is known, a function to open the +class device is provided. This method can be used when details of +a single class device is required. + +------------------------------------------------------------------------------- +Name: sysfs_open_class + +Description: Function opens up one of the classes represented in sysfs in + the /sys/class directory. It returns a sysfs_class structure + that includes a list of class devices. + +Arguments: const char *name Class name to open, like "net".. + +Returns: struct sysfs_class * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class *sysfs_open_class(const char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_class + +Description: Function closes up the sysfs_class structure including its + class devices. + +Arguments: sysfs_class *cls Class structure to close + +Prototype: void sysfs_close_class(struct sysfs_class *cls); +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_class_device_path + +Description: Function opens up one of the class devices represented in + sysfs in sysfs/class/"class"/ directory. It returns a + sysfs_class_device structure. + +Arguments: const char *path Path to class device + +Returns: struct sysfs_class_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class_device *sysfs_open_class_device_path + (const char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_class_device + +Description: Function closes up the sysfs_class_device structure. + +Arguments: sysfs_class_device *dev Class device structure to close + +Prototype: void sysfs_close_class_device(struct sysfs_class_device *dev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_class_device + +Description: Function takes a sysfs_class structure(obtained on a successful + return from a sysfs_open_class() call) and looks for the given + device in this class. On success, it returns a sysfs_class_device + structure corresponding to the class device. + +Arguments: struct sysfs_class *cls Class on which to search + char *name Class device "name" to look for + +Returns: struct sysfs_class_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class_device *sysfs_get_class_device + (struct sysfs_class *cls, char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_class_devices + +Description: Function returns a list of class devices for the given class. + +Arguments: struct sysfs_class *cls Class whose class device list + is required + +Returns: struct dlist * of sysfs_class_devices on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_class_device + +Description: Given the name of the class on which to look for, this function + locates a given class device and returns a sysfs_class_device + structure corresponding to the requested class device. + + NOTE: + 1. The sysfs_class_device structure obtained upon successful + return from this function has to be closed by calling + sysfs_close_class_device(). + 2. Class this device belongs to must be known prior to calling + this function. + +Arguments: const char *classname Class on which to search + char *name Class device "name" to open + +Returns: struct sysfs_class_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class_device *sysfs_open_class_device + (const char *classname, char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_device + +Description: Function returns the sysfs_device reference (if present) for the + given class device. + +Arguments: struct sysfs_class_device *clsdev Class device whose + sysfs_device reference + is required + +Returns: struct sysfs_device * on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_get_classdev_device + (struct sysfs_class_device *clsdev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_driver + +Description: Function returns the sysfs_driver reference (if present) for + the given class device. + +Arguments: struct sysfs_class_device *clsdev Class device whose + sysfs_driver reference + is required + +Returns: struct sysfs_driver * on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_driver *sysfs_get_classdev_driver + (struct sysfs_class_device *clsdev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_parent + +Description: Function returns the sysfs_class_device reference for the + parent (if present) of the given class device. + +Arguments: struct sysfs_class_device *clsdev Class device whose + parent reference + is required + +Returns: struct sysfs_class_device * on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_class_device *sysfs_get_classdev_parent + (struct sysfs_class_device *clsdev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_attributes + +Description: Function takes a sysfs_class_device structure and returns a + list of attributes for the class device. + +Arguments: struct sysfs_class_device *cdev Class device for which + attributes are required + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_classdev_attributes + (struct sysfs_class_device *cdev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_classdev_attr + +Description: Searches supplied class device's attributes by name and returns + the attribute. + +Arguments: struct sysfs_class_device *clsdev Device to search + const char *name Attribute name to find + +Returns: struct sysfs_attribute * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_classdev_attr + (struct sysfs_class_device *clsdev, const char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_refresh_classdev_attributes + +Description: Function refreshes the list of attributes for a given + sysfs_class_device. + +Arguments: struct sysfs_class_device *cdev Class device whose attributes + list to refresh + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_classdev_attributes + (struct sysfs_class_device *cdev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_classdev_attr + +Description: Function takes as arguments, a the name of the class, the class + device name and the name of the required attribute. + + NOTE: + 1. The struct sysfs_attribute * obtained upon successful + return from this function has to be closed by making + a call to sysfs_close_attribute() + +Arguments: char *classname Class name on which to search + char *dev Name of the class device + char *attrib Attribute to open + +Returns: struct sysfs_attribute * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_write_classdev_attr + (const char *classname, const char *dev, + const char *attrib) +------------------------------------------------------------------------------- + + +6.6 Device Functions +-------------------- + +Devices represent everything in sysfs under /sys/devices, which is a +hierarchical view of system devices. Besides the expected open and +close functions, libsysfs provides open and close functions for +root devices. These functions recursively open or close a device +and all of its children. + +------------------------------------------------------------------------------- +Name: sysfs_open_device_path + +Description: Opens up a device at a specific path. It opens the device's + directory, reads the directory, and returns a sysfs_device + structure. + +Arguments: const char *path Path to device + +Returns: struct sysfs_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_open_device_path(const char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_device + +Description: Function closes up the sysfs_device structure. + +Arguments: sysfs_device *dev Device structure to close + +Prototype: void sysfs_close_device(struct sysfs_device *dev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_root_device + +Description: Function opens up one of the root devices represented in sysfs + in the /sys/devices directory. It returns a sysfs_root_device + structure that includes a list of devices in the tree. + +Arguments: const char *name Name of the root device to open + +Returns: struct sysfs_root_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_open_root_device(const char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_root_device + +Description: Function closes up the sysfs_root_device structure including the + devices in the root device tree. + +Arguments: sysfs_device *root Root device structure to close + +Prototype: void sysfs_close_root_device(struct sysfs_root_device *root) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_device_tree + +Description: Function opens up the device tree at the specified path. + +Arguments: const char *path Path at which to open the device tree + +Returns: struct sysfs_device * with success + NULL with error, Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_open_device_tree(const char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_device_tree + +Description: Function closes the device tree originating at the given + sysfs_device. + +Arguments: struct sysfs_device *devroot Device from which the device + tree has to be closed + +Prototype: void sysfs_close_device_tree(struct sysfs_device *devroot) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_device_parent + +Description: Function returns the sysfs_device reference for the parent + (if present) of the given sysfs_device. + +Arguments: struct sysfs_device *dev sysfs_device whose parent + reference is required + +Returns: struct sysfs_device * on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_get_device_parent + (struct sysfs_device *dev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_root_devices + +Description: Function returns a list of devices under the given root device. + +Arguments: struct sysfs_root_device *root sysfs_root_device whose devices + list is required + +Returns: struct dlist * of sysfs_devices on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_root_devices + (struct sysfs_root_device *root) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_device_attr + +Description: Searches supplied device's attributes by name and returns + the attribute. + +Arguments: struct sysfs_device *dev Device to search + const char *name Attribute name to find + +Returns: struct sysfs_attribute * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_device_attr + (struct sysfs_device *dev, const char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_device_attributes + +Description: Function takes a sysfs_device structure and returns a list + of attributes for the device. + +Arguments: struct sysfs_device *device Device for which + attributes are required + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_device_attributes + (struct sysfs_device *device) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_refresh_device_attributes + +Description: Function refreshes the list of attributes for a given + sysfs_device. + +Arguments: struct sysfs_device *device Device whose attributes list + to refresh + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_refresh_device_attributes + (struct sysfs_device *device) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_device + +Description: Given the name of the bus on which to look for, this function + locates a given device and returns a sysfs_device structure + corresponding to the requested device. + +Arguments: const char *bus Bus on which to search + const char *bus_id Device to look for + +Returns: struct sysfs_device * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_device *sysfs_open_device + (const char *bus, const char *bus_id) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_device_bus + +Description: Given a sysfs_device, this function fills in the bus this + device is on in the sysfs_device->bus field. + +Arguments: struct sysfs_device *dev Device whose bus name to find + +Returns: 0 with success. + -1 with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: int sysfs_get_device_bus(struct sysfs_device *dev) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_device_attr + +Description: Function takes as arguments, the bus on which to search for a + device, and an attribute of the device to open. + + NOTE: + 1. The struct sysfs_attribute * obtained upon successful + return from this function has to be closed by making + a call to sysfs_close_attribute() + +Arguments: char *bus Bus on which to search + char *bus_id Device to look for + char *attrib Name of the attribute to open + +Returns: struct sysfs_attribute * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_open_device_attr + (const char *bus, const char *bus_id, const char *attrib) +------------------------------------------------------------------------------- + + +6.7 Driver Functions +-------------------- + +Drivers are represented in sysfs under the /sys/bus/xxx/drivers (xxx being +the bus type, such as "pci", "usb, and so on). Functions are provided to +open and close drivers. + +------------------------------------------------------------------------------- +Name: sysfs_open_driver_path + +Description: Opens driver at specific path. + +Arguments: const char *path Path to driver + +Returns: struct sysfs_driver * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_driver *sysfs_open_driver_path(const char *path) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_close_driver + +Description: Closes and cleans up sysfs_driver structure. + +Arguments: sysfs_driver *driver Driver structure to close + +Prototype: void sysfs_close_driver(struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_devices + +Description: Function returns a list of devices that use this driver. + +Arguments: struct sysfs_driver *driver Driver whose devices list is + required + +Returns: struct dlist * of sysfs_devices on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_driver_devices + (struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_refresh_driver_devices + +Description: Function refreshes the list of devices that use this driver. + +Arguments: struct sysfs_driver *driver Driver whose devices list is + required to be refreshed + +Returns: struct dlist * of sysfs_devices on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_refresh_driver_devices + (struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_device + +Description: Function returns a sysfs_device reference for the device with + "name" that uses this driver + +Arguments: struct sysfs_driver *driver Driver on which to search + const char *name Name of the device to look for + +Returns: struct sysfs_device * corresponding to "name" on success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_driver_device + (struct sysfs_driver *driver, const char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_attr + +Description: Searches supplied driver's attributes by name and returns + the attribute. + +Arguments: struct sysfs_driver *drv Driver to search + const char *name Attribute name to find + +Returns: struct sysfs_attribute * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_get_driver_attr + (struct sysfs_driver *drv, const char *name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_attributes + +Description: Function takes a sysfs_driver structure and returns a list + of attributes for the driver. + +Arguments: struct sysfs_driver *driver Driver for which attributes + are required + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_get_driver_attributes + (struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_refresh_driver_attributes + +Description: Function refreshes the list of attributes for a given + sysfs_driver. + +Arguments: struct sysfs_driver *driver Driver whose attributes list + to refresh + +Returns: struct dlist * of attributes with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct dlist *sysfs_refresh_driver_attributes + (struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_driver + +Description: Given the name of the bus on which to look for, this function + locates a given driver and returns a sysfs_driver structure + corresponding to the requested device. + + NOTE: + 1. The sysfs_driver structure obtained upon successful return + from this function has to be closed by calling + sysfs_close_driver_by_name(). + 2. Bus on which to look for this driver should be known prior + to calling this function. Use sysfs_find_driver_bus() + to determine this. + +Arguments: const char *bus_name Bus on which to search + const char *drv_name Driver name to look for + +Returns: struct sysfs_driver * with success + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_driver *sysfs_open_driver(const char *bus_name, + const char *drv_name) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_get_driver_links + +Description: Function returns a list of links for a given driver + +Arguments: struct sysfs_driver *driver Driver to get links from + +Returns: struct dlist * of links on success + NULL with error + +Prototype: struct dlist *sysfs_get_driver_links + (struct sysfs_driver *driver) +------------------------------------------------------------------------------- + +------------------------------------------------------------------------------- +Name: sysfs_open_driver_attr + +Description: Function takes as arguments, the bus the driver is registered + on, the driver name and the name of the attribute to open. + + NOTE: + 1. The struct sysfs_attribute * obtained upon successful + return from this function has to be closed by making + a call to sysfs_close_attribute() + +Arguments: char *bus Bus on which driver is present + char *drv Driver to look for + char *attrib Name of the attribute to open + +Returns: struct sysfs_attribute * with success. + NULL with error. Errno will be set with error, returning + - EINVAL for invalid arguments + +Prototype: struct sysfs_attribute *sysfs_open_driver_attr + (const char *bus, const char *drv, const char *attrib) +------------------------------------------------------------------------------- + + +7 Dlists +-------- + +Libsysfs uses (yet another) list implementation thanks to Eric J Bohm. + + +7.1 Navigating a dlist +---------------------- + +Some library functions return a dlist of devices/drivers/attributes, etc. +To navigate the list returned the macro "dlist_for_each_data" is to be used. + +------------------------------------------------------------------------------ +Function/Macro name: dlist_for_each_data + +Description: Walk the given list, returning a known data type/ + structure in each iteration. + +Arguments: struct dlist *list List pointer + data_iterator Data type/structure variable + contained in the list + datatype Data type/structure contained + in the list + +Returns: On each iteration, "data_iterator" will contain a list + element of "datatype" + +Usage example: The function sysfs_get_classdev_attributes() returns a + dlist of attributes. To navigate the list: + + struct sysfs_attribute *attr = NULL; + struct dlist *attrlist = NULL; + . + . + . + attrlist = sysfs_get_classdev_attributes + (struct sysfs_class_device *cdev) + if (attrlist != NULL) { + dlist_for_each_data(attrlist, attr, + struct sysfs_attribute) { + . + . + . + } + } +------------------------------------------------------------------------------- + + +7.2 Custom sorting using dlist_sort_custom() +-------------------------------------------- + +As of release 1.2.0, libsysfs provides a new interface for custom sorting +of dlists. The API dlist_sort_custom() has been added for this purpose. +Applications that would like to define their own sorter function can now +make use of this API. + +The sorter function must conform to the following prototype: + + int compare(void *a, void*b) + +dlist_sort_custom() expects that the compare function will: + return >0 for a before b + return <0 for b before a + return 0 for a == b + + +8. Usage +-------- + +Accessing devices through libsysfs is supposed to mirror accessing devices +in the filesystem it represents. Here's a typical order of operation: + + - get sysfs mount point + - "open" sysfs category, ie. bus, class, or device + - work with category + - "close" sysfs category + + +9. Testsuite +------------ + +Version 1.0.0 of sysfsutils ships with a comprehensive testsuite. The testsuite +shipped as part of the "test" directory of the sysfsutils source package, +results in an executable "testlibsysfs" which will be installed in the +/usr/local/bin directory. Some of the salient features of the testsuite are: + +a. Tests _every_ API exported by the library. +b. Tests are performed for all possible combinations of input parameters. +c. Detailed output is provided for the correct case. +d. Facility to redirect output of the tests to a normal file. +e. Number of iterations of tests can be specified. + +The testsuite comes with its own configuration file "libsysfs.conf" in the +"test" directory. This file is used to generate a header file at the time +the tests are built. + +To use the testsuite: + +a. Modify the variables libsysfs.conf file to appropriate values for your + system. (The libsysfs.conf file contains comments describing what each + variable stands for and, in some cases, how to determine an appropriate + value for the system under test). + +b. Build and install the testsuite. + +c. Run the testsuite: + + testlibsysfs + +The default logfile is stdout. + +NOTE: If the libsysfs.conf file is changed, make sure to run "make clean" in +the test directory and then a "make" for the changes to take effect. + + +10. Conclusion +-------------- + +Libsysfs is meant to provide a stable application programming interface to +sysfs. Applications can depend upon the library to access system devices +and functions exposed through sysfs. -- cgit v1.2.3-54-g00ecf From b2652e6b29c3d29766e1133c81612113084ee44a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 6 Sep 2005 22:57:07 +0200 Subject: klibc: update to version 1.1.1 Signed-off-by: Kay Sievers --- klibc/MCONFIG | 4 ++-- klibc/include/klibc/compiler.h | 4 ++++ klibc/include/klibc/extern.h | 2 ++ klibc/include/malloc.h | 21 +++++++++++++++++++++ klibc/include/stdlib.h | 6 ++---- klibc/include/string.h | 2 ++ klibc/include/sys/inotify.h | 16 ++++++++++++++++ klibc/klibc.spec.in | 4 ++-- klibc/klibc/SYSCALLS.def | 3 +++ klibc/klibc/execvpe.c | 4 +++- klibc/klibc/strchr.c | 3 +++ klibc/klibc/strrchr.c | 3 +++ klibc/version | 2 +- 13 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 klibc/include/malloc.h create mode 100644 klibc/include/sys/inotify.h diff --git a/klibc/MCONFIG b/klibc/MCONFIG index 1141b78d47..450e5c7f5c 100644 --- a/klibc/MCONFIG +++ b/klibc/MCONFIG @@ -33,7 +33,7 @@ KRNLOBJ = $(SRCROOT)/linux KLIBCVER = -D__KLIBC__=$(shell cut -d. -f1 < $(SRCROOT)/version) \ -D__KLIBC_MINOR__=$(shell cut -d. -f2 < $(SRCROOT)/version) -ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/) +ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/parisc.*/parisc/) CC = $(CROSS)gcc LD = $(CROSS)ld KLIBSRC = $(SRCROOT)/klibc @@ -42,7 +42,7 @@ INCLUDE = -I$(SRCROOT)/include/arch/$(ARCH) \ -I$(SRCROOT)/include/bits$(BITSIZE) \ -I$(SRCROOT)/include \ -I$(KRNLOBJ)/include -I$(KRNLOBJ)/include2 -I$(KRNLSRC)/include -REQFLAGS = $(ARCHREQFLAGS) $(KLIBCVER) -nostdinc -iwithprefix include \ +REQFLAGS = $(ARCHREQFLAGS) $(KLIBCVER) -nostdlib -nostdinc -iwithprefix include \ $(INCLUDE) LDFLAGS = AR = $(CROSS)ar diff --git a/klibc/include/klibc/compiler.h b/klibc/include/klibc/compiler.h index ee697adf08..7ff6ff7d51 100644 --- a/klibc/include/klibc/compiler.h +++ b/klibc/include/klibc/compiler.h @@ -116,4 +116,8 @@ # define __bitwise #endif +/* Compiler pragma to make an alias symbol */ +#define __ALIAS(__t, __f, __p, __a) \ + __t __f __p __attribute__((weak, alias(#__a))); + #endif diff --git a/klibc/include/klibc/extern.h b/klibc/include/klibc/extern.h index f9c3467211..8a73d19358 100644 --- a/klibc/include/klibc/extern.h +++ b/klibc/include/klibc/extern.h @@ -11,4 +11,6 @@ #define __extern extern #endif +#define __alias(x) __attribute__((weak, alias(x))) + #endif /* _KLIBC_EXTERN_H */ diff --git a/klibc/include/malloc.h b/klibc/include/malloc.h new file mode 100644 index 0000000000..5beca8d068 --- /dev/null +++ b/klibc/include/malloc.h @@ -0,0 +1,21 @@ +/* + * malloc.h + * + * Apparently people haven't caught on to use , which is the + * standard place for this crap since the 1980's... + */ + +#ifndef _MALLOC_H +#define _MALLOC_H + +#include +#include +#include + +__extern void free(void *); + +__extern __mallocfunc void *malloc(size_t); +__extern __mallocfunc void *calloc(size_t, size_t); +__extern __mallocfunc void *realloc(void *, size_t); + +#endif /* _MALLOC_H */ diff --git a/klibc/include/stdlib.h b/klibc/include/stdlib.h index 54d45043f7..17efc30e5a 100644 --- a/klibc/include/stdlib.h +++ b/klibc/include/stdlib.h @@ -9,6 +9,8 @@ #include #include +#include + #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 @@ -28,7 +30,6 @@ __extern int atoi(const char *); __extern long atol(const char *); __extern long long atoll(const char *); __extern __noreturn exit(int); -__extern void free(void *); static __inline__ long labs(long __n) { return (__n < 0L) ? -__n : __n; } @@ -37,9 +38,6 @@ static __inline__ long long llabs(long long __n) { return (__n < 0LL) ? -__n : __n; } -__extern __mallocfunc void *malloc(size_t); -__extern __mallocfunc void *calloc(size_t, size_t); -__extern __mallocfunc void *realloc(void *, size_t); __extern long strtol(const char *, char **, int); __extern long long strtoll(const char *, char **, int); __extern unsigned long strtoul(const char *, char **, int); diff --git a/klibc/include/string.h b/klibc/include/string.h index 5608a3c963..319be4eb85 100644 --- a/klibc/include/string.h +++ b/klibc/include/string.h @@ -21,7 +21,9 @@ __extern int strcasecmp(const char *, const char *); __extern int strncasecmp(const char *, const char *, size_t); __extern char *strcat(char *, const char *); __extern char *strchr(const char *, int); +__extern char *index(const char *, int); __extern char *strrchr(const char *, int); +__extern char *rindex(const char *, int); __extern int strcmp(const char *, const char *); __extern char *strcpy(char *, const char *); __extern size_t strcspn(const char *, const char *); diff --git a/klibc/include/sys/inotify.h b/klibc/include/sys/inotify.h new file mode 100644 index 0000000000..74fc714190 --- /dev/null +++ b/klibc/include/sys/inotify.h @@ -0,0 +1,16 @@ +/* + * sys/inotify.h + */ + +#ifndef _SYS_INOTIFY_H +#define _SYS_INOTIFY_H + +#include +#include +#include + +__extern int inotify_init(void); +__extern int inotify_add_watch(int, const char *, __u32); +__extern int inotify_rm_watch(int, __u32); + +#endif /* _SYS_INOTIFY_H */ diff --git a/klibc/klibc.spec.in b/klibc/klibc.spec.in index cab496b917..eef5dbf9d3 100644 --- a/klibc/klibc.spec.in +++ b/klibc/klibc.spec.in @@ -7,7 +7,7 @@ Group: Development/Libraries URL: http://www.zytor.com/mailman/listinfo/klibc Source: http://www.kernel.org/pub/linux/libs/klibc-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildRequires: kernel >= 2.6.0 +BuildRequires: kernel >= 2.6.0, kernel-devel Packager: H. Peter Anvin Prefix: /usr Vendor: Starving Linux Artists @@ -44,7 +44,7 @@ embedded systems. %prep %setup -q -cp -dRs /lib/modules/`uname -r`/build ./linux +cp -dRs /lib/modules/`uname -r`/build/ ./linux # Shouldn't need this when getting the build tree from /lib/modules # make -C linux defconfig ARCH=%{_target_cpu} # make -C linux prepare ARCH=%{_target_cpu} diff --git a/klibc/klibc/SYSCALLS.def b/klibc/klibc/SYSCALLS.def index 11d8c9a47e..b78919b134 100644 --- a/klibc/klibc/SYSCALLS.def +++ b/klibc/klibc/SYSCALLS.def @@ -114,6 +114,9 @@ int lchown32,lchown::lchown(const char *, uid_t, gid_t) int getcwd::__getcwd(char *, size_t) int utime(const char *, const struct utimbuf *) int utimes(const char *, const struct timeval *) + int inotify_init(void) + int inotify_add_watch(int, const char *, __u32) + int inotify_rm_watch(int, __u32) ; ; I/O operations diff --git a/klibc/klibc/execvpe.c b/klibc/klibc/execvpe.c index afd791ab43..fcd5b6fd4a 100644 --- a/klibc/klibc/execvpe.c +++ b/klibc/klibc/execvpe.c @@ -9,7 +9,9 @@ * Since execlpe() and execvpe() aren't in POSIX, nor in glibc, * I have followed QNX precedent in the implementation of the PATH: * the PATH that is used is the one in the current environment, not - * in the new environment. + * in the new environment. Otherwise it would be impossible to pass + * a different PATH to the new process than the one one would want to + * use to search. */ #include diff --git a/klibc/klibc/strchr.c b/klibc/klibc/strchr.c index 192f83600c..f657095c6b 100644 --- a/klibc/klibc/strchr.c +++ b/klibc/klibc/strchr.c @@ -3,6 +3,7 @@ */ #include +#include char *strchr(const char *s, int c) { @@ -14,3 +15,5 @@ char *strchr(const char *s, int c) return (char *)s; } + +__ALIAS(char *, index, (const char *, int), strchr) diff --git a/klibc/klibc/strrchr.c b/klibc/klibc/strrchr.c index 3b42464059..5a0cbe386e 100644 --- a/klibc/klibc/strrchr.c +++ b/klibc/klibc/strrchr.c @@ -3,6 +3,7 @@ */ #include +#include char *strrchr(const char *s, int c) { @@ -16,3 +17,5 @@ char *strrchr(const char *s, int c) return (char *)found; } + +__ALIAS(char *, rindex, (const char *, int), strrchr) diff --git a/klibc/version b/klibc/version index 5b09c67c20..45a1b3f445 100644 --- a/klibc/version +++ b/klibc/version @@ -1 +1 @@ -1.0.14 +1.1.2 -- cgit v1.2.3-54-g00ecf From fc049858394318dab8ec729cb49cd6cfd49f350d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Sep 2005 03:34:34 +0200 Subject: delete cdromsymlinks* - obsoleted by cdrom_id and IMPORT rules Signed-off-by: Kay Sievers --- extras/cdsymlinks.c | 555 ------------------------------------------------- extras/cdsymlinks.conf | 21 -- extras/cdsymlinks.sh | 204 ------------------ 3 files changed, 780 deletions(-) delete mode 100644 extras/cdsymlinks.c delete mode 100644 extras/cdsymlinks.conf delete mode 100644 extras/cdsymlinks.sh diff --git a/extras/cdsymlinks.c b/extras/cdsymlinks.c deleted file mode 100644 index b6bc96dc6f..0000000000 --- a/extras/cdsymlinks.c +++ /dev/null @@ -1,555 +0,0 @@ -/* cdsymlinks.c - * - * Map cdrom, cd-r, cdrw, dvd, dvdrw, dvdram to suitable devices. - * Prefers cd* for DVD-incapable and cdrom and dvd for read-only devices. - * First parameter is the kernel device name. - * Second parameter, if present, must be "-d" => output the full mapping. - * - * Usage: - * BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" - * BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" - * BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" - * (this last one is "just in case") - * - * (c) 2004, 2005 Darren Salt - * - * Contributors: - * - J A Magallon (bug fixes) - * - * Last modified: 2005-02-15 - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -static const char *progname; - -/* This file provides us with our devices and capabilities information. */ -#define CDROM_INFO "/proc/sys/dev/cdrom/info" - -/* This file contains our default settings. */ -#define CONFIGURATION "/etc/udev/cdsymlinks.conf" -/* Default output types configuration, in the presence of an empty list */ -#define OUTPUT_DEFAULT "CD CDRW DVD DVDRW DVDRAM" - -static int debug = 0; - -/* List item */ -struct list_item_t { - struct list_item_t *next; - char *data; -}; - -/* List root. Note offset of list_t->head and list_item_t->next */ -struct list_t { - struct list_item_t *head, *tail; -}; - -/* Configuration variables */ -static struct list_t allowed_output = {0}; -static int numbered_links = 1; -static int link_zero = 0; - -/* Available devices */ -static struct list_t Devices = {0}; - -/* Devices' capabilities in full (same order as available devices list). - * There's no cap_CD; all are assumed able to read CDs. - */ -static struct list_t cap_DVDRAM = {0}, cap_DVDRW = {0}, cap_DVD = {0}, - cap_CDRW = {0}, cap_CDR = {0}, cap_CDWMRW = {0}, - cap_CDMRW = {0}, cap_CDRAM = {0}; - -/* Device capabilities by name */ -static struct list_t dev_DVDRAM = {0}, dev_DVDRW = {0}, dev_DVD = {0}, - dev_CDRW = {0}, dev_CDR = {0}, dev_CDWMRW = {0}, - dev_CDMRW = {0}, dev_CDRAM = {0}; -#define dev_CD Devices - -typedef struct { - struct list_t *cap, *dev; - const char label[8], symlink[8]; - const char *captext; - int captextlen; -} cap_dev_t; - -#define CAPDEV(X) &cap_##X, &dev_##X - -static const cap_dev_t cap_dev_info[] = { - { NULL, &dev_CD, "CD", "cdrom", NULL, 0 }, - { CAPDEV(CDR), "CDR", "cd-r", "Can write CD-R:", 15 }, - { CAPDEV(CDRW), "CDRW", "cdrw", "Can write CD-RW:", 16 }, - { CAPDEV(DVD), "DVD", "dvd", "Can read DVD:", 13 }, - { CAPDEV(DVDRW), "DVDRW", "dvdrw", "Can write DVD-R:", 16 }, - { CAPDEV(DVDRAM), "DVDRAM", "dvdram", "Can write DVD-RAM:", 18 }, - { CAPDEV(CDMRW), "CDMRW", "cdm", "Can read MRW:", 13 }, /* CDC-MRW R */ - { CAPDEV(CDWMRW), "CDWMRW", "cdmrw", "Can write MRW:", 14 }, /* CDC-MRW W */ - { CAPDEV(CDRAM), "CDRAM", "cdram", "Can write RAM:", 14 }, /* CDC-RAM W */ - { NULL } -}; - -#define foreach_cap_dev(loop) \ - for ((loop) = cap_dev_info; (loop)->label[0]; ++(loop)) -#define foreach_cap_dev_noCD(loop) \ - for ((loop) = cap_dev_info + 1; (loop)->label[0]; ++(loop)) - -/* - * Some library-like bits first... - */ - -static void -errexit (const char *reason) -{ - fprintf (stderr, "%s: %s: %s\n", progname, reason, strerror (errno)); - exit (2); -} - - -static void -msgexit (const char *reason) -{ - fprintf (stderr, "%s: %s\n", progname, reason); - exit (2); -} - - -static void -errwarn (const char *reason) -{ - fprintf (stderr, "%s: warning: %s: %s\n", progname, reason, strerror (errno)); -} - - -static void -msgwarn (const char *reason) -{ - fprintf (stderr, "%s: warning: %s\n", progname, reason); -} - - -static void * -xmalloc (size_t size) -{ - void *mem = malloc (size); - if (size && !mem) - msgexit ("malloc failed"); - return mem; -} - - -static char * -xstrdup (const char *text) -{ - char *mem = xmalloc (strlen (text) + 1); - return strcpy (mem, text); -} - - -/* Append a string to a list. The string is duplicated. */ -static void -list_append (struct list_t *list, const char *data) -{ - struct list_item_t *node = xmalloc (sizeof (struct list_item_t)); - node->next = NULL; - if (list->tail) - list->tail->next = node; - list->tail = node; - if (!list->head) - list->head = node; - node->data = xstrdup (data); -} - - -/* Prepend a string to a list. The string is duplicated. */ -static void -list_prepend (struct list_t *list, const char *data) -{ - struct list_item_t *node = xmalloc (sizeof (struct list_item_t)); - node->next = list->head; - list->head = node; - if (!list->tail) - list->tail = node; - node->data = xstrdup (data); -} - - -/* Delete a lists's contents, freeing claimed memory */ -static void -list_delete (struct list_t *list) -{ - struct list_item_t *node = list->head; - while (node) - { - struct list_item_t *n = node; - node = node->next; - free (n->data); - free (n); - } - list->tail = list->head = NULL; -} - - -/* Print out a list on one line, each item space-prefixed, no LF */ -static void -list_print (const struct list_t *list, FILE *stream) -{ - const struct list_item_t *node = (const struct list_item_t *)list; - while ((node = node->next) != NULL) - fprintf (stream, " %s", node->data); -} - - -/* Return the nth item in a list (count from 0) - * If there aren't enough items in the list, return the requested default - */ -static const struct list_item_t * -list_nth (const struct list_t *list, size_t nth) -{ - const struct list_item_t *node = list->head; - while (nth && node) - { - node = node->next; - --nth; - } - return node; -} - - -/* Return the first matching item in a list, or NULL */ -static const struct list_item_t * -list_search (const struct list_t *list, const char *data) -{ - const struct list_item_t *node = list->head; - while (node) - { - if (!strcmp (node->data, data)) - return node; - node = node->next; - } - return NULL; -} - - -/* Split up a string on whitespace & assign the resulting tokens to a list. - * Ignore everything up until the first colon (if present). - */ -static void -list_assign_split (struct list_t *list, char *text) -{ - char *token = strchr (text, ':'); - token = strtok (token ? token + 1 : text, " \t\n"); - while (token) - { - list_prepend (list, token); - token = strtok (0, " \t\n"); - } -} - - - -/* Gather the default settings. */ -static void -read_defaults (void) -{ - FILE *conf = fopen (CONFIGURATION, "r"); - if (!conf) - { - if (errno != ENOENT) - errwarn ("error accessing configuration"); - } - else - { - char *text = NULL; - size_t textlen; - while (getline (&text, &textlen, conf) != -1) - { - wordexp_t p = {0}; - int len = strlen (text); - if (len && text[len - 1] == '\n') - text[--len] = '\0'; - if (len && text[len - 1] == '\r') - text[--len] = '\0'; - if (!len) - continue; - char *token = text + strspn (text, " \t"); - if (!*token || *token == '#') - continue; - switch (len = wordexp (text, &p, 0)) - { - case WRDE_NOSPACE: - msgexit ("malloc failed"); - case 0: - if (p.we_wordc == 1) - { - if (!strncmp (p.we_wordv[0], "OUTPUT=", 7)) - { - list_delete (&allowed_output); - list_assign_split (&allowed_output, p.we_wordv[0] + 7); - } - else if (!strncmp (p.we_wordv[0], "NUMBERED_LINKS=", 15)) - numbered_links = atoi (p.we_wordv[0] + 15); - else if (!strncmp (p.we_wordv[0], "LINK_ZERO=", 15)) - link_zero = atoi (p.we_wordv[0] + 15); - break; - } - /* fall through */ - default: - msgwarn ("syntax error in configuration file"); - } - wordfree (&p); - } - if (!feof (conf)) - errwarn ("error accessing configuration"); - if (fclose (conf)) - errwarn ("error accessing configuration"); - free (text); - } - if (!allowed_output.head) - { - char *dflt = strdup (OUTPUT_DEFAULT); - list_assign_split (&allowed_output, dflt); - free (dflt); - } -} - - -/* From information supplied by the kernel: - * + get the names of the available devices - * + populate our capability lists - * Order is significant: device item N maps to each capability item N. - */ -static void -populate_capability_lists (void) -{ - FILE *info = fopen (CDROM_INFO, "r"); - if (!info) - { - if (errno == ENOENT) - exit (0); - errexit ("error accessing CD/DVD info"); - } - - char *text = 0; - size_t textlen = 0; - - while (getline (&text, &textlen, info) != -1) - { - if (!strncasecmp (text, "drive name", 10)) - list_assign_split (&Devices, text); - else - { - const cap_dev_t *cap; - foreach_cap_dev_noCD (cap) - if (!strncasecmp (text, cap->captext, cap->captextlen)) - { - list_assign_split (cap->cap, text); - break; - } - } - } - if (!feof (info)) - errexit ("error accessing CD/DVD info"); - fclose (info); - free (text); -} - - -/* Write out the links of type LINK which should be created for device NAME, - * taking into account existing links and the capability list for type LINK. - */ -static void -do_output (const char *name, const char *link, const struct list_t *dev, - int do_link_zero) -{ - const struct list_item_t *i = (const struct list_item_t *)dev; - if (!i->next) - return; - - errno = 0; - - size_t link_len = strlen (link); - DIR *dir = opendir ("/dev"); - if (!dir) - errexit ("error reading /dev"); - - struct list_t devls = {0}; /* symlinks whose name matches LINK */ - struct list_t devlinks = {0}; /* those symlinks' targets */ - struct dirent *entry; - while ((entry = readdir (dir)) != NULL) - { - if (strncmp (entry->d_name, link, link_len)) - continue; /* wrong name: ignore it */ - - /* The rest of the name must be null or consist entirely of digits. */ - const char *p = entry->d_name + link_len - 1; - while (*++p) - if (!isdigit (*p)) - break; - if (*p) - continue; /* wrong format - ignore */ - - /* Assume that it's a symlink and try to read its target. */ - char buf[sizeof (entry->d_name)]; - int r = readlink (entry->d_name, buf, sizeof (buf) - 1); - if (r < 0) - { - if (errno == EINVAL) - continue; /* not a symlink - ignore */ - errexit ("error reading link in /dev"); - } - /* We have the name and the target, so update our lists. */ - buf[r] = 0; - list_append (&devls, entry->d_name); - list_append (&devlinks, buf); - } - if (errno) - errexit ("error reading /dev"); - if (closedir (dir)) - errexit ("error closing /dev"); - - /* Now we write our output... */ - size_t count = 0; - while ((i = i->next) != NULL) - { - int isdev = !strcmp (name, i->data); /* current dev == target dev? */ - int present = 0; - size_t li = -1; - const struct list_item_t *l = (const struct list_item_t *)&devlinks; - - /* First, we look for existing symlinks to the target device. */ - while (++li, (l = l->next) != NULL) - { - if (strcmp (l->data, i->data)) - continue; - /* Existing symlink found - don't output a new one. - * If ISDEV, we output the name of the existing symlink. - */ - if (do_link_zero) - return; - present = 1; - if (isdev) - printf (" %s", list_nth (&devls, li)->data); - } - - /* If we found no existing symlinks for the target device... */ - if (!present) - { - char buf[256]; - snprintf (buf, sizeof (buf), count || do_link_zero ? "%s%d" : "%s", - link, count); - /* Find the next available (not present) symlink name. - * We always need to do this for reasons of output consistency: if a - * symlink is created by udev as a result of use of this program, we - * DON'T want different output! - */ - while (list_search (&devls, buf)) - { - if (do_link_zero) - return; - snprintf (buf, sizeof (buf), "%s%d", link, ++count); - } - /* If ISDEV, output it. */ - if (isdev && (numbered_links || count == 0)) - printf (" %s", buf); - /* If the link isn't in our "existing links" list, add it and increment - * our counter. - */ - if (!list_search (&devls, buf)) - { - if (do_link_zero) - return; - list_append (&devls, buf); - ++count; - } - } - } - - list_delete (&devls); - list_delete (&devlinks); -} - - -/* Populate a device list from a capabilities list. */ -static void -populate_device_list (struct list_t *out, const struct list_t *caps) -{ - const struct list_item_t *cap, *dev; - cap = (const struct list_item_t *)caps; - dev = (const struct list_item_t *)&Devices; - while ((cap = cap->next) != NULL && (dev = dev->next) != NULL) - if (cap->data[0] != '0') - list_append (out, dev->data); -} - - -int -main (int argc, char *argv[]) -{ - const cap_dev_t *capdev; - - progname = argv[0]; - debug = argc > 2 && !strcmp (argv[2], "-d"); - - if (argc < 2 || argc > 2 + debug) - msgexit ("usage: cdsymlinks DEVICE [-d]"); - - if (chdir ("/dev")) - errexit ("can't chdir /dev"); - - read_defaults (); - populate_capability_lists (); - - /* Construct the device lists from the capability lists. - * (We assume that all relevant devices can read CDs.) - */ - foreach_cap_dev_noCD (capdev) - populate_device_list (capdev->dev, capdev->cap); - - if (debug) - { - printf ("Devices:"); - const struct list_item_t *item = (const struct list_item_t *)&Devices; - while ((item = item->next) != NULL) - printf (" %s", item->data); - - printf ("\nCDROM : (all)"); - item = (const struct list_item_t *)&dev_CD; - while ((item = item->next) != NULL) - printf (" %s", item->data); - puts (""); - - foreach_cap_dev_noCD (capdev) - { - printf ("%-10s:", capdev->label); - list_print (capdev->cap, stdout); - list_print (capdev->dev, stdout); - puts (""); - } - - } - - /* Write the symlink names. */ - foreach_cap_dev (capdev) - if (list_search (&allowed_output, capdev->label)) - { - do_output (argv[1], capdev->symlink, capdev->dev, 0); - if (link_zero) - do_output (argv[1], capdev->symlink, capdev->dev, 1); - } - puts (""); - - return 0; -} diff --git a/extras/cdsymlinks.conf b/extras/cdsymlinks.conf deleted file mode 100644 index e4c5ee2231..0000000000 --- a/extras/cdsymlinks.conf +++ /dev/null @@ -1,21 +0,0 @@ -# Configuration file for cdsymlinks - -# Output links for these types of devices. -# Allowed keywords are: corresponding to device names: -# CD CDR CDRW cdrom cd-r cdrw -# DVD DVDRW DVDRAM dvd dvdrw dvdram -# CDMRW CDWMRW cdm cdmrw -# CDRAM cdram -# Other words are accepted but ignored. -# Devices with multiple recognised capabilities WILL get multiple links. -#OUTPUT="CD CDRW DVD DVDRW DVDRAM" - -# Whether to output numbered links. -# 1 = output 'cdrom1', 'dvd1' etc. for other devices -# 0 = don't output 'cdrom1', 'dvd1' etc. -# We always output 'cdrom', 'dvd' etc. for the best-match devices. -#NUMBERED_LINKS=1 - -# Whether to output link 0 along with each unnumbered link. -# (No effect if NUMBERED_LINKS=0.) -#LINK_ZERO=0 diff --git a/extras/cdsymlinks.sh b/extras/cdsymlinks.sh deleted file mode 100644 index 592de365cb..0000000000 --- a/extras/cdsymlinks.sh +++ /dev/null @@ -1,204 +0,0 @@ -#! /bin/sh -e -# -# Map cdrom, cd-r, cdrw, dvd, dvdrw, dvdram, cdm, cdmrw, cdram -# to suitable devices. -# Prefers cd* for DVD-incapable and cdrom and dvd for read-only devices. -# First parameter is the kernel device name. -# Second parameter, if present, must be "-d" => output the full mapping. -# -# Usage: -# BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -# BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -# BUS="scsi", KERNEL="scd[0-9]*", PROGRAM="/etc/udev/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -# (this last one is "just in case") -# -# (c) 2004, 2005 Darren Salt -# -# Last modified: 2005-02-15 - -test -e /proc/sys/dev/cdrom/info || exit 0 - -# Defaults; it's better that you alter them in /etc/udev/cdsymlinks.conf -OUTPUT='CD CDRW DVD DVDRW DVDRAM' -NUMBERED_LINKS=1 -LINK_ZERO=0 - -test -e /etc/udev/cdsymlinks.conf && . /etc/udev/cdsymlinks.conf - -DEBUG='' -test "$2" = '-d' && DEBUG=1 - - -# Array emulation. 'setArray FOO a b c' gives FOO=3 FOO_1=a FOO_2=b FOO_3=c -setArray () { - local _ARRAY=$1 - local _INDEX=0 - shift - while test $# -ne 0; do - eval ${_ARRAY}_$_INDEX="$1" - _INDEX=$(($_INDEX+1)) - shift - done - eval $_ARRAY=$_INDEX -} - -ix () { eval echo -n \$$1_$2; } -ixs () { eval $1_$2="$3"; } - -# Args: variable, value -# Returns true if value is not in variable (a whitespace-separated list) -notin () { - test "$2" = '' && return 0 - local i - for i in `eval echo '$'$1`; do - test "$i" != "$2" || return 1 - done -} - - -# Scan /proc/sys/dev/cdrom/info for details on the present devices -setArray DEVICES `sed -re '/^drive name:/I! d; s/.*://' /proc/sys/dev/cdrom/info` -setArray DVDRAMs `sed -re '/^Can write DVD-RAM:/I! d; s/.*://' /proc/sys/dev/cdrom/info` -setArray DVDRWs `sed -re '/^Can write DVD-R:/I! d; s/.*://' /proc/sys/dev/cdrom/info` -setArray DVDs `sed -re '/^Can read DVD:/I! d; s/.*://' /proc/sys/dev/cdrom/info` -setArray CDRWs `sed -re '/^Can write CD-RW:/I! d; s/.*://' /proc/sys/dev/cdrom/info` -setArray CDRs `sed -re '/^Can write CD-R:/I! d; s/.*://' /proc/sys/dev/cdrom/info` -setArray CDMRWs `sed -re '/^Can write MRW:/I! d; s/.*://' /proc/sys/dev/cdrom/info` -setArray CDMs `sed -re '/^Can read MRW:/I! d; s/.*://' /proc/sys/dev/cdrom/info` -setArray CDRAMs `sed -re '/^Can write RAM:/I! d; s/.*://' /proc/sys/dev/cdrom/info` - -# How many devices do we have? -NumDevs=$(($DEVICES-1)) -Count='' -i=-1 -while test $i -ne $NumDevs; do - i=$(($i+1)); - Count="$i${Count:+ }$Count"; -done - -# Fill in any missing capabilities information (assume not capable) -for i in $Count; do - test "`ix DVDRAMs $i`" != '' || ixs DVDRAMs $i 0 - test "`ix DVDRWs $i`" != '' || ixs DVDRWs $i 0 - test "`ix DVDs $i`" != '' || ixs DVDs $i 0 - test "`ix CDRWs $i`" != '' || ixs CDRWs $i 0 - test "`ix CDRs $i`" != '' || ixs CDRs $i 0 - test "`ix CDMRWs $i`" != '' || ixs CDMRWs $i 0 - test "`ix CDMs $i`" != '' || ixs CDMs $i 0 - test "`ix CDRAMs $i`" != '' || ixs CDRAMs $i 0 -done - -DVDRAM='' -DVDRW='' -DVD='' -CDRW='' -CDR='' -CDMRW='' -CDM='' -CDRAM='' -CD='' - -# Calculate symlink->device mappings. -# We need to be careful about how we assign mappings because we want -# read-only devices to have /dev/cdrom and /dev/dvd. -# Hot-plugged CD/DVD devices may well cause this scheme some problems. -for i in $Count; do - test "`ix DVDRAMs $i`" = 1 && DVDRAM="$DVDRAM `ix DEVICES $i`" -done -for i in $Count; do - test "`ix DVDRWs $i`" = 1 && DVDRW="$DVDRW `ix DEVICES $i`" -done -for i in $Count; do - test "`ix DVDs $i`" = 1 && DVD="$DVD `ix DEVICES $i`" -done -for i in $Count; do - test "`ix CDRWs $i`" = 1 && CDRW="$CDRW `ix DEVICES $i`" -done -for i in $Count; do - test "`ix CDRs $i`" = 1 && CDR="$CDR `ix DEVICES $i`" -done -for i in $Count; do - test "`ix CDMRWs $i`" = 1 && CDMRW="$CDMRW `ix DEVICES $i`" -done -for i in $Count; do - test "`ix CDMs $i`" = 1 && CDM="$CDM `ix DEVICES $i`" -done -for i in $Count; do - test "`ix CDRAMs $i`" = 1 && CDRAM="$CDRAM `ix DEVICES $i`" -done -for i in $Count; do - CD="$CD `ix DEVICES $i`" -done - -# Debug output -if test "$DEBUG" = 1; then - echo 'Devices:' `for i in $Count; do ix DEVICES $i; echo -n \ ; done` - echo 'CDROM : (all)' $CD - echo 'CD-R :' `for i in $Count; do ix CDRs $i; echo -n \ ; done` $CDR - echo 'CDRW :' `for i in $Count; do ix CDRWs $i; echo -n \ ; done` $CDRW - echo 'DVD :' `for i in $Count; do ix DVDs $i; echo -n \ ; done` $DVD - echo 'DVDRW :' `for i in $Count; do ix DVDRWs $i; echo -n \ ; done` $DVDRW - echo 'DVDRAM :' `for i in $Count; do ix DVDRAMs $i; echo -n \ ; done` $DVDRAM - echo 'CDMRW :' `for i in $Count; do ix CDMRWs $i; echo -n \ ; done` $CDMRW - echo 'CDWMRW :' `for i in $Count; do ix CDMs $i; echo -n \ ; done` $CDM - echo 'CDRAM :' `for i in $Count; do ix CDRAMs $i; echo -n \ ; done` $CDRAM -fi - -# Prepare symlink names output -do_output () { - test "`eval echo '$'$3`" = '' && return - local i - local COUNT=$4 - local DEVLS="`ls -dl \"/dev/$2\" \"/dev/$2\"[0-9]* 2>/dev/null`" - local PRESENT="`echo "$DEVLS" | - sed -re 's!^.* /dev/('$2'[[:digit:]]*) -> [^[:space:]]+$!\1!'`" - for i in `eval echo '$'$3`; do - # First, we look for existing symlinks to the target device. - local DEVPRESENT="`echo "$DEVLS" | - sed -re 's!^.* /dev/('$2'[[:digit:]]*) -> '$i'$!\1!; t X; d; :X'`" - if test "$DEVPRESENT" != ""; then - # Existing symlinks found - don't output a new one. - # If the target dev ($1) is the current dev ($i), we output their names. - test -z "$4" || return; - test "$1" = "$i" && echo " $DEVPRESENT" | sed -e 'N; $ s/\n/ /' - else - # If we found no existing symlinks for the target device... - # Find the next available (not present) symlink name. - # We always need to do this for reasons of output consistency: if a - # symlink is created by udev as a result of use of this program, we - # DON'T want different output! - until notin PRESENT "$2$COUNT"; do - test -z "$4" || return; - COUNT=$(($COUNT+1)) - done - # If the target dev ($1) is the current dev ($i), we output its name. - if test $(($NUMBERED_LINKS)) -ne 0 || test -z "$COUNT"; then - test "$i" != "$1" || echo -n " $2$COUNT" - fi - # If the link isn't in our "existing links" list, add it and increment - # our counter. - if notin PRESENT "$2$COUNT"; then - test -z "$4" || return; - PRESENT="$PRESENT\n$2$COUNT" - COUNT=$(($COUNT+1)) - fi - fi - done -} - -output () { - do_output "$@" - test $(($LINK_ZERO)) -eq 0 || do_output "$@" 0 -} - -# And output it -notin OUTPUT CD || echo -n "`output "$1" cdrom CD`" -notin OUTPUT CDR || echo -n "`output "$1" cd-r CDR`" -notin OUTPUT CDRW || echo -n "`output "$1" cdrw CDRW`" -notin OUTPUT DVD || echo -n "`output "$1" dvd DVD`" -notin OUTPUT DVDRW || echo -n "`output "$1" dvdrw DVDRW`" -notin OUTPUT DVDRAM || echo -n "`output "$1" dvdram DVDRAM`" -notin OUTPUT CDMRW || echo -n "`output "$1" cdmrw CDM`" -notin OUTPUT CDWMRW || echo -n "`output "$1" cdwmrw CDMRW`" -notin OUTPUT CDRAM || echo -n "`output "$1" cdram CDRAM`" -echo -- cgit v1.2.3-54-g00ecf From 619d548faaad20fbbe4f38a862b1b3e92d1c0f27 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Sep 2005 03:36:45 +0200 Subject: delete docs/persistent_naming - obsoleted by persistent disk names Signed-off-by: Kay Sievers --- docs/persistent_naming/testing_scsi_notes.txt | 201 ---- docs/persistent_naming/udev.rules_1000_scsi_debug | 1014 --------------------- 2 files changed, 1215 deletions(-) delete mode 100644 docs/persistent_naming/testing_scsi_notes.txt delete mode 100644 docs/persistent_naming/udev.rules_1000_scsi_debug diff --git a/docs/persistent_naming/testing_scsi_notes.txt b/docs/persistent_naming/testing_scsi_notes.txt deleted file mode 100644 index 728b40b0fe..0000000000 --- a/docs/persistent_naming/testing_scsi_notes.txt +++ /dev/null @@ -1,201 +0,0 @@ -Using UDEV to do Persistent storage device naming -for large numbers of storage devices -3/16/2004 - -Here are some lessons we learned at OSDL recently on how to use UDEV -(version 021) to do persistent device naming for lots of storage devices. -We used what was available in udev for scsi devices. Here is an outline of -this report: - -Background information - a list of resources we needed to get started. -Setup - what we needed to create the right enviroment (kernel, patches, - drivers) -How udev works to assign persistent storage device names - what the documentation didn't tell us. -Performance - A sanity test we ran to compare with and without persistent naming. - - -BACKGROUND INFORMATION -To get started, here are some references. Review the overview articles so -that the rest of the information makes sense. - -Download the latest udev stuff from: - http://www.kernel.org/pub/linux/utils/kernel/hotplug/ - -mailing list: - linux-hotplug-devel@lists.sourceforge.net - -Here is a nice overview article to get started (warning, this is from -summer 2003 so many items indicated as "todo" have been done and -configuration file name references have sometime changed): -http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf -(also included when you download udev) - -More general info (also included in the udev package): - http://kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ -UDEV version 021 Announcement: - http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=107827264803336&w=2 - -"Managing Dynamic Naming": - http://lwn.net/Articles/28897/ - -If you are a fan of devfs, whatever you do, don't complain until you read -everything you possibly can about udev. This for example: - http://kernel.org/pub/linux/utils/kernel/hotplug/udev_vs_devfs - -You will need to create udev.rules to supply consistent names. (See -etc/udev/udev.rules in the download). This article gives you some -background about udev.rules, but avoids describing the "PROGRAM" key which -is needed for our work. Read it for background: writing udev rules -(current as of udev 018) - http://www.reactivated.net/udevrules.php - -bitkeeper tree: - bk://kernel.bkbits.net/gregkh/udev - -Libsysfs used to get sysfs information): - http://www-124.ibm.com/linux/papers/libsysfs/libsysfs-linuxconfau2004.pdf - -UDEV works using the way hotplug events are handled by the kernel. -Several overview articles about hotplug include: -Hotplug events -http://lwn.net/Articles/52621/ -Overview of Hotplug -http://linux-hotplug.sourceforge.net/ - -Gentoo centric install info: -http://webpages.charter.net/decibelshelp/LinuxHelp_UDEVPrimer.html - -rpms built against Red Hat FC2-test1 may be available at: -http://kernel.org/pub/linux/utils/kernel/hotplug/udev-021-1.i386.rpm - -with the source rpm at: -http://kernel.org/pub/linux/utils/kernel/hotplug/udev-021-1.src.rpm - - - -SETUP - -Here is a brief checklist of what you need on your system for this to -work: - -Kernel must be a 2.6 kernel - -Must use CONFIG_HOTPLUG kernel config option, since the solution is based -on hotplug capabilities. - -To test more than 256 scsi devices you need a patch to the scsi driver to -support that many (available from IBM or SuSE). To see the patch we used, -see this link: -http://developer.osdl.org/maryedie/DCL/PSDN/lotsofdisks.patch - -Your storage device must support (via the driver) a unique identifier for -persistent device naming. (Adaptec RAID device does not, for example.) - -Your device driver must support sysfs (new in 2.6 kernel). This is already -done for scsi devices and most if not all block devices. - -A program (scsi_id) exists in the udev download (extras/scsi_id/scsi_id.c) -for scsi devices. It can read the identifier and is needed for persistent -naming. - - -HOW UDEV WORKS TO ASSIGN PERSISTENT NAMES: - -There are three places where device information is stored that udev -uses: -(1) /sys maintained by sysfs -(2) /etc/udev/udev.rules - where you can store the identifier to NAME - mapping information. -(3) The udevdb, that keeps track the valid system configuration. - It is constructed at boot time and updated with configuration changes. - -The persistent names are kept (at least this is one way to do it) in -udev.rules (uuid and NAME), one entry per device. If you want to initially -give your 1000 disk devices a default name and then make sure those names -are preserved, here is how : - -Start with no special entry in udev.rules when do you an initial boot of -your system with disks in place. Udev will assign default names (there -are ways to control what you want for default too). - -Once the names are assigned, use a script supplied for scsi devices - -udev-021/extras/scsi_id/gen_scsi_id_udev_rules.sh to generate the lines -needed for udev.rules, one per device. Each line indicates the identifier -and the NAME it was assigned. You could optionally create this manually if -you prefer other names . - -[example entries in udev.rules for scsi disks] -BUS="scsi", PROGRAM="scsi_id", RESULT="",NAME="" -BUS="scsi", RESULT="",NAME="" -... -BUS="scsi", RESULT="",NAME="" - -(The actual file we used is the file udev.rules_1000_scsi_debug in this -directory ) - -Upon reboot, for each device a hotplug event occurs. The udev.rules file -is scanned looking for the device type (BUS) in this case for "scsi". The -first entry generated by the above program references a PROGRAM in the key -field (scsi_id) which is called to probe the device and determine the -unique identifier. sysfs is used to determine the major/minor number for -the device. The result of the program execution (the uuid) is compared -with the RESULT entry in the same udev.rules line. - -- If it matches, then the NAME entered on this line is used. The uuid and - major/minor number is saved in the udevdb (newly recreated upon boot). - That device is created in /udev (the target directory name is configurable) - with the assigned NAME. - -- If it doesn't match, the RESULT (uuid) is preserved for use on the next - udev.rules line as long as the bus type (scsi) is the same. So the - result (the uuid) is compared on the next line, and the next until a - match occurs. - -- If no match occurs, the device will be assigned a default name. - -- The udevdb is updated with the resulting name assignment. - - -Thus if the uuid and names are enumerated, they will be found, assigned, -and are therefore permanent. - -If the device is removed from a live system, a hotplug event occurs, and it -is removed from udevdb and the /udev entry disappears. - -If it is re-inserted at a new location, the udev.rules file is scanned as -above. The rule matches again against the uuid, the name in udev.rules -is applied again and the /udev name re-appears. - - - -PERFORMANCE - -Now the question becomes, how much longer does it take to scan the -udev.rules table once there are 1000 entries? - -To test this, we created 1000 "scsi " devices using the scsi debug device -driver supplied in the kernel. When this device driver is loaded you can -specify how many fake scsi devices to create. There is no real I/O -involved but it does respond to some scsi commands. It simulates the uuid -by using the device number assigned when the device is created. - -Then we auto-generated entries into udev.rules with -gen_scsi_id_udev_rules.sh. We then removed the devices and reassigned them -to simulate a reboot. The delta between assigning defaults and assigning -the names enumerated in the udev.rules file was 7 seconds (that's for 1000 -drives). - -Scripts utilized the feature (described above) that saves the "RESULT" key -after one scsi-id program call for later reference with other udev.rules -entries (so only have one PROGRAM key is the moral of the story). If you -repeated the PROGRAM key, you would unnecessarily call the program up to -999 times! - -The script that creates udev.rules did not work for 1000 drives (the input -line is too long). We determined that a patch for this already existed but -had not yet been checked in. - diff --git a/docs/persistent_naming/udev.rules_1000_scsi_debug b/docs/persistent_naming/udev.rules_1000_scsi_debug deleted file mode 100644 index e1598cb829..0000000000 --- a/docs/persistent_naming/udev.rules_1000_scsi_debug +++ /dev/null @@ -1,1014 +0,0 @@ -# -# Start of autogenerated scsi_id rules. Edit the NAME portions of these -# rules to your liking. -# -BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="SSEAGATE ST336704LC 3CD1HVVA00007128JK12", NAME="disk-sda%n" - -# Further RESULT keys use the result of the last PROGRAM rule. -# Be careful not to add any rules containing PROGRAM key between here -# and the end of this section - -BUS="scsi", RESULT="3512345600000afc8", NAME="disk-sdaa%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaaa%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaab%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaac%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdaad%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaae%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaaf%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaag%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaah%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaai%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaaj%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaak%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdaal%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaam%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdaan%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaao%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdaap%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaaq%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaar%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaas%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdaat%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaau%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaav%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaaw%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaax%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaay%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaaz%n" -BUS="scsi", RESULT="3512345600000b3b0", NAME="disk-sdab%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaba%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdabb%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdabc%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdabd%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdabe%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdabf%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdabg%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdabh%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdabi%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdabj%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdabk%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdabl%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdabm%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdabn%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdabo%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdabp%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdabq%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdabr%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdabs%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdabt%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdabu%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdabv%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdabw%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdabx%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaby%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdabz%n" -BUS="scsi", RESULT="3512345600000b798", NAME="disk-sdac%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaca%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdacb%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdacc%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdacd%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdace%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdacf%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdacg%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdach%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaci%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdacj%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdack%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdacl%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdacm%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdacn%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaco%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdacp%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdacq%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdacr%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdacs%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdact%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdacu%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdacv%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdacw%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdacx%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdacy%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdacz%n" -BUS="scsi", RESULT="3512345600000bb80", NAME="disk-sdad%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdada%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdadb%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdadc%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdadd%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdade%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdadf%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdadg%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdadh%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdadi%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdadj%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdadk%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdadl%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdadm%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdadn%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdado%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdadp%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdadq%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdadr%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdads%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdadt%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdadu%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdadv%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdadw%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdadx%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdady%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdadz%n" -BUS="scsi", RESULT="3512345600000bf68", NAME="disk-sdae%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaea%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaeb%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaec%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdaed%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaee%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdaef%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaeg%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdaeh%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaei%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaej%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaek%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdael%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaem%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaen%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaeo%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaep%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaeq%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaer%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaes%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdaet%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaeu%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdaev%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaew%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdaex%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaey%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaez%n" -BUS="scsi", RESULT="3512345600000c350", NAME="disk-sdaf%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdafa%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdafb%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdafc%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdafd%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdafe%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaff%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdafg%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdafh%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdafi%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdafj%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdafk%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdafl%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdafm%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdafn%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdafo%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdafp%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdafq%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdafr%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdafs%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaft%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdafu%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdafv%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdafw%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdafx%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdafy%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdafz%n" -BUS="scsi", RESULT="3512345600000c738", NAME="disk-sdag%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaga%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdagb%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdagc%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdagd%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdage%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdagf%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdagg%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdagh%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdagi%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdagj%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdagk%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdagl%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdagm%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdagn%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdago%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdagp%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdagq%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdagr%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdags%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdagt%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdagu%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdagv%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdagw%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdagx%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdagy%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdagz%n" -BUS="scsi", RESULT="3512345600000cb20", NAME="disk-sdah%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaha%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdahb%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdahc%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdahd%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdahe%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdahf%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdahg%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdahh%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdahi%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdahj%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdahk%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdahl%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdahm%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdahn%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaho%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdahp%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdahq%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdahr%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdahs%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaht%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdahu%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdahv%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdahw%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdahx%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdahy%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdahz%n" -BUS="scsi", RESULT="3512345600000cf08", NAME="disk-sdai%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaia%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdaib%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaic%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdaid%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaie%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaif%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaig%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaih%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaii%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaij%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaik%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdail%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaim%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdain%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaio%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdaip%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdaiq%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdair%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdais%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdait%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaiu%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdaiv%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaiw%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdaix%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaiy%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdaiz%n" -BUS="scsi", RESULT="3512345600000d2f0", NAME="disk-sdaj%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdaja%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdajb%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdajc%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdajd%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaje%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdajf%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdajg%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdajh%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdaji%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdajj%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdajk%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdajl%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdajm%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdajn%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdajo%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdajp%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdajq%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdajr%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdajs%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdajt%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdaju%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdajv%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdajw%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdajx%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdajy%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdajz%n" -BUS="scsi", RESULT="3512345600000d6d8", NAME="disk-sdak%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdaka%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdakb%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdakc%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdakd%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdake%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdakf%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdakg%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdakh%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaki%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdakj%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdakk%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdakl%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdakm%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdakn%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdako%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdakp%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdakq%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdakr%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdaks%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdakt%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdaku%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdakv%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdakw%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdakx%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdaky%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdakz%n" -BUS="scsi", RESULT="3512345600000dac0", NAME="disk-sdal%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdala%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdalb%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdalc%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdald%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdale%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdalf%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdalg%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdalh%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdali%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdalj%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdalk%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdall%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdalm%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdaln%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdalo%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdalp%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdalq%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdalr%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdals%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdalt%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdalu%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdalv%n" -BUS="scsi", RESULT="3512345600000dea8", NAME="disk-sdam%n" -BUS="scsi", RESULT="3512345600000e290", NAME="disk-sdan%n" -BUS="scsi", RESULT="3512345600000e678", NAME="disk-sdao%n" -BUS="scsi", RESULT="3512345600000ea60", NAME="disk-sdap%n" -BUS="scsi", RESULT="3512345600000ee48", NAME="disk-sdaq%n" -BUS="scsi", RESULT="3512345600000f230", NAME="disk-sdar%n" -BUS="scsi", RESULT="3512345600000f618", NAME="disk-sdas%n" -BUS="scsi", RESULT="3512345600000fa00", NAME="disk-sdat%n" -BUS="scsi", RESULT="3512345600000fde8", NAME="disk-sdau%n" -BUS="scsi", RESULT="351234560000101d0", NAME="disk-sdav%n" -BUS="scsi", RESULT="351234560000105b8", NAME="disk-sdaw%n" -BUS="scsi", RESULT="351234560000109a0", NAME="disk-sdax%n" -BUS="scsi", RESULT="35123456000010d88", NAME="disk-sday%n" -BUS="scsi", RESULT="35123456000011170", NAME="disk-sdaz%n" -BUS="scsi", RESULT="SSEAGATE ST336704LC 3CD1HVBC000071283KA0", NAME="disk-sdb%n" -BUS="scsi", RESULT="35123456000011558", NAME="disk-sdba%n" -BUS="scsi", RESULT="35123456000011940", NAME="disk-sdbb%n" -BUS="scsi", RESULT="35123456000011d28", NAME="disk-sdbc%n" -BUS="scsi", RESULT="35123456000012110", NAME="disk-sdbd%n" -BUS="scsi", RESULT="351234560000124f8", NAME="disk-sdbe%n" -BUS="scsi", RESULT="351234560000128e0", NAME="disk-sdbf%n" -BUS="scsi", RESULT="35123456000012cc8", NAME="disk-sdbg%n" -BUS="scsi", RESULT="351234560000130b0", NAME="disk-sdbh%n" -BUS="scsi", RESULT="35123456000013498", NAME="disk-sdbi%n" -BUS="scsi", RESULT="35123456000013880", NAME="disk-sdbj%n" -BUS="scsi", RESULT="35123456000013c68", NAME="disk-sdbk%n" -BUS="scsi", RESULT="35123456000014050", NAME="disk-sdbl%n" -BUS="scsi", RESULT="35123456000014438", NAME="disk-sdbm%n" -BUS="scsi", RESULT="35123456000014820", NAME="disk-sdbn%n" -BUS="scsi", RESULT="35123456000014c08", NAME="disk-sdbo%n" -BUS="scsi", RESULT="35123456000014ff0", NAME="disk-sdbp%n" -BUS="scsi", RESULT="351234560000153d8", NAME="disk-sdbq%n" -BUS="scsi", RESULT="351234560000157c0", NAME="disk-sdbr%n" -BUS="scsi", RESULT="35123456000015ba8", NAME="disk-sdbs%n" -BUS="scsi", RESULT="35123456000015f90", NAME="disk-sdbt%n" -BUS="scsi", RESULT="35123456000016378", NAME="disk-sdbu%n" -BUS="scsi", RESULT="35123456000016760", NAME="disk-sdbv%n" -BUS="scsi", RESULT="35123456000016b48", NAME="disk-sdbw%n" -BUS="scsi", RESULT="35123456000016f30", NAME="disk-sdbx%n" -BUS="scsi", RESULT="35123456000017318", NAME="disk-sdby%n" -BUS="scsi", RESULT="35123456000017700", NAME="disk-sdbz%n" -BUS="scsi", RESULT="35123456000017ae8", NAME="disk-sdca%n" -BUS="scsi", RESULT="35123456000017ed0", NAME="disk-sdcb%n" -BUS="scsi", RESULT="351234560000182b8", NAME="disk-sdcc%n" -BUS="scsi", RESULT="351234560000186a0", NAME="disk-sdcd%n" -BUS="scsi", RESULT="35123456000018a88", NAME="disk-sdce%n" -BUS="scsi", RESULT="35123456000018e70", NAME="disk-sdcf%n" -BUS="scsi", RESULT="35123456000019258", NAME="disk-sdcg%n" -BUS="scsi", RESULT="35123456000019640", NAME="disk-sdch%n" -BUS="scsi", RESULT="35123456000019a28", NAME="disk-sdci%n" -BUS="scsi", RESULT="35123456000019e10", NAME="disk-sdcj%n" -BUS="scsi", RESULT="3512345600001a1f8", NAME="disk-sdck%n" -BUS="scsi", RESULT="3512345600001a5e0", NAME="disk-sdcl%n" -BUS="scsi", RESULT="3512345600001a9c8", NAME="disk-sdcm%n" -BUS="scsi", RESULT="3512345600001adb0", NAME="disk-sdcn%n" -BUS="scsi", RESULT="3512345600001b198", NAME="disk-sdco%n" -BUS="scsi", RESULT="3512345600001b580", NAME="disk-sdcp%n" -BUS="scsi", RESULT="3512345600001b968", NAME="disk-sdcq%n" -BUS="scsi", RESULT="3512345600001bd50", NAME="disk-sdcr%n" -BUS="scsi", RESULT="3512345600001c138", NAME="disk-sdcs%n" -BUS="scsi", RESULT="3512345600001c520", NAME="disk-sdct%n" -BUS="scsi", RESULT="3512345600001c908", NAME="disk-sdcu%n" -BUS="scsi", RESULT="3512345600001ccf0", NAME="disk-sdcv%n" -BUS="scsi", RESULT="3512345600001d0d8", NAME="disk-sdcw%n" -BUS="scsi", RESULT="3512345600001d4c0", NAME="disk-sdcx%n" -BUS="scsi", RESULT="3512345600001d8a8", NAME="disk-sdcy%n" -BUS="scsi", RESULT="3512345600001dc90", NAME="disk-sdcz%n" -BUS="scsi", RESULT="3512345600001e078", NAME="disk-sdda%n" -BUS="scsi", RESULT="3512345600001e460", NAME="disk-sddb%n" -BUS="scsi", RESULT="3512345600001e848", NAME="disk-sddc%n" -BUS="scsi", RESULT="3512345600001ec30", NAME="disk-sddd%n" -BUS="scsi", RESULT="3512345600001f018", NAME="disk-sdde%n" -BUS="scsi", RESULT="3512345600001f400", NAME="disk-sddf%n" -BUS="scsi", RESULT="35123456000007530", NAME="disk-sddg%n" -BUS="scsi", RESULT="35123456000007918", NAME="disk-sddh%n" -BUS="scsi", RESULT="35123456000007d00", NAME="disk-sddi%n" -BUS="scsi", RESULT="351234560000080e8", NAME="disk-sddj%n" -BUS="scsi", RESULT="351234560000084d0", NAME="disk-sddk%n" -BUS="scsi", RESULT="351234560000088b8", NAME="disk-sddl%n" -BUS="scsi", RESULT="35123456000008ca0", NAME="disk-sddm%n" -BUS="scsi", RESULT="35123456000009470", NAME="disk-sddn%n" -BUS="scsi", RESULT="35123456000009858", NAME="disk-sddo%n" -BUS="scsi", RESULT="35123456000009c40", NAME="disk-sddp%n" -BUS="scsi", RESULT="3512345600000a028", NAME="disk-sddq%n" -BUS="scsi", RESULT="3512345600000a410", NAME="disk-sddr%n" -BUS="scsi", RESULT="3512345600000a7f8", NAME="disk-sdds%n" -BUS="scsi", RESULT="3512345600000abe0", NAME="disk-sddt%n" -BUS="scsi", RESULT="3512345600000afc8", NAME="disk-sddu%n" -BUS="scsi", RESULT="3512345600000b3b0", NAME="disk-sddv%n" -BUS="scsi", RESULT="3512345600000b798", NAME="disk-sddw%n" -BUS="scsi", RESULT="3512345600000bb80", NAME="disk-sddx%n" -BUS="scsi", RESULT="3512345600000bf68", NAME="disk-sddy%n" -BUS="scsi", RESULT="3512345600000c350", NAME="disk-sddz%n" -BUS="scsi", RESULT="3512345600000c738", NAME="disk-sdea%n" -BUS="scsi", RESULT="3512345600000cb20", NAME="disk-sdeb%n" -BUS="scsi", RESULT="3512345600000cf08", NAME="disk-sdec%n" -BUS="scsi", RESULT="3512345600000d2f0", NAME="disk-sded%n" -BUS="scsi", RESULT="3512345600000d6d8", NAME="disk-sdee%n" -BUS="scsi", RESULT="3512345600000dac0", NAME="disk-sdef%n" -BUS="scsi", RESULT="3512345600000dea8", NAME="disk-sdeg%n" -BUS="scsi", RESULT="3512345600000e290", NAME="disk-sdeh%n" -BUS="scsi", RESULT="3512345600000e678", NAME="disk-sdei%n" -BUS="scsi", RESULT="3512345600000ea60", NAME="disk-sdej%n" -BUS="scsi", RESULT="3512345600000ee48", NAME="disk-sdek%n" -BUS="scsi", RESULT="3512345600000f230", NAME="disk-sdel%n" -BUS="scsi", RESULT="3512345600000f618", NAME="disk-sdem%n" -BUS="scsi", RESULT="3512345600000fa00", NAME="disk-sden%n" -BUS="scsi", RESULT="3512345600000fde8", NAME="disk-sdeo%n" -BUS="scsi", RESULT="351234560000101d0", NAME="disk-sdep%n" -BUS="scsi", RESULT="351234560000105b8", NAME="disk-sdeq%n" -BUS="scsi", RESULT="351234560000109a0", NAME="disk-sder%n" -BUS="scsi", RESULT="35123456000010d88", NAME="disk-sdes%n" -BUS="scsi", RESULT="35123456000011170", NAME="disk-sdet%n" -BUS="scsi", RESULT="35123456000011558", NAME="disk-sdeu%n" -BUS="scsi", RESULT="35123456000011940", NAME="disk-sdev%n" -BUS="scsi", RESULT="35123456000011d28", NAME="disk-sdew%n" -BUS="scsi", RESULT="35123456000012110", NAME="disk-sdex%n" -BUS="scsi", RESULT="351234560000124f8", NAME="disk-sdey%n" -BUS="scsi", RESULT="351234560000128e0", NAME="disk-sdez%n" -BUS="scsi", RESULT="35123456000012cc8", NAME="disk-sdfa%n" -BUS="scsi", RESULT="351234560000130b0", NAME="disk-sdfb%n" -BUS="scsi", RESULT="35123456000013498", NAME="disk-sdfc%n" -BUS="scsi", RESULT="35123456000013880", NAME="disk-sdfd%n" -BUS="scsi", RESULT="35123456000013c68", NAME="disk-sdfe%n" -BUS="scsi", RESULT="35123456000014050", NAME="disk-sdff%n" -BUS="scsi", RESULT="35123456000014438", NAME="disk-sdfg%n" -BUS="scsi", RESULT="35123456000014820", NAME="disk-sdfh%n" -BUS="scsi", RESULT="35123456000014c08", NAME="disk-sdfi%n" -BUS="scsi", RESULT="35123456000014ff0", NAME="disk-sdfj%n" -BUS="scsi", RESULT="351234560000153d8", NAME="disk-sdfk%n" -BUS="scsi", RESULT="351234560000157c0", NAME="disk-sdfl%n" -BUS="scsi", RESULT="35123456000015ba8", NAME="disk-sdfm%n" -BUS="scsi", RESULT="35123456000015f90", NAME="disk-sdfn%n" -BUS="scsi", RESULT="35123456000016378", NAME="disk-sdfo%n" -BUS="scsi", RESULT="35123456000016760", NAME="disk-sdfp%n" -BUS="scsi", RESULT="35123456000016b48", NAME="disk-sdfq%n" -BUS="scsi", RESULT="35123456000016f30", NAME="disk-sdfr%n" -BUS="scsi", RESULT="35123456000017318", NAME="disk-sdfs%n" -BUS="scsi", RESULT="35123456000017700", NAME="disk-sdft%n" -BUS="scsi", RESULT="35123456000017ae8", NAME="disk-sdfu%n" -BUS="scsi", RESULT="35123456000017ed0", NAME="disk-sdfv%n" -BUS="scsi", RESULT="351234560000182b8", NAME="disk-sdfw%n" -BUS="scsi", RESULT="351234560000186a0", NAME="disk-sdfx%n" -BUS="scsi", RESULT="35123456000018a88", NAME="disk-sdfy%n" -BUS="scsi", RESULT="35123456000018e70", NAME="disk-sdfz%n" -BUS="scsi", RESULT="35123456000019258", NAME="disk-sdga%n" -BUS="scsi", RESULT="35123456000019640", NAME="disk-sdgb%n" -BUS="scsi", RESULT="35123456000019a28", NAME="disk-sdgc%n" -BUS="scsi", RESULT="35123456000019e10", NAME="disk-sdgd%n" -BUS="scsi", RESULT="3512345600001a1f8", NAME="disk-sdge%n" -BUS="scsi", RESULT="3512345600001a5e0", NAME="disk-sdgf%n" -BUS="scsi", RESULT="3512345600001a9c8", NAME="disk-sdgg%n" -BUS="scsi", RESULT="3512345600001adb0", NAME="disk-sdgh%n" -BUS="scsi", RESULT="3512345600001b198", NAME="disk-sdgi%n" -BUS="scsi", RESULT="3512345600001b580", NAME="disk-sdgj%n" -BUS="scsi", RESULT="3512345600001b968", NAME="disk-sdgk%n" -BUS="scsi", RESULT="3512345600001bd50", NAME="disk-sdgl%n" -BUS="scsi", RESULT="3512345600001c138", NAME="disk-sdgm%n" -BUS="scsi", RESULT="3512345600001c520", NAME="disk-sdgn%n" -BUS="scsi", RESULT="3512345600001c908", NAME="disk-sdgo%n" -BUS="scsi", RESULT="3512345600001ccf0", NAME="disk-sdgp%n" -BUS="scsi", RESULT="3512345600001d0d8", NAME="disk-sdgq%n" -BUS="scsi", RESULT="3512345600001d4c0", NAME="disk-sdgr%n" -BUS="scsi", RESULT="3512345600001d8a8", NAME="disk-sdgs%n" -BUS="scsi", RESULT="3512345600001dc90", NAME="disk-sdgt%n" -BUS="scsi", RESULT="3512345600001e078", NAME="disk-sdgu%n" -BUS="scsi", RESULT="3512345600001e460", NAME="disk-sdgv%n" -BUS="scsi", RESULT="3512345600001e848", NAME="disk-sdgw%n" -BUS="scsi", RESULT="3512345600001ec30", NAME="disk-sdgx%n" -BUS="scsi", RESULT="3512345600001f018", NAME="disk-sdgy%n" -BUS="scsi", RESULT="3512345600001f400", NAME="disk-sdgz%n" -BUS="scsi", RESULT="3512345600001f7e8", NAME="disk-sdha%n" -BUS="scsi", RESULT="3512345600001fbd0", NAME="disk-sdhb%n" -BUS="scsi", RESULT="35123456000007d00", NAME="disk-sdhc%n" -BUS="scsi", RESULT="351234560000080e8", NAME="disk-sdhd%n" -BUS="scsi", RESULT="351234560000084d0", NAME="disk-sdhe%n" -BUS="scsi", RESULT="351234560000088b8", NAME="disk-sdhf%n" -BUS="scsi", RESULT="35123456000008ca0", NAME="disk-sdhg%n" -BUS="scsi", RESULT="35123456000009088", NAME="disk-sdhh%n" -BUS="scsi", RESULT="35123456000009470", NAME="disk-sdhi%n" -BUS="scsi", RESULT="35123456000009c40", NAME="disk-sdhj%n" -BUS="scsi", RESULT="3512345600000a028", NAME="disk-sdhk%n" -BUS="scsi", RESULT="3512345600000a410", NAME="disk-sdhl%n" -BUS="scsi", RESULT="3512345600000a7f8", NAME="disk-sdhm%n" -BUS="scsi", RESULT="3512345600000abe0", NAME="disk-sdhn%n" -BUS="scsi", RESULT="3512345600000afc8", NAME="disk-sdho%n" -BUS="scsi", RESULT="3512345600000b3b0", NAME="disk-sdhp%n" -BUS="scsi", RESULT="3512345600000b798", NAME="disk-sdhq%n" -BUS="scsi", RESULT="3512345600000bb80", NAME="disk-sdhr%n" -BUS="scsi", RESULT="3512345600000bf68", NAME="disk-sdhs%n" -BUS="scsi", RESULT="3512345600000c350", NAME="disk-sdht%n" -BUS="scsi", RESULT="3512345600000c738", NAME="disk-sdhu%n" -BUS="scsi", RESULT="3512345600000cb20", NAME="disk-sdhv%n" -BUS="scsi", RESULT="3512345600000cf08", NAME="disk-sdhw%n" -BUS="scsi", RESULT="3512345600000d2f0", NAME="disk-sdhx%n" -BUS="scsi", RESULT="3512345600000d6d8", NAME="disk-sdhy%n" -BUS="scsi", RESULT="3512345600000dac0", NAME="disk-sdhz%n" -BUS="scsi", RESULT="3512345600000dea8", NAME="disk-sdia%n" -BUS="scsi", RESULT="3512345600000e290", NAME="disk-sdib%n" -BUS="scsi", RESULT="3512345600000e678", NAME="disk-sdic%n" -BUS="scsi", RESULT="3512345600000ea60", NAME="disk-sdid%n" -BUS="scsi", RESULT="3512345600000ee48", NAME="disk-sdie%n" -BUS="scsi", RESULT="3512345600000f230", NAME="disk-sdif%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdig%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdih%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdii%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdij%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdik%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdil%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdim%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdin%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdio%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdip%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdiq%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdir%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdis%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdit%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdiu%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdiv%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdiw%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdix%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdiy%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdiz%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdja%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdjb%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdjc%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdjd%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdje%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdjf%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdjg%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdjh%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdji%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdjj%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdjk%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdjl%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdjm%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdjn%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdjo%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdjp%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdjq%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdjr%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdjs%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdjt%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdju%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdjv%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdjw%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdjx%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdjy%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdjz%n" -BUS="scsi", RESULT="35123456000006d60", NAME="disk-sdk%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdka%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdkb%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdkc%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdkd%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdke%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdkf%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdkg%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdkh%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdki%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdkj%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdkk%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdkl%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdkm%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdkn%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdko%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdkp%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdkq%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdkr%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdks%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdkt%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdku%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdkv%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdkw%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdkx%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdky%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdkz%n" -BUS="scsi", RESULT="35123456000007148", NAME="disk-sdl%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdla%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdlb%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdlc%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdld%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdle%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdlf%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdlg%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdlh%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdli%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdlj%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdlk%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdll%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdlm%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdln%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdlo%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdlp%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdlq%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdlr%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdls%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdlt%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdlu%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdlv%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdlw%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdlx%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdly%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdlz%n" -BUS="scsi", RESULT="35123456000007530", NAME="disk-sdm%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdma%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdmb%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdmc%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdmd%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdme%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdmf%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdmg%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdmh%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdmi%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdmj%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdmk%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdml%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdmm%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdmn%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdmo%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdmp%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdmq%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdmr%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdms%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdmt%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdmu%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdmv%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdmw%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdmx%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdmy%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdmz%n" -BUS="scsi", RESULT="35123456000007918", NAME="disk-sdn%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdna%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdnb%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdnc%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdnd%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdne%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdnf%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdng%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdnh%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdni%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdnj%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdnk%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdnl%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdnm%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdnn%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdno%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdnp%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdnq%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdnr%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdns%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdnt%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdnu%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdnv%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdnw%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdnx%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdny%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdnz%n" -BUS="scsi", RESULT="35123456000007d00", NAME="disk-sdo%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdoa%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdob%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdoc%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdod%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdoe%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdof%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdog%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdoh%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdoi%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdoj%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdok%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdol%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdom%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdon%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdoo%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdop%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdoq%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdor%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdos%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdot%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdou%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdov%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdow%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdox%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdoy%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdoz%n" -BUS="scsi", RESULT="351234560000080e8", NAME="disk-sdp%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdpa%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdpb%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdpc%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdpd%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdpe%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdpf%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdpg%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdph%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdpi%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdpj%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdpk%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdpl%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdpm%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdpn%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdpo%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdpp%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdpq%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdpr%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdps%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdpt%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdpu%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdpv%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdpw%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdpx%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdpy%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdpz%n" -BUS="scsi", RESULT="351234560000084d0", NAME="disk-sdq%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdqa%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdqb%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdqc%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdqd%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdqe%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdqf%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdqg%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdqh%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdqi%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdqj%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdqk%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdql%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdqm%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdqn%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdqo%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdqp%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdqq%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdqr%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdqs%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdqt%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdqu%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdqv%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdqw%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdqx%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdqy%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdqz%n" -BUS="scsi", RESULT="35123456000008ca0", NAME="disk-sdr%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdra%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdrb%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdrc%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdrd%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdre%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdrf%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdrg%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdrh%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdri%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdrj%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdrk%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdrl%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdrm%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdrn%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdro%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdrp%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdrq%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdrr%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdrs%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdrt%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdru%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdrv%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdrw%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdrx%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdry%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdrz%n" -BUS="scsi", RESULT="35123456000009088", NAME="disk-sds%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdsa%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdsb%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdsc%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdsd%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdse%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdsf%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdsg%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdsh%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdsi%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdsj%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdsk%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdsl%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdsm%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdsn%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdso%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdsp%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdsq%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdsr%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdss%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdst%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdsu%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdsv%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdsw%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdsx%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdsy%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdsz%n" -BUS="scsi", RESULT="35123456000009470", NAME="disk-sdt%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdta%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdtb%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdtc%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdtd%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdte%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdtf%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdtg%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdth%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdti%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdtj%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdtk%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdtl%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdtm%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdtn%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdto%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdtp%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdtq%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdtr%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdts%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdtt%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdtu%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdtv%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdtw%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdtx%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdty%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdtz%n" -BUS="scsi", RESULT="35123456000009858", NAME="disk-sdu%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdua%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdub%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sduc%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdud%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdue%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sduf%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdug%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sduh%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdui%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sduj%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sduk%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdul%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdum%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdun%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sduo%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdup%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sduq%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdur%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdus%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdut%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sduu%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sduv%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sduw%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdux%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sduy%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sduz%n" -BUS="scsi", RESULT="35123456000009c40", NAME="disk-sdv%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdva%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdvb%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdvc%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdvd%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdve%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdvf%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdvg%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdvh%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdvi%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdvj%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdvk%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdvl%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdvm%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdvn%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdvo%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdvp%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdvq%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdvr%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdvs%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdvt%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdvu%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdvv%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdvw%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdvx%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdvy%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdvz%n" -BUS="scsi", RESULT="3512345600000a028", NAME="disk-sdw%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdwa%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdwb%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdwc%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdwd%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdwe%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdwf%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdwg%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdwh%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdwi%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdwj%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdwk%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdwl%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdwm%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdwn%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdwo%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdwp%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdwq%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdwr%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdws%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdwt%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdwu%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdwv%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdww%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdwx%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdwy%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdwz%n" -BUS="scsi", RESULT="3512345600000a410", NAME="disk-sdx%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdxa%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdxb%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdxc%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdxd%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdxe%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdxf%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdxg%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdxh%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdxi%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdxj%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdxk%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdxl%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdxm%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdxn%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdxo%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdxp%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdxq%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdxr%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdxs%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdxt%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdxu%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdxv%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdxw%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdxx%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdxy%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdxz%n" -BUS="scsi", RESULT="3512345600000a7f8", NAME="disk-sdy%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdya%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdyb%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdyc%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdyd%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdye%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdyf%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdyg%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdyh%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdyi%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdyj%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdyk%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdyl%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdym%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdyn%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdyo%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdyp%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdyq%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdyr%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdys%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdyt%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdyu%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdyv%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdyw%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdyx%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdyy%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdyz%n" -BUS="scsi", RESULT="3512345600000abe0", NAME="disk-sdz%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdza%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdzb%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdzc%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdzd%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdze%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdzf%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdzg%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdzh%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdzi%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdzj%n" -BUS="scsi", RESULT="35123456000022e98", NAME="disk-sdzk%n" -BUS="scsi", RESULT="35123456000023280", NAME="disk-sdzl%n" -BUS="scsi", RESULT="35123456000023668", NAME="disk-sdzm%n" -BUS="scsi", RESULT="35123456000023a50", NAME="disk-sdzn%n" -BUS="scsi", RESULT="3512345600001ffb8", NAME="disk-sdzo%n" -BUS="scsi", RESULT="351234560000203a0", NAME="disk-sdzp%n" -BUS="scsi", RESULT="35123456000020788", NAME="disk-sdzq%n" -BUS="scsi", RESULT="35123456000020b70", NAME="disk-sdzr%n" -BUS="scsi", RESULT="35123456000020f58", NAME="disk-sdzs%n" -BUS="scsi", RESULT="35123456000021340", NAME="disk-sdzt%n" -BUS="scsi", RESULT="35123456000021728", NAME="disk-sdzu%n" -BUS="scsi", RESULT="35123456000021b10", NAME="disk-sdzv%n" -BUS="scsi", RESULT="35123456000021ef8", NAME="disk-sdzw%n" -BUS="scsi", RESULT="351234560000222e0", NAME="disk-sdzx%n" -BUS="scsi", RESULT="351234560000226c8", NAME="disk-sdzy%n" -BUS="scsi", RESULT="35123456000022ab0", NAME="disk-sdzz%n" -# -# End of autogenerated scsi_id rules -# -- cgit v1.2.3-54-g00ecf From b90f1b81895bc4f161794e1aed5784fd98f06571 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Sep 2005 03:38:06 +0200 Subject: delete old Fedora html page Signed-off-by: Kay Sievers --- docs/fedora_udev.html | 258 -------------------------------------------------- 1 file changed, 258 deletions(-) delete mode 100644 docs/fedora_udev.html diff --git a/docs/fedora_udev.html b/docs/fedora_udev.html deleted file mode 100644 index 5d5048766d..0000000000 --- a/docs/fedora_udev.html +++ /dev/null @@ -1,258 +0,0 @@ - - - - - Fedora Project, sponsored by Red Hat - - - - - - - - - - - -
    - - -
    - -  Download -  Projects -  FAQ -
    -
    - -
    - - - -
    -
    Site Navigation:
    -
    - - - - -
    -
     
    -
     
    -
    - -

    Udev on Fedora

    -

    by Harald Hoyer

    -

    - This document tries to reveal the secrets of udev and how it works on Fedora. -

    -

    - udev was developed by Greg Kroah-Hartman <greg@kroah.com> with much - help from Dan Stekloff <dsteklof@us.ibm.com>, Kay Sievers <kay.sievers@vrfy.org>, - and many others. -

    -

    - The udev homepage and the - Linux-hotplug-devel mailing list https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel are the main development sources. -

    -

    - -

    What Does Udev Do?

    -

    - udev provides a dynamic device directory containing only the files for - actually present devices. It creates or removes device node files usually - located in the /dev/ directory, or it renames network interfaces. -

    - As part of the hotplug subsystem, udev is executed if a kernel device - is added or removed from the system. On device creation, udev reads - the sysfs directory of the given device to collect device attributes - like label, serial number or bus device number. These attributes may - be used as keys to determine a unique name for the device. udev maintains - a database for devices present on the system. - On device removal, udev queries its database for the name of the device - file to be deleted. -

    - udev gets called by hotplug, if a module is loaded, and a device is added - or removed. udev looks in /sys/, if the driver provides a "dev" file, which - contains the major and minor number for a device node to communicate with - the driver. After looking in the udev rules (in the /etc/udev/rules.d/ directory), which - specify the device node filename and symlinks, a device node is created - in /dev/ with the permissions, which are specified in /etc/udev/permissions.d/. -

    - After device node creation, removal, or network device renaming, udev - executes the programs in the directory tree under /etc/dev.d/. The - name of a program must end with the .dev suffix, to be recognized. - In addition to the hotplug environment variables, DEVNAME is exported - to make the name of the created node or the name the network device is - renamed to, available to the executed program. The programs in every - directory are sorted in lexical order, while the directories are - searched in the following order: -
      -
    • /etc/dev.d/$(DEVNAME)/*.dev
    • -
    • /etc/dev.d/$(SUBSYSTEM)/*.dev
    • -
    • /etc/dev.d/default/*.dev
    • -
    - -

    How is Udev Integrated on Fedora?

    -

    initrd / initfs

    -

    - mkinitrd copies /sbin/udev.static - to the initrd /sbin/udev and symlinks it to - /sbin/udevstart. -

    -After the kernel boots, it executes the nash script of the initrd. This -mounts a tmpfs filesystem on /dev/. Instead of hotplug /sbin/udev is -called in the initrd phase. udevstart creates all device nodes for the -devices, which are compiled in the kernel and for the modules, which -are loaded by nash.

    - -

    Problems

    - -The whole udev and hotplug infrastructure is -not available in initrd. Thus no hotplug scripts, udev rules, and -permissions and no /etc/dev.d/ scripts are executed for any hotplug -event, which is sent from the kernel. - -

    rc.sysinit

    -

    First, if SELinux is loaded and enabled, -the context of /dev/ is set. rc.sysinit calls /sbin/start_udev. -start_udev mounts a tmpfs filesystem on /dev/, if there is none already -mounted. Then it creates some device nodes, which need module -autoloading, or where there is no kernel module. After that -/sbin/udevstart is called again, which simulates the hotplug events in -the initrd phase, to apply the whole udev rules and permissions. After -that rc.sysinit parses the ouput of /sbin/kmodule and loads every -module. This should provide device nodes for all hardware found on your -computer.

    -

    Console User Permissions

    -

    -/etc/dev.d/default/pam_console.dev is called whenever a device node is -created and calls /sbin/pam_console_setowner with the filename (and an -optional symlink) of the device node. This sets the permissions for -console users like specified in /etc/security/console.perms.

    -

    Customizing Udev on Fedora

    -

    - Read the manpage of udev and udevinfo. - Please try not to modify the files of RPM packages. -

    -

    New Rules

    -

    -New rules should be placed in a file, which ends in .rules in -/etc/udev/rules.d/. Please do not use 50-udev.rules. The supported and -preferred way is to create rules without the "NAME" tag and only -create "SYMLINK"s.

    - A nice document describing how to write rules can be found on http://www.reactivated.net/udevrules.php. -

    - -

    Permissions

    -New permissions should be placed in a file, which ends in -.permissions in /etc/udev/permissions.d/. Please do not use -50-udev.permissions. - -

    But I Really Want My Device Node!

    -

    - Put them in /etc/udev/devices/, and they will get copied to /dev/. File a bugzilla entry, if you think that should be done per default. -

    - -

    Updating to udev Without /dev/

    -

    - The steps to upgrade without Anaconda or a rescue CD are (NOT recommended): -

    - -
      -
    • start from a kernel-2.6 -
    • Make sure /sys/ is mounted -
    • Install the latest initscripts package -
    • Install the latest udev package -
    • Execute /sbin/start_udev -
    • Install the latest mkinitrd package -
    • Install the latest kernel package -
    • Or execute mkinitrd for your existing kernel(s) -
    - -

    Udev without initrd

    - -

    Install Fedore Core as usual and reboot. Execute the following commands -

    - -
    -
    -mkdir /tmp/dev
    -mount --move /dev /tmp/dev
    -sbin/MAKEDEV null console zero
    -mount --move /tmp/dev /dev
    -
    - Install your kernel without an initrd. Reboot. -

    - You will get some SELinux errors, and syslogd will not work as expected. -

    -

    Current Problems on Fedora

    -

    - All open bugs for udev -

    -

    Nvidia

    -

    Quick solution: If you do not need rhgb, just load the nvidia module in /etc/rc.local -

    - If you have udev >= 032-5, load the nvidia module: -

    -
    -
    -cp -a /dev/nvidia* /etc/udev/devices
    -chown root.root /etc/udev/devices/nvidia*
    -
    - -

    The Bugzilla for this problem is 133900.

    -

    Palm Pilot

    -

    - If you have udev >= 032-5, execute the command: -

    -
    -
    -ln -s ttyUSB1 /etc/udev/devices/pilot
    -
    - -

    ISDN

    -

    - If you have udev >= 032-5: -

    -
    -
    -/sbin/MAKEDEV -d /etc/udev/devices isdn
    -
    - - - - - -
    -
     
    -
     
    -
    - - - - - - - - -- cgit v1.2.3-54-g00ecf From 14e31b3502b5748068e9367cf4a0d42d9e6cfbf2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Sep 2005 03:49:23 +0200 Subject: add "totally outdated" header to docs/overview :) Signed-off-by: Kay Sievers --- docs/overview | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/overview b/docs/overview index 350d53ee70..87c1d1df10 100644 --- a/docs/overview +++ b/docs/overview @@ -1,5 +1,11 @@ - -We've got a couple goals for udev: +------------------------------------------------------------------------- + This is a proposal from the early days of udev. A lot of the things + mentioned here are implemented differently and most of the features + implemented in udev are not part of that document. + This document is only kept in the tree for sentimental reasons. +------------------------------------------------------------------------- + +We've got a couple of goals for udev: 1) dynamic replacement for /dev 2) device naming -- cgit v1.2.3-54-g00ecf From 86eeb30e0c349ea7aab1713b0ede29029043ca54 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Sep 2005 03:53:54 +0200 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/udev.rules | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/etc/udev/suse/udev.rules b/etc/udev/suse/udev.rules index 51d182a307..a674f9b510 100644 --- a/etc/udev/suse/udev.rules +++ b/etc/udev/suse/udev.rules @@ -20,7 +20,6 @@ KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" # video/graphics SUBSYSTEM=="video4linux", GROUP="video" SUBSYSTEM=="graphics" GROUP="video" -KERNEL=="video*", NAME="%k", GROUP="video" KERNEL=="vtx*", NAME="%k", GROUP="video" KERNEL=="vbi*", NAME="%k", GROUP="video" KERNEL=="winradio*", NAME="%k", GROUP="video" @@ -29,6 +28,8 @@ KERNEL=="nvidia*", NAME="%k", GROUP="video" KERNEL=="nvidiactl*", NAME="%k", GROUP="video" KERNEL=="video0", SYMLINK+="video" KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="pmu", GROUP="video" # dvb SUBSYSTEM="dvb", PROGRAM="/bin/sh -c 'X=%k X=$${X#dvb} A=$${X%%%%.*} D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" @@ -63,6 +64,7 @@ KERNEL=="ts*", NAME="input/%k", MODE="0600" KERNEL=="uinput", NAME="input/%k", MODE="0600" KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" SUBSYSTEM=="input_device", RUN+="/sbin/udev.input_device.sh" +SUBSYSTEM=="input_device", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" # printer SUBSYSTEM=="usb", KERNEL=="lp*", ACTION=="add", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" @@ -199,13 +201,13 @@ KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # by-path (shortest physical path) -KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="sr*", GOTO="persistent_end" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -KERNEL=="sr*", GOTO="persistent_end" IMPORT{program}="/sbin/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -- cgit v1.2.3-54-g00ecf From aab571f3621de595dfb2b014040520804c71796c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Sep 2005 12:24:18 +0200 Subject: fix useless but funny name_cdrom.pl script to work again Signed-off-by: Kay Sievers --- extras/name_cdrom.pl | 46 ++++++++++++++++------------------------------ 1 file changed, 16 insertions(+), 30 deletions(-) diff --git a/extras/name_cdrom.pl b/extras/name_cdrom.pl index 766f6f366a..5e696f33ae 100644 --- a/extras/name_cdrom.pl +++ b/extras/name_cdrom.pl @@ -2,45 +2,31 @@ # a horribly funny script that shows how flexible udev can really be # This is to be executed by udev with the following rules: -# KERNEL="[hs]d[a-z]", PROGRAM="name_cdrom.pl %M %m", NAME="%c{1}", SYMLINK="cdrom" +# +# KERNEL="hd*[!0-9]|sr*", PROGRAM="name_cdrom.pl $tempnode", SYMLINK+="%c" use strict; use warnings; -use CDDB_get qw( get_cddb ); - -my $dev_node = "/tmp/cd_foo"; +use CDDB_get qw(get_cddb); # following variables just need to be declared if different from defaults my %config; -$config{CDDB_HOST}="freedb.freedb.org"; # set cddb host -$config{CDDB_PORT}=8880; # set cddb port -$config{CDDB_MODE}="cddb"; # set cddb mode: cddb or http -$config{CD_DEVICE}="$dev_node"; # set cd device - -# No user interaction, this is a automated script! -$config{input}=0; +$config{'CDDB_HOST'} = "freedb.freedb.org"; # set cddb host +$config{'CDDB_PORT'} = 8880; # set cddb port +$config{'CDDB_MODE'} = "cddb"; # set cddb mode: cddb or http +$config{'CD_DEVICE'} = $ARGV[0]; # set cd device +$config{'input'} = 0; # no user interaction -my $major = $ARGV[0]; -my $minor = $ARGV[1]; +my %cd = get_cddb(\%config); -# create our temp device node to read the cd info from -unlink($dev_node); -if (system("mknod $dev_node b $major $minor")) { - die "bad mknod failed"; +if (!defined $cd{title}) { + exit 1; } -# get it on -my %cd=get_cddb(\%config); +# print out our cd name +$cd{artist} =~ s/ /_/g; +$cd{title} =~ s/ /_/g; +print "$cd{artist}-$cd{title}\n"; -# remove the dev node we just created -unlink($dev_node); - -# print out our cd name if we have found it or skip rule by nonzero exit -if (defined $cd{title}) { - $cd{artist} =~ s/ /_/g; - $cd{title} =~ s/ /_/g; - print "$cd{artist}-$cd{title}\n"; -} else { - exit -1; -} +exit 0; -- cgit v1.2.3-54-g00ecf From f432183eb8cfdd21a4445c77273d6aa4f2d1c5dd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Sep 2005 12:45:09 +0200 Subject: update TODO Signed-off-by: Kay Sievers --- TODO | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/TODO b/TODO index 63e518feeb..a992547377 100644 --- a/TODO +++ b/TODO @@ -1,14 +1,19 @@ This is a short list of things that needs to be done. They are in no specific -order. I will gladly accept patches for any of these items, or any other stuff -people offer up. +order. We will gladly accept patches for any of these items: -greg k-h -greg@kroah.com +- More documentation: + Allmost all extras/*_id/ programs don't have a man page + some details are missing in the udev man pages. +- Completely replace the built-in wait_for_sysfs stuff in udev_sysfs.c + by rules using the WAIT_FOR_SYSFS key. + +- Log the relationship of the kernel name and the persistent disk name + to syslog, so any error logged from the kernel can be associated with + any of the links. + +- Do generic early boot logic: + initramfs, pivot-root, cover coldplug or event replay, etc... + +- Keep the distro rules in etc/ up-to-date. -- more documentation (can never have too much.) -- persuade the distro packagers to submit their changes (or just steal them - if we can find them...) -- do early boot logic (putting udev into initramfs, handle pivot-root, - etc.) -- solve world hunger -- cgit v1.2.3-54-g00ecf From 609435bad66d5b33db367c341ab528239044d346 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Fri, 9 Sep 2005 12:38:58 +0200 Subject: firmware_helper: fix write count --- extras/firmware/firmware_helper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/firmware/firmware_helper.c b/extras/firmware/firmware_helper.c index 7b7a307298..45815137ac 100644 --- a/extras/firmware/firmware_helper.c +++ b/extras/firmware/firmware_helper.c @@ -118,9 +118,9 @@ int main(int argc, char **argv) { count = 0; while (count < fw_buffer_size) { - int c; + ssize_t c; - c = write(fw_fd, fw_buffer+count, fw_buffer_size); + c = write(fw_fd, fw_buffer+count, fw_buffer_size-count); if (c <= 0) { rc = errno; close(fw_fd); -- cgit v1.2.3-54-g00ecf From 7a526da67da5be9522af02c2c10511a088402356 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 10 Sep 2005 23:35:30 +0200 Subject: Makefile: fix prerequisits for $(PROGRAMS) Signed-off-by: Kay Sievers --- Makefile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 80364c2a7a..07f57519ab 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,6 @@ HEADERS = \ udev.h \ udev_utils.h \ udev_rules.h \ - udev_version.h \ udev_db.h \ udev_sysfs.h \ logging.h \ @@ -229,19 +228,27 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) done; .PHONY: all -$(PROGRAMS): $(HOST_PROGS) $(KLCC) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) - $(QUIET) $(CC) $(CFLAGS) -c -o $@.o $@.c - $(QUIET) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +# clear implicit rules +.SUFFIXES: + +# build the objects +%.o: %.c + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + +# "Static Pattern Rule" to build all programs +$(PROGRAMS): %: $(HOST_PROGS) $(KLCC) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) %.o + $(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) $(QUIET) $(STRIPCMD) $@ -# our own copy of klibc if KLCC is specified it will not be used +# our own copy of klibc, it is not used if KLCC is given $(KLCC): - $(MAKE) -j1 -C klibc KRNLSRC=$(KERNEL_DIR) SUBDIRS=klibc TESTS= \ + $(MAKE) -C klibc KRNLSRC=$(KERNEL_DIR) SUBDIRS=klibc TESTS= \ SHLIBDIR=$(KLIBC_INSTALL)/lib \ INSTALLDIR=$(KLIBC_INSTALL) \ bindir=$(KLIBC_INSTALL)/bin \ mandir=$(KLIBC_INSTALL)/man all install -find $(KLIBC_INSTALL)/include -name SCCS -print| xargs rm -rf +.NOTPARALLEL: $(KLCC) $(UDEV_OBJS): $(KLCC) $(LIBUDEV): $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS) @@ -276,9 +283,6 @@ udev_version.h: xmlto man $? .PRECIOUS: %.8 -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< - ccdv: ccdv.c @$(HOSTCC) -O1 ccdv.c -o ccdv .SILENT: ccdv -- cgit v1.2.3-54-g00ecf From 17d3cb12882f71f19a78beb26054054628423703 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Sep 2005 14:21:14 +0200 Subject: Makefile: cleanup install targets Split into individual target and never remove any config file. Signed-off-by: Kay Sievers --- Makefile | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 07f57519ab..773041b02f 100644 --- a/Makefile +++ b/Makefile @@ -194,6 +194,7 @@ ifeq ($(strip $(USE_KLIBC)),true) LD = $(KLCC) else CFLAGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations + LDFLAGS += -Wl,-warn-common endif ifeq ($(strip $(USE_SELINUX)),true) @@ -227,6 +228,7 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) -C $$target $@; \ done; .PHONY: all +.DEFAULT: all # clear implicit rules .SUFFIXES: @@ -288,8 +290,8 @@ ccdv: ccdv.c .SILENT: ccdv clean: - -find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print | xargs rm -f - -rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS) + - find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print0 | xargs -0rt rm -f + - rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS) $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ @@ -342,7 +344,7 @@ uninstall-man: - rm $(mandir)/man8/udevcontrol.8 .PHONY: uninstall-man -install: install-config install-man all +install-bin: $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL_PROGRAM) -D udev $(DESTDIR)$(sbindir)/udev $(INSTALL_PROGRAM) -D udevd $(DESTDIR)$(sbindir)/udevd @@ -361,13 +363,9 @@ endif echo $$target; \ $(MAKE) prefix=$(prefix) -C $$target $@; \ done; -.PHONY: install +.PHONY: install-bin -uninstall: uninstall-man - - rm $(configdir)/rules.d/50-udev.rules - - rm $(configdir)/udev.conf - - rmdir $(configdir)/rules.d - - rmdir $(configdir) +uninstall-bin: - rm $(sbindir)/udev - rm $(sbindir)/udevd - rm $(sbindir)/udevsend @@ -379,16 +377,24 @@ uninstall: uninstall-man - rm $(usrbindir)/udevinfo - rm $(usrbindir)/udevtest - rm -rf $(udevdb) - - rmdir $(udevdir) - killall udevd @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ $(MAKE) prefix=$(prefix) -C $$target $@; \ done; -.PHONY: uninstall-man +.PHONY: uninstall-bin + +install: all install-bin install-config install-man +.PHONY: install + +uninstall: uninstall-bin uninstall-man +.PHONY: uninstall test tests: all @ cd test && ./udev-test.pl @ cd test && ./udevstart-test.pl .PHONY: test tests +buildtest: + ./test/simple-build-check.sh + -- cgit v1.2.3-54-g00ecf From 852cc0f58dba9d101abf86880aaea4880222de47 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Sep 2005 14:28:59 +0200 Subject: remove chassis_id program Broken and unmaintained! Signed-off-by: Kay Sievers --- extras/chassis_id/Makefile | 51 ------------------- extras/chassis_id/README | 28 ----------- extras/chassis_id/chassis_id.c | 91 ---------------------------------- extras/chassis_id/chassis_id.h | 42 ---------------- extras/chassis_id/install.txt | 49 ------------------- extras/chassis_id/provision.tbl | 5 -- extras/chassis_id/table.c | 106 ---------------------------------------- extras/chassis_id/udev.rules | 7 --- 8 files changed, 379 deletions(-) delete mode 100644 extras/chassis_id/Makefile delete mode 100644 extras/chassis_id/README delete mode 100644 extras/chassis_id/chassis_id.c delete mode 100644 extras/chassis_id/chassis_id.h delete mode 100644 extras/chassis_id/install.txt delete mode 100644 extras/chassis_id/provision.tbl delete mode 100644 extras/chassis_id/table.c delete mode 100644 extras/chassis_id/udev.rules diff --git a/extras/chassis_id/Makefile b/extras/chassis_id/Makefile deleted file mode 100644 index ae5c95961c..0000000000 --- a/extras/chassis_id/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# * -# * Makefile -# * -# * Copyright (C) 2004 Intel Corporation. All rights reserved. -# * -# * This program is free software; you can redistribute it and/or -# * modify it under the terms of the GNU General Public -# * License v2.0 as published by the Free Software Foundation; -# * -# * 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., 59 Temple Place - Suite 330, -# * Boston, MA 021110-1307, USA. -# * -# * Authors: Atul Sabharwal -# * -# * - -TARGET = chassis_id - -exec_prefix = ${prefix} -sbindir = ${exec_prefix}/sbin -INSTALL = /usr/bin/install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -all: chassis_id - -ifneq ($(strip $(USE_KLIBC)),true) -chassis_id: chassis_id.c table.c - $(QUIET) $(CC) -o $(TARGET) $(CFLAGS) chassis_id.c table.c - -install: all - $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(sbindir)/$(TARGET) -else -chassis_id: - @echo - @echo "!!! chassis_id is incompatible with klibc !!!" - @echo - @exit 0 - -install: all -endif - -clean: - rm -rf core a.out $(TARGET) - diff --git a/extras/chassis_id/README b/extras/chassis_id/README deleted file mode 100644 index 51add4945e..0000000000 --- a/extras/chassis_id/README +++ /dev/null @@ -1,28 +0,0 @@ - README.txt - ~~~~~~~~~~ -Chassis_id is a callout program which is used to give geographic names to devices. It uses -another callout program scsi_id to determine the serial number of a device and then looks up -the provisioning table based on this key. It retrieves geographic information -( chassis#, slot# and host# ) about the device and prints it to stdout. These fields are -used by udev to create the device entry. - -Using Udev: -~~~~~~~~~~ -Chassis_id gets invoked by udev using the udev as below: - -BUS="scsi", PROGRAM="/usr/local/bin/chassis_id", NAME="/chassis%c{1}/slot%c{2}/host%c{3}/disk-%c{4} - -The provisioning table ( file provision.tbl ) has to be put in /usr/local/bin and as of now has -to be populated manually. This is the only place where the geographic map of devices is kept -in the system. - - -Usage Model: -~~~~~~~~~~~~ -On ATCA based blade architecture systems, blade insertion/removal is common. We create names -in a 3 level deep tree which represent the geographic map of the devices. - - -CONTACT: -~~~~~~~~ -Please feel free to contact atul.sabharwal@intel.com with questions, comments, suggestions. diff --git a/extras/chassis_id/chassis_id.c b/extras/chassis_id/chassis_id.c deleted file mode 100644 index de86087921..0000000000 --- a/extras/chassis_id/chassis_id.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * chassis_id.c - * - * Copyright (C) 2004 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License v 2.0 as published by the Free Software Foundation; - * - * 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., 59 Temple Place - Suite 330, - * Boston, MA 021110-1307, USA. - * - * Authors: Atul Sabharwal - * - */ - -#include -#include -#include - -#include "chassis_id.h" - -//#define DEBUG 1 - -/* Run SCSI id to find serial number of the device */ -static int getserial_number(char * devpath, char * snumber) -{ - FILE *fp; - char vendor[255], model[255], cmd[255]; - int retval; - - sprintf(cmd, "/sbin/scsi_id -s %s -p 0x80", devpath); - - fp = popen(cmd, "r"); - - if (fp == NULL) - return -ERROR_BAD_SNUMBER; - - fscanf(fp, "%s %s %s", vendor, model, snumber); - #ifdef DEBUG - syslog(LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", snumber ); - #endif - - retval = pclose(fp); - if (retval == -1) - return -ERROR_BAD_SNUMBER; - else - return NO_ERROR; -} - -int main(int argc, char **argv, char **envp) -{ - int chassis_num, slot_num, retval; - char disk_snum[255], devpath[255]; - char *ptr; - int disk_index; - - syslog( LOG_PID| LOG_DAEMON| LOG_ERR, "\n%s", "starting chassis_id" ); - - ptr = getenv("DEVPATH"); - if (ptr == NULL) - return -ERROR_NO_DEVPATH; - - sscanf(ptr, "%s", &devpath[0]); - #ifdef DEBUG - syslog(LOG_PID|LOG_DAEMON| LOG_ERR, "Devpath %s", devpath); - #endif - - retval = table_init(); - if (retval < 0) - return -ERROR_BAD_TABLE; - - getserial_number(devpath, disk_snum); - - /* Now we open the provisioning table t find actual entry for the serial number*/ - disk_index = table_find_disk(disk_snum, &chassis_num, &slot_num); - if ( disk_index == -1 ) { - // typical provisioning error - return -ERROR_NO_DISK; - } else { - table_select_disk( disk_index ); - } - return 0; -} diff --git a/extras/chassis_id/chassis_id.h b/extras/chassis_id/chassis_id.h deleted file mode 100644 index 1463bd22c7..0000000000 --- a/extras/chassis_id/chassis_id.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * chassis_id.h - * - * Copyright (C) 2004 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License v 2.0 as published by the Free Software Foundation; - * - * 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., 59 Temple Place - Suite 330, - * Boston, MA 021110-1307, USA. - * - * Authors: Atul Sabharwal - * - */ - -#ifndef _CHASSIS_ID_H -#define _CHASSIS_ID_H - -//#define DEBUG 1 -#define ERROR 1 -#define ERROR_NO_SLOT 2 -#define ERROR_NO_CHASSIS 3 -#define ERROR_NO_DEVPATH 4 -#define ERROR_BAD_SNUMBER 5 -#define ERROR_NO_DISK 6 -#define ERROR_BAD_TABLE 7 -#define ERROR_BAD_SCAN 8 -#define NO_ERROR 0 - -extern int table_init(void); -extern int table_find_disk(const char *serialnumber , int *chassis_num, int *slot_num); -extern int table_select_disk(int diskindex); - -#endif diff --git a/extras/chassis_id/install.txt b/extras/chassis_id/install.txt deleted file mode 100644 index a567afedcf..0000000000 --- a/extras/chassis_id/install.txt +++ /dev/null @@ -1,49 +0,0 @@ - -Udev does not come pre-installed on a Linux system. Hence, we need to do the following before -a Linux system is ready :: - -Steps: -~~~~~ -1. Install libsysfs shared libraries by installing sysfsutils-0.4.0. - -2. Download latest version of udev from www.kernel.org site. It is - under repository->utils->kernel path chain. - - Do make and make install so as to install udev. To install scsi_id, - go into extras/scsi_id folder to compile scsi_id. Typically, this - would be in /sbin folder. Now, change scsi_id.cfg and set the - global option to work with all devices ( -g) and comment out the - black list option ( -b ). - -3. Download chassis_id callout code and compile. Install chassis_id and - provision.tbl file in /usr/local/bin. - -4. In /etc/rc.sysinit, add mount command to mount the sys memory file - system. ( mount -t sysfs sys /sys ). The /sys is necessary as - lot of the software components expect it to be in /sys. - -5. Now, in /etc/udev/udev.rules, install the udev rules file. This - is the GDN config file which is used by udev to create folders - in the form chasis/slot/port/disk

    . - -6. Now, you are almost there. Refer to PROVISIONING file. - - -PROVISIONING: -1. For GDN, the provisioning file is in the format : - - - SCSI host on which the device is connected - how many disks on this blade ? - chassis Number - Physical slot number - Serial Number for the disk - Name of the disk device. - -2. To fill the provisioning table, the user needs to collect this information and - fill provision.tbl. - - The serial number is found from the command scsi_id -p 0x80 -s . - - The host number is availble from the sys file system. The chassis & slot - are visual data and should be enetered into provision.tbl. diff --git a/extras/chassis_id/provision.tbl b/extras/chassis_id/provision.tbl deleted file mode 100644 index c137fd537f..0000000000 --- a/extras/chassis_id/provision.tbl +++ /dev/null @@ -1,5 +0,0 @@ -id host number_of_disks chassis# slot# serial# name -1 1 2 1 2 3BM07NKA000070456Z6B disk1 -2 1 2 1 2 3BM07R68000070456ZCK disk2 -3 2 2 1 3 3EV08ANK00007219JAVA disk3 -4 2 2 1 4 3EV00NZB000072190Y90 disk4 diff --git a/extras/chassis_id/table.c b/extras/chassis_id/table.c deleted file mode 100644 index ee64ecc774..0000000000 --- a/extras/chassis_id/table.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * table.c - * - * Copyright (C) 2004 Intel Corporation. All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public - * License v2.0 as published by the Free Software Foundation; - * - * 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., 59 Temple Place - Suite 330, - * Boston, MA 021110-1307, USA. - * - * Authors: Atul Sabharwal - * - */ - -#include -#include - -#include "chassis_id.h" - -#define TABLE_SIZE 100 -#define PROVISION_DB "/usr/local/bin/provision.tbl" - -struct provision_record -{ - int id; - int num_disks; - int chassis_num; - int slot_num; - char serial_num[32]; - char name[32]; -} ptable[TABLE_SIZE]; - -int ptable_size; - -/* Initialize the provisioning table by reading the data from special file provision.tbl * - Return error if something does not work appropriately. */ -int table_init(void) -{ - FILE *fp; - char ptr[255]; - int i; - - fp = fopen( PROVISION_DB, "r"); - - if ((fp== NULL) || feof(fp)) - return -1; - - // skip the first line of text which contains descriptive details. - fgets(ptr, 80, fp); - i = 0; - while (!feof(fp)) { - fgets(ptr, 80, fp); - sscanf(ptr, "%d %d %d %d %s %s", &ptable[i].id, - &ptable[i].num_disks, - &ptable[i].chassis_num, &ptable[i].slot_num, - ptable[i].serial_num, ptable[i].name); - i++; - } - - ptable_size = i; - fclose(fp); - return 0; -} - - -/* return -1 when no disk found. Otherwise return index of disk */ -int table_find_disk(const char *serialnumber , int *chassis_num, int *slot_num) -{ - int i; - - for (i = 0; i < ptable_size; i++) { - if (strcmp(ptable[i].serial_num, serialnumber) == 0) { - *chassis_num = ptable[i].chassis_num; - *slot_num = ptable[i].slot_num; - break; - } - } - - if (i == ptable_size) - return -1; - else - return i; -} - -/* This function is primarily there for passing the selected disk entry to udev - * so that it can create descriptive GDN for it. So, for that we need to output - * this data to stdout. - */ -int table_select_disk(int diskindex) -{ - printf("%d ", ptable[diskindex].chassis_num); - printf("%d ", ptable[diskindex].slot_num); - printf("%s ", ptable[diskindex].name); - - return 0; -} - diff --git a/extras/chassis_id/udev.rules b/extras/chassis_id/udev.rules deleted file mode 100644 index b1618c1b0b..0000000000 --- a/extras/chassis_id/udev.rules +++ /dev/null @@ -1,7 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# See the udev.rules.examples file for more examples of how to create rules -# - -BUS="scsi", PROGRAM="/usr/local/bin/chassis_id", NAME="/chassis%c{1}/slot%c{2}/%c{3}" -- cgit v1.2.3-54-g00ecf From a8b38f1c44c8a925bef467c7fbca7812dfbf86f8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Sep 2005 15:26:33 +0200 Subject: fic gcov use and move it into the Makefile Signed-off-by: Kay Sievers --- Makefile | 37 ++++++++++++++++ README-gcov_for_udev | 108 ---------------------------------------------- docs/README-gcov_for_udev | 90 ++++++++++++++++++++++++++++++++++++++ make_gcov.sh | 53 ----------------------- run_gcov.sh | 40 ----------------- 5 files changed, 127 insertions(+), 201 deletions(-) delete mode 100644 README-gcov_for_udev create mode 100644 docs/README-gcov_for_udev delete mode 100644 make_gcov.sh delete mode 100644 run_gcov.sh diff --git a/Makefile b/Makefile index 773041b02f..2017e7be3b 100644 --- a/Makefile +++ b/Makefile @@ -27,6 +27,10 @@ USE_LOG = true # to print the debug messages to syslog) DEBUG = false +# compile with gcc's code coverage option +# (use it with DEBUG, works only with glibc) +USE_GCOV = false + # include Security-Enhanced Linux support USE_SELINUX = false @@ -186,6 +190,11 @@ else STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment endif +ifeq ($(strip $(USE_GCOV)),true) + CFLAGS += -fprofile-arcs -ftest-coverage + LDFLAGS = -fprofile-arcs +endif + # if our own version of klibc is used, we need to build it ifeq ($(strip $(USE_KLIBC)),true) KLIBC_INSTALL = $(PWD)/klibc/.install @@ -291,6 +300,10 @@ ccdv: ccdv.c clean: - find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print0 | xargs -0rt rm -f + - find -name "*.gcno" -print0 | xargs -0rt rm -f + - find -name "*.gcda" -print0 | xargs -0rt rm -f + - find -name "*.gcov" -print0 | xargs -0rt rm -f + - rm -f udev_gcov.txt - rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS) $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)"; for target in $$extras; do \ @@ -397,4 +410,28 @@ test tests: all buildtest: ./test/simple-build-check.sh +.PHONY: buildtest + +gcov-all: + $(MAKE) clean all DEBUG=true USE_GCOV=true + @echo + @echo "binaries built with gcov support." + @echo "run the tests and analyze with 'make udev_gcov.txt'" +.PHONY: gcov-all + +# see docs/README-gcov_for_udev +udev_gcov.txt: $(wildcard *.gcda) $(wildcard *.gcno) + for file in `find -maxdepth 1 -name "*.gcno"`; do \ + name=`basename $$file .gcno`; \ + echo "################" >> $@; \ + echo "$$name.c" >> $@; \ + echo "################" >> $@; \ + if [ -e "$$name.gcda" ]; then \ + gcov -l "$$name.c" >> $@ 2>&1; \ + else \ + echo "code for $$name.c was never executed" >> $@ 2>&1; \ + fi; \ + echo >> $@; \ + done; \ + echo "view $@ for the result" diff --git a/README-gcov_for_udev b/README-gcov_for_udev deleted file mode 100644 index ca832803a2..0000000000 --- a/README-gcov_for_udev +++ /dev/null @@ -1,108 +0,0 @@ -################################################ - -Using GCC's code coverage tool, gcov, with udev - -################################################ - -For more information on using gcov please see: - -http://gcc.gnu.org/onlinedocs/gcc/Gcov.html - -With that said, here is how to get code coverage analysis for udev files. -Note that this was developed with udev version 024. - -- Make sure you've installed udev and that it is working properly. - If you are having problems, refer to the README and HOWTO-udev_for_dev - documents in udev tarball. I've also compiled a udev_for_dev - toubleshooting document for Red Hat which can be found in: - - docs/rh_udev_for_dev.txt - -- execute make_gcov.sh from udev top level directory - - ./make_gcov.sh - - This will compile udev with gcov support. Basically make_gcov.sh will - run make but override the CFLAGS. It strips any optimization from - CFLAGS in order for gcov to get correct code coverage analysis. It will - also add the -fprofile-arcs and -ftest-coverage options which are the - necessary flags needed to use gcov. - - make_gcov.sh will assume the same default parameters as the regular - make but also accepts the same parameters. For example if you want - to get code coverage analysis for udev with the DEBUG flag turned - on, you would just execute: - - ./make_gcov.sh DEBUG=true - - There is one exception, gcov will not work with klibc as it does not - compile cleanly with the -fprofile-arcs and -ftest-coverage flags. - With this said it is pretty much useless to set the KERNEL_DIR flag - when using make_gcov.sh as well. - - Don't be alarmed if you look into your udev directory and see that it - has been polluted with a bunch of *.bb, *.bbg, *.da, and *.gcov files. - gcov creates and uses these files to extract the code coverage info. - -- After running make_gcov.sh you need to install udev again. So basically, - - su to root - make install - -- Then execute some udev tasks. You can run some udev tests, reboot, or - do anything your little udev heart desires. Once you are satisfied, you - can now see how much udev code was covered. I personally recommend just - running test/udev-test.pl for starters. - -- To get the udev code coverage analysis, execute run_gcov.sh from udev top - level directory. You need to be root to do this. - - su to root - ./run_gcov.sh - -- This creates udev_gcov.txt in the udev top level directory which holds all - the code coverage information. To see an example of the code coverage info - after executing the udev-test.pl test, please see: - - http://developer.osdl.org/ogasawara/gcov_for_udev/udev_gcov.txt - -- Also, after having executed gcov on udev (ie executing run_gcov.sh) a - *.gcov file is created for every file which contained code that was - used. Looking at the *.gcov files, one will see what lines of code - were hit, and what lines were missed. For, example if code in udev-add.c - were executed, gcov then created a file called udev-add.c.gcov. And a - portion of udev-add.c.gov might look like: - - static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) - 95 { - 95 struct sysfs_attribute *attr = NULL; - - 95 attr = sysfs_get_classdev_attr(class_dev, "dev"); - 95 if (attr == NULL) - ###### goto error; - dbg("dev='%s'", attr->value); - - 95 if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2) - ###### goto error; - dbg("found major=%d, minor=%d", udev->major, udev->minor); - - 95 return 0; - error: - ###### return -1; - } - - Any line of code that is preceded by a "######" implies that the code - was never hit during execution. - -- Once you are done with using gcov for udev and want to return to your - normal use of udev. Simply, - - ./make_gcov.sh clean - - This will clean out all the *.bb, *.bbg, *.da, *.gcov files produced by gcov. - It will also run a regular make clean on your udev directory. Then just run - a regular make and make install and you are back to normal: - - make - su to root - make isntall diff --git a/docs/README-gcov_for_udev b/docs/README-gcov_for_udev new file mode 100644 index 0000000000..c223dc38e8 --- /dev/null +++ b/docs/README-gcov_for_udev @@ -0,0 +1,90 @@ +################################################ + +Using GCC's code coverage tool, gcov, with udev + +Leann Ogasawara , April 2004 + +################################################ + +For more information on using gcov please see: + +http://gcc.gnu.org/onlinedocs/gcc/Gcov.html + +With that said, here is how to get code coverage analysis for udev files. +Note that this was developed with udev version 024. + +- Make sure you've installed udev and that it is working properly. + If you are having problems, refer to the README and HOWTO-udev_for_dev + documents in udev tarball. + +- execute make_gcov.sh from udev top level directory + + make gcov-all + + This will compile udev with gcov support. Basically make_gcov.sh will + run make but override the CFLAGS. It strips any optimization from + CFLAGS in order for gcov to get correct code coverage analysis. It will + also add the -fprofile-arcs and -ftest-coverage options which are the + necessary flags needed to use gcov. + + If you look into your udev directory and see that it has been polluted with + a bunch of *.gcno, *.gcda and *.gcov files. gcov creates and uses these files + to extract the code coverage info. + +- After running make_gcov.sh you need to install udev again. So basically, + + su to root + make install + +- Then execute some udev tasks. You can run some udev tests, reboot, or + do anything your little udev heart desires. Once you are satisfied, you + can now see how much udev code was covered. I personally recommend just + running test/udev-test.pl for starters. + +- To get the udev code coverage analysis, execute run_gcov.sh from udev top + level directory. You need to be root to do this. + + su to root + make udev_gcov.txt + +- This creates udev_gcov.txt in the udev top level directory which holds all + the code coverage information. To see an example of the code coverage info + after executing the udev-test.pl test, please see: + + http://developer.osdl.org/ogasawara/gcov_for_udev/udev_gcov.txt + +- Also, after having executed gcov on udev (ie executing run_gcov.sh) a + *.gcov file is created for every file which contained code that was + used. Looking at the *.gcov files, one will see what lines of code + were hit, and what lines were missed. For, example if code in udev-add.c + were executed, gcov then created a file called udev-add.c.gcov. And a + portion of udev-add.c.gov might look like: + + static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) + 95 { + 95 struct sysfs_attribute *attr = NULL; + + 95 attr = sysfs_get_classdev_attr(class_dev, "dev"); + 95 if (attr == NULL) + ###### goto error; + dbg("dev='%s'", attr->value); + + 95 if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2) + ###### goto error; + dbg("found major=%d, minor=%d", udev->major, udev->minor); + + 95 return 0; + error: + ###### return -1; + } + + Any line of code that is preceded by a "######" implies that the code + was never hit during execution. + +- Once you are done with using gcov for udev and want to return to your + normal use of udev, run a regular 'make clean' on your udev directory. + Then just run a regular make and make install and you are back to normal: + + make clean all + su to root + make install diff --git a/make_gcov.sh b/make_gcov.sh deleted file mode 100644 index e3ceb96d07..0000000000 --- a/make_gcov.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# gcov capability for udev -# -# Provides code coverage analysis for udev. -# -# make_gcov.sh assumes the same same default parameters as make, but also -# accepts the same parameters as make (see README file in udev/ for -# parameter info). There is one exception, klibc can not be used with -# gcov as it will not compile cleanly. -# -# make_gcov.sh then overrides CFLAGS to strip out optimization in order -# for gcov to get correct code coverage analysis. -# -# Leann Ogasawara , April 2004 - -# clean up udev dir -clean_udev () { - find -name "*.gcno" -exec rm -f "{}" \; - find -name "*.gcda" -exec rm -f "{}" \; - find -name "*.gcov" -exec rm -f "{}" \; - rm -f udev_gcov.txt - make clean -} - -PWD=`pwd` -GCCINCDIR=`gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"` -LIBSYSFS="-I$PWD/libsysfs/sysfs -I$PWD/libsysfs" -WARNINGS="-Wall -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations" -GCC="-I$GCCINCDIR" -USE_LOG="-DUSE_LOG" -DEBUG="-D_GNU_SOURCE" -GCOV_FLAGS="-pipe -fprofile-arcs -ftest-coverage" - -for i in $*; do - pre=`echo $i | sed 's/=.*//g'` - post=`echo $i | sed 's/.*=//g'` - if [ $pre = "USE_KLIBC" ] && [ $post = "true" ]; then - echo "cannot use gcov with klibc, will not compile" - exit - elif [ $pre = "USE_LOG" ] && [ $post = "false" ]; then - USE_LOG="" - elif [ $pre = "DEBUG" ] && [ $post = "true" ]; then - DEBUG="-g -DDEBUG -D_GNU_SOURCE" - elif [ $pre = "clean" ]; then - clean_udev - exit - fi -done - -clean_udev - -make $* CFLAGS="$WARNINGS $GCOV_FLAGS $USE_LOG $DEBUG $GCC $LIBSYSFS" LDFLAGS="-Wl,-warn-common -fprofile-arcs" diff --git a/run_gcov.sh b/run_gcov.sh deleted file mode 100644 index ad6a62b130..0000000000 --- a/run_gcov.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -# -# run gcov on udev -# -# Generate code coverage analysis for udev files -# -# This requires that you compiled udev with gcov flags i.e. -# you should have compiled udev with the make_gcov.sh script. -# -# Leann Ogasawara , April 2004 - -PWD=`pwd` - -# check if root else may not have access to *.da files -# and gcov analysis will fail. -if [ $(id -u) -ne 0 ]; then - echo "please become root before executing run_gcov.sh" - exit 1 -fi - -echo > udev_gcov.txt -echo "CODE COVERAGE ANALYSIS FOR UDEV" >> udev_gcov.txt -echo >> udev_gcov.txt - -for file in `find -maxdepth 1 -name "*.gcno"`; do - name=`basename $file .gcno` - echo "################" >> udev_gcov.txt - echo "$name.c" >> udev_gcov.txt - echo "################" >> udev_gcov.txt - if [ -e "$name.gcda" ]; then - gcov -l "$name.c" >> udev_gcov.txt 2>&1 - else - echo "code for $name.c was never executed" >> udev_gcov.txt 2>&1 - echo "no code coverage analysis to be done" >> udev_gcov.txt 2>&1 - fi - echo >> udev_gcov.txt -done - -echo "udev gcov analysis done. View udev_gcov.txt for results." -- cgit v1.2.3-54-g00ecf From 9d97f3bb7974103efb9602e2066b95e4cb529e53 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Sep 2005 16:00:09 +0200 Subject: FAQ: update things that have changed Signed-off-by: Kay Sievers --- FAQ | 92 +++++++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 49 insertions(+), 43 deletions(-) diff --git a/FAQ b/FAQ index bd9d63a4d5..1b9e56d8c5 100644 --- a/FAQ +++ b/FAQ @@ -1,40 +1,40 @@ Frequently Asked Questions about udev - Q: What's this udev thing, and what is it trying to do? A: Read the OLS 2003 paper about udev, available in the docs/ directory, and at: - + There is also a udev presentation given at OLS 2003 available at: - + Q: How is udev related to devfs? -A: udev works entirely in userspace, using /sbin/hotplug calls that the - kernel makes whenever a device is added or removed from the kernel. All - naming policy, and permission control is done in userspace. devfs - operated from within the kernel. +A: udev works entirely in userspace, using hotplug events the kernel sends + whenever a device is added or removed from the kernel. Details about + the devices are exported by the kernel to the sysfs filesystem at /sys + All device naming policy permission control and event handling is done in + userspace. devfs is operated from within the kernel. -Q: Why was devfs marked OBSOLETE if udev is not finished yet? +Q: Why was devfs marked OBSOLETE/removed if udev can't do everthing devfs did? A: To quote Al Viro (Linux VFS kernel maintainer): - - it was determined that the same thing could be done in userspace - - devfs had been shoved into the tree in hope that its quality will - catch up - - devfs was found to have fixable and unfixable bugs - - the former had stayed around for many months with maintainer - claiming that everything works fine - - the latter had stayed, period. - - the devfs maintainer/author disappeared and stopped maintaining - the code. + - it was determined that the same thing could be done in userspace + - devfs had been shoved into the tree in hope that its quality will + catch up + - devfs was found to have fixable and unfixable bugs + - the former had stayed around for many months with maintainer + claiming that everything works fine + - the latter had stayed, period. + - the devfs maintainer/author disappeared and stopped maintaining + the code. Q: But udev will not automatically load a driver if a /dev node is opened when it is not present like devfs will do. -A: If you really require this functionality, then use devfs. It is still - present in the kernel. +A: Right, but Linux is supposed to load a module when a device is discovered + not to load a module when it's accessed. Q: But wait, I really want udev to automatically load drivers when they are not present but the device node is opened. It's the only reason I like using devfs. Please make udev do this. -A: No. udev is for managing /dev, not loading kernel drivers. +A: No. udev is for managing /dev, not loading kernel drivers. Q: Oh come on, pretty please. It can't be that hard to do. A: Such a functionality isn't needed on a properly configured system. All @@ -53,9 +53,14 @@ A: The devfs approach caused a lot of spurious modprobe attempts as Q: I really like the devfs naming scheme, will udev do that? A: Yes, udev can create /dev nodes using the devfs naming policy. A configuration file needs to be created to map the kernel default names - to the devfs names. See the initial udev.rules.devfs file in the udev - release. It is the start of such a configuration file. If there are - any things missing, please let the udev authors know. + to the devfs names. See the udev.rules.devfs file in the udev + release. + Note that the devfs scheme is not recommended or officially supported + cause it is a really stupid idea to simply enumerate devices in a world + where devices can come and go at any time. These numbers give you nothing + but problems, and are not useful to identify a device. Have a look at the + persistent disk rules for an example how to do it correctly in userspace + without any stupid device enumeration. Q: What kinds of devices does udev create nodes for? A: All devices that are shown in sysfs will work with udev. If more @@ -70,29 +75,30 @@ A: udev is entirely in userspace. If the kernel supports a greater number of anonymous devices, udev will support it. Q: Will udev support symlinks? -A: Yes, It now does. Multiple symlinks per device node too. +A: Yes, It now does. Multiple symlinks per device node are supported. Q: How will udev handle the /dev filesystem? -A: /dev can be a ramfs, or a backing filesystem. udev does not care what - kind of filesystem it runs on. +A: /dev is recomended to be a tmpfs filesystem that is recreated on every reboot. + Although, udev does not care what kind of filesystem it runs on. Q: How will udev handle devices found before init runs? -A: udev will be placed in initramfs and run for every device that is found. - Work to get this implemented is still underway. +A: udev can be placed in initramfs and run for every device that is found. + udev can also populate an initial /dev directory from the content of /sys + after the real root is mounted. Q: Can I use udev to automount a USB device when I connect it? -A: Technically, yes, but udev is not intended for this. Projects that do - automount hotplugged storage devices are: - * Usb-mount http://users.actrix.co.nz/michael/usbmount.html - * devlabel http://linux.dell.com/projects.shtml#devlabel - - Alternatively, it is easy to add the following to fstab: - /udev/pendrive /pendrive vfat user,noauto 0 0 +A: Technically, yes, but udev is not intended for this. All major distributions + use HAL (http://freedesktop.org/wiki/Software_2fhal) for this, which also + watches devices with removable media and integrates into the desktop software. + + Alternatively, it is easy to add the following to fstab: + /dev/disk/by-label/PENDRIVE /media/PENDRIVE vfat user,noauto 0 0 This means that users can access the device with: - $ mount /pendrive - And don't have to be root but will get full permissions on /pendrive. - This works even without udev if /udev/pendrive is replaced by /dev/sda1 + $mount /media/PENDRIVE + and doen't have to be root, but will get full permissions on the device. + Using the persistent disk links (label, uuid) will always catch the + same device regardless of the actual kernel name. Q: Are there any security issues that I should be aware of? A: When using dynamic device numbers, a given pair of major/minor numbers may @@ -103,15 +109,15 @@ A: When using dynamic device numbers, a given pair of major/minor numbers may If the device node is later recreated with different permissions the hard link can still be used to access the device using the old permissions. (The same problem exists when using PAM to change permissions on login.) - + The simplest solution is to prevent the creation of hard links by putting - /dev in a separate filesystem (tmpfs, ramfs, ...). - + /dev in a separate filesystem like tmpfs. + Q: I have other questions about udev, where do I ask them? A: The linux-hotplug-devel mailing list is the proper place for it. The address for it is linux-hotplug-devel@lists.sourceforge.net Information on joining can be found at - + Archives of the mailing list can be found at: - + -- cgit v1.2.3-54-g00ecf From a2c7b2173ab1c365157d07795a58a5e37a083c04 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 13 Sep 2005 10:24:51 -0700 Subject: 069 release --- ChangeLog | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b18208e245..1e39f722c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,72 @@ +Summary of changes from v068 to v069 +============================================ + +Amir Shalem: + fix typo in firmware_helper + +Duncan Sands: + firmware_helper: fix write count + +Kay Sievers: + *_id: fix zero length in set_str() + add program name to logged error + fix exit code of udevinitsend and udevmonitor + udevd: keep the right order for messages without SEQNUM + volume_id: don't probe for mac_partition_maps + udevmonitor: cleanup on exit + path_id: remove SUSE specific PATH + update SUSE rules + add pci_express to bus list + update SUSE rules + store ENV{key}="value" exported keys in the database + fix lookup for name in the udevdb, it should return the devpath + prepare for new HAL udevdb dump + print persistent data with "udevinfo -q all" + change parameter order of udev_db_search_name() + add and use name_list_cleanup() for cleaning up the string lists + don't store devpath in udevdb, we don't need it + add uft8 validation for safe volume label exporting + start to enforce plain ascii or valid utf8 + use WRITE_END/READ_END for the pipe index + remove not needed sig_flag for state of signal_pipe + don't reenter get_udevd_msg() if message is ignored + rename ...trailing_char() to ...trailing_chars() + vol_id: ID_LABEL_SAFE will no longer contain fancy characters + udevd: move some logging to "info" and "err" + remove special TIMEOUT handling from incoming queue + udev_test.pl: we replace untrusted chars with '_' + check the udevdb before assigning a new %e + update RELEASE-NOTES + udevinfo: add database export + write man page masters in DocBook XML + udevinfo: rename dump() to export() + test the automatic man page rebuild and checkin + Makefile: remove all the duplicated rules + all man pages rewritten to use DocBook XML + add missing udevsend man page + also forgot udevmonitor.8 + udevinfo: restore -d option + scsi_id: rename SYSFS to LIBSYSFS + add edd_id tool to match BIOS EDD disk information + move and update libsysfs.txt + klibc: update to version 1.1.1 + delete cdromsymlinks* - obsoleted by cdrom_id and IMPORT rules + delete docs/persistent_naming - obsoleted by persistent disk names + delete old Fedora html page + add "totally outdated" header to docs/overview :) + update SUSE rules + fix useless but funny name_cdrom.pl script to work again + update TODO + Makefile: fix prerequisits for $(PROGRAMS) + Makefile: cleanup install targets + remove chassis_id program + fic gcov use and move it into the Makefile + FAQ: update things that have changed + +Thierry Vignaud: + switch to '==' in raid-devfs.sh + + Summary of changes from v067 to v068 ============================================ diff --git a/Makefile b/Makefile index 2017e7be3b..95b657c47c 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 068 +VERSION = 069 # set this to make use of syslog USE_LOG = true diff --git a/udev.spec b/udev.spec index 25bc2d7f2c..4997528257 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace device manager providing devfs functionality Name: udev -Version: 068 +Version: 069 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 23fd5f886c6847fd1917cefd7cb6d3eba0b9df1d Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 13 Sep 2005 10:39:07 -0700 Subject: fix scsi_id rule in gentoo config file --- etc/udev/gentoo/udev.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index f1e38b8d87..cba8e677c2 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -262,8 +262,8 @@ KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MOD KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p -d %N" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p -d %N" KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From 8c65c6a1be91dd3a3da2b5c3b304ec02ad3c67f9 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Tue, 13 Sep 2005 14:10:27 -0700 Subject: fix nbd error messages with a gentoo rule hack --- etc/udev/gentoo/udev.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index cba8e677c2..0c705f778d 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -250,6 +250,7 @@ KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" # Skip all of this if we are not adding a block device ACTION!="add", GOTO="persistent_end" SUBSYSTEM!="block", GOTO="persistent_end" +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" # skip accessing removable ide devices, cause the ide drivers are horrible broken BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" -- cgit v1.2.3-54-g00ecf From 1ac216b198e559163b1c81eca2f1c9a635d8e326 Mon Sep 17 00:00:00 2001 From: Jürg Billeter Date: Wed, 14 Sep 2005 14:27:28 +0200 Subject: EXTRAS/Makefile: fix install targets to match main Makefile --- Makefile | 12 ++++++++++++ extras/ata_id/Makefile | 4 ++-- extras/cdrom_id/Makefile | 4 ++-- extras/dasd_id/Makefile | 4 ++-- extras/edd_id/Makefile | 4 ++-- extras/firmware/Makefile | 4 ++-- extras/floppy/Makefile | 4 ++-- extras/run_directory/Makefile | 4 ++-- extras/scsi_id/Makefile | 11 ++++++++--- extras/usb_id/Makefile | 4 ++-- extras/volume_id/Makefile | 4 ++-- 11 files changed, 38 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 95b657c47c..7e3adb975b 100644 --- a/Makefile +++ b/Makefile @@ -333,6 +333,10 @@ install-config: $(GEN_CONFIGS) echo "pick a udev rules file from the etc/udev directory that matches your distribution"; \ echo; \ fi + @extras="$(EXTRAS)"; for target in $$extras; do \ + echo $$target; \ + $(MAKE) prefix=$(prefix) -C $$target $@; \ + done; .PHONY: install-config install-man: @@ -344,6 +348,10 @@ install-man: $(INSTALL_DATA) -D udevsend.8 $(DESTDIR)$(mandir)/man8/udevsend.8 $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 + @extras="$(EXTRAS)"; for target in $$extras; do \ + echo $$target; \ + $(MAKE) prefix=$(prefix) -C $$target $@; \ + done; .PHONY: install-man uninstall-man: @@ -355,6 +363,10 @@ uninstall-man: - rm $(mandir)/man8/udevmonitor.8 - rm $(mandir)/man8/udevsend.8 - rm $(mandir)/man8/udevcontrol.8 + @extras="$(EXTRAS)"; for target in $$extras; do \ + echo $$target; \ + $(MAKE) prefix=$(prefix) -C $$target $@; \ + done; .PHONY: uninstall-man install-bin: diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index eab01ad9ab..769b7e3c2d 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -43,8 +43,8 @@ clean: spotless: clean -install: all +install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) -uninstall: +uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index 6ea5f14ec1..c6dfc4e1a8 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -44,8 +44,8 @@ clean: spotless: clean -install: all +install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) -uninstall: +uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index f2c0595de0..23331ce14c 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -43,8 +43,8 @@ clean: spotless: clean -install: all +install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) -uninstall: +uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 627884a329..aa3db4f209 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -43,8 +43,8 @@ clean: spotless: clean -install: all +install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) -uninstall: +uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index 343d5295f1..5632e0dee5 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -44,8 +44,8 @@ clean: spotless: clean -install: all +install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) -uninstall: +uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 5380590c9b..b7915fc484 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -43,8 +43,8 @@ clean: spotless: clean -install: all +install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) -uninstall: +uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index c1a83e3c0b..38ef7b128e 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -45,9 +45,9 @@ clean: spotless: clean -install: all +install-bin: all $(INSTALL_PROGRAM) $(DEVD) $(DESTDIR)$(sbindir)/$(DEVD) $(INSTALL_PROGRAM) $(HOTPLUGD) $(DESTDIR)$(sbindir)/$(HOTPLUGD) -uninstall: +uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(DEVD) diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 3c38d6171e..3b75e165fb 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -46,18 +46,23 @@ all: $(PROG) # XXX use a compressed man page? -install: all +install-bin: all $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + +install-man: $(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 + +install-config: @if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \ echo $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir); \ $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \ fi -uninstall: +uninstall-bin: -rm $(DESTDIR)$(sbindir)/$(PROG) + +uninstall-man: -rm $(DESTDIR)$(mandir)/man8/scsi_id.8 - -rm $(DESTDIR)$(etcdir)/scsi_id.config GEN_HEADER=scsi_id_version.h diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 4347fba407..10dd09da21 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -44,8 +44,8 @@ clean: spotless: clean -install: all +install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) -uninstall: +uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 8ca3bd1333..c1dd74f0f7 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -47,8 +47,8 @@ clean: spotless: clean -install: all +install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) -uninstall: +uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) -- cgit v1.2.3-54-g00ecf From b4f192f054410bf9ddd04b770f0b46f0fd25abce Mon Sep 17 00:00:00 2001 From: Amir Shalem Date: Wed, 14 Sep 2005 14:28:13 +0200 Subject: udevd: fix udevd read() calls to leave room for null byte --- udevd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index 96d4fbb3be..e227a64d71 100644 --- a/udevd.c +++ b/udevd.c @@ -195,7 +195,7 @@ static int running_processes(void) if (f == -1) return -1; - len = read(f, buf, sizeof(buf)); + len = read(f, buf, sizeof(buf)-1); close(f); if (len <= 0) @@ -244,7 +244,7 @@ static int running_processes_in_session(pid_t session, int limit) if (f == -1) continue; - len = read(f, line, sizeof(line)); + len = read(f, line, sizeof(line)-1); close(f); if (len <= 0) -- cgit v1.2.3-54-g00ecf From 129979643f5ae0363cef23978bce5d546be2f77d Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 14 Sep 2005 14:28:59 +0200 Subject: fix a debug text typo in udev_rules.c --- udev_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_rules.c b/udev_rules.c index 7c73356831..ad3629d39d 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -648,7 +648,7 @@ found: } pos = getenv(attr); if (pos == NULL) { - dbg("env '%s' not avialable", attr); + dbg("env '%s' not available", attr); break; } dbg("substitute env '%s=%s'", attr, pos); -- cgit v1.2.3-54-g00ecf From 726b21604aa5132090a6be1068da7f58069849ab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Sep 2005 14:29:59 +0200 Subject: volume_id: fix error handling with failing read() Signed-off-by: Kay Sievers --- extras/volume_id/vol_id.c | 1 + extras/volume_id/volume_id/util.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 3c75bdaa2f..2b53085c72 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -145,6 +145,7 @@ int main(int argc, char *argv[]) if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) size = 0; + dbg("BLKGETSIZE64=%llu", size); if (volume_id_probe_all(vid, 0, size) == 0) goto print; diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index 62b96a3657..d1271a86be 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -197,7 +197,7 @@ set: uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) { - size_t buf_len; + ssize_t buf_len; dbg("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); /* check if requested area fits in superblock buffer */ @@ -224,7 +224,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) } dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->sbbuf_len = buf_len; - if (buf_len < off + len) { + if ((size_t)buf_len < off + len) { dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); return NULL; } @@ -261,7 +261,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); id->seekbuf_off = off; id->seekbuf_len = buf_len; - if (buf_len < len) { + if ((size_t)buf_len < len) { dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); return NULL; } -- cgit v1.2.3-54-g00ecf From db28d2ea4f95aee82ec3619546546eb1506be46a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Sep 2005 17:00:02 +0200 Subject: EXTRAS: cleanup and sync all Makefiles Signed-off-by: Kay Sievers --- Makefile | 17 +++--- extras/ata_id/Makefile | 54 ++++++++++++------ extras/cdrom_id/Makefile | 61 ++++++++++++++------- extras/dasd_id/Makefile | 54 ++++++++++++------ extras/edd_id/Makefile | 54 ++++++++++++------ extras/firmware/Makefile | 54 +++++++++++------- extras/floppy/Makefile | 53 ++++++++++++------ extras/run_directory/Makefile | 65 +++++++++++++--------- extras/scsi_id/Makefile | 124 ++++++++++++++++++++++-------------------- extras/usb_id/Makefile | 54 +++++++++++------- extras/volume_id/Makefile | 60 ++++++++++++-------- test/simple-build-check.sh | 1 - 12 files changed, 409 insertions(+), 242 deletions(-) diff --git a/Makefile b/Makefile index 7e3adb975b..46d5365694 100644 --- a/Makefile +++ b/Makefile @@ -147,8 +147,6 @@ STRIP = $(CROSS)strip RANLIB = $(CROSS)ranlib HOSTCC = gcc -export CROSS CC AR STRIP RANLIB CFLAGS LDFLAGS LIB_OBJS - # code taken from uClibc to determine the current arch ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/powerpc/ppc/g'} @@ -229,7 +227,12 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ $(MAKE) prefix=$(prefix) \ + CC="$(CC)" \ + CFLAGS="$(CFLAGS)" \ LD="$(LD)" \ + LDFLAGS="$(LDFLAGS)" \ + STRIPCMD="$(STRIPCMD)" \ + LIB_OBJS="$(LIB_OBJS)" \ LIBUDEV="$(PWD)/$(LIBUDEV)" \ LIBSYSFS="$(PWD)/$(LIBSYSFS)" \ KERNEL_DIR="$(KERNEL_DIR)" \ @@ -243,7 +246,7 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) .SUFFIXES: # build the objects -%.o: %.c +%.o: %.c $(GEN_HEADERS) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ # "Static Pattern Rule" to build all programs @@ -379,15 +382,15 @@ install-bin: $(INSTALL_PROGRAM) -D udevinfo $(DESTDIR)$(usrbindir)/udevinfo $(INSTALL_PROGRAM) -D udevtest $(DESTDIR)$(usrbindir)/udevtest $(INSTALL_PROGRAM) -D udevstart $(DESTDIR)$(sbindir)/udevstart + @extras="$(EXTRAS)"; for target in $$extras; do \ + echo $$target; \ + $(MAKE) prefix=$(prefix) -C $$target $@; \ + done; ifndef DESTDIR - killall udevd - rm -rf $(udevdb) - $(sbindir)/udevd --daemon endif - @extras="$(EXTRAS)"; for target in $$extras; do \ - echo $$target; \ - $(MAKE) prefix=$(prefix) -C $$target $@; \ - done; .PHONY: install-bin uninstall-bin: diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index 769b7e3c2d..d93e694778 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -1,15 +1,15 @@ -# Makefile for ata_id +# Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2004 Kay Sievers +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # PROG = ata_id - -all: $(PROG) +OBJ = +HEADERS = +GEN_HEADERS = +MAN_PAGES = prefix = exec_prefix = ${prefix} @@ -18,9 +18,7 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -28,23 +26,43 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = ata_id.o $(LIBUDEV) +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all -$(OBJS): $(HEADERS) +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -$(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) - -spotless: clean + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config + diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index c6dfc4e1a8..3e91d4fc47 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -1,16 +1,15 @@ -# Makefile for cdrom_id +# Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2004 Kay Sievers -# Copyright (C) 2005 Greg Kroah-Hartman +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # PROG = cdrom_id - -all: $(PROG) +OBJ = +HEADERS = +GEN_HEADERS = +MAN_PAGES = prefix = exec_prefix = ${prefix} @@ -19,9 +18,7 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -29,23 +26,49 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = cdrom_id.o $(LIBUDEV) +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all -$(OBJS): $(HEADERS) +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -$(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) - -spotless: clean + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config + +install: all install-bin install-config install-man +.PHONY: install + +uninstall: uninstall-bin uninstall-man +.PHONY: uninstall + diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 23331ce14c..2a14050d66 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -1,15 +1,15 @@ -# Makefile for dasd_id +# Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2004 Kay Sievers +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # PROG = dasd_id - -all: $(PROG) +OBJ = +HEADERS = +GEN_HEADERS = +MAN_PAGES = prefix = exec_prefix = ${prefix} @@ -18,9 +18,7 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -28,23 +26,43 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = dasd_id.o $(LIBUDEV) +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all -$(OBJS): $(HEADERS) +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -$(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) - -spotless: clean + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config + diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index aa3db4f209..70244ea468 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -1,15 +1,15 @@ -# Makefile for edd_id +# Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2004 Kay Sievers +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # PROG = edd_id - -all: $(PROG) +OBJ = +HEADERS = +GEN_HEADERS = +MAN_PAGES = prefix = exec_prefix = ${prefix} @@ -18,9 +18,7 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -28,23 +26,43 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = $(PROG).o $(LIBUDEV) +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all -$(OBJS): $(HEADERS) +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -$(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) - -spotless: clean + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config + diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index 5632e0dee5..7de94c40a7 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -1,15 +1,15 @@ -# Makefile for firmware_helper +# Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2005 Kay Sievers +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # PROG = firmware_helper - -all: $(PROG) +OBJ = +HEADERS = +GEN_HEADERS = +MAN_PAGES = prefix = exec_prefix = ${prefix} @@ -18,9 +18,7 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -28,24 +26,42 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = $(PROG).o $(LIBUDEV) $(LIBSYSFS) -HEADERS = +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all -$(OBJS): $(HEADERS) +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -$(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) - -spotless: clean + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index b7915fc484..8568e28edf 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -1,15 +1,15 @@ -# Makefile for create_floppy_devices +# Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2004 Kay Sievers +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # PROG = create_floppy_devices - -all: $(PROG) +OBJ = +HEADERS = +GEN_HEADERS = +MAN_PAGES = prefix = exec_prefix = ${prefix} @@ -18,9 +18,7 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -28,23 +26,42 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = $(PROG).o $(LIBUDEV) +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all -$(OBJS): $(HEADERS) +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -$(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) - -spotless: clean + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 38ef7b128e..8444c3ba63 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -1,16 +1,14 @@ -# Makefile for run_directory +# Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2005 Kay Sievers +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # - -DEVD = udev_run_devd -HOTPLUGD = udev_run_hotplugd - -all: $(DEVD) $(HOTPLUGD) +PROG = udev_run_devd udev_run_hotplugd +OBJS = run_directory.o +HEADERS = +GEN_HEADERS = +MAN_PAGES = prefix = exec_prefix = ${prefix} @@ -19,9 +17,7 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -29,25 +25,44 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = $(LIBUDEV) +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -$(DEVD): $(HEADERS) $(DEVD).o run_directory.o - $(QUIET) $(LD) $(LDFLAGS) -o $(DEVD) $(DEVD).o run_directory.o $(OBJS) +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -$(HOTPLUGD): $(HEADERS) $(HOTPLUGD).o run_directory.o - $(QUIET) $(LD) $(LDFLAGS) -o $(HOTPLUGD) $(HOTPLUGD).o run_directory.o $(OBJS) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 clean: - rm -f $(DEVD) $(HOTPLUGD) run_directory.o - -spotless: clean + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(DEVD) $(DESTDIR)$(sbindir)/$(DEVD) - $(INSTALL_PROGRAM) $(HOTPLUGD) $(DESTDIR)$(sbindir)/$(HOTPLUGD) + $(INSTALL_PROGRAM) udev_run_devd $(DESTDIR)$(sbindir)/udev_run_devd + $(INSTALL_PROGRAM) udev_run_devd $(DESTDIR)$(sbindir)/udev_run_hotplugd +.PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(DEVD) + - rm $(DESTDIR)$(sbindir)/udev_run_devd + - rm $(DESTDIR)$(sbindir)/udev_run_hotplugd +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 3b75e165fb..bb3422a9c4 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -1,85 +1,93 @@ +# Makefile for udev extra invoked from the udev main Makefile # # Copyright (C) 2003 IBM +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # -# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -SCSI_ID_VERSION=0.9 +SCSI_ID_VERSION = 0.9 + +PROG = scsi_id +OBJS= scsi_serial.o +HEADERS = scsi_id.h scsi.h scsi_id_version.h +GEN_HEADERS = scsi_id_version.h +MAN_PAGES = scsi_id.8 prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin +exec_prefix = ${prefix} +etcdir = ${prefix}/etc +sbindir = ${exec_prefix}/sbin +usrbindir = ${exec_prefix}/usr/bin +usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man +configdir = ${etcdir}/udev/ +srcdir = . -INSTALL = /usr/bin/install -c +INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +# be able to run without udev +LIBSYSFS = -lsysfs +CROSS = +QUIET = +CC = $(CROSS)gcc +LD = $(CROSS)gcc +AR = $(CROSS)ar +STRIPCMD = $(CROSS)strip +RANLIB = $(CROSS)ranlib +HOSTCC = gcc +CFLAGS += -Wall -pipe -fno-builtin -Wstrict-prototypes -Wsign-compare -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +LDFLAGS += -Wl + +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all + +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -# Note some of the variables used here are set when built under udev, and -# otherwise might not be set. - -CFLAGS+=-Wall -fno-builtin - -PROG=scsi_id -LIBSYSFS=-lsysfs - -# -# Built static and stripped when built with udev. -# -# STRIP=-s -# LDFLAGS=$(STRIP) -LD=$(CC) - -OBJS= scsi_id.o scsi_serial.o +scsi_id_version.h: + @echo "/* This file is auto-generated by the Makefile */" > $@ + @echo \#define SCSI_ID_VERSION \"$(SCSI_ID_VERSION)\" >> $@ + @echo \#define SCSI_ID_CONFIG_FILE \"$(etcdir)/scsi_id.config\" >> $@ -all: $(PROG) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 -# XXX use a compressed man page? +clean: + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: install-bin + +uninstall-bin: + - rm $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: uninstall-bin install-man: $(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 +.PHONY: uninstall-man + +uninstall-man: + -rm -f $(mandir)/man8/scsi_id.8 +.PHONY: uninstall-man install-config: @if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \ echo $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir); \ $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \ fi - -uninstall-bin: - -rm $(DESTDIR)$(sbindir)/$(PROG) - -uninstall-man: - -rm $(DESTDIR)$(mandir)/man8/scsi_id.8 - -GEN_HEADER=scsi_id_version.h - -scsi_id_version.h: - @echo "/* This file is auto-generated by the Makefile */" > $@ - @echo \#define SCSI_ID_VERSION \"$(SCSI_ID_VERSION)\" >> $@ - @echo \#define SCSI_ID_CONFIG_FILE \"$(etcdir)/scsi_id.config\" >> $@ -$(OBJS): scsi_id.h scsi.h scsi_id_version.h - -clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADER) - -spotless: clean - -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +.PHONY: install-config -$(PROG): $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(CRT0) $(OBJS) $(LIBSYSFS) $(LIB_OBJS) $(ARCH_LIB_OBJS) diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 10dd09da21..1796aaea09 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -1,15 +1,15 @@ -# Makefile for usb_id +# Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2005 Kay Sievers +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # PROG = usb_id - -all: $(PROG) +OBJ = +HEADERS = +GEN_HEADERS = +MAN_PAGES = prefix = exec_prefix = ${prefix} @@ -18,9 +18,7 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -28,24 +26,42 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -OBJS = $(PROG).o $(VOLUME_ID_OBJS) $(LIBUDEV) $(LIBSYSFS) -HEADERS = +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all -$(OBJS): $(HEADERS) +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -$(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LIB_OBJS) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) - -spotless: clean + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index c1dd74f0f7..56cab10e23 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -1,15 +1,18 @@ -# Makefile for volume_id +# Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2004, 2005 Kay Sievers +# Copyright (C) 2004-2005 Kay Sievers # -# 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. +# Released under the GNU General Public License, version 2. # -PROG = vol_id +VOLUME_ID_BASE=volume_id +include $(VOLUME_ID_BASE)/Makefile.inc -all: $(PROG) +PROG = vol_id +OBJS = $(VOLUME_ID_OBJS) +HEADERS = $(VOLUME_ID_HEADERS) +GEN_HEADERS = +MAN_PAGES = prefix = exec_prefix = ${prefix} @@ -18,9 +21,7 @@ sbindir = ${exec_prefix}/sbin usrbindir = ${exec_prefix}/usr/bin usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man -devddir = ${etcdir}/dev.d/default configdir = ${etcdir}/udev/ -initdir = ${etcdir}/init.d/ srcdir = . INSTALL = /usr/bin/install -c @@ -28,27 +29,42 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -VOLUME_ID_BASE=volume_id -include $(VOLUME_ID_BASE)/Makefile.inc +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all -OBJS = vol_id.o $(VOLUME_ID_OBJS) $(LIBUDEV) -HEADERS = $(VOLUME_ID_HEADERS) - -$(OBJS): $(HEADERS) +%.o: %.c $(GEN_HEADERS) + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -.c.o: - $(QUIET) $(CC) $(CFLAGS) -c -o $@ $< +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(STRIPCMD) $@ -$(PROG): $(OBJS) $(HEADERS) - $(QUIET) $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) +# man pages +%.8: %.xml + xmlto man $? +.PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) - -spotless: clean + rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean install-bin: all $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 27e5c93d90..8becb0b057 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -1,7 +1,6 @@ #/bin/sh EXTRAS="\ - extras/chassis_id \ extras/scsi_id \ extras/ata_id \ extras/volume_id \ -- cgit v1.2.3-54-g00ecf From 85701baede56edd4fba042f98550b8dec1a73127 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Sep 2005 17:29:27 +0200 Subject: add install test to 'make buildtest' Signed-off-by: Kay Sievers --- Makefile | 36 ++++++++++++++++++------------------ extras/cdrom_id/Makefile | 7 ------- extras/scsi_id/Makefile | 6 ++++-- test/simple-build-check.sh | 19 +++++++++++++++---- 4 files changed, 37 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 46d5365694..c0e1e46ad7 100644 --- a/Makefile +++ b/Makefile @@ -358,14 +358,14 @@ install-man: .PHONY: install-man uninstall-man: - - rm $(mandir)/man8/udev.8 - - rm $(mandir)/man8/udevinfo.8 - - rm $(mandir)/man8/udevtest.8 - - rm $(mandir)/man8/udevstart.8 - - rm $(mandir)/man8/udevd.8 - - rm $(mandir)/man8/udevmonitor.8 - - rm $(mandir)/man8/udevsend.8 - - rm $(mandir)/man8/udevcontrol.8 + - rm -f $(mandir)/man8/udev.8 + - rm -f $(mandir)/man8/udevinfo.8 + - rm -f $(mandir)/man8/udevtest.8 + - rm -f $(mandir)/man8/udevstart.8 + - rm -f $(mandir)/man8/udevd.8 + - rm -f $(mandir)/man8/udevmonitor.8 + - rm -f $(mandir)/man8/udevsend.8 + - rm -f $(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ $(MAKE) prefix=$(prefix) -C $$target $@; \ @@ -394,16 +394,16 @@ endif .PHONY: install-bin uninstall-bin: - - rm $(sbindir)/udev - - rm $(sbindir)/udevd - - rm $(sbindir)/udevsend - - rm $(sbindir)/udevinitsend - - rm $(sbindir)/udeveventrecoreder - - rm $(sbindir)/udevcontrol - - rm $(sbindir)/udevstart - - rm $(usrsbindir)/udevmonitor - - rm $(usrbindir)/udevinfo - - rm $(usrbindir)/udevtest + - rm -f $(sbindir)/udev + - rm -f $(sbindir)/udevd + - rm -f $(sbindir)/udevsend + - rm -f $(sbindir)/udevinitsend + - rm -f $(sbindir)/udeveventrecoreder + - rm -f $(sbindir)/udevcontrol + - rm -f $(sbindir)/udevstart + - rm -f $(usrsbindir)/udevmonitor + - rm -f $(usrbindir)/udevinfo + - rm -f $(usrbindir)/udevtest - rm -rf $(udevdb) - killall udevd @extras="$(EXTRAS)"; for target in $$extras; do \ diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index 3e91d4fc47..c3ee6e3295 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -65,10 +65,3 @@ uninstall-man: install-config: @echo "no config file to install" .PHONY: install-config - -install: all install-bin install-config install-man -.PHONY: install - -uninstall: uninstall-bin uninstall-man -.PHONY: uninstall - diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index bb3422a9c4..85f6ff6ca8 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -37,8 +37,6 @@ CC = $(CROSS)gcc LD = $(CROSS)gcc AR = $(CROSS)ar STRIPCMD = $(CROSS)strip -RANLIB = $(CROSS)ranlib -HOSTCC = gcc CFLAGS += -Wall -pipe -fno-builtin -Wstrict-prototypes -Wsign-compare -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 LDFLAGS += -Wl @@ -90,4 +88,8 @@ install-config: fi .PHONY: install-config +install: all install-bin install-config install-man +.PHONY: install +uninstall: uninstall-bin uninstall-man +.PHONY: uninstall diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 8becb0b057..e69c6451ab 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -15,24 +15,35 @@ EXTRAS="\ [ -z "$KERNEL_DIR" ] && KERNEL_DIR=/lib/modules/`uname -r`/build echo KERNEL_DIR: "$KERNEL_DIR" -make spotless EXTRAS="$EXTRAS" >/dev/null -make all $MAKEOPTS EXTRAS="$EXTRAS" || exit -echo -e "\n\n" - +# with debug make spotless EXTRAS="$EXTRAS" >/dev/null make all -j4 $MAKEOPTS DEBUG=true EXTRAS="$EXTRAS" || exit echo -e "\n\n" +# without any logging make spotless EXTRAS="$EXTRAS" >/dev/null make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit echo -e "\n\n" +# klibc and debug make spotless EXTRAS="$EXTRAS" >/dev/null make all -j4 $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit echo -e "\n\n" +# klibc without logging make spotless EXTRAS="$EXTRAS" >/dev/null make all $MAKEOPTS USE_KLIBC=true USE_LOG=false EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit echo -e "\n\n" +# install in temporary dir and show it +TEMPDIR="`pwd`/.tmp" +rm -rf $TEMPDIR +mkdir $TEMPDIR +make spotless EXTRAS="$EXTRAS" >/dev/null +make all $MAKEOPTS DESTDIR="$TEMPDIR" EXTRAS="$EXTRAS" || exit +make install DESTDIR="$TEMPDIR" EXTRAS="$EXTRAS" || exit +echo -e "\nInstalled tree:" +find $TEMPDIR +rm -rf $TEMPDIR + make spotless EXTRAS="$EXTRAS" >/dev/null -- cgit v1.2.3-54-g00ecf From 50be1401743704419ba52174302b4c1d06b3898b Mon Sep 17 00:00:00 2001 From: Edward Goggin Date: Wed, 14 Sep 2005 20:23:48 +0200 Subject: scsi_id: derive a UID for a SCSI-2 not compliant with the page 83 This patch is to enable the use of scsi_id to derive a UID for a SCSI-2 device which is not compliant with the page 83 inquiry reply format for either SPC-2 or SPC-3. In this case, the page 83 reply does not contain a list of Identification descriptors but a single binary encoded hexa-decimal Vendor Specified Identifier. The update is being driven by the need for scsi_id to support older model EMC Symmetrix hardware, that is, models 4, 5, and 6. --- extras/scsi_id/scsi_id.8 | 16 +++++-- extras/scsi_id/scsi_id.c | 14 ++++-- extras/scsi_id/scsi_id.config | 5 ++ extras/scsi_id/scsi_id.h | 10 ++++ extras/scsi_id/scsi_serial.c | 109 ++++++++++++++++++++++++++++++++++++++---- 5 files changed, 137 insertions(+), 17 deletions(-) diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 26df0d3e66..4213468ae4 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -91,10 +91,18 @@ to generate any output. Prefix the identification string with the driver model (sysfs) bus id of the SCSI device. .TP -.BI \-p "\| 0x80 | 0x83" -Use SCSI INQUIRY VPD page code 0x80 or 0x83. The default behaviour is to -query the available VPD pages, and use page 0x83 if found, else page 0x80 -if found, else nothing. +.BI \-p "\| 0x80 | 0x83 | pre-spc3-83" +Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83. +.sp +The default +behaviour is to query the availabe VPD pages, and use page 0x83 if found, +else page 0x80 if found, else nothing. +.sp +Page pre-spc3-83 should only be utilized for those scsi devices which +are not compliant with the SPC-2 or SPC-3 format for page 83. While this +option is used for older model 4, 5, and 6 EMC Symmetrix devices, its +use with SPC-2 or SPC-3 compliant devices will fallback to the page 83 +format supported by these devices. .TP .BI \-s "\| sysfs\-device" Generate an id for the diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index a86b004709..e997be9956 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -67,7 +67,7 @@ static int dev_specified; static int sys_specified; static char config_file[MAX_NAME_LEN] = SCSI_ID_CONFIG_FILE; static int display_bus_id; -static int default_page_code; +static enum page_code default_page_code; static int use_stderr; static int debug; static int hotplug_mode; @@ -519,9 +519,11 @@ static int set_options(int argc, char **argv, const char *short_opts, case 'p': if (strcmp(optarg, "0x80") == 0) { - default_page_code = 0x80; + default_page_code = PAGE_80; } else if (strcmp(optarg, "0x83") == 0) { - default_page_code = 0x83; + default_page_code = PAGE_83; + } else if (strcmp(optarg, "pre-spc3-83") == 0) { + default_page_code = PAGE_83_PRE_SPC3; } else { log_message(LOG_WARNING, "Unknown page code '%s'\n", optarg); @@ -640,9 +642,11 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, case 'p': if (strcmp(optarg, "0x80") == 0) { - *page_code = 0x80; + *page_code = PAGE_80; } else if (strcmp(optarg, "0x83") == 0) { - *page_code = 0x83; + *page_code = PAGE_83; + } else if (strcmp(optarg, "pre-spc3-83") == 0) { + *page_code = PAGE_83_PRE_SPC3; } else { log_message(LOG_WARNING, "Unknown page code '%s'\n", optarg); diff --git a/extras/scsi_id/scsi_id.config b/extras/scsi_id/scsi_id.config index 0567ecb7d6..4f31b1c498 100644 --- a/extras/scsi_id/scsi_id.config +++ b/extras/scsi_id/scsi_id.config @@ -41,3 +41,8 @@ vendor=someone, model=nicedrive, options=-g # if you rely on the id for persistent naming or multi-path configuration. ## vendor=ELBONIA, model=borken, options=-b + +# EMC SYMMETRIX models 4 and 5, and some model 6 systems return the VSI +# field of the page 83 reply according to SCSI-2 format. This format is +# binary encoded hexa-decimal as opposed to the Identifiscation descriptor +# utilized by both SPC-2 and SPC-3 compliant systems. diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 74b449e984..1c9ed969a7 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -53,3 +53,13 @@ extern void log_message (int level, const char *format, ...) #ifndef u8 typedef unsigned char u8; #endif + +/* + * Page code values. + */ +enum page_code { + PAGE_83_PRE_SPC3 = -0x83, + PAGE_UNSPECIFIED = 0x00, + PAGE_80 = 0x80, + PAGE_83 = 0x83, +}; diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 73d66ee615..d1b1d94f53 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -567,12 +567,12 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned char page_83[SCSI_INQ_BUFF_LEN]; memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(scsi_dev, fd, 1, 0x83, page_83, + retval = scsi_inquiry(scsi_dev, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); if (retval < 0) return 1; - if (page_83[1] != 0x83) { + if (page_83[1] != PAGE_83) { log_message(LOG_WARNING, "%s: Invalid page 0x83\n", scsi_dev->name); return 1; @@ -616,6 +616,74 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, return 1; } +/* + * Get device identification VPD page for older SCSI-2 device which is not + * compliant with either SPC-2 or SPC-3 format. + * + * Return the hard coded error code value 2 if the page 83 reply is not + * conformant to the SCSI-2 format. + */ +static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *scsi_dev, int fd, + char *serial, int len) +{ + int retval; + int i, j; + unsigned char page_83[SCSI_INQ_BUFF_LEN]; + + memset(page_83, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(scsi_dev, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); + if (retval < 0) + return 1; + + if (page_83[1] != PAGE_83) { + log_message(LOG_WARNING, "%s: Invalid page 0x83\n", scsi_dev->name); + return 1; + } + /* + * Model 4, 5, and (some) model 6 EMC Symmetrix devices return + * a page 83 reply according to SCSI-2 format instead of SPC-2/3. + * + * The SCSI-2 page 83 format returns an IEEE WWN in binary + * encoded hexi-decimal in the 16 bytes following the initial + * 4-byte page 83 reply header. + * + * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part + * of an Identification descriptor. The 3rd byte of the first + * Identification descriptor is a reserved (BSZ) byte field. + * + * Reference the 7th byte of the page 83 reply to determine + * whether the reply is compliant with SCSI-2 or SPC-2/3 + * specifications. A zero value in the 7th byte indicates + * an SPC-2/3 conformant reply, (i.e., the reserved field of the + * first Identification descriptor). This byte will be non-zero + * for a SCSI-2 conformant page 83 reply from these EMC + * Symmetrix models since the 7th byte of the reply corresponds + * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, + * 0x006048. + */ + if (page_83[6] == 0) + return 2; + + serial[0] = hex_str[id_search_list[0].id_type]; + /* + * The first four bytes contain data, not a descriptor. + */ + i = 4; + j = strlen(serial); + /* + * Binary descriptor, convert to ASCII, + * using two bytes of ASCII for each byte + * in the page_83. + */ + while (i < (page_83[3]+4)) { + serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; + serial[j++] = hex_str[page_83[i] & 0x0f]; + i++; + } + dprintf("using pre-spc3-83 for %s.\n", scsi_dev->name); + return 0; +} + /* Get unit serial number VPD page */ static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, char *serial, int max_len) @@ -627,11 +695,11 @@ static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned char buf[SCSI_INQ_BUFF_LEN]; memset(buf, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(scsi_dev, fd, 1, 0x80, buf, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(scsi_dev, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); if (retval < 0) return retval; - if (buf[1] != 0x80) { + if (buf[1] != PAGE_80) { log_message(LOG_WARNING, "%s: Invalid page 0x80\n", scsi_dev->name); return 1; @@ -674,7 +742,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, return 1; } - if (page_code == 0x80) { + if (page_code == PAGE_80) { if (do_scsi_page80_inquiry(scsi_dev, fd, serial, len)) { retval = 1; goto completed; @@ -682,7 +750,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, retval = 0; goto completed; } - } else if (page_code == 0x83) { + } else if (page_code == PAGE_83) { if (do_scsi_page83_inquiry(scsi_dev, fd, serial, len)) { retval = 1; goto completed; @@ -690,6 +758,31 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, retval = 0; goto completed; } + } else if (page_code == PAGE_83_PRE_SPC3) { + retval = do_scsi_page83_prespc3_inquiry(scsi_dev, fd, serial, len); + if (retval) { + /* + * Fallback to servicing a SPC-2/3 compliant page 83 + * inquiry if the page 83 reply format does not + * conform to pre-SPC3 expectations. + */ + if (retval == 2) { + if (do_scsi_page83_inquiry(scsi_dev, fd, serial, len)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } + else { + retval = 1; + goto completed; + } + } else { + retval = 0; + goto completed; + } } else if (page_code != 0x00) { log_message(LOG_WARNING, "%s: unsupported page code 0x%d\n", scsi_dev->name, page_code); @@ -713,7 +806,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, dprintf("%s: Checking page0\n", scsi_dev->name); for (ind = 4; ind <= page0[3] + 3; ind++) - if (page0[ind] == 0x83) + if (page0[ind] == PAGE_83) if (!do_scsi_page83_inquiry(scsi_dev, fd, serial, len)) { /* @@ -724,7 +817,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, } for (ind = 4; ind <= page0[3] + 3; ind++) - if (page0[ind] == 0x80) + if (page0[ind] == PAGE_80) if (!do_scsi_page80_inquiry(scsi_dev, fd, serial, len)) { /* -- cgit v1.2.3-54-g00ecf From b0f6529556e71186b186cbc295ad7e21e2288887 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Sep 2005 21:12:08 +0200 Subject: update RELEASE-NOTES Signed-off-by: Kay Sievers --- RELEASE-NOTES | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 76d945e2e0..31c97ce1b2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,8 @@ +udev 070 +======== +Fix a 'install' target in the Makefile, that prevents EXTRAS from +beeing installed. + udev 069 ======== A bunch of mostly trivial bugfixes. From now on no node name or -- cgit v1.2.3-54-g00ecf From 8355c61b485dd93683d724469bf88b56fd32a463 Mon Sep 17 00:00:00 2001 From: Greg KH Date: Wed, 14 Sep 2005 16:19:07 -0700 Subject: 070 release --- ChangeLog | 26 ++++++++++++++++++++++++++ Makefile | 2 +- udev.spec | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e39f722c4..8f25c0c5b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +Summary of changes from v069 to v070 +============================================ + +Amir Shalem: + udevd: fix udevd read() calls to leave room for null byte + +Edward Goggin: + scsi_id: derive a UID for a SCSI-2 not compliant with the page 83 + +Greg Kroah-Hartman: + fix nbd error messages with a gentoo rule hack + fix scsi_id rule in gentoo config file + +Jrg Billeter: + EXTRAS/Makefile: fix install targets to match main Makefile + +Kay Sievers: + volume_id: fix error handling with failing read() + EXTRAS: cleanup and sync all Makefiles + add install test to 'make buildtest' + update RELEASE-NOTES + +Olivier Blin: + fix a debug text typo in udev_rules.c + + Summary of changes from v068 to v069 ============================================ diff --git a/Makefile b/Makefile index c0e1e46ad7..ed5a87c427 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 069 +VERSION = 070 # set this to make use of syslog USE_LOG = true diff --git a/udev.spec b/udev.spec index 4997528257..2b8eb054c0 100644 --- a/udev.spec +++ b/udev.spec @@ -29,7 +29,7 @@ Summary: A userspace device manager providing devfs functionality Name: udev -Version: 069 +Version: 070 Release: 1 License: GPL Group: Utilities/System -- cgit v1.2.3-54-g00ecf From 77914dfeda9caae155f7dcdbeb06dc8574a6f4ad Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Fri, 16 Sep 2005 21:05:15 +0200 Subject: run_directory: fix typo in "make install" --- extras/run_directory/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 8444c3ba63..20b3af340c 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -47,7 +47,7 @@ clean: install-bin: all $(INSTALL_PROGRAM) udev_run_devd $(DESTDIR)$(sbindir)/udev_run_devd - $(INSTALL_PROGRAM) udev_run_devd $(DESTDIR)$(sbindir)/udev_run_hotplugd + $(INSTALL_PROGRAM) udev_run_hotplugd $(DESTDIR)$(sbindir)/udev_run_hotplugd .PHONY: install-bin uninstall-bin: -- cgit v1.2.3-54-g00ecf From 4b12433517bfb1a4cdf4eecc5102f2cc5e1e6288 Mon Sep 17 00:00:00 2001 From: John Hull Date: Fri, 16 Sep 2005 21:10:12 +0200 Subject: edd_id: check that EDD id is unique The attached patch adds a check to edd_id.c to verify that the MBR signature on the device node passed to the program is unique to only that disk. Signed-off-by: John Hull --- extras/edd_id/edd_id.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 504aac36e6..8ac50e9812 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -63,6 +63,7 @@ int main(int argc, char *argv[]) int sysfs_fd; DIR *dir = NULL; int rc = 1; + char *match = NULL; logging_init("edd_id"); @@ -165,14 +166,23 @@ int main(int argc, char *argv[]) sysfs_id = strtoul(sysfs_id_buf, NULL, 16); if (disk_id == sysfs_id) { + if (!match) { + match = dent->d_name; + } else { + info("'%s' does not have a unique signature", node); + fprintf(stderr, "'%s' does not have a unique signature\n", node); + rc=10; + goto exit; + } + } + + } + if (export) - printf("ID_EDD=%s\n", dent->d_name); + printf("ID_EDD=%s\n", match); else - printf("%s\n", dent->d_name); + printf("%s\n", match); rc = 0; - break; - } - } close: close(disk_fd); -- cgit v1.2.3-54-g00ecf From 3515c0ad001731edd9a1cbf6e3d9a3161d37eb4b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Sep 2005 21:23:36 +0200 Subject: ata_id: open volume O_NONBLOCK Opticals like that and should be ok for disks too, as long as we don't read(). Signed-off-by: Kay Sievers --- extras/ata_id/ata_id.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 9579db3105..ba40555a0b 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -122,10 +122,7 @@ int main(int argc, char *argv[]) goto exit; } - fd = open(node, O_RDONLY); - if (fd < 0) - if (errno == ENOMEDIUM) - fd = open(node, O_RDONLY|O_NONBLOCK); + fd = open(node, O_RDONLY|O_NONBLOCK); if (fd < 0) { err("unable to open '%s'", node); rc = 1; -- cgit v1.2.3-54-g00ecf From a3f129d054395019d4b2385dede233eb12425c78 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Sep 2005 04:41:09 +0200 Subject: add "Persistent Device Naming" rules file for disks Based on: "Linux Persistent Device Naming", 2004, Hannes Reinecke --- etc/udev/persistent.rules | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 etc/udev/persistent.rules diff --git a/etc/udev/persistent.rules b/etc/udev/persistent.rules new file mode 100644 index 0000000000..0ca0c56545 --- /dev/null +++ b/etc/udev/persistent.rules @@ -0,0 +1,46 @@ +# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" + +# never access removable ide devices, the drivers are causing event loops on open() +SUBSYSTEM=="block", BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="sr*", GOTO="persistent_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" + +LABEL="persistent_end" + -- cgit v1.2.3-54-g00ecf From 0e5f8a1fcc4b2bb020d865075bb8e543f5b0c230 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Sep 2005 04:49:23 +0200 Subject: scsi_id: switch temporary node creation to /dev /tmp is not writable on most systems, so just use /dev to create a temporary node. If called from a udev rule, "-d $tempnode" should be used and udev will create a temporary node and pass the name before calling scsi_id. Also remove gen_scsi_id_udev_rules.sh per Patrick's request, as it's no longer needed with the persistent disk links. Signed-off-by: Kay Sievers --- extras/scsi_id/gen_scsi_id_udev_rules.sh | 80 -------------------------------- extras/scsi_id/scsi_id.8 | 16 +++++-- extras/scsi_id/scsi_id.c | 4 +- 3 files changed, 14 insertions(+), 86 deletions(-) delete mode 100644 extras/scsi_id/gen_scsi_id_udev_rules.sh diff --git a/extras/scsi_id/gen_scsi_id_udev_rules.sh b/extras/scsi_id/gen_scsi_id_udev_rules.sh deleted file mode 100644 index 92fde5df1b..0000000000 --- a/extras/scsi_id/gen_scsi_id_udev_rules.sh +++ /dev/null @@ -1,80 +0,0 @@ -#! /bin/sh - -# This script generates and sends to stdout a set of udev.rules for use -# with all scsi block devices on your system. It creates a udev key NAME -# with prefix defaulting to "disk-", and appends the current kernel name -# and the udev kernel number (the partition number, empty for the entire -# disk). -# -# Managing these is probably better done via a gui interface. -# -# You can edit and append the output to your /etc/udev/udev.rules file. -# You probably want to to change names to be non-kernel defaults, so as to -# avoid confusion if a configuration change modifies /sys/block/sd* -# naming. -# -# /etc/scsi_id.config must be properly configured. If you are using this -# script, you probably want a single line enabling scsi_id for all -# devices as follows: -# -# options=-g -# -# The above assumes you will not attach block devices that do not -# properly support the page codes used by scsi_id, this is especially true -# of many USB mass storage devices (mainly flash card readers). -# - -prefix=disk- -scsi_id=/sbin/scsi_id - -sysfs_dir=$(mount | awk '$5 == "sysfs" {print $3}') -if [ "$sysfs_dir" = "" ] -then - sysfs_dir="/sys" - echo "Using sysfs mount point \"$sysfs_dir\"" >&2 -fi - -c=$(ls /${sysfs_dir}/block/sd* 2>/dev/null | wc -l) -if [ $c = 0 ] -then - echo $0 no block devices present >&2 - exit 1 -fi - -echo "#" -echo "# Start of autogenerated scsi_id rules. Edit the NAME portions of these" -echo "# rules to your liking." -echo "#" -first_line=yes - -# -cd ${sysfs_dir}/block -for name in sd* -do - id=$($scsi_id -s /block/$name) - if [ $? != 0 ] - then - echo $0 failed for device $name exiting >&2 - exit 1 - fi - if [ $first_line = "yes" ] - then - first_line=no - echo "BUS=\"scsi\", PROGRAM=\"${scsi_id} -d %N -s %p\", RESULT=\"${id}\", NAME=\"${prefix}${name}%n\"" - echo - echo "# Further RESULT keys use the result of the last PROGRAM rule." - echo "# Be careful not to add any rules containing PROGRAM key between here" - echo "# and the end of this section" - echo - else - # No PROGRAM, so just use the last result of PROGRAM. The - # following is the same as the above without the PROGRAM - # key. - echo "BUS=\"scsi\", RESULT=\"${id}\", NAME=\"${prefix}${name}%n\"" - fi - -done - -echo "#" -echo "# End of autogenerated scsi_id rules" -echo "#" diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 4213468ae4..691d5b8b05 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -111,7 +111,10 @@ The sysfs mount point must not be included. For example, use /block/sd, not /sys/block/sd. .TP .BI \-u -Reformat the output : replace all whitespaces by underscores +Reformat the output : replace all whitespaces by underscores. +.TP +.BI \-x +Export all data in KEY= format used to import in other programs. .TP .BI \-v Generate verbose debugging output. @@ -140,13 +143,18 @@ for example: .fi .P -An example \fBudev\fP rule using \fBscsi_id\fP, that will name a block +\fBscsi_id\fP is one of the tools used in the "Linux Persistent Device Names" +scheme that creates persistent device links in /dev/disk. It is called with +the -x option which will print all values in a defined format to let udev +import it into its own environment for later event processing. +.sp +An example custom \fBudev\fP rule using \fBscsi_id\fP, that will name a block device and any partitions for the device matching the \fBscsi_id\fP output of 312345: .sp .nf -BUS="scsi", PROGRAM="/sbin/scsi_id -d %N -s %p", RESULT="312345", NAME="disk%n" +BUS=="scsi", PROGRAM=="/sbin/scsi_id -d %N -s %p", RESULT=="312345", NAME="disk%n" .fi .P @@ -158,7 +166,7 @@ BUS="scsi", PROGRAM="/sbin/scsi_id -d %N -s %p", RESULT="312345", NAME="disk%n" .fi .LP .SH "SEE ALSO" -.BR udev (8), hotplug (8) +.BR udev (8) .SH AUTHORS Developed by Patrick Mansfield based on SCSI ID source included in earlier linux 2.5 kernels, sg_utils source, and SCSI diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index e997be9956..39391f6e2e 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -44,8 +44,8 @@ /* * temporary names for mknod. */ -#define TMP_DIR "/tmp" -#define TMP_PREFIX "scsi" +#define TMP_DIR "/dev" +#define TMP_PREFIX "tmp-scsi" /* * XXX Note the 'e' (send output to stderr in all cases), and 'c' (callout) -- cgit v1.2.3-54-g00ecf From 3a9fc6416770a617023dade2ffb8952703686b42 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Sep 2005 05:06:10 +0200 Subject: volume_id: set reiser instead of reiserfs for filesystem type Thanks to Theodore Ts'o for the hint and a test image. Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/reiserfs.c | 11 ++++++++--- extras/volume_id/volume_id/volume_id.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c index 75d1be05dc..6cffdce8d8 100644 --- a/extras/volume_id/volume_id/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs.c @@ -82,14 +82,17 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) rs = (struct reiserfs_super_block *) buf;; if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { strcpy(id->type_version, "3.5"); + id->type = "reiserfs"; goto found; } if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { strcpy(id->type_version, "3.6"); + id->type = "reiserfs"; goto found_label; } if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { strcpy(id->type_version, "JR"); + id->type = "reiserfs"; goto found_label; } @@ -99,15 +102,18 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) volume_id_set_label_raw(id, rs4->label, 16); volume_id_set_label_string(id, rs4->label, 16); volume_id_set_uuid(id, rs4->uuid, UUID_DCE); + id->type = "reiser4"; goto found; } - rs = (struct reiserfs_super_block *) volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); - if (rs == NULL) + buf = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) return -1; + rs = (struct reiserfs_super_block *) buf; if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { strcpy(id->type_version, "3.5"); + id->type = "reiserfs"; goto found; } @@ -120,7 +126,6 @@ found_label: found: volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "reiserfs"; return 0; } diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 84f8fb6740..0f5716b893 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -23,7 +23,7 @@ #include -#define VOLUME_ID_VERSION 48 +#define VOLUME_ID_VERSION 49 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From 800c36cd642a38a8d775e3e434cbc984b562032d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Sep 2005 05:08:52 +0200 Subject: update devfs rules header Signed-off-by: Kay Sievers --- etc/udev/udev-devfs.rules | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/etc/udev/udev-devfs.rules b/etc/udev/udev-devfs.rules index 1e71ae1a17..380bbee85b 100644 --- a/etc/udev/udev-devfs.rules +++ b/etc/udev/udev-devfs.rules @@ -1,8 +1,12 @@ -# The use of these rules is not recommended or supported. -# In a world where devices can come and go at any time, the devfs scheme -# of simple device enumeration does not help _anything_. Just forget about -# it. Use custom rules to name your device or look at the persistent device -# naming scheme, which is implemented for disks and add your subsystem. +# The use of these rules is not recommended or supported. This file +# is just kept around to proof that udev is able to emulate the devfs scheme. +# +# In a world where devices can come and go at any time, the devfs device +# naming scheme of simple grouping and enumeration does not help _anything_. +# +# Use custom rules to name your device or look at the persistent device +# naming scheme, which is implemented for disks and extend it in a +# similar way for the subsystem you want a sane node layout for. # ide block devices BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" -- cgit v1.2.3-54-g00ecf From 449ac79193438b233508adf6bd7310f875be4d01 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Sep 2005 05:34:05 +0200 Subject: update Debian rules Signed-off-by: Kay Sievers --- etc/udev/debian/cd-aliases.rules | 20 ++++----- etc/udev/debian/devfs.rules | 32 ++++++------- etc/udev/debian/hotplugd.rules | 7 +++ etc/udev/debian/permissions.rules | 11 +++-- etc/udev/debian/persistent.rules | 79 ++++++++++++++++++--------------- etc/udev/debian/simple-cd-aliases.rules | 7 --- etc/udev/debian/udev.rules | 18 +++++--- 7 files changed, 96 insertions(+), 78 deletions(-) delete mode 100644 etc/udev/debian/simple-cd-aliases.rules diff --git a/etc/udev/debian/cd-aliases.rules b/etc/udev/debian/cd-aliases.rules index b96d3a571d..22f710032b 100644 --- a/etc/udev/debian/cd-aliases.rules +++ b/etc/udev/debian/cd-aliases.rules @@ -1,17 +1,15 @@ -# These rules create the /dev/{cdrom,dvd,...} symlinks. Also see the -# /etc/udev/cdsymlinks.conf config file. +# These rules create the /dev/{cdrom,dvd,...} symlinks. # # If you would like to statically configure the aliases instead, you can # use rules like: # BUS=="ide", ID=="1.0", SYMLINK+="cdrom" -BUS=="scsi", KERNEL=="sr[0-9]*", \ - PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", \ - SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", \ - SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -BUS=="ide", KERNEL=="pcd[0-9]*", SYSFS{removable}=="1", \ - PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", \ - SYMLINK+="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" +# The variables for IDE devices are imported in permissions.rules. +BUS=="scsi", KERNEL=="sr[0-9]*", ACTION=="add", \ + IMPORT{program}="/sbin/cdrom_id --export $tempnode" + +ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%e" +ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%e" +ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%e" +ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw%e" diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index 89e0db2aac..b1696c7d24 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -15,30 +15,26 @@ # workaround for devices which do not report media changes BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT=="IOMEGA ZIP *", \ - NAME="%k", OPTIONS+="all_partitions" + PROGRAM="/sbin/ata_id --export $tempnode", ENV{ID_MODEL}=="IOMEGA_ZIP*", \ + NAME="%k", OPTIONS+="all_partitions" # IDE devices BUS=="ide", KERNEL=="hd[a-z]*", \ PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK+="%k %c{2}" + NAME="%c{1}", SYMLINK+="%k %c{2}" # SCSI devices -BUS=="scsi", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ - NAME="%c{1}", SYMLINK+="%k %c{2}" +BUS=="scsi", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ + NAME="%c{1}", SYMLINK+="%k %c{2}" # RAID controllers -KERNEL=="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ - NAME="%c{1}", SYMLINK+="%k" -KERNEL=="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ - NAME="%c{1}", SYMLINK+="%k" -KERNEL=="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ - NAME="%c{1}", SYMLINK+="%k" +KERNEL=="cciss!*|ida!*|rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ + NAME="%c{1}", SYMLINK+="%k" # other block devices -KERNEL=="md[0-9]*", NAME="md/%n", -KERNEL=="loop[0-9]*", NAME="loop/%n" -KERNEL=="ram[0-9]*", NAME="rd/%n" +KERNEL=="md[0-9]*", NAME="md/%n", +KERNEL=="loop[0-9]*", NAME="loop/%n" +KERNEL=="ram[0-9]*", NAME="rd/%n" # USB devices BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" @@ -50,6 +46,10 @@ BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ SYMLINK+="pilot" +# usbfs-like devices +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k K=$${K#usbdev} B=$${K%%%%.*} D=$${K#*.}; echo bus/usb/$$B/$$D'", \ + SYMLINK+="%c" + # serial devices KERNEL=="ttyS[0-9]*", NAME="tts/%n" KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n" @@ -69,7 +69,7 @@ KERNEL=="video[0-9]*", NAME="v4l/%k" KERNEL=="radio[0-9]*", NAME="v4l/%k" KERNEL=="vbi[0-9]*", NAME="v4l/%k" KERNEL=="vtx[0-9]*", NAME="v4l/%k" -KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'KNAME=%k KNAME=$${KNAME#dvb} A=$${KNAME%%%%.*} D=$${KNAME#*.}; echo dvb/adapter$$A/$$D'", \ NAME="%c" KERNEL=="fb[0-9]*", NAME="fb/%n" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -100,6 +100,8 @@ KERNEL=="microcode", NAME="cpu/microcode" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm", NAME="infiniband/%k" # sound devices KERNEL=="controlC[0-9]*", NAME="snd/%k" diff --git a/etc/udev/debian/hotplugd.rules b/etc/udev/debian/hotplugd.rules index cf84682abf..e311d22678 100644 --- a/etc/udev/debian/hotplugd.rules +++ b/etc/udev/debian/hotplugd.rules @@ -3,6 +3,13 @@ SUBSYSTEM=="drivers", OPTIONS="last_rule" SUBSYSTEM=="module", OPTIONS="last_rule" # compatibility support for the obsolete hotplug.d and dev.d directories +# do not run the hotplug.d scripts when started from udevstart ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" RUN+="/sbin/udev_run_devd" +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + +# debugging monitor +RUN+="socket:/org/kernel/udev/monitor" + diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index 52d7aa9536..02bfefdd27 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -1,12 +1,14 @@ # default permissions for block devices SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" +SUBSYSTEM=="block", SYSFS{../removable}=="1", GROUP="floppy" # IDE devices -BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}="1", \ - PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom*", GROUP="cdrom" -BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" -BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", ACTION=="add", \ + IMPORT{program}="/sbin/cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", GROUP="cdrom" +BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" +BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" # SCSI devices BUS=="scsi", SYSFS{type}=="1", GROUP="tape" @@ -52,6 +54,7 @@ KERNEL=="sonypi", MODE="0666" KERNEL=="agpgart", GROUP="video" KERNEL=="nvram", GROUP="nvram" KERNEL=="rtc", MODE="0660", GROUP="audio" +KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" KERNEL=="cdemu[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index b444a27bf6..a6467fa319 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -1,49 +1,58 @@ # This file contains the rules needed to create persistent device names. # we are only interested in add actions for block devices -ACTION!="add", GOTO="no_volume_id" -SUBSYSTEM!="block", GOTO="no_volume_id" +SUBSYSTEM!="block", GOTO="no_volume_id" +ACTION!="add", GOTO="no_volume_id" # and we can safely ignore these kinds of devices -KERNEL=="ram*|loop*|fd*|sr*", GOTO="no_volume_id" +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="no_volume_id" + +# skip removable ide devices, because open(2) on them causes an events loop +BUS=="ide", SYSFS{removable}=="1", GOTO="no_volume_id" +BUS=="ide", SYSFS{../removable}=="1", GOTO="no_volume_id" # disk id -KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" - -KERNEL=="hd*[0-9]", IMPORT{parent}="ID_*" -KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", \ - IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394\nID_TYPE=disk'" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", \ - IMPORT="/sbin/scsi_id -g -x -a -s %p" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -KERNEL=="sd*[0-9]", IMPORT{parent}="ID_*" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="hd*[!0-9]", \ + IMPORT{program}="/sbin/ata_id --export $tempnode" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", \ + IMPORT{program}="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="/sbin/scsi_id -g -x -s %p -d %N" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d %N" + +KERNEL=="dasd*[!0-9]", \ + IMPORT{program}="/sbin/dasd_id --export $tempnode" + +KERNEL=="hd*[0-9]|sd*[0-9]|dasd*[0-9]", IMPORT{parent}="ID_*" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="sd*[!0-9]|sr*|dasd[!0-9]*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # path -KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", \ - SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", \ + IMPORT{program}="/sbin/path_id %p", -KERNEL=="*[0-9]", IMPORT{parent}="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="$env{ID_TYPE}/by-path/$env{ID_PATH}-part%n" +KERNEL=="*[0-9]", IMPORT{parent}="ID_*" +KERNEL=="*[!0-9]|sr*", ENV{ID_PATH}=="?*", \ + SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ + SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -# volume label and uuid -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" -KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" -KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", \ - SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", \ - SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +# UUID and volume label +KERNEL=="*[!0-9]|sr*", SYSFS{removable}=="1", GOTO="no_volume_id" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # end of processing -SUBSYSTEM=="block", LABEL="no_volume_id" +LABEL="no_volume_id" diff --git a/etc/udev/debian/simple-cd-aliases.rules b/etc/udev/debian/simple-cd-aliases.rules deleted file mode 100644 index 45ffeeac6b..0000000000 --- a/etc/udev/debian/simple-cd-aliases.rules +++ /dev/null @@ -1,7 +0,0 @@ -# grouping of optical drives from multiple kernel subsystems -BUS=="scsi", KERNEL=="sr[0-9]*", SYMLINK+="cdrom%e" -BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom", \ - SYMLINK+="cdrom%e" -BUS=="ide", KERNEL=="pcd[0-9]*", SYSFS{removable}=="1", SYMLINK+="cdrom%e" - diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index 07087a3a36..27eb43e54c 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -15,28 +15,32 @@ # workaround for devices which do not report media changes BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/etc/udev/scripts/ide-model.sh %k", RESULT=="IOMEGA ZIP *", \ + PROGRAM="/sbin/ata_id --export $tempnode", ENV{ID_MODEL}=="IOMEGA_ZIP*", \ NAME="%k", OPTIONS+="all_partitions" # SCSI devices BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" # USB devices -BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" -BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ - SYMLINK+=="pilot" + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k K=$${K#usbdev} B=$${K%%%%.*} D=$${K#*.}; echo bus/usb/$$B/$$D'", \ + SYMLINK+="%c" # serial devices KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" KERNEL=="capi[0-9]*", NAME="capi/%n" # video devices -KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k K=$${K#dvb} A=$${K%%%%.*} D=$${K#*.}; echo dvb/adapter$$A/$$D'", \ NAME="%c" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -54,6 +58,8 @@ KERNEL=="microcode", NAME="cpu/microcode" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm", NAME="infiniband/%k" # ALSA devices KERNEL=="controlC[0-9]*", NAME="snd/%k" -- cgit v1.2.3-54-g00ecf From 5bd4c5d72aa69c8d0b722630fd88e29c4a42662a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Sep 2005 05:37:33 +0200 Subject: update Fedora rules Signed-off-by: Kay Sievers --- etc/udev/redhat/udev.rules | 81 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 66 insertions(+), 15 deletions(-) diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index 0f6e6ffb73..115abc3ae4 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -3,34 +3,37 @@ # # default is OWNER="root" GROUP="root", MODE="0600" # +KERNEL="*", OWNER="root" GROUP="root", MODE="0600" # all block devices SUBSYSTEM=="block", GROUP="disk", MODE="0640" +KERNEL=="root", GROUP="disk", MODE="0640" # console devices -KERNEL=="tty", MODE="0666" -KERNEL=="tty[0-9]", GROUP="tty", MODE="0660" -KERNEL=="tty[0-9][0-9]*", GROUP="tty", MODE="0660" -KERNEL=="vc/[0-9]*", GROUP="tty", MODE="0660" +KERNEL=="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty[0-9]", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="tty[0-9][0-9]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="vc/[0-9]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" # pty devices # Set this to 0660 if you only want users belonging to tty group # to be able to allocate PTYs -KERNEL=="ptmx", GROUP="tty", MODE="0666" -KERNEL=="pty[p-za-e][0-9a-f]*", GROUP="tty", MODE="0660" -KERNEL=="tty[p-za-e][0-9a-f]*", GROUP="tty", MODE="0660" -KERNEL=="pty/m*", GROUP="tty", MODE="0660" -KERNEL=="vc/s*", GROUP="tty", MODE="0660" +KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="pty[p-za-e][0-9a-f]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="tty[p-za-e][0-9a-f]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="pty/m*", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="vc/s*", GROUP="tty", MODE="0660", OPTIONS="last_rule" # serial+dialup devices -KERNEL=="ttyS*", GROUP="uucp", MODE="0660" +KERNEL=="ttyS*", GROUP="uucp", MODE="0660", OPTIONS="last_rule" +KERNEL=="ttyACM*", GROUP="uucp", MODE="0660", OPTIONS="last_rule" +KERNEL=="ttyUSB*", GROUP="uucp", MODE="0660", OPTIONS="last_rule" KERNEL=="ippp*", MODE="0660" KERNEL=="isdn*", MODE="0660" KERNEL=="isdnctrl*", MODE="0660" KERNEL=="capi*", MODE="0660" KERNEL=="dcbri*", MODE="0660" KERNEL=="ircomm*", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB*", GROUP="uucp", MODE="0660" KERNEL=="tts/[0-9]*", GROUP="uucp", MODE="0660" KERNEL=="tts/USB[0-9]*", GROUP="uucp", MODE="0660" @@ -170,9 +173,8 @@ KERNEL=="lp[0-9]*", SYMLINK+="par%n" BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" KERNEL=="microcode", NAME="cpu/%k" -# provide symlinks for backwards compatibility -KERNEL="msr[0-9]*", NAME="cpu/%n/msr", SYMLINK+="cpu/%k" -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpu", SYMLINK+="cpu/%k", SYMLINK+="%k" +KERNEL="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpu" KERNEL=="ram1", SYMLINK+="ram" KERNEL=="video0", SYMLINK+="video" @@ -235,6 +237,55 @@ KERNEL=="hd[a-z]*", BUS=="ide", SYSFS{removable}=="1", NAME{ignore_remove}="%k" KERNEL=="dvb*", PROGRAM=="/etc/udev/scripts/dvb.sh %k", NAME="%c" +####################################### +# Persistant block device stuff - begin +####################################### + +# Skip all of this if we are not adding a block device +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + +# skip accessing removable ide devices, cause the ide drivers are horrible broken +BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" +BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id" + +# persistent disk device links /dev/disk/ +KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" +KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# Skip id for ram / loop / fd +KERNEL=="ram*", GOTO="no_volume_id" +KERNEL=="loop*", GOTO="no_volume_id" +KERNEL=="fd*", GOTO="no_volume_id" + +KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# volume-label/uuid +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" +KERNEL=="sr*", GOTO="no_volume_id" +KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" +KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +LABEL="no_volume_id" + +LABEL="persistent_end" + +##################################### +# Persistant block device stuff - end +##################################### + + # Perhaps this should just be for all subsystems? @@ -265,5 +316,5 @@ ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}!="Onstream", \ ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[23689]", \ RUN+="/sbin/modprobe sg" -ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}="*", \ +ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", \ RUN+="/sbin/firmware_helper" -- cgit v1.2.3-54-g00ecf From 6e01a73fc31c220bfed43540ecd15a4daa8cc428 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Sep 2005 09:51:49 +0200 Subject: update Debian rules --- etc/udev/debian/compat-full.rules | 37 ------------------------------- etc/udev/debian/hotplug.rules | 46 +++++++++++++++++++++++++++++++++++++++ etc/udev/debian/hotplugd.rules | 6 ----- etc/udev/debian/persistent.rules | 8 +++---- etc/udev/debian/run.rules | 6 +++++ 5 files changed, 56 insertions(+), 47 deletions(-) delete mode 100644 etc/udev/debian/compat-full.rules create mode 100644 etc/udev/debian/hotplug.rules diff --git a/etc/udev/debian/compat-full.rules b/etc/udev/debian/compat-full.rules deleted file mode 100644 index 50e24bc64a..0000000000 --- a/etc/udev/debian/compat-full.rules +++ /dev/null @@ -1,37 +0,0 @@ -# compatibility links for a devfs-style /dev - -KERNEL=="md[0-9]*", SYMLINK+="%k" -KERNEL=="loop[0-9]*", SYMLINK+="%k" - -KERNEL=="tty[0-9]*", SYMLINK+="%k" -KERNEL=="ttyS[0-9]*", SYMLINK+="%k" -KERNEL=="ttyUSB[0-9]*", SYMLINK+="%k" - -KERNEL=="vcs", SYMLINK+="%k" -KERNEL=="vcs[0-9]*", SYMLINK+="%k" -KERNEL=="vcsa", SYMLINK+="%k" -KERNEL=="vcsa[0-9]*", SYMLINK+="%k" - -KERNEL=="video*", SYMLINK+="%k" -KERNEL=="radio*", SYMLINK+="%k" -KERNEL=="vbi*", SYMLINK+="%k" -KERNEL=="vtx*", SYMLINK+="%k" - -KERNEL=="apm_bios", SYMLINK+="%k" -KERNEL=="agpgart", SYMLINK+="%k" -KERNEL=="psaux", SYMLINK+="%k" -KERNEL=="nvram", SYMLINK+="%k" -KERNEL=="rtc", SYMLINK+="%k" -KERNEL=="ram[0-9]*", SYMLINK+="%k" - -KERNEL=="i2c-[0-9]*", SYMLINK+="%k" -KERNEL=="lp[0-9]*", SYMLINK+="%k" - -KERNEL=="audio*" SYMLINK+="%k" -KERNEL=="dsp*" SYMLINK+="%k" -KERNEL=="mixer*" SYMLINK+="%k" - -KERNEL=="fb[0-9]*", SYMLINK+="%k" -KERNEL=="fd[0-9]*", SYMLINK+="%k" -KERNEL=="js[0-9]*", SYMLINK+="%k" - diff --git a/etc/udev/debian/hotplug.rules b/etc/udev/debian/hotplug.rules new file mode 100644 index 0000000000..84f8c32156 --- /dev/null +++ b/etc/udev/debian/hotplug.rules @@ -0,0 +1,46 @@ +ACTION!="add", GOTO="hotplug_not_add_event" + +# check if the device has already been claimed by a driver +PROGRAM="/bin/sh -c 'test -e /sys$devpath/driver'", \ + GOTO="hotplug_driver_loaded" + +# workarounds for kernels which lack $MODALIAS support +SUBSYSTEM=="input", BUS=="serio", ENV{MODALIAS}!="?*", \ + IMPORT{program}="/lib/hotplug/modalias_serio" +SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", \ + IMPORT{program}="/lib/hotplug/modalias_ieee1394" + +# load the drivers +ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $modalias" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" + +SUBSYSTEM=="scsi_device", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe osst", \ + SYSFS{vendor}=="Onstream", SYSFS{model}!="ADR*" +SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe st", \ + SYSFS{vendor}=="Onstream", SYSFS{model}=="ADR*" +SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe st", \ + SYSFS{vendor}!="Onstream" +SUBSYSTEM=="scsi_device", SYSFS{type}=="[345]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", SYSFS{type}=="[235689]", RUN+="/sbin/modprobe sg" + +SUBSYSTEM=="input_device", ENV{ABS}=="?*", RUN+="/sbin/modprobe joydev" + +SUBSYSTEM=="ide", RUN+="/lib/hotplug/ide.agent" + +# From here on follows the hotplug agents which do not load modules +LABEL="hotplug_driver_loaded" + +# FIXME: does a sane default exist? +#SUBSYSTEM=="scsi_device", SYSFS{idVendor}=="...", \ +# RUN+="/lib/hotplug/scsi-re-add" + +SUBSYSTEM=="firmware", RUN+="/lib/hotplug/firmware.agent" + +LABEL="hotplug_not_add_event" + +SUBSYSTEM=="net", RUN+="/lib/hotplug/net.agent" + +# for debugging +#RUN+="/lib/hotplug/logger.agent" + diff --git a/etc/udev/debian/hotplugd.rules b/etc/udev/debian/hotplugd.rules index e311d22678..7b85e179e8 100644 --- a/etc/udev/debian/hotplugd.rules +++ b/etc/udev/debian/hotplugd.rules @@ -7,9 +7,3 @@ SUBSYSTEM=="module", OPTIONS="last_rule" ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" RUN+="/sbin/udev_run_devd" -# run a command on remove events -ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" - -# debugging monitor -RUN+="socket:/org/kernel/udev/monitor" - diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index a6467fa319..7bd44da36c 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -8,14 +8,14 @@ ACTION!="add", GOTO="no_volume_id" KERNEL=="ram*|loop*|fd*|nbd*", GOTO="no_volume_id" # skip removable ide devices, because open(2) on them causes an events loop -BUS=="ide", SYSFS{removable}=="1", GOTO="no_volume_id" -BUS=="ide", SYSFS{../removable}=="1", GOTO="no_volume_id" +BUS=="ide", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="no_volume_id" +BUS=="ide", SYSFS{../removable}=="1", GOTO="no_volume_id" # disk id KERNEL=="hd*[!0-9]", \ IMPORT{program}="/sbin/ata_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", \ +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="?*", \ IMPORT{program}="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ IMPORT{program}="/sbin/usb_id -x" @@ -39,7 +39,7 @@ KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", \ # path KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", \ - IMPORT{program}="/sbin/path_id %p", + IMPORT{program}="/sbin/path_id %p" KERNEL=="*[0-9]", IMPORT{parent}="ID_*" KERNEL=="*[!0-9]|sr*", ENV{ID_PATH}=="?*", \ diff --git a/etc/udev/debian/run.rules b/etc/udev/debian/run.rules index 23fa43c051..75d71375bb 100644 --- a/etc/udev/debian/run.rules +++ b/etc/udev/debian/run.rules @@ -1,3 +1,9 @@ +# debugging monitor +RUN+="socket:/org/kernel/udev/monitor" + +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + # ignore the events generated by virtual consoles KERNEL=="ptmx", OPTIONS+="last_rule" KERNEL=="console", OPTIONS+="last_rule" -- cgit v1.2.3-54-g00ecf From 2d8af104e0262554be2bf2cbbaa752bee6f1a65a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 27 Sep 2005 15:05:34 +0200 Subject: remove no longer needed includes Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/mac.c | 1 - extras/volume_id/volume_id/ocfs2.c | 1 - extras/volume_id/volume_id/reiserfs.c | 1 - extras/volume_id/volume_id/sysv.c | 1 - extras/volume_id/volume_id/volume_id.h | 2 +- 5 files changed, 1 insertion(+), 5 deletions(-) diff --git a/extras/volume_id/volume_id/mac.c b/extras/volume_id/volume_id/mac.c index 7ebd749e4f..f394ca45f8 100644 --- a/extras/volume_id/volume_id/mac.c +++ b/extras/volume_id/volume_id/mac.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" diff --git a/extras/volume_id/volume_id/ocfs2.c b/extras/volume_id/volume_id/ocfs2.c index 08138472ce..7ccdd066a7 100644 --- a/extras/volume_id/volume_id/ocfs2.c +++ b/extras/volume_id/volume_id/ocfs2.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c index 6cffdce8d8..e6677015de 100644 --- a/extras/volume_id/volume_id/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs.c @@ -33,7 +33,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" diff --git a/extras/volume_id/volume_id/sysv.c b/extras/volume_id/volume_id/sysv.c index 9645ef8004..a72d5025a9 100644 --- a/extras/volume_id/volume_id/sysv.c +++ b/extras/volume_id/volume_id/sysv.c @@ -32,7 +32,6 @@ #include #include #include -#include #include "volume_id.h" #include "logging.h" diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 0f5716b893..6537f7c67e 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -23,7 +23,7 @@ #include -#define VOLUME_ID_VERSION 49 +#define VOLUME_ID_VERSION 50 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From 2321ba6fd89635f321ec08fa3803aa7e20aa76bf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 27 Sep 2005 16:27:35 +0200 Subject: switch tools and volume_id from LGPL to GPLv2 After beeing hit by proprietary applications which statically link the LGPL'd libusb, which needs a patch to reflect the recent kernel changes, I decided not to provide LGPL code anymore. Signed-off-by: Kay Sievers --- extras/ata_id/ata_id.c | 16 +++------------- extras/cdrom_id/cdrom_id.c | 3 --- extras/dasd_id/dasd_id.c | 10 ---------- extras/edd_id/edd_id.c | 1 - extras/firmware/firmware_helper.c | 10 +++------- extras/floppy/create_floppy_devices.c | 20 +++++--------------- extras/path_id | 16 ++++++++++------ extras/usb_id/usb_id.c | 18 ++++-------------- extras/volume_id/volume_id/cramfs.c | 16 +++------------- extras/volume_id/volume_id/cramfs.h | 16 +++------------- extras/volume_id/volume_id/ext.c | 16 +++------------- extras/volume_id/volume_id/ext.h | 16 +++------------- extras/volume_id/volume_id/fat.c | 16 +++------------- extras/volume_id/volume_id/fat.h | 16 +++------------- extras/volume_id/volume_id/hfs.c | 16 +++------------- extras/volume_id/volume_id/hfs.h | 16 +++------------- extras/volume_id/volume_id/highpoint.c | 16 +++------------- extras/volume_id/volume_id/highpoint.h | 16 +++------------- extras/volume_id/volume_id/hpfs.c | 16 +++------------- extras/volume_id/volume_id/hpfs.h | 16 +++------------- extras/volume_id/volume_id/iso9660.c | 16 +++------------- extras/volume_id/volume_id/iso9660.h | 16 +++------------- extras/volume_id/volume_id/isw_raid.c | 16 +++------------- extras/volume_id/volume_id/isw_raid.h | 16 +++------------- extras/volume_id/volume_id/jfs.c | 16 +++------------- extras/volume_id/volume_id/jfs.h | 16 +++------------- extras/volume_id/volume_id/linux_raid.c | 16 +++------------- extras/volume_id/volume_id/linux_raid.h | 16 +++------------- extras/volume_id/volume_id/linux_swap.c | 16 +++------------- extras/volume_id/volume_id/linux_swap.h | 16 +++------------- extras/volume_id/volume_id/logging.h | 3 +++ extras/volume_id/volume_id/lsi_raid.c | 16 +++------------- extras/volume_id/volume_id/lsi_raid.h | 16 +++------------- extras/volume_id/volume_id/luks.c | 16 +++------------- extras/volume_id/volume_id/luks.h | 16 +++------------- extras/volume_id/volume_id/lvm.c | 16 +++------------- extras/volume_id/volume_id/lvm.h | 16 +++------------- extras/volume_id/volume_id/mac.c | 16 +++------------- extras/volume_id/volume_id/mac.h | 16 +++------------- extras/volume_id/volume_id/minix.c | 16 +++------------- extras/volume_id/volume_id/minix.h | 16 +++------------- extras/volume_id/volume_id/msdos.c | 16 +++------------- extras/volume_id/volume_id/msdos.h | 16 +++------------- extras/volume_id/volume_id/ntfs.c | 16 +++------------- extras/volume_id/volume_id/ntfs.h | 16 +++------------- extras/volume_id/volume_id/nvidia_raid.c | 16 +++------------- extras/volume_id/volume_id/nvidia_raid.h | 16 +++------------- extras/volume_id/volume_id/ocfs2.c | 16 +++------------- extras/volume_id/volume_id/ocfs2.h | 16 +++------------- extras/volume_id/volume_id/promise_raid.c | 16 +++------------- extras/volume_id/volume_id/promise_raid.h | 16 +++------------- extras/volume_id/volume_id/reiserfs.c | 16 +++------------- extras/volume_id/volume_id/reiserfs.h | 16 +++------------- extras/volume_id/volume_id/romfs.c | 16 +++------------- extras/volume_id/volume_id/romfs.h | 16 +++------------- extras/volume_id/volume_id/silicon_raid.c | 16 +++------------- extras/volume_id/volume_id/silicon_raid.h | 16 +++------------- extras/volume_id/volume_id/sysv.c | 16 +++------------- extras/volume_id/volume_id/sysv.h | 16 +++------------- extras/volume_id/volume_id/udf.c | 16 +++------------- extras/volume_id/volume_id/udf.h | 16 +++------------- extras/volume_id/volume_id/ufs.c | 16 +++------------- extras/volume_id/volume_id/ufs.h | 16 +++------------- extras/volume_id/volume_id/util.c | 16 +++------------- extras/volume_id/volume_id/util.h | 16 +++------------- extras/volume_id/volume_id/via_raid.c | 16 +++------------- extras/volume_id/volume_id/via_raid.h | 16 +++------------- extras/volume_id/volume_id/volume_id.c | 16 +++------------- extras/volume_id/volume_id/volume_id.h | 16 +++------------- extras/volume_id/volume_id/xfs.c | 16 +++------------- extras/volume_id/volume_id/xfs.h | 16 +++------------- 71 files changed, 214 insertions(+), 875 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index ba40555a0b..a97cc284cc 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 091bf91559..ff6f89e163 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -7,9 +7,6 @@ * under the terms of the GNU General Public License as published by the * Free Software Foundation version 2 of the License. * - * Framework based on ata_id which is: - * Copyright (C) 2005 Kay Sievers - * */ #ifndef _GNU_SOURCE diff --git a/extras/dasd_id/dasd_id.c b/extras/dasd_id/dasd_id.c index a6f2de0db7..ca2582cde6 100644 --- a/extras/dasd_id/dasd_id.c +++ b/extras/dasd_id/dasd_id.c @@ -6,16 +6,6 @@ * 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 02139, USA. - * */ #ifndef _GNU_SOURCE diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 8ac50e9812..f21362b902 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -7,7 +7,6 @@ * 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. - * */ #ifndef _GNU_SOURCE diff --git a/extras/firmware/firmware_helper.c b/extras/firmware/firmware_helper.c index 45815137ac..2bc6b50f06 100644 --- a/extras/firmware/firmware_helper.c +++ b/extras/firmware/firmware_helper.c @@ -3,13 +3,9 @@ * * Copyright 2005 Red Hat, Inc. * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * 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 02139, USA. - * + * 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. */ #include diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index f4003c2ce2..b2906106d4 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -6,22 +6,12 @@ * * Copyright(C) 2005, SUSE Linux Products GmbH * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Author: Hannes Reinecke + * Author: + * Hannes Reinecke * + * 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. */ #include diff --git a/extras/path_id b/extras/path_id index c7f50687fe..4ac718717a 100755 --- a/extras/path_id +++ b/extras/path_id @@ -4,15 +4,19 @@ # for the udev persistent disk device naming scheme # # Copyright (C) 2005 SUSE Linux Products GmbH -# Licensed under the GPL v2. +# Author: +# Hannes Reinecke +# +# 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. # # to be called from a udev rule to return the name for a symlink -# DEVPATH=/block/sda/sda3 $0 (or similar) -# $0 /block/sda -# $0 /sys/block/sda +# DEVPATH=/block/sda/sda3 path_id +# path_id -# example for all: -# for i in `find /sys/block -name dev` ;do DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`" $0 ; done +# example for all block devices on a system: +# for i in `find /sys/block -name dev` ;do DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`" path_id ; done # examples: # SCSI cdrom diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index c4ce0c6103..b7d67958c9 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -4,23 +4,13 @@ * Identify an USB (block) device * * Copyright (c) 2005 SUSE Linux Products GmbH, Germany + * * Author: * Hannes Reinecke * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of the - * License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA + * 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. */ #include diff --git a/extras/volume_id/volume_id/cramfs.c b/extras/volume_id/volume_id/cramfs.c index 9a71b0265c..85a1bc8c55 100644 --- a/extras/volume_id/volume_id/cramfs.c +++ b/extras/volume_id/volume_id/cramfs.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/cramfs.h b/extras/volume_id/volume_id/cramfs.h index a40cec199d..0ff19c342e 100644 --- a/extras/volume_id/volume_id/cramfs.h +++ b/extras/volume_id/volume_id/cramfs.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_CRAMFS_ diff --git a/extras/volume_id/volume_id/ext.c b/extras/volume_id/volume_id/ext.c index 64e5ff7cbf..df2ebb696b 100644 --- a/extras/volume_id/volume_id/ext.c +++ b/extras/volume_id/volume_id/ext.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/ext.h b/extras/volume_id/volume_id/ext.h index aa931a02a8..dfda2074b8 100644 --- a/extras/volume_id/volume_id/ext.h +++ b/extras/volume_id/volume_id/ext.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_EXT_ diff --git a/extras/volume_id/volume_id/fat.c b/extras/volume_id/volume_id/fat.c index 9fa0387afe..d5f84ece4c 100644 --- a/extras/volume_id/volume_id/fat.c +++ b/extras/volume_id/volume_id/fat.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/fat.h b/extras/volume_id/volume_id/fat.h index 0043210d5a..92fa953b11 100644 --- a/extras/volume_id/volume_id/fat.h +++ b/extras/volume_id/volume_id/fat.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_FAT_ diff --git a/extras/volume_id/volume_id/hfs.c b/extras/volume_id/volume_id/hfs.c index ab1bc2ec39..8de8b9aaac 100644 --- a/extras/volume_id/volume_id/hfs.c +++ b/extras/volume_id/volume_id/hfs.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/hfs.h b/extras/volume_id/volume_id/hfs.h index 42dc449e29..4f732b6726 100644 --- a/extras/volume_id/volume_id/hfs.h +++ b/extras/volume_id/volume_id/hfs.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_HFS_ diff --git a/extras/volume_id/volume_id/highpoint.c b/extras/volume_id/volume_id/highpoint.c index baa278ba80..33c4a8c9c0 100644 --- a/extras/volume_id/volume_id/highpoint.c +++ b/extras/volume_id/volume_id/highpoint.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/highpoint.h b/extras/volume_id/volume_id/highpoint.h index b0462f0525..f04d5f1685 100644 --- a/extras/volume_id/volume_id/highpoint.h +++ b/extras/volume_id/volume_id/highpoint.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_HIGHPOINT_ diff --git a/extras/volume_id/volume_id/hpfs.c b/extras/volume_id/volume_id/hpfs.c index 8cd65cd6e9..3b97d9339d 100644 --- a/extras/volume_id/volume_id/hpfs.c +++ b/extras/volume_id/volume_id/hpfs.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/hpfs.h b/extras/volume_id/volume_id/hpfs.h index d496829033..d33e43a114 100644 --- a/extras/volume_id/volume_id/hpfs.h +++ b/extras/volume_id/volume_id/hpfs.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_HPFS_ diff --git a/extras/volume_id/volume_id/iso9660.c b/extras/volume_id/volume_id/iso9660.c index 8811ffbc03..3999a1e7bf 100644 --- a/extras/volume_id/volume_id/iso9660.c +++ b/extras/volume_id/volume_id/iso9660.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/iso9660.h b/extras/volume_id/volume_id/iso9660.h index 0119acac6c..c407d416a2 100644 --- a/extras/volume_id/volume_id/iso9660.h +++ b/extras/volume_id/volume_id/iso9660.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_ISO9660_ diff --git a/extras/volume_id/volume_id/isw_raid.c b/extras/volume_id/volume_id/isw_raid.c index 9c3082dbbf..745b42f2d1 100644 --- a/extras/volume_id/volume_id/isw_raid.c +++ b/extras/volume_id/volume_id/isw_raid.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/isw_raid.h b/extras/volume_id/volume_id/isw_raid.h index 7f48b0196f..55d8c49268 100644 --- a/extras/volume_id/volume_id/isw_raid.h +++ b/extras/volume_id/volume_id/isw_raid.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_ISW_RAID_ diff --git a/extras/volume_id/volume_id/jfs.c b/extras/volume_id/volume_id/jfs.c index 6899e939ac..1b2bfdf0e9 100644 --- a/extras/volume_id/volume_id/jfs.c +++ b/extras/volume_id/volume_id/jfs.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/jfs.h b/extras/volume_id/volume_id/jfs.h index e979eb740c..4ef0d8763c 100644 --- a/extras/volume_id/volume_id/jfs.h +++ b/extras/volume_id/volume_id/jfs.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_JFS_ diff --git a/extras/volume_id/volume_id/linux_raid.c b/extras/volume_id/volume_id/linux_raid.c index ece3e46f6d..eb37dba367 100644 --- a/extras/volume_id/volume_id/linux_raid.c +++ b/extras/volume_id/volume_id/linux_raid.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/linux_raid.h b/extras/volume_id/volume_id/linux_raid.h index adf6ebaacd..8fdeebf5cd 100644 --- a/extras/volume_id/volume_id/linux_raid.h +++ b/extras/volume_id/volume_id/linux_raid.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_LINUX_RAID_ diff --git a/extras/volume_id/volume_id/linux_swap.c b/extras/volume_id/volume_id/linux_swap.c index 1ffc2a8cb5..b3e22f6db2 100644 --- a/extras/volume_id/volume_id/linux_swap.c +++ b/extras/volume_id/volume_id/linux_swap.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/linux_swap.h b/extras/volume_id/volume_id/linux_swap.h index c8fa90d5c5..e31ee6eb90 100644 --- a/extras/volume_id/volume_id/linux_swap.h +++ b/extras/volume_id/volume_id/linux_swap.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_LINUX_SWAP_ diff --git a/extras/volume_id/volume_id/logging.h b/extras/volume_id/volume_id/logging.h index ac30264158..4a8aa50d4c 100644 --- a/extras/volume_id/volume_id/logging.h +++ b/extras/volume_id/volume_id/logging.h @@ -2,6 +2,9 @@ * volume_id_logging - this file is used to map the dbg() function * to the user's logging facility * + * 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. */ #ifndef _VOLUME_ID_LOGGING_H_ diff --git a/extras/volume_id/volume_id/lsi_raid.c b/extras/volume_id/volume_id/lsi_raid.c index bb2ac7f9c5..e5da281203 100644 --- a/extras/volume_id/volume_id/lsi_raid.c +++ b/extras/volume_id/volume_id/lsi_raid.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/lsi_raid.h b/extras/volume_id/volume_id/lsi_raid.h index 2c2758bdb4..51a0bfbcc6 100644 --- a/extras/volume_id/volume_id/lsi_raid.h +++ b/extras/volume_id/volume_id/lsi_raid.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_LSI_RAID_ diff --git a/extras/volume_id/volume_id/luks.c b/extras/volume_id/volume_id/luks.c index 22d2a94ac7..ff90f5d3d1 100644 --- a/extras/volume_id/volume_id/luks.c +++ b/extras/volume_id/volume_id/luks.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 W. Michael Petullo * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/luks.h b/extras/volume_id/volume_id/luks.h index f53a1558ec..fbf3fcd846 100644 --- a/extras/volume_id/volume_id/luks.h +++ b/extras/volume_id/volume_id/luks.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 W. Michael Petullo * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_LUKS_ diff --git a/extras/volume_id/volume_id/lvm.c b/extras/volume_id/volume_id/lvm.c index b2e2e421d0..a188402da8 100644 --- a/extras/volume_id/volume_id/lvm.c +++ b/extras/volume_id/volume_id/lvm.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/lvm.h b/extras/volume_id/volume_id/lvm.h index 555f18d904..d07cb53af6 100644 --- a/extras/volume_id/volume_id/lvm.h +++ b/extras/volume_id/volume_id/lvm.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_LVM_ diff --git a/extras/volume_id/volume_id/mac.c b/extras/volume_id/volume_id/mac.c index f394ca45f8..1587f48823 100644 --- a/extras/volume_id/volume_id/mac.c +++ b/extras/volume_id/volume_id/mac.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/mac.h b/extras/volume_id/volume_id/mac.h index 0ab0d4489d..77b8ccda6f 100644 --- a/extras/volume_id/volume_id/mac.h +++ b/extras/volume_id/volume_id/mac.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_MAC_ diff --git a/extras/volume_id/volume_id/minix.c b/extras/volume_id/volume_id/minix.c index 97aa83a3dc..b081afab49 100644 --- a/extras/volume_id/volume_id/minix.c +++ b/extras/volume_id/volume_id/minix.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/minix.h b/extras/volume_id/volume_id/minix.h index 2a3fd7292b..3020cc0464 100644 --- a/extras/volume_id/volume_id/minix.h +++ b/extras/volume_id/volume_id/minix.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_MINIX_ diff --git a/extras/volume_id/volume_id/msdos.c b/extras/volume_id/volume_id/msdos.c index 0b8dbbeaec..ab18fc3585 100644 --- a/extras/volume_id/volume_id/msdos.c +++ b/extras/volume_id/volume_id/msdos.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/msdos.h b/extras/volume_id/volume_id/msdos.h index 29be629845..b319f05d63 100644 --- a/extras/volume_id/volume_id/msdos.h +++ b/extras/volume_id/volume_id/msdos.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_MSDOS_ diff --git a/extras/volume_id/volume_id/ntfs.c b/extras/volume_id/volume_id/ntfs.c index f59da48165..39aa2d73c6 100644 --- a/extras/volume_id/volume_id/ntfs.c +++ b/extras/volume_id/volume_id/ntfs.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/ntfs.h b/extras/volume_id/volume_id/ntfs.h index 2a84db3653..8d59159685 100644 --- a/extras/volume_id/volume_id/ntfs.h +++ b/extras/volume_id/volume_id/ntfs.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_NTFS_ diff --git a/extras/volume_id/volume_id/nvidia_raid.c b/extras/volume_id/volume_id/nvidia_raid.c index d49ffe3010..9198f1e067 100644 --- a/extras/volume_id/volume_id/nvidia_raid.c +++ b/extras/volume_id/volume_id/nvidia_raid.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/nvidia_raid.h b/extras/volume_id/volume_id/nvidia_raid.h index 250c1f8214..80c51692aa 100644 --- a/extras/volume_id/volume_id/nvidia_raid.h +++ b/extras/volume_id/volume_id/nvidia_raid.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_NVIDIA_RAID_ diff --git a/extras/volume_id/volume_id/ocfs2.c b/extras/volume_id/volume_id/ocfs2.c index 7ccdd066a7..3a771123f1 100644 --- a/extras/volume_id/volume_id/ocfs2.c +++ b/extras/volume_id/volume_id/ocfs2.c @@ -3,19 +3,9 @@ * * Copyright (C) Andre Masella * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/ocfs2.h b/extras/volume_id/volume_id/ocfs2.h index b4b7cc4469..24b43b1875 100644 --- a/extras/volume_id/volume_id/ocfs2.h +++ b/extras/volume_id/volume_id/ocfs2.h @@ -3,19 +3,9 @@ * * Copyright (C) Andre Masella * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_OCFS2_ diff --git a/extras/volume_id/volume_id/promise_raid.c b/extras/volume_id/volume_id/promise_raid.c index ed72809acb..54832a888a 100644 --- a/extras/volume_id/volume_id/promise_raid.c +++ b/extras/volume_id/volume_id/promise_raid.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/promise_raid.h b/extras/volume_id/volume_id/promise_raid.h index f1a9925d72..a46b062015 100644 --- a/extras/volume_id/volume_id/promise_raid.h +++ b/extras/volume_id/volume_id/promise_raid.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_PROMISE_RAID_ diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c index e6677015de..e64b08acdd 100644 --- a/extras/volume_id/volume_id/reiserfs.c +++ b/extras/volume_id/volume_id/reiserfs.c @@ -4,19 +4,9 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2005 Tobias Klauser * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/reiserfs.h b/extras/volume_id/volume_id/reiserfs.h index 2ef1d255b7..57ee05ea2e 100644 --- a/extras/volume_id/volume_id/reiserfs.h +++ b/extras/volume_id/volume_id/reiserfs.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_REISERFS_ diff --git a/extras/volume_id/volume_id/romfs.c b/extras/volume_id/volume_id/romfs.c index 3d7df2443f..3373f36497 100644 --- a/extras/volume_id/volume_id/romfs.c +++ b/extras/volume_id/volume_id/romfs.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/romfs.h b/extras/volume_id/volume_id/romfs.h index 5a8e900b08..5fe56dcdfe 100644 --- a/extras/volume_id/volume_id/romfs.h +++ b/extras/volume_id/volume_id/romfs.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_ROMFS_ diff --git a/extras/volume_id/volume_id/silicon_raid.c b/extras/volume_id/volume_id/silicon_raid.c index 0d5ce043da..5f68127c4f 100644 --- a/extras/volume_id/volume_id/silicon_raid.c +++ b/extras/volume_id/volume_id/silicon_raid.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/silicon_raid.h b/extras/volume_id/volume_id/silicon_raid.h index 0816125d7f..f80c1a4a3f 100644 --- a/extras/volume_id/volume_id/silicon_raid.h +++ b/extras/volume_id/volume_id/silicon_raid.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_SILICON_RAID_ diff --git a/extras/volume_id/volume_id/sysv.c b/extras/volume_id/volume_id/sysv.c index a72d5025a9..610edb8876 100644 --- a/extras/volume_id/volume_id/sysv.c +++ b/extras/volume_id/volume_id/sysv.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/sysv.h b/extras/volume_id/volume_id/sysv.h index 1cb2bf9f43..b8c369ec08 100644 --- a/extras/volume_id/volume_id/sysv.h +++ b/extras/volume_id/volume_id/sysv.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_SYSV_ diff --git a/extras/volume_id/volume_id/udf.c b/extras/volume_id/volume_id/udf.c index ecb6b9743d..f54ca87c8f 100644 --- a/extras/volume_id/volume_id/udf.c +++ b/extras/volume_id/volume_id/udf.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/udf.h b/extras/volume_id/volume_id/udf.h index 5a784ad068..ff95cc1058 100644 --- a/extras/volume_id/volume_id/udf.h +++ b/extras/volume_id/volume_id/udf.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_UDF_ diff --git a/extras/volume_id/volume_id/ufs.c b/extras/volume_id/volume_id/ufs.c index 763b79cb0b..a7bd091c5e 100644 --- a/extras/volume_id/volume_id/ufs.c +++ b/extras/volume_id/volume_id/ufs.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/ufs.h b/extras/volume_id/volume_id/ufs.h index 8f0af18897..ae46a924b4 100644 --- a/extras/volume_id/volume_id/ufs.h +++ b/extras/volume_id/volume_id/ufs.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_UFS_ diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c index d1271a86be..361d7058d0 100644 --- a/extras/volume_id/volume_id/util.c +++ b/extras/volume_id/volume_id/util.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h index 0c94fea051..afaa0b7d8d 100644 --- a/extras/volume_id/volume_id/util.h +++ b/extras/volume_id/volume_id/util.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_UTIL_ diff --git a/extras/volume_id/volume_id/via_raid.c b/extras/volume_id/volume_id/via_raid.c index 2f167dcbcc..2b74123016 100644 --- a/extras/volume_id/volume_id/via_raid.c +++ b/extras/volume_id/volume_id/via_raid.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/via_raid.h b/extras/volume_id/volume_id/via_raid.h index 429375dcc9..3eeaa2cee3 100644 --- a/extras/volume_id/volume_id/via_raid.h +++ b/extras/volume_id/volume_id/via_raid.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_VIA_RAID_ diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 32b91e65ca..d1a6a5f0f5 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 6537f7c67e..2ee974ff42 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -3,19 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID_H_ diff --git a/extras/volume_id/volume_id/xfs.c b/extras/volume_id/volume_id/xfs.c index e631e23ead..7fd629099d 100644 --- a/extras/volume_id/volume_id/xfs.c +++ b/extras/volume_id/volume_id/xfs.c @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/volume_id/xfs.h b/extras/volume_id/volume_id/xfs.h index 537617f7e5..f21cc5f929 100644 --- a/extras/volume_id/volume_id/xfs.h +++ b/extras/volume_id/volume_id/xfs.h @@ -3,19 +3,9 @@ * * Copyright (C) 2004 Kay Sievers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 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. */ #ifndef _VOLUME_ID__ -- cgit v1.2.3-54-g00ecf From 144d1c9707f80f24014db49eaa6929732727fe87 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 27 Sep 2005 16:38:43 +0200 Subject: add edd-*-part%n to the persistent.rules Thanks to: Marco d'Itri Signed-off-by: Kay Sievers --- etc/udev/persistent.rules | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/udev/persistent.rules b/etc/udev/persistent.rules index 0ca0c56545..0b231aacd5 100644 --- a/etc/udev/persistent.rules +++ b/etc/udev/persistent.rules @@ -8,7 +8,7 @@ SUBSYSTEM!="block", GOTO="persistent_end" KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" # never access removable ide devices, the drivers are causing event loops on open() -SUBSYSTEM=="block", BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" +BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" @@ -40,7 +40,8 @@ ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # BIOS Enhanced Disk Device KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" -ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" LABEL="persistent_end" -- cgit v1.2.3-54-g00ecf From af2703d39aaf924cbfdce5a41b498a0a025c34d1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 27 Sep 2005 16:43:27 +0200 Subject: update Debian persistent rules --- etc/udev/debian/persistent.rules | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index 7bd44da36c..4b591b02fa 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -9,46 +9,54 @@ KERNEL=="ram*|loop*|fd*|nbd*", GOTO="no_volume_id" # skip removable ide devices, because open(2) on them causes an events loop BUS=="ide", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="no_volume_id" -BUS=="ide", SYSFS{../removable}=="1", GOTO="no_volume_id" -# disk id +# look for different kinds of unique identificators KERNEL=="hd*[!0-9]", \ IMPORT{program}="/sbin/ata_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="?*", \ - IMPORT{program}="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" + ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$sysfs{ieee1394_id}" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ IMPORT{program}="/sbin/usb_id -x" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ - IMPORT{program}="/sbin/scsi_id -g -x -s %p -d %N" + IMPORT{program}="/sbin/scsi_id -g -x -s $devpath -d $tempnode" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ - IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d %N" + IMPORT{program}="/sbin/scsi_id -g -x -a -s $devpath -d $tempnode" KERNEL=="dasd*[!0-9]", \ IMPORT{program}="/sbin/dasd_id --export $tempnode" -KERNEL=="hd*[0-9]|sd*[0-9]|dasd*[0-9]", IMPORT{parent}="ID_*" +KERNEL=="*[!0-9]", SYSFS{removable}!="1", \ + IMPORT{program}="/sbin/edd_id --export $tempnode" + +# find the physical path of the device +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", \ + IMPORT{program}="/sbin/path_id $devpath" + +# import the variables of partitions from the parent disks +KERNEL=="*[0-9]", IMPORT{parent}="ID_*" + KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="sd*[!0-9]|sr*|dasd[!0-9]*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="sd*[!0-9]|dasd[!0-9]*|sr*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" -# path -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", \ - IMPORT{program}="/sbin/path_id %p" - -KERNEL=="*[0-9]", IMPORT{parent}="ID_*" KERNEL=="*[!0-9]|sr*", ENV{ID_PATH}=="?*", \ SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="sr*", GOTO="no_volume_id" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # UUID and volume label -KERNEL=="*[!0-9]|sr*", SYSFS{removable}=="1", GOTO="no_volume_id" +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" IMPORT{program}="/sbin/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -- cgit v1.2.3-54-g00ecf From 3162a25fd3d6fe95026dc754ef5d5859b62a6b7c Mon Sep 17 00:00:00 2001 From: Date: Tue, 27 Sep 2005 08:11:31 -0700 Subject: Remove the udev.spec file as no one uses it anymore Signed-off-by: Greg Kroah-Hartman --- udev.spec | 179 -------------------------------------------------------------- 1 file changed, 179 deletions(-) delete mode 100644 udev.spec diff --git a/udev.spec b/udev.spec deleted file mode 100644 index 2b8eb054c0..0000000000 --- a/udev.spec +++ /dev/null @@ -1,179 +0,0 @@ -# if we want to build against the included version of klibc or not. -# 0 - do not use klibc -# 1 - use klibc -# Watch out for where the linux symlink is in the klibc part of the tarball, -# it probably is not where you want it to be. -%define klibc 1 - -# if we want to have logging support in or not. -# 0 - no logging support -# 1 - logging support -# Note, it is not recommend if you use klibc to enable logging. -%define log 0 - -# if we want to enable debugging support in udev. If it is enabled, lots of -# stuff will get sent to the debug syslog. -# 0 - debugging disabled -# 1 - debugging enabled -%define debug 0 - -# if we want to build the scsi_id "extra" package or not -# 0 - do not build the package -# 1 - build it -%define scsi_id 1 - -# if we want to build the volume_id "extra" package or not -# 0 - do not build the package -# 1 - build it -%define volume_id 1 - -Summary: A userspace device manager providing devfs functionality -Name: udev -Version: 070 -Release: 1 -License: GPL -Group: Utilities/System -Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.tar.gz -ExclusiveOS: Linux -Vendor: Greg Kroah-Hartman -URL : kernel.org/pub/linux/utils/kernel/hotplug/ -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -Prereq: /bin/sh, fileutils, hotplug - -%description -udev is a userspace device manager, using sysfs and uevents -to provide a devfs-like device directory management and uevent -dispatching. - -%prep -%setup -q - -%build -make CC="gcc $RPM_OPT_FLAGS" \ -%if %{klibc} - USE_KLIBC=true \ -%endif -%if %{log} - USE_LOG=true \ -%else - USE_LOG=false \ -%endif -%if %{debug} - DEBUG=true \ -%else - DEBUG=false \ -%endif - EXTRAS=" \ -%if %{scsi_id} - extras/scsi_id \ -%endif -%if %{volume_id} - extras/volume_id \ -%endif -" - -%install -rm -rf $RPM_BUILD_ROOT -make DESTDIR=$RPM_BUILD_ROOT install \ - EXTRAS=" \ -%if %{scsi_id} - extras/scsi_id \ -%endif -%if %{volume_id} - extras/volume_id \ -%endif -" - -%post -/sbin/chkconfig --add udev - -%postun -if [ $1 = 0 ]; then - /sbin/chkconfig --del udev -fi - -%clean -rm -rf $RPM_BUILD_ROOT - -%files -%defattr(-,root,root) -%doc COPYING README TODO ChangeLog HOWTO* docs/* -%doc etc/udev/udev.rules.{examples,gentoo,redhat} -%attr(755,root,root) /sbin/udev -%attr(755,root,root) /usr/bin/udevinfo -%attr(755,root,root) /sbin/udevsend -%attr(755,root,root) /sbin/udevd -%attr(755,root,root) /usr/bin/udevtest -%attr(755,root,root) /sbin/udevstart -%attr(755,root,root) %dir /udev/ -%attr(755,root,root) %dir /etc/udev/ -%config(noreplace) %attr(0644,root,root) /etc/udev/udev.conf -%attr(755,root,root) %dir /etc/udev/rules.d/ -%config(noreplace) %attr(0644,root,root) /etc/udev/rules.d/50-udev.rules -%attr(-,root,root) /etc/hotplug.d/default/udev.hotplug -%attr(755,root,root) /etc/init.d/udev -%attr(0644,root,root) %{_mandir}/man8/udev*.8* - -%if %{scsi_id} - %attr(755,root,root) /sbin/scsi_id - %config(noreplace) %attr(0644,root,root) /etc/scsi_id.config - %attr(0644,root,root) %{_mandir}/man8/scsi_id*.8* -%endif -%if %{volume_id} - %attr(755,root,root) /sbin/udev_volume_id -%endif - -%changelog -* Fri May 14 2004 Greg Kroah-Hartman -- remove dbus and selinux stuff from here -- added volume_id option - -* Wed Mar 24 2004 Greg Kroah-Hartman -- change the way dbus and selinux support is built (now an extra) - -* Tue Mar 2 2004 Greg Kroah-Hartman -- added udevstart to the list of files installed -- udevinfo is now in /usr/bin not /sbin - -* Fri Feb 27 2004 Greg Kroah-Hartman -- added ability to build with SELinux support - -* Thu Feb 19 2004 Greg Kroah-Hartman -- add some more files to the documentation directory -- add ability to build scsi_id and make it the default - -* Mon Feb 16 2004 Greg Kroah-Hartman -- fix up udevd build, as it's no longer needed to be build seperatly -- add udevtest to list of files -- more Red Hat sync ups. - -* Thu Feb 12 2004 Greg Kroah-Hartman -- add some changes from the latest Fedora udev release. - -* Mon Feb 2 2004 Greg Kroah-Hartman -- add udevsend, and udevd to the files -- add ability to build udevd with glibc after the rest is build with klibc - -* Mon Jan 26 2004 Greg Kroah-Hartman -- added udevinfo to rpm -- added URL to spec file -- added udevinfo's man page - -* Mon Jan 05 2004 Rolf Eike Beer -- add defines to choose the init script (Redhat or LSB) - -* Tue Dec 16 2003 Robert Love -- install the initscript and run chkconfig on it - -* Tue Nov 2 2003 Greg Kroah-Hartman -- changes due to config file name changes - -* Fri Oct 17 2003 Robert Love -- Make work without a build root -- Correctly install the right files -- Pass the RPM_OPT_FLAGS to gcc so we can build per the build policy -- Put some prereqs in -- Install the hotplug symlink to udev - -* Mon Jul 28 2003 Paul Mundt -- Initial spec file for udev-0.2. -- cgit v1.2.3-54-g00ecf From c2df8b5f517216ab7763c1b25655c170cfcee097 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 3 Oct 2005 16:28:11 +0200 Subject: clarify README Signed-off-by: Kay Sievers --- README | 182 ++++++++++++++++++++++++---------------------------------- docs/udev.xml | 2 +- udev.8 | 2 +- 3 files changed, 78 insertions(+), 108 deletions(-) diff --git a/README b/README index 9891c696d3..19ed4468ea 100644 --- a/README +++ b/README @@ -1,107 +1,77 @@ - -udev - a userspace device manager - -For more information on the design, and structure of this project, see the -files in the docs/ directory. - -To use: - -- You must be running a 2.6 version of the Linux kernel. - -- Your 2.6 kernel must have had CONFIG_HOTPLUG enabled when it was built. - -- Make sure sysfs is mounted at /sys. No other location is supported. - You can mount it by running: - mount -t sysfs none /sys - -- Make sure you integrate udev with your hotplug setup. There is a copy of - the rules files for all major distros in the etc/udev folder. You may look - there how others are doing it. - -- Make sure you integrate with the kernel hotplug events. Later versions of - udev are able to listen directly to a netlink socket, older versions used - udevsend to feed the udev daemon with the kernel event. The most basic - setup to run udev is to let the kernel for the udev binary directly: - echo "/sbin/udev" > /proc/sys/kernel/hotplug - - While this may work in some setups, it is not recommended to do. A recent - kernel and udev version is able to operate with the event serializing daemon - udevd, that makes sure, that no "remove" event will beat a "add" event for - the same device. - -- Build the project: - make - - Note: - There are a number of different flags that you can use when building - udev. They are as follows: - prefix - set this to the default root that you want udev to be - installed into. This works just like the 'configure --prefix' - script does. Default value is ''. Only override this if you - really know what you are doing. - USE_KLIBC - if set to 'true', udev is built and linked against the - included version of klibc. Default value is 'false'. - USE_LOG - if set to 'true', udev will emit messages to the syslog when - it creates or removes device nodes. This is helpful to see - what udev is doing. This is enabled by default. Note, if you - are building udev against klibc it is recommended that you - disable this option (due to klibc's syslog implementation.) - USE_SELINUX - if set to 'true', udev will be built with SELinux support - enabled. This is disabled by default. - DEBUG - if set to 'true', debugging messages will be sent to the syslog - as udev is run. Default value is 'false'. - KERNEL_DIR - If this is not set it will default to /lib/modules/`uname -r`/build - This is used if USE_KLIBC=true to find the kernel include - directory that klibc needs to build against. This must be set - if you are not building udev while running a 2.6 kernel. - EXTRAS - if set, will build the "extra" helper programs as specified - as listed (see below for an example.) - - So, if you want to build udev using klibc with debugging messages, you - would do: - make USE_KLIBC=true DEBUG=true - - If you want to build the udev helper program cdrom_id and scsi_id you - would do: - make EXTRAS="extras/cdrom_id extras/scsi_id" - - udev will follow the setting of the debug level in udev.conf. Adapt this - value to see the debug in syslog. - -- Install the project: - make install - - This will put the udev binaries in /sbin, create the and /etc/udev - directories, and place the udev configuration files in /etc/udev/. You - will probably want to edit the *.rules files to create custom naming - rules. More info on how the config files are set up are contained in - comments in the files, and is located in the documentation. - -- Add and remove devices from the system and marvel as nodes are created - and removed in /dev based on the device types. - -- If you later get sick of it, uninstall it: - make uninstall - -If nothing seems to happen, make sure your build worked properly by -running the udev-test.pl script as root in the test/ subdirectory of the -udev source tree. Running udevstart should populate an empty /dev -directory. You may test, if a node is recreated after running udevstart. - -Development and documentation help is very much appreciated, see the TODO -file for a list of things left to be done. - -Any comment/questions/concerns please let me and the other udev developers -know by sending a message to the linux-hotplug-devel mailing list at: - linux-hotplug-devel@lists.sourceforge.net - -greg k-h -greg@kroah.com +udev - userspace device management + +For more information see the files in the docs/ directory. + +Important Note: + Integrating udev in the system is a whole lot of work, has complex dependencies + and differs a lot from distro to distro. All reasonable distros use udev these + days, the major ones make it mandatory and the system will not work without it. + + The upstream udev project does not support or recomend to replace a distro's udev + installation with the upstream version. The installation of a unmodified upstream + version may render your system unusable! There is no "default" setup or a set + of "default" rules provided by the upstream udev version. + +udev requires: + - 2.6 version of the Linux kernel + + - the kernel must have sysfs, netlink, and hotplug enabled + + - proc must be mounted on /proc + + - sysfs must be mounted at /sys, no other location is supported + + - udev creates and removes device nodes in /dev based on events + the kernel sends out on device discovery or removal + + - during bootup /dev usually gets a tmpfs mounted which is populated scratch + by udev (created nodes don't survive a reboot, it always starts from scratch) + + - udev replaces the hotplug event management invoked from /sbin/hotplug + by the udevd daemon, which receives the kernel events over netlink + + - all kernel events are matched against a set of specified rules which + make it posible to hook into the event processing + + - there is a copy of the rules files for all major distros in the etc/udev + directory (you may look there how others distros are doing it) + +Setting which are used for building udev: + prefix + set this to the default root that you want to use + Only override this if you really know what you are doing + DESTDIR + prefix for install target for package building + USE_LOG + if set to 'true', udev will emit messages to the syslog when + it creates or removes device nodes. This is helpful to see + what udev is doing. This is enabled by default. Note, if you + are building udev against klibc it is recommended that you + disable this option (due to klibc's syslog implementation.) + DEBUG + if set to 'true', verbose debugging messages will be compiled into + the udev binaries. Default value is 'false'. + USE_SELINUX + if set to 'true', udev will be built with SELinux support + enabled. This is disabled by default. + USE_KLIBC + if set to 'true', udev is built and linked against the + included version of klibc. Default value is 'false'. + KERNEL_DIR + If this is not set it will default to /lib/modules/`uname -r`/build + This is used if USE_KLIBC=true to find the kernel include + directory that klibc needs to build against. This must be set + if you are not building udev while running a 2.6 kernel. + EXTRAS + if set, will build the "extra" helper programs as specified + as listed (see below for an example.) + +if you want to build udev using klibc with debugging messages: + make USE_KLIBC=true DEBUG=true + +if you want to build the udev helper program cdrom_id and scsi_id: + make EXTRAS="extras/cdrom_id extras/scsi_id" + +Please direct any comment/question/concern to the linux-hotplug-devel mailing list at: + linux-hotplug-devel@lists.sourceforge.net diff --git a/docs/udev.xml b/docs/udev.xml index 02dcd2586a..c98054f8ce 100644 --- a/docs/udev.xml +++ b/docs/udev.xml @@ -440,7 +440,7 @@ devices of the same type originating from different kernel subsystems. Note: The use of the enumeration facility is unreliable for events that request a number at the same time. The use of enumerations in todays setups - where devices can come and go at any time is not recomended. + where devices can come and go at any time is not recommended. diff --git a/udev.8 b/udev.8 index 9b74ae23bf..a591a1398e 100644 --- a/udev.8 +++ b/udev.8 @@ -203,7 +203,7 @@ The string returned by the external program requested with PROGRAM. A single par \fB%e\fR, \fB$enum\fR If a device node already exists with the name, the smallest next free number is used. This can be used to create compatibility symlinks and enumerate devices of the same type originating from different kernel subsystems. -Note: The use of the enumeration facility is unreliable for events that request a number at the same time. The use of enumerations in todays setups where devices can come and go at any time is not recomended. +Note: The use of the enumeration facility is unreliable for events that request a number at the same time. The use of enumerations in todays setups where devices can come and go at any time is not recommended. .TP \fB%P\fR, \fB$parent\fR The node name of the parent device. -- cgit v1.2.3-54-g00ecf From 133326dc74d9f02686d480b2f4c8a1d9732ba1d6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 3 Oct 2005 16:36:52 +0200 Subject: udevd: fix initial timeout handling UDEVD_EVENT_TIMEOUT=0 didn't work directly after udevd startup. The whole event timeout handling is not needed since we use netlink. Signed-off-by: Kay Sievers --- udevd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index e227a64d71..5974d14e8e 100644 --- a/udevd.c +++ b/udevd.c @@ -410,8 +410,9 @@ recheck: /* limit timeout during initialization phase */ if (init_phase) { - timeout = UDEVD_INIT_EVENT_TIMEOUT; - dbg("initialization phase, limit timeout to %i seconds", UDEVD_INIT_EVENT_TIMEOUT); + if (timeout > UDEVD_INIT_EVENT_TIMEOUT) + timeout = UDEVD_INIT_EVENT_TIMEOUT; + dbg("initialization phase, timeout %i seconds", timeout); } /* move event with expired timeout to the exec list */ -- cgit v1.2.3-54-g00ecf From a5c606f6c3c736bdd3a38b03aa8e1aa144bb3c98 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 11 Oct 2005 21:06:50 +0200 Subject: force event socket buffer size to 16MB Netlink events get lost when the kernel creates thousends of events faster than udevd reads it. The default is 128 KB, which can carry app. 500 events. Set it to 16 MB now. I have 4000 fibrechannel LUNs connected to my system. There are two paths to the devices and two ports on the host connected via a switch. This gives 16000 when probed. I have had problems getting all of the entries in /dev created. -- Mark Haverkamp Signed-off-by: Kay Sievers --- udev_libc_wrapper.h | 4 ++++ udevd.c | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 9dd22175cd..6f8c8f24c7 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -53,6 +53,10 @@ #define NETLINK_KOBJECT_UEVENT 15 #endif +#ifndef SO_RCVBUFFORCE +#define SO_RCVBUFFORCE 33 +#endif + #ifdef __KLIBC__ static inline int clearenv(void) { diff --git a/udevd.c b/udevd.c index 5974d14e8e..aaf80a2314 100644 --- a/udevd.c +++ b/udevd.c @@ -686,7 +686,7 @@ static void reap_sigchilds(void) static int init_udevd_socket(void) { struct sockaddr_un saddr; - const int buffersize = 1024 * 1024; + const int buffersize = 16 * 1024 * 1024; socklen_t addrlen; const int feature_on = 1; int retval; @@ -704,7 +704,7 @@ static int init_udevd_socket(void) } /* set receive buffersize */ - setsockopt(udevd_sock, SOL_SOCKET, SO_RCVBUF, &buffersize, sizeof(buffersize)); + setsockopt(udevd_sock, SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize)); /* the bind takes care of ensuring only one copy running */ retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); @@ -723,7 +723,7 @@ static int init_udevd_socket(void) static int init_uevent_netlink_sock(void) { struct sockaddr_nl snl; - const int buffersize = 1024 * 1024; + const int buffersize = 16 * 1024 * 1024; int retval; memset(&snl, 0x00, sizeof(struct sockaddr_nl)); @@ -738,7 +738,7 @@ static int init_uevent_netlink_sock(void) } /* set receive buffersize */ - setsockopt(uevent_netlink_sock, SOL_SOCKET, SO_RCVBUF, &buffersize, sizeof(buffersize)); + setsockopt(uevent_netlink_sock, SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize)); retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); -- cgit v1.2.3-54-g00ecf From dfedc446db906952ef32fe95f637cc51f9b2d129 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 12 Oct 2005 11:55:49 +0200 Subject: udevd: move logging from err to info for non-hotplug uevent Signed-off-by: Kay Sievers --- udevd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index aaf80a2314..a926715908 100644 --- a/udevd.c +++ b/udevd.c @@ -611,7 +611,7 @@ static struct uevent_msg *get_netlink_msg(void) pos[0] = '\0'; if (msg->action == NULL) { - err("no ACTION in payload found, skip event '%s'", buffer); + info("no ACTION in payload found, skip event '%s'", buffer); free(msg); return NULL; } @@ -865,7 +865,7 @@ int main(int argc, char *argv[], char *envp[]) if (errno == EADDRINUSE) dbg("another udevd running, exit"); else - dbg("error initialising udevd socket: %s", strerror(errno)); + dbg("error initializing udevd socket: %s", strerror(errno)); goto exit; } -- cgit v1.2.3-54-g00ecf From 586e1a37eff1ec9b69c0d2953014e7291fb875b5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 16 Oct 2005 14:16:43 +0200 Subject: fix selinux compilation Taken from Red Hat CVS. Signed-off-by: Kay Sievers --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ed5a87c427..16f4c244eb 100644 --- a/Makefile +++ b/Makefile @@ -206,7 +206,7 @@ endif ifeq ($(strip $(USE_SELINUX)),true) UDEV_OBJS += udev_selinux.o - LIB_OBJS += -lselinux + LIB_OBJS += -lselinux -lsepol CFLAGS += -DUSE_SELINUX endif -- cgit v1.2.3-54-g00ecf From daff48063eb2cb547d24a547684543ee991f0815 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 19 Oct 2005 23:59:54 +0200 Subject: libsysfs: accept sysmlinks to directories instead of real directories Recent changes to the sysfs layout introduced class-devices pointed to by a symlink, instead of the real object at that location. Signed-off-by: Kay Sievers --- libsysfs/sysfs_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index c5558a43a1..bd7f99ae15 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -233,7 +233,7 @@ int sysfs_path_is_dir(const char *path) errno = EINVAL; return 1; } - if ((lstat(path, &astats)) != 0) { + if ((stat(path, &astats)) != 0) { dprintf("stat() failed\n"); return 1; } -- cgit v1.2.3-54-g00ecf From a743be9a785e1223ce628a4225b63546281d9e66 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Oct 2005 00:28:34 +0200 Subject: 071 release --- ChangeLog | 33 +++++++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 15 +++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8f25c0c5b8..cc20111553 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +Summary of changes from v70 to v071 +============================================ + +Greg Kroah-Hartman: + Remove the udev.spec file as no one uses it anymore + +John Hull: + edd_id: check that EDD id is unique + +Kay Sievers: + ata_id: open volume O_NONBLOCK + add "Persistent Device Naming" rules file for disks + scsi_id: switch temporary node creation to /dev + volume_id: set reiser instead of reiserfs for filesystem type + update devfs rules header + update Debian rules + update Fedora rules + update Debian rules + remove no longer needed includes + switch tools and volume_id from LGPL to GPLv2 + add edd-*-part%n to the persistent.rules + update Debian persistent rules + clarify README + udevd: fix initial timeout handling + force event socket buffer size to 16MB + udevd: move logging from err to info for non-hotplug uevent + fix selinux compilation + libsysfs: accept sysmlinks to directories instead of real directories + +Marco d'Itri: + run_directory: fix typo in "make install" + + Summary of changes from v069 to v070 ============================================ diff --git a/Makefile b/Makefile index 16f4c244eb..0f5ab8fe82 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 070 +VERSION = 071 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 31c97ce1b2..815d4083c5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,18 @@ +udev 071 +======== +Fix a stupid typo in extras/run_directory for "make install". + +scsi_id creates the temporary devnode now in /dev for usage with a +non-writable /tmp directory. + +The uevent kernel socket buffer can carry app. 50.000 events now, +let's see who can break this again. :) + +The upcoming kernel will have a new input driver core integration. +Some class devices are now symlinks to the real device. libsysfs +needs a fix for this to work correctly. Udevstart of older udev +versions will _not_ create these devices! + udev 070 ======== Fix a 'install' target in the Makefile, that prevents EXTRAS from -- cgit v1.2.3-54-g00ecf From 0ecc6c1b1957e367852bf2dbf3fbc406762d272d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 16:08:56 +0200 Subject: volume_id: add OVFS Version 1 Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/Makefile.inc | 4 +- extras/volume_id/volume_id/ocfs.c | 194 ++++++++++++++++++++++++++++++++ extras/volume_id/volume_id/ocfs.h | 18 +++ extras/volume_id/volume_id/ocfs2.c | 114 ------------------- extras/volume_id/volume_id/ocfs2.h | 16 --- extras/volume_id/volume_id/volume_id.c | 5 +- 6 files changed, 218 insertions(+), 133 deletions(-) create mode 100644 extras/volume_id/volume_id/ocfs.c create mode 100644 extras/volume_id/volume_id/ocfs.h delete mode 100644 extras/volume_id/volume_id/ocfs2.c delete mode 100644 extras/volume_id/volume_id/ocfs2.h diff --git a/extras/volume_id/volume_id/Makefile.inc b/extras/volume_id/volume_id/Makefile.inc index 71f4ea2862..80f451d583 100644 --- a/extras/volume_id/volume_id/Makefile.inc +++ b/extras/volume_id/volume_id/Makefile.inc @@ -27,7 +27,7 @@ VOLUME_ID_OBJS= \ $(VOLUME_ID_BASE)/sysv.o \ $(VOLUME_ID_BASE)/minix.o \ $(VOLUME_ID_BASE)/luks.o \ - $(VOLUME_ID_BASE)/ocfs2.o \ + $(VOLUME_ID_BASE)/ocfs.o \ $(VOLUME_ID_BASE)/volume_id.o \ $(VOLUME_ID_BASE)/util.o @@ -59,6 +59,6 @@ VOLUME_ID_HEADERS= \ $(VOLUME_ID_BASE)/sysv.h \ $(VOLUME_ID_BASE)/minix.h \ $(VOLUME_ID_BASE)/luks.h \ - $(VOLUME_ID_BASE)/ocfs2.h \ + $(VOLUME_ID_BASE)/ocfs.h \ $(VOLUME_ID_BASE)/volume_id.h \ $(VOLUME_ID_BASE)/util.h diff --git a/extras/volume_id/volume_id/ocfs.c b/extras/volume_id/volume_id/ocfs.c new file mode 100644 index 0000000000..81b4e2d048 --- /dev/null +++ b/extras/volume_id/volume_id/ocfs.c @@ -0,0 +1,194 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Andre Masella + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "ocfs.h" + + +struct ocfs1_super_block_header { + uint32_t minor_version; + uint32_t major_version; + uint8_t signature[128]; + uint8_t mount_point[128]; + uint64_t serial_num; + uint64_t device_size; + uint64_t start_off; + uint64_t bitmap_off; + uint64_t publ_off; + uint64_t vote_off; + uint64_t root_bitmap_off; + uint64_t data_start_off; + uint64_t root_bitmap_size; + uint64_t root_off; + uint64_t root_size; + uint64_t cluster_size; + uint64_t num_nodes; + uint64_t num_clusters; + uint64_t dir_node_size; + uint64_t file_node_size; + uint64_t internal_off; + uint64_t node_cfg_off; + uint64_t node_cfg_size; + uint64_t new_cfg_off; + uint32_t prot_bits; + int32_t excl_mount; +} __attribute__((__packed__)); + +struct ocfs1_super_block_label { + struct ocfs1_disk_lock { + uint32_t curr_master; + uint8_t file_lock; + uint8_t compat_pad[3]; + uint64_t last_write_time; + uint64_t last_read_time; + uint32_t writer_node_num; + uint32_t reader_node_num; + uint64_t oin_node_map; + uint64_t dlock_seq_num; + } disk_lock __attribute__((__packed__)); + uint8_t label[64]; + uint16_t label_len; + uint8_t vol_id[16]; + uint16_t vol_id_len; + uint8_t cluster_name[64]; + uint16_t cluster_name_len; +} __attribute__((__packed__)); + +struct ocfs2_super_block { + uint8_t i_signature[8]; + uint32_t i_generation; + int16_t i_suballoc_slot; + uint16_t i_suballoc_bit; + uint32_t i_reserved0; + uint32_t i_clusters; + uint32_t i_uid; + uint32_t i_gid; + uint64_t i_size; + uint16_t i_mode; + uint16_t i_links_count; + uint32_t i_flags; + uint64_t i_atime; + uint64_t i_ctime; + uint64_t i_mtime; + uint64_t i_dtime; + uint64_t i_blkno; + uint64_t i_last_eb_blk; + uint32_t i_fs_generation; + uint32_t i_atime_nsec; + uint32_t i_ctime_nsec; + uint32_t i_mtime_nsec; + uint64_t i_reserved1[9]; + uint64_t i_pad1; + uint16_t s_major_rev_level; + uint16_t s_minor_rev_level; + uint16_t s_mnt_count; + int16_t s_max_mnt_count; + uint16_t s_state; + uint16_t s_errors; + uint32_t s_checkinterval; + uint64_t s_lastcheck; + uint32_t s_creator_os; + uint32_t s_feature_compat; + uint32_t s_feature_incompat; + uint32_t s_feature_ro_compat; + uint64_t s_root_blkno; + uint64_t s_system_dir_blkno; + uint32_t s_blocksize_bits; + uint32_t s_clustersize_bits; + uint16_t s_max_slots; + uint16_t s_reserved1; + uint32_t s_reserved2; + uint64_t s_first_cluster_group; + uint8_t s_label[64]; + uint8_t s_uuid[16]; +} __attribute__((__packed__)); + +int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct ocfs1_super_block_header *osh; + struct ocfs1_super_block_label *osl; + + buf = volume_id_get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + osh = (struct ocfs1_super_block_header *) buf; + if (memcmp(osh->signature, "OracleCFS", 9) != 0) + return -1; + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", osh->major_version, osh->minor_version); + + dbg("found OracleCFS signature, now reading label"); + buf = volume_id_get_buffer(id, off + 0x200, 0x200); + if (buf == NULL) + return -1; + + osl = (struct ocfs1_super_block_label *) buf; + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + if (osl->label_len <= 64) { + volume_id_set_label_raw(id, osl->label, 64); + volume_id_set_label_string(id, osl->label, 64); + } + if (osl->vol_id_len == 16) + volume_id_set_uuid(id, osl->vol_id, UUID_DCE); + id->type = "ocfs"; + return 0; +} + +#define OCFS2_MAX_BLOCKSIZE 0x1000 +#define OCFS2_SUPER_BLOCK_BLKNO 2 + +int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct ocfs2_super_block *os; + size_t blksize; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize >>= 1) { + buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); + if (buf == NULL) + return -1; + + os = (struct ocfs2_super_block *) buf; + if (memcmp(os->i_signature, "OCFSV2", 6) != 0) + continue; + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + volume_id_set_label_raw(id, os->s_label, 64); + volume_id_set_label_string(id, os->s_label, 64); + volume_id_set_uuid(id, os->s_uuid, UUID_DCE); + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", os->s_major_rev_level, os->s_minor_rev_level); + id->type = "ocfs2"; + return 0; + } + return -1; +} diff --git a/extras/volume_id/volume_id/ocfs.h b/extras/volume_id/volume_id/ocfs.h new file mode 100644 index 0000000000..9d46b28dcd --- /dev/null +++ b/extras/volume_id/volume_id/ocfs.h @@ -0,0 +1,18 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Andre Masella + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _VOLUME_ID_OCFS1_ +#define _VOLUME_ID_OCFS1_ + +extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); + +#endif diff --git a/extras/volume_id/volume_id/ocfs2.c b/extras/volume_id/volume_id/ocfs2.c deleted file mode 100644 index 3a771123f1..0000000000 --- a/extras/volume_id/volume_id/ocfs2.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) Andre Masella - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "ocfs2.h" - - -/* All these values are taken from ocfs2-tools's ocfs2_fs.h */ -#define OCFS2_VOL_UUID_LEN 16 -#define OCFS2_MAX_VOL_LABEL_LEN 64 -#define OCFS2_SUPERBLOCK_OFFSET 0x2000 - - -/* This is the superblock. The OCFS2 header files have structs in structs. -This is one has been simplified since we only care about the superblock. -*/ - -struct ocfs2_super_block { - uint8_t i_signature[8]; /* Signature for validation */ - uint32_t i_generation; /* Generation number */ - int16_t i_suballoc_slot; /* Slot suballocator this inode belongs to */ - uint16_t i_suballoc_bit; /* Bit offset in suballocator block group */ - uint32_t i_reserved0; - uint32_t i_clusters; /* Cluster count */ - uint32_t i_uid; /* Owner UID */ - uint32_t i_gid; /* Owning GID */ - uint64_t i_size; /* Size in bytes */ - uint16_t i_mode; /* File mode */ - uint16_t i_links_count; /* Links count */ - uint32_t i_flags; /* File flags */ - uint64_t i_atime; /* Access time */ - uint64_t i_ctime; /* Creation time */ - uint64_t i_mtime; /* Modification time */ - uint64_t i_dtime; /* Deletion time */ - uint64_t i_blkno; /* Offset on disk, in blocks */ - uint64_t i_last_eb_blk; /* Pointer to last extent block */ - uint32_t i_fs_generation; /* Generation per fs-instance */ - uint32_t i_atime_nsec; - uint32_t i_ctime_nsec; - uint32_t i_mtime_nsec; - uint64_t i_reserved1[9]; - uint64_t i_pad1; /* Generic way to refer to this 64bit union */ - /* Normally there is a union of the different block types, but we only care about the superblock. */ - uint16_t s_major_rev_level; - uint16_t s_minor_rev_level; - uint16_t s_mnt_count; - int16_t s_max_mnt_count; - uint16_t s_state; /* File system state */ - uint16_t s_errors; /* Behaviour when detecting errors */ - uint32_t s_checkinterval; /* Max time between checks */ - uint64_t s_lastcheck; /* Time of last check */ - uint32_t s_creator_os; /* OS */ - uint32_t s_feature_compat; /* Compatible feature set */ - uint32_t s_feature_incompat; /* Incompatible feature set */ - uint32_t s_feature_ro_compat; /* Readonly-compatible feature set */ - uint64_t s_root_blkno; /* Offset, in blocks, of root directory dinode */ - uint64_t s_system_dir_blkno; /* Offset, in blocks, of system directory dinode */ - uint32_t s_blocksize_bits; /* Blocksize for this fs */ - uint32_t s_clustersize_bits; /* Clustersize for this fs */ - uint16_t s_max_slots; /* Max number of simultaneous mounts before tunefs required */ - uint16_t s_reserved1; - uint32_t s_reserved2; - uint64_t s_first_cluster_group; /* Block offset of 1st cluster group header */ - uint8_t s_label[OCFS2_MAX_VOL_LABEL_LEN]; /* Label for mounting, etc. */ - uint8_t s_uuid[OCFS2_VOL_UUID_LEN]; /* 128-bit uuid */ -} __attribute__((__packed__)); - -int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) -{ - struct ocfs2_super_block *os; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - os = (struct ocfs2_super_block *) volume_id_get_buffer(id, off + OCFS2_SUPERBLOCK_OFFSET, 0x200); - if (os == NULL) - return -1; - - if (memcmp(os->i_signature, "OCFSV2", 6) != 0) { - return -1; - } - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - volume_id_set_label_raw(id, os->s_label, OCFS2_MAX_VOL_LABEL_LEN < VOLUME_ID_LABEL_SIZE ? - OCFS2_MAX_VOL_LABEL_LEN : VOLUME_ID_LABEL_SIZE); - volume_id_set_label_string(id, os->s_label, OCFS2_MAX_VOL_LABEL_LEN < VOLUME_ID_LABEL_SIZE ? - OCFS2_MAX_VOL_LABEL_LEN : VOLUME_ID_LABEL_SIZE); - volume_id_set_uuid(id, os->s_uuid, UUID_DCE); - id->type = "ocfs2"; - return 0; -} diff --git a/extras/volume_id/volume_id/ocfs2.h b/extras/volume_id/volume_id/ocfs2.h deleted file mode 100644 index 24b43b1875..0000000000 --- a/extras/volume_id/volume_id/ocfs2.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) Andre Masella - * - * 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. - */ - -#ifndef _VOLUME_ID_OCFS2_ -#define _VOLUME_ID_OCFS2_ - -extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index d1a6a5f0f5..25bcd95358 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -58,7 +58,7 @@ #include "minix.h" #include "mac.h" #include "msdos.h" -#include "ocfs2.h" +#include "ocfs.h" int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) { @@ -156,6 +156,9 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) if (volume_id_probe_minix(id, off) == 0) goto exit; + if (volume_id_probe_ocfs1(id, off) == 0) + goto exit; + if (volume_id_probe_ocfs2(id, off) == 0) goto exit; -- cgit v1.2.3-54-g00ecf From 79bd4f222954a331aafcd7d0164742a60b570294 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 16:31:13 +0200 Subject: volume_id: add Veritas fs Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/Makefile.inc | 2 ++ extras/volume_id/volume_id/volume_id.c | 3 ++ extras/volume_id/volume_id/vxfs.c | 56 +++++++++++++++++++++++++++++++++ extras/volume_id/volume_id/vxfs.h | 16 ++++++++++ 4 files changed, 77 insertions(+) create mode 100644 extras/volume_id/volume_id/vxfs.c create mode 100644 extras/volume_id/volume_id/vxfs.h diff --git a/extras/volume_id/volume_id/Makefile.inc b/extras/volume_id/volume_id/Makefile.inc index 80f451d583..6f8dceea4a 100644 --- a/extras/volume_id/volume_id/Makefile.inc +++ b/extras/volume_id/volume_id/Makefile.inc @@ -28,6 +28,7 @@ VOLUME_ID_OBJS= \ $(VOLUME_ID_BASE)/minix.o \ $(VOLUME_ID_BASE)/luks.o \ $(VOLUME_ID_BASE)/ocfs.o \ + $(VOLUME_ID_BASE)/vxfs.o \ $(VOLUME_ID_BASE)/volume_id.o \ $(VOLUME_ID_BASE)/util.o @@ -60,5 +61,6 @@ VOLUME_ID_HEADERS= \ $(VOLUME_ID_BASE)/minix.h \ $(VOLUME_ID_BASE)/luks.h \ $(VOLUME_ID_BASE)/ocfs.h \ + $(VOLUME_ID_BASE)/vxfs.h \ $(VOLUME_ID_BASE)/volume_id.h \ $(VOLUME_ID_BASE)/util.h diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 25bcd95358..06496e7130 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -162,6 +162,9 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) if (volume_id_probe_ocfs2(id, off) == 0) goto exit; + if (volume_id_probe_vxfs(id, off) == 0) + goto exit; + return -1; exit: diff --git a/extras/volume_id/volume_id/vxfs.c b/extras/volume_id/volume_id/vxfs.c new file mode 100644 index 0000000000..c4a9ace98f --- /dev/null +++ b/extras/volume_id/volume_id/vxfs.c @@ -0,0 +1,56 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" +#include "vxfs.h" + +#define VXFS_SUPER_MAGIC 0xa501FCF5 + +struct vxfs_super { + uint32_t vs_magic; + int32_t vs_version; +} __attribute__((__packed__)); + +int volume_id_probe_vxfs(struct volume_id *id, uint64_t off) +{ + struct vxfs_super *vxs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); + if (vxs == NULL) + return -1; + + if (vxs->vs_magic == cpu_to_le32(VXFS_SUPER_MAGIC)) { + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", (unsigned int) vxs->vs_version); + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "vxfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/volume_id/vxfs.h b/extras/volume_id/volume_id/vxfs.h new file mode 100644 index 0000000000..8ca45c3fdc --- /dev/null +++ b/extras/volume_id/volume_id/vxfs.h @@ -0,0 +1,16 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _VOLUME_ID_VXFS_ +#define _VOLUME_ID_VXFS_ + +extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); + +#endif -- cgit v1.2.3-54-g00ecf From c929358e0292e7f0650b543f4085cd10d2624534 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 17:41:55 +0200 Subject: volume_id: check ext fs for valid blocksize, cause magic is only 2 bytes Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/ext.c | 84 ++++++++++++++++++++++++++++----------- extras/volume_id/volume_id/util.h | 2 + 2 files changed, 63 insertions(+), 23 deletions(-) diff --git a/extras/volume_id/volume_id/ext.c b/extras/volume_id/volume_id/ext.c index df2ebb696b..7080f1dd35 100644 --- a/extras/volume_id/volume_id/ext.c +++ b/extras/volume_id/volume_id/ext.c @@ -29,31 +29,53 @@ #include "ext.h" struct ext2_super_block { - uint32_t inodes_count; - uint32_t blocks_count; - uint32_t r_blocks_count; - uint32_t free_blocks_count; - uint32_t free_inodes_count; - uint32_t first_data_block; - uint32_t log_block_size; - uint32_t dummy3[7]; - uint8_t magic[2]; - uint16_t state; - uint32_t dummy5[8]; - uint32_t feature_compat; - uint32_t feature_incompat; - uint32_t feature_ro_compat; - uint8_t uuid[16]; - uint8_t volume_name[16]; + uint32_t s_inodes_count; + uint32_t s_blocks_count; + uint32_t s_r_blocks_count; + uint32_t s_free_blocks_count; + uint32_t s_free_inodes_count; + uint32_t s_first_data_block; + uint32_t s_log_block_size; + uint32_t s_log_frag_size; + uint32_t s_blocks_per_group; + uint32_t s_frags_per_group; + uint32_t s_inodes_per_group; + uint32_t s_mtime; + uint32_t s_wtime; + uint16_t s_mnt_count; + uint16_t s_max_mnt_count; + uint16_t s_magic; + uint16_t s_state; + uint16_t s_errors; + uint16_t s_minor_rev_level; + uint32_t s_lastcheck; + uint32_t s_checkinterval; + uint32_t s_creator_os; + uint32_t s_rev_level; + uint16_t s_def_resuid; + uint16_t s_def_resgid; + uint32_t s_first_ino; + uint16_t s_inode_size; + uint16_t s_block_group_nr; + uint32_t s_feature_compat; + uint32_t s_feature_incompat; + uint32_t s_feature_ro_compat; + uint8_t s_uuid[16]; + uint8_t s_volume_name[16]; } __attribute__((__packed__)); +#define EXT_SUPER_MAGIC 0xEF53 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 #define EXT_SUPERBLOCK_OFFSET 0x400 +#define EXT3_MIN_BLOCK_SIZE 0x400 +#define EXT3_MAX_BLOCK_SIZE 0x1000 + int volume_id_probe_ext(struct volume_id *id, uint64_t off) { struct ext2_super_block *es; + size_t bsize; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -61,16 +83,32 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off) if (es == NULL) return -1; - if (es->magic[0] != 0123 || - es->magic[1] != 0357) + if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC)) return -1; - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - volume_id_set_label_raw(id, es->volume_name, 16); - volume_id_set_label_string(id, es->volume_name, 16); - volume_id_set_uuid(id, es->uuid, UUID_DCE); + bsize = 0x200 << le32_to_cpu(es->s_log_block_size); + dbg("ext blocksize 0x%zx", bsize); + if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { + dbg("invalid ext blocksize"); + return -1; + } - if ((le32_to_cpu(es->feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) + volume_id_set_label_raw(id, es->s_volume_name, 16); + volume_id_set_label_string(id, es->s_volume_name, 16); + volume_id_set_uuid(id, es->s_uuid, UUID_DCE); + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", es->s_rev_level, es->s_minor_rev_level); + + /* check for external journal device */ + if ((le32_to_cpu(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { + volume_id_set_usage(id, VOLUME_ID_OTHER); + id->type = "jbd"; + return 0; + } + + /* check for ext2 / ext3 */ + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + if ((le32_to_cpu(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) id->type = "ext3"; else id->type = "ext2"; diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h index afaa0b7d8d..6e16491c80 100644 --- a/extras/volume_id/volume_id/util.h +++ b/extras/volume_id/volume_id/util.h @@ -51,6 +51,7 @@ #define le64_to_cpu(x) (x) #define be16_to_cpu(x) bswap16(x) #define be32_to_cpu(x) bswap32(x) +#define cpu_to_le16(x) (x) #define cpu_to_le32(x) (x) #define cpu_to_be32(x) bswap32(x) #elif (__BYTE_ORDER == __BIG_ENDIAN) @@ -59,6 +60,7 @@ #define le64_to_cpu(x) bswap64(x) #define be16_to_cpu(x) (x) #define be32_to_cpu(x) (x) +#define cpu_to_le16(x) bswap16(x) #define cpu_to_le32(x) bswap32(x) #define cpu_to_be32(x) (x) #endif -- cgit v1.2.3-54-g00ecf From f3c14c68499d318b2beb56cee7c5f88f2c04dc62 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 18:54:34 +0200 Subject: volume_id: move blocksize validation to fix jbd recognition Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/ext.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extras/volume_id/volume_id/ext.c b/extras/volume_id/volume_id/ext.c index 7080f1dd35..e80ac90ad6 100644 --- a/extras/volume_id/volume_id/ext.c +++ b/extras/volume_id/volume_id/ext.c @@ -86,13 +86,6 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off) if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC)) return -1; - bsize = 0x200 << le32_to_cpu(es->s_log_block_size); - dbg("ext blocksize 0x%zx", bsize); - if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { - dbg("invalid ext blocksize"); - return -1; - } - volume_id_set_label_raw(id, es->s_volume_name, 16); volume_id_set_label_string(id, es->s_volume_name, 16); volume_id_set_uuid(id, es->s_uuid, UUID_DCE); @@ -106,6 +99,13 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off) return 0; } + bsize = 0x200 << le32_to_cpu(es->s_log_block_size); + dbg("ext blocksize 0x%zx", bsize); + if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { + dbg("invalid ext blocksize"); + return -1; + } + /* check for ext2 / ext3 */ volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); if ((le32_to_cpu(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) -- cgit v1.2.3-54-g00ecf From b5866871385be4e4ad170dca40f5e2b1c6666694 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 18:55:22 +0200 Subject: volume_id: fix typo in ocfs Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/ocfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/volume_id/ocfs.c b/extras/volume_id/volume_id/ocfs.c index 81b4e2d048..88064ed193 100644 --- a/extras/volume_id/volume_id/ocfs.c +++ b/extras/volume_id/volume_id/ocfs.c @@ -172,7 +172,7 @@ int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) dbg("probing at offset 0x%llx", (unsigned long long) off); - for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize >>= 1) { + for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); if (buf == NULL) return -1; -- cgit v1.2.3-54-g00ecf From 1305b47167388297b33b073989ae3b70a26ca71a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 18:56:30 +0200 Subject: volume_id: add vxfs include Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/volume_id.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c index 06496e7130..b92269863f 100644 --- a/extras/volume_id/volume_id/volume_id.c +++ b/extras/volume_id/volume_id/volume_id.c @@ -59,6 +59,7 @@ #include "mac.h" #include "msdos.h" #include "ocfs.h" +#include "vxfs.h" int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) { -- cgit v1.2.3-54-g00ecf From 04b222b4b0369f3f0861f3911bacc928d18c0b00 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 19:15:07 +0200 Subject: volume_id: make FAT32 recognition more robust FAT32 volumes should never have a cluster count, that fits into a 16 bit value, but mkdosfs can create such volumes. No sane formatter or Windows will ever do this, but the Linux kernel as Windows can read/write it. Thanks to Ted Ts'o for convincing me. Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/fat.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/extras/volume_id/volume_id/fat.c b/extras/volume_id/volume_id/fat.c index d5f84ece4c..74f2bb9194 100644 --- a/extras/volume_id/volume_id/fat.c +++ b/extras/volume_id/volume_id/fat.c @@ -138,7 +138,8 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off) uint32_t root_cluster; uint32_t dir_size; uint32_t cluster_count; - uint32_t fat_length; + uint16_t fat_length; + uint32_t fat32_length; uint64_t root_start; uint32_t start_data_sect; uint16_t root_dir_entries; @@ -222,11 +223,18 @@ valid: dbg("sect_count 0x%x", sect_count); fat_length = le16_to_cpu(vs->fat_length); - if (fat_length == 0) - fat_length = le32_to_cpu(vs->type.fat32.fat32_length); dbg("fat_length 0x%x", fat_length); + fat32_length = le32_to_cpu(vs->type.fat32.fat32_length); + dbg("fat32_length 0x%x", fat32_length); + + if (fat_length) + fat_size = fat_length * vs->fats; + else if (fat32_length) + fat_size = fat32_length * vs->fats; + else + return -1; + dbg("fat_size 0x%x", fat_size); - fat_size = fat_length * vs->fats; dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + (sector_size-1)) / sector_size; dbg("dir_size 0x%x", dir_size); @@ -235,14 +243,17 @@ valid: cluster_count /= vs->sectors_per_cluster; dbg("cluster_count 0x%x", cluster_count); - if (cluster_count < FAT12_MAX) { + /* must be FAT32 */ + if (!fat_length && fat32_length) + goto fat32; + + /* cluster_count tells us the format */ + if (cluster_count < FAT12_MAX) strcpy(id->type_version, "FAT12"); - } else if (cluster_count < FAT16_MAX) { + else if (cluster_count < FAT16_MAX) strcpy(id->type_version, "FAT16"); - } else { - strcpy(id->type_version, "FAT32"); + else goto fat32; - } /* the label may be an attribute in the root directory */ root_start = (reserved + fat_size) * sector_size; @@ -274,6 +285,8 @@ valid: goto found; fat32: + strcpy(id->type_version, "FAT32"); + /* FAT32 root dir is a cluster chain like any other directory */ buf_size = vs->sectors_per_cluster * sector_size; root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); -- cgit v1.2.3-54-g00ecf From eba25b20ce19cb273785f72f169c60406edacc3a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 19:16:01 +0200 Subject: volume_id: Version 051 Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/volume_id.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 2ee974ff42..16770dd6ab 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -13,7 +13,7 @@ #include -#define VOLUME_ID_VERSION 50 +#define VOLUME_ID_VERSION 51 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From 7f0a5b80957844148d05ba5218c40b70910a6b49 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 21:12:51 +0200 Subject: volume_id: fix typo in ext blocksize check Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/ext.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extras/volume_id/volume_id/ext.c b/extras/volume_id/volume_id/ext.c index e80ac90ad6..a3e20d3151 100644 --- a/extras/volume_id/volume_id/ext.c +++ b/extras/volume_id/volume_id/ext.c @@ -86,6 +86,13 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off) if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC)) return -1; + bsize = 0x400 << le32_to_cpu(es->s_log_block_size); + dbg("ext blocksize 0x%zx", bsize); + if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { + dbg("invalid ext blocksize"); + return -1; + } + volume_id_set_label_raw(id, es->s_volume_name, 16); volume_id_set_label_string(id, es->s_volume_name, 16); volume_id_set_uuid(id, es->s_uuid, UUID_DCE); @@ -99,13 +106,6 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off) return 0; } - bsize = 0x200 << le32_to_cpu(es->s_log_block_size); - dbg("ext blocksize 0x%zx", bsize); - if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { - dbg("invalid ext blocksize"); - return -1; - } - /* check for ext2 / ext3 */ volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); if ((le32_to_cpu(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) -- cgit v1.2.3-54-g00ecf From 81d719a1d48f31f169487d043982aeabd3b2dd51 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Oct 2005 21:13:10 +0200 Subject: volume_id: Version 052 Signed-off-by: Kay Sievers --- extras/volume_id/volume_id/volume_id.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h index 16770dd6ab..9994615c69 100644 --- a/extras/volume_id/volume_id/volume_id.h +++ b/extras/volume_id/volume_id/volume_id.h @@ -13,7 +13,7 @@ #include -#define VOLUME_ID_VERSION 51 +#define VOLUME_ID_VERSION 52 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From e4b1a0f608c2d00e458b5cb47a6fba4da9aafe7e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Oct 2005 13:13:25 +0200 Subject: FAQ: remove confusing statement about module loading Signed-off-by: Kay Sievers --- FAQ | 5 ----- 1 file changed, 5 deletions(-) diff --git a/FAQ b/FAQ index 1b9e56d8c5..abe88638b2 100644 --- a/FAQ +++ b/FAQ @@ -31,11 +31,6 @@ Q: But udev will not automatically load a driver if a /dev node is opened A: Right, but Linux is supposed to load a module when a device is discovered not to load a module when it's accessed. -Q: But wait, I really want udev to automatically load drivers when they - are not present but the device node is opened. It's the only reason I - like using devfs. Please make udev do this. -A: No. udev is for managing /dev, not loading kernel drivers. - Q: Oh come on, pretty please. It can't be that hard to do. A: Such a functionality isn't needed on a properly configured system. All devices present on the system should generate hotplug events, loading -- cgit v1.2.3-54-g00ecf From 638b983b4d20f3c8f184084b672da8e8e93eb91e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Oct 2005 18:20:58 +0200 Subject: cleanup compiler/linker flags Signed-off-by: Kay Sievers --- Makefile | 39 ++++++++++++--------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 0f5ab8fe82..5fd5f29182 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 071 +VERSION = 071 # set this to make use of syslog USE_LOG = true @@ -42,10 +42,10 @@ USE_STATIC = false # to build any of the extras programs pass: # make EXTRAS="extras/ extras/" -EXTRAS= +EXTRAS = # make the build silent. Set this to something else to make it noisy again. -V=false +V = false PROGRAMS = \ udev \ @@ -136,10 +136,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} PWD = $(shell pwd) -# If you are running a cross compiler, you may want to set this -# to something more interesting, like "arm-linux-". If you want -# to compile vs uClibc, that can be done here as well. -CROSS = #/usr/i386-linux-uclibc/usr/bin/i386-uclibc- +CROSS = CC = $(CROSS)gcc LD = $(CROSS)gcc AR = $(CROSS)ar @@ -147,25 +144,18 @@ STRIP = $(CROSS)strip RANLIB = $(CROSS)ranlib HOSTCC = gcc -# code taken from uClibc to determine the current arch -ARCH := ${shell $(CC) -dumpmachine | sed -e s'/-.*//' -e 's/i.86/i386/' -e 's/sparc.*/sparc/' \ - -e 's/arm.*/arm/g' -e 's/m68k.*/m68k/' -e 's/powerpc/ppc/g'} - -# determine the gcc include dir -GCCINCDIR := ${shell LC_ALL=C $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"} - -# determine the libgcc.a filename -GCC_LIB := $(shell $(CC) -print-libgcc-file-name ) - # check if compiler option is supported cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;} -CFLAGS += -Wall -fno-builtin -Wchar-subscripts -Wpointer-arith \ - -Wstrict-prototypes -Wsign-compare +CFLAGS += -g -Wall -pipe -fno-builtin -Wstrict-prototypes -Wsign-compare \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes \ + -Wshadow CFLAGS += $(call cc-supports, -Wdeclaration-after-statement, ) -CFLAGS += -pipe CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +LDFLAGS = -Wl,-warn-common + # use '-Os' optimization if available, else use -O2 OPTFLAGS := $(call cc-supports, -Os, -O2) @@ -179,8 +169,7 @@ endif # if DEBUG is enabled, then we do not strip or optimize ifeq ($(strip $(DEBUG)),true) - CFLAGS += -O1 -g -DDEBUG - LDFLAGS += -Wl + CFLAGS += -DDEBUG STRIPCMD = /bin/true -Since_we_are_debugging else CFLAGS += $(OPTFLAGS) -fomit-frame-pointer @@ -190,7 +179,7 @@ endif ifeq ($(strip $(USE_GCOV)),true) CFLAGS += -fprofile-arcs -ftest-coverage - LDFLAGS = -fprofile-arcs + LDFLAGS += -fprofile-arcs endif # if our own version of klibc is used, we need to build it @@ -199,9 +188,6 @@ ifeq ($(strip $(USE_KLIBC)),true) KLCC = $(KLIBC_INSTALL)/bin/$(CROSS)klcc CC = $(KLCC) LD = $(KLCC) -else - CFLAGS += -Wshadow -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations - LDFLAGS += -Wl,-warn-common endif ifeq ($(strip $(USE_SELINUX)),true) @@ -261,7 +247,6 @@ $(KLCC): INSTALLDIR=$(KLIBC_INSTALL) \ bindir=$(KLIBC_INSTALL)/bin \ mandir=$(KLIBC_INSTALL)/man all install - -find $(KLIBC_INSTALL)/include -name SCCS -print| xargs rm -rf .NOTPARALLEL: $(KLCC) $(UDEV_OBJS): $(KLCC) -- cgit v1.2.3-54-g00ecf From 49fb51c6159db916f93c9439ef9b37ce6be90d02 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Oct 2005 18:42:52 +0200 Subject: use DESTDIR on uninstall, no need to pass prefix to submake Signed-off-by: Kay Sievers --- Makefile | 61 +++++++++++++++++++++++----------------------- extras/scsi_id/Makefile | 2 +- test/simple-build-check.sh | 15 ++++-------- 3 files changed, 36 insertions(+), 42 deletions(-) diff --git a/Makefile b/Makefile index 5fd5f29182..f3698329ef 100644 --- a/Makefile +++ b/Makefile @@ -188,6 +188,7 @@ ifeq ($(strip $(USE_KLIBC)),true) KLCC = $(KLIBC_INSTALL)/bin/$(CROSS)klcc CC = $(KLCC) LD = $(KLCC) + V = true endif ifeq ($(strip $(USE_SELINUX)),true) @@ -212,8 +213,7 @@ endif all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) prefix=$(prefix) \ - CC="$(CC)" \ + $(MAKE) CC="$(CC)" \ CFLAGS="$(CFLAGS)" \ LD="$(LD)" \ LDFLAGS="$(LDFLAGS)" \ @@ -296,16 +296,13 @@ clean: $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) prefix=$(prefix) -C $$target $@; \ + $(MAKE) -C $$target $@; \ done; -.PHONY: clean - -spotless: clean $(MAKE) -C klibc SUBDIRS=klibc spotless rm -rf klibc/.install -.PHONY: spotless +.PHONY: clean -release: spotless +release: git-tar-tree HEAD $(RELEASE_NAME) | gzip -9v > $(RELEASE_NAME).tar.gz @echo "$(RELEASE_NAME).tar.gz created" .PHONY: release @@ -323,7 +320,7 @@ install-config: $(GEN_CONFIGS) fi @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) prefix=$(prefix) -C $$target $@; \ + $(MAKE) -C $$target $@; \ done; .PHONY: install-config @@ -338,22 +335,22 @@ install-man: - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) prefix=$(prefix) -C $$target $@; \ + $(MAKE) -C $$target $@; \ done; .PHONY: install-man uninstall-man: - - rm -f $(mandir)/man8/udev.8 - - rm -f $(mandir)/man8/udevinfo.8 - - rm -f $(mandir)/man8/udevtest.8 - - rm -f $(mandir)/man8/udevstart.8 - - rm -f $(mandir)/man8/udevd.8 - - rm -f $(mandir)/man8/udevmonitor.8 - - rm -f $(mandir)/man8/udevsend.8 - - rm -f $(mandir)/man8/udevcontrol.8 + - rm -f $(DESTDIR)$(mandir)/man8/udev.8 + - rm -f $(DESTDIR)$(mandir)/man8/udevinfo.8 + - rm -f $(DESTDIR)$(mandir)/man8/udevtest.8 + - rm -f $(DESTDIR)$(mandir)/man8/udevstart.8 + - rm -f $(DESTDIR)$(mandir)/man8/udevd.8 + - rm -f $(DESTDIR)$(mandir)/man8/udevmonitor.8 + - rm -f $(DESTDIR)$(mandir)/man8/udevsend.8 + - rm -f $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) prefix=$(prefix) -C $$target $@; \ + $(MAKE) -C $$target $@; \ done; .PHONY: uninstall-man @@ -369,7 +366,7 @@ install-bin: $(INSTALL_PROGRAM) -D udevstart $(DESTDIR)$(sbindir)/udevstart @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) prefix=$(prefix) -C $$target $@; \ + $(MAKE) -C $$target $@; \ done; ifndef DESTDIR - killall udevd @@ -379,21 +376,23 @@ endif .PHONY: install-bin uninstall-bin: - - rm -f $(sbindir)/udev - - rm -f $(sbindir)/udevd - - rm -f $(sbindir)/udevsend - - rm -f $(sbindir)/udevinitsend - - rm -f $(sbindir)/udeveventrecoreder - - rm -f $(sbindir)/udevcontrol - - rm -f $(sbindir)/udevstart - - rm -f $(usrsbindir)/udevmonitor + - rm -f $(DESTDIR)$(sbindir)/udev + - rm -f $(DESTDIR)$(sbindir)/udevd + - rm -f $(DESTDIR)$(sbindir)/udevsend + - rm -f $(DESTDIR)$(sbindir)/udevinitsend + - rm -f $(DESTDIR)$(sbindir)/udeveventrecoreder + - rm -f $(DESTDIR)$(sbindir)/udevcontrol + - rm -f $(DESTDIR)$(sbindir)/udevstart + - rm -f $(DESTDIR)$(usrsbindir)/udevmonitor - rm -f $(usrbindir)/udevinfo - - rm -f $(usrbindir)/udevtest - - rm -rf $(udevdb) + - rm -f $(DESTDIR)$(DESTDIR)$(usrbindir)/udevtest +ifndef DESTDIR - killall udevd + - rm -rf $(udevdb) +endif @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) prefix=$(prefix) -C $$target $@; \ + $(MAKE) -C $$target $@; \ done; .PHONY: uninstall-bin diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 85f6ff6ca8..8a8c714a87 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -78,7 +78,7 @@ install-man: .PHONY: uninstall-man uninstall-man: - -rm -f $(mandir)/man8/scsi_id.8 + -rm -f $(DESTDIR)$(mandir)/man8/scsi_id.8 .PHONY: uninstall-man install-config: diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index e69c6451ab..6572a39625 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -16,34 +16,29 @@ EXTRAS="\ echo KERNEL_DIR: "$KERNEL_DIR" # with debug -make spotless EXTRAS="$EXTRAS" >/dev/null +make clean EXTRAS="$EXTRAS" >/dev/null make all -j4 $MAKEOPTS DEBUG=true EXTRAS="$EXTRAS" || exit echo -e "\n\n" # without any logging -make spotless EXTRAS="$EXTRAS" >/dev/null +make clean EXTRAS="$EXTRAS" >/dev/null make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit echo -e "\n\n" # klibc and debug -make spotless EXTRAS="$EXTRAS" >/dev/null +make clean EXTRAS="$EXTRAS" >/dev/null make all -j4 $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit echo -e "\n\n" -# klibc without logging -make spotless EXTRAS="$EXTRAS" >/dev/null -make all $MAKEOPTS USE_KLIBC=true USE_LOG=false EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit -echo -e "\n\n" - # install in temporary dir and show it TEMPDIR="`pwd`/.tmp" rm -rf $TEMPDIR mkdir $TEMPDIR -make spotless EXTRAS="$EXTRAS" >/dev/null +make clean EXTRAS="$EXTRAS" >/dev/null make all $MAKEOPTS DESTDIR="$TEMPDIR" EXTRAS="$EXTRAS" || exit make install DESTDIR="$TEMPDIR" EXTRAS="$EXTRAS" || exit echo -e "\nInstalled tree:" find $TEMPDIR rm -rf $TEMPDIR -make spotless EXTRAS="$EXTRAS" >/dev/null +make clean EXTRAS="$EXTRAS" >/dev/null -- cgit v1.2.3-54-g00ecf From f032e0ed6b4bd7a9112711687b5012a0285357f7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Oct 2005 19:14:21 +0200 Subject: allow to pass STRIPCMD, to skip stripping of binaries Signed-off-by: Kay Sievers --- Makefile | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index f3698329ef..e10967017c 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,6 @@ USE_LOG = true DEBUG = false # compile with gcc's code coverage option -# (use it with DEBUG, works only with glibc) USE_GCOV = false # include Security-Enhanced Linux support @@ -140,24 +139,26 @@ CROSS = CC = $(CROSS)gcc LD = $(CROSS)gcc AR = $(CROSS)ar -STRIP = $(CROSS)strip RANLIB = $(CROSS)ranlib HOSTCC = gcc +STRIP = $(CROSS)strip +STRIPCMD = $(STRIP) -s # check if compiler option is supported cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;} -CFLAGS += -g -Wall -pipe -fno-builtin -Wstrict-prototypes -Wsign-compare \ - -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ - -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes \ - -Wshadow -CFLAGS += $(call cc-supports, -Wdeclaration-after-statement, ) -CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ + -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ + -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes +WARNINGS += $(call cc-supports, -Wdeclaration-after-statement, ) +CFLAGS += $(WARNINGS) LDFLAGS = -Wl,-warn-common -# use '-Os' optimization if available, else use -O2 +# use -Os optimization if available, else use -O2 OPTFLAGS := $(call cc-supports, -Os, -O2) +CFLAGS += $(OPTFLAGS) # include our local copy of libsysfs CFLAGS += -I$(PWD)/libsysfs/sysfs \ @@ -167,14 +168,10 @@ ifeq ($(strip $(USE_LOG)),true) CFLAGS += -DUSE_LOG endif -# if DEBUG is enabled, then we do not strip or optimize +# if DEBUG is enabled, then we do not strip ifeq ($(strip $(DEBUG)),true) CFLAGS += -DDEBUG - STRIPCMD = /bin/true -Since_we_are_debugging -else - CFLAGS += $(OPTFLAGS) -fomit-frame-pointer - LDFLAGS += -s -Wl - STRIPCMD = $(STRIP) -s --remove-section=.note --remove-section=.comment + STRIPCMD = /bin/true unstripped binary endif ifeq ($(strip $(USE_GCOV)),true) @@ -412,7 +409,7 @@ buildtest: .PHONY: buildtest gcov-all: - $(MAKE) clean all DEBUG=true USE_GCOV=true + $(MAKE) clean all STRIPCMD= USE_GCOV=true @echo @echo "binaries built with gcov support." @echo "run the tests and analyze with 'make udev_gcov.txt'" -- cgit v1.2.3-54-g00ecf From cf686d37b42ed49df9209d6630fd3292c54c6bde Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Oct 2005 19:38:36 +0200 Subject: cleanup make release Signed-off-by: Kay Sievers --- Makefile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index e10967017c..f69ac96e9d 100644 --- a/Makefile +++ b/Makefile @@ -125,9 +125,7 @@ udevdir = /dev udevdb = ${udevdir}/.udevdb LOCAL_CFG_DIR = etc/udev KERNEL_DIR = /lib/modules/${shell uname -r}/build -srcdir = . DESTDIR = -RELEASE_NAME = udev-$(VERSION) INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} @@ -290,6 +288,7 @@ clean: - find -name "*.gcov" -print0 | xargs -0rt rm -f - rm -f udev_gcov.txt - rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS) + - rm -f udev-$(VERSION).tar.gz $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ @@ -300,8 +299,8 @@ clean: .PHONY: clean release: - git-tar-tree HEAD $(RELEASE_NAME) | gzip -9v > $(RELEASE_NAME).tar.gz - @echo "$(RELEASE_NAME).tar.gz created" + git-tar-tree HEAD udev-$(VERSION) | gzip -9v > udev-$(VERSION).tar.gz + @echo "udev-$(VERSION).tar.gz created" .PHONY: release install-config: $(GEN_CONFIGS) -- cgit v1.2.3-54-g00ecf From 916c5e4725ef4558b752c6464deef6492c8ac31a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Oct 2005 20:32:07 +0200 Subject: fix the new warnings I asked for Signed-off-by: Kay Sievers --- test/simple-build-check.sh | 4 ++-- udev_rules_parse.c | 4 ++-- udevcontrol.c | 6 +++--- udevd.c | 10 +++++----- udeveventrecorder.c | 6 +++--- udevinitsend.c | 6 +++--- udevmonitor.c | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 6572a39625..daf0b75269 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -17,12 +17,12 @@ echo KERNEL_DIR: "$KERNEL_DIR" # with debug make clean EXTRAS="$EXTRAS" >/dev/null -make all -j4 $MAKEOPTS DEBUG=true EXTRAS="$EXTRAS" || exit +make all -j4 $MAKEOPTS DEBUG=true EXTRAS="$EXTRAS" || exit echo -e "\n\n" # without any logging make clean EXTRAS="$EXTRAS" >/dev/null -make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit +make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit echo -e "\n\n" # klibc and debug diff --git a/udev_rules_parse.c b/udev_rules_parse.c index c14164f1cc..7d1853acbe 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -437,7 +437,7 @@ static int add_to_rules(struct udev_rules *rules, char *line) char owner[32]; uid_t uid = lookup_user(value); dbg("replacing username='%s' by id=%i", value, uid); - sprintf(owner, "%li", uid); + sprintf(owner, "%u", (unsigned int) uid); add_rule_key(rule, &rule->owner, operation, owner); continue; } @@ -456,7 +456,7 @@ static int add_to_rules(struct udev_rules *rules, char *line) char group[32]; gid_t gid = lookup_group(value); dbg("replacing groupname='%s' by id=%i", value, gid); - sprintf(group, "%li", gid); + sprintf(group, "%u", (unsigned int) gid); add_rule_key(rule, &rule->group, operation, group); continue; } diff --git a/udevcontrol.c b/udevcontrol.c index f16f6a125a..6651e9761e 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -39,14 +39,14 @@ /* global variables */ static int sock = -1; -static int log = 0; +static int udev_log = 0; #ifdef USE_LOG void log_message (int priority, const char *format, ...) { va_list args; - if (priority > log) + if (priority > udev_log) return; va_start(args, format); @@ -69,7 +69,7 @@ int main(int argc, char *argv[], char *envp[]) env = getenv("UDEV_LOG"); if (env) - log = log_priority(env); + udev_log = log_priority(env); logging_init("udevcontrol"); dbg("version %s", UDEV_VERSION); diff --git a/udevd.c b/udevd.c index a926715908..bd1324e4a3 100644 --- a/udevd.c +++ b/udevd.c @@ -67,7 +67,7 @@ static int event_timeout; static int max_childs; static int max_childs_running; static unsigned long long expected_seqnum; -static char log[32]; +static char udev_log[32]; static LIST_HEAD(msg_list); static LIST_HEAD(exec_list); @@ -559,8 +559,8 @@ static struct uevent_msg *get_udevd_msg(void) intval = (int *) usend_msg.envbuf; info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i", *intval); udev_log_priority = *intval; - sprintf(log, "UDEV_LOG=%i", udev_log_priority); - putenv(log); + sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); + putenv(udev_log); break; case UDEVD_SET_MAX_CHILDS: intval = (int *) usend_msg.envbuf; @@ -912,8 +912,8 @@ int main(int argc, char *argv[], char *envp[]) info("initialize max_childs_running to %u", max_childs_running); /* export log_priority , as called programs may want to follow that setting */ - sprintf(log, "UDEV_LOG=%i", udev_log_priority); - putenv(log); + sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); + putenv(udev_log); while (!udev_exit) { struct uevent_msg *msg; diff --git a/udeveventrecorder.c b/udeveventrecorder.c index 9a3c3e197c..8ac344a47e 100644 --- a/udeveventrecorder.c +++ b/udeveventrecorder.c @@ -37,14 +37,14 @@ #define BUFSIZE 12345 #define FNSIZE 123 -static int log = 0; +static int udev_log = 0; #ifdef USE_LOG void log_message (int priority, const char *format, ...) { va_list args; - if (priority > log) + if (priority > udev_log) return; va_start(args, format); @@ -67,7 +67,7 @@ int main(int argc, char **argv, char **envp) env = getenv("UDEV_LOG"); if (env) - log = log_priority(env); + udev_log = log_priority(env); logging_init("udeveventrecorder"); dbg("version %s", UDEV_VERSION); diff --git a/udevinitsend.c b/udevinitsend.c index ea05734a00..4f50da8f68 100644 --- a/udevinitsend.c +++ b/udevinitsend.c @@ -42,14 +42,14 @@ #include "udev_utils.h" #include "logging.h" -static int log = 0; +static int udev_log = 0; #ifdef USE_LOG void log_message (int priority, const char *format, ...) { va_list args; - if (priority > log) + if (priority > udev_log) return; va_start(args, format); @@ -174,7 +174,7 @@ int main(int argc, char *argv[], char *envp[]) env = getenv("UDEV_LOG"); if (env) - log = log_priority(env); + udev_log = log_priority(env); logging_init("udevinitsend"); dbg("version %s", UDEV_VERSION); diff --git a/udevmonitor.c b/udevmonitor.c index 33dff2a13c..382cbb1905 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -181,7 +181,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "error receiving uevent message\n"); continue; } - printf("UEVENT[%i] %s\n", time(NULL), buf); + printf("UEVENT[%llu] %s\n", (unsigned long long) time(NULL), buf); } if ((udev_monitor_sock > 0) && FD_ISSET(udev_monitor_sock, &readfds)) { @@ -190,7 +190,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "error receiving udev message\n"); continue; } - printf("UDEV [%i] %s\n", time(NULL), buf); + printf("UDEV [%llu] %s\n", (unsigned long long) time(NULL), buf); } if (buflen == 0) -- cgit v1.2.3-54-g00ecf From c895fd002763d6ae808e820020dc54e74c347fc2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Oct 2005 21:04:38 +0200 Subject: move rules parsing into daemon The rules files are parsed only once at daemon startup. Every udev event process will be fork()'d from udevd without exec()'ing the udev binary. The in-memory rules will be inherited from the daemon itself. If inotify is available, udevd will reload all rules if any change in /etc/udev/rules.d/ happens. Otherwise -HUP or "udevcontrol reload_rules" can be used. Signed-off-by: Kay Sievers --- etc/udev/udev.conf.in | 4 +- udev_libc_wrapper.h | 69 +++++++++++++++++++++++- udevcontrol.c | 3 ++ udevd.c | 142 +++++++++++++++++++++++++++++++++++++++++--------- udevd.h | 1 + 5 files changed, 192 insertions(+), 27 deletions(-) diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index efdb1d1808..c44ed3092c 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -9,6 +9,8 @@ udev_db="@udevdir@/.udevdb" # The name and location of the udev rules file(s). udev_rules="@configdir@/rules.d" -# The syslog(3) priority: "err", "info", or the numerical value. +# The initial syslog(3) priority: "err", "info", "debug" or its +# numerical equivalent. For runtime debugging, change the daemons +# internal state with: "udevcontrol log_priority=". udev_log="err" diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 6f8c8f24c7..9a8b26a2b3 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -24,7 +24,72 @@ #include #include -#include +#include + +/* needed until Inotify! syscalls reach glibc */ +#include +#ifndef __NR_inotify_init +#if defined(__i386__) +# define __NR_inotify_init 291 +# define __NR_inotify_add_watch 292 +# define __NR_inotify_rm_watch 293 +#elif defined(__x86_64__) +# define __NR_inotify_init 253 +# define __NR_inotify_add_watch 254 +# define __NR_inotify_rm_watch 255 +#elif defined(__powerpc__) || defined(__powerpc64__) +# define __NR_inotify_init 275 +# define __NR_inotify_add_watch 276 +# define __NR_inotify_rm_watch 277 +#elif defined (__ia64__) +# define __NR_inotify_init 1277 +# define __NR_inotify_add_watch 1278 +# define __NR_inotify_rm_watch 1279 +#elif defined (__s390__) +# define __NR_inotify_init 284 +# define __NR_inotify_add_watch 285 +# define __NR_inotify_rm_watch 286 +#elif defined (__alpha__) +# define __NR_inotify_init 444 +# define __NR_inotify_add_watch 445 +# define __NR_inotify_rm_watch 446 +#elif defined (__sparc__) || defined (__sparc64__) +# define __NR_inotify_init 151 +# define __NR_inotify_add_watch 152 +# define __NR_inotify_rm_watch 156 +#elif defined (__arm__) +# define __NR_inotify_init 316 +# define __NR_inotify_add_watch 317 +# define __NR_inotify_rm_watch 318 +#elif defined (__sh__) +# define __NR_inotify_init 290 +# define __NR_inotify_add_watch 291 +# define __NR_inotify_rm_watch 292 +#else +# error "Unsupported architecture!" +#endif +#endif /* __NR_inotify_init */ + +/* needed until /usr/include/sys/inotify.h is working */ +#ifdef __KLIBC__ +#include +#else +static inline int inotify_init(void) +{ + return syscall(__NR_inotify_init); +} + +static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) +{ + return syscall(__NR_inotify_add_watch, fd, name, mask); +} +#define IN_CREATE 0x00000100 /* Subfile was created */ +#define IN_MOVED_FROM 0x00000040 /* File was moved from X */ +#define IN_MOVED_TO 0x00000080 /* File was moved to Y */ +#define IN_DELETE 0x00000200 /* Subfile was deleted */ +#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ +#endif /* __KLIBC__ */ /* needed for our signal handlers to work */ #undef asmlinkage @@ -32,7 +97,7 @@ #define asmlinkage __attribute__((regparm(0))) #else #define asmlinkage -#endif +#endif /* __i386__ */ /* headers are broken on some lazy platforms */ #ifndef __FD_SET diff --git a/udevcontrol.c b/udevcontrol.c index 6651e9761e..00b435edc4 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -89,6 +89,8 @@ int main(int argc, char *argv[], char *envp[]) usend_msg.type = UDEVD_STOP_EXEC_QUEUE; else if (!strcmp(arg, "start_exec_queue")) usend_msg.type = UDEVD_START_EXEC_QUEUE; + else if (!strcmp(arg, "reload_rules")) + usend_msg.type = UDEVD_RELOAD_RULES; else if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { intval = (int *) usend_msg.envbuf; val = &arg[strlen("log_priority=")]; @@ -106,6 +108,7 @@ int main(int argc, char *argv[], char *envp[]) " log_priority= set the udev log level for the daemon\n" " stop_exec_queue keep udevd from executing events, queue only\n" " start_exec_queue execute events, flush queue\n" + " reload_rules reloads the rules files\n" " max_childs= maximum number of childs running at the same time\n" " --help print this help text\n\n"); exit(0); diff --git a/udevd.c b/udevd.c index bd1324e4a3..1f769fbce0 100644 --- a/udevd.c +++ b/udevd.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -46,23 +47,26 @@ #include "udev_libc_wrapper.h" #include "udev.h" #include "udev_version.h" +#include "udev_rules.h" #include "udev_utils.h" #include "udevd.h" #include "logging.h" /* global variables*/ +struct udev_rules rules; static int udevd_sock; static int uevent_netlink_sock; +static int inotify_fd; static pid_t sid; static int signal_pipe[2] = {-1, -1}; static volatile int sigchilds_waiting; static volatile int run_msg_q; static volatile int udev_exit; +static volatile int reload_config; static int init_phase = 1; static int run_exec_q; static int stop_exec_q; -static char *udev_bin; static int event_timeout; static int max_childs; static int max_childs_running; @@ -75,7 +79,7 @@ static LIST_HEAD(running_list); #ifdef USE_LOG -void log_message (int priority, const char *format, ...) +void log_message(int priority, const char *format, ...) { va_list args; @@ -151,10 +155,55 @@ static void msg_queue_insert(struct uevent_msg *msg) return; } -/* forks event and removes event from run queue when finished */ +static void asmlinkage udev_event_sig_handler(int signum) +{ + if (signum == SIGALRM) + exit(1); +} + +static int udev_event_process(struct uevent_msg *msg) +{ + struct sigaction act; + struct udevice udev; + struct name_entry *name_loop; + int i; + int retval; + + /* set signal handlers */ + memset(&act, 0x00, sizeof(act)); + act.sa_handler = (void (*)(int)) udev_event_sig_handler; + sigemptyset (&act.sa_mask); + act.sa_flags = 0; + sigaction(SIGALRM, &act, NULL); + + /* trigger timeout to prevent hanging processes */ + alarm(UDEV_ALARM_TIMEOUT); + + /* reconstruct env from message */ + for (i = 0; msg->envp[i]; i++) + putenv(msg->envp[i]); + + udev_init_device(&udev, msg->devpath, msg->subsystem, msg->action); + retval = udev_process_event(&rules, &udev); + + /* run programs collected by RUN-key*/ + if (!retval) { + list_for_each_entry(name_loop, &udev.run_list, node) { + if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) + pass_env_to_socket(&name_loop->name[strlen("socket:")], msg->devpath, msg->action); + else + run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + } + } + + udev_cleanup_device(&udev); + + return 0; +} + +/* runs event and removes event from run queue when finished */ static void udev_event_run(struct uevent_msg *msg) { - char *const argv[] = { "udev", msg->subsystem, NULL }; pid_t pid; struct sysinfo info; @@ -162,14 +211,22 @@ static void udev_event_run(struct uevent_msg *msg) switch (pid) { case 0: /* child */ - if (uevent_netlink_sock != -1) + if (uevent_netlink_sock > 0) close(uevent_netlink_sock); + if (inotify_fd > 0) + close(inotify_fd); close(udevd_sock); + close(signal_pipe[READ_END]); + close(signal_pipe[WRITE_END]); logging_close(); + + logging_init("udevd-event"); setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); - execve(udev_bin, argv, msg->envp); - err("exec of child failed"); - _exit(1); + udev_event_process(msg); + info("seq %llu finished", msg->seqnum); + + logging_close(); + exit(0); case -1: err("fork of child failed"); msg_queue_delete(msg); @@ -421,9 +478,8 @@ recheck: if (msg_age >= timeout) { msg_move_exec(loop_msg); goto recheck; - } else { + } else break; - } } msg_dump_queue(); @@ -567,6 +623,10 @@ static struct uevent_msg *get_udevd_msg(void) info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i", *intval); max_childs = *intval; break; + case UDEVD_RELOAD_RULES: + info("udevd message (RELOAD_RULES) received"); + reload_config = 1; + break; default: dbg("unknown message type"); } @@ -640,6 +700,9 @@ static void asmlinkage sig_handler(int signum) /* set flag, then write to pipe if needed */ sigchilds_waiting = 1; break; + case SIGHUP: + reload_config = 1; + break; } /* write to pipe, which will wakeup select() in our mainloop */ @@ -838,17 +901,11 @@ int main(int argc, char *argv[], char *envp[]) err("error fcntl on read pipe: %s", strerror(errno)); goto exit; } - retval = fcntl(signal_pipe[READ_END], F_SETFD, FD_CLOEXEC); - if (retval < 0) - err("error fcntl on read pipe: %s", strerror(errno)); retval = fcntl(signal_pipe[WRITE_END], F_SETFL, O_NONBLOCK); if (retval < 0) { err("error fcntl on write pipe: %s", strerror(errno)); goto exit; } - retval = fcntl(signal_pipe[WRITE_END], F_SETFD, FD_CLOEXEC); - if (retval < 0) - err("error fcntl on write pipe: %s", strerror(errno)); /* set signal handlers */ memset(&act, 0x00, sizeof(struct sigaction)); @@ -861,6 +918,9 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGCHLD, &act, NULL); sigaction(SIGHUP, &act, NULL); + /* parse the rules and keep it in memory */ + udev_rules_init(&rules, 0, 1); + if (init_udevd_socket() < 0) { if (errno == EADDRINUSE) dbg("another udevd running, exit"); @@ -871,14 +931,12 @@ int main(int argc, char *argv[], char *envp[]) } if (init_uevent_netlink_sock() < 0) - info("uevent socket not available"); + err("uevent socket not available"); - /* override of forked udev binary, used for testing */ - udev_bin = getenv("UDEV_BIN"); - if (udev_bin != NULL) - info("udev binary is set to '%s'", udev_bin); - else - udev_bin = UDEV_BIN; + /* watch rules directory */ + inotify_fd = inotify_init(); + if (inotify_fd > 0) + inotify_add_watch(inotify_fd, udev_rules_filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* init of expected_seqnum value */ value = getenv("UDEVD_EXPECTED_SEQNUM"); @@ -911,6 +969,9 @@ int main(int argc, char *argv[], char *envp[]) max_childs_running = UDEVD_MAX_CHILDS_RUNNING; info("initialize max_childs_running to %u", max_childs_running); + /* clear environment for forked event processes */ + clearenv(); + /* export log_priority , as called programs may want to follow that setting */ sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); putenv(udev_log); @@ -924,8 +985,10 @@ int main(int argc, char *argv[], char *envp[]) FD_SET(udevd_sock, &readfds); if (uevent_netlink_sock > 0) FD_SET(uevent_netlink_sock, &readfds); + if (inotify_fd > 0) + FD_SET(inotify_fd, &readfds); - fdcount = select(UDEV_MAX(udevd_sock, uevent_netlink_sock)+1, &readfds, NULL, NULL, NULL); + fdcount = select(UDEV_MAX(uevent_netlink_sock, inotify_fd)+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) dbg("error in select: %s", strerror(errno)); @@ -965,6 +1028,33 @@ int main(int argc, char *argv[], char *envp[]) read(signal_pipe[READ_END], &buf, sizeof(buf)); } + /* rules directory inotify watch */ + if ((inotify_fd > 0) && FD_ISSET(inotify_fd, &readfds)) { + int nbytes; + + /* discard all possible events, we can just reload the config */ + if ((ioctl(inotify_fd, FIONREAD, &nbytes) == 0) && nbytes) { + char *buf; + + reload_config = 1; + buf = malloc(nbytes); + if (!buf) { + err("error getting buffer for inotify, disable watching"); + close(inotify_fd); + inotify_fd = -1; + } + read(inotify_fd, buf, nbytes); + free(buf); + } + } + + /* rules changed, set by inotify or a signal*/ + if (reload_config) { + reload_config = 0; + udev_rules_close(&rules); + udev_rules_init(&rules, 0, 1); + } + /* forked child have returned */ if (sigchilds_waiting) { sigchilds_waiting = 0; @@ -990,6 +1080,8 @@ int main(int argc, char *argv[], char *envp[]) } exit: + udev_rules_close(&rules); + if (signal_pipe[READ_END] > 0) close(signal_pipe[READ_END]); if (signal_pipe[WRITE_END] > 0) @@ -997,6 +1089,8 @@ exit: if (udevd_sock > 0) close(udevd_sock); + if (inotify_fd > 0) + close(inotify_fd); if (uevent_netlink_sock > 0) close(uevent_netlink_sock); diff --git a/udevd.h b/udevd.h index da5f6b94f9..db510ab24a 100644 --- a/udevd.h +++ b/udevd.h @@ -54,6 +54,7 @@ enum udevd_msg_type { UDEVD_START_EXEC_QUEUE, UDEVD_SET_LOG_LEVEL, UDEVD_SET_MAX_CHILDS, + UDEVD_RELOAD_RULES, }; -- cgit v1.2.3-54-g00ecf From 6cb1bbe471ea4e5098a47e4515765e6cae96b9a0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Oct 2005 21:49:13 +0200 Subject: "make STRIPCMD=" will disable the stripping of binaries Almost all packagers have always patched the stripping out, cause the buildsystems takes care of it. Signed-off-by: Kay Sievers --- Makefile | 4 +++- RELEASE-NOTES | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f69ac96e9d..d309cf6c90 100644 --- a/Makefile +++ b/Makefile @@ -169,7 +169,7 @@ endif # if DEBUG is enabled, then we do not strip ifeq ($(strip $(DEBUG)),true) CFLAGS += -DDEBUG - STRIPCMD = /bin/true unstripped binary + STRIPCMD = endif ifeq ($(strip $(USE_GCOV)),true) @@ -233,7 +233,9 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) # "Static Pattern Rule" to build all programs $(PROGRAMS): %: $(HOST_PROGS) $(KLCC) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) %.o $(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif # our own copy of klibc, it is not used if KLCC is given $(KLCC): diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 815d4083c5..39e72d474d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,15 @@ +udev 072 +======== +The rule parsing happens now in the daemon once at startup, all udev +event processes inherit the already parsed rules from the daemon. +It is shipped with SUSE10.0 and reduces heavily the system load at +startup. + +using 'make STRIPCMD=' will leave the binaries unstripped for debugging +and packaging. + +A few improvements for vol_id, the filesytem probing code. + udev 071 ======== Fix a stupid typo in extras/run_directory for "make install". -- cgit v1.2.3-54-g00ecf From 90e037dbe29fc55e72d0c7e31ed78a71b8dca2c9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 Oct 2005 00:29:50 +0200 Subject: remove no longer working udevd-test program Signed-off-by: Kay Sievers --- test/udevd-test/udev-log-amplify.pl | 63 ---- test/udevd-test/udev-log-script.pl | 58 ---- test/udevd-test/udevd-test.pl | 602 ------------------------------------ 3 files changed, 723 deletions(-) delete mode 100644 test/udevd-test/udev-log-amplify.pl delete mode 100644 test/udevd-test/udev-log-script.pl delete mode 100644 test/udevd-test/udevd-test.pl diff --git a/test/udevd-test/udev-log-amplify.pl b/test/udevd-test/udev-log-amplify.pl deleted file mode 100644 index 9e2692ac0c..0000000000 --- a/test/udevd-test/udev-log-amplify.pl +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/perl -w -# -# udev-log-amplify -# -# Copyright (C) Intel Corp, 2004 -# -# Author: Yin Hu -# -# This is a script for replacing udev binary during udevsend/udevd testing. -# It first amplifies the execution time ( sleep 5 ) and then logs the event -# information sent by udved in order that test script udevd-test.pl can -# analyze whether udved execute as we expected. -# You should not execute this script directly because it will be invoked by -# udevd automatically. -# -# Before you run your test please modify $log_file to designate where the udev -# log file should be placed, in fact, the default value is ok. -# -# -# 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 02139, USA. -# - -use warnings; -use strict; - -# modifiable settings -my $udev_exe_time = 5; -my $log_file = "/tmp/udev_log.txt"; - -if ($ARGV[0]) { - my $subsystem = $ARGV[0]; - my $devpath = $ENV{DEVPATH}; - my $action = $ENV{ACTION}; - my $time = time(); - - # Logging - if (open(LOGF, ">>$log_file")) { - print LOGF "$devpath,$action,$subsystem,$time\n"; - } else { - print "File open failed. \n"; - exit 1; - } - close(LOGF); - - # Amplify the execution time of udev - sleep 5; - - exit 0; -} else { - print "Too less argument count.\n"; - exit 1; -} diff --git a/test/udevd-test/udev-log-script.pl b/test/udevd-test/udev-log-script.pl deleted file mode 100644 index 5d7ca71181..0000000000 --- a/test/udevd-test/udev-log-script.pl +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/perl -w -# -# udev-log-script -# -# Copyright (C) Intel Corp, 2004 -# -# Author: Yin Hu -# -# This is a script for replacing udev binary during udevsend/udevd testing. -# It just simply logs the event information sent by udved in order to -# test script udevd-test.pl can analyze whether udved execute as we expected. -# You should not execute this script directly because it will be invoked by -# udevd automatically. -# -# Before you run your test please modify $log_file to designate where the udev -# log file should be placed, in fact, the default value is ok. -# -# -# 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 02139, USA. -# - -use warnings; -use strict; - -# modifiable settings -my $log_file = "/tmp/udev_log.txt"; - -if ($ARGV[0]) { - my $subsystem = $ARGV[0]; - my $devpath = $ENV{DEVPATH}; - my $action = $ENV{ACTION}; - my $time = time(); - - # Logging - if (open(LOGF, ">>$log_file")) { - print LOGF "$devpath,$action,$subsystem,$time\n"; - } else { - print "File open failed. \n"; - exit 1; - } - close(LOGF); - - exit 0; -} else { - print "Too less argument count.\n"; - exit 1; -} diff --git a/test/udevd-test/udevd-test.pl b/test/udevd-test/udevd-test.pl deleted file mode 100644 index 2328de814f..0000000000 --- a/test/udevd-test/udevd-test.pl +++ /dev/null @@ -1,602 +0,0 @@ -#!/usr/bin/perl -w -# -# udevd-test -# -# Copyright (C) Intel Corp, 2004 -# -# Author: Yin Hu -# -# Provides automated testing of the udevd binary.This test script is self-contained. -# Before you run this script please modify $sysfs to locate your sysfs filesystem, -# modify $udevsend_bin to locate your udevsend binary, -# modify $udev_bin to locate dummy udev script, -# modify $udev_bin2 to locate another dummy udev script ( amplify the execution time for test), -# modify $log_file to locate where udev script have placed the log file, -# modify $time_out to decide the time out for events, -# modify $udev_exe_time to decide the execution time for dummy udev script. -# -# Detail information of each test case please refer to the header of corresponding -# test case function. -# -# -# 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 02139, USA. -# - -use warnings; -use strict; - -# modifiable settings -my $sysfs = "../sys"; -my $udevd_bin = "../../udevd"; -my $udevsend_bin = "../../udevsend"; -my $udev_bin = "$ENV{'PWD'}/udev-log-script.pl"; -my $udev_bin2 = "$ENV{'PWD'}/udev-log-amplify.pl"; -my $log_file = "/tmp/udev_log.txt"; -my $time_out = 10; -my $udev_exe_time = 5; - -# global variables -my $test_case = 0; - -# common functions - -sub restart_daemon { - my ($udev_binary) = @_; - - system("killall udevd"); - system("rm -f $log_file"); - sleep 1; - - if (!defined($udev_binary)) { - $udev_binary = $udev_bin; - } - - $ENV{'UDEV_BIN'} = $udev_binary; - system("/bin/sh -c $udevd_bin&"); - sleep(1); -} - -sub udevsend { - # This function prepares corresponding environment variables - # and then call $udevsend_bin to send event. - - my ($seqnum, $devpath, $action, $subsystem, $script) = @_; - - %ENV = (); - $ENV{'DEVPATH'} = $devpath; - $ENV{'ACTION'} = $action; - $ENV{'SUBSYSTEM'} = $subsystem; - - if ( $seqnum != -1) { - $ENV{SEQNUM} = $seqnum; - } - - return system("$udevsend_bin $subsystem"); -} - -sub check_count_and_time { - my $event_recv_time; - my $udev_fork_time; - my $log_ln_count = 0; - my $line; - my @content; - my @line_items; - my $diff; - - ($event_recv_time) = @_; - - print " event receiving time: $event_recv_time\n\n"; - - open(LOGF, $log_file) || die "Opening file $log_file: $!"; - @content = ; - foreach $line ( @content ) { - @line_items = split(/,/,$line); - print " device: $line_items[0], action: $line_items[1] \n"; - print " forking udev time: $line_items[-1]"; - $diff = $line_items[-1] - $event_recv_time; - print " the delay time is: $diff s \n\n"; - if ( $diff > $time_out+10 ) { - print " the delay time is: $diff \n"; - print " udevd doesn't act properly. \n"; - exit 1; - } - $log_ln_count++; - } - close(LOGF); - - return $log_ln_count; -} - -sub check_sysfs_device_exist { - # check if the designated devices exist - my @dev_list = @_; - my $dev; - - foreach $dev (@dev_list) { - if (! -e $dev) { - print "the designated device $dev doesn't exist. please change a device!\n"; - exit 1; - } - } -} - -sub show_result { - my $event_recv_time; - my $udev_fork_time; - my $line; - my @content; - my @line_items; - my $diff; - - ($event_recv_time) = @_; - - print " event receiving time: $event_recv_time\n\n"; - - open(LOGF, $log_file) || die "Opening file $log_file: $!"; - @content = ; - foreach $line ( @content ) { - @line_items = split(/,/,$line); - print " device: $line_items[0], action: $line_items[1] \n"; - print " forking udev time: $line_items[-1]"; - $diff = $line_items[-1] - $event_recv_time; - print " the delay time is: $diff s \n\n"; - } - close(LOGF); -} - -sub show_result_tm_out { - my $event_recv_time; - my $udev_fork_time; - my $line; - my @content; - my @line_items; - my $diff; - - ($event_recv_time) = @_; - - print " event receiving time: $event_recv_time\n\n"; - - open(LOGF, $log_file) || die "Opening file $log_file: $!"; - @content = ; - foreach $line ( @content ) { - @line_items = split(/,/,$line); - print " device: $line_items[0], action: $line_items[1] \n"; - print " forking udev time: $line_items[-1]"; - $diff = $line_items[-1] - $event_recv_time; - print " the delay time is: $diff s \n\n"; - if ( $diff < $time_out ) { - print " the delay time is: $diff \n"; - print " udevd doesn't act properly. \n"; - exit 1; - } - } - close(LOGF); -} - -sub show_result_immediate { - my $event_recv_time; - my $udev_fork_time; - my $line; - my @content; - my @line_items; - my $diff; - - ($event_recv_time) = @_; - - print " event receiving time: $event_recv_time\n\n"; - - open(LOGF, $log_file) || die "Opening file $log_file: $!"; - @content = ; - foreach $line ( @content ) { - @line_items = split(/,/,$line); - print " device: $line_items[0], action: $line_items[1] \n"; - print " forking udev time: $line_items[-1]"; - $diff = $line_items[-1] - $event_recv_time; - print " the delay time is: $diff s \n\n"; - if ( $diff > $time_out ) { - print " the delay time is: $diff \n"; - print " udevd doesn't act properly. \n"; - exit 1; - } - } - close(LOGF); -} - -sub check_exe_time { - my @exe_time; - my $i = 0; - my $line; - my @content; - my @line_items; - my $diff; - - open(LOGF, $log_file) || die "Opening file $log_file: $!"; - @content = ; - close(LOGF); - foreach $line ( @content ) { - @line_items = split(/,/,$line); - $exe_time[$i] = $line_items[-1]; - $i++; - } - $diff = $exe_time[1] - $exe_time[0]; - if ( $diff < $udev_exe_time ) { - print " there are more than one udev instance for a single device at the same time. \n"; - exit 1; - } else { - print " there is just one udev instance for a single device at the same time. \n"; - } -} - -# test case functions -sub run_no_seq_test { - print "Test case name: no sequence number test\n"; - print "Test case purpose: check whether udevd forks udev immediately when environment variable SEQNUM is null.\n"; - print "Test expected visible results: \n"; - print " the delay time between event receiving and forking udev for udevd should be negligible, \n"; - print " that is, udev should be forked at once. please notice the following time...\n\n"; - - my $time; - - # - # add devices event test - # - restart_daemon(); - - # check if devices /block/sda exist - check_sysfs_device_exist("$sysfs/block/sda"); - - # log current system date/time - $time = time(); - - udevsend(-1, "/block/sda", "add", "block"); - - # check if execution is successful in time - sleep 1; - show_result_immediate($time); - print " fork udev (add device) at once successfully.\n\n"; - - # - # remove devices event test - # - system("rm -f $log_file"); - - # log current system date/time - $time = time(); - - udevsend(-1, "/block/sda", "remove", "block"); - - # check if execution is successful in time - sleep 1; - show_result_immediate($time); - print " fork udev (remove device) at once successfully.\n\n"; - print "this case is ok\n\n"; -} - -sub run_normal_seq_test { - print "Test case name: normal sequence number stress test\n"; - print "Test case purpose: check whether udevd can fork massive udev instances for \n"; - print " massive sequential events successfully. \n"; - print "Test expected visible results: \n"; - print " Populate all the devices in directory $sysfs/class/tty, fork udved to send add/remove \n"; - print " event to udev for each device. \n"; - print " We can see the delay time for each device should be negligible. \n\n"; - - my @file_list; - my $file; - my $seq = 0; - my $time; - my $ret_seq; - - restart_daemon(); - @file_list = glob "$sysfs/class/tty/*"; - - # log current system date/time for device add events - $time = time(); - - # - # add devices event test - # - print "add device events test: \n"; - foreach $file (@file_list) { - udevsend($seq, substr($file, length($sysfs), length($file)-length($sysfs)), "add", "tty"); - # check if execution is successful - if ($? == 0) { - $seq++; - } else { - print "add event: error\n\n"; - exit 1; - } - } - - # we'd better wait the udev to create all the device for a few seconds - print " wait for udevd processing about $time_out s... \n\n"; - sleep $time_out + 5; - - $ret_seq = check_count_and_time($time); - if ( $ret_seq != $seq ) { - print " add event: failed. some device-adding events fail to execute.\n\n"; - exit 1; - } else { - print " $seq pieces of device-adding events have executed successfully.\n\n"; - } - - # log current system date/time for device remove events - $time = time(); - - # - # remove devices event test - # - print "remove device events test: \n"; - restart_daemon(); - @file_list = glob "$sysfs/class/tty/*"; - $seq = 0; - foreach $file (@file_list) { - udevsend($seq, substr($file, length($sysfs), length($file)-length($sysfs)), "remove", "tty"); - # check if execution is successful - if ($? == 0) { - $seq++; - } else { - print "remove event: error\n\n"; - exit 1; - } - } - - # we'd better wait the udev to create all the device for a few seconds - print " waiting for udev removing devices (about $time_out s)...\n"; - sleep $time_out + 5; - - # show results - $ret_seq = check_count_and_time($time); - if ( $ret_seq != $seq ) { - print " remove event: failed. some device-removing events fail to execute.\n\n"; - exit 1; - } else { - print " $seq pieces of device-removing events have executed successfully.\n\n"; - print "this case is ok.\n\n"; - } -} - -sub run_random_seq_test { - print "Test case name: random sequence number test case,\n"; - print "Test case purpose: check whether udevd can order the events with random sequence number \n"; - print " and fork udev correctly. \n"; - print "Test expected visible results: \n"; - print " We have disordered the events sent to udevd, if udevd can order them correctly, the devices' \n"; - print " add/remove sequence should be tty0, tty1, tty2. \n\n"; - - my $time; - - # check if devices /class/tty/tty0, tty1, tty2 exist - check_sysfs_device_exist("$sysfs/class/tty/tty0", "$sysfs/class/tty/tty1", "$sysfs/class/tty/tty2"); - - # - # add device events test - # - print "add device events test: \n"; - restart_daemon(); - - # log current system date/time for device remove events - $time = time(); - - # parameters: 1 sequence number, 2 device, 3 action, 4 subsystem - udevsend(3, "/class/tty/tty2", "add", "tty"); - udevsend(1, "/class/tty/tty0", "add", "tty"); - udevsend(2, "/class/tty/tty1", "add", "tty"); - print " wait for udevd processing about $time_out s... \n\n"; - sleep $time_out+1; - show_result_tm_out($time); - - # - # remove device events test - # - print "\nremove device events test: \n"; - restart_daemon(); - - # log current system date/time for device remove events - $time = time(); - - udevsend(3, "/class/tty/tty2", "remove", "tty"); - udevsend(2, "/class/tty/tty1", "remove", "tty"); - udevsend(1, "/class/tty/tty0", "remove", "tty"); - - # show results - print " wait for udevd processing about $time_out s... \n\n"; - sleep $time_out+1; - show_result_tm_out($time); - print "this case is ok.\n\n"; -} - -sub run_expected_seq_test { - print "Test case name: expected sequence number test \n"; - print "Test case purpose: check whether udevd fork udev immediately when the incoming event\n"; - print " is exactly the expected event sequence number.\n"; - print "Test expected visible results:\n"; - print " first, udevd disposes disorder events(sequence number is 3,1,2,5,4,6),\n"; - print " thus after disposed the expected event number for udevd is 7, when incoming event is 7, udevd\n"; - print " should fork udev immediately, the delay time should be negligible. \n"; - print " where: event 7 is (add device /class/tty/tty2) \n\n"; - - my $time; - - # check if devices /class/tty0, tty1, tty2 exist - check_sysfs_device_exist("$sysfs/class/tty/tty0", "$sysfs/class/tty/tty1", "$sysfs/class/tty/tty2"); - - restart_daemon(); - - # parameters: 1 sequence number, 2 device, 3 action, 4 subsystem - udevsend(3, "/class/tty/tty2", "add", "tty"); - udevsend(1, "/class/tty/tty0", "add", "tty"); - udevsend(2, "/class/tty/tty1", "add", "tty"); - udevsend(5, "/class/tty/tty1", "remove", "tty"); - udevsend(4, "/class/tty/tty0", "remove", "tty"); - udevsend(6, "/class/tty/tty2", "remove", "tty"); - - print " wait for udevd timing out for disorder events (about $time_out s) \n\n"; - sleep $udev_exe_time + $time_out+1; - system("rm -f $log_file"); - - # log current system date/time for device remove events - $time = time(); - - # show results - udevsend(7, "/class/tty/tty2", "add", "tty"); - sleep 1; - print " event sequence number: 7 \n"; - show_result_immediate($time); - - print "this case is ok.\n\n"; -} - -sub run_single_instance_test { - print "Test case name: single instance running for a single device test \n"; - print "Test case purpose: check whether udevd only fork one udev instance for a single\n"; - print " device at the same time. For each event a udev instance is \n"; - print " executed in the background. All further events for the same \n"; - print " device are delayed until the execution is finished. This way \n"; - print " there will never be more than one instance running for a single \n"; - print " device at the same time.\n"; - print "Test expected visible results:\n"; - print " In this test we amplify the execution time of udev (about 5 seconds), first, \n"; - print " we send a add event for device /block/sda, and then we send a remove event, so the \n"; - print " execution of remove event should be delayed until add is finished. \n\n"; - - my $time; - - restart_daemon($udev_bin2); - - # check if device exists - check_sysfs_device_exist("$sysfs/block/sda"); - - # log current system date/time - $time = time(); - - udevsend(-1, "/block/sda", "add", "block"); - udevsend(-1, "/block/sda", "remove", "block"); - - # show results - print " wait for udevd processing about $udev_exe_time s... \n\n"; - sleep $udev_exe_time+1; - show_result_immediate($time); - check_exe_time(); - print "this case is ok\n\n"; -} - -sub run_same_events_test { - print "Test case name: event sequence number overlap test \n"; - print "Test case purpose: check whether udevd doesn't fork udev untill time out\n"; - print " when encountering a event with sequence number same as the pevious event. \n"; - print "Test expected visible results:\n"; - print " event ( remove device /block/sda ) should be no delay, \n"; - print " event ( add device /class/tty/tty1 ) should be delayed for $time_out s than its previous \n"; - print " event ( remove device /block/sda ) \n\n"; - - my $time; - - restart_daemon(); - - # check if device exist - check_sysfs_device_exist("$sysfs/block/sda", "$sysfs/class/tty/tty1"); - - udevsend(0, "/block/sda", "add", "block"); - - # log current system date/time - sleep 1; - $time = time(); - system("rm -f $log_file"); - - udevsend(1, "/block/sda", "remove", "block"); - udevsend(1, "/class/tty/tty1", "add", "tty"); - - # show results - print " wait for udevd processing about $time_out s... \n\n"; - sleep $time_out+1; - show_result($time); - print "this case is ok\n\n"; -} - -sub run_missing_seq_test { - print "Test case name: missing sequence number test \n"; - print "Test case purpose: check whether udevd doesn't fork udev untill time out\n"; - print " when certain event sequence number is missing.\n"; - print "Test expected visible results:\n"; - print " the delay time for event(add device /block/sda) should be about $time_out s.\n\n"; - - my $time; - - restart_daemon(); - - # check if device exist - check_sysfs_device_exist("$sysfs/block/sda", "$sysfs/class/tty/tty1"); - - udevsend(0, "/class/tty/tty1", "add", "tty"); - udevsend(1, "/class/tty/tty1", "remove", "tty"); - sleep 1; - - # log current system date/time - $time = time(); - system("rm -f $log_file"); - - udevsend(3, "/block/sda", "add", "block"); - - # show results - print " wait for udevd processing about $time_out s... \n\n"; - sleep $time_out+1; - show_result($time); - print "this case is ok\n\n"; -} - -sub run_all_cases_test { - run_no_seq_test(); - run_normal_seq_test(); - run_random_seq_test(); - run_missing_seq_test(); - run_expected_seq_test(); - run_same_events_test(); - run_single_instance_test(); -} - -# main program -if ($ARGV[0]) { - $test_case = $ARGV[0]; - - if ($test_case == 1) { - run_no_seq_test(); - } elsif ($test_case == 2) { - run_normal_seq_test(); - } elsif ($test_case == 3) { - run_random_seq_test(); - } elsif ($test_case == 4) { - run_missing_seq_test(); - } elsif ($test_case == 5) { - run_expected_seq_test(); - } elsif ($test_case == 6) { - run_single_instance_test(); - } elsif ($test_case == 7) { - run_same_events_test(); - } else { - run_all_cases_test(); - } -} else { - # echo usage - print "command format: perl udevd-test.pl \n"; - print " test case:\n"; - print " 1: no event sequence number\n"; - print " 2: sequential event sequence number\n"; - print " 3: random event sequence number\n"; - print " 4: missing event sequence number\n"; - print " 5: the incoming event sequence number is right the expected sequence number\n"; - print " 6: single udev instance on a single device at the same time\n"; - print " 7: test event sequence number overlap\n"; - print " 9: all the cases\n\n"; -} -- cgit v1.2.3-54-g00ecf From c1bf1edeb726dc2cdedca5358f9b9cd88db72697 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 Oct 2005 01:49:22 +0200 Subject: "STRIPCMD=" for the EXTRAS Signed-off-by: Kay Sievers --- Makefile | 2 +- extras/ata_id/Makefile | 2 ++ extras/cdrom_id/Makefile | 2 ++ extras/dasd_id/Makefile | 2 ++ extras/edd_id/Makefile | 2 ++ extras/firmware/Makefile | 2 ++ extras/floppy/Makefile | 2 ++ extras/run_directory/Makefile | 2 ++ extras/scsi_id/Makefile | 2 ++ extras/usb_id/Makefile | 2 ++ extras/volume_id/Makefile | 2 ++ 11 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d309cf6c90..8446eee924 100644 --- a/Makefile +++ b/Makefile @@ -233,7 +233,7 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) # "Static Pattern Rule" to build all programs $(PROGRAMS): %: $(HOST_PROGS) $(KLCC) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) %.o $(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) +ifneq ($(STRIPCMD),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index d93e694778..fba0d0b719 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -35,7 +35,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(STRIPCMD),) $(QUIET) $(STRIPCMD) $@ +endif # man pages %.8: %.xml diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index c3ee6e3295..f06d2c65bf 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -35,7 +35,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif # man pages %.8: %.xml diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 2a14050d66..698253a9ee 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -35,7 +35,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif # man pages %.8: %.xml diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 70244ea468..65e023f542 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -35,7 +35,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif # man pages %.8: %.xml diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index 7de94c40a7..48dacb4764 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -35,7 +35,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif # man pages %.8: %.xml diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 8568e28edf..344f48828d 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -35,7 +35,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif # man pages %.8: %.xml diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 20b3af340c..1b48719c61 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -34,7 +34,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif # man pages %.8: %.xml diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 8a8c714a87..fadd4a1dd4 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -49,7 +49,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif scsi_id_version.h: @echo "/* This file is auto-generated by the Makefile */" > $@ diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 1796aaea09..9f82fd5b2c 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -35,7 +35,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif # man pages %.8: %.xml diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 56cab10e23..a936e43bb2 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -38,7 +38,9 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ +endif # man pages %.8: %.xml -- cgit v1.2.3-54-g00ecf From 29ed5bf414c9eebdc78c68540f8a19af7691ef1f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 Oct 2005 02:29:38 +0200 Subject: add dummy inotify syscalls on unsupported architecture Signed-off-by: Kay Sievers --- udev_libc_wrapper.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 9a8b26a2b3..824603b74c 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -66,10 +66,22 @@ # define __NR_inotify_add_watch 291 # define __NR_inotify_rm_watch 292 #else -# error "Unsupported architecture!" +#warning "inotify unsupported on this architecture!" #endif #endif /* __NR_inotify_init */ +/* dummy if we don't have the syscalls defined */ +#ifndef __NR_inotify_init +static inline int inotify_init(void) +{ + return -1; +} + +static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) +{ + return -1; +} +#else /* needed until /usr/include/sys/inotify.h is working */ #ifdef __KLIBC__ #include @@ -83,13 +95,17 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) { return syscall(__NR_inotify_add_watch, fd, name, mask); } +#endif /* __KLIBC__ */ +#endif /* __NR_inotify_init */ + +#ifndef IN_CREATE #define IN_CREATE 0x00000100 /* Subfile was created */ #define IN_MOVED_FROM 0x00000040 /* File was moved from X */ #define IN_MOVED_TO 0x00000080 /* File was moved to Y */ #define IN_DELETE 0x00000200 /* Subfile was deleted */ #define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ #define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ -#endif /* __KLIBC__ */ +#endif /* IN_CREATE */ /* needed for our signal handlers to work */ #undef asmlinkage -- cgit v1.2.3-54-g00ecf From 2a4ce7092546039063fcf5aaa36760a89d8c9047 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Oct 2005 21:13:43 +0200 Subject: remove no longer needed waiting for "dev" file Signed-off-by: Kay Sievers --- udev_sysfs.c | 310 ++++++++++++----------------------------------------------- udev_sysfs.h | 3 +- udev_utils.c | 23 ----- udev_utils.h | 1 - 4 files changed, 61 insertions(+), 276 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index 75e275d500..71aa827d38 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -35,30 +35,6 @@ #include "logging.h" /* list of subsystem specific files, NULL if there is no file to wait for */ -static const struct subsystem_file { - const char *subsystem; - const char *file; -} subsystem_files[] = { - { .subsystem = "class", .file = NULL }, - { .subsystem = "net", .file = "ifindex" }, - { .subsystem = "scsi_host", .file = "unique_id" }, - { .subsystem = "scsi_device", .file = NULL }, - { .subsystem = "pcmcia_socket", .file = "card_type" }, - { .subsystem = "usb_host", .file = NULL }, - { .subsystem = "bluetooth", .file = "address" }, - { .subsystem = "firmware", .file = "data" }, - { .subsystem = "i2c-adapter", .file = NULL }, - { .subsystem = "pci_bus", .file = NULL }, - { .subsystem = "ieee1394", .file = NULL }, - { .subsystem = "ieee1394_host", .file = NULL }, - { .subsystem = "ieee1394_node", .file = NULL }, - { .subsystem = "fc_transport", .file = "port_id" }, - { .subsystem = "fc_host", .file = "port_id" }, - { .subsystem = "spi_transport", .file = "width" }, - { .subsystem = "spi_host", .file = "width" }, - { NULL, NULL } -}; - dev_t get_devt(struct sysfs_class_device *class_dev) { struct sysfs_attribute *attr = NULL; @@ -76,215 +52,6 @@ dev_t get_devt(struct sysfs_class_device *class_dev) return makedev(major, minor); } -int subsystem_expect_no_dev(const char *subsystem) -{ - const struct subsystem_file *file; - - for (file = subsystem_files; file->subsystem != NULL; file++) - if (strcmp(subsystem, file->subsystem) == 0) - return 1; - - return 0; -} - -/* get subsystem specific files, returns "dev" if no other found */ -static const char *get_subsystem_specific_file(const char *subsystem) -{ - const struct subsystem_file *file; - - /* look if we want to look for another file instead of "dev" */ - for (file = subsystem_files; file->subsystem != NULL; file++) - if (strcmp(subsystem, file->subsystem) == 0) - return file->file; - - return "dev"; -} - -/* wait for class pecific file to show up */ -static int wait_for_class_device_attributes(struct sysfs_class_device *class_dev, - const char **error) -{ - const char *file; - char filename[PATH_SIZE]; - int loop; - - file = get_subsystem_specific_file(class_dev->classname); - if (file == NULL) { - dbg("class '%s' has no file to wait for", class_dev->classname); - return 0; - } - - snprintf(filename, sizeof(filename), "%s/%s", class_dev->path, file); - filename[sizeof(filename)-1] = '\0'; - dbg("looking at class '%s' for specific file '%s'", class_dev->classname, filename); - - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - struct stat stats; - - if (stat(class_dev->path, &stats) == -1) { - dbg("'%s' now disappeared (probably remove has beaten us)", class_dev->path); - return -ENODEV; - } - - if (stat(filename, &stats) == 0) { - dbg("class '%s' specific file '%s' found", class_dev->classname, file); - return 0; - } - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - - dbg("error: getting class '%s' specific file '%s'", class_dev->classname, file); - if (error) - *error = "class specific file unavailable"; - return -ENOENT; -} - -/* check if we need to wait for a physical device */ -static int class_device_expect_no_device_link(struct sysfs_class_device *class_dev) -{ - /* list of devices without a "device" symlink to the physical device - * if device is set to NULL, no devices in that subsystem has a link */ - static const struct class_device { - const char *subsystem; - const char *device; - } class_device[] = { - { .subsystem = "block", .device = "double" }, - { .subsystem = "block", .device = "nb" }, - { .subsystem = "block", .device = "ram" }, - { .subsystem = "block", .device = "loop" }, - { .subsystem = "block", .device = "fd" }, - { .subsystem = "block", .device = "md" }, - { .subsystem = "block", .device = "dos_cd" }, - { .subsystem = "block", .device = "rflash" }, - { .subsystem = "block", .device = "rom" }, - { .subsystem = "block", .device = "rrom" }, - { .subsystem = "block", .device = "flash" }, - { .subsystem = "block", .device = "msd" }, - { .subsystem = "block", .device = "sbpcd" }, - { .subsystem = "block", .device = "pcd" }, - { .subsystem = "block", .device = "pf" }, - { .subsystem = "block", .device = "scd" }, - { .subsystem = "block", .device = "ubd" }, - { .subsystem = "block", .device = "dm-" }, - { .subsystem = "block", .device = "bcrypt" }, - { .subsystem = "input", .device = "event" }, - { .subsystem = "input", .device = "mice" }, - { .subsystem = "input", .device = "mouse" }, - { .subsystem = "input", .device = "ts" }, - { .subsystem = "input", .device = "js" }, - { .subsystem = "vc", .device = NULL }, - { .subsystem = "tty", .device = NULL }, - { .subsystem = "cpuid", .device = "cpu" }, - { .subsystem = "graphics", .device = "fb" }, - { .subsystem = "mem", .device = NULL }, - { .subsystem = "misc", .device = NULL }, - { .subsystem = "msr", .device = NULL }, - { .subsystem = "netlink", .device = NULL }, - { .subsystem = "net", .device = "sit" }, - { .subsystem = "net", .device = "lo" }, - { .subsystem = "net", .device = "tap" }, - { .subsystem = "net", .device = "ipsec" }, - { .subsystem = "net", .device = "dummy" }, - { .subsystem = "net", .device = "irda" }, - { .subsystem = "net", .device = "ppp" }, - { .subsystem = "net", .device = "tun" }, - { .subsystem = "net", .device = "pan" }, - { .subsystem = "net", .device = "bnep" }, - { .subsystem = "net", .device = "vmnet" }, - { .subsystem = "net", .device = "ippp" }, - { .subsystem = "net", .device = "nlv" }, - { .subsystem = "net", .device = "atml" }, - { .subsystem = "ppp", .device = NULL }, - { .subsystem = "sound", .device = NULL }, - { .subsystem = "printer", .device = "lp" }, - { .subsystem = "ppdev", .device = NULL }, - { .subsystem = "nvidia", .device = NULL }, - { .subsystem = "video4linux", .device = "vbi" }, - { .subsystem = "dvb", .device = NULL }, - { .subsystem = "lirc", .device = NULL }, - { .subsystem = "firmware", .device = NULL }, - { .subsystem = "drm", .device = NULL }, - { .subsystem = "pci_bus", .device = NULL }, - { .subsystem = "ieee1394", .device = NULL }, - { .subsystem = "ieee1394_host", .device = NULL }, - { .subsystem = "ieee1394_node", .device = NULL }, - { .subsystem = "raw", .device = NULL }, - { .subsystem = "zaptel", .device = NULL }, - { .subsystem = "tiglusb", .device = NULL }, - { .subsystem = "ppdev", .device = NULL }, - { .subsystem = "ticables", .device = NULL }, - { .subsystem = "snsc", .device = NULL }, - { .subsystem = "staliomem", .device = NULL }, - { .subsystem = "tape", .device = NULL }, - { .subsystem = "ip2", .device = NULL }, - { .subsystem = "tpqic02", .device = NULL }, - { .subsystem = "dsp56k", .device = NULL }, - { .subsystem = "zft", .device = NULL }, - { .subsystem = "adb", .device = NULL }, - { .subsystem = "cosa", .device = NULL }, - { .subsystem = "pg", .device = NULL }, - { .subsystem = "pt", .device = NULL }, - { .subsystem = "capi", .device = NULL }, - { NULL, NULL } - }; - const struct class_device *classdevice; - unsigned int len; - - /* the kernel may tell us what to wait for */ - if (kernel_release_satisfactory(2,6,10) > 0) - if (getenv("PHYSDEVPATH") == NULL) { - dbg("the kernel says, that there is no physical device for '%s'", class_dev->path); - return 1; - } - - for (classdevice = class_device; classdevice->subsystem != NULL; classdevice++) { - if (strcmp(class_dev->classname, classdevice->subsystem) == 0) { - /* see if no device in this class is expected to have a device-link */ - if (classdevice->device == NULL) - return 1; - - len = strlen(classdevice->device); - - /* see if device name matches */ - if (strncmp(class_dev->name, classdevice->device, len) != 0) - continue; - - /* exact name match */ - if (strlen(class_dev->name) == len) - return 1; - - /* name match with instance number */ - if (isdigit(class_dev->name[len])) - return 1; - } - } - - return 0; -} - -/* skip waiting for the bus of the devices device */ -static int class_device_expect_no_bus(struct sysfs_class_device *class_dev) -{ - static const char *devices_without_bus[] = { - "scsi_host", - "i2c-adapter", - "i2c-dev", - NULL - }; - const char **device; - - for (device = devices_without_bus; *device != NULL; device++) { - int len = strlen(*device); - - if (strncmp(class_dev->classname, *device, len) == 0) - return 1; - } - - return 0; -} - /* wait for a devices device specific file to show up */ int wait_for_devices_device(struct sysfs_device *devices_dev, const char **error) @@ -335,12 +102,10 @@ int wait_for_devices_device(struct sysfs_device *devices_dev, const struct device_file *devicefile = NULL; int loop; - /* the kernel may tell us what to wait for */ - if (kernel_release_satisfactory(2,6,10) > 0) - if (getenv("PHYSDEVBUS") == NULL) { - dbg("the kernel says, that there is no bus for '%s'", devices_dev->path); - return 0; - } + if (getenv("PHYSDEVBUS") == NULL) { + dbg("the kernel says, that there is no bus for '%s'", devices_dev->path); + return 0; + } /* wait for the bus device link to the devices device */ loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; @@ -421,19 +186,70 @@ struct sysfs_class_device *wait_class_device_open(const char *path) int wait_for_class_device(struct sysfs_class_device *class_dev, const char **error) { + const struct subsystem_file { + const char *subsystem; + const char *file; + } subsystem_files[] = { + { .subsystem = "net", .file = "ifindex" }, + { .subsystem = "scsi_host", .file = "unique_id" }, + { .subsystem = "pcmcia_socket", .file = "card_type" }, + { .subsystem = "bluetooth", .file = "address" }, + { .subsystem = "firmware", .file = "data" }, + { .subsystem = "fc_transport", .file = "port_id" }, + { .subsystem = "fc_host", .file = "port_id" }, + { .subsystem = "spi_transport", .file = "width" }, + { .subsystem = "spi_host", .file = "width" }, + { NULL, NULL } + }; + + const struct subsystem_file *subsys_file; struct sysfs_class_device *class_dev_parent; struct sysfs_device *devices_dev = NULL; + char filename[PATH_SIZE]; int loop; - if (wait_for_class_device_attributes(class_dev, error) != 0) - return -ENOENT; + /* look if we want to wait for a file */ + for (subsys_file = subsystem_files; subsys_file->subsystem != NULL; subsys_file++) + if (strcmp(class_dev->classname, subsys_file->subsystem) == 0) + break; - /* skip devices without devices-link */ - if (class_device_expect_no_device_link(class_dev)) { - dbg("no device symlink expected for '%s', ", class_dev->name); + if (subsys_file->file == NULL) { + dbg("class '%s' has no file to wait for", class_dev->classname); return 0; } + snprintf(filename, sizeof(filename), "%s/%s", class_dev->path, subsys_file->file); + filename[sizeof(filename)-1] = '\0'; + dbg("looking at class '%s' for specific file '%s'", class_dev->classname, filename); + + loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; + while (--loop) { + struct stat stats; + + if (stat(class_dev->path, &stats) == -1) { + dbg("'%s' now disappeared (probably remove has beaten us)", class_dev->path); + return -ENODEV; + } + + if (stat(filename, &stats) == 0) { + dbg("class '%s' specific file '%s' found", class_dev->classname, subsys_file->file); + return 0; + } + + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + + dbg("error: getting class '%s' specific file '%s'", class_dev->classname, subsys_file->file); + if (error) + *error = "class specific file unavailable"; + return -1; + + /* skip devices without devices-link */ + if (getenv("PHYSDEVPATH") == NULL) { + dbg("the kernel says, that there is no physical device for '%s'", class_dev->path); + return 1; + } + /* the symlink may be on the parent device */ class_dev_parent = sysfs_get_classdev_parent(class_dev); if (class_dev_parent) @@ -461,12 +277,6 @@ int wait_for_class_device(struct sysfs_class_device *class_dev, } dbg("device symlink found pointing to '%s'", devices_dev->path); - /* wait for the devices device */ - if (class_device_expect_no_bus(class_dev)) { - dbg("no bus device expected for '%s', ", class_dev->classname); - return 0; - } - return wait_for_devices_device(devices_dev, error); } diff --git a/udev_sysfs.h b/udev_sysfs.h index 8078f62d82..5b87d6bf95 100644 --- a/udev_sysfs.h +++ b/udev_sysfs.h @@ -28,9 +28,8 @@ #define WAIT_LOOP_PER_SECOND 20 extern dev_t get_devt(struct sysfs_class_device *class_dev); -extern int subsystem_expect_no_dev(const char *subsystem); -/* /sys/class /sys/block devices */ +/* /sys/class, /sys/block devices */ extern struct sysfs_class_device *wait_class_device_open(const char *path); extern int wait_for_class_device(struct sysfs_class_device *class_dev, const char **error); diff --git a/udev_utils.c b/udev_utils.c index c7292d0f04..683378aadf 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -57,29 +57,6 @@ int log_priority(const char *priority) return 0; } -int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel) -{ - static unsigned int kversion = 0; - static unsigned int kpatchlevel; - static unsigned int ksublevel; - - if (kversion == 0) { - struct utsname uts; - if (uname(&uts) != 0) - return -1; - - if (sscanf (uts.release, "%u.%u.%u", &kversion, &kpatchlevel, &ksublevel) != 3) { - kversion = 0; - return -1; - } - } - - if (kversion >= version && kpatchlevel >= patchlevel && ksublevel >= sublevel) - return 1; - else - return 0; -} - int name_list_add(struct list_head *name_list, const char *name, int sort) { struct name_entry *loop_name; diff --git a/udev_utils.h b/udev_utils.h index ea39a028f5..ffdaf0469f 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -37,7 +37,6 @@ struct name_entry { /* udev_utils.c */ extern int log_priority(const char *priority); -extern int kernel_release_satisfactory(unsigned int version, unsigned int patchlevel, unsigned int sublevel); extern int name_list_add(struct list_head *name_list, const char *name, int sort); extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); extern void name_list_cleanup(struct list_head *name_list); -- cgit v1.2.3-54-g00ecf From 0c25d156b06259f4d0ba4cfafffc8c64c27a0baf Mon Sep 17 00:00:00 2001 From: Jan Luebbe Date: Mon, 31 Oct 2005 02:10:56 +0100 Subject: add man pages for *_id programs I've written manpages for the *_id binaries, which are attached to this mail. --- extras/ata_id/Makefile | 4 ++-- extras/ata_id/ata_id.8 | 28 ++++++++++++++++++++++++++++ extras/cdrom_id/Makefile | 4 ++-- extras/cdrom_id/cdrom_id.8 | 27 +++++++++++++++++++++++++++ extras/dasd_id/Makefile | 4 ++-- extras/dasd_id/dasd_id.8 | 28 ++++++++++++++++++++++++++++ extras/edd_id/Makefile | 4 ++-- extras/edd_id/edd_id.8 | 27 +++++++++++++++++++++++++++ extras/volume_id/Makefile | 4 ++-- extras/volume_id/vol_id.8 | 41 +++++++++++++++++++++++++++++++++++++++++ 10 files changed, 161 insertions(+), 10 deletions(-) create mode 100644 extras/ata_id/ata_id.8 create mode 100644 extras/cdrom_id/cdrom_id.8 create mode 100644 extras/dasd_id/dasd_id.8 create mode 100644 extras/edd_id/edd_id.8 create mode 100644 extras/volume_id/vol_id.8 diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index fba0d0b719..4080df1b42 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -57,11 +57,11 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - @echo "Please create a man page for this tool." + $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man uninstall-man: - @echo "Please create a man page for this tool." + -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man install-config: diff --git a/extras/ata_id/ata_id.8 b/extras/ata_id/ata_id.8 new file mode 100644 index 0000000000..0ef9e3ed84 --- /dev/null +++ b/extras/ata_id/ata_id.8 @@ -0,0 +1,28 @@ +.TH ATA_ID 8 "November 2005" "" "Linux Administrator's Manual" +.SH NAME +ata_id \- udev callout to read product/serial number from ATA drives +.SH SYNOPSIS +.BI ata_id +[\fI--export\fP] \fIblockdevice\fP +.SH "DESCRIPTION" +.B ata_id +is normally called from a udev rule, to provide udev with a unique string and +additional information (uuid, label) for an ATA drive. Udev can use this +information to create symlinks in /dev/disk/by-id and /dev/disk/by-label +to the real device node. +.SH USAGE +.B ata_id +opens the blockdevice node specified at the commandline and prints the +information chosen by the options. +.SH OPTIONS +The following commandline switches are supported to specify what ata_id +should print: +.TP +.BI --export +print all values (instead of only the id) +.RE +.SH SEE ALSO +.BR udev (8) +.SH AUTHORS +Developed by Kay Sievers . + diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index f06d2c65bf..f1120673e1 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -57,11 +57,11 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - @echo "Please create a man page for this tool." + $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man uninstall-man: - @echo "Please create a man page for this tool." + -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man install-config: diff --git a/extras/cdrom_id/cdrom_id.8 b/extras/cdrom_id/cdrom_id.8 new file mode 100644 index 0000000000..8c95e938cf --- /dev/null +++ b/extras/cdrom_id/cdrom_id.8 @@ -0,0 +1,27 @@ +.TH CDROM_ID 8 "November 2005" "" "Linux Administrator's Manual" +.SH NAME +cdrom_id \- udev callout to determine the capabilities of cd/dvd drives +.SH SYNOPSIS +.BI cdrom_id +[\fI--export\fP] \fIblockdevice\fP +.SH "DESCRIPTION" +.B cdrom_id +is normally called from a udev rule, to provide udev with the capabilities +of a cdrom or dvdrom drive. Udev can use this information to create +symlinks like /dev/cdrom or /dev/dvd to the real device node. +.SH USAGE +.B cdrom_id +opens the blockdevice node specified at the commandline and prints the +discovered capabilities. +.SH OPTIONS +The following commandline switches are supported to specify what cdrom_id +should print: +.TP +.BI --export +print all values (default) +.RE +.SH SEE ALSO +.BR udev (8) +.SH AUTHORS +Developed by Greg Kroah\-Hartman . + diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 698253a9ee..a995c7892d 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -57,11 +57,11 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - @echo "Please create a man page for this tool." + $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man uninstall-man: - @echo "Please create a man page for this tool." + -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man install-config: diff --git a/extras/dasd_id/dasd_id.8 b/extras/dasd_id/dasd_id.8 new file mode 100644 index 0000000000..c3d4075326 --- /dev/null +++ b/extras/dasd_id/dasd_id.8 @@ -0,0 +1,28 @@ +.TH DASD_ID 8 "November 2005" "" "Linux Administrator's Manual" +.SH NAME +dasd_id \- udev callout to read label from s390 block device +.SH SYNOPSIS +.BI dasd_id +[\fI--export\fP] \fIblockdevice\fP +.SH "DESCRIPTION" +.B dasd_id +is normally called from a udev rule, to provide udev with a unique string and +additional information (type, serial) for an S390 drive. Udev can use this +information to create symlinks in /dev/disk/by-id and /dev/disk/by-label +to the real device node. +.SH USAGE +.B dasd_id +opens the blockdevice node specified at the commandline and prints the +information chosen by the options. +.SH OPTIONS +The following commandline switches are supported to specify what dasd_id +should print: +.TP +.BI --export +print all values (instead of only the serial) +.RE +.SH SEE ALSO +.BR udev (8) +.SH AUTHORS +Developed by Arnd Bergmann and Kay Sievers . + diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 65e023f542..469d6d4d03 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -57,11 +57,11 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - @echo "Please create a man page for this tool." + $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man uninstall-man: - @echo "Please create a man page for this tool." + -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man install-config: diff --git a/extras/edd_id/edd_id.8 b/extras/edd_id/edd_id.8 new file mode 100644 index 0000000000..8d5fd4f1aa --- /dev/null +++ b/extras/edd_id/edd_id.8 @@ -0,0 +1,27 @@ +.TH EDD_ID 8 "November 2005" "" "Linux Administrator's Manual" +.SH NAME +edd_id \- udev callout to identify BIOS disk drives via EDD +.SH SYNOPSIS +.BI edd_id +[\fI--export\fP] \fIblockdevice\fP +.SH "DESCRIPTION" +.B edd_id +is normally called from a udev rule, to provide udev with the edd id for +a BIOS disk drive. Udev can use this information to create symlinks in +/dev/disk/by-id and /dev/disk/by-label to the real device node. +.SH USAGE +.B edd_id +opens the blockdevice node specified at the commandline and prints the +information chosen by the options. +.SH OPTIONS +The following commandline switches are supported to specify what edd_id +should print: +.TP +.BI --export +print all values (instead of only the id) +.RE +.SH SEE ALSO +.BR udev (8) +.SH AUTHORS +Developed by John Hull and Kay Sievers . + diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index a936e43bb2..23de2ba091 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -60,11 +60,11 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - @echo "Please create a man page for this tool." + $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man uninstall-man: - @echo "Please create a man page for this tool." + -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man install-config: diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 new file mode 100644 index 0000000000..6ffe7ce220 --- /dev/null +++ b/extras/volume_id/vol_id.8 @@ -0,0 +1,41 @@ +.TH VOL_ID 8 "November 2005" "" "Linux Administrator's Manual" +.SH NAME +vol_id \- probe filesystem type and read label and uuid +.SH SYNOPSIS +.BI vol_id +[\fI--export\fP|\fI-t\fP|\fI-l\fP|\fI-u\fP] \fIblockdevice\fP +.SH "DESCRIPTION" +.B vol_id +is normally called from a udev rule, to provide udev with the +label and uuid of a filesystem. vol_id supports all common +filesystem formats and detects various raid setups to prevent +the recognition of raid members as a filesystem. +.SH USAGE +.B vol_id +opens the device node specified at the commandline. +.SH OPTIONS +The following commandline switches are supported to specify what vol_id +should print: +.TP +.BI --export +print all values in key/value format to import them into the environment. +.TP +.BI -l +print the label of the partition +.TP +.BI -t +print the type of the partition +.TP +.BI -u +print the uuid of the partition +.RE +.SH EXIT STATUS +.B vol_id +will only return successful if the string asked for is not empty. +All trailing whitespace will be removed, spaces replaced by underscore +and slashes ignored. +.SH SEE ALSO +.BR udev (8) +.SH AUTHORS +Developed by Kay Sievers . + -- cgit v1.2.3-54-g00ecf From 7a551dc35580988d13ff8e6e3e37398ac779181a Mon Sep 17 00:00:00 2001 From: Ananth N Mavinakayanahalli Date: Wed, 2 Nov 2005 04:02:33 +0100 Subject: libsysfs: translate devpath of the symlinked class devices to its real path --- libsysfs/sysfs_class.c | 110 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 73 insertions(+), 37 deletions(-) diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c index edf751b124..102f09f17a 100644 --- a/libsysfs/sysfs_class.c +++ b/libsysfs/sysfs_class.c @@ -128,28 +128,45 @@ static void set_classdev_classname(struct sysfs_class_device *cdev) struct sysfs_class_device *sysfs_open_class_device_path(const char *path) { struct sysfs_class_device *cdev; + char temp_path[SYSFS_PATH_MAX]; if (!path) { errno = EINVAL; return NULL; } + + /* + * Post linux-2.6.14 driver model supports nested classes with + * links to the nested hierarchy at /sys/class/xxx/. Check for + * a link to the actual class device if a directory isn't found + */ if (sysfs_path_is_dir(path)) { - dprintf("%s is not a valid path to a class device\n", path); - return NULL; - } + dprintf("%s: Directory not found, checking for a link\n", path); + if (!sysfs_path_is_link(path)) { + if (sysfs_get_link(path, temp_path, SYSFS_PATH_MAX)) { + dprintf("Error retrieving link at %s\n", path); + return NULL; + } + } else { + dprintf("%s is not a valid class device path\n", path); + return NULL; + } + } else + safestrcpy(temp_path, path); + cdev = alloc_class_device(); if (!cdev) { dprintf("calloc failed\n"); return NULL; } - if (sysfs_get_name_from_path(path, cdev->name, SYSFS_NAME_LEN)) { + if (sysfs_get_name_from_path(temp_path, cdev->name, SYSFS_NAME_LEN)) { errno = EINVAL; dprintf("Error getting class device name\n"); sysfs_close_class_device(cdev); return NULL; } - safestrcpy(cdev->path, path); + safestrcpy(cdev->path, temp_path); if (sysfs_remove_trailing_slash(cdev->path)) { dprintf("Invalid path to class device %s\n", cdev->path); sysfs_close_class_device(cdev); @@ -455,12 +472,10 @@ struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *cls, safestrcpy(path, cls->path); safestrcat(path, "/"); safestrcat(path, name); - if (!sysfs_path_is_dir(path)) { - cdev = sysfs_open_class_device_path(path); - if (!cdev) { - dprintf("Error opening class device at %s\n", path); - return NULL; - } + cdev = sysfs_open_class_device_path(path); + if (!cdev) { + dprintf("Error opening class device at %s\n", path); + return NULL; } if (!cls->devices) cls->devices = dlist_new_with_delete @@ -471,6 +486,40 @@ struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *cls, return cdev; } +/** + * Add class devices to list + */ +static void add_cdevs_to_classlist(struct sysfs_class *cls, struct dlist *list) +{ + char path[SYSFS_PATH_MAX], *cdev_name; + struct sysfs_class_device *cdev = NULL; + + if (cls == NULL || list == NULL) + return; + + dlist_for_each_data(list, cdev_name, char) { + if (cls->devices) { + cdev = (struct sysfs_class_device *) + dlist_find_custom(cls->devices, + (void *)cdev_name, cdev_name_equal); + if (cdev) + continue; + } + safestrcpy(path, cls->path); + safestrcat(path, "/"); + safestrcat(path, cdev_name); + cdev = sysfs_open_class_device_path(path); + if (cdev) { + if (!cls->devices) + cls->devices = dlist_new_with_delete + (sizeof(struct sysfs_class_device), + sysfs_close_cls_dev); + dlist_unshift_sorted(cls->devices, cdev, + sort_list); + } + } +} + /** * sysfs_get_class_devices: get all class devices in the given class * @cls: sysfs_class whose devices list is needed @@ -480,42 +529,29 @@ struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *cls, struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) { char path[SYSFS_PATH_MAX]; - char *cdev_name; - struct sysfs_class_device *cdev = NULL; - struct dlist *dirlist; + struct dlist *dirlist, *linklist; if (!cls) { errno = EINVAL; return NULL; } + /* + * Post linux-2.6.14, we have nested classes and links under + * /sys/class/xxx/. are also valid class devices + */ safestrcpy(path, cls->path); dirlist = read_dir_subdirs(path); if (dirlist) { - dlist_for_each_data(dirlist, cdev_name, char) { - if (cls->devices) { - cdev = (struct sysfs_class_device *) - dlist_find_custom(cls->devices, - (void *)cdev_name, cdev_name_equal); - if (cdev) - continue; - } - safestrcpy(path, cls->path); - safestrcat(path, "/"); - safestrcat(path, cdev_name); - cdev = sysfs_open_class_device_path(path); - if (cdev) { - if (!cls->devices) - cls->devices = dlist_new_with_delete - (sizeof(struct sysfs_class_device), - sysfs_close_cls_dev); - dlist_unshift_sorted(cls->devices, cdev, - sort_list); - } - } + add_cdevs_to_classlist(cls, dirlist); sysfs_close_list(dirlist); } - + + linklist = read_dir_links(path); + if (linklist) { + add_cdevs_to_classlist(cls, linklist); + sysfs_close_list(linklist); + } + return cls->devices; } - -- cgit v1.2.3-54-g00ecf From 8ebe9547a81408061ecf3571d31117a18c1810b8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Nov 2005 04:04:19 +0100 Subject: revert the "read symlink as device patch" It's covered by libsysfs now. Signed-off-by: Kay Sievers --- libsysfs/sysfs_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c index bd7f99ae15..c5558a43a1 100644 --- a/libsysfs/sysfs_utils.c +++ b/libsysfs/sysfs_utils.c @@ -233,7 +233,7 @@ int sysfs_path_is_dir(const char *path) errno = EINVAL; return 1; } - if ((stat(path, &astats)) != 0) { + if ((lstat(path, &astats)) != 0) { dprintf("stat() failed\n"); return 1; } -- cgit v1.2.3-54-g00ecf From 0747dd884adfdf2bcd617655c44a87cb7a6eda5f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Nov 2005 04:05:06 +0100 Subject: use libsysfs to translate the class linke to the device path Signed-off-by: Kay Sievers --- udevstart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevstart.c b/udevstart.c index ce96f38879..057d59fcaa 100644 --- a/udevstart.c +++ b/udevstart.c @@ -139,7 +139,7 @@ static int add_device(const char *devpath, const char *subsystem) return -1; } - udev_init_device(&udev, devpath, subsystem, "add"); + udev_init_device(&udev, &class_dev->path[strlen(sysfs_path)], subsystem, "add"); udev.devt = get_devt(class_dev); if (!udev.devt && udev.type != DEV_NET) { dbg("sysfs_open_class_device_path failed"); -- cgit v1.2.3-54-g00ecf From 8687cbfffb3d0c380bd02409dd71e0e8ffe3a3b4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Nov 2005 04:58:59 +0100 Subject: libsysfs: remove brute-force "bus", "driver" searching for old kernels Signed-off-by: Kay Sievers --- libsysfs/sysfs_device.c | 88 ------------------------------------------------- 1 file changed, 88 deletions(-) diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c index 1c59403edd..e3d70143f9 100644 --- a/libsysfs/sysfs_device.c +++ b/libsysfs/sysfs_device.c @@ -29,10 +29,8 @@ */ static int get_dev_driver(struct sysfs_device *dev) { - struct dlist *drvlist; char path[SYSFS_PATH_MAX]; char devpath[SYSFS_PATH_MAX]; - char *drv = NULL, *c; if (!dev) { errno = EINVAL; @@ -50,44 +48,6 @@ static int get_dev_driver(struct sysfs_device *dev) } return 0; } - - /* - * Devices on earlier kernels do not have the "driver" link. - * Look it up in the bus directory. - */ - if (dev->bus[0] == '\0') - return -1; - memset(path, 0, SYSFS_PATH_MAX); - memset(devpath, 0, SYSFS_PATH_MAX); - safestrcpy(path, dev->path); - c = strstr(path, SYSFS_DEVICES_NAME); - if (c == NULL) { - dprintf("Invalid path to device - %s\n", dev->path); - return -1; - } else - *c = '\0'; - safestrcat(path, SYSFS_BUS_NAME); - safestrcat(path, "/"); - safestrcat(path, dev->bus); - safestrcat(path, "/"); - safestrcat(path, SYSFS_DRIVERS_NAME); - - drvlist = sysfs_open_directory_list(path); - if (drvlist) { - dlist_for_each_data(drvlist, drv, char) { - safestrcpy(devpath, path); - safestrcat(devpath, "/"); - safestrcat(devpath, drv); - safestrcat(devpath, "/"); - safestrcat(devpath, dev->bus_id); - if (!sysfs_path_is_link(devpath)) { - safestrcpy(dev->driver_name, drv); - sysfs_close_list(drvlist); - return 0; - } - } - sysfs_close_list(drvlist); - } return -1; } @@ -100,11 +60,7 @@ static int get_dev_driver(struct sysfs_device *dev) int sysfs_get_device_bus(struct sysfs_device *dev) { char devpath[SYSFS_PATH_MAX]; - char subsys[SYSFS_NAME_LEN]; char path[SYSFS_PATH_MAX]; - char target[SYSFS_PATH_MAX]; - char *bus = NULL, *c; - struct dlist *buslist; if (!dev) { errno = EINVAL; @@ -123,49 +79,6 @@ int sysfs_get_device_bus(struct sysfs_device *dev) } return 0; } - - /* - * Devices on on earlier kernels do not have the "bus" link. - * Look it up in the bus directory. - */ - memset(subsys, 0, SYSFS_NAME_LEN); - safestrcpy(subsys, dev->path); - c = strstr(subsys, SYSFS_DEVICES_NAME); - if (c == NULL) { - dprintf("Invalid path to device - %s\n", dev->path); - return -1; - } else - *c = '\0'; - safestrcat(subsys, SYSFS_BUS_NAME); - buslist = sysfs_open_directory_list(subsys); - if (buslist) { - dlist_for_each_data(buslist, bus, char) { - memset(path, 0, SYSFS_PATH_MAX); - safestrcpy(path, subsys); - safestrcat(path, "/"); - safestrcat(path, bus); - safestrcat(path, "/"); - safestrcat(path, SYSFS_DEVICES_NAME); - safestrcat(path, "/"); - safestrcat(path, dev->bus_id); - if (!sysfs_path_is_link(path)) { - memset(target, 0, SYSFS_PATH_MAX); - if (sysfs_get_link(path, target, - SYSFS_PATH_MAX)) { - dprintf("Error getting link target\n"); - sysfs_close_list(buslist); - return -1; - } - if (!(strncmp(target, dev->path, - SYSFS_PATH_MAX))) { - safestrcpy(dev->bus, bus); - sysfs_close_list(buslist); - return 0; - } - } - } - sysfs_close_list(buslist); - } return -1; } @@ -371,7 +284,6 @@ struct sysfs_device *sysfs_open_device(const char *bus, const char *bus_id) dprintf("Error opening device %s\n", bus_id); return NULL; } - return device; } -- cgit v1.2.3-54-g00ecf From 6d33ed73741ad4108dc1a540defb851418a04013 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Nov 2005 05:08:22 +0100 Subject: test: add "driver" and "bus" links to test sysfs tree Signed-off-by: Kay Sievers --- test/sys/block/cciss!c0d0/device | 2 +- test/sys/block/rd!c0d0/device | 2 +- test/sys/block/sda/device | 2 +- test/sys/bus/scsi/devices/0:0:0:0 | 2 +- test/sys/bus/scsi/drivers/sd/0:0:0:0 | 2 +- test/sys/devices/pci0000:00/0000:00:09.0/bus | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/driver | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/driver | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/driver | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/driver | 1 + .../pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked | 1 - .../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model | 1 - .../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level | 1 - .../sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type | 1 - .../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/whitespace_test | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus | 1 + .../0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/device_blocked | 1 + .../0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/driver | 1 + .../0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/model | 1 + .../0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/online | 1 + .../0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/queue_depth | 1 + .../pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/rev | 1 + .../0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/scsi_level | 1 + .../pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/type | 1 + .../0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor | 1 + .../0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/whitespace_test | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/bus | 1 + 38 files changed, 29 insertions(+), 14 deletions(-) create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/whitespace_test create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/device_blocked create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/model create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/online create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/queue_depth create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/rev create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/scsi_level create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/whitespace_test create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/bus diff --git a/test/sys/block/cciss!c0d0/device b/test/sys/block/cciss!c0d0/device index 2d78258b1a..485bf09f61 120000 --- a/test/sys/block/cciss!c0d0/device +++ b/test/sys/block/cciss!c0d0/device @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/rd!c0d0/device b/test/sys/block/rd!c0d0/device index 2d78258b1a..485bf09f61 120000 --- a/test/sys/block/rd!c0d0/device +++ b/test/sys/block/rd!c0d0/device @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/sda/device b/test/sys/block/sda/device index 2d78258b1a..485bf09f61 120000 --- a/test/sys/block/sda/device +++ b/test/sys/block/sda/device @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file +../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/0:0:0:0 b/test/sys/bus/scsi/devices/0:0:0:0 index ebb65b3bac..6d8555dce1 120000 --- a/test/sys/bus/scsi/devices/0:0:0:0 +++ b/test/sys/bus/scsi/devices/0:0:0:0 @@ -1 +1 @@ -../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file +../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/0:0:0:0 b/test/sys/bus/scsi/drivers/sd/0:0:0:0 index 239003f712..97ae02167d 120000 --- a/test/sys/bus/scsi/drivers/sd/0:0:0:0 +++ b/test/sys/bus/scsi/drivers/sd/0:0:0:0 @@ -1 +1 @@ -../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0 \ No newline at end of file +../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/bus b/test/sys/devices/pci0000:00/0000:00:09.0/bus new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/bus @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver new file mode 120000 index 0000000000..5cf493442c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/driver new file mode 120000 index 0000000000..27eb850ee4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/driver @@ -0,0 +1 @@ +../../../../../../bus/usb/drivers/pl2303 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/driver new file mode 120000 index 0000000000..092d2282f3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus new file mode 120000 index 0000000000..dd0c04b01d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus @@ -0,0 +1 @@ +../../../../../../bus/usb-serial \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus new file mode 120000 index 0000000000..77682faf80 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus @@ -0,0 +1 @@ +../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/driver new file mode 120000 index 0000000000..0b3eba3d91 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/driver @@ -0,0 +1 @@ +../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus new file mode 120000 index 0000000000..d6210992bb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus @@ -0,0 +1 @@ +../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/driver b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/driver new file mode 120000 index 0000000000..f6536ff545 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/driver @@ -0,0 +1 @@ +../../../../bus/pci/drivers/aic7xxx \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/device_blocked +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model deleted file mode 100644 index 392039b199..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/model +++ /dev/null @@ -1 +0,0 @@ -ST336605LW !# diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/online +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/queue_depth +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev deleted file mode 100644 index 65dd514497..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/rev +++ /dev/null @@ -1 +0,0 @@ -B245 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/scsi_level +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor deleted file mode 100644 index d87b2a5c0b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/vendor +++ /dev/null @@ -1 +0,0 @@ -IBM-ESXS diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/whitespace_test b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/whitespace_test deleted file mode 100644 index e3d48f0fe0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/0:0:0:0/whitespace_test +++ /dev/null @@ -1 +0,0 @@ -WHITE SPACE diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus new file mode 120000 index 0000000000..2edcea4660 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus @@ -0,0 +1 @@ +../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/device_blocked new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/device_blocked @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/driver b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/driver new file mode 120000 index 0000000000..5fbbc0f385 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/driver @@ -0,0 +1 @@ +../../../../../../../bus/scsi/drivers/sd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/model new file mode 100644 index 0000000000..392039b199 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/model @@ -0,0 +1 @@ +ST336605LW !# diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/online b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/online new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/online @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/queue_depth new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/queue_depth @@ -0,0 +1 @@ +32 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/rev new file mode 100644 index 0000000000..65dd514497 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/rev @@ -0,0 +1 @@ +B245 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/scsi_level new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/scsi_level @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor new file mode 100644 index 0000000000..d87b2a5c0b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor @@ -0,0 +1 @@ +IBM-ESXS diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/whitespace_test b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/whitespace_test new file mode 100644 index 0000000000..e3d48f0fe0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/whitespace_test @@ -0,0 +1 @@ +WHITE SPACE diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/bus b/test/sys/devices/pci0000:00/0000:00:1e.0/bus new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/bus @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file -- cgit v1.2.3-54-g00ecf From ce364175b275834077b97fa79e1969e736b6e551 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Nov 2005 05:47:18 +0100 Subject: update RELEASE-NOTES Signed-off-by: Kay Sievers --- RELEASE-NOTES | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 39e72d474d..0cd11d6bb6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -5,7 +5,12 @@ event processes inherit the already parsed rules from the daemon. It is shipped with SUSE10.0 and reduces heavily the system load at startup. -using 'make STRIPCMD=' will leave the binaries unstripped for debugging +Kernel 2.6.15 will have symlinks at /class/input pointing to the real +device. Libsysfs is changed to "translate" the requested link into the +real device path, as it would happen with the hotplug event. Otherwise +device removal and the udev database will not work. + +Using 'make STRIPCMD=' will leave the binaries unstripped for debugging and packaging. A few improvements for vol_id, the filesytem probing code. -- cgit v1.2.3-54-g00ecf From 833b3c680b23dab87ba4918f25fbd5775dfd9ba8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 4 Nov 2005 05:25:15 +0100 Subject: udevd: don't daemonize before initialization Move socket init and rule parsing before forking, so we can start emitting event immediately after udevd has started. Signed-off-by: Kay Sievers --- udevd.c | 80 ++++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 42 insertions(+), 38 deletions(-) diff --git a/udevd.c b/udevd.c index 1f769fbce0..c49cf292cf 100644 --- a/udevd.c +++ b/udevd.c @@ -211,11 +211,10 @@ static void udev_event_run(struct uevent_msg *msg) switch (pid) { case 0: /* child */ - if (uevent_netlink_sock > 0) - close(uevent_netlink_sock); + close(uevent_netlink_sock); + close(udevd_sock); if (inotify_fd > 0) close(inotify_fd); - close(udevd_sock); close(signal_pipe[READ_END]); close(signal_pipe[WRITE_END]); logging_close(); @@ -773,7 +772,6 @@ static int init_udevd_socket(void) retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { err("bind failed, %s", strerror(errno)); - close(udevd_sock); return -1; } @@ -803,15 +801,13 @@ static int init_uevent_netlink_sock(void) /* set receive buffersize */ setsockopt(uevent_netlink_sock, SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize)); - retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, - sizeof(struct sockaddr_nl)); + retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { err("bind failed, %s", strerror(errno)); close(uevent_netlink_sock); uevent_netlink_sock = -1; return -1; } - return 0; } @@ -825,10 +821,11 @@ int main(int argc, char *argv[], char *envp[]) int uevent_netlink_active = 0; int daemonize = 0; int i; + int rc = 0; - /* set std fd's to /dev/null, if the kernel forks us, we don't have them at all */ + /* redirect std fd's, if the kernel forks us, we don't have them at all */ devnull = open("/dev/null", O_RDWR); - if (devnull >= 0) { + if (devnull >= 0) { if (devnull != STDIN_FILENO) dup2(devnull, STDIN_FILENO); if (devnull != STDOUT_FILENO) @@ -851,6 +848,7 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + /* parse commandline options */ for (i = 1 ; i < argc; i++) { char *arg = argv[i]; if (strcmp(arg, "--daemon") == 0 || strcmp(arg, "-d") == 0) { @@ -863,30 +861,52 @@ int main(int argc, char *argv[], char *envp[]) } } + /* init sockets to receive events */ + if (init_udevd_socket() < 0) { + if (errno == EADDRINUSE) { + dbg("another udevd running, exit"); + rc = 1; + } else { + dbg("error initializing udevd socket: %s", strerror(errno)); + rc = 2; + } + goto exit; + } + + if (init_uevent_netlink_sock() < 0) { + err("uevent socket not available"); + rc = 3; + goto exit; + } + + /* parse the rules and keep it in memory */ + udev_rules_init(&rules, 0, 1); + if (daemonize) { pid_t pid; pid = fork(); switch (pid) { case 0: - dbg("damonized fork running"); + dbg("daemonized fork running"); + + /* become session leader */ + sid = setsid(); + dbg("our session is %d", sid); + + chdir("/"); + umask(umask(077) | 022); break; case -1: err("fork of daemon failed"); + rc = 4; goto exit; default: - logging_close(); - exit(0); + dbg("child [%u] running, parent exits", pid); + goto exit; } } - /* become session leader */ - sid = setsid(); - dbg("our session is %d", sid); - - chdir("/"); - umask(umask(077) | 022); - /* set a reasonable scheduling priority for the daemon */ setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); @@ -918,21 +938,6 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGCHLD, &act, NULL); sigaction(SIGHUP, &act, NULL); - /* parse the rules and keep it in memory */ - udev_rules_init(&rules, 0, 1); - - if (init_udevd_socket() < 0) { - if (errno == EADDRINUSE) - dbg("another udevd running, exit"); - else - dbg("error initializing udevd socket: %s", strerror(errno)); - - goto exit; - } - - if (init_uevent_netlink_sock() < 0) - err("uevent socket not available"); - /* watch rules directory */ inotify_fd = inotify_init(); if (inotify_fd > 0) @@ -983,8 +988,7 @@ int main(int argc, char *argv[], char *envp[]) FD_ZERO(&readfds); FD_SET(signal_pipe[READ_END], &readfds); FD_SET(udevd_sock, &readfds); - if (uevent_netlink_sock > 0) - FD_SET(uevent_netlink_sock, &readfds); + FD_SET(uevent_netlink_sock, &readfds); if (inotify_fd > 0) FD_SET(inotify_fd, &readfds); @@ -1009,7 +1013,7 @@ int main(int argc, char *argv[], char *envp[]) } /* get kernel netlink message */ - if ((uevent_netlink_sock > 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { + if (FD_ISSET(uevent_netlink_sock, &readfds)) { msg = get_netlink_msg(); if (msg) { msg_queue_insert(msg); @@ -1096,5 +1100,5 @@ exit: logging_close(); - return 0; + return rc; } -- cgit v1.2.3-54-g00ecf From 57d782bf1e8313e65579a8faa9671a8e5ffecb2f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Nov 2005 16:22:14 +0100 Subject: log to console if syslog is not available Signed-off-by: Kay Sievers --- logging.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logging.h b/logging.h index e0dcb80305..dd520dd874 100644 --- a/logging.h +++ b/logging.h @@ -61,7 +61,7 @@ extern void log_message(int priority, const char *format, ...) #undef logging_init static inline void logging_init(const char *program_name) { - openlog(program_name, LOG_PID, LOG_DAEMON); + openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); } #undef logging_close -- cgit v1.2.3-54-g00ecf From 3904a7581776cffc7ddaf4adbfbea8a57ab1adaa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Nov 2005 19:41:00 +0100 Subject: udevd: disable OOM Signed-off-by: Kay Sievers --- udevd.c | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/udevd.c b/udevd.c index c49cf292cf..e2514e5947 100644 --- a/udevd.c +++ b/udevd.c @@ -814,7 +814,7 @@ static int init_uevent_netlink_sock(void) int main(int argc, char *argv[], char *envp[]) { int retval; - int devnull; + int fd; struct sigaction act; fd_set readfds; const char *value; @@ -824,20 +824,20 @@ int main(int argc, char *argv[], char *envp[]) int rc = 0; /* redirect std fd's, if the kernel forks us, we don't have them at all */ - devnull = open("/dev/null", O_RDWR); - if (devnull >= 0) { - if (devnull != STDIN_FILENO) - dup2(devnull, STDIN_FILENO); - if (devnull != STDOUT_FILENO) - dup2(devnull, STDOUT_FILENO); - if (devnull != STDERR_FILENO) - dup2(devnull, STDERR_FILENO); - if (devnull > STDERR_FILENO) - close(devnull); + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + if (fd != STDIN_FILENO) + dup2(fd, STDIN_FILENO); + if (fd != STDOUT_FILENO) + dup2(fd, STDOUT_FILENO); + if (fd != STDERR_FILENO) + dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) + close(fd); } logging_init("udevd"); - if (devnull < 0) + if (fd < 0) err("fatal, could not open /dev/null"); udev_init_config(); @@ -889,13 +889,6 @@ int main(int argc, char *argv[], char *envp[]) switch (pid) { case 0: dbg("daemonized fork running"); - - /* become session leader */ - sid = setsid(); - dbg("our session is %d", sid); - - chdir("/"); - umask(umask(077) | 022); break; case -1: err("fork of daemon failed"); @@ -907,9 +900,25 @@ int main(int argc, char *argv[], char *envp[]) } } - /* set a reasonable scheduling priority for the daemon */ + /* set scheduling priority for the daemon */ setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); + chdir("/"); + umask(077); + + /* become session leader */ + sid = setsid(); + dbg("our session is %d", sid); + + /* OOM_DISABLE == -17 */ + fd = open("/proc/self/oom_adj", O_RDWR); + if (fd < 0) + err("error disabling OOM"); + else { + write(fd, "-17", 3); + close(fd); + } + /* setup signal handler pipe */ retval = pipe(signal_pipe); if (retval < 0) { -- cgit v1.2.3-54-g00ecf From 287814b23cd564043391ce449f27e6ccd9d244e4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Nov 2005 20:00:31 +0100 Subject: remove precompiled rules option It was a workaround for speed up udev "coldplug", where ~800 events happened a second time during bootup. No need for it with the rules aleady parsed in the daemon. Signed-off-by: Kay Sievers --- Makefile | 1 - udev.c | 2 +- udev_rules.h | 3 +- udev_rules_parse.c | 36 ++------------------ udevd.c | 4 +-- udevrulescompile.c | 97 ------------------------------------------------------ udevstart.c | 2 +- udevtest.c | 2 +- 8 files changed, 8 insertions(+), 139 deletions(-) delete mode 100644 udevrulescompile.c diff --git a/Makefile b/Makefile index 8446eee924..4f6d3da983 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,6 @@ PROGRAMS = \ udev \ udevd \ udevsend \ - udevrulescompile \ udevinitsend \ udeveventrecorder \ udevcontrol \ diff --git a/udev.c b/udev.c index 926c4b526a..aab9f015fb 100644 --- a/udev.c +++ b/udev.c @@ -132,7 +132,7 @@ int main(int argc, char *argv[], char *envp[]) } udev_init_device(&udev, devpath, subsystem, action); - udev_rules_init(&rules, 1, 0); + udev_rules_init(&rules, 0); retval = udev_process_event(&rules, &udev); diff --git a/udev_rules.h b/udev_rules.h index be13378e4e..6d9d306ded 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -100,11 +100,10 @@ struct udev_rules { char *buf; size_t bufsize; size_t current; - int mapped; int resolve_names; }; -extern int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_names); +extern int udev_rules_init(struct udev_rules *rules, int resolve_names); extern void udev_rules_close(struct udev_rules *rules); extern void udev_apply_format(struct udevice *udev, char *string, size_t maxsize, diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 7d1853acbe..6e978d74b4 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -591,42 +591,14 @@ static int parse_file(struct udev_rules *rules, const char *filename) return retval; } -static int rules_map(struct udev_rules *rules, const char *filename) +int udev_rules_init(struct udev_rules *rules, int resolve_names) { - if (file_map(filename, &rules->buf, &rules->bufsize)) { - rules->buf = NULL; - return -1; - } - if (rules->bufsize == 0) { - file_unmap(rules->buf, rules->bufsize); - rules->buf = NULL; - return -1; - } - rules->mapped = 1; - - return 0; -} - -int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_names) -{ - char comp[PATH_SIZE]; struct stat stats; int retval; memset(rules, 0x00, sizeof(struct udev_rules)); rules->resolve_names = resolve_names; - /* check for precompiled rules */ - if (read_compiled) { - strlcpy(comp, udev_rules_filename, sizeof(comp)); - strlcat(comp, ".compiled", sizeof(comp)); - if (stat(comp, &stats) == 0) { - dbg("map compiled rules '%s'", comp); - if (rules_map(rules, comp) == 0) - return 0; - } - } - /* parse rules file or all matching files in directory */ if (stat(udev_rules_filename, &stats) != 0) return -1; @@ -660,11 +632,7 @@ int udev_rules_init(struct udev_rules *rules, int read_compiled, int resolve_nam void udev_rules_close(struct udev_rules *rules) { if (rules->buf) { - if (rules->mapped) { - rules->mapped = 0; - file_unmap(rules->buf, rules->bufsize); - } else - free(rules->buf); + free(rules->buf); rules->buf = NULL; } } diff --git a/udevd.c b/udevd.c index e2514e5947..154c370589 100644 --- a/udevd.c +++ b/udevd.c @@ -880,7 +880,7 @@ int main(int argc, char *argv[], char *envp[]) } /* parse the rules and keep it in memory */ - udev_rules_init(&rules, 0, 1); + udev_rules_init(&rules, 1); if (daemonize) { pid_t pid; @@ -1065,7 +1065,7 @@ int main(int argc, char *argv[], char *envp[]) if (reload_config) { reload_config = 0; udev_rules_close(&rules); - udev_rules_init(&rules, 0, 1); + udev_rules_init(&rules, 1); } /* forked child have returned */ diff --git a/udevrulescompile.c b/udevrulescompile.c deleted file mode 100644 index a2c5f2e9fc..0000000000 --- a/udevrulescompile.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * udevrulescompile.c - store already parsed config on disk - * - * Copyright (C) 2005 Kay Sievers - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include - -#include "udev_libc_wrapper.h" -#include "udev_sysfs.h" -#include "udev.h" -#include "udev_version.h" -#include "logging.h" -#include "udev_rules.h" -#include "udev_utils.h" -#include "list.h" - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) -{ - struct udev_rules rules; - FILE *f; - char comp[PATH_SIZE]; - char comp_tmp[PATH_SIZE]; - int retval = 0; - - logging_init("udevrulescompile"); - udev_init_config(); - dbg("version %s", UDEV_VERSION); - - strlcpy(comp, udev_rules_filename, sizeof(comp)); - strlcat(comp, ".compiled", sizeof(comp)); - strlcpy(comp_tmp, comp, sizeof(comp_tmp)); - strlcat(comp_tmp, ".tmp", sizeof(comp_tmp)); - - /* remove old version, otherwise we would read it instead of the real rules */ - unlink(comp); - unlink(comp_tmp); - - udev_rules_init(&rules, 0, 1); - - f = fopen(comp_tmp, "w"); - if (f == NULL) { - err("unable to create db file '%s'", comp_tmp); - unlink(comp_tmp); - retval = 1; - goto exit; - } - - dbg("storing compiled rules in '%s' size=%zi", comp_tmp, rules.bufsize); - fwrite(rules.buf, rules.bufsize, 1, f); - fclose(f); - - dbg("activating compiled rules in '%s'", comp); - if (rename(comp_tmp, comp) != 0) { - err("unable to write file"); - unlink(comp); - unlink(comp_tmp); - retval = 2; - } - -exit: - logging_close(); - return retval; -} diff --git a/udevstart.c b/udevstart.c index 057d59fcaa..8ee079dbe5 100644 --- a/udevstart.c +++ b/udevstart.c @@ -364,7 +364,7 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timeout to prevent hanging processes */ alarm(UDEV_ALARM_TIMEOUT); - udev_rules_init(&rules, 0, 1); + udev_rules_init(&rules, 1); udev_scan_class(&device_list); udev_scan_block(&device_list); diff --git a/udevtest.c b/udevtest.c index 6e973e31e6..4890b6837c 100644 --- a/udevtest.c +++ b/udevtest.c @@ -92,7 +92,7 @@ int main(int argc, char *argv[], char *envp[]) info("looking at device '%s' from subsystem '%s'", devpath, subsystem); /* initialize the naming deamon */ - udev_rules_init(&rules, 0, 0); + udev_rules_init(&rules, 0); /* fill in values and test_run flag*/ udev_init_device(&udev, devpath, subsystem, "add"); -- cgit v1.2.3-54-g00ecf From 31819a1e32fbd249264fbe089270d832b4987d39 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Nov 2005 20:32:20 +0100 Subject: export DEVNAME on "remove" only if we really got a node to remove Signed-off-by: Kay Sievers --- udev_remove.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/udev_remove.c b/udev_remove.c index cff940ccfe..0d536bc8ff 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -112,6 +112,10 @@ static int delete_node(struct udevice *udev) if (retval) return retval; + /* export DEVNAME to the environment */ + snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); + udev->devname[sizeof(udev->devname)-1] = '\0'; + num = udev->partitions; if (num > 0) { info("removing all_partitions '%s[1-%i]'", filename, num); @@ -152,9 +156,6 @@ int udev_remove_device(struct udevice *udev) dbg("'%s' not found in database, using kernel name '%s'", udev->devpath, udev->kernel_name); strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); } - /* use full path to the environment */ - snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); - udev->devname[sizeof(udev->devname)-1] = '\0'; return delete_node(udev); } -- cgit v1.2.3-54-g00ecf From 74adec7d97f463bfe441996b8997cdea213a087d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Nov 2005 22:02:21 +0100 Subject: fix typo in umask() Signed-off-by: Kay Sievers --- udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevd.c b/udevd.c index 154c370589..64a6f4d002 100644 --- a/udevd.c +++ b/udevd.c @@ -904,7 +904,7 @@ int main(int argc, char *argv[], char *envp[]) setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); chdir("/"); - umask(077); + umask(022); /* become session leader */ sid = setsid(); -- cgit v1.2.3-54-g00ecf From 1ad45a47cae79a80bb9c9ff287dc46c18b2ddc71 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Nov 2005 22:05:35 +0100 Subject: 072 release --- ChangeLog | 45 +++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 3 ++- 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cc20111553..4964d782fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,48 @@ +Summary of changes from v71 to v072 +============================================ + +Ananth N Mavinakayanahalli: + libsysfs: translate devpath of the symlinked class devices to its real path + +Jan Luebbe: + add man pages for *_id programs + +Kay Sievers: + volume_id: add OCFS Version 1 + volume_id: add Veritas fs + volume_id: check ext fs for valid blocksize, cause magic is only 2 bytes + volume_id: move blocksize validation to fix jbd recognition + volume_id: fix typo in ocfs + volume_id: add vxfs include + volume_id: make FAT32 recognition more robust + volume_id: Version 051 + volume_id: fix typo in ext blocksize check + volume_id: Version 052 + FAQ: remove confusing statement about module loading + cleanup compiler/linker flags + use DESTDIR on uninstall, no need to pass prefix to submake + allow to pass STRIPCMD, to skip stripping of binaries + cleanup make release + fix the new warnings I asked for + move rules parsing into daemon + "make STRIPCMD=" will disable the stripping of binaries + remove no longer working udevd-test program + "STRIPCMD=" for the EXTRAS + add dummy inotify syscalls on unsupported architecture + remove no longer needed waiting for "dev" file + revert the "read symlink as device patch" + use libsysfs to translate the class linke to the device path + libsysfs: remove brute-force "bus", "driver" searching for old kernels + test: add "driver" and "bus" links to test sysfs tree + update RELEASE-NOTES + udevd: don't daemonize before initialization + log to console if syslog is not available + udevd: disable OOM + remove precompiled rules option + export DEVNAME on "remove" only if we really got a node to remove + fix typo in umask() + + Summary of changes from v70 to v071 ============================================ diff --git a/Makefile b/Makefile index 4f6d3da983..8d280acd48 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 071 +VERSION = 072 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0cd11d6bb6..087403d56f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -3,7 +3,8 @@ udev 072 The rule parsing happens now in the daemon once at startup, all udev event processes inherit the already parsed rules from the daemon. It is shipped with SUSE10.0 and reduces heavily the system load at -startup. +startup. The option to save precompiled rules and let the udev process +pick the them up is removed, as it's no longer needed. Kernel 2.6.15 will have symlinks at /class/input pointing to the real device. Libsysfs is changed to "translate" the requested link into the -- cgit v1.2.3-54-g00ecf From 0b3dfb3d72e1df5f38ecb9669e37e5e77d958343 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2005 02:22:44 +0100 Subject: udevd: depend on netlink and remove all sequence reorder logic Netlink will never get out-of-order and we just depend on it from now on. Udevsend messages will have no effect if they contain a sequence number (SEQNUM). Thanks to Bastian Blank , for the debugging session which identified a bug where the timeouts are not working if inotify was not available. All the timeout handling is removed now and this issue should be solved. Signed-off-by: Kay Sievers --- Makefile | 1 - udev.h | 2 +- udevd.c | 185 ++++++------------------------------------------------------- udevd.h | 9 +-- udevsend.c | 31 +---------- 5 files changed, 23 insertions(+), 205 deletions(-) diff --git a/Makefile b/Makefile index 8d280acd48..afa649e522 100644 --- a/Makefile +++ b/Makefile @@ -270,7 +270,6 @@ udev_version.h: @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ - @echo \#define UDEV_BIN \"$(sbindir)/udev\" >> $@ @echo \#define UDEVD_BIN \"$(sbindir)/udevd\" >> $@ # man pages diff --git a/udev.h b/udev.h index 66edfd66bf..ecc0a44f91 100644 --- a/udev.h +++ b/udev.h @@ -36,7 +36,7 @@ #define VALUE_SIZE 128 #define DEFAULT_PARTITIONS_COUNT 15 -#define UDEV_ALARM_TIMEOUT 120 +#define UDEV_ALARM_TIMEOUT 180 struct udev_rules; diff --git a/udevd.c b/udevd.c index 64a6f4d002..dcf5781812 100644 --- a/udevd.c +++ b/udevd.c @@ -31,16 +31,14 @@ #include #include #include +#include #include #include -#include #include #include #include -#include #include #include -#include #include #include "list.h" @@ -61,19 +59,14 @@ static pid_t sid; static int signal_pipe[2] = {-1, -1}; static volatile int sigchilds_waiting; -static volatile int run_msg_q; static volatile int udev_exit; static volatile int reload_config; -static int init_phase = 1; static int run_exec_q; static int stop_exec_q; -static int event_timeout; static int max_childs; static int max_childs_running; -static unsigned long long expected_seqnum; static char udev_log[32]; -static LIST_HEAD(msg_list); static LIST_HEAD(exec_list); static LIST_HEAD(running_list); @@ -92,14 +85,11 @@ void log_message(int priority, const char *format, ...) } #endif -static void msg_dump_queue(void) +static void msg_queue_insert(struct uevent_msg *msg) { -#ifdef DEBUG - struct uevent_msg *msg; - - list_for_each_entry(msg, &msg_list, node) - dbg("sequence %llu in queue", msg->seqnum); -#endif + list_add(&msg->node, &exec_list); + msg->queue_time = time(NULL); + run_exec_q = 1; } static void msg_queue_delete(struct uevent_msg *msg) @@ -108,53 +98,6 @@ static void msg_queue_delete(struct uevent_msg *msg) free(msg); } -/* orders the message in the queue by sequence number */ -static void msg_queue_insert(struct uevent_msg *msg) -{ - struct uevent_msg *loop_msg; - struct sysinfo info; - - if (msg->seqnum == 0) { - dbg("no SEQNUM, move straight to the exec queue"); - list_add_tail(&msg->node, &exec_list); - run_exec_q = 1; - return; - } - - /* store timestamp of queuing */ - sysinfo(&info); - msg->queue_time = info.uptime; - - /* with the first event we provide a phase of shorter timeout */ - if (init_phase) { - static long init_time; - - if (init_time == 0) - init_time = info.uptime; - if (info.uptime - init_time >= UDEVD_INIT_TIME) - init_phase = 0; - } - - /* sort message by sequence number into list */ - list_for_each_entry_reverse(loop_msg, &msg_list, node) { - if (loop_msg->seqnum < msg->seqnum) - break; - - if (loop_msg->seqnum == msg->seqnum) { - dbg("ignoring duplicate message seq %llu", msg->seqnum); - free(msg); - return; - } - } - list_add(&msg->node, &loop_msg->node); - info("seq %llu queued, '%s' '%s'", msg->seqnum, msg->action, msg->devpath); - - /* run msg queue manager */ - run_msg_q = 1; - - return; -} - static void asmlinkage udev_event_sig_handler(int signum) { if (signum == SIGALRM) @@ -205,7 +148,6 @@ static int udev_event_process(struct uevent_msg *msg) static void udev_event_run(struct uevent_msg *msg) { pid_t pid; - struct sysinfo info; pid = fork(); switch (pid) { @@ -232,9 +174,8 @@ static void udev_event_run(struct uevent_msg *msg) break; default: /* get SIGCHLD in main loop */ - sysinfo(&info); info("seq %llu forked, pid [%d], '%s' '%s', %ld seconds old", - msg->seqnum, pid, msg->action, msg->subsystem, info.uptime - msg->queue_time); + msg->seqnum, pid, msg->action, msg->subsystem, time(NULL) - msg->queue_time); msg->pid = pid; } } @@ -436,61 +377,6 @@ static void exec_queue_manager(void) } } -static void msg_move_exec(struct uevent_msg *msg) -{ - list_move_tail(&msg->node, &exec_list); - run_exec_q = 1; - expected_seqnum = msg->seqnum+1; - dbg("moved seq %llu to exec, next expected is %llu", - msg->seqnum, expected_seqnum); -} - -/* msg queue management routine handles the timeouts and dispatches the events */ -static void msg_queue_manager(void) -{ - struct uevent_msg *loop_msg; - struct uevent_msg *tmp_msg; - struct sysinfo info; - long msg_age = 0; - int timeout = event_timeout; - - dbg("msg queue manager, next expected is %llu", expected_seqnum); -recheck: - sysinfo(&info); - list_for_each_entry_safe(loop_msg, tmp_msg, &msg_list, node) { - /* move event with expected sequence to the exec list */ - if (loop_msg->seqnum == expected_seqnum) { - msg_move_exec(loop_msg); - continue; - } - - /* limit timeout during initialization phase */ - if (init_phase) { - if (timeout > UDEVD_INIT_EVENT_TIMEOUT) - timeout = UDEVD_INIT_EVENT_TIMEOUT; - dbg("initialization phase, timeout %i seconds", timeout); - } - - /* move event with expired timeout to the exec list */ - msg_age = info.uptime - loop_msg->queue_time; - dbg("seq %llu is %li seconds old", loop_msg->seqnum, msg_age); - if (msg_age >= timeout) { - msg_move_exec(loop_msg); - goto recheck; - } else - break; - } - - msg_dump_queue(); - - /* set timeout for remaining queued events */ - if (!list_empty(&msg_list)) { - struct itimerval itv = {{0, 0}, {timeout - msg_age, 0}}; - info("next event expires in %li seconds", timeout - msg_age); - setitimer(ITIMER_REAL, &itv, NULL); - } -} - static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) { int bufpos; @@ -691,10 +577,6 @@ static void asmlinkage sig_handler(int signum) case SIGTERM: udev_exit = 1; break; - case SIGALRM: - /* set flag, then write to pipe if needed */ - run_msg_q = 1; - break; case SIGCHLD: /* set flag, then write to pipe if needed */ sigchilds_waiting = 1; @@ -712,13 +594,11 @@ static void udev_done(int pid) { /* find msg associated with pid and delete it */ struct uevent_msg *msg; - struct sysinfo info; list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { - sysinfo(&info); if (msg->queue_time) - info("seq %llu, pid [%d] exit, %ld seconds old", msg->seqnum, msg->pid, info.uptime - msg->queue_time); + info("seq %llu, pid [%d] exit, %ld seconds old", msg->seqnum, msg->pid, time(NULL) - msg->queue_time); else info("seq 0, pid [%d] exit", msg->pid); msg_queue_delete(msg); @@ -818,10 +698,10 @@ int main(int argc, char *argv[], char *envp[]) struct sigaction act; fd_set readfds; const char *value; - int uevent_netlink_active = 0; int daemonize = 0; int i; int rc = 0; + int maxfd; /* redirect std fd's, if the kernel forks us, we don't have them at all */ fd = open("/dev/null", O_RDWR); @@ -943,7 +823,6 @@ int main(int argc, char *argv[], char *envp[]) act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); - sigaction(SIGALRM, &act, NULL); sigaction(SIGCHLD, &act, NULL); sigaction(SIGHUP, &act, NULL); @@ -952,21 +831,6 @@ int main(int argc, char *argv[], char *envp[]) if (inotify_fd > 0) inotify_add_watch(inotify_fd, udev_rules_filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - /* init of expected_seqnum value */ - value = getenv("UDEVD_EXPECTED_SEQNUM"); - if (value) { - expected_seqnum = strtoull(value, NULL, 10); - info("initialize expected_seqnum to %llu", expected_seqnum); - } - - /* timeout to wait for missing events */ - value = getenv("UDEVD_EVENT_TIMEOUT"); - if (value) - event_timeout = strtoul(value, NULL, 10); - else - event_timeout = UDEVD_EVENT_TIMEOUT; - info("initialize event_timeout to %u", event_timeout); - /* maximum limit of forked childs */ value = getenv("UDEVD_MAX_CHILDS"); if (value) @@ -990,6 +854,11 @@ int main(int argc, char *argv[], char *envp[]) sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); putenv(udev_log); + maxfd = udevd_sock; + maxfd = UDEV_MAX(maxfd, uevent_netlink_sock); + maxfd = UDEV_MAX(maxfd, signal_pipe[READ_END]); + maxfd = UDEV_MAX(maxfd, inotify_fd); + while (!udev_exit) { struct uevent_msg *msg; int fdcount; @@ -1001,7 +870,7 @@ int main(int argc, char *argv[], char *envp[]) if (inotify_fd > 0) FD_SET(inotify_fd, &readfds); - fdcount = select(UDEV_MAX(uevent_netlink_sock, inotify_fd)+1, &readfds, NULL, NULL, NULL); + fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) dbg("error in select: %s", strerror(errno)); @@ -1012,9 +881,8 @@ int main(int argc, char *argv[], char *envp[]) if (FD_ISSET(udevd_sock, &readfds)) { msg = get_udevd_msg(); if (msg) { - /* discard kernel messages if netlink is active */ - if (uevent_netlink_active && msg->type == UDEVD_UEVENT_UDEVSEND && msg->seqnum != 0) { - info("skip uevent_helper message with SEQNUM, netlink is active"); + if (msg->type == UDEVD_UEVENT_UDEVSEND && msg->seqnum != 0) { + info("skip non-kernel message with SEQNUM"); free(msg); } else msg_queue_insert(msg); @@ -1024,14 +892,8 @@ int main(int argc, char *argv[], char *envp[]) /* get kernel netlink message */ if (FD_ISSET(uevent_netlink_sock, &readfds)) { msg = get_netlink_msg(); - if (msg) { + if (msg) msg_queue_insert(msg); - /* disable udevsend with first netlink message */ - if (!uevent_netlink_active) { - info("uevent_nl message received, disable udevsend messages"); - uevent_netlink_active = 1; - } - } } /* received a signal, clear our notification pipe */ @@ -1068,24 +930,13 @@ int main(int argc, char *argv[], char *envp[]) udev_rules_init(&rules, 1); } - /* forked child have returned */ + /* forked child has returned */ if (sigchilds_waiting) { sigchilds_waiting = 0; reap_sigchilds(); } - if (run_msg_q) { - run_msg_q = 0; - msg_queue_manager(); - } - if (run_exec_q) { - /* clean up running_list before calling exec_queue_manager() */ - if (sigchilds_waiting) { - sigchilds_waiting = 0; - reap_sigchilds(); - } - run_exec_q = 0; if (!stop_exec_q) exec_queue_manager(); diff --git a/udevd.h b/udevd.h index db510ab24a..884c4b0074 100644 --- a/udevd.h +++ b/udevd.h @@ -29,13 +29,6 @@ #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 -/* duration of initialization phase with shorter timeout */ -#define UDEVD_INIT_TIME 5 -#define UDEVD_INIT_EVENT_TIMEOUT 2 - -/* timeout to wait for missing events */ -#define UDEVD_EVENT_TIMEOUT 5 - /* maximum limit of runnig childs */ #define UDEVD_MAX_CHILDS 64 /* start to throttle forking if maximum number of running childs in our session is reached */ @@ -68,7 +61,7 @@ struct uevent_msg { enum udevd_msg_type type; struct list_head node; pid_t pid; - long queue_time; + time_t queue_time; char *action; char *devpath; char *subsystem; diff --git a/udevsend.c b/udevsend.c index 0ba1b58a4b..29d5bc155e 100644 --- a/udevsend.c +++ b/udevsend.c @@ -89,27 +89,6 @@ static int start_daemon(void) return 0; } -static void run_udev(const char *subsystem) -{ - char *const argv[] = { "udev", (char *)subsystem, NULL }; - pid_t pid; - - pid = fork(); - switch (pid) { - case 0: - /* child */ - execv(UDEV_BIN, argv); - err("exec of udev child failed"); - _exit(1); - break; - case -1: - err("fork of udev child failed"); - break; - default: - waitpid(pid, NULL, 0); - } -} - int main(int argc, char *argv[], char *envp[]) { static struct udevd_msg usend_msg; @@ -132,7 +111,7 @@ int main(int argc, char *argv[], char *envp[]) sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { err("error getting socket"); - goto fallback; + goto exit; } memset(&saddr, 0x00, sizeof(struct sockaddr_un)); @@ -192,7 +171,7 @@ int main(int argc, char *argv[], char *envp[]) if (errno != ECONNREFUSED) { err("error sending message (%s)", strerror(errno)); - goto fallback; + goto exit; } if (!started_daemon) { @@ -200,7 +179,7 @@ int main(int argc, char *argv[], char *envp[]) retval = start_daemon(); if (retval) { dbg("error starting daemon"); - goto fallback; + goto exit; } dbg("udevd daemon started"); started_daemon = 1; @@ -210,10 +189,6 @@ int main(int argc, char *argv[], char *envp[]) } } -fallback: - err("unable to connect to event daemon, try to call udev directly"); - run_udev(subsystem); - exit: if (sock != -1) close(sock); -- cgit v1.2.3-54-g00ecf From 38ff77b80ba400ab059b6a215092bf25a3085b2e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2005 02:23:06 +0100 Subject: print useconds in udevmonitor Signed-off-by: Kay Sievers --- udevmonitor.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/udevmonitor.c b/udevmonitor.c index 382cbb1905..dc04649745 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -23,13 +23,12 @@ #include #include #include -#include #include #include +#include #include #include #include -#include #include #include "udev.h" @@ -160,6 +159,9 @@ int main(int argc, char *argv[]) static char buf[UEVENT_BUFFER_SIZE*2]; ssize_t buflen; int fdcount; + struct timeval tv; + struct timezone tz; + char timestr[64]; buflen = 0; FD_ZERO(&readfds); @@ -175,13 +177,19 @@ int main(int argc, char *argv[]) continue; } + if (gettimeofday(&tv, &tz) == 0) { + snprintf(timestr, sizeof(timestr), "%llu.%06u", + (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec); + } else + timestr[0] = '\0'; + if ((uevent_netlink_sock > 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); if (buflen <= 0) { fprintf(stderr, "error receiving uevent message\n"); continue; } - printf("UEVENT[%llu] %s\n", (unsigned long long) time(NULL), buf); + printf("UEVENT[%s] %s\n", timestr, buf); } if ((udev_monitor_sock > 0) && FD_ISSET(udev_monitor_sock, &readfds)) { @@ -190,7 +198,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "error receiving udev message\n"); continue; } - printf("UDEV [%llu] %s\n", (unsigned long long) time(NULL), buf); + printf("UDEV [%s] %s\n", timestr, buf); } if (buflen == 0) -- cgit v1.2.3-54-g00ecf From 9092f7edcf12f7b2dc77e56a6a5f688ef81ef000 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2005 02:40:09 +0100 Subject: add .gitignore Signed-off-by: Kay Sievers --- .gitignore | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..c37b70c524 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +*.o +*.a +ccdv +udev +udevd +udevcontrol +udevsend +udevinfo +udevmonitor +udevstart +udevtest +udev_version.h + -- cgit v1.2.3-54-g00ecf From 8f528042ca780a6f772dd8f9b4a1427f2407a264 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2005 02:44:34 +0100 Subject: 073 release --- ChangeLog | 9 +++++++++ Makefile | 2 +- RELEASE-NOTES | 6 ++++++ TODO | 11 ++--------- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4964d782fd..2a81a68166 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Summary of changes from v72 to v073 +============================================ + +Kay Sievers: + udevd: depend on netlink and remove all sequence reorder logic + print useconds in udevmonitor + add RELEASE-NOTES, update TODO + + Summary of changes from v71 to v072 ============================================ diff --git a/Makefile b/Makefile index afa649e522..9050933214 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 072 +VERSION = 073 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 087403d56f..8e9416d921 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,9 @@ +udev 073 +======== +Fixed bug in udevd, if inotify is not available. We depend on netlink +uevents now, kernels without that event source will not work with that +version of udev anymore. + udev 072 ======== The rule parsing happens now in the daemon once at startup, all udev diff --git a/TODO b/TODO index a992547377..0bf22dd580 100644 --- a/TODO +++ b/TODO @@ -1,19 +1,12 @@ This is a short list of things that needs to be done. They are in no specific order. We will gladly accept patches for any of these items: -- More documentation: - Allmost all extras/*_id/ programs don't have a man page - some details are missing in the udev man pages. - - Completely replace the built-in wait_for_sysfs stuff in udev_sysfs.c by rules using the WAIT_FOR_SYSFS key. - Log the relationship of the kernel name and the persistent disk name to syslog, so any error logged from the kernel can be associated with - any of the links. - -- Do generic early boot logic: - initramfs, pivot-root, cover coldplug or event replay, etc... + any of the links at that time. -- Keep the distro rules in etc/ up-to-date. +- remove klibc tree and make it an external dependency -- cgit v1.2.3-54-g00ecf From fc465079caefbbfb838019e3c2b86ffa3e889efa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2005 14:10:09 +0100 Subject: never queue events with TIMEOUT set With removing the event reorder queue, we can fix the TIMEOUT events like firmware loading proper, and never delay any of these events. Signed-off-by: Kay Sievers --- udevd.c | 77 ++++++++++++++++++++++++++++++++--------------------------------- udevd.h | 2 +- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/udevd.c b/udevd.c index dcf5781812..ddf72738c3 100644 --- a/udevd.c +++ b/udevd.c @@ -50,7 +50,6 @@ #include "udevd.h" #include "logging.h" -/* global variables*/ struct udev_rules rules; static int udevd_sock; static int uevent_netlink_sock; @@ -85,19 +84,6 @@ void log_message(int priority, const char *format, ...) } #endif -static void msg_queue_insert(struct uevent_msg *msg) -{ - list_add(&msg->node, &exec_list); - msg->queue_time = time(NULL); - run_exec_q = 1; -} - -static void msg_queue_delete(struct uevent_msg *msg) -{ - list_del(&msg->node); - free(msg); -} - static void asmlinkage udev_event_sig_handler(int signum) { if (signum == SIGALRM) @@ -144,7 +130,12 @@ static int udev_event_process(struct uevent_msg *msg) return 0; } -/* runs event and removes event from run queue when finished */ +static void msg_queue_delete(struct uevent_msg *msg) +{ + list_del(&msg->node); + free(msg); +} + static void udev_event_run(struct uevent_msg *msg) { pid_t pid; @@ -180,6 +171,22 @@ static void udev_event_run(struct uevent_msg *msg) } } +static void msg_queue_insert(struct uevent_msg *msg) +{ + msg->queue_time = time(NULL); + + /* run all events with a timeout set immediately */ + if (msg->timeout != 0) { + list_add_tail(&msg->node, &running_list); + udev_event_run(msg); + return; + } + + list_add_tail(&msg->node, &exec_list); + run_exec_q = 1; +} + +/* runs event and removes event from run queue when finished */ static int running_processes(void) { int f; @@ -308,10 +315,6 @@ static int running_with_devpath(struct uevent_msg *msg, int limit) if (msg->devpath == NULL) return 0; - /* skip any events with a timeout set */ - if (msg->timeout != 0) - return 0; - list_for_each_entry(loop_msg, &running_list, node) { if (limit && childs_count++ > limit) { dbg("%llu, maximum number (%i) of child reached", msg->seqnum, childs_count); @@ -340,7 +343,7 @@ static int running_with_devpath(struct uevent_msg *msg, int limit) } /* exec queue management routine executes the events and serializes events in the same sequence */ -static void exec_queue_manager(void) +static void msg_queue_manager(void) { struct uevent_msg *loop_msg; struct uevent_msg *tmp_msg; @@ -360,20 +363,22 @@ static void exec_queue_manager(void) running = running_processes_in_session(sid, max_childs_running+10); dbg("at least %d processes running in session", running); if (running >= max_childs_running) { - dbg("delay seq %llu, cause too many processes already running", - loop_msg->seqnum); + dbg("delay seq %llu, too many processes already running", loop_msg->seqnum); return; } } - if (running_with_devpath(loop_msg, max_childs) == 0) { - /* move event to run list */ - list_move_tail(&loop_msg->node, &running_list); - udev_event_run(loop_msg); - running++; - dbg("moved seq %llu to running list", loop_msg->seqnum); - } else + /* don't run two processes for the same devpath and wait for the parent*/ + if (running_with_devpath(loop_msg, max_childs)) { dbg("delay seq %llu (%s)", loop_msg->seqnum, loop_msg->devpath); + continue; + } + + /* move event to run list */ + list_move_tail(&loop_msg->node, &running_list); + udev_event_run(loop_msg); + running++; + dbg("moved seq %llu to running list", loop_msg->seqnum); } } @@ -494,7 +499,7 @@ static struct uevent_msg *get_udevd_msg(void) case UDEVD_START_EXEC_QUEUE: info("udevd message (START_EXEC_QUEUE) received"); stop_exec_q = 0; - exec_queue_manager(); + msg_queue_manager(); break; case UDEVD_SET_LOG_LEVEL: intval = (int *) usend_msg.envbuf; @@ -597,16 +602,10 @@ static void udev_done(int pid) list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { - if (msg->queue_time) - info("seq %llu, pid [%d] exit, %ld seconds old", msg->seqnum, msg->pid, time(NULL) - msg->queue_time); - else - info("seq 0, pid [%d] exit", msg->pid); + info("seq %llu, pid [%d] exit, %ld seconds old", msg->seqnum, msg->pid, time(NULL) - msg->queue_time); msg_queue_delete(msg); - /* we want to run the exec queue manager since there may - * be events waiting with the devpath of the one that - * just finished - */ + /* there may be events waiting with the same devpath */ run_exec_q = 1; return; } @@ -939,7 +938,7 @@ int main(int argc, char *argv[], char *envp[]) if (run_exec_q) { run_exec_q = 0; if (!stop_exec_q) - exec_queue_manager(); + msg_queue_manager(); } } diff --git a/udevd.h b/udevd.h index 884c4b0074..91c8e6503d 100644 --- a/udevd.h +++ b/udevd.h @@ -32,7 +32,7 @@ /* maximum limit of runnig childs */ #define UDEVD_MAX_CHILDS 64 /* start to throttle forking if maximum number of running childs in our session is reached */ -#define UDEVD_MAX_CHILDS_RUNNING 8 +#define UDEVD_MAX_CHILDS_RUNNING 16 /* environment buffer, should match the kernel's size in lib/kobject_uevent.h */ #define UEVENT_BUFFER_SIZE 1024 -- cgit v1.2.3-54-g00ecf From 271c2d7d26132858a3302208dfe1572aa9cbbd12 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2005 16:00:41 +0100 Subject: let NAME="" supress node creation, but do RUN keys Signed-off-by: Kay Sievers --- udev_event.c | 9 ++++----- udev_rules_parse.c | 9 +++------ 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/udev_event.c b/udev_event.c index fae5a46597..b50fbf4c1d 100644 --- a/udev_event.c +++ b/udev_event.c @@ -73,13 +73,12 @@ int udev_process_event(struct udev_rules *rules, struct udevice *udev) sysfs_close_class_device(class_dev); return -1; } - if (udev->name[0] == '\0') { + if (udev->name[0] != '\0') { + /* create node, store in db */ + retval = udev_add_device(udev, class_dev); + } else { info("device node creation supressed"); - sysfs_close_class_device(class_dev); - return -1; } - /* create node, store in db */ - retval = udev_add_device(udev, class_dev); } else { dbg("no dev-file found"); udev_rules_get_run(rules, udev, class_dev, NULL); diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 6e978d74b4..9041c383e0 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -413,12 +413,9 @@ static int add_to_rules(struct udev_rules *rules, char *line) rule->ignore_remove = 1; } } - if (value[0] == '\0') { - dbg("name empty device should be ignored"); - rule->name.operation = operation; - rule->ignore_device = 1; - } else - add_rule_key(rule, &rule->name, operation, value); + if (value[0] == '\0') + dbg("name empty, not creation supressed"); + add_rule_key(rule, &rule->name, operation, value); continue; } -- cgit v1.2.3-54-g00ecf From e07a3d79bad70ea132435c8a44737ac270b0f9e3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2005 17:14:38 +0100 Subject: remove udevinitsend Signed-off-by: Kay Sievers --- Makefile | 2 - udevinitsend.c | 241 --------------------------------------------------------- 2 files changed, 243 deletions(-) delete mode 100644 udevinitsend.c diff --git a/Makefile b/Makefile index 9050933214..bcaf30b706 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,6 @@ PROGRAMS = \ udev \ udevd \ udevsend \ - udevinitsend \ udeveventrecorder \ udevcontrol \ udevmonitor \ @@ -375,7 +374,6 @@ uninstall-bin: - rm -f $(DESTDIR)$(sbindir)/udev - rm -f $(DESTDIR)$(sbindir)/udevd - rm -f $(DESTDIR)$(sbindir)/udevsend - - rm -f $(DESTDIR)$(sbindir)/udevinitsend - rm -f $(DESTDIR)$(sbindir)/udeveventrecoreder - rm -f $(DESTDIR)$(sbindir)/udevcontrol - rm -f $(DESTDIR)$(sbindir)/udevstart diff --git a/udevinitsend.c b/udevinitsend.c deleted file mode 100644 index 4f50da8f68..0000000000 --- a/udevinitsend.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * udevinitsend.c - * - * Copyright (C) 2004, 2005 SuSE Linux Products GmbH - * Author: - * Hannes Reinecke - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_version.h" -#include "udevd.h" -#include "udev_utils.h" -#include "logging.h" - -static int udev_log = 0; - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -/* - * udevsend - * - * Scan a file, write all variables into the msgbuf and - * fires the message to udevd. - */ -static int udevsend(char *filename, int sock, int disable_loop_detection) -{ - static struct udevd_msg usend_msg; - int usend_msg_len; - int bufpos = 0; - struct stat statbuf; - int fd; - char *fdmap, *ls, *le, *ch; - struct sockaddr_un saddr; - socklen_t addrlen; - int retval = 0; - - if (stat(filename,&statbuf) < 0) { - dbg("cannot stat %s: %s\n", filename, strerror(errno)); - return 1; - } - fd = open(filename,O_RDONLY); - if (fd < 0) - return 1; - - fdmap = mmap(0, statbuf.st_size, - PROT_READ, MAP_PRIVATE, fd, 0); - close(fd); - if (fdmap == MAP_FAILED) { - dbg("mmap failed, errno %d\n", errno); - return 1; - } - - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - - memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); - strcpy(usend_msg.magic, UDEV_MAGIC); - usend_msg.type = UDEVD_UEVENT_INITSEND; - - ls = fdmap; - ch = le = ls; - while (*ch && ch < fdmap + statbuf.st_size) { - le = strchr(ch, '\n'); - if (!le) - break; - ch = strchr(ch, '='); - if (!ch) - break; - - /* prevent loops in the scripts we execute */ - if (strncmp(ls, "UDEVD_EVENT=", 12) == 0) { - if (!disable_loop_detection) { - dbg("event already handled by udev\n"); - retval = -1; - break; - } - goto loop_end; - } - - /* omit shell-generated keys */ - if (ls[0] == '_' && ls[1] == '=') { - goto loop_end; - } - - if (ch < le) { - strncpy(&usend_msg.envbuf[bufpos],ls,(ch - ls) + 1); - bufpos += (ch - ls) + 1; - if (ch[1] == '\'' && le[-1] == '\'') { - strncpy(&usend_msg.envbuf[bufpos],ch + 2, (le - ch) - 3); - bufpos += (le - ch) - 3; - } else { - strncpy(&usend_msg.envbuf[bufpos],ch + 1, (le - ch) - 1); - bufpos += (le - ch) - 1; - } - bufpos++; - } -loop_end: - ch = le + 1; - ls = ch; - } - munmap(fdmap, statbuf.st_size); - - usend_msg_len = offsetof(struct udevd_msg, envbuf) + bufpos; - dbg("usend_msg_len=%i", usend_msg_len); - - if (!retval) { - retval = sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen); - if (retval < 0) { - dbg("error sending message (%s)", strerror(errno)); - retval = -1; - } - } - - return retval; -} - -int main(int argc, char *argv[], char *envp[]) -{ - static const char short_options[] = "d:f:lVh"; - int option; - char *event_dir = NULL; - char *event_file = NULL; - DIR *dirstream; - struct dirent *direntry; - int retval = 0; - int disable_loop_detection = 0; - int sock; - const char *env; - - env = getenv("UDEV_LOG"); - if (env) - udev_log = log_priority(env); - - logging_init("udevinitsend"); - dbg("version %s", UDEV_VERSION); - - /* get command line options */ - while (1) { - option = getopt(argc, argv, short_options); - if (option == -1) - break; - - dbg("option '%c': ", option); - switch (option) { - case 'd': - dbg("scan directory %s\n", optarg); - event_dir = optarg; - break; - - case 'f': - dbg("use event file %s\n", optarg); - event_file = optarg; - break; - - case 'l': - dbg("disable loop detection, ignore UDEVD_EVENT\n"); - disable_loop_detection = 1; - break; - - case 'h': - retval = 0; - } - } - - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (sock == -1) { - dbg("error getting socket"); - return 1; - } - - if (event_dir) { - dirstream = opendir(event_dir); - if (!dirstream) { - info("error opening directory %s: %s\n", - event_dir, strerror(errno)); - return 2; - } - chdir(event_dir); - while ((direntry = readdir(dirstream)) != NULL) { - if (!strcmp(direntry->d_name,".") || - !strcmp(direntry->d_name,"..")) - continue; - retval = udevsend(direntry->d_name, sock, disable_loop_detection); - } - closedir(dirstream); - } else if (event_file) { - retval = udevsend(event_file, sock, disable_loop_detection); - } - - if (sock != -1) - close(sock); - - if (retval) - return 3; - return 0; -} -- cgit v1.2.3-54-g00ecf From b6d474506f8935084e423f78035ea7206d4c3da0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2005 17:16:33 +0100 Subject: update .gitignore Signed-off-by: Kay Sievers --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c37b70c524..a83700c930 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,6 @@ udevinfo udevmonitor udevstart udevtest +udeveventrecorder udev_version.h -- cgit v1.2.3-54-g00ecf From ff3e4bed21aaff673284f2e024da26c1e39cfda6 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 7 Nov 2005 18:44:18 +0100 Subject: add strerror() to error logs --- udev.c | 2 +- udev_add.c | 14 +++++++------- udev_config.c | 2 +- udev_db.c | 10 +++++----- udev_libc_wrapper.c | 2 +- udev_remove.c | 7 +++---- udev_rules.c | 2 +- udev_rules_parse.c | 2 +- udev_selinux.c | 6 +++--- udev_utils.c | 2 +- udev_utils_file.c | 6 +++--- udev_utils_run.c | 12 ++++++------ udevcontrol.c | 4 ++-- udevd.c | 20 ++++++++++---------- udeveventrecorder.c | 2 +- udevmonitor.c | 14 +++++++------- udevsend.c | 10 +++++----- 17 files changed, 58 insertions(+), 59 deletions(-) diff --git a/udev.c b/udev.c index aab9f015fb..17867180c7 100644 --- a/udev.c +++ b/udev.c @@ -95,7 +95,7 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udev"); if (devnull < 0) - err("fatal, could not open /dev/null"); + err("fatal, could not open /dev/null: %s", strerror(errno)); udev_init_config(); dbg("version %s", UDEV_VERSION); diff --git a/udev_add.c b/udev_add.c index 9420b4fe14..a811b5a17c 100644 --- a/udev_add.c +++ b/udev_add.c @@ -73,7 +73,7 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo } if (unlink(file) != 0) - dbg("unlink(%s) failed with error '%s'", file, strerror(errno)); + dbg("unlink(%s) failed: %s", file, strerror(errno)); else dbg("already present file '%s' unlinked", file); @@ -82,7 +82,7 @@ create: retval = mknod(file, mode, devt); selinux_resetfscreatecon(); if (retval != 0) { - err("mknod(%s, %#o, %u, %u) failed with error '%s'", + err("mknod(%s, %#o, %u, %u) failed: %s", file, mode, major(devt), minor(devt), strerror(errno)); goto exit; } @@ -90,14 +90,14 @@ create: perms: dbg("chmod(%s, %#o)", file, mode); if (chmod(file, mode) != 0) { - dbg("chmod(%s, %#o) failed with error '%s'", file, mode, strerror(errno)); + dbg("chmod(%s, %#o) failed: %s", file, mode, strerror(errno)); goto exit; } if (uid != 0 || gid != 0) { dbg("chown(%s, %u, %u)", file, uid, gid); if (chown(file, uid, gid) != 0) { - dbg("chown(%s, %u, %u) failed with error '%s'", + dbg("chown(%s, %u, %u) failed: %s", file, uid, gid, strerror(errno)); goto exit; } @@ -222,7 +222,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de retval = symlink(linktarget, filename); selinux_resetfscreatecon(); if (retval != 0) - dbg("symlink(%s, %s) failed with error '%s'", + dbg("symlink(%s, %s) failed: %s", linktarget, filename, strerror(errno)); } } @@ -244,7 +244,7 @@ static int rename_net_if(struct udevice *udev) sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { - dbg("error opening socket"); + dbg("error opening socket: %s", strerror(errno)); return -1; } @@ -254,7 +254,7 @@ static int rename_net_if(struct udevice *udev) retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) - dbg("error changing net interface name"); + dbg("error changing net interface name: %s", strerror(errno)); close(sk); return retval; diff --git a/udev_config.c b/udev_config.c index b8c4ffc8ed..192a0b80d2 100644 --- a/udev_config.c +++ b/udev_config.c @@ -107,7 +107,7 @@ static int parse_config_file(void) int retval = 0; if (file_map(udev_config_filename, &buf, &bufsize) != 0) { - err("can't open '%s' as config file", udev_config_filename); + err("can't open '%s' as config file: %s", udev_config_filename, strerror(errno)); return -ENODEV; } diff --git a/udev_db.c b/udev_db.c index bf369ac2e6..f00308bd2f 100644 --- a/udev_db.c +++ b/udev_db.c @@ -95,7 +95,7 @@ int udev_db_add_device(struct udevice *udev) create_path(filename); f = fopen(filename, "w"); if (f == NULL) { - err("unable to create db file '%s'", filename); + err("unable to create db file '%s': %s", filename, strerror(errno)); return -1; } dbg("storing data for device '%s' in '%s'", udev->devpath, filename); @@ -129,7 +129,7 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) devpath_to_db_path(devpath, filename, sizeof(filename)); if (file_map(filename, &buf, &bufsize) != 0) { - dbg("no db file to read '%s'", filename); + dbg("no db file to read %s: %s", filename, strerror(errno)); return -1; } @@ -210,7 +210,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) dir = opendir(udev_db_path); if (dir == NULL) { - err("unable to open udev_db '%s'", udev_db_path); + err("unable to open udev_db '%s': %s", udev_db_path, strerror(errno)); return -1; } @@ -235,7 +235,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) dbg("looking at '%s'", filename); if (file_map(filename, &buf, &bufsize) != 0) { - err("unable to read db file '%s'", filename); + err("unable to read db file '%s': %s", filename, strerror(errno)); continue; } @@ -278,7 +278,7 @@ int udev_db_get_all_entries(struct list_head *name_list) dir = opendir(udev_db_path); if (dir == NULL) { - err("unable to open udev_db '%s'", udev_db_path); + err("unable to open udev_db '%s': %s", udev_db_path, strerror(errno)); return -1; } diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index 4e9f9f1fe8..a7a8c5342d 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -144,7 +144,7 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) char *tail; if (file_map(dbfile, &buf, &bufsize) != 0) { - dbg("can't open '%s' as db file", dbfile); + dbg("can't open '%s' as db file: %s", dbfile, strerror(errno)); return 0; } dbg("search '%s' in '%s'", uname, dbfile); diff --git a/udev_remove.c b/udev_remove.c index 0d536bc8ff..621fcc1960 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -56,8 +56,7 @@ static int delete_path(const char *path) if (retval) { if (errno == ENOTEMPTY) return 0; - dbg("rmdir(%s) failed with error '%s'", - path, strerror(errno)); + dbg("rmdir(%s) failed: %s", path, strerror(errno)); break; } dbg("removed '%s'", path); @@ -153,8 +152,8 @@ int udev_remove_device(struct udevice *udev) dbg("remove name='%s'", udev->name); udev_db_delete_device(udev); } else { - dbg("'%s' not found in database, using kernel name '%s'", udev->devpath, udev->kernel_name); - strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); + dbg("'%s' not found in database, don't remove anything", udev->devpath); + return -1; } return delete_node(udev); diff --git a/udev_rules.c b/udev_rules.c index ad3629d39d..137ad27dba 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -208,7 +208,7 @@ static int import_file_into_env(struct udevice *udev, const char *filename) size_t bufsize; if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s'", filename); + err("can't open '%s': %s", filename, strerror(errno)); return -1; } import_keys_into_env(udev, buf, bufsize); diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 9041c383e0..b664b983fb 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -538,7 +538,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) int retval = 0; if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s' as rules file", filename); + err("can't open '%s' as rules file: %s", filename, strerror(errno)); return -1; } dbg("reading '%s' as rules file", filename); diff --git a/udev_selinux.c b/udev_selinux.c index cc6f4d7d3f..719ff6403e 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -105,7 +105,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode } if (setfilecon(file, scontext) < 0) - dbg("setfilecon %s failed with error '%s'", file, strerror(errno)); + dbg("setfilecon %s failed: %s", file, strerror(errno)); freecon(scontext); } @@ -131,7 +131,7 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int } if (setfscreatecon(scontext) < 0) - dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); + dbg("setfscreatecon %s failed: %s", file, strerror(errno)); freecon(scontext); } @@ -141,7 +141,7 @@ void selinux_resetfscreatecon(void) { if (is_selinux_running()) { if (setfscreatecon(prev_scontext) < 0) - dbg("setfscreatecon %s failed with error '%s'", file, strerror(errno)); + dbg("setfscreatecon failed: %s", strerror(errno)); } } diff --git a/udev_utils.c b/udev_utils.c index 683378aadf..04258a39c2 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -139,7 +139,7 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c dbg("open directory '%s'", dirname); dir = opendir(dirname); if (dir == NULL) { - dbg("unable to open '%s'", dirname); + dbg("unable to open '%s': %s", dirname, strerror(errno)); return -1; } diff --git a/udev_utils_file.c b/udev_utils_file.c index f8518f64ad..23f61196b7 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -72,18 +72,18 @@ int unlink_secure(const char *filename) retval = chown(filename, 0, 0); if (retval) - dbg("chown(%s, 0, 0) failed with error '%s'", filename, strerror(errno)); + dbg("chown(%s, 0, 0) failed: %s", filename, strerror(errno)); retval = chmod(filename, 0000); if (retval) - dbg("chmod(%s, 0000) failed with error '%s'", filename, strerror(errno)); + dbg("chmod(%s, 0000) failed: %s", filename, strerror(errno)); retval = unlink(filename); if (errno == ENOENT) retval = 0; if (retval) - dbg("unlink(%s) failed with error '%s'", filename, strerror(errno)); + dbg("unlink(%s) failed: %s", filename, strerror(errno)); return retval; } diff --git a/udev_utils_run.c b/udev_utils_run.c index 1315154c26..20aaa4ab05 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -115,13 +115,13 @@ int run_program(const char *command, const char *subsystem, /* prepare pipes from child to parent */ if (result || log) { if (pipe(outpipe) != 0) { - err("pipe failed"); + err("pipe failed: %s", strerror(errno)); return -1; } } if (log) { if (pipe(errpipe) != 0) { - err("pipe failed"); + err("pipe failed: %s", strerror(errno)); return -1; } } @@ -145,7 +145,7 @@ int run_program(const char *command, const char *subsystem, dup2(devnull, STDERR_FILENO); close(devnull); } else - err("open /dev/null failed"); + err("open /dev/null failed: %s", strerror(errno)); if (outpipe[WRITE_END] > 0) dup2(outpipe[WRITE_END], STDOUT_FILENO); if (errpipe[WRITE_END] > 0) @@ -156,7 +156,7 @@ int run_program(const char *command, const char *subsystem, err("exec of program '%s' failed", argv[0]); _exit(1); case -1: - err("fork of '%s' failed", argv[0]); + err("fork of '%s' failed: %s", argv[0], strerror(errno)); return -1; default: /* read from child if requested */ @@ -199,7 +199,7 @@ int run_program(const char *command, const char *subsystem, close(outpipe[READ_END]); outpipe[READ_END] = -1; if (count < 0) { - err("stdin read failed with '%s'", strerror(errno)); + err("stdin read failed: %s", strerror(errno)); retval = -1; } continue; @@ -233,7 +233,7 @@ int run_program(const char *command, const char *subsystem, close(errpipe[READ_END]); errpipe[READ_END] = -1; if (count < 0) - err("stderr read failed with '%s'", strerror(errno)); + err("stderr read failed: %s", strerror(errno)); continue; } errbuf[count] = '\0'; diff --git a/udevcontrol.c b/udevcontrol.c index 00b435edc4..bd6563531d 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -125,7 +125,7 @@ int main(int argc, char *argv[], char *envp[]) sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { - err("error getting socket"); + err("error getting socket: %s", strerror(errno)); goto exit; } @@ -138,7 +138,7 @@ int main(int argc, char *argv[], char *envp[]) retval = sendto(sock, &usend_msg, sizeof(usend_msg), 0, (struct sockaddr *)&saddr, addrlen); if (retval == -1) { - info("error sending message (%s)", strerror(errno)); + err("error sending message: %s", strerror(errno)); retval = 1; } else { dbg("sent message type=0x%02x, %u bytes sent", usend_msg.type, retval); diff --git a/udevd.c b/udevd.c index ddf72738c3..86905923be 100644 --- a/udevd.c +++ b/udevd.c @@ -160,7 +160,7 @@ static void udev_event_run(struct uevent_msg *msg) logging_close(); exit(0); case -1: - err("fork of child failed"); + err("fork of child failed: %s", strerror(errno)); msg_queue_delete(msg); break; default: @@ -460,7 +460,7 @@ static struct uevent_msg *get_udevd_msg(void) size = recvmsg(udevd_sock, &smsg, 0); if (size < 0) { if (errno != EINTR) - err("unable to receive udevd message"); + err("unable to receive udevd message: %s", strerror(errno)); return NULL; } cmsg = CMSG_FIRSTHDR(&smsg); @@ -535,7 +535,7 @@ static struct uevent_msg *get_netlink_msg(void) size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); if (size < 0) { if (errno != EINTR) - err("unable to receive udevd message"); + err("unable to receive udevd message: %s", strerror(errno)); return NULL; } @@ -640,7 +640,7 @@ static int init_udevd_socket(void) udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udevd_sock == -1) { - err("error getting socket, %s", strerror(errno)); + err("error getting socket: %s", strerror(errno)); return -1; } @@ -650,7 +650,7 @@ static int init_udevd_socket(void) /* the bind takes care of ensuring only one copy running */ retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { - err("bind failed, %s", strerror(errno)); + err("bind failed: %s", strerror(errno)); return -1; } @@ -673,7 +673,7 @@ static int init_uevent_netlink_sock(void) uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_netlink_sock == -1) { - err("error getting socket, %s", strerror(errno)); + err("error getting socket: %s", strerror(errno)); return -1; } @@ -682,7 +682,7 @@ static int init_uevent_netlink_sock(void) retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { - err("bind failed, %s", strerror(errno)); + err("bind failed: %s", strerror(errno)); close(uevent_netlink_sock); uevent_netlink_sock = -1; return -1; @@ -717,7 +717,7 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevd"); if (fd < 0) - err("fatal, could not open /dev/null"); + err("fatal, could not open /dev/null: %s", strerror(errno)); udev_init_config(); dbg("version %s", UDEV_VERSION); @@ -770,7 +770,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("daemonized fork running"); break; case -1: - err("fork of daemon failed"); + err("fork of daemon failed: %s", strerror(errno)); rc = 4; goto exit; default: @@ -792,7 +792,7 @@ int main(int argc, char *argv[], char *envp[]) /* OOM_DISABLE == -17 */ fd = open("/proc/self/oom_adj", O_RDWR); if (fd < 0) - err("error disabling OOM"); + err("error disabling OOM: %s", strerror(errno)); else { write(fd, "-17", 3); close(fd); diff --git a/udeveventrecorder.c b/udeveventrecorder.c index 8ac344a47e..422cf88ff0 100644 --- a/udeveventrecorder.c +++ b/udeveventrecorder.c @@ -84,7 +84,7 @@ int main(int argc, char **argv, char **envp) snprintf(buf, FNSIZE, "/events/debug.%05lu.%s.%s.%u", seq, argv[1], a ? a : "", getpid()); if ((fd = open(buf, O_CREAT | O_WRONLY | O_TRUNC, 0644)) < 0) { - err("error creating '%s'", buf); + err("error creating '%s': %s", buf, strerror(errno)); goto error; } free(buf); diff --git a/udevmonitor.c b/udevmonitor.c index dc04649745..805790233f 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -55,14 +55,14 @@ static int init_udev_monitor_socket(void) udev_monitor_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udev_monitor_sock == -1) { - fprintf(stderr, "error getting socket, %s\n", strerror(errno)); + fprintf(stderr, "error getting socket: %s\n", strerror(errno)); return -1; } /* the bind takes care of ensuring only one copy running */ retval = bind(udev_monitor_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { - fprintf(stderr, "bind failed, %s\n", strerror(errno)); + fprintf(stderr, "bind failed: %s\n", strerror(errno)); close(udev_monitor_sock); udev_monitor_sock = -1; return -1; @@ -86,14 +86,14 @@ static int init_uevent_netlink_sock(void) uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_netlink_sock == -1) { - fprintf(stderr, "error getting socket, %s\n", strerror(errno)); + fprintf(stderr, "error getting socket: %s\n", strerror(errno)); return -1; } retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { - fprintf(stderr, "bind failed, %s\n", strerror(errno)); + fprintf(stderr, "bind failed: %s\n", strerror(errno)); close(uevent_netlink_sock); uevent_netlink_sock = -1; return -1; @@ -173,7 +173,7 @@ int main(int argc, char *argv[]) fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) - fprintf(stderr, "error receiving uevent message\n"); + fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); continue; } @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) if ((uevent_netlink_sock > 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); if (buflen <= 0) { - fprintf(stderr, "error receiving uevent message\n"); + fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); continue; } printf("UEVENT[%s] %s\n", timestr, buf); @@ -195,7 +195,7 @@ int main(int argc, char *argv[]) if ((udev_monitor_sock > 0) && FD_ISSET(udev_monitor_sock, &readfds)) { buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); if (buflen <= 0) { - fprintf(stderr, "error receiving udev message\n"); + fprintf(stderr, "error receiving udev message: %s\n", strerror(errno)); continue; } printf("UDEV [%s] %s\n", timestr, buf); diff --git a/udevsend.c b/udevsend.c index 29d5bc155e..d0cfc2af53 100644 --- a/udevsend.c +++ b/udevsend.c @@ -71,17 +71,17 @@ static int start_daemon(void) /* daemon with empty environment */ close(sock); execve(UDEVD_BIN, argv, envp); - err("exec of daemon failed"); + err("exec of daemon failed: %s", strerror(errno)); _exit(1); case -1: - err("fork of daemon failed"); + err("fork of daemon failed: %s", strerror(errno)); return -1; default: exit(0); } break; case -1: - err("fork of helper failed"); + err("fork of helper failed: %s", strerror(errno)); return -1; default: waitpid(pid, NULL, 0); @@ -110,7 +110,7 @@ int main(int argc, char *argv[], char *envp[]) sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { - err("error getting socket"); + err("error getting socket: %s", strerror(errno)); goto exit; } @@ -170,7 +170,7 @@ int main(int argc, char *argv[], char *envp[]) } if (errno != ECONNREFUSED) { - err("error sending message (%s)", strerror(errno)); + err("error sending message: %s", strerror(errno)); goto exit; } -- cgit v1.2.3-54-g00ecf From df4e89bfa61b6aaea41619842aa9032dd1af072e Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 7 Nov 2005 18:52:03 +0100 Subject: move some logging from dbg() to info() --- udev_add.c | 12 ++++++------ udev_db.c | 2 +- udev_libc_wrapper.c | 6 +++--- udev_remove.c | 2 +- udev_rules_parse.c | 2 +- udev_selinux.c | 12 ++++++------ udev_utils.c | 2 +- udev_utils_file.c | 6 +++--- udevd.c | 6 +++--- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/udev_add.c b/udev_add.c index a811b5a17c..f4ad55a893 100644 --- a/udev_add.c +++ b/udev_add.c @@ -73,7 +73,7 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo } if (unlink(file) != 0) - dbg("unlink(%s) failed: %s", file, strerror(errno)); + err("unlink(%s) failed: %s", file, strerror(errno)); else dbg("already present file '%s' unlinked", file); @@ -90,14 +90,14 @@ create: perms: dbg("chmod(%s, %#o)", file, mode); if (chmod(file, mode) != 0) { - dbg("chmod(%s, %#o) failed: %s", file, mode, strerror(errno)); + err("chmod(%s, %#o) failed: %s", file, mode, strerror(errno)); goto exit; } if (uid != 0 || gid != 0) { dbg("chown(%s, %u, %u)", file, uid, gid); if (chown(file, uid, gid) != 0) { - dbg("chown(%s, %u, %u) failed: %s", + err("chown(%s, %u, %u) failed: %s", file, uid, gid, strerror(errno)); goto exit; } @@ -222,7 +222,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de retval = symlink(linktarget, filename); selinux_resetfscreatecon(); if (retval != 0) - dbg("symlink(%s, %s) failed: %s", + err("symlink(%s, %s) failed: %s", linktarget, filename, strerror(errno)); } } @@ -244,7 +244,7 @@ static int rename_net_if(struct udevice *udev) sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { - dbg("error opening socket: %s", strerror(errno)); + err("error opening socket: %s", strerror(errno)); return -1; } @@ -254,7 +254,7 @@ static int rename_net_if(struct udevice *udev) retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) - dbg("error changing net interface name: %s", strerror(errno)); + err("error changing net interface name: %s", strerror(errno)); close(sk); return retval; diff --git a/udev_db.c b/udev_db.c index f00308bd2f..5caf3fda80 100644 --- a/udev_db.c +++ b/udev_db.c @@ -129,7 +129,7 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) devpath_to_db_path(devpath, filename, sizeof(filename)); if (file_map(filename, &buf, &bufsize) != 0) { - dbg("no db file to read %s: %s", filename, strerror(errno)); + info("no db file to read %s: %s", filename, strerror(errno)); return -1; } diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index a7a8c5342d..fe38993cd7 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -102,7 +102,7 @@ uid_t lookup_user(const char *user) pw = getpwnam(user); if (pw == NULL) - dbg("specified user unknown '%s'", user); + info("specified user unknown '%s'", user); else uid = pw->pw_uid; @@ -116,7 +116,7 @@ gid_t lookup_group(const char *group) gr = getgrnam(group); if (gr == NULL) - dbg("specified group unknown '%s'", group); + info("specified group unknown '%s'", group); else gid = gr->gr_gid; @@ -144,7 +144,7 @@ static unsigned long get_id_by_name(const char *uname, const char *dbfile) char *tail; if (file_map(dbfile, &buf, &bufsize) != 0) { - dbg("can't open '%s' as db file: %s", dbfile, strerror(errno)); + err("can't open '%s' as db file: %s", dbfile, strerror(errno)); return 0; } dbg("search '%s' in '%s'", uname, dbfile); diff --git a/udev_remove.c b/udev_remove.c index 621fcc1960..cb5523af92 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -56,7 +56,7 @@ static int delete_path(const char *path) if (retval) { if (errno == ENOTEMPTY) return 0; - dbg("rmdir(%s) failed: %s", path, strerror(errno)); + err("rmdir(%s) failed: %s", path, strerror(errno)); break; } dbg("removed '%s'", path); diff --git a/udev_rules_parse.c b/udev_rules_parse.c index b664b983fb..7fa21afa8c 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -617,7 +617,7 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) else dbg("empty rules file '%s'", name_loop->name); } else - dbg("could not read '%s'", name_loop->name); + err("could not read '%s': %s", name_loop->name, strerror(errno)); list_del(&name_loop->node); free(name_loop); } diff --git a/udev_selinux.c b/udev_selinux.c index 719ff6403e..6ec359edd4 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -100,12 +100,12 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - dbg("matchpathcon(%s) failed\n", file); + err("matchpathcon(%s) failed\n", file); return; } if (setfilecon(file, scontext) < 0) - dbg("setfilecon %s failed: %s", file, strerror(errno)); + err("setfilecon %s failed: %s", file, strerror(errno)); freecon(scontext); } @@ -126,12 +126,12 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - dbg("matchpathcon(%s) failed\n", file); + err("matchpathcon(%s) failed\n", file); return; } if (setfscreatecon(scontext) < 0) - dbg("setfscreatecon %s failed: %s", file, strerror(errno)); + err("setfscreatecon %s failed: %s", file, strerror(errno)); freecon(scontext); } @@ -141,7 +141,7 @@ void selinux_resetfscreatecon(void) { if (is_selinux_running()) { if (setfscreatecon(prev_scontext) < 0) - dbg("setfscreatecon failed: %s", strerror(errno)); + err("setfscreatecon failed: %s", strerror(errno)); } } @@ -153,7 +153,7 @@ void selinux_init(void) */ if (is_selinux_running()) { if (getfscreatecon(&prev_scontext) < 0) { - dbg("getfscreatecon failed\n"); + err("getfscreatecon failed\n"); prev_scontext = NULL; } } diff --git a/udev_utils.c b/udev_utils.c index 04258a39c2..581ba9e80a 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -139,7 +139,7 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c dbg("open directory '%s'", dirname); dir = opendir(dirname); if (dir == NULL) { - dbg("unable to open '%s': %s", dirname, strerror(errno)); + err("unable to open '%s': %s", dirname, strerror(errno)); return -1; } diff --git a/udev_utils_file.c b/udev_utils_file.c index 23f61196b7..a3dab58b36 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -72,18 +72,18 @@ int unlink_secure(const char *filename) retval = chown(filename, 0, 0); if (retval) - dbg("chown(%s, 0, 0) failed: %s", filename, strerror(errno)); + err("chown(%s, 0, 0) failed: %s", filename, strerror(errno)); retval = chmod(filename, 0000); if (retval) - dbg("chmod(%s, 0000) failed: %s", filename, strerror(errno)); + err("chmod(%s, 0000) failed: %s", filename, strerror(errno)); retval = unlink(filename); if (errno == ENOENT) retval = 0; if (retval) - dbg("unlink(%s) failed: %s", filename, strerror(errno)); + err("unlink(%s) failed: %s", filename, strerror(errno)); return retval; } diff --git a/udevd.c b/udevd.c index 86905923be..333ad4143a 100644 --- a/udevd.c +++ b/udevd.c @@ -743,10 +743,10 @@ int main(int argc, char *argv[], char *envp[]) /* init sockets to receive events */ if (init_udevd_socket() < 0) { if (errno == EADDRINUSE) { - dbg("another udevd running, exit"); + err("another udevd running, exit"); rc = 1; } else { - dbg("error initializing udevd socket: %s", strerror(errno)); + err("error initializing udevd socket: %s", strerror(errno)); rc = 2; } goto exit; @@ -872,7 +872,7 @@ int main(int argc, char *argv[], char *envp[]) fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) - dbg("error in select: %s", strerror(errno)); + err("error in select: %s", strerror(errno)); continue; } -- cgit v1.2.3-54-g00ecf From bc48bbd9cd994470ce9b77adbb40464968853b00 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2005 18:52:26 +0100 Subject: 074 release --- Makefile | 2 +- RELEASE-NOTES | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index bcaf30b706..bc97388a12 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 073 +VERSION = 074 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8e9416d921..8a1bde8a3b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,11 @@ +udev 074 +======== +NAME="" will not create any nodes, but execute RUN keys. To completely +ignore an event the OPTION "ignore_device" should be used. + +After removal of the reorder queue, events with a TIMEOUT can be executed +without any queuing now. + udev 073 ======== Fixed bug in udevd, if inotify is not available. We depend on netlink -- cgit v1.2.3-54-g00ecf From 09c2bab517c58d9447660a9584822c8de6b641f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 8 Nov 2005 03:07:04 +0100 Subject: forgot the ChangeLog for 074 --- ChangeLog | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2a81a68166..e6fd84f582 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Summary of changes from v73 to v074 +============================================ + +Kay Sievers: + never queue events with TIMEOUT set + let NAME="" supress node creation, but do RUN keys + remove udevinitsend + update .gitignore + +Marco d'Itri: + add strerror() to error logs + move some logging from dbg() to info() + + Summary of changes from v72 to v073 ============================================ -- cgit v1.2.3-54-g00ecf From accff726856a0b3258a413d823a534f4f437e6b2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Nov 2005 15:08:45 +0100 Subject: volume_id: provide libvolume_id.a file Signed-off-by: Kay Sievers --- extras/volume_id/Makefile | 14 +- extras/volume_id/libvolume_id/Makefile | 66 +++++ extras/volume_id/libvolume_id/cramfs.c | 65 +++++ extras/volume_id/libvolume_id/ext.c | 116 +++++++++ extras/volume_id/libvolume_id/fat.c | 353 ++++++++++++++++++++++++++ extras/volume_id/libvolume_id/hfs.c | 298 ++++++++++++++++++++++ extras/volume_id/libvolume_id/highpoint.c | 97 ++++++++ extras/volume_id/libvolume_id/hpfs.c | 57 +++++ extras/volume_id/libvolume_id/iso9660.c | 125 ++++++++++ extras/volume_id/libvolume_id/isw_raid.c | 67 +++++ extras/volume_id/libvolume_id/jfs.c | 66 +++++ extras/volume_id/libvolume_id/linux_raid.c | 88 +++++++ extras/volume_id/libvolume_id/linux_swap.c | 77 ++++++ extras/volume_id/libvolume_id/logging.h | 24 ++ extras/volume_id/libvolume_id/lsi_raid.c | 61 +++++ extras/volume_id/libvolume_id/luks.c | 83 +++++++ extras/volume_id/libvolume_id/lvm.c | 98 ++++++++ extras/volume_id/libvolume_id/mac.c | 132 ++++++++++ extras/volume_id/libvolume_id/minix.c | 85 +++++++ extras/volume_id/libvolume_id/msdos.c | 203 +++++++++++++++ extras/volume_id/libvolume_id/ntfs.c | 195 +++++++++++++++ extras/volume_id/libvolume_id/nvidia_raid.c | 65 +++++ extras/volume_id/libvolume_id/ocfs.c | 193 +++++++++++++++ extras/volume_id/libvolume_id/promise_raid.c | 71 ++++++ extras/volume_id/libvolume_id/reiserfs.c | 119 +++++++++ extras/volume_id/libvolume_id/romfs.c | 61 +++++ extras/volume_id/libvolume_id/silicon_raid.c | 78 ++++++ extras/volume_id/libvolume_id/sysv.c | 134 ++++++++++ extras/volume_id/libvolume_id/udf.c | 179 ++++++++++++++ extras/volume_id/libvolume_id/ufs.c | 211 ++++++++++++++++ extras/volume_id/libvolume_id/util.c | 276 +++++++++++++++++++++ extras/volume_id/libvolume_id/util.h | 93 +++++++ extras/volume_id/libvolume_id/via_raid.c | 76 ++++++ extras/volume_id/libvolume_id/volume_id.c | 200 +++++++++++++++ extras/volume_id/libvolume_id/volume_id.h | 116 +++++++++ extras/volume_id/libvolume_id/vxfs.c | 55 +++++ extras/volume_id/libvolume_id/xfs.c | 66 +++++ extras/volume_id/vol_id.c | 2 +- extras/volume_id/volume_id/Makefile.inc | 66 ----- extras/volume_id/volume_id/cramfs.c | 66 ----- extras/volume_id/volume_id/cramfs.h | 16 -- extras/volume_id/volume_id/ext.c | 117 --------- extras/volume_id/volume_id/ext.h | 16 -- extras/volume_id/volume_id/fat.c | 354 --------------------------- extras/volume_id/volume_id/fat.h | 16 -- extras/volume_id/volume_id/hfs.c | 299 ---------------------- extras/volume_id/volume_id/hfs.h | 16 -- extras/volume_id/volume_id/highpoint.c | 98 -------- extras/volume_id/volume_id/highpoint.h | 17 -- extras/volume_id/volume_id/hpfs.c | 58 ----- extras/volume_id/volume_id/hpfs.h | 16 -- extras/volume_id/volume_id/iso9660.c | 126 ---------- extras/volume_id/volume_id/iso9660.h | 16 -- extras/volume_id/volume_id/isw_raid.c | 68 ----- extras/volume_id/volume_id/isw_raid.h | 16 -- extras/volume_id/volume_id/jfs.c | 67 ----- extras/volume_id/volume_id/jfs.h | 16 -- extras/volume_id/volume_id/linux_raid.c | 89 ------- extras/volume_id/volume_id/linux_raid.h | 16 -- extras/volume_id/volume_id/linux_swap.c | 78 ------ extras/volume_id/volume_id/linux_swap.h | 16 -- extras/volume_id/volume_id/logging.h | 24 -- extras/volume_id/volume_id/lsi_raid.c | 62 ----- extras/volume_id/volume_id/lsi_raid.h | 16 -- extras/volume_id/volume_id/luks.c | 84 ------- extras/volume_id/volume_id/luks.h | 16 -- extras/volume_id/volume_id/lvm.c | 99 -------- extras/volume_id/volume_id/lvm.h | 17 -- extras/volume_id/volume_id/mac.c | 133 ---------- extras/volume_id/volume_id/mac.h | 16 -- extras/volume_id/volume_id/minix.c | 86 ------- extras/volume_id/volume_id/minix.h | 16 -- extras/volume_id/volume_id/msdos.c | 204 --------------- extras/volume_id/volume_id/msdos.h | 16 -- extras/volume_id/volume_id/ntfs.c | 196 --------------- extras/volume_id/volume_id/ntfs.h | 16 -- extras/volume_id/volume_id/nvidia_raid.c | 66 ----- extras/volume_id/volume_id/nvidia_raid.h | 16 -- extras/volume_id/volume_id/ocfs.c | 194 --------------- extras/volume_id/volume_id/ocfs.h | 18 -- extras/volume_id/volume_id/promise_raid.c | 72 ------ extras/volume_id/volume_id/promise_raid.h | 16 -- extras/volume_id/volume_id/reiserfs.c | 120 --------- extras/volume_id/volume_id/reiserfs.h | 16 -- extras/volume_id/volume_id/romfs.c | 62 ----- extras/volume_id/volume_id/romfs.h | 16 -- extras/volume_id/volume_id/silicon_raid.c | 79 ------ extras/volume_id/volume_id/silicon_raid.h | 16 -- extras/volume_id/volume_id/sysv.c | 135 ---------- extras/volume_id/volume_id/sysv.h | 16 -- extras/volume_id/volume_id/udf.c | 180 -------------- extras/volume_id/volume_id/udf.h | 16 -- extras/volume_id/volume_id/ufs.c | 212 ---------------- extras/volume_id/volume_id/ufs.h | 16 -- extras/volume_id/volume_id/util.c | 276 --------------------- extras/volume_id/volume_id/util.h | 93 ------- extras/volume_id/volume_id/via_raid.c | 77 ------ extras/volume_id/volume_id/via_raid.h | 16 -- extras/volume_id/volume_id/volume_id.c | 252 ------------------- extras/volume_id/volume_id/volume_id.h | 74 ------ extras/volume_id/volume_id/vxfs.c | 56 ----- extras/volume_id/volume_id/vxfs.h | 16 -- extras/volume_id/volume_id/xfs.c | 67 ----- extras/volume_id/volume_id/xfs.h | 16 -- 104 files changed, 4357 insertions(+), 4881 deletions(-) create mode 100644 extras/volume_id/libvolume_id/Makefile create mode 100644 extras/volume_id/libvolume_id/cramfs.c create mode 100644 extras/volume_id/libvolume_id/ext.c create mode 100644 extras/volume_id/libvolume_id/fat.c create mode 100644 extras/volume_id/libvolume_id/hfs.c create mode 100644 extras/volume_id/libvolume_id/highpoint.c create mode 100644 extras/volume_id/libvolume_id/hpfs.c create mode 100644 extras/volume_id/libvolume_id/iso9660.c create mode 100644 extras/volume_id/libvolume_id/isw_raid.c create mode 100644 extras/volume_id/libvolume_id/jfs.c create mode 100644 extras/volume_id/libvolume_id/linux_raid.c create mode 100644 extras/volume_id/libvolume_id/linux_swap.c create mode 100644 extras/volume_id/libvolume_id/logging.h create mode 100644 extras/volume_id/libvolume_id/lsi_raid.c create mode 100644 extras/volume_id/libvolume_id/luks.c create mode 100644 extras/volume_id/libvolume_id/lvm.c create mode 100644 extras/volume_id/libvolume_id/mac.c create mode 100644 extras/volume_id/libvolume_id/minix.c create mode 100644 extras/volume_id/libvolume_id/msdos.c create mode 100644 extras/volume_id/libvolume_id/ntfs.c create mode 100644 extras/volume_id/libvolume_id/nvidia_raid.c create mode 100644 extras/volume_id/libvolume_id/ocfs.c create mode 100644 extras/volume_id/libvolume_id/promise_raid.c create mode 100644 extras/volume_id/libvolume_id/reiserfs.c create mode 100644 extras/volume_id/libvolume_id/romfs.c create mode 100644 extras/volume_id/libvolume_id/silicon_raid.c create mode 100644 extras/volume_id/libvolume_id/sysv.c create mode 100644 extras/volume_id/libvolume_id/udf.c create mode 100644 extras/volume_id/libvolume_id/ufs.c create mode 100644 extras/volume_id/libvolume_id/util.c create mode 100644 extras/volume_id/libvolume_id/util.h create mode 100644 extras/volume_id/libvolume_id/via_raid.c create mode 100644 extras/volume_id/libvolume_id/volume_id.c create mode 100644 extras/volume_id/libvolume_id/volume_id.h create mode 100644 extras/volume_id/libvolume_id/vxfs.c create mode 100644 extras/volume_id/libvolume_id/xfs.c delete mode 100644 extras/volume_id/volume_id/Makefile.inc delete mode 100644 extras/volume_id/volume_id/cramfs.c delete mode 100644 extras/volume_id/volume_id/cramfs.h delete mode 100644 extras/volume_id/volume_id/ext.c delete mode 100644 extras/volume_id/volume_id/ext.h delete mode 100644 extras/volume_id/volume_id/fat.c delete mode 100644 extras/volume_id/volume_id/fat.h delete mode 100644 extras/volume_id/volume_id/hfs.c delete mode 100644 extras/volume_id/volume_id/hfs.h delete mode 100644 extras/volume_id/volume_id/highpoint.c delete mode 100644 extras/volume_id/volume_id/highpoint.h delete mode 100644 extras/volume_id/volume_id/hpfs.c delete mode 100644 extras/volume_id/volume_id/hpfs.h delete mode 100644 extras/volume_id/volume_id/iso9660.c delete mode 100644 extras/volume_id/volume_id/iso9660.h delete mode 100644 extras/volume_id/volume_id/isw_raid.c delete mode 100644 extras/volume_id/volume_id/isw_raid.h delete mode 100644 extras/volume_id/volume_id/jfs.c delete mode 100644 extras/volume_id/volume_id/jfs.h delete mode 100644 extras/volume_id/volume_id/linux_raid.c delete mode 100644 extras/volume_id/volume_id/linux_raid.h delete mode 100644 extras/volume_id/volume_id/linux_swap.c delete mode 100644 extras/volume_id/volume_id/linux_swap.h delete mode 100644 extras/volume_id/volume_id/logging.h delete mode 100644 extras/volume_id/volume_id/lsi_raid.c delete mode 100644 extras/volume_id/volume_id/lsi_raid.h delete mode 100644 extras/volume_id/volume_id/luks.c delete mode 100644 extras/volume_id/volume_id/luks.h delete mode 100644 extras/volume_id/volume_id/lvm.c delete mode 100644 extras/volume_id/volume_id/lvm.h delete mode 100644 extras/volume_id/volume_id/mac.c delete mode 100644 extras/volume_id/volume_id/mac.h delete mode 100644 extras/volume_id/volume_id/minix.c delete mode 100644 extras/volume_id/volume_id/minix.h delete mode 100644 extras/volume_id/volume_id/msdos.c delete mode 100644 extras/volume_id/volume_id/msdos.h delete mode 100644 extras/volume_id/volume_id/ntfs.c delete mode 100644 extras/volume_id/volume_id/ntfs.h delete mode 100644 extras/volume_id/volume_id/nvidia_raid.c delete mode 100644 extras/volume_id/volume_id/nvidia_raid.h delete mode 100644 extras/volume_id/volume_id/ocfs.c delete mode 100644 extras/volume_id/volume_id/ocfs.h delete mode 100644 extras/volume_id/volume_id/promise_raid.c delete mode 100644 extras/volume_id/volume_id/promise_raid.h delete mode 100644 extras/volume_id/volume_id/reiserfs.c delete mode 100644 extras/volume_id/volume_id/reiserfs.h delete mode 100644 extras/volume_id/volume_id/romfs.c delete mode 100644 extras/volume_id/volume_id/romfs.h delete mode 100644 extras/volume_id/volume_id/silicon_raid.c delete mode 100644 extras/volume_id/volume_id/silicon_raid.h delete mode 100644 extras/volume_id/volume_id/sysv.c delete mode 100644 extras/volume_id/volume_id/sysv.h delete mode 100644 extras/volume_id/volume_id/udf.c delete mode 100644 extras/volume_id/volume_id/udf.h delete mode 100644 extras/volume_id/volume_id/ufs.c delete mode 100644 extras/volume_id/volume_id/ufs.h delete mode 100644 extras/volume_id/volume_id/util.c delete mode 100644 extras/volume_id/volume_id/util.h delete mode 100644 extras/volume_id/volume_id/via_raid.c delete mode 100644 extras/volume_id/volume_id/via_raid.h delete mode 100644 extras/volume_id/volume_id/volume_id.c delete mode 100644 extras/volume_id/volume_id/volume_id.h delete mode 100644 extras/volume_id/volume_id/vxfs.c delete mode 100644 extras/volume_id/volume_id/vxfs.h delete mode 100644 extras/volume_id/volume_id/xfs.c delete mode 100644 extras/volume_id/volume_id/xfs.h diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 23de2ba091..30c0abb9a4 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -5,12 +5,8 @@ # Released under the GNU General Public License, version 2. # -VOLUME_ID_BASE=volume_id -include $(VOLUME_ID_BASE)/Makefile.inc - PROG = vol_id -OBJS = $(VOLUME_ID_OBJS) -HEADERS = $(VOLUME_ID_HEADERS) +LIBVOLUME_ID = libvolume_id/libvolume_id.a GEN_HEADERS = MAN_PAGES = @@ -36,8 +32,11 @@ all: $(PROG) $(MAN_PAGES) %.o: %.c $(GEN_HEADERS) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +$(LIBVOLUME_ID): + $(MAKE) -C libvolume_id + +$(PROG): %: $(HEADERS) %.o $(LIBVOLUME_ID) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(LIBVOLUME_ID) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif @@ -49,6 +48,7 @@ endif clean: rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(MAKE) -C libvolume_id clean .PHONY: clean install-bin: all diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile new file mode 100644 index 0000000000..02c24eae05 --- /dev/null +++ b/extras/volume_id/libvolume_id/Makefile @@ -0,0 +1,66 @@ +# Makefile for udev extra invoked from the udev main Makefile +# +# Copyright (C) 2004-2005 Kay Sievers +# +# Released under the GNU General Public License, version 2. +# + +LIBVOLUME_ID = libvolume_id.a + +OBJS= \ + ext.o \ + fat.o \ + hfs.o \ + highpoint.o \ + isw_raid.o \ + lsi_raid.o \ + via_raid.o \ + silicon_raid.o \ + nvidia_raid.o \ + promise_raid.o \ + iso9660.o \ + jfs.o \ + linux_raid.o \ + linux_swap.o \ + lvm.o \ + mac.o \ + msdos.o \ + ntfs.o \ + reiserfs.o \ + udf.o \ + ufs.o \ + xfs.o \ + cramfs.o \ + hpfs.o \ + romfs.o \ + sysv.o \ + minix.o \ + luks.o \ + ocfs.o \ + vxfs.o \ + volume_id.o \ + util.o + +HEADERS= \ + volume_id.h \ + util.h + +AR = $(CROSS)ar +RANLIB = $(CROSS)ranlib + +all: $(LIBVOLUME_ID) +.PHONY: all +.DEFAULT: all + +%.o: %.c + $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + +$(LIBVOLUME_ID): $(HEADERS) $(OBJS) + @rm -f $@ + $(QUIET) $(AR) cq $@ $(OBJS) + $(QUIET) $(RANLIB) $@ + +clean: + rm -f $(LIBVOLUME_ID) $(OBJS) +.PHONY: clean + diff --git a/extras/volume_id/libvolume_id/cramfs.c b/extras/volume_id/libvolume_id/cramfs.c new file mode 100644 index 0000000000..0ad5886b32 --- /dev/null +++ b/extras/volume_id/libvolume_id/cramfs.c @@ -0,0 +1,65 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct cramfs_super { + uint8_t magic[4]; + uint32_t size; + uint32_t flags; + uint32_t future; + uint8_t signature[16]; + struct cramfs_info { + uint32_t crc; + uint32_t edition; + uint32_t blocks; + uint32_t files; + } __attribute__((__packed__)) info; + uint8_t name[16]; +} __attribute__((__packed__)); + +int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) +{ + struct cramfs_super *cs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); + if (cs == NULL) + return -1; + + if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0) { + volume_id_set_label_raw(id, cs->name, 16); + volume_id_set_label_string(id, cs->name, 16); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "cramfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/libvolume_id/ext.c b/extras/volume_id/libvolume_id/ext.c new file mode 100644 index 0000000000..d1f62dfb6f --- /dev/null +++ b/extras/volume_id/libvolume_id/ext.c @@ -0,0 +1,116 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "util.h" +#include "logging.h" + +struct ext2_super_block { + uint32_t s_inodes_count; + uint32_t s_blocks_count; + uint32_t s_r_blocks_count; + uint32_t s_free_blocks_count; + uint32_t s_free_inodes_count; + uint32_t s_first_data_block; + uint32_t s_log_block_size; + uint32_t s_log_frag_size; + uint32_t s_blocks_per_group; + uint32_t s_frags_per_group; + uint32_t s_inodes_per_group; + uint32_t s_mtime; + uint32_t s_wtime; + uint16_t s_mnt_count; + uint16_t s_max_mnt_count; + uint16_t s_magic; + uint16_t s_state; + uint16_t s_errors; + uint16_t s_minor_rev_level; + uint32_t s_lastcheck; + uint32_t s_checkinterval; + uint32_t s_creator_os; + uint32_t s_rev_level; + uint16_t s_def_resuid; + uint16_t s_def_resgid; + uint32_t s_first_ino; + uint16_t s_inode_size; + uint16_t s_block_group_nr; + uint32_t s_feature_compat; + uint32_t s_feature_incompat; + uint32_t s_feature_ro_compat; + uint8_t s_uuid[16]; + uint8_t s_volume_name[16]; +} __attribute__((__packed__)); + +#define EXT_SUPER_MAGIC 0xEF53 +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 +#define EXT_SUPERBLOCK_OFFSET 0x400 + +#define EXT3_MIN_BLOCK_SIZE 0x400 +#define EXT3_MAX_BLOCK_SIZE 0x1000 + +int volume_id_probe_ext(struct volume_id *id, uint64_t off) +{ + struct ext2_super_block *es; + size_t bsize; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); + if (es == NULL) + return -1; + + if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC)) + return -1; + + bsize = 0x400 << le32_to_cpu(es->s_log_block_size); + dbg("ext blocksize 0x%zx", bsize); + if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { + dbg("invalid ext blocksize"); + return -1; + } + + volume_id_set_label_raw(id, es->s_volume_name, 16); + volume_id_set_label_string(id, es->s_volume_name, 16); + volume_id_set_uuid(id, es->s_uuid, UUID_DCE); + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", es->s_rev_level, es->s_minor_rev_level); + + /* check for external journal device */ + if ((le32_to_cpu(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { + volume_id_set_usage(id, VOLUME_ID_OTHER); + id->type = "jbd"; + return 0; + } + + /* check for ext2 / ext3 */ + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + if ((le32_to_cpu(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) + id->type = "ext3"; + else + id->type = "ext2"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/fat.c b/extras/volume_id/libvolume_id/fat.c new file mode 100644 index 0000000000..26d0fe74ab --- /dev/null +++ b/extras/volume_id/libvolume_id/fat.c @@ -0,0 +1,353 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +#define FAT12_MAX 0xff5 +#define FAT16_MAX 0xfff5 +#define FAT_ATTR_VOLUME_ID 0x08 +#define FAT_ATTR_DIR 0x10 +#define FAT_ATTR_LONG_NAME 0x0f +#define FAT_ATTR_MASK 0x3f +#define FAT_ENTRY_FREE 0xe5 + +struct vfat_super_block { + uint8_t boot_jump[3]; + uint8_t sysid[8]; + uint16_t sector_size; + uint8_t sectors_per_cluster; + uint16_t reserved; + uint8_t fats; + uint16_t dir_entries; + uint16_t sectors; + uint8_t media; + uint16_t fat_length; + uint16_t secs_track; + uint16_t heads; + uint32_t hidden; + uint32_t total_sect; + union { + struct fat_super_block { + uint8_t unknown[3]; + uint8_t serno[4]; + uint8_t label[11]; + uint8_t magic[8]; + uint8_t dummy2[192]; + uint8_t pmagic[2]; + } __attribute__((__packed__)) fat; + struct fat32_super_block { + uint32_t fat32_length; + uint16_t flags; + uint8_t version[2]; + uint32_t root_cluster; + uint16_t insfo_sector; + uint16_t backup_boot; + uint16_t reserved2[6]; + uint8_t unknown[3]; + uint8_t serno[4]; + uint8_t label[11]; + uint8_t magic[8]; + uint8_t dummy2[164]; + uint8_t pmagic[2]; + } __attribute__((__packed__)) fat32; + } __attribute__((__packed__)) type; +} __attribute__((__packed__)); + +struct vfat_dir_entry { + uint8_t name[11]; + uint8_t attr; + uint16_t time_creat; + uint16_t date_creat; + uint16_t time_acc; + uint16_t date_acc; + uint16_t cluster_high; + uint16_t time_write; + uint16_t date_write; + uint16_t cluster_low; + uint32_t size; +} __attribute__((__packed__)); + +static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) +{ + unsigned int i; + + for (i = 0; i < count; i++) { + /* end marker */ + if (dir[i].name[0] == 0x00) { + dbg("end of dir"); + break; + } + + /* empty entry */ + if (dir[i].name[0] == FAT_ENTRY_FREE) + continue; + + /* long name */ + if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) + continue; + + if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { + /* labels do not have file data */ + if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) + continue; + + dbg("found ATTR_VOLUME_ID id in root dir"); + return dir[i].name; + } + + dbg("skip dir entry"); + } + + return NULL; +} + +int volume_id_probe_vfat(struct volume_id *id, uint64_t off) +{ + struct vfat_super_block *vs; + struct vfat_dir_entry *dir; + uint16_t sector_size; + uint16_t dir_entries; + uint32_t sect_count; + uint16_t reserved; + uint32_t fat_size; + uint32_t root_cluster; + uint32_t dir_size; + uint32_t cluster_count; + uint16_t fat_length; + uint32_t fat32_length; + uint64_t root_start; + uint32_t start_data_sect; + uint16_t root_dir_entries; + uint8_t *buf; + uint32_t buf_size; + uint8_t *label = NULL; + uint32_t next; + int maxloop; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + /* believe only that's fat, don't trust the version + * the cluster_count will tell us + */ + if (memcmp(vs->sysid, "NTFS", 4) == 0) + return -1; + + if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) + goto valid; + + if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) + goto valid; + + if (memcmp(vs->type.fat.magic, "FAT16 ", 8) == 0) + goto valid; + + if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0) + goto valid; + + if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) + goto valid; + + /* + * There are old floppies out there without a magic, so we check + * for well known values and guess if it's a fat volume + */ + + /* boot jump address check */ + if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && + vs->boot_jump[0] != 0xe9) + return -1; + + /* heads check */ + if (vs->heads == 0) + return -1; + + /* cluster size check*/ + if (vs->sectors_per_cluster == 0 || + (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) + return -1; + + /* media check */ + if (vs->media < 0xf8 && vs->media != 0xf0) + return -1; + + /* fat count*/ + if (vs->fats != 2) + return -1; + +valid: + /* sector size check */ + sector_size = le16_to_cpu(vs->sector_size); + if (sector_size != 0x200 && sector_size != 0x400 && + sector_size != 0x800 && sector_size != 0x1000) + return -1; + + dbg("sector_size 0x%x", sector_size); + dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); + + dir_entries = le16_to_cpu(vs->dir_entries); + reserved = le16_to_cpu(vs->reserved); + dbg("reserved 0x%x", reserved); + + sect_count = le16_to_cpu(vs->sectors); + if (sect_count == 0) + sect_count = le32_to_cpu(vs->total_sect); + dbg("sect_count 0x%x", sect_count); + + fat_length = le16_to_cpu(vs->fat_length); + dbg("fat_length 0x%x", fat_length); + fat32_length = le32_to_cpu(vs->type.fat32.fat32_length); + dbg("fat32_length 0x%x", fat32_length); + + if (fat_length) + fat_size = fat_length * vs->fats; + else if (fat32_length) + fat_size = fat32_length * vs->fats; + else + return -1; + dbg("fat_size 0x%x", fat_size); + + dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + + (sector_size-1)) / sector_size; + dbg("dir_size 0x%x", dir_size); + + cluster_count = sect_count - (reserved + fat_size + dir_size); + cluster_count /= vs->sectors_per_cluster; + dbg("cluster_count 0x%x", cluster_count); + + /* must be FAT32 */ + if (!fat_length && fat32_length) + goto fat32; + + /* cluster_count tells us the format */ + if (cluster_count < FAT12_MAX) + strcpy(id->type_version, "FAT12"); + else if (cluster_count < FAT16_MAX) + strcpy(id->type_version, "FAT16"); + else + goto fat32; + + /* the label may be an attribute in the root directory */ + root_start = (reserved + fat_size) * sector_size; + dbg("root dir start 0x%llx", (unsigned long long) root_start); + root_dir_entries = le16_to_cpu(vs->dir_entries); + dbg("expected entries 0x%x", root_dir_entries); + + buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); + buf = volume_id_get_buffer(id, off + root_start, buf_size); + if (buf == NULL) + goto found; + + dir = (struct vfat_dir_entry*) buf; + + label = get_attr_volume_id(dir, root_dir_entries); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, label, 11); + volume_id_set_label_string(id, label, 11); + } else if (memcmp(vs->type.fat.label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, vs->type.fat.label, 11); + volume_id_set_label_string(id, vs->type.fat.label, 11); + } + volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); + goto found; + +fat32: + strcpy(id->type_version, "FAT32"); + + /* FAT32 root dir is a cluster chain like any other directory */ + buf_size = vs->sectors_per_cluster * sector_size; + root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); + dbg("root dir cluster %u", root_cluster); + start_data_sect = reserved + fat_size; + + next = root_cluster; + maxloop = 100; + while (--maxloop) { + uint32_t next_sect_off; + uint64_t next_off; + uint64_t fat_entry_off; + int count; + + dbg("next cluster %u", next); + next_sect_off = (next - 2) * vs->sectors_per_cluster; + next_off = (start_data_sect + next_sect_off) * sector_size; + dbg("cluster offset 0x%llx", (unsigned long long) next_off); + + /* get cluster */ + buf = volume_id_get_buffer(id, off + next_off, buf_size); + if (buf == NULL) + goto found; + + dir = (struct vfat_dir_entry*) buf; + count = buf_size / sizeof(struct vfat_dir_entry); + dbg("expected entries 0x%x", count); + + label = get_attr_volume_id(dir, count); + if (label) + break; + + /* get FAT entry */ + fat_entry_off = (reserved * sector_size) + (next * sizeof(uint32_t)); + buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); + if (buf == NULL) + goto found; + + /* set next cluster */ + next = le32_to_cpu(*((uint32_t *) buf) & 0x0fffffff); + if (next == 0) + break; + } + if (maxloop == 0) + dbg("reached maximum follow count of root cluster chain, give up"); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, label, 11); + volume_id_set_label_string(id, label, 11); + } else if (memcmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, vs->type.fat32.label, 11); + volume_id_set_label_string(id, vs->type.fat32.label, 11); + } + volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "vfat"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/hfs.c b/extras/volume_id/libvolume_id/hfs.c new file mode 100644 index 0000000000..27a8ac9999 --- /dev/null +++ b/extras/volume_id/libvolume_id/hfs.c @@ -0,0 +1,298 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct hfs_finder_info{ + uint32_t boot_folder; + uint32_t start_app; + uint32_t open_folder; + uint32_t os9_folder; + uint32_t reserved; + uint32_t osx_folder; + uint8_t id[8]; +} __attribute__((__packed__)); + +struct hfs_mdb { + uint8_t signature[2]; + uint32_t cr_date; + uint32_t ls_Mod; + uint16_t atrb; + uint16_t nm_fls; + uint16_t vbm_st; + uint16_t alloc_ptr; + uint16_t nm_al_blks; + uint32_t al_blk_size; + uint32_t clp_size; + uint16_t al_bl_st; + uint32_t nxt_cnid; + uint16_t free_bks; + uint8_t label_len; + uint8_t label[27]; + uint32_t vol_bkup; + uint16_t vol_seq_num; + uint32_t wr_cnt; + uint32_t xt_clump_size; + uint32_t ct_clump_size; + uint16_t num_root_dirs; + uint32_t file_count; + uint32_t dir_count; + struct hfs_finder_info finder_info; + uint8_t embed_sig[2]; + uint16_t embed_startblock; + uint16_t embed_blockcount; +} __attribute__((__packed__)) *hfs; + +struct hfsplus_bnode_descriptor { + uint32_t next; + uint32_t prev; + uint8_t type; + uint8_t height; + uint16_t num_recs; + uint16_t reserved; +} __attribute__((__packed__)); + +struct hfsplus_bheader_record { + uint16_t depth; + uint32_t root; + uint32_t leaf_count; + uint32_t leaf_head; + uint32_t leaf_tail; + uint16_t node_size; +} __attribute__((__packed__)); + +struct hfsplus_catalog_key { + uint16_t key_len; + uint32_t parent_id; + uint16_t unicode_len; + uint8_t unicode[255 * 2]; +} __attribute__((__packed__)); + +struct hfsplus_extent { + uint32_t start_block; + uint32_t block_count; +} __attribute__((__packed__)); + +#define HFSPLUS_EXTENT_COUNT 8 +struct hfsplus_fork { + uint64_t total_size; + uint32_t clump_size; + uint32_t total_blocks; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; +} __attribute__((__packed__)); + +struct hfsplus_vol_header { + uint8_t signature[2]; + uint16_t version; + uint32_t attributes; + uint32_t last_mount_vers; + uint32_t reserved; + uint32_t create_date; + uint32_t modify_date; + uint32_t backup_date; + uint32_t checked_date; + uint32_t file_count; + uint32_t folder_count; + uint32_t blocksize; + uint32_t total_blocks; + uint32_t free_blocks; + uint32_t next_alloc; + uint32_t rsrc_clump_sz; + uint32_t data_clump_sz; + uint32_t next_cnid; + uint32_t write_count; + uint64_t encodings_bmp; + struct hfs_finder_info finder_info; + struct hfsplus_fork alloc_file; + struct hfsplus_fork ext_file; + struct hfsplus_fork cat_file; + struct hfsplus_fork attr_file; + struct hfsplus_fork start_file; +} __attribute__((__packed__)) *hfsplus; + +#define HFS_SUPERBLOCK_OFFSET 0x400 +#define HFS_NODE_LEAF 0xff +#define HFSPLUS_POR_CNID 1 + +int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off) +{ + unsigned int blocksize; + unsigned int cat_block; + unsigned int ext_block_start; + unsigned int ext_block_count; + int ext; + unsigned int leaf_node_head; + unsigned int leaf_node_count; + unsigned int leaf_node_size; + unsigned int leaf_block; + uint64_t leaf_off; + unsigned int alloc_block_size; + unsigned int alloc_first_block; + unsigned int embed_first_block; + unsigned int record_count; + struct hfsplus_bnode_descriptor *descr; + struct hfsplus_bheader_record *bnode; + struct hfsplus_catalog_key *key; + unsigned int label_len; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; + const uint8_t *buf; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + hfs = (struct hfs_mdb *) buf; + if (memcmp(hfs->signature, "BD", 2) != 0) + goto checkplus; + + /* it may be just a hfs wrapper for hfs+ */ + if (memcmp(hfs->embed_sig, "H+", 2) == 0) { + alloc_block_size = be32_to_cpu(hfs->al_blk_size); + dbg("alloc_block_size 0x%x", alloc_block_size); + + alloc_first_block = be16_to_cpu(hfs->al_bl_st); + dbg("alloc_first_block 0x%x", alloc_first_block); + + embed_first_block = be16_to_cpu(hfs->embed_startblock); + dbg("embed_first_block 0x%x", embed_first_block); + + off += (alloc_first_block * 512) + + (embed_first_block * alloc_block_size); + dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + goto checkplus; + } + + if (hfs->label_len > 0 && hfs->label_len < 28) { + volume_id_set_label_raw(id, hfs->label, hfs->label_len); + volume_id_set_label_string(id, hfs->label, hfs->label_len) ; + } + + volume_id_set_uuid(id, hfs->finder_info.id, UUID_HFS); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hfs"; + + return 0; + +checkplus: + hfsplus = (struct hfsplus_vol_header *) buf; + if (memcmp(hfsplus->signature, "H+", 2) == 0) + goto hfsplus; + if (memcmp(hfsplus->signature, "HX", 2) == 0) + goto hfsplus; + return -1; + +hfsplus: + volume_id_set_uuid(id, hfsplus->finder_info.id, UUID_HFS); + + blocksize = be32_to_cpu(hfsplus->blocksize); + dbg("blocksize %u", blocksize); + + memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); + cat_block = be32_to_cpu(extents[0].start_block); + dbg("catalog start block 0x%x", cat_block); + + buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); + if (buf == NULL) + goto found; + + bnode = (struct hfsplus_bheader_record *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + leaf_node_head = be32_to_cpu(bnode->leaf_head); + dbg("catalog leaf node 0x%x", leaf_node_head); + + leaf_node_size = be16_to_cpu(bnode->node_size); + dbg("leaf node size 0x%x", leaf_node_size); + + leaf_node_count = be32_to_cpu(bnode->leaf_count); + dbg("leaf node count 0x%x", leaf_node_count); + if (leaf_node_count == 0) + goto found; + + leaf_block = (leaf_node_head * leaf_node_size) / blocksize; + + /* get physical location */ + for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { + ext_block_start = be32_to_cpu(extents[ext].start_block); + ext_block_count = be32_to_cpu(extents[ext].block_count); + dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); + + if (ext_block_count == 0) + goto found; + + /* this is our extent */ + if (leaf_block < ext_block_count) + break; + + leaf_block -= ext_block_count; + } + if (ext == HFSPLUS_EXTENT_COUNT) + goto found; + dbg("found block in extent %i", ext); + + leaf_off = (ext_block_start + leaf_block) * blocksize; + + buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size); + if (buf == NULL) + goto found; + + descr = (struct hfsplus_bnode_descriptor *) buf; + dbg("descriptor type 0x%x", descr->type); + + record_count = be16_to_cpu(descr->num_recs); + dbg("number of records %u", record_count); + if (record_count == 0) + goto found; + + if (descr->type != HFS_NODE_LEAF) + goto found; + + key = (struct hfsplus_catalog_key *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); + if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) + goto found; + + label_len = be16_to_cpu(key->unicode_len) * 2; + dbg("label unicode16 len %i", label_len); + volume_id_set_label_raw(id, key->unicode, label_len); + volume_id_set_label_unicode16(id, key->unicode, BE, label_len); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hfsplus"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/highpoint.c b/extras/volume_id/libvolume_id/highpoint.c new file mode 100644 index 0000000000..721b7ab26f --- /dev/null +++ b/extras/volume_id/libvolume_id/highpoint.c @@ -0,0 +1,97 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct hpt37x_meta { + uint8_t filler1[32]; + uint32_t magic; +} __attribute__((packed)); + +struct hpt45x_meta { + uint32_t magic; +} __attribute__((packed)); + +#define HPT37X_CONFIG_OFF 0x1200 +#define HPT37X_MAGIC_OK 0x5a7816f0 +#define HPT37X_MAGIC_BAD 0x5a7816fd + +#define HPT45X_MAGIC_OK 0x5a7816f3 +#define HPT45X_MAGIC_BAD 0x5a7816fd + + +int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct hpt37x_meta *hpt; + uint32_t magic; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); + if (buf == NULL) + return -1; + + hpt = (struct hpt37x_meta *) buf; + magic = le32_to_cpu(hpt->magic); + if (magic != HPT37X_MAGIC_OK && magic != HPT37X_MAGIC_BAD) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "highpoint_raid_member"; + + return 0; +} + +int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + struct hpt45x_meta *hpt; + uint64_t meta_off; + uint32_t magic; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-11) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + hpt = (struct hpt45x_meta *) buf; + magic = le32_to_cpu(hpt->magic); + if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "highpoint_raid_member"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/hpfs.c b/extras/volume_id/libvolume_id/hpfs.c new file mode 100644 index 0000000000..52cb47be39 --- /dev/null +++ b/extras/volume_id/libvolume_id/hpfs.c @@ -0,0 +1,57 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct hpfs_super +{ + uint8_t magic[4]; + uint8_t version; +} __attribute__((__packed__)); + +#define HPFS_SUPERBLOCK_OFFSET 0x2000 + +int volume_id_probe_hpfs(struct volume_id *id, uint64_t off) +{ + struct hpfs_super *hs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); + if (hs == NULL) + return -1; + + if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) { + sprintf(id->type_version, "%u", hs->version); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hpfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/libvolume_id/iso9660.c b/extras/volume_id/libvolume_id/iso9660.c new file mode 100644 index 0000000000..b6654cecf2 --- /dev/null +++ b/extras/volume_id/libvolume_id/iso9660.c @@ -0,0 +1,125 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +#define ISO_SUPERBLOCK_OFFSET 0x8000 +#define ISO_SECTOR_SIZE 0x800 +#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) +#define ISO_VD_PRIMARY 0x1 +#define ISO_VD_SUPPLEMENTARY 0x2 +#define ISO_VD_END 0xff +#define ISO_VD_MAX 16 + +struct iso_volume_descriptor { + uint8_t vd_type; + uint8_t vd_id[5]; + uint8_t vd_version; + uint8_t flags; + uint8_t system_id[32]; + uint8_t volume_id[32]; + uint8_t unused[8]; + uint8_t space_size[8]; + uint8_t escape_sequences[8]; +} __attribute__((__packed__)); + +struct high_sierra_volume_descriptor { + uint8_t foo[8]; + uint8_t type; + uint8_t id[4]; + uint8_t version; +} __attribute__((__packed__)); + +int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) +{ + uint8_t *buf; + struct iso_volume_descriptor *is; + struct high_sierra_volume_descriptor *hs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + is = (struct iso_volume_descriptor *) buf; + + if (memcmp(is->vd_id, "CD001", 5) == 0) { + int vd_offset; + int i; + + dbg("read label from PVD"); + volume_id_set_label_raw(id, is->volume_id, 32); + volume_id_set_label_string(id, is->volume_id, 32); + + dbg("looking for SVDs"); + vd_offset = ISO_VD_OFFSET; + for (i = 0; i < ISO_VD_MAX; i++) { + uint8_t svd_label[64]; + + is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200); + if (is == NULL || is->vd_type == ISO_VD_END) + break; + if (is->vd_type != ISO_VD_SUPPLEMENTARY) + continue; + + dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset)); + if (memcmp(is->escape_sequences, "%/@", 3) == 0|| + memcmp(is->escape_sequences, "%/C", 3) == 0|| + memcmp(is->escape_sequences, "%/E", 3) == 0) { + dbg("Joliet extension found"); + volume_id_set_unicode16((char *)svd_label, sizeof(svd_label), is->volume_id, BE, 32); + if (memcmp(id->label, svd_label, 16) == 0) { + dbg("SVD label is identical, use the possibly longer PVD one"); + break; + } + + volume_id_set_label_raw(id, is->volume_id, 32); + volume_id_set_label_string(id, svd_label, 32); + strcpy(id->type_version, "Joliet Extension"); + goto found; + } + vd_offset += ISO_SECTOR_SIZE; + } + goto found; + } + + hs = (struct high_sierra_volume_descriptor *) buf; + + if (memcmp(hs->id, "CDROM", 5) == 0) { + strcpy(id->type_version, "High Sierra"); + goto found; + } + + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "iso9660"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/isw_raid.c b/extras/volume_id/libvolume_id/isw_raid.c new file mode 100644 index 0000000000..1f49959ff9 --- /dev/null +++ b/extras/volume_id/libvolume_id/isw_raid.c @@ -0,0 +1,67 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct isw_meta { + uint8_t sig[32]; + uint32_t check_sum; + uint32_t mpb_size; + uint32_t family_num; + uint32_t generation_num; +} __attribute__((packed)); + +#define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " + + +int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct isw_meta *isw; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-2) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + isw = (struct isw_meta *) buf; + if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + memcpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); + id->type = "isw_raid_member"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/jfs.c b/extras/volume_id/libvolume_id/jfs.c new file mode 100644 index 0000000000..b6ae9624d6 --- /dev/null +++ b/extras/volume_id/libvolume_id/jfs.c @@ -0,0 +1,66 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct jfs_super_block { + uint8_t magic[4]; + uint32_t version; + uint64_t size; + uint32_t bsize; + uint32_t dummy1; + uint32_t pbsize; + uint32_t dummy2[27]; + uint8_t uuid[16]; + uint8_t label[16]; + uint8_t loguuid[16]; +} __attribute__((__packed__)); + +#define JFS_SUPERBLOCK_OFFSET 0x8000 + +int volume_id_probe_jfs(struct volume_id *id, uint64_t off) +{ + struct jfs_super_block *js; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); + if (js == NULL) + return -1; + + if (memcmp(js->magic, "JFS1", 4) != 0) + return -1; + + volume_id_set_label_raw(id, js->label, 16); + volume_id_set_label_string(id, js->label, 16); + volume_id_set_uuid(id, js->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "jfs"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/linux_raid.c b/extras/volume_id/libvolume_id/linux_raid.c new file mode 100644 index 0000000000..d90510a817 --- /dev/null +++ b/extras/volume_id/libvolume_id/linux_raid.c @@ -0,0 +1,88 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct mdp_super_block { + uint32_t md_magic; + uint32_t major_version; + uint32_t minor_version; + uint32_t patch_version; + uint32_t gvalid_words; + uint32_t set_uuid0; + uint32_t ctime; + uint32_t level; + uint32_t size; + uint32_t nr_disks; + uint32_t raid_disks; + uint32_t md_minor; + uint32_t not_persistent; + uint32_t set_uuid1; + uint32_t set_uuid2; + uint32_t set_uuid3; +} __attribute__((packed)) *mdp; + +#define MD_RESERVED_BYTES 0x10000 +#define MD_MAGIC 0xa92b4efc + +int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t sboff; + uint8_t uuid[16]; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; + buf = volume_id_get_buffer(id, off + sboff, 0x800); + if (buf == NULL) + return -1; + + mdp = (struct mdp_super_block *) buf; + + if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) + return -1; + + memcpy(uuid, &mdp->set_uuid0, 4); + memcpy(&uuid[4], &mdp->set_uuid1, 12); + volume_id_set_uuid(id, uuid, UUID_DCE); + + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", + le32_to_cpu(mdp->major_version), + le32_to_cpu(mdp->minor_version), + le32_to_cpu(mdp->patch_version)); + + dbg("found raid signature"); + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "linux_raid_member"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/linux_swap.c b/extras/volume_id/libvolume_id/linux_swap.c new file mode 100644 index 0000000000..18928b8351 --- /dev/null +++ b/extras/volume_id/libvolume_id/linux_swap.c @@ -0,0 +1,77 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct swap_header_v1_2 { + uint8_t bootbits[1024]; + uint32_t version; + uint32_t last_page; + uint32_t nr_badpages; + uint8_t uuid[16]; + uint8_t volume_name[16]; +} __attribute__((__packed__)) *sw; + +#define LARGEST_PAGESIZE 0x4000 + +int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + unsigned int page; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + /* the swap signature is at the end of the PAGE_SIZE */ + for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { + buf = volume_id_get_buffer(id, off + page-10, 10); + if (buf == NULL) + return -1; + + if (memcmp(buf, "SWAP-SPACE", 10) == 0) { + strcpy(id->type_version, "1"); + goto found; + } + + if (memcmp(buf, "SWAPSPACE2", 10) == 0) { + sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); + if (sw == NULL) + return -1; + strcpy(id->type_version, "2"); + volume_id_set_label_raw(id, sw->volume_name, 16); + volume_id_set_label_string(id, sw->volume_name, 16); + volume_id_set_uuid(id, sw->uuid, UUID_DCE); + goto found; + } + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_OTHER); + id->type = "swap"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/logging.h b/extras/volume_id/libvolume_id/logging.h new file mode 100644 index 0000000000..4a8aa50d4c --- /dev/null +++ b/extras/volume_id/libvolume_id/logging.h @@ -0,0 +1,24 @@ +/* + * volume_id_logging - this file is used to map the dbg() function + * to the user's logging facility + * + * 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. + */ + +#ifndef _VOLUME_ID_LOGGING_H_ +#define _VOLUME_ID_LOGGING_H_ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +#include +#endif + +/* just use the udev version */ +#include "../../../logging.h" + +#endif /* _VOLUME_ID_LOGGING_H_ */ diff --git a/extras/volume_id/libvolume_id/lsi_raid.c b/extras/volume_id/libvolume_id/lsi_raid.c new file mode 100644 index 0000000000..2720de763d --- /dev/null +++ b/extras/volume_id/libvolume_id/lsi_raid.c @@ -0,0 +1,61 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct lsi_meta { + uint8_t sig[6]; +} __attribute__((packed)); + +#define LSI_SIGNATURE "$XIDE$" + +int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct lsi_meta *lsi; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + lsi = (struct lsi_meta *) buf; + if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "lsi_mega_raid_member"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/luks.c b/extras/volume_id/libvolume_id/luks.c new file mode 100644 index 0000000000..43f326e176 --- /dev/null +++ b/extras/volume_id/libvolume_id/luks.c @@ -0,0 +1,83 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 W. Michael Petullo + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "util.h" +#include "logging.h" + +#define SECTOR_SHIFT 9 +#define SECTOR_SIZE (1 << SECTOR_SHIFT) + +#define LUKS_CIPHERNAME_L 32 +#define LUKS_CIPHERMODE_L 32 +#define LUKS_HASHSPEC_L 32 +#define LUKS_DIGESTSIZE 20 +#define LUKS_SALTSIZE 32 +#define LUKS_NUMKEYS 8 + +const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; +#define LUKS_MAGIC_L 6 +#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) +#define UUID_STRING_L 40 + +struct luks_phdr { + uint8_t magic[LUKS_MAGIC_L]; + uint16_t version; + uint8_t cipherName[LUKS_CIPHERNAME_L]; + uint8_t cipherMode[LUKS_CIPHERMODE_L]; + uint8_t hashSpec[LUKS_HASHSPEC_L]; + uint32_t payloadOffset; + uint32_t keyBytes; + uint8_t mkDigest[LUKS_DIGESTSIZE]; + uint8_t mkDigestSalt[LUKS_SALTSIZE]; + uint32_t mkDigestIterations; + uint8_t uuid[UUID_STRING_L]; + struct { + uint32_t active; + uint32_t passwordIterations; + uint8_t passwordSalt[LUKS_SALTSIZE]; + uint32_t keyMaterialOffset; + uint32_t stripes; + } keyblock[LUKS_NUMKEYS]; +}; + +int volume_id_probe_luks(struct volume_id *id, uint64_t off) +{ + struct luks_phdr *header; + + header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE); + if (header == NULL) + return -1; + + if (memcmp(header->magic, LUKS_MAGIC, LUKS_MAGIC_L)) + return -1; + + volume_id_set_usage(id, VOLUME_ID_CRYPTO); + volume_id_set_uuid(id, header->uuid, UUID_DCE_STRING); + + id->type = "crypto_LUKS"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/lvm.c b/extras/volume_id/libvolume_id/lvm.c new file mode 100644 index 0000000000..650986256d --- /dev/null +++ b/extras/volume_id/libvolume_id/lvm.c @@ -0,0 +1,98 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct lvm1_super_block { + uint8_t id[2]; +} __attribute__((packed)); + +struct lvm2_super_block { + uint8_t id[8]; + uint64_t sector_xl; + uint32_t crc_xl; + uint32_t offset_xl; + uint8_t type[8]; +} __attribute__((packed)); + +#define LVM1_SB_OFF 0x400 +#define LVM1_MAGIC "HM" + +int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct lvm1_super_block *lvm; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); + if (buf == NULL) + return -1; + + lvm = (struct lvm1_super_block *) buf; + + if (memcmp(lvm->id, LVM1_MAGIC, 2) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "LVM1_member"; + + return 0; +} + +#define LVM2_LABEL_ID "LABELONE" +#define LVM2LABEL_SCAN_SECTORS 4 + +int volume_id_probe_lvm2(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + unsigned int soff; + struct lvm2_super_block *lvm; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); + if (buf == NULL) + return -1; + + + for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { + lvm = (struct lvm2_super_block *) &buf[soff]; + + if (memcmp(lvm->id, LVM2_LABEL_ID, 8) == 0) + goto found; + } + + return -1; + +found: + memcpy(id->type_version, lvm->type, 8); + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "LVM2_member"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/mac.c b/extras/volume_id/libvolume_id/mac.c new file mode 100644 index 0000000000..99bcbde6be --- /dev/null +++ b/extras/volume_id/libvolume_id/mac.c @@ -0,0 +1,132 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct mac_driver_desc { + uint8_t signature[2]; + uint16_t block_size; + uint32_t block_count; +} __attribute__((__packed__)); + +struct mac_partition { + uint8_t signature[2]; + uint16_t res1; + uint32_t map_count; + uint32_t start_block; + uint32_t block_count; + uint8_t name[32]; + uint8_t type[32]; +} __attribute__((__packed__)); + +int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct mac_driver_desc *driver; + struct mac_partition *part; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if ((memcmp(part->signature, "PM", 2) == 0) && + (memcmp(part->type, "Apple_partition_map", 19) == 0)) { + /* linux creates an own subdevice for the map + * just return the type if the drive header is missing */ + volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); + id->type = "mac_partition_map"; + return 0; + } + + driver = (struct mac_driver_desc *) buf; + if (memcmp(driver->signature, "ER", 2) == 0) { + /* we are on a main device, like a CD + * just try to probe the first partition from the map */ + unsigned int bsize = be16_to_cpu(driver->block_size); + int part_count; + int i; + + /* get first entry of partition table */ + buf = volume_id_get_buffer(id, off + bsize, 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if (memcmp(part->signature, "PM", 2) != 0) + return -1; + + part_count = be32_to_cpu(part->map_count); + dbg("expecting %d partition entries", part_count); + + if (id->partitions != NULL) + free(id->partitions); + id->partitions = + malloc(part_count * sizeof(struct volume_id_partition)); + if (id->partitions == NULL) + return -1; + memset(id->partitions, 0x00, sizeof(struct volume_id_partition)); + + id->partition_count = part_count; + + for (i = 0; i < part_count; i++) { + uint64_t poff; + uint64_t plen; + + buf = volume_id_get_buffer(id, off + ((i+1) * bsize), 0x200); + if (buf == NULL) + return -1; + + part = (struct mac_partition *) buf; + if (memcmp(part->signature, "PM", 2) != 0) + return -1; + + poff = be32_to_cpu(part->start_block) * bsize; + plen = be32_to_cpu(part->block_count) * bsize; + dbg("found '%s' partition entry at 0x%llx, len 0x%llx", + part->type, (unsigned long long) poff, (unsigned long long) plen); + + id->partitions[i].off = poff; + id->partitions[i].len = plen; + + if (memcmp(part->type, "Apple_Free", 10) == 0) { + volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED); + } else if (memcmp(part->type, "Apple_partition_map", 19) == 0) { + volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE); + } else { + volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED); + } + } + volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); + id->type = "mac_partition_map"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/libvolume_id/minix.c b/extras/volume_id/libvolume_id/minix.c new file mode 100644 index 0000000000..ca57745f78 --- /dev/null +++ b/extras/volume_id/libvolume_id/minix.c @@ -0,0 +1,85 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct minix_super_block +{ + uint16_t s_ninodes; + uint16_t s_nzones; + uint16_t s_imap_blocks; + uint16_t s_zmap_blocks; + uint16_t s_firstdatazone; + uint16_t s_log_zone_size; + uint32_t s_max_size; + uint16_t s_magic; + uint16_t s_state; + uint32_t s_zones; +} __attribute__((__packed__)); + +#define MINIX_SUPERBLOCK_OFFSET 0x400 + +int volume_id_probe_minix(struct volume_id *id, uint64_t off) +{ + struct minix_super_block *ms; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + ms = (struct minix_super_block *) volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); + if (ms == NULL) + return -1; + + if (le16_to_cpu(ms->s_magic) == 0x137f) { + strcpy(id->type_version, "1"); + goto found; + } + + if (le16_to_cpu(ms->s_magic) == 0x1387) { + strcpy(id->type_version, "1"); + goto found; + } + + if (le16_to_cpu(ms->s_magic) == 0x2468) { + strcpy(id->type_version, "2"); + goto found; + } + + if (le16_to_cpu(ms->s_magic) == 0x2478) { + strcpy(id->type_version, "2"); + goto found; + } + + goto exit; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "minix"; + return 0; + +exit: + return -1; +} diff --git a/extras/volume_id/libvolume_id/msdos.c b/extras/volume_id/libvolume_id/msdos.c new file mode 100644 index 0000000000..a66046052a --- /dev/null +++ b/extras/volume_id/libvolume_id/msdos.c @@ -0,0 +1,203 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct msdos_partition_entry { + uint8_t boot_ind; + uint8_t head; + uint8_t sector; + uint8_t cyl; + uint8_t sys_ind; + uint8_t end_head; + uint8_t end_sector; + uint8_t end_cyl; + uint32_t start_sect; + uint32_t nr_sects; +} __attribute__((packed)); + +#define MSDOS_MAGIC "\x55\xaa" +#define MSDOS_PARTTABLE_OFFSET 0x1be +#define MSDOS_SIG_OFF 0x1fe +#define BSIZE 0x200 +#define DOS_EXTENDED_PARTITION 0x05 +#define LINUX_EXTENDED_PARTITION 0x85 +#define WIN98_EXTENDED_PARTITION 0x0f +#define LINUX_RAID_PARTITION 0xfd +#define is_extended(type) \ + (type == DOS_EXTENDED_PARTITION || \ + type == WIN98_EXTENDED_PARTITION || \ + type == LINUX_EXTENDED_PARTITION) +#define is_raid(type) \ + (type == LINUX_RAID_PARTITION) + +int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + int i; + uint64_t poff; + uint64_t plen; + uint64_t extended = 0; + uint64_t current; + uint64_t next; + int limit; + int empty = 1; + struct msdos_partition_entry *part; + struct volume_id_partition *p; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + return -1; + + /* check flags on all entries for a valid partition table */ + part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; + for (i = 0; i < 4; i++) { + if (part[i].boot_ind != 0 && + part[i].boot_ind != 0x80) + return -1; + + if (le32_to_cpu(part[i].nr_sects) != 0) + empty = 0; + } + if (empty == 1) + return -1; + + if (id->partitions != NULL) + free(id->partitions); + id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX * + sizeof(struct volume_id_partition)); + if (id->partitions == NULL) + return -1; + memset(id->partitions, 0x00, + VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); + + for (i = 0; i < 4; i++) { + poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; + + if (plen == 0) + continue; + + p = &id->partitions[i]; + + p->partition_type_raw = part[i].sys_ind; + + if (is_extended(part[i].sys_ind)) { + dbg("found extended partition at 0x%llx", (unsigned long long) poff); + volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE); + p->type = "msdos_extended_partition"; + if (extended == 0) + extended = off + poff; + } else { + dbg("found 0x%x data partition at 0x%llx, len 0x%llx", + part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen); + + if (is_raid(part[i].sys_ind)) + volume_id_set_usage_part(p, VOLUME_ID_RAID); + else + volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); + } + + p->off = off + poff; + p->len = plen; + id->partition_count = i+1; + } + + next = extended; + current = extended; + limit = 50; + + /* follow extended partition chain and add data partitions */ + while (next != 0) { + if (limit-- == 0) { + dbg("extended chain limit reached"); + break; + } + + buf = volume_id_get_buffer(id, current, 0x200); + if (buf == NULL) + break; + + part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; + + if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) + break; + + next = 0; + + for (i = 0; i < 4; i++) { + poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; + plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; + + if (plen == 0) + continue; + + if (is_extended(part[i].sys_ind)) { + dbg("found extended partition at 0x%llx", (unsigned long long) poff); + if (next == 0) + next = extended + poff; + } else { + dbg("found 0x%x data partition at 0x%llx, len 0x%llx", + part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen); + + /* we always start at the 5th entry */ + while (id->partition_count < 4) + volume_id_set_usage_part(&id->partitions[id->partition_count++], VOLUME_ID_UNUSED); + + p = &id->partitions[id->partition_count]; + + if (is_raid(part[i].sys_ind)) + volume_id_set_usage_part(p, VOLUME_ID_RAID); + else + volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); + + p->off = current + poff; + p->len = plen; + id->partition_count++; + + p->partition_type_raw = part[i].sys_ind; + + if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { + dbg("too many partitions"); + next = 0; + } + } + } + + current = next; + } + + volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); + id->type = "msdos_partition_table"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/ntfs.c b/extras/volume_id/libvolume_id/ntfs.c new file mode 100644 index 0000000000..de9ad6d654 --- /dev/null +++ b/extras/volume_id/libvolume_id/ntfs.c @@ -0,0 +1,195 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct ntfs_super_block { + uint8_t jump[3]; + uint8_t oem_id[8]; + uint16_t bytes_per_sector; + uint8_t sectors_per_cluster; + uint16_t reserved_sectors; + uint8_t fats; + uint16_t root_entries; + uint16_t sectors; + uint8_t media_type; + uint16_t sectors_per_fat; + uint16_t sectors_per_track; + uint16_t heads; + uint32_t hidden_sectors; + uint32_t large_sectors; + uint16_t unused[2]; + uint64_t number_of_sectors; + uint64_t mft_cluster_location; + uint64_t mft_mirror_cluster_location; + int8_t cluster_per_mft_record; + uint8_t reserved1[3]; + int8_t cluster_per_index_record; + uint8_t reserved2[3]; + uint8_t volume_serial[8]; + uint16_t checksum; +} __attribute__((__packed__)) *ns; + +struct master_file_table_record { + uint8_t magic[4]; + uint16_t usa_ofs; + uint16_t usa_count; + uint64_t lsn; + uint16_t sequence_number; + uint16_t link_count; + uint16_t attrs_offset; + uint16_t flags; + uint32_t bytes_in_use; + uint32_t bytes_allocated; +} __attribute__((__packed__)) *mftr; + +struct file_attribute { + uint32_t type; + uint32_t len; + uint8_t non_resident; + uint8_t name_len; + uint16_t name_offset; + uint16_t flags; + uint16_t instance; + uint32_t value_len; + uint16_t value_offset; +} __attribute__((__packed__)) *attr; + +struct volume_info { + uint64_t reserved; + uint8_t major_ver; + uint8_t minor_ver; +} __attribute__((__packed__)) *info; + +#define MFT_RECORD_VOLUME 3 +#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 +#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 +#define MFT_RECORD_ATTR_OBJECT_ID 0x40 +#define MFT_RECORD_ATTR_END 0xffffffffu + +int volume_id_probe_ntfs(struct volume_id *id, uint64_t off) +{ + unsigned int sector_size; + unsigned int cluster_size; + uint64_t mft_cluster; + uint64_t mft_off; + unsigned int mft_record_size; + unsigned int attr_type; + unsigned int attr_off; + unsigned int attr_len; + unsigned int val_off; + unsigned int val_len; + const uint8_t *buf; + const uint8_t *val; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); + if (ns == NULL) + return -1; + + if (memcmp(ns->oem_id, "NTFS", 4) != 0) + return -1; + + volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS); + + sector_size = le16_to_cpu(ns->bytes_per_sector); + cluster_size = ns->sectors_per_cluster * sector_size; + mft_cluster = le64_to_cpu(ns->mft_cluster_location); + mft_off = mft_cluster * cluster_size; + + if (ns->cluster_per_mft_record < 0) + /* size = -log2(mft_record_size); normally 1024 Bytes */ + mft_record_size = 1 << -ns->cluster_per_mft_record; + else + mft_record_size = ns->cluster_per_mft_record * cluster_size; + + dbg("sectorsize 0x%x", sector_size); + dbg("clustersize 0x%x", cluster_size); + dbg("mftcluster %llu", (unsigned long long) mft_cluster); + dbg("mftoffset 0x%llx", (unsigned long long) mft_off); + dbg("cluster per mft_record %i", ns->cluster_per_mft_record); + dbg("mft record size %i", mft_record_size); + + buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), + mft_record_size); + if (buf == NULL) + goto found; + + mftr = (struct master_file_table_record*) buf; + + dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); + if (memcmp(mftr->magic, "FILE", 4) != 0) + goto found; + + attr_off = le16_to_cpu(mftr->attrs_offset); + dbg("file $Volume's attributes are at offset %i", attr_off); + + while (1) { + attr = (struct file_attribute*) &buf[attr_off]; + attr_type = le32_to_cpu(attr->type); + attr_len = le16_to_cpu(attr->len); + val_off = le16_to_cpu(attr->value_offset); + val_len = le32_to_cpu(attr->value_len); + attr_off += attr_len; + + if (attr_len == 0) + break; + + if (attr_off >= mft_record_size) + break; + + if (attr_type == MFT_RECORD_ATTR_END) + break; + + dbg("found attribute type 0x%x, len %i, at offset %i", + attr_type, attr_len, attr_off); + + if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { + dbg("found info, len %i", val_len); + info = (struct volume_info*) (((uint8_t *) attr) + val_off); + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", info->major_ver, info->minor_ver); + } + + if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { + dbg("found label, len %i", val_len); + if (val_len > VOLUME_ID_LABEL_SIZE) + val_len = VOLUME_ID_LABEL_SIZE; + + val = ((uint8_t *) attr) + val_off; + volume_id_set_label_raw(id, val, val_len); + volume_id_set_label_unicode16(id, val, LE, val_len); + } + } + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "ntfs"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/nvidia_raid.c b/extras/volume_id/libvolume_id/nvidia_raid.c new file mode 100644 index 0000000000..3b967e6979 --- /dev/null +++ b/extras/volume_id/libvolume_id/nvidia_raid.c @@ -0,0 +1,65 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct nvidia_meta { + uint8_t vendor[8]; + uint32_t size; + uint32_t chksum; + uint16_t version; +} __attribute__((packed)); + +#define NVIDIA_SIGNATURE "NVIDIA" + +int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct nvidia_meta *nv; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-2) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + nv = (struct nvidia_meta *) buf; + if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le16_to_cpu(nv->version)); + id->type = "nvidia_raid_member"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/ocfs.c b/extras/volume_id/libvolume_id/ocfs.c new file mode 100644 index 0000000000..faf89bd3e0 --- /dev/null +++ b/extras/volume_id/libvolume_id/ocfs.c @@ -0,0 +1,193 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Andre Masella + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + + +struct ocfs1_super_block_header { + uint32_t minor_version; + uint32_t major_version; + uint8_t signature[128]; + uint8_t mount_point[128]; + uint64_t serial_num; + uint64_t device_size; + uint64_t start_off; + uint64_t bitmap_off; + uint64_t publ_off; + uint64_t vote_off; + uint64_t root_bitmap_off; + uint64_t data_start_off; + uint64_t root_bitmap_size; + uint64_t root_off; + uint64_t root_size; + uint64_t cluster_size; + uint64_t num_nodes; + uint64_t num_clusters; + uint64_t dir_node_size; + uint64_t file_node_size; + uint64_t internal_off; + uint64_t node_cfg_off; + uint64_t node_cfg_size; + uint64_t new_cfg_off; + uint32_t prot_bits; + int32_t excl_mount; +} __attribute__((__packed__)); + +struct ocfs1_super_block_label { + struct ocfs1_disk_lock { + uint32_t curr_master; + uint8_t file_lock; + uint8_t compat_pad[3]; + uint64_t last_write_time; + uint64_t last_read_time; + uint32_t writer_node_num; + uint32_t reader_node_num; + uint64_t oin_node_map; + uint64_t dlock_seq_num; + } disk_lock __attribute__((__packed__)); + uint8_t label[64]; + uint16_t label_len; + uint8_t vol_id[16]; + uint16_t vol_id_len; + uint8_t cluster_name[64]; + uint16_t cluster_name_len; +} __attribute__((__packed__)); + +struct ocfs2_super_block { + uint8_t i_signature[8]; + uint32_t i_generation; + int16_t i_suballoc_slot; + uint16_t i_suballoc_bit; + uint32_t i_reserved0; + uint32_t i_clusters; + uint32_t i_uid; + uint32_t i_gid; + uint64_t i_size; + uint16_t i_mode; + uint16_t i_links_count; + uint32_t i_flags; + uint64_t i_atime; + uint64_t i_ctime; + uint64_t i_mtime; + uint64_t i_dtime; + uint64_t i_blkno; + uint64_t i_last_eb_blk; + uint32_t i_fs_generation; + uint32_t i_atime_nsec; + uint32_t i_ctime_nsec; + uint32_t i_mtime_nsec; + uint64_t i_reserved1[9]; + uint64_t i_pad1; + uint16_t s_major_rev_level; + uint16_t s_minor_rev_level; + uint16_t s_mnt_count; + int16_t s_max_mnt_count; + uint16_t s_state; + uint16_t s_errors; + uint32_t s_checkinterval; + uint64_t s_lastcheck; + uint32_t s_creator_os; + uint32_t s_feature_compat; + uint32_t s_feature_incompat; + uint32_t s_feature_ro_compat; + uint64_t s_root_blkno; + uint64_t s_system_dir_blkno; + uint32_t s_blocksize_bits; + uint32_t s_clustersize_bits; + uint16_t s_max_slots; + uint16_t s_reserved1; + uint32_t s_reserved2; + uint64_t s_first_cluster_group; + uint8_t s_label[64]; + uint8_t s_uuid[16]; +} __attribute__((__packed__)); + +int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct ocfs1_super_block_header *osh; + struct ocfs1_super_block_label *osl; + + buf = volume_id_get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + osh = (struct ocfs1_super_block_header *) buf; + if (memcmp(osh->signature, "OracleCFS", 9) != 0) + return -1; + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", osh->major_version, osh->minor_version); + + dbg("found OracleCFS signature, now reading label"); + buf = volume_id_get_buffer(id, off + 0x200, 0x200); + if (buf == NULL) + return -1; + + osl = (struct ocfs1_super_block_label *) buf; + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + if (osl->label_len <= 64) { + volume_id_set_label_raw(id, osl->label, 64); + volume_id_set_label_string(id, osl->label, 64); + } + if (osl->vol_id_len == 16) + volume_id_set_uuid(id, osl->vol_id, UUID_DCE); + id->type = "ocfs"; + return 0; +} + +#define OCFS2_MAX_BLOCKSIZE 0x1000 +#define OCFS2_SUPER_BLOCK_BLKNO 2 + +int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct ocfs2_super_block *os; + size_t blksize; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { + buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); + if (buf == NULL) + return -1; + + os = (struct ocfs2_super_block *) buf; + if (memcmp(os->i_signature, "OCFSV2", 6) != 0) + continue; + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + volume_id_set_label_raw(id, os->s_label, 64); + volume_id_set_label_string(id, os->s_label, 64); + volume_id_set_uuid(id, os->s_uuid, UUID_DCE); + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", os->s_major_rev_level, os->s_minor_rev_level); + id->type = "ocfs2"; + return 0; + } + return -1; +} diff --git a/extras/volume_id/libvolume_id/promise_raid.c b/extras/volume_id/libvolume_id/promise_raid.c new file mode 100644 index 0000000000..6611aeab32 --- /dev/null +++ b/extras/volume_id/libvolume_id/promise_raid.c @@ -0,0 +1,71 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct promise_meta { + uint8_t sig[24]; +} __attribute__((packed)); + +#define PDC_CONFIG_OFF 0x1200 +#define PDC_SIGNATURE "Promise Technology, Inc." + +int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + struct promise_meta *pdc; + unsigned int i; + static unsigned int sectors[] = { + 63, 255, 256, 16, 399, 0 + }; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x40000) + return -1; + + for (i = 0; sectors[i] != 0; i++) { + uint64_t meta_off; + + meta_off = ((size / 0x200) - sectors[i]) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + pdc = (struct promise_meta *) buf; + if (memcmp(pdc->sig, PDC_SIGNATURE, sizeof(PDC_SIGNATURE)-1) == 0) + goto found; + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "promise_fasttrack_raid_member"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/reiserfs.c b/extras/volume_id/libvolume_id/reiserfs.c new file mode 100644 index 0000000000..0eecbda5cb --- /dev/null +++ b/extras/volume_id/libvolume_id/reiserfs.c @@ -0,0 +1,119 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2005 Tobias Klauser + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct reiserfs_super_block { + uint32_t blocks_count; + uint32_t free_blocks; + uint32_t root_block; + uint32_t journal_block; + uint32_t journal_dev; + uint32_t orig_journal_size; + uint32_t dummy2[5]; + uint16_t blocksize; + uint16_t dummy3[3]; + uint8_t magic[12]; + uint32_t dummy4[5]; + uint8_t uuid[16]; + uint8_t label[16]; +} __attribute__((__packed__)); + +struct reiser4_super_block { + uint8_t magic[16]; + uint16_t dummy[2]; + uint8_t uuid[16]; + uint8_t label[16]; + uint64_t dummy2; +} __attribute__((__packed__)); + +#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 +#define REISERFS_SUPERBLOCK_OFFSET 0x10000 + +int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) +{ + struct reiserfs_super_block *rs; + struct reiser4_super_block *rs4; + uint8_t *buf; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + rs = (struct reiserfs_super_block *) buf;; + if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { + strcpy(id->type_version, "3.5"); + id->type = "reiserfs"; + goto found; + } + if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { + strcpy(id->type_version, "3.6"); + id->type = "reiserfs"; + goto found_label; + } + if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { + strcpy(id->type_version, "JR"); + id->type = "reiserfs"; + goto found_label; + } + + rs4 = (struct reiser4_super_block *) buf; + if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) { + strcpy(id->type_version, "4"); + volume_id_set_label_raw(id, rs4->label, 16); + volume_id_set_label_string(id, rs4->label, 16); + volume_id_set_uuid(id, rs4->uuid, UUID_DCE); + id->type = "reiser4"; + goto found; + } + + buf = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + rs = (struct reiserfs_super_block *) buf; + if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { + strcpy(id->type_version, "3.5"); + id->type = "reiserfs"; + goto found; + } + + return -1; + +found_label: + volume_id_set_label_raw(id, rs->label, 16); + volume_id_set_label_string(id, rs->label, 16); + volume_id_set_uuid(id, rs->uuid, UUID_DCE); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + + return 0; +} diff --git a/extras/volume_id/libvolume_id/romfs.c b/extras/volume_id/libvolume_id/romfs.c new file mode 100644 index 0000000000..51ef3739b3 --- /dev/null +++ b/extras/volume_id/libvolume_id/romfs.c @@ -0,0 +1,61 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct romfs_super { + uint8_t magic[8]; + uint32_t size; + uint32_t checksum; + uint8_t name[0]; +} __attribute__((__packed__)); + +int volume_id_probe_romfs(struct volume_id *id, uint64_t off) +{ + struct romfs_super *rfs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); + if (rfs == NULL) + return -1; + + if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { + size_t len = strlen((char *)rfs->name); + + if (len) { + volume_id_set_label_raw(id, rfs->name, len); + volume_id_set_label_string(id, rfs->name, len); + } + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "romfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/libvolume_id/silicon_raid.c b/extras/volume_id/libvolume_id/silicon_raid.c new file mode 100644 index 0000000000..a307764730 --- /dev/null +++ b/extras/volume_id/libvolume_id/silicon_raid.c @@ -0,0 +1,78 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct silicon_meta { + uint8_t unknown0[0x2E]; + uint8_t ascii_version[0x36 - 0x2E]; + uint8_t diskname[0x56 - 0x36]; + uint8_t unknown1[0x60 - 0x56]; + uint32_t magic; + uint32_t unknown1a[0x6C - 0x64]; + uint32_t array_sectors_low; + uint32_t array_sectors_high; + uint8_t unknown2[0x78 - 0x74]; + uint32_t thisdisk_sectors; + uint8_t unknown3[0x100 - 0x7C]; + uint8_t unknown4[0x104 - 0x100]; + uint16_t product_id; + uint16_t vendor_id; + uint16_t minor_ver; + uint16_t major_ver; +} __attribute__((packed)); + +#define SILICON_MAGIC 0x2F000000 + +int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct silicon_meta *sil; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + sil = (struct silicon_meta *) buf; + if (le32_to_cpu(sil->magic) != SILICON_MAGIC) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", + le16_to_cpu(sil->major_ver), le16_to_cpu(sil->minor_ver)); + id->type = "silicon_medley_raid_member"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/sysv.c b/extras/volume_id/libvolume_id/sysv.c new file mode 100644 index 0000000000..fc874d5bea --- /dev/null +++ b/extras/volume_id/libvolume_id/sysv.c @@ -0,0 +1,134 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +#define SYSV_NICINOD 100 +#define SYSV_NICFREE 50 + +struct sysv_super +{ + uint16_t s_isize; + uint16_t s_pad0; + uint32_t s_fsize; + uint16_t s_nfree; + uint16_t s_pad1; + uint32_t s_free[SYSV_NICFREE]; + uint16_t s_ninode; + uint16_t s_pad2; + uint16_t s_inode[SYSV_NICINOD]; + uint8_t s_flock; + uint8_t s_ilock; + uint8_t s_fmod; + uint8_t s_ronly; + uint32_t s_time; + uint16_t s_dinfo[4]; + uint32_t s_tfree; + uint16_t s_tinode; + uint16_t s_pad3; + uint8_t s_fname[6]; + uint8_t s_fpack[6]; + uint32_t s_fill[12]; + uint32_t s_state; + uint32_t s_magic; + uint32_t s_type; +} __attribute__((__packed__)); + +#define XENIX_NICINOD 100 +#define XENIX_NICFREE 100 + +struct xenix_super { + uint16_t s_isize; + uint32_t s_fsize; + uint16_t s_nfree; + uint32_t s_free[XENIX_NICFREE]; + uint16_t s_ninode; + uint16_t s_inode[XENIX_NICINOD]; + uint8_t s_flock; + uint8_t s_ilock; + uint8_t s_fmod; + uint8_t s_ronly; + uint32_t s_time; + uint32_t s_tfree; + uint16_t s_tinode; + uint16_t s_dinfo[4]; + uint8_t s_fname[6]; + uint8_t s_fpack[6]; + uint8_t s_clean; + uint8_t s_fill[371]; + uint32_t s_magic; + uint32_t s_type; +} __attribute__((__packed__)); + +#define SYSV_SUPERBLOCK_BLOCK 0x01 +#define SYSV_MAGIC 0xfd187e20 +#define XENIX_SUPERBLOCK_BLOCK 0x18 +#define XENIX_MAGIC 0x2b5544 +#define SYSV_MAX_BLOCKSIZE 0x800 + +int volume_id_probe_sysv(struct volume_id *id, uint64_t off) +{ + struct sysv_super *vs; + struct xenix_super *xs; + unsigned int boff; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { + vs = (struct sysv_super *) + volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200); + if (vs == NULL) + return -1; + + if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) { + volume_id_set_label_raw(id, vs->s_fname, 6); + volume_id_set_label_string(id, vs->s_fname, 6); + id->type = "sysv"; + goto found; + } + } + + for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { + xs = (struct xenix_super *) + volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200); + if (xs == NULL) + return -1; + + if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) { + volume_id_set_label_raw(id, xs->s_fname, 6); + volume_id_set_label_string(id, xs->s_fname, 6); + id->type = "xenix"; + goto found; + } + } + + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + return 0; +} diff --git a/extras/volume_id/libvolume_id/udf.c b/extras/volume_id/libvolume_id/udf.c new file mode 100644 index 0000000000..fede1ce68a --- /dev/null +++ b/extras/volume_id/libvolume_id/udf.c @@ -0,0 +1,179 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct volume_descriptor { + struct descriptor_tag { + uint16_t id; + uint16_t version; + uint8_t checksum; + uint8_t reserved; + uint16_t serial; + uint16_t crc; + uint16_t crc_len; + uint32_t location; + } __attribute__((__packed__)) tag; + union { + struct anchor_descriptor { + uint32_t length; + uint32_t location; + } __attribute__((__packed__)) anchor; + struct primary_descriptor { + uint32_t seq_num; + uint32_t desc_num; + struct dstring { + uint8_t clen; + uint8_t c[31]; + } __attribute__((__packed__)) ident; + } __attribute__((__packed__)) primary; + } __attribute__((__packed__)) type; +} __attribute__((__packed__)); + +struct volume_structure_descriptor { + uint8_t type; + uint8_t id[5]; + uint8_t version; +} __attribute__((__packed__)); + +#define UDF_VSD_OFFSET 0x8000 + +int volume_id_probe_udf(struct volume_id *id, uint64_t off) +{ + struct volume_descriptor *vd; + struct volume_structure_descriptor *vsd; + unsigned int bs; + unsigned int b; + unsigned int type; + unsigned int count; + unsigned int loc; + unsigned int clen; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); + if (vsd == NULL) + return -1; + + if (memcmp(vsd->id, "NSR02", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "NSR03", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "BEA01", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "BOOT2", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "CD001", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "CDW02", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "TEA03", 5) == 0) + goto blocksize; + return -1; + +blocksize: + /* search the next VSD to get the logical block size of the volume */ + for (bs = 0x800; bs < 0x8000; bs += 0x800) { + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); + if (vsd == NULL) + return -1; + dbg("test for blocksize: 0x%x", bs); + if (vsd->id[0] != '\0') + goto nsr; + } + return -1; + +nsr: + /* search the list of VSDs for a NSR descriptor */ + for (b = 0; b < 64; b++) { + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); + if (vsd == NULL) + return -1; + + dbg("vsd: %c%c%c%c%c", + vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); + + if (vsd->id[0] == '\0') + return -1; + if (memcmp(vsd->id, "NSR02", 5) == 0) + goto anchor; + if (memcmp(vsd->id, "NSR03", 5) == 0) + goto anchor; + } + return -1; + +anchor: + /* read anchor volume descriptor */ + vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + if (type != 2) /* TAG_ID_AVDP */ + goto found; + + /* get desriptor list address and block count */ + count = le32_to_cpu(vd->type.anchor.length) / bs; + loc = le32_to_cpu(vd->type.anchor.location); + dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); + + /* pick the primary descriptor from the list */ + for (b = 0; b < count; b++) { + vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + dbg("descriptor type %i", type); + + /* check validity */ + if (type == 0) + goto found; + if (le32_to_cpu(vd->tag.location) != loc + b) + goto found; + + if (type == 1) /* TAG_ID_PVD */ + goto pvd; + } + goto found; + +pvd: + volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); + + clen = vd->type.primary.ident.clen; + dbg("label string charsize=%i bit", clen); + if (clen == 8) + volume_id_set_label_string(id, vd->type.primary.ident.c, 31); + else if (clen == 16) + volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "udf"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/ufs.c b/extras/volume_id/libvolume_id/ufs.c new file mode 100644 index 0000000000..ace61db657 --- /dev/null +++ b/extras/volume_id/libvolume_id/ufs.c @@ -0,0 +1,211 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct ufs_super_block { + uint32_t fs_link; + uint32_t fs_rlink; + uint32_t fs_sblkno; + uint32_t fs_cblkno; + uint32_t fs_iblkno; + uint32_t fs_dblkno; + uint32_t fs_cgoffset; + uint32_t fs_cgmask; + uint32_t fs_time; + uint32_t fs_size; + uint32_t fs_dsize; + uint32_t fs_ncg; + uint32_t fs_bsize; + uint32_t fs_fsize; + uint32_t fs_frag; + uint32_t fs_minfree; + uint32_t fs_rotdelay; + uint32_t fs_rps; + uint32_t fs_bmask; + uint32_t fs_fmask; + uint32_t fs_bshift; + uint32_t fs_fshift; + uint32_t fs_maxcontig; + uint32_t fs_maxbpg; + uint32_t fs_fragshift; + uint32_t fs_fsbtodb; + uint32_t fs_sbsize; + uint32_t fs_csmask; + uint32_t fs_csshift; + uint32_t fs_nindir; + uint32_t fs_inopb; + uint32_t fs_nspf; + uint32_t fs_optim; + uint32_t fs_npsect_state; + uint32_t fs_interleave; + uint32_t fs_trackskew; + uint32_t fs_id[2]; + uint32_t fs_csaddr; + uint32_t fs_cssize; + uint32_t fs_cgsize; + uint32_t fs_ntrak; + uint32_t fs_nsect; + uint32_t fs_spc; + uint32_t fs_ncyl; + uint32_t fs_cpg; + uint32_t fs_ipg; + uint32_t fs_fpg; + struct ufs_csum { + uint32_t cs_ndir; + uint32_t cs_nbfree; + uint32_t cs_nifree; + uint32_t cs_nffree; + } __attribute__((__packed__)) fs_cstotal; + int8_t fs_fmod; + int8_t fs_clean; + int8_t fs_ronly; + int8_t fs_flags; + union { + struct { + int8_t fs_fsmnt[512]; + uint32_t fs_cgrotor; + uint32_t fs_csp[31]; + uint32_t fs_maxcluster; + uint32_t fs_cpc; + uint16_t fs_opostbl[16][8]; + } __attribute__((__packed__)) fs_u1; + struct { + int8_t fs_fsmnt[468]; + uint8_t fs_volname[32]; + uint64_t fs_swuid; + int32_t fs_pad; + uint32_t fs_cgrotor; + uint32_t fs_ocsp[28]; + uint32_t fs_contigdirs; + uint32_t fs_csp; + uint32_t fs_maxcluster; + uint32_t fs_active; + int32_t fs_old_cpc; + int32_t fs_maxbsize; + int64_t fs_sparecon64[17]; + int64_t fs_sblockloc; + struct ufs2_csum_total { + uint64_t cs_ndir; + uint64_t cs_nbfree; + uint64_t cs_nifree; + uint64_t cs_nffree; + uint64_t cs_numclusters; + uint64_t cs_spare[3]; + } __attribute__((__packed__)) fs_cstotal; + struct ufs_timeval { + int32_t tv_sec; + int32_t tv_usec; + } __attribute__((__packed__)) fs_time; + int64_t fs_size; + int64_t fs_dsize; + uint64_t fs_csaddr; + int64_t fs_pendingblocks; + int32_t fs_pendinginodes; + } __attribute__((__packed__)) fs_u2; + } fs_u11; + union { + struct { + int32_t fs_sparecon[53]; + int32_t fs_reclaim; + int32_t fs_sparecon2[1]; + int32_t fs_state; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; + } __attribute__((__packed__)) fs_sun; + struct { + int32_t fs_sparecon[53]; + int32_t fs_reclaim; + int32_t fs_sparecon2[1]; + uint32_t fs_npsect; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; + } __attribute__((__packed__)) fs_sunx86; + struct { + int32_t fs_sparecon[50]; + int32_t fs_contigsumsize; + int32_t fs_maxsymlinklen; + int32_t fs_inodefmt; + uint32_t fs_maxfilesize[2]; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; + int32_t fs_state; + } __attribute__((__packed__)) fs_44; + } fs_u2; + int32_t fs_postblformat; + int32_t fs_nrpos; + int32_t fs_postbloff; + int32_t fs_rotbloff; + uint32_t fs_magic; + uint8_t fs_space[1]; +} __attribute__((__packed__)); + +#define UFS_MAGIC 0x00011954 +#define UFS2_MAGIC 0x19540119 +#define UFS_MAGIC_FEA 0x00195612 +#define UFS_MAGIC_LFN 0x00095014 + +int volume_id_probe_ufs(struct volume_id *id, uint64_t off) +{ + uint32_t magic; + int i; + struct ufs_super_block *ufs; + int offsets[] = {0, 8, 64, 256, -1}; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + for (i = 0; offsets[i] >= 0; i++) { + ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); + if (ufs == NULL) + return -1; + + dbg("offset 0x%x", offsets[i] * 0x400); + magic = be32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(be)", magic); + goto found; + } + magic = le32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(le)", magic); + goto found; + } + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "ufs"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/util.c b/extras/volume_id/libvolume_id/util.c new file mode 100644 index 0000000000..361d7058d0 --- /dev/null +++ b/extras/volume_id/libvolume_id/util.c @@ -0,0 +1,276 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) +{ + unsigned int i, j; + uint16_t c; + + j = 0; + for (i = 0; i + 2 <= count; i += 2) { + if (endianess == LE) + c = (buf[i+1] << 8) | buf[i]; + else + c = (buf[i] << 8) | buf[i+1]; + if (c == 0) { + str[j] = '\0'; + break; + } else if (c < 0x80) { + if (j+1 >= len) + break; + str[j++] = (uint8_t) c; + } else if (c < 0x800) { + if (j+2 >= len) + break; + str[j++] = (uint8_t) (0xc0 | (c >> 6)); + str[j++] = (uint8_t) (0x80 | (c & 0x3f)); + } else { + if (j+3 >= len) + break; + str[j++] = (uint8_t) (0xe0 | (c >> 12)); + str[j++] = (uint8_t) (0x80 | ((c >> 6) & 0x3f)); + str[j++] = (uint8_t) (0x80 | (c & 0x3f)); + } + } + str[j] = '\0'; +} + +static char *usage_to_string(enum volume_id_usage usage_id) +{ + switch (usage_id) { + case VOLUME_ID_FILESYSTEM: + return "filesystem"; + case VOLUME_ID_PARTITIONTABLE: + return "partitiontable"; + case VOLUME_ID_OTHER: + return "other"; + case VOLUME_ID_RAID: + return "raid"; + case VOLUME_ID_DISKLABEL: + return "disklabel"; + case VOLUME_ID_CRYPTO: + return "crypto"; + case VOLUME_ID_UNPROBED: + return "unprobed"; + case VOLUME_ID_UNUSED: + return "unused"; + } + return NULL; +} + +void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id) +{ + part->usage_id = usage_id; + part->usage = usage_to_string(usage_id); +} + +void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) +{ + id->usage_id = usage_id; + id->usage = usage_to_string(usage_id); +} + +void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count) +{ + memcpy(id->label_raw, buf, count); + id->label_raw_len = count; +} + +void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) +{ + unsigned int i; + + memcpy(id->label, buf, count); + + /* remove trailing whitespace */ + i = strnlen(id->label, count); + while (i--) { + if (!isspace(id->label[i])) + break; + } + id->label[i+1] = '\0'; +} + +void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count) +{ + volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count); +} + +void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) +{ + unsigned int i; + unsigned int count = 0; + + switch(format) { + case UUID_DOS: + count = 4; + break; + case UUID_NTFS: + case UUID_HFS: + count = 8; + break; + case UUID_DCE: + count = 16; + break; + case UUID_DCE_STRING: + count = 36; + break; + } + memcpy(id->uuid_raw, buf, count); + id->uuid_raw_len = count; + + /* if set, create string in the same format, the native platform uses */ + for (i = 0; i < count; i++) + if (buf[i] != 0) + goto set; + return; + +set: + switch(format) { + case UUID_DOS: + sprintf(id->uuid, "%02X%02X-%02X%02X", + buf[3], buf[2], buf[1], buf[0]); + break; + case UUID_NTFS: + sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", + buf[7], buf[6], buf[5], buf[4], + buf[3], buf[2], buf[1], buf[0]); + break; + case UUID_HFS: + sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], buf[6], buf[7]); + break; + case UUID_DCE: + sprintf(id->uuid, + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], + buf[6], buf[7], + buf[8], buf[9], + buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); + break; + case UUID_DCE_STRING: + memcpy(id->uuid, buf, count); + id->uuid[count] = '\0'; + break; + } +} + +uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) +{ + ssize_t buf_len; + + dbg("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); + /* check if requested area fits in superblock buffer */ + if (off + len <= SB_BUFFER_SIZE) { + if (id->sbbuf == NULL) { + id->sbbuf = malloc(SB_BUFFER_SIZE); + if (id->sbbuf == NULL) { + dbg("error malloc"); + return NULL; + } + } + + /* check if we need to read */ + if ((off + len) > id->sbbuf_len) { + dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len)); + if (lseek(id->fd, 0, SEEK_SET) < 0) { + dbg("lseek failed (%s)", strerror(errno)); + return NULL; + } + buf_len = read(id->fd, id->sbbuf, off + len); + if (buf_len < 0) { + dbg("read failed (%s)", strerror(errno)); + return NULL; + } + dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); + id->sbbuf_len = buf_len; + if ((size_t)buf_len < off + len) { + dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); + return NULL; + } + } + + return &(id->sbbuf[off]); + } else { + if (len > SEEK_BUFFER_SIZE) { + dbg("seek buffer too small %d", SEEK_BUFFER_SIZE); + return NULL; + } + + /* get seek buffer */ + if (id->seekbuf == NULL) { + id->seekbuf = malloc(SEEK_BUFFER_SIZE); + if (id->seekbuf == NULL) { + dbg("error malloc"); + return NULL; + } + } + + /* check if we need to read */ + if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { + dbg("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); + if (lseek(id->fd, off, SEEK_SET) < 0) { + dbg("lseek failed (%s)", strerror(errno)); + return NULL; + } + buf_len = read(id->fd, id->seekbuf, len); + if (buf_len < 0) { + dbg("read failed (%s)", strerror(errno)); + return NULL; + } + dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); + id->seekbuf_off = off; + id->seekbuf_len = buf_len; + if ((size_t)buf_len < len) { + dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); + return NULL; + } + } + + return &(id->seekbuf[off - id->seekbuf_off]); + } +} + +void volume_id_free_buffer(struct volume_id *id) +{ + if (id->sbbuf != NULL) { + free(id->sbbuf); + id->sbbuf = NULL; + id->sbbuf_len = 0; + } + if (id->seekbuf != NULL) { + free(id->seekbuf); + id->seekbuf = NULL; + id->seekbuf_len = 0; + } +} diff --git a/extras/volume_id/libvolume_id/util.h b/extras/volume_id/libvolume_id/util.h new file mode 100644 index 0000000000..6e16491c80 --- /dev/null +++ b/extras/volume_id/libvolume_id/util.h @@ -0,0 +1,93 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _VOLUME_ID_UTIL_ +#define _VOLUME_ID_UTIL_ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +/* size of superblock buffer, reiserfs block is at 64k */ +#define SB_BUFFER_SIZE 0x11000 +/* size of seek buffer, FAT cluster is 32k max */ +#define SEEK_BUFFER_SIZE 0x10000 + +/* probe volume for all known filesystems in specific order */ +#define bswap16(x) (uint16_t) ((((uint16_t)(x) & 0x00ffu) << 8) | \ + (((uint16_t)(x) & 0xff00u) >> 8)) + +#define bswap32(x) (uint32_t) ((((uint32_t)(x) & 0xff000000u) >> 24) | \ + (((uint32_t)(x) & 0x00ff0000u) >> 8) | \ + (((uint32_t)(x) & 0x0000ff00u) << 8) | \ + (((uint32_t)(x) & 0x000000ffu) << 24)) + +#define bswap64(x) (uint64_t) ((((uint64_t)(x) & 0xff00000000000000ull) >> 56) | \ + (((uint64_t)(x) & 0x00ff000000000000ull) >> 40) | \ + (((uint64_t)(x) & 0x0000ff0000000000ull) >> 24) | \ + (((uint64_t)(x) & 0x000000ff00000000ull) >> 8) | \ + (((uint64_t)(x) & 0x00000000ff000000ull) << 8) | \ + (((uint64_t)(x) & 0x0000000000ff0000ull) << 24) | \ + (((uint64_t)(x) & 0x000000000000ff00ull) << 40) | \ + (((uint64_t)(x) & 0x00000000000000ffull) << 56)) + +#ifdef __BYTE_ORDER +#if (__BYTE_ORDER == __LITTLE_ENDIAN) +#define le16_to_cpu(x) (x) +#define le32_to_cpu(x) (x) +#define le64_to_cpu(x) (x) +#define be16_to_cpu(x) bswap16(x) +#define be32_to_cpu(x) bswap32(x) +#define cpu_to_le16(x) (x) +#define cpu_to_le32(x) (x) +#define cpu_to_be32(x) bswap32(x) +#elif (__BYTE_ORDER == __BIG_ENDIAN) +#define le16_to_cpu(x) bswap16(x) +#define le32_to_cpu(x) bswap32(x) +#define le64_to_cpu(x) bswap64(x) +#define be16_to_cpu(x) (x) +#define be32_to_cpu(x) (x) +#define cpu_to_le16(x) bswap16(x) +#define cpu_to_le32(x) bswap32(x) +#define cpu_to_be32(x) (x) +#endif +#endif /* __BYTE_ORDER */ + +enum uuid_format { + UUID_DCE_STRING, + UUID_DCE, + UUID_DOS, + UUID_NTFS, + UUID_HFS, +}; + +enum endian { + LE = 0, + BE = 1 +}; + +extern void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); +extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); +extern void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id); +extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); +extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format); +extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); +extern void volume_id_free_buffer(struct volume_id *id); + +#endif /* _VOLUME_ID_UTIL_ */ + diff --git a/extras/volume_id/libvolume_id/via_raid.c b/extras/volume_id/libvolume_id/via_raid.c new file mode 100644 index 0000000000..66962cd7f0 --- /dev/null +++ b/extras/volume_id/libvolume_id/via_raid.c @@ -0,0 +1,76 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct via_meta { + uint16_t signature; + uint8_t version_number; + struct via_array { + uint16_t disk_bits; + uint8_t disk_array_ex; + uint32_t capacity_low; + uint32_t capacity_high; + uint32_t serial_checksum; + } __attribute((packed)) array; + uint32_t serial_checksum[8]; + uint8_t checksum; +} __attribute__((packed)); + +#define VIA_SIGNATURE 0xAA55 + +int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct via_meta *via; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + via = (struct via_meta *) buf; + if (le16_to_cpu(via->signature) != VIA_SIGNATURE) + return -1; + + if (via->version_number > 1) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", via->version_number); + id->type = "via_raid_member"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c new file mode 100644 index 0000000000..09d1e31725 --- /dev/null +++ b/extras/volume_id/libvolume_id/volume_id.c @@ -0,0 +1,200 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + + +int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) +{ + if (id == NULL) + return -EINVAL; + + /* probe for raid first, cause fs probes may be successful on raid members */ + if (size) { + if (volume_id_probe_linux_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_intel_software_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_lsi_mega_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_via_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_silicon_medley_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_nvidia_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_promise_fasttrack_raid(id, off, size) == 0) + goto exit; + + if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0) + goto exit; + } + + if (volume_id_probe_lvm1(id, off) == 0) + goto exit; + + if (volume_id_probe_lvm2(id, off) == 0) + goto exit; + + if (volume_id_probe_highpoint_37x_raid(id, off) == 0) + goto exit; + + if (volume_id_probe_luks(id, off) == 0) + goto exit; + + /* signature in the first block, only small buffer needed */ + if (volume_id_probe_vfat(id, off) == 0) + goto exit; + + if (volume_id_probe_xfs(id, off) == 0) + goto exit; + + /* fill buffer with maximum */ + volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); + + if (volume_id_probe_linux_swap(id, off) == 0) + goto exit; + + if (volume_id_probe_ext(id, off) == 0) + goto exit; + + if (volume_id_probe_reiserfs(id, off) == 0) + goto exit; + + if (volume_id_probe_jfs(id, off) == 0) + goto exit; + + if (volume_id_probe_udf(id, off) == 0) + goto exit; + + if (volume_id_probe_iso9660(id, off) == 0) + goto exit; + + if (volume_id_probe_hfs_hfsplus(id, off) == 0) + goto exit; + + if (volume_id_probe_ufs(id, off) == 0) + goto exit; + + if (volume_id_probe_ntfs(id, off) == 0) + goto exit; + + if (volume_id_probe_cramfs(id, off) == 0) + goto exit; + + if (volume_id_probe_romfs(id, off) == 0) + goto exit; + + if (volume_id_probe_hpfs(id, off) == 0) + goto exit; + + if (volume_id_probe_sysv(id, off) == 0) + goto exit; + + if (volume_id_probe_minix(id, off) == 0) + goto exit; + + if (volume_id_probe_ocfs1(id, off) == 0) + goto exit; + + if (volume_id_probe_ocfs2(id, off) == 0) + goto exit; + + if (volume_id_probe_vxfs(id, off) == 0) + goto exit; + + return -1; + +exit: + /* If the filestystem in recognized, we free the allocated buffers, + otherwise they will stay in place for the possible next probe call */ + volume_id_free_buffer(id); + + return 0; +} + +/* open volume by already open file descriptor */ +struct volume_id *volume_id_open_fd(int fd) +{ + struct volume_id *id; + + id = malloc(sizeof(struct volume_id)); + if (id == NULL) + return NULL; + memset(id, 0x00, sizeof(struct volume_id)); + + id->fd = fd; + + return id; +} + +/* open volume by device node */ +struct volume_id *volume_id_open_node(const char *path) +{ + struct volume_id *id; + int fd; + + fd = open(path, O_RDONLY); + if (fd < 0) { + dbg("unable to open '%s'", path); + return NULL; + } + + id = volume_id_open_fd(fd); + if (id == NULL) + return NULL; + + /* close fd on device close */ + id->fd_close = 1; + + return id; +} + +void volume_id_close(struct volume_id *id) +{ + if (id == NULL) + return; + + if (id->fd_close != 0) + close(id->fd); + + volume_id_free_buffer(id); + + if (id->partitions != NULL) + free(id->partitions); + + free(id); +} diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h new file mode 100644 index 0000000000..f2f3a0d006 --- /dev/null +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -0,0 +1,116 @@ +/* + * volume_id - reads partition label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _VOLUME_ID_H_ +#define _VOLUME_ID_H_ + +#include + +#define VOLUME_ID_VERSION 53 + +#define VOLUME_ID_LABEL_SIZE 64 +#define VOLUME_ID_UUID_SIZE 36 +#define VOLUME_ID_FORMAT_SIZE 32 +#define VOLUME_ID_PATH_MAX 256 +#define VOLUME_ID_PARTITIONS_MAX 256 + +enum volume_id_usage { + VOLUME_ID_UNUSED, + VOLUME_ID_UNPROBED, + VOLUME_ID_OTHER, + VOLUME_ID_FILESYSTEM, + VOLUME_ID_PARTITIONTABLE, + VOLUME_ID_RAID, + VOLUME_ID_DISKLABEL, + VOLUME_ID_CRYPTO, +}; + +struct volume_id_partition { + enum volume_id_usage usage_id; + char *usage; + char *type; + uint64_t off; + uint64_t len; + uint8_t partition_type_raw; +}; + +struct volume_id { + uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; + size_t label_raw_len; + char label[VOLUME_ID_LABEL_SIZE+1]; + uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; + size_t uuid_raw_len; + char uuid[VOLUME_ID_UUID_SIZE+1]; + enum volume_id_usage usage_id; + char *usage; + char *type; + char type_version[VOLUME_ID_FORMAT_SIZE]; + + struct volume_id_partition *partitions; + size_t partition_count; + + int fd; + uint8_t *sbbuf; + size_t sbbuf_len; + uint8_t *seekbuf; + uint64_t seekbuf_off; + size_t seekbuf_len; + int fd_close:1; +}; + +extern struct volume_id *volume_id_open_fd(int fd); +extern struct volume_id *volume_id_open_node(const char *path); +extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); +extern void volume_id_close(struct volume_id *id); + +/* filesystems */ +extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ext(struct volume_id *id, uint64_t off); +extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off); +extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); +extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); +extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_minix(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); +extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off); +extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); + +/* special formats */ +extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); +extern int volume_id_probe_luks(struct volume_id *id, uint64_t off); + +/* raid */ +extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off); +extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); + +/* bios raid */ +extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); +extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); + +/* partition tables */ +extern int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off); +extern int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off); + +#endif diff --git a/extras/volume_id/libvolume_id/vxfs.c b/extras/volume_id/libvolume_id/vxfs.c new file mode 100644 index 0000000000..0aef369899 --- /dev/null +++ b/extras/volume_id/libvolume_id/vxfs.c @@ -0,0 +1,55 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +#define VXFS_SUPER_MAGIC 0xa501FCF5 + +struct vxfs_super { + uint32_t vs_magic; + int32_t vs_version; +} __attribute__((__packed__)); + +int volume_id_probe_vxfs(struct volume_id *id, uint64_t off) +{ + struct vxfs_super *vxs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); + if (vxs == NULL) + return -1; + + if (vxs->vs_magic == cpu_to_le32(VXFS_SUPER_MAGIC)) { + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", (unsigned int) vxs->vs_version); + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "vxfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/libvolume_id/xfs.c b/extras/volume_id/libvolume_id/xfs.c new file mode 100644 index 0000000000..a5f5d8432c --- /dev/null +++ b/extras/volume_id/libvolume_id/xfs.c @@ -0,0 +1,66 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +struct xfs_super_block { + uint8_t magic[4]; + uint32_t blocksize; + uint64_t dblocks; + uint64_t rblocks; + uint32_t dummy1[2]; + uint8_t uuid[16]; + uint32_t dummy2[15]; + uint8_t fname[12]; + uint32_t dummy3[2]; + uint64_t icount; + uint64_t ifree; + uint64_t fdblocks; +} __attribute__((__packed__)); + +int volume_id_probe_xfs(struct volume_id *id, uint64_t off) +{ + struct xfs_super_block *xs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); + if (xs == NULL) + return -1; + + if (memcmp(xs->magic, "XFSB", 4) != 0) + return -1; + + volume_id_set_label_raw(id, xs->fname, 12); + volume_id_set_label_string(id, xs->fname, 12); + volume_id_set_uuid(id, xs->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "xfs"; + + return 0; +} diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 2b53085c72..6f99c52728 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -31,7 +31,7 @@ #include "../../udev_utils.h" #include "../../logging.h" -#include "volume_id/volume_id.h" +#include "libvolume_id/volume_id.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) diff --git a/extras/volume_id/volume_id/Makefile.inc b/extras/volume_id/volume_id/Makefile.inc deleted file mode 100644 index 6f8dceea4a..0000000000 --- a/extras/volume_id/volume_id/Makefile.inc +++ /dev/null @@ -1,66 +0,0 @@ -VOLUME_ID_OBJS= \ - $(VOLUME_ID_BASE)/ext.o \ - $(VOLUME_ID_BASE)/fat.o \ - $(VOLUME_ID_BASE)/hfs.o \ - $(VOLUME_ID_BASE)/highpoint.o \ - $(VOLUME_ID_BASE)/isw_raid.o \ - $(VOLUME_ID_BASE)/lsi_raid.o \ - $(VOLUME_ID_BASE)/via_raid.o \ - $(VOLUME_ID_BASE)/silicon_raid.o \ - $(VOLUME_ID_BASE)/nvidia_raid.o \ - $(VOLUME_ID_BASE)/promise_raid.o \ - $(VOLUME_ID_BASE)/iso9660.o \ - $(VOLUME_ID_BASE)/jfs.o \ - $(VOLUME_ID_BASE)/linux_raid.o \ - $(VOLUME_ID_BASE)/linux_swap.o \ - $(VOLUME_ID_BASE)/lvm.o \ - $(VOLUME_ID_BASE)/mac.o \ - $(VOLUME_ID_BASE)/msdos.o \ - $(VOLUME_ID_BASE)/ntfs.o \ - $(VOLUME_ID_BASE)/reiserfs.o \ - $(VOLUME_ID_BASE)/udf.o \ - $(VOLUME_ID_BASE)/ufs.o \ - $(VOLUME_ID_BASE)/xfs.o \ - $(VOLUME_ID_BASE)/cramfs.o \ - $(VOLUME_ID_BASE)/hpfs.o \ - $(VOLUME_ID_BASE)/romfs.o \ - $(VOLUME_ID_BASE)/sysv.o \ - $(VOLUME_ID_BASE)/minix.o \ - $(VOLUME_ID_BASE)/luks.o \ - $(VOLUME_ID_BASE)/ocfs.o \ - $(VOLUME_ID_BASE)/vxfs.o \ - $(VOLUME_ID_BASE)/volume_id.o \ - $(VOLUME_ID_BASE)/util.o - -VOLUME_ID_HEADERS= \ - $(VOLUME_ID_BASE)/ext.h \ - $(VOLUME_ID_BASE)/fat.h \ - $(VOLUME_ID_BASE)/hfs.h \ - $(VOLUME_ID_BASE)/highpoint.h \ - $(VOLUME_ID_BASE)/isw_raid.h \ - $(VOLUME_ID_BASE)/lsi_raid.h \ - $(VOLUME_ID_BASE)/via_raid.h \ - $(VOLUME_ID_BASE)/silicon_raid.h \ - $(VOLUME_ID_BASE)/nvidia_raid.h \ - $(VOLUME_ID_BASE)/promise_raid.h \ - $(VOLUME_ID_BASE)/iso9660.h \ - $(VOLUME_ID_BASE)/jfs.h \ - $(VOLUME_ID_BASE)/linux_raid.h \ - $(VOLUME_ID_BASE)/linux_swap.h \ - $(VOLUME_ID_BASE)/lvm.h \ - $(VOLUME_ID_BASE)/mac.h \ - $(VOLUME_ID_BASE)/msdos.h \ - $(VOLUME_ID_BASE)/ntfs.h \ - $(VOLUME_ID_BASE)/reiserfs.h \ - $(VOLUME_ID_BASE)/udf.h \ - $(VOLUME_ID_BASE)/ufs.h \ - $(VOLUME_ID_BASE)/xfs.h \ - $(VOLUME_ID_BASE)/cramfs.h \ - $(VOLUME_ID_BASE)/romfs.h \ - $(VOLUME_ID_BASE)/sysv.h \ - $(VOLUME_ID_BASE)/minix.h \ - $(VOLUME_ID_BASE)/luks.h \ - $(VOLUME_ID_BASE)/ocfs.h \ - $(VOLUME_ID_BASE)/vxfs.h \ - $(VOLUME_ID_BASE)/volume_id.h \ - $(VOLUME_ID_BASE)/util.h diff --git a/extras/volume_id/volume_id/cramfs.c b/extras/volume_id/volume_id/cramfs.c deleted file mode 100644 index 85a1bc8c55..0000000000 --- a/extras/volume_id/volume_id/cramfs.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "cramfs.h" - -struct cramfs_super { - uint8_t magic[4]; - uint32_t size; - uint32_t flags; - uint32_t future; - uint8_t signature[16]; - struct cramfs_info { - uint32_t crc; - uint32_t edition; - uint32_t blocks; - uint32_t files; - } __attribute__((__packed__)) info; - uint8_t name[16]; -} __attribute__((__packed__)); - -int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) -{ - struct cramfs_super *cs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); - if (cs == NULL) - return -1; - - if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0) { - volume_id_set_label_raw(id, cs->name, 16); - volume_id_set_label_string(id, cs->name, 16); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "cramfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/volume_id/cramfs.h b/extras/volume_id/volume_id/cramfs.h deleted file mode 100644 index 0ff19c342e..0000000000 --- a/extras/volume_id/volume_id/cramfs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_CRAMFS_ -#define _VOLUME_ID_CRAMFS_ - -extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/ext.c b/extras/volume_id/volume_id/ext.c deleted file mode 100644 index a3e20d3151..0000000000 --- a/extras/volume_id/volume_id/ext.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "util.h" -#include "logging.h" -#include "ext.h" - -struct ext2_super_block { - uint32_t s_inodes_count; - uint32_t s_blocks_count; - uint32_t s_r_blocks_count; - uint32_t s_free_blocks_count; - uint32_t s_free_inodes_count; - uint32_t s_first_data_block; - uint32_t s_log_block_size; - uint32_t s_log_frag_size; - uint32_t s_blocks_per_group; - uint32_t s_frags_per_group; - uint32_t s_inodes_per_group; - uint32_t s_mtime; - uint32_t s_wtime; - uint16_t s_mnt_count; - uint16_t s_max_mnt_count; - uint16_t s_magic; - uint16_t s_state; - uint16_t s_errors; - uint16_t s_minor_rev_level; - uint32_t s_lastcheck; - uint32_t s_checkinterval; - uint32_t s_creator_os; - uint32_t s_rev_level; - uint16_t s_def_resuid; - uint16_t s_def_resgid; - uint32_t s_first_ino; - uint16_t s_inode_size; - uint16_t s_block_group_nr; - uint32_t s_feature_compat; - uint32_t s_feature_incompat; - uint32_t s_feature_ro_compat; - uint8_t s_uuid[16]; - uint8_t s_volume_name[16]; -} __attribute__((__packed__)); - -#define EXT_SUPER_MAGIC 0xEF53 -#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 -#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 -#define EXT_SUPERBLOCK_OFFSET 0x400 - -#define EXT3_MIN_BLOCK_SIZE 0x400 -#define EXT3_MAX_BLOCK_SIZE 0x1000 - -int volume_id_probe_ext(struct volume_id *id, uint64_t off) -{ - struct ext2_super_block *es; - size_t bsize; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); - if (es == NULL) - return -1; - - if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC)) - return -1; - - bsize = 0x400 << le32_to_cpu(es->s_log_block_size); - dbg("ext blocksize 0x%zx", bsize); - if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { - dbg("invalid ext blocksize"); - return -1; - } - - volume_id_set_label_raw(id, es->s_volume_name, 16); - volume_id_set_label_string(id, es->s_volume_name, 16); - volume_id_set_uuid(id, es->s_uuid, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", es->s_rev_level, es->s_minor_rev_level); - - /* check for external journal device */ - if ((le32_to_cpu(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { - volume_id_set_usage(id, VOLUME_ID_OTHER); - id->type = "jbd"; - return 0; - } - - /* check for ext2 / ext3 */ - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - if ((le32_to_cpu(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) - id->type = "ext3"; - else - id->type = "ext2"; - - return 0; -} diff --git a/extras/volume_id/volume_id/ext.h b/extras/volume_id/volume_id/ext.h deleted file mode 100644 index dfda2074b8..0000000000 --- a/extras/volume_id/volume_id/ext.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_EXT_ -#define _VOLUME_ID_EXT_ - -extern int volume_id_probe_ext(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/fat.c b/extras/volume_id/volume_id/fat.c deleted file mode 100644 index 74f2bb9194..0000000000 --- a/extras/volume_id/volume_id/fat.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "fat.h" - -#define FAT12_MAX 0xff5 -#define FAT16_MAX 0xfff5 -#define FAT_ATTR_VOLUME_ID 0x08 -#define FAT_ATTR_DIR 0x10 -#define FAT_ATTR_LONG_NAME 0x0f -#define FAT_ATTR_MASK 0x3f -#define FAT_ENTRY_FREE 0xe5 - -struct vfat_super_block { - uint8_t boot_jump[3]; - uint8_t sysid[8]; - uint16_t sector_size; - uint8_t sectors_per_cluster; - uint16_t reserved; - uint8_t fats; - uint16_t dir_entries; - uint16_t sectors; - uint8_t media; - uint16_t fat_length; - uint16_t secs_track; - uint16_t heads; - uint32_t hidden; - uint32_t total_sect; - union { - struct fat_super_block { - uint8_t unknown[3]; - uint8_t serno[4]; - uint8_t label[11]; - uint8_t magic[8]; - uint8_t dummy2[192]; - uint8_t pmagic[2]; - } __attribute__((__packed__)) fat; - struct fat32_super_block { - uint32_t fat32_length; - uint16_t flags; - uint8_t version[2]; - uint32_t root_cluster; - uint16_t insfo_sector; - uint16_t backup_boot; - uint16_t reserved2[6]; - uint8_t unknown[3]; - uint8_t serno[4]; - uint8_t label[11]; - uint8_t magic[8]; - uint8_t dummy2[164]; - uint8_t pmagic[2]; - } __attribute__((__packed__)) fat32; - } __attribute__((__packed__)) type; -} __attribute__((__packed__)); - -struct vfat_dir_entry { - uint8_t name[11]; - uint8_t attr; - uint16_t time_creat; - uint16_t date_creat; - uint16_t time_acc; - uint16_t date_acc; - uint16_t cluster_high; - uint16_t time_write; - uint16_t date_write; - uint16_t cluster_low; - uint32_t size; -} __attribute__((__packed__)); - -static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) -{ - unsigned int i; - - for (i = 0; i < count; i++) { - /* end marker */ - if (dir[i].name[0] == 0x00) { - dbg("end of dir"); - break; - } - - /* empty entry */ - if (dir[i].name[0] == FAT_ENTRY_FREE) - continue; - - /* long name */ - if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) - continue; - - if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { - /* labels do not have file data */ - if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) - continue; - - dbg("found ATTR_VOLUME_ID id in root dir"); - return dir[i].name; - } - - dbg("skip dir entry"); - } - - return NULL; -} - -int volume_id_probe_vfat(struct volume_id *id, uint64_t off) -{ - struct vfat_super_block *vs; - struct vfat_dir_entry *dir; - uint16_t sector_size; - uint16_t dir_entries; - uint32_t sect_count; - uint16_t reserved; - uint32_t fat_size; - uint32_t root_cluster; - uint32_t dir_size; - uint32_t cluster_count; - uint16_t fat_length; - uint32_t fat32_length; - uint64_t root_start; - uint32_t start_data_sect; - uint16_t root_dir_entries; - uint8_t *buf; - uint32_t buf_size; - uint8_t *label = NULL; - uint32_t next; - int maxloop; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - /* believe only that's fat, don't trust the version - * the cluster_count will tell us - */ - if (memcmp(vs->sysid, "NTFS", 4) == 0) - return -1; - - if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) - goto valid; - - if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) - goto valid; - - if (memcmp(vs->type.fat.magic, "FAT16 ", 8) == 0) - goto valid; - - if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0) - goto valid; - - if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) - goto valid; - - /* - * There are old floppies out there without a magic, so we check - * for well known values and guess if it's a fat volume - */ - - /* boot jump address check */ - if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && - vs->boot_jump[0] != 0xe9) - return -1; - - /* heads check */ - if (vs->heads == 0) - return -1; - - /* cluster size check*/ - if (vs->sectors_per_cluster == 0 || - (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) - return -1; - - /* media check */ - if (vs->media < 0xf8 && vs->media != 0xf0) - return -1; - - /* fat count*/ - if (vs->fats != 2) - return -1; - -valid: - /* sector size check */ - sector_size = le16_to_cpu(vs->sector_size); - if (sector_size != 0x200 && sector_size != 0x400 && - sector_size != 0x800 && sector_size != 0x1000) - return -1; - - dbg("sector_size 0x%x", sector_size); - dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); - - dir_entries = le16_to_cpu(vs->dir_entries); - reserved = le16_to_cpu(vs->reserved); - dbg("reserved 0x%x", reserved); - - sect_count = le16_to_cpu(vs->sectors); - if (sect_count == 0) - sect_count = le32_to_cpu(vs->total_sect); - dbg("sect_count 0x%x", sect_count); - - fat_length = le16_to_cpu(vs->fat_length); - dbg("fat_length 0x%x", fat_length); - fat32_length = le32_to_cpu(vs->type.fat32.fat32_length); - dbg("fat32_length 0x%x", fat32_length); - - if (fat_length) - fat_size = fat_length * vs->fats; - else if (fat32_length) - fat_size = fat32_length * vs->fats; - else - return -1; - dbg("fat_size 0x%x", fat_size); - - dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + - (sector_size-1)) / sector_size; - dbg("dir_size 0x%x", dir_size); - - cluster_count = sect_count - (reserved + fat_size + dir_size); - cluster_count /= vs->sectors_per_cluster; - dbg("cluster_count 0x%x", cluster_count); - - /* must be FAT32 */ - if (!fat_length && fat32_length) - goto fat32; - - /* cluster_count tells us the format */ - if (cluster_count < FAT12_MAX) - strcpy(id->type_version, "FAT12"); - else if (cluster_count < FAT16_MAX) - strcpy(id->type_version, "FAT16"); - else - goto fat32; - - /* the label may be an attribute in the root directory */ - root_start = (reserved + fat_size) * sector_size; - dbg("root dir start 0x%llx", (unsigned long long) root_start); - root_dir_entries = le16_to_cpu(vs->dir_entries); - dbg("expected entries 0x%x", root_dir_entries); - - buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); - buf = volume_id_get_buffer(id, off + root_start, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - - label = get_attr_volume_id(dir, root_dir_entries); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, label, 11); - volume_id_set_label_string(id, label, 11); - } else if (memcmp(vs->type.fat.label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, vs->type.fat.label, 11); - volume_id_set_label_string(id, vs->type.fat.label, 11); - } - volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); - goto found; - -fat32: - strcpy(id->type_version, "FAT32"); - - /* FAT32 root dir is a cluster chain like any other directory */ - buf_size = vs->sectors_per_cluster * sector_size; - root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); - dbg("root dir cluster %u", root_cluster); - start_data_sect = reserved + fat_size; - - next = root_cluster; - maxloop = 100; - while (--maxloop) { - uint32_t next_sect_off; - uint64_t next_off; - uint64_t fat_entry_off; - int count; - - dbg("next cluster %u", next); - next_sect_off = (next - 2) * vs->sectors_per_cluster; - next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%llx", (unsigned long long) next_off); - - /* get cluster */ - buf = volume_id_get_buffer(id, off + next_off, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - count = buf_size / sizeof(struct vfat_dir_entry); - dbg("expected entries 0x%x", count); - - label = get_attr_volume_id(dir, count); - if (label) - break; - - /* get FAT entry */ - fat_entry_off = (reserved * sector_size) + (next * sizeof(uint32_t)); - buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); - if (buf == NULL) - goto found; - - /* set next cluster */ - next = le32_to_cpu(*((uint32_t *) buf) & 0x0fffffff); - if (next == 0) - break; - } - if (maxloop == 0) - dbg("reached maximum follow count of root cluster chain, give up"); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, label, 11); - volume_id_set_label_string(id, label, 11); - } else if (memcmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, vs->type.fat32.label, 11); - volume_id_set_label_string(id, vs->type.fat32.label, 11); - } - volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "vfat"; - - return 0; -} diff --git a/extras/volume_id/volume_id/fat.h b/extras/volume_id/volume_id/fat.h deleted file mode 100644 index 92fa953b11..0000000000 --- a/extras/volume_id/volume_id/fat.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_FAT_ -#define _VOLUME_ID_FAT_ - -extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/hfs.c b/extras/volume_id/volume_id/hfs.c deleted file mode 100644 index 8de8b9aaac..0000000000 --- a/extras/volume_id/volume_id/hfs.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "hfs.h" - -struct hfs_finder_info{ - uint32_t boot_folder; - uint32_t start_app; - uint32_t open_folder; - uint32_t os9_folder; - uint32_t reserved; - uint32_t osx_folder; - uint8_t id[8]; -} __attribute__((__packed__)); - -struct hfs_mdb { - uint8_t signature[2]; - uint32_t cr_date; - uint32_t ls_Mod; - uint16_t atrb; - uint16_t nm_fls; - uint16_t vbm_st; - uint16_t alloc_ptr; - uint16_t nm_al_blks; - uint32_t al_blk_size; - uint32_t clp_size; - uint16_t al_bl_st; - uint32_t nxt_cnid; - uint16_t free_bks; - uint8_t label_len; - uint8_t label[27]; - uint32_t vol_bkup; - uint16_t vol_seq_num; - uint32_t wr_cnt; - uint32_t xt_clump_size; - uint32_t ct_clump_size; - uint16_t num_root_dirs; - uint32_t file_count; - uint32_t dir_count; - struct hfs_finder_info finder_info; - uint8_t embed_sig[2]; - uint16_t embed_startblock; - uint16_t embed_blockcount; -} __attribute__((__packed__)) *hfs; - -struct hfsplus_bnode_descriptor { - uint32_t next; - uint32_t prev; - uint8_t type; - uint8_t height; - uint16_t num_recs; - uint16_t reserved; -} __attribute__((__packed__)); - -struct hfsplus_bheader_record { - uint16_t depth; - uint32_t root; - uint32_t leaf_count; - uint32_t leaf_head; - uint32_t leaf_tail; - uint16_t node_size; -} __attribute__((__packed__)); - -struct hfsplus_catalog_key { - uint16_t key_len; - uint32_t parent_id; - uint16_t unicode_len; - uint8_t unicode[255 * 2]; -} __attribute__((__packed__)); - -struct hfsplus_extent { - uint32_t start_block; - uint32_t block_count; -} __attribute__((__packed__)); - -#define HFSPLUS_EXTENT_COUNT 8 -struct hfsplus_fork { - uint64_t total_size; - uint32_t clump_size; - uint32_t total_blocks; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; -} __attribute__((__packed__)); - -struct hfsplus_vol_header { - uint8_t signature[2]; - uint16_t version; - uint32_t attributes; - uint32_t last_mount_vers; - uint32_t reserved; - uint32_t create_date; - uint32_t modify_date; - uint32_t backup_date; - uint32_t checked_date; - uint32_t file_count; - uint32_t folder_count; - uint32_t blocksize; - uint32_t total_blocks; - uint32_t free_blocks; - uint32_t next_alloc; - uint32_t rsrc_clump_sz; - uint32_t data_clump_sz; - uint32_t next_cnid; - uint32_t write_count; - uint64_t encodings_bmp; - struct hfs_finder_info finder_info; - struct hfsplus_fork alloc_file; - struct hfsplus_fork ext_file; - struct hfsplus_fork cat_file; - struct hfsplus_fork attr_file; - struct hfsplus_fork start_file; -} __attribute__((__packed__)) *hfsplus; - -#define HFS_SUPERBLOCK_OFFSET 0x400 -#define HFS_NODE_LEAF 0xff -#define HFSPLUS_POR_CNID 1 - -int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off) -{ - unsigned int blocksize; - unsigned int cat_block; - unsigned int ext_block_start; - unsigned int ext_block_count; - int ext; - unsigned int leaf_node_head; - unsigned int leaf_node_count; - unsigned int leaf_node_size; - unsigned int leaf_block; - uint64_t leaf_off; - unsigned int alloc_block_size; - unsigned int alloc_first_block; - unsigned int embed_first_block; - unsigned int record_count; - struct hfsplus_bnode_descriptor *descr; - struct hfsplus_bheader_record *bnode; - struct hfsplus_catalog_key *key; - unsigned int label_len; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; - const uint8_t *buf; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - hfs = (struct hfs_mdb *) buf; - if (memcmp(hfs->signature, "BD", 2) != 0) - goto checkplus; - - /* it may be just a hfs wrapper for hfs+ */ - if (memcmp(hfs->embed_sig, "H+", 2) == 0) { - alloc_block_size = be32_to_cpu(hfs->al_blk_size); - dbg("alloc_block_size 0x%x", alloc_block_size); - - alloc_first_block = be16_to_cpu(hfs->al_bl_st); - dbg("alloc_first_block 0x%x", alloc_first_block); - - embed_first_block = be16_to_cpu(hfs->embed_startblock); - dbg("embed_first_block 0x%x", embed_first_block); - - off += (alloc_first_block * 512) + - (embed_first_block * alloc_block_size); - dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - goto checkplus; - } - - if (hfs->label_len > 0 && hfs->label_len < 28) { - volume_id_set_label_raw(id, hfs->label, hfs->label_len); - volume_id_set_label_string(id, hfs->label, hfs->label_len) ; - } - - volume_id_set_uuid(id, hfs->finder_info.id, UUID_HFS); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hfs"; - - return 0; - -checkplus: - hfsplus = (struct hfsplus_vol_header *) buf; - if (memcmp(hfsplus->signature, "H+", 2) == 0) - goto hfsplus; - if (memcmp(hfsplus->signature, "HX", 2) == 0) - goto hfsplus; - return -1; - -hfsplus: - volume_id_set_uuid(id, hfsplus->finder_info.id, UUID_HFS); - - blocksize = be32_to_cpu(hfsplus->blocksize); - dbg("blocksize %u", blocksize); - - memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); - cat_block = be32_to_cpu(extents[0].start_block); - dbg("catalog start block 0x%x", cat_block); - - buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); - if (buf == NULL) - goto found; - - bnode = (struct hfsplus_bheader_record *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - leaf_node_head = be32_to_cpu(bnode->leaf_head); - dbg("catalog leaf node 0x%x", leaf_node_head); - - leaf_node_size = be16_to_cpu(bnode->node_size); - dbg("leaf node size 0x%x", leaf_node_size); - - leaf_node_count = be32_to_cpu(bnode->leaf_count); - dbg("leaf node count 0x%x", leaf_node_count); - if (leaf_node_count == 0) - goto found; - - leaf_block = (leaf_node_head * leaf_node_size) / blocksize; - - /* get physical location */ - for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { - ext_block_start = be32_to_cpu(extents[ext].start_block); - ext_block_count = be32_to_cpu(extents[ext].block_count); - dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); - - if (ext_block_count == 0) - goto found; - - /* this is our extent */ - if (leaf_block < ext_block_count) - break; - - leaf_block -= ext_block_count; - } - if (ext == HFSPLUS_EXTENT_COUNT) - goto found; - dbg("found block in extent %i", ext); - - leaf_off = (ext_block_start + leaf_block) * blocksize; - - buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size); - if (buf == NULL) - goto found; - - descr = (struct hfsplus_bnode_descriptor *) buf; - dbg("descriptor type 0x%x", descr->type); - - record_count = be16_to_cpu(descr->num_recs); - dbg("number of records %u", record_count); - if (record_count == 0) - goto found; - - if (descr->type != HFS_NODE_LEAF) - goto found; - - key = (struct hfsplus_catalog_key *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); - if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) - goto found; - - label_len = be16_to_cpu(key->unicode_len) * 2; - dbg("label unicode16 len %i", label_len); - volume_id_set_label_raw(id, key->unicode, label_len); - volume_id_set_label_unicode16(id, key->unicode, BE, label_len); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hfsplus"; - - return 0; -} diff --git a/extras/volume_id/volume_id/hfs.h b/extras/volume_id/volume_id/hfs.h deleted file mode 100644 index 4f732b6726..0000000000 --- a/extras/volume_id/volume_id/hfs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_HFS_ -#define _VOLUME_ID_HFS_ - -extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/highpoint.c b/extras/volume_id/volume_id/highpoint.c deleted file mode 100644 index 33c4a8c9c0..0000000000 --- a/extras/volume_id/volume_id/highpoint.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "highpoint.h" - -struct hpt37x_meta { - uint8_t filler1[32]; - uint32_t magic; -} __attribute__((packed)); - -struct hpt45x_meta { - uint32_t magic; -} __attribute__((packed)); - -#define HPT37X_CONFIG_OFF 0x1200 -#define HPT37X_MAGIC_OK 0x5a7816f0 -#define HPT37X_MAGIC_BAD 0x5a7816fd - -#define HPT45X_MAGIC_OK 0x5a7816f3 -#define HPT45X_MAGIC_BAD 0x5a7816fd - - -int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct hpt37x_meta *hpt; - uint32_t magic; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); - if (buf == NULL) - return -1; - - hpt = (struct hpt37x_meta *) buf; - magic = le32_to_cpu(hpt->magic); - if (magic != HPT37X_MAGIC_OK && magic != HPT37X_MAGIC_BAD) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "highpoint_raid_member"; - - return 0; -} - -int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct hpt45x_meta *hpt; - uint64_t meta_off; - uint32_t magic; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-11) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - hpt = (struct hpt45x_meta *) buf; - magic = le32_to_cpu(hpt->magic); - if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "highpoint_raid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/highpoint.h b/extras/volume_id/volume_id/highpoint.h deleted file mode 100644 index f04d5f1685..0000000000 --- a/extras/volume_id/volume_id/highpoint.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_HIGHPOINT_ -#define _VOLUME_ID_HIGHPOINT_ - -extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); -extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/volume_id/hpfs.c b/extras/volume_id/volume_id/hpfs.c deleted file mode 100644 index 3b97d9339d..0000000000 --- a/extras/volume_id/volume_id/hpfs.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "hpfs.h" - -struct hpfs_super -{ - uint8_t magic[4]; - uint8_t version; -} __attribute__((__packed__)); - -#define HPFS_SUPERBLOCK_OFFSET 0x2000 - -int volume_id_probe_hpfs(struct volume_id *id, uint64_t off) -{ - struct hpfs_super *hs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); - if (hs == NULL) - return -1; - - if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) { - sprintf(id->type_version, "%u", hs->version); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hpfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/volume_id/hpfs.h b/extras/volume_id/volume_id/hpfs.h deleted file mode 100644 index d33e43a114..0000000000 --- a/extras/volume_id/volume_id/hpfs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_HPFS_ -#define _VOLUME_ID_HPFS_ - -extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/iso9660.c b/extras/volume_id/volume_id/iso9660.c deleted file mode 100644 index 3999a1e7bf..0000000000 --- a/extras/volume_id/volume_id/iso9660.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "iso9660.h" - -#define ISO_SUPERBLOCK_OFFSET 0x8000 -#define ISO_SECTOR_SIZE 0x800 -#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) -#define ISO_VD_PRIMARY 0x1 -#define ISO_VD_SUPPLEMENTARY 0x2 -#define ISO_VD_END 0xff -#define ISO_VD_MAX 16 - -struct iso_volume_descriptor { - uint8_t vd_type; - uint8_t vd_id[5]; - uint8_t vd_version; - uint8_t flags; - uint8_t system_id[32]; - uint8_t volume_id[32]; - uint8_t unused[8]; - uint8_t space_size[8]; - uint8_t escape_sequences[8]; -} __attribute__((__packed__)); - -struct high_sierra_volume_descriptor { - uint8_t foo[8]; - uint8_t type; - uint8_t id[4]; - uint8_t version; -} __attribute__((__packed__)); - -int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) -{ - uint8_t *buf; - struct iso_volume_descriptor *is; - struct high_sierra_volume_descriptor *hs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - is = (struct iso_volume_descriptor *) buf; - - if (memcmp(is->vd_id, "CD001", 5) == 0) { - int vd_offset; - int i; - - dbg("read label from PVD"); - volume_id_set_label_raw(id, is->volume_id, 32); - volume_id_set_label_string(id, is->volume_id, 32); - - dbg("looking for SVDs"); - vd_offset = ISO_VD_OFFSET; - for (i = 0; i < ISO_VD_MAX; i++) { - uint8_t svd_label[64]; - - is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200); - if (is == NULL || is->vd_type == ISO_VD_END) - break; - if (is->vd_type != ISO_VD_SUPPLEMENTARY) - continue; - - dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset)); - if (memcmp(is->escape_sequences, "%/@", 3) == 0|| - memcmp(is->escape_sequences, "%/C", 3) == 0|| - memcmp(is->escape_sequences, "%/E", 3) == 0) { - dbg("Joliet extension found"); - volume_id_set_unicode16((char *)svd_label, sizeof(svd_label), is->volume_id, BE, 32); - if (memcmp(id->label, svd_label, 16) == 0) { - dbg("SVD label is identical, use the possibly longer PVD one"); - break; - } - - volume_id_set_label_raw(id, is->volume_id, 32); - volume_id_set_label_string(id, svd_label, 32); - strcpy(id->type_version, "Joliet Extension"); - goto found; - } - vd_offset += ISO_SECTOR_SIZE; - } - goto found; - } - - hs = (struct high_sierra_volume_descriptor *) buf; - - if (memcmp(hs->id, "CDROM", 5) == 0) { - strcpy(id->type_version, "High Sierra"); - goto found; - } - - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "iso9660"; - - return 0; -} diff --git a/extras/volume_id/volume_id/iso9660.h b/extras/volume_id/volume_id/iso9660.h deleted file mode 100644 index c407d416a2..0000000000 --- a/extras/volume_id/volume_id/iso9660.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_ISO9660_ -#define _VOLUME_ID_ISO9660_ - -extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/isw_raid.c b/extras/volume_id/volume_id/isw_raid.c deleted file mode 100644 index 745b42f2d1..0000000000 --- a/extras/volume_id/volume_id/isw_raid.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "isw_raid.h" - -struct isw_meta { - uint8_t sig[32]; - uint32_t check_sum; - uint32_t mpb_size; - uint32_t family_num; - uint32_t generation_num; -} __attribute__((packed)); - -#define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " - - -int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct isw_meta *isw; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-2) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - isw = (struct isw_meta *) buf; - if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - memcpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); - id->type = "isw_raid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/isw_raid.h b/extras/volume_id/volume_id/isw_raid.h deleted file mode 100644 index 55d8c49268..0000000000 --- a/extras/volume_id/volume_id/isw_raid.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_ISW_RAID_ -#define _VOLUME_ID_ISW_RAID_ - -extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/volume_id/jfs.c b/extras/volume_id/volume_id/jfs.c deleted file mode 100644 index 1b2bfdf0e9..0000000000 --- a/extras/volume_id/volume_id/jfs.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "jfs.h" - -struct jfs_super_block { - uint8_t magic[4]; - uint32_t version; - uint64_t size; - uint32_t bsize; - uint32_t dummy1; - uint32_t pbsize; - uint32_t dummy2[27]; - uint8_t uuid[16]; - uint8_t label[16]; - uint8_t loguuid[16]; -} __attribute__((__packed__)); - -#define JFS_SUPERBLOCK_OFFSET 0x8000 - -int volume_id_probe_jfs(struct volume_id *id, uint64_t off) -{ - struct jfs_super_block *js; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); - if (js == NULL) - return -1; - - if (memcmp(js->magic, "JFS1", 4) != 0) - return -1; - - volume_id_set_label_raw(id, js->label, 16); - volume_id_set_label_string(id, js->label, 16); - volume_id_set_uuid(id, js->uuid, UUID_DCE); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "jfs"; - - return 0; -} diff --git a/extras/volume_id/volume_id/jfs.h b/extras/volume_id/volume_id/jfs.h deleted file mode 100644 index 4ef0d8763c..0000000000 --- a/extras/volume_id/volume_id/jfs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_JFS_ -#define _VOLUME_ID_JFS_ - -extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/linux_raid.c b/extras/volume_id/volume_id/linux_raid.c deleted file mode 100644 index eb37dba367..0000000000 --- a/extras/volume_id/volume_id/linux_raid.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "linux_raid.h" - -struct mdp_super_block { - uint32_t md_magic; - uint32_t major_version; - uint32_t minor_version; - uint32_t patch_version; - uint32_t gvalid_words; - uint32_t set_uuid0; - uint32_t ctime; - uint32_t level; - uint32_t size; - uint32_t nr_disks; - uint32_t raid_disks; - uint32_t md_minor; - uint32_t not_persistent; - uint32_t set_uuid1; - uint32_t set_uuid2; - uint32_t set_uuid3; -} __attribute__((packed)) *mdp; - -#define MD_RESERVED_BYTES 0x10000 -#define MD_MAGIC 0xa92b4efc - -int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t sboff; - uint8_t uuid[16]; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; - buf = volume_id_get_buffer(id, off + sboff, 0x800); - if (buf == NULL) - return -1; - - mdp = (struct mdp_super_block *) buf; - - if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) - return -1; - - memcpy(uuid, &mdp->set_uuid0, 4); - memcpy(&uuid[4], &mdp->set_uuid1, 12); - volume_id_set_uuid(id, uuid, UUID_DCE); - - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", - le32_to_cpu(mdp->major_version), - le32_to_cpu(mdp->minor_version), - le32_to_cpu(mdp->patch_version)); - - dbg("found raid signature"); - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "linux_raid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/linux_raid.h b/extras/volume_id/volume_id/linux_raid.h deleted file mode 100644 index 8fdeebf5cd..0000000000 --- a/extras/volume_id/volume_id/linux_raid.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_LINUX_RAID_ -#define _VOLUME_ID_LINUX_RAID_ - -extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/volume_id/linux_swap.c b/extras/volume_id/volume_id/linux_swap.c deleted file mode 100644 index b3e22f6db2..0000000000 --- a/extras/volume_id/volume_id/linux_swap.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "linux_swap.h" - -struct swap_header_v1_2 { - uint8_t bootbits[1024]; - uint32_t version; - uint32_t last_page; - uint32_t nr_badpages; - uint8_t uuid[16]; - uint8_t volume_name[16]; -} __attribute__((__packed__)) *sw; - -#define LARGEST_PAGESIZE 0x4000 - -int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - unsigned int page; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - /* the swap signature is at the end of the PAGE_SIZE */ - for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { - buf = volume_id_get_buffer(id, off + page-10, 10); - if (buf == NULL) - return -1; - - if (memcmp(buf, "SWAP-SPACE", 10) == 0) { - strcpy(id->type_version, "1"); - goto found; - } - - if (memcmp(buf, "SWAPSPACE2", 10) == 0) { - sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); - if (sw == NULL) - return -1; - strcpy(id->type_version, "2"); - volume_id_set_label_raw(id, sw->volume_name, 16); - volume_id_set_label_string(id, sw->volume_name, 16); - volume_id_set_uuid(id, sw->uuid, UUID_DCE); - goto found; - } - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_OTHER); - id->type = "swap"; - - return 0; -} diff --git a/extras/volume_id/volume_id/linux_swap.h b/extras/volume_id/volume_id/linux_swap.h deleted file mode 100644 index e31ee6eb90..0000000000 --- a/extras/volume_id/volume_id/linux_swap.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_LINUX_SWAP_ -#define _VOLUME_ID_LINUX_SWAP_ - -extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/logging.h b/extras/volume_id/volume_id/logging.h deleted file mode 100644 index 4a8aa50d4c..0000000000 --- a/extras/volume_id/volume_id/logging.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * volume_id_logging - this file is used to map the dbg() function - * to the user's logging facility - * - * 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. - */ - -#ifndef _VOLUME_ID_LOGGING_H_ -#define _VOLUME_ID_LOGGING_H_ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - -/* just use the udev version */ -#include "../../../logging.h" - -#endif /* _VOLUME_ID_LOGGING_H_ */ diff --git a/extras/volume_id/volume_id/lsi_raid.c b/extras/volume_id/volume_id/lsi_raid.c deleted file mode 100644 index e5da281203..0000000000 --- a/extras/volume_id/volume_id/lsi_raid.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "lsi_raid.h" - -struct lsi_meta { - uint8_t sig[6]; -} __attribute__((packed)); - -#define LSI_SIGNATURE "$XIDE$" - -int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct lsi_meta *lsi; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - lsi = (struct lsi_meta *) buf; - if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "lsi_mega_raid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/lsi_raid.h b/extras/volume_id/volume_id/lsi_raid.h deleted file mode 100644 index 51a0bfbcc6..0000000000 --- a/extras/volume_id/volume_id/lsi_raid.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_LSI_RAID_ -#define _VOLUME_ID_LSI_RAID_ - -extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/volume_id/luks.c b/extras/volume_id/volume_id/luks.c deleted file mode 100644 index ff90f5d3d1..0000000000 --- a/extras/volume_id/volume_id/luks.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 W. Michael Petullo - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "util.h" -#include "logging.h" -#include "luks.h" - -#define SECTOR_SHIFT 9 -#define SECTOR_SIZE (1 << SECTOR_SHIFT) - -#define LUKS_CIPHERNAME_L 32 -#define LUKS_CIPHERMODE_L 32 -#define LUKS_HASHSPEC_L 32 -#define LUKS_DIGESTSIZE 20 -#define LUKS_SALTSIZE 32 -#define LUKS_NUMKEYS 8 - -const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; -#define LUKS_MAGIC_L 6 -#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) -#define UUID_STRING_L 40 - -struct luks_phdr { - uint8_t magic[LUKS_MAGIC_L]; - uint16_t version; - uint8_t cipherName[LUKS_CIPHERNAME_L]; - uint8_t cipherMode[LUKS_CIPHERMODE_L]; - uint8_t hashSpec[LUKS_HASHSPEC_L]; - uint32_t payloadOffset; - uint32_t keyBytes; - uint8_t mkDigest[LUKS_DIGESTSIZE]; - uint8_t mkDigestSalt[LUKS_SALTSIZE]; - uint32_t mkDigestIterations; - uint8_t uuid[UUID_STRING_L]; - struct { - uint32_t active; - uint32_t passwordIterations; - uint8_t passwordSalt[LUKS_SALTSIZE]; - uint32_t keyMaterialOffset; - uint32_t stripes; - } keyblock[LUKS_NUMKEYS]; -}; - -int volume_id_probe_luks(struct volume_id *id, uint64_t off) -{ - struct luks_phdr *header; - - header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE); - if (header == NULL) - return -1; - - if (memcmp(header->magic, LUKS_MAGIC, LUKS_MAGIC_L)) - return -1; - - volume_id_set_usage(id, VOLUME_ID_CRYPTO); - volume_id_set_uuid(id, header->uuid, UUID_DCE_STRING); - - id->type = "crypto_LUKS"; - - return 0; -} diff --git a/extras/volume_id/volume_id/luks.h b/extras/volume_id/volume_id/luks.h deleted file mode 100644 index fbf3fcd846..0000000000 --- a/extras/volume_id/volume_id/luks.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 W. Michael Petullo - * - * 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. - */ - -#ifndef _VOLUME_ID_LUKS_ -#define _VOLUME_ID_LUKS_ - -extern int volume_id_probe_luks(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/lvm.c b/extras/volume_id/volume_id/lvm.c deleted file mode 100644 index a188402da8..0000000000 --- a/extras/volume_id/volume_id/lvm.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "lvm.h" - -struct lvm1_super_block { - uint8_t id[2]; -} __attribute__((packed)); - -struct lvm2_super_block { - uint8_t id[8]; - uint64_t sector_xl; - uint32_t crc_xl; - uint32_t offset_xl; - uint8_t type[8]; -} __attribute__((packed)); - -#define LVM1_SB_OFF 0x400 -#define LVM1_MAGIC "HM" - -int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct lvm1_super_block *lvm; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); - if (buf == NULL) - return -1; - - lvm = (struct lvm1_super_block *) buf; - - if (memcmp(lvm->id, LVM1_MAGIC, 2) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "LVM1_member"; - - return 0; -} - -#define LVM2_LABEL_ID "LABELONE" -#define LVM2LABEL_SCAN_SECTORS 4 - -int volume_id_probe_lvm2(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - unsigned int soff; - struct lvm2_super_block *lvm; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); - if (buf == NULL) - return -1; - - - for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { - lvm = (struct lvm2_super_block *) &buf[soff]; - - if (memcmp(lvm->id, LVM2_LABEL_ID, 8) == 0) - goto found; - } - - return -1; - -found: - memcpy(id->type_version, lvm->type, 8); - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "LVM2_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/lvm.h b/extras/volume_id/volume_id/lvm.h deleted file mode 100644 index d07cb53af6..0000000000 --- a/extras/volume_id/volume_id/lvm.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_LVM_ -#define _VOLUME_ID_LVM_ - -extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off); -extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/mac.c b/extras/volume_id/volume_id/mac.c deleted file mode 100644 index 1587f48823..0000000000 --- a/extras/volume_id/volume_id/mac.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "mac.h" - -struct mac_driver_desc { - uint8_t signature[2]; - uint16_t block_size; - uint32_t block_count; -} __attribute__((__packed__)); - -struct mac_partition { - uint8_t signature[2]; - uint16_t res1; - uint32_t map_count; - uint32_t start_block; - uint32_t block_count; - uint8_t name[32]; - uint8_t type[32]; -} __attribute__((__packed__)); - -int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct mac_driver_desc *driver; - struct mac_partition *part; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if ((memcmp(part->signature, "PM", 2) == 0) && - (memcmp(part->type, "Apple_partition_map", 19) == 0)) { - /* linux creates an own subdevice for the map - * just return the type if the drive header is missing */ - volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); - id->type = "mac_partition_map"; - return 0; - } - - driver = (struct mac_driver_desc *) buf; - if (memcmp(driver->signature, "ER", 2) == 0) { - /* we are on a main device, like a CD - * just try to probe the first partition from the map */ - unsigned int bsize = be16_to_cpu(driver->block_size); - int part_count; - int i; - - /* get first entry of partition table */ - buf = volume_id_get_buffer(id, off + bsize, 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if (memcmp(part->signature, "PM", 2) != 0) - return -1; - - part_count = be32_to_cpu(part->map_count); - dbg("expecting %d partition entries", part_count); - - if (id->partitions != NULL) - free(id->partitions); - id->partitions = - malloc(part_count * sizeof(struct volume_id_partition)); - if (id->partitions == NULL) - return -1; - memset(id->partitions, 0x00, sizeof(struct volume_id_partition)); - - id->partition_count = part_count; - - for (i = 0; i < part_count; i++) { - uint64_t poff; - uint64_t plen; - - buf = volume_id_get_buffer(id, off + ((i+1) * bsize), 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if (memcmp(part->signature, "PM", 2) != 0) - return -1; - - poff = be32_to_cpu(part->start_block) * bsize; - plen = be32_to_cpu(part->block_count) * bsize; - dbg("found '%s' partition entry at 0x%llx, len 0x%llx", - part->type, (unsigned long long) poff, (unsigned long long) plen); - - id->partitions[i].off = poff; - id->partitions[i].len = plen; - - if (memcmp(part->type, "Apple_Free", 10) == 0) { - volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED); - } else if (memcmp(part->type, "Apple_partition_map", 19) == 0) { - volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE); - } else { - volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED); - } - } - volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); - id->type = "mac_partition_map"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/volume_id/mac.h b/extras/volume_id/volume_id/mac.h deleted file mode 100644 index 77b8ccda6f..0000000000 --- a/extras/volume_id/volume_id/mac.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_MAC_ -#define _VOLUME_ID_MAC_ - -extern int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/minix.c b/extras/volume_id/volume_id/minix.c deleted file mode 100644 index b081afab49..0000000000 --- a/extras/volume_id/volume_id/minix.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "minix.h" - -struct minix_super_block -{ - uint16_t s_ninodes; - uint16_t s_nzones; - uint16_t s_imap_blocks; - uint16_t s_zmap_blocks; - uint16_t s_firstdatazone; - uint16_t s_log_zone_size; - uint32_t s_max_size; - uint16_t s_magic; - uint16_t s_state; - uint32_t s_zones; -} __attribute__((__packed__)); - -#define MINIX_SUPERBLOCK_OFFSET 0x400 - -int volume_id_probe_minix(struct volume_id *id, uint64_t off) -{ - struct minix_super_block *ms; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - ms = (struct minix_super_block *) volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); - if (ms == NULL) - return -1; - - if (le16_to_cpu(ms->s_magic) == 0x137f) { - strcpy(id->type_version, "1"); - goto found; - } - - if (le16_to_cpu(ms->s_magic) == 0x1387) { - strcpy(id->type_version, "1"); - goto found; - } - - if (le16_to_cpu(ms->s_magic) == 0x2468) { - strcpy(id->type_version, "2"); - goto found; - } - - if (le16_to_cpu(ms->s_magic) == 0x2478) { - strcpy(id->type_version, "2"); - goto found; - } - - goto exit; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "minix"; - return 0; - -exit: - return -1; -} diff --git a/extras/volume_id/volume_id/minix.h b/extras/volume_id/volume_id/minix.h deleted file mode 100644 index 3020cc0464..0000000000 --- a/extras/volume_id/volume_id/minix.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_MINIX_ -#define _VOLUME_ID_MINIX_ - -extern int volume_id_probe_minix(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/msdos.c b/extras/volume_id/volume_id/msdos.c deleted file mode 100644 index ab18fc3585..0000000000 --- a/extras/volume_id/volume_id/msdos.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "msdos.h" - -struct msdos_partition_entry { - uint8_t boot_ind; - uint8_t head; - uint8_t sector; - uint8_t cyl; - uint8_t sys_ind; - uint8_t end_head; - uint8_t end_sector; - uint8_t end_cyl; - uint32_t start_sect; - uint32_t nr_sects; -} __attribute__((packed)); - -#define MSDOS_MAGIC "\x55\xaa" -#define MSDOS_PARTTABLE_OFFSET 0x1be -#define MSDOS_SIG_OFF 0x1fe -#define BSIZE 0x200 -#define DOS_EXTENDED_PARTITION 0x05 -#define LINUX_EXTENDED_PARTITION 0x85 -#define WIN98_EXTENDED_PARTITION 0x0f -#define LINUX_RAID_PARTITION 0xfd -#define is_extended(type) \ - (type == DOS_EXTENDED_PARTITION || \ - type == WIN98_EXTENDED_PARTITION || \ - type == LINUX_EXTENDED_PARTITION) -#define is_raid(type) \ - (type == LINUX_RAID_PARTITION) - -int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - int i; - uint64_t poff; - uint64_t plen; - uint64_t extended = 0; - uint64_t current; - uint64_t next; - int limit; - int empty = 1; - struct msdos_partition_entry *part; - struct volume_id_partition *p; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) - return -1; - - /* check flags on all entries for a valid partition table */ - part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; - for (i = 0; i < 4; i++) { - if (part[i].boot_ind != 0 && - part[i].boot_ind != 0x80) - return -1; - - if (le32_to_cpu(part[i].nr_sects) != 0) - empty = 0; - } - if (empty == 1) - return -1; - - if (id->partitions != NULL) - free(id->partitions); - id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX * - sizeof(struct volume_id_partition)); - if (id->partitions == NULL) - return -1; - memset(id->partitions, 0x00, - VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); - - for (i = 0; i < 4; i++) { - poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; - - if (plen == 0) - continue; - - p = &id->partitions[i]; - - p->partition_type_raw = part[i].sys_ind; - - if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", (unsigned long long) poff); - volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE); - p->type = "msdos_extended_partition"; - if (extended == 0) - extended = off + poff; - } else { - dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen); - - if (is_raid(part[i].sys_ind)) - volume_id_set_usage_part(p, VOLUME_ID_RAID); - else - volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); - } - - p->off = off + poff; - p->len = plen; - id->partition_count = i+1; - } - - next = extended; - current = extended; - limit = 50; - - /* follow extended partition chain and add data partitions */ - while (next != 0) { - if (limit-- == 0) { - dbg("extended chain limit reached"); - break; - } - - buf = volume_id_get_buffer(id, current, 0x200); - if (buf == NULL) - break; - - part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; - - if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) - break; - - next = 0; - - for (i = 0; i < 4; i++) { - poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; - - if (plen == 0) - continue; - - if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", (unsigned long long) poff); - if (next == 0) - next = extended + poff; - } else { - dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen); - - /* we always start at the 5th entry */ - while (id->partition_count < 4) - volume_id_set_usage_part(&id->partitions[id->partition_count++], VOLUME_ID_UNUSED); - - p = &id->partitions[id->partition_count]; - - if (is_raid(part[i].sys_ind)) - volume_id_set_usage_part(p, VOLUME_ID_RAID); - else - volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); - - p->off = current + poff; - p->len = plen; - id->partition_count++; - - p->partition_type_raw = part[i].sys_ind; - - if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { - dbg("too many partitions"); - next = 0; - } - } - } - - current = next; - } - - volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); - id->type = "msdos_partition_table"; - - return 0; -} diff --git a/extras/volume_id/volume_id/msdos.h b/extras/volume_id/volume_id/msdos.h deleted file mode 100644 index b319f05d63..0000000000 --- a/extras/volume_id/volume_id/msdos.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_MSDOS_ -#define _VOLUME_ID_MSDOS_ - -extern int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/ntfs.c b/extras/volume_id/volume_id/ntfs.c deleted file mode 100644 index 39aa2d73c6..0000000000 --- a/extras/volume_id/volume_id/ntfs.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "ntfs.h" - -struct ntfs_super_block { - uint8_t jump[3]; - uint8_t oem_id[8]; - uint16_t bytes_per_sector; - uint8_t sectors_per_cluster; - uint16_t reserved_sectors; - uint8_t fats; - uint16_t root_entries; - uint16_t sectors; - uint8_t media_type; - uint16_t sectors_per_fat; - uint16_t sectors_per_track; - uint16_t heads; - uint32_t hidden_sectors; - uint32_t large_sectors; - uint16_t unused[2]; - uint64_t number_of_sectors; - uint64_t mft_cluster_location; - uint64_t mft_mirror_cluster_location; - int8_t cluster_per_mft_record; - uint8_t reserved1[3]; - int8_t cluster_per_index_record; - uint8_t reserved2[3]; - uint8_t volume_serial[8]; - uint16_t checksum; -} __attribute__((__packed__)) *ns; - -struct master_file_table_record { - uint8_t magic[4]; - uint16_t usa_ofs; - uint16_t usa_count; - uint64_t lsn; - uint16_t sequence_number; - uint16_t link_count; - uint16_t attrs_offset; - uint16_t flags; - uint32_t bytes_in_use; - uint32_t bytes_allocated; -} __attribute__((__packed__)) *mftr; - -struct file_attribute { - uint32_t type; - uint32_t len; - uint8_t non_resident; - uint8_t name_len; - uint16_t name_offset; - uint16_t flags; - uint16_t instance; - uint32_t value_len; - uint16_t value_offset; -} __attribute__((__packed__)) *attr; - -struct volume_info { - uint64_t reserved; - uint8_t major_ver; - uint8_t minor_ver; -} __attribute__((__packed__)) *info; - -#define MFT_RECORD_VOLUME 3 -#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 -#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 -#define MFT_RECORD_ATTR_OBJECT_ID 0x40 -#define MFT_RECORD_ATTR_END 0xffffffffu - -int volume_id_probe_ntfs(struct volume_id *id, uint64_t off) -{ - unsigned int sector_size; - unsigned int cluster_size; - uint64_t mft_cluster; - uint64_t mft_off; - unsigned int mft_record_size; - unsigned int attr_type; - unsigned int attr_off; - unsigned int attr_len; - unsigned int val_off; - unsigned int val_len; - const uint8_t *buf; - const uint8_t *val; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); - if (ns == NULL) - return -1; - - if (memcmp(ns->oem_id, "NTFS", 4) != 0) - return -1; - - volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS); - - sector_size = le16_to_cpu(ns->bytes_per_sector); - cluster_size = ns->sectors_per_cluster * sector_size; - mft_cluster = le64_to_cpu(ns->mft_cluster_location); - mft_off = mft_cluster * cluster_size; - - if (ns->cluster_per_mft_record < 0) - /* size = -log2(mft_record_size); normally 1024 Bytes */ - mft_record_size = 1 << -ns->cluster_per_mft_record; - else - mft_record_size = ns->cluster_per_mft_record * cluster_size; - - dbg("sectorsize 0x%x", sector_size); - dbg("clustersize 0x%x", cluster_size); - dbg("mftcluster %llu", (unsigned long long) mft_cluster); - dbg("mftoffset 0x%llx", (unsigned long long) mft_off); - dbg("cluster per mft_record %i", ns->cluster_per_mft_record); - dbg("mft record size %i", mft_record_size); - - buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), - mft_record_size); - if (buf == NULL) - goto found; - - mftr = (struct master_file_table_record*) buf; - - dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); - if (memcmp(mftr->magic, "FILE", 4) != 0) - goto found; - - attr_off = le16_to_cpu(mftr->attrs_offset); - dbg("file $Volume's attributes are at offset %i", attr_off); - - while (1) { - attr = (struct file_attribute*) &buf[attr_off]; - attr_type = le32_to_cpu(attr->type); - attr_len = le16_to_cpu(attr->len); - val_off = le16_to_cpu(attr->value_offset); - val_len = le32_to_cpu(attr->value_len); - attr_off += attr_len; - - if (attr_len == 0) - break; - - if (attr_off >= mft_record_size) - break; - - if (attr_type == MFT_RECORD_ATTR_END) - break; - - dbg("found attribute type 0x%x, len %i, at offset %i", - attr_type, attr_len, attr_off); - - if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { - dbg("found info, len %i", val_len); - info = (struct volume_info*) (((uint8_t *) attr) + val_off); - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", info->major_ver, info->minor_ver); - } - - if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { - dbg("found label, len %i", val_len); - if (val_len > VOLUME_ID_LABEL_SIZE) - val_len = VOLUME_ID_LABEL_SIZE; - - val = ((uint8_t *) attr) + val_off; - volume_id_set_label_raw(id, val, val_len); - volume_id_set_label_unicode16(id, val, LE, val_len); - } - } - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "ntfs"; - - return 0; -} diff --git a/extras/volume_id/volume_id/ntfs.h b/extras/volume_id/volume_id/ntfs.h deleted file mode 100644 index 8d59159685..0000000000 --- a/extras/volume_id/volume_id/ntfs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_NTFS_ -#define _VOLUME_ID_NTFS_ - -extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/nvidia_raid.c b/extras/volume_id/volume_id/nvidia_raid.c deleted file mode 100644 index 9198f1e067..0000000000 --- a/extras/volume_id/volume_id/nvidia_raid.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "nvidia_raid.h" - -struct nvidia_meta { - uint8_t vendor[8]; - uint32_t size; - uint32_t chksum; - uint16_t version; -} __attribute__((packed)); - -#define NVIDIA_SIGNATURE "NVIDIA" - -int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct nvidia_meta *nv; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-2) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - nv = (struct nvidia_meta *) buf; - if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le16_to_cpu(nv->version)); - id->type = "nvidia_raid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/nvidia_raid.h b/extras/volume_id/volume_id/nvidia_raid.h deleted file mode 100644 index 80c51692aa..0000000000 --- a/extras/volume_id/volume_id/nvidia_raid.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_NVIDIA_RAID_ -#define _VOLUME_ID_NVIDIA_RAID_ - -extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/volume_id/ocfs.c b/extras/volume_id/volume_id/ocfs.c deleted file mode 100644 index 88064ed193..0000000000 --- a/extras/volume_id/volume_id/ocfs.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Andre Masella - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "ocfs.h" - - -struct ocfs1_super_block_header { - uint32_t minor_version; - uint32_t major_version; - uint8_t signature[128]; - uint8_t mount_point[128]; - uint64_t serial_num; - uint64_t device_size; - uint64_t start_off; - uint64_t bitmap_off; - uint64_t publ_off; - uint64_t vote_off; - uint64_t root_bitmap_off; - uint64_t data_start_off; - uint64_t root_bitmap_size; - uint64_t root_off; - uint64_t root_size; - uint64_t cluster_size; - uint64_t num_nodes; - uint64_t num_clusters; - uint64_t dir_node_size; - uint64_t file_node_size; - uint64_t internal_off; - uint64_t node_cfg_off; - uint64_t node_cfg_size; - uint64_t new_cfg_off; - uint32_t prot_bits; - int32_t excl_mount; -} __attribute__((__packed__)); - -struct ocfs1_super_block_label { - struct ocfs1_disk_lock { - uint32_t curr_master; - uint8_t file_lock; - uint8_t compat_pad[3]; - uint64_t last_write_time; - uint64_t last_read_time; - uint32_t writer_node_num; - uint32_t reader_node_num; - uint64_t oin_node_map; - uint64_t dlock_seq_num; - } disk_lock __attribute__((__packed__)); - uint8_t label[64]; - uint16_t label_len; - uint8_t vol_id[16]; - uint16_t vol_id_len; - uint8_t cluster_name[64]; - uint16_t cluster_name_len; -} __attribute__((__packed__)); - -struct ocfs2_super_block { - uint8_t i_signature[8]; - uint32_t i_generation; - int16_t i_suballoc_slot; - uint16_t i_suballoc_bit; - uint32_t i_reserved0; - uint32_t i_clusters; - uint32_t i_uid; - uint32_t i_gid; - uint64_t i_size; - uint16_t i_mode; - uint16_t i_links_count; - uint32_t i_flags; - uint64_t i_atime; - uint64_t i_ctime; - uint64_t i_mtime; - uint64_t i_dtime; - uint64_t i_blkno; - uint64_t i_last_eb_blk; - uint32_t i_fs_generation; - uint32_t i_atime_nsec; - uint32_t i_ctime_nsec; - uint32_t i_mtime_nsec; - uint64_t i_reserved1[9]; - uint64_t i_pad1; - uint16_t s_major_rev_level; - uint16_t s_minor_rev_level; - uint16_t s_mnt_count; - int16_t s_max_mnt_count; - uint16_t s_state; - uint16_t s_errors; - uint32_t s_checkinterval; - uint64_t s_lastcheck; - uint32_t s_creator_os; - uint32_t s_feature_compat; - uint32_t s_feature_incompat; - uint32_t s_feature_ro_compat; - uint64_t s_root_blkno; - uint64_t s_system_dir_blkno; - uint32_t s_blocksize_bits; - uint32_t s_clustersize_bits; - uint16_t s_max_slots; - uint16_t s_reserved1; - uint32_t s_reserved2; - uint64_t s_first_cluster_group; - uint8_t s_label[64]; - uint8_t s_uuid[16]; -} __attribute__((__packed__)); - -int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct ocfs1_super_block_header *osh; - struct ocfs1_super_block_label *osl; - - buf = volume_id_get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - osh = (struct ocfs1_super_block_header *) buf; - if (memcmp(osh->signature, "OracleCFS", 9) != 0) - return -1; - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", osh->major_version, osh->minor_version); - - dbg("found OracleCFS signature, now reading label"); - buf = volume_id_get_buffer(id, off + 0x200, 0x200); - if (buf == NULL) - return -1; - - osl = (struct ocfs1_super_block_label *) buf; - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - if (osl->label_len <= 64) { - volume_id_set_label_raw(id, osl->label, 64); - volume_id_set_label_string(id, osl->label, 64); - } - if (osl->vol_id_len == 16) - volume_id_set_uuid(id, osl->vol_id, UUID_DCE); - id->type = "ocfs"; - return 0; -} - -#define OCFS2_MAX_BLOCKSIZE 0x1000 -#define OCFS2_SUPER_BLOCK_BLKNO 2 - -int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct ocfs2_super_block *os; - size_t blksize; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { - buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); - if (buf == NULL) - return -1; - - os = (struct ocfs2_super_block *) buf; - if (memcmp(os->i_signature, "OCFSV2", 6) != 0) - continue; - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - volume_id_set_label_raw(id, os->s_label, 64); - volume_id_set_label_string(id, os->s_label, 64); - volume_id_set_uuid(id, os->s_uuid, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", os->s_major_rev_level, os->s_minor_rev_level); - id->type = "ocfs2"; - return 0; - } - return -1; -} diff --git a/extras/volume_id/volume_id/ocfs.h b/extras/volume_id/volume_id/ocfs.h deleted file mode 100644 index 9d46b28dcd..0000000000 --- a/extras/volume_id/volume_id/ocfs.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Andre Masella - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_OCFS1_ -#define _VOLUME_ID_OCFS1_ - -extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/promise_raid.c b/extras/volume_id/volume_id/promise_raid.c deleted file mode 100644 index 54832a888a..0000000000 --- a/extras/volume_id/volume_id/promise_raid.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "promise_raid.h" - -struct promise_meta { - uint8_t sig[24]; -} __attribute__((packed)); - -#define PDC_CONFIG_OFF 0x1200 -#define PDC_SIGNATURE "Promise Technology, Inc." - -int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct promise_meta *pdc; - unsigned int i; - static unsigned int sectors[] = { - 63, 255, 256, 16, 399, 0 - }; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x40000) - return -1; - - for (i = 0; sectors[i] != 0; i++) { - uint64_t meta_off; - - meta_off = ((size / 0x200) - sectors[i]) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - pdc = (struct promise_meta *) buf; - if (memcmp(pdc->sig, PDC_SIGNATURE, sizeof(PDC_SIGNATURE)-1) == 0) - goto found; - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "promise_fasttrack_raid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/promise_raid.h b/extras/volume_id/volume_id/promise_raid.h deleted file mode 100644 index a46b062015..0000000000 --- a/extras/volume_id/volume_id/promise_raid.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_PROMISE_RAID_ -#define _VOLUME_ID_PROMISE_RAID_ - -extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/volume_id/reiserfs.c b/extras/volume_id/volume_id/reiserfs.c deleted file mode 100644 index e64b08acdd..0000000000 --- a/extras/volume_id/volume_id/reiserfs.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * Copyright (C) 2005 Tobias Klauser - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "reiserfs.h" - -struct reiserfs_super_block { - uint32_t blocks_count; - uint32_t free_blocks; - uint32_t root_block; - uint32_t journal_block; - uint32_t journal_dev; - uint32_t orig_journal_size; - uint32_t dummy2[5]; - uint16_t blocksize; - uint16_t dummy3[3]; - uint8_t magic[12]; - uint32_t dummy4[5]; - uint8_t uuid[16]; - uint8_t label[16]; -} __attribute__((__packed__)); - -struct reiser4_super_block { - uint8_t magic[16]; - uint16_t dummy[2]; - uint8_t uuid[16]; - uint8_t label[16]; - uint64_t dummy2; -} __attribute__((__packed__)); - -#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 -#define REISERFS_SUPERBLOCK_OFFSET 0x10000 - -int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) -{ - struct reiserfs_super_block *rs; - struct reiser4_super_block *rs4; - uint8_t *buf; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - rs = (struct reiserfs_super_block *) buf;; - if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { - strcpy(id->type_version, "3.5"); - id->type = "reiserfs"; - goto found; - } - if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { - strcpy(id->type_version, "3.6"); - id->type = "reiserfs"; - goto found_label; - } - if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { - strcpy(id->type_version, "JR"); - id->type = "reiserfs"; - goto found_label; - } - - rs4 = (struct reiser4_super_block *) buf; - if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) { - strcpy(id->type_version, "4"); - volume_id_set_label_raw(id, rs4->label, 16); - volume_id_set_label_string(id, rs4->label, 16); - volume_id_set_uuid(id, rs4->uuid, UUID_DCE); - id->type = "reiser4"; - goto found; - } - - buf = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - rs = (struct reiserfs_super_block *) buf; - if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { - strcpy(id->type_version, "3.5"); - id->type = "reiserfs"; - goto found; - } - - return -1; - -found_label: - volume_id_set_label_raw(id, rs->label, 16); - volume_id_set_label_string(id, rs->label, 16); - volume_id_set_uuid(id, rs->uuid, UUID_DCE); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - - return 0; -} diff --git a/extras/volume_id/volume_id/reiserfs.h b/extras/volume_id/volume_id/reiserfs.h deleted file mode 100644 index 57ee05ea2e..0000000000 --- a/extras/volume_id/volume_id/reiserfs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_REISERFS_ -#define _VOLUME_ID_REISERFS_ - -extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/romfs.c b/extras/volume_id/volume_id/romfs.c deleted file mode 100644 index 3373f36497..0000000000 --- a/extras/volume_id/volume_id/romfs.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "romfs.h" - -struct romfs_super { - uint8_t magic[8]; - uint32_t size; - uint32_t checksum; - uint8_t name[0]; -} __attribute__((__packed__)); - -int volume_id_probe_romfs(struct volume_id *id, uint64_t off) -{ - struct romfs_super *rfs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); - if (rfs == NULL) - return -1; - - if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { - size_t len = strlen((char *)rfs->name); - - if (len) { - volume_id_set_label_raw(id, rfs->name, len); - volume_id_set_label_string(id, rfs->name, len); - } - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "romfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/volume_id/romfs.h b/extras/volume_id/volume_id/romfs.h deleted file mode 100644 index 5fe56dcdfe..0000000000 --- a/extras/volume_id/volume_id/romfs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_ROMFS_ -#define _VOLUME_ID_ROMFS_ - -extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/silicon_raid.c b/extras/volume_id/volume_id/silicon_raid.c deleted file mode 100644 index 5f68127c4f..0000000000 --- a/extras/volume_id/volume_id/silicon_raid.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "silicon_raid.h" - -struct silicon_meta { - uint8_t unknown0[0x2E]; - uint8_t ascii_version[0x36 - 0x2E]; - uint8_t diskname[0x56 - 0x36]; - uint8_t unknown1[0x60 - 0x56]; - uint32_t magic; - uint32_t unknown1a[0x6C - 0x64]; - uint32_t array_sectors_low; - uint32_t array_sectors_high; - uint8_t unknown2[0x78 - 0x74]; - uint32_t thisdisk_sectors; - uint8_t unknown3[0x100 - 0x7C]; - uint8_t unknown4[0x104 - 0x100]; - uint16_t product_id; - uint16_t vendor_id; - uint16_t minor_ver; - uint16_t major_ver; -} __attribute__((packed)); - -#define SILICON_MAGIC 0x2F000000 - -int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct silicon_meta *sil; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - sil = (struct silicon_meta *) buf; - if (le32_to_cpu(sil->magic) != SILICON_MAGIC) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", - le16_to_cpu(sil->major_ver), le16_to_cpu(sil->minor_ver)); - id->type = "silicon_medley_raid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/silicon_raid.h b/extras/volume_id/volume_id/silicon_raid.h deleted file mode 100644 index f80c1a4a3f..0000000000 --- a/extras/volume_id/volume_id/silicon_raid.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_SILICON_RAID_ -#define _VOLUME_ID_SILICON_RAID_ - -extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/volume_id/sysv.c b/extras/volume_id/volume_id/sysv.c deleted file mode 100644 index 610edb8876..0000000000 --- a/extras/volume_id/volume_id/sysv.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "sysv.h" - -#define SYSV_NICINOD 100 -#define SYSV_NICFREE 50 - -struct sysv_super -{ - uint16_t s_isize; - uint16_t s_pad0; - uint32_t s_fsize; - uint16_t s_nfree; - uint16_t s_pad1; - uint32_t s_free[SYSV_NICFREE]; - uint16_t s_ninode; - uint16_t s_pad2; - uint16_t s_inode[SYSV_NICINOD]; - uint8_t s_flock; - uint8_t s_ilock; - uint8_t s_fmod; - uint8_t s_ronly; - uint32_t s_time; - uint16_t s_dinfo[4]; - uint32_t s_tfree; - uint16_t s_tinode; - uint16_t s_pad3; - uint8_t s_fname[6]; - uint8_t s_fpack[6]; - uint32_t s_fill[12]; - uint32_t s_state; - uint32_t s_magic; - uint32_t s_type; -} __attribute__((__packed__)); - -#define XENIX_NICINOD 100 -#define XENIX_NICFREE 100 - -struct xenix_super { - uint16_t s_isize; - uint32_t s_fsize; - uint16_t s_nfree; - uint32_t s_free[XENIX_NICFREE]; - uint16_t s_ninode; - uint16_t s_inode[XENIX_NICINOD]; - uint8_t s_flock; - uint8_t s_ilock; - uint8_t s_fmod; - uint8_t s_ronly; - uint32_t s_time; - uint32_t s_tfree; - uint16_t s_tinode; - uint16_t s_dinfo[4]; - uint8_t s_fname[6]; - uint8_t s_fpack[6]; - uint8_t s_clean; - uint8_t s_fill[371]; - uint32_t s_magic; - uint32_t s_type; -} __attribute__((__packed__)); - -#define SYSV_SUPERBLOCK_BLOCK 0x01 -#define SYSV_MAGIC 0xfd187e20 -#define XENIX_SUPERBLOCK_BLOCK 0x18 -#define XENIX_MAGIC 0x2b5544 -#define SYSV_MAX_BLOCKSIZE 0x800 - -int volume_id_probe_sysv(struct volume_id *id, uint64_t off) -{ - struct sysv_super *vs; - struct xenix_super *xs; - unsigned int boff; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { - vs = (struct sysv_super *) - volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200); - if (vs == NULL) - return -1; - - if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) { - volume_id_set_label_raw(id, vs->s_fname, 6); - volume_id_set_label_string(id, vs->s_fname, 6); - id->type = "sysv"; - goto found; - } - } - - for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { - xs = (struct xenix_super *) - volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200); - if (xs == NULL) - return -1; - - if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) { - volume_id_set_label_raw(id, xs->s_fname, 6); - volume_id_set_label_string(id, xs->s_fname, 6); - id->type = "xenix"; - goto found; - } - } - - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - return 0; -} diff --git a/extras/volume_id/volume_id/sysv.h b/extras/volume_id/volume_id/sysv.h deleted file mode 100644 index b8c369ec08..0000000000 --- a/extras/volume_id/volume_id/sysv.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_SYSV_ -#define _VOLUME_ID_SYSV_ - -extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/udf.c b/extras/volume_id/volume_id/udf.c deleted file mode 100644 index f54ca87c8f..0000000000 --- a/extras/volume_id/volume_id/udf.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "udf.h" - -struct volume_descriptor { - struct descriptor_tag { - uint16_t id; - uint16_t version; - uint8_t checksum; - uint8_t reserved; - uint16_t serial; - uint16_t crc; - uint16_t crc_len; - uint32_t location; - } __attribute__((__packed__)) tag; - union { - struct anchor_descriptor { - uint32_t length; - uint32_t location; - } __attribute__((__packed__)) anchor; - struct primary_descriptor { - uint32_t seq_num; - uint32_t desc_num; - struct dstring { - uint8_t clen; - uint8_t c[31]; - } __attribute__((__packed__)) ident; - } __attribute__((__packed__)) primary; - } __attribute__((__packed__)) type; -} __attribute__((__packed__)); - -struct volume_structure_descriptor { - uint8_t type; - uint8_t id[5]; - uint8_t version; -} __attribute__((__packed__)); - -#define UDF_VSD_OFFSET 0x8000 - -int volume_id_probe_udf(struct volume_id *id, uint64_t off) -{ - struct volume_descriptor *vd; - struct volume_structure_descriptor *vsd; - unsigned int bs; - unsigned int b; - unsigned int type; - unsigned int count; - unsigned int loc; - unsigned int clen; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); - if (vsd == NULL) - return -1; - - if (memcmp(vsd->id, "NSR02", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "NSR03", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "BEA01", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "BOOT2", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "CD001", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "CDW02", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "TEA03", 5) == 0) - goto blocksize; - return -1; - -blocksize: - /* search the next VSD to get the logical block size of the volume */ - for (bs = 0x800; bs < 0x8000; bs += 0x800) { - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); - if (vsd == NULL) - return -1; - dbg("test for blocksize: 0x%x", bs); - if (vsd->id[0] != '\0') - goto nsr; - } - return -1; - -nsr: - /* search the list of VSDs for a NSR descriptor */ - for (b = 0; b < 64; b++) { - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); - if (vsd == NULL) - return -1; - - dbg("vsd: %c%c%c%c%c", - vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); - - if (vsd->id[0] == '\0') - return -1; - if (memcmp(vsd->id, "NSR02", 5) == 0) - goto anchor; - if (memcmp(vsd->id, "NSR03", 5) == 0) - goto anchor; - } - return -1; - -anchor: - /* read anchor volume descriptor */ - vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - if (type != 2) /* TAG_ID_AVDP */ - goto found; - - /* get desriptor list address and block count */ - count = le32_to_cpu(vd->type.anchor.length) / bs; - loc = le32_to_cpu(vd->type.anchor.location); - dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); - - /* pick the primary descriptor from the list */ - for (b = 0; b < count; b++) { - vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - dbg("descriptor type %i", type); - - /* check validity */ - if (type == 0) - goto found; - if (le32_to_cpu(vd->tag.location) != loc + b) - goto found; - - if (type == 1) /* TAG_ID_PVD */ - goto pvd; - } - goto found; - -pvd: - volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); - - clen = vd->type.primary.ident.clen; - dbg("label string charsize=%i bit", clen); - if (clen == 8) - volume_id_set_label_string(id, vd->type.primary.ident.c, 31); - else if (clen == 16) - volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "udf"; - - return 0; -} diff --git a/extras/volume_id/volume_id/udf.h b/extras/volume_id/volume_id/udf.h deleted file mode 100644 index ff95cc1058..0000000000 --- a/extras/volume_id/volume_id/udf.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_UDF_ -#define _VOLUME_ID_UDF_ - -extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/ufs.c b/extras/volume_id/volume_id/ufs.c deleted file mode 100644 index a7bd091c5e..0000000000 --- a/extras/volume_id/volume_id/ufs.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "ufs.h" - -struct ufs_super_block { - uint32_t fs_link; - uint32_t fs_rlink; - uint32_t fs_sblkno; - uint32_t fs_cblkno; - uint32_t fs_iblkno; - uint32_t fs_dblkno; - uint32_t fs_cgoffset; - uint32_t fs_cgmask; - uint32_t fs_time; - uint32_t fs_size; - uint32_t fs_dsize; - uint32_t fs_ncg; - uint32_t fs_bsize; - uint32_t fs_fsize; - uint32_t fs_frag; - uint32_t fs_minfree; - uint32_t fs_rotdelay; - uint32_t fs_rps; - uint32_t fs_bmask; - uint32_t fs_fmask; - uint32_t fs_bshift; - uint32_t fs_fshift; - uint32_t fs_maxcontig; - uint32_t fs_maxbpg; - uint32_t fs_fragshift; - uint32_t fs_fsbtodb; - uint32_t fs_sbsize; - uint32_t fs_csmask; - uint32_t fs_csshift; - uint32_t fs_nindir; - uint32_t fs_inopb; - uint32_t fs_nspf; - uint32_t fs_optim; - uint32_t fs_npsect_state; - uint32_t fs_interleave; - uint32_t fs_trackskew; - uint32_t fs_id[2]; - uint32_t fs_csaddr; - uint32_t fs_cssize; - uint32_t fs_cgsize; - uint32_t fs_ntrak; - uint32_t fs_nsect; - uint32_t fs_spc; - uint32_t fs_ncyl; - uint32_t fs_cpg; - uint32_t fs_ipg; - uint32_t fs_fpg; - struct ufs_csum { - uint32_t cs_ndir; - uint32_t cs_nbfree; - uint32_t cs_nifree; - uint32_t cs_nffree; - } __attribute__((__packed__)) fs_cstotal; - int8_t fs_fmod; - int8_t fs_clean; - int8_t fs_ronly; - int8_t fs_flags; - union { - struct { - int8_t fs_fsmnt[512]; - uint32_t fs_cgrotor; - uint32_t fs_csp[31]; - uint32_t fs_maxcluster; - uint32_t fs_cpc; - uint16_t fs_opostbl[16][8]; - } __attribute__((__packed__)) fs_u1; - struct { - int8_t fs_fsmnt[468]; - uint8_t fs_volname[32]; - uint64_t fs_swuid; - int32_t fs_pad; - uint32_t fs_cgrotor; - uint32_t fs_ocsp[28]; - uint32_t fs_contigdirs; - uint32_t fs_csp; - uint32_t fs_maxcluster; - uint32_t fs_active; - int32_t fs_old_cpc; - int32_t fs_maxbsize; - int64_t fs_sparecon64[17]; - int64_t fs_sblockloc; - struct ufs2_csum_total { - uint64_t cs_ndir; - uint64_t cs_nbfree; - uint64_t cs_nifree; - uint64_t cs_nffree; - uint64_t cs_numclusters; - uint64_t cs_spare[3]; - } __attribute__((__packed__)) fs_cstotal; - struct ufs_timeval { - int32_t tv_sec; - int32_t tv_usec; - } __attribute__((__packed__)) fs_time; - int64_t fs_size; - int64_t fs_dsize; - uint64_t fs_csaddr; - int64_t fs_pendingblocks; - int32_t fs_pendinginodes; - } __attribute__((__packed__)) fs_u2; - } fs_u11; - union { - struct { - int32_t fs_sparecon[53]; - int32_t fs_reclaim; - int32_t fs_sparecon2[1]; - int32_t fs_state; - uint32_t fs_qbmask[2]; - uint32_t fs_qfmask[2]; - } __attribute__((__packed__)) fs_sun; - struct { - int32_t fs_sparecon[53]; - int32_t fs_reclaim; - int32_t fs_sparecon2[1]; - uint32_t fs_npsect; - uint32_t fs_qbmask[2]; - uint32_t fs_qfmask[2]; - } __attribute__((__packed__)) fs_sunx86; - struct { - int32_t fs_sparecon[50]; - int32_t fs_contigsumsize; - int32_t fs_maxsymlinklen; - int32_t fs_inodefmt; - uint32_t fs_maxfilesize[2]; - uint32_t fs_qbmask[2]; - uint32_t fs_qfmask[2]; - int32_t fs_state; - } __attribute__((__packed__)) fs_44; - } fs_u2; - int32_t fs_postblformat; - int32_t fs_nrpos; - int32_t fs_postbloff; - int32_t fs_rotbloff; - uint32_t fs_magic; - uint8_t fs_space[1]; -} __attribute__((__packed__)); - -#define UFS_MAGIC 0x00011954 -#define UFS2_MAGIC 0x19540119 -#define UFS_MAGIC_FEA 0x00195612 -#define UFS_MAGIC_LFN 0x00095014 - -int volume_id_probe_ufs(struct volume_id *id, uint64_t off) -{ - uint32_t magic; - int i; - struct ufs_super_block *ufs; - int offsets[] = {0, 8, 64, 256, -1}; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - for (i = 0; offsets[i] >= 0; i++) { - ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); - if (ufs == NULL) - return -1; - - dbg("offset 0x%x", offsets[i] * 0x400); - magic = be32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(be)", magic); - goto found; - } - magic = le32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(le)", magic); - goto found; - } - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "ufs"; - - return 0; -} diff --git a/extras/volume_id/volume_id/ufs.h b/extras/volume_id/volume_id/ufs.h deleted file mode 100644 index ae46a924b4..0000000000 --- a/extras/volume_id/volume_id/ufs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_UFS_ -#define _VOLUME_ID_UFS_ - -extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/util.c b/extras/volume_id/volume_id/util.c deleted file mode 100644 index 361d7058d0..0000000000 --- a/extras/volume_id/volume_id/util.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" - -void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) -{ - unsigned int i, j; - uint16_t c; - - j = 0; - for (i = 0; i + 2 <= count; i += 2) { - if (endianess == LE) - c = (buf[i+1] << 8) | buf[i]; - else - c = (buf[i] << 8) | buf[i+1]; - if (c == 0) { - str[j] = '\0'; - break; - } else if (c < 0x80) { - if (j+1 >= len) - break; - str[j++] = (uint8_t) c; - } else if (c < 0x800) { - if (j+2 >= len) - break; - str[j++] = (uint8_t) (0xc0 | (c >> 6)); - str[j++] = (uint8_t) (0x80 | (c & 0x3f)); - } else { - if (j+3 >= len) - break; - str[j++] = (uint8_t) (0xe0 | (c >> 12)); - str[j++] = (uint8_t) (0x80 | ((c >> 6) & 0x3f)); - str[j++] = (uint8_t) (0x80 | (c & 0x3f)); - } - } - str[j] = '\0'; -} - -static char *usage_to_string(enum volume_id_usage usage_id) -{ - switch (usage_id) { - case VOLUME_ID_FILESYSTEM: - return "filesystem"; - case VOLUME_ID_PARTITIONTABLE: - return "partitiontable"; - case VOLUME_ID_OTHER: - return "other"; - case VOLUME_ID_RAID: - return "raid"; - case VOLUME_ID_DISKLABEL: - return "disklabel"; - case VOLUME_ID_CRYPTO: - return "crypto"; - case VOLUME_ID_UNPROBED: - return "unprobed"; - case VOLUME_ID_UNUSED: - return "unused"; - } - return NULL; -} - -void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id) -{ - part->usage_id = usage_id; - part->usage = usage_to_string(usage_id); -} - -void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) -{ - id->usage_id = usage_id; - id->usage = usage_to_string(usage_id); -} - -void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count) -{ - memcpy(id->label_raw, buf, count); - id->label_raw_len = count; -} - -void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) -{ - unsigned int i; - - memcpy(id->label, buf, count); - - /* remove trailing whitespace */ - i = strnlen(id->label, count); - while (i--) { - if (!isspace(id->label[i])) - break; - } - id->label[i+1] = '\0'; -} - -void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count) -{ - volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count); -} - -void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) -{ - unsigned int i; - unsigned int count = 0; - - switch(format) { - case UUID_DOS: - count = 4; - break; - case UUID_NTFS: - case UUID_HFS: - count = 8; - break; - case UUID_DCE: - count = 16; - break; - case UUID_DCE_STRING: - count = 36; - break; - } - memcpy(id->uuid_raw, buf, count); - id->uuid_raw_len = count; - - /* if set, create string in the same format, the native platform uses */ - for (i = 0; i < count; i++) - if (buf[i] != 0) - goto set; - return; - -set: - switch(format) { - case UUID_DOS: - sprintf(id->uuid, "%02X%02X-%02X%02X", - buf[3], buf[2], buf[1], buf[0]); - break; - case UUID_NTFS: - sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", - buf[7], buf[6], buf[5], buf[4], - buf[3], buf[2], buf[1], buf[0]); - break; - case UUID_HFS: - sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], buf[6], buf[7]); - break; - case UUID_DCE: - sprintf(id->uuid, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], - buf[6], buf[7], - buf[8], buf[9], - buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); - break; - case UUID_DCE_STRING: - memcpy(id->uuid, buf, count); - id->uuid[count] = '\0'; - break; - } -} - -uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) -{ - ssize_t buf_len; - - dbg("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); - /* check if requested area fits in superblock buffer */ - if (off + len <= SB_BUFFER_SIZE) { - if (id->sbbuf == NULL) { - id->sbbuf = malloc(SB_BUFFER_SIZE); - if (id->sbbuf == NULL) { - dbg("error malloc"); - return NULL; - } - } - - /* check if we need to read */ - if ((off + len) > id->sbbuf_len) { - dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len)); - if (lseek(id->fd, 0, SEEK_SET) < 0) { - dbg("lseek failed (%s)", strerror(errno)); - return NULL; - } - buf_len = read(id->fd, id->sbbuf, off + len); - if (buf_len < 0) { - dbg("read failed (%s)", strerror(errno)); - return NULL; - } - dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); - id->sbbuf_len = buf_len; - if ((size_t)buf_len < off + len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); - return NULL; - } - } - - return &(id->sbbuf[off]); - } else { - if (len > SEEK_BUFFER_SIZE) { - dbg("seek buffer too small %d", SEEK_BUFFER_SIZE); - return NULL; - } - - /* get seek buffer */ - if (id->seekbuf == NULL) { - id->seekbuf = malloc(SEEK_BUFFER_SIZE); - if (id->seekbuf == NULL) { - dbg("error malloc"); - return NULL; - } - } - - /* check if we need to read */ - if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - dbg("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); - if (lseek(id->fd, off, SEEK_SET) < 0) { - dbg("lseek failed (%s)", strerror(errno)); - return NULL; - } - buf_len = read(id->fd, id->seekbuf, len); - if (buf_len < 0) { - dbg("read failed (%s)", strerror(errno)); - return NULL; - } - dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); - id->seekbuf_off = off; - id->seekbuf_len = buf_len; - if ((size_t)buf_len < len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); - return NULL; - } - } - - return &(id->seekbuf[off - id->seekbuf_off]); - } -} - -void volume_id_free_buffer(struct volume_id *id) -{ - if (id->sbbuf != NULL) { - free(id->sbbuf); - id->sbbuf = NULL; - id->sbbuf_len = 0; - } - if (id->seekbuf != NULL) { - free(id->seekbuf); - id->seekbuf = NULL; - id->seekbuf_len = 0; - } -} diff --git a/extras/volume_id/volume_id/util.h b/extras/volume_id/volume_id/util.h deleted file mode 100644 index 6e16491c80..0000000000 --- a/extras/volume_id/volume_id/util.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_UTIL_ -#define _VOLUME_ID_UTIL_ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include - -/* size of superblock buffer, reiserfs block is at 64k */ -#define SB_BUFFER_SIZE 0x11000 -/* size of seek buffer, FAT cluster is 32k max */ -#define SEEK_BUFFER_SIZE 0x10000 - -/* probe volume for all known filesystems in specific order */ -#define bswap16(x) (uint16_t) ((((uint16_t)(x) & 0x00ffu) << 8) | \ - (((uint16_t)(x) & 0xff00u) >> 8)) - -#define bswap32(x) (uint32_t) ((((uint32_t)(x) & 0xff000000u) >> 24) | \ - (((uint32_t)(x) & 0x00ff0000u) >> 8) | \ - (((uint32_t)(x) & 0x0000ff00u) << 8) | \ - (((uint32_t)(x) & 0x000000ffu) << 24)) - -#define bswap64(x) (uint64_t) ((((uint64_t)(x) & 0xff00000000000000ull) >> 56) | \ - (((uint64_t)(x) & 0x00ff000000000000ull) >> 40) | \ - (((uint64_t)(x) & 0x0000ff0000000000ull) >> 24) | \ - (((uint64_t)(x) & 0x000000ff00000000ull) >> 8) | \ - (((uint64_t)(x) & 0x00000000ff000000ull) << 8) | \ - (((uint64_t)(x) & 0x0000000000ff0000ull) << 24) | \ - (((uint64_t)(x) & 0x000000000000ff00ull) << 40) | \ - (((uint64_t)(x) & 0x00000000000000ffull) << 56)) - -#ifdef __BYTE_ORDER -#if (__BYTE_ORDER == __LITTLE_ENDIAN) -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#define le64_to_cpu(x) (x) -#define be16_to_cpu(x) bswap16(x) -#define be32_to_cpu(x) bswap32(x) -#define cpu_to_le16(x) (x) -#define cpu_to_le32(x) (x) -#define cpu_to_be32(x) bswap32(x) -#elif (__BYTE_ORDER == __BIG_ENDIAN) -#define le16_to_cpu(x) bswap16(x) -#define le32_to_cpu(x) bswap32(x) -#define le64_to_cpu(x) bswap64(x) -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_le16(x) bswap16(x) -#define cpu_to_le32(x) bswap32(x) -#define cpu_to_be32(x) (x) -#endif -#endif /* __BYTE_ORDER */ - -enum uuid_format { - UUID_DCE_STRING, - UUID_DCE, - UUID_DOS, - UUID_NTFS, - UUID_HFS, -}; - -enum endian { - LE = 0, - BE = 1 -}; - -extern void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); -extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); -extern void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id); -extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); -extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); -extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); -extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format); -extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); -extern void volume_id_free_buffer(struct volume_id *id); - -#endif /* _VOLUME_ID_UTIL_ */ - diff --git a/extras/volume_id/volume_id/via_raid.c b/extras/volume_id/volume_id/via_raid.c deleted file mode 100644 index 2b74123016..0000000000 --- a/extras/volume_id/volume_id/via_raid.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "via_raid.h" - -struct via_meta { - uint16_t signature; - uint8_t version_number; - struct via_array { - uint16_t disk_bits; - uint8_t disk_array_ex; - uint32_t capacity_low; - uint32_t capacity_high; - uint32_t serial_checksum; - } __attribute((packed)) array; - uint32_t serial_checksum[8]; - uint8_t checksum; -} __attribute__((packed)); - -#define VIA_SIGNATURE 0xAA55 - -int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct via_meta *via; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - via = (struct via_meta *) buf; - if (le16_to_cpu(via->signature) != VIA_SIGNATURE) - return -1; - - if (via->version_number > 1) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", via->version_number); - id->type = "via_raid_member"; - - return 0; -} diff --git a/extras/volume_id/volume_id/via_raid.h b/extras/volume_id/volume_id/via_raid.h deleted file mode 100644 index 3eeaa2cee3..0000000000 --- a/extras/volume_id/volume_id/via_raid.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_VIA_RAID_ -#define _VOLUME_ID_VIA_RAID_ - -extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/volume_id/volume_id.c b/extras/volume_id/volume_id/volume_id.c deleted file mode 100644 index b92269863f..0000000000 --- a/extras/volume_id/volume_id/volume_id.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" - -#include "ext.h" -#include "reiserfs.h" -#include "fat.h" -#include "hfs.h" -#include "jfs.h" -#include "xfs.h" -#include "ufs.h" -#include "ntfs.h" -#include "iso9660.h" -#include "udf.h" -#include "highpoint.h" -#include "isw_raid.h" -#include "lsi_raid.h" -#include "via_raid.h" -#include "silicon_raid.h" -#include "nvidia_raid.h" -#include "promise_raid.h" -#include "luks.h" -#include "linux_swap.h" -#include "linux_raid.h" -#include "lvm.h" -#include "cramfs.h" -#include "hpfs.h" -#include "romfs.h" -#include "sysv.h" -#include "minix.h" -#include "mac.h" -#include "msdos.h" -#include "ocfs.h" -#include "vxfs.h" - -int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) -{ - if (id == NULL) - return -EINVAL; - - /* probe for raid first, cause fs probes may be successful on raid members */ - if (size) { - if (volume_id_probe_linux_raid(id, off, size) == 0) - goto exit; - - if (volume_id_probe_intel_software_raid(id, off, size) == 0) - goto exit; - - if (volume_id_probe_lsi_mega_raid(id, off, size) == 0) - goto exit; - - if (volume_id_probe_via_raid(id, off, size) == 0) - goto exit; - - if (volume_id_probe_silicon_medley_raid(id, off, size) == 0) - goto exit; - - if (volume_id_probe_nvidia_raid(id, off, size) == 0) - goto exit; - - if (volume_id_probe_promise_fasttrack_raid(id, off, size) == 0) - goto exit; - - if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0) - goto exit; - } - - if (volume_id_probe_lvm1(id, off) == 0) - goto exit; - - if (volume_id_probe_lvm2(id, off) == 0) - goto exit; - - if (volume_id_probe_highpoint_37x_raid(id, off) == 0) - goto exit; - - if (volume_id_probe_luks(id, off) == 0) - goto exit; - - /* signature in the first block, only small buffer needed */ - if (volume_id_probe_vfat(id, off) == 0) - goto exit; - - if (volume_id_probe_xfs(id, off) == 0) - goto exit; - - /* fill buffer with maximum */ - volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); - - if (volume_id_probe_linux_swap(id, off) == 0) - goto exit; - - if (volume_id_probe_ext(id, off) == 0) - goto exit; - - if (volume_id_probe_reiserfs(id, off) == 0) - goto exit; - - if (volume_id_probe_jfs(id, off) == 0) - goto exit; - - if (volume_id_probe_udf(id, off) == 0) - goto exit; - - if (volume_id_probe_iso9660(id, off) == 0) - goto exit; - - if (volume_id_probe_hfs_hfsplus(id, off) == 0) - goto exit; - - if (volume_id_probe_ufs(id, off) == 0) - goto exit; - - if (volume_id_probe_ntfs(id, off) == 0) - goto exit; - - if (volume_id_probe_cramfs(id, off) == 0) - goto exit; - - if (volume_id_probe_romfs(id, off) == 0) - goto exit; - - if (volume_id_probe_hpfs(id, off) == 0) - goto exit; - - if (volume_id_probe_sysv(id, off) == 0) - goto exit; - - if (volume_id_probe_minix(id, off) == 0) - goto exit; - - if (volume_id_probe_ocfs1(id, off) == 0) - goto exit; - - if (volume_id_probe_ocfs2(id, off) == 0) - goto exit; - - if (volume_id_probe_vxfs(id, off) == 0) - goto exit; - - return -1; - -exit: - /* If the filestystem in recognized, we free the allocated buffers, - otherwise they will stay in place for the possible next probe call */ - volume_id_free_buffer(id); - - return 0; -} - -/* open volume by already open file descriptor */ -struct volume_id *volume_id_open_fd(int fd) -{ - struct volume_id *id; - - id = malloc(sizeof(struct volume_id)); - if (id == NULL) - return NULL; - memset(id, 0x00, sizeof(struct volume_id)); - - id->fd = fd; - - return id; -} - -/* open volume by device node */ -struct volume_id *volume_id_open_node(const char *path) -{ - struct volume_id *id; - int fd; - - fd = open(path, O_RDONLY); - if (fd < 0) { - dbg("unable to open '%s'", path); - return NULL; - } - - id = volume_id_open_fd(fd); - if (id == NULL) - return NULL; - - /* close fd on device close */ - id->fd_close = 1; - - return id; -} - -/* open volume by major/minor */ -struct volume_id *volume_id_open_dev_t(dev_t devt) -{ - struct volume_id *id; - char tmp_node[VOLUME_ID_PATH_MAX]; - - snprintf(tmp_node, VOLUME_ID_PATH_MAX, - "/dev/.volume_id-%u-%u-%u", getpid(), major(devt), minor(devt)); - tmp_node[VOLUME_ID_PATH_MAX-1] = '\0'; - - /* create tempory node to open the block device */ - unlink(tmp_node); - if (mknod(tmp_node, (S_IFBLK | 0600), devt) != 0) - return NULL; - - id = volume_id_open_node(tmp_node); - - unlink(tmp_node); - - return id; -} - -void volume_id_close(struct volume_id *id) -{ - if (id == NULL) - return; - - if (id->fd_close != 0) - close(id->fd); - - volume_id_free_buffer(id); - - if (id->partitions != NULL) - free(id->partitions); - - free(id); -} diff --git a/extras/volume_id/volume_id/volume_id.h b/extras/volume_id/volume_id/volume_id.h deleted file mode 100644 index 9994615c69..0000000000 --- a/extras/volume_id/volume_id/volume_id.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * volume_id - reads partition label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_H_ -#define _VOLUME_ID_H_ - -#include - -#define VOLUME_ID_VERSION 52 - -#define VOLUME_ID_LABEL_SIZE 64 -#define VOLUME_ID_UUID_SIZE 36 -#define VOLUME_ID_FORMAT_SIZE 32 -#define VOLUME_ID_PATH_MAX 256 -#define VOLUME_ID_PARTITIONS_MAX 256 - -enum volume_id_usage { - VOLUME_ID_UNUSED, - VOLUME_ID_UNPROBED, - VOLUME_ID_OTHER, - VOLUME_ID_FILESYSTEM, - VOLUME_ID_PARTITIONTABLE, - VOLUME_ID_RAID, - VOLUME_ID_DISKLABEL, - VOLUME_ID_CRYPTO, -}; - -struct volume_id_partition { - enum volume_id_usage usage_id; - char *usage; - char *type; - uint64_t off; - uint64_t len; - uint8_t partition_type_raw; -}; - -struct volume_id { - uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; - size_t label_raw_len; - char label[VOLUME_ID_LABEL_SIZE+1]; - uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; - size_t uuid_raw_len; - char uuid[VOLUME_ID_UUID_SIZE+1]; - enum volume_id_usage usage_id; - char *usage; - char *type; - char type_version[VOLUME_ID_FORMAT_SIZE]; - - struct volume_id_partition *partitions; - size_t partition_count; - - int fd; - uint8_t *sbbuf; - size_t sbbuf_len; - uint8_t *seekbuf; - uint64_t seekbuf_off; - size_t seekbuf_len; - int fd_close:1; -}; - -extern struct volume_id *volume_id_open_fd(int fd); -extern struct volume_id *volume_id_open_node(const char *path); -extern struct volume_id *volume_id_open_dev_t(dev_t devt); -extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); -extern void volume_id_close(struct volume_id *id); - -#endif diff --git a/extras/volume_id/volume_id/vxfs.c b/extras/volume_id/volume_id/vxfs.c deleted file mode 100644 index c4a9ace98f..0000000000 --- a/extras/volume_id/volume_id/vxfs.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "vxfs.h" - -#define VXFS_SUPER_MAGIC 0xa501FCF5 - -struct vxfs_super { - uint32_t vs_magic; - int32_t vs_version; -} __attribute__((__packed__)); - -int volume_id_probe_vxfs(struct volume_id *id, uint64_t off) -{ - struct vxfs_super *vxs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); - if (vxs == NULL) - return -1; - - if (vxs->vs_magic == cpu_to_le32(VXFS_SUPER_MAGIC)) { - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", (unsigned int) vxs->vs_version); - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "vxfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/volume_id/vxfs.h b/extras/volume_id/volume_id/vxfs.h deleted file mode 100644 index 8ca45c3fdc..0000000000 --- a/extras/volume_id/volume_id/vxfs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_VXFS_ -#define _VOLUME_ID_VXFS_ - -extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); - -#endif diff --git a/extras/volume_id/volume_id/xfs.c b/extras/volume_id/volume_id/xfs.c deleted file mode 100644 index 7fd629099d..0000000000 --- a/extras/volume_id/volume_id/xfs.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" -#include "xfs.h" - -struct xfs_super_block { - uint8_t magic[4]; - uint32_t blocksize; - uint64_t dblocks; - uint64_t rblocks; - uint32_t dummy1[2]; - uint8_t uuid[16]; - uint32_t dummy2[15]; - uint8_t fname[12]; - uint32_t dummy3[2]; - uint64_t icount; - uint64_t ifree; - uint64_t fdblocks; -} __attribute__((__packed__)); - -int volume_id_probe_xfs(struct volume_id *id, uint64_t off) -{ - struct xfs_super_block *xs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); - if (xs == NULL) - return -1; - - if (memcmp(xs->magic, "XFSB", 4) != 0) - return -1; - - volume_id_set_label_raw(id, xs->fname, 12); - volume_id_set_label_string(id, xs->fname, 12); - volume_id_set_uuid(id, xs->uuid, UUID_DCE); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "xfs"; - - return 0; -} diff --git a/extras/volume_id/volume_id/xfs.h b/extras/volume_id/volume_id/xfs.h deleted file mode 100644 index f21cc5f929..0000000000 --- a/extras/volume_id/volume_id/xfs.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID__ -#define _VOLUME_ID__ - -extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); - -#endif -- cgit v1.2.3-54-g00ecf From a8349b33e564f7faa83341cb1fa58466b0589ae9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Nov 2005 15:42:07 +0100 Subject: remove our own copy of klibc Signed-off-by: Kay Sievers --- ChangeLog | 3 + Makefile | 25 +- README | 17 +- RELEASE-NOTES | 5 + klibc/MCONFIG | 98 -- klibc/MRULES | 45 - klibc/Makefile | 77 -- klibc/README | 21 - klibc/include/alloca.h | 13 - klibc/include/arch/alpha/klibc/archsetjmp.h | 33 - klibc/include/arch/alpha/klibc/archsignal.h | 13 - klibc/include/arch/alpha/klibc/archstat.h | 26 - klibc/include/arch/alpha/klibc/archsys.h | 53 - klibc/include/arch/alpha/machine/asm.h | 44 - klibc/include/arch/arm/klibc/archsetjmp.h | 14 - klibc/include/arch/arm/klibc/archsignal.h | 13 - klibc/include/arch/arm/klibc/archstat.h | 45 - klibc/include/arch/arm/klibc/archsys.h | 12 - klibc/include/arch/cris/klibc/archsetjmp.h | 24 - klibc/include/arch/cris/klibc/archsignal.h | 13 - klibc/include/arch/cris/klibc/archstat.h | 37 - klibc/include/arch/cris/klibc/archsys.h | 12 - klibc/include/arch/i386/klibc/archsetjmp.h | 19 - klibc/include/arch/i386/klibc/archsignal.h | 13 - klibc/include/arch/i386/klibc/archstat.h | 37 - klibc/include/arch/i386/klibc/archsys.h | 12 - klibc/include/arch/i386/klibc/diverr.h | 16 - klibc/include/arch/i386/sys/io.h | 126 --- klibc/include/arch/i386/sys/vm86.h | 41 - klibc/include/arch/ia64/klibc/archsetjmp.h | 17 - klibc/include/arch/ia64/klibc/archsignal.h | 31 - klibc/include/arch/ia64/klibc/archstat.h | 24 - klibc/include/arch/ia64/klibc/archsys.h | 218 ---- klibc/include/arch/m32r/klibc/archsetjmp.h | 21 - klibc/include/arch/m32r/klibc/archsignal.h | 13 - klibc/include/arch/m32r/klibc/archstat.h | 37 - klibc/include/arch/m32r/klibc/archsys.h | 12 - klibc/include/arch/m68k/klibc/archsignal.h | 13 - klibc/include/arch/m68k/klibc/archstat.h | 37 - klibc/include/arch/m68k/klibc/archsys.h | 12 - klibc/include/arch/mips/klibc/archfcntl.h | 87 -- klibc/include/arch/mips/klibc/archsetjmp.h | 39 - klibc/include/arch/mips/klibc/archsignal.h | 13 - klibc/include/arch/mips/klibc/archstat.h | 39 - klibc/include/arch/mips/klibc/archsys.h | 12 - klibc/include/arch/mips/machine/asm.h | 11 - klibc/include/arch/mips/sgidefs.h | 20 - klibc/include/arch/mips/spaces.h | 1 - klibc/include/arch/mips64/klibc/archsignal.h | 13 - klibc/include/arch/mips64/klibc/archstat.h | 33 - klibc/include/arch/mips64/klibc/archsys.h | 12 - klibc/include/arch/parisc/klibc/archsetjmp.h | 14 - klibc/include/arch/parisc/klibc/archsignal.h | 24 - klibc/include/arch/parisc/klibc/archstat.h | 27 - klibc/include/arch/parisc/klibc/archsys.h | 12 - klibc/include/arch/ppc/klibc/archsetjmp.h | 36 - klibc/include/arch/ppc/klibc/archsignal.h | 13 - klibc/include/arch/ppc/klibc/archstat.h | 28 - klibc/include/arch/ppc/klibc/archsys.h | 61 - klibc/include/arch/ppc64/klibc/archsetjmp.h | 36 - klibc/include/arch/ppc64/klibc/archsignal.h | 13 - klibc/include/arch/ppc64/klibc/archstat.h | 25 - klibc/include/arch/ppc64/klibc/archsys.h | 52 - klibc/include/arch/s390/klibc/archsetjmp.h | 15 - klibc/include/arch/s390/klibc/archsignal.h | 13 - klibc/include/arch/s390/klibc/archstat.h | 31 - klibc/include/arch/s390/klibc/archsys.h | 41 - klibc/include/arch/s390x/klibc/archsetjmp.h | 15 - klibc/include/arch/s390x/klibc/archsignal.h | 13 - klibc/include/arch/s390x/klibc/archstat.h | 24 - klibc/include/arch/s390x/klibc/archsys.h | 41 - klibc/include/arch/sh/klibc/archsetjmp.h | 22 - klibc/include/arch/sh/klibc/archsignal.h | 13 - klibc/include/arch/sh/klibc/archstat.h | 45 - klibc/include/arch/sh/klibc/archsys.h | 12 - klibc/include/arch/sparc/klibc/archsetjmp.h | 16 - klibc/include/arch/sparc/klibc/archsignal.h | 38 - klibc/include/arch/sparc/klibc/archstat.h | 35 - klibc/include/arch/sparc/klibc/archsys.h | 10 - klibc/include/arch/sparc/machine/asm.h | 192 ---- klibc/include/arch/sparc/machine/frame.h | 138 --- klibc/include/arch/sparc/machine/trap.h | 141 --- klibc/include/arch/sparc64/klibc/archsetjmp.h | 16 - klibc/include/arch/sparc64/klibc/archsignal.h | 13 - klibc/include/arch/sparc64/klibc/archstat.h | 22 - klibc/include/arch/sparc64/klibc/archsys.h | 10 - klibc/include/arch/x86_64/klibc/archsetjmp.h | 21 - klibc/include/arch/x86_64/klibc/archsignal.h | 17 - klibc/include/arch/x86_64/klibc/archstat.h | 26 - klibc/include/arch/x86_64/klibc/archsys.h | 109 -- klibc/include/arch/x86_64/sys/io.h | 126 --- klibc/include/arpa/inet.h | 24 - klibc/include/assert.h | 22 - klibc/include/bits32/bitsize.h | 3 - klibc/include/bits32/bitsize/limits.h | 14 - klibc/include/bits32/bitsize/stddef.h | 18 - klibc/include/bits32/bitsize/stdint.h | 34 - klibc/include/bits32/bitsize/stdintconst.h | 18 - klibc/include/bits32/bitsize/stdintlimits.h | 22 - klibc/include/bits64/bitsize.h | 3 - klibc/include/bits64/bitsize/limits.h | 14 - klibc/include/bits64/bitsize/stddef.h | 13 - klibc/include/bits64/bitsize/stdint.h | 36 - klibc/include/bits64/bitsize/stdintconst.h | 18 - klibc/include/bits64/bitsize/stdintlimits.h | 22 - klibc/include/ctype.h | 119 -- klibc/include/dirent.h | 32 - klibc/include/elf.h | 12 - klibc/include/endian.h | 42 - klibc/include/errno.h | 8 - klibc/include/fcntl.h | 46 - klibc/include/grp.h | 13 - klibc/include/inttypes.h | 226 ---- klibc/include/klibc/compiler.h | 123 -- klibc/include/klibc/diverr.h | 16 - klibc/include/klibc/extern.h | 16 - klibc/include/klibc/sysconfig.h | 34 - klibc/include/limits.h | 40 - klibc/include/malloc.h | 21 - klibc/include/net/if.h | 1 - klibc/include/net/if_arp.h | 1 - klibc/include/net/if_packet.h | 1 - klibc/include/net/route.h | 1 - klibc/include/netinet/if_ether.h | 1 - klibc/include/netinet/in.h | 39 - klibc/include/netinet/in6.h | 10 - klibc/include/netinet/ip.h | 13 - klibc/include/netinet/tcp.h | 11 - klibc/include/netinet/udp.h | 19 - klibc/include/netpacket/packet.h | 1 - klibc/include/paths.h | 74 -- klibc/include/poll.h | 16 - klibc/include/sched.h | 36 - klibc/include/setjmp.h | 43 - klibc/include/signal.h | 88 -- klibc/include/stdarg.h | 14 - klibc/include/stddef.h | 24 - klibc/include/stdint.h | 116 -- klibc/include/stdio.h | 125 -- klibc/include/stdlib.h | 89 -- klibc/include/string.h | 46 - klibc/include/sys/dirent.h | 21 - klibc/include/sys/elf32.h | 115 -- klibc/include/sys/elf64.h | 115 -- klibc/include/sys/elfcommon.h | 188 ---- klibc/include/sys/fsuid.h | 14 - klibc/include/sys/inotify.h | 16 - klibc/include/sys/ioctl.h | 14 - klibc/include/sys/klog.h | 24 - klibc/include/sys/mman.h | 25 - klibc/include/sys/mount.h | 72 -- klibc/include/sys/param.h | 11 - klibc/include/sys/reboot.h | 25 - klibc/include/sys/resource.h | 15 - klibc/include/sys/select.h | 14 - klibc/include/sys/socket.h | 50 - klibc/include/sys/socketcalls.h | 28 - klibc/include/sys/stat.h | 31 - klibc/include/sys/statfs.h | 1 - klibc/include/sys/syscall.h | 17 - klibc/include/sys/sysinfo.h | 12 - klibc/include/sys/sysmacros.h | 31 - klibc/include/sys/time.h | 18 - klibc/include/sys/times.h | 14 - klibc/include/sys/types.h | 104 -- klibc/include/sys/uio.h | 15 - klibc/include/sys/un.h | 10 - klibc/include/sys/utime.h | 10 - klibc/include/sys/utsname.h | 23 - klibc/include/sys/vfs.h | 112 -- klibc/include/sys/wait.h | 28 - klibc/include/syslog.h | 64 -- klibc/include/termios.h | 86 -- klibc/include/time.h | 18 - klibc/include/unistd.h | 140 --- klibc/include/utime.h | 15 - klibc/klcc.1 | 116 -- klibc/klcc.in | 258 ----- klibc/klibc.spec.in | 126 --- klibc/klibc/CAVEATS | 61 - klibc/klibc/Kbuild | 149 --- klibc/klibc/LICENSE | 73 -- klibc/klibc/MCONFIG | 20 - klibc/klibc/Makefile | 192 ---- klibc/klibc/README | 81 -- klibc/klibc/SOCKETCALLS.def | 21 - klibc/klibc/SYSCALLS.def | 231 ---- klibc/klibc/__put_env.c | 60 - klibc/klibc/__shared_init.c | 2 - klibc/klibc/__signal.c | 22 - klibc/klibc/__static_init.c | 2 - klibc/klibc/abort.c | 19 - klibc/klibc/alarm.c | 25 - klibc/klibc/arch/README | 67 -- klibc/klibc/arch/alpha/MCONFIG | 17 - klibc/klibc/arch/alpha/Makefile.inc | 95 -- klibc/klibc/arch/alpha/README-gcc | 23 - klibc/klibc/arch/alpha/crt0.S | 22 - klibc/klibc/arch/alpha/divide.c | 57 - klibc/klibc/arch/alpha/pipe.c | 28 - klibc/klibc/arch/alpha/setjmp.S | 77 -- klibc/klibc/arch/alpha/syscall.S | 26 - klibc/klibc/arch/alpha/sysdual.S | 33 - klibc/klibc/arch/alpha/sysstub.ph | 37 - klibc/klibc/arch/arm/MCONFIG | 26 - klibc/klibc/arch/arm/Makefile.inc | 43 - klibc/klibc/arch/arm/crt0.S | 23 - klibc/klibc/arch/arm/setjmp-arm.S | 39 - klibc/klibc/arch/arm/setjmp-thumb.S | 58 - klibc/klibc/arch/arm/syscall.S | 50 - klibc/klibc/arch/arm/sysstub.ph | 44 - klibc/klibc/arch/cris/MCONFIG | 26 - klibc/klibc/arch/cris/Makefile.inc | 33 - klibc/klibc/arch/cris/__negdi2.S | 25 - klibc/klibc/arch/cris/crt0.S | 28 - klibc/klibc/arch/cris/divide.c | 92 -- klibc/klibc/arch/cris/setjmp.S | 37 - klibc/klibc/arch/cris/syscall.S | 30 - klibc/klibc/arch/cris/sysstub.ph | 29 - klibc/klibc/arch/i386/MCONFIG | 33 - klibc/klibc/arch/i386/Makefile.inc | 28 - klibc/klibc/arch/i386/crt0.S | 32 - klibc/klibc/arch/i386/exits.S | 45 - klibc/klibc/arch/i386/libgcc/__ashldi3.S | 29 - klibc/klibc/arch/i386/libgcc/__ashrdi3.S | 29 - klibc/klibc/arch/i386/libgcc/__lshrdi3.S | 29 - klibc/klibc/arch/i386/libgcc/__muldi3.S | 34 - klibc/klibc/arch/i386/libgcc/__negdi2.S | 21 - klibc/klibc/arch/i386/open.S | 29 - klibc/klibc/arch/i386/setjmp.S | 58 - klibc/klibc/arch/i386/sigreturn.S | 15 - klibc/klibc/arch/i386/socketcall.S | 42 - klibc/klibc/arch/i386/syscall.S | 60 - klibc/klibc/arch/i386/sysstub.ph | 32 - klibc/klibc/arch/ia64/MCONFIG | 11 - klibc/klibc/arch/ia64/Makefile.inc | 26 - klibc/klibc/arch/ia64/crt0.S | 27 - klibc/klibc/arch/ia64/pipe.c | 42 - klibc/klibc/arch/ia64/setjmp.S | 343 ------ klibc/klibc/arch/ia64/syscall.S | 20 - klibc/klibc/arch/ia64/sysstub.ph | 29 - klibc/klibc/arch/ia64/vfork.S | 42 - klibc/klibc/arch/m32r/MCONFIG | 18 - klibc/klibc/arch/m32r/Makefile.inc | 19 - klibc/klibc/arch/m32r/crt0.S | 25 - klibc/klibc/arch/m32r/setjmp.S | 47 - klibc/klibc/arch/m32r/syscall.S | 29 - klibc/klibc/arch/m32r/sysstub.ph | 25 - klibc/klibc/arch/m68k/MCONFIG | 11 - klibc/klibc/arch/m68k/Makefile.inc | 10 - klibc/klibc/arch/mips/MCONFIG | 15 - klibc/klibc/arch/mips/Makefile.inc | 25 - klibc/klibc/arch/mips/crt0.S | 25 - klibc/klibc/arch/mips/klibc.ld | 217 ---- klibc/klibc/arch/mips/pipe.S | 16 - klibc/klibc/arch/mips/setjmp.S | 82 -- klibc/klibc/arch/mips/syscall.S | 15 - klibc/klibc/arch/mips/sysstub.ph | 30 - klibc/klibc/arch/mips/vfork.S | 16 - klibc/klibc/arch/mips64/MCONFIG | 11 - klibc/klibc/arch/mips64/Makefile.inc | 10 - klibc/klibc/arch/parisc/MCONFIG | 11 - klibc/klibc/arch/parisc/Makefile.inc | 19 - klibc/klibc/arch/parisc/crt0.S | 34 - klibc/klibc/arch/parisc/setjmp.S | 88 -- klibc/klibc/arch/parisc/syscall.c | 29 - klibc/klibc/arch/parisc/sysstub.ph | 28 - klibc/klibc/arch/ppc/MCONFIG | 18 - klibc/klibc/arch/ppc/Makefile.inc | 22 - klibc/klibc/arch/ppc/crt0.S | 20 - klibc/klibc/arch/ppc/setjmp.S | 35 - klibc/klibc/arch/ppc/syscall.S | 16 - klibc/klibc/arch/ppc/sysstub.ph | 25 - klibc/klibc/arch/ppc64/MCONFIG | 20 - klibc/klibc/arch/ppc64/Makefile.inc | 25 - klibc/klibc/arch/ppc64/crt0.S | 32 - klibc/klibc/arch/ppc64/setjmp.S | 85 -- klibc/klibc/arch/ppc64/syscall.c | 14 - klibc/klibc/arch/ppc64/sysstub.ph | 31 - klibc/klibc/arch/s390/MCONFIG | 13 - klibc/klibc/arch/s390/Makefile.inc | 23 - klibc/klibc/arch/s390/crt0.S | 25 - klibc/klibc/arch/s390/mmap.c | 41 - klibc/klibc/arch/s390/setjmp.S | 32 - klibc/klibc/arch/s390/syscall.c | 16 - klibc/klibc/arch/s390/sysstub.ph | 31 - klibc/klibc/arch/s390x/MCONFIG | 13 - klibc/klibc/arch/s390x/Makefile.inc | 18 - klibc/klibc/arch/s390x/crt0.S | 21 - klibc/klibc/arch/s390x/mmap.c | 41 - klibc/klibc/arch/s390x/setjmp.S | 36 - klibc/klibc/arch/s390x/syscall.c | 16 - klibc/klibc/arch/s390x/sysstub.ph | 28 - klibc/klibc/arch/sh/MCONFIG | 19 - klibc/klibc/arch/sh/Makefile.inc | 15 - klibc/klibc/arch/sh/crt0.S | 27 - klibc/klibc/arch/sh/setjmp.S | 65 -- klibc/klibc/arch/sh/syscall.S | 35 - klibc/klibc/arch/sh/sysstub.ph | 34 - klibc/klibc/arch/sparc/MCONFIG | 18 - klibc/klibc/arch/sparc/Makefile.inc | 51 - klibc/klibc/arch/sparc/crt0.S | 2 - klibc/klibc/arch/sparc/crt0i.S | 100 -- klibc/klibc/arch/sparc/divrem.m4 | 276 ----- klibc/klibc/arch/sparc/setjmp.S | 38 - klibc/klibc/arch/sparc/smul.S | 160 --- klibc/klibc/arch/sparc/syscall.S | 19 - klibc/klibc/arch/sparc/sysfork.S | 25 - klibc/klibc/arch/sparc/sysstub.ph | 25 - klibc/klibc/arch/sparc/umul.S | 193 ---- klibc/klibc/arch/sparc64/MCONFIG | 21 - klibc/klibc/arch/sparc64/Makefile.inc | 15 - klibc/klibc/arch/sparc64/crt0.S | 2 - klibc/klibc/arch/sparc64/setjmp.S | 55 - klibc/klibc/arch/sparc64/syscall.S | 18 - klibc/klibc/arch/sparc64/sysfork.S | 26 - klibc/klibc/arch/sparc64/sysstub.ph | 25 - klibc/klibc/arch/x86_64/MCONFIG | 36 - klibc/klibc/arch/x86_64/Makefile.inc | 18 - klibc/klibc/arch/x86_64/crt0.S | 22 - klibc/klibc/arch/x86_64/exits.S | 35 - klibc/klibc/arch/x86_64/setjmp.S | 54 - klibc/klibc/arch/x86_64/sigreturn.S | 15 - klibc/klibc/arch/x86_64/syscall.S | 28 - klibc/klibc/arch/x86_64/sysstub.ph | 23 - klibc/klibc/asprintf.c | 30 - klibc/klibc/assert.c | 13 - klibc/klibc/atexit.c | 10 - klibc/klibc/atexit.h | 17 - klibc/klibc/atoi.c | 3 - klibc/klibc/atol.c | 3 - klibc/klibc/atoll.c | 3 - klibc/klibc/atox.c | 14 - klibc/klibc/brk.c | 24 - klibc/klibc/bsd_signal.c | 11 - klibc/klibc/calloc.c | 21 - klibc/klibc/closelog.c | 18 - klibc/klibc/creat.c | 12 - klibc/klibc/ctypes.c | 284 ----- klibc/klibc/daemon.c | 38 - klibc/klibc/exec_l.c | 57 - klibc/klibc/execl.c | 8 - klibc/klibc/execle.c | 8 - klibc/klibc/execlp.c | 8 - klibc/klibc/execlpe.c | 8 - klibc/klibc/execv.c | 13 - klibc/klibc/execvp.c | 13 - klibc/klibc/execvpe.c | 75 -- klibc/klibc/exitc.c | 23 - klibc/klibc/fgetc.c | 20 - klibc/klibc/fgets.c | 34 - klibc/klibc/fopen.c | 40 - klibc/klibc/fork.c | 20 - klibc/klibc/fprintf.c | 19 - klibc/klibc/fputc.c | 14 - klibc/klibc/fputs.c | 15 - klibc/klibc/fread.c | 36 - klibc/klibc/fread2.c | 13 - klibc/klibc/fstatfs.c | 19 - klibc/klibc/fwrite.c | 36 - klibc/klibc/fwrite2.c | 13 - klibc/klibc/getcwd.c | 16 - klibc/klibc/getdomainname.c | 25 - klibc/klibc/getenv.c | 22 - klibc/klibc/gethostname.c | 25 - klibc/klibc/getopt.c | 75 -- klibc/klibc/getpgrp.c | 9 - klibc/klibc/getpriority.c | 23 - klibc/klibc/getpt.c | 17 - klibc/klibc/globals.c | 10 - klibc/klibc/inet/bindresvport.c | 45 - klibc/klibc/inet/inet_addr.c | 14 - klibc/klibc/inet/inet_aton.c | 23 - klibc/klibc/inet/inet_ntoa.c | 19 - klibc/klibc/inet/inet_ntop.c | 52 - klibc/klibc/inet/inet_pton.c | 74 -- klibc/klibc/interp.S | 13 - klibc/klibc/isatty.c | 21 - klibc/klibc/jrand48.c | 24 - klibc/klibc/libc_init.c | 86 -- klibc/klibc/libgcc/__divdi3.c | 29 - klibc/klibc/libgcc/__divsi3.c | 29 - klibc/klibc/libgcc/__moddi3.c | 29 - klibc/klibc/libgcc/__modsi3.c | 29 - klibc/klibc/libgcc/__udivdi3.c | 13 - klibc/klibc/libgcc/__udivmoddi4.c | 32 - klibc/klibc/libgcc/__udivmodsi4.c | 32 - klibc/klibc/libgcc/__udivsi3.c | 13 - klibc/klibc/libgcc/__umoddi3.c | 16 - klibc/klibc/libgcc/__umodsi3.c | 16 - klibc/klibc/llseek.c | 30 - klibc/klibc/lrand48.c | 14 - klibc/klibc/makeerrlist.pl | 100 -- klibc/klibc/malloc.c | 197 ---- klibc/klibc/malloc.h | 45 - klibc/klibc/memccpy.c | 23 - klibc/klibc/memchr.c | 19 - klibc/klibc/memcmp.c | 19 - klibc/klibc/memcpy.c | 29 - klibc/klibc/memmem.c | 52 - klibc/klibc/memmove.c | 34 - klibc/klibc/memrchr.c | 20 - klibc/klibc/memset.c | 30 - klibc/klibc/memswap.c | 23 - klibc/klibc/mmap.c | 49 - klibc/klibc/mrand48.c | 13 - klibc/klibc/nice.c | 18 - klibc/klibc/nrand48.c | 11 - klibc/klibc/onexit.c | 39 - klibc/klibc/open.c | 22 - klibc/klibc/pause.c | 17 - klibc/klibc/perror.c | 13 - klibc/klibc/printf.c | 19 - klibc/klibc/pty.c | 31 - klibc/klibc/putchar.c | 15 - klibc/klibc/putenv.c | 40 - klibc/klibc/puts.c | 13 - klibc/klibc/qsort.c | 42 - klibc/klibc/raise.c | 11 - klibc/klibc/readdir.c | 57 - klibc/klibc/realloc.c | 49 - klibc/klibc/reboot.c | 15 - klibc/klibc/recv.c | 11 - klibc/klibc/sbrk.c | 41 - klibc/klibc/seed48.c | 19 - klibc/klibc/send.c | 11 - klibc/klibc/setegid.c | 10 - klibc/klibc/setenv.c | 45 - klibc/klibc/seteuid.c | 10 - klibc/klibc/setpgrp.c | 10 - klibc/klibc/sha1hash.c | 317 ------ klibc/klibc/sigaction.c | 44 - klibc/klibc/siglist.c | 115 -- klibc/klibc/siglongjmp.c | 16 - klibc/klibc/sigpending.c | 17 - klibc/klibc/sigprocmask.c | 17 - klibc/klibc/sigsuspend.c | 17 - klibc/klibc/sleep.c | 20 - klibc/klibc/snprintf.c | 16 - klibc/klibc/socketcalls.pl | 88 -- klibc/klibc/socketcommon.h | 16 - klibc/klibc/sprintf.c | 18 - klibc/klibc/srand48.c | 15 - klibc/klibc/sscanf.c | 17 - klibc/klibc/statfs.c | 19 - klibc/klibc/strcasecmp.c | 23 - klibc/klibc/strcat.c | 11 - klibc/klibc/strchr.c | 19 - klibc/klibc/strcmp.c | 20 - klibc/klibc/strcpy.c | 20 - klibc/klibc/strcspn.c | 11 - klibc/klibc/strdup.c | 17 - klibc/klibc/strerror.c | 34 - klibc/klibc/strlcat.c | 33 - klibc/klibc/strlcpy.c | 29 - klibc/klibc/strlen.c | 14 - klibc/klibc/strncasecmp.c | 23 - klibc/klibc/strncat.c | 22 - klibc/klibc/strncmp.c | 20 - klibc/klibc/strncpy.c | 24 - klibc/klibc/strndup.c | 17 - klibc/klibc/strnlen.c | 19 - klibc/klibc/strntoimax.c | 13 - klibc/klibc/strntoumax.c | 76 -- klibc/klibc/strpbrk.c | 14 - klibc/klibc/strrchr.c | 21 - klibc/klibc/strsep.c | 21 - klibc/klibc/strspn.c | 11 - klibc/klibc/strstr.c | 10 - klibc/klibc/strtoimax.c | 3 - klibc/klibc/strtok.c | 16 - klibc/klibc/strtol.c | 3 - klibc/klibc/strtoll.c | 3 - klibc/klibc/strtotimespec.c | 5 - klibc/klibc/strtotimeval.c | 5 - klibc/klibc/strtotimex.c | 39 - klibc/klibc/strtoul.c | 3 - klibc/klibc/strtoull.c | 3 - klibc/klibc/strtoumax.c | 3 - klibc/klibc/strtox.c | 13 - klibc/klibc/strxspn.c | 30 - klibc/klibc/strxspn.h | 13 - klibc/klibc/syscalls.pl | 120 -- klibc/klibc/syscommon.h | 32 - klibc/klibc/syslog.c | 87 -- klibc/klibc/system.c | 61 - klibc/klibc/sysv_signal.c | 11 - klibc/klibc/time.c | 23 - klibc/klibc/umount.c | 12 - klibc/klibc/unsetenv.c | 40 - klibc/klibc/usleep.c | 15 - klibc/klibc/utime.c | 24 - klibc/klibc/vasprintf.c | 25 - klibc/klibc/vfprintf.c | 26 - klibc/klibc/vprintf.c | 11 - klibc/klibc/vsnprintf.c | 433 ------- klibc/klibc/vsprintf.c | 11 - klibc/klibc/vsscanf.c | 365 ------ klibc/klibc/wait.c | 12 - klibc/klibc/wait3.c | 12 - klibc/klibc/waitpid.c | 12 - klibc/klibc/zlib/FAQ | 315 ------ klibc/klibc/zlib/INDEX | 48 - klibc/klibc/zlib/README | 126 --- klibc/klibc/zlib/adler32.c | 74 -- klibc/klibc/zlib/algorithm.txt | 209 ---- klibc/klibc/zlib/compress.c | 79 -- klibc/klibc/zlib/crc32.c | 311 ----- klibc/klibc/zlib/crc32.h | 441 -------- klibc/klibc/zlib/deflate.c | 1502 ------------------------- klibc/klibc/zlib/deflate.h | 326 ------ klibc/klibc/zlib/gzio.c | 1008 ----------------- klibc/klibc/zlib/infback.c | 619 ---------- klibc/klibc/zlib/inffast.c | 305 ----- klibc/klibc/zlib/inffast.h | 11 - klibc/klibc/zlib/inffixed.h | 94 -- klibc/klibc/zlib/inflate.c | 1270 --------------------- klibc/klibc/zlib/inflate.h | 117 -- klibc/klibc/zlib/inftrees.c | 321 ------ klibc/klibc/zlib/inftrees.h | 55 - klibc/klibc/zlib/trees.c | 1215 -------------------- klibc/klibc/zlib/trees.h | 128 --- klibc/klibc/zlib/uncompr.c | 61 - klibc/klibc/zlib/zconf.h | 323 ------ klibc/klibc/zlib/zconf.in.h | 323 ------ klibc/klibc/zlib/zlib.3 | 159 --- klibc/klibc/zlib/zlib.h | 1200 -------------------- klibc/klibc/zlib/zutil.c | 319 ------ klibc/klibc/zlib/zutil.h | 258 ----- klibc/makeklcc.pl | 55 - klibc/version | 1 - test/simple-build-check.sh | 15 +- 532 files changed, 25 insertions(+), 30176 deletions(-) delete mode 100644 klibc/MCONFIG delete mode 100644 klibc/MRULES delete mode 100644 klibc/Makefile delete mode 100644 klibc/README delete mode 100644 klibc/include/alloca.h delete mode 100644 klibc/include/arch/alpha/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/alpha/klibc/archsignal.h delete mode 100644 klibc/include/arch/alpha/klibc/archstat.h delete mode 100644 klibc/include/arch/alpha/klibc/archsys.h delete mode 100644 klibc/include/arch/alpha/machine/asm.h delete mode 100644 klibc/include/arch/arm/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/arm/klibc/archsignal.h delete mode 100644 klibc/include/arch/arm/klibc/archstat.h delete mode 100644 klibc/include/arch/arm/klibc/archsys.h delete mode 100644 klibc/include/arch/cris/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/cris/klibc/archsignal.h delete mode 100644 klibc/include/arch/cris/klibc/archstat.h delete mode 100644 klibc/include/arch/cris/klibc/archsys.h delete mode 100644 klibc/include/arch/i386/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/i386/klibc/archsignal.h delete mode 100644 klibc/include/arch/i386/klibc/archstat.h delete mode 100644 klibc/include/arch/i386/klibc/archsys.h delete mode 100644 klibc/include/arch/i386/klibc/diverr.h delete mode 100644 klibc/include/arch/i386/sys/io.h delete mode 100644 klibc/include/arch/i386/sys/vm86.h delete mode 100644 klibc/include/arch/ia64/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/ia64/klibc/archsignal.h delete mode 100644 klibc/include/arch/ia64/klibc/archstat.h delete mode 100644 klibc/include/arch/ia64/klibc/archsys.h delete mode 100644 klibc/include/arch/m32r/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/m32r/klibc/archsignal.h delete mode 100644 klibc/include/arch/m32r/klibc/archstat.h delete mode 100644 klibc/include/arch/m32r/klibc/archsys.h delete mode 100644 klibc/include/arch/m68k/klibc/archsignal.h delete mode 100644 klibc/include/arch/m68k/klibc/archstat.h delete mode 100644 klibc/include/arch/m68k/klibc/archsys.h delete mode 100644 klibc/include/arch/mips/klibc/archfcntl.h delete mode 100644 klibc/include/arch/mips/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/mips/klibc/archsignal.h delete mode 100644 klibc/include/arch/mips/klibc/archstat.h delete mode 100644 klibc/include/arch/mips/klibc/archsys.h delete mode 100644 klibc/include/arch/mips/machine/asm.h delete mode 100644 klibc/include/arch/mips/sgidefs.h delete mode 100644 klibc/include/arch/mips/spaces.h delete mode 100644 klibc/include/arch/mips64/klibc/archsignal.h delete mode 100644 klibc/include/arch/mips64/klibc/archstat.h delete mode 100644 klibc/include/arch/mips64/klibc/archsys.h delete mode 100644 klibc/include/arch/parisc/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/parisc/klibc/archsignal.h delete mode 100644 klibc/include/arch/parisc/klibc/archstat.h delete mode 100644 klibc/include/arch/parisc/klibc/archsys.h delete mode 100644 klibc/include/arch/ppc/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/ppc/klibc/archsignal.h delete mode 100644 klibc/include/arch/ppc/klibc/archstat.h delete mode 100644 klibc/include/arch/ppc/klibc/archsys.h delete mode 100644 klibc/include/arch/ppc64/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/ppc64/klibc/archsignal.h delete mode 100644 klibc/include/arch/ppc64/klibc/archstat.h delete mode 100644 klibc/include/arch/ppc64/klibc/archsys.h delete mode 100644 klibc/include/arch/s390/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/s390/klibc/archsignal.h delete mode 100644 klibc/include/arch/s390/klibc/archstat.h delete mode 100644 klibc/include/arch/s390/klibc/archsys.h delete mode 100644 klibc/include/arch/s390x/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/s390x/klibc/archsignal.h delete mode 100644 klibc/include/arch/s390x/klibc/archstat.h delete mode 100644 klibc/include/arch/s390x/klibc/archsys.h delete mode 100644 klibc/include/arch/sh/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/sh/klibc/archsignal.h delete mode 100644 klibc/include/arch/sh/klibc/archstat.h delete mode 100644 klibc/include/arch/sh/klibc/archsys.h delete mode 100644 klibc/include/arch/sparc/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/sparc/klibc/archsignal.h delete mode 100644 klibc/include/arch/sparc/klibc/archstat.h delete mode 100644 klibc/include/arch/sparc/klibc/archsys.h delete mode 100644 klibc/include/arch/sparc/machine/asm.h delete mode 100644 klibc/include/arch/sparc/machine/frame.h delete mode 100644 klibc/include/arch/sparc/machine/trap.h delete mode 100644 klibc/include/arch/sparc64/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/sparc64/klibc/archsignal.h delete mode 100644 klibc/include/arch/sparc64/klibc/archstat.h delete mode 100644 klibc/include/arch/sparc64/klibc/archsys.h delete mode 100644 klibc/include/arch/x86_64/klibc/archsetjmp.h delete mode 100644 klibc/include/arch/x86_64/klibc/archsignal.h delete mode 100644 klibc/include/arch/x86_64/klibc/archstat.h delete mode 100644 klibc/include/arch/x86_64/klibc/archsys.h delete mode 100644 klibc/include/arch/x86_64/sys/io.h delete mode 100644 klibc/include/arpa/inet.h delete mode 100644 klibc/include/assert.h delete mode 100644 klibc/include/bits32/bitsize.h delete mode 100644 klibc/include/bits32/bitsize/limits.h delete mode 100644 klibc/include/bits32/bitsize/stddef.h delete mode 100644 klibc/include/bits32/bitsize/stdint.h delete mode 100644 klibc/include/bits32/bitsize/stdintconst.h delete mode 100644 klibc/include/bits32/bitsize/stdintlimits.h delete mode 100644 klibc/include/bits64/bitsize.h delete mode 100644 klibc/include/bits64/bitsize/limits.h delete mode 100644 klibc/include/bits64/bitsize/stddef.h delete mode 100644 klibc/include/bits64/bitsize/stdint.h delete mode 100644 klibc/include/bits64/bitsize/stdintconst.h delete mode 100644 klibc/include/bits64/bitsize/stdintlimits.h delete mode 100644 klibc/include/ctype.h delete mode 100644 klibc/include/dirent.h delete mode 100644 klibc/include/elf.h delete mode 100644 klibc/include/endian.h delete mode 100644 klibc/include/errno.h delete mode 100644 klibc/include/fcntl.h delete mode 100644 klibc/include/grp.h delete mode 100644 klibc/include/inttypes.h delete mode 100644 klibc/include/klibc/compiler.h delete mode 100644 klibc/include/klibc/diverr.h delete mode 100644 klibc/include/klibc/extern.h delete mode 100644 klibc/include/klibc/sysconfig.h delete mode 100644 klibc/include/limits.h delete mode 100644 klibc/include/malloc.h delete mode 100644 klibc/include/net/if.h delete mode 100644 klibc/include/net/if_arp.h delete mode 100644 klibc/include/net/if_packet.h delete mode 100644 klibc/include/net/route.h delete mode 100644 klibc/include/netinet/if_ether.h delete mode 100644 klibc/include/netinet/in.h delete mode 100644 klibc/include/netinet/in6.h delete mode 100644 klibc/include/netinet/ip.h delete mode 100644 klibc/include/netinet/tcp.h delete mode 100644 klibc/include/netinet/udp.h delete mode 100644 klibc/include/netpacket/packet.h delete mode 100644 klibc/include/paths.h delete mode 100644 klibc/include/poll.h delete mode 100644 klibc/include/sched.h delete mode 100644 klibc/include/setjmp.h delete mode 100644 klibc/include/signal.h delete mode 100644 klibc/include/stdarg.h delete mode 100644 klibc/include/stddef.h delete mode 100644 klibc/include/stdint.h delete mode 100644 klibc/include/stdio.h delete mode 100644 klibc/include/stdlib.h delete mode 100644 klibc/include/string.h delete mode 100644 klibc/include/sys/dirent.h delete mode 100644 klibc/include/sys/elf32.h delete mode 100644 klibc/include/sys/elf64.h delete mode 100644 klibc/include/sys/elfcommon.h delete mode 100644 klibc/include/sys/fsuid.h delete mode 100644 klibc/include/sys/inotify.h delete mode 100644 klibc/include/sys/ioctl.h delete mode 100644 klibc/include/sys/klog.h delete mode 100644 klibc/include/sys/mman.h delete mode 100644 klibc/include/sys/mount.h delete mode 100644 klibc/include/sys/param.h delete mode 100644 klibc/include/sys/reboot.h delete mode 100644 klibc/include/sys/resource.h delete mode 100644 klibc/include/sys/select.h delete mode 100644 klibc/include/sys/socket.h delete mode 100644 klibc/include/sys/socketcalls.h delete mode 100644 klibc/include/sys/stat.h delete mode 100644 klibc/include/sys/statfs.h delete mode 100644 klibc/include/sys/syscall.h delete mode 100644 klibc/include/sys/sysinfo.h delete mode 100644 klibc/include/sys/sysmacros.h delete mode 100644 klibc/include/sys/time.h delete mode 100644 klibc/include/sys/times.h delete mode 100644 klibc/include/sys/types.h delete mode 100644 klibc/include/sys/uio.h delete mode 100644 klibc/include/sys/un.h delete mode 100644 klibc/include/sys/utime.h delete mode 100644 klibc/include/sys/utsname.h delete mode 100644 klibc/include/sys/vfs.h delete mode 100644 klibc/include/sys/wait.h delete mode 100644 klibc/include/syslog.h delete mode 100644 klibc/include/termios.h delete mode 100644 klibc/include/time.h delete mode 100644 klibc/include/unistd.h delete mode 100644 klibc/include/utime.h delete mode 100644 klibc/klcc.1 delete mode 100644 klibc/klcc.in delete mode 100644 klibc/klibc.spec.in delete mode 100644 klibc/klibc/CAVEATS delete mode 100644 klibc/klibc/Kbuild delete mode 100644 klibc/klibc/LICENSE delete mode 100644 klibc/klibc/MCONFIG delete mode 100644 klibc/klibc/Makefile delete mode 100644 klibc/klibc/README delete mode 100644 klibc/klibc/SOCKETCALLS.def delete mode 100644 klibc/klibc/SYSCALLS.def delete mode 100644 klibc/klibc/__put_env.c delete mode 100644 klibc/klibc/__shared_init.c delete mode 100644 klibc/klibc/__signal.c delete mode 100644 klibc/klibc/__static_init.c delete mode 100644 klibc/klibc/abort.c delete mode 100644 klibc/klibc/alarm.c delete mode 100644 klibc/klibc/arch/README delete mode 100644 klibc/klibc/arch/alpha/MCONFIG delete mode 100644 klibc/klibc/arch/alpha/Makefile.inc delete mode 100644 klibc/klibc/arch/alpha/README-gcc delete mode 100644 klibc/klibc/arch/alpha/crt0.S delete mode 100644 klibc/klibc/arch/alpha/divide.c delete mode 100644 klibc/klibc/arch/alpha/pipe.c delete mode 100644 klibc/klibc/arch/alpha/setjmp.S delete mode 100644 klibc/klibc/arch/alpha/syscall.S delete mode 100644 klibc/klibc/arch/alpha/sysdual.S delete mode 100644 klibc/klibc/arch/alpha/sysstub.ph delete mode 100644 klibc/klibc/arch/arm/MCONFIG delete mode 100644 klibc/klibc/arch/arm/Makefile.inc delete mode 100644 klibc/klibc/arch/arm/crt0.S delete mode 100644 klibc/klibc/arch/arm/setjmp-arm.S delete mode 100644 klibc/klibc/arch/arm/setjmp-thumb.S delete mode 100644 klibc/klibc/arch/arm/syscall.S delete mode 100644 klibc/klibc/arch/arm/sysstub.ph delete mode 100644 klibc/klibc/arch/cris/MCONFIG delete mode 100644 klibc/klibc/arch/cris/Makefile.inc delete mode 100644 klibc/klibc/arch/cris/__negdi2.S delete mode 100644 klibc/klibc/arch/cris/crt0.S delete mode 100644 klibc/klibc/arch/cris/divide.c delete mode 100644 klibc/klibc/arch/cris/setjmp.S delete mode 100644 klibc/klibc/arch/cris/syscall.S delete mode 100644 klibc/klibc/arch/cris/sysstub.ph delete mode 100644 klibc/klibc/arch/i386/MCONFIG delete mode 100644 klibc/klibc/arch/i386/Makefile.inc delete mode 100644 klibc/klibc/arch/i386/crt0.S delete mode 100644 klibc/klibc/arch/i386/exits.S delete mode 100644 klibc/klibc/arch/i386/libgcc/__ashldi3.S delete mode 100644 klibc/klibc/arch/i386/libgcc/__ashrdi3.S delete mode 100644 klibc/klibc/arch/i386/libgcc/__lshrdi3.S delete mode 100644 klibc/klibc/arch/i386/libgcc/__muldi3.S delete mode 100644 klibc/klibc/arch/i386/libgcc/__negdi2.S delete mode 100644 klibc/klibc/arch/i386/open.S delete mode 100644 klibc/klibc/arch/i386/setjmp.S delete mode 100644 klibc/klibc/arch/i386/sigreturn.S delete mode 100644 klibc/klibc/arch/i386/socketcall.S delete mode 100644 klibc/klibc/arch/i386/syscall.S delete mode 100644 klibc/klibc/arch/i386/sysstub.ph delete mode 100644 klibc/klibc/arch/ia64/MCONFIG delete mode 100644 klibc/klibc/arch/ia64/Makefile.inc delete mode 100644 klibc/klibc/arch/ia64/crt0.S delete mode 100644 klibc/klibc/arch/ia64/pipe.c delete mode 100644 klibc/klibc/arch/ia64/setjmp.S delete mode 100644 klibc/klibc/arch/ia64/syscall.S delete mode 100644 klibc/klibc/arch/ia64/sysstub.ph delete mode 100644 klibc/klibc/arch/ia64/vfork.S delete mode 100644 klibc/klibc/arch/m32r/MCONFIG delete mode 100644 klibc/klibc/arch/m32r/Makefile.inc delete mode 100644 klibc/klibc/arch/m32r/crt0.S delete mode 100644 klibc/klibc/arch/m32r/setjmp.S delete mode 100644 klibc/klibc/arch/m32r/syscall.S delete mode 100644 klibc/klibc/arch/m32r/sysstub.ph delete mode 100644 klibc/klibc/arch/m68k/MCONFIG delete mode 100644 klibc/klibc/arch/m68k/Makefile.inc delete mode 100644 klibc/klibc/arch/mips/MCONFIG delete mode 100644 klibc/klibc/arch/mips/Makefile.inc delete mode 100644 klibc/klibc/arch/mips/crt0.S delete mode 100644 klibc/klibc/arch/mips/klibc.ld delete mode 100644 klibc/klibc/arch/mips/pipe.S delete mode 100644 klibc/klibc/arch/mips/setjmp.S delete mode 100644 klibc/klibc/arch/mips/syscall.S delete mode 100644 klibc/klibc/arch/mips/sysstub.ph delete mode 100644 klibc/klibc/arch/mips/vfork.S delete mode 100644 klibc/klibc/arch/mips64/MCONFIG delete mode 100644 klibc/klibc/arch/mips64/Makefile.inc delete mode 100644 klibc/klibc/arch/parisc/MCONFIG delete mode 100644 klibc/klibc/arch/parisc/Makefile.inc delete mode 100644 klibc/klibc/arch/parisc/crt0.S delete mode 100644 klibc/klibc/arch/parisc/setjmp.S delete mode 100644 klibc/klibc/arch/parisc/syscall.c delete mode 100644 klibc/klibc/arch/parisc/sysstub.ph delete mode 100644 klibc/klibc/arch/ppc/MCONFIG delete mode 100644 klibc/klibc/arch/ppc/Makefile.inc delete mode 100644 klibc/klibc/arch/ppc/crt0.S delete mode 100644 klibc/klibc/arch/ppc/setjmp.S delete mode 100644 klibc/klibc/arch/ppc/syscall.S delete mode 100644 klibc/klibc/arch/ppc/sysstub.ph delete mode 100644 klibc/klibc/arch/ppc64/MCONFIG delete mode 100644 klibc/klibc/arch/ppc64/Makefile.inc delete mode 100644 klibc/klibc/arch/ppc64/crt0.S delete mode 100644 klibc/klibc/arch/ppc64/setjmp.S delete mode 100644 klibc/klibc/arch/ppc64/syscall.c delete mode 100644 klibc/klibc/arch/ppc64/sysstub.ph delete mode 100644 klibc/klibc/arch/s390/MCONFIG delete mode 100644 klibc/klibc/arch/s390/Makefile.inc delete mode 100644 klibc/klibc/arch/s390/crt0.S delete mode 100644 klibc/klibc/arch/s390/mmap.c delete mode 100644 klibc/klibc/arch/s390/setjmp.S delete mode 100644 klibc/klibc/arch/s390/syscall.c delete mode 100644 klibc/klibc/arch/s390/sysstub.ph delete mode 100644 klibc/klibc/arch/s390x/MCONFIG delete mode 100644 klibc/klibc/arch/s390x/Makefile.inc delete mode 100644 klibc/klibc/arch/s390x/crt0.S delete mode 100644 klibc/klibc/arch/s390x/mmap.c delete mode 100644 klibc/klibc/arch/s390x/setjmp.S delete mode 100644 klibc/klibc/arch/s390x/syscall.c delete mode 100644 klibc/klibc/arch/s390x/sysstub.ph delete mode 100644 klibc/klibc/arch/sh/MCONFIG delete mode 100644 klibc/klibc/arch/sh/Makefile.inc delete mode 100644 klibc/klibc/arch/sh/crt0.S delete mode 100644 klibc/klibc/arch/sh/setjmp.S delete mode 100644 klibc/klibc/arch/sh/syscall.S delete mode 100644 klibc/klibc/arch/sh/sysstub.ph delete mode 100644 klibc/klibc/arch/sparc/MCONFIG delete mode 100644 klibc/klibc/arch/sparc/Makefile.inc delete mode 100644 klibc/klibc/arch/sparc/crt0.S delete mode 100644 klibc/klibc/arch/sparc/crt0i.S delete mode 100644 klibc/klibc/arch/sparc/divrem.m4 delete mode 100644 klibc/klibc/arch/sparc/setjmp.S delete mode 100644 klibc/klibc/arch/sparc/smul.S delete mode 100644 klibc/klibc/arch/sparc/syscall.S delete mode 100644 klibc/klibc/arch/sparc/sysfork.S delete mode 100644 klibc/klibc/arch/sparc/sysstub.ph delete mode 100644 klibc/klibc/arch/sparc/umul.S delete mode 100644 klibc/klibc/arch/sparc64/MCONFIG delete mode 100644 klibc/klibc/arch/sparc64/Makefile.inc delete mode 100644 klibc/klibc/arch/sparc64/crt0.S delete mode 100644 klibc/klibc/arch/sparc64/setjmp.S delete mode 100644 klibc/klibc/arch/sparc64/syscall.S delete mode 100644 klibc/klibc/arch/sparc64/sysfork.S delete mode 100644 klibc/klibc/arch/sparc64/sysstub.ph delete mode 100644 klibc/klibc/arch/x86_64/MCONFIG delete mode 100644 klibc/klibc/arch/x86_64/Makefile.inc delete mode 100644 klibc/klibc/arch/x86_64/crt0.S delete mode 100644 klibc/klibc/arch/x86_64/exits.S delete mode 100644 klibc/klibc/arch/x86_64/setjmp.S delete mode 100644 klibc/klibc/arch/x86_64/sigreturn.S delete mode 100644 klibc/klibc/arch/x86_64/syscall.S delete mode 100644 klibc/klibc/arch/x86_64/sysstub.ph delete mode 100644 klibc/klibc/asprintf.c delete mode 100644 klibc/klibc/assert.c delete mode 100644 klibc/klibc/atexit.c delete mode 100644 klibc/klibc/atexit.h delete mode 100644 klibc/klibc/atoi.c delete mode 100644 klibc/klibc/atol.c delete mode 100644 klibc/klibc/atoll.c delete mode 100644 klibc/klibc/atox.c delete mode 100644 klibc/klibc/brk.c delete mode 100644 klibc/klibc/bsd_signal.c delete mode 100644 klibc/klibc/calloc.c delete mode 100644 klibc/klibc/closelog.c delete mode 100644 klibc/klibc/creat.c delete mode 100644 klibc/klibc/ctypes.c delete mode 100644 klibc/klibc/daemon.c delete mode 100644 klibc/klibc/exec_l.c delete mode 100644 klibc/klibc/execl.c delete mode 100644 klibc/klibc/execle.c delete mode 100644 klibc/klibc/execlp.c delete mode 100644 klibc/klibc/execlpe.c delete mode 100644 klibc/klibc/execv.c delete mode 100644 klibc/klibc/execvp.c delete mode 100644 klibc/klibc/execvpe.c delete mode 100644 klibc/klibc/exitc.c delete mode 100644 klibc/klibc/fgetc.c delete mode 100644 klibc/klibc/fgets.c delete mode 100644 klibc/klibc/fopen.c delete mode 100644 klibc/klibc/fork.c delete mode 100644 klibc/klibc/fprintf.c delete mode 100644 klibc/klibc/fputc.c delete mode 100644 klibc/klibc/fputs.c delete mode 100644 klibc/klibc/fread.c delete mode 100644 klibc/klibc/fread2.c delete mode 100644 klibc/klibc/fstatfs.c delete mode 100644 klibc/klibc/fwrite.c delete mode 100644 klibc/klibc/fwrite2.c delete mode 100644 klibc/klibc/getcwd.c delete mode 100644 klibc/klibc/getdomainname.c delete mode 100644 klibc/klibc/getenv.c delete mode 100644 klibc/klibc/gethostname.c delete mode 100644 klibc/klibc/getopt.c delete mode 100644 klibc/klibc/getpgrp.c delete mode 100644 klibc/klibc/getpriority.c delete mode 100644 klibc/klibc/getpt.c delete mode 100644 klibc/klibc/globals.c delete mode 100644 klibc/klibc/inet/bindresvport.c delete mode 100644 klibc/klibc/inet/inet_addr.c delete mode 100644 klibc/klibc/inet/inet_aton.c delete mode 100644 klibc/klibc/inet/inet_ntoa.c delete mode 100644 klibc/klibc/inet/inet_ntop.c delete mode 100644 klibc/klibc/inet/inet_pton.c delete mode 100644 klibc/klibc/interp.S delete mode 100644 klibc/klibc/isatty.c delete mode 100644 klibc/klibc/jrand48.c delete mode 100644 klibc/klibc/libc_init.c delete mode 100644 klibc/klibc/libgcc/__divdi3.c delete mode 100644 klibc/klibc/libgcc/__divsi3.c delete mode 100644 klibc/klibc/libgcc/__moddi3.c delete mode 100644 klibc/klibc/libgcc/__modsi3.c delete mode 100644 klibc/klibc/libgcc/__udivdi3.c delete mode 100644 klibc/klibc/libgcc/__udivmoddi4.c delete mode 100644 klibc/klibc/libgcc/__udivmodsi4.c delete mode 100644 klibc/klibc/libgcc/__udivsi3.c delete mode 100644 klibc/klibc/libgcc/__umoddi3.c delete mode 100644 klibc/klibc/libgcc/__umodsi3.c delete mode 100644 klibc/klibc/llseek.c delete mode 100644 klibc/klibc/lrand48.c delete mode 100644 klibc/klibc/makeerrlist.pl delete mode 100644 klibc/klibc/malloc.c delete mode 100644 klibc/klibc/malloc.h delete mode 100644 klibc/klibc/memccpy.c delete mode 100644 klibc/klibc/memchr.c delete mode 100644 klibc/klibc/memcmp.c delete mode 100644 klibc/klibc/memcpy.c delete mode 100644 klibc/klibc/memmem.c delete mode 100644 klibc/klibc/memmove.c delete mode 100644 klibc/klibc/memrchr.c delete mode 100644 klibc/klibc/memset.c delete mode 100644 klibc/klibc/memswap.c delete mode 100644 klibc/klibc/mmap.c delete mode 100644 klibc/klibc/mrand48.c delete mode 100644 klibc/klibc/nice.c delete mode 100644 klibc/klibc/nrand48.c delete mode 100644 klibc/klibc/onexit.c delete mode 100644 klibc/klibc/open.c delete mode 100644 klibc/klibc/pause.c delete mode 100644 klibc/klibc/perror.c delete mode 100644 klibc/klibc/printf.c delete mode 100644 klibc/klibc/pty.c delete mode 100644 klibc/klibc/putchar.c delete mode 100644 klibc/klibc/putenv.c delete mode 100644 klibc/klibc/puts.c delete mode 100644 klibc/klibc/qsort.c delete mode 100644 klibc/klibc/raise.c delete mode 100644 klibc/klibc/readdir.c delete mode 100644 klibc/klibc/realloc.c delete mode 100644 klibc/klibc/reboot.c delete mode 100644 klibc/klibc/recv.c delete mode 100644 klibc/klibc/sbrk.c delete mode 100644 klibc/klibc/seed48.c delete mode 100644 klibc/klibc/send.c delete mode 100644 klibc/klibc/setegid.c delete mode 100644 klibc/klibc/setenv.c delete mode 100644 klibc/klibc/seteuid.c delete mode 100644 klibc/klibc/setpgrp.c delete mode 100644 klibc/klibc/sha1hash.c delete mode 100644 klibc/klibc/sigaction.c delete mode 100644 klibc/klibc/siglist.c delete mode 100644 klibc/klibc/siglongjmp.c delete mode 100644 klibc/klibc/sigpending.c delete mode 100644 klibc/klibc/sigprocmask.c delete mode 100644 klibc/klibc/sigsuspend.c delete mode 100644 klibc/klibc/sleep.c delete mode 100644 klibc/klibc/snprintf.c delete mode 100644 klibc/klibc/socketcalls.pl delete mode 100644 klibc/klibc/socketcommon.h delete mode 100644 klibc/klibc/sprintf.c delete mode 100644 klibc/klibc/srand48.c delete mode 100644 klibc/klibc/sscanf.c delete mode 100644 klibc/klibc/statfs.c delete mode 100644 klibc/klibc/strcasecmp.c delete mode 100644 klibc/klibc/strcat.c delete mode 100644 klibc/klibc/strchr.c delete mode 100644 klibc/klibc/strcmp.c delete mode 100644 klibc/klibc/strcpy.c delete mode 100644 klibc/klibc/strcspn.c delete mode 100644 klibc/klibc/strdup.c delete mode 100644 klibc/klibc/strerror.c delete mode 100644 klibc/klibc/strlcat.c delete mode 100644 klibc/klibc/strlcpy.c delete mode 100644 klibc/klibc/strlen.c delete mode 100644 klibc/klibc/strncasecmp.c delete mode 100644 klibc/klibc/strncat.c delete mode 100644 klibc/klibc/strncmp.c delete mode 100644 klibc/klibc/strncpy.c delete mode 100644 klibc/klibc/strndup.c delete mode 100644 klibc/klibc/strnlen.c delete mode 100644 klibc/klibc/strntoimax.c delete mode 100644 klibc/klibc/strntoumax.c delete mode 100644 klibc/klibc/strpbrk.c delete mode 100644 klibc/klibc/strrchr.c delete mode 100644 klibc/klibc/strsep.c delete mode 100644 klibc/klibc/strspn.c delete mode 100644 klibc/klibc/strstr.c delete mode 100644 klibc/klibc/strtoimax.c delete mode 100644 klibc/klibc/strtok.c delete mode 100644 klibc/klibc/strtol.c delete mode 100644 klibc/klibc/strtoll.c delete mode 100644 klibc/klibc/strtotimespec.c delete mode 100644 klibc/klibc/strtotimeval.c delete mode 100644 klibc/klibc/strtotimex.c delete mode 100644 klibc/klibc/strtoul.c delete mode 100644 klibc/klibc/strtoull.c delete mode 100644 klibc/klibc/strtoumax.c delete mode 100644 klibc/klibc/strtox.c delete mode 100644 klibc/klibc/strxspn.c delete mode 100644 klibc/klibc/strxspn.h delete mode 100644 klibc/klibc/syscalls.pl delete mode 100644 klibc/klibc/syscommon.h delete mode 100644 klibc/klibc/syslog.c delete mode 100644 klibc/klibc/system.c delete mode 100644 klibc/klibc/sysv_signal.c delete mode 100644 klibc/klibc/time.c delete mode 100644 klibc/klibc/umount.c delete mode 100644 klibc/klibc/unsetenv.c delete mode 100644 klibc/klibc/usleep.c delete mode 100644 klibc/klibc/utime.c delete mode 100644 klibc/klibc/vasprintf.c delete mode 100644 klibc/klibc/vfprintf.c delete mode 100644 klibc/klibc/vprintf.c delete mode 100644 klibc/klibc/vsnprintf.c delete mode 100644 klibc/klibc/vsprintf.c delete mode 100644 klibc/klibc/vsscanf.c delete mode 100644 klibc/klibc/wait.c delete mode 100644 klibc/klibc/wait3.c delete mode 100644 klibc/klibc/waitpid.c delete mode 100644 klibc/klibc/zlib/FAQ delete mode 100644 klibc/klibc/zlib/INDEX delete mode 100644 klibc/klibc/zlib/README delete mode 100644 klibc/klibc/zlib/adler32.c delete mode 100644 klibc/klibc/zlib/algorithm.txt delete mode 100644 klibc/klibc/zlib/compress.c delete mode 100644 klibc/klibc/zlib/crc32.c delete mode 100644 klibc/klibc/zlib/crc32.h delete mode 100644 klibc/klibc/zlib/deflate.c delete mode 100644 klibc/klibc/zlib/deflate.h delete mode 100644 klibc/klibc/zlib/gzio.c delete mode 100644 klibc/klibc/zlib/infback.c delete mode 100644 klibc/klibc/zlib/inffast.c delete mode 100644 klibc/klibc/zlib/inffast.h delete mode 100644 klibc/klibc/zlib/inffixed.h delete mode 100644 klibc/klibc/zlib/inflate.c delete mode 100644 klibc/klibc/zlib/inflate.h delete mode 100644 klibc/klibc/zlib/inftrees.c delete mode 100644 klibc/klibc/zlib/inftrees.h delete mode 100644 klibc/klibc/zlib/trees.c delete mode 100644 klibc/klibc/zlib/trees.h delete mode 100644 klibc/klibc/zlib/uncompr.c delete mode 100644 klibc/klibc/zlib/zconf.h delete mode 100644 klibc/klibc/zlib/zconf.in.h delete mode 100644 klibc/klibc/zlib/zlib.3 delete mode 100644 klibc/klibc/zlib/zlib.h delete mode 100644 klibc/klibc/zlib/zutil.c delete mode 100644 klibc/klibc/zlib/zutil.h delete mode 100755 klibc/makeklcc.pl delete mode 100644 klibc/version diff --git a/ChangeLog b/ChangeLog index e6fd84f582..3ef3c4b838 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +Summary of changes from v74 to v075 +============================================ + Summary of changes from v73 to v074 ============================================ diff --git a/Makefile b/Makefile index bc97388a12..c105dab2e2 100644 --- a/Makefile +++ b/Makefile @@ -122,7 +122,6 @@ configdir = ${etcdir}/udev udevdir = /dev udevdb = ${udevdir}/.udevdb LOCAL_CFG_DIR = etc/udev -KERNEL_DIR = /lib/modules/${shell uname -r}/build DESTDIR = INSTALL = /usr/bin/install -c @@ -177,8 +176,7 @@ endif # if our own version of klibc is used, we need to build it ifeq ($(strip $(USE_KLIBC)),true) - KLIBC_INSTALL = $(PWD)/klibc/.install - KLCC = $(KLIBC_INSTALL)/bin/$(CROSS)klcc + KLCC = /usr/bin/$(CROSS)klcc CC = $(KLCC) LD = $(KLCC) V = true @@ -203,7 +201,7 @@ else HOST_PROGS= endif -all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) +all: $(PROGRAMS) $(MAN_PAGES) @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ $(MAKE) CC="$(CC)" \ @@ -214,7 +212,6 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) LIB_OBJS="$(LIB_OBJS)" \ LIBUDEV="$(PWD)/$(LIBUDEV)" \ LIBSYSFS="$(PWD)/$(LIBSYSFS)" \ - KERNEL_DIR="$(KERNEL_DIR)" \ QUIET="$(QUIET)" \ -C $$target $@; \ done; @@ -229,28 +226,19 @@ all: $(KLCC) $(PROGRAMS) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ # "Static Pattern Rule" to build all programs -$(PROGRAMS): %: $(HOST_PROGS) $(KLCC) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) %.o +$(PROGRAMS): %: $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) %.o $(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) ifneq ($(STRIPCMD),) $(QUIET) $(STRIPCMD) $@ endif -# our own copy of klibc, it is not used if KLCC is given -$(KLCC): - $(MAKE) -C klibc KRNLSRC=$(KERNEL_DIR) SUBDIRS=klibc TESTS= \ - SHLIBDIR=$(KLIBC_INSTALL)/lib \ - INSTALLDIR=$(KLIBC_INSTALL) \ - bindir=$(KLIBC_INSTALL)/bin \ - mandir=$(KLIBC_INSTALL)/man all install -.NOTPARALLEL: $(KLCC) - -$(UDEV_OBJS): $(KLCC) +$(UDEV_OBJS): $(LIBUDEV): $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS) @rm -f $@ $(QUIET) $(AR) cq $@ $(UDEV_OBJS) $(QUIET) $(RANLIB) $@ -$(SYSFS_OBJS): $(KLCC) +$(SYSFS_OBJS): $(LIBSYSFS): $(HOST_PROGS) $(SYSFS_OBJS) @rm -f $@ $(QUIET) $(AR) cq $@ $(SYSFS_OBJS) @@ -288,13 +276,10 @@ clean: - rm -f udev_gcov.txt - rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS) - rm -f udev-$(VERSION).tar.gz - $(MAKE) -C klibc SUBDIRS=klibc clean @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ $(MAKE) -C $$target $@; \ done; - $(MAKE) -C klibc SUBDIRS=klibc spotless - rm -rf klibc/.install .PHONY: clean release: diff --git a/README b/README index 19ed4468ea..3f4f947f79 100644 --- a/README +++ b/README @@ -45,9 +45,7 @@ Setting which are used for building udev: USE_LOG if set to 'true', udev will emit messages to the syslog when it creates or removes device nodes. This is helpful to see - what udev is doing. This is enabled by default. Note, if you - are building udev against klibc it is recommended that you - disable this option (due to klibc's syslog implementation.) + what udev is doing. This is enabled by default. DEBUG if set to 'true', verbose debugging messages will be compiled into the udev binaries. Default value is 'false'. @@ -55,20 +53,13 @@ Setting which are used for building udev: if set to 'true', udev will be built with SELinux support enabled. This is disabled by default. USE_KLIBC - if set to 'true', udev is built and linked against the - included version of klibc. Default value is 'false'. - KERNEL_DIR - If this is not set it will default to /lib/modules/`uname -r`/build - This is used if USE_KLIBC=true to find the kernel include - directory that klibc needs to build against. This must be set - if you are not building udev while running a 2.6 kernel. + if set to 'true', udev is built and linked against klibc. + Default value is 'false'. KLCC specifies the klibc compiler + wrapper, usually in /usr/bin/klcc EXTRAS if set, will build the "extra" helper programs as specified as listed (see below for an example.) -if you want to build udev using klibc with debugging messages: - make USE_KLIBC=true DEBUG=true - if you want to build the udev helper program cdrom_id and scsi_id: make EXTRAS="extras/cdrom_id extras/scsi_id" diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8a1bde8a3b..d89aeaa69f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,8 @@ +udev 075 +======== +The copy of klibc is removed. A systemwide installed version of klibc +can be used to buil a klibc udev. + udev 074 ======== NAME="" will not create any nodes, but execute RUN keys. To completely diff --git a/klibc/MCONFIG b/klibc/MCONFIG deleted file mode 100644 index 450e5c7f5c..0000000000 --- a/klibc/MCONFIG +++ /dev/null @@ -1,98 +0,0 @@ -# -*- makefile -*- -# -# Makefile configuration, without explicit rules -# - -# CROSS is the prefix used for system tools like gcc, ld etc. -CROSS = - -# KCROSS is the prefix we use for klibc installations. This is usually -# the same as CROSS, but may be different, e.g. to install an i386 -# cross-compilation suite on an x86-64 system, using the same gcc/binutils. -KCROSS ?= $(CROSS) - -# Location for installation -prefix = /usr -bindir = $(prefix)/bin -libdir = $(prefix)/lib -mandir = $(prefix)/man -INSTALLDIR = $(prefix)/lib/klibc -INSTALLROOT = - -INSTALL_EXEC = install -m 755 -INSTALL_DATA = install -m 644 - -# Eventually support separate compilation, but we don't have it yet... -OBJROOT = $(SRCROOT) - -# Kernel trees (source and obj) - can potentially be different -KRNLSRC = $(SRCROOT)/linux -KRNLOBJ = $(SRCROOT)/linux - -# klibc version information -KLIBCVER = -D__KLIBC__=$(shell cut -d. -f1 < $(SRCROOT)/version) \ - -D__KLIBC_MINOR__=$(shell cut -d. -f2 < $(SRCROOT)/version) - -ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/parisc.*/parisc/) -CC = $(CROSS)gcc -LD = $(CROSS)ld -KLIBSRC = $(SRCROOT)/klibc -KLIBOBJ = $(OBJROOT)/klibc -INCLUDE = -I$(SRCROOT)/include/arch/$(ARCH) \ - -I$(SRCROOT)/include/bits$(BITSIZE) \ - -I$(SRCROOT)/include \ - -I$(KRNLOBJ)/include -I$(KRNLOBJ)/include2 -I$(KRNLSRC)/include -REQFLAGS = $(ARCHREQFLAGS) $(KLIBCVER) -nostdlib -nostdinc -iwithprefix include \ - $(INCLUDE) -LDFLAGS = -AR = $(CROSS)ar -RANLIB = $(CROSS)ranlib -NM = $(CROSS)nm -PERL = perl -OBJCOPY = $(CROSS)objcopy - -STRIP = $(CROSS)strip -STRIPFLAGS = --strip-all -R .comment -R .note -STRIPCMD = $(STRIP) $(STRIPFLAGS) - -HOST_CC = gcc -HOST_CFLAGS = -g -O -HOST_LDFLAGS = -HOST_LIBS = - -# Static library paths -CRT0 = $(KLIBOBJ)/crt0.o -KLIBC = $(KLIBOBJ)/libc.a -LIBGCC = $(shell $(CC) $(REQFLAGS) $(OPTFLAGS) --print-libgcc) - -# Shared library paths -CRTSHARED = $(KLIBOBJ)/interp.o -LIBSHARED = $(KLIBOBJ)/libc.so - -# -# This indicates the location of the final version of the shared library. -# THIS MUST BE AN ABSOLUTE PATH WITH NO FINAL SLASH. -# Leave this empty to make it the root. -# -SHLIBDIR = /lib - -# Enable this to make perror/strerror return real error messages -# This makes klibc.so and any static binary which uses these functions -# about 4K bigger. -ERRLIST = 1 - -# Include zlib in klibc. This roughly triples the size of klibc! -ZLIB = 0 - -# -# Include arch-specific rule fragments -# -include $(KLIBSRC)/arch/$(ARCH)/MCONFIG - -ifeq ($(DEBUG),y) -STRIP = /bin/true -Since_we_are_debugging -OPTFLAGS += -O1 -g -endif - -# How to tell the linker main() is the entrypoint -EMAIN ?= -e main diff --git a/klibc/MRULES b/klibc/MRULES deleted file mode 100644 index 41fdd07af8..0000000000 --- a/klibc/MRULES +++ /dev/null @@ -1,45 +0,0 @@ -# -*- makefile -*- -# -# Standard pattern rules -# - -.SUFFIXES: .c .o .a .so .lo .i .S .s .ls .ss .lss - -% : %.c # Cancel default rule - -% : %.S - -.c.o: - $(CC) $(CFLAGS) -c -o $@ $< - -.c.i: - $(CC) $(CFLAGS) -E -o $@ $< - -.c.s: - $(CC) $(CFLAGS) -S -o $@ $< - -.S.o: - $(CC) $(CFLAGS) -D__ASSEMBLY__ -c -o $@ $< - -.S.s: - $(CC) $(CFLAGS) -D__ASSEMBLY__ -E -o $@ $< - -.S.lo: - $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -c -o $@ $< - -.S.ls: - $(CC) $(CFLAGS) $(SOFLAGS) -D__ASSEMBLY__ -E -o $@ $< - -.s.o: - $(CC) $(CFLAGS) -x assembler -c -o $@ $< - -.ls.lo: - $(CC) $(CFLAGS) $(SOFLAGS) -x assembler -c -o $@ $< - -.c.lo: - $(CC) $(CFLAGS) $(SOFLAGS) -c -o $@ $< - -.c.ls: - $(CC) $(CFLAGS) $(SOFLAGS) -S -o $@ $< - - diff --git a/klibc/Makefile b/klibc/Makefile deleted file mode 100644 index e634aaccb5..0000000000 --- a/klibc/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -VERSION := $(shell cat version) -SUBDIRS = klibc ash ipconfig nfsmount utils kinit gzip -SRCROOT = . - -all: - -rpmbuild = $(shell which rpmbuild 2>/dev/null || which rpm) - -klibc.spec: klibc.spec.in version - sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@ - -.PHONY: rpm -rpm: klibc.spec - +$(rpmbuild) -bb klibc.spec --target=$(ARCH) - -$(CROSS)klibc.config: Makefile - rm -f $@ - echo 'ARCH=$(ARCH)' >> $@ - echo 'CROSS=$(CROSS)' >> $@ - echo 'KCROSS=$(KCROSS)' >> $@ - echo 'CC=$(CC)' >> $@ - echo 'LD=$(LD)' >> $@ - echo 'REQFLAGS=$(filter-out -I%,$(REQFLAGS))' >> $@ - echo 'OPTFLAGS=$(OPTFLAGS)' >> $@ - echo 'LDFLAGS=$(LDFLAGS)' >> $@ - echo 'STRIP=$(STRIP)' >> $@ - echo 'STRIPFLAGS=$(STRIPFLAGS)' >> $@ - echo 'EMAIN=$(EMAIN)' >> $@ - echo 'BITSIZE=$(BITSIZE)' >> $@ - echo 'prefix=$(INSTALLDIR)' >> $@ - echo 'bindir=$(INSTALLDIR)/$(KCROSS)bin' >> $@ - echo 'libdir=$(INSTALLDIR)/$(KCROSS)lib' >> $@ - echo 'includedir=$(INSTALLDIR)/$(KCROSS)include' >> $@ - -$(CROSS)klcc: klcc.in $(CROSS)klibc.config makeklcc.pl - $(PERL) makeklcc.pl klcc.in $(CROSS)klibc.config \ - $(shell bash -c 'type -p $(PERL)') > $@ || ( rm -f $@ ; exit 1 ) - chmod a+x $@ - -%: local-% - @set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done - -local-all: $(CROSS)klcc - -local-clean: - rm -f klibc.config klcc - -local-spotless: local-clean - rm -f klibc.spec *~ tags - -local-install: $(CROSS)klcc - mkdir -p $(INSTALLROOT)$(bindir) - mkdir -p $(INSTALLROOT)$(mandir)/man1 - mkdir -p $(INSTALLROOT)$(SHLIBDIR) - mkdir -p $(INSTALLROOT)$(INSTALLDIR) - -rm -rf $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin - set -xe ; for d in linux scsi asm-$(ARCH) asm-generic $(ASMARCH); do \ - mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)include/$$d ; \ - for r in $(KRNLSRC)/include $(KRNLOBJ)/include $(KRNLOBJ)/include2 ; do \ - [ ! -d $$r/$$d ] || \ - cp -rfL $$r/$$d/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/$$d/. ; \ - done ; \ - done - cd $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include && ln -sf asm-$(ARCH) asm - cp -rf include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. - $(INSTALL_DATA) klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 - $(INSTALL_EXEC) $(KCROSS)klcc $(INSTALLROOT)$(bindir) - -# This does all the prep work needed to turn a freshly exported git repository -# into a release tarball tree -release: klibc.spec - rm -f maketar.sh - --include MCONFIG diff --git a/klibc/README b/klibc/README deleted file mode 100644 index eb72e1c239..0000000000 --- a/klibc/README +++ /dev/null @@ -1,21 +0,0 @@ -Please see klibc/README for build instructions and for the status of -various platforms. - - - -klibc is archived at: - - ftp://ftp.kernel.org/pub/linux/libs/klibc/ - -There is a mailing list for klibc and early-userspace issues at: - - http://www.zytor.com/mailman/listinfo/klibc/ - -There is also a cvsweb repository at: - - http://www.zytor.com/cvsweb.cgi/klibc/ - -There is no direct public CVS access yet, however, the CVS repository -is available for rsync from: - - rsync://rsync.kernel.org/pub/linux/libs/klibc/cvsroot/ diff --git a/klibc/include/alloca.h b/klibc/include/alloca.h deleted file mode 100644 index 41a4d94d44..0000000000 --- a/klibc/include/alloca.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * alloca.h - * - * Just call the builtin alloca() function - */ - -#ifndef _ALLOCA_H -#define _ALLOCA_H - -#define alloca(size) __builtin_alloca(size) - -#endif /* _ALLOCA_H */ - diff --git a/klibc/include/arch/alpha/klibc/archsetjmp.h b/klibc/include/arch/alpha/klibc/archsetjmp.h deleted file mode 100644 index 9dc570a6f5..0000000000 --- a/klibc/include/arch/alpha/klibc/archsetjmp.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * arch/alpha/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __s0; - unsigned long __s1; - unsigned long __s2; - unsigned long __s3; - unsigned long __s4; - unsigned long __s5; - unsigned long __fp; - unsigned long __ra; - unsigned long __gp; - unsigned long __sp; - - unsigned long __f2; - unsigned long __f3; - unsigned long __f4; - unsigned long __f5; - unsigned long __f6; - unsigned long __f7; - unsigned long __f8; - unsigned long __f9; -}; - -/* Must be an array so it will decay to a pointer when a function is called */ -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/alpha/klibc/archsignal.h b/klibc/include/arch/alpha/klibc/archsignal.h deleted file mode 100644 index b870a05131..0000000000 --- a/klibc/include/arch/alpha/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/alpha/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/alpha/klibc/archstat.h b/klibc/include/arch/alpha/klibc/archstat.h deleted file mode 100644 index 23302d737d..0000000000 --- a/klibc/include/arch/alpha/klibc/archstat.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -struct stat { - unsigned long st_dev; - unsigned long st_ino; - unsigned long st_rdev; - long st_size; - unsigned long st_blocks; - - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int st_blksize; - unsigned int st_nlink; - unsigned int __pad0; - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - long __unused[3]; -}; - -#endif diff --git a/klibc/include/arch/alpha/klibc/archsys.h b/klibc/include/arch/alpha/klibc/archsys.h deleted file mode 100644 index 16ed658987..0000000000 --- a/klibc/include/arch/alpha/klibc/archsys.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * arch/alpha/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* Alpha has some bizarre Tru64-derived system calls which return two - different values in $0 and $20(!), respectively. The standard - macros can't deal with these; even the ones that give the right - return value have the wrong clobbers. */ - -#define _syscall0_dual0(type, name) \ -type name(void) \ -{ \ - long _sc_ret, _sc_err; \ - { \ - register long _sc_0 __asm__("$0"); \ - register long _sc_19 __asm__("$19"); \ - register long _sc_20 __asm__("$20"); \ - \ - _sc_0 = __NR_##name; \ - __asm__("callsys" \ - : "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \ - : "0"(_sc_0) \ - : _syscall_clobbers); \ - _sc_ret = _sc_0, _sc_err = _sc_19; (void)(_sc_20); \ - } \ - _syscall_return(type); \ -} - -#define _syscall0_dual1(type, name) \ -type name(void) \ -{ \ - long _sc_ret, _sc_err; \ - { \ - register long _sc_0 __asm__("$0"); \ - register long _sc_19 __asm__("$19"); \ - register long _sc_20 __asm__("$20"); \ - \ - _sc_0 = __NR_##name; \ - __asm__("callsys" \ - : "=r"(_sc_0), "=r"(_sc_19), "=r" (_sc_20) \ - : "0"(_sc_0) \ - : _syscall_clobbers); \ - _sc_ret = _sc_20, _sc_err = _sc_19; (void)(_sc_0); \ - } \ - _syscall_return(type); \ -} - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/alpha/machine/asm.h b/klibc/include/arch/alpha/machine/asm.h deleted file mode 100644 index e22db90412..0000000000 --- a/klibc/include/arch/alpha/machine/asm.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * machine/asm.h - */ - -#ifndef _MACHINE_ASM_H -#define _MACHINE_ASM_H - -/* Standard aliases for Alpha register names */ - -#define v0 $0 -#define t0 $1 -#define t1 $2 -#define t2 $3 -#define t3 $4 -#define t4 $5 -#define t5 $6 -#define t6 $7 -#define t7 $8 -#define s0 $9 -#define s1 $10 -#define s2 $11 -#define s3 $12 -#define s4 $13 -#define s5 $14 -#define fp $15 -#define a0 $16 -#define a1 $17 -#define a2 $18 -#define a3 $19 -#define a4 $20 -#define a5 $21 -#define t8 $22 -#define t9 $23 -#define t10 $24 -#define t11 $25 -#define ra $26 -#define t12 $27 /* t12 and pv are both used for $27 */ -#define pv $27 /* t12 and pv are both used for $27 */ -#define at $28 -#define gp $29 -#define sp $30 -#define zero $31 - -#endif /* _MACHINE_ASM_H */ diff --git a/klibc/include/arch/arm/klibc/archsetjmp.h b/klibc/include/arch/arm/klibc/archsetjmp.h deleted file mode 100644 index c956b50a90..0000000000 --- a/klibc/include/arch/arm/klibc/archsetjmp.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * arch/i386/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned int regs[10]; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/arm/klibc/archsignal.h b/klibc/include/arch/arm/klibc/archsignal.h deleted file mode 100644 index 77685e62f0..0000000000 --- a/klibc/include/arch/arm/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/arm/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/arm/klibc/archstat.h b/klibc/include/arch/arm/klibc/archstat.h deleted file mode 100644 index 42b1409f67..0000000000 --- a/klibc/include/arch/arm/klibc/archstat.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#include - -#define _STATBUF_ST_NSEC - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - * Note: The kernel zero's the padded region because glibc might read them - * in the hope that the kernel has stretched to using larger sizes. - */ -struct stat { - unsigned long long st_dev; - unsigned char __pad0[4]; - - unsigned long __st_ino; - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned long long st_rdev; - unsigned char __pad3[4]; - - long long st_size; - unsigned long st_blksize; - -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned long __pad4; /* Future possible st_blocks hi bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ -#else /* Must be little */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - unsigned long __pad4; /* Future possible st_blocks hi bits */ -#endif - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - - unsigned long long st_ino; -}; - -#endif diff --git a/klibc/include/arch/arm/klibc/archsys.h b/klibc/include/arch/arm/klibc/archsys.h deleted file mode 100644 index dfdc70a6de..0000000000 --- a/klibc/include/arch/arm/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/cris/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/cris/klibc/archsetjmp.h b/klibc/include/arch/cris/klibc/archsetjmp.h deleted file mode 100644 index 8d20800609..0000000000 --- a/klibc/include/arch/cris/klibc/archsetjmp.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * arch/cris/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __r0; - unsigned long __r1; - unsigned long __r2; - unsigned long __r3; - unsigned long __r4; - unsigned long __r5; - unsigned long __r6; - unsigned long __r7; - unsigned long __r8; - unsigned long __sp; - unsigned long __srp; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/cris/klibc/archsignal.h b/klibc/include/arch/cris/klibc/archsignal.h deleted file mode 100644 index 73b2e196c9..0000000000 --- a/klibc/include/arch/cris/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/cris/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/cris/klibc/archstat.h b/klibc/include/arch/cris/klibc/archstat.h deleted file mode 100644 index 154820755f..0000000000 --- a/klibc/include/arch/cris/klibc/archstat.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat { - unsigned long long st_dev; - unsigned char __pad0[4]; - - unsigned long __st_ino; - - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned long long st_rdev; - unsigned char __pad3[4]; - - long long st_size; - unsigned long st_blksize; - - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - unsigned long __pad4; /* future possible st_blocks high bits */ - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - - unsigned long long st_ino; -}; - -#endif diff --git a/klibc/include/arch/cris/klibc/archsys.h b/klibc/include/arch/cris/klibc/archsys.h deleted file mode 100644 index dfdc70a6de..0000000000 --- a/klibc/include/arch/cris/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/cris/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/i386/klibc/archsetjmp.h b/klibc/include/arch/i386/klibc/archsetjmp.h deleted file mode 100644 index db04314b8c..0000000000 --- a/klibc/include/arch/i386/klibc/archsetjmp.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * arch/i386/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned int __ebx; - unsigned int __esp; - unsigned int __ebp; - unsigned int __esi; - unsigned int __edi; - unsigned int __eip; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/i386/klibc/archsignal.h b/klibc/include/arch/i386/klibc/archsignal.h deleted file mode 100644 index b092ba6d3a..0000000000 --- a/klibc/include/arch/i386/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/i386/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/i386/klibc/archstat.h b/klibc/include/arch/i386/klibc/archstat.h deleted file mode 100644 index 154820755f..0000000000 --- a/klibc/include/arch/i386/klibc/archstat.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat { - unsigned long long st_dev; - unsigned char __pad0[4]; - - unsigned long __st_ino; - - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned long long st_rdev; - unsigned char __pad3[4]; - - long long st_size; - unsigned long st_blksize; - - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - unsigned long __pad4; /* future possible st_blocks high bits */ - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - - unsigned long long st_ino; -}; - -#endif diff --git a/klibc/include/arch/i386/klibc/archsys.h b/klibc/include/arch/i386/klibc/archsys.h deleted file mode 100644 index dfdc70a6de..0000000000 --- a/klibc/include/arch/i386/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/cris/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/i386/klibc/diverr.h b/klibc/include/arch/i386/klibc/diverr.h deleted file mode 100644 index 410aba06d3..0000000000 --- a/klibc/include/arch/i386/klibc/diverr.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/i386/include/klibc/diverr.h - */ - -#ifndef _KLIBC_DIVERR_H -#define _KLIBC_DIVERR_H - -#include - -static __inline__ void -__divide_error(void) -{ - asm volatile("divl %0" :: "rm" (0) : "eax", "edx"); -} - -#endif /* _KLIBC_DIVERR_H */ diff --git a/klibc/include/arch/i386/sys/io.h b/klibc/include/arch/i386/sys/io.h deleted file mode 100644 index b051464dfc..0000000000 --- a/klibc/include/arch/i386/sys/io.h +++ /dev/null @@ -1,126 +0,0 @@ -#ident "$Id: io.h,v 1.2 2004/01/25 07:49:39 hpa Exp $" -/* ----------------------------------------------------------------------- * - * - * Copyright 2004 H. Peter Anvin - All Rights Reserved - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall - * be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * ----------------------------------------------------------------------- */ - -/* - * sys/io.h for the i386 architecture - * - * Basic I/O macros - */ - -#ifndef _SYS_IO_H -#define _SYS_IO_H 1 - -/* I/O-related system calls */ - -int iopl(int); -int ioperm(unsigned long, unsigned long, int); - -/* Basic I/O macros */ - -static __inline__ void -outb(unsigned char __v, unsigned short __p) -{ - asm volatile("outb %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ void -outw(unsigned short __v, unsigned short __p) -{ - asm volatile("outw %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ void -outl(unsigned int __v, unsigned short __p) -{ - asm volatile("outl %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ unsigned char -inb(unsigned short __p) -{ - unsigned char __v; - asm volatile("inb %1,%0" : "=a" (__v) : "dN" (__p)); - return __v; -} - -static __inline__ unsigned short -inw(unsigned short __p) -{ - unsigned short __v; - asm volatile("inw %1,%0" : "=a" (__v) : "dN" (__p)); - return __v; -} - -static __inline__ unsigned int -inl(unsigned short __p) -{ - unsigned int __v; - asm volatile("inl %1,%0" : "=a" (__v) : "dN" (__p)); - return __v; -} - -/* String I/O macros */ - -static __inline__ void -outsb (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsb" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -outsw (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsw" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -outsl (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsl" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - - -static __inline__ void -insb (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insb" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -insw (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insw" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -insl (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insl" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -#endif /* _SYS_IO_H */ diff --git a/klibc/include/arch/i386/sys/vm86.h b/klibc/include/arch/i386/sys/vm86.h deleted file mode 100644 index d3272393dc..0000000000 --- a/klibc/include/arch/i386/sys/vm86.h +++ /dev/null @@ -1,41 +0,0 @@ -#ident "$Id: vm86.h,v 1.1 2004/01/25 01:34:28 hpa Exp $" -/* ----------------------------------------------------------------------- * - * - * Copyright 2004 H. Peter Anvin - All Rights Reserved - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall - * be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * ----------------------------------------------------------------------- */ - -/* - * sys/vm86.h for i386 - */ - -#ifndef _SYS_VM86_H -#define _SYS_VM86_H 1 - -#include - -/* Actual system call */ -int vm86(struct vm86_struct *); - -#endif diff --git a/klibc/include/arch/ia64/klibc/archsetjmp.h b/klibc/include/arch/ia64/klibc/archsetjmp.h deleted file mode 100644 index bd639c0b00..0000000000 --- a/klibc/include/arch/ia64/klibc/archsetjmp.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * arch/ia64/include/klibc/archsetjmp.h - * - * Code borrowed from the FreeBSD kernel. - * - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -/* User code must not depend on the internal representation of jmp_buf. */ -#define _JBLEN 0x200 - -/* guaranteed 128-bit alignment! */ -typedef char jmp_buf[_JBLEN] __attribute__ ((aligned (16))); - -#endif diff --git a/klibc/include/arch/ia64/klibc/archsignal.h b/klibc/include/arch/ia64/klibc/archsignal.h deleted file mode 100644 index 5b01f19bc2..0000000000 --- a/klibc/include/arch/ia64/klibc/archsignal.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * arch/ia64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions. - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -#define _NSIG 64 -#define _NSIG_BPW 64 -#define _NSIG_WORDS (_NSIG / _NSIG_BPW) - -typedef struct { - unsigned long sig[_NSIG_WORDS]; -} sigset_t; - -struct sigaction { - union { - __sighandler_t _sa_handler; - void (*_sa_sigaction)(int, struct siginfo *, void *); - } _u; - sigset_t sa_mask; - int sa_flags; -}; - -#define sa_handler _u._sa_handler -#define sa_sigaction _u._sa_sigaction - -#endif diff --git a/klibc/include/arch/ia64/klibc/archstat.h b/klibc/include/arch/ia64/klibc/archstat.h deleted file mode 100644 index 9475c0b797..0000000000 --- a/klibc/include/arch/ia64/klibc/archstat.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -struct stat { - unsigned long st_dev; - unsigned long st_ino; - unsigned long st_nlink; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad0; - unsigned long st_rdev; - unsigned long st_size; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long st_blksize; - long st_blocks; - unsigned long __unused[3]; -}; - -#endif diff --git a/klibc/include/arch/ia64/klibc/archsys.h b/klibc/include/arch/ia64/klibc/archsys.h deleted file mode 100644 index 4c795a43ca..0000000000 --- a/klibc/include/arch/ia64/klibc/archsys.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * arch/ia64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -#define __IA64_BREAK "break 0x100000;;\n\t" - -#define _syscall0(type,name) \ -type \ -name (void) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15) \ - : "2" (_r15) ASM_ARGS_0 \ - : "memory" ASM_CLOBBERS_0); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return (type)_retval; \ -} - -#define _syscall1(type,name,type1,arg1) \ -type \ -name (type1 arg1) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_1(arg1); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_1 \ - : "2" (_r15) ASM_ARGS_1 \ - : "memory" ASM_CLOBBERS_1); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return (type)_retval; \ -} - -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type \ -name (type1 arg1, type2 arg2) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_2(arg1, arg2); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_2 \ - : "2" (_r15) ASM_ARGS_2 \ - : "memory" ASM_CLOBBERS_2); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return (type)_retval; \ -} - -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type \ -name (type1 arg1, type2 arg2, type3 arg3) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_3(arg1, arg2, arg3); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_3 \ - : "2" (_r15) ASM_ARGS_3 \ - : "memory" ASM_CLOBBERS_3); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return (type)_retval; \ -} - -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type \ -name (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_4(arg1, arg2, arg3, arg4); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_4 \ - : "2" (_r15) ASM_ARGS_4 \ - : "memory" ASM_CLOBBERS_4); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return (type)_retval; \ -} - -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ -type \ -name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_5(arg1, arg2, arg3, arg4, arg5); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_5 \ - : "2" (_r15) ASM_ARGS_5 \ - : "memory" ASM_CLOBBERS_5); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return (type)_retval; \ -} - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5,type6,arg6) \ -type \ -name (type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5, type6 arg6) \ -{ \ - register long _r8 asm ("r8"); \ - register long _r10 asm ("r10"); \ - register long _r15 asm ("r15") = __NR_##name; \ - long _retval; \ - LOAD_ARGS_6(arg1, arg2, arg3, arg4, arg5, arg6); \ - __asm __volatile (__IA64_BREAK \ - : "=r" (_r8), "=r" (_r10), "=r" (_r15), \ - ASM_OUTARGS_6 \ - : "2" (_r15) ASM_ARGS_6 \ - : "memory" ASM_CLOBBERS_6); \ - _retval = _r8; \ - if (_r10 == -1) { \ - errno = (_retval); \ - _retval = -1; \ - } \ - return (type)_retval; \ -} - - -#define LOAD_ARGS_0() do { } while (0) -#define LOAD_ARGS_1(out0) \ - register long _out0 asm ("out0") = (long) (out0); \ - LOAD_ARGS_0 () -#define LOAD_ARGS_2(out0, out1) \ - register long _out1 asm ("out1") = (long) (out1); \ - LOAD_ARGS_1 (out0) -#define LOAD_ARGS_3(out0, out1, out2) \ - register long _out2 asm ("out2") = (long) (out2); \ - LOAD_ARGS_2 (out0, out1) -#define LOAD_ARGS_4(out0, out1, out2, out3) \ - register long _out3 asm ("out3") = (long) (out3); \ - LOAD_ARGS_3 (out0, out1, out2) -#define LOAD_ARGS_5(out0, out1, out2, out3, out4) \ - register long _out4 asm ("out4") = (long) (out4); \ - LOAD_ARGS_4 (out0, out1, out2, out3) -#define LOAD_ARGS_6(out0, out1, out2, out3, out4, out5) \ - register long _out5 asm ("out5") = (long) (out5); \ - LOAD_ARGS_5 (out0, out1, out2, out3, out4) - -#define ASM_OUTARGS_1 "=r" (_out0) -#define ASM_OUTARGS_2 ASM_OUTARGS_1, "=r" (_out1) -#define ASM_OUTARGS_3 ASM_OUTARGS_2, "=r" (_out2) -#define ASM_OUTARGS_4 ASM_OUTARGS_3, "=r" (_out3) -#define ASM_OUTARGS_5 ASM_OUTARGS_4, "=r" (_out4) -#define ASM_OUTARGS_6 ASM_OUTARGS_5, "=r" (_out5) - -#define ASM_ARGS_0 -#define ASM_ARGS_1 ASM_ARGS_0, "3" (_out0) -#define ASM_ARGS_2 ASM_ARGS_1, "4" (_out1) -#define ASM_ARGS_3 ASM_ARGS_2, "5" (_out2) -#define ASM_ARGS_4 ASM_ARGS_3, "6" (_out3) -#define ASM_ARGS_5 ASM_ARGS_4, "7" (_out4) -#define ASM_ARGS_6 ASM_ARGS_5, "8" (_out5) - -#define ASM_CLOBBERS_0 ASM_CLOBBERS_1, "out0" -#define ASM_CLOBBERS_1 ASM_CLOBBERS_2, "out1" -#define ASM_CLOBBERS_2 ASM_CLOBBERS_3, "out2" -#define ASM_CLOBBERS_3 ASM_CLOBBERS_4, "out3" -#define ASM_CLOBBERS_4 ASM_CLOBBERS_5, "out4" -#define ASM_CLOBBERS_5 ASM_CLOBBERS_6, "out5" -#define ASM_CLOBBERS_6 , "out6", "out7", \ - /* Non-stacked integer registers, minus r8, r10, r15. */ \ - "r2", "r3", "r9", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \ - "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \ - "r28", "r29", "r30", "r31", \ - /* Predicate registers. */ \ - "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \ - /* Non-rotating fp registers. */ \ - "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ - /* Branch registers. */ \ - "b6", "b7" - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/m32r/klibc/archsetjmp.h b/klibc/include/arch/m32r/klibc/archsetjmp.h deleted file mode 100644 index e16a83517a..0000000000 --- a/klibc/include/arch/m32r/klibc/archsetjmp.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * arch/m32r/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __r8; - unsigned long __r9; - unsigned long __r10; - unsigned long __r11; - unsigned long __r12; - unsigned long __r13; - unsigned long __r14; - unsigned long __r15; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/m32r/klibc/archsignal.h b/klibc/include/arch/m32r/klibc/archsignal.h deleted file mode 100644 index 02596e9a1c..0000000000 --- a/klibc/include/arch/m32r/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/m32r/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/m32r/klibc/archstat.h b/klibc/include/arch/m32r/klibc/archstat.h deleted file mode 100644 index 154820755f..0000000000 --- a/klibc/include/arch/m32r/klibc/archstat.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat { - unsigned long long st_dev; - unsigned char __pad0[4]; - - unsigned long __st_ino; - - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned long long st_rdev; - unsigned char __pad3[4]; - - long long st_size; - unsigned long st_blksize; - - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - unsigned long __pad4; /* future possible st_blocks high bits */ - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - - unsigned long long st_ino; -}; - -#endif diff --git a/klibc/include/arch/m32r/klibc/archsys.h b/klibc/include/arch/m32r/klibc/archsys.h deleted file mode 100644 index 386db8b505..0000000000 --- a/klibc/include/arch/m32r/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/m32r/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/m68k/klibc/archsignal.h b/klibc/include/arch/m68k/klibc/archsignal.h deleted file mode 100644 index 714527f6b0..0000000000 --- a/klibc/include/arch/m68k/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/m68k/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/m68k/klibc/archstat.h b/klibc/include/arch/m68k/klibc/archstat.h deleted file mode 100644 index 9c0a05da09..0000000000 --- a/klibc/include/arch/m68k/klibc/archstat.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat { - unsigned long long st_dev; - unsigned char __pad1[2]; - - unsigned long __st_ino; - - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned long long st_rdev; - unsigned char __pad3[2]; - - long long st_size; - unsigned long st_blksize; - - unsigned long __pad4; /* future possible st_blocks high bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - - unsigned long long st_ino; -}; - -#endif diff --git a/klibc/include/arch/m68k/klibc/archsys.h b/klibc/include/arch/m68k/klibc/archsys.h deleted file mode 100644 index 8f6bed8e94..0000000000 --- a/klibc/include/arch/m68k/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/m68k/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/mips/klibc/archfcntl.h b/klibc/include/arch/mips/klibc/archfcntl.h deleted file mode 100644 index 54462ea69f..0000000000 --- a/klibc/include/arch/mips/klibc/archfcntl.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * arch/mips/include/klibc/archfcntl.h - * - * On MIPS, isn't usable (compiling struct stat with - * the correct definitions doesn't "just work"), so we need to provide - * our own definitions. - */ - -#ifndef _KLIBC_ARCHFCNTL_H -#define _KLIBC_ARCHFCNTL_H - -#ifdef _ASM_FCNTL_H /* We were too late! */ -# error " included before " -#endif -#define _ASM_FCNTL_H /* Keep from getting included */ - -#define O_ACCMODE 0x0003 -#define O_RDONLY 0x0000 -#define O_WRONLY 0x0001 -#define O_RDWR 0x0002 -#define O_APPEND 0x0008 -#define O_SYNC 0x0010 -#define O_NONBLOCK 0x0080 -#define O_CREAT 0x0100 -#define O_TRUNC 0x0200 -#define O_EXCL 0x0400 -#define O_NOCTTY 0x0800 -#define FASYNC 0x1000 -#define O_LARGEFILE 0x2000 -#define O_DIRECT 0x8000 -#define O_DIRECTORY 0x10000 -#define O_NOFOLLOW 0x20000 -#define O_NOATIME 0x40000 - -#define O_NDELAY O_NONBLOCK - -#define F_DUPFD 0 -#define F_GETFD 1 -#define F_SETFD 2 -#define F_GETFL 3 -#define F_SETFL 4 -#define F_GETLK 14 -#define F_SETLK 6 -#define F_SETLKW 7 - -#define F_SETOWN 24 -#define F_GETOWN 23 -#define F_SETSIG 10 -#define F_GETSIG 11 - -#define F_GETLK64 33 -#define F_SETLK64 34 -#define F_SETLKW64 35 - -#define FD_CLOEXEC 1 - -#define F_RDLCK 0 -#define F_WRLCK 1 -#define F_UNLCK 2 - -#define F_EXLCK 4 -#define F_SHLCK 8 - -#define F_INPROGRESS 16 - -#define LOCK_SH 1 -#define LOCK_EX 2 -#define LOCK_NB 4 -#define LOCK_UN 8 - -#define LOCK_MAND 32 -#define LOCK_READ 64 -#define LOCK_WRITE 128 -#define LOCK_RW 192 - -typedef struct flock { - short l_type; - short l_whence; - loff_t l_start; - loff_t l_len; - pid_t l_pid; -} flock_t; - -#define F_LINUX_SPECIFIC_BASE 1024 - -#endif /* _KLIBC_ARCHFCNTL_H */ - diff --git a/klibc/include/arch/mips/klibc/archsetjmp.h b/klibc/include/arch/mips/klibc/archsetjmp.h deleted file mode 100644 index 40e5be2736..0000000000 --- a/klibc/include/arch/mips/klibc/archsetjmp.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * arch/mips/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __s0; - unsigned long __s1; - unsigned long __s2; - unsigned long __s3; - unsigned long __s4; - unsigned long __s5; - unsigned long __s6; - unsigned long __s7; - unsigned long __gp; - unsigned long __sp; - unsigned long __s8; - unsigned long __ra; - unsigned long __f20; - unsigned long __f21; - unsigned long __f22; - unsigned long __f23; - unsigned long __f24; - unsigned long __f25; - unsigned long __f26; - unsigned long __f27; - unsigned long __f28; - unsigned long __f29; - unsigned long __f30; - unsigned long __f31; - unsigned long __fcr31; - unsigned long __unused; -} __attribute__((aligned(8))); - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/mips/klibc/archsignal.h b/klibc/include/arch/mips/klibc/archsignal.h deleted file mode 100644 index 3b72908636..0000000000 --- a/klibc/include/arch/mips/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/mips/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/mips/klibc/archstat.h b/klibc/include/arch/mips/klibc/archstat.h deleted file mode 100644 index 612bbfa85b..0000000000 --- a/klibc/include/arch/mips/klibc/archstat.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -/* - * This matches struct stat64 in glibc2.1, hence the absolutely insane - * amounts of padding around dev_t's. The memory layout is the same as of - * struct stat of the 64-bit kernel. - */ - -struct stat { - unsigned long st_dev; - unsigned long st_pad0[3]; /* Reserved for st_dev expansion */ - - unsigned long long st_ino; - - mode_t st_mode; - nlink_t st_nlink; - - uid_t st_uid; - gid_t st_gid; - - unsigned long st_rdev; - unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */ - - long long st_size; - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - - unsigned long st_blksize; - unsigned long st_pad2; - - long long st_blocks; -}; - -#endif diff --git a/klibc/include/arch/mips/klibc/archsys.h b/klibc/include/arch/mips/klibc/archsys.h deleted file mode 100644 index f696cdfaa7..0000000000 --- a/klibc/include/arch/mips/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/mips/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/mips/machine/asm.h b/klibc/include/arch/mips/machine/asm.h deleted file mode 100644 index e5239a6cef..0000000000 --- a/klibc/include/arch/mips/machine/asm.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * arch/mips/include/machine/asm.h - */ - -#ifndef _MACHINE_ASM_H -#define _MACHINE_ASM_H - -#include -#include - -#endif /* _MACHINE_ASM_H */ diff --git a/klibc/include/arch/mips/sgidefs.h b/klibc/include/arch/mips/sgidefs.h deleted file mode 100644 index eb103ace2c..0000000000 --- a/klibc/include/arch/mips/sgidefs.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * arch/mips/include/sgidefs.h - */ - -/* Some ABI constants */ - -#ifndef _SGIDEFS_H -#define _SGIDEFS_H - -#define _MIPS_ISA_MIPS1 1 -#define _MIPS_ISA_MIPS2 2 -#define _MIPS_ISA_MIPS3 3 -#define _MIPS_ISA_MIPS4 4 -#define _MIPS_ISA_MIPS5 5 - -#define _MIPS_SIM_ABI32 1 -#define _MIPS_SIM_NABI32 2 -#define _MIPS_SIM_ABI64 3 - -#endif /* _SGIDEFS_H */ diff --git a/klibc/include/arch/mips/spaces.h b/klibc/include/arch/mips/spaces.h deleted file mode 100644 index b5f530b753..0000000000 --- a/klibc/include/arch/mips/spaces.h +++ /dev/null @@ -1 +0,0 @@ -/* Included by but not actually needed */ diff --git a/klibc/include/arch/mips64/klibc/archsignal.h b/klibc/include/arch/mips64/klibc/archsignal.h deleted file mode 100644 index 56b0fd323e..0000000000 --- a/klibc/include/arch/mips64/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/mips64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/mips64/klibc/archstat.h b/klibc/include/arch/mips64/klibc/archstat.h deleted file mode 100644 index d237e3a3e8..0000000000 --- a/klibc/include/arch/mips64/klibc/archstat.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -struct stat { - unsigned int st_dev; - unsigned int st_pad0[3]; /* Reserved for st_dev expansion */ - - unsigned long st_ino; - - mode_t st_mode; - nlink_t st_nlink; - - uid_t st_uid; - gid_t st_gid; - - unsigned int st_rdev; - unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ - - off_t st_size; - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - - unsigned int st_blksize; - unsigned int st_pad2; - - unsigned long st_blocks; -}; - -#endif diff --git a/klibc/include/arch/mips64/klibc/archsys.h b/klibc/include/arch/mips64/klibc/archsys.h deleted file mode 100644 index 81e5106e16..0000000000 --- a/klibc/include/arch/mips64/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/mips64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/parisc/klibc/archsetjmp.h b/klibc/include/arch/parisc/klibc/archsetjmp.h deleted file mode 100644 index e7444983ed..0000000000 --- a/klibc/include/arch/parisc/klibc/archsetjmp.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * arch/parisc/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - double regs[21]; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/parisc/klibc/archsignal.h b/klibc/include/arch/parisc/klibc/archsignal.h deleted file mode 100644 index 3190e8528e..0000000000 --- a/klibc/include/arch/parisc/klibc/archsignal.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * arch/parisc/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -#define _NSIG 64 -#define _NSIG_SZ (_NSIG / LONG_BIT) - -typedef struct { - unsigned long sig[_NSIG_SZ]; -} sigset_t; - -struct sigaction { - __sighandler_t sa_handler; - unsigned long sa_flags; - sigset_t sa_mask; -}; - -#endif diff --git a/klibc/include/arch/parisc/klibc/archstat.h b/klibc/include/arch/parisc/klibc/archstat.h deleted file mode 100644 index 7d28f459ee..0000000000 --- a/klibc/include/arch/parisc/klibc/archstat.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -struct stat { - unsigned long long st_dev; - unsigned int __pad1; - - unsigned int __st_ino; /* Not actually filled in */ - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned long long st_rdev; - unsigned int __pad2; - signed long long st_size; - signed int st_blksize; - - signed long long st_blocks; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long long st_ino; -}; - -#endif diff --git a/klibc/include/arch/parisc/klibc/archsys.h b/klibc/include/arch/parisc/klibc/archsys.h deleted file mode 100644 index 5013ba8794..0000000000 --- a/klibc/include/arch/parisc/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/parisc/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/ppc/klibc/archsetjmp.h b/klibc/include/arch/ppc/klibc/archsetjmp.h deleted file mode 100644 index 53e2fccc3b..0000000000 --- a/klibc/include/arch/ppc/klibc/archsetjmp.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * arch/ppc/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __r2; - unsigned long __sp; - unsigned long __lr; - unsigned long __cr; - unsigned long __r13; - unsigned long __r14; - unsigned long __r15; - unsigned long __r16; - unsigned long __r17; - unsigned long __r18; - unsigned long __r19; - unsigned long __r20; - unsigned long __r21; - unsigned long __r22; - unsigned long __r23; - unsigned long __r24; - unsigned long __r25; - unsigned long __r26; - unsigned long __r27; - unsigned long __r28; - unsigned long __r29; - unsigned long __r30; - unsigned long __r31; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/ppc/klibc/archsignal.h b/klibc/include/arch/ppc/klibc/archsignal.h deleted file mode 100644 index 567a547ef9..0000000000 --- a/klibc/include/arch/ppc/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/ppc/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/ppc/klibc/archstat.h b/klibc/include/arch/ppc/klibc/archstat.h deleted file mode 100644 index 1d0487b47f..0000000000 --- a/klibc/include/arch/ppc/klibc/archstat.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -/* This matches struct stat64 in glibc2.1. - */ -struct stat { - unsigned long long st_dev; /* Device. */ - unsigned long long st_ino; /* File serial number. */ - unsigned int st_mode; /* File mode. */ - unsigned int st_nlink; /* Link count. */ - unsigned int st_uid; /* User ID of the file's owner. */ - unsigned int st_gid; /* Group ID of the file's group. */ - unsigned long long st_rdev; /* Device number, if device. */ - unsigned short int __pad2; - long long st_size; /* Size of file, in bytes. */ - long st_blksize; /* Optimal block size for I/O. */ - - long long st_blocks; /* Number 512-byte blocks allocated. */ - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ - unsigned long int __unused4; - unsigned long int __unused5; -}; - -#endif diff --git a/klibc/include/arch/ppc/klibc/archsys.h b/klibc/include/arch/ppc/klibc/archsys.h deleted file mode 100644 index 17a28859e5..0000000000 --- a/klibc/include/arch/ppc/klibc/archsys.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * arch/ppc/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* PowerPC seems to lack _syscall6() in its headers */ -/* This seems to work on both 32- and 64-bit ppc */ - -#ifndef _syscall6 - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ - unsigned long __sc_ret, __sc_err; \ - { \ - register unsigned long __sc_0 __asm__ ("r0"); \ - register unsigned long __sc_3 __asm__ ("r3"); \ - register unsigned long __sc_4 __asm__ ("r4"); \ - register unsigned long __sc_5 __asm__ ("r5"); \ - register unsigned long __sc_6 __asm__ ("r6"); \ - register unsigned long __sc_7 __asm__ ("r7"); \ - register unsigned long __sc_8 __asm__ ("r8"); \ - \ - __sc_3 = (unsigned long) (arg1); \ - __sc_4 = (unsigned long) (arg2); \ - __sc_5 = (unsigned long) (arg3); \ - __sc_6 = (unsigned long) (arg4); \ - __sc_7 = (unsigned long) (arg5); \ - __sc_8 = (unsigned long) (arg6); \ - __sc_0 = __NR_##name; \ - __asm__ __volatile__ \ - ("sc \n\t" \ - "mfcr %1 " \ - : "+r" (__sc_3), \ - "+r" (__sc_0), \ - "+r" (__sc_4), \ - "+r" (__sc_5), \ - "+r" (__sc_6), \ - "+r" (__sc_7), \ - "+r" (__sc_8) \ - : : "cr0", "ctr", "memory", \ - "r9", "r10", "r11", "r12"); \ - __sc_ret = __sc_3; \ - __sc_err = __sc_0; \ - } \ - if (__sc_err & 0x10000000) \ - { \ - errno = (int)__sc_ret; \ - __sc_ret = -1; \ - } \ - return (type)__sc_ret; \ -} - -#endif /* _syscall6() missing */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/ppc64/klibc/archsetjmp.h b/klibc/include/arch/ppc64/klibc/archsetjmp.h deleted file mode 100644 index 006a2e27be..0000000000 --- a/klibc/include/arch/ppc64/klibc/archsetjmp.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * arch/ppc64/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __r2; - unsigned long __sp; - unsigned long __lr; - unsigned long __cr; - unsigned long __r13; - unsigned long __r14; - unsigned long __r15; - unsigned long __r16; - unsigned long __r17; - unsigned long __r18; - unsigned long __r19; - unsigned long __r20; - unsigned long __r21; - unsigned long __r22; - unsigned long __r23; - unsigned long __r24; - unsigned long __r25; - unsigned long __r26; - unsigned long __r27; - unsigned long __r28; - unsigned long __r29; - unsigned long __r30; - unsigned long __r31; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/ppc64/klibc/archsignal.h b/klibc/include/arch/ppc64/klibc/archsignal.h deleted file mode 100644 index 8452f6e4bc..0000000000 --- a/klibc/include/arch/ppc64/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/ppc64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/ppc64/klibc/archstat.h b/klibc/include/arch/ppc64/klibc/archstat.h deleted file mode 100644 index 71f4748690..0000000000 --- a/klibc/include/arch/ppc64/klibc/archstat.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -struct stat { - unsigned long st_dev; - ino_t st_ino; - nlink_t st_nlink; - mode_t st_mode; - uid_t st_uid; - gid_t st_gid; - unsigned long st_rdev; - off_t st_size; - unsigned long st_blksize; - unsigned long st_blocks; - struct timespec st_atim; /* Time of last access. */ - struct timespec st_mtim; /* Time of last modification. */ - struct timespec st_ctim; /* Time of last status change. */ - unsigned long __unused4; - unsigned long __unused5; - unsigned long __unused6; -}; - -#endif diff --git a/klibc/include/arch/ppc64/klibc/archsys.h b/klibc/include/arch/ppc64/klibc/archsys.h deleted file mode 100644 index 4f81fee00d..0000000000 --- a/klibc/include/arch/ppc64/klibc/archsys.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * arch/ppc64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -#ifndef _syscall6 - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ - unsigned long __sc_ret, __sc_err; \ - { \ - register unsigned long __sc_0 __asm__ ("r0"); \ - register unsigned long __sc_3 __asm__ ("r3"); \ - register unsigned long __sc_4 __asm__ ("r4"); \ - register unsigned long __sc_5 __asm__ ("r5"); \ - register unsigned long __sc_6 __asm__ ("r6"); \ - register unsigned long __sc_7 __asm__ ("r7"); \ - register unsigned long __sc_8 __asm__ ("r8"); \ - \ - __sc_3 = (unsigned long) (arg1); \ - __sc_4 = (unsigned long) (arg2); \ - __sc_5 = (unsigned long) (arg3); \ - __sc_6 = (unsigned long) (arg4); \ - __sc_7 = (unsigned long) (arg5); \ - __sc_8 = (unsigned long) (arg6); \ - __sc_0 = __NR_##name; \ - __asm__ __volatile__ \ - ("sc \n\t" \ - "mfcr %1 " \ - : "=&r" (__sc_3), "=&r" (__sc_0) \ - : "0" (__sc_3), "1" (__sc_0), \ - "r" (__sc_4), \ - "r" (__sc_5), \ - "r" (__sc_6), \ - "r" (__sc_7), \ - "r" (__sc_8) \ - : __syscall_clobbers); \ - __sc_ret = __sc_3; \ - __sc_err = __sc_0; \ - } \ - __syscall_return (type); \ -} - -#endif /* _syscall6() missing */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/s390/klibc/archsetjmp.h b/klibc/include/arch/s390/klibc/archsetjmp.h deleted file mode 100644 index 11a641ed5a..0000000000 --- a/klibc/include/arch/s390/klibc/archsetjmp.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * arch/s390/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - uint32_t __gregs[10]; /* general registers r6-r15 */ - uint64_t __fpregs[2]; /* fp registers f4 and f6 */ -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/s390/klibc/archsignal.h b/klibc/include/arch/s390/klibc/archsignal.h deleted file mode 100644 index 1f8de28b4b..0000000000 --- a/klibc/include/arch/s390/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/s390/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/s390/klibc/archstat.h b/klibc/include/arch/s390/klibc/archstat.h deleted file mode 100644 index 866c3d4f4c..0000000000 --- a/klibc/include/arch/s390/klibc/archstat.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat { - unsigned long long st_dev; - unsigned int __pad1; -#define STAT64_HAS_BROKEN_ST_INO 1 - unsigned long __st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned long st_uid; - unsigned long st_gid; - unsigned long long st_rdev; - unsigned int __pad3; - long long st_size; - unsigned long st_blksize; - unsigned char __pad4[4]; - unsigned long __pad5; /* future possible st_blocks high bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long long st_ino; -}; - -#endif diff --git a/klibc/include/arch/s390/klibc/archsys.h b/klibc/include/arch/s390/klibc/archsys.h deleted file mode 100644 index 1cd0948f3c..0000000000 --- a/klibc/include/arch/s390/klibc/archsys.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * arch/s390/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* S/390 only has five syscall parameters, and uses a structure for - 6-argument syscalls. */ - -#ifndef _syscall6 - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,\ - type4,arg4,type5,arg5,type6,arg6) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ - type5 arg5, type6 arg6) { \ - unsigned long __arg[6] = { \ - (unsigned long) arg1, \ - (unsigned long) arg2, \ - (unsigned long) arg3, \ - (unsigned long) arg4, \ - (unsigned long) arg5, \ - (unsigned long) arg6 \ - }; \ - register void *__argp asm("2") = &__arg; \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - " lr %0,2" \ - : "=d" (__res) \ - : "i" (__NR_##name), \ - "d" (__argp) \ - : _svc_clobber); \ - __syscall_return(type, __res); \ -} - -#endif /* _syscall6() missing */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/s390x/klibc/archsetjmp.h b/klibc/include/arch/s390x/klibc/archsetjmp.h deleted file mode 100644 index dd3ed0d47c..0000000000 --- a/klibc/include/arch/s390x/klibc/archsetjmp.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * arch/s390x/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - uint64_t __gregs[10]; /* general registers r6-r15 */ - uint64_t __fpregs[4]; /* fp registers f1, f3, f5, f7 */ -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/s390x/klibc/archsignal.h b/klibc/include/arch/s390x/klibc/archsignal.h deleted file mode 100644 index 08c9a0073a..0000000000 --- a/klibc/include/arch/s390x/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/s390x/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/s390x/klibc/archstat.h b/klibc/include/arch/s390x/klibc/archstat.h deleted file mode 100644 index 0de73cb2b6..0000000000 --- a/klibc/include/arch/s390x/klibc/archstat.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -struct stat { - unsigned long st_dev; - unsigned long st_ino; - unsigned long st_nlink; - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad1; - unsigned long st_rdev; - unsigned long st_size; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - unsigned long st_blksize; - long st_blocks; - unsigned long __unused[3]; -}; - -#endif diff --git a/klibc/include/arch/s390x/klibc/archsys.h b/klibc/include/arch/s390x/klibc/archsys.h deleted file mode 100644 index 15f7113bb4..0000000000 --- a/klibc/include/arch/s390x/klibc/archsys.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * arch/s390x/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* S/390X only has five syscall parameters, and uses a structure for - 6-argument syscalls. */ - -#ifndef _syscall6 - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,\ - type4,arg4,type5,arg5,type6,arg6) \ -type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ - type5 arg5, type6 arg6) { \ - unsigned long __arg[6] = { \ - (unsigned long) arg1, \ - (unsigned long) arg2, \ - (unsigned long) arg3, \ - (unsigned long) arg4, \ - (unsigned long) arg5, \ - (unsigned long) arg6 \ - }; \ - register void *__argp asm("2") = &__arg; \ - long __res; \ - __asm__ __volatile__ ( \ - " svc %b1\n" \ - " lgr %0,2" \ - : "=d" (__res) \ - : "i" (__NR_##name), \ - "d" (__argp) \ - : _svc_clobber); \ - __syscall_return(type, __res); \ -} - -#endif /* _syscall6() missing */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/sh/klibc/archsetjmp.h b/klibc/include/arch/sh/klibc/archsetjmp.h deleted file mode 100644 index 28dd932fbc..0000000000 --- a/klibc/include/arch/sh/klibc/archsetjmp.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * arch/sh/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long r8; - unsigned long r9; - unsigned long r10; - unsigned long r11; - unsigned long r12; - unsigned long r13; - unsigned long r14; - unsigned long r15; - unsigned long pr; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/include/arch/sh/klibc/archsignal.h b/klibc/include/arch/sh/klibc/archsignal.h deleted file mode 100644 index 6c4e5976ad..0000000000 --- a/klibc/include/arch/sh/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/sh/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/sh/klibc/archstat.h b/klibc/include/arch/sh/klibc/archstat.h deleted file mode 100644 index 73caceb593..0000000000 --- a/klibc/include/arch/sh/klibc/archstat.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#include - -#define _STATBUF_ST_NSEC - -/* This matches struct stat64 in glibc2.1, hence the absolutely - * insane amounts of padding around dev_t's. - */ -struct stat64 { - unsigned long long st_dev; - unsigned char __pad0[4]; - - unsigned long st_ino; - unsigned int st_mode; - unsigned int st_nlink; - - unsigned long st_uid; - unsigned long st_gid; - - unsigned long long st_rdev; - unsigned char __pad3[4]; - - long long st_size; - unsigned long st_blksize; - -#if __BYTE_ORDER == __BIG_ENDIAN - unsigned long __pad4; /* Future possible st_blocks hi bits */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ -#else /* Must be little */ - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ - unsigned long __pad4; /* Future possible st_blocks hi bits */ -#endif - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - - unsigned long __unused1; - unsigned long __unused2; -}; - -#endif - diff --git a/klibc/include/arch/sh/klibc/archsys.h b/klibc/include/arch/sh/klibc/archsys.h deleted file mode 100644 index 5f8050a536..0000000000 --- a/klibc/include/arch/sh/klibc/archsys.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * arch/sh/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* No special syscall definitions for this architecture */ - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/sparc/klibc/archsetjmp.h b/klibc/include/arch/sparc/klibc/archsetjmp.h deleted file mode 100644 index 92c1c74c9d..0000000000 --- a/klibc/include/arch/sparc/klibc/archsetjmp.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/sparc/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __sp; - unsigned long __fp; - unsigned long __pc; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/sparc/klibc/archsignal.h b/klibc/include/arch/sparc/klibc/archsignal.h deleted file mode 100644 index 3be67a2158..0000000000 --- a/klibc/include/arch/sparc/klibc/archsignal.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * arch/sparc/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* Hidden definitions */ - -struct __new_sigaction { - __sighandler_t sa_handler; - unsigned long sa_flags; - void (*sa_restorer)(void); /* Not used by Linux/SPARC */ - __new_sigset_t sa_mask; -}; - -struct k_sigaction { - struct __new_sigaction sa; - void __user *ka_restorer; -}; - -struct __old_sigaction { - __sighandler_t sa_handler; - __old_sigset_t sa_mask; - unsigned long sa_flags; - void (*sa_restorer) (void); /* not used by Linux/SPARC */ -}; - -typedef struct sigaltstack { - void __user *ss_sp; - int ss_flags; - size_t ss_size; -} stack_t; - -#endif diff --git a/klibc/include/arch/sparc/klibc/archstat.h b/klibc/include/arch/sparc/klibc/archstat.h deleted file mode 100644 index 0ff68785e5..0000000000 --- a/klibc/include/arch/sparc/klibc/archstat.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -struct stat { - unsigned long long st_dev; - - unsigned long long st_ino; - - unsigned int st_mode; - unsigned int st_nlink; - - unsigned int st_uid; - unsigned int st_gid; - - unsigned long long st_rdev; - - unsigned char __pad3[8]; - - long long st_size; - unsigned int st_blksize; - - unsigned char __pad4[8]; - unsigned int st_blocks; - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - - unsigned int __unused4; - unsigned int __unused5; -}; - -#endif diff --git a/klibc/include/arch/sparc/klibc/archsys.h b/klibc/include/arch/sparc/klibc/archsys.h deleted file mode 100644 index 20de8a8b44..0000000000 --- a/klibc/include/arch/sparc/klibc/archsys.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * arch/sparc/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/sparc/machine/asm.h b/klibc/include/arch/sparc/machine/asm.h deleted file mode 100644 index b622bd8cf1..0000000000 --- a/klibc/include/arch/sparc/machine/asm.h +++ /dev/null @@ -1,192 +0,0 @@ -/* $NetBSD: asm.h,v 1.14 2002/07/20 08:37:30 mrg Exp $ */ - -/* - * Copyright (c) 1994 Allen Briggs - * All rights reserved. - * - * Gleaned from locore.s and sun3 asm.h which had the following copyrights: - * locore.s: - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1990 The Regents of the University of California. - * sun3/include/asm.h: - * Copyright (c) 1993 Adam Glass - * Copyright (c) 1990 The Regents of the University of California. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _ASM_H_ -#define _ASM_H_ - -/* Pull in CCFSZ, CC64FSZ, and BIAS from frame.h */ -#ifndef _LOCORE -#define _LOCORE -#endif -#include - -#ifdef __ELF__ -#define _C_LABEL(name) name -#else -#ifdef __STDC__ -#define _C_LABEL(name) _ ## name -#else -#define _C_LABEL(name) _/**/name -#endif -#endif -#define _ASM_LABEL(name) name - -#ifdef PIC -/* - * PIC_PROLOGUE() is akin to the compiler generated function prologue for - * PIC code. It leaves the address of the Global Offset Table in DEST, - * clobbering register TMP in the process. - * - * We can use two code sequences. We can read the %pc or use the call - * instruction that saves the pc in %o7. Call requires the branch unit and - * IEU1, and clobbers %o7 which needs to be restored. This instruction - * sequence takes about 4 cycles due to instruction interdependence. Reading - * the pc takes 4 cycles to dispatch and is always dispatched alone. That - * sequence takes 7 cycles. - */ -#ifdef __arch64__ -#define PIC_PROLOGUE(dest,tmp) \ - mov %o7, tmp; \ - sethi %hi(_GLOBAL_OFFSET_TABLE_-4),dest; \ - call 0f; \ - or dest,%lo(_GLOBAL_OFFSET_TABLE_+4),dest; \ -0: \ - add dest,%o7,dest; \ - mov tmp, %o7 -#else -#define PIC_PROLOGUE(dest,tmp) \ - mov %o7,tmp; 3: call 4f; nop; 4: \ - sethi %hi(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ - or dest,%lo(_C_LABEL(_GLOBAL_OFFSET_TABLE_)-(3b-.)),dest; \ - add dest,%o7,dest; mov tmp,%o7 -#endif - -/* - * PICCY_SET() does the equivalent of a `set var, %dest' instruction in - * a PIC-like way, but without involving the Global Offset Table. This - * only works for VARs defined in the same file *and* in the text segment. - */ -#ifdef __arch64__ -#define PICCY_SET(var,dest,tmp) \ - 3: rd %pc, tmp; add tmp,(var-3b),dest -#else -#define PICCY_SET(var,dest,tmp) \ - mov %o7,tmp; 3: call 4f; nop; 4: \ - add %o7,(var-3b),dest; mov tmp,%o7 -#endif -#else -#define PIC_PROLOGUE(dest,tmp) -#define PICCY_OFFSET(var,dest,tmp) -#endif - -#define FTYPE(x) .type x,@function -#define OTYPE(x) .type x,@object - -#define _ENTRY(name) \ - .align 4; .globl name; .proc 1; FTYPE(name); name: - -#ifdef GPROF -/* see _MCOUNT_ENTRY in profile.h */ -#ifdef __ELF__ -#ifdef __arch64__ -#define _PROF_PROLOGUE \ - .data; .align 8; 1: .uaword 0; .uaword 0; \ - .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call _mcount; \ - or %o0,%lo(1b),%o0; restore -#else -#define _PROF_PROLOGUE \ - .data; .align 4; 1: .long 0; \ - .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call _mcount; \ - or %o0,%lo(1b),%o0; restore -#endif -#else -#ifdef __arch64__ -#define _PROF_PROLOGUE \ - .data; .align 8; 1: .uaword 0; .uaword 0; \ - .text; save %sp,-CC64FSZ,%sp; sethi %hi(1b),%o0; call mcount; \ - or %o0,%lo(1b),%o0; restore -#else -#define _PROF_PROLOGUE \ - .data; .align 4; 1: .long 0; \ - .text; save %sp,-96,%sp; sethi %hi(1b),%o0; call mcount; \ - or %o0,%lo(1b),%o0; restore -#endif -#endif -#else -#define _PROF_PROLOGUE -#endif - -#define ENTRY(name) _ENTRY(_C_LABEL(name)); _PROF_PROLOGUE -#define ENTRY_NOPROFILE(name) _ENTRY(_C_LABEL(name)) -#define ASENTRY(name) _ENTRY(_ASM_LABEL(name)); _PROF_PROLOGUE -#define FUNC(name) ASENTRY(name) -#define RODATA(name) .align 4; .text; .globl _C_LABEL(name); \ - OTYPE(_C_LABEL(name)); _C_LABEL(name): - - -#define ASMSTR .asciz - -#define RCSID(name) .asciz name - -#ifdef __ELF__ -#define WEAK_ALIAS(alias,sym) \ - .weak alias; \ - alias = sym -#endif - -/* - * WARN_REFERENCES: create a warning if the specified symbol is referenced. - */ -#ifdef __ELF__ -#ifdef __STDC__ -#define WARN_REFERENCES(_sym,_msg) \ - .section .gnu.warning. ## _sym ; .ascii _msg ; .text -#else -#define WARN_REFERENCES(_sym,_msg) \ - .section .gnu.warning./**/_sym ; .ascii _msg ; .text -#endif /* __STDC__ */ -#else -#ifdef __STDC__ -#define __STRING(x) #x -#define WARN_REFERENCES(sym,msg) \ - .stabs msg ## ,30,0,0,0 ; \ - .stabs __STRING(_ ## sym) ## ,1,0,0,0 -#else -#define __STRING(x) "x" -#define WARN_REFERENCES(sym,msg) \ - .stabs msg,30,0,0,0 ; \ - .stabs __STRING(_/**/sym),1,0,0,0 -#endif /* __STDC__ */ -#endif /* __ELF__ */ - -#endif /* _ASM_H_ */ diff --git a/klibc/include/arch/sparc/machine/frame.h b/klibc/include/arch/sparc/machine/frame.h deleted file mode 100644 index b09175c7f4..0000000000 --- a/klibc/include/arch/sparc/machine/frame.h +++ /dev/null @@ -1,138 +0,0 @@ -/* $NetBSD: frame.h,v 1.4 2001/12/04 00:05:05 darrenr Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)frame.h 8.1 (Berkeley) 6/11/93 - */ - -#if defined(_KERNEL_OPT) -#include "opt_sparc_arch.h" -#endif - -/* - * Sparc stack frame format. - * - * Note that the contents of each stack frame may be held only in - * machine register windows. In order to get an accurate picture - * of the frame, you must first force the kernel to write any such - * windows to the stack. - */ -#ifndef _LOCORE -#ifndef SUN4U -struct frame { - int32_t fr_local[8]; /* space to save locals (%l0..%l7) */ - int32_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ - struct frame *fr_fp; /* space to save frame pointer (%i6) */ - int32_t fr_pc; /* space to save return pc (%i7) */ - /* - * SunOS reserves another 8 words here; this is pointless - * but we do it for compatibility. - */ - int32_t fr_xxx; /* `structure return pointer' (unused) */ - int32_t fr_argd[6]; /* `arg dump area' (lunacy) */ - int32_t fr_argx[1]; /* arg extension (args 7..n; variable size) */ -}; -#else -struct frame32 { - int32_t fr_local[8]; /* space to save locals (%l0..%l7) */ - int32_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ - u_int32_t fr_fp; /* space to save frame pointer (%i6) */ - u_int32_t fr_pc; /* space to save return pc (%i7) */ - /* - * SunOS reserves another 8 words here; this is pointless - * but we do it for compatibility. - */ - int32_t fr_xxx; /* `structure return pointer' (unused) */ - int32_t fr_argd[6]; /* `arg dump area' (lunacy) */ - int32_t fr_argx[1]; /* arg extension (args 7..n; variable size) */ -}; -#endif -#endif - -/* - * CCFSZ (C Compiler Frame SiZe) is the size of a stack frame required if - * a function is to call C code. It should be just 64, but Sun defined - * their frame with space to hold arguments 0 through 5 (plus some junk), - * and varargs routines (such as kprintf) demand this, and gcc uses this - * area at times anyway. - */ -#define CCFSZ 96 - -/* - * Sparc v9 stack frame format. - * - * Note that the contents of each stack frame may be held only in - * machine register windows. In order to get an accurate picture - * of the frame, you must first force the kernel to write any such - * windows to the stack. - * - * V9 frames have an odd bias, so you can tall a v9 frame from - * a v8 frame by testing the stack pointer's lsb. - */ -#if !defined(_LOCORE) && !defined(_LIBC) -struct frame64 { - int64_t fr_local[8]; /* space to save locals (%l0..%l7) */ - int64_t fr_arg[6]; /* space to save arguments (%i0..%i5) */ - u_int64_t fr_fp; /* space to save frame pointer (%i6) */ - u_int64_t fr_pc; /* space to save return pc (%i7) */ - /* - * SVR4 reserves a bunch of extra stuff. - */ - int64_t fr_argd[6]; /* `register save area' (lunacy) */ - int64_t fr_argx[0]; /* arg extension (args 7..n; variable size) */ -}; - -#define v9next_frame(f) ((struct frame64*)(f->fr_fp+BIAS)) -#endif - -/* - * CC64FSZ (C Compiler 64-bit Frame SiZe) is the size of a stack frame used - * by the compiler in 64-bit mode. It is (16)*8; space for 8 ins, 8 outs. - */ -#define CC64FSZ 176 - -/* - * v9 stacks all have a bias of 2047 added to the %sp and %fp, so you can easily - * detect it by testing the register for an odd value. Why 2K-1 I don't know. - */ -#define BIAS (2048-1) - diff --git a/klibc/include/arch/sparc/machine/trap.h b/klibc/include/arch/sparc/machine/trap.h deleted file mode 100644 index 42c3ef6ae2..0000000000 --- a/klibc/include/arch/sparc/machine/trap.h +++ /dev/null @@ -1,141 +0,0 @@ -/* $NetBSD: trap.h,v 1.11 1999/01/20 00:15:08 pk Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Lawrence Berkeley Laboratory. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)trap.h 8.1 (Berkeley) 6/11/93 - */ -/* - * Sun4m support by Aaron Brown, Harvard University. - * Changes Copyright (c) 1995 The President and Fellows of Harvard College. - * All rights reserved. - */ - -#ifndef _MACHINE_TRAP_H -#define _MACHINE_TRAP_H - -/* trap vec (pri) description */ -#define T_RESET 0x00 /* (1) not actually vectored; jumps to 0 */ -#define T_TEXTFAULT 0x01 /* (2) address fault during instr fetch */ -#define T_ILLINST 0x02 /* (3) illegal instruction */ -#define T_PRIVINST 0x03 /* (4) privileged instruction */ -#define T_FPDISABLED 0x04 /* (5) fp instr while fp disabled */ -#define T_WINOF 0x05 /* (6) register window overflow */ -#define T_WINUF 0x06 /* (7) register window underflow */ -#define T_ALIGN 0x07 /* (8) address not properly aligned */ -#define T_FPE 0x08 /* (9) floating point exception */ -#define T_DATAFAULT 0x09 /* (10) address fault during data fetch */ -#define T_TAGOF 0x0a /* (11) tag overflow */ -/* 0x0b unused */ -/* 0x0c unused */ -/* 0x0d unused */ -/* 0x0e unused */ -/* 0x0f unused */ -/* 0x10 unused */ -#define T_L1INT 0x11 /* (27) level 1 interrupt */ -#define T_L2INT 0x12 /* (26) level 2 interrupt */ -#define T_L3INT 0x13 /* (25) level 3 interrupt */ -#define T_L4INT 0x14 /* (24) level 4 interrupt */ -#define T_L5INT 0x15 /* (23) level 5 interrupt */ -#define T_L6INT 0x16 /* (22) level 6 interrupt */ -#define T_L7INT 0x17 /* (21) level 7 interrupt */ -#define T_L8INT 0x18 /* (20) level 8 interrupt */ -#define T_L9INT 0x19 /* (19) level 9 interrupt */ -#define T_L10INT 0x1a /* (18) level 10 interrupt */ -#define T_L11INT 0x1b /* (17) level 11 interrupt */ -#define T_L12INT 0x1c /* (16) level 12 interrupt */ -#define T_L13INT 0x1d /* (15) level 13 interrupt */ -#define T_L14INT 0x1e /* (14) level 14 interrupt */ -#define T_L15INT 0x1f /* (13) level 15 interrupt */ -/* 0x20 unused */ -/* through 0x23 unused */ -#define T_CPDISABLED 0x24 /* (5) coprocessor instr while disabled */ -#define T_UNIMPLFLUSH 0x25 /* Unimplemented FLUSH */ -/* through 0x27 unused */ -#define T_CPEXCEPTION 0x28 /* (9) coprocessor exception */ -/* 0x29 unused */ -#define T_IDIV0 0x2a /* divide by zero (from hw [su]div instr) */ -#define T_STOREBUFFAULT 0x2b /* SuperSPARC: Store buffer copy-back fault */ -/* 0x2c unused */ -/* through 0x7f unused */ - -/* beginning of `user' vectors (from trap instructions) - all priority 12 */ -#define T_SUN_SYSCALL 0x80 /* system call */ -#define T_BREAKPOINT 0x81 /* breakpoint `instruction' */ -#define T_DIV0 0x82 /* division routine was handed 0 */ -#define T_FLUSHWIN 0x83 /* flush windows */ -#define T_CLEANWIN 0x84 /* provide clean windows */ -#define T_RANGECHECK 0x85 /* ? */ -#define T_FIXALIGN 0x86 /* fix up unaligned accesses */ -#define T_INTOF 0x87 /* integer overflow ? */ -#define T_SVR4_SYSCALL 0x88 /* SVR4 system call */ -#define T_BSD_SYSCALL 0x89 /* BSD system call */ -#define T_KGDB_EXEC 0x8a /* for kernel gdb */ - -/* 0x8b..0xff are currently unallocated, except the following */ -#define T_SVR4_GETCC 0xa0 -#define T_SVR4_SETCC 0xa1 -#define T_SVR4_GETPSR 0xa2 -#define T_SVR4_SETPSR 0xa3 -#define T_SVR4_GETHRTIME 0xa4 -#define T_SVR4_GETHRVTIME 0xa5 -#define T_SVR4_GETHRESTIME 0xa7 - - -#ifdef _KERNEL /* pseudo traps for locore.s */ -#define T_RWRET -1 /* need first user window for trap return */ -#define T_AST -2 /* no-op, just needed reschedule or profile */ -#endif - -/* flags to system call (flags in %g1 along with syscall number) */ -#define SYSCALL_G2RFLAG 0x400 /* on success, return to %g2 rather than npc */ -#define SYSCALL_G7RFLAG 0x800 /* use %g7 as above (deprecated) */ - -/* - * `software trap' macros to keep people happy (sparc v8 manual says not - * to set the upper bits). - */ -#define ST_BREAKPOINT (T_BREAKPOINT & 0x7f) -#define ST_DIV0 (T_DIV0 & 0x7f) -#define ST_FLUSHWIN (T_FLUSHWIN & 0x7f) -#define ST_SYSCALL (T_SUN_SYSCALL & 0x7f) - -#endif /* _MACHINE_TRAP_H_ */ diff --git a/klibc/include/arch/sparc64/klibc/archsetjmp.h b/klibc/include/arch/sparc64/klibc/archsetjmp.h deleted file mode 100644 index 022a31e542..0000000000 --- a/klibc/include/arch/sparc64/klibc/archsetjmp.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/sparc64/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __sp; - unsigned long __fp; - unsigned long __pc; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/sparc64/klibc/archsignal.h b/klibc/include/arch/sparc64/klibc/archsignal.h deleted file mode 100644 index f81bd668bb..0000000000 --- a/klibc/include/arch/sparc64/klibc/archsignal.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/sparc64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* No special stuff for this architecture */ - -#endif diff --git a/klibc/include/arch/sparc64/klibc/archstat.h b/klibc/include/arch/sparc64/klibc/archstat.h deleted file mode 100644 index c22905d30c..0000000000 --- a/klibc/include/arch/sparc64/klibc/archstat.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -/* No nsec fields?! */ -struct stat { - unsigned st_dev; - ino_t st_ino; - mode_t st_mode; - short st_nlink; - uid_t st_uid; - gid_t st_gid; - unsigned st_rdev; - off_t st_size; - time_t st_atime; - time_t st_mtime; - time_t st_ctime; - off_t st_blksize; - off_t st_blocks; - unsigned long __unused4[2]; -}; - -#endif diff --git a/klibc/include/arch/sparc64/klibc/archsys.h b/klibc/include/arch/sparc64/klibc/archsys.h deleted file mode 100644 index 6a3a7b25bc..0000000000 --- a/klibc/include/arch/sparc64/klibc/archsys.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * arch/sparc64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/x86_64/klibc/archsetjmp.h b/klibc/include/arch/x86_64/klibc/archsetjmp.h deleted file mode 100644 index 90d0a0d263..0000000000 --- a/klibc/include/arch/x86_64/klibc/archsetjmp.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * arch/x86_64/include/klibc/archsetjmp.h - */ - -#ifndef _KLIBC_ARCHSETJMP_H -#define _KLIBC_ARCHSETJMP_H - -struct __jmp_buf { - unsigned long __rbx; - unsigned long __rsp; - unsigned long __rbp; - unsigned long __r12; - unsigned long __r13; - unsigned long __r14; - unsigned long __r15; - unsigned long __rip; -}; - -typedef struct __jmp_buf jmp_buf[1]; - -#endif /* _SETJMP_H */ diff --git a/klibc/include/arch/x86_64/klibc/archsignal.h b/klibc/include/arch/x86_64/klibc/archsignal.h deleted file mode 100644 index 527241454e..0000000000 --- a/klibc/include/arch/x86_64/klibc/archsignal.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * arch/x86_64/include/klibc/archsignal.h - * - * Architecture-specific signal definitions - * - */ - -#ifndef _KLIBC_ARCHSIGNAL_H -#define _KLIBC_ARCHSIGNAL_H - -/* The x86-64 headers defines NSIG 32, but it's actually 64 */ -#undef _NSIG -#undef NSIG -#define _NSIG 64 -#define NSIG _NSIG - -#endif diff --git a/klibc/include/arch/x86_64/klibc/archstat.h b/klibc/include/arch/x86_64/klibc/archstat.h deleted file mode 100644 index 53e141daea..0000000000 --- a/klibc/include/arch/x86_64/klibc/archstat.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _KLIBC_ARCHSTAT_H -#define _KLIBC_ARCHSTAT_H - -#define _STATBUF_ST_NSEC - -struct stat { - unsigned long st_dev; - unsigned long st_ino; - unsigned long st_nlink; - - unsigned int st_mode; - unsigned int st_uid; - unsigned int st_gid; - unsigned int __pad0; - unsigned long st_rdev; - long st_size; - long st_blksize; - long st_blocks; /* Number 512-byte blocks allocated. */ - - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - long __unused[3]; -}; - -#endif diff --git a/klibc/include/arch/x86_64/klibc/archsys.h b/klibc/include/arch/x86_64/klibc/archsys.h deleted file mode 100644 index 2ec72cd397..0000000000 --- a/klibc/include/arch/x86_64/klibc/archsys.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * arch/x86_64/include/klibc/archsys.h - * - * Architecture-specific syscall definitions - */ - -#ifndef _KLIBC_ARCHSYS_H -#define _KLIBC_ARCHSYS_H - -/* The x86-64 syscall headers are needlessly inefficient */ - -#undef _syscall0 -#undef _syscall1 -#undef _syscall2 -#undef _syscall3 -#undef _syscall4 -#undef _syscall5 -#undef _syscall6 - -#define _syscall0(type,name) \ -type name (void) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall1(type,name,type1,arg1) \ -type name (type1 arg1) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall2(type,name,type1,arg1,type2,arg2) \ -type name (type1 arg1,type2 arg2) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \ -type name (type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ - "d" (arg3) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4) \ -{ \ -long __res; \ -register type4 __r10 asm("%r10") = arg4; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ - "d" (arg3),"r" (__r10) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -register type4 __r10 asm("%r10") = arg4; \ -register type5 __r8 asm("%r8") = arg5; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ - "d" (arg3),"r" (__r10),"r" (__r8) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5,type6,arg6) \ -type name (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5,type6 arg6) \ -{ \ -long __res; \ -register type4 __r10 asm("%r10") = arg4; \ -register type5 __r8 asm("%r8") = arg5; \ -register type6 __r9 asm("%r9") = arg6; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##name),"D" (arg1),"S" (arg2), \ - "d" (arg3),"r" (__r10),"r" (__r8), "r" (__r9) \ - : __syscall_clobber); \ -__syscall_return(type,__res); \ -} - -#endif /* _KLIBC_ARCHSYS_H */ diff --git a/klibc/include/arch/x86_64/sys/io.h b/klibc/include/arch/x86_64/sys/io.h deleted file mode 100644 index 4a0ae44985..0000000000 --- a/klibc/include/arch/x86_64/sys/io.h +++ /dev/null @@ -1,126 +0,0 @@ -#ident "$Id: io.h,v 1.1 2004/01/25 01:34:29 hpa Exp $" -/* ----------------------------------------------------------------------- * - * - * Copyright 2004 H. Peter Anvin - All Rights Reserved - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall - * be included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * ----------------------------------------------------------------------- */ - -/* - * sys/io.h for the i386 architecture - * - * Basic I/O macros - */ - -#ifndef _SYS_IO_H -#define _SYS_IO_H 1 - -/* I/O-related system calls */ - -int iopl(int); -int ioperm(unsigned long, unsigned long, int); - -/* Basic I/O macros */ - -static __inline__ void -outb(unsigned char __v, unsigned short __p) -{ - asm volatile("outb %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ void -outw(unsigned short __v, unsigned short __p) -{ - asm volatile("outw %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ void -outl(unsigned int __v, unsigned short __p) -{ - asm volatile("outl %0,%1" : : "a" (__v), "dN" (__p)); -} - -static __inline__ unsigned char -inb(unsigned short __p) -{ - unsigned char __v; - asm volatile("inb %1,%0" : "=a" (__v) : "dN" (__p)); - return v; -} - -static __inline__ unsigned short -inw(unsigned short __p) -{ - unsigned short __v; - asm volatile("inw %1,%0" : "=a" (__v) : "dN" (__p)); - return v; -} - -static __inline__ unsigned int -inl(unsigned short __p) -{ - unsigned int __v; - asm volatile("inl %1,%0" : "=a" (__v) : "dN" (__p)); - return v; -} - -/* String I/O macros */ - -static __inline__ void -outsb (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsb" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -outsw (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsw" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -outsl (unsigned short __p, const void *__d, unsigned long __n) -{ - asm volatile("cld; rep; outsl" : "+S" (__d), "+c" (__n) : "d" (__p)); -} - - -static __inline__ void -insb (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insb" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -insw (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insw" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -static __inline__ void -insl (unsigned short __p, void *__d, unsigned long __n) -{ - asm volatile("cld; rep; insl" : "+D" (__d), "+c" (__n) : "d" (__p)); -} - -#endif /* _SYS_IO_H */ diff --git a/klibc/include/arpa/inet.h b/klibc/include/arpa/inet.h deleted file mode 100644 index 043b148e17..0000000000 --- a/klibc/include/arpa/inet.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * arpa/inet.h - */ - -#ifndef _ARPA_INET_H -#define _ARPA_INET_H - -#include -#include -#include -#include -#include - -__extern uint32_t inet_addr(const char *); -__extern int inet_aton(const char *, struct in_addr *); -__extern char *inet_ntoa(struct in_addr); -__extern int inet_pton(int, const char *, void *); -__extern const char *inet_ntop(int, const void *, char *, size_t); -__extern unsigned int inet_nsap_addr(const char *, unsigned char *, int); -__extern char *inet_nsap_ntoa(int, const unsigned char *, char *); - -#endif /* _ARPA_INET_H */ - - diff --git a/klibc/include/assert.h b/klibc/include/assert.h deleted file mode 100644 index 58cc37c487..0000000000 --- a/klibc/include/assert.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * assert.h - */ - -#ifndef _ASSERT_H -#define _ASSERT_H - -#ifdef NDEBUG - -#define assert(x) ((void)(x)) - -#else - -extern void __assert_fail(const char *, const char *, - unsigned int); - -#define assert(x) ((x) ? (void)0 : __assert_fail(#x, __FILE__, __LINE__)) - -#endif - -#endif /* _ASSERT_H */ - diff --git a/klibc/include/bits32/bitsize.h b/klibc/include/bits32/bitsize.h deleted file mode 100644 index 06cc885983..0000000000 --- a/klibc/include/bits32/bitsize.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef _BITSIZE -#define _BITSIZE 32 -#endif diff --git a/klibc/include/bits32/bitsize/limits.h b/klibc/include/bits32/bitsize/limits.h deleted file mode 100644 index f90e524b2b..0000000000 --- a/klibc/include/bits32/bitsize/limits.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * bits32/limits.h - */ - -#ifndef _BITSIZE_LIMITS_H -#define _BITSIZE_LIMITS_H - -#define LONG_BIT 32 - -#define LONG_MIN (-2147483647L-1) -#define LONG_MAX 2147483647L -#define ULONG_MAX 4294967295UL - -#endif /* _BITSIZE_LIMITS_H */ diff --git a/klibc/include/bits32/bitsize/stddef.h b/klibc/include/bits32/bitsize/stddef.h deleted file mode 100644 index c486041fe0..0000000000 --- a/klibc/include/bits32/bitsize/stddef.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * bits32/stddef.h - */ - -#ifndef _BITSIZE_STDDEF_H -#define _BITSIZE_STDDEF_H - -#define _SIZE_T -#if defined(__s390__) || defined(__hppa__) || defined(__cris__) -typedef unsigned long size_t; -#else -typedef unsigned int size_t; -#endif - -#define _PTRDIFF_T -typedef signed int ptrdiff_t; - -#endif /* _BITSIZE_STDDEF_H */ diff --git a/klibc/include/bits32/bitsize/stdint.h b/klibc/include/bits32/bitsize/stdint.h deleted file mode 100644 index 40b464961c..0000000000 --- a/klibc/include/bits32/bitsize/stdint.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * bits32/stdint.h - */ - -#ifndef _BITSIZE_STDINT_H -#define _BITSIZE_STDINT_H - -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef long long int int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long int uint64_t; - -typedef int int_fast16_t; -typedef int int_fast32_t; - -typedef unsigned int uint_fast16_t; -typedef unsigned int uint_fast32_t; - -typedef int intptr_t; -typedef unsigned int uintptr_t; - -#define __INT64_C(c) c ## LL -#define __UINT64_C(c) c ## ULL - -#define __PRI64_RANK "ll" -#define __PRIFAST_RANK "" -#define __PRIPTR_RANK "" - -#endif /* _BITSIZE_STDINT_H */ diff --git a/klibc/include/bits32/bitsize/stdintconst.h b/klibc/include/bits32/bitsize/stdintconst.h deleted file mode 100644 index 8157dd06e0..0000000000 --- a/klibc/include/bits32/bitsize/stdintconst.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * bits32/stdintconst.h - */ - -#ifndef _BITSIZE_STDINTCONST_H -#define _BITSIZE_STDINTCONST_H - -#define INT_FAST16_C(c) INT32_C(c) -#define INT_FAST32_C(c) INT32_C(c) - -#define UINT_FAST16_C(c) UINT32_C(c) -#define UINT_FAST32_C(c) UINT32_C(c) - -#define INTPTR_C(c) INT32_C(c) -#define UINTPTR_C(c) UINT32_C(c) -#define PTRDIFF_C(c) INT32_C(c) - -#endif /* _BITSIZE_STDINTCONST_H */ diff --git a/klibc/include/bits32/bitsize/stdintlimits.h b/klibc/include/bits32/bitsize/stdintlimits.h deleted file mode 100644 index b44fe01186..0000000000 --- a/klibc/include/bits32/bitsize/stdintlimits.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * bits32/stdintlimits.h - */ - -#ifndef _BITSIZE_STDINTLIMITS_H -#define _BITSIZE_STDINTLIMITS_H - -#define INT_FAST16_MIN INT32_MIN -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST16_MAX INT32_MAX -#define INT_FAST32_MAX INT32_MAX -#define UINT_FAST16_MAX UINT32_MAX -#define UINT_FAST32_MAX UINT32_MAX - -#define INTPTR_MIN INT32_MIN -#define INTPTR_MAX INT32_MAX -#define UINTPTR_MAX UINT32_MAX - -#define PTRDIFF_MIN INT32_MIN -#define PTRDIFF_MAX INT32_MAX - -#endif /* _BITSIZE_STDINTLIMITS_H */ diff --git a/klibc/include/bits64/bitsize.h b/klibc/include/bits64/bitsize.h deleted file mode 100644 index 54696fd70e..0000000000 --- a/klibc/include/bits64/bitsize.h +++ /dev/null @@ -1,3 +0,0 @@ -#ifndef _BITSIZE -#define _BITSIZE 64 -#endif diff --git a/klibc/include/bits64/bitsize/limits.h b/klibc/include/bits64/bitsize/limits.h deleted file mode 100644 index 7b20da085b..0000000000 --- a/klibc/include/bits64/bitsize/limits.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * bits64/limits.h - */ - -#ifndef _BITSIZE_LIMITS_H -#define _BITSIZE_LIMITS_H - -#define LONG_BIT 64 - -#define LONG_MIN (-9223372036854775807L-1) -#define LONG_MAX 9223372036854775807L -#define ULONG_MAX 18446744073709551615UL - -#endif /* _BITSIZE_LIMITS_H */ diff --git a/klibc/include/bits64/bitsize/stddef.h b/klibc/include/bits64/bitsize/stddef.h deleted file mode 100644 index 3e72621862..0000000000 --- a/klibc/include/bits64/bitsize/stddef.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * bits64/stddef.h - */ - -#ifndef _BITSIZE_STDDEF_H -#define _BITSIZE_STDDEF_H - -#define _SIZE_T -typedef unsigned long size_t; -#define _PTRDIFF_T -typedef signed long ptrdiff_t; - -#endif /* _BITSIZE_STDDEF_H */ diff --git a/klibc/include/bits64/bitsize/stdint.h b/klibc/include/bits64/bitsize/stdint.h deleted file mode 100644 index 8e16cf0909..0000000000 --- a/klibc/include/bits64/bitsize/stdint.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * bits64/stdint.h - */ - -#ifndef _BITSIZE_STDINT_H -#define _BITSIZE_STDINT_H - -typedef signed char int8_t; -typedef short int int16_t; -typedef int int32_t; -typedef long int int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short int uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long int uint64_t; - -typedef long int int_fast16_t; -typedef long int int_fast32_t; - -typedef unsigned long int uint_fast16_t; -typedef unsigned long int uint_fast32_t; - -typedef long int intptr_t; -typedef unsigned long int uintptr_t; - -#define __INT64_C(c) c ## L -#define __UINT64_C(c) c ## UL - -#define __PRI64_RANK "l" -#define __PRIFAST_RANK "l" -#define __PRIPTR_RANK "l" - -#endif /* _BITSIZE_STDINT_H */ - - diff --git a/klibc/include/bits64/bitsize/stdintconst.h b/klibc/include/bits64/bitsize/stdintconst.h deleted file mode 100644 index 65f2db0501..0000000000 --- a/klibc/include/bits64/bitsize/stdintconst.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * bits64/stdintconst.h - */ - -#ifndef _BITSIZE_STDINTCONST_H -#define _BITSIZE_STDINTCONST_H - -#define INT_FAST16_C(c) INT64_C(c) -#define INT_FAST32_C(c) INT64_C(c) - -#define UINT_FAST16_C(c) UINT64_C(c) -#define UINT_FAST32_C(c) UINT64_C(c) - -#define INTPTR_C(c) INT64_C(c) -#define UINTPTR_C(c) UINT64_C(c) -#define PTRDIFF_C(c) INT64_C(c) - -#endif /* _BITSIZE_STDINTCONST_H */ diff --git a/klibc/include/bits64/bitsize/stdintlimits.h b/klibc/include/bits64/bitsize/stdintlimits.h deleted file mode 100644 index d110d17d2d..0000000000 --- a/klibc/include/bits64/bitsize/stdintlimits.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * bits64/stdintlimits.h - */ - -#ifndef _BITSIZE_STDINTLIMITS_H -#define _BITSIZE_STDINTLIMITS_H - -#define INT_FAST16_MIN INT64_MIN -#define INT_FAST32_MIN INT64_MIN -#define INT_FAST16_MAX INT64_MAX -#define INT_FAST32_MAX INT64_MAX -#define UINT_FAST16_MAX UINT64_MAX -#define UINT_FAST32_MAX UINT64_MAX - -#define INTPTR_MIN INT64_MIN -#define INTPTR_MAX INT64_MAX -#define UINTPTR_MAX UINT64_MAX - -#define PTRDIFF_MIN INT64_MIN -#define PTRDIFF_MAX INT64_MAX - -#endif /* _BITSIZE_STDINTLIMITS_H */ diff --git a/klibc/include/ctype.h b/klibc/include/ctype.h deleted file mode 100644 index daa6a8eff4..0000000000 --- a/klibc/include/ctype.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * ctype.h - * - * This assumes ISO 8859-1, being a reasonable superset of ASCII. - */ - -#ifndef _CTYPE_H -#define _CTYPE_H - -#ifndef __CTYPE_NO_INLINE -# define __ctype_inline extern __inline__ -#else -# define __ctype_inline -#endif - -/* - * This relies on the following definitions: - * - * cntrl = !print - * alpha = upper|lower - * graph = punct|alpha|digit - * blank = '\t' || ' ' (per POSIX requirement) - */ -enum { - __ctype_upper = (1 << 0), - __ctype_lower = (1 << 1), - __ctype_digit = (1 << 2), - __ctype_xdigit = (1 << 3), - __ctype_space = (1 << 4), - __ctype_print = (1 << 5), - __ctype_punct = (1 << 6), - __ctype_cntrl = (1 << 7), -}; - -extern const unsigned char __ctypes[]; - -__ctype_inline int isalnum(int __c) -{ - return __ctypes[__c+1] & - (__ctype_upper|__ctype_lower|__ctype_digit); -} - -__ctype_inline int isalpha(int __c) -{ - return __ctypes[__c+1] & - (__ctype_upper|__ctype_lower); -} - -__ctype_inline int isascii(int __c) -{ - return !(__c & ~0x7f); -} - -__ctype_inline int isblank(int __c) -{ - return (__c == '\t') || (__c == ' '); -} - -__ctype_inline int iscntrl(int __c) -{ - return __ctypes[__c+1] & __ctype_cntrl; -} - -__ctype_inline int isdigit(int __c) -{ - return ((unsigned)__c - '0') <= 9; -} - -__ctype_inline int isgraph(int __c) -{ - return __ctypes[__c+1] & - (__ctype_upper|__ctype_lower|__ctype_digit|__ctype_punct); -} - -__ctype_inline int islower(int __c) -{ - return __ctypes[__c+1] & __ctype_lower; -} - -__ctype_inline int isprint(int __c) -{ - return __ctypes[__c+1] & __ctype_print; -} - -__ctype_inline int ispunct(int __c) -{ - return __ctypes[__c+1] & __ctype_punct; -} - -__ctype_inline int isspace(int __c) -{ - return __ctypes[__c+1] & __ctype_space; -} - -__ctype_inline int isupper(int __c) -{ - return __ctypes[__c+1] & __ctype_upper; -} - -__ctype_inline int isxdigit(int __c) -{ - return __ctypes[__c+1] & __ctype_xdigit; -} - -/* Note: this is decimal, not hex, to avoid accidental promotion to unsigned */ -#define _toupper(__c) ((__c) & ~32) -#define _tolower(__c) ((__c) | 32) - -__ctype_inline int toupper(int __c) -{ - return islower(__c) ? _toupper(__c) : __c; -} - -__ctype_inline int tolower(int __c) -{ - return isupper(__c) ? _tolower(__c) : __c; -} - -#endif /* _CTYPE_H */ diff --git a/klibc/include/dirent.h b/klibc/include/dirent.h deleted file mode 100644 index 4db479592b..0000000000 --- a/klibc/include/dirent.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * dirent.h - */ - -#ifndef _DIRENT_H -#define _DIRENT_H - -#include -#include - -struct _IO_dir { - int __fd; - -#ifdef __KLIBC_DIRENT_INTERNALS - /* These fields for internal use only */ - - size_t bytes_left; - struct dirent *next; - /* Declaring this as an array of struct enforces correct alignment */ - struct dirent buffer[15]; /* 15 times max dirent size =~ 4K */ -#endif -}; -typedef struct _IO_dir DIR; - -__extern DIR *opendir(const char *); -__extern struct dirent *readdir(DIR *); -__extern int closedir(DIR *); -static __inline__ int dirfd (DIR *__d) { - return __d->__fd; -} - -#endif /* _DIRENT_H */ diff --git a/klibc/include/elf.h b/klibc/include/elf.h deleted file mode 100644 index 52f47d042e..0000000000 --- a/klibc/include/elf.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * elf.h - */ - -#ifndef _ELF_H -#define _ELF_H - -#include -#include - -#endif /* _ELF_H */ - diff --git a/klibc/include/endian.h b/klibc/include/endian.h deleted file mode 100644 index 44f89ccbbc..0000000000 --- a/klibc/include/endian.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * endian.h - */ - -#ifndef _ENDIAN_H -#define _ENDIAN_H - -#include -#include - -/* Linux' asm/byteorder.h defines either __LITTLE_ENDIAN or - __BIG_ENDIAN, but the glibc/BSD-ish macros expect both to be - defined with __BYTE_ORDER defining which is actually used... */ - -#if defined(__LITTLE_ENDIAN) -# undef __LITTLE_ENDIAN -# define __LITTLE_ENDIAN 1234 -# define __BIG_ENDIAN 4321 -# define __PDP_ENDIAN 3412 -# define __BYTE_ORDER __LITTLE_ENDIAN -#elif defined(__BIG_ENDIAN) -# undef __BIG_ENDIAN -# define __LITTLE_ENDIAN 1234 -# define __BIG_ENDIAN 4321 -# define __PDP_ENDIAN 3412 -# define __BYTE_ORDER __BIG_ENDIAN -#elif defined(__PDP_ENDIAN) -# undef __PDP_ENDIAN -# define __LITTLE_ENDIAN 1234 -# define __BIG_ENDIAN 4321 -# define __PDP_ENDIAN 3412 -# define __BYTE_ORDER __PDP_ENDIAN -#else -# error "Unknown byte order!" -#endif - -#define LITTLE_ENDIAN __LITTLE_ENDIAN -#define BIG_ENDIAN __BIG_ENDIAN -#define PDP_ENDIAN __PDP_ENDIAN -#define BYTE_ORDER __BYTE_ORDER - -#endif /* _ENDIAN_H */ diff --git a/klibc/include/errno.h b/klibc/include/errno.h deleted file mode 100644 index b2e666504d..0000000000 --- a/klibc/include/errno.h +++ /dev/null @@ -1,8 +0,0 @@ -/* - * errno.h - */ - -#include -#include - -__extern int errno; diff --git a/klibc/include/fcntl.h b/klibc/include/fcntl.h deleted file mode 100644 index c9650f76b5..0000000000 --- a/klibc/include/fcntl.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * fcntl.h - */ - -#ifndef _FCNTL_H -#define _FCNTL_H - -#include -#include -#include -#if defined(__mips__) && !defined(__mips64__) -# include -#endif -#include - -/* This is ugly, but "struct flock" has actually been defined with - a long off_t, so it's really "struct flock64". It just happens - to work. Gag. Barf. - - This happens to work on all 32-bit architectures except MIPS. */ - -#ifdef F_GETLK64 -# undef F_GETLK -# define F_GETLK F_GETLK64 -#endif - -#ifdef F_SETLK64 -# undef F_SETLK -# define F_SETLK F_SETLK64 -#endif - -#ifdef F_SETLKW64 -# undef F_SETLKW -# define F_SETLKW F_SETLKW64 -#endif - -/* This is defined here as well as in since old-style code - would still include when using open(), and open() being - a varadic function changes its calling convention on some architectures. */ -#ifndef _KLIBC_IN_OPEN_C -__extern int open(const char *, int, ...); -#endif - -__extern int fcntl(int, int, ...); - -#endif /* _FCNTL_H */ diff --git a/klibc/include/grp.h b/klibc/include/grp.h deleted file mode 100644 index 03ceb31560..0000000000 --- a/klibc/include/grp.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * grp.h - */ - -#ifndef _GRP_H -#define _GRP_H - -#include -#include - -__extern int setgroups(size_t, const gid_t *); - -#endif /* _GRP_H */ diff --git a/klibc/include/inttypes.h b/klibc/include/inttypes.h deleted file mode 100644 index e00fa63160..0000000000 --- a/klibc/include/inttypes.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * inttypes.h - */ - -#ifndef _INTTYPES_H -#define _INTTYPES_H - -#include -#include -#include - -static __inline__ intmax_t imaxabs(intmax_t __n) -{ - return (__n < (intmax_t)0) ? -__n : __n; -} - -__extern intmax_t strtoimax(const char *, char **, int); -__extern uintmax_t strtoumax(const char *, char **, int); - -/* extensions */ -__extern intmax_t strntoimax(const char *, char **, int, size_t); -__extern uintmax_t strntoumax(const char *, char **, int, size_t); - -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) - -#define PRId8 "d" -#define PRId16 "d" -#define PRId32 "d" -#define PRId64 __PRI64_RANK "d" - -#define PRIdLEAST8 "d" -#define PRIdLEAST16 "d" -#define PRIdLEAST32 "d" -#define PRIdLEAST64 __PRI64_RANK "d" - -#define PRIdFAST8 "d" -#define PRIdFAST16 __PRIFAST_RANK "d" -#define PRIdFAST32 __PRIFAST_RANK "d" -#define PRIdFAST64 __PRI64_RANK "d" - -#define PRIdMAX __PRI64_RANK "d" -#define PRIdPTR __PRIPTR_RANK "d" - -#define PRIi8 "i" -#define PRIi16 "i" -#define PRIi32 "i" -#define PRIi64 __PRI64_RANK "i" - -#define PRIiLEAST8 "i" -#define PRIiLEAST16 "i" -#define PRIiLEAST32 "i" -#define PRIiLEAST64 __PRI64_RANK "i" - -#define PRIiFAST8 "i" -#define PRIiFAST16 __PRIFAST_RANK "i" -#define PRIiFAST32 __PRIFAST_RANK "i" -#define PRIiFAST64 __PRI64_RANK "i" - -#define PRIiMAX __PRI64_RANK "i" -#define PRIiPTR __PRIPTR_RANK "i" - -#define PRIo8 "o" -#define PRIo16 "o" -#define PRIo32 "o" -#define PRIo64 __PRI64_RANK "o" - -#define PRIoLEAST8 "o" -#define PRIoLEAST16 "o" -#define PRIoLEAST32 "o" -#define PRIoLEAST64 __PRI64_RANK "o" - -#define PRIoFAST8 "o" -#define PRIoFAST16 __PRIFAST_RANK "o" -#define PRIoFAST32 __PRIFAST_RANK "o" -#define PRIoFAST64 __PRI64_RANK "o" - -#define PRIoMAX __PRI64_RANK "o" -#define PRIoPTR __PRIPTR_RANK "o" - -#define PRIu8 "u" -#define PRIu16 "u" -#define PRIu32 "u" -#define PRIu64 __PRI64_RANK "u" - -#define PRIuLEAST8 "u" -#define PRIuLEAST16 "u" -#define PRIuLEAST32 "u" -#define PRIuLEAST64 __PRI64_RANK "u" - -#define PRIuFAST8 "u" -#define PRIuFAST16 __PRIFAST_RANK "u" -#define PRIuFAST32 __PRIFAST_RANK "u" -#define PRIuFAST64 __PRI64_RANK "u" - -#define PRIuMAX __PRI64_RANK "u" -#define PRIuPTR __PRIPTR_RANK "u" - -#define PRIx8 "x" -#define PRIx16 "x" -#define PRIx32 "x" -#define PRIx64 __PRI64_RANK "x" - -#define PRIxLEAST8 "x" -#define PRIxLEAST16 "x" -#define PRIxLEAST32 "x" -#define PRIxLEAST64 __PRI64_RANK "x" - -#define PRIxFAST8 "x" -#define PRIxFAST16 __PRIFAST_RANK "x" -#define PRIxFAST32 __PRIFAST_RANK "x" -#define PRIxFAST64 __PRI64_RANK "x" - -#define PRIxMAX __PRI64_RANK "x" -#define PRIxPTR __PRIPTR_RANK "x" - -#define PRIX8 "X" -#define PRIX16 "X" -#define PRIX32 "X" -#define PRIX64 __PRI64_RANK "X" - -#define PRIXLEAST8 "X" -#define PRIXLEAST16 "X" -#define PRIXLEAST32 "X" -#define PRIXLEAST64 __PRI64_RANK "X" - -#define PRIXFAST8 "X" -#define PRIXFAST16 __PRIFAST_RANK "X" -#define PRIXFAST32 __PRIFAST_RANK "X" -#define PRIXFAST64 __PRI64_RANK "X" - -#define PRIXMAX __PRI64_RANK "X" -#define PRIXPTR __PRIPTR_RANK "X" - -#define SCNd8 "hhd" -#define SCNd16 "hd" -#define SCNd32 "d" -#define SCNd64 __PRI64_RANK "d" - -#define SCNdLEAST8 "hhd" -#define SCNdLEAST16 "hd" -#define SCNdLEAST32 "d" -#define SCNdLEAST64 __PRI64_RANK "d" - -#define SCNdFAST8 "hhd" -#define SCNdFAST16 __PRIFAST_RANK "d" -#define SCNdFAST32 __PRIFAST_RANK "d" -#define SCNdFAST64 __PRI64_RANK "d" - -#define SCNdMAX __PRI64_RANK "d" -#define SCNdPTR __PRIPTR_RANK "d" - -#define SCNi8 "hhi" -#define SCNi16 "hi" -#define SCNi32 "i" -#define SCNi64 __PRI64_RANK "i" - -#define SCNiLEAST8 "hhi" -#define SCNiLEAST16 "hi" -#define SCNiLEAST32 "i" -#define SCNiLEAST64 __PRI64_RANK "i" - -#define SCNiFAST8 "hhi" -#define SCNiFAST16 __PRIFAST_RANK "i" -#define SCNiFAST32 __PRIFAST_RANK "i" -#define SCNiFAST64 __PRI64_RANK "i" - -#define SCNiMAX __PRI64_RANK "i" -#define SCNiPTR __PRIPTR_RANK "i" - -#define SCNo8 "hho" -#define SCNo16 "ho" -#define SCNo32 "o" -#define SCNo64 __PRI64_RANK "o" - -#define SCNoLEAST8 "hho" -#define SCNoLEAST16 "ho" -#define SCNoLEAST32 "o" -#define SCNoLEAST64 __PRI64_RANK "o" - -#define SCNoFAST8 "hho" -#define SCNoFAST16 __PRIFAST_RANK "o" -#define SCNoFAST32 __PRIFAST_RANK "o" -#define SCNoFAST64 __PRI64_RANK "o" - -#define SCNoMAX __PRI64_RANK "o" -#define SCNoPTR __PRIPTR_RANK "o" - -#define SCNu8 "hhu" -#define SCNu16 "hu" -#define SCNu32 "u" -#define SCNu64 __PRI64_RANK "u" - -#define SCNuLEAST8 "hhu" -#define SCNuLEAST16 "hu" -#define SCNuLEAST32 "u" -#define SCNuLEAST64 __PRI64_RANK "u" - -#define SCNuFAST8 "hhu" -#define SCNuFAST16 __PRIFAST_RANK "u" -#define SCNuFAST32 __PRIFAST_RANK "u" -#define SCNuFAST64 __PRI64_RANK "u" - -#define SCNuMAX __PRI64_RANK "u" -#define SCNuPTR __PRIPTR_RANK "u" - -#define SCNx8 "hhx" -#define SCNx16 "hx" -#define SCNx32 "x" -#define SCNx64 __PRI64_RANK "x" - -#define SCNxLEAST8 "hhx" -#define SCNxLEAST16 "hx" -#define SCNxLEAST32 "x" -#define SCNxLEAST64 __PRI64_RANK "x" - -#define SCNxFAST8 "hhx" -#define SCNxFAST16 __PRIFAST_RANK "x" -#define SCNxFAST32 __PRIFAST_RANK "x" -#define SCNxFAST64 __PRI64_RANK "x" - -#define SCNxMAX __PRI64_RANK "x" -#define SCNxPTR __PRIPTR_RANK "x" - -#endif - -#endif /* _INTTYPES_H */ diff --git a/klibc/include/klibc/compiler.h b/klibc/include/klibc/compiler.h deleted file mode 100644 index 7ff6ff7d51..0000000000 --- a/klibc/include/klibc/compiler.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * klibc/compiler.h - * - * Various compiler features - */ - -#ifndef _KLIBC_COMPILER_H -#define _KLIBC_COMPILER_H - -/* Specific calling conventions */ -/* __cdecl is used when we want varadic and non-varadic functions to have - the same binary calling convention. */ -#ifdef __i386__ -# ifdef __GNUC__ -# define __cdecl __attribute__((cdecl,regparm(0))) -# else - /* Most other C compilers have __cdecl as a keyword */ -# endif -#else -# define __cdecl /* Meaningless on non-i386 */ -#endif - -/* How to declare a function that *must* be inlined */ -#ifdef __GNUC__ -# if __GNUC__ >= 3 -# define __must_inline static __inline__ __attribute__((always_inline)) -# else -# define __must_inline extern __inline__ -# endif -#else -# define __must_inline inline /* Just hope this works... */ -#endif - -/* How to declare a function that does not return */ -#ifdef __GNUC__ -# define __noreturn void __attribute__((noreturn)) -#else -# define __noreturn void -#endif - -/* "const" function: - - Many functions do not examine any values except their arguments, - and have no effects except the return value. Basically this is - just slightly more strict class than the `pure' attribute above, - since function is not allowed to read global memory. - - Note that a function that has pointer arguments and examines the - data pointed to must _not_ be declared `const'. Likewise, a - function that calls a non-`const' function usually must not be - `const'. It does not make sense for a `const' function to return - `void'. -*/ -#ifdef __GNUC__ -# define __constfunc __attribute__((const)) -#else -# define __constfunc -#endif -#undef __attribute_const__ -#define __attribute_const__ __constfunc - -/* "pure" function: - - Many functions have no effects except the return value and their - return value depends only on the parameters and/or global - variables. Such a function can be subject to common subexpression - elimination and loop optimization just as an arithmetic operator - would be. These functions should be declared with the attribute - `pure'. -*/ -#ifdef __GNUC__ -# define __purefunc __attribute__((pure)) -#else -# define __purefunc -#endif -#undef __attribute_pure__ -#define __attribute_pure__ __purefunc - -/* Format attribute */ -#ifdef __GNUC__ -# define __formatfunc(t,f,a) __attribute__((format(t,f,a))) -#else -# define __formatfunc(t,f,a) -#endif - -/* malloc() function (returns unaliased pointer) */ -#if defined(__GNUC__) && (__GNUC__ >= 3) -# define __mallocfunc __attribute__((malloc)) -#else -# define __mallocfunc -#endif - -/* likely/unlikely */ -#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) -# define __likely(x) __builtin_expect((x), 1) -# define __unlikely(x) __builtin_expect((x), 0) -#else -# define __likely(x) (x) -# define __unlikely(x) (x) -#endif - -/* Possibly unused function */ -#ifdef __GNUC__ -# define __unusedfunc __attribute__((unused)) -#else -# define __unusedfunc -#endif - -/* It's all user space... */ -#define __user - -/* The bitwise attribute: disallow arithmetric operations */ -#ifdef __CHECKER__ /* sparse only */ -# define __bitwise __attribute__((bitwise)) -#else -# define __bitwise -#endif - -/* Compiler pragma to make an alias symbol */ -#define __ALIAS(__t, __f, __p, __a) \ - __t __f __p __attribute__((weak, alias(#__a))); - -#endif diff --git a/klibc/include/klibc/diverr.h b/klibc/include/klibc/diverr.h deleted file mode 100644 index 4d8c8d36c2..0000000000 --- a/klibc/include/klibc/diverr.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * klibc/diverr.h - */ - -#ifndef _KLIBC_DIVERR_H -#define _KLIBC_DIVERR_H - -#include - -static __inline__ void -__divide_error(void) -{ - raise(SIGFPE); -} - -#endif /* _KLIBC_DIVERR_H */ diff --git a/klibc/include/klibc/extern.h b/klibc/include/klibc/extern.h deleted file mode 100644 index 8a73d19358..0000000000 --- a/klibc/include/klibc/extern.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * klibc/extern.h - */ - -#ifndef _KLIBC_EXTERN_H -#define _KLIBC_EXTERN_H - -#ifdef __cplusplus -#define __extern extern "C" -#else -#define __extern extern -#endif - -#define __alias(x) __attribute__((weak, alias(x))) - -#endif /* _KLIBC_EXTERN_H */ diff --git a/klibc/include/klibc/sysconfig.h b/klibc/include/klibc/sysconfig.h deleted file mode 100644 index ce01c23593..0000000000 --- a/klibc/include/klibc/sysconfig.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * klibc/sysconfig.h - * - * Allows for definitions of some things which may be system-dependent - */ - -#ifndef _KLIBC_SYSCONFIG_H -#define _KLIBC_SYSCONFIG_H - -/* - * Define this to obtain memory using sbrk() instead - * of mmap(). This should make it friendlier on - * non-MMU architectures. This should become a - * per-architecture configurable. - */ -#undef MALLOC_USING_SBRK - -/* - * This is the minimum chunk size we will ask the kernel for using - * malloc(); this should be a multiple of the page size on all - * architectures. - */ -#define MALLOC_CHUNK_SIZE 65536 -#define MALLOC_CHUNK_MASK (MALLOC_CHUNK_SIZE-1) - -/* - * This is the minimum alignment for the memory returned by sbrk(). - * It must be a power of 2. If MALLOC_USING_SBRK is defined it should - * be no smaller than the size of struct arena_header in malloc.h (4 - * pointers.) - */ -#define SBRK_ALIGNMENT 32 - -#endif /* _KLIBC_SYSCONFIG_H */ diff --git a/klibc/include/limits.h b/klibc/include/limits.h deleted file mode 100644 index f1532e5323..0000000000 --- a/klibc/include/limits.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * limits.h - */ - -#ifndef _LIMITS_H -#define _LIMITS_H - -#define CHAR_BIT 8 -#define SHRT_BIT 16 -#define INT_BIT 32 -#define LONGLONG_BIT 64 - -#define SCHAR_MIN (-128) -#define SCHAR_MAX 127 -#define UCHAR_MAX 255 - -#ifdef __CHAR_UNSIGNED__ -# define CHAR_MIN 0 -# define CHAR_MAX UCHAR_MAX -#else -# define CHAR_MIN SCHAR_MIN -# define CHAR_MAX SCHAR_MAX -#endif - -#define SHRT_MIN (-32768) -#define SHRT_MAX 32767 -#define USHRT_MAX 65535 - -#define INT_MIN (-2147483647-1) -#define INT_MAX 2147483647 -#define UINT_MAX 4294967295U - -#define LONGLONG_MIN (-9223372036854775807LL-1) -#define LONGLONG_MAX 9223372036854775807LL -#define ULONGLONG_MAX 18446744073709551615ULL - -#include -#include - -#endif /* _LIMITS_H */ diff --git a/klibc/include/malloc.h b/klibc/include/malloc.h deleted file mode 100644 index 5beca8d068..0000000000 --- a/klibc/include/malloc.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * malloc.h - * - * Apparently people haven't caught on to use , which is the - * standard place for this crap since the 1980's... - */ - -#ifndef _MALLOC_H -#define _MALLOC_H - -#include -#include -#include - -__extern void free(void *); - -__extern __mallocfunc void *malloc(size_t); -__extern __mallocfunc void *calloc(size_t, size_t); -__extern __mallocfunc void *realloc(void *, size_t); - -#endif /* _MALLOC_H */ diff --git a/klibc/include/net/if.h b/klibc/include/net/if.h deleted file mode 100644 index 1aa8e7b90c..0000000000 --- a/klibc/include/net/if.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/include/net/if_arp.h b/klibc/include/net/if_arp.h deleted file mode 100644 index a25f1b4759..0000000000 --- a/klibc/include/net/if_arp.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/include/net/if_packet.h b/klibc/include/net/if_packet.h deleted file mode 100644 index b5e8e0e11f..0000000000 --- a/klibc/include/net/if_packet.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/include/net/route.h b/klibc/include/net/route.h deleted file mode 100644 index a60df24c0a..0000000000 --- a/klibc/include/net/route.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/include/netinet/if_ether.h b/klibc/include/netinet/if_ether.h deleted file mode 100644 index 060ef22070..0000000000 --- a/klibc/include/netinet/if_ether.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/include/netinet/in.h b/klibc/include/netinet/in.h deleted file mode 100644 index 27b778700e..0000000000 --- a/klibc/include/netinet/in.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * netinet/in.h - */ - -#ifndef _NETINET_IN_H -#define _NETINET_IN_H - -/* added this include by Mats Petersson */ -#include - -#include -#include -#include /* Must be included *before* */ -#include - -#ifndef htons -# define htons(x) __cpu_to_be16(x) -#endif -#ifndef ntohs -# define ntohs(x) __be16_to_cpu(x) -#endif -#ifndef htonl -# define htonl(x) __cpu_to_be32(x) -#endif -#ifndef ntohl -# define ntohl(x) __be32_to_cpu(x) -#endif -#ifndef htonq -# define htonq(x) __cpu_to_be64(x) -#endif -#ifndef ntohq -# define ntohq(x) __be64_to_cpu(x) -#endif - -#define IPPORT_RESERVED 1024 - -__extern int bindresvport (int sd, struct sockaddr_in *sin); - -#endif /* _NETINET_IN_H */ diff --git a/klibc/include/netinet/in6.h b/klibc/include/netinet/in6.h deleted file mode 100644 index 46584ca627..0000000000 --- a/klibc/include/netinet/in6.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * netinet/in6.h - */ - -#ifndef _NETINET_IN6_H -#define _NETINET_IN6_H - -#include - -#endif /* _NETINET_IN6_H */ diff --git a/klibc/include/netinet/ip.h b/klibc/include/netinet/ip.h deleted file mode 100644 index 8aecbe66a3..0000000000 --- a/klibc/include/netinet/ip.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * netinet/ip.h - */ - -#ifndef _NETINET_IP_H -#define _NETINET_IP_H - -#include -#include - -#define IP_DF 0x4000 /* Flag: "Don't Fragment" */ - -#endif /* _NETINET_IP_H */ diff --git a/klibc/include/netinet/tcp.h b/klibc/include/netinet/tcp.h deleted file mode 100644 index bb5d307e98..0000000000 --- a/klibc/include/netinet/tcp.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * netinet/tcp.h - */ - -#ifndef _NETINET_TCP_H -#define _NETINET_TCP_H - -#include /* Include *before* linux/tcp.h */ -#include - -#endif /* _NETINET_TCP_H */ diff --git a/klibc/include/netinet/udp.h b/klibc/include/netinet/udp.h deleted file mode 100644 index b809b4ee6e..0000000000 --- a/klibc/include/netinet/udp.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * netinet/udp.h - */ - -#ifndef _NETINET_UDP_H -#define _NETINET_UDP_H - -/* - * We would include linux/udp.h, but it brings in too much other stuff - */ - -struct udphdr { - __u16 source; - __u16 dest; - __u16 len; - __u16 check; -}; - -#endif /* _NETINET_UDP_H */ diff --git a/klibc/include/netpacket/packet.h b/klibc/include/netpacket/packet.h deleted file mode 100644 index b5e8e0e11f..0000000000 --- a/klibc/include/netpacket/packet.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/include/paths.h b/klibc/include/paths.h deleted file mode 100644 index a87831e74a..0000000000 --- a/klibc/include/paths.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)paths.h 8.1 (Berkeley) 6/2/93 - */ - -#ifndef _PATHS_H_ -#define _PATHS_H_ - -/* Default search path. */ -#define _PATH_DEFPATH "/usr/bin:/bin" -/* All standard utilities path. */ -#define _PATH_STDPATH \ - "/usr/bin:/bin:/usr/sbin:/sbin" - -#define _PATH_BSHELL "/bin/sh" -#define _PATH_CONSOLE "/dev/console" -#define _PATH_CSHELL "/bin/csh" -#define _PATH_DEVDB "/var/run/dev.db" -#define _PATH_DEVNULL "/dev/null" -#define _PATH_DRUM "/dev/drum" -#define _PATH_KLOG "/proc/kmsg" -#define _PATH_KMEM "/dev/kmem" -#define _PATH_LASTLOG "/var/log/lastlog" -#define _PATH_MAILDIR "/var/mail" -#define _PATH_MAN "/usr/share/man" -#define _PATH_MEM "/dev/mem" -#define _PATH_MNTTAB "/etc/fstab" -#define _PATH_MOUNTED "/etc/mtab" -#define _PATH_NOLOGIN "/etc/nologin" -#define _PATH_PRESERVE "/var/lib" -#define _PATH_RWHODIR "/var/spool/rwho" -#define _PATH_SENDMAIL "/usr/sbin/sendmail" -#define _PATH_SHADOW "/etc/shadow" -#define _PATH_SHELLS "/etc/shells" -#define _PATH_TTY "/dev/tty" -#define _PATH_UNIX "/boot/vmlinux" -#define _PATH_UTMP "/var/run/utmp" -#define _PATH_VI "/bin/vi" -#define _PATH_WTMP "/var/log/wtmp" - -/* Provide trailing slash, since mostly used for building pathnames. */ -#define _PATH_DEV "/dev/" -#define _PATH_TMP "/tmp/" -#define _PATH_VARDB "/var/db/" -#define _PATH_VARRUN "/var/run/" -#define _PATH_VARTMP "/var/tmp/" - -#endif /* !_PATHS_H_ */ diff --git a/klibc/include/poll.h b/klibc/include/poll.h deleted file mode 100644 index 8710d92ebd..0000000000 --- a/klibc/include/poll.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * poll.h - */ - -#ifndef _POLL_H -#define _POLL_H - -#include -#include - -/* POSIX specifies "int" for the timeout, Linux seems to use long... */ - -typedef unsigned int nfds_t; -__extern int poll(struct pollfd *, nfds_t, long); - -#endif /* _POLL_H */ diff --git a/klibc/include/sched.h b/klibc/include/sched.h deleted file mode 100644 index 3465b5705c..0000000000 --- a/klibc/include/sched.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * sched.h - */ - -#ifndef _SCHED_H -#define _SCHED_H - -#include - -/* linux/sched.h is unusable; put the declarations we need here... */ - -#define SCHED_NORMAL 0 -#define SCHED_FIFO 1 -#define SCHED_RR 2 - -struct sched_param { - int sched_priority; -}; - -__extern int sched_setscheduler(pid_t, int, const struct sched_param *); -__extern int sched_yield(void); - -/* Raw interfaces to clone(2); only actually usable for non-VM-cloning */ -#ifdef __ia64__ -__extern pid_t __clone2(int, void *, void *); -static __inline__ pid_t __clone(int _f, void *_sp) -{ - /* If this is used with _sp != 0 it will have the effect of the sp - and rsp growing away from a single point in opposite directions. */ - return __clone2(_f, _sp, _sp); -} -#else -__extern pid_t __clone(int, void *); -#endif - -#endif /* _SCHED_H */ diff --git a/klibc/include/setjmp.h b/klibc/include/setjmp.h deleted file mode 100644 index b504eb6d08..0000000000 --- a/klibc/include/setjmp.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * setjmp.h - */ - -#ifndef _SETJMP_H -#define _SETJMP_H - -#include -#include -#include -#include - -#include - -__extern int setjmp(jmp_buf); -__extern __noreturn longjmp(jmp_buf, int); - -/* - Whose bright idea was it to add unrelated functionality to just about - the only function in the standard C library (setjmp) which cannot be - wrapped by an ordinary function wrapper? Anyway, the damage is done, - and therefore, this wrapper *must* be inline. However, gcc will - complain if this is an inline function for unknown reason, and - therefore sigsetjmp() needs to be a macro. -*/ - -struct __sigjmp_buf { - jmp_buf __jmpbuf; - sigset_t __sigs; -}; - -typedef struct __sigjmp_buf sigjmp_buf[1]; - -#define sigsetjmp(__env, __save) \ -({ \ - struct __sigjmp_buf *__e = (__env); \ - sigprocmask(0, NULL, &__e->__sigs); \ - setjmp(__e->__jmpbuf); \ -}) - -__extern __noreturn siglongjmp(sigjmp_buf, int); - -#endif /* _SETJMP_H */ diff --git a/klibc/include/signal.h b/klibc/include/signal.h deleted file mode 100644 index 05930bdea1..0000000000 --- a/klibc/include/signal.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * signal.h - */ - -#ifndef _SIGNAL_H -#define _SIGNAL_H - -#include -#include -#include /* For memset() */ -#include /* For LONG_BIT */ -#include -#include - -#include - -/* glibc seems to use sig_atomic_t as "int" pretty much on all architectures. - Do the same, but allow the architecture to override. */ -#ifndef _KLIBC_HAS_ARCH_SIG_ATOMIC_T -typedef int sig_atomic_t; -#endif - -/* Some architectures don't define these */ -#ifndef SA_RESETHAND -# define SA_RESETHAND SA_ONESHOT -#endif -#ifndef SA_NODEFER -# define SA_NODEFER SA_NOMASK -#endif -/* Some architectures define NSIG and not _NSIG or vice versa */ -#ifndef NSIG -# define NSIG _NSIG -#endif -#ifndef _NSIG -# define _NSIG NSIG -#endif - -/* If we don't have any real-time signals available to userspace, - hide them all */ -#if SIGRTMAX <= SIGRTMIN -# undef SIGRTMIN -# undef SIGRTMAX -#endif - -__extern const char * const sys_siglist[]; - -/* This assumes sigset_t is either an unsigned long or an array of such, - and that _NSIG_BPW in the kernel is always LONG_BIT */ - -static __inline__ int sigemptyset(sigset_t *__set) -{ - memset(__set, 0, sizeof *__set); - return 0; -} -static __inline__ int sigfillset(sigset_t *__set) -{ - memset(__set, ~0, sizeof *__set); - return 0; -} -static __inline__ int sigaddset(sigset_t *__set, int __signum) -{ - unsigned long *__lset = (unsigned long *)__set; - __lset[__signum/LONG_BIT] |= 1UL << (__signum%LONG_BIT); - return 0; -} -static __inline__ int sigdelset(sigset_t *__set, int __signum) -{ - unsigned long *__lset = (unsigned long *)__set; - __lset[__signum/LONG_BIT] &= ~(1UL << (__signum%LONG_BIT)); - return 0; -} -static __inline__ int sigismember(sigset_t *__set, int __signum) -{ - unsigned long *__lset = (unsigned long *)__set; - return (int)((__lset[__signum/LONG_BIT] >> (__signum%LONG_BIT)) & 1); -} - -__extern __sighandler_t __signal(int, __sighandler_t, int); -__extern __sighandler_t sysv_signal(int, __sighandler_t); -__extern __sighandler_t bsd_signal(int, __sighandler_t); -__extern int sigaction(int, const struct sigaction *, struct sigaction *); -__extern int sigprocmask(int, const sigset_t *, sigset_t *); -__extern int sigpending(sigset_t *); -__extern int sigsuspend(const sigset_t *); -__extern int raise(int); -__extern int kill(pid_t, int); - -#endif /* _SIGNAL_H */ diff --git a/klibc/include/stdarg.h b/klibc/include/stdarg.h deleted file mode 100644 index cc324b825d..0000000000 --- a/klibc/include/stdarg.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * stdarg.h - * - * This is just a wrapper for the gcc one, but defines va_copy() - * even if gcc doesn't. - */ - -/* Note: the _STDARG_H macro belongs to the gcc header... */ -#include_next - -/* Older gcc considers this an extension, so it's double underbar only */ -#ifndef va_copy -#define va_copy(d,s) __va_copy(d,s) -#endif diff --git a/klibc/include/stddef.h b/klibc/include/stddef.h deleted file mode 100644 index e96f28c446..0000000000 --- a/klibc/include/stddef.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * stddef.h - */ - -#ifndef _STDDEF_H -#define _STDDEF_H - -#ifndef __KLIBC__ -# error "__KLIBC__ not defined, compiler invocation error!" -#endif - -#include - -#undef NULL -#ifdef __cplusplus -# define NULL 0 -#else -# define NULL ((void *)0) -#endif - -#undef offsetof -#define offsetof(t,m) ((size_t)&((t *)0)->m) - -#endif /* _STDDEF_H */ diff --git a/klibc/include/stdint.h b/klibc/include/stdint.h deleted file mode 100644 index 47fec18594..0000000000 --- a/klibc/include/stdint.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * stdint.h - */ - -#ifndef _STDINT_H -#define _STDINT_H - -#include - -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; - -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -typedef int8_t int_fast8_t; -typedef int64_t int_fast64_t; - -typedef uint8_t uint_fast8_t; -typedef uint64_t uint_fast64_t; - -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - -#define INT8_MIN (-128) -#define INT16_MIN (-32768) -#define INT32_MIN (-2147483647-1) -#define INT64_MIN (__INT64_C(-9223372036854775807)-1) - -#define INT8_MAX (127) -#define INT16_MAX (32767) -#define INT32_MAX (2147483647) -#define INT64_MAX (__INT64_C(9223372036854775807)) - -#define UINT8_MAX (255U) -#define UINT16_MAX (65535U) -#define UINT32_MAX (4294967295U) -#define UINT64_MAX (__UINT64_C(18446744073709551615)) - -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST64_MIN INT64_MIN - -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST64_MAX INT64_MAX - -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST64_MAX UINT64_MAX - -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -#include - -#endif - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) - -#define INT8_C(c) c -#define INT16_C(c) c -#define INT32_C(c) c -#define INT64_C(c) __INT64_C(c) - -#define UINT8_C(c) c ## U -#define UINT16_C(c) c ## U -#define UINT32_C(c) c ## U -#define UINT64_C(c) __UINT64_C(c) - -#define INT_LEAST8_C(c) INT8_C(c) -#define INT_LEAST16_C(c) INT16_C(c) -#define INT_LEAST32_C(c) INT32_C(c) -#define INT_LEAST64_C(c) INT64_C(c) - -#define UINT_LEAST8_C(c) UINT8_C(c) -#define UINT_LEAST16_C(c) UINT16_C(c) -#define UINT_LEAST32_C(c) UINT32_C(c) -#define UINT_LEAST64_C(c) UINT64_C(c) - -#define INT_FAST8_C(c) INT8_C(c) -#define INT_FAST64_C(c) INT64_C(c) - -#define UINT_FAST8_C(c) UINT8_C(c) -#define UINT_FAST64_C(c) UINT64_C(c) - -#define INTMAX_C(c) INT64_C(c) -#define UINTMAX_C(c) UINT64_C(c) - -#include - -#endif - -/* Keep the kernel from trying to define these types... */ -#define __BIT_TYPES_DEFINED__ - -#endif /* _STDINT_H */ diff --git a/klibc/include/stdio.h b/klibc/include/stdio.h deleted file mode 100644 index d30622cfb2..0000000000 --- a/klibc/include/stdio.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * stdio.h - */ - -#ifndef _STDIO_H -#define _STDIO_H - -#include -#include -#include -#include - -/* This structure doesn't really exist, but it gives us something - to define FILE * with */ -struct _IO_file; -typedef struct _IO_file FILE; - -#ifndef EOF -# define EOF (-1) -#endif - -#ifndef BUFSIZ -# define BUFSIZ 4096 -#endif - -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 - -/* - * Convert between a FILE * and a file descriptor. We don't actually - * have any in-memory data, so we just abuse the pointer itself to - * hold the data. Note, however, that for file descriptors, -1 is - * error and 0 is a valid value; for FILE *, NULL (0) is error and - * non-NULL are valid. - */ -static __inline__ int fileno(FILE *__f) -{ - /* This should really be intptr_t, but size_t should be the same size */ - return (int)(size_t)__f - 1; -} - -/* This is a macro so it can be used as initializer */ -#define __create_file(__fd) ((FILE *)(size_t)((__fd) + 1)) - -#define stdin __create_file(0) -#define stdout __create_file(1) -#define stderr __create_file(2) - -__extern FILE *fopen(const char *, const char *); - -static __inline__ FILE *fdopen(int __fd, const char *__m) -{ - (void)__m; return __create_file(__fd); -} -static __inline__ int fclose(FILE *__f) -{ - extern int close(int); - return close(fileno(__f)); -} -static __inline__ int fseek(FILE *__f, off_t __o, int __w) -{ - extern off_t lseek(int, off_t, int); - return (lseek(fileno(__f), __o, __w) == (off_t)-1) ? -1 : 0; -} -static __inline__ off_t ftell(FILE *__f) -{ - extern off_t lseek(int, off_t, int); - return lseek(fileno(__f), 0, SEEK_CUR); -} - -__extern int fputs(const char *, FILE *); -__extern int puts(const char *); -__extern int fputc(int, FILE *); -#define putc(c,f) fputc((c),(f)) -#define putchar(c) fputc((c),stdout) - -__extern int fgetc(FILE *); -__extern char * fgets(char *, int, FILE *); -#define getc(f) fgetc(f) - -__extern size_t _fread(void *, size_t, FILE *); -__extern size_t _fwrite(const void *, size_t, FILE *); - -#ifndef __NO_FREAD_FWRITE_INLINES -extern __inline__ size_t -fread(void *__p, size_t __s, size_t __n, FILE *__f) -{ - return _fread(__p, __s*__n, __f)/__s; -} - -extern __inline__ size_t -fwrite(const void *__p, size_t __s, size_t __n, FILE *__f) -{ - return _fwrite(__p, __s*__n, __f)/__s; -} -#endif - -__extern int printf(const char *, ...); -__extern int vprintf(const char *, va_list); -__extern int fprintf(FILE *, const char *, ...); -__extern int vfprintf(FILE *, const char *, va_list); -__extern int sprintf(char *, const char *, ...); -__extern int vsprintf(char *, const char *, va_list); -__extern int snprintf(char *, size_t n, const char *, ...); -__extern int vsnprintf(char *, size_t n, const char *, va_list); -__extern int asprintf(char **, const char *, ...); -__extern int vasprintf(char **, const char *, va_list); - -/* No buffering, so no flushing needed */ -extern __inline__ int -fflush(FILE *__f) -{ - (void)__f; - return 0; -} - -__extern int sscanf(const char *, const char *, ...); -__extern int vsscanf(const char *, const char *, va_list); - -__extern void perror(const char *); - -__extern int rename(const char *, const char *); - -#endif /* _STDIO_H */ diff --git a/klibc/include/stdlib.h b/klibc/include/stdlib.h deleted file mode 100644 index 17efc30e5a..0000000000 --- a/klibc/include/stdlib.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * stdlib.h - */ - -#ifndef _STDLIB_H -#define _STDLIB_H - -#include -#include -#include - -#include - -#define EXIT_FAILURE 1 -#define EXIT_SUCCESS 0 - -static __inline__ __noreturn _Exit(int __n) { - __extern __noreturn _exit(int); - _exit(__n); - for(;;); /* Some gcc versions are stupid */ -} -__extern __noreturn abort(void); -static __inline__ int abs(int __n) { - return (__n < 0) ? -__n : __n; -} -__extern int system(const char * string); -__extern int atexit(void (*)(void)); -__extern int on_exit(void (*)(int, void *), void *); -__extern int atoi(const char *); -__extern long atol(const char *); -__extern long long atoll(const char *); -__extern __noreturn exit(int); -static __inline__ long labs(long __n) { - return (__n < 0L) ? -__n : __n; -} - -static __inline__ long long llabs(long long __n) { - return (__n < 0LL) ? -__n : __n; -} - -__extern long strtol(const char *, char **, int); -__extern long long strtoll(const char *, char **, int); -__extern unsigned long strtoul(const char *, char **, int); -__extern unsigned long long strtoull(const char *, char **, int); - -__extern char *getenv(const char *); -__extern int putenv(const char *); -__extern int setenv(const char *, const char *, int); -__extern int unsetenv(const char *); - -__extern void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); - - -__extern long jrand48(unsigned short *); -__extern long mrand48(void); -__extern long nrand48(unsigned short *); -__extern long lrand48(void); -__extern unsigned short *seed48(const unsigned short *); -__extern void srand48(long); - -#define RAND_MAX 0x7fffffff -static __inline__ int rand(void) { - return (int)lrand48(); -} -static __inline__ void srand(unsigned int __s) { - srand48(__s); -} -static __inline__ long random(void) -{ - return lrand48(); -} -static __inline__ void srandom(unsigned int __s) -{ - srand48(__s); -} - -/* Basic PTY functions. These only work if devpts is mounted! */ - -__extern int unlockpt(int); -__extern char *ptsname(int); -__extern int getpt(void); - -static __inline__ int grantpt(int __fd) -{ - (void)__fd; - return 0; /* devpts does this all for us! */ -} - -#endif /* _STDLIB_H */ diff --git a/klibc/include/string.h b/klibc/include/string.h deleted file mode 100644 index 319be4eb85..0000000000 --- a/klibc/include/string.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * string.h - */ - -#ifndef _STRING_H -#define _STRING_H - -#include -#include - -__extern void *memccpy(void *, const void *, int, size_t); -__extern void *memchr(const void *, int, size_t); -__extern void *memrchr(const void *, int, size_t); -__extern int memcmp(const void *, const void *, size_t); -__extern void *memcpy(void *, const void *, size_t); -__extern void *memmove(void *, const void *, size_t); -__extern void *memset(void *, int, size_t); -__extern void *memmem(const void *, size_t, const void *, size_t); -__extern void memswap(void *, void *, size_t); -__extern int strcasecmp(const char *, const char *); -__extern int strncasecmp(const char *, const char *, size_t); -__extern char *strcat(char *, const char *); -__extern char *strchr(const char *, int); -__extern char *index(const char *, int); -__extern char *strrchr(const char *, int); -__extern char *rindex(const char *, int); -__extern int strcmp(const char *, const char *); -__extern char *strcpy(char *, const char *); -__extern size_t strcspn(const char *, const char *); -__extern char *strdup(const char *); -__extern char *strndup(const char *, size_t); -__extern char *strerror(int); -__extern size_t strlen(const char *); -__extern size_t strnlen(const char *, size_t); -__extern char *strncat(char *, const char *, size_t); -__extern size_t strlcat(char *, const char *, size_t); -__extern int strncmp(const char *, const char *, size_t); -__extern char *strncpy(char *, const char *, size_t); -__extern size_t strlcpy(char *, const char *, size_t); -__extern char *strpbrk(const char *, const char *); -__extern char *strsep(char **, const char *); -__extern size_t strspn(const char *, const char *); -__extern char *strstr(const char *, const char *); -__extern char *strtok(char *, const char *); - -#endif /* _STRING_H */ diff --git a/klibc/include/sys/dirent.h b/klibc/include/sys/dirent.h deleted file mode 100644 index eec470ce1a..0000000000 --- a/klibc/include/sys/dirent.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * sys/dirent.h - */ - -#ifndef _SYS_DIRENT_H -#define _SYS_DIRENT_H - -#include - -/* The kernel calls this struct dirent64 */ -struct dirent { - uint64_t d_ino; - int64_t d_off; - unsigned short d_reclen; - unsigned char d_type; - char d_name[256]; -}; - -__extern int getdents(unsigned int, struct dirent *, unsigned int); - -#endif /* _SYS_DIRENT_H */ diff --git a/klibc/include/sys/elf32.h b/klibc/include/sys/elf32.h deleted file mode 100644 index 652de5bc5f..0000000000 --- a/klibc/include/sys/elf32.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * sys/elf32.h - */ - -#ifndef _SYS_ELF32_H -#define _SYS_ELF32_H - -#include - -/* ELF standard typedefs (yet more proof that was way overdue) */ -typedef uint16_t Elf32_Half; -typedef int16_t Elf32_SHalf; -typedef uint32_t Elf32_Word; -typedef int32_t Elf32_Sword; -typedef uint64_t Elf32_Xword; -typedef int64_t Elf32_Sxword; - -typedef uint32_t Elf32_Off; -typedef uint32_t Elf32_Addr; -typedef uint16_t Elf32_Section; - -/* Dynamic header */ - -typedef struct elf32_dyn { - Elf32_Sword d_tag; - union{ - Elf32_Sword d_val; - Elf32_Addr d_ptr; - } d_un; -} Elf32_Dyn; - -/* Relocations */ - -#define ELF32_R_SYM(x) ((x) >> 8) -#define ELF32_R_TYPE(x) ((x) & 0xff) - -typedef struct elf32_rel { - Elf32_Addr r_offset; - Elf32_Word r_info; -} Elf32_Rel; - -typedef struct elf32_rela { - Elf32_Addr r_offset; - Elf32_Word r_info; - Elf32_Sword r_addend; -} Elf32_Rela; - -/* Symbol */ - -typedef struct elf32_sym { - Elf32_Word st_name; - Elf32_Addr st_value; - Elf32_Word st_size; - unsigned char st_info; - unsigned char st_other; - Elf32_Half st_shndx; -} Elf32_Sym; - -/* Main file header */ - -typedef struct elf32_hdr { - unsigned char e_ident[EI_NIDENT]; - Elf32_Half e_type; - Elf32_Half e_machine; - Elf32_Word e_version; - Elf32_Addr e_entry; - Elf32_Off e_phoff; - Elf32_Off e_shoff; - Elf32_Word e_flags; - Elf32_Half e_ehsize; - Elf32_Half e_phentsize; - Elf32_Half e_phnum; - Elf32_Half e_shentsize; - Elf32_Half e_shnum; - Elf32_Half e_shstrndx; -} Elf32_Ehdr; - -/* Program header */ - -typedef struct elf32_phdr { - Elf32_Word p_type; - Elf32_Off p_offset; - Elf32_Addr p_vaddr; - Elf32_Addr p_paddr; - Elf32_Word p_filesz; - Elf32_Word p_memsz; - Elf32_Word p_flags; - Elf32_Word p_align; -} Elf32_Phdr; - - -/* Section header */ - -typedef struct elf32_shdr { - Elf32_Word sh_name; - Elf32_Word sh_type; - Elf32_Word sh_flags; - Elf32_Addr sh_addr; - Elf32_Off sh_offset; - Elf32_Word sh_size; - Elf32_Word sh_link; - Elf32_Word sh_info; - Elf32_Word sh_addralign; - Elf32_Word sh_entsize; -} Elf32_Shdr; - -/* Note header */ -typedef struct elf32_note { - Elf32_Word n_namesz; /* Name size */ - Elf32_Word n_descsz; /* Content size */ - Elf32_Word n_type; /* Content type */ -} Elf32_Nhdr; - -#endif /* _SYS_ELF32_H */ - diff --git a/klibc/include/sys/elf64.h b/klibc/include/sys/elf64.h deleted file mode 100644 index 750ddac4d9..0000000000 --- a/klibc/include/sys/elf64.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * sys/elf64.h - */ - -#ifndef _SYS_ELF64_H -#define _SYS_ELF64_H - -#include - -/* ELF standard typedefs (yet more proof that was way overdue) */ -typedef uint16_t Elf64_Half; -typedef int16_t Elf64_SHalf; -typedef uint32_t Elf64_Word; -typedef int32_t Elf64_Sword; -typedef uint64_t Elf64_Xword; -typedef int64_t Elf64_Sxword; - -typedef uint64_t Elf64_Off; -typedef uint64_t Elf64_Addr; -typedef uint16_t Elf64_Section; - -/* Dynamic header */ - -typedef struct elf64_dyn { - Elf64_Sxword d_tag; - union{ - Elf64_Xword d_val; - Elf64_Addr d_ptr; - } d_un; -} Elf64_Dyn; - -/* Relocations */ - -#define ELF64_R_SYM(x) ((x) >> 32) -#define ELF64_R_TYPE(x) ((x) & 0xffffffff) - -typedef struct elf64_rel { - Elf64_Addr r_offset; - Elf64_Xword r_info; -} Elf64_Rel; - -typedef struct elf64_rela { - Elf64_Addr r_offset; - Elf64_Xword r_info; - Elf64_Sxword r_addend; -} Elf64_Rela; - -/* Symbol */ - -typedef struct elf64_sym { - Elf64_Word st_name; - unsigned char st_info; - unsigned char st_other; - Elf64_Half st_shndx; - Elf64_Addr st_value; - Elf64_Xword st_size; -} Elf64_Sym; - -/* Main file header */ - -typedef struct elf64_hdr { - unsigned char e_ident[EI_NIDENT]; - Elf64_Half e_type; - Elf64_Half e_machine; - Elf64_Word e_version; - Elf64_Addr e_entry; - Elf64_Off e_phoff; - Elf64_Off e_shoff; - Elf64_Word e_flags; - Elf64_Half e_ehsize; - Elf64_Half e_phentsize; - Elf64_Half e_phnum; - Elf64_Half e_shentsize; - Elf64_Half e_shnum; - Elf64_Half e_shstrndx; -} Elf64_Ehdr; - -/* Program header */ - -typedef struct elf64_phdr { - Elf64_Word p_type; - Elf64_Word p_flags; - Elf64_Off p_offset; - Elf64_Addr p_vaddr; - Elf64_Addr p_paddr; - Elf64_Xword p_filesz; - Elf64_Xword p_memsz; - Elf64_Xword p_align; -} Elf64_Phdr; - - -/* Section header */ - -typedef struct elf64_shdr { - Elf64_Word sh_name; - Elf64_Word sh_type; - Elf64_Xword sh_flags; - Elf64_Addr sh_addr; - Elf64_Off sh_offset; - Elf64_Xword sh_size; - Elf64_Word sh_link; - Elf64_Word sh_info; - Elf64_Xword sh_addralign; - Elf64_Xword sh_entsize; -} Elf64_Shdr; - -/* Note header */ -typedef struct elf64_note { - Elf64_Word n_namesz; /* Name size */ - Elf64_Word n_descsz; /* Content size */ - Elf64_Word n_type; /* Content type */ -} Elf64_Nhdr; - -#endif /* _SYS_ELF64_H */ - diff --git a/klibc/include/sys/elfcommon.h b/klibc/include/sys/elfcommon.h deleted file mode 100644 index d25804e483..0000000000 --- a/klibc/include/sys/elfcommon.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * sys/elfcommon.h - */ - -#ifndef _SYS_ELFCOMMON_H -#define _SYS_ELFCOMMON_H - -#include - -/* Segment types */ -#define PT_NULL 0 -#define PT_LOAD 1 -#define PT_DYNAMIC 2 -#define PT_INTERP 3 -#define PT_NOTE 4 -#define PT_SHLIB 5 -#define PT_PHDR 6 -#define PT_LOOS 0x60000000 -#define PT_HIOS 0x6fffffff -#define PT_LOPROC 0x70000000 -#define PT_HIPROC 0x7fffffff -#define PT_GNU_EH_FRAME 0x6474e550 /* Extension, eh? */ - -/* ELF file types */ -#define ET_NONE 0 -#define ET_REL 1 -#define ET_EXEC 2 -#define ET_DYN 3 -#define ET_CORE 4 -#define ET_LOPROC 0xff00 -#define ET_HIPROC 0xffff - -/* ELF machine types */ -#define EM_NONE 0 -#define EM_M32 1 -#define EM_SPARC 2 -#define EM_386 3 -#define EM_68K 4 -#define EM_88K 5 -#define EM_486 6 /* Not used in Linux at least */ -#define EM_860 7 -#define EM_MIPS 8 /* R3k, bigendian(?) */ -#define EM_MIPS_RS4_BE 10 /* R4k BE */ -#define EM_PARISC 15 -#define EM_SPARC32PLUS 18 -#define EM_PPC 20 -#define EM_PPC64 21 -#define EM_S390 22 -#define EM_SH 42 -#define EM_SPARCV9 43 /* v9 = SPARC64 */ -#define EM_H8_300H 47 -#define EM_H8S 48 -#define EM_IA_64 50 /* Itanic */ -#define EM_X86_64 62 -#define EM_CRIS 76 -#define EM_V850 87 -#define EM_ALPHA 0x9026 /* Interrim Alpha that stuck around */ -#define EM_CYGNUS_V850 0x9080 /* Old v850 ID used by Cygnus */ -#define EM_S390_OLD 0xA390 /* Obsolete interrim value for S/390 */ - -/* Dynamic type values */ -#define DT_NULL 0 -#define DT_NEEDED 1 -#define DT_PLTRELSZ 2 -#define DT_PLTGOT 3 -#define DT_HASH 4 -#define DT_STRTAB 5 -#define DT_SYMTAB 6 -#define DT_RELA 7 -#define DT_RELASZ 8 -#define DT_RELAENT 9 -#define DT_STRSZ 10 -#define DT_SYMENT 11 -#define DT_INIT 12 -#define DT_FINI 13 -#define DT_SONAME 14 -#define DT_RPATH 15 -#define DT_SYMBOLIC 16 -#define DT_REL 17 -#define DT_RELSZ 18 -#define DT_RELENT 19 -#define DT_PLTREL 20 -#define DT_DEBUG 21 -#define DT_TEXTREL 22 -#define DT_JMPREL 23 -#define DT_LOPROC 0x70000000 -#define DT_HIPROC 0x7fffffff - -/* Auxilliary table entries */ -#define AT_NULL 0 /* end of vector */ -#define AT_IGNORE 1 /* entry should be ignored */ -#define AT_EXECFD 2 /* file descriptor of program */ -#define AT_PHDR 3 /* program headers for program */ -#define AT_PHENT 4 /* size of program header entry */ -#define AT_PHNUM 5 /* number of program headers */ -#define AT_PAGESZ 6 /* system page size */ -#define AT_BASE 7 /* base address of interpreter */ -#define AT_FLAGS 8 /* flags */ -#define AT_ENTRY 9 /* entry point of program */ -#define AT_NOTELF 10 /* program is not ELF */ -#define AT_UID 11 /* real uid */ -#define AT_EUID 12 /* effective uid */ -#define AT_GID 13 /* real gid */ -#define AT_EGID 14 /* effective gid */ -#define AT_PLATFORM 15 /* string identifying CPU for optimizations */ -#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */ -#define AT_CLKTCK 17 /* frequency at which times() increments */ -/* 18..22 = ? */ -#define AT_SECURE 23 /* secure mode boolean */ - -/* Program header permission flags */ -#define PF_X 0x1 -#define PF_W 0x2 -#define PF_R 0x4 - -/* Section header types */ -#define SHT_NULL 0 -#define SHT_PROGBITS 1 -#define SHT_SYMTAB 2 -#define SHT_STRTAB 3 -#define SHT_RELA 4 -#define SHT_HASH 5 -#define SHT_DYNAMIC 6 -#define SHT_NOTE 7 -#define SHT_NOBITS 8 -#define SHT_REL 9 -#define SHT_SHLIB 10 -#define SHT_DYNSYM 11 -#define SHT_NUM 12 -#define SHT_LOPROC 0x70000000 -#define SHT_HIPROC 0x7fffffff -#define SHT_LOUSER 0x80000000 -#define SHT_HIUSER 0xffffffff - -/* Section header flags */ -#define SHF_WRITE 0x1 -#define SHF_ALLOC 0x2 -#define SHF_EXECINSTR 0x4 -#define SHF_MASKPROC 0xf0000000 - -/* Special section numbers */ -#define SHN_UNDEF 0 -#define SHN_LORESERVE 0xff00 -#define SHN_LOPROC 0xff00 -#define SHN_HIPROC 0xff1f -#define SHN_ABS 0xfff1 -#define SHN_COMMON 0xfff2 -#define SHN_HIRESERVE 0xffff - -/* Lenght of magic at the start of a file */ -#define EI_NIDENT 16 - -/* Magic number constants... */ -#define EI_MAG0 0 /* e_ident[] indexes */ -#define EI_MAG1 1 -#define EI_MAG2 2 -#define EI_MAG3 3 -#define EI_CLASS 4 -#define EI_DATA 5 -#define EI_VERSION 6 -#define EI_OSABI 7 -#define EI_PAD 8 - -#define ELFMAG0 0x7f /* EI_MAG */ -#define ELFMAG1 'E' -#define ELFMAG2 'L' -#define ELFMAG3 'F' -#define ELFMAG "\177ELF" -#define SELFMAG 4 - -#define ELFCLASSNONE 0 /* EI_CLASS */ -#define ELFCLASS32 1 -#define ELFCLASS64 2 -#define ELFCLASSNUM 3 - -#define ELFDATANONE 0 /* e_ident[EI_DATA] */ -#define ELFDATA2LSB 1 -#define ELFDATA2MSB 2 - -#define EV_NONE 0 /* e_version, EI_VERSION */ -#define EV_CURRENT 1 -#define EV_NUM 2 - -#define ELFOSABI_NONE 0 -#define ELFOSABI_LINUX 3 - -#endif /* _SYS_ELFCOMMON_H */ - diff --git a/klibc/include/sys/fsuid.h b/klibc/include/sys/fsuid.h deleted file mode 100644 index 823486b776..0000000000 --- a/klibc/include/sys/fsuid.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * sys/fsuid.h - */ - -#ifndef _SYS_FSUID_H -#define _SYS_FSUID_H - -#include -#include - -__extern int setfsuid(uid_t); -__extern int setfsgid(gid_t); - -#endif /* _SYS_FSUID_H */ diff --git a/klibc/include/sys/inotify.h b/klibc/include/sys/inotify.h deleted file mode 100644 index 74fc714190..0000000000 --- a/klibc/include/sys/inotify.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * sys/inotify.h - */ - -#ifndef _SYS_INOTIFY_H -#define _SYS_INOTIFY_H - -#include -#include -#include - -__extern int inotify_init(void); -__extern int inotify_add_watch(int, const char *, __u32); -__extern int inotify_rm_watch(int, __u32); - -#endif /* _SYS_INOTIFY_H */ diff --git a/klibc/include/sys/ioctl.h b/klibc/include/sys/ioctl.h deleted file mode 100644 index b0cee4c02c..0000000000 --- a/klibc/include/sys/ioctl.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * sys/ioctl.h - */ - -#ifndef _SYS_IOCTL_H -#define _SYS_IOCTL_H - -#include -#include -#include - -__extern int ioctl(int, int, void *); - -#endif /* _SYS_IOCTL_H */ diff --git a/klibc/include/sys/klog.h b/klibc/include/sys/klog.h deleted file mode 100644 index 0fc5f5d945..0000000000 --- a/klibc/include/sys/klog.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * sys/klog.h - */ - -#ifndef _SYS_KLOG_H -#define _SYS_KLOG_H - -#include - -#define KLOG_CLOSE 0 -#define KLOG_OPEN 1 -#define KLOG_READ 2 -#define KLOG_READ_ALL 3 -#define KLOG_READ_CLEAR 4 -#define KLOG_CLEAR 5 -#define KLOG_DISABLE 6 -#define KLOG_ENABLE 7 -#define KLOG_SETLEVEL 8 -#define KLOG_UNREADSIZE 9 -#define KLOG_WRITE 10 - -__extern int klogctl(int, char *, int); - -#endif /* _SYS_KLOG_H */ diff --git a/klibc/include/sys/mman.h b/klibc/include/sys/mman.h deleted file mode 100644 index 7f8f3e2f96..0000000000 --- a/klibc/include/sys/mman.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * sys/mman.h - */ - -#ifndef _SYS_MMAN_H -#define _SYS_MMAN_H - -#include -#include -#include -#include /* For PAGE_SIZE */ - -#define MAP_FAILED ((void *)-1) - -__extern void *mmap(void *, size_t, int, int, int, off_t); -__extern int munmap(void *, size_t); -__extern void *mremap(void *, size_t, size_t, unsigned long); -__extern int msync(const void *, size_t, int); -__extern int mprotect(const void *, size_t, int); -__extern int mlockall(int); -__extern int munlockall(void); -__extern int mlock(const void *, size_t); -__extern int munlock(const void *, size_t); - -#endif /* _SYS_MMAN_H */ diff --git a/klibc/include/sys/mount.h b/klibc/include/sys/mount.h deleted file mode 100644 index 0e1bce49bf..0000000000 --- a/klibc/include/sys/mount.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * sys/mount.h - */ - -#ifndef _SYS_MOUNT_H -#define _SYS_MOUNT_H - -#include -#include - -/* - * These are the fs-independent mount-flags: up to 32 flags are supported - */ -#define MS_RDONLY 1 /* Mount read-only */ -#define MS_NOSUID 2 /* Ignore suid and sgid bits */ -#define MS_NODEV 4 /* Disallow access to device special files */ -#define MS_NOEXEC 8 /* Disallow program execution */ -#define MS_SYNCHRONOUS 16 /* Writes are synced at once */ -#define MS_REMOUNT 32 /* Alter flags of a mounted FS */ -#define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */ -#define MS_DIRSYNC 128 /* Directory modifications are synchronous */ -#define MS_NOATIME 1024 /* Do not update access times. */ -#define MS_NODIRATIME 2048 /* Do not update directory access times */ -#define MS_BIND 4096 -#define MS_MOVE 8192 -#define MS_REC 16384 -#define MS_VERBOSE 32768 -#define MS_POSIXACL (1<<16) /* VFS does not apply the umask */ -#define MS_ONE_SECOND (1<<17) /* fs has 1 sec a/m/ctime resolution */ -#define MS_ACTIVE (1<<30) -#define MS_NOUSER (1<<31) - -/* - * Superblock flags that can be altered by MS_REMOUNT - */ -#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME|MS_NODIRATIME) - -/* - * Old magic mount flag and mask - */ -#define MS_MGC_VAL 0xC0ED0000 -#define MS_MGC_MSK 0xffff0000 - -/* - * umount2() flags - */ -#define MNT_FORCE 1 /* Forcibly unmount */ -#define MNT_DETACH 2 /* Detach from tree only */ -#define MNT_EXPIRE 4 /* Mark for expiry */ - -/* - * Block device ioctls - */ -#define BLKROSET _IO(0x12, 93) /* Set device read-only (0 = read-write). */ -#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */ -#define BLKRRPART _IO(0x12, 95) /* Re-read partition table. */ -#define BLKGETSIZE _IO(0x12, 96) /* Return device size. */ -#define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */ -#define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */ -#define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */ - -/* - * Prototypes - */ -__extern int mount(const char *, const char *, - const char *, unsigned long, - const void *); -__extern int umount(const char *); -__extern int umount2(const char *, int); -__extern int pivot_root(const char *, const char *); - -#endif /* _SYS_MOUNT_H */ diff --git a/klibc/include/sys/param.h b/klibc/include/sys/param.h deleted file mode 100644 index 63a0661f43..0000000000 --- a/klibc/include/sys/param.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * sys/param.h - */ - -#ifndef _SYS_PARAM_H -#define _SYS_PARAM_H - -#include -#include - -#endif /* _SYS_PARAM_H */ diff --git a/klibc/include/sys/reboot.h b/klibc/include/sys/reboot.h deleted file mode 100644 index eaf56610d7..0000000000 --- a/klibc/include/sys/reboot.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * sys/reboot.h - */ - -#ifndef _SYS_REBOOT_H -#define _SYS_REBOOT_H - -#include -#include - -/* glibc names these constants differently; allow both versions */ - -#define RB_AUTOBOOT LINUX_REBOOT_CMD_RESTART -#define RB_HALT_SYSTEM LINUX_REBOOT_CMD_HALT -#define RB_ENABLE_CAD LINUX_REBOOT_CMD_CAD_ON -#define RB_DISABLE_CAD LINUX_REBOOT_CMD_CAD_OFF -#define RB_POWER_OFF LINUX_REBOOT_CMD_POWER_OFF - -/* glibc-ish one-argument version */ -__extern int reboot(int); - -/* Native four-argument system call */ -__extern int __reboot(int, int, int, void *); - -#endif /* _SYS_REBOOT_H */ diff --git a/klibc/include/sys/resource.h b/klibc/include/sys/resource.h deleted file mode 100644 index ef14bde9f6..0000000000 --- a/klibc/include/sys/resource.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * sys/resource.h - */ - -#ifndef _SYS_RESOURCE_H -#define _SYS_RESOURCE_H - -#include -#include /* MUST be included before linux/resource.h */ -#include - -__extern int getpriority(int, int); -__extern int setpriority(int, int, int); - -#endif /* _SYS_RESOURCE_H */ diff --git a/klibc/include/sys/select.h b/klibc/include/sys/select.h deleted file mode 100644 index 361a1a53b0..0000000000 --- a/klibc/include/sys/select.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * sys/select.h - */ - -#ifndef _SYS_SELECT_H -#define _SYS_SELECT_H - -#include -#include -#include - -__extern int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); - -#endif /* _SYS_SELECT_H */ diff --git a/klibc/include/sys/socket.h b/klibc/include/sys/socket.h deleted file mode 100644 index cbc2b89591..0000000000 --- a/klibc/include/sys/socket.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * sys/socket.h - */ - -#ifndef _SYS_SOCKET_H -#define _SYS_SOCKET_H - -#include -#include -#include - -/* For some reason these may be protected by __KERNEL__ in asm/socket.h */ -#ifndef SOCK_STREAM -# define SOCK_STREAM 1 -# define SOCK_DGRAM 2 -# define SOCK_RAW 3 -# define SOCK_RDM 4 -# define SOCK_SEQPACKET 5 -# define SOCK_PACKET 10 -#endif - -#ifdef __i386__ -# define __socketcall __extern __cdecl -#else -# define __socketcall __extern -#endif - -typedef int socklen_t; - -__socketcall int socket(int, int, int); -__socketcall int bind(int, struct sockaddr *, int); -__socketcall int connect(int, struct sockaddr *, socklen_t); -__socketcall int listen(int, int); -__socketcall int accept(int, struct sockaddr *, socklen_t *); -__socketcall int getsockname(int, struct sockaddr *, socklen_t *); -__socketcall int getpeername(int, struct sockaddr *, socklen_t *); -__socketcall int socketpair(int, int, int, int *); -__extern int send(int, const void *, size_t, unsigned int); -__socketcall int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t); -__extern int recv(int, void *, size_t, unsigned int); -__socketcall int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *); -__socketcall int shutdown(int, int); -__socketcall int setsockopt(int, int, int, const void *, socklen_t); -__socketcall int getsockopt(int, int, int, void *, socklen_t *); -__socketcall int sendmsg(int, const struct msghdr *, unsigned int); -__socketcall int recvmsg(int, struct msghdr *, unsigned int); - -#undef __socketcall - -#endif /* _SYS_SOCKET_H */ diff --git a/klibc/include/sys/socketcalls.h b/klibc/include/sys/socketcalls.h deleted file mode 100644 index dac9f9aab6..0000000000 --- a/klibc/include/sys/socketcalls.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * sys/socketcalls.h - */ - -#ifndef _SYS_SOCKETCALLS_H -#define _SYS_SOCKETCALLS_H - -/* socketcalls by number, since isn't usable for assembly */ - -#define SYS_SOCKET 1 /* sys_socket(2) */ -#define SYS_BIND 2 /* sys_bind(2) */ -#define SYS_CONNECT 3 /* sys_connect(2) */ -#define SYS_LISTEN 4 /* sys_listen(2) */ -#define SYS_ACCEPT 5 /* sys_accept(2) */ -#define SYS_GETSOCKNAME 6 /* sys_getsockname(2) */ -#define SYS_GETPEERNAME 7 /* sys_getpeername(2) */ -#define SYS_SOCKETPAIR 8 /* sys_socketpair(2) */ -#define SYS_SEND 9 /* sys_send(2) */ -#define SYS_RECV 10 /* sys_recv(2) */ -#define SYS_SENDTO 11 /* sys_sendto(2) */ -#define SYS_RECVFROM 12 /* sys_recvfrom(2) */ -#define SYS_SHUTDOWN 13 /* sys_shutdown(2) */ -#define SYS_SETSOCKOPT 14 /* sys_setsockopt(2) */ -#define SYS_GETSOCKOPT 15 /* sys_getsockopt(2) */ -#define SYS_SENDMSG 16 /* sys_sendmsg(2) */ -#define SYS_RECVMSG 17 /* sys_recvmsg(2) */ - -#endif /* _SYS_SOCKETCALLS_H */ diff --git a/klibc/include/sys/stat.h b/klibc/include/sys/stat.h deleted file mode 100644 index 1bf6a75f79..0000000000 --- a/klibc/include/sys/stat.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * sys/stat.h - */ - -#ifndef _SYS_STAT_H -#define _SYS_STAT_H - -#include -#include -#include /* For struct timespec */ -#include -#include - -#ifdef _STATBUF_ST_NSEC - /* struct stat has struct timespec instead of time_t */ -# define st_atime st_atim.tv_sec -# define st_mtime st_mtim.tv_sec -# define st_ctime st_ctim.tv_sec -#endif - -__extern int stat(const char *, struct stat *); -__extern int fstat(int, struct stat *); -__extern int lstat(const char *, struct stat *); -__extern mode_t umask(mode_t); -__extern int mknod(const char *, mode_t, dev_t); -static __inline__ int mkfifo(const char *__p, mode_t __m) -{ - return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t)0); -} - -#endif /* _SYS_STAT_H */ diff --git a/klibc/include/sys/statfs.h b/klibc/include/sys/statfs.h deleted file mode 100644 index 53b3b5e4da..0000000000 --- a/klibc/include/sys/statfs.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/klibc/include/sys/syscall.h b/klibc/include/sys/syscall.h deleted file mode 100644 index c2c7684c4a..0000000000 --- a/klibc/include/sys/syscall.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * sys/syscall.h - * - * Generic system call interface macros - */ -#ifndef _SYS_SYSCALL_H -#define _SYS_SYSCALL_H - -#include -#include -#include - -/* Many architectures have incomplete, defective or non-applicable - syscall macros */ -#include - -#endif /* _SYS_SYSCALL_H */ diff --git a/klibc/include/sys/sysinfo.h b/klibc/include/sys/sysinfo.h deleted file mode 100644 index 4051c6897a..0000000000 --- a/klibc/include/sys/sysinfo.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * sys/sysinfo.h - */ - -#ifndef _SYS_SYSINFO_H -#define _SYS_SYSINFO_H - -#include - -extern int sysinfo (struct sysinfo *info); - -#endif /* _SYS_SYSINFO_H */ diff --git a/klibc/include/sys/sysmacros.h b/klibc/include/sys/sysmacros.h deleted file mode 100644 index 7f1e0822b3..0000000000 --- a/klibc/include/sys/sysmacros.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * sys/sysmacros.h - * - * Constructs to create and pick apart dev_t. This applies to the Linux 2.6 - * 32-bit dev_t format. - */ - -#ifndef _SYS_SYSMACROS_H -#define _SYS_SYSMACROS_H - -#ifndef _SYS_TYPES_H -# include -#endif - -static __inline__ int major(dev_t __d) -{ - return (__d >> 8) & 0xfff; -} - -static __inline__ int minor(dev_t __d) -{ - return (__d & 0xff) | ((__d >> 12) & 0xfff00); -} - -static __inline__ dev_t makedev(int __ma, int __mi) -{ - return ((__ma & 0xfff) << 8) | (__mi & 0xff) | ((__mi & 0xfff00) << 12); -} - -#endif /* _SYS_SYSMACROS_H */ - diff --git a/klibc/include/sys/time.h b/klibc/include/sys/time.h deleted file mode 100644 index 2767a1bce3..0000000000 --- a/klibc/include/sys/time.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * sys/time.h - */ - -#ifndef _SYS_TIME_H -#define _SYS_TIME_H - -#include -#include -#include - -__extern int gettimeofday(struct timeval *, struct timezone *); -__extern int settimeofday(const struct timeval *, const struct timezone *); -__extern int getitimer(int, struct itimerval *); -__extern int setitimer(int, const struct itimerval *, struct itimerval *); -__extern int utimes(const char *, const struct timeval *); - -#endif /* _SYS_TIME_H */ diff --git a/klibc/include/sys/times.h b/klibc/include/sys/times.h deleted file mode 100644 index dd86531669..0000000000 --- a/klibc/include/sys/times.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * sys/times.h - */ - -#ifndef _SYS_TIMES_H -#define _SYS_TIMES_H - -#include -#include -#include - -__extern clock_t times(struct tms *); - -#endif /* _SYS_TIMES_H */ diff --git a/klibc/include/sys/types.h b/klibc/include/sys/types.h deleted file mode 100644 index ddec242922..0000000000 --- a/klibc/include/sys/types.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * sys/types.h - */ - -#ifndef _SYS_TYPES_H -#define _SYS_TYPES_H - -#include -#include -#include - -#define _SSIZE_T -typedef ptrdiff_t ssize_t; - -#include -#include - -/* Keeps linux/types.h from getting included elsewhere */ -#define _LINUX_TYPES_H - -typedef __kernel_fd_set fd_set; -typedef uint32_t dev_t; -typedef __kernel_ino_t ino_t; -typedef __kernel_mode_t mode_t; -typedef __kernel_nlink_t nlink_t; -typedef __kernel_loff_t off_t; -typedef __kernel_loff_t loff_t; -typedef __kernel_pid_t pid_t; -typedef __kernel_daddr_t daddr_t; -typedef __kernel_key_t key_t; -typedef __kernel_suseconds_t suseconds_t; -/* typedef __kernel_timer_t timer_t; */ -typedef int timer_t; - -typedef __kernel_uid32_t uid_t; -typedef __kernel_gid32_t gid_t; - -typedef __kernel_fsid_t fsid_t; - -/* - * The following typedefs are also protected by individual ifdefs for - * historical reasons: - */ -#ifndef _SIZE_T -#define _SIZE_T -typedef __kernel_size_t size_t; -#endif - -#ifndef _SSIZE_T -#define _SSIZE_T -typedef __kernel_ssize_t ssize_t; -#endif - -#ifndef _PTRDIFF_T -#define _PTRDIFF_T -typedef __kernel_ptrdiff_t ptrdiff_t; -#endif - -#ifndef _TIME_T -#define _TIME_T -typedef __kernel_time_t time_t; -#endif - -#ifndef _CLOCK_T -#define _CLOCK_T -typedef __kernel_clock_t clock_t; -#endif - -#ifndef _CADDR_T -#define _CADDR_T -typedef __kernel_caddr_t caddr_t; -#endif - -/* bsd */ -typedef unsigned char u_char; -typedef unsigned short u_short; -typedef unsigned int u_int; -typedef unsigned long u_long; - -/* sysv */ -typedef unsigned char unchar; -typedef unsigned short ushort; -typedef unsigned int uint; -typedef unsigned long ulong; - -/* Linux-specific? */ -typedef uint8_t u_int8_t; -typedef uint16_t u_int16_t; -typedef uint32_t u_int32_t; -typedef uint64_t u_int64_t; - -typedef uint16_t __bitwise __le16; -typedef uint16_t __bitwise __be16; -typedef uint32_t __bitwise __le32; -typedef uint32_t __bitwise __be32; -typedef uint64_t __bitwise __le64; -typedef uint64_t __bitwise __be64; - -/* - * Some apps want this in - */ -#include - -#endif diff --git a/klibc/include/sys/uio.h b/klibc/include/sys/uio.h deleted file mode 100644 index fc2525d11a..0000000000 --- a/klibc/include/sys/uio.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * sys/uio.h - */ - -#ifndef _SYS_UIO_H -#define _SYS_UIO_H - -#include -#include -#include - -__extern int readv(int, const struct iovec *, int); -__extern int writev(int, const struct iovec *, int); - -#endif /* _SYS_UIO_H */ diff --git a/klibc/include/sys/un.h b/klibc/include/sys/un.h deleted file mode 100644 index df42d719f7..0000000000 --- a/klibc/include/sys/un.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * - */ - -#ifndef _SYS_UN_H -#define _SYS_UN_H - -#include - -#endif /* _SYS_UN_H */ diff --git a/klibc/include/sys/utime.h b/klibc/include/sys/utime.h deleted file mode 100644 index d1d635d242..0000000000 --- a/klibc/include/sys/utime.h +++ /dev/null @@ -1,10 +0,0 @@ -/* - * sys/utime.h - */ - -#ifndef _SYS_UTIME_H -#define _SYS_UTIME_H - -#include - -#endif /* _SYS_UTIME_H */ diff --git a/klibc/include/sys/utsname.h b/klibc/include/sys/utsname.h deleted file mode 100644 index f2990f5711..0000000000 --- a/klibc/include/sys/utsname.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * sys/utsname.h - */ - -#ifndef _SYS_UTSNAME_H -#define _SYS_UTSNAME_H - -#include - -#define SYS_NMLN 65 - -struct utsname { - char sysname[SYS_NMLN]; - char nodename[SYS_NMLN]; - char release[SYS_NMLN]; - char version[SYS_NMLN]; - char machine[SYS_NMLN]; - char domainname[SYS_NMLN]; -}; - -__extern int uname(struct utsname *); - -#endif /* _SYS_UTSNAME_H */ diff --git a/klibc/include/sys/vfs.h b/klibc/include/sys/vfs.h deleted file mode 100644 index cf5aaf9107..0000000000 --- a/klibc/include/sys/vfs.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * sys/vfs.h - */ - -#ifndef _SYS_VFS_H -#define _SYS_VFS_H - -#include -#include -#include -#include - -/* struct statfs64 -- there seems to be two standards - - one for 32 and one for 64 bits, and they're incompatible... */ - -#if _BITSIZE == 32 || defined(__s390__) - -struct statfs { - uint32_t f_type; - uint32_t f_bsize; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_bavail; - uint64_t f_files; - uint64_t f_ffree; - __kernel_fsid_t f_fsid; - uint32_t f_namelen; - uint32_t f_frsize; - uint32_t f_spare[5]; -}; - -#else /* _BITSIZE == 64 */ - -struct statfs { - uint64_t f_type; - uint64_t f_bsize; - uint64_t f_blocks; - uint64_t f_bfree; - uint64_t f_bavail; - uint64_t f_files; - uint64_t f_ffree; - __kernel_fsid_t f_fsid; - uint64_t f_namelen; - uint64_t f_frsize; - uint64_t f_spare[5]; -}; - -#endif /* _BITSIZE */ - -__extern int statfs(const char *, struct statfs *); -__extern int fstatfs(int, struct statfs *); - -/* Various filesystem types */ -#define ADFS_SUPER_MAGIC 0xadf5 -#define AFFS_SUPER_MAGIC 0xadff -#define AFS_FS_MAGIC 0x6B414653 /* 'kAFS' */ -#define AUTOFS_SUPER_MAGIC 0x0187 -#define BFS_MAGIC 0x1BADFACE -#define CAPIFS_SUPER_MAGIC 0x434e -#define CIFS_MAGIC_NUMBER 0xFF534D42 -#define CODA_SUPER_MAGIC 0x73757245 -#define CRAMFS_MAGIC 0x28cd3d45 -#define DEVFS_SUPER_MAGIC 0x1373 -#define DEVPTS_SUPER_MAGIC 0x1cd1 -#define EFS_SUPER_MAGIC 0x414A53 -#define EVENTPOLLFS_MAGIC 0x03111965 -#define EXT2_SUPER_MAGIC 0xEF53 -#define EXT3_SUPER_MAGIC 0xEF53 -#define GADGETFS_MAGIC 0xaee71ee7 -#define HFSPLUS_SUPER_MAGIC 0x482b -#define HFS_MFS_SUPER_MAGIC 0xD2D7 /* MFS MDB (super block) */ -#define HFS_SUPER_MAGIC 0x4244 /* "BD": HFS MDB (super block) */ -#define HPFS_SUPER_MAGIC 0xf995e849 -#define HUGETLBFS_MAGIC 0x958458f6 -#define HWGFS_MAGIC 0x12061983 -#define IBMASMFS_MAGIC 0x66726f67 -#define ISOFS_SUPER_MAGIC 0x9660 -#define JFFS2_SUPER_MAGIC 0x72b6 -#define JFFS_MAGIC_BITMASK 0x34383931 /* "1984" */ -#define JFFS_MAGIC_SB_BITMASK 0x07c0 /* 1984 */ -#define JFS_SUPER_MAGIC 0x3153464a /* "JFS1" */ -#define MINIX2_SUPER_MAGIC 0x2468 /* minix V2 fs */ -#define MINIX2_SUPER_MAGIC2 0x2478 /* minix V2 fs, 30 char names */ -#define MINIX_SUPER_MAGIC 0x137F /* original minix fs */ -#define MINIX_SUPER_MAGIC2 0x138F /* minix fs, 30 char names */ -#define MSDOS_SUPER_MAGIC 0x4d44 /* MD */ -#define NCP_SUPER_MAGIC 0x564c -#define NFS_SUPER_MAGIC 0x6969 -#define NFS_SUPER_MAGIC 0x6969 -#define OPENPROM_SUPER_MAGIC 0x9fa1 -#define OPROFILEFS_MAGIC 0x6f70726f -#define PFMFS_MAGIC 0xa0b4d889 -#define PIPEFS_MAGIC 0x50495045 -#define PROC_SUPER_MAGIC 0x9fa0 -#define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */ -#define RAMFS_MAGIC 0x858458f6 -#define REISERFS_SUPER_MAGIC 0x52654973 -#define ROMFS_MAGIC 0x7275 -#define SMB_SUPER_MAGIC 0x517B -#define SOCKFS_MAGIC 0x534F434B -#define SYSFS_MAGIC 0x62656572 -#define TMPFS_MAGIC 0x01021994 -#define UDF_SUPER_MAGIC 0x15013346 -#define UFS_MAGIC 0x00011954 -#define UFS_MAGIC_4GB 0x05231994 /* fs > 4 GB && fs_featurebits */ -#define UFS_MAGIC_FEA 0x00195612 /* fs_featurebits supported */ -#define UFS_MAGIC_LFN 0x00095014 /* fs supports filenames > 14 chars */ -#define UFS_MAGIC_SEC 0x00612195 /* B1 security fs */ -#define USBDEVICE_SUPER_MAGIC 0x9fa2 -#define VXFS_SUPER_MAGIC 0xa501FCF5 - -#endif /* _SYS_VFS_H */ diff --git a/klibc/include/sys/wait.h b/klibc/include/sys/wait.h deleted file mode 100644 index 4cfafc9408..0000000000 --- a/klibc/include/sys/wait.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * sys/wait.h - */ - -#ifndef _SYS_WAIT_H -#define _SYS_WAIT_H - -#include -#include -#include - -#include - -#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) -#define WTERMSIG(s) ((s) & 0x7f) -#define WIFEXITED(s) (WTERMSIG(s) == 0) -#define WIFSTOPPED(s) (WTERMSIG(s) == 0x7f) -/* Ugly hack to avoid multiple evaluation of "s" */ -#define WIFSIGNALED(s) (WTERMSIG((s)+1) >= 2) -#define WCOREDUMP(s) ((s) & 0x80) -#define WSTOPSIG(s) WEXITSTATUS(s) - -__extern pid_t wait(int *); -__extern pid_t waitpid(pid_t, int *, int); -__extern pid_t wait3(int *, int, struct rusage *); -__extern pid_t wait4(pid_t, int *, int, struct rusage *); - -#endif /* _SYS_WAIT_H */ diff --git a/klibc/include/syslog.h b/klibc/include/syslog.h deleted file mode 100644 index 061dbcd5a7..0000000000 --- a/klibc/include/syslog.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * syslog.h - */ - -#ifndef _SYSLOG_H -#define _SYSLOG_H - -#include -#include - -/* Alert levels */ -#define LOG_EMERG 0 -#define LOG_ALERT 1 -#define LOG_CRIT 2 -#define LOG_ERR 3 -#define LOG_WARNING 4 -#define LOG_NOTICE 5 -#define LOG_INFO 6 -#define LOG_DEBUG 7 - -#define LOG_PRIMASK 7 -#define LOG_PRI(x) ((x) & LOG_PRIMASK) - - -/* Facilities; not actually used */ -#define LOG_KERN 0000 -#define LOG_USER 0010 -#define LOG_MAIL 0020 -#define LOG_DAEMON 0030 -#define LOG_AUTH 0040 -#define LOG_SYSLOG 0050 -#define LOG_LPR 0060 -#define LOG_NEWS 0070 -#define LOG_UUCP 0100 -#define LOG_CRON 0110 -#define LOG_AUTHPRIV 0120 -#define LOG_FTP 0130 -#define LOG_LOCAL0 0200 -#define LOG_LOCAL1 0210 -#define LOG_LOCAL2 0220 -#define LOG_LOCAL3 0230 -#define LOG_LOCAL4 0240 -#define LOG_LOCAL5 0250 -#define LOG_LOCAL6 0260 -#define LOG_LOCAL7 0270 - -#define LOG_FACMASK 01770 -#define LOG_FAC(x) (((x) >> 3) & (LOG_FACMASK >> 3)) - -/* openlog() flags; only LOG_PID and LOG_PERROR supported */ -#define LOG_PID 0x01 /* include pid with message */ -#define LOG_CONS 0x02 /* write to console on logger error */ -#define LOG_ODELAY 0x04 /* delay connection until syslog() */ -#define LOG_NDELAY 0x08 /* open connection immediately */ -#define LOG_NOWAIT 0x10 /* wait for child processes (unused on linux) */ -#define LOG_PERROR 0x20 /* additional logging to stderr */ - - -__extern void openlog(const char *, int, int); -__extern void syslog(int, const char *, ...); -__extern void vsyslog(int, const char *, va_list); -__extern void closelog(void); - -#endif /* _SYSLOG_H */ diff --git a/klibc/include/termios.h b/klibc/include/termios.h deleted file mode 100644 index 08a5e56855..0000000000 --- a/klibc/include/termios.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * termios.h - */ - -#ifndef _TERMIOS_H -#define _TERMIOS_H - -#include -#include -#include -#include -#include - -/* Redefine these so the magic constants == the ioctl number to use. */ -#undef TCSANOW -#undef TCSADRAIN -#undef TCSAFLUSH -#define TCSANOW TCSETS -#define TCSADRAIN TCSETSW -#define TCSAFLUSH TCSETSF - -static __inline__ int tcgetattr(int __fd, struct termios *__s) -{ - return ioctl(__fd, TCGETS, __s); -} - -static __inline__ int tcsetattr(int __fd, int __opt, const struct termios *__s) -{ - return ioctl(__fd, __opt, (void *)__s); -} - -static __inline__ int tcflow(int __fd, int __action) -{ - return ioctl(__fd, TCXONC, (void *)(intptr_t)__action); -} - -static __inline__ int tcflush(int __fd, int __queue) -{ - return ioctl(__fd, TCFLSH, (void *)(intptr_t)__queue); -} - -static __inline__ pid_t tcgetpgrp(int __fd) -{ - pid_t __p; - return ioctl(__fd, TIOCGPGRP, &__p) ? (pid_t)-1 : __p; -} - -static __inline__ pid_t tcgetsid(int __fd) -{ - pid_t __p; - return ioctl(__fd, TIOCGSID, &__p) ? (pid_t)-1 : __p; -} - -static __inline__ int tcsendbreak(int __fd, int __duration) -{ - return ioctl(__fd, TCSBRKP, (void *)(uintptr_t)__duration); -} - -static __inline__ int tcsetpgrp(int __fd, pid_t __p) -{ - return ioctl(__fd, TIOCSPGRP, &__p); -} - -static __inline__ speed_t cfgetospeed(const struct termios *__s) -{ - return (speed_t)(__s->c_cflag & CBAUD); -} - -static __inline__ speed_t cfgetispeed(const struct termios *__s) -{ - return (speed_t)(__s->c_cflag & CBAUD); -} - -static __inline__ int cfsetospeed(struct termios *__s, speed_t __v) -{ - __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); - return 0; -} - -static __inline__ int cfsetispeed(struct termios *__s, speed_t __v) -{ - __s->c_cflag = (__s->c_cflag & ~CBAUD) | (__v & CBAUD); - return 0; -} - -#endif /* _TERMIOS_H */ diff --git a/klibc/include/time.h b/klibc/include/time.h deleted file mode 100644 index 0f094c2806..0000000000 --- a/klibc/include/time.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * time.h - */ - -#ifndef _TIME_H -#define _TIME_H - -#include -#include - -__extern time_t time(time_t *); -__extern int nanosleep(const struct timespec *, struct timespec *); - -/* klibc-specific but useful since we don't have floating point */ -__extern char *strtotimeval(const char *str, struct timeval *tv); -__extern char *strtotimespec(const char *str, struct timespec *tv); - -#endif /* _TIME_H */ diff --git a/klibc/include/unistd.h b/klibc/include/unistd.h deleted file mode 100644 index 51fd7b769e..0000000000 --- a/klibc/include/unistd.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * unistd.h - */ - -#ifndef _UNISTD_H -#define _UNISTD_H - -#include -#include -#include -#include -#include - -__extern char **environ; -__extern __noreturn _exit(int); - -__extern pid_t fork(void); -__extern pid_t vfork(void); -__extern pid_t getpid(void); -__extern pid_t getpgid(pid_t); -__extern int setpgid(pid_t, pid_t); -__extern pid_t getppid(void); -__extern pid_t getpgrp(void); -__extern int setpgrp(void); -__extern pid_t setsid(void); -__extern pid_t getsid(pid_t); -__extern int execv(const char *, char * const *); -__extern int execvp(const char *, char * const *); -__extern int execve(const char *, char * const *, char * const *); -__extern int execvpe(const char *, char * const *, char * const *); -__extern int execl(const char *, const char *, ...); -__extern int execlp(const char *, const char *, ...); -__extern int execle(const char *, const char *, ...); -__extern int execlpe(const char *, const char *, ...); - -__extern int setuid(uid_t); -__extern uid_t getuid(void); -__extern int seteuid(uid_t); -__extern uid_t geteuid(void); -__extern int setgid(gid_t); -__extern gid_t getgid(void); -__extern int setegid(gid_t); -__extern gid_t getegid(void); -__extern int getgroups(int, gid_t *); -__extern int setgroups(size_t, const gid_t *); -__extern int setreuid(uid_t, uid_t); -__extern int setregid(gid_t, gid_t); -__extern int setresuid(uid_t, uid_t, uid_t); -__extern int setresgid(gid_t, gid_t, gid_t); -__extern int getfsuid(uid_t); -__extern int setfsuid(uid_t); - -/* Macros for access() */ -#define R_OK 4 /* Read */ -#define W_OK 2 /* Write */ -#define X_OK 1 /* Execute */ -#define F_OK 0 /* Existence */ - -__extern int access(const char *, int); -__extern int link(const char *, const char *); -__extern int unlink(const char *); -__extern int chdir(const char *); -__extern int fchdir(int); -__extern int chmod(const char *, mode_t); -__extern int fchmod(int, mode_t); -__extern int mkdir(const char *, mode_t); -__extern int rmdir(const char *); -__extern int pipe(int *); -__extern int chroot(const char *); -__extern int symlink(const char *, const char *); -__extern int readlink(const char *, char *, size_t); -__extern int chown(const char *, uid_t, gid_t); -__extern int fchown(int, uid_t, gid_t); -__extern int lchown(const char *, uid_t, gid_t); -__extern char *getcwd(char *, size_t); - -__extern int sync(void); - -/* Also in */ -#ifndef _KLIBC_IN_OPEN_C -__extern int open(const char *, int, ...); -#endif -__extern int close(int); -__extern off_t lseek(int, off_t, int); -/* off_t is 64 bits now even on 32-bit platforms; see llseek.c */ -static __inline__ off_t llseek(int __f, off_t __o, int __w) { - return lseek(__f, __o, __w); -} - -__extern ssize_t read(int, void *, size_t); -__extern ssize_t write(int, const void *, size_t); -__extern ssize_t pread(int, void *, size_t, off_t); -__extern ssize_t pwrite(int, void *, size_t, off_t); - -__extern int dup(int); -__extern int dup2(int, int); -__extern int fcntl(int, int, ...); -__extern int ioctl(int, int, void *); -__extern int flock(int, int); -__extern int fsync(int); -__extern int fdatasync(int); -__extern int ftruncate(int, off_t); - -__extern int pause(void); -__extern unsigned int alarm(unsigned int); -__extern unsigned int sleep(unsigned int); -__extern void usleep(unsigned long); - -__extern int gethostname(char *, size_t); -__extern int sethostname(const char *, size_t); -__extern int getdomainname(char *, size_t); -__extern int setdomainname(const char *, size_t); - -__extern void *__brk(void *); -__extern int brk(void *); -__extern void *sbrk(ptrdiff_t); - -__extern int getopt(int, char * const *, const char *); -__extern char *optarg; -__extern int optind, opterr, optopt; - -__extern int isatty(int); - -static __inline__ int getpagesize(void) { - extern unsigned int __page_size; - return __page_size; -} -static __inline__ int __getpageshift(void) { - extern unsigned int __page_shift; - return __page_shift; -} - -__extern int daemon(int, int); - -/* Standard file descriptor numbers. */ -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 - -#endif /* _UNISTD_H */ diff --git a/klibc/include/utime.h b/klibc/include/utime.h deleted file mode 100644 index 3dfa03a14a..0000000000 --- a/klibc/include/utime.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * utime.h - */ - -#ifndef _UTIME_H -#define _UTIME_H - -#include -#include -#include - -__extern int utime(const char *, const struct utimbuf *); - -#endif /* _UTIME_H */ - diff --git a/klibc/klcc.1 b/klibc/klcc.1 deleted file mode 100644 index 76334a3a54..0000000000 --- a/klibc/klcc.1 +++ /dev/null @@ -1,116 +0,0 @@ -.\" $Id: klcc.1,v 1.3 2005/04/19 23:27:46 hpa Exp $ -.\" ----------------------------------------------------------------------- -.\" -.\" Copyright 2005 H. Peter Anvin - All Rights Reserved -.\" -.\" Permission is hereby granted, free of charge, to any person -.\" obtaining a copy of this software and associated documentation -.\" files (the "Software"), to deal in the Software without -.\" restriction, including without limitation the rights to use, -.\" copy, modify, merge, publish, distribute, sublicense, and/or -.\" sell copies of the Software, and to permit persons to whom -.\" the Software is furnished to do so, subject to the following -.\" conditions: -.\" -.\" The above copyright notice and this permission notice shall -.\" be included in all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -.\" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -.\" OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -.\" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -.\" HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -.\" WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -.\" OTHER DEALINGS IN THE SOFTWARE. -.\" -.\" ----------------------------------------------------------------------- - -.TH klcc "1" "1 March 2005" "klibc" "H. Peter Anvin" -.SH NAME -klcc \- compile a program against klibc -.SH SYNOPSIS -.B klcc -[\fIgcc options\fP] -[\fB\-o\fP \fIoutfile\fP] -\fIinfile...\fP -.SH DESCRIPTION -.PP -.B klcc -is a wrapper around -.BR gcc (1) -and -.BR ld (1) -which compiles and links a program against the -.B klibc -tiny C library. It supports most -.B gcc -options. -.PP -Unlike -.BR gcc , -.B klcc -compiles with optimization on by default. Furthermore, the -optimization level used depends on whether or not -.B \-g -is specified, since -.B klcc -frequently uses options in the normal case which makes debugging -impossible. Therefore, compile without -.BR \-g , -.BR \-O , -.B \-f -or -.B \-m -option to use the default optimization level; this will generally -result in the smallest binaries. You may want to use -.B \-s -when linking, however. Use -.B \-O0 -to compile without any optimization whatsoever; this may not work depending -on the version of -.B gcc -used. -.PP -Use the -.B \-shared -or -.B \-static -option to compile for and link against shared or static klibc. Note -that shared klibc only supports running against the exact same klibc -binary as the binary was linked with. -.PP -In addition to standard -.B gcc -options, -.B klcc -supports options of the form \fB\-print-klibc-\fP\fIoption\fP, -which prints the corresponding klibc configuration option. -.SH AUTHOR -Written by H. Peter Anvin . -.SH COPYRIGHT -Copyright \(co 2005 H. Peter Anvin \- All Rights Reserved -.PP -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following -conditions: -.PP -The above copyright notice and this permission notice shall -be included in all copies or substantial portions of the Software. -.PP -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. -.SH "SEE ALSO" -.BR gcc (1) - diff --git a/klibc/klcc.in b/klibc/klcc.in deleted file mode 100644 index 5629f24f1c..0000000000 --- a/klibc/klcc.in +++ /dev/null @@ -1,258 +0,0 @@ -# -*- perl -*- - -use IPC::Open3; - -# Standard includes -@includes = ("-I${prefix}/${KCROSS}include/arch/${ARCH}", - "-I${prefix}/${KCROSS}include/bits${BITSIZE}", - "-I${prefix}/${KCROSS}include"); - -# Default optimization options (for compiles without -g) -@optopt = @OPTFLAGS; -@goptopt = ('-O'); - -# Standard library directories -@stdlibpath = ("-L${prefix}/${KCROSS}lib"); - -# Options and libraries to pass to ld; shared versus static -@staticopt = ("${prefix}/${KCROSS}lib/crt0.o"); -@staticlib = ("${prefix}/${KCROSS}lib/libc.a"); -@sharedopt = (@EMAIN, "${prefix}/${KCROSS}lib/interp.o"); -@sharedlib = ('-R', "${prefix}/${KCROSS}lib/libc.so"); - -# Returns the language (-x option string) for a specific extension. -sub filename2lang($) { - my ($file) = @_; - - return 'c' if ( $file =~ /\.c$/ ); - return 'c-header' if ( $file =~ /\.h$/ ); - return 'cpp-output' if ( $file =~ /\.i$/ ); - return 'c++-cpp-output' if ( $file =~ /\.ii$/ ); - return 'objective-c' if ( $file =~ /\.m$/ ); - return 'objc-cpp-output' if ( $file =~ /\.mi$/ ); - return 'c++' if ( $file =~/\.(cc|cp|cxx|cpp|CPP|c\+\+|C)$/ ); - return 'c++-header' if ( $file =~ /\.(hh|H)$/ ); - return 'f77' if ( $file =~ /\.(f|for|FOR)$/ ); - return 'f77-cpp-input' if ( $file =~ /\.(F|fpp|FPP)$/ ); - return 'ratfor' if ( $file =~ /\.r$/ ); - - # Is this correct? - return 'ada' if ( $file =~ /\.(ads|adb)$/ ); - - return 'assembler' if ( $file =~ /\.s$/ ); - return 'assembler-with-cpp' if ( $file =~/ \.S$/ ); - - # Linker file; there is no option to gcc to assume something - # is a linker file, so we make up our own... - return 'obj'; -} - -# Produces a series of -x options and files -sub files_with_lang($$) { - my($files, $flang) = @_; - my(@as) = (); - my($xopt) = 'none'; - my($need); - - foreach $f ( @{$files} ) { - $need = ${$flang}{$f}; - - # Skip object files - if ( $need ne 'obj' ) { - unless ( $xopt eq $need || $need eq 'stdin') { - push(@as, '-x', $need); - $xopt = $need; - } - push(@as, $f); - } - } - - return @as; -} - -# Convert a return value from system() to an exit() code -sub syserr($) { - my($e) = @_; - - return ($e & 0x7f) | 0x80 if ( $e & 0xff ); - return $e >> 8; -} - -# Run a program; printing out the command line if $verbose is set -sub mysystem(@) { - print STDERR join(' ', @_), "\n" if ( $verbose ); - my $cmd = shift; - open(INPUT, "<&STDIN"); # dup STDIN filehandle to INPUT - my $childpid = open3("<&INPUT", ">&STDOUT", ">&STDERR", $cmd, @_); - waitpid ($childpid, 0); - return $?; -} - -# -# Initialization -# -open(NULL, '+<', '/dev/null') or die "$0: cannot open /dev/null\n"; - -# -# Begin parsing options. -# - -@ccopt = (); -@ldopt = (); -@libs = (); - -@files = (); # List of files -%flang = (); # Languages for files - -# This is 'c' for compile only, 'E' for preprocess only, -# 'S' for compile to assembly. -$operation = ''; # Compile and link - -# Current -x option. If undefined, it means autodetect. -undef $lang; - -$save_temps = 0; # The -save-temps option -$verbose = 0; # The -v option -$shared = 0; # Are we compiling shared? -$debugging = 0; # -g or -p option present? -$strip = 0; # -s option present? -undef $output; # -o option present? - -while ( defined($a = shift(@ARGV)) ) { - if ( $a !~ /^\-/ ) { - # Not an option. Must be a filename then. - push(@files, $a); - $flang{$a} = $lang || filename2lang($a); - } elsif ( $a eq '-' ) { - # gcc gets its input from stdin - push(@files, $a); - # prevent setting -x - $flang{$a} = 'stdin' - } elsif ( $a =~ /^-print-klibc-(.*)$/ ) { - # This test must precede -print - if ( defined($conf{$1}) ) { - print ${$conf{$1}}, "\n"; - exit 0; - } else { - die "$0: unknown option: $a\n"; - } - } elsif ( $a =~ /^(-print|-dump|--help|--version)/ ) { - # These share prefixes with some other options, so put this test early! - # Pseudo-operations; just pass to gcc and don't do anything else - push(@ccopt, $a); - $operation = 'c' if ( $operation eq '' ); - } elsif ( $a =~ /^-Wl,(.*)$/ ) { - # -Wl used to pass options to the linker - push(@ldopt, split(/,/, $1)); - } elsif ( $a =~ /^-([fmwWQdO]|std=|ansi|pedantic|M[GPD]|MMD)/ ) { - # Options to gcc - push(@ccopt, $a); - } elsif ( $a =~ /^-([DUI]|M[FQT])(.*)$/ ) { - # Options to gcc, which can take either a conjoined argument - # (-DFOO) or a disjoint argument (-D FOO) - push(@ccopt, $a); - push(@ccopt, shift(@ARGV)) if ( $2 eq '' ); - } elsif ( $a eq '-include' ) { - # Options to gcc which always take a disjoint argument - push(@ccopt, $a, shift(@ARGV)); - } elsif ( $a eq '-M' || $a eq '-MM' ) { - # gcc options, that force preprocessing mode - push(@ccopt, $a); - $operation = 'E'; - } elsif ( $a =~ /^-[gp]/ || $a eq '-p' ) { - # Debugging options to gcc - push(@ccopt, $a); - $debugging = 1; - } elsif ( $a eq '-v' ) { - push(@ccopt, $a); - $verbose = 1; - } elsif ( $a eq '-save-temps' ) { - push(@ccopt, $a); - $save_temps = 1; - } elsif ( $a =~ '^-([cSE])$' ) { - push(@ccopt, $a); - $operation = $1; - } elsif ( $a eq '-shared' ) { - $shared = 1; - } elsif ( $a eq '-static' ) { - $shared = 0; - } elsif ( $a eq '-s' ) { - $strip = 1; - } elsif ( $a eq '-o' ) { - $output = shift(@ARGV); - } elsif ( $a eq '-x' ) { - $lang = shift(@ARGV); - } elsif ( $a eq '-nostdinc' ) { - push(@ccopt, $a); - @includes = (); - } elsif ( $a =~ /^-([lL])(.*)$/ ) { - # Libraries - push(@libs, $a); - push(@libs, shift(@ARGV)) if ( $2 eq '' ); - } else { - die "$0: unknown option: $a\n"; - } -} - -if ( $debugging ) { - @ccopt = (@REQFLAGS, @includes, @goptopt, @ccopt); -} else { - @ccopt = (@REQFLAGS, @includes, @optopt, @ccopt); -} - -if ( $operation ne '' ) { - # Just run gcc with the appropriate options - @outopt = ('-o', $output) if ( defined($output) ); - $rv = mysystem($CC, @ccopt, @outopt, files_with_lang(\@files, \%flang)); -} else { - if ( scalar(@files) == 0 ) { - die "$0: No input files!\n"; - } - - @outopt = ('-o', $output || 'a.out'); - - @objs = (); - @rmobjs = (); - - foreach $f ( @files ) { - if ( $flang{$f} eq 'obj' ) { - push(@objs, $f); - } else { - $fo = $f; - $fo =~ s/\.[^\/.]+$/\.o/; - - die if ( $f eq $fo ); # safety check - - push(@objs, $fo); - push(@rmobjs, $fo) unless ( $save_temps ); - - $rv = mysystem($CC, @ccopt, '-c', '-o', $fo, '-x', $flang{$f}, $f); - - if ( $rv ) { - unlink(@rmobjs); - exit syserr($rv); - } - } - } - - # Get the libgcc pathname for the *current* gcc - open(LIBGCC, '-|', $CC, @ccopt, '-print-libgcc-file-name') - or die "$0: cannot get libgcc filename\n"; - $libgcc = ; - chomp $libgcc; - close(LIBGCC); - - if ( $shared ) { - $rv = mysystem($LD, @LDFLAGS, @sharedopt, @ldopt, @outopt, @objs, @libs, @stdlibpath, @sharedlib, $libgcc); - } else { - $rv = mysystem($LD, @LDFLAGS, @staticopt, @ldopt, @outopt, @objs, @libs, @stdlibpath, @staticlib, $libgcc); - } - - unlink(@rmobjs); - - if ( $strip && !$rv ) { - $rv = mysystem($STRIP, @STRIPFLAGS, $output); - } -} - -exit syserr($rv); diff --git a/klibc/klibc.spec.in b/klibc/klibc.spec.in deleted file mode 100644 index eef5dbf9d3..0000000000 --- a/klibc/klibc.spec.in +++ /dev/null @@ -1,126 +0,0 @@ -Summary: A minimal libc subset for use with initramfs. -Name: klibc -Version: @@VERSION@@ -Release: 1 -License: BSD/GPL -Group: Development/Libraries -URL: http://www.zytor.com/mailman/listinfo/klibc -Source: http://www.kernel.org/pub/linux/libs/klibc-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildRequires: kernel >= 2.6.0, kernel-devel -Packager: H. Peter Anvin -Prefix: /usr -Vendor: Starving Linux Artists - -%define klibcdir %{_prefix}/lib/klibc -%define libdocdir %{_docdir}/%{name}-%{version}-%{release} -%define bindocdir %{_docdir}/%{name}-utils-%{version}-%{release} - -%description -%{name} is intended to be a minimalistic libc subset for use with -initramfs. It is deliberately written for small size, minimal -entanglement, and portability, not speed. - -%package devel -Summary: Libraries and tools needed to compile applications against klibc. -Group: Development/Libraries -Requires: klibc = %{version}-%{release} - -%description devel -This package contains the link libraries, header files, and gcc -wrapper scripts needed to compile applications against klibc. - -%package utils -Summary: Small utilities built with klibc. -Group: Utilities/System -Requires: klibc = %{version}-%{release} - -%description utils -This package contains a collection of programs that are linked against -klibc. These duplicate some of the functionality of a regular Linux -toolset, but are typically much smaller than their full-function -counterparts. They are intended for inclusion in initramfs images and -embedded systems. - -%prep -%setup -q -cp -dRs /lib/modules/`uname -r`/build/ ./linux -# Shouldn't need this when getting the build tree from /lib/modules -# make -C linux defconfig ARCH=%{_target_cpu} -# make -C linux prepare ARCH=%{_target_cpu} -# Deal with braindamage in RedHat's kernel-source RPM -rm -f linux/include/linux/config.h -cat < linux/include/linux/config.h -#ifndef _LINUX_CONFIG_H -#define _LINUX_CONFIG_H - -#include - -#endif -EOF -mkdir -p %{buildroot} - -%build -make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ - INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} - -%install -rm -rf %{buildroot} -make ARCH=%{_target_cpu} prefix=%{_prefix} bindir=%{_bindir} \ - INSTALLDIR=%{klibcdir} mandir=%{_mandir} INSTALLROOT=%{buildroot} \ - install - -# Make the .so file in /lib a hardlink (they will be expanded as two -# files automatically if it crosses filesystems when extracted.) -ln -f %{buildroot}%{klibcdir}/lib/klibc-*.so %{buildroot}/lib - -# Install the docs -mkdir -p %{buildroot}%{bindocdir} %{buildroot}%{libdocdir} -install -m 444 README %{buildroot}%{libdocdir} -install -m 444 klibc/README %{buildroot}%{libdocdir}/README.klibc -install -m 444 klibc/arch/README %{buildroot}%{libdocdir}/README.klibc.arch - -install -m 444 gzip/COPYING %{buildroot}%{bindocdir}/COPYING.gzip -install -m 444 gzip/README %{buildroot}%{bindocdir}/README.gzip -install -m 444 ipconfig/README %{buildroot}%{bindocdir}/README.ipconfig -install -m 444 kinit/README %{buildroot}%{bindocdir}/README.kinit - -%clean -rm -rf $RPM_BUILD_ROOT - -# -# Note: libc.so and interp.o are technically -devel files, but -# put them in this package until we can make really, really sure -# the dependency system can avoid confusion. (In fact, it would be -# good to eventually get them out of here, so that multiple runtimes -# can be installed should it be necessary.) -# -%files -%defattr(-,root,root,-) -/lib/klibc-*.so -%{klibcdir}/lib/*.so -%{klibcdir}/lib/interp.o - -%files devel -%defattr(-,root,root,-) -%{klibcdir}/include -%{klibcdir}/lib/*.a -%{klibcdir}/lib/crt0.o -%{_bindir}/klcc -%doc %{_mandir}/man1/* -%doc %{libdocdir}/* - -%files utils -%defattr(-,root,root,-) -%{klibcdir}/bin -%doc %{bindocdir}/* - -%changelog -* Tue Mar 1 2005 H. Peter Anvin -- New "make install" scheme, klcc - -* Tue Jul 6 2004 H. Peter Anvin -- Update to use kernel-source RPM for the kernel symlink. - -* Sat Nov 29 2003 Bryan O'Sullivan - -- Initial build. diff --git a/klibc/klibc/CAVEATS b/klibc/klibc/CAVEATS deleted file mode 100644 index 5bc11e4179..0000000000 --- a/klibc/klibc/CAVEATS +++ /dev/null @@ -1,61 +0,0 @@ - ------------------------------------------------- - Please note the following caveats to using klibc: - ------------------------------------------------- - -optimization: -------------- - -Compiling with -O0 is not supported. It may or may not work; please -use -O1 if you want to do maximize debuggability. - -Compiling with -O0 is more likely to work on gcc 3. - - -setjmp()/longjmp(): -------------------- - -setjmp() and longjmp() *do not* save signal state. sigsetjmp() and -siglongjmp() *do* save the signal mask -- regardless of the value of -the extra argument. - -The standards actually state that if you pass longjmp() a final value -of zero the library should change that to a 1! Presumably the reason -is so people who write broken code can get away with writing -longjmp(buf); or something equally bad. If you pass longjmp() a final -value of 0 you get what you deserve -- setjmp() will happily return 0. - - -stdio: ------- - -Only a small subset of the stdio functions are implemented. Those -that are implemented do not buffer, although they *do* trap EINTR or -short read/writes and iterate. - -_fread() and _fwrite(), which take only one size argument (like -read/write), but do handle EINTR/short return are also available. - - -namespaces: ------------ - -klibc frequently includes headers in other headers in a way that -exposes more symbols than POSIX says they should. "Live with it." - - -theading: ---------- - -klibc is not thread-safe. Consequently, clone() or any of the -pthreads functions are not included. - - -bsd_signal vs sysv_signal: --------------------------- - -There is no signal() call, because you never know if you want -Linux/SysV semantics (SA_RESETHAND) or GNU/BSD semantics (SA_RESTART). -The best, in *any* circumstances, is to never use signal() and instead -use sigaction(), but in order to simplify porting you can use either -sysv_signal() or bsd_signal(), depending on what you actually want. - diff --git a/klibc/klibc/Kbuild b/klibc/klibc/Kbuild deleted file mode 100644 index be239a6647..0000000000 --- a/klibc/klibc/Kbuild +++ /dev/null @@ -1,149 +0,0 @@ -# -# Kbuild file for klibc -# - -libc-y := vsnprintf.o snprintf.o vsprintf.o sprintf.o \ - asprintf.o vasprintf.o \ - vsscanf.o sscanf.o ctypes.o \ - strntoumax.o strntoimax.o \ - atoi.o atol.o atoll.o \ - strtol.o strtoll.o strtoul.o strtoull.o \ - strtoimax.o strtoumax.o \ - globals.o exitc.o atexit.o onexit.o \ - execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \ - fork.o wait.o wait3.o waitpid.o system.o setpgrp.o getpgrp.o \ - daemon.o \ - printf.o vprintf.o fprintf.o vfprintf.o perror.o \ - statfs.o fstatfs.o umount.o \ - open.o fopen.o fread.o fread2.o fgetc.o fgets.o \ - fwrite.o fwrite2.o fputc.o fputs.o puts.o putchar.o \ - sleep.o usleep.o strtotimespec.o strtotimeval.o \ - raise.o abort.o assert.o alarm.o pause.o \ - __signal.o sysv_signal.o bsd_signal.o siglist.o siglongjmp.o \ - sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ - brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ - memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ - memmove.o memchr.o memrchr.o \ - strcasecmp.o strncasecmp.o strndup.o strerror.o \ - strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \ - strncat.o strlcpy.o strlcat.o \ - strstr.o strncmp.o strncpy.o strrchr.o \ - strxspn.o strspn.o strcspn.o strpbrk.o strsep.o strtok.o \ - gethostname.o getdomainname.o getcwd.o \ - seteuid.o setegid.o \ - getenv.o setenv.o putenv.o __put_env.o unsetenv.o \ - getopt.o readdir.o \ - syslog.o closelog.o pty.o getpt.o isatty.o reboot.o \ - time.o utime.o llseek.o nice.o getpriority.o \ - qsort.o \ - lrand48.o jrand48.o mrand48.o nrand48.o srand48.o seed48.o \ - inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ - inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ - send.o recv.o - -libc-$(CONFIG_KLIBC_ERRLIST) += errlist.o - -libc-$(CONFIG_KLIBC_ZLIB) += \ - zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/gzio.o \ - zlib/uncompr.o zlib/deflate.o zlib/trees.o zlib/zutil.o \ - zlib/inflate.o zlib/infback.o zlib/inftrees.o zlib/inffast.o - -##### -# Add any architecture-specific rules -include $(obj)/arch/$(ARCH)/Makefile.inc - -##### -# Shared definitions -LIB := libc.a -SOLIB := libc.so -SOHASH := klibc.so -CRT0 := arch/$(ARCH)/crt0.o -INTERP_O := interp.o - -always := $(CRT0) $(LIB) $(SOLIB) $(SOHASH) $(INTERP_O) -LIB := $(call objectify,$(LIB)) -SOLIB := $(call objectify,$(SOLIB)) -SOHASH := $(call objectify,$(SOHASH)) -CRT0 := $(call objectify,$(CRT0)) -INTERP_O := $(call objectify,$(INTERP_O)) - -targets := arch/$(ARCH)/crt0.o -targets += $(libc-y) $(ARCHOBJS) - -# Generate syscall stubs -subdir-y += syscalls -# Generate socket calls stubs -subdir-y += socketcalls - -# Tell make to descend before building libs -$(obj)/syscalls/syscalls.o: $(obj)/syscalls -$(obj)/socketcalls/socketcalls.o: $(obj)/socketcalls - -##### -# Readable errormessages extracted from src.. -targets += errlist.c -quiet_cmd_errlist = GEN $@ - cmd_errlist = $(PERL) $< $(LINUXINCLUDE) -errlist > $@ || rm -f $@ - -$(obj)/errlist.c: $(srctree)/$(src)/makeerrlist.pl - $(call cmd,errlist) - -# full list of dependencies for klibc -libc-deps = $(call objectify, $(libc-y) $(ARCHOBJS)) \ - $(call objectify, syscalls/syscalls.o socketcalls/socketcalls.o) - -###### -# Build static library: libc.a -targets += libc.a __static_init.o -quiet_cmd_libc = USERAR $@ - cmd_libc = rm -f $@; \ - $(USERAR) cq $@ $(filter-out FORCE,$^); \ - $(USERRANLIB) $@ - -$(LIB): $(call objectify,__static_init.o) $(libc-deps) FORCE - $(call if_changed,libc) - -###### -# Build shared library -targets += libc.so __shared_init.o - -quiet_cmd_libcso = LD $@ - cmd_libcso = $(USERLD) $(USERLDFLAGS) $(USERSHAREDFLAGS) \ - -o $@ $(filter-out FORCE,$^) $(USERLIBGCC) - -$(SOLIB): $(CRT0) $(call objectify,__shared_init.o) $(libc-deps) FORCE - $(call if_changed,libcso) - - -##### -# Build sha1 hash values -targets += klibc.so libc.so.hash -hostprogs-y := sha1hash - -quiet_cmd_solibhash = HASH $@ - cmd_solibhash = $(USERNM) $< | egrep '^[0-9a-fA-F]+ [ADRTW] ' | \ - sort | $(obj)/sha1hash > $@ -$(SOLIB).hash: $(SOLIB) $(obj)/sha1hash FORCE - $(call if_changed,solibhash) - -quiet_cmd_sohash = GEN $@ - cmd_sohash = cat $< > $@; \ - $(USERSTRIP) $(USERSTRIPFLAGS) $@; \ - rm -f $(obj)/klibc-??????????????????????.so; \ - ln -f $@ $(obj)/klibc-`cat $(SOLIB).hash`.so -$(SOHASH): $(SOLIB) $(SOLIB).hash - $(call cmd,sohash) - - -##### -# build interp.o -targets += interp.o - -quiet_cmd_interp = BUILD $@ - cmd_interp = $(USERCC) $(usercflags) -D__ASSEMBLY__ \ - -DLIBDIR=\"$(SHLIBDIR)\" \ - -DSOHASH=\"`cat $(SOLIB).hash`\" \ - -c -o $@ $< - -$(INTERP_O): $(obj)/interp.S $(SOLIB).hash - $(call if_changed,interp) diff --git a/klibc/klibc/LICENSE b/klibc/klibc/LICENSE deleted file mode 100644 index b512ff96bc..0000000000 --- a/klibc/klibc/LICENSE +++ /dev/null @@ -1,73 +0,0 @@ -This license applies to all files in directory and its subdirectories, -unless otherwise noted in individual files. - - -Some files are derived from files derived from the include/ directory -of the Linux kernel, and are licensed under the terms of the GNU -General Public License, version 2, as released by the Free Software -Foundation, Inc.; incorporated herein by reference. - - ----- - -Some files are derived from files copyrighted by the Regents of The -University of California, and are available under the following -license: - -Note: The advertising clause in the license appearing on BSD Unix -files was officially rescinded by the Director of the Office of -Technology Licensing of the University of California on July 22 -1999. He states that clause 3 is "hereby deleted in its entirety." - - * Copyright (c) - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - - ----- - -For all remaining files, the following license applies: - - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * Any copyright notice(s) and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/klibc/klibc/MCONFIG b/klibc/klibc/MCONFIG deleted file mode 100644 index 24af09d8e0..0000000000 --- a/klibc/klibc/MCONFIG +++ /dev/null @@ -1,20 +0,0 @@ -# -*- makefile -*- -# -# Makefile configuration, without explicit rules -# - -SRCROOT = .. -include ../MCONFIG -include ../MRULES - -WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline - -ifeq ($(ERRLIST),1) -REQFLAGS += -DWITH_ERRLIST -endif - -CFLAGS = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d $(OPTFLAGS) $(REQFLAGS) $(WARNFLAGS) -INCLUDE += -I./zlib -CFLAGS += -DDYNAMIC_CRC_TABLE - -SOFLAGS = -fPIC diff --git a/klibc/klibc/Makefile b/klibc/klibc/Makefile deleted file mode 100644 index dff813fc59..0000000000 --- a/klibc/klibc/Makefile +++ /dev/null @@ -1,192 +0,0 @@ -# -# Makefile -# -# Main makefile -# - -# Include configuration rules -include MCONFIG - -INCLUDE += -I./zlib - -TESTS = $(patsubst %.c,%,$(wildcard tests/*.c)) \ - $(patsubst %.c,%.shared,$(wildcard tests/*.c)) -LIBOBJS = vsnprintf.o snprintf.o vsprintf.o sprintf.o \ - asprintf.o vasprintf.o \ - vsscanf.o sscanf.o ctypes.o \ - strntoumax.o strntoimax.o \ - atoi.o atol.o atoll.o \ - strtol.o strtoll.o strtoul.o strtoull.o \ - strtoimax.o strtoumax.o \ - globals.o exitc.o atexit.o onexit.o \ - execl.o execle.o execv.o execvpe.o execvp.o execlp.o execlpe.o \ - fork.o wait.o wait3.o waitpid.o system.o setpgrp.o getpgrp.o \ - daemon.o \ - printf.o vprintf.o fprintf.o vfprintf.o perror.o \ - statfs.o fstatfs.o umount.o \ - open.o fopen.o fread.o fread2.o fgetc.o fgets.o \ - fwrite.o fwrite2.o fputc.o fputs.o puts.o putchar.o \ - sleep.o usleep.o strtotimespec.o strtotimeval.o \ - raise.o abort.o assert.o alarm.o pause.o \ - __signal.o sysv_signal.o bsd_signal.o siglist.o siglongjmp.o \ - sigaction.o sigpending.o sigprocmask.o sigsuspend.o \ - brk.o sbrk.o malloc.o realloc.o calloc.o mmap.o \ - memcpy.o memcmp.o memset.o memccpy.o memmem.o memswap.o \ - memmove.o memchr.o memrchr.o \ - strcasecmp.o strncasecmp.o strndup.o strerror.o \ - strcat.o strchr.o strcmp.o strcpy.o strdup.o strlen.o strnlen.o \ - strncat.o strlcpy.o strlcat.o \ - strstr.o strncmp.o strncpy.o strrchr.o \ - strxspn.o strspn.o strcspn.o strpbrk.o strsep.o strtok.o \ - gethostname.o getdomainname.o getcwd.o \ - seteuid.o setegid.o \ - getenv.o setenv.o putenv.o __put_env.o unsetenv.o \ - getopt.o readdir.o \ - syslog.o closelog.o pty.o getpt.o isatty.o reboot.o \ - time.o utime.o llseek.o nice.o getpriority.o \ - qsort.o \ - lrand48.o jrand48.o mrand48.o nrand48.o srand48.o seed48.o \ - inet/inet_ntoa.o inet/inet_aton.o inet/inet_addr.o \ - inet/inet_ntop.o inet/inet_pton.o inet/bindresvport.o \ - send.o recv.o - -ifeq ($(ERRLIST),1) -LIBOBJS += errlist.o -endif - -ifeq ($(ZLIB),1) -LIBOBJS += zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/gzio.o \ - zlib/uncompr.o zlib/deflate.o zlib/trees.o zlib/zutil.o \ - zlib/inflate.o zlib/infback.o zlib/inftrees.o zlib/inffast.o -endif - -SOLIB = libc.so -SOHASH = klibc.so - -CRT0 = crt0.o -LIB = libc.a - -INTERP_O = interp.o - -all: tests $(CRT0) $(LIB) $(SOLIB) $(SOHASH) $(INTERP_O) - -# Add any architecture-specific rules -include arch/$(ARCH)/Makefile.inc -EMAIN ?= -e main - -tests: $(TESTS) - -tests/%.o : tests/%.c - $(CC) $(CFLAGS) -c -o $@ $< - -# This particular file uses a bunch of formats gcc don't know of, in order -# to test the full range of our vsnprintf() function. This outputs a bunch -# of useless warnings unless we tell it not to. -tests/testvsnp.o : tests/testvsnp.c - $(CC) $(CFLAGS) -Wno-format -c -o $@ $< - -tests/% : tests/%.o $(LIB) $(CRT0) - $(LD) $(LDFLAGS) -o $@ $(CRT0) $< $(LIB) $(LIBGCC) - cp $@ $@.stripped - $(STRIPCMD) $@.stripped - -tests/%.shared : tests/%.o interp.o $(SOLIB) - $(LD) $(LDFLAGS) -o $@ $(EMAIN) interp.o tests/$*.o -R $(SOLIB) $(LIBGCC) - cp $@ $@.stripped - $(STRIPCMD) $@.stripped - -$(LIB): __static_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/static.obj socketcalls/static.obj - rm -f $(LIB) - $(AR) cq $(LIB) __static_init.o $(LIBOBJS) $(ARCHOBJS) \ - $(wildcard syscalls/*.o) $(wildcard socketcalls/*.o) - $(RANLIB) $(LIB) - -$(SOLIB): $(CRT0) __shared_init.o $(LIBOBJS) $(ARCHOBJS) syscalls/static.obj socketcalls/static.obj - $(LD) $(LDFLAGS) $(SHAREDFLAGS) -o $@ \ - $(CRT0) __shared_init.o $(LIBOBJS) $(ARCHOBJS) \ - $(wildcard syscalls/*.o) $(wildcard socketcalls/*.o) \ - $(LIBGCC) - -sha1hash: sha1hash.c - $(HOST_CC) $(HOST_CFLAGS) $(HOST_LDFLAGS) -o $@ $< - -$(SOLIB).hash: $(SOLIB) sha1hash - $(NM) $(SOLIB) | \ - egrep '^[0-9a-fA-F]+ [ADRTW] ' | sort | ./sha1hash > $@ - -$(SOHASH): $(SOLIB) $(SOLIB).hash - cp -f $(SOLIB) $@ - $(STRIPCMD) $@ - rm -f klibc-??????????????????????.so - ln -f $@ klibc-`cat $(SOLIB).hash`.so - -$(INTERP_O): interp.S $(SOLIB).hash - $(CC) $(CFLAGS) -D__ASSEMBLY__ -DLIBDIR=\"$(SHLIBDIR)\" \ - -DSOHASH=\"`cat $(SOLIB).hash`\" \ - -c -o $@ $< - -crt0.o: arch/$(ARCH)/crt0.o - cp arch/$(ARCH)/crt0.o . - -errlist.c: - $(PERL) makeerrlist.pl -q $(INCLUDE) -errlist > $@ || rm -f $@ - -# We pass -ansi to keep cpp from define e.g. "i386" as well as "__i386__" -SYSCALLS.i: SYSCALLS.def - $(CC) $(CFLAGS) -D__ASSEMBLY__ -ansi -x assembler-with-cpp -E -o $@ $< - -syscalls.nrs: ../include/sys/syscall.h - $(CC) $(CFLAGS) -Wp,-dM -x c -E -o $@ $< - -syscalls.dir: SYSCALLS.i syscalls.pl arch/$(ARCH)/sysstub.ph syscommon.h syscalls.nrs - rm -f syscalls/*.[Ssco] syscalls/*.obj - mkdir -p syscalls - $(PERL) syscalls.pl SYSCALLS.i arch/$(ARCH)/sysstub.ph $(ARCH) \ - $(BITSIZE) syscalls.nrs \ - syscalls ../include/klibc/havesyscall.h - touch $@ - -../include/klibc/havesyscall.h: syscalls.dir - : Generated by side effect - -socketcalls.dir: SOCKETCALLS.def socketcalls.pl socketcommon.h - rm -f socketcalls/*.[Ssco] socketcalls/*.obj - mkdir -p socketcalls - $(PERL) socketcalls.pl SOCKETCALLS.def $(ARCH) socketcalls - touch $@ - -%/static.obj: %.dir - $(MAKE) objects-$(basename $(notdir $@)) DIR=$*/ - -STATIC = $(addsuffix .o,$(basename $(wildcard $(DIR)*.[cS]))) - -objects-static: $(STATIC) - touch $(DIR)static.obj - -clean: archclean - find . -type f -a \( -name \*.[isoa] -o -name \*.l[iso] \) -print0 | xargs -0rt rm -f - rm -f *.a *.so *.hash *.syms *.stripped - rm -f $(TESTS) tests/*.stripped - rm -f syscalls/*.[Ssco] syscalls/*.obj syscalls.dir - rm -f socketcalls/*.[Ssco] socketcalls/*.obj socketcalls.dir - rm -f sha1hash errlist.c - -spotless: clean - rm -f ../include/klibc/havesyscall.h syscalls.nrs - find . \( -name \*~ -o -name '.*.d' \) -not -type d -print0 | \ - xargs -0rt rm -f - -bitsize: - @echo $(BITSIZE) - -install: all - $(INSTALL_DATA) $(LIB) $(SOLIB) $(CRT0) $(INTERP_O) \ - $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib - $(INSTALL_EXEC) klibc-`cat $(SOLIB).hash`.so \ - $(INSTALLROOT)$(INSTALLDIR)/$(CROSS)lib - $(INSTALL_EXEC) klibc-`cat $(SOLIB).hash`.so \ - $(INSTALLROOT)/$(SHLIBDIR) - -ifneq ($(wildcard $(DIR).*.d),) -include $(wildcard $(DIR).*.d) -endif diff --git a/klibc/klibc/README b/klibc/klibc/README deleted file mode 100644 index 3a53a8809f..0000000000 --- a/klibc/klibc/README +++ /dev/null @@ -1,81 +0,0 @@ -This is klibc, what is intended to be a minimalistic libc subset for -use with initramfs. It is deliberately written for small size, -minimal entaglement, and portability, not speed. It is definitely a -work in progress, and a lot of things are still missing. - - -The build procedure is not very polished yet, but it should work like -this: - -a) In the source root directory (the directory above the one in which - this file is found) create a symlink called "linux" pointing to a - reasonably recent Linux kernel tree (2.4 or 2.6 should be OK.) - This tree must have the include/asm symlink set up for the - architecture you're compiling for, and include/linux/autoconf.h - must exist. The easiest way to make sure of all of these is to do - a "make config" or any of its variants on the kernel tree is - question, followed by a "make dep" (2.4) or "make prepare" (2.6). - -b) If you're cross-compiling, change ARCH in the main MCONFIG file to - the appropriate architecture, and set CROSS to your toolchain - prefix. - - IMPORTANT: if you're on a 64-bit machine with a 32-bit userland - (ia64, mips64, ppc64 sparc64, s390x or x86_64), and you want to - build the 32-bit version: you need to set ARCH to the 32-bit - architecture as well as set up the linux/include/asm symlink to - point to the 32-bit architecture. Building the 32-bit architecture - usually (but not always) produces smaller binaries, and is likely - to be better tested. - - If you are on ARM, and want to build a thumb version of the library - (this is supported), change OPTFLAGS in arch/arm/MCONFIG to build - thumb code. - - The following is the last known status of various architectures: - - alpha: Working static, shared untested - arm-thumb: Untested - arm26: Not yet ported - arm: Working - cris: Working - h8300: Not yet ported - i386: Working - ia64: Working - m32r: Untested - m68k: Not yet ported - mips64: Not yet ported - mips: Working - parisc: Untested - ppc64: Working - ppc: Working - s390: Working static, shared untested - s390x: Working - sh: Untested - sparc64: Untested - sparc: Working - v850: Not yet ported - x86-64: Working - - Shared library support requires recent binutils on many - architectures. - - "Need sysstub.ph" means the architectural changes first implemented - in klibc-0.117 has not yet been implemented; klibc-0.116 did, - however, work. "Not yet ported" means no porting work has been - done on this architecture. - - Note that even the "working" ones likely have bugs. Please report - them if you run into them. - -c) Type "make" and pray... - -d) Try the test programs in the tests/ directory. They should run... - -Contact the klibc mailing list: - - http://www.zytor.com/mailman/listinfo/klibc - -... for more info. - - -hpa diff --git a/klibc/klibc/SOCKETCALLS.def b/klibc/klibc/SOCKETCALLS.def deleted file mode 100644 index e70b3fc16e..0000000000 --- a/klibc/klibc/SOCKETCALLS.def +++ /dev/null @@ -1,21 +0,0 @@ -; -*- fundamental -*- -; -; These are calls that are invoked via the socketcall mechanism -; Note that on most architectures this is simply #included into -; SYSCALLS.def. -; - int socket(int, int, int) - int bind(int, struct sockaddr *, int) - int connect(int, struct sockaddr *, socklen_t) - int listen(int, int) - int accept(int, struct sockaddr *, socklen_t *) - int getsockname(int, struct sockaddr *, socklen_t *) - int getpeername(int, struct sockaddr *, socklen_t *) - int socketpair(int, int, int, int *) - int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t) - int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) - int shutdown(int, int) - int setsockopt(int, int, int, const void *, socklen_t) - int getsockopt(int, int, int, void *, socklen_t *) - int sendmsg(int, const struct msghdr *, unsigned int) - int recvmsg(int, struct msghdr *, unsigned int) diff --git a/klibc/klibc/SYSCALLS.def b/klibc/klibc/SYSCALLS.def deleted file mode 100644 index b78919b134..0000000000 --- a/klibc/klibc/SYSCALLS.def +++ /dev/null @@ -1,231 +0,0 @@ -; -*- fundamental -*- -; -; This is a list of system calls we invoke "directly". These -; are generated into syscall stubs in their own files, so the -; linker can do its job properly. -; -; The full description of a line is: -; [<[?][!]arch,...>] type [sysname,...][@systype][::funcname](args) -; -; ? means only instantiate this system call if present in asm/unistd.h -; - -#include -#include - -; -; Process-related syscalls -; - void _exit,exit::_exit(int) - pid_t clone::__clone(unsigned long, void *) - pid_t clone::__clone2(unsigned long, void *, void *) - pid_t fork() - pid_t fork@forkish() - pid_t vfork() - pid_t vfork@forkish() - pid_t getpid() - pid_t getxpid@dual0::getpid() -int setpgid(pid_t, pid_t) -pid_t getpgid(pid_t) - pid_t getppid() - pid_t getxpid@dual1::getppid() -pid_t setsid() -pid_t getsid(pid_t) -pid_t wait4(pid_t, int *, int, struct rusage *) -int execve(const char *, char * const *, char * const *) - int nice(int) - int getpriority(int, int) - int getpriority::__getpriority(int, int) -int setpriority(int, int, int) -int sched_setscheduler(pid_t, int, const struct sched_param *) -int sched_yield() - -; -; User and group IDs -; -int setuid32,setuid::setuid(uid_t) -int setgid32,setgid::setgid(gid_t) - uid_t getuid32,getuid::getuid() - uid_t getxuid@dual0::getuid() - gid_t getgid32,getgid::getgid() - gid_t getxgid@dual0::getgid() - uid_t geteuid32,geteuid::geteuid() - uid_t getxuid@dual1::geteuid() - gid_t getegid32,getegid::getegid() - gid_t getxgid@dual1::getegid() -int getgroups32,getgroups::getgroups(int, gid_t *) -int setgroups32,setgroups::setgroups(size_t, const gid_t *) -int setreuid32,setreuid::setreuid(uid_t, uid_t) -int setregid32,setregid::setregid(gid_t, gid_t) -int setfsuid32,setfsuid::setfsuid(uid_t) -int setfsgid32,setfsgid::setfsgid(gid_t) -int setresuid32,setresuid::setresuid(int, uid_t, uid, uid_t) - -; -; Filesystem-related system calls -; -int mount(const char *, const char *, const char *, unsigned long, const void *) - int umount2(const char *, int) - int umount::umount2(const char *, int) - int pivot_root(const char *, const char *) -int sync() -#ifdef __NR_statfs64 -int statfs64::__statfs64(const char *, size_t, struct statfs *) -#else -int statfs(const char *, struct statfs *) -#endif -#ifdef __NR_fstatfs64 -int fstatfs64::__fstatfs64(int, size_t, struct statfs *) -#else -int fstatfs(int, struct statfs *) -#endif -int swapon(const char *, int) -int swapoff(const char *) - -; -; Inode-related system calls -; -int access(const char *, int) -int link(const char *, const char *) -int unlink(const char *) -int chdir(const char *) -int fchdir(int) -int rename(const char *, const char *) -int mknod(const char *, mode_t, dev_t) -int chmod(const char *, mode_t) -int fchmod(int, mode_t) -int mkdir(const char *, mode_t) -int rmdir(const char *) - int pipe(int *) -mode_t umask(mode_t) -int chroot(const char *) -int symlink(const char *, const char *) -int readlink(const char *, char *, size_t) - int stat64,stat::stat(const char *, struct stat *) - int lstat64,lstat::lstat(const char *, struct stat *) - int fstat64,fstat::fstat(int, struct stat *) - int stat::stat(const char *, struct stat *) - int lstat::lstat(const char *, struct stat *) - int fstat::fstat(int, struct stat *) -int getdents64,getdents::getdents(unsigned int, struct dirent *, unsigned int) -int chown32,chown::chown(const char *, uid_t, gid_t) -int fchown32,fchown::fchown(int, uid_t, gid_t) -int lchown32,lchown::lchown(const char *, uid_t, gid_t) -int getcwd::__getcwd(char *, size_t) - int utime(const char *, const struct utimbuf *) - int utimes(const char *, const struct timeval *) - int inotify_init(void) - int inotify_add_watch(int, const char *, __u32) - int inotify_rm_watch(int, __u32) - -; -; I/O operations -; - int open::__open(const char *, int, mode_t) -<64> int open(const char *, int, mode_t) -ssize_t read(int, void *, size_t) -ssize_t write(int, const void *, size_t) -int close(int) -<64> off_t lseek(int, off_t, int) -<32> int _llseek::__llseek(int, unsigned long, unsigned long, off_t *, int) -int dup(int) -int dup2(int, int) - int fcntl64@varadic::fcntl(int, int, unsigned long) - int fcntl(int, int, unsigned long) - int fcntl64,fcntl::fcntl(int, int, unsigned long) -int ioctl(int, int, void *) -int flock(int, int) -int _newselect,select::select(int, fd_set *, fd_set *, fd_set *, struct timeval *) -int poll(struct pollfd *, nfds_t, long) -int fsync(int) -int fdatasync,fsync::fdatasync(int) -int readv(int, const struct iovec *, int) -int writev(int, const struct iovec *, int) -int ftruncate64,ftruncate::ftruncate(int, off_t) -ssize_t pread64,pread::pread(int, void *, size_t, off_t) -ssize_t pwrite64,pwrite::pwrite(int, void *, size_t, off_t) - -; -; Signal operations -; -; We really should get rid of the non-rt_* of these, but that takes -; sanitizing for all architectures, sigh. -#ifdef __NR_sigaction -int sigaction::__sigaction(int, const struct sigaction *, struct sigaction *) -#else -int rt_sigaction::__rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t) -#endif -#ifdef __NR_sigsuspend -int sigsuspend(const sigset_t *) -#else -int rt_sigsuspend::__rt_sigsuspend(const sigset_t *, size_t) -#endif -#ifdef __NR_sigpending -int sigpending(sigset_t *) -#else -int rt_sigpending::__rt_sigpending(sigset_t *, size_t) -#endif -#ifdef __NR_sigprocmask -int sigprocmask(int, const sigset_t *, sigset_t *) -#else -int rt_sigprocmask::__rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t) -#endif -int kill(pid_t, int) - unsigned int alarm(unsigned int) -int getitimer(int, struct itimerval *) -int setitimer(int, const struct itimerval *, struct itimerval *) - -; -; Time-related system calls -; - time_t time(time_t *) -clock_t times(struct tms *) -int gettimeofday(struct timeval *, struct timezone *) -int settimeofday(const struct timeval *, const struct timezone *) -int nanosleep(const struct timespec *, struct timespec *) - int pause() - -; -; Memory -; -void * brk::__brk(void *) -int munmap(void *, size_t) -void * mremap(void *, size_t, size_t, unsigned long) -int msync(const void *, size_t, int) -int mprotect(const void *, size_t, int) -#if (_BITSIZE == 32 && defined(__NR_mmap2)) || \ - (_BITSIZE == 64 && !defined(__NR_mmap)) - void * mmap2::__mmap2(void *, size_t, int, int, int, long) -#else - void * mmap(void *, size_t, int, int, int, long) -#endif -int mlockall(int) -int munlockall() -int mlock(const void *, size_t) -int munlock(const void *, size_t) - -; -; System stuff -; -int uname(struct utsname *) -int setdomainname(const char *, size_t) -int sethostname(const char *, size_t) -long init_module(void *, unsigned long, const char *) -long delete_module(const char *, unsigned int) -int reboot::__reboot(int, int, int, void *) -int syslog::klogctl(int, char *, int) -int sysinfo(struct sysinfo *) - -; -; Low-level I/O (generally architecture-specific) -; - int iopl(int) - int ioperm(unsigned long, unsigned long, int) - int vm86(struct vm86_struct *) - -; -; Most architectures have the socket interfaces using regular -; system calls. -; - long socketcall::__socketcall(int, const unsigned long *) -#include "SOCKETCALLS.def" diff --git a/klibc/klibc/__put_env.c b/klibc/klibc/__put_env.c deleted file mode 100644 index 7e55f2c43b..0000000000 --- a/klibc/klibc/__put_env.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * __put_env.c - common code for putenv() and setenv() - */ - -#include -#include -#include -#include - -/* Initialized to zero, meaning "not malloc'd" */ -static size_t __environ_size; - -/* str should be a duplicated version of the input string; - len is the length of the key including the = sign */ -int __put_env(char *str, size_t len, int overwrite) -{ - char **p, *q; - char **newenv; - size_t n; - - n = 1; /* Include space for final NULL */ - for ( p = environ ; (q = *p) ; p++ ) { - n++; - if ( !strncmp(q,str,len) ) { - if ( !overwrite ) - free(str); - else - *p = str; /* Possible memory leak... */ - return 0; - } - } - - /* Need to extend the environment */ - if ( n < __environ_size ) { - p[1] = NULL; - *p = str; - return 0; - } else { - if ( __environ_size ) { - newenv = realloc(environ, (__environ_size << 1)*sizeof(char *)); - if ( !newenv ) - return -1; - - __environ_size <<= 1; - } else { - /* Make a reasonable guess how much more space we need */ - size_t newsize = n+32; - newenv = malloc(newsize*sizeof(char *)); - if ( !newenv ) - return -1; - - memcpy(newenv, environ, n*sizeof(char *)); - __environ_size = newsize; - } - newenv[n-1] = str; /* Old NULL position */ - newenv[n] = NULL; - environ = newenv; - } - return 0; -} diff --git a/klibc/klibc/__shared_init.c b/klibc/klibc/__shared_init.c deleted file mode 100644 index 592a3db6f5..0000000000 --- a/klibc/klibc/__shared_init.c +++ /dev/null @@ -1,2 +0,0 @@ -#define SHARED 1 -#include "libc_init.c" diff --git a/klibc/klibc/__signal.c b/klibc/klibc/__signal.c deleted file mode 100644 index b5081d386b..0000000000 --- a/klibc/klibc/__signal.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * __signal.c - */ - -#include - -__sighandler_t __signal(int signum, __sighandler_t handler, int flags) -{ - struct sigaction sa; - - sa.sa_handler = handler; - sa.sa_flags = flags; - sigemptyset(&sa.sa_mask); - - if ( sigaction(signum, &sa, &sa) ) { - return (__sighandler_t)SIG_ERR; - } else { - return (__sighandler_t)sa.sa_handler; - } -} - - diff --git a/klibc/klibc/__static_init.c b/klibc/klibc/__static_init.c deleted file mode 100644 index 0b59eedaa7..0000000000 --- a/klibc/klibc/__static_init.c +++ /dev/null @@ -1,2 +0,0 @@ -#define SHARED 0 -#include "libc_init.c" diff --git a/klibc/klibc/abort.c b/klibc/klibc/abort.c deleted file mode 100644 index 9280d9861b..0000000000 --- a/klibc/klibc/abort.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * abort.c - */ - -#include -#include -#include - -void abort(void) -{ - sigset_t set; - - sigemptyset(&set); - sigaddset(&set, SIGABRT); - sigprocmask(SIG_UNBLOCK, &set, NULL); - raise(SIGABRT); - _exit(255); /* raise() should have killed us */ -} - diff --git a/klibc/klibc/alarm.c b/klibc/klibc/alarm.c deleted file mode 100644 index 40c0969432..0000000000 --- a/klibc/klibc/alarm.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * alarm.c - */ - -#include -#include - -#ifndef __NR_alarm - -/* Emulate alarm() via setitimer() */ - -unsigned int alarm(unsigned int seconds) -{ - struct itimerval iv; - - iv.it_interval.tv_sec = iv.it_interval.tv_usec = 0; - iv.it_value.tv_sec = seconds; - iv.it_value.tv_usec = 0; - - setitimer(ITIMER_REAL, &iv, &iv); - - return iv.it_value.tv_sec + (iv.it_value.tv_usec ? 1 : 0); -} - -#endif diff --git a/klibc/klibc/arch/README b/klibc/klibc/arch/README deleted file mode 100644 index eceb23de4b..0000000000 --- a/klibc/klibc/arch/README +++ /dev/null @@ -1,67 +0,0 @@ -To port klibc to a new architecture, you need: - -a) A directory structure - -Each archtecture has an arch/ directory, which should include an -MCONFIG and a Makefile.inc file. - -b) Startup code (arch/*/crt0.S) - -The crt0.S assembly routine typically corresponds to the following -pseudo-C code. In addition, each architecture needs any support -routines that gcc-generated code expects to find in the system library --- Alpha, for example, needs divide subroutines. - -The "getenvtest" test program is a very good test for proper crt0.S -functionality. - - -extern __noreturn __libc_init(void *, void *); - -__noreturn _start(void) -{ - void *elf_data = get_elf_data_address(); /* Usually the stack address */ - void *atexit_ptr = get_atexit_ptr(); /* Usually in a register */ - - /* Some architectures need this for debugging to work */ - setup_null_stack_frame_if_necessary(); - - __libc_init(elf_data, atexit_ptr); -} - - -c) A setenv implementation (arch/*/setjmp.S, arch/*/include/klibc/archsetjmp.h) - -On most (but not all!) architectures, this entails creating a setjmp -buffer big enough to hold all callee-saved registers, plus the stack -pointer and the return address. In setjmp.S you have: - -* A "setjmp" function that writes out the callee-saved registers, the - stack pointer and the return address to the buffer pointed to by the - first argument, and then returns zero normally. - - On some architectures you need to take some kind of action to make - sure the contents of the stack is actually manifest in memory and - not cached in the CPU. In some cases (e.g. on SPARC) this will - automatically spill the registers onto the stack; then they don't - need to be spilled into the jmp_buf. - -* A "longjmp" function that read back these same registers from the - jmp_buf pointed to by the first argument, and returns the second - argument *to the address specified in the jmp_buf*. - - On some architectures you need to take some kind of action to flush - any cached stack data or return stack. - - -d) Any support functions needed by gcc, *unless* they are in libgcc - *and* libgcc is usable for klibc on your particular platform. If - libgcc isn't usable for klibc (on MIPS, for example, libgcc is - compiled in a way that is not compatible with klibc) there are - reasonably good clones of most of the libgcc functions in the libgcc - directory. To use them, add them to ARCHOBJS in - arch/*/Makefile.inc. - - -e) A link location for the shared klibc. This should be specified in - SHAREDFLAGS in arch/*/MCONFIG. diff --git a/klibc/klibc/arch/alpha/MCONFIG b/klibc/klibc/arch/alpha/MCONFIG deleted file mode 100644 index d7ab6c0b82..0000000000 --- a/klibc/klibc/arch/alpha/MCONFIG +++ /dev/null @@ -1,17 +0,0 @@ -# -*- makefile -*- -# -# arch/alpha/MCONFIG -# -# Build configuration for this architecture -# - -OPTFLAGS = -Os -BITSIZE = 64 - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# 7 GB - normal binaries start at 4.5 GB, and the stack is below -# the binary. -SHAREDFLAGS = -Ttext 0x1c0000200 - diff --git a/klibc/klibc/arch/alpha/Makefile.inc b/klibc/klibc/arch/alpha/Makefile.inc deleted file mode 100644 index 62fce9dc28..0000000000 --- a/klibc/klibc/arch/alpha/Makefile.inc +++ /dev/null @@ -1,95 +0,0 @@ -# -*- makefile -*- -# -# arch/alpha/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -# Special CFLAGS for the divide code -DIVCFLAGS = $(REQFLAGS) \ - -O3 -fomit-frame-pointer -fcall-saved-1 -fcall-saved-2 \ - -fcall-saved-3 -fcall-saved-4 -fcall-saved-5 -fcall-saved-6 \ - -fcall-saved-7 -fcall-saved-8 -ffixed-15 -fcall-saved-16 \ - -fcall-saved-17 -fcall-saved-18 -fcall-saved-19 -fcall-saved-20 \ - -fcall-saved-21 -fcall-saved-22 -ffixed-23 -fcall-saved-24 \ - -ffixed-25 -ffixed-27 - -ARCHOBJS = \ - arch/$(ARCH)/__divqu.o \ - arch/$(ARCH)/__remqu.o \ - arch/$(ARCH)/__divq.o \ - arch/$(ARCH)/__remq.o \ - arch/$(ARCH)/__divlu.o \ - arch/$(ARCH)/__remlu.o \ - arch/$(ARCH)/__divl.o \ - arch/$(ARCH)/__reml.o \ - arch/$(ARCH)/pipe.o \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o \ - arch/$(ARCH)/sysdual.o - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - -arch/$(ARCH)/%.s: arch/$(ARCH)/%.ss - sed -e 's/\$$0\b/$$27/g' -e 's/\$$24\b/$$99/g' \ - -e 's/\$$16\b/$$24/g' -e 's/\$$17\b/$$25/g' \ - -e 's/\$$26\b/$$23/g' -e 's/\$$99\b/$$16/g' < $< > $@ - -arch/$(ARCH)/%.ls: arch/$(ARCH)/%.lss - sed -e 's/\$$0\b/$$27/g' -e 's/\$$24\b/$$99/g' \ - -e 's/\$$16\b/$$24/g' -e 's/\$$17\b/$$25/g' \ - -e 's/\$$26\b/$$23/g' -e 's/\$$99\b/$$16/g' < $< > $@ - -arch/$(ARCH)/__divqu.ss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=0 -DBITS=64 -DNAME=__divqu -S -o $@ $< - -arch/$(ARCH)/__remqu.ss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=1 -DBITS=64 -DNAME=__remqu -S -o $@ $< - -arch/$(ARCH)/__divq.ss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=0 -DBITS=64 -DNAME=__divq -S -o $@ $< - -arch/$(ARCH)/__remq.ss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=1 -DBITS=64 -DNAME=__remq -S -o $@ $< - -arch/$(ARCH)/__divlu.ss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=0 -DBITS=32 -DNAME=__divlu -S -o $@ $< - -arch/$(ARCH)/__remlu.ss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -DSIGNED=0 -DREM=1 -DBITS=32 -DNAME=__remlu -S -o $@ $< - -arch/$(ARCH)/__divl.ss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=0 -DBITS=32 -DNAME=__divl -S -o $@ $< - -arch/$(ARCH)/__reml.ss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -DSIGNED=1 -DREM=1 -DBITS=32 -DNAME=__reml -S -o $@ $< - -arch/$(ARCH)/__divqu.lss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=0 -DBITS=64 -DNAME=__divqu -S -o $@ $< - -arch/$(ARCH)/__remqu.lss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=1 -DBITS=64 -DNAME=__remqu -S -o $@ $< - -arch/$(ARCH)/__divq.lss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=0 -DBITS=64 -DNAME=__divq -S -o $@ $< - -arch/$(ARCH)/__remq.lss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=1 -DBITS=64 -DNAME=__remq -S -o $@ $< - -arch/$(ARCH)/__divlu.lss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=0 -DBITS=32 -DNAME=__divlu -S -o $@ $< - -arch/$(ARCH)/__remlu.lss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=0 -DREM=1 -DBITS=32 -DNAME=__remlu -S -o $@ $< - -arch/$(ARCH)/__divl.lss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=0 -DBITS=32 -DNAME=__divl -S -o $@ $< - -arch/$(ARCH)/__reml.lss: arch/$(ARCH)/divide.c - $(CC) $(DIVCFLAGS) -fPIC -DSIGNED=1 -DREM=1 -DBITS=32 -DNAME=__reml -S -o $@ $< - -archclean: - rm -f arch/$(ARCH)/*.ss arch/$(ARCH)/*.lss - diff --git a/klibc/klibc/arch/alpha/README-gcc b/klibc/klibc/arch/alpha/README-gcc deleted file mode 100644 index 9aaba72837..0000000000 --- a/klibc/klibc/arch/alpha/README-gcc +++ /dev/null @@ -1,23 +0,0 @@ - The current Alpha chips don't provide hardware for integer - division. The C compiler expects the functions - - __divqu: 64-bit unsigned long divide - __remqu: 64-bit unsigned long remainder - __divq/__remq: signed 64-bit - __divlu/__remlu: unsigned 32-bit - __divl/__reml: signed 32-bit - - These are not normal C functions: instead of the normal calling - sequence, these expect their arguments in registers t10 and t11, and - return the result in t12 (aka pv). Register AT may be clobbered - (assembly temporary), anything else must be saved. - - Furthermore, the return address is in t9 instead of ra. - - Normal function Divide functions - --------------- ---------------- - v0 ($0) t12/pv ($27) - a0 ($16) t10 ($24) - a1 ($17) t11 ($25) - ra ($26) t9 ($23) - diff --git a/klibc/klibc/arch/alpha/crt0.S b/klibc/klibc/arch/alpha/crt0.S deleted file mode 100644 index 904b539741..0000000000 --- a/klibc/klibc/arch/alpha/crt0.S +++ /dev/null @@ -1,22 +0,0 @@ -# -# arch/alpha/crt0.S -# - - .text - .type _start,@function - .ent _start, 0 - .globl _start -_start: - .frame $30, 0, $26, 0 - mov $31, $15 - br $29, 1f -1: ldgp $29, 0($29) - .prologue 0 - - lda $16, 0($30) # ELF data structure - lda $17, 0($0) # atexit pointer - - jsr $26, __libc_init - - .size _start,.-_start - .end _start diff --git a/klibc/klibc/arch/alpha/divide.c b/klibc/klibc/arch/alpha/divide.c deleted file mode 100644 index 49d77cd5dc..0000000000 --- a/klibc/klibc/arch/alpha/divide.c +++ /dev/null @@ -1,57 +0,0 @@ -#include -#include -#include - -#if BITS == 64 -typedef uint64_t uint; -typedef int64_t sint; -#else -typedef uint32_t uint; -typedef int32_t sint; -#endif - -#ifdef SIGNED -typedef sint xint; -#else -typedef uint xint; -#endif - -xint NAME (uint num, uint den) -{ - uint quot = 0, qbit = 1; - int minus = 0; - xint v; - - if ( den == 0 ) { - /* This is really $16, but $16 and $24 are exchanged by a script */ - register unsigned long cause asm("$24") = GEN_INTDIV; - asm volatile("call_pal %0" :: "i" (PAL_gentrap), "r" (cause)); - return 0; /* If trap returns... */ - } - -#if SIGNED - if ( (sint)(num^den) < 0 ) - minus = 1; - if ( (sint)num < 0 ) num = -num; - if ( (sint)den < 0 ) den = -den; -#endif - - /* Left-justify denominator and count shift */ - while ( (sint)den >= 0 ) { - den <<= 1; - qbit <<= 1; - } - - while ( qbit ) { - if ( den <= num ) { - num -= den; - quot += qbit; - } - den >>= 1; - qbit >>= 1; - } - - v = (xint)(REM ? num : quot); - if ( minus ) v = -v; - return v; -} diff --git a/klibc/klibc/arch/alpha/pipe.c b/klibc/klibc/arch/alpha/pipe.c deleted file mode 100644 index 5aee9edbab..0000000000 --- a/klibc/klibc/arch/alpha/pipe.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include - -/* pipe() on alpha returns both file descriptors in registers -- - $0 and $20 respectively. This is unlike any other system call, - as far as I can tell. */ - -int pipe(int *fds) -{ - register long sc_0 __asm__("$0"); - register long sc_19 __asm__("$19"); - register long sc_20 __asm__("$20"); - - sc_0 = __NR_pipe; - asm volatile("callsys" : "=r" (sc_0), "=r" (sc_19), "=r" (sc_20) - : "0" (sc_0) - : _syscall_clobbers); - - if ( sc_19 ) { - errno = sc_19; - return -1; - } - - fds[0] = sc_0; - fds[1] = sc_20; - - return 0; -} diff --git a/klibc/klibc/arch/alpha/setjmp.S b/klibc/klibc/arch/alpha/setjmp.S deleted file mode 100644 index 5d915f2dbe..0000000000 --- a/klibc/klibc/arch/alpha/setjmp.S +++ /dev/null @@ -1,77 +0,0 @@ -# -# setjmp.S -# - -# -# The jmp_buf looks like: -# -# s0..5 -# fp -# ra -# gp -# sp -# - -#include - - .text - .align 3 - .type setjmp,@function - .ent setjmp, 0 - .globl setjmp -setjmp: - lda v0, 0(zero) - stq s0, 0(a0) - stq s1, 8(a0) - stq s2, 16(a0) - stq s3, 24(a0) - stq s4, 32(a0) - stq s5, 40(a0) - stq fp, 48(a0) - stq ra, 56(a0) - stq gp, 64(a0) - stq sp, 72(a0) - stt $f2, 80(a0) - stt $f3, 88(a0) - stt $f4, 96(a0) - stt $f5, 104(a0) - stt $f6, 112(a0) - stt $f7, 120(a0) - stt $f8, 128(a0) - stt $f9, 136(a0) - ret zero,(ra),1 - - .size setjmp,.-setjmp - .end setjmp - - .type longjmp,@function - .ent longjmp, 0 - .globl longjmp -longjmp: - mov a1, v0 - ldq s0, 0(a0) - ldq s1, 8(a0) - ldq s2, 16(a0) - ldq s3, 24(a0) - ldq s4, 32(a0) - ldq s5, 40(a0) - ldq fp, 48(a0) - ldq ra, 56(a0) - ldq gp, 64(a0) - ldq sp, 72(a0) - ldt $f2, 80(a0) - ldt $f3, 88(a0) - ldt $f4, 96(a0) - ldt $f5, 104(a0) - ldt $f6, 112(a0) - ldt $f7, 120(a0) - ldt $f8, 128(a0) - ldt $f9, 136(a0) - /* We're bound to get a mispredict here, but at least give us - a chance to get the return stack back in sync... */ - ret zero,(ra),1 - - .size longjmp,.-longjmp - .end longjmp - - diff --git a/klibc/klibc/arch/alpha/syscall.S b/klibc/klibc/arch/alpha/syscall.S deleted file mode 100644 index 0c87414b1a..0000000000 --- a/klibc/klibc/arch/alpha/syscall.S +++ /dev/null @@ -1,26 +0,0 @@ -# -# arch/alpha/syscall.S -# - -#include - - .text - .align 3 - .type __syscall_common,@function - .ent __syscall_common, 0 - .globl __syscall_common -__syscall_common: - .frame sp,0,ra,0 - callsys - beq a3, 1f - br pv, 2f # pv <- pc -2: - ldgp gp, 0(pv) - lda a1, errno - lda v0, -1(zero) - stl a3, 0(a1) -1: - ret zero,(ra),1 - - .size __syscall_common,.-__syscall_common - .end __syscall_common diff --git a/klibc/klibc/arch/alpha/sysdual.S b/klibc/klibc/arch/alpha/sysdual.S deleted file mode 100644 index c00db88960..0000000000 --- a/klibc/klibc/arch/alpha/sysdual.S +++ /dev/null @@ -1,33 +0,0 @@ -# -# arch/alpha/sysdual.S -# - -# -# Some system calls have an alternate return value in r20 (a4). -# This system call stub is for system calls where that is -# the "real" return value. -# - -#include - - .text - .align 3 - .type __syscall_dual1,@function - .ent __syscall_dual1, 0 - .globl __syscall_dual1 -__syscall_dual1: - .frame sp,0,ra,0 - callsys - mov v0, a4 - beq a3, 1f - br pv, 2f # pv <- pc -2: - ldgp gp, 0(pv) - lda a1, errno - lda v0, -1(zero) - stl a3, 0(a1) -1: - ret zero,(ra),1 - - .size __syscall_dual1,.-__syscall_dual1 - .end __syscall_dual1 diff --git a/klibc/klibc/arch/alpha/sysstub.ph b/klibc/klibc/arch/alpha/sysstub.ph deleted file mode 100644 index 08b97e807e..0000000000 --- a/klibc/klibc/arch/alpha/sysstub.ph +++ /dev/null @@ -1,37 +0,0 @@ -# -*- perl -*- -# -# arch/alpha/sysstub.ph -# -# Script to generate system call stubs -# - -# On Alpha, most system calls follow the standard convention, with the -# system call number in r0 (v0), return an error value in r19 (a3) as -# well as the return value in r0 (v0). -# -# A few system calls are dual-return with the second return value in -# r20 (a4). - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - $stype = $stype || 'common'; - $stype = 'common' if ( $stype eq 'dual0' ); - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.text\n"; - print OUT "\t.type ${fname},\@function\n"; - print OUT "\t.ent\t${fname}, 0\n"; # What is this? - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - print OUT "\tlda\tv0, __NR_${sname}(zero)\n"; - print OUT "\tbr __syscall_${stype}\n"; - print OUT "\t.size\t${fname},.-${fname}\n"; - print OUT "\t.end\t${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/arm/MCONFIG b/klibc/klibc/arch/arm/MCONFIG deleted file mode 100644 index fe26b996a7..0000000000 --- a/klibc/klibc/arch/arm/MCONFIG +++ /dev/null @@ -1,26 +0,0 @@ -# -*- makefile -*- -# -# arch/arm/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -THUMB = n -CPU_ARCH := armv4 -CPU_TUNE := strongarm - -OPTFLAGS = -Os -march=$(CPU_ARCH) -mtune=$(CPU_TUNE) -BITSIZE = 32 - -ifeq ($(THUMB),y) -CPU_ARCH := $(CPU_ARCH)t -OPTFLAGS += -mthumb -LDFLAGS += --thumb-entry _start -endif - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -SHAREDFLAGS = -Ttext 0x01000200 diff --git a/klibc/klibc/arch/arm/Makefile.inc b/klibc/klibc/arch/arm/Makefile.inc deleted file mode 100644 index 0603d850bd..0000000000 --- a/klibc/klibc/arch/arm/Makefile.inc +++ /dev/null @@ -1,43 +0,0 @@ -# -*- makefile -*- -# -# arch/arm/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - libgcc/__divsi3.o \ - libgcc/__modsi3.o \ - libgcc/__udivsi3.o \ - libgcc/__umodsi3.o \ - libgcc/__udivmodsi4.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o \ - arch/arm/syscall.o - -ifeq ($(THUMB),y) -ARCHOBJS += arch/arm/setjmp-thumb.o -LIBGCC = -else -ARCHOBJS += arch/arm/setjmp-arm.o -endif - -arch/arm/sysstubs.a: arch/arm/sysstubs.pl - mkdir -p arch/arm/sysstubs - $(PERL) $< arch/arm/sysstubs - $(MAKE) $(patsubst %.S,%.o,$(wildcard arch/arm/sysstubs/*.S)) - -rm -f $@ - $(AR) cq $@ arch/arm/sysstubs/*.o - $(RANLIB) $@ - - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - -archclean: - -rm -rf arch/arm/sysstubs - -rm -f arch/arm/sysstubs.a diff --git a/klibc/klibc/arch/arm/crt0.S b/klibc/klibc/arch/arm/crt0.S deleted file mode 100644 index fc1104ef0e..0000000000 --- a/klibc/klibc/arch/arm/crt0.S +++ /dev/null @@ -1,23 +0,0 @@ -# -# arch/arm/crt0.S -# -# void _start(void) -# { -# __libc_init(elf_structure, atexit_ptr); -# } -# - - .text - .align 4 - .type _start,#function - .globl _start - -#ifdef __thumb__ - .thumb_func -#endif - -_start: mov r0, sp - mov r1, #0 - bl __libc_init - - .size _start,.-_start diff --git a/klibc/klibc/arch/arm/setjmp-arm.S b/klibc/klibc/arch/arm/setjmp-arm.S deleted file mode 100644 index 1a29ee7f71..0000000000 --- a/klibc/klibc/arch/arm/setjmp-arm.S +++ /dev/null @@ -1,39 +0,0 @@ -# -# arch/arm/setjmp.S -# -# setjmp/longjmp for the ARM architecture -# - -# -# The jmp_buf is assumed to contain the following, in order: -# r4 -# r5 -# r6 -# r7 -# r8 -# r9 -# r10 -# fp -# sp -# lr -# - - .text - .align 4 - .globl setjmp - .type setjmp, #function -setjmp: - stmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} - mov r0, #0 - mov pc, lr - .size setjmp,.-setjmp - - .text - .align 4 - .globl longjmp - .type longjmp, #function -longjmp: - ldmia r0, {r4, r5, r6, r7, r8, r9, r10, fp, sp, lr} - mov r0, r1 - mov pc, lr - .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/arm/setjmp-thumb.S b/klibc/klibc/arch/arm/setjmp-thumb.S deleted file mode 100644 index b581c5f7ad..0000000000 --- a/klibc/klibc/arch/arm/setjmp-thumb.S +++ /dev/null @@ -1,58 +0,0 @@ -# -# arch/arm/setjmp-thumb.S -# -# setjmp/longjmp for the ARM/thumb architecture -# - -# -# The jmp_buf is assumed to contain the following, in order: -# lr -# r4 -# r5 -# r6 -# r7 -# r8 -# r9 -# r10 -# fp -# sp -# - - .text - .align 4 - .globl setjmp - .type setjmp, #function - .thumb_func -setjmp: - mov r3, lr - stmia r0!, {r3, r4, r5, r6, r7} - mov r3, r8 - mov r4, r9 - mov r5, r10 - mov r6, fp - mov r7, sp - stmia r0!, {r3, r4, r5, r6, r7} - mov r0, #0 - mov pc, lr - .size setjmp,.-setjmp - - .text - .align 4 - .globl longjmp - .type longjmp, #function - .thumb_func -longjmp: - mov r2, r0 - add r0, #5*4 - ldmia r0!, {r3, r4, r5, r6, r7} - mov r8, r3 - mov r9, r4 - mov r10, r5 - mov fp, r6 - mov sp, r7 - ldmia r2!, {r3, r4, r5, r6, r7} - mov r0, r1 - bne 1f - mov r0, #1 -1: mov pc, r3 - .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/arm/syscall.S b/klibc/klibc/arch/arm/syscall.S deleted file mode 100644 index 0e73f68ed0..0000000000 --- a/klibc/klibc/arch/arm/syscall.S +++ /dev/null @@ -1,50 +0,0 @@ -/* - * arch/arm/syscall.S - * - * System call common handling - */ - - .type __syscall_common,#function - .globl __syscall_common -#ifndef __thumb__ - /* ARM version - this is executed after the swi */ - - .align 4 -__syscall_common: - cmn r0, #4096 - rsbcs r2, r0, #0 - ldrcs r3, 1f - mvncs r0, #0 - strcs r2, [r3] - ldmfd sp!,{r4,r5,pc} - - .align 4 -1: - .word errno - -#else - /* Thumb version - must still load r4 and r5 and run swi */ - - .thumb_func - .align 2 -__syscall_common: - ldr r4, [sp #12] - ldr r5, [sp #16] - swi 0 - ldr r1, 2f - cmp r0, r1 - bcc 1f - ldr r1, 3f - neg r2, r0 - mvn r0, #0 - str r2, [r1] -1: - pop {r4,r5,r7,pc} - - .align 4 -2: - .word #-4095 -3: - .word errno - -#endif diff --git a/klibc/klibc/arch/arm/sysstub.ph b/klibc/klibc/arch/arm/sysstub.ph deleted file mode 100644 index 256ea3d534..0000000000 --- a/klibc/klibc/arch/arm/sysstub.ph +++ /dev/null @@ -1,44 +0,0 @@ -# -*- perl -*- -# -# arch/arm/sysstub.ph -# -# Script to generate system call stubs -# - - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - - print OUT "\t.text\n"; - print OUT "\t.type\t${fname}, #function\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "\t.align\t4\n"; - - print OUT "#ifndef __thumb__\n"; - - # ARM version first - print OUT "${fname}:\n"; - print OUT "\tstmfd\tsp!,{r4,r5,lr}\n"; - print OUT "\tldr\tr4,[sp,#12]\n"; - print OUT "\tldr\tr5,[sp,#16]\n"; - print OUT "\tswi\t# __NR_${sname}\n"; - print OUT "\tb\t__syscall_common\n"; - - print OUT "#else\n"; - - # Thumb version - print OUT "\t.thumb_func\n"; - print OUT "${fname}:\n"; - print OUT "\tpush\t{r4,r5,r7,pc}\n"; - print OUT "\tmov\tr7, # __NR_${sname}\n"; - print OUT "\tb\t__syscall_common\n"; - - print OUT "#endif\n"; - - print OUT "\t.size\t__syscall${i},.-__syscall${i}\n"; -} - -1; diff --git a/klibc/klibc/arch/cris/MCONFIG b/klibc/klibc/arch/cris/MCONFIG deleted file mode 100644 index 2762494a30..0000000000 --- a/klibc/klibc/arch/cris/MCONFIG +++ /dev/null @@ -1,26 +0,0 @@ -# -*- makefile -*- -# -# arch/cris/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -fomit-frame-pointer -BITSIZE = 32 - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# 224 MB - normal binaries start at 0 -# (lib?)gcc on cris seems to insist on producing .init and .fini sections -SHAREDFLAGS = --section-start .init=0x0e000100 - -# The CRIS compiler needs an -iprefix to find libgcc includes when -# nostdinc is used. It also needs -mlinux to compile linux applications. -INCLUDE_PREFIX = $(shell $(CC) -print-libgcc-file-name | sed -e s/libgcc.a//) -ARCHREQFLAGS = -iprefix $(INCLUDE_PREFIX) -mlinux - -# Special flags needed for linking -LDFLAGS += -mcrislinux diff --git a/klibc/klibc/arch/cris/Makefile.inc b/klibc/klibc/arch/cris/Makefile.inc deleted file mode 100644 index 75fa17ba99..0000000000 --- a/klibc/klibc/arch/cris/Makefile.inc +++ /dev/null @@ -1,33 +0,0 @@ -# -*- makefile -*- -# -# arch/cris/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/__Umod.o \ - arch/$(ARCH)/__Udiv.o \ - arch/$(ARCH)/__Mod.o \ - arch/$(ARCH)/__Div.o \ - arch/$(ARCH)/__negdi2.o \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - -arch/$(ARCH)/__Umod.o: arch/$(ARCH)/divide.c - $(CC) $(CFLAGS) -DSIGNED=0 -DREM=1 -DBITS=32 -DNAME=__Umod -c -o $@ $< -arch/$(ARCH)/__Udiv.o: arch/$(ARCH)/divide.c - $(CC) $(CFLAGS) -DSIGNED=0 -DREM=0 -DBITS=32 -DNAME=__Udiv -c -o $@ $< -arch/$(ARCH)/__Mod.o: arch/$(ARCH)/divide.c - $(CC) $(CFLAGS) -DSIGNED=1 -DREM=1 -DBITS=32 -DNAME=__Mod -c -o $@ $< -arch/$(ARCH)/__Div.o: arch/$(ARCH)/divide.c - $(CC) $(CFLAGS) -DSIGNED=1 -DREM=0 -DBITS=32 -DNAME=__Div -c -o $@ $< - -archclean: diff --git a/klibc/klibc/arch/cris/__negdi2.S b/klibc/klibc/arch/cris/__negdi2.S deleted file mode 100644 index 3cca9edfa8..0000000000 --- a/klibc/klibc/arch/cris/__negdi2.S +++ /dev/null @@ -1,25 +0,0 @@ -/* - * arch/cris/__negdi2.c - */ - -/* - * In 2's complement arithmetric, -x == (~x + 1), so - * -{h,l} = (~{h,l} + {0,1) - * -{h,l} = {~h,~l} + {0,1} - * -{h,l} = {~h + cy, ~l + 1} - * ... where cy = (l == 0) - * -{h,l} = {~h + cy, -l} - */ - - .text - .balign 4 - .type __negdi2,@function - .globl __negdi2 -__negdi2: - neg.d $r10,$r10 - seq $r12 - not $r11 - ret - add.d $r12,$r11 - - .size __negdi2, .-__negdi2 diff --git a/klibc/klibc/arch/cris/crt0.S b/klibc/klibc/arch/cris/crt0.S deleted file mode 100644 index 989c82b2ba..0000000000 --- a/klibc/klibc/arch/cris/crt0.S +++ /dev/null @@ -1,28 +0,0 @@ -# -# arch/cris/crt0.S -# -# Does arch-specific initialization and invokes __libc_init -# with the appropriate arguments. -# -# See __static_init.c or __shared_init.c for the expected -# arguments. -# - - .text - .balign 4 - .type _start,@function - .globl _start -_start: - /* Save the address of the ELF argument array */ - move.d $sp,$r10 /* Address of ELF arguments */ - - /* atexit() function (assume null) */ - moveq 0,$r11 - - /* Set up a dummy stack frame to keep gcc from getting confused */ - push $r11 - push $r11 - jump __libc_init - - .size _start, .-_start - diff --git a/klibc/klibc/arch/cris/divide.c b/klibc/klibc/arch/cris/divide.c deleted file mode 100644 index 29081dc953..0000000000 --- a/klibc/klibc/arch/cris/divide.c +++ /dev/null @@ -1,92 +0,0 @@ -#include -#include - -#if BITS == 64 -typedef uint64_t unum; -typedef int64_t snum; -#else -typedef uint32_t unum; -typedef int32_t snum; -#endif - -#ifdef SIGNED -typedef snum xnum; -#else -typedef unum xnum; -#endif - -#ifdef __cris__ -static inline unum __attribute__((const)) dstep(unum rs, unum rd) { - asm("dstep %1,%0" : "+r" (rd) : "r" (rs)); - return rd; -} - -static inline unum __attribute__((const)) lz(unum rs) { - unum rd; - asm("lz %1,%0" : "=r" (rd) : "r" (rs)); - return rd; -} - -#else -/* For testing */ -static inline unum __attribute__ ((const)) dstep(unum rs, unum rd) { - rd <<= 1; - if ( rd >= rs ) - rd -= rs; - - return rd; -} - -static inline unum __attribute__((const)) lz(unum rs) { - unum rd = 0; - while ( rs >= 0x7fffffff ) { - rd++; - rs <<= 1; - } - return rd; -} - -#endif - -xnum NAME (unum num, unum den) -{ - unum quot = 0, qbit = 1; - int minus = 0; - xnum v; - - if ( den == 0 ) { - raise(SIGFPE); - return 0; /* If signal ignored... */ - } - - if (den == 1) return (xnum)(REM ? 0 : num); - -#if SIGNED - if ( (snum)(num^den) < 0 ) - minus = 1; - if ( (snum)num < 0 ) num = -num; - if ( (snum)den < 0 ) den = -den; -#endif - - den--; - - - /* Left-justify denominator and count shift */ - while ( (snum)den >= 0 ) { - den <<= 1; - qbit <<= 1; - } - - while ( qbit ) { - if ( den <= num ) { - num -= den; - quot += qbit; - } - den >>= 1; - qbit >>= 1; - } - - v = (xnum)(REM ? num : quot); - if ( minus ) v = -v; - return v; -} diff --git a/klibc/klibc/arch/cris/setjmp.S b/klibc/klibc/arch/cris/setjmp.S deleted file mode 100644 index 43162418af..0000000000 --- a/klibc/klibc/arch/cris/setjmp.S +++ /dev/null @@ -1,37 +0,0 @@ -# -# arch/cris/setjmp.S -# -# setjmp/longjmp for the cris architecture -# - -# -# The jmp_buf is assumed to contain the following, in order: -# $r8..$r0 (in that order) -# $sp ($r14) -# return address -# - - .text - .balign 4 - .globl setjmp - .type setjmp, @function -setjmp: - movem $r8,[$r10+] /* Save $r8..$r0 at $r10... */ - move.d $sp,[$r10+] - move $srp,[$r10] - ret - moveq 0,$r10 - - .size setjmp,.-setjmp - - .text - .balign 4 - .globl longjmp - .type longjmp, @function -longjmp: - movem [$r10+],$r8 /* Load $r8..$r0 from $r10... */ - move.d [$r10+],$sp - jump [$r10] - move.d $r11,$r10 - - .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/cris/syscall.S b/klibc/klibc/arch/cris/syscall.S deleted file mode 100644 index d71495aba2..0000000000 --- a/klibc/klibc/arch/cris/syscall.S +++ /dev/null @@ -1,30 +0,0 @@ -/* - * arch/cris/syscall.S - * - * On cris, r9 contains the syscall number (set by generated stub); - * r10..r13 contain arguments 0-3 per the standard calling convention, - * and arguments 4-5 are passed in $mof and $srp; however, we have - * to save $srp around the system call. - */ - - .section ".text","ax" - .balign 4 - .globl __syscall_common - .type __syscall_common,@function -__syscall_common: - push $srp - move [$sp+4],$mof - move [$sp+8],$srp - break 13 - - cmps.w -4096,$r10 - blo 1f - neg.d $r10,$r11 - move.d $r11,[errno] - moveq -1,$r10 -1: - pop $srp - ret - nop - - .size __syscall_common,.-__syscall_common diff --git a/klibc/klibc/arch/cris/sysstub.ph b/klibc/klibc/arch/cris/sysstub.ph deleted file mode 100644 index 182ad73f8c..0000000000 --- a/klibc/klibc/arch/cris/sysstub.ph +++ /dev/null @@ -1,29 +0,0 @@ -# -*- perl -*- -# -# arch/cris/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.text\n"; - print OUT "\t.type\t${fname},\@function\n"; - print OUT "\t.globl\t${fname}\n"; - print OUT "\t.balign\t4\n"; - print OUT "${fname}:\n"; - print OUT "#if __NR_${sname} <= 31\n"; - print OUT "\t moveq\t__NR_${sname}, \$r9\n"; - print OUT "#else\n"; - print OUT "\t move.d\t__NR_${sname}, \$r9\n"; - print OUT "#endif\n"; - print OUT "\tjump\t__syscall_common\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/i386/MCONFIG b/klibc/klibc/arch/i386/MCONFIG deleted file mode 100644 index ecd1307d7f..0000000000 --- a/klibc/klibc/arch/i386/MCONFIG +++ /dev/null @@ -1,33 +0,0 @@ -# -*- makefile -*- -# -# arch/i386/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -# Enable this to compile with register parameters; only safe for -# gcc >= 3 -REGPARM_OPT := -mregparm=3 -D_REGPARM=3 - -gcc_major := $(shell echo __GNUC__ | $(CC) -E -xc - | tail -n 1) - -OPTFLAGS = -march=i386 -Os -g -fomit-frame-pointer -LDFLAGS = -m elf_i386 - -ifneq ($(gcc_major),2) -REQFLAGS += $(REGPARM_OPT) -OPTFLAGS += -falign-functions=0 -falign-jumps=0 -falign-loops=0 -ARCHREQFLAGS += -m32 -else -OPTFLAGS += -malign-functions=0 -malign-jumps=0 -malign-loops=0 -endif - -BITSIZE = 32 - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# 96 MB - normal binaries start at 128 MB -SHAREDFLAGS = -Ttext 0x06000200 diff --git a/klibc/klibc/arch/i386/Makefile.inc b/klibc/klibc/arch/i386/Makefile.inc deleted file mode 100644 index 80344bd0a5..0000000000 --- a/klibc/klibc/arch/i386/Makefile.inc +++ /dev/null @@ -1,28 +0,0 @@ -# -*- makefile -*- -# -# arch/i386/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/exits.o \ - arch/$(ARCH)/socketcall.o \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o \ - arch/$(ARCH)/open.o \ - arch/$(ARCH)/sigreturn.o \ - arch/$(ARCH)/libgcc/__ashldi3.o \ - arch/$(ARCH)/libgcc/__ashrdi3.o \ - arch/$(ARCH)/libgcc/__lshrdi3.o \ - arch/$(ARCH)/libgcc/__muldi3.o \ - arch/$(ARCH)/libgcc/__negdi2.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - -archclean: diff --git a/klibc/klibc/arch/i386/crt0.S b/klibc/klibc/arch/i386/crt0.S deleted file mode 100644 index fb02c694c0..0000000000 --- a/klibc/klibc/arch/i386/crt0.S +++ /dev/null @@ -1,32 +0,0 @@ -# -# arch/i386/crt0.S -# -# Does arch-specific initialization and invokes __libc_init -# with the appropriate arguments. -# -# See __static_init.c or __shared_init.c for the expected -# arguments. -# - - .text - .align 4 - .type _start,@function - .globl _start -_start: - # Save the address of the ELF argument array - movl %esp,%eax # Address of ELF arguments - # Set up a faux stack frame for the benefit of gdb - xorl %ebp,%ebp - push %ebp # Keep gdb from getting confused - push %ebp # Keep gdb from getting confused - # Push the arguments and called __libc_init() -#ifndef _REGPARM - push %edx # atexit() function - push %eax # ELF array -#endif - call __libc_init - # If __libc_init returns, problem... - hlt - - .size _start, .-_start - diff --git a/klibc/klibc/arch/i386/exits.S b/klibc/klibc/arch/i386/exits.S deleted file mode 100644 index ed23d98bcb..0000000000 --- a/klibc/klibc/arch/i386/exits.S +++ /dev/null @@ -1,45 +0,0 @@ -# -# exit and _exit get included in *every* program, and gcc generates -# horrible code for them. Yes, this only saves a few bytes, but -# it does it in every program. -# - -#include - - .data - .align 4 - .globl __exit_handler - .type __exit_handler,@object -__exit_handler: - .long _exit - .size __exit_handler,4 - - .text - .align 4 - .globl exit - .type exit,@function -exit: - jmp *(__exit_handler) - .size exit,.-exit - - /* No need to save any registers... we're exiting! */ - .text - .align 4 - .globl _exit - .type _exit,@function -_exit: -#ifdef _REGPARM - movl %eax,%ebx -#else - popl %ebx - popl %ebx -#endif -#if __NR_exit == 1 - xorl %eax,%eax - incl %eax -#else - movl $__NR_exit,%eax -#endif - int $0x80 - hlt - .size _exit,.-exit diff --git a/klibc/klibc/arch/i386/libgcc/__ashldi3.S b/klibc/klibc/arch/i386/libgcc/__ashldi3.S deleted file mode 100644 index 61982eb0eb..0000000000 --- a/klibc/klibc/arch/i386/libgcc/__ashldi3.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * arch/i386/libgcc/__ashldi3.S - * - * 64-bit shl - */ - .text - .align 4 - .globl __ashldi3 - .type __ashldi3,@function -__ashldi3: -#ifndef _REGPARM - movl 4(%esp),%eax - movl 8(%esp),%edx - movb 12(%esp),%cl -#endif - cmpb $32,%cl - jae 1f - - shldl %cl,%eax,%edx - shl %cl,%eax - ret - -1: - xorl %edx,%edx - shl %cl,%eax - xchgl %edx,%eax - ret - - .size __ashldi3,.-__ashldi3 diff --git a/klibc/klibc/arch/i386/libgcc/__ashrdi3.S b/klibc/klibc/arch/i386/libgcc/__ashrdi3.S deleted file mode 100644 index 4ac2af69a1..0000000000 --- a/klibc/klibc/arch/i386/libgcc/__ashrdi3.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * arch/i386/libgcc/__ashrdi3.S - * - * 64-bit sar - */ - .text - .align 4 - .globl __ashrdi3 - .type __ashrdi3,@function -__ashrdi3: -#ifndef _REGPARM - movl 4(%esp),%eax - movl 8(%esp),%edx - movb 12(%esp),%cl -#endif - cmpb $32,%cl - jae 1f - - shrdl %cl,%edx,%eax - sarl %cl,%edx - ret - -1: - sarl %cl,%edx - movl %edx,%eax - cdq - ret - - .size __ashrdi3,.-__ashrdi3 diff --git a/klibc/klibc/arch/i386/libgcc/__lshrdi3.S b/klibc/klibc/arch/i386/libgcc/__lshrdi3.S deleted file mode 100644 index 730ee43178..0000000000 --- a/klibc/klibc/arch/i386/libgcc/__lshrdi3.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * arch/i386/libgcc/__lshrdi3.S - * - * 64-bit shr - */ - .text - .align 4 - .globl __lshrdi3 - .type __lshrdi3,@function -__lshrdi3: -#ifndef _REGPARM - movl 4(%esp),%eax - movl 8(%esp),%edx - movb 12(%esp),%cl -#endif - cmpb $32,%cl - jae 1f - - shrdl %cl,%edx,%eax - shrl %cl,%edx - ret - -1: - shrl %cl,%edx - xorl %eax,%eax - xchgl %edx,%eax - ret - - .size __lshrdi3,.-__lshrdi3 diff --git a/klibc/klibc/arch/i386/libgcc/__muldi3.S b/klibc/klibc/arch/i386/libgcc/__muldi3.S deleted file mode 100644 index 81e23b190e..0000000000 --- a/klibc/klibc/arch/i386/libgcc/__muldi3.S +++ /dev/null @@ -1,34 +0,0 @@ -/* - * arch/i386/libgcc/__muldi3.S - * - * 64*64 = 64 bit unsigned multiplication - */ - - .text - .align 4 - .globl __muldi3 - .type __muldi3,@function -__muldi3: - push %esi -#ifndef _REGPARM - movl 8(%esp),%eax - movl %eax,%esi - movl 16(%esp),%ecx - mull %ecx - imull 12(%esp),%ecx - imull 20(%esp),%esi - addl %ecx,%edx - addl %esi,%edx -#else - movl %eax,%esi - push %edx - mull %ecx - imull 8(%esp),%esi - addl %esi,%edx - pop %esi - imull %esi,%ecx - addl %ecx,%edx -#endif - pop %esi - ret - .size __muldi3,.-__muldi3 diff --git a/klibc/klibc/arch/i386/libgcc/__negdi2.S b/klibc/klibc/arch/i386/libgcc/__negdi2.S deleted file mode 100644 index c4f2cd517e..0000000000 --- a/klibc/klibc/arch/i386/libgcc/__negdi2.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * arch/i386/libgcc/__negdi2.S - * - * 64-bit negation - */ - - .text - .align 4 - .globl __negdi2 - .type __negdi2,@function -__negdi2: -#ifndef _REGPARM - movl 4(%esp),%eax - movl 8(%esp),%edx -#endif - negl %edx - negl %eax - sbbl $0,%edx - ret - - .size __negdi2,.-__negdi2 diff --git a/klibc/klibc/arch/i386/open.S b/klibc/klibc/arch/i386/open.S deleted file mode 100644 index 54dd6151d1..0000000000 --- a/klibc/klibc/arch/i386/open.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * arch/i386/open.S - * - * Handle the open() system call - oddball due to the varadic - * prototype, which forces the use of the cdecl calling convention, - * and the need for O_LARGEFILE. - */ - -#include - -/* , despite the name, isn't assembly-safe */ -#define O_LARGEFILE 0100000 - - .globl open - .type open,@function - -open: -#ifdef _REGPARM - movl 4(%esp),%eax - movl 8(%esp),%edx - movl 12(%esp),%ecx - orl $O_LARGEFILE,%edx -#else - orl $O_LARGEFILE,8(%esp) -#endif - pushl $__NR_open - jmp __syscall_common - - .size open,.-open diff --git a/klibc/klibc/arch/i386/setjmp.S b/klibc/klibc/arch/i386/setjmp.S deleted file mode 100644 index 2f3033f5bd..0000000000 --- a/klibc/klibc/arch/i386/setjmp.S +++ /dev/null @@ -1,58 +0,0 @@ -# -# arch/i386/setjmp.S -# -# setjmp/longjmp for the i386 architecture -# - -# -# The jmp_buf is assumed to contain the following, in order: -# %ebx -# %esp -# %ebp -# %esi -# %edi -# -# - - .text - .align 4 - .globl setjmp - .type setjmp, @function -setjmp: -#ifdef _REGPARM - movl %eax,%edx -#else - movl 4(%esp),%edx -#endif - popl %ecx # Return address, and adjust the stack - xorl %eax,%eax # Return value - movl %ebx,(%edx) - movl %esp,4(%edx) # Post-return %esp! - pushl %ecx # Make the call/return stack happy - movl %ebp,8(%edx) - movl %esi,12(%edx) - movl %edi,16(%edx) - movl %ecx,20(%edx) # Return address - ret - - .size setjmp,.-setjmp - - .text - .align 4 - .globl longjmp - .type longjmp, @function -longjmp: -#ifdef _REGPARM - xchgl %eax,%edx -#else - movl 4(%esp),%edx # jmp_ptr address - movl 8(%esp),%eax # Return value -#endif - movl (%edx),%ebx - movl 4(%edx),%esp - movl 8(%edx),%ebp - movl 12(%edx),%esi - movl 16(%edx),%edi - jmp *20(%edx) - - .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/i386/sigreturn.S b/klibc/klibc/arch/i386/sigreturn.S deleted file mode 100644 index f2a32419d3..0000000000 --- a/klibc/klibc/arch/i386/sigreturn.S +++ /dev/null @@ -1,15 +0,0 @@ -# -# arch/i386/sigreturn.S -# - -#include - - .text - .align 4 - .globl __sigreturn - .type __sigreturn,@function -__sigreturn: - pop %eax # Have no idea why this is needed... - movl $__NR_sigreturn,%eax - int $0x80 - .size __sigreturn,.-__sigreturn diff --git a/klibc/klibc/arch/i386/socketcall.S b/klibc/klibc/arch/i386/socketcall.S deleted file mode 100644 index b13d204c32..0000000000 --- a/klibc/klibc/arch/i386/socketcall.S +++ /dev/null @@ -1,42 +0,0 @@ -# -# socketcall.S -# -# On i386, the main (only?) user of socketcall(2), the memory array -# socketcall(2) needs is conveniently already assembled for us on -# the stack. Capitalize on that to make a common socketcall stub. -# - -#include - -#ifdef __i386__ - - .text - .align 4 - .globl __socketcall_common - .type __socketcall_common, @function - -__socketcall_common: - pushl %ebx - - movzbl %al,%ebx # The socketcall number is passed in in %al - leal 8(%esp),%ecx # Argument pointer - movl $__NR_socketcall,%eax - int $0x80 - - cmpl $-4096,%eax # Error return? - - popl %ebx - - jb 1f - - negl %eax - movl %eax,errno - orl $-1,%eax # Return -1 -1: - ret - - .size __socketcall_common,.-__socketcall_common - -#endif - - diff --git a/klibc/klibc/arch/i386/syscall.S b/klibc/klibc/arch/i386/syscall.S deleted file mode 100644 index 0634e8208a..0000000000 --- a/klibc/klibc/arch/i386/syscall.S +++ /dev/null @@ -1,60 +0,0 @@ -/* - * arch/i386/syscall.S - * - * Common tail-handling code for system calls. Because of __syscalldecl - * we are using the stack even on if we are compiling with regparm. - * - * The arguments are on the stack; the system call number in %eax. - */ - -#define ARG(n) (4*n+20)(%esp) - - .text - .align 4 - .globl __syscall_common - .type __syscall_common,@function -__syscall_common: -#ifdef _REGPARM - xchgl %ebx,(%esp) -#else - popl %eax - pushl %ebx -#endif - pushl %esi - pushl %edi - pushl %ebp - -#ifdef _REGPARM - xchgl %eax,%ebx - xchgl %ecx,%edx - movl ARG(0),%esi - movl ARG(1),%edi - movl ARG(2),%ebp -#else - movl ARG(0),%ebx # Syscall arguments - movl ARG(1),%ecx - movl ARG(2),%edx - movl ARG(3),%esi - movl ARG(4),%edi - movl ARG(5),%ebp -#endif - int $0x80 - - cmpl $-4096,%eax - - popl %ebp - popl %edi - popl %esi - popl %ebx - - jb 1f - - # Error return, must set errno - negl %eax - movl %eax,errno - orl $-1,%eax # Return -1 - -1: - ret - - .size __syscall_common,.-__syscall_common diff --git a/klibc/klibc/arch/i386/sysstub.ph b/klibc/klibc/arch/i386/sysstub.ph deleted file mode 100644 index e2649e283e..0000000000 --- a/klibc/klibc/arch/i386/sysstub.ph +++ /dev/null @@ -1,32 +0,0 @@ -# -*- perl -*- -# -# arch/i386/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.type ${fname},\@function\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - - if ( $stype eq 'varadic' ) { - print OUT "#ifdef _REGPARM\n"; - print OUT "\tmovl 4(%esp),%eax\n"; - print OUT "\tmovl 8(%esp),%edx\n"; - print OUT "\tmovl 12(%esp),%ecx\n"; - print OUT "#endif\n"; - } - - print OUT "\tpushl \$__NR_${sname}\n"; - print OUT "\tjmp __syscall_common\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/ia64/MCONFIG b/klibc/klibc/arch/ia64/MCONFIG deleted file mode 100644 index 36b30ffb81..0000000000 --- a/klibc/klibc/arch/ia64/MCONFIG +++ /dev/null @@ -1,11 +0,0 @@ -# -*- makefile -*- -# -# arch/ia64/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -BITSIZE = 64 diff --git a/klibc/klibc/arch/ia64/Makefile.inc b/klibc/klibc/arch/ia64/Makefile.inc deleted file mode 100644 index 6363c1f948..0000000000 --- a/klibc/klibc/arch/ia64/Makefile.inc +++ /dev/null @@ -1,26 +0,0 @@ -# -*- makefile -*- -# -# arch/ia64/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/vfork.o \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/pipe.o \ - arch/$(ARCH)/syscall.o \ - libgcc/__divdi3.o \ - libgcc/__divsi3.o \ - libgcc/__udivdi3.o \ - libgcc/__udivsi3.o \ - libgcc/__umodsi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmodsi4.o \ - libgcc/__udivmoddi4.o - -ARCHSOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS)) - -archclean: diff --git a/klibc/klibc/arch/ia64/crt0.S b/klibc/klibc/arch/ia64/crt0.S deleted file mode 100644 index 4b128154e8..0000000000 --- a/klibc/klibc/arch/ia64/crt0.S +++ /dev/null @@ -1,27 +0,0 @@ - -#include - - .align 32 - .global _start - - .proc _start - .type _start,@function -_start: - .prologue - .save rp, r0 - - alloc r2 = ar.pfs,0,0,2,0 - movl r3 = FPSR_DEFAULT - ;; - adds out0= 16,sp /* argc pointer */ - movl gp = @gprel(0f) -0: mov r9 = ip - ;; - sub gp = r9, gp /* back-compute gp value */ - - .body - br.call.sptk.few rp = __libc_init - ;; - break 0 /* break miserably if we ever return */ - - .endp _start diff --git a/klibc/klibc/arch/ia64/pipe.c b/klibc/klibc/arch/ia64/pipe.c deleted file mode 100644 index 87a6981e55..0000000000 --- a/klibc/klibc/arch/ia64/pipe.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * pipe.c - */ - -#include -#include - -#define ASM_CLOBBERS ,"out2", "out3", "out4", "out5", "out6", "out7", \ - /* Non-stacked integer registers, minus r8, r9, r10, r15. */ \ - "r2", "r3", "r11", "r12", "r13", "r14", "r16", "r17", "r18", \ - "r19", "r20", "r21", "r22", "r23", "r24", "r25", "r26", "r27", \ - "r28", "r29", "r30", "r31", \ - /* Predicate registers. */ \ - "p6", "p7", "p8", "p9", "p10", "p11", "p12", "p13", "p14", "p15", \ - /* Non-rotating fp registers. */ \ - "f6", "f7", "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ - /* Branch registers. */ \ - "b6", "b7" - -int pipe(int *filedes) -{ - register long _r8 asm("r8"); - register long _r9 asm("r9"); - register long _r10 asm("r10"); - register long _r15 asm("r15") = __NR_pipe; - register long _out0 asm ("out0") = (long)filedes; - long _retval; - __asm __volatile (__IA64_BREAK - : "=r" (_r8), "=r" (_r10), "=r" (_r15), - "=r" (_out0), "=r" (_r9) - : "2" (_r15), "3" (_out0) - : "memory" ASM_CLOBBERS); - if (_r10 == -1) { - errno = _r8; - _retval = -1; - } else { - filedes[0] = _r8; - filedes[1] = _r9; - _retval = 0; - } - return _retval; -} diff --git a/klibc/klibc/arch/ia64/setjmp.S b/klibc/klibc/arch/ia64/setjmp.S deleted file mode 100644 index 7859ba4143..0000000000 --- a/klibc/klibc/arch/ia64/setjmp.S +++ /dev/null @@ -1,343 +0,0 @@ -/* - * IA-64 specific setjmp/longjmp routines - * - * Inspired by setjmp.s from the FreeBSD kernel. - */ - -#define J_UNAT 0 -#define J_NATS 0x8 -#define J_PFS 0x10 -#define J_BSP 0x18 -#define J_RNAT 0x20 -#define J_PREDS 0x28 -#define J_LC 0x30 -#define J_R4 0x38 -#define J_R5 0x40 -#define J_R6 0x48 -#define J_R7 0x50 -#define J_SP 0x58 -#define J_F2 0x60 -#define J_F3 0x70 -#define J_F4 0x80 -#define J_F5 0x90 -#define J_F16 0xa0 -#define J_F17 0xb0 -#define J_F18 0xc0 -#define J_F19 0xd0 -#define J_F20 0xe0 -#define J_F21 0xf0 -#define J_F22 0x100 -#define J_F23 0x110 -#define J_F24 0x120 -#define J_F25 0x130 -#define J_F26 0x140 -#define J_F27 0x150 -#define J_F28 0x160 -#define J_F29 0x170 -#define J_F30 0x180 -#define J_F31 0x190 -#define J_FPSR 0x1a0 -#define J_B0 0x1a8 -#define J_B1 0x1b0 -#define J_B2 0x1b8 -#define J_B3 0x1c0 -#define J_B4 0x1c8 -#define J_B5 0x1d0 -#define J_SIGMASK 0x1d8 -#define J_SIGSET 0x1e0 -#define J_GP 0x1f0 - -// int setjmp(struct jmp_buffer *) -// -// Setup a non-local goto. -// -// Description: -// -// SetJump stores the current register set in the area pointed to -// by "save". It returns zero. Subsequent calls to "LongJump" will -// restore the registers and return non-zero to the same location. -// -// On entry, r32 contains the pointer to the jmp_buffer -// - .align 32 - .global setjmp - .proc setjmp -setjmp: - // - // Make sure buffer is aligned at 16byte boundary - // - add r10 = -0x10,r0 ;; // mask the lower 4 bits - and r32 = r32, r10;; - add r32 = 0x10, r32;; // move to next 16 byte boundary - - add r10 = J_PREDS, r32 // skip Unats & pfs save area - add r11 = J_BSP, r32 - // - // save immediate context - // - mov r2 = ar.bsp // save backing store pointer - mov r3 = pr // save predicates - flushrs - ;; - // - // save user Unat register - // - mov r16 = ar.lc // save loop count register - mov r14 = ar.unat // save user Unat register - - st8 [r10] = r3, J_LC-J_PREDS - st8 [r11] = r2, J_R4-J_BSP - ;; - st8 [r10] = r16, J_R5-J_LC - st8 [r32] = r14, J_NATS // Note: Unat at the - // beginning of the save area - mov r15 = ar.pfs - ;; - // - // save preserved general registers & NaT's - // - st8.spill [r11] = r4, J_R6-J_R4 - ;; - st8.spill [r10] = r5, J_R7-J_R5 - ;; - st8.spill [r11] = r6, J_SP-J_R6 - ;; - st8.spill [r10] = r7, J_F3-J_R7 - ;; - st8.spill [r11] = sp, J_F2-J_SP - ;; - // - // save spilled Unat and pfs registers - // - mov r2 = ar.unat // save Unat register after spill - ;; - st8 [r32] = r2, J_PFS-J_NATS // save unat for spilled regs - ;; - st8 [r32] = r15 // save pfs - // - // save floating registers - // - stf.spill [r11] = f2, J_F4-J_F2 - stf.spill [r10] = f3, J_F5-J_F3 - ;; - stf.spill [r11] = f4, J_F16-J_F4 - stf.spill [r10] = f5, J_F17-J_F5 - ;; - stf.spill [r11] = f16, J_F18-J_F16 - stf.spill [r10] = f17, J_F19-J_F17 - ;; - stf.spill [r11] = f18, J_F20-J_F18 - stf.spill [r10] = f19, J_F21-J_F19 - ;; - stf.spill [r11] = f20, J_F22-J_F20 - stf.spill [r10] = f21, J_F23-J_F21 - ;; - stf.spill [r11] = f22, J_F24-J_F22 - stf.spill [r10] = f23, J_F25-J_F23 - ;; - stf.spill [r11] = f24, J_F26-J_F24 - stf.spill [r10] = f25, J_F27-J_F25 - ;; - stf.spill [r11] = f26, J_F28-J_F26 - stf.spill [r10] = f27, J_F29-J_F27 - ;; - stf.spill [r11] = f28, J_F30-J_F28 - stf.spill [r10] = f29, J_F31-J_F29 - ;; - stf.spill [r11] = f30, J_FPSR-J_F30 - stf.spill [r10] = f31, J_B0-J_F31 // size of f31 + fpsr - // - // save FPSR register & branch registers - // - mov r2 = ar.fpsr // save fpsr register - mov r3 = b0 - ;; - st8 [r11] = r2, J_B1-J_FPSR - st8 [r10] = r3, J_B2-J_B0 - mov r2 = b1 - mov r3 = b2 - ;; - st8 [r11] = r2, J_B3-J_B1 - st8 [r10] = r3, J_B4-J_B2 - mov r2 = b3 - mov r3 = b4 - ;; - st8 [r11] = r2, J_B5-J_B3 - st8 [r10] = r3 - mov r2 = b5 - ;; - st8 [r11] = r2 - ;; - // - // return - // - mov r8 = r0 // return 0 from setjmp - mov ar.unat = r14 // restore unat - br.ret.sptk b0 - .endp setjmp - -// -// void longjmp(struct jmp_buffer *, int val) -// -// Perform a non-local goto. -// -// Description: -// -// LongJump initializes the register set to the values saved by a -// previous 'SetJump' and jumps to the return location saved by that -// 'SetJump'. This has the effect of unwinding the stack and returning -// for a second time to the 'SetJump'. -// - - .align 32 - .global longjmp - .proc longjmp -longjmp: - // - // Make sure buffer is aligned at 16byte boundary - // - add r10 = -0x10,r0 ;; // mask the lower 4 bits - and r32 = r32, r10;; - add r32 = 0x10, r32;; // move to next 16 byte boundary - - // - // caching the return value as we do invala in the end - // - mov r8 = r33 // return value - - // - // get immediate context - // - mov r14 = ar.rsc // get user RSC conf - add r10 = J_PFS, r32 // get address of pfs - add r11 = J_NATS, r32 - ;; - ld8 r15 = [r10], J_BSP-J_PFS // get pfs - ld8 r2 = [r11], J_LC-J_NATS // get unat for spilled regs - ;; - mov ar.unat = r2 - ;; - ld8 r16 = [r10], J_PREDS-J_BSP // get backing store pointer - mov ar.rsc = r0 // put RSE in enforced lazy - mov ar.pfs = r15 - ;; - - // - // while returning from longjmp the BSPSTORE and BSP needs to be - // same and discard all the registers allocated after we did - // setjmp. Also, we need to generate the RNAT register since we - // did not flushed the RSE on setjmp. - // - mov r17 = ar.bspstore // get current BSPSTORE - ;; - cmp.ltu p6,p7 = r17, r16 // is it less than BSP of -(p6) br.spnt.few .flush_rse - mov r19 = ar.rnat // get current RNAT - ;; - loadrs // invalidate dirty regs - br.sptk.many .restore_rnat // restore RNAT - -.flush_rse: - flushrs - ;; - mov r19 = ar.rnat // get current RNAT - mov r17 = r16 // current BSPSTORE - ;; -.restore_rnat: - // - // check if RNAT is saved between saved BSP and curr BSPSTORE - // - mov r18 = 0x3f - ;; - dep r18 = r18,r16,3,6 // get RNAT address - ;; - cmp.ltu p8,p9 = r18, r17 // RNAT saved on RSE - ;; -(p8) ld8 r19 = [r18] // get RNAT from RSE - ;; - mov ar.bspstore = r16 // set new BSPSTORE - ;; - mov ar.rnat = r19 // restore RNAT - mov ar.rsc = r14 // restore RSC conf - - - ld8 r3 = [r11], J_R4-J_LC // get lc register - ld8 r2 = [r10], J_R5-J_PREDS // get predicates - ;; - mov pr = r2, -1 - mov ar.lc = r3 - // - // restore preserved general registers & NaT's - // - ld8.fill r4 = [r11], J_R6-J_R4 - ;; - ld8.fill r5 = [r10], J_R7-J_R5 - ld8.fill r6 = [r11], J_SP-J_R6 - ;; - ld8.fill r7 = [r10], J_F2-J_R7 - ld8.fill sp = [r11], J_F3-J_SP - ;; - // - // restore floating registers - // - ldf.fill f2 = [r10], J_F4-J_F2 - ldf.fill f3 = [r11], J_F5-J_F3 - ;; - ldf.fill f4 = [r10], J_F16-J_F4 - ldf.fill f5 = [r11], J_F17-J_F5 - ;; - ldf.fill f16 = [r10], J_F18-J_F16 - ldf.fill f17 = [r11], J_F19-J_F17 - ;; - ldf.fill f18 = [r10], J_F20-J_F18 - ldf.fill f19 = [r11], J_F21-J_F19 - ;; - ldf.fill f20 = [r10], J_F22-J_F20 - ldf.fill f21 = [r11], J_F23-J_F21 - ;; - ldf.fill f22 = [r10], J_F24-J_F22 - ldf.fill f23 = [r11], J_F25-J_F23 - ;; - ldf.fill f24 = [r10], J_F26-J_F24 - ldf.fill f25 = [r11], J_F27-J_F25 - ;; - ldf.fill f26 = [r10], J_F28-J_F26 - ldf.fill f27 = [r11], J_F29-J_F27 - ;; - ldf.fill f28 = [r10], J_F30-J_F28 - ldf.fill f29 = [r11], J_F31-J_F29 - ;; - ldf.fill f30 = [r10], J_FPSR-J_F30 - ldf.fill f31 = [r11], J_B0-J_F31 ;; - - // - // restore branch registers and fpsr - // - ld8 r16 = [r10], J_B1-J_FPSR // get fpsr - ld8 r17 = [r11], J_B2-J_B0 // get return pointer - ;; - mov ar.fpsr = r16 - mov b0 = r17 - ld8 r2 = [r10], J_B3-J_B1 - ld8 r3 = [r11], J_B4-J_B2 - ;; - mov b1 = r2 - mov b2 = r3 - ld8 r2 = [r10], J_B5-J_B3 - ld8 r3 = [r11] - ;; - mov b3 = r2 - mov b4 = r3 - ld8 r2 = [r10] - ld8 r21 = [r32] // get user unat - ;; - mov b5 = r2 - mov ar.unat = r21 - - // - // invalidate ALAT - // - invala ;; - - br.ret.sptk b0 - .endp longjmp diff --git a/klibc/klibc/arch/ia64/syscall.S b/klibc/klibc/arch/ia64/syscall.S deleted file mode 100644 index e3f264c0e4..0000000000 --- a/klibc/klibc/arch/ia64/syscall.S +++ /dev/null @@ -1,20 +0,0 @@ -# -# arch/ia64/syscall.S -# - -#include - - .text - .align 32 - .proc __syscall_error - .globl __syscall_error -__syscall_error: - addl r2 = @ltoffx(errno),gp - ;; - ld8.mov r3 = [r2],errno - ;; - st4 [r3] = r8 - mov r8 = -1 - br.ret.sptk.many b0 - .size __syscall_error, .-__syscall_error - .endp __syscall_error diff --git a/klibc/klibc/arch/ia64/sysstub.ph b/klibc/klibc/arch/ia64/sysstub.ph deleted file mode 100644 index 8e686c68a3..0000000000 --- a/klibc/klibc/arch/ia64/sysstub.ph +++ /dev/null @@ -1,29 +0,0 @@ -# -*- perl -*- -# -# arch/ia64/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.text\n"; - print OUT "\t.align 32\n"; - print OUT "\t.proc ${fname}\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - print OUT "\tmov\tr15 = __NR_${sname}\n"; - print OUT "\tbreak __BREAK_SYSCALL\n"; - print OUT "\tcmp.eq p6,p0 = -1,r10\n"; - print OUT "(p6)\tbr.few __syscall_error\n"; - print OUT "\tbr.ret.sptk.many b0\n"; - print OUT "\t.size\t${fname},.-${fname}\n"; - print OUT "\t.endp\t${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/ia64/vfork.S b/klibc/klibc/arch/ia64/vfork.S deleted file mode 100644 index f79bdc8234..0000000000 --- a/klibc/klibc/arch/ia64/vfork.S +++ /dev/null @@ -1,42 +0,0 @@ -/* - * ia64 specific vfork syscall - * - * Written By: Martin Hicks - * - */ - -/* This syscall is a special case of the clone syscall */ -#include -#include -#include - -/* These are redefined here because linux/sched.h isn't safe for - * inclusion in asm. - */ -#define CLONE_VM 0x00000100 /* set if VM shared between processes */ -#define CLONE_VFORK 0x00004000 /* set if parent wants the child to wake it up on exit */ - -/* pid_t vfork(void) */ -/* Implemented as clone(CLONE_VFORK | CLONE_VM | SIGCHLD, 0) */ - - .align 32 - .proc vfork - .global vfork -vfork: - alloc r2=ar.pfs,0,0,2,0 - mov r15=__NR_clone - mov out0=CLONE_VM|CLONE_VFORK|SIGCHLD - mov out1=0 - ;; - break 0x100000 // Do the syscall - ;; - addl r15=0,r1 - cmp.eq p7,p6 = -1,r10 - ;; - ld8 r14=[r15] - ;; -(p7) st4 [r14]=r8 - ;; -(p7) mov r8=-1 - br.ret.sptk.many b0 - .endp vfork diff --git a/klibc/klibc/arch/m32r/MCONFIG b/klibc/klibc/arch/m32r/MCONFIG deleted file mode 100644 index 2673090fce..0000000000 --- a/klibc/klibc/arch/m32r/MCONFIG +++ /dev/null @@ -1,18 +0,0 @@ -# -*- makefile -*- -# -# arch/m32r/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -BITSIZE = 32 - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# 224 MB - normal binaries start at 0 (?) -# (lib?)gcc on cris seems to insist on producing .init and .fini sections -SHAREDFLAGS = --section-start .init=0x0e000100 diff --git a/klibc/klibc/arch/m32r/Makefile.inc b/klibc/klibc/arch/m32r/Makefile.inc deleted file mode 100644 index 43cb44ef8f..0000000000 --- a/klibc/klibc/arch/m32r/Makefile.inc +++ /dev/null @@ -1,19 +0,0 @@ -# -*- makefile -*- -# -# arch/m32r/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - -archclean: diff --git a/klibc/klibc/arch/m32r/crt0.S b/klibc/klibc/arch/m32r/crt0.S deleted file mode 100644 index 1589a774a2..0000000000 --- a/klibc/klibc/arch/m32r/crt0.S +++ /dev/null @@ -1,25 +0,0 @@ -# -# arch/m32r/crt0.S -# -# Does arch-specific initialization and invokes __libc_init -# with the appropriate arguments. -# -# See __static_init.c or __shared_init.c for the expected -# arguments. -# - - .text - .balign 4 - .type _start,@function - .globl _start -_start: - /* Save the address of the ELF argument array */ - mv r0, sp - - /* atexit() function (assume null) */ - xor r1, r1 - - bl __libc_init - - .size _start, .-_start - diff --git a/klibc/klibc/arch/m32r/setjmp.S b/klibc/klibc/arch/m32r/setjmp.S deleted file mode 100644 index 14ef7e3577..0000000000 --- a/klibc/klibc/arch/m32r/setjmp.S +++ /dev/null @@ -1,47 +0,0 @@ -# -# arch/m32r/setjmp.S -# -# setjmp/longjmp for the M32R architecture -# - -# -# The jmp_buf is assumed to contain the following, in order: -# r8-r15 -# -# Note that r14 is the return address register and -# r15 is the stack pointer. -# - - .text - .balign 4 - .globl setjmp - .type setjmp, @function -setjmp: - st r8, @r0 - st r9, @+r0 - st r10, @+r0 - st r11, @+r0 - st r12, @+r0 - st r13, @+r0 - st r14, @+r0 - st r15, @+r0 - xor r0, r0 - jmp r14 - .size setjmp,.-setjmp - - .text - .balign 4 - .globl longjmp - .type longjmp, @function -longjmp: - ld r8, @r0+ - ld r9, @r0+ - ld r10, @r0+ - ld r11, @r0+ - ld r12, @r0+ - ld r13, @r0+ - ld r14, @r0+ - ld r15, @r0 - mv r0, r1 - jmp r14 - .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/m32r/syscall.S b/klibc/klibc/arch/m32r/syscall.S deleted file mode 100644 index a20a33667f..0000000000 --- a/klibc/klibc/arch/m32r/syscall.S +++ /dev/null @@ -1,29 +0,0 @@ -/* - * arch/m32r/syscall.S - * - * r7 contains the syscall number (set by stub); - * r0..r3 contains arguments 0-3 per standard calling convention; - * r4..r5 contains arguments 4-5, but we have to get those from - * the stack. - */ - - .section ".text","ax" - .balign 4 - .globl __syscall_common - .type __syscall_common,@function -__syscall_common: - ld r4,@sp - ld r5,@(4,sp) - trap #2 - cmpi r0, #-4096 - bnc 1f - jmp r14 -1: - seth r2,#high(errno) - or3 r2,r2,#low(errno) - neg r1,r0 - st r1,@r7 - ldi r0,#-1 - jmp r14 - - .size __syscall_common,.-__syscall_common diff --git a/klibc/klibc/arch/m32r/sysstub.ph b/klibc/klibc/arch/m32r/sysstub.ph deleted file mode 100644 index 98dfb9d0a8..0000000000 --- a/klibc/klibc/arch/m32r/sysstub.ph +++ /dev/null @@ -1,25 +0,0 @@ -# -*- perl -*- -# -# arch/m32r/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.text\n"; - print OUT "\t.type\t${fname},\@function\n"; - print OUT "\t.globl\t${fname}\n"; - print OUT "\t.balign\t4\n"; - print OUT "${fname}:\n"; - print OUT "\tldi\tr7,#__NR_${sname}\n"; - print OUT "\tbra\t__syscall_common\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/m68k/MCONFIG b/klibc/klibc/arch/m68k/MCONFIG deleted file mode 100644 index 2ba69b3178..0000000000 --- a/klibc/klibc/arch/m68k/MCONFIG +++ /dev/null @@ -1,11 +0,0 @@ -# -*- makefile -*- -# -# arch/m68k/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -fomit-frame-pointer -BITSIZE = 32 diff --git a/klibc/klibc/arch/m68k/Makefile.inc b/klibc/klibc/arch/m68k/Makefile.inc deleted file mode 100644 index 9abec14db1..0000000000 --- a/klibc/klibc/arch/m68k/Makefile.inc +++ /dev/null @@ -1,10 +0,0 @@ -# -*- makefile -*- -# -# arch/m68k/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -archclean: diff --git a/klibc/klibc/arch/mips/MCONFIG b/klibc/klibc/arch/mips/MCONFIG deleted file mode 100644 index 0a98918987..0000000000 --- a/klibc/klibc/arch/mips/MCONFIG +++ /dev/null @@ -1,15 +0,0 @@ -# -*- makefile -*- -# -# arch/mips/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHREQFLAGS = -fno-pic -mno-abicalls -G 0 -OPTFLAGS = -Os -BITSIZE = 32 - -# Extra linkflags when building the shared version of the library -SHAREDFLAGS = -T arch/$(ARCH)/klibc.ld diff --git a/klibc/klibc/arch/mips/Makefile.inc b/klibc/klibc/arch/mips/Makefile.inc deleted file mode 100644 index e257023f34..0000000000 --- a/klibc/klibc/arch/mips/Makefile.inc +++ /dev/null @@ -1,25 +0,0 @@ -# -*- makefile -*- -# -# arch/mips/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/pipe.o \ - arch/$(ARCH)/vfork.o \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - - -archclean: diff --git a/klibc/klibc/arch/mips/crt0.S b/klibc/klibc/arch/mips/crt0.S deleted file mode 100644 index 42d9dd5e38..0000000000 --- a/klibc/klibc/arch/mips/crt0.S +++ /dev/null @@ -1,25 +0,0 @@ -# -# arch/mips/crt0.S -# -# Does arch-specific initialization and invokes __libc_init -# with the appropriate arguments. -# -# See __static_init.c or __shared_init.c for the expected -# arguments. -# - -#include - -NESTED(__start, 32, sp) - subu sp, 32 - sw zero, 16(sp) - - lui gp, %hi(_gp) # Initialize gp - addiu gp, gp, _gp - - addiu a0, sp, 32 # Pointer to ELF entry structure - move a1, v0 # Kernel-provided atexit() pointer - - jal __libc_init - - END(__start) diff --git a/klibc/klibc/arch/mips/klibc.ld b/klibc/klibc/arch/mips/klibc.ld deleted file mode 100644 index d75c9de70c..0000000000 --- a/klibc/klibc/arch/mips/klibc.ld +++ /dev/null @@ -1,217 +0,0 @@ -/* Linker script for klibc.so, needed because of the the damned - GNU ld script headers problem */ - -OUTPUT_FORMAT("elf32-tradbigmips", "elf32-tradbigmips", - "elf32-tradlittlemips") -OUTPUT_ARCH(mips) -ENTRY(__start) -SECTIONS -{ - /* Read-only sections, merged into text segment: */ - /* This address needs to be reachable using normal inter-module - calls, and work on the memory models for this architecture */ - /* 2 MB -- the normal starting point for text is 4 MB */ - . = 0x00200400; - .interp : { *(.interp) } - .reginfo : { *(.reginfo) } - .dynamic : { *(.dynamic) } - .hash : { *(.hash) } - .dynsym : { *(.dynsym) } - .dynstr : { *(.dynstr) } - .gnu.version : { *(.gnu.version) } - .gnu.version_d : { *(.gnu.version_d) } - .gnu.version_r : { *(.gnu.version_r) } - .rel.dyn : - { - *(.rel.init) - *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) - *(.rel.fini) - *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) - *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) - *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) - *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) - *(.rel.ctors) - *(.rel.dtors) - *(.rel.got) - *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*) - *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*) - *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*) - *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*) - *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) - } - .rela.dyn : - { - *(.rela.init) - *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) - *(.rela.fini) - *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) - *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) - *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) - *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) - *(.rela.ctors) - *(.rela.dtors) - *(.rela.got) - *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*) - *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*) - *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*) - *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*) - *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) - } - .rel.plt : { *(.rel.plt) } - .rela.plt : { *(.rela.plt) } - .init : - { - KEEP (*(.init)) - } =0 - .plt : { *(.plt) } - .text : - { - _ftext = . ; - *(.text .stub .text.* .gnu.linkonce.t.*) - /* .gnu.warning sections are handled specially by elf32.em. */ - *(.gnu.warning) - *(.mips16.fn.*) *(.mips16.call.*) - } =0 - .fini : - { - KEEP (*(.fini)) - } =0 - PROVIDE (__etext = .); - PROVIDE (_etext = .); - PROVIDE (etext = .); - .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } - .rodata1 : { *(.rodata1) } - .sdata2 : { *(.sdata2 .sdata2.* .gnu.linkonce.s2.*) } - .sbss2 : { *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*) } - .eh_frame_hdr : { *(.eh_frame_hdr) } - /* Adjust the address for the data segment. We want to adjust up to - the same address within the page on the next page up. */ - . = ALIGN(8192); - /* Ensure the __preinit_array_start label is properly aligned. We - could instead move the label definition inside the section, but - the linker would then create the section even if it turns out to - be empty, which isn't pretty. */ - . = ALIGN(32 / 8); - PROVIDE (__preinit_array_start = .); - .preinit_array : { *(.preinit_array) } - PROVIDE (__preinit_array_end = .); - PROVIDE (__init_array_start = .); - .init_array : { *(.init_array) } - PROVIDE (__init_array_end = .); - PROVIDE (__fini_array_start = .); - .fini_array : { *(.fini_array) } - PROVIDE (__fini_array_end = .); - .data : - { - _fdata = . ; - *(.data .data.* .gnu.linkonce.d.*) - SORT(CONSTRUCTORS) - } - .data1 : { *(.data1) } - .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } - .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } - .eh_frame : { KEEP (*(.eh_frame)) } - .gcc_except_table : { *(.gcc_except_table) } - .ctors : - { - /* gcc uses crtbegin.o to find the start of - the constructors, so we make sure it is - first. Because this is a wildcard, it - doesn't matter if the user does not - actually link against crtbegin.o; the - linker won't look for a file to match a - wildcard. The wildcard also means that it - doesn't matter which directory crtbegin.o - is in. */ - KEEP (*crtbegin*.o(.ctors)) - /* We don't want to include the .ctor section from - from the crtend.o file until after the sorted ctors. - The .ctor section from the crtend file contains the - end of ctors marker and it must be last */ - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors)) - KEEP (*(SORT(.ctors.*))) - KEEP (*(.ctors)) - } - .dtors : - { - KEEP (*crtbegin*.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - } - .jcr : { KEEP (*(.jcr)) } - _gp = ALIGN(16) + 0x7ff0; - .got : { *(.got.plt) *(.got) } - /* We want the small data sections together, so single-instruction offsets - can access them all, and initialized data all before uninitialized, so - we can shorten the on-disk segment size. */ - .sdata : - { - *(.sdata .sdata.* .gnu.linkonce.s.*) - } - .lit8 : { *(.lit8) } - .lit4 : { *(.lit4) } - _edata = .; - PROVIDE (edata = .); - __bss_start = .; - _fbss = .; - .sbss : - { - PROVIDE (__sbss_start = .); - PROVIDE (___sbss_start = .); - *(.dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - PROVIDE (__sbss_end = .); - PROVIDE (___sbss_end = .); - } - .bss : - { - *(.dynbss) - *(.bss .bss.* .gnu.linkonce.b.*) - *(COMMON) - /* Align here to ensure that the .bss section occupies space up to - _end. Align after .bss to ensure correct alignment even if the - .bss section disappears because there are no input sections. */ - . = ALIGN(32 / 8); - } - . = ALIGN(32 / 8); - _end = .; - PROVIDE (end = .); - /* Stabs debugging sections. */ - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - /* DWARF debug sections. - Symbols in the DWARF debugging sections are relative to the beginning - of the section so we begin them at 0. */ - /* DWARF 1 */ - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - /* GNU DWARF 1 extensions */ - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - /* DWARF 1.1 and DWARF 2 */ - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - /* DWARF 2 */ - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - /* SGI/MIPS DWARF 2 extensions */ - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) } - .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) } - /DISCARD/ : { *(.note.GNU-stack) } -} diff --git a/klibc/klibc/arch/mips/pipe.S b/klibc/klibc/arch/mips/pipe.S deleted file mode 100644 index d79f614025..0000000000 --- a/klibc/klibc/arch/mips/pipe.S +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include - -LEAF(pipe) - li v0, __NR_pipe - syscall - bnez a3, 1f - sw v0, (a0) - sw v1, (a1) - li v0, 0 - b 2f -1: sw v0, errno - li v0, -1 -2: jr ra - END(pipe) diff --git a/klibc/klibc/arch/mips/setjmp.S b/klibc/klibc/arch/mips/setjmp.S deleted file mode 100644 index 4d293757ec..0000000000 --- a/klibc/klibc/arch/mips/setjmp.S +++ /dev/null @@ -1,82 +0,0 @@ -# -# arch/mips/setjmp.S -# -# setjmp/longjmp for the MIPS architecture -# -# The jmp_buf is assumed to contain the following, in order: -# s0..s7 -# gp -# sp -# s8 -# ra -# f20..f31 -# fcr31 -# - -#include - -LEAF(setjmp) - sw s0, 0(a0) - sw s1, 4(a0) - sw s2, 8(a0) - sw s3, 12(a0) - sw s4, 16(a0) - sw s5, 20(a0) - sw s6, 24(a0) - sw s7, 28(a0) - sw gp, 32(a0) - sw sp, 36(a0) - sw s8, 40(a0) - sw ra, 44(a0) - cfc1 t0,$31 - swc1 $f20,48(a0) - swc1 $f21,52(a0) - swc1 $f22,56(a0) - swc1 $f23,60(a0) - swc1 $f24,64(a0) - swc1 $f25,68(a0) - swc1 $f26,72(a0) - swc1 $f27,76(a0) - swc1 $f28,80(a0) - swc1 $f29,84(a0) - swc1 $f30,88(a0) - swc1 $f31,92(a0) - sw t0,96(a0) - move v0,zero - jr ra - - END(setjmp) - -LEAF(longjmp) - lw s0, 0(a0) - lw s1, 4(a0) - lw s2, 8(a0) - lw s3, 12(a0) - lw s4, 16(a0) - lw s5, 20(a0) - lw s6, 24(a0) - lw s7, 28(a0) - lw gp, 32(a0) - lw sp, 36(a0) - lw s8, 40(a0) - lw ra, 44(a0) - lw t0, 96(a0) - lwc1 $f20,48(a0) - lwc1 $f21,52(a0) - lwc1 $f22,56(a0) - lwc1 $f23,60(a0) - lwc1 $f24,64(a0) - lwc1 $f25,68(a0) - lwc1 $f26,72(a0) - lwc1 $f27,76(a0) - lwc1 $f28,80(a0) - lwc1 $f29,84(a0) - lwc1 $f30,88(a0) - lwc1 $f31,92(a0) - ctc1 t0,$31 - move v0,a1 - jr ra - - END(longjmp) - - \ No newline at end of file diff --git a/klibc/klibc/arch/mips/syscall.S b/klibc/klibc/arch/mips/syscall.S deleted file mode 100644 index d5c1fe1c7d..0000000000 --- a/klibc/klibc/arch/mips/syscall.S +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - - .set noreorder - -LEAF(__syscall_common) - syscall - beqz a3, 1f - # sw is actually two instructions; the first one goes - # in the branch delay slot - sw v0, errno - li v0, -1 -1: jr ra - END(__syscall_common) diff --git a/klibc/klibc/arch/mips/sysstub.ph b/klibc/klibc/arch/mips/sysstub.ph deleted file mode 100644 index a71d5d02ef..0000000000 --- a/klibc/klibc/arch/mips/sysstub.ph +++ /dev/null @@ -1,30 +0,0 @@ -# -*- perl -*- -# -# arch/mips/sysstub.ph -# -# Script to generate system call stubs -# - -# On MIPS, most system calls follow the standard convention, with the -# system call number in r0 (v0), return an error value in r19 (a3) as -# well as the return value in r0 (v0). - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - $stype = $stype || 'common'; - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "#include \n"; - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.set noreorder\n"; - print OUT "\n"; - print OUT "LEAF(${fname})\n"; - print OUT "\tj\t__syscall_${stype}\n"; - print OUT "\t li\tv0, __NR_${sname}\n"; - print OUT "\tEND(${fname})\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/mips/vfork.S b/klibc/klibc/arch/mips/vfork.S deleted file mode 100644 index 9829867fab..0000000000 --- a/klibc/klibc/arch/mips/vfork.S +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include - -#define CLONE_VM 0x00000100 -#define CLONE_VFORK 0x00004000 -#define SIGCHLD 18 - - .set noreorder - -LEAF(vfork) - li a0, CLONE_VFORK | CLONE_VM | SIGCHLD - li a1, 0 - j __syscall_common - li v0, __NR_clone - END(vfork) diff --git a/klibc/klibc/arch/mips64/MCONFIG b/klibc/klibc/arch/mips64/MCONFIG deleted file mode 100644 index 66405e4373..0000000000 --- a/klibc/klibc/arch/mips64/MCONFIG +++ /dev/null @@ -1,11 +0,0 @@ -# -*- makefile -*- -# -# arch/mips64/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -BITSIZE = 64 diff --git a/klibc/klibc/arch/mips64/Makefile.inc b/klibc/klibc/arch/mips64/Makefile.inc deleted file mode 100644 index 4a9529adca..0000000000 --- a/klibc/klibc/arch/mips64/Makefile.inc +++ /dev/null @@ -1,10 +0,0 @@ -# -*- makefile -*- -# -# arch/mips64/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -archclean: diff --git a/klibc/klibc/arch/parisc/MCONFIG b/klibc/klibc/arch/parisc/MCONFIG deleted file mode 100644 index 93a31707c6..0000000000 --- a/klibc/klibc/arch/parisc/MCONFIG +++ /dev/null @@ -1,11 +0,0 @@ -# -*- makefile -*- -# -# arch/parisc/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -fomit-frame-pointer -BITSIZE = 32 diff --git a/klibc/klibc/arch/parisc/Makefile.inc b/klibc/klibc/arch/parisc/Makefile.inc deleted file mode 100644 index 980a543ed2..0000000000 --- a/klibc/klibc/arch/parisc/Makefile.inc +++ /dev/null @@ -1,19 +0,0 @@ -# -*- makefile -*- -# -# arch/parisc/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o - -ARCHOOBJS = $(patsubst %o,%.lo,%(ARCHOBJS)) - -archclean: - -arch/$(ARCH)/syscall.o: arch/$(ARCH)/syscall.c - $(CC) $(CFLAGS) -ffixed-r20 -c -o $@ $< diff --git a/klibc/klibc/arch/parisc/crt0.S b/klibc/klibc/arch/parisc/crt0.S deleted file mode 100644 index fb0bd373ee..0000000000 --- a/klibc/klibc/arch/parisc/crt0.S +++ /dev/null @@ -1,34 +0,0 @@ - .align 4 - - .import $global$, data - .import __libc_init, code - - .global _start - .export _start, ENTRY - .type _start,@function - - .proc - .callinfo - -_start: -/* extend the stack by 64-bytes */ - ldo 64(%sp), %sp - -/* %r25 = argc - * %r24 = argv - * envp = argv + (argc + 1) - * elfdata = (argv - 4) - */ - ldo -4(%r24), %r26 - -/* load global data */ - ldil L%$global$, %dp - ldo R%$global$(%dp), %dp - -/* branch to __libc_init */ - bl __libc_init,%r2 - nop -/* break miserably if we ever return */ - iitlbp %r0,(%r0) /* illegal instruction */ - nop - .procend diff --git a/klibc/klibc/arch/parisc/setjmp.S b/klibc/klibc/arch/parisc/setjmp.S deleted file mode 100644 index aebe03a5ed..0000000000 --- a/klibc/klibc/arch/parisc/setjmp.S +++ /dev/null @@ -1,88 +0,0 @@ -/* - * parisc specific setjmp/longjmp routines - * - */ - - .text - .align 4 - .global setjmp - .export setjmp, code - .proc - .callinfo -setjmp: - stw %r3,0(%r26) - stw %r4,8(%r26) - stw %r5,12(%r26) - stw %r6,16(%r26) - stw %r7,20(%r26) - stw %r8,24(%r26) - stw %r9,28(%r26) - stw %r10,32(%r26) - stw %r11,36(%r26) - stw %r12,40(%r26) - stw %r13,44(%r26) - stw %r14,48(%r26) - stw %r15,52(%r26) - stw %r16,56(%r26) - stw %r17,60(%r26) - stw %r18,64(%r26) - stw %r19,68(%r26) - stw %r27,72(%r26) - stw %r30,76(%r26) - stw %rp,80(%r26) - ldo 88(%r26),%r19 - fstd,ma %fr12,8(%r19) - fstd,ma %fr13,8(%r19) - fstd,ma %fr14,8(%r19) - fstd,ma %fr15,8(%r19) - fstd,ma %fr16,8(%r19) - fstd,ma %fr17,8(%r19) - fstd,ma %fr18,8(%r19) - fstd,ma %fr19,8(%r19) - fstd,ma %fr20,8(%r19) - fstd %fr21,0(%r19) - bv %r0(%rp) - copy %r0,%r28 - .procend - - .text - .align 4 - .global longjmp - .export longjmp, code - .proc - .callinfo -longjmp: - ldw 0(%r26),%r3 - ldw 8(%r26),%r4 - ldw 12(%r26),%r5 - ldw 16(%r26),%r6 - ldw 20(%r26),%r7 - ldw 24(%r26),%r8 - ldw 28(%r26),%r9 - ldw 32(%r26),%r10 - ldw 36(%r26),%r11 - ldw 40(%r26),%r12 - ldw 44(%r26),%r13 - ldw 48(%r26),%r14 - ldw 52(%r26),%r15 - ldw 56(%r26),%r16 - ldw 60(%r26),%r17 - ldw 64(%r26),%r18 - ldw 68(%r26),%r19 - ldw 72(%r26),%r27 - ldw 76(%r26),%r30 - ldw 80(%r26),%rp - ldo 88(%r26),%r20 - fldd,ma 8(%r20),%fr12 - fldd,ma 8(%r20),%fr13 - fldd,ma 8(%r20),%fr14 - fldd,ma 8(%r20),%fr15 - fldd,ma 8(%r20),%fr16 - fldd,ma 8(%r20),%fr17 - fldd,ma 8(%r20),%fr18 - fldd,ma 8(%r20),%fr19 - fldd,ma 8(%r20),%fr20 - fldd 0(%r20),%fr21 - bv %r0(%rp) - copy %r25,%r28 - .procend diff --git a/klibc/klibc/arch/parisc/syscall.c b/klibc/klibc/arch/parisc/syscall.c deleted file mode 100644 index 99ef5fe103..0000000000 --- a/klibc/klibc/arch/parisc/syscall.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * arch/parisc/syscall.c - * - * This function is called from a stub with %r20 already set up. - * Compile this function with -ffixed-r20 so that it doesn't clobber - * this register by mistake. - */ - -#include -#include - -long __syscall_common(long a0, long a1, long a2, long a3, long a4, long a5) -{ - register unsigned long rv asm ("r28"); - - asm volatile("\tble 0x100(%%sr2, %%r0)\n" - : "=r" (rv) - : "r" (a0), "r" (a1), "r" (a2), "r" (a3), "r" (a4), "r" (a5) - : "%r1", "%r2", "%r29", "%r31"); - - if ( __unlikely(rv >= -4095UL) ) { - errno = -rv; - return -1L; - } else { - return (long)rv; - } -} - - diff --git a/klibc/klibc/arch/parisc/sysstub.ph b/klibc/klibc/arch/parisc/sysstub.ph deleted file mode 100644 index e2196acaf3..0000000000 --- a/klibc/klibc/arch/parisc/sysstub.ph +++ /dev/null @@ -1,28 +0,0 @@ -# -*- perl -*- -# -# arch/parisc/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.text\n"; - print OUT "\t.align 4\n"; - print OUT "\t.import __syscall_common, code\n"; - print OUT "\t.global ${fname}\n"; - print OUT "\t.export ${fname}, code\n"; - print OUT "\t.proc\n"; - print OUT "\.callinfo\n"; - print OUT "${fname}:\n"; - print OUT "\tb\t__syscall_common\n"; - print OUT "\t ldo\t__NR_${sname}(%r0),%r20\n"; - print OUT "\t.procend\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/ppc/MCONFIG b/klibc/klibc/arch/ppc/MCONFIG deleted file mode 100644 index 82c7107013..0000000000 --- a/klibc/klibc/arch/ppc/MCONFIG +++ /dev/null @@ -1,18 +0,0 @@ -# -*- makefile -*- -# -# arch/ppc/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -BITSIZE = 32 - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# 256-16 MB - normal binaries start at 256 MB, and jumps are limited -# to +/- 16 MB -SHAREDFLAGS = -Ttext 0x0f000200 diff --git a/klibc/klibc/arch/ppc/Makefile.inc b/klibc/klibc/arch/ppc/Makefile.inc deleted file mode 100644 index c6bb975f0f..0000000000 --- a/klibc/klibc/arch/ppc/Makefile.inc +++ /dev/null @@ -1,22 +0,0 @@ -# -*- makefile -*- -# -# arch/ppc/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - -archclean: diff --git a/klibc/klibc/arch/ppc/crt0.S b/klibc/klibc/arch/ppc/crt0.S deleted file mode 100644 index 282f8411e4..0000000000 --- a/klibc/klibc/arch/ppc/crt0.S +++ /dev/null @@ -1,20 +0,0 @@ -# -# arch/ppc/crt0.S -# - - .text - .align 4 - .type _start,@function - .globl _start -_start: - stwu 1,-16(1) - addi 3,1,16 - /* - * the SVR4abippc.pdf specifies r7 as a pointer to - * a termination function pointer. - * It is unused on Linux. - */ - mr 4,7 - bl __libc_init - - .size _start,.-_start diff --git a/klibc/klibc/arch/ppc/setjmp.S b/klibc/klibc/arch/ppc/setjmp.S deleted file mode 100644 index 3012de3ea6..0000000000 --- a/klibc/klibc/arch/ppc/setjmp.S +++ /dev/null @@ -1,35 +0,0 @@ -# -# arch/ppc/setjmp.S -# -# Basic setjmp/longjmp implementation -# This file was derived from the equivalent file in NetBSD -# - - .text - .align 4 - .type setjmp,@function - .globl setjmp -setjmp: - mflr %r11 /* save return address */ - mfcr %r12 /* save condition register */ - mr %r10,%r1 /* save stack pointer */ - mr %r9,%r2 /* save GPR2 (not needed) */ - stmw %r9,0(%r3) /* save r9..r31 */ - li %r3,0 /* indicate success */ - blr /* return */ - - .size setjmp,.-setjmp - - .type longjmp,@function - .globl longjmp -longjmp: - lmw %r9,0(%r3) /* save r9..r31 */ - mtlr %r11 /* restore LR */ - mtcr %r12 /* restore CR */ - mr %r2,%r9 /* restore GPR2 (not needed) */ - mr %r1,%r10 /* restore stack */ - mr %r3,%r4 /* get return value */ - blr /* return */ - - .size longjmp,.-longjmp - diff --git a/klibc/klibc/arch/ppc/syscall.S b/klibc/klibc/arch/ppc/syscall.S deleted file mode 100644 index 0a7c37c903..0000000000 --- a/klibc/klibc/arch/ppc/syscall.S +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/ppc/syscall.S - * - * Common error-handling path for system calls. - */ - - .text - .align 2 - .globl __syscall_error - .type __syscall_error,@function -__syscall_error: - lis 9,errno@ha - stw 3,errno@l(9) - li 3,-1 - blr - .size __syscall_error,.-__syscall_error diff --git a/klibc/klibc/arch/ppc/sysstub.ph b/klibc/klibc/arch/ppc/sysstub.ph deleted file mode 100644 index 3b3916c726..0000000000 --- a/klibc/klibc/arch/ppc/sysstub.ph +++ /dev/null @@ -1,25 +0,0 @@ -# -*- perl -*- -# -# arch/ppc/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.type ${fname},\@function\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - print OUT "\tli 0,__NR_${sname}\n"; - print OUT "\tsc\n"; - print OUT "\tbnslr\n"; - print OUT "\tb __syscall_error\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/ppc64/MCONFIG b/klibc/klibc/arch/ppc64/MCONFIG deleted file mode 100644 index 9aba2ddbb6..0000000000 --- a/klibc/klibc/arch/ppc64/MCONFIG +++ /dev/null @@ -1,20 +0,0 @@ -# -*- makefile -*- -# -# arch/ppc64/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHREQFLAGS = -m64 -mcall-aixdesc -OPTFLAGS = -Os -BITSIZE = 64 -LDFLAGS = -m elf64ppc - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# 256-16 MB - normal binaries start at 256 MB, and jumps are limited -# to +/- 16 MB -SHAREDFLAGS = -Ttext 0x0f000200 diff --git a/klibc/klibc/arch/ppc64/Makefile.inc b/klibc/klibc/arch/ppc64/Makefile.inc deleted file mode 100644 index d1e128fdce..0000000000 --- a/klibc/klibc/arch/ppc64/Makefile.inc +++ /dev/null @@ -1,25 +0,0 @@ -# -*- makefile -*- -# -# arch/ppc64/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - -INTERP_O = interp1.o - -interp.o: interp1.o klibc.got - $(LD) $(LDFLAGS) -r -o $@ interp1.o klibc.got - -klibc.got: $(SOHASH) - $(OBJCOPY) -j .got $< $@ - -archclean: - rm -f klibc.got diff --git a/klibc/klibc/arch/ppc64/crt0.S b/klibc/klibc/arch/ppc64/crt0.S deleted file mode 100644 index 872d2a0791..0000000000 --- a/klibc/klibc/arch/ppc64/crt0.S +++ /dev/null @@ -1,32 +0,0 @@ -# -# arch/ppc64/crt0.S -# -# void _start(void) -# { -# /* Divine up argc, argv, and envp */ -# environ = envp; -# exit(main(argc, argv, envp)); -# } -# - - .section ".toc","aw" -.LC0: .tc environ[TC],environ - - .section ".opd","aw" - .align 3 - .globl _start -_start: - .quad ._start - .quad .TOC.@tocbase, 0 - - .text - .globl ._start - .type ._start,@function -._start: - stdu %r1,-32(%r1) - addi %r3,%r1,32 - mr %r4,%r7 /* fini */ - b .__libc_init - nop - - .size _start,.-_start diff --git a/klibc/klibc/arch/ppc64/setjmp.S b/klibc/klibc/arch/ppc64/setjmp.S deleted file mode 100644 index 30db419140..0000000000 --- a/klibc/klibc/arch/ppc64/setjmp.S +++ /dev/null @@ -1,85 +0,0 @@ -# -# arch/ppc64/setjmp.S -# -# Basic setjmp/longjmp implementation -# - - .text - .align 4 - - .section ".opd","aw" -setjmp: - .quad .setjmp,.TOC.@tocbase,0 - .previous - .size setjmp,24 - .type .setjmp,@function - .globl setjmp - .globl .setjmp -.setjmp: - mflr %r11 /* save return address */ - mfcr %r12 /* save condition register */ - std %r2,0(%r3) /* save TOC pointer (not needed) */ - stdu %r1,8(%r3) /* save stack pointer */ - stdu %r11,8(%r3) - stdu %r12,8(%r3) - stdu %r13,8(%r3) /* save caller saved regs */ - stdu %r14,8(%r3) - stdu %r15,8(%r3) - stdu %r16,8(%r3) - stdu %r17,8(%r3) - stdu %r18,8(%r3) - stdu %r19,8(%r3) - stdu %r20,8(%r3) - stdu %r21,8(%r3) - stdu %r22,8(%r3) - stdu %r23,8(%r3) - stdu %r24,8(%r3) - stdu %r25,8(%r3) - stdu %r26,8(%r3) - stdu %r27,8(%r3) - stdu %r28,8(%r3) - stdu %r29,8(%r3) - stdu %r30,8(%r3) - std %r31,8(%r3) - li %r3,0 /* indicate success */ - blr /* return */ - - .size .setjmp,.-.setjmp - .section ".opd","aw" -longjmp: - .quad .longjmp,.TOC.@tocbase,0 - .previous - .size longjmp,24 - .type .longjmp,@function - .globl longjmp - .globl .longjmp -.longjmp: - ld %r2,0(%r3) /* restore TOC pointer (not needed) */ - ldu %r1,8(%r3) /* restore stack */ - ldu %r11,8(%r3) - ldu %r12,8(%r3) - ldu %r13,8(%r3) /* restore caller saved regs */ - ldu %r14,8(%r3) - ldu %r15,8(%r3) - ldu %r16,8(%r3) - ldu %r17,8(%r3) - ldu %r18,8(%r3) - ldu %r19,8(%r3) - ldu %r20,8(%r3) - ldu %r21,8(%r3) - ldu %r22,8(%r3) - ldu %r23,8(%r3) - ldu %r24,8(%r3) - ldu %r25,8(%r3) - ldu %r26,8(%r3) - ldu %r27,8(%r3) - ldu %r28,8(%r3) - ldu %r29,8(%r3) - ldu %r30,8(%r3) - ld %r31,8(%r3) - mtlr %r11 /* restore LR */ - mtcr %r12 /* restore CR */ - mr %r3,%r4 /* get return value */ - blr /* return */ - - .size .longjmp,.-.longjmp diff --git a/klibc/klibc/arch/ppc64/syscall.c b/klibc/klibc/arch/ppc64/syscall.c deleted file mode 100644 index a5895fe88e..0000000000 --- a/klibc/klibc/arch/ppc64/syscall.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * arch/ppc64/syscall.c - * - * Common error-handling path for system calls. - * The return value from __syscall_error becomes the - * return value from the system call. - */ -#include - -long int __syscall_error(long int err) -{ - errno = err; - return -1; -} diff --git a/klibc/klibc/arch/ppc64/sysstub.ph b/klibc/klibc/arch/ppc64/sysstub.ph deleted file mode 100644 index 9ee93701f6..0000000000 --- a/klibc/klibc/arch/ppc64/sysstub.ph +++ /dev/null @@ -1,31 +0,0 @@ -# -*- perl -*- -# -# arch/ppc64/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "\t.section \".opd\",\"aw\"\n"; - print OUT "\t.align 3\n"; - print OUT "${fname}:\n"; - print OUT "\t.quad .${fname},.TOC.\@tocbase,0\n"; - print OUT "\t.text\n"; - print OUT "\t.type .${fname},\@function\n"; - print OUT "\t.globl .${fname}\n"; - print OUT ".${fname}:\n"; - print OUT "\tli 0,__NR_${sname}\n"; - print OUT "\tsc\n"; - print OUT "\tbnslr\n"; - print OUT "\tb .__syscall_error\n"; - print OUT "\t.size .${fname},.-.${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/s390/MCONFIG b/klibc/klibc/arch/s390/MCONFIG deleted file mode 100644 index 640b395b54..0000000000 --- a/klibc/klibc/arch/s390/MCONFIG +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- -# -# arch/s390/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -BITSIZE = 32 - -SHAREDFLAGS = -Ttext 0x40000200 diff --git a/klibc/klibc/arch/s390/Makefile.inc b/klibc/klibc/arch/s390/Makefile.inc deleted file mode 100644 index 49b64ddbc6..0000000000 --- a/klibc/klibc/arch/s390/Makefile.inc +++ /dev/null @@ -1,23 +0,0 @@ -# -*- makefile -*- -# -# arch/s390/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/mmap.o \ - arch/$(ARCH)/syscall.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - - -archclean: diff --git a/klibc/klibc/arch/s390/crt0.S b/klibc/klibc/arch/s390/crt0.S deleted file mode 100644 index 49c3e7ebc7..0000000000 --- a/klibc/klibc/arch/s390/crt0.S +++ /dev/null @@ -1,25 +0,0 @@ -# -# arch/s390/crt0.S -# -# Does arch-specific initialization and invokes __libc_init -# with the appropriate arguments. -# -# See __static_init.c or __shared_init.c for the expected -# arguments. -# - .text - .align 4 - .type _start,@function - .globl _start -_start: - lr %r2,%r15 - lhi %r3,0 - ahi %r15,-96 - bras %r1,.L0 -.L0: - l %r1,.L1-.L0(%r1) - br %r1 -.L1: - .long __libc_init - - .size _start,.-_start diff --git a/klibc/klibc/arch/s390/mmap.c b/klibc/klibc/arch/s390/mmap.c deleted file mode 100644 index 51ff07f44c..0000000000 --- a/klibc/klibc/arch/s390/mmap.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -struct mmap_arg_struct { - unsigned long addr; - unsigned long len; - unsigned long prot; - unsigned long flags; - unsigned long fd; - unsigned long offset; -}; - -void * __mmap2(void * addr, size_t len, int prot, int flags, - int fd, long offset) -{ - struct mmap_arg_struct args = { - (unsigned long) addr, - (unsigned long) len, - (unsigned long) prot, - (unsigned long) flags, - (unsigned long) fd, - (unsigned long) offset, - }; - - register struct mmap_arg_struct *__arg1 asm("2") = &args; - register long __svcres asm("2"); - unsigned long __res; - - __asm__ __volatile__ ( - " svc %b1\n" - : "=d" (__svcres) - : "i" (__NR_mmap2), - "0" (__arg1) - : "1", "cc", "memory"); - __res = __svcres; - if (__res >= (unsigned long)-125) { - errno = -__res; - __res = -1; - } - return (void *)__res; -} diff --git a/klibc/klibc/arch/s390/setjmp.S b/klibc/klibc/arch/s390/setjmp.S deleted file mode 100644 index 97132680ae..0000000000 --- a/klibc/klibc/arch/s390/setjmp.S +++ /dev/null @@ -1,32 +0,0 @@ -# -# arch/s390/setjmp.S -# -# setjmp/longjmp for the s390 architecture -# - - .text - .align 4 - .globl setjmp - .type setjmp, @function -setjmp: - stm %r6,%r15,0(%r2) # save all general registers - std %f4,40(%r2) # save fp registers f4 and f6 - std %f6,48(%r2) - lhi %r2,0 # return 0 - br %r14 - - .size setjmp,.-setjmp - - .text - .align 4 - .globl longjmp - .type longjmp, @function -longjmp: - lr %r1,%r2 # jmp_buf - lr %r2,%r3 # return value - ld %f6,48(%r1) # restore all saved registers - ld %f4,40(%r1) - lm %r6,%r15,0(%r1) - br %r14 # return to restored address - - .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/s390/syscall.c b/klibc/klibc/arch/s390/syscall.c deleted file mode 100644 index c0f17c453c..0000000000 --- a/klibc/klibc/arch/s390/syscall.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/s390/syscall.c - * - * Common error-handling path for system calls. - * The return value from __syscall_common becomes the - * return value from the system call. - */ -#include - -long int __syscall_common(long int err) -{ - if ((unsigned long)(err) < (unsigned long)(-125)) - return err; - errno = err; - return -1; -} diff --git a/klibc/klibc/arch/s390/sysstub.ph b/klibc/klibc/arch/s390/sysstub.ph deleted file mode 100644 index 35f40a0865..0000000000 --- a/klibc/klibc/arch/s390/sysstub.ph +++ /dev/null @@ -1,31 +0,0 @@ -# -*- perl -*- -# -# arch/s390/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.type ${fname},\@function\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - print OUT ".if __NR_${sname} < 256\n"; - print OUT "\tsvc __NR_${sname}\n"; - print OUT ".else\n"; - print OUT "\tlhi %r1,__NR_${sname}\n"; - print OUT "\tsvc 0\n"; - print OUT ".endif\n"; - print OUT "\tbras %r3,1f\n"; - print OUT "\t.long __syscall_common\n"; - print OUT "1:\tl %r3,0(%r3)\n"; - print OUT "\tbr %r3\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/s390x/MCONFIG b/klibc/klibc/arch/s390x/MCONFIG deleted file mode 100644 index 081a0bbb52..0000000000 --- a/klibc/klibc/arch/s390x/MCONFIG +++ /dev/null @@ -1,13 +0,0 @@ -# -*- makefile -*- -# -# arch/s390x/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -BITSIZE = 64 - -SHAREDFLAGS = -Ttext 0x40000200 diff --git a/klibc/klibc/arch/s390x/Makefile.inc b/klibc/klibc/arch/s390x/Makefile.inc deleted file mode 100644 index 9d614e07b2..0000000000 --- a/klibc/klibc/arch/s390x/Makefile.inc +++ /dev/null @@ -1,18 +0,0 @@ -# -*- makefile -*- -# -# arch/s390x/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/mmap.o \ - arch/$(ARCH)/syscall.o - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - - -archclean: diff --git a/klibc/klibc/arch/s390x/crt0.S b/klibc/klibc/arch/s390x/crt0.S deleted file mode 100644 index de35664904..0000000000 --- a/klibc/klibc/arch/s390x/crt0.S +++ /dev/null @@ -1,21 +0,0 @@ -# -# arch/s390/crt0.S -# -# Does arch-specific initialization and invokes __libc_init -# with the appropriate arguments. -# -# See __static_init.c or __shared_init.c for the expected -# arguments. -# - - .text - .align 4 - .type _start,@function - .globl _start -_start: - lgr %r2,%r15 - lghi %r3,0 - aghi %r15,-160 - jg __libc_init - - .size _start,.-_start diff --git a/klibc/klibc/arch/s390x/mmap.c b/klibc/klibc/arch/s390x/mmap.c deleted file mode 100644 index 158f0933a4..0000000000 --- a/klibc/klibc/arch/s390x/mmap.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include - -struct mmap_arg_struct { - unsigned long addr; - unsigned long len; - unsigned long prot; - unsigned long flags; - unsigned long fd; - unsigned long offset; -}; - -void * mmap(void * addr, size_t len, int prot, int flags, - int fd, off_t offset) -{ - struct mmap_arg_struct args = { - (unsigned long) addr, - (unsigned long) len, - (unsigned long) prot, - (unsigned long) flags, - (unsigned long) fd, - (unsigned long) offset, - }; - - register struct mmap_arg_struct *__arg1 asm("2") = &args; - register long __svcres asm("2"); - unsigned long __res; - - __asm__ __volatile__ ( - " svc %b1\n" - : "=d" (__svcres) - : "i" (__NR_mmap), - "0" (__arg1) - : "1", "cc", "memory"); - __res = __svcres; - if (__res >= (unsigned long)-125) { - errno = -__res; - __res = -1; - } - return (void *)__res; -} diff --git a/klibc/klibc/arch/s390x/setjmp.S b/klibc/klibc/arch/s390x/setjmp.S deleted file mode 100644 index 251c57d43a..0000000000 --- a/klibc/klibc/arch/s390x/setjmp.S +++ /dev/null @@ -1,36 +0,0 @@ -# -# arch/s390x/setjmp.S -# -# setjmp/longjmp for the s390x architecture -# - - .text - .align 4 - .globl setjmp - .type setjmp, @function -setjmp: - stmg %r6,%r15,0(%r2) # save all general registers - std %f1,80(%r2) # save fp registers f4 and f6 - std %f3,88(%r2) - std %f5,96(%r2) - std %f7,104(%r2) - lghi %r2,0 # return 0 - br %r14 - - .size setjmp,.-setjmp - - .text - .align 4 - .globl longjmp - .type longjmp, @function -longjmp: - lgr %r1,%r2 # jmp_buf - lgr %r2,%r3 # return value - ld %f7,104(%r1) # restore all saved registers - ld %f5,96(%r1) - ld %f3,88(%r1) - ld %f1,80(%r1) - lmg %r6,%r15,0(%r1) - br %r14 # return to restored address - - .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/s390x/syscall.c b/klibc/klibc/arch/s390x/syscall.c deleted file mode 100644 index c0f17c453c..0000000000 --- a/klibc/klibc/arch/s390x/syscall.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/s390/syscall.c - * - * Common error-handling path for system calls. - * The return value from __syscall_common becomes the - * return value from the system call. - */ -#include - -long int __syscall_common(long int err) -{ - if ((unsigned long)(err) < (unsigned long)(-125)) - return err; - errno = err; - return -1; -} diff --git a/klibc/klibc/arch/s390x/sysstub.ph b/klibc/klibc/arch/s390x/sysstub.ph deleted file mode 100644 index 55c721b558..0000000000 --- a/klibc/klibc/arch/s390x/sysstub.ph +++ /dev/null @@ -1,28 +0,0 @@ -# -*- perl -*- -# -# arch/s390x/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.type ${fname},\@function\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - print OUT ".if __NR_${sname} < 256\n"; - print OUT "\tsvc __NR_${sname}\n"; - print OUT ".else\n"; - print OUT "\tlghi %r1,__NR_${sname}\n"; - print OUT "\tsvc 0\n"; - print OUT ".endif\n"; - print OUT "\tbrasl %r3,__syscall_common\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/sh/MCONFIG b/klibc/klibc/arch/sh/MCONFIG deleted file mode 100644 index 6cd4e5c839..0000000000 --- a/klibc/klibc/arch/sh/MCONFIG +++ /dev/null @@ -1,19 +0,0 @@ -# -*- makefile -*- -# -# arch/sh/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHREGFLAGS = -m4 -mno-implicit-fp -OPTFLAGS = -Os -fomit-frame-pointer -BITSIZE = 32 - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# 2 MB -- the normal starting point for text is 4 MB. -SHAREDFLAGS = -Ttext 0x00200200 - diff --git a/klibc/klibc/arch/sh/Makefile.inc b/klibc/klibc/arch/sh/Makefile.inc deleted file mode 100644 index ccabfa496b..0000000000 --- a/klibc/klibc/arch/sh/Makefile.inc +++ /dev/null @@ -1,15 +0,0 @@ -# -*- makefile -*- -# -# arch/sh/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = arch/sh/setjmp.o \ - arch/sh/syscall.o - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - -archclean: diff --git a/klibc/klibc/arch/sh/crt0.S b/klibc/klibc/arch/sh/crt0.S deleted file mode 100644 index 21a37655f2..0000000000 --- a/klibc/klibc/arch/sh/crt0.S +++ /dev/null @@ -1,27 +0,0 @@ -# -# arch/sh/crt0.S -# -# Does arch-specific initialization and invokes __libc_init -# with the appropriate arguments. -# -# See __static_init.c or __shared_init.c for the expected -# arguments. -# - - .text - .align 2 - .type _start,#function - .globl _start - -_start: - mov r15, r4 - mov #0, r5 - mov.l 1f, r0 - - jsr @r0 - nop - - .align 2 -1: .long __libc_init - - .size _start,.-_start diff --git a/klibc/klibc/arch/sh/setjmp.S b/klibc/klibc/arch/sh/setjmp.S deleted file mode 100644 index 63f760283f..0000000000 --- a/klibc/klibc/arch/sh/setjmp.S +++ /dev/null @@ -1,65 +0,0 @@ -# -# arch/sh/setjmp.S -# -# setjmp/longjmp for the SuperH architecture -# - -# -# The jmp_buf is assumed to contain the following, in order: -# -# r8 -# r9 -# r10 -# r11 -# r12 -# r13 -# r14 -# r15 -# pr -# - - .text - .align 2 - - .globl setjmp - .type setjmp, #function - -setjmp: - add #(9*4), r4 - sts.l pr, @-r4 - mov.l r15, @-r4 - mov.l r14, @-r4 - mov.l r13, @-r4 - mov.l r12, @-r4 - mov.l r11, @-r4 - mov.l r10, @-r4 - mov.l r9, @-r4 - mov.l r8, @-r4 - rts - mov #0, r0 - - .size setjmp,.-setjmp - - .align 2 - .globl longjmp - .type setjmp, #function - -longjmp: - mov.l @r4+, r8 - mov.l @r4+, r9 - mov.l @r4+, r10 - mov.l @r4+, r11 - mov.l @r4+, r12 - mov.l @r4+, r13 - mov.l @r4+, r14 - mov.l @r4+, r15 - lds.l @r4+, pr - mov r5, r0 - tst r0, r0 - bf 1f - mov #1, r0 ! in case val==0 -1: rts - nop - - .size longjmp,.-longjmp - diff --git a/klibc/klibc/arch/sh/syscall.S b/klibc/klibc/arch/sh/syscall.S deleted file mode 100644 index 41a0486679..0000000000 --- a/klibc/klibc/arch/sh/syscall.S +++ /dev/null @@ -1,35 +0,0 @@ -/* - * arch/sh/syscall.S - * - * On sh, r3 contains the syscall number (set by generated stub); - * r4..r7 contain arguments 0-3 per the standard calling convention, - * and arguments 4-5 are passed in r0 and r1. - * - * The return value is in r3 rather than standard r0. - */ - - .section ".text.syscall","ax" - .align 2 - .globl ___syscall_common - .type ___syscall_common,@function -___syscall_common: - mov.l @(sp),r0 - mov.l @(4,sp),r1 - trapa #0x15 - mov.l 1f,r0 - cmp/hs r0,r3 - bt/s 3f - neg r3,r4 - mov.l 2f,r5 - mov.l r4,@r5 - rts - mov #-1,r0 -3: - rts - mov r3,r0 - - .align 2 -1: .long -4096 /* Errno limit */ -2: .long errno - - .size ___syscall_common,.-___syscall_common diff --git a/klibc/klibc/arch/sh/sysstub.ph b/klibc/klibc/arch/sh/sysstub.ph deleted file mode 100644 index ce04b739e9..0000000000 --- a/klibc/klibc/arch/sh/sysstub.ph +++ /dev/null @@ -1,34 +0,0 @@ -# -*- perl -*- -# -# arch/sh/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.section\t\".text.syscall\",\"ax\"\n"; - print OUT "\t.type\t${fname},\#function\n"; - print OUT "\t.globl\t${fname}\n"; - print OUT "\t.align\t2\n"; - print OUT "${fname}:\n"; - print OUT "\tbra\t__syscall_common\n"; - print OUT "#if __NR_${sname} >= 128\n"; - print OUT "\t mov.l\t1f, r3\n"; - print OUT "#else\n"; - print OUT "\t mov\t# __NR_${sname}, r3\n"; - print OUT "#endif\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - print OUT "\n"; - print OUT "#if __NR_${sname} >= 128\n"; - print OUT "\t.align\t2\n"; - print OUT "1:\t.long\t__NR_${sname}\n"; - print OUT "#endif\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/sparc/MCONFIG b/klibc/klibc/arch/sparc/MCONFIG deleted file mode 100644 index 3a5cbaa2e7..0000000000 --- a/klibc/klibc/arch/sparc/MCONFIG +++ /dev/null @@ -1,18 +0,0 @@ -# -*- makefile -*- -# -# arch/sparc/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -OPTFLAGS = -Os -m32 -mptr32 -BITSIZE = 32 - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# Normal binaries start at 64K; the linker wants 64K alignment, -# and call instructions have a 30-bit signed offset, << 2. -SHAREDFLAGS = -Ttext 0x40000100 diff --git a/klibc/klibc/arch/sparc/Makefile.inc b/klibc/klibc/arch/sparc/Makefile.inc deleted file mode 100644 index bea1dbc94e..0000000000 --- a/klibc/klibc/arch/sparc/Makefile.inc +++ /dev/null @@ -1,51 +0,0 @@ -# -*- makefile -*- -# -# arch/sparc/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/sdiv.o \ - arch/$(ARCH)/udiv.o \ - arch/$(ARCH)/srem.o \ - arch/$(ARCH)/urem.o \ - arch/$(ARCH)/smul.o \ - arch/$(ARCH)/umul.o \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o \ - arch/$(ARCH)/sysfork.o \ - libgcc/__divdi3.o \ - libgcc/__moddi3.o \ - libgcc/__udivdi3.o \ - libgcc/__umoddi3.o \ - libgcc/__udivmoddi4.o - -arch/$(ARCH)/sdiv.S: arch/$(ARCH)/divrem.m4 - @echo 'building $@ from $^' - @(echo "define(NAME,\`.div')define(OP,\`div')define(S,\`true')"; \ - cat $^) | m4 > $@ - @chmod 444 $@ - -arch/$(ARCH)/udiv.S: arch/$(ARCH)/divrem.m4 - @echo 'building $@ from $^' - @(echo "define(NAME,\`.udiv')define(OP,\`div')define(S,\`false')"; \ - cat $^) | m4 > $@ - @chmod 444 $@ - -arch/$(ARCH)/srem.S: arch/$(ARCH)/divrem.m4 - @echo 'building $@ from $^' - @(echo "define(NAME,\`.rem')define(OP,\`rem')define(S,\`true')"; \ - cat $^) | m4 > $@ - @chmod 444 $@ - -arch/$(ARCH)/urem.S: arch/$(ARCH)/divrem.m4 - @echo 'building $@ from $^' - @(echo "define(NAME,\`.urem')define(OP,\`rem')define(S,\`false')"; \ - cat $^) | m4 > $@ - @chmod 444 $@ - -archclean: - rm -f arch/$(ARCH)/?div.S arch/$(ARCH)/?rem.S diff --git a/klibc/klibc/arch/sparc/crt0.S b/klibc/klibc/arch/sparc/crt0.S deleted file mode 100644 index 63db188961..0000000000 --- a/klibc/klibc/arch/sparc/crt0.S +++ /dev/null @@ -1,2 +0,0 @@ -#define TARGET_PTR_SIZE 32 -#include "crt0i.S" diff --git a/klibc/klibc/arch/sparc/crt0i.S b/klibc/klibc/arch/sparc/crt0i.S deleted file mode 100644 index 97652a3090..0000000000 --- a/klibc/klibc/arch/sparc/crt0i.S +++ /dev/null @@ -1,100 +0,0 @@ -! This file derived from the equivalent in newlib -! -! C run time start off - -! This file supports: -! -! - both 32bit pointer and 64bit pointer environments (at compile time) -! - an imposed stack bias (of 2047) (at run time) -! - medium/low and medium/anywhere code models (at run time) - -! Initial stack setup: -! -! bottom of stack (higher memory address) -! ... -! text of environment strings -! text of argument strings -! envp[envc] = 0 (4/8 bytes) -! ... -! env[0] (4/8 bytes) -! argv[argc] = 0 (4/8 bytes) -! ... -! argv[0] (4/8 bytes) -! argc (4/8 bytes) -! register save area (64 bits by 16 registers = 128 bytes) -! top of stack (%sp) - -! Stack Bias: -! -! It is the responsibility of the o/s to set this up. -! We handle both a 0 and 2047 value for the stack bias. - -! Medium/Anywhere code model support: -! -! In this model %g4 points to the start of the data segment. -! The text segment can go anywhere, but %g4 points to the *data* segment. -! It is up to the compiler/linker to get this right. -! -! Since this model is statically linked the start of the data segment -! is known at link time. Eg: -! -! sethi %hh(data_start), %g1 -! sethi %lm(data_start), %g4 -! or %g1, %hm(data_start), %g1 -! or %g4, %lo(data_start), %g4 -! sllx %g1, 32, %g1 -! or %g4, %g1, %g4 -! -! FIXME: For now we just assume 0. - -! FIXME: if %g1 contains a non-zero value, atexit() should be invoked -! with this value. - - - .text - .align 4 - .globl _start - .type _start, @function -_start: - clr %fp - -! We use %g4 even if the code model is Medium/Low (simplifies the code). - - clr %g4 ! Medium/Anywhere base reg - -! If there is a stack bias in effect, account for it in %g5. Then always -! add %g5 to stack references below. This way the code can be used with -! or without an imposed bias. - - andcc %sp, 1, %g5 - bz,a .LNoBias - nop - mov 2047, %g5 -.LNoBias: - add %sp, %g5, %g5 - -! On entry, the kernel leaves room for one register frame, but -! the C API wants more free space. Thus, we need to drop the stack -! pointer additionally. - -#if TARGET_PTR_SIZE == 32 - sub %sp, 32, %sp ! make room for incoming arguments -#else /* TARGET_PTR_SIZE == 64 */ - sub %sp, 64, %sp ! make room for incoming arguments -#endif - -! Set up pointers to the ELF data structure (argc, argv, ...) -! Pass as the first argument to __libc_init -#if TARGET_PTR_SIZE == 32 - add %g5, 0x40, %o0 -#else /* TARGET_PTR_SIZE == 64 */ - add %g5, 0x80, %o0 -#endif - - call __libc_init - mov %g1, %o1 ! This is the "atexit" pointer; - ! pass as the second argument to __libc_init - -! If __libc_init returns, something is hosed. Try an illegal insn. -! If that does not work, the o/s is hosed more than we are. - .long 0 diff --git a/klibc/klibc/arch/sparc/divrem.m4 b/klibc/klibc/arch/sparc/divrem.m4 deleted file mode 100644 index aa4171dd88..0000000000 --- a/klibc/klibc/arch/sparc/divrem.m4 +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: divrem.m4,v 1.4 92/06/25 13:23:57 torek Exp - * $NetBSD: divrem.m4,v 1.4 1997/10/09 10:07:54 lukem Exp $ - */ - -/* - * Division and remainder, from Appendix E of the Sparc Version 8 - * Architecture Manual, with fixes from Gordon Irlam. - */ - -#if defined(LIBC_SCCS) && !defined(lint) - .asciz "@(#)divrem.m4 8.1 (Berkeley) 6/4/93" -#endif /* LIBC_SCCS and not lint */ - -/* - * Input: dividend and divisor in %o0 and %o1 respectively. - * - * m4 parameters: - * NAME name of function to generate - * OP OP=div => %o0 / %o1; OP=rem => %o0 % %o1 - * S S=true => signed; S=false => unsigned - * - * Algorithm parameters: - * N how many bits per iteration we try to get (4) - * WORDSIZE total number of bits (32) - * - * Derived constants: - * TWOSUPN 2^N, for label generation (m4 exponentiation currently broken) - * TOPBITS number of bits in the top `decade' of a number - * - * Important variables: - * Q the partial quotient under development (initially 0) - * R the remainder so far, initially the dividend - * ITER number of main division loop iterations required; - * equal to ceil(log2(quotient) / N). Note that this - * is the log base (2^N) of the quotient. - * V the current comparand, initially divisor*2^(ITER*N-1) - * - * Cost: - * Current estimate for non-large dividend is - * ceil(log2(quotient) / N) * (10 + 7N/2) + C - * A large dividend is one greater than 2^(31-TOPBITS) and takes a - * different path, as the upper bits of the quotient must be developed - * one bit at a time. - */ - -define(N, `4') -define(TWOSUPN, `16') -define(WORDSIZE, `32') -define(TOPBITS, eval(WORDSIZE - N*((WORDSIZE-1)/N))) - -define(dividend, `%o0') -define(divisor, `%o1') -define(Q, `%o2') -define(R, `%o3') -define(ITER, `%o4') -define(V, `%o5') - -/* m4 reminder: ifelse(a,b,c,d) => if a is b, then c, else d */ -define(T, `%g1') -define(SC, `%g7') -ifelse(S, `true', `define(SIGN, `%g6')') - -/* - * This is the recursive definition for developing quotient digits. - * - * Parameters: - * $1 the current depth, 1 <= $1 <= N - * $2 the current accumulation of quotient bits - * N max depth - * - * We add a new bit to $2 and either recurse or insert the bits in - * the quotient. R, Q, and V are inputs and outputs as defined above; - * the condition codes are expected to reflect the input R, and are - * modified to reflect the output R. - */ -define(DEVELOP_QUOTIENT_BITS, -` ! depth $1, accumulated bits $2 - bl L.$1.eval(TWOSUPN+$2) - srl V,1,V - ! remainder is positive - subcc R,V,R - ifelse($1, N, - ` b 9f - add Q, ($2*2+1), Q - ', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2+1)')') -L.$1.eval(TWOSUPN+$2): - ! remainder is negative - addcc R,V,R - ifelse($1, N, - ` b 9f - add Q, ($2*2-1), Q - ', ` DEVELOP_QUOTIENT_BITS(incr($1), `eval(2*$2-1)')') - ifelse($1, 1, `9:')') - -#include -#include - -FUNC(NAME) -ifelse(S, `true', -` ! compute sign of result; if neither is negative, no problem - orcc divisor, dividend, %g0 ! either negative? - bge 2f ! no, go do the divide - ifelse(OP, `div', - `xor divisor, dividend, SIGN', - `mov dividend, SIGN') ! compute sign in any case - tst divisor - bge 1f - tst dividend - ! divisor is definitely negative; dividend might also be negative - bge 2f ! if dividend not negative... - neg divisor ! in any case, make divisor nonneg -1: ! dividend is negative, divisor is nonnegative - neg dividend ! make dividend nonnegative -2: -') - ! Ready to divide. Compute size of quotient; scale comparand. - orcc divisor, %g0, V - bnz 1f - mov dividend, R - - ! Divide by zero trap. If it returns, return 0 (about as - ! wrong as possible, but that is what SunOS does...). - t ST_DIV0 - retl - clr %o0 - -1: - cmp R, V ! if divisor exceeds dividend, done - blu Lgot_result ! (and algorithm fails otherwise) - clr Q - sethi %hi(1 << (WORDSIZE - TOPBITS - 1)), T - cmp R, T - blu Lnot_really_big - clr ITER - - ! `Here the dividend is >= 2^(31-N) or so. We must be careful here, - ! as our usual N-at-a-shot divide step will cause overflow and havoc. - ! The number of bits in the result here is N*ITER+SC, where SC <= N. - ! Compute ITER in an unorthodox manner: know we need to shift V into - ! the top decade: so do not even bother to compare to R.' - 1: - cmp V, T - bgeu 3f - mov 1, SC - sll V, N, V - b 1b - inc ITER - - ! Now compute SC. - 2: addcc V, V, V - bcc Lnot_too_big - inc SC - - ! We get here if the divisor overflowed while shifting. - ! This means that R has the high-order bit set. - ! Restore V and subtract from R. - sll T, TOPBITS, T ! high order bit - srl V, 1, V ! rest of V - add V, T, V - b Ldo_single_div - dec SC - - Lnot_too_big: - 3: cmp V, R - blu 2b - nop - be Ldo_single_div - nop - /* NB: these are commented out in the V8-Sparc manual as well */ - /* (I do not understand this) */ - ! V > R: went too far: back up 1 step - ! srl V, 1, V - ! dec SC - ! do single-bit divide steps - ! - ! We have to be careful here. We know that R >= V, so we can do the - ! first divide step without thinking. BUT, the others are conditional, - ! and are only done if R >= 0. Because both R and V may have the high- - ! order bit set in the first step, just falling into the regular - ! division loop will mess up the first time around. - ! So we unroll slightly... - Ldo_single_div: - deccc SC - bl Lend_regular_divide - nop - sub R, V, R - mov 1, Q - b Lend_single_divloop - nop - Lsingle_divloop: - sll Q, 1, Q - bl 1f - srl V, 1, V - ! R >= 0 - sub R, V, R - b 2f - inc Q - 1: ! R < 0 - add R, V, R - dec Q - 2: - Lend_single_divloop: - deccc SC - bge Lsingle_divloop - tst R - b,a Lend_regular_divide - -Lnot_really_big: -1: - sll V, N, V - cmp V, R - bleu 1b - inccc ITER - be Lgot_result - dec ITER - - tst R ! set up for initial iteration -Ldivloop: - sll Q, N, Q - DEVELOP_QUOTIENT_BITS(1, 0) -Lend_regular_divide: - deccc ITER - bge Ldivloop - tst R - bl,a Lgot_result - ! non-restoring fixup here (one instruction only!) -ifelse(OP, `div', -` dec Q -', ` add R, divisor, R -') - -Lgot_result: -ifelse(S, `true', -` ! check to see if answer should be < 0 - tst SIGN - bl,a 1f - ifelse(OP, `div', `neg Q', `neg R') -1:') - retl - ifelse(OP, `div', `mov Q, %o0', `mov R, %o0') diff --git a/klibc/klibc/arch/sparc/setjmp.S b/klibc/klibc/arch/sparc/setjmp.S deleted file mode 100644 index f41ee2bf12..0000000000 --- a/klibc/klibc/arch/sparc/setjmp.S +++ /dev/null @@ -1,38 +0,0 @@ -! -! setjmp.S -! -! Basic setjmp/longjmp -! -! This code was based on the equivalent code in NetBSD -! - -#include -#include - -! -! The jmp_buf contains the following entries: -! sp -! fp -! pc -! -ENTRY(setjmp) - st %sp,[%o0+0] ! Callers stack pointer - st %o7,[%o0+4] ! Return pc - st %fp,[%o0+8] ! Frame pointer - retl ! Return - clr %o0 ! ...0 - -ENTRY(longjmp) - sub %sp, 64, %sp ! set up a local stack frame -0: - t ST_FLUSHWIN ! flush register windows out to memory - ! - ! We restore the saved stack pointer to %fp, then issue - ! a restore instruction which will reload the register - ! window from the stack. - ! - ld [%o0+4], %o7 /* restore return pc */ - ld [%o0+0], %fp /* and stack pointer */ - - retl ! success, return %g6 - restore %o1, 0, %o0 diff --git a/klibc/klibc/arch/sparc/smul.S b/klibc/klibc/arch/sparc/smul.S deleted file mode 100644 index 0eb218bbe8..0000000000 --- a/klibc/klibc/arch/sparc/smul.S +++ /dev/null @@ -1,160 +0,0 @@ -/* $NetBSD: mul.S,v 1.3 1997/07/16 14:37:42 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: mul.s,v 1.5 92/06/25 13:24:03 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)mul.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: mul.S,v 1.3 1997/07/16 14:37:42 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * Signed multiply, from Appendix E of the Sparc Version 8 - * Architecture Manual. - * - * Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the upper 32 bits of - * the 64-bit product). - * - * This code optimizes short (less than 13-bit) multiplies. - */ - -FUNC(.mul) - mov %o0, %y ! multiplier -> Y - andncc %o0, 0xfff, %g0 ! test bits 12..31 - be Lmul_shortway ! if zero, can do it the short way - andcc %g0, %g0, %o4 ! zero the partial product and clear N and V - - /* - * Long multiply. 32 steps, followed by a final shift step. - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %o1, %o4 ! 13 - mulscc %o4, %o1, %o4 ! 14 - mulscc %o4, %o1, %o4 ! 15 - mulscc %o4, %o1, %o4 ! 16 - mulscc %o4, %o1, %o4 ! 17 - mulscc %o4, %o1, %o4 ! 18 - mulscc %o4, %o1, %o4 ! 19 - mulscc %o4, %o1, %o4 ! 20 - mulscc %o4, %o1, %o4 ! 21 - mulscc %o4, %o1, %o4 ! 22 - mulscc %o4, %o1, %o4 ! 23 - mulscc %o4, %o1, %o4 ! 24 - mulscc %o4, %o1, %o4 ! 25 - mulscc %o4, %o1, %o4 ! 26 - mulscc %o4, %o1, %o4 ! 27 - mulscc %o4, %o1, %o4 ! 28 - mulscc %o4, %o1, %o4 ! 29 - mulscc %o4, %o1, %o4 ! 30 - mulscc %o4, %o1, %o4 ! 31 - mulscc %o4, %o1, %o4 ! 32 - mulscc %o4, %g0, %o4 ! final shift - - ! If %o0 was negative, the result is - ! (%o0 * %o1) + (%o1 << 32)) - ! We fix that here. - - tst %o0 - bge 1f - rd %y, %o0 - - ! %o0 was indeed negative; fix upper 32 bits of result by subtracting - ! %o1 (i.e., return %o4 - %o1 in %o1). - retl - sub %o4, %o1, %o1 - -1: - retl - mov %o4, %o1 - -Lmul_shortway: - /* - * Short multiply. 12 steps, followed by a final shift step. - * The resulting bits are off by 12 and (32-12) = 20 bit positions, - * but there is no problem with %o0 being negative (unlike above). - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %g0, %o4 ! final shift - - /* - * %o4 has 20 of the bits that should be in the low part of the - * result; %y has the bottom 12 (as %y's top 12). That is: - * - * %o4 %y - * +----------------+----------------+ - * | -12- | -20- | -12- | -20- | - * +------(---------+------)---------+ - * --hi-- ----low-part---- - * - * The upper 12 bits of %o4 should be sign-extended to form the - * high part of the product (i.e., highpart = %o4 >> 20). - */ - - rd %y, %o5 - sll %o4, 12, %o0 ! shift middle bits left 12 - srl %o5, 20, %o5 ! shift low bits right 20, zero fill at left - or %o5, %o0, %o0 ! construct low part of result - retl - sra %o4, 20, %o1 ! ... and extract high part of result diff --git a/klibc/klibc/arch/sparc/syscall.S b/klibc/klibc/arch/sparc/syscall.S deleted file mode 100644 index c0273f77ca..0000000000 --- a/klibc/klibc/arch/sparc/syscall.S +++ /dev/null @@ -1,19 +0,0 @@ -/* - * arch/sparc/syscall.S - * - * Common system-call stub; %g1 already set to syscall number - */ - - .globl __syscall_common - .type __syscall_common,#function - .align 4 -__syscall_common: - t 0x10 - bcc 1f - sethi %hi(errno), %g4 - or %g4, %lo(errno), %g4 - st %o0,[%g4] - mov -1, %o0 -1: - retl - nop diff --git a/klibc/klibc/arch/sparc/sysfork.S b/klibc/klibc/arch/sparc/sysfork.S deleted file mode 100644 index a66c76e9db..0000000000 --- a/klibc/klibc/arch/sparc/sysfork.S +++ /dev/null @@ -1,25 +0,0 @@ -/* - * arch/sparc/sysfork.S - * - * The fork and vfork system calls are special on sparc[64]: - * they return the "other process" pid in %o0 and the - * "is child" flag in %o1 - * - * Common system-call stub; %g1 already set to syscall number - */ - - .globl __syscall_forkish - .type __syscall_forkish,#function - .align 4 -__syscall_forkish: - t 0x10 - sub %o1, 1, %o1 - bcc,a 1f - and %o0, %o1, %o0 - sethi %hi(errno), %g4 - or %g4, %lo(errno), %g4 - st %o0,[%g4] - mov -1, %o0 -1: - retl - nop diff --git a/klibc/klibc/arch/sparc/sysstub.ph b/klibc/klibc/arch/sparc/sysstub.ph deleted file mode 100644 index d8cedb5ae5..0000000000 --- a/klibc/klibc/arch/sparc/sysstub.ph +++ /dev/null @@ -1,25 +0,0 @@ -# -*- perl -*- -# -# arch/sparc32/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - $stype = $stype || 'common'; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.type ${fname},\@function\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - print OUT "\tb __syscall_${stype}\n"; - print OUT "\t mov\t__NR_${sname}, %g1\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/sparc/umul.S b/klibc/klibc/arch/sparc/umul.S deleted file mode 100644 index 6a7193d217..0000000000 --- a/klibc/klibc/arch/sparc/umul.S +++ /dev/null @@ -1,193 +0,0 @@ -/* $NetBSD: umul.S,v 1.3 1997/07/16 14:37:44 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: umul.s,v 1.4 92/06/25 13:24:05 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)umul.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: umul.S,v 1.3 1997/07/16 14:37:44 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * Unsigned multiply. Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the - * upper 32 bits of the 64-bit product). - * - * This code optimizes short (less than 13-bit) multiplies. Short - * multiplies require 25 instruction cycles, and long ones require - * 45 instruction cycles. - * - * On return, overflow has occurred (%o1 is not zero) if and only if - * the Z condition code is clear, allowing, e.g., the following: - * - * call .umul - * nop - * bnz overflow (or tnz) - */ - -FUNC(.umul) - or %o0, %o1, %o4 - mov %o0, %y ! multiplier -> Y - andncc %o4, 0xfff, %g0 ! test bits 12..31 of *both* args - be Lmul_shortway ! if zero, can do it the short way - andcc %g0, %g0, %o4 ! zero the partial product and clear N and V - - /* - * Long multiply. 32 steps, followed by a final shift step. - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %o1, %o4 ! 13 - mulscc %o4, %o1, %o4 ! 14 - mulscc %o4, %o1, %o4 ! 15 - mulscc %o4, %o1, %o4 ! 16 - mulscc %o4, %o1, %o4 ! 17 - mulscc %o4, %o1, %o4 ! 18 - mulscc %o4, %o1, %o4 ! 19 - mulscc %o4, %o1, %o4 ! 20 - mulscc %o4, %o1, %o4 ! 21 - mulscc %o4, %o1, %o4 ! 22 - mulscc %o4, %o1, %o4 ! 23 - mulscc %o4, %o1, %o4 ! 24 - mulscc %o4, %o1, %o4 ! 25 - mulscc %o4, %o1, %o4 ! 26 - mulscc %o4, %o1, %o4 ! 27 - mulscc %o4, %o1, %o4 ! 28 - mulscc %o4, %o1, %o4 ! 29 - mulscc %o4, %o1, %o4 ! 30 - mulscc %o4, %o1, %o4 ! 31 - mulscc %o4, %o1, %o4 ! 32 - mulscc %o4, %g0, %o4 ! final shift - - - /* - * Normally, with the shift-and-add approach, if both numbers are - * positive you get the correct result. WIth 32-bit two's-complement - * numbers, -x is represented as - * - * x 32 - * ( 2 - ------ ) mod 2 * 2 - * 32 - * 2 - * - * (the `mod 2' subtracts 1 from 1.bbbb). To avoid lots of 2^32s, - * we can treat this as if the radix point were just to the left - * of the sign bit (multiply by 2^32), and get - * - * -x = (2 - x) mod 2 - * - * Then, ignoring the `mod 2's for convenience: - * - * x * y = xy - * -x * y = 2y - xy - * x * -y = 2x - xy - * -x * -y = 4 - 2x - 2y + xy - * - * For signed multiplies, we subtract (x << 32) from the partial - * product to fix this problem for negative multipliers (see mul.s). - * Because of the way the shift into the partial product is calculated - * (N xor V), this term is automatically removed for the multiplicand, - * so we don't have to adjust. - * - * But for unsigned multiplies, the high order bit wasn't a sign bit, - * and the correction is wrong. So for unsigned multiplies where the - * high order bit is one, we end up with xy - (y << 32). To fix it - * we add y << 32. - */ - tst %o1 - bl,a 1f ! if %o1 < 0 (high order bit = 1), - add %o4, %o0, %o4 ! %o4 += %o0 (add y to upper half) -1: rd %y, %o0 ! get lower half of product - retl - addcc %o4, %g0, %o1 ! put upper half in place and set Z for %o1==0 - -Lmul_shortway: - /* - * Short multiply. 12 steps, followed by a final shift step. - * The resulting bits are off by 12 and (32-12) = 20 bit positions, - * but there is no problem with %o0 being negative (unlike above), - * and overflow is impossible (the answer is at most 24 bits long). - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %g0, %o4 ! final shift - - /* - * %o4 has 20 of the bits that should be in the result; %y has - * the bottom 12 (as %y's top 12). That is: - * - * %o4 %y - * +----------------+----------------+ - * | -12- | -20- | -12- | -20- | - * +------(---------+------)---------+ - * -----result----- - * - * The 12 bits of %o4 left of the `result' area are all zero; - * in fact, all top 20 bits of %o4 are zero. - */ - - rd %y, %o5 - sll %o4, 12, %o0 ! shift middle bits left 12 - srl %o5, 20, %o5 ! shift low bits right 20 - or %o5, %o0, %o0 - retl - addcc %g0, %g0, %o1 ! %o1 = zero, and set Z diff --git a/klibc/klibc/arch/sparc64/MCONFIG b/klibc/klibc/arch/sparc64/MCONFIG deleted file mode 100644 index a8a742412e..0000000000 --- a/klibc/klibc/arch/sparc64/MCONFIG +++ /dev/null @@ -1,21 +0,0 @@ -# -*- makefile -*- -# -# arch/sparc64/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHREQFLAGS = -m64 -mptr64 -OPTFLAGS = -Os -BITSIZE = 64 - -LDFLAGS = -m elf64_sparc - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# Normal binaries start at 1 MB; the linker wants 1 MB alignment, -# and call instructions have a 30-bit signed offset, << 2. -SHAREDFLAGS = -Ttext 0x80000200 diff --git a/klibc/klibc/arch/sparc64/Makefile.inc b/klibc/klibc/arch/sparc64/Makefile.inc deleted file mode 100644 index 06b79537a3..0000000000 --- a/klibc/klibc/arch/sparc64/Makefile.inc +++ /dev/null @@ -1,15 +0,0 @@ -# -*- makefile -*- -# -# arch/sparc64/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o \ - arch/$(ARCH)/sysfork.o - -archclean: diff --git a/klibc/klibc/arch/sparc64/crt0.S b/klibc/klibc/arch/sparc64/crt0.S deleted file mode 100644 index 5faee7c6be..0000000000 --- a/klibc/klibc/arch/sparc64/crt0.S +++ /dev/null @@ -1,2 +0,0 @@ -#define TARGET_PTR_SIZE 64 -#include "../sparc/crt0i.S" diff --git a/klibc/klibc/arch/sparc64/setjmp.S b/klibc/klibc/arch/sparc64/setjmp.S deleted file mode 100644 index b04d47faab..0000000000 --- a/klibc/klibc/arch/sparc64/setjmp.S +++ /dev/null @@ -1,55 +0,0 @@ -! -! setjmp.S -! -! Basic setjmp/longjmp -! -! This code was based on the equivalent code in NetBSD -! - -! -! The jmp_buf contains the following entries: -! sp -! fp -! pc -! - .text - .align 4 - .global setjmp - .type setjmp, @function -setjmp: - stx %sp,[%o0+0] ! Callers stack pointer - stx %o7,[%o0+8] ! Return pc - stx %fp,[%o0+16] ! Frame pointer - retl ! Return - clr %o0 ! ...0 - - .size setjmp,.-setjmp - - - .globl longjmp - .type longjmp, @function -longjmp: - mov %o1, %g4 ! save return value - mov %o0, %g1 ! save target - ldx [%g1+16],%g5 ! get callers frame -1: - cmp %fp, %g5 ! compare against desired frame - bl,a 1b ! if below... - restore ! pop frame and loop - be,a 2f ! if there... - ldx [%g1+0],%o2 ! fetch return %sp - -.Lbotch: - unimp 0 ! ... error ... - -2: - cmp %o2, %sp ! %sp must not decrease - bl .Lbotch - nop - mov %o2, %sp ! it is OK, put it in place - - ldx [%g1+8],%o3 ! fetch %pc - jmp %o3 + 8 ! if sucess... - mov %g4,%o0 ! return %g4 - - .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/sparc64/syscall.S b/klibc/klibc/arch/sparc64/syscall.S deleted file mode 100644 index 7ab9d95f11..0000000000 --- a/klibc/klibc/arch/sparc64/syscall.S +++ /dev/null @@ -1,18 +0,0 @@ -/* - * arch/sparc64/syscall.S - * - * Common system-call stub; %g1 already set to syscall number - */ - - .globl __syscall_common - .type __syscall_common,#function - .align 4 -__syscall_common: - t 0x6d - bcc %xcc, 1f - sethi %hi(errno), %g4 - or %g4, %lo(errno), %g4 - st %o0,[%g4] -1: - retl - movcs %xcc, -1, %o0 diff --git a/klibc/klibc/arch/sparc64/sysfork.S b/klibc/klibc/arch/sparc64/sysfork.S deleted file mode 100644 index 739c35ede3..0000000000 --- a/klibc/klibc/arch/sparc64/sysfork.S +++ /dev/null @@ -1,26 +0,0 @@ -/* - * arch/sparc64/sysfork.S - * - * The fork and vfork system calls are special on sparc[64]: - * they return the "other process" pid in %o0 and the - * "is child" flag in %o1 - * - * Common system-call stub; %g1 already set to syscall number - * - * IS THIS CORRECT FOR SPARC64? - */ - - .globl __syscall_forkish - .type __syscall_forkish,#function - .align 4 -__syscall_forkish: - t 0x6d - sub %o1, 1, %o1 - bcc,a %xcc, 1f - and %o0, %o1, %o0 - sethi %hi(errno), %g4 - or %g4, %lo(errno), %g4 - st %o0,[%g4] -1: - retl - movcs %xcc, -1, %o0 diff --git a/klibc/klibc/arch/sparc64/sysstub.ph b/klibc/klibc/arch/sparc64/sysstub.ph deleted file mode 100644 index deeb88ce07..0000000000 --- a/klibc/klibc/arch/sparc64/sysstub.ph +++ /dev/null @@ -1,25 +0,0 @@ -# -*- perl -*- -# -# arch/sparc64/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - $stype = $stype || 'common'; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.type ${fname},\@function\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - print OUT "\tb __syscall_${stype}\n"; - print OUT "\t mov\t__NR_${sname}, %g1\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/arch/x86_64/MCONFIG b/klibc/klibc/arch/x86_64/MCONFIG deleted file mode 100644 index c9b5da8bd6..0000000000 --- a/klibc/klibc/arch/x86_64/MCONFIG +++ /dev/null @@ -1,36 +0,0 @@ -# -*- makefile -*- -# -# arch/x86-64/MCONFIG -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# -# Blatantly copied and modified from i386 version by Mats Petersson, AMD. -# - -# -# NOTE: -fno-asynchronous-unwind-tables produce significantly smaller -# binaries (20% smaller), but makes the code completely useless for -# debugging using gdb. -# -ARCHREQFLAGS = -m64 -ifeq ($(DEBUG),y) -OPTFLAGS = -Os -fomit-frame-pointer \ - -falign-functions=0 -falign-jumps=0 -falign-loops=0 -else -OPTFLAGS = -Os -fno-asynchronous-unwind-tables -fomit-frame-pointer \ - -falign-functions=0 -falign-jumps=0 -falign-loops=0 -endif -BITSIZE = 64 -LDFLAGS = -m elf_x86_64 - -# Extra linkflags when building the shared version of the library -# This address needs to be reachable using normal inter-module -# calls, and work on the memory models for this architecture -# 2 MB - normal binaries start at 4 MB -SHAREDFLAGS = -Ttext 0x00200200 - -# Additional asm- directories needed during installation -ASMARCH = asm-i386 - diff --git a/klibc/klibc/arch/x86_64/Makefile.inc b/klibc/klibc/arch/x86_64/Makefile.inc deleted file mode 100644 index 26d880d7c7..0000000000 --- a/klibc/klibc/arch/x86_64/Makefile.inc +++ /dev/null @@ -1,18 +0,0 @@ -# -*- makefile -*- -# -# arch/x86_64/Makefile.inc -# -# Special rules for this architecture. Note that this is actually -# included from the main Makefile, and that pathnames should be -# accordingly. -# - -ARCHOBJS = \ - arch/$(ARCH)/exits.o \ - arch/$(ARCH)/setjmp.o \ - arch/$(ARCH)/syscall.o \ - arch/$(ARCH)/sigreturn.o - -ARCHSOOBJS = $(patsubst %.o,%.lo,$(ARCHOBJS)) - -archclean: diff --git a/klibc/klibc/arch/x86_64/crt0.S b/klibc/klibc/arch/x86_64/crt0.S deleted file mode 100644 index c562708d0f..0000000000 --- a/klibc/klibc/arch/x86_64/crt0.S +++ /dev/null @@ -1,22 +0,0 @@ -# -# arch/x86_64/crt0.S -# -# Does arch-specific initialization and invokes __libc_init -# with the appropriate arguments. -# -# See __static_init.c or __shared_init.c for the expected -# arguments. -# - - .text - .align 4 - .type _start,@function - .globl _start -_start: - movq %rsp,%rdi # Offset of the ELF data structure - movq %rdx,%rsi # The atexit() pointer (if any) - call __libc_init - # We should never get here... - hlt - - .size _start,.-_start diff --git a/klibc/klibc/arch/x86_64/exits.S b/klibc/klibc/arch/x86_64/exits.S deleted file mode 100644 index 618f4fb585..0000000000 --- a/klibc/klibc/arch/x86_64/exits.S +++ /dev/null @@ -1,35 +0,0 @@ -# -# exit and _exit get included in *every* program, and gcc generates -# horrible code for them. Yes, this only saves a few bytes, but -# it does it in every program. -# - -#include - - .data - .align 8 - .globl __exit_handler - .type __exit_handler,@object -__exit_handler: - .quad _exit - .size __exit_handler,8 - - .text - .align 8 - .globl exit - .type exit,@function -exit: - jmp *(__exit_handler) - .size exit,.-exit - - /* No need to save any registers... we're exiting! */ - .text - .align 4 - .globl _exit - .type _exit,@function -_exit: - movl $__NR_exit,%eax - /* The argument is already in %rdi */ - syscall - .size _exit,.-exit - diff --git a/klibc/klibc/arch/x86_64/setjmp.S b/klibc/klibc/arch/x86_64/setjmp.S deleted file mode 100644 index 45f547b404..0000000000 --- a/klibc/klibc/arch/x86_64/setjmp.S +++ /dev/null @@ -1,54 +0,0 @@ -# -# arch/x86_64/setjmp.S -# -# setjmp/longjmp for the x86-64 architecture -# - -# -# The jmp_buf is assumed to contain the following, in order: -# %rbx -# %rsp (post-return) -# %rbp -# %r12 -# %r13 -# %r14 -# %r15 -# -# - - .text - .align 4 - .globl setjmp - .type setjmp, @function -setjmp: - pop %rsi # Return address, and adjust the stack - xorl %eax,%eax # Return value - movq %rbx,(%rdi) - movq %rsp,8(%rdi) # Post-return %rsp! - push %rsi # Make the call/return stack happy - movq %rbp,16(%rdi) - movq %r12,24(%rdi) - movq %r13,32(%rdi) - movq %r14,40(%rdi) - movq %r15,48(%rdi) - movq %rsi,56(%rdi) # Return address - ret - - .size setjmp,.-setjmp - - .text - .align 4 - .globl longjmp - .type longjmp, @function -longjmp: - movl %esi,%eax # Return value (int) - movq (%rdi),%rbx - movq 8(%rdi),%rsp - movq 16(%rdi),%rbp - movq 24(%rdi),%r12 - movq 32(%rdi),%r13 - movq 40(%rdi),%r14 - movq 48(%rdi),%r15 - jmp *56(%rdi) - - .size longjmp,.-longjmp diff --git a/klibc/klibc/arch/x86_64/sigreturn.S b/klibc/klibc/arch/x86_64/sigreturn.S deleted file mode 100644 index 66e7152344..0000000000 --- a/klibc/klibc/arch/x86_64/sigreturn.S +++ /dev/null @@ -1,15 +0,0 @@ -/* - * arch/x86_64/sigreturn.S - */ - -#include - - .text - .align 4 - .globl __sigreturn - .type __sigreturn,@function -__sigreturn: - movl $__NR_rt_sigreturn,%eax - syscall - - .size __sigreturn,.-__sigreturn diff --git a/klibc/klibc/arch/x86_64/syscall.S b/klibc/klibc/arch/x86_64/syscall.S deleted file mode 100644 index 17977978b9..0000000000 --- a/klibc/klibc/arch/x86_64/syscall.S +++ /dev/null @@ -1,28 +0,0 @@ -/* - * arch/x86-64/syscall.S - * - * Common tail-handling code for system calls. - * - * The arguments are in the standard argument registers; the system - * call number in %eax. - */ - .text - .align 4 - .globl __syscall_common - .type __syscall_common,@function -__syscall_common: - movq %rcx,%r10 # The kernel uses %r10 istf %rcx - syscall - - cmpq $-4095,%rax - jnb 1f - ret - - # Error return, must set errno -1: - negl %eax - movl %eax,errno(%rip) # errno is type int, so 32 bits - orq $-1,%rax # orq $-1 smaller than movq $-1 - ret - - .size __syscall_common,.-__syscall_common diff --git a/klibc/klibc/arch/x86_64/sysstub.ph b/klibc/klibc/arch/x86_64/sysstub.ph deleted file mode 100644 index e2d797b166..0000000000 --- a/klibc/klibc/arch/x86_64/sysstub.ph +++ /dev/null @@ -1,23 +0,0 @@ -# -*- perl -*- -# -# arch/x86_64/sysstub.ph -# -# Script to generate system call stubs -# - -sub make_sysstub($$$$$@) { - my($outputdir, $fname, $type, $sname, $stype, @args) = @_; - - open(OUT, '>', "${outputdir}/${fname}.S"); - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.type ${fname},\@function\n"; - print OUT "\t.globl ${fname}\n"; - print OUT "${fname}:\n"; - print OUT "\tmovl \$__NR_${sname},%eax\n"; # Zero-extends to 64 bits - print OUT "\tjmp __syscall_common\n"; - print OUT "\t.size ${fname},.-${fname}\n"; - close(OUT); -} - -1; diff --git a/klibc/klibc/asprintf.c b/klibc/klibc/asprintf.c deleted file mode 100644 index 6002b576e1..0000000000 --- a/klibc/klibc/asprintf.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * asprintf.c - */ - -#include -#include -#include - -int asprintf(char **bufp, const char *format, ...) -{ - va_list ap, ap1; - int rv; - int bytes; - char *p; - - va_start(ap, format); - va_copy(ap1, ap); - - bytes = vsnprintf(NULL, 0, format, ap1) + 1; - va_end(ap1); - - *bufp = p = malloc(bytes); - if ( !p ) - return -1; - - rv = vsnprintf(p, bytes, format, ap); - va_end(ap); - - return rv; -} diff --git a/klibc/klibc/assert.c b/klibc/klibc/assert.c deleted file mode 100644 index 6d3ff238c9..0000000000 --- a/klibc/klibc/assert.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * assert.c - */ - -#include -#include -#include - -void __assert_fail(const char *expr, const char *file, unsigned int line) -{ - printf("Assertion %s failed, file %s, line %u\n", expr, file, line); - abort(); -} diff --git a/klibc/klibc/atexit.c b/klibc/klibc/atexit.c deleted file mode 100644 index 078dd8b211..0000000000 --- a/klibc/klibc/atexit.c +++ /dev/null @@ -1,10 +0,0 @@ -/* - * atexit.c - */ - -#include - -int atexit(void (*fctn)(void)) -{ - return on_exit((void (*)(int, void *))fctn, NULL); -} diff --git a/klibc/klibc/atexit.h b/klibc/klibc/atexit.h deleted file mode 100644 index 792141def5..0000000000 --- a/klibc/klibc/atexit.h +++ /dev/null @@ -1,17 +0,0 @@ -/* - * atexit.h - * - * atexit()/on_exit() internal definitions - */ - -#ifndef ATEXIT_H -#define ATEXIT_H - -struct atexit { - void (*fctn)(int, void *); - void *arg; /* on_exit() parameter */ - struct atexit *next; -}; - -#endif /* ATEXIT_H */ - diff --git a/klibc/klibc/atoi.c b/klibc/klibc/atoi.c deleted file mode 100644 index a6ec0bf778..0000000000 --- a/klibc/klibc/atoi.c +++ /dev/null @@ -1,3 +0,0 @@ -#define TYPE int -#define NAME atoi -#include "atox.c" diff --git a/klibc/klibc/atol.c b/klibc/klibc/atol.c deleted file mode 100644 index e65484e7f1..0000000000 --- a/klibc/klibc/atol.c +++ /dev/null @@ -1,3 +0,0 @@ -#define TYPE long -#define NAME atol -#include "atox.c" diff --git a/klibc/klibc/atoll.c b/klibc/klibc/atoll.c deleted file mode 100644 index 25df79e1bf..0000000000 --- a/klibc/klibc/atoll.c +++ /dev/null @@ -1,3 +0,0 @@ -#define TYPE long long -#define NAME atoll -#include "atox.c" diff --git a/klibc/klibc/atox.c b/klibc/klibc/atox.c deleted file mode 100644 index 56f8d93b40..0000000000 --- a/klibc/klibc/atox.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * atox.c - * - * atoi(), atol(), atoll() - */ - -#include -#include -#include - -TYPE NAME (const char *nptr) -{ - return (TYPE) strntoumax(nptr, (char **)NULL, 10, ~(size_t)0); -} diff --git a/klibc/klibc/brk.c b/klibc/klibc/brk.c deleted file mode 100644 index 0a08c4e1c5..0000000000 --- a/klibc/klibc/brk.c +++ /dev/null @@ -1,24 +0,0 @@ -/* brk.c - Change data segment size */ - -/* Written 2000 by Werner Almesberger */ - - -#include -#include -#include - -char *__current_brk; /* Common with sbrk.c */ - -/* - * The Linux brk() isn't what most people expect, so we call the - * system call __brk() and provide a wrapper. - */ -int brk(void *end_data_segment) -{ - char *new_brk; - - new_brk = __brk(end_data_segment); - if (new_brk != end_data_segment) return -1; - __current_brk = new_brk; - return 0; -} diff --git a/klibc/klibc/bsd_signal.c b/klibc/klibc/bsd_signal.c deleted file mode 100644 index 9acc867a36..0000000000 --- a/klibc/klibc/bsd_signal.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * bsd_signal.c - */ - -#include - -__sighandler_t bsd_signal(int signum, __sighandler_t handler) -{ - /* BSD signal() semantics */ - return __signal(signum, handler, SA_RESTART); -} diff --git a/klibc/klibc/calloc.c b/klibc/klibc/calloc.c deleted file mode 100644 index 228a1b70e4..0000000000 --- a/klibc/klibc/calloc.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * calloc.c - */ - -#include -#include - -/* FIXME: This should look for multiplication overflow */ - -void *calloc(size_t nmemb, size_t size) -{ - void *ptr; - - size *= nmemb; - ptr = malloc(size); - if ( ptr ) - memset(ptr, 0, size); - - return ptr; -} - diff --git a/klibc/klibc/closelog.c b/klibc/klibc/closelog.c deleted file mode 100644 index 2359d4f92b..0000000000 --- a/klibc/klibc/closelog.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * closelog.c - */ - -#include -#include - -extern int __syslog_fd; - -void closelog(void) -{ - int logfd = __syslog_fd; - - if ( logfd != -1 ) { - close(logfd); - __syslog_fd = -1; - } -} diff --git a/klibc/klibc/creat.c b/klibc/klibc/creat.c deleted file mode 100644 index 9bd22172d4..0000000000 --- a/klibc/klibc/creat.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * creat.c - */ - -#include -#include -#include - -int creat(const char *pathname, mode_t mode) -{ - return open(pathname, O_CREAT|O_WRONLY|O_TRUNC, mode); -} diff --git a/klibc/klibc/ctypes.c b/klibc/klibc/ctypes.c deleted file mode 100644 index acfa05ab65..0000000000 --- a/klibc/klibc/ctypes.c +++ /dev/null @@ -1,284 +0,0 @@ -/* - * ctypes.c - * - * This is the array that defines classes. - * This assumes ISO 8859-1. - */ - -#include - -const unsigned char __ctypes[257] = { - 0, /* EOF */ - - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl|__ctype_space, /* BS */ - __ctype_cntrl|__ctype_space, /* TAB */ - __ctype_cntrl|__ctype_space, /* LF */ - __ctype_cntrl|__ctype_space, /* VT */ - __ctype_cntrl|__ctype_space, /* FF */ - __ctype_cntrl|__ctype_space, /* CR */ - __ctype_cntrl, /* control character */ - - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - - __ctype_print|__ctype_space, /* space */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_digit|__ctype_xdigit, /* digit */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ - __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ - __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ - __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ - __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ - __ctype_print|__ctype_upper|__ctype_xdigit, /* A-F */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_upper, /* G-Z */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ - __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ - __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ - __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ - __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ - __ctype_print|__ctype_lower|__ctype_xdigit, /* a-f */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_lower, /* g-z */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_cntrl, /* control character */ - - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - __ctype_cntrl, /* control character */ - - __ctype_print|__ctype_space, /* NBSP */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_punct, /* punctuation */ - - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_upper, /* upper accented */ - __ctype_print|__ctype_lower, /* lower accented */ - - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_punct, /* punctuation */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ - __ctype_print|__ctype_lower, /* lower accented */ -}; diff --git a/klibc/klibc/daemon.c b/klibc/klibc/daemon.c deleted file mode 100644 index 75d7146205..0000000000 --- a/klibc/klibc/daemon.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * daemon.c - "daemonize" a process - */ - -#include -#include -#include - -int daemon(int nochdir, int noclose) -{ - int nullfd; - pid_t f; - - if ( !nochdir ) { - if ( chdir("/") ) - return -1; - } - - if ( !noclose ) { - if ( (nullfd = open("/dev/null", O_RDWR)) < 0 || - dup2(nullfd, 0) < 0 || - dup2(nullfd, 1) < 0 || - dup2(nullfd, 2) < 0 ) - return -1; - close(nullfd); - } - - f = fork(); - if ( f < 0 ) - return -1; - else if ( f > 0 ) - _exit(0); - - - return setsid(); -} - - diff --git a/klibc/klibc/exec_l.c b/klibc/klibc/exec_l.c deleted file mode 100644 index cdae11e981..0000000000 --- a/klibc/klibc/exec_l.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * exec_l.c - * - * Common implementation of execl() execle() execlp() - */ - -#include -#include -#include - -int NAME (const char *path, const char *arg0, ...) -{ - va_list ap, cap; - int argc = 1, rv; - const char **argv, **argp; - const char *arg; -#if EXEC_E - char * const * envp; -#else -#define envp environ -#endif - - va_start(ap, arg0); - va_copy(cap, ap); - - /* Count the number of arguments */ - do { - arg = va_arg(cap, const char *); - argc++; - } while ( arg ); - - va_end(cap); - - /* Allocate memory for the pointer array */ - argp = argv = alloca(argc*sizeof(const char *)); - if ( !argv ) { - va_end(ap); - return -1; - } - - /* Copy the list into an array */ - *argp++ = arg0; - do { - *argp++ = arg = va_arg(ap, const char *); - } while ( arg ); - -#if EXEC_E - /* execle() takes one more argument for the environment pointer */ - envp = va_arg(ap, char * const *); -#endif - - rv = (EXEC_P ? execvpe : execve)(path, (char * const *)argv, envp); - - va_end(ap); - - return rv; -} diff --git a/klibc/klibc/execl.c b/klibc/klibc/execl.c deleted file mode 100644 index 4581113ba5..0000000000 --- a/klibc/klibc/execl.c +++ /dev/null @@ -1,8 +0,0 @@ -/* - * execl.c - */ - -#define NAME execl -#define EXEC_P 0 -#define EXEC_E 0 -#include "exec_l.c" diff --git a/klibc/klibc/execle.c b/klibc/klibc/execle.c deleted file mode 100644 index b073988835..0000000000 --- a/klibc/klibc/execle.c +++ /dev/null @@ -1,8 +0,0 @@ -/* - * execle.c - */ - -#define NAME execle -#define EXEC_P 0 -#define EXEC_E 1 -#include "exec_l.c" diff --git a/klibc/klibc/execlp.c b/klibc/klibc/execlp.c deleted file mode 100644 index 65c9aa4a7a..0000000000 --- a/klibc/klibc/execlp.c +++ /dev/null @@ -1,8 +0,0 @@ -/* - * execlp.c - */ - -#define NAME execlp -#define EXEC_P 1 -#define EXEC_E 0 -#include "exec_l.c" diff --git a/klibc/klibc/execlpe.c b/klibc/klibc/execlpe.c deleted file mode 100644 index fef972fcb3..0000000000 --- a/klibc/klibc/execlpe.c +++ /dev/null @@ -1,8 +0,0 @@ -/* - * execlpe.c - */ - -#define NAME execlpe -#define EXEC_P 1 -#define EXEC_E 1 -#include "exec_l.c" diff --git a/klibc/klibc/execv.c b/klibc/klibc/execv.c deleted file mode 100644 index 9856b76d87..0000000000 --- a/klibc/klibc/execv.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * execv.c - */ - -#include -#include - -int execv(const char *path, char * const * argv) -{ - return execve(path, argv, environ); -} - - diff --git a/klibc/klibc/execvp.c b/klibc/klibc/execvp.c deleted file mode 100644 index b1065ee47e..0000000000 --- a/klibc/klibc/execvp.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * execvp.c - */ - -#include -#include - -int execvp(const char *path, char * const * argv) -{ - return execvpe(path, argv, environ); -} - - diff --git a/klibc/klibc/execvpe.c b/klibc/klibc/execvpe.c deleted file mode 100644 index fcd5b6fd4a..0000000000 --- a/klibc/klibc/execvpe.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * execvpe.c - * - * execvpe() function (from which we build execlp, execlpe, execvp). - * - * This version of execvpe() will *not* spawn /bin/sh if the command - * return ENOEXEC. That's what #! is for, folks! - * - * Since execlpe() and execvpe() aren't in POSIX, nor in glibc, - * I have followed QNX precedent in the implementation of the PATH: - * the PATH that is used is the one in the current environment, not - * in the new environment. Otherwise it would be impossible to pass - * a different PATH to the new process than the one one would want to - * use to search. - */ - -#include -#include -#include -#include -#include - -#define DEFAULT_PATH "/bin:/usr/bin:." - -int execvpe(const char *file, char * const *argv, char * const *envp) -{ - char path[PATH_MAX]; - const char *searchpath, *esp; - size_t prefixlen, filelen, totallen; - - if ( strchr(file, '/') ) /* Specific path */ - return execve(file, argv, envp); - - filelen = strlen(file); - - searchpath = getenv("PATH"); - if ( !searchpath ) - searchpath = DEFAULT_PATH; - - errno = ENOENT; /* Default errno, if execve() doesn't change it */ - - do { - esp = strchr(searchpath, ':'); - if ( esp ) - prefixlen = esp-searchpath; - else - prefixlen = strlen(searchpath); - - if ( prefixlen == 0 || searchpath[prefixlen-1] == '/' ) { - totallen = prefixlen+filelen; - if ( totallen >= PATH_MAX ) - continue; - memcpy(path, searchpath, prefixlen); - memcpy(path+prefixlen, file, filelen); - } else { - totallen = prefixlen+filelen+1; - if ( totallen >= PATH_MAX ) - continue; - memcpy(path, searchpath, prefixlen); - path[prefixlen] = '/'; - memcpy(path+prefixlen+1, file, filelen); - } - path[totallen] = '\0'; - - execve(path, argv, envp); - if ( errno == E2BIG || errno == ENOEXEC || - errno == ENOMEM || errno == ETXTBSY ) - break; /* Report this as an error, no more search */ - - searchpath = esp+1; - } while ( esp ); - - return -1; -} - diff --git a/klibc/klibc/exitc.c b/klibc/klibc/exitc.c deleted file mode 100644 index 8819737fb7..0000000000 --- a/klibc/klibc/exitc.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * exit.c - * - * Implement exit() - */ - -#include -#include -#include - -/* We have an assembly version for i386 and x86-64 */ - -#if !defined(__i386__) && !defined(__x86_64__) - -/* This allows atexit/on_exit to install a hook */ -__noreturn (*__exit_handler)(int) = _exit; - -__noreturn exit(int rv) -{ - __exit_handler(rv); -} - -#endif diff --git a/klibc/klibc/fgetc.c b/klibc/klibc/fgetc.c deleted file mode 100644 index 83eee16f61..0000000000 --- a/klibc/klibc/fgetc.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * fgetc.c - * - * Extremely slow fgetc implementation, using _fread(). If people - * actually need character-oriented input to be fast, we may actually - * have to implement buffering. Sigh. - */ - -#include -#include -#include -#include - -int fgetc(FILE *f) -{ - unsigned char ch; - - return (_fread(&ch, 1, f) == 1) ? (int)ch : EOF; -} - diff --git a/klibc/klibc/fgets.c b/klibc/klibc/fgets.c deleted file mode 100644 index 72f8a13cf1..0000000000 --- a/klibc/klibc/fgets.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * fgets.c - * - * This will be very slow due to the implementation of getc(), - * but we can't afford to drain characters we don't need from - * the input. - */ - -#include - -char *fgets(char *s, int n, FILE *f) -{ - int ch; - char *p = s; - - while ( n > 1 ) { - ch = getc(f); - if ( ch == EOF ) { - *p = '\0'; - return NULL; - } - *p++ = ch; - n--; - if ( ch == '\n' ) - break; - } - if ( n ) - *p = '\0'; - - return s; -} - - - diff --git a/klibc/klibc/fopen.c b/klibc/klibc/fopen.c deleted file mode 100644 index ee62c68bd7..0000000000 --- a/klibc/klibc/fopen.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * fopen.c - */ - -#include -#include -#include - -/* This depends on O_RDONLY == 0, O_WRONLY == 1, O_RDWR == 2 */ - - -FILE *fopen(const char *file, const char *mode) -{ - int flags = O_RDONLY; - int plus = 0; - - while ( *mode ) { - switch ( *mode++ ) { - case 'r': - flags = O_RDONLY; - break; - case 'w': - flags = O_WRONLY|O_CREAT|O_TRUNC; - break; - case 'a': - flags = O_WRONLY|O_CREAT|O_APPEND; - break; - case '+': - plus = 1; - break; - } - } - - if ( plus ) { - flags = (flags & ~(O_RDONLY|O_WRONLY)) | O_RDWR; - } - - /* Note: __create_file(-1) == NULL, so this is safe */ - return __create_file(open(file, flags, 0666)); -} diff --git a/klibc/klibc/fork.c b/klibc/klibc/fork.c deleted file mode 100644 index fcd73bd60b..0000000000 --- a/klibc/klibc/fork.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * fork.c - * - * This is normally just a syscall stub, but at least one system - * doesn't have sys_fork, only sys_clone... - */ - -#include -#include -#include -#include - -#ifndef __NR_fork - -pid_t fork(void) -{ - return __clone(SIGCHLD, 0); -} - -#endif /* __NR_fork */ diff --git a/klibc/klibc/fprintf.c b/klibc/klibc/fprintf.c deleted file mode 100644 index df3823eac3..0000000000 --- a/klibc/klibc/fprintf.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * fprintf.c - */ - -#include -#include - -#define BUFFER_SIZE 16384 - -int fprintf(FILE *file, const char *format, ...) -{ - va_list ap; - int rv; - - va_start(ap, format); - rv = vfprintf(file, format, ap); - va_end(ap); - return rv; -} diff --git a/klibc/klibc/fputc.c b/klibc/klibc/fputc.c deleted file mode 100644 index 61aff1644b..0000000000 --- a/klibc/klibc/fputc.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * fputc.c - * - * gcc "printf decompilation" expects this to exist... - */ - -#include - -int fputc(int c, FILE *f) -{ - unsigned char ch = c; - - return _fwrite(&ch, 1, f) == 1 ? ch : EOF; -} diff --git a/klibc/klibc/fputs.c b/klibc/klibc/fputs.c deleted file mode 100644 index 4b68f96886..0000000000 --- a/klibc/klibc/fputs.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * fputs.c - * - * This isn't quite fputs() in the stdio sense, since we don't - * have stdio, but it takes a file descriptor argument instead - * of the FILE *. - */ - -#include -#include - -int fputs(const char *s, FILE *file) -{ - return _fwrite(s, strlen(s), file); -} diff --git a/klibc/klibc/fread.c b/klibc/klibc/fread.c deleted file mode 100644 index a49f0d8210..0000000000 --- a/klibc/klibc/fread.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * fread.c - */ - -#include -#include -#include - -size_t _fread(void *buf, size_t count, FILE *f) -{ - size_t bytes = 0; - ssize_t rv; - char *p = buf; - - while ( count ) { - rv = read(fileno(f), p, count); - if ( rv == -1 ) { - if ( errno == EINTR ) { - errno = 0; - continue; - } else - break; - } else if ( rv == 0 ) { - break; - } - - p += rv; - bytes += rv; - count -= rv; - } - - return bytes; -} - - - diff --git a/klibc/klibc/fread2.c b/klibc/klibc/fread2.c deleted file mode 100644 index 9e5ac81fc2..0000000000 --- a/klibc/klibc/fread2.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * fread2.c - * - * The actual fread() function as a non-inline - */ - -#define __NO_FREAD_FWRITE_INLINES -#include - -size_t fread(void *ptr, size_t size, size_t nmemb, FILE *f) -{ - return _fread(ptr, size*nmemb, f)/size; -} diff --git a/klibc/klibc/fstatfs.c b/klibc/klibc/fstatfs.c deleted file mode 100644 index 09e4674947..0000000000 --- a/klibc/klibc/fstatfs.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * fstatfs.c - * - * On architectures which do fstatfs64, wrap the system call - */ - -#include -#include - -#ifdef __NR_fstatfs64 - -extern int __fstatfs64(int, size_t, struct statfs *); - -int fstatfs(int fd, struct statfs *buf) -{ - return __fstatfs64(fd, sizeof *buf, buf); -} - -#endif diff --git a/klibc/klibc/fwrite.c b/klibc/klibc/fwrite.c deleted file mode 100644 index ad61c86b88..0000000000 --- a/klibc/klibc/fwrite.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * fwrite.c - */ - -#include -#include -#include - -size_t _fwrite(const void *buf, size_t count, FILE *f) -{ - size_t bytes = 0; - ssize_t rv; - const char *p = buf; - - while ( count ) { - rv = write(fileno(f), p, count); - if ( rv == -1 ) { - if ( errno == EINTR ) { - errno = 0; - continue; - } else - break; - } else if ( rv == 0 ) { - break; - } - - p += rv; - bytes += rv; - count -= rv; - } - - return bytes; -} - - - diff --git a/klibc/klibc/fwrite2.c b/klibc/klibc/fwrite2.c deleted file mode 100644 index 82ec832be4..0000000000 --- a/klibc/klibc/fwrite2.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * fwrite2.c - * - * The actual fwrite() function as a non-inline - */ - -#define __NO_FREAD_FWRITE_INLINES -#include - -size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *f) -{ - return _fwrite(ptr, size*nmemb, f)/size; -} diff --git a/klibc/klibc/getcwd.c b/klibc/klibc/getcwd.c deleted file mode 100644 index 613ca0529c..0000000000 --- a/klibc/klibc/getcwd.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * getcwd.c - * - * The system call behaves differently than the library function. - */ - -#include -#include - -extern int __getcwd(char * buf, size_t size); - -char *getcwd(char *buf, size_t size) -{ - return ( __getcwd(buf, size) < 0 ) ? NULL : buf; -} - diff --git a/klibc/klibc/getdomainname.c b/klibc/klibc/getdomainname.c deleted file mode 100644 index 4cd68a3cb5..0000000000 --- a/klibc/klibc/getdomainname.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * getdomainname.c - */ - -#include -#include -#include -#include - -int getdomainname(char *name, size_t len) -{ - struct utsname un; - - if ( !uname(&un) ) - return -1; - - if ( len < strlen(un.domainname)+1 ) { - errno = EINVAL; - return -1; - } - - strcpy(name, un.domainname); - - return 0; -} diff --git a/klibc/klibc/getenv.c b/klibc/klibc/getenv.c deleted file mode 100644 index 84fc94c00e..0000000000 --- a/klibc/klibc/getenv.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * getenv.c - */ - -#include -#include -#include - -char *getenv(const char *name) -{ - char **p, *q; - int len = strlen(name); - - for ( p = environ ; (q = *p) ; p++ ) { - if ( !strncmp(name, q, len) && q[len] == '=' ) { - return q+(len+1); - } - } - - return NULL; -} - diff --git a/klibc/klibc/gethostname.c b/klibc/klibc/gethostname.c deleted file mode 100644 index 6c5062e816..0000000000 --- a/klibc/klibc/gethostname.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * gethostname.c - */ - -#include -#include -#include -#include - -int gethostname(char *name, size_t len) -{ - struct utsname un; - - if ( !uname(&un) ) - return -1; - - if ( len < strlen(un.nodename)+1 ) { - errno = EINVAL; - return -1; - } - - strcpy(name, un.nodename); - - return 0; -} diff --git a/klibc/klibc/getopt.c b/klibc/klibc/getopt.c deleted file mode 100644 index cd534bf304..0000000000 --- a/klibc/klibc/getopt.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * getopt.c - * - * Simple POSIX getopt(), no GNU extensions... - */ - -#include -#include -#include - -char *optarg; -int optind = 1; -int opterr, optopt; -static const char *__optptr; - -int getopt(int argc, char * const *argv, const char *optstring) -{ - const char *carg = argv[optind]; - const char *osptr; - int opt; - - /* We don't actually need argc */ - (void)argc; - - /* First, eliminate all non-option cases */ - - if ( !carg || carg[0] != '-' || !carg[1] ) { - return -1; - } - - if ( carg[1] == '-' && !carg[2] ) { - optind++; - return -1; - } - - if ( (uintptr_t)(__optptr-carg) > (uintptr_t)strlen(carg) ) - __optptr = carg+1; /* Someone frobbed optind, change to new opt. */ - - opt = *__optptr++; - - if ( opt != ':' && (osptr = strchr(optstring, opt)) ) { - if ( osptr[1] == ':' ) { - if ( *__optptr ) { - /* Argument-taking option with attached argument */ - optarg = (char *)__optptr; - optind++; - } else { - /* Argument-taking option with non-attached argument */ - if ( argv[optind+1] ) { - optarg = (char *)argv[optind+1]; - optind += 2; - } else { - /* Missing argument */ - optind++; - return (optstring[0] == ':') ? ':' : '?'; - } - } - return opt; - } else { - /* Non-argument-taking option */ - /* __optptr will remember the exact position to resume at */ - if ( ! *__optptr ) - optind++; - return opt; - } - } else { - /* Unknown option */ - optopt = opt; - if ( ! *__optptr ) - optind++; - return '?'; - } -} - - diff --git a/klibc/klibc/getpgrp.c b/klibc/klibc/getpgrp.c deleted file mode 100644 index c92369807b..0000000000 --- a/klibc/klibc/getpgrp.c +++ /dev/null @@ -1,9 +0,0 @@ -/* - * getpgrp.c - */ - -#include - -pid_t getpgrp(void) { - return getpgid(0); -} diff --git a/klibc/klibc/getpriority.c b/klibc/klibc/getpriority.c deleted file mode 100644 index 4ea630487d..0000000000 --- a/klibc/klibc/getpriority.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * getpriority.c - * - * Needs to do some post-syscall mangling to distinguish error returns... - * but only on some platforms. Sigh. - */ - -#include -#include -#include -#include - -#if !defined(__alpha__) && !defined(__ia64__) - -extern int __getpriority(int, int); - -int getpriority(int which, int who) -{ - int rv = __getpriority(which, who); - return ( rv < 0 ) ? rv : 20-rv; -} - -#endif diff --git a/klibc/klibc/getpt.c b/klibc/klibc/getpt.c deleted file mode 100644 index a05903062c..0000000000 --- a/klibc/klibc/getpt.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * getpt.c - * - * GNU extension to the standard Unix98 pty suite - */ - -#include -#include -#include -#include -#include -#include - -int getpt(void) -{ - return open("/dev/ptmx", O_RDWR|O_NOCTTY); -} diff --git a/klibc/klibc/globals.c b/klibc/klibc/globals.c deleted file mode 100644 index 72ae91fbad..0000000000 --- a/klibc/klibc/globals.c +++ /dev/null @@ -1,10 +0,0 @@ -/* - * globals.c - * - * These have to be defined somewhere... - */ -#include -#include - -int errno; -char **environ; diff --git a/klibc/klibc/inet/bindresvport.c b/klibc/klibc/inet/bindresvport.c deleted file mode 100644 index 750bd709c4..0000000000 --- a/klibc/klibc/inet/bindresvport.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * inet/bindresvport.c - */ - -#include -#include -#include -#include -#include -#include - -#define START_PORT 768 -#define END_PORT IPPORT_RESERVED -#define NUM_PORTS (END_PORT - START_PORT) - -int bindresvport(int sd, struct sockaddr_in *sin) -{ - struct sockaddr_in me; - static short port; - int ret = 0; - int i; - - if (sin == NULL) { - memset(&me, 0, sizeof(me)); - sin = &me; - sin->sin_family = AF_INET; - } else if (sin->sin_family != AF_INET) { - errno = EPFNOSUPPORT; - return -1; - } - - if (port == 0) { - port = START_PORT + (getpid() % NUM_PORTS); - } - - for (i = 0; i < NUM_PORTS; i++, port++) { - if (port == END_PORT) - port = START_PORT; - sin->sin_port = htons(port); - if ((ret = bind(sd, (struct sockaddr *)sin, sizeof(*sin))) != -1) - break; - } - - return ret; -} diff --git a/klibc/klibc/inet/inet_addr.c b/klibc/klibc/inet/inet_addr.c deleted file mode 100644 index e04a4d0214..0000000000 --- a/klibc/klibc/inet/inet_addr.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * inet/inet_addr.c - */ - -#include -#include - -uint32_t inet_addr(const char *str) -{ - struct in_addr a; - int rv = inet_aton(str, &a); - - return rv ? INADDR_NONE : a.s_addr; -} diff --git a/klibc/klibc/inet/inet_aton.c b/klibc/klibc/inet/inet_aton.c deleted file mode 100644 index e581b492ad..0000000000 --- a/klibc/klibc/inet/inet_aton.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * inet/inet_aton.c - */ - -#include -#include - -int inet_aton(const char *str, struct in_addr *addr) -{ - union { - uint8_t b[4]; - uint32_t l; - } a; - - if ( sscanf(str, "%hhu.%hhu.%hhu.%hhu", &a.b[0], &a.b[1], &a.b[2], &a.b[3]) == 4 ) { - addr->s_addr = a.l; /* Always in network byte order */ - return 1; - } else { - return 0; - } -} - - diff --git a/klibc/klibc/inet/inet_ntoa.c b/klibc/klibc/inet/inet_ntoa.c deleted file mode 100644 index 5340aa622a..0000000000 --- a/klibc/klibc/inet/inet_ntoa.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * inet/inet_ntoa.c - */ - -#include -#include - -char *inet_ntoa(struct in_addr addr) -{ - static char name[16]; - union { - uint8_t b[4]; - uint32_t l; - } a; - a.l = addr.s_addr; - - sprintf(name, "%u.%u.%u.%u", a.b[0], a.b[1], a.b[2], a.b[3]); - return name; -} diff --git a/klibc/klibc/inet/inet_ntop.c b/klibc/klibc/inet/inet_ntop.c deleted file mode 100644 index 377bab7bf2..0000000000 --- a/klibc/klibc/inet/inet_ntop.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * inet/inet_ntop.c - */ - -#include -#include -#include -#include -#include - -const char *inet_ntop(int af, const void *cp, char *buf, size_t len) -{ - size_t xlen; - - switch ( af ) { - case AF_INET: - { - union { - uint8_t b[4]; - uint32_t l; - } a; - a.l = ((const struct in_addr *)cp)->s_addr; - - xlen = snprintf(buf, len, "%u.%u.%u.%u", a.b[0], a.b[1], a.b[2], a.b[3]); - } - break; - - case AF_INET6: - { - const struct in6_addr *s = (const struct in6_addr *)cp; - - xlen = snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x", - ntohs(s->s6_addr16[0]), ntohs(s->s6_addr16[1]), - ntohs(s->s6_addr16[2]), ntohs(s->s6_addr16[3]), - ntohs(s->s6_addr16[4]), ntohs(s->s6_addr16[5]), - ntohs(s->s6_addr16[6]), ntohs(s->s6_addr16[7])); - } - break; - - default: - errno = EAFNOSUPPORT; - return NULL; - } - - if ( xlen > len ) { - errno = ENOSPC; - return NULL; - } - - return buf; -} - diff --git a/klibc/klibc/inet/inet_pton.c b/klibc/klibc/inet/inet_pton.c deleted file mode 100644 index 6c14b3cfb6..0000000000 --- a/klibc/klibc/inet/inet_pton.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * inet/inet_pton.c - */ - -#include -#include -#include -#include -#include -#include -#include - -static inline int hexval(int ch) -{ - if ( ch >= '0' && ch <= '9' ) { - return ch-'0'; - } else if ( ch >= 'A' && ch <= 'F' ) { - return ch-'A'+10; - } else if ( ch >= 'a' && ch <= 'f' ) { - return ch-'a'+10; - } else { - return -1; - } -} - -int inet_pton(int af, const char *src, void *dst) -{ - switch ( af ) { - case AF_INET: - return inet_aton(src, (struct in_addr *)dst); - - case AF_INET6: - { - struct in6_addr *d = (struct in6_addr *)dst; - int colons = 0, dcolons = 0; - int i; - const char *p; - - /* A double colon will increment colons by 2, dcolons by 1 */ - for ( p = dst ; *p ; p++ ) { - if ( p[0] == ':' ) { - colons++; - if ( p[1] == ':' ) - dcolons++; - } else if ( !isxdigit(*p) ) - return 0; /* Not a valid address */ - } - - if ( colons > 7 || dcolons > 1 || (!dcolons && colons != 7) ) - return 0; /* Not a valid address */ - - memset(d, 0, sizeof(struct in6_addr)); - - i = 0; - for ( p = dst ; *p ; p++ ) { - if ( *p == ':' ) { - if ( p[1] == ':' ) { - i += (8-colons); - } else { - i++; - } - } else { - d->s6_addr16[i] = htons((ntohs(d->s6_addr16[i]) << 4) + hexval(*p)); - } - } - - return 1; - } - - default: - errno = EAFNOSUPPORT; - return -1; - } -} diff --git a/klibc/klibc/interp.S b/klibc/klibc/interp.S deleted file mode 100644 index b1a2701999..0000000000 --- a/klibc/klibc/interp.S +++ /dev/null @@ -1,13 +0,0 @@ -# -# This is a hack to generate the .intrp section, which then -# ld turns into an PT_INTERP header. -# -# NOTE: The .interp section needs to be "a", or it doesnt work... -# - - .section ".interp","a" - .ascii LIBDIR - .ascii "/klibc-" - .ascii SOHASH - .ascii ".so" - .byte 0 diff --git a/klibc/klibc/isatty.c b/klibc/klibc/isatty.c deleted file mode 100644 index ff5e1ff748..0000000000 --- a/klibc/klibc/isatty.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * isatty.c - */ - -#include -#include -#include - -int isatty(int fd) -{ - int old_errno = errno; - int istty; - pid_t dummy; - - /* All ttys support TIOCGPGRP */ - istty = !ioctl(fd, TIOCGPGRP, &dummy); - errno = old_errno; - - return istty; -} - diff --git a/klibc/klibc/jrand48.c b/klibc/klibc/jrand48.c deleted file mode 100644 index 660a6e5a71..0000000000 --- a/klibc/klibc/jrand48.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * jrand48.c - */ - -#include -#include - -long jrand48(unsigned short xsubi[3]) -{ - uint64_t x; - - /* The xsubi[] array is littleendian by spec */ - x = (uint64_t)(uint16_t)xsubi[0] + - ((uint64_t)(uint16_t)xsubi[1] << 16) + - ((uint64_t)(uint16_t)xsubi[2] << 32); - - x = (0x5deece66dULL * x) + 0xb; - - xsubi[0] = (unsigned short)(uint16_t)x; - xsubi[1] = (unsigned short)(uint16_t)(x >> 16); - xsubi[2] = (unsigned short)(uint16_t)(x >> 32); - - return (long)(int32_t)(x >> 16); -} diff --git a/klibc/klibc/libc_init.c b/klibc/klibc/libc_init.c deleted file mode 100644 index e91edc44a3..0000000000 --- a/klibc/klibc/libc_init.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * libc_init.c - * - * This function takes the raw data block set up by the ELF loader - * in the kernel and parses it. It is invoked by crt0.S which makes - * any necessary adjustments and passes calls this function using - * the standard C calling convention. - * - * The arguments are: - * uintptr_t *elfdata -- The ELF loader data block; usually from the stack. - * Basically a pointer to argc. - * void (*onexit)(void) -- Function to install into onexit - */ - -#include -#include -#include -#include -#include - -/* This file is included from __static_init.c or __shared_init.c */ -#ifndef SHARED -# error "SHARED should be defined to 0 or 1" -#endif - -char **environ; -unsigned int __page_size, __page_shift; - -struct auxentry { - uintptr_t type; - uintptr_t v; -}; - -__noreturn __libc_init(uintptr_t *elfdata, void (*onexit)(void)) -{ - int argc; - char **argv, **envp, **envend; - struct auxentry *auxentry; -#if SHARED - typedef int (*main_t)(int, char **, char **); - main_t MAIN = NULL; -#else - extern int main(int, char **, char **); -#define MAIN main -#endif - unsigned int page_size = 0, page_shift = 0; - - (void)onexit; /* For now, we ignore this... */ - - argc = (int)*elfdata++; - argv = (char **)elfdata; - envp = argv+(argc+1); - - /* The auxillary entry vector is after all the environment vars */ - for ( envend = envp ; *envend ; envend++ ); - auxentry = (struct auxentry *)(envend+1); - - while ( auxentry->type ) { - switch ( auxentry->type ) { -#if SHARED - case AT_ENTRY: - MAIN = (main_t)(auxentry->v); - break; -#endif - case AT_PAGESZ: - page_size = (int)(auxentry->v); - break; - } - auxentry++; - } - - __page_size = page_size; - -#if defined(__i386__) || defined(__x86_64__) - asm("bsrl %1,%0" : "=r" (page_shift) : "rm" (page_size)); -#else - while ( page_size > 1 ) { - page_shift++; - page_size >>= 1; - } -#endif - __page_shift = page_shift; - - environ = envp; - exit(MAIN(argc, argv, envp)); -} diff --git a/klibc/klibc/libgcc/__divdi3.c b/klibc/klibc/libgcc/__divdi3.c deleted file mode 100644 index be13caed7e..0000000000 --- a/klibc/klibc/libgcc/__divdi3.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * arch/i386/libgcc/__divdi3.c - */ - -#include -#include - -extern uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem); - -int64_t __divdi3(int64_t num, int64_t den) -{ - int minus = 0; - int64_t v; - - if ( num < 0 ) { - num = -num; - minus = 1; - } - if ( den < 0 ) { - den = -den; - minus ^= 1; - } - - v = __udivmoddi4(num, den, NULL); - if ( minus ) - v = -v; - - return v; -} diff --git a/klibc/klibc/libgcc/__divsi3.c b/klibc/klibc/libgcc/__divsi3.c deleted file mode 100644 index 24a7e044c8..0000000000 --- a/klibc/klibc/libgcc/__divsi3.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * libgcc/__divsi3.c - */ - -#include -#include - -extern uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem); - -int32_t __divsi3(int32_t num, int32_t den) -{ - int minus = 0; - int32_t v; - - if ( num < 0 ) { - num = -num; - minus = 1; - } - if ( den < 0 ) { - den = -den; - minus ^= 1; - } - - v = __udivmodsi4(num, den, NULL); - if ( minus ) - v = -v; - - return v; -} diff --git a/klibc/klibc/libgcc/__moddi3.c b/klibc/klibc/libgcc/__moddi3.c deleted file mode 100644 index 3e613654e4..0000000000 --- a/klibc/klibc/libgcc/__moddi3.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * arch/i386/libgcc/__moddi3.c - */ - -#include -#include - -extern uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem); - -int64_t __moddi3(int64_t num, int64_t den) -{ - int minus = 0; - int64_t v; - - if ( num < 0 ) { - num = -num; - minus = 1; - } - if ( den < 0 ) { - den = -den; - minus ^= 1; - } - - (void) __udivmoddi4(num, den, &v); - if ( minus ) - v = -v; - - return v; -} diff --git a/klibc/klibc/libgcc/__modsi3.c b/klibc/klibc/libgcc/__modsi3.c deleted file mode 100644 index cf62b8b556..0000000000 --- a/klibc/klibc/libgcc/__modsi3.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * libgcc/__modsi3.c - */ - -#include -#include - -extern uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem); - -int32_t __modsi3(int32_t num, int32_t den) -{ - int minus = 0; - int32_t v; - - if ( num < 0 ) { - num = -num; - minus = 1; - } - if ( den < 0 ) { - den = -den; - minus ^= 1; - } - - (void) __udivmodsi4(num, den, &v); - if ( minus ) - v = -v; - - return v; -} diff --git a/klibc/klibc/libgcc/__udivdi3.c b/klibc/klibc/libgcc/__udivdi3.c deleted file mode 100644 index 901ce2aea6..0000000000 --- a/klibc/klibc/libgcc/__udivdi3.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * arch/i386/libgcc/__divdi3.c - */ - -#include -#include - -extern uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem); - -uint64_t __udivdi3(uint64_t num, uint64_t den) -{ - return __udivmoddi4(num, den, NULL); -} diff --git a/klibc/klibc/libgcc/__udivmoddi4.c b/klibc/klibc/libgcc/__udivmoddi4.c deleted file mode 100644 index 1c456543be..0000000000 --- a/klibc/klibc/libgcc/__udivmoddi4.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem_p) -{ - uint64_t quot = 0, qbit = 1; - - if ( den == 0 ) { - __divide_error(); - return 0; /* If trap returns... */ - } - - /* Left-justify denominator and count shift */ - while ( (int64_t)den >= 0 ) { - den <<= 1; - qbit <<= 1; - } - - while ( qbit ) { - if ( den <= num ) { - num -= den; - quot += qbit; - } - den >>= 1; - qbit >>= 1; - } - - if ( rem_p ) - *rem_p = num; - - return quot; -} diff --git a/klibc/klibc/libgcc/__udivmodsi4.c b/klibc/klibc/libgcc/__udivmodsi4.c deleted file mode 100644 index 61f6bef0a4..0000000000 --- a/klibc/klibc/libgcc/__udivmodsi4.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include - -uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem_p) -{ - uint32_t quot = 0, qbit = 1; - - if ( den == 0 ) { - __divide_error(); - return 0; /* If trap returns... */ - } - - /* Left-justify denominator and count shift */ - while ( (int32_t)den >= 0 ) { - den <<= 1; - qbit <<= 1; - } - - while ( qbit ) { - if ( den <= num ) { - num -= den; - quot += qbit; - } - den >>= 1; - qbit >>= 1; - } - - if ( rem_p ) - *rem_p = num; - - return quot; -} diff --git a/klibc/klibc/libgcc/__udivsi3.c b/klibc/klibc/libgcc/__udivsi3.c deleted file mode 100644 index cba6f8f03d..0000000000 --- a/klibc/klibc/libgcc/__udivsi3.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * libgcc/__divsi3.c - */ - -#include -#include - -extern uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem); - -uint32_t __udivsi3(uint32_t num, uint32_t den) -{ - return __udivmodsi4(num, den, NULL); -} diff --git a/klibc/klibc/libgcc/__umoddi3.c b/klibc/klibc/libgcc/__umoddi3.c deleted file mode 100644 index c007d4859f..0000000000 --- a/klibc/klibc/libgcc/__umoddi3.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * arch/i386/libgcc/__umoddi3.c - */ - -#include -#include - -extern uint64_t __udivmoddi4(uint64_t num, uint64_t den, uint64_t *rem); - -uint64_t __umoddi3(uint64_t num, uint64_t den) -{ - uint64_t v; - - (void) __udivmoddi4(num, den, &v); - return v; -} diff --git a/klibc/klibc/libgcc/__umodsi3.c b/klibc/klibc/libgcc/__umodsi3.c deleted file mode 100644 index e3db972c4e..0000000000 --- a/klibc/klibc/libgcc/__umodsi3.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * libgcc/__umodsi3.c - */ - -#include -#include - -extern uint32_t __udivmodsi4(uint32_t num, uint32_t den, uint32_t *rem); - -uint32_t __umodsi3(uint32_t num, uint32_t den) -{ - uint32_t v; - - (void) __udivmodsi4(num, den, &v); - return v; -} diff --git a/klibc/klibc/llseek.c b/klibc/klibc/llseek.c deleted file mode 100644 index 857490b378..0000000000 --- a/klibc/klibc/llseek.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * llseek.c - * - * On 32-bit platforms, we need to use the _llseek() system call - * rather than lseek(), to be able to handle large disks. _llseek() - * isn't just a normal syscall which takes a 64-bit argument; it needs - * to return a 64-bit value and so takes an extra pointer. - */ - -#include -#include -#include - -#if _BITSIZE == 32 - -extern int __llseek(int fd, unsigned long hi, unsigned long lo, off_t *res, int whence); - -off_t lseek(int fd, off_t offset, int whence) -{ - off_t result; - int rv; - - rv = __llseek(fd, (unsigned long)(offset >> 32), (unsigned long)offset, - &result, whence); - - return rv ? (off_t)-1 : result; -} - -#endif - diff --git a/klibc/klibc/lrand48.c b/klibc/klibc/lrand48.c deleted file mode 100644 index 8c0a3de176..0000000000 --- a/klibc/klibc/lrand48.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * lrand48.c - */ - -#include -#include - -unsigned short __rand48_seed[3]; /* Common with mrand48.c, srand48.c */ - -long lrand48(void) -{ - return (uint32_t)jrand48(__rand48_seed) >> 1; -} - diff --git a/klibc/klibc/makeerrlist.pl b/klibc/klibc/makeerrlist.pl deleted file mode 100644 index 14498d880a..0000000000 --- a/klibc/klibc/makeerrlist.pl +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/perl -# -# This creates sys_errlist from through somewhat -# heuristic matching. It presumes the relevant entries are of the form -# #define Exxxx /* comment */ -# - -use FileHandle; - -%errors = (); -%errmsg = (); -$maxerr = -1; -@includelist = (); # Include directories - -sub parse_file($) { - my($file) = @_; - my($fh) = new FileHandle; - my($line, $error, $msg); - my($kernelonly) = 0; - my($root); - - print STDERR "opening $file\n" unless ( $quiet ); - - $ok = 0; - foreach $root ( @includelist ) { - if ( $fh->open($root.'//'.$file, '<') ) { - $ok = 1; - last; - } - } - - if ( ! $ok ) { - die "$0: Cannot find file $file\n"; - } - - while ( defined($line = <$fh>) ) { - if ( $kernelonly ) { - if ( $line =~ /^\#\s*endif/ ) { - $kernelonly--; - } elsif ( $line =~ /^\#\sif/ ) { - $kernelonly++; - } - } else { - if ( $line =~ /^\#\s*define\s+([A-Z0-9_]+)\s+([0-9]+)\s*\/\*\s*(.*\S)\s*\*\// ) { - $error = $1; - $errno = $2+0; - $msg = $3; - print STDERR "$error ($errno) => \"$msg\"\n" unless ( $quiet ); - $errors{$errno} = $error; - $errmsg{$errno} = $msg; - $maxerr = $errno if ( $errno > $maxerr ); - } elsif ( $line =~ /^\#\s*include\s+[\<\"](.*)[\>\"]/ ) { - parse_file($1); - } elsif ( $line =~ /^\#\s*ifdef\s+__KERNEL__/ ) { - $kernelonly++; - } - } - } - close($fh); - print STDERR "closing $file\n" unless ( $quiet ); -} - -$v = $ENV{'KBUILD_VERBOSE'}; -$quiet = defined($v) ? !$v : 0; - -foreach $arg ( @ARGV ) { - if ( $arg eq '-q' ) { - $quiet = 1; - } elsif ( $arg =~ /^-(errlist|errnos|maxerr)$/ ) { - $type = $arg; - } elsif ( $arg =~ '^\-I' ) { - push(@includelist, "$'"); - } else { - die "$0: Unknown option: $arg\n"; - } -} - -parse_file('linux/errno.h'); - -if ( $type eq '-errlist' ) { - print "#include \n"; - printf "const int sys_nerr = %d;\n", $maxerr+1; - printf "const char * const sys_errlist[%d] = {\n", $maxerr+1; - foreach $e ( sort(keys(%errors)) ) { - printf " [%s] = \"%s\",\n", $errors{$e}, $errmsg{$e}; - } - print "};\n"; -} elsif ( $type eq '-errnos' ) { - print "#include \n"; - printf "const int sys_nerr = %d;\n", $maxerr+1; - printf "const char * const sys_errlist[%d] = {\n", $maxerr+1; - foreach $e ( sort(keys(%errors)) ) { - printf " [%s] = \"%s\",\n", $errors{$e}, $errors{$e}; - } - print "};\n"; -} elsif ( $type eq '-maxerr' ) { - print $maxerr, "\n"; -} - - diff --git a/klibc/klibc/malloc.c b/klibc/klibc/malloc.c deleted file mode 100644 index 976353c201..0000000000 --- a/klibc/klibc/malloc.c +++ /dev/null @@ -1,197 +0,0 @@ -/* - * malloc.c - * - * Very simple linked-list based malloc()/free(). - */ - -#include -#include -#include "malloc.h" - -struct free_arena_header __malloc_head = -{ - { - ARENA_TYPE_HEAD, - 0, - &__malloc_head, - &__malloc_head, - }, - &__malloc_head, - &__malloc_head -}; - -static void *__malloc_from_block(struct free_arena_header *fp, size_t size) -{ - size_t fsize; - struct free_arena_header *nfp, *na; - - fsize = fp->a.size; - - /* We need the 2* to account for the larger requirements of a free block */ - if ( fsize >= size+2*sizeof(struct arena_header) ) { - /* Bigger block than required -- split block */ - nfp = (struct free_arena_header *)((char *)fp + size); - na = fp->a.next; - - nfp->a.type = ARENA_TYPE_FREE; - nfp->a.size = fsize-size; - fp->a.type = ARENA_TYPE_USED; - fp->a.size = size; - - /* Insert into all-block chain */ - nfp->a.prev = fp; - nfp->a.next = na; - na->a.prev = nfp; - fp->a.next = nfp; - - /* Replace current block on free chain */ - nfp->next_free = fp->next_free; - nfp->prev_free = fp->prev_free; - fp->next_free->prev_free = nfp; - fp->prev_free->next_free = nfp; - } else { - /* Allocate the whole block */ - fp->a.type = ARENA_TYPE_USED; - - /* Remove from free chain */ - fp->next_free->prev_free = fp->prev_free; - fp->prev_free->next_free = fp->next_free; - } - - return (void *)(&fp->a + 1); -} - -static struct free_arena_header * -__free_block(struct free_arena_header *ah) -{ - struct free_arena_header *pah, *nah; - - pah = ah->a.prev; - nah = ah->a.next; - if ( pah->a.type == ARENA_TYPE_FREE && - (char *)pah+pah->a.size == (char *)ah ) { - /* Coalesce into the previous block */ - pah->a.size += ah->a.size; - pah->a.next = nah; - nah->a.prev = pah; - -#ifdef DEBUG_MALLOC - ah->a.type = ARENA_TYPE_DEAD; -#endif - - ah = pah; - pah = ah->a.prev; - } else { - /* Need to add this block to the free chain */ - ah->a.type = ARENA_TYPE_FREE; - - ah->next_free = __malloc_head.next_free; - ah->prev_free = &__malloc_head; - __malloc_head.next_free = ah; - ah->next_free->prev_free = ah; - } - - /* In either of the previous cases, we might be able to merge - with the subsequent block... */ - if ( nah->a.type == ARENA_TYPE_FREE && - (char *)ah+ah->a.size == (char *)nah ) { - ah->a.size += nah->a.size; - - /* Remove the old block from the chains */ - nah->next_free->prev_free = nah->prev_free; - nah->prev_free->next_free = nah->next_free; - ah->a.next = nah->a.next; - nah->a.next->a.prev = ah; - -#ifdef DEBUG_MALLOC - nah->a.type = ARENA_TYPE_DEAD; -#endif - } - - /* Return the block that contains the called block */ - return ah; -} - -void *malloc(size_t size) -{ - struct free_arena_header *fp; - struct free_arena_header *pah; - size_t fsize; - - if ( size == 0 ) - return NULL; - - /* Add the obligatory arena header, and round up */ - size = (size+2*sizeof(struct arena_header)-1) & ARENA_SIZE_MASK; - - for ( fp = __malloc_head.next_free ; fp->a.type != ARENA_TYPE_HEAD ; - fp = fp->next_free ) { - if ( fp->a.size >= size ) { - /* Found fit -- allocate out of this block */ - return __malloc_from_block(fp, size); - } - } - - /* Nothing found... need to request a block from the kernel */ - fsize = (size+MALLOC_CHUNK_MASK) & ~MALLOC_CHUNK_MASK; - -#ifdef MALLOC_USING_SBRK - fp = (struct free_arena_header *) sbrk(fsize); -#else - fp = (struct free_arena_header *) - mmap(NULL, fsize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0); -#endif - - if ( fp == (struct free_arena_header *)MAP_FAILED ) { - return NULL; /* Failed to get a block */ - } - - /* Insert the block into the management chains. We need to set - up the size and the main block list pointer, the rest of - the work is logically identical to free(). */ - fp->a.type = ARENA_TYPE_FREE; - fp->a.size = fsize; - - /* We need to insert this into the main block list in the proper - place -- this list is required to be sorted. Since we most likely - get memory assignments in ascending order, search backwards for - the proper place. */ - for ( pah = __malloc_head.a.prev ; pah->a.type != ARENA_TYPE_HEAD ; - pah = pah->a.prev ) { - if ( pah < fp ) - break; - } - - /* Now pah points to the node that should be the predecessor of - the new node */ - fp->a.next = pah->a.next; - fp->a.prev = pah; - pah->a.next = fp; - fp->a.next->a.prev = fp; - - - /* Insert into the free chain and coalesce with adjacent blocks */ - fp = __free_block(fp); - - /* Now we can allocate from this block */ - return __malloc_from_block(fp, size); -} - -void free(void *ptr) -{ - struct free_arena_header *ah; - - if ( !ptr ) - return; - - ah = (struct free_arena_header *) - ((struct arena_header *)ptr - 1); - -#ifdef DEBUG_MALLOC - assert( ah->a.type == ARENA_TYPE_USED ); -#endif - - __free_block(ah); - - /* Here we could insert code to return memory to the system. */ -} diff --git a/klibc/klibc/malloc.h b/klibc/klibc/malloc.h deleted file mode 100644 index 456295069a..0000000000 --- a/klibc/klibc/malloc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * malloc.h - * - * Internals for the memory allocator - */ - -#include -#include -#include - -/* - * This structure should be a power of two. This becomes the - * alignment unit. - */ -struct free_arena_header; - -struct arena_header { - size_t type; - size_t size; /* Also gives the location of the next entry */ - struct free_arena_header *next, *prev; -}; - -#ifdef DEBUG_MALLOC -#define ARENA_TYPE_USED 0x64e69c70 -#define ARENA_TYPE_FREE 0x012d610a -#define ARENA_TYPE_HEAD 0x971676b5 -#define ARENA_TYPE_DEAD 0xeeeeeeee -#else -#define ARENA_TYPE_USED 0 -#define ARENA_TYPE_FREE 1 -#define ARENA_TYPE_HEAD 2 -#endif - -#define ARENA_SIZE_MASK (~(sizeof(struct arena_header)-1)) - -/* - * This structure should be no more than twice the size of the - * previous structure. - */ -struct free_arena_header { - struct arena_header a; - struct free_arena_header *next_free, *prev_free; -}; - -extern struct free_arena_header __malloc_head; diff --git a/klibc/klibc/memccpy.c b/klibc/klibc/memccpy.c deleted file mode 100644 index 22f68deaad..0000000000 --- a/klibc/klibc/memccpy.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * memccpy.c - * - * memccpy() - */ - -#include -#include - -void *memccpy(void *dst, const void *src, int c, size_t n) -{ - char *q = dst; - const char *p = src; - char ch; - - while ( n-- ) { - *q++ = ch = *p++; - if ( ch == (char)c ) - return q; - } - - return NULL; /* No instance of "c" found */ -} diff --git a/klibc/klibc/memchr.c b/klibc/klibc/memchr.c deleted file mode 100644 index 2e5e4cc7f2..0000000000 --- a/klibc/klibc/memchr.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * memchr.c - */ - -#include -#include - -void *memchr(const void *s, int c, size_t n) -{ - const unsigned char *sp = s; - - while ( n-- ) { - if ( *sp == (unsigned char)c ) - return (void *)sp; - sp++; - } - - return NULL; -} diff --git a/klibc/klibc/memcmp.c b/klibc/klibc/memcmp.c deleted file mode 100644 index f6bc17286f..0000000000 --- a/klibc/klibc/memcmp.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * memcmp.c - */ - -#include - -int memcmp(const void *s1, const void *s2, size_t n) -{ - const unsigned char *c1 = s1, *c2 = s2; - int d = 0; - - while ( n-- ) { - d = (int)*c1++ - (int)*c2++; - if ( d ) - break; - } - - return d; -} diff --git a/klibc/klibc/memcpy.c b/klibc/klibc/memcpy.c deleted file mode 100644 index b9171c300d..0000000000 --- a/klibc/klibc/memcpy.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * memcpy.c - */ - -#include -#include - -void *memcpy(void *dst, const void *src, size_t n) -{ - const char *p = src; - char *q = dst; -#if defined(__i386__) - size_t nl = n >> 2; - asm volatile("cld ; rep ; movsl ; movl %3,%0 ; rep ; movsb" - : "+c" (nl), "+S" (p), "+D" (q) - : "r" (n & 3)); -#elif defined(__x86_64__) - size_t nq = n >> 3; - asm volatile("cld ; rep ; movsq ; movl %3,%%ecx ; rep ; movsb" - : "+c" (nq), "+S" (p), "+D" (q) - : "r" ((uint32_t)(n & 7))); -#else - while ( n-- ) { - *q++ = *p++; - } -#endif - - return dst; -} diff --git a/klibc/klibc/memmem.c b/klibc/klibc/memmem.c deleted file mode 100644 index 8b5faa0014..0000000000 --- a/klibc/klibc/memmem.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * memmem.c - * - * Find a byte string inside a longer byte string - * - * This uses the "Not So Naive" algorithm, a very simple but - * usually effective algorithm, see: - * - * http://www-igm.univ-mlv.fr/~lecroq/string/ - */ - -#include - -void *memmem(const void *haystack, size_t n, const void *needle, size_t m) -{ - const unsigned char *y = (const unsigned char *)haystack; - const unsigned char *x = (const unsigned char *)needle; - - size_t j, k, l; - - if (m > n || !m || !n) - return NULL; - - if (1 != m) { - if (x[0] == x[1]) { - k = 2; - l = 1; - } else { - k = 1; - l = 2; - } - - j = 0; - while (j <= n - m) { - if (x[1] != y[j + 1]) { - j += k; - } else { - if (!memcmp(x + 2, y + j + 2, m - 2) - && x[0] == y[j]) - return (void *)&y[j]; - j += l; - } - } - } else - do { - if (*y == *x) - return (void *)y; - y++; - } while (--n); - - return NULL; -} diff --git a/klibc/klibc/memmove.c b/klibc/klibc/memmove.c deleted file mode 100644 index c1f042af39..0000000000 --- a/klibc/klibc/memmove.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * memmove.c - */ - -#include - -void *memmove(void *dst, const void *src, size_t n) -{ - const char *p = src; - char *q = dst; -#if defined(__i386__) || defined(__x86_64__) - if ( q < p ) { - asm volatile("cld ; rep ; movsb" : "+c" (n), "+S" (p), "+D" (q)); - } else { - p += (n-1); - q += (n-1); - asm volatile("std ; rep ; movsb" : "+c" (n), "+S" (p), "+D" (q)); - } -#else - if ( q < p ) { - while ( n-- ) { - *q++ = *p++; - } - } else { - p += n; - q += n; - while ( n-- ) { - *--q = *--p; - } - } -#endif - - return dst; -} diff --git a/klibc/klibc/memrchr.c b/klibc/klibc/memrchr.c deleted file mode 100644 index 10d9c29851..0000000000 --- a/klibc/klibc/memrchr.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * memrchr.c - */ - -#include -#include - -void *memrchr(const void *s, int c, size_t n) -{ - const unsigned char *sp = - (const unsigned char *)s + n - 1; - - while ( n-- ) { - if ( *sp == (unsigned char)c ) - return (void *)sp; - sp--; - } - - return NULL; -} diff --git a/klibc/klibc/memset.c b/klibc/klibc/memset.c deleted file mode 100644 index 522cc59a1e..0000000000 --- a/klibc/klibc/memset.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * memset.c - */ - -#include -#include - -void *memset(void *dst, int c, size_t n) -{ - char *q = dst; - -#if defined(__i386__) - size_t nl = n >> 2; - asm volatile("cld ; rep ; stosl ; movl %3,%0 ; rep ; stosb" - : "+c" (nl), "+D" (q) - : "a" ((unsigned char)c * 0x01010101U), "r" (n & 3)); -#elif defined(__x86_64__) - size_t nq = n >> 3; - asm volatile("cld ; rep ; stosq ; movl %3,%%ecx ; rep ; stosb" - : "+c" (nq), "+D" (q) - : "a" ((unsigned char)c * 0x0101010101010101U), - "r" ((uint32_t)n & 7)); -#else - while ( n-- ) { - *q++ = c; - } -#endif - - return dst; -} diff --git a/klibc/klibc/memswap.c b/klibc/klibc/memswap.c deleted file mode 100644 index 10440e3499..0000000000 --- a/klibc/klibc/memswap.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * memswap() - * - * Swaps the contents of two nonoverlapping memory areas. - * This really could be done faster... - */ - -#include - -void memswap(void *m1, void *m2, size_t n) -{ - char *p = m1; - char *q = m2; - char tmp; - - while ( n-- ) { - tmp = *p; - *p = *q; - *q = tmp; - - p++; q++; - } -} diff --git a/klibc/klibc/mmap.c b/klibc/klibc/mmap.c deleted file mode 100644 index 11c540aed6..0000000000 --- a/klibc/klibc/mmap.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * mmap.c - */ - -#include -#include -#include -#include -#include -#include /* For PAGE_SHIFT */ -#include - -/* - * MMAP2_SHIFT is definitely *NOT* equal to getpageshift() for - * many 32-bit architectures. Supposedly this is fixed to 12 - * for all 32-bit architectures. CHECK THIS!!! - */ -# define MMAP2_SHIFT 12 /* Fixed by syscall definition */ - -/* - * Set in SYSCALLS whether or not we should use an unadorned mmap() system - * call (typical on 64-bit architectures). - */ -#if (_BITSIZE == 32 && defined(__NR_mmap2)) || (_BITSIZE == 64 && !defined(__NR_mmap)) - -/* This architecture uses mmap2(). The Linux mmap2() system call takes - a page offset as the offset argument. We need to make sure we have - the proper conversion in place. */ - -extern void *__mmap2(void *, size_t, int, int, int, size_t); - -void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t offset) -{ - const int mmap2_shift = MMAP2_SHIFT; - const unsigned long mmap2_mask = (1UL << mmap2_shift) - 1; - - if ( offset & mmap2_mask ) { - errno = EINVAL; - return MAP_FAILED; - } - - return __mmap2(start, length, prot, flags, fd, (size_t)offset >> mmap2_shift); -} - -#endif - - - - diff --git a/klibc/klibc/mrand48.c b/klibc/klibc/mrand48.c deleted file mode 100644 index 886ae9f03c..0000000000 --- a/klibc/klibc/mrand48.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * mrand48.c - */ - -#include -#include - -unsigned short __rand48_seed[3]; /* Common with lrand48.c, srand48.c */ - -long mrand48(void) -{ - return jrand48(__rand48_seed); -} diff --git a/klibc/klibc/nice.c b/klibc/klibc/nice.c deleted file mode 100644 index 5a18de9091..0000000000 --- a/klibc/klibc/nice.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * nice.c - */ - -#include -#include -#include -#include - -#ifndef __NR_nice - -int nice(int inc) -{ - pid_t me = getpid(); - return setpriority(me, PRIO_PROCESS, getpriority(me, PRIO_PROCESS)+inc); -} - -#endif diff --git a/klibc/klibc/nrand48.c b/klibc/klibc/nrand48.c deleted file mode 100644 index fb7c5772fd..0000000000 --- a/klibc/klibc/nrand48.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * nrand48.c - */ - -#include -#include - -long nrand48(unsigned short xsubi[3]) -{ - return (long)((uint32_t)jrand48(xsubi) >> 1); -} diff --git a/klibc/klibc/onexit.c b/klibc/klibc/onexit.c deleted file mode 100644 index 70a9c01f61..0000000000 --- a/klibc/klibc/onexit.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * onexit.c - */ - -#include -#include -#include "atexit.h" - -extern __noreturn (*__exit_handler)(int); -static struct atexit *__atexit_list; - -static __noreturn on_exit_exit(int rv) -{ - struct atexit *ap; - - for ( ap = __atexit_list ; ap ; ap = ap->next ) { - ap->fctn(rv, ap->arg); /* This assumes extra args are harmless */ - } - - _exit(rv); -} - -int on_exit(void (*fctn)(int, void *), void *arg) -{ - struct atexit *as = malloc(sizeof(struct atexit)); - - if ( !as ) - return -1; - - as->fctn = fctn; - as->arg = arg; - - as->next = __atexit_list; - __atexit_list = as; - - __exit_handler = on_exit_exit; - - return 0; -} diff --git a/klibc/klibc/open.c b/klibc/klibc/open.c deleted file mode 100644 index cb1f5195db..0000000000 --- a/klibc/klibc/open.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * open.c - * - * On 32-bit platforms we need to pass O_LARGEFILE to the open() - * system call, to indicate that we're 64-bit safe. - */ - -#define _KLIBC_IN_OPEN_C -#include -#include -#include - -#if _BITSIZE == 32 && !defined(__i386__) - -extern int __open(const char *, int, mode_t); - -int open(const char *pathname, int flags, mode_t mode) -{ - return __open(pathname, flags|O_LARGEFILE, mode); -} - -#endif diff --git a/klibc/klibc/pause.c b/klibc/klibc/pause.c deleted file mode 100644 index 1f7b9342de..0000000000 --- a/klibc/klibc/pause.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * pause.c - */ - -#include -#include -#include -#include - -#ifndef __NR_pause - -int pause(void) -{ - return select(0,NULL,NULL,NULL,NULL); -} - -#endif diff --git a/klibc/klibc/perror.c b/klibc/klibc/perror.c deleted file mode 100644 index 26f8ce8f6d..0000000000 --- a/klibc/klibc/perror.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * perror.c - */ - -#include -#include -#include - -void perror(const char *s) -{ - int e = errno; - fprintf(stderr, "%s: %s\n", s, strerror(e)); -} diff --git a/klibc/klibc/printf.c b/klibc/klibc/printf.c deleted file mode 100644 index 34237592d6..0000000000 --- a/klibc/klibc/printf.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * printf.c - */ - -#include -#include - -#define BUFFER_SIZE 16384 - -int printf(const char *format, ...) -{ - va_list ap; - int rv; - - va_start(ap, format); - rv = vfprintf(stdout, format, ap); - va_end(ap); - return rv; -} diff --git a/klibc/klibc/pty.c b/klibc/klibc/pty.c deleted file mode 100644 index 2fe01ab204..0000000000 --- a/klibc/klibc/pty.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * pty.c - * - * Basic Unix98 PTY functionality; assumes devpts mounted on /dev/pts - */ - -#include -#include -#include -#include -#include - -char *ptsname(int fd) -{ - static char buffer[32]; /* Big enough to hold even a 64-bit pts no */ - unsigned int ptyno; - - if ( ioctl(fd, TIOCGPTN, &ptyno) ) - return NULL; - - snprintf(buffer, sizeof buffer, "/dev/pts/%u", ptyno); - - return buffer; -} - -int unlockpt(int fd) -{ - int unlock = 0; - - return ioctl(fd, TIOCSPTLCK, &unlock); -} diff --git a/klibc/klibc/putchar.c b/klibc/klibc/putchar.c deleted file mode 100644 index 0e35adda17..0000000000 --- a/klibc/klibc/putchar.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * putchar.c - * - * - gcc wants this - */ - -#include - -#undef putchar /* Defined as a macro */ -int putchar(int); - -int putchar(int c) -{ - return fputc(c, stdout); -} diff --git a/klibc/klibc/putenv.c b/klibc/klibc/putenv.c deleted file mode 100644 index 8138c653b4..0000000000 --- a/klibc/klibc/putenv.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * putenv.c - */ - -#include -#include -#include -#include - -/* str should be a duplicated version of the input string; - len is the length of the key including the = sign */ -int __put_env(char *str, size_t len, int overwrite); - -int putenv(const char *str) -{ - char *s; - const char *e, *z; - - if ( !str ) { - errno = EINVAL; - return -1; - } - - e = NULL; - for ( z = str ; *z ; z++ ) { - if ( *z == '=' ) - e = z; - } - - if ( !e ) { - errno = EINVAL; - return -1; - } - - s = strdup(str); - if ( !s ) - return -1; - - return __put_env(s, e-str, 1); -} diff --git a/klibc/klibc/puts.c b/klibc/klibc/puts.c deleted file mode 100644 index ecebf275da..0000000000 --- a/klibc/klibc/puts.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * puts.c - */ - -#include - -int puts(const char *s) -{ - if ( fputs(s, stdout) < 0 ) - return -1; - - return _fwrite("\n", 1, stdout); -} diff --git a/klibc/klibc/qsort.c b/klibc/klibc/qsort.c deleted file mode 100644 index 185f4dac69..0000000000 --- a/klibc/klibc/qsort.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * qsort.c - * - * This is actually combsort. It's an O(n log n) algorithm with - * simplicity/small code size being its main virtue. - */ - -#include -#include - -static inline size_t newgap(size_t gap) -{ - gap = (gap*10)/13; - if ( gap == 9 || gap == 10 ) - gap = 11; - - if ( gap < 1 ) - gap = 1; - return gap; -} - -void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) -{ - size_t gap = nmemb; - size_t i, j; - char *p1, *p2; - int swapped; - - do { - gap = newgap(gap); - swapped = 0; - - for ( i = 0, p1 = base ; i < nmemb-gap ; i++, p1 += size ) { - j = i+gap; - if ( compar(p1, p2 = (char *)base+j*size) > 0 ) { - memswap(p1, p2, size); - swapped = 1; - } - } - } while ( gap > 1 || swapped ); -} - diff --git a/klibc/klibc/raise.c b/klibc/klibc/raise.c deleted file mode 100644 index dcbb9c9c6c..0000000000 --- a/klibc/klibc/raise.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * raise.c - */ - -#include -#include - -int raise(int signal) -{ - return kill(getpid(), signal); -} diff --git a/klibc/klibc/readdir.c b/klibc/klibc/readdir.c deleted file mode 100644 index acfe588713..0000000000 --- a/klibc/klibc/readdir.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * readdir.c: opendir/readdir/closedir - */ - -#include -#include -#include - -#define __KLIBC_DIRENT_INTERNALS -#include - -DIR *opendir(const char *name) -{ - DIR *dp = malloc(sizeof(DIR)); - - if ( !dp ) - return NULL; - - dp->__fd = open(name, O_DIRECTORY|O_RDONLY); - - if ( dp->__fd < 0 ) { - free(dp); - return NULL; - } - - dp->bytes_left = 0; - - return dp; -} - -struct dirent *readdir(DIR *dir) -{ - struct dirent *dent; - int rv; - - if ( !dir->bytes_left ) { - rv = getdents(dir->__fd, dir->buffer, sizeof(dir->buffer)); - if ( rv <= 0 ) - return NULL; - dir->bytes_left = rv; - dir->next = dir->buffer; - } - - dent = dir->next; - dir->next = (struct dirent *)((char *)dir->next + dent->d_reclen); - dir->bytes_left -= dent->d_reclen; - - return dent; -} - -int closedir(DIR *dir) -{ - int rv; - rv = close(dir->__fd); - free(dir); - return rv; -} diff --git a/klibc/klibc/realloc.c b/klibc/klibc/realloc.c deleted file mode 100644 index 577c2001a5..0000000000 --- a/klibc/klibc/realloc.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * realloc.c - */ - -#include -#include - -#include "malloc.h" - -/* FIXME: This is cheesy, it should be fixed later */ - -void *realloc(void *ptr, size_t size) -{ - struct free_arena_header *ah; - void *newptr; - size_t oldsize; - - if ( !ptr ) - return malloc(size); - - if ( size == 0 ) { - free(ptr); - return NULL; - } - - /* Add the obligatory arena header, and round up */ - size = (size+2*sizeof(struct arena_header)-1) & ARENA_SIZE_MASK; - - ah = (struct free_arena_header *) - ((struct arena_header *)ptr - 1); - - if ( ah->a.size >= size && size >= (ah->a.size >> 2) ) { - /* This field is a good size already. */ - return ptr; - } else { - /* Make me a new block. This is kind of bogus; we should - be checking the adjacent blocks to see if we can do an - in-place adjustment... fix that later. */ - - oldsize = ah->a.size - sizeof(struct arena_header); - - newptr = malloc(size); - memcpy(newptr, ptr, (size < oldsize) ? size : oldsize); - free(ptr); - - return newptr; - } -} - diff --git a/klibc/klibc/reboot.c b/klibc/klibc/reboot.c deleted file mode 100644 index 772c85910e..0000000000 --- a/klibc/klibc/reboot.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * reboot.c - */ - -#include -#include -#include - -/* This provides the one-argument glibc-ish version of reboot. - The full four-argument system call is available as __reboot(). */ - -int reboot(int flag) -{ - return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, flag, NULL); -} diff --git a/klibc/klibc/recv.c b/klibc/klibc/recv.c deleted file mode 100644 index 4d30610cee..0000000000 --- a/klibc/klibc/recv.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * recv.c - */ - -#include -#include - -int recv(int s, void *buf, size_t len, unsigned int flags) -{ - return recvfrom(s, buf, len, flags, NULL, 0); -} diff --git a/klibc/klibc/sbrk.c b/klibc/klibc/sbrk.c deleted file mode 100644 index cb0efb21b9..0000000000 --- a/klibc/klibc/sbrk.c +++ /dev/null @@ -1,41 +0,0 @@ -/* sbrk.c - Change data segment size */ - -/* Written 2000 by Werner Almesberger */ -/* Modified 2003-2004 for klibc by H. Peter Anvin */ - -#include -#include -#include -#include -#include "malloc.h" - -char *__current_brk; /* Common with brk.c */ - -/* p is an address, a is alignment; must be a power of 2 */ -static inline void *align_up(void *p, uintptr_t a) -{ - return (void *) (((uintptr_t)p + a-1) & ~(a-1)); -} - -void *sbrk(ptrdiff_t increment) -{ - char *start, *end, *new_brk; - - if (!__current_brk) - __current_brk = __brk(NULL); - - start = align_up(__current_brk, SBRK_ALIGNMENT); - end = start + increment; - - new_brk = __brk(end); - - if (new_brk == (void *)-1) - return (void *)-1; - else if (new_brk < end) { - errno = ENOMEM; - return (void *) -1; - } - - __current_brk = new_brk; - return start; -} diff --git a/klibc/klibc/seed48.c b/klibc/klibc/seed48.c deleted file mode 100644 index ac916d6165..0000000000 --- a/klibc/klibc/seed48.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * seed48.c - */ - -#include -#include -#include - -unsigned short __rand48_seed[3]; - -unsigned short *seed48(const unsigned short xsubi[3]) -{ - static unsigned short oldseed[3]; - memcpy(oldseed, __rand48_seed, sizeof __rand48_seed); - memcpy(__rand48_seed, xsubi, sizeof __rand48_seed); - - return oldseed; -} - diff --git a/klibc/klibc/send.c b/klibc/klibc/send.c deleted file mode 100644 index 8c53d0f764..0000000000 --- a/klibc/klibc/send.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * send.c - */ - -#include -#include - -int send(int s, const void *buf, size_t len, unsigned int flags) -{ - return sendto(s, buf, len, flags, NULL, 0); -} diff --git a/klibc/klibc/setegid.c b/klibc/klibc/setegid.c deleted file mode 100644 index 09f2416e43..0000000000 --- a/klibc/klibc/setegid.c +++ /dev/null @@ -1,10 +0,0 @@ -/* - * setegid.c - */ - -#include - -int setegid(gid_t egid) -{ - return setregid(-1, egid); -} diff --git a/klibc/klibc/setenv.c b/klibc/klibc/setenv.c deleted file mode 100644 index d4ada53d74..0000000000 --- a/klibc/klibc/setenv.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * setenv.c - */ - -#include -#include -#include -#include - -/* str should be a duplicated version of the input string; - len is the length of the key including the = sign */ -int __put_env(char *str, size_t len, int overwrite); - -int setenv(const char *name, const char *val, int overwrite) -{ - const char *z; - char *s; - size_t l1, l2; - - if ( !name || !name[0] ) { - errno = EINVAL; - return -1; - } - - l1 = 0; - for ( z = name ; *z ; z++ ) { - l1++; - if ( *z == '=' ) { - errno = EINVAL; - return -1; - } - } - - l2 = strlen(val); - - s = malloc(l1+l2+2); - if ( !s ) - return -1; - - memcpy(s, name, l1); - s[l1] = '='; - memcpy(s+l1+1, val, l2+1); - - return __put_env(s, l1+1, overwrite); -} diff --git a/klibc/klibc/seteuid.c b/klibc/klibc/seteuid.c deleted file mode 100644 index 6d1ac3922a..0000000000 --- a/klibc/klibc/seteuid.c +++ /dev/null @@ -1,10 +0,0 @@ -/* - * seteuid.c - */ - -#include - -int seteuid(uid_t euid) -{ - return setreuid(-1, euid); -} diff --git a/klibc/klibc/setpgrp.c b/klibc/klibc/setpgrp.c deleted file mode 100644 index 001dd0435d..0000000000 --- a/klibc/klibc/setpgrp.c +++ /dev/null @@ -1,10 +0,0 @@ -/* - * setpgrp.c - */ - -#include - -int setpgrp(void) -{ - return setpgid(0,0); -} diff --git a/klibc/klibc/sha1hash.c b/klibc/klibc/sha1hash.c deleted file mode 100644 index 28e3399967..0000000000 --- a/klibc/klibc/sha1hash.c +++ /dev/null @@ -1,317 +0,0 @@ -/* -SHA-1 in C -By Steve Reid -100% Public Domain - ------------------ -Modified 7/98 -By James H. Brown -Still 100% Public Domain - -Corrected a problem which generated improper hash values on 16 bit machines -Routine SHA1Update changed from - void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int -len) -to - void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned -long len) - -The 'len' parameter was declared an int which works fine on 32 bit machines. -However, on 16 bit machines an int is too small for the shifts being done -against -it. This caused the hash function to generate incorrect values if len was -greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update(). - -Since the file IO in main() reads 16K at a time, any file 8K or larger would -be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million -"a"s). - -I also changed the declaration of variables i & j in SHA1Update to -unsigned long from unsigned int for the same reason. - -These changes should make no difference to any 32 bit implementations since -an -int and a long are the same size in those environments. - --- -I also corrected a few compiler warnings generated by Borland C. -1. Added #include for exit() prototype -2. Removed unused variable 'j' in SHA1Final -3. Changed exit(0) to return(0) at end of main. - -ALL changes I made can be located by searching for comments containing 'JHB' ------------------ -Modified 8/98 -By Steve Reid -Still 100% public domain - -1- Removed #include and used return() instead of exit() -2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall) -3- Changed email address from steve@edmweb.com to sreid@sea-to-sky.net - ------------------ -Modified 4/01 -By Saul Kravitz -Still 100% PD -Modified to run on Compaq Alpha hardware. - ------------------ -Modified 2/03 -By H. Peter Anvin -Still 100% PD -Modified to run on any hardware with and -Changed the driver program - -*/ - -/* -Test Vectors (from FIPS PUB 180-1) -"abc" - A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D -"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" - 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 -A million repetitions of "a" - 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F -*/ - -/* #define SHA1HANDSOFF */ - -#include -#include -#include -#include /* For htonl/ntohl/htons/ntohs */ - -/* #include */ /* prototype for exit() - JHB */ -/* Using return() instead of exit() - SWR */ - -typedef struct { - uint32_t state[5]; - uint32_t count[2]; - unsigned char buffer[64]; -} SHA1_CTX; - -void SHA1Transform(uint32_t state[5], unsigned char buffer[64]); -void SHA1Init(SHA1_CTX* context); -void SHA1Update(SHA1_CTX* context, unsigned char* data, uint32_t len); /* -JHB */ -void SHA1Final(unsigned char digest[20], SHA1_CTX* context); - -#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) - -/* blk0() and blk() perform the initial expand. */ -/* I got the idea of expanding during the round function from SSLeay */ -#define blk0(i) (block->l[i] = ntohl(block->l[i])) -#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ - ^block->l[(i+2)&15]^block->l[i&15],1)) - -/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ -#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); -#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); -#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); - - -#ifdef VERBOSE /* SAK */ -void SHAPrintContext(SHA1_CTX *context, char *msg){ - printf("%s (%d,%d) %x %x %x %x %x\n", - msg, - context->count[0], context->count[1], - context->state[0], - context->state[1], - context->state[2], - context->state[3], - context->state[4]); -} -#endif - -/* Hash a single 512-bit block. This is the core of the algorithm. */ - -void SHA1Transform(uint32_t state[5], unsigned char buffer[64]) -{ -uint32_t a, b, c, d, e; -typedef union { - unsigned char c[64]; - uint32_t l[16]; -} CHAR64LONG16; -CHAR64LONG16* block; -#ifdef SHA1HANDSOFF -static unsigned char workspace[64]; - block = (CHAR64LONG16*)workspace; - memcpy(block, buffer, 64); -#else - block = (CHAR64LONG16*)buffer; -#endif - /* Copy context->state[] to working vars */ - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - /* 4 rounds of 20 operations each. Loop unrolled. */ - R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); - R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); - R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); - R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); - R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); - R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); - R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); - R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); - R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); - R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); - R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); - R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); - R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); - R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); - R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); - R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); - R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); - R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); - R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); - R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); - /* Add the working vars back into context.state[] */ - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - state[4] += e; - /* Wipe variables */ - a = b = c = d = e = 0; -} - - -/* SHA1Init - Initialize new context */ - -void SHA1Init(SHA1_CTX* context) -{ - /* SHA1 initialization constants */ - context->state[0] = 0x67452301; - context->state[1] = 0xEFCDAB89; - context->state[2] = 0x98BADCFE; - context->state[3] = 0x10325476; - context->state[4] = 0xC3D2E1F0; - context->count[0] = context->count[1] = 0; -} - - -/* Run your data through this. */ - -void SHA1Update(SHA1_CTX* context, unsigned char* data, uint32_t len) /* -JHB */ -{ -uint32_t i, j; /* JHB */ - -#ifdef VERBOSE - SHAPrintContext(context, "before"); -#endif - j = (context->count[0] >> 3) & 63; - if ((context->count[0] += len << 3) < (len << 3)) context->count[1]++; - context->count[1] += (len >> 29); - if ((j + len) > 63) { - memcpy(&context->buffer[j], data, (i = 64-j)); - SHA1Transform(context->state, context->buffer); - for ( ; i + 63 < len; i += 64) { - SHA1Transform(context->state, &data[i]); - } - j = 0; - } - else i = 0; - memcpy(&context->buffer[j], &data[i], len - i); -#ifdef VERBOSE - SHAPrintContext(context, "after "); -#endif -} - - -/* Add padding and return the message digest. */ - -void SHA1Final(unsigned char digest[20], SHA1_CTX* context) -{ -uint32_t i; /* JHB */ -unsigned char finalcount[8]; - - for (i = 0; i < 8; i++) { - finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] - >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ - } - SHA1Update(context, (unsigned char *)"\200", 1); - while ((context->count[0] & 504) != 448) { - SHA1Update(context, (unsigned char *)"\0", 1); - } - SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() -*/ - for (i = 0; i < 20; i++) { - digest[i] = (unsigned char) - ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); - } - /* Wipe variables */ - i = 0; /* JHB */ - memset(context->buffer, 0, 64); - memset(context->state, 0, 20); - memset(context->count, 0, 8); - memset(finalcount, 0, 8); /* SWR */ -#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite it's own static vars */ - SHA1Transform(context->state, context->buffer); -#endif -} - -/*************************************************************/ - -/* This is not quite the MIME base64 algorithm: it uses _ instead of /, - and instead of padding the output with = characters we just make the - output shorter. */ -char *mybase64(uint8_t digest[20]) -{ - static const char charz[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; - uint8_t input[21]; - static char output[28]; - int i, j; - uint8_t *p; - char *q; - uint32_t bv; - - memcpy(input, digest, 20); - input[20] = 0; /* Pad to multiple of 3 bytes */ - - p = input; q = output; - for ( i = 0 ; i < 7 ; i++ ) { - bv = (p[0] << 16) | (p[1] << 8) | p[2]; - p += 3; - for ( j = 0 ; j < 4 ; j++ ) { - *q++ = charz[(bv >> 18) & 0x3f]; - bv <<= 6; - } - } - *--q = '\0'; /* The last character is not significant */ - return output; -} - -int main(int argc, char** argv) -{ - int i; - SHA1_CTX context; - uint8_t digest[20], buffer[16384]; - FILE* file; - - if (argc < 2) { - file = stdin; - } - else { - if (!(file = fopen(argv[1], "rb"))) { - fputs("Unable to open file.", stderr); - return(-1); - } - } - SHA1Init(&context); - while (!feof(file)) { /* note: what if ferror(file) */ - i = fread(buffer, 1, 16384, file); - SHA1Update(&context, buffer, i); - } - SHA1Final(digest, &context); - fclose(file); - - puts(mybase64(digest)); - - return 0; -} diff --git a/klibc/klibc/sigaction.c b/klibc/klibc/sigaction.c deleted file mode 100644 index 85f42a244c..0000000000 --- a/klibc/klibc/sigaction.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * sigaction.c - */ - -#include -#include - -__extern void __sigreturn(void); -__extern int __sigaction(int, const struct sigaction *, struct sigaction *); -__extern int __rt_sigaction(int, const struct sigaction *, struct sigaction *, size_t); - -int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) -{ - int rv; - -#if defined(__i386__) || defined(__x86_64__) - /* x86-64, and the Fedora i386 kernel, are broken without SA_RESTORER */ - struct sigaction sa; - - if ( act && !(act->sa_flags & SA_RESTORER) ) { - sa = *act; - act = &sa; - - /* The kernel can't be trusted to have a valid default restorer */ - sa.sa_flags |= SA_RESTORER; - sa.sa_restorer = &__sigreturn; - } -#endif - -#ifdef __NR_sigaction - rv = __sigaction(sig, act, oact); -#else - rv = __rt_sigaction(sig, act, oact, sizeof(sigset_t)); -#endif - - -#if defined(__i386__) || defined(__x86_64__) - if ( oact && (oact->sa_restorer == &__sigreturn) ) { - oact->sa_flags &= ~SA_RESTORER; - } -#endif - - return rv; -} diff --git a/klibc/klibc/siglist.c b/klibc/klibc/siglist.c deleted file mode 100644 index dce7355079..0000000000 --- a/klibc/klibc/siglist.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * siglist.h - * - * Construct the signal list - */ - -#include -#include - -const char * const sys_siglist[NSIG] = { -#ifdef SIGABRT - [SIGABRT] = "Aborted", -#endif -#ifdef SIGALRM - [SIGALRM] = "Alarm clock", -#endif -#ifdef SIGBUS - [SIGBUS] = "Bus error", -#endif -#ifdef SIGCHLD - [SIGCHLD] = "Child exited", -#endif -#if defined(SIGCLD) && (SIGCHLD != SIGCLD) - [SIGCLD] = "Child exited", -#endif -#ifdef SIGEMT - [SIGEMT] = "Emulation trap", -#endif -#ifdef SIGFPE - [SIGFPE] = "Floating point exception", -#endif -#ifdef SIGHUP - [SIGHUP] = "Hangup", -#endif -#ifdef SIGILL - [SIGILL] = "Illegal instruction", -#endif - /* SIGINFO == SIGPWR */ -#ifdef SIGINT - [SIGINT] = "Interrupt", -#endif -#ifdef SIGIO - [SIGIO] = "I/O possible", -#endif -#if defined(SIGIOT) && (SIGIOT != SIGABRT) - [SIGIOT] = "I/O trap", -#endif -#ifdef SIGKILL - [SIGKILL] = "Killed", -#endif -#if defined(SIGLOST) && (SIGLOST != SIGIO) && (SIGLOST != SIGPWR) - [SIGLOST] = "Lock lost", -#endif -#ifdef SIGPIPE - [SIGPIPE] = "Broken pipe", -#endif -#if defined(SIGPOLL) && (SIGPOLL != SIGIO) - [SIGPOLL] = "Pollable event", -#endif -#ifdef SIGPROF - [SIGPROF] = "Profiling timer expired", -#endif -#ifdef SIGPWR - [SIGPWR] = "Power failure", -#endif -#ifdef SIGQUIT - [SIGQUIT] = "Quit", -#endif - /* SIGRESERVE == SIGUNUSED */ -#ifdef SIGSEGV - [SIGSEGV] = "Segment violation", -#endif -#ifdef SIGSTKFLT - [SIGSTKFLT] = "Stack fault", -#endif -#ifdef SIGSTOP - [SIGSTOP] = "Stopped (signal)", -#endif -#ifdef SIGSYS - [SIGSYS] = "Bad system call", -#endif -#ifdef SIGTERM - [SIGTERM] = "Terminated", -#endif -#ifdef SIGTSTP - [SIGTSTP] = "Stopped", -#endif -#ifdef SIGTTIN - [SIGTTIN] = "Stopped (tty input)", -#endif -#ifdef SIGTTOU - [SIGTTOU] = "Stopped (tty output)", -#endif -#ifdef SIGURG - [SIGURG] = "Urgent I/O condition", -#endif -#ifdef SIGUSR1 - [SIGUSR1] = "User signal 1", -#endif -#ifdef SIGUSR2 - [SIGUSR2] = "User signal 2", -#endif -#ifdef SIGVTALRM - [SIGVTALRM] = "Virtual timer expired", -#endif -#ifdef SIGWINCH - [SIGWINCH] = "Window size changed", -#endif -#ifdef SIGXCPU - [SIGXCPU] = "CPU time limit exceeded", -#endif -#ifdef SIGXFSZ - [SIGXFSZ] = "File size limit exceeded", -#endif -}; diff --git a/klibc/klibc/siglongjmp.c b/klibc/klibc/siglongjmp.c deleted file mode 100644 index 2ba1239b6b..0000000000 --- a/klibc/klibc/siglongjmp.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * siglongjmp.c - * - * sigsetjmp() is a macro, by necessity (it's either that or write - * it in assembly), but siglongjmp() is a normal function. - */ - -#include -#include - -__noreturn siglongjmp(sigjmp_buf buf, int retval) -{ - sigprocmask(SIG_SETMASK, &buf->__sigs, NULL); - longjmp(buf->__jmpbuf, retval); -} - diff --git a/klibc/klibc/sigpending.c b/klibc/klibc/sigpending.c deleted file mode 100644 index decfe32b1b..0000000000 --- a/klibc/klibc/sigpending.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * sigpending.c - */ - -#include -#include - -#ifndef __NR_sigpending - -__extern __rt_sigpending(sigset_t *, size_t); - -int sigpending(sigset_t *set) -{ - return __rt_sigpending(set, sizeof(sigset_t)); -} - -#endif diff --git a/klibc/klibc/sigprocmask.c b/klibc/klibc/sigprocmask.c deleted file mode 100644 index 372e0fd90d..0000000000 --- a/klibc/klibc/sigprocmask.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * sigprocmask.c - */ - -#include -#include - -#ifndef __NR_sigprocmask - -__extern __rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t); - -int sigprocmask(int how, const sigset_t *set, sigset_t *oset) -{ - return __rt_sigprocmask(how, set, oset, sizeof(sigset_t)); -} - -#endif diff --git a/klibc/klibc/sigsuspend.c b/klibc/klibc/sigsuspend.c deleted file mode 100644 index 22f9a46681..0000000000 --- a/klibc/klibc/sigsuspend.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * sigsuspend.c - */ - -#include -#include - -#ifndef __NR_sigsuspend - -__extern int __rt_sigsuspend(const sigset_t *, size_t); - -int sigsuspend(const sigset_t *mask) -{ - return __rt_sigsuspend(mask, sizeof *mask); -} - -#endif diff --git a/klibc/klibc/sleep.c b/klibc/klibc/sleep.c deleted file mode 100644 index eb3777e8a6..0000000000 --- a/klibc/klibc/sleep.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * sleep.c - */ - -#include -#include - -unsigned int sleep(unsigned int seconds) -{ - struct timespec ts; - - ts.tv_sec = seconds; - ts.tv_nsec = 0; - if ( !nanosleep(&ts,&ts) ) - return 0; - else if ( errno == EINTR ) - return ts.tv_sec; - else - return -1; -} diff --git a/klibc/klibc/snprintf.c b/klibc/klibc/snprintf.c deleted file mode 100644 index c642851b2f..0000000000 --- a/klibc/klibc/snprintf.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * snprintf.c - */ - -#include - -int snprintf(char *buffer, size_t n, const char *format, ...) -{ - va_list ap; - int rv; - - va_start(ap, format); - rv = vsnprintf(buffer, n, format, ap); - va_end(ap); - return rv; -} diff --git a/klibc/klibc/socketcalls.pl b/klibc/klibc/socketcalls.pl deleted file mode 100644 index 68f0fa164b..0000000000 --- a/klibc/klibc/socketcalls.pl +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/perl - -$v = $ENV{'KBUILD_VERBOSE'}; -$quiet = defined($v) ? !$v : 0; - -@args = (); -for $arg ( @ARGV ) { - if ( $arg =~ /^-/ ) { - if ( $arg eq '-q' ) { - $quiet = 1; - } else { - die "$0: Unknown option: $arg\n"; - } - } else { - push(@args, $arg); - } -} -($file, $arch, $outputdir) = @args; - -if (!open(FILE, "< $file")) { - die "$file: $!\n"; -} - -print "socketcall-objs := "; -while ( defined($line = ) ) { - chomp $line; - $line =~ s/\s*[\#\;].*$//; # Strip comments and trailing blanks - next unless $line; - - if ( $line =~ /^\s*\<\?\>\s*(.*)\s+([_a-zA-Z][_a-zA-Z0-9]+)\s*\((.*)\)$/ ) { - $type = $1; - $name = $2; - $argv = $3; - - @args = split(/\s*\,\s*/, $argv); - @cargs = (); - - $i = 0; - for $arg ( @args ) { - push(@cargs, "$arg a".$i++); - } - $nargs = $i; - print " \\\n\t${name}.o"; - - if ( $arch eq 'i386' ) { - open(OUT, '>', "${outputdir}/${name}.S") - or die "$0: Cannot open ${outputdir}/${name}.S\n"; - - print OUT "#include \n"; - print OUT "\n"; - print OUT "\t.text\n"; - print OUT "\t.align 4\n"; - print OUT "\t.globl ${name}\n"; - print OUT "\t.type ${name},\@function\n"; - print OUT "${name}:\n"; - print OUT "\tmovb \$SYS_\U${name}\E,%al\n"; - print OUT "\tjmp __socketcall_common\n"; - print OUT "\t.size ${name},.-${name}\n"; - close(OUT); - } else { - open(OUT, '>', "${outputdir}/${name}.c") - or die "$0: Cannot open ${outputdir}/${name}.c\n"; - - print OUT "#include \"../socketcommon.h\"\n"; - print OUT "\n"; - print OUT "#ifndef __NR_${name}\n\n"; - - print OUT "extern long __socketcall(int, const unsigned long *);\n\n"; - - print OUT "$type $name (", join(', ', @cargs), ")\n"; - print OUT "{\n"; - print OUT " unsigned long args[$nargs];\n"; - for ( $i = 0 ; $i < $nargs ; $i++ ) { - print OUT " args[$i] = (unsigned long)a$i;\n"; - } - print OUT " return ($type) __socketcall(SYS_\U${name}\E, args);\n"; - print OUT "}\n\n"; - - print OUT "#endif\n"; - - close(OUT); - } - } else { - die "$file:$.: Could not parse input\n"; - } -} - -print "\n"; diff --git a/klibc/klibc/socketcommon.h b/klibc/klibc/socketcommon.h deleted file mode 100644 index 9c4b11fab8..0000000000 --- a/klibc/klibc/socketcommon.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * socketcommon.h - * - * Common header file for socketcall stubs - */ - -#define __IN_SYS_COMMON -#include -#include -#include -#include -#include -#include -#include -#include -#include diff --git a/klibc/klibc/sprintf.c b/klibc/klibc/sprintf.c deleted file mode 100644 index 31f28af005..0000000000 --- a/klibc/klibc/sprintf.c +++ /dev/null @@ -1,18 +0,0 @@ -/* - * sprintf.c - */ - -#include -#include - -int sprintf(char *buffer, const char *format, ...) -{ - va_list ap; - int rv; - - va_start(ap, format); - rv = vsnprintf(buffer, ~(size_t)0, format, ap); - va_end(ap); - - return rv; -} diff --git a/klibc/klibc/srand48.c b/klibc/klibc/srand48.c deleted file mode 100644 index 5f201d2047..0000000000 --- a/klibc/klibc/srand48.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * srand48.c - */ - -#include -#include - -unsigned short __rand48_seed[3]; /* Common with mrand48.c, lrand48.c */ - -void srand48(long seedval) -{ - __rand48_seed[0] = 0x330e; - __rand48_seed[1] = (unsigned short)seedval; - __rand48_seed[2] = (unsigned short)((uint32_t)seedval >> 16); -} diff --git a/klibc/klibc/sscanf.c b/klibc/klibc/sscanf.c deleted file mode 100644 index 81aab9e05b..0000000000 --- a/klibc/klibc/sscanf.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * sscanf() - */ - -#include - -int sscanf(const char *str, const char *format, ...) -{ - va_list ap; - int rv; - - va_start(ap, format); - rv = vsscanf(str, format, ap); - va_end(ap); - - return rv; -} diff --git a/klibc/klibc/statfs.c b/klibc/klibc/statfs.c deleted file mode 100644 index 60e9188a09..0000000000 --- a/klibc/klibc/statfs.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * statfs.c - * - * On architectures which do statfs64, wrap the system call - */ - -#include -#include - -#ifdef __NR_statfs64 - -extern int __statfs64(const char *, size_t, struct statfs *); - -int statfs(const char *path, struct statfs *buf) -{ - return __statfs64(path, sizeof *buf, buf); -} - -#endif diff --git a/klibc/klibc/strcasecmp.c b/klibc/klibc/strcasecmp.c deleted file mode 100644 index 12aef40d93..0000000000 --- a/klibc/klibc/strcasecmp.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * strcasecmp.c - */ - -#include -#include - -int strcasecmp(const char *s1, const char *s2) -{ - const unsigned char *c1 = s1, *c2 = s2; - unsigned char ch; - int d = 0; - - while ( 1 ) { - /* toupper() expects an unsigned char (implicitly cast to int) - as input, and returns an int, which is exactly what we want. */ - d = toupper(ch = *c1++) - toupper(*c2++); - if ( d || !ch ) - break; - } - - return d; -} diff --git a/klibc/klibc/strcat.c b/klibc/klibc/strcat.c deleted file mode 100644 index a5f9477866..0000000000 --- a/klibc/klibc/strcat.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * strcat.c - */ - -#include - -char *strcat(char *dst, const char *src) -{ - strcpy(strchr(dst, '\0'), src); - return dst; -} diff --git a/klibc/klibc/strchr.c b/klibc/klibc/strchr.c deleted file mode 100644 index f657095c6b..0000000000 --- a/klibc/klibc/strchr.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * strchr.c - */ - -#include -#include - -char *strchr(const char *s, int c) -{ - while ( *s != (char)c ) { - if ( ! *s ) - return NULL; - s++; - } - - return (char *)s; -} - -__ALIAS(char *, index, (const char *, int), strchr) diff --git a/klibc/klibc/strcmp.c b/klibc/klibc/strcmp.c deleted file mode 100644 index f44774f443..0000000000 --- a/klibc/klibc/strcmp.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * strcmp.c - */ - -#include - -int strcmp(const char *s1, const char *s2) -{ - const unsigned char *c1 = s1, *c2 = s2; - unsigned char ch; - int d = 0; - - while ( 1 ) { - d = (int)(ch = *c1++) - (int)*c2++; - if ( d || !ch ) - break; - } - - return d; -} diff --git a/klibc/klibc/strcpy.c b/klibc/klibc/strcpy.c deleted file mode 100644 index 8372eba50b..0000000000 --- a/klibc/klibc/strcpy.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * strcpy.c - * - * strcpy() - */ - -#include - -char *strcpy(char *dst, const char *src) -{ - char *q = dst; - const char *p = src; - char ch; - - do { - *q++ = ch = *p++; - } while ( ch ); - - return dst; -} diff --git a/klibc/klibc/strcspn.c b/klibc/klibc/strcspn.c deleted file mode 100644 index 87d644551e..0000000000 --- a/klibc/klibc/strcspn.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * strcspn - */ - -#include "strxspn.h" - -size_t -strcspn(const char *s, const char *reject) -{ - return __strxspn(s, reject, 1); -} diff --git a/klibc/klibc/strdup.c b/klibc/klibc/strdup.c deleted file mode 100644 index eb170c2645..0000000000 --- a/klibc/klibc/strdup.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * strdup.c - */ - -#include -#include - -char *strdup(const char *s) -{ - int l = strlen(s)+1; - char *d = malloc(l); - - if ( d ) - memcpy(d, s, l); - - return d; -} diff --git a/klibc/klibc/strerror.c b/klibc/klibc/strerror.c deleted file mode 100644 index c8e3eac793..0000000000 --- a/klibc/klibc/strerror.c +++ /dev/null @@ -1,34 +0,0 @@ -/* - * strerror.c - */ - -#include - -char *strerror(int errnum) -{ - static char message[32] = "error "; /* enough for error 2^63-1 */ - char numbuf[32]; - char *p; - unsigned int e = (unsigned int)errnum; - -#ifdef WITH_ERRLIST - extern const int sys_nerr; - extern const char * const sys_errlist[]; - - if ( e < (unsigned int)sys_nerr && sys_errlist[e] ) - return (char *)sys_errlist[e]; -#endif - - p = numbuf+sizeof numbuf; - *--p = '\0'; - - do { - *--p = (e % 10) + '0'; - e /= 10; - } while ( e ); - - memcpy(message+6, p, (numbuf+sizeof numbuf)-p); - - return message; -} - diff --git a/klibc/klibc/strlcat.c b/klibc/klibc/strlcat.c deleted file mode 100644 index f397857e76..0000000000 --- a/klibc/klibc/strlcat.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * strlcat.c - */ - -#include -#include - -size_t strlcat(char *dst, const char *src, size_t size) -{ - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while ( bytes < size && *q ) { - q++; - bytes++; - } - if (bytes == size) - return (bytes + strlen(src)); - - while ( (ch = *p++) ) { - if ( bytes+1 < size ) - *q++ = ch; - - bytes++; - } - - *q = '\0'; - return bytes; -} - - diff --git a/klibc/klibc/strlcpy.c b/klibc/klibc/strlcpy.c deleted file mode 100644 index e6937445cd..0000000000 --- a/klibc/klibc/strlcpy.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * strlcpy.c - */ - -#include -#include - -size_t strlcpy(char *dst, const char *src, size_t size) -{ - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while ( (ch = *p++) ) { - if ( bytes+1 < size ) - *q++ = ch; - - bytes++; - } - - /* If size == 0 there is no space for a final null... */ - if ( size ) - *q = '\0'; - - return bytes; -} - - diff --git a/klibc/klibc/strlen.c b/klibc/klibc/strlen.c deleted file mode 100644 index 4d773f9a05..0000000000 --- a/klibc/klibc/strlen.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * strlen() - */ - -#include - -size_t strlen(const char *s) -{ - const char *ss = s; - while ( *ss ) - ss++; - return ss-s; -} - diff --git a/klibc/klibc/strncasecmp.c b/klibc/klibc/strncasecmp.c deleted file mode 100644 index 3309d1a7fe..0000000000 --- a/klibc/klibc/strncasecmp.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * strncasecmp.c - */ - -#include -#include - -int strncasecmp(const char *s1, const char *s2, size_t n) -{ - const unsigned char *c1 = s1, *c2 = s2; - unsigned char ch; - int d = 0; - - while ( n-- ) { - /* toupper() expects an unsigned char (implicitly cast to int) - as input, and returns an int, which is exactly what we want. */ - d = toupper(ch = *c1++) - toupper(*c2++); - if ( d || !ch ) - break; - } - - return d; -} diff --git a/klibc/klibc/strncat.c b/klibc/klibc/strncat.c deleted file mode 100644 index 78223152c4..0000000000 --- a/klibc/klibc/strncat.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * strncat.c - */ - -#include -#include - -char *strncat(char *dst, const char *src, size_t n) -{ - char *q = strchr(dst, '\0'); - const char *p = src; - char ch; - - while (n--) { - *q++ = ch = *p++; - if ( !ch ) - return dst; - } - *q = '\0'; - - return dst; -} diff --git a/klibc/klibc/strncmp.c b/klibc/klibc/strncmp.c deleted file mode 100644 index 4dbde1389f..0000000000 --- a/klibc/klibc/strncmp.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * strncmp.c - */ - -#include - -int strncmp(const char *s1, const char *s2, size_t n) -{ - const unsigned char *c1 = s1, *c2 = s2; - unsigned char ch; - int d = 0; - - while ( n-- ) { - d = (int)(ch = *c1++) - (int)*c2++; - if ( d || !ch ) - break; - } - - return d; -} diff --git a/klibc/klibc/strncpy.c b/klibc/klibc/strncpy.c deleted file mode 100644 index 06964f31d6..0000000000 --- a/klibc/klibc/strncpy.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * strncpy.c - */ - -#include - -char *strncpy(char *dst, const char *src, size_t n) -{ - char *q = dst; - const char *p = src; - char ch; - - while (n) { - n--; - *q++ = ch = *p++; - if ( !ch ) - break; - } - - /* The specs say strncpy() fills the entire buffer with NUL. Sigh. */ - memset(q, 0, n); - - return dst; -} diff --git a/klibc/klibc/strndup.c b/klibc/klibc/strndup.c deleted file mode 100644 index 1b44e6f99a..0000000000 --- a/klibc/klibc/strndup.c +++ /dev/null @@ -1,17 +0,0 @@ -/* - * strndup.c - */ - -#include -#include - -char *strndup(const char *s, size_t n) -{ - int l = n > strlen(s) ? strlen(s)+1 : n+1; - char *d = malloc(l); - - if (d) - memcpy(d, s, l); - d[n] = '\0'; - return d; -} diff --git a/klibc/klibc/strnlen.c b/klibc/klibc/strnlen.c deleted file mode 100644 index 06b54c3189..0000000000 --- a/klibc/klibc/strnlen.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * strnlen() - */ - -#include - -size_t strnlen(const char *s, size_t maxlen) -{ - const char *ss = s; - - /* Important: the maxlen test must precede the reference through ss; - since the byte beyond the maximum may segfault */ - while ((maxlen > 0) && *ss) { - ss++; - maxlen--; - } - return ss-s; -} - diff --git a/klibc/klibc/strntoimax.c b/klibc/klibc/strntoimax.c deleted file mode 100644 index f53a266dba..0000000000 --- a/klibc/klibc/strntoimax.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * strntoimax.c - * - * strntoimax() - */ - -#include -#include - -intmax_t strntoimax(const char *nptr, char **endptr, int base, size_t n) -{ - return (intmax_t) strntoumax(nptr, endptr, base, n); -} diff --git a/klibc/klibc/strntoumax.c b/klibc/klibc/strntoumax.c deleted file mode 100644 index 4c47fe8662..0000000000 --- a/klibc/klibc/strntoumax.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * strntoumax.c - * - * The strntoumax() function and associated - */ - -#include -#include -#include - -static inline int digitval(int ch) -{ - if ( ch >= '0' && ch <= '9' ) { - return ch-'0'; - } else if ( ch >= 'A' && ch <= 'Z' ) { - return ch-'A'+10; - } else if ( ch >= 'a' && ch <= 'z' ) { - return ch-'a'+10; - } else { - return -1; - } -} - -uintmax_t strntoumax(const char *nptr, char **endptr, int base, size_t n) -{ - int minus = 0; - uintmax_t v = 0; - int d; - - while ( n && isspace((unsigned char)*nptr) ) { - nptr++; - n--; - } - - /* Single optional + or - */ - if ( n ) { - char c = *nptr; - if ( c == '-' || c == '+' ) { - minus = (c == '-'); - nptr++; - n--; - } - } - - if ( base == 0 ) { - if ( n >= 2 && nptr[0] == '0' && - (nptr[1] == 'x' || nptr[1] == 'X') ) { - n -= 2; - nptr += 2; - base = 16; - } else if ( n >= 1 && nptr[0] == '0' ) { - n--; - nptr++; - base = 8; - } else { - base = 10; - } - } else if ( base == 16 ) { - if ( n >= 2 && nptr[0] == '0' && - (nptr[1] == 'x' || nptr[1] == 'X') ) { - n -= 2; - nptr += 2; - } - } - - while ( n && (d = digitval(*nptr)) >= 0 && d < base ) { - v = v*base + d; - n--; - nptr++; - } - - if ( endptr ) - *endptr = (char *)nptr; - - return minus ? -v : v; -} diff --git a/klibc/klibc/strpbrk.c b/klibc/klibc/strpbrk.c deleted file mode 100644 index 86ea236308..0000000000 --- a/klibc/klibc/strpbrk.c +++ /dev/null @@ -1,14 +0,0 @@ -/* - * strpbrk - */ - -#include "strxspn.h" - -char * -strpbrk(const char *s, const char *accept) -{ - const char *ss = s+__strxspn(s, accept, 1); - - return *ss ? (char *)ss : NULL; -} - diff --git a/klibc/klibc/strrchr.c b/klibc/klibc/strrchr.c deleted file mode 100644 index 5a0cbe386e..0000000000 --- a/klibc/klibc/strrchr.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * strrchr.c - */ - -#include -#include - -char *strrchr(const char *s, int c) -{ - const char *found = NULL; - - while ( *s ) { - if ( *s == (char) c ) - found = s; - s++; - } - - return (char *)found; -} - -__ALIAS(char *, rindex, (const char *, int), strrchr) diff --git a/klibc/klibc/strsep.c b/klibc/klibc/strsep.c deleted file mode 100644 index 58a7a07773..0000000000 --- a/klibc/klibc/strsep.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * strsep.c - */ - -#include - -char *strsep(char **stringp, const char *delim) -{ - char *s = *stringp; - char *e; - - if ( !s ) - return NULL; - - e = strpbrk(s, delim); - if (e) - *e++ = '\0'; - - *stringp = e; - return s; -} diff --git a/klibc/klibc/strspn.c b/klibc/klibc/strspn.c deleted file mode 100644 index 10b1dfc5fa..0000000000 --- a/klibc/klibc/strspn.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * strspn - */ - -#include "strxspn.h" - -size_t -strspn(const char *s, const char *accept) -{ - return __strxspn(s, accept, 0); -} diff --git a/klibc/klibc/strstr.c b/klibc/klibc/strstr.c deleted file mode 100644 index 10222dfd30..0000000000 --- a/klibc/klibc/strstr.c +++ /dev/null @@ -1,10 +0,0 @@ -/* - * strstr.c - */ - -#include - -char *strstr(const char *haystack, const char *needle) -{ - return (char *)memmem(haystack, strlen(haystack), needle, strlen(needle)); -} diff --git a/klibc/klibc/strtoimax.c b/klibc/klibc/strtoimax.c deleted file mode 100644 index 0cdd088e51..0000000000 --- a/klibc/klibc/strtoimax.c +++ /dev/null @@ -1,3 +0,0 @@ -#define TYPE intmax_t -#define NAME strtoimax -#include "strtox.c" diff --git a/klibc/klibc/strtok.c b/klibc/klibc/strtok.c deleted file mode 100644 index 6e84f1dff3..0000000000 --- a/klibc/klibc/strtok.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * strtok.c - */ - -#include - -char *strtok(char *s, const char *delim) -{ - static char *holder; - - if ( s ) - holder = s; - - return strsep(&holder, delim); -} - diff --git a/klibc/klibc/strtol.c b/klibc/klibc/strtol.c deleted file mode 100644 index 9efc8b9e4a..0000000000 --- a/klibc/klibc/strtol.c +++ /dev/null @@ -1,3 +0,0 @@ -#define TYPE signed long -#define NAME strtol -#include "strtox.c" diff --git a/klibc/klibc/strtoll.c b/klibc/klibc/strtoll.c deleted file mode 100644 index a9428c7f14..0000000000 --- a/klibc/klibc/strtoll.c +++ /dev/null @@ -1,3 +0,0 @@ -#define TYPE signed long long -#define NAME strtoll -#include "strtox.c" diff --git a/klibc/klibc/strtotimespec.c b/klibc/klibc/strtotimespec.c deleted file mode 100644 index b426bf8d0f..0000000000 --- a/klibc/klibc/strtotimespec.c +++ /dev/null @@ -1,5 +0,0 @@ -#define NAME strtotimespec -#define TIMEX struct timespec -#define FSEC tv_nsec -#define DECIMALS 9 -#include "strtotimex.c" diff --git a/klibc/klibc/strtotimeval.c b/klibc/klibc/strtotimeval.c deleted file mode 100644 index 280d4bcd3a..0000000000 --- a/klibc/klibc/strtotimeval.c +++ /dev/null @@ -1,5 +0,0 @@ -#define NAME strtotimeval -#define TIMEX struct timeval -#define FSEC tv_usec -#define DECIMALS 6 -#include "strtotimex.c" diff --git a/klibc/klibc/strtotimex.c b/klibc/klibc/strtotimex.c deleted file mode 100644 index 0f6c2f9181..0000000000 --- a/klibc/klibc/strtotimex.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * strtotimex.c - * - * Nonstandard function which takes a string and converts it to a - * struct timespec/timeval. Returns a pointer to the first non-numeric - * character in the string. - * - */ - -#include -#include -#include -#include - -char * NAME (const char *str, TIMEX *ts) -{ - int n; - char *s, *s0; - __typeof__(ts->FSEC) fs; /* Fractional seconds */ - - ts->tv_sec = strntoumax(str, &s, 10, ~(size_t)0); - fs = 0; - - if ( *s == '.' ) { - s0 = s+1; - - fs = strntoumax(s0, &s, 10, DECIMALS); - n = s-s0; - - while ( isdigit(*s) ) - s++; - - for ( ; n < DECIMALS ; n++ ) - fs *= 10; - } - - ts->FSEC = fs; - return s; -} diff --git a/klibc/klibc/strtoul.c b/klibc/klibc/strtoul.c deleted file mode 100644 index 3189aaa7ce..0000000000 --- a/klibc/klibc/strtoul.c +++ /dev/null @@ -1,3 +0,0 @@ -#define TYPE unsigned long -#define NAME strtoul -#include "strtox.c" diff --git a/klibc/klibc/strtoull.c b/klibc/klibc/strtoull.c deleted file mode 100644 index 83c14e9128..0000000000 --- a/klibc/klibc/strtoull.c +++ /dev/null @@ -1,3 +0,0 @@ -#define TYPE unsigned long long -#define NAME strtoull -#include "strtox.c" diff --git a/klibc/klibc/strtoumax.c b/klibc/klibc/strtoumax.c deleted file mode 100644 index a3797105e8..0000000000 --- a/klibc/klibc/strtoumax.c +++ /dev/null @@ -1,3 +0,0 @@ -#define TYPE uintmax_t -#define NAME strtoumax -#include "strtox.c" diff --git a/klibc/klibc/strtox.c b/klibc/klibc/strtox.c deleted file mode 100644 index 7c228b6fa4..0000000000 --- a/klibc/klibc/strtox.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * strtox.c - * - * strto...() functions, by macro definition - */ - -#include -#include - -TYPE NAME (const char *nptr, char **endptr, int base) -{ - return (TYPE) strntoumax(nptr, endptr, base, ~(size_t)0); -} diff --git a/klibc/klibc/strxspn.c b/klibc/klibc/strxspn.c deleted file mode 100644 index 618c0bcdb5..0000000000 --- a/klibc/klibc/strxspn.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * strpbrk - */ - -#include -#include -#include -#include -#include "strxspn.h" - -size_t -__strxspn(const char *s, const char *map, int parity) -{ - char matchmap[UCHAR_MAX+1]; - size_t n = 0; - - /* Create bitmap */ - memset(matchmap, 0, sizeof matchmap); - while ( *map ) - matchmap[(unsigned char) *map++] = 1; - - /* Make sure the null character never matches */ - matchmap[0] = parity; - - /* Calculate span length */ - while ( matchmap[(unsigned char) *s++] ^ parity ) - n++; - - return n; -} diff --git a/klibc/klibc/strxspn.h b/klibc/klibc/strxspn.h deleted file mode 100644 index 5e1a21922f..0000000000 --- a/klibc/klibc/strxspn.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * strxspn.h - */ - -#ifndef STRXSPN_H -#define STRXSPN_H - -#include - -extern size_t -__strxspn(const char *s, const char *map, int parity); - -#endif diff --git a/klibc/klibc/syscalls.pl b/klibc/klibc/syscalls.pl deleted file mode 100644 index 0575fa6648..0000000000 --- a/klibc/klibc/syscalls.pl +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/perl -# -# Script to parse the SYSCALLS file and generate appropriate -# stubs. - -$v = $ENV{'KBUILD_VERBOSE'}; -$quiet = defined($v) ? !$v : 0; - -@args = (); -for $arg ( @ARGV ) { - if ( $arg =~ /^-/ ) { - if ( $arg eq '-q' ) { - $quiet = 1; - } else { - die "$0: Unknown option: $arg\n"; - } - } else { - push(@args, $arg); - } -} -($file, $sysstub, $arch, $bits, $unistd, $outputdir, $havesyscall) = @args; - -require "$sysstub"; - -if (!open(UNISTD, '<', $unistd)) { - die "$0: $unistd: $!\n"; -} - -while ( defined($line = ) ) { - chomp $line; - - if ( $line =~ /^\#\s*define\s+__NR_([A-Za-z0-9_]+)\s+(.*\S)\s*$/ ) { - $syscalls{$1} = $2; - print STDERR "SYSCALL FOUND: $1\n" unless ( $quiet ); - } -} -close(UNISTD); - -if (!open(HAVESYS, '>', $havesyscall)) { - die "$0: $havesyscall: $!\n"; -} - -print HAVESYS "#ifndef _KLIBC_HAVESYSCALL_H\n"; -print HAVESYS "#define _KLIBC_HAVESYSCALL_H 1\n\n"; - -if (!open(FILE, '<', $file)) { - die "$0: $file: $!\n"; -} - -print "syscall-objs := "; - -while ( defined($line = ) ) { - chomp $line; - $line =~ s/\s*(|[\#;].*)$//; # Strip comments and trailing blanks - next unless $line; - - if ( $line =~ /^\s*(\<[^\>]+\>\s+|)([A-Za-z0-9_\*\s]+)\s+([A-Za-z0-9_,]+)(|\@[A-Za-z0-9_]+)(|\:\:[A-Za-z0-9_]+)\s*\(([^\:\)]*)\)\s*$/ ) { - $archs = $1; - $type = $2; - $snames = $3; - $stype = $4; - $fname = $5; - $argv = $6; - - $doit = 1; - $maybe = 0; - if ( $archs ne '' ) { - die "$file:$.: Invalid architecture spec: <$archs>\n" - unless ( $archs =~ /^\<(|\?)(|\!)([^\>\!\?]*)\>/ ); - $maybe = $1 ne ''; - $not = $2 ne ''; - $list = $3; - - $doit = $not || ($list eq ''); - - @list = split(/,/, $list); - foreach $a ( @list ) { - if ( $a eq $arch || $a eq $bits ) { - $doit = !$not; - last; - } - } - } - next if ( ! $doit ); - - undef $sname; - foreach $sn ( split(/,/, $snames) ) { - if ( defined $syscalls{$sn} ) { - $sname = $sn; - last; - } - } - if ( !defined($sname) ) { - next if ( $maybe ); - die "$file:$.: Undefined system call: $snames\n"; - } - - $type =~ s/\s*$//; - $stype =~ s/^\@//; - - if ( $fname eq '' ) { - $fname = $sname; - } else { - $fname =~ s/^\:\://; - } - - @args = split(/\s*\,\s*/, $argv); - - print HAVESYS "#define _KLIBC_HAVE_SYSCALL_${fname} ${sname}\n"; - print " \\\n\t${fname}.o"; - make_sysstub($outputdir, $fname, $type, $sname, $stype, @args); - } else { - die "$file:$.: Could not parse input: \"$line\"\n"; - } -} - -print "\n"; - -print HAVESYS "\n#endif\n"; -close(HAVESYS); diff --git a/klibc/klibc/syscommon.h b/klibc/klibc/syscommon.h deleted file mode 100644 index 429025279e..0000000000 --- a/klibc/klibc/syscommon.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * syscommon.h - * - * Common header file for system call stubs - */ - -#define __IN_SYS_COMMON -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __i386__ -# include -#endif diff --git a/klibc/klibc/syslog.c b/klibc/klibc/syslog.c deleted file mode 100644 index 0cd296ab85..0000000000 --- a/klibc/klibc/syslog.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * syslog.c - * - * Issue syslog messages via the kernel printk queue. - */ - -#include -#include -#include -#include -#include -#include - -/* Maximum size for a kernel message */ -#define BUFLEN 1024 - -/* Logging node */ -#define LOGDEV "/dev/kmsg" - -/* Max length of ID string */ -#define MAXID 31 /* MAXID+5 must be < BUFLEN */ - -int __syslog_fd = -1; -static char id[MAXID+1]; -static int syslog_flags = 0; - -void openlog(const char *ident, int option, int facility) -{ - int fd; - - (void)option; (void)facility; /* Unused */ - - if ( __syslog_fd == -1 ) { - __syslog_fd = fd = open(LOGDEV, O_WRONLY); - if ( fd == -1 ) - return; - fcntl(fd, F_SETFD, (long)FD_CLOEXEC); - } - - syslog_flags = option; - - strncpy(id, ident?ident:"", MAXID); -} - -void vsyslog(int prio, const char *format, va_list ap) -{ - char buf[BUFLEN]; - int len; - int fd; - - if ( __syslog_fd == -1 ) - openlog(NULL, 0, 0); - - buf[0] = '<'; - buf[1] = LOG_PRI(prio)+'0'; - buf[2] = '>'; - len = 3; - - if ( syslog_flags & LOG_PID ) - len += sprintf(buf+3, "%s[%u]: ", id, getpid()); - else if ( *id ) - len += sprintf(buf+3, "%s: ", id); - - len += vsnprintf(buf+len, BUFLEN-len, format, ap); - - if ( len > BUFLEN-1 ) len = BUFLEN-1; - if (buf[len-1] != '\n') - buf[len++] = '\n'; - - fd = __syslog_fd; - if ( fd == -1 ) - fd = 2; /* Failed to open log, write to stderr */ - - write(fd, buf, len); - - if ( syslog_flags & LOG_PERROR ) - _fwrite(buf+3, len-3, stderr); -} - -void syslog(int prio, const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - vsyslog(prio, format, ap); - va_end(ap); -} diff --git a/klibc/klibc/system.c b/klibc/klibc/system.c deleted file mode 100644 index 643bf5e1cc..0000000000 --- a/klibc/klibc/system.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * system.c - * - * The system() function. If this turns out to actually be *used*, - * we may want to try to detect the very simple cases (no shell magic) - * and handle them internally, instead of requiring that /bin/sh be - * present. - */ - -#include -#include -#include -#include -#include - -int system(const char *string) -{ - pid_t pid; - struct sigaction ignore, old_int, old_quit; - sigset_t masked, oldmask; - static const char *argv[] = { "/bin/sh", "-c", NULL, NULL }; - int status; - - /* Block SIGCHLD and ignore SIGINT and SIGQUIT */ - /* Do this before the fork() to avoid races */ - - ignore.sa_handler = SIG_IGN; - sigemptyset(&ignore.sa_mask); - ignore.sa_flags = 0; - sigaction(SIGINT, &ignore, &old_int); - sigaction(SIGQUIT, &ignore, &old_quit); - - sigemptyset(&masked); - sigaddset(&masked, SIGCHLD); - sigprocmask(SIG_BLOCK, &masked, &oldmask); - - pid = fork(); - - if ( pid < 0 ) - return -1; - else if ( pid == 0 ) { - sigaction(SIGINT, &old_int, NULL); - sigaction(SIGQUIT, &old_quit, NULL); - sigprocmask(SIG_SETMASK, &oldmask, NULL); - - argv[2] = string; - - execve(argv[0], (char * const *)argv, (char * const *)environ); - _exit(127); - } - - /* else... */ - - waitpid(pid, &status, 0); - - sigaction(SIGINT, &old_int, NULL); - sigaction(SIGQUIT, &old_quit, NULL); - sigprocmask(SIG_SETMASK, &oldmask, NULL); - - return status; -} diff --git a/klibc/klibc/sysv_signal.c b/klibc/klibc/sysv_signal.c deleted file mode 100644 index 3e55a02bb5..0000000000 --- a/klibc/klibc/sysv_signal.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * sysv_signal.c - */ - -#include - -__sighandler_t sysv_signal(int signum, __sighandler_t handler) -{ - /* Linux/SysV signal() semantics */ - return __signal(signum, handler, SA_RESETHAND); -} diff --git a/klibc/klibc/time.c b/klibc/klibc/time.c deleted file mode 100644 index 92f82ccee0..0000000000 --- a/klibc/klibc/time.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * time.c - */ - -#include -#include -#include - -#ifndef __NR_time - -time_t time(time_t *t) -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - - if ( t ) - *t = (time_t)tv.tv_sec; - - return (time_t)tv.tv_sec; -} - -#endif diff --git a/klibc/klibc/umount.c b/klibc/klibc/umount.c deleted file mode 100644 index 9a8e62a779..0000000000 --- a/klibc/klibc/umount.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * umount.c - * - * Single-argument form of umount - */ - -#include - -int umount(const char *dir) -{ - return umount2(dir, 0); -} diff --git a/klibc/klibc/unsetenv.c b/klibc/klibc/unsetenv.c deleted file mode 100644 index 5f39f3d8f9..0000000000 --- a/klibc/klibc/unsetenv.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * unsetenv.c - */ - -#include -#include -#include -#include - -int unsetenv(const char *name) -{ - size_t len; - char **p, *q; - const char *z; - - if ( !name || !name[0] ) { - errno = EINVAL; - return -1; - } - - len = 0; - for ( z = name ; *z ; z++ ) { - len++; - if ( *z == '=' ) { - errno = EINVAL; - return -1; - } - } - - for ( p = environ ; (q = *p) ; p++ ) { - if ( !strncmp(name,q,len) && q[len] == '=' ) - break; - } - - for ( ; (q = *p) ; p++ ) { - p[0] = p[1]; - } - - return 0; -} diff --git a/klibc/klibc/usleep.c b/klibc/klibc/usleep.c deleted file mode 100644 index b63352eebf..0000000000 --- a/klibc/klibc/usleep.c +++ /dev/null @@ -1,15 +0,0 @@ -/* - * usleep.c - */ - -#include -#include - -void usleep(unsigned long usec) -{ - struct timespec ts; - - ts.tv_sec = usec/1000000UL; - ts.tv_nsec = (usec%1000000UL) * 1000; - while ( nanosleep(&ts,&ts) == -1 && errno == EINTR ); -} diff --git a/klibc/klibc/utime.c b/klibc/klibc/utime.c deleted file mode 100644 index 2c8607756a..0000000000 --- a/klibc/klibc/utime.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * utime.c - */ - -#include -#include -#include -#include - -#ifndef __NR_utime - -int utime(const char *filename, const struct utimbuf *buf) -{ - struct timeval tvp[2]; - - tvp[0].tv_sec = buf->actime; - tvp[0].tv_usec = 0; - tvp[1].tv_sec = buf->modtime; - tvp[1].tv_usec = 0; - - return utimes(filename, tvp); -} - -#endif diff --git a/klibc/klibc/vasprintf.c b/klibc/klibc/vasprintf.c deleted file mode 100644 index 657bfdc3ef..0000000000 --- a/klibc/klibc/vasprintf.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * vasprintf.c - */ - -#include -#include -#include - -int vasprintf(char **bufp, const char *format, va_list ap) -{ - va_list ap1; - int bytes; - char *p; - - va_copy(ap1, ap); - - bytes = vsnprintf(NULL, 0, format, ap1) + 1; - va_end(ap1); - - *bufp = p = malloc(bytes); - if ( !p ) - return -1; - - return vsnprintf(p, bytes, format, ap); -} diff --git a/klibc/klibc/vfprintf.c b/klibc/klibc/vfprintf.c deleted file mode 100644 index 39cf9838f6..0000000000 --- a/klibc/klibc/vfprintf.c +++ /dev/null @@ -1,26 +0,0 @@ -/* - * vfprintf.c - */ - -#include -#include -#include -#include - -#define BUFFER_SIZE 32768 - -int vfprintf(FILE *file, const char *format, va_list ap) -{ - int rv; - char buffer[BUFFER_SIZE]; - - rv = vsnprintf(buffer, BUFFER_SIZE, format, ap); - - if ( rv < 0 ) - return rv; - - if ( rv > BUFFER_SIZE-1 ) - rv = BUFFER_SIZE-1; - - return _fwrite(buffer, rv, file); -} diff --git a/klibc/klibc/vprintf.c b/klibc/klibc/vprintf.c deleted file mode 100644 index 7d6066586f..0000000000 --- a/klibc/klibc/vprintf.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * vprintf.c - */ - -#include -#include - -int vprintf(const char *format, va_list ap) -{ - return vfprintf(stdout, format, ap); -} diff --git a/klibc/klibc/vsnprintf.c b/klibc/klibc/vsnprintf.c deleted file mode 100644 index 5cb9331954..0000000000 --- a/klibc/klibc/vsnprintf.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * vsnprintf.c - * - * vsnprintf(), from which the rest of the printf() - * family is built - */ - -#include -#include -#include -#include -#include -#include - -enum flags { - FL_ZERO = 0x01, /* Zero modifier */ - FL_MINUS = 0x02, /* Minus modifier */ - FL_PLUS = 0x04, /* Plus modifier */ - FL_TICK = 0x08, /* ' modifier */ - FL_SPACE = 0x10, /* Space modifier */ - FL_HASH = 0x20, /* # modifier */ - FL_SIGNED = 0x40, /* Number is signed */ - FL_UPPER = 0x80 /* Upper case digits */ -}; - -/* These may have to be adjusted on certain implementations */ -enum ranks { - rank_char = -2, - rank_short = -1, - rank_int = 0, - rank_long = 1, - rank_longlong = 2 -}; - -#define MIN_RANK rank_char -#define MAX_RANK rank_longlong - -#define INTMAX_RANK rank_longlong -#define SIZE_T_RANK rank_long -#define PTRDIFF_T_RANK rank_long - -#define EMIT(x) ({ if (o nchars ) { - while ( width > nchars ) { - EMIT(' '); - width--; - } - } - - /* Emit nondigits */ - if ( minus ) - EMIT('-'); - else if ( flags & FL_PLUS ) - EMIT('+'); - else if ( flags & FL_SPACE ) - EMIT(' '); - - if ( (flags & FL_HASH) && base == 16 ) { - EMIT('0'); - EMIT((flags & FL_UPPER) ? 'X' : 'x'); - } - - /* Emit zero padding */ - if ( (flags & (FL_MINUS|FL_ZERO)) == FL_ZERO && width > ndigits ) { - while ( width > nchars ) { - EMIT('0'); - width--; - } - } - - /* Generate the number. This is done from right to left. */ - q += ndigits; /* Advance the pointer to end of number */ - o += ndigits; - qq = q; oo = o; /* Temporary values */ - - b4tick = tickskip; - while ( ndigits > 0 ) { - if ( !b4tick-- ) { - qq--; oo--; ndigits--; - if ( oo < n ) *qq = '_'; - b4tick = tickskip-1; - } - qq--; oo--; ndigits--; - if ( oo < n ) *qq = digits[val%base]; - val /= base; - } - - /* Emit late space padding */ - while ( (flags & FL_MINUS) && width > nchars ) { - EMIT(' '); - width--; - } - - return o; -} - - -int vsnprintf(char *buffer, size_t n, const char *format, va_list ap) -{ - const char *p = format; - char ch; - char *q = buffer; - size_t o = 0; /* Number of characters output */ - uintmax_t val = 0; - int rank = rank_int; /* Default rank */ - int width = 0; - int prec = -1; - int base; - size_t sz; - enum flags flags = 0; - enum { - st_normal, /* Ground state */ - st_flags, /* Special flags */ - st_width, /* Field width */ - st_prec, /* Field precision */ - st_modifiers /* Length or conversion modifiers */ - } state = st_normal; - const char *sarg; /* %s string argument */ - char carg; /* %c char argument */ - int slen; /* String length */ - - while ( (ch = *p++) ) { - switch ( state ) { - case st_normal: - if ( ch == '%' ) { - state = st_flags; - flags = 0; rank = rank_int; width = 0; prec = -1; - } else { - EMIT(ch); - } - break; - - case st_flags: - switch ( ch ) { - case '-': - flags |= FL_MINUS; - break; - case '+': - flags |= FL_PLUS; - break; - case '\'': - flags |= FL_TICK; - break; - case ' ': - flags |= FL_SPACE; - break; - case '#': - flags |= FL_HASH; - break; - case '0': - flags |= FL_ZERO; - break; - default: - state = st_width; - p--; /* Process this character again */ - break; - } - break; - - case st_width: - if ( ch >= '0' && ch <= '9' ) { - width = width*10+(ch-'0'); - } else if ( ch == '*' ) { - width = va_arg(ap, int); - if ( width < 0 ) { - width = -width; - flags |= FL_MINUS; - } - } else if ( ch == '.' ) { - prec = 0; /* Precision given */ - state = st_prec; - } else { - state = st_modifiers; - p--; /* Process this character again */ - } - break; - - case st_prec: - if ( ch >= '0' && ch <= '9' ) { - prec = prec*10+(ch-'0'); - } else if ( ch == '*' ) { - prec = va_arg(ap, int); - if ( prec < 0 ) - prec = -1; - } else { - state = st_modifiers; - p--; /* Process this character again */ - } - break; - - case st_modifiers: - switch ( ch ) { - /* Length modifiers - nonterminal sequences */ - case 'h': - rank--; /* Shorter rank */ - break; - case 'l': - rank++; /* Longer rank */ - break; - case 'j': - rank = INTMAX_RANK; - break; - case 'z': - rank = SIZE_T_RANK; - break; - case 't': - rank = PTRDIFF_T_RANK; - break; - case 'L': - case 'q': - rank += 2; - break; - default: - /* Output modifiers - terminal sequences */ - state = st_normal; /* Next state will be normal */ - if ( rank < MIN_RANK ) /* Canonicalize rank */ - rank = MIN_RANK; - else if ( rank > MAX_RANK ) - rank = MAX_RANK; - - switch ( ch ) { - case 'P': /* Upper case pointer */ - flags |= FL_UPPER; - /* fall through */ - case 'p': /* Pointer */ - base = 16; - prec = (CHAR_BIT*sizeof(void *)+3)/4; - flags |= FL_HASH; - val = (uintmax_t)(uintptr_t)va_arg(ap, void *); - goto is_integer; - - case 'd': /* Signed decimal output */ - case 'i': - base = 10; - flags |= FL_SIGNED; - switch (rank) { - case rank_char: - /* Yes, all these casts are needed... */ - val = (uintmax_t)(intmax_t)(signed char)va_arg(ap, signed int); - break; - case rank_short: - val = (uintmax_t)(intmax_t)(signed short)va_arg(ap, signed int); - break; - case rank_int: - val = (uintmax_t)(intmax_t)va_arg(ap, signed int); - break; - case rank_long: - val = (uintmax_t)(intmax_t)va_arg(ap, signed long); - break; - case rank_longlong: - val = (uintmax_t)(intmax_t)va_arg(ap, signed long long); - break; - } - goto is_integer; - case 'o': /* Octal */ - base = 8; - goto is_unsigned; - case 'u': /* Unsigned decimal */ - base = 10; - goto is_unsigned; - case 'X': /* Upper case hexadecimal */ - flags |= FL_UPPER; - /* fall through */ - case 'x': /* Hexadecimal */ - base = 16; - goto is_unsigned; - - is_unsigned: - switch (rank) { - case rank_char: - val = (uintmax_t)(unsigned char)va_arg(ap, unsigned int); - break; - case rank_short: - val = (uintmax_t)(unsigned short)va_arg(ap, unsigned int); - break; - case rank_int: - val = (uintmax_t)va_arg(ap, unsigned int); - break; - case rank_long: - val = (uintmax_t)va_arg(ap, unsigned long); - break; - case rank_longlong: - val = (uintmax_t)va_arg(ap, unsigned long long); - break; - } - /* fall through */ - - is_integer: - sz = format_int(q, (o prec ) - slen = prec; - - if ( width > slen && !(flags & FL_MINUS) ) { - char pad = (flags & FL_ZERO) ? '0' : ' '; - while ( width > slen ) { - EMIT(pad); - width--; - } - } - for ( i = slen ; i ; i-- ) { - sch = *sarg++; - EMIT(sch); - } - if ( width > slen && (flags & FL_MINUS) ) { - while ( width > slen ) { - EMIT(' '); - width--; - } - } - } - break; - - case 'n': /* Output the number of characters written */ - { - switch (rank) { - case rank_char: - *va_arg(ap, signed char *) = o; - break; - case rank_short: - *va_arg(ap, signed short *) = o; - break; - case rank_int: - *va_arg(ap, signed int *) = o; - break; - case rank_long: - *va_arg(ap, signed long *) = o; - break; - case rank_longlong: - *va_arg(ap, signed long long *) = o; - break; - } - } - break; - - default: /* Anything else, including % */ - EMIT(ch); - break; - } - } - } - } - - /* Null-terminate the string */ - if ( o0 ) - buffer[n-1] = '\0'; /* Overflow - terminate at end of buffer */ - - return o; -} diff --git a/klibc/klibc/vsprintf.c b/klibc/klibc/vsprintf.c deleted file mode 100644 index 4a6100e70c..0000000000 --- a/klibc/klibc/vsprintf.c +++ /dev/null @@ -1,11 +0,0 @@ -/* - * vsprintf.c - */ - -#include -#include - -int vsprintf(char *buffer, const char *format, va_list ap) -{ - return vsnprintf(buffer, ~(size_t)0, format, ap); -} diff --git a/klibc/klibc/vsscanf.c b/klibc/klibc/vsscanf.c deleted file mode 100644 index 12a82b2747..0000000000 --- a/klibc/klibc/vsscanf.c +++ /dev/null @@ -1,365 +0,0 @@ -/* - * vsscanf.c - * - * vsscanf(), from which the rest of the scanf() - * family is built - */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef LONG_BIT -#define LONG_BIT (CHAR_BIT*sizeof(long)) -#endif - -enum flags { - FL_SPLAT = 0x01, /* Drop the value, do not assign */ - FL_INV = 0x02, /* Character-set with inverse */ - FL_WIDTH = 0x04, /* Field width specified */ - FL_MINUS = 0x08, /* Negative number */ -}; - -enum ranks { - rank_char = -2, - rank_short = -1, - rank_int = 0, - rank_long = 1, - rank_longlong = 2, - rank_ptr = INT_MAX /* Special value used for pointers */ -}; - -#define MIN_RANK rank_char -#define MAX_RANK rank_longlong - -#define INTMAX_RANK rank_longlong -#define SIZE_T_RANK rank_long -#define PTRDIFF_T_RANK rank_long - -enum bail { - bail_none = 0, /* No error condition */ - bail_eof, /* Hit EOF */ - bail_err /* Conversion mismatch */ -}; - -static inline const char * -skipspace(const char *p) -{ - while ( isspace((unsigned char)*p) ) p++; - return p; -} - -#undef set_bit -static inline void -set_bit(unsigned long *bitmap, unsigned int bit) -{ - bitmap[bit/LONG_BIT] |= 1UL << (bit%LONG_BIT); -} - -#undef test_bit -static inline int -test_bit(unsigned long *bitmap, unsigned int bit) -{ - return (int)(bitmap[bit/LONG_BIT] >> (bit%LONG_BIT)) & 1; -} - -int vsscanf(const char *buffer, const char *format, va_list ap) -{ - const char *p = format; - char ch; - const char *q = buffer; - const char *qq; - uintmax_t val = 0; - int rank = rank_int; /* Default rank */ - unsigned int width = UINT_MAX; - int base; - enum flags flags = 0; - enum { - st_normal, /* Ground state */ - st_flags, /* Special flags */ - st_width, /* Field width */ - st_modifiers, /* Length or conversion modifiers */ - st_match_init, /* Initial state of %[ sequence */ - st_match, /* Main state of %[ sequence */ - st_match_range, /* After - in a %[ sequence */ - } state = st_normal; - char *sarg = NULL; /* %s %c or %[ string argument */ - enum bail bail = bail_none; - int sign; - int converted = 0; /* Successful conversions */ - unsigned long matchmap[((1 << CHAR_BIT)+(LONG_BIT-1))/LONG_BIT]; - int matchinv = 0; /* Is match map inverted? */ - unsigned char range_start = 0; - - while ( (ch = *p++) && !bail ) { - switch ( state ) { - case st_normal: - if ( ch == '%' ) { - state = st_flags; - flags = 0; rank = rank_int; width = UINT_MAX; - } else if ( isspace((unsigned char)ch) ) { - q = skipspace(q); - } else { - if ( *q == ch ) - q++; - else - bail = bail_err; /* Match failure */ - } - break; - - case st_flags: - switch ( ch ) { - case '*': - flags |= FL_SPLAT; - break; - case '0' ... '9': - width = (ch-'0'); - state = st_width; - flags |= FL_WIDTH; - break; - default: - state = st_modifiers; - p--; /* Process this character again */ - break; - } - break; - - case st_width: - if ( ch >= '0' && ch <= '9' ) { - width = width*10+(ch-'0'); - } else { - state = st_modifiers; - p--; /* Process this character again */ - } - break; - - case st_modifiers: - switch ( ch ) { - /* Length modifiers - nonterminal sequences */ - case 'h': - rank--; /* Shorter rank */ - break; - case 'l': - rank++; /* Longer rank */ - break; - case 'j': - rank = INTMAX_RANK; - break; - case 'z': - rank = SIZE_T_RANK; - break; - case 't': - rank = PTRDIFF_T_RANK; - break; - case 'L': - case 'q': - rank = rank_longlong; /* long double/long long */ - break; - - default: - /* Output modifiers - terminal sequences */ - state = st_normal; /* Next state will be normal */ - if ( rank < MIN_RANK ) /* Canonicalize rank */ - rank = MIN_RANK; - else if ( rank > MAX_RANK ) - rank = MAX_RANK; - - switch ( ch ) { - case 'P': /* Upper case pointer */ - case 'p': /* Pointer */ -#if 0 /* Enable this to allow null pointers by name */ - q = skipspace(q); - if ( !isdigit((unsigned char)*q) ) { - static const char * const nullnames[] = - { "null", "nul", "nil", "(null)", "(nul)", "(nil)", 0 }; - const char * const *np; - - /* Check to see if it's a null pointer by name */ - for ( np = nullnames ; *np ; np++ ) { - if ( !strncasecmp(q, *np, strlen(*np)) ) { - val = (uintmax_t)((void *)NULL); - goto set_integer; - } - } - /* Failure */ - bail = bail_err; - break; - } - /* else */ -#endif - rank = rank_ptr; - base = 0; sign = 0; - goto scan_int; - - case 'i': /* Base-independent integer */ - base = 0; sign = 1; - goto scan_int; - - case 'd': /* Decimal integer */ - base = 10; sign = 1; - goto scan_int; - - case 'o': /* Octal integer */ - base = 8; sign = 0; - goto scan_int; - - case 'u': /* Unsigned decimal integer */ - base = 10; sign = 0; - goto scan_int; - - case 'x': /* Hexadecimal integer */ - case 'X': - base = 16; sign = 0; - goto scan_int; - - case 'n': /* Number of characters consumed */ - val = (q-buffer); - goto set_integer; - - scan_int: - q = skipspace(q); - if ( !*q ) { - bail = bail_eof; - break; - } - val = strntoumax(q, (char **)&qq, base, width); - if ( qq == q ) { - bail = bail_err; - break; - } - q = qq; - converted++; - /* fall through */ - - set_integer: - if ( !(flags & FL_SPLAT) ) { - switch(rank) { - case rank_char: - *va_arg(ap, unsigned char *) = (unsigned char)val; - break; - case rank_short: - *va_arg(ap, unsigned short *) = (unsigned short)val; - break; - case rank_int: - *va_arg(ap, unsigned int *) = (unsigned int)val; - break; - case rank_long: - *va_arg(ap, unsigned long *) = (unsigned long)val; - break; - case rank_longlong: - *va_arg(ap, unsigned long long *) = (unsigned long long)val; - break; - case rank_ptr: - *va_arg(ap, void **) = (void *)(uintptr_t)val; - break; - } - } - break; - - case 'c': /* Character */ - width = (flags & FL_WIDTH) ? width : 1; /* Default width == 1 */ - sarg = va_arg(ap, char *); - while ( width-- ) { - if ( !*q ) { - bail = bail_eof; - break; - } - *sarg++ = *q++; - } - if ( !bail ) - converted++; - break; - - case 's': /* String */ - { - char *sp; - sp = sarg = va_arg(ap, char *); - while ( width-- && *q && !isspace((unsigned char)*q) ) { - *sp++ = *q++; - } - if ( sarg != sp ) { - *sp = '\0'; /* Terminate output */ - converted++; - } else { - bail = bail_eof; - } - } - break; - - case '[': /* Character range */ - sarg = va_arg(ap, char *); - state = st_match_init; - matchinv = 0; - memset(matchmap, 0, sizeof matchmap); - break; - - case '%': /* %% sequence */ - if ( *q == '%' ) - q++; - else - bail = bail_err; - break; - - default: /* Anything else */ - bail = bail_err; /* Unknown sequence */ - break; - } - } - break; - - case st_match_init: /* Initial state for %[ match */ - if ( ch == '^' && !(flags & FL_INV) ) { - matchinv = 1; - } else { - set_bit(matchmap, (unsigned char)ch); - state = st_match; - } - break; - - case st_match: /* Main state for %[ match */ - if ( ch == ']' ) { - goto match_run; - } else if ( ch == '-' ) { - range_start = (unsigned char)ch; - state = st_match_range; - } else { - set_bit(matchmap, (unsigned char)ch); - } - break; - - case st_match_range: /* %[ match after - */ - if ( ch == ']' ) { - set_bit(matchmap, (unsigned char)'-'); /* - was last character */ - goto match_run; - } else { - int i; - for ( i = range_start ; i < (unsigned char)ch ; i++ ) - set_bit(matchmap, i); - state = st_match; - } - break; - - match_run: /* Match expression finished */ - qq = q; - while ( width && *q && test_bit(matchmap, (unsigned char)*q)^matchinv ) { - *sarg++ = *q++; - } - if ( q != qq ) { - *sarg = '\0'; - converted++; - } else { - bail = *q ? bail_err : bail_eof; - } - break; - } - } - - if ( bail == bail_eof && !converted ) - converted = -1; /* Return EOF (-1) */ - - return converted; -} diff --git a/klibc/klibc/wait.c b/klibc/klibc/wait.c deleted file mode 100644 index 5e0bbe29c5..0000000000 --- a/klibc/klibc/wait.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * wait.c - */ - -#include -#include -#include - -pid_t wait(int *status) -{ - return wait4((pid_t)-1, status, 0, NULL); -} diff --git a/klibc/klibc/wait3.c b/klibc/klibc/wait3.c deleted file mode 100644 index 48840ad155..0000000000 --- a/klibc/klibc/wait3.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * wait3.c - */ - -#include -#include -#include - -pid_t wait3(int *status, int options, struct rusage *rusage) -{ - return wait4((pid_t)-1, status, options, rusage); -} diff --git a/klibc/klibc/waitpid.c b/klibc/klibc/waitpid.c deleted file mode 100644 index f7c5cbfbc0..0000000000 --- a/klibc/klibc/waitpid.c +++ /dev/null @@ -1,12 +0,0 @@ -/* - * waitpid.c - */ - -#include -#include -#include - -pid_t waitpid(pid_t pid, int *status, int options) -{ - return wait4(pid, status, options, NULL); -} diff --git a/klibc/klibc/zlib/FAQ b/klibc/klibc/zlib/FAQ deleted file mode 100644 index 7115ec38d6..0000000000 --- a/klibc/klibc/zlib/FAQ +++ /dev/null @@ -1,315 +0,0 @@ - - Frequently Asked Questions about zlib - - -If your question is not there, please check the zlib home page -http://www.zlib.org which may have more recent information. -The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html - - - 1. Is zlib Y2K-compliant? - - Yes. zlib doesn't handle dates. - - 2. Where can I get a Windows DLL version? - - The zlib sources can be compiled without change to produce a DLL. - See the file win32/DLL_FAQ.txt in the zlib distribution. - Pointers to the precompiled DLL are found in the zlib web site at - http://www.zlib.org. - - 3. Where can I get a Visual Basic interface to zlib? - - See - * http://www.winimage.com/zLibDll/ - * http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm - * contrib/visual-basic.txt in the zlib distribution - - 4. compress() returns Z_BUF_ERROR - - Make sure that before the call of compress, the length of the compressed - buffer is equal to the total size of the compressed buffer and not - zero. For Visual Basic, check that this parameter is passed by reference - ("as any"), not by value ("as long"). - - 5. deflate() or inflate() returns Z_BUF_ERROR - - Before making the call, make sure that avail_in and avail_out are not - zero. When setting the parameter flush equal to Z_FINISH, also make sure - that avail_out is big enough to allow processing all pending input. - Note that a Z_BUF_ERROR is not fatal--another call to deflate() or - inflate() can be made with more input or output space. A Z_BUF_ERROR - may in fact be unavoidable depending on how the functions are used, since - it is not possible to tell whether or not there is more output pending - when strm.avail_out returns with zero. - - 6. Where's the zlib documentation (man pages, etc.)? - - It's in zlib.h for the moment, and Francis S. Lin has converted it to a - web page zlib.html. Volunteers to transform this to Unix-style man pages, - please contact Jean-loup Gailly (jloup@gzip.org). Examples of zlib usage - are in the files example.c and minigzip.c. - - 7. Why don't you use GNU autoconf or libtool or ...? - - Because we would like to keep zlib as a very small and simple - package. zlib is rather portable and doesn't need much configuration. - - 8. I found a bug in zlib. - - Most of the time, such problems are due to an incorrect usage of - zlib. Please try to reproduce the problem with a small program and send - the corresponding source to us at zlib@gzip.org . Do not send - multi-megabyte data files without prior agreement. - - 9. Why do I get "undefined reference to gzputc"? - - If "make test" produces something like - - example.o(.text+0x154): undefined reference to `gzputc' - - check that you don't have old files libz.* in /usr/lib, /usr/local/lib or - /usr/X11R6/lib. Remove any old versions, then do "make install". - -10. I need a Delphi interface to zlib. - - See the contrib/delphi directory in the zlib distribution. - -11. Can zlib handle .zip archives? - - See the directory contrib/minizip in the zlib distribution. - -12. Can zlib handle .Z files? - - No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt - the code of uncompress on your own. - -13. How can I make a Unix shared library? - - make clean - ./configure -s - make - -14. How do I install a shared zlib library on Unix? - - make install - - However, many flavors of Unix come with a shared zlib already installed. - Before going to the trouble of compiling a shared version of zlib and - trying to install it, you may want to check if it's already there! If you - can #include , it's there. The -lz option will probably link to it. - -15. I have a question about OttoPDF - - We are not the authors of OttoPDF. The real author is on the OttoPDF web - site Joel Hainley jhainley@myndkryme.com. - -16. Why does gzip give an error on a file I make with compress/deflate? - - The compress and deflate functions produce data in the zlib format, which - is different and incompatible with the gzip format. The gz* functions in - zlib on the other hand use the gzip format. Both the zlib and gzip - formats use the same compressed data format internally, but have different - headers and trailers around the compressed data. - -17. Ok, so why are there two different formats? - - The gzip format was designed to retain the directory information about - a single file, such as the name and last modification date. The zlib - format on the other hand was designed for in-memory and communication - channel applications, and has a much more compact header and trailer and - uses a faster integrity check than gzip. - -18. Well that's nice, but how do I make a gzip file in memory? - - You can request that deflate write the gzip format instead of the zlib - format using deflateInit2(). You can also request that inflate decode - the gzip format using inflateInit2(). Read zlib.h for more details. - - Note that you cannot specify special gzip header contents (e.g. a file - name or modification date), nor will inflate tell you what was in the - gzip header. If you need to customize the header or see what's in it, - you can use the raw deflate and inflate operations and the crc32() - function and roll your own gzip encoding and decoding. Read the gzip - RFC 1952 for details of the header and trailer format. - -19. Is zlib thread-safe? - - Yes. However any library routines that zlib uses and any application- - provided memory allocation routines must also be thread-safe. zlib's gz* - functions use stdio library routines, and most of zlib's functions use the - library memory allocation routines by default. zlib's Init functions allow - for the application to provide custom memory allocation routines. - - Of course, you should only operate on any given zlib or gzip stream from a - single thread at a time. - -20. Can I use zlib in my commercial application? - - Yes. Please read the license in zlib.h. - -21. Is zlib under the GNU license? - - No. Please read the license in zlib.h. - -22. The license says that altered source versions must be "plainly marked". So - what exactly do I need to do to meet that requirement? - - You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In - particular, the final version number needs to be changed to "f", and an - identification string should be appended to ZLIB_VERSION. Version numbers - x.x.x.f are reserved for modifications to zlib by others than the zlib - maintainers. For example, if the version of the base zlib you are altering - is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and - ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also - update the version strings in deflate.c and inftrees.c. - - For altered source distributions, you should also note the origin and - nature of the changes in zlib.h, as well as in ChangeLog and README, along - with the dates of the alterations. The origin should include at least your - name (or your company's name), and an email address to contact for help or - issues with the library. - - Note that distributing a compiled zlib library along with zlib.h and - zconf.h is also a source distribution, and so you should change - ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes - in zlib.h as you would for a full source distribution. - -23. Will zlib work on a big-endian or little-endian architecture, and can I - exchange compressed data between them? - - Yes and yes. - -24. Will zlib work on a 64-bit machine? - - It should. It has been tested on 64-bit machines, and has no dependence - on any data types being limited to 32-bits in length. If you have any - difficulties, please provide a complete problem report to zlib@gzip.org - -25. Will zlib decompress data from the PKWare Data Compression Library? - - No. The PKWare DCL uses a completely different compressed data format - than does PKZIP and zlib. However, you can look in zlib's contrib/blast - directory for a possible solution to your problem. - -26. Can I access data randomly in a compressed stream? - - No, not without some preparation. If when compressing you periodically - use Z_FULL_FLUSH, carefully write all the pending data at those points, - and keep an index of those locations, then you can start decompression - at those points. You have to be careful to not use Z_FULL_FLUSH too - often, since it can significantly degrade compression. - -27. Does zlib work on MVS, OS/390, CICS, etc.? - - We don't know for sure. We have heard occasional reports of success on - these systems. If you do use it on one of these, please provide us with - a report, instructions, and patches that we can reference when we get - these questions. Thanks. - -28. Is there some simpler, easier to read version of inflate I can look at - to understand the deflate format? - - First off, you should read RFC 1951. Second, yes. Look in zlib's - contrib/puff directory. - -29. Does zlib infringe on any patents? - - As far as we know, no. In fact, that was originally the whole point behind - zlib. Look here for some more information: - - http://www.gzip.org/#faq11 - -30. Can zlib work with greater than 4 GB of data? - - Yes. inflate() and deflate() will process any amount of data correctly. - Each call of inflate() or deflate() is limited to input and output chunks - of the maximum value that can be stored in the compiler's "unsigned int" - type, but there is no limit to the number of chunks. Note however that the - strm.total_in and strm_total_out counters may be limited to 4 GB. These - counters are provided as a convenience and are not used internally by - inflate() or deflate(). The application can easily set up its own counters - updated after each call of inflate() or deflate() to count beyond 4 GB. - compress() and uncompress() may be limited to 4 GB, since they operate in a - single call. gzseek() and gztell() may be limited to 4 GB depending on how - zlib is compiled. See the zlibCompileFlags() function in zlib.h. - - The word "may" appears several times above since there is a 4 GB limit - only if the compiler's "long" type is 32 bits. If the compiler's "long" - type is 64 bits, then the limit is 16 exabytes. - -31. Does zlib have any security vulnerabilities? - - The only one that we are aware of is potentially in gzprintf(). If zlib - is compiled to use sprintf() or vsprintf(), then there is no protection - against a buffer overflow of a 4K string space, other than the caller of - gzprintf() assuring that the output will not exceed 4K. On the other - hand, if zlib is compiled to use snprintf() or vsnprintf(), which should - normally be the case, then there is no vulnerability. The ./configure - script will display warnings if an insecure variation of sprintf() will - be used by gzprintf(). Also the zlibCompileFlags() function will return - information on what variant of sprintf() is used by gzprintf(). - - If you don't have snprintf() or vsnprintf() and would like one, you can - find a portable implementation here: - - http://www.ijs.si/software/snprintf/ - - Note that you should be using the most recent version of zlib. Versions - 1.1.3 and before were subject to a double-free vulnerability. - -32. Is there a Java version of zlib? - - Probably what you want is to use zlib in Java. zlib is already included - as part of the Java SDK in the java.util.zip package. If you really want - a version of zlib written in the Java language, look on the zlib home - page for links: http://www.zlib.org/ - -33. I get this or that compiler or source-code scanner warning when I crank it - up to maximally-pendantic. Can't you guys write proper code? - - Many years ago, we gave up attempting to avoid warnings on every compiler - in the universe. It just got to be a waste of time, and some compilers - were downright silly. So now, we simply make sure that the code always - works. - -34. Will zlib read the (insert any ancient or arcane format here) compressed - data format? - - Probably not. Look in the comp.compression FAQ for pointers to various - formats and associated software. - -35. How can I encrypt/decrypt zip files with zlib? - - zlib doesn't support encryption. The original PKZIP encryption is very weak - and can be broken with freely available programs. To get strong encryption, - use gpg ( http://www.gnupg.org/ ) which already includes zlib compression. - For PKZIP compatible "encryption", look at http://www.info-zip.org/ - -36. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? - - "gzip" is the gzip format, and "deflate" is the zlib format. They should - probably have called the second one "zlib" instead to avoid confusion - with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 - correctly points to the zlib specification in RFC 1950 for the "deflate" - transfer encoding, there have been reports of servers and browsers that - incorrectly produce or expect raw deflate data per the deflate - specficiation in RFC 1951, most notably Microsoft. So even though the - "deflate" transfer encoding using the zlib format would be the more - efficient approach (and in fact exactly what the zlib format was designed - for), using the "gzip" transfer encoding is probably more reliable due to - an unfortunate choice of name on the part of the HTTP 1.1 authors. - - Bottom line: use the gzip format for HTTP 1.1 encoding. - -37. Does zlib support the new "Deflate64" format introduced by PKWare? - - No. PKWare has apparently decided to keep that format proprietary, since - they have not documented it as they have previous compression formats. - In any case, the compression improvements are so modest compared to other - more modern approaches, that it's not worth the effort to implement. - -38. Can you please sign these lengthy legal documents and fax them back to us - so that we can use your software in our product? - - No. Go away. Shoo. diff --git a/klibc/klibc/zlib/INDEX b/klibc/klibc/zlib/INDEX deleted file mode 100644 index a9de7844d1..0000000000 --- a/klibc/klibc/zlib/INDEX +++ /dev/null @@ -1,48 +0,0 @@ -ChangeLog history of changes -FAQ Frequently Asked Questions about zlib -INDEX this file -Makefile makefile for Unix (generated by configure) -Makefile.in makefile for Unix (template for configure) -README guess what -algorithm.txt description of the (de)compression algorithm -configure configure script for Unix -zconf.in.h template for zconf.h (used by configure) - -msdos/ makefiles for MSDOS -old/ makefiles for various architectures and zlib documentation - files that have not yet been updated for zlib 1.2.x -qnx/ makefiles for QNX -win32/ makefiles for Windows - - zlib public header files (must be kept): -zconf.h -zlib.h - - private source files used to build the zlib library: -adler32.c -compress.c -crc32.c -crc32.h -deflate.c -deflate.h -gzio.c -infback.c -inffast.c -inffast.h -inffixed.h -inflate.c -inflate.h -inftrees.c -inftrees.h -trees.c -trees.h -uncompr.c -zutil.c -zutil.h - - source files for sample programs: -example.c -minigzip.c - - unsupported contribution by third parties -See contrib/README.contrib diff --git a/klibc/klibc/zlib/README b/klibc/klibc/zlib/README deleted file mode 100644 index 0f1205481c..0000000000 --- a/klibc/klibc/zlib/README +++ /dev/null @@ -1,126 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.1 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) -and rfc1952.txt (gzip format). These documents are also available in other -formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example -of the library is given in the file example.c which also tests that the library -is working correctly. Another example is given in the file minigzip.c. The -compression library itself is composed of all source files except example.c and -minigzip.c. - -To compile all files and run the test program, follow the instructions given at -the top of Makefile. In short "make test; make install" should work for most -machines. For Unix: "./configure; make test; make install" For MSDOS, use one -of the special makefiles such as Makefile.msc. For VMS, use Make_vms.com or -descrip.mms. - -Questions about zlib should be sent to , or to Gilles Vollant - for the Windows DLL version. The zlib home page is -http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, -please check this site to verify that you have the latest version of zlib; -otherwise get the latest version and check whether the problem still exists or -not. - -PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking -for help. - -Mark Nelson wrote an article about zlib for the Jan. 1997 -issue of Dr. Dobb's Journal; a copy of the article is available in -http://dogma.net/markn/articles/zlibtool/zlibtool.htm - -The changes made in version 1.2.1 are documented in the file ChangeLog. - -Unsupported third party contributions are provided in directory "contrib". - -A Java implementation of zlib is available in the Java Development Kit -http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html -See the zlib home page http://www.zlib.org for details. - -A Perl interface to zlib written by Paul Marquess is in the -CPAN (Comprehensive Perl Archive Network) sites -http://www.cpan.org/modules/by-module/Compress/ - -A Python interface to zlib written by A.M. Kuchling is -available in Python 1.5 and later versions, see -http://www.python.org/doc/lib/module-zlib.html - -A zlib binding for TCL written by Andreas Kupries is -availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html - -An experimental package to read and write files in .zip format, written on top -of zlib by Gilles Vollant , is available in the -contrib/minizip directory of zlib. - - -Notes for some targets: - -- For Windows DLL versions, please see win32/DLL_FAQ.txt - -- For 64-bit Irix, deflate.c must be compiled without any optimization. With - -O, one libpng test fails. The test works in 32 bit mode (with the -n32 - compiler flag). The compiler bug has been reported to SGI. - -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works - when compiled with cc. - -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is - necessary to get gzprintf working correctly. This is done by configure. - -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with - other compilers. Use "make test" to check your compiler. - -- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. - -- For PalmOs, see http://palmzlib.sourceforge.net/ - -- When building a shared, i.e. dynamic library on Mac OS X, the library must be - installed before testing (do "make install" before "make test"), since the - library location is specified in the library. - - -Acknowledgments: - - The deflate format used by zlib was defined by Phil Katz. The deflate - and zlib specifications were written by L. Peter Deutsch. Thanks to all the - people who reported problems and suggested various improvements in zlib; - they are too numerous to cite here. - -Copyright notice: - - (C) 1995-2003 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* -receiving lengthy legal documents to sign. The sources are provided -for free but without warranty of any kind. The library has been -entirely written by Jean-loup Gailly and Mark Adler; it does not -include third-party code. - -If you redistribute modified sources, we would appreciate that you include -in the file ChangeLog history information documenting your changes. Please -read the FAQ for more information on the distribution of modified source -versions. diff --git a/klibc/klibc/zlib/adler32.c b/klibc/klibc/zlib/adler32.c deleted file mode 100644 index 48c08f094a..0000000000 --- a/klibc/klibc/zlib/adler32.c +++ /dev/null @@ -1,74 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id: adler32.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -#define BASE 65521UL /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(buf,i) {s1 += buf[i]; s2 += s1;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); - -#ifdef NO_DIVIDE -# define MOD(a) \ - do { \ - if (a >= (BASE << 16)) a -= (BASE << 16); \ - if (a >= (BASE << 15)) a -= (BASE << 15); \ - if (a >= (BASE << 14)) a -= (BASE << 14); \ - if (a >= (BASE << 13)) a -= (BASE << 13); \ - if (a >= (BASE << 12)) a -= (BASE << 12); \ - if (a >= (BASE << 11)) a -= (BASE << 11); \ - if (a >= (BASE << 10)) a -= (BASE << 10); \ - if (a >= (BASE << 9)) a -= (BASE << 9); \ - if (a >= (BASE << 8)) a -= (BASE << 8); \ - if (a >= (BASE << 7)) a -= (BASE << 7); \ - if (a >= (BASE << 6)) a -= (BASE << 6); \ - if (a >= (BASE << 5)) a -= (BASE << 5); \ - if (a >= (BASE << 4)) a -= (BASE << 4); \ - if (a >= (BASE << 3)) a -= (BASE << 3); \ - if (a >= (BASE << 2)) a -= (BASE << 2); \ - if (a >= (BASE << 1)) a -= (BASE << 1); \ - if (a >= BASE) a -= BASE; \ - } while (0) -#else -# define MOD(a) a %= BASE -#endif - -/* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; - uInt len; -{ - unsigned long s1 = adler & 0xffff; - unsigned long s2 = (adler >> 16) & 0xffff; - int k; - - if (buf == Z_NULL) return 1L; - - while (len > 0) { - k = len < NMAX ? (int)len : NMAX; - len -= k; - while (k >= 16) { - DO16(buf); - buf += 16; - k -= 16; - } - if (k != 0) do { - s1 += *buf++; - s2 += s1; - } while (--k); - MOD(s1); - MOD(s2); - } - return (s2 << 16) | s1; -} diff --git a/klibc/klibc/zlib/algorithm.txt b/klibc/klibc/zlib/algorithm.txt deleted file mode 100644 index b022dde312..0000000000 --- a/klibc/klibc/zlib/algorithm.txt +++ /dev/null @@ -1,209 +0,0 @@ -1. Compression algorithm (deflate) - -The deflation algorithm used by gzip (also zip and zlib) is a variation of -LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in -the input data. The second occurrence of a string is replaced by a -pointer to the previous string, in the form of a pair (distance, -length). Distances are limited to 32K bytes, and lengths are limited -to 258 bytes. When a string does not occur anywhere in the previous -32K bytes, it is emitted as a sequence of literal bytes. (In this -description, `string' must be taken as an arbitrary sequence of bytes, -and is not restricted to printable characters.) - -Literals or match lengths are compressed with one Huffman tree, and -match distances are compressed with another tree. The trees are stored -in a compact form at the start of each block. The blocks can have any -size (except that the compressed data for one block must fit in -available memory). A block is terminated when deflate() determines that -it would be useful to start another block with fresh trees. (This is -somewhat similar to the behavior of LZW-based _compress_.) - -Duplicated strings are found using a hash table. All input strings of -length 3 are inserted in the hash table. A hash index is computed for -the next 3 bytes. If the hash chain for this index is not empty, all -strings in the chain are compared with the current input string, and -the longest match is selected. - -The hash chains are searched starting with the most recent strings, to -favor small distances and thus take advantage of the Huffman encoding. -The hash chains are singly linked. There are no deletions from the -hash chains, the algorithm simply discards matches that are too old. - -To avoid a worst-case situation, very long hash chains are arbitrarily -truncated at a certain length, determined by a runtime option (level -parameter of deflateInit). So deflate() does not always find the longest -possible match but generally finds a match which is long enough. - -deflate() also defers the selection of matches with a lazy evaluation -mechanism. After a match of length N has been found, deflate() searches for -a longer match at the next input byte. If a longer match is found, the -previous match is truncated to a length of one (thus producing a single -literal byte) and the process of lazy evaluation begins again. Otherwise, -the original match is kept, and the next match search is attempted only N -steps later. - -The lazy match evaluation is also subject to a runtime parameter. If -the current match is long enough, deflate() reduces the search for a longer -match, thus speeding up the whole process. If compression ratio is more -important than speed, deflate() attempts a complete second search even if -the first match is already long enough. - -The lazy match evaluation is not performed for the fastest compression -modes (level parameter 1 to 3). For these fast modes, new strings -are inserted in the hash table only when no match was found, or -when the match is not too long. This degrades the compression ratio -but saves time since there are both fewer insertions and fewer searches. - - -2. Decompression algorithm (inflate) - -2.1 Introduction - -The key question is how to represent a Huffman code (or any prefix code) so -that you can decode fast. The most important characteristic is that shorter -codes are much more common than longer codes, so pay attention to decoding the -short codes fast, and let the long codes take longer to decode. - -inflate() sets up a first level table that covers some number of bits of -input less than the length of longest code. It gets that many bits from the -stream, and looks it up in the table. The table will tell if the next -code is that many bits or less and how many, and if it is, it will tell -the value, else it will point to the next level table for which inflate() -grabs more bits and tries to decode a longer code. - -How many bits to make the first lookup is a tradeoff between the time it -takes to decode and the time it takes to build the table. If building the -table took no time (and if you had infinite memory), then there would only -be a first level table to cover all the way to the longest code. However, -building the table ends up taking a lot longer for more bits since short -codes are replicated many times in such a table. What inflate() does is -simply to make the number of bits in the first table a variable, and then -to set that variable for the maximum speed. - -For inflate, which has 286 possible codes for the literal/length tree, the size -of the first table is nine bits. Also the distance trees have 30 possible -values, and the size of the first table is six bits. Note that for each of -those cases, the table ended up one bit longer than the ``average'' code -length, i.e. the code length of an approximately flat code which would be a -little more than eight bits for 286 symbols and a little less than five bits -for 30 symbols. - - -2.2 More details on the inflate table lookup - -Ok, you want to know what this cleverly obfuscated inflate tree actually -looks like. You are correct that it's not a Huffman tree. It is simply a -lookup table for the first, let's say, nine bits of a Huffman symbol. The -symbol could be as short as one bit or as long as 15 bits. If a particular -symbol is shorter than nine bits, then that symbol's translation is duplicated -in all those entries that start with that symbol's bits. For example, if the -symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a -symbol is nine bits long, it appears in the table once. - -If the symbol is longer than nine bits, then that entry in the table points -to another similar table for the remaining bits. Again, there are duplicated -entries as needed. The idea is that most of the time the symbol will be short -and there will only be one table look up. (That's whole idea behind data -compression in the first place.) For the less frequent long symbols, there -will be two lookups. If you had a compression method with really long -symbols, you could have as many levels of lookups as is efficient. For -inflate, two is enough. - -So a table entry either points to another table (in which case nine bits in -the above example are gobbled), or it contains the translation for the symbol -and the number of bits to gobble. Then you start again with the next -ungobbled bit. - -You may wonder: why not just have one lookup table for how ever many bits the -longest symbol is? The reason is that if you do that, you end up spending -more time filling in duplicate symbol entries than you do actually decoding. -At least for deflate's output that generates new trees every several 10's of -kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code -would take too long if you're only decoding several thousand symbols. At the -other extreme, you could make a new table for every bit in the code. In fact, -that's essentially a Huffman tree. But then you spend two much time -traversing the tree while decoding, even for short symbols. - -So the number of bits for the first lookup table is a trade of the time to -fill out the table vs. the time spent looking at the second level and above of -the table. - -Here is an example, scaled down: - -The code being decoded, with 10 symbols, from 1 to 6 bits long: - -A: 0 -B: 10 -C: 1100 -D: 11010 -E: 11011 -F: 11100 -G: 11101 -H: 11110 -I: 111110 -J: 111111 - -Let's make the first table three bits long (eight entries): - -000: A,1 -001: A,1 -010: A,1 -011: A,1 -100: B,2 -101: B,2 -110: -> table X (gobble 3 bits) -111: -> table Y (gobble 3 bits) - -Each entry is what the bits decode as and how many bits that is, i.e. how -many bits to gobble. Or the entry points to another table, with the number of -bits to gobble implicit in the size of the table. - -Table X is two bits long since the longest code starting with 110 is five bits -long: - -00: C,1 -01: C,1 -10: D,2 -11: E,2 - -Table Y is three bits long since the longest code starting with 111 is six -bits long: - -000: F,2 -001: F,2 -010: G,2 -011: G,2 -100: H,2 -101: H,2 -110: I,3 -111: J,3 - -So what we have here are three tables with a total of 20 entries that had to -be constructed. That's compared to 64 entries for a single table. Or -compared to 16 entries for a Huffman tree (six two entry tables and one four -entry table). Assuming that the code ideally represents the probability of -the symbols, it takes on the average 1.25 lookups per symbol. That's compared -to one lookup for the single table, or 1.66 lookups per symbol for the -Huffman tree. - -There, I think that gives you a picture of what's going on. For inflate, the -meaning of a particular symbol is often more than just a letter. It can be a -byte (a "literal"), or it can be either a length or a distance which -indicates a base value and a number of bits to fetch after the code that is -added to the base value. Or it might be the special end-of-block code. The -data structures created in inftrees.c try to encode all that information -compactly in the tables. - - -Jean-loup Gailly Mark Adler -jloup@gzip.org madler@alumni.caltech.edu - - -References: - -[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data -Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3, -pp. 337-343. - -``DEFLATE Compressed Data Format Specification'' available in -http://www.ietf.org/rfc/rfc1951.txt diff --git a/klibc/klibc/zlib/compress.c b/klibc/klibc/zlib/compress.c deleted file mode 100644 index 3f4b44266a..0000000000 --- a/klibc/klibc/zlib/compress.c +++ /dev/null @@ -1,79 +0,0 @@ -/* compress.c -- compress a memory buffer - * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id: compress.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; - int level; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; -#ifdef MAXSEG_64K - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; -#endif - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; - - err = deflateInit(&stream, level); - if (err != Z_OK) return err; - - err = deflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - deflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; - } - *destLen = stream.total_out; - - err = deflateEnd(&stream); - return err; -} - -/* =========================================================================== - */ -int ZEXPORT compress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); -} - -/* =========================================================================== - If the default memLevel or windowBits for deflateInit() is changed, then - this function needs to be updated. - */ -uLong ZEXPORT compressBound (sourceLen) - uLong sourceLen; -{ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11; -} diff --git a/klibc/klibc/zlib/crc32.c b/klibc/klibc/zlib/crc32.c deleted file mode 100644 index 0bb9c49ab1..0000000000 --- a/klibc/klibc/zlib/crc32.c +++ /dev/null @@ -1,311 +0,0 @@ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results about a factor - * of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. - */ - -/* @(#) $Id: crc32.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#ifdef MAKECRCH -# include -# ifndef DYNAMIC_CRC_TABLE -# define DYNAMIC_CRC_TABLE -# endif /* !DYNAMIC_CRC_TABLE */ -#endif /* MAKECRCH */ - -#include "zutil.h" /* for STDC and FAR definitions */ - -#define local static - -/* Find a four-byte integer type for crc32_little() and crc32_big(). */ -#ifndef NOBYFOUR -# ifdef STDC /* need ANSI C limits.h to determine sizes */ -# include -# define BYFOUR -# if (UINT_MAX == 0xffffffffUL) - typedef unsigned int u4; -# else -# if (ULONG_MAX == 0xffffffffUL) - typedef unsigned long u4; -# else -# if (USHRT_MAX == 0xffffffffUL) - typedef unsigned short u4; -# else -# undef BYFOUR /* can't find a four-byte integer type! */ -# endif -# endif -# endif -# endif /* STDC */ -#endif /* !NOBYFOUR */ - -/* Definitions for doing the crc four data bytes at a time. */ -#ifdef BYFOUR -# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \ - (((w)&0xff00)<<8)+(((w)&0xff)<<24)) - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, unsigned)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, unsigned)); -# define TBLS 8 -#else -# define TBLS 1 -#endif /* BYFOUR */ - -#ifdef DYNAMIC_CRC_TABLE - -local int crc_table_empty = 1; -local unsigned long FAR crc_table[TBLS][256]; -local void make_crc_table OF((void)); -#ifdef MAKECRCH - local void write_table OF((FILE *, const unsigned long FAR *)); -#endif /* MAKECRCH */ - -/* - Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ -local void make_crc_table() -{ - unsigned long c; - int n, k; - unsigned long poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0UL; - for (n = 0; n < sizeof(p)/sizeof(unsigned char); n++) - poly |= 1UL << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (unsigned long)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, and - then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = REV(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = REV(c); - } - } -#endif /* BYFOUR */ - - crc_table_empty = 0; - -#ifdef MAKECRCH - /* write out CRC tables to crc32.h */ - { - FILE *out; - - out = fopen("crc32.h", "w"); - if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const unsigned long FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); - } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); - fclose(out); - } -#endif /* MAKECRCH */ -} - -#ifdef MAKECRCH -local void write_table(out, table) - FILE *out; - const unsigned long FAR *table; -{ - int n; - - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", table[n], - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); -} -#endif /* MAKECRCH */ - -#else /* !DYNAMIC_CRC_TABLE */ -/* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). - */ -#include "crc32.h" -#endif /* DYNAMIC_CRC_TABLE */ - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const unsigned long FAR * ZEXPORT get_crc_table() -{ -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - return (const unsigned long FAR *)crc_table; -} - -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 - -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - if (buf == Z_NULL) return 0UL; - -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - -#ifdef BYFOUR - if (sizeof(void *) == sizeof(ptrdiff_t)) { - u4 endian; - - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); - } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; - while (len >= 8) { - DO8; - len -= 8; - } - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} - -#ifdef BYFOUR - -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 - -/* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register u4 c; - register const u4 FAR *buf4; - - c = (u4)crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } - - buf4 = (const u4 FAR *)buf; - while (len >= 32) { - DOLIT32; - len -= 32; - } - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} - -/* ========================================================================= */ -#define DOBIG4 c ^= *++buf4; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 - -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register u4 c; - register const u4 FAR *buf4; - - c = REV((u4)crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; - } - - buf4 = (const u4 FAR *)buf; - buf4--; - while (len >= 32) { - DOBIG32; - len -= 32; - } - while (len >= 4) { - DOBIG4; - len -= 4; - } - buf4++; - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(REV(c)); -} - -#endif /* BYFOUR */ diff --git a/klibc/klibc/zlib/crc32.h b/klibc/klibc/zlib/crc32.h deleted file mode 100644 index 8053b6117c..0000000000 --- a/klibc/klibc/zlib/crc32.h +++ /dev/null @@ -1,441 +0,0 @@ -/* crc32.h -- tables for rapid CRC calculation - * Generated automatically by crc32.c - */ - -local const unsigned long FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL -#endif - } -}; diff --git a/klibc/klibc/zlib/deflate.c b/klibc/klibc/zlib/deflate.c deleted file mode 100644 index fe07dcb673..0000000000 --- a/klibc/klibc/zlib/deflate.c +++ /dev/null @@ -1,1502 +0,0 @@ -/* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process depends on being able to identify portions - * of the input text which are identical to earlier input (within a - * sliding window trailing behind the input currently being processed). - * - * The most straightforward technique turns out to be the fastest for - * most input files: try all possible matches and select the longest. - * The key feature of this algorithm is that insertions into the string - * dictionary are very simple and thus fast, and deletions are avoided - * completely. Insertions are performed at each input character, whereas - * string matches are performed only when the previous match ends. So it - * is preferable to spend more time in matches to allow very fast string - * insertions and avoid deletions. The matching algorithm for small - * strings is inspired from that of Rabin & Karp. A brute force approach - * is used to find longer strings when a small match has been found. - * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze - * (by Leonid Broukhis). - * A previous version of this file used a more sophisticated algorithm - * (by Fiala and Greene) which is guaranteed to run in linear amortized - * time, but has a larger average cost, uses more memory and is patented. - * However the F&G algorithm may be faster for some highly redundant - * files if the parameter max_chain_length (described below) is too large. - * - * ACKNOWLEDGEMENTS - * - * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and - * I found it in 'freeze' written by Leonid Broukhis. - * Thanks to many people for bug reports and testing. - * - * REFERENCES - * - * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://www.ietf.org/rfc/rfc1951.txt - * - * A description of the Rabin and Karp algorithm is given in the book - * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. - * - * Fiala,E.R., and Greene,D.H. - * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 - * - */ - -/* @(#) $Id: deflate.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#include "deflate.h" - -const char deflate_copyright[] = - " deflate 1.2.1 Copyright 1995-2003 Jean-loup Gailly "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* =========================================================================== - * Function prototypes. - */ -typedef enum { - need_more, /* block not completed, need more input or more output */ - block_done, /* block flush performed */ - finish_started, /* finish started, need only more output at next deflate */ - finish_done /* finish done, accept no more input or output */ -} block_state; - -typedef block_state (*compress_func) OF((deflate_state *s, int flush)); -/* Compression function. Returns the block state after the call. */ - -local void fill_window OF((deflate_state *s)); -local block_state deflate_stored OF((deflate_state *s, int flush)); -local block_state deflate_fast OF((deflate_state *s, int flush)); -#ifndef FASTEST -local block_state deflate_slow OF((deflate_state *s, int flush)); -#endif -local void lm_init OF((deflate_state *s)); -local void putShortMSB OF((deflate_state *s, uInt b)); -local void flush_pending OF((z_streamp strm)); -local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifndef FASTEST -#ifdef ASMV - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else -local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif -#endif -local uInt longest_match_fast OF((deflate_state *s, IPos cur_match)); - -#ifdef DEBUG -local void check_match OF((deflate_state *s, IPos start, IPos match, - int length)); -#endif - -/* =========================================================================== - * Local data - */ - -#define NIL 0 -/* Tail of hash chains */ - -#ifndef TOO_FAR -# define TOO_FAR 4096 -#endif -/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -typedef struct config_s { - ush good_length; /* reduce lazy search above this match length */ - ush max_lazy; /* do not perform lazy search above this match length */ - ush nice_length; /* quit search above this match length */ - ush max_chain; - compress_func func; -} config; - -#ifdef FASTEST -local const config configuration_table[2] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ -#else -local const config configuration_table[10] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ -/* 2 */ {4, 5, 16, 8, deflate_fast}, -/* 3 */ {4, 6, 32, 32, deflate_fast}, - -/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ -/* 5 */ {8, 16, 32, 32, deflate_slow}, -/* 6 */ {8, 16, 128, 128, deflate_slow}, -/* 7 */ {8, 32, 128, 256, deflate_slow}, -/* 8 */ {32, 128, 258, 1024, deflate_slow}, -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ -#endif - -/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 - * For deflate_fast() (levels <= 3) good is ignored and lazy has a different - * meaning. - */ - -#define EQUAL 0 -/* result of memcmp for equal strings */ - -#ifndef NO_DUMMY_DECL -struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ -#endif - -/* =========================================================================== - * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. - */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) - - -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * If this file is compiled with -DFASTEST, the compression level is forced - * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). - */ -#ifdef FASTEST -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#else -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#endif - -/* =========================================================================== - * Initialize the hash table (avoiding 64K overflow for 16 bit systems). - * prev[] will be initialized on the fly. - */ -#define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); - -/* ========================================================================= */ -int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; - int level; - const char *version; - int stream_size; -{ - return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); - /* To do: ignore strm->next_in if we use it as window */ -} - -/* ========================================================================= */ -int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) - z_streamp strm; - int level; - int method; - int windowBits; - int memLevel; - int strategy; - const char *version; - int stream_size; -{ - deflate_state *s; - int wrap = 1; - static const char my_version[] = ZLIB_VERSION; - - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - - if (version == Z_NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; - } - if (strm == Z_NULL) return Z_STREAM_ERROR; - - strm->msg = Z_NULL; - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } -#ifdef GZIP - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } -#endif - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_RLE) { - return Z_STREAM_ERROR; - } - if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ - s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); - if (s == Z_NULL) return Z_MEM_ERROR; - strm->state = (struct internal_state FAR *)s; - s->strm = strm; - - s->wrap = wrap; - s->w_bits = windowBits; - s->w_size = 1 << s->w_bits; - s->w_mask = s->w_size - 1; - - s->hash_bits = memLevel + 7; - s->hash_size = 1 << s->hash_bits; - s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); - - s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); - s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); - s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); - - s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); - - if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || - s->pending_buf == Z_NULL) { - s->status = FINISH_STATE; - strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); - deflateEnd (strm); - return Z_MEM_ERROR; - } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - - s->level = level; - s->strategy = strategy; - s->method = (Byte)method; - - return deflateReset(strm); -} - -/* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) - z_streamp strm; - const Bytef *dictionary; - uInt dictLength; -{ - deflate_state *s; - uInt length = dictLength; - uInt n; - IPos hash_head = 0; - - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || - strm->state->wrap == 2 || - (strm->state->wrap == 1 && strm->state->status != INIT_STATE)) - return Z_STREAM_ERROR; - - s = strm->state; - if (s->wrap) - strm->adler = adler32(strm->adler, dictionary, dictLength); - - if (length < MIN_MATCH) return Z_OK; - if (length > MAX_DIST(s)) { - length = MAX_DIST(s); -#ifndef USE_DICT_HEAD - dictionary += dictLength - length; /* use the tail of the dictionary */ -#endif - } - zmemcpy(s->window, dictionary, length); - s->strstart = length; - s->block_start = (long)length; - - /* Insert all strings in the hash table (except for the last two bytes). - * s->lookahead stays null, so s->ins_h will be recomputed at the next - * call of fill_window. - */ - s->ins_h = s->window[0]; - UPDATE_HASH(s, s->ins_h, s->window[1]); - for (n = 0; n <= length - MIN_MATCH; n++) { - INSERT_STRING(s, n, hash_head); - } - if (hash_head) hash_head = 0; /* to make compiler happy */ - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateReset (strm) - z_streamp strm; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { - return Z_STREAM_ERROR; - } - - strm->total_in = strm->total_out = 0; - strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ - strm->data_type = Z_UNKNOWN; - - s = (deflate_state *)strm->state; - s->pending = 0; - s->pending_out = s->pending_buf; - - if (s->wrap < 0) { - s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ - } - s->status = s->wrap ? INIT_STATE : BUSY_STATE; - strm->adler = -#ifdef GZIP - s->wrap == 2 ? crc32(0L, Z_NULL, 0) : -#endif - adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; - - _tr_init(s); - lm_init(s); - - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) - z_streamp strm; - int bits; - int value; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - strm->state->bi_valid = bits; - strm->state->bi_buf = (ush)(value & ((1 << bits) - 1)); - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateParams(strm, level, strategy) - z_streamp strm; - int level; - int strategy; -{ - deflate_state *s; - compress_func func; - int err = Z_OK; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - if (level < 0 || level > 9 || strategy < 0 || strategy > Z_RLE) { - return Z_STREAM_ERROR; - } - func = configuration_table[s->level].func; - - if (func != configuration_table[level].func && strm->total_in != 0) { - /* Flush the last buffer: */ - err = deflate(strm, Z_PARTIAL_FLUSH); - } - if (s->level != level) { - s->level = level; - s->max_lazy_match = configuration_table[level].max_lazy; - s->good_match = configuration_table[level].good_length; - s->nice_match = configuration_table[level].nice_length; - s->max_chain_length = configuration_table[level].max_chain; - } - s->strategy = strategy; - return err; -} - -/* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. - * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. - * - * This function could be more sophisticated to provide closer upper bounds - * for every combination of windowBits and memLevel, as well as wrap. - * But even the conservative upper bound of about 14% expansion does not - * seem onerous for output buffer allocation. - */ -uLong ZEXPORT deflateBound(strm, sourceLen) - z_streamp strm; - uLong sourceLen; -{ - deflate_state *s; - uLong destLen; - - /* conservative upper bound */ - destLen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11; - - /* if can't get parameters, return conservative bound */ - if (strm == Z_NULL || strm->state == Z_NULL) - return destLen; - - /* if not default parameters, return conservative bound */ - s = strm->state; - if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return destLen; - - /* default settings: return tight bound for that case */ - return compressBound(sourceLen); -} - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -local void putShortMSB (s, b) - deflate_state *s; - uInt b; -{ - put_byte(s, (Byte)(b >> 8)); - put_byte(s, (Byte)(b & 0xff)); -} - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->next_out buffer and copying into it. - * (See also read_buf()). - */ -local void flush_pending(strm) - z_streamp strm; -{ - unsigned len = strm->state->pending; - - if (len > strm->avail_out) len = strm->avail_out; - if (len == 0) return; - - zmemcpy(strm->next_out, strm->state->pending_out, len); - strm->next_out += len; - strm->state->pending_out += len; - strm->total_out += len; - strm->avail_out -= len; - strm->state->pending -= len; - if (strm->state->pending == 0) { - strm->state->pending_out = strm->state->pending_buf; - } -} - -/* ========================================================================= */ -int ZEXPORT deflate (strm, flush) - z_streamp strm; - int flush; -{ - int old_flush; /* value of flush param for previous deflate call */ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - flush > Z_FINISH || flush < 0) { - return Z_STREAM_ERROR; - } - s = strm->state; - - if (strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0) || - (s->status == FINISH_STATE && flush != Z_FINISH)) { - ERR_RETURN(strm, Z_STREAM_ERROR); - } - if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); - - s->strm = strm; /* just in case */ - old_flush = s->last_flush; - s->last_flush = flush; - - /* Write the header */ - if (s->status == INIT_STATE) { -#ifdef GZIP - if (s->wrap == 2) { - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, 255); - s->status = BUSY_STATE; - strm->adler = crc32(0L, Z_NULL, 0); - } - else -#endif - { - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); - - s->status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - strm->adler = adler32(0L, Z_NULL, 0); - } - } - - /* Flush as much pending output as possible */ - if (s->pending != 0) { - flush_pending(strm); - if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s->last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm->avail_in == 0 && flush <= old_flush && - flush != Z_FINISH) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s->status == FINISH_STATE && strm->avail_in != 0) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm->avail_in != 0 || s->lookahead != 0 || - (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { - block_state bstate; - - bstate = (*(configuration_table[s->level].func))(s, flush); - - if (bstate == finish_started || bstate == finish_done) { - s->status = FINISH_STATE; - } - if (bstate == need_more || bstate == finish_started) { - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate == block_done) { - if (flush == Z_PARTIAL_FLUSH) { - _tr_align(s); - } else { /* FULL_FLUSH or SYNC_FLUSH */ - _tr_stored_block(s, (char*)0, 0L, 0); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush == Z_FULL_FLUSH) { - CLEAR_HASH(s); /* forget history */ - } - } - flush_pending(strm); - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - Assert(strm->avail_out > 0, "bug2"); - - if (flush != Z_FINISH) return Z_OK; - if (s->wrap <= 0) return Z_STREAM_END; - - /* Write the trailer */ -#ifdef GZIP - if (s->wrap == 2) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); - put_byte(s, (Byte)(strm->total_in & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); - } - else -#endif - { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ - return s->pending != 0 ? Z_OK : Z_STREAM_END; -} - -/* ========================================================================= */ -int ZEXPORT deflateEnd (strm) - z_streamp strm; -{ - int status; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - - status = strm->state->status; - if (status != INIT_STATE && status != BUSY_STATE && - status != FINISH_STATE) { - return Z_STREAM_ERROR; - } - - /* Deallocate in reverse order of allocations: */ - TRY_FREE(strm, strm->state->pending_buf); - TRY_FREE(strm, strm->state->head); - TRY_FREE(strm, strm->state->prev); - TRY_FREE(strm, strm->state->window); - - ZFREE(strm, strm->state); - strm->state = Z_NULL; - - return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; -} - -/* ========================================================================= - * Copy the source state to the destination state. - * To simplify the source, this is not supported for 16-bit MSDOS (which - * doesn't have enough memory anyway to duplicate compression states). - */ -int ZEXPORT deflateCopy (dest, source) - z_streamp dest; - z_streamp source; -{ -#ifdef MAXSEG_64K - return Z_STREAM_ERROR; -#else - deflate_state *ds; - deflate_state *ss; - ushf *overlay; - - - if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { - return Z_STREAM_ERROR; - } - - ss = source->state; - - *dest = *source; - - ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); - if (ds == Z_NULL) return Z_MEM_ERROR; - dest->state = (struct internal_state FAR *) ds; - *ds = *ss; - ds->strm = dest; - - ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); - ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); - ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; - - if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || - ds->pending_buf == Z_NULL) { - deflateEnd (dest); - return Z_MEM_ERROR; - } - /* following zmemcpy do not work for 16-bit MSDOS */ - zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); - zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); - zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); - - ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; - - ds->l_desc.dyn_tree = ds->dyn_ltree; - ds->d_desc.dyn_tree = ds->dyn_dtree; - ds->bl_desc.dyn_tree = ds->bl_tree; - - return Z_OK; -#endif /* MAXSEG_64K */ -} - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->next_in buffer and copying from it. - * (See also flush_pending()). - */ -local int read_buf(strm, buf, size) - z_streamp strm; - Bytef *buf; - unsigned size; -{ - unsigned len = strm->avail_in; - - if (len > size) len = size; - if (len == 0) return 0; - - strm->avail_in -= len; - - if (strm->state->wrap == 1) { - strm->adler = adler32(strm->adler, strm->next_in, len); - } -#ifdef GZIP - else if (strm->state->wrap == 2) { - strm->adler = crc32(strm->adler, strm->next_in, len); - } -#endif - zmemcpy(buf, strm->next_in, len); - strm->next_in += len; - strm->total_in += len; - - return (int)len; -} - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -local void lm_init (s) - deflate_state *s; -{ - s->window_size = (ulg)2L*s->w_size; - - CLEAR_HASH(s); - - /* Set the default configuration parameters: - */ - s->max_lazy_match = configuration_table[s->level].max_lazy; - s->good_match = configuration_table[s->level].good_length; - s->nice_match = configuration_table[s->level].nice_length; - s->max_chain_length = configuration_table[s->level].max_chain; - - s->strstart = 0; - s->block_start = 0L; - s->lookahead = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - s->ins_h = 0; -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -} - -#ifndef FASTEST -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - unsigned chain_length = s->max_chain_length;/* max hash chain length */ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - int best_len = s->prev_length; /* best match length so far */ - int nice_match = s->nice_match; /* stop if match long enough */ - IPos limit = s->strstart > (IPos)MAX_DIST(s) ? - s->strstart - (IPos)MAX_DIST(s) : NIL; - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - Posf *prev = s->prev; - uInt wmask = s->w_mask; - -#ifdef UNALIGNED_OK - /* Compare two bytes at a time. Note: this is not always beneficial. - * Try with and without -DUNALIGNED_OK to check. - */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; - register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); -#else - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; - register Byte scan_end = scan[best_len]; -#endif - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s->prev_length >= s->good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - Assert(cur_match < s->strstart, "no future"); - match = s->window + cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2: - */ -#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) - /* This code assumes sizeof(unsigned short) == 2. Do not use - * UNALIGNED_OK if your compiler uses a different size. - */ - if (*(ushf*)(match+best_len-1) != scan_end || - *(ushf*)match != scan_start) continue; - - /* It is not necessary to compare scan[2] and match[2] since they are - * always equal when the other bytes match, given that the hash keys - * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient - * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is - * necessary to put more guard bytes at the end of the window, or - * to check more often for insufficient lookahead. - */ - Assert(scan[2] == match[2], "scan[2]?"); - scan++, match++; - do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - scan < strend); - /* The funny "do {}" generates better code on most compilers */ - - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - if (*scan == *match) scan++; - - len = (MAX_MATCH - 1) - (int)(strend-scan); - scan = strend - (MAX_MATCH-1); - -#else /* UNALIGNED_OK */ - - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match++; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - scan = strend - MAX_MATCH; - -#endif /* UNALIGNED_OK */ - - if (len > best_len) { - s->match_start = cur_match; - best_len = len; - if (len >= nice_match) break; -#ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); -#else - scan_end1 = scan[best_len-1]; - scan_end = scan[best_len]; -#endif - } - } while ((cur_match = prev[cur_match & wmask]) > limit - && --chain_length != 0); - - if ((uInt)best_len <= s->lookahead) return (uInt)best_len; - return s->lookahead; -} -#endif /* ASMV */ -#endif /* FASTEST */ - -/* --------------------------------------------------------------------------- - * Optimized version for level == 1 or strategy == Z_RLE only - */ -local uInt longest_match_fast(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - Assert(cur_match < s->strstart, "no future"); - - match = s->window + cur_match; - - /* Return failure if the match length is less than 2: - */ - if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match += 2; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - - if (len < MIN_MATCH) return MIN_MATCH - 1; - - s->match_start = cur_match; - return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; -} - -#ifdef DEBUG -/* =========================================================================== - * Check that the match at match_start is indeed a match. - */ -local void check_match(s, start, match, length) - deflate_state *s; - IPos start, match; - int length; -{ - /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); - do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); - z_error("invalid match"); - } - if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); - do { putc(s->window[start++], stderr); } while (--length != 0); - } -} -#else -# define check_match(s, start, match, length) -#endif /* DEBUG */ - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -local void fill_window(s) - deflate_state *s; -{ - register unsigned n, m; - register Posf *p; - unsigned more; /* Amount of free space at the end of the window. */ - uInt wsize = s->w_size; - - do { - more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); - - /* Deal with !@#$% 64K limit: */ - if (sizeof(int) <= 2) { - if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - more = wsize; - - } else if (more == (unsigned)(-1)) { - /* Very unlikely, but possible on 16 bit machine if - * strstart == 0 && lookahead == 1 (input done a byte at time) - */ - more--; - } - } - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s->strstart >= wsize+MAX_DIST(s)) { - - zmemcpy(s->window, s->window+wsize, (unsigned)wsize); - s->match_start -= wsize; - s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (long) wsize; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - n = s->hash_size; - p = &s->head[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - } while (--n); - - n = wsize; -#ifndef FASTEST - p = &s->prev[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); -#endif - more += wsize; - } - if (s->strm->avail_in == 0) return; - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - Assert(more >= 2, "more < 2"); - - n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); - s->lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s->lookahead >= MIN_MATCH) { - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); -} - -/* =========================================================================== - * Flush the current block, with given end-of-file flag. - * IN assertion: strstart is set to the end of the current match. - */ -#define FLUSH_BLOCK_ONLY(s, eof) { \ - _tr_flush_block(s, (s->block_start >= 0L ? \ - (charf *)&s->window[(unsigned)s->block_start] : \ - (charf *)Z_NULL), \ - (ulg)((long)s->strstart - s->block_start), \ - (eof)); \ - s->block_start = s->strstart; \ - flush_pending(s->strm); \ - Tracev((stderr,"[FLUSH]")); \ -} - -/* Same but force premature exit if necessary. */ -#define FLUSH_BLOCK(s, eof) { \ - FLUSH_BLOCK_ONLY(s, eof); \ - if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \ -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -local block_state deflate_stored(s, flush) - deflate_state *s; - int flush; -{ - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - ulg max_block_size = 0xffff; - ulg max_start; - - if (max_block_size > s->pending_buf_size - 5) { - max_block_size = s->pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s->lookahead <= 1) { - - Assert(s->strstart < s->w_size+MAX_DIST(s) || - s->block_start >= (long)s->w_size, "slide too late"); - - fill_window(s); - if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; - - if (s->lookahead == 0) break; /* flush the current block */ - } - Assert(s->block_start >= 0L, "block gone"); - - s->strstart += s->lookahead; - s->lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - max_start = s->block_start + max_block_size; - if (s->strstart == 0 || (ulg)s->strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s->lookahead = (uInt)(s->strstart - max_start); - s->strstart = (uInt)max_start; - FLUSH_BLOCK(s, 0); - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { - FLUSH_BLOCK(s, 0); - } - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -local block_state deflate_fast(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head = NIL; /* head of the hash chain */ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ -#ifdef FASTEST - if ((s->strategy < Z_HUFFMAN_ONLY) || - (s->strategy == Z_RLE && s->strstart - hash_head == 1)) { - s->match_length = longest_match_fast (s, hash_head); - } -#else - if (s->strategy < Z_HUFFMAN_ONLY) { - s->match_length = longest_match (s, hash_head); - } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { - s->match_length = longest_match_fast (s, hash_head); - } -#endif - /* longest_match() or longest_match_fast() sets match_start */ - } - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->match_start, s->match_length); - - _tr_tally_dist(s, s->strstart - s->match_start, - s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ -#ifndef FASTEST - if (s->match_length <= s->max_insert_length && - s->lookahead >= MIN_MATCH) { - s->match_length--; /* string at strstart already in table */ - do { - s->strstart++; - INSERT_STRING(s, s->strstart, hash_head); - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s->match_length != 0); - s->strstart++; - } else -#endif - { - s->strstart += s->match_length; - s->match_length = 0; - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} - -#ifndef FASTEST -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -local block_state deflate_slow(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head = NIL; /* head of hash chain */ - int bflush; /* set if current block must be flushed */ - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - */ - s->prev_length = s->match_length, s->prev_match = s->match_start; - s->match_length = MIN_MATCH-1; - - if (hash_head != NIL && s->prev_length < s->max_lazy_match && - s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - if (s->strategy < Z_HUFFMAN_ONLY) { - s->match_length = longest_match (s, hash_head); - } else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) { - s->match_length = longest_match_fast (s, hash_head); - } - /* longest_match() or longest_match_fast() sets match_start */ - - if (s->match_length <= 5 && (s->strategy == Z_FILTERED -#if TOO_FAR <= 32767 - || (s->match_length == MIN_MATCH && - s->strstart - s->match_start > TOO_FAR) -#endif - )) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s->match_length = MIN_MATCH-1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { - uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - check_match(s, s->strstart-1, s->prev_match, s->prev_length); - - _tr_tally_dist(s, s->strstart -1 - s->prev_match, - s->prev_length - MIN_MATCH, bflush); - - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s->lookahead -= s->prev_length-1; - s->prev_length -= 2; - do { - if (++s->strstart <= max_insert) { - INSERT_STRING(s, s->strstart, hash_head); - } - } while (--s->prev_length != 0); - s->match_available = 0; - s->match_length = MIN_MATCH-1; - s->strstart++; - - if (bflush) FLUSH_BLOCK(s, 0); - - } else if (s->match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - if (bflush) { - FLUSH_BLOCK_ONLY(s, 0); - } - s->strstart++; - s->lookahead--; - if (s->strm->avail_out == 0) return need_more; - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s->match_available = 1; - s->strstart++; - s->lookahead--; - } - } - Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - s->match_available = 0; - } - FLUSH_BLOCK(s, flush == Z_FINISH); - return flush == Z_FINISH ? finish_done : block_done; -} -#endif /* FASTEST */ diff --git a/klibc/klibc/zlib/deflate.h b/klibc/klibc/zlib/deflate.h deleted file mode 100644 index bc79532e59..0000000000 --- a/klibc/klibc/zlib/deflate.h +++ /dev/null @@ -1,326 +0,0 @@ -/* deflate.h -- internal compression state - * Copyright (C) 1995-2002 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id: deflate.h,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#ifndef DEFLATE_H -#define DEFLATE_H - -#include "zutil.h" - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer creation by deflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip encoding - should be left enabled. */ -#ifndef NO_GZIP -# define GZIP -#endif - -/* =========================================================================== - * Internal compression state. - */ - -#define LENGTH_CODES 29 -/* number of length codes, not counting the special END_BLOCK code */ - -#define LITERALS 256 -/* number of literal bytes 0..255 */ - -#define L_CODES (LITERALS+1+LENGTH_CODES) -/* number of Literal or Length codes, including the END_BLOCK code */ - -#define D_CODES 30 -/* number of distance codes */ - -#define BL_CODES 19 -/* number of codes used to transfer the bit lengths */ - -#define HEAP_SIZE (2*L_CODES+1) -/* maximum heap size */ - -#define MAX_BITS 15 -/* All codes must not exceed MAX_BITS bits */ - -#define INIT_STATE 42 -#define BUSY_STATE 113 -#define FINISH_STATE 666 -/* Stream status */ - - -/* Data structure describing a single value and its code string. */ -typedef struct ct_data_s { - union { - ush freq; /* frequency count */ - ush code; /* bit string */ - } fc; - union { - ush dad; /* father node in Huffman tree */ - ush len; /* length of bit string */ - } dl; -} FAR ct_data; - -#define Freq fc.freq -#define Code fc.code -#define Dad dl.dad -#define Len dl.len - -typedef struct static_tree_desc_s static_tree_desc; - -typedef struct tree_desc_s { - ct_data *dyn_tree; /* the dynamic tree */ - int max_code; /* largest code with non zero frequency */ - static_tree_desc *stat_desc; /* the corresponding static tree */ -} FAR tree_desc; - -typedef ush Pos; -typedef Pos FAR Posf; -typedef unsigned IPos; - -/* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. IPos is used only for parameter passing. - */ - -typedef struct internal_state { - z_streamp strm; /* pointer back to this zlib stream */ - int status; /* as the name implies */ - Bytef *pending_buf; /* output still pending */ - ulg pending_buf_size; /* size of pending_buf */ - Bytef *pending_out; /* next pending byte to output to the stream */ - int pending; /* nb of bytes in the pending buffer */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - Byte data_type; /* UNKNOWN, BINARY or ASCII */ - Byte method; /* STORED (for zip only) or DEFLATED */ - int last_flush; /* value of flush param for previous deflate call */ - - /* used by deflate.c: */ - - uInt w_size; /* LZ77 window size (32K by default) */ - uInt w_bits; /* log2(w_size) (8..16) */ - uInt w_mask; /* w_size - 1 */ - - Bytef *window; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. Also, it limits - * the window size to 64K, which is quite useful on MSDOS. - * To do: use the user input buffer as sliding window. - */ - - ulg window_size; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - Posf *prev; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - Posf *head; /* Heads of the hash chains or NIL. */ - - uInt ins_h; /* hash index of string to be inserted */ - uInt hash_size; /* number of elements in hash table */ - uInt hash_bits; /* log2(hash_size) */ - uInt hash_mask; /* hash_size-1 */ - - uInt hash_shift; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - long block_start; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - uInt match_length; /* length of best match */ - IPos prev_match; /* previous match */ - int match_available; /* set if previous match exists */ - uInt strstart; /* start of string to insert */ - uInt match_start; /* start of matching string */ - uInt lookahead; /* number of valid bytes ahead in window */ - - uInt prev_length; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - uInt max_chain_length; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - uInt max_lazy_match; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ -# define max_insert_length max_lazy_match - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - int level; /* compression level (1..9) */ - int strategy; /* favor or force Huffman coding*/ - - uInt good_match; - /* Use a faster search when the previous match is longer than this */ - - int nice_match; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - /* Didn't use ct_data typedef below to supress compiler warning */ - struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - struct tree_desc_s l_desc; /* desc. for literal tree */ - struct tree_desc_s d_desc; /* desc. for distance tree */ - struct tree_desc_s bl_desc; /* desc. for bit length tree */ - - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - int heap_len; /* number of elements in the heap */ - int heap_max; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - uch depth[2*L_CODES+1]; - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - uchf *l_buf; /* buffer for literals or lengths */ - - uInt lit_bufsize; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - ulg opt_len; /* bit length of current block with optimal trees */ - ulg static_len; /* bit length of current block with static trees */ - uInt matches; /* number of string matches in current block */ - int last_eob_len; /* bit length of EOB code for last block */ - -#ifdef DEBUG - ulg compressed_len; /* total bit length of compressed file mod 2^32 */ - ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ -#endif - - ush bi_buf; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - int bi_valid; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - -} FAR deflate_state; - -/* Output a byte on the stream. - * IN assertion: there is enough room in pending_buf. - */ -#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} - - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - - /* in trees.c */ -void _tr_init OF((deflate_state *s)); -int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); -void _tr_align OF((deflate_state *s)); -void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, - int eof)); - -#define d_code(dist) \ - ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) -/* Mapping from a distance to a distance code. dist is the distance - 1 and - * must not have side effects. _dist_code[256] and _dist_code[257] are never - * used. - */ - -#ifndef DEBUG -/* Inline versions of _tr_tally for speed: */ - -#if defined(GEN_TREES_H) || !defined(STDC) - extern uch _length_code[]; - extern uch _dist_code[]; -#else - extern const uch _length_code[]; - extern const uch _dist_code[]; -#endif - -# define _tr_tally_lit(s, c, flush) \ - { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ - s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -# define _tr_tally_dist(s, distance, length, flush) \ - { uch len = (length); \ - ush dist = (distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ - dist--; \ - s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ - s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -#else -# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) -# define _tr_tally_dist(s, distance, length, flush) \ - flush = _tr_tally(s, distance, length) -#endif - -#endif /* DEFLATE_H */ diff --git a/klibc/klibc/zlib/gzio.c b/klibc/klibc/zlib/gzio.c deleted file mode 100644 index cb56b8d381..0000000000 --- a/klibc/klibc/zlib/gzio.c +++ /dev/null @@ -1,1008 +0,0 @@ -/* gzio.c -- IO on .gz files - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Compile this file with -DNO_GZCOMPRESS to avoid the compression code. - */ - -/* @(#) $Id: gzio.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#include - -#include "zutil.h" - -#ifdef NO_DEFLATE /* for compatiblity with old definition */ -# define NO_GZCOMPRESS -#endif - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -#ifndef Z_BUFSIZE -# ifdef MAXSEG_64K -# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */ -# else -# define Z_BUFSIZE 16384 -# endif -#endif -#ifndef Z_PRINTF_BUFSIZE -# define Z_PRINTF_BUFSIZE 4096 -#endif - -#ifdef __MVS__ -# pragma map (fdopen , "\174\174FDOPEN") - FILE *fdopen(int, const char *); -#endif - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern void free OF((voidpf ptr)); -#endif - -#define ALLOC(size) malloc(size) -#define TRYFREE(p) {if (p) free(p);} - -static int const gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */ - -/* gzip flag byte */ -#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */ -#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */ -#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ -#define ORIG_NAME 0x08 /* bit 3 set: original file name present */ -#define COMMENT 0x10 /* bit 4 set: file comment present */ -#define RESERVED 0xE0 /* bits 5..7: reserved */ - -typedef struct gz_stream { - z_stream stream; - int z_err; /* error code for last stream operation */ - int z_eof; /* set if end of input file */ - FILE *file; /* .gz file */ - Byte *inbuf; /* input buffer */ - Byte *outbuf; /* output buffer */ - uLong crc; /* crc32 of uncompressed data */ - char *msg; /* error message */ - char *path; /* path name for debugging only */ - int transparent; /* 1 if input file is not a .gz file */ - char mode; /* 'w' or 'r' */ - z_off_t start; /* start of compressed data in file (header skipped) */ - z_off_t in; /* bytes into deflate or inflate */ - z_off_t out; /* bytes out of deflate or inflate */ - int back; /* one character push-back */ - int last; /* true if push-back is last character */ -} gz_stream; - - -local gzFile gz_open OF((const char *path, const char *mode, int fd)); -local int do_flush OF((gzFile file, int flush)); -local int get_byte OF((gz_stream *s)); -local void check_header OF((gz_stream *s)); -local int destroy OF((gz_stream *s)); -local void putLong OF((FILE *file, uLong x)); -local uLong getLong OF((gz_stream *s)); - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb"). The file is given either by file descriptor - or path name (if fd == -1). - gz_open returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). -*/ -local gzFile gz_open (path, mode, fd) - const char *path; - const char *mode; - int fd; -{ - int err; - int level = Z_DEFAULT_COMPRESSION; /* compression level */ - int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */ - char *p = (char*)mode; - gz_stream *s; - char fmode[80]; /* copy of mode, without the compression level */ - char *m = fmode; - - if (!path || !mode) return Z_NULL; - - s = (gz_stream *)ALLOC(sizeof(gz_stream)); - if (!s) return Z_NULL; - - s->stream.zalloc = (alloc_func)0; - s->stream.zfree = (free_func)0; - s->stream.opaque = (voidpf)0; - s->stream.next_in = s->inbuf = Z_NULL; - s->stream.next_out = s->outbuf = Z_NULL; - s->stream.avail_in = s->stream.avail_out = 0; - s->file = NULL; - s->z_err = Z_OK; - s->z_eof = 0; - s->in = 0; - s->out = 0; - s->back = EOF; - s->crc = crc32(0L, Z_NULL, 0); - s->msg = NULL; - s->transparent = 0; - - s->path = (char*)ALLOC(strlen(path)+1); - if (s->path == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - strcpy(s->path, path); /* do this early for debugging */ - - s->mode = '\0'; - do { - if (*p == 'r') s->mode = 'r'; - if (*p == 'w' || *p == 'a') s->mode = 'w'; - if (*p >= '0' && *p <= '9') { - level = *p - '0'; - } else if (*p == 'f') { - strategy = Z_FILTERED; - } else if (*p == 'h') { - strategy = Z_HUFFMAN_ONLY; - } else if (*p == 'R') { - strategy = Z_RLE; - } else { - *m++ = *p; /* copy the mode */ - } - } while (*p++ && m != fmode + sizeof(fmode)); - if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateInit2(&(s->stream), level, - Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy); - /* windowBits is passed < 0 to suppress zlib header */ - - s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); -#endif - if (err != Z_OK || s->outbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } else { - s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); - - err = inflateInit2(&(s->stream), -MAX_WBITS); - /* windowBits is passed < 0 to tell that there is no zlib header. - * Note that in this case inflate *requires* an extra "dummy" byte - * after the compressed stream in order to complete decompression and - * return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are - * present after the compressed stream. - */ - if (err != Z_OK || s->inbuf == Z_NULL) { - return destroy(s), (gzFile)Z_NULL; - } - } - s->stream.avail_out = Z_BUFSIZE; - - errno = 0; - s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode); - - if (s->file == NULL) { - return destroy(s), (gzFile)Z_NULL; - } - if (s->mode == 'w') { - /* Write a very simple .gz header: - */ - fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1], - Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE); - s->start = 10L; - /* We use 10L instead of ftell(s->file) to because ftell causes an - * fflush on some systems. This version of the library doesn't use - * start anyway in write mode, so this initialization is not - * necessary. - */ - } else { - check_header(s); /* skip the .gz header */ - s->start = ftell(s->file) - s->stream.avail_in; - } - - return (gzFile)s; -} - -/* =========================================================================== - Opens a gzip (.gz) file for reading or writing. -*/ -gzFile ZEXPORT gzopen (path, mode) - const char *path; - const char *mode; -{ - return gz_open (path, mode, -1); -} - -/* =========================================================================== - Associate a gzFile with the file descriptor fd. fd is not dup'ed here - to mimic the behavio(u)r of fdopen. -*/ -gzFile ZEXPORT gzdopen (fd, mode) - int fd; - const char *mode; -{ - char name[20]; - - if (fd < 0) return (gzFile)Z_NULL; - sprintf(name, "", fd); /* for debugging */ - - return gz_open (name, mode, fd); -} - -/* =========================================================================== - * Update the compression level and strategy - */ -int ZEXPORT gzsetparams (file, level, strategy) - gzFile file; - int level; - int strategy; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - /* Make room to allow flushing */ - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - } - s->stream.avail_out = Z_BUFSIZE; - } - - return deflateParams (&(s->stream), level, strategy); -} - -/* =========================================================================== - Read a byte from a gz_stream; update next_in and avail_in. Return EOF - for end of file. - IN assertion: the stream s has been sucessfully opened for reading. -*/ -local int get_byte(s) - gz_stream *s; -{ - if (s->z_eof) return EOF; - if (s->stream.avail_in == 0) { - errno = 0; - s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - /* klibc hack */ - if (errno) s->z_err = Z_ERRNO; - return EOF; - } - s->stream.next_in = s->inbuf; - } - s->stream.avail_in--; - return *(s->stream.next_in)++; -} - -/* =========================================================================== - Check the gzip header of a gz_stream opened for reading. Set the stream - mode to transparent if the gzip magic header is not present; set s->err - to Z_DATA_ERROR if the magic header is present but the rest of the header - is incorrect. - IN assertion: the stream s has already been created sucessfully; - s->stream.avail_in is zero for the first time, but may be non-zero - for concatenated .gz files. -*/ -local void check_header(s) - gz_stream *s; -{ - int method; /* method byte */ - int flags; /* flags byte */ - uInt len; - int c; - - /* Assure two bytes in the buffer so we can peek ahead -- handle case - where first byte of header is at the end of the buffer after the last - gzip segment */ - len = s->stream.avail_in; - if (len < 2) { - if (len) s->inbuf[0] = s->stream.next_in[0]; - errno = 0; - len = fread(s->inbuf + len, 1, Z_BUFSIZE >> len, s->file); - /* klibc hack */ - if (len == 0 && errno) s->z_err = Z_ERRNO; - s->stream.avail_in += len; - s->stream.next_in = s->inbuf; - if (s->stream.avail_in < 2) { - s->transparent = s->stream.avail_in; - return; - } - } - - /* Peek ahead to check the gzip magic header */ - if (s->stream.next_in[0] != gz_magic[0] || - s->stream.next_in[1] != gz_magic[1]) { - s->transparent = 1; - return; - } - s->stream.avail_in -= 2; - s->stream.next_in += 2; - - /* Check the rest of the gzip header */ - method = get_byte(s); - flags = get_byte(s); - if (method != Z_DEFLATED || (flags & RESERVED) != 0) { - s->z_err = Z_DATA_ERROR; - return; - } - - /* Discard time, xflags and OS code: */ - for (len = 0; len < 6; len++) (void)get_byte(s); - - if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */ - len = (uInt)get_byte(s); - len += ((uInt)get_byte(s))<<8; - /* len is garbage if EOF but the loop below will quit anyway */ - while (len-- != 0 && get_byte(s) != EOF) ; - } - if ((flags & ORIG_NAME) != 0) { /* skip the original file name */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & COMMENT) != 0) { /* skip the .gz file comment */ - while ((c = get_byte(s)) != 0 && c != EOF) ; - } - if ((flags & HEAD_CRC) != 0) { /* skip the header crc */ - for (len = 0; len < 2; len++) (void)get_byte(s); - } - s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK; -} - - /* =========================================================================== - * Cleanup then free the given gz_stream. Return a zlib error code. - Try freeing in the reverse order of allocations. - */ -local int destroy (s) - gz_stream *s; -{ - int err = Z_OK; - - if (!s) return Z_STREAM_ERROR; - - TRYFREE(s->msg); - - if (s->stream.state != NULL) { - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - err = Z_STREAM_ERROR; -#else - err = deflateEnd(&(s->stream)); -#endif - } else if (s->mode == 'r') { - err = inflateEnd(&(s->stream)); - } - } - if (s->file != NULL && fclose(s->file)) { -#ifdef ESPIPE - if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */ -#endif - err = Z_ERRNO; - } - if (s->z_err < 0) err = s->z_err; - - TRYFREE(s->inbuf); - TRYFREE(s->outbuf); - TRYFREE(s->path); - TRYFREE(s); - return err; -} - -/* =========================================================================== - Reads the given number of uncompressed bytes from the compressed file. - gzread returns the number of bytes actually read (0 for end of file). -*/ -int ZEXPORT gzread (file, buf, len) - gzFile file; - voidp buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - Bytef *start = (Bytef*)buf; /* starting point for crc computation */ - Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */ - - if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR; - - if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1; - if (s->z_err == Z_STREAM_END) return 0; /* EOF */ - - next_out = (Byte*)buf; - s->stream.next_out = (Bytef*)buf; - s->stream.avail_out = len; - - if (s->stream.avail_out && s->back != EOF) { - *next_out++ = s->back; - s->stream.next_out++; - s->stream.avail_out--; - s->back = EOF; - s->out++; - if (s->last) { - s->z_err = Z_STREAM_END; - return 1; - } - } - - while (s->stream.avail_out != 0) { - - if (s->transparent) { - /* Copy first the lookahead bytes: */ - uInt n = s->stream.avail_in; - if (n > s->stream.avail_out) n = s->stream.avail_out; - if (n > 0) { - zmemcpy(s->stream.next_out, s->stream.next_in, n); - next_out += n; - s->stream.next_out = next_out; - s->stream.next_in += n; - s->stream.avail_out -= n; - s->stream.avail_in -= n; - } - if (s->stream.avail_out > 0) { - s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out, - s->file); - } - len -= s->stream.avail_out; - s->in += len; - s->out += len; - if (len == 0) s->z_eof = 1; - return (int)len; - } - if (s->stream.avail_in == 0 && !s->z_eof) { - - errno = 0; - s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file); - if (s->stream.avail_in == 0) { - s->z_eof = 1; - if (errno) { - s->z_err = Z_ERRNO; - break; - } - } - s->stream.next_in = s->inbuf; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = inflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - - if (s->z_err == Z_STREAM_END) { - /* Check CRC and original size */ - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - start = s->stream.next_out; - - if (getLong(s) != s->crc) { - s->z_err = Z_DATA_ERROR; - } else { - (void)getLong(s); - /* The uncompressed length returned by above getlong() may be - * different from s->out in case of concatenated .gz files. - * Check for such files: - */ - check_header(s); - if (s->z_err == Z_OK) { - inflateReset(&(s->stream)); - s->crc = crc32(0L, Z_NULL, 0); - } - } - } - if (s->z_err != Z_OK || s->z_eof) break; - } - s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start)); - - return (int)(len - s->stream.avail_out); -} - - -/* =========================================================================== - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ -int ZEXPORT gzgetc(file) - gzFile file; -{ - unsigned char c; - - return gzread(file, &c, 1) == 1 ? c : -1; -} - - -/* =========================================================================== - Push one byte back onto the stream. -*/ -int ZEXPORT gzungetc(c, file) - int c; - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r' || c == EOF || s->back != EOF) return EOF; - s->back = c; - s->out--; - s->last = (s->z_err == Z_STREAM_END); - if (s->last) s->z_err = Z_OK; - s->z_eof = 0; - return c; -} - - -/* =========================================================================== - Reads bytes from the compressed file until len-1 characters are - read, or a newline character is read and transferred to buf, or an - end-of-file condition is encountered. The string is then terminated - with a null character. - gzgets returns buf, or Z_NULL in case of error. - - The current implementation is not optimized at all. -*/ -char * ZEXPORT gzgets(file, buf, len) - gzFile file; - char *buf; - int len; -{ - char *b = buf; - if (buf == Z_NULL || len <= 0) return Z_NULL; - - while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ; - *buf = '\0'; - return b == buf && len > 0 ? Z_NULL : b; -} - - -#ifndef NO_GZCOMPRESS -/* =========================================================================== - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of bytes actually written (0 in case of error). -*/ -int ZEXPORT gzwrite (file, buf, len) - gzFile file; - voidpc buf; - unsigned len; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.next_in = (Bytef*)buf; - s->stream.avail_in = len; - - while (s->stream.avail_in != 0) { - - if (s->stream.avail_out == 0) { - - s->stream.next_out = s->outbuf; - if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) { - s->z_err = Z_ERRNO; - break; - } - s->stream.avail_out = Z_BUFSIZE; - } - s->in += s->stream.avail_in; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), Z_NO_FLUSH); - s->in -= s->stream.avail_in; - s->out -= s->stream.avail_out; - if (s->z_err != Z_OK) break; - } - s->crc = crc32(s->crc, (const Bytef *)buf, len); - - return (int)(len - s->stream.avail_in); -} - - -/* =========================================================================== - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). -*/ -#ifdef STDC -#include - -int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...) -{ - char buf[Z_PRINTF_BUFSIZE]; - va_list va; - int len; - - buf[sizeof(buf) - 1] = 0; - va_start(va, format); -#ifdef NO_vsnprintf -# ifdef HAS_vsprintf_void - (void)vsprintf(buf, format, va); - va_end(va); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = vsprintf(buf, format, va); - va_end(va); -# endif -#else -# ifdef HAS_vsnprintf_void - (void)vsnprintf(buf, sizeof(buf), format, va); - va_end(va); - len = strlen(buf); -# else - len = vsnprintf(buf, sizeof(buf), format, va); - va_end(va); -# endif -#endif - if (len <= 0 || len >= (int)sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, (unsigned)len); -} -#else /* not ANSI C */ - -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) - gzFile file; - const char *format; - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; -{ - char buf[Z_PRINTF_BUFSIZE]; - int len; - - buf[sizeof(buf) - 1] = 0; -#ifdef NO_snprintf -# ifdef HAS_sprintf_void - sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - for (len = 0; len < sizeof(buf); len++) - if (buf[len] == 0) break; -# else - len = sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#else -# ifdef HAS_snprintf_void - snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen(buf); -# else - len = snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#endif - if (len <= 0 || len >= sizeof(buf) || buf[sizeof(buf) - 1] != 0) - return 0; - return gzwrite(file, buf, len); -} -#endif - -/* =========================================================================== - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ -int ZEXPORT gzputc(file, c) - gzFile file; - int c; -{ - unsigned char cc = (unsigned char) c; /* required for big endian systems */ - - return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1; -} - - -/* =========================================================================== - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ -int ZEXPORT gzputs(file, s) - gzFile file; - const char *s; -{ - return gzwrite(file, (char*)s, (unsigned)strlen(s)); -} - - -/* =========================================================================== - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. -*/ -local int do_flush (file, flush) - gzFile file; - int flush; -{ - uInt len; - int done = 0; - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR; - - s->stream.avail_in = 0; /* should be zero already anyway */ - - for (;;) { - len = Z_BUFSIZE - s->stream.avail_out; - - if (len != 0) { - if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) { - s->z_err = Z_ERRNO; - return Z_ERRNO; - } - s->stream.next_out = s->outbuf; - s->stream.avail_out = Z_BUFSIZE; - } - if (done) break; - s->out += s->stream.avail_out; - s->z_err = deflate(&(s->stream), flush); - s->out -= s->stream.avail_out; - - /* Ignore the second of two consecutive flushes: */ - if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK; - - /* deflate has finished flushing only when it hasn't used up - * all the available space in the output buffer: - */ - done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END); - - if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break; - } - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} - -int ZEXPORT gzflush (file, flush) - gzFile file; - int flush; -{ - gz_stream *s = (gz_stream*)file; - int err = do_flush (file, flush); - - if (err) return err; - fflush(s->file); - return s->z_err == Z_STREAM_END ? Z_OK : s->z_err; -} -#endif /* NO_GZCOMPRESS */ - -/* =========================================================================== - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error. - SEEK_END is not implemented, returns error. - In this version of the library, gzseek can be extremely slow. -*/ -z_off_t ZEXPORT gzseek (file, offset, whence) - gzFile file; - z_off_t offset; - int whence; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || whence == SEEK_END || - s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) { - return -1L; - } - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return -1L; -#else - if (whence == SEEK_SET) { - offset -= s->in; - } - if (offset < 0) return -1L; - - /* At this point, offset is the number of zero bytes to write. */ - if (s->inbuf == Z_NULL) { - s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */ - if (s->inbuf == Z_NULL) return -1L; - zmemzero(s->inbuf, Z_BUFSIZE); - } - while (offset > 0) { - uInt size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (uInt)offset; - - size = gzwrite(file, s->inbuf, size); - if (size == 0) return -1L; - - offset -= size; - } - return s->in; -#endif - } - /* Rest of function is for reading only */ - - /* compute absolute position */ - if (whence == SEEK_CUR) { - offset += s->out; - } - if (offset < 0) return -1L; - - if (s->transparent) { - /* map to fseek */ - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - if (fseek(s->file, offset, SEEK_SET) < 0) return -1L; - - s->in = s->out = offset; - return offset; - } - - /* For a negative seek, rewind and use positive seek */ - if (offset >= s->out) { - offset -= s->out; - } else if (gzrewind(file) < 0) { - return -1L; - } - /* offset is now the number of bytes to skip. */ - - if (offset != 0 && s->outbuf == Z_NULL) { - s->outbuf = (Byte*)ALLOC(Z_BUFSIZE); - if (s->outbuf == Z_NULL) return -1L; - } - if (offset && s->back != EOF) { - s->back = EOF; - s->out++; - offset--; - if (s->last) s->z_err = Z_STREAM_END; - } - while (offset > 0) { - int size = Z_BUFSIZE; - if (offset < Z_BUFSIZE) size = (int)offset; - - size = gzread(file, s->outbuf, (uInt)size); - if (size <= 0) return -1L; - offset -= size; - } - return s->out; -} - -/* =========================================================================== - Rewinds input file. -*/ -int ZEXPORT gzrewind (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL || s->mode != 'r') return -1; - - s->z_err = Z_OK; - s->z_eof = 0; - s->back = EOF; - s->stream.avail_in = 0; - s->stream.next_in = s->inbuf; - s->crc = crc32(0L, Z_NULL, 0); - if (!s->transparent) (void)inflateReset(&s->stream); - s->in = 0; - s->out = 0; - return fseek(s->file, s->start, SEEK_SET); -} - -/* =========================================================================== - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. -*/ -z_off_t ZEXPORT gztell (file) - gzFile file; -{ - return gzseek(file, 0L, SEEK_CUR); -} - -/* =========================================================================== - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ -int ZEXPORT gzeof (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - /* With concatenated compressed files that can have embedded - * crc trailers, z_eof is no longer the only/best indicator of EOF - * on a gz_stream. Handle end-of-stream error explicitly here. - */ - if (s == NULL || s->mode != 'r') return 0; - if (s->z_eof) return 1; - return s->z_err == Z_STREAM_END; -} - -/* =========================================================================== - Outputs a long in LSB order to the given file -*/ -local void putLong (file, x) - FILE *file; - uLong x; -{ - int n; - for (n = 0; n < 4; n++) { - fputc((int)(x & 0xff), file); - x >>= 8; - } -} - -/* =========================================================================== - Reads a long in LSB order from the given gz_stream. Sets z_err in case - of error. -*/ -local uLong getLong (s) - gz_stream *s; -{ - uLong x = (uLong)get_byte(s); - int c; - - x += ((uLong)get_byte(s))<<8; - x += ((uLong)get_byte(s))<<16; - c = get_byte(s); - if (c == EOF) s->z_err = Z_DATA_ERROR; - x += ((uLong)c)<<24; - return x; -} - -/* =========================================================================== - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. -*/ -int ZEXPORT gzclose (file) - gzFile file; -{ - int err; - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return Z_STREAM_ERROR; - - if (s->mode == 'w') { -#ifdef NO_GZCOMPRESS - return Z_STREAM_ERROR; -#else - err = do_flush (file, Z_FINISH); - if (err != Z_OK) return destroy((gz_stream*)file); - - putLong (s->file, s->crc); - putLong (s->file, (uLong)(s->in & 0xffffffff)); -#endif - } - return destroy((gz_stream*)file); -} - -/* =========================================================================== - Returns the error message for the last error which occured on the - given compressed file. errnum is set to zlib error number. If an - error occured in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ -const char * ZEXPORT gzerror (file, errnum) - gzFile file; - int *errnum; -{ - char *m; - gz_stream *s = (gz_stream*)file; - - if (s == NULL) { - *errnum = Z_STREAM_ERROR; - return (const char*)ERR_MSG(Z_STREAM_ERROR); - } - *errnum = s->z_err; - if (*errnum == Z_OK) return (const char*)""; - - m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg); - - if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err); - - TRYFREE(s->msg); - s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3); - if (s->msg == Z_NULL) return (const char*)ERR_MSG(Z_MEM_ERROR); - strcpy(s->msg, s->path); - strcat(s->msg, ": "); - strcat(s->msg, m); - return (const char*)s->msg; -} - -/* =========================================================================== - Clear the error and end-of-file flags, and do the same for the real file. -*/ -void ZEXPORT gzclearerr (file) - gzFile file; -{ - gz_stream *s = (gz_stream*)file; - - if (s == NULL) return; - if (s->z_err != Z_STREAM_END) s->z_err = Z_OK; - s->z_eof = 0; - /* klibc hack */ - /* clearerr(s->file); */ -} diff --git a/klibc/klibc/zlib/infback.c b/klibc/klibc/zlib/infback.c deleted file mode 100644 index 110b03b857..0000000000 --- a/klibc/klibc/zlib/infback.c +++ /dev/null @@ -1,619 +0,0 @@ -/* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - This code is largely copied from inflate.c. Normally either infback.o or - inflate.o would be linked into an application--not both. The interface - with inffast.c is retained so that optimized assembler-coded versions of - inflate_fast() can be used with either inflate.c or infback.c. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); - -/* - strm provides memory allocation functions in zalloc and zfree, or - Z_NULL to use the library memory allocation functions. - - windowBits is in the range 8..15, and window is a user-supplied - window and output buffer that is 2**windowBits bytes. - */ -int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) -z_stream FAR *strm; -int windowBits; -unsigned char FAR *window; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL || window == Z_NULL || - windowBits < 8 || windowBits > 15) - return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *)ZALLOC(strm, 1, - sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (voidpf)state; - state->wbits = windowBits; - state->wsize = 1U << windowBits; - state->window = window; - state->write = 0; - state->whave = 0; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -/* Macros for inflateBack(): */ - -/* Load returned state from inflate_fast() */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Set state from registers for inflate_fast() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = Z_NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflateBack() with - an error. */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = state->window; \ - left = state->wsize; \ - state->whave = left; \ - if (out(out_desc, put, left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is Z_NULL or the state was not initialized. - */ -int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) -z_stream FAR *strm; -in_func in; -void FAR *in_desc; -out_func out; -void FAR *out_desc; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code this; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* Check that the strm exists and that the state was initialized */ - if (strm == Z_NULL || strm->state == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* Reset the state */ - strm->msg = Z_NULL; - state->mode = TYPE; - state->last = 0; - state->whave = 0; - next = strm->next_in; - have = next != Z_NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = state->window; - left = state->wsize; - - /* Inflate until end of block marked as last */ - for (;;) - switch (state->mode) { - case TYPE: - /* determine and dispatch block type */ - if (state->last) { - BYTEBITS(); - state->mode = DONE; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - - /* copy stored block from input to output */ - while (state->length != 0) { - copy = state->length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - - /* get code length code lengths (not a typo) */ - state->have = 0; - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - - /* get length and distance code code lengths */ - state->have = 0; - while (state->have < state->nlen + state->ndist) { - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.val < 16) { - NEEDBITS(this.bits); - DROPBITS(this.bits); - state->lens[state->have++] = this.val; - } - else { - if (this.val == 16) { - NEEDBITS(this.bits + 2); - DROPBITS(this.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = (unsigned)(state->lens[state->have - 1]); - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (this.val == 17) { - NEEDBITS(this.bits + 3); - DROPBITS(this.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(this.bits + 7); - DROPBITS(this.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* build code tables */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= 6 && left >= 258) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; - inflate_fast(strm, state->wsize); - LOAD(); - break; - } - - /* get a literal, length, or end-of-block code */ - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.op && (this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - state->length = (unsigned)this.val; - - /* process literal */ - if (this.op == 0) { - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - ROOM(); - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - } - - /* process end of block */ - if (this.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - - /* invalid code */ - if (this.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - state->extra = (unsigned)(this.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - - /* get distance code */ - for (;;) { - this = state->distcode[BITS(state->distbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if ((this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - if (this.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)this.val; - - /* get distance extra bits, if any */ - state->extra = (unsigned)(this.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } - if (state->offset > state->wsize - (state->whave < state->wsize ? - left : 0)) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = state->wsize - state->offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } - else { - from = put - state->offset; - copy = left; - } - if (copy > state->length) copy = state->length; - state->length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (state->length != 0); - break; - - case DONE: - /* inflate stream terminated properly -- write leftover output */ - ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - default: /* can't happen, but makes compilers happy */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Return unused input */ - inf_leave: - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int ZEXPORT inflateBackEnd(strm) -z_stream FAR *strm; -{ - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/klibc/klibc/zlib/inffast.c b/klibc/klibc/zlib/inffast.c deleted file mode 100644 index c716440a92..0000000000 --- a/klibc/klibc/zlib/inffast.c +++ /dev/null @@ -1,305 +0,0 @@ -/* inffast.c -- fast decoding - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifndef ASMINF - -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - 68060 (Nikl) - */ -#ifdef POSTINC -# define OFF 0 -# define PUP(a) *(a)++ -#else -# define OFF 1 -# define PUP(a) *++(a) -#endif - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ -void inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - unsigned char FAR *in; /* local strm->next_in */ - unsigned char FAR *last; /* while in < last, enough input available */ - unsigned char FAR *out; /* local strm->next_out */ - unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ - unsigned char FAR *end; /* while out < end, enough space available */ - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ - unsigned long hold; /* local strm->hold */ - unsigned bits; /* local strm->bits */ - code const FAR *lcode; /* local strm->lencode */ - code const FAR *dcode; /* local strm->distcode */ - unsigned lmask; /* mask for first level of length codes */ - unsigned dmask; /* mask for first level of distance codes */ - code this; /* retrieved table entry */ - unsigned op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - unsigned len; /* match length, unused bytes */ - unsigned dist; /* match distance */ - unsigned char FAR *from; /* where to copy match from */ - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - in = strm->next_in - OFF; - last = in + (strm->avail_in - 5); - out = strm->next_out - OFF; - beg = out - (start - strm->avail_out); - end = out + (strm->avail_out - 257); - wsize = state->wsize; - whave = state->whave; - write = state->write; - window = state->window; - hold = state->hold; - bits = state->bits; - lcode = state->lencode; - dcode = state->distcode; - lmask = (1U << state->lenbits) - 1; - dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - do { - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - this = lcode[hold & lmask]; - dolen: - op = (unsigned)(this.bits); - hold >>= op; - bits -= op; - op = (unsigned)(this.op); - if (op == 0) { /* literal */ - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - PUP(out) = (unsigned char)(this.val); - } - else if (op & 16) { /* length base */ - len = (unsigned)(this.val); - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - len += (unsigned)hold & ((1U << op) - 1); - hold >>= op; - bits -= op; - } - Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - this = dcode[hold & dmask]; - dodist: - op = (unsigned)(this.bits); - hold >>= op; - bits -= op; - op = (unsigned)(this.op); - if (op & 16) { /* distance base */ - dist = (unsigned)(this.val); - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - } - dist += (unsigned)hold & ((1U << op) - 1); - hold >>= op; - bits -= op; - Tracevv((stderr, "inflate: distance %u\n", dist)); - op = (unsigned)(out - beg); /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - from = window - OFF; - if (write == 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - else if (write < op) { /* wrap around window */ - from += wsize + write - op; - op -= write; - if (op < len) { /* some from end of window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = window - OFF; - if (write < len) { /* some from start of window */ - op = write; - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - } - else { /* contiguous in window */ - from += write - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - while (len > 2) { - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - else { - from = out - dist; /* copy direct from output */ - do { /* minimum length is three */ - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } while (len > 2); - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - } - else if ((op & 64) == 0) { /* 2nd level distance code */ - this = dcode[this.val + (hold & ((1U << op) - 1))]; - goto dodist; - } - else { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - } - else if ((op & 64) == 0) { /* 2nd level length code */ - this = lcode[this.val + (hold & ((1U << op) - 1))]; - goto dolen; - } - else if (op & 32) { /* end-of-block */ - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - else { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - } while (in < last && out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - in -= len; - bits -= len << 3; - hold &= (1U << bits) - 1; - - /* update state and return */ - strm->next_in = in + OFF; - strm->next_out = out + OFF; - strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); - strm->avail_out = (unsigned)(out < end ? - 257 + (end - out) : 257 - (out - end)); - state->hold = hold; - state->bits = bits; - return; -} - -/* - inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - - Using bit fields for code structure - - Different op definition to avoid & for extra bits (do & for table bits) - - Three separate decoding do-loops for direct, window, and write == 0 - - Special case for distance > 1 copies to do overlapped load and store copy - - Explicit branch predictions (based on measured branch probabilities) - - Deferring match copy and interspersed it with decoding subsequent codes - - Swapping literal/length else - - Swapping window/direct else - - Larger unrolled copy loops (three is about right) - - Moving len -= 3 statement into middle of loop - */ - -#endif /* !ASMINF */ diff --git a/klibc/klibc/zlib/inffast.h b/klibc/klibc/zlib/inffast.h deleted file mode 100644 index 1e88d2d97b..0000000000 --- a/klibc/klibc/zlib/inffast.h +++ /dev/null @@ -1,11 +0,0 @@ -/* inffast.h -- header to use inffast.c - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -void inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/klibc/klibc/zlib/inffixed.h b/klibc/klibc/zlib/inffixed.h deleted file mode 100644 index 75ed4b5978..0000000000 --- a/klibc/klibc/zlib/inffixed.h +++ /dev/null @@ -1,94 +0,0 @@ - /* inffixed.h -- table for decoding fixed codes - * Generated automatically by makefixed(). - */ - - /* WARNING: this file should *not* be used by applications. It - is part of the implementation of the compression library and - is subject to change. Applications should only use zlib.h. - */ - - static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, - {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, - {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, - {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, - {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, - {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, - {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, - {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, - {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, - {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, - {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, - {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, - {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, - {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, - {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, - {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, - {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, - {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, - {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, - {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, - {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, - {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, - {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, - {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, - {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, - {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, - {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, - {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, - {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, - {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, - {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, - {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, - {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, - {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, - {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, - {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, - {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, - {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, - {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, - {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, - {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, - {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, - {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, - {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, - {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, - {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, - {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, - {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, - {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, - {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, - {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, - {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, - {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, - {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, - {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, - {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, - {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, - {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, - {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, - {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, - {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, - {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, - {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, - {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, - {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, - {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, - {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, - {0,9,255} - }; - - static const code distfix[32] = { - {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, - {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, - {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, - {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, - {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, - {22,5,193},{64,5,0} - }; diff --git a/klibc/klibc/zlib/inflate.c b/klibc/klibc/zlib/inflate.c deleted file mode 100644 index a53b5c7446..0000000000 --- a/klibc/klibc/zlib/inflate.c +++ /dev/null @@ -1,1270 +0,0 @@ -/* inflate.c -- zlib decompression - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * Change history: - * - * 1.2.beta0 24 Nov 2002 - * - First version -- complete rewrite of inflate to simplify code, avoid - * creation of window when not needed, minimize use of window when it is - * needed, make inffast.c even faster, implement gzip decoding, and to - * improve code readability and style over the previous zlib inflate code - * - * 1.2.beta1 25 Nov 2002 - * - Use pointers for available input and output checking in inffast.c - * - Remove input and output counters in inffast.c - * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 - * - Remove unnecessary second byte pull from length extra in inffast.c - * - Unroll direct copy to three copies per loop in inffast.c - * - * 1.2.beta2 4 Dec 2002 - * - Change external routine names to reduce potential conflicts - * - Correct filename to inffixed.h for fixed tables in inflate.c - * - Make hbuf[] unsigned char to match parameter type in inflate.c - * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) - * to avoid negation problem on Alphas (64 bit) in inflate.c - * - * 1.2.beta3 22 Dec 2002 - * - Add comments on state->bits assertion in inffast.c - * - Add comments on op field in inftrees.h - * - Fix bug in reuse of allocated window after inflateReset() - * - Remove bit fields--back to byte structure for speed - * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths - * - Change post-increments to pre-increments in inflate_fast(), PPC biased? - * - Add compile time option, POSTINC, to use post-increments instead (Intel?) - * - Make MATCH copy in inflate() much faster for when inflate_fast() not used - * - Use local copies of stream next and avail values, as well as local bit - * buffer and bit count in inflate()--for speed when inflate_fast() not used - * - * 1.2.beta4 1 Jan 2003 - * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings - * - Move a comment on output buffer sizes from inffast.c to inflate.c - * - Add comments in inffast.c to introduce the inflate_fast() routine - * - Rearrange window copies in inflate_fast() for speed and simplification - * - Unroll last copy for window match in inflate_fast() - * - Use local copies of window variables in inflate_fast() for speed - * - Pull out common write == 0 case for speed in inflate_fast() - * - Make op and len in inflate_fast() unsigned for consistency - * - Add FAR to lcode and dcode declarations in inflate_fast() - * - Simplified bad distance check in inflate_fast() - * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new - * source file infback.c to provide a call-back interface to inflate for - * programs like gzip and unzip -- uses window as output buffer to avoid - * window copying - * - * 1.2.beta5 1 Jan 2003 - * - Improved inflateBack() interface to allow the caller to provide initial - * input in strm. - * - Fixed stored blocks bug in inflateBack() - * - * 1.2.beta6 4 Jan 2003 - * - Added comments in inffast.c on effectiveness of POSTINC - * - Typecasting all around to reduce compiler warnings - * - Changed loops from while (1) or do {} while (1) to for (;;), again to - * make compilers happy - * - Changed type of window in inflateBackInit() to unsigned char * - * - * 1.2.beta7 27 Jan 2003 - * - Changed many types to unsigned or unsigned short to avoid warnings - * - Added inflateCopy() function - * - * 1.2.0 9 Mar 2003 - * - Changed inflateBack() interface to provide separate opaque descriptors - * for the in() and out() functions - * - Changed inflateBack() argument and in_func typedef to swap the length - * and buffer address return values for the input function - * - Check next_in and next_out for Z_NULL on entry to inflate() - * - * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifdef MAKEFIXED -# ifndef BUILDFIXED -# define BUILDFIXED -# endif -#endif - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, unsigned out)); -#ifdef BUILDFIXED - void makefixed OF((void)); -#endif -local unsigned syncsearch OF((unsigned FAR *have, unsigned char FAR *buf, - unsigned len)); - -int ZEXPORT inflateReset(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - strm->total_in = strm->total_out = state->total = 0; - strm->msg = Z_NULL; - state->mode = HEAD; - state->last = 0; - state->havedict = 0; - state->wsize = 0; - state->whave = 0; - state->hold = 0; - state->bits = 0; - state->lencode = state->distcode = state->next = state->codes; - Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) -z_streamp strm; -int windowBits; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL) return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; - } - if (strm->zfree == (free_func)0) strm->zfree = zcfree; - state = (struct inflate_state FAR *) - ZALLOC(strm, 1, sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (voidpf)state; - if (windowBits < 0) { - state->wrap = 0; - windowBits = -windowBits; - } - else { - state->wrap = (windowBits >> 4) + 1; -#ifdef GUNZIP - if (windowBits < 48) windowBits &= 15; -#endif - } - if (windowBits < 8 || windowBits > 15) { - ZFREE(strm, state); - strm->state = Z_NULL; - return Z_STREAM_ERROR; - } - state->wbits = (unsigned)windowBits; - state->window = Z_NULL; - return inflateReset(strm); -} - -int ZEXPORT inflateInit_(strm, version, stream_size) -z_streamp strm; -const char *version; -int stream_size; -{ - return inflateInit2_(strm, DEF_WBITS, version, stream_size); -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -#ifdef MAKEFIXED -#include - -/* - Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also - defines BUILDFIXED, so the tables are built on the fly. makefixed() writes - those tables to stdout, which would be piped to inffixed.h. A small program - can simply call makefixed to do this: - - void makefixed(void); - - int main(void) - { - makefixed(); - return 0; - } - - Then that can be linked with zlib built with MAKEFIXED defined and run: - - a.out > inffixed.h - */ -void makefixed() -{ - unsigned low, size; - struct inflate_state state; - - fixedtables(&state); - puts(" /* inffixed.h -- table for decoding fixed codes"); - puts(" * Generated automatically by makefixed()."); - puts(" */"); - puts(""); - puts(" /* WARNING: this file should *not* be used by applications."); - puts(" It is part of the implementation of this library and is"); - puts(" subject to change. Applications should only use zlib.h."); - puts(" */"); - puts(""); - size = 1U << 9; - printf(" static const code lenfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 7) == 0) printf("\n "); - printf("{%u,%u,%d}", state.lencode[low].op, state.lencode[low].bits, - state.lencode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); - size = 1U << 5; - printf("\n static const code distfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 6) == 0) printf("\n "); - printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, - state.distcode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); -} -#endif /* MAKEFIXED */ - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -local int updatewindow(strm, out) -z_streamp strm; -unsigned out; -{ - struct inflate_state FAR *state; - unsigned copy, dist; - - state = (struct inflate_state FAR *)strm->state; - - /* if it hasn't been done already, allocate space for the window */ - if (state->window == Z_NULL) { - state->window = (unsigned char FAR *) - ZALLOC(strm, 1U << state->wbits, - sizeof(unsigned char)); - if (state->window == Z_NULL) return 1; - } - - /* if window not in use yet, initialize */ - if (state->wsize == 0) { - state->wsize = 1U << state->wbits; - state->write = 0; - state->whave = 0; - } - - /* copy state->wsize or less output bytes into the circular window */ - copy = out - strm->avail_out; - if (copy >= state->wsize) { - zmemcpy(state->window, strm->next_out - state->wsize, state->wsize); - state->write = 0; - state->whave = state->wsize; - } - else { - dist = state->wsize - state->write; - if (dist > copy) dist = copy; - zmemcpy(state->window + state->write, strm->next_out - copy, dist); - copy -= dist; - if (copy) { - zmemcpy(state->window, strm->next_out - copy, copy); - state->write = copy; - state->whave = state->wsize; - } - else { - state->write += dist; - if (state->write == state->wsize) state->write = 0; - if (state->whave < state->wsize) state->whave += dist; - } - } - return 0; -} - -/* Macros for inflate(): */ - -/* check function to use adler32() for zlib or crc32() for gzip */ -#ifdef GUNZIP -# define UPDATE(check, buf, len) \ - (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) -#else -# define UPDATE(check, buf, len) adler32(check, buf, len) -#endif - -/* check macros for header crc */ -#ifdef GUNZIP -# define CRC2(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - check = crc32(check, hbuf, 2); \ - } while (0) - -# define CRC4(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - hbuf[2] = (unsigned char)((word) >> 16); \ - hbuf[3] = (unsigned char)((word) >> 24); \ - check = crc32(check, hbuf, 4); \ - } while (0) -#endif - -/* Load registers with state in inflate() for speed */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Restore state from registers in inflate() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflate() - if there is no input available. */ -#define PULLBYTE() \ - do { \ - if (have == 0) goto inf_leave; \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflate(). */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Reverse the bytes in a 32-bit value */ -#define REVERSE(q) \ - ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - -/* - inflate() uses a state machine to process as much input data and generate as - much output data as possible before returning. The state machine is - structured roughly as follows: - - for (;;) switch (state) { - ... - case STATEn: - if (not enough input data or output space to make progress) - return; - ... make progress ... - state = STATEm; - break; - ... - } - - so when inflate() is called again, the same case is attempted again, and - if the appropriate resources are provided, the machine proceeds to the - next state. The NEEDBITS() macro is usually the way the state evaluates - whether it can proceed or should return. NEEDBITS() does the return if - the requested bits are not available. The typical use of the BITS macros - is: - - NEEDBITS(n); - ... do something with BITS(n) ... - DROPBITS(n); - - where NEEDBITS(n) either returns from inflate() if there isn't enough - input left to load n bits into the accumulator, or it continues. BITS(n) - gives the low n bits in the accumulator. When done, DROPBITS(n) drops - the low n bits off the accumulator. INITBITS() clears the accumulator - and sets the number of available bits to zero. BYTEBITS() discards just - enough bits to put the accumulator on a byte boundary. After BYTEBITS() - and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. - - NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return - if there is no input available. The decoding of variable length codes uses - PULLBYTE() directly in order to pull just enough bytes to decode the next - code, and no more. - - Some states loop until they get enough input, making sure that enough - state information is maintained to continue the loop where it left off - if NEEDBITS() returns in the loop. For example, want, need, and keep - would all have to actually be part of the saved state in case NEEDBITS() - returns: - - case STATEw: - while (want < need) { - NEEDBITS(n); - keep[want++] = BITS(n); - DROPBITS(n); - } - state = STATEx; - case STATEx: - - As shown above, if the next state is also the next case, then the break - is omitted. - - A state may also return if there is not enough output space available to - complete that state. Those states are copying stored data, writing a - literal byte, and copying a matching string. - - When returning, a "goto inf_leave" is used to update the total counters, - update the check value, and determine whether any progress has been made - during that inflate() call in order to return the proper return code. - Progress is defined as a change in either strm->avail_in or strm->avail_out. - When there is a window, goto inf_leave will update the window with the last - output written. If a goto inf_leave occurs in the middle of decompression - and there is no window currently, goto inf_leave will create one and copy - output to the window for the next call of inflate(). - - In this implementation, the flush parameter of inflate() only affects the - return code (per zlib.h). inflate() always writes as much as possible to - strm->next_out, given the space available and the provided input--the effect - documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers - the allocation of and copying into a sliding window until necessary, which - provides the effect documented in zlib.h for Z_FINISH when the entire input - stream available. So the only thing the flush parameter actually does is: - when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it - will return Z_BUF_ERROR if it has not reached the end of the stream. - */ - -int ZEXPORT inflate(strm, flush) -z_streamp strm; -int flush; -{ - struct inflate_state FAR *state; - unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned in, out; /* save starting available input and output */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code this; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ -#ifdef GUNZIP - unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ -#endif - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0)) - return Z_STREAM_ERROR; - - state = (struct inflate_state FAR *)strm->state; - if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ - LOAD(); - in = have; - out = left; - ret = Z_OK; - for (;;) - switch (state->mode) { - case HEAD: - if (state->wrap == 0) { - state->mode = TYPEDO; - break; - } - NEEDBITS(16); -#ifdef GUNZIP - if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ - state->check = crc32(0L, Z_NULL, 0); - CRC2(state->check, hold); - INITBITS(); - state->mode = FLAGS; - break; - } - state->flags = 0; /* expect zlib header */ - if (!(state->wrap & 1) || /* check if zlib header allowed */ -#else - if ( -#endif - ((BITS(8) << 8) + (hold >> 8)) % 31) { - strm->msg = (char *)"incorrect header check"; - state->mode = BAD; - break; - } - if (BITS(4) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - DROPBITS(4); - if (BITS(4) + 8 > state->wbits) { - strm->msg = (char *)"invalid window size"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: zlib header ok\n")); - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = hold & 0x200 ? DICTID : TYPE; - INITBITS(); - break; -#ifdef GUNZIP - case FLAGS: - NEEDBITS(16); - state->flags = (int)(hold); - if ((state->flags & 0xff) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - if (state->flags & 0xe000) { - strm->msg = (char *)"unknown header flags set"; - state->mode = BAD; - break; - } - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = TIME; - case TIME: - NEEDBITS(32); - if (state->flags & 0x0200) CRC4(state->check, hold); - INITBITS(); - state->mode = OS; - case OS: - NEEDBITS(16); - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = EXLEN; - case EXLEN: - if (state->flags & 0x0400) { - NEEDBITS(16); - state->length = (unsigned)(hold); - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - } - state->mode = EXTRA; - case EXTRA: - if (state->flags & 0x0400) { - copy = state->length; - if (copy > have) copy = have; - if (copy) { - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - state->length -= copy; - } - if (state->length) goto inf_leave; - } - state->mode = NAME; - case NAME: - if (state->flags & 0x0800) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - } while (len && copy < have); - if (state->flags & 0x02000) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - state->mode = COMMENT; - case COMMENT: - if (state->flags & 0x1000) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - } while (len && copy < have); - if (state->flags & 0x02000) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - state->mode = HCRC; - case HCRC: - if (state->flags & 0x0200) { - NEEDBITS(16); - if (hold != (state->check & 0xffff)) { - strm->msg = (char *)"header crc mismatch"; - state->mode = BAD; - break; - } - INITBITS(); - } - strm->adler = state->check = crc32(0L, Z_NULL, 0); - state->mode = TYPE; - break; -#endif - case DICTID: - NEEDBITS(32); - strm->adler = state->check = REVERSE(hold); - INITBITS(); - state->mode = DICT; - case DICT: - if (state->havedict == 0) { - RESTORE(); - return Z_NEED_DICT; - } - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = TYPE; - case TYPE: - if (flush == Z_BLOCK) goto inf_leave; - case TYPEDO: - if (state->last) { - BYTEBITS(); - state->mode = CHECK; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - case STORED: - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - state->mode = COPY; - case COPY: - copy = state->length; - if (copy) { - if (copy > have) copy = have; - if (copy > left) copy = left; - if (copy == 0) goto inf_leave; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - break; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - case TABLE: - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - state->have = 0; - state->mode = LENLENS; - case LENLENS: - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - state->have = 0; - state->mode = CODELENS; - case CODELENS: - while (state->have < state->nlen + state->ndist) { - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.val < 16) { - NEEDBITS(this.bits); - DROPBITS(this.bits); - state->lens[state->have++] = this.val; - } - else { - if (this.val == 16) { - NEEDBITS(this.bits + 2); - DROPBITS(this.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = state->lens[state->have - 1]; - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (this.val == 17) { - NEEDBITS(this.bits + 3); - DROPBITS(this.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(this.bits + 7); - DROPBITS(this.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* build code tables */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - case LEN: - if (have >= 6 && left >= 258) { - RESTORE(); - inflate_fast(strm, out); - LOAD(); - break; - } - for (;;) { - this = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if (this.op && (this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - state->length = (unsigned)this.val; - if ((int)(this.op) == 0) { - Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", this.val)); - state->mode = LIT; - break; - } - if (this.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - if (this.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - state->extra = (unsigned)(this.op) & 15; - state->mode = LENEXT; - case LENEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - state->mode = DIST; - case DIST: - for (;;) { - this = state->distcode[BITS(state->distbits)]; - if ((unsigned)(this.bits) <= bits) break; - PULLBYTE(); - } - if ((this.op & 0xf0) == 0) { - last = this; - for (;;) { - this = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + this.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(this.bits); - if (this.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)this.val; - state->extra = (unsigned)(this.op) & 15; - state->mode = DISTEXT; - case DISTEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } - if (state->offset > state->whave + out - left) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - state->mode = MATCH; - case MATCH: - if (left == 0) goto inf_leave; - copy = out - left; - if (state->offset > copy) { /* copy from window */ - copy = state->offset - copy; - if (copy > state->write) { - copy -= state->write; - from = state->window + (state->wsize - copy); - } - else - from = state->window + (state->write - copy); - if (copy > state->length) copy = state->length; - } - else { /* copy from output */ - from = put - state->offset; - copy = state->length; - } - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = *from++; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; - case LIT: - if (left == 0) goto inf_leave; - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - case CHECK: - if (state->wrap) { - NEEDBITS(32); - out -= left; - strm->total_out += out; - state->total += out; - if (out) - strm->adler = state->check = - UPDATE(state->check, put - out, out); - out = left; - if (( -#ifdef GUNZIP - state->flags ? hold : -#endif - REVERSE(hold)) != state->check) { - strm->msg = (char *)"incorrect data check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: check matches trailer\n")); - } -#ifdef GUNZIP - state->mode = LENGTH; - case LENGTH: - if (state->wrap && state->flags) { - NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { - strm->msg = (char *)"incorrect length check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: length matches trailer\n")); - } -#endif - state->mode = DONE; - case DONE: - ret = Z_STREAM_END; - goto inf_leave; - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - default: - return Z_STREAM_ERROR; - } - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - inf_leave: - RESTORE(); - if (state->wsize || (state->mode < CHECK && out != strm->avail_out)) - if (updatewindow(strm, out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - in -= strm->avail_in; - out -= strm->avail_out; - strm->total_in += in; - strm->total_out += out; - state->total += out; - if (state->wrap && out) - strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); - strm->data_type = state->bits + (state->last ? 64 : 0) + - (state->mode == TYPE ? 128 : 0); - if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) - ret = Z_BUF_ERROR; - return ret; -} - -int ZEXPORT inflateEnd(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->window != Z_NULL) ZFREE(strm, state->window); - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} - -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) -z_streamp strm; -const Bytef *dictionary; -uInt dictLength; -{ - struct inflate_state FAR *state; - unsigned long id; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->mode != DICT) return Z_STREAM_ERROR; - - /* check for correct dictionary id */ - id = adler32(0L, Z_NULL, 0); - id = adler32(id, dictionary, dictLength); - if (id != state->check) return Z_DATA_ERROR; - - /* copy dictionary to window */ - if (updatewindow(strm, strm->avail_out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - if (dictLength > state->wsize) { - zmemcpy(state->window, dictionary + dictLength - state->wsize, - state->wsize); - state->whave = state->wsize; - } - else { - zmemcpy(state->window + state->wsize - dictLength, dictionary, - dictLength); - state->whave = dictLength; - } - state->havedict = 1; - Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -/* - Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found - or when out of input. When called, *have is the number of pattern bytes - found in order so far, in 0..3. On return *have is updated to the new - state. If on return *have equals four, then the pattern was found and the - return value is how many bytes were read including the last byte of the - pattern. If *have is less than four, then the pattern has not been found - yet and the return value is len. In the latter case, syncsearch() can be - called again with more data and the *have state. *have is initialized to - zero for the first call. - */ -local unsigned syncsearch(have, buf, len) -unsigned FAR *have; -unsigned char FAR *buf; -unsigned len; -{ - unsigned got; - unsigned next; - - got = *have; - next = 0; - while (next < len && got < 4) { - if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) - got++; - else if (buf[next]) - got = 0; - else - got = 4 - got; - next++; - } - *have = got; - return next; -} - -int ZEXPORT inflateSync(strm) -z_streamp strm; -{ - unsigned len; /* number of bytes to look at or looked at */ - unsigned long in, out; /* temporary to save total_in and total_out */ - unsigned char buf[4]; /* to restore bit buffer to byte string */ - struct inflate_state FAR *state; - - /* check parameters */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; - - /* if first time, start search in bit buffer */ - if (state->mode != SYNC) { - state->mode = SYNC; - state->hold <<= state->bits & 7; - state->bits -= state->bits & 7; - len = 0; - while (state->bits >= 8) { - buf[len++] = (unsigned char)(state->hold); - state->hold >>= 8; - state->bits -= 8; - } - state->have = 0; - syncsearch(&(state->have), buf, len); - } - - /* search available input */ - len = syncsearch(&(state->have), strm->next_in, strm->avail_in); - strm->avail_in -= len; - strm->next_in += len; - strm->total_in += len; - - /* return no joy or set up to restart inflate() on a new block */ - if (state->have != 4) return Z_DATA_ERROR; - in = strm->total_in; out = strm->total_out; - inflateReset(strm); - strm->total_in = in; strm->total_out = out; - state->mode = TYPE; - return Z_OK; -} - -/* - Returns true if inflate is currently at the end of a block generated by - Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - implementation to provide an additional safety check. PPP uses - Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored - block. When decompressing, PPP checks that at the end of input packet, - inflate is waiting for these length bytes. - */ -int ZEXPORT inflateSyncPoint(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - return state->mode == STORED && state->bits == 0; -} - -int ZEXPORT inflateCopy(dest, source) -z_streamp dest; -z_streamp source; -{ - struct inflate_state FAR *state; - struct inflate_state FAR *copy; - unsigned char FAR *window; - - /* check input */ - if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || - source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)source->state; - - /* allocate space */ - copy = (struct inflate_state FAR *) - ZALLOC(source, 1, sizeof(struct inflate_state)); - if (copy == Z_NULL) return Z_MEM_ERROR; - window = Z_NULL; - if (state->window != Z_NULL) { - window = (unsigned char FAR *) - ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); - if (window == Z_NULL) { - ZFREE(source, copy); - return Z_MEM_ERROR; - } - } - - /* copy state */ - *dest = *source; - *copy = *state; - copy->lencode = copy->codes + (state->lencode - state->codes); - copy->distcode = copy->codes + (state->distcode - state->codes); - copy->next = copy->codes + (state->next - state->codes); - if (window != Z_NULL) - zmemcpy(window, state->window, 1U << state->wbits); - copy->window = window; - dest->state = (voidpf)copy; - return Z_OK; -} diff --git a/klibc/klibc/zlib/inflate.h b/klibc/klibc/zlib/inflate.h deleted file mode 100644 index 9a12c8fd29..0000000000 --- a/klibc/klibc/zlib/inflate.h +++ /dev/null @@ -1,117 +0,0 @@ -/* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer decoding by inflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip decoding - should be left enabled. */ -#ifndef NO_GZIP -# define GUNZIP -#endif - -/* Possible inflate modes between inflate() calls */ -typedef enum { - HEAD, /* i: waiting for magic header */ -#ifdef GUNZIP - FLAGS, /* i: waiting for method and flags (gzip) */ - TIME, /* i: waiting for modification time (gzip) */ - OS, /* i: waiting for extra flags and operating system (gzip) */ - EXLEN, /* i: waiting for extra length (gzip) */ - EXTRA, /* i: waiting for extra bytes (gzip) */ - NAME, /* i: waiting for end of file name (gzip) */ - COMMENT, /* i: waiting for end of comment (gzip) */ - HCRC, /* i: waiting for header crc (gzip) */ -#endif - DICTID, /* i: waiting for dictionary check value */ - DICT, /* waiting for inflateSetDictionary() call */ - TYPE, /* i: waiting for type bits, including last-flag bit */ - TYPEDO, /* i: same, but skip check to exit inflate on new block */ - STORED, /* i: waiting for stored size (length and complement) */ - COPY, /* i/o: waiting for input or output to copy stored block */ - TABLE, /* i: waiting for dynamic block table lengths */ - LENLENS, /* i: waiting for code length code lengths */ - CODELENS, /* i: waiting for length/lit and distance code lengths */ - LEN, /* i: waiting for length/lit code */ - LENEXT, /* i: waiting for length extra bits */ - DIST, /* i: waiting for distance code */ - DISTEXT, /* i: waiting for distance extra bits */ - MATCH, /* o: waiting for output space to copy string */ - LIT, /* o: waiting for output space to write literal */ - CHECK, /* i: waiting for 32-bit check value */ -#ifdef GUNZIP - LENGTH, /* i: waiting for 32-bit length (gzip) */ -#endif - DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ - SYNC /* looking for synchronization bytes to restart inflate() */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to the BAD or MEM mode -- not shown for clarity) - - Process header: - HEAD -> (gzip) or (zlib) - (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME - NAME -> COMMENT -> HCRC -> TYPE - (zlib) -> DICTID or TYPE - DICTID -> DICT -> TYPE - Read deflate blocks: - TYPE -> STORED or TABLE or LEN or CHECK - STORED -> COPY -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN - Read deflate codes: - LEN -> LENEXT or LIT or TYPE - LENEXT -> DIST -> DISTEXT -> MATCH -> LEN - LIT -> LEN - Process trailer: - CHECK -> LENGTH -> DONE - */ - -/* state maintained between inflate() calls. Approximately 7K bytes. */ -struct inflate_state { - inflate_mode mode; /* current inflate mode */ - int last; /* true if processing last block */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ - unsigned long check; /* protected copy of check value */ - unsigned long total; /* protected copy of output count */ - /* sliding window */ - unsigned wbits; /* log base 2 of requested window size */ - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned write; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - /* bit accumulator */ - unsigned long hold; /* input bit accumulator */ - unsigned bits; /* number of bits in "in" */ - /* for string and stored block copying */ - unsigned length; /* literal or length of data to copy */ - unsigned offset; /* distance back to copy string from */ - /* for table and code decoding */ - unsigned extra; /* extra bits needed */ - /* fixed and dynamic code tables */ - code const FAR *lencode; /* starting table for length/literal codes */ - code const FAR *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - unsigned have; /* number of code lengths in lens[] */ - code FAR *next; /* next available space in codes[] */ - unsigned short lens[320]; /* temporary storage for code lengths */ - unsigned short work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ -}; diff --git a/klibc/klibc/zlib/inftrees.c b/klibc/klibc/zlib/inftrees.c deleted file mode 100644 index 3bb56398e1..0000000000 --- a/klibc/klibc/zlib/inftrees.c +++ /dev/null @@ -1,321 +0,0 @@ -/* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" - -#define MAXBITS 15 - -const char inflate_copyright[] = - " inflate 1.2.1 Copyright 1995-2003 Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* - Build a set of tables to decode the provided canonical Huffman code. - The code lengths are lens[0..codes-1]. The result starts at *table, - whose indices are 0..2^bits-1. work is a writable array of at least - lens shorts, which is used as a work area. type is the type of code - to be generated, CODES, LENS, or DISTS. On return, zero is success, - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table - on return points to the next available entry's address. bits is the - requested root table index bits, and on return it is the actual root - table index bits. It will differ if the request is greater than the - longest code or if it is less than the shortest code. - */ -int inflate_table(type, lens, codes, table, bits, work) -codetype type; -unsigned short FAR *lens; -unsigned codes; -code FAR * FAR *table; -unsigned FAR *bits; -unsigned short FAR *work; -{ - unsigned len; /* a code's length in bits */ - unsigned sym; /* index of code symbols */ - unsigned min, max; /* minimum and maximum code lengths */ - unsigned root; /* number of index bits for root table */ - unsigned curr; /* number of index bits for current table */ - unsigned drop; /* code bits to drop for sub-table */ - int left; /* number of prefix codes available */ - unsigned used; /* code entries in table used */ - unsigned huff; /* Huffman code */ - unsigned incr; /* for incrementing code, index */ - unsigned fill; /* index for replicating entries */ - unsigned low; /* low bits for current root entry */ - unsigned mask; /* mask for low root bits */ - code this; /* table entry for duplication */ - code FAR *next; /* next available space in table */ - const unsigned short FAR *base; /* base value table to use */ - const unsigned short FAR *extra; /* extra bits table to use */ - int end; /* use base and extra for symbol > end */ - unsigned short count[MAXBITS+1]; /* number of codes of each length */ - unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ - static const unsigned short lbase[31] = { /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - static const unsigned short lext[31] = { /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 76, 66}; - static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0}; - static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64}; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) - count[len] = 0; - for (sym = 0; sym < codes; sym++) - count[lens[sym]]++; - - /* bound code lengths, force root to be within code lengths */ - root = *bits; - for (max = MAXBITS; max >= 1; max--) - if (count[max] != 0) break; - if (root > max) root = max; - if (max == 0) return -1; /* no codes! */ - for (min = 1; min <= MAXBITS; min++) - if (count[min] != 0) break; - if (root < min) root = min; - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) return -1; /* over-subscribed */ - } - if (left > 0 && (type == CODES || (codes - count[0] != 1))) - return -1; /* incomplete set */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + count[len]; - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) - if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked when a LENS table is being made - against the space in *table, ENOUGH, minus the maximum space needed by - the worst case distance code, MAXD. This should never happen, but the - sufficiency of ENOUGH has not been proven exhaustively, hence the check. - This assumes that when type == LENS, bits == 9. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - switch (type) { - case CODES: - base = extra = work; /* dummy value--not used */ - end = 19; - break; - case LENS: - base = lbase; - base -= 257; - extra = lext; - extra -= 257; - end = 256; - break; - default: /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize state for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = *table; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = (unsigned)(-1); /* trigger new sub-table when len > root */ - used = 1U << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if (type == LENS && used >= ENOUGH - MAXD) - return 1; - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - this.bits = (unsigned char)(len - drop); - if ((int)(work[sym]) < end) { - this.op = (unsigned char)0; - this.val = work[sym]; - } - else if ((int)(work[sym]) > end) { - this.op = (unsigned char)(extra[work[sym]]); - this.val = base[work[sym]]; - } - else { - this.op = (unsigned char)(32 + 64); /* end of block */ - this.val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1U << (len - drop); - fill = 1U << curr; - do { - fill -= incr; - next[(huff >> drop) + fill] = this; - } while (fill != 0); - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - - /* go to next symbol, update count, len */ - sym++; - if (--(count[len]) == 0) { - if (len == max) break; - len = lens[work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) != low) { - /* if first time, transition to sub-tables */ - if (drop == 0) - drop = root; - - /* increment past last table */ - next += 1U << curr; - - /* determine length of next table */ - curr = len - drop; - left = (int)(1 << curr); - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) break; - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1U << curr; - if (type == LENS && used >= ENOUGH - MAXD) - return 1; - - /* point entry in root table to sub-table */ - low = huff & mask; - (*table)[low].op = (unsigned char)curr; - (*table)[low].bits = (unsigned char)root; - (*table)[low].val = (unsigned short)(next - *table); - } - } - - /* - Fill in rest of table for incomplete codes. This loop is similar to the - loop above in incrementing huff for table indices. It is assumed that - len is equal to curr + drop, so there is no loop needed to increment - through high index bits. When the current sub-table is filled, the loop - drops back to the root table to fill in any remaining entries there. - */ - this.op = (unsigned char)64; /* invalid code marker */ - this.bits = (unsigned char)(len - drop); - this.val = (unsigned short)0; - while (huff != 0) { - /* when done with sub-table, drop back to root table */ - if (drop != 0 && (huff & mask) != low) { - drop = 0; - len = root; - next = *table; - curr = root; - this.bits = (unsigned char)len; - } - - /* put invalid code marker in table */ - next[huff >> drop] = this; - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - } - - /* set return parameters */ - *table += used; - *bits = root; - return 0; -} diff --git a/klibc/klibc/zlib/inftrees.h b/klibc/klibc/zlib/inftrees.h deleted file mode 100644 index 82d365a7e9..0000000000 --- a/klibc/klibc/zlib/inftrees.h +++ /dev/null @@ -1,55 +0,0 @@ -/* inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - unsigned short val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 0001eeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* Maximum size of dynamic tree. The maximum found in a long but non- - exhaustive search was 1004 code structures (850 for length/literals - and 154 for distances, the latter actually the result of an - exhaustive search). The true maximum is not known, but the value - below is more than safe. */ -#define ENOUGH 1440 -#define MAXD 154 - -/* Type of code to build for inftable() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -extern int inflate_table OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); diff --git a/klibc/klibc/zlib/trees.c b/klibc/klibc/zlib/trees.c deleted file mode 100644 index f7748c4dcc..0000000000 --- a/klibc/klibc/zlib/trees.c +++ /dev/null @@ -1,1215 +0,0 @@ -/* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2003 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. - * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. - * - * REFERENCES - * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc - * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. - * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. - */ - -/* @(#) $Id: trees.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -/* #define GEN_TREES_H */ - -#include "deflate.h" - -#ifdef DEBUG -# include -#endif - -/* =========================================================================== - * Constants - */ - -#define MAX_BL_BITS 7 -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -#define END_BLOCK 256 -/* end of block literal code */ - -#define REP_3_6 16 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -#define REPZ_3_10 17 -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -#define REPZ_11_138 18 -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ - = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; - -local const int extra_dbits[D_CODES] /* extra bits for each distance code */ - = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ - = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; - -local const uch bl_order[BL_CODES] - = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -#define Buf_size (8 * 2*sizeof(char)) -/* Number of bits used within bi_buf. (bi_buf might be implemented on - * more than 16 bits on some systems.) - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ - -#if defined(GEN_TREES_H) || !defined(STDC) -/* non ANSI compilers may not accept trees.h */ - -local ct_data static_ltree[L_CODES+2]; -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -local ct_data static_dtree[D_CODES]; -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -uch _dist_code[DIST_CODE_LEN]; -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -uch _length_code[MAX_MATCH-MIN_MATCH+1]; -/* length code for each normalized match length (0 == MIN_MATCH) */ - -local int base_length[LENGTH_CODES]; -/* First normalized length for each code (0 = MIN_MATCH) */ - -local int base_dist[D_CODES]; -/* First normalized distance for each code (0 = distance of 1) */ - -#else -# include "trees.h" -#endif /* GEN_TREES_H */ - -struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const intf *extra_bits; /* extra bits for each code or NULL */ - int extra_base; /* base index for extra_bits */ - int elems; /* max number of elements in the tree */ - int max_length; /* max bit length for the codes */ -}; - -local static_tree_desc static_l_desc = -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; - -local static_tree_desc static_d_desc = -{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; - -local static_tree_desc static_bl_desc = -{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; - -/* =========================================================================== - * Local (static) routines in this file. - */ - -local void tr_static_init OF((void)); -local void init_block OF((deflate_state *s)); -local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); -local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); -local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); -local void build_tree OF((deflate_state *s, tree_desc *desc)); -local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local int build_bl_tree OF((deflate_state *s)); -local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, - int blcodes)); -local void compress_block OF((deflate_state *s, ct_data *ltree, - ct_data *dtree)); -local void set_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); -local void bi_windup OF((deflate_state *s)); -local void bi_flush OF((deflate_state *s)); -local void copy_block OF((deflate_state *s, charf *buf, unsigned len, - int header)); - -#ifdef GEN_TREES_H -local void gen_trees_header OF((void)); -#endif - -#ifndef DEBUG -# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) - /* Send a code of the given tree. c and tree must not have side effects */ - -#else /* DEBUG */ -# define send_code(s, c, tree) \ - { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ - send_bits(s, tree[c].Code, tree[c].Len); } -#endif - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -#define put_short(s, w) { \ - put_byte(s, (uch)((w) & 0xff)); \ - put_byte(s, (uch)((ush)(w) >> 8)); \ -} - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -#ifdef DEBUG -local void send_bits OF((deflate_state *s, int value, int length)); - -local void send_bits(s, value, length) - deflate_state *s; - int value; /* value to send */ - int length; /* number of bits */ -{ - Tracevv((stderr," l %2d v %4x ", length, value)); - Assert(length > 0 && length <= 15, "invalid length"); - s->bits_sent += (ulg)length; - - /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) - * unused bits in value. - */ - if (s->bi_valid > (int)Buf_size - length) { - s->bi_buf |= (value << s->bi_valid); - put_short(s, s->bi_buf); - s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); - s->bi_valid += length - Buf_size; - } else { - s->bi_buf |= value << s->bi_valid; - s->bi_valid += length; - } -} -#else /* !DEBUG */ - -#define send_bits(s, value, length) \ -{ int len = length;\ - if (s->bi_valid > (int)Buf_size - len) {\ - int val = value;\ - s->bi_buf |= (val << s->bi_valid);\ - put_short(s, s->bi_buf);\ - s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ - s->bi_valid += len - Buf_size;\ - } else {\ - s->bi_buf |= (value) << s->bi_valid;\ - s->bi_valid += len;\ - }\ -} -#endif /* DEBUG */ - - -/* the arguments must not have side effects */ - -/* =========================================================================== - * Initialize the various 'constant' tables. - */ -local void tr_static_init() -{ -#if defined(GEN_TREES_H) || !defined(STDC) - static int static_init_done = 0; - int n; /* iterates over tree elements */ - int bits; /* bit counter */ - int length; /* length value */ - int code; /* code value */ - int dist; /* distance index */ - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - if (static_init_done) return; - - /* For some embedded targets, global variables are not initialized: */ - static_l_desc.static_tree = static_ltree; - static_l_desc.extra_bits = extra_lbits; - static_d_desc.static_tree = static_dtree; - static_d_desc.extra_bits = extra_dbits; - static_bl_desc.extra_bits = extra_blbits; - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES-1; code++) { - base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ - dist = 0; - for (code = 0 ; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ - for ( ; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { - _dist_code[256 + dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; - n = 0; - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n].Len = 5; - static_dtree[n].Code = bi_reverse((unsigned)n, 5); - } - static_init_done = 1; - -# ifdef GEN_TREES_H - gen_trees_header(); -# endif -#endif /* defined(GEN_TREES_H) || !defined(STDC) */ -} - -/* =========================================================================== - * Genererate the file trees.h describing the static trees. - */ -#ifdef GEN_TREES_H -# ifndef DEBUG -# include -# endif - -# define SEPARATOR(i, last, width) \ - ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) - -void gen_trees_header() -{ - FILE *header = fopen("trees.h", "w"); - int i; - - Assert (header != NULL, "Can't open trees.h"); - fprintf(header, - "/* header created automatically with -DGEN_TREES_H */\n\n"); - - fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); - for (i = 0; i < L_CODES+2; i++) { - fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, - static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); - } - - fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, - static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); - } - - fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); - for (i = 0; i < DIST_CODE_LEN; i++) { - fprintf(header, "%2u%s", _dist_code[i], - SEPARATOR(i, DIST_CODE_LEN-1, 20)); - } - - fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); - for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - fprintf(header, "%2u%s", _length_code[i], - SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); - } - - fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); - for (i = 0; i < LENGTH_CODES; i++) { - fprintf(header, "%1u%s", base_length[i], - SEPARATOR(i, LENGTH_CODES-1, 20)); - } - - fprintf(header, "local const int base_dist[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "%5u%s", base_dist[i], - SEPARATOR(i, D_CODES-1, 10)); - } - - fclose(header); -} -#endif /* GEN_TREES_H */ - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -void _tr_init(s) - deflate_state *s; -{ - tr_static_init(); - - s->l_desc.dyn_tree = s->dyn_ltree; - s->l_desc.stat_desc = &static_l_desc; - - s->d_desc.dyn_tree = s->dyn_dtree; - s->d_desc.stat_desc = &static_d_desc; - - s->bl_desc.dyn_tree = s->bl_tree; - s->bl_desc.stat_desc = &static_bl_desc; - - s->bi_buf = 0; - s->bi_valid = 0; - s->last_eob_len = 8; /* enough lookahead for inflate */ -#ifdef DEBUG - s->compressed_len = 0L; - s->bits_sent = 0L; -#endif - - /* Initialize the first block of the first file: */ - init_block(s); -} - -/* =========================================================================== - * Initialize a new block. - */ -local void init_block(s) - deflate_state *s; -{ - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; -} - -#define SMALLEST 1 -/* Index within the heap array of least frequent node in the Huffman tree */ - - -/* =========================================================================== - * Remove the smallest element from the heap and recreate the heap with - * one less element. Updates heap and heap_len. - */ -#define pqremove(s, tree, top) \ -{\ - top = s->heap[SMALLEST]; \ - s->heap[SMALLEST] = s->heap[s->heap_len--]; \ - pqdownheap(s, tree, SMALLEST); \ -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -#define smaller(tree, n, m, depth) \ - (tree[n].Freq < tree[m].Freq || \ - (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -local void pqdownheap(s, tree, k) - deflate_state *s; - ct_data *tree; /* the tree to restore */ - int k; /* node to move down */ -{ - int v = s->heap[k]; - int j = k << 1; /* left son of k */ - while (j <= s->heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s->heap[j], s->depth)) break; - - /* Exchange v with the smallest son */ - s->heap[k] = s->heap[j]; k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s->heap[k] = v; -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -local void gen_bitlen(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ - ct_data *tree = desc->dyn_tree; - int max_code = desc->max_code; - const ct_data *stree = desc->stat_desc->static_tree; - const intf *extra = desc->stat_desc->extra_bits; - int base = desc->stat_desc->extra_base; - int max_length = desc->stat_desc->max_length; - int h; /* heap index */ - int n, m; /* iterate over the tree elements */ - int bits; /* bit length */ - int xbits; /* extra bits */ - ush f; /* frequency */ - int overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { - n = s->heap[h]; - bits = tree[tree[n].Dad].Len + 1; - if (bits > max_length) bits = max_length, overflow++; - tree[n].Len = (ush)bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) continue; /* not a leaf node */ - - s->bl_count[bits]++; - xbits = 0; - if (n >= base) xbits = extra[n-base]; - f = tree[n].Freq; - s->opt_len += (ulg)f * (bits + xbits); - if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); - } - if (overflow == 0) return; - - Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length-1; - while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ - s->bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits != 0; bits--) { - n = s->bl_count[bits]; - while (n != 0) { - m = s->heap[--h]; - if (m > max_code) continue; - if (tree[m].Len != (unsigned) bits) { - Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((long)bits - (long)tree[m].Len) - *(long)tree[m].Freq; - tree[m].Len = (ush)bits; - } - n--; - } - } -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -local void gen_codes (tree, max_code, bl_count) - ct_data *tree; /* the tree to decorate */ - int max_code; /* largest code with non zero frequency */ - ushf *bl_count; /* number of codes at each bit length */ -{ - ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - ush code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits-1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; - const ct_data *stree = desc->stat_desc->static_tree; - int elems = desc->stat_desc->elems; - int n, m; /* iterate over heap elements */ - int max_code = -1; /* largest code with non zero frequency */ - int node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s->heap_len = 0, s->heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n].Freq != 0) { - s->heap[++(s->heap_len)] = max_code = n; - s->depth[n] = 0; - } else { - tree[n].Len = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s->heap_len < 2) { - node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); - tree[node].Freq = 1; - s->depth[node] = 0; - s->opt_len--; if (stree) s->static_len -= stree[node].Len; - /* node is 0 or 1 so it does not have extra bits */ - } - desc->max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - pqremove(s, tree, n); /* n = node of least frequency */ - m = s->heap[SMALLEST]; /* m = node of next least frequency */ - - s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ - s->heap[--(s->heap_max)] = m; - - /* Create a new node father of n and m */ - tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? - s->depth[n] : s->depth[m]) + 1); - tree[n].Dad = tree[m].Dad = (ush)node; -#ifdef DUMP_BL_TREE - if (tree == s->bl_tree) { - fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", - node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); - } -#endif - /* and insert the new node in the heap */ - s->heap[SMALLEST] = node++; - pqdownheap(s, tree, SMALLEST); - - } while (s->heap_len >= 2); - - s->heap[--(s->heap_max)] = s->heap[SMALLEST]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, (tree_desc *)desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes ((ct_data *)tree, max_code, s->bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -local void scan_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - s->bl_tree[curlen].Freq += count; - } else if (curlen != 0) { - if (curlen != prevlen) s->bl_tree[curlen].Freq++; - s->bl_tree[REP_3_6].Freq++; - } else if (count <= 10) { - s->bl_tree[REPZ_3_10].Freq++; - } else { - s->bl_tree[REPZ_11_138].Freq++; - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -local void send_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen == 0) max_count = 138, min_count = 3; - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { send_code(s, curlen, s->bl_tree); } while (--count != 0); - - } else if (curlen != 0) { - if (curlen != prevlen) { - send_code(s, curlen, s->bl_tree); count--; - } - Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); - - } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -local int build_bl_tree(s) - deflate_state *s; -{ - int max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); - scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { - if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; - } - /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*(max_blindex+1) + 5+5+4; - Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -local void send_all_trees(s, lcodes, dcodes, blcodes) - deflate_state *s; - int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - int rank; /* index in bl_order */ - - Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - "too many codes"); - Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); - } - Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - -/* =========================================================================== - * Send a stored block - */ -void _tr_stored_block(s, buf, stored_len, eof) - deflate_state *s; - charf *buf; /* input block */ - ulg stored_len; /* length of input block */ - int eof; /* true if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ -#ifdef DEBUG - s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; - s->compressed_len += (stored_len + 4) << 3; -#endif - copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - * The current inflate code requires 9 bits of lookahead. If the - * last two codes for the previous block (real code plus EOB) were coded - * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode - * the last real code. In this case we send two empty static blocks instead - * of one. (There are no problems if the previous block is stored or fixed.) - * To simplify the code, we assume the worst case of last real code encoded - * on one bit only. - */ -void _tr_align(s) - deflate_state *s; -{ - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ -#endif - bi_flush(s); - /* Of the 10 bits for the empty block, we have already sent - * (10 - bi_valid) bits. The lookahead for the last real code (before - * the EOB of the previous block) was thus at least one plus the length - * of the EOB plus what we have just sent of the empty static block. - */ - if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; -#endif - bi_flush(s); - } - s->last_eob_len = 7; -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -void _tr_flush_block(s, buf, stored_len, eof) - deflate_state *s; - charf *buf; /* input block, or NULL if too old */ - ulg stored_len; /* length of input block */ - int eof; /* true if this is the last block for a file */ -{ - ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - int max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s->level > 0) { - - /* Check if the file is ascii or binary */ - if (s->data_type == Z_UNKNOWN) set_data_type(s); - - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; - - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); - - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; - - } else { - Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - -#ifdef FORCE_STORED - if (buf != (char*)0) { /* force stored block */ -#else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { - /* 4: two words for the lengths */ -#endif - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, eof); - -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+eof, 3); - compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->static_len; -#endif - } else { - send_bits(s, (DYN_TREES<<1)+eof, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); - compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->opt_len; -#endif - } - Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (eof) { - bi_windup(s); -#ifdef DEBUG - s->compressed_len += 7; /* align on byte boundary */ -#endif - } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*eof)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -int _tr_tally (s, dist, lc) - deflate_state *s; - unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; - if (dist == 0) { - /* lc is the unmatched char */ - s->dyn_ltree[lc].Freq++; - } else { - s->matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - Assert((ush)dist < (ush)MAX_DIST(s) && - (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -local void compress_block(s, ltree, dtree) - deflate_state *s; - ct_data *ltree; /* literal tree */ - ct_data *dtree; /* distance tree */ -{ - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ - unsigned code; /* the code to send */ - int extra; /* number of extra bits to send */ - - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; - if (dist == 0) { - send_code(s, lc, ltree); /* send a literal byte */ - Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra != 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); - - } while (lx < s->last_lit); - - send_code(s, END_BLOCK, ltree); - s->last_eob_len = ltree[END_BLOCK].Len; -} - -/* =========================================================================== - * Set the data type to ASCII or BINARY, using a crude approximation: - * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise. - * IN assertion: the fields freq of dyn_ltree are set and the total of all - * frequencies does not exceed 64K (to fit in an int on 16 bit machines). - */ -local void set_data_type(s) - deflate_state *s; -{ - int n = 0; - unsigned ascii_freq = 0; - unsigned bin_freq = 0; - while (n < 7) bin_freq += s->dyn_ltree[n++].Freq; - while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq; - while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq; - s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII); -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -local unsigned bi_reverse(code, len) - unsigned code; /* the value to invert */ - int len; /* its bit length */ -{ - register unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -local void bi_flush(s) - deflate_state *s; -{ - if (s->bi_valid == 16) { - put_short(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else if (s->bi_valid >= 8) { - put_byte(s, (Byte)s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -local void bi_windup(s) - deflate_state *s; -{ - if (s->bi_valid > 8) { - put_short(s, s->bi_buf); - } else if (s->bi_valid > 0) { - put_byte(s, (Byte)s->bi_buf); - } - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; -#endif -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -local void copy_block(s, buf, len, header) - deflate_state *s; - charf *buf; /* the input data */ - unsigned len; /* its length */ - int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - s->last_eob_len = 8; /* enough lookahead for inflate */ - - if (header) { - put_short(s, (ush)len); - put_short(s, (ush)~len); -#ifdef DEBUG - s->bits_sent += 2*16; -#endif - } -#ifdef DEBUG - s->bits_sent += (ulg)len<<3; -#endif - while (len--) { - put_byte(s, *buf++); - } -} diff --git a/klibc/klibc/zlib/trees.h b/klibc/klibc/zlib/trees.h deleted file mode 100644 index 72facf900f..0000000000 --- a/klibc/klibc/zlib/trees.h +++ /dev/null @@ -1,128 +0,0 @@ -/* header created automatically with -DGEN_TREES_H */ - -local const ct_data static_ltree[L_CODES+2] = { -{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, -{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, -{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, -{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, -{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, -{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, -{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, -{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, -{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, -{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, -{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, -{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, -{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, -{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, -{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, -{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, -{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, -{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, -{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, -{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, -{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, -{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, -{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, -{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, -{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, -{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, -{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, -{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, -{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, -{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, -{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, -{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, -{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, -{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, -{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, -{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, -{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, -{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, -{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, -{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, -{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, -{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, -{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, -{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, -{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, -{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, -{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, -{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, -{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, -{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, -{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, -{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, -{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, -{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, -{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, -{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, -{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, -{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} -}; - -local const ct_data static_dtree[D_CODES] = { -{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, -{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, -{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, -{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, -{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, -{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} -}; - -const uch _dist_code[DIST_CODE_LEN] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, -10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 -}; - -const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 -}; - -local const int base_length[LENGTH_CODES] = { -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, -64, 80, 96, 112, 128, 160, 192, 224, 0 -}; - -local const int base_dist[D_CODES] = { - 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, - 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, - 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 -}; - diff --git a/klibc/klibc/zlib/uncompr.c b/klibc/klibc/zlib/uncompr.c deleted file mode 100644 index debee4385e..0000000000 --- a/klibc/klibc/zlib/uncompr.c +++ /dev/null @@ -1,61 +0,0 @@ -/* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id: uncompr.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -*/ -int ZEXPORT uncompress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - z_stream stream; - int err; - - stream.next_in = (Bytef*)source; - stream.avail_in = (uInt)sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) - return Z_DATA_ERROR; - return err; - } - *destLen = stream.total_out; - - err = inflateEnd(&stream); - return err; -} diff --git a/klibc/klibc/zlib/zconf.h b/klibc/klibc/zlib/zconf.h deleted file mode 100644 index 9b74ce7bd4..0000000000 --- a/klibc/klibc/zlib/zconf.h +++ /dev/null @@ -1,323 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id: zconf.h,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflatePrime z_deflatePrime -# define deflateParams z_deflateParams -# define deflateBound z_deflateBound -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateCopy z_inflateCopy -# define inflateReset z_inflateReset -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table - -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -# define WIN32 -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(__OS400__) -#define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -# ifdef FAR -# undef FAR -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(deflateBound,"DEBND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(compressBound,"CMBND") -# pragma map(inflate_table,"INTABL") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/klibc/klibc/zlib/zconf.in.h b/klibc/klibc/zlib/zconf.in.h deleted file mode 100644 index d96c85955c..0000000000 --- a/klibc/klibc/zlib/zconf.in.h +++ /dev/null @@ -1,323 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id: zconf.in.h,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - */ -#ifdef Z_PREFIX -# define deflateInit_ z_deflateInit_ -# define deflate z_deflate -# define deflateEnd z_deflateEnd -# define inflateInit_ z_inflateInit_ -# define inflate z_inflate -# define inflateEnd z_inflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateSetDictionary z_deflateSetDictionary -# define deflateCopy z_deflateCopy -# define deflateReset z_deflateReset -# define deflatePrime z_deflatePrime -# define deflateParams z_deflateParams -# define deflateBound z_deflateBound -# define inflateInit2_ z_inflateInit2_ -# define inflateSetDictionary z_inflateSetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateCopy z_inflateCopy -# define inflateReset z_inflateReset -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# define uncompress z_uncompress -# define adler32 z_adler32 -# define crc32 z_crc32 -# define get_crc_table z_get_crc_table - -# define Byte z_Byte -# define uInt z_uInt -# define uLong z_uLong -# define Bytef z_Bytef -# define charf z_charf -# define intf z_intf -# define uIntf z_uIntf -# define uLongf z_uLongf -# define voidpf z_voidpf -# define voidp z_voidp -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) -# define WIN32 -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */ -# include /* for off_t */ -# include /* for SEEK_* and off_t */ -# ifdef VMS -# include /* for off_t */ -# endif -# define z_off_t off_t -#endif -#ifndef SEEK_SET -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif -#ifndef z_off_t -# define z_off_t long -#endif - -#if defined(__OS400__) -#define NO_vsnprintf -#endif - -#if defined(__MVS__) -# define NO_vsnprintf -# ifdef FAR -# undef FAR -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) -# pragma map(deflateInit_,"DEIN") -# pragma map(deflateInit2_,"DEIN2") -# pragma map(deflateEnd,"DEEND") -# pragma map(deflateBound,"DEBND") -# pragma map(inflateInit_,"ININ") -# pragma map(inflateInit2_,"ININ2") -# pragma map(inflateEnd,"INEND") -# pragma map(inflateSync,"INSY") -# pragma map(inflateSetDictionary,"INSEDI") -# pragma map(compressBound,"CMBND") -# pragma map(inflate_table,"INTABL") -# pragma map(inflate_fast,"INFA") -# pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/klibc/klibc/zlib/zlib.3 b/klibc/klibc/zlib/zlib.3 deleted file mode 100644 index 890098449d..0000000000 --- a/klibc/klibc/zlib/zlib.3 +++ /dev/null @@ -1,159 +0,0 @@ -.TH ZLIB 3 "17 November 2003" -.SH NAME -zlib \- compression/decompression library -.SH SYNOPSIS -[see -.I zlib.h -for full description] -.SH DESCRIPTION -The -.I zlib -library is a general purpose data compression library. -The code is thread safe. -It provides in-memory compression and decompression functions, -including integrity checks of the uncompressed data. -This version of the library supports only one compression method (deflation) -but other algorithms will be added later -and will have the same stream interface. -.LP -Compression can be done in a single step if the buffers are large enough -(for example if an input file is mmap'ed), -or can be done by repeated calls of the compression function. -In the latter case, -the application must provide more input and/or consume the output -(providing more output space) before each call. -.LP -The library also supports reading and writing files in -.IR gzip (1) -(.gz) format -with an interface similar to that of stdio. -.LP -The library does not install any signal handler. -The decoder checks the consistency of the compressed data, -so the library should never crash even in case of corrupted input. -.LP -All functions of the compression library are documented in the file -.IR zlib.h . -The distribution source includes examples of use of the library -in the files -.I example.c -and -.IR minigzip.c . -.LP -Changes to this version are documented in the file -.I ChangeLog -that accompanies the source, -and are concerned primarily with bug fixes and portability enhancements. -.LP -A Java implementation of -.I zlib -is available in the Java Development Kit 1.1: -.IP -http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html -.LP -A Perl interface to -.IR zlib , -written by Paul Marquess (pmqs@cpan.org), -is available at CPAN (Comprehensive Perl Archive Network) sites, -including: -.IP -http://www.cpan.org/modules/by-module/Compress/ -.LP -A Python interface to -.IR zlib , -written by A.M. Kuchling (amk@magnet.com), -is available in Python 1.5 and later versions: -.IP -http://www.python.org/doc/lib/module-zlib.html -.LP -A -.I zlib -binding for -.IR tcl (1), -written by Andreas Kupries (a.kupries@westend.com), -is availlable at: -.IP -http://www.westend.com/~kupries/doc/trf/man/man.html -.LP -An experimental package to read and write files in .zip format, -written on top of -.I zlib -by Gilles Vollant (info@winimage.com), -is available at: -.IP -http://www.winimage.com/zLibDll/unzip.html -and also in the -.I contrib/minizip -directory of the main -.I zlib -web site. -.SH "SEE ALSO" -The -.I zlib -web site can be found at either of these locations: -.IP -http://www.zlib.org -.br -http://www.gzip.org/zlib/ -.LP -The data format used by the zlib library is described by RFC -(Request for Comments) 1950 to 1952 in the files: -.IP -http://www.ietf.org/rfc/rfc1950.txt (concerning zlib format) -.br -http://www.ietf.org/rfc/rfc1951.txt (concerning deflate format) -.br -http://www.ietf.org/rfc/rfc1952.txt (concerning gzip format) -.LP -These documents are also available in other formats from: -.IP -ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html -.LP -Mark Nelson (markn@ieee.org) wrote an article about -.I zlib -for the Jan. 1997 issue of Dr. Dobb's Journal; -a copy of the article is available at: -.IP -http://dogma.net/markn/articles/zlibtool/zlibtool.htm -.SH "REPORTING PROBLEMS" -Before reporting a problem, -please check the -.I zlib -web site to verify that you have the latest version of -.IR zlib ; -otherwise, -obtain the latest version and see if the problem still exists. -Please read the -.I zlib -FAQ at: -.IP -http://www.gzip.org/zlib/zlib_faq.html -.LP -before asking for help. -Send questions and/or comments to zlib@gzip.org, -or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). -.SH AUTHORS -Version 1.2.1 -Copyright (C) 1995-2003 Jean-loup Gailly (jloup@gzip.org) -and Mark Adler (madler@alumni.caltech.edu). -.LP -This software is provided "as-is," -without any express or implied warranty. -In no event will the authors be held liable for any damages -arising from the use of this software. -See the distribution directory with respect to requirements -governing redistribution. -The deflate format used by -.I zlib -was defined by Phil Katz. -The deflate and -.I zlib -specifications were written by L. Peter Deutsch. -Thanks to all the people who reported problems and suggested various -improvements in -.IR zlib ; -who are too numerous to cite here. -.LP -UNIX manual page by R. P. C. Rodgers, -U.S. National Library of Medicine (rodgers@nlm.nih.gov). -.\" end of man page diff --git a/klibc/klibc/zlib/zlib.h b/klibc/klibc/zlib/zlib.h deleted file mode 100644 index 92edf96ff3..0000000000 --- a/klibc/klibc/zlib/zlib.h +++ /dev/null @@ -1,1200 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.1, November 17th, 2003 - - Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt - (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.1" -#define ZLIB_VERNUM 0x1210 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. - - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by the in-memory functions is the zlib - format, which is a zlib wrapper documented in RFC 1950, wrapped around a - deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - This library does not provide any functions to write gzip files in memory. - However such functions could be easily written using zlib's deflate function, - the documentation in the gzip RFC, and the examples in gzio.c. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total nb of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total nb of bytes output so far */ - - char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: ascii or binary */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative - * values are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_ASCII 1 -#define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - the compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - the value returned by deflateBound (see below). If deflate does not return - Z_STREAM_END, then it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update data_type if it can make a good guess about - the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there - is no more input data or no more space in the output buffer (see below - about the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, - Z_FINISH, or Z_BLOCK. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() stop - if and when it get to the next deflate block boundary. When decoding the zlib - or gzip format, this will cause inflate() to return immediately after the - header and before the first block. When doing a raw inflate, inflate() will - go ahead and process the first block, and will return when it gets to the end - of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 - if inflate() is currently decoding the last block in the deflate stream, - plus 128 if inflate() returned immediately after decoding an end-of-block - code or decoding the complete header up to just before the first byte of the - deflate stream. The end-of-block will not be indicated until all of the - uncompressed data from that block has been written to strm->next_out. The - number of unused bits may in general be greater than seven, except when - bit 7 of data_type is set, in which case the number of unused bits will be - less than eight. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster approach - may be used for the single inflate() call. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the only effect of the flush parameter in this implementation - is on the return value of inflate(), as noted below, or when it returns early - because Z_BLOCK is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm-adler to the adler32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the adler32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() will decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically. Any information - contained in the gzip header is not retained, so applications that need that - information should instead use raw inflate, see inflateInit2() below, or - inflateBack() and perform their own processing of the gzip header and - trailer. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may then - call inflateSync() to look for a good compression block if a partial recovery - of the data is desired. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), - no header crc, and the operating system will be set to 255 (unknown). - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as fast as - Z_HUFFMAN_ONLY, but give better compression for PNG image data. The strategy - parameter only affects the compression ratio but not the correctness of the - compressed output even if it is not set appropriately. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front. - - Upon return of this function, strm->adler is set to the adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero. -*/ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() - or deflateInit2(). This would be used to allocate an output buffer - for deflation in a single pass, and so would be called before deflate(). -*/ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the - bits leftover from a previous deflate stream when appending to it. As such, - this function can only be used for raw deflate, and must be used before the - first deflate() call after a deflateInit2() or deflateReset(). bits must be - less than or equal to 16, and that many of the least significant bits of - value will be inserted in the output. - - deflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to null if there is no error message. inflateInit2 - does not perform any decompression apart from reading the zlib header if - present: this will be done by inflate(). (So next_in and avail_in may be - modified, but next_out and avail_out are unchanged.) -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate - if this call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by this call of - inflate. The compressor and decompressor must use exactly the same - dictionary (see deflateSetDictionary). - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_stream FAR *strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the paramaters are invalid, Z_MEM_ERROR if the internal state could not - be allocated, or Z_VERSION_ERROR if the version of the library does not - match the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_stream FAR *strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is more efficient than inflate() for - file i/o applications in that it avoids copying between the output and the - sliding window by simply making the window itself the output buffer. This - function trusts the application to not change the output buffer passed by - the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free - the allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects - only the raw deflate stream to decompress. This is different from the - normal behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format - error in the deflate stream (in which case strm->msg is set to indicate the - nature of the error), or Z_STREAM_ERROR if the stream was not properly - initialized. In the case of Z_BUF_ERROR, an input or output error can be - distinguished using strm->next_in which will be Z_NULL only if in() returned - an error. If strm->next is not Z_NULL, then the Z_BUF_ERROR was due to - out() returning non-zero. (in() will always be called before out(), so - strm->next_in is assured to be defined if out() returns non-zero.) Note - that inflateBack() cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_stream FAR *strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - - - /* utility functions */ - -/* - The following utility functions are implemented on top of the - basic stream-oriented functions. To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least the value returned - by compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - This function can be used to compress a whole file at once if the - input file is mmap'ed. - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before - a compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - This function can be used to decompress a whole file at once if the - input file is mmap'ed. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. -*/ - - -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); -/* - Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h", or 'R' for run-length encoding - as in "wb1R". (See the description of deflateInit2 for more information - about the strategy parameter.) - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. - - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). */ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. - The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). - gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. - gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). */ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -*/ - -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). The number of - uncompressed bytes written is limited to 4095. The caller should assure that - this limit is not exceeded. If it is exceeded, then gzprintf() will return - return an error (0) with nothing written. In this case, there may also be a - buffer overflow with unpredictable consequences, which is possible only if - zlib was compiled with the insecure functions sprintf() or vsprintf() - because the secure snprintf() or vsnprintf() functions were not available. -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. - gzgets returns buf, or Z_NULL in case of error. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read again later. - Only one character of push-back is allowed. gzungetc() returns the - character pushed, or -1 on failure. gzungetc() will fail if a - character has been pushed but not read yet, or if c is -1. The pushed - character will be discarded if the stream is repositioned with gzseek() - or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. - gzflush should be called only when strictly necessary because it can - degrade compression. -*/ - -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); -/* - Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); -/* - Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); - -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is NULL, this function returns the required initial value - for the crc. Pre- and post-conditioning (one's complement) is performed - within this function so it shouldn't be done by the application. - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_stream FAR *strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, sizeof(z_stream)) - - -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; /* hack for buggy compilers */ -#endif - -ZEXTERN const char * ZEXPORT zError OF((int err)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/klibc/klibc/zlib/zutil.c b/klibc/klibc/zlib/zutil.c deleted file mode 100644 index 253a1cc7e1..0000000000 --- a/klibc/klibc/zlib/zutil.c +++ /dev/null @@ -1,319 +0,0 @@ -/* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id: zutil.c,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#include "zutil.h" - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -#ifndef STDC -extern void exit OF((int)); -#endif - -const char * const z_errmsg[10] = { -"need dictionary", /* Z_NEED_DICT 2 */ -"stream end", /* Z_STREAM_END 1 */ -"", /* Z_OK 0 */ -"file error", /* Z_ERRNO (-1) */ -"stream error", /* Z_STREAM_ERROR (-2) */ -"data error", /* Z_DATA_ERROR (-3) */ -"insufficient memory", /* Z_MEM_ERROR (-4) */ -"buffer error", /* Z_BUF_ERROR (-5) */ -"incompatible version",/* Z_VERSION_ERROR (-6) */ -""}; - - -const char * ZEXPORT zlibVersion() -{ - return ZLIB_VERSION; -} - -uLong ZEXPORT zlibCompileFlags() -{ - uLong flags; - - flags = 0; - switch (sizeof(uInt)) { - case 2: break; - case 4: flags += 1; break; - case 8: flags += 2; break; - default: flags += 3; - } - switch (sizeof(uLong)) { - case 2: break; - case 4: flags += 1 << 2; break; - case 8: flags += 2 << 2; break; - default: flags += 3 << 2; - } - switch (sizeof(voidpf)) { - case 2: break; - case 4: flags += 1 << 4; break; - case 8: flags += 2 << 4; break; - default: flags += 3 << 4; - } - switch (sizeof(z_off_t)) { - case 2: break; - case 4: flags += 1 << 6; break; - case 8: flags += 2 << 6; break; - default: flags += 3 << 6; - } -#ifdef DEBUG - flags += 1 << 8; -#endif -#if defined(ASMV) || defined(ASMINF) - flags += 1 << 9; -#endif -#ifdef ZLIB_WINAPI - flags += 1 << 10; -#endif -#ifdef BUILDFIXED - flags += 1 << 12; -#endif -#ifdef DYNAMIC_CRC_TABLE - flags += 1 << 13; -#endif -#ifdef NO_GZCOMPRESS - flags += 1 << 16; -#endif -#ifdef NO_GZIP - flags += 1 << 17; -#endif -#ifdef PKZIP_BUG_WORKAROUND - flags += 1 << 20; -#endif -#ifdef FASTEST - flags += 1 << 21; -#endif -#ifdef STDC -# ifdef NO_vsnprintf - flags += 1 << 25; -# ifdef HAS_vsprintf_void - flags += 1 << 26; -# endif -# else -# ifdef HAS_vsnprintf_void - flags += 1 << 26; -# endif -# endif -#else - flags += 1 << 24; -# ifdef NO_snprintf - flags += 1 << 25; -# ifdef HAS_sprintf_void - flags += 1 << 26; -# endif -# else -# ifdef HAS_snprintf_void - flags += 1 << 26; -# endif -# endif -#endif - return flags; -} - -#ifdef DEBUG - -# ifndef verbose -# define verbose 0 -# endif -int z_verbose = verbose; - -void z_error (m) - char *m; -{ - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * ZEXPORT zError(err) - int err; -{ - return ERR_MSG(err); -} - -#if defined(_WIN32_WCE) - /* does not exist on WCE */ - int errno = 0; -#endif - -#ifndef HAVE_MEMCPY - -void zmemcpy(dest, source, len) - Bytef* dest; - const Bytef* source; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = *source++; /* ??? to be unrolled */ - } while (--len != 0); -} - -int zmemcmp(s1, s2, len) - const Bytef* s1; - const Bytef* s2; - uInt len; -{ - uInt j; - - for (j = 0; j < len; j++) { - if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; - } - return 0; -} - -void zmemzero(dest, len) - Bytef* dest; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = 0; /* ??? to be unrolled */ - } while (--len != 0); -} -#endif - - -#ifdef SYS16BIT - -#ifdef __TURBOC__ -/* Turbo C in 16-bit mode */ - -# define MY_ZCALLOC - -/* Turbo C malloc() does not allow dynamic allocation of 64K bytes - * and farmalloc(64K) returns a pointer with an offset of 8, so we - * must fix the pointer. Warning: the pointer must be put back to its - * original form in order to free it, use zcfree(). - */ - -#define MAX_PTR 10 -/* 10*64K = 640K */ - -local int next_ptr = 0; - -typedef struct ptr_table_s { - voidpf org_ptr; - voidpf new_ptr; -} ptr_table; - -local ptr_table table[MAX_PTR]; -/* This table is used to remember the original form of pointers - * to large buffers (64K). Such pointers are normalized with a zero offset. - * Since MSDOS is not a preemptive multitasking OS, this table is not - * protected from concurrent access. This hack doesn't work anyway on - * a protected system like OS/2. Use Microsoft C instead. - */ - -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - voidpf buf = opaque; /* just to make some compilers happy */ - ulg bsize = (ulg)items*size; - - /* If we allocate less than 65520 bytes, we assume that farmalloc - * will return a usable pointer which doesn't have to be normalized. - */ - if (bsize < 65520L) { - buf = farmalloc(bsize); - if (*(ush*)&buf != 0) return buf; - } else { - buf = farmalloc(bsize + 16L); - } - if (buf == NULL || next_ptr >= MAX_PTR) return NULL; - table[next_ptr].org_ptr = buf; - - /* Normalize the pointer to seg:0 */ - *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; - *(ush*)&buf = 0; - table[next_ptr++].new_ptr = buf; - return buf; -} - -void zcfree (voidpf opaque, voidpf ptr) -{ - int n; - if (*(ush*)&ptr != 0) { /* object < 64K */ - farfree(ptr); - return; - } - /* Find the original pointer */ - for (n = 0; n < next_ptr; n++) { - if (ptr != table[n].new_ptr) continue; - - farfree(table[n].org_ptr); - while (++n < next_ptr) { - table[n-1] = table[n]; - } - next_ptr--; - return; - } - ptr = opaque; /* just to make some compilers happy */ - Assert(0, "zcfree: ptr not found"); -} - -#endif /* __TURBOC__ */ - - -#ifdef M_I86 -/* Microsoft C in 16-bit mode */ - -# define MY_ZCALLOC - -#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) -# define _halloc halloc -# define _hfree hfree -#endif - -voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - return _halloc((long)items, size); -} - -void zcfree (voidpf opaque, voidpf ptr) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - _hfree(ptr); -} - -#endif /* M_I86 */ - -#endif /* SYS16BIT */ - - -#ifndef MY_ZCALLOC /* Any system without a special alloc function */ - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern voidp calloc OF((uInt items, uInt size)); -extern void free OF((voidpf ptr)); -#endif - -voidpf zcalloc (opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ - if (opaque) items += size - size; /* make compiler happy */ - return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : - (voidpf)calloc(items, size); -} - -void zcfree (opaque, ptr) - voidpf opaque; - voidpf ptr; -{ - free(ptr); - if (opaque) return; /* make compiler happy */ -} - -#endif /* MY_ZCALLOC */ diff --git a/klibc/klibc/zlib/zutil.h b/klibc/klibc/zlib/zutil.h deleted file mode 100644 index 129452806b..0000000000 --- a/klibc/klibc/zlib/zutil.h +++ /dev/null @@ -1,258 +0,0 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id: zutil.h,v 1.1 2005/02/27 23:15:39 hpa Exp $ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#define ZLIB_INTERNAL -#include "zlib.h" - -#ifdef STDC -# include -# include -# include -#endif -#ifdef NO_ERRNO_H - extern int errno; -#else -# include -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = (char*)ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 -#endif - -#ifdef OS2 -# define OS_CODE 0x06 -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -#endif - -#ifdef TOPS20 -# define OS_CODE 0x0a -#endif - -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b -# endif -#endif - -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0f -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS - /* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 - /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# define vsnprintf _vsnprintf -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -#endif - -#ifdef HAVE_STRERROR - extern char *strerror OF((int)); -# define zstrerror(errnum) strerror(errnum) -#else -# define zstrerror(errnum) "" -#endif - -#if defined(pyr) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - extern void zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef DEBUG -# include - extern int z_verbose; - extern void z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - - -voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); -void zcfree OF((voidpf opaque, voidpf ptr)); - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -#endif /* ZUTIL_H */ diff --git a/klibc/makeklcc.pl b/klibc/makeklcc.pl deleted file mode 100755 index 74045955fd..0000000000 --- a/klibc/makeklcc.pl +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/perl -# -# Combine klibc.config, klcc.in to produce a klcc script -# -# Usage: makeklcc klcc.in klibc.config perlpath -# - -use File::Spec; - -($klccin, $klibcconf, $perlpath) = @ARGV; - -sub pathsearch($) { - my($file) = @_; - my(@path); - my($p,$pp); - - if ( $file =~ /\// ) { - return File::Spec->rel2abs($file); - } - - foreach $p ( split(/\:/, $ENV{'PATH'}) ) { - $pp = File::Spec->rel2abs(File::Spec->catpath(undef, $p, $file)); - return $pp if ( -x $pp ); - } - - return undef; -} - -print "#!${perlpath}\n"; - -open(KLIBCCONF, '<', $klibcconf) or die "$0: cannot open $klibcconf: $!\n"; -while ( defined($l = ) ) { - chomp $l; - if ( $l =~ /^([^=]+)\=(.*)$/ ) { - $n = $1; $s = $2; - - if ( $n eq 'CC' || $n eq 'LD' || $n eq 'STRIP' ) { - $s1 = pathsearch($s); - die "$0: Cannot find $n: $s\n" unless ( defined($s1) ); - $s = $s1; - } - - print "\$$n = \"\Q$s\E\";\n"; - print "\@$n = qw($s);\n"; - print "\$conf{\'\L$n\E\'} = \\\$$n;\n"; - } -} -close(KLIBCCONF); - -open(KLCCIN, '<', $klccin) or die "$0: cannot open $klccin: $!\n"; -while ( defined($l = ) ) { - print $l; -} -close(KLCCIN); - diff --git a/klibc/version b/klibc/version deleted file mode 100644 index 45a1b3f445..0000000000 --- a/klibc/version +++ /dev/null @@ -1 +0,0 @@ -1.1.2 diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index daf0b75269..d1c28749fb 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -12,9 +12,6 @@ EXTRAS="\ extras/run_directory \ extras/firmware" -[ -z "$KERNEL_DIR" ] && KERNEL_DIR=/lib/modules/`uname -r`/build -echo KERNEL_DIR: "$KERNEL_DIR" - # with debug make clean EXTRAS="$EXTRAS" >/dev/null make all -j4 $MAKEOPTS DEBUG=true EXTRAS="$EXTRAS" || exit @@ -25,10 +22,14 @@ make clean EXTRAS="$EXTRAS" >/dev/null make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit echo -e "\n\n" -# klibc and debug -make clean EXTRAS="$EXTRAS" >/dev/null -make all -j4 $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KERNEL_DIR="$KERNEL_DIR" || exit -echo -e "\n\n" +# klibc build +[ -z "$KLCC" ] && KLCC=/usr/bin/klcc +if [ -e "$KLCC" ]; then + echo KLCC: "$KLCC" + make clean EXTRAS="$EXTRAS" >/dev/null + make all -j4 $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KLCC="$KLCC" || exit + echo -e "\n\n" +fi # install in temporary dir and show it TEMPDIR="`pwd`/.tmp" -- cgit v1.2.3-54-g00ecf From fd15e02dbbaa60cf2aff37e1e2a86b244564fe4a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Nov 2005 15:46:25 +0100 Subject: remove outdated HOWTO Signed-off-by: Kay Sievers --- HOWTO-udev_for_dev | 79 ------------------------------------------------------ 1 file changed, 79 deletions(-) delete mode 100644 HOWTO-udev_for_dev diff --git a/HOWTO-udev_for_dev b/HOWTO-udev_for_dev deleted file mode 100644 index 9833dd1411..0000000000 --- a/HOWTO-udev_for_dev +++ /dev/null @@ -1,79 +0,0 @@ -HOWTO use udev to manage /dev - - This document describes one way to get udev working on a Fedora-development - machine to manage /dev. This procedure may be used to get udev to manage - /dev on other distros, if you modify some of the steps. - - This will only work if you use a 2.6 based kernel, preferably the most - recent one. This does not prevent your machine from using a 2.4 - kernel, if you boot into one, udev will not run and your old /dev will - be present with no changes needed. - - -NOTE NOTE NOTE NOTE NOTE NOTE NOTE - This is completely unsupported. Attempting to do this may cause your - machine to be unable to boot properly. USE AT YOUR OWN RISK. Always - have a rescue disk or CD handy to allow you to fix up any errors that - may occur. -NOTE NOTE NOTE NOTE NOTE NOTE NOTE - - - - Build and install udev as specified in the README that comes with - udev. I recommend using the following build options to get the - smallest possible binaries: - make USE_KLIBC=true USE_LOG=false DEBUG=false - - - disable udev from the boot process by running: - chkconfig udev off - or - chkconfig --del udev - as root. - - - place the start_udev script somewhere that is accessible by your - initscripts. I placed it into /etc/rc.d with the following command: - copy extras/start_udev /etc/rc.d/ - - - modify the rc.sysinit script to call the start_udev script as one of - the first things that it does, but after /proc and /sys are mounted. - I did this with the latest Fedora startup scripts with the patch at - the end of this file. - - - make sure the /etc/udev/udev.conf file lists the udev_root as "/dev/" - and the udev_db as "/dev/.udevdb". It should contain the - following lines in order to work properly. - udev_root="/dev/" - udev_db="/dev/.udevdb" - - - reboot into a 2.6 kernel and watch udev create all of the initial - device nodes in /dev - - -If anyone has any problems with this, please let me, and the -linux-hotplug-devel@lists.sourceforge.net mailing list know. - -A big thanks go out to the Gentoo developers for showing me that this is -possible to do. - -Greg Kroah-Hartman - - - ----------------------------------- -Patch to modify rc.sysinit to call udev at the beginning of the boot -process: - - ---- /etc/rc.sysinit.orig 2004-02-17 11:45:17.000000000 -0800 -+++ /etc/rc.sysinit 2004-02-17 13:28:33.000000000 -0800 -@@ -32,6 +32,9 @@ - - . /etc/init.d/functions - -+# start udev to populate /dev -+/etc/rc.d/start_udev -+ - if [ "$HOSTTYPE" != "s390" -a "$HOSTTYPE" != "s390x" ]; then - last=0 - for i in `LC_ALL=C grep '^[0-9].*respawn:/sbin/mingetty' /etc/inittab | sed 's/^.* tty\([0-9][0-9]*\).*/\1/g'`; do - - -- cgit v1.2.3-54-g00ecf From e5bdb75a109c446ff0ca2e27268cdd274ee61a9c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Nov 2005 15:47:47 +0100 Subject: update TODO Signed-off-by: Kay Sievers --- TODO | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/TODO b/TODO index 0bf22dd580..41ea98ff02 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -This is a short list of things that needs to be done. They are in no specific +This is a list of things that needs to be done. They are in no specific order. We will gladly accept patches for any of these items: - Completely replace the built-in wait_for_sysfs stuff in udev_sysfs.c @@ -8,5 +8,3 @@ order. We will gladly accept patches for any of these items: to syslog, so any error logged from the kernel can be associated with any of the links at that time. -- remove klibc tree and make it an external dependency - -- cgit v1.2.3-54-g00ecf From 54eb6a122fc6d2d765b9f71f9b47d529c1acf30f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 9 Nov 2005 09:53:32 -0800 Subject: Make run_directory.c stat the place it is going to try to run. This should remove a lot of error messages that people are seeing. Signed-off-by: Greg Kroah-Hartman --- extras/run_directory/run_directory.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extras/run_directory/run_directory.c b/extras/run_directory/run_directory.c index 5107f85aef..69faecc15e 100644 --- a/extras/run_directory/run_directory.c +++ b/extras/run_directory/run_directory.c @@ -53,9 +53,16 @@ static int exec_program(const char *filename, const char *subsystem) int run_directory(const char *dir, const char *suffix, const char *subsystem) { struct name_entry *name_loop, *name_tmp; + struct stat buf; LIST_HEAD(name_list); dbg("looking at '%s'", dir); + + if (stat(dir, &buf) != 0) { + dbg("directory '%s' not found", dir); + return 0; + } + add_matching_files(&name_list, dir, suffix); list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { -- cgit v1.2.3-54-g00ecf From efbd13e83863d834db1eb8b6f6301dede32f54fe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Nov 2005 01:07:51 +0100 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/45-isdn.rules | 50 ++++++++ etc/udev/suse/50-udev.rules | 190 +++++++++++++++++++++++++++++ etc/udev/suse/60-persistent.rules | 46 +++++++ etc/udev/suse/80-pcmcia.rules | 7 ++ etc/udev/suse/80-sysconfig.rules | 20 +++ etc/udev/suse/90-hal.rules | 3 + etc/udev/suse/95-debug.rules | 6 + etc/udev/suse/isdn.rules | 54 --------- etc/udev/suse/pcmcia.rules | 5 - etc/udev/suse/udev.rules | 247 -------------------------------------- 10 files changed, 322 insertions(+), 306 deletions(-) create mode 100644 etc/udev/suse/45-isdn.rules create mode 100644 etc/udev/suse/50-udev.rules create mode 100644 etc/udev/suse/60-persistent.rules create mode 100644 etc/udev/suse/80-pcmcia.rules create mode 100644 etc/udev/suse/80-sysconfig.rules create mode 100644 etc/udev/suse/90-hal.rules create mode 100644 etc/udev/suse/95-debug.rules delete mode 100644 etc/udev/suse/isdn.rules delete mode 100644 etc/udev/suse/pcmcia.rules delete mode 100644 etc/udev/suse/udev.rules diff --git a/etc/udev/suse/45-isdn.rules b/etc/udev/suse/45-isdn.rules new file mode 100644 index 0000000000..ef2912d160 --- /dev/null +++ b/etc/udev/suse/45-isdn.rules @@ -0,0 +1,50 @@ +# CAPI devices +SUBSYSTEM="capi", GROUP="dialout" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# ISDN devices +KERNEL=="isdn*", NAME="%k", MODE="600" +KERNEL=="isdnctrl*", NAME="%k", MODE="600" +KERNEL=="ippp*", NAME="%k", MODE="600" +KERNEL=="isdninfo*", NAME="%k", MODE="444" + +# ISDN USB +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/c00*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/1000*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/1900*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2000*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2200*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2300*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2800*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3000*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3500*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3600*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2805*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2806*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/4401*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/4601*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="483/4810*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="959/2bd0*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" +SUBSYSTEM=="usb", ENV{PRODUCT}=="9bf/*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" + +# ISDN PCMCIA +# AVM B1 models +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb845DC335pc*pd*", RUN+="/lib/udev/isdn.sh b1 1", ENV{SYSCONFIG}="no" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb81E10430pc*pd*", RUN+="/lib/udev/isdn.sh b1 2", ENV{SYSCONFIG}="no" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb18E8558Apc*pd*", RUN+="/lib/udev/isdn.sh b1 3", ENV{SYSCONFIG}="no" +# AVM A1 models (aka Fritz!Card PCMCIA) +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pbADC9D4BBpc*pd*", RUN+="/lib/udev/isdn.sh a1 1", ENV{SYSCONFIG}="no" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa8D9761C8pb01C5AA7Bpc*pd*", RUN+="/lib/udev/isdn.sh a1 2", ENV{SYSCONFIG}="no" +# teles +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa67B50EAEpbE9E70119pc*pd*", RUN+="/lib/udev/isdn.sh teles 1", ENV{SYSCONFIG}="no" +# sedlbauer +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbF3612E1Dpc6B95C78Apd*", RUN+="/lib/udev/isdn.sh sedlbauer 1", ENV{SYSCONFIG}="no" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc397B7E90pd*", RUN+="/lib/udev/isdn.sh sedlbauer 2", ENV{SYSCONFIG}="no" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc2E5C7FCEpd*", RUN+="/lib/udev/isdn.sh sedlbauer 3", ENV{SYSCONFIG}="no" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc8DB143FEpd*", RUN+="/lib/udev/isdn.sh sedlbauer 4", ENV{SYSCONFIG}="no" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pcB391AB4Cpd*", RUN+="/lib/udev/isdn.sh sedlbauer 5", ENV{SYSCONFIG}="no" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*paD79E0B84pb21D083AEpc*pd*", RUN+="/lib/udev/isdn.sh sedlbauer 6", ENV{SYSCONFIG}="no" +# elsa +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa983DE2C4pb333BA257pc*pd*", RUN+="/lib/udev/isdn.sh elsa 1", ENV{SYSCONFIG}="no" +SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa639E5718pb333BA257pc*pd*", RUN+="/lib/udev/isdn.sh elsa 2", ENV{SYSCONFIG}="no" diff --git a/etc/udev/suse/50-udev.rules b/etc/udev/suse/50-udev.rules new file mode 100644 index 0000000000..f24d77d197 --- /dev/null +++ b/etc/udev/suse/50-udev.rules @@ -0,0 +1,190 @@ +# console +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="console", NAME="%k", MODE="600" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666" + +# serial devices +KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" +KERNEL=="pppox*", NAME="%k", GROUP="uucp" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp" +KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" +KERNEL=="hvc*", NAME="%k", GROUP="uucp" +KERNEL=="hvsi*", NAME="%k", GROUP="uucp" +KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" +KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot" + +# video/graphics +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="graphics" GROUP="video" +KERNEL=="vtx*", NAME="%k", GROUP="video" +KERNEL=="vbi*", NAME="%k", GROUP="video" +KERNEL=="winradio*", NAME="%k", GROUP="video" +KERNEL=="vttuner*", NAME="%k", GROUP="video" +KERNEL=="nvidia*", NAME="%k", GROUP="video" +KERNEL=="nvidiactl*", NAME="%k", GROUP="video" +KERNEL=="video0", SYMLINK+="video" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="pmu", GROUP="video" + +# dvb +SUBSYSTEM="dvb", PROGRAM="/bin/sh -c 'X=%k; X=$${X#dvb}; A=$${X%%%%.*}; D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" + +# ALSA/sound +SUBSYSTEM="sound", GROUP="audio" +SUBSYSTEM="snd", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8000/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us428fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8004/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us224fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8006/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us122fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8001/*", RUN+="/sbin/startproc /usr/bin/us428control" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startproc /usr/bin/us428control" +SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" +SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" + +# Kino jogshuttle support +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="b33/10/*", RUN+="/usr/bin/killall --quiet -USR2 kino" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="5f3/240/*", RUN+="/usr/bin/killall --quiet -USR2 kino" + +# input devices +KERNEL=="mice", NAME="input/%k", MODE="0640" +KERNEL=="mouse*", NAME="input/%k", MODE="0640" +KERNEL=="event*", NAME="input/%k", MODE="0640" +KERNEL=="js*", NAME="input/%k", MODE="0644" +KERNEL=="ts*", NAME="input/%k", MODE="0600" +KERNEL=="uinput", NAME="input/%k", MODE="0600" +KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" +SUBSYSTEM=="input[0-9]*", RUN+="/lib/udev/input_device.sh" +KERNEL=="input[0-9]*", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" + +# printer +SUBSYSTEM=="usb", KERNEL=="lp*", ACTION=="add", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", ACTION=="add", NAME="%k", GROUP="lp" +KERNEL=="irlpt*", NAME="%k", GROUP="lp" + +# cpu devices +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# IEEE1394 devices +KERNEL=="raw1394*", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" + +# 183 = /dev/hwrng Generic random number generator +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +# 219 /dev/modems/mwave MWave modem firmware upload +KERNEL=="mwave", NAME="modems/%k" +# 169 /dev/specialix_rioctl Specialix RIO serial control +KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" +# 167 /dev/specialix_sxctl Specialix serial control +KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" + +# misc devices +KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" +KERNEL=="null", NAME="%k", MODE="666" +KERNEL=="zero", NAME="%k", MODE="666" +KERNEL=="full", NAME="%k", MODE="622" +KERNEL=="random", NAME="%k", MODE="666" +KERNEL=="urandom", NAME="%k", MODE="644" +KERNEL=="rtc", GROUP="audio" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", MODE="0600", GROUP="video" +KERNEL=="djs*", NAME="%k", MODE="644" +KERNEL=="sgi_*", NAME="%k", MODE="666" +KERNEL=="rrom*", NAME="%k", MODE="400" +KERNEL=="rflash*", NAME="%k", MODE="400" +KERNEL=="usbscanner*", NAME="%k", MODE="644" +KERNEL=="3270/ttycons*", NAME="%k", MODE="600" +KERNEL=="3270/tub*", NAME="%k", MODE="666" +KERNEL=="3270/tubcons*", NAME="%k", MODE="600" +KERNEL=="ica", NAME="%k", MODE="666" +KERNEL=="z90crypt", NAME="%k", MODE="666" +KERNEL=="mmtimer", NAME="%k", MODE="444" +KERNEL=="auer[0-9]*" NAME="usb/%k" + +KERNEL=="pktcdvd", NAME="pktcdvd/control" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" + +# fix floppy devices +KERNEL=="nvram", ACTION=="add", RUN+="/sbin/load_floppy_module.sh" +KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="/sbin/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd*", ACTION=="remove", RUN+="/sbin/remove_floppy_devices.sh %k" + +# block devices +SUBSYSTEM=="block", GROUP="disk", MODE="0640" + +# SCSI types: +# sd / block values: +# 0 TYPE_DISK +# 7 TYPE_MOD +# 14 TYPE_RBC +# +# st/osst tape: +# 1 TYPE_TAPE +# +# sr cd like ones: +# 4 TYPE_WORM +# 5 TYPE_ROM +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +# Treat osst as a unique case, that is, osst will load more often than +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="Onstream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" + +# IDE/ATAPI handling +SUBSYSTEM=="ide", ACTION=="add", RUN+="/lib/udev/load_ide_modules.sh" + +# device mapper targets +KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control" +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" + +# check fstab and possibly mount +SUBSYSTEM=="block", KERNEL=="sd*[0-9]|hd*[0-9]", ACTION=="add", RUN+="/lib/udev/mount.sh" + +# misc storage devices (non-block) +KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" +KERNEL=="st*", NAME="%k", GROUP="disk" +KERNEL=="nst*", NAME="%k", GROUP="disk" +KERNEL=="initrd", NAME="%k", GROUP="disk" +KERNEL=="qft*", NAME="%k", GROUP="disk" +KERNEL=="nqft*", NAME="%k", GROUP="disk" +KERNEL=="zqft*", NAME="%k", GROUP="disk" +KERNEL=="nzqft*", NAME="%k", GROUP="disk" +KERNEL=="rawqft*", NAME="%k", GROUP="disk" +KERNEL=="nrawqft*", NAME="%k", GROUP="disk" +KERNEL=="pf*", NAME="%k", GROUP="disk" +KERNEL=="sch*", NAME="%k", GROUP="disk" +KERNEL=="pt*", NAME="%k", GROUP="disk" +KERNEL=="npt*", NAME="%k", GROUP="disk" +KERNEL=="pg*", NAME="%k", GROUP="disk" +KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" +KERNEL=="rawctl*", NAME="%k", GROUP="disk" +KERNEL=="osst*", NAME="%k", GROUP="disk" +KERNEL=="nosst*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" + +# libusb device access (mount usbfs or create usbdev nodes) +DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb" +SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev}; B=$${X%%%%.*}; D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" + +# firmware loader +SUBSYSTEM=="firmware", ACTION=="add", RUN+="/lib/udev/firmware.sh" + diff --git a/etc/udev/suse/60-persistent.rules b/etc/udev/suse/60-persistent.rules new file mode 100644 index 0000000000..589fb0f88a --- /dev/null +++ b/etc/udev/suse/60-persistent.rules @@ -0,0 +1,46 @@ +# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" + +# never access removable ide devices, the drivers are causing event loops on open() +BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="sr*", GOTO="persistent_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +LABEL="persistent_end" diff --git a/etc/udev/suse/80-pcmcia.rules b/etc/udev/suse/80-pcmcia.rules new file mode 100644 index 0000000000..cae7a7606c --- /dev/null +++ b/etc/udev/suse/80-pcmcia.rules @@ -0,0 +1,7 @@ +ENV{SYSCONFIG}=="no|off|0", GOTO="pcmcia_end" + +SUBSYSTEM=="pcmcia_socket", ACTION=="add", RUN+="/sbin/hwup pcmcia_socket-devpath-%p -o hotplug" +SUBSYSTEM=="pcmcia", ACTION=="add", RUN+="/sbin/hwup pcmcia-devpath-%p -o hotplug" + +LABEL="pcmcia_end" + diff --git a/etc/udev/suse/80-sysconfig.rules b/etc/udev/suse/80-sysconfig.rules new file mode 100644 index 0000000000..630c0eedfb --- /dev/null +++ b/etc/udev/suse/80-sysconfig.rules @@ -0,0 +1,20 @@ +ENV{SYSCONFIG}=="no|off|0", GOTO="sysconfig_end" + +# network devices +KERNEL=="tun", NAME="net/%k", MODE="0600" +SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug" +SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" + +# SUSE system integration +SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" +SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-/sys%p -o hotplug" +SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-/sys%p -o hotplug" +SUBSYSTEM=="scsi", DEVPATH=="/devices/css*", ACTION=="remove", RUN+="/sbin/hwdown scsi-devpath-/sys%p -o hotplug" +SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{device/cutype}=="*", RUN+="/sbin/hwup scsi__host-devpath-/sys%p -o hotplug" +SUBSYSTEM=="vio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" +SUBSYSTEM=="macio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" +SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-/sys%p -o hotplug" +SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-/sys%p -o hotplug" +SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" + +LABEL="sysconfig_end" diff --git a/etc/udev/suse/90-hal.rules b/etc/udev/suse/90-hal.rules new file mode 100644 index 0000000000..35b81ea046 --- /dev/null +++ b/etc/udev/suse/90-hal.rules @@ -0,0 +1,3 @@ +# send all events to HAL +RUN+="/usr/sbin/hal.hotplug" + diff --git a/etc/udev/suse/95-debug.rules b/etc/udev/suse/95-debug.rules new file mode 100644 index 0000000000..fad54b9632 --- /dev/null +++ b/etc/udev/suse/95-debug.rules @@ -0,0 +1,6 @@ +# debug events to /events, but not on default udev_log="err" +ENV{UDEV_LOG}=="[4-9]", RUN+="/sbin/udeventrecorder" + +# event to be catched by udevmonitor +RUN+="socket:/org/kernel/udev/monitor" + diff --git a/etc/udev/suse/isdn.rules b/etc/udev/suse/isdn.rules deleted file mode 100644 index 29f993adab..0000000000 --- a/etc/udev/suse/isdn.rules +++ /dev/null @@ -1,54 +0,0 @@ -# -# Very important !!! -# These rules must be processed befor 50-pcmcia and 50-udev -# if not here 'll be a endless loop !!! -# -# CAPI devices -SUBSYSTEM="capi", GROUP="dialout" -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# ISDN -KERNEL=="isdn*", NAME="%k", MODE="600" -KERNEL=="isdnctrl*", NAME="%k", MODE="600" -KERNEL=="ippp*", NAME="%k", MODE="600" -KERNEL=="isdninfo*", NAME="%k", MODE="444" -# USB -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/c00*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/1000*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/1900*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2000*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2200*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2300*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2800*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3000*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3500*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3600*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2805*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2806*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/4401*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/4601*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="483/4810*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="959/2bd0*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" -SUBSYSTEM=="usb", ENV{PRODUCT}=="9bf/*", RUN+="/sbin/udev.isdn.sh", GOTO="after_usb_default" - -# ISDN PCMCIA -# AVM B1 models -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb845DC335pc*pd*", RUN+="/sbin/udev.isdn.sh b1 1", GOTO="after_pcmcia" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb81E10430pc*pd*", RUN+="/sbin/udev.isdn.sh b1 2", GOTO="after_pcmcia" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb18E8558Apc*pd*", RUN+="/sbin/udev.isdn.sh b1 3", GOTO="after_pcmcia" -# AVM A1 models (aka Fritz!Card PCMCIA) -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pbADC9D4BBpc*pd*", RUN+="/sbin/udev.isdn.sh a1 1", GOTO="after_pcmcia" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa8D9761C8pb01C5AA7Bpc*pd*", RUN+="/sbin/udev.isdn.sh a1 2", GOTO="after_pcmcia" -# teles -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa67B50EAEpbE9E70119pc*pd*", RUN+="/sbin/udev.isdn.sh teles 1", GOTO="after_pcmcia" -# sedlbauer -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbF3612E1Dpc6B95C78Apd*", RUN+="/sbin/udev.isdn.sh sedlbauer 1", GOTO="after_pcmcia" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc397B7E90pd*", RUN+="/sbin/udev.isdn.sh sedlbauer 2", GOTO="after_pcmcia" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc2E5C7FCEpd*", RUN+="/sbin/udev.isdn.sh sedlbauer 3", GOTO="after_pcmcia" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc8DB143FEpd*", RUN+="/sbin/udev.isdn.sh sedlbauer 4", GOTO="after_pcmcia" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pcB391AB4Cpd*", RUN+="/sbin/udev.isdn.sh sedlbauer 5", GOTO="after_pcmcia" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*paD79E0B84pb21D083AEpc*pd*", RUN+="/sbin/udev.isdn.sh sedlbauer 6", GOTO="after_pcmcia" -# elsa -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa983DE2C4pb333BA257pc*pd*", RUN+="/sbin/udev.isdn.sh elsa 1", GOTO="after_pcmcia" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa639E5718pb333BA257pc*pd*", RUN+="/sbin/udev.isdn.sh elsa 2", GOTO="after_pcmcia" diff --git a/etc/udev/suse/pcmcia.rules b/etc/udev/suse/pcmcia.rules deleted file mode 100644 index 11ccde56e7..0000000000 --- a/etc/udev/suse/pcmcia.rules +++ /dev/null @@ -1,5 +0,0 @@ -SUBSYSTEM=="pcmcia_socket", ACTION=="add", RUN+="/sbin/hwup pcmcia_socket-devpath-%p -o hotplug" -SUBSYSTEM=="pcmcia", ACTION=="add", RUN+="/sbin/hwup pcmcia-devpath-%p -o hotplug" - -LABEL="after_pcmcia" - diff --git a/etc/udev/suse/udev.rules b/etc/udev/suse/udev.rules deleted file mode 100644 index a674f9b510..0000000000 --- a/etc/udev/suse/udev.rules +++ /dev/null @@ -1,247 +0,0 @@ -# console -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", MODE="600" -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666" - -# serial devices -KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" -KERNEL=="pppox*", NAME="%k", GROUP="uucp" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp" -KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" -KERNEL=="hvc*", NAME="%k", GROUP="uucp" -KERNEL=="hvsi*", NAME="%k", GROUP="uucp" -KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" - -# video/graphics -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="graphics" GROUP="video" -KERNEL=="vtx*", NAME="%k", GROUP="video" -KERNEL=="vbi*", NAME="%k", GROUP="video" -KERNEL=="winradio*", NAME="%k", GROUP="video" -KERNEL=="vttuner*", NAME="%k", GROUP="video" -KERNEL=="nvidia*", NAME="%k", GROUP="video" -KERNEL=="nvidiactl*", NAME="%k", GROUP="video" -KERNEL=="video0", SYMLINK+="video" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="vbi0", SYMLINK+="vbi" -KERNEL=="pmu", GROUP="video" - -# dvb -SUBSYSTEM="dvb", PROGRAM="/bin/sh -c 'X=%k X=$${X#dvb} A=$${X%%%%.*} D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" - -# ALSA/sound -SUBSYSTEM="sound", GROUP="audio" -SUBSYSTEM="snd", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8000/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us428fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8004/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us224fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8006/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us122fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8001/*", RUN+="/sbin/startproc /usr/bin/us428control" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startproc /usr/bin/us428control" -SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" -SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" - -# Kino jogshuttle support -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="b33/10/*", RUN+="/usr/bin/killall --quiet -USR2 kino" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="5f3/240/*", RUN+="/usr/bin/killall --quiet -USR2 kino" - -# input devices -KERNEL=="mice", NAME="input/%k", MODE="0640" -KERNEL=="mouse*", NAME="input/%k", MODE="0640" -KERNEL=="event*", NAME="input/%k", MODE="0640" -KERNEL=="js*", NAME="input/%k", MODE="0644" -KERNEL=="ts*", NAME="input/%k", MODE="0600" -KERNEL=="uinput", NAME="input/%k", MODE="0600" -KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" -SUBSYSTEM=="input_device", RUN+="/sbin/udev.input_device.sh" -SUBSYSTEM=="input_device", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" - -# printer -SUBSYSTEM=="usb", KERNEL=="lp*", ACTION=="add", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", ACTION=="add", NAME="%k", GROUP="lp" -KERNEL=="irlpt*", NAME="%k", GROUP="lp" - -# cpu devices -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" - -# IEEE1394 devices -KERNEL=="raw1394*", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" - -# 183 = /dev/hwrng Generic random number generator -KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" -# 219 /dev/modems/mwave MWave modem firmware upload -KERNEL=="mwave", NAME="modems/%k" -# 169 /dev/specialix_rioctl Specialix RIO serial control -KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" -# 167 /dev/specialix_sxctl Specialix serial control -KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" - -# misc devices -KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" -KERNEL=="null", NAME="%k", MODE="666" -KERNEL=="zero", NAME="%k", MODE="666" -KERNEL=="full", NAME="%k", MODE="622" -KERNEL=="random", NAME="%k", MODE="666" -KERNEL=="urandom", NAME="%k", MODE="644" -KERNEL=="rtc", GROUP="audio" -KERNEL=="sonypi", MODE="0666" -KERNEL=="agpgart", MODE="0600", GROUP="video" -KERNEL=="djs*", NAME="%k", MODE="644" -KERNEL=="sgi_*", NAME="%k", MODE="666" -KERNEL=="rrom*", NAME="%k", MODE="400" -KERNEL=="rflash*", NAME="%k", MODE="400" -KERNEL=="usbscanner*", NAME="%k", MODE="644" -KERNEL=="3270/ttycons*", NAME="%k", MODE="600" -KERNEL=="3270/tub*", NAME="%k", MODE="666" -KERNEL=="3270/tubcons*", NAME="%k", MODE="600" -KERNEL=="ica", NAME="%k", MODE="666" -KERNEL=="z90crypt", NAME="%k", MODE="666" -KERNEL=="mmtimer", NAME="%k", MODE="444" - -# fix floppy devices -KERNEL=="nvram", ACTION=="add", RUN+="/sbin/load_floppy_module" -KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="/sbin/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" -KERNEL=="fd*", ACTION=="remove", RUN+="/sbin/remove_floppy_devices %k" - -# block devices -SUBSYSTEM=="block", GROUP="disk", MODE="0640" - -# SCSI types: -# sd / block values: -# 0 TYPE_DISK -# 7 TYPE_MOD -# 14 TYPE_RBC -# -# st/osst tape: -# 1 TYPE_TAPE -# -# sr cd like ones: -# 4 TYPE_WORM -# 5 TYPE_ROM -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -# Treat osst as a unique case, that is, osst will load more often than -# actually required, but the osst and st drivers will do the right thing. -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="Onstream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" - -# IDE/ATAPI handling -SUBSYSTEM=="ide", ACTION=="add", RUN+="/sbin/udev.load_ide_modules.sh" - -# misc storage devices (non-block) -KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" -KERNEL=="st*", NAME="%k", GROUP="disk" -KERNEL=="nst*", NAME="%k", GROUP="disk" -KERNEL=="initrd", NAME="%k", GROUP="disk" -KERNEL=="qft*", NAME="%k", GROUP="disk" -KERNEL=="nqft*", NAME="%k", GROUP="disk" -KERNEL=="zqft*", NAME="%k", GROUP="disk" -KERNEL=="nzqft*", NAME="%k", GROUP="disk" -KERNEL=="rawqft*", NAME="%k", GROUP="disk" -KERNEL=="nrawqft*", NAME="%k", GROUP="disk" -KERNEL=="pf*", NAME="%k", GROUP="disk" -KERNEL=="sch*", NAME="%k", GROUP="disk" -KERNEL=="pt*", NAME="%k", GROUP="disk" -KERNEL=="npt*", NAME="%k", GROUP="disk" -KERNEL=="pg*", NAME="%k", GROUP="disk" -KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" -KERNEL=="rawctl*", NAME="%k", GROUP="disk" -KERNEL=="osst*", NAME="%k", GROUP="disk" -KERNEL=="nosst*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" - -# device mapper targets -KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control" -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/udev.devmap_name.sh %M %m", NAME="mapper/%c" - -# persistent disk device links /dev/disk/ -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" - -# skip rules for for ram/loop/fd -KERNEL=="ram*|loop*|fd*", GOTO="persistent_end" - -# never access removable ide devices, the drivers are causing event loops on open() -SUBSYSTEM=="block", BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -LABEL="persistent_end" - -SUBSYSTEM=="block", KERNEL=="sd*[0-9]|hd*[0-9]", ACTION=="add", RUN+="/sbin/udev.mount.sh" - -# network devices -KERNEL=="tun", NAME="net/%k", MODE="0600" -SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug" -SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" - -# libusb device access (mount usbfs or usbdev nodes) -DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb" -SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" - -# firmware loader -SUBSYSTEM=="firmware", ACTION=="add", RUN+="/sbin/udev.firmware.sh" - -# SUSE system integration -SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" -SUBSYSTEM=="macio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" -SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-/sys%p -o hotplug" -LABEL="after_usb_default" -SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-/sys%p -o hotplug" -SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-/sys%p -o hotplug" -SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-/sys%p -o hotplug" -SUBSYSTEM=="scsi", DEVPATH=="/devices/css*", ACTION=="remove", RUN+="/sbin/hwdown scsi-devpath-/sys%p -o hotplug" -SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{device/cutype}=="*", RUN+="/sbin/hwup scsi__host-devpath-/sys%p -o hotplug" - -# default -RUN+="/usr/sbin/hal.hotplug" -RUN+="socket:/org/kernel/udev/monitor" - -# debug events to /events, but not on default udev_log="err" -ENV{UDEV_LOG}=="[4-9]", RUN+="/sbin/hotplugeventrecorder" - -- cgit v1.2.3-54-g00ecf From f5f8f316aa66251d0ccf71b940182a9d00dbd040 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Nov 2005 01:11:03 +0100 Subject: remove completely useless start script Signed-off-by: Kay Sievers --- etc/init.d/udev.init.LSB | 101 ----------------------------------------------- 1 file changed, 101 deletions(-) delete mode 100644 etc/init.d/udev.init.LSB diff --git a/etc/init.d/udev.init.LSB b/etc/init.d/udev.init.LSB deleted file mode 100644 index 0fb0f0c205..0000000000 --- a/etc/init.d/udev.init.LSB +++ /dev/null @@ -1,101 +0,0 @@ -#! /bin/sh -# -# Author: Rolf Eike Beer -# derived from original RedHat udev init script -# based on the SuSE 9.0 template (c) 1995-2002 SuSE Linux AG -# -# /etc/init.d/udev -# and its symbolic link -# /(usr/)sbin/rcudev -# -# System startup script for udev -# -# LSB compatible service control script; see http://www.linuxbase.org/spec/ -# -### BEGIN INIT INFO -# Provides: udev -# Required-Start: -# Required-Stop: -# Default-Start: 1 2 3 5 -# Default-Stop: 0 6 -# Short-Description: manage user-space device nodes in /udev -# Description: Start udev to create the device files for all -# devices already present in system when script is -# called. All other devices files will be automatically -# created when udev is called via /sbin/hotplug. -# Requires at least a kernel 2.6 to work properly. -### END INIT INFO -# -# Note on script names: -# http://www.linuxbase.org/spec/refspecs/LSB_1.2.0/gLSB/scrptnames.html -# A registry has been set up to manage the init script namespace. -# http://www.lanana.org/ -# Please use the names already registered or register one or use a -# vendor prefix. - - -# Check for missing binaries (stale symlinks should not happen) -UDEV_BIN=/sbin/udev -test -x $UDEV_BIN || exit 5 - -# Check for existence of needed config file and read it -UDEV_CONFIG=/etc/udev/udev.conf -test -r $UDEV_CONFIG || exit 6 -. $UDEV_CONFIG - -# Directory where sysfs is mounted -SYSFS_DIR=/sys - -# Source LSB init functions -. /lib/lsb/init-functions - -case "$1" in - start) - if [ ! -d $SYSFS_DIR ]; then - log_failure_msg "${0}: SYSFS_DIR \"$SYSFS_DIR\" not found" - exit 1 - fi - if [ ! -d $udev_root ]; then - mkdir $udev_root || exit 4 - fi - # propogate /udev from /sys - we only need this while we do not - # have initramfs and an early user-space with which to do early - # device bring up - echo -n "Creating initial udev device nodes: " - export ACTION=add - udevstart - log_success_msg - ;; - stop) - # nothing to do here - echo -n "Stopping udev: " - log_success_msg - ;; - restart) - $0 stop - $0 start - - exit $? - ;; - force-reload) - echo -n "Reload udev " - $0 stop && $0 start - exit $? - ;; - reload) - exit 3 - ;; - status) - echo -n "Checking for udev root directory: " - if [ -d $udev_root ]; then - log_success_msg found - else - log_warning_msg "not found" - exit 3 - fi - ;; - *) - echo "Usage: $0 {start|stop|status|restart|force-reload|reload}" - exit 1 - ;; -esac -- cgit v1.2.3-54-g00ecf From 53899a171ea862124b49c75b7511b7eb30742ef9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Nov 2005 01:50:06 +0100 Subject: fix tests and remove no longer useful stuff Signed-off-by: Kay Sievers --- test/devd_test | 37 ------------------------------------- test/net_test | 35 ----------------------------------- test/replace_test | 33 --------------------------------- test/show_all_devices.sh | 27 --------------------------- test/test.all | 41 ----------------------------------------- test/test.block | 29 ----------------------------- test/test.tty | 20 -------------------- test/testd.block | 36 ------------------------------------ test/udev-test.pl | 5 +++-- udev_remove.c | 4 ++-- 10 files changed, 5 insertions(+), 262 deletions(-) delete mode 100755 test/devd_test delete mode 100755 test/net_test delete mode 100755 test/replace_test delete mode 100755 test/show_all_devices.sh delete mode 100755 test/test.all delete mode 100755 test/test.block delete mode 100755 test/test.tty delete mode 100755 test/testd.block diff --git a/test/devd_test b/test/devd_test deleted file mode 100755 index 534e787f24..0000000000 --- a/test/devd_test +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -RULES=label_test.rules -CONFIG=label_test.conf - -export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_FILE=$PWD/$CONFIG - -cat > $RULES << EOF -BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="boot_diskX%n" -BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW !#", NAME="a/nice/place/to/put/a/boot_disk%n" -EOF - -cat > $CONFIG << EOF -udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udevdb" -udev_rules="$PWD/$RULES" -EOF - -mkdir udev - -export ACTION=add -export DEVPATH=block/sda - -../udev block -ls -l udev - -export ACTION=remove -export DEVPATH=block/sda - -../udev block -ls -l udev - - -rm $RULES -rm $CONFIG -rm -rf udev diff --git a/test/net_test b/test/net_test deleted file mode 100755 index 9daf8da082..0000000000 --- a/test/net_test +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -RULES=label_test.rules -CONFIG=label_test.conf - -export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_FILE=$PWD/$CONFIG - -cat > $RULES << EOF -SYSFS{address}="00:e0:00:8d:9f:25", NAME="wireless" -EOF - -cat > $CONFIG << EOF -udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udevdb" -udev_rules="$PWD/$RULES" -EOF - -mkdir udev - -export ACTION=add -export DEVPATH=class/net/eth1 - -../udevtest class/net/eth1 net -ls -l udev - -export ACTION=remove -export DEVPATH=class/net/eth1 - -../udevtest class/net/eth1 net -ls -l udev - -rm $RULES -rm $CONFIG -rm -rf udev diff --git a/test/replace_test b/test/replace_test deleted file mode 100755 index 6e01f28ed5..0000000000 --- a/test/replace_test +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -RULES=replace_test.rules -CONFIG=replace_test.conf - -export SYSFS_PATH=$PWD/sys/ -export UDEV_CONFIG_FILE=$PWD/$CONFIG - -cat > $RULES << EOF -KERNEL="ttyUSB0", NAME="visor" -EOF - -cat > $CONFIG << EOF -udev_root="$PWD/udev/" -udev_db="$PWD/udev/.udevdb" -udev_rules="$PWD/$RULES" -EOF - -mkdir udev - -export DEVPATH=class/tty/ttyUSB0 -export ACTION=add - -../udev tty -ls -l udev - -export ACTION=remove -../udev tty -ls -l udev - -rm $RULES -rm $CONFIG -rm -rf udev diff --git a/test/show_all_devices.sh b/test/show_all_devices.sh deleted file mode 100755 index 921b8e6163..0000000000 --- a/test/show_all_devices.sh +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/bash -# -# Directory where sysfs is mounted -SYSFS_DIR=/sys - -# handle block devices and their partitions -for i in ${SYSFS_DIR}/block/*; do - # each drive - echo ${i#${SYSFS_DIR}/block/} - - # each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - echo ${j#${SYSFS_DIR}} | cut --delimiter='/' --fields=4- - fi - done -done - -# all other device classes -for i in ${SYSFS_DIR}/class/*; do - for j in $i/*; do - if [ -f $j/dev ]; then - echo ${j#${SYSFS_DIR}} | cut --delimiter='/' --fields=4- - fi - done -done - diff --git a/test/test.all b/test/test.all deleted file mode 100755 index 527569bd43..0000000000 --- a/test/test.all +++ /dev/null @@ -1,41 +0,0 @@ -#! /bin/sh -# -# test.block - run udev(8) on each block device in /sys/block - -if [ $# = "0" ] ; then - echo - echo "usage: $0 " - echo "where is \"add\" or \"remove\"" - echo - exit 1 -fi - -SYSFSDIR=/sys # change this for a nonstand sysfs mount point -BIN=../udev # location of your udev binary -export ACTION=$1 # 'add' or 'remove' - -# do the block devices first -for i in ${SYSFSDIR}/block/*; do - # add each drive - export DEVPATH=${i#${SYSFSDIR}} - $BIN block - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${SYSFSDIR}} - $BIN block - fi - done -done - -# now all the devices in the class directories -for i in ${SYSFSDIR}/class/*; do - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${SYSFSDIR}} - CLASS=`echo ${i#${SYSFSDIR}} | cut --delimiter='/' --fields=3-` - $BIN $CLASS - fi - done -done diff --git a/test/test.block b/test/test.block deleted file mode 100755 index 294c47c0be..0000000000 --- a/test/test.block +++ /dev/null @@ -1,29 +0,0 @@ -#! /bin/sh -# -# test.block - run udev(8) on each block device in /sys/block - -if [ $# = "0" ] ; then - echo - echo "usage: $0 " - echo "where is \"add\" or \"remove\"" - echo - exit 1 -fi - -SYSFSDIR=/sys # change this for a nonstand sysfs mount point -BIN=../udev # location of your udev binary -export ACTION=$1 # 'add' or 'remove' - -for i in ${SYSFSDIR}/block/*; do - # add each drive - export DEVPATH=${i#${SYSFSDIR}} - $BIN block - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${SYSFSDIR}} - $BIN block - fi - done -done diff --git a/test/test.tty b/test/test.tty deleted file mode 100755 index b89ad5a6d8..0000000000 --- a/test/test.tty +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/sh -# -# test.tty - run udev(8) on each tty device in /sys/class/tty - -if [ $# = "0" ] ; then - echo - echo "usage: $0 " - echo "where is \"add\" or \"remove\"" - echo - exit 1 -fi - -SYSFSDIR=/sys # change this for a nonstand sysfs mount point -BIN=../udev # location of your udev binary -export ACTION=$1 # 'add' or 'remove' - -for i in ${SYSFSDIR}/class/tty/*; do - export DEVPATH=${i#${SYSFSDIR}} - $BIN tty -done diff --git a/test/testd.block b/test/testd.block deleted file mode 100755 index ca9ac8c1ac..0000000000 --- a/test/testd.block +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash -# -# test.block - run udev(8) on each block device in /sys/block - -if [ $# = "0" ] ; then - echo - echo "usage: $0 " - echo "where is \"add\" or \"remove\"" - echo - exit 1 -fi - -killall udevd - -SYSFSDIR=/sys # change this for a nonstand sysfs mount point -BIN=./udevsend # location of your udev binary -export ACTION=$1 # 'add' or 'remove' -seq=1 - -for i in ${SYSFSDIR}/block/*; do - # add each drive - export DEVPATH=${i#${SYSFSDIR}} - export SEQNUM=$seq - $BIN block - x=$((seq++)) - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${SYSFSDIR}} - export SEQNUM=$seq - $BIN block - x=$((seq++)) - fi - done -done diff --git a/test/udev-test.pl b/test/udev-test.pl index 44bc483cf1..2549c7ee69 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -262,9 +262,9 @@ EOF desc => "import of shell-value file", subsys => "block", devpath => "/block/sda", - exp_name => "subdir/sys/node" , + exp_name => "subdir/info/node" , rules => <$udev_conf" || die "unable to create config file: $udev_conf"; print CONF "udev_root=\"$udev_root\"\n"; print CONF "udev_db=\"$udev_db\"\n"; print CONF "udev_rules=\"$udev_rules\"\n"; +print CONF "udev_log=\"info\"\n"; close CONF; my $test_num = 1; diff --git a/udev_remove.c b/udev_remove.c index cb5523af92..4d1b9286a0 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -152,8 +152,8 @@ int udev_remove_device(struct udevice *udev) dbg("remove name='%s'", udev->name); udev_db_delete_device(udev); } else { - dbg("'%s' not found in database, don't remove anything", udev->devpath); - return -1; + dbg("'%s' not found in database, using kernel name '%s'", udev->devpath, udev->kernel_name); + strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); } return delete_node(udev); -- cgit v1.2.3-54-g00ecf From a8d141a3c165dafcf21d081e88f3cc0b7f1e65c5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Nov 2005 02:06:43 +0100 Subject: replace udeveventrecorder by a shell script Signed-off-by: Kay Sievers --- .gitignore | 1 - Makefile | 2 - etc/udev/suse/95-debug.rules | 2 +- extras/eventrecorder.sh | 4 ++ udeveventrecorder.c | 127 ------------------------------------------- 5 files changed, 5 insertions(+), 131 deletions(-) create mode 100755 extras/eventrecorder.sh delete mode 100644 udeveventrecorder.c diff --git a/.gitignore b/.gitignore index a83700c930..c37b70c524 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,5 @@ udevinfo udevmonitor udevstart udevtest -udeveventrecorder udev_version.h diff --git a/Makefile b/Makefile index c105dab2e2..ab75bb3d9a 100644 --- a/Makefile +++ b/Makefile @@ -50,7 +50,6 @@ PROGRAMS = \ udev \ udevd \ udevsend \ - udeveventrecorder \ udevcontrol \ udevmonitor \ udevinfo \ @@ -359,7 +358,6 @@ uninstall-bin: - rm -f $(DESTDIR)$(sbindir)/udev - rm -f $(DESTDIR)$(sbindir)/udevd - rm -f $(DESTDIR)$(sbindir)/udevsend - - rm -f $(DESTDIR)$(sbindir)/udeveventrecoreder - rm -f $(DESTDIR)$(sbindir)/udevcontrol - rm -f $(DESTDIR)$(sbindir)/udevstart - rm -f $(DESTDIR)$(usrsbindir)/udevmonitor diff --git a/etc/udev/suse/95-debug.rules b/etc/udev/suse/95-debug.rules index fad54b9632..280287c1a7 100644 --- a/etc/udev/suse/95-debug.rules +++ b/etc/udev/suse/95-debug.rules @@ -1,5 +1,5 @@ # debug events to /events, but not on default udev_log="err" -ENV{UDEV_LOG}=="[4-9]", RUN+="/sbin/udeventrecorder" +ENV{UDEV_LOG}=="[4-9]", RUN+="/lib/udev/eventrecorder.sh" # event to be catched by udevmonitor RUN+="socket:/org/kernel/udev/monitor" diff --git a/extras/eventrecorder.sh b/extras/eventrecorder.sh new file mode 100755 index 0000000000..90cfe68ebb --- /dev/null +++ b/extras/eventrecorder.sh @@ -0,0 +1,4 @@ +#/bin/sh + +[ -d /events ] || exit 0 +set > /events/debug.$SEQNUM.$1.$ACTION.$$ diff --git a/udeveventrecorder.c b/udeveventrecorder.c deleted file mode 100644 index 422cf88ff0..0000000000 --- a/udeveventrecorder.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * udeveventrecorder.c - * - * Copyright (C) 2004-2005 SuSE Linux Products GmbH - * Author: - * Olaf Hering - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_version.h" -#include "udev_utils.h" -#include "logging.h" - -#define BUFSIZE 12345 -#define FNSIZE 123 - -static int udev_log = 0; - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char **argv, char **envp) -{ - int fd, i; - unsigned long seq; - char **ep = envp; - char *buf, *p, *a; - struct stat sb; - const char *env; - - if (stat("/events", &sb) || !(S_ISDIR(sb.st_mode))) - return 0; - - env = getenv("UDEV_LOG"); - if (env) - udev_log = log_priority(env); - - logging_init("udeveventrecorder"); - dbg("version %s", UDEV_VERSION); - - p = getenv("SEQNUM"); - a = getenv("ACTION"); - buf = malloc(FNSIZE); - if (!(buf && a && argv[1])) - goto error; - if (p) - seq = strtoul(p, NULL, 0); - else - seq = 0; - - snprintf(buf, FNSIZE, "/events/debug.%05lu.%s.%s.%u", seq, argv[1], a ? a : "", getpid()); - if ((fd = open(buf, O_CREAT | O_WRONLY | O_TRUNC, 0644)) < 0) { - err("error creating '%s': %s", buf, strerror(errno)); - goto error; - } - free(buf); - p = malloc(BUFSIZE); - buf = p; - buf += snprintf(buf, p + BUFSIZE - buf, "set --"); - for (i = 1; i < argc; ++i) { - buf += snprintf(buf, p + BUFSIZE - buf, " %s", argv[i]); - if (buf > p + BUFSIZE) - goto full; - } - buf += snprintf(buf, p + BUFSIZE - buf, "\n"); - if (buf > p + BUFSIZE) - goto full; - while (*ep) { - unsigned char *t; - t = memchr(*ep, '=', strlen(*ep)); - if (t) { - *t = '\0'; - t++; - buf += snprintf(buf, p + BUFSIZE - buf, "%s='%s'\n", *ep, t); - --t; - *t = '='; - } - ep++; - if (buf > p + BUFSIZE) - break; - } - -full: - buf = p; - write(fd, buf, strlen(buf)); - close(fd); - free(buf); - return 0; - -error: - fprintf(stderr, "record enviroment to /events, to be called from udev context\n"); - return 1; -} -- cgit v1.2.3-54-g00ecf From ef0cd1ac934f10037766d1000e9a6065653688ac Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Nov 2005 02:20:25 +0100 Subject: 075 release --- ChangeLog | 15 +++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 5 ++++- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ef3c4b838..bde6b4f05e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,21 @@ Summary of changes from v74 to v075 ============================================ +Greg Kroah-Hartman: + Make run_directory.c stat the place it is going to try to run. + +Kay Sievers: + forgot the ChangeLog for 074 + volume_id: provide libvolume_id.a file + remove our own copy of klibc + remove outdated HOWTO + update TODO + update SUSE rules + remove completely useless start script + fix tests and remove no longer useful stuff + replace udeveventrecorder by a shell script + + Summary of changes from v73 to v074 ============================================ diff --git a/Makefile b/Makefile index ab75bb3d9a..c68db3b93a 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 074 +VERSION = 075 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d89aeaa69f..8062703889 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,7 +1,10 @@ udev 075 ======== +Silent a too verbose error logging for the old hotplug.d/ dev.d/ +emulation. + The copy of klibc is removed. A systemwide installed version of klibc -can be used to buil a klibc udev. +should be used to build a klibc udev now. udev 074 ======== -- cgit v1.2.3-54-g00ecf From 08f403cc3759c406a67c5477c3a14a0d82f4c8a1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Nov 2005 04:35:35 +0100 Subject: fix typo in eventrecorder Signed-off-by: Kay Sievers --- extras/eventrecorder.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/eventrecorder.sh b/extras/eventrecorder.sh index 90cfe68ebb..95ec95a24e 100755 --- a/extras/eventrecorder.sh +++ b/extras/eventrecorder.sh @@ -1,4 +1,4 @@ -#/bin/sh +#!/bin/sh [ -d /events ] || exit 0 set > /events/debug.$SEQNUM.$1.$ACTION.$$ -- cgit v1.2.3-54-g00ecf From 009364eef93ab3e757ece02a17b2cd217fd71dac Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 12 Nov 2005 04:11:08 +0100 Subject: volume_id: include stddef.h header Signed-off-by: Kay Sievers --- extras/volume_id/libvolume_id/volume_id.h | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index f2f3a0d006..517d382540 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -12,6 +12,7 @@ #define _VOLUME_ID_H_ #include +#include #define VOLUME_ID_VERSION 53 -- cgit v1.2.3-54-g00ecf From e24b218ad7ab05f92c6ca93ddc7e62f918094a46 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 12 Nov 2005 04:11:48 +0100 Subject: remove misleading install instructions Signed-off-by: Kay Sievers --- docs/rh_udev_for_dev.txt | 62 ------------------------------------------------ 1 file changed, 62 deletions(-) delete mode 100644 docs/rh_udev_for_dev.txt diff --git a/docs/rh_udev_for_dev.txt b/docs/rh_udev_for_dev.txt deleted file mode 100644 index 0b66868d79..0000000000 --- a/docs/rh_udev_for_dev.txt +++ /dev/null @@ -1,62 +0,0 @@ -Troubleshooting udev for dev on Red Hat distro - -1) Make sure you have a rescue disk/cd in case you hose your machine. You've - been forewarned. -2) Grab latest udev tarball or clone udev bitkeeper tree - (bk://linuxusb.bkbits.net.udev) -3) Follow README and HOWTO-udev_for_dev documents - -The following is some additional help to get udev for dev up and running on RH. - -Q. I login as my normal self from the login screen and RH just hangs on an - empty blue screen. What's wrong? - -A. You have some wrong permissions. I'm guessing you can probably log in as root - but not as your normal user. Basically you need to set the right - permissions with a rule. Setting the correct permissions to null and urandom - allowed me to login as myself and not at root. - - While you are there you might want to set the permissions to ptmx as well - or you may have trouble getting a bash prompt in an xterm. Also refer to the - next question. - -Q. I'm having trouble getting a bash prompt from my xterm. i.e. I bring up a - terminal and all I have is a blank screen with a blinking cursor. - -A. First make sure you have the correct permissions set for ptmx. See above - Q&A for help on this. But I'm guessing that something is wrong with your - /dev/pts, thanks Captain Obvious, heh:) You probably have devpts mounted - to /dev/pts from /etc/fstab. I'm also guessing that you have sysfs mounted - to /sys from /etc/fstab as well. If this is the case then the line in - /etc/rc.sysinit - - action $"Mounting local filesystems:" mount -a -t nonfs,smbfs,ncpfs -O no_netdev - - will have mounted these for you. As a result you placed your call to - start_udev directly after this because the HOWTO-udev_for_dev document - told you to insert start_udev after /proc and /sys have been mounted. - Well start_udev actually overwrites /dev thus anything you had mounted in - /dev prior to start_udev being called will be blown away. So basically, - you mounted devpts to /dev/pts because everything in /etc/fstab was mounted - and then it was blown away by calling start_udev. A simple fix is to remove - the mount devpts line from /etc/fstab and mount it after calling start_udev. - I did the following: - - action $"Mounting local filesystems:" mount -a -t nonfs,smbfs,ncpfs -O no_netdev - /etc/rc.d/start_udev - action $"Mounting devpts: " mount -t devpts none /dev/pts - - After doing so I rebooted and was able to get my prompt from my xterm. - -Q. I'm getting some error messages during boot. How do I get rid of them? - -A. For me it was a matter of setting up Symlinks. Basically, some /dev entries - were being looked for and not being found so an error was thrown. For example, - /dev/cdrom was needed but udev had named it /dev/hdc by default. Basically I - edited my /etc/udev/udev.rules file to create a symlink from /dev/cdrom to - /dev/hdc and my error went away. - -These are some of the things I ran into. NOTE: I hosed my machine more than once -trying to figure this out and a rescue disk was my best friend. If you have any -other experiences and would like to add to this Q&A list feel free to send me a -patch (ogasawara@osdl.org). Hopefully this helped someone. Thanks. -- cgit v1.2.3-54-g00ecf From c86be870ce6bb6361ca2ca6c3c05b6d89cf70a2c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 12 Nov 2005 04:17:48 +0100 Subject: remove all built-in wait_for_sysfs logic Most of the issues are fixed with the kernel we depend on, for the remaing ones see the RELEASE-NOTES for a special rule to add. Signed-off-by: Kay Sievers --- Makefile | 2 - RELEASE-NOTES | 9 ++ udev.c | 1 - udev.h | 1 + udev_add.c | 1 - udev_device.c | 1 - udev_event.c | 39 ++++++-- udev_rules.c | 5 +- udev_sysfs.c | 298 ---------------------------------------------------------- udev_sysfs.h | 40 -------- udevstart.c | 1 - udevtest.c | 1 - 12 files changed, 44 insertions(+), 355 deletions(-) delete mode 100644 udev_sysfs.c delete mode 100644 udev_sysfs.h diff --git a/Makefile b/Makefile index c68db3b93a..de305cb9bf 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,6 @@ HEADERS = \ udev_utils.h \ udev_rules.h \ udev_db.h \ - udev_sysfs.h \ logging.h \ udev_libc_wrapper.h \ udev_selinux.h \ @@ -73,7 +72,6 @@ UDEV_OBJS = \ udev_config.o \ udev_add.o \ udev_remove.o \ - udev_sysfs.o \ udev_db.o \ udev_rules.o \ udev_rules_parse.o \ diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 8062703889..18e2829bbb 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,12 @@ +udev 076 +======== +All built-in logic to work around bad sysfs timing is removed with this +version. The need to wait for sysfs files is almost fixed with a kernel +version that doesn't work with this udev version anyway. Until we fix +the timing of the "bus" link creation, the former integrated logic should +be emulated by a rule placed before all other rules: + ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" + udev 075 ======== Silent a too verbose error logging for the old hotplug.d/ dev.d/ diff --git a/udev.c b/udev.c index 17867180c7..f2d6f6653c 100644 --- a/udev.c +++ b/udev.c @@ -34,7 +34,6 @@ #include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" -#include "udev_sysfs.h" #include "udev_version.h" #include "udev_rules.h" #include "logging.h" diff --git a/udev.h b/udev.h index ecc0a44f91..e61b692df7 100644 --- a/udev.h +++ b/udev.h @@ -84,6 +84,7 @@ struct udevice { 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 dev_t get_devt(struct sysfs_class_device *class_dev); extern int udev_process_event(struct udev_rules *rules, struct udevice *udev); extern int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev); extern int udev_remove_device(struct udevice *udev); diff --git a/udev_add.c b/udev_add.c index f4ad55a893..1a224a1792 100644 --- a/udev_add.c +++ b/udev_add.c @@ -37,7 +37,6 @@ #include "udev_libc_wrapper.h" #include "udev.h" #include "udev_utils.h" -#include "udev_sysfs.h" #include "udev_version.h" #include "logging.h" #include "udev_rules.h" diff --git a/udev_device.c b/udev_device.c index ad6f706366..7821c91cb4 100644 --- a/udev_device.c +++ b/udev_device.c @@ -37,7 +37,6 @@ #include "udev.h" #include "logging.h" #include "udev_utils.h" -#include "udev_sysfs.h" #include "list.h" diff --git a/udev_event.c b/udev_event.c index b50fbf4c1d..353aff09b7 100644 --- a/udev_event.c +++ b/udev_event.c @@ -28,38 +28,62 @@ #include #include #include +#include +#include "libsysfs/sysfs/libsysfs.h" #include "udev_libc_wrapper.h" #include "udev.h" #include "logging.h" #include "udev_rules.h" #include "udev_utils.h" -#include "udev_sysfs.h" #include "list.h" +dev_t get_devt(struct sysfs_class_device *class_dev) +{ + struct sysfs_attribute *attr = NULL; + unsigned int major, minor; + char *maj, *min; + + maj = getenv("MAJOR"); + min = getenv("MINOR"); + + if (maj && min) { + major = atoi(maj); + minor = atoi(min); + } else { + attr = sysfs_get_classdev_attr(class_dev, "dev"); + if (attr == NULL) + return 0; + dbg("dev='%s'", attr->value); + + if (sscanf(attr->value, "%u:%u", &major, &minor) != 2) + return 0; + } + + dbg("found major=%d, minor=%d", major, minor); + return makedev(major, minor); +} + int udev_process_event(struct udev_rules *rules, struct udevice *udev) { int retval; char path[PATH_SIZE]; - const char *error; if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS || udev->type == DEV_NET) { /* handle device node */ if (strcmp(udev->action, "add") == 0) { struct sysfs_class_device *class_dev; - /* wait for sysfs of /sys/class /sys/block */ dbg("node add"); snprintf(path, sizeof(path), "%s%s", sysfs_path, udev->devpath); path[sizeof(path)-1] = '\0'; - class_dev = wait_class_device_open(path); + class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { dbg("open class device failed"); return 0; } dbg("opened class_dev->name='%s'", class_dev->name); - wait_for_class_device(class_dev, &error); /* get major/minor */ if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) @@ -113,17 +137,16 @@ int udev_process_event(struct udev_rules *rules, struct udevice *udev) } else if (udev->type == DEV_DEVICE && strcmp(udev->action, "add") == 0) { struct sysfs_device *devices_dev; - /* wait for sysfs of /sys/devices/ */ dbg("devices add"); snprintf(path, sizeof(path), "%s%s", sysfs_path, udev->devpath); path[sizeof(path)-1] = '\0'; - devices_dev = wait_devices_device_open(path); + devices_dev = sysfs_open_device_path(path); if (!devices_dev) { dbg("devices device unavailable (probably remove has beaten us)"); return 0; } + dbg("devices device opened '%s'", path); - wait_for_devices_device(devices_dev, &error); udev_rules_get_run(rules, udev, NULL, devices_dev); sysfs_close_device(devices_dev); if (udev->ignore_device) { diff --git a/udev_rules.c b/udev_rules.c index 137ad27dba..a3100f8e14 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -376,7 +376,7 @@ attr_found: return 0; } -#define WAIT_LOOP_PER_SECOND 20 +#define WAIT_LOOP_PER_SECOND 50 static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) { char filename[PATH_SIZE]; @@ -392,9 +392,10 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) info("file appeared after %i loops", (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } + info("wait for %i mseconds", 1000 / WAIT_LOOP_PER_SECOND); usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - info("waiting for '%s' failed", filename); + err("waiting for '%s' failed", filename); return -1; } diff --git a/udev_sysfs.c b/udev_sysfs.c deleted file mode 100644 index 71aa827d38..0000000000 --- a/udev_sysfs.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - * udev_sysfs.c - sysfs linux kernel specific knowledge - * - * Copyright (C) 2004 Kay Sievers - * Copyright (C) 2004 Greg Kroah-Hartman - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libsysfs/sysfs/libsysfs.h" -#include "udev_version.h" -#include "udev_sysfs.h" -#include "udev_utils.h" -#include "logging.h" - -/* list of subsystem specific files, NULL if there is no file to wait for */ -dev_t get_devt(struct sysfs_class_device *class_dev) -{ - struct sysfs_attribute *attr = NULL; - unsigned int major, minor; - - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr == NULL) - return 0; - dbg("dev='%s'", attr->value); - - if (sscanf(attr->value, "%u:%u", &major, &minor) != 2) - return 0; - dbg("found major=%d, minor=%d", major, minor); - - return makedev(major, minor); -} - -/* wait for a devices device specific file to show up */ -int wait_for_devices_device(struct sysfs_device *devices_dev, - const char **error) -{ - static const struct device_file { - const char *bus; - const char *file; - } device_files[] = { - { .bus = "scsi", .file = "vendor" }, - { .bus = "usb", .file = "idVendor" }, - { .bus = "usb", .file = "iInterface" }, - { .bus = "usb", .file = "bNumEndpoints" }, - { .bus = "usb-serial", .file = "bus" }, - { .bus = "ide", .file = "bus" }, - { .bus = "pci", .file = "vendor" }, - { .bus = "pci_express", .file = "bus" }, - { .bus = "platform", .file = "bus" }, - { .bus = "pcmcia", .file = "bus" }, - { .bus = "i2c", .file = "bus" }, - { .bus = "ieee1394", .file = "node_count" }, - { .bus = "ieee1394", .file = "nodeid" }, - { .bus = "ieee1394", .file = "address" }, - { .bus = "bttv-sub", .file = NULL }, - { .bus = "pnp", .file = "bus" }, - { .bus = "eisa", .file = "bus" }, - { .bus = "serio", .file = "bus" }, - { .bus = "pseudo", .file = "bus" }, - { .bus = "mmc", .file = "bus" }, - { .bus = "macio", .file = "bus" }, - { .bus = "of_platform", .file = "bus" }, - { .bus = "vio", .file = "bus" }, - { .bus = "ecard", .file = "bus" }, - { .bus = "sa1111-rab", .file = "bus" }, - { .bus = "amba", .file = "bus" }, - { .bus = "locomo-bus", .file = "bus" }, - { .bus = "logicmodule", .file = "bus" }, - { .bus = "parisc", .file = "bus" }, - { .bus = "ocp", .file = "bus" }, - { .bus = "dio", .file = "bus" }, - { .bus = "MCA", .file = "bus" }, - { .bus = "wl", .file = "bus" }, - { .bus = "ccwgroup", .file = "bus" }, - { .bus = "css", .file = "bus" }, - { .bus = "ccw", .file = "bus" }, - { .bus = "iucv", .file = "bus" }, - { NULL, NULL } - }; - const struct device_file *devicefile = NULL; - int loop; - - if (getenv("PHYSDEVBUS") == NULL) { - dbg("the kernel says, that there is no bus for '%s'", devices_dev->path); - return 0; - } - - /* wait for the bus device link to the devices device */ - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - if (sysfs_get_device_bus(devices_dev) == 0) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - if (loop == 0) { - dbg("error: getting bus device link"); - if (error) - *error = "no bus device link"; - return -1; - } - dbg("bus device link found for bus '%s'", devices_dev->bus); - - /* wait for a bus device specific file to show up */ - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - int found_bus_type = 0; - - for (devicefile = device_files; devicefile->bus != NULL; devicefile++) { - if (strcmp(devices_dev->bus, devicefile->bus) == 0) { - char filename[PATH_SIZE]; - struct stat stats; - - if (devicefile->file == NULL) { - dbg("bus '%s' has no file to wait for", devices_dev->bus); - return 0; - } - - found_bus_type = 1; - snprintf(filename, sizeof(filename), "%s/%s", devices_dev->path, devicefile->file); - filename[sizeof(filename)-1] = '\0'; - dbg("looking at bus '%s' device for specific file '%s'", devices_dev->bus, filename); - - if (stat(filename, &stats) == 0) { - dbg("bus '%s' device specific file '%s' found", devices_dev->bus, devicefile->file); - return 0; - } - } - } - if (found_bus_type == 0) { - if (error) - *error = "unknown bus"; - info("error: unknown bus, please report to " - " '%s'", devices_dev->bus); - return -1; - } - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - - dbg("error: getting '%s' device specific file '%s'", devices_dev->bus, devicefile->file); - if (error) - *error = "bus device specific file unavailable"; - return -1; -} - - -struct sysfs_class_device *wait_class_device_open(const char *path) -{ - struct sysfs_class_device *class_dev = NULL; - int loop; - - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - class_dev = sysfs_open_class_device_path(path); - if (class_dev) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - - return class_dev; -} - -int wait_for_class_device(struct sysfs_class_device *class_dev, - const char **error) -{ - const struct subsystem_file { - const char *subsystem; - const char *file; - } subsystem_files[] = { - { .subsystem = "net", .file = "ifindex" }, - { .subsystem = "scsi_host", .file = "unique_id" }, - { .subsystem = "pcmcia_socket", .file = "card_type" }, - { .subsystem = "bluetooth", .file = "address" }, - { .subsystem = "firmware", .file = "data" }, - { .subsystem = "fc_transport", .file = "port_id" }, - { .subsystem = "fc_host", .file = "port_id" }, - { .subsystem = "spi_transport", .file = "width" }, - { .subsystem = "spi_host", .file = "width" }, - { NULL, NULL } - }; - - const struct subsystem_file *subsys_file; - struct sysfs_class_device *class_dev_parent; - struct sysfs_device *devices_dev = NULL; - char filename[PATH_SIZE]; - int loop; - - /* look if we want to wait for a file */ - for (subsys_file = subsystem_files; subsys_file->subsystem != NULL; subsys_file++) - if (strcmp(class_dev->classname, subsys_file->subsystem) == 0) - break; - - if (subsys_file->file == NULL) { - dbg("class '%s' has no file to wait for", class_dev->classname); - return 0; - } - - snprintf(filename, sizeof(filename), "%s/%s", class_dev->path, subsys_file->file); - filename[sizeof(filename)-1] = '\0'; - dbg("looking at class '%s' for specific file '%s'", class_dev->classname, filename); - - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - struct stat stats; - - if (stat(class_dev->path, &stats) == -1) { - dbg("'%s' now disappeared (probably remove has beaten us)", class_dev->path); - return -ENODEV; - } - - if (stat(filename, &stats) == 0) { - dbg("class '%s' specific file '%s' found", class_dev->classname, subsys_file->file); - return 0; - } - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - - dbg("error: getting class '%s' specific file '%s'", class_dev->classname, subsys_file->file); - if (error) - *error = "class specific file unavailable"; - return -1; - - /* skip devices without devices-link */ - if (getenv("PHYSDEVPATH") == NULL) { - dbg("the kernel says, that there is no physical device for '%s'", class_dev->path); - return 1; - } - - /* the symlink may be on the parent device */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent) - dbg("looking at parent device for device link '%s'", class_dev_parent->path); - - /* wait for the symlink to the devices device */ - dbg("waiting for symlink to devices device"); - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - if (class_dev_parent) - devices_dev = sysfs_get_classdev_device(class_dev_parent); - else - devices_dev = sysfs_get_classdev_device(class_dev); - - if (devices_dev) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - if (!devices_dev) { - dbg(" error: no devices device symlink found"); - if (error) - *error = "no device symlink"; - return -ENODEV; - } - dbg("device symlink found pointing to '%s'", devices_dev->path); - - return wait_for_devices_device(devices_dev, error); -} - -struct sysfs_device *wait_devices_device_open(const char *path) -{ - struct sysfs_device *devices_dev = NULL; - int loop; - - loop = WAIT_MAX_SECONDS * WAIT_LOOP_PER_SECOND; - while (--loop) { - devices_dev = sysfs_open_device_path(path); - if (devices_dev) - break; - - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - - return devices_dev; -} diff --git a/udev_sysfs.h b/udev_sysfs.h deleted file mode 100644 index 5b87d6bf95..0000000000 --- a/udev_sysfs.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * udev_sysfs.h - * - * Copyright (C) 2004 Kay Sievers - * Copyright (C) 2004 Greg Kroah-Hartman - * - * 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 02139, USA. - * - */ - -#ifndef _UDEV_SYSFS_H_ -#define _UDEV_SYSFS_H_ - -#include "libsysfs/sysfs/libsysfs.h" - -#define WAIT_MAX_SECONDS 3 -#define WAIT_LOOP_PER_SECOND 20 - -extern dev_t get_devt(struct sysfs_class_device *class_dev); - -/* /sys/class, /sys/block devices */ -extern struct sysfs_class_device *wait_class_device_open(const char *path); -extern int wait_for_class_device(struct sysfs_class_device *class_dev, const char **error); - -/* /sys/devices devices */ -extern struct sysfs_device *wait_devices_device_open(const char *path); -extern int wait_for_devices_device(struct sysfs_device *devices_dev, const char **error); - -#endif /* _UDEV_SYSFS_H_ */ diff --git a/udevstart.c b/udevstart.c index 8ee079dbe5..11063f6799 100644 --- a/udevstart.c +++ b/udevstart.c @@ -40,7 +40,6 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev_libc_wrapper.h" -#include "udev_sysfs.h" #include "udev.h" #include "udev_version.h" #include "logging.h" diff --git a/udevtest.c b/udevtest.c index 4890b6837c..1be3fa9515 100644 --- a/udevtest.c +++ b/udevtest.c @@ -28,7 +28,6 @@ #include "libsysfs/sysfs/libsysfs.h" #include "udev.h" -#include "udev_sysfs.h" #include "udev_utils.h" #include "udev_version.h" #include "udev_rules.h" -- cgit v1.2.3-54-g00ecf From 62821d0de11e5af5b0cf066781228489408ef29b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 12 Nov 2005 05:09:34 +0100 Subject: add linux/types.h back, old glibc-kernel-headers want it Signed-off-by: Kay Sievers --- udevd.c | 1 + udevmonitor.c | 1 + 2 files changed, 2 insertions(+) diff --git a/udevd.c b/udevd.c index 333ad4143a..58371ba592 100644 --- a/udevd.c +++ b/udevd.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "list.h" diff --git a/udevmonitor.c b/udevmonitor.c index 805790233f..7d3f0aa538 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "udev.h" -- cgit v1.2.3-54-g00ecf From 88be7e8887e9284666b7844bb0faa84fbb699fb2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 12 Nov 2005 14:28:22 +0100 Subject: volume_id: use glibc's byteswap Signed-off-by: Kay Sievers --- extras/volume_id/libvolume_id/util.h | 35 ++++++++----------------------- extras/volume_id/libvolume_id/volume_id.h | 2 +- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/extras/volume_id/libvolume_id/util.h b/extras/volume_id/libvolume_id/util.h index 6e16491c80..f6c57fb66d 100644 --- a/extras/volume_id/libvolume_id/util.h +++ b/extras/volume_id/libvolume_id/util.h @@ -20,48 +20,31 @@ #endif #include +#include /* size of superblock buffer, reiserfs block is at 64k */ #define SB_BUFFER_SIZE 0x11000 /* size of seek buffer, FAT cluster is 32k max */ #define SEEK_BUFFER_SIZE 0x10000 -/* probe volume for all known filesystems in specific order */ -#define bswap16(x) (uint16_t) ((((uint16_t)(x) & 0x00ffu) << 8) | \ - (((uint16_t)(x) & 0xff00u) >> 8)) - -#define bswap32(x) (uint32_t) ((((uint32_t)(x) & 0xff000000u) >> 24) | \ - (((uint32_t)(x) & 0x00ff0000u) >> 8) | \ - (((uint32_t)(x) & 0x0000ff00u) << 8) | \ - (((uint32_t)(x) & 0x000000ffu) << 24)) - -#define bswap64(x) (uint64_t) ((((uint64_t)(x) & 0xff00000000000000ull) >> 56) | \ - (((uint64_t)(x) & 0x00ff000000000000ull) >> 40) | \ - (((uint64_t)(x) & 0x0000ff0000000000ull) >> 24) | \ - (((uint64_t)(x) & 0x000000ff00000000ull) >> 8) | \ - (((uint64_t)(x) & 0x00000000ff000000ull) << 8) | \ - (((uint64_t)(x) & 0x0000000000ff0000ull) << 24) | \ - (((uint64_t)(x) & 0x000000000000ff00ull) << 40) | \ - (((uint64_t)(x) & 0x00000000000000ffull) << 56)) - #ifdef __BYTE_ORDER #if (__BYTE_ORDER == __LITTLE_ENDIAN) #define le16_to_cpu(x) (x) #define le32_to_cpu(x) (x) #define le64_to_cpu(x) (x) -#define be16_to_cpu(x) bswap16(x) -#define be32_to_cpu(x) bswap32(x) +#define be16_to_cpu(x) bswap_16(x) +#define be32_to_cpu(x) bswap_32(x) #define cpu_to_le16(x) (x) #define cpu_to_le32(x) (x) -#define cpu_to_be32(x) bswap32(x) +#define cpu_to_be32(x) bswap_32(x) #elif (__BYTE_ORDER == __BIG_ENDIAN) -#define le16_to_cpu(x) bswap16(x) -#define le32_to_cpu(x) bswap32(x) -#define le64_to_cpu(x) bswap64(x) +#define le16_to_cpu(x) bswap_16(x) +#define le32_to_cpu(x) bswap_32(x) +#define le64_to_cpu(x) bswap_64(x) #define be16_to_cpu(x) (x) #define be32_to_cpu(x) (x) -#define cpu_to_le16(x) bswap16(x) -#define cpu_to_le32(x) bswap32(x) +#define cpu_to_le16(x) bswap_16(x) +#define cpu_to_le32(x) bswap_32(x) #define cpu_to_be32(x) (x) #endif #endif /* __BYTE_ORDER */ diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index 517d382540..3e3acbde9f 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -14,7 +14,7 @@ #include #include -#define VOLUME_ID_VERSION 53 +#define VOLUME_ID_VERSION 54 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From e825b59b0763ae82d12ef832df33e434aa066875 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Nov 2005 00:13:28 +0100 Subject: udevd: ignore all messages without DEVPATH Signed-off-by: Kay Sievers --- udevd.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/udevd.c b/udevd.c index 58371ba592..3fd3bfe6ad 100644 --- a/udevd.c +++ b/udevd.c @@ -313,16 +313,11 @@ static int running_with_devpath(struct uevent_msg *msg, int limit) struct uevent_msg *loop_msg; int childs_count = 0; - if (msg->devpath == NULL) - return 0; - list_for_each_entry(loop_msg, &running_list, node) { if (limit && childs_count++ > limit) { dbg("%llu, maximum number (%i) of child reached", msg->seqnum, childs_count); return 1; } - if (loop_msg->devpath == NULL) - continue; /* return running parent/child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { @@ -431,6 +426,12 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) msg->envp[i++] = "UDEVD_EVENT=1"; msg->envp[i] = NULL; + if (!msg->devpath) { + info("DEVPATH missing, ingnore message"); + free(msg); + return NULL; + } + return msg; } -- cgit v1.2.3-54-g00ecf From f4fc0136523afdc3ace865312f816c53694a6b87 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Nov 2005 02:06:46 +0100 Subject: udevd: track exit status of event process Signed-off-by: Kay Sievers --- udevd.c | 28 ++++++++++++++++++++-------- udevd.h | 1 + 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/udevd.c b/udevd.c index 3fd3bfe6ad..b7b306131e 100644 --- a/udevd.c +++ b/udevd.c @@ -122,13 +122,15 @@ static int udev_event_process(struct uevent_msg *msg) if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], msg->devpath, msg->action); else - run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + if (run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, + (udev_log_priority >= LOG_INFO))) + retval = -1; } } udev_cleanup_device(&udev); - return 0; + return retval; } static void msg_queue_delete(struct uevent_msg *msg) @@ -140,6 +142,7 @@ static void msg_queue_delete(struct uevent_msg *msg) static void udev_event_run(struct uevent_msg *msg) { pid_t pid; + int retval; pid = fork(); switch (pid) { @@ -155,10 +158,12 @@ static void udev_event_run(struct uevent_msg *msg) logging_init("udevd-event"); setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); - udev_event_process(msg); + retval = udev_event_process(msg); info("seq %llu finished", msg->seqnum); logging_close(); + if (retval) + exit(1); exit(0); case -1: err("fork of child failed: %s", strerror(errno)); @@ -427,7 +432,7 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) msg->envp[i] = NULL; if (!msg->devpath) { - info("DEVPATH missing, ingnore message"); + info("DEVPATH missing, ignore message"); free(msg); return NULL; } @@ -597,14 +602,16 @@ static void asmlinkage sig_handler(int signum) write(signal_pipe[WRITE_END], "", 1); } -static void udev_done(int pid) +static void udev_done(int pid, int exitstatus) { /* find msg associated with pid and delete it */ struct uevent_msg *msg; list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { - info("seq %llu, pid [%d] exit, %ld seconds old", msg->seqnum, msg->pid, time(NULL) - msg->queue_time); + info("seq %llu, pid [%d] exit with %i, %ld seconds old", msg->seqnum, msg->pid, + exitstatus, time(NULL) - msg->queue_time); + msg->exitstatus = exitstatus; msg_queue_delete(msg); /* there may be events waiting with the same devpath */ @@ -617,12 +624,17 @@ static void udev_done(int pid) static void reap_sigchilds(void) { pid_t pid; + int status; while (1) { - pid = waitpid(-1, NULL, WNOHANG); + pid = waitpid(-1, &status, WNOHANG); if (pid <= 0) break; - udev_done(pid); + if (WIFEXITED(status)) + status = WEXITSTATUS(status); + else + status = 0; + udev_done(pid, status); } } diff --git a/udevd.h b/udevd.h index 91c8e6503d..4040942ac9 100644 --- a/udevd.h +++ b/udevd.h @@ -61,6 +61,7 @@ struct uevent_msg { enum udevd_msg_type type; struct list_head node; pid_t pid; + int exitstatus; time_t queue_time; char *action; char *devpath; -- cgit v1.2.3-54-g00ecf From 7a7702509259f811d4f8321e64e28dc72037c88b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Nov 2005 04:12:53 +0100 Subject: udevd: export event queue and event state All pending and running events can be found as symlinks to the actual device in /dev/.udev/queue/ now. This way we can lookup if specific events are still in the queue, before doing actions which require events to have finished. All failed event processes can be found in /dev/.udev/failed/. This makes it possible to retry a failed event process at a later time in the boot process. Signed-off-by: Kay Sievers --- udevd.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/udevd.c b/udevd.c index b7b306131e..93f02c5395 100644 --- a/udevd.c +++ b/udevd.c @@ -133,9 +133,83 @@ static int udev_event_process(struct uevent_msg *msg) return retval; } +enum event_state { + EVENT_QUEUED, + EVENT_FINISHED, + EVENT_FAILED, +}; + +#define PATH_TO_NAME_CHAR '@' +#define EVENT_QUEUE_DIR ".udev/queue" +#define EVENT_FAILED_DIR ".udev/failed" +static void export_event_state(struct uevent_msg *msg, enum event_state state) +{ + char filename[PATH_SIZE]; + char filename_failed[PATH_SIZE]; + char target[PATH_SIZE]; + size_t start, end, i; + struct uevent_msg *loop_msg; + + /* add location of queue files */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + start = strlcat(filename, EVENT_QUEUE_DIR, sizeof(filename)); + end = strlcat(filename, msg->devpath, sizeof(filename)); + if (end > sizeof(filename)) + end = sizeof(filename); + + /* replace '/' to transform path into a filename */ + for (i = start+1; i < end; i++) + if (filename[i] == '/') + filename[i] = PATH_TO_NAME_CHAR; + + /* add location of failed files */ + strlcpy(filename_failed, udev_root, sizeof(filename_failed)); + strlcat(filename_failed, "/", sizeof(filename_failed)); + start = strlcat(filename_failed, EVENT_FAILED_DIR, sizeof(filename_failed)); + end = strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); + if (end > sizeof(filename_failed)) + end = sizeof(filename_failed); + + /* replace '/' to transform path into a filename */ + for (i = start+1; i < end; i++) + if (filename_failed[i] == '/') + filename_failed[i] = PATH_TO_NAME_CHAR; + + switch (state) { + case EVENT_QUEUED: + unlink(filename_failed); + + strlcpy(target, sysfs_path, sizeof(target)); + strlcat(target, msg->devpath, sizeof(target)); + create_path(filename); + symlink(target, filename); + return; + case EVENT_FINISHED: + unlink(filename_failed); + + /* don't remove if events for the same path are still pending */ + list_for_each_entry(loop_msg, &running_list, node) + if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0) + return; + unlink(filename); + case EVENT_FAILED: + create_path(filename_failed); + rename(filename, filename_failed); + return; + } +} + static void msg_queue_delete(struct uevent_msg *msg) { list_del(&msg->node); + + /* mark as failed, if add event returns non-zero */ + if (msg->exitstatus && strcmp(msg->action, "add") == 0) + export_event_state(msg, EVENT_FAILED); + else + export_event_state(msg, EVENT_FINISHED); + free(msg); } @@ -181,6 +255,8 @@ static void msg_queue_insert(struct uevent_msg *msg) { msg->queue_time = time(NULL); + export_event_state(msg, EVENT_QUEUED); + /* run all events with a timeout set immediately */ if (msg->timeout != 0) { list_add_tail(&msg->node, &running_list); -- cgit v1.2.3-54-g00ecf From fc55cf68ca0c0db5172a9de7e827c6c3f7c2a308 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Nov 2005 04:14:15 +0100 Subject: remove "udev_db" option from config file All udev state is kept in /$udev_root/.udev/ now. No option to configure that anymore, it will always be there. Signed-off-by: Kay Sievers --- Makefile | 7 ++----- RELEASE-NOTES | 4 ++++ docs/udev.xml | 8 -------- etc/udev/udev.conf.in | 3 --- test/udev-test.pl | 4 ---- udev.8 | 4 ---- udev.h | 10 +++++++++- udev_add.c | 1 - udev_config.c | 9 --------- udev_db.c | 24 ++++++++++++++++-------- udev_db.h | 33 --------------------------------- udev_remove.c | 1 - udev_rules.c | 1 - udevd.c | 3 --- udevd.h | 3 +++ udevinfo.c | 1 - 16 files changed, 34 insertions(+), 82 deletions(-) delete mode 100644 udev_db.h diff --git a/Makefile b/Makefile index de305cb9bf..4968df4261 100644 --- a/Makefile +++ b/Makefile @@ -60,7 +60,6 @@ HEADERS = \ udev.h \ udev_utils.h \ udev_rules.h \ - udev_db.h \ logging.h \ udev_libc_wrapper.h \ udev_selinux.h \ @@ -117,7 +116,6 @@ usrsbindir = ${exec_prefix}/usr/sbin mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev udevdir = /dev -udevdb = ${udevdir}/.udevdb LOCAL_CFG_DIR = etc/udev DESTDIR = @@ -250,7 +248,6 @@ udev_version.h: @echo "Creating udev_version.h" @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ - @echo \#define UDEV_DB \"$(udevdb)\" >> $@ @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ @@ -347,7 +344,7 @@ install-bin: done; ifndef DESTDIR - killall udevd - - rm -rf $(udevdb) + - rm -rf /dev/.udev - $(sbindir)/udevd --daemon endif .PHONY: install-bin @@ -363,7 +360,7 @@ uninstall-bin: - rm -f $(DESTDIR)$(DESTDIR)$(usrbindir)/udevtest ifndef DESTDIR - killall udevd - - rm -rf $(udevdb) + - rm -rf /dev/.udev endif @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 18e2829bbb..69166cfef1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -7,6 +7,10 @@ the timing of the "bus" link creation, the former integrated logic should be emulated by a rule placed before all other rules: ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +The option "udev_db" does no longer exist. All udev state will always +be in /$udev_root/.udev/ now, there is no longer an option to set this +to anything else. + udev 075 ======== Silent a too verbose error logging for the old hotplug.d/ dev.d/ diff --git a/docs/udev.xml b/docs/udev.xml index c98054f8ce..3db66f8001 100644 --- a/docs/udev.xml +++ b/docs/udev.xml @@ -71,14 +71,6 @@ - - - - The name and location of the udev database. The default value is - /dev/.udevdb. - - - diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index c44ed3092c..90c1f99ba6 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -3,9 +3,6 @@ # Where in the filesystem to place the device nodes udev_root="@udevdir@" -# The name and location of the udev database. -udev_db="@udevdir@/.udevdb" - # The name and location of the udev rules file(s). udev_rules="@configdir@/rules.d" diff --git a/test/udev-test.pl b/test/udev-test.pl index 2549c7ee69..c33c79b1c0 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -24,7 +24,6 @@ my $PWD = $ENV{PWD}; my $sysfs = "sys/"; my $udev_bin = "../udev"; my $udev_root = "udev-root/"; # !!! directory will be removed !!! -my $udev_db = ".udevdb"; my $udev_conf = "udev-test.conf"; my $udev_rules = "udev-test.rules"; @@ -1740,7 +1739,6 @@ sub run_test { print "\n"; if (defined($rules->{option}) && $rules->{option} eq "clean") { - system("rm -rf $udev_db"); system("rm -rf $udev_root"); mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; } @@ -1761,7 +1759,6 @@ mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; # create config file open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; print CONF "udev_root=\"$udev_root\"\n"; -print CONF "udev_db=\"$udev_db\"\n"; print CONF "udev_rules=\"$udev_rules\"\n"; print CONF "udev_log=\"info\"\n"; close CONF; @@ -1791,7 +1788,6 @@ if ($ARGV[0]) { print "$error errors occured\n\n"; # cleanup -system("rm -rf $udev_db"); system("rm -rf $udev_root"); unlink($udev_rules); unlink($udev_conf); diff --git a/udev.8 b/udev.8 index a591a1398e..2ea5812092 100644 --- a/udev.8 +++ b/udev.8 @@ -35,10 +35,6 @@ udev expects its main configuration file at Specifies where to place the device nodes in the filesystem. The default value is \fI/dev\fR. .TP -\fBudev_db\fR -The name and location of the udev database. The default value is -\fI/dev/.udevdb\fR. -.TP \fBudev_rules\fR The name of the udev rules file or directory to look for files with the suffix \fI.rules\fR. Multiple rule files are read in lexical order. The default value is diff --git a/udev.h b/udev.h index e61b692df7..faa12a31ee 100644 --- a/udev.h +++ b/udev.h @@ -28,6 +28,7 @@ #include "list.h" #define COMMENT_CHARACTER '#' +#define PATH_TO_NAME_CHAR '@' #define LINE_SIZE 512 #define NAME_SIZE 128 #define PATH_SIZE 256 @@ -38,6 +39,8 @@ #define DEFAULT_PARTITIONS_COUNT 15 #define UDEV_ALARM_TIMEOUT 180 +#define DB_DIR ".udev/db" + struct udev_rules; enum device_type { @@ -92,9 +95,14 @@ extern void udev_init_config(void); extern int udev_start(void); extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); +extern int udev_db_add_device(struct udevice *dev); +extern int udev_db_delete_device(struct udevice *dev); +extern int udev_db_get_device(struct udevice *udev, const char *devpath); +extern int udev_db_lookup_name(const char *name, char *devpath, size_t len); +extern int udev_db_get_all_entries(struct list_head *name_list); + 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]; extern int udev_log_priority; diff --git a/udev_add.c b/udev_add.c index 1a224a1792..128917e519 100644 --- a/udev_add.c +++ b/udev_add.c @@ -40,7 +40,6 @@ #include "udev_version.h" #include "logging.h" #include "udev_rules.h" -#include "udev_db.h" #include "udev_selinux.h" diff --git a/udev_config.c b/udev_config.c index 192a0b80d2..7037a17081 100644 --- a/udev_config.c +++ b/udev_config.c @@ -38,7 +38,6 @@ /* global variables */ char sysfs_path[PATH_SIZE]; char udev_root[PATH_SIZE]; -char udev_db_path[PATH_SIZE]; char udev_config_filename[PATH_SIZE]; char udev_rules_filename[PATH_SIZE]; int udev_log_priority; @@ -153,12 +152,6 @@ static int parse_config_file(void) continue; } - if (strcasecmp(variable, "udev_db") == 0) { - strlcpy(udev_db_path, value, sizeof(udev_db_path)); - remove_trailing_chars(udev_db_path, '/'); - continue; - } - if (strcasecmp(variable, "udev_rules") == 0) { strlcpy(udev_rules_filename, value, sizeof(udev_rules_filename)); remove_trailing_chars(udev_rules_filename, '/'); @@ -180,7 +173,6 @@ void udev_init_config(void) const char *env; strcpy(udev_root, UDEV_ROOT); - strcpy(udev_db_path, UDEV_DB); strcpy(udev_config_filename, UDEV_CONFIG_FILE); strcpy(udev_rules_filename, UDEV_RULES_FILE); udev_log_priority = LOG_ERR; @@ -207,7 +199,6 @@ void udev_init_config(void) dbg("sysfs_path='%s'", sysfs_path); dbg("UDEV_CONFIG_FILE='%s'", udev_config_filename); dbg("udev_root='%s'", udev_root); - dbg("udev_db='%s'", udev_db_path); dbg("udev_rules='%s'", udev_rules_filename); dbg("udev_log=%d", udev_log_priority); } diff --git a/udev_db.c b/udev_db.c index 5caf3fda80..e2b7b4d921 100644 --- a/udev_db.c +++ b/udev_db.c @@ -35,16 +35,16 @@ #include "udev.h" #include "udev_utils.h" #include "logging.h" -#include "udev_db.h" -#define PATH_TO_NAME_CHAR '@' static int devpath_to_db_path(const char *devpath, char *filename, size_t len) { size_t start, end, i; /* add location of db files */ - start = strlcpy(filename, udev_db_path, len); + strlcpy(filename, udev_root, len); + strlcat(filename, "/", len); + start = strlcat(filename, DB_DIR, len); end = strlcat(filename, devpath, len); if (end > len) end = len; @@ -205,12 +205,16 @@ int udev_db_delete_device(struct udevice *udev) int udev_db_lookup_name(const char *name, char *devpath, size_t len) { + char dbpath[PATH_MAX]; DIR *dir; int found = 0; - dir = opendir(udev_db_path); + strlcpy(dbpath, udev_root, sizeof(dbpath)); + strlcat(dbpath, "/", sizeof(dbpath)); + strlcat(dbpath, DB_DIR, sizeof(dbpath)); + dir = opendir(dbpath); if (dir == NULL) { - err("unable to open udev_db '%s': %s", udev_db_path, strerror(errno)); + err("unable to open udev_db '%s': %s", dbpath, strerror(errno)); return -1; } @@ -230,7 +234,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) if (ent->d_name[0] == '.') continue; - snprintf(filename, sizeof(filename), "%s/%s", udev_db_path, ent->d_name); + snprintf(filename, sizeof(filename), "%s/%s", dbpath, ent->d_name); filename[sizeof(filename)-1] = '\0'; dbg("looking at '%s'", filename); @@ -274,11 +278,15 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) int udev_db_get_all_entries(struct list_head *name_list) { + char dbpath[PATH_MAX]; DIR *dir; - dir = opendir(udev_db_path); + strlcpy(dbpath, udev_root, sizeof(dbpath)); + strlcat(dbpath, "/", sizeof(dbpath)); + strlcat(dbpath, DB_DIR, sizeof(dbpath)); + dir = opendir(dbpath); if (dir == NULL) { - err("unable to open udev_db '%s': %s", udev_db_path, strerror(errno)); + err("unable to open udev_db '%s': %s", dbpath, strerror(errno)); return -1; } diff --git a/udev_db.h b/udev_db.h deleted file mode 100644 index 89513932b3..0000000000 --- a/udev_db.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * udev_db.h - * - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004-2005 Kay Sievers - * - * 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 02139, USA. - * - */ - -#ifndef _UDEV_DB_H_ -#define _UDEV_DB_H_ - - -extern int udev_db_add_device(struct udevice *dev); -extern int udev_db_delete_device(struct udevice *dev); - -extern int udev_db_get_device(struct udevice *udev, const char *devpath); -extern int udev_db_lookup_name(const char *name, char *devpath, size_t len); -extern int udev_db_get_all_entries(struct list_head *name_list); - -#endif /* _UDEV_DB_H_ */ diff --git a/udev_remove.c b/udev_remove.c index 4d1b9286a0..8351860472 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -32,7 +32,6 @@ #include "udev.h" #include "udev_utils.h" #include "udev_version.h" -#include "udev_db.h" #include "logging.h" static int delete_path(const char *path) diff --git a/udev_rules.c b/udev_rules.c index a3100f8e14..492a9b0dfc 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -39,7 +39,6 @@ #include "udev_version.h" #include "logging.h" #include "udev_rules.h" -#include "udev_db.h" /* extract possible {attr} and move str behind it */ diff --git a/udevd.c b/udevd.c index 93f02c5395..e1afb7622b 100644 --- a/udevd.c +++ b/udevd.c @@ -139,9 +139,6 @@ enum event_state { EVENT_FAILED, }; -#define PATH_TO_NAME_CHAR '@' -#define EVENT_QUEUE_DIR ".udev/queue" -#define EVENT_FAILED_DIR ".udev/failed" static void export_event_state(struct uevent_msg *msg, enum event_state state) { char filename[PATH_SIZE]; diff --git a/udevd.h b/udevd.h index 4040942ac9..afbc3a31b1 100644 --- a/udevd.h +++ b/udevd.h @@ -29,6 +29,9 @@ #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 +#define EVENT_QUEUE_DIR ".udev/queue" +#define EVENT_FAILED_DIR ".udev/failed" + /* maximum limit of runnig childs */ #define UDEVD_MAX_CHILDS 64 /* start to throttle forking if maximum number of running childs in our session is reached */ diff --git a/udevinfo.c b/udevinfo.c index b668655f29..8ff09da3d1 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -31,7 +31,6 @@ #include "udev.h" #include "udev_utils.h" #include "udev_version.h" -#include "udev_db.h" #include "logging.h" -- cgit v1.2.3-54-g00ecf From d7363ee14c3ea46611d3e706a3e198e07869afc3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Nov 2005 04:35:37 +0100 Subject: Makefile: remove exec_prefix and srcdir Signed-off-by: Kay Sievers --- Makefile | 9 ++++----- extras/ata_id/Makefile | 9 ++++----- extras/cdrom_id/Makefile | 9 ++++----- extras/dasd_id/Makefile | 9 ++++----- extras/edd_id/Makefile | 9 ++++----- extras/firmware/Makefile | 9 ++++----- extras/floppy/Makefile | 9 ++++----- extras/run_directory/Makefile | 9 ++++----- extras/scsi_id/Makefile | 9 ++++----- extras/usb_id/Makefile | 9 ++++----- extras/volume_id/Makefile | 9 ++++----- 11 files changed, 44 insertions(+), 55 deletions(-) diff --git a/Makefile b/Makefile index 4968df4261..6cc51eea0a 100644 --- a/Makefile +++ b/Makefile @@ -108,11 +108,11 @@ GEN_HEADERS = \ # override this to make udev look in a different location for it's config files prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev udevdir = /dev @@ -248,7 +248,6 @@ udev_version.h: @echo "Creating udev_version.h" @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ - @echo \#define UDEV_CONFIG_DIR \"$(configdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ @echo \#define UDEVD_BIN \"$(sbindir)/udevd\" >> $@ diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index 4080df1b42..ebf0f4e9b4 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -12,14 +12,13 @@ GEN_HEADERS = MAN_PAGES = prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index f1120673e1..985eb805a5 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -12,14 +12,13 @@ GEN_HEADERS = MAN_PAGES = prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index a995c7892d..80680f22fe 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -12,14 +12,13 @@ GEN_HEADERS = MAN_PAGES = prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 469d6d4d03..5a6cdb65c3 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -12,14 +12,13 @@ GEN_HEADERS = MAN_PAGES = prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index 48dacb4764..78a7935d66 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -12,14 +12,13 @@ GEN_HEADERS = MAN_PAGES = prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 344f48828d..d894a4a3e1 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -12,14 +12,13 @@ GEN_HEADERS = MAN_PAGES = prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 1b48719c61..7d5bccbcca 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -11,14 +11,13 @@ GEN_HEADERS = MAN_PAGES = prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index fadd4a1dd4..399de76911 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -15,14 +15,13 @@ GEN_HEADERS = scsi_id_version.h MAN_PAGES = scsi_id.8 prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 9f82fd5b2c..f6d26e1c4c 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -12,14 +12,13 @@ GEN_HEADERS = MAN_PAGES = prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 30c0abb9a4..6201044941 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -11,14 +11,13 @@ GEN_HEADERS = MAN_PAGES = prefix = -exec_prefix = ${prefix} etcdir = ${prefix}/etc -sbindir = ${exec_prefix}/sbin -usrbindir = ${exec_prefix}/usr/bin -usrsbindir = ${exec_prefix}/usr/sbin +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -srcdir = . INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} -- cgit v1.2.3-54-g00ecf From c249f66a70f9ea623205f27f7931727acbafba9e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Nov 2005 05:22:31 +0100 Subject: update README and RELEASE-NOTES Signed-off-by: Kay Sievers --- README | 89 +++++++++++++++++++++++++++++++++------------------ RELEASE-NOTES | 7 ++++ etc/udev/udev.conf.in | 6 ++-- 3 files changed, 68 insertions(+), 34 deletions(-) diff --git a/README b/README index 3f4f947f79..fee078898c 100644 --- a/README +++ b/README @@ -4,65 +4,92 @@ For more information see the files in the docs/ directory. Important Note: Integrating udev in the system is a whole lot of work, has complex dependencies - and differs a lot from distro to distro. All reasonable distros use udev these - days, the major ones make it mandatory and the system will not work without it. + and differs a lot from distro to distro. All reasonable distros depend on udev + these days and the system will not work without it. The upstream udev project does not support or recomend to replace a distro's udev installation with the upstream version. The installation of a unmodified upstream version may render your system unusable! There is no "default" setup or a set of "default" rules provided by the upstream udev version. -udev requires: - - 2.6 version of the Linux kernel +Requirements: + - 2.6 version of the Linux kernel. - - the kernel must have sysfs, netlink, and hotplug enabled + - The kernel must have sysfs, netlink, and hotplug enabled. - - proc must be mounted on /proc + - The proc filesystem must be mounted on /proc. - - sysfs must be mounted at /sys, no other location is supported + - The sysfs filesystem must be mounted at /sys. No other location + is supported. - - udev creates and removes device nodes in /dev based on events + +Operation: + - Udev creates and removes device nodes in /dev based on events the kernel sends out on device discovery or removal - - during bootup /dev usually gets a tmpfs mounted which is populated scratch - by udev (created nodes don't survive a reboot, it always starts from scratch) + - Directly after mounting the root filesystem, the udevd daemon must be + started by an init script. + + - From kernel version 2.6.15 on, the hotplug helper /sbin/hotplug should + be disabled with an init script before kernel modules are loaded. + + - During bootup, /dev usually gets a tmpfs filesystem mounted which is + populated from scratch by udev (created nodes don't survive a reboot, + the /lib/udev/devices directory should be used for "static nodes"). - - udev replaces the hotplug event management invoked from /sbin/hotplug - by the udevd daemon, which receives the kernel events over netlink + - Udev replaces the hotplug event management invoked from /sbin/hotplug + by the udevd daemon, which receives the kernel events over netlink. - - all kernel events are matched against a set of specified rules which - make it posible to hook into the event processing + - All kernel events are matched against a set of specified rules which + make it possible to hook into the event processing. - - there is a copy of the rules files for all major distros in the etc/udev - directory (you may look there how others distros are doing it) + - Copies of the rules files for all major distros are in the etc/udev + directory (you may look there how others distros are doing it). -Setting which are used for building udev: +Compile Options: prefix - set this to the default root that you want to use - Only override this if you really know what you are doing + Set this to the default root that you want to use only override + this if you really know what you are doing even then, you probably + don't do the right thing. DESTDIR - prefix for install target for package building + Prefix for install target, used for package building. USE_LOG - if set to 'true', udev will emit messages to the syslog when - it creates or removes device nodes. This is helpful to see - what udev is doing. This is enabled by default. + if set to 'true', udev is able to pass errors or debug information + to syslog. This is very useful to see what udev is doing or not doing, + it is enabled by default. DEBUG - if set to 'true', verbose debugging messages will be compiled into - the udev binaries. Default value is 'false'. + If set to 'true', very verbose debugging messages will be compiled + into the udev binaries. The actual level of debugging is specified + in the udev config file. + STRIPCMD + If udev is compiled for packaging an empty string can be passed + to disable the stripping of the binaries. USE_SELINUX - if set to 'true', udev will be built with SELinux support + If set to 'true', udev will be built with SELinux support enabled. This is disabled by default. USE_KLIBC - if set to 'true', udev is built and linked against klibc. + If set to 'true', udev is built and linked against klibc. Default value is 'false'. KLCC specifies the klibc compiler - wrapper, usually in /usr/bin/klcc + wrapper, usually located at /usr/bin/klcc. EXTRAS - if set, will build the "extra" helper programs as specified - as listed (see below for an example.) + If set, will build the "extra" helper programs as specified + as listed (see below for an example). -if you want to build the udev helper program cdrom_id and scsi_id: +If you want to build the udev helper program cdrom_id and scsi_id: make EXTRAS="extras/cdrom_id extras/scsi_id" +Installation: + - The install target intall the udev binaries in the default locations, + all at boot time reqired binaries will be installed in /sbin. + + - The default location for scripts and binaries that are called from + rules is /lib/udev. + + - It is recommended to use the /lib/udev/devices directory to place + device nodes and symlinks in, which are copied to /dev at every boot. + That way, nodes for broken subsystems or devices which can't be + detected automatically by the kernel will always be available. + Please direct any comment/question/concern to the linux-hotplug-devel mailing list at: linux-hotplug-devel@lists.sourceforge.net diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 69166cfef1..0d7951f75b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -11,6 +11,13 @@ The option "udev_db" does no longer exist. All udev state will always be in /$udev_root/.udev/ now, there is no longer an option to set this to anything else. +Default location for rule sripts and helper programs is now: /lib/udev/. +Everything that is not useful on the commandline should go into this +directory. Also /lib/udev/devices/ is recommended as a directory where +packages or the user can place real device nodes, which get copied over +to /dev at every boot. This should replace the various solutions with +custom config files. + udev 075 ======== Silent a too verbose error logging for the old hotplug.d/ dev.d/ diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index 90c1f99ba6..a92f688c3a 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -1,13 +1,13 @@ # udev.conf -# Where in the filesystem to place the device nodes +# Where in the filesystem to place the device nodes. udev_root="@udevdir@" # The name and location of the udev rules file(s). udev_rules="@configdir@/rules.d" # The initial syslog(3) priority: "err", "info", "debug" or its -# numerical equivalent. For runtime debugging, change the daemons -# internal state with: "udevcontrol log_priority=". +# numerical equivalent. For runtime debugging, the daemons internal +# state can be changed with: "udevcontrol log_priority=". udev_log="err" -- cgit v1.2.3-54-g00ecf From 82de5983ab395df7f59ed53a51517a6066be3a57 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 Nov 2005 16:34:37 +0100 Subject: udevd: track killed event processes as failed Thanks to Marco for catching this. Signed-off-by: Kay Sievers --- udevd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udevd.c b/udevd.c index e1afb7622b..7978bdb08a 100644 --- a/udevd.c +++ b/udevd.c @@ -705,6 +705,8 @@ static void reap_sigchilds(void) break; if (WIFEXITED(status)) status = WEXITSTATUS(status); + else if (WIFSIGNALED(status)) + status = WTERMSIG(status) + 128; else status = 0; udev_done(pid, status); -- cgit v1.2.3-54-g00ecf From dfc9761d8846a5f6f437fb599bc6817d14efbec2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 Nov 2005 18:05:29 +0100 Subject: update README Signed-off-by: Kay Sievers --- README | 75 ++++++++++++++++++++++++++++++++++++++++-------------------------- TODO | 3 --- 2 files changed, 46 insertions(+), 32 deletions(-) diff --git a/README b/README index fee078898c..fe56095686 100644 --- a/README +++ b/README @@ -13,50 +13,58 @@ Important Note: of "default" rules provided by the upstream udev version. Requirements: - - 2.6 version of the Linux kernel. + - 2.6.x version of the Linux kernel. See the RELEASE-NOTES file in the + udev tree and the Documentation/Changes in the kernel source tree for + the actual dependency. - - The kernel must have sysfs, netlink, and hotplug enabled. + - The kernel must have sysfs and unix domain socket enabled. + (unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, + but it is completely silly, don't complain if anything goes wrong.) - The proc filesystem must be mounted on /proc. - The sysfs filesystem must be mounted at /sys. No other location - is supported. + will be supported by udev. Operation: - - Udev creates and removes device nodes in /dev based on events - the kernel sends out on device discovery or removal + Udev creates and removes device nodes in /dev, based on events the kernel + sends out on device discovery or removal. - - Directly after mounting the root filesystem, the udevd daemon must be - started by an init script. + - Directly after mouting the real root filesystem, wherever that + happens, in initramfs or with a directly mounted root, /dev should get + a tmpfs filesystem mounted, which is populated from scratch by udev. + Created nodes or changed permissions don't survive a reboot. - - From kernel version 2.6.15 on, the hotplug helper /sbin/hotplug should - be disabled with an init script before kernel modules are loaded. + - The content of /lib/udev/devices directory should be copied over to the + tmpfs mounted /dev, to provide the required nodes to initialize udev. - - During bootup, /dev usually gets a tmpfs filesystem mounted which is - populated from scratch by udev (created nodes don't survive a reboot, - the /lib/udev/devices directory should be used for "static nodes"). + - The udevd daemon must be started to receive netlink events from the kernel + driver core. - - Udev replaces the hotplug event management invoked from /sbin/hotplug - by the udevd daemon, which receives the kernel events over netlink. + - From kernel version 2.6.15 on, the hotplug helper /sbin/hotplug should + be disabled with an init script before the boot scripts are run and + kernel modules are loaded. - - All kernel events are matched against a set of specified rules which - make it possible to hook into the event processing. + - All kernel events are matched against a set of specified rules in + /etc/udev/rules.d/ which make it possible to hook into the event + processing to load required kernel modules and setup devices. For all + devices the kernel requests a device node, udev will create one with + the default name or the one specified by a matching udev rules. - - Copies of the rules files for all major distros are in the etc/udev - directory (you may look there how others distros are doing it). Compile Options: prefix - Set this to the default root that you want to use only override - this if you really know what you are doing even then, you probably + Set this to the default root that you want to use. Only override + this if you really know what you are doing, even then, you probably don't do the right thing. DESTDIR Prefix for install target, used for package building. USE_LOG - if set to 'true', udev is able to pass errors or debug information - to syslog. This is very useful to see what udev is doing or not doing, - it is enabled by default. + If set to 'true', udev is able to pass errors or debug information + to syslog. This is very useful to see what udev is doing or not doing. + It is enabled by default, don't expect any useful answer, if you + need to hunt a bug, but you can't enable syslog. DEBUG If set to 'true', very verbose debugging messages will be compiled into the udev binaries. The actual level of debugging is specified @@ -75,20 +83,29 @@ Compile Options: If set, will build the "extra" helper programs as specified as listed (see below for an example). -If you want to build the udev helper program cdrom_id and scsi_id: - make EXTRAS="extras/cdrom_id extras/scsi_id" +If you want to build the udev helper programs: + make EXTRAS="extras/cdrom_id extras/scsi_id extras/volume_id" + Installation: - - The install target intall the udev binaries in the default locations, - all at boot time reqired binaries will be installed in /sbin. + - The install target intalls the udev binaries in the default locations, + All at boot time reqired binaries will be installed in /sbin. - The default location for scripts and binaries that are called from - rules is /lib/udev. + rules is /lib/udev. Other packages who install udev rules, should use + that diretory too. - It is recommended to use the /lib/udev/devices directory to place device nodes and symlinks in, which are copied to /dev at every boot. That way, nodes for broken subsystems or devices which can't be - detected automatically by the kernel will always be available. + detected automatically by the kernel, will always be available. + + - Copies of the rules files for all major distros are in the etc/udev + directory (you may look there how others distros are doing it). + + - The persistent disk links in /dev/disk are the de facto standard + on Linux and should be installed with every default udev installation. + The devfs naming scheme rules are not recommended and not supported. Please direct any comment/question/concern to the linux-hotplug-devel mailing list at: linux-hotplug-devel@lists.sourceforge.net diff --git a/TODO b/TODO index 41ea98ff02..7e123d8b14 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,6 @@ This is a list of things that needs to be done. They are in no specific order. We will gladly accept patches for any of these items: -- Completely replace the built-in wait_for_sysfs stuff in udev_sysfs.c - by rules using the WAIT_FOR_SYSFS key. - - Log the relationship of the kernel name and the persistent disk name to syslog, so any error logged from the kernel can be associated with any of the links at that time. -- cgit v1.2.3-54-g00ecf From 4389ec08fb177f62fc02eb2217fed126aef3a7a3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 Nov 2005 18:50:47 +0100 Subject: don't start udevd from udevsend Doesn't make any sense these days to let the kernel start the daemon. Signed-off-by: Kay Sievers --- Makefile | 1 - RELEASE-NOTES | 4 +++ udevsend.c | 81 ++++++----------------------------------------------------- 3 files changed, 12 insertions(+), 74 deletions(-) diff --git a/Makefile b/Makefile index 6cc51eea0a..718cf4347d 100644 --- a/Makefile +++ b/Makefile @@ -250,7 +250,6 @@ udev_version.h: @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ - @echo \#define UDEVD_BIN \"$(sbindir)/udevd\" >> $@ # man pages %.8: docs/%.xml diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0d7951f75b..cbec3d31ab 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -18,6 +18,10 @@ packages or the user can place real device nodes, which get copied over to /dev at every boot. This should replace the various solutions with custom config files. +Udevsend does no longer start the udev daemon. This must be done with +the init script that prepares /dev on tmpfs and creates the initial nodes, +before starting the daemon. + udev 075 ======== Silent a too verbose error logging for the old hotplug.d/ dev.d/ diff --git a/udevsend.c b/udevsend.c index d0cfc2af53..8cabe9039b 100644 --- a/udevsend.c +++ b/udevsend.c @@ -54,52 +54,15 @@ void log_message (int priority, const char *format, ...) } #endif -static int start_daemon(void) -{ - pid_t pid; - pid_t child_pid; - char *const argv[] = { "udevd", NULL }; - char *const envp[] = { NULL }; - - pid = fork(); - switch (pid) { - case 0: - /* helper child */ - child_pid = fork(); - switch (child_pid) { - case 0: - /* daemon with empty environment */ - close(sock); - execve(UDEVD_BIN, argv, envp); - err("exec of daemon failed: %s", strerror(errno)); - _exit(1); - case -1: - err("fork of daemon failed: %s", strerror(errno)); - return -1; - default: - exit(0); - } - break; - case -1: - err("fork of helper failed: %s", strerror(errno)); - return -1; - default: - waitpid(pid, NULL, 0); - } - return 0; -} - int main(int argc, char *argv[], char *envp[]) { static struct udevd_msg usend_msg; int usend_msg_len; int i; - int loop; struct sockaddr_un saddr; socklen_t addrlen; int bufpos = 0; - int retval = 1; - int started_daemon = 0; + int retval = 0; const char *subsystem = NULL; logging_init("udevsend"); @@ -109,8 +72,9 @@ int main(int argc, char *argv[], char *envp[]) dbg("version %s", UDEV_VERSION); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (sock == -1) { + if (sock < 0) { err("error getting socket: %s", strerror(errno)); + retval = 1; goto exit; } @@ -134,7 +98,8 @@ int main(int argc, char *argv[], char *envp[]) /* prevent loops in the scripts we execute */ if (strncmp(key, "UDEVD_EVENT=", 12) == 0) { - dbg("seems that the event source is not the kernel, just exit"); + err("event loop, already passed through the daemon, exit"); + retval = 2; goto exit; } @@ -151,42 +116,13 @@ int main(int argc, char *argv[], char *envp[]) strcpy(&usend_msg.envbuf[bufpos], key); bufpos += keylen + 1; } - /* older kernels passed the SUBSYSTEM only as the first argument */ - if (!subsystem && argc == 2) { - bufpos += sprintf(&usend_msg.envbuf[bufpos], "SUBSYSTEM=%s", argv[1]) + 1; - dbg("add 'SUBSYSTEM=%s' to env[%i] buffer from argv", argv[1], i); - } usend_msg_len = offsetof(struct udevd_msg, envbuf) + bufpos; dbg("usend_msg_len=%i", usend_msg_len); - /* If we can't send, try to start daemon and resend message */ - loop = UDEVSEND_WAIT_MAX_SECONDS * UDEVSEND_WAIT_LOOP_PER_SECOND; - while (--loop) { - retval = sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen); - if (retval != -1) { - retval = 0; - goto exit; - } - - if (errno != ECONNREFUSED) { - err("error sending message: %s", strerror(errno)); - goto exit; - } - - if (!started_daemon) { - info("try to start udevd daemon"); - retval = start_daemon(); - if (retval) { - dbg("error starting daemon"); - goto exit; - } - dbg("udevd daemon started"); - started_daemon = 1; - } else { - dbg("retry to connect %d", UDEVSEND_WAIT_MAX_SECONDS * UDEVSEND_WAIT_LOOP_PER_SECOND - loop); - usleep(1000 * 1000 / UDEVSEND_WAIT_LOOP_PER_SECOND); - } + if (sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen) < 0) { + retval = 3; + err("error sending message: %s", strerror(errno)); } exit: @@ -194,6 +130,5 @@ exit: close(sock); logging_close(); - return retval; } -- cgit v1.2.3-54-g00ecf From 8813e55c74d8224a361f62fc8c9f01591dfb58d3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 Nov 2005 18:53:53 +0100 Subject: udevd: add a missing return Signed-off-by: Kay Sievers --- udevd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevd.c b/udevd.c index 7978bdb08a..446db8fd33 100644 --- a/udevd.c +++ b/udevd.c @@ -190,6 +190,7 @@ static void export_event_state(struct uevent_msg *msg, enum event_state state) if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0) return; unlink(filename); + return; case EVENT_FAILED: create_path(filename_failed); rename(filename, filename_failed); -- cgit v1.2.3-54-g00ecf From cfd0fc66054cb7eab4989d214e4f8552dc2bf0b8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Nov 2005 18:28:56 +0100 Subject: libvolume_id: fix weird fat volume recognition Signed-off-by: Kay Sievers --- extras/volume_id/libvolume_id/fat.c | 31 ++++++++++++++----------------- extras/volume_id/libvolume_id/volume_id.h | 2 +- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/extras/volume_id/libvolume_id/fat.c b/extras/volume_id/libvolume_id/fat.c index 26d0fe74ab..cea5b8cff2 100644 --- a/extras/volume_id/libvolume_id/fat.c +++ b/extras/volume_id/libvolume_id/fat.c @@ -161,48 +161,45 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off) return -1; if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) - goto valid; + goto magic; if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) - goto valid; + goto magic; if (memcmp(vs->type.fat.magic, "FAT16 ", 8) == 0) - goto valid; + goto magic; if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0) - goto valid; + goto magic; if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) - goto valid; + goto magic; - /* - * There are old floppies out there without a magic, so we check - * for well known values and guess if it's a fat volume - */ + /* some old floppies don't have a magic, so we expect the boot code to match */ /* boot jump address check */ if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && vs->boot_jump[0] != 0xe9) return -1; - /* heads check */ - if (vs->heads == 0) +magic: + /* reserverd sector count */ + if (!vs->reserved) return -1; - /* cluster size check*/ - if (vs->sectors_per_cluster == 0 || - (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) + /* fat count*/ + if (!vs->fats) return -1; /* media check */ if (vs->media < 0xf8 && vs->media != 0xf0) return -1; - /* fat count*/ - if (vs->fats != 2) + /* cluster size check*/ + if (vs->sectors_per_cluster == 0 || + (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) return -1; -valid: /* sector size check */ sector_size = le16_to_cpu(vs->sector_size); if (sector_size != 0x200 && sector_size != 0x400 && diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index 3e3acbde9f..ad65fe5438 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -14,7 +14,7 @@ #include #include -#define VOLUME_ID_VERSION 54 +#define VOLUME_ID_VERSION 55 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 -- cgit v1.2.3-54-g00ecf From 0da0efb2b622435209d183b49e2d16d426142b2c Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Tue, 22 Nov 2005 15:44:02 +0100 Subject: move delete_path() to utils --- udev_remove.c | 29 ----------------------------- udev_utils.h | 1 + udev_utils_file.c | 31 +++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 29 deletions(-) diff --git a/udev_remove.c b/udev_remove.c index 8351860472..6efa17eb7c 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -34,35 +34,6 @@ #include "udev_version.h" #include "logging.h" -static int delete_path(const char *path) -{ - char *pos; - int retval; - - pos = strrchr(path, '/'); - while (1) { - *pos = '\0'; - pos = strrchr(path, '/'); - - /* don't remove the last one */ - if ((pos == path) || (pos == NULL)) - break; - - /* remove if empty */ - retval = rmdir(path); - if (errno == ENOENT) - retval = 0; - if (retval) { - if (errno == ENOTEMPTY) - return 0; - err("rmdir(%s) failed: %s", path, strerror(errno)); - break; - } - dbg("removed '%s'", path); - } - return 0; -} - static int delete_node(struct udevice *udev) { char filename[PATH_SIZE]; diff --git a/udev_utils.h b/udev_utils.h index ffdaf0469f..a28ba005ca 100644 --- a/udev_utils.h +++ b/udev_utils.h @@ -51,6 +51,7 @@ extern int replace_untrusted_chars(char *str); /* udev_utils_file.c */ extern int create_path(const char *path); +extern int delete_path(const char *path); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(void *buf, size_t bufsize); extern int unlink_secure(const char *filename); diff --git a/udev_utils_file.c b/udev_utils_file.c index a3dab58b36..cd9c244f0f 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -63,6 +63,37 @@ int create_path(const char *path) return mkdir(p, 0755); } +int delete_path(const char *path) +{ + char p[PATH_SIZE]; + char *pos; + int retval; + + strcpy (p, path); + pos = strrchr(p, '/'); + while (1) { + *pos = '\0'; + pos = strrchr(p, '/'); + + /* don't remove the last one */ + if ((pos == p) || (pos == NULL)) + break; + + /* remove if empty */ + retval = rmdir(p); + if (errno == ENOENT) + retval = 0; + if (retval) { + if (errno == ENOTEMPTY) + return 0; + err("rmdir(%s) failed: %s", p, strerror(errno)); + break; + } + dbg("removed '%s'", p); + } + return 0; +} + /* Reset permissions on the device node, before unlinking it to make sure, * that permisions of possible hard links will be removed too. */ -- cgit v1.2.3-54-g00ecf From 1b75f1096e8fdf2ec5ab4ec112f20b69fbd084c3 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Tue, 22 Nov 2005 15:49:49 +0100 Subject: clean-up empty queue directories This allows scripts to do: while test -d /dev/.udev/queue; do sleep 0.1; done And don't create a failed symlink if there is another event for the same devpath in the queue. --- udevd.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/udevd.c b/udevd.c index 446db8fd33..25ef857a8c 100644 --- a/udevd.c +++ b/udevd.c @@ -176,6 +176,7 @@ static void export_event_state(struct uevent_msg *msg, enum event_state state) switch (state) { case EVENT_QUEUED: unlink(filename_failed); + delete_path(filename_failed); strlcpy(target, sysfs_path, sizeof(target)); strlcat(target, msg->devpath, sizeof(target)); @@ -183,17 +184,26 @@ static void export_event_state(struct uevent_msg *msg, enum event_state state) symlink(target, filename); return; case EVENT_FINISHED: + case EVENT_FAILED: unlink(filename_failed); + delete_path(filename_failed); - /* don't remove if events for the same path are still pending */ + /* don't remove, if events for the same path are still pending */ list_for_each_entry(loop_msg, &running_list, node) if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0) return; - unlink(filename); - return; - case EVENT_FAILED: - create_path(filename_failed); - rename(filename, filename_failed); + + /* move failed events to the failed directory */ + if (state == EVENT_FAILED) { + create_path(filename_failed); + rename(filename, filename_failed); + } else { + unlink(filename); + } + + /* clean up the queue directory */ + delete_path(filename); + return; } } -- cgit v1.2.3-54-g00ecf From c699bc48e1432bc1b283907a52e461b97f2e45b1 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Tue, 22 Nov 2005 16:33:25 +0100 Subject: Makefile: fail, if submake fails --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 718cf4347d..54bfb31cd3 100644 --- a/Makefile +++ b/Makefile @@ -208,7 +208,7 @@ all: $(PROGRAMS) $(MAN_PAGES) LIBUDEV="$(PWD)/$(LIBUDEV)" \ LIBSYSFS="$(PWD)/$(LIBSYSFS)" \ QUIET="$(QUIET)" \ - -C $$target $@; \ + -C $$target $@ || exit 1; \ done; .PHONY: all .DEFAULT: all @@ -270,7 +270,7 @@ clean: - rm -f udev-$(VERSION).tar.gz @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) -C $$target $@; \ + $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: clean @@ -292,7 +292,7 @@ install-config: $(GEN_CONFIGS) fi @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) -C $$target $@; \ + $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: install-config @@ -307,7 +307,7 @@ install-man: - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) -C $$target $@; \ + $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: install-man @@ -322,7 +322,7 @@ uninstall-man: - rm -f $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) -C $$target $@; \ + $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: uninstall-man @@ -338,7 +338,7 @@ install-bin: $(INSTALL_PROGRAM) -D udevstart $(DESTDIR)$(sbindir)/udevstart @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) -C $$target $@; \ + $(MAKE) -C $$target $@ || exit 1; \ done; ifndef DESTDIR - killall udevd @@ -362,7 +362,7 @@ ifndef DESTDIR endif @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ - $(MAKE) -C $$target $@; \ + $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: uninstall-bin -- cgit v1.2.3-54-g00ecf From e0dc4f00baaa4ad328aa13362fcf25e7ec2ae2f6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 22 Nov 2005 17:31:38 +0100 Subject: move some helpers from extras to /lib/udev Signed-off-by: Kay Sievers --- RELEASE-NOTES | 18 ++++++++++++------ extras/firmware/Makefile | 4 ++-- extras/floppy/Makefile | 4 ++-- extras/run_directory/Makefile | 8 ++++---- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cbec3d31ab..86a7fa8bde 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -7,16 +7,22 @@ the timing of the "bus" link creation, the former integrated logic should be emulated by a rule placed before all other rules: ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -The option "udev_db" does no longer exist. All udev state will always -be in /$udev_root/.udev/ now, there is no longer an option to set this +The option "udev_db" does no longer exist. All udev state will be in +/$udev_root/.udev/ now, there is no longer an option to set this to anything else. +If the init script or something else used this value, just depend on +this hardcoded path. But remember _all_content_ of this directory is +still private to udev and can change at any time. Default location for rule sripts and helper programs is now: /lib/udev/. Everything that is not useful on the commandline should go into this -directory. Also /lib/udev/devices/ is recommended as a directory where -packages or the user can place real device nodes, which get copied over -to /dev at every boot. This should replace the various solutions with -custom config files. +directory. Some of the helpers in the extras folder are installed there +now. The rules need to be changed, to find the helpers there. + +Also /lib/udev/devices is recommended as a directory where packages or +the user can place real device nodes, which get copied over to /dev at +every boot. This should replace the various solutions with custom config +files. Udevsend does no longer start the udev daemon. This must be done with the init script that prepares /dev on tmpfs and creates the initial nodes, diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index 78a7935d66..16918867fc 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -48,11 +48,11 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(PROG) + - rm $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: uninstall-bin install-man: diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index d894a4a3e1..240af4ce05 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -48,11 +48,11 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(PROG) + - rm $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: uninstall-bin install-man: diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 7d5bccbcca..d138f62c03 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -47,13 +47,13 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) udev_run_devd $(DESTDIR)$(sbindir)/udev_run_devd - $(INSTALL_PROGRAM) udev_run_hotplugd $(DESTDIR)$(sbindir)/udev_run_hotplugd + $(INSTALL_PROGRAM) -D udev_run_devd $(DESTDIR)$(libudevdir)/udev_run_devd + $(INSTALL_PROGRAM) -D udev_run_hotplugd $(DESTDIR)$(libudevdir)/udev_run_hotplugd .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/udev_run_devd - - rm $(DESTDIR)$(sbindir)/udev_run_hotplugd + - rm $(DESTDIR)$(libudevdir)/udev_run_devd + - rm $(DESTDIR)$(libudevdir)/udev_run_hotplugd .PHONY: uninstall-bin install-man: -- cgit v1.2.3-54-g00ecf From 4a924f0a58024258098e03e3a8827acbc26c591e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 22 Nov 2005 17:34:55 +0100 Subject: 076 release --- ChangeLog | 29 +++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bde6b4f05e..795de89707 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +Summary of changes from v75 to v076 +============================================ + +Kay Sievers: + fix typo in eventrecorder + volume_id: include stddef.h header + remove misleading install instructions + remove all built-in wait_for_sysfs logic + add linux/types.h back, old glibc-kernel-headers want it + volume_id: use glibc's byteswap + udevd: ignore all messages without DEVPATH + udevd: track exit status of event process + udevd: export event queue and event state + remove "udev_db" option from config file + Makefile: remove exec_prefix and srcdir + update README and RELEASE-NOTES + udevd: track killed event processes as failed + update README + don't start udevd from udevsend + udevd: add a missing return + libvolume_id: fix weird fat volume recognition + move some helpers from extras to /lib/udev + +Scott James Remnant: + move delete_path() to utils + clean-up empty queue directories + Makefile: fail, if submake fails + + Summary of changes from v74 to v075 ============================================ diff --git a/Makefile b/Makefile index 54bfb31cd3..48a130491e 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 075 +VERSION = 076 # set this to make use of syslog USE_LOG = true -- cgit v1.2.3-54-g00ecf From 30473427e8c958158750a0ee412315282c25f3ae Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Nov 2005 20:06:22 +0100 Subject: merge two consecutive static strlcat's Thanks for Marco, who noticed it. Signed-off-by: Kay Sievers --- udev_db.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/udev_db.c b/udev_db.c index e2b7b4d921..6e9a1187d0 100644 --- a/udev_db.c +++ b/udev_db.c @@ -43,8 +43,7 @@ static int devpath_to_db_path(const char *devpath, char *filename, size_t len) /* add location of db files */ strlcpy(filename, udev_root, len); - strlcat(filename, "/", len); - start = strlcat(filename, DB_DIR, len); + start = strlcat(filename, "/"DB_DIR, len); end = strlcat(filename, devpath, len); if (end > len) end = len; @@ -210,8 +209,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) int found = 0; strlcpy(dbpath, udev_root, sizeof(dbpath)); - strlcat(dbpath, "/", sizeof(dbpath)); - strlcat(dbpath, DB_DIR, sizeof(dbpath)); + strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); dir = opendir(dbpath); if (dir == NULL) { err("unable to open udev_db '%s': %s", dbpath, strerror(errno)); @@ -282,8 +280,7 @@ int udev_db_get_all_entries(struct list_head *name_list) DIR *dir; strlcpy(dbpath, udev_root, sizeof(dbpath)); - strlcat(dbpath, "/", sizeof(dbpath)); - strlcat(dbpath, DB_DIR, sizeof(dbpath)); + strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); dir = opendir(dbpath); if (dir == NULL) { err("unable to open udev_db '%s': %s", dbpath, strerror(errno)); -- cgit v1.2.3-54-g00ecf From 8d1425d54717b9b9ec06efdd1dd25559445e2571 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Nov 2005 20:06:51 +0100 Subject: don't return an error, if "ignore_device" is used Signed-off-by: Kay Sievers --- udev_event.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/udev_event.c b/udev_event.c index 353aff09b7..0b4b9dc495 100644 --- a/udev_event.c +++ b/udev_event.c @@ -95,7 +95,7 @@ int udev_process_event(struct udev_rules *rules, struct udevice *udev) if (udev->ignore_device) { info("device event will be ignored"); sysfs_close_class_device(class_dev); - return -1; + return 0; } if (udev->name[0] != '\0') { /* create node, store in db */ @@ -109,7 +109,7 @@ int udev_process_event(struct udev_rules *rules, struct udevice *udev) if (udev->ignore_device) { info("device event will be ignored"); sysfs_close_class_device(class_dev); - return -1; + return 0; } } sysfs_close_class_device(class_dev); @@ -127,7 +127,7 @@ int udev_process_event(struct udev_rules *rules, struct udevice *udev) udev_rules_get_run(rules, udev, NULL, NULL); if (udev->ignore_device) { dbg("device event will be ignored"); - return -1; + return 0; } } @@ -151,14 +151,14 @@ int udev_process_event(struct udev_rules *rules, struct udevice *udev) sysfs_close_device(devices_dev); if (udev->ignore_device) { info("device event will be ignored"); - return -1; + return 0; } } else { dbg("default handling"); udev_rules_get_run(rules, udev, NULL, NULL); if (udev->ignore_device) { info("device event will be ignored"); - return -1; + return 0; } } return 0; -- cgit v1.2.3-54-g00ecf From a8a614a7018918e987585c2d07189024c640cb3a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Nov 2005 18:50:42 +0100 Subject: remove outdated and misleading stuff Packagers who still need this, should carry it in their own package. It just causes too much trouble to users to have it in the tree and expect that it's needed or the way to do it. Signed-off-by: Kay Sievers --- README | 10 +++-- etc/udev/udev-devfs.rules | 2 +- extras/dvb.sh | 3 -- extras/inputdev.sh | 30 -------------- extras/name_cdrom.pl | 7 ++-- extras/start_udev | 102 ---------------------------------------------- 6 files changed, 10 insertions(+), 144 deletions(-) delete mode 100644 extras/dvb.sh delete mode 100644 extras/inputdev.sh delete mode 100644 extras/start_udev diff --git a/README b/README index fe56095686..9e1aae3452 100644 --- a/README +++ b/README @@ -36,11 +36,13 @@ Operation: a tmpfs filesystem mounted, which is populated from scratch by udev. Created nodes or changed permissions don't survive a reboot. - - The content of /lib/udev/devices directory should be copied over to the - tmpfs mounted /dev, to provide the required nodes to initialize udev. + - The content of /lib/udev/devices directory which contains the nodes, + symlinks and directories, which are always expected to be in/dev, should + be copied over to the tmpfs mounted /dev, to provide the required nodes + to initialize udev and continue booting. - - The udevd daemon must be started to receive netlink events from the kernel - driver core. + - The udevd daemon must be started by an init script to receive netlink + events from the kernel driver core. - From kernel version 2.6.15 on, the hotplug helper /sbin/hotplug should be disabled with an init script before the boot scripts are run and diff --git a/etc/udev/udev-devfs.rules b/etc/udev/udev-devfs.rules index 380bbee85b..ec44692d68 100644 --- a/etc/udev/udev-devfs.rules +++ b/etc/udev/udev-devfs.rules @@ -2,7 +2,7 @@ # is just kept around to proof that udev is able to emulate the devfs scheme. # # In a world where devices can come and go at any time, the devfs device -# naming scheme of simple grouping and enumeration does not help _anything_. +# naming scheme of simple grouping and enumeration DOES NOT HELP ANYTHING. # # Use custom rules to name your device or look at the persistent device # naming scheme, which is implemented for disks and extend it in a diff --git a/extras/dvb.sh b/extras/dvb.sh deleted file mode 100644 index b14a6d0d7b..0000000000 --- a/extras/dvb.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -e -echo $1 | sed -e 's#^dvb\([0-9]\)\.\([^0-9]*\)\([0-9]\)#dvb/adapter\1/\2\3#' -exit 0 diff --git a/extras/inputdev.sh b/extras/inputdev.sh deleted file mode 100644 index 82e4fdc374..0000000000 --- a/extras/inputdev.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -e -# -# Scans /proc/bus/input/devices for the given device. -# -# (c) 2004 Darren Salt -# GPL v2 or later applies. - -[ "$1" ] || exit 0 - -# input device name, less leading "input/" -DEVICE=${1#input/} - -# "|"-separated list. -# The first found in the given device's "N:" line will be output. -DEFAULT_KEYWORDS='dvb|saa7134' -KEYWORDS=${2:-$DEFAULT_KEYWORDS} - -exec sed -nre ' - /^I:/ { - : gather - N - /\nH:/! b gather - /'"$DEVICE"'/ { - s/^.*\nN:[^\n]*("|\b)('"$KEYWORDS"')("|\b)[^\n]*\n.*$/inputdev/ - T - p - } - } -' < /proc/bus/input/devices - diff --git a/extras/name_cdrom.pl b/extras/name_cdrom.pl index 5e696f33ae..28d2d29a3d 100644 --- a/extras/name_cdrom.pl +++ b/extras/name_cdrom.pl @@ -1,9 +1,8 @@ #!/usr/bin/perl -# a horribly funny script that shows how flexible udev can really be -# This is to be executed by udev with the following rules: -# -# KERNEL="hd*[!0-9]|sr*", PROGRAM="name_cdrom.pl $tempnode", SYMLINK+="%c" +# Horrible but funny script that shows how flexible udev can really be +# This is to be executed by udev with the following rule: +# KERNEL="hd*[!0-9]|sr*", PROGRAM="name_cdrom.pl $tempnode", SYMLINK+="%c" use strict; use warnings; diff --git a/extras/start_udev b/extras/start_udev deleted file mode 100644 index c2518761e3..0000000000 --- a/extras/start_udev +++ /dev/null @@ -1,102 +0,0 @@ -#! /bin/sh -# -# start_udev -# -# script to initialize /dev by using udev. -# -# Copyright (C) 2004 Greg Kroah-Hartman -# -# Released under the GPL v2 only. -# -# This needs to be run at the earliest possible point in the boot -# process. -# -# Based on the udev init.d script -# -# Thanks go out to the Gentoo developers for proving -# that this is possible to do. -# -# Yes, it's very verbose, feel free to turn off all of the echo calls, -# they were there to make me feel better that everything was working -# properly during development... -# - -. /etc/udev/udev.conf - -prog=udev -sysfs_dir=/sys -bin=/sbin/udev -udevd=/sbin/udevd - -run_udev () { - export ACTION=add - - # handle block devices and their partitions - for i in ${sysfs_dir}/block/*; do - # add each drive - export DEVPATH=${i#${sysfs_dir}} - echo "$DEVPATH" - $bin block - - # add each partition, on each device - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - echo "$DEVPATH" - $bin block - fi - done - done - # all other device classes - for i in ${sysfs_dir}/class/*; do - for j in $i/*; do - if [ -f $j/dev ]; then - export DEVPATH=${j#${sysfs_dir}} - CLASS=`echo ${i#${sysfs_dir}} | \ - cut --delimiter='/' --fields=3-` - echo "$DEVPATH" - $bin $CLASS - fi - done - done - return 0 -} - -make_extra_nodes () { - # there are a few things that sysfs does not export for us. - # these things go here (and remember to remove them in - # remove_extra_nodes() - # - # Thanks to Gentoo for the initial list of these. - ln -snf /proc/self/fd $udev_root/fd - ln -snf /proc/self/fd/0 $udev_root/stdin - ln -snf /proc/self/fd/1 $udev_root/stdout - ln -snf /proc/self/fd/2 $udev_root/stderr - ln -snf /proc/kcore $udev_root/core - - mkdir $udev_root/pts - mkdir $udev_root/shm -} - -# don't use udev if sysfs is not mounted. -if [ ! -d $sysfs_dir/block ]; then - exit 1 -fi - -echo "mounting... ramfs at $udev_root" -mount -n -t ramfs none $udev_root - -# propogate /udev from /sys -echo "Creating initial udev device nodes:" - -# You can use the shell scripts above by calling run_udev or execute udevstart -# which does the same thing, but much faster by not using shell. -# only comment out one of the following lines. -#run_udev -/sbin/udevstart - -echo "making extra nodes" -make_extra_nodes - -echo "udev startup is finished!" -exit 0 -- cgit v1.2.3-54-g00ecf From 2796c47b5c88f2775247fd0cddc1385d6bbb10bd Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Fri, 25 Nov 2005 18:56:06 +0100 Subject: allow to overwrite the configured udev_root by exporting UDEV_ROOT --- udev_config.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/udev_config.c b/udev_config.c index 7037a17081..c1af7c12ca 100644 --- a/udev_config.c +++ b/udev_config.c @@ -192,6 +192,12 @@ void udev_init_config(void) parse_config_file(); + env = getenv("UDEV_ROOT"); + if (env) { + strlcpy(udev_root, env, sizeof(udev_root)); + remove_trailing_chars(udev_root, '/'); + } + env = getenv("UDEV_LOG"); if (env) udev_log_priority = log_priority(env); -- cgit v1.2.3-54-g00ecf From 13141b9a6a046e2aca812b2442f12f116856addf Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Fri, 25 Nov 2005 19:02:25 +0100 Subject: let udevsend ignore events with SEQNUM set Using syslog from udevsend for error logging when the daemon is not running, causes vc events and an udev event loop. --- udevsend.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/udevsend.c b/udevsend.c index 8cabe9039b..b67df9720b 100644 --- a/udevsend.c +++ b/udevsend.c @@ -96,6 +96,13 @@ int main(int argc, char *argv[], char *envp[]) key = envp[i]; keylen = strlen(key); + /* ignore events which are already sent on the netlink socket */ + if (strncmp(key, "SEQNUM=", 7) == 0) { + dbg("ignoring event with SEQNUM set"); + retval = 0; + goto exit; + } + /* prevent loops in the scripts we execute */ if (strncmp(key, "UDEVD_EVENT=", 12) == 0) { err("event loop, already passed through the daemon, exit"); -- cgit v1.2.3-54-g00ecf From 997b164d56257244411aea4d709e47e6ca2da299 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Nov 2005 19:03:16 +0100 Subject: move SEQNUM event skipping to udevsend Signed-off-by: Kay Sievers --- udevd.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/udevd.c b/udevd.c index 25ef857a8c..b87fe56413 100644 --- a/udevd.c +++ b/udevd.c @@ -979,13 +979,8 @@ int main(int argc, char *argv[], char *envp[]) /* get user socket message */ if (FD_ISSET(udevd_sock, &readfds)) { msg = get_udevd_msg(); - if (msg) { - if (msg->type == UDEVD_UEVENT_UDEVSEND && msg->seqnum != 0) { - info("skip non-kernel message with SEQNUM"); - free(msg); - } else - msg_queue_insert(msg); - } + if (msg) + msg_queue_insert(msg); } /* get kernel netlink message */ -- cgit v1.2.3-54-g00ecf From 7403f98b53b115738299d7ed7a0b4d23d727ce92 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Nov 2005 19:13:28 +0100 Subject: update RELEASE-NOTES Signed-off-by: Kay Sievers --- ChangeLog | 14 ++++++++++++++ RELEASE-NOTES | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/ChangeLog b/ChangeLog index 795de89707..52a88a976a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Summary of changes from v76 to v077 +============================================ + +Kay Sievers: + merge two consecutive static strlcat's + don't return an error, if "ignore_device" is used + remove outdated and misleading stuff + move SEQNUM event skipping to udevsend + +Marco d'Itri: + allow to overwrite the configured udev_root by exporting UDEV_ROOT + let udevsend ignore events with SEQNUM set + + Summary of changes from v75 to v076 ============================================ diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 86a7fa8bde..4006e510d7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,9 @@ +udev 077 +======== +Fix a problem if udevsend is used as the hotplug handler and tries to use +syslog, which causes a "vc" event loop. 2.6.15 will make udevsend obsolete +and this kind of problems will hopefully go away soon. + udev 076 ======== All built-in logic to work around bad sysfs timing is removed with this -- cgit v1.2.3-54-g00ecf From de34dc2b06f941a7d3aa12e4cdc62b48677a0c3b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Nov 2005 19:30:33 +0100 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/10-wait-for-sysfs.rules | 1 + etc/udev/suse/40-alsa.rules | 16 +++++++ etc/udev/suse/40-bluetooth.rules | 82 +++++++++++++++++++++++++++++++++++ etc/udev/suse/50-pcmcia.rules | 5 +++ etc/udev/suse/50-udev.rules | 68 ++++++++++------------------- etc/udev/suse/60-persistent.rules | 2 + etc/udev/suse/80-pcmcia.rules | 7 --- etc/udev/suse/80-sysconfig.rules | 14 +++--- etc/udev/suse/90-hal.rules | 2 +- 9 files changed, 137 insertions(+), 60 deletions(-) create mode 100644 etc/udev/suse/10-wait-for-sysfs.rules create mode 100644 etc/udev/suse/40-alsa.rules create mode 100644 etc/udev/suse/40-bluetooth.rules create mode 100644 etc/udev/suse/50-pcmcia.rules delete mode 100644 etc/udev/suse/80-pcmcia.rules diff --git a/etc/udev/suse/10-wait-for-sysfs.rules b/etc/udev/suse/10-wait-for-sysfs.rules new file mode 100644 index 0000000000..80c1781530 --- /dev/null +++ b/etc/udev/suse/10-wait-for-sysfs.rules @@ -0,0 +1 @@ +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" diff --git a/etc/udev/suse/40-alsa.rules b/etc/udev/suse/40-alsa.rules new file mode 100644 index 0000000000..79888dd3be --- /dev/null +++ b/etc/udev/suse/40-alsa.rules @@ -0,0 +1,16 @@ +SUBSYSTEM="sound", GROUP="audio" +SUBSYSTEM="snd", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8000/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us428fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8004/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us224fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8006/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us122fw.ihx" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8001/*", RUN+="/sbin/startproc /usr/bin/us428control" +SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startproc /usr/bin/us428control" +SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" +SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" + diff --git a/etc/udev/suse/40-bluetooth.rules b/etc/udev/suse/40-bluetooth.rules new file mode 100644 index 0000000000..7405d15b21 --- /dev/null +++ b/etc/udev/suse/40-bluetooth.rules @@ -0,0 +1,82 @@ +# bluetooth subsystem +SUBSYSTEM=="bluetooth", RUN+="/sbin/udev.bluetooth.sh" + +# uncomment this if you have configured an automatic rfcomm-bind in +# /etc/bluetooth/rfcomm.conf +# KERNEL=="rfcomm*", NAME="%k" GROUP="uucp" MODE="0660" OPTIONS="resmgr" + +## PCMCIA-Cards +# "Brain Boxes BL-620 Bluetooth Adapter" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Brain Boxes", SYSFS{prod_id2}=="Bluetooth PC Card", RUN+="/etc/pcmcia/bluetooth.sh" +# "Xircom CreditCard Bluetooth Adapter" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Xircom", SYSFS{prod_id3}=="CBT", RUN+="/etc/pcmcia/bluetooth.sh" +# "Xircom RealPort2 Bluetooth Adapter" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Xircom", SYSFS{prod_id3}=="CBT", RUN+="/etc/pcmcia/bluetooth.sh" +# "IBM Bluetooth PC Card II" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="IBM", SYSFS{prod_id2}=="Bluetooth PC Card II", RUN+="/etc/pcmcia/bluetooth.sh" +# "TDK Bluetooth PC Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="TDK", SYSFS{prod_id2}=="Bluetooth PC Card II", RUN+="/etc/pcmcia/bluetooth.sh" +# "AmbiCom BT2000C Bluetooth PC/CF Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="AmbiCom BT2000C", SYSFS{prod_id2}=="Bluetooth PC/CF Card", RUN+="/etc/pcmcia/bluetooth.sh" +# "COM One Platinium Bluetooth PC Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="COM1 SA", SYSFS{prod_id2}=="MC310 CARD", RUN+="/etc/pcmcia/bluetooth.sh" +# "Sphinx PICO Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="SPHINX", SYSFS{prod_id2}=="BT-CARD", RUN+="/etc/pcmcia/bluetooth.sh" +# "H-Soft blue+Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="H-Soft", SYSFS{prod_id2}=="Blue+CARD", RUN+="/etc/pcmcia/bluetooth.sh" +# "Compaq iPAQ Bluetooth Sleeve" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="CF CARD", SYSFS{prod_id2}=="GENERIC", RUN+="/etc/pcmcia/bluetooth.sh" +# "Zoom Bluetooth Card" +# "Sitecom CN-504 Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="PCMCIA", SYSFS{prod_id2}=="Bluetooth Card", RUN+="/etc/pcmcia/bluetooth.sh" + + +# +# dtl1_cs +# +# card "Nokia Bluetooth Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Nokia Mobile Phones", SYSFS{prod_id2}=="DTL-1", RUN+="/etc/pcmcia/bluetooth.sh" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Nokia Mobile Phones", SYSFS{prod_id2}=="DTL-4", RUN+="/etc/pcmcia/bluetooth.sh" +# "Socket Bluetooth Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Socket", SYSFS{prod_id2}=="CF+ Personal Network Card", RUN+="/etc/pcmcia/bluetooth.sh" + + +# +# bt3c_cs +# + +# "3Com Bluetooth PC Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="3COM", SYSFS{prod_id3}=="Bluetooth PC Card", RUN+="/etc/pcmcia/bluetooth.sh" + +# +# bluecard_cs +# + +# "LSE041 Bluetooth PC Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="BlueCard", SYSFS{prod_id2}=="LSE041", RUN+="/etc/pcmcia/bluetooth.sh" +# "LSE039 Bluetooth Compact Flash Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="WSS", SYSFS{prod_id2}=="LSE039", RUN+="/etc/pcmcia/bluetooth.sh" +# "LSE139 Bluetooth Compact Flash Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="BTCFCARD", SYSFS{prod_id2}=="LSE139", RUN+="/etc/pcmcia/bluetooth.sh" + + +# +# bt950_cs +# + +# "AmbiCom BT2000E Bluetooth Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="AmbiCom,Inc", SYSFS{prod_id2}=="BT2000E", RUN+="/etc/pcmcia/bluetooth.sh" +# "Pretec BT2000E Bluetooth Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Pretec", SYSFS{prod_id2}=="BT2000E", RUN+="/etc/pcmcia/bluetooth.sh" +# "Billionton Bluetooth Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Compact Flash", SYSFS{prod_id2}=="Bluetooth Card", RUN+="/etc/pcmcia/bluetooth.sh" + + +# +# btuart_cs +# + +# "Cyber-blue Compact Flash Card" +SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="BT", SYSFS{prod_id2}=="", SYSFS{prod_id3}=="", SYSFS{prod_id4}=="", RUN+="/etc/pcmcia/bluetooth.sh" + + diff --git a/etc/udev/suse/50-pcmcia.rules b/etc/udev/suse/50-pcmcia.rules new file mode 100644 index 0000000000..11ccde56e7 --- /dev/null +++ b/etc/udev/suse/50-pcmcia.rules @@ -0,0 +1,5 @@ +SUBSYSTEM=="pcmcia_socket", ACTION=="add", RUN+="/sbin/hwup pcmcia_socket-devpath-%p -o hotplug" +SUBSYSTEM=="pcmcia", ACTION=="add", RUN+="/sbin/hwup pcmcia-devpath-%p -o hotplug" + +LABEL="after_pcmcia" + diff --git a/etc/udev/suse/50-udev.rules b/etc/udev/suse/50-udev.rules index f24d77d197..768fdf0acb 100644 --- a/etc/udev/suse/50-udev.rules +++ b/etc/udev/suse/50-udev.rules @@ -1,3 +1,7 @@ +# ignore these events until someone needs them +SUBSYSTEM=="drivers", OPTIONS="last_rule" +SUBSYSTEM=="module", OPTIONS="last_rule" + # console KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" @@ -5,8 +9,8 @@ KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", MODE="600" -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666" +KERNEL=="console", NAME="%k", MODE="600", OPTIONS="last_rule" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" # serial devices KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" @@ -35,23 +39,6 @@ KERNEL=="pmu", GROUP="video" # dvb SUBSYSTEM="dvb", PROGRAM="/bin/sh -c 'X=%k; X=$${X#dvb}; A=$${X%%%%.*}; D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" -# ALSA/sound -SUBSYSTEM="sound", GROUP="audio" -SUBSYSTEM="snd", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8000/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us428fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8004/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us224fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8006/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us122fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8001/*", RUN+="/sbin/startproc /usr/bin/us428control" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startproc /usr/bin/us428control" -SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" -SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" - # Kino jogshuttle support SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="b33/10/*", RUN+="/usr/bin/killall --quiet -USR2 kino" SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="5f3/240/*", RUN+="/usr/bin/killall --quiet -USR2 kino" @@ -64,12 +51,12 @@ KERNEL=="js*", NAME="input/%k", MODE="0644" KERNEL=="ts*", NAME="input/%k", MODE="0600" KERNEL=="uinput", NAME="input/%k", MODE="0600" KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" -SUBSYSTEM=="input[0-9]*", RUN+="/lib/udev/input_device.sh" -KERNEL=="input[0-9]*", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" +KERNEL=="input[0-9]*", RUN+="/lib/udev/input_device.sh" +KERNEL=="input[0-9]*", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" # printer -SUBSYSTEM=="usb", KERNEL=="lp*", ACTION=="add", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", ACTION=="add", NAME="%k", GROUP="lp" +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp" KERNEL=="irlpt*", NAME="%k", GROUP="lp" # cpu devices @@ -117,32 +104,25 @@ KERNEL=="z90crypt", NAME="%k", MODE="666" KERNEL=="mmtimer", NAME="%k", MODE="444" KERNEL=="auer[0-9]*" NAME="usb/%k" -KERNEL=="pktcdvd", NAME="pktcdvd/control" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" +KERNEL=="pktcdvd", NAME="pktcdvd/control" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" # fix floppy devices -KERNEL=="nvram", ACTION=="add", RUN+="/sbin/load_floppy_module.sh" -KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="/sbin/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" -KERNEL=="fd*", ACTION=="remove", RUN+="/sbin/remove_floppy_devices.sh %k" +KERNEL=="nvram", ACTION=="add", RUN+="/lib/udev/load_floppy_module.sh" +KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="/lib/udev/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd*", ACTION=="remove", RUN+="/lib/udev/remove_floppy_devices.sh %k" # block devices SUBSYSTEM=="block", GROUP="disk", MODE="0640" -# SCSI types: -# sd / block values: -# 0 TYPE_DISK -# 7 TYPE_MOD -# 14 TYPE_RBC -# -# st/osst tape: -# 1 TYPE_TAPE -# -# sr cd like ones: -# 4 TYPE_WORM -# 5 TYPE_ROM +# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC +# sr: 4 TYPE_WORM, 5 TYPE_ROM +# st/osst: 1 TYPE_TAPE +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys/$DEVPATH/timeout'" +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys/$DEVPATH/timeout'" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" # Treat osst as a unique case, that is, osst will load more often than -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="Onstream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="OnStream", RUN+="/sbin/modprobe osst" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" @@ -150,9 +130,8 @@ SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" # IDE/ATAPI handling SUBSYSTEM=="ide", ACTION=="add", RUN+="/lib/udev/load_ide_modules.sh" -# device mapper targets +# device mapper KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control" -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" # check fstab and possibly mount SUBSYSTEM=="block", KERNEL=="sd*[0-9]|hd*[0-9]", ACTION=="add", RUN+="/lib/udev/mount.sh" @@ -181,8 +160,7 @@ KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" -# libusb device access (mount usbfs or create usbdev nodes) -DEVPATH=="/module/usbcore", ACTION=="add", RUN+="/bin/mount -t usbfs usbfs /proc/bus/usb" +# libusb device access SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev}; B=$${X%%%%.*}; D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" # firmware loader diff --git a/etc/udev/suse/60-persistent.rules b/etc/udev/suse/60-persistent.rules index 589fb0f88a..0d24a29338 100644 --- a/etc/udev/suse/60-persistent.rules +++ b/etc/udev/suse/60-persistent.rules @@ -43,4 +43,6 @@ KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" + LABEL="persistent_end" diff --git a/etc/udev/suse/80-pcmcia.rules b/etc/udev/suse/80-pcmcia.rules deleted file mode 100644 index cae7a7606c..0000000000 --- a/etc/udev/suse/80-pcmcia.rules +++ /dev/null @@ -1,7 +0,0 @@ -ENV{SYSCONFIG}=="no|off|0", GOTO="pcmcia_end" - -SUBSYSTEM=="pcmcia_socket", ACTION=="add", RUN+="/sbin/hwup pcmcia_socket-devpath-%p -o hotplug" -SUBSYSTEM=="pcmcia", ACTION=="add", RUN+="/sbin/hwup pcmcia-devpath-%p -o hotplug" - -LABEL="pcmcia_end" - diff --git a/etc/udev/suse/80-sysconfig.rules b/etc/udev/suse/80-sysconfig.rules index 630c0eedfb..d33d975b36 100644 --- a/etc/udev/suse/80-sysconfig.rules +++ b/etc/udev/suse/80-sysconfig.rules @@ -7,14 +7,14 @@ SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" # SUSE system integration SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" -SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-/sys%p -o hotplug" -SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-/sys%p -o hotplug" -SUBSYSTEM=="scsi", DEVPATH=="/devices/css*", ACTION=="remove", RUN+="/sbin/hwdown scsi-devpath-/sys%p -o hotplug" -SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{device/cutype}=="*", RUN+="/sbin/hwup scsi__host-devpath-/sys%p -o hotplug" +SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-%p -o hotplug" +SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-%p -o hotplug" +SUBSYSTEM=="scsi", DEVPATH=="/devices/css*", ACTION=="remove", RUN+="/sbin/hwdown scsi-devpath-%p -o hotplug" +SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{device/cutype}=="?*", RUN+="/sbin/hwup scsi__host-devpath-%p -o hotplug" SUBSYSTEM=="vio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" SUBSYSTEM=="macio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" -SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-/sys%p -o hotplug" -SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-/sys%p -o hotplug" -SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" +SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-%p -o hotplug" +SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-%p -o hotplug" +SUBSYSTEM=="pnp", ACTION=="add", RUN+="/sbin/hwup pnp-devpath-%p -o hotplug" LABEL="sysconfig_end" diff --git a/etc/udev/suse/90-hal.rules b/etc/udev/suse/90-hal.rules index 35b81ea046..9b2fe79ea5 100644 --- a/etc/udev/suse/90-hal.rules +++ b/etc/udev/suse/90-hal.rules @@ -1,3 +1,3 @@ # send all events to HAL -RUN+="/usr/sbin/hal.hotplug" +RUN+="socket:/org/freedesktop/hal/udev_event" -- cgit v1.2.3-54-g00ecf From 6acd81c8981a5f0ea80e3cdef2a10e5d595bbae3 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Fri, 25 Nov 2005 19:35:26 +0100 Subject: update Debian rules --- etc/udev/debian/devfs.rules | 20 +++++++++----------- etc/udev/debian/hotplug.rules | 35 ++++++++++++++++++----------------- etc/udev/debian/hotplugd.rules | 4 ++-- etc/udev/debian/permissions.rules | 18 ++++++++++++++---- etc/udev/debian/udev.rules | 13 ++++++------- 5 files changed, 49 insertions(+), 41 deletions(-) diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index b1696c7d24..c4a44e3e7f 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -15,20 +15,18 @@ # workaround for devices which do not report media changes BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/sbin/ata_id --export $tempnode", ENV{ID_MODEL}=="IOMEGA_ZIP*", \ - NAME="%k", OPTIONS+="all_partitions" + ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" # IDE devices -BUS=="ide", KERNEL=="hd[a-z]*", \ - PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", \ +BUS=="ide", KERNEL=="hd[a-z]*", PROGRAM="/lib/udev/ide-devfs.sh %k %b %n", \ NAME="%c{1}", SYMLINK+="%k %c{2}" # SCSI devices -BUS=="scsi", PROGRAM="/etc/udev/scripts/scsi-devfs.sh %k %b %n", \ +BUS=="scsi", PROGRAM="/lib/udev/scsi-devfs.sh %k %b %n", \ NAME="%c{1}", SYMLINK+="%k %c{2}" # RAID controllers -KERNEL=="cciss!*|ida!*|rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", \ +KERNEL=="cciss!*|ida!*|rd!*", PROGRAM="/lib/udev/raid-devfs.sh %k", \ NAME="%c{1}", SYMLINK+="%k" # other block devices @@ -47,8 +45,8 @@ BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ SYMLINK+="pilot" # usbfs-like devices -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k K=$${K#usbdev} B=$${K%%%%.*} D=$${K#*.}; echo bus/usb/$$B/$$D'", \ - SYMLINK+="%c" +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; B=$${K%%%%.*}; D=$${K#*.}; echo bus/usb/$$B/$$D'", \ + NAME="%c" # serial devices KERNEL=="ttyS[0-9]*", NAME="tts/%n" @@ -69,7 +67,7 @@ KERNEL=="video[0-9]*", NAME="v4l/%k" KERNEL=="radio[0-9]*", NAME="v4l/%k" KERNEL=="vbi[0-9]*", NAME="v4l/%k" KERNEL=="vtx[0-9]*", NAME="v4l/%k" -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'KNAME=%k KNAME=$${KNAME#dvb} A=$${KNAME%%%%.*} D=$${KNAME#*.}; echo dvb/adapter$$A/$$D'", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'KNAME=%k; KNAME=$${KNAME#dvb}; A=$${KNAME%%%%.*}; D=$${KNAME#*.}; echo dvb/adapter$$A/$$D'", \ NAME="%c" KERNEL=="fb[0-9]*", NAME="fb/%n" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -101,7 +99,7 @@ KERNEL=="microcode", NAME="cpu/microcode" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" KERNEL=="uverbs*", NAME="infiniband/%k" -KERNEL=="ucm", NAME="infiniband/%k" +KERNEL=="ucm*", NAME="infiniband/%k" # sound devices KERNEL=="controlC[0-9]*", NAME="snd/%k" @@ -145,6 +143,6 @@ SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" # device mapper creates its own device nodes, so ignore these -KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="dm-[0-9]*", NAME="" KERNEL=="device-mapper", NAME="mapper/control" diff --git a/etc/udev/debian/hotplug.rules b/etc/udev/debian/hotplug.rules index 84f8c32156..f4c99ec8eb 100644 --- a/etc/udev/debian/hotplug.rules +++ b/etc/udev/debian/hotplug.rules @@ -1,18 +1,23 @@ ACTION!="add", GOTO="hotplug_not_add_event" # check if the device has already been claimed by a driver -PROGRAM="/bin/sh -c 'test -e /sys$devpath/driver'", \ - GOTO="hotplug_driver_loaded" +ENV{PHYSDEVDRIVER}=="?*", GOTO="hotplug_driver_loaded" # workarounds for kernels which lack $MODALIAS support -SUBSYSTEM=="input", BUS=="serio", ENV{MODALIAS}!="?*", \ - IMPORT{program}="/lib/hotplug/modalias_serio" -SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", \ - IMPORT{program}="/lib/hotplug/modalias_ieee1394" +SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", \ + IMPORT{program}="/lib/udev/modalias_ieee1394" +SUBSYSTEM=="serio", ENV{MODALIAS}!="?*", \ + IMPORT{program}="/lib/udev/modalias_serio" # load the drivers -ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $modalias" -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" +ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" +SUBSYSTEM=="ide", ENV{MODALIAS}!="?*", RUN+="/lib/udev/ide.agent" +#SUBSYSTEM=="input", ENV{MODALIAS}!="?*", RUN+="/lib/udev/input.agent" +SUBSYSTEM=="vio", ENV{MODALIAS}!="?*", RUN+="/lib/udev/vio.agent" + +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" + +SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" SUBSYSTEM=="scsi_device", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe osst", \ @@ -24,23 +29,19 @@ SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe st", \ SUBSYSTEM=="scsi_device", SYSFS{type}=="[345]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", SYSFS{type}=="[235689]", RUN+="/sbin/modprobe sg" -SUBSYSTEM=="input_device", ENV{ABS}=="?*", RUN+="/sbin/modprobe joydev" - -SUBSYSTEM=="ide", RUN+="/lib/hotplug/ide.agent" - # From here on follows the hotplug agents which do not load modules LABEL="hotplug_driver_loaded" # FIXME: does a sane default exist? #SUBSYSTEM=="scsi_device", SYSFS{idVendor}=="...", \ -# RUN+="/lib/hotplug/scsi-re-add" +# RUN+="/lib/udev/scsi-re-add" -SUBSYSTEM=="firmware", RUN+="/lib/hotplug/firmware.agent" +SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware.agent" LABEL="hotplug_not_add_event" -SUBSYSTEM=="net", RUN+="/lib/hotplug/net.agent" +SUBSYSTEM=="net", RUN+="/bin/sh -c '/lib/udev/net.agent &'" -# for debugging -#RUN+="/lib/hotplug/logger.agent" +# Log every event to /dev/hotplug.log (for debugging). +#RUN+="/lib/udev/logger.agent" diff --git a/etc/udev/debian/hotplugd.rules b/etc/udev/debian/hotplugd.rules index 7b85e179e8..d79ce85e52 100644 --- a/etc/udev/debian/hotplugd.rules +++ b/etc/udev/debian/hotplugd.rules @@ -4,6 +4,6 @@ SUBSYSTEM=="module", OPTIONS="last_rule" # compatibility support for the obsolete hotplug.d and dev.d directories # do not run the hotplug.d scripts when started from udevstart -ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" -RUN+="/sbin/udev_run_devd" +ENV{UDEVD_EVENT}=="1", RUN+="/lib/udev/udev_run_hotplugd" +RUN+="/lib/udev/udev_run_devd" diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index 02bfefdd27..bc97566b57 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -1,7 +1,10 @@ +# workaround needed to make udevd wait for the "bus" link +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", \ + WAIT_FOR_SYSFS="bus" + # default permissions for block devices SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" -SUBSYSTEM=="block", SYSFS{../removable}=="1", GROUP="floppy" # IDE devices BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", ACTION=="add", \ @@ -19,6 +22,9 @@ BUS=="scsi", SYSFS{type}=="6", GROUP="scanner" BUS=="usb", KERNEL=="legousbtower*", MODE="0666" BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" +# usbfs-like devices +SUBSYSTEM=="usb_device", MODE="0664" + # serial devices SUBSYSTEM=="tty", GROUP="dialout" SUBSYSTEM=="capi", GROUP="dialout" @@ -41,7 +47,7 @@ SUBSYSTEM=="nvidia", GROUP="video" # misc devices KERNEL=="random", MODE="0666" -KERNEL=="urandom", MODE="0444" +KERNEL=="urandom", MODE="0666" KERNEL=="mem", MODE="0640", GROUP="kmem" KERNEL=="kmem", MODE="0640", GROUP="kmem" KERNEL=="port", MODE="0640", GROUP="kmem" @@ -53,13 +59,17 @@ KERNEL=="sgi_fetchop", MODE="0666" KERNEL=="sonypi", MODE="0666" KERNEL=="agpgart", GROUP="video" KERNEL=="nvram", GROUP="nvram" -KERNEL=="rtc", MODE="0660", GROUP="audio" +KERNEL=="rtc", GROUP="audio" KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" +KERNEL=="fuse", GROUP="fuse" KERNEL=="cdemu[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd", MODE="0644" +KERNEL=="uverbs*", GROUP="rdma" +KERNEL=="ucm*", GROUP="rdma" + # printers and parallel devices SUBSYSTEM=="printer", GROUP="lp" SUBSYSTEM=="ppdev", GROUP="lp" @@ -75,7 +85,7 @@ KERNEL=="dv1394*", GROUP="video" KERNEL=="video1394*", GROUP="video" # input devices -KERNEL=="event[0-9]*", PROGRAM="/etc/udev/scripts/inputdev.sh %k", \ +KERNEL=="event[0-9]*", PROGRAM="/lib/udev/inputdev.sh %k", \ RESULT=="inputdev", MODE="0664", GROUP="video" KERNEL=="js[0-9]*", MODE="0664" diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index 27eb43e54c..b5dfd00572 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -15,8 +15,7 @@ # workaround for devices which do not report media changes BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ - PROGRAM="/sbin/ata_id --export $tempnode", ENV{ID_MODEL}=="IOMEGA_ZIP*", \ - NAME="%k", OPTIONS+="all_partitions" + ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" # SCSI devices BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" @@ -32,15 +31,15 @@ BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ SYMLINK+="pilot" # usbfs-like devices -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k K=$${K#usbdev} B=$${K%%%%.*} D=$${K#*.}; echo bus/usb/$$B/$$D'", \ - SYMLINK+="%c" +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; B=$${K%%%%.*}; D=$${K#*.}; echo bus/usb/$$B/$$D'", \ + NAME="%c" # serial devices KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" KERNEL=="capi[0-9]*", NAME="capi/%n" # video devices -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k K=$${K#dvb} A=$${K%%%%.*} D=$${K#*.}; echo dvb/adapter$$A/$$D'", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; A=$${K%%%%.*}; D=$${K#*.}; echo dvb/adapter$$A/$$D'", \ NAME="%c" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -59,7 +58,7 @@ KERNEL=="microcode", NAME="cpu/microcode" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" KERNEL=="uverbs*", NAME="infiniband/%k" -KERNEL=="ucm", NAME="infiniband/%k" +KERNEL=="ucm*", NAME="infiniband/%k" # ALSA devices KERNEL=="controlC[0-9]*", NAME="snd/%k" @@ -94,6 +93,6 @@ SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" # device mapper creates its own device nodes, so ignore these -KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="dm-[0-9]*", NAME="" KERNEL=="device-mapper", NAME="mapper/control" -- cgit v1.2.3-54-g00ecf From aab4c0eebef44c5b67d4c9537f1c5149de3ca9c2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Dec 2005 18:55:51 +0100 Subject: allow programs in /lib/udev called without the path RUN="firmware.sh" should work like RUN="/lib/udev/firmware.sh" Signed-off-by: Kay Sievers --- udev_utils_run.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/udev_utils_run.c b/udev_utils_run.c index 20aaa4ab05..e1e775ebe6 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -82,6 +82,7 @@ int run_program(const char *command, const char *subsystem, int errpipe[2] = {-1, -1}; pid_t pid; char arg[PATH_SIZE]; + char program[PATH_SIZE]; char *argv[(sizeof(arg) / 2) + 1]; int devnull; int i; @@ -126,6 +127,13 @@ int run_program(const char *command, const char *subsystem, } } + /* allow programs in /lib/udev called without the path */ + if (strchr(argv[0], '/') == NULL) { + strlcpy(program, "/lib/udev/", sizeof(program)); + strlcat(program, argv[0], sizeof(program)); + argv[0] = program; + } + pid = fork(); switch(pid) { case 0: -- cgit v1.2.3-54-g00ecf From a2f87fddbfcb81f6f8f254b1a986a18f444212cf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 4 Dec 2005 01:48:53 +0100 Subject: update SUSE rules Signed-off-by: Kay Sievers --- Makefile | 1 - etc/udev/suse/50-udev.rules | 14 ++++++-------- etc/udev/suse/90-hal.rules | 2 -- udevd.c | 4 ++-- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 48a130491e..5995b57697 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,6 @@ GEN_CONFIGS = \ GEN_HEADERS = \ udev_version.h -# override this to make udev look in a different location for it's config files prefix = etcdir = ${prefix}/etc sbindir = ${prefix}/sbin diff --git a/etc/udev/suse/50-udev.rules b/etc/udev/suse/50-udev.rules index 768fdf0acb..51561ffd0f 100644 --- a/etc/udev/suse/50-udev.rules +++ b/etc/udev/suse/50-udev.rules @@ -37,7 +37,7 @@ KERNEL=="vbi0", SYMLINK+="vbi" KERNEL=="pmu", GROUP="video" # dvb -SUBSYSTEM="dvb", PROGRAM="/bin/sh -c 'X=%k; X=$${X#dvb}; A=$${X%%%%.*}; D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" # Kino jogshuttle support SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="b33/10/*", RUN+="/usr/bin/killall --quiet -USR2 kino" @@ -51,8 +51,7 @@ KERNEL=="js*", NAME="input/%k", MODE="0644" KERNEL=="ts*", NAME="input/%k", MODE="0600" KERNEL=="uinput", NAME="input/%k", MODE="0600" KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" -KERNEL=="input[0-9]*", RUN+="/lib/udev/input_device.sh" -KERNEL=="input[0-9]*", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" +KERNEL=="input[0-9]*", ACTION=="add", RUN+="/lib/udev/input.sh" # printer SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" @@ -121,14 +120,13 @@ SUBSYSTEM=="block", GROUP="disk", MODE="0640" ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys/$DEVPATH/timeout'" ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys/$DEVPATH/timeout'" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -# Treat osst as a unique case, that is, osst will load more often than -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="OnStream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" -# IDE/ATAPI handling -SUBSYSTEM=="ide", ACTION=="add", RUN+="/lib/udev/load_ide_modules.sh" +# IDE modules +SUBSYSTEM=="ide", ACTION=="add", RUN+="/lib/udev/ide.sh" # device mapper KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control" @@ -161,7 +159,7 @@ KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" # libusb device access -SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev}; B=$${X%%%%.*}; D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" # firmware loader SUBSYSTEM=="firmware", ACTION=="add", RUN+="/lib/udev/firmware.sh" diff --git a/etc/udev/suse/90-hal.rules b/etc/udev/suse/90-hal.rules index 9b2fe79ea5..b0b36330df 100644 --- a/etc/udev/suse/90-hal.rules +++ b/etc/udev/suse/90-hal.rules @@ -1,3 +1 @@ -# send all events to HAL - RUN+="socket:/org/freedesktop/hal/udev_event" diff --git a/udevd.c b/udevd.c index b87fe56413..ff61c656c8 100644 --- a/udevd.c +++ b/udevd.c @@ -551,7 +551,7 @@ static struct uevent_msg *get_udevd_msg(void) size = recvmsg(udevd_sock, &smsg, 0); if (size < 0) { if (errno != EINTR) - err("unable to receive udevd message: %s", strerror(errno)); + err("unable to receive user udevd message: %s", strerror(errno)); return NULL; } cmsg = CMSG_FIRSTHDR(&smsg); @@ -626,7 +626,7 @@ static struct uevent_msg *get_netlink_msg(void) size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); if (size < 0) { if (errno != EINTR) - err("unable to receive udevd message: %s", strerror(errno)); + err("unable to receive kernel netlink message: %s", strerror(errno)); return NULL; } -- cgit v1.2.3-54-g00ecf From ed0e3cbd6dfe49c2cceb26eb65466dd5905b1c5b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 4 Dec 2005 02:31:38 +0100 Subject: add target to to generate ChangeLog section I can't remember that magic sequence... Signed-off-by: Kay Sievers --- ChangeLog | 14 -------------- Makefile | 12 +++++++++++- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 52a88a976a..795de89707 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,17 +1,3 @@ -Summary of changes from v76 to v077 -============================================ - -Kay Sievers: - merge two consecutive static strlcat's - don't return an error, if "ignore_device" is used - remove outdated and misleading stuff - move SEQNUM event skipping to udevsend - -Marco d'Itri: - allow to overwrite the configured udev_root by exporting UDEV_ROOT - let udevsend ignore events with SEQNUM set - - Summary of changes from v75 to v076 ============================================ diff --git a/Makefile b/Makefile index 5995b57697..d4ee3eb6be 100644 --- a/Makefile +++ b/Makefile @@ -377,9 +377,19 @@ test tests: all .PHONY: test tests buildtest: - ./test/simple-build-check.sh + test/simple-build-check.sh .PHONY: buildtest +ChangeLog: Makefile + @ mv $@ $@.tmp + @ echo "Summary of changes from v$(VERSION) to v$(shell printf '%03i' $$(expr $(VERSION) + 1))" >> $@ + @ echo "============================================" >> $@ + @ git log --pretty=short $(VERSION)..HEAD | git shortlog >> $@ + @ echo >> $@ + @ cat $@ + @ cat $@.tmp >> $@ + @ rm $@.tmp + gcov-all: $(MAKE) clean all STRIPCMD= USE_GCOV=true @echo -- cgit v1.2.3-54-g00ecf From 4d1f4aa957277808a79d04216cf6e3db00035204 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 4 Dec 2005 02:52:57 +0100 Subject: update Red Hat rules --- etc/udev/redhat/hotplug.rules | 8 +++ etc/udev/redhat/udev.rules | 129 +++++++++++++++++++++++------------------- 2 files changed, 79 insertions(+), 58 deletions(-) create mode 100644 etc/udev/redhat/hotplug.rules diff --git a/etc/udev/redhat/hotplug.rules b/etc/udev/redhat/hotplug.rules new file mode 100644 index 0000000000..1f4369c36b --- /dev/null +++ b/etc/udev/redhat/hotplug.rules @@ -0,0 +1,8 @@ +# do not call hotplug.d and dev.d for "drivers" and "module" events +SUBSYSTEM=="drivers", OPTIONS="last_rule" +SUBSYSTEM=="module", OPTIONS="last_rule" + +# compatibility support for the obsolete hotplug.d and dev.d directories +ENV{UDEVD_EVENT}=="1", RUN+="/lib/udev/udev_run_hotplugd" +RUN+="/lib/udev/udev_run_devd" + diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index 115abc3ae4..ba10fd5501 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -11,6 +11,7 @@ KERNEL=="root", GROUP="disk", MODE="0640" # console devices KERNEL=="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="console", MODE="0600", OPTIONS="last_rule" KERNEL=="tty[0-9]", GROUP="tty", MODE="0660", OPTIONS="last_rule" KERNEL=="tty[0-9][0-9]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" KERNEL=="vc/[0-9]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" @@ -38,21 +39,21 @@ KERNEL=="tts/[0-9]*", GROUP="uucp", MODE="0660" KERNEL=="tts/USB[0-9]*", GROUP="uucp", MODE="0660" # vc devices -KERNEL=="vcs", OWNER="vcsa", GROUP="tty" -KERNEL=="vcs[0-9]*", OWNER="vcsa", GROUP="tty" -KERNEL=="vcsa", OWNER="vcsa", GROUP="tty" -KERNEL=="vcsa[0-9]*", OWNER="vcsa", GROUP="tty" -KERNEL=="vcc/*", OWNER="vcsa", GROUP="tty" +KERNEL=="vcs", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcs[0-9]*", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcsa", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcsa[0-9]*", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcc/*", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" # memory devices -KERNEL=="random", MODE="0666" -KERNEL=="urandom", MODE="0444" -KERNEL=="mem", GROUP="kmem", MODE="0640" -KERNEL=="kmem", GROUP="kmem", MODE="0640" -KERNEL=="port", GROUP="kmem", MODE="0640" -KERNEL=="full", MODE="0666" -KERNEL=="null", MODE="0666" -KERNEL=="zero", MODE="0666" +KERNEL=="random", MODE="0666", OPTIONS="last_rule" +KERNEL=="urandom", MODE="0444", OPTIONS="last_rule" +KERNEL=="mem", GROUP="kmem", MODE="0640", OPTIONS="last_rule" +KERNEL=="kmem", GROUP="kmem", MODE="0640", OPTIONS="last_rule" +KERNEL=="port", GROUP="kmem", MODE="0640", OPTIONS="last_rule" +KERNEL=="full", MODE="0666", OPTIONS="last_rule" +KERNEL=="null", MODE="0666", OPTIONS="last_rule" +KERNEL=="zero", MODE="0666", OPTIONS="last_rule" # misc devices KERNEL=="nvram", MODE="0660" @@ -133,9 +134,9 @@ KERNEL=="3dfx*", MODE="0660" KERNEL=="dri/*", MODE="0666" # usb devices -KERNEL=="usb/dabusb*", GROUP="usb", MODE="0660" -KERNEL=="usb/mdc800*", GROUP="usb", MODE="0660" -KERNEL=="usb/rio500", GROUP="usb", MODE="0660" +KERNEL=="usb/dabusb*", MODE="0660" +KERNEL=="usb/mdc800*", MODE="0660" +KERNEL=="usb/rio500", MODE="0660" # s390 devices KERNEL=="z90crypt", MODE="0666" @@ -164,9 +165,14 @@ KERNEL=="seq", NAME="snd/%k" KERNEL=="mice", NAME="input/%k" KERNEL=="mouse*", NAME="input/%k" KERNEL=="event*", NAME="input/%k" -KERNEL=="js*", NAME="input/%k" +KERNEL=="js*", NAME="input/%k", SYMLINK+="%k" KERNEL=="ts*", NAME="input/%k" +# IEEE1394 (firewire) devices (must be before raw devices below) +KERNEL=="raw1394", NAME="%k" +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + KERNEL=="raw[0-9]*", NAME="raw/%k" KERNEL=="lp[0-9]*", SYMLINK+="par%n" @@ -174,7 +180,7 @@ BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" KERNEL=="microcode", NAME="cpu/%k" KERNEL="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpu" +KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" KERNEL=="ram1", SYMLINK+="ram" KERNEL=="video0", SYMLINK+="video" @@ -218,73 +224,80 @@ KERNEL=="zap[0-9]*", NAME="zap/%n" BUS=="scsi", KERNEL=="sg[0-9]*", SYSFS{type}=="6", NAME="%k", SYMLINK="scanner%e", MODE="0660" # do not seperate the next 2 lines!! -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/ide-media.sh %k", RESULT=="floppy", SYMLINK+="floppy%e", NAME{ignore_remove, all_partitions}="%k" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/lib/udev/ide-media.sh %k", RESULT=="floppy", SYMLINK+="floppy%e", NAME{ignore_remove, all_partitions}="%k" KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", RESULT=="cdrom", SYMLINK+="cdrom%e" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK+="dvd%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD", SYMLINK+="dvd%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/lib/udev/check-cdrom.sh %k DVD", SYMLINK+="dvd%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/lib/udev/check-cdrom.sh %k DVD", SYMLINK+="dvd%e" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/lib/udev/check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/lib/udev/check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/etc/udev/scripts/check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="/lib/udev/check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/lib/udev/check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" # rename sr* to scd* KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n" KERNEL=="hd[a-z]*", BUS=="ide", SYSFS{removable}=="1", NAME{ignore_remove}="%k" -KERNEL=="dvb*", PROGRAM=="/etc/udev/scripts/dvb.sh %k", NAME="%c" +KERNEL=="dvb*", PROGRAM=="/lib/udev/dvb.sh %k", NAME="%c" ####################################### -# Persistant block device stuff - begin +# Persistent block device stuff - begin ####################################### +# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" -# Skip all of this if we are not adding a block device -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" -# skip accessing removable ide devices, cause the ide drivers are horrible broken -BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" -BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id" +# never access removable ide devices, the drivers are causing event loops on open() +BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" -# persistent disk device links /dev/disk/ -KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -# Skip id for ram / loop / fd -KERNEL=="ram*", GOTO="no_volume_id" -KERNEL=="loop*", GOTO="no_volume_id" -KERNEL=="fd*", GOTO="no_volume_id" +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="sr*", GOTO="persistent_end" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -# volume-label/uuid -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" -KERNEL=="sr*", GOTO="no_volume_id" -KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" -KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -LABEL="no_volume_id" +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" LABEL="persistent_end" ##################################### -# Persistant block device stuff - end +# Persistent block device stuff - end ##################################### +ACTION=="add", SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" # Perhaps this should just be for all subsystems? @@ -307,11 +320,11 @@ ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="14", \ RUN+="/sbin/modprobe sd_mod" ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[45]", \ RUN+="/sbin/modprobe sr_mod" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="Onstream", \ +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", \ SYSFS{model}!="ADR*", RUN+="/sbin/modprobe osst" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="Onstream", \ +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", \ SYSFS{model}=="ADR*", RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}!="Onstream", \ +ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}!="On[sS]tream", \ RUN+="/sbin/modprobe st" ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[23689]", \ RUN+="/sbin/modprobe sg" -- cgit v1.2.3-54-g00ecf From 731a7d6d75fa412d676fd536ea282f33296f64cb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 4 Dec 2005 03:01:48 +0100 Subject: 077 release --- ChangeLog | 21 +++++++++++++++++++++ Makefile | 7 ++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 795de89707..e80def7759 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Summary of changes from v076 to v077 +============================================ + +Kay Sievers: + merge two consecutive static strlcat's + don't return an error, if "ignore_device" is used + remove outdated and misleading stuff + move SEQNUM event skipping to udevsend + update RELEASE-NOTES + update SUSE rules + allow programs in /lib/udev called without the path + update SUSE rules + add target to to generate ChangeLog section + update Red Hat rules + +Marco d'Itri: + allow to overwrite the configured udev_root by exporting UDEV_ROOT + let udevsend ignore events with SEQNUM set + update Debian rules + + Summary of changes from v75 to v076 ============================================ diff --git a/Makefile b/Makefile index d4ee3eb6be..cd789f82fd 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 076 +VERSION = 077 # set this to make use of syslog USE_LOG = true @@ -382,9 +382,10 @@ buildtest: ChangeLog: Makefile @ mv $@ $@.tmp - @ echo "Summary of changes from v$(VERSION) to v$(shell printf '%03i' $$(expr $(VERSION) + 1))" >> $@ + @ echo "Summary of changes from v$(shell printf '%03i' $$(expr $(VERSION) - 1)) to v$(VERSION)" >> $@ @ echo "============================================" >> $@ - @ git log --pretty=short $(VERSION)..HEAD | git shortlog >> $@ + @ echo >> $@ + @ git log --pretty=short $(shell printf '%03i' $$(expr $(VERSION) - 1))..HEAD | git shortlog >> $@ @ echo >> $@ @ cat $@ @ cat $@.tmp >> $@ -- cgit v1.2.3-54-g00ecf From 65e63a710e0369781c3632dd3fc95e4c72f9ab40 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 6 Dec 2005 19:00:40 +0100 Subject: optimize SELinux path match --- udev_selinux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_selinux.c b/udev_selinux.c index 6ec359edd4..f014ea5535 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -152,6 +152,7 @@ void selinux_init(void) * restoration creation purposes. */ if (is_selinux_running()) { + matchpathcon_init_prefix(NULL, "/dev"); if (getfscreatecon(&prev_scontext) < 0) { err("getfscreatecon failed\n"); prev_scontext = NULL; -- cgit v1.2.3-54-g00ecf From d992629180a4bbce84c28456057bf4e9c6bfce6e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Dec 2005 20:40:38 +0100 Subject: update README Signed-off-by: Kay Sievers --- README | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/README b/README index 9e1aae3452..21a6c186dc 100644 --- a/README +++ b/README @@ -31,22 +31,21 @@ Operation: Udev creates and removes device nodes in /dev, based on events the kernel sends out on device discovery or removal. - - Directly after mouting the real root filesystem, wherever that - happens, in initramfs or with a directly mounted root, /dev should get - a tmpfs filesystem mounted, which is populated from scratch by udev. - Created nodes or changed permissions don't survive a reboot. + - Early in the boot process, /dev should get a tmpfs filesystem + mounted, which is populated from scratch by udev. Created nodes or + changed permissions will not survive a reboot, which is intentional. - The content of /lib/udev/devices directory which contains the nodes, - symlinks and directories, which are always expected to be in/dev, should + symlinks and directories, which are always expected to be in /dev, should be copied over to the tmpfs mounted /dev, to provide the required nodes to initialize udev and continue booting. - The udevd daemon must be started by an init script to receive netlink - events from the kernel driver core. + uevents from the kernel driver core. - From kernel version 2.6.15 on, the hotplug helper /sbin/hotplug should - be disabled with an init script before the boot scripts are run and - kernel modules are loaded. + be disabled with an init script before actions like loading kernel + modules are taken, which may cause a lot of events. - All kernel events are matched against a set of specified rules in /etc/udev/rules.d/ which make it possible to hook into the event @@ -56,12 +55,8 @@ Operation: Compile Options: - prefix - Set this to the default root that you want to use. Only override - this if you really know what you are doing, even then, you probably - don't do the right thing. DESTDIR - Prefix for install target, used for package building. + Prefix of install target, used for package building. USE_LOG If set to 'true', udev is able to pass errors or debug information to syslog. This is very useful to see what udev is doing or not doing. @@ -95,7 +90,7 @@ Installation: - The default location for scripts and binaries that are called from rules is /lib/udev. Other packages who install udev rules, should use - that diretory too. + that directory too. - It is recommended to use the /lib/udev/devices directory to place device nodes and symlinks in, which are copied to /dev at every boot. -- cgit v1.2.3-54-g00ecf From ca93c2c6c4daee82c45c15dd321a38357d26586e Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 7 Dec 2005 13:59:32 -0800 Subject: Update Gentoo udev main rule file. --- etc/udev/gentoo/udev.rules | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 0c705f778d..6614c76394 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -36,6 +36,7 @@ SUBSYSTEM=="block", GROUP="disk" BUS=="ide", KERNEL=="hd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" BUS=="scsi", KERNEL="sr[0-9]*", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" BUS=="scsi", KERNEL="scd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" +BUS=="scsi", KERNEL="sg[0-9]*", ACTION=="add", DRIVER=="sr", GROUP="cdrom" ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%e", GROUP="cdrom" ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%e" ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%e" @@ -47,11 +48,11 @@ KERNEL=="dasd*", NAME="%k", GROUP="disk" KERNEL=="ataraid*", NAME="%k", GROUP="disk" # compaq smart array -KERNEL=="cciss*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" -KERNEL=="ida*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +KERNEL=="cciss*", PROGRAM="raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +KERNEL=="ida*", PROGRAM="raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" # mylex -KERNEL=="rd*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +KERNEL=="rd*", PROGRAM="raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" # dri devices KERNEL=="card*", NAME="dri/card%n", GROUP="video" @@ -177,12 +178,12 @@ BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" # v4l devices KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" -KERNEL=="radio[0-9]*", NAME="v4l/radio%n", GROUP="video" +KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" # dvb devices -KERNEL=="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video", MODE="0660" +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%i $${K%%%%.*} $${K#*.}'", NAME="%c" # Asterisk Zaptel devices KERNEL=="zapctl", NAME="zap/ctl" @@ -293,7 +294,7 @@ LABEL="persistent_end" ##################################### # usbfs-like device nodes -SUBSYSTEM="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems -- cgit v1.2.3-54-g00ecf From f3aef1a78eeb80f9234eb39d22965ad1f6e94b5d Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 7 Dec 2005 14:00:05 -0800 Subject: add parisc support to path_id As reported at http://bugs.gentoo.org/show_bug.cgi?id=113379 path_id doesn't work too well for parisc boxes. This patch from Jeroen Roovers fixes that. Signed-off-by: Greg Kroah-Hartman --- extras/path_id | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/path_id b/extras/path_id index 4ac718717a..dfb997b340 100755 --- a/extras/path_id +++ b/extras/path_id @@ -235,6 +235,11 @@ handle_block_scsi () { adapter="`echo $controller_dev | sed -e 's@/[^/]\{1,\}$@@;s@^.*/@@;s@^.*:@@'`" bus="gc" ;; + # PARISC devices + *parisc*) + adapter="${controler_dev##*/}" + bus=parisc; + ;; *) adapter="${controller_dev##*/}" bus="pci" -- cgit v1.2.3-54-g00ecf From d313632b04e2277306af74738df0b4444bcad695 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Thu, 15 Dec 2005 12:22:42 +0100 Subject: fold multiple consecutive whitespace chars into single '_' --- extras/scsi_id/scsi_id.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 39391f6e2e..aa1b16009e 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -677,13 +677,22 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, */ static void format_serial(char *serial) { - char *p = serial; + char *p = serial, *q; + q = p; while (*p != '\0') { - if (isspace(*p)) - *p = '_'; + if (isspace(*p)) { + if (q > serial && q[-1] != '_') { + *q = '_'; + q++; + } + } else { + *q = *p; + q++; + } p++; } + *q = '\0'; } /* -- cgit v1.2.3-54-g00ecf From c756114f8e78f2b7d17ac9f5c3e6cd76e3648601 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Dec 2005 12:30:25 +0100 Subject: allow C99 statements Signed-off-by: Kay Sievers --- Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index cd789f82fd..774d5e154a 100644 --- a/Makefile +++ b/Makefile @@ -133,20 +133,15 @@ HOSTCC = gcc STRIP = $(CROSS)strip STRIPCMD = $(STRIP) -s -# check if compiler option is supported -cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -xc /dev/null > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi;} - CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes -WARNINGS += $(call cc-supports, -Wdeclaration-after-statement, ) CFLAGS += $(WARNINGS) LDFLAGS = -Wl,-warn-common -# use -Os optimization if available, else use -O2 -OPTFLAGS := $(call cc-supports, -Os, -O2) +OPTFLAGS = -Os CFLAGS += $(OPTFLAGS) # include our local copy of libsysfs -- cgit v1.2.3-54-g00ecf From cbba4a544628b2f5d78cb15dadbc4e0f73f75eb3 Mon Sep 17 00:00:00 2001 From: Kurt Garloff Date: Thu, 15 Dec 2005 13:01:01 +0100 Subject: support pre-SPC3 page 83 format --- extras/scsi_id/scsi_serial.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index d1b1d94f53..14955e676c 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -558,6 +558,27 @@ static int check_fill_0x83_id(struct sysfs_device *scsi_dev, return 0; } +/* Extract the raw binary from VPD 0x83 pre-SPC devices */ +static int check_fill_0x83_prespc3(struct sysfs_device *scsi_dev, + unsigned char *page_83, + const struct scsi_id_search_values + *id_search, char *serial, int max_len) +{ + int i, j; + + serial[0] = hex_str[id_search->id_type]; + /* serial has been memset to zero before */ + j = strlen(serial); /* j = 1; */ + + for (i = 0; i < page_83[3]; ++i) { + serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; + serial[j++] = hex_str[ page_83[4+i] & 0x0f]; + } + dprintf("using pre-spc3-83 for %s.\n", scsi_dev->name); + return 0; +} + + /* Get device identification VPD page */ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, char *serial, int len) @@ -584,6 +605,33 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, * the form: "1 ". */ + /* + * Model 4, 5, and (some) model 6 EMC Symmetrix devices return + * a page 83 reply according to SCSI-2 format instead of SPC-2/3. + * + * The SCSI-2 page 83 format returns an IEEE WWN in binary + * encoded hexi-decimal in the 16 bytes following the initial + * 4-byte page 83 reply header. + * + * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part + * of an Identification descriptor. The 3rd byte of the first + * Identification descriptor is a reserved (BSZ) byte field. + * + * Reference the 7th byte of the page 83 reply to determine + * whether the reply is compliant with SCSI-2 or SPC-2/3 + * specifications. A zero value in the 7th byte indicates + * an SPC-2/3 conformant reply, (i.e., the reserved field of the + * first Identification descriptor). This byte will be non-zero + * for a SCSI-2 conformant page 83 reply from these EMC + * Symmetrix models since the 7th byte of the reply corresponds + * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, + * 0x006048. + */ + + if (page_83[6] != 0) + return check_fill_0x83_prespc3(scsi_dev, page_83, + id_search_list, serial, len); + /* * Search for a match in the prioritized id_search_list. */ -- cgit v1.2.3-54-g00ecf From 89a8f4e75e68aea378163a3c56b16f76cee407e0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Dec 2005 15:56:50 +0100 Subject: fix segfaulting create_floppy_devices Signed-off-by: Kay Sievers --- extras/floppy/create_floppy_devices.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index b2906106d4..91d3a58195 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -31,9 +31,9 @@ static char *table[] = { NULL }; -static int t360[] = { 1 }; -static int t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23 }; -static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, 17, 21, 22, 30 }; +static int t360[] = { 1, 0 }; +static int t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 }; +static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, 17, 21, 22, 30, 0 }; static int *table_sup[] = { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in }; @@ -112,7 +112,7 @@ int main(int argc, char **argv) i = 0; while (table_sup[type][i]) { - sprintf(node,"%s%s",dev,table[table_sup[type][i]]); + sprintf(node, "%s%s",dev, table[table_sup[type][i]]); minor = (table_sup[type][i] << 2) + fdnum; if (print_nodes) printf("%s b %d %d %d\n", node, mode, major, minor); -- cgit v1.2.3-54-g00ecf From 6317c213d0cffdf66faf644361877bf259aff756 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Dec 2005 16:05:37 +0100 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/05-udev-early.rules | 7 ++ etc/udev/suse/10-wait-for-sysfs.rules | 1 - etc/udev/suse/40-bluetooth.rules | 2 +- etc/udev/suse/50-udev-default.rules | 162 ++++++++++++++++++++++++++++++++ etc/udev/suse/50-udev.rules | 166 --------------------------------- etc/udev/suse/60-persistent-disk.rules | 48 ++++++++++ etc/udev/suse/60-persistent.rules | 48 ---------- etc/udev/suse/80-sysconfig.rules | 5 +- etc/udev/suse/95-debug.rules | 6 -- etc/udev/suse/95-udev-late.rules | 6 ++ 10 files changed, 227 insertions(+), 224 deletions(-) create mode 100644 etc/udev/suse/05-udev-early.rules delete mode 100644 etc/udev/suse/10-wait-for-sysfs.rules create mode 100644 etc/udev/suse/50-udev-default.rules delete mode 100644 etc/udev/suse/50-udev.rules create mode 100644 etc/udev/suse/60-persistent-disk.rules delete mode 100644 etc/udev/suse/60-persistent.rules delete mode 100644 etc/udev/suse/95-debug.rules create mode 100644 etc/udev/suse/95-udev-late.rules diff --git a/etc/udev/suse/05-udev-early.rules b/etc/udev/suse/05-udev-early.rules new file mode 100644 index 0000000000..ce159d56d3 --- /dev/null +++ b/etc/udev/suse/05-udev-early.rules @@ -0,0 +1,7 @@ +# sysfs is populated after the event is sent +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" + +# ignore these events until someone needs them +SUBSYSTEM=="drivers", OPTIONS="ignore_device" +SUBSYSTEM=="module", OPTIONS="ignore_device" + diff --git a/etc/udev/suse/10-wait-for-sysfs.rules b/etc/udev/suse/10-wait-for-sysfs.rules deleted file mode 100644 index 80c1781530..0000000000 --- a/etc/udev/suse/10-wait-for-sysfs.rules +++ /dev/null @@ -1 +0,0 @@ -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" diff --git a/etc/udev/suse/40-bluetooth.rules b/etc/udev/suse/40-bluetooth.rules index 7405d15b21..b6d706cabf 100644 --- a/etc/udev/suse/40-bluetooth.rules +++ b/etc/udev/suse/40-bluetooth.rules @@ -1,5 +1,5 @@ # bluetooth subsystem -SUBSYSTEM=="bluetooth", RUN+="/sbin/udev.bluetooth.sh" +SUBSYSTEM=="bluetooth", RUN+="/lib/udev/bluetooth.sh" # uncomment this if you have configured an automatic rfcomm-bind in # /etc/bluetooth/rfcomm.conf diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules new file mode 100644 index 0000000000..09f197da23 --- /dev/null +++ b/etc/udev/suse/50-udev-default.rules @@ -0,0 +1,162 @@ +# console +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="console", NAME="%k", MODE="600", OPTIONS="last_rule" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" + +# serial devices +KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" +KERNEL=="pppox*", NAME="%k", GROUP="uucp" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp" +KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" +KERNEL=="hvc*", NAME="%k", GROUP="uucp" +KERNEL=="hvsi*", NAME="%k", GROUP="uucp" +KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" +KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot" + +# video/graphics +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="graphics" GROUP="video" +KERNEL=="vtx*", NAME="%k", GROUP="video" +KERNEL=="vbi*", NAME="%k", GROUP="video" +KERNEL=="winradio*", NAME="%k", GROUP="video" +KERNEL=="vttuner*", NAME="%k", GROUP="video" +KERNEL=="nvidia*", NAME="%k", GROUP="video" +KERNEL=="nvidiactl*", NAME="%k", GROUP="video" +KERNEL=="video0", SYMLINK+="video" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="pmu", GROUP="video" + +# dvb +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" + +# input devices +KERNEL=="mice", NAME="input/%k", MODE="0640" +KERNEL=="mouse*", NAME="input/%k", MODE="0640" +KERNEL=="event*", NAME="input/%k", MODE="0640" +KERNEL=="js*", NAME="input/%k", MODE="0644" +KERNEL=="ts*", NAME="input/%k", MODE="0600" +KERNEL=="uinput", NAME="input/%k", MODE="0600" +KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" +KERNEL=="input[0-9]*", ACTION=="add", RUN+="input.sh" + +# printer +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp" +KERNEL=="irlpt*", NAME="%k", GROUP="lp" + +# cpu devices +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# IEEE1394 devices +KERNEL=="raw1394*", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" + +# 183 = /dev/hwrng Generic random number generator +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +# 219 /dev/modems/mwave MWave modem firmware upload +KERNEL=="mwave", NAME="modems/%k" +# 169 /dev/specialix_rioctl Specialix RIO serial control +KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" +# 167 /dev/specialix_sxctl Specialix serial control +KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" + +# network +KERNEL=="tun", NAME="net/%k", MODE="0600" + +# misc devices +KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" +KERNEL=="null", NAME="%k", MODE="666" +KERNEL=="zero", NAME="%k", MODE="666" +KERNEL=="full", NAME="%k", MODE="622" +KERNEL=="random", NAME="%k", MODE="666" +KERNEL=="urandom", NAME="%k", MODE="644" +KERNEL=="rtc", GROUP="audio" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", MODE="0600", GROUP="video" +KERNEL=="djs*", NAME="%k", MODE="644" +KERNEL=="sgi_*", NAME="%k", MODE="666" +KERNEL=="rrom*", NAME="%k", MODE="400" +KERNEL=="rflash*", NAME="%k", MODE="400" +KERNEL=="usbscanner*", NAME="%k", MODE="644" +KERNEL=="3270/ttycons*", NAME="%k", MODE="600" +KERNEL=="3270/tub*", NAME="%k", MODE="666" +KERNEL=="3270/tubcons*", NAME="%k", MODE="600" +KERNEL=="ica", NAME="%k", MODE="666" +KERNEL=="z90crypt", NAME="%k", MODE="666" +KERNEL=="mmtimer", NAME="%k", MODE="444" +KERNEL=="auer[0-9]*" NAME="usb/%k" + +# packet writing interface +KERNEL=="pktcdvd", NAME="pktcdvd/control" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" + +# fix floppy devices +KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" +KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/rm -f $root/%k*" + +# block devices +SUBSYSTEM=="block", GROUP="disk", MODE="0640" + +# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC +# sr: 4 TYPE_WORM, 5 TYPE_ROM +# st/osst: 1 TYPE_TAPE +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys/$DEVPATH/timeout'" +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys/$DEVPATH/timeout'" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" + +# load IDE modules +SUBSYSTEM=="ide", ACTION=="add", RUN+="ide.sh" + +# device mapper +KERNEL=="device-mapper", NAME="%k", SYMLINK+="mapper/control" + +# check fstab and possibly mount +SUBSYSTEM=="block", ACTION=="add", KERNEL=="sd*[0-9]|hd*[0-9]", RUN+="mount.sh" + +# misc storage devices (non-block) +KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" +KERNEL=="st*", NAME="%k", GROUP="disk" +KERNEL=="nst*", NAME="%k", GROUP="disk" +KERNEL=="initrd", NAME="%k", GROUP="disk" +KERNEL=="qft*", NAME="%k", GROUP="disk" +KERNEL=="nqft*", NAME="%k", GROUP="disk" +KERNEL=="zqft*", NAME="%k", GROUP="disk" +KERNEL=="nzqft*", NAME="%k", GROUP="disk" +KERNEL=="rawqft*", NAME="%k", GROUP="disk" +KERNEL=="nrawqft*", NAME="%k", GROUP="disk" +KERNEL=="pf*", NAME="%k", GROUP="disk" +KERNEL=="sch*", NAME="%k", GROUP="disk" +KERNEL=="pt*", NAME="%k", GROUP="disk" +KERNEL=="npt*", NAME="%k", GROUP="disk" +KERNEL=="pg*", NAME="%k", GROUP="disk" +KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" +KERNEL=="rawctl*", NAME="%k", GROUP="disk" +KERNEL=="osst*", NAME="%k", GROUP="disk" +KERNEL=="nosst*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" + +# libusb device access +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" + +# kernel firmware loader +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" + diff --git a/etc/udev/suse/50-udev.rules b/etc/udev/suse/50-udev.rules deleted file mode 100644 index 51561ffd0f..0000000000 --- a/etc/udev/suse/50-udev.rules +++ /dev/null @@ -1,166 +0,0 @@ -# ignore these events until someone needs them -SUBSYSTEM=="drivers", OPTIONS="last_rule" -SUBSYSTEM=="module", OPTIONS="last_rule" - -# console -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", MODE="600", OPTIONS="last_rule" -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" - -# serial devices -KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" -KERNEL=="pppox*", NAME="%k", GROUP="uucp" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp" -KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" -KERNEL=="hvc*", NAME="%k", GROUP="uucp" -KERNEL=="hvsi*", NAME="%k", GROUP="uucp" -KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" -KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot" - -# video/graphics -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="graphics" GROUP="video" -KERNEL=="vtx*", NAME="%k", GROUP="video" -KERNEL=="vbi*", NAME="%k", GROUP="video" -KERNEL=="winradio*", NAME="%k", GROUP="video" -KERNEL=="vttuner*", NAME="%k", GROUP="video" -KERNEL=="nvidia*", NAME="%k", GROUP="video" -KERNEL=="nvidiactl*", NAME="%k", GROUP="video" -KERNEL=="video0", SYMLINK+="video" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="vbi0", SYMLINK+="vbi" -KERNEL=="pmu", GROUP="video" - -# dvb -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" - -# Kino jogshuttle support -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="b33/10/*", RUN+="/usr/bin/killall --quiet -USR2 kino" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="5f3/240/*", RUN+="/usr/bin/killall --quiet -USR2 kino" - -# input devices -KERNEL=="mice", NAME="input/%k", MODE="0640" -KERNEL=="mouse*", NAME="input/%k", MODE="0640" -KERNEL=="event*", NAME="input/%k", MODE="0640" -KERNEL=="js*", NAME="input/%k", MODE="0644" -KERNEL=="ts*", NAME="input/%k", MODE="0600" -KERNEL=="uinput", NAME="input/%k", MODE="0600" -KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" -KERNEL=="input[0-9]*", ACTION=="add", RUN+="/lib/udev/input.sh" - -# printer -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp" -KERNEL=="irlpt*", NAME="%k", GROUP="lp" - -# cpu devices -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" - -# IEEE1394 devices -KERNEL=="raw1394*", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" - -# 183 = /dev/hwrng Generic random number generator -KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" -# 219 /dev/modems/mwave MWave modem firmware upload -KERNEL=="mwave", NAME="modems/%k" -# 169 /dev/specialix_rioctl Specialix RIO serial control -KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" -# 167 /dev/specialix_sxctl Specialix serial control -KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" - -# misc devices -KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" -KERNEL=="null", NAME="%k", MODE="666" -KERNEL=="zero", NAME="%k", MODE="666" -KERNEL=="full", NAME="%k", MODE="622" -KERNEL=="random", NAME="%k", MODE="666" -KERNEL=="urandom", NAME="%k", MODE="644" -KERNEL=="rtc", GROUP="audio" -KERNEL=="sonypi", MODE="0666" -KERNEL=="agpgart", MODE="0600", GROUP="video" -KERNEL=="djs*", NAME="%k", MODE="644" -KERNEL=="sgi_*", NAME="%k", MODE="666" -KERNEL=="rrom*", NAME="%k", MODE="400" -KERNEL=="rflash*", NAME="%k", MODE="400" -KERNEL=="usbscanner*", NAME="%k", MODE="644" -KERNEL=="3270/ttycons*", NAME="%k", MODE="600" -KERNEL=="3270/tub*", NAME="%k", MODE="666" -KERNEL=="3270/tubcons*", NAME="%k", MODE="600" -KERNEL=="ica", NAME="%k", MODE="666" -KERNEL=="z90crypt", NAME="%k", MODE="666" -KERNEL=="mmtimer", NAME="%k", MODE="444" -KERNEL=="auer[0-9]*" NAME="usb/%k" - -KERNEL=="pktcdvd", NAME="pktcdvd/control" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" - -# fix floppy devices -KERNEL=="nvram", ACTION=="add", RUN+="/lib/udev/load_floppy_module.sh" -KERNEL=="fd*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="/lib/udev/create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" -KERNEL=="fd*", ACTION=="remove", RUN+="/lib/udev/remove_floppy_devices.sh %k" - -# block devices -SUBSYSTEM=="block", GROUP="disk", MODE="0640" - -# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC -# sr: 4 TYPE_WORM, 5 TYPE_ROM -# st/osst: 1 TYPE_TAPE -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys/$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys/$DEVPATH/timeout'" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" - -# IDE modules -SUBSYSTEM=="ide", ACTION=="add", RUN+="/lib/udev/ide.sh" - -# device mapper -KERNEL=="device-mapper", ACTION=="add", NAME="%k", SYMLINK+="mapper/control" - -# check fstab and possibly mount -SUBSYSTEM=="block", KERNEL=="sd*[0-9]|hd*[0-9]", ACTION=="add", RUN+="/lib/udev/mount.sh" - -# misc storage devices (non-block) -KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" -KERNEL=="st*", NAME="%k", GROUP="disk" -KERNEL=="nst*", NAME="%k", GROUP="disk" -KERNEL=="initrd", NAME="%k", GROUP="disk" -KERNEL=="qft*", NAME="%k", GROUP="disk" -KERNEL=="nqft*", NAME="%k", GROUP="disk" -KERNEL=="zqft*", NAME="%k", GROUP="disk" -KERNEL=="nzqft*", NAME="%k", GROUP="disk" -KERNEL=="rawqft*", NAME="%k", GROUP="disk" -KERNEL=="nrawqft*", NAME="%k", GROUP="disk" -KERNEL=="pf*", NAME="%k", GROUP="disk" -KERNEL=="sch*", NAME="%k", GROUP="disk" -KERNEL=="pt*", NAME="%k", GROUP="disk" -KERNEL=="npt*", NAME="%k", GROUP="disk" -KERNEL=="pg*", NAME="%k", GROUP="disk" -KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" -KERNEL=="rawctl*", NAME="%k", GROUP="disk" -KERNEL=="osst*", NAME="%k", GROUP="disk" -KERNEL=="nosst*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" - -# libusb device access -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" - -# firmware loader -SUBSYSTEM=="firmware", ACTION=="add", RUN+="/lib/udev/firmware.sh" - diff --git a/etc/udev/suse/60-persistent-disk.rules b/etc/udev/suse/60-persistent-disk.rules new file mode 100644 index 0000000000..3515bb189d --- /dev/null +++ b/etc/udev/suse/60-persistent-disk.rules @@ -0,0 +1,48 @@ +# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" + +# never access removable ide devices, the drivers are causing event loops on open() +BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="sr*", GOTO="persistent_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" + +LABEL="persistent_end" diff --git a/etc/udev/suse/60-persistent.rules b/etc/udev/suse/60-persistent.rules deleted file mode 100644 index 0d24a29338..0000000000 --- a/etc/udev/suse/60-persistent.rules +++ /dev/null @@ -1,48 +0,0 @@ -# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" - -# never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" - -LABEL="persistent_end" diff --git a/etc/udev/suse/80-sysconfig.rules b/etc/udev/suse/80-sysconfig.rules index d33d975b36..7073813c61 100644 --- a/etc/udev/suse/80-sysconfig.rules +++ b/etc/udev/suse/80-sysconfig.rules @@ -1,7 +1,6 @@ ENV{SYSCONFIG}=="no|off|0", GOTO="sysconfig_end" -# network devices -KERNEL=="tun", NAME="net/%k", MODE="0600" +# SUSE network device handling SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug" SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" @@ -16,5 +15,7 @@ SUBSYSTEM=="macio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-%p -o hotplug" SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-%p -o hotplug" SUBSYSTEM=="pnp", ACTION=="add", RUN+="/sbin/hwup pnp-devpath-%p -o hotplug" +#SUBSYSTEM=="ide", ACTION=="add", RUN+="/sbin/hwup ide-devpath-%p -o hotplug" +#SUBSYSTEM=="input", KERNEL=="input[0-9]*", ACTION=="add", RUN+="/sbin/hwup input-devpath-%p -o hotplug" LABEL="sysconfig_end" diff --git a/etc/udev/suse/95-debug.rules b/etc/udev/suse/95-debug.rules deleted file mode 100644 index 280287c1a7..0000000000 --- a/etc/udev/suse/95-debug.rules +++ /dev/null @@ -1,6 +0,0 @@ -# debug events to /events, but not on default udev_log="err" -ENV{UDEV_LOG}=="[4-9]", RUN+="/lib/udev/eventrecorder.sh" - -# event to be catched by udevmonitor -RUN+="socket:/org/kernel/udev/monitor" - diff --git a/etc/udev/suse/95-udev-late.rules b/etc/udev/suse/95-udev-late.rules new file mode 100644 index 0000000000..81331ad6b7 --- /dev/null +++ b/etc/udev/suse/95-udev-late.rules @@ -0,0 +1,6 @@ +# debug events to /events, but not on default udev_log="err" +ENV{UDEV_LOG}=="[4-9]", RUN+="eventrecorder.sh" + +# event to be catched by udevmonitor +RUN+="socket:/org/kernel/udev/monitor" + -- cgit v1.2.3-54-g00ecf From 632b682b2a1b4b71500a633369668b0cc7379bcd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Dec 2005 21:00:14 +0100 Subject: remove unused variables Signed-off-by: Kay Sievers --- udev.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/udev.h b/udev.h index faa12a31ee..474f3f5e25 100644 --- a/udev.h +++ b/udev.h @@ -76,8 +76,6 @@ struct udevice { int partitions; int ignore_device; int ignore_remove; - int config_line; - char config_file[PATH_SIZE]; char bus_id[NAME_SIZE]; char program_result[PATH_SIZE]; char kernel_number[NAME_SIZE]; -- cgit v1.2.3-54-g00ecf From c602535043cbe74dfdcc5f2926e8518237602694 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Dec 2005 21:16:32 +0100 Subject: remove default settings in udev.conf Changing the default values in udev.conf will render allmost all current systems unusable. So just remove the settings that can't be changed anyway. Signed-off-by: Kay Sievers --- etc/udev/udev.conf.in | 6 ------ udev_add.c | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in index a92f688c3a..41902c4f06 100644 --- a/etc/udev/udev.conf.in +++ b/etc/udev/udev.conf.in @@ -1,11 +1,5 @@ # udev.conf -# Where in the filesystem to place the device nodes. -udev_root="@udevdir@" - -# The name and location of the udev rules file(s). -udev_rules="@configdir@/rules.d" - # The initial syslog(3) priority: "err", "info", "debug" or its # numerical equivalent. For runtime debugging, the daemons internal # state can be changed with: "udevcontrol log_priority=". diff --git a/udev_add.c b/udev_add.c index 128917e519..174474bdc7 100644 --- a/udev_add.c +++ b/udev_add.c @@ -272,8 +272,7 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) goto exit; if (udev_db_add_device(udev) != 0) - dbg("udev_db_add_dev failed, but we create the node anyway, " - "remove might not work for custom names"); + dbg("udev_db_add_dev failed, remove might not work for custom names"); /* use full path to the environment */ snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); -- cgit v1.2.3-54-g00ecf From d2e7c6bf67b1b0d1f5d12ac533131c73bc046454 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 17 Dec 2005 00:27:19 +0100 Subject: clearenv() is now part of klibc Signed-off-by: Kay Sievers --- udev_libc_wrapper.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 824603b74c..a4d320fef2 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -138,14 +138,6 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) #define SO_RCVBUFFORCE 33 #endif -#ifdef __KLIBC__ -static inline int clearenv(void) -{ - environ[0] = NULL; - return 0; -} -#endif - extern uid_t lookup_user(const char *user); extern gid_t lookup_group(const char *group); -- cgit v1.2.3-54-g00ecf From fb6e4c28248cdeed30a1d3eb42aba477f0429472 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 17 Dec 2005 16:20:51 +0100 Subject: add DEVLINKS to the event environment Multiple symlinks are separated by a space character. Signed-off-by: Kay Sievers --- RELEASE-NOTES | 10 +++++++ udev.h | 1 - udev_add.c | 93 ++++++++++++++++++++++++++++++----------------------------- udev_event.c | 4 --- udev_remove.c | 7 +++-- udevstart.c | 2 -- 6 files changed, 62 insertions(+), 55 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4006e510d7..19af28fb66 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,13 @@ +udev 078 +======== +Symlinks are now exported to the event environment. Hopefully it's no +longer needed to run udevinfo from an event process, like it was +mentioned on the hotplug list: + UDEV [1134776873.702967] add@/block/sdb + ... + DEVNAME=/dev/sdb + DEVLINKS=/dev/disk/by-id/usb-IBM_Memory_Key_0218B301030027E8 /dev/disk/by-path/usb-0218B301030027E8:0:0:0 + udev 077 ======== Fix a problem if udevsend is used as the hotplug handler and tries to use diff --git a/udev.h b/udev.h index 474f3f5e25..ca99da512d 100644 --- a/udev.h +++ b/udev.h @@ -58,7 +58,6 @@ struct udevice { enum device_type type; char name[PATH_SIZE]; - char devname[PATH_SIZE]; struct list_head symlink_list; int symlink_final; char owner[USER_SIZE]; diff --git a/udev_add.c b/udev_add.c index 174474bdc7..bf2d59d198 100644 --- a/udev_add.c +++ b/udev_add.c @@ -108,7 +108,6 @@ exit: static int create_node(struct udevice *udev, struct sysfs_class_device *class_dev) { char filename[PATH_SIZE]; - char partitionname[PATH_SIZE]; struct name_entry *name_loop; uid_t uid; gid_t gid; @@ -152,6 +151,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de info("creating device node '%s'", filename); if (udev_make_node(udev, filename, udev->devt, udev->mode, uid, gid) != 0) goto error; + setenv("DEVNAME", filename, 1); } else { info("creating device node '%s', major = '%d', minor = '%d', " "mode = '%#o', uid = '%d', gid = '%d'", filename, @@ -160,6 +160,7 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de /* create all_partitions if requested */ if (udev->partitions) { + char partitionname[PATH_SIZE]; struct sysfs_attribute *attr; int range; @@ -184,45 +185,55 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de } /* create symlink(s) if requested */ - list_for_each_entry(name_loop, &udev->symlink_list, node) { - int retval; - char linktarget[PATH_SIZE]; - - snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); - filename[sizeof(filename)-1] = '\0'; - - dbg("symlink '%s' to node '%s' requested", filename, udev->name); - if (!udev->test_run) - if (strchr(filename, '/')) - create_path(filename); - - /* optimize relative link */ - linktarget[0] = '\0'; - i = 0; - tail = 0; - while (udev->name[i] && (udev->name[i] == name_loop->name[i])) { - if (udev->name[i] == '/') - tail = i+1; - i++; - } - while (name_loop->name[i] != '\0') { - if (name_loop->name[i] == '/') - strlcat(linktarget, "../", sizeof(linktarget)); - i++; - } + if (!list_empty(&udev->symlink_list)) { + char symlinks[512] = ""; + + list_for_each_entry(name_loop, &udev->symlink_list, node) { + int retval; + char linktarget[PATH_SIZE]; + + snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); + filename[sizeof(filename)-1] = '\0'; + + dbg("symlink '%s' to node '%s' requested", filename, udev->name); + if (!udev->test_run) + if (strchr(filename, '/')) + create_path(filename); + + /* optimize relative link */ + linktarget[0] = '\0'; + i = 0; + tail = 0; + while (udev->name[i] && (udev->name[i] == name_loop->name[i])) { + if (udev->name[i] == '/') + tail = i+1; + i++; + } + while (name_loop->name[i] != '\0') { + if (name_loop->name[i] == '/') + strlcat(linktarget, "../", sizeof(linktarget)); + i++; + } - strlcat(linktarget, &udev->name[tail], sizeof(linktarget)); + strlcat(linktarget, &udev->name[tail], sizeof(linktarget)); + + info("creating symlink '%s' to '%s'", filename, linktarget); + if (!udev->test_run) { + unlink(filename); + selinux_setfscreatecon(filename, NULL, S_IFLNK); + retval = symlink(linktarget, filename); + selinux_resetfscreatecon(); + if (retval != 0) + err("symlink(%s, %s) failed: %s", + linktarget, filename, strerror(errno)); + } - info("creating symlink '%s' to '%s'", filename, linktarget); - if (!udev->test_run) { - unlink(filename); - selinux_setfscreatecon(filename, NULL, S_IFLNK); - retval = symlink(linktarget, filename); - selinux_resetfscreatecon(); - if (retval != 0) - err("symlink(%s, %s) failed: %s", - linktarget, filename, strerror(errno)); + strlcat(symlinks, filename, sizeof(symlinks)); + strlcat(symlinks, " ", sizeof(symlinks)); } + + remove_trailing_chars(symlinks, ' '); + setenv("DEVLINKS", symlinks, 1); } return 0; @@ -273,11 +284,6 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) if (udev_db_add_device(udev) != 0) dbg("udev_db_add_dev failed, remove might not work for custom names"); - - /* use full path to the environment */ - snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); - udev->devname[sizeof(udev->devname)-1] = '\0'; - } else if (udev->type == DEV_NET) { /* look if we want to change the name of the netif */ if (strcmp(udev->name, udev->kernel_name) != 0) { @@ -298,9 +304,6 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) setenv("DEVPATH", udev->devpath, 1); setenv("INTERFACE", udev->name, 1); } - - /* use netif name for the environment */ - strlcpy(udev->devname, udev->name, sizeof(udev->devname)); } } diff --git a/udev_event.c b/udev_event.c index 0b4b9dc495..887537e0e9 100644 --- a/udev_event.c +++ b/udev_event.c @@ -130,10 +130,6 @@ int udev_process_event(struct udev_rules *rules, struct udevice *udev) return 0; } } - - /* export name of device node or netif */ - if (udev->devname[0] != '\0') - setenv("DEVNAME", udev->devname, 1); } else if (udev->type == DEV_DEVICE && strcmp(udev->action, "add") == 0) { struct sysfs_device *devices_dev; diff --git a/udev_remove.c b/udev_remove.c index 6efa17eb7c..f9592b4c70 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -37,6 +37,7 @@ static int delete_node(struct udevice *udev) { char filename[PATH_SIZE]; + char devname[PATH_SIZE]; char partitionname[PATH_SIZE]; struct name_entry *name_loop; struct stat stats; @@ -81,9 +82,9 @@ static int delete_node(struct udevice *udev) if (retval) return retval; - /* export DEVNAME to the environment */ - snprintf(udev->devname, sizeof(udev->devname), "%s/%s", udev_root, udev->name); - udev->devname[sizeof(udev->devname)-1] = '\0'; + snprintf(devname, sizeof(devname), "%s/%s", udev_root, udev->name); + devname[sizeof(devname)-1] = '\0'; + setenv("DEVNAME", devname, 1); num = udev->partitions; if (num > 0) { diff --git a/udevstart.c b/udevstart.c index 11063f6799..a9959c5d6b 100644 --- a/udevstart.c +++ b/udevstart.c @@ -155,8 +155,6 @@ static int add_device(const char *devpath, const char *subsystem) } udev_add_device(&udev, class_dev); - if (udev.devname[0] != '\0') - setenv("DEVNAME", udev.devname, 1); run: if (udev_run && !list_empty(&udev.run_list)) { struct name_entry *name_loop; -- cgit v1.2.3-54-g00ecf From ba65db20cfa6754ed7e0d0c5ecc82a58f481e070 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 17 Dec 2005 16:40:29 +0100 Subject: 078 release --- ChangeLog | 27 +++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e80def7759..71df29fc20 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +Summary of changes from v077 to v078 +============================================ + +Greg Kroah-Hartman: + Update Gentoo udev main rule file. + add parisc support to path_id + +Hannes Reinecke: + scsi_id: -u fold multiple consecutive whitespace chars into single '_' + +Harald Hoyer: + optimize SELinux path match + +Kay Sievers: + update README + allow C99 statements + fix segfaulting create_floppy_devices + update SUSE rules + remove unused variables + remove default settings in udev.conf + clearenv() is now part of klibc + add DEVLINKS to the event environment + +Kurt Garloff: + scsi_id: support pre-SPC3 page 83 format + + Summary of changes from v076 to v077 ============================================ diff --git a/Makefile b/Makefile index 774d5e154a..8d80ce5dc7 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 077 +VERSION = 078 # set this to make use of syslog USE_LOG = true -- cgit v1.2.3-54-g00ecf From caa4fd85aeff9c40897d34fba09b4fb7c18d2198 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 20 Dec 2005 11:23:08 +0100 Subject: don't log error if database does not exist Signed-off-by: Kay Sievers --- udev_db.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_db.c b/udev_db.c index 6e9a1187d0..6b9d5e8426 100644 --- a/udev_db.c +++ b/udev_db.c @@ -212,7 +212,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); dir = opendir(dbpath); if (dir == NULL) { - err("unable to open udev_db '%s': %s", dbpath, strerror(errno)); + info("no udev_db available '%s': %s", dbpath, strerror(errno)); return -1; } @@ -283,7 +283,7 @@ int udev_db_get_all_entries(struct list_head *name_list) strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); dir = opendir(dbpath); if (dir == NULL) { - err("unable to open udev_db '%s': %s", dbpath, strerror(errno)); + info("no udev_db available '%s': %s", dbpath, strerror(errno)); return -1; } -- cgit v1.2.3-54-g00ecf From 1698d39857e105876011b95e82d44c5e1e0846f2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Dec 2005 17:29:20 +0100 Subject: use udev_root instead of "/dev"in selinux matchpathcon_init_prefix() Taken from Red Hat CVS: udev-075-selinux.patch --- udev_selinux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_selinux.c b/udev_selinux.c index f014ea5535..1e1fdb9617 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -152,7 +152,7 @@ void selinux_init(void) * restoration creation purposes. */ if (is_selinux_running()) { - matchpathcon_init_prefix(NULL, "/dev"); + matchpathcon_init_prefix(NULL, udev_root); if (getfscreatecon(&prev_scontext) < 0) { err("getfscreatecon failed\n"); prev_scontext = NULL; -- cgit v1.2.3-54-g00ecf From 892532a9395d6b2c9cbaddde8b658fefa13bf7dc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2005 00:06:54 +0100 Subject: scsi_id: read page 0x80 with libata drives Signed-off-by: Kay Sievers --- extras/scsi_id/scsi_id.config | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) diff --git a/extras/scsi_id/scsi_id.config b/extras/scsi_id/scsi_id.config index 4f31b1c498..d1768509ad 100644 --- a/extras/scsi_id/scsi_id.config +++ b/extras/scsi_id/scsi_id.config @@ -1,11 +1,8 @@ # -# Informational and example scsi_id.config file for use with scsi_id. -# - -# General syntax is: +# scsi_id configuration # # lower or upper case has no affect on the left side. Quotes (") are -# required if you need spaces in values. Model is the same as the SCSI +# required for spaces in values. Model is the same as the SCSI # INQUIRY product identification field. Per the SCSI INQUIRY, the vendor # is limited to 8 bytes, model to 16 bytes. # @@ -13,36 +10,8 @@ # if you do not want such a match space fill the extra bytes. If no model # is specified, only the vendor string need match. # -# The "options" line is searched for when scsi_id starts up, and is -# primarily for use with hotplug. -# # options= -# # vendor=string[,model=string],options= -# -# If you normally don't need scsi id's, or might be attaching devices of -# an unknown functionality, black list everyone. This is the default -# behaviour (if no -b or -g is specified). -# -options=-b - -# -# Then white list devices on your system that have correct and useful id's: -# -vendor=someone, model=nicedrive, options=-g - -# If you know all the scsi devices on your system support valid id's, -# remove the options=-b line, and mark all devices as good: - -## options=-g - -# Then black list any offenders. Missing entries here could be dangerous -# if you rely on the id for persistent naming or multi-path configuration. - -## vendor=ELBONIA, model=borken, options=-b - -# EMC SYMMETRIX models 4 and 5, and some model 6 systems return the VSI -# field of the page 83 reply according to SCSI-2 format. This format is -# binary encoded hexa-decimal as opposed to the Identifiscation descriptor -# utilized by both SPC-2 and SPC-3 compliant systems. +# some libata drives require vpd page 0x80 +vendor="ATA",options=-p 0x80 -- cgit v1.2.3-54-g00ecf From d69b2203c37d32bbfbd81153a1fc99b55b7b6cbb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2005 00:13:34 +0100 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/persistent-disk.rules | 48 +++++++++++++++++++++++++++++++++++++ etc/udev/persistent.rules | 47 ------------------------------------ etc/udev/suse/05-udev-early.rules | 1 + etc/udev/suse/50-udev-default.rules | 5 +--- etc/udev/suse/80-sysconfig.rules | 2 +- 5 files changed, 51 insertions(+), 52 deletions(-) create mode 100644 etc/udev/persistent-disk.rules delete mode 100644 etc/udev/persistent.rules diff --git a/etc/udev/persistent-disk.rules b/etc/udev/persistent-disk.rules new file mode 100644 index 0000000000..3515bb189d --- /dev/null +++ b/etc/udev/persistent-disk.rules @@ -0,0 +1,48 @@ +# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" + +# never access removable ide devices, the drivers are causing event loops on open() +BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="sr*", GOTO="persistent_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" + +LABEL="persistent_end" diff --git a/etc/udev/persistent.rules b/etc/udev/persistent.rules deleted file mode 100644 index 0b231aacd5..0000000000 --- a/etc/udev/persistent.rules +++ /dev/null @@ -1,47 +0,0 @@ -# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" - -# never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -LABEL="persistent_end" - diff --git a/etc/udev/suse/05-udev-early.rules b/etc/udev/suse/05-udev-early.rules index ce159d56d3..dfdbdff0c9 100644 --- a/etc/udev/suse/05-udev-early.rules +++ b/etc/udev/suse/05-udev-early.rules @@ -1,5 +1,6 @@ # sysfs is populated after the event is sent ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" # ignore these events until someone needs them SUBSYSTEM=="drivers", OPTIONS="ignore_device" diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 09f197da23..fe861ae972 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -33,7 +33,7 @@ KERNEL=="vbi0", SYMLINK+="vbi" KERNEL=="pmu", GROUP="video" # dvb -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" # input devices KERNEL=="mice", NAME="input/%k", MODE="0640" @@ -127,9 +127,6 @@ SUBSYSTEM=="ide", ACTION=="add", RUN+="ide.sh" # device mapper KERNEL=="device-mapper", NAME="%k", SYMLINK+="mapper/control" -# check fstab and possibly mount -SUBSYSTEM=="block", ACTION=="add", KERNEL=="sd*[0-9]|hd*[0-9]", RUN+="mount.sh" - # misc storage devices (non-block) KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" KERNEL=="st*", NAME="%k", GROUP="disk" diff --git a/etc/udev/suse/80-sysconfig.rules b/etc/udev/suse/80-sysconfig.rules index 7073813c61..d6778647ba 100644 --- a/etc/udev/suse/80-sysconfig.rules +++ b/etc/udev/suse/80-sysconfig.rules @@ -9,7 +9,7 @@ SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-%p -o hotplug" SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-%p -o hotplug" SUBSYSTEM=="scsi", DEVPATH=="/devices/css*", ACTION=="remove", RUN+="/sbin/hwdown scsi-devpath-%p -o hotplug" -SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{device/cutype}=="?*", RUN+="/sbin/hwup scsi__host-devpath-%p -o hotplug" +SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{proc_name}=="zfcp", RUN+="/sbin/hwup scsi_host-devpath-%p -o hotplug" SUBSYSTEM=="vio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" SUBSYSTEM=="macio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-%p -o hotplug" -- cgit v1.2.3-54-g00ecf From c082b99acbc4b25fd133a88bfabf68eee23d7b0b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2005 00:49:02 +0100 Subject: remove %e from man page Simple %e enumerations never worked reliably outside of udevstart and udevstart is no longer recommended to use. Signed-off-by: Kay Sievers --- docs/udev.xml | 18 ++---------------- udev.8 | 11 ++--------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/docs/udev.xml b/docs/udev.xml index 3db66f8001..8c07f0e687 100644 --- a/docs/udev.xml +++ b/docs/udev.xml @@ -42,9 +42,7 @@ Usually udev runs as udevd 8 and receives uevents directly from the - kernel if a device is added or removed form the system. The program - udev itself may be used as an event handler in situations, - where running the daemon is not appropriate, like in initramfs. + kernel if a device is added or removed form the system. If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. @@ -393,7 +391,7 @@ - , + , The value of an environment variable. @@ -424,18 +422,6 @@ - - , - - If a device node already exists with the name, the smallest next free - number is used. This can be used to create compatibility symlinks and enumerate - devices of the same type originating from different kernel subsystems. - Note: The use of the enumeration facility is unreliable for events that - request a number at the same time. The use of enumerations in todays setups - where devices can come and go at any time is not recommended. - - - , diff --git a/udev.8 b/udev.8 index 2ea5812092..c6ab83e805 100644 --- a/udev.8 +++ b/udev.8 @@ -17,9 +17,7 @@ directory, or it renames network interfaces. .PP Usually udev runs as \fBudevd\fR(8) -and receives uevents directly from the kernel if a device is added or removed form the system. The program -\fBudev\fR -itself may be used as an event handler in situations, where running the daemon is not appropriate, like in initramfs. +and receives uevents directly from the kernel if a device is added or removed form the system. .PP If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. Rules that match, may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling. .SH "CONFIGURATION" @@ -182,7 +180,7 @@ The devpath of the device. \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR, \fB$sysfs{\fR\fB\fIfile\fR\fR\fB}\fR The content of a sysfs attribute. .TP -\fB%e{\fR\fB\fIkey\fR\fR\fB}\fR, \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR +\fB%E{\fR\fB\fIkey\fR\fR\fB}\fR, \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR The value of an environment variable. .TP \fB%m\fR, \fB$major\fR @@ -196,11 +194,6 @@ The string returned by the external program requested with PROGRAM. A single par \fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: \fB%c{N+}\fR .TP -\fB%e\fR, \fB$enum\fR -If a device node already exists with the name, the smallest next free number is used. This can be used to create compatibility symlinks and enumerate devices of the same type originating from different kernel subsystems. - -Note: The use of the enumeration facility is unreliable for events that request a number at the same time. The use of enumerations in todays setups where devices can come and go at any time is not recommended. -.TP \fB%P\fR, \fB$parent\fR The node name of the parent device. .TP -- cgit v1.2.3-54-g00ecf From e2e8e5ce960ad79d8e5380303e770302570534af Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2005 00:51:30 +0100 Subject: 079 release --- ChangeLog | 10 ++++++++++ Makefile | 2 +- RELEASE-NOTES | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 71df29fc20..cba96f91a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Summary of changes from v078 to v079 +============================================ + +Kay Sievers: + don't log error if database does not exist + use udev_root instead of "/dev"in selinux matchpathcon_init_prefix() + scsi_id: read page 0x80 with libata drives + update SUSE rules + remove %e from man page + Summary of changes from v077 to v078 ============================================ diff --git a/Makefile b/Makefile index 8d80ce5dc7..f5c71a6f80 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 078 +VERSION = 079 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 19af28fb66..f7839b6893 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,13 @@ +udev 079 +======== +Let scsi_id request libata drive serial numbers from page 0x80. + +Renamed etc/udev/persistent.rules to persistent-disk.rules and +added /dev/disk/by-name/* for device mapper device names. + +Removed %e from the man page. It never worked reliably outside +of udevstart and udevstart is no longer recommended to use. + udev 078 ======== Symlinks are now exported to the event environment. Hopefully it's no -- cgit v1.2.3-54-g00ecf From 68cfe3b5c851eb4c21e73720049f00ad87fcd5b8 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 26 Dec 2005 17:21:25 +0100 Subject: udev_selinux.c: include udev.h --- udev_selinux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_selinux.c b/udev_selinux.c index 1e1fdb9617..298c75566c 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -30,6 +30,7 @@ #include #include +#include "udev.h" #include "udev_selinux.h" #include "logging.h" -- cgit v1.2.3-54-g00ecf From a5e551b996f81709d9f53b2c7434b48ee7f85605 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Thu, 29 Dec 2005 03:42:38 +0100 Subject: fix dependency for make -j2 --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f5c71a6f80..5edc76f81a 100644 --- a/Makefile +++ b/Makefile @@ -211,7 +211,7 @@ all: $(PROGRAMS) $(MAN_PAGES) .SUFFIXES: # build the objects -%.o: %.c $(GEN_HEADERS) +%.o: %.c $(HOST_PROGS) $(GEN_HEADERS) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ # "Static Pattern Rule" to build all programs @@ -255,6 +255,7 @@ ccdv: ccdv.c .SILENT: ccdv clean: + - rm -f $(HOST_PROGS) - find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print0 | xargs -0rt rm -f - find -name "*.gcno" -print0 | xargs -0rt rm -f - find -name "*.gcda" -print0 | xargs -0rt rm -f -- cgit v1.2.3-54-g00ecf From 3e0f8812f8c824648db7cc6886265ed186685488 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 29 Dec 2005 03:51:24 +0100 Subject: update RELEASE-NOTES + TODO Signed-off-by: Kay Sievers --- RELEASE-NOTES | 12 ++++++++++++ TODO | 24 +++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f7839b6893..4e3570205e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,15 @@ +udev 080 +======== +The enumeration format character '%e' is deprecated and will be +removed sometimes from a future udev version. It never worked correctly +outside of udevstart, so we can't use it with the new parallel +coldplug. A simple enumeration is as useless as the devfs naming +scheme, just get rid of both if you still use it. + +MODALIAS and $modalias is not needed and will be removed from one of +the next udev versions, replace it in all rules with ENV{MODALIAS} or +the sysfs "modalias" value. + udev 079 ======== Let scsi_id request libata drive serial numbers from page 0x80. diff --git a/TODO b/TODO index 7e123d8b14..2afa1783ee 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,21 @@ -This is a list of things that needs to be done. They are in no specific -order. We will gladly accept patches for any of these items: +These things need to be done, or would be nice to have: -- Log the relationship of the kernel name and the persistent disk name - to syslog, so any error logged from the kernel can be associated with - any of the links at that time. + o Log the relationship of the kernel name and the persistent disk name + to syslog, so any error logged from the kernel can be associated with + any of the links at that time. + + +These things are scheduled for removal sometimes: + + o remove broken %e enumeration + (simple enumerations can't work and should go) + + o remove devfs naming scheme rules and scripts + + o remove MODALIAS + $modalias + (ENV{MODALIAS}, $env{MODALIAS}, $sysfs{modalias} will do it) + + o remove udevstart, udevsend + (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer + want to guess event properties from sysfs like udevstart is doing it) -- cgit v1.2.3-54-g00ecf From fabd8709fb2202daa30168401f3ed8af5e6dadab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 29 Dec 2005 04:02:24 +0100 Subject: fix typo in man page Thanks to Frans Pop for the "patch". --- docs/udev.xml | 8 ++++---- udev.8 | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/udev.xml b/docs/udev.xml index 8c07f0e687..b2e2df0aa3 100644 --- a/docs/udev.xml +++ b/docs/udev.xml @@ -176,7 +176,7 @@ - Match the typ of bus the device is connected to. + Match the type of bus the device is connected to. @@ -263,8 +263,8 @@ - The name of the node to be created, or the name, the network interface - should be renamed to. Only one rule can set the a name, all later rules with + The name of the node to be created, or the name the network interface + should be renamed to. Only one rule can set the node name, all later rules with a NAME key will be ignored. @@ -282,7 +282,7 @@ - The permissions for the device node. Every specified value over writes + The permissions for the device node. Every specified value overwrites the compiled-in default value. diff --git a/udev.8 b/udev.8 index c6ab83e805..4ca8107265 100644 --- a/udev.8 +++ b/udev.8 @@ -82,7 +82,7 @@ Match the kernel devpath. Match the kernel subsystem name .TP \fBBUS\fR -Match the typ of bus the device is connected to. +Match the type of bus the device is connected to. .TP \fBDRIVER\fR Match the kernel driver name. @@ -116,13 +116,13 @@ Matches any single character specified within the brackets. example, the pattern The following keys can get values assigned: .TP \fBNAME\fR -The name of the node to be created, or the name, the network interface should be renamed to. Only one rule can set the a name, all later rules with a NAME key will be ignored. +The name of the node to be created, or the name the network interface should be renamed to. Only one rule can set the node name, all later rules with a NAME key will be ignored. .TP \fBSYMLINK\fR The name of a symlink targeting the node. Every matching rule can add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character. .TP \fBOWNER, GROUP, MODE\fR -The permissions for the device node. Every specified value over writes the compiled\-in default value. +The permissions for the device node. Every specified value overwrites the compiled\-in default value. .TP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR Export the key to the environment. Depending on the specified operation, this key is also used as a match. -- cgit v1.2.3-54-g00ecf From 22f29307ff0df84de0c3bebc9bf523d19d673b32 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 29 Dec 2005 04:24:15 +0100 Subject: update TODO Signed-off-by: Kay Sievers --- TODO | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 2afa1783ee..19aae9edf0 100644 --- a/TODO +++ b/TODO @@ -4,8 +4,14 @@ These things need to be done, or would be nice to have: to syslog, so any error logged from the kernel can be associated with any of the links at that time. + o Fix inconsistency with KERNEL and ID. ID will walk up the device chain + but it matches on "KERNEL names" too. And ID and SYSFS can only match + on the same device in the chain. That's pretty hard to explain and to + understand. Same for SUBSYSTEM and BUS. -These things are scheduled for removal sometimes: + +These things are deprecated and scheduled for removal in a future +udev version: o remove broken %e enumeration (simple enumerations can't work and should go) -- cgit v1.2.3-54-g00ecf From 33d062d74661c5d1f5d9686365ee95254e32332a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 29 Dec 2005 04:25:49 +0100 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index fe861ae972..667b0ae9b1 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -16,7 +16,7 @@ KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" KERNEL=="hvc*", NAME="%k", GROUP="uucp" KERNEL=="hvsi*", NAME="%k", GROUP="uucp" KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" -KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot" +KERNEL=="ttyUSB*", SYSFS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" # video/graphics SUBSYSTEM=="video4linux", GROUP="video" -- cgit v1.2.3-54-g00ecf From 309d6fd302921489a93dca07f1675c9fc1f74a5a Mon Sep 17 00:00:00 2001 From: coly Date: Mon, 9 Jan 2006 20:58:20 +0100 Subject: fix man page typos --- docs/udev.xml | 4 ++-- udev.8 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/udev.xml b/docs/udev.xml index b2e2df0aa3..e87dbab880 100644 --- a/docs/udev.xml +++ b/docs/udev.xml @@ -53,7 +53,7 @@ CONFIGURATION All udev configuration files are placed in /etc/udev/*. - Every file consist of a set of lines of text. All empty lines or lines beginning + Every file consists of a set of lines of text. All empty lines or lines beginning with '#' will be ignored. Configuration file @@ -198,7 +198,7 @@ Match against the value of an environment key. Depending on - the specified operation, this key is also used as a assignment. + the specified operation, this key is also used as an assignment. diff --git a/udev.8 b/udev.8 index 4ca8107265..6d2f5e679e 100644 --- a/udev.8 +++ b/udev.8 @@ -23,7 +23,7 @@ If udev receives a device event, it matches its configured rules against the ava .SH "CONFIGURATION" .PP All udev configuration files are placed in -\fI/etc/udev/*\fR. Every file consist of a set of lines of text. All empty lines or lines beginning with '#' will be ignored. +\fI/etc/udev/*\fR. Every file consists of a set of lines of text. All empty lines or lines beginning with '#' will be ignored. .SS "Configuration file" .PP udev expects its main configuration file at @@ -91,7 +91,7 @@ Match the kernel driver name. Match the device number on the bus. .TP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -Match against the value of an environment key. Depending on the specified operation, this key is also used as a assignment. +Match against the value of an environment key. Depending on the specified operation, this key is also used as an assignment. .TP \fBSYSFS{\fR\fB\fIfilename\fR\fR\fB}\fR Match the sysfs attribute value. Up to five values can be specified. Trailing whitespace is ignored, if the specified match value does not contain trailing whitespace itself. -- cgit v1.2.3-54-g00ecf From 47fbf3c58260e3fed1078061f8d45e01b0e120f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 9 Jan 2006 21:17:24 +0100 Subject: path_id: fix invalid character class Thanks to Marco for the _right_ fix. Signed-off-by: Kay Sievers --- extras/path_id | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/path_id b/extras/path_id index dfb997b340..44fc4820b5 100755 --- a/extras/path_id +++ b/extras/path_id @@ -275,7 +275,7 @@ handle_block_usb_storage () { # usb-storage devs have a serial number, hopefully unique serial= if [ -f $controller_dev/../serial ] ; then - serial="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_0123456789]@@g' < $controller_dev/../serial`" + serial="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789-]@@g' < $controller_dev/../serial`" : serial XXX_${serial}_XXX d="usb-$serial" serial="`echo $serial | sed -e 's@[ 0]\{1,\}@@g'`" @@ -285,10 +285,10 @@ handle_block_usb_storage () { # has eventually binary junk in vpd identifier= if [ -f $controller_dev/../product ] ; then - product="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_0123456789]@@g' < $controller_dev/../product`" + product="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789-]@@g' < $controller_dev/../product`" fi if [ -f $controller_dev/../manufacturer ] ; then - manufacturer="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_0123456789]@@g' < $controller_dev/../manufacturer`" + manufacturer="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789-]@@g' < $controller_dev/../manufacturer`" fi if [ -z "$product" -o -z "$manufacturer" ] ; then read idvendor < $controller_dev/../idVendor -- cgit v1.2.3-54-g00ecf From 1aa1e24848903d11780db1ade355be73ad61a937 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 9 Jan 2006 21:18:00 +0100 Subject: replace libsysfs We never used any of the libsysfs convenience features. Here we replace it completely with 300 lines of code, which are much simpler and a bit faster cause udev(d) does not open any syfs file for a simple event which does not need any parent device information. Signed-off-by: Kay Sievers --- Makefile | 30 +- RELEASE-NOTES | 8 + docs/udev.xml | 7 - docs/udevtest.xml | 2 +- extras/ata_id/Makefile | 2 +- extras/ata_id/ata_id.c | 4 +- extras/cdrom_id/Makefile | 2 +- extras/cdrom_id/cdrom_id.c | 4 +- extras/dasd_id/Makefile | 2 +- extras/dasd_id/dasd_id.c | 3 +- extras/edd_id/Makefile | 2 +- extras/edd_id/edd_id.c | 4 +- extras/firmware/Makefile | 2 +- extras/firmware/firmware_helper.c | 3 +- extras/floppy/Makefile | 2 +- extras/run_directory/Makefile | 2 +- extras/run_directory/run_directory.c | 4 +- extras/run_directory/udev_run_devd.c | 4 +- extras/run_directory/udev_run_hotplugd.c | 4 +- extras/scsi_id/Makefile | 3 +- extras/scsi_id/scsi_id.c | 436 +++---- extras/scsi_id/scsi_id.h | 14 +- extras/scsi_id/scsi_serial.c | 258 ++-- extras/usb_id/Makefile | 2 +- extras/usb_id/usb_id.c | 226 ++-- extras/volume_id/Makefile | 2 +- extras/volume_id/vol_id.c | 3 +- libsysfs/LGPL | 441 ------- libsysfs/dlist.c | 621 ---------- libsysfs/libsysfs.txt | 1954 ------------------------------ libsysfs/sysfs.h | 64 - libsysfs/sysfs/dlist.h | 207 ---- libsysfs/sysfs/libsysfs.h | 225 ---- libsysfs/sysfs_bus.c | 317 ----- libsysfs/sysfs_class.c | 557 --------- libsysfs/sysfs_device.c | 341 ------ libsysfs/sysfs_dir.c | 491 -------- libsysfs/sysfs_driver.c | 261 ---- libsysfs/sysfs_utils.c | 290 ----- test/simple-build-check.sh | 3 +- test/udev-test.pl | 51 +- udev.c | 53 +- udev.h | 108 +- udev_add.c | 54 +- udev_config.c | 10 +- udev_db.c | 14 +- udev_device.c | 138 ++- udev_event.c | 161 --- udev_libc_wrapper.c | 3 - udev_remove.c | 12 +- udev_rules.c | 353 +++--- udev_rules.h | 12 +- udev_rules_parse.c | 5 +- udev_selinux.c | 1 - udev_sysfs.c | 345 ++++++ udev_utils.c | 4 - udev_utils.h | 65 - udev_utils_file.c | 4 - udev_utils_run.c | 4 - udev_utils_string.c | 4 - udevcontrol.c | 3 - udevd.c | 41 +- udevd.h | 2 +- udevinfo.c | 254 ++-- udevmonitor.c | 2 - udevsend.c | 4 +- udevstart.c | 88 +- udevtest.8 | 4 +- udevtest.c | 85 +- 69 files changed, 1376 insertions(+), 7315 deletions(-) delete mode 100644 libsysfs/LGPL delete mode 100644 libsysfs/dlist.c delete mode 100644 libsysfs/libsysfs.txt delete mode 100644 libsysfs/sysfs.h delete mode 100644 libsysfs/sysfs/dlist.h delete mode 100644 libsysfs/sysfs/libsysfs.h delete mode 100644 libsysfs/sysfs_bus.c delete mode 100644 libsysfs/sysfs_class.c delete mode 100644 libsysfs/sysfs_device.c delete mode 100644 libsysfs/sysfs_dir.c delete mode 100644 libsysfs/sysfs_driver.c delete mode 100644 libsysfs/sysfs_utils.c delete mode 100644 udev_event.c create mode 100644 udev_sysfs.c delete mode 100644 udev_utils.h diff --git a/Makefile b/Makefile index 5edc76f81a..461f5ac012 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,6 @@ PROGRAMS = \ HEADERS = \ udev.h \ - udev_utils.h \ udev_rules.h \ logging.h \ udev_libc_wrapper.h \ @@ -66,12 +65,12 @@ HEADERS = \ list.h UDEV_OBJS = \ - udev_event.o \ udev_device.o \ udev_config.o \ udev_add.o \ udev_remove.o \ udev_db.o \ + udev_sysfs.o \ udev_rules.o \ udev_rules_parse.o \ udev_utils.o \ @@ -90,15 +89,6 @@ MAN_PAGES = \ udevinfo.8 \ udevstart.8 -SYSFS_OBJS = \ - libsysfs/sysfs_class.o \ - libsysfs/sysfs_device.o \ - libsysfs/sysfs_dir.o \ - libsysfs/sysfs_driver.o \ - libsysfs/sysfs_utils.o \ - libsysfs/dlist.o -LIBSYSFS = libsysfs/libsysfs.a - # config files automatically generated GEN_CONFIGS = \ $(LOCAL_CFG_DIR)/udev.conf @@ -144,10 +134,6 @@ LDFLAGS = -Wl,-warn-common OPTFLAGS = -Os CFLAGS += $(OPTFLAGS) -# include our local copy of libsysfs -CFLAGS += -I$(PWD)/libsysfs/sysfs \ - -I$(PWD)/libsysfs - ifeq ($(strip $(USE_LOG)),true) CFLAGS += -DUSE_LOG endif @@ -200,7 +186,6 @@ all: $(PROGRAMS) $(MAN_PAGES) STRIPCMD="$(STRIPCMD)" \ LIB_OBJS="$(LIB_OBJS)" \ LIBUDEV="$(PWD)/$(LIBUDEV)" \ - LIBSYSFS="$(PWD)/$(LIBSYSFS)" \ QUIET="$(QUIET)" \ -C $$target $@ || exit 1; \ done; @@ -211,28 +196,21 @@ all: $(PROGRAMS) $(MAN_PAGES) .SUFFIXES: # build the objects -%.o: %.c $(HOST_PROGS) $(GEN_HEADERS) +%.o: %.c $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ # "Static Pattern Rule" to build all programs -$(PROGRAMS): %: $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(LIBSYSFS) $(LIBUDEV) %.o - $(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) +$(PROGRAMS): %: $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(LIBUDEV) %.o + $(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(STRIPCMD),) $(QUIET) $(STRIPCMD) $@ endif -$(UDEV_OBJS): $(LIBUDEV): $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS) @rm -f $@ $(QUIET) $(AR) cq $@ $(UDEV_OBJS) $(QUIET) $(RANLIB) $@ -$(SYSFS_OBJS): -$(LIBSYSFS): $(HOST_PROGS) $(SYSFS_OBJS) - @rm -f $@ - $(QUIET) $(AR) cq $@ $(SYSFS_OBJS) - $(QUIET) $(RANLIB) $@ - # generate config files $(GEN_CONFIGS): sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $@.in > $@ diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4e3570205e..623ea0ed60 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,5 +1,11 @@ udev 080 ======== +Complete removal of libsysfs, replaced by simple helper functions +which are much simpler and a bit faster. The udev daemon operatesentirely +on event parameters and does not use sysfs for simple rules anymore. +Please report any new bugs/problems, that may be caused by this big +change. They will be fixed immediately. + The enumeration format character '%e' is deprecated and will be removed sometimes from a future udev version. It never worked correctly outside of udevstart, so we can't use it with the new parallel @@ -10,6 +16,8 @@ MODALIAS and $modalias is not needed and will be removed from one of the next udev versions, replace it in all rules with ENV{MODALIAS} or the sysfs "modalias" value. +Thanks a lot to Marco for all his help on finding and fixing bugs. + udev 079 ======== Let scsi_id request libata drive serial numbers from page 0x80. diff --git a/docs/udev.xml b/docs/udev.xml index e87dbab880..7f6a30df52 100644 --- a/docs/udev.xml +++ b/docs/udev.xml @@ -361,13 +361,6 @@ - - , - - The kernel bus id for this device. - - - , diff --git a/docs/udevtest.xml b/docs/udevtest.xml index ceea0413c5..2b39eebab0 100644 --- a/docs/udevtest.xml +++ b/docs/udevtest.xml @@ -37,7 +37,7 @@ - udevtest device-path subsystem + udevtest device-path diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index ebf0f4e9b4..0a881fb194 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -33,7 +33,7 @@ all: $(PROG) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(STRIPCMD),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index a97cc284cc..aedebff711 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -24,8 +25,7 @@ #include #include -#include "../../logging.h" -#include "../../udev_utils.h" +#include "../../udev.h" #ifdef USE_LOG void log_message(int priority, const char *format, ...) diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index 985eb805a5..9a722d52f9 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -33,7 +33,7 @@ all: $(PROG) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index ff6f89e163..0d4a8c10f0 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -18,14 +18,14 @@ #include #include #include +#include #include #include #include #include #include -#include "../../logging.h" -#include "../../udev_utils.h" +#include "../../udev.h" /* * Taken from the cdrom.h kernel include file. diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 80680f22fe..79f14a49ba 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -33,7 +33,7 @@ all: $(PROG) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/dasd_id/dasd_id.c b/extras/dasd_id/dasd_id.c index ca2582cde6..b2496e99f8 100644 --- a/extras/dasd_id/dasd_id.c +++ b/extras/dasd_id/dasd_id.c @@ -24,8 +24,7 @@ #include #include -#include "../../logging.h" -#include "../../udev_utils.h" +#include "../../udev.h" #ifdef USE_LOG void log_message(int priority, const char *format, ...) diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 5a6cdb65c3..db6afae18c 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -33,7 +33,7 @@ all: $(PROG) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index f21362b902..8fc690a49c 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -18,12 +18,12 @@ #include #include #include +#include #include #include #include -#include "../../logging.h" -#include "../../udev_utils.h" +#include "../../udev.h" #ifdef USE_LOG void log_message(int priority, const char *format, ...) diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index 16918867fc..da7fe9d1a8 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -33,7 +33,7 @@ all: $(PROG) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/firmware/firmware_helper.c b/extras/firmware/firmware_helper.c index 2bc6b50f06..ca1c43814f 100644 --- a/extras/firmware/firmware_helper.c +++ b/extras/firmware/firmware_helper.c @@ -17,8 +17,7 @@ #include #include -#include "../../udev_utils.h" -#include "../../logging.h" +#include "../../udev.h" #define FIRMWARE_PATH "/lib/firmware" #define PATH_SIZE 256 diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 240af4ce05..e23191a533 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -33,7 +33,7 @@ all: $(PROG) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index d138f62c03..37a59597b9 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -32,7 +32,7 @@ all: $(PROG) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/run_directory/run_directory.c b/extras/run_directory/run_directory.c index 69faecc15e..c715ca6bd3 100644 --- a/extras/run_directory/run_directory.c +++ b/extras/run_directory/run_directory.c @@ -22,9 +22,7 @@ #include #include -#include "../../udev_utils.h" -#include "../../list.h" -#include "../../logging.h" +#include "../../udev.h" #include "run_directory.h" static int exec_program(const char *filename, const char *subsystem) diff --git a/extras/run_directory/udev_run_devd.c b/extras/run_directory/udev_run_devd.c index e708de8aa4..59ea766ac2 100644 --- a/extras/run_directory/udev_run_devd.c +++ b/extras/run_directory/udev_run_devd.c @@ -22,9 +22,7 @@ #include #include -#include "../../udev_utils.h" -#include "../../list.h" -#include "../../logging.h" +#include "../../udev.h" #include "run_directory.h" diff --git a/extras/run_directory/udev_run_hotplugd.c b/extras/run_directory/udev_run_hotplugd.c index a21835ae4e..bfa82ab917 100644 --- a/extras/run_directory/udev_run_hotplugd.c +++ b/extras/run_directory/udev_run_hotplugd.c @@ -22,9 +22,7 @@ #include #include -#include "../../udev_utils.h" -#include "../../list.h" -#include "../../logging.h" +#include "../../udev.h" #include "run_directory.h" diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 399de76911..057594d5bf 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -29,7 +29,6 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} # be able to run without udev -LIBSYSFS = -lsysfs CROSS = QUIET = CC = $(CROSS)gcc @@ -47,7 +46,7 @@ all: $(PROG) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index aa1b16009e..3a4a374d3e 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -32,37 +32,20 @@ #include #include #include -#include -#include "scsi_id_version.h" -#include "scsi_id.h" -#ifndef SCSI_ID_VERSION -#warning No version -#define SCSI_ID_VERSION "unknown" -#endif +#include "../../udev.h" +#include "scsi_id.h" +#include "scsi_id_version.h" -/* - * temporary names for mknod. - */ -#define TMP_DIR "/dev" -#define TMP_PREFIX "tmp-scsi" +/* temporary names for mknod */ +#define TMP_DIR "/dev" +#define TMP_PREFIX "tmp-scsi" -/* - * XXX Note the 'e' (send output to stderr in all cases), and 'c' (callout) - * options are not supported, but other code is still left in place for - * now. - */ static const char short_options[] = "abd:f:gip:s:uvVx"; -/* - * Just duplicate per dev options. - */ static const char dev_short_options[] = "bgp:"; -char sysfs_mnt_path[SYSFS_PATH_MAX]; - static int all_good; static int always_info; -static char *default_callout; static int dev_specified; static int sys_specified; static char config_file[MAX_NAME_LEN] = SCSI_ID_CONFIG_FILE; @@ -78,28 +61,30 @@ static char model_str[64]; static char revision_str[16]; static char type_str[16]; -void log_message (int level, const char *format, ...) +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) { - va_list args; + va_list args; + static int udev_log = -1; - if (!debug && level == LOG_DEBUG) - return; + if (udev_log == -1) { + const char *value; - va_start (args, format); - if (!hotplug_mode || use_stderr) { - vfprintf(stderr, format, args); - } else { - static int logging_init = 0; - if (!logging_init) { - openlog ("scsi_id", LOG_PID, LOG_DAEMON); - logging_init = 1; - } - - vsyslog(level, format, args); + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; } - va_end (args); - return; + + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); } +#endif static void set_str(char *to, const char *from, size_t count) { @@ -171,68 +156,35 @@ static void set_type(char *to, const char *from, size_t len) to[len-1] = '\0'; } -static int get_major_minor(struct sysfs_class_device *class_dev, int *maj, - int *min) +static int create_tmp_dev(const char *devpath, char *tmpdev, int dev_type) { - struct sysfs_attribute *dev_attr; + unsigned int maj, min; + const char *attr; - dev_attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (!dev_attr) { - /* - * XXX This happens a lot, since sg has no dev attr. - * And now sysfsutils does not set a meaningful errno - * value. Someday change this back to a LOG_WARNING. - * And if sysfsutils changes, check for ENOENT and handle - * it separately. - */ - log_message(LOG_DEBUG, "%s: could not get dev attribute: %s\n", - class_dev->name, strerror(errno)); + dbg("%s", devpath); + attr = sysfs_attr_get_value(devpath, "dev"); + if (attr == NULL) { + dbg("%s: could not get dev attribute: %s", devpath, strerror(errno)); return -1; } - dprintf("dev value %s", dev_attr->value); /* value has a trailing \n */ - if (sscanf(dev_attr->value, "%u:%u", maj, min) != 2) { - log_message(LOG_WARNING, "%s: invalid dev major/minor\n", - class_dev->name); + dbg("dev value %s", attr); + if (sscanf(attr, "%u:%u", &maj, &min) != 2) { + err("%s: invalid dev major/minor", devpath); return -1; } - return 0; -} - -static int create_tmp_dev(struct sysfs_class_device *class_dev, char *tmpdev, - int dev_type) -{ - int maj, min; - - dprintf("(%s)\n", class_dev->name); - - if (get_major_minor(class_dev, &maj, &min)) - return -1; snprintf(tmpdev, MAX_NAME_LEN, "%s/%s-maj%d-min%d-%u", TMP_DIR, TMP_PREFIX, maj, min, getpid()); - dprintf("tmpdev '%s'\n", tmpdev); - + dbg("tmpdev '%s'", tmpdev); if (mknod(tmpdev, 0600 | dev_type, makedev(maj, min))) { - log_message(LOG_WARNING, "mknod failed: %s\n", strerror(errno)); + err("mknod failed: %s", strerror(errno)); return -1; } return 0; } -static int has_sysfs_prefix(const char *path, const char *prefix) -{ - char match[MAX_NAME_LEN]; - - strncpy(match, sysfs_mnt_path, MAX_NAME_LEN); - strncat(match, prefix, MAX_NAME_LEN); - if (strncmp(path, match, strlen(match)) == 0) - return 1; - else - return 0; -} - /* * get_value: * @@ -289,8 +241,8 @@ static int argc_count(char *opts) * * vendor and model can end in '\n'. */ -static int get_file_options(char *vendor, char *model, int *argc, - char ***newargv) +static int get_file_options(const char *vendor, const char *model, + int *argc, char ***newargv) { char *buffer; FILE *fd; @@ -301,15 +253,14 @@ static int get_file_options(char *vendor, char *model, int *argc, int c; int retval = 0; - dprintf("vendor='%s'; model='%s'\n", vendor, model); + dbg("vendor='%s'; model='%s'\n", vendor, model); fd = fopen(config_file, "r"); if (fd == NULL) { - dprintf("can't open %s\n", config_file); + dbg("can't open %s\n", config_file); if (errno == ENOENT) { return 1; } else { - log_message(LOG_WARNING, "can't open %s: %s\n", - config_file, strerror(errno)); + err("can't open %s: %s", config_file, strerror(errno)); return -1; } } @@ -321,7 +272,7 @@ static int get_file_options(char *vendor, char *model, int *argc, */ buffer = malloc(MAX_BUFFER_LEN); if (!buffer) { - log_message(LOG_WARNING, "Can't allocate memory.\n"); + err("Can't allocate memory."); return -1; } @@ -335,29 +286,22 @@ static int get_file_options(char *vendor, char *model, int *argc, break; lineno++; if (buf[strlen(buffer) - 1] != '\n') { - log_message(LOG_WARNING, - "Config file line %d too long.\n", lineno); + info("Config file line %d too long.\n", lineno); break; } while (isspace(*buf)) buf++; + /* blank or all whitespace line */ if (*buf == '\0') - /* - * blank or all whitespace line - */ continue; + /* comment line */ if (*buf == '#') - /* - * comment line - */ continue; -#ifdef LOTS - dprintf("lineno %d: '%s'\n", lineno, buf); -#endif + dbg("lineno %d: '%s'\n", lineno, buf); str1 = strsep(&buf, "="); if (str1 && strcasecmp(str1, "VENDOR") == 0) { str1 = get_value(&buf); @@ -387,22 +331,20 @@ static int get_file_options(char *vendor, char *model, int *argc, } options_in = str1; } - dprintf("config file line %d:" + dbg("config file line %d:" " vendor '%s'; model '%s'; options '%s'\n", lineno, vendor_in, model_in, options_in); /* * Only allow: [vendor=foo[,model=bar]]options=stuff */ if (!options_in || (!vendor_in && model_in)) { - log_message(LOG_WARNING, - "Error parsing config file line %d '%s'\n", - lineno, buffer); + info("Error parsing config file line %d '%s'", lineno, buffer); retval = -1; break; } if (vendor == NULL) { if (vendor_in == NULL) { - dprintf("matched global option\n"); + dbg("matched global option\n"); break; } } else if ((vendor_in && strncmp(vendor, vendor_in, @@ -416,10 +358,10 @@ static int get_file_options(char *vendor, char *model, int *argc, * give a partial match (that is FOO * matches FOOBAR). */ - dprintf("matched vendor/model\n"); + dbg("matched vendor/model\n"); break; } else { - dprintf("no match\n"); + dbg("no match\n"); } } @@ -434,8 +376,7 @@ static int get_file_options(char *vendor, char *model, int *argc, c = argc_count(buffer) + 2; *newargv = calloc(c, sizeof(**newargv)); if (!*newargv) { - log_message(LOG_WARNING, - "Can't allocate memory.\n"); + err("Can't allocate memory."); retval = -1; } else { *argc = c; @@ -450,9 +391,7 @@ static int get_file_options(char *vendor, char *model, int *argc, (*newargv)[c] = strsep(&buffer, " "); } } else { - /* - * No matches. - */ + /* No matches */ retval = 1; } } @@ -480,9 +419,9 @@ static int set_options(int argc, char **argv, const char *short_opts, break; if (optarg) - dprintf("option '%c' arg '%s'\n", option, optarg); + dbg("option '%c' arg '%s'\n", option, optarg); else - dprintf("option '%c'\n", option); + dbg("option '%c'\n", option); switch (option) { case 'a': @@ -492,10 +431,6 @@ static int set_options(int argc, char **argv, const char *short_opts, all_good = 0; break; - case 'c': - default_callout = optarg; - break; - case 'd': dev_specified = 1; strncpy(maj_min_dev, optarg, MAX_NAME_LEN); @@ -525,16 +460,15 @@ static int set_options(int argc, char **argv, const char *short_opts, } else if (strcmp(optarg, "pre-spc3-83") == 0) { default_page_code = PAGE_83_PRE_SPC3; } else { - log_message(LOG_WARNING, - "Unknown page code '%s'\n", optarg); + info("Unknown page code '%s'", optarg); return -1; } break; case 's': sys_specified = 1; - strncpy(target, sysfs_mnt_path, MAX_NAME_LEN); - strncat(target, optarg, MAX_NAME_LEN); + strncpy(target, optarg, MAX_NAME_LEN); + target[MAX_NAME_LEN-1] = '\0'; break; case 'u': @@ -550,71 +484,58 @@ static int set_options(int argc, char **argv, const char *short_opts, break; case 'V': - log_message(LOG_WARNING, "scsi_id version: %s\n", - SCSI_ID_VERSION); + info("scsi_id version: %s\n", SCSI_ID_VERSION); exit(0); break; default: - log_message(LOG_WARNING, - "Unknown or bad option '%c' (0x%x)\n", - option, option); + info("Unknown or bad option '%c' (0x%x)", option, option); return -1; } } return 0; } -static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, - int *page_code, char *callout) +static int per_dev_options(struct sysfs_device *dev_scsi, int *good_bad, int *page_code) { int retval; int newargc; char **newargv = NULL; - struct sysfs_attribute *vendor, *model, *type; + const char *vendor, *model, *type; int option; *good_bad = all_good; *page_code = default_page_code; - if (default_callout && (callout != default_callout)) - strncpy(callout, default_callout, MAX_NAME_LEN); - else - callout[0] = '\0'; - vendor = sysfs_get_device_attr(scsi_dev, "vendor"); + vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!vendor) { - log_message(LOG_WARNING, "%s: cannot get vendor attribute\n", - scsi_dev->name); + info("%s: cannot get vendor attribute", dev_scsi->devpath); return -1; } - set_str(vendor_str, vendor->value, sizeof(vendor_str)-1); + set_str(vendor_str, vendor, sizeof(vendor_str)-1); - model = sysfs_get_device_attr(scsi_dev, "model"); + model = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!model) { - log_message(LOG_WARNING, "%s: cannot get model attribute\n", - scsi_dev->name); + info("%s: cannot get model attribute\n", dev_scsi->devpath); return -1; } - set_str(model_str, model->value, sizeof(model_str)-1); + set_str(model_str, model, sizeof(model_str)-1); - type = sysfs_get_device_attr(scsi_dev, "type"); + type = sysfs_attr_get_value(dev_scsi->devpath, "type"); if (!type) { - log_message(LOG_WARNING, "%s: cannot get type attribute\n", - scsi_dev->name); + info("%s: cannot get type attribute", dev_scsi->devpath); return -1; } - set_type(type_str, type->value, sizeof(type_str)); + set_type(type_str, type, sizeof(type_str)); - type = sysfs_get_device_attr(scsi_dev, "rev"); + type = sysfs_attr_get_value(dev_scsi->devpath, "rev"); if (!type) { - log_message(LOG_WARNING, "%s: cannot get type attribute\n", - scsi_dev->name); + info("%s: cannot get type attribute\n", dev_scsi->devpath); return -1; } - set_str(revision_str, type->value, sizeof(revision_str)-1); + set_str(revision_str, type, sizeof(revision_str)-1); - retval = get_file_options(vendor->value, model->value, &newargc, - &newargv); + retval = get_file_options(vendor, model, &newargc, &newargv); optind = 1; /* reset this global extern */ while (retval == 0) { @@ -623,19 +544,15 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, break; if (optarg) - dprintf("option '%c' arg '%s'\n", option, optarg); + dbg("option '%c' arg '%s'\n", option, optarg); else - dprintf("option '%c'\n", option); + dbg("option '%c'\n", option); switch (option) { case 'b': *good_bad = 0; break; - case 'c': - strncpy(callout, default_callout, MAX_NAME_LEN); - break; - case 'g': *good_bad = 1; break; @@ -648,16 +565,13 @@ static int per_dev_options(struct sysfs_device *scsi_dev, int *good_bad, } else if (strcmp(optarg, "pre-spc3-83") == 0) { *page_code = PAGE_83_PRE_SPC3; } else { - log_message(LOG_WARNING, - "Unknown page code '%s'\n", optarg); + info("Unknown page code '%s'", optarg); retval = -1; } break; default: - log_message(LOG_WARNING, - "Unknown or bad option '%c' (0x%x)\n", - option, option); + info("Unknown or bad option '%c' (0x%x)", option, option); retval = -1; break; } @@ -702,129 +616,62 @@ static void format_serial(char *serial) * memory etc. return 2, and return 1 for expected cases (like broken * device found) that do not print an id. */ -static int scsi_id(const char *target_path, char *maj_min_dev) +static int scsi_id(const char *devpath, char *maj_min_dev) { int retval; int dev_type = 0; char *serial, *unaligned_buf; - struct sysfs_class_device *class_dev; /* of target_path */ - struct sysfs_class_device *class_dev_parent; /* for partitions */ - struct sysfs_device *scsi_dev; /* the scsi_device */ + struct sysfs_device *dev; + struct sysfs_device *dev_scsi; int good_dev; int page_code; - char callout[MAX_NAME_LEN]; - - dprintf("target_path %s\n", target_path); - /* - * Ugly: depend on the sysfs path to tell us whether this is a - * block or char device. This should probably be encoded in the - * "dev" along with the major/minor. - */ - if (has_sysfs_prefix(target_path, "/block")) { - dev_type = S_IFBLK; - } else if (has_sysfs_prefix(target_path, "/class")) { - dev_type = S_IFCHR; - } else { - if (!hotplug_mode) { - log_message(LOG_WARNING, - "Non block or class device '%s'\n", - target_path); - return 1; - } else { - /* - * Expected in some cases. - */ - dprintf("Non block or class device\n"); - return 0; - } - } + dbg("devpath %s\n", devpath); - class_dev = sysfs_open_class_device_path(target_path); - if (!class_dev) { - log_message(LOG_WARNING, "open class %s failed: %s\n", - target_path, strerror(errno)); + dev = sysfs_device_get(devpath); + if (dev == NULL) { + err("unable to access '%s'", devpath); return 1; } - class_dev_parent = sysfs_get_classdev_parent(class_dev); - dprintf("class_dev 0x%p; class_dev_parent 0x%p\n", class_dev, - class_dev_parent); - if (class_dev_parent) { - scsi_dev = sysfs_get_classdev_device(class_dev_parent); - } else { - scsi_dev = sysfs_get_classdev_device(class_dev); - } - /* - * The close of scsi_dev will close class_dev or class_dev_parent. - */ + if (strcmp(dev->subsystem, "block") == 0) + dev_type = S_IFBLK; + else + dev_type = S_IFCHR; - /* - * We assume we are called after the device is completely ready, - * so we don't have to loop here like udev. (And we are usually - * called via udev.) - */ - if (!scsi_dev) { - /* - * errno is not set if we can't find the device link, so - * don't print it out here. - */ - log_message(LOG_WARNING, "Cannot find sysfs device associated with %s\n", - target_path); + /* get scsi parent device */ + dev_scsi = sysfs_device_get_parent(dev); + if (dev_scsi == NULL) { + err("unable to access parent device of '%s'", devpath); return 1; } - - /* - * Allow only scsi devices. - * - * Other block devices can support SG IO, but only ide-cd does, so - * for now, don't bother with anything else. - */ - if (strcmp(scsi_dev->bus, "scsi") != 0) { - if (hotplug_mode) - /* - * Expected in some cases. - */ - dprintf("%s is not a scsi device\n", target_path); - else - log_message(LOG_WARNING, "%s is not a scsi device\n", - target_path); + /* allow only scsi devices */ + if (strcmp(dev_scsi->subsystem, "scsi") != 0) { + info("%s is not a scsi device", devpath); return 1; } - /* - * mknod a temp dev to communicate with the device. - */ - if (!dev_specified && create_tmp_dev(class_dev, maj_min_dev, - dev_type)) { - dprintf("create_tmp_dev failed\n"); + /* mknod a temp dev to communicate with the device */ + if (!dev_specified && create_tmp_dev(dev->devpath, maj_min_dev, dev_type)) { + dbg("create_tmp_dev failed\n"); return 1; } - /* - * Get any per device (vendor + model) options from the config - * file. - */ - retval = per_dev_options(scsi_dev, &good_dev, &page_code, callout); - dprintf("per dev options: good %d; page code 0x%x; callout '%s'\n", - good_dev, page_code, callout); + /* get per device (vendor + model) options from the config file */ + retval = per_dev_options(dev_scsi, &good_dev, &page_code); + dbg("per dev options: good %d; page code 0x%x", good_dev, page_code); #define ALIGN 512 unaligned_buf = malloc(MAX_SERIAL_LEN + ALIGN); serial = (char*) (((unsigned long) unaligned_buf + (ALIGN - 1)) & ~(ALIGN - 1)); - dprintf("buffer unaligned 0x%p; aligned 0x%p\n", unaligned_buf, serial); + dbg("buffer unaligned 0x%p; aligned 0x%p\n", unaligned_buf, serial); #undef ALIGN if (!good_dev) { retval = 1; - } else if (callout[0] != '\0') { - /* - * XXX Disabled for now ('c' is not in any options[]). - */ - retval = 1; - } else if (scsi_get_serial(scsi_dev, maj_min_dev, page_code, + } else if (scsi_get_serial(dev_scsi, maj_min_dev, page_code, serial, MAX_SERIAL_LEN)) { retval = always_info?0:1; } else { @@ -844,13 +691,12 @@ static int scsi_id(const char *target_path, char *maj_min_dev) if (reformat_serial) format_serial(serial); if (display_bus_id) - printf("%s: ", scsi_dev->name); + printf("%s: ", dev_scsi->kernel_name); printf("%s\n", serial); } - dprintf("%s\n", serial); + dbg("%s\n", serial); retval = 0; } - sysfs_close_device(scsi_dev); if (!dev_specified) unlink(maj_min_dev); @@ -860,32 +706,31 @@ static int scsi_id(const char *target_path, char *maj_min_dev) int main(int argc, char **argv) { - int retval; - char *devpath; - char target_path[MAX_NAME_LEN]; + int retval = 0; + char devpath[MAX_NAME_LEN]; char maj_min_dev[MAX_NAME_LEN]; int newargc; + const char *env; char **newargv; - if (getenv("DEBUG")) - debug++; + logging_init("scsi_id"); + sysfs_init(); + dbg("argc is %d\n", argc); - dprintf("argc is %d\n", argc); - if (sysfs_get_mnt_path(sysfs_mnt_path, MAX_NAME_LEN)) { - log_message(LOG_WARNING, "sysfs_get_mnt_path failed: %s\n", - strerror(errno)); - exit(1); - } + /* sysfs path can be overridden for testing */ + env = getenv("SYSFS_PATH"); + if (env) { + strncpy(sysfs_path, env, sizeof(sysfs_path)); + sysfs_path[sizeof(sysfs_path)-1] = '\0'; + } else + strcpy(sysfs_path, "/sys"); - devpath = getenv("DEVPATH"); - if (devpath) { - /* - * This implies that we were invoked via udev or hotplug. - */ + env = getenv("DEVPATH"); + if (env) { hotplug_mode = 1; sys_specified = 1; - strncpy(target_path, sysfs_mnt_path, MAX_NAME_LEN); - strncat(target_path, devpath, MAX_NAME_LEN); + strncpy(devpath, env, MAX_NAME_LEN); + devpath[sizeof(devpath)-1] = '\0'; } /* @@ -894,26 +739,35 @@ int main(int argc, char **argv) newargv = NULL; retval = get_file_options(NULL, NULL, &newargc, &newargv); if (retval < 0) { - exit(1); - } else if (newargv && (retval == 0)) { - if (set_options(newargc, newargv, short_options, target_path, - maj_min_dev) < 0) - exit(1); + retval = 1; + goto exit; + } + if (newargv && (retval == 0)) { + if (set_options(newargc, newargv, short_options, devpath, + maj_min_dev) < 0) { + retval = 2; + goto exit; + } free(newargv); } + /* * Get command line options (overriding any config file or DEVPATH * settings). */ - if (set_options(argc, argv, short_options, target_path, - maj_min_dev) < 0) + if (set_options(argc, argv, short_options, devpath, maj_min_dev) < 0) exit(1); if (!sys_specified) { - log_message(LOG_WARNING, "-s must be specified\n"); - exit(1); + info("-s must be specified\n"); + retval = 1; + goto exit; } - retval = scsi_id(target_path, maj_min_dev); - exit(retval); + retval = scsi_id(devpath, maj_min_dev); + +exit: + sysfs_cleanup(); + logging_close(); + return retval; } diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 1c9ed969a7..b5312b8988 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -21,9 +21,6 @@ * USA */ -#define dprintf(format, arg...) \ - log_message(LOG_DEBUG, "%s: " format, __FUNCTION__ , ## arg) - #define MAX_NAME_LEN 72 /* @@ -44,15 +41,8 @@ */ #define MAX_BUFFER_LEN 256 -extern int scsi_get_serial (struct sysfs_device *scsi_dev, const char - *devname, int page_code, char *serial, int - len); -extern void log_message (int level, const char *format, ...) - __attribute__ ((format (printf, 2, 3))); - -#ifndef u8 -typedef unsigned char u8; -#endif +extern int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, + int page_code, char *serial, int len); /* * Page code values. diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 14955e676c..bdebe94eb3 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -30,11 +30,12 @@ #include #include #include -#include /* need __user when built via klibc */ #include -#include -#include "scsi_id.h" + +#include "../../udev.h" #include "scsi.h" +#include "scsi_id.h" +#include "scsi_id_version.h" /* * A priority based list of id, naa, and binary/ascii for the identifier @@ -75,23 +76,21 @@ static const char hex_str[]="0123456789abcdef"; * are used here. */ -#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ - -#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ -#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ - -#define DRIVER_TIMEOUT 0x06 -#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ +#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ +#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ +#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ /* The following "category" function returns one of the following */ -#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ -#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ -#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ -#define SG_ERR_CAT_TIMEOUT 3 -#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ -#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ -#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ -#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ +#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ +#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ +#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ +#define SG_ERR_CAT_TIMEOUT 3 +#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ +#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ +#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ static int sg_err_category_new(int scsi_status, int msg_status, int host_status, int driver_status, const @@ -157,7 +156,7 @@ static int sg_err_category3(struct sg_io_hdr *hp) hp->sbp, hp->sb_len_wr); } -static int scsi_dump_sense(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) +static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) { unsigned char *sense_buffer; int s; @@ -184,12 +183,11 @@ static int scsi_dump_sense(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) * we'll retry the command. */ - dprintf("got check condition\n"); + dbg("got check condition\n"); sb_len = io->sb_len_wr; if (sb_len < 1) { - log_message(LOG_WARNING, "%s: sense buffer empty\n", - scsi_dev->name); + info("%s: sense buffer empty", dev_scsi->kernel_name); return -1; } @@ -203,10 +201,8 @@ static int scsi_dump_sense(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) */ s = sense_buffer[7] + 8; if (sb_len < s) { - log_message(LOG_WARNING, - "%s: sense buffer too small %d bytes," - " %d bytes too short\n", scsi_dev->name, - sb_len, s - sb_len); + info("%s: sense buffer too small %d bytes, %d bytes too short", + dev_scsi->kernel_name, sb_len, s - sb_len); return -1; } if ((code == 0x0) || (code == 0x1)) { @@ -216,9 +212,8 @@ static int scsi_dump_sense(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) /* * Possible? */ - log_message(LOG_WARNING, "%s: sense result too" - " small %d bytes\n", - scsi_dev->name, s); + info("%s: sense result too" " small %d bytes", + dev_scsi->kernel_name, s); return -1; } asc = sense_buffer[12]; @@ -229,72 +224,64 @@ static int scsi_dump_sense(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) asc = sense_buffer[2]; ascq = sense_buffer[3]; } else { - log_message(LOG_WARNING, - "%s: invalid sense code 0x%x\n", - scsi_dev->name, code); + info("%s: invalid sense code 0x%x", + dev_scsi->kernel_name, code); return -1; } - log_message(LOG_WARNING, - "%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", - scsi_dev->name, sense_key, asc, ascq); + info("%s: sense key 0x%x ASC 0x%x ASCQ 0x%x", + dev_scsi->kernel_name, sense_key, asc, ascq); } else { if (sb_len < 4) { - log_message(LOG_WARNING, - "%s: sense buffer too small %d bytes, %d bytes too short\n", - scsi_dev->name, sb_len, 4 - sb_len); + info("%s: sense buffer too small %d bytes, %d bytes too short", + dev_scsi->kernel_name, sb_len, 4 - sb_len); return -1; } if (sense_buffer[0] < 15) - log_message(LOG_WARNING, "%s: old sense key: 0x%x\n", - scsi_dev->name, sense_buffer[0] & 0x0f); + info("%s: old sense key: 0x%x", dev_scsi->kernel_name, sense_buffer[0] & 0x0f); else - log_message(LOG_WARNING, "%s: sense = %2x %2x\n", - scsi_dev->name, sense_buffer[0], - sense_buffer[2]); - log_message(LOG_WARNING, - "%s: non-extended sense class %d code 0x%0x\n", - scsi_dev->name, sense_class, code); + info("%s: sense = %2x %2x", + dev_scsi->kernel_name, sense_buffer[0], sense_buffer[2]); + info("%s: non-extended sense class %d code 0x%0x", + dev_scsi->kernel_name, sense_class, code); } #ifdef DUMP_SENSE for (i = 0, j = 0; (i < s) && (j < 254); i++) { - dprintf("i %d, j %d\n", i, j); + dbg("i %d, j %d\n", i, j); out_buffer[j++] = hex_str[(sense_buffer[i] & 0xf0) >> 4]; out_buffer[j++] = hex_str[sense_buffer[i] & 0x0f]; out_buffer[j++] = ' '; } out_buffer[j] = '\0'; - log_message(LOG_WARNING, "%s: sense dump:\n", scsi_dev->name); - log_message(LOG_WARNING, "%s: %s\n", scsi_dev->name, out_buffer); + info("%s: sense dump:", dev_scsi->kernel_name); + info("%s: %s", dev_scsi->kernel_name, out_buffer); #endif return -1; } -static int scsi_dump(struct sysfs_device *scsi_dev, struct sg_io_hdr *io) +static int scsi_dump(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) { if (!io->status && !io->host_status && !io->msg_status && !io->driver_status) { /* * Impossible, should not be called. */ - log_message(LOG_WARNING, "%s: called with no error\n", - __FUNCTION__); + info("%s: called with no error", __FUNCTION__); return -1; } - log_message(LOG_WARNING, "%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", - scsi_dev->name, io->driver_status, io->host_status, - io->msg_status, io->status); + info("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x", + dev_scsi->kernel_name, io->driver_status, io->host_status, io->msg_status, io->status); if (io->status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(scsi_dev, io); + return scsi_dump_sense(dev_scsi, io); else return -1; } -static int scsi_inquiry(struct sysfs_device *scsi_dev, int fd, +static int scsi_inquiry(struct sysfs_device *dev_scsi, int fd, unsigned char evpd, unsigned char page, unsigned char *buf, unsigned int buflen) { @@ -306,12 +293,12 @@ static int scsi_inquiry(struct sysfs_device *scsi_dev, int fd, int retry = 3; /* rather random */ if (buflen > SCSI_INQ_BUFF_LEN) { - log_message(LOG_WARNING, "buflen %d too long\n", buflen); + info("buflen %d too long", buflen); return -1; } resend: - dprintf("%s evpd %d, page 0x%x\n", scsi_dev->name, evpd, page); + dbg("%s evpd %d, page 0x%x\n", dev_scsi->kernel_name, evpd, page); memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); io_hdr.interface_id = 'S'; @@ -325,8 +312,7 @@ resend: io_hdr.timeout = DEF_TIMEOUT; if (ioctl(fd, SG_IO, &io_hdr) < 0) { - log_message(LOG_WARNING, "%s: ioctl failed: %s\n", - scsi_dev->name, strerror(errno)); + info("%s: ioctl failed: %s", dev_scsi->kernel_name, strerror(errno)); retval = -1; goto error; } @@ -343,14 +329,14 @@ resend: break; default: - retval = scsi_dump(scsi_dev, &io_hdr); + retval = scsi_dump(dev_scsi, &io_hdr); } if (!retval) { retval = buflen; } else if (retval > 0) { if (--retry > 0) { - dprintf("%s: Retrying ...\n", scsi_dev->name); + dbg("%s: Retrying ...\n", dev_scsi->kernel_name); goto resend; } retval = -1; @@ -358,33 +344,30 @@ resend: error: if (retval < 0) - log_message(LOG_WARNING, - "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", - scsi_dev->name, evpd, page); + info("%s: Unable to get INQUIRY vpd %d page 0x%x.", + dev_scsi->kernel_name, evpd, page); return retval; } /* Get list of supported EVPD pages */ -static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, +static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, unsigned char *buffer, unsigned int len) { int retval; - struct sysfs_attribute *vendor; + const char *vendor; memset(buffer, 0, len); - retval = scsi_inquiry(scsi_dev, fd, 1, 0x0, buffer, len); + retval = scsi_inquiry(dev_scsi, fd, 1, 0x0, buffer, len); if (retval < 0) return 1; if (buffer[1] != 0) { - log_message(LOG_WARNING, "%s: page 0 not available.\n", - scsi_dev->name); + info("%s: page 0 not available.", dev_scsi->kernel_name); return 1; } if (buffer[3] > len) { - log_message(LOG_WARNING, "%s: page 0 buffer too long %d\n", - scsi_dev->name, buffer[3]); + info("%s: page 0 buffer too long %d", dev_scsi->kernel_name, buffer[3]); return 1; } @@ -400,17 +383,13 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, * If the vendor id appears in the page assume the page is * invalid. */ - vendor = sysfs_get_device_attr(scsi_dev, "vendor"); + vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!vendor) { - log_message(LOG_WARNING, - "%s: cannot get model attribute\n", - scsi_dev->name); + info("%s: cannot get model attribute", dev_scsi->kernel_name); return 1; } - if (!strncmp((char *)&buffer[VENDOR_LENGTH], vendor->value, - VENDOR_LENGTH)) { - log_message(LOG_WARNING, "%s: invalid page0 data\n", - scsi_dev->name); + if (!strncmp((char *)&buffer[VENDOR_LENGTH], vendor, VENDOR_LENGTH)) { + info("%s: invalid page0 data", dev_scsi->kernel_name); return 1; } } @@ -421,46 +400,35 @@ static int do_scsi_page0_inquiry(struct sysfs_device *scsi_dev, int fd, * The caller checks that serial is long enough to include the vendor + * model. */ -static int prepend_vendor_model(struct sysfs_device *scsi_dev, char *serial) +static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) { - struct sysfs_attribute *attr; + const char *attr; int ind; - attr = sysfs_get_device_attr(scsi_dev, "vendor"); + attr = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!attr) { - log_message(LOG_WARNING, "%s: cannot get vendor attribute\n", - scsi_dev->name); + info("%s: cannot get vendor attribute", dev_scsi->kernel_name); return 1; } - strncpy(serial, attr->value, VENDOR_LENGTH); + strncpy(serial, attr, VENDOR_LENGTH); ind = strlen(serial) - 1; - /* - * Remove sysfs added newlines. - */ - if (serial[ind] == '\n') - serial[ind] = '\0'; - attr = sysfs_get_device_attr(scsi_dev, "model"); + attr = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!attr) { - log_message(LOG_WARNING, "%s: cannot get model attribute\n", - scsi_dev->name); + info("%s: cannot get model attribute", dev_scsi->kernel_name); return 1; } - strncat(serial, attr->value, MODEL_LENGTH); + strncat(serial, attr, MODEL_LENGTH); ind = strlen(serial) - 1; - if (serial[ind] == '\n') - serial[ind] = '\0'; - else - ind++; + ind++; /* * This is not a complete check, since we are using strncat/cpy * above, ind will never be too large. */ if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { - log_message(LOG_WARNING, "%s: expected length %d, got length %d\n", - scsi_dev->name, (VENDOR_LENGTH + MODEL_LENGTH), - ind); + info("%s: expected length %d, got length %d", + dev_scsi->kernel_name, (VENDOR_LENGTH + MODEL_LENGTH), ind); return 1; } return ind; @@ -470,7 +438,7 @@ static int prepend_vendor_model(struct sysfs_device *scsi_dev, char *serial) * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill * serial number. **/ -static int check_fill_0x83_id(struct sysfs_device *scsi_dev, +static int check_fill_0x83_id(struct sysfs_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values *id_search, char *serial, int max_len) @@ -517,8 +485,8 @@ static int check_fill_0x83_id(struct sysfs_device *scsi_dev, len += VENDOR_LENGTH + MODEL_LENGTH; if (max_len < len) { - log_message(LOG_WARNING, "%s: length %d too short - need %d\n", - scsi_dev->name, max_len, len); + info("%s: length %d too short - need %d", + dev_scsi->kernel_name, max_len, len); return 1; } @@ -531,8 +499,8 @@ static int check_fill_0x83_id(struct sysfs_device *scsi_dev, * included in the identifier. */ if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) - if (prepend_vendor_model(scsi_dev, &serial[1]) < 0) { - dprintf("prepend failed\n"); + if (prepend_vendor_model(dev_scsi, &serial[1]) < 0) { + dbg("prepend failed\n"); return 1; } @@ -559,7 +527,7 @@ static int check_fill_0x83_id(struct sysfs_device *scsi_dev, } /* Extract the raw binary from VPD 0x83 pre-SPC devices */ -static int check_fill_0x83_prespc3(struct sysfs_device *scsi_dev, +static int check_fill_0x83_prespc3(struct sysfs_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values *id_search, char *serial, int max_len) @@ -574,13 +542,13 @@ static int check_fill_0x83_prespc3(struct sysfs_device *scsi_dev, serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; serial[j++] = hex_str[ page_83[4+i] & 0x0f]; } - dprintf("using pre-spc3-83 for %s.\n", scsi_dev->name); + dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel_name); return 0; } /* Get device identification VPD page */ -static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, +static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, char *serial, int len) { int retval; @@ -588,14 +556,13 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned char page_83[SCSI_INQ_BUFF_LEN]; memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(scsi_dev, fd, 1, PAGE_83, page_83, + retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); if (retval < 0) return 1; if (page_83[1] != PAGE_83) { - log_message(LOG_WARNING, "%s: Invalid page 0x83\n", - scsi_dev->name); + info("%s: Invalid page 0x83", dev_scsi->kernel_name); return 1; } @@ -629,7 +596,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, */ if (page_83[6] != 0) - return check_fill_0x83_prespc3(scsi_dev, page_83, + return check_fill_0x83_prespc3(dev_scsi, page_83, id_search_list, serial, len); /* @@ -643,21 +610,21 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, * one or a small number of descriptors. */ for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { - retval = check_fill_0x83_id(scsi_dev, &page_83[j], + retval = check_fill_0x83_id(dev_scsi, &page_83[j], &id_search_list[id_ind], serial, len); - dprintf("%s id desc %d/%d/%d\n", scsi_dev->name, + dbg("%s id desc %d/%d/%d\n", dev_scsi->kernel_name, id_search_list[id_ind].id_type, id_search_list[id_ind].naa_type, id_search_list[id_ind].code_set); if (!retval) { - dprintf(" used\n"); + dbg(" used\n"); return retval; } else if (retval < 0) { - dprintf(" failed\n"); + dbg(" failed\n"); return retval; } else { - dprintf(" not used\n"); + dbg(" not used\n"); } } } @@ -671,7 +638,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *scsi_dev, int fd, * Return the hard coded error code value 2 if the page 83 reply is not * conformant to the SCSI-2 format. */ -static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *scsi_dev, int fd, +static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, char *serial, int len) { int retval; @@ -679,12 +646,12 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned char page_83[SCSI_INQ_BUFF_LEN]; memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(scsi_dev, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); if (retval < 0) return 1; if (page_83[1] != PAGE_83) { - log_message(LOG_WARNING, "%s: Invalid page 0x83\n", scsi_dev->name); + info("%s: Invalid page 0x83", dev_scsi->kernel_name); return 1; } /* @@ -728,12 +695,12 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *scsi_dev, int fd, serial[j++] = hex_str[page_83[i] & 0x0f]; i++; } - dprintf("using pre-spc3-83 for %s.\n", scsi_dev->name); + dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel_name); return 0; } /* Get unit serial number VPD page */ -static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, +static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, char *serial, int max_len) { int retval; @@ -743,20 +710,19 @@ static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, unsigned char buf[SCSI_INQ_BUFF_LEN]; memset(buf, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(scsi_dev, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); if (retval < 0) return retval; if (buf[1] != PAGE_80) { - log_message(LOG_WARNING, "%s: Invalid page 0x80\n", - scsi_dev->name); + info("%s: Invalid page 0x80", dev_scsi->kernel_name); return 1; } len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; if (max_len < len) { - log_message(LOG_WARNING, "%s: length %d too short - need %d\n", - scsi_dev->name, max_len, len); + info("%s: length %d too short - need %d", + dev_scsi->kernel_name, max_len, len); return 1; } /* @@ -764,7 +730,7 @@ static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, * specific type where we prepend '0' + vendor + model. */ serial[0] = 'S'; - ser_ind = prepend_vendor_model(scsi_dev, &serial[1]); + ser_ind = prepend_vendor_model(dev_scsi, &serial[1]); if (ser_ind < 0) return 1; len = buf[3]; @@ -773,7 +739,7 @@ static int do_scsi_page80_inquiry(struct sysfs_device *scsi_dev, int fd, return 0; } -int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, +int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, int page_code, char *serial, int len) { unsigned char page0[SCSI_INQ_BUFF_LEN]; @@ -782,16 +748,16 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, int retval; memset(serial, 0, len); - dprintf("opening %s\n", devname); + dbg("opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { - log_message(LOG_WARNING, "%s: cannot open %s: %s\n", - scsi_dev->name, devname, strerror(errno)); + info("%s: cannot open %s: %s", + dev_scsi->kernel_name, devname, strerror(errno)); return 1; } if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(scsi_dev, fd, serial, len)) { + if (do_scsi_page80_inquiry(dev_scsi, fd, serial, len)) { retval = 1; goto completed; } else { @@ -799,7 +765,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, goto completed; } } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(scsi_dev, fd, serial, len)) { + if (do_scsi_page83_inquiry(dev_scsi, fd, serial, len)) { retval = 1; goto completed; } else { @@ -807,7 +773,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, goto completed; } } else if (page_code == PAGE_83_PRE_SPC3) { - retval = do_scsi_page83_prespc3_inquiry(scsi_dev, fd, serial, len); + retval = do_scsi_page83_prespc3_inquiry(dev_scsi, fd, serial, len); if (retval) { /* * Fallback to servicing a SPC-2/3 compliant page 83 @@ -815,7 +781,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, * conform to pre-SPC3 expectations. */ if (retval == 2) { - if (do_scsi_page83_inquiry(scsi_dev, fd, serial, len)) { + if (do_scsi_page83_inquiry(dev_scsi, fd, serial, len)) { retval = 1; goto completed; } else { @@ -832,8 +798,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, goto completed; } } else if (page_code != 0x00) { - log_message(LOG_WARNING, "%s: unsupported page code 0x%d\n", - scsi_dev->name, page_code); + info("%s: unsupported page code 0x%d", dev_scsi->kernel_name, page_code); return 1; } @@ -841,7 +806,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, * Get page 0, the page of the pages. By default, try from best to * worst of supported pages: 0x83 then 0x80. */ - if (do_scsi_page0_inquiry(scsi_dev, fd, page0, SCSI_INQ_BUFF_LEN)) { + if (do_scsi_page0_inquiry(dev_scsi, fd, page0, SCSI_INQ_BUFF_LEN)) { /* * Don't try anything else. Black list if a specific page * should be used for this vendor+model, or maybe have an @@ -851,11 +816,11 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, goto completed; } - dprintf("%s: Checking page0\n", scsi_dev->name); + dbg("%s: Checking page0\n", dev_scsi->kernel_name); for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) - if (!do_scsi_page83_inquiry(scsi_dev, fd, serial, + if (!do_scsi_page83_inquiry(dev_scsi, fd, serial, len)) { /* * Success @@ -866,7 +831,7 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_80) - if (!do_scsi_page80_inquiry(scsi_dev, fd, serial, + if (!do_scsi_page80_inquiry(dev_scsi, fd, serial, len)) { /* * Success @@ -877,7 +842,6 @@ int scsi_get_serial (struct sysfs_device *scsi_dev, const char *devname, retval = 1; completed: if (close(fd) < 0) - log_message(LOG_WARNING, "%s: close failed: %s\n", - scsi_dev->name, strerror(errno)); + info("%s: close failed: %s", dev_scsi->kernel_name, strerror(errno)); return retval; } diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index f6d26e1c4c..91b4d57d76 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -33,7 +33,7 @@ all: $(PROG) $(MAN_PAGES) $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index b7d67958c9..0bcd267f67 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -21,12 +21,10 @@ #include #include -#include <../../libsysfs/sysfs/libsysfs.h> -#include "../../udev_utils.h" -#include "../../logging.h" +#include "../../udev.h" -#define MAX_NAME_LEN 72 -#define MAX_SERIAL_LEN 256 +#define MAX_NAME_LEN 72 +#define MAX_SERIAL_LEN 256 #define BLKGETSIZE64 _IOR(0x12,114,size_t) #ifdef USE_LOG @@ -54,7 +52,6 @@ void log_message(int priority, const char *format, ...) } #endif -char sysfs_mnt_path[SYSFS_PATH_MAX]; static char vendor_str[64]; static char model_str[64]; static char serial_str[MAX_SERIAL_LEN]; @@ -245,182 +242,176 @@ static void set_scsi_type(char *to, const char *from, int count) * 6.) If the device supplies a serial number, this number * is concatenated with the identification with an underscore '_'. */ -static int usb_id(const char *target_path) +static int usb_id(const char *devpath) { - struct sysfs_class_device *class_dev; /* of target_path */ - struct sysfs_class_device *class_dev_parent; /* for partitions */ - struct sysfs_device *scsi_dev; /* the scsi_device */ - struct sysfs_device *target_dev; - struct sysfs_device *host_dev, *interface_dev, *usb_dev; - struct sysfs_attribute *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; - struct sysfs_attribute *usb_model = NULL, *usb_vendor = NULL, *usb_rev, *usb_serial; - struct sysfs_attribute *if_class, *if_subclass; + struct sysfs_device *dev; + struct sysfs_device *dev_scsi; + struct sysfs_device *dev_target; + struct sysfs_device *dev_host, *dev_interface, *dev_usb; + const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; + const char *usb_model = NULL, *usb_vendor = NULL, *usb_rev, *usb_serial; + const char *if_class, *if_subclass; int if_class_num; int protocol = 0; - class_dev = sysfs_open_class_device_path(target_path); - if (!class_dev) { - info("open class %s failed: %s", target_path, strerror(errno)); + dbg("devpath %s\n", devpath); + + dev = sysfs_device_get(devpath); + if (dev == NULL) { + err("unable to access '%s'", devpath); return 1; } - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent) { - scsi_dev = sysfs_get_classdev_device(class_dev_parent); - } else { - scsi_dev = sysfs_get_classdev_device(class_dev); - } - /* - * The close of scsi_dev will close class_dev or class_dev_parent. - */ - - /* - * We assume we are called after the device is completely ready, - * so we don't have to loop here like udev. (And we are usually - * called via udev.) - */ - if (!scsi_dev) { - /* - * errno is not set if we can't find the device link, so - * don't print it out here. - */ - info("Cannot find sysfs device associated with %s", target_path); + /* get scsi parent device */ + dev_scsi = sysfs_device_get_parent(dev); + if (dev_scsi == NULL) { + err("unable to access parent device of '%s'", devpath); return 1; } - - /* - * Allow only scsi devices. - * - * Other block devices can support SG IO, but only ide-cd does, so - * for now, don't bother with anything else. - */ - if (strcmp(scsi_dev->bus, "scsi") != 0) { - info("%s is not a scsi device", target_path); + /* allow only scsi devices */ + if (strcmp(dev_scsi->subsystem, "scsi") != 0) { + info("%s is not a scsi device", devpath); return 1; } /* target directory */ - target_dev = sysfs_get_device_parent(scsi_dev); + dev_target = sysfs_device_get_parent(dev_scsi); + if (dev_target == NULL) { + err("unable to access parent device of '%s'", devpath); + return 1; + } + /* host directory */ - host_dev = sysfs_get_device_parent(target_dev); + dev_host = sysfs_device_get_parent(dev_target); + if (dev_host == NULL) { + err("unable to access parent device of '%s'", devpath); + return 1; + } + /* usb interface directory */ - interface_dev = sysfs_get_device_parent(host_dev); - /* usb device directory */ - usb_dev = sysfs_get_device_parent(interface_dev); + dev_interface = sysfs_device_get_parent(dev_host); + if (dev_interface == NULL) { + err("unable to access parent device of '%s'", devpath); + return 1; + } - if (strcmp(interface_dev->bus, "usb") != 0) { - info("%s is not an usb device", target_path); + /* usb device directory */ + dev_usb = sysfs_device_get_parent(dev_interface); + if (dev_usb == NULL) { + err("unable to access parent device of '%s'", devpath); + return 1; + } + if (strcmp(dev_interface->subsystem, "usb") != 0) { + info("%s is not an usb device", devpath); return 1; } - if_class = sysfs_get_device_attr(interface_dev, "bInterfaceClass"); + if_class = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceClass"); if (!if_class) { - info("%s: cannot get bInterfaceClass attribute", interface_dev->name); + info("%s: cannot get bInterfaceClass attribute", dev_interface->kernel_name); return 1; } - if_class_num = strtoul(if_class->value, NULL, 16); + if_class_num = strtoul(if_class, NULL, 16); if (if_class_num != 8) { - set_usb_iftype(type_str, if_class->value, sizeof(type_str) - 1); + set_usb_iftype(type_str, if_class, sizeof(type_str)-1); protocol = 0; } else { - if_subclass = sysfs_get_device_attr(interface_dev, - "bInterfaceSubClass"); - protocol = set_usb_ifsubtype(type_str, if_subclass->value, - sizeof(type_str) -1 ); + if_subclass = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceSubClass"); + protocol = set_usb_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); } if (!use_usb_info && protocol == 6) { /* Generic SPC-2 device */ - scsi_vendor = sysfs_get_device_attr(scsi_dev, "vendor"); + scsi_vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!scsi_vendor) { - info("%s: cannot get SCSI vendor attribute", scsi_dev->name); + info("%s: cannot get SCSI vendor attribute", dev_scsi->kernel_name); return 1; } - set_str(vendor_str, scsi_vendor->value, sizeof(vendor_str)-1); + set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); - scsi_model = sysfs_get_device_attr(scsi_dev, "model"); + scsi_model = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!scsi_model) { - info("%s: cannot get SCSI model attribute", scsi_dev->name); + info("%s: cannot get SCSI model attribute", dev_scsi->kernel_name); return 1; } - set_str(model_str, scsi_model->value, sizeof(model_str)-1); + set_str(model_str, scsi_model, sizeof(model_str)-1); - scsi_type = sysfs_get_device_attr(scsi_dev, "type"); + scsi_type = sysfs_attr_get_value(dev_scsi->devpath, "type"); if (!scsi_type) { - info("%s: cannot get SCSI type attribute", scsi_dev->name); + info("%s: cannot get SCSI type attribute", dev_scsi->kernel_name); return 1; } - set_scsi_type(type_str, scsi_type->value, sizeof(type_str)-1); + set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); - scsi_rev = sysfs_get_device_attr(scsi_dev, "rev"); + scsi_rev = sysfs_attr_get_value(dev_scsi->devpath, "rev"); if (!scsi_rev) { - info("%s: cannot get SCSI revision attribute", scsi_dev->name); + info("%s: cannot get SCSI revision attribute", dev_scsi->kernel_name); return 1; } - set_str(revision_str, scsi_rev->value, sizeof(revision_str)-1); + set_str(revision_str, scsi_rev, sizeof(revision_str)-1); } /* Fallback to USB vendor & device */ if (vendor_str[0] == '\0') { if (!use_num_info) - if (!(usb_vendor = sysfs_get_device_attr(usb_dev, "manufacturer"))) + if (!(usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "manufacturer"))) dbg("No USB vendor string found, using idVendor"); if (!usb_vendor) { - if (!(usb_vendor = sysfs_get_device_attr(usb_dev, "idVendor"))) { + if (!(usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "idVendor"))) { dbg("No USB vendor information available\n"); sprintf(vendor_str,"0000"); } } - set_str(vendor_str,usb_vendor->value, sizeof(vendor_str) - 1); + set_str(vendor_str,usb_vendor, sizeof(vendor_str) - 1); } if (model_str[0] == '\0') { if (!use_num_info) - if (!(usb_model = sysfs_get_device_attr(usb_dev, "product"))) + if (!(usb_model = sysfs_attr_get_value(dev_usb->devpath, "product"))) dbg("No USB model string found, using idProduct"); if (!usb_model) { - if (!(usb_model = sysfs_get_device_attr(usb_dev, "idProduct"))) { - dbg("No USB model information available\n"); - sprintf(model_str,"0000"); - } + if (!(usb_model = sysfs_attr_get_value(dev_usb->devpath, "idProduct"))) + dbg("No USB model information available\n"); sprintf(model_str,"0000"); } - set_str(model_str, usb_model->value, sizeof(model_str) - 1); + set_str(model_str, usb_model, sizeof(model_str) - 1); } if (revision_str[0] == '\0') { - usb_rev = sysfs_get_device_attr(usb_dev, "bcdDevice"); - if (usb_rev) { - set_str(revision_str, usb_rev->value, - sizeof(revision_str) - 1); - } + usb_rev = sysfs_attr_get_value(dev_usb->devpath, "bcdDevice"); + if (usb_rev) + set_str(revision_str, usb_rev, sizeof(revision_str)-1); } if (serial_str[0] == '\0') { - usb_serial = sysfs_get_device_attr(usb_dev, "serial"); - if (usb_serial) { - set_str(serial_str, usb_serial->value, - sizeof(serial_str) - 1); - } + usb_serial = sysfs_attr_get_value(dev_usb->devpath, "serial"); + if (usb_serial) + set_str(serial_str, usb_serial, sizeof(serial_str)-1); } return 0; } int main(int argc, char **argv) { - int retval; - char *devpath; - char target_path[MAX_NAME_LEN]; + int retval = 0; + const char *env; + char devpath[MAX_NAME_LEN]; int option; + logging_init("usb_id"); + sysfs_init(); + dbg("argc is %d", argc); - if (sysfs_get_mnt_path(sysfs_mnt_path, MAX_NAME_LEN)) { - info("sysfs_get_mnt_path failed: %s", - strerror(errno)); - exit(1); - } + + /* sysfs path can be overridden for testing */ + env = getenv("SYSFS_PATH"); + if (env) { + strlcpy(sysfs_path, env, sizeof(sysfs_path)); + remove_trailing_chars(sysfs_path, '/'); + } else + strcpy(sysfs_path, "/sys"); while ((option = getopt(argc, argv, "dnux")) != -1 ) { if (optarg) @@ -433,14 +424,14 @@ int main(int argc, char **argv) debug = 1; break; case 'n': - use_num_info=1; - use_usb_info=1; + use_num_info = 1; + use_usb_info = 1; break; case 'u': - use_usb_info=1; + use_usb_info = 1; break; case 'x': - export=1; + export = 1; break; default: info("Unknown or bad option '%c' (0x%x)", option, option); @@ -449,20 +440,19 @@ int main(int argc, char **argv) } } - devpath = getenv("DEVPATH"); - if (devpath) { - strncpy(target_path, sysfs_mnt_path, MAX_NAME_LEN); - strncat(target_path, devpath, MAX_NAME_LEN); - } else { + env = getenv("DEVPATH"); + if (env != NULL) + strlcpy(devpath, env, sizeof(devpath)); + else { if (optind == argc) { fprintf(stderr, "No device specified\n"); - exit(1); + retval = 1; + goto exit; } - devpath = argv[optind]; - strncpy(target_path, devpath, MAX_NAME_LEN); + strlcpy(devpath, argv[optind], sizeof(devpath)); } - retval = usb_id(target_path); + retval = usb_id(devpath); if (retval == 0) { if (export) { @@ -488,5 +478,9 @@ int main(int argc, char **argv) } } } - exit(retval); + +exit: + sysfs_cleanup(); + logging_close(); + return retval; } diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 6201044941..edb5d3ac68 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -35,7 +35,7 @@ $(LIBVOLUME_ID): $(MAKE) -C libvolume_id $(PROG): %: $(HEADERS) %.o $(LIBVOLUME_ID) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(LIBVOLUME_ID) -o $@ $(LIBUDEV) $(LIBSYSFS) $(LIB_OBJS) + $(QUIET) $(LD) $(LDFLAGS) $@.o $(LIBVOLUME_ID) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(QUIET) $(STRIPCMD) $@ endif diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 6f99c52728..a291eda51d 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -29,8 +29,7 @@ #include #include -#include "../../udev_utils.h" -#include "../../logging.h" +#include "../../udev.h" #include "libvolume_id/volume_id.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) diff --git a/libsysfs/LGPL b/libsysfs/LGPL deleted file mode 100644 index e00a829bb6..0000000000 --- a/libsysfs/LGPL +++ /dev/null @@ -1,441 +0,0 @@ - - GNU Lesser Public License - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - [This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your freedom to - share and change it. By contrast, the GNU General Public Licenses are - intended to guarantee your freedom to share and change free software--to - make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some specially - designated software packages--typically libraries--of the Free Software - Foundation and other authors who decide to use it. You can use it too, but - we suggest you first think carefully about whether this license or the - ordinary General Public License is the better strategy to use in any - particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, not - price. Our General Public Licenses are designed to make sure that you have - the freedom to distribute copies of free software (and charge for this - service if you wish); that you receive source code or can get it if you - want it; that you can change the software and use pieces of it in new free - programs; and that you are informed that you can do these things. - - To protect your rights, we need to make restrictions that forbid - distributors to deny you these rights or to ask you to surrender these - rights. These restrictions translate to certain responsibilities for you - if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis or - for a fee, you must give the recipients all the rights that we gave you. - You must make sure that they, too, receive or can get the source code. If - you link other code with the library, you must provide complete object - files to the recipients, so that they can relink them with the library - after making changes to the library and recompiling it. And you must show - them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the - library, and (2) we offer you this license, which gives you legal - permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that there is - no warranty for the free library. Also, if the library is modified by - someone else and passed on, the recipients should know that what they have - is not the original version, so that the original author's reputation will - not be affected by problems that might be introduced by others. - - Finally, software patents pose a constant threat to the existence of any - free program. We wish to make sure that a company cannot effectively - restrict the users of a free program by obtaining a restrictive license - from a patent holder. Therefore, we insist that any patent license - obtained for a version of the library must be consistent with the full - freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the ordinary - GNU General Public License. This license, the GNU Lesser General Public - License, applies to certain designated libraries, and is quite different - from the ordinary General Public License. We use this license for certain - libraries in order to permit linking those libraries into non-free - programs. - - When a program is linked with a library, whether statically or using a - shared library, the combination of the two is legally speaking a combined - work, a derivative of the original library. The ordinary General Public - License therefore permits such linking only if the entire combination fits - its criteria of freedom. The Lesser General Public License permits more - lax criteria for linking other code with the library. - - We call this license the "Lesser" General Public License because it does - Less to protect the user's freedom than the ordinary General Public - License. It also provides other free software developers Less of an - advantage over competing non-free programs. These disadvantages are the - reason we use the ordinary General Public License for many libraries. - However, the Lesser license provides advantages in certain special - circumstances. - - For example, on rare occasions, there may be a special need to encourage - the widest possible use of a certain library, so that it becomes a - de-facto standard. To achieve this, non-free programs must be allowed to - use the library. A more frequent case is that a free library does the same - job as widely used non-free libraries. In this case, there is little to - gain by limiting the free library to free software only, so we use the - Lesser General Public License. - - In other cases, permission to use a particular library in non-free - programs enables a greater number of people to use a large body of free - software. For example, permission to use the GNU C Library in non-free - programs enables many more people to use the whole GNU operating system, - as well as its variant, the GNU/Linux operating system. - - Although the Lesser General Public License is Less protective of the - users' freedom, it does ensure that the user of a program that is linked - with the Library has the freedom and the wherewithal to run that program - using a modified version of the Library. - - The precise terms and conditions for copying, distribution and - modification follow. Pay close attention to the difference between a "work - based on the library" and a "work that uses the library". The former - contains code derived from the library, whereas the latter must be - combined with the library in order to run. - - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other program - which contains a notice placed by the copyright holder or other authorized - party saying it may be distributed under the terms of this Lesser General - Public License (also called "this License"). Each licensee is addressed as - "you". - - A "library" means a collection of software functions and/or data prepared - so as to be conveniently linked with application programs (which use some - of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work which - has been distributed under these terms. A "work based on the Library" - means either the Library or any derivative work under copyright law: that - is to say, a work containing the Library or a portion of it, either - verbatim or with modifications and/or translated straightforwardly into - another language. (Hereinafter, translation is included without limitation - in the term "modification".) - - "Source code" for a work means the preferred form of the work for making - modifications to it. For a library, complete source code means all the - source code for all modules it contains, plus any associated interface - definition files, plus the scripts used to control compilation and - installation of the library. - - Activities other than copying, distribution and modification are not - covered by this License; they are outside its scope. The act of running a - program using the Library is not restricted, and output from such a - program is covered only if its contents constitute a work based on the - Library (independent of the use of the Library in a tool for writing it). - Whether that is true depends on what the Library does and what the program - that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's complete - source code as you receive it, in any medium, provided that you - conspicuously and appropriately publish on each copy an appropriate - copyright notice and disclaimer of warranty; keep intact all the notices - that refer to this License and to the absence of any warranty; and - distribute a copy of this License along with the Library. - - You may charge a fee for the physical act of transferring a copy, and you - may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Library or any portion of it, - thus forming a work based on the Library, and copy and distribute such - modifications or work under the terms of Section 1 above, provided that - you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices stating - that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no charge to - all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a table - of data to be supplied by an application program that uses the facility, - other than as an argument passed when the facility is invoked, then you - must make a good faith effort to ensure that, in the event an - application does not supply such function or table, the facility still - operates, and performs whatever part of its purpose remains meaningful. - - (For example, a function in a library to compute square roots has a - purpose that is entirely well-defined independent of the application. - Therefore, Subsection 2d requires that any application-supplied function - or table used by this function must be optional: if the application does - not supply it, the square root function must still compute square - roots.) - - These requirements apply to the modified work as a whole. If - identifiable sections of that work are not derived from the Library, and - can be reasonably considered independent and separate works in - themselves, then this License, and its terms, do not apply to those - sections when you distribute them as separate works. But when you - distribute the same sections as part of a whole which is a work based on - the Library, the distribution of the whole must be on the terms of this - License, whose permissions for other licensees extend to the entire - whole, and thus to each and every part regardless of who wrote it. - - Thus, it is not the intent of this section to claim rights or contest - your rights to work written entirely by you; rather, the intent is to - exercise the right to control the distribution of derivative or - collective works based on the Library. - - In addition, mere aggregation of another work not based on the Library - with the Library (or with a work based on the Library) on a volume of a - storage or distribution medium does not bring the other work under the - scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public - License instead of this License to a given copy of the Library. To do - this, you must alter all the notices that refer to this License, so that - they refer to the ordinary GNU General Public License, version 2, instead - of to this License. (If a newer version than version 2 of the ordinary GNU - General Public License has appeared, then you can specify that version - instead if you wish.) Do not make any other change in these notices. - - Once this change is made in a given copy, it is irreversible for that - copy, so the ordinary GNU General Public License applies to all subsequent - copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of the - Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or derivative of - it, under Section 2) in object code or executable form under the terms of - Sections 1 and 2 above provided that you accompany it with the complete - corresponding machine-readable source code, which must be distributed - under the terms of Sections 1 and 2 above on a medium customarily used for - software interchange. - - If distribution of object code is made by offering access to copy from a - designated place, then offering equivalent access to copy the source code - from the same place satisfies the requirement to distribute the source - code, even though third parties are not compelled to copy the source along - with the object code. - - 5. A program that contains no derivative of any portion of the Library, - but is designed to work with the Library by being compiled or linked with - it, is called a "work that uses the Library". Such a work, in isolation, - is not a derivative work of the Library, and therefore falls outside the - scope of this License. - - However, linking a "work that uses the Library" with the Library creates - an executable that is a derivative of the Library (because it contains - portions of the Library), rather than a "work that uses the library". The - executable is therefore covered by this License. Section 6 states terms - for distribution of such executables. - - When a "work that uses the Library" uses material from a header file that - is part of the Library, the object code for the work may be a derivative - work of the Library even though the source code is not. Whether this is - true is especially significant if the work can be linked without the - Library, or if the work is itself a library. The threshold for this to be - true is not precisely defined by law. - - If such an object file uses only numerical parameters, data structure - layouts and accessors, and small macros and small inline functions (ten - lines or less in length), then the use of the object file is unrestricted, - regardless of whether it is legally a derivative work. (Executables - containing this object code plus portions of the Library will still fall - under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may distribute - the object code for the work under the terms of Section 6. Any executables - containing that work also fall under Section 6, whether or not they are - linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or link a - "work that uses the Library" with the Library to produce a work containing - portions of the Library, and distribute that work under terms of your - choice, provided that the terms permit modification of the work for the - customer's own use and reverse engineering for debugging such - modifications. - - You must give prominent notice with each copy of the work that the Library - is used in it and that the Library and its use are covered by this - License. You must supply a copy of this License. If the work during - execution displays copyright notices, you must include the copyright - notice for the Library among them, as well as a reference directing the - user to the copy of this License. Also, you must do one of these things: - - a) Accompany the work with the complete corresponding machine-readable - source code for the Library including whatever changes were used in the - work (which must be distributed under Sections 1 and 2 above); and, if - the work is an executable linked with the Library, with the complete - machine-readable "work that uses the Library", as object code and/or - source code, so that the user can modify the Library and then relink to - produce a modified executable containing the modified Library. (It is - understood that the user who changes the contents of definitions files - in the Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the Library. - A suitable mechanism is one that (1) uses at run time a copy of the - library already present on the user's computer system, rather than - copying library functions into the executable, and (2) will operate - properly with a modified version of the library, if the user installs - one, as long as the modified version is interface-compatible with the - version that the work was made with. - - c) Accompany the work with a written offer, valid for at least three - years, to give the same user the materials specified in Subsection 6a, - above, for a charge no more than the cost of performing this - distribution. - - d) If distribution of the work is made by offering access to copy from a - designated place, offer equivalent access to copy the above specified - materials from the same place. - - e) Verify that the user has already received a copy of these materials - or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the Library" - must include any data and utility programs needed for reproducing the - executable from it. However, as a special exception, the materials to be - distributed need not include anything that is normally distributed (in - either source or binary form) with the major components (compiler, kernel, - and so on) of the operating system on which the executable runs, unless - that component itself accompanies the executable. - - It may happen that this requirement contradicts the license restrictions - of other proprietary libraries that do not normally accompany the - operating system. Such a contradiction means you cannot use both them and - the Library together in an executable that you distribute. - - 7. You may place library facilities that are a work based on the Library - side-by-side in a single library together with other library facilities - not covered by this License, and distribute such a combined library, - provided that the separate distribution of the work based on the Library - and of the other library facilities is otherwise permitted, and provided - that you do these two things: - - a) Accompany the combined library with a copy of the same work based on - the Library, uncombined with any other library facilities. This must be - distributed under the terms of the Sections above. - - b) Give prominent notice with the combined library of the fact that part - of it is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute the - Library except as expressly provided under this License. Any attempt - otherwise to copy, modify, sublicense, link with, or distribute the - Library is void, and will automatically terminate your rights under this - License. However, parties who have received copies, or rights, from you - under this License will not have their licenses terminated so long as such - parties remain in full compliance. - - 9. You are not required to accept this License, since you have not signed - it. However, nothing else grants you permission to modify or distribute - the Library or its derivative works. These actions are prohibited by law - if you do not accept this License. Therefore, by modifying or distributing - the Library (or any work based on the Library), you indicate your - acceptance of this License to do so, and all its terms and conditions for - copying, distributing or modifying the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the - Library), the recipient automatically receives a license from the original - licensor to copy, distribute, link with or modify the Library subject to - these terms and conditions. You may not impose any further restrictions on - the recipients' exercise of the rights granted herein. You are not - responsible for enforcing compliance by third parties with this License. - - 11. If, as a consequence of a court judgment or allegation of patent - infringement or for any other reason (not limited to patent issues), - conditions are imposed on you (whether by court order, agreement or - otherwise) that contradict the conditions of this License, they do not - excuse you from the conditions of this License. If you cannot distribute - so as to satisfy simultaneously your obligations under this License and - any other pertinent obligations, then as a consequence you may not - distribute the Library at all. For example, if a patent license would not - permit royalty-free redistribution of the Library by all those who receive - copies directly or indirectly through you, then the only way you could - satisfy both it and this License would be to refrain entirely from - distribution of the Library. - - If any portion of this section is held invalid or unenforceable under any - particular circumstance, the balance of the section is intended to apply, - and the section as a whole is intended to apply in other circumstances. - - It is not the purpose of this section to induce you to infringe any - patents or other property right claims or to contest validity of any such - claims; this section has the sole purpose of protecting the integrity of - the free software distribution system which is implemented by public - license practices. Many people have made generous contributions to the - wide range of software distributed through that system in reliance on - consistent application of that system; it is up to the author/donor to - decide if he or she is willing to distribute software through any other - system and a licensee cannot impose that choice. - - This section is intended to make thoroughly clear what is believed to be a - consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in certain - countries either by patents or by copyrighted interfaces, the original - copyright holder who places the Library under this License may add an - explicit geographical distribution limitation excluding those countries, - so that distribution is permitted only in or among countries not thus - excluded. In such case, this License incorporates the limitation as if - written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new versions - of the Lesser General Public License from time to time. Such new versions - will be similar in spirit to the present version, but may differ in detail - to address new problems or concerns. - - Each version is given a distinguishing version number. If the Library - specifies a version number of this License which applies to it and "any - later version", you have the option of following the terms and conditions - either of that version or of any later version published by the Free - Software Foundation. If the Library does not specify a license version - number, you may choose any version ever published by the Free Software - Foundation. - - 14. If you wish to incorporate parts of the Library into other free - programs whose distribution conditions are incompatible with these, write - to the author to ask for permission. For software which is copyrighted by - the Free Software Foundation, write to the Free Software Foundation; we - sometimes make exceptions for this. Our decision will be guided by the two - goals of preserving the free status of all derivatives of our free - software and of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY - FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN - OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES - PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED - OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS - TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE - LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, - REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING - WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR - REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, - INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES - ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT - LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES - SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE - WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN - ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - diff --git a/libsysfs/dlist.c b/libsysfs/dlist.c deleted file mode 100644 index 5579602bbc..0000000000 --- a/libsysfs/dlist.c +++ /dev/null @@ -1,621 +0,0 @@ -/* - * dlist.c - * - * Copyright (C) 2003 Eric J Bohm - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 021110307 USA - * - */ - - -/* Double linked list implementation. - - * You allocate the data and give dlist the pointer. - * If your data is complex set the dlist->del_func to a an appropriate - * delete function. Otherwise dlist will just use free. - -*/ -#include "stdlib.h" -#include "dlist.h" - -/* - * Return pointer to node at marker. - * else null if no nodes. - */ - -inline void *dlist_mark(Dlist *list) -{ - if(list->marker!=NULL) - return(list->marker->data); - else - return(NULL); -} - -/* - * Set marker to start. - */ - -inline void dlist_start(Dlist *list) -{ - list->marker=list->head; -} - -/* - * Set marker to end. - */ - -inline void dlist_end(Dlist *list) -{ - list->marker=list->head; -} - -/* internal use function - * quickie inline to consolidate the marker movement logic - * in one place - * - * when direction true it moves marker after - * when direction false it moves marker before. - * return pointer to data at new marker - * if nowhere to move the marker in desired direction return null - */ -inline void *_dlist_mark_move(Dlist *list,int direction) -{ - if(direction) - { - if( list->marker && list->marker->next!=NULL) - list->marker=list->marker->next; - else - return(NULL); - } - else - { - if( list->marker && list->marker->prev!=NULL) - list->marker=list->marker->prev; - else - return(NULL); - } - if(list->marker!=list->head) - return(list->marker->data); - else - return(NULL); -} - -/* - * Create new linked list to store nodes of datasize. - * return null if list cannot be created. - */ -Dlist *dlist_new(size_t datasize) -{ - Dlist *list=NULL; - if((list=malloc(sizeof(Dlist)))) - { - list->marker=NULL; - list->count=0L; - list->data_size=datasize; - list->del_func=free; - list->head=&(list->headnode); - list->head->prev=NULL; - list->head->next=NULL; - list->head->data=NULL; - } - return(list); -} - -/* - * Create new linked list to store nodes of datasize set list - * data node delete function to the passed in del_func - * return null if list cannot be created. - */ -Dlist *dlist_new_with_delete(size_t datasize,void (*del_func)(void*)) -{ - Dlist *list=NULL; - list=dlist_new(datasize); - if(list!=NULL) - list->del_func=del_func; - return(list); -} - - -/* - * remove marker node from list - * call data_delete function on data if registered. - * otherwise call free. - * when direction true it moves marker after - * when direction false it moves marker before. - * free marker node - * return nothing. - */ -void dlist_delete(Dlist *list,int direction) -{ - if((list->marker != list->head)&&(list->marker!=NULL)) - { - DL_node *corpse; - corpse=list->marker; - _dlist_mark_move(list,direction); - if(list->head->next==corpse) - list->head->next=corpse->next; - if(list->head->prev==corpse) - list->head->prev=corpse->prev; - if(corpse->prev!=NULL) //should be impossible - corpse->prev->next=corpse->next; - if(corpse->next!=NULL) //should be impossible - corpse->next->prev=corpse->prev; - list->del_func(corpse->data); - list->count--; - free(corpse); - } -} - -/* - * Insert node containing data at marker. - * If direction true it inserts after. - * If direction false it inserts before. - * move marker to inserted node - * return pointer to inserted node - */ -void *dlist_insert(Dlist *list,void *data,int direction) -{ - DL_node *new_node=NULL; - if(list==NULL || data==NULL) - return(NULL); - if(list->marker==NULL) //in case the marker ends up unset - list->marker=list->head; - if((new_node=malloc(sizeof(DL_node)))) - { - new_node->data=data; - new_node->prev=NULL; - new_node->next=NULL; - list->count++; - if(list->head->next==NULL) //no l - { - list->head->next=list->head->prev=new_node; - new_node->prev=list->head; - new_node->next=list->head; - } - else if(direction) - { - new_node->next=list->marker->next; - new_node->prev=list->marker; - list->marker->next->prev=new_node; - list->marker->next=new_node; - } - else - { - new_node->prev=list->marker->prev; - new_node->next=list->marker; - list->marker->prev->next=new_node; - list->marker->prev=new_node; - } - list->marker=new_node; - } - else - { - return(NULL); - } - return(list->marker->data); -} - -/* internal use only - * Insert dl_node at marker. - * If direction true it inserts after. - * If direction false it inserts before. - * move marker to inserted node - * return pointer to inserted node - */ -void *_dlist_insert_dlnode(struct dlist *list,struct dl_node *new_node,int direction) -{ - if(list==NULL || new_node==NULL) - return(NULL); - if(list->marker==NULL) //in case the marker ends up unset - list->marker=list->head; - list->count++; - if(list->head->next==NULL) - { - list->head->next=list->head->prev=new_node; - new_node->prev=list->head; - new_node->next=list->head; - } - else if(direction) - { - new_node->next=list->marker->next; - new_node->prev=list->marker; - list->marker->next->prev=new_node; - list->marker->next=new_node; - } - else - { - new_node->prev=list->marker->prev; - new_node->next=list->marker; - list->marker->prev->next=new_node; - list->marker->prev=new_node; - } - list->marker=new_node; - return(list->marker); -} - - - -/* - * Remove DL_node from list without deallocating data. - * if marker == killme . - * when direction true it moves marker after - * when direction false it moves marker before. - * to previous if there is no next. - */ -void *_dlist_remove(Dlist *list,DL_node *killme,int direction) -{ - if(killme!=NULL) - { - void *killer_data=killme->data; - // take care of head and marker pointers. - if(list->marker==killme) - _dlist_mark_move(list,direction); - if(killme ==list->head->next) - list->head->next=killme->next; - if(killme==list->head->prev) - list->head->prev=killme->prev; - // remove from list - if(killme->prev !=NULL) - killme->prev->next=killme->next; - if(killme->next !=NULL) - killme->next->prev=killme->prev; - list->count--; - free(killme); - return(killer_data); - } - else - return (NULL); -} - -/* - * move dl_node from source to dest - * if marker == target . - * when direction true it moves marker after - * when direction false it moves marker before. - * to previous if there is no next. - */ -void dlist_move(struct dlist *source, struct dlist *dest, struct dl_node *target,int direction) -{ - - if(target!=NULL) - { - if(target==source->head) - { - //not even going to try - } - else - { - // take care of head and marker pointers. - if(source->marker==target) - _dlist_mark_move(source,direction); - if(target ==source->head->next) - source->head->next=target->next; - if(target==source->head->prev) - source->head->prev=target->prev; - // remove from list - if(source->count==1) - { - target->prev=NULL; - target->next=NULL; - source->head->next=NULL; - source->head->prev=NULL; - } - else - { - if(target->prev !=NULL) - target->prev->next=target->next; - if(target->next !=NULL) - target->next->prev=target->prev; - target->prev=NULL; - target->next=NULL; - } - source->count--; - _dlist_insert_dlnode(dest,target,direction); - } - } -} - - -/* - * Insert node containing data after end. - */ -void dlist_push(Dlist *list,void *data) -{ - list->marker=list->head->prev; - dlist_insert(list,data,1); -} - -/* - * Insert node containing data at start. - */ - -void dlist_unshift(Dlist *list,void *data) - -{ - list->marker=list->head->next; - dlist_insert(list,data,0); -} - -void dlist_unshift_sorted(Dlist *list, void *data, - int (*sorter)(void *new_elem, void *old_elem)) -{ - if (list->count == 0) - dlist_unshift(list, data); - else { - list->marker=list->head->next; - dlist_insert_sorted(list, data, sorter); - } -} - -/* - * Remove end node from list. - * Return pointer to data in removed node. - * Null if no nodes. - */ - -void *dlist_pop(Dlist *list) -{ - return(_dlist_remove(list,list->head->prev,0)); -} - -/* - * Remove start node from list. - * Return pointer to data in removed node. - * Null if no nodes. - */ - -void *dlist_shift(Dlist *list) -{ - return(_dlist_remove(list,list->head->next,1)); -} - - -/* - * destroy the list freeing all memory - */ - - -void dlist_destroy(Dlist *list) -{ - if(list !=NULL) - { - dlist_start(list); - dlist_next(list); - while (dlist_mark(list)) { - dlist_delete(list,1); - } - free(list); - } -} - -/** - * Return void pointer to list_data element matching comp function criteria - * else null - * Does not move the marker. - */ - -void *dlist_find_custom(struct dlist *list, void *target, int (*comp)(void *, void *)) -{ - /* test the comp function on each node */ - struct dl_node *nodepointer; - dlist_for_each_nomark(list,nodepointer) - if(comp(target,nodepointer->data)) - return(nodepointer->data); - return(NULL); -} - -/** - * Apply the node_operation function to each data node in the list - */ -void dlist_transform(struct dlist *list, void (*node_operation)(void *)) -{ - struct dl_node *nodepointer; - dlist_for_each_nomark(list,nodepointer) - node_operation(nodepointer->data); -} - -/** - * insert new into list in sorted order - * sorter function in form int sorter(new,ith) - * must return 1 for when new should go before ith - * else 0 - * return pointer to inserted node - * NOTE: assumes list is already sorted - */ -void *dlist_insert_sorted(struct dlist *list, void *new, int (*sorter)(void *, void *)) -{ - for(dlist_start(list),dlist_next(list); \ - list->marker!=list->head && !sorter(new,list->marker->data);dlist_next(list)); - return(dlist_insert_before(list,new)); -} - -/* - * NOTE: internal use only - */ -int _dlist_merge(struct dlist *listsource, struct dlist *listdest, unsigned int passcount, int (*compare)(void *, void *)) -{ - - struct dl_node *l1head; - struct dl_node *l2head; - struct dl_node *target; - unsigned int l1count=0; - unsigned int l2count=0; - unsigned int mergecount=0; - while(listsource->count>0) - { - l1head=listsource->head->next; - l2head=l1head; - while((l1counthead)) - { - l2head=l2head->next; - l1count++; - } - // so now we have two lists to merge - - if(l2head==listsource->head) - {// l2count - l2count=0; - } - else - { - l2count=passcount; - } - while(l1count>0 || l2count>0) - { - mergecount++; - if((l2count>0)&&(l1count>0)) - { - // we have things to merge - int result=compare(l1head->data,l2head->data); - if(result>0) - { - // move from l2 - target=l2head; - l2head=l2head->next; - dlist_move(listsource,listdest,target,1); - l2count--; - if(l2head==listsource->head) - l2count=0; - } - else - { - // move from l1 - target=l1head; - l1head=l1head->next; - dlist_move(listsource,listdest,target,1); - l1count--; - } - } - else if(l1count>0) - { - // only have l1 to work with - while(l1count>0) - { - target=l1head; - l1head=l1head->next; - dlist_move(listsource,listdest,target,1); - l1count--; - } - } - else if(l2count>0) - { - // only have l2 to work with - while(l2count>0) - { - if(l2head==listsource->head) - { - l2count=0; - } - else - { - target=l2head; - l2head=l2head->next; - dlist_move(listsource,listdest,target,1); - l2count--; - } - } - } - else - { //nothing left and this should be unreachable - } - } - } - return(mergecount); -} - -/** - * mergesort the list based on compare - * compare function in form int sorter(void * a,void * b) - * must return >0 for a after b - * must return <0 for a before b - * else 0 - - * NOTE: mergesort changes the mark pointer - */ -void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)) -{ - - struct dlist *listsource, *listdest, *swap; - struct dlist *templist; - unsigned int passcount = 1; - unsigned int mergecount = 1; - - dlist_start(list); - templist = dlist_new(list->data_size); - - // do nothing if there isn't anything to sort - listsource = list; - listdest = templist; - if(listsource->count<2) - { //nothing to do - return; - } - else - { - while(mergecount>0) - { - mergecount=_dlist_merge(listsource, listdest, passcount, compare); - if(mergecount>1) - { - passcount=passcount*2; - //start new pass - swap=listsource; - listsource=listdest; - listdest=swap; - } - } - } - // now put the input list pointers right - // list pointers = newlist pointers - // including the forward and next nodes prev and back pointers - if(list->count==0) - {//copy - list->marker = listdest->marker; - list->count = listdest->count; - list->data_size = listdest->data_size; - list->del_func = listdest->del_func; - list->head->prev = listdest->head->prev; - list->head->next = listdest->head->next; - list->head->data = listdest->head->data; - list->head->next->prev=list->head; - list->head->prev->next=list->head; - templist->head->next=NULL; - templist->head->prev=NULL; - templist->count=0; - } - else - {// no need to copy - - } - - dlist_destroy(templist); -} - - - -/* internal use function - swaps elements a and b - No sense in juggling node pointers when we can just swap the data pointers -*/ - -void _dlist_swap(struct dlist *list, struct dl_node *a, struct dl_node *b) -{ - - void *swap=a->data; - a->data=b->data; - b->data=swap; - -} - diff --git a/libsysfs/libsysfs.txt b/libsysfs/libsysfs.txt deleted file mode 100644 index b877cb8030..0000000000 --- a/libsysfs/libsysfs.txt +++ /dev/null @@ -1,1954 +0,0 @@ - - System Utilities sysfs Library - libsysfs - ========================================= - -Version: 1.2.0 -September 13, 2004 - -Contents --------- -1. Introduction -2. Requirements -3. Definitions -4. Overview -5. Data Structures - 5.1 Directory and Attribute Data Structures - 5.1.1 Attribute Structure - 5.1.2 Link Structure - 5.1.3 Directory Structure - 5.2 Bus Data Structure - 5.3 Class Data Structures - 5.4 Root Device Data Structure - 5.5 Device Data Structure - 5.6 Driver Data Structure -6. Functions - 6.1 Calling Conventions in Libsysfs - 6.2 Utility Functions - 6.3 Filesystem Functions - 6.3.1 Attribute Functions - 6.3.2 Directory Link Functions - 6.3.3 Directory Functions - 6.4 Bus Functions - 6.5 Class Functions - 6.6 Device Functions - 6.7 Driver Functions -7. Dlists - 7.1 Navigating a dlist - 7.2 Custom sorting using dlist_sort_custom() -8. Usage -9. Testsuite -10. Conclusion - - -1. Introduction ---------------- - -Libsysfs' purpose is to provide a consistent and stable interface for -querying system device information exposed through the sysfs filesystem. -The library implements functions for querying filesystem information, -such as reading directories and files. It also contains routines for -working with buses, classes, and the device tree. - - -2. Requirements ---------------- - -The library must satisfy the following requirements: - -- It must provide a stable programming interfaces that applications can - be built upon. - -- It must provide functions to retrieve device Vital Product Data (VPD) - information for Error Log Analysis (ELA) support. ELA will provide - device driver and device bus address information. - -- It must provide access to all system devices and information exposed - by sysfs. - -- It must provide a function to find sysfs' current mount point. - -- It must provide a function for udev to retrieve a device's major and - minor numbers. - - -3. Definitions --------------- - -- sysfs: Sysfs is a virtual filesystem in 2.5+ Linux kernels that - presents a hierarchical representation of all system physical and - virtual devices. It presents system devices by bus, by class, and - by topology. Callbacks to device drivers are exposed as files in - device directories. Sysfs, for all purposes, is our tree of system - devices. For more information, please see: - - http://www.kernel.org/pub/linux/kernel/people/mochel/doc/ - -- udev: Udev is Greg Kroah-Hartman's User Space implementation of devfs. - Udev creates /dev nodes for devices upon Hotplug events. The Hotplug - event provides udev with a sysfs directory location of the device. Udev - must use that directory to grab device's major and minor number, which it - will use to create the /dev node. For more information, please see: - - http://www.kernel.org/pub/linux/utils/kernel/hotplug/ - - Udev provides persistent device naming based on a set of user specified - rules. The rules a device name is based on could one or a combination of a - number of parameters such as the bus the device is on, the serial number - of the device (in case of USB), the vendor name (in case of SCSI) and so - on. Udev uses Libsysfs to retrieve relevent information to appropriately - name devices. - - -4. Overview ------------ - -Libsysfs grew from a common need. There are several applications under -development that need access to sysfs and system devices. Udev, on a -hotplug event, must take a sysfs device path and create a /dev node. Our -diagnostic client needs to list all system devices. Finally, our Error -Log Analysis piece is required to retrieve VPD information for a -failing device. We divided to create a single library interface rather -than having these separate applications create their own accesses to -sysfs involving reading directories and files. - -Libsysfs will also provide stability for applications to be built upon. Sysfs -currently doesn't enforce any standards for callback or file names. File -names change depending on bus or class. Sysfs is also changing, it is -currently being developed. Libsysfs will provide a stable interface to -applications while allowing sysfs to change underneath it. - -Like sysfs, the library will provide devices to applications by bus, by -class, and by topology. The library will function similar to directories -and files that lie underneath it. To query a device on a PCI bus, one would -"open" the bus to scan or read devices and "close" the bus when -completed. Besides supplying functions to retrieve devices, the library -will also provide some utility functions like getting sysfs mount point. - -A paper on Libsysfs was presented at Linux.Conf.Au 2004 (Adelaide, January -2004). The paper is available online at: - -http://oss.software.ibm.com/linux/papers/libsysfs/libsysfs-linuxconfau2004.pdf - - -5. Data Structures ------------------- - -Libsysfs will classify system devices following sysfs' example, dividing -them by bus, class, and devices. The library presents this information -generically. It doesn't, for example, differentiate between PCI and USB -buses. Device attributes are presented with values as they are exposed -by sysfs, the values are not formatted. - -The library will provide standard definitions for working with sysfs -and devices, here's some examples: - -#define SYSFS_FSTYPE_NAME "sysfs" -#define SYSFS_PROC_MNTS "/proc/mounts" -#define SYSFS_BUS_NAME "bus" -#define SYSFS_CLASS_NAME "class" -#define SYSFS_BLOCK_NAME "block" -#define SYSFS_DEVICES_NAME "devices" -#define SYSFS_DRIVERS_NAME "drivers" -#define SYSFS_NAME_ATTRIBUTE "name" - -The library uses some definitions to mark maximum size of a sysfs name or -path length: - -#define SYSFS_PATH_MAX 255 -#define SYSFS_NAME_LEN 50 -#define SYSFS_BUS_ID_SIZE 20 - - -NOTE: - a. As of release 0.4.0 of sysfsutils, a number of changes have been - made so that the dlists and "directory" references in all libsysfs's - structures are not populated until such time that it is absolutely - necessary. Hence, these elements may not contain valid data at all - times (as was the case before). - b. As of release 1.0.0 of sysfsutils, all dlists in the library are - sorted in alphabetical order. It is now a requirement that the - "name" and "path" be the first two elements of all libsysfs - structures. - - -5.1 Directory and Attribute Data Structures -------------------------------------------- - -The library implements structures to represent sysfs directories, links, -and files. - - -5.1.1 Attribute Structure -------------------------- - -A file in sysfs represents a device or driver attribute. Attributes can be -read only, write only, or read and write. File data can be ASCII and -binary. The library has the following structure to represent files: - -struct sysfs_attribute { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - char *value; - unsigned short len; /* value length */ - unsigned short method; /* show and store */ -}; - -Path represents the file/attribute's full path. Value is used when reading -from or writing to an attribute. "len" is the length of data in "value". -Method is a bitmask for defining if the attribute supports show(read) -and/or store(write). - - -5.1.2 Link Structure --------------------- - -Symbolic links are used in sysfs to link bus or class views with -particular devices. - -struct sysfs_link { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - char target[SYSFS_PATH_MAX]; -}; - -Link's name is stored in "name' and it's target stored in "target". Absolute -path to the link is stored in "path". - - -5.1.3 Directory Structure -------------------------- - -The directory structure represents a sysfs directory: - -struct sysfs_directory { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *subdirs; - struct dlist *links; - struct dlist *attributes; -}; - -The sysfs_directory structure includes the list of subdirectories, links and -attributes. The "name" and absolute "path" are also stored in the structure. -The sysfs_directory structure is intended for use internal to the library. -Applications needing access to attributes and links from the directory -will need to make appropriate calls (described below) to get the same. - - -5.2 Bus Data Structure ----------------------- - -All buses look similar in sysfs including lists of devices and drivers, -therefore we use the following structure to represent all sysfs buses: - -struct sysfs_bus { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *drivers; - struct dlist *devices; - struct sysfs_directory *directory; -}; - -The sysfs_bus structure contains the bus "name", while the "path" to bus -directory is also stored. It also contains lists of devices on the bus -and drivers that are registered on it. The bus' directory is represented -by the sysfs_directory structure and it contains references to all the -subdirectories, links, and attributes. The sysfs_directory structure -is for internal use only. The following functions may be used by -applications to retrieve data from the sysfs_directory structure: - -struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) -struct sysfs_attribute *sysfs_get_bus_attribute(struct sysfs_bus *bus, - char *attrname) - - -5.3 Class Data Structures -------------------------- - -The library uses two data structures to represent classes in sysfs. Sysfs -classes contains a class directory like "net" or "scsi_host" and then -class devices like "eth0", "lo", or "eth1" for the "net" class. - -struct sysfs_class { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; -}; - -The sysfs_class represents device classes in sysfs like "net". It contains -the class "name", "path" to the class, a list of class devices and the -directory representation (for internal use only). - -struct sysfs_class_device { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - char classname[SYSFS_NAME_LEN]; - - /* Private: for internal use only */ - struct sysfs_class_device *parent; - struct sysfs_device *sysdevice; /* NULL if virtual */ - struct sysfs_driver *driver; /* NULL if not implemented */ - struct sysfs_directory *directory; -}; - -A class device isn't the same as a sysfs_device, it's specific to the class in -which it belongs. The class device structure contains the name of the class -the class device belongs to, its sysfs_device reference and that device's -driver reference (if any). It also contains the name of the class device -- like "eth0", its parent point (if present) and its sysfs directory -information including links and attributes (for internal use only). -The following function may be used by applications to retrieve data -from the sysfs_directory structure: - -struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *cdev); - - -5.4 Root Device Data Structure ------------------------------- - -Device hierarchies in sysfs are represented under the /sys/devices directory -structure. Sysfs devices typically spawn off from base devices which are -represented by a sysfs_root_device. - -struct sysfs_root_device { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; -}; - -The sysfs_root_device structure contains a list of "devices" that spawn off it. -The name of the root device as represented under /sys/devices is read into -"name" and the absolute path into "path" and its sysfs_directory information -intended to be used internal to the library. - - -5.5 Device Data Structure -------------------------- - -The sysfs_device structure represents a system device that's exposed -in sysfs under the /sys/devices directory structure. - -struct sysfs_device { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - char bus_id[SYSFS_NAME_LEN]; - char bus[SYSFS_NAME_LEN]; - char driver_name[SYSFS_NAME_LEN]; - - /* Private: for internal use only */ - struct sysfs_device *parent; - struct dlist *children; - struct sysfs_directory *directory; -}; - -The sysfs_device structure contains a "parent" pointer, a list of child -devices, if any, device's directory, its bus id - which is the name of -device's directory, the bus name on which this device is registered and -its driver name. The device structure also contains the absolute path -to the device and a directory structure, which contains a list of the -device's attributes (for internal use only). The following functions -may be used to obtain information from sysfs_directory structure: - -struct sysfs_attribute *sysfs_get_device_attribute(struct sysfs_device *dev, - const char *name) -struct dlist *sysfs_get_device_attributes(struct sysfs_device *device) - - -5.6 Driver Data Structure -------------------------- - -The sysfs_driver structure represents a device driver. - -struct sysfs_driver { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - - /* Private: for internal use only */ - struct dlist *devices; - struct sysfs_directory *directory; -}; - -The sysfs_driver structure contains a list of devices that use this driver, -the name of the driver, its path, and its directory information, which -includes the driver's attributes (for internal use only). The following -function may be used to retrieve driver attribute information from the -sysfs_directory structure: - -struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver) - - -6. Functions ------------- - -Libsysfs will provide functions to access system devices by bus, by class, -and by device. Functions will act like accessing directories and files, -using "open" and "close". Open returns a structure and close is used -to clean that structure up. - - -6.1 Calling Conventions in Libsysfs ------------------------------------ - -Libsysfs uses a simple API calling convention. APIs are classified to be -one of "open", "get", "close" types. The convention is as follows: - - a. All "open" APIs have a corresponding "close" API. - b. References obtained using "get" calls should not be closed - explicitly. - c. All "opened" references have to be closed with a call to - their corresponding "close" call. This takes care of - freeing structure references obtained with "get" calls. - - -6.2 Utility Functions ---------------------- - -The library will provide a few utility functions for working with sysfs. - -------------------------------------------------------------------------------- -Name: sysfs_get_mnt_path - -Description: Function finds the mount path for filesystem type "sysfs". - -Arguments: char *mnt_path Mount path buffer - size_t len Size of mount path buffer - -Returns: Zero with success. - -1 with error. Errno will be set with error: - - EINVAL for invalid argument, if buffer is NULL or - if len is zero - -Prototype: sysfs_get_mnt_path(char *mnt_path, size_t len); -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_name_from_path - -Description: Function returns the last directory or file name from the - included path. - -Arguments: const char *path Path to parse name from - char *name Buffer to put parsed name into - size_t *len Size of name buffer - -Returns: 0 with success. - -1 on Error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_get_name_from_path(const char *path, - char *name, size_t *len) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_link - -Description: Sysfs readlink function, reads the link at supplied path - and returns its target path. - -Arguments: const char *path Link's path - char *target Buffer to place link's target - size_t len Size of target buffer - -Returns: 0 with success - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_get_link(const char *path, char *target, size_t len) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_subsystem_list - -Description: Function returns the list of entries for the given subsystem. If - the argument is "bus", this function will return a list of buses - ("pci", "scsi", etc) supported on the system. - - sysfs_close_list() has to be called to free the list obtained - from this call. - -Arguments: char *name Subsystem to open, like "bus".. - -Returns: dlist of entries for the subsystem on success - NULL with error indicating the "name" subsystem is invalid. - -Prototype: struct dlist *sysfs_open_subsystem_list(char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_bus_devices_list - -Description: Function returns the list of devices on the given bus. - - sysfs_close_list() has to be called to free the list obtained - from this call. - -Arguments: char *name Bus name to open "pci"/"scsi"/"usb".. - -Returns: dlist of device names for the given bus on success - NULL with error indicating the bus is not supported. - -Prototype: struct dlist *sysfs_open_bus_devices_list(char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_list - -Description: Closes a given dlist. This can be used as a generic list close - routine. - -Arguments: struct dlist *list List to be closed - -Prototype: void sysfs_close_list(struct dlist *list) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_path_is_dir - -Description: Utility function to verify if a given path is to a directory. - -Arguments: const char *path Path to verify - -Returns: 0 on success, 1 on error - - EINVAL for invalid arguments - -Prototype: int sysfs_path_is_dir(const char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_path_is_file - -Description: Utility function to verify if a given path is to a file. - -Arguments: const char *path Path to verify - -Returns: 0 on success, 1 on error - - EINVAL for invalid arguments - -Prototype: int sysfs_path_is_file(const char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_path_is_link - -Description: Utility function to verify if a given path is to a link. - -Arguments: const char *path Path to verify - -Returns: 0 on success, 1 on error - - EINVAL for invalid arguments - -Prototype: int sysfs_path_is_link(const char *path) -------------------------------------------------------------------------------- - - -6.3 Filesystem Functions ------------------------- - -Libsysfs provides a set of functions to open, read, and close directories -and attributes/files in sysfs. These functions mirror their filesystem -function counterparts. - - -6.3.1 Attribute Functions -------------------------- - -Along with the usual open, read, and close functions, libsysfs provides -a couple other functions for accessing attribute values. - -------------------------------------------------------------------------------- -Name: sysfs_open_attribute - -Description: Opens up a file in sysfs and creates a sysfs_attribute - structure. File isn't read with this function. - -Arguments: const char *path File/Attribute's path - -Returns: struct sysfs_attribute * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_open_attribute(const char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_attribute - -Description: Cleans up and closes sysfs_attribute structure. - -Arguments: struct sysfs_attribute *sysattr Attribute to close - -Prototype: void sysfs_close_attribute(struct sysfs_attribute *sysattr) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_dir_attributes - -Description: Reads the given sysfs_directory to create a list of attributes. - -Arguments: struct sysfs_directory *sysdir sysfs_directory whose - attributes to read - -Returns: struct dlist * of attributes on success - NULL with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: struct dlist *sysfs_read_dir_attributes - (struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_refresh_dir_attributes - -Description: Given a list sysfs_directory, this function refreshes the list - of attributes for the given directory. - -Arguments: struct sysfs_directory *sysdir sysfs_ directory whose - attributes list to refresh - -Returns: 0 with success. - 1 with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: int sysfs_refresh_dir_attributes(struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_dir_attributes - -Description: Returns a list of attributes for the given sysfs_directory. - -Arguments: struct sysfs_directory *sysdir sysfs_directory whose - attributes list to return - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: struct dlist *sysfs_read_dir_attributes - (struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_attribute - -Description: Reads the supplied attribute. Since the maximum transfer - from a sysfs attribute is a pagesize, function reads in - up to a page from the file and stores it in the "value" - field in the attribute. - -Arguments: struct sysfs_attribute *sysattr Attribute to read - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_read_attribute(struct sysfs_attribute *sysattr) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_write_attribute - -Description: Writes to the supplied attribute. Function validates if the - given attribute is writable, and writes the new value to the - attribute. Value to write as well as its length is user - supplied. In case the length written is not equal to the - length requested to be written, the original value is - restored and an error is returned. - -Arguments: struct sysfs_attribute *sysattr Attribute to write to - const char *new_value sysattr's new value - size_t len Length of "new_value" - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const char *new_value, size_t len) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_attribute_value - -Description: Given a path to a specific attribute, function reads and - returns its value to the supplied value buffer. - -Arguments: const char *attrpath Attribute path to read - char *value Buffer to read in attribute's value - size_t vsize Size of buffer - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_read_attribute_value(const char *attrpath, - char *value, size_t vsize) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_value_from_attributes - -Description: Function takes a single or linked list of sysfs attribute - structures and returns the value of the specified attribute - name. - -Arguments: struct dlist *attr Attribute list to search through - const char *name Name of attribute whose value - to retrieve - -Returns: char * attribute value with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: char *sysfs_get_value_from_attributes - (struct sysfs_attribute *attr, const char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_directory_attribute - -Description: Function walks the list of attributes for the given sysfs - directory and returns the sysfs_attribute structure for - the specified attribute name. - -Arguments: struct sysfs_directory *dir Directory in which to search - char *attrname Attribute name to look for - -Returns: struct sysfs_attribute on success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_directory_attribute - (struct sysfs_directory *dir, char *attrname) -------------------------------------------------------------------------------- - - -6.3.2 Link Functions --------------------- - -Sysfs contains many symbolic links, like bus links to bus devices. Libsysfs -treats links differently than directories due to processing differences. A -link in the /sys/bus/"busname"/devices/ directory indicates a device in the -/sys/devices directory. Through links we give the functionality to know -what is and what isn't a link and the ability to query the links target. - -------------------------------------------------------------------------------- -Name: sysfs_open_link - -Description: Opens a directory link. - -Arguments: const char *linkpath Path to link - -Returns: struct sysfs_link * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_link *sysfs_open_link(const char *linkpath) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_link - -Description: Closes a directory link structure. - -Arguments: struct sysfs_link *ln Link to close - -Prototype: void sysfs_close_link(struct sysfs_link *ln) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_dir_links - -Description: Reads the given sysfs_directory to create a list of links. - -Arguments: struct sysfs_directory *sysdir sysfs_directory whose - links to read - -Returns: struct dlist * of links with success - NULL with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: struct dlist *sysfs_read_dir_links - (struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_dir_links - -Description: Returns a list of links for the given sysfs_directory. - -Arguments: struct sysfs_directory *sysdir sysfs_directory whose - list of links to return - -Returns: struct dlist * of links with success - NULL with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: struct dlist *sysfs_read_dir_links - (struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_directory_link - -Description: Function walks the list of links for the given sysfs directory - and returns the sysfs_link structure for the specified link - name. - -Arguments: struct sysfs_directory *dir Directory in which to search - char *linkname Link name to look for - -Returns: struct sysfs_link * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_link *sysfs_get_directory_link - (struct sysfs_directory *dir, char *linkname) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_subdirectory_link - -Description: Function walks the list of links for the given sysfs directory - and its subdirectories returns the sysfs_link structure for - the specified link name. - -Arguments: struct sysfs_directory *dir Directory in which to search - char *linkname Link name to look for - -Returns: struct sysfs_link * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_link *sysfs_get_subdirectory_link - (struct sysfs_directory *dir, char *linkname) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_refresh_dir_links - -Description: Given a list sysfs_directory, this function refreshes the list - of links under the given directory. - -Arguments: struct sysfs_directory *sysdir sysfs_ directory whose - links list to refresh - -Returns: 0 with success. - 1 with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: int sysfs_refresh_dir_links(struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - - -6.3.3 Directory Functions -------------------------- - -Sysfs directories can represent every directory under sysfs. The structures -keep track of subdirectories, links, and files. Like opendir, readdir, and -closedir, libsysfs provides open, read, and close functions for working with -sysfs directories. Open creates the sysfs_directory structure. Read reads in -its contents - like subdirectories, links, and files. Close cleans it all -up. - -------------------------------------------------------------------------------- -Name: sysfs_open_directory - -Description: Opens a sysfs directory at a specific path - -Arguments: const char *path Directory path to open - -Returns: struct sysfs_directory * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_directory *sysfs_open_directory(const char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_directory - -Description: Closes specific directory, its subdirectories, links, and - files. - -Arguments: struct sysfs_directory *sysdir Directory to close - -Prototype: void sysfs_close_directory(struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_dir_subdirs - -Description: Reads the given sysfs_directory to create a list of subdirs. - -Arguments: struct sysfs_directory *sysdir sysfs_directory whose - subdirs have to be read - -Returns: struct dlist * of links with success - NULL with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: struct dlist *sysfs_read_dir_subdirs - (struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_directory - -Description: Read the supplied directory. Reading fills in the directory's - contents like subdirectories, links, and attributes. - -Arguments: struct sysfs_directory *sysdir Directory to read - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_read_directory(struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_read_all_subdirs - -Description: Reads all subdirs under a given supplied directory. - -Arguments: struct sysfs_directory *sysdir Directory to read - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_read_all_subdirs(struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_subdirectory - -Description: Function walks the directory tree for the given directory and - returns a sysfs_directory structure for the specified directory - name. - -Arguments: struct sysfs_directory *dir Directory in which to search - char *subname Name of directory to look for - -Returns: struct sysfs_directory with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_directory *sysfs_get_subdirectory - (struct sysfs_directory *dir, char *subname) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_dir_subdirs - -Description: Returns a list of subdirs for the given sysfs_directory. - -Arguments: struct sysfs_directory *sysdir sysfs_directory whose - subdirectories list to return - -Returns: struct dlist * of directories with success - NULL with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: struct dlist *sysfs_read_dir_subdirs - (struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_refresh_dir_subdirs - -Description: Given a list sysfs_directory, this function refreshes the list - of subdirectories under the given directory. - -Arguments: struct sysfs_directory *sysdir sysfs_ directory whose - subdirs list to refresh - -Returns: 0 with success. - 1 with error. Errno will be set on error, returning EINVAL - for invalid arguments - -Prototype: int sysfs_refresh_dir_subdirs(struct sysfs_directory *sysdir) -------------------------------------------------------------------------------- - - -6.4 Bus Functions ------------------ - -The library provides a functions for viewing buses represented in sysfs. -The sysfs_open_bus opens a bus in the /sys/bus directory, such as "pci", -"usb", or "scsi". The open command returns a sysfs_bus structure that -contains a list of the bus' devices. The sysfs_close_bus function is -used to clean up the bus structure. Given a device or a driver, -functions are provided to determine what bus they are on. - -------------------------------------------------------------------------------- -Name: sysfs_open_bus - -Description: Function opens up one of the buses represented in sysfs in - the /sys/bus directory. It returns a sysfs_bus structure - that includes a list of bus devices and drivers. - -Arguments: const char *name Bus name to open, like "pci"... - -Returns: struct sysfs_bus * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_bus *sysfs_open_bus(const char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_bus - -Description: Function closes up the sysfs_bus structure including its - devices, drivers, and directory. - -Arguments: sysfs_bus *bus Bus structure to close - -Prototype: void sysfs_close_bus(struct sysfs_bus *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_devices - -Description: Function returns a list of devices that are registered with - this bus. - -Arguments: struct sysfs_bus *bus Bus whose devices list to return - -Returns: struct dlist * of sysfs_devices on success - NULL with error. Errno will be sent with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_drivers - -Description: Function returns a list of drivers that are registered with - this bus. - -Arguments: struct sysfs_bus *bus Bus whose drivers list to return - -Returns: struct dlist * of sysfs_drivers on success - NULL with error. Errno will be sent with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_device - -Description: Function takes a sysfs_bus structure(obtained on a successful - return from a sysfs_open_bus() call) and looks for the given - device on this bus. On success, it returns a sysfs_device - structure corresponding to the device. - -Arguments: struct sysfs_bus *bus Bus structure on which to search - char *id Device to look for - -Returns: struct sysfs_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_get_bus_device - (struct sysfs_bus *bus, char *id) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_driver - -Description: Function takes a sysfs_bus structure (obtained on a successful - return from a sysfs_open_bus() call) and looks for the given - driver on this bus. On success, it returns a sysfs_driver - structure corresponding to the driver. - -Arguments: struct sysfs_bus *bus Bus structure on which to search - char *drvname Driver to look for - -Returns: struct sysfs_driver * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_get_bus_driver - (struct sysfs_bus *bus, char *drvname) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_attributes - -Description: Function takes a sysfs_bus structure and returns a list of - attributes for the bus. - -Arguments: struct sysfs_bus *bus Bus for which attributes are required - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_bus_attribute - -Description: Function takes a sysfs_bus structure and looks for the required - attribute on the bus. On success, it returns a sysfs_attribute - structure corresponding to the given attribute. - -Arguments: struct sysfs_bus *bus Bus structure on which to search - char *attrname Attribute to look for - -Returns: struct sysfs_attribute * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_bus_attribute - (struct sysfs_bus *bus, char *attrname) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_refresh_bus_attributes - -Description: Function refreshes the list of attributes for a given sysfs_bus - -Arguments: struct sysfs_bus *bus Bus whose attributes list to refresh - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_bus_attributes(struct sysfs_bus *bus) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_find_driver_bus - -Description: Given the name of a driver, this function finds the name of the - bus the driver is on - -Arguments: const char *driver Name of the driver to look for - char *busname Buffer to return the bus name - size_t bsize Size of the "busname" buffer - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_find_driver_bus(const char *driver, - char *busname, size_t bsize) -------------------------------------------------------------------------------- - - -6.5 Class Functions -------------------- - -Libsysfs provides functions to open sysfs classes and their class devices. -These functions too operate with open and close, close must be called to -clean up the class structures. Given a class device name, functions are -provided to determine what class they belong to. Once a class device -name and the class it belongs to is known, a function to open the -class device is provided. This method can be used when details of -a single class device is required. - -------------------------------------------------------------------------------- -Name: sysfs_open_class - -Description: Function opens up one of the classes represented in sysfs in - the /sys/class directory. It returns a sysfs_class structure - that includes a list of class devices. - -Arguments: const char *name Class name to open, like "net".. - -Returns: struct sysfs_class * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class *sysfs_open_class(const char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_class - -Description: Function closes up the sysfs_class structure including its - class devices. - -Arguments: sysfs_class *cls Class structure to close - -Prototype: void sysfs_close_class(struct sysfs_class *cls); -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_class_device_path - -Description: Function opens up one of the class devices represented in - sysfs in sysfs/class/"class"/ directory. It returns a - sysfs_class_device structure. - -Arguments: const char *path Path to class device - -Returns: struct sysfs_class_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class_device *sysfs_open_class_device_path - (const char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_class_device - -Description: Function closes up the sysfs_class_device structure. - -Arguments: sysfs_class_device *dev Class device structure to close - -Prototype: void sysfs_close_class_device(struct sysfs_class_device *dev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_class_device - -Description: Function takes a sysfs_class structure(obtained on a successful - return from a sysfs_open_class() call) and looks for the given - device in this class. On success, it returns a sysfs_class_device - structure corresponding to the class device. - -Arguments: struct sysfs_class *cls Class on which to search - char *name Class device "name" to look for - -Returns: struct sysfs_class_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class_device *sysfs_get_class_device - (struct sysfs_class *cls, char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_class_devices - -Description: Function returns a list of class devices for the given class. - -Arguments: struct sysfs_class *cls Class whose class device list - is required - -Returns: struct dlist * of sysfs_class_devices on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_class_device - -Description: Given the name of the class on which to look for, this function - locates a given class device and returns a sysfs_class_device - structure corresponding to the requested class device. - - NOTE: - 1. The sysfs_class_device structure obtained upon successful - return from this function has to be closed by calling - sysfs_close_class_device(). - 2. Class this device belongs to must be known prior to calling - this function. - -Arguments: const char *classname Class on which to search - char *name Class device "name" to open - -Returns: struct sysfs_class_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class_device *sysfs_open_class_device - (const char *classname, char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_device - -Description: Function returns the sysfs_device reference (if present) for the - given class device. - -Arguments: struct sysfs_class_device *clsdev Class device whose - sysfs_device reference - is required - -Returns: struct sysfs_device * on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_get_classdev_device - (struct sysfs_class_device *clsdev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_driver - -Description: Function returns the sysfs_driver reference (if present) for - the given class device. - -Arguments: struct sysfs_class_device *clsdev Class device whose - sysfs_driver reference - is required - -Returns: struct sysfs_driver * on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_driver *sysfs_get_classdev_driver - (struct sysfs_class_device *clsdev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_parent - -Description: Function returns the sysfs_class_device reference for the - parent (if present) of the given class device. - -Arguments: struct sysfs_class_device *clsdev Class device whose - parent reference - is required - -Returns: struct sysfs_class_device * on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_class_device *sysfs_get_classdev_parent - (struct sysfs_class_device *clsdev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_attributes - -Description: Function takes a sysfs_class_device structure and returns a - list of attributes for the class device. - -Arguments: struct sysfs_class_device *cdev Class device for which - attributes are required - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_classdev_attributes - (struct sysfs_class_device *cdev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_classdev_attr - -Description: Searches supplied class device's attributes by name and returns - the attribute. - -Arguments: struct sysfs_class_device *clsdev Device to search - const char *name Attribute name to find - -Returns: struct sysfs_attribute * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_classdev_attr - (struct sysfs_class_device *clsdev, const char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_refresh_classdev_attributes - -Description: Function refreshes the list of attributes for a given - sysfs_class_device. - -Arguments: struct sysfs_class_device *cdev Class device whose attributes - list to refresh - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_classdev_attributes - (struct sysfs_class_device *cdev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_classdev_attr - -Description: Function takes as arguments, a the name of the class, the class - device name and the name of the required attribute. - - NOTE: - 1. The struct sysfs_attribute * obtained upon successful - return from this function has to be closed by making - a call to sysfs_close_attribute() - -Arguments: char *classname Class name on which to search - char *dev Name of the class device - char *attrib Attribute to open - -Returns: struct sysfs_attribute * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_write_classdev_attr - (const char *classname, const char *dev, - const char *attrib) -------------------------------------------------------------------------------- - - -6.6 Device Functions --------------------- - -Devices represent everything in sysfs under /sys/devices, which is a -hierarchical view of system devices. Besides the expected open and -close functions, libsysfs provides open and close functions for -root devices. These functions recursively open or close a device -and all of its children. - -------------------------------------------------------------------------------- -Name: sysfs_open_device_path - -Description: Opens up a device at a specific path. It opens the device's - directory, reads the directory, and returns a sysfs_device - structure. - -Arguments: const char *path Path to device - -Returns: struct sysfs_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_open_device_path(const char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_device - -Description: Function closes up the sysfs_device structure. - -Arguments: sysfs_device *dev Device structure to close - -Prototype: void sysfs_close_device(struct sysfs_device *dev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_root_device - -Description: Function opens up one of the root devices represented in sysfs - in the /sys/devices directory. It returns a sysfs_root_device - structure that includes a list of devices in the tree. - -Arguments: const char *name Name of the root device to open - -Returns: struct sysfs_root_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_open_root_device(const char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_root_device - -Description: Function closes up the sysfs_root_device structure including the - devices in the root device tree. - -Arguments: sysfs_device *root Root device structure to close - -Prototype: void sysfs_close_root_device(struct sysfs_root_device *root) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_device_tree - -Description: Function opens up the device tree at the specified path. - -Arguments: const char *path Path at which to open the device tree - -Returns: struct sysfs_device * with success - NULL with error, Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_open_device_tree(const char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_device_tree - -Description: Function closes the device tree originating at the given - sysfs_device. - -Arguments: struct sysfs_device *devroot Device from which the device - tree has to be closed - -Prototype: void sysfs_close_device_tree(struct sysfs_device *devroot) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_device_parent - -Description: Function returns the sysfs_device reference for the parent - (if present) of the given sysfs_device. - -Arguments: struct sysfs_device *dev sysfs_device whose parent - reference is required - -Returns: struct sysfs_device * on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_get_device_parent - (struct sysfs_device *dev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_root_devices - -Description: Function returns a list of devices under the given root device. - -Arguments: struct sysfs_root_device *root sysfs_root_device whose devices - list is required - -Returns: struct dlist * of sysfs_devices on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_root_devices - (struct sysfs_root_device *root) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_device_attr - -Description: Searches supplied device's attributes by name and returns - the attribute. - -Arguments: struct sysfs_device *dev Device to search - const char *name Attribute name to find - -Returns: struct sysfs_attribute * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_device_attr - (struct sysfs_device *dev, const char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_device_attributes - -Description: Function takes a sysfs_device structure and returns a list - of attributes for the device. - -Arguments: struct sysfs_device *device Device for which - attributes are required - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_device_attributes - (struct sysfs_device *device) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_refresh_device_attributes - -Description: Function refreshes the list of attributes for a given - sysfs_device. - -Arguments: struct sysfs_device *device Device whose attributes list - to refresh - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_refresh_device_attributes - (struct sysfs_device *device) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_device - -Description: Given the name of the bus on which to look for, this function - locates a given device and returns a sysfs_device structure - corresponding to the requested device. - -Arguments: const char *bus Bus on which to search - const char *bus_id Device to look for - -Returns: struct sysfs_device * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_device *sysfs_open_device - (const char *bus, const char *bus_id) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_device_bus - -Description: Given a sysfs_device, this function fills in the bus this - device is on in the sysfs_device->bus field. - -Arguments: struct sysfs_device *dev Device whose bus name to find - -Returns: 0 with success. - -1 with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: int sysfs_get_device_bus(struct sysfs_device *dev) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_device_attr - -Description: Function takes as arguments, the bus on which to search for a - device, and an attribute of the device to open. - - NOTE: - 1. The struct sysfs_attribute * obtained upon successful - return from this function has to be closed by making - a call to sysfs_close_attribute() - -Arguments: char *bus Bus on which to search - char *bus_id Device to look for - char *attrib Name of the attribute to open - -Returns: struct sysfs_attribute * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_open_device_attr - (const char *bus, const char *bus_id, const char *attrib) -------------------------------------------------------------------------------- - - -6.7 Driver Functions --------------------- - -Drivers are represented in sysfs under the /sys/bus/xxx/drivers (xxx being -the bus type, such as "pci", "usb, and so on). Functions are provided to -open and close drivers. - -------------------------------------------------------------------------------- -Name: sysfs_open_driver_path - -Description: Opens driver at specific path. - -Arguments: const char *path Path to driver - -Returns: struct sysfs_driver * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_driver *sysfs_open_driver_path(const char *path) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_close_driver - -Description: Closes and cleans up sysfs_driver structure. - -Arguments: sysfs_driver *driver Driver structure to close - -Prototype: void sysfs_close_driver(struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_devices - -Description: Function returns a list of devices that use this driver. - -Arguments: struct sysfs_driver *driver Driver whose devices list is - required - -Returns: struct dlist * of sysfs_devices on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_driver_devices - (struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_refresh_driver_devices - -Description: Function refreshes the list of devices that use this driver. - -Arguments: struct sysfs_driver *driver Driver whose devices list is - required to be refreshed - -Returns: struct dlist * of sysfs_devices on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_refresh_driver_devices - (struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_device - -Description: Function returns a sysfs_device reference for the device with - "name" that uses this driver - -Arguments: struct sysfs_driver *driver Driver on which to search - const char *name Name of the device to look for - -Returns: struct sysfs_device * corresponding to "name" on success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_driver_device - (struct sysfs_driver *driver, const char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_attr - -Description: Searches supplied driver's attributes by name and returns - the attribute. - -Arguments: struct sysfs_driver *drv Driver to search - const char *name Attribute name to find - -Returns: struct sysfs_attribute * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_get_driver_attr - (struct sysfs_driver *drv, const char *name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_attributes - -Description: Function takes a sysfs_driver structure and returns a list - of attributes for the driver. - -Arguments: struct sysfs_driver *driver Driver for which attributes - are required - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_get_driver_attributes - (struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_refresh_driver_attributes - -Description: Function refreshes the list of attributes for a given - sysfs_driver. - -Arguments: struct sysfs_driver *driver Driver whose attributes list - to refresh - -Returns: struct dlist * of attributes with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct dlist *sysfs_refresh_driver_attributes - (struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_driver - -Description: Given the name of the bus on which to look for, this function - locates a given driver and returns a sysfs_driver structure - corresponding to the requested device. - - NOTE: - 1. The sysfs_driver structure obtained upon successful return - from this function has to be closed by calling - sysfs_close_driver_by_name(). - 2. Bus on which to look for this driver should be known prior - to calling this function. Use sysfs_find_driver_bus() - to determine this. - -Arguments: const char *bus_name Bus on which to search - const char *drv_name Driver name to look for - -Returns: struct sysfs_driver * with success - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_driver *sysfs_open_driver(const char *bus_name, - const char *drv_name) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_get_driver_links - -Description: Function returns a list of links for a given driver - -Arguments: struct sysfs_driver *driver Driver to get links from - -Returns: struct dlist * of links on success - NULL with error - -Prototype: struct dlist *sysfs_get_driver_links - (struct sysfs_driver *driver) -------------------------------------------------------------------------------- - -------------------------------------------------------------------------------- -Name: sysfs_open_driver_attr - -Description: Function takes as arguments, the bus the driver is registered - on, the driver name and the name of the attribute to open. - - NOTE: - 1. The struct sysfs_attribute * obtained upon successful - return from this function has to be closed by making - a call to sysfs_close_attribute() - -Arguments: char *bus Bus on which driver is present - char *drv Driver to look for - char *attrib Name of the attribute to open - -Returns: struct sysfs_attribute * with success. - NULL with error. Errno will be set with error, returning - - EINVAL for invalid arguments - -Prototype: struct sysfs_attribute *sysfs_open_driver_attr - (const char *bus, const char *drv, const char *attrib) -------------------------------------------------------------------------------- - - -7 Dlists --------- - -Libsysfs uses (yet another) list implementation thanks to Eric J Bohm. - - -7.1 Navigating a dlist ----------------------- - -Some library functions return a dlist of devices/drivers/attributes, etc. -To navigate the list returned the macro "dlist_for_each_data" is to be used. - ------------------------------------------------------------------------------- -Function/Macro name: dlist_for_each_data - -Description: Walk the given list, returning a known data type/ - structure in each iteration. - -Arguments: struct dlist *list List pointer - data_iterator Data type/structure variable - contained in the list - datatype Data type/structure contained - in the list - -Returns: On each iteration, "data_iterator" will contain a list - element of "datatype" - -Usage example: The function sysfs_get_classdev_attributes() returns a - dlist of attributes. To navigate the list: - - struct sysfs_attribute *attr = NULL; - struct dlist *attrlist = NULL; - . - . - . - attrlist = sysfs_get_classdev_attributes - (struct sysfs_class_device *cdev) - if (attrlist != NULL) { - dlist_for_each_data(attrlist, attr, - struct sysfs_attribute) { - . - . - . - } - } -------------------------------------------------------------------------------- - - -7.2 Custom sorting using dlist_sort_custom() --------------------------------------------- - -As of release 1.2.0, libsysfs provides a new interface for custom sorting -of dlists. The API dlist_sort_custom() has been added for this purpose. -Applications that would like to define their own sorter function can now -make use of this API. - -The sorter function must conform to the following prototype: - - int compare(void *a, void*b) - -dlist_sort_custom() expects that the compare function will: - return >0 for a before b - return <0 for b before a - return 0 for a == b - - -8. Usage --------- - -Accessing devices through libsysfs is supposed to mirror accessing devices -in the filesystem it represents. Here's a typical order of operation: - - - get sysfs mount point - - "open" sysfs category, ie. bus, class, or device - - work with category - - "close" sysfs category - - -9. Testsuite ------------- - -Version 1.0.0 of sysfsutils ships with a comprehensive testsuite. The testsuite -shipped as part of the "test" directory of the sysfsutils source package, -results in an executable "testlibsysfs" which will be installed in the -/usr/local/bin directory. Some of the salient features of the testsuite are: - -a. Tests _every_ API exported by the library. -b. Tests are performed for all possible combinations of input parameters. -c. Detailed output is provided for the correct case. -d. Facility to redirect output of the tests to a normal file. -e. Number of iterations of tests can be specified. - -The testsuite comes with its own configuration file "libsysfs.conf" in the -"test" directory. This file is used to generate a header file at the time -the tests are built. - -To use the testsuite: - -a. Modify the variables libsysfs.conf file to appropriate values for your - system. (The libsysfs.conf file contains comments describing what each - variable stands for and, in some cases, how to determine an appropriate - value for the system under test). - -b. Build and install the testsuite. - -c. Run the testsuite: - - testlibsysfs - -The default logfile is stdout. - -NOTE: If the libsysfs.conf file is changed, make sure to run "make clean" in -the test directory and then a "make" for the changes to take effect. - - -10. Conclusion --------------- - -Libsysfs is meant to provide a stable application programming interface to -sysfs. Applications can depend upon the library to access system devices -and functions exposed through sysfs. diff --git a/libsysfs/sysfs.h b/libsysfs/sysfs.h deleted file mode 100644 index 2add8227a4..0000000000 --- a/libsysfs/sysfs.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * sysfs.h - * - * Internal Header Definitions for libsysfs - * - * Copyright (C) IBM Corp. 2003-2005 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#ifndef _SYSFS_H_ -#define _SYSFS_H_ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define safestrcpy(to, from) strncpy(to, from, sizeof(to)-1) -#define safestrcat(to, from) strncat(to, from, sizeof(to) - strlen(to)-1) - -#define safestrcpymax(to, from, max) \ -do { \ - to[max-1] = '\0'; \ - strncpy(to, from, max-1); \ -} while (0) - -#define safestrcatmax(to, from, max) \ -do { \ - to[max-1] = '\0'; \ - strncat(to, from, max - strlen(to)-1); \ -} while (0) - -extern struct sysfs_attribute *get_attribute(void *dev, const char *name); -extern struct dlist *read_dir_subdirs(const char *path); -extern struct dlist *read_dir_links(const char *path); -extern struct dlist *get_attributes_list(void *dev); - -/* Debugging */ -#ifdef DEBUG -#include "../logging.h" -#define dprintf(format, arg...) dbg(format, ## arg) -#else -#define dprintf(format, arg...) do { } while (0) -#endif - -#endif /* _SYSFS_H_ */ diff --git a/libsysfs/sysfs/dlist.h b/libsysfs/sysfs/dlist.h deleted file mode 100644 index 335a490a0a..0000000000 --- a/libsysfs/sysfs/dlist.h +++ /dev/null @@ -1,207 +0,0 @@ -/* - * dlist.h - * - * Copyright (C) 2003 Eric J Bohm - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#ifndef _DLIST_H_ -#define _DLIST_H_ - -/* Double linked list header. - -* navigate your list with DLIST_PREV and DLIST_NEXT. These are macros -* so function call overhead is minimized. - -* Supports perl style push, pop, shift, unshift list semantics. - -* You allocate the data and give dlist the pointer. If your data is -* complex set the dlist->del_func to a an appropriate delete using -* dlist_new_with_delete. Your delete function must match -(void * )(del(void *) -*Otherwise dlist will just use free. - -* NOTE: The small amount of pain involved in doing that allows us to -* avoid copy in copy out semantics. - -* Dlist uses an internal mark pointer to keep track of where you are -* in the list. - -* insert and delete take a directional parameter. Where direction -* corresponds to the direction in which you want the list to go. -* true direction corresponded to progressing forward in the last -* false to regressing in the list. -* so a dlist_insert(yourlist,item,1) will insert it after the mark -* so a dlist_insert(yourlist,item,0) will insert it before the mark -* any insert will move the mark to the new node regardless of the direction. - -* Just use the dlist_(insert|delete)_(before|after) macros if you do not want -* to think about it. - -*/ - -#include - -typedef struct dl_node { - struct dl_node *prev; - struct dl_node *next; - void *data; -} DL_node; - -typedef struct dlist { - DL_node *marker; - unsigned long count; - size_t data_size; - void (*del_func)(void *); - DL_node headnode; - DL_node *head; -} Dlist; - -Dlist *dlist_new(size_t datasize); -Dlist *dlist_new_with_delete(size_t datasize,void (*del_func)(void*)); -void *_dlist_mark_move(Dlist *list,int direction); -void *dlist_mark(Dlist *); -void dlist_start(Dlist *); -void dlist_end(Dlist *); -void dlist_move(struct dlist *source, struct dlist *dest, struct dl_node *target,int direction); -void *dlist_insert(Dlist *,void *,int) ; - -void *dlist_insert_sorted(struct dlist *list, void *new_elem, int (*sorter)(void *, void *)); - -void dlist_delete(Dlist *,int); - -void dlist_push(Dlist *,void *); - -void dlist_unshift(Dlist *,void *); -void dlist_unshift_sorted(Dlist *,void *,int (*sorter)(void *, void *)); - -void *dlist_pop(Dlist *); - -void *dlist_shift(Dlist *); - -void dlist_destroy(Dlist *); - -int _dlist_merge(struct dlist *listsource, struct dlist *listdest, unsigned int passcount, int (*compare)(void *, void *)); - -void *dlist_find_custom(struct dlist *list, void *target, int (*comp)(void *, void *)); - -void dlist_sort_custom(struct dlist *list, int (*compare)(void *, void *)); - - -void _dlist_swap(struct dlist *list, struct dl_node *a, struct dl_node *b); - -void dlist_transform(struct dlist *list, void (*node_operation)(void *)); - - -/* - * _dlist_remove is for internal use only - * _dlist_mark_move is for internal use only - */ -void *_dlist_remove(struct dlist *,struct dl_node *,int ); -void *_dlist_insert_dlnode(struct dlist *list,struct dl_node *new_node,int direction); - -#define dlist_prev(A) _dlist_mark_move((A),0) -#define dlist_next(A) _dlist_mark_move((A),1) - -#define dlist_insert_before(A,B) dlist_insert((A),(B),0) -#define dlist_insert_after(A,B) dlist_insert((A),(B),1) - -#define dlist_delete_before(A) dlist_delete((A),0) -#define dlist_delete_after(A) dlist_delete((A),1) - -/** - * provide for loop header which iterates the mark from start to end - * list: the dlist pointer, use dlist_mark(list) to get iterator - */ -#define dlist_for_each(list) \ - for(dlist_start(list),dlist_next(list); \ - (list)->marker!=(list)->head;dlist_next(list)) - -/** - * provide for loop header which iterates the mark from end to start - * list: the dlist pointer, use dlist_mark(list) to get iterator - */ -#define dlist_for_each_rev(list) \ - for(dlist_end(list),dlist_prev(list); \ - (list)->marker!=(list)->head;dlist_prev(list)) - -/** - * provide for loop header which iterates through the list without moving mark - * list: the dlist_pointer - * iterator: dl_node pointer to iterate - */ -#define dlist_for_each_nomark(list,iterator) \ - for((iterator)=(list)->head->next; (iterator)!=(list)->head; \ - (iterator)=(iterator)->next) - -/** - * provide for loop header which iterates through the list without moving mark - * in reverse - * list: the dlist_pointer - * iterator: dl_node pointer to iterate - */ -#define dlist_for_each_nomark_rev(list,iterator) \ - for((iterator)=(list)->head->prev; (iterator)!=(list)->head; \ - (iterator)=(iterator)->prev) -/** - * provide for loop header which iterates through the list providing a - * data iterator - * list: the dlist pointer - * data_iterator: the pointer of type datatype to iterate - * datatype: actual type of the contents in the dl_node->data - */ - -#define dlist_for_each_data(list,data_iterator,datatype) \ - for(dlist_start(list), (data_iterator)=(datatype *) dlist_next(list); \ - (list)->marker!=(list)->head;(data_iterator)=(datatype *) dlist_next(list)) - -/** - * provide for loop header which iterates through the list providing a - * data iterator in reverse - * list: the dlist pointer - * data_iterator: the pointer of type datatype to iterate - * datatype: actual type of the contents in the dl_node->data - */ -#define dlist_for_each_data_rev(list,data_iterator,datatype) \ - for(dlist_end(list), (data_iterator)=(datatype *) dlist_prev(list); \ - (list)->marker!=(list)->head;(data_iterator)=(datatype *) dlist_prev(list)) - -/** - * provide for loop header which iterates through the list providing a - * data iterator without moving the mark - * list: the dlist pointer - * iterator: the dl_node pointer to iterate - * data_iterator: the pointer of type datatype to iterate - * datatype: actual type of the contents in the dl_node->data - */ - -#define dlist_for_each_data_nomark(list,iterator,data_iterator,datatype) \ - for((iterator)=(list)->head->next, (data_iterator)=(datatype *) (iterator)->data; \ - (iterator)!=(list)->head;(iterator)=(iterator)->next,(data_iterator)=(datatype *) (iterator)) - -/** - * provide for loop header which iterates through the list providing a - * data iterator in reverse without moving the mark - * list: the dlist pointer - * iterator: the dl_node pointer to iterate - * data_iterator: the pointer of type datatype to iterate - * datatype: actual type of the contents in the dl_node->data - */ -#define dlist_for_each_data_nomark_rev(list,iterator, data_iterator,datatype) \ - for((iterator)=(list)->head->prev, (data_iterator)=(datatype *) (iterator)->data; \ - (iterator)!=(list)->head;(iterator)=(iterator)->prev,(data_iterator)=(datatype *) (iterator)) - -#endif /* _DLIST_H_ */ diff --git a/libsysfs/sysfs/libsysfs.h b/libsysfs/sysfs/libsysfs.h deleted file mode 100644 index 12e7cc5f99..0000000000 --- a/libsysfs/sysfs/libsysfs.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * libsysfs.h - * - * Header Definitions for libsysfs - * - * Copyright (C) IBM Corp. 2004-2005 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#ifndef _LIBSYSFS_H_ -#define _LIBSYSFS_H_ - -#include -#include -#include "dlist.h" - -#define SYSFS_FSTYPE_NAME "sysfs" -#define SYSFS_PROC_MNTS "/proc/mounts" -#define SYSFS_BUS_NAME "bus" -#define SYSFS_CLASS_NAME "class" -#define SYSFS_BLOCK_NAME "block" -#define SYSFS_DEVICES_NAME "devices" -#define SYSFS_DRIVERS_NAME "drivers" -#define SYSFS_MODULE_NAME "module" -#define SYSFS_NAME_ATTRIBUTE "name" -#define SYSFS_UNKNOWN "unknown" -#define SYSFS_PATH_ENV "SYSFS_PATH" - -#define SYSFS_PATH_MAX 256 -#define SYSFS_NAME_LEN 64 -#define SYSFS_BUS_ID_SIZE 32 - -/* mount path for sysfs, can be overridden by exporting SYSFS_PATH */ -#define SYSFS_MNT_PATH "/sys" - -enum sysfs_attribute_method { - SYSFS_METHOD_SHOW = 0x01, /* attr can be read by user */ - SYSFS_METHOD_STORE = 0x02, /* attr can be changed by user */ -}; - -/* - * NOTE: - * 1. We have the statically allocated "name" as the first element of all - * the structures. This feature is used in the "sorter" function for dlists - * 2. As is the case with attrlist - * 3. As is the case with path - */ -struct sysfs_attribute { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - char *value; - unsigned short len; /* value length */ - enum sysfs_attribute_method method; /* show and store */ -}; - -struct sysfs_driver { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - struct dlist *attrlist; - char bus[SYSFS_NAME_LEN]; - - /* Private: for internal use only */ - struct dlist *devices; -}; - -struct sysfs_device { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - struct dlist *attrlist; - char bus_id[SYSFS_NAME_LEN]; - char bus[SYSFS_NAME_LEN]; - char driver_name[SYSFS_NAME_LEN]; - - /* Private: for internal use only */ - struct sysfs_device *parent; - /* NOTE - we still don't populate this */ - struct dlist *children; -}; - -/* NOTE: not used as of now */ -struct sysfs_bus { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - struct dlist *attrlist; - - /* Private: for internal use only */ - struct dlist *drivers; - struct dlist *devices; -}; - -struct sysfs_class_device { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - struct dlist *attrlist; - char classname[SYSFS_NAME_LEN]; - - /* Private: for internal use only */ - struct sysfs_class_device *parent; - struct sysfs_device *sysdevice; /* NULL if virtual */ -}; - -/* NOTE: not used as of now */ -struct sysfs_class { - char name[SYSFS_NAME_LEN]; - char path[SYSFS_PATH_MAX]; - struct dlist *attrlist; - - /* Private: for internal use only */ - struct dlist *devices; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Function Prototypes - */ -extern int sysfs_get_mnt_path(char *mnt_path, size_t len); -extern int sysfs_remove_trailing_slash(char *path); -extern int sysfs_get_name_from_path(const char *path, char *name, size_t len); -extern int sysfs_path_is_dir(const char *path); -extern int sysfs_path_is_link(const char *path); -extern int sysfs_path_is_file(const char *path); -extern int sysfs_get_link(const char *path, char *target, size_t len); -extern struct dlist *sysfs_open_directory_list(const char *path); -extern void sysfs_close_list(struct dlist *list); - -/* sysfs directory and file access */ -extern void sysfs_close_attribute(struct sysfs_attribute *sysattr); -extern struct sysfs_attribute *sysfs_open_attribute(const char *path); -extern int sysfs_read_attribute(struct sysfs_attribute *sysattr); -extern int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const char *new_value, size_t len); - -/* sysfs driver access */ -extern void sysfs_close_driver(struct sysfs_driver *driver); -extern struct sysfs_driver *sysfs_open_driver - (const char *bus_name, const char *drv_name); -extern struct sysfs_driver *sysfs_open_driver_path(const char *path); -extern struct sysfs_attribute *sysfs_get_driver_attr - (struct sysfs_driver *drv, const char *name); -extern struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *driver); -extern struct dlist *sysfs_get_driver_devices(struct sysfs_driver *driver); - -/* generic sysfs device access */ -extern void sysfs_close_device_tree(struct sysfs_device *device); -extern struct sysfs_device *sysfs_open_device_tree(const char *path); -extern void sysfs_close_device(struct sysfs_device *dev); -extern struct sysfs_device *sysfs_open_device - (const char *bus, const char *bus_id); -extern struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev); -extern struct sysfs_device *sysfs_open_device_path(const char *path); -extern int sysfs_get_device_bus(struct sysfs_device *dev); -extern struct sysfs_attribute *sysfs_get_device_attr - (struct sysfs_device *dev, const char *name); -extern struct dlist *sysfs_get_device_attributes - (struct sysfs_device *dev); - -/* generic sysfs class access */ -extern void sysfs_close_class_device(struct sysfs_class_device *dev); -extern struct sysfs_class_device *sysfs_open_class_device_path - (const char *path); -extern struct sysfs_class_device *sysfs_open_class_device - (const char *classname, const char *name); -extern struct sysfs_class_device *sysfs_get_classdev_parent - (struct sysfs_class_device *clsdev); -extern struct sysfs_attribute *sysfs_get_classdev_attr - (struct sysfs_class_device *clsdev, const char *name); -extern struct dlist *sysfs_get_classdev_attributes - (struct sysfs_class_device *clsdev); -extern struct sysfs_device *sysfs_get_classdev_device - (struct sysfs_class_device *clsdev); -extern void sysfs_close_class(struct sysfs_class *cls); -extern struct sysfs_class *sysfs_open_class(const char *name); -extern struct sysfs_class_device *sysfs_get_class_device - (struct sysfs_class *cls, const char *name); -extern struct dlist *sysfs_get_class_devices(struct sysfs_class *cls); - -/* generic sysfs bus access */ -extern void sysfs_close_bus(struct sysfs_bus *bus); -extern struct sysfs_bus *sysfs_open_bus(const char *name); -extern struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus); -extern struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus); -extern struct sysfs_device *sysfs_get_bus_device - (struct sysfs_bus *bus, const char *id); -extern struct sysfs_driver *sysfs_get_bus_driver - (struct sysfs_bus *bus, const char *drvname); - -/** - * sort_list: sorter function to keep list elements sorted in alphabetical - * order. Just does a strncmp as you can see :) - * - * Returns 1 if less than 0 otherwise - * - * NOTE: We take care to have a statically allocated "name" as the first - * lement of all libsysfs structures. Hence, this function will work - * AS IS for _ALL_ the lists that have to be sorted. - */ -static inline int sort_list(void *new_elem, void *old_elem) -{ - return ((strncmp(((struct sysfs_attribute *)new_elem)->name, - ((struct sysfs_attribute *)old_elem)->name, - strlen(((struct sysfs_attribute *)new_elem)->name))) < 0 ? 1 : 0); -} - - -#ifdef __cplusplus -} -#endif - -#endif /* _LIBSYSFS_H_ */ diff --git a/libsysfs/sysfs_bus.c b/libsysfs/sysfs_bus.c deleted file mode 100644 index 921ef32094..0000000000 --- a/libsysfs/sysfs_bus.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * sysfs_bus.c - * - * Generic bus utility functions for libsysfs - * - * Copyright (C) IBM Corp. 2003-2005 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include "libsysfs.h" -#include "sysfs.h" - -static void sysfs_close_dev(void *dev) -{ - sysfs_close_device((struct sysfs_device *)dev); -} - -static void sysfs_close_drv(void *drv) -{ - sysfs_close_driver((struct sysfs_driver *)drv); -} - -/* - * compares names. - * @a: name looked for - * @b: sysfs_device comparing being compared - * returns 1 if a==b->name or 0 not equal - */ -static int name_equal(void *a, void *b) -{ - if (!a || !b) - return 0; - - if (strcmp(((char *)a), ((struct sysfs_device *)b)->name) == 0) - return 1; - - return 0; -} - -/** - * sysfs_close_bus: close single bus - * @bus: bus structure - */ -void sysfs_close_bus(struct sysfs_bus *bus) -{ - if (bus) { - if (bus->attrlist) - dlist_destroy(bus->attrlist); - if (bus->devices) - dlist_destroy(bus->devices); - if (bus->drivers) - dlist_destroy(bus->drivers); - free(bus); - } -} - -/** - * alloc_bus: mallocs new bus structure - * returns sysfs_bus_bus struct or NULL - */ -static struct sysfs_bus *alloc_bus(void) -{ - return (struct sysfs_bus *)calloc(1, sizeof(struct sysfs_bus)); -} - -/** - * sysfs_get_bus_devices: gets all devices for bus - * @bus: bus to get devices for - * returns dlist of devices with success and NULL with failure - */ -struct dlist *sysfs_get_bus_devices(struct sysfs_bus *bus) -{ - struct sysfs_device *dev; - struct dlist *linklist; - char path[SYSFS_PATH_MAX], devpath[SYSFS_PATH_MAX]; - char target[SYSFS_PATH_MAX]; - char *curlink; - - if (!bus) { - errno = EINVAL; - return NULL; - } - memset(path, 0, SYSFS_PATH_MAX); - safestrcpy(path, bus->path); - safestrcat(path, "/"); - safestrcat(path, SYSFS_DEVICES_NAME); - - linklist = read_dir_links(path); - if (linklist) { - dlist_for_each_data(linklist, curlink, char) { - if (bus->devices) { - dev = (struct sysfs_device *) - dlist_find_custom(bus->devices, - (void *)curlink, name_equal); - if (dev) - continue; - } - safestrcpy(devpath, path); - safestrcat(devpath, "/"); - safestrcat(devpath, curlink); - if (sysfs_get_link(devpath, target, SYSFS_PATH_MAX)) { - dprintf("Error getting link - %s\n", devpath); - continue; - } - dev = sysfs_open_device_path(target); - if (!dev) { - dprintf("Error opening device at %s\n", - target); - continue; - } - if (!bus->devices) - bus->devices = dlist_new_with_delete - (sizeof(struct sysfs_device), - sysfs_close_dev); - dlist_unshift_sorted(bus->devices, dev, sort_list); - } - sysfs_close_list(linklist); - } - return (bus->devices); -} - -/** - * sysfs_get_bus_drivers: gets all drivers for bus - * @bus: bus to get devices for - * returns dlist of devices with success and NULL with failure - */ -struct dlist *sysfs_get_bus_drivers(struct sysfs_bus *bus) -{ - struct sysfs_driver *drv; - struct dlist *dirlist; - char path[SYSFS_PATH_MAX], drvpath[SYSFS_PATH_MAX]; - char *curdir; - - if (!bus) { - errno = EINVAL; - return NULL; - } - memset(path, 0, SYSFS_PATH_MAX); - safestrcpy(path, bus->path); - safestrcat(path, "/"); - safestrcat(path, SYSFS_DRIVERS_NAME); - - dirlist = read_dir_subdirs(path); - if (dirlist) { - dlist_for_each_data(dirlist, curdir, char) { - if (bus->drivers) { - drv = (struct sysfs_driver *) - dlist_find_custom(bus->drivers, - (void *)curdir, name_equal); - if (drv) - continue; - } - safestrcpy(drvpath, path); - safestrcat(drvpath, "/"); - safestrcat(drvpath, curdir); - drv = sysfs_open_driver_path(drvpath); - if (!drv) { - dprintf("Error opening driver at %s\n", - drvpath); - continue; - } - if (!bus->drivers) - bus->drivers = dlist_new_with_delete - (sizeof(struct sysfs_driver), - sysfs_close_drv); - dlist_unshift_sorted(bus->drivers, drv, sort_list); - } - sysfs_close_list(dirlist); - } - return (bus->drivers); -} - -/** - * sysfs_open_bus: opens specific bus and all its devices on system - * returns sysfs_bus structure with success or NULL with error. - */ -struct sysfs_bus *sysfs_open_bus(const char *name) -{ - struct sysfs_bus *bus; - char buspath[SYSFS_PATH_MAX]; - - if (!name) { - errno = EINVAL; - return NULL; - } - - memset(buspath, 0, SYSFS_PATH_MAX); - if (sysfs_get_mnt_path(buspath, SYSFS_PATH_MAX)) { - dprintf("Sysfs not supported on this system\n"); - return NULL; - } - - safestrcat(buspath, "/"); - safestrcat(buspath, SYSFS_BUS_NAME); - safestrcat(buspath, "/"); - safestrcat(buspath, name); - if (sysfs_path_is_dir(buspath)) { - dprintf("Invalid path to bus: %s\n", buspath); - return NULL; - } - bus = alloc_bus(); - if (!bus) { - dprintf("calloc failed\n"); - return NULL; - } - safestrcpy(bus->name, name); - safestrcpy(bus->path, buspath); - if (sysfs_remove_trailing_slash(bus->path)) { - dprintf("Incorrect path to bus %s\n", bus->path); - sysfs_close_bus(bus); - return NULL; - } - - return bus; -} - -/** - * sysfs_get_bus_device: Get specific device on bus using device's id - * @bus: bus to find device on - * @id: bus_id for device - * returns struct sysfs_device reference or NULL if not found. - */ -struct sysfs_device *sysfs_get_bus_device(struct sysfs_bus *bus, - const char *id) -{ - struct sysfs_device *dev = NULL; - char devpath[SYSFS_PATH_MAX], target[SYSFS_PATH_MAX]; - - if (!bus || !id) { - errno = EINVAL; - return NULL; - } - - if (bus->devices) { - dev = (struct sysfs_device *)dlist_find_custom - (bus->devices, (void *)id, name_equal); - if (dev) - return dev; - } - safestrcpy(devpath, bus->path); - safestrcat(devpath, "/"); - safestrcat(devpath, SYSFS_DEVICES_NAME); - safestrcat(devpath, "/"); - safestrcat(devpath, id); - if (sysfs_path_is_link(devpath)) { - dprintf("No such device %s on bus %s?\n", id, bus->name); - return NULL; - } - if (!sysfs_get_link(devpath, target, SYSFS_PATH_MAX)) { - dev = sysfs_open_device_path(target); - if (!dev) { - dprintf("Error opening device at %s\n", target); - return NULL; - } - if (!bus->devices) - bus->devices = dlist_new_with_delete - (sizeof(struct sysfs_device), - sysfs_close_dev); - dlist_unshift_sorted(bus->devices, dev, sort_list); - } - return dev; -} - -/** - * sysfs_get_bus_driver: Get specific driver on bus using driver name - * @bus: bus to find driver on - * @drvname: name of driver - * returns struct sysfs_driver reference or NULL if not found. - */ -struct sysfs_driver *sysfs_get_bus_driver(struct sysfs_bus *bus, - const char *drvname) -{ - struct sysfs_driver *drv; - char drvpath[SYSFS_PATH_MAX]; - - if (!bus || !drvname) { - errno = EINVAL; - return NULL; - } - - if (bus->drivers) { - drv = (struct sysfs_driver *)dlist_find_custom - (bus->drivers, (void *)drvname, name_equal); - if (drv) - return drv; - } - safestrcpy(drvpath, bus->path); - safestrcat(drvpath, "/"); - safestrcat(drvpath, SYSFS_DRIVERS_NAME); - safestrcat(drvpath, "/"); - safestrcat(drvpath, drvname); - drv = sysfs_open_driver_path(drvpath); - if (!drv) { - dprintf("Error opening driver at %s\n", drvpath); - return NULL; - } - if (!bus->drivers) - bus->drivers = dlist_new_with_delete - (sizeof(struct sysfs_driver), - sysfs_close_drv); - dlist_unshift_sorted(bus->drivers, drv, sort_list); - return drv; -} - diff --git a/libsysfs/sysfs_class.c b/libsysfs/sysfs_class.c deleted file mode 100644 index 102f09f17a..0000000000 --- a/libsysfs/sysfs_class.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * sysfs_class.c - * - * Generic class utility functions for libsysfs - * - * Copyright (C) IBM Corp. 2003-2005 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include "libsysfs.h" -#include "sysfs.h" - -/** - * sysfs_close_class_device: closes a single class device. - * @dev: class device to close. - */ -void sysfs_close_class_device(struct sysfs_class_device *dev) -{ - if (dev) { - if (dev->parent) - sysfs_close_class_device(dev->parent); - if (dev->sysdevice) - sysfs_close_device(dev->sysdevice); - if (dev->attrlist) - dlist_destroy(dev->attrlist); - free(dev); - } -} - -static void sysfs_close_cls_dev(void *dev) -{ - sysfs_close_class_device((struct sysfs_class_device *)dev); -} - -/** - * sysfs_close_class: close the given class - * @cls: sysfs_class to close - */ -void sysfs_close_class(struct sysfs_class *cls) -{ - if (cls) { - if (cls->devices) - dlist_destroy(cls->devices); - if (cls->attrlist) - dlist_destroy(cls->attrlist); - free(cls); - } -} - -static int cdev_name_equal(void *a, void *b) -{ - if (!a || !b) - return 0; - - if (strncmp((char *)a, ((struct sysfs_class_device *)b)->name, - strlen((char *)a)) == 0) - return 1; - - return 0; -} - -static struct sysfs_class *alloc_class(void) -{ - return (struct sysfs_class *) calloc(1, sizeof(struct sysfs_class)); -} - -/** - * alloc_class_device: mallocs and initializes new class device struct. - * returns sysfs_class_device or NULL. - */ -static struct sysfs_class_device *alloc_class_device(void) -{ - struct sysfs_class_device *dev; - - dev = calloc(1, sizeof(struct sysfs_class_device)); - return dev; -} - -/** - * set_classdev_classname: Grabs classname from path - * @cdev: class device to set - * Returns nothing - */ -static void set_classdev_classname(struct sysfs_class_device *cdev) -{ - char *c, *e; - int count = 0; - - c = strstr(cdev->path, SYSFS_CLASS_NAME); - if (c == NULL) { - c = strstr(cdev->path, SYSFS_BLOCK_NAME); - } else { - c = strstr(c, "/"); - } - - if (c == NULL) - safestrcpy(cdev->classname, SYSFS_UNKNOWN); - else { - if (*c == '/') - c++; - e = c; - while (e != NULL && *e != '/' && *e != '\0') { - e++; - count++; - } - strncpy(cdev->classname, c, count); - } -} - -/** - * sysfs_open_class_device_path: Opens and populates class device - * @path: path to class device. - * returns struct sysfs_class_device with success and NULL with error. - */ -struct sysfs_class_device *sysfs_open_class_device_path(const char *path) -{ - struct sysfs_class_device *cdev; - char temp_path[SYSFS_PATH_MAX]; - - if (!path) { - errno = EINVAL; - return NULL; - } - - /* - * Post linux-2.6.14 driver model supports nested classes with - * links to the nested hierarchy at /sys/class/xxx/. Check for - * a link to the actual class device if a directory isn't found - */ - if (sysfs_path_is_dir(path)) { - dprintf("%s: Directory not found, checking for a link\n", path); - if (!sysfs_path_is_link(path)) { - if (sysfs_get_link(path, temp_path, SYSFS_PATH_MAX)) { - dprintf("Error retrieving link at %s\n", path); - return NULL; - } - } else { - dprintf("%s is not a valid class device path\n", path); - return NULL; - } - } else - safestrcpy(temp_path, path); - - cdev = alloc_class_device(); - if (!cdev) { - dprintf("calloc failed\n"); - return NULL; - } - if (sysfs_get_name_from_path(temp_path, cdev->name, SYSFS_NAME_LEN)) { - errno = EINVAL; - dprintf("Error getting class device name\n"); - sysfs_close_class_device(cdev); - return NULL; - } - - safestrcpy(cdev->path, temp_path); - if (sysfs_remove_trailing_slash(cdev->path)) { - dprintf("Invalid path to class device %s\n", cdev->path); - sysfs_close_class_device(cdev); - return NULL; - } - set_classdev_classname(cdev); - - return cdev; -} - -/** - * get_blockdev_parent: Get the parent class device for a "block" subsystem - * device if present - * @clsdev: block subsystem class device whose parent needs to be found - * Returns 0 on success and 1 on error - */ -static int get_blockdev_parent(struct sysfs_class_device *clsdev) -{ - char parent_path[SYSFS_PATH_MAX]; - char *c; - - safestrcpy(parent_path, clsdev->path); - c = strstr(parent_path, SYSFS_BLOCK_NAME); - if (c == NULL) { - dprintf("Class device %s does not belong to BLOCK subsystem\n", - clsdev->name); - return 1; - } - c += strlen(SYSFS_BLOCK_NAME); - if (*c == '/') - c++; - else - goto errout; - - /* validate whether the given class device is a partition or not */ - if ((strncmp(c, clsdev->name, strlen(clsdev->name))) == 0) { - dprintf("%s not a partition\n", clsdev->name); - return 1; - } - - c = strchr(c, '/'); - if (c == NULL) - goto errout; - - *c = '\0'; - - clsdev->parent = sysfs_open_class_device_path(parent_path); - if (!clsdev->parent) { - dprintf("Error opening the parent class device at %s\n", - parent_path); - return 1; - } - return 0; - -errout: - dprintf("Invalid path %s\n", clsdev->path); - return 1; -} - -/** - * sysfs_get_classdev_parent: Retrieves the parent of a class device. - * eg., when working with hda1, this function can be used to retrieve the - * sysfs_class_device for hda - * - * @clsdev: class device whose parent details are required. - * Returns sysfs_class_device of the parent on success, NULL on failure - */ -struct sysfs_class_device *sysfs_get_classdev_parent - (struct sysfs_class_device *clsdev) -{ - if (!clsdev) { - errno = EINVAL; - return NULL; - } - if (clsdev->parent) - return (clsdev->parent); - - /* - * As of now, only block devices have a parent child heirarchy in sysfs - * We do not know, if, in the future, more classes will have a similar - * structure. Hence, we now call a specialized function for block and - * later we can add support functions for other subsystems as required. - */ - if (!(strncmp(clsdev->classname, SYSFS_BLOCK_NAME, - sizeof(SYSFS_BLOCK_NAME)))) { - if ((get_blockdev_parent(clsdev)) == 0) - return (clsdev->parent); - } - return NULL; -} - -/** - * get_classdev_path: given the class and a device in the class, return the - * absolute path to the device - * @classname: name of the class - * @clsdev: the class device - * @path: buffer to return path - * @psize: size of "path" - * Returns 0 on SUCCESS or -1 on error - */ -static int get_classdev_path(const char *classname, const char *clsdev, - char *path, size_t len) -{ - if (!classname || !clsdev || !path) { - errno = EINVAL; - return -1; - } - if (sysfs_get_mnt_path(path, len) != 0) { - dprintf("Error getting sysfs mount path\n"); - return -1; - } - if (strncmp(classname, SYSFS_BLOCK_NAME, - sizeof(SYSFS_BLOCK_NAME)) == 0) { - safestrcatmax(path, "/", len); - safestrcatmax(path, SYSFS_BLOCK_NAME, len); - } else { - safestrcatmax(path, "/", len); - safestrcatmax(path, SYSFS_CLASS_NAME, len); - safestrcatmax(path, "/", len); - safestrcatmax(path, classname, len); - } - safestrcatmax(path, "/", len); - safestrcatmax(path, clsdev, len); - return 0; -} - -/** - * sysfs_open_class_device: Locates a specific class_device and returns it. - * Class_device must be closed using sysfs_close_class_device - * @classname: Class to search - * @name: name of the class_device - * - * NOTE: - * Call sysfs_close_class_device() to close the class device - */ -struct sysfs_class_device *sysfs_open_class_device - (const char *classname, const char *name) -{ - char devpath[SYSFS_PATH_MAX]; - struct sysfs_class_device *cdev; - - if (!classname || !name) { - errno = EINVAL; - return NULL; - } - - memset(devpath, 0, SYSFS_PATH_MAX); - if ((get_classdev_path(classname, name, devpath, - SYSFS_PATH_MAX)) != 0) { - dprintf("Error getting to device %s on class %s\n", - name, classname); - return NULL; - } - - cdev = sysfs_open_class_device_path(devpath); - if (!cdev) { - dprintf("Error getting class device %s from class %s\n", - name, classname); - return NULL; - } - return cdev; -} - -/** - * sysfs_get_classdev_attr: searches class device's attributes by name - * @clsdev: class device to look through - * @name: attribute name to get - * returns sysfs_attribute reference with success or NULL with error - */ -struct sysfs_attribute *sysfs_get_classdev_attr - (struct sysfs_class_device *clsdev, const char *name) -{ - if (!clsdev || !name) { - errno = EINVAL; - return NULL; - } - return get_attribute(clsdev, (char *)name); -} - -/** - * sysfs_get_classdev_attributes: gets list of classdev attributes - * @clsdev: class device whose attributes list is needed - * returns dlist of attributes on success or NULL on error - */ -struct dlist *sysfs_get_classdev_attributes(struct sysfs_class_device *clsdev) -{ - if (!clsdev) { - errno = EINVAL; - return NULL; - } - return get_attributes_list(clsdev); -} - -/** - * sysfs_get_classdev_device: gets the sysfs_device associated with the - * given sysfs_class_device - * @clsdev: class device whose associated sysfs_device is needed - * returns struct sysfs_device * on success or NULL on error - */ -struct sysfs_device *sysfs_get_classdev_device - (struct sysfs_class_device *clsdev) -{ - char linkpath[SYSFS_PATH_MAX], devpath[SYSFS_PATH_MAX]; - - if (!clsdev) { - errno = EINVAL; - return NULL; - } - - if (clsdev->sysdevice) - return clsdev->sysdevice; - - memset(linkpath, 0, SYSFS_PATH_MAX); - safestrcpy(linkpath, clsdev->path); - safestrcat(linkpath, "/device"); - if (!sysfs_path_is_link(linkpath)) { - memset(devpath, 0, SYSFS_PATH_MAX); - if (!sysfs_get_link(linkpath, devpath, SYSFS_PATH_MAX)) - clsdev->sysdevice = sysfs_open_device_path(devpath); - } - return clsdev->sysdevice; -} - -/** - * sysfs_open_class: opens specific class and all its devices on system - * returns sysfs_class structure with success or NULL with error. - */ -struct sysfs_class *sysfs_open_class(const char *name) -{ - struct sysfs_class *cls = NULL; - char classpath[SYSFS_PATH_MAX]; - - if (!name) { - errno = EINVAL; - return NULL; - } - - memset(classpath, 0, SYSFS_PATH_MAX); - if ((sysfs_get_mnt_path(classpath, SYSFS_PATH_MAX)) != 0) { - dprintf("Sysfs not supported on this system\n"); - return NULL; - } - - /* - * We shall now treat "block" also as a class. Hence, check here - * if "name" is "block" and proceed accordingly - */ - if (strcmp(name, SYSFS_BLOCK_NAME) == 0) { - safestrcat(classpath, "/"); - safestrcat(classpath, SYSFS_BLOCK_NAME); - } else { - safestrcat(classpath, "/"); - safestrcat(classpath, SYSFS_CLASS_NAME); - safestrcat(classpath, "/"); - safestrcat(classpath, name); - } - if (sysfs_path_is_dir(classpath)) { - dprintf("Class %s not found on the system\n", name); - return NULL; - } - - cls = alloc_class(); - if (cls == NULL) { - dprintf("calloc failed\n"); - return NULL; - } - safestrcpy(cls->name, name); - safestrcpy(cls->path, classpath); - if ((sysfs_remove_trailing_slash(cls->path)) != 0) { - dprintf("Invalid path to class device %s\n", cls->path); - sysfs_close_class(cls); - return NULL; - } - - return cls; -} - -/** - * sysfs_get_class_device: get specific class device using the device's id - * @cls: sysfs_class to find the device on - * @name: name of the class device to look for - * - * Returns sysfs_class_device * on success and NULL on failure - */ -struct sysfs_class_device *sysfs_get_class_device(struct sysfs_class *cls, - const char *name) -{ - char path[SYSFS_PATH_MAX]; - struct sysfs_class_device *cdev = NULL; - - if (!cls || !name) { - errno = EINVAL; - return NULL; - } - - if (cls->devices) { - cdev = (struct sysfs_class_device *)dlist_find_custom - (cls->devices, (void *)name, cdev_name_equal); - if (cdev) - return cdev; - } - - safestrcpy(path, cls->path); - safestrcat(path, "/"); - safestrcat(path, name); - cdev = sysfs_open_class_device_path(path); - if (!cdev) { - dprintf("Error opening class device at %s\n", path); - return NULL; - } - if (!cls->devices) - cls->devices = dlist_new_with_delete - (sizeof(struct sysfs_class_device), - sysfs_close_cls_dev); - - dlist_unshift_sorted(cls->devices, cdev, sort_list); - return cdev; -} - -/** - * Add class devices to list - */ -static void add_cdevs_to_classlist(struct sysfs_class *cls, struct dlist *list) -{ - char path[SYSFS_PATH_MAX], *cdev_name; - struct sysfs_class_device *cdev = NULL; - - if (cls == NULL || list == NULL) - return; - - dlist_for_each_data(list, cdev_name, char) { - if (cls->devices) { - cdev = (struct sysfs_class_device *) - dlist_find_custom(cls->devices, - (void *)cdev_name, cdev_name_equal); - if (cdev) - continue; - } - safestrcpy(path, cls->path); - safestrcat(path, "/"); - safestrcat(path, cdev_name); - cdev = sysfs_open_class_device_path(path); - if (cdev) { - if (!cls->devices) - cls->devices = dlist_new_with_delete - (sizeof(struct sysfs_class_device), - sysfs_close_cls_dev); - dlist_unshift_sorted(cls->devices, cdev, - sort_list); - } - } -} - -/** - * sysfs_get_class_devices: get all class devices in the given class - * @cls: sysfs_class whose devices list is needed - * - * Returns a dlist of sysfs_class_device * on success and NULL on failure - */ -struct dlist *sysfs_get_class_devices(struct sysfs_class *cls) -{ - char path[SYSFS_PATH_MAX]; - struct dlist *dirlist, *linklist; - - if (!cls) { - errno = EINVAL; - return NULL; - } - - /* - * Post linux-2.6.14, we have nested classes and links under - * /sys/class/xxx/. are also valid class devices - */ - safestrcpy(path, cls->path); - dirlist = read_dir_subdirs(path); - if (dirlist) { - add_cdevs_to_classlist(cls, dirlist); - sysfs_close_list(dirlist); - } - - linklist = read_dir_links(path); - if (linklist) { - add_cdevs_to_classlist(cls, linklist); - sysfs_close_list(linklist); - } - - return cls->devices; -} diff --git a/libsysfs/sysfs_device.c b/libsysfs/sysfs_device.c deleted file mode 100644 index e3d70143f9..0000000000 --- a/libsysfs/sysfs_device.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * sysfs_device.c - * - * Generic device utility functions for libsysfs - * - * Copyright (C) IBM Corp. 2003-2005 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include "libsysfs.h" -#include "sysfs.h" - -/** - * get_dev_driver: fills in the dev->driver_name field - * Returns 0 on SUCCESS and -1 on error - */ -static int get_dev_driver(struct sysfs_device *dev) -{ - char path[SYSFS_PATH_MAX]; - char devpath[SYSFS_PATH_MAX]; - - if (!dev) { - errno = EINVAL; - return -1; - } - memset(path, 0, SYSFS_PATH_MAX); - memset(devpath, 0, SYSFS_PATH_MAX); - safestrcpymax(path, dev->path, SYSFS_PATH_MAX); - safestrcatmax(path, "/driver", SYSFS_PATH_MAX); - if (!sysfs_path_is_link(path)) { - if (!sysfs_get_link(path, devpath, SYSFS_PATH_MAX)) { - if (sysfs_get_name_from_path(devpath, - dev->driver_name, SYSFS_NAME_LEN)) - return -1; - } - return 0; - } - return -1; -} - -/** - * sysfs_get_device_bus: retrieves the bus name the device is on, checks path - * to bus' link to make sure it has correct device. - * @dev: device to get busname. - * returns 0 with success and -1 with error. - */ -int sysfs_get_device_bus(struct sysfs_device *dev) -{ - char devpath[SYSFS_PATH_MAX]; - char path[SYSFS_PATH_MAX]; - - if (!dev) { - errno = EINVAL; - return -1; - } - - memset(path, 0, SYSFS_PATH_MAX); - memset(devpath, 0, SYSFS_PATH_MAX); - safestrcpymax(path, dev->path, SYSFS_PATH_MAX); - safestrcatmax(path, "/bus", SYSFS_PATH_MAX); - if (!sysfs_path_is_link(path)) { - if (!sysfs_get_link(path, devpath, SYSFS_PATH_MAX)) { - if (sysfs_get_name_from_path(devpath, - dev->bus, SYSFS_NAME_LEN)) - return -1; - } - return 0; - } - return -1; -} - -/** - * sysfs_close_device_tree: closes every device in the supplied tree, - * closing children only. - * @devroot: device root of tree. - */ -void sysfs_close_device_tree(struct sysfs_device *devroot) -{ - if (devroot) { - if (devroot->children) { - struct sysfs_device *child = NULL; - - dlist_for_each_data(devroot->children, child, - struct sysfs_device) { - sysfs_close_device_tree(child); - } - } - sysfs_close_device(devroot); - } -} - -/** - * sysfs_close_device: closes and cleans up a device - * @dev = device to clean up - */ -void sysfs_close_device(struct sysfs_device *dev) -{ - if (dev) { - if (dev->parent) - sysfs_close_device(dev->parent); - if (dev->children && dev->children->count) - dlist_destroy(dev->children); - if (dev->attrlist) - dlist_destroy(dev->attrlist); - free(dev); - } -} - -/** - * alloc_device: allocates and initializes device structure - * returns struct sysfs_device - */ -static struct sysfs_device *alloc_device(void) -{ - return (struct sysfs_device *) calloc(1, sizeof(struct sysfs_device)); -} - -/** - * sysfs_open_device_path: opens and populates device structure - * @path: path to device, this is the /sys/devices/ path - * returns sysfs_device structure with success or NULL with error - */ -struct sysfs_device *sysfs_open_device_path(const char *path) -{ - struct sysfs_device *dev; - - if (!path) { - errno = EINVAL; - return NULL; - } - if (sysfs_path_is_dir(path)) { - dprintf("Incorrect path to device: %s\n", path); - return NULL; - } - dev = alloc_device(); - if (!dev) { - dprintf("Error allocating device at %s\n", path); - return NULL; - } - if (sysfs_get_name_from_path(path, dev->bus_id, SYSFS_NAME_LEN)) { - errno = EINVAL; - dprintf("Error getting device bus_id\n"); - sysfs_close_device(dev); - return NULL; - } - safestrcpy(dev->path, path); - if (sysfs_remove_trailing_slash(dev->path)) { - dprintf("Invalid path to device %s\n", dev->path); - sysfs_close_device(dev); - return NULL; - } - /* - * The "name" attribute no longer exists... return the device's - * sysfs representation instead, in the "dev->name" field, which - * implies that the dev->name and dev->bus_id contain same data. - */ - safestrcpy(dev->name, dev->bus_id); - - if (sysfs_get_device_bus(dev)) - dprintf("Could not get device bus\n"); - - if (get_dev_driver(dev)) { - dprintf("Could not get device %s's driver\n", dev->bus_id); - safestrcpy(dev->driver_name, SYSFS_UNKNOWN); - } - - return dev; -} - -/** - * sysfs_get_device_attr: searches dev's attributes by name - * @dev: device to look through - * @name: attribute name to get - * returns sysfs_attribute reference with success or NULL with error. - */ -struct sysfs_attribute *sysfs_get_device_attr(struct sysfs_device *dev, - const char *name) -{ - if (!dev || !name) { - errno = EINVAL; - return NULL; - } - return get_attribute(dev, (char *)name); -} - -/** - * sysfs_get_device_attributes: gets list of device attributes - * @dev: device whose attributes list is needed - * returns dlist of attributes on success or NULL on error - */ -struct dlist *sysfs_get_device_attributes(struct sysfs_device *dev) -{ - if (!dev) { - errno = EINVAL; - return NULL; - } - return get_attributes_list(dev); -} - -/** - * get_device_absolute_path: looks up the bus the device is on, gets - * absolute path to the device - * @device: device for which path is needed - * @path: buffer to store absolute path - * @psize: size of "path" - * Returns 0 on success -1 on failure - */ -static int get_device_absolute_path(const char *device, const char *bus, - char *path, size_t psize) -{ - char bus_path[SYSFS_PATH_MAX]; - - if (!device || !path) { - errno = EINVAL; - return -1; - } - - memset(bus_path, 0, SYSFS_PATH_MAX); - if (sysfs_get_mnt_path(bus_path, SYSFS_PATH_MAX)) { - dprintf ("Sysfs not supported on this system\n"); - return -1; - } - safestrcat(bus_path, "/"); - safestrcat(bus_path, SYSFS_BUS_NAME); - safestrcat(bus_path, "/"); - safestrcat(bus_path, bus); - safestrcat(bus_path, "/"); - safestrcat(bus_path, SYSFS_DEVICES_NAME); - safestrcat(bus_path, "/"); - safestrcat(bus_path, device); - /* - * We now are at /sys/bus/"bus_name"/devices/"device" which is a link. - * Now read this link to reach to the device. - */ - if (sysfs_get_link(bus_path, path, psize)) { - dprintf("Error getting to device %s\n", device); - return -1; - } - return 0; -} - -/** - * sysfs_open_device: open a device by id (use the "bus" subsystem) - * @bus: bus the device belongs to - * @bus_id: bus_id of the device to open - has to be the "bus_id" in - * /sys/bus/xxx/devices - * returns struct sysfs_device if found, NULL otherwise - * NOTE: - * 1. Use sysfs_close_device to close the device - * 2. Bus the device is on must be supplied - * Use sysfs_find_device_bus to get the bus name - */ -struct sysfs_device *sysfs_open_device(const char *bus, const char *bus_id) -{ - char sysfs_path[SYSFS_PATH_MAX]; - struct sysfs_device *device; - - if (!bus_id || !bus) { - errno = EINVAL; - return NULL; - } - memset(sysfs_path, 0, SYSFS_PATH_MAX); - if (get_device_absolute_path(bus_id, bus, sysfs_path, - SYSFS_PATH_MAX)) { - dprintf("Error getting to device %s\n", bus_id); - return NULL; - } - - device = sysfs_open_device_path(sysfs_path); - if (!device) { - dprintf("Error opening device %s\n", bus_id); - return NULL; - } - return device; -} - -/** - * sysfs_get_device_parent: opens up given device's parent and returns a - * reference to its sysfs_device - * @dev: sysfs_device whose parent is requested - * Returns sysfs_device of the parent on success and NULL on failure - */ -struct sysfs_device *sysfs_get_device_parent(struct sysfs_device *dev) -{ - char ppath[SYSFS_PATH_MAX], dpath[SYSFS_PATH_MAX], *tmp; - - if (!dev) { - errno = EINVAL; - return NULL; - } - - if (dev->parent) - return (dev->parent); - - memset(ppath, 0, SYSFS_PATH_MAX); - memset(dpath, 0, SYSFS_PATH_MAX); - safestrcpy(ppath, dev->path); - tmp = strrchr(ppath, '/'); - if (!tmp) { - dprintf("Invalid path to device %s\n", ppath); - return NULL; - } - if (*(tmp + 1) == '\0') { - *tmp = '\0'; - tmp = strrchr(tmp, '/'); - if (tmp == NULL) { - dprintf("Invalid path to device %s\n", ppath); - return NULL; - } - } - *tmp = '\0'; - - /* Make sure we're not at the top of the device tree */ - sysfs_get_mnt_path(dpath, SYSFS_PATH_MAX); - safestrcat(dpath, "/" SYSFS_DEVICES_NAME); - if (strcmp(dpath, ppath) == 0) { - dprintf("Device at %s does not have a parent\n", dev->path); - return NULL; - } - - dev->parent = sysfs_open_device_path(ppath); - if (!dev->parent) { - dprintf("Error opening device %s's parent at %s\n", - dev->bus_id, ppath); - return NULL; - } - return (dev->parent); -} diff --git a/libsysfs/sysfs_dir.c b/libsysfs/sysfs_dir.c deleted file mode 100644 index 7d98c669c6..0000000000 --- a/libsysfs/sysfs_dir.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * sysfs_dir.c - * - * Directory utility functions for libsysfs - * - * Copyright (C) IBM Corp. 2003-2005 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include "libsysfs.h" -#include "sysfs.h" - -static int sort_char(void *new, void *old) -{ - return ((strncmp((char *)new, (char *)old, - strlen((char *)new))) < 0 ? 1 : 0); -} - -/** - * sysfs_del_name: free function for sysfs_open_subsystem_list - * @name: memory area to be freed - */ -static void sysfs_del_name(void *name) -{ - free(name); -} - -/** - * sysfs_del_attribute: routine for dlist integration - */ -static void sysfs_del_attribute(void *attr) -{ - sysfs_close_attribute((struct sysfs_attribute *)attr); -} - -/** - * attr_name_equal: compares attributes by name - * @a: attribute name for comparison - * @b: sysfs_attribute to be compared. - * returns 1 if a==b->name or 0 if not equal - */ -static int attr_name_equal(void *a, void *b) -{ - if (!a || !b) - return 0; - - if (strcmp(((char *)a), ((struct sysfs_attribute *)b)->name) == 0) - return 1; - - return 0; -} - -/** - * sysfs_close_attribute: closes and cleans up attribute - * @sysattr: attribute to close. - */ -void sysfs_close_attribute(struct sysfs_attribute *sysattr) -{ - if (sysattr) { - if (sysattr->value) - free(sysattr->value); - free(sysattr); - } -} - -/** - * alloc_attribute: allocates and initializes attribute structure - * returns struct sysfs_attribute with success and NULL with error. - */ -static struct sysfs_attribute *alloc_attribute(void) -{ - return (struct sysfs_attribute *) - calloc(1, sizeof(struct sysfs_attribute)); -} - -/** - * sysfs_open_attribute: creates sysfs_attribute structure - * @path: path to attribute. - * returns sysfs_attribute struct with success and NULL with error. - */ -struct sysfs_attribute *sysfs_open_attribute(const char *path) -{ - struct sysfs_attribute *sysattr = NULL; - struct stat fileinfo; - - if (!path) { - errno = EINVAL; - return NULL; - } - sysattr = alloc_attribute(); - if (!sysattr) { - dprintf("Error allocating attribute at %s\n", path); - return NULL; - } - if (sysfs_get_name_from_path(path, sysattr->name, - SYSFS_NAME_LEN) != 0) { - dprintf("Error retrieving attrib name from path: %s\n", path); - sysfs_close_attribute(sysattr); - return NULL; - } - safestrcpy(sysattr->path, path); - if ((stat(sysattr->path, &fileinfo)) != 0) { - dprintf("Stat failed: No such attribute?\n"); - sysattr->method = 0; - free(sysattr); - sysattr = NULL; - } else { - if (fileinfo.st_mode & S_IRUSR) - sysattr->method |= SYSFS_METHOD_SHOW; - if (fileinfo.st_mode & S_IWUSR) - sysattr->method |= SYSFS_METHOD_STORE; - } - - return sysattr; -} - -/** - * sysfs_read_attribute: reads value from attribute - * @sysattr: attribute to read - * returns 0 with success and -1 with error. - */ -int sysfs_read_attribute(struct sysfs_attribute *sysattr) -{ - char *fbuf = NULL; - char *vbuf = NULL; - ssize_t length = 0; - long pgsize = 0; - int fd; - - if (!sysattr) { - errno = EINVAL; - return -1; - } - if (!(sysattr->method & SYSFS_METHOD_SHOW)) { - dprintf("Show method not supported for attribute %s\n", - sysattr->path); - errno = EACCES; - return -1; - } - pgsize = getpagesize(); - fbuf = (char *)calloc(1, pgsize+1); - if (!fbuf) { - dprintf("calloc failed\n"); - return -1; - } - if ((fd = open(sysattr->path, O_RDONLY)) < 0) { - dprintf("Error reading attribute %s\n", sysattr->path); - free(fbuf); - return -1; - } - length = read(fd, fbuf, pgsize); - if (length < 0) { - dprintf("Error reading from attribute %s\n", sysattr->path); - close(fd); - free(fbuf); - return -1; - } - if (sysattr->len > 0) { - if ((sysattr->len == length) && - (!(strncmp(sysattr->value, fbuf, length)))) { - close(fd); - free(fbuf); - return 0; - } - free(sysattr->value); - } - sysattr->len = length; - close(fd); - vbuf = (char *)realloc(fbuf, length+1); - if (!vbuf) { - dprintf("realloc failed\n"); - free(fbuf); - return -1; - } - sysattr->value = vbuf; - - return 0; -} - -/** - * sysfs_write_attribute: write value to the attribute - * @sysattr: attribute to write - * @new_value: value to write - * @len: length of "new_value" - * returns 0 with success and -1 with error. - */ -int sysfs_write_attribute(struct sysfs_attribute *sysattr, - const char *new_value, size_t len) -{ - int fd; - int length; - - if (!sysattr || !new_value || len == 0) { - errno = EINVAL; - return -1; - } - - if (!(sysattr->method & SYSFS_METHOD_STORE)) { - dprintf ("Store method not supported for attribute %s\n", - sysattr->path); - errno = EACCES; - return -1; - } - if (sysattr->method & SYSFS_METHOD_SHOW) { - /* - * read attribute again to see if we can get an updated value - */ - if ((sysfs_read_attribute(sysattr))) { - dprintf("Error reading attribute\n"); - return -1; - } - if ((strncmp(sysattr->value, new_value, sysattr->len)) == 0) { - dprintf("Attr %s already has the requested value %s\n", - sysattr->name, new_value); - return 0; - } - } - /* - * open O_WRONLY since some attributes have no "read" but only - * "write" permission - */ - if ((fd = open(sysattr->path, O_WRONLY)) < 0) { - dprintf("Error reading attribute %s\n", sysattr->path); - return -1; - } - - length = write(fd, new_value, len); - if (length < 0) { - dprintf("Error writing to the attribute %s - invalid value?\n", - sysattr->name); - close(fd); - return -1; - } else if ((unsigned int)length != len) { - dprintf("Could not write %zd bytes to attribute %s\n", - len, sysattr->name); - /* - * since we could not write user supplied number of bytes, - * restore the old value if one available - */ - if (sysattr->method & SYSFS_METHOD_SHOW) { - length = write(fd, sysattr->value, sysattr->len); - close(fd); - return -1; - } - } - - /* - * Validate length that has been copied. Alloc appropriate area - * in sysfs_attribute. Verify first if the attribute supports reading - * (show method). If it does not, do not bother - */ - if (sysattr->method & SYSFS_METHOD_SHOW) { - if (length != sysattr->len) { - sysattr->value = (char *)realloc - (sysattr->value, length); - sysattr->len = length; - safestrcpymax(sysattr->value, new_value, length); - } else { - /*"length" of the new value is same as old one */ - safestrcpymax(sysattr->value, new_value, length); - } - } - - close(fd); - return 0; -} - -/** - * add_attribute: open and add attribute at path to given directory - * @dev: device whose attribute is to be added - * @path: path to attribute - * returns pointer to attr added with success and NULL with error. - */ -static struct sysfs_attribute *add_attribute(void *dev, const char *path) -{ - struct sysfs_attribute *attr; - - attr = sysfs_open_attribute(path); - if (!attr) { - dprintf("Error opening attribute %s\n", path); - return NULL; - } - if (attr->method & SYSFS_METHOD_SHOW) { - if (sysfs_read_attribute(attr)) { - dprintf("Error reading attribute %s\n", path); - sysfs_close_attribute(attr); - return NULL; - } - } - - if (!((struct sysfs_device *)dev)->attrlist) { - ((struct sysfs_device *)dev)->attrlist = dlist_new_with_delete - (sizeof(struct sysfs_attribute), sysfs_del_attribute); - } - dlist_unshift_sorted(((struct sysfs_device *)dev)->attrlist, - attr, sort_list); - - return attr; -} - -/* - * get_attribute - given a sysfs_* struct and a name, return the - * sysfs_attribute corresponding to "name" - * returns sysfs_attribute on success and NULL on error - */ -struct sysfs_attribute *get_attribute(void *dev, const char *name) -{ - struct sysfs_attribute *cur = NULL; - char path[SYSFS_PATH_MAX]; - - if (!dev || !name) { - errno = EINVAL; - return NULL; - } - - if (((struct sysfs_device *)dev)->attrlist) { - /* check if attr is already in the list */ - cur = (struct sysfs_attribute *)dlist_find_custom - ((((struct sysfs_device *)dev)->attrlist), - (void *)name, attr_name_equal); - if (cur) - return cur; - } - safestrcpymax(path, ((struct sysfs_device *)dev)->path, - SYSFS_PATH_MAX); - safestrcatmax(path, "/", SYSFS_PATH_MAX); - safestrcatmax(path, name, SYSFS_PATH_MAX); - if (!sysfs_path_is_file(path)) - cur = add_attribute((void *)dev, path); - return cur; -} - -/** - * read_dir_links: grabs links in a specific directory - * @sysdir: sysfs directory to read - * returns list of link names with success and NULL with error. - */ -struct dlist *read_dir_links(const char *path) -{ - DIR *dir = NULL; - struct dirent *dirent = NULL; - char file_path[SYSFS_PATH_MAX], *linkname; - struct dlist *linklist = NULL; - - if (!path) { - errno = EINVAL; - return NULL; - } - dir = opendir(path); - if (!dir) { - dprintf("Error opening directory %s\n", path); - return NULL; - } - while ((dirent = readdir(dir)) != NULL) { - if (0 == strcmp(dirent->d_name, ".")) - continue; - if (0 == strcmp(dirent->d_name, "..")) - continue; - memset(file_path, 0, SYSFS_PATH_MAX); - safestrcpy(file_path, path); - safestrcat(file_path, "/"); - safestrcat(file_path, dirent->d_name); - if (!sysfs_path_is_link(file_path)) { - if (!linklist) { - linklist = dlist_new_with_delete - (SYSFS_NAME_LEN, sysfs_del_name); - if (!linklist) { - dprintf("Error creating list\n"); - return NULL; - } - } - linkname = (char *)calloc(1, SYSFS_NAME_LEN); - safestrcpymax(linkname, dirent->d_name, SYSFS_NAME_LEN); - dlist_unshift_sorted(linklist, linkname, sort_char); - } - } - closedir(dir); - return linklist; -} - -/** - * read_dir_subdirs: grabs subdirs in a specific directory - * @sysdir: sysfs directory to read - * returns list of directory names with success and NULL with error. - */ -struct dlist *read_dir_subdirs(const char *path) -{ - DIR *dir = NULL; - struct dirent *dirent = NULL; - char file_path[SYSFS_PATH_MAX], *dir_name; - struct dlist *dirlist = NULL; - - if (!path) { - errno = EINVAL; - return NULL; - } - dir = opendir(path); - if (!dir) { - dprintf("Error opening directory %s\n", path); - return NULL; - } - while ((dirent = readdir(dir)) != NULL) { - if (0 == strcmp(dirent->d_name, ".")) - continue; - if (0 == strcmp(dirent->d_name, "..")) - continue; - memset(file_path, 0, SYSFS_PATH_MAX); - safestrcpy(file_path, path); - safestrcat(file_path, "/"); - safestrcat(file_path, dirent->d_name); - if (!sysfs_path_is_dir(file_path)) { - if (!dirlist) { - dirlist = dlist_new_with_delete - (SYSFS_NAME_LEN, sysfs_del_name); - if (!dirlist) { - dprintf("Error creating list\n"); - return NULL; - } - } - dir_name = (char *)calloc(1, SYSFS_NAME_LEN); - safestrcpymax(dir_name, dirent->d_name, SYSFS_NAME_LEN); - dlist_unshift_sorted(dirlist, dir_name, sort_char); - } - } - closedir(dir); - return dirlist; -} - -/** - * get_attributes_list: build a list of attributes for the given device - * @dev: devices whose attributes list is required - * returns dlist of attributes on success and NULL on failure - */ -struct dlist *get_attributes_list(void *dev) -{ - DIR *dir = NULL; - struct dirent *dirent = NULL; - struct sysfs_attribute *attr = NULL; - char file_path[SYSFS_PATH_MAX], path[SYSFS_PATH_MAX]; - - if (!dev) { - errno = EINVAL; - return NULL; - } - memset(path, 0, SYSFS_PATH_MAX); - safestrcpy(path, ((struct sysfs_device *)dev)->path); - dir = opendir(path); - if (!dir) { - dprintf("Error opening directory %s\n", path); - return NULL; - } - while ((dirent = readdir(dir)) != NULL) { - if (0 == strcmp(dirent->d_name, ".")) - continue; - if (0 == strcmp(dirent->d_name, "..")) - continue; - memset(file_path, 0, SYSFS_PATH_MAX); - safestrcpy(file_path, path); - safestrcat(file_path, "/"); - safestrcat(file_path, dirent->d_name); - if (!sysfs_path_is_file(file_path)) { - if (((struct sysfs_device *)dev)->attrlist) { - /* check if attr is already in the list */ - attr = (struct sysfs_attribute *) - dlist_find_custom - ((((struct sysfs_device *)dev)->attrlist), - (void *)dirent->d_name, attr_name_equal); - if (attr) - continue; - else - add_attribute(dev, file_path); - } else - attr = add_attribute(dev, file_path); - } - } - closedir(dir); - return ((struct sysfs_device *)dev)->attrlist; -} diff --git a/libsysfs/sysfs_driver.c b/libsysfs/sysfs_driver.c deleted file mode 100644 index c2464faa9e..0000000000 --- a/libsysfs/sysfs_driver.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * sysfs_driver.c - * - * Driver utility functions for libsysfs - * - * Copyright (C) IBM Corp. 2003-2005 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include "libsysfs.h" -#include "sysfs.h" - -static void sysfs_close_driver_device(void *device) -{ - sysfs_close_device((struct sysfs_device *)device); -} - -/** - * sysfs_close_driver: closes driver and deletes device lists too - * @driver: driver to close - */ -void sysfs_close_driver(struct sysfs_driver *driver) -{ - if (driver) { - if (driver->devices) - dlist_destroy(driver->devices); - if (driver->attrlist) - dlist_destroy(driver->attrlist); - free(driver); - } -} - -/** - * alloc_driver: allocates and initializes driver - * returns struct sysfs_driver with success and NULL with error. - */ -static struct sysfs_driver *alloc_driver(void) -{ - return (struct sysfs_driver *)calloc(1, sizeof(struct sysfs_driver)); -} - -/** - * get_driver_bus: gets bus the driver is on - * Returns 0 on success and 1 on error - */ -static int get_driver_bus(struct sysfs_driver *drv) -{ - char drvpath[SYSFS_PATH_MAX], *c = NULL; - - if (!drv) { - errno = EINVAL; - return 1; - } - - safestrcpy(drvpath, drv->path); - c = strstr(drvpath, SYSFS_DRIVERS_NAME); - if (c == NULL) - return 1; - *--c = '\0'; - c = strstr(drvpath, SYSFS_BUS_NAME); - if (c == NULL) - return 1; - c = strstr(c, "/"); - if (c == NULL) - return 1; - c++; - safestrcpy(drv->bus, c); - return 0; -} - -/** - * sysfs_get_driver_attr: searches drv's attributes by name - * @drv: driver to look through - * @name: attribute name to get - * returns sysfs_attribute reference with success or NULL with error. - */ -struct sysfs_attribute *sysfs_get_driver_attr(struct sysfs_driver *drv, - const char *name) -{ - if (!drv || !name) { - errno = EINVAL; - return NULL; - } - return get_attribute(drv, (char *)name); -} - -/** - * sysfs_get_driver_attributes: gets list of driver attributes - * @dev: driver whose attributes list is needed - * returns dlist of attributes on success or NULL on error - */ -struct dlist *sysfs_get_driver_attributes(struct sysfs_driver *drv) -{ - if (!drv) { - errno = EINVAL; - return NULL; - } - return get_attributes_list(drv); -} - -/** - * sysfs_open_driver_path: opens and initializes driver structure - * @path: path to driver directory - * returns struct sysfs_driver with success and NULL with error - */ -struct sysfs_driver *sysfs_open_driver_path(const char *path) -{ - struct sysfs_driver *driver = NULL; - - if (!path) { - errno = EINVAL; - return NULL; - } - if (sysfs_path_is_dir(path)) { - dprintf("Invalid path to driver: %s\n", path); - return NULL; - } - driver = alloc_driver(); - if (!driver) { - dprintf("Error allocating driver at %s\n", path); - return NULL; - } - if (sysfs_get_name_from_path(path, driver->name, SYSFS_NAME_LEN)) { - dprintf("Error getting driver name from path\n"); - free(driver); - return NULL; - } - safestrcpy(driver->path, path); - if (sysfs_remove_trailing_slash(driver->path)) { - dprintf("Invalid path to driver %s\n", driver->path); - sysfs_close_driver(driver); - return NULL; - } - if (get_driver_bus(driver)) { - dprintf("Could not get the bus driver is on\n"); - sysfs_close_driver(driver); - return NULL; - } - - return driver; -} - -/** - * get_driver_path: looks up the bus the driver is on and builds path to - * the driver. - * @bus: bus on which to search - * @drv: driver to look for - * @path: buffer to return path to driver - * @psize: size of "path" - * Returns 0 on success and -1 on error - */ -static int get_driver_path(const char *bus, const char *drv, - char *path, size_t psize) -{ - if (!bus || !drv || !path || psize == 0) { - errno = EINVAL; - return -1; - } - if (sysfs_get_mnt_path(path, psize)) { - dprintf("Error getting sysfs mount path\n"); - return -1; - } - safestrcatmax(path, "/", psize); - safestrcatmax(path, SYSFS_BUS_NAME, psize); - safestrcatmax(path, "/", psize); - safestrcatmax(path, bus, psize); - safestrcatmax(path, "/", psize); - safestrcatmax(path, SYSFS_DRIVERS_NAME, psize); - safestrcatmax(path, "/", psize); - safestrcatmax(path, drv, psize); - return 0; -} - -/** - * sysfs_open_driver: open driver by name, given its bus - * @bus_name: Name of the bus - * @drv_name: Name of the driver - * Returns the sysfs_driver reference on success and NULL on failure - */ -struct sysfs_driver *sysfs_open_driver(const char *bus_name, - const char *drv_name) -{ - char path[SYSFS_PATH_MAX]; - struct sysfs_driver *driver = NULL; - - if (!drv_name || !bus_name) { - errno = EINVAL; - return NULL; - } - - memset(path, 0, SYSFS_PATH_MAX); - if (get_driver_path(bus_name, drv_name, path, SYSFS_PATH_MAX)) { - dprintf("Error getting to driver %s\n", drv_name); - return NULL; - } - driver = sysfs_open_driver_path(path); - if (!driver) { - dprintf("Error opening driver at %s\n", path); - return NULL; - } - return driver; -} - -/** - * sysfs_get_driver_devices: gets list of devices that use the driver - * @drv: sysfs_driver whose device list is needed - * Returns dlist of struct sysfs_device on success and NULL on failure - */ -struct dlist *sysfs_get_driver_devices(struct sysfs_driver *drv) -{ - char *ln = NULL; - struct dlist *linklist = NULL; - struct sysfs_device *dev = NULL; - - if (!drv) { - errno = EINVAL; - return NULL; - } - - linklist = read_dir_links(drv->path); - if (linklist) { - dlist_for_each_data(linklist, ln, char) { - - if (!strncmp(ln, SYSFS_MODULE_NAME, strlen(ln))) - continue; - - dev = sysfs_open_device(drv->bus, ln); - if (!dev) { - dprintf("Error opening driver's device\n"); - sysfs_close_list(linklist); - return NULL; - } - if (!drv->devices) { - drv->devices = dlist_new_with_delete - (sizeof(struct sysfs_device), - sysfs_close_driver_device); - if (!drv->devices) { - dprintf("Error creating device list\n"); - sysfs_close_list(linklist); - return NULL; - } - } - dlist_unshift_sorted(drv->devices, dev, sort_list); - } - sysfs_close_list(linklist); - } - return drv->devices; -} diff --git a/libsysfs/sysfs_utils.c b/libsysfs/sysfs_utils.c deleted file mode 100644 index c5558a43a1..0000000000 --- a/libsysfs/sysfs_utils.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * sysfs_utils.c - * - * System utility functions for libsysfs - * - * Copyright (C) IBM Corp. 2003-2005 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#include "libsysfs.h" -#include "sysfs.h" - -/** - * sysfs_remove_trailing_slash: Removes any trailing '/' in the given path - * @path: Path to look for the trailing '/' - * Returns 0 on success 1 on error - */ -int sysfs_remove_trailing_slash(char *path) -{ - size_t len; - - if (!path) { - errno = EINVAL; - return 1; - } - - len = strlen(path); - while (len > 0 && path[len-1] == '/') - path[--len] = '\0'; - return 0; -} - -/* - * sysfs_get_mnt_path: Gets the sysfs mount point. - * @mnt_path: place to put "sysfs" mount point - * @len: size of mnt_path - * returns 0 with success and -1 with error. - */ -int sysfs_get_mnt_path(char *mnt_path, size_t len) -{ - static char sysfs_path[SYSFS_PATH_MAX] = ""; - const char *sysfs_path_env; - - /* evaluate only at the first call */ - if (sysfs_path[0] == '\0') { - /* possible overrride of real mount path */ - sysfs_path_env = getenv(SYSFS_PATH_ENV); - if (sysfs_path_env != NULL) { - safestrcpymax(mnt_path, sysfs_path_env, len); - sysfs_remove_trailing_slash(mnt_path); - return 0; - } - safestrcpymax(mnt_path, SYSFS_MNT_PATH, len); - } - - return 0; -} - -/** - * sysfs_get_name_from_path: returns last name from a "/" delimited path - * @path: path to get name from - * @name: where to put name - * @len: size of name - */ -int sysfs_get_name_from_path(const char *path, char *name, size_t len) -{ - char tmp[SYSFS_PATH_MAX]; - char *n = NULL; - - if (!path || !name || len == 0) { - errno = EINVAL; - return -1; - } - memset(tmp, 0, SYSFS_PATH_MAX); - safestrcpy(tmp, path); - n = strrchr(tmp, '/'); - if (n == NULL) { - errno = EINVAL; - return -1; - } - if (*(n+1) == '\0') { - *n = '\0'; - n = strrchr(tmp, '/'); - if (n == NULL) { - errno = EINVAL; - return -1; - } - } - n++; - safestrcpymax(name, n, len); - return 0; -} - -/** - * sysfs_get_link: returns link source - * @path: symbolic link's path - * @target: where to put name - * @len: size of name - */ -int sysfs_get_link(const char *path, char *target, size_t len) -{ - char devdir[SYSFS_PATH_MAX]; - char linkpath[SYSFS_PATH_MAX]; - char temp_path[SYSFS_PATH_MAX]; - char *d = NULL, *s = NULL; - int slashes = 0, count = 0; - - if (!path || !target || len == 0) { - errno = EINVAL; - return -1; - } - - memset(devdir, 0, SYSFS_PATH_MAX); - memset(linkpath, 0, SYSFS_PATH_MAX); - memset(temp_path, 0, SYSFS_PATH_MAX); - safestrcpy(devdir, path); - - if ((readlink(path, linkpath, SYSFS_PATH_MAX)) < 0) { - return -1; - } - d = linkpath; - /* - * Three cases here: - * 1. relative path => format ../.. - * 2. absolute path => format /abcd/efgh - * 3. relative path _from_ this dir => format abcd/efgh - */ - switch (*d) { - case '.': - /* - * handle the case where link is of type ./abcd/xxx - */ - safestrcpy(temp_path, devdir); - if (*(d+1) == '/') - d += 2; - else if (*(d+1) == '.') - goto parse_path; - s = strrchr(temp_path, '/'); - if (s != NULL) { - *(s+1) = '\0'; - safestrcat(temp_path, d); - } else { - safestrcpy(temp_path, d); - } - safestrcpymax(target, temp_path, len); - break; - /* - * relative path, getting rid of leading "../.." - */ -parse_path: - while (*d == '/' || *d == '.') { - if (*d == '/') - slashes++; - d++; - } - d--; - s = &devdir[strlen(devdir)-1]; - while (s != NULL && count != (slashes+1)) { - s--; - if (*s == '/') - count++; - } - safestrcpymax(s, d, (SYSFS_PATH_MAX-strlen(devdir))); - safestrcpymax(target, devdir, len); - break; - case '/': - /* absolute path - copy as is */ - safestrcpymax(target, linkpath, len); - break; - default: - /* relative path from this directory */ - safestrcpy(temp_path, devdir); - s = strrchr(temp_path, '/'); - if (s != NULL) { - *(s+1) = '\0'; - safestrcat(temp_path, linkpath); - } else { - safestrcpy(temp_path, linkpath); - } - safestrcpymax(target, temp_path, len); - } - return 0; -} - -/** - * sysfs_close_list: generic list free routine - * @list: dlist to free - * Returns nothing - */ -void sysfs_close_list(struct dlist *list) -{ - if (list) - dlist_destroy(list); -} - -/** - * sysfs_open_directory_list: gets a list of all directories under "path" - * @path: path to read - * Returns a dlist of supported names or NULL no directories (errno is set - * in case of error - */ -struct dlist *sysfs_open_directory_list(const char *path) -{ - if (!path) - return NULL; - - return (read_dir_subdirs(path)); -} - -/** - * sysfs_path_is_dir: Check if the path supplied points to a directory - * @path: path to validate - * Returns 0 if path points to dir, 1 otherwise - */ -int sysfs_path_is_dir(const char *path) -{ - struct stat astats; - - if (!path) { - errno = EINVAL; - return 1; - } - if ((lstat(path, &astats)) != 0) { - dprintf("stat() failed\n"); - return 1; - } - if (S_ISDIR(astats.st_mode)) - return 0; - - return 1; -} - -/** - * sysfs_path_is_link: Check if the path supplied points to a link - * @path: path to validate - * Returns 0 if path points to link, 1 otherwise - */ -int sysfs_path_is_link(const char *path) -{ - struct stat astats; - - if (!path) { - errno = EINVAL; - return 1; - } - if ((lstat(path, &astats)) != 0) { - dprintf("stat() failed\n"); - return 1; - } - if (S_ISLNK(astats.st_mode)) - return 0; - - return 1; -} - -/** - * sysfs_path_is_file: Check if the path supplied points to a file - * @path: path to validate - * Returns 0 if path points to file, 1 otherwise - */ -int sysfs_path_is_file(const char *path) -{ - struct stat astats; - - if (!path) { - errno = EINVAL; - return 1; - } - if ((lstat(path, &astats)) != 0) { - dprintf("stat() failed\n"); - return 1; - } - if (S_ISREG(astats.st_mode)) - return 0; - - return 1; -} diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index d1c28749fb..faa7c46432 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -23,8 +23,7 @@ make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit echo -e "\n\n" # klibc build -[ -z "$KLCC" ] && KLCC=/usr/bin/klcc -if [ -e "$KLCC" ]; then +if [ -n "$KLCC" -a -e "$KLCC" ]; then echo KLCC: "$KLCC" make clean EXTRAS="$EXTRAS" >/dev/null make all -j4 $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KLCC="$KLCC" || exit diff --git a/test/udev-test.pl b/test/udev-test.pl index c33c79b1c0..7ce920092f 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -243,18 +243,18 @@ EOF desc => "test substitution chars", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , + exp_name => "Major:8:minor:3:kernelnumber:3" , rules => < "test substitution chars (with length limit)", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "M8-m3-n3-b0:0-sIBM" , + exp_name => "M8-m3-n3-bsd-sIBM" , rules => < "program result substitution", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "test-0:0:0:0" , + exp_name => "test-3" , rules => < "test substitution by variable name", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "Major:8-minor:3-kernelnumber:3-bus:0:0:0:0" , + exp_name => "Major:8-minor:3-kernelnumber:3" , rules => < "test substitution by variable name 2", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "Major:8-minor:3-kernelnumber:3-bus:0:0:0:0" , + exp_name => "Major:8-minor:3-kernelnumber:3-name:sda3" , rules => < "test substitution by variable name 3", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "830:0:0:03" , + exp_name => "83sda33" , rules => < "test substitution by variable name 5", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "8330:0:0:0" , + exp_name => "833sda3" , rules => < "program and bus type match", subsys => "block", devpath => "/block/sda", - exp_name => "scsi-0:0:0:0" , + exp_name => "scsi-sda" , rules => < "symlink2-ttyUSB0", exp_target => "ttyUSB0", rules => < "symlink %b substitution", + desc => "symlink %k substitution", subsys => "block", devpath => "/block/sda", - exp_name => "symlink-0:0:0:0", + exp_name => "symlink-sda", exp_target => "node", rules => <; + close $fd; + $dev =~ m/^(.+):(.+)$/; + $ENV{MAJOR} = $1; + $ENV{MINOR} = $2; + # create temporary rules open CONF, ">$udev_rules" || die "unable to create rules file: $udev_rules"; print CONF $$rules; diff --git a/udev.c b/udev.c index f2d6f6653c..4762ab1cef 100644 --- a/udev.c +++ b/udev.c @@ -30,13 +30,8 @@ #include #include -#include "libsysfs/sysfs/libsysfs.h" -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_utils.h" -#include "udev_version.h" #include "udev_rules.h" -#include "logging.h" #ifdef USE_LOG void log_message(int priority, const char *format, ...) @@ -65,7 +60,9 @@ static void asmlinkage sig_handler(int signum) int main(int argc, char *argv[], char *envp[]) { - struct udevice udev; + struct sysfs_device *dev; + struct udevice *udev; + const char *maj, *min; struct udev_rules rules; const char *action; const char *devpath; @@ -95,7 +92,7 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udev"); if (devnull < 0) err("fatal, could not open /dev/null: %s", strerror(errno)); - udev_init_config(); + udev_config_init(); dbg("version %s", UDEV_VERSION); /* set signal handlers */ @@ -114,10 +111,10 @@ int main(int argc, char *argv[], char *envp[]) devpath = getenv("DEVPATH"); subsystem = getenv("SUBSYSTEM"); /* older kernels passed the SUBSYSTEM only as argument */ - if (!subsystem && argc == 2) + if (subsystem == NULL && argc == 2) subsystem = argv[1]; - if (!action || !subsystem || !devpath) { + if (action == NULL || subsystem == NULL || devpath == NULL) { err("action, subsystem or devpath missing"); goto exit; } @@ -130,25 +127,49 @@ int main(int argc, char *argv[], char *envp[]) setenv("UDEV_LOG", priority, 1); } - udev_init_device(&udev, devpath, subsystem, action); + sysfs_init(); udev_rules_init(&rules, 0); - retval = udev_process_event(&rules, &udev); + dev = sysfs_device_get(devpath); + if (dev == NULL) { + info("unable to open '%s'", devpath); + goto fail; + } + + udev = udev_device_init(); + if (udev == NULL) + goto fail; + + /* override built-in sysfs device */ + udev->dev = dev; + strlcpy(udev->action, action, sizeof(udev->action)); + + /* get dev_t from environment, which is needed for "remove" to work, "add" works also from sysfs */ + maj = getenv("MAJOR"); + min = getenv("MINOR"); + if (maj != NULL && min != NULL) + udev->devt = makedev(atoi(maj), atoi(min)); + else + udev->devt = udev_device_get_devt(udev); + + retval = udev_device_event(&rules, udev); - if (!retval && udev_run && !list_empty(&udev.run_list)) { + if (!retval && udev_run && !list_empty(&udev->run_list)) { struct name_entry *name_loop; dbg("executing run list"); - list_for_each_entry(name_loop, &udev.run_list, node) { + list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action); else - run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + run_program(name_loop->name, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); } } - udev_rules_close(&rules); - udev_cleanup_device(&udev); + udev_device_cleanup(udev); +fail: + udev_rules_cleanup(&rules); + sysfs_cleanup(); exit: logging_close(); diff --git a/udev.h b/udev.h index ca99da512d..c060b8d6ff 100644 --- a/udev.h +++ b/udev.h @@ -24,8 +24,11 @@ #include #include -#include "libsysfs/sysfs/libsysfs.h" + #include "list.h" +#include "logging.h" +#include "udev_libc_wrapper.h" +#include "udev_version.h" #define COMMENT_CHARACTER '#' #define PATH_TO_NAME_CHAR '@' @@ -39,24 +42,32 @@ #define DEFAULT_PARTITIONS_COUNT 15 #define UDEV_ALARM_TIMEOUT 180 +#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) + +/* pipes */ +#define READ_END 0 +#define WRITE_END 1 + #define DB_DIR ".udev/db" struct udev_rules; -enum device_type { - DEV_UNKNOWN, - DEV_CLASS, - DEV_BLOCK, - DEV_NET, - DEV_DEVICE, +struct sysfs_device { + struct list_head node; /* for device cache */ + char devpath[PATH_SIZE]; + char subsystem[NAME_SIZE]; /* $class/$bus/"drivers */ + char kernel_name[NAME_SIZE]; /* device instance name */ + char kernel_number[NAME_SIZE]; + char driver[NAME_SIZE]; /* device driver name */ }; struct udevice { - char devpath[PATH_SIZE]; - char subsystem[NAME_SIZE]; + /* device event */ + struct sysfs_device *dev; + struct sysfs_device dev_local; char action[NAME_SIZE]; - enum device_type type; + /* node */ char name[PATH_SIZE]; struct list_head symlink_list; int symlink_final; @@ -67,42 +78,83 @@ struct udevice { mode_t mode; int mode_final; dev_t devt; + + /* event processing */ struct list_head run_list; int run_final; struct list_head env_list; - char tmp_node[PATH_SIZE]; int partitions; int ignore_device; int ignore_remove; - char bus_id[NAME_SIZE]; char program_result[PATH_SIZE]; - char kernel_number[NAME_SIZE]; - char kernel_name[NAME_SIZE]; int test_run; }; -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 dev_t get_devt(struct sysfs_class_device *class_dev); -extern int udev_process_event(struct udev_rules *rules, struct udevice *udev); -extern int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev); -extern int udev_remove_device(struct udevice *udev); -extern void udev_init_config(void); -extern int udev_start(void); +/* udev_config.c */ +extern char udev_root[PATH_SIZE]; +extern char udev_config_filename[PATH_SIZE]; +extern char udev_rules_filename[PATH_SIZE]; +extern int udev_log_priority; +extern int udev_run; +extern void udev_config_init(void); + +/* udev_device.c */ +extern struct udevice *udev_device_init(void); +extern void udev_device_cleanup(struct udevice *udev); +extern int udev_device_event(struct udev_rules *rules, struct udevice *udev); +extern dev_t udev_device_get_devt(struct udevice *udev); + +/* udev_sysfs.c */ +extern char sysfs_path[PATH_SIZE]; +extern int sysfs_init(void); +extern void sysfs_cleanup(void); +extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, const char *subsystem); +extern struct sysfs_device *sysfs_device_get(const char *devpath); +extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); +extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); + +/* udev_add.c / udev_remove.c */ +extern int udev_add_device(struct udevice *udev); extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); +extern int udev_remove_device(struct udevice *udev); +/* udev_db.c */ extern int udev_db_add_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); extern int udev_db_get_device(struct udevice *udev, const char *devpath); extern int udev_db_lookup_name(const char *name, char *devpath, size_t len); extern int udev_db_get_all_entries(struct list_head *name_list); -extern char sysfs_path[PATH_SIZE]; -extern char udev_root[PATH_SIZE]; -extern char udev_config_filename[PATH_SIZE]; -extern char udev_rules_filename[PATH_SIZE]; -extern int udev_log_priority; -extern int udev_run; +/* udev_utils.c */ +struct name_entry { + struct list_head node; + char name[PATH_SIZE]; +}; +extern int log_priority(const char *priority); +extern int name_list_add(struct list_head *name_list, const char *name, int sort); +extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); +extern void name_list_cleanup(struct list_head *name_list); +extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); + +/* udev_utils_string.c */ +extern int strcmp_pattern(const char *p, const char *s); +extern int string_is_true(const char *str); +extern void remove_trailing_chars(char *path, char c); +extern int utf8_encoded_valid_unichar(const char *str); +extern int replace_untrusted_chars(char *str); + +/* udev_utils_file.c */ +extern int create_path(const char *path); +extern int delete_path(const char *path); +extern int file_map(const char *filename, char **buf, size_t *bufsize); +extern void file_unmap(void *buf, size_t bufsize); +extern int unlink_secure(const char *filename); +extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); + +/* udev_utils_run.c */ +extern int pass_env_to_socket(const char *name, const char *devpath, const char *action); +extern int run_program(const char *command, const char *subsystem, + char *result, size_t ressize, size_t *reslen, int log); #endif diff --git a/udev_add.c b/udev_add.c index bf2d59d198..2c66a0ba8d 100644 --- a/udev_add.c +++ b/udev_add.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -29,16 +30,10 @@ #include #include #include -#include #include #include -#include "libsysfs/sysfs/libsysfs.h" -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_utils.h" -#include "udev_version.h" -#include "logging.h" #include "udev_rules.h" #include "udev_selinux.h" @@ -48,25 +43,18 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo struct stat stats; int retval = 0; - switch (udev->type) { - case DEV_BLOCK: + if (major(devt) != 0 && strcmp(udev->dev->subsystem, "block") == 0) mode |= S_IFBLK; - break; - case DEV_CLASS: + else mode |= S_IFCHR; - break; - default: - dbg("unknown node type %c\n", udev->type); - return -EINVAL; - } if (stat(file, &stats) != 0) goto create; - /* preserve node with already correct numbers, to not change the inode number */ + /* preserve node with already correct numbers, to prevent changing the inode number */ if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { info("preserve file '%s', cause it has correct dev_t", file); - selinux_setfilecon(file, udev->kernel_name, stats.st_mode); + selinux_setfilecon(file, udev->dev->kernel_name, stats.st_mode); goto perms; } @@ -76,7 +64,7 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo dbg("already present file '%s' unlinked", file); create: - selinux_setfscreatecon(file, udev->kernel_name, mode); + selinux_setfscreatecon(file, udev->dev->kernel_name, mode); retval = mknod(file, mode, devt); selinux_resetfscreatecon(); if (retval != 0) { @@ -105,7 +93,7 @@ exit: return retval; } -static int create_node(struct udevice *udev, struct sysfs_class_device *class_dev) +static int create_node(struct udevice *udev) { char filename[PATH_SIZE]; struct name_entry *name_loop; @@ -161,13 +149,13 @@ static int create_node(struct udevice *udev, struct sysfs_class_device *class_de /* create all_partitions if requested */ if (udev->partitions) { char partitionname[PATH_SIZE]; - struct sysfs_attribute *attr; + char *attr; int range; /* take the maximum registered minor range */ - attr = sysfs_get_classdev_attr(class_dev, "range"); + attr = sysfs_attr_get_value(udev->dev->devpath, "range"); if (attr) { - range = atoi(attr->value); + range = atoi(attr); if (range > 1) udev->partitions = range-1; } @@ -247,7 +235,7 @@ static int rename_net_if(struct udevice *udev) struct ifreq ifr; int retval; - info("changing net interface name from '%s' to '%s'", udev->kernel_name, udev->name); + info("changing net interface name from '%s' to '%s'", udev->dev->kernel_name, udev->name); if (udev->test_run) return 0; @@ -258,7 +246,7 @@ static int rename_net_if(struct udevice *udev) } memset(&ifr, 0x00, sizeof(struct ifreq)); - strlcpy(ifr.ifr_name, udev->kernel_name, IFNAMSIZ); + strlcpy(ifr.ifr_name, udev->dev->kernel_name, IFNAMSIZ); strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); @@ -269,7 +257,7 @@ static int rename_net_if(struct udevice *udev) return retval; } -int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) +int udev_add_device(struct udevice *udev) { char *pos; int retval = 0; @@ -277,16 +265,16 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) dbg("adding name='%s'", udev->name); selinux_init(); - if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { - retval = create_node(udev, class_dev); + if (major(udev->devt)) { + retval = create_node(udev); if (retval != 0) goto exit; if (udev_db_add_device(udev) != 0) dbg("udev_db_add_dev failed, remove might not work for custom names"); - } else if (udev->type == DEV_NET) { + } else if (strcmp(udev->dev->subsystem, "net") == 0) { /* look if we want to change the name of the netif */ - if (strcmp(udev->name, udev->kernel_name) != 0) { + if (strcmp(udev->name, udev->dev->kernel_name) != 0) { retval = rename_net_if(udev); if (retval != 0) goto exit; @@ -296,12 +284,12 @@ int udev_add_device(struct udevice *udev, struct sysfs_class_device *class_dev) * original kernel name sleeps with the fishes and we don't * get an event from the kernel with the new name */ - pos = strrchr(udev->devpath, '/'); + pos = strrchr(udev->dev->devpath, '/'); if (pos != NULL) { pos[1] = '\0'; - strlcat(udev->devpath, udev->name, sizeof(udev->devpath)); - strlcpy(udev->kernel_name, udev->name, sizeof(udev->kernel_name)); - setenv("DEVPATH", udev->devpath, 1); + strlcat(udev->dev->devpath, udev->name, sizeof(udev->dev->devpath)); + strlcpy(udev->dev->kernel_name, udev->name, sizeof(udev->dev->kernel_name)); + setenv("DEVPATH", udev->dev->devpath, 1); setenv("INTERFACE", udev->name, 1); } } diff --git a/udev_config.c b/udev_config.c index c1af7c12ca..a7e19fe864 100644 --- a/udev_config.c +++ b/udev_config.c @@ -28,15 +28,9 @@ #include #include -#include "libsysfs/sysfs/libsysfs.h" -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_utils.h" -#include "udev_version.h" -#include "logging.h" /* global variables */ -char sysfs_path[PATH_SIZE]; char udev_root[PATH_SIZE]; char udev_config_filename[PATH_SIZE]; char udev_rules_filename[PATH_SIZE]; @@ -168,7 +162,7 @@ static int parse_config_file(void) return retval; } -void udev_init_config(void) +void udev_config_init(void) { const char *env; @@ -177,7 +171,6 @@ void udev_init_config(void) strcpy(udev_rules_filename, UDEV_RULES_FILE); udev_log_priority = LOG_ERR; udev_run = 1; - sysfs_get_mnt_path(sysfs_path, sizeof(sysfs_path)); /* disable RUN key execution */ env = getenv("UDEV_RUN"); @@ -202,7 +195,6 @@ void udev_init_config(void) if (env) udev_log_priority = log_priority(env); - dbg("sysfs_path='%s'", sysfs_path); dbg("UDEV_CONFIG_FILE='%s'", udev_config_filename); dbg("udev_root='%s'", udev_root); dbg("udev_rules='%s'", udev_rules_filename); diff --git a/udev_db.c b/udev_db.c index 6b9d5e8426..e9ae799132 100644 --- a/udev_db.c +++ b/udev_db.c @@ -30,11 +30,7 @@ #include #include -#include "libsysfs/sysfs/libsysfs.h" -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_utils.h" -#include "logging.h" static int devpath_to_db_path(const char *devpath, char *filename, size_t len) @@ -83,21 +79,21 @@ int udev_db_add_device(struct udevice *udev) /* don't write anything if udev created only the node with the * kernel name without any interesting data to remember */ - if (strcmp(udev->name, udev->kernel_name) == 0 && + if (strcmp(udev->name, udev->dev->kernel_name) == 0 && list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && !udev->partitions && !udev->ignore_remove) { dbg("nothing interesting to store in udevdb, skip"); goto exit; } - devpath_to_db_path(udev->devpath, filename, sizeof(filename)); + devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); create_path(filename); f = fopen(filename, "w"); if (f == NULL) { err("unable to create db file '%s': %s", filename, strerror(errno)); return -1; } - dbg("storing data for device '%s' in '%s'", udev->devpath, filename); + dbg("storing data for device '%s' in '%s'", udev->dev->devpath, filename); fprintf(f, "N:%s\n", udev->name); list_for_each_entry(name_loop, &udev->symlink_list, node) @@ -132,7 +128,7 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) return -1; } - strlcpy(udev->devpath, devpath, sizeof(udev->devpath)); + strlcpy(udev->dev->devpath, devpath, sizeof(udev->dev->devpath)); cur = 0; while (cur < bufsize) { count = buf_get_line(buf, bufsize, cur); @@ -196,7 +192,7 @@ int udev_db_delete_device(struct udevice *udev) { char filename[PATH_SIZE]; - devpath_to_db_path(udev->devpath, filename, sizeof(filename)); + devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); unlink(filename); return 0; diff --git a/udev_device.c b/udev_device.c index 7821c91cb4..0325001428 100644 --- a/udev_device.c +++ b/udev_device.c @@ -26,83 +26,99 @@ #include #include #include -#include -#include -#include -#include -#include -#include - -#include "udev_libc_wrapper.h" + #include "udev.h" -#include "logging.h" -#include "udev_utils.h" -#include "list.h" +#include "udev_rules.h" -int udev_init_device(struct udevice *udev, const char* devpath, const char *subsystem, const char *action) +struct udevice *udev_device_init(void) { - char *pos; + struct udevice *udev; + udev = malloc(sizeof(struct udevice)); + if (udev == NULL) + return NULL; memset(udev, 0x00, sizeof(struct udevice)); + INIT_LIST_HEAD(&udev->symlink_list); INIT_LIST_HEAD(&udev->run_list); INIT_LIST_HEAD(&udev->env_list); - if (subsystem) - strlcpy(udev->subsystem, subsystem, sizeof(udev->subsystem)); - - if (action) - strlcpy(udev->action, action, sizeof(udev->action)); - - if (devpath) { - strlcpy(udev->devpath, devpath, sizeof(udev->devpath)); - remove_trailing_chars(udev->devpath, '/'); - - if (strncmp(udev->devpath, "/block/", 7) == 0) - udev->type = DEV_BLOCK; - else if (strncmp(udev->devpath, "/class/net/", 11) == 0) - udev->type = DEV_NET; - else if (strncmp(udev->devpath, "/class/", 7) == 0) - udev->type = DEV_CLASS; - else if (strncmp(udev->devpath, "/devices/", 9) == 0) - udev->type = DEV_DEVICE; - - /* get kernel name */ - pos = strrchr(udev->devpath, '/'); - if (pos) { - strlcpy(udev->kernel_name, &pos[1], sizeof(udev->kernel_name)); - dbg("kernel_name='%s'", udev->kernel_name); - - /* Some block devices have '!' in their name, change that to '/' */ - pos = udev->kernel_name; - while (pos[0] != '\0') { - if (pos[0] == '!') - pos[0] = '/'; - pos++; - } - - /* get kernel number */ - pos = &udev->kernel_name[strlen(udev->kernel_name)]; - while (isdigit(pos[-1])) - pos--; - strlcpy(udev->kernel_number, pos, sizeof(udev->kernel_number)); - dbg("kernel_number='%s'", udev->kernel_number); - } - } + /* set sysfs device to local storage, can be overridden if needed */ + udev->dev = &udev->dev_local; - if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) { - udev->mode = 0660; - strcpy(udev->owner, "root"); - strcpy(udev->group, "root"); - } + /* default node permissions */ + udev->mode = 0660; + strcpy(udev->owner, "root"); + strcpy(udev->group, "root"); - return 0; + return udev; } -void udev_cleanup_device(struct udevice *udev) +void udev_device_cleanup(struct udevice *udev) { name_list_cleanup(&udev->symlink_list); name_list_cleanup(&udev->run_list); name_list_cleanup(&udev->env_list); + free(udev); +} + +dev_t udev_device_get_devt(struct udevice *udev) +{ + const char *attr; + unsigned int major, minor; + + /* read it from sysfs */ + attr = sysfs_attr_get_value(udev->dev->devpath, "dev"); + if (attr != NULL) { + if (sscanf(attr, "%u:%u", &major, &minor) == 2) + return makedev(major, minor); + } + return makedev(0, 0); +} + +int udev_device_event(struct udev_rules *rules, struct udevice *udev) +{ + int retval = 0; + + /* device node or netif */ + if ((major(udev->devt) != 0 || strcmp(udev->dev->subsystem, "net") == 0) && + strcmp(udev->action, "add") == 0) { + dbg("device node or netif add '%s'", udev->dev->devpath); + udev_rules_get_name(rules, udev); + if (udev->ignore_device) { + info("device event will be ignored"); + return 0; + } + /* create node, store in db */ + if (udev->name[0] != '\0') + retval = udev_add_device(udev); + else + info("device node creation supressed"); + return 0; + } + + if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { + struct name_entry *name_loop; + + udev_rules_get_run(rules, udev); + if (udev->ignore_device) { + info("device event will be ignored"); + return 0; + } + /* get data from db, remove db-entry, delete node */ + retval = udev_remove_device(udev); + + /* restore stored persistent data */ + list_for_each_entry(name_loop, &udev->env_list, node) + putenv(name_loop->name); + return 0; + } + + /* default devices */ + udev_rules_get_run(rules, udev); + if (udev->ignore_device) + info("device event will be ignored"); + + return retval; } diff --git a/udev_event.c b/udev_event.c deleted file mode 100644 index 887537e0e9..0000000000 --- a/udev_event.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * udev_event.c - udev event process - * - * Copyright (C) 2004, 2005 Kay Sievers - * - * 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 02139, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libsysfs/sysfs/libsysfs.h" -#include "udev_libc_wrapper.h" -#include "udev.h" -#include "logging.h" -#include "udev_rules.h" -#include "udev_utils.h" -#include "list.h" - - -dev_t get_devt(struct sysfs_class_device *class_dev) -{ - struct sysfs_attribute *attr = NULL; - unsigned int major, minor; - char *maj, *min; - - maj = getenv("MAJOR"); - min = getenv("MINOR"); - - if (maj && min) { - major = atoi(maj); - minor = atoi(min); - } else { - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr == NULL) - return 0; - dbg("dev='%s'", attr->value); - - if (sscanf(attr->value, "%u:%u", &major, &minor) != 2) - return 0; - } - - dbg("found major=%d, minor=%d", major, minor); - return makedev(major, minor); -} - -int udev_process_event(struct udev_rules *rules, struct udevice *udev) -{ - int retval; - char path[PATH_SIZE]; - - if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS || udev->type == DEV_NET) { - /* handle device node */ - if (strcmp(udev->action, "add") == 0) { - struct sysfs_class_device *class_dev; - - dbg("node add"); - snprintf(path, sizeof(path), "%s%s", sysfs_path, udev->devpath); - path[sizeof(path)-1] = '\0'; - class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) { - dbg("open class device failed"); - return 0; - } - dbg("opened class_dev->name='%s'", class_dev->name); - - /* get major/minor */ - if (udev->type == DEV_BLOCK || udev->type == DEV_CLASS) - udev->devt = get_devt(class_dev); - - if (udev->type == DEV_NET || udev->devt) { - /* name device */ - udev_rules_get_name(rules, udev, class_dev); - if (udev->ignore_device) { - info("device event will be ignored"); - sysfs_close_class_device(class_dev); - return 0; - } - if (udev->name[0] != '\0') { - /* create node, store in db */ - retval = udev_add_device(udev, class_dev); - } else { - info("device node creation supressed"); - } - } else { - dbg("no dev-file found"); - udev_rules_get_run(rules, udev, class_dev, NULL); - if (udev->ignore_device) { - info("device event will be ignored"); - sysfs_close_class_device(class_dev); - return 0; - } - } - sysfs_close_class_device(class_dev); - } else if (strcmp(udev->action, "remove") == 0) { - struct name_entry *name_loop; - - /* get data from db, remove db-entry, delete node */ - dbg("node remove"); - retval = udev_remove_device(udev); - - /* restore stored persistent data */ - list_for_each_entry(name_loop, &udev->env_list, node) - putenv(name_loop->name); - - udev_rules_get_run(rules, udev, NULL, NULL); - if (udev->ignore_device) { - dbg("device event will be ignored"); - return 0; - } - } - } else if (udev->type == DEV_DEVICE && strcmp(udev->action, "add") == 0) { - struct sysfs_device *devices_dev; - - dbg("devices add"); - snprintf(path, sizeof(path), "%s%s", sysfs_path, udev->devpath); - path[sizeof(path)-1] = '\0'; - devices_dev = sysfs_open_device_path(path); - if (!devices_dev) { - dbg("devices device unavailable (probably remove has beaten us)"); - return 0; - } - - dbg("devices device opened '%s'", path); - udev_rules_get_run(rules, udev, NULL, devices_dev); - sysfs_close_device(devices_dev); - if (udev->ignore_device) { - info("device event will be ignored"); - return 0; - } - } else { - dbg("default handling"); - udev_rules_get_run(rules, udev, NULL, NULL); - if (udev->ignore_device) { - info("device event will be ignored"); - return 0; - } - } - return 0; -} diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index fe38993cd7..02a1f8d016 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -27,10 +27,7 @@ #include #include -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_utils.h" -#include "logging.h" #ifdef __KLIBC__ #define __OWN_USERDB_PARSER__ diff --git a/udev_remove.c b/udev_remove.c index f9592b4c70..945618ce5a 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -28,11 +28,7 @@ #include #include -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_utils.h" -#include "udev_version.h" -#include "logging.h" static int delete_node(struct udevice *udev) { @@ -112,10 +108,10 @@ static int delete_node(struct udevice *udev) */ int udev_remove_device(struct udevice *udev) { - if (udev->type != DEV_BLOCK && udev->type != DEV_CLASS) + if (major(udev->devt) == 0) return 0; - if (udev_db_get_device(udev, udev->devpath) == 0) { + if (udev_db_get_device(udev, udev->dev->devpath) == 0) { if (udev->ignore_remove) { dbg("remove event for '%s' requested to be ignored by rule", udev->name); return 0; @@ -123,8 +119,8 @@ int udev_remove_device(struct udevice *udev) dbg("remove name='%s'", udev->name); udev_db_delete_device(udev); } else { - dbg("'%s' not found in database, using kernel name '%s'", udev->devpath, udev->kernel_name); - strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); + dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel_name); + strlcpy(udev->name, udev->dev->kernel_name, sizeof(udev->name)); } return delete_node(udev); diff --git a/udev_rules.c b/udev_rules.c index 492a9b0dfc..8693b71c08 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -31,13 +31,7 @@ #include #include -#include "libsysfs/sysfs/libsysfs.h" -#include "list.h" -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_utils.h" -#include "udev_version.h" -#include "logging.h" #include "udev_rules.h" @@ -221,26 +215,29 @@ static int import_program_into_env(struct udevice *udev, const char *program) char result[1024]; size_t reslen; - if (run_program(program, udev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_INFO)) != 0) + if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_INFO)) != 0) return -1; return import_keys_into_env(udev, result, reslen); } -static int import_parent_into_env(struct udevice *udev, struct sysfs_class_device *class_dev, const char *filter) +static int import_parent_into_env(struct udevice *udev, const char *filter) { - struct sysfs_class_device *parent = sysfs_get_classdev_parent(class_dev); + struct sysfs_device *dev_parent; int rc = -1; - if (parent != NULL) { - struct udevice udev_parent; + dev_parent = sysfs_device_get_parent(udev->dev); + if (dev_parent != NULL) { + struct udevice *udev_parent; struct name_entry *name_loop; - dbg("found parent '%s', get the node name", parent->path); - udev_init_device(&udev_parent, NULL, NULL, NULL); + dbg("found parent '%s', get the node name", dev_parent->devpath); + udev_parent = udev_device_init(); + if (udev_parent == NULL) + return -1; /* import the udev_db of the parent */ - if (udev_db_get_device(&udev_parent, &parent->path[strlen(sysfs_path)]) == 0) { - dbg("import stored parent env '%s'", udev_parent.name); - list_for_each_entry(name_loop, &udev_parent.env_list, node) { + if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { + dbg("import stored parent env '%s'", udev_parent->name); + list_for_each_entry(name_loop, &udev_parent->env_list, node) { char name[NAME_SIZE]; char *pos; @@ -260,7 +257,7 @@ static int import_parent_into_env(struct udevice *udev, struct sysfs_class_devic rc = 0; } else dbg("parent not found in database"); - udev_cleanup_device(&udev_parent); + udev_device_cleanup(udev_parent); } return rc; @@ -291,22 +288,24 @@ static int find_free_number(const char *base, const char *devpath) { char db_devpath[PATH_SIZE]; char filename[PATH_SIZE]; - struct udevice udev_db; + struct udevice *udev_db; int num = 0; /* check if the device already owns a matching name */ - udev_init_device(&udev_db, NULL, NULL, NULL); - if (udev_db_get_device(&udev_db, devpath) == 0) { + udev_db = udev_device_init(); + if (udev_db == NULL) + return -1; + if (udev_db_get_device(udev_db, devpath) == 0) { struct name_entry *name_loop; int devnum; - devnum = match_name_and_get_number(base, udev_db.name); + devnum = match_name_and_get_number(base, udev_db->name); if (devnum >= 0) { num = devnum; dbg("device '%s', already has the node '%s' with num %u, use it", devpath, base, num); goto out; } - list_for_each_entry(name_loop, &udev_db.symlink_list, node) { + list_for_each_entry(name_loop, &udev_db->symlink_list, node) { devnum = match_name_and_get_number(base, name_loop->name); if (devnum >= 0) { num = devnum; @@ -336,45 +335,10 @@ static int find_free_number(const char *base, const char *devpath) } out: - udev_cleanup_device(&udev_db); + udev_device_cleanup(udev_db); return num; } -static int find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, - const char *name, char *value, size_t len) -{ - struct sysfs_class_device *class_dev_parent; - struct sysfs_attribute *tmpattr; - - dbg("look for device attribute '%s'", name); - if (class_dev) { - dbg("look for class attribute '%s/%s'", class_dev->path, name); - tmpattr = sysfs_get_classdev_attr(class_dev, name); - if (tmpattr) - goto attr_found; - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent) { - tmpattr = sysfs_get_classdev_attr(class_dev_parent, name); - if (tmpattr) - goto attr_found; - } - } - if (sysfs_device) { - dbg("look for devices attribute '%s/%s'", sysfs_device->path, name); - tmpattr = sysfs_get_device_attr(sysfs_device, name); - if (tmpattr) - goto attr_found; - } - return -1; - -attr_found: - strlcpy(value, tmpattr->value, len); - remove_trailing_chars(value, '\n'); - - dbg("found attribute '%s'", tmpattr->path); - return 0; -} - #define WAIT_LOOP_PER_SECOND 50 static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) { @@ -382,7 +346,7 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) struct stat stats; int loop = timeout * WAIT_LOOP_PER_SECOND; - snprintf(filename, sizeof(filename), "%s%s/%s", sysfs_path, udev->devpath, file); + snprintf(filename, sizeof(filename), "%s%s/%s", sysfs_path, udev->dev->devpath, file); filename[sizeof(filename)-1] = '\0'; dbg("wait %i sec for '%s'", timeout, filename); @@ -398,8 +362,7 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) return -1; } -static void apply_format(struct udevice *udev, char *string, size_t maxsize, - struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) +static void apply_format(struct udevice *udev, char *string, size_t maxsize) { char temp[PATH_SIZE]; char temp2[PATH_SIZE]; @@ -408,11 +371,9 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, int i; int count; unsigned int next_free_number; - struct sysfs_class_device *class_dev_parent; enum subst_type { SUBST_UNKNOWN, SUBST_DEVPATH, - SUBST_ID, SUBST_KERNEL_NUMBER, SUBST_KERNEL_NAME, SUBST_MAJOR, @@ -432,7 +393,6 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, enum subst_type type; } map[] = { { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, - { .name = "id", .fmt = 'b', .type = SUBST_ID }, { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL_NAME }, { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, @@ -502,25 +462,20 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize, found: attr = get_format_attribute(&tail); strlcpy(temp, tail, sizeof(temp)); - dbg("format=%i, string='%s', tail='%s', class_dev=%p, sysfs_dev=%p", - type ,string, tail, class_dev, sysfs_device); + dbg("format=%i, string='%s', tail='%s'", type ,string, tail); switch (type) { case SUBST_DEVPATH: - strlcat(string, udev->devpath, maxsize); - dbg("substitute devpath '%s'", udev->devpath); - break; - case SUBST_ID: - strlcat(string, udev->bus_id, maxsize); - dbg("substitute bus_id '%s'", udev->bus_id); + strlcat(string, udev->dev->devpath, maxsize); + dbg("substitute devpath '%s'", udev->dev->devpath); break; case SUBST_KERNEL_NAME: - strlcat(string, udev->kernel_name, maxsize); - dbg("substitute kernel name '%s'", udev->kernel_name); + strlcat(string, udev->dev->kernel_name, maxsize); + dbg("substitute kernel name '%s'", udev->dev->kernel_name); break; case SUBST_KERNEL_NUMBER: - strlcat(string, udev->kernel_number, maxsize); - dbg("substitute kernel number '%s'", udev->kernel_number); + strlcat(string, udev->dev->kernel_number, maxsize); + dbg("substitute kernel number '%s'", udev->dev->kernel_number); break; case SUBST_MAJOR: sprintf(temp2, "%d", major(udev->devt)); @@ -570,54 +525,59 @@ found: if (attr == NULL) { dbg("missing attribute"); break; - } - if (find_sysfs_attribute(class_dev, sysfs_device, attr, temp2, sizeof(temp2)) != 0) { - struct sysfs_device *parent_device; - - dbg("sysfs attribute '%s' not found, walk up the physical devices", attr); - parent_device = sysfs_get_device_parent(sysfs_device); - while (parent_device) { - dbg("looking at '%s'", parent_device->path); - if (find_sysfs_attribute(NULL, parent_device, attr, temp2, sizeof(temp2)) == 0) + } else { + struct sysfs_device *dev_parent; + const char *value; + + dev_parent = udev->dev; + do { + dbg("looking at '%s'", dev_parent->devpath); + value = sysfs_attr_get_value(dev_parent->devpath, attr); + if (value != NULL) { + strlcpy(temp2, value, sizeof(temp2)); break; - parent_device = sysfs_get_device_parent(parent_device); - } - if (!parent_device) - break; + } + dev_parent = sysfs_device_get_parent(dev_parent); + } while (dev_parent != NULL); + + /* strip trailing whitespace of sysfs value */ + i = strlen(temp2); + while (i > 0 && isspace(temp2[i-1])) + temp2[--i] = '\0'; + count = replace_untrusted_chars(temp2); + if (count) + info("%i untrusted character(s) replaced" , count); + strlcat(string, temp2, maxsize); + dbg("substitute sysfs value '%s'", temp2); } - /* strip trailing whitespace of sysfs value */ - i = strlen(temp2); - while (i > 0 && isspace(temp2[i-1])) - temp2[--i] = '\0'; - count = replace_untrusted_chars(temp2); - if (count) - info("%i untrusted character(s) replaced" , count); - strlcat(string, temp2, maxsize); - dbg("substitute sysfs value '%s'", temp2); break; case SUBST_ENUM: - next_free_number = find_free_number(string, udev->devpath); + next_free_number = find_free_number(string, udev->dev->devpath); if (next_free_number > 0) { sprintf(temp2, "%d", next_free_number); strlcat(string, temp2, maxsize); } break; case SUBST_PARENT: - if (!class_dev) - break; - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) { - struct udevice udev_parent; - - dbg("found parent '%s', get the node name", class_dev_parent->path); - udev_init_device(&udev_parent, NULL, NULL, NULL); - /* lookup the name in the udev_db with the DEVPATH of the parent */ - if (udev_db_get_device(&udev_parent, &class_dev_parent->path[strlen(sysfs_path)]) == 0) { - strlcat(string, udev_parent.name, maxsize); - dbg("substitute parent node name'%s'", udev_parent.name); - } else - dbg("parent not found in database"); - udev_cleanup_device(&udev_parent); + { + struct sysfs_device *dev_parent; + + dev_parent = sysfs_device_get_parent(udev->dev); + if (dev_parent != NULL) { + struct udevice *udev_parent; + + dbg("found parent '%s', get the node name", dev_parent->devpath); + udev_parent = udev_device_init(); + if (udev_parent != NULL) { + /* lookup the name in the udev_db with the DEVPATH of the parent */ + if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { + strlcat(string, udev_parent->name, maxsize); + dbg("substitute parent node name'%s'", udev_parent->name); + } else + dbg("parent not found in database"); + udev_device_cleanup(udev_parent); + } + } } break; case SUBST_TEMP_NODE: @@ -636,10 +596,15 @@ found: dbg("substitute udev_root '%s'", udev_root); break; case SUBST_MODALIAS: - if (find_sysfs_attribute(NULL, sysfs_device, "modalias", temp2, sizeof(temp2)) != 0) - break; - strlcat(string, temp2, maxsize); - dbg("substitute MODALIAS '%s'", temp2); + { + const char *value; + + value = sysfs_attr_get_value(udev->dev->devpath, "modalias"); + if (value != NULL) { + strlcat(string, value, maxsize); + dbg("substitute MODALIAS '%s'", temp2); + } + } break; case SUBST_ENV: if (attr == NULL) { @@ -714,28 +679,28 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k } /* match a single rule against a given device and possibly its parent devices */ -static int match_rule(struct udevice *udev, struct udev_rule *rule, - struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) +static int match_rule(struct udevice *udev, struct udev_rule *rule) { - struct sysfs_device *parent_device = sysfs_device; + struct sysfs_device *dev_parent; int i; if (match_key("ACTION", rule, &rule->action, udev->action)) goto exit; - if (match_key("KERNEL", rule, &rule->kernel_name, udev->kernel_name)) + if (match_key("KERNEL", rule, &rule->kernel_name, udev->dev->kernel_name)) goto exit; - if (match_key("SUBSYSTEM", rule, &rule->subsystem, udev->subsystem)) + if (match_key("SUBSYSTEM", rule, &rule->subsystem, udev->dev->subsystem)) goto exit; - if (match_key("DEVPATH", rule, &rule->devpath, udev->devpath)) + if (match_key("DEVPATH", rule, &rule->devpath, udev->dev->devpath)) goto exit; if (rule->modalias.operation != KEY_OP_UNSET) { - char value[NAME_SIZE]; + const char *value; - if (find_sysfs_attribute(NULL, sysfs_device, "modalias", value, sizeof(value)) != 0) { + value = sysfs_attr_get_value(udev->dev->devpath, "modalias"); + if (value == NULL) { dbg("MODALIAS value not found"); goto exit; } @@ -777,34 +742,23 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, } /* walk up the chain of physical devices and find a match */ + dev_parent = udev->dev; while (1) { /* check for matching driver */ if (rule->driver.operation != KEY_OP_UNSET) { - if (parent_device == NULL) { - dbg("device has no sysfs_device"); - goto exit; - } - if (match_key("DRIVER", rule, &rule->driver, parent_device->driver_name)) + if (match_key("DRIVER", rule, &rule->driver, dev_parent->driver)) goto try_parent; } /* check for matching bus value */ if (rule->bus.operation != KEY_OP_UNSET) { - if (parent_device == NULL) { - dbg("device has no sysfs_device"); - goto exit; - } - if (match_key("BUS", rule, &rule->bus, parent_device->bus)) + if (match_key("BUS", rule, &rule->bus, dev_parent->subsystem)) goto try_parent; } /* check for matching bus id */ if (rule->id.operation != KEY_OP_UNSET) { - if (parent_device == NULL) { - dbg("device has no sysfs_device"); - goto exit; - } - if (match_key("ID", rule, &rule->id, parent_device->bus_id)) + if (match_key("ID", rule, &rule->id, dev_parent->kernel_name)) goto try_parent; } @@ -815,36 +769,39 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule, struct key_pair *pair = &rule->sysfs.keys[i]; const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); - char value[VALUE_SIZE]; + const char *value; + char val[VALUE_SIZE]; size_t len; - if (find_sysfs_attribute(class_dev, parent_device, key_name, value, sizeof(value)) != 0) + value = sysfs_attr_get_value(dev_parent->devpath, key_name); + if (value == NULL) goto try_parent; + strlcpy(val, value, sizeof(val)); /* strip trailing whitespace of value, if not asked to match for it */ len = strlen(key_value); - if (len && !isspace(key_value[len-1])) { - len = strlen(value); - while (len > 0 && isspace(value[len-1])) - value[--len] = '\0'; - dbg("removed %zi trailing whitespace chars from '%s'", strlen(value)-len, value); + if (len > 0 && !isspace(key_value[len-1])) { + len = strlen(val); + while (len > 0 && isspace(val[len-1])) + val[--len] = '\0'; + dbg("removed %zi trailing whitespace chars from '%s'", strlen(val)-len, val); } - if (match_key("SYSFS", rule, &pair->key, value)) + if (match_key("SYSFS", rule, &pair->key, val)) goto try_parent; } dbg("all %i SYSFS keys matched", rule->sysfs.count); } - /* found matching physical device */ + /* found matching device */ break; try_parent: dbg("try parent sysfs device"); - parent_device = sysfs_get_device_parent(parent_device); - if (parent_device == NULL) + dev_parent = sysfs_device_get_parent(dev_parent); + if (dev_parent == NULL) goto exit; - dbg("look at sysfs_device->path='%s'", parent_device->path); - dbg("look at sysfs_device->bus_id='%s'", parent_device->bus_id); + dbg("looking at dev_parent->devpath='%s'", dev_parent->devpath); + dbg("looking at dev_parent->bus_kernel_name='%s'", dev_parent->kernel_name); } /* execute external program */ @@ -853,8 +810,8 @@ try_parent: char result[PATH_SIZE]; strlcpy(program, key_val(rule, &rule->program), sizeof(program)); - apply_format(udev, program, sizeof(program), class_dev, sysfs_device); - if (run_program(program, udev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_INFO)) != 0) { + apply_format(udev, program, sizeof(program)); + if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_INFO)) != 0) { dbg("PROGRAM is false"); udev->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) @@ -886,18 +843,18 @@ try_parent: int rc = -1; strlcpy(import, key_val(rule, &rule->import), sizeof(import)); - apply_format(udev, import, sizeof(import), class_dev, sysfs_device); + apply_format(udev, import, sizeof(import)); dbg("check for IMPORT import='%s'", import); if (rule->import_type == IMPORT_PROGRAM) { rc = import_program_into_env(udev, import); } else if (rule->import_type == IMPORT_FILE) { dbg("import file import='%s'", import); rc = import_file_into_env(udev, import); - } else if (rule->import_type == IMPORT_PARENT && class_dev) { + } else if (rule->import_type == IMPORT_PARENT) { dbg("import parent import='%s'", import); - rc = import_parent_into_env(udev, class_dev, import); + rc = import_parent_into_env(udev, import); } - if (rc) { + if (rc != 0) { dbg("IMPORT failed"); if (rule->import.operation != KEY_OP_NOMATCH) goto exit; @@ -926,35 +883,13 @@ exit: return -1; } -int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct sysfs_class_device *class_dev) +int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) { - struct sysfs_class_device *class_dev_parent; - struct sysfs_device *sysfs_device = NULL; struct udev_rule *rule; int name_set = 0; - dbg("class_dev->name='%s'", class_dev->name); - - /* Figure out where the "device"-symlink is at. For char devices this will - * always be in the class_dev->path. On block devices, only the main block - * device will have the device symlink in it's path. All partition devices - * need to look at the symlink in its parent directory. - */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) { - dbg("given class device has a parent, use this instead"); - sysfs_device = sysfs_get_classdev_device(class_dev_parent); - } else { - sysfs_device = sysfs_get_classdev_device(class_dev); - } - - if (sysfs_device) { - dbg("found devices device: path='%s', bus_id='%s', bus='%s'", - sysfs_device->path, sysfs_device->bus_id, sysfs_device->bus); - strlcpy(udev->bus_id, sysfs_device->bus_id, sizeof(udev->bus_id)); - } - - dbg("udev->kernel_name='%s'", udev->kernel_name); + dbg("udev->dev->devpath='%s'", udev->dev->devpath); + dbg("udev->dev->kernel_name='%s'", udev->dev->kernel_name); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -969,10 +904,10 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s } dbg("process rule"); - if (match_rule(udev, rule, class_dev, sysfs_device) == 0) { + if (match_rule(udev, rule) == 0) { /* apply options */ if (rule->ignore_device) { - info("rule applied, '%s' is ignored", udev->kernel_name); + info("rule applied, '%s' is ignored", udev->dev->kernel_name); udev->ignore_device = 1; return 0; } @@ -981,7 +916,8 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s dbg("remove event should be ignored"); } /* apply all_partitions option only at a main block device */ - if (rule->partitions && udev->type == DEV_BLOCK && udev->kernel_number[0] == '\0') { + if (rule->partitions && + strcmp(udev->dev->subsystem, "block") == 0 && udev->dev->kernel_number[0] == '\0') { udev->partitions = rule->partitions; dbg("creation of partition nodes requested"); } @@ -991,21 +927,21 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s if (rule->mode_operation == KEY_OP_ASSIGN_FINAL) udev->mode_final = 1; udev->mode = rule->mode; - dbg("applied mode=%#o to '%s'", rule->mode, udev->kernel_name); + dbg("applied mode=%#o to '%s'", rule->mode, udev->dev->kernel_name); } if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) udev->owner_final = 1; strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner)); - apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device); - dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name); + apply_format(udev, udev->owner, sizeof(udev->owner)); + dbg("applied owner='%s' to '%s'", udev->owner, udev->dev->kernel_name); } if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) { if (rule->group.operation == KEY_OP_ASSIGN_FINAL) udev->group_final = 1; strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); - apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device); - dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name); + apply_format(udev, udev->group, sizeof(udev->group)); + dbg("applied group='%s' to '%s'", udev->group, udev->dev->kernel_name); } /* collect symlinks */ @@ -1021,7 +957,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s name_list_cleanup(&udev->symlink_list); } strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); - apply_format(udev, temp, sizeof(temp), class_dev, sysfs_device); + apply_format(udev, temp, sizeof(temp)); count = replace_untrusted_chars(temp); if (count) info("%i untrusted character(s) replaced" , count); @@ -1052,13 +988,13 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s int count; name_set = 1; strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); - apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); + apply_format(udev, udev->name, sizeof(udev->name)); count = replace_untrusted_chars(udev->name); if (count) info("%i untrusted character(s) replaced", count); - info("rule applied, '%s' becomes '%s'", udev->kernel_name, udev->name); - if (udev->type != DEV_NET) + info("rule applied, '%s' becomes '%s'", udev->dev->kernel_name, udev->name); + if (strcmp(udev->dev->subsystem, "net") != 0) dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", udev->name, udev->owner, udev->group, udev->mode, udev->partitions); } @@ -1073,7 +1009,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s name_list_cleanup(&udev->run_list); } strlcpy(program, key_val(rule, &rule->run), sizeof(program)); - apply_format(udev, program, sizeof(program), class_dev, sysfs_device); + apply_format(udev, program, sizeof(program)); dbg("add run '%s'", program); name_list_add(&udev->run_list, program, 0); } @@ -1091,7 +1027,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s } if (!name_set) { - strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); + strlcpy(udev->name, udev->dev->kernel_name, sizeof(udev->name)); info("no node name set, will use kernel name '%s'", udev->name); } @@ -1104,20 +1040,11 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s return 0; } -int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, - struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_dev) +int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) { struct udev_rule *rule; - if (class_dev && !sysfs_dev) - sysfs_dev = sysfs_get_classdev_device(class_dev); - if (sysfs_dev) { - dbg("found devices device: path='%s', bus_id='%s', bus='%s'", - sysfs_dev->path, sysfs_dev->bus_id, sysfs_dev->bus); - strlcpy(udev->bus_id, sysfs_dev->bus_id, sizeof(udev->bus_id)); - } - - dbg("udev->kernel_name='%s'", udev->kernel_name); + dbg("udev->kernel_name='%s'", udev->dev->kernel_name); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -1133,9 +1060,9 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, continue; } - if (match_rule(udev, rule, class_dev, sysfs_dev) == 0) { + if (match_rule(udev, rule) == 0) { if (rule->ignore_device) { - info("rule applied, '%s' is ignored", udev->kernel_name); + info("rule applied, '%s' is ignored", udev->dev->kernel_name); udev->ignore_device = 1; return 0; } @@ -1148,7 +1075,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, name_list_cleanup(&udev->run_list); } strlcpy(program, key_val(rule, &rule->run), sizeof(program)); - apply_format(udev, program, sizeof(program), class_dev, sysfs_dev); + apply_format(udev, program, sizeof(program)); dbg("add run '%s'", program); name_list_add(&udev->run_list, program, 0); if (rule->run.operation == KEY_OP_ASSIGN_FINAL) diff --git a/udev_rules.h b/udev_rules.h index 6d9d306ded..125babf1c5 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -22,7 +22,6 @@ #ifndef UDEV_RULES_H #define UDEV_RULES_H -#include "libsysfs/sysfs/libsysfs.h" #include "udev.h" #include "list.h" @@ -104,18 +103,15 @@ struct udev_rules { }; extern int udev_rules_init(struct udev_rules *rules, int resolve_names); -extern void udev_rules_close(struct udev_rules *rules); +extern void udev_rules_cleanup(struct udev_rules *rules); -extern void udev_apply_format(struct udevice *udev, char *string, size_t maxsize, - struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device); +extern void udev_apply_format(struct udevice *udev, char *string, size_t maxsize); extern void udev_rules_iter_init(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label); -extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, - struct sysfs_class_device *class_dev); -extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev, - struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_dev); +extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev); +extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev); #endif diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 7fa21afa8c..4fcd6db08e 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -28,10 +28,7 @@ #include #include -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_utils.h" -#include "logging.h" #include "udev_rules.h" @@ -626,7 +623,7 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) return retval; } -void udev_rules_close(struct udev_rules *rules) +void udev_rules_cleanup(struct udev_rules *rules) { if (rules->buf) { free(rules->buf); diff --git a/udev_selinux.c b/udev_selinux.c index 298c75566c..94c213d297 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -32,7 +32,6 @@ #include "udev.h" #include "udev_selinux.h" -#include "logging.h" static security_context_t prev_scontext = NULL; diff --git a/udev_sysfs.c b/udev_sysfs.c new file mode 100644 index 0000000000..19fd614e63 --- /dev/null +++ b/udev_sysfs.c @@ -0,0 +1,345 @@ +/* + * udev_sysfs.c - sysfs access + * + * Copyright (C) 2005 Kay Sievers + * + * 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 02139, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +char sysfs_path[PATH_SIZE]; + +/* device cache */ +static LIST_HEAD(dev_list); + +/* attribute value cache */ +static LIST_HEAD(attr_list); +struct sysfs_attr { + struct list_head node; + char path[PATH_SIZE]; + char value[NAME_SIZE]; +}; + +int sysfs_init(void) +{ + const char *env; + + env = getenv("SYSFS_PATH"); + if (env) { + strlcpy(sysfs_path, env, sizeof(sysfs_path)); + remove_trailing_chars(sysfs_path, '/'); + } else + strlcpy(sysfs_path, "/sys", sizeof(sysfs_path)); + dbg("sysfs_path='%s'", sysfs_path); + + INIT_LIST_HEAD(&dev_list); + INIT_LIST_HEAD(&attr_list); + return 0; +} + +void sysfs_cleanup(void) +{ + struct sysfs_attr *attr_loop; + struct sysfs_attr *attr_temp; + struct sysfs_device *dev_loop; + struct sysfs_device *dev_temp; + + list_for_each_entry_safe(attr_loop, attr_temp, &attr_list, node) { + list_del(&attr_loop->node); + free(attr_loop); + } + + list_for_each_entry_safe(dev_loop, dev_temp, &dev_list, node) { + list_del(&dev_loop->node); + free(dev_loop); + } +} + +void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, const char *subsystem) +{ + char *pos; + + strlcpy(dev->devpath, devpath, sizeof(dev->devpath)); + if (subsystem != NULL) + strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); + + /* set kernel name */ + pos = strrchr(dev->devpath, '/'); + if (pos == NULL) + return; + + strlcpy(dev->kernel_name, &pos[1], sizeof(dev->kernel_name)); + dbg("kernel_name='%s'", dev->kernel_name); + + /* some devices have '!' in their name, change that to '/' */ + pos = dev->kernel_name; + while (pos[0] != '\0') { + if (pos[0] == '!') + pos[0] = '/'; + pos++; + } + + /* get kernel number */ + pos = &dev->kernel_name[strlen(dev->kernel_name)]; + while (isdigit(pos[-1])) + pos--; + strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); + dbg("kernel_number='%s'", dev->kernel_number); +} + +struct sysfs_device *sysfs_device_get(const char *devpath) +{ + char path[PATH_SIZE]; + char devpath_real[PATH_SIZE]; + struct sysfs_device *dev; + struct sysfs_device *dev_loop; + struct stat statbuf; + char link_path[PATH_SIZE]; + char link_target[PATH_SIZE]; + int len; + char *pos; + + dbg("open '%s'", devpath); + strlcpy(devpath_real, devpath, sizeof(devpath_real)); + remove_trailing_chars(devpath_real, '/'); + + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath_real, sizeof(path)); + if (lstat(path, &statbuf) != 0) { + dbg("stat '%s' failed: %s", devpath, strerror(errno)); + return NULL; + } + + /* if we got a link, resolve it to the real device */ + if (S_ISLNK(statbuf.st_mode)) { + int i; + int back; + + len = readlink(path, link_target, sizeof(link_target)); + if (len <= 0) + return NULL; + link_target[len] = '\0'; + dbg("devpath link '%s' points to '%s'", path, link_target); + + for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) + ; + dbg("base '%s', tail '%s', back %i", devpath_real, &link_target[back * 3], back); + for (i = 0; i <= back; i++) { + pos = strrchr(devpath_real, '/'); + if (pos == NULL) + return NULL; + pos[0] = '\0'; + } + dbg("after moving back '%s'", devpath_real); + strlcat(devpath_real, "/", sizeof(devpath_real)); + strlcat(devpath_real, &link_target[back * 3], sizeof(devpath_real)); + } + + /* look for device in cache */ + list_for_each_entry(dev_loop, &dev_list, node) { + if (strcmp(dev_loop->devpath, devpath_real) == 0) { + dbg("found in cache '%s'", dev_loop->devpath); + return dev_loop; + } + } + + /* new device */ + dbg("'%s'", devpath_real); + dev = malloc(sizeof(struct sysfs_device)); + if (dev == NULL) + return NULL; + memset(dev, 0x00, sizeof(struct sysfs_device)); + + sysfs_device_set_values(dev, devpath_real, NULL); + + /* get subsystem */ + if (strncmp(dev->devpath, "/class/", 7) == 0) { + strlcpy(dev->subsystem, &dev->devpath[7], sizeof(dev->subsystem)); + pos = strchr(dev->subsystem, '/'); + if (pos != NULL) + pos[0] = '\0'; + else + dev->subsystem[0] = '\0'; + } else if (strncmp(devpath, "/block/", 7) == 0) { + strlcpy(dev->subsystem, "block", sizeof(dev->subsystem)); + } else if (strncmp(devpath, "/devices/", 9) == 0) { + /* get subsystem from bus name */ + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, dev->devpath, sizeof(link_path)); + strlcat(link_path, "/bus", sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len > 0) { + link_target[len] = '\0'; + dbg("bus link '%s' points to '%s'", link_path, link_target); + pos = strrchr(link_target, '/'); + if (pos != NULL) + strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); + } + + /* get driver name */ + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, dev->devpath, sizeof(link_path)); + strlcat(link_path, "/driver", sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len > 0) { + link_target[len] = '\0'; + dbg("driver link '%s' points to '%s'", link_path, link_target); + pos = strrchr(link_target, '/'); + if (pos != NULL) + strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); + } + } else if (strncmp(devpath, "/bus/", 5) == 0 && strstr(devpath, "/drivers/")) { + strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); + } else if (strncmp(devpath, "/module/", 8) == 0) { + strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); + } + + dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'", dev->devpath, dev->subsystem, dev->driver); + list_add(&dev->node, &dev_list); + + return dev; +} + +struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) +{ + char parent_devpath[PATH_SIZE]; + char device_link[PATH_SIZE]; + char device_link_target[PATH_SIZE]; + char *pos; + int i; + int len; + int back; + + /* requesting a parent is only valid for devices */ + if ((strncmp(dev->devpath, "/devices/", 9) != 0) && + (strncmp(dev->devpath, "/class/", 7) != 0) && + (strncmp(dev->devpath, "/block/", 7) != 0)) + return NULL; + + strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); + dbg("'%s'", parent_devpath); + + /* strip last element */ + pos = strrchr(parent_devpath, '/'); + if (pos == NULL || pos == parent_devpath) + return NULL; + pos[0] = '\0'; + + /* are we at the top level */ + if (strcmp(parent_devpath, "/devices") == 0) { + dbg("/devices top level"); + return NULL; + } + + /* at the top level we may follow the "device" link */ + if (strcmp(parent_devpath, "/block") == 0) { + dbg("/block top level, look for device link"); + goto device_link; + } + + if (strncmp(parent_devpath, "/class", 6) == 0) { + pos = strrchr(parent_devpath, '/'); + if (pos == &parent_devpath[6] || pos == parent_devpath) { + dbg("class top level, look for device link"); + goto device_link; + } + } + return sysfs_device_get(parent_devpath); + +device_link: + strlcpy(device_link, sysfs_path, sizeof(device_link)); + strlcat(device_link, dev->devpath, sizeof(device_link)); + strlcat(device_link, "/device", sizeof(device_link)); + len = readlink(device_link, device_link_target, sizeof(device_link_target)); + if (len < 0) + return NULL; + device_link_target[len] = '\0'; + dbg("device link '%s' points to '%s'", device_link, device_link_target); + + for (back = 0; strncmp(&device_link_target[back * 3], "../", 3) == 0; back++) + ; + strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); + dbg("base='%s', tail='%s', back=%i", parent_devpath, &device_link_target[back * 3], back); + for (i = 0; i < back; i++) { + pos = strrchr(parent_devpath, '/'); + if (pos == NULL) + return NULL; + pos[0] = '\0'; + } + dbg("after moving back '%s'", parent_devpath); + strlcat(parent_devpath, "/", sizeof(parent_devpath)); + strlcat(parent_devpath, &device_link_target[back * 3], sizeof(parent_devpath)); + return sysfs_device_get(parent_devpath); +} + +char *sysfs_attr_get_value(const char *devpath, const char *attr_name) +{ + char path_full[PATH_SIZE]; + const char *path; + char value[NAME_SIZE]; + struct sysfs_attr *attr_loop; + struct sysfs_attr *attr; + int fd; + ssize_t size; + size_t sysfs_len; + + sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); + path = &path_full[sysfs_len]; + strlcat(path_full, devpath, sizeof(path_full)); + strlcat(path_full, "/", sizeof(path_full)); + strlcat(path_full, attr_name, sizeof(path_full)); + + /* look for attribute in cache */ + list_for_each_entry(attr_loop, &attr_list, node) { + if (strcmp(attr_loop->path, path) == 0) { + dbg("found in cache '%s'", attr_loop->path); + return attr_loop->value; + } + } + + /* read attribute value */ + fd = open(path_full, O_RDONLY); + if (fd < 0) + return NULL; + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + return NULL; + if (size == sizeof(value)) + return NULL; + value[size] = '\0'; + remove_trailing_chars(value, '\n'); + + /* store attribute in cache */ + attr = malloc(sizeof(struct sysfs_attr)); + if (attr == NULL) + return NULL; + strlcpy(attr->path, path, sizeof(attr->path)); + strlcpy(attr->value, value, sizeof(attr->value)); + dbg("add to cache '%s' '%s'", attr->path, attr->value); + list_add(&attr->node, &attr_list); + + return attr->value; +} diff --git a/udev_utils.c b/udev_utils.c index 581ba9e80a..a37c4dfe74 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -30,11 +30,7 @@ #include #include -#include "udev_libc_wrapper.h" #include "udev.h" -#include "logging.h" -#include "udev_utils.h" -#include "list.h" int log_priority(const char *priority) diff --git a/udev_utils.h b/udev_utils.h deleted file mode 100644 index a28ba005ca..0000000000 --- a/udev_utils.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * udev_utils.c - generic stuff used by udev - * - * Copyright (C) 2004-2005 Kay Sievers - * - * 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 02139, USA. - * - */ - -#ifndef _UDEV_COMMON_H_ -#define _UDEV_COMMON_H_ - -#include "udev.h" -#include "list.h" - -#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) - -/* pipes */ -#define READ_END 0 -#define WRITE_END 1 - -struct name_entry { - struct list_head node; - char name[PATH_SIZE]; -}; - -/* udev_utils.c */ -extern int log_priority(const char *priority); -extern int name_list_add(struct list_head *name_list, const char *name, int sort); -extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); -extern void name_list_cleanup(struct list_head *name_list); -extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); - -/* udev_utils_string.c */ -extern int strcmp_pattern(const char *p, const char *s); -extern int string_is_true(const char *str); -extern void remove_trailing_chars(char *path, char c); -extern int utf8_encoded_valid_unichar(const char *str); -extern int replace_untrusted_chars(char *str); - -/* udev_utils_file.c */ -extern int create_path(const char *path); -extern int delete_path(const char *path); -extern int file_map(const char *filename, char **buf, size_t *bufsize); -extern void file_unmap(void *buf, size_t bufsize); -extern int unlink_secure(const char *filename); -extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); - -/* udev_utils_run.c */ -extern int pass_env_to_socket(const char *name, const char *devpath, const char *action); -extern int run_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen, int log); - -#endif diff --git a/udev_utils_file.c b/udev_utils_file.c index cd9c244f0f..acaffdc918 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -30,11 +30,7 @@ #include #include -#include "udev_libc_wrapper.h" #include "udev.h" -#include "logging.h" -#include "udev_utils.h" -#include "list.h" int create_path(const char *path) { diff --git a/udev_utils_run.c b/udev_utils_run.c index e1e775ebe6..b6020b0ab6 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -31,11 +31,7 @@ #include #include -#include "udev_libc_wrapper.h" #include "udev.h" -#include "logging.h" -#include "udev_utils.h" -#include "list.h" int pass_env_to_socket(const char *sockname, const char *devpath, const char *action) diff --git a/udev_utils_string.c b/udev_utils_string.c index 37db8dbc85..36ef8bef7e 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -30,11 +30,7 @@ #include #include -#include "udev_libc_wrapper.h" #include "udev.h" -#include "logging.h" -#include "udev_utils.h" -#include "list.h" /* compare string with pattern (like fnmatch(), supports * ? [0-9] [!A-Z]) */ int strcmp_pattern(const char *p, const char *s) diff --git a/udevcontrol.c b/udevcontrol.c index bd6563531d..6d91adc1c4 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -32,10 +32,7 @@ #include #include "udev.h" -#include "udev_version.h" #include "udevd.h" -#include "udev_utils.h" -#include "logging.h" /* global variables */ static int sock = -1; diff --git a/udevd.c b/udevd.c index ff61c656c8..f64a4252bb 100644 --- a/udevd.c +++ b/udevd.c @@ -42,16 +42,11 @@ #include #include -#include "list.h" -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_version.h" #include "udev_rules.h" -#include "udev_utils.h" #include "udevd.h" -#include "logging.h" -struct udev_rules rules; +static struct udev_rules rules; static int udevd_sock; static int uevent_netlink_sock; static int inotify_fd; @@ -94,8 +89,7 @@ static void asmlinkage udev_event_sig_handler(int signum) static int udev_event_process(struct uevent_msg *msg) { struct sigaction act; - struct udevice udev; - struct name_entry *name_loop; + struct udevice *udev; int i; int retval; @@ -109,27 +103,34 @@ static int udev_event_process(struct uevent_msg *msg) /* trigger timeout to prevent hanging processes */ alarm(UDEV_ALARM_TIMEOUT); - /* reconstruct env from message */ + /* reconstruct event environment from message */ for (i = 0; msg->envp[i]; i++) putenv(msg->envp[i]); - udev_init_device(&udev, msg->devpath, msg->subsystem, msg->action); - retval = udev_process_event(&rules, &udev); + udev = udev_device_init(); + if (udev == NULL) + return -1; + strlcpy(udev->action, msg->action, sizeof(udev->action)); + sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem); + udev->devt = msg->devt; + + retval = udev_device_event(&rules, udev); /* run programs collected by RUN-key*/ - if (!retval) { - list_for_each_entry(name_loop, &udev.run_list, node) { + if (retval == 0) { + struct name_entry *name_loop; + + list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], msg->devpath, msg->action); else - if (run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, + if (run_program(name_loop->name, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO))) retval = -1; } } - udev_cleanup_device(&udev); - + udev_device_cleanup(udev); return retval; } @@ -819,7 +820,7 @@ int main(int argc, char *argv[], char *envp[]) if (fd < 0) err("fatal, could not open /dev/null: %s", strerror(errno)); - udev_init_config(); + udev_config_init(); dbg("version %s", UDEV_VERSION); if (getuid() != 0) { @@ -859,6 +860,7 @@ int main(int argc, char *argv[], char *envp[]) } /* parse the rules and keep it in memory */ + sysfs_init(); udev_rules_init(&rules, 1); if (daemonize) { @@ -1020,7 +1022,7 @@ int main(int argc, char *argv[], char *envp[]) /* rules changed, set by inotify or a signal*/ if (reload_config) { reload_config = 0; - udev_rules_close(&rules); + udev_rules_cleanup(&rules); udev_rules_init(&rules, 1); } @@ -1038,7 +1040,8 @@ int main(int argc, char *argv[], char *envp[]) } exit: - udev_rules_close(&rules); + udev_rules_cleanup(&rules); + sysfs_cleanup(); if (signal_pipe[READ_END] > 0) close(signal_pipe[READ_END]); diff --git a/udevd.h b/udevd.h index afbc3a31b1..c0a32e97ed 100644 --- a/udevd.h +++ b/udevd.h @@ -32,7 +32,7 @@ #define EVENT_QUEUE_DIR ".udev/queue" #define EVENT_FAILED_DIR ".udev/failed" -/* maximum limit of runnig childs */ +/* maximum limit of forked childs */ #define UDEVD_MAX_CHILDS 64 /* start to throttle forking if maximum number of running childs in our session is reached */ #define UDEVD_MAX_CHILDS_RUNNING 16 diff --git a/udevinfo.c b/udevinfo.c index 8ff09da3d1..f8d0b6125a 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -21,17 +21,14 @@ #include #include #include +#include #include #include #include +#include #include -#include "libsysfs/sysfs/libsysfs.h" -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_utils.h" -#include "udev_version.h" -#include "logging.h" #ifdef USE_LOG @@ -48,125 +45,98 @@ void log_message (int priority, const char *format, ...) } #endif -static void print_all_attributes(struct dlist *attr_list) +static void print_all_attributes(const char *devpath) { - struct sysfs_attribute *attr; - char value[VALUE_SIZE]; - size_t len; - - dlist_for_each_data(attr_list, attr, struct sysfs_attribute) { - if (attr->value == NULL) - continue; - len = strlcpy(value, attr->value, sizeof(value)); - if (len >= sizeof(value)) { - dbg("attribute value of '%s' too long, skip", attr->name); - continue; - } + char path[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + + dir = opendir(path); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char *attr_value; + char value[NAME_SIZE]; + size_t len; + + attr_value = sysfs_attr_get_value(devpath, dent->d_name); + if (attr_value == NULL) + continue; + len = strlcpy(value, attr_value, sizeof(value)); + dbg("attr '%s'='%s'(%zi)", dent->d_name, value, len); + + /* remove trailing newlines */ + while (len && value[len-1] == '\n') + value[--len] = '\0'; + + /* skip nonprintable attributes */ + while (len && isprint(value[len-1])) + len--; + if (len) { + dbg("attribute value of '%s' non-printable, skip", dent->d_name); + continue; + } - /* remove trailing newlines */ - while (len && value[len-1] == '\n') - value[--len] = '\0'; - /* skip nonprintable attributes */ - while (len && isprint(value[len-1])) - len--; - if (len) { - dbg("attribute value of '%s' non-printable, skip", attr->name); - continue; + replace_untrusted_chars(value); + printf(" SYSFS{%s}==\"%s\"\n", dent->d_name, value); } - replace_untrusted_chars(value); - printf(" SYSFS{%s}==\"%s\"\n", attr->name, value); } printf("\n"); } -static void print_record(struct udevice *udev) +static int print_device_chain(const char *devpath) { - struct name_entry *name_loop; + struct sysfs_device *dev; - printf("P: %s\n", udev->devpath); - printf("N: %s\n", udev->name); - list_for_each_entry(name_loop, &udev->symlink_list, node) - printf("S: %s\n", name_loop->name); - list_for_each_entry(name_loop, &udev->env_list, node) - printf("E: %s\n", name_loop->name); -} - -static int print_device_chain(const char *path) -{ - struct sysfs_class_device *class_dev; - struct sysfs_class_device *class_dev_parent; - struct sysfs_attribute *attr; - struct sysfs_device *sysfs_dev; - struct dlist *attr_list; - int retval = 0; - - /* get the class dev */ - class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) { - fprintf(stderr, "couldn't get the class device\n"); - return -1; - } - - printf("\nudevinfo starts with the device the node belongs to and then walks up the\n" + printf("\n" + "udevinfo starts with the device the node belongs to and then walks up the\n" "device chain, to print for every device found, all possibly useful attributes\n" "in the udev key format.\n" "Only attributes within one device section may be used together in one rule,\n" "to match the device for which the node will be created.\n" "\n"); - /* look for the 'dev' file */ - attr = sysfs_get_classdev_attr(class_dev, "dev"); - if (attr != NULL) - printf("device '%s' has major:minor %s", class_dev->path, attr->value); - - /* open sysfs class device directory and print all attributes */ - printf(" looking at class device '%s':\n", class_dev->path); - printf(" KERNEL==\"%s\"\n", class_dev->name); - printf(" SUBSYSTEM==\"%s\"\n", class_dev->classname); + dev = sysfs_device_get(devpath); + if (dev == NULL) + return -1; - attr_list = sysfs_get_classdev_attributes(class_dev); - if (attr_list == NULL) { - fprintf(stderr, "couldn't open class device directory\n"); - retval = -1; - goto exit; - } - print_all_attributes(attr_list); - - /* get the device link (if parent exists look here) */ - class_dev_parent = sysfs_get_classdev_parent(class_dev); - if (class_dev_parent != NULL) - sysfs_dev = sysfs_get_classdev_device(class_dev_parent); - else - sysfs_dev = sysfs_get_classdev_device(class_dev); - - if (sysfs_dev != NULL) - printf("follow the \"device\"-link to the physical device:\n"); - - /* look the device chain upwards */ - while (sysfs_dev != NULL) { - printf(" looking at the device chain at '%s':\n", sysfs_dev->path); - printf(" BUS==\"%s\"\n", sysfs_dev->bus); - printf(" ID==\"%s\"\n", sysfs_dev->bus_id); - printf(" DRIVER==\"%s\"\n", sysfs_dev->driver_name); - - attr_list = sysfs_get_device_attributes(sysfs_dev); - if (attr_list != NULL) - print_all_attributes(attr_list); - else - printf("\n"); + printf(" looking at device '%s':\n", dev->devpath); + printf(" KERNEL==\"%s\"\n", dev->kernel_name); + printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); + print_all_attributes(dev->devpath); - sysfs_dev = sysfs_get_device_parent(sysfs_dev); - if (sysfs_dev == NULL) + /* walk up the chain of devices */ + while (1) { + dev = sysfs_device_get_parent(dev); + if (dev == NULL) break; + printf(" looking at device '%s':\n", dev->devpath); + printf(" ID==\"%s\"\n", dev->kernel_name); + printf(" BUS==\"%s\"\n", dev->subsystem); + printf(" DRIVER==\"%s\"\n", dev->driver); + + print_all_attributes(dev->devpath); } -exit: - sysfs_close_class_device(class_dev); - return retval; + return 0; +} + +static void print_record(struct udevice *udev) +{ + struct name_entry *name_loop; + + printf("P: %s\n", udev->dev->devpath); + printf("N: %s\n", udev->name); + list_for_each_entry(name_loop, &udev->symlink_list, node) + printf("S: %s\n", name_loop->name); + list_for_each_entry(name_loop, &udev->env_list, node) + printf("E: %s\n", name_loop->name); } static void export_name_devpath(struct udevice *udev) { - printf("%s=%s/%s\n", udev->devpath, udev_root, udev->name); + printf("%s=%s/%s\n", udev->dev->devpath, udev_root, udev->name); } static void export_record(struct udevice *udev) { @@ -180,12 +150,14 @@ static void export_db(void fnct(struct udevice *udev)) { udev_db_get_all_entries(&name_list); list_for_each_entry(name_loop, &name_list, node) { - struct udevice udev_db; + struct udevice *udev_db; - udev_init_device(&udev_db, NULL, NULL, NULL); - if (udev_db_get_device(&udev_db, name_loop->name) == 0) - fnct(&udev_db); - udev_cleanup_device(&udev_db); + udev_db = udev_device_init(); + if (udev_db == NULL) + continue; + if (udev_db_get_device(udev_db, name_loop->name) == 0) + fnct(udev_db); + udev_device_cleanup(udev_db); } name_list_cleanup(&name_list); } @@ -215,7 +187,7 @@ int main(int argc, char *argv[], char *envp[]) { static const char short_options[] = "aden:p:q:rVh"; int option; - struct udevice udev; + struct udevice *udev; int root = 0; enum action_type { @@ -239,12 +211,18 @@ int main(int argc, char *argv[], char *envp[]) char temp[PATH_SIZE]; struct name_entry *name_loop; char *pos; - int retval = 0; + int rc = 0; logging_init("udevinfo"); - udev_init_config(); - udev_init_device(&udev, NULL, NULL, NULL); + udev_config_init(); + sysfs_init(); + + udev = udev_device_init(); + if (udev == NULL) { + rc = 1; + goto exit; + } /* get command line options */ while (1) { @@ -260,7 +238,11 @@ int main(int argc, char *argv[], char *envp[]) break; case 'p': dbg("udev path: %s\n", optarg); - strlcpy(path, optarg, sizeof(path)); + /* remove sysfs mountpoint if not given */ + if (strncmp(optarg, sysfs_path, strlen(sysfs_path)) == 0) + strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path)); + else + strlcpy(path, optarg, sizeof(path)); break; case 'q': dbg("udev query: %s\n", optarg); @@ -286,7 +268,7 @@ int main(int argc, char *argv[], char *envp[]) break; } fprintf(stderr, "unknown query type\n"); - retval = 2; + rc = 2; goto exit; case 'r': if (action == ACTION_NONE) @@ -331,10 +313,9 @@ int main(int argc, char *argv[], char *envp[]) pos = path; } } - retval = udev_db_get_device(&udev, pos); - if (retval != 0) { + if (udev_db_get_device(udev, pos) != 0) { fprintf(stderr, "no record for '%s' in database\n", pos); - retval = 3; + rc = 3; goto exit; } } else if (name[0] != '\0') { @@ -348,46 +329,45 @@ int main(int argc, char *argv[], char *envp[]) } else pos = name; - retval = udev_db_lookup_name(pos, devpath, sizeof(devpath)); - if (retval != 0) { + if (udev_db_lookup_name(pos, devpath, sizeof(devpath)) != 0) { fprintf(stderr, "no record for '%s' in database\n", pos); - retval = 3; + rc = 3; goto exit; } - udev_db_get_device(&udev, devpath); + udev_db_get_device(udev, devpath); } else { fprintf(stderr, "query needs device path(-p) or node name(-n) specified\n"); - retval = 4; + rc = 4; goto exit; } switch(query) { case QUERY_NAME: if (root) - printf("%s/%s\n", udev_root, udev.name); + printf("%s/%s\n", udev_root, udev->name); else - printf("%s\n", udev.name); + printf("%s\n", udev->name); break; case QUERY_SYMLINK: - if (list_empty(&udev.symlink_list)) + if (list_empty(&udev->symlink_list)) goto exit; if (root) - list_for_each_entry(name_loop, &udev.symlink_list, node) + list_for_each_entry(name_loop, &udev->symlink_list, node) printf("%s/%s ", udev_root, name_loop->name); else - list_for_each_entry(name_loop, &udev.symlink_list, node) + list_for_each_entry(name_loop, &udev->symlink_list, node) printf("%s ", name_loop->name); printf("\n"); break; case QUERY_PATH: - printf("%s\n", udev.devpath); + printf("%s\n", udev->dev->devpath); goto exit; case QUERY_ENV: - list_for_each_entry(name_loop, &udev.env_list, node) + list_for_each_entry(name_loop, &udev->env_list, node) printf("%s\n", name_loop->name); break; case QUERY_ALL: - print_record(&udev); + print_record(udev); break; default: print_help(); @@ -397,29 +377,23 @@ int main(int argc, char *argv[], char *envp[]) case ACTION_ATTRIBUTE_WALK: if (path[0] == '\0') { fprintf(stderr, "attribute walk on device chain needs path(-p) specified\n"); - retval = 4; + rc = 4; goto exit; - } else { - if (strncmp(path, sysfs_path, strlen(sysfs_path)) != 0) { - /* prepend sysfs mountpoint if not given */ - snprintf(temp, sizeof(temp), "%s%s", sysfs_path, path); - temp[sizeof(temp)-1] = '\0'; - strlcpy(path, temp, sizeof(temp)); - } + } else print_device_chain(path); - } break; case ACTION_ROOT: printf("%s\n", udev_root); break; default: print_help(); - retval = 1; + rc = 1; break; } exit: - udev_cleanup_device(&udev); + udev_device_cleanup(udev); + sysfs_cleanup(); logging_close(); - return retval; + return rc; } diff --git a/udevmonitor.c b/udevmonitor.c index 7d3f0aa538..80c49753f5 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -34,8 +34,6 @@ #include "udev.h" #include "udevd.h" -#include "udev_utils.h" -#include "udev_libc_wrapper.h" static int uevent_netlink_sock; static int udev_monitor_sock; diff --git a/udevsend.c b/udevsend.c index b67df9720b..1b9860baca 100644 --- a/udevsend.c +++ b/udevsend.c @@ -33,9 +33,7 @@ #include #include "udev.h" -#include "udev_version.h" #include "udevd.h" -#include "logging.h" /* global variables */ static int sock = -1; @@ -67,7 +65,7 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevsend"); #ifdef USE_LOG - udev_init_config(); + udev_config_init(); #endif dbg("version %s", UDEV_VERSION); diff --git a/udevstart.c b/udevstart.c index a9959c5d6b..8c414f1acb 100644 --- a/udevstart.c +++ b/udevstart.c @@ -38,14 +38,8 @@ #include #include -#include "libsysfs/sysfs/libsysfs.h" -#include "udev_libc_wrapper.h" #include "udev.h" -#include "udev_version.h" -#include "logging.h" -#include "udev_utils.h" #include "udev_rules.h" -#include "list.h" static const char *udev_run_str; static const char *udev_log_str; @@ -68,11 +62,10 @@ void log_message(int priority, const char *format, ...) struct device { struct list_head node; char path[PATH_SIZE]; - char subsys[NAME_SIZE]; }; /* sort files in lexical order */ -static int device_list_insert(const char *path, char *subsystem, struct list_head *device_list) +static int device_list_insert(const char *path, struct list_head *device_list) { struct device *loop_device; struct device *new_device; @@ -93,9 +86,8 @@ static int device_list_insert(const char *path, char *subsystem, struct list_hea } strlcpy(new_device->path, devpath, sizeof(new_device->path)); - strlcpy(new_device->subsys, subsystem, sizeof(new_device->subsys)); list_add_tail(&new_device->node, &loop_device->node); - dbg("add '%s' from subsys '%s'", new_device->path, new_device->subsys); + dbg("add '%s'" , new_device->path); return 0; } @@ -112,64 +104,68 @@ static char *first_list[] = { NULL, }; -static int add_device(const char *devpath, const char *subsystem) +static int add_device(const char *devpath) { - struct udevice udev; - struct sysfs_class_device *class_dev; - char path[PATH_SIZE]; + struct sysfs_device *dev; + struct udevice *udev; /* clear and set environment for next event */ clearenv(); setenv("ACTION", "add", 1); - setenv("DEVPATH", devpath, 1); - setenv("SUBSYSTEM", subsystem, 1); setenv("UDEV_START", "1", 1); if (udev_log_str) setenv("UDEV_LOG", udev_log_str, 1); if (udev_run_str) setenv("UDEV_RUN", udev_run_str, 1); - dbg("add '%s'", devpath); - snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath); - path[sizeof(path)-1] = '\0'; - class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) { - dbg("sysfs_open_class_device_path failed"); + dev = sysfs_device_get(devpath); + if (dev == NULL) return -1; - } - udev_init_device(&udev, &class_dev->path[strlen(sysfs_path)], subsystem, "add"); - udev.devt = get_devt(class_dev); - if (!udev.devt && udev.type != DEV_NET) { - dbg("sysfs_open_class_device_path failed"); + udev = udev_device_init(); + if (udev == NULL) return -1; + + /* override built-in sysfs device */ + udev->dev = dev; + strcpy(udev->action, "add"); + udev->devt = udev_device_get_devt(udev); + + if (strcmp(udev->dev->subsystem, "net") != 0) { + udev->devt = udev_device_get_devt(udev); + if (major(udev->devt) == 0) + return -1; } - udev_rules_get_name(&rules, &udev, class_dev); - if (udev.ignore_device) { + + dbg("add '%s'", udev->dev->devpath); + setenv("DEVPATH", udev->dev->devpath, 1); + setenv("SUBSYSTEM", udev->dev->subsystem, 1); + + udev_rules_get_name(&rules, udev); + if (udev->ignore_device) { dbg("device event will be ignored"); goto exit; } - if (udev.name[0] == '\0') { + if (udev->name[0] == '\0') { dbg("device node creation supressed"); goto run; } - udev_add_device(&udev, class_dev); + udev_add_device(udev); run: - if (udev_run && !list_empty(&udev.run_list)) { + if (udev_run && !list_empty(&udev->run_list)) { struct name_entry *name_loop; dbg("executing run list"); - list_for_each_entry(name_loop, &udev.run_list, node) { + list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) - pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, "add"); + pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, "add"); else - run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + run_program(name_loop->name, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); } } exit: - sysfs_close_class_device(class_dev); - udev_cleanup_device(&udev); + udev_device_cleanup(udev); return 0; } @@ -184,7 +180,7 @@ static void exec_list(struct list_head *device_list) list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { for (i = 0; first_list[i] != NULL; i++) { if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { - add_device(loop_device->path, loop_device->subsys); + add_device(loop_device->path); list_del(&loop_device->node); free(loop_device); break; @@ -204,14 +200,14 @@ static void exec_list(struct list_head *device_list) if (found) continue; - add_device(loop_device->path, loop_device->subsys); + add_device(loop_device->path); list_del(&loop_device->node); free(loop_device); } /* handle the rest of the devices left over, if any */ list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { - add_device(loop_device->path, loop_device->subsys); + add_device(loop_device->path); list_del(&loop_device->node); free(loop_device); } @@ -253,7 +249,7 @@ static void udev_scan_block(struct list_head *device_list) snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); dirname[sizeof(dirname)-1] = '\0'; if (has_devt(dirname)) - device_list_insert(dirname, "block", device_list); + device_list_insert(dirname, device_list); else continue; @@ -270,7 +266,7 @@ static void udev_scan_block(struct list_head *device_list) dirname2[sizeof(dirname2)-1] = '\0'; if (has_devt(dirname2)) - device_list_insert(dirname2, "block", device_list); + device_list_insert(dirname2, device_list); } closedir(dir2); } @@ -313,7 +309,7 @@ static void udev_scan_class(struct list_head *device_list) dirname2[sizeof(dirname2)-1] = '\0'; if (has_devt(dirname2) || strcmp(dent->d_name, "net") == 0) - device_list_insert(dirname2, dent->d_name, device_list); + device_list_insert(dirname2, device_list); } closedir(dir2); } @@ -339,7 +335,7 @@ int main(int argc, char *argv[], char *envp[]) struct sigaction act; logging_init("udevstart"); - udev_init_config(); + udev_config_init(); dbg("version %s", UDEV_VERSION); udev_run_str = getenv("UDEV_RUN"); @@ -361,13 +357,15 @@ int main(int argc, char *argv[], char *envp[]) /* trigger timeout to prevent hanging processes */ alarm(UDEV_ALARM_TIMEOUT); + sysfs_init(); udev_rules_init(&rules, 1); udev_scan_class(&device_list); udev_scan_block(&device_list); exec_list(&device_list); - udev_rules_close(&rules); + udev_rules_cleanup(&rules); + sysfs_cleanup(); logging_close(); return 0; } diff --git a/udevtest.8 b/udevtest.8 index e547811a8b..ea0ea59238 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -10,8 +10,8 @@ .SH "NAME" udevtest \- simulate a udev run and print the action to the console .SH "SYNOPSIS" -.HP 31 -\fBudevtest \fR\fB\fIdevice\-path\fR\fR\fB \fR\fB\fIsubsystem\fR\fR +.HP 21 +\fBudevtest \fR\fB\fIdevice\-path\fR\fR .SH "DESCRIPTION" .PP udevtest simulates a udev run for the given device and prints out the name of the node udev would have created, or the name of the network interface, that would have been renamend. diff --git a/udevtest.c b/udevtest.c index 1be3fa9515..22fd3735c2 100644 --- a/udevtest.c +++ b/udevtest.c @@ -21,17 +21,15 @@ #include #include #include +#include +#include #include #include #include #include -#include "libsysfs/sysfs/libsysfs.h" #include "udev.h" -#include "udev_utils.h" -#include "udev_version.h" #include "udev_rules.h" -#include "logging.h" #ifdef USE_LOG @@ -53,28 +51,28 @@ void log_message (int priority, const char *format, ...) int main(int argc, char *argv[], char *envp[]) { struct udev_rules rules; - struct sysfs_class_device *class_dev; char *devpath; - char path[PATH_SIZE]; char temp[PATH_SIZE]; - struct udevice udev; - char *subsystem = NULL; + struct udevice *udev; + struct sysfs_device *dev; + int retval; + int rc = 0; info("version %s", UDEV_VERSION); /* initialize our configuration */ - udev_init_config(); + udev_config_init(); if (udev_log_priority < LOG_INFO) udev_log_priority = LOG_INFO; - if (argc != 3) { - info("Usage: udevtest "); + if (argc != 2) { + info("Usage: udevtest "); return 1; } /* remove sysfs_path if given */ if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) - devpath = &argv[1][strlen(sysfs_path)] ; + devpath = &argv[1][strlen(sysfs_path)]; else if (argv[1][0] != '/') { /* prepend '/' if missing */ @@ -84,39 +82,46 @@ int main(int argc, char *argv[], char *envp[]) } else devpath = argv[1]; - subsystem = argv[2]; - setenv("DEVPATH", devpath, 1); - setenv("SUBSYSTEM", subsystem, 1); - setenv("ACTION", "add", 1); - info("looking at device '%s' from subsystem '%s'", devpath, subsystem); - - /* initialize the naming deamon */ + sysfs_init(); udev_rules_init(&rules, 0); - /* fill in values and test_run flag*/ - udev_init_device(&udev, devpath, subsystem, "add"); + dev = sysfs_device_get(devpath); + if (dev == NULL) { + info("unable to open '%s'", devpath); + rc = 2; + goto exit; + } - /* open the device */ - snprintf(path, sizeof(path), "%s%s", sysfs_path, udev.devpath); - path[sizeof(path)-1] = '\0'; - class_dev = sysfs_open_class_device_path(path); - if (class_dev == NULL) { - info("sysfs_open_class_device_path failed"); - return 1; + udev = udev_device_init(); + if (udev == NULL) { + info("can't open device"); + rc = 3; + goto exit; } - info("opened class_dev->name='%s'", class_dev->name); - if (udev.type == DEV_BLOCK || udev.type == DEV_CLASS) - udev.devt = get_devt(class_dev); + /* override built-in sysfs device */ + udev->dev = dev; + strcpy(udev->action, "add"); + udev->devt = udev_device_get_devt(udev); /* simulate node creation with test flag */ - udev.test_run = 1; - if (udev.type == DEV_NET || udev.devt) { - udev_rules_get_name(&rules, &udev, class_dev); - udev_add_device(&udev, class_dev); - } else - info("only char and block devices with a dev-file are supported by this test program"); - sysfs_close_class_device(class_dev); - - return 0; + udev->test_run = 1; + + setenv("DEVPATH", udev->dev->devpath, 1); + setenv("SUBSYSTEM", udev->dev->subsystem, 1); + setenv("ACTION", "add", 1); + + info("looking at device '%s' from subsystem '%s'", udev->dev->devpath, udev->dev->subsystem); + retval = udev_device_event(&rules, udev); + if (retval == 0) { + struct name_entry *name_loop; + + list_for_each_entry(name_loop, &udev->run_list, node) + info("run: '%s'", name_loop->name); + } + +exit: + udev_rules_cleanup(&rules); + sysfs_cleanup(); + return rc; } -- cgit v1.2.3-54-g00ecf From 8531b0b9649b504c660d6fecc78d1be919153f2d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 9 Jan 2006 21:30:04 +0100 Subject: 080 release --- ChangeLog | 22 ++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index cba96f91a6..25e23de593 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Summary of changes from v079 to v080 +============================================ + +Brent Cook: + fix dependency for make -j2 + +coly: + fix man page typos + +Kay Sievers: + update RELEASE-NOTES + TODO + fix typo in man page + update TODO + update SUSE rules + path_id: fix invalid character class + replace libsysfs + +Marco d'Itri: + udev_selinux.c: include udev.h + + Summary of changes from v078 to v079 ============================================ @@ -8,6 +29,7 @@ Kay Sievers: update SUSE rules remove %e from man page + Summary of changes from v077 to v078 ============================================ diff --git a/Makefile b/Makefile index 461f5ac012..5c44571aab 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 079 +VERSION = 080 # set this to make use of syslog USE_LOG = true -- cgit v1.2.3-54-g00ecf From afe9f2fb5fe97281e2e84c12e1451a8e9bab6edb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Jan 2006 13:19:53 +0100 Subject: add DEVLINKS to "remove" event Signed-off-by: Kay Sievers --- udev_remove.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/udev_remove.c b/udev_remove.c index 945618ce5a..6de6cf5962 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -33,7 +33,6 @@ static int delete_node(struct udevice *udev) { char filename[PATH_SIZE]; - char devname[PATH_SIZE]; char partitionname[PATH_SIZE]; struct name_entry *name_loop; struct stat stats; @@ -41,24 +40,35 @@ static int delete_node(struct udevice *udev) int i; int num; - list_for_each_entry(name_loop, &udev->symlink_list, node) { - snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); - filename[sizeof(filename)-1] = '\0'; + if (!list_empty(&udev->symlink_list)) { + char symlinks[512] = ""; - if (stat(filename, &stats) != 0) { - dbg("symlink '%s' not found", filename); - continue; - } - if (udev->devt && stats.st_rdev != udev->devt) { - info("symlink '%s' points to a different device, skip removal", filename); - continue;; - } + list_for_each_entry(name_loop, &udev->symlink_list, node) { + snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); + filename[sizeof(filename)-1] = '\0'; + + if (stat(filename, &stats) != 0) { + dbg("symlink '%s' not found", filename); + continue; + } + if (udev->devt && stats.st_rdev != udev->devt) { + info("symlink '%s' points to a different device, skip removal", filename); + continue; + } - info("removing symlink '%s'", filename); - unlink(filename); + info("removing symlink '%s'", filename); + unlink(filename); + + if (strchr(filename, '/')) + delete_path(filename); + + strlcat(symlinks, filename, sizeof(symlinks)); + strlcat(symlinks, " ", sizeof(symlinks)); + } - if (strchr(filename, '/')) - delete_path(filename); + remove_trailing_chars(symlinks, ' '); + if (symlinks[0] != '\0') + setenv("DEVLINKS", symlinks, 1); } snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); @@ -78,9 +88,7 @@ static int delete_node(struct udevice *udev) if (retval) return retval; - snprintf(devname, sizeof(devname), "%s/%s", udev_root, udev->name); - devname[sizeof(devname)-1] = '\0'; - setenv("DEVNAME", devname, 1); + setenv("DEVNAME", filename, 1); num = udev->partitions; if (num > 0) { -- cgit v1.2.3-54-g00ecf From d548032795b3c02aad606537a35ff63d954f1613 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 13 Jan 2006 13:17:10 +0100 Subject: better log test and comments Signed-off-by: Kay Sievers --- udev.h | 10 ++++++---- udev_config.c | 2 +- udev_rules.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/udev.h b/udev.h index c060b8d6ff..6dc0c9e354 100644 --- a/udev.h +++ b/udev.h @@ -55,7 +55,7 @@ struct udev_rules; struct sysfs_device { struct list_head node; /* for device cache */ char devpath[PATH_SIZE]; - char subsystem[NAME_SIZE]; /* $class/$bus/"drivers */ + char subsystem[NAME_SIZE]; /* $class/$bus/"drivers" */ char kernel_name[NAME_SIZE]; /* device instance name */ char kernel_number[NAME_SIZE]; char driver[NAME_SIZE]; /* device driver name */ @@ -63,7 +63,7 @@ struct sysfs_device { struct udevice { /* device event */ - struct sysfs_device *dev; + struct sysfs_device *dev; /* points to dev_local by default */ struct sysfs_device dev_local; char action[NAME_SIZE]; @@ -114,9 +114,11 @@ extern struct sysfs_device *sysfs_device_get(const char *devpath); extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); -/* udev_add.c / udev_remove.c */ -extern int udev_add_device(struct udevice *udev); +/* udev_add.c */ extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); +extern int udev_add_device(struct udevice *udev); + +/* udev_remove.c */ extern int udev_remove_device(struct udevice *udev); /* udev_db.c */ diff --git a/udev_config.c b/udev_config.c index a7e19fe864..204827407d 100644 --- a/udev_config.c +++ b/udev_config.c @@ -136,7 +136,7 @@ static int parse_config_file(void) linepos = line; retval = get_key(&linepos, &variable, &value); if (retval != 0) { - err("error parsing %s, line %d:%d", udev_config_filename, lineno, (int) (linepos-line)); + err("error parsing %s, line %d:%d", udev_config_filename, lineno, (int)(linepos-line)); continue; } diff --git a/udev_rules.c b/udev_rules.c index 8693b71c08..fc1f3c9c3d 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -352,7 +352,7 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) while (--loop) { if (stat(filename, &stats) == 0) { - info("file appeared after %i loops", (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + info("file '%s' appeared after %i loops", filename, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } info("wait for %i mseconds", 1000 / WAIT_LOOP_PER_SECOND); -- cgit v1.2.3-54-g00ecf From e3440f37f026b1e45d48f27ef1be903542b385f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 13 Jan 2006 13:18:41 +0100 Subject: vol_id: probe volume as user nobody Signed-off-by: Kay Sievers --- extras/volume_id/libvolume_id/mac.c | 7 ++++--- extras/volume_id/libvolume_id/volume_id.h | 2 +- extras/volume_id/vol_id.c | 17 ++++++++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/extras/volume_id/libvolume_id/mac.c b/extras/volume_id/libvolume_id/mac.c index 99bcbde6be..53f0761c8a 100644 --- a/extras/volume_id/libvolume_id/mac.c +++ b/extras/volume_id/libvolume_id/mac.c @@ -84,14 +84,15 @@ int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off) part_count = be32_to_cpu(part->map_count); dbg("expecting %d partition entries", part_count); + if (part_count < 1 || part_count > 256) + return -1; if (id->partitions != NULL) free(id->partitions); - id->partitions = - malloc(part_count * sizeof(struct volume_id_partition)); + id->partitions = malloc(part_count * sizeof(struct volume_id_partition)); if (id->partitions == NULL) return -1; - memset(id->partitions, 0x00, sizeof(struct volume_id_partition)); + memset(id->partitions, 0x00, part_count * sizeof(struct volume_id_partition)); id->partition_count = part_count; diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index ad65fe5438..edeb225faf 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -14,7 +14,7 @@ #include #include -#define VOLUME_ID_VERSION 55 +#define VOLUME_ID_VERSION 56 #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index a291eda51d..6961969c13 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "../../udev.h" @@ -110,6 +111,8 @@ int main(int argc, char *argv[]) int i; uint64_t size; const char *node = NULL; + uid_t nobody_uid; + gid_t nobody_gid; int rc = 0; logging_init("vol_id"); @@ -146,12 +149,24 @@ int main(int argc, char *argv[]) size = 0; dbg("BLKGETSIZE64=%llu", size); + /* drop all privileges */ + nobody_uid = lookup_user("nobody"); + nobody_gid = lookup_group("nogroup"); + if (nobody_uid > 0 && nobody_gid > 0) { + if (setgroups(0, NULL) != 0 || + setgid(nobody_gid) != 0 || + setuid(nobody_uid) != 0) { + rc = 3; + goto exit; + } + } + if (volume_id_probe_all(vid, 0, size) == 0) goto print; if (print != PRINT_EXPORT) fprintf(stderr, "%s: unknown volume type\n", node); - rc = 3; + rc = 4; goto exit; print: -- cgit v1.2.3-54-g00ecf From 03b24b71e05d116c592b08281f8a5f0dadf6d3c7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Jan 2006 06:12:49 +0100 Subject: fix BUS, ID, $id usage Signed-off-by: Kay Sievers --- TODO | 6 ----- docs/udev.xml | 73 ++++++++++++++++++++++++++++++++----------------------- test/udev-test.pl | 71 ++++++++++++++++++++--------------------------------- udev.8 | 66 +++++++++++++++++++++++++++---------------------- udev.h | 39 ++++++++++++++--------------- udev_rules.c | 60 +++++++++++++++++++++++++-------------------- 6 files changed, 160 insertions(+), 155 deletions(-) diff --git a/TODO b/TODO index 19aae9edf0..bdd2e1e1f6 100644 --- a/TODO +++ b/TODO @@ -4,12 +4,6 @@ These things need to be done, or would be nice to have: to syslog, so any error logged from the kernel can be associated with any of the links at that time. - o Fix inconsistency with KERNEL and ID. ID will walk up the device chain - but it matches on "KERNEL names" too. And ID and SYSFS can only match - on the same device in the chain. That's pretty hard to explain and to - understand. Same for SUBSYSTEM and BUS. - - These things are deprecated and scheduled for removal in a future udev version: diff --git a/docs/udev.xml b/docs/udev.xml index 7f6a30df52..ab8174e6a9 100644 --- a/docs/udev.xml +++ b/docs/udev.xml @@ -148,66 +148,68 @@ - Match the kernel action name. + Match the name of the event action. - Match the kernel device name + Match the name of the device. - Match the kernel devpath. + Match the devpath of the device. - Match the kernel subsystem name + Match the subsystem of the device. - Match the type of bus the device is connected to. + Search the devpath upwards for a matching device subsystem name. - Match the kernel driver name. + Search the devpath upwards for a matching device driver name. - Match the device number on the bus. + Search the devpath upwards for a matching device name. - + - Match against the value of an environment key. Depending on - the specified operation, this key is also used as an assignment. + Search the devpath upwards for a device with matching sysfs attribute values. + Up to five keys can be specified per rule. All attributes + must match on the same device. Trailing whitespace in the attribute values is ignored, + if the specified match value does not contain trailing whitespace itself. - + - Match the sysfs attribute value. Up to five values can be specified. - Trailing whitespace is ignored, if the specified match value does not contain - trailing whitespace itself. + Match against the value of an environment variable. Up to five + keys can be specified per rule. This key can also be used to export a variable to + the environment. @@ -290,8 +292,8 @@ - Export the key to the environment. Depending on the specified - operation, this key is also used as a match. + Export a variable to the environment. This key can also be used to match + against an environment variable. @@ -320,7 +322,7 @@ - Import the printed result or the content of a file in environment key + Import the printed result or the value of a file in environment key format into the event environment. will execute an external program and read its output. will inport a text file. If no option is given, udev will determine it from the executable @@ -331,8 +333,8 @@ - Wait for the specified sysfs file of the device to be created. May be used - to fight agains timing issues wth the kernel. + Wait for the specified sysfs file of the device to be created. Can be used + to fight against kernel sysfs timing issues. @@ -355,14 +357,14 @@ printf-like string substitutions: - , + , The kernel name for this device. - , + , The kernel number for this device. For example, 'sda3' has kernel number of '3' @@ -370,42 +372,51 @@ - , + , The devpath of the device. - , + , + + The name of the device matched while searching the devpath upwards for + , and . + + + + + + , - The content of a sysfs attribute. + The value of a sysfs attribute found at the current or a parent device. - , + , The value of an environment variable. - , + , The kernel major number for the device. - + The kernel minor number for the device. - , + , The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected @@ -416,21 +427,21 @@ - , + , The node name of the parent device. - , + , The udev_root value. - , + , The name of a created temporary device node to provide access to the device from a external program before the real node is created. diff --git a/test/udev-test.pl b/test/udev-test.pl index 7ce920092f..555d36e7f2 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -231,7 +231,7 @@ KERNEL=="ttyUSB0", NAME="sub/direct/ory/visor" EOF }, { - desc => "place on bus of scsi partition", + desc => "parent device name match of scsi partition", subsys => "block", devpath => "/block/sda/sda3", exp_name => "first_disk3" , @@ -243,18 +243,18 @@ EOF desc => "test substitution chars", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "Major:8:minor:3:kernelnumber:3" , + exp_name => "Major:8:minor:3:kernelnumber:3:id:0:0:0:0" , rules => < "test substitution chars (with length limit)", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "M8-m3-n3-bsd-sIBM" , + exp_name => "M8-m3-n3-b0:0-sIBM" , rules => < "program result substitution", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "test-3" , + exp_name => "test-0:0:0:0" , rules => < "test substitution by variable name", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "Major:8-minor:3-kernelnumber:3" , + exp_name => "Major:8-minor:3-kernelnumber:3-id:0:0:0:0", rules => < "test substitution by variable name 2", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "Major:8-minor:3-kernelnumber:3-name:sda3" , + exp_name => "Major:8-minor:3-kernelnumber:3-id:0:0:0:0", rules => < "test substitution by variable name 3", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "83sda33" , + exp_name => "830:0:0:03" , rules => < "test substitution by variable name 5", subsys => "block", devpath => "/block/sda/sda3", - exp_name => "833sda3" , + exp_name => "8330:0:0:0" , rules => < "invalid program for device with no bus", + desc => "non matching BUS for device with no parent", subsys => "tty", devpath => "/class/tty/console", - exp_name => "TTY" , + exp_name => "TTY", rules => < "valid program for device with no bus", - subsys => "tty", - devpath => "/class/tty/console", - exp_name => "foo" , - rules => < "invalid label for device with no bus", + desc => "non matching BUS", subsys => "tty", devpath => "/class/tty/console", exp_name => "TTY" , @@ -457,7 +447,7 @@ KERNEL=="console", NAME="TTY" EOF }, { - desc => "valid label for device with no bus", + desc => "SYSFS match", subsys => "tty", devpath => "/class/tty/console", exp_name => "foo" , @@ -470,11 +460,11 @@ EOF desc => "program and bus type match", subsys => "block", devpath => "/block/sda", - exp_name => "scsi-sda" , + exp_name => "scsi-0:0:0:0" , rules => < "symlink2-ttyUSB0", exp_target => "ttyUSB0", rules => < "symlink %k substitution", + desc => "symlink %b substitution", subsys => "block", devpath => "/block/sda", - exp_name => "symlink-sda", + exp_name => "symlink-0:0:0:0", exp_target => "node", rules => <; - close $fd; - $dev =~ m/^(.+):(.+)$/; - $ENV{MAJOR} = $1; - $ENV{MINOR} = $2; - # create temporary rules open CONF, ">$udev_rules" || die "unable to create rules file: $udev_rules"; print CONF $$rules; diff --git a/udev.8 b/udev.8 index 6d2f5e679e..8eb63c2015 100644 --- a/udev.8 +++ b/udev.8 @@ -70,31 +70,35 @@ Assign a value to a key finally; disallow any later changes, which may be used t The following key names can be used to match against device properties: .TP \fBACTION\fR -Match the kernel action name. +Match the name of the event action. .TP \fBKERNEL\fR -Match the kernel device name +Match the name of the device. .TP \fBDEVPATH\fR -Match the kernel devpath. +Match the devpath of the device. .TP \fBSUBSYSTEM\fR -Match the kernel subsystem name +Match the subsystem of the device. .TP \fBBUS\fR -Match the type of bus the device is connected to. +Search the devpath upwards for a matching device subsystem name. .TP \fBDRIVER\fR -Match the kernel driver name. +Search the devpath upwards for a matching device driver name. .TP \fBID\fR -Match the device number on the bus. -.TP -\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -Match against the value of an environment key. Depending on the specified operation, this key is also used as an assignment. +Search the devpath upwards for a matching device name. .TP \fBSYSFS{\fR\fB\fIfilename\fR\fR\fB}\fR -Match the sysfs attribute value. Up to five values can be specified. Trailing whitespace is ignored, if the specified match value does not contain trailing whitespace itself. +Search the devpath upwards for a device with matching sysfs attribute values. Up to five +\fBSYSFS\fR +keys can be specified per rule. All attributes must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. +.TP +\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR +Match against the value of an environment variable. Up to five +\fBENV\fR +keys can be specified per rule. This key can also be used to export a variable to the environment. .TP \fBPROGRAM\fR Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key. @@ -125,7 +129,7 @@ The name of a symlink targeting the node. Every matching rule can add this value The permissions for the device node. Every specified value overwrites the compiled\-in default value. .TP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -Export the key to the environment. Depending on the specified operation, this key is also used as a match. +Export a variable to the environment. This key can also be used to match against an environment variable. .TP \fBRUN\fR Add a program to the list of programs to be executed for a specific device. @@ -137,14 +141,14 @@ Named label where a GOTO can jump to. Jumps to the next LABEL with a matching gname .TP \fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR -Import the printed result or the content of a file in environment key format into the event environment. +Import the printed result or the value of a file in environment key format into the event environment. \fBprogram\fR will execute an external program and read its output. \fBfile\fR will inport a text file. If no option is given, udev will determine it from the executable bit of of the file permissions. .TP \fBWAIT_FOR_SYSFS\fR -Wait for the specified sysfs file of the device to be created. May be used to fight agains timing issues wth the kernel. +Wait for the specified sysfs file of the device to be created. Can be used to fight against kernel sysfs timing issues. .TP \fBOPTIONS\fR \fBlast_rule\fR @@ -165,42 +169,46 @@ and \fBGROUP\fR fields support simple printf\-like string substitutions: .TP -\fB%k\fR, \fB$kernel\fR +\fB$kernel\fR, \fB%k\fR The kernel name for this device. .TP -\fB%b\fR, \fB$id\fR -The kernel bus id for this device. -.TP -\fB%n\fR, \fB$number\fR +\fB$number\fR, \fB%n\fR The kernel number for this device. For example, 'sda3' has kernel number of '3' .TP -\fB%p\fR, \fB$devpath\fR +\fB$devpath\fR, \fB%p\fR The devpath of the device. .TP -\fB%s{\fR\fB\fIfile\fR\fR\fB}\fR, \fB$sysfs{\fR\fB\fIfile\fR\fR\fB}\fR -The content of a sysfs attribute. +\fB$id\fR, \fB%b\fR +The name of the device matched while searching the devpath upwards for +\fBBUS\fR, +\fBID\fR \fBDRIVER\fR +and +\fBSYSFS\fR. +.TP +\fB$sysfs{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR +The value of a sysfs attribute found at the current or a parent device. .TP -\fB%E{\fR\fB\fIkey\fR\fR\fB}\fR, \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR +\fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR The value of an environment variable. .TP -\fB%m\fR, \fB$major\fR +\fB$major\fR, \fB%M\fR The kernel major number for the device. .TP -\fB%M\fR \fB$minor\fR +\fB$minor\fR \fB%m\fR The kernel minor number for the device. .TP -\fB%c\fR, \fB$result\fR +\fB$result\fR, \fB%c\fR The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: \fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: \fB%c{N+}\fR .TP -\fB%P\fR, \fB$parent\fR +\fB$parent\fR, \fB%P\fR The node name of the parent device. .TP -\fB%r\fR, \fB$root\fR +\fB$root\fR, \fB%r\fR The udev_root value. .TP -\fB%N\fR, \fB$tempnode\fR +\fB$tempnode\fR, \fB%N\fR The name of a created temporary device node to provide access to the device from a external program before the real node is created. .TP \fB%%\fR diff --git a/udev.h b/udev.h index 6dc0c9e354..5d54b54432 100644 --- a/udev.h +++ b/udev.h @@ -30,41 +30,42 @@ #include "udev_libc_wrapper.h" #include "udev_version.h" -#define COMMENT_CHARACTER '#' -#define PATH_TO_NAME_CHAR '@' -#define LINE_SIZE 512 -#define NAME_SIZE 128 -#define PATH_SIZE 256 -#define USER_SIZE 32 -#define SEQNUM_SIZE 32 -#define VALUE_SIZE 128 - -#define DEFAULT_PARTITIONS_COUNT 15 -#define UDEV_ALARM_TIMEOUT 180 +#define COMMENT_CHARACTER '#' +#define PATH_TO_NAME_CHAR '@' +#define LINE_SIZE 512 +#define NAME_SIZE 128 +#define PATH_SIZE 256 +#define USER_SIZE 32 +#define SEQNUM_SIZE 32 +#define VALUE_SIZE 128 + +#define DEFAULT_PARTITIONS_COUNT 15 +#define UDEV_ALARM_TIMEOUT 180 #define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) /* pipes */ -#define READ_END 0 -#define WRITE_END 1 +#define READ_END 0 +#define WRITE_END 1 -#define DB_DIR ".udev/db" +#define DB_DIR ".udev/db" struct udev_rules; struct sysfs_device { - struct list_head node; /* for device cache */ + struct list_head node; /* for device cache */ char devpath[PATH_SIZE]; - char subsystem[NAME_SIZE]; /* $class/$bus/"drivers" */ - char kernel_name[NAME_SIZE]; /* device instance name */ + char subsystem[NAME_SIZE]; /* $class/$bus/"drivers" */ + char kernel_name[NAME_SIZE]; /* device instance name */ char kernel_number[NAME_SIZE]; - char driver[NAME_SIZE]; /* device driver name */ + char driver[NAME_SIZE]; /* device driver name */ }; struct udevice { /* device event */ - struct sysfs_device *dev; /* points to dev_local by default */ + struct sysfs_device *dev; /* points to dev_local by default */ struct sysfs_device dev_local; + struct sysfs_device *dev_parent; /* current parent device used for matching */ char action[NAME_SIZE]; /* node */ diff --git a/udev_rules.c b/udev_rules.c index fc1f3c9c3d..e9d8d7560e 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -376,6 +376,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize) SUBST_DEVPATH, SUBST_KERNEL_NUMBER, SUBST_KERNEL_NAME, + SUBST_ID, SUBST_MAJOR, SUBST_MINOR, SUBST_RESULT, @@ -395,6 +396,7 @@ static void apply_format(struct udevice *udev, char *string, size_t maxsize) { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL_NAME }, + { .name = "id", .fmt = 'b', .type = SUBST_ID }, { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, @@ -477,6 +479,12 @@ found: strlcat(string, udev->dev->kernel_number, maxsize); dbg("substitute kernel number '%s'", udev->dev->kernel_number); break; + case SUBST_ID: + if (udev->dev_parent != NULL) { + strlcat(string, udev->dev_parent->kernel_name, maxsize); + dbg("substitute id '%s'", udev->dev_parent->kernel_name); + } + break; case SUBST_MAJOR: sprintf(temp2, "%d", major(udev->devt)); strlcat(string, temp2, maxsize); @@ -681,20 +689,19 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k /* match a single rule against a given device and possibly its parent devices */ static int match_rule(struct udevice *udev, struct udev_rule *rule) { - struct sysfs_device *dev_parent; int i; if (match_key("ACTION", rule, &rule->action, udev->action)) - goto exit; + goto nomatch; if (match_key("KERNEL", rule, &rule->kernel_name, udev->dev->kernel_name)) - goto exit; + goto nomatch; if (match_key("SUBSYSTEM", rule, &rule->subsystem, udev->dev->subsystem)) - goto exit; + goto nomatch; if (match_key("DEVPATH", rule, &rule->devpath, udev->dev->devpath)) - goto exit; + goto nomatch; if (rule->modalias.operation != KEY_OP_UNSET) { const char *value; @@ -702,10 +709,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) value = sysfs_attr_get_value(udev->dev->devpath, "modalias"); if (value == NULL) { dbg("MODALIAS value not found"); - goto exit; + goto nomatch; } if (match_key("MODALIAS", rule, &rule->modalias, value)) - goto exit; + goto nomatch; } for (i = 0; i < rule->env.count; i++) { @@ -721,7 +728,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) value = ""; } if (match_key("ENV", rule, &pair->key, value)) - goto exit; + goto nomatch; } } @@ -741,24 +748,24 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) return -1; } - /* walk up the chain of physical devices and find a match */ - dev_parent = udev->dev; + /* walk up the chain of parent devices and find a match */ + udev->dev_parent = udev->dev; while (1) { /* check for matching driver */ if (rule->driver.operation != KEY_OP_UNSET) { - if (match_key("DRIVER", rule, &rule->driver, dev_parent->driver)) + if (match_key("DRIVER", rule, &rule->driver, udev->dev_parent->driver)) goto try_parent; } - /* check for matching bus value */ + /* check for matching subsystem/bus value */ if (rule->bus.operation != KEY_OP_UNSET) { - if (match_key("BUS", rule, &rule->bus, dev_parent->subsystem)) + if (match_key("BUS", rule, &rule->bus, udev->dev_parent->subsystem)) goto try_parent; } - /* check for matching bus id */ + /* check for matching bus id (device name) */ if (rule->id.operation != KEY_OP_UNSET) { - if (match_key("ID", rule, &rule->id, dev_parent->kernel_name)) + if (match_key("ID", rule, &rule->id, udev->dev_parent->kernel_name)) goto try_parent; } @@ -773,7 +780,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) char val[VALUE_SIZE]; size_t len; - value = sysfs_attr_get_value(dev_parent->devpath, key_name); + value = sysfs_attr_get_value(udev->dev_parent->devpath, key_name); if (value == NULL) goto try_parent; strlcpy(val, value, sizeof(val)); @@ -796,12 +803,13 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) /* found matching device */ break; try_parent: + /* move to parent device */ dbg("try parent sysfs device"); - dev_parent = sysfs_device_get_parent(dev_parent); - if (dev_parent == NULL) - goto exit; - dbg("looking at dev_parent->devpath='%s'", dev_parent->devpath); - dbg("looking at dev_parent->bus_kernel_name='%s'", dev_parent->kernel_name); + udev->dev_parent = sysfs_device_get_parent(udev->dev_parent); + if (udev->dev_parent == NULL) + goto nomatch; + dbg("looking at dev_parent->devpath='%s'", udev->dev_parent->devpath); + dbg("looking at dev_parent->bus_kernel_name='%s'", udev->dev_parent->kernel_name); } /* execute external program */ @@ -815,7 +823,7 @@ try_parent: dbg("PROGRAM is false"); udev->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) - goto exit; + goto nomatch; } else { int count; @@ -828,14 +836,14 @@ try_parent: strlcpy(udev->program_result, result, sizeof(udev->program_result)); dbg("PROGRAM returned successful"); if (rule->program.operation == KEY_OP_NOMATCH) - goto exit; + goto nomatch; } dbg("PROGRAM key is true"); } /* check for matching result of external program */ if (match_key("RESULT", rule, &rule->result, udev->program_result)) - goto exit; + goto nomatch; /* import variables returned from program or or file into environment */ if (rule->import.operation != KEY_OP_UNSET) { @@ -857,7 +865,7 @@ try_parent: if (rc != 0) { dbg("IMPORT failed"); if (rule->import.operation != KEY_OP_NOMATCH) - goto exit; + goto nomatch; } else dbg("IMPORT '%s' imported", key_val(rule, &rule->import)); dbg("IMPORT key is true"); @@ -879,7 +887,7 @@ try_parent: return 0; -exit: +nomatch: return -1; } -- cgit v1.2.3-54-g00ecf From ea48d4d7fb856184b5caadf5436a48afe5ad113c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Jan 2006 06:14:26 +0100 Subject: prepare moving of /sys/class devices to /sys/devices Signed-off-by: Kay Sievers --- udev_sysfs.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index 19fd614e63..9838379803 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -128,7 +128,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strlcpy(path, sysfs_path, sizeof(path)); strlcat(path, devpath_real, sizeof(path)); if (lstat(path, &statbuf) != 0) { - dbg("stat '%s' failed: %s", devpath, strerror(errno)); + dbg("stat '%s' failed: %s", path, strerror(errno)); return NULL; } @@ -182,10 +182,10 @@ struct sysfs_device *sysfs_device_get(const char *devpath) pos[0] = '\0'; else dev->subsystem[0] = '\0'; - } else if (strncmp(devpath, "/block/", 7) == 0) { + } else if (strncmp(dev->devpath, "/block/", 7) == 0) { strlcpy(dev->subsystem, "block", sizeof(dev->subsystem)); - } else if (strncmp(devpath, "/devices/", 9) == 0) { - /* get subsystem from bus name */ + } else if (strncmp(dev->devpath, "/devices/", 9) == 0) { + /* get subsystem from "bus" link */ strlcpy(link_path, sysfs_path, sizeof(link_path)); strlcat(link_path, dev->devpath, sizeof(link_path)); strlcat(link_path, "/bus", sizeof(link_path)); @@ -196,8 +196,20 @@ struct sysfs_device *sysfs_device_get(const char *devpath) pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); + } else { + /* get subsystem from "subsystem" link */ + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, dev->devpath, sizeof(link_path)); + strlcat(link_path, "/subsystem", sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len > 0) { + link_target[len] = '\0'; + dbg("subsystem link '%s' points to '%s'", link_path, link_target); + pos = strrchr(link_target, '/'); + if (pos != NULL) + strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); + } } - /* get driver name */ strlcpy(link_path, sysfs_path, sizeof(link_path)); strlcat(link_path, dev->devpath, sizeof(link_path)); @@ -210,9 +222,9 @@ struct sysfs_device *sysfs_device_get(const char *devpath) if (pos != NULL) strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); } - } else if (strncmp(devpath, "/bus/", 5) == 0 && strstr(devpath, "/drivers/")) { + } else if (strncmp(dev->devpath, "/bus/", 5) == 0 && strstr(dev->devpath, "/drivers/")) { strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); - } else if (strncmp(devpath, "/module/", 8) == 0) { + } else if (strncmp(dev->devpath, "/module/", 8) == 0) { strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); } -- cgit v1.2.3-54-g00ecf From 7155bfb7fa7d72bc4e7341ad1481ffd4c6e39f97 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Jan 2006 06:16:57 +0100 Subject: 081 release --- ChangeLog | 11 +++++++++++ Makefile | 2 +- RELEASE-NOTES | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 25e23de593..68db4db036 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Summary of changes from v080 to v081 +============================================ + +Kay Sievers: + add DEVLINKS to "remove" event + better log text and comments + vol_id: probe volume as user nobody + fix BUS, ID, $id usage + prepare moving of /sys/class devices to /sys/devices + + Summary of changes from v079 to v080 ============================================ diff --git a/Makefile b/Makefile index 5c44571aab..bb4f6d4239 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 080 +VERSION = 081 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 623ea0ed60..68f7b88067 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,14 @@ +udev 081 +======== +Prepare udev to work with the experimental kernel patch, that moves +/sys/class devices to /sys/devices and /sys/block to /sys/class/block. + +Clarify BUS, ID, $id usage and fix $id behavior. This prepares for +moving the class devices to /sys/devices. + +Thanks again to Marco for help finding a hopefully nice compromise +to make %b simpler and working again. + udev 080 ======== Complete removal of libsysfs, replaced by simple helper functions -- cgit v1.2.3-54-g00ecf From 6ecd4d1e364ea8104c83e36b82d1c23835fb104b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 18 Jan 2006 04:24:48 +0100 Subject: scsi_id, usb_id: request device parent by subsystem Request specific parents identified by subsystem and don't rely on a predefined sequence. Also let the devpath be longer than 72 chars, tsss ... Signed-off-by: Kay Sievers --- extras/scsi_id/scsi_id.c | 28 ++++++++++++---------------- extras/scsi_id/scsi_id.h | 2 +- extras/usb_id/usb_id.c | 27 ++++++++++----------------- udev.h | 1 + udev_sysfs.c | 13 +++++++++++++ 5 files changed, 37 insertions(+), 34 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 3a4a374d3e..6458f2b7ac 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -48,7 +48,7 @@ static int all_good; static int always_info; static int dev_specified; static int sys_specified; -static char config_file[MAX_NAME_LEN] = SCSI_ID_CONFIG_FILE; +static char config_file[MAX_PATH_LEN] = SCSI_ID_CONFIG_FILE; static int display_bus_id; static enum page_code default_page_code; static int use_stderr; @@ -174,7 +174,7 @@ static int create_tmp_dev(const char *devpath, char *tmpdev, int dev_type) return -1; } - snprintf(tmpdev, MAX_NAME_LEN, "%s/%s-maj%d-min%d-%u", + snprintf(tmpdev, MAX_PATH_LEN, "%s/%s-maj%d-min%d-%u", TMP_DIR, TMP_PREFIX, maj, min, getpid()); dbg("tmpdev '%s'", tmpdev); @@ -433,7 +433,8 @@ static int set_options(int argc, char **argv, const char *short_opts, case 'd': dev_specified = 1; - strncpy(maj_min_dev, optarg, MAX_NAME_LEN); + strncpy(maj_min_dev, optarg, MAX_PATH_LEN); + maj_min_dev[MAX_PATH_LEN-1] = '\0'; break; case 'e': @@ -441,7 +442,8 @@ static int set_options(int argc, char **argv, const char *short_opts, break; case 'f': - strncpy(config_file, optarg, MAX_NAME_LEN); + strncpy(config_file, optarg, MAX_PATH_LEN); + config_file[MAX_PATH_LEN-1] = '\0'; break; case 'g': @@ -467,8 +469,8 @@ static int set_options(int argc, char **argv, const char *short_opts, case 's': sys_specified = 1; - strncpy(target, optarg, MAX_NAME_LEN); - target[MAX_NAME_LEN-1] = '\0'; + strncpy(target, optarg, MAX_PATH_LEN); + target[MAX_PATH_LEN-1] = '\0'; break; case 'u': @@ -640,18 +642,12 @@ static int scsi_id(const char *devpath, char *maj_min_dev) dev_type = S_IFCHR; /* get scsi parent device */ - dev_scsi = sysfs_device_get_parent(dev); + dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); if (dev_scsi == NULL) { err("unable to access parent device of '%s'", devpath); return 1; } - /* allow only scsi devices */ - if (strcmp(dev_scsi->subsystem, "scsi") != 0) { - info("%s is not a scsi device", devpath); - return 1; - } - /* mknod a temp dev to communicate with the device */ if (!dev_specified && create_tmp_dev(dev->devpath, maj_min_dev, dev_type)) { dbg("create_tmp_dev failed\n"); @@ -707,8 +703,8 @@ static int scsi_id(const char *devpath, char *maj_min_dev) int main(int argc, char **argv) { int retval = 0; - char devpath[MAX_NAME_LEN]; - char maj_min_dev[MAX_NAME_LEN]; + char devpath[MAX_PATH_LEN]; + char maj_min_dev[MAX_PATH_LEN]; int newargc; const char *env; char **newargv; @@ -729,7 +725,7 @@ int main(int argc, char **argv) if (env) { hotplug_mode = 1; sys_specified = 1; - strncpy(devpath, env, MAX_NAME_LEN); + strncpy(devpath, env, MAX_PATH_LEN); devpath[sizeof(devpath)-1] = '\0'; } diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index b5312b8988..758706ba25 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -21,7 +21,7 @@ * USA */ -#define MAX_NAME_LEN 72 +#define MAX_PATH_LEN 512 /* * MAX_ATTR_LEN: maximum length of the result of reading a sysfs diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 0bcd267f67..62aa1506d7 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -23,7 +23,7 @@ #include "../../udev.h" -#define MAX_NAME_LEN 72 +#define MAX_PATH_LEN 512 #define MAX_SERIAL_LEN 256 #define BLKGETSIZE64 _IOR(0x12,114,size_t) @@ -247,7 +247,9 @@ static int usb_id(const char *devpath) struct sysfs_device *dev; struct sysfs_device *dev_scsi; struct sysfs_device *dev_target; - struct sysfs_device *dev_host, *dev_interface, *dev_usb; + struct sysfs_device *dev_host; + struct sysfs_device *dev_interface; + struct sysfs_device *dev_usb; const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; const char *usb_model = NULL, *usb_vendor = NULL, *usb_rev, *usb_serial; const char *if_class, *if_subclass; @@ -263,14 +265,9 @@ static int usb_id(const char *devpath) } /* get scsi parent device */ - dev_scsi = sysfs_device_get_parent(dev); + dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); if (dev_scsi == NULL) { - err("unable to access parent device of '%s'", devpath); - return 1; - } - /* allow only scsi devices */ - if (strcmp(dev_scsi->subsystem, "scsi") != 0) { - info("%s is not a scsi device", devpath); + err("unable to find parent 'scsi' device of '%s'", devpath); return 1; } @@ -289,20 +286,16 @@ static int usb_id(const char *devpath) } /* usb interface directory */ - dev_interface = sysfs_device_get_parent(dev_host); + dev_interface = sysfs_device_get_parent_with_subsystem(dev_host, "usb"); if (dev_interface == NULL) { err("unable to access parent device of '%s'", devpath); return 1; } /* usb device directory */ - dev_usb = sysfs_device_get_parent(dev_interface); + dev_usb = sysfs_device_get_parent_with_subsystem(dev_interface, "usb"); if (dev_usb == NULL) { - err("unable to access parent device of '%s'", devpath); - return 1; - } - if (strcmp(dev_interface->subsystem, "usb") != 0) { - info("%s is not an usb device", devpath); + err("unable to find parent 'usb' device of '%s'", devpath); return 1; } @@ -397,7 +390,7 @@ int main(int argc, char **argv) { int retval = 0; const char *env; - char devpath[MAX_NAME_LEN]; + char devpath[MAX_PATH_LEN]; int option; logging_init("usb_id"); diff --git a/udev.h b/udev.h index 5d54b54432..0c7ca12f10 100644 --- a/udev.h +++ b/udev.h @@ -113,6 +113,7 @@ extern void sysfs_cleanup(void); extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, const char *subsystem); extern struct sysfs_device *sysfs_device_get(const char *devpath); extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); +extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem); extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); /* udev_add.c */ diff --git a/udev_sysfs.c b/udev_sysfs.c index 9838379803..172f0ce1fd 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -306,6 +306,19 @@ device_link: return sysfs_device_get(parent_devpath); } +struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem) +{ + struct sysfs_device *dev_parent; + + dev_parent = sysfs_device_get_parent(dev); + while (dev_parent != NULL) { + if (strcmp(dev_parent->subsystem, subsystem) == 0) + return dev_parent; + dev_parent = sysfs_device_get_parent(dev_parent); + } + return NULL; +} + char *sysfs_attr_get_value(const char *devpath, const char *attr_name) { char path_full[PATH_SIZE]; -- cgit v1.2.3-54-g00ecf From fbc5a2b921477cf490198e2781f096668f4ffba8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 19 Jan 2006 04:54:34 +0100 Subject: path_id: work with "all devices in /sys/devices" Signed-off-by: Kay Sievers --- extras/path_id | 129 ++++++++++++++++++++++++++------------------------------- 1 file changed, 58 insertions(+), 71 deletions(-) diff --git a/extras/path_id b/extras/path_id index 44fc4820b5..af1837a77d 100755 --- a/extras/path_id +++ b/extras/path_id @@ -15,33 +15,37 @@ # DEVPATH=/block/sda/sda3 path_id # path_id -# example for all block devices on a system: -# for i in `find /sys/block -name dev` ;do DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`" path_id ; done +# examples for all block devices on a system: +# for i in `find /sys/class/block`; do DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`"; path_id; done -# examples: # SCSI cdrom -# /block/sr0 -> /devices/pci0002:30/0002:30:0c.0/host0/0:0:1:0 -# result: pci-0002:30:0c.0-scsi-0:0:1:0 +# /class/block/sr0 -> /devices/pci0002:30/0002:30:0c.0/host0/target0:0:0/0:0:1:0 +# pci-0002:30:0c.0-scsi-0:0:1:0 +# # SCSI disk -# /block/sda -> /devices/pci0002:30/0002:30:0c.0/host0/0:0:4:0 -# result: pci-0002:30:0c.0-scsi-0:0:4:0 +# /class/block/sda -> /devices/pci0002:30/0002:30:0c.0/host0/target0:0:0/0:0:4:0 +# pci-0002:30:0c.0-scsi-0:0:4:0 +# # SATA disk, 4 channels per controller -# /block/sda -> /devices/pci0001:00/0001:00:07.0/0001:05:0c.0/host0/0:0:0:0 -# result: pci-0001:05:0c.0-scsi-0:0:0:0 +# /class/block/sda -> /devices/pci0001:00/0001:00:07.0/0001:05:0c.0/host0/target0:0:0/0:0:0:0 +# pci-0001:05:0c.0-scsi-0:0:0:0 +# # IDE disk -# /block/hda -> /devices/pci0002:02/0002:02:0d.0/ide0/0.0 -# result: pci-0002:02:0d.0-ide-0.0 +# /class/block/hda -> /devices/pci0002:02/0002:02:0d.0/ide0/0.0 +# pci-0002:02:0d.0-ide-0.0 +# # IDE cdrom on a Mac ASIC: -# /block/hdc -> /devices/pci0001:01/0001:01:17.0/0.80000000:mac-io/0.00020000:ata-3/ide1/1.0 -# result: mac-io_ata-3_master +# /class/block/hdc -> /devices/pci0001:01/0001:01:17.0/0.80000000:mac-io/0.00020000:ata-3/ide1/1.0 +# mac-io_ata-3_master +# # IDE cdrom on a Mac ASIC, with ide-scsi: -# /block/sr0 -> /devices/pci0001:01/0001:01:17.0/0.80000000:mac-io/0.0001f000:ata-4/ide0/0.1/host2/2:0:0:0 -# result: mac-io_ata-4_slave +# /class/block/sr0 -> /devices/pci0001:01/0001:01:17.0/0.80000000:mac-io/0.0001f000:ata-4/ide0/0.1/host2/target2:0:0/2:0:0:0 +# mac-io_ata-4_slave # USB CDrom drive without 'serial' number: # reusing 'product' and 'manufacturer' string, if available -# /block/sr0 -> /devices/pci0001:00/0001:00:04.0/0001:02:0b.0/usb4/4-2/4-2:1.0/host4/4:0:0:0 -# result: usb-storage-odd-Freecom-USIDERev930:0:0:0 +# /class/block/sr0 -> /devices/pci0001:00/0001:00:04.0/0001:02:0b.0/usb4/4-2/4-2:1.0/host4/4:0:0:0 +# usb-storage-odd-Freecom-USIDERev930:0:0:0 # devices may have several interfaces on one PCI device, like IDE: # pci-0001:00:04.0_ide1-master @@ -52,24 +56,14 @@ # interface # # match order is important. -# first IDE to find ide-scsi devices. -# then SCSI -# first usb-storage -# then firewire sbp2 -# then the rest +# first IDE to find ide-scsi devices, then SCSI +# first usb-storage, then firewire sbp2, then the rest SYSFS=/sys RESULT=1 -CDROM= TYPE= OPWD="`pwd`" -# Check for 'pwd -P' -if $(pwd -P > /dev/null 2>&1); then - pwd_cmd="pwd -P" -else - pwd_cmd="pwd" -fi -full_sysfs_class_path= +full_sysfs_path= full_sysfs_device_path= if [ -z "$DEVPATH" -a -z "$1" ] ; then @@ -87,29 +81,28 @@ if [ -z "$DEVPATH" ] ; then esac fi -if [ ! -d $SYSFS$DEVPATH ] ; then - exit 1 -fi -if [ ! -f $SYSFS$DEVPATH/dev ] ; then +if [ ! -e $SYSFS$DEVPATH/dev ] ; then exit 1 fi case "$DEVPATH" in - /block/*) - TYPE=block + /devices/*) + cd "$SYSFS$DEVPATH/subsystem"; + TYPE="`pwd -P`" + cd "$OPWD" + TYPE="${TYPE##*/}" ;; /class/*) TYPE="${DEVPATH#/class/}" TYPE="${TYPE%%/*}" ;; + /block/*) + TYPE=block + ;; *) exit 1 ;; esac - -# -## -# get_port () { local type offset port @@ -183,7 +176,7 @@ handle_block_ide () { ;; /sys/devices) # PCMCIA devices - ifname=${full_sysfs_class_path##*/} + ifname=${full_sysfs_path##*/} set -- `sed -n "/$ifname/p" /var/lib/pcmcia/stab` d="pcmcia-$1" ;; @@ -202,7 +195,6 @@ handle_block_ide () { else d="${d}-ide-${port}:$channel" fi - RESULT=0 } @@ -301,25 +293,35 @@ handle_block_usb_storage () { fi d="$d:$cil" RESULT=0 - - } handle_block () { - full_sysfs_class_path="$SYSFS$DEVPATH" - if [ ! -f $full_sysfs_class_path/dev ] ; then return ; fi - # the main device has (hopefully) a symlink to the real device - # a partition is a subdir of the main (raw) device - if [ ! -L $full_sysfs_class_path/device ] ; then - if [ -f $full_sysfs_class_path/range ] ; then return ; fi - full_sysfs_class_path="${full_sysfs_class_path%/*}" - : full_sysfs_class_path "$full_sysfs_class_path" - if [ ! -L $full_sysfs_class_path/device -o ! -f $full_sysfs_class_path/dev ] ; then - return + full_sysfs_path="$SYSFS$DEVPATH" + if [ -L $full_sysfs_path/subsystem ]; then + # new sysfs block layout + full_sysfs_path="${full_sysfs_path%/*}" + cd "$full_sysfs_path/subsystem"; + subsys="`pwd -P`" + cd "$OPWD" + subsys="${subsys##*/}" + if [ "$subsys" == "block" ]; then + # parent is "block", it's a partition, move one up + full_sysfs_path="${full_sysfs_path%/*}" fi + cd $full_sysfs_path + else + # old sysfs block layout + if [ ! -L $full_sysfs_path/device ] ; then + if [ -f $full_sysfs_path/range ] ; then return ; fi + full_sysfs_path="${full_sysfs_path%/*}" + : full_sysfs_path "$full_sysfs_path" + if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then + return + fi + fi + cd $full_sysfs_path/device fi - cd $full_sysfs_class_path/device - full_sysfs_device_path="`$pwd_cmd`" + full_sysfs_device_path="`pwd -P`" cd "$OPWD" D=$full_sysfs_device_path case "$D" in @@ -361,27 +363,12 @@ handle_block () { handle_block_scsi "$D" fi ;; - *) : not handled RESULT=1 return - ;; esac - # look for a partition - if [ "$full_sysfs_class_path" != "$SYSFS$DEVPATH" ] ; then - dp="`echo $SYSFS$DEVPATH | sed -e 's@^/.*/@@;s@^[^0-9]\{1,\}@@;s@.*_@@'`" - case "$d" in - *[0-9]) - d="${d}p${dp}" - ;; - *) - d="${d}${dp}" - ;; - esac - fi - # done echo "ID_PATH=$d" } -- cgit v1.2.3-54-g00ecf From 0ec819d92bd53a2f64e738c40bde39e4d2dd66be Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 Jan 2006 02:54:31 +0100 Subject: ignore all messages with missing devpath or action Signed-off-by: Kay Sievers --- udevd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index f64a4252bb..c45d3a4cd0 100644 --- a/udevd.c +++ b/udevd.c @@ -516,8 +516,8 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) msg->envp[i++] = "UDEVD_EVENT=1"; msg->envp[i] = NULL; - if (!msg->devpath) { - info("DEVPATH missing, ignore message"); + if (msg->devpath == NULL || msg->action == NULL) { + info("DEVPATH or ACTION missing, ignore message"); free(msg); return NULL; } -- cgit v1.2.3-54-g00ecf From aaa14841de57fc0d8c92514da9453c58d9ba59fe Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Fri, 20 Jan 2006 23:18:23 +0100 Subject: fixes udev build with -fpie Add missing includes and environ declaration. --- udev_sysfs.c | 1 + udev_utils_run.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 172f0ce1fd..d1e43a60ee 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "udev.h" diff --git a/udev_utils_run.c b/udev_utils_run.c index b6020b0ab6..c6af90658d 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -30,9 +30,11 @@ #include #include #include +#include #include "udev.h" +extern char **environ; int pass_env_to_socket(const char *sockname, const char *devpath, const char *action) { -- cgit v1.2.3-54-g00ecf From d8a57e7c2624bf19ad2f4f91a6d9149d5228402f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Jan 2006 03:24:16 +0100 Subject: Makefile: remove dynamic config file generation Signed-off-by: Kay Sievers --- Makefile | 34 +++++++++++----------------------- etc/udev/udev.conf | 7 +++++++ etc/udev/udev.conf.in | 7 ------- udev_sysfs.c | 2 +- udev_utils_run.c | 3 +-- 5 files changed, 20 insertions(+), 33 deletions(-) create mode 100644 etc/udev/udev.conf delete mode 100644 etc/udev/udev.conf.in diff --git a/Makefile b/Makefile index bb4f6d4239..cb097dde58 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ USE_STATIC = false # make EXTRAS="extras/ extras/" EXTRAS = -# make the build silent. Set this to something else to make it noisy again. +# make the build silent. V = false PROGRAMS = \ @@ -89,10 +89,6 @@ MAN_PAGES = \ udevinfo.8 \ udevstart.8 -# config files automatically generated -GEN_CONFIGS = \ - $(LOCAL_CFG_DIR)/udev.conf - GEN_HEADERS = \ udev_version.h @@ -105,12 +101,11 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev udevdir = /dev -LOCAL_CFG_DIR = etc/udev DESTDIR = INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} PWD = $(shell pwd) @@ -149,7 +144,6 @@ ifeq ($(strip $(USE_GCOV)),true) LDFLAGS += -fprofile-arcs endif -# if our own version of klibc is used, we need to build it ifeq ($(strip $(USE_KLIBC)),true) KLCC = /usr/bin/$(CROSS)klcc CC = $(KLCC) @@ -211,14 +205,9 @@ $(LIBUDEV): $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS) $(QUIET) $(AR) cq $@ $(UDEV_OBJS) $(QUIET) $(RANLIB) $@ -# generate config files -$(GEN_CONFIGS): - sed -e "s:@udevdir@:$(udevdir):" -e "s:@configdir@:$(configdir):" < $@.in > $@ - -# generate config header file udev_version.h: - @echo "Creating udev_version.h" - @echo \#define UDEV_VERSION \"$(VERSION)\" > $@ + @echo "/* Generated by make. */" > $@ + @echo \#define UDEV_VERSION \"$(VERSION)\" >> $@ @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ @@ -239,8 +228,9 @@ clean: - find -name "*.gcda" -print0 | xargs -0rt rm -f - find -name "*.gcov" -print0 | xargs -0rt rm -f - rm -f udev_gcov.txt - - rm -f core $(PROGRAMS) $(GEN_HEADERS) $(GEN_CONFIGS) + - rm -f core $(PROGRAMS) $(GEN_HEADERS) - rm -f udev-$(VERSION).tar.gz + - rm -f udev-$(VERSION).tar.bz2 @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ $(MAKE) -C $$target $@ || exit 1; \ @@ -249,14 +239,13 @@ clean: release: git-tar-tree HEAD udev-$(VERSION) | gzip -9v > udev-$(VERSION).tar.gz - @echo "udev-$(VERSION).tar.gz created" + git-tar-tree HEAD udev-$(VERSION) | bzip2 -9v > udev-$(VERSION).tar.bz2 .PHONY: release -install-config: $(GEN_CONFIGS) +install-config: $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d @if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ - echo $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ - $(INSTALL_DATA) $(LOCAL_CFG_DIR)/udev.conf $(DESTDIR)$(configdir); \ + $(INSTALL_DATA) etc/udev/udev.conf $(DESTDIR)$(configdir); \ fi @if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \ echo; \ @@ -327,8 +316,8 @@ uninstall-bin: - rm -f $(DESTDIR)$(sbindir)/udevcontrol - rm -f $(DESTDIR)$(sbindir)/udevstart - rm -f $(DESTDIR)$(usrsbindir)/udevmonitor - - rm -f $(usrbindir)/udevinfo - - rm -f $(DESTDIR)$(DESTDIR)$(usrbindir)/udevtest + - rm -f $(DESTDIR)$(usrbindir)/udevinfo + - rm -f $(DESTDIR)$(usrbindir)/udevtest ifndef DESTDIR - killall udevd - rm -rf /dev/.udev @@ -387,4 +376,3 @@ udev_gcov.txt: $(wildcard *.gcda) $(wildcard *.gcno) echo >> $@; \ done; \ echo "view $@ for the result" - diff --git a/etc/udev/udev.conf b/etc/udev/udev.conf new file mode 100644 index 0000000000..41902c4f06 --- /dev/null +++ b/etc/udev/udev.conf @@ -0,0 +1,7 @@ +# udev.conf + +# The initial syslog(3) priority: "err", "info", "debug" or its +# numerical equivalent. For runtime debugging, the daemons internal +# state can be changed with: "udevcontrol log_priority=". +udev_log="err" + diff --git a/etc/udev/udev.conf.in b/etc/udev/udev.conf.in deleted file mode 100644 index 41902c4f06..0000000000 --- a/etc/udev/udev.conf.in +++ /dev/null @@ -1,7 +0,0 @@ -# udev.conf - -# The initial syslog(3) priority: "err", "info", "debug" or its -# numerical equivalent. For runtime debugging, the daemons internal -# state can be changed with: "udevcontrol log_priority=". -udev_log="err" - diff --git a/udev_sysfs.c b/udev_sysfs.c index d1e43a60ee..8de523dadf 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -275,7 +275,7 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) if (strncmp(parent_devpath, "/class", 6) == 0) { pos = strrchr(parent_devpath, '/'); if (pos == &parent_devpath[6] || pos == parent_devpath) { - dbg("class top level, look for device link"); + dbg("/class top level, look for device link"); goto device_link; } } diff --git a/udev_utils_run.c b/udev_utils_run.c index c6af90658d..31363588c8 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -30,7 +30,6 @@ #include #include #include -#include #include "udev.h" @@ -51,7 +50,7 @@ int pass_env_to_socket(const char *sockname, const char *devpath, const char *ac sock = socket(AF_LOCAL, SOCK_DGRAM, 0); memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; - /* only abstract namespace is supported */ + /* abstract namespace only */ strcpy(&saddr.sun_path[1], sockname); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; -- cgit v1.2.3-54-g00ecf From aabc6a7294936030fa646ee6f6eae6ffe004774c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Jan 2006 19:08:06 +0100 Subject: path_id: handle fiber channel Patch from: Hannes Reinecke Signed-off-by: Kay Sievers --- extras/path_id | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/extras/path_id b/extras/path_id index af1837a77d..b58e1eda6a 100755 --- a/extras/path_id +++ b/extras/path_id @@ -248,6 +248,46 @@ handle_block_scsi () { RESULT=0 } +handle_block_fc () { +: handle_block_fc $* + local DEV=$1 + local cil controller_port controller_dev + # SCSI-FC device + fc_tgt_hcil="${DEV##*/}" + fc_tgt_lun="${fc_tgt_hcil##*:}" + fc_tgt_path="${DEV%/*}" + fc_tgt_num="${fc_tgt_path##*/}" + fc_tgt_dev="${fc_tgt_path}/fc_transport:${fc_tgt_num}" + if [ -e "$fc_tgt_dev/port_name" ]; then + read wwpn < $fc_tgt_dev/port_name + fi + if [ -z "$wwpn" ] ; then + : no WWPN + RESULT=1 + return + fi + # Linux currently knows about 32bit luns + tmp_lun3=$(printf "%04x" $(($fc_tgt_lun & 0xFFFF))) + tmp_lun2=$(printf "%04x" $(( ($fc_tgt_lun >> 16) & 0xFFFF))) + tmp_lun1="0000" + tmp_lun0="0000" + + if (($fc_tgt_lun == 0)) ; then + lun="0x0000000000000000" + else + lun="0x${tmp_lun3}${tmp_lun2}${tmp_lun1}${tmp_lun0}" + fi + controller_dev="${fc_tgt_path%/host[0-9]*}" + adapter="${controller_dev##*/}" + bus="pci" + d="$bus-$adapter" + if [ -z "$controller_port" ] ; then + controller_port=0 + fi + d="${d}-fc-${wwpn}:${lun}" + RESULT=0 +} + handle_block_usb_storage () { : handle_block_usb_storage $* local DEV=$1 @@ -353,6 +393,9 @@ handle_block () { RESULT=0 fi ;; + */rport-[0-9]*:[0-9]*-[0-9]*/*) + handle_block_fc "$D" + ;; */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) # check for ieee1394 sbp2 if test -f $D/ieee1394_id ; then -- cgit v1.2.3-54-g00ecf From f83cccb9798d6ce70c6cc39d2100794813b3615b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Jan 2006 19:09:17 +0100 Subject: usb_id: don't fail on other subsytems than "scsi" Signed-off-by: Kay Sievers --- extras/usb_id/usb_id.c | 151 ++++++++++++++++++++----------------------------- 1 file changed, 62 insertions(+), 89 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 62aa1506d7..783d546b26 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -101,59 +101,44 @@ static void set_str(char *to, const char *from, size_t count) to[j] = '\0'; } -/* - * set_usb_iftype - * - * Set the type based on the USB interface class - */ -static void set_usb_iftype(char *to, const char *from, size_t len) +static void set_usb_iftype(char *to, int if_class_num, size_t len) { - int type_num; - char *eptr; char *type = "generic"; - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 1: - type = "audio"; - break; - case 3: - type = "hid"; - break; - case 7: - type = "printer"; - break; - case 8: - type = "disk"; - break; - case 2: /* CDC-Control */ - case 5: /* Physical */ - case 6: /* Image */ - case 9: /* HUB */ - case 0x0a: /* CDC-Data */ - case 0x0b: /* Chip/Smart Card */ - case 0x0d: /* Content Security */ - case 0x0e: /* Video */ - case 0xdc: /* Diagnostic Device */ - case 0xe0: /* Wireless Controller */ - case 0xf2: /* Application-specific */ - case 0xff: /* Vendor-specific */ - default: - break; - } + switch (if_class_num) { + case 1: + type = "audio"; + break; + case 3: + type = "hid"; + break; + case 7: + type = "printer"; + break; + case 8: + type = "disk"; + break; + case 2: /* CDC-Control */ + case 5: /* Physical */ + case 6: /* Image */ + case 9: /* HUB */ + case 0x0a: /* CDC-Data */ + case 0x0b: /* Chip/Smart Card */ + case 0x0d: /* Content Security */ + case 0x0e: /* Video */ + case 0xdc: /* Diagnostic Device */ + case 0xe0: /* Wireless Controller */ + case 0xf2: /* Application-specific */ + case 0xff: /* Vendor-specific */ + break; + default: + break; } strncpy(to, type, len); to[len-1] = '\0'; } -/* - * set_usb_ifsybtype - * - * Set the type base on the interfaceSubClass. - * Valid for Mass-Storage devices (type 8) only. - */ -static int set_usb_ifsubtype(char *to, const char *from, size_t len) +static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len) { int type_num = 0; char *eptr; @@ -245,9 +230,6 @@ static void set_scsi_type(char *to, const char *from, int count) static int usb_id(const char *devpath) { struct sysfs_device *dev; - struct sysfs_device *dev_scsi; - struct sysfs_device *dev_target; - struct sysfs_device *dev_host; struct sysfs_device *dev_interface; struct sysfs_device *dev_usb; const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; @@ -258,44 +240,17 @@ static int usb_id(const char *devpath) dbg("devpath %s\n", devpath); + /* get all usb specific information: dev_interface, if_class, dev_usb */ dev = sysfs_device_get(devpath); if (dev == NULL) { err("unable to access '%s'", devpath); return 1; } - /* get scsi parent device */ - dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); - if (dev_scsi == NULL) { - err("unable to find parent 'scsi' device of '%s'", devpath); - return 1; - } - - /* target directory */ - dev_target = sysfs_device_get_parent(dev_scsi); - if (dev_target == NULL) { - err("unable to access parent device of '%s'", devpath); - return 1; - } - - /* host directory */ - dev_host = sysfs_device_get_parent(dev_target); - if (dev_host == NULL) { - err("unable to access parent device of '%s'", devpath); - return 1; - } - /* usb interface directory */ - dev_interface = sysfs_device_get_parent_with_subsystem(dev_host, "usb"); + dev_interface = sysfs_device_get_parent_with_subsystem(dev, "usb"); if (dev_interface == NULL) { - err("unable to access parent device of '%s'", devpath); - return 1; - } - - /* usb device directory */ - dev_usb = sysfs_device_get_parent_with_subsystem(dev_interface, "usb"); - if (dev_usb == NULL) { - err("unable to find parent 'usb' device of '%s'", devpath); + info("unable to access usb_interface device of '%s'", devpath); return 1; } @@ -305,46 +260,64 @@ static int usb_id(const char *devpath) return 1; } if_class_num = strtoul(if_class, NULL, 16); - if (if_class_num != 8) { - set_usb_iftype(type_str, if_class, sizeof(type_str)-1); - protocol = 0; - } else { + if (if_class_num == 8) { if_subclass = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceSubClass"); - protocol = set_usb_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); + if (if_subclass != NULL) + protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); + } else + set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1); + + info("%s: if_class %d protocol %d\n", dev_interface->devpath, if_class_num, protocol); + + /* usb device directory */ + dev_usb = sysfs_device_get_parent_with_subsystem(dev_interface, "usb"); + if (!dev_usb) { + info("unable to find parent 'usb' device of '%s'", devpath); + return 1; } - if (!use_usb_info && protocol == 6) { + /* mass storage */ + if (protocol == 6 && !use_usb_info) { + struct sysfs_device *dev_scsi; + + /* get scsi device */ + dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); + if (dev_scsi == NULL) { + info("unable to find parent 'scsi' device of '%s'", devpath); + goto fallback; + } + /* Generic SPC-2 device */ scsi_vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!scsi_vendor) { info("%s: cannot get SCSI vendor attribute", dev_scsi->kernel_name); - return 1; + goto fallback; } set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); scsi_model = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!scsi_model) { info("%s: cannot get SCSI model attribute", dev_scsi->kernel_name); - return 1; + goto fallback; } set_str(model_str, scsi_model, sizeof(model_str)-1); scsi_type = sysfs_attr_get_value(dev_scsi->devpath, "type"); if (!scsi_type) { info("%s: cannot get SCSI type attribute", dev_scsi->kernel_name); - return 1; + goto fallback; } set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); scsi_rev = sysfs_attr_get_value(dev_scsi->devpath, "rev"); if (!scsi_rev) { info("%s: cannot get SCSI revision attribute", dev_scsi->kernel_name); - return 1; + goto fallback; } set_str(revision_str, scsi_rev, sizeof(revision_str)-1); - } +fallback: /* Fallback to USB vendor & device */ if (vendor_str[0] == '\0') { if (!use_num_info) -- cgit v1.2.3-54-g00ecf From f61f78a76e424e4ec8197bc52e08d19b2ce07236 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Jan 2006 03:03:42 +0100 Subject: don't do RUN if "ignore_device" is given Signed-off-by: Kay Sievers --- udev_device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udev_device.c b/udev_device.c index 0325001428..781787ef4a 100644 --- a/udev_device.c +++ b/udev_device.c @@ -88,7 +88,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) udev_rules_get_name(rules, udev); if (udev->ignore_device) { info("device event will be ignored"); - return 0; + return -1; } /* create node, store in db */ if (udev->name[0] != '\0') @@ -104,7 +104,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) udev_rules_get_run(rules, udev); if (udev->ignore_device) { info("device event will be ignored"); - return 0; + return -1; } /* get data from db, remove db-entry, delete node */ retval = udev_remove_device(udev); @@ -117,8 +117,10 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* default devices */ udev_rules_get_run(rules, udev); - if (udev->ignore_device) + if (udev->ignore_device) { info("device event will be ignored"); + return -1; + } return retval; } -- cgit v1.2.3-54-g00ecf From 7d1e179f86aabeb5c206bf9b5bcac52235a9afbf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Jan 2006 12:12:07 +0100 Subject: increase kernel uevent buffer size Signed-off-by: Kay Sievers --- udevd.c | 2 +- udevd.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/udevd.c b/udevd.c index c45d3a4cd0..ffa81bbb75 100644 --- a/udevd.c +++ b/udevd.c @@ -621,7 +621,7 @@ static struct uevent_msg *get_netlink_msg(void) struct uevent_msg *msg; int bufpos; ssize_t size; - static char buffer[UEVENT_BUFFER_SIZE + 512]; + static char buffer[UEVENT_BUFFER_SIZE+512]; char *pos; size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); diff --git a/udevd.h b/udevd.h index c0a32e97ed..242c0b6907 100644 --- a/udevd.h +++ b/udevd.h @@ -38,8 +38,8 @@ #define UDEVD_MAX_CHILDS_RUNNING 16 /* environment buffer, should match the kernel's size in lib/kobject_uevent.h */ -#define UEVENT_BUFFER_SIZE 1024 -#define UEVENT_NUM_ENVP 32 +#define UEVENT_BUFFER_SIZE 2048 +#define UEVENT_NUM_ENVP 64 enum udevd_msg_type { UDEVD_UNKNOWN, -- cgit v1.2.3-54-g00ecf From f5f0c34f6dc32769fd788560ce0d0cac843872b2 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Tue, 24 Jan 2006 20:10:48 +0100 Subject: substitute format chars in RUN after rule matching Apply substitutions before running a program, not while the rule is parsed. It allows to use environment variables set during rule processing as command arguments. --- udev.c | 9 +++++++-- udev_rules.c | 3 +-- udev_rules.h | 2 +- udevd.c | 9 +++++++-- udevstart.c | 9 +++++++-- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/udev.c b/udev.c index 4762ab1cef..f808abf427 100644 --- a/udev.c +++ b/udev.c @@ -161,8 +161,13 @@ int main(int argc, char *argv[], char *envp[]) list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action); - else - run_program(name_loop->name, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + else { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + apply_format(udev, program, sizeof(program)); + run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + } } } diff --git a/udev_rules.c b/udev_rules.c index e9d8d7560e..fbcbbe0083 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -362,7 +362,7 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) return -1; } -static void apply_format(struct udevice *udev, char *string, size_t maxsize) +void apply_format(struct udevice *udev, char *string, size_t maxsize) { char temp[PATH_SIZE]; char temp2[PATH_SIZE]; @@ -1017,7 +1017,6 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) name_list_cleanup(&udev->run_list); } strlcpy(program, key_val(rule, &rule->run), sizeof(program)); - apply_format(udev, program, sizeof(program)); dbg("add run '%s'", program); name_list_add(&udev->run_list, program, 0); } diff --git a/udev_rules.h b/udev_rules.h index 125babf1c5..b183d9b531 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -105,7 +105,7 @@ struct udev_rules { extern int udev_rules_init(struct udev_rules *rules, int resolve_names); extern void udev_rules_cleanup(struct udev_rules *rules); -extern void udev_apply_format(struct udevice *udev, char *string, size_t maxsize); +extern void apply_format(struct udevice *udev, char *string, size_t maxsize); extern void udev_rules_iter_init(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); diff --git a/udevd.c b/udevd.c index ffa81bbb75..8a352e1eb9 100644 --- a/udevd.c +++ b/udevd.c @@ -123,10 +123,15 @@ static int udev_event_process(struct uevent_msg *msg) list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], msg->devpath, msg->action); - else - if (run_program(name_loop->name, udev->dev->subsystem, NULL, 0, NULL, + else { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + apply_format(udev, program, sizeof(program)); + if (run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO))) retval = -1; + } } } diff --git a/udevstart.c b/udevstart.c index 8c414f1acb..11bdf79183 100644 --- a/udevstart.c +++ b/udevstart.c @@ -160,8 +160,13 @@ run: list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, "add"); - else - run_program(name_loop->name, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + else { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + apply_format(udev, program, sizeof(program)); + run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + } } } exit: -- cgit v1.2.3-54-g00ecf From 2c769419a18281ab095809cf3c37a36f0f615c01 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Jan 2006 20:21:42 +0100 Subject: move udev(8) manpage to udev(7) Signed-off-by: Kay Sievers --- Makefile | 8 +- docs/udev.xml | 7 +- udev.7 | 249 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev.8 | 250 ---------------------------------------------------------- 4 files changed, 255 insertions(+), 259 deletions(-) create mode 100644 udev.7 delete mode 100644 udev.8 diff --git a/Makefile b/Makefile index cb097dde58..500c8db6d2 100644 --- a/Makefile +++ b/Makefile @@ -81,7 +81,7 @@ UDEV_OBJS = \ LIBUDEV = libudev.a MAN_PAGES = \ - udev.8 \ + udev.7 \ udevmonitor.8 \ udevd.8 \ udevsend.8 \ @@ -213,7 +213,7 @@ udev_version.h: @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ # man pages -%.8: docs/%.xml +%.8 %.7: docs/%.xml xmlto man $? .PRECIOUS: %.8 @@ -259,7 +259,7 @@ install-config: .PHONY: install-config install-man: - $(INSTALL_DATA) -D udev.8 $(DESTDIR)$(mandir)/man8/udev.8 + $(INSTALL_DATA) -D udev.7 $(DESTDIR)$(mandir)/man7/udev.7 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 $(INSTALL_DATA) -D udevstart.8 $(DESTDIR)$(mandir)/man8/udevstart.8 @@ -274,7 +274,7 @@ install-man: .PHONY: install-man uninstall-man: - - rm -f $(DESTDIR)$(mandir)/man8/udev.8 + - rm -f $(DESTDIR)$(mandir)/man7/udev.7 - rm -f $(DESTDIR)$(mandir)/man8/udevinfo.8 - rm -f $(DESTDIR)$(mandir)/man8/udevtest.8 - rm -f $(DESTDIR)$(mandir)/man8/udevstart.8 diff --git a/docs/udev.xml b/docs/udev.xml index ab8174e6a9..7e29077977 100644 --- a/docs/udev.xml +++ b/docs/udev.xml @@ -27,7 +27,7 @@ udev - 8 + 7 @@ -510,14 +510,11 @@ SEE ALSO - udev8 + udevd8 , udevinfo8 , - - udevd8 - , udevmonitor8 diff --git a/udev.7 b/udev.7 new file mode 100644 index 0000000000..a7e2f5a4e7 --- /dev/null +++ b/udev.7 @@ -0,0 +1,249 @@ +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEV" "7" "August 2005" "udev" "udev" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udev \- dynamic device management +.SH "DESCRIPTION" +.PP +udev provides a dynamic device directory containing only the files for actually present devices. It creates or removes device node files in the +\fI/dev\fR +directory, or it renames network interfaces. +.PP +Usually udev runs as +\fBudevd\fR(8) +and receives uevents directly from the kernel if a device is added or removed form the system. +.PP +If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. Rules that match, may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling. +.SH "CONFIGURATION" +.PP +All udev configuration files are placed in +\fI/etc/udev/*\fR. Every file consists of a set of lines of text. All empty lines or lines beginning with '#' will be ignored. +.SS "Configuration file" +.PP +udev expects its main configuration file at +\fI/etc/udev/udev.conf\fR. It consists of a set of variables allowing the user to override default udev values. The following variables can be set: +.TP +\fBudev_root\fR +Specifies where to place the device nodes in the filesystem. The default value is +\fI/dev\fR. +.TP +\fBudev_rules\fR +The name of the udev rules file or directory to look for files with the suffix +\fI.rules\fR. Multiple rule files are read in lexical order. The default value is +\fI/etc/udev/rules.d\fR. +.TP +\fBudev_log\fR +The logging priority. Valid values are the numerical syslog priorities or their textual representations: +\fBerr\fR, +\fBinfo\fR +and +\fBdebug\fR. +.SS "Rules files" +.PP +The udev rules are read from the files located in the +\fI/etc/udev/rules.d\fR +directory or at the location specified value in the configuraton file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignement keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. +.PP +A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: +.TP +\fB==\fR +Compare for equality. +.TP +\fB!=\fR +Compare for non\-equality. +.TP +\fB=\fR +Asign a value to a key. Keys that represent a list, are reset and only this single value is assigned. +.TP +\fB+=\fR +Add the value to a key that holds a list of entries. +.TP +\fB:=\fR +Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules. +.PP +The following key names can be used to match against device properties: +.TP +\fBACTION\fR +Match the name of the event action. +.TP +\fBKERNEL\fR +Match the name of the device. +.TP +\fBDEVPATH\fR +Match the devpath of the device. +.TP +\fBSUBSYSTEM\fR +Match the subsystem of the device. +.TP +\fBBUS\fR +Search the devpath upwards for a matching device subsystem name. +.TP +\fBDRIVER\fR +Search the devpath upwards for a matching device driver name. +.TP +\fBID\fR +Search the devpath upwards for a matching device name. +.TP +\fBSYSFS{\fR\fB\fIfilename\fR\fR\fB}\fR +Search the devpath upwards for a device with matching sysfs attribute values. Up to five +\fBSYSFS\fR +keys can be specified per rule. All attributes must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. +.TP +\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR +Match against the value of an environment variable. Up to five +\fBENV\fR +keys can be specified per rule. This key can also be used to export a variable to the environment. +.TP +\fBPROGRAM\fR +Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key. +.TP +\fBRESULT\fR +Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call. +.PP +Most of the fields support a shell style pattern matching. The following pattern characters are supported: +.TP +\fB*\fR +Matches zero, or any number of characters. +.TP +\fB?\fR +Matches any single character. +.TP +\fB[]\fR +Matches any single character specified within the brackets. example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. +.PP +The following keys can get values assigned: +.TP +\fBNAME\fR +The name of the node to be created, or the name the network interface should be renamed to. Only one rule can set the node name, all later rules with a NAME key will be ignored. +.TP +\fBSYMLINK\fR +The name of a symlink targeting the node. Every matching rule can add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character. +.TP +\fBOWNER, GROUP, MODE\fR +The permissions for the device node. Every specified value overwrites the compiled\-in default value. +.TP +\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR +Export a variable to the environment. This key can also be used to match against an environment variable. +.TP +\fBRUN\fR +Add a program to the list of programs to be executed for a specific device. +.TP +\fBLABEL\fR +Named label where a GOTO can jump to. +.TP +\fBGOTO\fR +Jumps to the next LABEL with a matching gname +.TP +\fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR +Import the printed result or the value of a file in environment key format into the event environment. +\fBprogram\fR +will execute an external program and read its output. +\fBfile\fR +will inport a text file. If no option is given, udev will determine it from the executable bit of of the file permissions. +.TP +\fBWAIT_FOR_SYSFS\fR +Wait for the specified sysfs file of the device to be created. Can be used to fight against kernel sysfs timing issues. +.TP +\fBOPTIONS\fR +\fBlast_rule\fR +stops further rules application. No later rules will have any effect. +\fBignore_device\fR +will ignore this event completely. +\fBignore_remove\fR +will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. +\fBall_partitions\fR +will create device nodes for all available partitions of a block device. This may be useful for removable media. +.PP +The +\fBNAME\fR, +\fBSYMLINK\fR, +\fBPROGRAM\fR, +\fBOWNER\fR +and +\fBGROUP\fR +fields support simple printf\-like string substitutions: +.TP +\fB$kernel\fR, \fB%k\fR +The kernel name for this device. +.TP +\fB$number\fR, \fB%n\fR +The kernel number for this device. For example, 'sda3' has kernel number of '3' +.TP +\fB$devpath\fR, \fB%p\fR +The devpath of the device. +.TP +\fB$id\fR, \fB%b\fR +The name of the device matched while searching the devpath upwards for +\fBBUS\fR, +\fBID\fR\fBDRIVER\fR +and +\fBSYSFS\fR. +.TP +\fB$sysfs{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR +The value of a sysfs attribute found at the current or a parent device. +.TP +\fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR +The value of an environment variable. +.TP +\fB$major\fR, \fB%M\fR +The kernel major number for the device. +.TP +\fB$minor\fR \fB%m\fR +The kernel minor number for the device. +.TP +\fB$result\fR, \fB%c\fR +The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: +\fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: +\fB%c{N+}\fR +.TP +\fB$parent\fR, \fB%P\fR +The node name of the parent device. +.TP +\fB$root\fR, \fB%r\fR +The udev_root value. +.TP +\fB$tempnode\fR, \fB%N\fR +The name of a created temporary device node to provide access to the device from a external program before the real node is created. +.TP +\fB%%\fR +The '%' character itself. +.TP +\fB$$\fR +The '$' character itself. +.PP +The count of characters to be substituted may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute +.SH "ENVIRONMENT" +.TP +\fBACTION\fR +\fIadd\fR +or +\fIremove\fR +signifies the addition or the removal of a device. +.TP +\fBDEVPATH\fR +The sysfs devpath without the mountpoint but a leading slash. +.TP +\fBSUBSYSTEM\fR +The kernel subsystem the device belongs to. +.TP +\fBUDEV_LOG\fR +Overrides the syslog priority specified in the config file. +.SH "AUTHOR" +.PP +Written by Greg Kroah\-Hartman + +and Kay Sievers +. With much help from Dan Stekloff + +and many others. +.SH "SEE ALSO" +.PP +\fBudevd\fR(8), +\fBudevinfo\fR(8), +\fBudevmonitor\fR(8) diff --git a/udev.8 b/udev.8 deleted file mode 100644 index 8eb63c2015..0000000000 --- a/udev.8 +++ /dev/null @@ -1,250 +0,0 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. -.TH "UDEV" "8" "August 2005" "udev" "udev" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udev \- dynamic device management -.SH "DESCRIPTION" -.PP -udev provides a dynamic device directory containing only the files for actually present devices. It creates or removes device node files in the -\fI/dev\fR -directory, or it renames network interfaces. -.PP -Usually udev runs as -\fBudevd\fR(8) -and receives uevents directly from the kernel if a device is added or removed form the system. -.PP -If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. Rules that match, may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling. -.SH "CONFIGURATION" -.PP -All udev configuration files are placed in -\fI/etc/udev/*\fR. Every file consists of a set of lines of text. All empty lines or lines beginning with '#' will be ignored. -.SS "Configuration file" -.PP -udev expects its main configuration file at -\fI/etc/udev/udev.conf\fR. It consists of a set of variables allowing the user to override default udev values. The following variables can be set: -.TP -\fBudev_root\fR -Specifies where to place the device nodes in the filesystem. The default value is -\fI/dev\fR. -.TP -\fBudev_rules\fR -The name of the udev rules file or directory to look for files with the suffix -\fI.rules\fR. Multiple rule files are read in lexical order. The default value is -\fI/etc/udev/rules.d\fR. -.TP -\fBudev_log\fR -The logging priority. Valid values are the numerical syslog priorities or their textual representations: -\fBerr\fR, -\fBinfo\fR -and -\fBdebug\fR. -.SS "Rules files" -.PP -The udev rules are read from the files located in the -\fI/etc/udev/rules.d\fR -directory or at the location specified value in the configuraton file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignement keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. -.PP -A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: -.TP -\fB==\fR -Compare for equality. -.TP -\fB!=\fR -Compare for non\-equality. -.TP -\fB=\fR -Asign a value to a key. Keys that represent a list, are reset and only this single value is assigned. -.TP -\fB+=\fR -Add the value to a key that holds a list of entries. -.TP -\fB:=\fR -Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules. -.PP -The following key names can be used to match against device properties: -.TP -\fBACTION\fR -Match the name of the event action. -.TP -\fBKERNEL\fR -Match the name of the device. -.TP -\fBDEVPATH\fR -Match the devpath of the device. -.TP -\fBSUBSYSTEM\fR -Match the subsystem of the device. -.TP -\fBBUS\fR -Search the devpath upwards for a matching device subsystem name. -.TP -\fBDRIVER\fR -Search the devpath upwards for a matching device driver name. -.TP -\fBID\fR -Search the devpath upwards for a matching device name. -.TP -\fBSYSFS{\fR\fB\fIfilename\fR\fR\fB}\fR -Search the devpath upwards for a device with matching sysfs attribute values. Up to five -\fBSYSFS\fR -keys can be specified per rule. All attributes must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. -.TP -\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -Match against the value of an environment variable. Up to five -\fBENV\fR -keys can be specified per rule. This key can also be used to export a variable to the environment. -.TP -\fBPROGRAM\fR -Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key. -.TP -\fBRESULT\fR -Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call. -.PP -Most of the fields support a shell style pattern matching. The following pattern characters are supported: -.TP -\fB*\fR -Matches zero, or any number of characters. -.TP -\fB?\fR -Matches any single character. -.TP -\fB[]\fR -Matches any single character specified within the brackets. example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. -.PP -The following keys can get values assigned: -.TP -\fBNAME\fR -The name of the node to be created, or the name the network interface should be renamed to. Only one rule can set the node name, all later rules with a NAME key will be ignored. -.TP -\fBSYMLINK\fR -The name of a symlink targeting the node. Every matching rule can add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character. -.TP -\fBOWNER, GROUP, MODE\fR -The permissions for the device node. Every specified value overwrites the compiled\-in default value. -.TP -\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -Export a variable to the environment. This key can also be used to match against an environment variable. -.TP -\fBRUN\fR -Add a program to the list of programs to be executed for a specific device. -.TP -\fBLABEL\fR -Named label where a GOTO can jump to. -.TP -\fBGOTO\fR -Jumps to the next LABEL with a matching gname -.TP -\fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR -Import the printed result or the value of a file in environment key format into the event environment. -\fBprogram\fR -will execute an external program and read its output. -\fBfile\fR -will inport a text file. If no option is given, udev will determine it from the executable bit of of the file permissions. -.TP -\fBWAIT_FOR_SYSFS\fR -Wait for the specified sysfs file of the device to be created. Can be used to fight against kernel sysfs timing issues. -.TP -\fBOPTIONS\fR -\fBlast_rule\fR -stops further rules application. No later rules will have any effect. -\fBignore_device\fR -will ignore this event completely. -\fBignore_remove\fR -will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. -\fBall_partitions\fR -will create device nodes for all available partitions of a block device. This may be useful for removable media. -.PP -The -\fBNAME\fR, -\fBSYMLINK\fR, -\fBPROGRAM\fR, -\fBOWNER\fR -and -\fBGROUP\fR -fields support simple printf\-like string substitutions: -.TP -\fB$kernel\fR, \fB%k\fR -The kernel name for this device. -.TP -\fB$number\fR, \fB%n\fR -The kernel number for this device. For example, 'sda3' has kernel number of '3' -.TP -\fB$devpath\fR, \fB%p\fR -The devpath of the device. -.TP -\fB$id\fR, \fB%b\fR -The name of the device matched while searching the devpath upwards for -\fBBUS\fR, -\fBID\fR \fBDRIVER\fR -and -\fBSYSFS\fR. -.TP -\fB$sysfs{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR -The value of a sysfs attribute found at the current or a parent device. -.TP -\fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR -The value of an environment variable. -.TP -\fB$major\fR, \fB%M\fR -The kernel major number for the device. -.TP -\fB$minor\fR \fB%m\fR -The kernel minor number for the device. -.TP -\fB$result\fR, \fB%c\fR -The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: -\fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: -\fB%c{N+}\fR -.TP -\fB$parent\fR, \fB%P\fR -The node name of the parent device. -.TP -\fB$root\fR, \fB%r\fR -The udev_root value. -.TP -\fB$tempnode\fR, \fB%N\fR -The name of a created temporary device node to provide access to the device from a external program before the real node is created. -.TP -\fB%%\fR -The '%' character itself. -.TP -\fB$$\fR -The '$' character itself. -.PP -The count of characters to be substituted may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute -.SH "ENVIRONMENT" -.TP -\fBACTION\fR -\fIadd\fR -or -\fIremove\fR -signifies the addition or the removal of a device. -.TP -\fBDEVPATH\fR -The sysfs devpath without the mountpoint but a leading slash. -.TP -\fBSUBSYSTEM\fR -The kernel subsystem the device belongs to. -.TP -\fBUDEV_LOG\fR -Overrides the syslog priority specified in the config file. -.SH "AUTHOR" -.PP -Written by Greg Kroah\-Hartman - -and Kay Sievers -. With much help from Dan Stekloff - -and many others. -.SH "SEE ALSO" -.PP -\fBudev\fR(8), -\fBudevinfo\fR(8), -\fBudevd\fR(8), -\fBudevmonitor\fR(8) -- cgit v1.2.3-54-g00ecf From 0d210b3ad9ebca9fb60c79b2ebbd3d1482485bd3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Jan 2006 20:24:26 +0100 Subject: recreate man pages from xml source Signed-off-by: Kay Sievers --- udevd.8 | 12 ++++++------ udevinfo.8 | 32 ++++++++++++++++---------------- udevmonitor.8 | 4 ++-- udevsend.8 | 12 ++++++------ udevstart.8 | 4 ++-- udevtest.8 | 4 ++-- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/udevd.8 b/udevd.8 index c6efe9a03a..bf7e3c7f2f 100644 --- a/udevd.8 +++ b/udevd.8 @@ -1,5 +1,5 @@ .\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "UDEVD" "8" "August 2005" "udev" "udevd, udevcontrol" @@ -23,10 +23,10 @@ udevd listens to kernel uevents and passes the incoming events to udev. It ensur Detach and run in the background. .TP \fBlog_priority=\fR\fB\fIvalue\fR\fR -udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: -\fBerr\fR, -\fBinfo\fR -and +udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: +\fBerr\fR, +\fBinfo\fR +and \fBdebug\fR. .TP \fBstop_exec_queue\fR @@ -40,7 +40,7 @@ udevcontrol starts the execution of events from udevd. Overrides the syslog priority specified in the config file. .SH "AUTHOR" .PP -Written by Kay Sievers +Written by Kay Sievers . .SH "SEE ALSO" .PP diff --git a/udevinfo.8 b/udevinfo.8 index fc7001dc21..b74a690584 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -1,5 +1,5 @@ .\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "UDEVINFO" "8" "August 2005" "udev" "udevinfo" @@ -18,15 +18,15 @@ udevinfo queries the udev database for device information stored in the udev dat .SH "OPTIONS" .TP \fB\-q\fR -Query the database for specified type of device data. It needs the -\fB\-p\fR -or -\fB\-n\fR -to identify the specified device. Valid queries are: -\fBname\fR, -\fBsymlink\fR, -\fBpath\fR, -\fBenv\fR, +Query the database for specified type of device data. It needs the +\fB\-p\fR +or +\fB\-n\fR +to identify the specified device. Valid queries are: +\fBname\fR, +\fBsymlink\fR, +\fBpath\fR, +\fBenv\fR, \fBall\fR. .TP \fB\-a\fR @@ -39,11 +39,11 @@ The sysfs path of the device to query. The name of the device node or a symlink to query .TP \fB\-r\fR -The udev root directory: -\fI/dev\fR. If used in conjunction with a -\fBname\fR -or -\fBsymlink\fR +The udev root directory: +\fI/dev\fR. If used in conjunction with a +\fBname\fR +or +\fBsymlink\fR query, the query returns the absolute path. .TP \fB\-e\fR @@ -53,7 +53,7 @@ Export the content of the udev database. Print help text. .SH "AUTHOR" .PP -Written by Kay Sievers +Written by Kay Sievers . .SH "SEE ALSO" .PP diff --git a/udevmonitor.8 b/udevmonitor.8 index 6f60130cc7..e302ba1ab2 100644 --- a/udevmonitor.8 +++ b/udevmonitor.8 @@ -1,5 +1,5 @@ .\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "UDEVMONITOR" "8" "August 2005" "udev" "udevmonitor" @@ -21,7 +21,7 @@ udevmonitor listens to the kernel uevents and events send out by a udev rule and Print the complete environment for all events. Can be used to compare the kernel supplied and the udev added environment values. .SH "AUTHOR" .PP -Written by Kay Sievers +Written by Kay Sievers . .SH "SEE ALSO" .PP diff --git a/udevsend.8 b/udevsend.8 index d483f22133..97d09d3110 100644 --- a/udevsend.8 +++ b/udevsend.8 @@ -1,5 +1,5 @@ .\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "UDEVSEND" "8" "August 2005" "udev" "udevsend" @@ -18,9 +18,9 @@ Usually the udev daemon listens directly to the kernel uevents. udevsend may be .SH "ENVIRONMENT" .TP \fBACTION\fR -\fIadd\fR -or -\fIremove\fR +\fIadd\fR +or +\fIremove\fR signifies the addition or the removal of a device. .TP \fBDEVPATH\fR @@ -30,9 +30,9 @@ The sysfs devpath without the mountpoint but a leading slash. The kernel subsystem the device belongs to. .SH "AUTHOR" .PP -Written by Kay Sievers +Written by Kay Sievers . .SH "SEE ALSO" .PP -\fBudev\fR(8), +\fBudev\fR(8), \fBudevd\fR(8) diff --git a/udevstart.8 b/udevstart.8 index ea7a59ea8b..bbc022c2c2 100644 --- a/udevstart.8 +++ b/udevstart.8 @@ -1,5 +1,5 @@ .\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "UDEVSTART" "8" "August 2005" "udev" "udevstart" @@ -17,7 +17,7 @@ udevstart \- populate initial device directory udevstart scans the kernel exported device information available in sysfs for devices which require a device node to operate and creates the node using the specified udev rules. udevstart is used to create the initial device directory after system bootup. .SH "AUTHOR" .PP -Written by Harald Hoyer +Written by Harald Hoyer . .SH "SEE ALSO" .PP diff --git a/udevtest.8 b/udevtest.8 index ea0ea59238..f59c2e921c 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -1,5 +1,5 @@ .\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "UDEVTEST" "8" "August 2005" "udev" "udevtest" @@ -17,7 +17,7 @@ udevtest \- simulate a udev run and print the action to the console udevtest simulates a udev run for the given device and prints out the name of the node udev would have created, or the name of the network interface, that would have been renamend. .SH "AUTHOR" .PP -Written by Greg Kroah\-Hartman +Written by Greg Kroah\-Hartman . .SH "SEE ALSO" .PP -- cgit v1.2.3-54-g00ecf From c233b59baaabe55a8f99dc37c4ee9011b85f8917 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Jan 2006 20:29:37 +0100 Subject: remove udev, udevstart, udevsend from the default installation They still get compiled and are used for the test program, but everything should just work with the daemon and the kernel "uevent" triggers these days. Signed-off-by: Kay Sievers --- Makefile | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Makefile b/Makefile index 500c8db6d2..94ec41a0a6 100644 --- a/Makefile +++ b/Makefile @@ -262,9 +262,7 @@ install-man: $(INSTALL_DATA) -D udev.7 $(DESTDIR)$(mandir)/man7/udev.7 $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 - $(INSTALL_DATA) -D udevstart.8 $(DESTDIR)$(mandir)/man8/udevstart.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 - $(INSTALL_DATA) -D udevsend.8 $(DESTDIR)$(mandir)/man8/udevsend.8 $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ @@ -277,10 +275,8 @@ uninstall-man: - rm -f $(DESTDIR)$(mandir)/man7/udev.7 - rm -f $(DESTDIR)$(mandir)/man8/udevinfo.8 - rm -f $(DESTDIR)$(mandir)/man8/udevtest.8 - - rm -f $(DESTDIR)$(mandir)/man8/udevstart.8 - rm -f $(DESTDIR)$(mandir)/man8/udevd.8 - rm -f $(DESTDIR)$(mandir)/man8/udevmonitor.8 - - rm -f $(DESTDIR)$(mandir)/man8/udevsend.8 - rm -f $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ @@ -290,14 +286,11 @@ uninstall-man: install-bin: $(INSTALL) -d $(DESTDIR)$(udevdir) - $(INSTALL_PROGRAM) -D udev $(DESTDIR)$(sbindir)/udev $(INSTALL_PROGRAM) -D udevd $(DESTDIR)$(sbindir)/udevd - $(INSTALL_PROGRAM) -D udevsend $(DESTDIR)$(sbindir)/udevsend $(INSTALL_PROGRAM) -D udevcontrol $(DESTDIR)$(sbindir)/udevcontrol $(INSTALL_PROGRAM) -D udevmonitor $(DESTDIR)$(usrsbindir)/udevmonitor $(INSTALL_PROGRAM) -D udevinfo $(DESTDIR)$(usrbindir)/udevinfo $(INSTALL_PROGRAM) -D udevtest $(DESTDIR)$(usrbindir)/udevtest - $(INSTALL_PROGRAM) -D udevstart $(DESTDIR)$(sbindir)/udevstart @extras="$(EXTRAS)"; for target in $$extras; do \ echo $$target; \ $(MAKE) -C $$target $@ || exit 1; \ @@ -310,11 +303,8 @@ endif .PHONY: install-bin uninstall-bin: - - rm -f $(DESTDIR)$(sbindir)/udev - rm -f $(DESTDIR)$(sbindir)/udevd - - rm -f $(DESTDIR)$(sbindir)/udevsend - rm -f $(DESTDIR)$(sbindir)/udevcontrol - - rm -f $(DESTDIR)$(sbindir)/udevstart - rm -f $(DESTDIR)$(usrsbindir)/udevmonitor - rm -f $(DESTDIR)$(usrbindir)/udevinfo - rm -f $(DESTDIR)$(usrbindir)/udevtest -- cgit v1.2.3-54-g00ecf From 4a2c3aad07a97845ac61701d750cbf6487b36c77 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Jan 2006 21:02:30 +0100 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/50-udev-default.rules | 4 ---- etc/udev/suse/80-sysconfig.rules | 4 ++-- etc/udev/suse/90-hal.rules | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 etc/udev/suse/90-hal.rules diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 667b0ae9b1..4f69c666ac 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -43,7 +43,6 @@ KERNEL=="js*", NAME="input/%k", MODE="0644" KERNEL=="ts*", NAME="input/%k", MODE="0600" KERNEL=="uinput", NAME="input/%k", MODE="0600" KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" -KERNEL=="input[0-9]*", ACTION=="add", RUN+="input.sh" # printer SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" @@ -121,9 +120,6 @@ SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/mo SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" -# load IDE modules -SUBSYSTEM=="ide", ACTION=="add", RUN+="ide.sh" - # device mapper KERNEL=="device-mapper", NAME="%k", SYMLINK+="mapper/control" diff --git a/etc/udev/suse/80-sysconfig.rules b/etc/udev/suse/80-sysconfig.rules index d6778647ba..137754e166 100644 --- a/etc/udev/suse/80-sysconfig.rules +++ b/etc/udev/suse/80-sysconfig.rules @@ -15,7 +15,7 @@ SUBSYSTEM=="macio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-%p -o hotplug" SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-%p -o hotplug" SUBSYSTEM=="pnp", ACTION=="add", RUN+="/sbin/hwup pnp-devpath-%p -o hotplug" -#SUBSYSTEM=="ide", ACTION=="add", RUN+="/sbin/hwup ide-devpath-%p -o hotplug" -#SUBSYSTEM=="input", KERNEL=="input[0-9]*", ACTION=="add", RUN+="/sbin/hwup input-devpath-%p -o hotplug" +SUBSYSTEM=="ide", ACTION=="add", RUN+="/sbin/hwup ide-devpath-%p -o hotplug" +SUBSYSTEM=="input", KERNEL=="input[0-9]*", ACTION=="add", RUN+="/sbin/hwup input-devpath-%p -o hotplug" LABEL="sysconfig_end" diff --git a/etc/udev/suse/90-hal.rules b/etc/udev/suse/90-hal.rules deleted file mode 100644 index b0b36330df..0000000000 --- a/etc/udev/suse/90-hal.rules +++ /dev/null @@ -1 +0,0 @@ -RUN+="socket:/org/freedesktop/hal/udev_event" -- cgit v1.2.3-54-g00ecf From a9bd2ed84a7b0871c281adc8226f12ae46da4de0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jan 2006 01:28:31 +0100 Subject: rename apply_format() cause it is public now Signed-off-by: Kay Sievers --- udev.c | 2 +- udev_rules.c | 16 ++++++++-------- udev_rules.h | 4 ++-- udevd.c | 2 +- udevstart.c | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/udev.c b/udev.c index f808abf427..6387d0b14e 100644 --- a/udev.c +++ b/udev.c @@ -165,7 +165,7 @@ int main(int argc, char *argv[], char *envp[]) char program[PATH_SIZE]; strlcpy(program, name_loop->name, sizeof(program)); - apply_format(udev, program, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); } } diff --git a/udev_rules.c b/udev_rules.c index fbcbbe0083..90dc0243fe 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -362,7 +362,7 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) return -1; } -void apply_format(struct udevice *udev, char *string, size_t maxsize) +void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) { char temp[PATH_SIZE]; char temp2[PATH_SIZE]; @@ -818,7 +818,7 @@ try_parent: char result[PATH_SIZE]; strlcpy(program, key_val(rule, &rule->program), sizeof(program)); - apply_format(udev, program, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_INFO)) != 0) { dbg("PROGRAM is false"); udev->program_result[0] = '\0'; @@ -851,7 +851,7 @@ try_parent: int rc = -1; strlcpy(import, key_val(rule, &rule->import), sizeof(import)); - apply_format(udev, import, sizeof(import)); + udev_rules_apply_format(udev, import, sizeof(import)); dbg("check for IMPORT import='%s'", import); if (rule->import_type == IMPORT_PROGRAM) { rc = import_program_into_env(udev, import); @@ -941,14 +941,14 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) udev->owner_final = 1; strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner)); - apply_format(udev, udev->owner, sizeof(udev->owner)); + udev_rules_apply_format(udev, udev->owner, sizeof(udev->owner)); dbg("applied owner='%s' to '%s'", udev->owner, udev->dev->kernel_name); } if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) { if (rule->group.operation == KEY_OP_ASSIGN_FINAL) udev->group_final = 1; strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); - apply_format(udev, udev->group, sizeof(udev->group)); + udev_rules_apply_format(udev, udev->group, sizeof(udev->group)); dbg("applied group='%s' to '%s'", udev->group, udev->dev->kernel_name); } @@ -965,7 +965,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) name_list_cleanup(&udev->symlink_list); } strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); - apply_format(udev, temp, sizeof(temp)); + udev_rules_apply_format(udev, temp, sizeof(temp)); count = replace_untrusted_chars(temp); if (count) info("%i untrusted character(s) replaced" , count); @@ -996,7 +996,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) int count; name_set = 1; strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); - apply_format(udev, udev->name, sizeof(udev->name)); + udev_rules_apply_format(udev, udev->name, sizeof(udev->name)); count = replace_untrusted_chars(udev->name); if (count) info("%i untrusted character(s) replaced", count); @@ -1082,7 +1082,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) name_list_cleanup(&udev->run_list); } strlcpy(program, key_val(rule, &rule->run), sizeof(program)); - apply_format(udev, program, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); dbg("add run '%s'", program); name_list_add(&udev->run_list, program, 0); if (rule->run.operation == KEY_OP_ASSIGN_FINAL) diff --git a/udev_rules.h b/udev_rules.h index b183d9b531..e4d5ebd765 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -105,8 +105,6 @@ struct udev_rules { extern int udev_rules_init(struct udev_rules *rules, int resolve_names); extern void udev_rules_cleanup(struct udev_rules *rules); -extern void apply_format(struct udevice *udev, char *string, size_t maxsize); - extern void udev_rules_iter_init(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label); @@ -114,4 +112,6 @@ extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const c extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev); extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev); +extern void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize); + #endif diff --git a/udevd.c b/udevd.c index 8a352e1eb9..4ed2f94bfc 100644 --- a/udevd.c +++ b/udevd.c @@ -127,7 +127,7 @@ static int udev_event_process(struct uevent_msg *msg) char program[PATH_SIZE]; strlcpy(program, name_loop->name, sizeof(program)); - apply_format(udev, program, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); if (run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO))) retval = -1; diff --git a/udevstart.c b/udevstart.c index 11bdf79183..fdb2ae3808 100644 --- a/udevstart.c +++ b/udevstart.c @@ -164,7 +164,7 @@ run: char program[PATH_SIZE]; strlcpy(program, name_loop->name, sizeof(program)); - apply_format(udev, program, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); } } -- cgit v1.2.3-54-g00ecf From ad27f5b3962d4cb1e4fcc25d3d0c7d0c81abc82a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jan 2006 02:18:13 +0100 Subject: udevtest: add udev_rules_apply_format() to RUN keys Signed-off-by: Kay Sievers --- udev_add.c | 14 ++++++-------- udevtest.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/udev_add.c b/udev_add.c index 2c66a0ba8d..6de2858313 100644 --- a/udev_add.c +++ b/udev_add.c @@ -135,16 +135,14 @@ static int create_node(struct udevice *udev) gid = lookup_group(udev->group); } - if (!udev->test_run) { - info("creating device node '%s'", filename); + info("creating device node '%s', major = '%d', minor = '%d', " "mode = '%#o', uid = '%d', gid = '%d'", + filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid); + + if (!udev->test_run) if (udev_make_node(udev, filename, udev->devt, udev->mode, uid, gid) != 0) goto error; - setenv("DEVNAME", filename, 1); - } else { - info("creating device node '%s', major = '%d', minor = '%d', " - "mode = '%#o', uid = '%d', gid = '%d'", filename, - major(udev->devt), minor(udev->devt), udev->mode, uid, gid); - } + + setenv("DEVNAME", filename, 1); /* create all_partitions if requested */ if (udev->partitions) { diff --git a/udevtest.c b/udevtest.c index 22fd3735c2..d736711a3f 100644 --- a/udevtest.c +++ b/udevtest.c @@ -113,11 +113,16 @@ int main(int argc, char *argv[], char *envp[]) info("looking at device '%s' from subsystem '%s'", udev->dev->devpath, udev->dev->subsystem); retval = udev_device_event(&rules, udev); - if (retval == 0) { + if (retval == 0 && !udev->ignore_device && udev_run) { struct name_entry *name_loop; - list_for_each_entry(name_loop, &udev->run_list, node) - info("run: '%s'", name_loop->name); + list_for_each_entry(name_loop, &udev->run_list, node) { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); + info("run: '%s'", program); + } } exit: -- cgit v1.2.3-54-g00ecf From 37854ffc9ae60da66d5525225c93eb1754a780bb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jan 2006 02:21:07 +0100 Subject: let "ignore_device" always return the event successfully Signed-off-by: Kay Sievers --- udev.c | 6 ++++-- udev_device.c | 14 ++++++-------- udevd.c | 3 ++- udevstart.c | 15 ++++++++------- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/udev.c b/udev.c index 6387d0b14e..17ab635f1e 100644 --- a/udev.c +++ b/udev.c @@ -154,7 +154,7 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_device_event(&rules, udev); - if (!retval && udev_run && !list_empty(&udev->run_list)) { + if (retval == 0 && !udev->ignore_device && udev_run) { struct name_entry *name_loop; dbg("executing run list"); @@ -178,5 +178,7 @@ fail: exit: logging_close(); - return retval; + if (retval != 0) + return 1; + return 0; } diff --git a/udev_device.c b/udev_device.c index 781787ef4a..5db27093d4 100644 --- a/udev_device.c +++ b/udev_device.c @@ -88,14 +88,14 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) udev_rules_get_name(rules, udev); if (udev->ignore_device) { info("device event will be ignored"); - return -1; + return 0; } /* create node, store in db */ if (udev->name[0] != '\0') retval = udev_add_device(udev); else info("device node creation supressed"); - return 0; + return retval; } if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { @@ -104,7 +104,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) udev_rules_get_run(rules, udev); if (udev->ignore_device) { info("device event will be ignored"); - return -1; + return 0; } /* get data from db, remove db-entry, delete node */ retval = udev_remove_device(udev); @@ -112,15 +112,13 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* restore stored persistent data */ list_for_each_entry(name_loop, &udev->env_list, node) putenv(name_loop->name); - return 0; + return retval; } - /* default devices */ + /* default devices without a node */ udev_rules_get_run(rules, udev); - if (udev->ignore_device) { + if (udev->ignore_device) info("device event will be ignored"); - return -1; - } return retval; } diff --git a/udevd.c b/udevd.c index 4ed2f94bfc..c94fdc74d8 100644 --- a/udevd.c +++ b/udevd.c @@ -117,9 +117,10 @@ static int udev_event_process(struct uevent_msg *msg) retval = udev_device_event(&rules, udev); /* run programs collected by RUN-key*/ - if (retval == 0) { + if (retval == 0 && !udev->ignore_device && udev_run) { struct name_entry *name_loop; + dbg("executing run list"); list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) pass_env_to_socket(&name_loop->name[strlen("socket:")], msg->devpath, msg->action); diff --git a/udevstart.c b/udevstart.c index fdb2ae3808..8f8342ff48 100644 --- a/udevstart.c +++ b/udevstart.c @@ -108,6 +108,7 @@ static int add_device(const char *devpath) { struct sysfs_device *dev; struct udevice *udev; + int retval; /* clear and set environment for next event */ clearenv(); @@ -146,14 +147,14 @@ static int add_device(const char *devpath) dbg("device event will be ignored"); goto exit; } - if (udev->name[0] == '\0') { - dbg("device node creation supressed"); - goto run; + if (udev->name[0] != '\0') + retval = udev_add_device(udev); + else { + info("device node creation supressed"); + goto exit; } - udev_add_device(udev); -run: - if (udev_run && !list_empty(&udev->run_list)) { + if (retval == 0 && !udev->ignore_device && udev_run) { struct name_entry *name_loop; dbg("executing run list"); @@ -169,9 +170,9 @@ run: } } } + exit: udev_device_cleanup(udev); - return 0; } -- cgit v1.2.3-54-g00ecf From 1a72d06f7be696cf6f6753fdc01c0ff8171240ea Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jan 2006 02:45:48 +0100 Subject: 082 release --- ChangeLog | 27 +++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 35 +++++++++++++++++++++++++++++++++++ TODO | 2 +- 4 files changed, 64 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 68db4db036..9ca3e9354f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +Summary of changes from v081 to v082 +============================================ + +Andrey Borzenkov: + substitute format chars in RUN after rule matching + +Kay Sievers: + scsi_id, usb_id: request device parent by subsystem + path_id: work with "all devices in /sys/devices" + ignore all messages with missing devpath or action + Makefile: remove dynamic config file generation + path_id: handle fiber channel (Hannes Reinecke ) + usb_id: don't fail on other subsytems than "scsi" + don't do RUN if "ignore_device" is given + increase kernel uevent buffer size + move udev(8) manpage to udev(7) + recreate man pages from xml source + remove udev, udevstart, udevsend from the default installation + update SUSE rules + rename apply_format() cause it is public now + udevtest: add udev_rules_apply_format() to RUN keys + let "ignore_device" always return the event successfully + +Olivier Blin: + fixes udev build with -fpie + + Summary of changes from v080 to v081 ============================================ diff --git a/Makefile b/Makefile index 94ec41a0a6..09511c4693 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 081 +VERSION = 082 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 68f7b88067..d04dcd83be 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,38 @@ +udev 082 +======== +The udev man page has moced to udev(7) as it doesnot describe a command +anymore. The programs udev, udevstart and udevsend are no longer installed +by default and must be copied manually, if they should be installed or +included in a package. + +Fix a bug where "ignore_device" could run earlier collected RUN keys before +the ignore rule was applied. + +More preparation for future sysfs changes. usb_id and scsi_id no longer +depend on a magic order of devices in the /devices chain. Specific devices +should be requested by their subsytem. + +This will always find the scsi parent device without depending on a specific +path position: + dev = sysfs_device_get(devpath); + dev_usb = sysfs_device_get_parent_with_subsystem(dev, "scsi"); + +The "device" link in the current sysfs layout will be automatically +_resolved_ as a parent and in the new sysfs layout it will just _be_ the +parent in the devpath. If a device is requested by it's symlink, like all +class devices in the new sysfs layout will look like, it gets automatically +resolved and substituted with the real devpath and not the symlink path. + +Note: +A similar logic must be applied to _all_ sysfs users, including +scripts, that search along parent devices in sysfs. The explicit use of +the "device" link must be avoided. With the future sysfs layout all +DEVPATH's will start with /devices/ and have a "subsystem" symlink poiting +back to the "class" or the "bus". The layout of the parent devices in +/devices is not necessarily expected to be stable across kernel releases and +searching for parents by their subsystem should make sysfs users tolerant +for changed parent chains. + udev 081 ======== Prepare udev to work with the experimental kernel patch, that moves diff --git a/TODO b/TODO index bdd2e1e1f6..5047f06da9 100644 --- a/TODO +++ b/TODO @@ -15,7 +15,7 @@ udev version: o remove MODALIAS + $modalias (ENV{MODALIAS}, $env{MODALIAS}, $sysfs{modalias} will do it) - o remove udevstart, udevsend + o remove udevsend, udevstart and their man pages (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer want to guess event properties from sysfs like udevstart is doing it) -- cgit v1.2.3-54-g00ecf From 4cfdeaf3bf82b50fb6af123511d2f94078fe7df2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 Jan 2006 02:16:58 +0100 Subject: udevstart: fix NAME="" which prevents RUN from being executed Thanks to Olivier Blin for finding this. Signed-off-by: Kay Sievers --- udevstart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevstart.c b/udevstart.c index 8f8342ff48..d9d6a7b521 100644 --- a/udevstart.c +++ b/udevstart.c @@ -108,7 +108,7 @@ static int add_device(const char *devpath) { struct sysfs_device *dev; struct udevice *udev; - int retval; + int retval = 0; /* clear and set environment for next event */ clearenv(); -- cgit v1.2.3-54-g00ecf From 864412e02df16555c02da9ccb0a67fddb6628acd Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Thu, 26 Jan 2006 02:18:01 +0100 Subject: man page: document when substitutions are applied for RUN and other keys --- docs/udev.xml | 8 ++++++-- udev.7 | 9 ++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/udev.xml b/docs/udev.xml index 7e29077977..e0542a6be1 100644 --- a/docs/udev.xml +++ b/docs/udev.xml @@ -353,8 +353,12 @@ The , , , - and fields support simple - printf-like string substitutions: + , and + fields support simple printf-like string substitutions. The + format chars gets applied after all rules have been processed, right before the program + is executed. It allows the use of the complete environment set by earlier matching + rules. For all other fields, substitutions are applied while the individual rule is + being processed. The available substitutions are: , diff --git a/udev.7 b/udev.7 index a7e2f5a4e7..711bd0861b 100644 --- a/udev.7 +++ b/udev.7 @@ -164,10 +164,13 @@ The \fBNAME\fR, \fBSYMLINK\fR, \fBPROGRAM\fR, -\fBOWNER\fR -and +\fBOWNER\fR, \fBGROUP\fR -fields support simple printf\-like string substitutions: +and +\fBRUN\fR +fields support simple printf\-like string substitutions. The +\fBRUN\fR +format chars gets applied after all rules have been processed, right before the program is executed. It allows the use of the complete environment set by earlier matching rules. For all other fields, substitutions are applied while the individual rule is being processed. The available substitutions are: .TP \fB$kernel\fR, \fB%k\fR The kernel name for this device. -- cgit v1.2.3-54-g00ecf From f7ed0d113a964aae8da4ca752d1330704adb1c65 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Thu, 26 Jan 2006 02:24:13 +0100 Subject: check for ignore_device in loop looks redundant --- udevstart.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/udevstart.c b/udevstart.c index d9d6a7b521..e5ce7af030 100644 --- a/udevstart.c +++ b/udevstart.c @@ -149,12 +149,10 @@ static int add_device(const char *devpath) } if (udev->name[0] != '\0') retval = udev_add_device(udev); - else { + else info("device node creation supressed"); - goto exit; - } - if (retval == 0 && !udev->ignore_device && udev_run) { + if (retval == 0 && udev_run) { struct name_entry *name_loop; dbg("executing run list"); -- cgit v1.2.3-54-g00ecf From d2f605c8d61e4c5ef129f93510ab8b38e32cee97 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 Jan 2006 03:59:13 +0100 Subject: find programs in /lib/udev for IMPORT if {program} is not given Signed-off-by: Kay Sievers --- udev_rules_parse.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 4fcd6db08e..376006c7c4 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -366,6 +366,16 @@ static int add_to_rules(struct udev_rules *rules, char *line) pos = strchr(file, ' '); if (pos) pos[0] = '\0'; + + /* allow programs in /lib/udev called without the path */ + if (strchr(file, '/') == NULL) { + strlcpy(file, "/lib/udev/", sizeof(file)); + strlcat(file, value, sizeof(file)); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + } + dbg("IMPORT auto mode for '%s'", file); if (!lstat(file, &stats) && (stats.st_mode & S_IXUSR)) { dbg("IMPORT is executable, will be executed (autotype)"); -- cgit v1.2.3-54-g00ecf From 36af2ddcb92c51acad0f909bb5dfb090cea9c5ed Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 Jan 2006 04:38:33 +0100 Subject: don't add $SUBSYSTEM automatically as $1 to programs Signed-off-by: Kay Sievers --- RELEASE-NOTES | 12 ++++++++++++ test/udev-test.pl | 9 --------- udev_utils_run.c | 12 ++++++------ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d04dcd83be..42048cce53 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,15 @@ +udev 083 +======== +Fix a bug where NAME="" would prevent RUN from beeing executed. + +RUN="/bin/program" does no longer automatically add the subsystem +as the first parameter. This is from the days of /sbin/hotplug +which is dead now and it's just confusing to need to add space at the +end of the program name to prevent this. If you use rules that +depend on this, like the old "udev_run_hotlugd" and "udev_run_devd", +switch them to: RUN+="/bin/program $env{SUBSYSTEM}", otherwise +they will no longer work as expected. + udev 082 ======== The udev man page has moced to udev(7) as it doesnot describe a command diff --git a/test/udev-test.pl b/test/udev-test.pl index 555d36e7f2..b44bd18af5 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -298,15 +298,6 @@ BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special--*", NAME= BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-device-", NAME="%c-3-%n" BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-devic", NAME="%c-4-%n" BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-*", NAME="%c-%n" -EOF - }, - { - desc => "program result substitution (no argument should be subsystem)", - subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "subsys_block" , - rules => < Date: Fri, 27 Jan 2006 01:40:26 +0100 Subject: remove redundant substitution of RUN key Thanks to Andrey Borzenkov for the initial patch. Signed-off-by: Kay Sievers --- udev_rules.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 90dc0243fe..f1bbfd854c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -994,6 +994,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) /* set name, later rules with name set will be ignored */ if (rule->name.operation != KEY_OP_UNSET) { int count; + name_set = 1; strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); udev_rules_apply_format(udev, udev->name, sizeof(udev->name)); @@ -1008,17 +1009,14 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) } if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { - char program[PATH_SIZE]; - if (rule->run.operation == KEY_OP_ASSIGN_FINAL) udev->run_final = 1; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { info("reset run list"); name_list_cleanup(&udev->run_list); } - strlcpy(program, key_val(rule, &rule->run), sizeof(program)); - dbg("add run '%s'", program); - name_list_add(&udev->run_list, program, 0); + dbg("add run '%s'", key_val(rule, &rule->run)); + name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); } if (rule->last_rule) { @@ -1075,16 +1073,12 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) } if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { - char program[PATH_SIZE]; - if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { info("reset run list"); name_list_cleanup(&udev->run_list); } - strlcpy(program, key_val(rule, &rule->run), sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - dbg("add run '%s'", program); - name_list_add(&udev->run_list, program, 0); + dbg("add run '%s'", key_val(rule, &rule->run)); + name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); if (rule->run.operation == KEY_OP_ASSIGN_FINAL) break; } -- cgit v1.2.3-54-g00ecf From cef28db9db6e40271ce72ee42c1bb1a3eecbe25c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 27 Jan 2006 01:41:07 +0100 Subject: 083 release --- ChangeLog | 14 ++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 12 ++++++------ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ca3e9354f..a2137019cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Summary of changes from v082 to v083 +============================================ + +Andrey Borzenkov: + man page: document when substitutions are applied for RUN and other keys + check for ignore_device in loop looks redundant + +Kay Sievers: + udevstart: fix NAME="" which prevents RUN from being executed + find programs in /lib/udev for IMPORT if {program} is not given + don't add $SUBSYSTEM automatically as $1 to programs + remove redundant substitution of RUN key + + Summary of changes from v081 to v082 ============================================ diff --git a/Makefile b/Makefile index 09511c4693..9da2964ddf 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 082 +VERSION = 083 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 42048cce53..cce8dc03ce 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -2,13 +2,13 @@ udev 083 ======== Fix a bug where NAME="" would prevent RUN from beeing executed. -RUN="/bin/program" does no longer automatically add the subsystem +RUN="/bin/program" does not longer automatically add the subsystem as the first parameter. This is from the days of /sbin/hotplug -which is dead now and it's just confusing to need to add space at the -end of the program name to prevent this. If you use rules that -depend on this, like the old "udev_run_hotlugd" and "udev_run_devd", -switch them to: RUN+="/bin/program $env{SUBSYSTEM}", otherwise -they will no longer work as expected. +which is dead now and it's just confusing to need to add a space at +the end of the program name to prevent this. +If you use rules that need the subsystem as the first parameter, +like the old "udev_run_hotlugd" and "udev_run_devd", add the subsystem +to the key like RUN+="/bin/program $env{SUBSYSTEM}". udev 082 ======== -- cgit v1.2.3-54-g00ecf From a6aa9d70a470e02ccaf68bdb1929a2b7a3c5d030 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 27 Jan 2006 02:17:59 +0100 Subject: update SUSE rules Signed-off-by: Kay Sievers --- etc/udev/suse/05-udev-early.rules | 9 +++++---- etc/udev/suse/50-udev-default.rules | 14 +++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/etc/udev/suse/05-udev-early.rules b/etc/udev/suse/05-udev-early.rules index dfdbdff0c9..5818d43335 100644 --- a/etc/udev/suse/05-udev-early.rules +++ b/etc/udev/suse/05-udev-early.rules @@ -1,8 +1,9 @@ -# sysfs is populated after the event is sent -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" - # ignore these events until someone needs them SUBSYSTEM=="drivers", OPTIONS="ignore_device" SUBSYSTEM=="module", OPTIONS="ignore_device" +# sysfs is populated after the event is sent +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" + diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 4f69c666ac..838d5b91a7 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -103,7 +103,7 @@ KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" # fix floppy devices KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" -KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{cmos} -m %M /dev/%k" KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/rm -f $root/%k*" # block devices @@ -112,12 +112,12 @@ SUBSYSTEM=="block", GROUP="disk", MODE="0640" # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC # sr: 4 TYPE_WORM, 5 TYPE_ROM # st/osst: 1 TYPE_TAPE -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys/$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys/$DEVPATH/timeout'" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" # device mapper -- cgit v1.2.3-54-g00ecf From 4942c78cb01ef4100a3cbce577fc3262b82d9be4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 27 Jan 2006 21:36:29 +0100 Subject: switch CROSS to CROSS_COMPILE This matches what the kernel uses and was a suggestion from: KRONSTORFER Horst Signed-off-by: Kay Sievers --- Makefile | 14 +++++++------- RELEASE-NOTES | 4 ++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 9da2964ddf..db8ecdacc6 100644 --- a/Makefile +++ b/Makefile @@ -109,13 +109,13 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} PWD = $(shell pwd) -CROSS = -CC = $(CROSS)gcc -LD = $(CROSS)gcc -AR = $(CROSS)ar -RANLIB = $(CROSS)ranlib +CROSS_COMPILE = +CC = $(CROSS_COMPILE)gcc +LD = $(CROSS_COMPILE)gcc +AR = $(CROSS_COMPILE)ar +RANLIB = $(CROSS_COMPILE)ranlib HOSTCC = gcc -STRIP = $(CROSS)strip +STRIP = $(CROSS_COMPILE)strip STRIPCMD = $(STRIP) -s CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 @@ -145,7 +145,7 @@ ifeq ($(strip $(USE_GCOV)),true) endif ifeq ($(strip $(USE_KLIBC)),true) - KLCC = /usr/bin/$(CROSS)klcc + KLCC = /usr/bin/$(CROSS_COMPILE)klcc CC = $(KLCC) LD = $(KLCC) V = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index cce8dc03ce..27545893c9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 084 +======== +CROSS changed to CROSS_COMPILE to match the kernel build. + udev 083 ======== Fix a bug where NAME="" would prevent RUN from beeing executed. -- cgit v1.2.3-54-g00ecf From 1ef985452b0247ec32799b64ecabb85cb8ffe473 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 28 Jan 2006 04:44:51 +0100 Subject: replace fancy silent build program by simple kernel build like logic Signed-off-by: Kay Sievers --- Makefile | 102 +++++---- ccdv.c | 387 --------------------------------- extras/ata_id/Makefile | 17 +- extras/cdrom_id/Makefile | 15 +- extras/dasd_id/Makefile | 15 +- extras/edd_id/Makefile | 15 +- extras/firmware/Makefile | 15 +- extras/floppy/Makefile | 15 +- extras/run_directory/Makefile | 15 +- extras/scsi_id/Makefile | 36 ++- extras/usb_id/Makefile | 15 +- extras/volume_id/Makefile | 19 +- extras/volume_id/libvolume_id/Makefile | 14 +- 13 files changed, 168 insertions(+), 512 deletions(-) delete mode 100644 ccdv.c diff --git a/Makefile b/Makefile index db8ecdacc6..f650233cee 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ USE_STATIC = false EXTRAS = # make the build silent. -V = false +V = PROGRAMS = \ udev \ @@ -148,7 +148,6 @@ ifeq ($(strip $(USE_KLIBC)),true) KLCC = /usr/bin/$(CROSS_COMPILE)klcc CC = $(KLCC) LD = $(KLCC) - V = true endif ifeq ($(strip $(USE_SELINUX)),true) @@ -162,17 +161,17 @@ ifeq ($(strip $(USE_STATIC)),true) LDFLAGS += -static endif -ifeq ($(strip $(V)),false) - QUIET=@$(PWD)/ccdv - HOST_PROGS=ccdv +ifeq ($(strip $(V)),) + E = @echo + Q = @ else - QUIET= - HOST_PROGS= + E = @\# + Q = endif +export E Q all: $(PROGRAMS) $(MAN_PAGES) - @extras="$(EXTRAS)"; for target in $$extras; do \ - echo $$target; \ + $(Q) extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) CC="$(CC)" \ CFLAGS="$(CFLAGS)" \ LD="$(LD)" \ @@ -180,7 +179,6 @@ all: $(PROGRAMS) $(MAN_PAGES) STRIPCMD="$(STRIPCMD)" \ LIB_OBJS="$(LIB_OBJS)" \ LIBUDEV="$(PWD)/$(LIBUDEV)" \ - QUIET="$(QUIET)" \ -C $$target $@ || exit 1; \ done; .PHONY: all @@ -190,49 +188,54 @@ all: $(PROGRAMS) $(MAN_PAGES) .SUFFIXES: # build the objects -%.o: %.c $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ +%.o: %.c $(HEADERS) $(GEN_HEADERS) + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ # "Static Pattern Rule" to build all programs -$(PROGRAMS): %: $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(LIBUDEV) %.o - $(QUIET) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIB_OBJS) +$(PROGRAMS): %: $(HEADERS) $(GEN_HEADERS) $(LIBUDEV) %.o + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(STRIPCMD),) - $(QUIET) $(STRIPCMD) $@ + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif -$(LIBUDEV): $(HOST_PROGS) $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS) - @rm -f $@ - $(QUIET) $(AR) cq $@ $(UDEV_OBJS) - $(QUIET) $(RANLIB) $@ +$(LIBUDEV): $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS) + $(Q) rm -f $@ + $(E) " AR " $@ + $(Q) $(AR) cq $@ $(UDEV_OBJS) + $(E) " RANLIB " $@ + $(Q) $(RANLIB) $@ udev_version.h: - @echo "/* Generated by make. */" > $@ - @echo \#define UDEV_VERSION \"$(VERSION)\" >> $@ - @echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ - @echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ - @echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ + $(E) " GENHDR " $@ + $(Q) echo "/* Generated by make. */" > $@ + $(Q) echo \#define UDEV_VERSION \"$(VERSION)\" >> $@ + $(Q) echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ + $(Q) echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ + $(Q) echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ # man pages %.8 %.7: docs/%.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 -ccdv: ccdv.c - @$(HOSTCC) -O1 ccdv.c -o ccdv -.SILENT: ccdv - clean: - - rm -f $(HOST_PROGS) - - find . \( -not -type d \) -and \( -name '*~' -o -name '*.[oas]' \) -type f -print0 | xargs -0rt rm -f - - find -name "*.gcno" -print0 | xargs -0rt rm -f - - find -name "*.gcda" -print0 | xargs -0rt rm -f - - find -name "*.gcov" -print0 | xargs -0rt rm -f - - rm -f udev_gcov.txt - - rm -f core $(PROGRAMS) $(GEN_HEADERS) - - rm -f udev-$(VERSION).tar.gz - - rm -f udev-$(VERSION).tar.bz2 - @extras="$(EXTRAS)"; for target in $$extras; do \ - echo $$target; \ + $(E) " CLEAN " + $(Q) - find . -type f -name '*.orig' -print0 | xargs -0r rm -f + $(Q) - find . -type f -name '*.rej' -print0 | xargs -0r rm -f + $(Q) - find . -type f -name '*~' -print0 | xargs -0r rm -f + $(Q) - find . -type f -name '*.[oas]' -print0 | xargs -0r rm -f + $(Q) - find . -type f -name "*.gcno" -print0 | xargs -0r rm -f + $(Q) - find . -type f -name "*.gcda" -print0 | xargs -0r rm -f + $(Q) - find . -type f -name "*.gcov" -print0 | xargs -0r rm -f + $(Q) - rm -f udev_gcov.txt + $(Q) - rm -f core $(PROGRAMS) $(GEN_HEADERS) + $(Q) - rm -f udev-$(VERSION).tar.gz + $(Q) - rm -f udev-$(VERSION).tar.bz2 + @ extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: clean @@ -244,16 +247,15 @@ release: install-config: $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d - @if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ + @ if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ $(INSTALL_DATA) etc/udev/udev.conf $(DESTDIR)$(configdir); \ fi - @if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \ + @ if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \ echo; \ echo "pick a udev rules file from the etc/udev directory that matches your distribution"; \ echo; \ fi - @extras="$(EXTRAS)"; for target in $$extras; do \ - echo $$target; \ + @ extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: install-config @@ -266,7 +268,6 @@ install-man: $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ - echo $$target; \ $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: install-man @@ -278,8 +279,7 @@ uninstall-man: - rm -f $(DESTDIR)$(mandir)/man8/udevd.8 - rm -f $(DESTDIR)$(mandir)/man8/udevmonitor.8 - rm -f $(DESTDIR)$(mandir)/man8/udevcontrol.8 - @extras="$(EXTRAS)"; for target in $$extras; do \ - echo $$target; \ + @ extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: uninstall-man @@ -292,7 +292,6 @@ install-bin: $(INSTALL_PROGRAM) -D udevinfo $(DESTDIR)$(usrbindir)/udevinfo $(INSTALL_PROGRAM) -D udevtest $(DESTDIR)$(usrbindir)/udevtest @extras="$(EXTRAS)"; for target in $$extras; do \ - echo $$target; \ $(MAKE) -C $$target $@ || exit 1; \ done; ifndef DESTDIR @@ -313,7 +312,6 @@ ifndef DESTDIR - rm -rf /dev/.udev endif @extras="$(EXTRAS)"; for target in $$extras; do \ - echo $$target; \ $(MAKE) -C $$target $@ || exit 1; \ done; .PHONY: uninstall-bin @@ -346,9 +344,9 @@ ChangeLog: Makefile gcov-all: $(MAKE) clean all STRIPCMD= USE_GCOV=true - @echo - @echo "binaries built with gcov support." - @echo "run the tests and analyze with 'make udev_gcov.txt'" + @ echo + @ echo "binaries built with gcov support." + @ echo "run the tests and analyze with 'make udev_gcov.txt'" .PHONY: gcov-all # see docs/README-gcov_for_udev diff --git a/ccdv.c b/ccdv.c deleted file mode 100644 index e3ae9da91a..0000000000 --- a/ccdv.c +++ /dev/null @@ -1,387 +0,0 @@ -/* ccdv.c - * - * Copyright (C) 2002-2003, by Mike Gleason, NcFTP Software. - * All Rights Reserved. - * - * Licensed under the GNU Public License. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SETCOLOR_SUCCESS (gANSIEscapes ? "\033\1331;32m" : "") -#define SETCOLOR_FAILURE (gANSIEscapes ? "\033\1331;31m" : "") -#define SETCOLOR_WARNING (gANSIEscapes ? "\033\1331;33m" : "") -#define SETCOLOR_NORMAL (gANSIEscapes ? "\033\1330;39m" : "") - -#define TEXT_BLOCK_SIZE 8192 -#define INDENT 2 - -#define TERMS "vt100:vt102:vt220:vt320:xterm:xterm-color:ansi:linux:scoterm:scoansi:dtterm:cons25:cygwin" - -size_t gNBufUsed = 0, gNBufAllocated = 0; -char *gBuf = NULL; -int gCCPID; -char gAction[200] = ""; -char gTarget[200] = ""; -char gAr[32] = ""; -char gArLibraryTarget[64] = ""; -int gDumpCmdArgs = 0; -char gArgsStr[1000]; -int gColumns = 80; -int gANSIEscapes = 0; -int gExitStatus = 95; - -static void DumpFormattedOutput(void) -{ - char *cp; - char spaces[8 + 1] = " "; - char *saved; - int curcol; - int i; - - curcol = 0; - saved = NULL; - for (cp = gBuf + ((gDumpCmdArgs == 0) ? strlen(gArgsStr) : 0); ; cp++) { - if (*cp == '\0') { - if (saved != NULL) { - cp = saved; - saved = NULL; - } else break; - } - if (*cp == '\r') - continue; - if (*cp == '\t') { - saved = cp + 1; - cp = spaces + 8 - (8 - ((curcol - INDENT - 1) % 8)); - } - if (curcol == 0) { - for (i = INDENT; --i >= 0; ) - putchar(' '); - curcol = INDENT; - } - putchar(*cp); - if (++curcol == (gColumns - 1)) { - putchar('\n'); - curcol = 0; - } else if (*cp == '\n') - curcol = 0; - } - free(gBuf); -} /* DumpFormattedOutput */ - - - -/* Difftime(), only for timeval structures. */ -static void TimeValSubtract(struct timeval *tdiff, struct timeval *t1, struct timeval *t0) -{ - tdiff->tv_sec = t1->tv_sec - t0->tv_sec; - tdiff->tv_usec = t1->tv_usec - t0->tv_usec; - if (tdiff->tv_usec < 0) { - tdiff->tv_sec--; - tdiff->tv_usec += 1000000; - } -} /* TimeValSubtract */ - - - -static void Wait(void) -{ - int pid2, status; - - do { - status = 0; - pid2 = (int) waitpid(gCCPID, &status, 0); - } while (((pid2 >= 0) && (! WIFEXITED(status))) || ((pid2 < 0) && (errno == EINTR))); - if (WIFEXITED(status)) - gExitStatus = WEXITSTATUS(status); -} /* Wait */ - - - -static int SlurpProgress(int fd) -{ - char s1[71]; - char *newbuf; - int nready; - size_t ntoread; - ssize_t nread; - struct timeval now, tnext, tleft; - fd_set ss; - fd_set ss2; - const char *trail = "/-\\|", *trailcp; - - trailcp = trail; - snprintf(s1, sizeof(s1), "%s%s%s... ", gAction, gTarget[0] ? " " : "", gTarget); - printf("\r%-70s%-9s", s1, ""); - fflush(stdout); - - gettimeofday(&now, NULL); - tnext = now; - tnext.tv_sec++; - tleft.tv_sec = 1; - tleft.tv_usec = 0; - FD_ZERO(&ss2); - FD_SET(fd, &ss2); - for(;;) { - if (gNBufUsed == (gNBufAllocated - 1)) { - if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) { - perror("ccdv: realloc"); - return (-1); - } - gNBufAllocated += TEXT_BLOCK_SIZE; - gBuf = newbuf; - } - for (;;) { - ss = ss2; - nready = select(fd + 1, &ss, NULL, NULL, &tleft); - if (nready == 1) - break; - if (nready < 0) { - if (errno != EINTR) { - perror("ccdv: select"); - return (-1); - } - continue; - } - gettimeofday(&now, NULL); - if ((now.tv_sec > tnext.tv_sec) || ((now.tv_sec == tnext.tv_sec) && (now.tv_usec >= tnext.tv_usec))) { - tnext = now; - tnext.tv_sec++; - tleft.tv_sec = 1; - tleft.tv_usec = 0; - printf("\r%-71s%c%-7s", s1, *trailcp, ""); - fflush(stdout); - if (*++trailcp == '\0') - trailcp = trail; - } else { - TimeValSubtract(&tleft, &tnext, &now); - } - } - ntoread = (gNBufAllocated - gNBufUsed - 1); - nread = read(fd, gBuf + gNBufUsed, ntoread); - if (nread < 0) { - if (errno == EINTR) - continue; - perror("ccdv: read"); - return (-1); - } else if (nread == 0) { - break; - } - gNBufUsed += nread; - gBuf[gNBufUsed] = '\0'; - } - snprintf(s1, sizeof(s1), "%s%s%s: ", gAction, gTarget[0] ? " " : "", gTarget); - Wait(); - if (gExitStatus == 0) { - printf("\r%-70s", s1); - printf("[%s%s%s]", ((gNBufUsed - strlen(gArgsStr)) < 4) ? SETCOLOR_SUCCESS : SETCOLOR_WARNING, "OK", SETCOLOR_NORMAL); - printf("%-5s\n", " "); - } else { - printf("\r%-70s", s1); - printf("[%s%s%s]", SETCOLOR_FAILURE, "ERROR", SETCOLOR_NORMAL); - printf("%-2s\n", " "); - gDumpCmdArgs = 1; /* print cmd when there are errors */ - } - fflush(stdout); - return (0); -} /* SlurpProgress */ - - - -static int SlurpAll(int fd) -{ - char *newbuf; - size_t ntoread; - ssize_t nread; - - printf("%s%s%s.\n", gAction, gTarget[0] ? " " : "", gTarget); - fflush(stdout); - - for(;;) { - if (gNBufUsed == (gNBufAllocated - 1)) { - if ((newbuf = (char *) realloc(gBuf, gNBufAllocated + TEXT_BLOCK_SIZE)) == NULL) { - perror("ccdv: realloc"); - return (-1); - } - gNBufAllocated += TEXT_BLOCK_SIZE; - gBuf = newbuf; - } - ntoread = (gNBufAllocated - gNBufUsed - 1); - nread = read(fd, gBuf + gNBufUsed, ntoread); - if (nread < 0) { - if (errno == EINTR) - continue; - perror("ccdv: read"); - return (-1); - } else if (nread == 0) { - break; - } - gNBufUsed += nread; - gBuf[gNBufUsed] = '\0'; - } - Wait(); - gDumpCmdArgs = (gExitStatus != 0); /* print cmd when there are errors */ - return (0); -} /* SlurpAll */ - - - -static const char *Basename(const char *path) -{ - const char *cp; - cp = strrchr(path, '/'); - if (cp == NULL) - return (path); - return (cp + 1); -} /* Basename */ - - - -static const char * Extension(const char *path) -{ - const char *cp = path; - cp = strrchr(path, '.'); - if (cp == NULL) - return (""); - // printf("Extension='%s'\n", cp); - return (cp); -} /* Extension */ - - - -static void Usage(void) -{ - fprintf(stderr, "Usage: ccdv /path/to/cc CFLAGS...\n\n"); - fprintf(stderr, "I wrote this to reduce the deluge Make output to make finding actual problems\n"); - fprintf(stderr, "easier. It is intended to be invoked from Makefiles, like this. Instead of:\n\n"); - fprintf(stderr, "\t.c.o:\n"); - fprintf(stderr, "\t\t$(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n"); - fprintf(stderr, "\nRewrite your rule so it looks like:\n\n"); - fprintf(stderr, "\t.c.o:\n"); - fprintf(stderr, "\t\t@ccdv $(CC) $(CFLAGS) $(DEFS) $(CPPFLAGS) $< -c\n\n"); - fprintf(stderr, "ccdv 1.1.0 is Free under the GNU Public License. Enjoy!\n"); - fprintf(stderr, " -- Mike Gleason, NcFTP Software \n"); - exit(96); -} /* Usage */ - - - -int main(int argc, char **argv) -{ - int pipe1[2]; - int devnull; - char emerg[256]; - int fd; - int nread; - int i; - int cc = 0, pch = 0; - const char *quote; - - if (argc < 2) - Usage(); - - snprintf(gAction, sizeof(gAction), "Running %s", Basename(argv[1])); - memset(gArgsStr, 0, sizeof(gArgsStr)); - for (i = 1; i < argc; i++) { - // printf("argv[%d]='%s'\n", i, argv[i]); - quote = (strchr(argv[i], ' ') != NULL) ? "\"" : ""; - snprintf(gArgsStr + strlen(gArgsStr), sizeof(gArgsStr) - strlen(gArgsStr), "%s%s%s%s%s", (i == 1) ? "" : " ", quote, argv[i], quote, (i == (argc - 1)) ? "\n" : ""); - if ((strcmp(argv[i], "-o") == 0) && ((i + 1) < argc)) { - if (strcasecmp(Extension(argv[i + 1]), ".o") != 0) { - strcpy(gAction, "Linking"); - snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i + 1])); - } - } else if (strchr("-+", (int) argv[i][0]) != NULL) { - continue; - } else if (strncasecmp(Extension(argv[i]), ".c", 2) == 0) { - cc++; - snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); - // printf("gTarget='%s'\n", gTarget); - } else if ((strncasecmp(Extension(argv[i]), ".h", 2) == 0) && (cc == 0)) { - pch++; - snprintf(gTarget, sizeof(gTarget), "%s", Basename(argv[i])); - } else if ((i == 1) && (strcmp(Basename(argv[i]), "ar") == 0)) { - snprintf(gAr, sizeof(gAr), "%s", Basename(argv[i])); - } else if ((gArLibraryTarget[0] == '\0') && (strcasecmp(Extension(argv[i]), ".a") == 0)) { - snprintf(gArLibraryTarget, sizeof(gArLibraryTarget), "%s", Basename(argv[i])); - } - } - if ((gAr[0] != '\0') && (gArLibraryTarget[0] != '\0')) { - strcpy(gAction, "Creating library"); - snprintf(gTarget, sizeof(gTarget), "%s", gArLibraryTarget); - } else if (pch > 0) { - strcpy(gAction, "Precompiling"); - } else if (cc > 0) { - strcpy(gAction, "Compiling"); - } - - if (pipe(pipe1) < 0) { - perror("ccdv: pipe"); - exit(97); - } - - (void) close(0); - devnull = open("/dev/null", O_RDWR, 00666); - if ((devnull != 0) && (dup2(devnull, 0) == 0)) - close(devnull); - - gCCPID = (int) fork(); - if (gCCPID < 0) { - (void) close(pipe1[0]); - (void) close(pipe1[1]); - perror("ccdv: fork"); - exit(98); - } else if (gCCPID == 0) { - /* Child */ - (void) close(pipe1[0]); /* close read end */ - if (pipe1[1] != 1) { /* use write end on stdout */ - (void) dup2(pipe1[1], 1); - (void) close(pipe1[1]); - } - (void) dup2(1, 2); /* use write end on stderr */ - execvp(argv[1], argv + 1); - perror(argv[1]); - exit(99); - } - - /* parent */ - (void) close(pipe1[1]); /* close write end */ - fd = pipe1[0]; /* use read end */ - - gColumns = (getenv("COLUMNS") != NULL) ? atoi(getenv("COLUMNS")) : 80; - gANSIEscapes = (getenv("TERM") != NULL) && (strstr(TERMS, getenv("TERM")) != NULL); - gBuf = (char *) malloc(TEXT_BLOCK_SIZE); - if (gBuf == NULL) - goto panic; - gNBufUsed = 0; - gNBufAllocated = TEXT_BLOCK_SIZE; - if (strlen(gArgsStr) < (gNBufAllocated - 1)) { - strcpy(gBuf, gArgsStr); - gNBufUsed = strlen(gArgsStr); - } - - if (isatty(1)) { - if (SlurpProgress(fd) < 0) - goto panic; - } else { - if (SlurpAll(fd) < 0) - goto panic; - } - DumpFormattedOutput(); - exit(gExitStatus); - -panic: - gDumpCmdArgs = 1; /* print cmd when there are errors */ - DumpFormattedOutput(); - while ((nread = read(fd, emerg, (size_t) sizeof(emerg))) > 0) - (void) write(2, emerg, (size_t) nread); - Wait(); - exit(gExitStatus); -} /* main */ diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index 0a881fb194..9049a35787 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -30,21 +30,26 @@ all: $(PROG) $(MAN_PAGES) .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(STRIPCMD),) - $(QUIET) $(STRIPCMD) $@ + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) +ifneq ($(strip $(STRIPCMD)),) + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index 9a722d52f9..59c2532d41 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -30,21 +30,26 @@ all: $(PROG) $(MAN_PAGES) .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) - $(QUIET) $(STRIPCMD) $@ + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 79f14a49ba..6831a9d507 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -30,21 +30,26 @@ all: $(PROG) $(MAN_PAGES) .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) - $(QUIET) $(STRIPCMD) $@ + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index db6afae18c..8afd8cc2fd 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -30,21 +30,26 @@ all: $(PROG) $(MAN_PAGES) .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) - $(QUIET) $(STRIPCMD) $@ + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index da7fe9d1a8..d6b13b20db 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -30,21 +30,26 @@ all: $(PROG) $(MAN_PAGES) .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) - $(QUIET) $(STRIPCMD) $@ + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index e23191a533..7b46a5f00c 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -30,21 +30,26 @@ all: $(PROG) $(MAN_PAGES) .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) - $(QUIET) $(STRIPCMD) $@ + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 37a59597b9..0b52326a9a 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -29,21 +29,26 @@ all: $(PROG) $(MAN_PAGES) .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) - $(QUIET) $(STRIPCMD) $@ + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 057594d5bf..b185998b19 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -28,41 +28,37 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} -# be able to run without udev -CROSS = -QUIET = -CC = $(CROSS)gcc -LD = $(CROSS)gcc -AR = $(CROSS)ar -STRIPCMD = $(CROSS)strip -CFLAGS += -Wall -pipe -fno-builtin -Wstrict-prototypes -Wsign-compare -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -LDFLAGS += -Wl - all: $(PROG) $(MAN_PAGES) .PHONY: all .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) - $(QUIET) $(STRIPCMD) $@ + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) +ifneq ($(STRIPCMD),) + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif scsi_id_version.h: - @echo "/* This file is auto-generated by the Makefile */" > $@ - @echo \#define SCSI_ID_VERSION \"$(SCSI_ID_VERSION)\" >> $@ - @echo \#define SCSI_ID_CONFIG_FILE \"$(etcdir)/scsi_id.config\" >> $@ + $(E) " GENHDR " $@ + $(Q) echo "/* Generated by make. */" > $@ + $(Q) echo \#define SCSI_ID_VERSION \"$(SCSI_ID_VERSION)\" >> $@ + $(Q) echo \#define SCSI_ID_CONFIG_FILE \"$(etcdir)/scsi_id.config\" >> $@ # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all @@ -82,7 +78,7 @@ uninstall-man: .PHONY: uninstall-man install-config: - @if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \ + @ if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \ echo $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir); \ $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \ fi diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 91b4d57d76..b3c417276a 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -30,21 +30,26 @@ all: $(PROG) $(MAN_PAGES) .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) - $(QUIET) $(STRIPCMD) $@ + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index edb5d3ac68..b72d5b11d9 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -29,25 +29,30 @@ all: $(PROG) $(MAN_PAGES) .DEFAULT: all %.o: %.c $(GEN_HEADERS) - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(LIBVOLUME_ID): - $(MAKE) -C libvolume_id + $(Q) $(MAKE) -C libvolume_id $(PROG): %: $(HEADERS) %.o $(LIBVOLUME_ID) - $(QUIET) $(LD) $(LDFLAGS) $@.o $(LIBVOLUME_ID) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(LIBVOLUME_ID) -o $@ $(LIBUDEV) $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) - $(QUIET) $(STRIPCMD) $@ + $(E) " STRIP " $@ + $(Q) $(STRIPCMD) $@ endif # man pages %.8: %.xml - xmlto man $? + $(E) " XMLTO " $@ + $(Q) xmlto man $? .PRECIOUS: %.8 clean: - rm -f $(PROG) $(OBJS) $(GEN_HEADERS) - $(MAKE) -C libvolume_id clean + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) + $(Q) $(MAKE) -C libvolume_id clean .PHONY: clean install-bin: all diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile index 02c24eae05..07f6662f25 100644 --- a/extras/volume_id/libvolume_id/Makefile +++ b/extras/volume_id/libvolume_id/Makefile @@ -53,14 +53,18 @@ all: $(LIBVOLUME_ID) .DEFAULT: all %.o: %.c - $(QUIET) $(CC) -c $(CFLAGS) $< -o $@ + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(LIBVOLUME_ID): $(HEADERS) $(OBJS) - @rm -f $@ - $(QUIET) $(AR) cq $@ $(OBJS) - $(QUIET) $(RANLIB) $@ + $(Q) rm -f $@ + $(E) " AR " $@ + $(Q) $(AR) cq $@ $(OBJS) + $(E) " RANLIB " $@ + $(Q) $(RANLIB) $@ clean: - rm -f $(LIBVOLUME_ID) $(OBJS) + $(E) " CLEAN " + $(Q) rm -f $(LIBVOLUME_ID) $(OBJS) .PHONY: clean -- cgit v1.2.3-54-g00ecf From 9de98988130c5565e6d75f444f591141ad33e95e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 28 Jan 2006 04:56:24 +0100 Subject: move manpages to top level Signed-off-by: Kay Sievers --- Makefile | 2 +- docs/udev.xml | 528 --------------------------------------------------- docs/udevd.xml | 108 ----------- docs/udevinfo.xml | 131 ------------- docs/udevmonitor.xml | 76 -------- docs/udevsend.xml | 90 --------- docs/udevstart.xml | 62 ------ docs/udevtest.xml | 62 ------ udev.xml | 528 +++++++++++++++++++++++++++++++++++++++++++++++++++ udevd.xml | 108 +++++++++++ udevinfo.xml | 131 +++++++++++++ udevmonitor.xml | 76 ++++++++ udevsend.xml | 90 +++++++++ udevstart.xml | 62 ++++++ udevtest.xml | 62 ++++++ 15 files changed, 1058 insertions(+), 1058 deletions(-) delete mode 100644 docs/udev.xml delete mode 100644 docs/udevd.xml delete mode 100644 docs/udevinfo.xml delete mode 100644 docs/udevmonitor.xml delete mode 100644 docs/udevsend.xml delete mode 100644 docs/udevstart.xml delete mode 100644 docs/udevtest.xml create mode 100644 udev.xml create mode 100644 udevd.xml create mode 100644 udevinfo.xml create mode 100644 udevmonitor.xml create mode 100644 udevsend.xml create mode 100644 udevstart.xml create mode 100644 udevtest.xml diff --git a/Makefile b/Makefile index f650233cee..460ccf9ee7 100644 --- a/Makefile +++ b/Makefile @@ -217,7 +217,7 @@ udev_version.h: $(Q) echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ # man pages -%.8 %.7: docs/%.xml +%.8 %.7: %.xml $(E) " XMLTO " $@ $(Q) xmlto man $? .PRECIOUS: %.8 diff --git a/docs/udev.xml b/docs/udev.xml deleted file mode 100644 index e0542a6be1..0000000000 --- a/docs/udev.xml +++ /dev/null @@ -1,528 +0,0 @@ - - - -

    - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - - -
    - udev - - - udev - August 2005 - udev - - - - udev - 7 - - - - udev - dynamic device management - - - DESCRIPTION - udev provides a dynamic device directory containing only the files for - actually present devices. It creates or removes device node files in the - /dev directory, or it renames network interfaces. - - Usually udev runs as udevd - 8 and receives uevents directly from the - kernel if a device is added or removed form the system. - - If udev receives a device event, it matches its configured rules - against the available device attributes provided in sysfs to identify the device. - Rules that match, may provide additional device information or specify a device - node name and multiple symlink names and instruct udev to run additional programs - as part of the device event handling. - - - CONFIGURATION - All udev configuration files are placed in /etc/udev/*. - Every file consists of a set of lines of text. All empty lines or lines beginning - with '#' will be ignored. - - Configuration file - udev expects its main configuration file at /etc/udev/udev.conf. - It consists of a set of variables allowing the user to override default udev values. - The following variables can be set: - - - - - Specifies where to place the device nodes in the filesystem. - The default value is /dev. - - - - - - - The name of the udev rules file or directory to look for files - with the suffix .rules. Multiple rule files are - read in lexical order. The default value is - /etc/udev/rules.d. - - - - - - - The logging priority. Valid values are the numerical syslog priorities - or their textual representations: , - and . - - - - - - Rules files - The udev rules are read from the files located in the - /etc/udev/rules.d directory or at the location specified - value in the configuraton file. Every line in the rules file contains at least - one key value pair. There are two kind of keys, match and assignement keys. - If all match keys are matching against its value, the rule gets applied and the - assign keys get the specified value assigned. A matching rule may specify the - name of the device node, add a symlink pointing to the node, or run a specified - program as part of the event handling. If no matching rule is found, the default - device node name is used. - - A rule may consists of a list of one or more key value pairs separated by - a comma. Each key has a distinct operation, depending on the used operator. Valid - operators are: - - - - - Compare for equality. - - - - - - - Compare for non-equality. - - - - - - - Asign a value to a key. Keys that represent a list, are reset - and only this single value is assigned. - - - - - - - Add the value to a key that holds a list of entries. - - - - - - - Assign a value to a key finally; disallow any later changes, - which may be used to prevent changes by any later rules. - - - - - The following key names can be used to match against device properties: - - - - - Match the name of the event action. - - - - - - - Match the name of the device. - - - - - - - Match the devpath of the device. - - - - - - - Match the subsystem of the device. - - - - - - - Search the devpath upwards for a matching device subsystem name. - - - - - - - Search the devpath upwards for a matching device driver name. - - - - - - - Search the devpath upwards for a matching device name. - - - - - - - Search the devpath upwards for a device with matching sysfs attribute values. - Up to five keys can be specified per rule. All attributes - must match on the same device. Trailing whitespace in the attribute values is ignored, - if the specified match value does not contain trailing whitespace itself. - - - - - - - Match against the value of an environment variable. Up to five - keys can be specified per rule. This key can also be used to export a variable to - the environment. - - - - - - - Execute external program. The key is true, if the program returns - without exit code zero. The whole event environment is available to the - executed program. The program's output printed to stdout is available for - the RESULT key. - - - - - - - Match the returned string of the last PROGRAM call. This key can - be used in the same or in any later rule after a PROGRAM call. - - - - - Most of the fields support a shell style pattern matching. The following - pattern characters are supported: - - - - - Matches zero, or any number of characters. - - - - - - Matches any single character. - - - - - - Matches any single character specified within the brackets. - example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. - Ranges are also supported within this match with the '-' character. - For example, to match on the range of all digits, the pattern [0-9] would - be used. If the first character following the '[' is a '!', any characters - not enclosed are matched. - - - - - The following keys can get values assigned: - - - - - The name of the node to be created, or the name the network interface - should be renamed to. Only one rule can set the node name, all later rules with - a NAME key will be ignored. - - - - - - - The name of a symlink targeting the node. Every matching rule can add - this value to the list of symlinks to be created along with the device node. - Multiple symlinks may be specified by separating the names by the space - character. - - - - - - - The permissions for the device node. Every specified value overwrites - the compiled-in default value. - - - - - - - Export a variable to the environment. This key can also be used to match - against an environment variable. - - - - - - - Add a program to the list of programs to be executed for a specific - device. - - - - - - - Named label where a GOTO can jump to. - - - - - - - Jumps to the next LABEL with a matching gname - - - - - - - Import the printed result or the value of a file in environment key - format into the event environment. will execute an - external program and read its output. will inport a - text file. If no option is given, udev will determine it from the executable - bit of of the file permissions. - - - - - - - Wait for the specified sysfs file of the device to be created. Can be used - to fight against kernel sysfs timing issues. - - - - - - - stops further rules application. No later rules - will have any effect. - will ignore this event completely. - will ignore any later remove event for this - device. This may be useful as a workaround for broken device drivers. - will create device nodes for all available partitions of - a block device. This may be useful for removable media. - - - - - The , , , - , and - fields support simple printf-like string substitutions. The - format chars gets applied after all rules have been processed, right before the program - is executed. It allows the use of the complete environment set by earlier matching - rules. For all other fields, substitutions are applied while the individual rule is - being processed. The available substitutions are: - - - , - - The kernel name for this device. - - - - - , - - The kernel number for this device. For example, 'sda3' has - kernel number of '3' - - - - - , - - The devpath of the device. - - - - - , - - The name of the device matched while searching the devpath upwards for - , and . - - - - - - , - - The value of a sysfs attribute found at the current or a parent device. - - - - - , - - The value of an environment variable. - - - - - , - - The kernel major number for the device. - - - - - - - The kernel minor number for the device. - - - - - , - - The string returned by the external program requested with PROGRAM. - A single part of the string, separated by a space character may be selected - by specifying the part number as an attribute: . - If the number is followed by the '+' char this part plus all remaining parts - of the result string are substituted: - - - - - , - - The node name of the parent device. - - - - - , - - The udev_root value. - - - - - , - - The name of a created temporary device node to provide access to - the device from a external program before the real node is created. - - - - - - - The '%' character itself. - - - - - - - The '$' character itself. - - - - The count of characters to be substituted may be limited by specifying - the format length value. For example, '%3s{file}' will only - insert the first three characters of the sysfs attribute - - - - ENVIRONMENT - - - - - add or remove signifies - the addition or the removal of a device. - - - - - - - The sysfs devpath without the mountpoint but a leading slash. - - - - - - - The kernel subsystem the device belongs to. - - - - - - - Overrides the syslog priority specified in the config file. - - - - - - AUTHOR - Written by Greg Kroah-Hartman greg@kroah.com and - Kay Sievers kay.sievers@vrfy.org. With much help from - Dan Stekloff dsteklof@us.ibm.com and many others. - - - - SEE ALSO - - udevd8 - , - - udevinfo8 - , - - udevmonitor8 - - - -
    -
    diff --git a/docs/udevd.xml b/docs/udevd.xml deleted file mode 100644 index 76df707519..0000000000 --- a/docs/udevd.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - -
    - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - - -
    - udevd, udevcontrol - - - udevd - August 2005 - udev - - - - udevd - 8 - - - - udevdevent managing daemon - - - - - udevd - - - - udevcontrol command - - - - DESCRIPTION - udevd listens to kernel uevents and passes the incoming events to - udev. It ensures the right event order and takes care, that events for child - devices are delayed until the parent has finished the device handling. - - - OPTIONS - - - - - Detach and run in the background. - - - - - - udevcontrol can dynamically set the log level of udevd. - Valid values are the numerical syslog priorities or their textual - representations: , - and . - - - - - - udevcontrol stops the execution of events from udevd. - - - - - - udevcontrol starts the execution of events from udevd. - - - - - - ENVIRONMENT - - - - - Overrides the syslog priority specified in the config file. - - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev8 - - - -
    -
    diff --git a/docs/udevinfo.xml b/docs/udevinfo.xml deleted file mode 100644 index d6eecfb70d..0000000000 --- a/docs/udevinfo.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - -
    - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - - -
    - udevinfo - - - udevinfo - August 2005 - udev - - - - udevinfo - 8 - - - - udevinfoquery device information from the udev database - - - - - udevinfo - - - - - - - - - - - - DESCRIPTION - udevinfo queries the udev database for device information - stored in the udev database. It can also query the properties - of a device from its sysfs representation to help creating udev - rules that match this device. - - - OPTIONS - - - - - Query the database for specified type of device data. It needs the - or to identify the specified - device. Valid queries are: - name, symlink, path, - env, all. - - - - - - - Print all sysfs properties of the specified device that can be used - in udev rules to match the specified device. It prints all devices - along the chain, up to the root of sysfs that can be used in udev rules. - - - - - - - The sysfs path of the device to query. - - - - - - - The name of the device node or a symlink to query - - - - - - - The udev root directory: /dev. If used in conjunction - with a name or symlink query, the - query returns the absolute path. - - - - - - - Export the content of the udev database. - - - - - - - Print help text. - - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev8 - - - -
    -
    diff --git a/docs/udevmonitor.xml b/docs/udevmonitor.xml deleted file mode 100644 index 6f1e347f84..0000000000 --- a/docs/udevmonitor.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - -
    - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - - -
    - udevmonitor - - - udevmonitor - August 2005 - udev - - - - udevmonitor - 8 - - - - udevmonitor - print the kernel and udev event sequence to the console - - - - - udevmonitor - - - - - DESCRIPTION - udevmonitor listens to the kernel uevents and events send out by a udev rule - and prints the devpath of the event to the console. It can be used analyze to the - event timing by comparing the timestamps of the kernel uevent with the udev event. - - - - OPTIONS - - - - - Print the complete environment for all events. Can be used to compare the - kernel supplied and the udev added environment values. - - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev8 - - - -
    -
    diff --git a/docs/udevsend.xml b/docs/udevsend.xml deleted file mode 100644 index aa76eea845..0000000000 --- a/docs/udevsend.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - -
    - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - - -
    - udevsend - - - udevsend - August 2005 - udev - - - - udevsend - 8 - - - - udevsend - send the current environment to the udev daemon - - - - - udevsend - - - - DESCRIPTION - Usually the udev daemon listens directly to the kernel uevents. - udevsend may be used to pass events for already existing devices from - a userspace application to the daemon. - - - ENVIRONMENT - - - - - add or remove signifies - the addition or the removal of a device. - - - - - - - The sysfs devpath without the mountpoint but a leading slash. - - - - - - - The kernel subsystem the device belongs to. - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev8 - , - - udevd8 - - - -
    -
    diff --git a/docs/udevstart.xml b/docs/udevstart.xml deleted file mode 100644 index f917287086..0000000000 --- a/docs/udevstart.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - -
    - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - - -
    - udevstart - - - udevstart - August 2005 - udev - - - - udevstart - 8 - - - - udevstartpopulate initial device directory - - - - - udevstart - - - - DESCRIPTION - udevstart scans the kernel exported device information available in - sysfs for devices which require a device node to operate and creates the node - using the specified udev rules. udevstart is used to create the initial - device directory after system bootup. - - - AUTHOR - Written by Harald Hoyer harald@redhat.com. - - - - SEE ALSO - - udev8 - - - -
    -
    diff --git a/docs/udevtest.xml b/docs/udevtest.xml deleted file mode 100644 index 2b39eebab0..0000000000 --- a/docs/udevtest.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - -
    - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - - -
    - udevtest - - - udevtest - August 2005 - udev - - - - udevtest - 8 - - - - udevtest - simulate a udev run and print the action to the console - - - - - udevtest device-path - - - - DESCRIPTION - udevtest simulates a udev run for the given device and prints out the - name of the node udev would have created, or the name of the network interface, - that would have been renamend. - - - AUTHOR - Written by Greg Kroah-Hartman greg@kroah.com. - - - - SEE ALSO - - udev8 - - - -
    -
    diff --git a/udev.xml b/udev.xml new file mode 100644 index 0000000000..e0542a6be1 --- /dev/null +++ b/udev.xml @@ -0,0 +1,528 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udev + + + udev + August 2005 + udev + + + + udev + 7 + + + + udev + dynamic device management + + + DESCRIPTION + udev provides a dynamic device directory containing only the files for + actually present devices. It creates or removes device node files in the + /dev directory, or it renames network interfaces. + + Usually udev runs as udevd + 8 and receives uevents directly from the + kernel if a device is added or removed form the system. + + If udev receives a device event, it matches its configured rules + against the available device attributes provided in sysfs to identify the device. + Rules that match, may provide additional device information or specify a device + node name and multiple symlink names and instruct udev to run additional programs + as part of the device event handling. + + + CONFIGURATION + All udev configuration files are placed in /etc/udev/*. + Every file consists of a set of lines of text. All empty lines or lines beginning + with '#' will be ignored. + + Configuration file + udev expects its main configuration file at /etc/udev/udev.conf. + It consists of a set of variables allowing the user to override default udev values. + The following variables can be set: + + + + + Specifies where to place the device nodes in the filesystem. + The default value is /dev. + + + + + + + The name of the udev rules file or directory to look for files + with the suffix .rules. Multiple rule files are + read in lexical order. The default value is + /etc/udev/rules.d. + + + + + + + The logging priority. Valid values are the numerical syslog priorities + or their textual representations: , + and . + + + + + + Rules files + The udev rules are read from the files located in the + /etc/udev/rules.d directory or at the location specified + value in the configuraton file. Every line in the rules file contains at least + one key value pair. There are two kind of keys, match and assignement keys. + If all match keys are matching against its value, the rule gets applied and the + assign keys get the specified value assigned. A matching rule may specify the + name of the device node, add a symlink pointing to the node, or run a specified + program as part of the event handling. If no matching rule is found, the default + device node name is used. + + A rule may consists of a list of one or more key value pairs separated by + a comma. Each key has a distinct operation, depending on the used operator. Valid + operators are: + + + + + Compare for equality. + + + + + + + Compare for non-equality. + + + + + + + Asign a value to a key. Keys that represent a list, are reset + and only this single value is assigned. + + + + + + + Add the value to a key that holds a list of entries. + + + + + + + Assign a value to a key finally; disallow any later changes, + which may be used to prevent changes by any later rules. + + + + + The following key names can be used to match against device properties: + + + + + Match the name of the event action. + + + + + + + Match the name of the device. + + + + + + + Match the devpath of the device. + + + + + + + Match the subsystem of the device. + + + + + + + Search the devpath upwards for a matching device subsystem name. + + + + + + + Search the devpath upwards for a matching device driver name. + + + + + + + Search the devpath upwards for a matching device name. + + + + + + + Search the devpath upwards for a device with matching sysfs attribute values. + Up to five keys can be specified per rule. All attributes + must match on the same device. Trailing whitespace in the attribute values is ignored, + if the specified match value does not contain trailing whitespace itself. + + + + + + + Match against the value of an environment variable. Up to five + keys can be specified per rule. This key can also be used to export a variable to + the environment. + + + + + + + Execute external program. The key is true, if the program returns + without exit code zero. The whole event environment is available to the + executed program. The program's output printed to stdout is available for + the RESULT key. + + + + + + + Match the returned string of the last PROGRAM call. This key can + be used in the same or in any later rule after a PROGRAM call. + + + + + Most of the fields support a shell style pattern matching. The following + pattern characters are supported: + + + + + Matches zero, or any number of characters. + + + + + + Matches any single character. + + + + + + Matches any single character specified within the brackets. + example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. + Ranges are also supported within this match with the '-' character. + For example, to match on the range of all digits, the pattern [0-9] would + be used. If the first character following the '[' is a '!', any characters + not enclosed are matched. + + + + + The following keys can get values assigned: + + + + + The name of the node to be created, or the name the network interface + should be renamed to. Only one rule can set the node name, all later rules with + a NAME key will be ignored. + + + + + + + The name of a symlink targeting the node. Every matching rule can add + this value to the list of symlinks to be created along with the device node. + Multiple symlinks may be specified by separating the names by the space + character. + + + + + + + The permissions for the device node. Every specified value overwrites + the compiled-in default value. + + + + + + + Export a variable to the environment. This key can also be used to match + against an environment variable. + + + + + + + Add a program to the list of programs to be executed for a specific + device. + + + + + + + Named label where a GOTO can jump to. + + + + + + + Jumps to the next LABEL with a matching gname + + + + + + + Import the printed result or the value of a file in environment key + format into the event environment. will execute an + external program and read its output. will inport a + text file. If no option is given, udev will determine it from the executable + bit of of the file permissions. + + + + + + + Wait for the specified sysfs file of the device to be created. Can be used + to fight against kernel sysfs timing issues. + + + + + + + stops further rules application. No later rules + will have any effect. + will ignore this event completely. + will ignore any later remove event for this + device. This may be useful as a workaround for broken device drivers. + will create device nodes for all available partitions of + a block device. This may be useful for removable media. + + + + + The , , , + , and + fields support simple printf-like string substitutions. The + format chars gets applied after all rules have been processed, right before the program + is executed. It allows the use of the complete environment set by earlier matching + rules. For all other fields, substitutions are applied while the individual rule is + being processed. The available substitutions are: + + + , + + The kernel name for this device. + + + + + , + + The kernel number for this device. For example, 'sda3' has + kernel number of '3' + + + + + , + + The devpath of the device. + + + + + , + + The name of the device matched while searching the devpath upwards for + , and . + + + + + + , + + The value of a sysfs attribute found at the current or a parent device. + + + + + , + + The value of an environment variable. + + + + + , + + The kernel major number for the device. + + + + + + + The kernel minor number for the device. + + + + + , + + The string returned by the external program requested with PROGRAM. + A single part of the string, separated by a space character may be selected + by specifying the part number as an attribute: . + If the number is followed by the '+' char this part plus all remaining parts + of the result string are substituted: + + + + + , + + The node name of the parent device. + + + + + , + + The udev_root value. + + + + + , + + The name of a created temporary device node to provide access to + the device from a external program before the real node is created. + + + + + + + The '%' character itself. + + + + + + + The '$' character itself. + + + + The count of characters to be substituted may be limited by specifying + the format length value. For example, '%3s{file}' will only + insert the first three characters of the sysfs attribute + + + + ENVIRONMENT + + + + + add or remove signifies + the addition or the removal of a device. + + + + + + + The sysfs devpath without the mountpoint but a leading slash. + + + + + + + The kernel subsystem the device belongs to. + + + + + + + Overrides the syslog priority specified in the config file. + + + + + + AUTHOR + Written by Greg Kroah-Hartman greg@kroah.com and + Kay Sievers kay.sievers@vrfy.org. With much help from + Dan Stekloff dsteklof@us.ibm.com and many others. + + + + SEE ALSO + + udevd8 + , + + udevinfo8 + , + + udevmonitor8 + + + +
    +
    diff --git a/udevd.xml b/udevd.xml new file mode 100644 index 0000000000..76df707519 --- /dev/null +++ b/udevd.xml @@ -0,0 +1,108 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevd, udevcontrol + + + udevd + August 2005 + udev + + + + udevd + 8 + + + + udevdevent managing daemon + + + + + udevd + + + + udevcontrol command + + + + DESCRIPTION + udevd listens to kernel uevents and passes the incoming events to + udev. It ensures the right event order and takes care, that events for child + devices are delayed until the parent has finished the device handling. + + + OPTIONS + + + + + Detach and run in the background. + + + + + + udevcontrol can dynamically set the log level of udevd. + Valid values are the numerical syslog priorities or their textual + representations: , + and . + + + + + + udevcontrol stops the execution of events from udevd. + + + + + + udevcontrol starts the execution of events from udevd. + + + + + + ENVIRONMENT + + + + + Overrides the syslog priority specified in the config file. + + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev8 + + + +
    +
    diff --git a/udevinfo.xml b/udevinfo.xml new file mode 100644 index 0000000000..d6eecfb70d --- /dev/null +++ b/udevinfo.xml @@ -0,0 +1,131 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevinfo + + + udevinfo + August 2005 + udev + + + + udevinfo + 8 + + + + udevinfoquery device information from the udev database + + + + + udevinfo + + + + + + + + + + + + DESCRIPTION + udevinfo queries the udev database for device information + stored in the udev database. It can also query the properties + of a device from its sysfs representation to help creating udev + rules that match this device. + + + OPTIONS + + + + + Query the database for specified type of device data. It needs the + or to identify the specified + device. Valid queries are: + name, symlink, path, + env, all. + + + + + + + Print all sysfs properties of the specified device that can be used + in udev rules to match the specified device. It prints all devices + along the chain, up to the root of sysfs that can be used in udev rules. + + + + + + + The sysfs path of the device to query. + + + + + + + The name of the device node or a symlink to query + + + + + + + The udev root directory: /dev. If used in conjunction + with a name or symlink query, the + query returns the absolute path. + + + + + + + Export the content of the udev database. + + + + + + + Print help text. + + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev8 + + + +
    +
    diff --git a/udevmonitor.xml b/udevmonitor.xml new file mode 100644 index 0000000000..6f1e347f84 --- /dev/null +++ b/udevmonitor.xml @@ -0,0 +1,76 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevmonitor + + + udevmonitor + August 2005 + udev + + + + udevmonitor + 8 + + + + udevmonitor + print the kernel and udev event sequence to the console + + + + + udevmonitor + + + + + DESCRIPTION + udevmonitor listens to the kernel uevents and events send out by a udev rule + and prints the devpath of the event to the console. It can be used analyze to the + event timing by comparing the timestamps of the kernel uevent with the udev event. + + + + OPTIONS + + + + + Print the complete environment for all events. Can be used to compare the + kernel supplied and the udev added environment values. + + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev8 + + + +
    +
    diff --git a/udevsend.xml b/udevsend.xml new file mode 100644 index 0000000000..aa76eea845 --- /dev/null +++ b/udevsend.xml @@ -0,0 +1,90 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevsend + + + udevsend + August 2005 + udev + + + + udevsend + 8 + + + + udevsend + send the current environment to the udev daemon + + + + + udevsend + + + + DESCRIPTION + Usually the udev daemon listens directly to the kernel uevents. + udevsend may be used to pass events for already existing devices from + a userspace application to the daemon. + + + ENVIRONMENT + + + + + add or remove signifies + the addition or the removal of a device. + + + + + + + The sysfs devpath without the mountpoint but a leading slash. + + + + + + + The kernel subsystem the device belongs to. + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev8 + , + + udevd8 + + + +
    +
    diff --git a/udevstart.xml b/udevstart.xml new file mode 100644 index 0000000000..f917287086 --- /dev/null +++ b/udevstart.xml @@ -0,0 +1,62 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevstart + + + udevstart + August 2005 + udev + + + + udevstart + 8 + + + + udevstartpopulate initial device directory + + + + + udevstart + + + + DESCRIPTION + udevstart scans the kernel exported device information available in + sysfs for devices which require a device node to operate and creates the node + using the specified udev rules. udevstart is used to create the initial + device directory after system bootup. + + + AUTHOR + Written by Harald Hoyer harald@redhat.com. + + + + SEE ALSO + + udev8 + + + +
    +
    diff --git a/udevtest.xml b/udevtest.xml new file mode 100644 index 0000000000..2b39eebab0 --- /dev/null +++ b/udevtest.xml @@ -0,0 +1,62 @@ + + + +
    + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2005 + Kay Sievers + + + +
    + udevtest + + + udevtest + August 2005 + udev + + + + udevtest + 8 + + + + udevtest + simulate a udev run and print the action to the console + + + + + udevtest device-path + + + + DESCRIPTION + udevtest simulates a udev run for the given device and prints out the + name of the node udev would have created, or the name of the network interface, + that would have been renamend. + + + AUTHOR + Written by Greg Kroah-Hartman greg@kroah.com. + + + + SEE ALSO + + udev8 + + + +
    +
    -- cgit v1.2.3-54-g00ecf From 4179809b22af94a2c8c3937a9baa45870910ea0d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 28 Jan 2006 05:04:38 +0100 Subject: remove UDEVD_UEVENT_INITSEND Signed-off-by: Kay Sievers --- udevd.c | 2 -- udevd.h | 1 - 2 files changed, 3 deletions(-) diff --git a/udevd.c b/udevd.c index c94fdc74d8..3f4605ed11 100644 --- a/udevd.c +++ b/udevd.c @@ -527,7 +527,6 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) free(msg); return NULL; } - return msg; } @@ -581,7 +580,6 @@ static struct uevent_msg *get_udevd_msg(void) switch (usend_msg.type) { case UDEVD_UEVENT_UDEVSEND: - case UDEVD_UEVENT_INITSEND: info("udevd event message received"); envbuf_size = size - offsetof(struct udevd_msg, envbuf); dbg("envbuf_size=%i", envbuf_size); diff --git a/udevd.h b/udevd.h index 242c0b6907..9ab6a445b9 100644 --- a/udevd.h +++ b/udevd.h @@ -44,7 +44,6 @@ enum udevd_msg_type { UDEVD_UNKNOWN, UDEVD_UEVENT_UDEVSEND, - UDEVD_UEVENT_INITSEND, UDEVD_UEVENT_NETLINK, UDEVD_STOP_EXEC_QUEUE, UDEVD_START_EXEC_QUEUE, -- cgit v1.2.3-54-g00ecf From c1979c82e18c5ee0993479043f44f5dcc76d8d2d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 28 Jan 2006 16:39:46 +0100 Subject: whitespace fixes Signed-off-by: Kay Sievers --- Makefile | 8 ++++---- extras/eventrecorder.sh | 2 +- logging.h | 4 ++-- udev.xml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 460ccf9ee7..1234160d63 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Makefile for udev # # Copyright (C) 2003,2004 Greg Kroah-Hartman -# Copyright (C) 2004-2005 Kay Sievers +# Copyright (C) 2004-2006 Kay Sievers # # 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 @@ -43,7 +43,7 @@ USE_STATIC = false # make EXTRAS="extras/ extras/" EXTRAS = -# make the build silent. +# make the build silent V = PROGRAMS = \ @@ -213,8 +213,8 @@ udev_version.h: $(Q) echo "/* Generated by make. */" > $@ $(Q) echo \#define UDEV_VERSION \"$(VERSION)\" >> $@ $(Q) echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ - $(Q) echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ - $(Q) echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ + $(Q) echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ + $(Q) echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ # man pages %.8 %.7: %.xml diff --git a/extras/eventrecorder.sh b/extras/eventrecorder.sh index 95ec95a24e..d3e4a70c95 100755 --- a/extras/eventrecorder.sh +++ b/extras/eventrecorder.sh @@ -1,4 +1,4 @@ #!/bin/sh [ -d /events ] || exit 0 -set > /events/debug.$SEQNUM.$1.$ACTION.$$ +set > /events/debug.$SEQNUM.$SUBSYSTEM.$ACTION.$$ diff --git a/logging.h b/logging.h index dd520dd874..00b5f23b25 100644 --- a/logging.h +++ b/logging.h @@ -38,13 +38,13 @@ #undef err #define err(format, arg...) \ do { \ - log_message(LOG_ERR ,"%s: " format ,__FUNCTION__ ,## arg); \ + log_message(LOG_ERR ,"%s: " format ,__FUNCTION__ ,## arg); \ } while (0) #undef info #define info(format, arg...) \ do { \ - log_message(LOG_INFO ,"%s: " format ,__FUNCTION__ ,## arg); \ + log_message(LOG_INFO ,"%s: " format ,__FUNCTION__ ,## arg); \ } while (0) #ifdef DEBUG diff --git a/udev.xml b/udev.xml index e0542a6be1..bf5676bee6 100644 --- a/udev.xml +++ b/udev.xml @@ -11,7 +11,7 @@ kay.sievers@vrfy.org - 2005 + 2006 Kay Sievers -- cgit v1.2.3-54-g00ecf From 3d94fb8742847afe8396f6dd38b16ff4e836611d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 28 Jan 2006 16:42:49 +0100 Subject: scsi_id: remove dead files Signed-off-by: Kay Sievers --- extras/scsi_id/ChangeLog | 208 ------------------------------------------- extras/scsi_id/README | 14 +-- extras/scsi_id/TODO | 8 -- extras/scsi_id/release-notes | 23 ----- extras/scsi_id/scsi.h | 17 +--- extras/scsi_id/scsi_id.c | 19 ++-- extras/scsi_id/scsi_id.h | 17 +--- extras/scsi_id/scsi_serial.c | 18 ++-- 8 files changed, 19 insertions(+), 305 deletions(-) delete mode 100644 extras/scsi_id/ChangeLog delete mode 100644 extras/scsi_id/TODO delete mode 100644 extras/scsi_id/release-notes diff --git a/extras/scsi_id/ChangeLog b/extras/scsi_id/ChangeLog deleted file mode 100644 index d2a8be5b18..0000000000 --- a/extras/scsi_id/ChangeLog +++ /dev/null @@ -1,208 +0,0 @@ -2004-oct-15: - * Makefile: Add $(QUIET) to sync with the udev version. - -2004-oct-06: - * scsi_id.c: fix alignment for use with 64 bit pointers - -2004-jul-30: - * scsi_id.c, scsi_serial.c: Align the buffer passed to scsi_serial, - don't bother aligning and memcpy-ing the result in scsi_inquiry. - Aligning to 512 probably does not help, since the IO length of - 254 is not a multiple of 512. - -2004-jul-30: - * scsi.h, scsi_serial.c: Use a define for the SCSI INQUIRY buffer - length. - -2004-jul-30: - * scsi_id.c: Patch from add a -u flag - to substitute white space with underscores so it is easier to use - the output as a device name. - -2004-jul-30: - * scsi_serial.c: Patch from Hannes Reinecke use 254 - bytes for SCSI INQUIRY commands. - -2004-jul-28: - * scsi_id.h, scsi_serial.c: get rid of dumb/dead code, and use a - 512 byte aligned buffer. - -2004-jun-23: - * scsi_id.h: increase MAX_SERIAL_LEN from 128 to 256, as some - devices (maybe broken ones) are giving really long id's. - -2004-jun-17: - * Makefile: Olaf Hering add spotless target (already in udev). - -2004-jun-17: - * scsi_serial.c: Include linux/compiler.h so we can build with - klibc using kernel headers. - -2004-may-24: - * scsi_id.c: Rename major and minor to maj min to avoid compiler - warnings when compiled with -D_GNU_SOURCE. - -2004-mar-30: - * scsi_id.config: Minor wording changes - -2004-mar-30: - * scsi_id.h: Don't supply a makedev() when built under klibc. - -2004-mar-30: - * scsi_id.c: Ken Brush Have the command line - options override generic options. - -2004-mar-05: - * scsi_serial.c: Log INQUIRY failure, including the - failing page code and vpd values. And add a dprintf() to - the scsi_inquiry function. - -2004-mar-02: - * gen_scsi_id_udev_rules.sh: Per bug report from Atul Sabharwal - change to not require that sysfs be - in the mount tab (and default to "/sys"), and fix so scsi_id - results containing spaces work correctly. - -2004-mar-02: - * scsi_id.8: Escape '-' with '\-'. - -2004-feb-25: - * scsi_id.8: Add verbage about usage with udev, and running via - hotplug. - -2004-feb-25: - * scsi_id.c, scsi_id.8: Disable support for -e (all output to - stderr) as it cannot be used in any useful way, and the -c - (device specific callout) as the code is incomplete and has no - users. - -2004-feb-25: - * scsi_id.c: Don't print errno for NULL return from - sysfs_get_classdev_device. - -2004-feb-23: - * scsi_id.c: Get rid of dead/leftover code that checked - if we are on a scsi bus. - -2004-feb-23: - * scsi_serial.c, scsi_id.c: Use ":" consistently in output messages. - -2004-feb-23: - * scsi_serial.c: Add missing new lines for some error messages. - -2004-feb-23: - * scsi_serial.c: open O_NONBLOCK so we handle tape drives without - tapes loaded. - -2004-feb-20: - * scsi_id.h, scsi_id.c: Remove hacks based on KLIBC define to get - around problems when building with udev (udev libsysfs files - were rearranged). - -2004-feb-19: - * scsi_id.h, scsi_id.c, scsi_serial.c: As done in udev code, support - partitions via looking for a parent of the target path. Uses - libsysfs functions to do most of the work, and includes changing - a lot of variables to be struct sysfs_device instead of - sysfs_class_device. - -2004-feb-19: - * Makefile: Version 0.4 - -2004-jan-15: - * Makefile: Version 0.3 - -2004-jan-13: - * scsi_id.c, Makefile: Fix prefix usage with scsi_id.config. - -2004-jan-13: - * scsi_id.config: Clean up some comment entries. - -2004-jan-13: - * Makefile: Install the sample scsi_id.config file. - -2004-jan-13: - * Makefile: Use DESTDIR in all install/uninstall rules, per - problem reported by Svetoslav Slavtchev. - -2004-jan-12: - * scsi_id.h, scsi_id.c, scsi_serial.c: Fix to work with current - sysfs 0.4, based on patch from Dan Stekloff, but uses - sysfs_read_attribute_value instead of - sysfs_get_value_from_attributes. - -2004-jan-08: - * scsi_id.c: SYSFS_BUS_DIR was replaced with SYSFS_BUS_NAME. - -2004-jan-08: - * scsi_id.c: Must now use sysfs_open_class_device_path instead of the - previous sysfs_open_class_device. - -2003-dec-07: - * Makefile: patch from Olaf Hering remove DEBUG and - add --fno-builtin - -2003-dec-05: - * Makefile, scsi_id.8: Add a man page. - -2003-dec-04: - * Makefile: Set and use variables that might be passed down when - built under udev (with or without klibc), don't set LDFLAGS or - STRIP. - -2003-dec-04: - * scsi_id.c, scsi_id.h: Fix a bad bug - when parsing file options, - no space was allocated for the creation of the new argv[] - strings. - -2003-dec-04: - * scsi_id.c: Catch too long a line in the config file. - -2003-dec-02: - * scsi_id.h: Add u8 typedef to avoid ummm scsi.h kernel header - problem when built with klibc. - -2003-dec-02: - * scsi_id.h: Add define of makedev() if built with klibc. - -2003-dec-02: - * scsi_id.c: reset optind to 1 since klibc does not work if it is - reset to zero. - -2003-dec-02: - * scsi_id.c: remove fflush() as it is not needed, and is not - supported by klibc. - -2003-dec-02: - * scsi_serial.c: Make the functions do_scsi_page0_inquiry and - do_scsi_page80_inquiry static. - -2003-dec-01: - * scsi_id.c: Don't use syslog LOG_PID, as it is not supported by - klibc. - -2003-dec-01: - * scsi_id.c, scsi_serial.c: Hack - change include path to libsysfs - if built under klibc. - -2003-dec-01: - * Makefile: Use "override" for CFLAGS so we can pass CFLAGS values - down when built with udev - -2003-dec-01: - * scsi_id.c, Makefile: Use SCSI_ID_VERSION instead of VERSION. - -2003-nov-25: - * scsi_id.c: Remove getopt_long (long option names), as there - is no support for that in klibc. - -2003-nov-17: - * scsi_id.c: Patch from Brian King : check - result of setting model, not vendor in per_dev_options. - -2003-nov-03: - * scsi_id.c, scsi_serial.c: Use new and correct path to libsysfs.h. - -2003-nov-03: - * scsi_id.h: Fix scsi_id.h so var args in macros works ok with - older gcc. diff --git a/extras/scsi_id/README b/extras/scsi_id/README index 97af517304..9cfe73991c 100644 --- a/extras/scsi_id/README +++ b/extras/scsi_id/README @@ -1,14 +1,4 @@ scsi_id - generate a SCSI unique identifier for a given SCSI device -Primarily for use with udev callout config entries. This could also be -used by a multi-path configuration tool that requires SCSI id's. - -Requires: - - - Linux kernel 2.6 - - - sysfsutils 0.4 - -Build via make and make install. - -Please send questions, comments or patches to patmans@us.ibm.com. +Please send questions, comments or patches to or +. diff --git a/extras/scsi_id/TODO b/extras/scsi_id/TODO deleted file mode 100644 index 857c22b87a..0000000000 --- a/extras/scsi_id/TODO +++ /dev/null @@ -1,8 +0,0 @@ -- Add a bus white/black list option. So for example, all scsi devices - under USB could easily be blacklisted. This should allow multiple busses - to be listed. - -- Add code to check that SCSI commands get back enough data for their - intended usage, mainly callers of scsi_inquiry(). - -- Document the config file in the man page diff --git a/extras/scsi_id/release-notes b/extras/scsi_id/release-notes deleted file mode 100644 index c7ea51679c..0000000000 --- a/extras/scsi_id/release-notes +++ /dev/null @@ -1,23 +0,0 @@ -Version 0.7 of scsi_id is available at: - -http://www-124.ibm.com/storageio/scsi_id/scsi_id-0.7.tar.gz - -scsi_id is a program to generate a unique identifier for a given SCSI -device. - -It is primarily for use with the udev program key, or hotplug scripts that -want persistent naming of scsi devices. It could also be used for -automatic multi-path configuration or device mapper configuration. - -Requires: - -- Linux kernel 2.6 -- libsysfs 0.4.0 - -Changes since the last release: - - - Fix a bug introduced in version 0.6 so that buffer alignement - works on 64 bit systems. Without this fix, it crashes on 64 bit - systems. - - - Add $(QUIET) to sync up with the udev Makefile diff --git a/extras/scsi_id/scsi.h b/extras/scsi_id/scsi.h index 212765a17d..f5aa686f71 100644 --- a/extras/scsi_id/scsi.h +++ b/extras/scsi_id/scsi.h @@ -5,20 +5,9 @@ * * Copyright (C) IBM Corp. 2003 * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of the - * License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA + * 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. */ #include diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 6458f2b7ac..2ffc95fbfe 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -4,21 +4,14 @@ * Main section of the scsi_id program * * Copyright (C) IBM Corp. 2003 + * Copyright (C) SUSE Linux Products GmbH, 2006 * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of the - * License, or (at your option) any later version. + * Author: + * Patrick Mansfield * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA + * 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. */ #include diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 758706ba25..64ea349064 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -5,20 +5,9 @@ * * Copyright (C) IBM Corp. 2003 * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of the - * License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA + * 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. */ #define MAX_PATH_LEN 512 diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index bdebe94eb3..0ecfebe1b6 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -5,20 +5,12 @@ * * Copyright (C) IBM Corp. 2003 * - * This library is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of the - * License, or (at your option) any later version. + * Author: + * Patrick Mansfield * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA + * 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. */ #include -- cgit v1.2.3-54-g00ecf From 34f55103c5d451d247fc3b57579a6b3c1de0d58d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 29 Jan 2006 02:09:35 +0100 Subject: optimize sysfs device and attribute cache Add negative cache for attributes and look for device in cache before doing any sysfs access. (Three times speed up for a stupid 1000 rules SYSFS file). Signed-off-by: Kay Sievers --- udev.h | 1 + udev_sysfs.c | 70 ++++++++++++++++++++++++++++++++++++++---------------------- 2 files changed, 45 insertions(+), 26 deletions(-) diff --git a/udev.h b/udev.h index 0c7ca12f10..2652d46ada 100644 --- a/udev.h +++ b/udev.h @@ -54,6 +54,7 @@ struct udev_rules; struct sysfs_device { struct list_head node; /* for device cache */ + struct sysfs_device *parent; /* already cached parent*/ char devpath[PATH_SIZE]; char subsystem[NAME_SIZE]; /* $class/$bus/"drivers" */ char kernel_name[NAME_SIZE]; /* device instance name */ diff --git a/udev_sysfs.c b/udev_sysfs.c index 8de523dadf..b579c17caa 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -40,7 +40,8 @@ static LIST_HEAD(attr_list); struct sysfs_attr { struct list_head node; char path[PATH_SIZE]; - char value[NAME_SIZE]; + char *value; /* points to value_local if value is cached */ + char value_local[NAME_SIZE]; }; int sysfs_init(void) @@ -126,14 +127,21 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strlcpy(devpath_real, devpath, sizeof(devpath_real)); remove_trailing_chars(devpath_real, '/'); + /* look for device already in cache (we never put an untranslated path in the cache) */ + list_for_each_entry(dev_loop, &dev_list, node) { + if (strcmp(dev_loop->devpath, devpath_real) == 0) { + dbg("found in cache '%s'", dev_loop->devpath); + return dev_loop; + } + } + + /* if we got a link, resolve it to the real device */ strlcpy(path, sysfs_path, sizeof(path)); strlcat(path, devpath_real, sizeof(path)); if (lstat(path, &statbuf) != 0) { dbg("stat '%s' failed: %s", path, strerror(errno)); return NULL; } - - /* if we got a link, resolve it to the real device */ if (S_ISLNK(statbuf.st_mode)) { int i; int back; @@ -156,17 +164,17 @@ struct sysfs_device *sysfs_device_get(const char *devpath) dbg("after moving back '%s'", devpath_real); strlcat(devpath_real, "/", sizeof(devpath_real)); strlcat(devpath_real, &link_target[back * 3], sizeof(devpath_real)); - } - /* look for device in cache */ - list_for_each_entry(dev_loop, &dev_list, node) { - if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'", dev_loop->devpath); - return dev_loop; + /* now look for device in cache after path translation */ + list_for_each_entry(dev_loop, &dev_list, node) { + if (strcmp(dev_loop->devpath, devpath_real) == 0) { + dbg("found in cache '%s'", dev_loop->devpath); + return dev_loop; + } } } - /* new device */ + /* it is a new device */ dbg("'%s'", devpath_real); dev = malloc(sizeof(struct sysfs_device)); if (dev == NULL) @@ -245,6 +253,9 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) int len; int back; + if (dev->parent != NULL) + return dev->parent; + /* requesting a parent is only valid for devices */ if ((strncmp(dev->devpath, "/devices/", 9) != 0) && (strncmp(dev->devpath, "/class/", 7) != 0) && @@ -266,12 +277,11 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) return NULL; } - /* at the top level we may follow the "device" link */ + /* at the top level of class/block we want to follow the "device" link */ if (strcmp(parent_devpath, "/block") == 0) { dbg("/block top level, look for device link"); goto device_link; } - if (strncmp(parent_devpath, "/class", 6) == 0) { pos = strrchr(parent_devpath, '/'); if (pos == &parent_devpath[6] || pos == parent_devpath) { @@ -279,7 +289,8 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) goto device_link; } } - return sysfs_device_get(parent_devpath); + dev->parent = sysfs_device_get(parent_devpath); + return dev->parent; device_link: strlcpy(device_link, sysfs_path, sizeof(device_link)); @@ -304,7 +315,9 @@ device_link: dbg("after moving back '%s'", parent_devpath); strlcat(parent_devpath, "/", sizeof(parent_devpath)); strlcat(parent_devpath, &device_link_target[back * 3], sizeof(parent_devpath)); - return sysfs_device_get(parent_devpath); + + dev->parent = sysfs_device_get(parent_devpath); + return dev->parent; } struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem) @@ -345,27 +358,32 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) } } + /* store attribute in cache (also negatives are kept in cache) */ + attr = malloc(sizeof(struct sysfs_attr)); + if (attr == NULL) + return NULL; + memset(attr, 0x00, sizeof(struct sysfs_attr)); + strlcpy(attr->path, path, sizeof(attr->path)); + dbg("add to cache '%s' '%s'", attr->path, attr->value); + list_add(&attr->node, &attr_list); + /* read attribute value */ fd = open(path_full, O_RDONLY); if (fd < 0) - return NULL; + goto out; size = read(fd, value, sizeof(value)); close(fd); if (size < 0) - return NULL; + goto out; if (size == sizeof(value)) - return NULL; + goto out; + + /* got a valid value, store and return it */ value[size] = '\0'; remove_trailing_chars(value, '\n'); + strlcpy(attr->value_local, value, sizeof(attr->value_local)); + attr->value = attr->value_local; - /* store attribute in cache */ - attr = malloc(sizeof(struct sysfs_attr)); - if (attr == NULL) - return NULL; - strlcpy(attr->path, path, sizeof(attr->path)); - strlcpy(attr->value, value, sizeof(attr->value)); - dbg("add to cache '%s' '%s'", attr->path, attr->value); - list_add(&attr->node, &attr_list); - +out: return attr->value; } -- cgit v1.2.3-54-g00ecf From 9538b16d8b6086691dd01d76dea91ba73d13a630 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 29 Jan 2006 17:08:44 +0100 Subject: let SYSFS{} look at the device, not only the parent device The stricter parent logic broke: BUS=="ide", SYSFS{removable}=="1", ... cause removable is on the block device, which isn't a ide device. Just look for matching attributes at the device and the selected parent device at the same time now. Signed-off-by: Kay Sievers --- udev_rules.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index f1bbfd854c..8e9c1605bf 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -348,14 +348,14 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) snprintf(filename, sizeof(filename), "%s%s/%s", sysfs_path, udev->dev->devpath, file); filename[sizeof(filename)-1] = '\0'; - dbg("wait %i sec for '%s'", timeout, filename); + dbg("will wait %i sec for '%s'", timeout, filename); while (--loop) { if (stat(filename, &stats) == 0) { info("file '%s' appeared after %i loops", filename, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } - info("wait for %i mseconds", 1000 / WAIT_LOOP_PER_SECOND); + info("wait for '%s' for %i mseconds", filename, 1000 / WAIT_LOOP_PER_SECOND); usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } err("waiting for '%s' failed", filename); @@ -781,6 +781,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) size_t len; value = sysfs_attr_get_value(udev->dev_parent->devpath, key_name); + if (value == NULL) + value = sysfs_attr_get_value(udev->dev->devpath, key_name); if (value == NULL) goto try_parent; strlcpy(val, value, sizeof(val)); -- cgit v1.2.3-54-g00ecf From 7e75cfa6fe0818ffb76c2a5a88c8572f04bda879 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 30 Jan 2006 08:39:55 +0100 Subject: add debug output to sysfs operations Signed-off-by: Kay Sievers --- udev_sysfs.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index b579c17caa..ddc0b46790 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -175,7 +175,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) } /* it is a new device */ - dbg("'%s'", devpath_real); + dbg("new uncached device '%s'", devpath_real); dev = malloc(sizeof(struct sysfs_device)); if (dev == NULL) return NULL; @@ -253,6 +253,9 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) int len; int back; + dbg("open '%s'", dev->devpath); + + /* look if we already know the parent */ if (dev->parent != NULL) return dev->parent; @@ -271,7 +274,7 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) return NULL; pos[0] = '\0'; - /* are we at the top level */ + /* are we at the top level of /devices */ if (strcmp(parent_devpath, "/devices") == 0) { dbg("/devices top level"); return NULL; @@ -289,6 +292,7 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) goto device_link; } } + /* get parent and remember it */ dev->parent = sysfs_device_get(parent_devpath); return dev->parent; @@ -316,6 +320,7 @@ device_link: strlcat(parent_devpath, "/", sizeof(parent_devpath)); strlcat(parent_devpath, &device_link_target[back * 3], sizeof(parent_devpath)); + /* get parent and remember it */ dev->parent = sysfs_device_get(parent_devpath); return dev->parent; } @@ -344,6 +349,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) ssize_t size; size_t sysfs_len; + dbg("open '%s'/'%s'", devpath, attr_name); sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); path = &path_full[sysfs_len]; strlcat(path_full, devpath, sizeof(path_full)); @@ -359,18 +365,21 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) } /* store attribute in cache (also negatives are kept in cache) */ + dbg("new uncached attribute '%s'", path_full); attr = malloc(sizeof(struct sysfs_attr)); if (attr == NULL) return NULL; memset(attr, 0x00, sizeof(struct sysfs_attr)); strlcpy(attr->path, path, sizeof(attr->path)); - dbg("add to cache '%s' '%s'", attr->path, attr->value); + dbg("add to cache '%s'", path_full); list_add(&attr->node, &attr_list); /* read attribute value */ fd = open(path_full, O_RDONLY); - if (fd < 0) + if (fd < 0) { + dbg("attribute '%s' does not exist", path_full); goto out; + } size = read(fd, value, sizeof(value)); close(fd); if (size < 0) @@ -381,6 +390,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* got a valid value, store and return it */ value[size] = '\0'; remove_trailing_chars(value, '\n'); + dbg("cache '%s' with value '%s'", path_full, value); strlcpy(attr->value_local, value, sizeof(attr->value_local)); attr->value = attr->value_local; -- cgit v1.2.3-54-g00ecf From 66c2bc212087d02faf77520b52ef6177d5c351fa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 30 Jan 2006 08:51:38 +0100 Subject: 084 release --- ChangeLog | 16 ++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 8 +++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2137019cf..8f0e9b157b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Summary of changes from v083 to v084 +============================================ + +Kay Sievers: + update SUSE rules + switch CROSS to CROSS_COMPILE + replace fancy silent build program by simple kernel build like logic + move manpages to top level + remove UDEVD_UEVENT_INITSEND + whitespace fixes + scsi_id: remove dead files + optimize sysfs device and attribute cache + let SYSFS{} look at the device, not only the parent device + add debug output to sysfs operations + + Summary of changes from v082 to v083 ============================================ diff --git a/Makefile b/Makefile index 1234160d63..55cecd3755 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 083 +VERSION = 084 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 27545893c9..50831aceba 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,6 +1,12 @@ udev 084 ======== -CROSS changed to CROSS_COMPILE to match the kernel build. +If BUS== and SYSFS{}== have been used in the same rule, the sysfs +attributes are only checked at the parent device that matched the +by BUS requested subsystem. Fix t to also look at the device we +received the event for. + +Build variable CROSS has changed to CROSS_COMPILE to match the kernel +build name. udev 083 ======== -- cgit v1.2.3-54-g00ecf From f8db897faaaf3417ed0a31a39c7f47cc8cf40bd6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 31 Jan 2006 16:24:22 +0100 Subject: make WAIT_FOR_SYSFS usable in non "wait-only" rules Thanks to Andrey Borzenkov for noticing this and the initial patch to fix it. Signed-off-by: Kay Sievers --- udev_rules.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 8e9c1605bf..e9b32df1c6 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -733,19 +733,13 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) } if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { - int match; + int found; - match = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0); - if (match && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) { - dbg("WAIT_FOR_SYSFS is true (matching value)"); - return 0; - } - if (!match && (rule->wait_for_sysfs.operation == KEY_OP_NOMATCH)) { - dbg("WAIT_FOR_SYSFS is true, (non matching value)"); - return 0; + found = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0); + if (!found && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) { + dbg("WAIT_FOR_SYSFS failed"); + goto nomatch; } - dbg("WAIT_FOR_SYSFS is false"); - return -1; } /* walk up the chain of parent devices and find a match */ -- cgit v1.2.3-54-g00ecf From b3e8c12b2d18897d6d9220607fc32ee18e5db4ac Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Wed, 1 Feb 2006 02:01:12 +0100 Subject: Fix trivial spelling errors in RELEASE-NOTES Signed-off-by: Andrey Borzenkov --- RELEASE-NOTES | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 50831aceba..c8e7baa4db 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,8 +1,8 @@ udev 084 ======== If BUS== and SYSFS{}== have been used in the same rule, the sysfs -attributes are only checked at the parent device that matched the -by BUS requested subsystem. Fix t to also look at the device we +attributes were only checked at the parent device that matched the +by BUS requested subsystem. Fix it to also look at the device we received the event for. Build variable CROSS has changed to CROSS_COMPILE to match the kernel @@ -22,7 +22,7 @@ to the key like RUN+="/bin/program $env{SUBSYSTEM}". udev 082 ======== -The udev man page has moced to udev(7) as it doesnot describe a command +The udev man page has moved to udev(7) as it does not describe a command anymore. The programs udev, udevstart and udevsend are no longer installed by default and must be copied manually, if they should be installed or included in a package. -- cgit v1.2.3-54-g00ecf From a2a7f7d7af3c44bf9390c9fe168993f4d0916807 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Feb 2006 02:08:11 +0100 Subject: fix typo in man page Thanks to Joachim Breitner . --- udev.7 | 2 +- udev.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udev.7 b/udev.7 index 711bd0861b..75db2b72a5 100644 --- a/udev.7 +++ b/udev.7 @@ -138,7 +138,7 @@ Add a program to the list of programs to be executed for a specific device. Named label where a GOTO can jump to. .TP \fBGOTO\fR -Jumps to the next LABEL with a matching gname +Jumps to the next LABEL with a matching name .TP \fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR Import the printed result or the value of a file in environment key format into the event environment. diff --git a/udev.xml b/udev.xml index bf5676bee6..51288c0089 100644 --- a/udev.xml +++ b/udev.xml @@ -315,7 +315,7 @@ - Jumps to the next LABEL with a matching gname + Jumps to the next LABEL with a matching name -- cgit v1.2.3-54-g00ecf From 67f69ae17c2ba2cf54ca40ece1dc42418fb72aaa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Feb 2006 13:52:37 +0100 Subject: include sys/socket.h for klibc build Requested by Aaron Griffin --- udev_add.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udev_add.c b/udev_add.c index 6de2858313..398dcb58fa 100644 --- a/udev_add.c +++ b/udev_add.c @@ -26,11 +26,12 @@ #include #include #include +#include #include #include -#include -#include +#include #include +#include #include #include "udev.h" -- cgit v1.2.3-54-g00ecf From 42878445d73b19096e068e50a0ab86c9fa047c63 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 13 Feb 2006 06:29:30 +0100 Subject: cramfs detection for bigendian Patch from Olaf Hering . --- extras/volume_id/libvolume_id/cramfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/libvolume_id/cramfs.c b/extras/volume_id/libvolume_id/cramfs.c index 0ad5886b32..bf79407d9d 100644 --- a/extras/volume_id/libvolume_id/cramfs.c +++ b/extras/volume_id/libvolume_id/cramfs.c @@ -52,7 +52,7 @@ int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) if (cs == NULL) return -1; - if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0) { + if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0 || memcmp(cs->magic, "\x28\xcd\x3d\x45", 4) == 0) { volume_id_set_label_raw(id, cs->name, 16); volume_id_set_label_string(id, cs->name, 16); -- cgit v1.2.3-54-g00ecf From 656ba91ee111308b53938b0f518ccbfadada9aa0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Feb 2006 20:43:28 +0100 Subject: exit WAIT_FOR_SYSFS if the whole device goes away Signed-off-by: Kay Sievers --- udev_rules.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index e9b32df1c6..9fa2253e96 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -342,23 +342,33 @@ out: #define WAIT_LOOP_PER_SECOND 50 static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) { - char filename[PATH_SIZE]; + char devicepath[PATH_SIZE]; + char filepath[PATH_SIZE]; struct stat stats; int loop = timeout * WAIT_LOOP_PER_SECOND; - snprintf(filename, sizeof(filename), "%s%s/%s", sysfs_path, udev->dev->devpath, file); - filename[sizeof(filename)-1] = '\0'; - dbg("will wait %i sec for '%s'", timeout, filename); + strlcpy(devicepath, sysfs_path, sizeof(devicepath)); + strlcat(devicepath, udev->dev->devpath, sizeof(devicepath)); + strlcpy(filepath, devicepath, sizeof(filepath)); + strlcat(filepath, "/", sizeof(filepath)); + strlcat(filepath, file, sizeof(filepath)); + dbg("will wait %i sec for '%s'", timeout, filepath); while (--loop) { - if (stat(filename, &stats) == 0) { - info("file '%s' appeared after %i loops", filename, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + /* lookup file */ + if (stat(filepath, &stats) == 0) { + info("file '%s' appeared after %i loops", filepath, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } - info("wait for '%s' for %i mseconds", filename, 1000 / WAIT_LOOP_PER_SECOND); + /* make sure the device does not have disappeared in the meantime */ + if (stat(devicepath, &stats) != 0) { + info("device disappeared while waiting for '%s'", filepath); + return -2; + } + info("wait for '%s' for %i mseconds", filepath, 1000 / WAIT_LOOP_PER_SECOND); usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - err("waiting for '%s' failed", filename); + err("waiting for '%s' failed", filepath); return -1; } -- cgit v1.2.3-54-g00ecf From 348f9dfa0461a9e3d93c360de59f4959b0c97fd4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Feb 2006 20:54:53 +0100 Subject: update SUSE rules --- etc/udev/suse/60-persistent-disk.rules | 14 +++++++------- etc/udev/suse/60-persistent-input.rules | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 etc/udev/suse/60-persistent-input.rules diff --git a/etc/udev/suse/60-persistent-disk.rules b/etc/udev/suse/60-persistent-disk.rules index 3515bb189d..bcbd7721ab 100644 --- a/etc/udev/suse/60-persistent-disk.rules +++ b/etc/udev/suse/60-persistent-disk.rules @@ -1,14 +1,14 @@ # persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} # scheme based on "Linux persistent device names", 2004, Hannes Reinecke -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" +ACTION!="add", GOTO="persistent_disk_end" +SUBSYSTEM!="block", GOTO="persistent_disk_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_disk_end" # never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" +BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_disk_end" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" @@ -28,12 +28,12 @@ KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{I # by-path (shortest physical path) KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="persistent_end" +KERNEL=="sr*", GOTO="persistent_disk_end" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_disk_end" IMPORT{program}="/sbin/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" @@ -45,4 +45,4 @@ KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part% KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" -LABEL="persistent_end" +LABEL="persistent_disk_end" diff --git a/etc/udev/suse/60-persistent-input.rules b/etc/udev/suse/60-persistent-input.rules new file mode 100644 index 0000000000..2a74d15482 --- /dev/null +++ b/etc/udev/suse/60-persistent-input.rules @@ -0,0 +1,20 @@ +ACTION!="add", GOTO="persistent_input_end" +SUBSYSTEM!="input", GOTO="persistent_input_end" +KERNEL=="input[0-9]*", GOTO="persistent_input_end" + +# usb devices +BUS=="usb", IMPORT{program}="/sbin/usb_id -x" +BUS=="usb", SYSFS{bInterfaceClass}="03", SYSFS{bInterfaceProtocol}="01", ENV{ID_CLASS}="kbd" +BUS=="usb", SYSFS{bInterfaceClass}="03", SYSFS{bInterfaceProtocol}="02", ENV{ID_CLASS}="mouse" + +# by-id links +KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" + +# by-path +IMPORT{program}="/sbin/path_id %p" +ENV{ID_PATH}=="?*", KERNEL=="mouse*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" + +LABEL="persistent_input_end" + -- cgit v1.2.3-54-g00ecf From bee6e24fa94fced3a23115ca020f041ed9ed9143 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Feb 2006 20:57:29 +0100 Subject: update Red Hat rules --- etc/udev/redhat/05-udev-early.rules | 9 +++ etc/udev/redhat/95-pam-console.rules | 1 + etc/udev/redhat/hotplug.rules | 13 +++- etc/udev/redhat/udev.rules | 118 ++++++++++++++++++----------------- 4 files changed, 82 insertions(+), 59 deletions(-) create mode 100644 etc/udev/redhat/05-udev-early.rules create mode 100644 etc/udev/redhat/95-pam-console.rules diff --git a/etc/udev/redhat/05-udev-early.rules b/etc/udev/redhat/05-udev-early.rules new file mode 100644 index 0000000000..9a96b6a198 --- /dev/null +++ b/etc/udev/redhat/05-udev-early.rules @@ -0,0 +1,9 @@ +# sysfs is populated after the event is sent +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" + +# ignore these events until someone needs them +SUBSYSTEM=="drivers", OPTIONS="ignore_device" +SUBSYSTEM=="module", OPTIONS="ignore_device" + +ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN="/sbin/firmware_helper", OPTIONS="last_rule" diff --git a/etc/udev/redhat/95-pam-console.rules b/etc/udev/redhat/95-pam-console.rules new file mode 100644 index 0000000000..8de9249c28 --- /dev/null +++ b/etc/udev/redhat/95-pam-console.rules @@ -0,0 +1 @@ +ACTION=="add", SYSFS{dev}="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}" diff --git a/etc/udev/redhat/hotplug.rules b/etc/udev/redhat/hotplug.rules index 1f4369c36b..4c47976ee5 100644 --- a/etc/udev/redhat/hotplug.rules +++ b/etc/udev/redhat/hotplug.rules @@ -1,8 +1,15 @@ # do not call hotplug.d and dev.d for "drivers" and "module" events -SUBSYSTEM=="drivers", OPTIONS="last_rule" -SUBSYSTEM=="module", OPTIONS="last_rule" +SUBSYSTEM=="drivers", GOTO="hotplug_end" +SUBSYSTEM=="module", GOTO="hotplug_end" +ACTION="add", GOTO="hotplug_comp" +ACTION="remove", GOTO="hotplug_comp" +GOTO="hotplug_end" + +LABEL="hotplug_comp" # compatibility support for the obsolete hotplug.d and dev.d directories -ENV{UDEVD_EVENT}=="1", RUN+="/lib/udev/udev_run_hotplugd" +ENV{UDEVD_EVENT}=="1", RUN+="/lib/udev/udev_run_hotplugd" RUN+="/lib/udev/udev_run_devd" + +LABEL="hotplug_end" diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules index ba10fd5501..dbd62c397b 100644 --- a/etc/udev/redhat/udev.rules +++ b/etc/udev/redhat/udev.rules @@ -3,6 +3,7 @@ # # default is OWNER="root" GROUP="root", MODE="0600" # + KERNEL="*", OWNER="root" GROUP="root", MODE="0600" # all block devices @@ -10,40 +11,44 @@ SUBSYSTEM=="block", GROUP="disk", MODE="0640" KERNEL=="root", GROUP="disk", MODE="0640" # console devices -KERNEL=="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="console", MODE="0600", OPTIONS="last_rule" -KERNEL=="tty[0-9]", GROUP="tty", MODE="0660", OPTIONS="last_rule" -KERNEL=="tty[0-9][0-9]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" -KERNEL=="vc/[0-9]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="console", NAME="%k", MODE="0600", OPTIONS="last_rule" +KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="vc/[0-9]*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" # pty devices # Set this to 0660 if you only want users belonging to tty group # to be able to allocate PTYs -KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="pty[p-za-e][0-9a-f]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" -KERNEL=="tty[p-za-e][0-9a-f]*", GROUP="tty", MODE="0660", OPTIONS="last_rule" -KERNEL=="pty/m*", GROUP="tty", MODE="0660", OPTIONS="last_rule" -KERNEL=="vc/s*", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule" +KERNEL=="pty/m*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" # serial+dialup devices -KERNEL=="ttyS*", GROUP="uucp", MODE="0660", OPTIONS="last_rule" -KERNEL=="ttyACM*", GROUP="uucp", MODE="0660", OPTIONS="last_rule" -KERNEL=="ttyUSB*", GROUP="uucp", MODE="0660", OPTIONS="last_rule" -KERNEL=="ippp*", MODE="0660" -KERNEL=="isdn*", MODE="0660" -KERNEL=="isdnctrl*", MODE="0660" -KERNEL=="capi*", MODE="0660" -KERNEL=="dcbri*", MODE="0660" -KERNEL=="ircomm*", GROUP="uucp", MODE="0660" -KERNEL=="tts/[0-9]*", GROUP="uucp", MODE="0660" -KERNEL=="tts/USB[0-9]*", GROUP="uucp", MODE="0660" +KERNEL=="ippp*", NAME="%k", MODE="0660" +KERNEL=="isdn*", NAME="%k", MODE="0660" +KERNEL=="isdnctrl*", NAME="%k", MODE="0660" +KERNEL=="capi*", NAME="%k", MODE="0660" +KERNEL=="dcbri*", NAME="%k", MODE="0660" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="tts/[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="tts/USB[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="pppox*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="hvc*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="hvsi*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot" +KERNEL=="ttyUSB*", SYSFS{product}=="palmOne Handheld*", SYMLINK+="pilot" # vc devices -KERNEL=="vcs", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcs[0-9]*", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcsa", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcsa[0-9]*", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcc/*", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcs[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcsa", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcsa[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcc/*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" # memory devices KERNEL=="random", MODE="0666", OPTIONS="last_rule" @@ -54,6 +59,8 @@ KERNEL=="port", GROUP="kmem", MODE="0640", OPTIONS="last_rule" KERNEL=="full", MODE="0666", OPTIONS="last_rule" KERNEL=="null", MODE="0666", OPTIONS="last_rule" KERNEL=="zero", MODE="0666", OPTIONS="last_rule" +# 183 = /dev/hwrng Generic random number generator +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" # misc devices KERNEL=="nvram", MODE="0660" @@ -61,6 +68,10 @@ KERNEL=="rtc", MODE="0644" # floppy devices KERNEL=="fd[01]*", GROUP="floppy", MODE="0660" +# fix floppy devices +KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" +KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f /dev/%k*'" # audio devices KERNEL=="dsp*", MODE="0660" @@ -209,7 +220,7 @@ KERNEL=="pcd[0-9]*", SYMLINK+="cdrom%e" KERNEL=="fd[0-9]*", SYMLINK+="floppy%e" KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK+="tape%e", MODE="0660" KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK+="tape%e", MODE="0660" -KERNEL=="sg[0-9]*", BUS="scsi", SYSFS{type}=="6", SYMLINK+="scanner%e", MODE="0660" +KERNEL=="sg[0-9]*", BUS="scsi", SYSFS{type}=="[36]", SYMLINK+="scanner%e", MODE="0660" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" @@ -224,24 +235,25 @@ KERNEL=="zap[0-9]*", NAME="zap/%n" BUS=="scsi", KERNEL=="sg[0-9]*", SYSFS{type}=="6", NAME="%k", SYMLINK="scanner%e", MODE="0660" # do not seperate the next 2 lines!! -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/lib/udev/ide-media.sh %k", RESULT=="floppy", SYMLINK+="floppy%e", NAME{ignore_remove, all_partitions}="%k" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="ide-media.sh %k", RESULT=="floppy", SYMLINK+="floppy%e", NAME{ignore_remove, all_partitions}="%k" KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", RESULT=="cdrom", SYMLINK+="cdrom%e" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/lib/udev/check-cdrom.sh %k DVD", SYMLINK+="dvd%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/lib/udev/check-cdrom.sh %k DVD", SYMLINK+="dvd%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd%e" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="/lib/udev/check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/lib/udev/check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="/lib/udev/check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="/lib/udev/check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" # rename sr* to scd* KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n" KERNEL=="hd[a-z]*", BUS=="ide", SYSFS{removable}=="1", NAME{ignore_remove}="%k" -KERNEL=="dvb*", PROGRAM=="/lib/udev/dvb.sh %k", NAME="%c" +# dvb +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" ####################################### # Persistent block device stuff - begin @@ -297,37 +309,31 @@ LABEL="persistent_end" # Persistent block device stuff - end ##################################### -ACTION=="add", SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev} B=$${X%%%%.*} D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" - +ACTION=="add", SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" # Perhaps this should just be for all subsystems? +ACTION=="add", SUBSYSTEM=="?*", MODALIAS=="?*", RUN+="/sbin/modprobe $modalias" -ACTION=="add", SUBSYSTEM=="pci", MODALIAS=="*", \ - RUN+="/sbin/modprobe $modalias" -ACTION=="add", SUBSYSTEM=="usb", MODALIAS=="*", \ - RUN+="/sbin/modprobe $modalias" -ACTION=="add", SUBSYSTEM=="pcmcia", MODALIAS=="*", \ - RUN+="/sbin/modprobe $modalias" ACTION=="add", SUBSYSTEM=="pcmcia", MODALIAS=="*", \ RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" -ACTION=="add", SUBSYSTEM=="ieee1394", MODALIAS=="*", \ - RUN+="/sbin/modprobe $modalias" +# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC +# sr: 4 TYPE_WORM, 5 TYPE_ROM +# st/osst: 1 TYPE_TAPE +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[07]", \ +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="0|7|14", \ RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="14", \ - RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[45]", \ +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="[45]", \ RUN+="/sbin/modprobe sr_mod" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", \ +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}=="On[sS]tream", \ SYSFS{model}!="ADR*", RUN+="/sbin/modprobe osst" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", \ +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}=="On[sS]tream", \ SYSFS{model}=="ADR*", RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="1", SYSFS{vendor}!="On[sS]tream", \ +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}!="On[sS]tream", \ RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi", SYSFS{type}=="[23689]", \ - RUN+="/sbin/modprobe sg" +ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="/sbin/modprobe sg" + +RUN+="socket:/org/kernel/udev/monitor" -ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", \ - RUN+="/sbin/firmware_helper" -- cgit v1.2.3-54-g00ecf From 515e50555cb9776e425d498197eb382a22a51a04 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Feb 2006 21:03:25 +0100 Subject: update Gentoo rules --- etc/udev/gentoo/udev.rules | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 6614c76394..24f67be85a 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -22,8 +22,8 @@ KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" # tty devices -KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" +KERNEL=="ttyS[0-9]*", NAME="%k", SYMLINK="tts/%n", GROUP="tty" +KERNEL=="ttyUSB[0-9]*", NAME="%k", SYMLINK="tts/USB%n", GROUP="tty", MODE="0660" KERNEL=="ippp0", NAME="%k", GROUP="tty" KERNEL=="isdn*" NAME="%k", GROUP="tty" KERNEL=="dcbri*", NAME="%k", GROUP="tty" @@ -133,7 +133,7 @@ KERNEL=="dnrtmsg", NAME="netlink/%k" KERNEL=="tap*", NAME="netlink/%k" # network devices -KERNEL=="tun", NAME="net/%k" +KERNEL=="tun", NAME="net/%k", MODE="0600" # ramdisk devices KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" @@ -183,7 +183,7 @@ KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" # dvb devices -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%i $${K%%%%.*} $${K#*.}'", NAME="%c" +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" # Asterisk Zaptel devices KERNEL=="zapctl", NAME="zap/ctl" @@ -210,6 +210,7 @@ KERNEL=="lp*", NAME="%k", GROUP="lp" KERNEL=="irlpt", NAME="%k", GROUP="lp" KERNEL=="usblp", NAME="%k", GROUP="lp" KERNEL=="lp*", NAME="%k", GROUP="lp" +KERNEL=="parport*", NAME="%k", GROUP="lp" # tape devices KERNEL=="ht*", NAME="%k", GROUP="tape" @@ -299,10 +300,10 @@ SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/u # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems # run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart -ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" +ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd $env{SUBSYSTEM}" # always run /etc/dev.d/ stuff for now. -RUN+="/sbin/udev_run_devd" +RUN+="/sbin/udev_run_devd $env{SUBSYSTEM}" # debugging monitor RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From c779c930f157a3e8984110f813d03289092eb60b Mon Sep 17 00:00:00 2001 From: Jeroen Roovers Date: Wed, 15 Feb 2006 21:06:19 +0100 Subject: fix typo in parisc support to path_id As reported at http://bugs.gentoo.org/show_bug.cgi?id=113379 path_id is still broken for parisc boxes. This patch from Jeroen Roovers fixes that. Signed-off-by: Greg Kroah-Hartman --- extras/path_id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/path_id b/extras/path_id index b58e1eda6a..73d5c834dd 100755 --- a/extras/path_id +++ b/extras/path_id @@ -229,7 +229,7 @@ handle_block_scsi () { ;; # PARISC devices *parisc*) - adapter="${controler_dev##*/}" + adapter="${controller_dev##*/}" bus=parisc; ;; *) -- cgit v1.2.3-54-g00ecf From 4c2d04bd997b1585625926aa10397616097f7b0f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Feb 2006 21:12:49 +0100 Subject: include errno.h in udev_libc_wrapper.c --- udev_libc_wrapper.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index 02a1f8d016..1711811e83 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "udev.h" -- cgit v1.2.3-54-g00ecf From 4cb665e431cfd03f000e7f025b47b24727458131 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Feb 2006 23:15:27 +0100 Subject: 085 release --- ChangeLog | 21 +++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 7 +++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8f0e9b157b..2b959f04a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Summary of changes from v084 to v085 +============================================ + +Andrey Borzenkov: + Fix trivial spelling errors in RELEASE-NOTES + +Jeroen Roovers: + fix typo in parisc support to path_id + +Kay Sievers: + make WAIT_FOR_SYSFS usable in non "wait-only" rules + fix typo in man page + include sys/socket.h for klibc build + cramfs detection for bigendian + exit WAIT_FOR_SYSFS if the whole device goes away + update SUSE rules + update Red Hat rules + update Gentoo rules + include errno.h in udev_libc_wrapper.c + + Summary of changes from v083 to v084 ============================================ diff --git a/Makefile b/Makefile index 55cecd3755..5d82d44c64 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 084 +VERSION = 085 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c8e7baa4db..6826b8fd8a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,10 @@ +udev 085 +======== +Fix cramfs detection on big endian. + +Make WAIT_FOR_SYSFS usable in "normal" rules and silent if the whole +device goes away. + udev 084 ======== If BUS== and SYSFS{}== have been used in the same rule, the sysfs -- cgit v1.2.3-54-g00ecf From 559776036744f6dc4e475851ae646ee1c0c51631 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Tue, 21 Feb 2006 17:01:54 +0100 Subject: workaround missing kernel headers for some architectures Signed-off-by: Kyle McMartin --- udev_libc_wrapper.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index a4d320fef2..fc66670a3c 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -135,8 +135,12 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) #endif #ifndef SO_RCVBUFFORCE +#if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || defined(__sparc_v9__) +#define SO_RCVBUFFORCE 0x100b +#else #define SO_RCVBUFFORCE 33 #endif +#endif extern uid_t lookup_user(const char *user); extern gid_t lookup_group(const char *group); -- cgit v1.2.3-54-g00ecf From 467546b586e9ae29ac168967f5cdaac696cadcfb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Feb 2006 18:44:18 +0100 Subject: volume_id: replace __packed__ by PACKED macro --- extras/volume_id/libvolume_id/cramfs.c | 4 ++-- extras/volume_id/libvolume_id/ext.c | 2 +- extras/volume_id/libvolume_id/fat.c | 10 +++++----- extras/volume_id/libvolume_id/hfs.c | 16 ++++++++-------- extras/volume_id/libvolume_id/highpoint.c | 4 ++-- extras/volume_id/libvolume_id/hpfs.c | 2 +- extras/volume_id/libvolume_id/iso9660.c | 4 ++-- extras/volume_id/libvolume_id/isw_raid.c | 2 +- extras/volume_id/libvolume_id/jfs.c | 2 +- extras/volume_id/libvolume_id/linux_raid.c | 2 +- extras/volume_id/libvolume_id/linux_swap.c | 2 +- extras/volume_id/libvolume_id/lsi_raid.c | 2 +- extras/volume_id/libvolume_id/lvm.c | 4 ++-- extras/volume_id/libvolume_id/mac.c | 4 ++-- extras/volume_id/libvolume_id/minix.c | 2 +- extras/volume_id/libvolume_id/msdos.c | 2 +- extras/volume_id/libvolume_id/ntfs.c | 8 ++++---- extras/volume_id/libvolume_id/nvidia_raid.c | 2 +- extras/volume_id/libvolume_id/ocfs.c | 8 ++++---- extras/volume_id/libvolume_id/promise_raid.c | 2 +- extras/volume_id/libvolume_id/reiserfs.c | 4 ++-- extras/volume_id/libvolume_id/romfs.c | 2 +- extras/volume_id/libvolume_id/silicon_raid.c | 2 +- extras/volume_id/libvolume_id/sysv.c | 4 ++-- extras/volume_id/libvolume_id/udf.c | 14 +++++++------- extras/volume_id/libvolume_id/ufs.c | 18 +++++++++--------- extras/volume_id/libvolume_id/via_raid.c | 4 ++-- extras/volume_id/libvolume_id/volume_id.h | 4 ++++ extras/volume_id/libvolume_id/vxfs.c | 2 +- extras/volume_id/libvolume_id/xfs.c | 2 +- 30 files changed, 72 insertions(+), 68 deletions(-) diff --git a/extras/volume_id/libvolume_id/cramfs.c b/extras/volume_id/libvolume_id/cramfs.c index bf79407d9d..e099c214c8 100644 --- a/extras/volume_id/libvolume_id/cramfs.c +++ b/extras/volume_id/libvolume_id/cramfs.c @@ -38,9 +38,9 @@ struct cramfs_super { uint32_t edition; uint32_t blocks; uint32_t files; - } __attribute__((__packed__)) info; + } PACKED info; uint8_t name[16]; -} __attribute__((__packed__)); +} PACKED; int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) { diff --git a/extras/volume_id/libvolume_id/ext.c b/extras/volume_id/libvolume_id/ext.c index d1f62dfb6f..26ac98bc37 100644 --- a/extras/volume_id/libvolume_id/ext.c +++ b/extras/volume_id/libvolume_id/ext.c @@ -61,7 +61,7 @@ struct ext2_super_block { uint32_t s_feature_ro_compat; uint8_t s_uuid[16]; uint8_t s_volume_name[16]; -} __attribute__((__packed__)); +} PACKED; #define EXT_SUPER_MAGIC 0xEF53 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 diff --git a/extras/volume_id/libvolume_id/fat.c b/extras/volume_id/libvolume_id/fat.c index cea5b8cff2..a72ec19f59 100644 --- a/extras/volume_id/libvolume_id/fat.c +++ b/extras/volume_id/libvolume_id/fat.c @@ -58,7 +58,7 @@ struct vfat_super_block { uint8_t magic[8]; uint8_t dummy2[192]; uint8_t pmagic[2]; - } __attribute__((__packed__)) fat; + } PACKED fat; struct fat32_super_block { uint32_t fat32_length; uint16_t flags; @@ -73,9 +73,9 @@ struct vfat_super_block { uint8_t magic[8]; uint8_t dummy2[164]; uint8_t pmagic[2]; - } __attribute__((__packed__)) fat32; - } __attribute__((__packed__)) type; -} __attribute__((__packed__)); + } PACKED fat32; + } PACKED type; +} PACKED; struct vfat_dir_entry { uint8_t name[11]; @@ -89,7 +89,7 @@ struct vfat_dir_entry { uint16_t date_write; uint16_t cluster_low; uint32_t size; -} __attribute__((__packed__)); +} PACKED; static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) { diff --git a/extras/volume_id/libvolume_id/hfs.c b/extras/volume_id/libvolume_id/hfs.c index 27a8ac9999..09194d5be1 100644 --- a/extras/volume_id/libvolume_id/hfs.c +++ b/extras/volume_id/libvolume_id/hfs.c @@ -35,7 +35,7 @@ struct hfs_finder_info{ uint32_t reserved; uint32_t osx_folder; uint8_t id[8]; -} __attribute__((__packed__)); +} PACKED; struct hfs_mdb { uint8_t signature[2]; @@ -65,7 +65,7 @@ struct hfs_mdb { uint8_t embed_sig[2]; uint16_t embed_startblock; uint16_t embed_blockcount; -} __attribute__((__packed__)) *hfs; +} PACKED *hfs; struct hfsplus_bnode_descriptor { uint32_t next; @@ -74,7 +74,7 @@ struct hfsplus_bnode_descriptor { uint8_t height; uint16_t num_recs; uint16_t reserved; -} __attribute__((__packed__)); +} PACKED; struct hfsplus_bheader_record { uint16_t depth; @@ -83,19 +83,19 @@ struct hfsplus_bheader_record { uint32_t leaf_head; uint32_t leaf_tail; uint16_t node_size; -} __attribute__((__packed__)); +} PACKED; struct hfsplus_catalog_key { uint16_t key_len; uint32_t parent_id; uint16_t unicode_len; uint8_t unicode[255 * 2]; -} __attribute__((__packed__)); +} PACKED; struct hfsplus_extent { uint32_t start_block; uint32_t block_count; -} __attribute__((__packed__)); +} PACKED; #define HFSPLUS_EXTENT_COUNT 8 struct hfsplus_fork { @@ -103,7 +103,7 @@ struct hfsplus_fork { uint32_t clump_size; uint32_t total_blocks; struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; -} __attribute__((__packed__)); +} PACKED; struct hfsplus_vol_header { uint8_t signature[2]; @@ -132,7 +132,7 @@ struct hfsplus_vol_header { struct hfsplus_fork cat_file; struct hfsplus_fork attr_file; struct hfsplus_fork start_file; -} __attribute__((__packed__)) *hfsplus; +} PACKED *hfsplus; #define HFS_SUPERBLOCK_OFFSET 0x400 #define HFS_NODE_LEAF 0xff diff --git a/extras/volume_id/libvolume_id/highpoint.c b/extras/volume_id/libvolume_id/highpoint.c index 721b7ab26f..78a4ad82b4 100644 --- a/extras/volume_id/libvolume_id/highpoint.c +++ b/extras/volume_id/libvolume_id/highpoint.c @@ -30,11 +30,11 @@ struct hpt37x_meta { uint8_t filler1[32]; uint32_t magic; -} __attribute__((packed)); +} PACKED; struct hpt45x_meta { uint32_t magic; -} __attribute__((packed)); +} PACKED; #define HPT37X_CONFIG_OFF 0x1200 #define HPT37X_MAGIC_OK 0x5a7816f0 diff --git a/extras/volume_id/libvolume_id/hpfs.c b/extras/volume_id/libvolume_id/hpfs.c index 52cb47be39..452df0124d 100644 --- a/extras/volume_id/libvolume_id/hpfs.c +++ b/extras/volume_id/libvolume_id/hpfs.c @@ -31,7 +31,7 @@ struct hpfs_super { uint8_t magic[4]; uint8_t version; -} __attribute__((__packed__)); +} PACKED; #define HPFS_SUPERBLOCK_OFFSET 0x2000 diff --git a/extras/volume_id/libvolume_id/iso9660.c b/extras/volume_id/libvolume_id/iso9660.c index b6654cecf2..2e28af8d70 100644 --- a/extras/volume_id/libvolume_id/iso9660.c +++ b/extras/volume_id/libvolume_id/iso9660.c @@ -45,14 +45,14 @@ struct iso_volume_descriptor { uint8_t unused[8]; uint8_t space_size[8]; uint8_t escape_sequences[8]; -} __attribute__((__packed__)); +} PACKED; struct high_sierra_volume_descriptor { uint8_t foo[8]; uint8_t type; uint8_t id[4]; uint8_t version; -} __attribute__((__packed__)); +} PACKED; int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) { diff --git a/extras/volume_id/libvolume_id/isw_raid.c b/extras/volume_id/libvolume_id/isw_raid.c index 1f49959ff9..72b2b85b12 100644 --- a/extras/volume_id/libvolume_id/isw_raid.c +++ b/extras/volume_id/libvolume_id/isw_raid.c @@ -33,7 +33,7 @@ struct isw_meta { uint32_t mpb_size; uint32_t family_num; uint32_t generation_num; -} __attribute__((packed)); +} PACKED; #define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " diff --git a/extras/volume_id/libvolume_id/jfs.c b/extras/volume_id/libvolume_id/jfs.c index b6ae9624d6..78b61fb30d 100644 --- a/extras/volume_id/libvolume_id/jfs.c +++ b/extras/volume_id/libvolume_id/jfs.c @@ -38,7 +38,7 @@ struct jfs_super_block { uint8_t uuid[16]; uint8_t label[16]; uint8_t loguuid[16]; -} __attribute__((__packed__)); +} PACKED; #define JFS_SUPERBLOCK_OFFSET 0x8000 diff --git a/extras/volume_id/libvolume_id/linux_raid.c b/extras/volume_id/libvolume_id/linux_raid.c index d90510a817..2285e87b97 100644 --- a/extras/volume_id/libvolume_id/linux_raid.c +++ b/extras/volume_id/libvolume_id/linux_raid.c @@ -44,7 +44,7 @@ struct mdp_super_block { uint32_t set_uuid1; uint32_t set_uuid2; uint32_t set_uuid3; -} __attribute__((packed)) *mdp; +} PACKED *mdp; #define MD_RESERVED_BYTES 0x10000 #define MD_MAGIC 0xa92b4efc diff --git a/extras/volume_id/libvolume_id/linux_swap.c b/extras/volume_id/libvolume_id/linux_swap.c index 18928b8351..b4828347f7 100644 --- a/extras/volume_id/libvolume_id/linux_swap.c +++ b/extras/volume_id/libvolume_id/linux_swap.c @@ -34,7 +34,7 @@ struct swap_header_v1_2 { uint32_t nr_badpages; uint8_t uuid[16]; uint8_t volume_name[16]; -} __attribute__((__packed__)) *sw; +} PACKED *sw; #define LARGEST_PAGESIZE 0x4000 diff --git a/extras/volume_id/libvolume_id/lsi_raid.c b/extras/volume_id/libvolume_id/lsi_raid.c index 2720de763d..efa792575f 100644 --- a/extras/volume_id/libvolume_id/lsi_raid.c +++ b/extras/volume_id/libvolume_id/lsi_raid.c @@ -29,7 +29,7 @@ struct lsi_meta { uint8_t sig[6]; -} __attribute__((packed)); +} PACKED; #define LSI_SIGNATURE "$XIDE$" diff --git a/extras/volume_id/libvolume_id/lvm.c b/extras/volume_id/libvolume_id/lvm.c index 650986256d..074660b1e4 100644 --- a/extras/volume_id/libvolume_id/lvm.c +++ b/extras/volume_id/libvolume_id/lvm.c @@ -29,7 +29,7 @@ struct lvm1_super_block { uint8_t id[2]; -} __attribute__((packed)); +} PACKED; struct lvm2_super_block { uint8_t id[8]; @@ -37,7 +37,7 @@ struct lvm2_super_block { uint32_t crc_xl; uint32_t offset_xl; uint8_t type[8]; -} __attribute__((packed)); +} PACKED; #define LVM1_SB_OFF 0x400 #define LVM1_MAGIC "HM" diff --git a/extras/volume_id/libvolume_id/mac.c b/extras/volume_id/libvolume_id/mac.c index 53f0761c8a..78ef9fc803 100644 --- a/extras/volume_id/libvolume_id/mac.c +++ b/extras/volume_id/libvolume_id/mac.c @@ -31,7 +31,7 @@ struct mac_driver_desc { uint8_t signature[2]; uint16_t block_size; uint32_t block_count; -} __attribute__((__packed__)); +} PACKED; struct mac_partition { uint8_t signature[2]; @@ -41,7 +41,7 @@ struct mac_partition { uint32_t block_count; uint8_t name[32]; uint8_t type[32]; -} __attribute__((__packed__)); +} PACKED; int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off) { diff --git a/extras/volume_id/libvolume_id/minix.c b/extras/volume_id/libvolume_id/minix.c index ca57745f78..fefba8e729 100644 --- a/extras/volume_id/libvolume_id/minix.c +++ b/extras/volume_id/libvolume_id/minix.c @@ -39,7 +39,7 @@ struct minix_super_block uint16_t s_magic; uint16_t s_state; uint32_t s_zones; -} __attribute__((__packed__)); +} PACKED; #define MINIX_SUPERBLOCK_OFFSET 0x400 diff --git a/extras/volume_id/libvolume_id/msdos.c b/extras/volume_id/libvolume_id/msdos.c index a66046052a..ca3801a8db 100644 --- a/extras/volume_id/libvolume_id/msdos.c +++ b/extras/volume_id/libvolume_id/msdos.c @@ -38,7 +38,7 @@ struct msdos_partition_entry { uint8_t end_cyl; uint32_t start_sect; uint32_t nr_sects; -} __attribute__((packed)); +} PACKED; #define MSDOS_MAGIC "\x55\xaa" #define MSDOS_PARTTABLE_OFFSET 0x1be diff --git a/extras/volume_id/libvolume_id/ntfs.c b/extras/volume_id/libvolume_id/ntfs.c index de9ad6d654..fe9ff8d5d6 100644 --- a/extras/volume_id/libvolume_id/ntfs.c +++ b/extras/volume_id/libvolume_id/ntfs.c @@ -52,7 +52,7 @@ struct ntfs_super_block { uint8_t reserved2[3]; uint8_t volume_serial[8]; uint16_t checksum; -} __attribute__((__packed__)) *ns; +} PACKED *ns; struct master_file_table_record { uint8_t magic[4]; @@ -65,7 +65,7 @@ struct master_file_table_record { uint16_t flags; uint32_t bytes_in_use; uint32_t bytes_allocated; -} __attribute__((__packed__)) *mftr; +} PACKED *mftr; struct file_attribute { uint32_t type; @@ -77,13 +77,13 @@ struct file_attribute { uint16_t instance; uint32_t value_len; uint16_t value_offset; -} __attribute__((__packed__)) *attr; +} PACKED *attr; struct volume_info { uint64_t reserved; uint8_t major_ver; uint8_t minor_ver; -} __attribute__((__packed__)) *info; +} PACKED *info; #define MFT_RECORD_VOLUME 3 #define MFT_RECORD_ATTR_VOLUME_NAME 0x60 diff --git a/extras/volume_id/libvolume_id/nvidia_raid.c b/extras/volume_id/libvolume_id/nvidia_raid.c index 3b967e6979..24717aaaec 100644 --- a/extras/volume_id/libvolume_id/nvidia_raid.c +++ b/extras/volume_id/libvolume_id/nvidia_raid.c @@ -32,7 +32,7 @@ struct nvidia_meta { uint32_t size; uint32_t chksum; uint16_t version; -} __attribute__((packed)); +} PACKED; #define NVIDIA_SIGNATURE "NVIDIA" diff --git a/extras/volume_id/libvolume_id/ocfs.c b/extras/volume_id/libvolume_id/ocfs.c index faf89bd3e0..c2f8360cae 100644 --- a/extras/volume_id/libvolume_id/ocfs.c +++ b/extras/volume_id/libvolume_id/ocfs.c @@ -56,7 +56,7 @@ struct ocfs1_super_block_header { uint64_t new_cfg_off; uint32_t prot_bits; int32_t excl_mount; -} __attribute__((__packed__)); +} PACKED; struct ocfs1_super_block_label { struct ocfs1_disk_lock { @@ -69,14 +69,14 @@ struct ocfs1_super_block_label { uint32_t reader_node_num; uint64_t oin_node_map; uint64_t dlock_seq_num; - } disk_lock __attribute__((__packed__)); + } PACKED disk_lock; uint8_t label[64]; uint16_t label_len; uint8_t vol_id[16]; uint16_t vol_id_len; uint8_t cluster_name[64]; uint16_t cluster_name_len; -} __attribute__((__packed__)); +} PACKED; struct ocfs2_super_block { uint8_t i_signature[8]; @@ -125,7 +125,7 @@ struct ocfs2_super_block { uint64_t s_first_cluster_group; uint8_t s_label[64]; uint8_t s_uuid[16]; -} __attribute__((__packed__)); +} PACKED; int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off) { diff --git a/extras/volume_id/libvolume_id/promise_raid.c b/extras/volume_id/libvolume_id/promise_raid.c index 6611aeab32..bdf0c7b601 100644 --- a/extras/volume_id/libvolume_id/promise_raid.c +++ b/extras/volume_id/libvolume_id/promise_raid.c @@ -29,7 +29,7 @@ struct promise_meta { uint8_t sig[24]; -} __attribute__((packed)); +} PACKED; #define PDC_CONFIG_OFF 0x1200 #define PDC_SIGNATURE "Promise Technology, Inc." diff --git a/extras/volume_id/libvolume_id/reiserfs.c b/extras/volume_id/libvolume_id/reiserfs.c index 0eecbda5cb..91a5bcb9b0 100644 --- a/extras/volume_id/libvolume_id/reiserfs.c +++ b/extras/volume_id/libvolume_id/reiserfs.c @@ -42,7 +42,7 @@ struct reiserfs_super_block { uint32_t dummy4[5]; uint8_t uuid[16]; uint8_t label[16]; -} __attribute__((__packed__)); +} PACKED; struct reiser4_super_block { uint8_t magic[16]; @@ -50,7 +50,7 @@ struct reiser4_super_block { uint8_t uuid[16]; uint8_t label[16]; uint64_t dummy2; -} __attribute__((__packed__)); +} PACKED; #define REISERFS1_SUPERBLOCK_OFFSET 0x2000 #define REISERFS_SUPERBLOCK_OFFSET 0x10000 diff --git a/extras/volume_id/libvolume_id/romfs.c b/extras/volume_id/libvolume_id/romfs.c index 51ef3739b3..456077d1e1 100644 --- a/extras/volume_id/libvolume_id/romfs.c +++ b/extras/volume_id/libvolume_id/romfs.c @@ -32,7 +32,7 @@ struct romfs_super { uint32_t size; uint32_t checksum; uint8_t name[0]; -} __attribute__((__packed__)); +} PACKED; int volume_id_probe_romfs(struct volume_id *id, uint64_t off) { diff --git a/extras/volume_id/libvolume_id/silicon_raid.c b/extras/volume_id/libvolume_id/silicon_raid.c index a307764730..27ac9591a7 100644 --- a/extras/volume_id/libvolume_id/silicon_raid.c +++ b/extras/volume_id/libvolume_id/silicon_raid.c @@ -44,7 +44,7 @@ struct silicon_meta { uint16_t vendor_id; uint16_t minor_ver; uint16_t major_ver; -} __attribute__((packed)); +} PACKED; #define SILICON_MAGIC 0x2F000000 diff --git a/extras/volume_id/libvolume_id/sysv.c b/extras/volume_id/libvolume_id/sysv.c index fc874d5bea..4aa281e9fa 100644 --- a/extras/volume_id/libvolume_id/sysv.c +++ b/extras/volume_id/libvolume_id/sysv.c @@ -56,7 +56,7 @@ struct sysv_super uint32_t s_state; uint32_t s_magic; uint32_t s_type; -} __attribute__((__packed__)); +} PACKED; #define XENIX_NICINOD 100 #define XENIX_NICFREE 100 @@ -82,7 +82,7 @@ struct xenix_super { uint8_t s_fill[371]; uint32_t s_magic; uint32_t s_type; -} __attribute__((__packed__)); +} PACKED; #define SYSV_SUPERBLOCK_BLOCK 0x01 #define SYSV_MAGIC 0xfd187e20 diff --git a/extras/volume_id/libvolume_id/udf.c b/extras/volume_id/libvolume_id/udf.c index fede1ce68a..f0e0d41957 100644 --- a/extras/volume_id/libvolume_id/udf.c +++ b/extras/volume_id/libvolume_id/udf.c @@ -37,28 +37,28 @@ struct volume_descriptor { uint16_t crc; uint16_t crc_len; uint32_t location; - } __attribute__((__packed__)) tag; + } PACKED tag; union { struct anchor_descriptor { uint32_t length; uint32_t location; - } __attribute__((__packed__)) anchor; + } PACKED anchor; struct primary_descriptor { uint32_t seq_num; uint32_t desc_num; struct dstring { uint8_t clen; uint8_t c[31]; - } __attribute__((__packed__)) ident; - } __attribute__((__packed__)) primary; - } __attribute__((__packed__)) type; -} __attribute__((__packed__)); + } PACKED ident; + } PACKED primary; + } PACKED type; +} PACKED; struct volume_structure_descriptor { uint8_t type; uint8_t id[5]; uint8_t version; -} __attribute__((__packed__)); +} PACKED; #define UDF_VSD_OFFSET 0x8000 diff --git a/extras/volume_id/libvolume_id/ufs.c b/extras/volume_id/libvolume_id/ufs.c index ace61db657..2351d1f926 100644 --- a/extras/volume_id/libvolume_id/ufs.c +++ b/extras/volume_id/libvolume_id/ufs.c @@ -80,7 +80,7 @@ struct ufs_super_block { uint32_t cs_nbfree; uint32_t cs_nifree; uint32_t cs_nffree; - } __attribute__((__packed__)) fs_cstotal; + } PACKED fs_cstotal; int8_t fs_fmod; int8_t fs_clean; int8_t fs_ronly; @@ -93,7 +93,7 @@ struct ufs_super_block { uint32_t fs_maxcluster; uint32_t fs_cpc; uint16_t fs_opostbl[16][8]; - } __attribute__((__packed__)) fs_u1; + } PACKED fs_u1; struct { int8_t fs_fsmnt[468]; uint8_t fs_volname[32]; @@ -116,17 +116,17 @@ struct ufs_super_block { uint64_t cs_nffree; uint64_t cs_numclusters; uint64_t cs_spare[3]; - } __attribute__((__packed__)) fs_cstotal; + } PACKED fs_cstotal; struct ufs_timeval { int32_t tv_sec; int32_t tv_usec; - } __attribute__((__packed__)) fs_time; + } PACKED fs_time; int64_t fs_size; int64_t fs_dsize; uint64_t fs_csaddr; int64_t fs_pendingblocks; int32_t fs_pendinginodes; - } __attribute__((__packed__)) fs_u2; + } PACKED fs_u2; } fs_u11; union { struct { @@ -136,7 +136,7 @@ struct ufs_super_block { int32_t fs_state; uint32_t fs_qbmask[2]; uint32_t fs_qfmask[2]; - } __attribute__((__packed__)) fs_sun; + } PACKED fs_sun; struct { int32_t fs_sparecon[53]; int32_t fs_reclaim; @@ -144,7 +144,7 @@ struct ufs_super_block { uint32_t fs_npsect; uint32_t fs_qbmask[2]; uint32_t fs_qfmask[2]; - } __attribute__((__packed__)) fs_sunx86; + } PACKED fs_sunx86; struct { int32_t fs_sparecon[50]; int32_t fs_contigsumsize; @@ -154,7 +154,7 @@ struct ufs_super_block { uint32_t fs_qbmask[2]; uint32_t fs_qfmask[2]; int32_t fs_state; - } __attribute__((__packed__)) fs_44; + } PACKED fs_44; } fs_u2; int32_t fs_postblformat; int32_t fs_nrpos; @@ -162,7 +162,7 @@ struct ufs_super_block { int32_t fs_rotbloff; uint32_t fs_magic; uint8_t fs_space[1]; -} __attribute__((__packed__)); +} PACKED; #define UFS_MAGIC 0x00011954 #define UFS2_MAGIC 0x19540119 diff --git a/extras/volume_id/libvolume_id/via_raid.c b/extras/volume_id/libvolume_id/via_raid.c index 66962cd7f0..375a20979d 100644 --- a/extras/volume_id/libvolume_id/via_raid.c +++ b/extras/volume_id/libvolume_id/via_raid.c @@ -36,10 +36,10 @@ struct via_meta { uint32_t capacity_low; uint32_t capacity_high; uint32_t serial_checksum; - } __attribute((packed)) array; + } PACKED array; uint32_t serial_checksum[8]; uint8_t checksum; -} __attribute__((packed)); +} PACKED; #define VIA_SIGNATURE 0xAA55 diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index edeb225faf..0f265a584d 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -16,6 +16,10 @@ #define VOLUME_ID_VERSION 56 +#ifndef PACKED +#define PACKED __attribute__((packed)) +#endif + #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 #define VOLUME_ID_FORMAT_SIZE 32 diff --git a/extras/volume_id/libvolume_id/vxfs.c b/extras/volume_id/libvolume_id/vxfs.c index 0aef369899..883c1266a4 100644 --- a/extras/volume_id/libvolume_id/vxfs.c +++ b/extras/volume_id/libvolume_id/vxfs.c @@ -32,7 +32,7 @@ struct vxfs_super { uint32_t vs_magic; int32_t vs_version; -} __attribute__((__packed__)); +} PACKED; int volume_id_probe_vxfs(struct volume_id *id, uint64_t off) { diff --git a/extras/volume_id/libvolume_id/xfs.c b/extras/volume_id/libvolume_id/xfs.c index a5f5d8432c..934ed2d877 100644 --- a/extras/volume_id/libvolume_id/xfs.c +++ b/extras/volume_id/libvolume_id/xfs.c @@ -40,7 +40,7 @@ struct xfs_super_block { uint64_t icount; uint64_t ifree; uint64_t fdblocks; -} __attribute__((__packed__)); +} PACKED; int volume_id_probe_xfs(struct volume_id *id, uint64_t off) { -- cgit v1.2.3-54-g00ecf From ab925d69d5d38e851ae3b71523fb70a75f7b16de Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Feb 2006 18:48:28 +0100 Subject: volume_id: split raid and filesystem detection --- extras/volume_id/libvolume_id/volume_id.c | 31 +++++++++++++++++++++++++++---- extras/volume_id/libvolume_id/volume_id.h | 4 +++- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c index 09d1e31725..1daf1cbd74 100644 --- a/extras/volume_id/libvolume_id/volume_id.c +++ b/extras/volume_id/libvolume_id/volume_id.c @@ -31,7 +31,7 @@ #include "util.h" -int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) +int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) { if (id == NULL) return -EINVAL; @@ -72,6 +72,17 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) if (volume_id_probe_highpoint_37x_raid(id, off) == 0) goto exit; +exit: + /* If recognized, we free the allocated buffers */ + volume_id_free_buffer(id); + return 0; +} + +int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size) +{ + if (id == NULL) + return -EINVAL; + if (volume_id_probe_luks(id, off) == 0) goto exit; @@ -139,13 +150,25 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) return -1; exit: - /* If the filestystem in recognized, we free the allocated buffers, - otherwise they will stay in place for the possible next probe call */ + /* If recognized, we free the allocated buffers */ volume_id_free_buffer(id); - return 0; } +int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) +{ + if (id == NULL) + return -EINVAL; + + if (volume_id_probe_raid(id, off, size) == 0) + return 0; + + if (volume_id_probe_filesystem(id, off, size) == 0) + return 0; + + return -1; +} + /* open volume by already open file descriptor */ struct volume_id *volume_id_open_fd(int fd) { diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index 0f265a584d..2caf75f532 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -14,7 +14,7 @@ #include #include -#define VOLUME_ID_VERSION 56 +#define VOLUME_ID_VERSION 57 #ifndef PACKED #define PACKED __attribute__((packed)) @@ -73,6 +73,8 @@ struct volume_id { extern struct volume_id *volume_id_open_fd(int fd); extern struct volume_id *volume_id_open_node(const char *path); extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size); extern void volume_id_close(struct volume_id *id); /* filesystems */ -- cgit v1.2.3-54-g00ecf From 731f0aec41e3f46f5b630e70166ab384976d52c6 Mon Sep 17 00:00:00 2001 From: Nix Date: Tue, 21 Feb 2006 18:53:25 +0100 Subject: update to udev-084/doc/writing_udev_rules --- docs/writing_udev_rules/index.html | 118 ++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index c2ccdc3663..1c5c89b3c9 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -113,7 +113,7 @@ As your own rules will effectively mask out the udev defaults which create the b In rule files, lines starting with a "#" are treated as comments. Every uncommented line in the file corresponds to a rule.

    -Rules are composed of keys. Keys are seperated by commas. Some keys are used for reading and matching information, others are used for assigning information and performing actions. +Rules are composed of keys. Keys are seperated by commas. Some keys are used for reading and matching information, others are used for assigning information and performing actions. Matches and assignments are carried out with the expected operators (= and ==).
    1. At least one identification key should be provided, which will match the rule to any number of devices in the system. These are listed in the later section: Identifying devices through basic keys.
    2. @@ -123,7 +123,7 @@ Rules are composed of keys. Keys are seperated by commas. Some keys are used for Common rules will use basic identification keys to determine the device to name, and then have a NAME assignement key to define the device node name. udev will only create one node for one device, so if you want it to be accessible through multiple nodes, then you have to specify the other nodes in the SYMLINK assignment key.

      I'll take a slightly modified udev example rule to illustrate this: -
      BUS="usb", SYSFS{serial}="HXOLL0012202323480", NAME="lp_epson", SYMLINK="printers/epson_stylus"
      +
      BUS=="usb", SYSFS{serial}=="HXOLL0012202323480", NAME="lp_epson", SYMLINK="printers/epson_stylus"
      The identification keys here are BUS and SYSFS{serial}. The assignment keys here are NAME and SYMLINK. udev will match this rule against a device that is connected through the USB bus and with a serial number of HXOLL0012202323480. Note that all (as opposed to any) specified keys must be matched for udev to use the rule to name a device.
      @@ -140,7 +140,7 @@ In the NAME and SYMLINK parameters of your rules, you are able to use basic oper There are a number of operators which can compose some or all of your NAME/SYMLINK parameters. These operators refer to kernel-data relating to the device. Take this example: -
      BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n"
      +
      BUS=="usb", SYSFS{vendor}=="FUJIFILM", SYSFS{model}=="M100", NAME="camera%n"
      The %n operator will be replaced with the "kernel number" for the camera device, to produce a NAME such as camera0, camera1, etc.

      @@ -153,7 +153,7 @@ Another common operator is %k. This represents what the kernel would name You can use shell style pattern matching to provide even more flexibility when writing keys. Taking a default udev rule: -
      KERNEL="ts*", NAME="input/%k"
      +
      KERNEL=="ts*", NAME="input/%k"
      The * operator is used here, which matches literally anything - zero, one, or more characters of any kind. The rule literally says:
      @@ -166,7 +166,7 @@ You can also use square brackets [ ] to match any single character. Direct quote You can also specify ranges that can be matched, e.g. [0-9] would match any single digit. Using an example rule from a default udev installation: -
      KERNEL="fd[0-9]*", NAME="floppy/%n"
      +
      KERNEL=="fd[0-9]*", NAME="floppy/%n"
      This rule says:
      @@ -208,7 +208,7 @@ The ID and PLACE keys do have their uses, but they are not commonly used in rule Background information: SYSFS stores many small files under a tree of directories which provide information about your hardware. One file typically contains just one "data item" - e.g. device name, manufacturer, or product ID.

      Note that SYSFS{...} keys can be combined with the basic keys described in the previous section.


      -You can use keys in the format SYSFS{filename} to match specific info from SYSFS, where filename corresponds to a file in your SYSFS tree. For example, when my camera is connected, there is a file located at /sys/block/sda/device/model which contains "USB 2.0M DSC". To match this, I could use the following key: SYSFS{model} = "USB 2.0M DSC"

      +You can use keys in the format SYSFS{filename} to match specific info from SYSFS, where filename corresponds to a file in your SYSFS tree. For example, when my camera is connected, there is a file located at /sys/block/sda/device/model which contains "USB 2.0M DSC". To match this, I could use the following key: SYSFS{model} == "USB 2.0M DSC"

      Note that any file in sysfs can be matched in this manner, but if you match more than one file (through multiple keys), then you must only match files that exist in the same directory. Typically, there will be several directories giving information about one device. You cannot mix and match (as shown by example below).

      @@ -237,42 +237,42 @@ Moving on to rule-writing, some snipped output of the results of my "udevinfo -a
      
       follow the class device's "device"
         looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3/3-3:1.0/host0/0:0:0:0':
      -    BUS="scsi"
      -    ID="0:0:0:0"
      -    SYSFS{detach_state}="0"
      -    SYSFS{type}="0"
      -    SYSFS{max_sectors}="240"
      -    SYSFS{device_blocked}="0"
      -    SYSFS{queue_depth}="1"
      -    SYSFS{scsi_level}="3"
      -    SYSFS{vendor}="        "
      -    SYSFS{model}="USB 2.0M DSC    "
      -    SYSFS{rev}="1.00"
      -    SYSFS{online}="1"
      +    BUS=="scsi"
      +    ID=="0:0:0:0"
      +    SYSFS{detach_state}=="0"
      +    SYSFS{type}=="0"
      +    SYSFS{max_sectors}=="240"
      +    SYSFS{device_blocked}=="0"
      +    SYSFS{queue_depth}=="1"
      +    SYSFS{scsi_level}=="3"
      +    SYSFS{vendor}=="        "
      +    SYSFS{model}=="USB 2.0M DSC    "
      +    SYSFS{rev}=="1.00"
      +    SYSFS{online}=="1"
       
         looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
      -    BUS="usb"
      -    ID="3-3"
      -    SYSFS{detach_state}="0"
      -    SYSFS{bNumInterfaces}=" 1"
      -    SYSFS{bConfigurationValue}="1"
      -    SYSFS{bmAttributes}="c0"
      -    SYSFS{bMaxPower}="  0mA"
      -    SYSFS{idVendor}="052b"
      -    SYSFS{idProduct}="1514"
      -    SYSFS{bcdDevice}="0100"
      -    SYSFS{bDeviceClass}="00"
      -    SYSFS{bDeviceSubClass}="00"
      -    SYSFS{bDeviceProtocol}="00"
      -    SYSFS{bNumConfigurations}="1"
      -    SYSFS{speed}="12"
      -    SYSFS{manufacturer}="Tekom Technologies, Inc"
      -    SYSFS{product}="USB 2.0M DSC"
      +    BUS=="usb"
      +    ID=="3-3"
      +    SYSFS{detach_state}=="0"
      +    SYSFS{bNumInterfaces}==" 1"
      +    SYSFS{bConfigurationValue}=="1"
      +    SYSFS{bmAttributes}=="c0"
      +    SYSFS{bMaxPower}=="  0mA"
      +    SYSFS{idVendor}=="052b"
      +    SYSFS{idProduct}=="1514"
      +    SYSFS{bcdDevice}=="0100"
      +    SYSFS{bDeviceClass}=="00"
      +    SYSFS{bDeviceSubClass}=="00"
      +    SYSFS{bDeviceProtocol}=="00"
      +    SYSFS{bNumConfigurations}=="1"
      +    SYSFS{speed}=="12"
      +    SYSFS{manufacturer}=="Tekom Technologies, Inc"
      +    SYSFS{product}=="USB 2.0M DSC"
       
      The udevinfo tool provides a lot of information which you can simply copy-paste as udev rules. The reason that I have colour coded the above output is to point out that you generally cannot mix and match information from different parts of the udevinfo output. In the above output, I could not combine information from the different coloured sections - this is because each section of output refers to a different directory in SYSFS. For example, the following rule would not work: -
      BUS="scsi", SYSFS{manufacturer}="Tekom Technologies, Inc", NAME="%k"
      -This rule would not work because I am combining information found in the section beginning with BUS="scsi" (green) with information only found in the blue section. The rule would work if I used BUS="usb", sticking only to information found in the blue section above.

      +
      BUS=="scsi", SYSFS{manufacturer}=="Tekom Technologies, Inc", NAME="%k"
      +This rule would not work because I am combining information found in the section beginning with BUS=="scsi" (green) with information only found in the blue section. The rule would work if I used BUS=="usb", sticking only to information found in the blue section above.

      You will notice that a lot of information is not relevant for writing basic rules (there is so much of it!), you should generally be looking for information that you recognise and know will not change (e.g. model name).

      @@ -293,7 +293,7 @@ The behaviour of your own rules masking the defaults can be overcome if you writ Another recent feature is the ability to write rules that do not specify a NAME, but instead they simply specify SYMLINK keys. This allows you to avoid the issue where your own rules effectively mask the udev defaults.

      Take the rule:
      -
      KERNEL="hdc", SYMLINK="dvd"
      +
      KERNEL=="hdc", SYMLINK="dvd"
      When udev finds this rule, it will take a mental note of it. Upon finding another rule matching the same device which also includes a NAME parameter, udev will create the node as specified by the NAME parameter, plus symbolic links as specified by the SYMLINK parameters of both rules.
      To put it into practical terms, when udev is naming nodes for my hdc device, it will use the default rules for block devices as usual, with the addition of my personal symlink "dvd".

      @@ -307,23 +307,23 @@ As well as controlling the naming of the device nodes which are created, udev ru The GROUP key allows you to define which unix group should own the device node. Here's an example from the udev defaults, which defines that the video group will own framebuffer (fb) devices: -
      KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video"
      +
      KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video"
      The OWNER key, perhaps less useful, allows you to define which unix user should own the device node. Assuming the slightly odd situation where you would want "john" to own your floppy devices, you could use: -
      KERNEL="fd[0-9]*", OWNER="john"
      +
      KERNEL=="fd[0-9]*", OWNER="john"
      You'll notice in the above rule that we didn't specify any NAME or SYMLINK keys. This is similar to the multiple symlink style where udev will take a mental note that we want john to own floppy nodes, and will apply that ownership once it finds a rule which defines a NAME for the floppy device nodes.

      Building on the style mentioned above, you can do even more flashy things. The udev defaults use the following rule to define that all the sound device nodes shall be owned by the "audio" group: -
      SUBSYSTEM="sound", GROUP="audio"
      +
      SUBSYSTEM=="sound", GROUP="audio"
      -This prevents the need to excessively provide a GROUP="audio" key on every following rule which names sound devices.

      +This prevents the need to excessively provide a GROUP=="audio" key on every following rule which names sound devices.

      udev defaults to creating nodes with unix permissions of 0660 (read/write to owner and group). There may be some situations where you do not want to use the default permissions on your device node. Fortunately, you can easily override the permissions in your rules using the MODE assignment key. As an example, the following rule defines that the inotify node shall be readable and writable to everyone: -
      KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666"
      +
      KERNEL=="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666"

      Example: Writing a rule for my USB printer

      @@ -337,14 +337,14 @@ After plugging in my printer, I started looking around some /sys directories for Running "udevinfo -a -p /sys/class/usb/lp0" provided me with a heap of info, as usual. I picked out the relevant bits for unique device identification:
       looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
      -BUS="usb"
      -SYSFS{manufacturer}="EPSON"
      -SYSFS{product}="USB Printer"
      -SYSFS{serial}="L72010011070626380"
      +BUS=="usb"
      +SYSFS{manufacturer}=="EPSON"
      +SYSFS{product}=="USB Printer"
      +SYSFS{serial}=="L72010011070626380"
       
      My udev rule becomes: -
      BUS="usb", SYSFS{serial}="L72010011070626380", NAME="%k", SYMLINK="epson_680"
      +
      BUS=="usb", SYSFS{serial}=="L72010011070626380", NAME="%k", SYMLINK="epson_680"
      And my printer nodes exist at /dev/lp0 (or /dev/lp1 if another printer was plugged in beforehand) and /dev/epson_680 always points at the device node for that particular printer.

      @@ -357,7 +357,7 @@ This one is a bit tricky. Several nodes are created by default when my camera is sda1 is the node that I would like as my /dev/camera, as that is what gets mounted. udevinfo did not point out any useful differences between sda, sda1, and sg1. I decided that a reliable way to differentiate between these 3 nodes would be to look at the KERNEL name.

      -A key such as KERNEL="sd?1" would match KERNEL names such as "sda1", "sdb1", "sdc1", and equally importantly, it will not match KERNEL names such as sda, sdb, or sg1. The purpose of this key is to ignore the /dev/sda and /dev/sg1 nodes. The device is a digital camera - I would not dream of fdisking it or anything like that, so these 2 nodes are pretty useless to me. The key attempts to capture the /dev/sda1 node, which is mountable and therefore useful!

      +A key such as KERNEL=="sd?1" would match KERNEL names such as "sda1", "sdb1", "sdc1", and equally importantly, it will not match KERNEL names such as sda, sdb, or sg1. The purpose of this key is to ignore the /dev/sda and /dev/sg1 nodes. The device is a digital camera - I would not dream of fdisking it or anything like that, so these 2 nodes are pretty useless to me. The key attempts to capture the /dev/sda1 node, which is mountable and therefore useful!

      As this node (sda1) is treated as a block device, looking in /sys/block would be a good place to start.

      @@ -366,10 +366,10 @@ In my /sys/block, I have a directory named sda. In my /sys/bloc
      # udevinfo -a -p /sys/block/sda/sda1
      In the udevinfo output, I also noticed this bit of useful and understandable information: -
      SYSFS{product}="USB 2.0M DSC"
      +
      SYSFS{product}=="USB 2.0M DSC"
      So that gives me my rule. For completeness, I also include a BUS key (this was also found in the udevinfo output). -
      BUS="usb", SYSFS{product}="USB 2.0M DSC", KERNEL="sd?1", NAME="%k", SYMLINK="camera"
      +
      BUS=="usb", SYSFS{product}=="USB 2.0M DSC", KERNEL=="sd?1", NAME="%k", SYMLINK="camera"
      Now, when my camera is plugged in, it will be named /dev/sda1 (or, if sda1 isnt available, it might be called /dev/sdb1) and will always be correctly linked to from /dev/camera. The /dev/sda (or sdb) node still appears as normal, but the important thing is that my custom persistent "camera" symlink points to the mountable partition.

      @@ -379,7 +379,7 @@ Now, when my camera is plugged in, it will be named /dev/sda1 (or, if sda Carl Streeter, the owner of a large USB hard disk, wrote to me and explained that unlike in my digital camera example, the /dev/sda node is useful to him. He pointed out that he does occasionally need to use tools such as fdisk and hdparm on that node.

      Carl's rule is: -
      BUS="usb", KERNEL="sd*", SYSFS{product}="USB 2.0 Storage Device", NAME="%k", SYMLINK="usbhd%n"
      +
      BUS=="usb", KERNEL=="sd*", SYSFS{product}=="USB 2.0 Storage Device", NAME="%k", SYMLINK="usbhd%n"
      This rule creates symlinks such as:
        @@ -396,7 +396,7 @@ This problem also applies to other USB disks - e.g. if you create a new partitio udev provides a solution here - it is able to create nodes for all partitions of a block device. For every rule that you specify, the block device will have all 16 partition nodes created. To achieve this, you can simply modify the NAME key, as shown below:
        -
        BUS="usb", SYSFS{product}="USB 2.0 Storage Device", NAME{all_partitions}="usbhd"
        +
        BUS=="usb", SYSFS{product}=="USB 2.0 Storage Device", NAME{all_partitions}="usbhd"
        You will now have nodes named: usbhd, usbhd1, usbhd2, usbhd3, ..., usbhd15.

        @@ -407,8 +407,8 @@ I have two CD drives in my PC - a DVD reader, and a CD rewriter. My DVD is hdc a Still, some people (myself included) like to have nodes such as /dev/dvd and /dev/cdrw for convenience. Since we know the "hdX" values for these drives, writing rules is simple. The examples below should be self explanatory.
        -BUS="ide", KERNEL="hdc", NAME="%k", SYMLINK="dvd cdroms/cdrom%n"
        -BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n"
        +BUS=="ide", KERNEL=="hdc", NAME="%k", SYMLINK="dvd cdroms/cdrom%n"
        +BUS=="ide", KERNEL=="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n"
         
        You may have noticed that the default 50-udev.rules file contains a rule which runs a script to produces names for block devices. Do not be confused by this - as usual, because your own rules are located in a file which is processed before the default rules, the defaults will not be used when naming the hardware you have written rules for.

        @@ -418,7 +418,7 @@ BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n" These devices work as USB-serial devices, so by default, you only get the ttyUSB1 node. The user-space palm utilities rely on /dev/pilot, so you need to use a rule to create this. The following rule will do the job:

        -
        BUS="usb", SYSFS{product}="Palm Handheld", KERNEL="ttyUSB*", SYMLINK="pilot"
        +
        BUS=="usb", SYSFS{product}=="Palm Handheld", KERNEL=="ttyUSB*", SYMLINK="pilot"
        This was adapted from Carsten Clasohm's blog entry, which includes a useful discussion of the situation. You may also wish to add ownership and permission keys to the rule to suit your setup.

        @@ -431,14 +431,14 @@ As usual, udevinfo comes to our aid in rule-writing. In my example, I wish to re
         # udevinfo -a -p /sys/class/net/eth0/
           looking at class device '/sys/class/net/eth0':
        -    SYSFS{address}="00:52:8b:d5:04:48"
        +    SYSFS{address}=="00:52:8b:d5:04:48"
         
        Every network adapter has its own unique MAC-address, so I chose to use this when writing my rule. This will not change, unless you change your network card. There is one caveat here: make sure you use the MAC address you obtain from udevinfo (as above), because it is case sensitive. Be careful when using utilities such as ifconfig as they will capitalize the letters.

        An example rule is shown below: -
        KERNEL="eth*", SYSFS{address}="00:52:8b:d5:04:48", NAME="lan"
        +
        KERNEL=="eth*", SYSFS{address}=="00:52:8b:d5:04:48", NAME="lan"
        You will need to reload the net driver for this rule to take effect. You can either unload and reload the module, or simply reboot the system. You will also need to reconfigure your system to use "lan" rather than "eth0". I had some troubles getting this going (the interface wasn't being renamed) until I had completely dropped all references to eth0.
        After that, you should be able to use "lan" instead of "eth0" in any calls to ifconfig or similar utilities.

        @@ -452,7 +452,7 @@ After that, you should be able to use "lan" instead of "eth0" in any calls to Always use udevinfo to assist the rule-writing process. Always use udevinfo to look under /sys/block or /sys/class (it will not start reading a chain from anywhere else).
      • If you get totally stuck, use the following command to find all "dev" files under /sys (udevinfo can work on directories containing this file): find /sys -iname dev
      • If your device is a flash-card reader, usb flash-drive, or digital camera that acts as usb-storage, that is created as /dev/sdX, then start looking in /sys/block/sdX.
      • -
      • If applicable, make sure you identify the difference between sdX and sdX1 in the above situation. This can be done with the key KERNEL="sd?1" to match sdX1, or KERNEL="sd?" to match sdX.
      • +
      • If applicable, make sure you identify the difference between sdX and sdX1 in the above situation. This can be done with the key KERNEL="sd?1" to match sdX1, or KERNEL=="sd?" to match sdX.
      • For USB printers that are created as /dev/lpX, then you should start looking in /sys/class/usb/lpX.
      • The usb scanner driver has recently been removed from the kernel and re-implemented in userspace (as part of the SANE package). You do not (and can not) write rules for this hardware as it does not rely on specific kernel drivers.
      • -- cgit v1.2.3-54-g00ecf From dd8140ae79de87f72a956c0806e303984e827c6b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Feb 2006 19:14:43 +0100 Subject: volume_id: add missing return --- extras/volume_id/libvolume_id/volume_id.c | 68 ++++++++++++++++--------------- extras/volume_id/libvolume_id/volume_id.h | 2 +- 2 files changed, 36 insertions(+), 34 deletions(-) diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c index 1daf1cbd74..6a900ab281 100644 --- a/extras/volume_id/libvolume_id/volume_id.c +++ b/extras/volume_id/libvolume_id/volume_id.c @@ -39,40 +39,42 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) /* probe for raid first, cause fs probes may be successful on raid members */ if (size) { if (volume_id_probe_linux_raid(id, off, size) == 0) - goto exit; + goto found; if (volume_id_probe_intel_software_raid(id, off, size) == 0) - goto exit; + goto found; if (volume_id_probe_lsi_mega_raid(id, off, size) == 0) - goto exit; + goto found; if (volume_id_probe_via_raid(id, off, size) == 0) - goto exit; + goto found; if (volume_id_probe_silicon_medley_raid(id, off, size) == 0) - goto exit; + goto found; if (volume_id_probe_nvidia_raid(id, off, size) == 0) - goto exit; + goto found; if (volume_id_probe_promise_fasttrack_raid(id, off, size) == 0) - goto exit; + goto found; if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0) - goto exit; + goto found; } if (volume_id_probe_lvm1(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_lvm2(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_highpoint_37x_raid(id, off) == 0) - goto exit; + goto found; -exit: + return -1; + +found: /* If recognized, we free the allocated buffers */ volume_id_free_buffer(id); return 0; @@ -84,72 +86,72 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size return -EINVAL; if (volume_id_probe_luks(id, off) == 0) - goto exit; + goto found; /* signature in the first block, only small buffer needed */ if (volume_id_probe_vfat(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_xfs(id, off) == 0) - goto exit; + goto found; /* fill buffer with maximum */ volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); if (volume_id_probe_linux_swap(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_ext(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_reiserfs(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_jfs(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_udf(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_iso9660(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_hfs_hfsplus(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_ufs(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_ntfs(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_cramfs(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_romfs(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_hpfs(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_sysv(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_minix(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_ocfs1(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_ocfs2(id, off) == 0) - goto exit; + goto found; if (volume_id_probe_vxfs(id, off) == 0) - goto exit; + goto found; return -1; -exit: +found: /* If recognized, we free the allocated buffers */ volume_id_free_buffer(id); return 0; diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index 2caf75f532..78baf59820 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -14,7 +14,7 @@ #include #include -#define VOLUME_ID_VERSION 57 +#define VOLUME_ID_VERSION 58 #ifndef PACKED #define PACKED __attribute__((packed)) -- cgit v1.2.3-54-g00ecf From 1a4e5303e0309fc629880a5abaf690b571ae6f2f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Feb 2006 20:10:49 +0100 Subject: udevd: fix queue export for multiple events for the same device Identified by Joachim Plack while working around the problem that the device nodes appear and disappear while the partitiontable is re-read and the application need to waait for an empty udevd queue. --- udevd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udevd.c b/udevd.c index 3f4605ed11..98e3d54b33 100644 --- a/udevd.c +++ b/udevd.c @@ -200,6 +200,10 @@ static void export_event_state(struct uevent_msg *msg, enum event_state state) if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0) return; + list_for_each_entry(loop_msg, &exec_list, node) + if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0) + return; + /* move failed events to the failed directory */ if (state == EVENT_FAILED) { create_path(filename_failed); -- cgit v1.2.3-54-g00ecf From 0030441ca4cda7023dcc37f1a6522b245e1f46ae Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Feb 2006 16:59:50 +0100 Subject: 086 release --- ChangeLog | 16 ++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2b959f04a3..4df68ecc74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Summary of changes from v085 to v086 +============================================ + +Kay Sievers: + volume_id: replace __packed__ by PACKED macro + volume_id: split raid and filesystem detection + volume_id: add missing return + udevd: fix queue export for multiple events for the same device + +Kyle McMartin: + workaround missing kernel headers for some architectures + +Nix: + update to udev-084/doc/writing_udev_rules + + Summary of changes from v084 to v085 ============================================ diff --git a/Makefile b/Makefile index 5d82d44c64..54cf59c3b9 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 085 +VERSION = 086 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6826b8fd8a..11d728d06a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,8 @@ +udev 085 +======== +Fix queue export, which wasn't correct for subsequent add/remove +events for the same device. + udev 085 ======== Fix cramfs detection on big endian. -- cgit v1.2.3-54-g00ecf From 5016ef53f52feddb0beb202c7b4c0a299cd835bd Mon Sep 17 00:00:00 2001 From: Masatake YAMATO Date: Wed, 1 Mar 2006 20:02:41 +0100 Subject: typo in debug text in udev_run_hotplugd.c --- extras/run_directory/udev_run_hotplugd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/run_directory/udev_run_hotplugd.c b/extras/run_directory/udev_run_hotplugd.c index bfa82ab917..f94c237e37 100644 --- a/extras/run_directory/udev_run_hotplugd.c +++ b/extras/run_directory/udev_run_hotplugd.c @@ -68,7 +68,7 @@ int main(int argc, char *argv[], char *envp[]) close(fd); } - dbg("running dev.d directory"); + dbg("running hotplug.d directory"); sprintf(dirname, "/etc/hotplug.d/%s", subsystem); run_directory(dirname, ".hotplug", subsystem); -- cgit v1.2.3-54-g00ecf From 226c074d6d27a789a1dfba869f993b53fe135958 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Wed, 1 Mar 2006 20:07:20 +0100 Subject: path_id: support SAS devices --- extras/path_id | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) mode change 100755 => 100644 extras/path_id diff --git a/extras/path_id b/extras/path_id old mode 100755 new mode 100644 index 73d5c834dd..324fe825b6 --- a/extras/path_id +++ b/extras/path_id @@ -288,6 +288,48 @@ handle_block_fc () { RESULT=0 } +handle_block_sas () { + : handle_block_sas $* + local DEV=$1 + local cil adapter controller_dev + # SAS device + sas_host_path="${DEV%%/phy*}" + sas_phy_path="${DEV#*/host*/}" + sas_phy_path="${sas_phy_path%%/target*}" + sas_phy_id="${sas_phy_path%%/*}" + sas_rphy_id="${sas_phy_path##*/}" + sas_phy_dev="${sas_host_path}/${sas_phy_id}/sas_phy:${sas_phy_id}" + if [ -e "$sas_phy_dev/sas_address" ]; then + read phy_address < $sas_phy_dev/sas_address + read phy_port < $sas_phy_dev/port_identifier + read phy_id < $sas_phy_dev/phy_identifier + fi + if [ -z "$phy_address" ] ; then + : no initiator address + RESULT=1 + return + fi + sas_phy_address="$phy_address:$phy_port:$phy_id" + sas_rphy_dev="${sas_host_path}/${sas_phy_id}/${sas_rphy_id}/sas_rphy:${sas_rphy_id}" + if [ -e "$sas_rphy_dev/sas_address" ]; then + read rphy_address < $sas_rphy_dev/sas_address + read rphy_id < $sas_rphy_dev/phy_identifier + fi + if [ -z "$rphy_address" ] ; then + : no initiator address + RESULT=1 + return + fi + sas_rphy_address="$rphy_address:$rphy_id" + + controller_dev="${sas_host_path%/host[0-9]*}" + adapter="${controller_dev##*/}" + bus="pci" + d="$bus-$adapter" + d="${d}-sas-${sas_phy_address}-${sas_rphy_address}" + RESULT=0 +} + handle_block_usb_storage () { : handle_block_usb_storage $* local DEV=$1 @@ -396,6 +438,9 @@ handle_block () { */rport-[0-9]*:[0-9]*-[0-9]*/*) handle_block_fc "$D" ;; + */phy-[0-9]*:[0-9]*/*) + handle_block_sas "$D" + ;; */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) # check for ieee1394 sbp2 if test -f $D/ieee1394_id ; then -- cgit v1.2.3-54-g00ecf From 7b05672ebb1cb6cefe25f7c83c193cf4c6947e2b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Mar 2006 23:19:27 +0100 Subject: fix persistent disk rules to exclude removable IDE drives --- etc/udev/05-udev-early.rules | 4 ++++ etc/udev/60-persistent-disk.rules | 49 +++++++++++++++++++++++++++++++++++++++ etc/udev/persistent-disk.rules | 48 -------------------------------------- 3 files changed, 53 insertions(+), 48 deletions(-) create mode 100644 etc/udev/05-udev-early.rules create mode 100644 etc/udev/60-persistent-disk.rules delete mode 100644 etc/udev/persistent-disk.rules diff --git a/etc/udev/05-udev-early.rules b/etc/udev/05-udev-early.rules new file mode 100644 index 0000000000..417ee67d6f --- /dev/null +++ b/etc/udev/05-udev-early.rules @@ -0,0 +1,4 @@ +# sysfs is populated after the event is sent +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" + diff --git a/etc/udev/60-persistent-disk.rules b/etc/udev/60-persistent-disk.rules new file mode 100644 index 0000000000..679e1ef988 --- /dev/null +++ b/etc/udev/60-persistent-disk.rules @@ -0,0 +1,49 @@ +# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_disk_end" +SUBSYSTEM!="block", GOTO="persistent_disk_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_disk_end" + +# never access removable ide devices, the drivers are causing event loops on open() +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_disk_end" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_disk_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="sr*", GOTO="persistent_disk_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_disk_end" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" + +LABEL="persistent_disk_end" diff --git a/etc/udev/persistent-disk.rules b/etc/udev/persistent-disk.rules deleted file mode 100644 index 3515bb189d..0000000000 --- a/etc/udev/persistent-disk.rules +++ /dev/null @@ -1,48 +0,0 @@ -# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" - -# never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" - -LABEL="persistent_end" -- cgit v1.2.3-54-g00ecf From 79102489260da9f577d7c1fb3665dd95d1596bea Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Mar 2006 23:20:10 +0100 Subject: warn about %e, MODALIAS, $modalias --- udev_rules.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/udev_rules.c b/udev_rules.c index 9fa2253e96..1aedb11118 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -290,6 +290,12 @@ static int find_free_number(const char *base, const char *devpath) char filename[PATH_SIZE]; struct udevice *udev_db; int num = 0; + static int warn = 1; + + if (warn) { + err("%%e is deprecated, will be removed and is unlikey to work correctly. Don't use it."); + warn = 0; + } /* check if the device already owns a matching name */ udev_db = udev_device_init(); @@ -616,6 +622,13 @@ found: case SUBST_MODALIAS: { const char *value; + static int warn = 1; + + if (warn) { + err("$modalias is deprecated, use $env{MODALIAS} or " + "$sysfs{modalias} instead."); + warn = 0; + } value = sysfs_attr_get_value(udev->dev->devpath, "modalias"); if (value != NULL) { @@ -715,6 +728,12 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (rule->modalias.operation != KEY_OP_UNSET) { const char *value; + static int warn = 1; + + if (warn) { + err("MODALIAS is deprecated, use ENV{MODALIAS} or SYSFS{modalias} instead."); + warn = 0; + } value = sysfs_attr_get_value(udev->dev->devpath, "modalias"); if (value == NULL) { -- cgit v1.2.3-54-g00ecf From cdce0be8956a26a4a2a4f9fb338508ffd75672b9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Mar 2006 00:34:36 +0100 Subject: remove devfs rules and scripts --- etc/udev/udev-devfs.rules | 112 ---------------------------------------------- extras/ide-devfs.sh | 47 ------------------- extras/raid-devfs.sh | 50 --------------------- extras/scsi-devfs.sh | 88 ------------------------------------ 4 files changed, 297 deletions(-) delete mode 100644 etc/udev/udev-devfs.rules delete mode 100644 extras/ide-devfs.sh delete mode 100644 extras/raid-devfs.sh delete mode 100644 extras/scsi-devfs.sh diff --git a/etc/udev/udev-devfs.rules b/etc/udev/udev-devfs.rules deleted file mode 100644 index ec44692d68..0000000000 --- a/etc/udev/udev-devfs.rules +++ /dev/null @@ -1,112 +0,0 @@ -# The use of these rules is not recommended or supported. This file -# is just kept around to proof that udev is able to emulate the devfs scheme. -# -# In a world where devices can come and go at any time, the devfs device -# naming scheme of simple grouping and enumeration DOES NOT HELP ANYTHING. -# -# Use custom rules to name your device or look at the persistent device -# naming scheme, which is implemented for disks and extend it in a -# similar way for the subsystem you want a sane node layout for. - -# ide block devices -BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}" - -# md block devices -KERNEL="md[0-9]*", NAME="md/%n" - -# floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n" - -# tty devices -KERNEL="tty[0-9]*", NAME="vc/%n" -KERNEL="ttyS[0-9]*", NAME="tts/%n" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n" - -# vc devices -KERNEL="vcs", NAME="vcc/0" -KERNEL="vcs[0-9]*", NAME="vcc/%n" -KERNEL="vcsa", NAME="vcc/a0" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n" - -# v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n" -KERNEL="radio[0-9]*", NAME="v4l/radio%n" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n" - -# dm devices (ignore them) -KERNEL="dm-[0-9]*", NAME="" - -# i2c devices -KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" - -# loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k" - -# ramdisks -KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" - -# framebuffer devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k" - -# misc -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" - -# alsa devices -KERNEL="controlC[0-9]*", NAME="snd/%k" -KERNEL="hw[CD0-9]*", NAME="snd/%k" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL="midi[CD0-9]*", NAME="snd/%k" -KERNEL="timer", NAME="snd/%k" -KERNEL="seq", NAME="snd/%k" - -# oss devices -KERNEL="audio*", NAME="sound/%k", SYMLINK="%k" -KERNEL="dmmidi", NAME="sound/%k", SYMLINK="%k" -KERNEL="dsp*", NAME="sound/%k", SYMLINK="%k" -KERNEL="midi*", NAME="sound/%k", SYMLINK="%k" -KERNEL="mixer*", NAME="sound/%k", SYMLINK="%k" -KERNEL="sequencer*", NAME="sound/%k", SYMLINK="%k" - -# input devices -KERNEL="mice", NAME="input/%k" -KERNEL="mouse*", NAME="input/%k" -KERNEL="event*", NAME="input/%k" -KERNEL="js*", NAME="input/%k" -KERNEL="ts*", NAME="input/%k" - -# USB devices -KERNEL="hiddev*", NAME="usb/%k" -KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k" -KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" - -# netlink devices -KERNEL="route", NAME="netlink/%k" -KERNEL="skip", NAME="netlink/%k" -KERNEL="usersock", NAME="netlink/%k" -KERNEL="fwmonitor", NAME="netlink/%k" -KERNEL="tcpdiag", NAME="netlink/%k" -KERNEL="nflog", NAME="netlink/%k" -KERNEL="xfrm", NAME="netlink/%k" -KERNEL="arpd", NAME="netlink/%k" -KERNEL="route6", NAME="netlink/%k" -KERNEL="ip6_fw", NAME="netlink/%k" -KERNEL="dnrtmsg", NAME="netlink/%k" -KERNEL="tap*", NAME="netlink/%k" - -# CAPI devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi*", NAME="capi/%n" - -# Network devices -KERNEL="tun", NAME="net/%k" - -# raw devices -KERNEL="raw[0-9]*", NAME="raw/%k" diff --git a/extras/ide-devfs.sh b/extras/ide-devfs.sh deleted file mode 100644 index d4c05b5342..0000000000 --- a/extras/ide-devfs.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -# udev external PROGRAM script -# return devfs-names for ide-devices -# BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" - -HOST="${2%\.[0-9]}" -TARGET="${2#[0-9]\.}" - -if [ -z "${HOST#[13579]}" ]; then - HOST=$((${HOST} - 1)) - BUS="1" -else - BUS="0" -fi - -get_dev_number() { - num=0 - DRIVE="${1%%[0-9]*}" - - for x in /proc/ide/*/media; do - if [ -e "${x}" ]; then - lMEDIA=`cat ${x}` - if [ "${lMEDIA}" = "$2" ]; then - num=$((${num} + 1)) - fi - if [ "${x}" = "/proc/ide/${DRIVE}/media" ]; then - break - fi - fi - done - - echo $((${num} - 1)) -} - -if [ -z "$3" ] && [ -f /proc/ide/${1}/media ]; then - MEDIA=`cat /proc/ide/${1}/media` - if [ "${MEDIA}" = "cdrom" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/cd cdroms/cdrom`get_dev_number $1 cdrom` ${MEDIA} - elif [ "${MEDIA}" = "floppy" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc floppies/floppy`get_dev_number $1 floppy`/disc ${MEDIA} - elif [ "${MEDIA}" = "disk" ]; then - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/disc discs/disc`get_dev_number $1 disk`/disc ${MEDIA} - fi -else - echo ide/host${HOST}/bus${BUS}/target${TARGET}/lun0/part$3 discs/disc`get_dev_number $1 disk`/part$3 -fi diff --git a/extras/raid-devfs.sh b/extras/raid-devfs.sh deleted file mode 100644 index ca279d45c0..0000000000 --- a/extras/raid-devfs.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -e -# -# Copyright (c) 2004 Marco d'Itri -# Copyright (c) 2004 Piotr Roszatycki -# -# Usage: -# KERNEL=="cciss!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" -# KERNEL=="ida!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" -# KERNEL=="rd!*", PROGRAM="/etc/udev/scripts/raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" - -get_dev_number_cciss() { - grep '^cciss/' /proc/driver/cciss/* | cat -n | \ - sed -n "/cciss\/$1:/s/cciss.*//p" -} - -get_dev_number_ida() { - grep '^ida/' /proc/driver/cpqarray/* | cat -n | \ - sed -n "/ida\/$1:/s/ida.*//p" -} - -get_dev_number_rd() { - grep '^ */dev/rd/' /proc/rd/*/initial_status | cat -n | \ - sed -n "/rd\/$1:/s/\/dev\/rd.*//p" -} - -get_dev_number() { - dev=$1 - num=$(eval $(echo get_dev_number_$TYPE $dev)) - [ "$num" ] || exit 1 - echo $(($num - 1)) -} - -TYPE=${1%%/*} -NAME=${1#*/} - -# abort if there was no match -[ "$TYPE" != "$1" ] || exit 1 - -case "$NAME" in - *p*) - LONG_NAME=disc$(get_dev_number ${NAME%%p*})/part${NAME##*p} - ;; - *) - LONG_NAME=disc$(get_dev_number $NAME)/disc - ;; -esac - -echo "$TYPE/$LONG_NAME" -exit 0 - diff --git a/extras/scsi-devfs.sh b/extras/scsi-devfs.sh deleted file mode 100644 index b1a17cb21e..0000000000 --- a/extras/scsi-devfs.sh +++ /dev/null @@ -1,88 +0,0 @@ -#! /bin/sh -# -# scsi-devfs.sh: udev external PROGRAM script -# -# Copyright 2004 Richard Gooch -# Copyright 2004 Fujitsu Ltd. -# Distributed under the GNU Copyleft version 2.0. -# -# return devfs-names for scsi-devices -# Usage in udev.rules: -# BUS="scsi", KERNEL="sd*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh sd %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" -# BUS="scsi", KERNEL="sr*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh sr %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" -# BUS="scsi", KERNEL="st*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh st %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" -# BUS="scsi", KERNEL="sg*", PROGRAM="/etc/udev/scripts/scsi-devfs.sh sg %b %n", NAME="%c{1}", SYMLINK="%c{2} %k %c{3} %c{4}" - -# Find out where sysfs is mounted. Exit if not available -sysfs=`grep -F sysfs /proc/mounts | awk '{print $2}'` -if [ "$sysfs" = "" ]; then - echo "sysfs is required" - exit 1 -fi -cd $sysfs/bus/scsi/devices - -case "$1" in - sd) - # Extract partition component - if [ "$3" = "" ]; then - lpart="disc" - spart="" - else - lpart="part$3" - spart="p$3" - fi - ;; - sr) - lpart="cdrom" - spart="" - ;; - st) - # Not supported yet - exit 1 - ;; - sg) - lpart="generic" - spart="" - ;; - *) - exit 1 - ;; -esac - -# Extract SCSI logical address components -scsi_host=`echo $2 | cut -f 1 -d:` -scsi_bus=`echo $2 | cut -f 2 -d:` -scsi_target=`echo $2 | cut -f 3 -d:` -scsi_lun=`echo $2 | cut -f 4 -d:` - -# Generate long and short common name parts -l_com="bus$scsi_bus/target$scsi_target/lun$scsi_lun/$lpart" -s_com="b${scsi_bus}t${scsi_target}u${scsi_lun}$spart" - -# Generate long and short logical names -l_log="scsi/host$scsi_host/$l_com" -s_log="$1/c${scsi_host}${s_com}" - -readlink $2 | grep -F -q pci -if [ "$?" != "0" ]; then - # Not a PCI controller, show logical locations only - echo $l_log $s_log - exit 0 -fi - -# Extract PCI address -tmp=`readlink $2 | sed -e 's@/host.*/.*@@'` -pci_addr=`basename "$tmp"` -pci_domain=`echo $pci_addr | cut -f 1 -d:` -pci_bus=`echo $pci_addr | cut -f 2 -d:` -pci_slot=`echo $pci_addr | tr . : | cut -f 3 -d:` -pci_function=`echo $pci_addr | cut -f 2 -d.` - -# Generate long and short physical names -l_pci="domain$pci_domain/bus$pci_bus/slot$pci_slot/function$pci_function" -l_phy="bus/pci/$l_pci/scsi/$l_com" -s_phy="$1/pci/$pci_addr/$s_com" - -echo $l_phy $s_phy $l_log $s_log - - -- cgit v1.2.3-54-g00ecf From b2885eeecf517e82830f585a69ebc9c2c60cfa5e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Mar 2006 00:38:17 +0100 Subject: 087 release --- ChangeLog | 15 +++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 8 +++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4df68ecc74..c2d00d149b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Summary of changes from v086 to v087 +============================================ + +Hannes Reinecke: + path_id: support SAS devices + +Kay Sievers: + fix persistent disk rules to exclude removable IDE drives + warn about %e, MODALIAS, $modalias + remove devfs rules and scripts + +Masatake YAMATO: + typo in debug text in udev_run_hotplugd.c + + Summary of changes from v085 to v086 ============================================ diff --git a/Makefile b/Makefile index 54cf59c3b9..9158550e6b 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 086 +VERSION = 087 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 11d728d06a..f8d6fde807 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,4 +1,10 @@ -udev 085 +udev 087 +======== +Fix persistent disk rules to exclude removable IDE drives. + +Warn if %e, $modalias or MODALIAS is used. + +udev 086 ======== Fix queue export, which wasn't correct for subsequent add/remove events for the same device. -- cgit v1.2.3-54-g00ecf From 2f567dd62ede3cf979e426738925446f1182ba52 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Mar 2006 19:44:28 +0100 Subject: volume_id: add squashfs detection --- extras/volume_id/libvolume_id/Makefile | 1 + extras/volume_id/libvolume_id/squashfs.c | 53 +++++++++++++++++++++++++++++++ extras/volume_id/libvolume_id/volume_id.c | 3 ++ extras/volume_id/libvolume_id/volume_id.h | 3 +- 4 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 extras/volume_id/libvolume_id/squashfs.c diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile index 07f6662f25..2a86e931a4 100644 --- a/extras/volume_id/libvolume_id/Makefile +++ b/extras/volume_id/libvolume_id/Makefile @@ -38,6 +38,7 @@ OBJS= \ luks.o \ ocfs.o \ vxfs.o \ + squashfs.o \ volume_id.o \ util.o diff --git a/extras/volume_id/libvolume_id/squashfs.c b/extras/volume_id/libvolume_id/squashfs.c new file mode 100644 index 0000000000..f220721d7b --- /dev/null +++ b/extras/volume_id/libvolume_id/squashfs.c @@ -0,0 +1,53 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2006 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "volume_id.h" +#include "logging.h" +#include "util.h" + +#define SQUASHFS_MAGIC 0x73717368 + +struct squashfs_super { + uint32_t s_magic; +} PACKED; + +int volume_id_probe_squashfs(struct volume_id *id, uint64_t off) +{ + struct squashfs_super *sqs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + sqs = (struct squashfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); + if (sqs == NULL) + return -1; + + if (sqs->s_magic == SQUASHFS_MAGIC || sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) { + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "squashfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c index 6a900ab281..fdecf396c4 100644 --- a/extras/volume_id/libvolume_id/volume_id.c +++ b/extras/volume_id/libvolume_id/volume_id.c @@ -149,6 +149,9 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (volume_id_probe_vxfs(id, off) == 0) goto found; + if (volume_id_probe_squashfs(id, off) == 0) + goto found; + return -1; found: diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index 78baf59820..15f1ac01f8 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -14,7 +14,7 @@ #include #include -#define VOLUME_ID_VERSION 58 +#define VOLUME_ID_VERSION 59 #ifndef PACKED #define PACKED __attribute__((packed)) @@ -96,6 +96,7 @@ extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off); /* special formats */ extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); -- cgit v1.2.3-54-g00ecf From 3e5e833253a0683935808c90498b6c639be955fe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Mar 2006 10:46:30 +0100 Subject: reset signal handler in event process --- udevd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/udevd.c b/udevd.c index 98e3d54b33..9340be14cf 100644 --- a/udevd.c +++ b/udevd.c @@ -100,6 +100,13 @@ static int udev_event_process(struct uevent_msg *msg) act.sa_flags = 0; sigaction(SIGALRM, &act, NULL); + /* reset to default */ + act.sa_handler = SIG_DFL; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + sigaction(SIGCHLD, &act, NULL); + sigaction(SIGHUP, &act, NULL); + /* trigger timeout to prevent hanging processes */ alarm(UDEV_ALARM_TIMEOUT); -- cgit v1.2.3-54-g00ecf From f660222775b2603c3d4b5a7119a4daffff794b2c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Mar 2006 10:47:31 +0100 Subject: correct use of fcntl() --- udevd.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index 9340be14cf..701165b9ad 100644 --- a/udevd.c +++ b/udevd.c @@ -921,12 +921,24 @@ int main(int argc, char *argv[], char *envp[]) err("error getting pipes: %s", strerror(errno)); goto exit; } - retval = fcntl(signal_pipe[READ_END], F_SETFL, O_NONBLOCK); + + retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); + if (retval < 0) { + err("error fcntl on read pipe: %s", strerror(errno)); + goto exit; + } + retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { err("error fcntl on read pipe: %s", strerror(errno)); goto exit; } - retval = fcntl(signal_pipe[WRITE_END], F_SETFL, O_NONBLOCK); + + retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); + if (retval < 0) { + err("error fcntl on write pipe: %s", strerror(errno)); + goto exit; + } + retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { err("error fcntl on write pipe: %s", strerror(errno)); goto exit; -- cgit v1.2.3-54-g00ecf From 0d5be398ffd2f47e0b97f33ca2fd96319ee16c9d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Mar 2006 01:52:15 +0100 Subject: add udevtrigger to request events for coldplug The shell script can't handle 1000's of devices. --- Makefile | 6 + udevtrigger.8 | 37 ++++++ udevtrigger.c | 354 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udevtrigger.xml | 90 ++++++++++++++ 4 files changed, 487 insertions(+) create mode 100644 udevtrigger.8 create mode 100644 udevtrigger.c create mode 100644 udevtrigger.xml diff --git a/Makefile b/Makefile index 9158550e6b..ddb74175ce 100644 --- a/Makefile +++ b/Makefile @@ -49,6 +49,7 @@ V = PROGRAMS = \ udev \ udevd \ + udevtrigger \ udevsend \ udevcontrol \ udevmonitor \ @@ -84,6 +85,7 @@ MAN_PAGES = \ udev.7 \ udevmonitor.8 \ udevd.8 \ + udevtrigger.8 \ udevsend.8 \ udevtest.8 \ udevinfo.8 \ @@ -265,6 +267,7 @@ install-man: $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 + $(INSTALL_DATA) -D udevtrigger.8 $(DESTDIR)$(mandir)/man8/udevtrigger.8 $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ @@ -277,6 +280,7 @@ uninstall-man: - rm -f $(DESTDIR)$(mandir)/man8/udevinfo.8 - rm -f $(DESTDIR)$(mandir)/man8/udevtest.8 - rm -f $(DESTDIR)$(mandir)/man8/udevd.8 + - rm -f $(DESTDIR)$(mandir)/man8/udevtrigger.8 - rm -f $(DESTDIR)$(mandir)/man8/udevmonitor.8 - rm -f $(DESTDIR)$(mandir)/man8/udevcontrol.8 @ extras="$(EXTRAS)"; for target in $$extras; do \ @@ -287,6 +291,7 @@ uninstall-man: install-bin: $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL_PROGRAM) -D udevd $(DESTDIR)$(sbindir)/udevd + $(INSTALL_PROGRAM) -D udevtrigger $(DESTDIR)$(sbindir)/udevtrigger $(INSTALL_PROGRAM) -D udevcontrol $(DESTDIR)$(sbindir)/udevcontrol $(INSTALL_PROGRAM) -D udevmonitor $(DESTDIR)$(usrsbindir)/udevmonitor $(INSTALL_PROGRAM) -D udevinfo $(DESTDIR)$(usrbindir)/udevinfo @@ -303,6 +308,7 @@ endif uninstall-bin: - rm -f $(DESTDIR)$(sbindir)/udevd + - rm -f $(DESTDIR)$(sbindir)/udevtrigger - rm -f $(DESTDIR)$(sbindir)/udevcontrol - rm -f $(DESTDIR)$(usrsbindir)/udevmonitor - rm -f $(DESTDIR)$(usrbindir)/udevinfo diff --git a/udevtrigger.8 b/udevtrigger.8 new file mode 100644 index 0000000000..a792eaca6e --- /dev/null +++ b/udevtrigger.8 @@ -0,0 +1,37 @@ +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEVTRIGGER" "8" "March 2006" "udev" "udevtrigger" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udevtrigger \- request kernel devices events for coldplug +.SH "SYNOPSIS" +.HP 12 +\fBudevtrigger\fR [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] +.SH "DESCRIPTION" +.PP +Trigger kernel device uevents to replay missing events at system coldplug. +.SH "OPTIONS" +.TP +\fB\-\-verbose\fR +print out the devices found in sysfs. +.TP +\fB\-\-dry\-run\fR +don't actually trigger the event. +.SH "ENVIRONMENT" +.TP +\fBUDEV_LOG\fR +Overrides the syslog priority specified in the config file. +.SH "AUTHOR" +.PP +Written by Kay Sievers + +and Hannes Reinecke +. +.SH "SEE ALSO" +.PP +\fBudev\fR(8) diff --git a/udevtrigger.c b/udevtrigger.c new file mode 100644 index 0000000000..bc8453a82a --- /dev/null +++ b/udevtrigger.c @@ -0,0 +1,354 @@ +/* + * udevtrigger.c + * + * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2006 Hannes Reinecke + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static const char *udev_log_str; +static int verbose; +static int dry_run; + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + + if (priority > udev_log_priority) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +/* list of devices that we should run last due to any one of a number of reasons */ +static char *last_list[] = { + "/class/block/md", + "/class/block/dm-", + "/block/md", + "/block/dm-", + NULL +}; + +/* list of devices that we should run first due to any one of a number of reasons */ +static char *first_list[] = { + "/class/mem", + "/class/tty", + NULL +}; + +LIST_HEAD(device_first_list); +LIST_HEAD(device_default_list); +LIST_HEAD(device_last_list); + +static int device_list_insert(const char *path) +{ + struct list_head *device_list = &device_default_list; + int i; + + for (i = 0; first_list[i] != NULL; i++) { + if (strncmp(path, first_list[i], strlen(first_list[i])) == 0) { + device_list = &device_first_list; + break; + } + } + for (i = 0; last_list[i] != NULL; i++) { + if (strncmp(path, last_list[i], strlen(last_list[i])) == 0) { + device_list = &device_last_list; + break; + } + } + + dbg("add '%s'" , path); + /* double entries will be ignored */ + name_list_add(device_list, path, 0); + return 0; +} + +static void trigger_uevent(const char *path) +{ + char filename[PATH_SIZE]; + int fd; + + strlcpy(filename, path, sizeof(filename)); + strlcat(filename, "/uevent", sizeof(filename)); + + if (verbose) + printf("%s\n", path); + + if (dry_run) + return; + + fd = open(filename, O_WRONLY); + if (fd < 0) { + dbg("error on opening %s: %s\n", filename, strerror(errno)); + return; + } + + if (write(fd, "add", 3) < 0) + info("error on triggering %s: %s\n", filename, strerror(errno)); + + close(fd); +} + +static void exec_lists(void) +{ + struct name_entry *loop_device; + struct name_entry *tmp_device; + + /* handle the devices on the "first" list first */ + list_for_each_entry_safe(loop_device, tmp_device, &device_first_list, node) { + trigger_uevent(loop_device->name); + list_del(&loop_device->node); + free(loop_device); + } + + /* handle the devices on the "default" list next */ + list_for_each_entry_safe(loop_device, tmp_device, &device_default_list, node) { + trigger_uevent(loop_device->name); + list_del(&loop_device->node); + free(loop_device); + } + + /* handle devices on the "last" list, if any */ + list_for_each_entry_safe(loop_device, tmp_device, &device_last_list, node) { + trigger_uevent(loop_device->name); + list_del(&loop_device->node); + free(loop_device); + } +} + +static int is_device(const char *path) +{ + char filename[PATH_SIZE]; + struct stat statbuf; + + /* look for the uevent file of the kobject */ + strlcpy(filename, path, sizeof(filename)); + strlcat(filename, "/uevent", sizeof(filename)); + if (stat(filename, &statbuf) < 0) + return 0; + + if (!(statbuf.st_mode & S_IWUSR)) + return 0; + + return 1; +} + +static void udev_scan_bus(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/bus", sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[PATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + strlcpy(dirname, base, sizeof(dirname)); + strlcat(dirname, "/", sizeof(dirname)); + strlcat(dirname, dent->d_name, sizeof(dirname)); + strlcat(dirname, "/devices", sizeof(dirname)); + + /* look for devices */ + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[PATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + + if (is_device(dirname2)) + device_list_insert(dirname2); + } + closedir(dir2); + } + } + closedir(dir); + } +} + +static void udev_scan_block(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + struct stat statbuf; + + /* skip if "block" is already a "class" */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/class/block", sizeof(base)); + if (stat(base, &statbuf) == 0) + return; + + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/block", sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[PATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + strlcpy(dirname, base, sizeof(dirname)); + strlcat(dirname, "/", sizeof(dirname)); + strlcat(dirname, dent->d_name, sizeof(dirname)); + if (is_device(dirname)) + device_list_insert(dirname); + else + continue; + + /* look for partitions */ + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[PATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + if (!strcmp(dent2->d_name,"device")) + continue; + + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (is_device(dirname2)) + device_list_insert(dirname2); + } + closedir(dir2); + } + } + closedir(dir); + } +} + +static void udev_scan_class(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/class", sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[PATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + strlcpy(dirname, base, sizeof(dirname)); + strlcat(dirname, "/", sizeof(dirname)); + strlcat(dirname, dent->d_name, sizeof(dirname)); + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[PATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + if (!strcmp(dent2->d_name, "device")) + continue; + + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (is_device(dirname2)) + device_list_insert(dirname2); + } + closedir(dir2); + } + } + closedir(dir); + } +} + +int main(int argc, char *argv[], char *envp[]) +{ + int i; + + logging_init("udevtrigger"); + udev_config_init(); + dbg("version %s", UDEV_VERSION); + + udev_log_str = getenv("UDEV_LOG"); + + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--verbose") == 0 || strcmp(arg, "-v") == 0) + verbose = 1; + else if (strcmp(arg, "--dry-run") == 0 || strcmp(arg, "-n") == 0) + dry_run = 1; + else { + fprintf(stderr, "Usage: udevtrigger [--verbose] [--dry-run]\n"); + goto exit; + } + } + + sysfs_init(); + + udev_scan_bus(); + udev_scan_class(); + udev_scan_block(); + exec_lists(); + + sysfs_cleanup(); +exit: + logging_close(); + return 0; +} diff --git a/udevtrigger.xml b/udevtrigger.xml new file mode 100644 index 0000000000..da83d56d7a --- /dev/null +++ b/udevtrigger.xml @@ -0,0 +1,90 @@ + + + +
        + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2006 + Kay Sievers + + + +
        + udevtrigger + + + udevtrigger + March 2006 + udev + + + + udevtrigger + 8 + + + + udevtriggerrequest kernel devices events for coldplug + + + + + udevtrigger + + + + + + DESCRIPTION + Trigger kernel device uevents to replay missing events at system coldplug. + + + OPTIONS + + + + + print out the devices found in sysfs. + + + + + + don't actually trigger the event. + + + + + + ENVIRONMENT + + + + + Overrides the syslog priority specified in the config file. + + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org and + Hannes Reinecke hare@suse.de. + + + + SEE ALSO + + udev8 + + + +
        +
        -- cgit v1.2.3-54-g00ecf From 8a37a3915f3431eb1613026a3ed72012d4f3b05d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Mar 2006 01:56:02 +0100 Subject: add ',' to trusted chars SGI needs it for some compatibility device names from irix, xvm volumes use "volname,subvolname" as the default device node. --- udev_utils_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_utils_string.c b/udev_utils_string.c index 36ef8bef7e..5aebfed523 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -241,7 +241,7 @@ int replace_untrusted_chars(char *str) if ((str[i] >= '0' && str[i] <= '9') || (str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z') || - strchr(" #$%+-./:=?@_", str[i])) { + strchr(" #$%+-./:=?@_,", str[i])) { i++; continue; } -- cgit v1.2.3-54-g00ecf From 0eb9e4a87eb5911d84f2feab18f8795a15e9e369 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Mar 2006 16:02:07 +0100 Subject: volume_id: remove partition table parsing code --- extras/volume_id/README | 28 ++--- extras/volume_id/libvolume_id/Makefile | 2 - extras/volume_id/libvolume_id/mac.c | 133 -------------------- extras/volume_id/libvolume_id/msdos.c | 203 ------------------------------ extras/volume_id/libvolume_id/volume_id.h | 6 +- 5 files changed, 14 insertions(+), 358 deletions(-) delete mode 100644 extras/volume_id/libvolume_id/mac.c delete mode 100644 extras/volume_id/libvolume_id/msdos.c diff --git a/extras/volume_id/README b/extras/volume_id/README index 974a5016d9..640a9e47ac 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -36,6 +36,7 @@ sysv * * - * luks * - * - hpfs * - - - romfs * +squashfs * minix * highpoint * isw_raid * @@ -44,29 +45,26 @@ nvidia_raid * promise_raid * silicon_raid * via_raid * -mac partitons * -msdos partitions * -The following rule will create a symlink named with the label string: - KERNEL=="[hs]d*", PROGRAM=="/sbin/vol_id -l %N", SYMLINK+="%c" - If no label is found vol_id exits with nonzero and the rule will be ignored. To give it a try, you may call it on the commandline: - [root@pim udev.kay]# extras/volume_id/vol_id /dev/hda3 - T:ext3 - L:Music Store - N:Music_Store - U:d2da42b5-bbd9-44eb-a72c-cc4542fcb71e + $ extras/volume_id/vol_id --export /dev/sda6 + ID_FS_USAGE=filesystem + ID_FS_TYPE=ext3 + ID_FS_VERSION=1.0 + ID_FS_UUID=3e999973-00c9-4917-9442-b7633bd95b9e + ID_FS_LABEL=devel + ID_FS_LABEL_SAFE=devel - [root@pim udev.kay]# extras/volume_id/vol_id -l /dev/hda3 - Music_Store + $ extras/volume_id/vol_id -l /dev/sda6 + devel - [root@pim udev.kay]# extras/volume_id/vol_id -t /dev/hda3 - swap + $ extras/volume_id/vol_id -t /dev/sda6 + ext3 Any comment/questions/concerns to me: -Kay Sievers + Kay Sievers diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile index 2a86e931a4..a5f9c1a825 100644 --- a/extras/volume_id/libvolume_id/Makefile +++ b/extras/volume_id/libvolume_id/Makefile @@ -23,8 +23,6 @@ OBJS= \ linux_raid.o \ linux_swap.o \ lvm.o \ - mac.o \ - msdos.o \ ntfs.o \ reiserfs.o \ udf.o \ diff --git a/extras/volume_id/libvolume_id/mac.c b/extras/volume_id/libvolume_id/mac.c deleted file mode 100644 index 78ef9fc803..0000000000 --- a/extras/volume_id/libvolume_id/mac.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" - -struct mac_driver_desc { - uint8_t signature[2]; - uint16_t block_size; - uint32_t block_count; -} PACKED; - -struct mac_partition { - uint8_t signature[2]; - uint16_t res1; - uint32_t map_count; - uint32_t start_block; - uint32_t block_count; - uint8_t name[32]; - uint8_t type[32]; -} PACKED; - -int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct mac_driver_desc *driver; - struct mac_partition *part; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if ((memcmp(part->signature, "PM", 2) == 0) && - (memcmp(part->type, "Apple_partition_map", 19) == 0)) { - /* linux creates an own subdevice for the map - * just return the type if the drive header is missing */ - volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); - id->type = "mac_partition_map"; - return 0; - } - - driver = (struct mac_driver_desc *) buf; - if (memcmp(driver->signature, "ER", 2) == 0) { - /* we are on a main device, like a CD - * just try to probe the first partition from the map */ - unsigned int bsize = be16_to_cpu(driver->block_size); - int part_count; - int i; - - /* get first entry of partition table */ - buf = volume_id_get_buffer(id, off + bsize, 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if (memcmp(part->signature, "PM", 2) != 0) - return -1; - - part_count = be32_to_cpu(part->map_count); - dbg("expecting %d partition entries", part_count); - if (part_count < 1 || part_count > 256) - return -1; - - if (id->partitions != NULL) - free(id->partitions); - id->partitions = malloc(part_count * sizeof(struct volume_id_partition)); - if (id->partitions == NULL) - return -1; - memset(id->partitions, 0x00, part_count * sizeof(struct volume_id_partition)); - - id->partition_count = part_count; - - for (i = 0; i < part_count; i++) { - uint64_t poff; - uint64_t plen; - - buf = volume_id_get_buffer(id, off + ((i+1) * bsize), 0x200); - if (buf == NULL) - return -1; - - part = (struct mac_partition *) buf; - if (memcmp(part->signature, "PM", 2) != 0) - return -1; - - poff = be32_to_cpu(part->start_block) * bsize; - plen = be32_to_cpu(part->block_count) * bsize; - dbg("found '%s' partition entry at 0x%llx, len 0x%llx", - part->type, (unsigned long long) poff, (unsigned long long) plen); - - id->partitions[i].off = poff; - id->partitions[i].len = plen; - - if (memcmp(part->type, "Apple_Free", 10) == 0) { - volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNUSED); - } else if (memcmp(part->type, "Apple_partition_map", 19) == 0) { - volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_PARTITIONTABLE); - } else { - volume_id_set_usage_part(&id->partitions[i], VOLUME_ID_UNPROBED); - } - } - volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); - id->type = "mac_partition_map"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/libvolume_id/msdos.c b/extras/volume_id/libvolume_id/msdos.c deleted file mode 100644 index ca3801a8db..0000000000 --- a/extras/volume_id/libvolume_id/msdos.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "volume_id.h" -#include "logging.h" -#include "util.h" - -struct msdos_partition_entry { - uint8_t boot_ind; - uint8_t head; - uint8_t sector; - uint8_t cyl; - uint8_t sys_ind; - uint8_t end_head; - uint8_t end_sector; - uint8_t end_cyl; - uint32_t start_sect; - uint32_t nr_sects; -} PACKED; - -#define MSDOS_MAGIC "\x55\xaa" -#define MSDOS_PARTTABLE_OFFSET 0x1be -#define MSDOS_SIG_OFF 0x1fe -#define BSIZE 0x200 -#define DOS_EXTENDED_PARTITION 0x05 -#define LINUX_EXTENDED_PARTITION 0x85 -#define WIN98_EXTENDED_PARTITION 0x0f -#define LINUX_RAID_PARTITION 0xfd -#define is_extended(type) \ - (type == DOS_EXTENDED_PARTITION || \ - type == WIN98_EXTENDED_PARTITION || \ - type == LINUX_EXTENDED_PARTITION) -#define is_raid(type) \ - (type == LINUX_RAID_PARTITION) - -int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - int i; - uint64_t poff; - uint64_t plen; - uint64_t extended = 0; - uint64_t current; - uint64_t next; - int limit; - int empty = 1; - struct msdos_partition_entry *part; - struct volume_id_partition *p; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) - return -1; - - /* check flags on all entries for a valid partition table */ - part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; - for (i = 0; i < 4; i++) { - if (part[i].boot_ind != 0 && - part[i].boot_ind != 0x80) - return -1; - - if (le32_to_cpu(part[i].nr_sects) != 0) - empty = 0; - } - if (empty == 1) - return -1; - - if (id->partitions != NULL) - free(id->partitions); - id->partitions = malloc(VOLUME_ID_PARTITIONS_MAX * - sizeof(struct volume_id_partition)); - if (id->partitions == NULL) - return -1; - memset(id->partitions, 0x00, - VOLUME_ID_PARTITIONS_MAX * sizeof(struct volume_id_partition)); - - for (i = 0; i < 4; i++) { - poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; - - if (plen == 0) - continue; - - p = &id->partitions[i]; - - p->partition_type_raw = part[i].sys_ind; - - if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", (unsigned long long) poff); - volume_id_set_usage_part(p, VOLUME_ID_PARTITIONTABLE); - p->type = "msdos_extended_partition"; - if (extended == 0) - extended = off + poff; - } else { - dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen); - - if (is_raid(part[i].sys_ind)) - volume_id_set_usage_part(p, VOLUME_ID_RAID); - else - volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); - } - - p->off = off + poff; - p->len = plen; - id->partition_count = i+1; - } - - next = extended; - current = extended; - limit = 50; - - /* follow extended partition chain and add data partitions */ - while (next != 0) { - if (limit-- == 0) { - dbg("extended chain limit reached"); - break; - } - - buf = volume_id_get_buffer(id, current, 0x200); - if (buf == NULL) - break; - - part = (struct msdos_partition_entry*) &buf[MSDOS_PARTTABLE_OFFSET]; - - if (memcmp(&buf[MSDOS_SIG_OFF], MSDOS_MAGIC, 2) != 0) - break; - - next = 0; - - for (i = 0; i < 4; i++) { - poff = (uint64_t) le32_to_cpu(part[i].start_sect) * BSIZE; - plen = (uint64_t) le32_to_cpu(part[i].nr_sects) * BSIZE; - - if (plen == 0) - continue; - - if (is_extended(part[i].sys_ind)) { - dbg("found extended partition at 0x%llx", (unsigned long long) poff); - if (next == 0) - next = extended + poff; - } else { - dbg("found 0x%x data partition at 0x%llx, len 0x%llx", - part[i].sys_ind, (unsigned long long) poff, (unsigned long long) plen); - - /* we always start at the 5th entry */ - while (id->partition_count < 4) - volume_id_set_usage_part(&id->partitions[id->partition_count++], VOLUME_ID_UNUSED); - - p = &id->partitions[id->partition_count]; - - if (is_raid(part[i].sys_ind)) - volume_id_set_usage_part(p, VOLUME_ID_RAID); - else - volume_id_set_usage_part(p, VOLUME_ID_UNPROBED); - - p->off = current + poff; - p->len = plen; - id->partition_count++; - - p->partition_type_raw = part[i].sys_ind; - - if (id->partition_count >= VOLUME_ID_PARTITIONS_MAX) { - dbg("too many partitions"); - next = 0; - } - } - } - - current = next; - } - - volume_id_set_usage(id, VOLUME_ID_PARTITIONTABLE); - id->type = "msdos_partition_table"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index 15f1ac01f8..d370bae6c8 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -14,7 +14,7 @@ #include #include -#define VOLUME_ID_VERSION 59 +#define VOLUME_ID_VERSION 60 #ifndef PACKED #define PACKED __attribute__((packed)) @@ -117,8 +117,4 @@ extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); -/* partition tables */ -extern int volume_id_probe_msdos_part_table(struct volume_id *id, uint64_t off); -extern int volume_id_probe_mac_partition_map(struct volume_id *id, uint64_t off); - #endif -- cgit v1.2.3-54-g00ecf From 10a9bff1c3038468a2aec0c2e9c701f0125c5685 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 21 Mar 2006 16:10:18 +0100 Subject: persistent links: add scsi tape links and usb path support --- etc/udev/60-persistent-disk.rules | 49 ------ etc/udev/60-persistent-storage.rules | 51 ++++++ extras/path_id | 313 ++++++++++++++++++----------------- 3 files changed, 212 insertions(+), 201 deletions(-) delete mode 100644 etc/udev/60-persistent-disk.rules create mode 100644 etc/udev/60-persistent-storage.rules diff --git a/etc/udev/60-persistent-disk.rules b/etc/udev/60-persistent-disk.rules deleted file mode 100644 index 679e1ef988..0000000000 --- a/etc/udev/60-persistent-disk.rules +++ /dev/null @@ -1,49 +0,0 @@ -# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_disk_end" -SUBSYSTEM!="block", GOTO="persistent_disk_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_disk_end" - -# never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_disk_end" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_disk_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="persistent_disk_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_disk_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" - -LABEL="persistent_disk_end" diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules new file mode 100644 index 0000000000..6ab396b070 --- /dev/null +++ b/etc/udev/60-persistent-storage.rules @@ -0,0 +1,51 @@ +# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_disk_end" +SUBSYSTEM!="block", GOTO="persistent_disk_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_disk_end" + +# never access removable ide devices, the drivers are causing event loops on open() +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_disk_end" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_disk_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="sr*|st*", GOTO="persistent_disk_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_disk_end" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" + +LABEL="persistent_disk_end" diff --git a/extras/path_id b/extras/path_id index 324fe825b6..c17fc3cdf0 100644 --- a/extras/path_id +++ b/extras/path_id @@ -104,7 +104,7 @@ case "$DEVPATH" in ;; esac -get_port () { +get_port_offset () { local type offset port type=$1 offset=$2 @@ -113,9 +113,28 @@ get_port () { port="${i#$type}" if [ "$port" -lt "$offset" ] ; then offset=$port ; fi done - if [ "$port" != "0" ] ; then - echo $(($2 - $offset)) - fi + echo $offset +} + +handle_pci () { + local DEV=$1 + cd -P $1 + DEV=${PWD} + pci_id=${DEV##*/} + + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */pci[0-9]*) + host_dev_path=${host_dev_path%/*} + ;; + *) break;; + esac + done + + d="pci-$pci_id-$d" + D="$host_dev_path" + RESULT=0 } handle_block_ide () { @@ -124,42 +143,15 @@ handle_block_ide () { local port idedev idecontroller # IDE : DEV $DEV - d=$DEV - case "$DEV" in - # remove ide-scsi part, leave only channel info - */ide[0-9]*/host[0-9]*) - while [ ! -z "$d" ] ; do - case "$d" in - */host[0-9]*) - d="${d%/*}" - continue - ;; - *) - break - ;; - esac - done - ;; - esac - idedev=$d - while [ ! -z "$d" ] ; do - case "$d" in - */ide[0-9]*) - port="${d##*/}" - d="${d%/*}" - continue - ;; - *) - break - ;; - esac - done - idecontroller=$d + + port=${DEV##*/} + idedev=${DEV%/*} + idecontroller=${idedev%/*} # port info if the controller has more than one interface port="${port#ide}" : port $port d $d : idedev $idedev kernel_port $port - case "${idedev##*.}" in + case "${port#*.}" in 0) channel=0 ;; @@ -169,85 +161,82 @@ handle_block_ide () { *) echo "Error: $idedev is neither master or slave" >&2 esac - case "$d" in - *:mac-io/*) - : mac-io: $d - d="`echo $d | sed -e 's@^.*:mac-io[^:]\+:\([^/]\+\).*@mac-io_\1@'`" - ;; - /sys/devices) - # PCMCIA devices - ifname=${full_sysfs_path##*/} - set -- `sed -n "/$ifname/p" /var/lib/pcmcia/stab` - d="pcmcia-$1" - ;; - *) - d="pci-${d##*/}" - # d="`echo $d | sed -e 's@^.*/\([^/]\{1,\}\)/.@pci-\1@'`" - ;; - esac cd $idecontroller - port="`get_port ide $port`" + offset="`get_port_offset ide ${port%.*}`" cd "$OPWD" - : hardware_port $port - if [ -z "$port" ] ; then - d="${d}-ide-0:$channel" + : port offset $offset + port=$((${port%.*} - $offset)) + if [ "$d" ] ; then + d="ide-${port}:$channel-$d" else - d="${d}-ide-${port}:$channel" + d="ide-${port}:$channel" fi + D=$idecontroller RESULT=0 } handle_block_scsi () { -: handle_block_scsi $* + : handle_block_scsi $* local DEV=$1 local cil controller_port controller_dev # SCSI device cil="${DEV##*/}" cil="${cil#*:}" - controller_dev=$DEV - while [ ! -z "$controller_dev" ] ; do - case "$controller_dev" in - */host[0-9]*) - controller_port=$controller_dev - controller_dev="${controller_dev%/*}" - ;; - *) break ;; - esac + target_dev=${DEV%/*} + target_id=${target_dev##*/target} + cd "$target_dev" + target_num=0 + for tid in ${target_id}* ; do + target_num=$(( $target_num + 1 )) done + + controller_port=${target_dev%/*} + controller_dev="${controller_port%/*}" + : controller_dev $controller_dev : controller_port $controller_port # a host controller may have more than one interface/port - controller_port="${controller_port##*/}" - controller_port="${controller_port##host}" + controller_port="${controller_port##*/host}" # - case "$controller_dev" in - # grand central, old powermacs - *:gc/*) - adapter="`echo $controller_dev | sed -e 's@/[^/]\{1,\}$@@;s@^.*/@@;s@^.*:@@'`" - bus="gc" - ;; - # PARISC devices - *parisc*) - adapter="${controller_dev##*/}" - bus=parisc; - ;; - *) - adapter="${controller_dev##*/}" - bus="pci" - ;; - esac cd "$controller_dev" - controller_port="`get_port host $controller_port`" + controller_offset=$(get_port_offset host $controller_port) cd "$OPWD" - d="$bus-$adapter" - if [ -z "$controller_port" ] ; then - controller_port=0 + controller_port=$(( $controller_port - $controller_offset)) + scsi_id="scsi-${controller_port}:${cil}" + + if [ "$d" ] ; then + d="${scsi_id}-$d" + else + d="$scsi_id" fi - d="${d}-scsi-${controller_port}:${cil}" + + D="$controller_dev" RESULT=0 } +handle_block_firewire () { + :handle_block_firewire $* + local DEV=$1 + + if [ -f "$D/ieee1394_id" ] ; then + read ieee1394_id < $D/ieee1394_id + fi + + if [ -z "$ieee1394_id" ] ; then + : no IEEE1394 ID + RESULT=1 + return + fi + + fw_host_dev=${DEV%/fw-host*} + # IEEE1394 devices are always endpoints + d="ieee1394-0x$ieee1394_id" + D="$fw_host_dev" + + RESULT=0 +} + handle_block_fc () { : handle_block_fc $* local DEV=$1 @@ -278,13 +267,10 @@ handle_block_fc () { lun="0x${tmp_lun3}${tmp_lun2}${tmp_lun1}${tmp_lun0}" fi controller_dev="${fc_tgt_path%/host[0-9]*}" - adapter="${controller_dev##*/}" - bus="pci" - d="$bus-$adapter" - if [ -z "$controller_port" ] ; then - controller_port=0 - fi - d="${d}-fc-${wwpn}:${lun}" + + # FC devices are always endpoints + d="fc-${wwpn}:${lun}" + D="$controller_dev" RESULT=0 } @@ -323,57 +309,46 @@ handle_block_sas () { sas_rphy_address="$rphy_address:$rphy_id" controller_dev="${sas_host_path%/host[0-9]*}" - adapter="${controller_dev##*/}" - bus="pci" - d="$bus-$adapter" - d="${d}-sas-${sas_phy_address}-${sas_rphy_address}" + + # SAS devices are always endpoints + d="sas-${sas_phy_address}-${sas_rphy_address}" + D="$controller_dev" + RESULT=0 } -handle_block_usb_storage () { -: handle_block_usb_storage $* +handle_usb () { +: handle_usb $* local DEV=$1 - cil="${DEV##*/}" - cil="${cil#*:}" - controller_dev=$DEV - while [ ! -z "$controller_dev" ] ; do - case "$controller_dev" in - */host[0-9]*) - controller_dev="${controller_dev%/*}" + cd -P $1 + DEV=${PWD} + port_id=${DEV##*/} + port_num=${port_id#*-} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */usb*) + usb_host_path=$host_dev_path + host_dev_path="${host_dev_path%/*}" ;; *) break ;; esac done - : controller_dev $controller_dev - # - # usb-storage devs have a serial number, hopefully unique - serial= - if [ -f $controller_dev/../serial ] ; then - serial="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789-]@@g' < $controller_dev/../serial`" - : serial XXX_${serial}_XXX - d="usb-$serial" - serial="`echo $serial | sed -e 's@[ 0]\{1,\}@@g'`" - fi - if [ -z "$serial" ] ; then - # no serial, broken device - # has eventually binary junk in vpd - identifier= - if [ -f $controller_dev/../product ] ; then - product="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789-]@@g' < $controller_dev/../product`" - fi - if [ -f $controller_dev/../manufacturer ] ; then - manufacturer="`sed -e 's@^[ -]\{1,\}\|[ -]\{1,\}$@@g;s@[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789-]@@g' < $controller_dev/../manufacturer`" - fi - if [ -z "$product" -o -z "$manufacturer" ] ; then - read idvendor < $controller_dev/../idVendor - read idproduct < $controller_dev/../idProduct - identifier="0x${idvendor}-0x${idproduct}" - else - identifier="${manufacturer}-${product}" - fi - d="usb-${identifier}" + : host_dev_path $host_dev_path + usb_host_num=${usb_host_path##*/usb} + + cd "$host_dev_path" + usb_host_offset=$(get_port_offset usb $usb_host_num) + usb_host_port=$(($usb_host_num - $usb_host_offset)) + cd "$OPWD" + + if [ "$d" ] ; then + d="usb-$usb_host_port:$port_num-${d}" + else + d="usb-$usb_host_port:$port_num" fi - d="$d:$cil" + + D="$host_dev_path" RESULT=0 } @@ -406,13 +381,11 @@ handle_block () { full_sysfs_device_path="`pwd -P`" cd "$OPWD" D=$full_sysfs_device_path + while [ ! -z "$D" ] ; do case "$D" in */ide[0-9]/[0-9].[0-9]*|*/ide[0-9][0-9]/[0-9][0-9].[0-9]*) handle_block_ide "$D" ;; - */usb[0-9]*/[0-9]*/host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) - handle_block_usb_storage "$D" - ;; */css0/*) if [ -r $full_sysfs_device_path/wwpn ]; then read wwpn < $full_sysfs_device_path/wwpn @@ -434,6 +407,7 @@ handle_block () { d="$bus-$adapter" RESULT=0 fi + D= ;; */rport-[0-9]*:[0-9]*-[0-9]*/*) handle_block_fc "$D" @@ -441,15 +415,20 @@ handle_block () { */phy-[0-9]*:[0-9]*/*) handle_block_sas "$D" ;; + */fw-host[0-9]*/*) + handle_block_firewire "$D" + ;; */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) - # check for ieee1394 sbp2 - if test -f $D/ieee1394_id ; then - read ieee1394_id < $D/ieee1394_id - d="`echo ieee1394-${ieee1394_id} | sed -e 's@:@-@g'`" - RESULT=0 - else - handle_block_scsi "$D" - fi + handle_block_scsi "$D" + ;; + */usb[0-9]*/[0-9]*/*) + handle_usb "$D" + ;; + */pci[0-9]*:[0-9]*) + handle_pci "$D" + ;; + */devices) + D= ;; *) : not handled @@ -457,14 +436,44 @@ handle_block () { return ;; esac + done + + if [ "$TYPE" == "scsi_tape" ] ; then + devname=${full_sysfs_path##*/} + rewind="${devname%%st*}" + mode="${devname##*st}" + case "$mode" in + *l) + mode="l" + ;; + *m) + mode="m" + ;; + *a) + mode="a" + ;; + *) + mode="" + ;; + esac + if [ "$d" ]; then + d="$d-${rewind}st${mode}" + fi + fi echo "ID_PATH=$d" } case "$TYPE" in - block) + block) handle_block ;; - *) + scsi_tape) + handle_block + ;; + input) + handle_usb $SYSFS$DEVPATH/device + ;; + *) RESULT=1 ;; esac -- cgit v1.2.3-54-g00ecf From 7808297b0fcb5a8033fd2d55854d065d8b1719e8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Mar 2006 16:16:55 +0100 Subject: volume_id: remove all partition table support --- extras/volume_id/README | 8 ++++---- extras/volume_id/libvolume_id/util.c | 8 -------- extras/volume_id/libvolume_id/util.h | 1 - extras/volume_id/libvolume_id/volume_id.c | 5 +---- extras/volume_id/libvolume_id/volume_id.h | 15 +-------------- extras/volume_id/vol_id.8 | 6 +++--- 6 files changed, 9 insertions(+), 34 deletions(-) diff --git a/extras/volume_id/README b/extras/volume_id/README index 640a9e47ac..969f301a4c 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -1,15 +1,15 @@ -vol_id - partition, filesystem, disklabel reader +vol_id - volume, filesystem, disklabel reader This program is normally called from a udev rule, to provide udev with the -name, uuid or the filesystem type of a partition to name a device node. +name, uuid or the filesystem type of a volume to name a device node. vol_id opens the blockdevice node specified at the commandline. The following commandline switches are supported to specify what vol_id should print: --export prints all values -h prints help text - -l prints the label of the partition - -u prints the uuid of the partition + -l prints the label of the volume + -u prints the uuid of the volume vol_id will only return successful if the string asked for, is not empty. All trailing whitespace will be removed, spaces replaced by underscore diff --git a/extras/volume_id/libvolume_id/util.c b/extras/volume_id/libvolume_id/util.c index 361d7058d0..0ad8ce66b2 100644 --- a/extras/volume_id/libvolume_id/util.c +++ b/extras/volume_id/libvolume_id/util.c @@ -68,8 +68,6 @@ static char *usage_to_string(enum volume_id_usage usage_id) switch (usage_id) { case VOLUME_ID_FILESYSTEM: return "filesystem"; - case VOLUME_ID_PARTITIONTABLE: - return "partitiontable"; case VOLUME_ID_OTHER: return "other"; case VOLUME_ID_RAID: @@ -86,12 +84,6 @@ static char *usage_to_string(enum volume_id_usage usage_id) return NULL; } -void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id) -{ - part->usage_id = usage_id; - part->usage = usage_to_string(usage_id); -} - void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) { id->usage_id = usage_id; diff --git a/extras/volume_id/libvolume_id/util.h b/extras/volume_id/libvolume_id/util.h index f6c57fb66d..8cb1abd360 100644 --- a/extras/volume_id/libvolume_id/util.h +++ b/extras/volume_id/libvolume_id/util.h @@ -64,7 +64,6 @@ enum endian { extern void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); -extern void volume_id_set_usage_part(struct volume_id_partition *part, enum volume_id_usage usage_id); extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c index fdecf396c4..718d74e5b6 100644 --- a/extras/volume_id/libvolume_id/volume_id.c +++ b/extras/volume_id/libvolume_id/volume_id.c @@ -1,5 +1,5 @@ /* - * volume_id - reads filesystem label and uuid + * volume_id - reads volume label and uuid * * Copyright (C) 2005 Kay Sievers * @@ -221,8 +221,5 @@ void volume_id_close(struct volume_id *id) volume_id_free_buffer(id); - if (id->partitions != NULL) - free(id->partitions); - free(id); } diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h index d370bae6c8..8ddffc96de 100644 --- a/extras/volume_id/libvolume_id/volume_id.h +++ b/extras/volume_id/libvolume_id/volume_id.h @@ -1,5 +1,5 @@ /* - * volume_id - reads partition label and uuid + * volume_id - reads volume label and uuid * * Copyright (C) 2005 Kay Sievers * @@ -31,21 +31,11 @@ enum volume_id_usage { VOLUME_ID_UNPROBED, VOLUME_ID_OTHER, VOLUME_ID_FILESYSTEM, - VOLUME_ID_PARTITIONTABLE, VOLUME_ID_RAID, VOLUME_ID_DISKLABEL, VOLUME_ID_CRYPTO, }; -struct volume_id_partition { - enum volume_id_usage usage_id; - char *usage; - char *type; - uint64_t off; - uint64_t len; - uint8_t partition_type_raw; -}; - struct volume_id { uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; size_t label_raw_len; @@ -58,9 +48,6 @@ struct volume_id { char *type; char type_version[VOLUME_ID_FORMAT_SIZE]; - struct volume_id_partition *partitions; - size_t partition_count; - int fd; uint8_t *sbbuf; size_t sbbuf_len; diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index 6ffe7ce220..092911ad4c 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -21,13 +21,13 @@ should print: print all values in key/value format to import them into the environment. .TP .BI -l -print the label of the partition +print the label of the volume .TP .BI -t -print the type of the partition +print the type of the volume .TP .BI -u -print the uuid of the partition +print the uuid of the volume .RE .SH EXIT STATUS .B vol_id -- cgit v1.2.3-54-g00ecf From bf289c06bff4e7780b044673fd66a17e510de43e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Mar 2006 16:17:28 +0100 Subject: fix spelling error in debug string --- .gitignore | 1 + udev_rules_parse.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c37b70c524..b9adf69fc6 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ ccdv udev udevd udevcontrol +udevtrigger udevsend udevinfo udevmonitor diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 376006c7c4..6bb83ae12b 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -421,7 +421,7 @@ static int add_to_rules(struct udev_rules *rules, char *line) } } if (value[0] == '\0') - dbg("name empty, not creation supressed"); + dbg("name empty, node creation supressed"); add_rule_key(rule, &rule->name, operation, value); continue; } -- cgit v1.2.3-54-g00ecf From ad9deeebfc8a34b95f32968dd0ef6bb292890e74 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Mar 2006 16:20:54 +0100 Subject: rename "persistent disk" to "persistent storage" --- etc/udev/60-persistent-storage.rules | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules index 6ab396b070..9424322d6d 100644 --- a/etc/udev/60-persistent-storage.rules +++ b/etc/udev/60-persistent-storage.rules @@ -1,15 +1,15 @@ -# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} # scheme based on "Linux persistent device names", 2004, Hannes Reinecke -ACTION!="add", GOTO="persistent_disk_end" -SUBSYSTEM!="block", GOTO="persistent_disk_end" +ACTION!="add", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_disk_end" +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_storage_end" # never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_disk_end" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_disk_end" +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_storage_end" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" @@ -31,12 +31,12 @@ KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{I # by-path (shortest physical path) KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" KERNEL=="st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_disk_end" +KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_disk_end" +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="/sbin/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" @@ -48,4 +48,4 @@ KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part% KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" -LABEL="persistent_disk_end" +LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From a05098641e448cbdb7b742826c3a0bc35a8a1c1f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Mar 2006 17:28:47 +0100 Subject: fix output for USB path --- extras/path_id | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/path_id b/extras/path_id index c17fc3cdf0..aecc40cc9b 100644 --- a/extras/path_id +++ b/extras/path_id @@ -460,18 +460,20 @@ handle_block () { d="$d-${rewind}st${mode}" fi fi - echo "ID_PATH=$d" } case "$TYPE" in block) handle_block + echo "ID_PATH=$d" ;; scsi_tape) handle_block + echo "ID_PATH=$d" ;; input) handle_usb $SYSFS$DEVPATH/device + echo "ID_PATH=$d" ;; *) RESULT=1 -- cgit v1.2.3-54-g00ecf From 00152560f9ba3de71144e25c874f9fa2cfa6682b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Mar 2006 19:26:12 +0100 Subject: update SUSE rules --- etc/udev/suse/05-udev-early.rules | 5 --- etc/udev/suse/50-udev-default.rules | 4 +-- etc/udev/suse/60-persistent-disk.rules | 48 ----------------------------- etc/udev/suse/60-persistent-input.rules | 2 +- etc/udev/suse/60-persistent-storage.rules | 51 +++++++++++++++++++++++++++++++ etc/udev/suse/80-sysconfig.rules | 4 --- 6 files changed, 54 insertions(+), 60 deletions(-) delete mode 100644 etc/udev/suse/60-persistent-disk.rules create mode 100644 etc/udev/suse/60-persistent-storage.rules diff --git a/etc/udev/suse/05-udev-early.rules b/etc/udev/suse/05-udev-early.rules index 5818d43335..417ee67d6f 100644 --- a/etc/udev/suse/05-udev-early.rules +++ b/etc/udev/suse/05-udev-early.rules @@ -1,9 +1,4 @@ -# ignore these events until someone needs them -SUBSYSTEM=="drivers", OPTIONS="ignore_device" -SUBSYSTEM=="module", OPTIONS="ignore_device" - # sysfs is populated after the event is sent ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" -ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 838d5b91a7..22000ba3c0 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -81,7 +81,7 @@ KERNEL=="zero", NAME="%k", MODE="666" KERNEL=="full", NAME="%k", MODE="622" KERNEL=="random", NAME="%k", MODE="666" KERNEL=="urandom", NAME="%k", MODE="644" -KERNEL=="rtc", GROUP="audio" +KERNEL=="rtc", MODE="600" KERNEL=="sonypi", MODE="0666" KERNEL=="agpgart", MODE="0600", GROUP="video" KERNEL=="djs*", NAME="%k", MODE="644" @@ -94,7 +94,7 @@ KERNEL=="3270/tub*", NAME="%k", MODE="666" KERNEL=="3270/tubcons*", NAME="%k", MODE="600" KERNEL=="ica", NAME="%k", MODE="666" KERNEL=="z90crypt", NAME="%k", MODE="666" -KERNEL=="mmtimer", NAME="%k", MODE="444" +KERNEL=="mmtimer", NAME="%k", MODE="644" KERNEL=="auer[0-9]*" NAME="usb/%k" # packet writing interface diff --git a/etc/udev/suse/60-persistent-disk.rules b/etc/udev/suse/60-persistent-disk.rules deleted file mode 100644 index bcbd7721ab..0000000000 --- a/etc/udev/suse/60-persistent-disk.rules +++ /dev/null @@ -1,48 +0,0 @@ -# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_disk_end" -SUBSYSTEM!="block", GOTO="persistent_disk_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_disk_end" - -# never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_disk_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="persistent_disk_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_disk_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" - -LABEL="persistent_disk_end" diff --git a/etc/udev/suse/60-persistent-input.rules b/etc/udev/suse/60-persistent-input.rules index 2a74d15482..2f9c5d3cfc 100644 --- a/etc/udev/suse/60-persistent-input.rules +++ b/etc/udev/suse/60-persistent-input.rules @@ -14,7 +14,7 @@ KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", # by-path IMPORT{program}="/sbin/path_id %p" ENV{ID_PATH}=="?*", KERNEL=="mouse*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" -ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" LABEL="persistent_input_end" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules new file mode 100644 index 0000000000..9424322d6d --- /dev/null +++ b/etc/udev/suse/60-persistent-storage.rules @@ -0,0 +1,51 @@ +# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_storage_end" + +# never access removable ide devices, the drivers are causing event loops on open() +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_storage_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="sr*|st*", GOTO="persistent_storage_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" + +LABEL="persistent_storage_end" diff --git a/etc/udev/suse/80-sysconfig.rules b/etc/udev/suse/80-sysconfig.rules index 137754e166..8efb7901a0 100644 --- a/etc/udev/suse/80-sysconfig.rules +++ b/etc/udev/suse/80-sysconfig.rules @@ -1,9 +1,5 @@ ENV{SYSCONFIG}=="no|off|0", GOTO="sysconfig_end" -# SUSE network device handling -SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/ifup $env{INTERFACE} -o hotplug" -SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/ifdown %k -o hotplug" - # SUSE system integration SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-%p -o hotplug" -- cgit v1.2.3-54-g00ecf From 63645a3dfce22e865b96b519fafaa2fcb489f3be Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Mar 2006 20:44:13 +0100 Subject: 088 release --- ChangeLog | 19 +++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 12 ++++++++++++ TODO | 3 +-- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c2d00d149b..8b6bada1be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Summary of changes from v087 to v088 +============================================ + +Hannes Reinecke: + persistent links: add scsi tape links and usb path support + +Kay Sievers: + volume_id: add squashfs detection + reset signal handler in event process + correct use of fcntl() + add udevtrigger to request events for coldplug + add ',' to trusted chars + volume_id: remove partition table parsing code + volume_id: remove all partition table support + fix spelling error in debug string + rename "persistent disk" to "persistent storage" + fix output for USB path + + Summary of changes from v086 to v087 ============================================ diff --git a/Makefile b/Makefile index ddb74175ce..d3341a6c83 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 087 +VERSION = 088 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f8d6fde807..93b4a19f9f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,15 @@ +udev 088 +======== +Add persistent links for SCSI tapes. The rules file is renamed +to 60-persistent-storage.rules. + +Create persistent path for usb devices. Can be used for all sorts +of devices that can't be distinguished by other properties like +multiple identical keyboards and mice connected to the same box. + +Provide "udevtrigger" program to request events on coldplug. The +shell script is much too slow with thousends of devices. + udev 087 ======== Fix persistent disk rules to exclude removable IDE drives. diff --git a/TODO b/TODO index 5047f06da9..14d4e2a036 100644 --- a/TODO +++ b/TODO @@ -10,8 +10,6 @@ udev version: o remove broken %e enumeration (simple enumerations can't work and should go) - o remove devfs naming scheme rules and scripts - o remove MODALIAS + $modalias (ENV{MODALIAS}, $env{MODALIAS}, $sysfs{modalias} will do it) @@ -19,3 +17,4 @@ udev version: (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer want to guess event properties from sysfs like udevstart is doing it) + o remove use of "device" link in path_id -- cgit v1.2.3-54-g00ecf From 24c27caf82ecf3bbe0b8d2ee5184faf03364635c Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Wed, 22 Mar 2006 12:21:49 +0100 Subject: path_id: add bus to USB path --- TODO | 1 - etc/udev/60-persistent-storage.rules | 3 +- extras/path_id | 533 ++++++++++++++++------------------- 3 files changed, 240 insertions(+), 297 deletions(-) mode change 100644 => 100755 extras/path_id diff --git a/TODO b/TODO index 14d4e2a036..1ef9c71f07 100644 --- a/TODO +++ b/TODO @@ -17,4 +17,3 @@ udev version: (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer want to guess event properties from sysfs like udevstart is doing it) - o remove use of "device" link in path_id diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules index 9424322d6d..94643be184 100644 --- a/etc/udev/60-persistent-storage.rules +++ b/etc/udev/60-persistent-storage.rules @@ -29,8 +29,7 @@ KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]|sr*|st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" diff --git a/extras/path_id b/extras/path_id old mode 100644 new mode 100755 index aecc40cc9b..0274be391a --- a/extras/path_id +++ b/extras/path_id @@ -1,9 +1,9 @@ #!/bin/sh -# provide the shortest possible unique hardware path to a block device -# for the udev persistent disk device naming scheme +# provide the shortest possible unique hardware path to a device +# for the Linux Persistent Device Naming scheme # -# Copyright (C) 2005 SUSE Linux Products GmbH +# Copyright (C) 2005-2006 SUSE Linux Products GmbH # Author: # Hannes Reinecke # @@ -12,53 +12,12 @@ # Free Software Foundation version 2 of the License. # # to be called from a udev rule to return the name for a symlink -# DEVPATH=/block/sda/sda3 path_id +# DEVPATH=; path_id # path_id # examples for all block devices on a system: # for i in `find /sys/class/block`; do DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`"; path_id; done -# SCSI cdrom -# /class/block/sr0 -> /devices/pci0002:30/0002:30:0c.0/host0/target0:0:0/0:0:1:0 -# pci-0002:30:0c.0-scsi-0:0:1:0 -# -# SCSI disk -# /class/block/sda -> /devices/pci0002:30/0002:30:0c.0/host0/target0:0:0/0:0:4:0 -# pci-0002:30:0c.0-scsi-0:0:4:0 -# -# SATA disk, 4 channels per controller -# /class/block/sda -> /devices/pci0001:00/0001:00:07.0/0001:05:0c.0/host0/target0:0:0/0:0:0:0 -# pci-0001:05:0c.0-scsi-0:0:0:0 -# -# IDE disk -# /class/block/hda -> /devices/pci0002:02/0002:02:0d.0/ide0/0.0 -# pci-0002:02:0d.0-ide-0.0 -# -# IDE cdrom on a Mac ASIC: -# /class/block/hdc -> /devices/pci0001:01/0001:01:17.0/0.80000000:mac-io/0.00020000:ata-3/ide1/1.0 -# mac-io_ata-3_master -# -# IDE cdrom on a Mac ASIC, with ide-scsi: -# /class/block/sr0 -> /devices/pci0001:01/0001:01:17.0/0.80000000:mac-io/0.0001f000:ata-4/ide0/0.1/host2/target2:0:0/2:0:0:0 -# mac-io_ata-4_slave - -# USB CDrom drive without 'serial' number: -# reusing 'product' and 'manufacturer' string, if available -# /class/block/sr0 -> /devices/pci0001:00/0001:00:04.0/0001:02:0b.0/usb4/4-2/4-2:1.0/host4/4:0:0:0 -# usb-storage-odd-Freecom-USIDERev930:0:0:0 - -# devices may have several interfaces on one PCI device, like IDE: -# pci-0001:00:04.0_ide1-master -# pci-0001:00:04.0_ide2-master -# pci-0001:00:04.0_ide2-slave -# they are marked as ports, it is expected that the driver shows -# ide1 even if there is nothing connected to either master or slave -# interface -# -# match order is important. -# first IDE to find ide-scsi devices, then SCSI -# first usb-storage, then firewire sbp2, then the rest - SYSFS=/sys RESULT=1 TYPE= @@ -67,83 +26,82 @@ full_sysfs_path= full_sysfs_device_path= if [ -z "$DEVPATH" -a -z "$1" ] ; then - exit 1 + exit 1 fi if [ -z "$DEVPATH" ] ; then - case "$1" in - $SYSFS/*) - DEVPATH="${1#$SYSFS}" - ;; - *) - DEVPATH=$1 - ;; - esac + case "$1" in + $SYSFS/*) + DEVPATH="${1#$SYSFS}" + ;; + *) + DEVPATH=$1 + ;; + esac fi if [ ! -e $SYSFS$DEVPATH/dev ] ; then - exit 1 + exit 1 fi case "$DEVPATH" in - /devices/*) - cd "$SYSFS$DEVPATH/subsystem"; - TYPE="`pwd -P`" - cd "$OPWD" - TYPE="${TYPE##*/}" - ;; - /class/*) - TYPE="${DEVPATH#/class/}" - TYPE="${TYPE%%/*}" - ;; - /block/*) - TYPE=block - ;; - *) - exit 1 - ;; + /devices/*) + cd "$SYSFS$DEVPATH/subsystem"; + TYPE="`pwd -P`" + cd "$OPWD" + TYPE="${TYPE##*/}" + ;; + /class/*) + TYPE="${DEVPATH#/class/}" + TYPE="${TYPE%%/*}" + ;; + /block/*) + TYPE=block + ;; + *) + exit 1 + ;; esac get_port_offset () { - local type offset port - type=$1 - offset=$2 - for i in $type[0-9]* ; do - : i $i - port="${i#$type}" - if [ "$port" -lt "$offset" ] ; then offset=$port ; fi - done - echo $offset + local type offset port + type=$1 + offset=$2 + for i in $type[0-9]* ; do + : i $i + port="${i#$type}" + if [ "$port" -lt "$offset" ] ; then offset=$port ; fi + done + echo $offset } handle_pci () { - local DEV=$1 - cd -P $1 - DEV=${PWD} - pci_id=${DEV##*/} - - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */pci[0-9]*) - host_dev_path=${host_dev_path%/*} - ;; - *) break;; - esac - done - - d="pci-$pci_id-$d" - D="$host_dev_path" - RESULT=0 + local DEV=$1 + cd -P $1 + DEV=${PWD} + pci_id=${DEV##*/} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */pci[0-9]*) + host_dev_path=${host_dev_path%/*} + ;; + *) + break + ;; + esac + done + d="pci-$pci_id-$d" + D="$host_dev_path" + RESULT=0 } -handle_block_ide () { -: handle_block_ide $* +handle_ide () { + : handle_ide $* local DEV=$1 local port idedev idecontroller # IDE : DEV $DEV - port=${DEV##*/} idedev=${DEV%/*} idecontroller=${idedev%/*} @@ -152,32 +110,32 @@ handle_block_ide () { : port $port d $d : idedev $idedev kernel_port $port case "${port#*.}" in - 0) - channel=0 - ;; - 1) - channel=1 - ;; - *) - echo "Error: $idedev is neither master or slave" >&2 + 0) + channel=0 + ;; + 1) + channel=1 + ;; + *) + echo "Error: $idedev is neither master or slave" >&2 + ;; esac - cd $idecontroller offset="`get_port_offset ide ${port%.*}`" cd "$OPWD" : port offset $offset port=$((${port%.*} - $offset)) if [ "$d" ] ; then - d="ide-${port}:$channel-$d" + d="ide-${port}:$channel-$d" else - d="ide-${port}:$channel" + d="ide-${port}:$channel" fi D=$idecontroller RESULT=0 } -handle_block_scsi () { - : handle_block_scsi $* +handle_scsi () { + : handle_scsi $* local DEV=$1 local cil controller_port controller_dev # SCSI device @@ -188,12 +146,10 @@ handle_block_scsi () { cd "$target_dev" target_num=0 for tid in ${target_id}* ; do - target_num=$(( $target_num + 1 )) + target_num=$(( $target_num + 1 )) done - controller_port=${target_dev%/*} controller_dev="${controller_port%/*}" - : controller_dev $controller_dev : controller_port $controller_port # a host controller may have more than one interface/port @@ -204,41 +160,35 @@ handle_block_scsi () { cd "$OPWD" controller_port=$(( $controller_port - $controller_offset)) scsi_id="scsi-${controller_port}:${cil}" - if [ "$d" ] ; then - d="${scsi_id}-$d" + d="${scsi_id}-$d" else - d="$scsi_id" + d="$scsi_id" fi - D="$controller_dev" RESULT=0 } -handle_block_firewire () { - :handle_block_firewire $* - local DEV=$1 - - if [ -f "$D/ieee1394_id" ] ; then - read ieee1394_id < $D/ieee1394_id - fi - - if [ -z "$ieee1394_id" ] ; then - : no IEEE1394 ID - RESULT=1 - return - fi - - fw_host_dev=${DEV%/fw-host*} - # IEEE1394 devices are always endpoints - d="ieee1394-0x$ieee1394_id" - D="$fw_host_dev" - - RESULT=0 +handle_firewire () { + :handle_firewire $* + local DEV=$1 + if [ -f "$D/ieee1394_id" ] ; then + read ieee1394_id < $D/ieee1394_id + fi + if [ -z "$ieee1394_id" ] ; then + : no IEEE1394 ID + RESULT=1 + return + fi + fw_host_dev=${DEV%/fw-host*} + # IEEE1394 devices are always endpoints + d="ieee1394-0x$ieee1394_id" + D="$fw_host_dev" + RESULT=0 } -handle_block_fc () { -: handle_block_fc $* +handle_fc () { + : handle_fc $* local DEV=$1 local cil controller_port controller_dev # SCSI-FC device @@ -248,34 +198,32 @@ handle_block_fc () { fc_tgt_num="${fc_tgt_path##*/}" fc_tgt_dev="${fc_tgt_path}/fc_transport:${fc_tgt_num}" if [ -e "$fc_tgt_dev/port_name" ]; then - read wwpn < $fc_tgt_dev/port_name + read wwpn < $fc_tgt_dev/port_name fi if [ -z "$wwpn" ] ; then - : no WWPN - RESULT=1 - return + : no WWPN + RESULT=1 + return fi # Linux currently knows about 32bit luns tmp_lun3=$(printf "%04x" $(($fc_tgt_lun & 0xFFFF))) tmp_lun2=$(printf "%04x" $(( ($fc_tgt_lun >> 16) & 0xFFFF))) tmp_lun1="0000" tmp_lun0="0000" - if (($fc_tgt_lun == 0)) ; then - lun="0x0000000000000000" + lun="0x0000000000000000" else - lun="0x${tmp_lun3}${tmp_lun2}${tmp_lun1}${tmp_lun0}" + lun="0x${tmp_lun3}${tmp_lun2}${tmp_lun1}${tmp_lun0}" fi controller_dev="${fc_tgt_path%/host[0-9]*}" - # FC devices are always endpoints d="fc-${wwpn}:${lun}" D="$controller_dev" RESULT=0 } -handle_block_sas () { - : handle_block_sas $* +handle_sas () { + : handle_sas $* local DEV=$1 local cil adapter controller_dev # SAS device @@ -286,34 +234,31 @@ handle_block_sas () { sas_rphy_id="${sas_phy_path##*/}" sas_phy_dev="${sas_host_path}/${sas_phy_id}/sas_phy:${sas_phy_id}" if [ -e "$sas_phy_dev/sas_address" ]; then - read phy_address < $sas_phy_dev/sas_address - read phy_port < $sas_phy_dev/port_identifier - read phy_id < $sas_phy_dev/phy_identifier + read phy_address < $sas_phy_dev/sas_address + read phy_port < $sas_phy_dev/port_identifier + read phy_id < $sas_phy_dev/phy_identifier fi if [ -z "$phy_address" ] ; then - : no initiator address - RESULT=1 - return + : no initiator address + RESULT=1 + return fi sas_phy_address="$phy_address:$phy_port:$phy_id" sas_rphy_dev="${sas_host_path}/${sas_phy_id}/${sas_rphy_id}/sas_rphy:${sas_rphy_id}" if [ -e "$sas_rphy_dev/sas_address" ]; then - read rphy_address < $sas_rphy_dev/sas_address - read rphy_id < $sas_rphy_dev/phy_identifier + read rphy_address < $sas_rphy_dev/sas_address + read rphy_id < $sas_rphy_dev/phy_identifier fi if [ -z "$rphy_address" ] ; then - : no initiator address - RESULT=1 - return + : no initiator address + RESULT=1 + return fi sas_rphy_address="$rphy_address:$rphy_id" - controller_dev="${sas_host_path%/host[0-9]*}" - # SAS devices are always endpoints d="sas-${sas_phy_address}-${sas_rphy_address}" D="$controller_dev" - RESULT=0 } @@ -328,10 +273,12 @@ handle_usb () { while [ ! -z "$host_dev_path" ] ; do case "$host_dev_path" in */usb*) - usb_host_path=$host_dev_path - host_dev_path="${host_dev_path%/*}" - ;; - *) break ;; + usb_host_path=$host_dev_path + host_dev_path="${host_dev_path%/*}" + ;; + *) + break + ;; esac done : host_dev_path $host_dev_path @@ -341,142 +288,140 @@ handle_usb () { usb_host_offset=$(get_port_offset usb $usb_host_num) usb_host_port=$(($usb_host_num - $usb_host_offset)) cd "$OPWD" - if [ "$d" ] ; then - d="usb-$usb_host_port:$port_num-${d}" + d="usb-$usb_host_port:$port_num-${d}" else - d="usb-$usb_host_port:$port_num" + d="usb-$usb_host_port:$port_num" fi - D="$host_dev_path" RESULT=0 } -handle_block () { - full_sysfs_path="$SYSFS$DEVPATH" - if [ -L $full_sysfs_path/subsystem ]; then - # new sysfs block layout - full_sysfs_path="${full_sysfs_path%/*}" - cd "$full_sysfs_path/subsystem"; - subsys="`pwd -P`" - cd "$OPWD" - subsys="${subsys##*/}" - if [ "$subsys" == "block" ]; then - # parent is "block", it's a partition, move one up - full_sysfs_path="${full_sysfs_path%/*}" - fi - cd $full_sysfs_path - else - # old sysfs block layout - if [ ! -L $full_sysfs_path/device ] ; then - if [ -f $full_sysfs_path/range ] ; then return ; fi - full_sysfs_path="${full_sysfs_path%/*}" - : full_sysfs_path "$full_sysfs_path" - if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then - return - fi - fi - cd $full_sysfs_path/device - fi - full_sysfs_device_path="`pwd -P`" - cd "$OPWD" - D=$full_sysfs_device_path - while [ ! -z "$D" ] ; do - case "$D" in - */ide[0-9]/[0-9].[0-9]*|*/ide[0-9][0-9]/[0-9][0-9].[0-9]*) - handle_block_ide "$D" - ;; - */css0/*) - if [ -r $full_sysfs_device_path/wwpn ]; then - read wwpn < $full_sysfs_device_path/wwpn - fi - if [ -r $full_sysfs_device_path/fcp_lun ]; then - read lun < $full_sysfs_device_path/fcp_lun - fi - if [ -r $full_sysfs_device_path/hba_id ]; then - read bus_id < $full_sysfs_device_path/hba_id - fi - if [ "$bus_id" -a "$wwpn" -a "$lun" ]; then - # S/390 zfcp adapter - d="ccw-$bus_id-zfcp-$wwpn:$lun" - RESULT=0 +handle_device () { + full_sysfs_path="$SYSFS$DEVPATH" + if [ -L $full_sysfs_path/subsystem ]; then + # new sysfs block layout + full_sysfs_path="${full_sysfs_path%/*}" + cd "$full_sysfs_path/subsystem"; + subsys="`pwd -P`" + cd "$OPWD" + subsys="${subsys##*/}" + if [ "$subsys" == "block" ]; then + # parent is "block", it's a partition, move one up + full_sysfs_path="${full_sysfs_path%/*}" + fi + cd $full_sysfs_path else - # DASD devices - bus="ccw" - adapter=${D##*/} - d="$bus-$adapter" - RESULT=0 + # old sysfs block layout + if [ ! -L $full_sysfs_path/device ] ; then + if [ -f $full_sysfs_path/range ] ; then return ; fi + full_sysfs_path="${full_sysfs_path%/*}" + : full_sysfs_path "$full_sysfs_path" + if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then + return + fi + fi + cd $full_sysfs_path/device fi - D= - ;; - */rport-[0-9]*:[0-9]*-[0-9]*/*) - handle_block_fc "$D" - ;; - */phy-[0-9]*:[0-9]*/*) - handle_block_sas "$D" - ;; - */fw-host[0-9]*/*) - handle_block_firewire "$D" - ;; - */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) - handle_block_scsi "$D" - ;; - */usb[0-9]*/[0-9]*/*) - handle_usb "$D" - ;; - */pci[0-9]*:[0-9]*) - handle_pci "$D" - ;; - */devices) - D= - ;; - *) - : not handled - RESULT=1 - return - ;; - esac - done + full_sysfs_device_path="`pwd -P`" + cd "$OPWD" + D=$full_sysfs_device_path + while [ ! -z "$D" ] ; do + case "$D" in + */ide[0-9]/[0-9].[0-9]*|*/ide[0-9][0-9]/[0-9][0-9].[0-9]*) + handle_ide "$D" + ;; + */css0/*) + if [ -r $full_sysfs_device_path/wwpn ]; then + read wwpn < $full_sysfs_device_path/wwpn + fi + if [ -r $full_sysfs_device_path/fcp_lun ]; then + read lun < $full_sysfs_device_path/fcp_lun + fi + if [ -r $full_sysfs_device_path/hba_id ]; then + read bus_id < $full_sysfs_device_path/hba_id + fi + if [ "$bus_id" -a "$wwpn" -a "$lun" ]; then + # S/390 zfcp adapter + d="ccw-$bus_id-zfcp-$wwpn:$lun" + RESULT=0 + else + # DASD devices + bus="ccw" + adapter=${D##*/} + d="$bus-$adapter" + RESULT=0 + fi + D= + ;; + */rport-[0-9]*:[0-9]*-[0-9]*/*) + handle_fc "$D" + ;; + */phy-[0-9]*:[0-9]*/*) + handle_sas "$D" + ;; + */fw-host[0-9]*/*) + handle_firewire "$D" + ;; + */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) + handle_scsi "$D" + ;; + */usb[0-9]*/[0-9]*/*) + handle_usb "$D" + ;; + */pci[0-9]*:[0-9]*) + handle_pci "$D" + ;; + */devices) + D= + ;; + *) + : not handled + RESULT=1 + return + ;; + esac + done + if [ "$TYPE" == "scsi_tape" ] ; then + devname=${full_sysfs_path##*/} + rewind="${devname%%st*}" + mode="${devname##*st}" + case "$mode" in + *l) + mode="l" + ;; + *m) + mode="m" + ;; + *a) + mode="a" + ;; + *) + mode="" + ;; + esac + if [ "$d" ]; then + d="$d-${rewind}st${mode}" + fi + fi +} - if [ "$TYPE" == "scsi_tape" ] ; then - devname=${full_sysfs_path##*/} - rewind="${devname%%st*}" - mode="${devname##*st}" - case "$mode" in - *l) - mode="l" +case "$TYPE" in + block) + handle_device + echo "ID_PATH=$d" ;; - *m) - mode="m" + scsi_tape) + handle_device + echo "ID_PATH=$d" ;; - *a) - mode="a" + input) + handle_device + echo "ID_PATH=$d" ;; - *) - mode="" + *) + RESULT=1 ;; - esac - if [ "$d" ]; then - d="$d-${rewind}st${mode}" - fi - fi -} - -case "$TYPE" in - block) - handle_block - echo "ID_PATH=$d" - ;; - scsi_tape) - handle_block - echo "ID_PATH=$d" - ;; - input) - handle_usb $SYSFS$DEVPATH/device - echo "ID_PATH=$d" - ;; - *) - RESULT=1 - ;; esac + exit $RESULT -- cgit v1.2.3-54-g00ecf From aeaf0fddb93bb2589253318353d1955bffae28ba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 22 Mar 2006 19:16:26 +0100 Subject: change rule to skip removable IDE devices --- etc/udev/60-persistent-storage.rules | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules index 94643be184..5f1e84b68e 100644 --- a/etc/udev/60-persistent-storage.rules +++ b/etc/udev/60-persistent-storage.rules @@ -8,8 +8,11 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end" KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_storage_end" # never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_storage_end" +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" + +# for partitions import parent information +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" @@ -22,20 +25,18 @@ KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*|st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_storage_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[!0-9]|sr*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" +KERNEL=="st*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" -# by-label/by-uuid (filesystem properties) +KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" + +# by-label/by-uuid (filesystem properties) IMPORT{program}="/sbin/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -- cgit v1.2.3-54-g00ecf From ddb5a84c349f2f5aca2387d5c3bddc684e64aa84 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 22 Mar 2006 19:46:33 +0100 Subject: don't create uuid/label links for raid members --- etc/udev/60-persistent-storage.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules index 5f1e84b68e..2455866999 100644 --- a/etc/udev/60-persistent-storage.rules +++ b/etc/udev/60-persistent-storage.rules @@ -38,8 +38,8 @@ KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" # by-label/by-uuid (filesystem properties) IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # BIOS Enhanced Disk Device KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" -- cgit v1.2.3-54-g00ecf From 2d82e6f0532295798adec25a52a7d70c85ba4bba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Mar 2006 10:50:55 +0100 Subject: volume_id: provide library --- extras/volume_id/Makefile | 13 ++-- extras/volume_id/libvolume_id/Makefile | 69 +++++++++++++++-- extras/volume_id/libvolume_id/cramfs.c | 2 +- extras/volume_id/libvolume_id/ext.c | 2 +- extras/volume_id/libvolume_id/fat.c | 2 +- extras/volume_id/libvolume_id/hfs.c | 2 +- extras/volume_id/libvolume_id/highpoint.c | 2 +- extras/volume_id/libvolume_id/hpfs.c | 2 +- extras/volume_id/libvolume_id/iso9660.c | 2 +- extras/volume_id/libvolume_id/isw_raid.c | 2 +- extras/volume_id/libvolume_id/jfs.c | 2 +- extras/volume_id/libvolume_id/libvolume_id.h | 105 ++++++++++++++++++++++++++ extras/volume_id/libvolume_id/linux_raid.c | 2 +- extras/volume_id/libvolume_id/linux_swap.c | 2 +- extras/volume_id/libvolume_id/lsi_raid.c | 2 +- extras/volume_id/libvolume_id/luks.c | 2 +- extras/volume_id/libvolume_id/lvm.c | 2 +- extras/volume_id/libvolume_id/minix.c | 2 +- extras/volume_id/libvolume_id/ntfs.c | 2 +- extras/volume_id/libvolume_id/nvidia_raid.c | 2 +- extras/volume_id/libvolume_id/ocfs.c | 2 +- extras/volume_id/libvolume_id/promise_raid.c | 2 +- extras/volume_id/libvolume_id/reiserfs.c | 2 +- extras/volume_id/libvolume_id/romfs.c | 2 +- extras/volume_id/libvolume_id/silicon_raid.c | 2 +- extras/volume_id/libvolume_id/squashfs.c | 2 +- extras/volume_id/libvolume_id/sysv.c | 2 +- extras/volume_id/libvolume_id/udf.c | 2 +- extras/volume_id/libvolume_id/ufs.c | 2 +- extras/volume_id/libvolume_id/util.c | 2 +- extras/volume_id/libvolume_id/via_raid.c | 2 +- extras/volume_id/libvolume_id/volume_id.c | 2 +- extras/volume_id/libvolume_id/volume_id.h | 107 --------------------------- extras/volume_id/libvolume_id/vxfs.c | 2 +- extras/volume_id/libvolume_id/xfs.c | 2 +- extras/volume_id/vol_id.c | 2 +- 36 files changed, 206 insertions(+), 152 deletions(-) create mode 100644 extras/volume_id/libvolume_id/libvolume_id.h delete mode 100644 extras/volume_id/libvolume_id/volume_id.h diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index b72d5b11d9..88752b880e 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -1,12 +1,11 @@ # Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2004-2005 Kay Sievers +# Copyright (C) 2004-2006 Kay Sievers # # Released under the GNU General Public License, version 2. # PROG = vol_id -LIBVOLUME_ID = libvolume_id/libvolume_id.a GEN_HEADERS = MAN_PAGES = @@ -32,12 +31,12 @@ all: $(PROG) $(MAN_PAGES) $(E) " CC " $@ $(Q) $(CC) -c $(CFLAGS) $< -o $@ -$(LIBVOLUME_ID): +libvolume_id/libvolume_id.a: $(Q) $(MAKE) -C libvolume_id -$(PROG): %: $(HEADERS) %.o $(LIBVOLUME_ID) +$(PROG): %: $(HEADERS) %.o libvolume_id/libvolume_id.a $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(LIBVOLUME_ID) -o $@ $(LIBUDEV) $(LIB_OBJS) + $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) libvolume_id/libvolume_id.a $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(E) " STRIP " $@ $(Q) $(STRIPCMD) $@ @@ -56,11 +55,13 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(MAKE) -C libvolume_id install .PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) + $(MAKE) -C libvolume_id uninstall .PHONY: uninstall-bin install-man: diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile index a5f9c1a825..5d188a23d4 100644 --- a/extras/volume_id/libvolume_id/Makefile +++ b/extras/volume_id/libvolume_id/Makefile @@ -1,11 +1,21 @@ -# Makefile for udev extra invoked from the udev main Makefile +# libvolume_id - read filesystem label/uuid # -# Copyright (C) 2004-2005 Kay Sievers +# Copyright (C) 2004-2006 Kay Sievers # # Released under the GNU General Public License, version 2. # +includedir = ${prefix}/usr/include +libdir = ${prefix}/lib +usrlibdir = ${prefix}/usr/lib -LIBVOLUME_ID = libvolume_id.a +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_LIB = ${INSTALL} -m 755 + +SHLIB_CUR = 0 +SHLIB_REV = 60 +SHLIB_AGE = 0 +SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) OBJS= \ ext.o \ @@ -41,13 +51,13 @@ OBJS= \ util.o HEADERS= \ - volume_id.h \ + libvolume_id.h \ util.h AR = $(CROSS)ar RANLIB = $(CROSS)ranlib -all: $(LIBVOLUME_ID) +all: libvolume_id.a $(SHLIB) libvolume_id.pc .PHONY: all .DEFAULT: all @@ -55,15 +65,60 @@ all: $(LIBVOLUME_ID) $(E) " CC " $@ $(Q) $(CC) -c $(CFLAGS) $< -o $@ -$(LIBVOLUME_ID): $(HEADERS) $(OBJS) +.shlib: + $(Q) mkdir .shlib + +.shlib/%.o: %.c + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@ + +libvolume_id.a: $(HEADERS) $(OBJS) $(Q) rm -f $@ $(E) " AR " $@ $(Q) $(AR) cq $@ $(OBJS) $(E) " RANLIB " $@ $(Q) $(RANLIB) $@ +$(SHLIB): $(HEADERS) .shlib $(addprefix .shlib/,$(OBJS)) + $(E) " CC " $@ + $(Q) $(CC) -shared $(CFLAGS) -o $@ -Wl,-soname,libvolume_id.so.$(SHLIB_CUR) $(addprefix .shlib/,$(OBJS)) + $(Q) ln -sf $@ libvolume_id.so.$(SHLIB_CUR) + $(Q) ln -sf $@ libvolume_id.so + +libvolume_id.pc: + $(E) " GENPC " $@ + $(Q) echo "prefix=${prefix}" > $@ + $(Q) echo "libdir=${libdir}" >> $@ + $(Q) echo "includedir=${includedir}" >> $@ + $(Q) echo "" >> $@ + $(Q) echo "Name: libvolume_id" >> $@ + $(Q) echo "Description: Filesystem label and uuid access" >> $@ + $(Q) echo "Version: $(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)" >> $@ + $(Q) echo "Libs: -L\$${libdir} -lvolume_id" >> $@ + $(Q) echo "Cflags: -I\$${includedir}" >> $@ + +install: all + $(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h + $(INSTALL_LIB) -D libvolume_id.a $(DESTDIR)$(usrlibdir)/libvolume_id.a + $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) + ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) + ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so + $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc +.PHONY: install + +uninstall: + rm -f $(DESTDIR)$(includedir)/libvolume_id.h + rm -f $(DESTDIR)$(usrlibdir)/libvolume_id.a + rm -f $(DESTDIR)$(libdir)/$(SHLIB) + rm -f $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) + rm -f $(DESTDIR)$(libdir)/libvolume_id.so +.PHONY: uninstall + clean: $(E) " CLEAN " - $(Q) rm -f $(LIBVOLUME_ID) $(OBJS) + $(Q) rm -f libvolume_id.a $(OBJS) + $(Q) rm -f $(SHLIB) libvolume_id.so.$(SHLIB_CUR) libvolume_id.so + $(Q) rm -rf .shlib + $(Q) rm -f libvolume_id.pc .PHONY: clean diff --git a/extras/volume_id/libvolume_id/cramfs.c b/extras/volume_id/libvolume_id/cramfs.c index e099c214c8..5a7c29d353 100644 --- a/extras/volume_id/libvolume_id/cramfs.c +++ b/extras/volume_id/libvolume_id/cramfs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/ext.c b/extras/volume_id/libvolume_id/ext.c index 26ac98bc37..d1c46471c6 100644 --- a/extras/volume_id/libvolume_id/ext.c +++ b/extras/volume_id/libvolume_id/ext.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "util.h" #include "logging.h" diff --git a/extras/volume_id/libvolume_id/fat.c b/extras/volume_id/libvolume_id/fat.c index a72ec19f59..4b32263fd6 100644 --- a/extras/volume_id/libvolume_id/fat.c +++ b/extras/volume_id/libvolume_id/fat.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/hfs.c b/extras/volume_id/libvolume_id/hfs.c index 09194d5be1..627166df98 100644 --- a/extras/volume_id/libvolume_id/hfs.c +++ b/extras/volume_id/libvolume_id/hfs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/highpoint.c b/extras/volume_id/libvolume_id/highpoint.c index 78a4ad82b4..fa580b7b8c 100644 --- a/extras/volume_id/libvolume_id/highpoint.c +++ b/extras/volume_id/libvolume_id/highpoint.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/hpfs.c b/extras/volume_id/libvolume_id/hpfs.c index 452df0124d..41b8013bb1 100644 --- a/extras/volume_id/libvolume_id/hpfs.c +++ b/extras/volume_id/libvolume_id/hpfs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/iso9660.c b/extras/volume_id/libvolume_id/iso9660.c index 2e28af8d70..02575f8dc2 100644 --- a/extras/volume_id/libvolume_id/iso9660.c +++ b/extras/volume_id/libvolume_id/iso9660.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/isw_raid.c b/extras/volume_id/libvolume_id/isw_raid.c index 72b2b85b12..cf7c62f817 100644 --- a/extras/volume_id/libvolume_id/isw_raid.c +++ b/extras/volume_id/libvolume_id/isw_raid.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/jfs.c b/extras/volume_id/libvolume_id/jfs.c index 78b61fb30d..f8d857878d 100644 --- a/extras/volume_id/libvolume_id/jfs.c +++ b/extras/volume_id/libvolume_id/jfs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/libvolume_id.h b/extras/volume_id/libvolume_id/libvolume_id.h new file mode 100644 index 0000000000..b08a650dc8 --- /dev/null +++ b/extras/volume_id/libvolume_id/libvolume_id.h @@ -0,0 +1,105 @@ +/* + * volume_id - reads volume label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _LIBVOLUME_ID_H_ +#define _LIBVOLUME_ID_H_ + +#include +#include + +#ifndef PACKED +#define PACKED __attribute__((packed)) +#endif + +#define VOLUME_ID_LABEL_SIZE 64 +#define VOLUME_ID_UUID_SIZE 36 +#define VOLUME_ID_FORMAT_SIZE 32 +#define VOLUME_ID_PATH_MAX 256 +#define VOLUME_ID_PARTITIONS_MAX 256 + +enum volume_id_usage { + VOLUME_ID_UNUSED, + VOLUME_ID_UNPROBED, + VOLUME_ID_OTHER, + VOLUME_ID_FILESYSTEM, + VOLUME_ID_RAID, + VOLUME_ID_DISKLABEL, + VOLUME_ID_CRYPTO, +}; + +struct volume_id { + uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; + size_t label_raw_len; + char label[VOLUME_ID_LABEL_SIZE+1]; + uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; + size_t uuid_raw_len; + char uuid[VOLUME_ID_UUID_SIZE+1]; + enum volume_id_usage usage_id; + char *usage; + char *type; + char type_version[VOLUME_ID_FORMAT_SIZE]; + + int fd; + uint8_t *sbbuf; + size_t sbbuf_len; + uint8_t *seekbuf; + uint64_t seekbuf_off; + size_t seekbuf_len; + int fd_close:1; +}; + +extern struct volume_id *volume_id_open_fd(int fd); +extern struct volume_id *volume_id_open_node(const char *path); +extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern void volume_id_close(struct volume_id *id); + +/* filesystems */ +extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ext(struct volume_id *id, uint64_t off); +extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off); +extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); +extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); +extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_minix(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); +extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off); +extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off); + +/* special formats */ +extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); +extern int volume_id_probe_luks(struct volume_id *id, uint64_t off); + +/* raid */ +extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off); +extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); + +/* bios raid */ +extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); +extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); + +#endif diff --git a/extras/volume_id/libvolume_id/linux_raid.c b/extras/volume_id/libvolume_id/linux_raid.c index 2285e87b97..ee5ed2875d 100644 --- a/extras/volume_id/libvolume_id/linux_raid.c +++ b/extras/volume_id/libvolume_id/linux_raid.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/linux_swap.c b/extras/volume_id/libvolume_id/linux_swap.c index b4828347f7..c87ef63df9 100644 --- a/extras/volume_id/libvolume_id/linux_swap.c +++ b/extras/volume_id/libvolume_id/linux_swap.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/lsi_raid.c b/extras/volume_id/libvolume_id/lsi_raid.c index efa792575f..4e6c095b86 100644 --- a/extras/volume_id/libvolume_id/lsi_raid.c +++ b/extras/volume_id/libvolume_id/lsi_raid.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/luks.c b/extras/volume_id/libvolume_id/luks.c index 43f326e176..5346450ecc 100644 --- a/extras/volume_id/libvolume_id/luks.c +++ b/extras/volume_id/libvolume_id/luks.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "util.h" #include "logging.h" diff --git a/extras/volume_id/libvolume_id/lvm.c b/extras/volume_id/libvolume_id/lvm.c index 074660b1e4..4a1620e8a4 100644 --- a/extras/volume_id/libvolume_id/lvm.c +++ b/extras/volume_id/libvolume_id/lvm.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/minix.c b/extras/volume_id/libvolume_id/minix.c index fefba8e729..957925fe1f 100644 --- a/extras/volume_id/libvolume_id/minix.c +++ b/extras/volume_id/libvolume_id/minix.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/ntfs.c b/extras/volume_id/libvolume_id/ntfs.c index fe9ff8d5d6..a46359268e 100644 --- a/extras/volume_id/libvolume_id/ntfs.c +++ b/extras/volume_id/libvolume_id/ntfs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/nvidia_raid.c b/extras/volume_id/libvolume_id/nvidia_raid.c index 24717aaaec..7e1b58ba55 100644 --- a/extras/volume_id/libvolume_id/nvidia_raid.c +++ b/extras/volume_id/libvolume_id/nvidia_raid.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/ocfs.c b/extras/volume_id/libvolume_id/ocfs.c index c2f8360cae..c55b7234f4 100644 --- a/extras/volume_id/libvolume_id/ocfs.c +++ b/extras/volume_id/libvolume_id/ocfs.c @@ -24,7 +24,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/promise_raid.c b/extras/volume_id/libvolume_id/promise_raid.c index bdf0c7b601..f58dab28e9 100644 --- a/extras/volume_id/libvolume_id/promise_raid.c +++ b/extras/volume_id/libvolume_id/promise_raid.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/reiserfs.c b/extras/volume_id/libvolume_id/reiserfs.c index 91a5bcb9b0..5a9d71b53d 100644 --- a/extras/volume_id/libvolume_id/reiserfs.c +++ b/extras/volume_id/libvolume_id/reiserfs.c @@ -24,7 +24,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/romfs.c b/extras/volume_id/libvolume_id/romfs.c index 456077d1e1..171bb5a2a0 100644 --- a/extras/volume_id/libvolume_id/romfs.c +++ b/extras/volume_id/libvolume_id/romfs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/silicon_raid.c b/extras/volume_id/libvolume_id/silicon_raid.c index 27ac9591a7..e9ce4e0b78 100644 --- a/extras/volume_id/libvolume_id/silicon_raid.c +++ b/extras/volume_id/libvolume_id/silicon_raid.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/squashfs.c b/extras/volume_id/libvolume_id/squashfs.c index f220721d7b..3eabce71ae 100644 --- a/extras/volume_id/libvolume_id/squashfs.c +++ b/extras/volume_id/libvolume_id/squashfs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/sysv.c b/extras/volume_id/libvolume_id/sysv.c index 4aa281e9fa..41a32bbaa2 100644 --- a/extras/volume_id/libvolume_id/sysv.c +++ b/extras/volume_id/libvolume_id/sysv.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/udf.c b/extras/volume_id/libvolume_id/udf.c index f0e0d41957..54e66b4e86 100644 --- a/extras/volume_id/libvolume_id/udf.c +++ b/extras/volume_id/libvolume_id/udf.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/ufs.c b/extras/volume_id/libvolume_id/ufs.c index 2351d1f926..be6fa9e9ea 100644 --- a/extras/volume_id/libvolume_id/ufs.c +++ b/extras/volume_id/libvolume_id/ufs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/util.c b/extras/volume_id/libvolume_id/util.c index 0ad8ce66b2..b49dd6dd14 100644 --- a/extras/volume_id/libvolume_id/util.c +++ b/extras/volume_id/libvolume_id/util.c @@ -25,7 +25,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/via_raid.c b/extras/volume_id/libvolume_id/via_raid.c index 375a20979d..e70cfa1241 100644 --- a/extras/volume_id/libvolume_id/via_raid.c +++ b/extras/volume_id/libvolume_id/via_raid.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c index 718d74e5b6..e5f0d90ee8 100644 --- a/extras/volume_id/libvolume_id/volume_id.c +++ b/extras/volume_id/libvolume_id/volume_id.c @@ -26,7 +26,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/volume_id.h b/extras/volume_id/libvolume_id/volume_id.h deleted file mode 100644 index 8ddffc96de..0000000000 --- a/extras/volume_id/libvolume_id/volume_id.h +++ /dev/null @@ -1,107 +0,0 @@ -/* - * volume_id - reads volume label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_H_ -#define _VOLUME_ID_H_ - -#include -#include - -#define VOLUME_ID_VERSION 60 - -#ifndef PACKED -#define PACKED __attribute__((packed)) -#endif - -#define VOLUME_ID_LABEL_SIZE 64 -#define VOLUME_ID_UUID_SIZE 36 -#define VOLUME_ID_FORMAT_SIZE 32 -#define VOLUME_ID_PATH_MAX 256 -#define VOLUME_ID_PARTITIONS_MAX 256 - -enum volume_id_usage { - VOLUME_ID_UNUSED, - VOLUME_ID_UNPROBED, - VOLUME_ID_OTHER, - VOLUME_ID_FILESYSTEM, - VOLUME_ID_RAID, - VOLUME_ID_DISKLABEL, - VOLUME_ID_CRYPTO, -}; - -struct volume_id { - uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; - size_t label_raw_len; - char label[VOLUME_ID_LABEL_SIZE+1]; - uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; - size_t uuid_raw_len; - char uuid[VOLUME_ID_UUID_SIZE+1]; - enum volume_id_usage usage_id; - char *usage; - char *type; - char type_version[VOLUME_ID_FORMAT_SIZE]; - - int fd; - uint8_t *sbbuf; - size_t sbbuf_len; - uint8_t *seekbuf; - uint64_t seekbuf_off; - size_t seekbuf_len; - int fd_close:1; -}; - -extern struct volume_id *volume_id_open_fd(int fd); -extern struct volume_id *volume_id_open_node(const char *path); -extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern void volume_id_close(struct volume_id *id); - -/* filesystems */ -extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ext(struct volume_id *id, uint64_t off); -extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off); -extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); -extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); -extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_minix(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); -extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off); -extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off); - -/* special formats */ -extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); -extern int volume_id_probe_luks(struct volume_id *id, uint64_t off); - -/* raid */ -extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off); -extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); - -/* bios raid */ -extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); -extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/libvolume_id/vxfs.c b/extras/volume_id/libvolume_id/vxfs.c index 883c1266a4..406391bf0e 100644 --- a/extras/volume_id/libvolume_id/vxfs.c +++ b/extras/volume_id/libvolume_id/vxfs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/xfs.c b/extras/volume_id/libvolume_id/xfs.c index 934ed2d877..4b48ff1250 100644 --- a/extras/volume_id/libvolume_id/xfs.c +++ b/extras/volume_id/libvolume_id/xfs.c @@ -23,7 +23,7 @@ #include #include -#include "volume_id.h" +#include "libvolume_id.h" #include "logging.h" #include "util.h" diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 6961969c13..518962c10b 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -31,7 +31,7 @@ #include #include "../../udev.h" -#include "libvolume_id/volume_id.h" +#include "libvolume_id/libvolume_id.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) -- cgit v1.2.3-54-g00ecf From ba743e43d4045b5c6cfecaeeab4e4293a32dc5ee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Mar 2006 10:57:05 +0100 Subject: fix rule order for persistent tape links Thanks a lot to Marco for finding this. --- etc/udev/60-persistent-storage.rules | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules index 2455866999..5f4e6b5f35 100644 --- a/etc/udev/60-persistent-storage.rules +++ b/etc/udev/60-persistent-storage.rules @@ -30,13 +30,12 @@ KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_S # by-path (shortest physical path) KERNEL=="*[!0-9]|sr*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" KERNEL=="st*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" - KERNEL=="sr*|st*", GOTO="persistent_storage_end" -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="/sbin/vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -- cgit v1.2.3-54-g00ecf From 727f3fb091cf4903e9e9aa21159f05c36aaede24 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Mar 2006 14:01:04 +0100 Subject: update man page --- udev.7 | 18 +----------------- udev.xml | 38 ++++---------------------------------- 2 files changed, 5 insertions(+), 51 deletions(-) diff --git a/udev.7 b/udev.7 index 75db2b72a5..332db04f1f 100644 --- a/udev.7 +++ b/udev.7 @@ -132,7 +132,7 @@ The permissions for the device node. Every specified value overwrites the compil Export a variable to the environment. This key can also be used to match against an environment variable. .TP \fBRUN\fR -Add a program to the list of programs to be executed for a specific device. +Add a program to the list of programs to be executed for a specific device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. .TP \fBLABEL\fR Named label where a GOTO can jump to. @@ -221,22 +221,6 @@ The '%' character itself. The '$' character itself. .PP The count of characters to be substituted may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute -.SH "ENVIRONMENT" -.TP -\fBACTION\fR -\fIadd\fR -or -\fIremove\fR -signifies the addition or the removal of a device. -.TP -\fBDEVPATH\fR -The sysfs devpath without the mountpoint but a leading slash. -.TP -\fBSUBSYSTEM\fR -The kernel subsystem the device belongs to. -.TP -\fBUDEV_LOG\fR -Overrides the syslog priority specified in the config file. .SH "AUTHOR" .PP Written by Greg Kroah\-Hartman diff --git a/udev.xml b/udev.xml index 51288c0089..958c10d1d6 100644 --- a/udev.xml +++ b/udev.xml @@ -301,7 +301,10 @@ Add a program to the list of programs to be executed for a specific - device. + device. This can only be used for very short running tasks. Running an + event process for a long period of time may block all further events for + this or a dependent device. Long running tasks need to be immediately + detached from the event process itself. @@ -472,39 +475,6 @@ - ENVIRONMENT - - - - - add or remove signifies - the addition or the removal of a device. - - - - - - - The sysfs devpath without the mountpoint but a leading slash. - - - - - - - The kernel subsystem the device belongs to. - - - - - - - Overrides the syslog priority specified in the config file. - - - - - AUTHOR Written by Greg Kroah-Hartman greg@kroah.com and Kay Sievers kay.sievers@vrfy.org. With much help from -- cgit v1.2.3-54-g00ecf From b5e694267142042228a6cac99ecad6c4b4ef8759 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 27 Mar 2006 17:59:22 +0200 Subject: volume_id: provide a custom debug function --- extras/volume_id/libvolume_id/Makefile | 2 +- extras/volume_id/libvolume_id/cramfs.c | 1 - extras/volume_id/libvolume_id/ext.c | 1 - extras/volume_id/libvolume_id/fat.c | 1 - extras/volume_id/libvolume_id/hfs.c | 1 - extras/volume_id/libvolume_id/highpoint.c | 1 - extras/volume_id/libvolume_id/hpfs.c | 1 - extras/volume_id/libvolume_id/iso9660.c | 1 - extras/volume_id/libvolume_id/isw_raid.c | 1 - extras/volume_id/libvolume_id/jfs.c | 1 - extras/volume_id/libvolume_id/libvolume_id.h | 6 ++++++ extras/volume_id/libvolume_id/linux_raid.c | 1 - extras/volume_id/libvolume_id/linux_swap.c | 1 - extras/volume_id/libvolume_id/logging.h | 24 ------------------------ extras/volume_id/libvolume_id/lsi_raid.c | 1 - extras/volume_id/libvolume_id/luks.c | 1 - extras/volume_id/libvolume_id/lvm.c | 1 - extras/volume_id/libvolume_id/minix.c | 1 - extras/volume_id/libvolume_id/ntfs.c | 1 - extras/volume_id/libvolume_id/nvidia_raid.c | 1 - extras/volume_id/libvolume_id/ocfs.c | 1 - extras/volume_id/libvolume_id/promise_raid.c | 1 - extras/volume_id/libvolume_id/reiserfs.c | 1 - extras/volume_id/libvolume_id/romfs.c | 1 - extras/volume_id/libvolume_id/silicon_raid.c | 1 - extras/volume_id/libvolume_id/squashfs.c | 1 - extras/volume_id/libvolume_id/sysv.c | 1 - extras/volume_id/libvolume_id/udf.c | 1 - extras/volume_id/libvolume_id/ufs.c | 1 - extras/volume_id/libvolume_id/util.c | 1 - extras/volume_id/libvolume_id/util.h | 11 ++++++++++- extras/volume_id/libvolume_id/via_raid.c | 1 - extras/volume_id/libvolume_id/volume_id.c | 8 +++++++- extras/volume_id/libvolume_id/vxfs.c | 1 - extras/volume_id/libvolume_id/xfs.c | 1 - extras/volume_id/vol_id.c | 15 +++++++++++++++ 36 files changed, 39 insertions(+), 57 deletions(-) delete mode 100644 extras/volume_id/libvolume_id/logging.h diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile index 5d188a23d4..6a12f0e67a 100644 --- a/extras/volume_id/libvolume_id/Makefile +++ b/extras/volume_id/libvolume_id/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 60 +SHLIB_REV = 61 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/libvolume_id/cramfs.c b/extras/volume_id/libvolume_id/cramfs.c index 5a7c29d353..beb34d5bc0 100644 --- a/extras/volume_id/libvolume_id/cramfs.c +++ b/extras/volume_id/libvolume_id/cramfs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct cramfs_super { diff --git a/extras/volume_id/libvolume_id/ext.c b/extras/volume_id/libvolume_id/ext.c index d1c46471c6..51c0011218 100644 --- a/extras/volume_id/libvolume_id/ext.c +++ b/extras/volume_id/libvolume_id/ext.c @@ -25,7 +25,6 @@ #include "libvolume_id.h" #include "util.h" -#include "logging.h" struct ext2_super_block { uint32_t s_inodes_count; diff --git a/extras/volume_id/libvolume_id/fat.c b/extras/volume_id/libvolume_id/fat.c index 4b32263fd6..4840a2a23c 100644 --- a/extras/volume_id/libvolume_id/fat.c +++ b/extras/volume_id/libvolume_id/fat.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" #define FAT12_MAX 0xff5 diff --git a/extras/volume_id/libvolume_id/hfs.c b/extras/volume_id/libvolume_id/hfs.c index 627166df98..a6e378dd28 100644 --- a/extras/volume_id/libvolume_id/hfs.c +++ b/extras/volume_id/libvolume_id/hfs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct hfs_finder_info{ diff --git a/extras/volume_id/libvolume_id/highpoint.c b/extras/volume_id/libvolume_id/highpoint.c index fa580b7b8c..deba540ad5 100644 --- a/extras/volume_id/libvolume_id/highpoint.c +++ b/extras/volume_id/libvolume_id/highpoint.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct hpt37x_meta { diff --git a/extras/volume_id/libvolume_id/hpfs.c b/extras/volume_id/libvolume_id/hpfs.c index 41b8013bb1..3e9589fcca 100644 --- a/extras/volume_id/libvolume_id/hpfs.c +++ b/extras/volume_id/libvolume_id/hpfs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct hpfs_super diff --git a/extras/volume_id/libvolume_id/iso9660.c b/extras/volume_id/libvolume_id/iso9660.c index 02575f8dc2..7b78a7e992 100644 --- a/extras/volume_id/libvolume_id/iso9660.c +++ b/extras/volume_id/libvolume_id/iso9660.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" #define ISO_SUPERBLOCK_OFFSET 0x8000 diff --git a/extras/volume_id/libvolume_id/isw_raid.c b/extras/volume_id/libvolume_id/isw_raid.c index cf7c62f817..6465a31bf5 100644 --- a/extras/volume_id/libvolume_id/isw_raid.c +++ b/extras/volume_id/libvolume_id/isw_raid.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct isw_meta { diff --git a/extras/volume_id/libvolume_id/jfs.c b/extras/volume_id/libvolume_id/jfs.c index f8d857878d..b230fb258c 100644 --- a/extras/volume_id/libvolume_id/jfs.c +++ b/extras/volume_id/libvolume_id/jfs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct jfs_super_block { diff --git a/extras/volume_id/libvolume_id/libvolume_id.h b/extras/volume_id/libvolume_id/libvolume_id.h index b08a650dc8..7faf8d8af3 100644 --- a/extras/volume_id/libvolume_id/libvolume_id.h +++ b/extras/volume_id/libvolume_id/libvolume_id.h @@ -18,6 +18,12 @@ #define PACKED __attribute__((packed)) #endif + +typedef void (*volume_id_log_fn)(int priority, const char *file, int line, const char *format, ...) + __attribute__ ((format(printf, 4, 5))); + +extern volume_id_log_fn volume_id_log; + #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 #define VOLUME_ID_FORMAT_SIZE 32 diff --git a/extras/volume_id/libvolume_id/linux_raid.c b/extras/volume_id/libvolume_id/linux_raid.c index ee5ed2875d..85e8d8109b 100644 --- a/extras/volume_id/libvolume_id/linux_raid.c +++ b/extras/volume_id/libvolume_id/linux_raid.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct mdp_super_block { diff --git a/extras/volume_id/libvolume_id/linux_swap.c b/extras/volume_id/libvolume_id/linux_swap.c index c87ef63df9..0193648c9e 100644 --- a/extras/volume_id/libvolume_id/linux_swap.c +++ b/extras/volume_id/libvolume_id/linux_swap.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct swap_header_v1_2 { diff --git a/extras/volume_id/libvolume_id/logging.h b/extras/volume_id/libvolume_id/logging.h deleted file mode 100644 index 4a8aa50d4c..0000000000 --- a/extras/volume_id/libvolume_id/logging.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * volume_id_logging - this file is used to map the dbg() function - * to the user's logging facility - * - * 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. - */ - -#ifndef _VOLUME_ID_LOGGING_H_ -#define _VOLUME_ID_LOGGING_H_ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif - -/* just use the udev version */ -#include "../../../logging.h" - -#endif /* _VOLUME_ID_LOGGING_H_ */ diff --git a/extras/volume_id/libvolume_id/lsi_raid.c b/extras/volume_id/libvolume_id/lsi_raid.c index 4e6c095b86..f1db4a6e50 100644 --- a/extras/volume_id/libvolume_id/lsi_raid.c +++ b/extras/volume_id/libvolume_id/lsi_raid.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct lsi_meta { diff --git a/extras/volume_id/libvolume_id/luks.c b/extras/volume_id/libvolume_id/luks.c index 5346450ecc..64de85ac21 100644 --- a/extras/volume_id/libvolume_id/luks.c +++ b/extras/volume_id/libvolume_id/luks.c @@ -25,7 +25,6 @@ #include "libvolume_id.h" #include "util.h" -#include "logging.h" #define SECTOR_SHIFT 9 #define SECTOR_SIZE (1 << SECTOR_SHIFT) diff --git a/extras/volume_id/libvolume_id/lvm.c b/extras/volume_id/libvolume_id/lvm.c index 4a1620e8a4..47d84b0968 100644 --- a/extras/volume_id/libvolume_id/lvm.c +++ b/extras/volume_id/libvolume_id/lvm.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct lvm1_super_block { diff --git a/extras/volume_id/libvolume_id/minix.c b/extras/volume_id/libvolume_id/minix.c index 957925fe1f..75e9c3acbd 100644 --- a/extras/volume_id/libvolume_id/minix.c +++ b/extras/volume_id/libvolume_id/minix.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct minix_super_block diff --git a/extras/volume_id/libvolume_id/ntfs.c b/extras/volume_id/libvolume_id/ntfs.c index a46359268e..23c64fc307 100644 --- a/extras/volume_id/libvolume_id/ntfs.c +++ b/extras/volume_id/libvolume_id/ntfs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct ntfs_super_block { diff --git a/extras/volume_id/libvolume_id/nvidia_raid.c b/extras/volume_id/libvolume_id/nvidia_raid.c index 7e1b58ba55..10c1c714f7 100644 --- a/extras/volume_id/libvolume_id/nvidia_raid.c +++ b/extras/volume_id/libvolume_id/nvidia_raid.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct nvidia_meta { diff --git a/extras/volume_id/libvolume_id/ocfs.c b/extras/volume_id/libvolume_id/ocfs.c index c55b7234f4..b376ead833 100644 --- a/extras/volume_id/libvolume_id/ocfs.c +++ b/extras/volume_id/libvolume_id/ocfs.c @@ -25,7 +25,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" diff --git a/extras/volume_id/libvolume_id/promise_raid.c b/extras/volume_id/libvolume_id/promise_raid.c index f58dab28e9..2a2ce1689e 100644 --- a/extras/volume_id/libvolume_id/promise_raid.c +++ b/extras/volume_id/libvolume_id/promise_raid.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct promise_meta { diff --git a/extras/volume_id/libvolume_id/reiserfs.c b/extras/volume_id/libvolume_id/reiserfs.c index 5a9d71b53d..b5706f86e0 100644 --- a/extras/volume_id/libvolume_id/reiserfs.c +++ b/extras/volume_id/libvolume_id/reiserfs.c @@ -25,7 +25,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct reiserfs_super_block { diff --git a/extras/volume_id/libvolume_id/romfs.c b/extras/volume_id/libvolume_id/romfs.c index 171bb5a2a0..8bb2a0018a 100644 --- a/extras/volume_id/libvolume_id/romfs.c +++ b/extras/volume_id/libvolume_id/romfs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct romfs_super { diff --git a/extras/volume_id/libvolume_id/silicon_raid.c b/extras/volume_id/libvolume_id/silicon_raid.c index e9ce4e0b78..017b023e27 100644 --- a/extras/volume_id/libvolume_id/silicon_raid.c +++ b/extras/volume_id/libvolume_id/silicon_raid.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct silicon_meta { diff --git a/extras/volume_id/libvolume_id/squashfs.c b/extras/volume_id/libvolume_id/squashfs.c index 3eabce71ae..bdb1f16628 100644 --- a/extras/volume_id/libvolume_id/squashfs.c +++ b/extras/volume_id/libvolume_id/squashfs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" #define SQUASHFS_MAGIC 0x73717368 diff --git a/extras/volume_id/libvolume_id/sysv.c b/extras/volume_id/libvolume_id/sysv.c index 41a32bbaa2..52349c0623 100644 --- a/extras/volume_id/libvolume_id/sysv.c +++ b/extras/volume_id/libvolume_id/sysv.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" #define SYSV_NICINOD 100 diff --git a/extras/volume_id/libvolume_id/udf.c b/extras/volume_id/libvolume_id/udf.c index 54e66b4e86..d7497ec51b 100644 --- a/extras/volume_id/libvolume_id/udf.c +++ b/extras/volume_id/libvolume_id/udf.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct volume_descriptor { diff --git a/extras/volume_id/libvolume_id/ufs.c b/extras/volume_id/libvolume_id/ufs.c index be6fa9e9ea..d3960b1bec 100644 --- a/extras/volume_id/libvolume_id/ufs.c +++ b/extras/volume_id/libvolume_id/ufs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct ufs_super_block { diff --git a/extras/volume_id/libvolume_id/util.c b/extras/volume_id/libvolume_id/util.c index b49dd6dd14..cf5392cf9a 100644 --- a/extras/volume_id/libvolume_id/util.c +++ b/extras/volume_id/libvolume_id/util.c @@ -26,7 +26,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) diff --git a/extras/volume_id/libvolume_id/util.h b/extras/volume_id/libvolume_id/util.h index 8cb1abd360..1d1b53bb57 100644 --- a/extras/volume_id/libvolume_id/util.h +++ b/extras/volume_id/libvolume_id/util.h @@ -1,7 +1,7 @@ /* * volume_id - reads filesystem label and uuid * - * Copyright (C) 2005 Kay Sievers + * Copyright (C) 2005-2006 Kay Sievers * * 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 @@ -21,6 +21,15 @@ #include #include +#include + +#define err(format, arg...) volume_id_log(LOG_ERR, __FILE__, __LINE__, format, ##arg) +#define info(format, arg...) volume_id_log(LOG_INFO, __FILE__, __LINE__, format, ##arg) +#ifdef DEBUG +#define dbg(format, arg...) volume_id_log(LOG_DEBUG, __FILE__, __LINE__, format, ##arg) +#else +#define dbg(format, arg...) do { } while (0) +#endif /* size of superblock buffer, reiserfs block is at 64k */ #define SB_BUFFER_SIZE 0x11000 diff --git a/extras/volume_id/libvolume_id/via_raid.c b/extras/volume_id/libvolume_id/via_raid.c index e70cfa1241..42cb098065 100644 --- a/extras/volume_id/libvolume_id/via_raid.c +++ b/extras/volume_id/libvolume_id/via_raid.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct via_meta { diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c index e5f0d90ee8..073ad79c77 100644 --- a/extras/volume_id/libvolume_id/volume_id.c +++ b/extras/volume_id/libvolume_id/volume_id.c @@ -27,9 +27,15 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" +/* the user can overwrite this log function */ +static void default_log(int priority, const char *file, int line, const char *format, ...) +{ + return; +} + +volume_id_log_fn volume_id_log = default_log; int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) { diff --git a/extras/volume_id/libvolume_id/vxfs.c b/extras/volume_id/libvolume_id/vxfs.c index 406391bf0e..d10cc37762 100644 --- a/extras/volume_id/libvolume_id/vxfs.c +++ b/extras/volume_id/libvolume_id/vxfs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" #define VXFS_SUPER_MAGIC 0xa501FCF5 diff --git a/extras/volume_id/libvolume_id/xfs.c b/extras/volume_id/libvolume_id/xfs.c index 4b48ff1250..3d870c41e7 100644 --- a/extras/volume_id/libvolume_id/xfs.c +++ b/extras/volume_id/libvolume_id/xfs.c @@ -24,7 +24,6 @@ #include #include "libvolume_id.h" -#include "logging.h" #include "util.h" struct xfs_super_block { diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 518962c10b..b086b3710c 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -60,6 +60,18 @@ void log_message(int priority, const char *format, ...) } #endif +static void vid_log(int priority, const char *file, int line, const char *format, ...) +{ +#ifdef USE_LOG + va_list args; + + va_start(args, format); + log_message(priority, format, args); + va_end(args); +#endif + return; +} + static void set_str(char *to, const char *from, size_t count) { size_t i, j, len; @@ -117,6 +129,9 @@ int main(int argc, char *argv[]) logging_init("vol_id"); + /* hook in our debug into libvolume_id */ + volume_id_log = vid_log; + for (i = 1 ; i < argc; i++) { char *arg = argv[i]; -- cgit v1.2.3-54-g00ecf From 83cc6ab4760817509f1ed1ee429669e563f82caf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 27 Mar 2006 18:05:17 +0200 Subject: volume_id: rename subdirectory --- extras/volume_id/Makefile | 14 +- extras/volume_id/lib/Makefile | 124 ++++++++++ extras/volume_id/lib/cramfs.c | 64 +++++ extras/volume_id/lib/ext.c | 115 +++++++++ extras/volume_id/lib/fat.c | 349 +++++++++++++++++++++++++++ extras/volume_id/lib/hfs.c | 297 +++++++++++++++++++++++ extras/volume_id/lib/highpoint.c | 96 ++++++++ extras/volume_id/lib/hpfs.c | 56 +++++ extras/volume_id/lib/iso9660.c | 124 ++++++++++ extras/volume_id/lib/isw_raid.c | 66 +++++ extras/volume_id/lib/jfs.c | 65 +++++ extras/volume_id/lib/libvolume_id.h | 111 +++++++++ extras/volume_id/lib/linux_raid.c | 87 +++++++ extras/volume_id/lib/linux_swap.c | 76 ++++++ extras/volume_id/lib/lsi_raid.c | 60 +++++ extras/volume_id/lib/luks.c | 82 +++++++ extras/volume_id/lib/lvm.c | 97 ++++++++ extras/volume_id/lib/minix.c | 84 +++++++ extras/volume_id/lib/ntfs.c | 194 +++++++++++++++ extras/volume_id/lib/nvidia_raid.c | 64 +++++ extras/volume_id/lib/ocfs.c | 192 +++++++++++++++ extras/volume_id/lib/promise_raid.c | 70 ++++++ extras/volume_id/lib/reiserfs.c | 118 +++++++++ extras/volume_id/lib/romfs.c | 60 +++++ extras/volume_id/lib/silicon_raid.c | 77 ++++++ extras/volume_id/lib/squashfs.c | 52 ++++ extras/volume_id/lib/sysv.c | 133 ++++++++++ extras/volume_id/lib/udf.c | 178 ++++++++++++++ extras/volume_id/lib/ufs.c | 210 ++++++++++++++++ extras/volume_id/lib/util.c | 267 ++++++++++++++++++++ extras/volume_id/lib/util.h | 84 +++++++ extras/volume_id/lib/via_raid.c | 75 ++++++ extras/volume_id/lib/volume_id.c | 231 ++++++++++++++++++ extras/volume_id/lib/vxfs.c | 54 +++++ extras/volume_id/lib/xfs.c | 65 +++++ extras/volume_id/libvolume_id/Makefile | 124 ---------- extras/volume_id/libvolume_id/cramfs.c | 64 ----- extras/volume_id/libvolume_id/ext.c | 115 --------- extras/volume_id/libvolume_id/fat.c | 349 --------------------------- extras/volume_id/libvolume_id/hfs.c | 297 ----------------------- extras/volume_id/libvolume_id/highpoint.c | 96 -------- extras/volume_id/libvolume_id/hpfs.c | 56 ----- extras/volume_id/libvolume_id/iso9660.c | 124 ---------- extras/volume_id/libvolume_id/isw_raid.c | 66 ----- extras/volume_id/libvolume_id/jfs.c | 65 ----- extras/volume_id/libvolume_id/libvolume_id.h | 111 --------- extras/volume_id/libvolume_id/linux_raid.c | 87 ------- extras/volume_id/libvolume_id/linux_swap.c | 76 ------ extras/volume_id/libvolume_id/lsi_raid.c | 60 ----- extras/volume_id/libvolume_id/luks.c | 82 ------- extras/volume_id/libvolume_id/lvm.c | 97 -------- extras/volume_id/libvolume_id/minix.c | 84 ------- extras/volume_id/libvolume_id/ntfs.c | 194 --------------- extras/volume_id/libvolume_id/nvidia_raid.c | 64 ----- extras/volume_id/libvolume_id/ocfs.c | 192 --------------- extras/volume_id/libvolume_id/promise_raid.c | 70 ------ extras/volume_id/libvolume_id/reiserfs.c | 118 --------- extras/volume_id/libvolume_id/romfs.c | 60 ----- extras/volume_id/libvolume_id/silicon_raid.c | 77 ------ extras/volume_id/libvolume_id/squashfs.c | 52 ---- extras/volume_id/libvolume_id/sysv.c | 133 ---------- extras/volume_id/libvolume_id/udf.c | 178 -------------- extras/volume_id/libvolume_id/ufs.c | 210 ---------------- extras/volume_id/libvolume_id/util.c | 267 -------------------- extras/volume_id/libvolume_id/util.h | 84 ------- extras/volume_id/libvolume_id/via_raid.c | 75 ------ extras/volume_id/libvolume_id/volume_id.c | 231 ------------------ extras/volume_id/libvolume_id/vxfs.c | 54 ----- extras/volume_id/libvolume_id/xfs.c | 65 ----- extras/volume_id/vol_id.c | 2 +- 70 files changed, 4085 insertions(+), 4085 deletions(-) create mode 100644 extras/volume_id/lib/Makefile create mode 100644 extras/volume_id/lib/cramfs.c create mode 100644 extras/volume_id/lib/ext.c create mode 100644 extras/volume_id/lib/fat.c create mode 100644 extras/volume_id/lib/hfs.c create mode 100644 extras/volume_id/lib/highpoint.c create mode 100644 extras/volume_id/lib/hpfs.c create mode 100644 extras/volume_id/lib/iso9660.c create mode 100644 extras/volume_id/lib/isw_raid.c create mode 100644 extras/volume_id/lib/jfs.c create mode 100644 extras/volume_id/lib/libvolume_id.h create mode 100644 extras/volume_id/lib/linux_raid.c create mode 100644 extras/volume_id/lib/linux_swap.c create mode 100644 extras/volume_id/lib/lsi_raid.c create mode 100644 extras/volume_id/lib/luks.c create mode 100644 extras/volume_id/lib/lvm.c create mode 100644 extras/volume_id/lib/minix.c create mode 100644 extras/volume_id/lib/ntfs.c create mode 100644 extras/volume_id/lib/nvidia_raid.c create mode 100644 extras/volume_id/lib/ocfs.c create mode 100644 extras/volume_id/lib/promise_raid.c create mode 100644 extras/volume_id/lib/reiserfs.c create mode 100644 extras/volume_id/lib/romfs.c create mode 100644 extras/volume_id/lib/silicon_raid.c create mode 100644 extras/volume_id/lib/squashfs.c create mode 100644 extras/volume_id/lib/sysv.c create mode 100644 extras/volume_id/lib/udf.c create mode 100644 extras/volume_id/lib/ufs.c create mode 100644 extras/volume_id/lib/util.c create mode 100644 extras/volume_id/lib/util.h create mode 100644 extras/volume_id/lib/via_raid.c create mode 100644 extras/volume_id/lib/volume_id.c create mode 100644 extras/volume_id/lib/vxfs.c create mode 100644 extras/volume_id/lib/xfs.c delete mode 100644 extras/volume_id/libvolume_id/Makefile delete mode 100644 extras/volume_id/libvolume_id/cramfs.c delete mode 100644 extras/volume_id/libvolume_id/ext.c delete mode 100644 extras/volume_id/libvolume_id/fat.c delete mode 100644 extras/volume_id/libvolume_id/hfs.c delete mode 100644 extras/volume_id/libvolume_id/highpoint.c delete mode 100644 extras/volume_id/libvolume_id/hpfs.c delete mode 100644 extras/volume_id/libvolume_id/iso9660.c delete mode 100644 extras/volume_id/libvolume_id/isw_raid.c delete mode 100644 extras/volume_id/libvolume_id/jfs.c delete mode 100644 extras/volume_id/libvolume_id/libvolume_id.h delete mode 100644 extras/volume_id/libvolume_id/linux_raid.c delete mode 100644 extras/volume_id/libvolume_id/linux_swap.c delete mode 100644 extras/volume_id/libvolume_id/lsi_raid.c delete mode 100644 extras/volume_id/libvolume_id/luks.c delete mode 100644 extras/volume_id/libvolume_id/lvm.c delete mode 100644 extras/volume_id/libvolume_id/minix.c delete mode 100644 extras/volume_id/libvolume_id/ntfs.c delete mode 100644 extras/volume_id/libvolume_id/nvidia_raid.c delete mode 100644 extras/volume_id/libvolume_id/ocfs.c delete mode 100644 extras/volume_id/libvolume_id/promise_raid.c delete mode 100644 extras/volume_id/libvolume_id/reiserfs.c delete mode 100644 extras/volume_id/libvolume_id/romfs.c delete mode 100644 extras/volume_id/libvolume_id/silicon_raid.c delete mode 100644 extras/volume_id/libvolume_id/squashfs.c delete mode 100644 extras/volume_id/libvolume_id/sysv.c delete mode 100644 extras/volume_id/libvolume_id/udf.c delete mode 100644 extras/volume_id/libvolume_id/ufs.c delete mode 100644 extras/volume_id/libvolume_id/util.c delete mode 100644 extras/volume_id/libvolume_id/util.h delete mode 100644 extras/volume_id/libvolume_id/via_raid.c delete mode 100644 extras/volume_id/libvolume_id/volume_id.c delete mode 100644 extras/volume_id/libvolume_id/vxfs.c delete mode 100644 extras/volume_id/libvolume_id/xfs.c diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 88752b880e..78dfd867bc 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -31,12 +31,12 @@ all: $(PROG) $(MAN_PAGES) $(E) " CC " $@ $(Q) $(CC) -c $(CFLAGS) $< -o $@ -libvolume_id/libvolume_id.a: - $(Q) $(MAKE) -C libvolume_id +lib/libvolume_id.a: + $(Q) $(MAKE) -C lib -$(PROG): %: $(HEADERS) %.o libvolume_id/libvolume_id.a +$(PROG): %: $(HEADERS) %.o lib/libvolume_id.a $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) libvolume_id/libvolume_id.a $(LIB_OBJS) + $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) lib/libvolume_id.a $(LIB_OBJS) ifneq ($(strip $(STRIPCMD)),) $(E) " STRIP " $@ $(Q) $(STRIPCMD) $@ @@ -51,17 +51,17 @@ endif clean: $(E) " CLEAN " $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) - $(Q) $(MAKE) -C libvolume_id clean + $(Q) $(MAKE) -C lib clean .PHONY: clean install-bin: all $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG) - $(MAKE) -C libvolume_id install + $(MAKE) -C lib install .PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(sbindir)/$(PROG) - $(MAKE) -C libvolume_id uninstall + $(MAKE) -C lib uninstall .PHONY: uninstall-bin install-man: diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile new file mode 100644 index 0000000000..6a12f0e67a --- /dev/null +++ b/extras/volume_id/lib/Makefile @@ -0,0 +1,124 @@ +# libvolume_id - read filesystem label/uuid +# +# Copyright (C) 2004-2006 Kay Sievers +# +# Released under the GNU General Public License, version 2. +# +includedir = ${prefix}/usr/include +libdir = ${prefix}/lib +usrlibdir = ${prefix}/usr/lib + +INSTALL = /usr/bin/install -c +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_LIB = ${INSTALL} -m 755 + +SHLIB_CUR = 0 +SHLIB_REV = 61 +SHLIB_AGE = 0 +SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) + +OBJS= \ + ext.o \ + fat.o \ + hfs.o \ + highpoint.o \ + isw_raid.o \ + lsi_raid.o \ + via_raid.o \ + silicon_raid.o \ + nvidia_raid.o \ + promise_raid.o \ + iso9660.o \ + jfs.o \ + linux_raid.o \ + linux_swap.o \ + lvm.o \ + ntfs.o \ + reiserfs.o \ + udf.o \ + ufs.o \ + xfs.o \ + cramfs.o \ + hpfs.o \ + romfs.o \ + sysv.o \ + minix.o \ + luks.o \ + ocfs.o \ + vxfs.o \ + squashfs.o \ + volume_id.o \ + util.o + +HEADERS= \ + libvolume_id.h \ + util.h + +AR = $(CROSS)ar +RANLIB = $(CROSS)ranlib + +all: libvolume_id.a $(SHLIB) libvolume_id.pc +.PHONY: all +.DEFAULT: all + +%.o: %.c + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ + +.shlib: + $(Q) mkdir .shlib + +.shlib/%.o: %.c + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@ + +libvolume_id.a: $(HEADERS) $(OBJS) + $(Q) rm -f $@ + $(E) " AR " $@ + $(Q) $(AR) cq $@ $(OBJS) + $(E) " RANLIB " $@ + $(Q) $(RANLIB) $@ + +$(SHLIB): $(HEADERS) .shlib $(addprefix .shlib/,$(OBJS)) + $(E) " CC " $@ + $(Q) $(CC) -shared $(CFLAGS) -o $@ -Wl,-soname,libvolume_id.so.$(SHLIB_CUR) $(addprefix .shlib/,$(OBJS)) + $(Q) ln -sf $@ libvolume_id.so.$(SHLIB_CUR) + $(Q) ln -sf $@ libvolume_id.so + +libvolume_id.pc: + $(E) " GENPC " $@ + $(Q) echo "prefix=${prefix}" > $@ + $(Q) echo "libdir=${libdir}" >> $@ + $(Q) echo "includedir=${includedir}" >> $@ + $(Q) echo "" >> $@ + $(Q) echo "Name: libvolume_id" >> $@ + $(Q) echo "Description: Filesystem label and uuid access" >> $@ + $(Q) echo "Version: $(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)" >> $@ + $(Q) echo "Libs: -L\$${libdir} -lvolume_id" >> $@ + $(Q) echo "Cflags: -I\$${includedir}" >> $@ + +install: all + $(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h + $(INSTALL_LIB) -D libvolume_id.a $(DESTDIR)$(usrlibdir)/libvolume_id.a + $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) + ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) + ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so + $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc +.PHONY: install + +uninstall: + rm -f $(DESTDIR)$(includedir)/libvolume_id.h + rm -f $(DESTDIR)$(usrlibdir)/libvolume_id.a + rm -f $(DESTDIR)$(libdir)/$(SHLIB) + rm -f $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) + rm -f $(DESTDIR)$(libdir)/libvolume_id.so +.PHONY: uninstall + +clean: + $(E) " CLEAN " + $(Q) rm -f libvolume_id.a $(OBJS) + $(Q) rm -f $(SHLIB) libvolume_id.so.$(SHLIB_CUR) libvolume_id.so + $(Q) rm -rf .shlib + $(Q) rm -f libvolume_id.pc +.PHONY: clean + diff --git a/extras/volume_id/lib/cramfs.c b/extras/volume_id/lib/cramfs.c new file mode 100644 index 0000000000..beb34d5bc0 --- /dev/null +++ b/extras/volume_id/lib/cramfs.c @@ -0,0 +1,64 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct cramfs_super { + uint8_t magic[4]; + uint32_t size; + uint32_t flags; + uint32_t future; + uint8_t signature[16]; + struct cramfs_info { + uint32_t crc; + uint32_t edition; + uint32_t blocks; + uint32_t files; + } PACKED info; + uint8_t name[16]; +} PACKED; + +int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) +{ + struct cramfs_super *cs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); + if (cs == NULL) + return -1; + + if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0 || memcmp(cs->magic, "\x28\xcd\x3d\x45", 4) == 0) { + volume_id_set_label_raw(id, cs->name, 16); + volume_id_set_label_string(id, cs->name, 16); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "cramfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c new file mode 100644 index 0000000000..51c0011218 --- /dev/null +++ b/extras/volume_id/lib/ext.c @@ -0,0 +1,115 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct ext2_super_block { + uint32_t s_inodes_count; + uint32_t s_blocks_count; + uint32_t s_r_blocks_count; + uint32_t s_free_blocks_count; + uint32_t s_free_inodes_count; + uint32_t s_first_data_block; + uint32_t s_log_block_size; + uint32_t s_log_frag_size; + uint32_t s_blocks_per_group; + uint32_t s_frags_per_group; + uint32_t s_inodes_per_group; + uint32_t s_mtime; + uint32_t s_wtime; + uint16_t s_mnt_count; + uint16_t s_max_mnt_count; + uint16_t s_magic; + uint16_t s_state; + uint16_t s_errors; + uint16_t s_minor_rev_level; + uint32_t s_lastcheck; + uint32_t s_checkinterval; + uint32_t s_creator_os; + uint32_t s_rev_level; + uint16_t s_def_resuid; + uint16_t s_def_resgid; + uint32_t s_first_ino; + uint16_t s_inode_size; + uint16_t s_block_group_nr; + uint32_t s_feature_compat; + uint32_t s_feature_incompat; + uint32_t s_feature_ro_compat; + uint8_t s_uuid[16]; + uint8_t s_volume_name[16]; +} PACKED; + +#define EXT_SUPER_MAGIC 0xEF53 +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 +#define EXT_SUPERBLOCK_OFFSET 0x400 + +#define EXT3_MIN_BLOCK_SIZE 0x400 +#define EXT3_MAX_BLOCK_SIZE 0x1000 + +int volume_id_probe_ext(struct volume_id *id, uint64_t off) +{ + struct ext2_super_block *es; + size_t bsize; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); + if (es == NULL) + return -1; + + if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC)) + return -1; + + bsize = 0x400 << le32_to_cpu(es->s_log_block_size); + dbg("ext blocksize 0x%zx", bsize); + if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { + dbg("invalid ext blocksize"); + return -1; + } + + volume_id_set_label_raw(id, es->s_volume_name, 16); + volume_id_set_label_string(id, es->s_volume_name, 16); + volume_id_set_uuid(id, es->s_uuid, UUID_DCE); + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", es->s_rev_level, es->s_minor_rev_level); + + /* check for external journal device */ + if ((le32_to_cpu(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { + volume_id_set_usage(id, VOLUME_ID_OTHER); + id->type = "jbd"; + return 0; + } + + /* check for ext2 / ext3 */ + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + if ((le32_to_cpu(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) + id->type = "ext3"; + else + id->type = "ext2"; + + return 0; +} diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c new file mode 100644 index 0000000000..4840a2a23c --- /dev/null +++ b/extras/volume_id/lib/fat.c @@ -0,0 +1,349 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +#define FAT12_MAX 0xff5 +#define FAT16_MAX 0xfff5 +#define FAT_ATTR_VOLUME_ID 0x08 +#define FAT_ATTR_DIR 0x10 +#define FAT_ATTR_LONG_NAME 0x0f +#define FAT_ATTR_MASK 0x3f +#define FAT_ENTRY_FREE 0xe5 + +struct vfat_super_block { + uint8_t boot_jump[3]; + uint8_t sysid[8]; + uint16_t sector_size; + uint8_t sectors_per_cluster; + uint16_t reserved; + uint8_t fats; + uint16_t dir_entries; + uint16_t sectors; + uint8_t media; + uint16_t fat_length; + uint16_t secs_track; + uint16_t heads; + uint32_t hidden; + uint32_t total_sect; + union { + struct fat_super_block { + uint8_t unknown[3]; + uint8_t serno[4]; + uint8_t label[11]; + uint8_t magic[8]; + uint8_t dummy2[192]; + uint8_t pmagic[2]; + } PACKED fat; + struct fat32_super_block { + uint32_t fat32_length; + uint16_t flags; + uint8_t version[2]; + uint32_t root_cluster; + uint16_t insfo_sector; + uint16_t backup_boot; + uint16_t reserved2[6]; + uint8_t unknown[3]; + uint8_t serno[4]; + uint8_t label[11]; + uint8_t magic[8]; + uint8_t dummy2[164]; + uint8_t pmagic[2]; + } PACKED fat32; + } PACKED type; +} PACKED; + +struct vfat_dir_entry { + uint8_t name[11]; + uint8_t attr; + uint16_t time_creat; + uint16_t date_creat; + uint16_t time_acc; + uint16_t date_acc; + uint16_t cluster_high; + uint16_t time_write; + uint16_t date_write; + uint16_t cluster_low; + uint32_t size; +} PACKED; + +static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) +{ + unsigned int i; + + for (i = 0; i < count; i++) { + /* end marker */ + if (dir[i].name[0] == 0x00) { + dbg("end of dir"); + break; + } + + /* empty entry */ + if (dir[i].name[0] == FAT_ENTRY_FREE) + continue; + + /* long name */ + if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) + continue; + + if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { + /* labels do not have file data */ + if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) + continue; + + dbg("found ATTR_VOLUME_ID id in root dir"); + return dir[i].name; + } + + dbg("skip dir entry"); + } + + return NULL; +} + +int volume_id_probe_vfat(struct volume_id *id, uint64_t off) +{ + struct vfat_super_block *vs; + struct vfat_dir_entry *dir; + uint16_t sector_size; + uint16_t dir_entries; + uint32_t sect_count; + uint16_t reserved; + uint32_t fat_size; + uint32_t root_cluster; + uint32_t dir_size; + uint32_t cluster_count; + uint16_t fat_length; + uint32_t fat32_length; + uint64_t root_start; + uint32_t start_data_sect; + uint16_t root_dir_entries; + uint8_t *buf; + uint32_t buf_size; + uint8_t *label = NULL; + uint32_t next; + int maxloop; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + /* believe only that's fat, don't trust the version + * the cluster_count will tell us + */ + if (memcmp(vs->sysid, "NTFS", 4) == 0) + return -1; + + if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) + goto magic; + + if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) + goto magic; + + if (memcmp(vs->type.fat.magic, "FAT16 ", 8) == 0) + goto magic; + + if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0) + goto magic; + + if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) + goto magic; + + /* some old floppies don't have a magic, so we expect the boot code to match */ + + /* boot jump address check */ + if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && + vs->boot_jump[0] != 0xe9) + return -1; + +magic: + /* reserverd sector count */ + if (!vs->reserved) + return -1; + + /* fat count*/ + if (!vs->fats) + return -1; + + /* media check */ + if (vs->media < 0xf8 && vs->media != 0xf0) + return -1; + + /* cluster size check*/ + if (vs->sectors_per_cluster == 0 || + (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) + return -1; + + /* sector size check */ + sector_size = le16_to_cpu(vs->sector_size); + if (sector_size != 0x200 && sector_size != 0x400 && + sector_size != 0x800 && sector_size != 0x1000) + return -1; + + dbg("sector_size 0x%x", sector_size); + dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); + + dir_entries = le16_to_cpu(vs->dir_entries); + reserved = le16_to_cpu(vs->reserved); + dbg("reserved 0x%x", reserved); + + sect_count = le16_to_cpu(vs->sectors); + if (sect_count == 0) + sect_count = le32_to_cpu(vs->total_sect); + dbg("sect_count 0x%x", sect_count); + + fat_length = le16_to_cpu(vs->fat_length); + dbg("fat_length 0x%x", fat_length); + fat32_length = le32_to_cpu(vs->type.fat32.fat32_length); + dbg("fat32_length 0x%x", fat32_length); + + if (fat_length) + fat_size = fat_length * vs->fats; + else if (fat32_length) + fat_size = fat32_length * vs->fats; + else + return -1; + dbg("fat_size 0x%x", fat_size); + + dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + + (sector_size-1)) / sector_size; + dbg("dir_size 0x%x", dir_size); + + cluster_count = sect_count - (reserved + fat_size + dir_size); + cluster_count /= vs->sectors_per_cluster; + dbg("cluster_count 0x%x", cluster_count); + + /* must be FAT32 */ + if (!fat_length && fat32_length) + goto fat32; + + /* cluster_count tells us the format */ + if (cluster_count < FAT12_MAX) + strcpy(id->type_version, "FAT12"); + else if (cluster_count < FAT16_MAX) + strcpy(id->type_version, "FAT16"); + else + goto fat32; + + /* the label may be an attribute in the root directory */ + root_start = (reserved + fat_size) * sector_size; + dbg("root dir start 0x%llx", (unsigned long long) root_start); + root_dir_entries = le16_to_cpu(vs->dir_entries); + dbg("expected entries 0x%x", root_dir_entries); + + buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); + buf = volume_id_get_buffer(id, off + root_start, buf_size); + if (buf == NULL) + goto found; + + dir = (struct vfat_dir_entry*) buf; + + label = get_attr_volume_id(dir, root_dir_entries); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, label, 11); + volume_id_set_label_string(id, label, 11); + } else if (memcmp(vs->type.fat.label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, vs->type.fat.label, 11); + volume_id_set_label_string(id, vs->type.fat.label, 11); + } + volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); + goto found; + +fat32: + strcpy(id->type_version, "FAT32"); + + /* FAT32 root dir is a cluster chain like any other directory */ + buf_size = vs->sectors_per_cluster * sector_size; + root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); + dbg("root dir cluster %u", root_cluster); + start_data_sect = reserved + fat_size; + + next = root_cluster; + maxloop = 100; + while (--maxloop) { + uint32_t next_sect_off; + uint64_t next_off; + uint64_t fat_entry_off; + int count; + + dbg("next cluster %u", next); + next_sect_off = (next - 2) * vs->sectors_per_cluster; + next_off = (start_data_sect + next_sect_off) * sector_size; + dbg("cluster offset 0x%llx", (unsigned long long) next_off); + + /* get cluster */ + buf = volume_id_get_buffer(id, off + next_off, buf_size); + if (buf == NULL) + goto found; + + dir = (struct vfat_dir_entry*) buf; + count = buf_size / sizeof(struct vfat_dir_entry); + dbg("expected entries 0x%x", count); + + label = get_attr_volume_id(dir, count); + if (label) + break; + + /* get FAT entry */ + fat_entry_off = (reserved * sector_size) + (next * sizeof(uint32_t)); + buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); + if (buf == NULL) + goto found; + + /* set next cluster */ + next = le32_to_cpu(*((uint32_t *) buf) & 0x0fffffff); + if (next == 0) + break; + } + if (maxloop == 0) + dbg("reached maximum follow count of root cluster chain, give up"); + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + + if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, label, 11); + volume_id_set_label_string(id, label, 11); + } else if (memcmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, vs->type.fat32.label, 11); + volume_id_set_label_string(id, vs->type.fat32.label, 11); + } + volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "vfat"; + + return 0; +} diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c new file mode 100644 index 0000000000..a6e378dd28 --- /dev/null +++ b/extras/volume_id/lib/hfs.c @@ -0,0 +1,297 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct hfs_finder_info{ + uint32_t boot_folder; + uint32_t start_app; + uint32_t open_folder; + uint32_t os9_folder; + uint32_t reserved; + uint32_t osx_folder; + uint8_t id[8]; +} PACKED; + +struct hfs_mdb { + uint8_t signature[2]; + uint32_t cr_date; + uint32_t ls_Mod; + uint16_t atrb; + uint16_t nm_fls; + uint16_t vbm_st; + uint16_t alloc_ptr; + uint16_t nm_al_blks; + uint32_t al_blk_size; + uint32_t clp_size; + uint16_t al_bl_st; + uint32_t nxt_cnid; + uint16_t free_bks; + uint8_t label_len; + uint8_t label[27]; + uint32_t vol_bkup; + uint16_t vol_seq_num; + uint32_t wr_cnt; + uint32_t xt_clump_size; + uint32_t ct_clump_size; + uint16_t num_root_dirs; + uint32_t file_count; + uint32_t dir_count; + struct hfs_finder_info finder_info; + uint8_t embed_sig[2]; + uint16_t embed_startblock; + uint16_t embed_blockcount; +} PACKED *hfs; + +struct hfsplus_bnode_descriptor { + uint32_t next; + uint32_t prev; + uint8_t type; + uint8_t height; + uint16_t num_recs; + uint16_t reserved; +} PACKED; + +struct hfsplus_bheader_record { + uint16_t depth; + uint32_t root; + uint32_t leaf_count; + uint32_t leaf_head; + uint32_t leaf_tail; + uint16_t node_size; +} PACKED; + +struct hfsplus_catalog_key { + uint16_t key_len; + uint32_t parent_id; + uint16_t unicode_len; + uint8_t unicode[255 * 2]; +} PACKED; + +struct hfsplus_extent { + uint32_t start_block; + uint32_t block_count; +} PACKED; + +#define HFSPLUS_EXTENT_COUNT 8 +struct hfsplus_fork { + uint64_t total_size; + uint32_t clump_size; + uint32_t total_blocks; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; +} PACKED; + +struct hfsplus_vol_header { + uint8_t signature[2]; + uint16_t version; + uint32_t attributes; + uint32_t last_mount_vers; + uint32_t reserved; + uint32_t create_date; + uint32_t modify_date; + uint32_t backup_date; + uint32_t checked_date; + uint32_t file_count; + uint32_t folder_count; + uint32_t blocksize; + uint32_t total_blocks; + uint32_t free_blocks; + uint32_t next_alloc; + uint32_t rsrc_clump_sz; + uint32_t data_clump_sz; + uint32_t next_cnid; + uint32_t write_count; + uint64_t encodings_bmp; + struct hfs_finder_info finder_info; + struct hfsplus_fork alloc_file; + struct hfsplus_fork ext_file; + struct hfsplus_fork cat_file; + struct hfsplus_fork attr_file; + struct hfsplus_fork start_file; +} PACKED *hfsplus; + +#define HFS_SUPERBLOCK_OFFSET 0x400 +#define HFS_NODE_LEAF 0xff +#define HFSPLUS_POR_CNID 1 + +int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off) +{ + unsigned int blocksize; + unsigned int cat_block; + unsigned int ext_block_start; + unsigned int ext_block_count; + int ext; + unsigned int leaf_node_head; + unsigned int leaf_node_count; + unsigned int leaf_node_size; + unsigned int leaf_block; + uint64_t leaf_off; + unsigned int alloc_block_size; + unsigned int alloc_first_block; + unsigned int embed_first_block; + unsigned int record_count; + struct hfsplus_bnode_descriptor *descr; + struct hfsplus_bheader_record *bnode; + struct hfsplus_catalog_key *key; + unsigned int label_len; + struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; + const uint8_t *buf; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + hfs = (struct hfs_mdb *) buf; + if (memcmp(hfs->signature, "BD", 2) != 0) + goto checkplus; + + /* it may be just a hfs wrapper for hfs+ */ + if (memcmp(hfs->embed_sig, "H+", 2) == 0) { + alloc_block_size = be32_to_cpu(hfs->al_blk_size); + dbg("alloc_block_size 0x%x", alloc_block_size); + + alloc_first_block = be16_to_cpu(hfs->al_bl_st); + dbg("alloc_first_block 0x%x", alloc_first_block); + + embed_first_block = be16_to_cpu(hfs->embed_startblock); + dbg("embed_first_block 0x%x", embed_first_block); + + off += (alloc_first_block * 512) + + (embed_first_block * alloc_block_size); + dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + goto checkplus; + } + + if (hfs->label_len > 0 && hfs->label_len < 28) { + volume_id_set_label_raw(id, hfs->label, hfs->label_len); + volume_id_set_label_string(id, hfs->label, hfs->label_len) ; + } + + volume_id_set_uuid(id, hfs->finder_info.id, UUID_HFS); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hfs"; + + return 0; + +checkplus: + hfsplus = (struct hfsplus_vol_header *) buf; + if (memcmp(hfsplus->signature, "H+", 2) == 0) + goto hfsplus; + if (memcmp(hfsplus->signature, "HX", 2) == 0) + goto hfsplus; + return -1; + +hfsplus: + volume_id_set_uuid(id, hfsplus->finder_info.id, UUID_HFS); + + blocksize = be32_to_cpu(hfsplus->blocksize); + dbg("blocksize %u", blocksize); + + memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); + cat_block = be32_to_cpu(extents[0].start_block); + dbg("catalog start block 0x%x", cat_block); + + buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); + if (buf == NULL) + goto found; + + bnode = (struct hfsplus_bheader_record *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + leaf_node_head = be32_to_cpu(bnode->leaf_head); + dbg("catalog leaf node 0x%x", leaf_node_head); + + leaf_node_size = be16_to_cpu(bnode->node_size); + dbg("leaf node size 0x%x", leaf_node_size); + + leaf_node_count = be32_to_cpu(bnode->leaf_count); + dbg("leaf node count 0x%x", leaf_node_count); + if (leaf_node_count == 0) + goto found; + + leaf_block = (leaf_node_head * leaf_node_size) / blocksize; + + /* get physical location */ + for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { + ext_block_start = be32_to_cpu(extents[ext].start_block); + ext_block_count = be32_to_cpu(extents[ext].block_count); + dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); + + if (ext_block_count == 0) + goto found; + + /* this is our extent */ + if (leaf_block < ext_block_count) + break; + + leaf_block -= ext_block_count; + } + if (ext == HFSPLUS_EXTENT_COUNT) + goto found; + dbg("found block in extent %i", ext); + + leaf_off = (ext_block_start + leaf_block) * blocksize; + + buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size); + if (buf == NULL) + goto found; + + descr = (struct hfsplus_bnode_descriptor *) buf; + dbg("descriptor type 0x%x", descr->type); + + record_count = be16_to_cpu(descr->num_recs); + dbg("number of records %u", record_count); + if (record_count == 0) + goto found; + + if (descr->type != HFS_NODE_LEAF) + goto found; + + key = (struct hfsplus_catalog_key *) + &buf[sizeof(struct hfsplus_bnode_descriptor)]; + + dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); + if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) + goto found; + + label_len = be16_to_cpu(key->unicode_len) * 2; + dbg("label unicode16 len %i", label_len); + volume_id_set_label_raw(id, key->unicode, label_len); + volume_id_set_label_unicode16(id, key->unicode, BE, label_len); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hfsplus"; + + return 0; +} diff --git a/extras/volume_id/lib/highpoint.c b/extras/volume_id/lib/highpoint.c new file mode 100644 index 0000000000..deba540ad5 --- /dev/null +++ b/extras/volume_id/lib/highpoint.c @@ -0,0 +1,96 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct hpt37x_meta { + uint8_t filler1[32]; + uint32_t magic; +} PACKED; + +struct hpt45x_meta { + uint32_t magic; +} PACKED; + +#define HPT37X_CONFIG_OFF 0x1200 +#define HPT37X_MAGIC_OK 0x5a7816f0 +#define HPT37X_MAGIC_BAD 0x5a7816fd + +#define HPT45X_MAGIC_OK 0x5a7816f3 +#define HPT45X_MAGIC_BAD 0x5a7816fd + + +int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct hpt37x_meta *hpt; + uint32_t magic; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); + if (buf == NULL) + return -1; + + hpt = (struct hpt37x_meta *) buf; + magic = le32_to_cpu(hpt->magic); + if (magic != HPT37X_MAGIC_OK && magic != HPT37X_MAGIC_BAD) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "highpoint_raid_member"; + + return 0; +} + +int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + struct hpt45x_meta *hpt; + uint64_t meta_off; + uint32_t magic; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-11) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + hpt = (struct hpt45x_meta *) buf; + magic = le32_to_cpu(hpt->magic); + if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "highpoint_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c new file mode 100644 index 0000000000..3e9589fcca --- /dev/null +++ b/extras/volume_id/lib/hpfs.c @@ -0,0 +1,56 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct hpfs_super +{ + uint8_t magic[4]; + uint8_t version; +} PACKED; + +#define HPFS_SUPERBLOCK_OFFSET 0x2000 + +int volume_id_probe_hpfs(struct volume_id *id, uint64_t off) +{ + struct hpfs_super *hs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); + if (hs == NULL) + return -1; + + if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) { + sprintf(id->type_version, "%u", hs->version); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hpfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c new file mode 100644 index 0000000000..7b78a7e992 --- /dev/null +++ b/extras/volume_id/lib/iso9660.c @@ -0,0 +1,124 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +#define ISO_SUPERBLOCK_OFFSET 0x8000 +#define ISO_SECTOR_SIZE 0x800 +#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) +#define ISO_VD_PRIMARY 0x1 +#define ISO_VD_SUPPLEMENTARY 0x2 +#define ISO_VD_END 0xff +#define ISO_VD_MAX 16 + +struct iso_volume_descriptor { + uint8_t vd_type; + uint8_t vd_id[5]; + uint8_t vd_version; + uint8_t flags; + uint8_t system_id[32]; + uint8_t volume_id[32]; + uint8_t unused[8]; + uint8_t space_size[8]; + uint8_t escape_sequences[8]; +} PACKED; + +struct high_sierra_volume_descriptor { + uint8_t foo[8]; + uint8_t type; + uint8_t id[4]; + uint8_t version; +} PACKED; + +int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) +{ + uint8_t *buf; + struct iso_volume_descriptor *is; + struct high_sierra_volume_descriptor *hs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + is = (struct iso_volume_descriptor *) buf; + + if (memcmp(is->vd_id, "CD001", 5) == 0) { + int vd_offset; + int i; + + dbg("read label from PVD"); + volume_id_set_label_raw(id, is->volume_id, 32); + volume_id_set_label_string(id, is->volume_id, 32); + + dbg("looking for SVDs"); + vd_offset = ISO_VD_OFFSET; + for (i = 0; i < ISO_VD_MAX; i++) { + uint8_t svd_label[64]; + + is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200); + if (is == NULL || is->vd_type == ISO_VD_END) + break; + if (is->vd_type != ISO_VD_SUPPLEMENTARY) + continue; + + dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset)); + if (memcmp(is->escape_sequences, "%/@", 3) == 0|| + memcmp(is->escape_sequences, "%/C", 3) == 0|| + memcmp(is->escape_sequences, "%/E", 3) == 0) { + dbg("Joliet extension found"); + volume_id_set_unicode16((char *)svd_label, sizeof(svd_label), is->volume_id, BE, 32); + if (memcmp(id->label, svd_label, 16) == 0) { + dbg("SVD label is identical, use the possibly longer PVD one"); + break; + } + + volume_id_set_label_raw(id, is->volume_id, 32); + volume_id_set_label_string(id, svd_label, 32); + strcpy(id->type_version, "Joliet Extension"); + goto found; + } + vd_offset += ISO_SECTOR_SIZE; + } + goto found; + } + + hs = (struct high_sierra_volume_descriptor *) buf; + + if (memcmp(hs->id, "CDROM", 5) == 0) { + strcpy(id->type_version, "High Sierra"); + goto found; + } + + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "iso9660"; + + return 0; +} diff --git a/extras/volume_id/lib/isw_raid.c b/extras/volume_id/lib/isw_raid.c new file mode 100644 index 0000000000..6465a31bf5 --- /dev/null +++ b/extras/volume_id/lib/isw_raid.c @@ -0,0 +1,66 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct isw_meta { + uint8_t sig[32]; + uint32_t check_sum; + uint32_t mpb_size; + uint32_t family_num; + uint32_t generation_num; +} PACKED; + +#define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " + + +int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct isw_meta *isw; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-2) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + isw = (struct isw_meta *) buf; + if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + memcpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); + id->type = "isw_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c new file mode 100644 index 0000000000..b230fb258c --- /dev/null +++ b/extras/volume_id/lib/jfs.c @@ -0,0 +1,65 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct jfs_super_block { + uint8_t magic[4]; + uint32_t version; + uint64_t size; + uint32_t bsize; + uint32_t dummy1; + uint32_t pbsize; + uint32_t dummy2[27]; + uint8_t uuid[16]; + uint8_t label[16]; + uint8_t loguuid[16]; +} PACKED; + +#define JFS_SUPERBLOCK_OFFSET 0x8000 + +int volume_id_probe_jfs(struct volume_id *id, uint64_t off) +{ + struct jfs_super_block *js; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); + if (js == NULL) + return -1; + + if (memcmp(js->magic, "JFS1", 4) != 0) + return -1; + + volume_id_set_label_raw(id, js->label, 16); + volume_id_set_label_string(id, js->label, 16); + volume_id_set_uuid(id, js->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "jfs"; + + return 0; +} diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h new file mode 100644 index 0000000000..7faf8d8af3 --- /dev/null +++ b/extras/volume_id/lib/libvolume_id.h @@ -0,0 +1,111 @@ +/* + * volume_id - reads volume label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _LIBVOLUME_ID_H_ +#define _LIBVOLUME_ID_H_ + +#include +#include + +#ifndef PACKED +#define PACKED __attribute__((packed)) +#endif + + +typedef void (*volume_id_log_fn)(int priority, const char *file, int line, const char *format, ...) + __attribute__ ((format(printf, 4, 5))); + +extern volume_id_log_fn volume_id_log; + +#define VOLUME_ID_LABEL_SIZE 64 +#define VOLUME_ID_UUID_SIZE 36 +#define VOLUME_ID_FORMAT_SIZE 32 +#define VOLUME_ID_PATH_MAX 256 +#define VOLUME_ID_PARTITIONS_MAX 256 + +enum volume_id_usage { + VOLUME_ID_UNUSED, + VOLUME_ID_UNPROBED, + VOLUME_ID_OTHER, + VOLUME_ID_FILESYSTEM, + VOLUME_ID_RAID, + VOLUME_ID_DISKLABEL, + VOLUME_ID_CRYPTO, +}; + +struct volume_id { + uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; + size_t label_raw_len; + char label[VOLUME_ID_LABEL_SIZE+1]; + uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; + size_t uuid_raw_len; + char uuid[VOLUME_ID_UUID_SIZE+1]; + enum volume_id_usage usage_id; + char *usage; + char *type; + char type_version[VOLUME_ID_FORMAT_SIZE]; + + int fd; + uint8_t *sbbuf; + size_t sbbuf_len; + uint8_t *seekbuf; + uint64_t seekbuf_off; + size_t seekbuf_len; + int fd_close:1; +}; + +extern struct volume_id *volume_id_open_fd(int fd); +extern struct volume_id *volume_id_open_node(const char *path); +extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern void volume_id_close(struct volume_id *id); + +/* filesystems */ +extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ext(struct volume_id *id, uint64_t off); +extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off); +extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); +extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); +extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_minix(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); +extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off); +extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); +extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off); + +/* special formats */ +extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); +extern int volume_id_probe_luks(struct volume_id *id, uint64_t off); + +/* raid */ +extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off); +extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); + +/* bios raid */ +extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); +extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); + +#endif diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c new file mode 100644 index 0000000000..85e8d8109b --- /dev/null +++ b/extras/volume_id/lib/linux_raid.c @@ -0,0 +1,87 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct mdp_super_block { + uint32_t md_magic; + uint32_t major_version; + uint32_t minor_version; + uint32_t patch_version; + uint32_t gvalid_words; + uint32_t set_uuid0; + uint32_t ctime; + uint32_t level; + uint32_t size; + uint32_t nr_disks; + uint32_t raid_disks; + uint32_t md_minor; + uint32_t not_persistent; + uint32_t set_uuid1; + uint32_t set_uuid2; + uint32_t set_uuid3; +} PACKED *mdp; + +#define MD_RESERVED_BYTES 0x10000 +#define MD_MAGIC 0xa92b4efc + +int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t sboff; + uint8_t uuid[16]; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; + buf = volume_id_get_buffer(id, off + sboff, 0x800); + if (buf == NULL) + return -1; + + mdp = (struct mdp_super_block *) buf; + + if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) + return -1; + + memcpy(uuid, &mdp->set_uuid0, 4); + memcpy(&uuid[4], &mdp->set_uuid1, 12); + volume_id_set_uuid(id, uuid, UUID_DCE); + + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", + le32_to_cpu(mdp->major_version), + le32_to_cpu(mdp->minor_version), + le32_to_cpu(mdp->patch_version)); + + dbg("found raid signature"); + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "linux_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c new file mode 100644 index 0000000000..0193648c9e --- /dev/null +++ b/extras/volume_id/lib/linux_swap.c @@ -0,0 +1,76 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct swap_header_v1_2 { + uint8_t bootbits[1024]; + uint32_t version; + uint32_t last_page; + uint32_t nr_badpages; + uint8_t uuid[16]; + uint8_t volume_name[16]; +} PACKED *sw; + +#define LARGEST_PAGESIZE 0x4000 + +int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + unsigned int page; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + /* the swap signature is at the end of the PAGE_SIZE */ + for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { + buf = volume_id_get_buffer(id, off + page-10, 10); + if (buf == NULL) + return -1; + + if (memcmp(buf, "SWAP-SPACE", 10) == 0) { + strcpy(id->type_version, "1"); + goto found; + } + + if (memcmp(buf, "SWAPSPACE2", 10) == 0) { + sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); + if (sw == NULL) + return -1; + strcpy(id->type_version, "2"); + volume_id_set_label_raw(id, sw->volume_name, 16); + volume_id_set_label_string(id, sw->volume_name, 16); + volume_id_set_uuid(id, sw->uuid, UUID_DCE); + goto found; + } + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_OTHER); + id->type = "swap"; + + return 0; +} diff --git a/extras/volume_id/lib/lsi_raid.c b/extras/volume_id/lib/lsi_raid.c new file mode 100644 index 0000000000..f1db4a6e50 --- /dev/null +++ b/extras/volume_id/lib/lsi_raid.c @@ -0,0 +1,60 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct lsi_meta { + uint8_t sig[6]; +} PACKED; + +#define LSI_SIGNATURE "$XIDE$" + +int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct lsi_meta *lsi; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + lsi = (struct lsi_meta *) buf; + if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "lsi_mega_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/luks.c b/extras/volume_id/lib/luks.c new file mode 100644 index 0000000000..64de85ac21 --- /dev/null +++ b/extras/volume_id/lib/luks.c @@ -0,0 +1,82 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 W. Michael Petullo + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +#define SECTOR_SHIFT 9 +#define SECTOR_SIZE (1 << SECTOR_SHIFT) + +#define LUKS_CIPHERNAME_L 32 +#define LUKS_CIPHERMODE_L 32 +#define LUKS_HASHSPEC_L 32 +#define LUKS_DIGESTSIZE 20 +#define LUKS_SALTSIZE 32 +#define LUKS_NUMKEYS 8 + +const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; +#define LUKS_MAGIC_L 6 +#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) +#define UUID_STRING_L 40 + +struct luks_phdr { + uint8_t magic[LUKS_MAGIC_L]; + uint16_t version; + uint8_t cipherName[LUKS_CIPHERNAME_L]; + uint8_t cipherMode[LUKS_CIPHERMODE_L]; + uint8_t hashSpec[LUKS_HASHSPEC_L]; + uint32_t payloadOffset; + uint32_t keyBytes; + uint8_t mkDigest[LUKS_DIGESTSIZE]; + uint8_t mkDigestSalt[LUKS_SALTSIZE]; + uint32_t mkDigestIterations; + uint8_t uuid[UUID_STRING_L]; + struct { + uint32_t active; + uint32_t passwordIterations; + uint8_t passwordSalt[LUKS_SALTSIZE]; + uint32_t keyMaterialOffset; + uint32_t stripes; + } keyblock[LUKS_NUMKEYS]; +}; + +int volume_id_probe_luks(struct volume_id *id, uint64_t off) +{ + struct luks_phdr *header; + + header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE); + if (header == NULL) + return -1; + + if (memcmp(header->magic, LUKS_MAGIC, LUKS_MAGIC_L)) + return -1; + + volume_id_set_usage(id, VOLUME_ID_CRYPTO); + volume_id_set_uuid(id, header->uuid, UUID_DCE_STRING); + + id->type = "crypto_LUKS"; + + return 0; +} diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c new file mode 100644 index 0000000000..47d84b0968 --- /dev/null +++ b/extras/volume_id/lib/lvm.c @@ -0,0 +1,97 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct lvm1_super_block { + uint8_t id[2]; +} PACKED; + +struct lvm2_super_block { + uint8_t id[8]; + uint64_t sector_xl; + uint32_t crc_xl; + uint32_t offset_xl; + uint8_t type[8]; +} PACKED; + +#define LVM1_SB_OFF 0x400 +#define LVM1_MAGIC "HM" + +int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct lvm1_super_block *lvm; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); + if (buf == NULL) + return -1; + + lvm = (struct lvm1_super_block *) buf; + + if (memcmp(lvm->id, LVM1_MAGIC, 2) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "LVM1_member"; + + return 0; +} + +#define LVM2_LABEL_ID "LABELONE" +#define LVM2LABEL_SCAN_SECTORS 4 + +int volume_id_probe_lvm2(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + unsigned int soff; + struct lvm2_super_block *lvm; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); + if (buf == NULL) + return -1; + + + for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { + lvm = (struct lvm2_super_block *) &buf[soff]; + + if (memcmp(lvm->id, LVM2_LABEL_ID, 8) == 0) + goto found; + } + + return -1; + +found: + memcpy(id->type_version, lvm->type, 8); + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "LVM2_member"; + + return 0; +} diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c new file mode 100644 index 0000000000..75e9c3acbd --- /dev/null +++ b/extras/volume_id/lib/minix.c @@ -0,0 +1,84 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct minix_super_block +{ + uint16_t s_ninodes; + uint16_t s_nzones; + uint16_t s_imap_blocks; + uint16_t s_zmap_blocks; + uint16_t s_firstdatazone; + uint16_t s_log_zone_size; + uint32_t s_max_size; + uint16_t s_magic; + uint16_t s_state; + uint32_t s_zones; +} PACKED; + +#define MINIX_SUPERBLOCK_OFFSET 0x400 + +int volume_id_probe_minix(struct volume_id *id, uint64_t off) +{ + struct minix_super_block *ms; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + ms = (struct minix_super_block *) volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); + if (ms == NULL) + return -1; + + if (le16_to_cpu(ms->s_magic) == 0x137f) { + strcpy(id->type_version, "1"); + goto found; + } + + if (le16_to_cpu(ms->s_magic) == 0x1387) { + strcpy(id->type_version, "1"); + goto found; + } + + if (le16_to_cpu(ms->s_magic) == 0x2468) { + strcpy(id->type_version, "2"); + goto found; + } + + if (le16_to_cpu(ms->s_magic) == 0x2478) { + strcpy(id->type_version, "2"); + goto found; + } + + goto exit; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "minix"; + return 0; + +exit: + return -1; +} diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c new file mode 100644 index 0000000000..23c64fc307 --- /dev/null +++ b/extras/volume_id/lib/ntfs.c @@ -0,0 +1,194 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct ntfs_super_block { + uint8_t jump[3]; + uint8_t oem_id[8]; + uint16_t bytes_per_sector; + uint8_t sectors_per_cluster; + uint16_t reserved_sectors; + uint8_t fats; + uint16_t root_entries; + uint16_t sectors; + uint8_t media_type; + uint16_t sectors_per_fat; + uint16_t sectors_per_track; + uint16_t heads; + uint32_t hidden_sectors; + uint32_t large_sectors; + uint16_t unused[2]; + uint64_t number_of_sectors; + uint64_t mft_cluster_location; + uint64_t mft_mirror_cluster_location; + int8_t cluster_per_mft_record; + uint8_t reserved1[3]; + int8_t cluster_per_index_record; + uint8_t reserved2[3]; + uint8_t volume_serial[8]; + uint16_t checksum; +} PACKED *ns; + +struct master_file_table_record { + uint8_t magic[4]; + uint16_t usa_ofs; + uint16_t usa_count; + uint64_t lsn; + uint16_t sequence_number; + uint16_t link_count; + uint16_t attrs_offset; + uint16_t flags; + uint32_t bytes_in_use; + uint32_t bytes_allocated; +} PACKED *mftr; + +struct file_attribute { + uint32_t type; + uint32_t len; + uint8_t non_resident; + uint8_t name_len; + uint16_t name_offset; + uint16_t flags; + uint16_t instance; + uint32_t value_len; + uint16_t value_offset; +} PACKED *attr; + +struct volume_info { + uint64_t reserved; + uint8_t major_ver; + uint8_t minor_ver; +} PACKED *info; + +#define MFT_RECORD_VOLUME 3 +#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 +#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 +#define MFT_RECORD_ATTR_OBJECT_ID 0x40 +#define MFT_RECORD_ATTR_END 0xffffffffu + +int volume_id_probe_ntfs(struct volume_id *id, uint64_t off) +{ + unsigned int sector_size; + unsigned int cluster_size; + uint64_t mft_cluster; + uint64_t mft_off; + unsigned int mft_record_size; + unsigned int attr_type; + unsigned int attr_off; + unsigned int attr_len; + unsigned int val_off; + unsigned int val_len; + const uint8_t *buf; + const uint8_t *val; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); + if (ns == NULL) + return -1; + + if (memcmp(ns->oem_id, "NTFS", 4) != 0) + return -1; + + volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS); + + sector_size = le16_to_cpu(ns->bytes_per_sector); + cluster_size = ns->sectors_per_cluster * sector_size; + mft_cluster = le64_to_cpu(ns->mft_cluster_location); + mft_off = mft_cluster * cluster_size; + + if (ns->cluster_per_mft_record < 0) + /* size = -log2(mft_record_size); normally 1024 Bytes */ + mft_record_size = 1 << -ns->cluster_per_mft_record; + else + mft_record_size = ns->cluster_per_mft_record * cluster_size; + + dbg("sectorsize 0x%x", sector_size); + dbg("clustersize 0x%x", cluster_size); + dbg("mftcluster %llu", (unsigned long long) mft_cluster); + dbg("mftoffset 0x%llx", (unsigned long long) mft_off); + dbg("cluster per mft_record %i", ns->cluster_per_mft_record); + dbg("mft record size %i", mft_record_size); + + buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), + mft_record_size); + if (buf == NULL) + goto found; + + mftr = (struct master_file_table_record*) buf; + + dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); + if (memcmp(mftr->magic, "FILE", 4) != 0) + goto found; + + attr_off = le16_to_cpu(mftr->attrs_offset); + dbg("file $Volume's attributes are at offset %i", attr_off); + + while (1) { + attr = (struct file_attribute*) &buf[attr_off]; + attr_type = le32_to_cpu(attr->type); + attr_len = le16_to_cpu(attr->len); + val_off = le16_to_cpu(attr->value_offset); + val_len = le32_to_cpu(attr->value_len); + attr_off += attr_len; + + if (attr_len == 0) + break; + + if (attr_off >= mft_record_size) + break; + + if (attr_type == MFT_RECORD_ATTR_END) + break; + + dbg("found attribute type 0x%x, len %i, at offset %i", + attr_type, attr_len, attr_off); + + if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { + dbg("found info, len %i", val_len); + info = (struct volume_info*) (((uint8_t *) attr) + val_off); + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", info->major_ver, info->minor_ver); + } + + if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { + dbg("found label, len %i", val_len); + if (val_len > VOLUME_ID_LABEL_SIZE) + val_len = VOLUME_ID_LABEL_SIZE; + + val = ((uint8_t *) attr) + val_off; + volume_id_set_label_raw(id, val, val_len); + volume_id_set_label_unicode16(id, val, LE, val_len); + } + } + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "ntfs"; + + return 0; +} diff --git a/extras/volume_id/lib/nvidia_raid.c b/extras/volume_id/lib/nvidia_raid.c new file mode 100644 index 0000000000..10c1c714f7 --- /dev/null +++ b/extras/volume_id/lib/nvidia_raid.c @@ -0,0 +1,64 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct nvidia_meta { + uint8_t vendor[8]; + uint32_t size; + uint32_t chksum; + uint16_t version; +} PACKED; + +#define NVIDIA_SIGNATURE "NVIDIA" + +int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct nvidia_meta *nv; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-2) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + nv = (struct nvidia_meta *) buf; + if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le16_to_cpu(nv->version)); + id->type = "nvidia_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c new file mode 100644 index 0000000000..b376ead833 --- /dev/null +++ b/extras/volume_id/lib/ocfs.c @@ -0,0 +1,192 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Andre Masella + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + + +struct ocfs1_super_block_header { + uint32_t minor_version; + uint32_t major_version; + uint8_t signature[128]; + uint8_t mount_point[128]; + uint64_t serial_num; + uint64_t device_size; + uint64_t start_off; + uint64_t bitmap_off; + uint64_t publ_off; + uint64_t vote_off; + uint64_t root_bitmap_off; + uint64_t data_start_off; + uint64_t root_bitmap_size; + uint64_t root_off; + uint64_t root_size; + uint64_t cluster_size; + uint64_t num_nodes; + uint64_t num_clusters; + uint64_t dir_node_size; + uint64_t file_node_size; + uint64_t internal_off; + uint64_t node_cfg_off; + uint64_t node_cfg_size; + uint64_t new_cfg_off; + uint32_t prot_bits; + int32_t excl_mount; +} PACKED; + +struct ocfs1_super_block_label { + struct ocfs1_disk_lock { + uint32_t curr_master; + uint8_t file_lock; + uint8_t compat_pad[3]; + uint64_t last_write_time; + uint64_t last_read_time; + uint32_t writer_node_num; + uint32_t reader_node_num; + uint64_t oin_node_map; + uint64_t dlock_seq_num; + } PACKED disk_lock; + uint8_t label[64]; + uint16_t label_len; + uint8_t vol_id[16]; + uint16_t vol_id_len; + uint8_t cluster_name[64]; + uint16_t cluster_name_len; +} PACKED; + +struct ocfs2_super_block { + uint8_t i_signature[8]; + uint32_t i_generation; + int16_t i_suballoc_slot; + uint16_t i_suballoc_bit; + uint32_t i_reserved0; + uint32_t i_clusters; + uint32_t i_uid; + uint32_t i_gid; + uint64_t i_size; + uint16_t i_mode; + uint16_t i_links_count; + uint32_t i_flags; + uint64_t i_atime; + uint64_t i_ctime; + uint64_t i_mtime; + uint64_t i_dtime; + uint64_t i_blkno; + uint64_t i_last_eb_blk; + uint32_t i_fs_generation; + uint32_t i_atime_nsec; + uint32_t i_ctime_nsec; + uint32_t i_mtime_nsec; + uint64_t i_reserved1[9]; + uint64_t i_pad1; + uint16_t s_major_rev_level; + uint16_t s_minor_rev_level; + uint16_t s_mnt_count; + int16_t s_max_mnt_count; + uint16_t s_state; + uint16_t s_errors; + uint32_t s_checkinterval; + uint64_t s_lastcheck; + uint32_t s_creator_os; + uint32_t s_feature_compat; + uint32_t s_feature_incompat; + uint32_t s_feature_ro_compat; + uint64_t s_root_blkno; + uint64_t s_system_dir_blkno; + uint32_t s_blocksize_bits; + uint32_t s_clustersize_bits; + uint16_t s_max_slots; + uint16_t s_reserved1; + uint32_t s_reserved2; + uint64_t s_first_cluster_group; + uint8_t s_label[64]; + uint8_t s_uuid[16]; +} PACKED; + +int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct ocfs1_super_block_header *osh; + struct ocfs1_super_block_label *osl; + + buf = volume_id_get_buffer(id, off, 0x200); + if (buf == NULL) + return -1; + + osh = (struct ocfs1_super_block_header *) buf; + if (memcmp(osh->signature, "OracleCFS", 9) != 0) + return -1; + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", osh->major_version, osh->minor_version); + + dbg("found OracleCFS signature, now reading label"); + buf = volume_id_get_buffer(id, off + 0x200, 0x200); + if (buf == NULL) + return -1; + + osl = (struct ocfs1_super_block_label *) buf; + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + if (osl->label_len <= 64) { + volume_id_set_label_raw(id, osl->label, 64); + volume_id_set_label_string(id, osl->label, 64); + } + if (osl->vol_id_len == 16) + volume_id_set_uuid(id, osl->vol_id, UUID_DCE); + id->type = "ocfs"; + return 0; +} + +#define OCFS2_MAX_BLOCKSIZE 0x1000 +#define OCFS2_SUPER_BLOCK_BLKNO 2 + +int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) +{ + const uint8_t *buf; + struct ocfs2_super_block *os; + size_t blksize; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { + buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); + if (buf == NULL) + return -1; + + os = (struct ocfs2_super_block *) buf; + if (memcmp(os->i_signature, "OCFSV2", 6) != 0) + continue; + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + volume_id_set_label_raw(id, os->s_label, 64); + volume_id_set_label_string(id, os->s_label, 64); + volume_id_set_uuid(id, os->s_uuid, UUID_DCE); + snprintf(id->type_version, sizeof(id->type_version)-1, + "%u.%u", os->s_major_rev_level, os->s_minor_rev_level); + id->type = "ocfs2"; + return 0; + } + return -1; +} diff --git a/extras/volume_id/lib/promise_raid.c b/extras/volume_id/lib/promise_raid.c new file mode 100644 index 0000000000..2a2ce1689e --- /dev/null +++ b/extras/volume_id/lib/promise_raid.c @@ -0,0 +1,70 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct promise_meta { + uint8_t sig[24]; +} PACKED; + +#define PDC_CONFIG_OFF 0x1200 +#define PDC_SIGNATURE "Promise Technology, Inc." + +int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + struct promise_meta *pdc; + unsigned int i; + static unsigned int sectors[] = { + 63, 255, 256, 16, 399, 0 + }; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x40000) + return -1; + + for (i = 0; sectors[i] != 0; i++) { + uint64_t meta_off; + + meta_off = ((size / 0x200) - sectors[i]) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + pdc = (struct promise_meta *) buf; + if (memcmp(pdc->sig, PDC_SIGNATURE, sizeof(PDC_SIGNATURE)-1) == 0) + goto found; + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "promise_fasttrack_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c new file mode 100644 index 0000000000..b5706f86e0 --- /dev/null +++ b/extras/volume_id/lib/reiserfs.c @@ -0,0 +1,118 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2005 Tobias Klauser + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct reiserfs_super_block { + uint32_t blocks_count; + uint32_t free_blocks; + uint32_t root_block; + uint32_t journal_block; + uint32_t journal_dev; + uint32_t orig_journal_size; + uint32_t dummy2[5]; + uint16_t blocksize; + uint16_t dummy3[3]; + uint8_t magic[12]; + uint32_t dummy4[5]; + uint8_t uuid[16]; + uint8_t label[16]; +} PACKED; + +struct reiser4_super_block { + uint8_t magic[16]; + uint16_t dummy[2]; + uint8_t uuid[16]; + uint8_t label[16]; + uint64_t dummy2; +} PACKED; + +#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 +#define REISERFS_SUPERBLOCK_OFFSET 0x10000 + +int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) +{ + struct reiserfs_super_block *rs; + struct reiser4_super_block *rs4; + uint8_t *buf; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + rs = (struct reiserfs_super_block *) buf;; + if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { + strcpy(id->type_version, "3.5"); + id->type = "reiserfs"; + goto found; + } + if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { + strcpy(id->type_version, "3.6"); + id->type = "reiserfs"; + goto found_label; + } + if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { + strcpy(id->type_version, "JR"); + id->type = "reiserfs"; + goto found_label; + } + + rs4 = (struct reiser4_super_block *) buf; + if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) { + strcpy(id->type_version, "4"); + volume_id_set_label_raw(id, rs4->label, 16); + volume_id_set_label_string(id, rs4->label, 16); + volume_id_set_uuid(id, rs4->uuid, UUID_DCE); + id->type = "reiser4"; + goto found; + } + + buf = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) + return -1; + + rs = (struct reiserfs_super_block *) buf; + if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { + strcpy(id->type_version, "3.5"); + id->type = "reiserfs"; + goto found; + } + + return -1; + +found_label: + volume_id_set_label_raw(id, rs->label, 16); + volume_id_set_label_string(id, rs->label, 16); + volume_id_set_uuid(id, rs->uuid, UUID_DCE); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + + return 0; +} diff --git a/extras/volume_id/lib/romfs.c b/extras/volume_id/lib/romfs.c new file mode 100644 index 0000000000..8bb2a0018a --- /dev/null +++ b/extras/volume_id/lib/romfs.c @@ -0,0 +1,60 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct romfs_super { + uint8_t magic[8]; + uint32_t size; + uint32_t checksum; + uint8_t name[0]; +} PACKED; + +int volume_id_probe_romfs(struct volume_id *id, uint64_t off) +{ + struct romfs_super *rfs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); + if (rfs == NULL) + return -1; + + if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { + size_t len = strlen((char *)rfs->name); + + if (len) { + volume_id_set_label_raw(id, rfs->name, len); + volume_id_set_label_string(id, rfs->name, len); + } + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "romfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/lib/silicon_raid.c b/extras/volume_id/lib/silicon_raid.c new file mode 100644 index 0000000000..017b023e27 --- /dev/null +++ b/extras/volume_id/lib/silicon_raid.c @@ -0,0 +1,77 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct silicon_meta { + uint8_t unknown0[0x2E]; + uint8_t ascii_version[0x36 - 0x2E]; + uint8_t diskname[0x56 - 0x36]; + uint8_t unknown1[0x60 - 0x56]; + uint32_t magic; + uint32_t unknown1a[0x6C - 0x64]; + uint32_t array_sectors_low; + uint32_t array_sectors_high; + uint8_t unknown2[0x78 - 0x74]; + uint32_t thisdisk_sectors; + uint8_t unknown3[0x100 - 0x7C]; + uint8_t unknown4[0x104 - 0x100]; + uint16_t product_id; + uint16_t vendor_id; + uint16_t minor_ver; + uint16_t major_ver; +} PACKED; + +#define SILICON_MAGIC 0x2F000000 + +int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct silicon_meta *sil; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + sil = (struct silicon_meta *) buf; + if (le32_to_cpu(sil->magic) != SILICON_MAGIC) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", + le16_to_cpu(sil->major_ver), le16_to_cpu(sil->minor_ver)); + id->type = "silicon_medley_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c new file mode 100644 index 0000000000..bdb1f16628 --- /dev/null +++ b/extras/volume_id/lib/squashfs.c @@ -0,0 +1,52 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2006 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +#define SQUASHFS_MAGIC 0x73717368 + +struct squashfs_super { + uint32_t s_magic; +} PACKED; + +int volume_id_probe_squashfs(struct volume_id *id, uint64_t off) +{ + struct squashfs_super *sqs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + sqs = (struct squashfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); + if (sqs == NULL) + return -1; + + if (sqs->s_magic == SQUASHFS_MAGIC || sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) { + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "squashfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/lib/sysv.c b/extras/volume_id/lib/sysv.c new file mode 100644 index 0000000000..52349c0623 --- /dev/null +++ b/extras/volume_id/lib/sysv.c @@ -0,0 +1,133 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +#define SYSV_NICINOD 100 +#define SYSV_NICFREE 50 + +struct sysv_super +{ + uint16_t s_isize; + uint16_t s_pad0; + uint32_t s_fsize; + uint16_t s_nfree; + uint16_t s_pad1; + uint32_t s_free[SYSV_NICFREE]; + uint16_t s_ninode; + uint16_t s_pad2; + uint16_t s_inode[SYSV_NICINOD]; + uint8_t s_flock; + uint8_t s_ilock; + uint8_t s_fmod; + uint8_t s_ronly; + uint32_t s_time; + uint16_t s_dinfo[4]; + uint32_t s_tfree; + uint16_t s_tinode; + uint16_t s_pad3; + uint8_t s_fname[6]; + uint8_t s_fpack[6]; + uint32_t s_fill[12]; + uint32_t s_state; + uint32_t s_magic; + uint32_t s_type; +} PACKED; + +#define XENIX_NICINOD 100 +#define XENIX_NICFREE 100 + +struct xenix_super { + uint16_t s_isize; + uint32_t s_fsize; + uint16_t s_nfree; + uint32_t s_free[XENIX_NICFREE]; + uint16_t s_ninode; + uint16_t s_inode[XENIX_NICINOD]; + uint8_t s_flock; + uint8_t s_ilock; + uint8_t s_fmod; + uint8_t s_ronly; + uint32_t s_time; + uint32_t s_tfree; + uint16_t s_tinode; + uint16_t s_dinfo[4]; + uint8_t s_fname[6]; + uint8_t s_fpack[6]; + uint8_t s_clean; + uint8_t s_fill[371]; + uint32_t s_magic; + uint32_t s_type; +} PACKED; + +#define SYSV_SUPERBLOCK_BLOCK 0x01 +#define SYSV_MAGIC 0xfd187e20 +#define XENIX_SUPERBLOCK_BLOCK 0x18 +#define XENIX_MAGIC 0x2b5544 +#define SYSV_MAX_BLOCKSIZE 0x800 + +int volume_id_probe_sysv(struct volume_id *id, uint64_t off) +{ + struct sysv_super *vs; + struct xenix_super *xs; + unsigned int boff; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { + vs = (struct sysv_super *) + volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200); + if (vs == NULL) + return -1; + + if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) { + volume_id_set_label_raw(id, vs->s_fname, 6); + volume_id_set_label_string(id, vs->s_fname, 6); + id->type = "sysv"; + goto found; + } + } + + for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { + xs = (struct xenix_super *) + volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200); + if (xs == NULL) + return -1; + + if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) { + volume_id_set_label_raw(id, xs->s_fname, 6); + volume_id_set_label_string(id, xs->s_fname, 6); + id->type = "xenix"; + goto found; + } + } + + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + return 0; +} diff --git a/extras/volume_id/lib/udf.c b/extras/volume_id/lib/udf.c new file mode 100644 index 0000000000..d7497ec51b --- /dev/null +++ b/extras/volume_id/lib/udf.c @@ -0,0 +1,178 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct volume_descriptor { + struct descriptor_tag { + uint16_t id; + uint16_t version; + uint8_t checksum; + uint8_t reserved; + uint16_t serial; + uint16_t crc; + uint16_t crc_len; + uint32_t location; + } PACKED tag; + union { + struct anchor_descriptor { + uint32_t length; + uint32_t location; + } PACKED anchor; + struct primary_descriptor { + uint32_t seq_num; + uint32_t desc_num; + struct dstring { + uint8_t clen; + uint8_t c[31]; + } PACKED ident; + } PACKED primary; + } PACKED type; +} PACKED; + +struct volume_structure_descriptor { + uint8_t type; + uint8_t id[5]; + uint8_t version; +} PACKED; + +#define UDF_VSD_OFFSET 0x8000 + +int volume_id_probe_udf(struct volume_id *id, uint64_t off) +{ + struct volume_descriptor *vd; + struct volume_structure_descriptor *vsd; + unsigned int bs; + unsigned int b; + unsigned int type; + unsigned int count; + unsigned int loc; + unsigned int clen; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); + if (vsd == NULL) + return -1; + + if (memcmp(vsd->id, "NSR02", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "NSR03", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "BEA01", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "BOOT2", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "CD001", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "CDW02", 5) == 0) + goto blocksize; + if (memcmp(vsd->id, "TEA03", 5) == 0) + goto blocksize; + return -1; + +blocksize: + /* search the next VSD to get the logical block size of the volume */ + for (bs = 0x800; bs < 0x8000; bs += 0x800) { + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); + if (vsd == NULL) + return -1; + dbg("test for blocksize: 0x%x", bs); + if (vsd->id[0] != '\0') + goto nsr; + } + return -1; + +nsr: + /* search the list of VSDs for a NSR descriptor */ + for (b = 0; b < 64; b++) { + vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); + if (vsd == NULL) + return -1; + + dbg("vsd: %c%c%c%c%c", + vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); + + if (vsd->id[0] == '\0') + return -1; + if (memcmp(vsd->id, "NSR02", 5) == 0) + goto anchor; + if (memcmp(vsd->id, "NSR03", 5) == 0) + goto anchor; + } + return -1; + +anchor: + /* read anchor volume descriptor */ + vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + if (type != 2) /* TAG_ID_AVDP */ + goto found; + + /* get desriptor list address and block count */ + count = le32_to_cpu(vd->type.anchor.length) / bs; + loc = le32_to_cpu(vd->type.anchor.location); + dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); + + /* pick the primary descriptor from the list */ + for (b = 0; b < count; b++) { + vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200); + if (vd == NULL) + return -1; + + type = le16_to_cpu(vd->tag.id); + dbg("descriptor type %i", type); + + /* check validity */ + if (type == 0) + goto found; + if (le32_to_cpu(vd->tag.location) != loc + b) + goto found; + + if (type == 1) /* TAG_ID_PVD */ + goto pvd; + } + goto found; + +pvd: + volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); + + clen = vd->type.primary.ident.clen; + dbg("label string charsize=%i bit", clen); + if (clen == 8) + volume_id_set_label_string(id, vd->type.primary.ident.c, 31); + else if (clen == 16) + volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31); + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "udf"; + + return 0; +} diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c new file mode 100644 index 0000000000..d3960b1bec --- /dev/null +++ b/extras/volume_id/lib/ufs.c @@ -0,0 +1,210 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct ufs_super_block { + uint32_t fs_link; + uint32_t fs_rlink; + uint32_t fs_sblkno; + uint32_t fs_cblkno; + uint32_t fs_iblkno; + uint32_t fs_dblkno; + uint32_t fs_cgoffset; + uint32_t fs_cgmask; + uint32_t fs_time; + uint32_t fs_size; + uint32_t fs_dsize; + uint32_t fs_ncg; + uint32_t fs_bsize; + uint32_t fs_fsize; + uint32_t fs_frag; + uint32_t fs_minfree; + uint32_t fs_rotdelay; + uint32_t fs_rps; + uint32_t fs_bmask; + uint32_t fs_fmask; + uint32_t fs_bshift; + uint32_t fs_fshift; + uint32_t fs_maxcontig; + uint32_t fs_maxbpg; + uint32_t fs_fragshift; + uint32_t fs_fsbtodb; + uint32_t fs_sbsize; + uint32_t fs_csmask; + uint32_t fs_csshift; + uint32_t fs_nindir; + uint32_t fs_inopb; + uint32_t fs_nspf; + uint32_t fs_optim; + uint32_t fs_npsect_state; + uint32_t fs_interleave; + uint32_t fs_trackskew; + uint32_t fs_id[2]; + uint32_t fs_csaddr; + uint32_t fs_cssize; + uint32_t fs_cgsize; + uint32_t fs_ntrak; + uint32_t fs_nsect; + uint32_t fs_spc; + uint32_t fs_ncyl; + uint32_t fs_cpg; + uint32_t fs_ipg; + uint32_t fs_fpg; + struct ufs_csum { + uint32_t cs_ndir; + uint32_t cs_nbfree; + uint32_t cs_nifree; + uint32_t cs_nffree; + } PACKED fs_cstotal; + int8_t fs_fmod; + int8_t fs_clean; + int8_t fs_ronly; + int8_t fs_flags; + union { + struct { + int8_t fs_fsmnt[512]; + uint32_t fs_cgrotor; + uint32_t fs_csp[31]; + uint32_t fs_maxcluster; + uint32_t fs_cpc; + uint16_t fs_opostbl[16][8]; + } PACKED fs_u1; + struct { + int8_t fs_fsmnt[468]; + uint8_t fs_volname[32]; + uint64_t fs_swuid; + int32_t fs_pad; + uint32_t fs_cgrotor; + uint32_t fs_ocsp[28]; + uint32_t fs_contigdirs; + uint32_t fs_csp; + uint32_t fs_maxcluster; + uint32_t fs_active; + int32_t fs_old_cpc; + int32_t fs_maxbsize; + int64_t fs_sparecon64[17]; + int64_t fs_sblockloc; + struct ufs2_csum_total { + uint64_t cs_ndir; + uint64_t cs_nbfree; + uint64_t cs_nifree; + uint64_t cs_nffree; + uint64_t cs_numclusters; + uint64_t cs_spare[3]; + } PACKED fs_cstotal; + struct ufs_timeval { + int32_t tv_sec; + int32_t tv_usec; + } PACKED fs_time; + int64_t fs_size; + int64_t fs_dsize; + uint64_t fs_csaddr; + int64_t fs_pendingblocks; + int32_t fs_pendinginodes; + } PACKED fs_u2; + } fs_u11; + union { + struct { + int32_t fs_sparecon[53]; + int32_t fs_reclaim; + int32_t fs_sparecon2[1]; + int32_t fs_state; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; + } PACKED fs_sun; + struct { + int32_t fs_sparecon[53]; + int32_t fs_reclaim; + int32_t fs_sparecon2[1]; + uint32_t fs_npsect; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; + } PACKED fs_sunx86; + struct { + int32_t fs_sparecon[50]; + int32_t fs_contigsumsize; + int32_t fs_maxsymlinklen; + int32_t fs_inodefmt; + uint32_t fs_maxfilesize[2]; + uint32_t fs_qbmask[2]; + uint32_t fs_qfmask[2]; + int32_t fs_state; + } PACKED fs_44; + } fs_u2; + int32_t fs_postblformat; + int32_t fs_nrpos; + int32_t fs_postbloff; + int32_t fs_rotbloff; + uint32_t fs_magic; + uint8_t fs_space[1]; +} PACKED; + +#define UFS_MAGIC 0x00011954 +#define UFS2_MAGIC 0x19540119 +#define UFS_MAGIC_FEA 0x00195612 +#define UFS_MAGIC_LFN 0x00095014 + +int volume_id_probe_ufs(struct volume_id *id, uint64_t off) +{ + uint32_t magic; + int i; + struct ufs_super_block *ufs; + int offsets[] = {0, 8, 64, 256, -1}; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + for (i = 0; offsets[i] >= 0; i++) { + ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); + if (ufs == NULL) + return -1; + + dbg("offset 0x%x", offsets[i] * 0x400); + magic = be32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(be)", magic); + goto found; + } + magic = le32_to_cpu(ufs->fs_magic); + if ((magic == UFS_MAGIC) || + (magic == UFS2_MAGIC) || + (magic == UFS_MAGIC_FEA) || + (magic == UFS_MAGIC_LFN)) { + dbg("magic 0x%08x(le)", magic); + goto found; + } + } + return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "ufs"; + + return 0; +} diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c new file mode 100644 index 0000000000..cf5392cf9a --- /dev/null +++ b/extras/volume_id/lib/util.c @@ -0,0 +1,267 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) +{ + unsigned int i, j; + uint16_t c; + + j = 0; + for (i = 0; i + 2 <= count; i += 2) { + if (endianess == LE) + c = (buf[i+1] << 8) | buf[i]; + else + c = (buf[i] << 8) | buf[i+1]; + if (c == 0) { + str[j] = '\0'; + break; + } else if (c < 0x80) { + if (j+1 >= len) + break; + str[j++] = (uint8_t) c; + } else if (c < 0x800) { + if (j+2 >= len) + break; + str[j++] = (uint8_t) (0xc0 | (c >> 6)); + str[j++] = (uint8_t) (0x80 | (c & 0x3f)); + } else { + if (j+3 >= len) + break; + str[j++] = (uint8_t) (0xe0 | (c >> 12)); + str[j++] = (uint8_t) (0x80 | ((c >> 6) & 0x3f)); + str[j++] = (uint8_t) (0x80 | (c & 0x3f)); + } + } + str[j] = '\0'; +} + +static char *usage_to_string(enum volume_id_usage usage_id) +{ + switch (usage_id) { + case VOLUME_ID_FILESYSTEM: + return "filesystem"; + case VOLUME_ID_OTHER: + return "other"; + case VOLUME_ID_RAID: + return "raid"; + case VOLUME_ID_DISKLABEL: + return "disklabel"; + case VOLUME_ID_CRYPTO: + return "crypto"; + case VOLUME_ID_UNPROBED: + return "unprobed"; + case VOLUME_ID_UNUSED: + return "unused"; + } + return NULL; +} + +void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) +{ + id->usage_id = usage_id; + id->usage = usage_to_string(usage_id); +} + +void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count) +{ + memcpy(id->label_raw, buf, count); + id->label_raw_len = count; +} + +void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) +{ + unsigned int i; + + memcpy(id->label, buf, count); + + /* remove trailing whitespace */ + i = strnlen(id->label, count); + while (i--) { + if (!isspace(id->label[i])) + break; + } + id->label[i+1] = '\0'; +} + +void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count) +{ + volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count); +} + +void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) +{ + unsigned int i; + unsigned int count = 0; + + switch(format) { + case UUID_DOS: + count = 4; + break; + case UUID_NTFS: + case UUID_HFS: + count = 8; + break; + case UUID_DCE: + count = 16; + break; + case UUID_DCE_STRING: + count = 36; + break; + } + memcpy(id->uuid_raw, buf, count); + id->uuid_raw_len = count; + + /* if set, create string in the same format, the native platform uses */ + for (i = 0; i < count; i++) + if (buf[i] != 0) + goto set; + return; + +set: + switch(format) { + case UUID_DOS: + sprintf(id->uuid, "%02X%02X-%02X%02X", + buf[3], buf[2], buf[1], buf[0]); + break; + case UUID_NTFS: + sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", + buf[7], buf[6], buf[5], buf[4], + buf[3], buf[2], buf[1], buf[0]); + break; + case UUID_HFS: + sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], buf[6], buf[7]); + break; + case UUID_DCE: + sprintf(id->uuid, + "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], + buf[6], buf[7], + buf[8], buf[9], + buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); + break; + case UUID_DCE_STRING: + memcpy(id->uuid, buf, count); + id->uuid[count] = '\0'; + break; + } +} + +uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) +{ + ssize_t buf_len; + + dbg("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); + /* check if requested area fits in superblock buffer */ + if (off + len <= SB_BUFFER_SIZE) { + if (id->sbbuf == NULL) { + id->sbbuf = malloc(SB_BUFFER_SIZE); + if (id->sbbuf == NULL) { + dbg("error malloc"); + return NULL; + } + } + + /* check if we need to read */ + if ((off + len) > id->sbbuf_len) { + dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len)); + if (lseek(id->fd, 0, SEEK_SET) < 0) { + dbg("lseek failed (%s)", strerror(errno)); + return NULL; + } + buf_len = read(id->fd, id->sbbuf, off + len); + if (buf_len < 0) { + dbg("read failed (%s)", strerror(errno)); + return NULL; + } + dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); + id->sbbuf_len = buf_len; + if ((size_t)buf_len < off + len) { + dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); + return NULL; + } + } + + return &(id->sbbuf[off]); + } else { + if (len > SEEK_BUFFER_SIZE) { + dbg("seek buffer too small %d", SEEK_BUFFER_SIZE); + return NULL; + } + + /* get seek buffer */ + if (id->seekbuf == NULL) { + id->seekbuf = malloc(SEEK_BUFFER_SIZE); + if (id->seekbuf == NULL) { + dbg("error malloc"); + return NULL; + } + } + + /* check if we need to read */ + if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { + dbg("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); + if (lseek(id->fd, off, SEEK_SET) < 0) { + dbg("lseek failed (%s)", strerror(errno)); + return NULL; + } + buf_len = read(id->fd, id->seekbuf, len); + if (buf_len < 0) { + dbg("read failed (%s)", strerror(errno)); + return NULL; + } + dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); + id->seekbuf_off = off; + id->seekbuf_len = buf_len; + if ((size_t)buf_len < len) { + dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); + return NULL; + } + } + + return &(id->seekbuf[off - id->seekbuf_off]); + } +} + +void volume_id_free_buffer(struct volume_id *id) +{ + if (id->sbbuf != NULL) { + free(id->sbbuf); + id->sbbuf = NULL; + id->sbbuf_len = 0; + } + if (id->seekbuf != NULL) { + free(id->seekbuf); + id->seekbuf = NULL; + id->seekbuf_len = 0; + } +} diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h new file mode 100644 index 0000000000..1d1b53bb57 --- /dev/null +++ b/extras/volume_id/lib/util.h @@ -0,0 +1,84 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005-2006 Kay Sievers + * + * 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. + */ + +#ifndef _VOLUME_ID_UTIL_ +#define _VOLUME_ID_UTIL_ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#define err(format, arg...) volume_id_log(LOG_ERR, __FILE__, __LINE__, format, ##arg) +#define info(format, arg...) volume_id_log(LOG_INFO, __FILE__, __LINE__, format, ##arg) +#ifdef DEBUG +#define dbg(format, arg...) volume_id_log(LOG_DEBUG, __FILE__, __LINE__, format, ##arg) +#else +#define dbg(format, arg...) do { } while (0) +#endif + +/* size of superblock buffer, reiserfs block is at 64k */ +#define SB_BUFFER_SIZE 0x11000 +/* size of seek buffer, FAT cluster is 32k max */ +#define SEEK_BUFFER_SIZE 0x10000 + +#ifdef __BYTE_ORDER +#if (__BYTE_ORDER == __LITTLE_ENDIAN) +#define le16_to_cpu(x) (x) +#define le32_to_cpu(x) (x) +#define le64_to_cpu(x) (x) +#define be16_to_cpu(x) bswap_16(x) +#define be32_to_cpu(x) bswap_32(x) +#define cpu_to_le16(x) (x) +#define cpu_to_le32(x) (x) +#define cpu_to_be32(x) bswap_32(x) +#elif (__BYTE_ORDER == __BIG_ENDIAN) +#define le16_to_cpu(x) bswap_16(x) +#define le32_to_cpu(x) bswap_32(x) +#define le64_to_cpu(x) bswap_64(x) +#define be16_to_cpu(x) (x) +#define be32_to_cpu(x) (x) +#define cpu_to_le16(x) bswap_16(x) +#define cpu_to_le32(x) bswap_32(x) +#define cpu_to_be32(x) (x) +#endif +#endif /* __BYTE_ORDER */ + +enum uuid_format { + UUID_DCE_STRING, + UUID_DCE, + UUID_DOS, + UUID_NTFS, + UUID_HFS, +}; + +enum endian { + LE = 0, + BE = 1 +}; + +extern void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); +extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); +extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); +extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format); +extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); +extern void volume_id_free_buffer(struct volume_id *id); + +#endif /* _VOLUME_ID_UTIL_ */ + diff --git a/extras/volume_id/lib/via_raid.c b/extras/volume_id/lib/via_raid.c new file mode 100644 index 0000000000..42cb098065 --- /dev/null +++ b/extras/volume_id/lib/via_raid.c @@ -0,0 +1,75 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct via_meta { + uint16_t signature; + uint8_t version_number; + struct via_array { + uint16_t disk_bits; + uint8_t disk_array_ex; + uint32_t capacity_low; + uint32_t capacity_high; + uint32_t serial_checksum; + } PACKED array; + uint32_t serial_checksum[8]; + uint8_t checksum; +} PACKED; + +#define VIA_SIGNATURE 0xAA55 + +int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct via_meta *via; + + dbg("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + via = (struct via_meta *) buf; + if (le16_to_cpu(via->signature) != VIA_SIGNATURE) + return -1; + + if (via->version_number > 1) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", via->version_number); + id->type = "via_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c new file mode 100644 index 0000000000..073ad79c77 --- /dev/null +++ b/extras/volume_id/lib/volume_id.c @@ -0,0 +1,231 @@ +/* + * volume_id - reads volume label and uuid + * + * Copyright (C) 2005 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +/* the user can overwrite this log function */ +static void default_log(int priority, const char *file, int line, const char *format, ...) +{ + return; +} + +volume_id_log_fn volume_id_log = default_log; + +int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + if (id == NULL) + return -EINVAL; + + /* probe for raid first, cause fs probes may be successful on raid members */ + if (size) { + if (volume_id_probe_linux_raid(id, off, size) == 0) + goto found; + + if (volume_id_probe_intel_software_raid(id, off, size) == 0) + goto found; + + if (volume_id_probe_lsi_mega_raid(id, off, size) == 0) + goto found; + + if (volume_id_probe_via_raid(id, off, size) == 0) + goto found; + + if (volume_id_probe_silicon_medley_raid(id, off, size) == 0) + goto found; + + if (volume_id_probe_nvidia_raid(id, off, size) == 0) + goto found; + + if (volume_id_probe_promise_fasttrack_raid(id, off, size) == 0) + goto found; + + if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0) + goto found; + } + + if (volume_id_probe_lvm1(id, off) == 0) + goto found; + + if (volume_id_probe_lvm2(id, off) == 0) + goto found; + + if (volume_id_probe_highpoint_37x_raid(id, off) == 0) + goto found; + + return -1; + +found: + /* If recognized, we free the allocated buffers */ + volume_id_free_buffer(id); + return 0; +} + +int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size) +{ + if (id == NULL) + return -EINVAL; + + if (volume_id_probe_luks(id, off) == 0) + goto found; + + /* signature in the first block, only small buffer needed */ + if (volume_id_probe_vfat(id, off) == 0) + goto found; + + if (volume_id_probe_xfs(id, off) == 0) + goto found; + + /* fill buffer with maximum */ + volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); + + if (volume_id_probe_linux_swap(id, off) == 0) + goto found; + + if (volume_id_probe_ext(id, off) == 0) + goto found; + + if (volume_id_probe_reiserfs(id, off) == 0) + goto found; + + if (volume_id_probe_jfs(id, off) == 0) + goto found; + + if (volume_id_probe_udf(id, off) == 0) + goto found; + + if (volume_id_probe_iso9660(id, off) == 0) + goto found; + + if (volume_id_probe_hfs_hfsplus(id, off) == 0) + goto found; + + if (volume_id_probe_ufs(id, off) == 0) + goto found; + + if (volume_id_probe_ntfs(id, off) == 0) + goto found; + + if (volume_id_probe_cramfs(id, off) == 0) + goto found; + + if (volume_id_probe_romfs(id, off) == 0) + goto found; + + if (volume_id_probe_hpfs(id, off) == 0) + goto found; + + if (volume_id_probe_sysv(id, off) == 0) + goto found; + + if (volume_id_probe_minix(id, off) == 0) + goto found; + + if (volume_id_probe_ocfs1(id, off) == 0) + goto found; + + if (volume_id_probe_ocfs2(id, off) == 0) + goto found; + + if (volume_id_probe_vxfs(id, off) == 0) + goto found; + + if (volume_id_probe_squashfs(id, off) == 0) + goto found; + + return -1; + +found: + /* If recognized, we free the allocated buffers */ + volume_id_free_buffer(id); + return 0; +} + +int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) +{ + if (id == NULL) + return -EINVAL; + + if (volume_id_probe_raid(id, off, size) == 0) + return 0; + + if (volume_id_probe_filesystem(id, off, size) == 0) + return 0; + + return -1; +} + +/* open volume by already open file descriptor */ +struct volume_id *volume_id_open_fd(int fd) +{ + struct volume_id *id; + + id = malloc(sizeof(struct volume_id)); + if (id == NULL) + return NULL; + memset(id, 0x00, sizeof(struct volume_id)); + + id->fd = fd; + + return id; +} + +/* open volume by device node */ +struct volume_id *volume_id_open_node(const char *path) +{ + struct volume_id *id; + int fd; + + fd = open(path, O_RDONLY); + if (fd < 0) { + dbg("unable to open '%s'", path); + return NULL; + } + + id = volume_id_open_fd(fd); + if (id == NULL) + return NULL; + + /* close fd on device close */ + id->fd_close = 1; + + return id; +} + +void volume_id_close(struct volume_id *id) +{ + if (id == NULL) + return; + + if (id->fd_close != 0) + close(id->fd); + + volume_id_free_buffer(id); + + free(id); +} diff --git a/extras/volume_id/lib/vxfs.c b/extras/volume_id/lib/vxfs.c new file mode 100644 index 0000000000..d10cc37762 --- /dev/null +++ b/extras/volume_id/lib/vxfs.c @@ -0,0 +1,54 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +#define VXFS_SUPER_MAGIC 0xa501FCF5 + +struct vxfs_super { + uint32_t vs_magic; + int32_t vs_version; +} PACKED; + +int volume_id_probe_vxfs(struct volume_id *id, uint64_t off) +{ + struct vxfs_super *vxs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); + if (vxs == NULL) + return -1; + + if (vxs->vs_magic == cpu_to_le32(VXFS_SUPER_MAGIC)) { + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", (unsigned int) vxs->vs_version); + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "vxfs"; + return 0; + } + + return -1; +} diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c new file mode 100644 index 0000000000..3d870c41e7 --- /dev/null +++ b/extras/volume_id/lib/xfs.c @@ -0,0 +1,65 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct xfs_super_block { + uint8_t magic[4]; + uint32_t blocksize; + uint64_t dblocks; + uint64_t rblocks; + uint32_t dummy1[2]; + uint8_t uuid[16]; + uint32_t dummy2[15]; + uint8_t fname[12]; + uint32_t dummy3[2]; + uint64_t icount; + uint64_t ifree; + uint64_t fdblocks; +} PACKED; + +int volume_id_probe_xfs(struct volume_id *id, uint64_t off) +{ + struct xfs_super_block *xs; + + dbg("probing at offset 0x%llx", (unsigned long long) off); + + xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); + if (xs == NULL) + return -1; + + if (memcmp(xs->magic, "XFSB", 4) != 0) + return -1; + + volume_id_set_label_raw(id, xs->fname, 12); + volume_id_set_label_string(id, xs->fname, 12); + volume_id_set_uuid(id, xs->uuid, UUID_DCE); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "xfs"; + + return 0; +} diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile deleted file mode 100644 index 6a12f0e67a..0000000000 --- a/extras/volume_id/libvolume_id/Makefile +++ /dev/null @@ -1,124 +0,0 @@ -# libvolume_id - read filesystem label/uuid -# -# Copyright (C) 2004-2006 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# -includedir = ${prefix}/usr/include -libdir = ${prefix}/lib -usrlibdir = ${prefix}/usr/lib - -INSTALL = /usr/bin/install -c -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_LIB = ${INSTALL} -m 755 - -SHLIB_CUR = 0 -SHLIB_REV = 61 -SHLIB_AGE = 0 -SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) - -OBJS= \ - ext.o \ - fat.o \ - hfs.o \ - highpoint.o \ - isw_raid.o \ - lsi_raid.o \ - via_raid.o \ - silicon_raid.o \ - nvidia_raid.o \ - promise_raid.o \ - iso9660.o \ - jfs.o \ - linux_raid.o \ - linux_swap.o \ - lvm.o \ - ntfs.o \ - reiserfs.o \ - udf.o \ - ufs.o \ - xfs.o \ - cramfs.o \ - hpfs.o \ - romfs.o \ - sysv.o \ - minix.o \ - luks.o \ - ocfs.o \ - vxfs.o \ - squashfs.o \ - volume_id.o \ - util.o - -HEADERS= \ - libvolume_id.h \ - util.h - -AR = $(CROSS)ar -RANLIB = $(CROSS)ranlib - -all: libvolume_id.a $(SHLIB) libvolume_id.pc -.PHONY: all -.DEFAULT: all - -%.o: %.c - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -.shlib: - $(Q) mkdir .shlib - -.shlib/%.o: %.c - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@ - -libvolume_id.a: $(HEADERS) $(OBJS) - $(Q) rm -f $@ - $(E) " AR " $@ - $(Q) $(AR) cq $@ $(OBJS) - $(E) " RANLIB " $@ - $(Q) $(RANLIB) $@ - -$(SHLIB): $(HEADERS) .shlib $(addprefix .shlib/,$(OBJS)) - $(E) " CC " $@ - $(Q) $(CC) -shared $(CFLAGS) -o $@ -Wl,-soname,libvolume_id.so.$(SHLIB_CUR) $(addprefix .shlib/,$(OBJS)) - $(Q) ln -sf $@ libvolume_id.so.$(SHLIB_CUR) - $(Q) ln -sf $@ libvolume_id.so - -libvolume_id.pc: - $(E) " GENPC " $@ - $(Q) echo "prefix=${prefix}" > $@ - $(Q) echo "libdir=${libdir}" >> $@ - $(Q) echo "includedir=${includedir}" >> $@ - $(Q) echo "" >> $@ - $(Q) echo "Name: libvolume_id" >> $@ - $(Q) echo "Description: Filesystem label and uuid access" >> $@ - $(Q) echo "Version: $(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)" >> $@ - $(Q) echo "Libs: -L\$${libdir} -lvolume_id" >> $@ - $(Q) echo "Cflags: -I\$${includedir}" >> $@ - -install: all - $(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h - $(INSTALL_LIB) -D libvolume_id.a $(DESTDIR)$(usrlibdir)/libvolume_id.a - $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) - ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) - ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so - $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc -.PHONY: install - -uninstall: - rm -f $(DESTDIR)$(includedir)/libvolume_id.h - rm -f $(DESTDIR)$(usrlibdir)/libvolume_id.a - rm -f $(DESTDIR)$(libdir)/$(SHLIB) - rm -f $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) - rm -f $(DESTDIR)$(libdir)/libvolume_id.so -.PHONY: uninstall - -clean: - $(E) " CLEAN " - $(Q) rm -f libvolume_id.a $(OBJS) - $(Q) rm -f $(SHLIB) libvolume_id.so.$(SHLIB_CUR) libvolume_id.so - $(Q) rm -rf .shlib - $(Q) rm -f libvolume_id.pc -.PHONY: clean - diff --git a/extras/volume_id/libvolume_id/cramfs.c b/extras/volume_id/libvolume_id/cramfs.c deleted file mode 100644 index beb34d5bc0..0000000000 --- a/extras/volume_id/libvolume_id/cramfs.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct cramfs_super { - uint8_t magic[4]; - uint32_t size; - uint32_t flags; - uint32_t future; - uint8_t signature[16]; - struct cramfs_info { - uint32_t crc; - uint32_t edition; - uint32_t blocks; - uint32_t files; - } PACKED info; - uint8_t name[16]; -} PACKED; - -int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) -{ - struct cramfs_super *cs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); - if (cs == NULL) - return -1; - - if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0 || memcmp(cs->magic, "\x28\xcd\x3d\x45", 4) == 0) { - volume_id_set_label_raw(id, cs->name, 16); - volume_id_set_label_string(id, cs->name, 16); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "cramfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/libvolume_id/ext.c b/extras/volume_id/libvolume_id/ext.c deleted file mode 100644 index 51c0011218..0000000000 --- a/extras/volume_id/libvolume_id/ext.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct ext2_super_block { - uint32_t s_inodes_count; - uint32_t s_blocks_count; - uint32_t s_r_blocks_count; - uint32_t s_free_blocks_count; - uint32_t s_free_inodes_count; - uint32_t s_first_data_block; - uint32_t s_log_block_size; - uint32_t s_log_frag_size; - uint32_t s_blocks_per_group; - uint32_t s_frags_per_group; - uint32_t s_inodes_per_group; - uint32_t s_mtime; - uint32_t s_wtime; - uint16_t s_mnt_count; - uint16_t s_max_mnt_count; - uint16_t s_magic; - uint16_t s_state; - uint16_t s_errors; - uint16_t s_minor_rev_level; - uint32_t s_lastcheck; - uint32_t s_checkinterval; - uint32_t s_creator_os; - uint32_t s_rev_level; - uint16_t s_def_resuid; - uint16_t s_def_resgid; - uint32_t s_first_ino; - uint16_t s_inode_size; - uint16_t s_block_group_nr; - uint32_t s_feature_compat; - uint32_t s_feature_incompat; - uint32_t s_feature_ro_compat; - uint8_t s_uuid[16]; - uint8_t s_volume_name[16]; -} PACKED; - -#define EXT_SUPER_MAGIC 0xEF53 -#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 -#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 -#define EXT_SUPERBLOCK_OFFSET 0x400 - -#define EXT3_MIN_BLOCK_SIZE 0x400 -#define EXT3_MAX_BLOCK_SIZE 0x1000 - -int volume_id_probe_ext(struct volume_id *id, uint64_t off) -{ - struct ext2_super_block *es; - size_t bsize; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); - if (es == NULL) - return -1; - - if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC)) - return -1; - - bsize = 0x400 << le32_to_cpu(es->s_log_block_size); - dbg("ext blocksize 0x%zx", bsize); - if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { - dbg("invalid ext blocksize"); - return -1; - } - - volume_id_set_label_raw(id, es->s_volume_name, 16); - volume_id_set_label_string(id, es->s_volume_name, 16); - volume_id_set_uuid(id, es->s_uuid, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", es->s_rev_level, es->s_minor_rev_level); - - /* check for external journal device */ - if ((le32_to_cpu(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { - volume_id_set_usage(id, VOLUME_ID_OTHER); - id->type = "jbd"; - return 0; - } - - /* check for ext2 / ext3 */ - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - if ((le32_to_cpu(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) - id->type = "ext3"; - else - id->type = "ext2"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/fat.c b/extras/volume_id/libvolume_id/fat.c deleted file mode 100644 index 4840a2a23c..0000000000 --- a/extras/volume_id/libvolume_id/fat.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -#define FAT12_MAX 0xff5 -#define FAT16_MAX 0xfff5 -#define FAT_ATTR_VOLUME_ID 0x08 -#define FAT_ATTR_DIR 0x10 -#define FAT_ATTR_LONG_NAME 0x0f -#define FAT_ATTR_MASK 0x3f -#define FAT_ENTRY_FREE 0xe5 - -struct vfat_super_block { - uint8_t boot_jump[3]; - uint8_t sysid[8]; - uint16_t sector_size; - uint8_t sectors_per_cluster; - uint16_t reserved; - uint8_t fats; - uint16_t dir_entries; - uint16_t sectors; - uint8_t media; - uint16_t fat_length; - uint16_t secs_track; - uint16_t heads; - uint32_t hidden; - uint32_t total_sect; - union { - struct fat_super_block { - uint8_t unknown[3]; - uint8_t serno[4]; - uint8_t label[11]; - uint8_t magic[8]; - uint8_t dummy2[192]; - uint8_t pmagic[2]; - } PACKED fat; - struct fat32_super_block { - uint32_t fat32_length; - uint16_t flags; - uint8_t version[2]; - uint32_t root_cluster; - uint16_t insfo_sector; - uint16_t backup_boot; - uint16_t reserved2[6]; - uint8_t unknown[3]; - uint8_t serno[4]; - uint8_t label[11]; - uint8_t magic[8]; - uint8_t dummy2[164]; - uint8_t pmagic[2]; - } PACKED fat32; - } PACKED type; -} PACKED; - -struct vfat_dir_entry { - uint8_t name[11]; - uint8_t attr; - uint16_t time_creat; - uint16_t date_creat; - uint16_t time_acc; - uint16_t date_acc; - uint16_t cluster_high; - uint16_t time_write; - uint16_t date_write; - uint16_t cluster_low; - uint32_t size; -} PACKED; - -static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) -{ - unsigned int i; - - for (i = 0; i < count; i++) { - /* end marker */ - if (dir[i].name[0] == 0x00) { - dbg("end of dir"); - break; - } - - /* empty entry */ - if (dir[i].name[0] == FAT_ENTRY_FREE) - continue; - - /* long name */ - if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) - continue; - - if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { - /* labels do not have file data */ - if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) - continue; - - dbg("found ATTR_VOLUME_ID id in root dir"); - return dir[i].name; - } - - dbg("skip dir entry"); - } - - return NULL; -} - -int volume_id_probe_vfat(struct volume_id *id, uint64_t off) -{ - struct vfat_super_block *vs; - struct vfat_dir_entry *dir; - uint16_t sector_size; - uint16_t dir_entries; - uint32_t sect_count; - uint16_t reserved; - uint32_t fat_size; - uint32_t root_cluster; - uint32_t dir_size; - uint32_t cluster_count; - uint16_t fat_length; - uint32_t fat32_length; - uint64_t root_start; - uint32_t start_data_sect; - uint16_t root_dir_entries; - uint8_t *buf; - uint32_t buf_size; - uint8_t *label = NULL; - uint32_t next; - int maxloop; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - /* believe only that's fat, don't trust the version - * the cluster_count will tell us - */ - if (memcmp(vs->sysid, "NTFS", 4) == 0) - return -1; - - if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) - goto magic; - - if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) - goto magic; - - if (memcmp(vs->type.fat.magic, "FAT16 ", 8) == 0) - goto magic; - - if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0) - goto magic; - - if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) - goto magic; - - /* some old floppies don't have a magic, so we expect the boot code to match */ - - /* boot jump address check */ - if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && - vs->boot_jump[0] != 0xe9) - return -1; - -magic: - /* reserverd sector count */ - if (!vs->reserved) - return -1; - - /* fat count*/ - if (!vs->fats) - return -1; - - /* media check */ - if (vs->media < 0xf8 && vs->media != 0xf0) - return -1; - - /* cluster size check*/ - if (vs->sectors_per_cluster == 0 || - (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) - return -1; - - /* sector size check */ - sector_size = le16_to_cpu(vs->sector_size); - if (sector_size != 0x200 && sector_size != 0x400 && - sector_size != 0x800 && sector_size != 0x1000) - return -1; - - dbg("sector_size 0x%x", sector_size); - dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); - - dir_entries = le16_to_cpu(vs->dir_entries); - reserved = le16_to_cpu(vs->reserved); - dbg("reserved 0x%x", reserved); - - sect_count = le16_to_cpu(vs->sectors); - if (sect_count == 0) - sect_count = le32_to_cpu(vs->total_sect); - dbg("sect_count 0x%x", sect_count); - - fat_length = le16_to_cpu(vs->fat_length); - dbg("fat_length 0x%x", fat_length); - fat32_length = le32_to_cpu(vs->type.fat32.fat32_length); - dbg("fat32_length 0x%x", fat32_length); - - if (fat_length) - fat_size = fat_length * vs->fats; - else if (fat32_length) - fat_size = fat32_length * vs->fats; - else - return -1; - dbg("fat_size 0x%x", fat_size); - - dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + - (sector_size-1)) / sector_size; - dbg("dir_size 0x%x", dir_size); - - cluster_count = sect_count - (reserved + fat_size + dir_size); - cluster_count /= vs->sectors_per_cluster; - dbg("cluster_count 0x%x", cluster_count); - - /* must be FAT32 */ - if (!fat_length && fat32_length) - goto fat32; - - /* cluster_count tells us the format */ - if (cluster_count < FAT12_MAX) - strcpy(id->type_version, "FAT12"); - else if (cluster_count < FAT16_MAX) - strcpy(id->type_version, "FAT16"); - else - goto fat32; - - /* the label may be an attribute in the root directory */ - root_start = (reserved + fat_size) * sector_size; - dbg("root dir start 0x%llx", (unsigned long long) root_start); - root_dir_entries = le16_to_cpu(vs->dir_entries); - dbg("expected entries 0x%x", root_dir_entries); - - buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); - buf = volume_id_get_buffer(id, off + root_start, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - - label = get_attr_volume_id(dir, root_dir_entries); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, label, 11); - volume_id_set_label_string(id, label, 11); - } else if (memcmp(vs->type.fat.label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, vs->type.fat.label, 11); - volume_id_set_label_string(id, vs->type.fat.label, 11); - } - volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); - goto found; - -fat32: - strcpy(id->type_version, "FAT32"); - - /* FAT32 root dir is a cluster chain like any other directory */ - buf_size = vs->sectors_per_cluster * sector_size; - root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); - dbg("root dir cluster %u", root_cluster); - start_data_sect = reserved + fat_size; - - next = root_cluster; - maxloop = 100; - while (--maxloop) { - uint32_t next_sect_off; - uint64_t next_off; - uint64_t fat_entry_off; - int count; - - dbg("next cluster %u", next); - next_sect_off = (next - 2) * vs->sectors_per_cluster; - next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%llx", (unsigned long long) next_off); - - /* get cluster */ - buf = volume_id_get_buffer(id, off + next_off, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - count = buf_size / sizeof(struct vfat_dir_entry); - dbg("expected entries 0x%x", count); - - label = get_attr_volume_id(dir, count); - if (label) - break; - - /* get FAT entry */ - fat_entry_off = (reserved * sector_size) + (next * sizeof(uint32_t)); - buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); - if (buf == NULL) - goto found; - - /* set next cluster */ - next = le32_to_cpu(*((uint32_t *) buf) & 0x0fffffff); - if (next == 0) - break; - } - if (maxloop == 0) - dbg("reached maximum follow count of root cluster chain, give up"); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, label, 11); - volume_id_set_label_string(id, label, 11); - } else if (memcmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, vs->type.fat32.label, 11); - volume_id_set_label_string(id, vs->type.fat32.label, 11); - } - volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "vfat"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/hfs.c b/extras/volume_id/libvolume_id/hfs.c deleted file mode 100644 index a6e378dd28..0000000000 --- a/extras/volume_id/libvolume_id/hfs.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct hfs_finder_info{ - uint32_t boot_folder; - uint32_t start_app; - uint32_t open_folder; - uint32_t os9_folder; - uint32_t reserved; - uint32_t osx_folder; - uint8_t id[8]; -} PACKED; - -struct hfs_mdb { - uint8_t signature[2]; - uint32_t cr_date; - uint32_t ls_Mod; - uint16_t atrb; - uint16_t nm_fls; - uint16_t vbm_st; - uint16_t alloc_ptr; - uint16_t nm_al_blks; - uint32_t al_blk_size; - uint32_t clp_size; - uint16_t al_bl_st; - uint32_t nxt_cnid; - uint16_t free_bks; - uint8_t label_len; - uint8_t label[27]; - uint32_t vol_bkup; - uint16_t vol_seq_num; - uint32_t wr_cnt; - uint32_t xt_clump_size; - uint32_t ct_clump_size; - uint16_t num_root_dirs; - uint32_t file_count; - uint32_t dir_count; - struct hfs_finder_info finder_info; - uint8_t embed_sig[2]; - uint16_t embed_startblock; - uint16_t embed_blockcount; -} PACKED *hfs; - -struct hfsplus_bnode_descriptor { - uint32_t next; - uint32_t prev; - uint8_t type; - uint8_t height; - uint16_t num_recs; - uint16_t reserved; -} PACKED; - -struct hfsplus_bheader_record { - uint16_t depth; - uint32_t root; - uint32_t leaf_count; - uint32_t leaf_head; - uint32_t leaf_tail; - uint16_t node_size; -} PACKED; - -struct hfsplus_catalog_key { - uint16_t key_len; - uint32_t parent_id; - uint16_t unicode_len; - uint8_t unicode[255 * 2]; -} PACKED; - -struct hfsplus_extent { - uint32_t start_block; - uint32_t block_count; -} PACKED; - -#define HFSPLUS_EXTENT_COUNT 8 -struct hfsplus_fork { - uint64_t total_size; - uint32_t clump_size; - uint32_t total_blocks; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; -} PACKED; - -struct hfsplus_vol_header { - uint8_t signature[2]; - uint16_t version; - uint32_t attributes; - uint32_t last_mount_vers; - uint32_t reserved; - uint32_t create_date; - uint32_t modify_date; - uint32_t backup_date; - uint32_t checked_date; - uint32_t file_count; - uint32_t folder_count; - uint32_t blocksize; - uint32_t total_blocks; - uint32_t free_blocks; - uint32_t next_alloc; - uint32_t rsrc_clump_sz; - uint32_t data_clump_sz; - uint32_t next_cnid; - uint32_t write_count; - uint64_t encodings_bmp; - struct hfs_finder_info finder_info; - struct hfsplus_fork alloc_file; - struct hfsplus_fork ext_file; - struct hfsplus_fork cat_file; - struct hfsplus_fork attr_file; - struct hfsplus_fork start_file; -} PACKED *hfsplus; - -#define HFS_SUPERBLOCK_OFFSET 0x400 -#define HFS_NODE_LEAF 0xff -#define HFSPLUS_POR_CNID 1 - -int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off) -{ - unsigned int blocksize; - unsigned int cat_block; - unsigned int ext_block_start; - unsigned int ext_block_count; - int ext; - unsigned int leaf_node_head; - unsigned int leaf_node_count; - unsigned int leaf_node_size; - unsigned int leaf_block; - uint64_t leaf_off; - unsigned int alloc_block_size; - unsigned int alloc_first_block; - unsigned int embed_first_block; - unsigned int record_count; - struct hfsplus_bnode_descriptor *descr; - struct hfsplus_bheader_record *bnode; - struct hfsplus_catalog_key *key; - unsigned int label_len; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; - const uint8_t *buf; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - hfs = (struct hfs_mdb *) buf; - if (memcmp(hfs->signature, "BD", 2) != 0) - goto checkplus; - - /* it may be just a hfs wrapper for hfs+ */ - if (memcmp(hfs->embed_sig, "H+", 2) == 0) { - alloc_block_size = be32_to_cpu(hfs->al_blk_size); - dbg("alloc_block_size 0x%x", alloc_block_size); - - alloc_first_block = be16_to_cpu(hfs->al_bl_st); - dbg("alloc_first_block 0x%x", alloc_first_block); - - embed_first_block = be16_to_cpu(hfs->embed_startblock); - dbg("embed_first_block 0x%x", embed_first_block); - - off += (alloc_first_block * 512) + - (embed_first_block * alloc_block_size); - dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - goto checkplus; - } - - if (hfs->label_len > 0 && hfs->label_len < 28) { - volume_id_set_label_raw(id, hfs->label, hfs->label_len); - volume_id_set_label_string(id, hfs->label, hfs->label_len) ; - } - - volume_id_set_uuid(id, hfs->finder_info.id, UUID_HFS); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hfs"; - - return 0; - -checkplus: - hfsplus = (struct hfsplus_vol_header *) buf; - if (memcmp(hfsplus->signature, "H+", 2) == 0) - goto hfsplus; - if (memcmp(hfsplus->signature, "HX", 2) == 0) - goto hfsplus; - return -1; - -hfsplus: - volume_id_set_uuid(id, hfsplus->finder_info.id, UUID_HFS); - - blocksize = be32_to_cpu(hfsplus->blocksize); - dbg("blocksize %u", blocksize); - - memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); - cat_block = be32_to_cpu(extents[0].start_block); - dbg("catalog start block 0x%x", cat_block); - - buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); - if (buf == NULL) - goto found; - - bnode = (struct hfsplus_bheader_record *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - leaf_node_head = be32_to_cpu(bnode->leaf_head); - dbg("catalog leaf node 0x%x", leaf_node_head); - - leaf_node_size = be16_to_cpu(bnode->node_size); - dbg("leaf node size 0x%x", leaf_node_size); - - leaf_node_count = be32_to_cpu(bnode->leaf_count); - dbg("leaf node count 0x%x", leaf_node_count); - if (leaf_node_count == 0) - goto found; - - leaf_block = (leaf_node_head * leaf_node_size) / blocksize; - - /* get physical location */ - for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { - ext_block_start = be32_to_cpu(extents[ext].start_block); - ext_block_count = be32_to_cpu(extents[ext].block_count); - dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); - - if (ext_block_count == 0) - goto found; - - /* this is our extent */ - if (leaf_block < ext_block_count) - break; - - leaf_block -= ext_block_count; - } - if (ext == HFSPLUS_EXTENT_COUNT) - goto found; - dbg("found block in extent %i", ext); - - leaf_off = (ext_block_start + leaf_block) * blocksize; - - buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size); - if (buf == NULL) - goto found; - - descr = (struct hfsplus_bnode_descriptor *) buf; - dbg("descriptor type 0x%x", descr->type); - - record_count = be16_to_cpu(descr->num_recs); - dbg("number of records %u", record_count); - if (record_count == 0) - goto found; - - if (descr->type != HFS_NODE_LEAF) - goto found; - - key = (struct hfsplus_catalog_key *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); - if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) - goto found; - - label_len = be16_to_cpu(key->unicode_len) * 2; - dbg("label unicode16 len %i", label_len); - volume_id_set_label_raw(id, key->unicode, label_len); - volume_id_set_label_unicode16(id, key->unicode, BE, label_len); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hfsplus"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/highpoint.c b/extras/volume_id/libvolume_id/highpoint.c deleted file mode 100644 index deba540ad5..0000000000 --- a/extras/volume_id/libvolume_id/highpoint.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct hpt37x_meta { - uint8_t filler1[32]; - uint32_t magic; -} PACKED; - -struct hpt45x_meta { - uint32_t magic; -} PACKED; - -#define HPT37X_CONFIG_OFF 0x1200 -#define HPT37X_MAGIC_OK 0x5a7816f0 -#define HPT37X_MAGIC_BAD 0x5a7816fd - -#define HPT45X_MAGIC_OK 0x5a7816f3 -#define HPT45X_MAGIC_BAD 0x5a7816fd - - -int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct hpt37x_meta *hpt; - uint32_t magic; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); - if (buf == NULL) - return -1; - - hpt = (struct hpt37x_meta *) buf; - magic = le32_to_cpu(hpt->magic); - if (magic != HPT37X_MAGIC_OK && magic != HPT37X_MAGIC_BAD) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "highpoint_raid_member"; - - return 0; -} - -int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct hpt45x_meta *hpt; - uint64_t meta_off; - uint32_t magic; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-11) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - hpt = (struct hpt45x_meta *) buf; - magic = le32_to_cpu(hpt->magic); - if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "highpoint_raid_member"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/hpfs.c b/extras/volume_id/libvolume_id/hpfs.c deleted file mode 100644 index 3e9589fcca..0000000000 --- a/extras/volume_id/libvolume_id/hpfs.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct hpfs_super -{ - uint8_t magic[4]; - uint8_t version; -} PACKED; - -#define HPFS_SUPERBLOCK_OFFSET 0x2000 - -int volume_id_probe_hpfs(struct volume_id *id, uint64_t off) -{ - struct hpfs_super *hs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); - if (hs == NULL) - return -1; - - if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) { - sprintf(id->type_version, "%u", hs->version); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hpfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/libvolume_id/iso9660.c b/extras/volume_id/libvolume_id/iso9660.c deleted file mode 100644 index 7b78a7e992..0000000000 --- a/extras/volume_id/libvolume_id/iso9660.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -#define ISO_SUPERBLOCK_OFFSET 0x8000 -#define ISO_SECTOR_SIZE 0x800 -#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) -#define ISO_VD_PRIMARY 0x1 -#define ISO_VD_SUPPLEMENTARY 0x2 -#define ISO_VD_END 0xff -#define ISO_VD_MAX 16 - -struct iso_volume_descriptor { - uint8_t vd_type; - uint8_t vd_id[5]; - uint8_t vd_version; - uint8_t flags; - uint8_t system_id[32]; - uint8_t volume_id[32]; - uint8_t unused[8]; - uint8_t space_size[8]; - uint8_t escape_sequences[8]; -} PACKED; - -struct high_sierra_volume_descriptor { - uint8_t foo[8]; - uint8_t type; - uint8_t id[4]; - uint8_t version; -} PACKED; - -int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) -{ - uint8_t *buf; - struct iso_volume_descriptor *is; - struct high_sierra_volume_descriptor *hs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - is = (struct iso_volume_descriptor *) buf; - - if (memcmp(is->vd_id, "CD001", 5) == 0) { - int vd_offset; - int i; - - dbg("read label from PVD"); - volume_id_set_label_raw(id, is->volume_id, 32); - volume_id_set_label_string(id, is->volume_id, 32); - - dbg("looking for SVDs"); - vd_offset = ISO_VD_OFFSET; - for (i = 0; i < ISO_VD_MAX; i++) { - uint8_t svd_label[64]; - - is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200); - if (is == NULL || is->vd_type == ISO_VD_END) - break; - if (is->vd_type != ISO_VD_SUPPLEMENTARY) - continue; - - dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset)); - if (memcmp(is->escape_sequences, "%/@", 3) == 0|| - memcmp(is->escape_sequences, "%/C", 3) == 0|| - memcmp(is->escape_sequences, "%/E", 3) == 0) { - dbg("Joliet extension found"); - volume_id_set_unicode16((char *)svd_label, sizeof(svd_label), is->volume_id, BE, 32); - if (memcmp(id->label, svd_label, 16) == 0) { - dbg("SVD label is identical, use the possibly longer PVD one"); - break; - } - - volume_id_set_label_raw(id, is->volume_id, 32); - volume_id_set_label_string(id, svd_label, 32); - strcpy(id->type_version, "Joliet Extension"); - goto found; - } - vd_offset += ISO_SECTOR_SIZE; - } - goto found; - } - - hs = (struct high_sierra_volume_descriptor *) buf; - - if (memcmp(hs->id, "CDROM", 5) == 0) { - strcpy(id->type_version, "High Sierra"); - goto found; - } - - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "iso9660"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/isw_raid.c b/extras/volume_id/libvolume_id/isw_raid.c deleted file mode 100644 index 6465a31bf5..0000000000 --- a/extras/volume_id/libvolume_id/isw_raid.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct isw_meta { - uint8_t sig[32]; - uint32_t check_sum; - uint32_t mpb_size; - uint32_t family_num; - uint32_t generation_num; -} PACKED; - -#define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " - - -int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct isw_meta *isw; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-2) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - isw = (struct isw_meta *) buf; - if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - memcpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); - id->type = "isw_raid_member"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/jfs.c b/extras/volume_id/libvolume_id/jfs.c deleted file mode 100644 index b230fb258c..0000000000 --- a/extras/volume_id/libvolume_id/jfs.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct jfs_super_block { - uint8_t magic[4]; - uint32_t version; - uint64_t size; - uint32_t bsize; - uint32_t dummy1; - uint32_t pbsize; - uint32_t dummy2[27]; - uint8_t uuid[16]; - uint8_t label[16]; - uint8_t loguuid[16]; -} PACKED; - -#define JFS_SUPERBLOCK_OFFSET 0x8000 - -int volume_id_probe_jfs(struct volume_id *id, uint64_t off) -{ - struct jfs_super_block *js; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); - if (js == NULL) - return -1; - - if (memcmp(js->magic, "JFS1", 4) != 0) - return -1; - - volume_id_set_label_raw(id, js->label, 16); - volume_id_set_label_string(id, js->label, 16); - volume_id_set_uuid(id, js->uuid, UUID_DCE); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "jfs"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/libvolume_id.h b/extras/volume_id/libvolume_id/libvolume_id.h deleted file mode 100644 index 7faf8d8af3..0000000000 --- a/extras/volume_id/libvolume_id/libvolume_id.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * volume_id - reads volume label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _LIBVOLUME_ID_H_ -#define _LIBVOLUME_ID_H_ - -#include -#include - -#ifndef PACKED -#define PACKED __attribute__((packed)) -#endif - - -typedef void (*volume_id_log_fn)(int priority, const char *file, int line, const char *format, ...) - __attribute__ ((format(printf, 4, 5))); - -extern volume_id_log_fn volume_id_log; - -#define VOLUME_ID_LABEL_SIZE 64 -#define VOLUME_ID_UUID_SIZE 36 -#define VOLUME_ID_FORMAT_SIZE 32 -#define VOLUME_ID_PATH_MAX 256 -#define VOLUME_ID_PARTITIONS_MAX 256 - -enum volume_id_usage { - VOLUME_ID_UNUSED, - VOLUME_ID_UNPROBED, - VOLUME_ID_OTHER, - VOLUME_ID_FILESYSTEM, - VOLUME_ID_RAID, - VOLUME_ID_DISKLABEL, - VOLUME_ID_CRYPTO, -}; - -struct volume_id { - uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; - size_t label_raw_len; - char label[VOLUME_ID_LABEL_SIZE+1]; - uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; - size_t uuid_raw_len; - char uuid[VOLUME_ID_UUID_SIZE+1]; - enum volume_id_usage usage_id; - char *usage; - char *type; - char type_version[VOLUME_ID_FORMAT_SIZE]; - - int fd; - uint8_t *sbbuf; - size_t sbbuf_len; - uint8_t *seekbuf; - uint64_t seekbuf_off; - size_t seekbuf_len; - int fd_close:1; -}; - -extern struct volume_id *volume_id_open_fd(int fd); -extern struct volume_id *volume_id_open_node(const char *path); -extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern void volume_id_close(struct volume_id *id); - -/* filesystems */ -extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ext(struct volume_id *id, uint64_t off); -extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off); -extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); -extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); -extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_minix(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); -extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off); -extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off); - -/* special formats */ -extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); -extern int volume_id_probe_luks(struct volume_id *id, uint64_t off); - -/* raid */ -extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off); -extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); - -/* bios raid */ -extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); -extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/libvolume_id/linux_raid.c b/extras/volume_id/libvolume_id/linux_raid.c deleted file mode 100644 index 85e8d8109b..0000000000 --- a/extras/volume_id/libvolume_id/linux_raid.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct mdp_super_block { - uint32_t md_magic; - uint32_t major_version; - uint32_t minor_version; - uint32_t patch_version; - uint32_t gvalid_words; - uint32_t set_uuid0; - uint32_t ctime; - uint32_t level; - uint32_t size; - uint32_t nr_disks; - uint32_t raid_disks; - uint32_t md_minor; - uint32_t not_persistent; - uint32_t set_uuid1; - uint32_t set_uuid2; - uint32_t set_uuid3; -} PACKED *mdp; - -#define MD_RESERVED_BYTES 0x10000 -#define MD_MAGIC 0xa92b4efc - -int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t sboff; - uint8_t uuid[16]; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; - buf = volume_id_get_buffer(id, off + sboff, 0x800); - if (buf == NULL) - return -1; - - mdp = (struct mdp_super_block *) buf; - - if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) - return -1; - - memcpy(uuid, &mdp->set_uuid0, 4); - memcpy(&uuid[4], &mdp->set_uuid1, 12); - volume_id_set_uuid(id, uuid, UUID_DCE); - - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", - le32_to_cpu(mdp->major_version), - le32_to_cpu(mdp->minor_version), - le32_to_cpu(mdp->patch_version)); - - dbg("found raid signature"); - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "linux_raid_member"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/linux_swap.c b/extras/volume_id/libvolume_id/linux_swap.c deleted file mode 100644 index 0193648c9e..0000000000 --- a/extras/volume_id/libvolume_id/linux_swap.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct swap_header_v1_2 { - uint8_t bootbits[1024]; - uint32_t version; - uint32_t last_page; - uint32_t nr_badpages; - uint8_t uuid[16]; - uint8_t volume_name[16]; -} PACKED *sw; - -#define LARGEST_PAGESIZE 0x4000 - -int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - unsigned int page; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - /* the swap signature is at the end of the PAGE_SIZE */ - for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { - buf = volume_id_get_buffer(id, off + page-10, 10); - if (buf == NULL) - return -1; - - if (memcmp(buf, "SWAP-SPACE", 10) == 0) { - strcpy(id->type_version, "1"); - goto found; - } - - if (memcmp(buf, "SWAPSPACE2", 10) == 0) { - sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); - if (sw == NULL) - return -1; - strcpy(id->type_version, "2"); - volume_id_set_label_raw(id, sw->volume_name, 16); - volume_id_set_label_string(id, sw->volume_name, 16); - volume_id_set_uuid(id, sw->uuid, UUID_DCE); - goto found; - } - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_OTHER); - id->type = "swap"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/lsi_raid.c b/extras/volume_id/libvolume_id/lsi_raid.c deleted file mode 100644 index f1db4a6e50..0000000000 --- a/extras/volume_id/libvolume_id/lsi_raid.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct lsi_meta { - uint8_t sig[6]; -} PACKED; - -#define LSI_SIGNATURE "$XIDE$" - -int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct lsi_meta *lsi; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - lsi = (struct lsi_meta *) buf; - if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "lsi_mega_raid_member"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/luks.c b/extras/volume_id/libvolume_id/luks.c deleted file mode 100644 index 64de85ac21..0000000000 --- a/extras/volume_id/libvolume_id/luks.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 W. Michael Petullo - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -#define SECTOR_SHIFT 9 -#define SECTOR_SIZE (1 << SECTOR_SHIFT) - -#define LUKS_CIPHERNAME_L 32 -#define LUKS_CIPHERMODE_L 32 -#define LUKS_HASHSPEC_L 32 -#define LUKS_DIGESTSIZE 20 -#define LUKS_SALTSIZE 32 -#define LUKS_NUMKEYS 8 - -const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; -#define LUKS_MAGIC_L 6 -#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) -#define UUID_STRING_L 40 - -struct luks_phdr { - uint8_t magic[LUKS_MAGIC_L]; - uint16_t version; - uint8_t cipherName[LUKS_CIPHERNAME_L]; - uint8_t cipherMode[LUKS_CIPHERMODE_L]; - uint8_t hashSpec[LUKS_HASHSPEC_L]; - uint32_t payloadOffset; - uint32_t keyBytes; - uint8_t mkDigest[LUKS_DIGESTSIZE]; - uint8_t mkDigestSalt[LUKS_SALTSIZE]; - uint32_t mkDigestIterations; - uint8_t uuid[UUID_STRING_L]; - struct { - uint32_t active; - uint32_t passwordIterations; - uint8_t passwordSalt[LUKS_SALTSIZE]; - uint32_t keyMaterialOffset; - uint32_t stripes; - } keyblock[LUKS_NUMKEYS]; -}; - -int volume_id_probe_luks(struct volume_id *id, uint64_t off) -{ - struct luks_phdr *header; - - header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE); - if (header == NULL) - return -1; - - if (memcmp(header->magic, LUKS_MAGIC, LUKS_MAGIC_L)) - return -1; - - volume_id_set_usage(id, VOLUME_ID_CRYPTO); - volume_id_set_uuid(id, header->uuid, UUID_DCE_STRING); - - id->type = "crypto_LUKS"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/lvm.c b/extras/volume_id/libvolume_id/lvm.c deleted file mode 100644 index 47d84b0968..0000000000 --- a/extras/volume_id/libvolume_id/lvm.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct lvm1_super_block { - uint8_t id[2]; -} PACKED; - -struct lvm2_super_block { - uint8_t id[8]; - uint64_t sector_xl; - uint32_t crc_xl; - uint32_t offset_xl; - uint8_t type[8]; -} PACKED; - -#define LVM1_SB_OFF 0x400 -#define LVM1_MAGIC "HM" - -int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct lvm1_super_block *lvm; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); - if (buf == NULL) - return -1; - - lvm = (struct lvm1_super_block *) buf; - - if (memcmp(lvm->id, LVM1_MAGIC, 2) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "LVM1_member"; - - return 0; -} - -#define LVM2_LABEL_ID "LABELONE" -#define LVM2LABEL_SCAN_SECTORS 4 - -int volume_id_probe_lvm2(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - unsigned int soff; - struct lvm2_super_block *lvm; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); - if (buf == NULL) - return -1; - - - for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { - lvm = (struct lvm2_super_block *) &buf[soff]; - - if (memcmp(lvm->id, LVM2_LABEL_ID, 8) == 0) - goto found; - } - - return -1; - -found: - memcpy(id->type_version, lvm->type, 8); - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "LVM2_member"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/minix.c b/extras/volume_id/libvolume_id/minix.c deleted file mode 100644 index 75e9c3acbd..0000000000 --- a/extras/volume_id/libvolume_id/minix.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct minix_super_block -{ - uint16_t s_ninodes; - uint16_t s_nzones; - uint16_t s_imap_blocks; - uint16_t s_zmap_blocks; - uint16_t s_firstdatazone; - uint16_t s_log_zone_size; - uint32_t s_max_size; - uint16_t s_magic; - uint16_t s_state; - uint32_t s_zones; -} PACKED; - -#define MINIX_SUPERBLOCK_OFFSET 0x400 - -int volume_id_probe_minix(struct volume_id *id, uint64_t off) -{ - struct minix_super_block *ms; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - ms = (struct minix_super_block *) volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); - if (ms == NULL) - return -1; - - if (le16_to_cpu(ms->s_magic) == 0x137f) { - strcpy(id->type_version, "1"); - goto found; - } - - if (le16_to_cpu(ms->s_magic) == 0x1387) { - strcpy(id->type_version, "1"); - goto found; - } - - if (le16_to_cpu(ms->s_magic) == 0x2468) { - strcpy(id->type_version, "2"); - goto found; - } - - if (le16_to_cpu(ms->s_magic) == 0x2478) { - strcpy(id->type_version, "2"); - goto found; - } - - goto exit; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "minix"; - return 0; - -exit: - return -1; -} diff --git a/extras/volume_id/libvolume_id/ntfs.c b/extras/volume_id/libvolume_id/ntfs.c deleted file mode 100644 index 23c64fc307..0000000000 --- a/extras/volume_id/libvolume_id/ntfs.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct ntfs_super_block { - uint8_t jump[3]; - uint8_t oem_id[8]; - uint16_t bytes_per_sector; - uint8_t sectors_per_cluster; - uint16_t reserved_sectors; - uint8_t fats; - uint16_t root_entries; - uint16_t sectors; - uint8_t media_type; - uint16_t sectors_per_fat; - uint16_t sectors_per_track; - uint16_t heads; - uint32_t hidden_sectors; - uint32_t large_sectors; - uint16_t unused[2]; - uint64_t number_of_sectors; - uint64_t mft_cluster_location; - uint64_t mft_mirror_cluster_location; - int8_t cluster_per_mft_record; - uint8_t reserved1[3]; - int8_t cluster_per_index_record; - uint8_t reserved2[3]; - uint8_t volume_serial[8]; - uint16_t checksum; -} PACKED *ns; - -struct master_file_table_record { - uint8_t magic[4]; - uint16_t usa_ofs; - uint16_t usa_count; - uint64_t lsn; - uint16_t sequence_number; - uint16_t link_count; - uint16_t attrs_offset; - uint16_t flags; - uint32_t bytes_in_use; - uint32_t bytes_allocated; -} PACKED *mftr; - -struct file_attribute { - uint32_t type; - uint32_t len; - uint8_t non_resident; - uint8_t name_len; - uint16_t name_offset; - uint16_t flags; - uint16_t instance; - uint32_t value_len; - uint16_t value_offset; -} PACKED *attr; - -struct volume_info { - uint64_t reserved; - uint8_t major_ver; - uint8_t minor_ver; -} PACKED *info; - -#define MFT_RECORD_VOLUME 3 -#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 -#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 -#define MFT_RECORD_ATTR_OBJECT_ID 0x40 -#define MFT_RECORD_ATTR_END 0xffffffffu - -int volume_id_probe_ntfs(struct volume_id *id, uint64_t off) -{ - unsigned int sector_size; - unsigned int cluster_size; - uint64_t mft_cluster; - uint64_t mft_off; - unsigned int mft_record_size; - unsigned int attr_type; - unsigned int attr_off; - unsigned int attr_len; - unsigned int val_off; - unsigned int val_len; - const uint8_t *buf; - const uint8_t *val; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); - if (ns == NULL) - return -1; - - if (memcmp(ns->oem_id, "NTFS", 4) != 0) - return -1; - - volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS); - - sector_size = le16_to_cpu(ns->bytes_per_sector); - cluster_size = ns->sectors_per_cluster * sector_size; - mft_cluster = le64_to_cpu(ns->mft_cluster_location); - mft_off = mft_cluster * cluster_size; - - if (ns->cluster_per_mft_record < 0) - /* size = -log2(mft_record_size); normally 1024 Bytes */ - mft_record_size = 1 << -ns->cluster_per_mft_record; - else - mft_record_size = ns->cluster_per_mft_record * cluster_size; - - dbg("sectorsize 0x%x", sector_size); - dbg("clustersize 0x%x", cluster_size); - dbg("mftcluster %llu", (unsigned long long) mft_cluster); - dbg("mftoffset 0x%llx", (unsigned long long) mft_off); - dbg("cluster per mft_record %i", ns->cluster_per_mft_record); - dbg("mft record size %i", mft_record_size); - - buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), - mft_record_size); - if (buf == NULL) - goto found; - - mftr = (struct master_file_table_record*) buf; - - dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); - if (memcmp(mftr->magic, "FILE", 4) != 0) - goto found; - - attr_off = le16_to_cpu(mftr->attrs_offset); - dbg("file $Volume's attributes are at offset %i", attr_off); - - while (1) { - attr = (struct file_attribute*) &buf[attr_off]; - attr_type = le32_to_cpu(attr->type); - attr_len = le16_to_cpu(attr->len); - val_off = le16_to_cpu(attr->value_offset); - val_len = le32_to_cpu(attr->value_len); - attr_off += attr_len; - - if (attr_len == 0) - break; - - if (attr_off >= mft_record_size) - break; - - if (attr_type == MFT_RECORD_ATTR_END) - break; - - dbg("found attribute type 0x%x, len %i, at offset %i", - attr_type, attr_len, attr_off); - - if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { - dbg("found info, len %i", val_len); - info = (struct volume_info*) (((uint8_t *) attr) + val_off); - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", info->major_ver, info->minor_ver); - } - - if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { - dbg("found label, len %i", val_len); - if (val_len > VOLUME_ID_LABEL_SIZE) - val_len = VOLUME_ID_LABEL_SIZE; - - val = ((uint8_t *) attr) + val_off; - volume_id_set_label_raw(id, val, val_len); - volume_id_set_label_unicode16(id, val, LE, val_len); - } - } - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "ntfs"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/nvidia_raid.c b/extras/volume_id/libvolume_id/nvidia_raid.c deleted file mode 100644 index 10c1c714f7..0000000000 --- a/extras/volume_id/libvolume_id/nvidia_raid.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct nvidia_meta { - uint8_t vendor[8]; - uint32_t size; - uint32_t chksum; - uint16_t version; -} PACKED; - -#define NVIDIA_SIGNATURE "NVIDIA" - -int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct nvidia_meta *nv; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-2) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - nv = (struct nvidia_meta *) buf; - if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le16_to_cpu(nv->version)); - id->type = "nvidia_raid_member"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/ocfs.c b/extras/volume_id/libvolume_id/ocfs.c deleted file mode 100644 index b376ead833..0000000000 --- a/extras/volume_id/libvolume_id/ocfs.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Andre Masella - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - - -struct ocfs1_super_block_header { - uint32_t minor_version; - uint32_t major_version; - uint8_t signature[128]; - uint8_t mount_point[128]; - uint64_t serial_num; - uint64_t device_size; - uint64_t start_off; - uint64_t bitmap_off; - uint64_t publ_off; - uint64_t vote_off; - uint64_t root_bitmap_off; - uint64_t data_start_off; - uint64_t root_bitmap_size; - uint64_t root_off; - uint64_t root_size; - uint64_t cluster_size; - uint64_t num_nodes; - uint64_t num_clusters; - uint64_t dir_node_size; - uint64_t file_node_size; - uint64_t internal_off; - uint64_t node_cfg_off; - uint64_t node_cfg_size; - uint64_t new_cfg_off; - uint32_t prot_bits; - int32_t excl_mount; -} PACKED; - -struct ocfs1_super_block_label { - struct ocfs1_disk_lock { - uint32_t curr_master; - uint8_t file_lock; - uint8_t compat_pad[3]; - uint64_t last_write_time; - uint64_t last_read_time; - uint32_t writer_node_num; - uint32_t reader_node_num; - uint64_t oin_node_map; - uint64_t dlock_seq_num; - } PACKED disk_lock; - uint8_t label[64]; - uint16_t label_len; - uint8_t vol_id[16]; - uint16_t vol_id_len; - uint8_t cluster_name[64]; - uint16_t cluster_name_len; -} PACKED; - -struct ocfs2_super_block { - uint8_t i_signature[8]; - uint32_t i_generation; - int16_t i_suballoc_slot; - uint16_t i_suballoc_bit; - uint32_t i_reserved0; - uint32_t i_clusters; - uint32_t i_uid; - uint32_t i_gid; - uint64_t i_size; - uint16_t i_mode; - uint16_t i_links_count; - uint32_t i_flags; - uint64_t i_atime; - uint64_t i_ctime; - uint64_t i_mtime; - uint64_t i_dtime; - uint64_t i_blkno; - uint64_t i_last_eb_blk; - uint32_t i_fs_generation; - uint32_t i_atime_nsec; - uint32_t i_ctime_nsec; - uint32_t i_mtime_nsec; - uint64_t i_reserved1[9]; - uint64_t i_pad1; - uint16_t s_major_rev_level; - uint16_t s_minor_rev_level; - uint16_t s_mnt_count; - int16_t s_max_mnt_count; - uint16_t s_state; - uint16_t s_errors; - uint32_t s_checkinterval; - uint64_t s_lastcheck; - uint32_t s_creator_os; - uint32_t s_feature_compat; - uint32_t s_feature_incompat; - uint32_t s_feature_ro_compat; - uint64_t s_root_blkno; - uint64_t s_system_dir_blkno; - uint32_t s_blocksize_bits; - uint32_t s_clustersize_bits; - uint16_t s_max_slots; - uint16_t s_reserved1; - uint32_t s_reserved2; - uint64_t s_first_cluster_group; - uint8_t s_label[64]; - uint8_t s_uuid[16]; -} PACKED; - -int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct ocfs1_super_block_header *osh; - struct ocfs1_super_block_label *osl; - - buf = volume_id_get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - osh = (struct ocfs1_super_block_header *) buf; - if (memcmp(osh->signature, "OracleCFS", 9) != 0) - return -1; - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", osh->major_version, osh->minor_version); - - dbg("found OracleCFS signature, now reading label"); - buf = volume_id_get_buffer(id, off + 0x200, 0x200); - if (buf == NULL) - return -1; - - osl = (struct ocfs1_super_block_label *) buf; - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - if (osl->label_len <= 64) { - volume_id_set_label_raw(id, osl->label, 64); - volume_id_set_label_string(id, osl->label, 64); - } - if (osl->vol_id_len == 16) - volume_id_set_uuid(id, osl->vol_id, UUID_DCE); - id->type = "ocfs"; - return 0; -} - -#define OCFS2_MAX_BLOCKSIZE 0x1000 -#define OCFS2_SUPER_BLOCK_BLKNO 2 - -int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) -{ - const uint8_t *buf; - struct ocfs2_super_block *os; - size_t blksize; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { - buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); - if (buf == NULL) - return -1; - - os = (struct ocfs2_super_block *) buf; - if (memcmp(os->i_signature, "OCFSV2", 6) != 0) - continue; - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - volume_id_set_label_raw(id, os->s_label, 64); - volume_id_set_label_string(id, os->s_label, 64); - volume_id_set_uuid(id, os->s_uuid, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", os->s_major_rev_level, os->s_minor_rev_level); - id->type = "ocfs2"; - return 0; - } - return -1; -} diff --git a/extras/volume_id/libvolume_id/promise_raid.c b/extras/volume_id/libvolume_id/promise_raid.c deleted file mode 100644 index 2a2ce1689e..0000000000 --- a/extras/volume_id/libvolume_id/promise_raid.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct promise_meta { - uint8_t sig[24]; -} PACKED; - -#define PDC_CONFIG_OFF 0x1200 -#define PDC_SIGNATURE "Promise Technology, Inc." - -int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct promise_meta *pdc; - unsigned int i; - static unsigned int sectors[] = { - 63, 255, 256, 16, 399, 0 - }; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x40000) - return -1; - - for (i = 0; sectors[i] != 0; i++) { - uint64_t meta_off; - - meta_off = ((size / 0x200) - sectors[i]) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - pdc = (struct promise_meta *) buf; - if (memcmp(pdc->sig, PDC_SIGNATURE, sizeof(PDC_SIGNATURE)-1) == 0) - goto found; - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "promise_fasttrack_raid_member"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/reiserfs.c b/extras/volume_id/libvolume_id/reiserfs.c deleted file mode 100644 index b5706f86e0..0000000000 --- a/extras/volume_id/libvolume_id/reiserfs.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * Copyright (C) 2005 Tobias Klauser - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct reiserfs_super_block { - uint32_t blocks_count; - uint32_t free_blocks; - uint32_t root_block; - uint32_t journal_block; - uint32_t journal_dev; - uint32_t orig_journal_size; - uint32_t dummy2[5]; - uint16_t blocksize; - uint16_t dummy3[3]; - uint8_t magic[12]; - uint32_t dummy4[5]; - uint8_t uuid[16]; - uint8_t label[16]; -} PACKED; - -struct reiser4_super_block { - uint8_t magic[16]; - uint16_t dummy[2]; - uint8_t uuid[16]; - uint8_t label[16]; - uint64_t dummy2; -} PACKED; - -#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 -#define REISERFS_SUPERBLOCK_OFFSET 0x10000 - -int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) -{ - struct reiserfs_super_block *rs; - struct reiser4_super_block *rs4; - uint8_t *buf; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - rs = (struct reiserfs_super_block *) buf;; - if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { - strcpy(id->type_version, "3.5"); - id->type = "reiserfs"; - goto found; - } - if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { - strcpy(id->type_version, "3.6"); - id->type = "reiserfs"; - goto found_label; - } - if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { - strcpy(id->type_version, "JR"); - id->type = "reiserfs"; - goto found_label; - } - - rs4 = (struct reiser4_super_block *) buf; - if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) { - strcpy(id->type_version, "4"); - volume_id_set_label_raw(id, rs4->label, 16); - volume_id_set_label_string(id, rs4->label, 16); - volume_id_set_uuid(id, rs4->uuid, UUID_DCE); - id->type = "reiser4"; - goto found; - } - - buf = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - rs = (struct reiserfs_super_block *) buf; - if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { - strcpy(id->type_version, "3.5"); - id->type = "reiserfs"; - goto found; - } - - return -1; - -found_label: - volume_id_set_label_raw(id, rs->label, 16); - volume_id_set_label_string(id, rs->label, 16); - volume_id_set_uuid(id, rs->uuid, UUID_DCE); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - - return 0; -} diff --git a/extras/volume_id/libvolume_id/romfs.c b/extras/volume_id/libvolume_id/romfs.c deleted file mode 100644 index 8bb2a0018a..0000000000 --- a/extras/volume_id/libvolume_id/romfs.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct romfs_super { - uint8_t magic[8]; - uint32_t size; - uint32_t checksum; - uint8_t name[0]; -} PACKED; - -int volume_id_probe_romfs(struct volume_id *id, uint64_t off) -{ - struct romfs_super *rfs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); - if (rfs == NULL) - return -1; - - if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { - size_t len = strlen((char *)rfs->name); - - if (len) { - volume_id_set_label_raw(id, rfs->name, len); - volume_id_set_label_string(id, rfs->name, len); - } - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "romfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/libvolume_id/silicon_raid.c b/extras/volume_id/libvolume_id/silicon_raid.c deleted file mode 100644 index 017b023e27..0000000000 --- a/extras/volume_id/libvolume_id/silicon_raid.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct silicon_meta { - uint8_t unknown0[0x2E]; - uint8_t ascii_version[0x36 - 0x2E]; - uint8_t diskname[0x56 - 0x36]; - uint8_t unknown1[0x60 - 0x56]; - uint32_t magic; - uint32_t unknown1a[0x6C - 0x64]; - uint32_t array_sectors_low; - uint32_t array_sectors_high; - uint8_t unknown2[0x78 - 0x74]; - uint32_t thisdisk_sectors; - uint8_t unknown3[0x100 - 0x7C]; - uint8_t unknown4[0x104 - 0x100]; - uint16_t product_id; - uint16_t vendor_id; - uint16_t minor_ver; - uint16_t major_ver; -} PACKED; - -#define SILICON_MAGIC 0x2F000000 - -int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct silicon_meta *sil; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - sil = (struct silicon_meta *) buf; - if (le32_to_cpu(sil->magic) != SILICON_MAGIC) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", - le16_to_cpu(sil->major_ver), le16_to_cpu(sil->minor_ver)); - id->type = "silicon_medley_raid_member"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/squashfs.c b/extras/volume_id/libvolume_id/squashfs.c deleted file mode 100644 index bdb1f16628..0000000000 --- a/extras/volume_id/libvolume_id/squashfs.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2006 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -#define SQUASHFS_MAGIC 0x73717368 - -struct squashfs_super { - uint32_t s_magic; -} PACKED; - -int volume_id_probe_squashfs(struct volume_id *id, uint64_t off) -{ - struct squashfs_super *sqs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - sqs = (struct squashfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); - if (sqs == NULL) - return -1; - - if (sqs->s_magic == SQUASHFS_MAGIC || sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) { - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "squashfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/libvolume_id/sysv.c b/extras/volume_id/libvolume_id/sysv.c deleted file mode 100644 index 52349c0623..0000000000 --- a/extras/volume_id/libvolume_id/sysv.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -#define SYSV_NICINOD 100 -#define SYSV_NICFREE 50 - -struct sysv_super -{ - uint16_t s_isize; - uint16_t s_pad0; - uint32_t s_fsize; - uint16_t s_nfree; - uint16_t s_pad1; - uint32_t s_free[SYSV_NICFREE]; - uint16_t s_ninode; - uint16_t s_pad2; - uint16_t s_inode[SYSV_NICINOD]; - uint8_t s_flock; - uint8_t s_ilock; - uint8_t s_fmod; - uint8_t s_ronly; - uint32_t s_time; - uint16_t s_dinfo[4]; - uint32_t s_tfree; - uint16_t s_tinode; - uint16_t s_pad3; - uint8_t s_fname[6]; - uint8_t s_fpack[6]; - uint32_t s_fill[12]; - uint32_t s_state; - uint32_t s_magic; - uint32_t s_type; -} PACKED; - -#define XENIX_NICINOD 100 -#define XENIX_NICFREE 100 - -struct xenix_super { - uint16_t s_isize; - uint32_t s_fsize; - uint16_t s_nfree; - uint32_t s_free[XENIX_NICFREE]; - uint16_t s_ninode; - uint16_t s_inode[XENIX_NICINOD]; - uint8_t s_flock; - uint8_t s_ilock; - uint8_t s_fmod; - uint8_t s_ronly; - uint32_t s_time; - uint32_t s_tfree; - uint16_t s_tinode; - uint16_t s_dinfo[4]; - uint8_t s_fname[6]; - uint8_t s_fpack[6]; - uint8_t s_clean; - uint8_t s_fill[371]; - uint32_t s_magic; - uint32_t s_type; -} PACKED; - -#define SYSV_SUPERBLOCK_BLOCK 0x01 -#define SYSV_MAGIC 0xfd187e20 -#define XENIX_SUPERBLOCK_BLOCK 0x18 -#define XENIX_MAGIC 0x2b5544 -#define SYSV_MAX_BLOCKSIZE 0x800 - -int volume_id_probe_sysv(struct volume_id *id, uint64_t off) -{ - struct sysv_super *vs; - struct xenix_super *xs; - unsigned int boff; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { - vs = (struct sysv_super *) - volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200); - if (vs == NULL) - return -1; - - if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) { - volume_id_set_label_raw(id, vs->s_fname, 6); - volume_id_set_label_string(id, vs->s_fname, 6); - id->type = "sysv"; - goto found; - } - } - - for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { - xs = (struct xenix_super *) - volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200); - if (xs == NULL) - return -1; - - if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) { - volume_id_set_label_raw(id, xs->s_fname, 6); - volume_id_set_label_string(id, xs->s_fname, 6); - id->type = "xenix"; - goto found; - } - } - - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - return 0; -} diff --git a/extras/volume_id/libvolume_id/udf.c b/extras/volume_id/libvolume_id/udf.c deleted file mode 100644 index d7497ec51b..0000000000 --- a/extras/volume_id/libvolume_id/udf.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct volume_descriptor { - struct descriptor_tag { - uint16_t id; - uint16_t version; - uint8_t checksum; - uint8_t reserved; - uint16_t serial; - uint16_t crc; - uint16_t crc_len; - uint32_t location; - } PACKED tag; - union { - struct anchor_descriptor { - uint32_t length; - uint32_t location; - } PACKED anchor; - struct primary_descriptor { - uint32_t seq_num; - uint32_t desc_num; - struct dstring { - uint8_t clen; - uint8_t c[31]; - } PACKED ident; - } PACKED primary; - } PACKED type; -} PACKED; - -struct volume_structure_descriptor { - uint8_t type; - uint8_t id[5]; - uint8_t version; -} PACKED; - -#define UDF_VSD_OFFSET 0x8000 - -int volume_id_probe_udf(struct volume_id *id, uint64_t off) -{ - struct volume_descriptor *vd; - struct volume_structure_descriptor *vsd; - unsigned int bs; - unsigned int b; - unsigned int type; - unsigned int count; - unsigned int loc; - unsigned int clen; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); - if (vsd == NULL) - return -1; - - if (memcmp(vsd->id, "NSR02", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "NSR03", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "BEA01", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "BOOT2", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "CD001", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "CDW02", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "TEA03", 5) == 0) - goto blocksize; - return -1; - -blocksize: - /* search the next VSD to get the logical block size of the volume */ - for (bs = 0x800; bs < 0x8000; bs += 0x800) { - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); - if (vsd == NULL) - return -1; - dbg("test for blocksize: 0x%x", bs); - if (vsd->id[0] != '\0') - goto nsr; - } - return -1; - -nsr: - /* search the list of VSDs for a NSR descriptor */ - for (b = 0; b < 64; b++) { - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); - if (vsd == NULL) - return -1; - - dbg("vsd: %c%c%c%c%c", - vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); - - if (vsd->id[0] == '\0') - return -1; - if (memcmp(vsd->id, "NSR02", 5) == 0) - goto anchor; - if (memcmp(vsd->id, "NSR03", 5) == 0) - goto anchor; - } - return -1; - -anchor: - /* read anchor volume descriptor */ - vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - if (type != 2) /* TAG_ID_AVDP */ - goto found; - - /* get desriptor list address and block count */ - count = le32_to_cpu(vd->type.anchor.length) / bs; - loc = le32_to_cpu(vd->type.anchor.location); - dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); - - /* pick the primary descriptor from the list */ - for (b = 0; b < count; b++) { - vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - dbg("descriptor type %i", type); - - /* check validity */ - if (type == 0) - goto found; - if (le32_to_cpu(vd->tag.location) != loc + b) - goto found; - - if (type == 1) /* TAG_ID_PVD */ - goto pvd; - } - goto found; - -pvd: - volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); - - clen = vd->type.primary.ident.clen; - dbg("label string charsize=%i bit", clen); - if (clen == 8) - volume_id_set_label_string(id, vd->type.primary.ident.c, 31); - else if (clen == 16) - volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "udf"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/ufs.c b/extras/volume_id/libvolume_id/ufs.c deleted file mode 100644 index d3960b1bec..0000000000 --- a/extras/volume_id/libvolume_id/ufs.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct ufs_super_block { - uint32_t fs_link; - uint32_t fs_rlink; - uint32_t fs_sblkno; - uint32_t fs_cblkno; - uint32_t fs_iblkno; - uint32_t fs_dblkno; - uint32_t fs_cgoffset; - uint32_t fs_cgmask; - uint32_t fs_time; - uint32_t fs_size; - uint32_t fs_dsize; - uint32_t fs_ncg; - uint32_t fs_bsize; - uint32_t fs_fsize; - uint32_t fs_frag; - uint32_t fs_minfree; - uint32_t fs_rotdelay; - uint32_t fs_rps; - uint32_t fs_bmask; - uint32_t fs_fmask; - uint32_t fs_bshift; - uint32_t fs_fshift; - uint32_t fs_maxcontig; - uint32_t fs_maxbpg; - uint32_t fs_fragshift; - uint32_t fs_fsbtodb; - uint32_t fs_sbsize; - uint32_t fs_csmask; - uint32_t fs_csshift; - uint32_t fs_nindir; - uint32_t fs_inopb; - uint32_t fs_nspf; - uint32_t fs_optim; - uint32_t fs_npsect_state; - uint32_t fs_interleave; - uint32_t fs_trackskew; - uint32_t fs_id[2]; - uint32_t fs_csaddr; - uint32_t fs_cssize; - uint32_t fs_cgsize; - uint32_t fs_ntrak; - uint32_t fs_nsect; - uint32_t fs_spc; - uint32_t fs_ncyl; - uint32_t fs_cpg; - uint32_t fs_ipg; - uint32_t fs_fpg; - struct ufs_csum { - uint32_t cs_ndir; - uint32_t cs_nbfree; - uint32_t cs_nifree; - uint32_t cs_nffree; - } PACKED fs_cstotal; - int8_t fs_fmod; - int8_t fs_clean; - int8_t fs_ronly; - int8_t fs_flags; - union { - struct { - int8_t fs_fsmnt[512]; - uint32_t fs_cgrotor; - uint32_t fs_csp[31]; - uint32_t fs_maxcluster; - uint32_t fs_cpc; - uint16_t fs_opostbl[16][8]; - } PACKED fs_u1; - struct { - int8_t fs_fsmnt[468]; - uint8_t fs_volname[32]; - uint64_t fs_swuid; - int32_t fs_pad; - uint32_t fs_cgrotor; - uint32_t fs_ocsp[28]; - uint32_t fs_contigdirs; - uint32_t fs_csp; - uint32_t fs_maxcluster; - uint32_t fs_active; - int32_t fs_old_cpc; - int32_t fs_maxbsize; - int64_t fs_sparecon64[17]; - int64_t fs_sblockloc; - struct ufs2_csum_total { - uint64_t cs_ndir; - uint64_t cs_nbfree; - uint64_t cs_nifree; - uint64_t cs_nffree; - uint64_t cs_numclusters; - uint64_t cs_spare[3]; - } PACKED fs_cstotal; - struct ufs_timeval { - int32_t tv_sec; - int32_t tv_usec; - } PACKED fs_time; - int64_t fs_size; - int64_t fs_dsize; - uint64_t fs_csaddr; - int64_t fs_pendingblocks; - int32_t fs_pendinginodes; - } PACKED fs_u2; - } fs_u11; - union { - struct { - int32_t fs_sparecon[53]; - int32_t fs_reclaim; - int32_t fs_sparecon2[1]; - int32_t fs_state; - uint32_t fs_qbmask[2]; - uint32_t fs_qfmask[2]; - } PACKED fs_sun; - struct { - int32_t fs_sparecon[53]; - int32_t fs_reclaim; - int32_t fs_sparecon2[1]; - uint32_t fs_npsect; - uint32_t fs_qbmask[2]; - uint32_t fs_qfmask[2]; - } PACKED fs_sunx86; - struct { - int32_t fs_sparecon[50]; - int32_t fs_contigsumsize; - int32_t fs_maxsymlinklen; - int32_t fs_inodefmt; - uint32_t fs_maxfilesize[2]; - uint32_t fs_qbmask[2]; - uint32_t fs_qfmask[2]; - int32_t fs_state; - } PACKED fs_44; - } fs_u2; - int32_t fs_postblformat; - int32_t fs_nrpos; - int32_t fs_postbloff; - int32_t fs_rotbloff; - uint32_t fs_magic; - uint8_t fs_space[1]; -} PACKED; - -#define UFS_MAGIC 0x00011954 -#define UFS2_MAGIC 0x19540119 -#define UFS_MAGIC_FEA 0x00195612 -#define UFS_MAGIC_LFN 0x00095014 - -int volume_id_probe_ufs(struct volume_id *id, uint64_t off) -{ - uint32_t magic; - int i; - struct ufs_super_block *ufs; - int offsets[] = {0, 8, 64, 256, -1}; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - for (i = 0; offsets[i] >= 0; i++) { - ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); - if (ufs == NULL) - return -1; - - dbg("offset 0x%x", offsets[i] * 0x400); - magic = be32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(be)", magic); - goto found; - } - magic = le32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(le)", magic); - goto found; - } - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "ufs"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/util.c b/extras/volume_id/libvolume_id/util.c deleted file mode 100644 index cf5392cf9a..0000000000 --- a/extras/volume_id/libvolume_id/util.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) -{ - unsigned int i, j; - uint16_t c; - - j = 0; - for (i = 0; i + 2 <= count; i += 2) { - if (endianess == LE) - c = (buf[i+1] << 8) | buf[i]; - else - c = (buf[i] << 8) | buf[i+1]; - if (c == 0) { - str[j] = '\0'; - break; - } else if (c < 0x80) { - if (j+1 >= len) - break; - str[j++] = (uint8_t) c; - } else if (c < 0x800) { - if (j+2 >= len) - break; - str[j++] = (uint8_t) (0xc0 | (c >> 6)); - str[j++] = (uint8_t) (0x80 | (c & 0x3f)); - } else { - if (j+3 >= len) - break; - str[j++] = (uint8_t) (0xe0 | (c >> 12)); - str[j++] = (uint8_t) (0x80 | ((c >> 6) & 0x3f)); - str[j++] = (uint8_t) (0x80 | (c & 0x3f)); - } - } - str[j] = '\0'; -} - -static char *usage_to_string(enum volume_id_usage usage_id) -{ - switch (usage_id) { - case VOLUME_ID_FILESYSTEM: - return "filesystem"; - case VOLUME_ID_OTHER: - return "other"; - case VOLUME_ID_RAID: - return "raid"; - case VOLUME_ID_DISKLABEL: - return "disklabel"; - case VOLUME_ID_CRYPTO: - return "crypto"; - case VOLUME_ID_UNPROBED: - return "unprobed"; - case VOLUME_ID_UNUSED: - return "unused"; - } - return NULL; -} - -void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) -{ - id->usage_id = usage_id; - id->usage = usage_to_string(usage_id); -} - -void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count) -{ - memcpy(id->label_raw, buf, count); - id->label_raw_len = count; -} - -void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) -{ - unsigned int i; - - memcpy(id->label, buf, count); - - /* remove trailing whitespace */ - i = strnlen(id->label, count); - while (i--) { - if (!isspace(id->label[i])) - break; - } - id->label[i+1] = '\0'; -} - -void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count) -{ - volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count); -} - -void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) -{ - unsigned int i; - unsigned int count = 0; - - switch(format) { - case UUID_DOS: - count = 4; - break; - case UUID_NTFS: - case UUID_HFS: - count = 8; - break; - case UUID_DCE: - count = 16; - break; - case UUID_DCE_STRING: - count = 36; - break; - } - memcpy(id->uuid_raw, buf, count); - id->uuid_raw_len = count; - - /* if set, create string in the same format, the native platform uses */ - for (i = 0; i < count; i++) - if (buf[i] != 0) - goto set; - return; - -set: - switch(format) { - case UUID_DOS: - sprintf(id->uuid, "%02X%02X-%02X%02X", - buf[3], buf[2], buf[1], buf[0]); - break; - case UUID_NTFS: - sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", - buf[7], buf[6], buf[5], buf[4], - buf[3], buf[2], buf[1], buf[0]); - break; - case UUID_HFS: - sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], buf[6], buf[7]); - break; - case UUID_DCE: - sprintf(id->uuid, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], - buf[6], buf[7], - buf[8], buf[9], - buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); - break; - case UUID_DCE_STRING: - memcpy(id->uuid, buf, count); - id->uuid[count] = '\0'; - break; - } -} - -uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) -{ - ssize_t buf_len; - - dbg("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); - /* check if requested area fits in superblock buffer */ - if (off + len <= SB_BUFFER_SIZE) { - if (id->sbbuf == NULL) { - id->sbbuf = malloc(SB_BUFFER_SIZE); - if (id->sbbuf == NULL) { - dbg("error malloc"); - return NULL; - } - } - - /* check if we need to read */ - if ((off + len) > id->sbbuf_len) { - dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len)); - if (lseek(id->fd, 0, SEEK_SET) < 0) { - dbg("lseek failed (%s)", strerror(errno)); - return NULL; - } - buf_len = read(id->fd, id->sbbuf, off + len); - if (buf_len < 0) { - dbg("read failed (%s)", strerror(errno)); - return NULL; - } - dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); - id->sbbuf_len = buf_len; - if ((size_t)buf_len < off + len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); - return NULL; - } - } - - return &(id->sbbuf[off]); - } else { - if (len > SEEK_BUFFER_SIZE) { - dbg("seek buffer too small %d", SEEK_BUFFER_SIZE); - return NULL; - } - - /* get seek buffer */ - if (id->seekbuf == NULL) { - id->seekbuf = malloc(SEEK_BUFFER_SIZE); - if (id->seekbuf == NULL) { - dbg("error malloc"); - return NULL; - } - } - - /* check if we need to read */ - if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - dbg("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); - if (lseek(id->fd, off, SEEK_SET) < 0) { - dbg("lseek failed (%s)", strerror(errno)); - return NULL; - } - buf_len = read(id->fd, id->seekbuf, len); - if (buf_len < 0) { - dbg("read failed (%s)", strerror(errno)); - return NULL; - } - dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); - id->seekbuf_off = off; - id->seekbuf_len = buf_len; - if ((size_t)buf_len < len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); - return NULL; - } - } - - return &(id->seekbuf[off - id->seekbuf_off]); - } -} - -void volume_id_free_buffer(struct volume_id *id) -{ - if (id->sbbuf != NULL) { - free(id->sbbuf); - id->sbbuf = NULL; - id->sbbuf_len = 0; - } - if (id->seekbuf != NULL) { - free(id->seekbuf); - id->seekbuf = NULL; - id->seekbuf_len = 0; - } -} diff --git a/extras/volume_id/libvolume_id/util.h b/extras/volume_id/libvolume_id/util.h deleted file mode 100644 index 1d1b53bb57..0000000000 --- a/extras/volume_id/libvolume_id/util.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005-2006 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_UTIL_ -#define _VOLUME_ID_UTIL_ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#define err(format, arg...) volume_id_log(LOG_ERR, __FILE__, __LINE__, format, ##arg) -#define info(format, arg...) volume_id_log(LOG_INFO, __FILE__, __LINE__, format, ##arg) -#ifdef DEBUG -#define dbg(format, arg...) volume_id_log(LOG_DEBUG, __FILE__, __LINE__, format, ##arg) -#else -#define dbg(format, arg...) do { } while (0) -#endif - -/* size of superblock buffer, reiserfs block is at 64k */ -#define SB_BUFFER_SIZE 0x11000 -/* size of seek buffer, FAT cluster is 32k max */ -#define SEEK_BUFFER_SIZE 0x10000 - -#ifdef __BYTE_ORDER -#if (__BYTE_ORDER == __LITTLE_ENDIAN) -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#define le64_to_cpu(x) (x) -#define be16_to_cpu(x) bswap_16(x) -#define be32_to_cpu(x) bswap_32(x) -#define cpu_to_le16(x) (x) -#define cpu_to_le32(x) (x) -#define cpu_to_be32(x) bswap_32(x) -#elif (__BYTE_ORDER == __BIG_ENDIAN) -#define le16_to_cpu(x) bswap_16(x) -#define le32_to_cpu(x) bswap_32(x) -#define le64_to_cpu(x) bswap_64(x) -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_le16(x) bswap_16(x) -#define cpu_to_le32(x) bswap_32(x) -#define cpu_to_be32(x) (x) -#endif -#endif /* __BYTE_ORDER */ - -enum uuid_format { - UUID_DCE_STRING, - UUID_DCE, - UUID_DOS, - UUID_NTFS, - UUID_HFS, -}; - -enum endian { - LE = 0, - BE = 1 -}; - -extern void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); -extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); -extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); -extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); -extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); -extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format); -extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); -extern void volume_id_free_buffer(struct volume_id *id); - -#endif /* _VOLUME_ID_UTIL_ */ - diff --git a/extras/volume_id/libvolume_id/via_raid.c b/extras/volume_id/libvolume_id/via_raid.c deleted file mode 100644 index 42cb098065..0000000000 --- a/extras/volume_id/libvolume_id/via_raid.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct via_meta { - uint16_t signature; - uint8_t version_number; - struct via_array { - uint16_t disk_bits; - uint8_t disk_array_ex; - uint32_t capacity_low; - uint32_t capacity_high; - uint32_t serial_checksum; - } PACKED array; - uint32_t serial_checksum[8]; - uint8_t checksum; -} PACKED; - -#define VIA_SIGNATURE 0xAA55 - -int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct via_meta *via; - - dbg("probing at offset 0x%llx, size 0x%llx", - (unsigned long long) off, (unsigned long long) size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - via = (struct via_meta *) buf; - if (le16_to_cpu(via->signature) != VIA_SIGNATURE) - return -1; - - if (via->version_number > 1) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", via->version_number); - id->type = "via_raid_member"; - - return 0; -} diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c deleted file mode 100644 index 073ad79c77..0000000000 --- a/extras/volume_id/libvolume_id/volume_id.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * volume_id - reads volume label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -/* the user can overwrite this log function */ -static void default_log(int priority, const char *file, int line, const char *format, ...) -{ - return; -} - -volume_id_log_fn volume_id_log = default_log; - -int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - if (id == NULL) - return -EINVAL; - - /* probe for raid first, cause fs probes may be successful on raid members */ - if (size) { - if (volume_id_probe_linux_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_intel_software_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_lsi_mega_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_via_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_silicon_medley_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_nvidia_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_promise_fasttrack_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0) - goto found; - } - - if (volume_id_probe_lvm1(id, off) == 0) - goto found; - - if (volume_id_probe_lvm2(id, off) == 0) - goto found; - - if (volume_id_probe_highpoint_37x_raid(id, off) == 0) - goto found; - - return -1; - -found: - /* If recognized, we free the allocated buffers */ - volume_id_free_buffer(id); - return 0; -} - -int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size) -{ - if (id == NULL) - return -EINVAL; - - if (volume_id_probe_luks(id, off) == 0) - goto found; - - /* signature in the first block, only small buffer needed */ - if (volume_id_probe_vfat(id, off) == 0) - goto found; - - if (volume_id_probe_xfs(id, off) == 0) - goto found; - - /* fill buffer with maximum */ - volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); - - if (volume_id_probe_linux_swap(id, off) == 0) - goto found; - - if (volume_id_probe_ext(id, off) == 0) - goto found; - - if (volume_id_probe_reiserfs(id, off) == 0) - goto found; - - if (volume_id_probe_jfs(id, off) == 0) - goto found; - - if (volume_id_probe_udf(id, off) == 0) - goto found; - - if (volume_id_probe_iso9660(id, off) == 0) - goto found; - - if (volume_id_probe_hfs_hfsplus(id, off) == 0) - goto found; - - if (volume_id_probe_ufs(id, off) == 0) - goto found; - - if (volume_id_probe_ntfs(id, off) == 0) - goto found; - - if (volume_id_probe_cramfs(id, off) == 0) - goto found; - - if (volume_id_probe_romfs(id, off) == 0) - goto found; - - if (volume_id_probe_hpfs(id, off) == 0) - goto found; - - if (volume_id_probe_sysv(id, off) == 0) - goto found; - - if (volume_id_probe_minix(id, off) == 0) - goto found; - - if (volume_id_probe_ocfs1(id, off) == 0) - goto found; - - if (volume_id_probe_ocfs2(id, off) == 0) - goto found; - - if (volume_id_probe_vxfs(id, off) == 0) - goto found; - - if (volume_id_probe_squashfs(id, off) == 0) - goto found; - - return -1; - -found: - /* If recognized, we free the allocated buffers */ - volume_id_free_buffer(id); - return 0; -} - -int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) -{ - if (id == NULL) - return -EINVAL; - - if (volume_id_probe_raid(id, off, size) == 0) - return 0; - - if (volume_id_probe_filesystem(id, off, size) == 0) - return 0; - - return -1; -} - -/* open volume by already open file descriptor */ -struct volume_id *volume_id_open_fd(int fd) -{ - struct volume_id *id; - - id = malloc(sizeof(struct volume_id)); - if (id == NULL) - return NULL; - memset(id, 0x00, sizeof(struct volume_id)); - - id->fd = fd; - - return id; -} - -/* open volume by device node */ -struct volume_id *volume_id_open_node(const char *path) -{ - struct volume_id *id; - int fd; - - fd = open(path, O_RDONLY); - if (fd < 0) { - dbg("unable to open '%s'", path); - return NULL; - } - - id = volume_id_open_fd(fd); - if (id == NULL) - return NULL; - - /* close fd on device close */ - id->fd_close = 1; - - return id; -} - -void volume_id_close(struct volume_id *id) -{ - if (id == NULL) - return; - - if (id->fd_close != 0) - close(id->fd); - - volume_id_free_buffer(id); - - free(id); -} diff --git a/extras/volume_id/libvolume_id/vxfs.c b/extras/volume_id/libvolume_id/vxfs.c deleted file mode 100644 index d10cc37762..0000000000 --- a/extras/volume_id/libvolume_id/vxfs.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -#define VXFS_SUPER_MAGIC 0xa501FCF5 - -struct vxfs_super { - uint32_t vs_magic; - int32_t vs_version; -} PACKED; - -int volume_id_probe_vxfs(struct volume_id *id, uint64_t off) -{ - struct vxfs_super *vxs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); - if (vxs == NULL) - return -1; - - if (vxs->vs_magic == cpu_to_le32(VXFS_SUPER_MAGIC)) { - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", (unsigned int) vxs->vs_version); - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "vxfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/libvolume_id/xfs.c b/extras/volume_id/libvolume_id/xfs.c deleted file mode 100644 index 3d870c41e7..0000000000 --- a/extras/volume_id/libvolume_id/xfs.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "util.h" - -struct xfs_super_block { - uint8_t magic[4]; - uint32_t blocksize; - uint64_t dblocks; - uint64_t rblocks; - uint32_t dummy1[2]; - uint8_t uuid[16]; - uint32_t dummy2[15]; - uint8_t fname[12]; - uint32_t dummy3[2]; - uint64_t icount; - uint64_t ifree; - uint64_t fdblocks; -} PACKED; - -int volume_id_probe_xfs(struct volume_id *id, uint64_t off) -{ - struct xfs_super_block *xs; - - dbg("probing at offset 0x%llx", (unsigned long long) off); - - xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); - if (xs == NULL) - return -1; - - if (memcmp(xs->magic, "XFSB", 4) != 0) - return -1; - - volume_id_set_label_raw(id, xs->fname, 12); - volume_id_set_label_string(id, xs->fname, 12); - volume_id_set_uuid(id, xs->uuid, UUID_DCE); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "xfs"; - - return 0; -} diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index b086b3710c..3a7361a6ac 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -31,7 +31,7 @@ #include #include "../../udev.h" -#include "libvolume_id/libvolume_id.h" +#include "lib/libvolume_id.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) -- cgit v1.2.3-54-g00ecf From c643d6183653ab908fbda48892357daa29dd5c52 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 27 Mar 2006 19:30:56 +0200 Subject: volume_id: use shared library by default --- extras/volume_id/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 78dfd867bc..72e2d3abb1 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -36,7 +36,11 @@ lib/libvolume_id.a: $(PROG): %: $(HEADERS) %.o lib/libvolume_id.a $(E) " LD " $@ +ifeq ($(strip $(VOLUME_ID_STATIC)),true) $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) lib/libvolume_id.a $(LIB_OBJS) +else + $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) -Llib -lvolume_id $(LIB_OBJS) +endif ifneq ($(strip $(STRIPCMD)),) $(E) " STRIP " $@ $(Q) $(STRIPCMD) $@ -- cgit v1.2.3-54-g00ecf From e688ad2d0da96db1e801ccc21189111ddee1bf40 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 27 Mar 2006 20:22:00 +0200 Subject: because is better than cause --- FAQ | 2 +- RELEASE-NOTES | 10 +++++----- extras/volume_id/lib/volume_id.c | 2 +- udev_add.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/FAQ b/FAQ index abe88638b2..4285d98ff7 100644 --- a/FAQ +++ b/FAQ @@ -51,7 +51,7 @@ A: Yes, udev can create /dev nodes using the devfs naming policy. A to the devfs names. See the udev.rules.devfs file in the udev release. Note that the devfs scheme is not recommended or officially supported - cause it is a really stupid idea to simply enumerate devices in a world + because it is a really stupid idea to simply enumerate devices in a world where devices can come and go at any time. These numbers give you nothing but problems, and are not useful to identify a device. Have a look at the persistent disk rules for an example how to do it correctly in userspace diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 93b4a19f9f..1dc4dfe9db 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -237,7 +237,7 @@ udev 069 A bunch of mostly trivial bugfixes. From now on no node name or symlink name can contain any character than plain whitelisted ascii characters or validated utf8 byte-streams. This is needed for the -/dev/disk/by-label/* links, cause we import untrusted data and +/dev/disk/by-label/* links, because we import untrusted data and export it to the filesystem. udev 068 @@ -249,7 +249,7 @@ situations. udev 067 ======== Bugfix. udevstart event ordering was broken for a long time. -The new run_program() uncovered it, cause /dev/null was not +The new run_program() uncovered it, because /dev/null was not available while we try to run external programs. Now udevstart should create it before we run anything. @@ -274,7 +274,7 @@ Mostly bugfixes and see ChangeLog. The test for the existence of an environment value should be switched from: ENV{KEY}=="*" to ENV{KEY}=="?*" -cause "*" will not fail anymore, if the key does not exist or +because "*" will not fail anymore, if the key does not exist or is empty. udev 063 @@ -447,7 +447,7 @@ We support an unlimited count of symlinks now. If USE_STATIC=true is passed to a glibc build, we link statically and use a built-in userdb parser to resolve user and group names. -The PLACE= key is gone. It can be replaced by an ID= for a long time, cause +The PLACE= key is gone. It can be replaced by an ID= for a long time, because we walk up the chain of physical devices to find a match. The KEY="" format supports '=', '==', '!=,' , '+=' now. This makes it @@ -462,5 +462,5 @@ but existing rules should be converted if possible, to be better readable. We have new ENV{}== key now, to match against a maximum of 5 environment variables. -udevstart is its own binary again, cause we don't need co carry this araound +udevstart is its own binary again, because we don't need co carry this araound with every forked event. diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 073ad79c77..4662b210dc 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -42,7 +42,7 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; - /* probe for raid first, cause fs probes may be successful on raid members */ + /* probe for raid first, because fs probes may be successful on raid members */ if (size) { if (volume_id_probe_linux_raid(id, off, size) == 0) goto found; diff --git a/udev_add.c b/udev_add.c index 398dcb58fa..6c023ab968 100644 --- a/udev_add.c +++ b/udev_add.c @@ -54,7 +54,7 @@ int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mo /* preserve node with already correct numbers, to prevent changing the inode number */ if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { - info("preserve file '%s', cause it has correct dev_t", file); + info("preserve file '%s', because it has correct dev_t", file); selinux_setfilecon(file, udev->dev->kernel_name, stats.st_mode); goto perms; } @@ -279,7 +279,7 @@ int udev_add_device(struct udevice *udev) goto exit; info("renamed netif to '%s'", udev->name); - /* we've changed the name, now fake the devpath, cause the + /* we've changed the name, now fake the devpath, because the * original kernel name sleeps with the fishes and we don't * get an event from the kernel with the new name */ -- cgit v1.2.3-54-g00ecf From d5618ac96913efa0b52501b6a5c690bee6a33517 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 27 Mar 2006 23:03:25 +0200 Subject: volume_id: remove some global symbols --- extras/volume_id/lib/hfs.c | 4 ++-- extras/volume_id/lib/linux_raid.c | 2 +- extras/volume_id/lib/linux_swap.c | 2 +- extras/volume_id/lib/luks.c | 2 +- extras/volume_id/lib/ntfs.c | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index a6e378dd28..f666b18379 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -36,7 +36,7 @@ struct hfs_finder_info{ uint8_t id[8]; } PACKED; -struct hfs_mdb { +static struct hfs_mdb { uint8_t signature[2]; uint32_t cr_date; uint32_t ls_Mod; @@ -104,7 +104,7 @@ struct hfsplus_fork { struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; } PACKED; -struct hfsplus_vol_header { +static struct hfsplus_vol_header { uint8_t signature[2]; uint16_t version; uint32_t attributes; diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 85e8d8109b..ad4a5ba4d6 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -26,7 +26,7 @@ #include "libvolume_id.h" #include "util.h" -struct mdp_super_block { +static struct mdp_super_block { uint32_t md_magic; uint32_t major_version; uint32_t minor_version; diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 0193648c9e..b63f1e6c00 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -26,7 +26,7 @@ #include "libvolume_id.h" #include "util.h" -struct swap_header_v1_2 { +static struct swap_header_v1_2 { uint8_t bootbits[1024]; uint32_t version; uint32_t last_page; diff --git a/extras/volume_id/lib/luks.c b/extras/volume_id/lib/luks.c index 64de85ac21..f3ec20eade 100644 --- a/extras/volume_id/lib/luks.c +++ b/extras/volume_id/lib/luks.c @@ -36,7 +36,7 @@ #define LUKS_SALTSIZE 32 #define LUKS_NUMKEYS 8 -const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; +static const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; #define LUKS_MAGIC_L 6 #define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) #define UUID_STRING_L 40 diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index 23c64fc307..f1e8c4bc29 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -26,7 +26,7 @@ #include "libvolume_id.h" #include "util.h" -struct ntfs_super_block { +static struct ntfs_super_block { uint8_t jump[3]; uint8_t oem_id[8]; uint16_t bytes_per_sector; @@ -53,7 +53,7 @@ struct ntfs_super_block { uint16_t checksum; } PACKED *ns; -struct master_file_table_record { +static struct master_file_table_record { uint8_t magic[4]; uint16_t usa_ofs; uint16_t usa_count; @@ -66,7 +66,7 @@ struct master_file_table_record { uint32_t bytes_allocated; } PACKED *mftr; -struct file_attribute { +static struct file_attribute { uint32_t type; uint32_t len; uint8_t non_resident; @@ -78,7 +78,7 @@ struct file_attribute { uint16_t value_offset; } PACKED *attr; -struct volume_info { +static struct volume_info { uint64_t reserved; uint8_t major_ver; uint8_t minor_ver; -- cgit v1.2.3-54-g00ecf From 92da64c700371126ee3bde79f983e0b3056d9442 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Mar 2006 02:52:58 +0200 Subject: volume_id: define exported symbols --- extras/volume_id/lib/Makefile | 4 +++- extras/volume_id/lib/exported_symbols | 43 +++++++++++++++++++++++++++++++++++ extras/volume_id/lib/libvolume_id.h | 4 ++-- extras/volume_id/lib/util.h | 6 ++--- extras/volume_id/lib/volume_id.c | 2 +- extras/volume_id/vol_id.c | 6 ++--- 6 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 extras/volume_id/lib/exported_symbols diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 6a12f0e67a..f69df5f5ca 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -81,7 +81,9 @@ libvolume_id.a: $(HEADERS) $(OBJS) $(SHLIB): $(HEADERS) .shlib $(addprefix .shlib/,$(OBJS)) $(E) " CC " $@ - $(Q) $(CC) -shared $(CFLAGS) -o $@ -Wl,-soname,libvolume_id.so.$(SHLIB_CUR) $(addprefix .shlib/,$(OBJS)) + $(Q) $(CC) -shared $(CFLAGS) -o $@ \ + -Wl,-soname,libvolume_id.so.$(SHLIB_CUR),--version-script,exported_symbols \ + $(addprefix .shlib/,$(OBJS)) $(Q) ln -sf $@ libvolume_id.so.$(SHLIB_CUR) $(Q) ln -sf $@ libvolume_id.so diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols new file mode 100644 index 0000000000..b1ff3cce3a --- /dev/null +++ b/extras/volume_id/lib/exported_symbols @@ -0,0 +1,43 @@ +{ global: + volume_id_log_fn; + volume_id_open_fd; + volume_id_open_node; + volume_id_probe_all; + volume_id_probe_filesystem; + volume_id_probe_raid; + volume_id_close; + + volume_id_probe_cramfs; + volume_id_probe_ext; + volume_id_probe_vfat; + volume_id_probe_hfs_hfsplus; + volume_id_probe_hpfs; + volume_id_probe_iso9660; + volume_id_probe_jfs; + volume_id_probe_minix; + volume_id_probe_ntfs; + volume_id_probe_ocfs1; + volume_id_probe_ocfs2; + volume_id_probe_reiserfs; + volume_id_probe_romfs; + volume_id_probe_sysv; + volume_id_probe_udf; + volume_id_probe_ufs; + volume_id_probe_vxfs; + volume_id_probe_xfs; + volume_id_probe_squashfs; + + volume_id_probe_linux_raid; + volume_id_probe_lvm1; + volume_id_probe_lvm2; + volume_id_probe_intel_software_raid; + volume_id_probe_highpoint_37x_raid; + volume_id_probe_highpoint_45x_raid; + volume_id_probe_lsi_mega_raid; + volume_id_probe_nvidia_raid; + volume_id_probe_promise_fasttrack_raid; + volume_id_probe_silicon_medley_raid; + volume_id_probe_via_raid; +local: + *; +}; diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index 7faf8d8af3..06b1baa9d0 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -19,10 +19,10 @@ #endif -typedef void (*volume_id_log_fn)(int priority, const char *file, int line, const char *format, ...) +typedef void (*volume_id_log_fn_t)(int priority, const char *file, int line, const char *format, ...) __attribute__ ((format(printf, 4, 5))); -extern volume_id_log_fn volume_id_log; +extern volume_id_log_fn_t volume_id_log_fn; #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index 1d1b53bb57..dc60a09123 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -23,10 +23,10 @@ #include #include -#define err(format, arg...) volume_id_log(LOG_ERR, __FILE__, __LINE__, format, ##arg) -#define info(format, arg...) volume_id_log(LOG_INFO, __FILE__, __LINE__, format, ##arg) +#define err(format, arg...) volume_id_log_fn(LOG_ERR, __FILE__, __LINE__, format, ##arg) +#define info(format, arg...) volume_id_log_fn(LOG_INFO, __FILE__, __LINE__, format, ##arg) #ifdef DEBUG -#define dbg(format, arg...) volume_id_log(LOG_DEBUG, __FILE__, __LINE__, format, ##arg) +#define dbg(format, arg...) volume_id_log_fn(LOG_DEBUG, __FILE__, __LINE__, format, ##arg) #else #define dbg(format, arg...) do { } while (0) #endif diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 4662b210dc..9f8e39b518 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -35,7 +35,7 @@ static void default_log(int priority, const char *file, int line, const char *fo return; } -volume_id_log_fn volume_id_log = default_log; +volume_id_log_fn_t volume_id_log_fn = default_log; int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) { diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 3a7361a6ac..2274550c19 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -1,7 +1,7 @@ /* - * vol_id - udev callout to read filesystem label and uuid + * vol_id - read filesystem label and uuid * - * Copyright (C) 2005 Kay Sievers + * Copyright (C) 2005-2006 Kay Sievers * * 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 @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) logging_init("vol_id"); /* hook in our debug into libvolume_id */ - volume_id_log = vid_log; + volume_id_log_fn = vid_log; for (i = 1 ; i < argc; i++) { char *arg = argv[i]; -- cgit v1.2.3-54-g00ecf From 15ff0ba36e9c1f051fe1e35e69f8569d0dfe2d66 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Mar 2006 03:09:18 +0200 Subject: remove all stripping code --- Makefile | 10 +--------- README | 3 --- extras/ata_id/Makefile | 4 ---- extras/cdrom_id/Makefile | 4 ---- extras/dasd_id/Makefile | 4 ---- extras/edd_id/Makefile | 4 ---- extras/firmware/Makefile | 4 ---- extras/floppy/Makefile | 4 ---- extras/run_directory/Makefile | 4 ---- extras/scsi_id/Makefile | 4 ---- extras/usb_id/Makefile | 4 ---- extras/volume_id/Makefile | 4 ---- 12 files changed, 1 insertion(+), 52 deletions(-) diff --git a/Makefile b/Makefile index d3341a6c83..1b9534c7b8 100644 --- a/Makefile +++ b/Makefile @@ -117,8 +117,6 @@ LD = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar RANLIB = $(CROSS_COMPILE)ranlib HOSTCC = gcc -STRIP = $(CROSS_COMPILE)strip -STRIPCMD = $(STRIP) -s CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ @@ -138,7 +136,6 @@ endif # if DEBUG is enabled, then we do not strip ifeq ($(strip $(DEBUG)),true) CFLAGS += -DDEBUG - STRIPCMD = endif ifeq ($(strip $(USE_GCOV)),true) @@ -178,7 +175,6 @@ all: $(PROGRAMS) $(MAN_PAGES) CFLAGS="$(CFLAGS)" \ LD="$(LD)" \ LDFLAGS="$(LDFLAGS)" \ - STRIPCMD="$(STRIPCMD)" \ LIB_OBJS="$(LIB_OBJS)" \ LIBUDEV="$(PWD)/$(LIBUDEV)" \ -C $$target $@ || exit 1; \ @@ -198,10 +194,6 @@ all: $(PROGRAMS) $(MAN_PAGES) $(PROGRAMS): %: $(HEADERS) $(GEN_HEADERS) $(LIBUDEV) %.o $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(STRIPCMD),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif $(LIBUDEV): $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS) $(Q) rm -f $@ @@ -349,7 +341,7 @@ ChangeLog: Makefile @ rm $@.tmp gcov-all: - $(MAKE) clean all STRIPCMD= USE_GCOV=true + $(MAKE) clean all USE_GCOV=true @ echo @ echo "binaries built with gcov support." @ echo "run the tests and analyze with 'make udev_gcov.txt'" diff --git a/README b/README index 21a6c186dc..c188506b53 100644 --- a/README +++ b/README @@ -66,9 +66,6 @@ Compile Options: If set to 'true', very verbose debugging messages will be compiled into the udev binaries. The actual level of debugging is specified in the udev config file. - STRIPCMD - If udev is compiled for packaging an empty string can be passed - to disable the stripping of the binaries. USE_SELINUX If set to 'true', udev will be built with SELinux support enabled. This is disabled by default. diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index 9049a35787..690100082e 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -36,10 +36,6 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif # man pages %.8: %.xml diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index 59c2532d41..c7479ed4ed 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -36,10 +36,6 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif # man pages %.8: %.xml diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 6831a9d507..76f5949c12 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -36,10 +36,6 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif # man pages %.8: %.xml diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 8afd8cc2fd..9671878a57 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -36,10 +36,6 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif # man pages %.8: %.xml diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index d6b13b20db..a30c0fcd5b 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -36,10 +36,6 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif # man pages %.8: %.xml diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 7b46a5f00c..a06ebc8b39 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -36,10 +36,6 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif # man pages %.8: %.xml diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 0b52326a9a..7ad6c547b8 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -35,10 +35,6 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif # man pages %.8: %.xml diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index b185998b19..544954dc7e 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -39,10 +39,6 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(STRIPCMD),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif scsi_id_version.h: $(E) " GENHDR " $@ diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index b3c417276a..40555fd52c 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -36,10 +36,6 @@ all: $(PROG) $(MAN_PAGES) $(PROG): %: $(HEADERS) %.o $(OBJS) $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) -ifneq ($(strip $(STRIPCMD)),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif # man pages %.8: %.xml diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 72e2d3abb1..759ea549cc 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -41,10 +41,6 @@ ifeq ($(strip $(VOLUME_ID_STATIC)),true) else $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) -Llib -lvolume_id $(LIB_OBJS) endif -ifneq ($(strip $(STRIPCMD)),) - $(E) " STRIP " $@ - $(Q) $(STRIPCMD) $@ -endif # man pages %.8: %.xml -- cgit v1.2.3-54-g00ecf From 16801abde1888e24af9652e99522eab8ee8cb057 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Mar 2006 20:16:34 +0200 Subject: man pages: mention udev(7) not udev(8) Thanks to: Henrique de Moraes Holschuh --- extras/ata_id/ata_id.8 | 2 +- extras/cdrom_id/cdrom_id.8 | 2 +- extras/dasd_id/dasd_id.8 | 2 +- extras/edd_id/edd_id.8 | 2 +- extras/scsi_id/scsi_id.8 | 2 +- extras/volume_id/vol_id.8 | 2 +- udevd.8 | 2 +- udevd.xml | 2 +- udevinfo.8 | 2 +- udevinfo.xml | 2 +- udevmonitor.8 | 2 +- udevmonitor.xml | 2 +- udevsend.8 | 2 +- udevsend.xml | 2 +- udevstart.8 | 2 +- udevstart.xml | 2 +- udevtest.8 | 2 +- udevtest.xml | 2 +- udevtrigger.8 | 2 +- udevtrigger.xml | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/extras/ata_id/ata_id.8 b/extras/ata_id/ata_id.8 index 0ef9e3ed84..32cb3714b9 100644 --- a/extras/ata_id/ata_id.8 +++ b/extras/ata_id/ata_id.8 @@ -22,7 +22,7 @@ should print: print all values (instead of only the id) .RE .SH SEE ALSO -.BR udev (8) +.BR udev (7) .SH AUTHORS Developed by Kay Sievers . diff --git a/extras/cdrom_id/cdrom_id.8 b/extras/cdrom_id/cdrom_id.8 index 8c95e938cf..4194ae477e 100644 --- a/extras/cdrom_id/cdrom_id.8 +++ b/extras/cdrom_id/cdrom_id.8 @@ -21,7 +21,7 @@ should print: print all values (default) .RE .SH SEE ALSO -.BR udev (8) +.BR udev (7) .SH AUTHORS Developed by Greg Kroah\-Hartman . diff --git a/extras/dasd_id/dasd_id.8 b/extras/dasd_id/dasd_id.8 index c3d4075326..3c38eacf27 100644 --- a/extras/dasd_id/dasd_id.8 +++ b/extras/dasd_id/dasd_id.8 @@ -22,7 +22,7 @@ should print: print all values (instead of only the serial) .RE .SH SEE ALSO -.BR udev (8) +.BR udev (7) .SH AUTHORS Developed by Arnd Bergmann and Kay Sievers . diff --git a/extras/edd_id/edd_id.8 b/extras/edd_id/edd_id.8 index 8d5fd4f1aa..86576bbb39 100644 --- a/extras/edd_id/edd_id.8 +++ b/extras/edd_id/edd_id.8 @@ -21,7 +21,7 @@ should print: print all values (instead of only the id) .RE .SH SEE ALSO -.BR udev (8) +.BR udev (7) .SH AUTHORS Developed by John Hull and Kay Sievers . diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 691d5b8b05..ccb8f9d744 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -166,7 +166,7 @@ BUS=="scsi", PROGRAM=="/sbin/scsi_id -d %N -s %p", RESULT=="312345", NAME="disk% .fi .LP .SH "SEE ALSO" -.BR udev (8) +.BR udev (7) .SH AUTHORS Developed by Patrick Mansfield based on SCSI ID source included in earlier linux 2.5 kernels, sg_utils source, and SCSI diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index 092911ad4c..d84ca8311a 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -35,7 +35,7 @@ will only return successful if the string asked for is not empty. All trailing whitespace will be removed, spaces replaced by underscore and slashes ignored. .SH SEE ALSO -.BR udev (8) +.BR udev (7) .SH AUTHORS Developed by Kay Sievers . diff --git a/udevd.8 b/udevd.8 index bf7e3c7f2f..6fbe1cbf91 100644 --- a/udevd.8 +++ b/udevd.8 @@ -44,4 +44,4 @@ Written by Kay Sievers . .SH "SEE ALSO" .PP -\fBudev\fR(8) +\fBudev\fR(7) diff --git a/udevd.xml b/udevd.xml index 76df707519..1a035b71e9 100644 --- a/udevd.xml +++ b/udevd.xml @@ -100,7 +100,7 @@ SEE ALSO - udev8 + udev7 diff --git a/udevinfo.8 b/udevinfo.8 index b74a690584..93aea361e9 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -57,4 +57,4 @@ Written by Kay Sievers . .SH "SEE ALSO" .PP -\fBudev\fR(8) +\fBudev\fR(7) diff --git a/udevinfo.xml b/udevinfo.xml index d6eecfb70d..ac2d0202f1 100644 --- a/udevinfo.xml +++ b/udevinfo.xml @@ -123,7 +123,7 @@ SEE ALSO - udev8 + udev7 diff --git a/udevmonitor.8 b/udevmonitor.8 index e302ba1ab2..243e7b8279 100644 --- a/udevmonitor.8 +++ b/udevmonitor.8 @@ -25,4 +25,4 @@ Written by Kay Sievers . .SH "SEE ALSO" .PP -\fBudev\fR(8) +\fBudev\fR(7) diff --git a/udevmonitor.xml b/udevmonitor.xml index 6f1e347f84..349ec2ca3d 100644 --- a/udevmonitor.xml +++ b/udevmonitor.xml @@ -68,7 +68,7 @@ SEE ALSO - udev8 + udev7 diff --git a/udevsend.8 b/udevsend.8 index 97d09d3110..b5028adca6 100644 --- a/udevsend.8 +++ b/udevsend.8 @@ -34,5 +34,5 @@ Written by Kay Sievers . .SH "SEE ALSO" .PP -\fBudev\fR(8), +\fBudev\fR(7), \fBudevd\fR(8) diff --git a/udevsend.xml b/udevsend.xml index aa76eea845..9e94ce1798 100644 --- a/udevsend.xml +++ b/udevsend.xml @@ -79,7 +79,7 @@ SEE ALSO - udev8 + udev7 , udevd8 diff --git a/udevstart.8 b/udevstart.8 index bbc022c2c2..11ac92d313 100644 --- a/udevstart.8 +++ b/udevstart.8 @@ -21,4 +21,4 @@ Written by Harald Hoyer . .SH "SEE ALSO" .PP -\fBudev\fR(8) +\fBudev\fR(7) diff --git a/udevstart.xml b/udevstart.xml index f917287086..b3e283f523 100644 --- a/udevstart.xml +++ b/udevstart.xml @@ -54,7 +54,7 @@ SEE ALSO - udev8 + udev7 diff --git a/udevtest.8 b/udevtest.8 index f59c2e921c..d33abd1aa3 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -21,4 +21,4 @@ Written by Greg Kroah\-Hartman . .SH "SEE ALSO" .PP -\fBudev\fR(8) +\fBudev\fR(7) diff --git a/udevtest.xml b/udevtest.xml index 2b39eebab0..58714be5a7 100644 --- a/udevtest.xml +++ b/udevtest.xml @@ -54,7 +54,7 @@ SEE ALSO - udev8 + udev7 diff --git a/udevtrigger.8 b/udevtrigger.8 index a792eaca6e..e0c2059ba0 100644 --- a/udevtrigger.8 +++ b/udevtrigger.8 @@ -34,4 +34,4 @@ and Hannes Reinecke . .SH "SEE ALSO" .PP -\fBudev\fR(8) +\fBudev\fR(7) diff --git a/udevtrigger.xml b/udevtrigger.xml index da83d56d7a..c9b60d18fe 100644 --- a/udevtrigger.xml +++ b/udevtrigger.xml @@ -82,7 +82,7 @@ SEE ALSO - udev8 + udev7 -- cgit v1.2.3-54-g00ecf From 7f1ba7b03f388c1d3d03b0f66a1c0ced7707ac11 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Mar 2006 12:19:21 +0200 Subject: update Debian rules --- etc/udev/debian/cd-aliases.rules | 15 ---- etc/udev/debian/compat.rules | 6 +- etc/udev/debian/devfs.rules | 14 ++-- etc/udev/debian/hotplug.rules | 25 ++++--- etc/udev/debian/hotplugd.rules | 5 +- etc/udev/debian/permissions.rules | 132 ++++++++++++++++++--------------- etc/udev/debian/persistent-input.rules | 29 ++++++++ etc/udev/debian/persistent.rules | 48 +++++++----- etc/udev/debian/udev.rules | 8 +- 9 files changed, 162 insertions(+), 120 deletions(-) delete mode 100644 etc/udev/debian/cd-aliases.rules create mode 100644 etc/udev/debian/persistent-input.rules diff --git a/etc/udev/debian/cd-aliases.rules b/etc/udev/debian/cd-aliases.rules deleted file mode 100644 index 22f710032b..0000000000 --- a/etc/udev/debian/cd-aliases.rules +++ /dev/null @@ -1,15 +0,0 @@ -# These rules create the /dev/{cdrom,dvd,...} symlinks. -# -# If you would like to statically configure the aliases instead, you can -# use rules like: -# BUS=="ide", ID=="1.0", SYMLINK+="cdrom" - -# The variables for IDE devices are imported in permissions.rules. -BUS=="scsi", KERNEL=="sr[0-9]*", ACTION=="add", \ - IMPORT{program}="/sbin/cdrom_id --export $tempnode" - -ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%e" -ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%e" -ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%e" -ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw%e" - diff --git a/etc/udev/debian/compat.rules b/etc/udev/debian/compat.rules index 09bb07441b..209e3ce7e4 100644 --- a/etc/udev/debian/compat.rules +++ b/etc/udev/debian/compat.rules @@ -27,9 +27,9 @@ KERNEL=="rtc", SYMLINK+="%k" #KERNEL=="i2c-[0-9]*", SYMLINK+="%k" #KERNEL=="lp[0-9]*", SYMLINK+="%k" -KERNEL=="audio*" SYMLINK+="%k" -KERNEL=="dsp*" SYMLINK+="%k" -KERNEL=="mixer*" SYMLINK+="%k" +KERNEL=="audio*", SYMLINK+="%k" +KERNEL=="dsp*", SYMLINK+="%k" +KERNEL=="mixer*", SYMLINK+="%k" #KERNEL=="fb[0-9]*", SYMLINK+="%k" #KERNEL=="fd[0-9]*", SYMLINK+="%k" diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index c4a44e3e7f..14a67bbdc2 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -18,15 +18,15 @@ BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" # IDE devices -BUS=="ide", KERNEL=="hd[a-z]*", PROGRAM="/lib/udev/ide-devfs.sh %k %b %n", \ +BUS=="ide", KERNEL=="hd[a-z]*", PROGRAM="ide-devfs.sh %k %b %n", \ NAME="%c{1}", SYMLINK+="%k %c{2}" # SCSI devices -BUS=="scsi", PROGRAM="/lib/udev/scsi-devfs.sh %k %b %n", \ +BUS=="scsi", PROGRAM="scsi-devfs.sh %k %b %n", \ NAME="%c{1}", SYMLINK+="%k %c{2}" # RAID controllers -KERNEL=="cciss!*|ida!*|rd!*", PROGRAM="/lib/udev/raid-devfs.sh %k", \ +KERNEL=="cciss!*|ida!*|rd!*", PROGRAM="raid-devfs.sh %k", \ NAME="%c{1}", SYMLINK+="%k" # other block devices @@ -41,11 +41,12 @@ BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ +BUS=="usb", KERNEL=="ttyUSB*", \ + SYSFS{product}=="Palm Handheld*|Handspring Visor", \ SYMLINK+="pilot" # usbfs-like devices -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; B=$${K%%%%.*}; D=$${K#*.}; echo bus/usb/$$B/$$D'", \ +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ NAME="%c" # serial devices @@ -67,7 +68,7 @@ KERNEL=="video[0-9]*", NAME="v4l/%k" KERNEL=="radio[0-9]*", NAME="v4l/%k" KERNEL=="vbi[0-9]*", NAME="v4l/%k" KERNEL=="vtx[0-9]*", NAME="v4l/%k" -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'KNAME=%k; KNAME=$${KNAME#dvb}; A=$${KNAME%%%%.*}; D=$${KNAME#*.}; echo dvb/adapter$$A/$$D'", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", \ NAME="%c" KERNEL=="fb[0-9]*", NAME="fb/%n" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -141,6 +142,7 @@ KERNEL=="zap[0-9]*", NAME="zap/%n" SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k" # device mapper creates its own device nodes, so ignore these KERNEL=="dm-[0-9]*", NAME="" diff --git a/etc/udev/debian/hotplug.rules b/etc/udev/debian/hotplug.rules index f4c99ec8eb..d592c5e9dc 100644 --- a/etc/udev/debian/hotplug.rules +++ b/etc/udev/debian/hotplug.rules @@ -1,24 +1,25 @@ ACTION!="add", GOTO="hotplug_not_add_event" # check if the device has already been claimed by a driver -ENV{PHYSDEVDRIVER}=="?*", GOTO="hotplug_driver_loaded" +ENV{PHYSDEVDRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" # workarounds for kernels which lack $MODALIAS support -SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", \ - IMPORT{program}="/lib/udev/modalias_ieee1394" -SUBSYSTEM=="serio", ENV{MODALIAS}!="?*", \ - IMPORT{program}="/lib/udev/modalias_serio" +SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", IMPORT{program}="modalias_ieee1394" +SUBSYSTEM=="serio", ENV{MODALIAS}!="?*", IMPORT{program}="modalias_serio" # load the drivers ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" -SUBSYSTEM=="ide", ENV{MODALIAS}!="?*", RUN+="/lib/udev/ide.agent" -#SUBSYSTEM=="input", ENV{MODALIAS}!="?*", RUN+="/lib/udev/input.agent" -SUBSYSTEM=="vio", ENV{MODALIAS}!="?*", RUN+="/lib/udev/vio.agent" +SUBSYSTEM=="ide", ENV{MODALIAS}!="?*", RUN+="ide.agent" +SUBSYSTEM=="vio", ENV{MODALIAS}!="?*", RUN+="vio.agent" SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" +# rules for subsystems which lack proper hotplug support +#SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o-block" +#SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc-block" + SUBSYSTEM=="scsi_device", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe osst", \ SYSFS{vendor}=="Onstream", SYSFS{model}!="ADR*" @@ -26,7 +27,7 @@ SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe st", \ SYSFS{vendor}=="Onstream", SYSFS{model}=="ADR*" SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe st", \ SYSFS{vendor}!="Onstream" -SUBSYSTEM=="scsi_device", SYSFS{type}=="[345]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", SYSFS{type}=="[235689]", RUN+="/sbin/modprobe sg" # From here on follows the hotplug agents which do not load modules @@ -34,14 +35,14 @@ LABEL="hotplug_driver_loaded" # FIXME: does a sane default exist? #SUBSYSTEM=="scsi_device", SYSFS{idVendor}=="...", \ -# RUN+="/lib/udev/scsi-re-add" +# RUN+="scsi-re-add" -SUBSYSTEM=="firmware", RUN+="/lib/udev/firmware.agent" +SUBSYSTEM=="firmware", RUN+="firmware.agent" LABEL="hotplug_not_add_event" SUBSYSTEM=="net", RUN+="/bin/sh -c '/lib/udev/net.agent &'" # Log every event to /dev/hotplug.log (for debugging). -#RUN+="/lib/udev/logger.agent" +#RUN+="logger.agent" diff --git a/etc/udev/debian/hotplugd.rules b/etc/udev/debian/hotplugd.rules index d79ce85e52..cd30fa49ba 100644 --- a/etc/udev/debian/hotplugd.rules +++ b/etc/udev/debian/hotplugd.rules @@ -3,7 +3,6 @@ SUBSYSTEM=="drivers", OPTIONS="last_rule" SUBSYSTEM=="module", OPTIONS="last_rule" # compatibility support for the obsolete hotplug.d and dev.d directories -# do not run the hotplug.d scripts when started from udevstart -ENV{UDEVD_EVENT}=="1", RUN+="/lib/udev/udev_run_hotplugd" -RUN+="/lib/udev/udev_run_devd" +RUN+="udev_run_hotplugd $env{SUBSYSTEM}" +RUN+="udev_run_devd $env{SUBSYSTEM}" diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index bc97566b57..b010353a22 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -1,95 +1,107 @@ -# workaround needed to make udevd wait for the "bus" link -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", \ - WAIT_FOR_SYSFS="bus" +ACTION!="add", GOTO="permissions_end" + +# workarounds needed to synchronize with sysfs +DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +# only needed for kernels < 2.6.16 +SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" # default permissions for block devices SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" # IDE devices -BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", ACTION=="add", \ - IMPORT{program}="/sbin/cdrom_id --export $tempnode" +BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", DRIVER=="ide-cdrom|pcd", \ + IMPORT{program}="cdrom_id --export $tempnode" ENV{ID_CDROM}=="?*", GROUP="cdrom" BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" # SCSI devices -BUS=="scsi", SYSFS{type}=="1", GROUP="tape" -BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom" -BUS=="scsi", SYSFS{type}=="6", GROUP="scanner" +BUS=="scsi", SYSFS{type}=="1", GROUP="tape" +BUS=="scsi", SYSFS{type}=="3", SYSFS{vendor}=="HP", GROUP="scanner" +BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom" +BUS=="scsi", SYSFS{type}=="6", GROUP="scanner" # USB devices BUS=="usb", KERNEL=="legousbtower*", MODE="0666" -BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" +BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" # usbfs-like devices -SUBSYSTEM=="usb_device", MODE="0664" +SUBSYSTEM=="usb_device", MODE="0664" + +# iRiver music players +SUBSYSTEM=="usb_device", GROUP="plugdev", \ + SYSFS{idVendor}=="4102", SYSFS{idProduct}=="10[01][135789]" # serial devices -SUBSYSTEM=="tty", GROUP="dialout" -SUBSYSTEM=="capi", GROUP="dialout" -SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="zaptel", GROUP="dialout" # vc devices (all members of the tty subsystem) -KERNEL=="ptmx", MODE="0666", GROUP="root" -KERNEL=="console", MODE="0600", GROUP="root" -KERNEL=="tty", MODE="0666", GROUP="root" -KERNEL=="tty[0-9]*", GROUP="root" -KERNEL=="pty*", MODE="0666", GROUP="tty" +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" # video devices -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="drm", GROUP="video" -SUBSYSTEM=="dvb", GROUP="video" -SUBSYSTEM=="em8300", GROUP="video" -SUBSYSTEM=="graphics", GROUP="video" -SUBSYSTEM=="nvidia", GROUP="video" +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" # misc devices -KERNEL=="random", MODE="0666" -KERNEL=="urandom", MODE="0666" -KERNEL=="mem", MODE="0640", GROUP="kmem" -KERNEL=="kmem", MODE="0640", GROUP="kmem" -KERNEL=="port", MODE="0640", GROUP="kmem" -KERNEL=="full", MODE="0666" -KERNEL=="null", MODE="0666" -KERNEL=="zero", MODE="0666" -KERNEL=="inotify", MODE="0666" -KERNEL=="sgi_fetchop", MODE="0666" -KERNEL=="sonypi", MODE="0666" -KERNEL=="agpgart", GROUP="video" -KERNEL=="nvram", GROUP="nvram" -KERNEL=="rtc", GROUP="audio" -KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" -KERNEL=="fuse", GROUP="fuse" - -KERNEL=="cdemu[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd", MODE="0644" - -KERNEL=="uverbs*", GROUP="rdma" -KERNEL=="ucm*", GROUP="rdma" +KERNEL=="random", MODE="0666" +KERNEL=="urandom", MODE="0666" +KERNEL=="mem", MODE="0640", GROUP="kmem" +KERNEL=="kmem", MODE="0640", GROUP="kmem" +KERNEL=="port", MODE="0640", GROUP="kmem" +KERNEL=="full", MODE="0666" +KERNEL=="null", MODE="0666" +KERNEL=="zero", MODE="0666" +KERNEL=="inotify", MODE="0666" +KERNEL=="sgi_fetchop", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="nvram", GROUP="nvram" +KERNEL=="rtc", GROUP="audio" +KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" +KERNEL=="fuse", GROUP="fuse" + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +KERNEL=="uverbs*", GROUP="rdma" +KERNEL=="ucm*", GROUP="rdma" # printers and parallel devices -SUBSYSTEM=="printer", GROUP="lp" -SUBSYSTEM=="ppdev", GROUP="lp" -KERNEL=="pt[0-9]*", GROUP="tape" -KERNEL=="pht[0-9]*", GROUP="tape" +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" # sound devices -SUBSYSTEM=="sound", GROUP="audio" +SUBSYSTEM=="sound", GROUP="audio" # ieee1394 devices -KERNEL=="raw1394", GROUP="disk" -KERNEL=="dv1394*", GROUP="video" -KERNEL=="video1394*", GROUP="video" +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" # input devices -KERNEL=="event[0-9]*", PROGRAM="/lib/udev/inputdev.sh %k", \ - RESULT=="inputdev", MODE="0664", GROUP="video" -KERNEL=="js[0-9]*", MODE="0664" +KERNEL=="event[0-9]*", SYSFS{name}=="*dvb*|*DVB*|* IR *" \ + MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" # AOE character devices -SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" -SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" + +LABEL="permissions_end" diff --git a/etc/udev/debian/persistent-input.rules b/etc/udev/debian/persistent-input.rules new file mode 100644 index 0000000000..95021b1646 --- /dev/null +++ b/etc/udev/debian/persistent-input.rules @@ -0,0 +1,29 @@ +SUBSYSTEM!="input", GOTO="persistent_input_end" +ACTION!="add", GOTO="persistent_input_end" +# ignore the mid-level drivers +KERNEL=="input[0-9]*", GOTO="persistent_input_end" + +# usb devices +BUS=="usb", IMPORT{program}="usb_id -x" +BUS=="usb", SYSFS{bInterfaceClass}="03", SYSFS{bInterfaceProtocol}="01", \ + ENV{ID_CLASS}="kbd" +BUS=="usb", SYSFS{bInterfaceClass}="03", SYSFS{bInterfaceProtocol}="02", \ + ENV{ID_CLASS}="mouse" + +# by-id links, generic and for the event devices +KERNEL=="mouse*", \ + ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", \ + SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="event*", \ + ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", \ + SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" + +# by-path links +IMPORT{program}="path_id %p" +KERNEL=="mouse*", ENV{ID_PATH}=="?*", \ + SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_PATH}=="?*", \ + SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" + +LABEL="persistent_input_end" + diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index 4b591b02fa..7fc86246f3 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -8,30 +8,33 @@ ACTION!="add", GOTO="no_volume_id" KERNEL=="ram*|loop*|fd*|nbd*", GOTO="no_volume_id" # skip removable ide devices, because open(2) on them causes an events loop -BUS=="ide", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="no_volume_id" +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", \ + GOTO="no_volume_id" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", \ + GOTO="no_volume_id" # look for different kinds of unique identificators KERNEL=="hd*[!0-9]", \ - IMPORT{program}="/sbin/ata_id --export $tempnode" + IMPORT{program}="ata_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="?*", \ +KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="?*", \ ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$sysfs{ieee1394_id}" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ - IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ - IMPORT{program}="/sbin/scsi_id -g -x -s $devpath -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", \ - IMPORT{program}="/sbin/scsi_id -g -x -a -s $devpath -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="usb_id -x" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="scsi_id -g -x -s $devpath -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="scsi_id -g -x -a -s $devpath -d $tempnode" KERNEL=="dasd*[!0-9]", \ - IMPORT{program}="/sbin/dasd_id --export $tempnode" + IMPORT{program}="dasd_id --export $tempnode" -KERNEL=="*[!0-9]", SYSFS{removable}!="1", \ - IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", \ + IMPORT{program}="edd_id --export $tempnode" # find the physical path of the device -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", \ - IMPORT{program}="/sbin/path_id $devpath" +KERNEL=="*[!0-9]|sr*|st*", ENV{ID_TYPE}=="?*", \ + IMPORT{program}="path_id $devpath" # import the variables of partitions from the parent disks KERNEL=="*[0-9]", IMPORT{parent}="ID_*" @@ -44,6 +47,8 @@ KERNEL=="sd*[!0-9]|dasd[!0-9]*|sr*", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="st*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", \ SYMLINK+="disk/by-id/edd-$env{ID_EDD}" KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", \ @@ -51,15 +56,22 @@ KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", \ KERNEL=="*[!0-9]|sr*", ENV{ID_PATH}=="?*", \ SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="no_volume_id" +KERNEL=="st*", ENV{ID_PATH}=="?*", \ + SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="sr*|st*", GOTO="no_volume_id" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # UUID and volume label KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ + SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ + SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", \ +# SYMLINK+="disk/by-name/%c" # end of processing LABEL="no_volume_id" diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index b5dfd00572..023337445c 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -27,11 +27,12 @@ BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", \ +BUS=="usb", KERNEL=="ttyUSB*", \ + SYSFS{product}=="Palm Handheld*|Handspring Visor", \ SYMLINK+="pilot" # usbfs-like devices -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; B=$${K%%%%.*}; D=$${K#*.}; echo bus/usb/$$B/$$D'", \ +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ NAME="%c" # serial devices @@ -39,7 +40,7 @@ KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" KERNEL=="capi[0-9]*", NAME="capi/%n" # video devices -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; A=$${K%%%%.*}; D=$${K#*.}; echo dvb/adapter$$A/$$D'", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", \ NAME="%c" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -91,6 +92,7 @@ KERNEL=="zap[0-9]*", NAME="zap/%n" SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" +SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k" # device mapper creates its own device nodes, so ignore these KERNEL=="dm-[0-9]*", NAME="" -- cgit v1.2.3-54-g00ecf From 4809b49e4100e35b0dfb5d93cf501e020366de0b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Mar 2006 14:44:41 +0200 Subject: move all *_id programs to /lib/udev/ --- etc/udev/60-persistent-storage.rules | 18 +- extras/ata_id/Makefile | 4 +- extras/cdrom_id/Makefile | 4 +- extras/dasd_id/Makefile | 4 +- extras/edd_id/Makefile | 4 +- extras/path_id | 427 ----------------------------------- extras/path_id/Makefile | 58 +++++ extras/path_id/path_id | 427 +++++++++++++++++++++++++++++++++++ extras/scsi_id/Makefile | 6 +- extras/usb_id/Makefile | 4 +- extras/volume_id/Makefile | 4 +- test/simple-build-check.sh | 1 + 12 files changed, 511 insertions(+), 450 deletions(-) delete mode 100755 extras/path_id create mode 100644 extras/path_id/Makefile create mode 100755 extras/path_id/path_id diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules index 5f4e6b5f35..340fc9c8d4 100644 --- a/etc/udev/60-persistent-storage.rules +++ b/etc/udev/60-persistent-storage.rules @@ -15,33 +15,33 @@ KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" # by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" +IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index 690100082e..64d6868062 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -49,11 +49,11 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(PROG) + - rm $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: uninstall-bin install-man: diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index c7479ed4ed..d7887e61ed 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -49,11 +49,11 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(PROG) + - rm $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: uninstall-bin install-man: diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 76f5949c12..9ad000b8fd 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -49,11 +49,11 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(PROG) + - rm $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: uninstall-bin install-man: diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 9671878a57..52f862da11 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -49,11 +49,11 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(PROG) + - rm $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: uninstall-bin install-man: diff --git a/extras/path_id b/extras/path_id deleted file mode 100755 index 0274be391a..0000000000 --- a/extras/path_id +++ /dev/null @@ -1,427 +0,0 @@ -#!/bin/sh - -# provide the shortest possible unique hardware path to a device -# for the Linux Persistent Device Naming scheme -# -# Copyright (C) 2005-2006 SUSE Linux Products GmbH -# Author: -# Hannes Reinecke -# -# 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. -# -# to be called from a udev rule to return the name for a symlink -# DEVPATH=; path_id -# path_id - -# examples for all block devices on a system: -# for i in `find /sys/class/block`; do DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`"; path_id; done - -SYSFS=/sys -RESULT=1 -TYPE= -OPWD="`pwd`" -full_sysfs_path= -full_sysfs_device_path= - -if [ -z "$DEVPATH" -a -z "$1" ] ; then - exit 1 -fi - -if [ -z "$DEVPATH" ] ; then - case "$1" in - $SYSFS/*) - DEVPATH="${1#$SYSFS}" - ;; - *) - DEVPATH=$1 - ;; - esac -fi - -if [ ! -e $SYSFS$DEVPATH/dev ] ; then - exit 1 -fi - -case "$DEVPATH" in - /devices/*) - cd "$SYSFS$DEVPATH/subsystem"; - TYPE="`pwd -P`" - cd "$OPWD" - TYPE="${TYPE##*/}" - ;; - /class/*) - TYPE="${DEVPATH#/class/}" - TYPE="${TYPE%%/*}" - ;; - /block/*) - TYPE=block - ;; - *) - exit 1 - ;; -esac - -get_port_offset () { - local type offset port - type=$1 - offset=$2 - for i in $type[0-9]* ; do - : i $i - port="${i#$type}" - if [ "$port" -lt "$offset" ] ; then offset=$port ; fi - done - echo $offset -} - -handle_pci () { - local DEV=$1 - cd -P $1 - DEV=${PWD} - pci_id=${DEV##*/} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */pci[0-9]*) - host_dev_path=${host_dev_path%/*} - ;; - *) - break - ;; - esac - done - d="pci-$pci_id-$d" - D="$host_dev_path" - RESULT=0 -} - -handle_ide () { - : handle_ide $* - local DEV=$1 - local port idedev idecontroller - # IDE - : DEV $DEV - port=${DEV##*/} - idedev=${DEV%/*} - idecontroller=${idedev%/*} - # port info if the controller has more than one interface - port="${port#ide}" - : port $port d $d - : idedev $idedev kernel_port $port - case "${port#*.}" in - 0) - channel=0 - ;; - 1) - channel=1 - ;; - *) - echo "Error: $idedev is neither master or slave" >&2 - ;; - esac - cd $idecontroller - offset="`get_port_offset ide ${port%.*}`" - cd "$OPWD" - : port offset $offset - port=$((${port%.*} - $offset)) - if [ "$d" ] ; then - d="ide-${port}:$channel-$d" - else - d="ide-${port}:$channel" - fi - D=$idecontroller - RESULT=0 -} - -handle_scsi () { - : handle_scsi $* - local DEV=$1 - local cil controller_port controller_dev - # SCSI device - cil="${DEV##*/}" - cil="${cil#*:}" - target_dev=${DEV%/*} - target_id=${target_dev##*/target} - cd "$target_dev" - target_num=0 - for tid in ${target_id}* ; do - target_num=$(( $target_num + 1 )) - done - controller_port=${target_dev%/*} - controller_dev="${controller_port%/*}" - : controller_dev $controller_dev - : controller_port $controller_port - # a host controller may have more than one interface/port - controller_port="${controller_port##*/host}" - # - cd "$controller_dev" - controller_offset=$(get_port_offset host $controller_port) - cd "$OPWD" - controller_port=$(( $controller_port - $controller_offset)) - scsi_id="scsi-${controller_port}:${cil}" - if [ "$d" ] ; then - d="${scsi_id}-$d" - else - d="$scsi_id" - fi - D="$controller_dev" - RESULT=0 -} - -handle_firewire () { - :handle_firewire $* - local DEV=$1 - if [ -f "$D/ieee1394_id" ] ; then - read ieee1394_id < $D/ieee1394_id - fi - if [ -z "$ieee1394_id" ] ; then - : no IEEE1394 ID - RESULT=1 - return - fi - fw_host_dev=${DEV%/fw-host*} - # IEEE1394 devices are always endpoints - d="ieee1394-0x$ieee1394_id" - D="$fw_host_dev" - RESULT=0 -} - -handle_fc () { - : handle_fc $* - local DEV=$1 - local cil controller_port controller_dev - # SCSI-FC device - fc_tgt_hcil="${DEV##*/}" - fc_tgt_lun="${fc_tgt_hcil##*:}" - fc_tgt_path="${DEV%/*}" - fc_tgt_num="${fc_tgt_path##*/}" - fc_tgt_dev="${fc_tgt_path}/fc_transport:${fc_tgt_num}" - if [ -e "$fc_tgt_dev/port_name" ]; then - read wwpn < $fc_tgt_dev/port_name - fi - if [ -z "$wwpn" ] ; then - : no WWPN - RESULT=1 - return - fi - # Linux currently knows about 32bit luns - tmp_lun3=$(printf "%04x" $(($fc_tgt_lun & 0xFFFF))) - tmp_lun2=$(printf "%04x" $(( ($fc_tgt_lun >> 16) & 0xFFFF))) - tmp_lun1="0000" - tmp_lun0="0000" - if (($fc_tgt_lun == 0)) ; then - lun="0x0000000000000000" - else - lun="0x${tmp_lun3}${tmp_lun2}${tmp_lun1}${tmp_lun0}" - fi - controller_dev="${fc_tgt_path%/host[0-9]*}" - # FC devices are always endpoints - d="fc-${wwpn}:${lun}" - D="$controller_dev" - RESULT=0 -} - -handle_sas () { - : handle_sas $* - local DEV=$1 - local cil adapter controller_dev - # SAS device - sas_host_path="${DEV%%/phy*}" - sas_phy_path="${DEV#*/host*/}" - sas_phy_path="${sas_phy_path%%/target*}" - sas_phy_id="${sas_phy_path%%/*}" - sas_rphy_id="${sas_phy_path##*/}" - sas_phy_dev="${sas_host_path}/${sas_phy_id}/sas_phy:${sas_phy_id}" - if [ -e "$sas_phy_dev/sas_address" ]; then - read phy_address < $sas_phy_dev/sas_address - read phy_port < $sas_phy_dev/port_identifier - read phy_id < $sas_phy_dev/phy_identifier - fi - if [ -z "$phy_address" ] ; then - : no initiator address - RESULT=1 - return - fi - sas_phy_address="$phy_address:$phy_port:$phy_id" - sas_rphy_dev="${sas_host_path}/${sas_phy_id}/${sas_rphy_id}/sas_rphy:${sas_rphy_id}" - if [ -e "$sas_rphy_dev/sas_address" ]; then - read rphy_address < $sas_rphy_dev/sas_address - read rphy_id < $sas_rphy_dev/phy_identifier - fi - if [ -z "$rphy_address" ] ; then - : no initiator address - RESULT=1 - return - fi - sas_rphy_address="$rphy_address:$rphy_id" - controller_dev="${sas_host_path%/host[0-9]*}" - # SAS devices are always endpoints - d="sas-${sas_phy_address}-${sas_rphy_address}" - D="$controller_dev" - RESULT=0 -} - -handle_usb () { -: handle_usb $* - local DEV=$1 - cd -P $1 - DEV=${PWD} - port_id=${DEV##*/} - port_num=${port_id#*-} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */usb*) - usb_host_path=$host_dev_path - host_dev_path="${host_dev_path%/*}" - ;; - *) - break - ;; - esac - done - : host_dev_path $host_dev_path - usb_host_num=${usb_host_path##*/usb} - - cd "$host_dev_path" - usb_host_offset=$(get_port_offset usb $usb_host_num) - usb_host_port=$(($usb_host_num - $usb_host_offset)) - cd "$OPWD" - if [ "$d" ] ; then - d="usb-$usb_host_port:$port_num-${d}" - else - d="usb-$usb_host_port:$port_num" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_device () { - full_sysfs_path="$SYSFS$DEVPATH" - if [ -L $full_sysfs_path/subsystem ]; then - # new sysfs block layout - full_sysfs_path="${full_sysfs_path%/*}" - cd "$full_sysfs_path/subsystem"; - subsys="`pwd -P`" - cd "$OPWD" - subsys="${subsys##*/}" - if [ "$subsys" == "block" ]; then - # parent is "block", it's a partition, move one up - full_sysfs_path="${full_sysfs_path%/*}" - fi - cd $full_sysfs_path - else - # old sysfs block layout - if [ ! -L $full_sysfs_path/device ] ; then - if [ -f $full_sysfs_path/range ] ; then return ; fi - full_sysfs_path="${full_sysfs_path%/*}" - : full_sysfs_path "$full_sysfs_path" - if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then - return - fi - fi - cd $full_sysfs_path/device - fi - full_sysfs_device_path="`pwd -P`" - cd "$OPWD" - D=$full_sysfs_device_path - while [ ! -z "$D" ] ; do - case "$D" in - */ide[0-9]/[0-9].[0-9]*|*/ide[0-9][0-9]/[0-9][0-9].[0-9]*) - handle_ide "$D" - ;; - */css0/*) - if [ -r $full_sysfs_device_path/wwpn ]; then - read wwpn < $full_sysfs_device_path/wwpn - fi - if [ -r $full_sysfs_device_path/fcp_lun ]; then - read lun < $full_sysfs_device_path/fcp_lun - fi - if [ -r $full_sysfs_device_path/hba_id ]; then - read bus_id < $full_sysfs_device_path/hba_id - fi - if [ "$bus_id" -a "$wwpn" -a "$lun" ]; then - # S/390 zfcp adapter - d="ccw-$bus_id-zfcp-$wwpn:$lun" - RESULT=0 - else - # DASD devices - bus="ccw" - adapter=${D##*/} - d="$bus-$adapter" - RESULT=0 - fi - D= - ;; - */rport-[0-9]*:[0-9]*-[0-9]*/*) - handle_fc "$D" - ;; - */phy-[0-9]*:[0-9]*/*) - handle_sas "$D" - ;; - */fw-host[0-9]*/*) - handle_firewire "$D" - ;; - */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) - handle_scsi "$D" - ;; - */usb[0-9]*/[0-9]*/*) - handle_usb "$D" - ;; - */pci[0-9]*:[0-9]*) - handle_pci "$D" - ;; - */devices) - D= - ;; - *) - : not handled - RESULT=1 - return - ;; - esac - done - if [ "$TYPE" == "scsi_tape" ] ; then - devname=${full_sysfs_path##*/} - rewind="${devname%%st*}" - mode="${devname##*st}" - case "$mode" in - *l) - mode="l" - ;; - *m) - mode="m" - ;; - *a) - mode="a" - ;; - *) - mode="" - ;; - esac - if [ "$d" ]; then - d="$d-${rewind}st${mode}" - fi - fi -} - -case "$TYPE" in - block) - handle_device - echo "ID_PATH=$d" - ;; - scsi_tape) - handle_device - echo "ID_PATH=$d" - ;; - input) - handle_device - echo "ID_PATH=$d" - ;; - *) - RESULT=1 - ;; -esac - -exit $RESULT diff --git a/extras/path_id/Makefile b/extras/path_id/Makefile new file mode 100644 index 0000000000..32747a71d1 --- /dev/null +++ b/extras/path_id/Makefile @@ -0,0 +1,58 @@ +# Makefile for udev extra invoked from the udev main Makefile +# +# Copyright (C) 2004-2006 Kay Sievers +# +# Released under the GNU General Public License, version 2. +# + +PROG = path_id +MAN_PAGES = + +prefix = +etcdir = ${prefix}/etc +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev +mandir = ${prefix}/usr/share/man +configdir = ${etcdir}/udev/ + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all + +# man pages +%.8: %.xml + $(E) " XMLTO " $@ + $(Q) xmlto man $? +.PRECIOUS: %.8 + +clean: + $(E) " CLEAN " +.PHONY: clean + +install-bin: all + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) +.PHONY: install-bin + +uninstall-bin: + - rm $(DESTDIR)$(libudevdir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config + diff --git a/extras/path_id/path_id b/extras/path_id/path_id new file mode 100755 index 0000000000..0274be391a --- /dev/null +++ b/extras/path_id/path_id @@ -0,0 +1,427 @@ +#!/bin/sh + +# provide the shortest possible unique hardware path to a device +# for the Linux Persistent Device Naming scheme +# +# Copyright (C) 2005-2006 SUSE Linux Products GmbH +# Author: +# Hannes Reinecke +# +# 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. +# +# to be called from a udev rule to return the name for a symlink +# DEVPATH=; path_id +# path_id + +# examples for all block devices on a system: +# for i in `find /sys/class/block`; do DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`"; path_id; done + +SYSFS=/sys +RESULT=1 +TYPE= +OPWD="`pwd`" +full_sysfs_path= +full_sysfs_device_path= + +if [ -z "$DEVPATH" -a -z "$1" ] ; then + exit 1 +fi + +if [ -z "$DEVPATH" ] ; then + case "$1" in + $SYSFS/*) + DEVPATH="${1#$SYSFS}" + ;; + *) + DEVPATH=$1 + ;; + esac +fi + +if [ ! -e $SYSFS$DEVPATH/dev ] ; then + exit 1 +fi + +case "$DEVPATH" in + /devices/*) + cd "$SYSFS$DEVPATH/subsystem"; + TYPE="`pwd -P`" + cd "$OPWD" + TYPE="${TYPE##*/}" + ;; + /class/*) + TYPE="${DEVPATH#/class/}" + TYPE="${TYPE%%/*}" + ;; + /block/*) + TYPE=block + ;; + *) + exit 1 + ;; +esac + +get_port_offset () { + local type offset port + type=$1 + offset=$2 + for i in $type[0-9]* ; do + : i $i + port="${i#$type}" + if [ "$port" -lt "$offset" ] ; then offset=$port ; fi + done + echo $offset +} + +handle_pci () { + local DEV=$1 + cd -P $1 + DEV=${PWD} + pci_id=${DEV##*/} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */pci[0-9]*) + host_dev_path=${host_dev_path%/*} + ;; + *) + break + ;; + esac + done + d="pci-$pci_id-$d" + D="$host_dev_path" + RESULT=0 +} + +handle_ide () { + : handle_ide $* + local DEV=$1 + local port idedev idecontroller + # IDE + : DEV $DEV + port=${DEV##*/} + idedev=${DEV%/*} + idecontroller=${idedev%/*} + # port info if the controller has more than one interface + port="${port#ide}" + : port $port d $d + : idedev $idedev kernel_port $port + case "${port#*.}" in + 0) + channel=0 + ;; + 1) + channel=1 + ;; + *) + echo "Error: $idedev is neither master or slave" >&2 + ;; + esac + cd $idecontroller + offset="`get_port_offset ide ${port%.*}`" + cd "$OPWD" + : port offset $offset + port=$((${port%.*} - $offset)) + if [ "$d" ] ; then + d="ide-${port}:$channel-$d" + else + d="ide-${port}:$channel" + fi + D=$idecontroller + RESULT=0 +} + +handle_scsi () { + : handle_scsi $* + local DEV=$1 + local cil controller_port controller_dev + # SCSI device + cil="${DEV##*/}" + cil="${cil#*:}" + target_dev=${DEV%/*} + target_id=${target_dev##*/target} + cd "$target_dev" + target_num=0 + for tid in ${target_id}* ; do + target_num=$(( $target_num + 1 )) + done + controller_port=${target_dev%/*} + controller_dev="${controller_port%/*}" + : controller_dev $controller_dev + : controller_port $controller_port + # a host controller may have more than one interface/port + controller_port="${controller_port##*/host}" + # + cd "$controller_dev" + controller_offset=$(get_port_offset host $controller_port) + cd "$OPWD" + controller_port=$(( $controller_port - $controller_offset)) + scsi_id="scsi-${controller_port}:${cil}" + if [ "$d" ] ; then + d="${scsi_id}-$d" + else + d="$scsi_id" + fi + D="$controller_dev" + RESULT=0 +} + +handle_firewire () { + :handle_firewire $* + local DEV=$1 + if [ -f "$D/ieee1394_id" ] ; then + read ieee1394_id < $D/ieee1394_id + fi + if [ -z "$ieee1394_id" ] ; then + : no IEEE1394 ID + RESULT=1 + return + fi + fw_host_dev=${DEV%/fw-host*} + # IEEE1394 devices are always endpoints + d="ieee1394-0x$ieee1394_id" + D="$fw_host_dev" + RESULT=0 +} + +handle_fc () { + : handle_fc $* + local DEV=$1 + local cil controller_port controller_dev + # SCSI-FC device + fc_tgt_hcil="${DEV##*/}" + fc_tgt_lun="${fc_tgt_hcil##*:}" + fc_tgt_path="${DEV%/*}" + fc_tgt_num="${fc_tgt_path##*/}" + fc_tgt_dev="${fc_tgt_path}/fc_transport:${fc_tgt_num}" + if [ -e "$fc_tgt_dev/port_name" ]; then + read wwpn < $fc_tgt_dev/port_name + fi + if [ -z "$wwpn" ] ; then + : no WWPN + RESULT=1 + return + fi + # Linux currently knows about 32bit luns + tmp_lun3=$(printf "%04x" $(($fc_tgt_lun & 0xFFFF))) + tmp_lun2=$(printf "%04x" $(( ($fc_tgt_lun >> 16) & 0xFFFF))) + tmp_lun1="0000" + tmp_lun0="0000" + if (($fc_tgt_lun == 0)) ; then + lun="0x0000000000000000" + else + lun="0x${tmp_lun3}${tmp_lun2}${tmp_lun1}${tmp_lun0}" + fi + controller_dev="${fc_tgt_path%/host[0-9]*}" + # FC devices are always endpoints + d="fc-${wwpn}:${lun}" + D="$controller_dev" + RESULT=0 +} + +handle_sas () { + : handle_sas $* + local DEV=$1 + local cil adapter controller_dev + # SAS device + sas_host_path="${DEV%%/phy*}" + sas_phy_path="${DEV#*/host*/}" + sas_phy_path="${sas_phy_path%%/target*}" + sas_phy_id="${sas_phy_path%%/*}" + sas_rphy_id="${sas_phy_path##*/}" + sas_phy_dev="${sas_host_path}/${sas_phy_id}/sas_phy:${sas_phy_id}" + if [ -e "$sas_phy_dev/sas_address" ]; then + read phy_address < $sas_phy_dev/sas_address + read phy_port < $sas_phy_dev/port_identifier + read phy_id < $sas_phy_dev/phy_identifier + fi + if [ -z "$phy_address" ] ; then + : no initiator address + RESULT=1 + return + fi + sas_phy_address="$phy_address:$phy_port:$phy_id" + sas_rphy_dev="${sas_host_path}/${sas_phy_id}/${sas_rphy_id}/sas_rphy:${sas_rphy_id}" + if [ -e "$sas_rphy_dev/sas_address" ]; then + read rphy_address < $sas_rphy_dev/sas_address + read rphy_id < $sas_rphy_dev/phy_identifier + fi + if [ -z "$rphy_address" ] ; then + : no initiator address + RESULT=1 + return + fi + sas_rphy_address="$rphy_address:$rphy_id" + controller_dev="${sas_host_path%/host[0-9]*}" + # SAS devices are always endpoints + d="sas-${sas_phy_address}-${sas_rphy_address}" + D="$controller_dev" + RESULT=0 +} + +handle_usb () { +: handle_usb $* + local DEV=$1 + cd -P $1 + DEV=${PWD} + port_id=${DEV##*/} + port_num=${port_id#*-} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */usb*) + usb_host_path=$host_dev_path + host_dev_path="${host_dev_path%/*}" + ;; + *) + break + ;; + esac + done + : host_dev_path $host_dev_path + usb_host_num=${usb_host_path##*/usb} + + cd "$host_dev_path" + usb_host_offset=$(get_port_offset usb $usb_host_num) + usb_host_port=$(($usb_host_num - $usb_host_offset)) + cd "$OPWD" + if [ "$d" ] ; then + d="usb-$usb_host_port:$port_num-${d}" + else + d="usb-$usb_host_port:$port_num" + fi + D="$host_dev_path" + RESULT=0 +} + +handle_device () { + full_sysfs_path="$SYSFS$DEVPATH" + if [ -L $full_sysfs_path/subsystem ]; then + # new sysfs block layout + full_sysfs_path="${full_sysfs_path%/*}" + cd "$full_sysfs_path/subsystem"; + subsys="`pwd -P`" + cd "$OPWD" + subsys="${subsys##*/}" + if [ "$subsys" == "block" ]; then + # parent is "block", it's a partition, move one up + full_sysfs_path="${full_sysfs_path%/*}" + fi + cd $full_sysfs_path + else + # old sysfs block layout + if [ ! -L $full_sysfs_path/device ] ; then + if [ -f $full_sysfs_path/range ] ; then return ; fi + full_sysfs_path="${full_sysfs_path%/*}" + : full_sysfs_path "$full_sysfs_path" + if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then + return + fi + fi + cd $full_sysfs_path/device + fi + full_sysfs_device_path="`pwd -P`" + cd "$OPWD" + D=$full_sysfs_device_path + while [ ! -z "$D" ] ; do + case "$D" in + */ide[0-9]/[0-9].[0-9]*|*/ide[0-9][0-9]/[0-9][0-9].[0-9]*) + handle_ide "$D" + ;; + */css0/*) + if [ -r $full_sysfs_device_path/wwpn ]; then + read wwpn < $full_sysfs_device_path/wwpn + fi + if [ -r $full_sysfs_device_path/fcp_lun ]; then + read lun < $full_sysfs_device_path/fcp_lun + fi + if [ -r $full_sysfs_device_path/hba_id ]; then + read bus_id < $full_sysfs_device_path/hba_id + fi + if [ "$bus_id" -a "$wwpn" -a "$lun" ]; then + # S/390 zfcp adapter + d="ccw-$bus_id-zfcp-$wwpn:$lun" + RESULT=0 + else + # DASD devices + bus="ccw" + adapter=${D##*/} + d="$bus-$adapter" + RESULT=0 + fi + D= + ;; + */rport-[0-9]*:[0-9]*-[0-9]*/*) + handle_fc "$D" + ;; + */phy-[0-9]*:[0-9]*/*) + handle_sas "$D" + ;; + */fw-host[0-9]*/*) + handle_firewire "$D" + ;; + */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) + handle_scsi "$D" + ;; + */usb[0-9]*/[0-9]*/*) + handle_usb "$D" + ;; + */pci[0-9]*:[0-9]*) + handle_pci "$D" + ;; + */devices) + D= + ;; + *) + : not handled + RESULT=1 + return + ;; + esac + done + if [ "$TYPE" == "scsi_tape" ] ; then + devname=${full_sysfs_path##*/} + rewind="${devname%%st*}" + mode="${devname##*st}" + case "$mode" in + *l) + mode="l" + ;; + *m) + mode="m" + ;; + *a) + mode="a" + ;; + *) + mode="" + ;; + esac + if [ "$d" ]; then + d="$d-${rewind}st${mode}" + fi + fi +} + +case "$TYPE" in + block) + handle_device + echo "ID_PATH=$d" + ;; + scsi_tape) + handle_device + echo "ID_PATH=$d" + ;; + input) + handle_device + echo "ID_PATH=$d" + ;; + *) + RESULT=1 + ;; +esac + +exit $RESULT diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 544954dc7e..c35d7dab94 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -58,11 +58,13 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + ln -sf $(DESTDIR)$(libudevdir)/$(PROG) $(DESTDIR)$(sbindir)/$(PROG) .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(PROG) + - rm $(DESTDIR)$(libudevdir)/$(PROG) + - rm -f $(DESTDIR)$(sbindir)/$(PROG) .PHONY: uninstall-bin install-man: diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 40555fd52c..26e2fedd4d 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -49,11 +49,11 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(PROG) + - rm $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: uninstall-bin install-man: diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 759ea549cc..f8d54a2309 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -55,12 +55,12 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(sbindir)/$(PROG) + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) $(MAKE) -C lib install .PHONY: install-bin uninstall-bin: - - rm $(DESTDIR)$(sbindir)/$(PROG) + - rm $(DESTDIR)$(libudevdir)/$(PROG) $(MAKE) -C lib uninstall .PHONY: uninstall-bin diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index faa7c46432..6d7272f80e 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -1,6 +1,7 @@ #/bin/sh EXTRAS="\ + extras/path_id \ extras/scsi_id \ extras/ata_id \ extras/volume_id \ -- cgit v1.2.3-54-g00ecf From 41797cb82e1bb930a3ddb43778471eba5196a1d8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Mar 2006 15:59:49 +0200 Subject: update Red Hat rules --- etc/udev/redhat/50-udev.rules | 351 +++++++++++++++++++++++++++++++++++++++ etc/udev/redhat/51-hotplug.rules | 15 ++ etc/udev/redhat/hotplug.rules | 15 -- etc/udev/redhat/udev.rules | 339 ------------------------------------- 4 files changed, 366 insertions(+), 354 deletions(-) create mode 100644 etc/udev/redhat/50-udev.rules create mode 100644 etc/udev/redhat/51-hotplug.rules delete mode 100644 etc/udev/redhat/hotplug.rules delete mode 100644 etc/udev/redhat/udev.rules diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules new file mode 100644 index 0000000000..89a3f02bac --- /dev/null +++ b/etc/udev/redhat/50-udev.rules @@ -0,0 +1,351 @@ +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# default is OWNER="root" GROUP="root", MODE="0600" +# + +KERNEL=="*", OWNER="root" GROUP="root", MODE="0600" + +# all block devices +SUBSYSTEM=="block", GROUP="disk", MODE="0640" +KERNEL=="root", GROUP="disk", MODE="0640" + +# console devices +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="console", NAME="%k", MODE="0600", OPTIONS="last_rule" +KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="vc/[0-9]*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" + +# pty devices +# Set this to 0660 if you only want users belonging to tty group +# to be able to allocate PTYs +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule" +KERNEL=="pty/m*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" + +# serial+dialup devices +KERNEL=="ippp*", NAME="%k", MODE="0660" +KERNEL=="isdn*", NAME="%k", MODE="0660" +KERNEL=="isdnctrl*", NAME="%k", MODE="0660" +KERNEL=="capi*", NAME="%k", MODE="0660" +KERNEL=="dcbri*", NAME="%k", MODE="0660" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="tts/[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="tts/USB[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="pppox*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="hvc*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="hvsi*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot" +KERNEL=="ttyUSB*", SYSFS{product}=="palmOne Handheld*", SYMLINK+="pilot" + +# vc devices +KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcs[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcsa", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcsa[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcc/*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" + +# memory devices +KERNEL=="random", MODE="0666", OPTIONS="last_rule" +KERNEL=="urandom", MODE="0444", OPTIONS="last_rule" +KERNEL=="mem", GROUP="kmem", MODE="0640", OPTIONS="last_rule" +KERNEL=="kmem", GROUP="kmem", MODE="0640", OPTIONS="last_rule" +KERNEL=="port", GROUP="kmem", MODE="0640", OPTIONS="last_rule" +KERNEL=="full", MODE="0666", OPTIONS="last_rule" +KERNEL=="null", MODE="0666", OPTIONS="last_rule" +KERNEL=="zero", MODE="0666", OPTIONS="last_rule" +# 183 = /dev/hwrng Generic random number generator +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" + +# misc devices +KERNEL=="nvram", MODE="0660" +KERNEL=="rtc", MODE="0644" + +# floppy devices +KERNEL=="fd[01]*", GROUP="floppy", MODE="0660" +# fix floppy devices +KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" +KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f /dev/%k*'" + +# audio devices +KERNEL=="dsp*", MODE="0660" +KERNEL=="audio*", MODE="0660" +KERNEL=="midi*", MODE="0660" +KERNEL=="mixer*", MODE="0660" +KERNEL=="sequencer*", MODE="0660" +KERNEL=="sound/*", MODE="0660" +KERNEL=="snd/*", MODE="0660" +KERNEL=="beep", MODE="0660" +KERNEL=="admm*", MODE="0660" +KERNEL=="adsp*", MODE="0660" +KERNEL=="aload*", MODE="0660" +KERNEL=="amidi*", MODE="0660" +KERNEL=="dmfm*", MODE="0660" +KERNEL=="dmmidi*", MODE="0660" +KERNEL=="sndstat", MODE="0660" + +# pilot/palm devices +KERNEL=="pilot", GROUP="uucp", MODE="0660" + +# lp devices +KERNEL=="lp*", GROUP="lp", MODE="0660" +KERNEL=="parport*", GROUP="lp", MODE="0660" +KERNEL=="irlpt*", GROUP="lp", MODE="0660" +KERNEL=="usblp*", GROUP="lp", MODE="0660" +KERNEL=="usb/lp*", GROUP="lp", MODE="0660" + +# tape devices +KERNEL=="ht*", GROUP="disk", MODE="0660" +KERNEL=="nht*", GROUP="disk", MODE="0660" +KERNEL=="pt[0-9]*", GROUP="disk", MODE="0660" +KERNEL=="npt*", GROUP="disk", MODE="0660" +KERNEL=="st*", GROUP="disk", MODE="0660" +KERNEL=="nst*", GROUP="disk", MODE="0660" +KERNEL=="osst*", GROUP="disk", MODE="0660" +KERNEL=="nosst*", GROUP="disk", MODE="0660" + +# diskonkey devices +KERNEL=="diskonkey*", GROUP="disk", MODE="0640" + +# rem_ide devices +KERNEL=="microdrive*", GROUP="disk", MODE="0640" + +# kbd devices +KERNEL=="kbd", MODE="0644" + +# joystick devices +KERNEL=="js[0-9]*", MODE="0644" +KERNEL=="djs[0-9]*", MODE="0644" + +# v4l devices +KERNEL=="video*", MODE="0660" +KERNEL=="radio*", MODE="0660" +KERNEL=="winradio*", MODE="0660" +KERNEL=="vtx*", MODE="0660" +KERNEL=="vbi*", MODE="0660" +KERNEL=="video/*", MODE="0660" +KERNEL=="vttuner", MODE="0660" +KERNEL=="v4l/*", MODE="0660" + +# input devices +KERNEL=="input/*", MODE="0660" + +# gpm devices +KERNEL=="gpmctl", MODE="0700" + +# dri devices +KERNEL=="nvidia*", MODE="0660" +KERNEL=="3dfx*", MODE="0660" +KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666" + +# usb devices +KERNEL=="usb/dabusb*", MODE="0660" +KERNEL=="usb/mdc800*", MODE="0660" +KERNEL=="usb/rio500", MODE="0660" + +# s390 devices +KERNEL=="z90crypt", MODE="0666" + +# DVB +KERNEL=="dvb", MODE="0660" +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", \ + NAME="%c", MODE="0660" + +# create a symlink named after the device map name +# note devmap_name comes with extras/multipath +#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" + + +# alsa devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hw[CD0-9]*", NAME="snd/%k" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL=="midi[CD0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse*", NAME="input/%k" +KERNEL=="event*", NAME="input/%k" +KERNEL=="js*", NAME="input/%k", SYMLINK+="%k" +KERNEL=="ts*", NAME="input/%k" + +# IEEE1394 (firewire) devices (must be before raw devices below) +KERNEL=="raw1394", NAME="%k" +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +KERNEL=="raw[0-9]*", NAME="raw/%k" + +KERNEL=="lp[0-9]*", SYMLINK+="par%n" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" + +KERNEL=="microcode", NAME="cpu/%k" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" + +KERNEL=="ram1", SYMLINK+="ram" +KERNEL=="video0", SYMLINK+="video" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="audio0", SYMLINK+="audio" +KERNEL=="dsp0", SYMLINK+="dsp" +KERNEL=="fb0", SYMLINK+="fb" +KERNEL=="qft0", SYMLINK+="ftape" +KERNEL=="isdnctrl0", SYMLINK+="isdnctrl" +KERNEL=="mixer0", SYMLINK+="mixer" +KERNEL=="ram0", SYMLINK+="ramdisk" +KERNEL=="sbpcd0", SYMLINK+="sbpcd" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="tty0", SYMLINK+="systty" +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="null", SYMLINK+="XOR" + +KERNEL=="tun", NAME="net/%k" + +KERNEL=="device-mapper", NAME="mapper/control" + +# old compat symlinks with enumeration +KERNEL=="sr[0-9]*", SYMLINK+="cdrom cdrom-%k" +KERNEL=="scd[0-9]*", SYMLINK+="cdrom cdrom-%k" +KERNEL=="pcd[0-9]*", SYMLINK+="cdrom cdrom-%k" +KERNEL=="fd[0-9]*", SYMLINK+="floppy-%k" +KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK+="tape-%k", MODE="0660" +KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK+="tape-%k", MODE="0660" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" + +# Section for zaptel device +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +KERNEL=="pktcdvd", NAME="%k/control" + + + +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", \ + SYSFS{device/media}=="floppy", \ + SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions" + +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom cdrom-%k" + +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" + +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" + +KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" + +# rename sr* to scd* +KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n" +KERNEL=="hd*[0-9]", BUS=="ide", SYSFS{../removable}=="1", \ + OPTIONS+="ignore_remove" + + +####################################### +# Persistent block device stuff - begin +####################################### +# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" + +# never access removable ide devices, the drivers are causing event loops on open() +BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}=="1", GOTO="persistent_end" +BUS=="ide", KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="sr*", GOTO="persistent_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +LABEL="persistent_end" + +##################################### +# Persistent block device stuff - end +##################################### + +ACTION=="add", SUBSYSTEM=="usb_device", \ + PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ + NAME="%c", MODE="0644" + +ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" + +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", \ + RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" + +# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC +# sr: 4 TYPE_WORM, 5 TYPE_ROM +# st/osst: 1 TYPE_TAPE +# sg: 8 changer, [36] scanner +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", \ + RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" +ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", \ + RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" + + +ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="/sbin/modprobe sg" +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="0|7|14", \ + RUN+="/sbin/modprobe sd_mod" +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="[45]", \ + RUN+="/sbin/modprobe sr_mod" + +ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", SYSFS{type}=="[36]", \ + SYMLINK+="scanner scanner-%k", MODE="0660" + +ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", SYSFS{type}=="8", \ + SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" + +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}=="On[sS]tream", \ + SYSFS{model}!="ADR*", RUN+="/sbin/modprobe osst" +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}=="On[sS]tream", \ + SYSFS{model}=="ADR*", RUN+="/sbin/modprobe st" +ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}!="On[sS]tream", \ + RUN+="/sbin/modprobe st" + +RUN+="socket:/org/kernel/udev/monitor" + diff --git a/etc/udev/redhat/51-hotplug.rules b/etc/udev/redhat/51-hotplug.rules new file mode 100644 index 0000000000..4c47976ee5 --- /dev/null +++ b/etc/udev/redhat/51-hotplug.rules @@ -0,0 +1,15 @@ +# do not call hotplug.d and dev.d for "drivers" and "module" events +SUBSYSTEM=="drivers", GOTO="hotplug_end" +SUBSYSTEM=="module", GOTO="hotplug_end" +ACTION="add", GOTO="hotplug_comp" +ACTION="remove", GOTO="hotplug_comp" + +GOTO="hotplug_end" + +LABEL="hotplug_comp" +# compatibility support for the obsolete hotplug.d and dev.d directories +ENV{UDEVD_EVENT}=="1", RUN+="/lib/udev/udev_run_hotplugd" +RUN+="/lib/udev/udev_run_devd" + + +LABEL="hotplug_end" diff --git a/etc/udev/redhat/hotplug.rules b/etc/udev/redhat/hotplug.rules deleted file mode 100644 index 4c47976ee5..0000000000 --- a/etc/udev/redhat/hotplug.rules +++ /dev/null @@ -1,15 +0,0 @@ -# do not call hotplug.d and dev.d for "drivers" and "module" events -SUBSYSTEM=="drivers", GOTO="hotplug_end" -SUBSYSTEM=="module", GOTO="hotplug_end" -ACTION="add", GOTO="hotplug_comp" -ACTION="remove", GOTO="hotplug_comp" - -GOTO="hotplug_end" - -LABEL="hotplug_comp" -# compatibility support for the obsolete hotplug.d and dev.d directories -ENV{UDEVD_EVENT}=="1", RUN+="/lib/udev/udev_run_hotplugd" -RUN+="/lib/udev/udev_run_devd" - - -LABEL="hotplug_end" diff --git a/etc/udev/redhat/udev.rules b/etc/udev/redhat/udev.rules deleted file mode 100644 index dbd62c397b..0000000000 --- a/etc/udev/redhat/udev.rules +++ /dev/null @@ -1,339 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# default is OWNER="root" GROUP="root", MODE="0600" -# - -KERNEL="*", OWNER="root" GROUP="root", MODE="0600" - -# all block devices -SUBSYSTEM=="block", GROUP="disk", MODE="0640" -KERNEL=="root", GROUP="disk", MODE="0640" - -# console devices -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", MODE="0600", OPTIONS="last_rule" -KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" -KERNEL=="vc/[0-9]*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" - -# pty devices -# Set this to 0660 if you only want users belonging to tty group -# to be able to allocate PTYs -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule" -KERNEL=="pty/m*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" - -# serial+dialup devices -KERNEL=="ippp*", NAME="%k", MODE="0660" -KERNEL=="isdn*", NAME="%k", MODE="0660" -KERNEL=="isdnctrl*", NAME="%k", MODE="0660" -KERNEL=="capi*", NAME="%k", MODE="0660" -KERNEL=="dcbri*", NAME="%k", MODE="0660" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="tts/[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="tts/USB[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="pppox*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="hvc*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="hvsi*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot" -KERNEL=="ttyUSB*", SYSFS{product}=="palmOne Handheld*", SYMLINK+="pilot" - -# vc devices -KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcs[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcsa", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcsa[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcc/*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" - -# memory devices -KERNEL=="random", MODE="0666", OPTIONS="last_rule" -KERNEL=="urandom", MODE="0444", OPTIONS="last_rule" -KERNEL=="mem", GROUP="kmem", MODE="0640", OPTIONS="last_rule" -KERNEL=="kmem", GROUP="kmem", MODE="0640", OPTIONS="last_rule" -KERNEL=="port", GROUP="kmem", MODE="0640", OPTIONS="last_rule" -KERNEL=="full", MODE="0666", OPTIONS="last_rule" -KERNEL=="null", MODE="0666", OPTIONS="last_rule" -KERNEL=="zero", MODE="0666", OPTIONS="last_rule" -# 183 = /dev/hwrng Generic random number generator -KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" - -# misc devices -KERNEL=="nvram", MODE="0660" -KERNEL=="rtc", MODE="0644" - -# floppy devices -KERNEL=="fd[01]*", GROUP="floppy", MODE="0660" -# fix floppy devices -KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" -KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" -KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f /dev/%k*'" - -# audio devices -KERNEL=="dsp*", MODE="0660" -KERNEL=="audio*", MODE="0660" -KERNEL=="midi*", MODE="0660" -KERNEL=="mixer*", MODE="0660" -KERNEL=="sequencer*", MODE="0660" -KERNEL=="sound/*", MODE="0660" -KERNEL=="snd/*", MODE="0660" -KERNEL=="beep", MODE="0660" -KERNEL=="admm*", MODE="0660" -KERNEL=="adsp*", MODE="0660" -KERNEL=="aload*", MODE="0660" -KERNEL=="amidi*", MODE="0660" -KERNEL=="dmfm*", MODE="0660" -KERNEL=="dmmidi*", MODE="0660" -KERNEL=="sndstat", MODE="0660" - -# pilot/palm devices -KERNEL=="pilot", GROUP="uucp", MODE="0660" - -# lp devices -KERNEL=="lp*", GROUP="lp", MODE="0660" -KERNEL=="parport*", GROUP="lp", MODE="0660" -KERNEL=="irlpt*", GROUP="lp", MODE="0660" -KERNEL=="usblp*", GROUP="lp", MODE="0660" -KERNEL=="usb/lp*", GROUP="lp", MODE="0660" - -# tape devices -KERNEL=="ht*", GROUP="disk", MODE="0660" -KERNEL=="nht*", GROUP="disk", MODE="0660" -KERNEL=="pt[0-9]*", GROUP="disk", MODE="0660" -KERNEL=="npt*", GROUP="disk", MODE="0660" -KERNEL=="st*", GROUP="disk", MODE="0660" -KERNEL=="nst*", GROUP="disk", MODE="0660" -KERNEL=="osst*", GROUP="disk", MODE="0660" -KERNEL=="nosst*", GROUP="disk", MODE="0660" - -# diskonkey devices -KERNEL=="diskonkey*", GROUP="disk", MODE="0640" - -# rem_ide devices -KERNEL=="microdrive*", GROUP="disk", MODE="0640" - -# kbd devices -KERNEL=="kbd", MODE="0644" - -# joystick devices -KERNEL=="js[0-9]*", MODE="0644" -KERNEL=="djs[0-9]*", MODE="0644" - -# v4l devices -KERNEL=="video*", MODE="0660" -KERNEL=="radio*", MODE="0660" -KERNEL=="winradio*", MODE="0660" -KERNEL=="vtx*", MODE="0660" -KERNEL=="vbi*", MODE="0660" -KERNEL=="video/*", MODE="0660" -KERNEL=="vttuner", MODE="0660" -KERNEL=="v4l/*", MODE="0660" - -# input devices -KERNEL=="input/*", MODE="0660" - -# gpm devices -KERNEL=="gpmctl", MODE="0700" - -# dri devices -KERNEL=="nvidia*", MODE="0660" -KERNEL=="3dfx*", MODE="0660" -KERNEL=="dri/*", MODE="0666" - -# usb devices -KERNEL=="usb/dabusb*", MODE="0660" -KERNEL=="usb/mdc800*", MODE="0660" -KERNEL=="usb/rio500", MODE="0660" - -# s390 devices -KERNEL=="z90crypt", MODE="0666" - -# DVB -KERNEL=="dvb/*", MODE="0660" -KERNEL=="dvb", MODE="0660" -KERNEL=="dvb/adapter*", MODE="0660" - -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" - -# DRI devices always go into a subdirectory (as per the LSB spec) -KERNEL=="card*", NAME="dri/card%n" - -# alsa devices -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hw[CD0-9]*", NAME="snd/%k" -KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL=="midi[CD0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# input devices -KERNEL=="mice", NAME="input/%k" -KERNEL=="mouse*", NAME="input/%k" -KERNEL=="event*", NAME="input/%k" -KERNEL=="js*", NAME="input/%k", SYMLINK+="%k" -KERNEL=="ts*", NAME="input/%k" - -# IEEE1394 (firewire) devices (must be before raw devices below) -KERNEL=="raw1394", NAME="%k" -KERNEL=="dv1394*", NAME="dv1394/%n" -KERNEL=="video1394*", NAME="video1394/%n" - -KERNEL=="raw[0-9]*", NAME="raw/%k" - -KERNEL=="lp[0-9]*", SYMLINK+="par%n" -BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" - -KERNEL=="microcode", NAME="cpu/%k" -KERNEL="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" - -KERNEL=="ram1", SYMLINK+="ram" -KERNEL=="video0", SYMLINK+="video" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="audio0", SYMLINK+="audio" -KERNEL=="dsp0", SYMLINK+="dsp" -KERNEL=="fb0", SYMLINK+="fb" -KERNEL=="qft0", SYMLINK+="ftape" -KERNEL=="isdnctrl0", SYMLINK+="isdnctrl" -KERNEL=="mixer0", SYMLINK+="mixer" -KERNEL=="ram0", SYMLINK+="ramdisk" -KERNEL=="sbpcd0", SYMLINK+="sbpcd" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="tty0", SYMLINK+="systty" -KERNEL=="vbi0", SYMLINK+="vbi" -KERNEL=="null", SYMLINK+="XOR" - -KERNEL=="tun", NAME="net/%k" - -KERNEL=="device-mapper", NAME="mapper/control" - -# old compat symlinks with enumeration -KERNEL=="sr[0-9]*", SYMLINK+="cdrom%e" -KERNEL=="scd[0-9]*", SYMLINK+="cdrom%e" -KERNEL=="pcd[0-9]*", SYMLINK+="cdrom%e" -KERNEL=="fd[0-9]*", SYMLINK+="floppy%e" -KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK+="tape%e", MODE="0660" -KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK+="tape%e", MODE="0660" -KERNEL=="sg[0-9]*", BUS="scsi", SYSFS{type}=="[36]", SYMLINK+="scanner%e", MODE="0660" - -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" - -# Section for zaptel device -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -BUS=="scsi", KERNEL=="sg[0-9]*", SYSFS{type}=="6", NAME="%k", SYMLINK="scanner%e", MODE="0660" - -# do not seperate the next 2 lines!! -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="ide-media.sh %k", RESULT=="floppy", SYMLINK+="floppy%e", NAME{ignore_remove, all_partitions}="%k" - -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", RESULT=="cdrom", SYMLINK+="cdrom%e" - -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd%e" - -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter%e" - -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter%e" - -# rename sr* to scd* -KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n" -KERNEL=="hd[a-z]*", BUS=="ide", SYSFS{removable}=="1", NAME{ignore_remove}="%k" - -# dvb -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" - -####################################### -# Persistent block device stuff - begin -####################################### -# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" - -# never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}="1", GOTO="persistent_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -LABEL="persistent_end" - -##################################### -# Persistent block device stuff - end -##################################### - -ACTION=="add", SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" - -# Perhaps this should just be for all subsystems? -ACTION=="add", SUBSYSTEM=="?*", MODALIAS=="?*", RUN+="/sbin/modprobe $modalias" - -ACTION=="add", SUBSYSTEM=="pcmcia", MODALIAS=="*", \ - RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" - -# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC -# sr: 4 TYPE_WORM, 5 TYPE_ROM -# st/osst: 1 TYPE_TAPE -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" - -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="0|7|14", \ - RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="[45]", \ - RUN+="/sbin/modprobe sr_mod" -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}=="On[sS]tream", \ - SYSFS{model}!="ADR*", RUN+="/sbin/modprobe osst" -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}=="On[sS]tream", \ - SYSFS{model}=="ADR*", RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}!="On[sS]tream", \ - RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="/sbin/modprobe sg" - -RUN+="socket:/org/kernel/udev/monitor" - -- cgit v1.2.3-54-g00ecf From 1945917d4b2048e56b0b7e26f15b6bcec8c786e9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Mar 2006 16:27:58 +0200 Subject: update SUSE rules --- etc/udev/suse/60-persistent-storage.rules | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index 9424322d6d..5f4e6b5f35 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -8,8 +8,11 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end" KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_storage_end" # never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", DRIVER!="ide-cdrom", GOTO="persistent_storage_end" +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" + +# for partitions import parent information +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" @@ -22,24 +25,20 @@ KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]|sr*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" KERNEL=="sr*|st*", GOTO="persistent_storage_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # BIOS Enhanced Disk Device KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" -- cgit v1.2.3-54-g00ecf From 1fda06ae9891494b5890b287bd6db01b685a8be6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Mar 2006 00:48:30 +0200 Subject: pass CROSS_COMPILE to AR and RANLIB down to extras/ --- Makefile | 3 ++- extras/volume_id/lib/Makefile | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 1b9534c7b8..fb7428279e 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,6 @@ CC = $(CROSS_COMPILE)gcc LD = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar RANLIB = $(CROSS_COMPILE)ranlib -HOSTCC = gcc CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ @@ -175,6 +174,8 @@ all: $(PROGRAMS) $(MAN_PAGES) CFLAGS="$(CFLAGS)" \ LD="$(LD)" \ LDFLAGS="$(LDFLAGS)" \ + AR="$(AR)" \ + RANLIB="$(RANLIB)" \ LIB_OBJS="$(LIB_OBJS)" \ LIBUDEV="$(PWD)/$(LIBUDEV)" \ -C $$target $@ || exit 1; \ diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index f69df5f5ca..a0c773550e 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -54,9 +54,6 @@ HEADERS= \ libvolume_id.h \ util.h -AR = $(CROSS)ar -RANLIB = $(CROSS)ranlib - all: libvolume_id.a $(SHLIB) libvolume_id.pc .PHONY: all .DEFAULT: all -- cgit v1.2.3-54-g00ecf From f05da2ae00de9fedaabb59dbf9a18b63175c5d40 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Mar 2006 01:52:12 +0200 Subject: volume_id: update README --- extras/name_cdrom.pl | 0 extras/volume_id/README | 44 ++++++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 20 deletions(-) mode change 100644 => 100755 extras/name_cdrom.pl diff --git a/extras/name_cdrom.pl b/extras/name_cdrom.pl old mode 100644 new mode 100755 diff --git a/extras/volume_id/README b/extras/volume_id/README index 969f301a4c..be98df9b12 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -1,10 +1,9 @@ -vol_id - volume, filesystem, disklabel reader +vol_id - probe filesystem and read label and uuid This program is normally called from a udev rule, to provide udev with the -name, uuid or the filesystem type of a volume to name a device node. -vol_id opens the blockdevice node specified at the commandline. -The following commandline switches are supported to specify what vol_id -should print: +filesystem type of a volume and the label and uuid to name a device node. +vol_id opens the blockdevice node specified at the commandline. The following +commandline switches are supported to specify what vol_id should print: --export prints all values -h prints help text @@ -17,6 +16,7 @@ and slashes ignored. fstype probe label uuid fsversion ---------------------------------------------------- +linux swap * * * * ext * * * * reiserfs jr/3.5/3.6/4 * * * * fat (12, 16, 32) * * * * @@ -25,26 +25,30 @@ jfs * * * - xfs * * * - hfs (plus, wrapped) * * * - udf * * - - -iso9660 * * n/a - +iso9660 * * - - ufs * - - - -linux swap * * * * -LVM 1 * - - - -LVM 2 * - - * -linux raid * - * * cramfs * * - - sysv * * - * luks * - * - hpfs * - - - -romfs * -squashfs * -minix * -highpoint * -isw_raid * -lsi_raid * -nvidia_raid * -promise_raid * -silicon_raid * -via_raid * +romfs * * - - +squashfs * - - - +minix * - - * +ocfs (1, 2) * * * * +vxfs * - - * + +Raid members are detected to prevent the probing for a filesystem +----------------------------------------------------------------- +linux raid * - * * +LVM 1 * - - - +LVM 2 * - - * +highpoint * - - - +isw_raid * - - - +lsi_raid * - - - +nvidia_raid * - - - +promise_raid * - - - +silicon_raid * - - - +via_raid * - - - If no label is found vol_id exits with nonzero and the rule will be -- cgit v1.2.3-54-g00ecf From cee5700cde26053bcf26c61fc2b9aa8f98d27acd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Mar 2006 02:13:22 +0200 Subject: volume_id: generate man page from xml source --- extras/volume_id/Makefile | 2 +- extras/volume_id/vol_id.8 | 75 ++++++++++++++++------------- extras/volume_id/vol_id.xml | 115 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 157 insertions(+), 35 deletions(-) create mode 100644 extras/volume_id/vol_id.xml diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index f8d54a2309..0b22fb9c2d 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -7,7 +7,7 @@ PROG = vol_id GEN_HEADERS = -MAN_PAGES = +MAN_PAGES = vol_id.8 prefix = etcdir = ${prefix}/etc diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index d84ca8311a..9f5a9c5d8e 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -1,41 +1,48 @@ -.TH VOL_ID 8 "November 2005" "" "Linux Administrator's Manual" -.SH NAME +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "VOL_ID" "8" "March 2006" "volume_id" "vol_id" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" vol_id \- probe filesystem type and read label and uuid -.SH SYNOPSIS -.BI vol_id -[\fI--export\fP|\fI-t\fP|\fI-l\fP|\fI-u\fP] \fIblockdevice\fP +.SH "SYNOPSIS" +.HP 7 +\fBvol_id\fR [\fB\-\-export\fR] [\fB\-t\fR] [\fB\-l\fR] [\fB\-u\fR] [\fIdevice\fR] .SH "DESCRIPTION" -.B vol_id -is normally called from a udev rule, to provide udev with the -label and uuid of a filesystem. vol_id supports all common -filesystem formats and detects various raid setups to prevent -the recognition of raid members as a filesystem. -.SH USAGE -.B vol_id -opens the device node specified at the commandline. -.SH OPTIONS -The following commandline switches are supported to specify what vol_id -should print: +.PP +\fBvol_id\fR +is usually called from a udev rule, to provide udev with the filesystem type, the label and the uuid of a volume. +\fBvol_id\fR +supports all common filesystem formats and detects various raid setups to prevent the recognition of raid members as a volume with a filesystem. +.SH "OPTIONS" .TP -.BI --export +\fB\-\-export\fR print all values in key/value format to import them into the environment. .TP -.BI -l -print the label of the volume +\fB\-t\fR +print the filesystem type .TP -.BI -t -print the type of the volume +\fB\-l\fR +print the label of a volume .TP -.BI -u -print the uuid of the volume -.RE -.SH EXIT STATUS -.B vol_id -will only return successful if the string asked for is not empty. -All trailing whitespace will be removed, spaces replaced by underscore -and slashes ignored. -.SH SEE ALSO -.BR udev (7) -.SH AUTHORS -Developed by Kay Sievers . - +\fB\-u\fR +print the uuid of a volume +.SH "ENVIRONMENT" +.TP +\fBUDEV_LOG\fR +Set the syslog priority. +.SH "EXIT STATUS" +.PP +\fBvol_id\fR +will only return successful if the value asked for is not empty. All trailing whitespace will be removed, spaces replaced by underscore and slashes ignored. +.SH "AUTHOR" +.PP +Written by Kay Sievers + +.SH "SEE ALSO" +.PP +\fBudev\fR(7) diff --git a/extras/volume_id/vol_id.xml b/extras/volume_id/vol_id.xml new file mode 100644 index 0000000000..0d4130e33f --- /dev/null +++ b/extras/volume_id/vol_id.xml @@ -0,0 +1,115 @@ + + + +
        + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2006 + Kay Sievers + + + +
        + vol_id + + + vol_id + March 2006 + volume_id + + + + vol_id + 8 + + + + vol_idprobe filesystem type and read label and uuid + + + + + vol_id + + + + + device + + + + DESCRIPTION + vol_id is usually called from a udev rule, to + provide udev with the filesystem type, the label and the uuid of a + volume. vol_id supports all common filesystem formats + and detects various raid setups to prevent the recognition of raid members + as a volume with a filesystem. + + + OPTIONS + + + + + print all values in key/value format to import them into the + environment. + + + + + + print the filesystem type + + + + + + print the label of a volume + + + + + + print the uuid of a volume + + + + + + ENVIRONMENT + + + + + Set the syslog priority. + + + + + + EXIT STATUS + vol_id will only return successful if the + value asked for is not empty. All trailing whitespace will be removed, + spaces replaced by underscore and slashes ignored. + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org + + + + SEE ALSO + + udev7 + + + +
        +
        -- cgit v1.2.3-54-g00ecf From cad4697469883b73cdd43e7e83db122951535ee8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 2 Apr 2006 16:01:00 +0200 Subject: update README --- FAQ | 13 ++++++------- README | 45 +++++++++++++++++++++------------------------ 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/FAQ b/FAQ index 4285d98ff7..1fe374cf91 100644 --- a/FAQ +++ b/FAQ @@ -84,7 +84,7 @@ A: udev can be placed in initramfs and run for every device that is found. Q: Can I use udev to automount a USB device when I connect it? A: Technically, yes, but udev is not intended for this. All major distributions use HAL (http://freedesktop.org/wiki/Software_2fhal) for this, which also - watches devices with removable media and integrates into the desktop software. + watches devices with removable media and integrates the Desktop environment. Alternatively, it is easy to add the following to fstab: /dev/disk/by-label/PENDRIVE /media/PENDRIVE vfat user,noauto 0 0 @@ -106,13 +106,12 @@ A: When using dynamic device numbers, a given pair of major/minor numbers may (The same problem exists when using PAM to change permissions on login.) The simplest solution is to prevent the creation of hard links by putting - /dev in a separate filesystem like tmpfs. + /dev on a separate filesystem like tmpfs. Q: I have other questions about udev, where do I ask them? A: The linux-hotplug-devel mailing list is the proper place for it. The - address for it is linux-hotplug-devel@lists.sourceforge.net - Information on joining can be found at - - Archives of the mailing list can be found at: - + address for it is: + linux-hotplug-devel@lists.sourceforge.net + Information on joining can be found at: + https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel diff --git a/README b/README index c188506b53..7ac1d4509c 100644 --- a/README +++ b/README @@ -4,13 +4,12 @@ For more information see the files in the docs/ directory. Important Note: Integrating udev in the system is a whole lot of work, has complex dependencies - and differs a lot from distro to distro. All reasonable distros depend on udev - these days and the system will not work without it. - - The upstream udev project does not support or recomend to replace a distro's udev - installation with the upstream version. The installation of a unmodified upstream - version may render your system unusable! There is no "default" setup or a set - of "default" rules provided by the upstream udev version. + and differs a lot from distro to distro. All major distros depend on udev these + days and the system may not work without a proper installed version. The upstream + udev project does not support or recomend to replace a distro's udev installation + with the upstream version. The installation of a unmodified upstream version may + render your system unusable. Until now, there is no "default" setup or a set of + "default" rules provided by the upstream udev version. Requirements: - 2.6.x version of the Linux kernel. See the RELEASE-NOTES file in the @@ -19,7 +18,7 @@ Requirements: - The kernel must have sysfs and unix domain socket enabled. (unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, - but it is completely silly, don't complain if anything goes wrong.) + but it is completely silly - don't complain if anything goes wrong.) - The proc filesystem must be mounted on /proc. @@ -31,9 +30,9 @@ Operation: Udev creates and removes device nodes in /dev, based on events the kernel sends out on device discovery or removal. - - Early in the boot process, /dev should get a tmpfs filesystem - mounted, which is populated from scratch by udev. Created nodes or - changed permissions will not survive a reboot, which is intentional. + - Early in the boot process, the /dev directory should get a tmpfs + filesystem mounted, which is populated from scratch by udev. Created nodes + or changed permissions will not survive a reboot, which is intentional. - The content of /lib/udev/devices directory which contains the nodes, symlinks and directories, which are always expected to be in /dev, should @@ -50,8 +49,9 @@ Operation: - All kernel events are matched against a set of specified rules in /etc/udev/rules.d/ which make it possible to hook into the event processing to load required kernel modules and setup devices. For all - devices the kernel requests a device node, udev will create one with - the default name or the one specified by a matching udev rules. + devices the kernel exports a major/minor number, udev will create a + device node with the default kernel name or the one specified by a + matching udev rule. Compile Options: @@ -74,16 +74,13 @@ Compile Options: Default value is 'false'. KLCC specifies the klibc compiler wrapper, usually located at /usr/bin/klcc. EXTRAS - If set, will build the "extra" helper programs as specified - as listed (see below for an example). - -If you want to build the udev helper programs: - make EXTRAS="extras/cdrom_id extras/scsi_id extras/volume_id" + list of helper programs in extras/ to build. + make EXTRAS="extras/cdrom_id extras/scsi_id extras/volume_id" Installation: - The install target intalls the udev binaries in the default locations, - All at boot time reqired binaries will be installed in /sbin. + All at boot time reqired binaries will be installed in /lib/udev or /sbin. - The default location for scripts and binaries that are called from rules is /lib/udev. Other packages who install udev rules, should use @@ -94,12 +91,12 @@ Installation: That way, nodes for broken subsystems or devices which can't be detected automatically by the kernel, will always be available. - - Copies of the rules files for all major distros are in the etc/udev - directory (you may look there how others distros are doing it). + - Copies of the rules files for the major distros are provided as examples + in the etc/udev directory. - - The persistent disk links in /dev/disk are the de facto standard - on Linux and should be installed with every default udev installation. - The devfs naming scheme rules are not recommended and not supported. + - The persistent device naming links in /dev/disk/ are required by other + software that depends on the data udev has collected from the devices + and should be installed by default with every udev installation. Please direct any comment/question/concern to the linux-hotplug-devel mailing list at: linux-hotplug-devel@lists.sourceforge.net -- cgit v1.2.3-54-g00ecf From 66e14ae7de7e95dde2f8360b9b506a2d3b6e9e42 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 3 Apr 2006 14:40:06 +0200 Subject: fix symlink targets in Makefiles --- extras/scsi_id/Makefile | 2 +- extras/volume_id/lib/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index c35d7dab94..1e9910efb9 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -59,7 +59,7 @@ clean: install-bin: all $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - ln -sf $(DESTDIR)$(libudevdir)/$(PROG) $(DESTDIR)$(sbindir)/$(PROG) + ln -sf $(libudevdir)/$(PROG) $(DESTDIR)$(sbindir)/$(PROG) .PHONY: install-bin uninstall-bin: diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index a0c773550e..ac298ab6c9 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -100,8 +100,8 @@ install: all $(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h $(INSTALL_LIB) -D libvolume_id.a $(DESTDIR)$(usrlibdir)/libvolume_id.a $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) - ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) - ln -sf $(DESTDIR)$(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so + ln -sf $(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) + ln -sf $(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc .PHONY: install -- cgit v1.2.3-54-g00ecf From 2b3f8e93ca4fff33ae0885c01c0a1fc238e58f7f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 3 Apr 2006 14:41:10 +0200 Subject: 089 release --- ChangeLog | 31 +++++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 16 ++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8b6bada1be..24c0ad3f83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +Summary of changes from v088 to v089 +============================================ + +Hannes Reinecke: + path_id: add bus to USB path + +Kay Sievers: + change rule to skip removable IDE devices + don't create uuid/label links for raid members + volume_id: provide library + fix rule order for persistent tape links + update man page + volume_id: provide a custom debug function + volume_id: rename subdirectory + volume_id: use shared library by default + because is better than cause + volume_id: remove some global symbols + volume_id: define exported symbols + remove all stripping code + man pages: mention udev(7) not udev(8) + update Debian rules + move all *_id programs to /lib/udev/ + update Red Hat rules + update SUSE rules + pass CROSS_COMPILE to AR and RANLIB down to extras/ + volume_id: update README + volume_id: generate man page from xml source + update README + fix symlink targets in Makefiles + + Summary of changes from v087 to v088 ============================================ diff --git a/Makefile b/Makefile index fb7428279e..5e4322481c 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 088 +VERSION = 089 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1dc4dfe9db..7c81c9a831 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,19 @@ +udev 089 +======== +Fix rule to skip persistent rules for removable IDE devices, which +also skipped optical IDE drives. + +All *_id program are installed in /lib/udev/ by default now. + +No binary is stripped anymore as this should be done in the +packaging process and not at build time. + +libvolume_id is provided as a shared library now and vol_id is +linked against it. Also one of the next HAL versions will require +this library, and the HAL build process will also require the +header file to be installed. The copy of the same code in HAL will +be removed to have only a single copy left on the system. + udev 088 ======== Add persistent links for SCSI tapes. The rules file is renamed -- cgit v1.2.3-54-g00ecf From 7baada47bea60dd192067fd36778a77481a3ed3a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Apr 2006 00:08:10 +0200 Subject: udevd: export current seqnum and add udevsettle --- Makefile | 6 +++ udevd.c | 15 ++++++ udevd.h | 1 + udevsettle.8 | 32 ++++++++++++ udevsettle.c | 155 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udevsettle.xml | 82 ++++++++++++++++++++++++++++++ 6 files changed, 291 insertions(+) create mode 100644 udevsettle.8 create mode 100644 udevsettle.c create mode 100644 udevsettle.xml diff --git a/Makefile b/Makefile index 5e4322481c..1ce1abeab4 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,7 @@ PROGRAMS = \ udev \ udevd \ udevtrigger \ + udevsettle \ udevsend \ udevcontrol \ udevmonitor \ @@ -86,6 +87,7 @@ MAN_PAGES = \ udevmonitor.8 \ udevd.8 \ udevtrigger.8 \ + udevsettle.8 \ udevsend.8 \ udevtest.8 \ udevinfo.8 \ @@ -261,6 +263,7 @@ install-man: $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 $(INSTALL_DATA) -D udevtrigger.8 $(DESTDIR)$(mandir)/man8/udevtrigger.8 + $(INSTALL_DATA) -D udevsettle.8 $(DESTDIR)$(mandir)/man8/udevsettle.8 $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ @@ -274,6 +277,7 @@ uninstall-man: - rm -f $(DESTDIR)$(mandir)/man8/udevtest.8 - rm -f $(DESTDIR)$(mandir)/man8/udevd.8 - rm -f $(DESTDIR)$(mandir)/man8/udevtrigger.8 + - rm -f $(DESTDIR)$(mandir)/man8/udevsettle.8 - rm -f $(DESTDIR)$(mandir)/man8/udevmonitor.8 - rm -f $(DESTDIR)$(mandir)/man8/udevcontrol.8 @ extras="$(EXTRAS)"; for target in $$extras; do \ @@ -285,6 +289,7 @@ install-bin: $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL_PROGRAM) -D udevd $(DESTDIR)$(sbindir)/udevd $(INSTALL_PROGRAM) -D udevtrigger $(DESTDIR)$(sbindir)/udevtrigger + $(INSTALL_PROGRAM) -D udevsettle $(DESTDIR)$(sbindir)/udevsettle $(INSTALL_PROGRAM) -D udevcontrol $(DESTDIR)$(sbindir)/udevcontrol $(INSTALL_PROGRAM) -D udevmonitor $(DESTDIR)$(usrsbindir)/udevmonitor $(INSTALL_PROGRAM) -D udevinfo $(DESTDIR)$(usrbindir)/udevinfo @@ -302,6 +307,7 @@ endif uninstall-bin: - rm -f $(DESTDIR)$(sbindir)/udevd - rm -f $(DESTDIR)$(sbindir)/udevtrigger + - rm -f $(DESTDIR)$(sbindir)/udevsettle - rm -f $(DESTDIR)$(sbindir)/udevcontrol - rm -f $(DESTDIR)$(usrsbindir)/udevmonitor - rm -f $(DESTDIR)$(usrbindir)/udevinfo diff --git a/udevd.c b/udevd.c index 701165b9ad..8741a0901b 100644 --- a/udevd.c +++ b/udevd.c @@ -279,8 +279,23 @@ static void udev_event_run(struct uevent_msg *msg) static void msg_queue_insert(struct uevent_msg *msg) { + char filename[PATH_SIZE]; + int fd; + msg->queue_time = time(NULL); + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); + if (fd > 0) { + char str[32]; + int len; + + len = sprintf(str, "%llu\n", msg->seqnum); + write(fd, str, len); + close(fd); + } + export_event_state(msg, EVENT_QUEUED); /* run all events with a timeout set immediately */ diff --git a/udevd.h b/udevd.h index 9ab6a445b9..e6ed58d622 100644 --- a/udevd.h +++ b/udevd.h @@ -31,6 +31,7 @@ #define EVENT_QUEUE_DIR ".udev/queue" #define EVENT_FAILED_DIR ".udev/failed" +#define EVENT_SEQNUM ".udev/uevent_seqnum" /* maximum limit of forked childs */ #define UDEVD_MAX_CHILDS 64 diff --git a/udevsettle.8 b/udevsettle.8 new file mode 100644 index 0000000000..601553980d --- /dev/null +++ b/udevsettle.8 @@ -0,0 +1,32 @@ +.\" ** You probably do not want to edit this file directly ** +.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). +.\" Instead of manually editing it, you probably should edit the DocBook XML +.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.TH "UDEVSETTLE" "8" "March 2006" "udev" "udevsettle" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udevsettle \- wait until queued kernel/udev events are handled +.SH "SYNOPSIS" +.HP 11 +\fBudevsettle\fR [\fB\-\-timeout=\fR\fB\fIseconds\fR\fR] +.SH "DESCRIPTION" +.PP +Waits watching the udev event queue and exits if all current events are handled. +.SH "OPTIONS" +.TP +\fB\-\-timeout=\fR\fB\fIseconds\fR\fR +maximum seconds to wait for the queue to become empty. +.SH "ENVIRONMENT" +.TP +\fBUDEV_LOG\fR +Overrides the syslog priority specified in the config file. +.SH "AUTHOR" +.PP +Written by Kay Sievers +. +.SH "SEE ALSO" +.PP +\fBudev\fR(7) diff --git a/udevsettle.c b/udevsettle.c new file mode 100644 index 0000000000..f0f85ff059 --- /dev/null +++ b/udevsettle.c @@ -0,0 +1,155 @@ +/* + * udevsettle.c + * + * Copyright (C) 2006 Kay Sievers + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" + +#define LOOP_PER_SECOND 20 + +static const char *udev_log_str; + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + + if (priority > udev_log_priority) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +int main(int argc, char *argv[], char *envp[]) +{ + char queuename[PATH_SIZE]; + char filename[PATH_SIZE]; + unsigned long long seq_kernel; + unsigned long long seq_udev; + char seqnum[32]; + int fd; + ssize_t len; + int timeout = 30; + int loop; + int i; + int rc = 1; + + logging_init("udevsettle"); + udev_config_init(); + dbg("version %s", UDEV_VERSION); + + udev_log_str = getenv("UDEV_LOG"); + + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strncmp(arg, "--timeout=", 10) == 0) { + char *str = &arg[10]; + + timeout = atoi(str); + dbg("timeout=%i", timeout); + if (timeout <= 0) { + fprintf(stderr, "Invalid timeout value.\n"); + goto exit; + } + } else { + fprintf(stderr, "Usage: udevsettle [--timeout=]\n"); + goto exit; + } + } + + sysfs_init(); + strlcpy(queuename, udev_root, sizeof(queuename)); + strlcat(queuename, "/" EVENT_QUEUE_DIR, sizeof(queuename)); + + loop = timeout * LOOP_PER_SECOND; + while (loop--) { + /* wait for events in queue to finish */ + while (loop--) { + struct stat statbuf; + + if (stat(queuename, &statbuf) < 0) { + info("queue is empty"); + break; + } + usleep(1000 * 1000 / LOOP_PER_SECOND); + } + if (loop <= 0) { + info("timeout waiting for queue"); + goto exit; + } + + /* read current kernel seqnum */ + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd < 0) + goto exit; + len = read(fd, seqnum, sizeof(seqnum)-1); + close(fd); + if (len <= 0) + goto exit; + seqnum[len] = '\0'; + seq_kernel = strtoull(seqnum, NULL, 10); + info("kernel seqnum = %llu", seq_kernel); + + /* read current udev seqnum */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd < 0) + goto exit; + len = read(fd, seqnum, sizeof(seqnum)-1); + close(fd); + if (len <= 0) + goto exit; + seqnum[len] = '\0'; + seq_udev = strtoull(seqnum, NULL, 10); + info("udev seqnum = %llu", seq_udev); + + /* make sure all kernel events have arrived in the queue */ + if (seq_udev >= seq_kernel) { + info("queue is empty and no pending events left"); + rc = 0; + goto exit; + } + usleep(1000 * 1000 / LOOP_PER_SECOND); + info("queue is empty, but events still pending"); + } + +exit: + sysfs_cleanup(); + logging_close(); + return rc; +} diff --git a/udevsettle.xml b/udevsettle.xml new file mode 100644 index 0000000000..5f8f1ee0a5 --- /dev/null +++ b/udevsettle.xml @@ -0,0 +1,82 @@ + + + +
        + + xmlto + + Kay + Sievers + kay.sievers@vrfy.org + + + 2006 + Kay Sievers + + + +
        + udevsettle + + + udevsettle + March 2006 + udev + + + + udevsettle + 8 + + + + udevsettlewait until queued kernel/udev events are handled + + + + + udevsettle + + + + + DESCRIPTION + Waits watching the udev event queue and exits if all current events are handled. + + + OPTIONS + + + + + maximum seconds to wait for the queue to become empty. + + + + + + ENVIRONMENT + + + + + Overrides the syslog priority specified in the config file. + + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev7 + + + +
        +
        -- cgit v1.2.3-54-g00ecf From 1017f139b311d7185f57f803c176f191e6d0ce3b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Apr 2006 17:31:49 +0200 Subject: volume_id: fix endianess conversion typo for FAT32 --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/fat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index ac298ab6c9..03c9315f9a 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 61 +SHLIB_REV = 62 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 4840a2a23c..9a11eaad55 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -321,7 +321,7 @@ fat32: goto found; /* set next cluster */ - next = le32_to_cpu(*((uint32_t *) buf) & 0x0fffffff); + next = le32_to_cpu(*((uint32_t *) buf)) & 0x0fffffff; if (next == 0) break; } -- cgit v1.2.3-54-g00ecf From a4d5ca644ed8bc59274967c17981d7448a075c07 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Apr 2006 22:29:33 +0200 Subject: merge device event handling and make database content available on "remove" --- Makefile | 3 +- udev.h | 10 +- udev_add.c | 300 -------------------------------------------------------- udev_device.c | 117 ++++++++++++++++++---- udev_node.c | 307 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev_remove.c | 135 -------------------------- udev_rules.c | 2 +- udevstart.c | 3 +- 8 files changed, 411 insertions(+), 466 deletions(-) delete mode 100644 udev_add.c create mode 100644 udev_node.c delete mode 100644 udev_remove.c diff --git a/Makefile b/Makefile index 1ce1abeab4..42c2bf23dc 100644 --- a/Makefile +++ b/Makefile @@ -69,8 +69,7 @@ HEADERS = \ UDEV_OBJS = \ udev_device.o \ udev_config.o \ - udev_add.o \ - udev_remove.o \ + udev_node.o \ udev_db.o \ udev_sysfs.o \ udev_rules.o \ diff --git a/udev.h b/udev.h index 2652d46ada..615253a52f 100644 --- a/udev.h +++ b/udev.h @@ -117,12 +117,10 @@ extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem); extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); -/* udev_add.c */ -extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); -extern int udev_add_device(struct udevice *udev); - -/* udev_remove.c */ -extern int udev_remove_device(struct udevice *udev); +/* udev_node.c */ +extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); +extern int udev_node_add(struct udevice *udev); +extern int udev_node_remove(struct udevice *udev); /* udev_db.c */ extern int udev_db_add_device(struct udevice *dev); diff --git a/udev_add.c b/udev_add.c deleted file mode 100644 index 6c023ab968..0000000000 --- a/udev_add.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * udev-add.c - * - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" -#include "udev_selinux.h" - - -int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) -{ - struct stat stats; - int retval = 0; - - if (major(devt) != 0 && strcmp(udev->dev->subsystem, "block") == 0) - mode |= S_IFBLK; - else - mode |= S_IFCHR; - - if (stat(file, &stats) != 0) - goto create; - - /* preserve node with already correct numbers, to prevent changing the inode number */ - if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { - info("preserve file '%s', because it has correct dev_t", file); - selinux_setfilecon(file, udev->dev->kernel_name, stats.st_mode); - goto perms; - } - - if (unlink(file) != 0) - err("unlink(%s) failed: %s", file, strerror(errno)); - else - dbg("already present file '%s' unlinked", file); - -create: - selinux_setfscreatecon(file, udev->dev->kernel_name, mode); - retval = mknod(file, mode, devt); - selinux_resetfscreatecon(); - if (retval != 0) { - err("mknod(%s, %#o, %u, %u) failed: %s", - file, mode, major(devt), minor(devt), strerror(errno)); - goto exit; - } - -perms: - dbg("chmod(%s, %#o)", file, mode); - if (chmod(file, mode) != 0) { - err("chmod(%s, %#o) failed: %s", file, mode, strerror(errno)); - goto exit; - } - - if (uid != 0 || gid != 0) { - dbg("chown(%s, %u, %u)", file, uid, gid); - if (chown(file, uid, gid) != 0) { - err("chown(%s, %u, %u) failed: %s", - file, uid, gid, strerror(errno)); - goto exit; - } - } - -exit: - return retval; -} - -static int create_node(struct udevice *udev) -{ - char filename[PATH_SIZE]; - struct name_entry *name_loop; - uid_t uid; - gid_t gid; - int tail; - int i; - - snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); - filename[sizeof(filename)-1] = '\0'; - - /* create parent directories if needed */ - if (strchr(udev->name, '/')) - create_path(filename); - - if (strcmp(udev->owner, "root") == 0) - uid = 0; - else { - char *endptr; - unsigned long id; - - id = strtoul(udev->owner, &endptr, 10); - if (endptr[0] == '\0') - uid = (uid_t) id; - else - uid = lookup_user(udev->owner); - } - - if (strcmp(udev->group, "root") == 0) - gid = 0; - else { - char *endptr; - unsigned long id; - - id = strtoul(udev->group, &endptr, 10); - if (endptr[0] == '\0') - gid = (gid_t) id; - else - gid = lookup_group(udev->group); - } - - info("creating device node '%s', major = '%d', minor = '%d', " "mode = '%#o', uid = '%d', gid = '%d'", - filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid); - - if (!udev->test_run) - if (udev_make_node(udev, filename, udev->devt, udev->mode, uid, gid) != 0) - goto error; - - setenv("DEVNAME", filename, 1); - - /* create all_partitions if requested */ - if (udev->partitions) { - char partitionname[PATH_SIZE]; - char *attr; - int range; - - /* take the maximum registered minor range */ - attr = sysfs_attr_get_value(udev->dev->devpath, "range"); - if (attr) { - range = atoi(attr); - if (range > 1) - udev->partitions = range-1; - } - info("creating device partition nodes '%s[1-%i]'", filename, udev->partitions); - if (!udev->test_run) { - for (i = 1; i <= udev->partitions; i++) { - dev_t part_devt; - - snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); - partitionname[sizeof(partitionname)-1] = '\0'; - part_devt = makedev(major(udev->devt), minor(udev->devt) + i); - udev_make_node(udev, partitionname, part_devt, udev->mode, uid, gid); - } - } - } - - /* create symlink(s) if requested */ - if (!list_empty(&udev->symlink_list)) { - char symlinks[512] = ""; - - list_for_each_entry(name_loop, &udev->symlink_list, node) { - int retval; - char linktarget[PATH_SIZE]; - - snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); - filename[sizeof(filename)-1] = '\0'; - - dbg("symlink '%s' to node '%s' requested", filename, udev->name); - if (!udev->test_run) - if (strchr(filename, '/')) - create_path(filename); - - /* optimize relative link */ - linktarget[0] = '\0'; - i = 0; - tail = 0; - while (udev->name[i] && (udev->name[i] == name_loop->name[i])) { - if (udev->name[i] == '/') - tail = i+1; - i++; - } - while (name_loop->name[i] != '\0') { - if (name_loop->name[i] == '/') - strlcat(linktarget, "../", sizeof(linktarget)); - i++; - } - - strlcat(linktarget, &udev->name[tail], sizeof(linktarget)); - - info("creating symlink '%s' to '%s'", filename, linktarget); - if (!udev->test_run) { - unlink(filename); - selinux_setfscreatecon(filename, NULL, S_IFLNK); - retval = symlink(linktarget, filename); - selinux_resetfscreatecon(); - if (retval != 0) - err("symlink(%s, %s) failed: %s", - linktarget, filename, strerror(errno)); - } - - strlcat(symlinks, filename, sizeof(symlinks)); - strlcat(symlinks, " ", sizeof(symlinks)); - } - - remove_trailing_chars(symlinks, ' '); - setenv("DEVLINKS", symlinks, 1); - } - - return 0; -error: - return -1; -} - -static int rename_net_if(struct udevice *udev) -{ - int sk; - struct ifreq ifr; - int retval; - - info("changing net interface name from '%s' to '%s'", udev->dev->kernel_name, udev->name); - if (udev->test_run) - return 0; - - sk = socket(PF_INET, SOCK_DGRAM, 0); - if (sk < 0) { - err("error opening socket: %s", strerror(errno)); - return -1; - } - - memset(&ifr, 0x00, sizeof(struct ifreq)); - strlcpy(ifr.ifr_name, udev->dev->kernel_name, IFNAMSIZ); - strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); - - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval != 0) - err("error changing net interface name: %s", strerror(errno)); - close(sk); - - return retval; -} - -int udev_add_device(struct udevice *udev) -{ - char *pos; - int retval = 0; - - dbg("adding name='%s'", udev->name); - selinux_init(); - - if (major(udev->devt)) { - retval = create_node(udev); - if (retval != 0) - goto exit; - - if (udev_db_add_device(udev) != 0) - dbg("udev_db_add_dev failed, remove might not work for custom names"); - } else if (strcmp(udev->dev->subsystem, "net") == 0) { - /* look if we want to change the name of the netif */ - if (strcmp(udev->name, udev->dev->kernel_name) != 0) { - retval = rename_net_if(udev); - if (retval != 0) - goto exit; - - info("renamed netif to '%s'", udev->name); - /* we've changed the name, now fake the devpath, because the - * original kernel name sleeps with the fishes and we don't - * get an event from the kernel with the new name - */ - pos = strrchr(udev->dev->devpath, '/'); - if (pos != NULL) { - pos[1] = '\0'; - strlcat(udev->dev->devpath, udev->name, sizeof(udev->dev->devpath)); - strlcpy(udev->dev->kernel_name, udev->name, sizeof(udev->dev->kernel_name)); - setenv("DEVPATH", udev->dev->devpath, 1); - setenv("INTERFACE", udev->name, 1); - } - } - } - -exit: - selinux_exit(); - return retval; -} diff --git a/udev_device.c b/udev_device.c index 5db27093d4..14c8d39cf7 100644 --- a/udev_device.c +++ b/udev_device.c @@ -1,7 +1,7 @@ /* - * udev_utils.c - generic stuff used by udev + * udev_device.c - main udev data object * - * Copyright (C) 2004, 2005 Kay Sievers + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -26,6 +26,9 @@ #include #include #include +#include +#include +#include #include "udev.h" #include "udev_rules.h" @@ -77,48 +80,122 @@ dev_t udev_device_get_devt(struct udevice *udev) return makedev(0, 0); } +static int rename_net_if(struct udevice *udev) +{ + int sk; + struct ifreq ifr; + int retval; + + info("changing net interface name from '%s' to '%s'", udev->dev->kernel_name, udev->name); + if (udev->test_run) + return 0; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) { + err("error opening socket: %s", strerror(errno)); + return -1; + } + + memset(&ifr, 0x00, sizeof(struct ifreq)); + strlcpy(ifr.ifr_name, udev->dev->kernel_name, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); + + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval != 0) + err("error changing net interface name: %s", strerror(errno)); + close(sk); + + return retval; +} + int udev_device_event(struct udev_rules *rules, struct udevice *udev) { int retval = 0; - /* device node or netif */ - if ((major(udev->devt) != 0 || strcmp(udev->dev->subsystem, "net") == 0) && - strcmp(udev->action, "add") == 0) { - dbg("device node or netif add '%s'", udev->dev->devpath); + /* add device node */ + if (major(udev->devt) != 0 && strcmp(udev->action, "add") == 0) { + dbg("device node add '%s'", udev->dev->devpath); udev_rules_get_name(rules, udev); if (udev->ignore_device) { info("device event will be ignored"); - return 0; + goto exit; } - /* create node, store in db */ - if (udev->name[0] != '\0') - retval = udev_add_device(udev); - else + if (udev->name[0] == '\0') { info("device node creation supressed"); - return retval; + goto exit; + } + /* create node, store in db */ + retval = udev_node_add(udev); + if (retval == 0) + udev_db_add_device(udev); + goto exit; } + /* add netif */ + if (strcmp(udev->dev->subsystem, "net") == 0 && strcmp(udev->action, "add") == 0) { + dbg("netif add '%s'", udev->dev->devpath); + udev_rules_get_name(rules, udev); + if (udev->ignore_device) { + info("device event will be ignored"); + goto exit; + } + + /* look if we want to change the name of the netif */ + if (strcmp(udev->name, udev->dev->kernel_name) != 0) { + char *pos; + + retval = rename_net_if(udev); + if (retval != 0) + goto exit; + info("renamed netif to '%s'", udev->name); + + /* now fake the devpath, because the kernel name changed silently */ + pos = strrchr(udev->dev->devpath, '/'); + if (pos != NULL) { + pos[1] = '\0'; + strlcat(udev->dev->devpath, udev->name, sizeof(udev->dev->devpath)); + strlcpy(udev->dev->kernel_name, udev->name, sizeof(udev->dev->kernel_name)); + setenv("DEVPATH", udev->dev->devpath, 1); + setenv("INTERFACE", udev->name, 1); + } + } + goto exit; + } + + /* remove device node */ if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { struct name_entry *name_loop; + /* import and delete database entry */ + if (udev_db_get_device(udev, udev->dev->devpath) == 0) { + udev_db_delete_device(udev); + if (udev->ignore_remove) { + dbg("remove event for '%s' requested to be ignored by rule", udev->name); + return 0; + } + /* restore stored persistent data */ + list_for_each_entry(name_loop, &udev->env_list, node) + putenv(name_loop->name); + } else { + dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel_name); + strlcpy(udev->name, udev->dev->kernel_name, sizeof(udev->name)); + } + udev_rules_get_run(rules, udev); if (udev->ignore_device) { info("device event will be ignored"); - return 0; + goto exit; } - /* get data from db, remove db-entry, delete node */ - retval = udev_remove_device(udev); - /* restore stored persistent data */ - list_for_each_entry(name_loop, &udev->env_list, node) - putenv(name_loop->name); - return retval; + retval = udev_node_remove(udev); + goto exit; } - /* default devices without a node */ + /* default devices */ udev_rules_get_run(rules, udev); if (udev->ignore_device) info("device event will be ignored"); +exit: return retval; } diff --git a/udev_node.c b/udev_node.c new file mode 100644 index 0000000000..9d6e89cfa1 --- /dev/null +++ b/udev_node.c @@ -0,0 +1,307 @@ +/* + * udev-node.c - device node handling + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2004 Kay Sievers + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" +#include "udev_selinux.h" + + +int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) +{ + struct stat stats; + int retval = 0; + + if (major(devt) != 0 && strcmp(udev->dev->subsystem, "block") == 0) + mode |= S_IFBLK; + else + mode |= S_IFCHR; + + if (stat(file, &stats) != 0) + goto create; + + /* preserve node with already correct numbers, to prevent changing the inode number */ + if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { + info("preserve file '%s', because it has correct dev_t", file); + selinux_setfilecon(file, udev->dev->kernel_name, stats.st_mode); + goto perms; + } + + if (unlink(file) != 0) + err("unlink(%s) failed: %s", file, strerror(errno)); + else + dbg("already present file '%s' unlinked", file); + +create: + selinux_setfscreatecon(file, udev->dev->kernel_name, mode); + retval = mknod(file, mode, devt); + selinux_resetfscreatecon(); + if (retval != 0) { + err("mknod(%s, %#o, %u, %u) failed: %s", + file, mode, major(devt), minor(devt), strerror(errno)); + goto exit; + } + +perms: + dbg("chmod(%s, %#o)", file, mode); + if (chmod(file, mode) != 0) { + err("chmod(%s, %#o) failed: %s", file, mode, strerror(errno)); + goto exit; + } + + if (uid != 0 || gid != 0) { + dbg("chown(%s, %u, %u)", file, uid, gid); + if (chown(file, uid, gid) != 0) { + err("chown(%s, %u, %u) failed: %s", + file, uid, gid, strerror(errno)); + goto exit; + } + } + +exit: + return retval; +} + +int udev_node_add(struct udevice *udev) +{ + char filename[PATH_SIZE]; + struct name_entry *name_loop; + uid_t uid; + gid_t gid; + int tail; + int i; + int retval = 0; + + selinux_init(); + + snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); + filename[sizeof(filename)-1] = '\0'; + + /* create parent directories if needed */ + if (strchr(udev->name, '/')) + create_path(filename); + + if (strcmp(udev->owner, "root") == 0) + uid = 0; + else { + char *endptr; + unsigned long id; + + id = strtoul(udev->owner, &endptr, 10); + if (endptr[0] == '\0') + uid = (uid_t) id; + else + uid = lookup_user(udev->owner); + } + + if (strcmp(udev->group, "root") == 0) + gid = 0; + else { + char *endptr; + unsigned long id; + + id = strtoul(udev->group, &endptr, 10); + if (endptr[0] == '\0') + gid = (gid_t) id; + else + gid = lookup_group(udev->group); + } + + info("creating device node '%s', major = '%d', minor = '%d', " "mode = '%#o', uid = '%d', gid = '%d'", + filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid); + + if (!udev->test_run) + if (udev_node_mknod(udev, filename, udev->devt, udev->mode, uid, gid) != 0) { + retval = -1; + goto exit; + } + + setenv("DEVNAME", filename, 1); + + /* create all_partitions if requested */ + if (udev->partitions) { + char partitionname[PATH_SIZE]; + char *attr; + int range; + + /* take the maximum registered minor range */ + attr = sysfs_attr_get_value(udev->dev->devpath, "range"); + if (attr) { + range = atoi(attr); + if (range > 1) + udev->partitions = range-1; + } + info("creating device partition nodes '%s[1-%i]'", filename, udev->partitions); + if (!udev->test_run) { + for (i = 1; i <= udev->partitions; i++) { + dev_t part_devt; + + snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); + partitionname[sizeof(partitionname)-1] = '\0'; + part_devt = makedev(major(udev->devt), minor(udev->devt) + i); + udev_node_mknod(udev, partitionname, part_devt, udev->mode, uid, gid); + } + } + } + + /* create symlink(s) if requested */ + if (!list_empty(&udev->symlink_list)) { + char symlinks[512] = ""; + + list_for_each_entry(name_loop, &udev->symlink_list, node) { + char linktarget[PATH_SIZE]; + + snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); + filename[sizeof(filename)-1] = '\0'; + + dbg("symlink '%s' to node '%s' requested", filename, udev->name); + if (!udev->test_run) + if (strchr(filename, '/')) + create_path(filename); + + /* optimize relative link */ + linktarget[0] = '\0'; + i = 0; + tail = 0; + while (udev->name[i] && (udev->name[i] == name_loop->name[i])) { + if (udev->name[i] == '/') + tail = i+1; + i++; + } + while (name_loop->name[i] != '\0') { + if (name_loop->name[i] == '/') + strlcat(linktarget, "../", sizeof(linktarget)); + i++; + } + + strlcat(linktarget, &udev->name[tail], sizeof(linktarget)); + + info("creating symlink '%s' to '%s'", filename, linktarget); + if (!udev->test_run) { + unlink(filename); + selinux_setfscreatecon(filename, NULL, S_IFLNK); + if (symlink(linktarget, filename) != 0) + err("symlink(%s, %s) failed: %s", linktarget, filename, strerror(errno)); + selinux_resetfscreatecon(); + } + + strlcat(symlinks, filename, sizeof(symlinks)); + strlcat(symlinks, " ", sizeof(symlinks)); + } + + remove_trailing_chars(symlinks, ' '); + setenv("DEVLINKS", symlinks, 1); + } + +exit: + selinux_exit(); + return retval; +} + +int udev_node_remove(struct udevice *udev) +{ + char filename[PATH_SIZE]; + char partitionname[PATH_SIZE]; + struct name_entry *name_loop; + struct stat stats; + int retval; + int i; + int num; + + if (!list_empty(&udev->symlink_list)) { + char symlinks[512] = ""; + + list_for_each_entry(name_loop, &udev->symlink_list, node) { + snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); + filename[sizeof(filename)-1] = '\0'; + + if (stat(filename, &stats) != 0) { + dbg("symlink '%s' not found", filename); + continue; + } + if (udev->devt && stats.st_rdev != udev->devt) { + info("symlink '%s' points to a different device, skip removal", filename); + continue; + } + + info("removing symlink '%s'", filename); + unlink(filename); + + if (strchr(filename, '/')) + delete_path(filename); + + strlcat(symlinks, filename, sizeof(symlinks)); + strlcat(symlinks, " ", sizeof(symlinks)); + } + + remove_trailing_chars(symlinks, ' '); + if (symlinks[0] != '\0') + setenv("DEVLINKS", symlinks, 1); + } + + snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); + filename[sizeof(filename)-1] = '\0'; + + if (stat(filename, &stats) != 0) { + dbg("device node '%s' not found", filename); + return -1; + } + if (udev->devt && stats.st_rdev != udev->devt) { + info("device node '%s' points to a different device, skip removal", filename); + return -1; + } + + info("removing device node '%s'", filename); + retval = unlink_secure(filename); + if (retval) + return retval; + + setenv("DEVNAME", filename, 1); + + num = udev->partitions; + if (num > 0) { + info("removing all_partitions '%s[1-%i]'", filename, num); + if (num > 255) { + info("garbage from udev database, skip all_partitions removal"); + return -1; + } + for (i = 1; i <= num; i++) { + snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); + partitionname[sizeof(partitionname)-1] = '\0'; + unlink_secure(partitionname); + } + } + + if (strchr(udev->name, '/')) + delete_path(filename); + + return retval; +} diff --git a/udev_remove.c b/udev_remove.c deleted file mode 100644 index 6de6cf5962..0000000000 --- a/udev_remove.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * udev-remove.c - * - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int delete_node(struct udevice *udev) -{ - char filename[PATH_SIZE]; - char partitionname[PATH_SIZE]; - struct name_entry *name_loop; - struct stat stats; - int retval; - int i; - int num; - - if (!list_empty(&udev->symlink_list)) { - char symlinks[512] = ""; - - list_for_each_entry(name_loop, &udev->symlink_list, node) { - snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); - filename[sizeof(filename)-1] = '\0'; - - if (stat(filename, &stats) != 0) { - dbg("symlink '%s' not found", filename); - continue; - } - if (udev->devt && stats.st_rdev != udev->devt) { - info("symlink '%s' points to a different device, skip removal", filename); - continue; - } - - info("removing symlink '%s'", filename); - unlink(filename); - - if (strchr(filename, '/')) - delete_path(filename); - - strlcat(symlinks, filename, sizeof(symlinks)); - strlcat(symlinks, " ", sizeof(symlinks)); - } - - remove_trailing_chars(symlinks, ' '); - if (symlinks[0] != '\0') - setenv("DEVLINKS", symlinks, 1); - } - - snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); - filename[sizeof(filename)-1] = '\0'; - - if (stat(filename, &stats) != 0) { - dbg("device node '%s' not found", filename); - return -1; - } - if (udev->devt && stats.st_rdev != udev->devt) { - info("device node '%s' points to a different device, skip removal", filename); - return -1; - } - - info("removing device node '%s'", filename); - retval = unlink_secure(filename); - if (retval) - return retval; - - setenv("DEVNAME", filename, 1); - - num = udev->partitions; - if (num > 0) { - info("removing all_partitions '%s[1-%i]'", filename, num); - if (num > 255) { - info("garbage from udev database, skip all_partitions removal"); - return -1; - } - for (i = 1; i <= num; i++) { - snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); - partitionname[sizeof(partitionname)-1] = '\0'; - unlink_secure(partitionname); - } - } - - if (strchr(udev->name, '/')) - delete_path(filename); - - return retval; -} - -/* - * look up the sysfs path in the database to get the node name to remove - * If we can't find it, use kernel name for lack of anything else to know to do - */ -int udev_remove_device(struct udevice *udev) -{ - if (major(udev->devt) == 0) - return 0; - - if (udev_db_get_device(udev, udev->dev->devpath) == 0) { - if (udev->ignore_remove) { - dbg("remove event for '%s' requested to be ignored by rule", udev->name); - return 0; - } - dbg("remove name='%s'", udev->name); - udev_db_delete_device(udev); - } else { - dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel_name); - strlcpy(udev->name, udev->dev->kernel_name, sizeof(udev->name)); - } - - return delete_node(udev); -} diff --git a/udev_rules.c b/udev_rules.c index 1aedb11118..09a299f224 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -610,7 +610,7 @@ found: snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", udev_root, major(udev->devt), minor(udev->devt)); udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0'; - udev_make_node(udev, udev->tmp_node, udev->devt, 0600, 0, 0); + udev_node_mknod(udev, udev->tmp_node, udev->devt, 0600, 0, 0); } strlcat(string, udev->tmp_node, maxsize); dbg("substitute temporary device node name '%s'", udev->tmp_node); diff --git a/udevstart.c b/udevstart.c index e5ce7af030..0d9b4f4004 100644 --- a/udevstart.c +++ b/udevstart.c @@ -130,7 +130,6 @@ static int add_device(const char *devpath) /* override built-in sysfs device */ udev->dev = dev; strcpy(udev->action, "add"); - udev->devt = udev_device_get_devt(udev); if (strcmp(udev->dev->subsystem, "net") != 0) { udev->devt = udev_device_get_devt(udev); @@ -148,7 +147,7 @@ static int add_device(const char *devpath) goto exit; } if (udev->name[0] != '\0') - retval = udev_add_device(udev); + retval = udev_device_event(&rules, udev); else info("device node creation supressed"); -- cgit v1.2.3-54-g00ecf From fc8ec932580698a2a4274204029aebb937000c70 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Apr 2006 19:46:24 +0200 Subject: set default udevsettle timeout to 3 minutes --- udevsettle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udevsettle.c b/udevsettle.c index f0f85ff059..3215b3c5ba 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -33,6 +33,7 @@ #include "udev.h" #include "udevd.h" +#define DEFAULT_TIMEOUT 180 #define LOOP_PER_SECOND 20 static const char *udev_log_str; @@ -60,7 +61,7 @@ int main(int argc, char *argv[], char *envp[]) char seqnum[32]; int fd; ssize_t len; - int timeout = 30; + int timeout = DEFAULT_TIMEOUT; int loop; int i; int rc = 1; -- cgit v1.2.3-54-g00ecf From 750d10daacfc0285f83204161811f5e2ea531712 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Thu, 6 Apr 2006 19:52:41 +0200 Subject: add inotify support for hppa and MIPS and log if inotify is not available --- udev_libc_wrapper.h | 22 ++++++++++++++++++++++ udevd.c | 6 +++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index fc66670a3c..ed8070947f 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -65,6 +65,28 @@ # define __NR_inotify_init 290 # define __NR_inotify_add_watch 291 # define __NR_inotify_rm_watch 292 +#elif defined (__hppa__) +# define __NR_inotify_init 269 +# define __NR_inotify_add_watch 270 +# define __NR_inotify_rm_watch 271 +#elif defined (__mips__) +# include +# if _MIPS_SIM == _MIPS_SIM_ABI32 +# define __NR_Linux 4000 +# define __NR_inotify_init (__NR_Linux + 284) +# define __NR_inotify_add_watch (__NR_Linux + 285) +# define __NR_inotify_rm_watch (__NR_Linux + 286) +# elif _MIPS_SIM == _MIPS_SIM_ABI64 +# define __NR_Linux 5000 +# define __NR_inotify_init (__NR_Linux + 243) +# define __NR_inotify_add_watch (__NR_Linux + 244) +# define __NR_inotify_rm_watch (__NR_Linux + 245) +# elif _MIPS_SIM == _MIPS_SIM_NABI32 +# define __NR_Linux 6000 +# define __NR_inotify_init (__NR_Linux + 247) +# define __NR_inotify_add_watch (__NR_Linux + 248) +# define __NR_inotify_rm_watch (__NR_Linux + 249) +# endif #else #warning "inotify unsupported on this architecture!" #endif diff --git a/udevd.c b/udevd.c index 8741a0901b..2129d3c66a 100644 --- a/udevd.c +++ b/udevd.c @@ -971,8 +971,12 @@ int main(int argc, char *argv[], char *envp[]) /* watch rules directory */ inotify_fd = inotify_init(); - if (inotify_fd > 0) + if (inotify_fd >= 0) inotify_add_watch(inotify_fd, udev_rules_filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + else if (errno == ENOSYS) + err("the kernel does not support inotify, udevd can't monitor configuration file changes"); + else + err("inotify_init failed: %s", strerror(errno)); /* maximum limit of forked childs */ value = getenv("UDEVD_MAX_CHILDS"); -- cgit v1.2.3-54-g00ecf From 3e5d5cb773f41d70b9e22bef36839101e0c51fd7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Apr 2006 20:40:58 +0200 Subject: export INTERFACE_OLD if we renamed a netif --- udev_device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udev_device.c b/udev_device.c index 14c8d39cf7..84d0ab2204 100644 --- a/udev_device.c +++ b/udev_device.c @@ -149,6 +149,9 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) goto exit; info("renamed netif to '%s'", udev->name); + /* export old name */ + setenv("INTERFACE_OLD", udev->dev->kernel_name, 1); + /* now fake the devpath, because the kernel name changed silently */ pos = strrchr(udev->dev->devpath, '/'); if (pos != NULL) { -- cgit v1.2.3-54-g00ecf From 03149e13c2f70f93e370c94f9c9a71129287bc1b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Apr 2006 20:56:15 +0200 Subject: let udevmonitor show the possibly renamed devpath For renamed network interfaces, the udev socket message header contained the original devpath, which we have updated in the environment after the kernel has silently renamed the netif. --- udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevd.c b/udevd.c index 2129d3c66a..b0c38eb413 100644 --- a/udevd.c +++ b/udevd.c @@ -130,7 +130,7 @@ static int udev_event_process(struct uevent_msg *msg) dbg("executing run list"); list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) - pass_env_to_socket(&name_loop->name[strlen("socket:")], msg->devpath, msg->action); + pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, udev->action); else { char program[PATH_SIZE]; -- cgit v1.2.3-54-g00ecf From f7dd3a57a40282f1c3fb9ad90a30d58b31b64ff8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 8 Apr 2006 05:04:35 +0200 Subject: volume_id: move some debug to info level --- extras/volume_id/lib/cramfs.c | 2 +- extras/volume_id/lib/ext.c | 2 +- extras/volume_id/lib/fat.c | 2 +- extras/volume_id/lib/hfs.c | 2 +- extras/volume_id/lib/highpoint.c | 2 +- extras/volume_id/lib/hpfs.c | 2 +- extras/volume_id/lib/iso9660.c | 2 +- extras/volume_id/lib/isw_raid.c | 2 +- extras/volume_id/lib/jfs.c | 2 +- extras/volume_id/lib/linux_raid.c | 2 +- extras/volume_id/lib/linux_swap.c | 2 +- extras/volume_id/lib/lsi_raid.c | 2 +- extras/volume_id/lib/lvm.c | 2 +- extras/volume_id/lib/minix.c | 2 +- extras/volume_id/lib/ntfs.c | 2 +- extras/volume_id/lib/nvidia_raid.c | 2 +- extras/volume_id/lib/ocfs.c | 4 +++- extras/volume_id/lib/promise_raid.c | 2 +- extras/volume_id/lib/reiserfs.c | 2 +- extras/volume_id/lib/romfs.c | 2 +- extras/volume_id/lib/silicon_raid.c | 2 +- extras/volume_id/lib/squashfs.c | 2 +- extras/volume_id/lib/sysv.c | 2 +- extras/volume_id/lib/udf.c | 2 +- extras/volume_id/lib/ufs.c | 2 +- extras/volume_id/lib/util.c | 6 +++--- extras/volume_id/lib/vxfs.c | 2 +- extras/volume_id/lib/xfs.c | 2 +- 28 files changed, 32 insertions(+), 30 deletions(-) diff --git a/extras/volume_id/lib/cramfs.c b/extras/volume_id/lib/cramfs.c index beb34d5bc0..100ebdec22 100644 --- a/extras/volume_id/lib/cramfs.c +++ b/extras/volume_id/lib/cramfs.c @@ -45,7 +45,7 @@ int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) { struct cramfs_super *cs; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); if (cs == NULL) diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index 51c0011218..7d41a3287e 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -75,7 +75,7 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off) struct ext2_super_block *es; size_t bsize; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); if (es == NULL) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 9a11eaad55..74336b4e6d 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -147,7 +147,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off) uint32_t next; int maxloop; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); if (vs == NULL) diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index f666b18379..4e34d66ba4 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -160,7 +160,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off) struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; const uint8_t *buf; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/highpoint.c b/extras/volume_id/lib/highpoint.c index deba540ad5..e441edb776 100644 --- a/extras/volume_id/lib/highpoint.c +++ b/extras/volume_id/lib/highpoint.c @@ -49,7 +49,7 @@ int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off) struct hpt37x_meta *hpt; uint32_t magic; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c index 3e9589fcca..6fec9caf8d 100644 --- a/extras/volume_id/lib/hpfs.c +++ b/extras/volume_id/lib/hpfs.c @@ -38,7 +38,7 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off) { struct hpfs_super *hs; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); if (hs == NULL) diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c index 7b78a7e992..be64a8b8af 100644 --- a/extras/volume_id/lib/iso9660.c +++ b/extras/volume_id/lib/iso9660.c @@ -59,7 +59,7 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) struct iso_volume_descriptor *is; struct high_sierra_volume_descriptor *hs; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/isw_raid.c b/extras/volume_id/lib/isw_raid.c index 6465a31bf5..f5761e826b 100644 --- a/extras/volume_id/lib/isw_raid.c +++ b/extras/volume_id/lib/isw_raid.c @@ -43,7 +43,7 @@ int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint uint64_t meta_off; struct isw_meta *isw; - dbg("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c index b230fb258c..80360915a4 100644 --- a/extras/volume_id/lib/jfs.c +++ b/extras/volume_id/lib/jfs.c @@ -45,7 +45,7 @@ int volume_id_probe_jfs(struct volume_id *id, uint64_t off) { struct jfs_super_block *js; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); if (js == NULL) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index ad4a5ba4d6..17819375ba 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -54,7 +54,7 @@ int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size uint64_t sboff; uint8_t uuid[16]; - dbg("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index b63f1e6c00..3937f8ea46 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -42,7 +42,7 @@ int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off) const uint8_t *buf; unsigned int page; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); /* the swap signature is at the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { diff --git a/extras/volume_id/lib/lsi_raid.c b/extras/volume_id/lib/lsi_raid.c index f1db4a6e50..56fd5671d3 100644 --- a/extras/volume_id/lib/lsi_raid.c +++ b/extras/volume_id/lib/lsi_raid.c @@ -38,7 +38,7 @@ int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t s uint64_t meta_off; struct lsi_meta *lsi; - dbg("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c index 47d84b0968..727204280b 100644 --- a/extras/volume_id/lib/lvm.c +++ b/extras/volume_id/lib/lvm.c @@ -46,7 +46,7 @@ int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) const uint8_t *buf; struct lvm1_super_block *lvm; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); if (buf == NULL) diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c index 75e9c3acbd..c5e16e783b 100644 --- a/extras/volume_id/lib/minix.c +++ b/extras/volume_id/lib/minix.c @@ -46,7 +46,7 @@ int volume_id_probe_minix(struct volume_id *id, uint64_t off) { struct minix_super_block *ms; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); ms = (struct minix_super_block *) volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); if (ms == NULL) diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index f1e8c4bc29..5f2a5b93a2 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -105,7 +105,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off) const uint8_t *buf; const uint8_t *val; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (ns == NULL) diff --git a/extras/volume_id/lib/nvidia_raid.c b/extras/volume_id/lib/nvidia_raid.c index 10c1c714f7..ca42459307 100644 --- a/extras/volume_id/lib/nvidia_raid.c +++ b/extras/volume_id/lib/nvidia_raid.c @@ -41,7 +41,7 @@ int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t siz uint64_t meta_off; struct nvidia_meta *nv; - dbg("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c index b376ead833..bf311415dd 100644 --- a/extras/volume_id/lib/ocfs.c +++ b/extras/volume_id/lib/ocfs.c @@ -132,6 +132,8 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off) struct ocfs1_super_block_header *osh; struct ocfs1_super_block_label *osl; + info("probing at offset 0x%llx", (unsigned long long) off); + buf = volume_id_get_buffer(id, off, 0x200); if (buf == NULL) return -1; @@ -168,7 +170,7 @@ int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) struct ocfs2_super_block *os; size_t blksize; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); diff --git a/extras/volume_id/lib/promise_raid.c b/extras/volume_id/lib/promise_raid.c index 2a2ce1689e..1c4d3658ce 100644 --- a/extras/volume_id/lib/promise_raid.c +++ b/extras/volume_id/lib/promise_raid.c @@ -42,7 +42,7 @@ int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, u 63, 255, 256, 16, 399, 0 }; - dbg("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); if (size < 0x40000) diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c index b5706f86e0..abeb06b88f 100644 --- a/extras/volume_id/lib/reiserfs.c +++ b/extras/volume_id/lib/reiserfs.c @@ -60,7 +60,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) struct reiser4_super_block *rs4; uint8_t *buf; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/romfs.c b/extras/volume_id/lib/romfs.c index 8bb2a0018a..a88781e36e 100644 --- a/extras/volume_id/lib/romfs.c +++ b/extras/volume_id/lib/romfs.c @@ -37,7 +37,7 @@ int volume_id_probe_romfs(struct volume_id *id, uint64_t off) { struct romfs_super *rfs; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); if (rfs == NULL) diff --git a/extras/volume_id/lib/silicon_raid.c b/extras/volume_id/lib/silicon_raid.c index 017b023e27..634e4abd0b 100644 --- a/extras/volume_id/lib/silicon_raid.c +++ b/extras/volume_id/lib/silicon_raid.c @@ -53,7 +53,7 @@ int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint uint64_t meta_off; struct silicon_meta *sil; - dbg("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index bdb1f16628..fdba64edbc 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -36,7 +36,7 @@ int volume_id_probe_squashfs(struct volume_id *id, uint64_t off) { struct squashfs_super *sqs; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); sqs = (struct squashfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); if (sqs == NULL) diff --git a/extras/volume_id/lib/sysv.c b/extras/volume_id/lib/sysv.c index 52349c0623..6e0ed046f0 100644 --- a/extras/volume_id/lib/sysv.c +++ b/extras/volume_id/lib/sysv.c @@ -95,7 +95,7 @@ int volume_id_probe_sysv(struct volume_id *id, uint64_t off) struct xenix_super *xs; unsigned int boff; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { vs = (struct sysv_super *) diff --git a/extras/volume_id/lib/udf.c b/extras/volume_id/lib/udf.c index d7497ec51b..d71e9d6f5d 100644 --- a/extras/volume_id/lib/udf.c +++ b/extras/volume_id/lib/udf.c @@ -72,7 +72,7 @@ int volume_id_probe_udf(struct volume_id *id, uint64_t off) unsigned int loc; unsigned int clen; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); if (vsd == NULL) diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c index d3960b1bec..8255b6e791 100644 --- a/extras/volume_id/lib/ufs.c +++ b/extras/volume_id/lib/ufs.c @@ -175,7 +175,7 @@ int volume_id_probe_ufs(struct volume_id *id, uint64_t off) struct ufs_super_block *ufs; int offsets[] = {0, 8, 64, 256, -1}; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); for (i = 0; offsets[i] >= 0; i++) { ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index cf5392cf9a..09bfc67500 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -180,7 +180,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) { ssize_t buf_len; - dbg("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); + info("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); /* check if requested area fits in superblock buffer */ if (off + len <= SB_BUFFER_SIZE) { if (id->sbbuf == NULL) { @@ -193,7 +193,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) /* check if we need to read */ if ((off + len) > id->sbbuf_len) { - dbg("read sbbuf len:0x%llx", (unsigned long long) (off + len)); + info("read sbbuf len:0x%llx", (unsigned long long) (off + len)); if (lseek(id->fd, 0, SEEK_SET) < 0) { dbg("lseek failed (%s)", strerror(errno)); return NULL; @@ -229,7 +229,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - dbg("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); + info("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); if (lseek(id->fd, off, SEEK_SET) < 0) { dbg("lseek failed (%s)", strerror(errno)); return NULL; diff --git a/extras/volume_id/lib/vxfs.c b/extras/volume_id/lib/vxfs.c index d10cc37762..112666192c 100644 --- a/extras/volume_id/lib/vxfs.c +++ b/extras/volume_id/lib/vxfs.c @@ -37,7 +37,7 @@ int volume_id_probe_vxfs(struct volume_id *id, uint64_t off) { struct vxfs_super *vxs; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); if (vxs == NULL) diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c index 3d870c41e7..9228fe4c88 100644 --- a/extras/volume_id/lib/xfs.c +++ b/extras/volume_id/lib/xfs.c @@ -45,7 +45,7 @@ int volume_id_probe_xfs(struct volume_id *id, uint64_t off) { struct xfs_super_block *xs; - dbg("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx", (unsigned long long) off); xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (xs == NULL) -- cgit v1.2.3-54-g00ecf From 6464f0ea2b1c62692c7032abecc1a794d2ab7dee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 8 Apr 2006 18:19:10 +0200 Subject: udevtrigger: fix event order Thanks for the fix to: Thomas de Grenier de Latour --- udevtrigger.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udevtrigger.c b/udevtrigger.c index bc8453a82a..2d5772fd6b 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -74,16 +74,17 @@ LIST_HEAD(device_last_list); static int device_list_insert(const char *path) { struct list_head *device_list = &device_default_list; + const char *devpath = &path[strlen(sysfs_path)]; int i; for (i = 0; first_list[i] != NULL; i++) { - if (strncmp(path, first_list[i], strlen(first_list[i])) == 0) { + if (strncmp(devpath, first_list[i], strlen(first_list[i])) == 0) { device_list = &device_first_list; break; } } for (i = 0; last_list[i] != NULL; i++) { - if (strncmp(path, last_list[i], strlen(last_list[i])) == 0) { + if (strncmp(devpath, last_list[i], strlen(last_list[i])) == 0) { device_list = &device_last_list; break; } -- cgit v1.2.3-54-g00ecf From 485fd28cfa03d2d0b682d6ddb30bdef1d249e5fd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 11 Apr 2006 19:33:51 +0200 Subject: usb_id: remove uneeded code --- extras/usb_id/usb_id.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 783d546b26..85c6beda40 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -61,7 +61,6 @@ static char type_str[16]; static int use_usb_info; static int use_num_info; static int export; -static int debug; static void set_str(char *to, const char *from, size_t count) { @@ -371,14 +370,6 @@ int main(int argc, char **argv) dbg("argc is %d", argc); - /* sysfs path can be overridden for testing */ - env = getenv("SYSFS_PATH"); - if (env) { - strlcpy(sysfs_path, env, sizeof(sysfs_path)); - remove_trailing_chars(sysfs_path, '/'); - } else - strcpy(sysfs_path, "/sys"); - while ((option = getopt(argc, argv, "dnux")) != -1 ) { if (optarg) dbg("option '%c' arg '%s'", option, optarg); @@ -386,9 +377,6 @@ int main(int argc, char **argv) dbg("option '%c'", option); switch (option) { - case 'd': - debug = 1; - break; case 'n': use_num_info = 1; use_usb_info = 1; -- cgit v1.2.3-54-g00ecf From 00a074480e4ab15e61f13f8791015fa0befcadce Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Tue, 11 Apr 2006 19:35:52 +0200 Subject: fix typo in error message --- udev_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_rules.c b/udev_rules.c index 09a299f224..623ca46858 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -293,7 +293,7 @@ static int find_free_number(const char *base, const char *devpath) static int warn = 1; if (warn) { - err("%%e is deprecated, will be removed and is unlikey to work correctly. Don't use it."); + err("%%e is deprecated, will be removed and is unlikely to work correctly. Don't use it."); warn = 0; } -- cgit v1.2.3-54-g00ecf From ff9a488d8c559a2ee40e522cdc68b750670711e4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 12 Apr 2006 22:08:05 +0200 Subject: remove old symlinks before creating current ones This will prevent incorrect symlinks when a filesystem label is changed and the event is triggered again from sysfs. --- .gitignore | 1 + udev.h | 3 ++- udev_device.c | 18 ++++++++++++++++-- udev_node.c | 20 +++++++++++++++----- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index b9adf69fc6..499e9c4d90 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ udev udevd udevcontrol udevtrigger +udevsettle udevsend udevinfo udevmonitor diff --git a/udev.h b/udev.h index 615253a52f..94d1676c90 100644 --- a/udev.h +++ b/udev.h @@ -119,7 +119,8 @@ extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); /* udev_node.c */ extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); -extern int udev_node_add(struct udevice *udev); +extern int udev_node_add(struct udevice *udev, struct udevice *udev_old); +extern void udev_node_remove_symlinks(struct udevice *udev); extern int udev_node_remove(struct udevice *udev); /* udev_db.c */ diff --git a/udev_device.c b/udev_device.c index 84d0ab2204..b356f163a5 100644 --- a/udev_device.c +++ b/udev_device.c @@ -114,7 +114,10 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* add device node */ if (major(udev->devt) != 0 && strcmp(udev->action, "add") == 0) { + struct udevice *udev_old; + dbg("device node add '%s'", udev->dev->devpath); + udev_rules_get_name(rules, udev); if (udev->ignore_device) { info("device event will be ignored"); @@ -124,8 +127,19 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) info("device node creation supressed"); goto exit; } - /* create node, store in db */ - retval = udev_node_add(udev); + + /* read current database entry, we may want to cleanup symlinks */ + udev_old = udev_device_init(); + if (udev_old != NULL) { + if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { + info("device '%s' already known, remove possible symlinks", udev->dev->devpath); + udev_node_remove_symlinks(udev_old); + } + udev_device_cleanup(udev_old); + } + + /* create node and symlinks, store record in database */ + retval = udev_node_add(udev, udev_old); if (retval == 0) udev_db_add_device(udev); goto exit; diff --git a/udev_node.c b/udev_node.c index 9d6e89cfa1..d2889a329e 100644 --- a/udev_node.c +++ b/udev_node.c @@ -90,7 +90,7 @@ exit: return retval; } -int udev_node_add(struct udevice *udev) +int udev_node_add(struct udevice *udev, struct udevice *udev_old) { char filename[PATH_SIZE]; struct name_entry *name_loop; @@ -226,15 +226,12 @@ exit: return retval; } -int udev_node_remove(struct udevice *udev) +void udev_node_remove_symlinks(struct udevice *udev) { char filename[PATH_SIZE]; - char partitionname[PATH_SIZE]; struct name_entry *name_loop; struct stat stats; int retval; - int i; - int num; if (!list_empty(&udev->symlink_list)) { char symlinks[512] = ""; @@ -266,6 +263,17 @@ int udev_node_remove(struct udevice *udev) if (symlinks[0] != '\0') setenv("DEVLINKS", symlinks, 1); } +} + +int udev_node_remove(struct udevice *udev) +{ + char filename[PATH_SIZE]; + char partitionname[PATH_SIZE]; + struct stat stats; + int retval; + int num; + + udev_node_remove_symlinks(udev); snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); filename[sizeof(filename)-1] = '\0'; @@ -288,6 +296,8 @@ int udev_node_remove(struct udevice *udev) num = udev->partitions; if (num > 0) { + int i; + info("removing all_partitions '%s[1-%i]'", filename, num); if (num > 255) { info("garbage from udev database, skip all_partitions removal"); -- cgit v1.2.3-54-g00ecf From 0c4a805bccbc52e48f972a87f83007fdb0ffe19e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Apr 2006 09:44:07 +0200 Subject: path_id: fix loop for SAS devices --- extras/path_id/path_id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 0274be391a..3f8efd63ac 100755 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -244,7 +244,7 @@ handle_sas () { return fi sas_phy_address="$phy_address:$phy_port:$phy_id" - sas_rphy_dev="${sas_host_path}/${sas_phy_id}/${sas_rphy_id}/sas_rphy:${sas_rphy_id}" + sas_rphy_dev="${sas_host_path}/${sas_phy_path}/sas_rphy:${sas_rphy_id}" if [ -e "$sas_rphy_dev/sas_address" ]; then read rphy_address < $sas_rphy_dev/sas_address read rphy_id < $sas_rphy_dev/phy_identifier -- cgit v1.2.3-54-g00ecf From 7ba2d2e6ae70964b68056283fcea209cb4b617ec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 15 Apr 2006 19:32:05 +0200 Subject: apply format char to variables exported by ENV --- udev.h | 4 ++-- udev_node.c | 1 - udev_rules.c | 9 ++++++--- udev_utils.c | 24 ++++++++++-------------- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/udev.h b/udev.h index 94d1676c90..79942e71cd 100644 --- a/udev.h +++ b/udev.h @@ -136,8 +136,8 @@ struct name_entry { char name[PATH_SIZE]; }; extern int log_priority(const char *priority); -extern int name_list_add(struct list_head *name_list, const char *name, int sort); -extern int name_list_key_add(struct list_head *name_list, const char *key, const char *value); +extern char *name_list_add(struct list_head *name_list, const char *name, int sort); +extern char *name_list_key_add(struct list_head *name_list, const char *key, const char *value); extern void name_list_cleanup(struct list_head *name_list); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); diff --git a/udev_node.c b/udev_node.c index d2889a329e..86fdcd3a41 100644 --- a/udev_node.c +++ b/udev_node.c @@ -231,7 +231,6 @@ void udev_node_remove_symlinks(struct udevice *udev) char filename[PATH_SIZE]; struct name_entry *name_loop; struct stat stats; - int retval; if (!list_empty(&udev->symlink_list)) { char symlinks[512] = ""; diff --git a/udev_rules.c b/udev_rules.c index 623ca46858..5b1e6889ec 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -903,10 +903,13 @@ try_parent: if (pair->key.operation == KEY_OP_ASSIGN) { const char *key_name = key_pair_name(rule, pair); const char *value = key_val(rule, &pair->key); + char *key_value = name_list_key_add(&udev->env_list, key_name, value); + if (key_value == NULL) + break; - name_list_key_add(&udev->env_list, key_name, value); - setenv(key_name, value, 1); - dbg("export ENV '%s=%s'", key_name, value); + udev_rules_apply_format(udev, key_value, NAME_SIZE); + putenv(key_value); + dbg("export ENV '%s'", key_value); } } diff --git a/udev_utils.c b/udev_utils.c index a37c4dfe74..003d7bded9 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -53,7 +53,7 @@ int log_priority(const char *priority) return 0; } -int name_list_add(struct list_head *name_list, const char *name, int sort) +char *name_list_add(struct list_head *name_list, const char *name, int sort) { struct name_entry *loop_name; struct name_entry *new_name; @@ -62,7 +62,7 @@ int name_list_add(struct list_head *name_list, const char *name, int sort) /* avoid doubles */ if (strcmp(loop_name->name, name) == 0) { dbg("'%s' is already in the list", name); - return 0; + return loop_name->name; } } @@ -73,19 +73,17 @@ int name_list_add(struct list_head *name_list, const char *name, int sort) } new_name = malloc(sizeof(struct name_entry)); - if (new_name == NULL) { - dbg("error malloc"); - return -ENOMEM; - } + if (new_name == NULL) + return NULL; strlcpy(new_name->name, name, sizeof(new_name->name)); dbg("adding '%s'", new_name->name); list_add_tail(&new_name->node, &loop_name->node); - return 0; + return new_name->name; } -int name_list_key_add(struct list_head *name_list, const char *key, const char *value) +char *name_list_key_add(struct list_head *name_list, const char *key, const char *value) { struct name_entry *loop_name; struct name_entry *new_name; @@ -95,22 +93,20 @@ int name_list_key_add(struct list_head *name_list, const char *key, const char * dbg("key already present '%s', replace it", loop_name->name); snprintf(loop_name->name, sizeof(loop_name->name), "%s=%s", key, value); loop_name->name[sizeof(loop_name->name)-1] = '\0'; - return 0; + return loop_name->name; } } new_name = malloc(sizeof(struct name_entry)); - if (new_name == NULL) { - dbg("error malloc"); - return -ENOMEM; - } + if (new_name == NULL) + return NULL; snprintf(new_name->name, sizeof(new_name->name), "%s=%s", key, value); new_name->name[sizeof(new_name->name)-1] = '\0'; dbg("adding '%s'", new_name->name); list_add_tail(&new_name->node, &loop_name->node); - return 0; + return new_name->name; } void name_list_cleanup(struct list_head *name_list) -- cgit v1.2.3-54-g00ecf From 876fa61d68140f4fc9da9b98a22823587b495e80 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 15 Apr 2006 19:32:38 +0200 Subject: 090 release --- ChangeLog | 24 ++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 7 +++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 24c0ad3f83..97f8a01061 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +Summary of changes from v089 to v090 +============================================ + +Kay Sievers: + udevd: export current seqnum and add udevsettle + volume_id: fix endianess conversion typo for FAT32 + merge device event handling and make database content available on "remove" + set default udevsettle timeout to 3 minutes + export INTERFACE_OLD if we renamed a netif + let udevmonitor show the possibly renamed devpath + volume_id: move some debug to info level + udevtrigger: fix event order + usb_id: remove uneeded code + remove old symlinks before creating current ones + path_id: fix loop for SAS devices + apply format char to variables exported by ENV + +Marco d'Itri: + add inotify support for hppa and MIPS and log if inotify is not available + +Matt Kraai: + fix typo in error message + + Summary of changes from v088 to v089 ============================================ diff --git a/Makefile b/Makefile index 42c2bf23dc..762c3b771b 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 089 +VERSION = 090 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7c81c9a831..65e3739fa4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,10 @@ +udev 090 +======== +Provide "udevsettle" to wait for all current udev events to finish. +It also watches the current kernel netlink queue by comparing the +even sequence number to make sure that there are no current pending +events that have not already arrived in the daemon. + udev 089 ======== Fix rule to skip persistent rules for removable IDE devices, which -- cgit v1.2.3-54-g00ecf From c6d4aeb930ae2da6114e551dadbed3e430b9cdf4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 15 Apr 2006 19:49:15 +0200 Subject: udevtest: don't try to delete symlinks --- udev_node.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udev_node.c b/udev_node.c index 86fdcd3a41..2a30fe3222 100644 --- a/udev_node.c +++ b/udev_node.c @@ -249,10 +249,12 @@ void udev_node_remove_symlinks(struct udevice *udev) } info("removing symlink '%s'", filename); - unlink(filename); + if (!udev->test_run) { + unlink(filename); - if (strchr(filename, '/')) - delete_path(filename); + if (strchr(filename, '/')) + delete_path(filename); + } strlcat(symlinks, filename, sizeof(symlinks)); strlcat(symlinks, " ", sizeof(symlinks)); -- cgit v1.2.3-54-g00ecf From b12a1fb1c6073c0679e80f515fe97cb21fa88e65 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Fri, 21 Apr 2006 20:02:58 +0200 Subject: path_id: fix SAS device path generation --- extras/path_id/path_id | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100755 => 100644 extras/path_id/path_id diff --git a/extras/path_id/path_id b/extras/path_id/path_id old mode 100755 new mode 100644 index 3f8efd63ac..7f0d53a180 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -232,7 +232,7 @@ handle_sas () { sas_phy_path="${sas_phy_path%%/target*}" sas_phy_id="${sas_phy_path%%/*}" sas_rphy_id="${sas_phy_path##*/}" - sas_phy_dev="${sas_host_path}/${sas_phy_id}/sas_phy:${sas_phy_id}" + sas_phy_dev="/sys/class/sas_phy/${sas_phy_id}" if [ -e "$sas_phy_dev/sas_address" ]; then read phy_address < $sas_phy_dev/sas_address read phy_port < $sas_phy_dev/port_identifier @@ -244,7 +244,7 @@ handle_sas () { return fi sas_phy_address="$phy_address:$phy_port:$phy_id" - sas_rphy_dev="${sas_host_path}/${sas_phy_path}/sas_rphy:${sas_rphy_id}" + sas_rphy_dev="/sys/class/sas_device/${sas_rphy_id}" if [ -e "$sas_rphy_dev/sas_address" ]; then read rphy_address < $sas_rphy_dev/sas_address read rphy_id < $sas_rphy_dev/phy_identifier -- cgit v1.2.3-54-g00ecf From a805ead1046db16902f5f228ed63666d9950c061 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 22 Apr 2006 17:28:50 +0200 Subject: persistent rules: fix typo in dm rule --- etc/udev/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules index 340fc9c8d4..099d09477e 100644 --- a/etc/udev/60-persistent-storage.rules +++ b/etc/udev/60-persistent-storage.rules @@ -45,6 +45,6 @@ KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From d59c84effdc50961bdbe01dcc41d71c8609e6700 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 24 Apr 2006 19:25:55 +0200 Subject: allow NAME=="value" to check for already assigned value --- test/udev-test.pl | 49 +++++++++++++++++++++++++++++++++++++++++++------ udev_rules.c | 37 +++++++++++++++++++++---------------- udev_rules_parse.c | 51 ++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 106 insertions(+), 31 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index b44bd18af5..33da68a386 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -387,7 +387,7 @@ EOF devpath => "/block/sda/sda3", exp_name => "Major:8-minor:3-kernelnumber:3-id:0:0:0:0", rules => < "/block/sda/sda3", exp_name => "830:0:0:03" , rules => < "/block/sda/sda3", exp_name => "833" , rules => < "/block/sda/sda3", exp_name => "8330:0:0:0" , rules => < "/block/sda/sda1", exp_name => "part", rules => < "NAME compare test", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "link", + exp_target => "node", + not_exp_name => "wronglink", + rules => < "NAME compare test 2", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "link2", + exp_target => "sda1", + not_exp_name => "link", + rules => < "invalid key operation", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "yes", + rules => <operation == KEY_OP_UNSET) + if (key->operation != KEY_OP_MATCH && + key->operation != KEY_OP_NOMATCH) return 0; strlcpy(value, rule->buf + key->val_off, sizeof(value)); @@ -726,6 +727,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (match_key("DEVPATH", rule, &rule->devpath, udev->dev->devpath)) goto nomatch; + /* compare NAME against a previously assigned value */ + if (match_key("NAME", rule, &rule->name, udev->name)) + goto nomatch; + if (rule->modalias.operation != KEY_OP_UNSET) { const char *value; static int warn = 1; @@ -748,7 +753,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) struct key_pair *pair = &rule->env.keys[i]; /* we only check for matches, assignments will be handled later */ - if (pair->key.operation != KEY_OP_ASSIGN) { + if (pair->key.operation == KEY_OP_MATCH || + pair->key.operation == KEY_OP_NOMATCH) { const char *key_name = key_pair_name(rule, pair); const char *value = getenv(key_name); @@ -775,22 +781,16 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) udev->dev_parent = udev->dev; while (1) { /* check for matching driver */ - if (rule->driver.operation != KEY_OP_UNSET) { - if (match_key("DRIVER", rule, &rule->driver, udev->dev_parent->driver)) - goto try_parent; - } + if (match_key("DRIVER", rule, &rule->driver, udev->dev_parent->driver)) + goto try_parent; /* check for matching subsystem/bus value */ - if (rule->bus.operation != KEY_OP_UNSET) { - if (match_key("BUS", rule, &rule->bus, udev->dev_parent->subsystem)) - goto try_parent; - } + if (match_key("BUS", rule, &rule->bus, udev->dev_parent->subsystem)) + goto try_parent; /* check for matching bus id (device name) */ - if (rule->id.operation != KEY_OP_UNSET) { - if (match_key("ID", rule, &rule->id, udev->dev_parent->kernel_name)) - goto try_parent; - } + if (match_key("ID", rule, &rule->id, udev->dev_parent->kernel_name)) + goto try_parent; /* check for matching sysfs pairs */ if (rule->sysfs.count) { @@ -934,7 +934,10 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (rule == NULL) break; - if (name_set && rule->name.operation != KEY_OP_UNSET) { + if (name_set && + (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD)) { dbg("node name already set, rule ignored"); continue; } @@ -1020,7 +1023,9 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) } /* set name, later rules with name set will be ignored */ - if (rule->name.operation != KEY_OP_UNSET) { + if (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD) { int count; name_set = 1; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 6bb83ae12b..442ec65390 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -235,7 +235,7 @@ static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs, return 0; } -static int add_to_rules(struct udev_rules *rules, char *line) +static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) { struct udev_rule *rule; size_t rule_size; @@ -276,36 +276,66 @@ static int add_to_rules(struct udev_rules *rules, char *line) } if (strcasecmp(key, "KERNEL") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid KERNEL operation"); + goto invalid; + } add_rule_key(rule, &rule->kernel_name, operation, value); valid = 1; continue; } if (strcasecmp(key, "SUBSYSTEM") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid SUBSYSTEM operation"); + goto invalid; + } add_rule_key(rule, &rule->subsystem, operation, value); valid = 1; continue; } if (strcasecmp(key, "ACTION") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid ACTION operation"); + goto invalid; + } add_rule_key(rule, &rule->action, operation, value); valid = 1; continue; } if (strcasecmp(key, "DEVPATH") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid DEVPATH operation"); + goto invalid; + } add_rule_key(rule, &rule->devpath, operation, value); valid = 1; continue; } if (strcasecmp(key, "BUS") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid BUS operation"); + goto invalid; + } add_rule_key(rule, &rule->bus, operation, value); valid = 1; continue; } if (strcasecmp(key, "ID") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid ID operation"); + goto invalid; + } add_rule_key(rule, &rule->id, operation, value); valid = 1; continue; @@ -504,14 +534,12 @@ static int add_to_rules(struct udev_rules *rules, char *line) continue; } - err("unknown key '%s', in '%s'", key, line); + err("unknown key '%s'", key); } /* skip line if not any valid key was found */ - if (!valid) { - err("invalid rule '%s'", line); - goto exit; - } + if (!valid) + goto invalid; /* grow buffer and add rule */ rule_size = sizeof(struct udev_rule) + rule->bufsize; @@ -531,13 +559,18 @@ static int add_to_rules(struct udev_rules *rules, char *line) exit: free(rule); return 0; + +invalid: + free(rule); + err("invalid rule '%s:%u'", filename, lineno); + return -1; } static int parse_file(struct udev_rules *rules, const char *filename) { char line[LINE_SIZE]; char *bufline; - int lineno; + unsigned int lineno; char *buf; size_t bufsize; size_t cur; @@ -562,7 +595,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) lineno++; if (count >= sizeof(line)) { - info("line too long, rule skipped %s, line %d", filename, lineno); + err("line too long, rule skipped '%s:%u'", filename, lineno); continue; } @@ -588,7 +621,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) line[j] = '\0'; dbg("read '%s'", line); - add_to_rules(rules, line); + add_to_rules(rules, line, filename, lineno); } file_unmap(buf, bufsize); -- cgit v1.2.3-54-g00ecf From 90cd961e2cb660b6c3ed9c9a33e8878f8aaa163c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Apr 2006 18:50:56 +0200 Subject: udevd: export initial sequence number on startup --- udevd.c | 47 ++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/udevd.c b/udevd.c index b0c38eb413..eb1080b190 100644 --- a/udevd.c +++ b/udevd.c @@ -250,7 +250,7 @@ static void udev_event_run(struct uevent_msg *msg) /* child */ close(uevent_netlink_sock); close(udevd_sock); - if (inotify_fd > 0) + if (inotify_fd >= 0) close(inotify_fd); close(signal_pipe[READ_END]); close(signal_pipe[WRITE_END]); @@ -287,7 +287,7 @@ static void msg_queue_insert(struct uevent_msg *msg) strlcpy(filename, udev_root, sizeof(filename)); strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd > 0) { + if (fd >= 0) { char str[32]; int len; @@ -821,6 +821,33 @@ static int init_uevent_netlink_sock(void) return 0; } +static void export_initial_seqnum(void) +{ + char filename[PATH_SIZE]; + int fd; + char seqnum[32]; + ssize_t len = 0; + + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd >= 0) { + len = read(fd, seqnum, sizeof(seqnum)-1); + close(fd); + } + if (len <= 0) { + strcpy(seqnum, "0\n"); + len = 3; + } + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); + if (fd >= 0) { + write(fd, seqnum, len); + close(fd); + } +} + int main(int argc, char *argv[], char *envp[]) { int retval; @@ -893,6 +920,8 @@ int main(int argc, char *argv[], char *envp[]) sysfs_init(); udev_rules_init(&rules, 1); + export_initial_seqnum(); + if (daemonize) { pid_t pid; @@ -1014,7 +1043,7 @@ int main(int argc, char *argv[], char *envp[]) FD_SET(signal_pipe[READ_END], &readfds); FD_SET(udevd_sock, &readfds); FD_SET(uevent_netlink_sock, &readfds); - if (inotify_fd > 0) + if (inotify_fd >= 0) FD_SET(inotify_fd, &readfds); fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); @@ -1046,7 +1075,7 @@ int main(int argc, char *argv[], char *envp[]) } /* rules directory inotify watch */ - if ((inotify_fd > 0) && FD_ISSET(inotify_fd, &readfds)) { + if ((inotify_fd >= 0) && FD_ISSET(inotify_fd, &readfds)) { int nbytes; /* discard all possible events, we can just reload the config */ @@ -1089,16 +1118,16 @@ exit: udev_rules_cleanup(&rules); sysfs_cleanup(); - if (signal_pipe[READ_END] > 0) + if (signal_pipe[READ_END] >= 0) close(signal_pipe[READ_END]); - if (signal_pipe[WRITE_END] > 0) + if (signal_pipe[WRITE_END] >= 0) close(signal_pipe[WRITE_END]); - if (udevd_sock > 0) + if (udevd_sock >= 0) close(udevd_sock); - if (inotify_fd > 0) + if (inotify_fd >= 0) close(inotify_fd); - if (uevent_netlink_sock > 0) + if (uevent_netlink_sock >= 0) close(uevent_netlink_sock); logging_close(); -- cgit v1.2.3-54-g00ecf From cdb5ecb8cf77f2a831022d14b1dcdaae2432c862 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Apr 2006 22:31:09 +0200 Subject: update SUSE rules --- etc/udev/suse/40-alsa.rules | 5 +++-- etc/udev/suse/50-udev-default.rules | 8 +++++--- etc/udev/suse/60-persistent-storage.rules | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/etc/udev/suse/40-alsa.rules b/etc/udev/suse/40-alsa.rules index 79888dd3be..684411efcf 100644 --- a/etc/udev/suse/40-alsa.rules +++ b/etc/udev/suse/40-alsa.rules @@ -1,5 +1,5 @@ -SUBSYSTEM="sound", GROUP="audio" -SUBSYSTEM="snd", GROUP="audio" +SUBSYSTEM=="sound", GROUP="audio" +SUBSYSTEM=="snd", GROUP="audio" KERNEL=="controlC[0-9]*", NAME="snd/%k" KERNEL=="hwC[D0-9]*", NAME="snd/%k" KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" @@ -14,3 +14,4 @@ SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startp SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" +0 \ No newline at end of file diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 22000ba3c0..920d4706fd 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -17,6 +17,7 @@ KERNEL=="hvc*", NAME="%k", GROUP="uucp" KERNEL=="hvsi*", NAME="%k", GROUP="uucp" KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" KERNEL=="ttyUSB*", SYSFS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" +KERNEL=="ttyUSB*", SYSFS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" # video/graphics SUBSYSTEM=="video4linux", GROUP="video" @@ -112,8 +113,8 @@ SUBSYSTEM=="block", GROUP="disk", MODE="0640" # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC # sr: 4 TYPE_WORM, 5 TYPE_ROM # st/osst: 1 TYPE_TAPE -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" +ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" +ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", RUN+="/sbin/modprobe st" @@ -140,7 +141,8 @@ KERNEL=="pt*", NAME="%k", GROUP="disk" KERNEL=="npt*", NAME="%k", GROUP="disk" KERNEL=="pg*", NAME="%k", GROUP="disk" KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" -KERNEL=="rawctl*", NAME="%k", GROUP="disk" +KERNEL=="rawctl*", NAME="raw/%k", GROUP="disk" +KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="osst*", NAME="%k", GROUP="disk" KERNEL=="nosst*", NAME="%k", GROUP="disk" KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index 5f4e6b5f35..bba529aab7 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -45,6 +45,6 @@ KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK="disk/by-name/%c" +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From 866bfe8817dee748be419321201f70751eb663ca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Apr 2006 22:39:59 +0200 Subject: 091 release --- ChangeLog | 13 +++++++++++++ Makefile | 2 +- RELEASE-NOTES | 8 ++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 97f8a01061..2c16ddf2d2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Summary of changes from v090 to v091 +============================================ + +Hannes Reinecke: + path_id: fix SAS device path generation + +Kay Sievers: + udevtest: don't try to delete symlinks + persistent rules: fix typo in dm rule + allow NAME=="value" to check for already assigned value + udevd: export initial sequence number on startup + + Summary of changes from v089 to v090 ============================================ diff --git a/Makefile b/Makefile index 762c3b771b..c04742507a 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 090 +VERSION = 091 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 65e3739fa4..da6af382c9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,11 @@ +udev 091 +======== +Some more keys require the correct use of '==' and '=' depending +on the kind of operation beeing an assignment or a match. Rules +with invalid operations are skipped and logged to syslog. Please +test with udevtest if the parsing of your rules throws errors and +fix possibly broken rules. + udev 090 ======== Provide "udevsettle" to wait for all current udev events to finish. -- cgit v1.2.3-54-g00ecf From 5fc32819ecb0c05fd8f67a2dfeff2454057982f8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 Apr 2006 00:32:32 +0200 Subject: don't include stropts.h, some libc's don't like it --- udev_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev_device.c b/udev_device.c index b356f163a5..6dc843ed22 100644 --- a/udev_device.c +++ b/udev_device.c @@ -26,7 +26,8 @@ #include #include #include -#include +#include +#include #include #include -- cgit v1.2.3-54-g00ecf From 0e385feecc252b8803b5c4bf2dc501ab486d86f7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 Apr 2006 00:34:05 +0200 Subject: udevd: create leading directories for /dev/.udev/uevent_seqnum --- udevd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevd.c b/udevd.c index eb1080b190..705e2a9780 100644 --- a/udevd.c +++ b/udevd.c @@ -841,6 +841,7 @@ static void export_initial_seqnum(void) } strlcpy(filename, udev_root, sizeof(filename)); strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + create_path(filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { write(fd, seqnum, len); -- cgit v1.2.3-54-g00ecf From 3d6d12c6b17e6ea84112bd3a7aac19d8b614fc1c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 Apr 2006 17:52:09 +0200 Subject: vol_id: fix logging from libvolume_id's log function --- extras/volume_id/lib/volume_id.c | 7 ++++++- extras/volume_id/vol_id.c | 5 ++++- udev_rules.c | 9 ++++----- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 9f8e39b518..33fd890dfd 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include @@ -42,6 +41,9 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; + info("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + /* probe for raid first, because fs probes may be successful on raid members */ if (size) { if (volume_id_probe_linux_raid(id, off, size) == 0) @@ -91,6 +93,9 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (id == NULL) return -EINVAL; + info("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + if (volume_id_probe_luks(id, off) == 0) goto found; diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 2274550c19..dcf56d87e9 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -63,10 +63,13 @@ void log_message(int priority, const char *format, ...) static void vid_log(int priority, const char *file, int line, const char *format, ...) { #ifdef USE_LOG + char log_str[1024]; va_list args; va_start(args, format); - log_message(priority, format, args); + vsnprintf(log_str, sizeof(log_str), format, args); + log_str[sizeof(log_str)-1] = '\0'; + log_message(priority, "%s:%i %s", file, line, log_str); va_end(args); #endif return; diff --git a/udev_rules.c b/udev_rules.c index 596bcd188b..ee4632513a 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -2,17 +2,17 @@ * udev_rules.c * * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2005 Kay Sievers + * Copyright (C) 2003-2006 Kay Sievers * * 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 02139, USA. @@ -451,8 +451,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) goto found; } } - } - else if (head[0] == '%') { + } else if (head[0] == '%') { /* substitute format char */ if (head[1] == '\0') break; -- cgit v1.2.3-54-g00ecf From 51f22c569636e16ae9801ea26f74b891259c1e72 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 Apr 2006 02:06:15 +0200 Subject: update SUSE rules --- etc/udev/suse/40-alsa.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/udev/suse/40-alsa.rules b/etc/udev/suse/40-alsa.rules index 684411efcf..87097a49e0 100644 --- a/etc/udev/suse/40-alsa.rules +++ b/etc/udev/suse/40-alsa.rules @@ -14,4 +14,3 @@ SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startp SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" -0 \ No newline at end of file -- cgit v1.2.3-54-g00ecf From a5df2c57326c9ed2ec35a5965cf82d4dfeed598d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 May 2006 01:44:59 +0200 Subject: update SUSE rules --- etc/udev/suse/60-persistent-input.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/suse/60-persistent-input.rules b/etc/udev/suse/60-persistent-input.rules index 2f9c5d3cfc..fffbf572de 100644 --- a/etc/udev/suse/60-persistent-input.rules +++ b/etc/udev/suse/60-persistent-input.rules @@ -4,8 +4,8 @@ KERNEL=="input[0-9]*", GOTO="persistent_input_end" # usb devices BUS=="usb", IMPORT{program}="/sbin/usb_id -x" -BUS=="usb", SYSFS{bInterfaceClass}="03", SYSFS{bInterfaceProtocol}="01", ENV{ID_CLASS}="kbd" -BUS=="usb", SYSFS{bInterfaceClass}="03", SYSFS{bInterfaceProtocol}="02", ENV{ID_CLASS}="mouse" +BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" +BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" # by-id links KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -- cgit v1.2.3-54-g00ecf From b1c4f377c4989e0d881778b5a61f0d08b05c0a24 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 May 2006 01:45:26 +0200 Subject: add more warnings for invalid key operations --- udev_rules_parse.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 442ec65390..91cc9744fb 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -342,6 +342,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid SYSFS operation"); + goto invalid; + } attr = get_key_attribute(key + sizeof("SYSFS")-1); if (attr == NULL) { err("error parsing SYSFS attribute in '%s'", line); @@ -421,12 +426,22 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strcasecmp(key, "DRIVER") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid DRIVER operation"); + goto invalid; + } add_rule_key(rule, &rule->driver, operation, value); valid = 1; continue; } if (strcasecmp(key, "RESULT") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid RESULT operation"); + goto invalid; + } add_rule_key(rule, &rule->result, operation, value); valid = 1; continue; -- cgit v1.2.3-54-g00ecf From 5263fb3464fdb43b1ca0eb6e7b71eb4ff91c6a17 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 1 May 2006 03:32:30 +0200 Subject: update Debian rules --- etc/udev/debian/permissions.rules | 2 ++ etc/udev/debian/persistent-input.rules | 4 ++-- etc/udev/debian/persistent.rules | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index b010353a22..8da35c3090 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -5,6 +5,8 @@ DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" # only needed for kernels < 2.6.16 SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" +# only needed for kernels < 2.6.17 +SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" # default permissions for block devices SUBSYSTEM=="block", GROUP="disk" diff --git a/etc/udev/debian/persistent-input.rules b/etc/udev/debian/persistent-input.rules index 95021b1646..339a365048 100644 --- a/etc/udev/debian/persistent-input.rules +++ b/etc/udev/debian/persistent-input.rules @@ -5,9 +5,9 @@ KERNEL=="input[0-9]*", GOTO="persistent_input_end" # usb devices BUS=="usb", IMPORT{program}="usb_id -x" -BUS=="usb", SYSFS{bInterfaceClass}="03", SYSFS{bInterfaceProtocol}="01", \ +BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", \ ENV{ID_CLASS}="kbd" -BUS=="usb", SYSFS{bInterfaceClass}="03", SYSFS{bInterfaceProtocol}="02", \ +BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", \ ENV{ID_CLASS}="mouse" # by-id links, generic and for the event devices diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index 7fc86246f3..9f1887ddea 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -33,8 +33,7 @@ KERNEL=="*[!0-9]", \ IMPORT{program}="edd_id --export $tempnode" # find the physical path of the device -KERNEL=="*[!0-9]|sr*|st*", ENV{ID_TYPE}=="?*", \ - IMPORT{program}="path_id $devpath" +KERNEL=="*[!0-9]|sr*|st*", IMPORT{program}="path_id $devpath" # import the variables of partitions from the parent disks KERNEL=="*[0-9]", IMPORT{parent}="ID_*" -- cgit v1.2.3-54-g00ecf From 9571122e00f54b5d6e5accda4c431ac6ae5c4847 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 May 2006 20:36:21 +0200 Subject: fix offsetof() build issue with recent glibc --- udevcontrol.c | 9 ++++----- udevmonitor.c | 1 + udevsend.c | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/udevcontrol.c b/udevcontrol.c index 6d91adc1c4..8add09e031 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -18,10 +18,6 @@ * */ -#include -#include -#include -#include #include #include #include @@ -29,7 +25,10 @@ #include #include #include -#include +#include +#include +#include +#include #include "udev.h" #include "udevd.h" diff --git a/udevmonitor.c b/udevmonitor.c index 80c49753f5..fb1f42cc01 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/udevsend.c b/udevsend.c index 1b9860baca..9f5059a4c8 100644 --- a/udevsend.c +++ b/udevsend.c @@ -30,7 +30,6 @@ #include #include #include -#include #include "udev.h" #include "udevd.h" -- cgit v1.2.3-54-g00ecf From c7a42aea3c1a81f7325104871aad6bb6b0a15834 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 May 2006 22:31:06 +0200 Subject: selinux: fix typo in block device node selection --- udev_selinux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_selinux.c b/udev_selinux.c index 94c213d297..446fedc3c3 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -54,7 +54,7 @@ static char *get_media(const char *devname, int mode) int size; char *media = NULL; - if (!(mode && S_IFBLK)) + if (!(mode & S_IFBLK)) return NULL; snprintf(procfile, PATH_MAX, "/proc/ide/%s/media", devname); -- cgit v1.2.3-54-g00ecf From 674e00f67c5dc4bd6e7c5aff21c11b36eb81cd75 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 May 2006 08:46:07 +0200 Subject: vol_id: add NetWare volume detection --- extras/volume_id/lib/Makefile | 1 + extras/volume_id/lib/exported_symbols | 1 + extras/volume_id/lib/libvolume_id.h | 1 + extras/volume_id/lib/netware.c | 63 +++++++++++++++++++++++++++++++++++ extras/volume_id/lib/volume_id.c | 3 ++ 5 files changed, 69 insertions(+) create mode 100644 extras/volume_id/lib/netware.c diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 03c9315f9a..e3c3f5dab5 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -47,6 +47,7 @@ OBJS= \ ocfs.o \ vxfs.o \ squashfs.o \ + netware.o \ volume_id.o \ util.o diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index b1ff3cce3a..df5f9f05c9 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -26,6 +26,7 @@ volume_id_probe_vxfs; volume_id_probe_xfs; volume_id_probe_squashfs; + volume_id_probe_netware; volume_id_probe_linux_raid; volume_id_probe_lvm1; diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index 06b1baa9d0..d6c5536274 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -88,6 +88,7 @@ extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_netware(struct volume_id *id, uint64_t off); /* special formats */ extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c new file mode 100644 index 0000000000..49afe21fc4 --- /dev/null +++ b/extras/volume_id/lib/netware.c @@ -0,0 +1,63 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2006 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +#define NW_SUPERBLOCK_OFFSET 0x1000 + +struct netware_super_block { + uint8_t SBH_Signature[4]; + uint16_t SBH_VersionMajor; + uint16_t SBH_VersionMinor; + uint16_t SBH_VersionMediaMajor; + uint16_t SBH_VersionMediaMinor; + uint32_t SBH_ItemsMoved; + uint8_t SBH_InternalID[16]; +} PACKED; + +int volume_id_probe_netware(struct volume_id *id, uint64_t off) +{ + struct netware_super_block *nw; + + info("probing at offset 0x%llx", (unsigned long long) off); + + nw = (struct netware_super_block *) volume_id_get_buffer(id, off + NW_SUPERBLOCK_OFFSET, 0x200); + if (nw == NULL) + return -1; + + if (memcmp(nw->SBH_Signature, "SPB5", 4) != 0) + return -1; + + volume_id_set_uuid(id, nw->SBH_InternalID, UUID_DCE); + + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%02u", + le16_to_cpu(nw->SBH_VersionMediaMajor), le16_to_cpu(nw->SBH_VersionMediaMinor)); + + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "nss"; + + return 0; +} diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 33fd890dfd..472ea24611 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -163,6 +163,9 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (volume_id_probe_squashfs(id, off) == 0) goto found; + if (volume_id_probe_netware(id, off) == 0) + goto found; + return -1; found: -- cgit v1.2.3-54-g00ecf From 5ac7a25e85729cdac995fd28de48c55487be31c9 Mon Sep 17 00:00:00 2001 From: Libor Klepac Date: Tue, 9 May 2006 18:23:20 +0200 Subject: path_id: add platform and serio support --- extras/path_id/path_id | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 7f0d53a180..913c4909f7 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -96,6 +96,56 @@ handle_pci () { RESULT=0 } +handle_platform () { + local DEV=$1 + cd -P $1 + DEV=${PWD} + platform_id=${DEV##*/} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */platform*) + host_dev_path=${host_dev_path%/*} + ;; + *) + break + ;; + esac + done + if [ "$d" ]; then + d="platform-$platform_id-$d" + else + d="platform-$platform_id" + fi + D="$host_dev_path" + RESULT=0 +} + +handle_serio () { + local DEV=$1 + cd -P $1 + DEV=${PWD} + serio_id=${DEV##*/serio} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */serio*) + host_dev_path=${host_dev_path%/*} + ;; + *) + break + ;; + esac + done + if [ "$d" ]; then + d="serio-$serio_id-$d" + else + d="serio-$serio_id" + fi + D="$host_dev_path" + RESULT=0 +} + handle_ide () { : handle_ide $* local DEV=$1 @@ -372,6 +422,12 @@ handle_device () { */pci[0-9]*:[0-9]*) handle_pci "$D" ;; + */serio[0-9]*) + handle_serio "$D" + ;; + */platform/*) + handle_platform "$D" + ;; */devices) D= ;; -- cgit v1.2.3-54-g00ecf From d7fea966f196e2eb5cd87b5e738bd4f39878c548 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 9 May 2006 18:24:43 +0200 Subject: path_id: fix bashism --- extras/path_id/path_id | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 913c4909f7..4941b88a45 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -356,7 +356,7 @@ handle_device () { subsys="`pwd -P`" cd "$OPWD" subsys="${subsys##*/}" - if [ "$subsys" == "block" ]; then + if [ "$subsys" = "block" ]; then # parent is "block", it's a partition, move one up full_sysfs_path="${full_sysfs_path%/*}" fi @@ -438,7 +438,7 @@ handle_device () { ;; esac done - if [ "$TYPE" == "scsi_tape" ] ; then + if [ "$TYPE" = "scsi_tape" ] ; then devname=${full_sysfs_path##*/} rewind="${devname%%st*}" mode="${devname##*st}" -- cgit v1.2.3-54-g00ecf From 7331443248f516345551661faa16305e2963e3b7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 May 2006 17:11:00 +0200 Subject: edd_id: fix "(null)" output if "mbr_signature" does not exist --- extras/edd_id/edd_id.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 8fc690a49c..4ba89ede89 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) int sysfs_fd; DIR *dir = NULL; int rc = 1; - char *match = NULL; + char match[NAME_MAX] = ""; logging_init("edd_id"); @@ -74,7 +74,7 @@ int main(int argc, char *argv[]) } else node = arg; } - if (!node) { + if (node == NULL) { err("no node specified"); fprintf(stderr, "no node specified\n"); goto exit; @@ -82,7 +82,7 @@ int main(int argc, char *argv[]) /* check for kernel support */ dir = opendir("/sys/firmware/edd"); - if (!dir) { + if (dir == NULL) { info("no kernel EDD support"); fprintf(stderr, "no kernel EDD support\n"); rc = 2; @@ -156,32 +156,36 @@ int main(int argc, char *argv[]) size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); close(sysfs_fd); - if (size < 0) { + if (size <= 0) { info("read sysfs '%s' failed", file); continue; } sysfs_id_buf[size] = '\0'; info("read '%s' from '%s'", sysfs_id_buf, file); - sysfs_id = strtoul(sysfs_id_buf, NULL, 16); + + /* look for matching value, that appears only once */ if (disk_id == sysfs_id) { - if (!match) { - match = dent->d_name; + if (match[0] == '\0') { + /* store id */ + strlcpy(match, dent->d_name, sizeof(match)); } else { + /* error, same signature for another device */ info("'%s' does not have a unique signature", node); fprintf(stderr, "'%s' does not have a unique signature\n", node); - rc=10; + rc = 10; goto exit; } } - } - if (export) - printf("ID_EDD=%s\n", match); - else - printf("%s\n", match); - rc = 0; + if (match[0] != '\0') { + if (export) + printf("ID_EDD=%s\n", match); + else + printf("%s\n", match); + rc = 0; + } close: close(disk_fd); -- cgit v1.2.3-54-g00ecf From ce1df104be4cfcb5a5242b073069126a8cdb4066 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 May 2006 17:23:41 +0200 Subject: update Fedora rules --- etc/udev/redhat/50-udev.rules | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index 89a3f02bac..04541a55f0 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -40,8 +40,9 @@ KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="hvc*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="hvsi*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot" -KERNEL=="ttyUSB*", SYSFS{product}=="palmOne Handheld*", SYMLINK+="pilot" +KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB*", SYSFS{product}=="palmOne Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB*", SYSFS{product}=="Handspring Visor*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" # vc devices KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" @@ -90,9 +91,6 @@ KERNEL=="dmfm*", MODE="0660" KERNEL=="dmmidi*", MODE="0660" KERNEL=="sndstat", MODE="0660" -# pilot/palm devices -KERNEL=="pilot", GROUP="uucp", MODE="0660" - # lp devices KERNEL=="lp*", GROUP="lp", MODE="0660" KERNEL=="parport*", GROUP="lp", MODE="0660" @@ -271,15 +269,15 @@ BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}=="1", GOTO="persistent_end" BUS=="ide", KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_end" # by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/lib/udev/dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # for partitions import parent information @@ -287,19 +285,19 @@ KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" KERNEL=="sr*", GOTO="persistent_end" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" +IMPORT{program}="/lib/udev/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", IMPORT{program}="/lib/udev/edd_id --export $tempnode" KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" @@ -309,22 +307,22 @@ LABEL="persistent_end" # Persistent block device stuff - end ##################################### + ACTION=="add", SUBSYSTEM=="usb_device", \ PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ NAME="%c", MODE="0644" ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", \ - RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC # sr: 4 TYPE_WORM, 5 TYPE_ROM # st/osst: 1 TYPE_TAPE # sg: 8 changer, [36] scanner -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="0|7|14", \ +ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="0|7|14", \ RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM="scsi" , SYSFS{type}=="1", \ +ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="1", \ RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" -- cgit v1.2.3-54-g00ecf From 172ee4205cfbcf451e00b4d82edc42c2df0eb925 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 12 May 2006 11:35:57 +0200 Subject: libvolume_id: nss - use different uuid --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/netware.c | 42 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index e3c3f5dab5..4ead34a20a 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 62 +SHLIB_REV = 63 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c index 49afe21fc4..6e1e95f86c 100644 --- a/extras/volume_id/lib/netware.c +++ b/extras/volume_id/lib/netware.c @@ -36,6 +36,46 @@ struct netware_super_block { uint16_t SBH_VersionMediaMinor; uint32_t SBH_ItemsMoved; uint8_t SBH_InternalID[16]; + uint32_t SBH_PackedSize; + uint32_t SBH_Checksum; + uint32_t supersyncid; + int64_t superlocation[4]; + uint32_t physSizeUsed; + uint32_t sizeUsed; + uint32_t superTimeStamp; + uint32_t reserved0[1]; + int64_t SBH_LoggedPoolDataBlk; + int64_t SBH_PoolDataBlk; + uint8_t SBH_OldInternalID[16]; + uint32_t SBH_PoolToLVStartUTC; + uint32_t SBH_PoolToLVEndUTC; + uint16_t SBH_VersionMediaMajorCreate; + uint16_t SBH_VersionMediaMinorCreate; + uint32_t SBH_BlocksMoved; + uint32_t SBH_TempBTSpBlk; + uint32_t SBH_TempFTSpBlk; + uint32_t SBH_TempFTSpBlk1; + uint32_t SBH_TempFTSpBlk2; + uint32_t nssMagicNumber; + uint32_t poolClassID; + uint32_t poolID; + uint32_t createTime; + int64_t SBH_LoggedVolumeDataBlk; + int64_t SBH_VolumeDataBlk; + int64_t SBH_SystemBeastBlkNum; + uint64_t totalblocks; + uint16_t SBH_Name[64]; + uint8_t SBH_VolumeID[16]; + uint8_t SBH_PoolID[16]; + uint8_t SBH_PoolInternalID[16]; + uint64_t SBH_Lsn; + uint32_t SBH_SS_Enabled; + uint32_t SBH_SS_CreateTime; + uint8_t SBH_SS_OriginalPoolID[16]; + uint8_t SBH_SS_OriginalVolumeID[16]; + uint8_t SBH_SS_Guid[16]; + uint16_t SBH_SS_OriginalName[64]; + uint32_t reserved2[64-(2+46)]; } PACKED; int volume_id_probe_netware(struct volume_id *id, uint64_t off) @@ -51,7 +91,7 @@ int volume_id_probe_netware(struct volume_id *id, uint64_t off) if (memcmp(nw->SBH_Signature, "SPB5", 4) != 0) return -1; - volume_id_set_uuid(id, nw->SBH_InternalID, UUID_DCE); + volume_id_set_uuid(id, nw->SBH_PoolID, UUID_DCE); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%02u", le16_to_cpu(nw->SBH_VersionMediaMajor), le16_to_cpu(nw->SBH_VersionMediaMinor)); -- cgit v1.2.3-54-g00ecf From acc8322f1f8c081d36b3b1fd85903fb9ac68f0bb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 12 May 2006 15:25:17 +0200 Subject: 092 release --- ChangeLog | 25 +++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 4 ++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2c16ddf2d2..bba69b25f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,28 @@ +Summary of changes from v091 to v092 +============================================ + +Kay Sievers: + don't include stropts.h, some libc's don't like it + udevd: create leading directories for /dev/.udev/uevent_seqnum + vol_id: fix logging from libvolume_id's log function + update SUSE rules + update SUSE rules + add more warnings for invalid key operations + fix offsetof() build issue with recent glibc + selinux: fix typo in block device node selection + vol_id: add NetWare volume detection + edd_id: fix "(null)" output if "mbr_signature" does not exist + update Fedora rules + libvolume_id: nss - use different uuid + +Libor Klepac: + path_id: add platform and serio support + +Marco d'Itri: + update Debian rules + path_id: fix bashism + + Summary of changes from v090 to v091 ============================================ diff --git a/Makefile b/Makefile index c04742507a..ce84c52f65 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 091 +VERSION = 092 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index da6af382c9..2a7bd06688 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 092 +======== +Bugfix release. + udev 091 ======== Some more keys require the correct use of '==' and '=' depending -- cgit v1.2.3-54-g00ecf From 2bac6c64aa7808cafd7706d56887a97ba9f7817d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 13 May 2006 18:38:03 +0200 Subject: libvolume_id: fat - check for signature at end of sector --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/fat.c | 45 ++++++++++++++++++++++++++++++++-------- extras/volume_id/lib/volume_id.c | 1 - 3 files changed, 37 insertions(+), 11 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 4ead34a20a..e847f36bc6 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 63 +SHLIB_REV = 64 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 74336b4e6d..61a9450438 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -63,7 +63,7 @@ struct vfat_super_block { uint16_t flags; uint8_t version[2]; uint32_t root_cluster; - uint16_t insfo_sector; + uint16_t fsinfo_sector; uint16_t backup_boot; uint16_t reserved2[6]; uint8_t unknown[3]; @@ -76,6 +76,15 @@ struct vfat_super_block { } PACKED type; } PACKED; +struct fat32_fsinfo { + uint8_t signature1[4]; + uint32_t reserved1[120]; + uint8_t signature2[4]; + uint32_t free_clusters; + uint32_t next_cluster; + uint32_t reserved2[4]; +} PACKED; + struct vfat_dir_entry { uint8_t name[11]; uint8_t attr; @@ -128,6 +137,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off) { struct vfat_super_block *vs; struct vfat_dir_entry *dir; + struct fat32_fsinfo *fsinfo; uint16_t sector_size; uint16_t dir_entries; uint32_t sect_count; @@ -141,6 +151,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off) uint64_t root_start; uint32_t start_data_sect; uint16_t root_dir_entries; + uint16_t fsinfo_sect; uint8_t *buf; uint32_t buf_size; uint8_t *label = NULL; @@ -149,16 +160,19 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off) info("probing at offset 0x%llx", (unsigned long long) off); - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) + buf = volume_id_get_buffer(id, off, 0x400); + if (buf == NULL) + return -1; + + /* check signature */ + if (buf[510] != 0x55 || buf[511] != 0xaa) return -1; - /* believe only that's fat, don't trust the version - * the cluster_count will tell us - */ + vs = (struct vfat_super_block *) buf; if (memcmp(vs->sysid, "NTFS", 4) == 0) return -1; + /* believe only that's fat, don't trust the version */ if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) goto magic; @@ -174,9 +188,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off) if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) goto magic; - /* some old floppies don't have a magic, so we expect the boot code to match */ - - /* boot jump address check */ + /* some old floppies don't have a magic, expect the boot jump address to match */ if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && vs->boot_jump[0] != 0xe9) return -1; @@ -280,6 +292,21 @@ magic: goto found; fat32: + /* FAT32 should have a valid signature in the fsinfo block */ + fsinfo_sect = le16_to_cpu(vs->type.fat32.fsinfo_sector); + buf = volume_id_get_buffer(id, off + (fsinfo_sect * sector_size), 0x200); + if (buf == NULL) + return -1; + fsinfo = (struct fat32_fsinfo *) buf; + if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0) + return -1; + if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0) + return -1 ; + + vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); + if (vs == NULL) + return -1; + strcpy(id->type_version, "FAT32"); /* FAT32 root dir is a cluster chain like any other directory */ diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 472ea24611..50eb72dbd5 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -99,7 +99,6 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (volume_id_probe_luks(id, off) == 0) goto found; - /* signature in the first block, only small buffer needed */ if (volume_id_probe_vfat(id, off) == 0) goto found; -- cgit v1.2.3-54-g00ecf From 6deef787557f46628cec4a65e18864173ea720c8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 May 2006 21:57:28 +0200 Subject: libvolume_id: add more software raid signatures --- extras/volume_id/lib/Makefile | 4 +- extras/volume_id/lib/adaptec_raid.c | 112 ++++++++++++++++++++++++++++++++++++ extras/volume_id/lib/jmicron_raid.c | 62 ++++++++++++++++++++ extras/volume_id/lib/libvolume_id.h | 2 + extras/volume_id/lib/volume_id.c | 6 ++ 5 files changed, 185 insertions(+), 1 deletion(-) create mode 100644 extras/volume_id/lib/adaptec_raid.c create mode 100644 extras/volume_id/lib/jmicron_raid.c diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index e847f36bc6..8d8710d09a 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 64 +SHLIB_REV = 65 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) @@ -28,6 +28,8 @@ OBJS= \ silicon_raid.o \ nvidia_raid.o \ promise_raid.o \ + adaptec_raid.o \ + jmicron_raid.o \ iso9660.o \ jfs.o \ linux_raid.o \ diff --git a/extras/volume_id/lib/adaptec_raid.c b/extras/volume_id/lib/adaptec_raid.c new file mode 100644 index 0000000000..858c3ba09e --- /dev/null +++ b/extras/volume_id/lib/adaptec_raid.c @@ -0,0 +1,112 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2006 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct adaptec_meta { + uint32_t b0idcode; + uint8_t lunsave[8]; + uint16_t sdtype; + uint16_t ssavecyl; + uint8_t ssavehed; + uint8_t ssavesec; + uint8_t sb0flags; + uint8_t jbodEnable; + uint8_t lundsave; + uint8_t svpdirty; + uint16_t biosInfo; + uint16_t svwbskip; + uint16_t svwbcln; + uint16_t svwbmax; + uint16_t res3; + uint16_t svwbmin; + uint16_t res4; + uint16_t svrcacth; + uint16_t svwcacth; + uint16_t svwbdly; + uint8_t svsdtime; + uint8_t res5; + uint16_t firmval; + uint16_t firmbln; + uint32_t firmblk; + uint32_t fstrsvrb; + uint16_t svBlockStorageTid; + uint16_t svtid; + uint8_t svseccfl; + uint8_t res6; + uint8_t svhbanum; + uint8_t resver; + uint32_t drivemagic; + uint8_t reserved[20]; + uint8_t testnum; + uint8_t testflags; + uint16_t maxErrorCount; + uint32_t count; + uint32_t startTime; + uint32_t interval; + uint8_t tstxt0; + uint8_t tstxt1; + uint8_t serNum[32]; + uint8_t res8[102]; + uint32_t fwTestMagic; + uint32_t fwTestSeqNum; + uint8_t fwTestRes[8]; + uint8_t smagic[4]; + uint32_t raidtbl; + uint16_t raidline; + uint8_t res9[0xF6]; +} PACKED; + +int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct adaptec_meta *ad; + + info("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + ad = (struct adaptec_meta *) buf; + if (memcmp(ad->smagic, "DPTM", 4) != 0) + return -1; + + if (ad->b0idcode != be32_to_cpu(0x37FC4D1E)) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", ad->resver); + id->type = "adaptec_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/jmicron_raid.c b/extras/volume_id/lib/jmicron_raid.c new file mode 100644 index 0000000000..5182a3e825 --- /dev/null +++ b/extras/volume_id/lib/jmicron_raid.c @@ -0,0 +1,62 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2006 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct jmicron_meta { + int8_t signature[2]; + uint8_t minor_version; + uint8_t major_version; + uint16_t checksum; +} PACKED; + +int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + uint64_t meta_off; + struct jmicron_meta *jm; + + info("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + if (size < 0x10000) + return -1; + + meta_off = ((size / 0x200)-1) * 0x200; + buf = volume_id_get_buffer(id, off + meta_off, 0x200); + if (buf == NULL) + return -1; + + jm = (struct jmicron_meta *) buf; + if (memcmp(jm->signature, "JM", 2) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", jm->major_version, jm->minor_version); + id->type = "jmicron_raid_member"; + + return 0; +} diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index d6c5536274..df9fcd9891 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -108,5 +108,7 @@ extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint6 extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size); #endif diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 50eb72dbd5..fd95e7d3b0 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -69,6 +69,12 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0) goto found; + + if (volume_id_probe_adaptec_raid(id, off, size) == 0) + goto found; + + if (volume_id_probe_jmicron_raid(id, off, size) == 0) + goto found; } if (volume_id_probe_lvm1(id, off) == 0) -- cgit v1.2.3-54-g00ecf From 321f7bbb0a200cd378edfef9a7a2e779f704ac41 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 23 May 2006 13:26:41 +0200 Subject: path_id: add support for iSCSI devices --- extras/path_id/path_id | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 4941b88a45..a6dfbf1a08 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -312,6 +312,61 @@ handle_sas () { RESULT=0 } +handle_iscsi() { + local DEV=$1 + local iscsi_session_dir + local iscsi_session iscsi_session_path + local iscsi_connection iscsi_connection_path + # iSCSI device + iscsi_session_dir="${DEV%%/target*}" + iscsi_session="${iscsi_session_dir##*/}" + iscsi_session_path=/sys/class/iscsi_session/${iscsi_session} + if [ ! -d "$iscsi_session_path" ] ; then + : no iSCSI session path + RESULT=1 + return + fi + # Currently we're not doing MC/S + for conn in ${iscsi_session_dir}/connection* ; do + iscsi_conn_num=${conn##*:} + if [ "$iscsi_conn_num" = '0' ] ; then + iscsi_connection=$(basename $conn) + fi + done + if [ -z "$iscsi_connection" ] ; then + : no iSCSI connection found + RESULT=1 + return + fi + iscsi_connection_path=/sys/class/iscsi_connection/${iscsi_connection} + if [ ! -d "$iscsi_connection_path" ] ; then + : no iSCSI connection path + RESULT=1 + return + fi + if [ -e "${iscsi_session_path}/targetname" ]; then + read iscsi_tgtname < ${iscsi_session_path}/targetname + fi + if [ -z "$iscsi_tgtname" ] ; then + : No iSCSI Targetname + RESULT=1 + return + fi + if [ -e "${iscsi_connection_path}/persistent_address" ] ; then + read iscsi_address < ${iscsi_connection_path}/persistent_address + fi + if [ -z "$iscsi_address" ] ; then + : No iSCSI Target address + RESULT=1 + return + fi + if [ -e "${iscsi_connection_path}/persistent_port" ] ; then + read iscsi_port < ${iscsi_connection_path}/persistent_port + fi + d="ip-${iscsi_address}:${iscsi_port}-iscsi-${iscsi_tgtname}" + RESULT=0 +} + handle_usb () { : handle_usb $* local DEV=$1 @@ -413,6 +468,10 @@ handle_device () { */fw-host[0-9]*/*) handle_firewire "$D" ;; + */session[0-9]*/*) + handle_iscsi "$D" + D= + ;; */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) handle_scsi "$D" ;; -- cgit v1.2.3-54-g00ecf From 7223b9c951563191d8c8b269d166a2236578e66b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 23 May 2006 14:30:06 +0200 Subject: update Fedora rules --- etc/udev/redhat/51-hotplug.rules | 4 ++-- etc/udev/redhat/95-pam-console.rules | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/udev/redhat/51-hotplug.rules b/etc/udev/redhat/51-hotplug.rules index 4c47976ee5..d665d3e7a5 100644 --- a/etc/udev/redhat/51-hotplug.rules +++ b/etc/udev/redhat/51-hotplug.rules @@ -1,8 +1,8 @@ # do not call hotplug.d and dev.d for "drivers" and "module" events SUBSYSTEM=="drivers", GOTO="hotplug_end" SUBSYSTEM=="module", GOTO="hotplug_end" -ACTION="add", GOTO="hotplug_comp" -ACTION="remove", GOTO="hotplug_comp" +ACTION=="add", GOTO="hotplug_comp" +ACTION=="remove", GOTO="hotplug_comp" GOTO="hotplug_end" diff --git a/etc/udev/redhat/95-pam-console.rules b/etc/udev/redhat/95-pam-console.rules index 8de9249c28..ff54b3cbac 100644 --- a/etc/udev/redhat/95-pam-console.rules +++ b/etc/udev/redhat/95-pam-console.rules @@ -1 +1 @@ -ACTION=="add", SYSFS{dev}="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}" +ACTION=="add", SYSFS{dev}=="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}" -- cgit v1.2.3-54-g00ecf From ecc527e0becc01811220fdc9b433c51dc97569c7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 26 May 2006 17:35:44 +0200 Subject: path_id: prevent endless loop for SAS devices on older kernels --- extras/path_id/path_id | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index a6dfbf1a08..f9b3d5a73f 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -252,6 +252,7 @@ handle_fc () { fi if [ -z "$wwpn" ] ; then : no WWPN + D= RESULT=1 return fi @@ -290,6 +291,7 @@ handle_sas () { fi if [ -z "$phy_address" ] ; then : no initiator address + D= RESULT=1 return fi @@ -301,6 +303,7 @@ handle_sas () { fi if [ -z "$rphy_address" ] ; then : no initiator address + D= RESULT=1 return fi -- cgit v1.2.3-54-g00ecf From 5005ca5991edb233d3a6bb41ba7d48d5f8a296ab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 27 May 2006 12:20:51 +0200 Subject: remove udevsend --- Makefile | 2 - TODO | 2 +- udevd.c | 27 ++++-------- udevd.h | 3 -- udevsend.8 | 38 ---------------- udevsend.c | 138 ----------------------------------------------------------- udevsend.xml | 90 -------------------------------------- 7 files changed, 9 insertions(+), 291 deletions(-) delete mode 100644 udevsend.8 delete mode 100644 udevsend.c delete mode 100644 udevsend.xml diff --git a/Makefile b/Makefile index ce84c52f65..e39ebfebf4 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,6 @@ PROGRAMS = \ udevd \ udevtrigger \ udevsettle \ - udevsend \ udevcontrol \ udevmonitor \ udevinfo \ @@ -87,7 +86,6 @@ MAN_PAGES = \ udevd.8 \ udevtrigger.8 \ udevsettle.8 \ - udevsend.8 \ udevtest.8 \ udevinfo.8 \ udevstart.8 diff --git a/TODO b/TODO index 1ef9c71f07..719f345a0e 100644 --- a/TODO +++ b/TODO @@ -13,7 +13,7 @@ udev version: o remove MODALIAS + $modalias (ENV{MODALIAS}, $env{MODALIAS}, $sysfs{modalias} will do it) - o remove udevsend, udevstart and their man pages + o remove udevstart (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer want to guess event properties from sysfs like udevstart is doing it) diff --git a/udevd.c b/udevd.c index 705e2a9780..02c4887f54 100644 --- a/udevd.c +++ b/udevd.c @@ -559,19 +559,17 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) /* receive the udevd message from userspace */ static struct uevent_msg *get_udevd_msg(void) { - static struct udevd_msg usend_msg; - struct uevent_msg *msg; + static struct udevd_msg ctrl_msg; ssize_t size; struct msghdr smsg; struct cmsghdr *cmsg; struct iovec iov; struct ucred *cred; char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - int envbuf_size; int *intval; - memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); - iov.iov_base = &usend_msg; + memset(&ctrl_msg, 0x00, sizeof(struct udevd_msg)); + iov.iov_base = &ctrl_msg; iov.iov_len = sizeof(struct udevd_msg); memset(&smsg, 0x00, sizeof(struct msghdr)); @@ -599,21 +597,12 @@ static struct uevent_msg *get_udevd_msg(void) return NULL; } - if (strncmp(usend_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { - err("message magic '%s' doesn't match, ignore it", usend_msg.magic); + if (strncmp(ctrl_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { + err("message magic '%s' doesn't match, ignore it", ctrl_msg.magic); return NULL; } - switch (usend_msg.type) { - case UDEVD_UEVENT_UDEVSEND: - info("udevd event message received"); - envbuf_size = size - offsetof(struct udevd_msg, envbuf); - dbg("envbuf_size=%i", envbuf_size); - msg = get_msg_from_envbuf(usend_msg.envbuf, envbuf_size); - if (msg == NULL) - return NULL; - msg->type = usend_msg.type; - return msg; + switch (ctrl_msg.type) { case UDEVD_STOP_EXEC_QUEUE: info("udevd message (STOP_EXEC_QUEUE) received"); stop_exec_q = 1; @@ -624,14 +613,14 @@ static struct uevent_msg *get_udevd_msg(void) msg_queue_manager(); break; case UDEVD_SET_LOG_LEVEL: - intval = (int *) usend_msg.envbuf; + intval = (int *) ctrl_msg.envbuf; info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i", *intval); udev_log_priority = *intval; sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); putenv(udev_log); break; case UDEVD_SET_MAX_CHILDS: - intval = (int *) usend_msg.envbuf; + intval = (int *) ctrl_msg.envbuf; info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i", *intval); max_childs = *intval; break; diff --git a/udevd.h b/udevd.h index e6ed58d622..1e9c702896 100644 --- a/udevd.h +++ b/udevd.h @@ -23,8 +23,6 @@ #define UDEV_MAGIC "udevd_" UDEV_VERSION #define UDEVD_SOCK_PATH "/org/kernel/udev/udevd" -#define UDEVSEND_WAIT_MAX_SECONDS 3 -#define UDEVSEND_WAIT_LOOP_PER_SECOND 10 #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 @@ -44,7 +42,6 @@ enum udevd_msg_type { UDEVD_UNKNOWN, - UDEVD_UEVENT_UDEVSEND, UDEVD_UEVENT_NETLINK, UDEVD_STOP_EXEC_QUEUE, UDEVD_START_EXEC_QUEUE, diff --git a/udevsend.8 b/udevsend.8 deleted file mode 100644 index b5028adca6..0000000000 --- a/udevsend.8 +++ /dev/null @@ -1,38 +0,0 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. -.TH "UDEVSEND" "8" "August 2005" "udev" "udevsend" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevsend \- send the current environment to the udev daemon -.SH "SYNOPSIS" -.HP 9 -\fBudevsend\fR -.SH "DESCRIPTION" -.PP -Usually the udev daemon listens directly to the kernel uevents. udevsend may be used to pass events for already existing devices from a userspace application to the daemon. -.SH "ENVIRONMENT" -.TP -\fBACTION\fR -\fIadd\fR -or -\fIremove\fR -signifies the addition or the removal of a device. -.TP -\fBDEVPATH\fR -The sysfs devpath without the mountpoint but a leading slash. -.TP -\fBSUBSYSTEM\fR -The kernel subsystem the device belongs to. -.SH "AUTHOR" -.PP -Written by Kay Sievers -. -.SH "SEE ALSO" -.PP -\fBudev\fR(7), -\fBudevd\fR(8) diff --git a/udevsend.c b/udevsend.c deleted file mode 100644 index 9f5059a4c8..0000000000 --- a/udevsend.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * udevsend.c - * - * Copyright (C) 2004 Ling, Xiaofeng - * Copyright (C) 2004 Kay Sievers - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" - -/* global variables */ -static int sock = -1; - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) -{ - static struct udevd_msg usend_msg; - int usend_msg_len; - int i; - struct sockaddr_un saddr; - socklen_t addrlen; - int bufpos = 0; - int retval = 0; - const char *subsystem = NULL; - - logging_init("udevsend"); -#ifdef USE_LOG - udev_config_init(); -#endif - dbg("version %s", UDEV_VERSION); - - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (sock < 0) { - err("error getting socket: %s", strerror(errno)); - retval = 1; - goto exit; - } - - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - - memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); - strcpy(usend_msg.magic, UDEV_MAGIC); - usend_msg.type = UDEVD_UEVENT_UDEVSEND; - - /* copy all keys to send buffer */ - for (i = 0; envp[i]; i++) { - const char *key; - int keylen; - - key = envp[i]; - keylen = strlen(key); - - /* ignore events which are already sent on the netlink socket */ - if (strncmp(key, "SEQNUM=", 7) == 0) { - dbg("ignoring event with SEQNUM set"); - retval = 0; - goto exit; - } - - /* prevent loops in the scripts we execute */ - if (strncmp(key, "UDEVD_EVENT=", 12) == 0) { - err("event loop, already passed through the daemon, exit"); - retval = 2; - goto exit; - } - - if (bufpos + keylen >= UEVENT_BUFFER_SIZE-1) { - err("environment buffer too small, probably not called by the kernel"); - continue; - } - - /* remember the SUBSYSTEM */ - if (strncmp(key, "SUBSYSTEM=", 10) == 0) - subsystem = &key[10]; - - dbg("add '%s' to env[%i] buffer", key, i); - strcpy(&usend_msg.envbuf[bufpos], key); - bufpos += keylen + 1; - } - - usend_msg_len = offsetof(struct udevd_msg, envbuf) + bufpos; - dbg("usend_msg_len=%i", usend_msg_len); - - if (sendto(sock, &usend_msg, usend_msg_len, 0, (struct sockaddr *)&saddr, addrlen) < 0) { - retval = 3; - err("error sending message: %s", strerror(errno)); - } - -exit: - if (sock != -1) - close(sock); - - logging_close(); - return retval; -} diff --git a/udevsend.xml b/udevsend.xml deleted file mode 100644 index 9e94ce1798..0000000000 --- a/udevsend.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - -
        - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - - -
        - udevsend - - - udevsend - August 2005 - udev - - - - udevsend - 8 - - - - udevsend - send the current environment to the udev daemon - - - - - udevsend - - - - DESCRIPTION - Usually the udev daemon listens directly to the kernel uevents. - udevsend may be used to pass events for already existing devices from - a userspace application to the daemon. - - - ENVIRONMENT - - - - - add or remove signifies - the addition or the removal of a device. - - - - - - - The sysfs devpath without the mountpoint but a leading slash. - - - - - - - The kernel subsystem the device belongs to. - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev7 - , - - udevd8 - - - -
        -
        -- cgit v1.2.3-54-g00ecf From 1388c830117d68bb623043d9e1803b34ddade8e5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 May 2006 10:23:32 +0200 Subject: replace binary firmware helper with shell script --- extras/firmware/Makefile | 17 +---- extras/firmware/firmware.sh | 27 ++++++++ extras/firmware/firmware_helper.c | 142 -------------------------------------- 3 files changed, 30 insertions(+), 156 deletions(-) create mode 100755 extras/firmware/firmware.sh delete mode 100644 extras/firmware/firmware_helper.c diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index a30c0fcd5b..55ba22386f 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -1,14 +1,11 @@ # Makefile for udev extra invoked from the udev main Makefile # -# Copyright (C) 2004-2005 Kay Sievers +# Copyright (C) 2004-2006 Kay Sievers # # Released under the GNU General Public License, version 2. # -PROG = firmware_helper -OBJ = -HEADERS = -GEN_HEADERS = +PROG = firmware.sh MAN_PAGES = prefix = @@ -29,14 +26,6 @@ all: $(PROG) $(MAN_PAGES) .PHONY: all .DEFAULT: all -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - # man pages %.8: %.xml $(E) " XMLTO " $@ @@ -45,7 +34,6 @@ $(PROG): %: $(HEADERS) %.o $(OBJS) clean: $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) .PHONY: clean install-bin: all @@ -67,3 +55,4 @@ uninstall-man: install-config: @echo "no config file to install" .PHONY: install-config + diff --git a/extras/firmware/firmware.sh b/extras/firmware/firmware.sh new file mode 100755 index 0000000000..fb2f2a792d --- /dev/null +++ b/extras/firmware/firmware.sh @@ -0,0 +1,27 @@ +#!/bin/sh -e + +FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware" + +err() { + echo "$@" >&2 + if [ -x /bin/logger ]; then + /bin/logger -t "${0##*/}[$$]" "$@" + fi +} + +if [ ! -e /sys$DEVPATH/loading ]; then + err "udev firmware loader misses sysfs directory" + exit 1 +fi + +for DIR in $FIRMWARE_DIRS; do + [ -e "$DIR/$FIRMWARE" ] || continue + echo 1 > /sys/$DEVPATH/loading + cat "$DIR/$FIRMWARE" > /sys/$DEVPATH/data + echo 0 > /sys/$DEVPATH/loading + exit 0 +done + +echo -1 > /sys/$DEVPATH/loading +err "Cannot find firmware file '$FIRMWARE'" +exit 1 diff --git a/extras/firmware/firmware_helper.c b/extras/firmware/firmware_helper.c deleted file mode 100644 index ca1c43814f..0000000000 --- a/extras/firmware/firmware_helper.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * A simple firmware helper program. - * - * Copyright 2005 Red Hat, Inc. - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../udev.h" - -#define FIRMWARE_PATH "/lib/firmware" -#define PATH_SIZE 256 - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -/* Set the 'loading' attribute for a firmware device. - * 1 == currently loading - * 0 == done loading - * -1 == error - */ -static int set_loading(const char *device, int value) { - char loading_path[PATH_SIZE]; - int rc; - FILE *f; - - snprintf(loading_path, sizeof(loading_path), "/sys/%s/loading", device); - loading_path[sizeof(loading_path)-1] = '\0'; - f = fopen(loading_path, "w"); - if (!f) - return -1; - rc = fprintf(f, "%d", value); - fclose(f); - if (rc < 0) - return rc; - return 0; -} - -int main(int argc, char **argv) { - char *devpath, *firmware, *action, *driver; - char fw_path[PATH_SIZE]; - char data_path[PATH_SIZE]; - int fw_fd; - char *fw_buffer; - size_t fw_buffer_size; - size_t count; - int rc = 0; - - logging_init("firmware_helper"); - - driver = getenv("PHYSDEVDRIVER"); - if (!driver) - driver = "(unknown)"; - devpath = getenv("DEVPATH"); - firmware = getenv("FIRMWARE"); - action = getenv("ACTION"); - if (!devpath || !firmware || !action || strcmp(action,"add") != 0) { - err("missing devpath, action or firmware"); - exit(1); - } - - dbg("try to load firmware '%s' for '%s'", firmware, devpath); - set_loading(devpath, 1); - - snprintf(fw_path, sizeof(fw_path), "%s/%s", FIRMWARE_PATH, firmware); - fw_path[sizeof(fw_path)-1] = '\0'; - if (file_map(fw_path, &fw_buffer, &fw_buffer_size) != 0 || fw_buffer_size == 0) { - err("could not load firmware '%s' for '%s'", fw_path, devpath); - fw_buffer = NULL; - goto out_err; - } - - snprintf(data_path, sizeof(data_path), "/sys/%s/data", devpath); - data_path[sizeof(data_path)-1] = '\0'; - fw_fd = open(data_path, O_RDWR); - if (fw_fd < 0) { - rc = errno; - goto out_err; - } - - count = 0; - while (count < fw_buffer_size) { - ssize_t c; - - c = write(fw_fd, fw_buffer+count, fw_buffer_size-count); - if (c <= 0) { - rc = errno; - close(fw_fd); - goto out_err; - } - count += c; - } - - close(fw_fd); - file_unmap(fw_buffer, fw_buffer_size); - set_loading(devpath, 0); - info("loaded '%s' for device '%s'", fw_path, devpath); - logging_close(); - return 0; - -out_err: - if (fw_buffer) - file_unmap(fw_buffer, fw_buffer_size); - set_loading(devpath, -1); - - err("error loading '%s' for device '%s' with driver '%s'", fw_path, devpath, driver); - logging_close(); - return rc; -} -- cgit v1.2.3-54-g00ecf From cecd7f9a758fd498ae267dcb64e65e167ffef810 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 May 2006 11:17:21 +0200 Subject: skip device mapper devices for persistent links It conflicts with snapshot creation. It will move to its own rule file after kernel provides needed additional events. --- etc/udev/60-persistent-storage.rules | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules index 099d09477e..5a63a4fa70 100644 --- a/etc/udev/60-persistent-storage.rules +++ b/etc/udev/60-persistent-storage.rules @@ -5,7 +5,7 @@ ACTION!="add", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_storage_end" +KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" # never access removable ide devices, the drivers are causing event loops on open() KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" @@ -45,6 +45,4 @@ KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" - LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From df16b77934bed6c2f146098d60e5ffaf15e591ae Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 May 2006 11:18:16 +0200 Subject: 093 release --- ChangeLog | 16 ++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 5 +++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bba69b25f3..5248e1662c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Summary of changes from v092 to v093 +============================================ + +Hannes Reinecke: + path_id: add support for iSCSI devices + +Kay Sievers: + libvolume_id: fat - check for signature at end of sector + libvolume_id: add more software raid signatures + update Fedora rules + path_id: prevent endless loop for SAS devices on older kernels + remove udevsend + replace binary firmware helper with shell script + skip device mapper devices for persistent links + + Summary of changes from v091 to v092 ============================================ diff --git a/Makefile b/Makefile index e39ebfebf4..54905512ee 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 092 +VERSION = 093 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2a7bd06688..a60d6d77ed 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,8 @@ +udev 093 +======== +The binary firmware helper is replaced by the usual simple +shell script. Udevsend is removed from the tree. + udev 092 ======== Bugfix release. -- cgit v1.2.3-54-g00ecf From 47b3e9478c48dbe5f428bd6fc074eac78f2765c3 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 29 May 2006 21:00:32 +0200 Subject: update Debian rules --- etc/udev/debian/hotplug.rules | 5 ----- etc/udev/debian/persistent-input.rules | 8 ++++++++ etc/udev/debian/persistent.rules | 5 +---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/etc/udev/debian/hotplug.rules b/etc/udev/debian/hotplug.rules index d592c5e9dc..426424de5a 100644 --- a/etc/udev/debian/hotplug.rules +++ b/etc/udev/debian/hotplug.rules @@ -3,14 +3,9 @@ ACTION!="add", GOTO="hotplug_not_add_event" # check if the device has already been claimed by a driver ENV{PHYSDEVDRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" -# workarounds for kernels which lack $MODALIAS support -SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", IMPORT{program}="modalias_ieee1394" -SUBSYSTEM=="serio", ENV{MODALIAS}!="?*", IMPORT{program}="modalias_serio" - # load the drivers ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" SUBSYSTEM=="ide", ENV{MODALIAS}!="?*", RUN+="ide.agent" -SUBSYSTEM=="vio", ENV{MODALIAS}!="?*", RUN+="vio.agent" SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" diff --git a/etc/udev/debian/persistent-input.rules b/etc/udev/debian/persistent-input.rules index 339a365048..293971266e 100644 --- a/etc/udev/debian/persistent-input.rules +++ b/etc/udev/debian/persistent-input.rules @@ -10,6 +10,14 @@ BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", \ BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", \ ENV{ID_CLASS}="mouse" +# other devices +DRIVER=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVER=="atkbd", ENV{ID_CLASS}="kbd" +DRIVER=="psmouse", ENV{ID_CLASS}="mouse" +SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" + +ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + # by-id links, generic and for the event devices KERNEL=="mouse*", \ ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", \ diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index 9f1887ddea..349817d797 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -5,7 +5,7 @@ SUBSYSTEM!="block", GOTO="no_volume_id" ACTION!="add", GOTO="no_volume_id" # and we can safely ignore these kinds of devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="no_volume_id" +KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="no_volume_id" # skip removable ide devices, because open(2) on them causes an events loop KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", \ @@ -69,9 +69,6 @@ ENV{ID_FS_UUID}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ ENV{ID_FS_LABEL_SAFE}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", \ -# SYMLINK+="disk/by-name/%c" - # end of processing LABEL="no_volume_id" -- cgit v1.2.3-54-g00ecf From e55a73abb07e6949ebbf17fa08a3ddeaddbbc41f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 May 2006 16:01:28 +0200 Subject: libvolume_id: gfs + gfs2 support Patch from Red Hat. --- extras/volume_id/README | 5 +- extras/volume_id/lib/Makefile | 3 +- extras/volume_id/lib/exported_symbols | 2 + extras/volume_id/lib/gfs.c | 120 ++++++++++++++++++++++++++++++++++ extras/volume_id/lib/libvolume_id.h | 2 + extras/volume_id/lib/volume_id.c | 6 ++ 6 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 extras/volume_id/lib/gfs.c diff --git a/extras/volume_id/README b/extras/volume_id/README index be98df9b12..b458ca59ba 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -36,6 +36,8 @@ squashfs * - - - minix * - - * ocfs (1, 2) * * * * vxfs * - - * +nss (netware) * * * +gfs, gfs2 * - - - Raid members are detected to prevent the probing for a filesystem ----------------------------------------------------------------- @@ -49,7 +51,8 @@ nvidia_raid * - - - promise_raid * - - - silicon_raid * - - - via_raid * - - - - +jmicron * - - - +adaptec * - - - If no label is found vol_id exits with nonzero and the rule will be ignored. diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 8d8710d09a..90cd63e745 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 65 +SHLIB_REV = 66 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) @@ -45,6 +45,7 @@ OBJS= \ romfs.o \ sysv.o \ minix.o \ + gfs.o \ luks.o \ ocfs.o \ vxfs.o \ diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index df5f9f05c9..3f10ec0c78 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -27,6 +27,8 @@ volume_id_probe_xfs; volume_id_probe_squashfs; volume_id_probe_netware; + volume_id_probe_gfs; + volume_id_probe_gfs2; volume_id_probe_linux_raid; volume_id_probe_lvm1; diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c new file mode 100644 index 0000000000..40a4493b32 --- /dev/null +++ b/extras/volume_id/lib/gfs.c @@ -0,0 +1,120 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2006 Red Hat, Inc. + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +/* Common gfs/gfs2 constants: */ +#define GFS_MAGIC 0x01161970 +#define GFS_DEFAULT_BSIZE 4096 +#define GFS_SUPERBLOCK_OFFSET (0x10 * GFS_DEFAULT_BSIZE) +#define GFS_METATYPE_SB 1 +#define GFS_FORMAT_SB 100 +#define GFS_LOCKNAME_LEN 64 + +/* gfs1 constants: */ +#define GFS_FORMAT_FS 1309 +#define GFS_FORMAT_MULTI 1401 +/* gfs2 constants: */ +#define GFS2_FORMAT_FS 1801 +#define GFS2_FORMAT_MULTI 1900 + +struct gfs2_meta_header { + uint32_t mh_magic; + uint32_t mh_type; + uint64_t __pad0; /* Was generation number in gfs1 */ + uint32_t mh_format; + uint32_t __pad1; /* Was incarnation number in gfs1 */ +}; + +struct gfs2_inum { + uint64_t no_formal_ino; + uint64_t no_addr; +}; + +struct gfs2_sb { + struct gfs2_meta_header sb_header; + + uint32_t sb_fs_format; + uint32_t sb_multihost_format; + uint32_t __pad0; /* Was superblock flags in gfs1 */ + + uint32_t sb_bsize; + uint32_t sb_bsize_shift; + uint32_t __pad1; /* Was journal segment size in gfs1 */ + + struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ + struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ + struct gfs2_inum sb_root_dir; + + char sb_lockproto[GFS_LOCKNAME_LEN]; + char sb_locktable[GFS_LOCKNAME_LEN]; + /* In gfs1, quota and license dinodes followed */ +} PACKED; + +static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int vers) +{ + struct gfs2_sb *sbd; + + info("probing at offset 0x%llx", (unsigned long long) off); + + sbd = (struct gfs2_sb *) + volume_id_get_buffer(id, off + GFS_SUPERBLOCK_OFFSET, sizeof(struct gfs2_sb)); + if (sbd == NULL) + return -1; + + if (be32_to_cpu(sbd->sb_header.mh_magic) == GFS_MAGIC && + be32_to_cpu(sbd->sb_header.mh_type) == GFS_METATYPE_SB && + be32_to_cpu(sbd->sb_header.mh_format) == GFS_FORMAT_SB) { + if (vers == 1) { + if (be32_to_cpu(sbd->sb_fs_format) != GFS_FORMAT_FS || + be32_to_cpu(sbd->sb_multihost_format) != GFS_FORMAT_MULTI) + return -1; /* not gfs1 */ + id->type = "gfs"; + } + else if (vers == 2) { + if (be32_to_cpu(sbd->sb_fs_format) != GFS2_FORMAT_FS || + be32_to_cpu(sbd->sb_multihost_format) != GFS2_FORMAT_MULTI) + return -1; /* not gfs2 */ + id->type = "gfs2"; + } + else + return -1; + strcpy(id->type_version, "1"); + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + return 0; + } + return -1; +} + +int volume_id_probe_gfs(struct volume_id *id, uint64_t off) +{ + return volume_id_probe_gfs_generic(id, off, 1); +} + +int volume_id_probe_gfs2(struct volume_id *id, uint64_t off) +{ + return volume_id_probe_gfs_generic(id, off, 2); +} diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index df9fcd9891..e34f4679e7 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -89,6 +89,8 @@ extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off); extern int volume_id_probe_netware(struct volume_id *id, uint64_t off); +extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off); +extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off); /* special formats */ extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index fd95e7d3b0..bcdbe2feaa 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -171,6 +171,12 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (volume_id_probe_netware(id, off) == 0) goto found; + if (volume_id_probe_gfs(id, off) == 0) + goto found; + + if (volume_id_probe_gfs2(id, off) == 0) + goto found; + return -1; found: -- cgit v1.2.3-54-g00ecf From 891205121395acbe84eb6173670ce7934cd9b1c6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Jun 2006 16:00:34 +0200 Subject: remove MODALIAS key and substitution --- TODO | 3 --- udev_rules.c | 38 -------------------------------------- udev_rules.h | 1 - udev_rules_parse.c | 6 ------ 4 files changed, 48 deletions(-) diff --git a/TODO b/TODO index 719f345a0e..ba12632374 100644 --- a/TODO +++ b/TODO @@ -10,9 +10,6 @@ udev version: o remove broken %e enumeration (simple enumerations can't work and should go) - o remove MODALIAS + $modalias - (ENV{MODALIAS}, $env{MODALIAS}, $sysfs{modalias} will do it) - o remove udevstart (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer want to guess event properties from sysfs like udevstart is doing it) diff --git a/udev_rules.c b/udev_rules.c index ee4632513a..03b3f2a116 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -401,7 +401,6 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) SUBST_PARENT, SUBST_TEMP_NODE, SUBST_ROOT, - SUBST_MODALIAS, SUBST_ENV, }; static const struct subst_map { @@ -421,7 +420,6 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, - { .name = "modalias", .fmt = 'A', .type = SUBST_MODALIAS }, { .name = "env", .fmt = 'E', .type = SUBST_ENV }, { NULL, '\0', 0 } }; @@ -618,24 +616,6 @@ found: strlcat(string, udev_root, maxsize); dbg("substitute udev_root '%s'", udev_root); break; - case SUBST_MODALIAS: - { - const char *value; - static int warn = 1; - - if (warn) { - err("$modalias is deprecated, use $env{MODALIAS} or " - "$sysfs{modalias} instead."); - warn = 0; - } - - value = sysfs_attr_get_value(udev->dev->devpath, "modalias"); - if (value != NULL) { - strlcat(string, value, maxsize); - dbg("substitute MODALIAS '%s'", temp2); - } - } - break; case SUBST_ENV: if (attr == NULL) { dbg("missing attribute"); @@ -730,24 +710,6 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (match_key("NAME", rule, &rule->name, udev->name)) goto nomatch; - if (rule->modalias.operation != KEY_OP_UNSET) { - const char *value; - static int warn = 1; - - if (warn) { - err("MODALIAS is deprecated, use ENV{MODALIAS} or SYSFS{modalias} instead."); - warn = 0; - } - - value = sysfs_attr_get_value(udev->dev->devpath, "modalias"); - if (value == NULL) { - dbg("MODALIAS value not found"); - goto nomatch; - } - if (match_key("MODALIAS", rule, &rule->modalias, value)) - goto nomatch; - } - for (i = 0; i < rule->env.count; i++) { struct key_pair *pair = &rule->env.keys[i]; diff --git a/udev_rules.h b/udev_rules.h index e4d5ebd765..2c956fcccc 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -71,7 +71,6 @@ struct udev_rule { struct key driver; struct key program; struct key result; - struct key modalias; struct key import; enum import_type import_type; struct key wait_for_sysfs; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 91cc9744fb..271de6f879 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -374,12 +374,6 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strcasecmp(key, "MODALIAS") == 0) { - add_rule_key(rule, &rule->modalias, operation, value); - valid = 1; - continue; - } - if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { attr = get_key_attribute(key + sizeof("IMPORT")-1); if (attr && strstr(attr, "program")) { -- cgit v1.2.3-54-g00ecf From 5aeea7b1f7880fbcb58df1cf60f75881ce607ca1 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Sat, 10 Jun 2006 23:46:15 +0200 Subject: update "writing udev rules" --- docs/writing_udev_rules/index.html | 951 +++++++++++++++++++++++++------------ 1 file changed, 650 insertions(+), 301 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index 1c5c89b3c9..ce33bbb011 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -1,341 +1,627 @@ - + + + + Writing udev rules -

        Writing udev rules

        by Daniel Drake (dsd)
        -Version 0.6

        +Version 0.7

        The most recent version of this document can always be found at:
        -http://www.reactivated.net/udevrules.php + +http://www.reactivated.net/writing_udev_rules.html

        Contents

        -
          -
        1. About this document
        2. -
        3. History
        4. -
        5. Software versions used at time of writing
        6. -
        7. Terminology: devfs, sysfs, nodes, etc.
        8. - -
        9. Why? (The purpose of this document)
        10. -
        11. The basics of writing rules
        12. -
        13. Additional automated customisation for NAME and SYMLINK parameters
        14. -
        15. Using shell-style pattern matching in keys
        16. -
        17. Key-writing basics
        18. -
        19. Identifying devices through basic keys
        20. -
        21. Identifying devices through SYSFS files
        22. -
        23. Using multiple SYMLINK style rules
        24. -
        25. Controlling ownership and permissions
        26. -
        27. Example: Writing a rule for my USB printer
        28. -
        29. Example: Writing a rule for my USB-Storage digital camera
        30. - -
        31. Additional notes on writing rules for USB storage
        32. -
        33. Example: Writing convenience rules for my CD drives
        34. -
        35. Example: Writing a rule to name my network interface
        36. -
        37. Tips for finding the appropriate places in SYSFS
        38. -
        39. Debugging your rules
        40. -
        41. Author and credits
        42. -
        + + +

        Introduction

        -

        About this document

        -udev is targetted at Linux kernels 2.6 and beyond to provide a userspace solution for a dynamic /dev directory, with persistent device naming. The previous /dev implementation, devfs, is now deprecated, and udev is seen as the successor. udev vs devfs is a sensitive area of conversation - you should read this document before making comparisons.

        +

        About this document

        -udev is a well thought out solution, but I was initially very confused how I might customise it for my system. This document attempts to make the process of rule writing a little bit clearer.

        +

        +udev is targeted at Linux kernels 2.6 and beyond to provide a userspace solution for a dynamic /dev directory, with persistent device naming. The previous /dev implementation, devfs, is now deprecated, and udev is seen as the successor. udev vs devfs is a sensitive area of conversation - you should read this document before making comparisons. +

        -I'm all open to feedback - please contact me with any comments, problems, and suggested improvements.

        +

        +Over the years, the things that you might use udev rules for has changed, as well as the flexibility of rules themselves. On a modern system, udev provides persistent naming for some device types out-of-the-box, eliminating the need for custom rules for those devices. However, some users will still require the extra level of customisation. +

        -This document assumes that you have udev/hotplug installed and running OK with default configurations. If you do not yet have udev configured and running, I would suggest that you follow Decibels udev Primer to get to this stage (contains some Gentoo Linux specifics, but should be useful for other distro's too).

        +

        +This document assumes that you have udev installed and running OK with default configurations. This is usually handled by your Linux distribution. +

        + +

        +This document does not cover every single detail of rule writing, but does aim to introduce all of the main concepts. The finer details can be found in the udev man page. +

        + +

        +This document uses various examples (many of which are entirely fictional) to illustrate ideas and concepts. Not all syntax is explicitly described in the accompanying text, be sure to look at the example rules to get a complete understanding. +

        +

        History

        -

        History

        - -May 9th 2005 v0.6: Misc updates, including information about udevinfo, groups and permissions, logging, and udevtest.

        -June 20th 2004 v0.55: Added info on multiple symlinks, and some minor changes/updates.

        -April 26th 2004 v0.54: Added some Debian info. Minor corrections. Re-reverted information about what to call your rule file. Added info about naming network interfaces.

        -April 15th 2004 v0.53: Minor corrections. Added info about NAME{all_partitions}. Added info about other udevinfo tricks.

        -April 14th 2004 v0.52: Reverted to suggesting using "udev.rules" until the udev defaults allow for other files. Minor work.

        -April 6th 2004 v0.51: I now write suggest users to use their own "local.rules" file rather than prepending "udev.rules".

        -April 3rd 2004 v0.5: Minor cleanups and preparations for possible inclusion in the udev distribution.

        -March 20th 2004 v0.4: General improvements, clarifications, and cleanups. Added more information about writing rules for usb-storage.

        -February 23rd 2004 v0.3: Rewrote some parts to emphasise how sysfs naming works, and how it can be matched. Updated rule-writing parts to represent udev 018s new SYSFS{filename} naming scheme. Improved sectioning, and clarified many points. Added info about KDE.

        -February 18th 2004 v0.2: Fixed a small omission in an example. Updated section on identifying mass-storage devices. Updated section on nvidia.

        -February 15th 2004 v0.1: Initial publication.

        - - -

        Software versions used at time of writing

        -Linux Kernel 2.6.11
        -udev 056

        +
          +
        • June 10th 2006 v0.71: Misc changes based on recent feedback - thanks!
        • +
        • June 3rd 2006 v0.7: Complete rework, to be more suited for the modern-day udev.
        • +
        • May 9th 2005 v0.6: Misc updates, including information about udevinfo, groups and permissions, logging, and udevtest.
        • +
        • June 20th 2004 v0.55: Added info on multiple symlinks, and some minor changes/updates.
        • +
        • April 26th 2004 v0.54: Added some Debian info. Minor corrections. Re-reverted information about what to call your rule file. Added info about naming network interfaces.
        • +
        • April 15th 2004 v0.53: Minor corrections. Added info about NAME{all_partitions}. Added info about other udevinfo tricks.
        • +
        • April 14th 2004 v0.52: Reverted to suggesting using "udev.rules" until the udev defaults allow for other files. Minor work.
        • +
        • April 6th 2004 v0.51: I now write suggest users to use their own "local.rules" file rather than prepending "udev.rules".
        • +
        • April 3rd 2004 v0.5: Minor cleanups and preparations for possible inclusion in the udev distribution.
        • +
        • March 20th 2004 v0.4: General improvements, clarifications, and cleanups. Added more information about writing rules for usb-storage.
        • +
        • February 23rd 2004 v0.3: Rewrote some parts to emphasise how sysfs naming works, and how it can be matched. Updated rule-writing parts to represent udev 018s new SYSFS{filename} naming scheme. Improved sectioning, and clarified many points. Added info about KDE.
        • +
        • February 18th 2004 v0.2: Fixed a small omission in an example. Updated section on identifying mass-storage devices. Updated section on nvidia.
        • +
        • February 15th 2004 v0.1: Initial publication.
        • +
        + +

        The concepts

        -

        Terminology: devfs, sysfs, nodes, etc.

        -A basic introduction only, might not be totally accurate.

        +

        Terminology: devfs, sysfs, nodes, etc.

        + +

        +A basic introduction only, might not be totally accurate. +

        -On typical linux-based systems, the /dev directory is used to store file-like device nodes which refer to certain devices in the system. Each node points to a part of the system (a device), which might or might not exist. Userspace applications can use these device nodes to interface with the systems hardware, for example, XFree86 will "listen to" /dev/input/mice so that it can relate the users mouse movements to moving the visual mouse pointer.

        +

        +On typical Linux-based systems, the /dev directory is used to store file-like device nodes which refer to certain devices in the system. Each node points to a part of the system (a device), which might or might not exist. Userspace applications can use these device nodes to interface with the systems hardware, for example, the X server will "listen to" /dev/input/mice so that it can relate the user's mouse movements to moving the visual mouse pointer. +

        -The original /dev directories were just populated with every device that might possibly appear in the system. /dev directories were typically very large because of this. devfs came along to provide a more managable approach (noticably, it only populated /dev with hardware that is plugged into the system), as well as some other functionality, but the system proved to have problems which could not be easily fixed.

        +

        +The original /dev directories were just populated with every device that might possibly appear in the system. /dev directories were typically very large because of this. devfs came along to provide a more manageable approach (noticeably, it only populated /dev with hardware that is plugged into the system), as well as some other functionality, but the system proved to have problems which could not be easily fixed. +

        -udev is the "new" way of managing /dev directories, designed to clear up some issues with previous /dev implementations, and provide a robust path forward. In order to create and name /dev device nodes corresponding to devices that are present in the system, udev relies on matching information provided by sysfs with rules provided by the user. This documentation aims to detail the process of rule-writing, one of the only udev-related tasks that must (optionally) be performed by the user.

        +

        +udev is the "new" way of managing /dev directories, designed to clear up some issues with previous /dev implementations, and provide a robust path forward. In order to create and name /dev device nodes corresponding to devices that are present in the system, udev relies on matching information provided by sysfs with rules provided by the user. This documentation aims to detail the process of rule-writing, one of the only udev-related tasks that must (optionally) be performed by the user. +

        -sysfs is a new filesystem to the 2.6 kernels. It is managed by the kernel, and exports basic information about the devices currently plugged into your system. udev can use this information to create device nodes corresponding to your hardware. sysfs is mounted at /sys and is browsable. You may wish to investigate some of the files stored there before getting to grips with udev. Throughout this document, I will use the terms /sys and SYSFS interchangeably.


        +

        +sysfs is a new filesystem to the 2.6 kernels. It is managed by the kernel, and exports basic information about the devices currently plugged into your system. udev can use this information to create device nodes corresponding to your hardware. sysfs is mounted at /sys and is browseable. You may wish to investigate some of the files stored there before getting to grips with udev. Throughout this document, I will use the terms /sys and sysfs interchangeably. +

        -

        Why?

        +

        Why?

        + +

        +udev rules are flexible and very powerful. Here are some of the things you can use rules to achieve: +

        + +
          +
        • Rename a device node from the default name to something else
        • +
        • Provide an alternative/persistent name for a device node by creating a symbolic link to the default device node
        • +
        • Name a device node based on the output of a program
        • +
        • Change permissions and ownership of a device node
        • +
        • Launch a script when a device node is created or deleted (typically when a device is attached or unplugged)
        • +
        • Rename network interfaces
        • +
        -As stated above, writing rules for udev is an optional process. By default, you can plug a device in, and the a relevant node (e.g. /dev/sda for a mass-storage device) will be there, just like in previous /dev implementations.

        +

        +Writing rules is not a workaround for the problem where no device nodes for your particular device exist. Even if there are no matching rules, udev will create the device node with the default name supplied by the kernel. +

        -However, udev allows you to customise the naming of device nodes. There are two reasons why you might want to do this: convenience, and persistent naming.

        +

        +Having persistently named device nodes has several advantages. Assume you own two USB storage devices: a digital camera and a USB flash disk. These devices are typically assigned device nodes /dev/sda and /dev/sdb but the exact assignment depends on the order which they were originally connected. This may cause problems to some users, who would benefit greatly if each device could be named persistently every time, e.g. /dev/camera and /dev/flashdisk. +

        -Take the example of using udev, so that when your printer is plugged in, it gets named as /dev/printer and also as the usual /dev/lp0. It's not only convenience (e.g. reading and interpreting "printer" as opposed to "lp0"), its a solution for non-persistent naming. Say that I have two printers - a HP laser printer and an Epson inkjet. When they are both plugged in and on, I have /dev/lp0 and /dev/lp1.
        + +

        Built-in persistent naming schemes

        -How do I know which node refers to which printer? There is no easy way. The first printer that got connected was assigned name "lp0", and the second "lp1". Plugging in my printers in a different order would swap the names here, and that would mess up my scripts that always expect my HP laser printer to be lp1.

        +

        +udev provides persistent naming for some device types out of the box. This is a very useful feature, and in many circumstances means that your journey ends here: you do not have to write any rules. +

        -However, if my HP laser printer got named lp_hp (as well as lpX) and my other printer got named lp_epson (as well as lpY), then my scripts could just refer to those names. udev magic can control this and ensure that these persistent names always point to the device that I intended.

        +

        +udev provides out-of-the-box persistent naming for storage devices in the /dev/disk directory. To view the persistent names which have been created for your storage hardware, you can use the following command: +

        -For external mass-storage devices (e.g. usb hard disks), persistent naming is very helpful in that it allows you to hardcode accurate device paths into your /etc/fstab.

        +
        # ls -lR /dev/disk
        -It is important to understand that writing rules is simply a means of customizing udev behaviour. Writing rules is not a workaround for the problem where no device nodes for your particular device exist. If no matching rules exist, udev will create the node anyway, using the name that was supplied by the kernel.

        +

        +This works for all storage types. As an example, udev has created /dev/disk/by-id/scsi-SATA_ST3120827AS_4MS1NDXZ-part3 which is a persistent-named symbolic link to my root partition. udev creates /dev/disk/by-id/usb-Prolific_Technology_Inc._USB_Mass_Storage_Device-part1 when I plug my USB flash disk in, which is also a persistent name. +

        - -

        The basics of writing rules

        + -When populating /dev, udev decides which nodes to include, and how to name them, by reading a series of rules files.

        +

        Rule writing

        -Default udev rules are stored in /etc/udev/rules.d/50-udev.rules. You may find it interesting to look over this file - it includes a few examples, and then some default rules proving a devfs-style /dev layout. However, you should not write rules into this file directly, to reduce hassle while updating your udev installation in the future.

        + +

        Rule files and semantics

        -Files in /etc/udev/rules.d/ are parsed in lexical order. udev will stop processing rules as soon as it finds a matching rule in a file for the new item of hardware that has been detected. It is important that your own rules get processed before the udev defaults, otherwise your own naming schemes will not take effect! I suggest that you keep your own rules in a file at /etc/udev/rules.d/10-local.rules (this doesn't exist by default - create it). As 10 comes before 50, you know that your rules will be looked at first. It is important that the filenames of your rule files end with the .rules suffix, otherwise they will not be used.

        +

        +When deciding how to name a device and which additional actions to perform, udev reads a series of rules files. These files are kept in the /etc/udev/rules.d directory, and they all must have the .rules suffix. +

        -As your own rules will effectively mask out the udev defaults which create the base /dev layout, it is recommended that you also specify devfs-style names/symlinks for the rules you write, so that you get the sensible defaults plus your own names.

        +

        +Default udev rules are stored in /etc/udev/rules.d/50-udev.rules. You may find it interesting to look over this file - it includes a few examples, and then some default rules proving a devfs-style /dev layout. However, you should not write rules into this file directly. +

        -In rule files, lines starting with a "#" are treated as comments. Every uncommented line in the file corresponds to a rule.

        +

        +Files in /etc/udev/rules.d/ are parsed in lexical order, and in some circumstances, the order in which rules are parsed is important. In general, you want your own rules to be parsed before the defaults, so I suggest you create a file at /etc/udev/rules.d/10-local.rules and write all your rules into this file. +

        -Rules are composed of keys. Keys are seperated by commas. Some keys are used for reading and matching information, others are used for assigning information and performing actions. Matches and assignments are carried out with the expected operators (= and ==). +

        +In a rules file, lines starting with "#" are treated as comments. Every other non-blank line is a rule. Rules cannot span multiple lines. +

        -
          -
        1. At least one identification key should be provided, which will match the rule to any number of devices in the system. These are listed in the later section: Identifying devices through basic keys.
        2. -
        3. At least one assignment key should be provided, to control how the resultant device node is created. These include NAME, SYMLINK, OWNER, GROUP and MODE, all of which are described in this document.
        4. -
        +

        +One device can be matched by more than one rule. This has it's practical advantages, for example, we can write two rules which match the same device, where each one provides its own alternate name for the device. Both alternate names will be created, even if the rules are in separate files. It is important to understand that udev will not stop processing when it finds a matching rule, it will continue searching and attempt to apply every rule that it knows about. +

        -Common rules will use basic identification keys to determine the device to name, and then have a NAME assignement key to define the device node name. udev will only create one node for one device, so if you want it to be accessible through multiple nodes, then you have to specify the other nodes in the SYMLINK assignment key.

        + +

        Rule syntax

        -I'll take a slightly modified udev example rule to illustrate this: -
        BUS=="usb", SYSFS{serial}=="HXOLL0012202323480", NAME="lp_epson", SYMLINK="printers/epson_stylus"
        +

        +Each rule is constructed from a series of key-value pairs, which are separated by commas. match keys are conditions used to identify the device which the rule is acting upon. When all match keys in a rule correspond to the device being handled, then the rule is applied and the actions of the assignment keys are invoked. Every rule should consist of at least one match key and at least one assignment key. +

        -The identification keys here are BUS and SYSFS{serial}. The assignment keys here are NAME and SYMLINK. udev will match this rule against a device that is connected through the USB bus and with a serial number of HXOLL0012202323480. Note that all (as opposed to any) specified keys must be matched for udev to use the rule to name a device.
        +

        +Here is an example rule to illustrate the above: +

        -udev will name this node lp_epson, and it will be located at /dev/lp_epson.
        -udev will also create a symlink to /dev/lp_epson, located at /dev/printers/epson_stylus (the printers directory will be automatically created). You can now print to your Epson printer by sending data to /dev/printers/epson_stylus or /dev/lp_epson.

        +
        KERNEL=="hdb", NAME="my_spare_disk"
        -Any rules that you have added or modified will not take effect until you notify udev of this. Make sure you remember to run the following every time you modify any rule files: -
        # udevstart
        +

        +The above rule includes one match key (KERNEL) and one assignment key (NAME). The semantics of these keys and their properties will be detailed later. It is important to note that the match key is related to its value through the equality operator (==), whereas the assignment key is related to its value through the assignment operator (=). +

        - -

        Additional automated customisation for NAME and SYMLINK parameters

        + -In the NAME and SYMLINK parameters of your rules, you are able to use basic operators to assist the naming of devices. Hackers will know this sort of thing as printf-like string substitution. + +

        Basic Rules

        -There are a number of operators which can compose some or all of your NAME/SYMLINK parameters. These operators refer to kernel-data relating to the device. Take this example: +

        +udev provides several different match keys which can be used to write rules which match devices very precisely. Some of the most common keys are introduced below, others will be introduced later in this document. For a complete list, see the udev man page. +

        -
        BUS=="usb", SYSFS{vendor}=="FUJIFILM", SYSFS{model}=="M100", NAME="camera%n"
        +
          +
        • KERNEL - match against the kernel name for the device
        • +
        • SUBSYSTEM - match against the subsystem of the device
        • +
        • DRIVER - match against the driver name for the device
        • +
        -The %n operator will be replaced with the "kernel number" for the camera device, to produce a NAME such as camera0, camera1, etc.

        +

        +After you have used a series of match keys to precisely match a device, udev gives you fine control over what happens next, through a range of assignment keys. For a complete list of possible assignment keys, see the udev man page. The most basic assignment keys are introduced below. Others will be introduced later in this document. +

        -Another common operator is %k. This represents what the kernel would name the device, e.g. "hda1". You may often see rules which have NAME="%k" to produce the default names for the hardware. In these rules, customisation is usually done through the SYMLINK parameter.

        +
          +
        • NAME - the name that shall be used for the device node
        • +
        • SYMLINK - a list of symbolic links which act as alternative names for the device node
        • +
        -A full list of operators, with explanations, can be found in the udev man page.

        +

        +As hinted above, udev only creates one true device node for one device. If you wish to provide alternate names for this device node, you use the symbolic link functionality. With the SYMLINK assignment, you are actually maintaining a list of symbolic links, all of which will be pointed at the real device node. To manipulate these links, we introduce a new operator for appending to lists: +=. You can append multiple symlinks to the list from any one rule by separating each one with a space. +

        - -

        Using shell-style pattern matching in keys

        +
        KERNEL=="hdb", NAME="my_spare_disk"
        -You can use shell style pattern matching to provide even more flexibility when writing keys. Taking a default udev rule: +

        +The above rule says: match a device which was named by the kernel as hdb, and instead of calling it hdb, name the device node as my_spare_disk. The device node appears at /dev/my_spare_disk. +

        -
        KERNEL=="ts*", NAME="input/%k"
        +
        KERNEL=="hdb", DRIVER=="ide-disk", SYMLINK+="sparedisk"
        -The * operator is used here, which matches literally anything - zero, one, or more characters of any kind. The rule literally says:
        +

        +The above rule says: match a device which was named by the kernel as hdb AND where the driver is ide-disk. Name the device node with the default name and create a symbolic link to it named sparedisk. Note that we did not specify a device node name, so udev uses the default. In order to preserve the standard /dev layout, your own rules will typically leave the NAME alone but create some SYMLINKs and/or perform other assignments. +

        -
        Match a device identified by a KERNEL name starting with the letters "ts" optionally followed by anything at all, and name it with the KERNEL name (%k) under the input directory.
        +
        KERNEL=="hdc", SYMLINK+="cdrom cdrom0"
        -The ? operator is similar, and matches any single character (but not zero characters).

        +

        +The above rule is probably more typical of the types of rules you might be writing. It creates two symbolic links at /dev/cdrom and /dev/cdrom0, both of which point at /dev/hdc. Again, no NAME assignment was specified, so the default kernel name (hdc) is used. +

        -You can also use square brackets [ ] to match any single character. Direct quote from udev man page:
        -
        For example, the pattern string "tty[SR]" would match either "ttyS" or "ttyR".
        + +

        Matching sysfs attributes

        -You can also specify ranges that can be matched, e.g. [0-9] would match any single digit. Using an example rule from a default udev installation: +

        +The match keys introduced so far only provide limited matching capabilities. Realistically we require much finer control: we want to identify devices based on advanced properties such as vendor codes, exact product numbers, serial numbers, storage capacities, number of partitions, etc. +

        -
        KERNEL=="fd[0-9]*", NAME="floppy/%n"
        +

        +Many drivers export information like this into sysfs, and udev allows us to incorporate sysfs-matching into our rules, using the SYSFS key with a slightly different syntax. +

        -This rule says:
        +

        +Here are some examples of rules which match data from sysfs. Further detail will be provided later in this document which will aid you in writing rules based on sysfs attributes. +

        -
        Match a device identified by a KERNEL name starting with the letters "fd", followed by any single digit, optionally followed by anything at all. Name the device with the kernel number of the device (%n) under the floppy directory.
        +
        +KERNEL=="sda", SYSFS{model}=="ST3120827AS", SYMLINK+="my_hard_disk"
        +SUBSYSTEM=="block", SYSFS{size}=="234441648", SYMLINK+="my_disk"
        +BUS=="usb", SYSFS{manufacturer}=="OLYMPUS", SYSFS{product}=="X250,D560Z,C350Z", SYMLINK+="camera"
        +
        -You can use these wildcards/pattern matches in any type of key, including both basic keys and sysfs-based identification (see below for explanations of these key types).

        + +

        String substitutions

        -I have purposely left out some information on this topic (particularly the flexibility of using [ ] operators) that is out of the scope of basic rule-writing documentation. More information on this topic can be found in the udev man page.

        +

        +When writing rules which will potentially handle multiple similar devices, udev's printf-like string substitution operators are very useful. You can simply include these operators in any assignments your rule makes, and udev will evaluate them when they are executed. +

        - -

        Key-writing basics

        +

        +The most common operators are %k and %n. %k evaluates to the kernel name for the device, e.g. "sda3" for a device that would (by default) appear at /dev/sda3. %n evaluates to the kernel number for the device (the partition number for storage devices), e.g. "3" for /dev/sda3. +

        -udev provides a few basic key matching methods, and also provides flexible ways of matching information in SYSFS. A typical rule will match both normal keys (e.g. BUS and KERNEL), as well as SYSFS keys to differentiate between different hardware plugged in throught the same port.

        +

        +udev also provides several other substitution operators for more advanced functionality. Consult the udev man page after reading the rest of this document. There is also an alternative syntax for these operators - $kernel and $number for the examples above. For this reason, if you wish to match a literal % in a rule then you must write %%, and if you wish to match a literal $ then you must write $$. +

        -You may be wondering, "How do I find the serial number of my printer? What is the model of my camera?". Rule writing isn't as hard as it sounds. The trickiest bit is finding your device in /sys, and deciding which info to use.

        +

        +To illustrate the concept of string substitution, some example rules are shown below. +

        - -

        Identifying devices through basic keys

        +
        +KERNEL=="mice", NAME="input/%k"
        +KERNEL=="loop0", NAME="loop/%n", SYMLINK+="%k"
        +
        + +

        +The first rule ensures that the mice device node appears exclusively in the /dev/input directory (by default it would be at /dev/mice). The second rule ensures that the device node named loop0 is created at /dev/loop/0 but also creates a symbolic link at /dev/loop0 as usual. +

        -See the udev man page for more info on these keys.

        +

        +The use of the above rules is questionable, as they all could be rewritten without using any substitution operators. The true power of these substitutions will become apparent in the next section. +

        -The valid keys are: -
        • BUS - match the bus type of the device.
        • -
        • KERNEL - match the kernel device name.
        • -
        • DRIVER - match the name of the kernel driver.
        • -
        • SUBSYSTEM - match the kernel subsystem name.
        • -
        • ID - match the device number on the bus (e.g. PCI bus ID).
        • -
        • PLACE - match the physical position where the device is plugged into (useful for USB).
        • + +

          String matching

          +

          +As well as matching strings exactly, udev allows you to use shell-style pattern matching. There are 3 patterns supported: +

          + +
            +
          • * - match any character, zero or more times
          • +
          • ? - match any character exactly once
          • +
          • [] - match any single character specified in the brackets, ranges are also permitted
          -The ID and PLACE keys do have their uses, but they are not commonly used in rules. This document focuses on using BUS and KERNEL keys, as well as SYSFS{...} keys (detailed in the next section). I will show how to use these keys by example.

          +

          +Here are some examples which incorporate the above patterns. Note the use of the string substitution operators. +

          + +
          +KERNEL=="fd[0-9]*", NAME="floppy/%n", SYMLINK+="%k"
          +KERNEL=="hiddev*", NAME="usb/%k"
          +
          -For extra flexibility, udev also provides keys to call external scripts and examine their result, and to examine environment variables. This is out of scope of this document. Look at the udev man page for more details. +

          +The first rule matches all floppy disk drives, and ensures that the device nodes are placed in the /dev/floppy directory, as well as creating a symbolic link from the default name. The second rule ensures that hiddev devices are only present in the /dev/usb directory. +

          - -

          Identifying devices through SYSFS files

          +

          Finding information from sysfs

          -Background information: SYSFS stores many small files under a tree of directories which provide information about your hardware. One file typically contains just one "data item" - e.g. device name, manufacturer, or product ID.

          -Note that SYSFS{...} keys can be combined with the basic keys described in the previous section.


          + +

          The sysfs tree

          -You can use keys in the format SYSFS{filename} to match specific info from SYSFS, where filename corresponds to a file in your SYSFS tree. For example, when my camera is connected, there is a file located at /sys/block/sda/device/model which contains "USB 2.0M DSC". To match this, I could use the following key: SYSFS{model} == "USB 2.0M DSC"

          +

          +The concept of using interesting information from sysfs was briefly touched upon above. In order to write rules based on this information, you first need to know the names of the attributes and their current values. +

          -Note that any file in sysfs can be matched in this manner, but if you match more than one file (through multiple keys), then you must only match files that exist in the same directory. Typically, there will be several directories giving information about one device. You cannot mix and match (as shown by example below).

          +

          +sysfs is actually a very simple structure. It is logically divided into directories. Each directory contains a number of files (attributes) which typically contain just one value. Some symbolic links are present, which link various parts of the tree together. +

          -Luckily, the process of rule writing does not entail hunting through millions of files in SYSFS, the udevinfo utility does the hard work. This program is included in the udev distribution.

          +

          +Some directories are referred to as top-level device paths. These directories act as the top-level glue which chain other parts of sysfs to the device in question. Top-level device paths can be classified as sysfs directories which contain a dev file, the following command will list these for you: +

          -The first thing you need to do is find a directory somewhere in /sys that corresponds to your hardware, and includes a file named "dev", as udevinfo can only work on directories of this type. These directories are all found under either /sys/block or /sys/class - there is no point looking anywhere else! However, udevinfo will follow links through this directory and read info found from other sections of sysfs.

          +
          # find /sys -name dev
          -Once you have found a directory of this type, you can use the following command to assist you in the creation of writing keys for udev rules: -
          # udevinfo -a -p /sys/path/to/hardware/info
          +

          +For example, on my system, the /sys/block/sda directory is the device path for my hard disk. It is chained to the controller through the /sys/block/sda/device/ symbolic link, which is in turn chained to the device driver through the /sys/block/sda/device/driver/ symbolic link. +

          -You may find that finding the correct place in /sys to run udevinfo on is not obvious. Chances are the device you just plugged in has already careted a device node (e.g. /dev/sda), in which case, udevinfo can be helpful! Taking the example of my /dev/sda node, running the following command will point you to the appropriate area of sysfs: -
          -# udevinfo -q path -n /dev/sda
          +

          +When you write rules based on sysfs information, you are simply matching attribute contents of some files in one part of the chain. For example, I can read the size of my hard disk as follows: +

          -/block/sda +
          +# cat /sys/block/sda/size
          +234441648
           
          -The output of the command (shown above) is telling me that the sysfs path to start at is /sys/block/sda. I would now run "udevinfo -a -p /sys/block/sda". These two commands can be chained together, like so: +

          +In a udev rule, I could use SYSFS{size}=="234441648" to identify this disk. As udev iterates through the entire device chain, I could alternatively opt to match attributes in another part of the chain (e.g. attributes in /sys/class/block/sda/device/), however there are some caveats when dealing with different parts of the chain which are described later. +

          -
          # udevinfo -a -p $(udevinfo -q path -n /dev/sda)
          +

          +Although this serves as a useful introduction as to the structure of sysfs and exactly how udev matches values, manually trawling through sysfs is both time consuming and unnecessary. +

          -Sidenote: You may notice that we previously provided full paths (/sys/some/path) to udevinfo beforehand, but now we are providing sysfs-relative paths (/some/path) by chaining these commands. This does not matter - both types of path are accepted.

          + +

          udevinfo

          -Moving on to rule-writing, some snipped output of the results of my "udevinfo -a -p /sys/block/sda" command is shown below, with colour added.
          +

          +Enter udevinfo, which is probably the most straightforward tool you can use to construct rules. All you need to know is the sysfs device path of the device in question. A trimmed example is shown below: +

          -
          
          -follow the class device's "device"
          -  looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3/3-3:1.0/host0/0:0:0:0':
          -    BUS=="scsi"
          +
          +# udevinfo -a -p /sys/block/sda
          +
          +  looking at device '/block/sda':
          +    KERNEL=="sda"
          +    SUBSYSTEM=="block"
          +    SYSFS{stat}=="  128535     2246  2788977   766188    73998   317300  3132216  5735004        0   516516  6503316"
          +    SYSFS{size}=="234441648"
          +    SYSFS{removable}=="0"
          +    SYSFS{range}=="16"
          +    SYSFS{dev}=="8:0"
          +
          +  looking at device '/devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0':
               ID=="0:0:0:0"
          -    SYSFS{detach_state}=="0"
          +    BUS=="scsi"
          +    DRIVER=="sd"
          +    SYSFS{ioerr_cnt}=="0x0"
          +    SYSFS{iodone_cnt}=="0x31737"
          +    SYSFS{iorequest_cnt}=="0x31737"
          +    SYSFS{iocounterbits}=="32"
          +    SYSFS{timeout}=="30"
          +    SYSFS{state}=="running"
          +    SYSFS{rev}=="3.42"
          +    SYSFS{model}=="ST3120827AS     "
          +    SYSFS{vendor}=="ATA     "
          +    SYSFS{scsi_level}=="6"
               SYSFS{type}=="0"
          -    SYSFS{max_sectors}=="240"
          -    SYSFS{device_blocked}=="0"
          +    SYSFS{queue_type}=="none"
               SYSFS{queue_depth}=="1"
          -    SYSFS{scsi_level}=="3"
          -    SYSFS{vendor}=="        "
          -    SYSFS{model}=="USB 2.0M DSC    "
          -    SYSFS{rev}=="1.00"
          -    SYSFS{online}=="1"
          -
          -  looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
          -    BUS=="usb"
          -    ID=="3-3"
          -    SYSFS{detach_state}=="0"
          -    SYSFS{bNumInterfaces}==" 1"
          -    SYSFS{bConfigurationValue}=="1"
          -    SYSFS{bmAttributes}=="c0"
          -    SYSFS{bMaxPower}=="  0mA"
          -    SYSFS{idVendor}=="052b"
          -    SYSFS{idProduct}=="1514"
          -    SYSFS{bcdDevice}=="0100"
          -    SYSFS{bDeviceClass}=="00"
          -    SYSFS{bDeviceSubClass}=="00"
          -    SYSFS{bDeviceProtocol}=="00"
          -    SYSFS{bNumConfigurations}=="1"
          -    SYSFS{speed}=="12"
          -    SYSFS{manufacturer}=="Tekom Technologies, Inc"
          -    SYSFS{product}=="USB 2.0M DSC"
          -
          - -The udevinfo tool provides a lot of information which you can simply copy-paste as udev rules. The reason that I have colour coded the above output is to point out that you generally cannot mix and match information from different parts of the udevinfo output. In the above output, I could not combine information from the different coloured sections - this is because each section of output refers to a different directory in SYSFS. For example, the following rule would not work: -
          BUS=="scsi", SYSFS{manufacturer}=="Tekom Technologies, Inc", NAME="%k"
          -This rule would not work because I am combining information found in the section beginning with BUS=="scsi" (green) with information only found in the blue section. The rule would work if I used BUS=="usb", sticking only to information found in the blue section above.

          + SYSFS{device_blocked}=="0" +
          -You will notice that a lot of information is not relevant for writing basic rules (there is so much of it!), you should generally be looking for information that you recognise and know will not change (e.g. model name).

          +

          +As you can see, udevinfo simply produces a list of attributes you can use as-is as match keys in your udev rules. From the above example, I could produce (e.g.) either of the following two rules for this device: +

          -Note that if you write your own rule to identify a device, the default devfs-style rules will not take effect! It is usually sensible to use NAME="%k" and specify your own extra names in the SYMLINK parameter so that you do not lose the default sensible names.

          +
          +SUBSYSTEM=="block", SYSFS{size}=="234441648", NAME="my_hard_disk"
          +BUS=="scsi", SYSFS{model}=="ST3120827AS", NAME="my_hard_disk"
          -I will show three examples of this rule writing based on udevinfo output process below. I will then attempt to list some device-dependant tips and tricks for locating the correct info.

          +

          +You may have noted the use of colour in the above examples. This is to demonstrate that you generally can not mix-and-match attributes from different sections of the udevinfo output - your rule will not work. For example, the following rule is invalid: +

          -A reader wrote to me and informed me that he found KDE's control centre useful for writing rules. Apparently, information about USB devices (and others) can be found in the "Info Centre" section of the KDE Control Centre. This interface shows information such as serial number, vendor ID, etc. If you prefer a GUI-like approach, you might want to investigate this.

          +
          +SUBSYSTEM=="block", SYSFS{size}=="234441648", SYSFS{model}=="ST3120827AS", NAME="my_hard_disk"
          -The current releases of gnome-volume-manager are unable to treat symlink-nodes as real devices. Conversely as described above, you may wish to specify your own naming in the NAME parameter and specify %k in the SYMLINK parameter.

          +

          +You are usually provided with a large number of attributes, and you must pick a number of them (from the same section) to construct your rule. In general, you want to choose attributes which identify your device in a persistent and human-recognisable way. In the examples above, I chose the size of my disk and its model number. I did not use meaningless numbers such as SYSFS{iodone_cnt}=="0x31737". +

          -The behaviour of your own rules masking the defaults can be overcome if you write multiple-SYMLINK style rules. +

          +Another point to note is that it is common for text attributes to appear in the udevinfo output to be padded with spaces (e.g. see ST3120827AS above). In your rules, you can either specify the extra spaces, or you can cut them off as I have done. +

          -
          +

          +The only complication with using udevinfo is that you are required to know the top-level device path (/sys/block/sda in the example above). This is not always obvious. However, as you are generally writing rules for device nodes which already exist, you can use udevinfo to look up the device path for you: +

          - -

          Using multiple SYMLINK style rules

          -Another recent feature is the ability to write rules that do not specify a NAME, but instead they simply specify SYMLINK keys. This allows you to avoid the issue where your own rules effectively mask the udev defaults.

          +
          # udevinfo -a -p $(udevinfo -q path -n /dev/sda)
          -Take the rule:
          -
          KERNEL=="hdc", SYMLINK="dvd"
          + +

          Alternative methods

          -When udev finds this rule, it will take a mental note of it. Upon finding another rule matching the same device which also includes a NAME parameter, udev will create the node as specified by the NAME parameter, plus symbolic links as specified by the SYMLINK parameters of both rules.
          -To put it into practical terms, when udev is naming nodes for my hdc device, it will use the default rules for block devices as usual, with the addition of my personal symlink "dvd".

          +

          +Although udevinfo is almost certainly the most straightforward way of listing the exact attributes you can build rules from, some users are happier with other tools. Utilities such as usbview display a similar set of information, most of which can be used in rules. +

          -Similarly to normal rules, rules of this type will only take effect if udev is able to find them before it finds a rule specifying a NAME parameter.

          +

          Advanced topics

          - -

          Controlling ownership and permissions

          + +

          Controlling permissions and ownership

          -As well as controlling the naming of the device nodes which are created, udev rules also allow you to control ownership and permission attributes on that device node.

          +

          +udev allows you to use additional assignments in rules to control ownership and permission attributes on each device. +

          -The GROUP key allows you to define which unix group should own the device node. Here's an example from the udev defaults, which defines that the video group will own framebuffer (fb) devices: +

          +The GROUP assignment allows you to define which Unix group should own the device node. Here is an example rule which defines that the video group will own the framebuffer devices: +

          -
          KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video"
          +
          KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video"
          -The OWNER key, perhaps less useful, allows you to define which unix user should own the device node. Assuming the slightly odd situation where you would want "john" to own your floppy devices, you could use: +

          +The OWNER key, perhaps less useful, allows you to define which Unix user should have ownership permissions on the device node. Assuming the slightly odd situation where you would want john to own your floppy devices, you could use: +

          KERNEL=="fd[0-9]*", OWNER="john"
          -You'll notice in the above rule that we didn't specify any NAME or SYMLINK keys. This is similar to the multiple symlink style where udev will take a mental note that we want john to own floppy nodes, and will apply that ownership once it finds a rule which defines a NAME for the floppy device nodes.

          +

          +udev defaults to creating nodes with Unix permissions of 0660 (read/write to owner and group). If you need to, you can override these defaults on certain devices using rules including the MODE assignment. As an example, the following rule defines that the inotify node shall be readable and writable to everyone: +

          + +
          KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666"
          + + +

          Using external programs to name devices

          + +

          +Under some circumstances, you may require more flexibility than standard udev rules can provide. In this case, you can ask udev to run a program and use the standard output from that program to provide device naming. +

          + +

          +To use this functionality, you simply specify the absolute path of the program to run (and any parameters) in the PROGRAM assignment, and you then use some variant of the %c substitution in the NAME/SYMLINK assignments. +

          + +

          +The following examples refer to a fictional program found at /bin/device_namer. device_namer takes one command line argument which is the kernel name for the device. Based upon this kernel name, device_namer does its magic and produces some output to the usual stdout pipe, split into several parts. Each part is just a single word, and parts are separated by a single space. +

          + +

          +In our first example, we assume that device_namer outputs a number of parts, each one to form a symbolic link (alternative name) for the device in question. +

          + +
          KERNEL=="hda", PROGRAM="/bin/device_namer %k", SYMLINK+="%c"
          + +

          +The next example assumes that device_namer outputs two parts, the first being the device name, and the second being the name for an additional symbolic link. We now introduce the %c{N} substitution, which refers to part N of the output: +

          + +
          KERNEL=="hda", PROGRAM="/bin/device_namer %k", NAME="%c{1}", SYMLINK+="%c{2}"
          + +

          +The next example assumes that device_namer outputs one part for the device name, followed by any number of parts which will form additional symbolic links. We now introduce the %c{N+} substitution, which evaluates to part N, N+1, N+2, ... until the end of the output. +

          + +
          KERNEL=="hda", PROGRAM="/bin/device_namer %k", NAME="%c{1}", SYMLINK+="%c{2+}"
          -Building on the style mentioned above, you can do even more flashy things. The udev defaults use the following rule to define that all the sound device nodes shall be owned by the "audio" group: +

          +Output parts can be used in any assignment key, not only NAME and SYMLINK. The example below uses a fictional program to determine the Unix group which should own the device: +

          -
          SUBSYSTEM=="sound", GROUP="audio"
          +
          KERNEL=="hda", PROGRAM="/bin/who_owns_device %k", GROUP="%c"
          -This prevents the need to excessively provide a GROUP=="audio" key on every following rule which names sound devices.

          + +

          Running external programs upon certain events

          -udev defaults to creating nodes with unix permissions of 0660 (read/write to owner and group). There may be some situations where you do not want to use the default permissions on your device node. Fortunately, you can easily override the permissions in your rules using the MODE assignment key. As an example, the following rule defines that the inotify node shall be readable and writable to everyone: +

          +Yet another reason for writing udev rules is to run a particular program when a device is connected or disconnected. For example, you might want to execute a script to automatically download all of your photos from your digital camera when it is connected. +

          -
          KERNEL=="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666"
          +

          +Do not confuse this with the PROGRAM functionality described above. PROGRAM is used for running programs which produce device names (and they shouldn't do anything other than that). When those programs are being executed, the device node has not yet been created, so acting upon the device in any way is not possible. +

          + +

          +The functionality introduced here allows you to run a program after the device node is put in place. This program can act on the device, however it must not run for any extended period of time, because udev is effectively paused while these programs are running. One workaround for this limitation is to make sure your program immediately detaches itself. +

          + +

          +Here is an example rule which demonstrates the use of the RUN list assignment: +

          + +
          KERNEL=="sdb", RUN+="/usr/bin/my_program"
          + +

          +When /usr/bin/my_program is executed, various parts of the udev environment are available as environment variables, including key values such as SUBSYSTEM. You can also use the ACTION environment variable to detect whether the device is being connected or disconnected - ACTION will be either "add" or "remove" respectively. +

          + + +

          Environment interaction

          + +

          +udev provides an ENV key for environment variables which can be used for both matching and assignment. +

          + +

          +In the assignment case, you can set environment variables which you can then match against later. You can also set environment variables which can be used by any external programs invoked using the techniques mentioned above. A fictional example rule which sets an environment variable is shown below. +

          + +
          KERNEL=="fd0", SYMLINK+="floppy", ENV{some_var}="value"
          + +

          +In the matching case, you can ensure that rules only run depending on the value of an environment variable. Note that the environment that udev sees will not be the same user environment as you get on the console. A fictional rule involving an environment match is shown below. +

          + +
          KERNEL=="fd0", ENV{an_env_var}=="yes", SYMLINK+="floppy"
          + +

          +The above rule only creates the /dev/floppy link if $an_env_var is set to "yes" in udev's environment. +

          + + +

          Additional options

          + +

          +Another assignment which can prove useful is the OPTIONS list. A few options are available: +

          + +
            +
          • all_partitions - create all possible partitions for a block device, rather than only those that were initially detected
          • +
          • ignore_device - ignore the event completely
          • +
          • last_rule - ensure that no later rules have any effect
          • +
          + +

          +For example, the rule below sets the group ownership on my hard disk node, and ensures that no later rule can have any effect: +

          + +
          KERNEL=="sda", GROUP="disk", OPTIONS+="last_rule"
          + + +

          Examples

          -

          Example: Writing a rule for my USB printer

          +

          USB Printer

          -After plugging in my printer, I started looking around some /sys directories for a relevant place to start. I didn't get anywhere, but I noticed that my printer had been given device node /dev/lp0. udevinfo was able to provide me with a useful path: -
          -# udevinfo -q path -n /dev/lp0
          -/class/usb/lp0
          -
          +

          +I power on my printer, and it is assigned device node /dev/lp0. Not satisfied with such a bland name, I decide to use udevinfo to aid me in writing a rule which will provide an alternative name: +

          -Running "udevinfo -a -p /sys/class/usb/lp0" provided me with a heap of info, as usual. I picked out the relevant bits for unique device identification:
          +# udevinfo -a -p $(udevinfo -q path -n /dev/lp0)
           looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
           BUS=="usb"
           SYSFS{manufacturer}=="EPSON"
          @@ -343,148 +629,211 @@ SYSFS{product}=="USB Printer"
           SYSFS{serial}=="L72010011070626380"
           
          -My udev rule becomes: -
          BUS=="usb", SYSFS{serial}=="L72010011070626380", NAME="%k", SYMLINK="epson_680"
          +

          +My rule becomes: +

          -And my printer nodes exist at /dev/lp0 (or /dev/lp1 if another printer was plugged in beforehand) and /dev/epson_680 always points at the device node for that particular printer.

          +
          BUS=="usb", SYSFS{serial}=="L72010011070626380", SYMLINK+="epson_680"
          -

          Example: Writing a rule for my USB-Storage digital camera

          - -Quick Intro: My camera identifies itself as an external SCSI hard disk (it uses the usb-storage driver which is also used by devices such as USB hard disks and flash-card readers). I can then mount the partition on that disk and copy images over. Not all cameras work like this - many require external software (e.g. gphoto2) to be able to access photos.

          +

          USB Camera

          -This one is a bit tricky. Several nodes are created by default when my camera is connected : /dev/sda and /dev/sda1, and possibly even /dev/sg1. This is an example where specifity is important - if your rule is not specific enough, it could match any of the above 3 nodes.

          +

          +Like most, my camera identifies itself as an external hard disk connected over the USB bus, using the SCSI transport. To access my photos, I mount the drive and copy the image files onto my hard disk. +

          -sda1 is the node that I would like as my /dev/camera, as that is what gets mounted. udevinfo did not point out any useful differences between sda, sda1, and sg1. I decided that a reliable way to differentiate between these 3 nodes would be to look at the KERNEL name.

          +

          +Not all cameras work in this way: some of them use a non-storage protocol such as cameras supported by gphoto2. In the gphoto case, you do not want to be writing rules for your device, as is it controlled purely through userspace (rather than a specific kernel driver). +

          -A key such as KERNEL=="sd?1" would match KERNEL names such as "sda1", "sdb1", "sdc1", and equally importantly, it will not match KERNEL names such as sda, sdb, or sg1. The purpose of this key is to ignore the /dev/sda and /dev/sg1 nodes. The device is a digital camera - I would not dream of fdisking it or anything like that, so these 2 nodes are pretty useless to me. The key attempts to capture the /dev/sda1 node, which is mountable and therefore useful!

          +

          +A common complication with USB camera devices is that they usually identify themselves as a disk with a single partition, in this case /dev/sdb with /dev/sdb1. The sdb node is useless to me, but sdb1 is interesting - this is the one I want to mount. There is a problem here that because sysfs is chained, the useful attributes which udevinfo produces for /dev/sdb1 are identical to the ones for /dev/sdb. This results in your rule potentially matching both the raw disk and the partition, which is not what you want, your rule should be specific. +

          -As this node (sda1) is treated as a block device, looking in /sys/block would be a good place to start.

          +

          +To get around this, you simply need to think about what differs between sdb and sdb1. It is surprisingly simple: the name itself differs, so we can use a simple pattern match on the NAME field. +

          -In my /sys/block, I have a directory named sda. In my /sys/block/sda, I have a directory named sda1. Both of these directories have dev files in, so they are OK to run udevinfo on. Running the following dumps a lot of information about my camera and the USB port it is connected through. - -
          # udevinfo -a -p /sys/block/sda/sda1
          +
          +# udevinfo -a -p $(udevinfo -q path -n /dev/sdb1)
          +  looking at device '/devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/host6/target6:0:0/6:0:0:0':
          +    ID=="6:0:0:0"
          +    BUS=="scsi"
          +    DRIVER=="sd"
          +    SYSFS{rev}=="1.00"
          +    SYSFS{model}=="X250,D560Z,C350Z"
          +    SYSFS{vendor}=="OLYMPUS "
          +    SYSFS{scsi_level}=="3"
          +    SYSFS{type}=="0"
          +
          -In the udevinfo output, I also noticed this bit of useful and understandable information: -
          SYSFS{product}=="USB 2.0M DSC"
          +

          +My rule: +

          -So that gives me my rule. For completeness, I also include a BUS key (this was also found in the udevinfo output). -
          BUS=="usb", SYSFS{product}=="USB 2.0M DSC", KERNEL=="sd?1", NAME="%k", SYMLINK="camera"
          +
          NAME=="sd?1", BUS=="scsi", SYSFS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"
          -Now, when my camera is plugged in, it will be named /dev/sda1 (or, if sda1 isnt available, it might be called /dev/sdb1) and will always be correctly linked to from /dev/camera. The /dev/sda (or sdb) node still appears as normal, but the important thing is that my custom persistent "camera" symlink points to the mountable partition.

          + +

          USB Hard Disk

          - -

          Additional notes on writing rules for USB storage

          +

          +A USB hard disk is comparable to the USB camera I described above, however typical usage patterns are different. In the camera example, I explained that I am not interested in the sdb node - it's only real use is for partitioning (e.g. with fdisk), but why would I want to partition my camera!? +

          -Carl Streeter, the owner of a large USB hard disk, wrote to me and explained that unlike in my digital camera example, the /dev/sda node is useful to him. He pointed out that he does occasionally need to use tools such as fdisk and hdparm on that node.

          +

          +Of course, if you have a 100GB USB hard disk, it is perfectly understandable that you might want to partition it, in which case we can take advantage of udev's string substitutions: +

          -Carl's rule is: -
          BUS=="usb", KERNEL=="sd*", SYSFS{product}=="USB 2.0 Storage Device", NAME="%k", SYMLINK="usbhd%n"
          +
          BUS=="usb", KERNEL=="sd*", SYSFS{product}=="USB 2.0 Storage Device", NAME="%k", SYMLINK+="usbhd%n"
          +

          This rule creates symlinks such as: -

            -
          • /dev/usbhd - The fdiskable node
          • -
          • /dev/usbhd1 - The first partition (mountable)
          • -
          • /dev/usbhd2 - The second partition (mountable)
          • +

            +
              +
            • /dev/usbhd - The fdiskable node
            • +
            • /dev/usbhd1 - The first partition (mountable)
            • +
            • /dev/usbhd2 - The second partition (mountable)
            -We agreed that depending on the situation and device in question, there are reasons for both wanting and not wanting the non-mountable /dev/sda node. Use whichever setup suits you best.

            + +

            USB Card Reader

            -Another difficult situation is having a multiple-slot USB-storage card reader. These types of device generally do not inform the host when new cards are plugged in or out, so plugging a card into an unused slot while the reader is plugged in will not create the extra device node needed for mounting!
            -This problem also applies to other USB disks - e.g. if you create a new partition, the new partition node will not appear until you re-plug the device.

            +

            +USB card readers (CompactFlash, SmartMedia, etc) are yet another range of USB storage devices which have different usage requirements. +

            -udev provides a solution here - it is able to create nodes for all partitions of a block device. For every rule that you specify, the block device will have all 16 partition nodes created. To achieve this, you can simply modify the NAME key, as shown below:
            +

            +These devices typically do not inform the host computer upon media change. So, if you plug in the device with no media, and then insert a card, the computer does not realise, and you do not have your mountable sdb1 partition node for the media. +

            -
            BUS=="usb", SYSFS{product}=="USB 2.0 Storage Device", NAME{all_partitions}="usbhd"
            +

            +One possible solution is to take advantage of the all_partitions option, which will create 16 partition nodes for every block device that the rule matches: +

            -You will now have nodes named: usbhd, usbhd1, usbhd2, usbhd3, ..., usbhd15.

            +
            BUS=="usb", SYSFS{product}=="USB 2.0 CompactFlash Reader", SYMLINK+="cfrdr%n", OPTIONS+="all_partitions"
            - -

            Example: Writing convenience rules for my CD drives

            -I have two CD drives in my PC - a DVD reader, and a CD rewriter. My DVD is hdc and my CDRW is hdd. I would not expect this to change, unless I manually changed the cabling of my system.

            +You will now have nodes named: cfrdr, cfrdr1, cfrdr2, cfrdr3, ..., cfrdr15. -Still, some people (myself included) like to have nodes such as /dev/dvd and /dev/cdrw for convenience. Since we know the "hdX" values for these drives, writing rules is simple. The examples below should be self explanatory. + +

            USB Palm Pilot

            -
            -BUS=="ide", KERNEL=="hdc", NAME="%k", SYMLINK="dvd cdroms/cdrom%n"
            -BUS=="ide", KERNEL=="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n"
            -
            +

            +These devices work as USB-serial devices, so by default, you only get the ttyUSB1 device node. The palm utilities rely on /dev/pilot, so many users will want to use a rule to provide this. +

            + +

            +Carsten Clasohm's blog post appears to be the definitive source for this. Carsten's rule is shown below: +

            -You may have noticed that the default 50-udev.rules file contains a rule which runs a script to produces names for block devices. Do not be confused by this - as usual, because your own rules are located in a file which is processed before the default rules, the defaults will not be used when naming the hardware you have written rules for.

            +
            BUS=="usb", SYSFS{product}=="Palm Handheld", KERNEL=="ttyUSB*", SYMLINK+="pilot"
            - -

            Example: Writing a rule for your USB Visor Palm Pilot

            +

            +Note that the product string seems to vary from product to product, so make sure that you check (using udevinfo) which one applies to you. +

            -These devices work as USB-serial devices, so by default, you only get the ttyUSB1 node. The user-space palm utilities rely on /dev/pilot, so you need to use a rule to create this. The following rule will do the job:

            + +

            CD/DVD drives

            -
            BUS=="usb", SYSFS{product}=="Palm Handheld", KERNEL=="ttyUSB*", SYMLINK="pilot"
            +

            +I have two optical drives in this computer: a DVD reader (hdc), and a DVD rewriter (hdd). I do not expect these device nodes to change, unless I physically rewire my system. However, many users like to have device nodes such as /dev/dvd for convenience. +

            -This was adapted from Carsten Clasohm's blog entry, which includes a useful discussion of the situation. You may also wish to add ownership and permission keys to the rule to suit your setup.

            +

            +As we know the KERNEL names for these devices, rule writing is simple. Here are some examples for my system: +

            - -

            Example: Writing a rule to name my network interface

            -An interesting new feature in recent udev versions is the ability to rename your network interfaces, like the nameif utility does. Network interfaces do not show up in /dev, but they are generally referenced by names (e.g. with ifconfig). Despite the differences, the rule writing process is almost identical.

            +
            +BUS=="ide", KERNEL=="hdc", SYMLINK+="dvd", GROUP="cdrom"
            +BUS=="ide", KERNEL=="hdd", SYMLINK+="dvdrw", GROUP="cdrom"
            +
            -As usual, udevinfo comes to our aid in rule-writing. In my example, I wish to rename my "eth0" network device (the following output is snipped): + +

            Network interfaces

            + +

            +Even though they are referenced by names, network interfaces typically do not have device nodes associated with them. Despite that, the rule writing process is almost identical. +

            + +

            +It makes sense to simply match the MAC address of your interface in the rule, as this is unique. However, make sure that you use the exact MAC address as shown as udevinfo, because if you do not match the case exactly, your rule will not work. +

            -# udevinfo -a -p /sys/class/net/eth0/
            +# udevinfo -a -p /sys/class/net/eth0
               looking at class device '/sys/class/net/eth0':
                 SYSFS{address}=="00:52:8b:d5:04:48"
             
            -Every network adapter has its own unique MAC-address, so I chose to use this when writing my rule. This will not change, unless you change your network card. There is one caveat here: make sure you use the MAC address you obtain from udevinfo (as above), because it is case sensitive. Be careful when using utilities such as ifconfig as they will capitalize the letters.

            - -An example rule is shown below: +

            +Here is my rule: +

            KERNEL=="eth*", SYSFS{address}=="00:52:8b:d5:04:48", NAME="lan"
            -You will need to reload the net driver for this rule to take effect. You can either unload and reload the module, or simply reboot the system. You will also need to reconfigure your system to use "lan" rather than "eth0". I had some troubles getting this going (the interface wasn't being renamed) until I had completely dropped all references to eth0.
            -After that, you should be able to use "lan" instead of "eth0" in any calls to ifconfig or similar utilities.

            +

            +You will need to reload the net driver for this rule to take effect. You can either unload and reload the module, or simply reboot the system. You will also need to reconfigure your system to use "lan" rather than "eth0". I had some troubles getting this going (the interface wasn't being renamed) until I had completely dropped all references to eth0. +After that, you should be able to use "lan" instead of "eth0" in any calls to ifconfig or similar utilities. +

            - -

            Tips for finding the appropriate places in SYSFS

            -I'm looking for some more device specific tips here. Please contact me with any you can provide. +

            Testing and debugging

            -
              -
            • If the device you are looking to write rules for has created a device node under /dev, then you are in luck! Run the following command to get an appropriate /sys path: udevinfo -q path -n /dev/yournode
            • -
            • Always use udevinfo to assist the rule-writing process. Always use udevinfo to look under /sys/block or /sys/class (it will not start reading a chain from anywhere else).
            • -
            • If you get totally stuck, use the following command to find all "dev" files under /sys (udevinfo can work on directories containing this file): find /sys -iname dev
            • -
            • If your device is a flash-card reader, usb flash-drive, or digital camera that acts as usb-storage, that is created as /dev/sdX, then start looking in /sys/block/sdX.
            • -
            • If applicable, make sure you identify the difference between sdX and sdX1 in the above situation. This can be done with the key KERNEL="sd?1" to match sdX1, or KERNEL=="sd?" to match sdX.
            • -
            • For USB printers that are created as /dev/lpX, then you should start looking in /sys/class/usb/lpX.
            • - -
            • The usb scanner driver has recently been removed from the kernel and re-implemented in userspace (as part of the SANE package). You do not (and can not) write rules for this hardware as it does not rely on specific kernel drivers.
            • -
            • Remember that unfortunately, the kernel does not export information for all devices into sysfs, meaning that you simply can't write rules for some devices yet. On 20/02/04, the udev author stated that there are 162 drivers left to convert to sysfs.
            • -
            + +

            Putting your rules into action

            + +

            +Assuming you are on a recent kernel with inotify support, udev will automatically monitor your rules directory and automatically pick up any modifications you make to the rule files. +

            - -

            Debugging your rules

            +

            +Despite this, udev will not automatically reprocess all devices and attempt to apply the new rule(s). For example, if you write a rule to add an extra symbolic link for your camera while your camera is plugged in, you cannot expect the extra symbolic link to show up right away. +

            -If you have written rules and remembered to run udevstart but they do not appear to be taking effect, there are a couple of ways you can debug them.

            +

            +To make the symbolic link show up, you can either disconnect and reconnect your camera, or alternatively in the case of non-removable devices, you can run udevtrigger. +

            -The file /etc/udev/udev.conf contains a udev_log option. Setting this option to yes will cause udev to log some useful information about which rules are being applied to which nodes into the system logger. The logs will be included in /var/log/messages for most users.

            +

            +If your kernel does not have inotify support, new rules will not be detected automatically. In this situation, you must run udevcontrol reload_rules after making any rule file modifications for those modifications to take effect. +

            -Additionally, if you know the path in sysfs for the node you want to create, you can use udevtest to see a rundown on what udev would do with the node. For example: + +

            udevtest

            -
            # udevtest /sys/class/sound/dsp/
            -version 056
            -looking at '/class/sound/dsp/'
            -opened class_dev->name='dsp'
            -configured rule in '/etc/udev/rules.d/50-udev.rules[132]' applied, added symlink '%k'
            -configured rule in '/etc/udev/rules.d/50-udev.rules[132]' applied, 'dsp' becomes 'sound/%k'
            -creating device node '/dev/sound/dsp', major = '14', minor = '3', mode = '0660', uid = '0', gid = '18'
            +

            +If you know the top-level device path in sysfs, you can use udevtest to show the actions which udev would take. This may help you debug your rules. For example, assuming you want to debug a rule which acts on /sys/class/sound/dsp: +

            -udevtest is only a debugging/testing tool - it does not actually create the device node, even though it says it doing so!

            +
            +# udevtest /class/sound/dsp
            +main: looking at device '/class/sound/dsp' from subsystem 'sound'
            +udev_rules_get_name: add symlink 'dsp'
            +udev_rules_get_name: rule applied, 'dsp' becomes 'sound/dsp'
            +udev_device_event: device '/class/sound/dsp' already known, remove possible symlinks
            +udev_node_add: creating device node '/dev/sound/dsp', major = '14', minor = '3', mode = '0660', uid = '0', gid = '18'
            +udev_node_add: creating symlink '/dev/dsp' to 'sound/dsp'
            +
            + +

            +Note the /sys prefix was removed from the udevtest command line argument, this is because udevtest operates on device paths. Also note that udevtest is purely a testing/debugging tool, it does not create any device nodes, despite what the output suggests! +

            -

            Author and Credits

            -This document is written by Daniel Drake <dan@reactivated.net>
            -Please do not hesitate to send feedback!

            +

            Author and contact

            -Copyright (C) 2003-2005 Daniel Drake
            +

            +This document is written by Daniel Drake <dan@reactivated.net>. Feedback is appreciated. +

            + +

            +For support, you should mail the linux-hotplug mailing list: linux-hotplug-devel@lists.sourceforge.net. +

            + +

            +Copyright (C) 2003-2006 Daniel Drake.
            This document is licensed under the GNU General Public License, Version 2. +

            + -- cgit v1.2.3-54-g00ecf From 521e3f78084bbdf6ddb628322084e17cb19b810b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 11 Jun 2006 17:11:27 +0200 Subject: add persistent-input.rules --- etc/udev/60-persistent-input.rules | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 etc/udev/60-persistent-input.rules diff --git a/etc/udev/60-persistent-input.rules b/etc/udev/60-persistent-input.rules new file mode 100644 index 0000000000..c177e1f19c --- /dev/null +++ b/etc/udev/60-persistent-input.rules @@ -0,0 +1,28 @@ +ACTION!="add", GOTO="persistent_input_end" +SUBSYSTEM!="input", GOTO="persistent_input_end" +KERNEL=="input[0-9]*", GOTO="persistent_input_end" + +# usb devices +BUS=="usb", IMPORT{program}="usb_id -x" +BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" +BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" + +# other devices +DRIVER=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVER=="atkbd", ENV{ID_CLASS}="kbd" +DRIVER=="psmouse", ENV{ID_CLASS}="mouse" +SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" + +ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + +# by-id links +KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" + +# by-path +IMPORT{program}="path_id %p" +ENV{ID_PATH}=="?*", KERNEL=="mouse*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" + +LABEL="persistent_input_end" + -- cgit v1.2.3-54-g00ecf From a924bf9a8214a8b0b7586b6b5d8bcfc6e962c36d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Jun 2006 10:27:03 +0200 Subject: 094 release --- ChangeLog | 15 +++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 4 ++++ TODO | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5248e1662c..f3ec138811 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +Summary of changes from v093 to v094 +============================================ + +Daniel Drake: + update "writing udev rules" + +Kay Sievers: + libvolume_id: gfs + gfs2 support + remove MODALIAS key and substitution + add persistent-input.rules + +Marco d'Itri: + update Debian rules + + Summary of changes from v092 to v093 ============================================ diff --git a/Makefile b/Makefile index 54905512ee..85a0b8ae82 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 093 +VERSION = 094 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a60d6d77ed..2975920e0c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 094 +======== +The built-in MODALIAS key and substitution is removed. + udev 093 ======== The binary firmware helper is replaced by the usual simple diff --git a/TODO b/TODO index ba12632374..cabb59cfb7 100644 --- a/TODO +++ b/TODO @@ -8,7 +8,7 @@ These things are deprecated and scheduled for removal in a future udev version: o remove broken %e enumeration - (simple enumerations can't work and should go) + (simple enumerations can't work reliably and should go) o remove udevstart (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer -- cgit v1.2.3-54-g00ecf From afb66e32335d7bea55b015855089df4779916829 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Jun 2006 20:28:35 +0200 Subject: update SUSE rules --- etc/udev/suse/45-isdn.rules | 50 ------------------------------- etc/udev/suse/60-persistent-input.rules | 4 +-- etc/udev/suse/60-persistent-storage.rules | 22 +++++++------- 3 files changed, 12 insertions(+), 64 deletions(-) delete mode 100644 etc/udev/suse/45-isdn.rules diff --git a/etc/udev/suse/45-isdn.rules b/etc/udev/suse/45-isdn.rules deleted file mode 100644 index ef2912d160..0000000000 --- a/etc/udev/suse/45-isdn.rules +++ /dev/null @@ -1,50 +0,0 @@ -# CAPI devices -SUBSYSTEM="capi", GROUP="dialout" -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# ISDN devices -KERNEL=="isdn*", NAME="%k", MODE="600" -KERNEL=="isdnctrl*", NAME="%k", MODE="600" -KERNEL=="ippp*", NAME="%k", MODE="600" -KERNEL=="isdninfo*", NAME="%k", MODE="444" - -# ISDN USB -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/c00*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/1000*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/1900*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2000*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2200*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2300*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2800*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3000*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3500*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/3600*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2805*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/2806*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/4401*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="57c/4601*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="483/4810*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="959/2bd0*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" -SUBSYSTEM=="usb", ENV{PRODUCT}=="9bf/*", RUN+="/lib/udev/isdn.sh", ENV{SYSCONFIG}="no" - -# ISDN PCMCIA -# AVM B1 models -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb845DC335pc*pd*", RUN+="/lib/udev/isdn.sh b1 1", ENV{SYSCONFIG}="no" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb81E10430pc*pd*", RUN+="/lib/udev/isdn.sh b1 2", ENV{SYSCONFIG}="no" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pb18E8558Apc*pd*", RUN+="/lib/udev/isdn.sh b1 3", ENV{SYSCONFIG}="no" -# AVM A1 models (aka Fritz!Card PCMCIA) -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa95D42008pbADC9D4BBpc*pd*", RUN+="/lib/udev/isdn.sh a1 1", ENV{SYSCONFIG}="no" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa8D9761C8pb01C5AA7Bpc*pd*", RUN+="/lib/udev/isdn.sh a1 2", ENV{SYSCONFIG}="no" -# teles -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa67B50EAEpbE9E70119pc*pd*", RUN+="/lib/udev/isdn.sh teles 1", ENV{SYSCONFIG}="no" -# sedlbauer -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbF3612E1Dpc6B95C78Apd*", RUN+="/lib/udev/isdn.sh sedlbauer 1", ENV{SYSCONFIG}="no" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc397B7E90pd*", RUN+="/lib/udev/isdn.sh sedlbauer 2", ENV{SYSCONFIG}="no" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc2E5C7FCEpd*", RUN+="/lib/udev/isdn.sh sedlbauer 3", ENV{SYSCONFIG}="no" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pc8DB143FEpd*", RUN+="/lib/udev/isdn.sh sedlbauer 4", ENV{SYSCONFIG}="no" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa81FB79F5pbE4E9BC12pcB391AB4Cpd*", RUN+="/lib/udev/isdn.sh sedlbauer 5", ENV{SYSCONFIG}="no" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*paD79E0B84pb21D083AEpc*pd*", RUN+="/lib/udev/isdn.sh sedlbauer 6", ENV{SYSCONFIG}="no" -# elsa -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa983DE2C4pb333BA257pc*pd*", RUN+="/lib/udev/isdn.sh elsa 1", ENV{SYSCONFIG}="no" -SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="pcmcia:m*c*f*fn*pfn*pa639E5718pb333BA257pc*pd*", RUN+="/lib/udev/isdn.sh elsa 2", ENV{SYSCONFIG}="no" diff --git a/etc/udev/suse/60-persistent-input.rules b/etc/udev/suse/60-persistent-input.rules index fffbf572de..2fd530b712 100644 --- a/etc/udev/suse/60-persistent-input.rules +++ b/etc/udev/suse/60-persistent-input.rules @@ -3,7 +3,7 @@ SUBSYSTEM!="input", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" # usb devices -BUS=="usb", IMPORT{program}="/sbin/usb_id -x" +BUS=="usb", IMPORT{program}="usb_id -x" BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" @@ -12,7 +12,7 @@ KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" # by-path -IMPORT{program}="/sbin/path_id %p" +IMPORT{program}="path_id %p" ENV{ID_PATH}=="?*", KERNEL=="mouse*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index bba529aab7..5a63a4fa70 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -5,7 +5,7 @@ ACTION!="add", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_storage_end" +KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" # never access removable ide devices, the drivers are causing event loops on open() KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" @@ -15,36 +15,34 @@ KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" # by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/sbin/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="/sbin/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/sbin/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", IMPORT{program}="/sbin/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" +IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/sbin/edd_id --export $tempnode" +KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" - LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From fa33d857e2cdd65d3de2f88021ecacf167fc21f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Jun 2006 16:32:52 +0200 Subject: don't remove symlinks if they are already there Consecutive "add" events will not remove and recreate the same symlinks anymore. No longer valid links, like after changing a filesystem label, will still be removed. --- test/udev-test.pl | 1 + udev_device.c | 35 ++++++++++++++++++++++++++++------- udev_node.c | 39 ++++++++++++++++++++++++++++++++------- 3 files changed, 61 insertions(+), 14 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 33da68a386..fafaa96ab6 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -862,6 +862,7 @@ EOF devpath => "/class/tty/tty0", exp_name => "link", exp_target => "link", + exp_add_error => "yes", exp_rem_error => "yes", option => "clean", rules => <dev->devpath) == 0) { - info("device '%s' already known, remove possible symlinks", udev->dev->devpath); - udev_node_remove_symlinks(udev_old); - } - udev_device_cleanup(udev_old); + if (udev_db_get_device(udev_old, udev->dev->devpath) != 0) { + udev_device_cleanup(udev_old); + udev_old = NULL; + } else + info("device '%s' already in database, validate currently present symlinks", + udev->dev->devpath); } - /* create node and symlinks, store record in database */ + /* create node and symlinks */ retval = udev_node_add(udev, udev_old); - if (retval == 0) + if (retval == 0) { + /* store record in database */ udev_db_add_device(udev); + + /* remove possibly left-over symlinks */ + if (udev_old != NULL) { + struct name_entry *link_loop; + struct name_entry *link_old_loop; + struct name_entry *link_old_tmp_loop; + + /* remove still valid symlinks from old list */ + list_for_each_entry_safe(link_old_loop, link_old_tmp_loop, &udev_old->symlink_list, node) + list_for_each_entry(link_loop, &udev->symlink_list, node) + if (strcmp(link_old_loop->name, link_loop->name) == 0) { + dbg("symlink '%s' still valid, keep it", link_old_loop->name); + list_del(&link_old_loop->node); + free(link_old_loop); + } + udev_node_remove_symlinks(udev_old); + udev_device_cleanup(udev_old); + } + } goto exit; } diff --git a/udev_node.c b/udev_node.c index 2a30fe3222..ee59d4ae7c 100644 --- a/udev_node.c +++ b/udev_node.c @@ -90,6 +90,36 @@ exit: return retval; } +static int udev_node_symlink(struct udevice *udev, const char *linktarget, const char *filename) +{ + char target[PATH_SIZE]; + int len; + + /* look if symlink already exists */ + len = readlink(filename, target, sizeof(target)); + if (len > 0) { + target[len] = '\0'; + if (strcmp(linktarget, target) == 0) { + info("preserving symlink '%s' to '%s'", filename, linktarget); + selinux_setfilecon(filename, NULL, S_IFLNK); + goto exit; + } else { + info("link '%s' points to different target '%s', delete it", filename, target); + unlink(filename); + } + } + + /* create link */ + info("creating symlink '%s' to '%s'", filename, linktarget); + selinux_setfscreatecon(filename, NULL, S_IFLNK); + if (symlink(linktarget, filename) != 0) + err("symlink(%s, %s) failed: %s", linktarget, filename, strerror(errno)); + selinux_resetfscreatecon(); + +exit: + return 0; +} + int udev_node_add(struct udevice *udev, struct udevice *udev_old) { char filename[PATH_SIZE]; @@ -205,13 +235,8 @@ int udev_node_add(struct udevice *udev, struct udevice *udev_old) strlcat(linktarget, &udev->name[tail], sizeof(linktarget)); info("creating symlink '%s' to '%s'", filename, linktarget); - if (!udev->test_run) { - unlink(filename); - selinux_setfscreatecon(filename, NULL, S_IFLNK); - if (symlink(linktarget, filename) != 0) - err("symlink(%s, %s) failed: %s", linktarget, filename, strerror(errno)); - selinux_resetfscreatecon(); - } + if (!udev->test_run) + udev_node_symlink(udev, linktarget, filename); strlcat(symlinks, filename, sizeof(symlinks)); strlcat(symlinks, " ", sizeof(symlinks)); -- cgit v1.2.3-54-g00ecf From 3c9e5740eb326de81f9611a8b77ae843700b0a81 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Jun 2006 18:12:01 +0200 Subject: allow "online" events to create/update symlinks --- udev_device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev_device.c b/udev_device.c index a7a8b13c96..ab4965c3a1 100644 --- a/udev_device.c +++ b/udev_device.c @@ -114,7 +114,8 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) int retval = 0; /* add device node */ - if (major(udev->devt) != 0 && strcmp(udev->action, "add") == 0) { + if (major(udev->devt) != 0 && + (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "online") == 0)) { struct udevice *udev_old; dbg("device node add '%s'", udev->dev->devpath); -- cgit v1.2.3-54-g00ecf From 6cf19e52c39eab9a13be4afc0d1d45318cd530a7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Jun 2006 11:11:07 +0200 Subject: udevinfo: clarify parent device attribute use --- udevinfo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index f8d0b6125a..567193adc7 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -91,11 +91,11 @@ static int print_device_chain(const char *devpath) struct sysfs_device *dev; printf("\n" - "udevinfo starts with the device the node belongs to and then walks up the\n" - "device chain, to print for every device found, all possibly useful attributes\n" - "in the udev key format.\n" - "Only attributes within one device section may be used together in one rule,\n" - "to match the device for which the node will be created.\n" + "Udevinfo starts with the device specified by the devpath and then\n" + "walks up the chain of parent devices. It prints for every device\n" + "found, all possible attributes in the udev rules key format.\n" + "A rule to match, can be composed by the attributes of the device\n" + "and the attributes from one single parent device.\n" "\n"); dev = sysfs_device_get(devpath); @@ -112,7 +112,7 @@ static int print_device_chain(const char *devpath) dev = sysfs_device_get_parent(dev); if (dev == NULL) break; - printf(" looking at device '%s':\n", dev->devpath); + printf(" looking at parent device '%s':\n", dev->devpath); printf(" ID==\"%s\"\n", dev->kernel_name); printf(" BUS==\"%s\"\n", dev->subsystem); printf(" DRIVER==\"%s\"\n", dev->driver); -- cgit v1.2.3-54-g00ecf From e0595b53b5ea6cb922fc17ecdbbf4188319c55d0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Jun 2006 11:11:27 +0200 Subject: update SUSE rules --- etc/udev/suse/64-device-mapper.rules | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 etc/udev/suse/64-device-mapper.rules diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules new file mode 100644 index 0000000000..3837d3f2c7 --- /dev/null +++ b/etc/udev/suse/64-device-mapper.rules @@ -0,0 +1,15 @@ +# device mapper links hook into "online" event, when the dm table +# is available, while some table types must be ignored + +KERNEL=="dm-*", ACTION=="add|online", GOTO="device_mapper_do" +GOTO="device_mapper_end" + +LABEL="device_mapper_do" +PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" +RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" + +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +LABEL="device_mapper_end" -- cgit v1.2.3-54-g00ecf From b879c303a787e9430a5234aff3c1185ff9a4b019 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 3 Jul 2006 00:58:35 +0200 Subject: netif rename: optimistic loop for the name to become free Parts from Ubuntu's 70-ifrename.patch. --- extras/volume_id/lib/reiserfs.c | 2 +- udev_device.c | 44 +++++++++++++++++++++++++++++++++++------ udevd.h | 2 +- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c index abeb06b88f..770f726825 100644 --- a/extras/volume_id/lib/reiserfs.c +++ b/extras/volume_id/lib/reiserfs.c @@ -66,7 +66,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) if (buf == NULL) return -1; - rs = (struct reiserfs_super_block *) buf;; + rs = (struct reiserfs_super_block *) buf; if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { strcpy(id->type_version, "3.5"); id->type = "reiserfs"; diff --git a/udev_device.c b/udev_device.c index ab4965c3a1..3c4ac913ed 100644 --- a/udev_device.c +++ b/udev_device.c @@ -81,7 +81,7 @@ dev_t udev_device_get_devt(struct udevice *udev) return makedev(0, 0); } -static int rename_net_if(struct udevice *udev) +static int rename_netif(struct udevice *udev) { int sk; struct ifreq ifr; @@ -100,12 +100,44 @@ static int rename_net_if(struct udevice *udev) memset(&ifr, 0x00, sizeof(struct ifreq)); strlcpy(ifr.ifr_name, udev->dev->kernel_name, IFNAMSIZ); strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval != 0) - err("error changing net interface name: %s", strerror(errno)); - close(sk); + if (retval != 0) { + int loop; + + /* see if the destination interface name already exists */ + if (errno != EEXIST) { + err("error changing netif name: %s", strerror(errno)); + goto exit; + } + + /* free our own name, another process may wait for us */ + strlcpy(ifr.ifr_newname, udev->dev->kernel_name, IFNAMSIZ); + strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval != 0) { + err("error changing netif name: %s", strerror(errno)); + goto exit; + } + /* wait 30 seconds for our target to become available */ + strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); + loop = 30 * 20; + while (loop--) { + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval != 0) { + if (errno != EEXIST) { + err("error changing net interface name: %s", strerror(errno)); + break; + } + dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop); + usleep(1000 * 1000 / 20); + } + } + } + +exit: + close(sk); return retval; } @@ -181,7 +213,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) if (strcmp(udev->name, udev->dev->kernel_name) != 0) { char *pos; - retval = rename_net_if(udev); + retval = rename_netif(udev); if (retval != 0) goto exit; info("renamed netif to '%s'", udev->name); diff --git a/udevd.h b/udevd.h index 1e9c702896..20dde8e8b3 100644 --- a/udevd.h +++ b/udevd.h @@ -32,7 +32,7 @@ #define EVENT_SEQNUM ".udev/uevent_seqnum" /* maximum limit of forked childs */ -#define UDEVD_MAX_CHILDS 64 +#define UDEVD_MAX_CHILDS 256 /* start to throttle forking if maximum number of running childs in our session is reached */ #define UDEVD_MAX_CHILDS_RUNNING 16 -- cgit v1.2.3-54-g00ecf From f1e9ccb94d7a1d9bec95d8e267fea6f3e150640a Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Mon, 3 Jul 2006 01:03:53 +0200 Subject: print usage of udevcontrol when no or invalid command is given --- udevcontrol.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/udevcontrol.c b/udevcontrol.c index 8add09e031..2d93f65ce8 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -33,7 +33,6 @@ #include "udev.h" #include "udevd.h" -/* global variables */ static int sock = -1; static int udev_log = 0; @@ -51,6 +50,16 @@ void log_message (int priority, const char *format, ...) } #endif +static void usage(void) +{ + printf("Usage: udevcontrol COMMAND\n" + " log_priority= set the udev log level for the daemon\n" + " stop_exec_queue keep udevd from executing events, queue only\n" + " start_exec_queue execute events, flush queue\n" + " reload_rules reloads the rules files\n" + " max_childs= maximum number of childs running at the same time\n" + " --help print this help text\n\n"); +} int main(int argc, char *argv[], char *envp[]) { @@ -72,6 +81,7 @@ int main(int argc, char *argv[], char *envp[]) if (argc < 2) { fprintf(stderr, "missing command\n\n"); + usage(); goto exit; } @@ -100,23 +110,18 @@ int main(int argc, char *argv[], char *envp[]) *intval = atoi(val); info("send max_childs=%i", *intval); } else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { - printf("Usage: udevcontrol COMMAND\n" - " log_priority= set the udev log level for the daemon\n" - " stop_exec_queue keep udevd from executing events, queue only\n" - " start_exec_queue execute events, flush queue\n" - " reload_rules reloads the rules files\n" - " max_childs= maximum number of childs running at the same time\n" - " --help print this help text\n\n"); - exit(0); + usage(); + goto exit; } else { fprintf(stderr, "unknown option\n\n"); - exit(1); + usage(); + goto exit; } } if (getuid() != 0) { fprintf(stderr, "need to be root, exit\n\n"); - exit(1); + goto exit; } sock = socket(AF_LOCAL, SOCK_DGRAM, 0); @@ -131,7 +136,6 @@ int main(int argc, char *argv[], char *envp[]) strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - retval = sendto(sock, &usend_msg, sizeof(usend_msg), 0, (struct sockaddr *)&saddr, addrlen); if (retval == -1) { err("error sending message: %s", strerror(errno)); @@ -142,9 +146,7 @@ int main(int argc, char *argv[], char *envp[]) } close(sock); - exit: logging_close(); - return retval; } -- cgit v1.2.3-54-g00ecf From c8ff4b3db440f1c3124b0e4e4efc68f1177c5964 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 4 Jul 2006 12:27:00 +0200 Subject: remove broken %e enumeration --- FAQ | 32 ++++++++----------- TODO | 3 -- docs/udev_vs_devfs | 6 ++-- test/udev-test.pl | 68 ---------------------------------------- udev_rules.c | 92 ------------------------------------------------------ 5 files changed, 16 insertions(+), 185 deletions(-) diff --git a/FAQ b/FAQ index 1fe374cf91..b34c38eeb8 100644 --- a/FAQ +++ b/FAQ @@ -14,7 +14,7 @@ A: udev works entirely in userspace, using hotplug events the kernel sends All device naming policy permission control and event handling is done in userspace. devfs is operated from within the kernel. -Q: Why was devfs marked OBSOLETE/removed if udev can't do everthing devfs did? +Q: Why was devfs removed if udev can't do everthing devfs did? A: To quote Al Viro (Linux VFS kernel maintainer): - it was determined that the same thing could be done in userspace - devfs had been shoved into the tree in hope that its quality will @@ -46,31 +46,25 @@ A: The devfs approach caused a lot of spurious modprobe attempts as spurious. Q: I really like the devfs naming scheme, will udev do that? -A: Yes, udev can create /dev nodes using the devfs naming policy. A - configuration file needs to be created to map the kernel default names - to the devfs names. See the udev.rules.devfs file in the udev - release. - Note that the devfs scheme is not recommended or officially supported - because it is a really stupid idea to simply enumerate devices in a world - where devices can come and go at any time. These numbers give you nothing - but problems, and are not useful to identify a device. Have a look at the - persistent disk rules for an example how to do it correctly in userspace - without any stupid device enumeration. +A: Yes, udev can create /dev nodes using the devfs naming policy. But you + will need a custom configuration and scripts that enumerate your devices + sequentially while events run in parallel, without a predictable order. + The devfs scheme is not recommended or supported because it is a stupid + idea to simply enumerate devices in a world where devices can come and go + at any time. These numbers give you nothing but problems, and are not + useful to identify a device. Have a look at the persistent rules for + examples how to create persistent device names in userspace without any + device enumeration depending on the device probing order. Q: What kinds of devices does udev create nodes for? -A: All devices that are shown in sysfs will work with udev. If more - support is added for devices to the kernel, udev will automatically - start working for them. All block devices are currently supported, and - almost all major char devices are supported. Kernel developers are - working on adding support for all char devices at this time. See the - linux-kernel mailing list for patches and status of these patches. +A: All devices that are shown in the kernel's sysfs tree will work with udev. Q: Will udev remove the limit on the number of anonymous devices? A: udev is entirely in userspace. If the kernel supports a greater number of anonymous devices, udev will support it. -Q: Will udev support symlinks? -A: Yes, It now does. Multiple symlinks per device node are supported. +Q: Does udev support symlinks? +A: Yes, multiple symlinks per device node are supported. Q: How will udev handle the /dev filesystem? A: /dev is recomended to be a tmpfs filesystem that is recreated on every reboot. diff --git a/TODO b/TODO index cabb59cfb7..b0df3c12d3 100644 --- a/TODO +++ b/TODO @@ -7,9 +7,6 @@ These things need to be done, or would be nice to have: These things are deprecated and scheduled for removal in a future udev version: - o remove broken %e enumeration - (simple enumerations can't work reliably and should go) - o remove udevstart (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer want to guess event properties from sysfs like udevstart is doing it) diff --git a/docs/udev_vs_devfs b/docs/udev_vs_devfs index fbf757d437..9e803ca309 100644 --- a/docs/udev_vs_devfs +++ b/docs/udev_vs_devfs @@ -101,7 +101,7 @@ And now for udev: want to deviate away from this standard (for example when naming some devices in a persistent manner), it is easily possible to do so. - 3) udev is small (49Kb binary) and is entirely in userspace, which + 3) udev is small and is entirely in userspace, which is swapable, and doesn't have to be running at all times. Nice, 7 out of 7 for udev. Makes you think the problems and constraints @@ -146,7 +146,7 @@ So, how well does udev solve its goals: As the above scenarios show, both desktop users and big iron users both need to not worry about which device is assigned to what major/minor device. - + udev doesn't care what major/minor number is assigned to a device. It merely takes the numbers that the kernel says it assigned to the device and creates a device node based on it, which the user can @@ -174,7 +174,7 @@ So, how well does udev solve its goals: For more information on how to create udev rules to name devices, please see the udev man page, and look at the example udev rules that ship with the tarball. - + So, convinced already why you should use udev instead of devfs? No. Ok, fine, I'm not forcing you to abandon your bloated, stifling policy, diff --git a/test/udev-test.pl b/test/udev-test.pl index fafaa96ab6..9a88d06271 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1008,74 +1008,6 @@ EOF exp_target => "node", rules => < "enumeration char test (single test)", - subsys => "block", - devpath => "/block/sda", - exp_name => "cdrom", - rules => < "enumeration char test sequence 1/5 (keep)", - subsys => "block", - devpath => "/block/sda", - exp_name => "cdrom", - option => "keep", - rules => < "enumeration char test sequence 2/5 (keep)", - subsys => "block", - devpath => "/block/sda/sda1", - exp_name => "enum", - option => "keep", - rules => < "enumeration char test sequence 3/5 (keep)", - subsys => "block", - devpath => "/block/sda/sda2", - exp_name => "cdrom1", - option => "keep", - rules => < "enumeration char test sequence 4/5 (keep)", - subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "enum1", - option => "keep", - rules => < "enumeration char test sequence 5/5 (clean)", - subsys => "block", - devpath => "/block/sda/sda4", - exp_name => "cdrom2", - option => "clean", - rules => < "enumeration char test after cleanup (single test)", - subsys => "block", - devpath => "/block/sda", - exp_name => "cdrom", - rules => <N isn't present in the udevdb - * if doesn't exist, 0 is returned, N otherwise */ -static int find_free_number(const char *base, const char *devpath) -{ - char db_devpath[PATH_SIZE]; - char filename[PATH_SIZE]; - struct udevice *udev_db; - int num = 0; - static int warn = 1; - - if (warn) { - err("%%e is deprecated, will be removed and is unlikely to work correctly. Don't use it."); - warn = 0; - } - - /* check if the device already owns a matching name */ - udev_db = udev_device_init(); - if (udev_db == NULL) - return -1; - if (udev_db_get_device(udev_db, devpath) == 0) { - struct name_entry *name_loop; - int devnum; - - devnum = match_name_and_get_number(base, udev_db->name); - if (devnum >= 0) { - num = devnum; - dbg("device '%s', already has the node '%s' with num %u, use it", devpath, base, num); - goto out; - } - list_for_each_entry(name_loop, &udev_db->symlink_list, node) { - devnum = match_name_and_get_number(base, name_loop->name); - if (devnum >= 0) { - num = devnum; - dbg("device '%s', already has a symlink '%s' with num %u, use it", devpath, base, num); - goto out; - } - } - } - - /* just search the database again and again until a free name is found */ - strlcpy(filename, base, sizeof(filename)); - while (1) { - dbg("look for existing node '%s'", filename); - if (udev_db_lookup_name(filename, db_devpath, sizeof(db_devpath)) != 0) { - dbg("free num=%d", num); - break; - } - - num++; - if (num > 100000) { - err("find_free_number aborted at num=%d", num); - num = -1; - break; - } - snprintf(filename, sizeof(filename), "%s%d", base, num); - filename[sizeof(filename)-1] = '\0'; - } - -out: - udev_device_cleanup(udev_db); - return num; -} - #define WAIT_LOOP_PER_SECOND 50 static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) { @@ -386,7 +304,6 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) int len; int i; int count; - unsigned int next_free_number; enum subst_type { SUBST_UNKNOWN, SUBST_DEVPATH, @@ -397,7 +314,6 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) SUBST_MINOR, SUBST_RESULT, SUBST_SYSFS, - SUBST_ENUM, SUBST_PARENT, SUBST_TEMP_NODE, SUBST_ROOT, @@ -416,7 +332,6 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, { .name = "sysfs", .fmt = 's', .type = SUBST_SYSFS }, - { .name = "enum", .fmt = 'e', .type = SUBST_ENUM }, { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, @@ -572,13 +487,6 @@ found: dbg("substitute sysfs value '%s'", temp2); } break; - case SUBST_ENUM: - next_free_number = find_free_number(string, udev->dev->devpath); - if (next_free_number > 0) { - sprintf(temp2, "%d", next_free_number); - strlcat(string, temp2, maxsize); - } - break; case SUBST_PARENT: { struct sysfs_device *dev_parent; -- cgit v1.2.3-54-g00ecf From 486e62f8ad13e1ec5ef5a9e3b9407bb45e7017e1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 4 Jul 2006 12:34:55 +0200 Subject: 095 release --- ChangeLog | 16 ++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index f3ec138811..093a04e62d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Summary of changes from v094 to v095 +============================================ + +Kay Sievers: + update SUSE rules + don't remove symlinks if they are already there + allow "online" events to create/update symlinks + udevinfo: clarify parent device attribute use + update SUSE rules + netif rename: optimistic loop for the name to become free + remove broken %e enumeration + +Tobias Klauser: + print usage of udevcontrol when no or invalid command is given + + Summary of changes from v093 to v094 ============================================ diff --git a/Makefile b/Makefile index 85a0b8ae82..56f9000cab 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 094 +VERSION = 095 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2975920e0c..16c44d6022 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,10 @@ +udev 095 +======== +%e is finaly gone. + +Added support for swapping network interface names, by temporarily +renaming the device and wait for the target name to become free. + udev 094 ======== The built-in MODALIAS key and substitution is removed. -- cgit v1.2.3-54-g00ecf From c76b97dc4d10fb569fa0d599e30a40b54fad05e4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 4 Jul 2006 18:41:07 +0200 Subject: Makefiles: fix .PHONY for man page target MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to David Härdeman for pointing it out. --- extras/ata_id/Makefile | 2 +- extras/cdrom_id/Makefile | 2 +- extras/dasd_id/Makefile | 2 +- extras/edd_id/Makefile | 2 +- extras/firmware/Makefile | 2 +- extras/floppy/Makefile | 2 +- extras/path_id/Makefile | 2 +- extras/run_directory/Makefile | 2 +- extras/scsi_id/Makefile | 2 +- extras/usb_id/Makefile | 2 +- extras/volume_id/Makefile | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index 64d6868062..c55bdac7c4 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -58,7 +58,7 @@ uninstall-bin: install-man: $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index d7887e61ed..f5890a0c6a 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -58,7 +58,7 @@ uninstall-bin: install-man: $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 9ad000b8fd..627b6cf42f 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -58,7 +58,7 @@ uninstall-bin: install-man: $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 52f862da11..01c2657e20 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -58,7 +58,7 @@ uninstall-bin: install-man: $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index 55ba22386f..cfc7cd5153 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -46,7 +46,7 @@ uninstall-bin: install-man: @echo "Please create a man page for this tool." -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: @echo "Please create a man page for this tool." diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index a06ebc8b39..4416559c4a 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -58,7 +58,7 @@ uninstall-bin: install-man: @echo "Please create a man page for this tool." -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: @echo "Please create a man page for this tool." diff --git a/extras/path_id/Makefile b/extras/path_id/Makefile index 32747a71d1..7884a5ef5a 100644 --- a/extras/path_id/Makefile +++ b/extras/path_id/Makefile @@ -46,7 +46,7 @@ uninstall-bin: install-man: @echo "Please create a man page for this tool." -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: @echo "Please create a man page for this tool." diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 7ad6c547b8..6a4e4df5ca 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -59,7 +59,7 @@ uninstall-bin: install-man: @echo "Please create a man page for this tool." -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: @echo "Please create a man page for this tool." diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 1e9910efb9..8ebe7026bb 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -69,7 +69,7 @@ uninstall-bin: install-man: $(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: -rm -f $(DESTDIR)$(mandir)/man8/scsi_id.8 diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 26e2fedd4d..d045a64857 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -58,7 +58,7 @@ uninstall-bin: install-man: @echo "Please create a man page for this tool." -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: @echo "Please create a man page for this tool." diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 0b22fb9c2d..a0401b04e8 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -66,7 +66,7 @@ uninstall-bin: install-man: $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man +.PHONY: install-man uninstall-man: -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 -- cgit v1.2.3-54-g00ecf From 989e081131f25b24da26ca94f0494ca756389867 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Jul 2006 13:49:43 +0200 Subject: allow longer devpath values --- udev.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/udev.h b/udev.h index 79942e71cd..95a2b88f5e 100644 --- a/udev.h +++ b/udev.h @@ -33,10 +33,8 @@ #define COMMENT_CHARACTER '#' #define PATH_TO_NAME_CHAR '@' #define LINE_SIZE 512 +#define PATH_SIZE 512 #define NAME_SIZE 128 -#define PATH_SIZE 256 -#define USER_SIZE 32 -#define SEQNUM_SIZE 32 #define VALUE_SIZE 128 #define DEFAULT_PARTITIONS_COUNT 15 @@ -73,9 +71,9 @@ struct udevice { char name[PATH_SIZE]; struct list_head symlink_list; int symlink_final; - char owner[USER_SIZE]; + char owner[NAME_SIZE]; int owner_final; - char group[USER_SIZE]; + char group[NAME_SIZE]; int group_final; mode_t mode; int mode_final; -- cgit v1.2.3-54-g00ecf From c2e04d6b8b82e870c6b9ce397f5fdf9c8b4efb5a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 9 Jul 2006 21:32:55 +0200 Subject: path_id: prepare for new sysfs layout --- extras/path_id/path_id | 51 +++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index f9b3d5a73f..825c77c3b1 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -407,30 +407,35 @@ handle_usb () { handle_device () { full_sysfs_path="$SYSFS$DEVPATH" - if [ -L $full_sysfs_path/subsystem ]; then - # new sysfs block layout - full_sysfs_path="${full_sysfs_path%/*}" - cd "$full_sysfs_path/subsystem"; - subsys="`pwd -P`" - cd "$OPWD" - subsys="${subsys##*/}" - if [ "$subsys" = "block" ]; then - # parent is "block", it's a partition, move one up - full_sysfs_path="${full_sysfs_path%/*}" - fi - cd $full_sysfs_path - else - # old sysfs block layout - if [ ! -L $full_sysfs_path/device ] ; then - if [ -f $full_sysfs_path/range ] ; then return ; fi - full_sysfs_path="${full_sysfs_path%/*}" - : full_sysfs_path "$full_sysfs_path" - if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then - return + case "$DEVPATH" in + /devices/*) + # new sysfs layout + if [ -L $full_sysfs_path/subsystem ]; then + full_sysfs_path="${full_sysfs_path%/*}" + cd "$full_sysfs_path/subsystem"; + subsys="`pwd -P`" + cd "$OPWD" + subsys="${subsys##*/}" + if [ "$subsys" = "block" ]; then + # parent is "block", it's a partition, move one up + full_sysfs_path="${full_sysfs_path%/*}" + fi + cd $full_sysfs_path fi - fi - cd $full_sysfs_path/device - fi + ;; + *) + # old sysfs layout + if [ ! -L $full_sysfs_path/device ] ; then + if [ -f $full_sysfs_path/range ] ; then return ; fi + full_sysfs_path="${full_sysfs_path%/*}" + : full_sysfs_path "$full_sysfs_path" + if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then + return + fi + fi + cd $full_sysfs_path/device + ;; + esac full_sysfs_device_path="`pwd -P`" cd "$OPWD" D=$full_sysfs_device_path -- cgit v1.2.3-54-g00ecf From 8448b7cea0c4e6b7d394c889be6ef4ae09a7ad2b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 9 Jul 2006 21:48:19 +0200 Subject: 096 release --- ChangeLog | 9 +++++++++ Makefile | 2 +- RELEASE-NOTES | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 093a04e62d..a92b509cb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Summary of changes from v095 to v096 +============================================ + +Kay Sievers: + Makefiles: fix .PHONY for man page target + allow longer devpath values + path_id: prepare for new sysfs layout + + Summary of changes from v094 to v095 ============================================ diff --git a/Makefile b/Makefile index 56f9000cab..ac5702b776 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 095 +VERSION = 096 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 16c44d6022..5fc6380ea6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 096 +======== +fix path_id for recent kernels + udev 095 ======== %e is finaly gone. -- cgit v1.2.3-54-g00ecf From f566b05b572492e4e7a684a5b04231412d71d0bd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 11 Jul 2006 14:16:59 +0200 Subject: firmware.sh: remove needless '/' --- extras/firmware/firmware.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/firmware/firmware.sh b/extras/firmware/firmware.sh index fb2f2a792d..89b985ef3b 100755 --- a/extras/firmware/firmware.sh +++ b/extras/firmware/firmware.sh @@ -16,12 +16,12 @@ fi for DIR in $FIRMWARE_DIRS; do [ -e "$DIR/$FIRMWARE" ] || continue - echo 1 > /sys/$DEVPATH/loading - cat "$DIR/$FIRMWARE" > /sys/$DEVPATH/data - echo 0 > /sys/$DEVPATH/loading + echo 1 > /sys$DEVPATH/loading + cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data + echo 0 > /sys$DEVPATH/loading exit 0 done -echo -1 > /sys/$DEVPATH/loading +echo -1 > /sys$DEVPATH/loading err "Cannot find firmware file '$FIRMWARE'" exit 1 -- cgit v1.2.3-54-g00ecf From 7d5ccc081008a08f066b5bb6805f417585ae663a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Jul 2006 16:59:01 +0200 Subject: vol_id: add --skip-raid and --probe-all option --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/exported_symbols | 4 ++ extras/volume_id/lib/volume_id.c | 12 ++-- extras/volume_id/vol_id.8 | 6 ++ extras/volume_id/vol_id.c | 109 ++++++++++++++++++++++++++++++---- 5 files changed, 115 insertions(+), 18 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 90cd63e745..66b3b92f9d 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 66 +SHLIB_REV = 67 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index 3f10ec0c78..57a1feb3dc 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -7,6 +7,8 @@ volume_id_probe_raid; volume_id_close; + volume_id_probe_linux_swap; + volume_id_probe_luks; volume_id_probe_cramfs; volume_id_probe_ext; volume_id_probe_vfat; @@ -41,6 +43,8 @@ volume_id_probe_promise_fasttrack_raid; volume_id_probe_silicon_medley_raid; volume_id_probe_via_raid; + volume_id_probe_adaptec_raid; + volume_id_probe_jmicron_raid; local: *; }; diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index bcdbe2feaa..f74319fb96 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -102,21 +102,21 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); - if (volume_id_probe_luks(id, off) == 0) - goto found; - if (volume_id_probe_vfat(id, off) == 0) goto found; - if (volume_id_probe_xfs(id, off) == 0) - goto found; - /* fill buffer with maximum */ volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); if (volume_id_probe_linux_swap(id, off) == 0) goto found; + if (volume_id_probe_luks(id, off) == 0) + goto found; + + if (volume_id_probe_xfs(id, off) == 0) + goto found; + if (volume_id_probe_ext(id, off) == 0) goto found; diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index 9f5a9c5d8e..15fccbe97e 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -31,6 +31,12 @@ print the label of a volume .TP \fB\-u\fR print the uuid of a volume +.TP +\fB\-\-skip-raid\fR +skip probing for raid signatures +.TP +\fB\-\-probe-all\fR +probe for all known signatures to detect possible conflicts .SH "ENVIRONMENT" .TP \fBUDEV_LOG\fR diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index dcf56d87e9..d516eb5cbd 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -109,11 +109,14 @@ static void set_str(char *to, const char *from, size_t count) int main(int argc, char *argv[]) { - const char help[] = "usage: vol_id [--export|-t|-l|-u] \n" - " --export\n" - " -t filesystem type\n" - " -l filesystem label\n" - " -u filesystem uuid\n" + const char help[] = "Usage: vol_id [options] \n" + " --export export key/value pairs\n" + " -t filesystem type\n" + " -l filesystem label\n" + " -u filesystem uuid\n" + " --skip-raid don't probe for raid\n" + " --probe-all find possibly conflicting signatures\n" + " --help\n" "\n"; enum print_type { PRINT_EXPORT, @@ -125,9 +128,12 @@ int main(int argc, char *argv[]) static char name[VOLUME_ID_LABEL_SIZE]; int i; uint64_t size; + int skip_raid = 0; + int probe_all = 0; const char *node = NULL; uid_t nobody_uid; gid_t nobody_gid; + int retval; int rc = 0; logging_init("vol_id"); @@ -146,6 +152,13 @@ int main(int argc, char *argv[]) print = PRINT_LABEL; } else if (strcmp(arg, "-u") == 0) { print = PRINT_UUID; + } else if (strcmp(arg, "--skip-raid") == 0) { + skip_raid = 1; + } else if (strcmp(arg, "--probe-all") == 0) { + probe_all = 1; + } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + printf(help); + goto exit; } else node = arg; } @@ -179,15 +192,89 @@ int main(int argc, char *argv[]) } } - if (volume_id_probe_all(vid, 0, size) == 0) - goto print; + if (probe_all) { + if (volume_id_probe_linux_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_intel_software_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_lsi_mega_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_via_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_silicon_medley_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_nvidia_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_promise_fasttrack_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_highpoint_45x_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_adaptec_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_jmicron_raid(vid, 0, size) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_vfat(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_linux_swap(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_luks(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_xfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_ext(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_reiserfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_jfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_udf(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_iso9660(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_hfs_hfsplus(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_ufs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_ntfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_cramfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_romfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_hpfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_sysv(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_minix(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_ocfs1(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_ocfs2(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_vxfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_squashfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_netware(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_gfs(vid, 0) == 0) + printf("%s\n", vid->type); + if (volume_id_probe_gfs2(vid, 0) == 0) + printf("%s\n", vid->type); + + goto exit; + } - if (print != PRINT_EXPORT) + if (skip_raid) + retval = volume_id_probe_filesystem(vid, 0, size); + else + retval = volume_id_probe_all(vid, 0, size); + if (retval != 0) { fprintf(stderr, "%s: unknown volume type\n", node); - rc = 4; - goto exit; + rc = 4; + goto exit; + } -print: set_str(name, vid->label, sizeof(vid->label)); replace_untrusted_chars(name); -- cgit v1.2.3-54-g00ecf From 733f070dddc096175fb74ba44a95538cf09411ba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Jul 2006 21:41:11 +0200 Subject: switch uevent netlink socket to group 1 only --- udevd.c | 2 +- udevmonitor.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index 02c4887f54..751231ee41 100644 --- a/udevd.c +++ b/udevd.c @@ -789,7 +789,7 @@ static int init_uevent_netlink_sock(void) memset(&snl, 0x00, sizeof(struct sockaddr_nl)); snl.nl_family = AF_NETLINK; snl.nl_pid = getpid(); - snl.nl_groups = 0xffffffff; + snl.nl_groups = 1; uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_netlink_sock == -1) { diff --git a/udevmonitor.c b/udevmonitor.c index fb1f42cc01..61901accad 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -82,7 +82,7 @@ static int init_uevent_netlink_sock(void) memset(&snl, 0x00, sizeof(struct sockaddr_nl)); snl.nl_family = AF_NETLINK; snl.nl_pid = getpid(); - snl.nl_groups = 0xffffffff; + snl.nl_groups = 1; uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_netlink_sock == -1) { -- cgit v1.2.3-54-g00ecf From e8c335b60a69d150140cb2ea7c3e78a8ab2cca29 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Jul 2006 21:42:05 +0200 Subject: increase /proc/stat read buffer --- udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevd.c b/udevd.c index 751231ee41..38a2643d60 100644 --- a/udevd.c +++ b/udevd.c @@ -313,7 +313,7 @@ static void msg_queue_insert(struct uevent_msg *msg) static int running_processes(void) { int f; - static char buf[4096]; + static char buf[32768]; int len; int running; const char *pos; -- cgit v1.2.3-54-g00ecf From aa0b70530c1ab116216e53641f4ec3f481d654fe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Jul 2006 22:31:58 +0200 Subject: use "change" instead of "online" events The kernel driver may send "change" to signify a device state change and udev can possibly recreate symlinks. --- udev_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_device.c b/udev_device.c index 3c4ac913ed..ed41c856e5 100644 --- a/udev_device.c +++ b/udev_device.c @@ -147,7 +147,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* add device node */ if (major(udev->devt) != 0 && - (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "online") == 0)) { + (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "change") == 0)) { struct udevice *udev_old; dbg("device node add '%s'", udev->dev->devpath); -- cgit v1.2.3-54-g00ecf From b437ec958a505c057870c40bf668d8692d60dc3a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Jul 2006 14:45:09 +0200 Subject: remove 'static' from local variable --- udevd.c | 23 ++++++++++------------- udevmonitor.c | 2 +- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/udevd.c b/udevd.c index 38a2643d60..344a806c06 100644 --- a/udevd.c +++ b/udevd.c @@ -258,6 +258,7 @@ static void udev_event_run(struct uevent_msg *msg) logging_init("udevd-event"); setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); + retval = udev_event_process(msg); info("seq %llu finished", msg->seqnum); @@ -313,7 +314,7 @@ static void msg_queue_insert(struct uevent_msg *msg) static int running_processes(void) { int f; - static char buf[32768]; + char buf[32768]; int len; int running; const char *pos; @@ -557,9 +558,9 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) } /* receive the udevd message from userspace */ -static struct uevent_msg *get_udevd_msg(void) +static void get_udevd_msg(void) { - static struct udevd_msg ctrl_msg; + struct udevd_msg ctrl_msg; ssize_t size; struct msghdr smsg; struct cmsghdr *cmsg; @@ -582,24 +583,24 @@ static struct uevent_msg *get_udevd_msg(void) if (size < 0) { if (errno != EINTR) err("unable to receive user udevd message: %s", strerror(errno)); - return NULL; + return; } cmsg = CMSG_FIRSTHDR(&smsg); cred = (struct ucred *) CMSG_DATA(cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { err("no sender credentials received, message ignored"); - return NULL; + return; } if (cred->uid != 0) { err("sender uid=%i, message ignored", cred->uid); - return NULL; + return; } if (strncmp(ctrl_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { err("message magic '%s' doesn't match, ignore it", ctrl_msg.magic); - return NULL; + return; } switch (ctrl_msg.type) { @@ -631,7 +632,6 @@ static struct uevent_msg *get_udevd_msg(void) default: dbg("unknown message type"); } - return NULL; } /* receive the kernel user event message and do some sanity checks */ @@ -1044,11 +1044,8 @@ int main(int argc, char *argv[], char *envp[]) } /* get user socket message */ - if (FD_ISSET(udevd_sock, &readfds)) { - msg = get_udevd_msg(); - if (msg) - msg_queue_insert(msg); - } + if (FD_ISSET(udevd_sock, &readfds)) + get_udevd_msg(); /* get kernel netlink message */ if (FD_ISSET(uevent_netlink_sock, &readfds)) { diff --git a/udevmonitor.c b/udevmonitor.c index 61901accad..d3d9050dca 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) "and the event which udev sends out after rule processing [UDEV]\n\n"); while (!udev_exit) { - static char buf[UEVENT_BUFFER_SIZE*2]; + char buf[UEVENT_BUFFER_SIZE*2]; ssize_t buflen; int fdcount; struct timeval tv; -- cgit v1.2.3-54-g00ecf From cdf18948639e56d2e3c71606c72e2f2d239c100b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Jul 2006 14:59:50 +0200 Subject: libvolume_id: add parameter 'size' to all probe functions --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/cramfs.c | 2 +- extras/volume_id/lib/ext.c | 2 +- extras/volume_id/lib/fat.c | 2 +- extras/volume_id/lib/gfs.c | 4 +-- extras/volume_id/lib/hfs.c | 2 +- extras/volume_id/lib/highpoint.c | 2 +- extras/volume_id/lib/hpfs.c | 2 +- extras/volume_id/lib/iso9660.c | 2 +- extras/volume_id/lib/jfs.c | 2 +- extras/volume_id/lib/libvolume_id.h | 54 ++++++++++++++++++------------------- extras/volume_id/lib/linux_swap.c | 2 +- extras/volume_id/lib/luks.c | 2 +- extras/volume_id/lib/lvm.c | 4 +-- extras/volume_id/lib/minix.c | 2 +- extras/volume_id/lib/netware.c | 2 +- extras/volume_id/lib/ntfs.c | 2 +- extras/volume_id/lib/ocfs.c | 4 +-- extras/volume_id/lib/reiserfs.c | 2 +- extras/volume_id/lib/romfs.c | 2 +- extras/volume_id/lib/squashfs.c | 2 +- extras/volume_id/lib/sysv.c | 2 +- extras/volume_id/lib/udf.c | 2 +- extras/volume_id/lib/ufs.c | 2 +- extras/volume_id/lib/volume_id.c | 54 ++++++++++++++++++------------------- extras/volume_id/lib/vxfs.c | 2 +- extras/volume_id/lib/xfs.c | 2 +- extras/volume_id/vol_id.c | 48 ++++++++++++++++----------------- 28 files changed, 106 insertions(+), 106 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 66b3b92f9d..f53e5f1141 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 67 +SHLIB_REV = 68 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/cramfs.c b/extras/volume_id/lib/cramfs.c index 100ebdec22..bf329506e1 100644 --- a/extras/volume_id/lib/cramfs.c +++ b/extras/volume_id/lib/cramfs.c @@ -41,7 +41,7 @@ struct cramfs_super { uint8_t name[16]; } PACKED; -int volume_id_probe_cramfs(struct volume_id *id, uint64_t off) +int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size) { struct cramfs_super *cs; diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index 7d41a3287e..8fc7a747dc 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -70,7 +70,7 @@ struct ext2_super_block { #define EXT3_MIN_BLOCK_SIZE 0x400 #define EXT3_MAX_BLOCK_SIZE 0x1000 -int volume_id_probe_ext(struct volume_id *id, uint64_t off) +int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) { struct ext2_super_block *es; size_t bsize; diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 61a9450438..92f316a275 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -133,7 +133,7 @@ static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int coun return NULL; } -int volume_id_probe_vfat(struct volume_id *id, uint64_t off) +int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) { struct vfat_super_block *vs; struct vfat_dir_entry *dir; diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c index 40a4493b32..1d3a4a0f1e 100644 --- a/extras/volume_id/lib/gfs.c +++ b/extras/volume_id/lib/gfs.c @@ -109,12 +109,12 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v return -1; } -int volume_id_probe_gfs(struct volume_id *id, uint64_t off) +int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size) { return volume_id_probe_gfs_generic(id, off, 1); } -int volume_id_probe_gfs2(struct volume_id *id, uint64_t off) +int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size) { return volume_id_probe_gfs_generic(id, off, 2); } diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index 4e34d66ba4..03b2aa0819 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -137,7 +137,7 @@ static struct hfsplus_vol_header { #define HFS_NODE_LEAF 0xff #define HFSPLUS_POR_CNID 1 -int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off) +int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size) { unsigned int blocksize; unsigned int cat_block; diff --git a/extras/volume_id/lib/highpoint.c b/extras/volume_id/lib/highpoint.c index e441edb776..f2c4069cc6 100644 --- a/extras/volume_id/lib/highpoint.c +++ b/extras/volume_id/lib/highpoint.c @@ -43,7 +43,7 @@ struct hpt45x_meta { #define HPT45X_MAGIC_BAD 0x5a7816fd -int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off) +int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; struct hpt37x_meta *hpt; diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c index 6fec9caf8d..edcf0666ae 100644 --- a/extras/volume_id/lib/hpfs.c +++ b/extras/volume_id/lib/hpfs.c @@ -34,7 +34,7 @@ struct hpfs_super #define HPFS_SUPERBLOCK_OFFSET 0x2000 -int volume_id_probe_hpfs(struct volume_id *id, uint64_t off) +int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size) { struct hpfs_super *hs; diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c index be64a8b8af..f8f5aa18ea 100644 --- a/extras/volume_id/lib/iso9660.c +++ b/extras/volume_id/lib/iso9660.c @@ -53,7 +53,7 @@ struct high_sierra_volume_descriptor { uint8_t version; } PACKED; -int volume_id_probe_iso9660(struct volume_id *id, uint64_t off) +int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) { uint8_t *buf; struct iso_volume_descriptor *is; diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c index 80360915a4..6d4124cd05 100644 --- a/extras/volume_id/lib/jfs.c +++ b/extras/volume_id/lib/jfs.c @@ -41,7 +41,7 @@ struct jfs_super_block { #define JFS_SUPERBLOCK_OFFSET 0x8000 -int volume_id_probe_jfs(struct volume_id *id, uint64_t off) +int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size) { struct jfs_super_block *js; diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index e34f4679e7..98423f08cc 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -69,41 +69,41 @@ extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t siz extern void volume_id_close(struct volume_id *id); /* filesystems */ -extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ext(struct volume_id *id, uint64_t off); -extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off); -extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off); -extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off); -extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_minix(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off); -extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off); -extern int volume_id_probe_udf(struct volume_id *id, uint64_t off); -extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_netware(struct volume_id *id, uint64_t off); -extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off); -extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off); +extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size); /* special formats */ -extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off); -extern int volume_id_probe_luks(struct volume_id *id, uint64_t off); +extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size); /* raid */ extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off); -extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off); +extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size); /* bios raid */ extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off); +extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 3937f8ea46..21cb2bce8c 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -37,7 +37,7 @@ static struct swap_header_v1_2 { #define LARGEST_PAGESIZE 0x4000 -int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off) +int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; unsigned int page; diff --git a/extras/volume_id/lib/luks.c b/extras/volume_id/lib/luks.c index f3ec20eade..a141a0f5c3 100644 --- a/extras/volume_id/lib/luks.c +++ b/extras/volume_id/lib/luks.c @@ -62,7 +62,7 @@ struct luks_phdr { } keyblock[LUKS_NUMKEYS]; }; -int volume_id_probe_luks(struct volume_id *id, uint64_t off) +int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size) { struct luks_phdr *header; diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c index 727204280b..9c83c55307 100644 --- a/extras/volume_id/lib/lvm.c +++ b/extras/volume_id/lib/lvm.c @@ -41,7 +41,7 @@ struct lvm2_super_block { #define LVM1_SB_OFF 0x400 #define LVM1_MAGIC "HM" -int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) +int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; struct lvm1_super_block *lvm; @@ -66,7 +66,7 @@ int volume_id_probe_lvm1(struct volume_id *id, uint64_t off) #define LVM2_LABEL_ID "LABELONE" #define LVM2LABEL_SCAN_SECTORS 4 -int volume_id_probe_lvm2(struct volume_id *id, uint64_t off) +int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; unsigned int soff; diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c index c5e16e783b..dffc52a4d8 100644 --- a/extras/volume_id/lib/minix.c +++ b/extras/volume_id/lib/minix.c @@ -42,7 +42,7 @@ struct minix_super_block #define MINIX_SUPERBLOCK_OFFSET 0x400 -int volume_id_probe_minix(struct volume_id *id, uint64_t off) +int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size) { struct minix_super_block *ms; diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c index 6e1e95f86c..67af561331 100644 --- a/extras/volume_id/lib/netware.c +++ b/extras/volume_id/lib/netware.c @@ -78,7 +78,7 @@ struct netware_super_block { uint32_t reserved2[64-(2+46)]; } PACKED; -int volume_id_probe_netware(struct volume_id *id, uint64_t off) +int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size) { struct netware_super_block *nw; diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index 5f2a5b93a2..f7675a3434 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -90,7 +90,7 @@ static struct volume_info { #define MFT_RECORD_ATTR_OBJECT_ID 0x40 #define MFT_RECORD_ATTR_END 0xffffffffu -int volume_id_probe_ntfs(struct volume_id *id, uint64_t off) +int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) { unsigned int sector_size; unsigned int cluster_size; diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c index bf311415dd..349527b7e0 100644 --- a/extras/volume_id/lib/ocfs.c +++ b/extras/volume_id/lib/ocfs.c @@ -126,7 +126,7 @@ struct ocfs2_super_block { uint8_t s_uuid[16]; } PACKED; -int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off) +int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; struct ocfs1_super_block_header *osh; @@ -164,7 +164,7 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off) #define OCFS2_MAX_BLOCKSIZE 0x1000 #define OCFS2_SUPER_BLOCK_BLKNO 2 -int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off) +int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; struct ocfs2_super_block *os; diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c index 770f726825..1f219e5bde 100644 --- a/extras/volume_id/lib/reiserfs.c +++ b/extras/volume_id/lib/reiserfs.c @@ -54,7 +54,7 @@ struct reiser4_super_block { #define REISERFS1_SUPERBLOCK_OFFSET 0x2000 #define REISERFS_SUPERBLOCK_OFFSET 0x10000 -int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off) +int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size) { struct reiserfs_super_block *rs; struct reiser4_super_block *rs4; diff --git a/extras/volume_id/lib/romfs.c b/extras/volume_id/lib/romfs.c index a88781e36e..2db36d61a5 100644 --- a/extras/volume_id/lib/romfs.c +++ b/extras/volume_id/lib/romfs.c @@ -33,7 +33,7 @@ struct romfs_super { uint8_t name[0]; } PACKED; -int volume_id_probe_romfs(struct volume_id *id, uint64_t off) +int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size) { struct romfs_super *rfs; diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index fdba64edbc..99cc78aa41 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -32,7 +32,7 @@ struct squashfs_super { uint32_t s_magic; } PACKED; -int volume_id_probe_squashfs(struct volume_id *id, uint64_t off) +int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size) { struct squashfs_super *sqs; diff --git a/extras/volume_id/lib/sysv.c b/extras/volume_id/lib/sysv.c index 6e0ed046f0..e48013c2bd 100644 --- a/extras/volume_id/lib/sysv.c +++ b/extras/volume_id/lib/sysv.c @@ -89,7 +89,7 @@ struct xenix_super { #define XENIX_MAGIC 0x2b5544 #define SYSV_MAX_BLOCKSIZE 0x800 -int volume_id_probe_sysv(struct volume_id *id, uint64_t off) +int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size) { struct sysv_super *vs; struct xenix_super *xs; diff --git a/extras/volume_id/lib/udf.c b/extras/volume_id/lib/udf.c index d71e9d6f5d..ac2f40a9e8 100644 --- a/extras/volume_id/lib/udf.c +++ b/extras/volume_id/lib/udf.c @@ -61,7 +61,7 @@ struct volume_structure_descriptor { #define UDF_VSD_OFFSET 0x8000 -int volume_id_probe_udf(struct volume_id *id, uint64_t off) +int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size) { struct volume_descriptor *vd; struct volume_structure_descriptor *vsd; diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c index 8255b6e791..2713a63d4d 100644 --- a/extras/volume_id/lib/ufs.c +++ b/extras/volume_id/lib/ufs.c @@ -168,7 +168,7 @@ struct ufs_super_block { #define UFS_MAGIC_FEA 0x00195612 #define UFS_MAGIC_LFN 0x00095014 -int volume_id_probe_ufs(struct volume_id *id, uint64_t off) +int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size) { uint32_t magic; int i; diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index f74319fb96..c6c8d5af6d 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -77,13 +77,13 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) goto found; } - if (volume_id_probe_lvm1(id, off) == 0) + if (volume_id_probe_lvm1(id, off, size) == 0) goto found; - if (volume_id_probe_lvm2(id, off) == 0) + if (volume_id_probe_lvm2(id, off, size) == 0) goto found; - if (volume_id_probe_highpoint_37x_raid(id, off) == 0) + if (volume_id_probe_highpoint_37x_raid(id, off, size) == 0) goto found; return -1; @@ -102,79 +102,79 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); - if (volume_id_probe_vfat(id, off) == 0) + if (volume_id_probe_vfat(id, off, size) == 0) goto found; /* fill buffer with maximum */ volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); - if (volume_id_probe_linux_swap(id, off) == 0) + if (volume_id_probe_linux_swap(id, off, size) == 0) goto found; - if (volume_id_probe_luks(id, off) == 0) + if (volume_id_probe_luks(id, off, size) == 0) goto found; - if (volume_id_probe_xfs(id, off) == 0) + if (volume_id_probe_xfs(id, off, size) == 0) goto found; - if (volume_id_probe_ext(id, off) == 0) + if (volume_id_probe_ext(id, off, size) == 0) goto found; - if (volume_id_probe_reiserfs(id, off) == 0) + if (volume_id_probe_reiserfs(id, off, size) == 0) goto found; - if (volume_id_probe_jfs(id, off) == 0) + if (volume_id_probe_jfs(id, off, size) == 0) goto found; - if (volume_id_probe_udf(id, off) == 0) + if (volume_id_probe_udf(id, off, size) == 0) goto found; - if (volume_id_probe_iso9660(id, off) == 0) + if (volume_id_probe_iso9660(id, off, size) == 0) goto found; - if (volume_id_probe_hfs_hfsplus(id, off) == 0) + if (volume_id_probe_hfs_hfsplus(id, off, size) == 0) goto found; - if (volume_id_probe_ufs(id, off) == 0) + if (volume_id_probe_ufs(id, off, size) == 0) goto found; - if (volume_id_probe_ntfs(id, off) == 0) + if (volume_id_probe_ntfs(id, off, size) == 0) goto found; - if (volume_id_probe_cramfs(id, off) == 0) + if (volume_id_probe_cramfs(id, off, size) == 0) goto found; - if (volume_id_probe_romfs(id, off) == 0) + if (volume_id_probe_romfs(id, off, size) == 0) goto found; - if (volume_id_probe_hpfs(id, off) == 0) + if (volume_id_probe_hpfs(id, off, size) == 0) goto found; - if (volume_id_probe_sysv(id, off) == 0) + if (volume_id_probe_sysv(id, off, size) == 0) goto found; - if (volume_id_probe_minix(id, off) == 0) + if (volume_id_probe_minix(id, off, size) == 0) goto found; - if (volume_id_probe_ocfs1(id, off) == 0) + if (volume_id_probe_ocfs1(id, off, size) == 0) goto found; - if (volume_id_probe_ocfs2(id, off) == 0) + if (volume_id_probe_ocfs2(id, off, size) == 0) goto found; - if (volume_id_probe_vxfs(id, off) == 0) + if (volume_id_probe_vxfs(id, off, size) == 0) goto found; - if (volume_id_probe_squashfs(id, off) == 0) + if (volume_id_probe_squashfs(id, off, size) == 0) goto found; - if (volume_id_probe_netware(id, off) == 0) + if (volume_id_probe_netware(id, off, size) == 0) goto found; - if (volume_id_probe_gfs(id, off) == 0) + if (volume_id_probe_gfs(id, off, size) == 0) goto found; - if (volume_id_probe_gfs2(id, off) == 0) + if (volume_id_probe_gfs2(id, off, size) == 0) goto found; return -1; diff --git a/extras/volume_id/lib/vxfs.c b/extras/volume_id/lib/vxfs.c index 112666192c..c9b76285e8 100644 --- a/extras/volume_id/lib/vxfs.c +++ b/extras/volume_id/lib/vxfs.c @@ -33,7 +33,7 @@ struct vxfs_super { int32_t vs_version; } PACKED; -int volume_id_probe_vxfs(struct volume_id *id, uint64_t off) +int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size) { struct vxfs_super *vxs; diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c index 9228fe4c88..5c1a82e1d3 100644 --- a/extras/volume_id/lib/xfs.c +++ b/extras/volume_id/lib/xfs.c @@ -41,7 +41,7 @@ struct xfs_super_block { uint64_t fdblocks; } PACKED; -int volume_id_probe_xfs(struct volume_id *id, uint64_t off) +int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size) { struct xfs_super_block *xs; diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index d516eb5cbd..96ccaf3637 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -213,53 +213,53 @@ int main(int argc, char *argv[]) printf("%s\n", vid->type); if (volume_id_probe_jmicron_raid(vid, 0, size) == 0) printf("%s\n", vid->type); - if (volume_id_probe_vfat(vid, 0) == 0) + if (volume_id_probe_vfat(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_linux_swap(vid, 0) == 0) + if (volume_id_probe_linux_swap(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_luks(vid, 0) == 0) + if (volume_id_probe_luks(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_xfs(vid, 0) == 0) + if (volume_id_probe_xfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_ext(vid, 0) == 0) + if (volume_id_probe_ext(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_reiserfs(vid, 0) == 0) + if (volume_id_probe_reiserfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_jfs(vid, 0) == 0) + if (volume_id_probe_jfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_udf(vid, 0) == 0) + if (volume_id_probe_udf(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_iso9660(vid, 0) == 0) + if (volume_id_probe_iso9660(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_hfs_hfsplus(vid, 0) == 0) + if (volume_id_probe_hfs_hfsplus(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_ufs(vid, 0) == 0) + if (volume_id_probe_ufs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_ntfs(vid, 0) == 0) + if (volume_id_probe_ntfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_cramfs(vid, 0) == 0) + if (volume_id_probe_cramfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_romfs(vid, 0) == 0) + if (volume_id_probe_romfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_hpfs(vid, 0) == 0) + if (volume_id_probe_hpfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_sysv(vid, 0) == 0) + if (volume_id_probe_sysv(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_minix(vid, 0) == 0) + if (volume_id_probe_minix(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_ocfs1(vid, 0) == 0) + if (volume_id_probe_ocfs1(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_ocfs2(vid, 0) == 0) + if (volume_id_probe_ocfs2(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_vxfs(vid, 0) == 0) + if (volume_id_probe_vxfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_squashfs(vid, 0) == 0) + if (volume_id_probe_squashfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_netware(vid, 0) == 0) + if (volume_id_probe_netware(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_gfs(vid, 0) == 0) + if (volume_id_probe_gfs(vid, 0, 0) == 0) printf("%s\n", vid->type); - if (volume_id_probe_gfs2(vid, 0) == 0) + if (volume_id_probe_gfs2(vid, 0, 0) == 0) printf("%s\n", vid->type); goto exit; -- cgit v1.2.3-54-g00ecf From 353b00edbcd4da7a2758b50e1e4abf18ac2c6625 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 27 Jul 2006 10:53:11 +0200 Subject: Fix inotify syscalls on ARM This patch fixes the inotify syscalls on ARM so they work. It uses __NR_SYSCALL_BASE from the libc headers (via sys/syscall.h) as this value depends on which ABI you're using and trying to work that out gets complicated. Signed-off-by: Richard Purdie --- udev_libc_wrapper.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index ed8070947f..238a4752f2 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -58,9 +58,9 @@ # define __NR_inotify_add_watch 152 # define __NR_inotify_rm_watch 156 #elif defined (__arm__) -# define __NR_inotify_init 316 -# define __NR_inotify_add_watch 317 -# define __NR_inotify_rm_watch 318 +# define __NR_inotify_init __NR_SYSCALL_BASE+316 +# define __NR_inotify_add_watch __NR_SYSCALL_BASE+317 +# define __NR_inotify_rm_watch __NR_SYSCALL_BASE+318 #elif defined (__sh__) # define __NR_inotify_init 290 # define __NR_inotify_add_watch 291 -- cgit v1.2.3-54-g00ecf From e861e01341e5590d7c0b71d601f3453fa05d01f7 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Sat, 29 Jul 2006 01:00:16 +0200 Subject: make rename_netif() error messages useful --- udev_device.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/udev_device.c b/udev_device.c index ed41c856e5..87f90c7676 100644 --- a/udev_device.c +++ b/udev_device.c @@ -106,7 +106,7 @@ static int rename_netif(struct udevice *udev) /* see if the destination interface name already exists */ if (errno != EEXIST) { - err("error changing netif name: %s", strerror(errno)); + err("error changing netif name %s to %s: %s", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } @@ -115,7 +115,7 @@ static int rename_netif(struct udevice *udev) strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) { - err("error changing netif name: %s", strerror(errno)); + err("error changing netif name %s to %s: %s", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } @@ -127,7 +127,8 @@ static int rename_netif(struct udevice *udev) retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) { if (errno != EEXIST) { - err("error changing net interface name: %s", strerror(errno)); + err("error changing net interface name %s to %s: %s", + ifr.ifr_name, ifr.ifr_newname, strerror(errno)); break; } dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop); -- cgit v1.2.3-54-g00ecf From 1d569d17b2400c9d4b2b3aed0b050a32084583b4 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Sat, 29 Jul 2006 01:01:21 +0200 Subject: path_id: fix an harmless syntax error --- extras/path_id/path_id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 825c77c3b1..a9182af6e0 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -220,7 +220,7 @@ handle_scsi () { } handle_firewire () { - :handle_firewire $* + : handle_firewire $* local DEV=$1 if [ -f "$D/ieee1394_id" ] ; then read ieee1394_id < $D/ieee1394_id -- cgit v1.2.3-54-g00ecf From 21dabee8a78bdde10bdb23bd3002c8aa09a161d3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Jul 2006 01:48:11 +0200 Subject: man pages: replace 'device-path' by 'devpath' --- udevinfo.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/udevinfo.xml b/udevinfo.xml index ac2d0202f1..0e2874973b 100644 --- a/udevinfo.xml +++ b/udevinfo.xml @@ -39,8 +39,8 @@ udevinfo - - + + @@ -78,14 +78,14 @@ - + - The sysfs path of the device to query. + The devpath of the device to query. - + The name of the device node or a symlink to query -- cgit v1.2.3-54-g00ecf From 660508cdcb1133735845a444d414a7a637ef28ba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Jul 2006 02:08:58 +0200 Subject: man pages: work around xmlto which tries to be smart --- udev.7 | 108 ++++++++++++++++++++++++++++++-------------------------- udev.xml | 14 +------- udevd.8 | 21 ++++++----- udevd.xml | 14 +------- udevinfo.8 | 33 +++++++++-------- udevinfo.xml | 14 +------- udevmonitor.8 | 13 ++++--- udevmonitor.xml | 14 +------- udevsettle.8 | 15 ++++---- udevsettle.xml | 14 +------- udevstart.8 | 11 +++--- udevstart.xml | 14 +------- udevtest.8 | 11 +++--- udevtest.xml | 14 +------- udevtrigger.8 | 17 +++++---- udevtrigger.xml | 14 +------- 16 files changed, 136 insertions(+), 205 deletions(-) diff --git a/udev.7 b/udev.7 index 332db04f1f..8a2ea16a61 100644 --- a/udev.7 +++ b/udev.7 @@ -1,7 +1,10 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.\" Title: udev +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: August 2005 +.\" Manual: udev +.\" Source: udev +.\" .TH "UDEV" "7" "August 2005" "udev" "udev" .\" disable hyphenation .nh @@ -28,22 +31,23 @@ All udev configuration files are placed in .PP udev expects its main configuration file at \fI/etc/udev/udev.conf\fR. It consists of a set of variables allowing the user to override default udev values. The following variables can be set: -.TP +.TP 3n \fBudev_root\fR Specifies where to place the device nodes in the filesystem. The default value is \fI/dev\fR. -.TP +.TP 3n \fBudev_rules\fR The name of the udev rules file or directory to look for files with the suffix \fI.rules\fR. Multiple rule files are read in lexical order. The default value is \fI/etc/udev/rules.d\fR. -.TP +.TP 3n \fBudev_log\fR The logging priority. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, \fBinfo\fR and \fBdebug\fR. +.\" end of SS subsection "Configuration file" .SS "Rules files" .PP The udev rules are read from the files located in the @@ -51,105 +55,105 @@ The udev rules are read from the files located in the directory or at the location specified value in the configuraton file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignement keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. .PP A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: -.TP +.TP 3n \fB==\fR Compare for equality. -.TP +.TP 3n \fB!=\fR Compare for non\-equality. -.TP +.TP 3n \fB=\fR Asign a value to a key. Keys that represent a list, are reset and only this single value is assigned. -.TP +.TP 3n \fB+=\fR Add the value to a key that holds a list of entries. -.TP +.TP 3n \fB:=\fR Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules. .PP The following key names can be used to match against device properties: -.TP +.TP 3n \fBACTION\fR Match the name of the event action. -.TP +.TP 3n \fBKERNEL\fR Match the name of the device. -.TP +.TP 3n \fBDEVPATH\fR Match the devpath of the device. -.TP +.TP 3n \fBSUBSYSTEM\fR Match the subsystem of the device. -.TP +.TP 3n \fBBUS\fR Search the devpath upwards for a matching device subsystem name. -.TP +.TP 3n \fBDRIVER\fR Search the devpath upwards for a matching device driver name. -.TP +.TP 3n \fBID\fR Search the devpath upwards for a matching device name. -.TP +.TP 3n \fBSYSFS{\fR\fB\fIfilename\fR\fR\fB}\fR Search the devpath upwards for a device with matching sysfs attribute values. Up to five \fBSYSFS\fR keys can be specified per rule. All attributes must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. -.TP +.TP 3n \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR Match against the value of an environment variable. Up to five \fBENV\fR keys can be specified per rule. This key can also be used to export a variable to the environment. -.TP +.TP 3n \fBPROGRAM\fR Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key. -.TP +.TP 3n \fBRESULT\fR Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call. .PP Most of the fields support a shell style pattern matching. The following pattern characters are supported: -.TP +.TP 3n \fB*\fR Matches zero, or any number of characters. -.TP +.TP 3n \fB?\fR Matches any single character. -.TP +.TP 3n \fB[]\fR Matches any single character specified within the brackets. example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. .PP The following keys can get values assigned: -.TP +.TP 3n \fBNAME\fR The name of the node to be created, or the name the network interface should be renamed to. Only one rule can set the node name, all later rules with a NAME key will be ignored. -.TP +.TP 3n \fBSYMLINK\fR The name of a symlink targeting the node. Every matching rule can add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character. -.TP +.TP 3n \fBOWNER, GROUP, MODE\fR The permissions for the device node. Every specified value overwrites the compiled\-in default value. -.TP +.TP 3n \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR Export a variable to the environment. This key can also be used to match against an environment variable. -.TP +.TP 3n \fBRUN\fR Add a program to the list of programs to be executed for a specific device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. -.TP +.TP 3n \fBLABEL\fR Named label where a GOTO can jump to. -.TP +.TP 3n \fBGOTO\fR Jumps to the next LABEL with a matching name -.TP +.TP 3n \fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR Import the printed result or the value of a file in environment key format into the event environment. \fBprogram\fR will execute an external program and read its output. \fBfile\fR will inport a text file. If no option is given, udev will determine it from the executable bit of of the file permissions. -.TP +.TP 3n \fBWAIT_FOR_SYSFS\fR Wait for the specified sysfs file of the device to be created. Can be used to fight against kernel sysfs timing issues. -.TP +.TP 3n \fBOPTIONS\fR \fBlast_rule\fR stops further rules application. No later rules will have any effect. @@ -171,56 +175,58 @@ and fields support simple printf\-like string substitutions. The \fBRUN\fR format chars gets applied after all rules have been processed, right before the program is executed. It allows the use of the complete environment set by earlier matching rules. For all other fields, substitutions are applied while the individual rule is being processed. The available substitutions are: -.TP +.TP 3n \fB$kernel\fR, \fB%k\fR The kernel name for this device. -.TP +.TP 3n \fB$number\fR, \fB%n\fR The kernel number for this device. For example, 'sda3' has kernel number of '3' -.TP +.TP 3n \fB$devpath\fR, \fB%p\fR The devpath of the device. -.TP +.TP 3n \fB$id\fR, \fB%b\fR The name of the device matched while searching the devpath upwards for \fBBUS\fR, -\fBID\fR\fBDRIVER\fR +\fBID\fR +\fBDRIVER\fR and \fBSYSFS\fR. -.TP +.TP 3n \fB$sysfs{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR The value of a sysfs attribute found at the current or a parent device. -.TP +.TP 3n \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR The value of an environment variable. -.TP +.TP 3n \fB$major\fR, \fB%M\fR The kernel major number for the device. -.TP +.TP 3n \fB$minor\fR \fB%m\fR The kernel minor number for the device. -.TP +.TP 3n \fB$result\fR, \fB%c\fR The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: \fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: \fB%c{N+}\fR -.TP +.TP 3n \fB$parent\fR, \fB%P\fR The node name of the parent device. -.TP +.TP 3n \fB$root\fR, \fB%r\fR The udev_root value. -.TP +.TP 3n \fB$tempnode\fR, \fB%N\fR The name of a created temporary device node to provide access to the device from a external program before the real node is created. -.TP +.TP 3n \fB%%\fR The '%' character itself. -.TP +.TP 3n \fB$$\fR The '$' character itself. .PP The count of characters to be substituted may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute +.\" end of SS subsection "Rules files" .SH "AUTHOR" .PP Written by Greg Kroah\-Hartman diff --git a/udev.xml b/udev.xml index 958c10d1d6..84c66c626e 100644 --- a/udev.xml +++ b/udev.xml @@ -3,19 +3,6 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
            - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2006 - Kay Sievers - - -
            udev @@ -28,6 +15,7 @@ udev 7 + diff --git a/udevd.8 b/udevd.8 index 6fbe1cbf91..a57ff7aab0 100644 --- a/udevd.8 +++ b/udevd.8 @@ -1,7 +1,10 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.\" Title: udevd +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: August 2005 +.\" Manual: udevd, udevcontrol +.\" Source: udev +.\" .TH "UDEVD" "8" "August 2005" "udev" "udevd, udevcontrol" .\" disable hyphenation .nh @@ -18,24 +21,24 @@ udevd \- event managing daemon .PP udevd listens to kernel uevents and passes the incoming events to udev. It ensures the right event order and takes care, that events for child devices are delayed until the parent has finished the device handling. .SH "OPTIONS" -.TP +.TP 3n \fB\-\-daemon\fR Detach and run in the background. -.TP +.TP 3n \fBlog_priority=\fR\fB\fIvalue\fR\fR udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, \fBinfo\fR and \fBdebug\fR. -.TP +.TP 3n \fBstop_exec_queue\fR udevcontrol stops the execution of events from udevd. -.TP +.TP 3n \fBstart_exec_queue\fR udevcontrol starts the execution of events from udevd. .SH "ENVIRONMENT" -.TP +.TP 3n \fBUDEV_LOG\fR Overrides the syslog priority specified in the config file. .SH "AUTHOR" diff --git a/udevd.xml b/udevd.xml index 1a035b71e9..7feede2777 100644 --- a/udevd.xml +++ b/udevd.xml @@ -3,19 +3,6 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
            - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - -
            udevd, udevcontrol @@ -28,6 +15,7 @@ udevd 8 + diff --git a/udevinfo.8 b/udevinfo.8 index 93aea361e9..4430f5d9d3 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -1,7 +1,10 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.\" Title: udevinfo +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: August 2005 +.\" Manual: udevinfo +.\" Source: udev +.\" .TH "UDEVINFO" "8" "August 2005" "udev" "udevinfo" .\" disable hyphenation .nh @@ -11,12 +14,12 @@ udevinfo \- query device information from the udev database .SH "SYNOPSIS" .HP 9 -\fBudevinfo\fR [\fB\-q\ \fR\fB\fIquery\-type\fR\fR] [\fB\-a\ \fR] [\fB\-p\ \fR\fB\fIdevice\-path\fR\fR] [\fB\-n\ \fR\fB\fInode\-name\fR\fR] [\fB\-r\fR] [\fB\-e\fR] [\fB\-V\fR] [\fB\-h\fR] +\fBudevinfo\fR [\fB\-q\ \fR\fB\fIquery\-type\fR\fR] [\fB\-a\ \fR] [\fB\-p\ \fR\fB\fIdevpath\fR\fR] [\fB\-n\ \fR\fB\fInode\fR\fR] [\fB\-r\fR] [\fB\-e\fR] [\fB\-V\fR] [\fB\-h\fR] .SH "DESCRIPTION" .PP udevinfo queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device. .SH "OPTIONS" -.TP +.TP 3n \fB\-q\fR Query the database for specified type of device data. It needs the \fB\-p\fR @@ -28,16 +31,16 @@ to identify the specified device. Valid queries are: \fBpath\fR, \fBenv\fR, \fBall\fR. -.TP +.TP 3n \fB\-a\fR Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules. -.TP -\fB\-p \fR\fB\fIdevice\-path\fR\fR -The sysfs path of the device to query. -.TP -\fB\-n \fR\fB\fInode\-name\fR\fR +.TP 3n +\fB\-p \fR\fB\fIdevpath\fR\fR +The devpath of the device to query. +.TP 3n +\fB\-n \fR\fB\fInode\fR\fR The name of the device node or a symlink to query -.TP +.TP 3n \fB\-r\fR The udev root directory: \fI/dev\fR. If used in conjunction with a @@ -45,10 +48,10 @@ The udev root directory: or \fBsymlink\fR query, the query returns the absolute path. -.TP +.TP 3n \fB\-e\fR Export the content of the udev database. -.TP +.TP 3n \fB\-h\fR Print help text. .SH "AUTHOR" diff --git a/udevinfo.xml b/udevinfo.xml index 0e2874973b..9bd0b8dc17 100644 --- a/udevinfo.xml +++ b/udevinfo.xml @@ -3,19 +3,6 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
            - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - -
            udevinfo @@ -28,6 +15,7 @@ udevinfo 8 + diff --git a/udevmonitor.8 b/udevmonitor.8 index 243e7b8279..4577aef95c 100644 --- a/udevmonitor.8 +++ b/udevmonitor.8 @@ -1,7 +1,10 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.\" Title: udevmonitor +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: August 2005 +.\" Manual: udevmonitor +.\" Source: udev +.\" .TH "UDEVMONITOR" "8" "August 2005" "udev" "udevmonitor" .\" disable hyphenation .nh @@ -16,7 +19,7 @@ udevmonitor \- print the kernel and udev event sequence to the console .PP udevmonitor listens to the kernel uevents and events send out by a udev rule and prints the devpath of the event to the console. It can be used analyze to the event timing by comparing the timestamps of the kernel uevent with the udev event. .SH "OPTIONS" -.TP +.TP 3n \fB\-\-env\fR Print the complete environment for all events. Can be used to compare the kernel supplied and the udev added environment values. .SH "AUTHOR" diff --git a/udevmonitor.xml b/udevmonitor.xml index 349ec2ca3d..d40a14c698 100644 --- a/udevmonitor.xml +++ b/udevmonitor.xml @@ -3,19 +3,6 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
            - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - -
            udevmonitor @@ -28,6 +15,7 @@ udevmonitor 8 + diff --git a/udevsettle.8 b/udevsettle.8 index 601553980d..2a51948d74 100644 --- a/udevsettle.8 +++ b/udevsettle.8 @@ -1,7 +1,10 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.\" Title: udevsettle +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: March 2006 +.\" Manual: udevsettle +.\" Source: udev +.\" .TH "UDEVSETTLE" "8" "March 2006" "udev" "udevsettle" .\" disable hyphenation .nh @@ -16,11 +19,11 @@ udevsettle \- wait until queued kernel/udev events are handled .PP Waits watching the udev event queue and exits if all current events are handled. .SH "OPTIONS" -.TP +.TP 3n \fB\-\-timeout=\fR\fB\fIseconds\fR\fR maximum seconds to wait for the queue to become empty. .SH "ENVIRONMENT" -.TP +.TP 3n \fBUDEV_LOG\fR Overrides the syslog priority specified in the config file. .SH "AUTHOR" diff --git a/udevsettle.xml b/udevsettle.xml index 5f8f1ee0a5..8eb8cbd523 100644 --- a/udevsettle.xml +++ b/udevsettle.xml @@ -3,19 +3,6 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
            - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2006 - Kay Sievers - - -
            udevsettle @@ -28,6 +15,7 @@ udevsettle 8 + diff --git a/udevstart.8 b/udevstart.8 index 11ac92d313..9f18c05d07 100644 --- a/udevstart.8 +++ b/udevstart.8 @@ -1,7 +1,10 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.\" Title: udevstart +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: August 2005 +.\" Manual: udevstart +.\" Source: udev +.\" .TH "UDEVSTART" "8" "August 2005" "udev" "udevstart" .\" disable hyphenation .nh diff --git a/udevstart.xml b/udevstart.xml index b3e283f523..c48de7c32c 100644 --- a/udevstart.xml +++ b/udevstart.xml @@ -3,19 +3,6 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
            - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - -
            udevstart @@ -28,6 +15,7 @@ udevstart 8 + diff --git a/udevtest.8 b/udevtest.8 index d33abd1aa3..da435bc4e4 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -1,7 +1,10 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.\" Title: udevtest +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: August 2005 +.\" Manual: udevtest +.\" Source: udev +.\" .TH "UDEVTEST" "8" "August 2005" "udev" "udevtest" .\" disable hyphenation .nh diff --git a/udevtest.xml b/udevtest.xml index 58714be5a7..81f674da9d 100644 --- a/udevtest.xml +++ b/udevtest.xml @@ -3,19 +3,6 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
            - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2005 - Kay Sievers - - -
            udevtest @@ -28,6 +15,7 @@ udevtest 8 + diff --git a/udevtrigger.8 b/udevtrigger.8 index e0c2059ba0..de31f2e745 100644 --- a/udevtrigger.8 +++ b/udevtrigger.8 @@ -1,7 +1,10 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.\" Title: udevtrigger +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: March 2006 +.\" Manual: udevtrigger +.\" Source: udev +.\" .TH "UDEVTRIGGER" "8" "March 2006" "udev" "udevtrigger" .\" disable hyphenation .nh @@ -16,14 +19,14 @@ udevtrigger \- request kernel devices events for coldplug .PP Trigger kernel device uevents to replay missing events at system coldplug. .SH "OPTIONS" -.TP +.TP 3n \fB\-\-verbose\fR print out the devices found in sysfs. -.TP +.TP 3n \fB\-\-dry\-run\fR don't actually trigger the event. .SH "ENVIRONMENT" -.TP +.TP 3n \fBUDEV_LOG\fR Overrides the syslog priority specified in the config file. .SH "AUTHOR" diff --git a/udevtrigger.xml b/udevtrigger.xml index c9b60d18fe..990cf63589 100644 --- a/udevtrigger.xml +++ b/udevtrigger.xml @@ -3,19 +3,6 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
            - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2006 - Kay Sievers - - -
            udevtrigger @@ -28,6 +15,7 @@ udevtrigger 8 + -- cgit v1.2.3-54-g00ecf From 55c1768ca1aff74b52644b5a96cae868100254a8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Jul 2006 02:13:42 +0200 Subject: refresh vol_id man page --- extras/volume_id/vol_id.8 | 27 ++++++++++++--------------- extras/volume_id/vol_id.xml | 14 +------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index 15fccbe97e..3129ab1b91 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -1,7 +1,10 @@ -.\" ** You probably do not want to edit this file directly ** -.\" It was generated using the DocBook XSL Stylesheets (version 1.69.1). -.\" Instead of manually editing it, you probably should edit the DocBook XML -.\" source for it and then use the DocBook XSL Stylesheets to regenerate it. +.\" Title: vol_id +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: March 2006 +.\" Manual: vol_id +.\" Source: volume_id +.\" .TH "VOL_ID" "8" "March 2006" "volume_id" "vol_id" .\" disable hyphenation .nh @@ -19,26 +22,20 @@ is usually called from a udev rule, to provide udev with the filesystem type, th \fBvol_id\fR supports all common filesystem formats and detects various raid setups to prevent the recognition of raid members as a volume with a filesystem. .SH "OPTIONS" -.TP +.TP 3n \fB\-\-export\fR print all values in key/value format to import them into the environment. -.TP +.TP 3n \fB\-t\fR print the filesystem type -.TP +.TP 3n \fB\-l\fR print the label of a volume -.TP +.TP 3n \fB\-u\fR print the uuid of a volume -.TP -\fB\-\-skip-raid\fR -skip probing for raid signatures -.TP -\fB\-\-probe-all\fR -probe for all known signatures to detect possible conflicts .SH "ENVIRONMENT" -.TP +.TP 3n \fBUDEV_LOG\fR Set the syslog priority. .SH "EXIT STATUS" diff --git a/extras/volume_id/vol_id.xml b/extras/volume_id/vol_id.xml index 0d4130e33f..b9b35abaa4 100644 --- a/extras/volume_id/vol_id.xml +++ b/extras/volume_id/vol_id.xml @@ -3,19 +3,6 @@ "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
            - - xmlto - - Kay - Sievers - kay.sievers@vrfy.org - - - 2006 - Kay Sievers - - -
            vol_id @@ -28,6 +15,7 @@ vol_id 8 + -- cgit v1.2.3-54-g00ecf From 22f5934a852d623d56746b23175f5e5036c7ae27 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 Jul 2006 15:54:28 +0200 Subject: udevinfo: add DRIVER== --- udevinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevinfo.c b/udevinfo.c index 567193adc7..e0ea5fb4ed 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -105,6 +105,7 @@ static int print_device_chain(const char *devpath) printf(" looking at device '%s':\n", dev->devpath); printf(" KERNEL==\"%s\"\n", dev->kernel_name); printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); + printf(" DRIVER==\"%s\"\n", dev->driver); print_all_attributes(dev->devpath); /* walk up the chain of devices */ -- cgit v1.2.3-54-g00ecf From b5adfb4f3387a5dcfcdb5a5996c249b1d14aa44a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Aug 2006 00:00:15 +0200 Subject: Makefile: fix dependency --- Makefile | 1 + udev_libc_wrapper.h | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ac5702b776..75789b9996 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ PROGRAMS = \ HEADERS = \ udev.h \ + udevd.h \ udev_rules.h \ logging.h \ udev_libc_wrapper.h \ diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 238a4752f2..6755aa1c74 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -137,7 +137,7 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) #define asmlinkage #endif /* __i386__ */ -/* headers are broken on some lazy platforms */ +/* headers are broken on some architectures */ #ifndef __FD_SET #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) #endif @@ -151,9 +151,8 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) #define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) #endif -/* missing in some lazy distros */ #ifndef NETLINK_KOBJECT_UEVENT -#define NETLINK_KOBJECT_UEVENT 15 +#define NETLINK_KOBJECT_UEVENT 15 #endif #ifndef SO_RCVBUFFORCE -- cgit v1.2.3-54-g00ecf From eb82b76dedc1482b6434c46fee84d3ef13cb9648 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Aug 2006 00:02:58 +0200 Subject: libvolume_id: read ufs2 label Taken from the FreeBSD HAL repository. --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/ufs.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index f53e5f1141..e5fd5fcddd 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 68 +SHLIB_REV = 69 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c index 2713a63d4d..4ace8c99fd 100644 --- a/extras/volume_id/lib/ufs.c +++ b/extras/volume_id/lib/ufs.c @@ -205,6 +205,18 @@ int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size) found: volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "ufs"; + switch (magic) { + case UFS_MAGIC: + strcpy(id->type_version, "1"); + break; + case UFS2_MAGIC: + strcpy(id->type_version, "2"); + volume_id_set_label_raw(id, ufs->fs_u11.fs_u2.fs_volname, 32); + volume_id_set_label_string(id, ufs->fs_u11.fs_u2.fs_volname, 32); + break; + default: + break; + } return 0; } -- cgit v1.2.3-54-g00ecf From 05ec6e7507d159e5a02a82927c6571b7e516c52e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Aug 2006 00:35:05 +0200 Subject: switch ifdef __KLIBC__ to ifndef __GLIBC__ --- Makefile | 9 --------- README | 4 ---- extras/scsi_id/scsi_id.c | 3 +-- test/simple-build-check.sh | 8 -------- udev_libc_wrapper.c | 2 +- udev_libc_wrapper.h | 4 ++-- 6 files changed, 4 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 75789b9996..bab1732da4 100644 --- a/Makefile +++ b/Makefile @@ -33,9 +33,6 @@ USE_GCOV = false # include Security-Enhanced Linux support USE_SELINUX = false -# comile with klibc instead of glibc -USE_KLIBC = false - # set this to create statically linked binaries USE_STATIC = false @@ -142,12 +139,6 @@ ifeq ($(strip $(USE_GCOV)),true) LDFLAGS += -fprofile-arcs endif -ifeq ($(strip $(USE_KLIBC)),true) - KLCC = /usr/bin/$(CROSS_COMPILE)klcc - CC = $(KLCC) - LD = $(KLCC) -endif - ifeq ($(strip $(USE_SELINUX)),true) UDEV_OBJS += udev_selinux.o LIB_OBJS += -lselinux -lsepol diff --git a/README b/README index 7ac1d4509c..92088ac6f5 100644 --- a/README +++ b/README @@ -69,10 +69,6 @@ Compile Options: USE_SELINUX If set to 'true', udev will be built with SELinux support enabled. This is disabled by default. - USE_KLIBC - If set to 'true', udev is built and linked against klibc. - Default value is 'false'. KLCC specifies the klibc compiler - wrapper, usually located at /usr/bin/klcc. EXTRAS list of helper programs in extras/ to build. make EXTRAS="extras/cdrom_id extras/scsi_id extras/volume_id" diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 2ffc95fbfe..446df70949 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -402,8 +402,7 @@ static int set_options(int argc, char **argv, const char *short_opts, /* * optind is a global extern used by getopt. Since we can call * set_options twice (once for command line, and once for config - * file) we have to reset this back to 1. [Note glibc handles - * setting this to 0, but klibc does not.] + * file) we have to reset this back to 1. */ optind = 1; while (1) { diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 6d7272f80e..6a03608477 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -23,14 +23,6 @@ make clean EXTRAS="$EXTRAS" >/dev/null make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit echo -e "\n\n" -# klibc build -if [ -n "$KLCC" -a -e "$KLCC" ]; then - echo KLCC: "$KLCC" - make clean EXTRAS="$EXTRAS" >/dev/null - make all -j4 $MAKEOPTS USE_KLIBC=true DEBUG=true EXTRAS="$EXTRAS" KLCC="$KLCC" || exit - echo -e "\n\n" -fi - # install in temporary dir and show it TEMPDIR="`pwd`/.tmp" rm -rf $TEMPDIR diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index 1711811e83..48a893cfb1 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -30,7 +30,7 @@ #include "udev.h" -#ifdef __KLIBC__ +#ifndef __GLIBC__ #define __OWN_USERDB_PARSER__ #endif diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h index 6755aa1c74..21dbce6474 100644 --- a/udev_libc_wrapper.h +++ b/udev_libc_wrapper.h @@ -105,7 +105,7 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) } #else /* needed until /usr/include/sys/inotify.h is working */ -#ifdef __KLIBC__ +#ifndef __GLIBC__ #include #else static inline int inotify_init(void) @@ -117,7 +117,7 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) { return syscall(__NR_inotify_add_watch, fd, name, mask); } -#endif /* __KLIBC__ */ +#endif /* __GLIBC__ */ #endif /* __NR_inotify_init */ #ifndef IN_CREATE -- cgit v1.2.3-54-g00ecf From e62fea35135359ffd6659e8134af528170179a3b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Aug 2006 04:59:25 +0200 Subject: report failing getpwnam/getgrnam as error --- udev_libc_wrapper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c index 48a893cfb1..35e01e619d 100644 --- a/udev_libc_wrapper.c +++ b/udev_libc_wrapper.c @@ -100,7 +100,7 @@ uid_t lookup_user(const char *user) pw = getpwnam(user); if (pw == NULL) - info("specified user unknown '%s'", user); + err("error resolving user '%s': %s", user, strerror(errno)); else uid = pw->pw_uid; @@ -114,7 +114,7 @@ gid_t lookup_group(const char *group) gr = getgrnam(group); if (gr == NULL) - info("specified group unknown '%s'", group); + err("error resolving group '%s': %s", group, strerror(errno)); else gid = gr->gr_gid; -- cgit v1.2.3-54-g00ecf From b3518c16e3c3795a5ff278ef4c71f8e439057d6d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Aug 2006 13:22:44 +0200 Subject: rename udevcontrol message types and variables --- udevcontrol.c | 26 +++++++++++----------- udevd.c | 71 +++++++++++++++++++++++++++++------------------------------ udevd.h | 35 ++++++++++++++--------------- 3 files changed, 64 insertions(+), 68 deletions(-) diff --git a/udevcontrol.c b/udevcontrol.c index 2d93f65ce8..3044d02f0b 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -63,7 +63,7 @@ static void usage(void) int main(int argc, char *argv[], char *envp[]) { - static struct udevd_msg usend_msg; + static struct udevd_ctrl_msg ctrl_msg; struct sockaddr_un saddr; socklen_t addrlen; const char *env; @@ -85,28 +85,28 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - memset(&usend_msg, 0x00, sizeof(struct udevd_msg)); - strcpy(usend_msg.magic, UDEV_MAGIC); + memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); + strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); for (i = 1 ; i < argc; i++) { char *arg = argv[i]; if (!strcmp(arg, "stop_exec_queue")) - usend_msg.type = UDEVD_STOP_EXEC_QUEUE; + ctrl_msg.type = UDEVD_CTRL_STOP_EXEC_QUEUE; else if (!strcmp(arg, "start_exec_queue")) - usend_msg.type = UDEVD_START_EXEC_QUEUE; + ctrl_msg.type = UDEVD_CTRL_START_EXEC_QUEUE; else if (!strcmp(arg, "reload_rules")) - usend_msg.type = UDEVD_RELOAD_RULES; + ctrl_msg.type = UDEVD_CTRL_RELOAD_RULES; else if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { - intval = (int *) usend_msg.envbuf; + intval = (int *) ctrl_msg.buf; val = &arg[strlen("log_priority=")]; - usend_msg.type = UDEVD_SET_LOG_LEVEL; + ctrl_msg.type = UDEVD_CTRL_SET_LOG_LEVEL; *intval = log_priority(val); info("send log_priority=%i", *intval); } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { - intval = (int *) usend_msg.envbuf; + intval = (int *) ctrl_msg.buf; val = &arg[strlen("max_childs=")]; - usend_msg.type = UDEVD_SET_MAX_CHILDS; + ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS; *intval = atoi(val); info("send max_childs=%i", *intval); } else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { @@ -133,15 +133,15 @@ int main(int argc, char *argv[], char *envp[]) memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); + strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - retval = sendto(sock, &usend_msg, sizeof(usend_msg), 0, (struct sockaddr *)&saddr, addrlen); + retval = sendto(sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&saddr, addrlen); if (retval == -1) { err("error sending message: %s", strerror(errno)); retval = 1; } else { - dbg("sent message type=0x%02x, %u bytes sent", usend_msg.type, retval); + dbg("sent message type=0x%02x, %u bytes sent", ctrl_msg.type, retval); retval = 0; } diff --git a/udevd.c b/udevd.c index 344a806c06..b221692944 100644 --- a/udevd.c +++ b/udevd.c @@ -1,7 +1,7 @@ /* * udevd.c - event listener and serializer * - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2006 Kay Sievers * Copyright (C) 2004 Chris Friesen * * @@ -86,7 +86,7 @@ static void asmlinkage udev_event_sig_handler(int signum) exit(1); } -static int udev_event_process(struct uevent_msg *msg) +static int udev_event_process(struct udevd_uevent_msg *msg) { struct sigaction act; struct udevice *udev; @@ -153,13 +153,13 @@ enum event_state { EVENT_FAILED, }; -static void export_event_state(struct uevent_msg *msg, enum event_state state) +static void export_event_state(struct udevd_uevent_msg *msg, enum event_state state) { char filename[PATH_SIZE]; char filename_failed[PATH_SIZE]; char target[PATH_SIZE]; size_t start, end, i; - struct uevent_msg *loop_msg; + struct udevd_uevent_msg *loop_msg; /* add location of queue files */ strlcpy(filename, udev_root, sizeof(filename)); @@ -226,7 +226,7 @@ static void export_event_state(struct uevent_msg *msg, enum event_state state) } } -static void msg_queue_delete(struct uevent_msg *msg) +static void msg_queue_delete(struct udevd_uevent_msg *msg) { list_del(&msg->node); @@ -239,7 +239,7 @@ static void msg_queue_delete(struct uevent_msg *msg) free(msg); } -static void udev_event_run(struct uevent_msg *msg) +static void udev_event_run(struct udevd_uevent_msg *msg) { pid_t pid; int retval; @@ -278,7 +278,7 @@ static void udev_event_run(struct uevent_msg *msg) } } -static void msg_queue_insert(struct uevent_msg *msg) +static void msg_queue_insert(struct udevd_uevent_msg *msg) { char filename[PATH_SIZE]; int fd; @@ -431,9 +431,9 @@ static int compare_devpath(const char *running, const char *waiting) } /* returns still running task for the same device, its parent or its physical device */ -static int running_with_devpath(struct uevent_msg *msg, int limit) +static int running_with_devpath(struct udevd_uevent_msg *msg, int limit) { - struct uevent_msg *loop_msg; + struct udevd_uevent_msg *loop_msg; int childs_count = 0; list_for_each_entry(loop_msg, &running_list, node) { @@ -464,8 +464,8 @@ static int running_with_devpath(struct uevent_msg *msg, int limit) /* exec queue management routine executes the events and serializes events in the same sequence */ static void msg_queue_manager(void) { - struct uevent_msg *loop_msg; - struct uevent_msg *tmp_msg; + struct udevd_uevent_msg *loop_msg; + struct udevd_uevent_msg *tmp_msg; int running; if (list_empty(&exec_list)) @@ -501,18 +501,18 @@ static void msg_queue_manager(void) } } -static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) +static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) { int bufpos; int i; - struct uevent_msg *msg; + struct udevd_uevent_msg *msg; int major = 0; int minor = 0; - msg = malloc(sizeof(struct uevent_msg) + buf_size); + msg = malloc(sizeof(struct udevd_uevent_msg) + buf_size); if (msg == NULL) return NULL; - memset(msg, 0x00, sizeof(struct uevent_msg) + buf_size); + memset(msg, 0x00, sizeof(struct udevd_uevent_msg) + buf_size); /* copy environment buffer and reconstruct envp */ memcpy(msg->envbuf, buf, buf_size); @@ -558,9 +558,9 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) } /* receive the udevd message from userspace */ -static void get_udevd_msg(void) +static void get_ctrl_msg(void) { - struct udevd_msg ctrl_msg; + struct udevd_ctrl_msg ctrl_msg; ssize_t size; struct msghdr smsg; struct cmsghdr *cmsg; @@ -569,9 +569,9 @@ static void get_udevd_msg(void) char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; int *intval; - memset(&ctrl_msg, 0x00, sizeof(struct udevd_msg)); + memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); iov.iov_base = &ctrl_msg; - iov.iov_len = sizeof(struct udevd_msg); + iov.iov_len = sizeof(struct udevd_ctrl_msg); memset(&smsg, 0x00, sizeof(struct msghdr)); smsg.msg_iov = &iov; @@ -598,34 +598,34 @@ static void get_udevd_msg(void) return; } - if (strncmp(ctrl_msg.magic, UDEV_MAGIC, sizeof(UDEV_MAGIC)) != 0 ) { + if (strncmp(ctrl_msg.magic, UDEVD_CTRL_MAGIC, sizeof(UDEVD_CTRL_MAGIC)) != 0 ) { err("message magic '%s' doesn't match, ignore it", ctrl_msg.magic); return; } switch (ctrl_msg.type) { - case UDEVD_STOP_EXEC_QUEUE: + case UDEVD_CTRL_STOP_EXEC_QUEUE: info("udevd message (STOP_EXEC_QUEUE) received"); stop_exec_q = 1; break; - case UDEVD_START_EXEC_QUEUE: + case UDEVD_CTRL_START_EXEC_QUEUE: info("udevd message (START_EXEC_QUEUE) received"); stop_exec_q = 0; msg_queue_manager(); break; - case UDEVD_SET_LOG_LEVEL: - intval = (int *) ctrl_msg.envbuf; + case UDEVD_CTRL_SET_LOG_LEVEL: + intval = (int *) ctrl_msg.buf; info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i", *intval); udev_log_priority = *intval; sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); putenv(udev_log); break; - case UDEVD_SET_MAX_CHILDS: - intval = (int *) ctrl_msg.envbuf; + case UDEVD_CTRL_SET_MAX_CHILDS: + intval = (int *) ctrl_msg.buf; info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i", *intval); max_childs = *intval; break; - case UDEVD_RELOAD_RULES: + case UDEVD_CTRL_RELOAD_RULES: info("udevd message (RELOAD_RULES) received"); reload_config = 1; break; @@ -635,9 +635,9 @@ static void get_udevd_msg(void) } /* receive the kernel user event message and do some sanity checks */ -static struct uevent_msg *get_netlink_msg(void) +static struct udevd_uevent_msg *get_netlink_msg(void) { - struct uevent_msg *msg; + struct udevd_uevent_msg *msg; int bufpos; ssize_t size; static char buffer[UEVENT_BUFFER_SIZE+512]; @@ -660,7 +660,6 @@ static struct uevent_msg *get_netlink_msg(void) msg = get_msg_from_envbuf(&buffer[bufpos], size-bufpos); if (msg == NULL) return NULL; - msg->type = UDEVD_UEVENT_NETLINK; /* validate message */ pos = strchr(buffer, '@'); @@ -709,7 +708,7 @@ static void asmlinkage sig_handler(int signum) static void udev_done(int pid, int exitstatus) { /* find msg associated with pid and delete it */ - struct uevent_msg *msg; + struct udevd_uevent_msg *msg; list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { @@ -755,7 +754,7 @@ static int init_udevd_socket(void) memset(&saddr, 0x00, sizeof(saddr)); saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_SOCK_PATH); + strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); @@ -1026,7 +1025,7 @@ int main(int argc, char *argv[], char *envp[]) maxfd = UDEV_MAX(maxfd, inotify_fd); while (!udev_exit) { - struct uevent_msg *msg; + struct udevd_uevent_msg *msg; int fdcount; FD_ZERO(&readfds); @@ -1043,11 +1042,11 @@ int main(int argc, char *argv[], char *envp[]) continue; } - /* get user socket message */ + /* get control message */ if (FD_ISSET(udevd_sock, &readfds)) - get_udevd_msg(); + get_ctrl_msg(); - /* get kernel netlink message */ + /* get netlink message */ if (FD_ISSET(uevent_netlink_sock, &readfds)) { msg = get_netlink_msg(); if (msg) diff --git a/udevd.h b/udevd.h index 20dde8e8b3..b852b5224d 100644 --- a/udevd.h +++ b/udevd.h @@ -21,9 +21,6 @@ #include "list.h" -#define UDEV_MAGIC "udevd_" UDEV_VERSION -#define UDEVD_SOCK_PATH "/org/kernel/udev/udevd" - #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 @@ -36,29 +33,29 @@ /* start to throttle forking if maximum number of running childs in our session is reached */ #define UDEVD_MAX_CHILDS_RUNNING 16 -/* environment buffer, should match the kernel's size in lib/kobject_uevent.h */ +/* linux/include/linux/kobject.h */ #define UEVENT_BUFFER_SIZE 2048 -#define UEVENT_NUM_ENVP 64 +#define UEVENT_NUM_ENVP 32 -enum udevd_msg_type { - UDEVD_UNKNOWN, - UDEVD_UEVENT_NETLINK, - UDEVD_STOP_EXEC_QUEUE, - UDEVD_START_EXEC_QUEUE, - UDEVD_SET_LOG_LEVEL, - UDEVD_SET_MAX_CHILDS, - UDEVD_RELOAD_RULES, -}; +#define UDEVD_CTRL_SOCK_PATH "/org/kernel/udev/udevd" +#define UDEVD_CTRL_MAGIC "udevd_" UDEV_VERSION +enum udevd_ctrl_msg_type { + UDEVD_CTRL_UNKNOWN, + UDEVD_CTRL_STOP_EXEC_QUEUE, + UDEVD_CTRL_START_EXEC_QUEUE, + UDEVD_CTRL_SET_LOG_LEVEL, + UDEVD_CTRL_SET_MAX_CHILDS, + UDEVD_CTRL_RELOAD_RULES, +}; -struct udevd_msg { +struct udevd_ctrl_msg { char magic[32]; - enum udevd_msg_type type; - char envbuf[UEVENT_BUFFER_SIZE+512]; + enum udevd_ctrl_msg_type type; + char buf[256]; }; -struct uevent_msg { - enum udevd_msg_type type; +struct udevd_uevent_msg { struct list_head node; pid_t pid; int exitstatus; -- cgit v1.2.3-54-g00ecf From 239cc98b80b614be2c7079c153c6a1dc2cdaa7e8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Aug 2006 13:24:05 +0200 Subject: initialize unused sockets to -1 --- udevd.c | 8 +++++--- udevmonitor.c | 19 ++++++++++--------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/udevd.c b/udevd.c index b221692944..eae66255f2 100644 --- a/udevd.c +++ b/udevd.c @@ -47,9 +47,9 @@ #include "udevd.h" static struct udev_rules rules; -static int udevd_sock; -static int uevent_netlink_sock; -static int inotify_fd; +static int udevd_sock = -1; +static int uevent_netlink_sock = -1; +static int inotify_fd = -1; static pid_t sid; static int signal_pipe[2] = {-1, -1}; @@ -770,6 +770,8 @@ static int init_udevd_socket(void) retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { err("bind failed: %s", strerror(errno)); + close(udevd_sock); + udevd_sock = -1; return -1; } diff --git a/udevmonitor.c b/udevmonitor.c index d3d9050dca..4c59a495db 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -1,7 +1,7 @@ /* * udevmonitor.c * - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -36,8 +36,8 @@ #include "udev.h" #include "udevd.h" -static int uevent_netlink_sock; -static int udev_monitor_sock; +static int uevent_netlink_sock = -1; +static int udev_monitor_sock = -1; static volatile int udev_exit; static int init_udev_monitor_socket(void) @@ -148,6 +148,7 @@ int main(int argc, char *argv[]) retval = init_udev_monitor_socket(); if (retval) goto out; + retval = init_uevent_netlink_sock(); if (retval) goto out; @@ -165,9 +166,9 @@ int main(int argc, char *argv[]) buflen = 0; FD_ZERO(&readfds); - if (uevent_netlink_sock > 0) + if (uevent_netlink_sock >= 0) FD_SET(uevent_netlink_sock, &readfds); - if (udev_monitor_sock > 0) + if (udev_monitor_sock >= 0) FD_SET(udev_monitor_sock, &readfds); fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &readfds, NULL, NULL, NULL); @@ -183,7 +184,7 @@ int main(int argc, char *argv[]) } else timestr[0] = '\0'; - if ((uevent_netlink_sock > 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { + if ((uevent_netlink_sock >= 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); if (buflen <= 0) { fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); @@ -192,7 +193,7 @@ int main(int argc, char *argv[]) printf("UEVENT[%s] %s\n", timestr, buf); } - if ((udev_monitor_sock > 0) && FD_ISSET(udev_monitor_sock, &readfds)) { + if ((udev_monitor_sock >= 0) && FD_ISSET(udev_monitor_sock, &readfds)) { buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); if (buflen <= 0) { fprintf(stderr, "error receiving udev message: %s\n", strerror(errno)); @@ -227,9 +228,9 @@ int main(int argc, char *argv[]) } out: - if (uevent_netlink_sock > 0) + if (uevent_netlink_sock >= 0) close(uevent_netlink_sock); - if (udev_monitor_sock > 0) + if (udev_monitor_sock >= 0) close(udev_monitor_sock); if (retval) -- cgit v1.2.3-54-g00ecf From 9824e9a76426eef53713349c0464e9d1411e3b66 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Aug 2006 19:18:41 +0200 Subject: udevd: remove useless udevinitsend parameter --- udevd.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/udevd.c b/udevd.c index eae66255f2..45e9aae771 100644 --- a/udevd.c +++ b/udevd.c @@ -883,10 +883,6 @@ int main(int argc, char *argv[], char *envp[]) info("will daemonize"); daemonize = 1; } - if (strcmp(arg, "--stop-exec-queue") == 0) { - info("will not execute events until START_EXEC_QUEUE is received"); - stop_exec_q = 1; - } } /* init sockets to receive events */ -- cgit v1.2.3-54-g00ecf From 15c02d46f5b7061808c5d37753a2e6cb90f472c8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Aug 2006 03:13:27 +0200 Subject: update README --- README | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/README b/README index 92088ac6f5..74aa7901cf 100644 --- a/README +++ b/README @@ -6,31 +6,29 @@ Important Note: Integrating udev in the system is a whole lot of work, has complex dependencies and differs a lot from distro to distro. All major distros depend on udev these days and the system may not work without a proper installed version. The upstream - udev project does not support or recomend to replace a distro's udev installation + udev project does not support or recommend to replace a distro's udev installation with the upstream version. The installation of a unmodified upstream version may render your system unusable. Until now, there is no "default" setup or a set of "default" rules provided by the upstream udev version. Requirements: - - 2.6.x version of the Linux kernel. See the RELEASE-NOTES file in the - udev tree and the Documentation/Changes in the kernel source tree for - the actual dependency. + - Version 2.6.15 of the Linux kernel for reliable operation of this release of + udev. The kernel may have a requirement on udev too, see Documentation/Changes + in the kernel source tree for the actual dependency. - - The kernel must have sysfs and unix domain socket enabled. + - The kernel must have sysfs, unix domain sockets and networking enabled. (unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, - but it is completely silly - don't complain if anything goes wrong.) + but it is completely silly - don't complain if anything goes wrong.) - - The proc filesystem must be mounted on /proc. - - - The sysfs filesystem must be mounted at /sys. No other location - will be supported by udev. + - The proc filesystem must be mounted on /proc, the sysfs filesystem must + be mounted at /sys. No other location will be supported by udev. Operation: Udev creates and removes device nodes in /dev, based on events the kernel sends out on device discovery or removal. - - Early in the boot process, the /dev directory should get a tmpfs + - Very early in the boot process, the /dev directory should get a 'tmpfs' filesystem mounted, which is populated from scratch by udev. Created nodes or changed permissions will not survive a reboot, which is intentional. @@ -39,12 +37,12 @@ Operation: be copied over to the tmpfs mounted /dev, to provide the required nodes to initialize udev and continue booting. - - The udevd daemon must be started by an init script to receive netlink - uevents from the kernel driver core. + - The old hotplug helper /sbin/hotplug should be disabled on bootup, before + actions like loading kernel modules are taken, which may cause a lot of + events. - - From kernel version 2.6.15 on, the hotplug helper /sbin/hotplug should - be disabled with an init script before actions like loading kernel - modules are taken, which may cause a lot of events. + - The udevd daemon must be started on bootup to receive netlink uevents + from the kernel driver core. - All kernel events are matched against a set of specified rules in /etc/udev/rules.d/ which make it possible to hook into the event -- cgit v1.2.3-54-g00ecf From a77f74dd93f971fddf24b19c0e83cf09874e2638 Mon Sep 17 00:00:00 2001 From: Piter PUNK Date: Tue, 8 Aug 2006 18:10:16 +0200 Subject: update slackware rules --- etc/udev/slackware/udev.rules | 419 ++++++++++++++++++++++++++---------------- 1 file changed, 261 insertions(+), 158 deletions(-) diff --git a/etc/udev/slackware/udev.rules b/etc/udev/slackware/udev.rules index ac43657cc6..4b36091528 100644 --- a/etc/udev/slackware/udev.rules +++ b/etc/udev/slackware/udev.rules @@ -2,247 +2,350 @@ # # There are a number of modifiers that are allowed to be used in some of the # fields. See the udev man page for a full description of them. +# +# This rules file is a mix of 10.2 Slackware udev.rules file and some +# rules from the udev examples. +# -# all block devices -SUBSYSTEM="block", GROUP="disk" +# wait for sysfs +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" -### cdrom symlinks and other good cdrom naming -##BUS="ide", KERNEL="hd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -##BUS="scsi", KERNEL="sr[0-9]*", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -##BUS="scsi", KERNEL="scd[a-z]", PROGRAM="/etc/udev/scripts/cdsymlinks.sh %k", SYMLINK="%c{1} %c{2} %c{3} %c{4} %c{5} %c{6}" -## -### devfs-names for ide-devices (uncomment only one) -### /dev/ide/.../{disc,cd} and /dev/{cdroms,discs}/* type names -##BUS="ide", KERNEL="hd*", PROGRAM="/etc/udev/scripts/ide-devfs.sh %k %b %n", NAME="%k", SYMLINK="%c{1} %c{2}", GROUP="%c{3}" +# all block devices +SUBSYSTEM=="block", GROUP="disk" # permissions for IDE CD devices -BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom*", NAME="%k", GROUP="cdrom", MODE="0660" +BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660", RUN+="/lib/udev/cdrom-symlinks.sh %k" # permissions for IDE floppy devices -BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="floppy*", NAME="%k", GROUP="floppy", MODE="0660" +BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-floppy*", NAME="%k", GROUP="floppy", MODE="0660" # permissions for SCSI cd/sg/tape devices -BUS="scsi", KERNEL="s[grt][0-9]*", SYSFS_type="5", NAME="%k", GROUP="cdrom", MODE="0660" +BUS=="scsi", KERNEL=="s[grt][0-9]*", SYSFS{type}=="5", NAME="%k", GROUP="cdrom", MODE="0660" + +# load modules to scsi disks, if they aren't in kernel +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" # disk devices -KERNEL="sd*", NAME="%k", GROUP="disk" -KERNEL="dasd*", NAME="%k", GROUP="disk" -KERNEL="ataraid*", NAME="%k", GROUP="disk" +KERNEL=="sd*", NAME="%k", GROUP="disk" +KERNEL=="dasd*", NAME="%k", GROUP="disk" +KERNEL=="ataraid*", NAME="%k", GROUP="disk" -# DRI devices -KERNEL="card*", NAME="dri/card%n", GROUP="video" -KERNEL="nvidia*", NAME="%k", GROUP="video" -KERNEL="3dfx*", NAME="%k", GROUP="video" +# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} + +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" + +# never access removable ide devices, the drivers are causing event loops on open() +BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}=="1", GOTO="persistent_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/lib/udev/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="sr*|st*", GOTO="persistent_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +IMPORT{program}="/lib/udev/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/lib/udev/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +# No dmsetup in slackware by default (LVM2 is in testing) +#KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" + +LABEL="persistent_end" # ALSA devices -SUBSYSTEM="sound", GROUP="audio" -KERNEL="controlC[0-9]*", NAME="snd/%k", MODE="0666" -KERNEL="hw[CD0-9]*", NAME="snd/%k", MODE="0662" -KERNEL="pcm[CD0-9]*c", NAME="snd/%k", MODE="0662" -KERNEL="pcm[CD0-9]*p", NAME="snd/%k", MODE="0666" -KERNEL="midiC[D0-9]*", NAME="snd/%k", MODE="0666" -KERNEL="timer", NAME="snd/%k", MODE="0666" -KERNEL="seq", NAME="snd/%k", MODE="0666" +SUBSYSTEM=="sound", GROUP="audio" +SUBSYSTEM=="snd", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k", MODE="0666" +KERNEL=="hw[CD0-9]*", NAME="snd/%k", MODE="0662" +KERNEL=="pcm[CD0-9]*c", NAME="snd/%k", MODE="0662" +KERNEL=="pcm[CD0-9]*p", NAME="snd/%k", MODE="0666" +KERNEL=="midiC[D0-9]*", NAME="snd/%k", MODE="0666" +KERNEL=="timer", NAME="snd/%k", MODE="0666" +KERNEL=="seq", NAME="snd/%k", MODE="0666" + +# IEEE1394 raw devices (often used for video) +KERNEL=="raw1394", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" # capi devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi*", NAME="capi/%n" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" # cpu devices -KERNEL="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL="microcode", NAME="cpu/microcode" +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" # dm devices (ignore them) -KERNEL="dm-[0-9]*", NAME="" +KERNEL=="dm-[0-9]*", NAME="" # create a symlink named after the device map name # note devmap_name comes with extras/multipath -#KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" -KERNEL="device-mapper", NAME="mapper/control" +#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" +KERNEL=="device-mapper", NAME="mapper/control" -# fb devices -KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video" # floppy devices -KERNEL="fd[0-9]*", NAME="floppy/%n", SYMLINK="%k", GROUP="floppy", PROGRAM="/etc/udev/scripts/floppy-extra-devs.sh %k %b %n" +KERNEL=="fd[0-9]*", NAME="floppy/%n", SYMLINK+="%k", GROUP="floppy", PROGRAM="/lib/udev/floppy-extra-devs.sh %k %b %n" # i2c devices -KERNEL="i2c-[0-9]*", NAME="i2c/%n", SYMLINK="%k" +KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" # input devices -KERNEL="mice", NAME="input/%k", MODE="0644" -KERNEL="mouse*", NAME="input/%k", MODE="0644" -KERNEL="event*", NAME="input/%k", MODE="0600" -KERNEL="js*", NAME="input/%k", MODE="664" -KERNEL="ts*", NAME="input/%k", MODE="0600" +KERNEL=="mice", NAME="input/%k", MODE="0644", SYMLINK+="mouse" +KERNEL=="mouse*", NAME="input/%k", MODE="0644" +KERNEL=="event*", NAME="input/%k", MODE="0600" +KERNEL=="js*", NAME="input/%k", MODE="664" +KERNEL=="ts*", NAME="input/%k", MODE="0600" +SUBSYSTEM=="input[0-9]*", RUN+="/lib/udev/input_device.sh" +KERNEL=="input[0-9]*", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" # loop devices -KERNEL="loop[0-9]*", NAME="loop/%n", SYMLINK="%k", GROUP="disk" +KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k", GROUP="disk" # md block devices -KERNEL="md[0-9]*", NAME="md/%n", SYMLINK="%k", GROUP="disk" +KERNEL=="md[0-9]*", NAME="md/%n", SYMLINK+="%k", GROUP="disk" # aoe char devices, -SUBSYSTEM="aoe", KERNEL="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" -SUBSYSTEM="aoe", KERNEL="err", NAME="etherd/%k", GROUP="disk", MODE="0440" -SUBSYSTEM="aoe", KERNEL="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" - -# misc devices -KERNEL="agpgart", NAME="misc/%k", SYMLINK="%k" -KERNEL="psaux", NAME="misc/%k", SYMLINK="%k" -KERNEL="rtc", NAME="misc/%k", SYMLINK="%k", MODE="0664" -KERNEL="uinput", NAME="misc/%k", SYMLINK="%k" -KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666" +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" # netlink devices -KERNEL="route", NAME="netlink/%k" -KERNEL="skip", NAME="netlink/%k" -KERNEL="usersock", NAME="netlink/%k" -KERNEL="fwmonitor", NAME="netlink/%k" -KERNEL="tcpdiag", NAME="netlink/%k" -KERNEL="nflog", NAME="netlink/%k" -KERNEL="xfrm", NAME="netlink/%k" -KERNEL="arpd", NAME="netlink/%k" -KERNEL="route6", NAME="netlink/%k" -KERNEL="ip6_fw", NAME="netlink/%k" -KERNEL="dnrtmsg", NAME="netlink/%k" -KERNEL="tap*", NAME="netlink/%k" - -# network devices -KERNEL="tun", NAME="net/%k" +KERNEL=="route", NAME="netlink/%k" +KERNEL=="skip", NAME="netlink/%k" +KERNEL=="usersock", NAME="netlink/%k" +KERNEL=="fwmonitor", NAME="netlink/%k" +KERNEL=="tcpdiag", NAME="netlink/%k" +KERNEL=="nflog", NAME="netlink/%k" +KERNEL=="xfrm", NAME="netlink/%k" +KERNEL=="arpd", NAME="netlink/%k" +KERNEL=="route6", NAME="netlink/%k" +KERNEL=="ip6_fw", NAME="netlink/%k" +KERNEL=="dnrtmsg", NAME="netlink/%k" +KERNEL=="tap*", NAME="netlink/%k" # ramdisk devices -KERNEL="ram[0-9]*", NAME="rd/%n", SYMLINK="%k" +KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" # raw devices -KERNEL="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL="ram*", NAME="%k", GROUP="disk" +KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="ram*", NAME="%k", GROUP="disk" # sound devices -KERNEL="adsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" -KERNEL="adsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" -KERNEL="audio", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" -KERNEL="audio[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" -KERNEL="dsp", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" -KERNEL="dsp[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" -KERNEL="mixer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" -KERNEL="mixer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" -KERNEL="sequencer", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" -KERNEL="sequencer[0-9]*", NAME="sound/%k", SYMLINK="%k", GROUP="audio", MODE="0662" +KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" # tty devices -KERNEL="console", NAME="%k", GROUP="tty", MODE="0600" -KERNEL="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="tty[0-9]*", NAME="vc/%n", SYMLINK="%k", GROUP="tty" -KERNEL="ttyS[0-9]*", NAME="tts/%n", SYMLINK="%k", GROUP="tty" -KERNEL="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0600" -KERNEL="ippp0", NAME="%k", GROUP="tty" -KERNEL="isdn*", NAME="%k", GROUP="tty" -KERNEL="dcbri*", NAME="%k", GROUP="tty" -KERNEL="ircomm*", NAME="%k", GROUP="tty" +KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" +KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0600" +KERNEL=="ippp0", NAME="%k", GROUP="tty" +KERNEL=="isdn*", NAME="%k", GROUP="tty" +KERNEL=="dcbri*", NAME="%k", GROUP="tty" +KERNEL=="ircomm*", NAME="%k", GROUP="tty" # pty devices -KERNEL="ptmx", NAME="%k", GROUP="tty", MODE="0666" -KERNEL="pty[p-za-e][0-9a-f]*", NAME="pty/m%n", SYMLINK="%k", GROUP="tty" -KERNEL="tty[p-za-e][0-9a-f]*", NAME="pty/s%n", SYMLINK="%k", GROUP="tty" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" +KERNEL=="pty[p-za-e][0-9a-f]*", NAME="pty/m%m", SYMLINK+="%k", GROUP="tty" +KERNEL=="tty[p-za-e][0-9a-f]*", NAME="pty/s%m", SYMLINK+="%k", GROUP="tty" # vc devices -KERNEL="vcs", NAME="vcc/0", SYMLINK="%k", GROUP="tty" -KERNEL="vcs[0-9]*", NAME="vcc/%n", SYMLINK="%k", GROUP="tty" -KERNEL="vcsa", NAME="vcc/a0", SYMLINK="%k", GROUP="tty" -KERNEL="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK="%k", GROUP="tty" +KERNEL=="vcs", NAME="vcc/0", SYMLINK+="%k", GROUP="tty" +KERNEL=="vcs[0-9]*", NAME="vcc/%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="vcsa", NAME="vcc/a0", SYMLINK+="%k", GROUP="tty" +KERNEL=="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK+="%k", GROUP="tty" # memory devices -KERNEL="random", NAME="%k", MODE="0664" -KERNEL="urandom", NAME="%k", MODE="0664" -KERNEL="mem", NAME="%k", GROUP="kmem", MODE="0640" -KERNEL="kmem", NAME="%k", GROUP="kmem", MODE="0640" -KERNEL="port", NAME="%k", GROUP="kmem", MODE="0640" -KERNEL="full", NAME="%k", MODE="0666" -KERNEL="null", NAME="%k", MODE="0666" -KERNEL="zero", NAME="%k", MODE="0666" +KERNEL=="random", NAME="%k", MODE="0664" +KERNEL=="urandom", NAME="%k", MODE="0664" +KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="0640" +KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="0640" +KERNEL=="port", NAME="%k", GROUP="kmem", MODE="0640" +KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" +KERNEL=="full", NAME="%k", MODE="0666" +KERNEL=="null", NAME="%k", MODE="0666" +KERNEL=="zero", NAME="%k", MODE="0666" + +# misc devices +KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="rtc", NAME="misc/%k", SYMLINK+="%k", MODE="0664" +KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" # usb devices -KERNEL="hiddev*", NAME="usb/%k" -KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k" -KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k", GROUP="lp" +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="auer*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k" +KERNEL=="dabusb*", NAME="usb/%k" + +# fb devices +KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" + +# DRI devices +KERNEL=="card*", NAME="dri/card%n", GROUP="video" +KERNEL=="nvidia*", NAME="%k", GROUP="video" +KERNEL=="3dfx*", NAME="%k", GROUP="video" # v4l devices -KERNEL="video[0-9]*", NAME="v4l/video%n", SYMLINK="video%n", GROUP="video" -KERNEL="radio[0-9]*", NAME="v4l/radio%n", GROUP="video" -KERNEL="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK="vbi%n", GROUP="video" -KERNEL="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" +KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" +KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" +KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" +KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" # dvb devices -KERNEL="dvb*", PROGRAM="/etc/udev/scripts/dvb.sh %k", NAME="%c", GROUP="video", MODE="0660" +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'X=%k; X=$${X#dvb}; A=$${X%%%%.*}; D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" # Asterix Zaptel devices -KERNEL="zapctl", NAME="zap/ctl" -KERNEL="zaptimer", NAME="zap/timer" -KERNEL="zapchannel", NAME="zap/channel" -KERNEL="zappseudo", NAME="zap/pseudo" -KERNEL="zap[0-9]*", NAME="zap/%n" +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" # pilot/palm devices -KERNEL="pilot", NAME="%k", GROUP="uucp" +KERNEL=="pilot", NAME="%k", GROUP="uucp" # jaz devices -KERNEL="jaz*", NAME="%k", GROUP="disk" +KERNEL=="jaz*", NAME="%k", GROUP="disk" # zip devices -KERNEL="pocketzip*", NAME="%k", GROUP="disk" -KERNEL="zip*", NAME="%k", GROUP="disk" +KERNEL=="pocketzip*", NAME="%k", GROUP="disk" +KERNEL=="zip*", NAME="%k", GROUP="disk" # ls120 devices -KERNEL="ls120", NAME="%k", GROUP="disk" +KERNEL=="ls120", NAME="%k", GROUP="disk" # lp devices -KERNEL="lp*", NAME="%k", GROUP="lp" -KERNEL="irlpt", NAME="%k", GROUP="lp" -KERNEL="usblp", NAME="%k", GROUP="lp" -KERNEL="lp*", NAME="%k", GROUP="lp" +KERNEL=="irlpt", NAME="%k", GROUP="lp", MODE="0664" +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp", MODE="0664" +SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp", MODE="0664" +KERNEL=="parport*", NAME="%k", GROUP="lp", MODE="0664" # tape devices -KERNEL="ht*", NAME="%k" -KERNEL="nht*", NAME="%k" -KERNEL="pt*", NAME="%k" -KERNEL="npt*", NAME="%k" -KERNEL="st*", NAME="%k" -KERNEL="nst*", NAME="%k" -KERNEL="osst*", NAME="%k" -KERNEL="nosst*", NAME="%k" +KERNEL=="ht*", NAME="%k" +KERNEL=="nht*", NAME="%k" +KERNEL=="pt*", NAME="%k" +KERNEL=="npt*", NAME="%k" +KERNEL=="st*", NAME="%k" +KERNEL=="nst*", NAME="%k" +KERNEL=="osst*", NAME="%k" +KERNEL=="nosst*", NAME="%k" # diskonkey devices -KERNEL="diskonkey*", NAME="%k", GROUP="disk" +KERNEL=="diskonkey*", NAME="%k", GROUP="disk" # rem_ide devices -KERNEL="microdrive*", NAME="%k", GROUP="disk" +KERNEL=="microdrive*", NAME="%k", GROUP="disk" # kbd devices -KERNEL="kbd", NAME="%k", MODE="0664" +KERNEL=="kbd", NAME="%k", MODE="0664" # Sony Vaio Jogdial sonypi device -KERNEL="sonypi", NAME="%k", MODE="0666" +KERNEL=="sonypi", NAME="%k", MODE="0666" # packet devices -KERNEL="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom", MODE="0660" -KERNEL="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrom", MODE="0660" +KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom", MODE="0660" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrom", MODE="0660" # infiniband devices -KERNEL="umad*", NAME="infiniband/%k" -KERNEL="issm*", NAME="infiniband/%k" +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" -## These lines are causing race conditions with the symlink to udevstart in -## /etc/hotplug.d/default/, so they are being commented out for now. Udev -## seems to work better that way... YMMV. +# PnP +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ + RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" + +# firewire +SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", IMPORT{program}="modalias_ieee1394" + +# libusb device access +DEVPATH=="/module/usbcore", ACTION=="add", \ + RUN+="/bin/sh -c 'sleep 1; /bin/mount none -t usbfs /proc/bus/usb -o devmode=0666,devgid=10'" +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev}; B=$${X%%%%.*}; D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" + +# firmware loader +SUBSYSTEM=="firmware", ACTION=="add", RUN+="/lib/udev/firmware_helper" + +# load module +ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" + +# PCMCIA devices: # -## be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/. -## systems run /etc/hotplug.d/ stuff only if we came from a hotplug event, -## not for udevstart -#ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd" +# Very few CIS firmware entries (which we use for matching) +# are so broken that we need to read out random bytes of it +# instead of the manufactor, card or product ID. Then the +# matching is done in userspace. +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \ + RUN+="/sbin/pcmcia-check-broken-cis" + +# However, the "weak" matching by func_id is only allowed _after_ modprobe +# returns, so that "strong" matches have a higher priority. +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \ + RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" + +# PCMCIA sockets: # -## always run /etc/dev.d/ stuff for now -#RUN+="/sbin/udev_run_devd" +# modprobe the pcmcia bus module so that 16-bit PCMCIA devices work +ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" + +# if this is a PCMCIA socket which needs a resource database, +# pcmcia-socket-startup sets it up +ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/pcmcia-socket-startup" + +# network devices +KERNEL=="tun", NAME="net/%k" +SUBSYSTEM=="net", ACTION=="add", RUN+="/lib/udev/nethelper.sh $env{INTERFACE} start" +SUBSYSTEM=="net", ACTION=="remove", RUN+="/lib/udev/nethelper.sh $env{INTERFACE} stop" + +# if you use HAL, try this: +# send all events to HAL +#RUN+="socket:/org/freedesktop/hal/udev_event" +# catch the event in udevmonitor +RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From f051e340699286831b90b242d843eb1a38c2b19f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Aug 2006 12:50:53 +0200 Subject: udevd: autotune max_childs/max_childs_running --- udevcontrol.c | 37 +++++++++++++++++++----- udevd.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ udevd.h | 1 + 3 files changed, 114 insertions(+), 16 deletions(-) diff --git a/udevcontrol.c b/udevcontrol.c index 3044d02f0b..9231f2e084 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -53,12 +53,13 @@ void log_message (int priority, const char *format, ...) static void usage(void) { printf("Usage: udevcontrol COMMAND\n" - " log_priority= set the udev log level for the daemon\n" - " stop_exec_queue keep udevd from executing events, queue only\n" - " start_exec_queue execute events, flush queue\n" - " reload_rules reloads the rules files\n" - " max_childs= maximum number of childs running at the same time\n" - " --help print this help text\n\n"); + " log_priority= set the udev log level for the daemon\n" + " stop_exec_queue keep udevd from executing events, queue only\n" + " start_exec_queue execute events, flush queue\n" + " reload_rules reloads the rules files\n" + " max_childs= maximum number of childs\n" + " max_childs_running= maximum number of childs running at the same time\n" + " --help print this help text\n\n"); } int main(int argc, char *argv[], char *envp[]) @@ -104,11 +105,33 @@ int main(int argc, char *argv[], char *envp[]) *intval = log_priority(val); info("send log_priority=%i", *intval); } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { + char *endp; + int count; + intval = (int *) ctrl_msg.buf; val = &arg[strlen("max_childs=")]; ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS; - *intval = atoi(val); + count = strtoul(val, &endp, 0); + if (endp[0] != '\0' || count < 1) { + fprintf(stderr, "invalid number\n"); + goto exit; + } + *intval = count; info("send max_childs=%i", *intval); + } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { + char *endp; + int count; + + intval = (int *) ctrl_msg.buf; + val = &arg[strlen("max_childs_running=")]; + ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS_RUNNING; + count = strtoul(val, &endp, 0); + if (endp[0] != '\0' || count < 1) { + fprintf(stderr, "invalid number\n"); + goto exit; + } + *intval = count; + info("send max_childs_running=%i", *intval); } else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { usage(); goto exit; diff --git a/udevd.c b/udevd.c index 45e9aae771..af9e118c55 100644 --- a/udevd.c +++ b/udevd.c @@ -310,7 +310,68 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) run_exec_q = 1; } -/* runs event and removes event from run queue when finished */ +static int mem_size_mb(void) +{ + int f; + char buf[8192]; + long int len; + const char *pos; + long int memsize; + + f = open("/proc/meminfo", O_RDONLY); + if (f == -1) + return -1; + + len = read(f, buf, sizeof(buf)-1); + close(f); + + if (len <= 0) + return -1; + buf[len] = '\0'; + + pos = strstr(buf, "MemTotal: "); + if (pos == NULL) + return -1; + + if (sscanf(pos, "MemTotal: %ld kB", &memsize) != 1) + return -1; + + return memsize / 1024; +} + +static int cpu_count(void) +{ + int f; + char buf[32768]; + int len; + const char *pos; + int count = 0; + + f = open("/proc/stat", O_RDONLY); + if (f == -1) + return -1; + + len = read(f, buf, sizeof(buf)-1); + close(f); + if (len <= 0) + return -1; + buf[len] = '\0'; + + pos = strstr(buf, "cpu"); + if (pos == NULL) + return -1; + + while (pos != NULL) { + if (strncmp(pos, "cpu", 3) == 0 &&isdigit(pos[3])) + count++; + pos = strstr(&pos[3], "cpu"); + } + + if (count == 0) + return -1; + return count; +} + static int running_processes(void) { int f; @@ -325,11 +386,9 @@ static int running_processes(void) len = read(f, buf, sizeof(buf)-1); close(f); - if (len <= 0) return -1; - else - buf[len] = '\0'; + buf[len] = '\0'; pos = strstr(buf, "procs_running "); if (pos == NULL) @@ -625,12 +684,17 @@ static void get_ctrl_msg(void) info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i", *intval); max_childs = *intval; break; + case UDEVD_CTRL_SET_MAX_CHILDS_RUNNING: + intval = (int *) ctrl_msg.buf; + info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs=%i", *intval); + max_childs_running = *intval; + break; case UDEVD_CTRL_RELOAD_RULES: info("udevd message (RELOAD_RULES) received"); reload_config = 1; break; default: - dbg("unknown message type"); + err("unknown control message type"); } } @@ -998,16 +1062,26 @@ int main(int argc, char *argv[], char *envp[]) value = getenv("UDEVD_MAX_CHILDS"); if (value) max_childs = strtoul(value, NULL, 10); - else - max_childs = UDEVD_MAX_CHILDS; + else { + int memsize = mem_size_mb(); + if (memsize > 0) + max_childs = 128 + (memsize / 4); + else + max_childs = UDEVD_MAX_CHILDS; + } info("initialize max_childs to %u", max_childs); /* start to throttle forking if maximum number of _running_ childs is reached */ value = getenv("UDEVD_MAX_CHILDS_RUNNING"); if (value) max_childs_running = strtoull(value, NULL, 10); - else - max_childs_running = UDEVD_MAX_CHILDS_RUNNING; + else { + int cpus = cpu_count(); + if (cpus > 0) + max_childs_running = 8 + (8 * cpus); + else + max_childs_running = UDEVD_MAX_CHILDS_RUNNING; + } info("initialize max_childs_running to %u", max_childs_running); /* clear environment for forked event processes */ diff --git a/udevd.h b/udevd.h index b852b5224d..688e6d52ef 100644 --- a/udevd.h +++ b/udevd.h @@ -46,6 +46,7 @@ enum udevd_ctrl_msg_type { UDEVD_CTRL_START_EXEC_QUEUE, UDEVD_CTRL_SET_LOG_LEVEL, UDEVD_CTRL_SET_MAX_CHILDS, + UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, UDEVD_CTRL_RELOAD_RULES, }; -- cgit v1.2.3-54-g00ecf From fef35cc8466d8360baff53c781e998277d2461a4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Aug 2006 14:26:18 +0200 Subject: update frugalware rules --- etc/udev/frugalware/05-udev-early.rules | 4 + etc/udev/frugalware/50-udev-default.rules | 157 ++++++++++++++++++++++ etc/udev/frugalware/60-persistent-storage.rules | 48 +++++++ etc/udev/frugalware/64-device-mapper.rules | 15 +++ etc/udev/frugalware/udev.rules | 170 ------------------------ 5 files changed, 224 insertions(+), 170 deletions(-) create mode 100644 etc/udev/frugalware/05-udev-early.rules create mode 100644 etc/udev/frugalware/50-udev-default.rules create mode 100644 etc/udev/frugalware/60-persistent-storage.rules create mode 100644 etc/udev/frugalware/64-device-mapper.rules delete mode 100644 etc/udev/frugalware/udev.rules diff --git a/etc/udev/frugalware/05-udev-early.rules b/etc/udev/frugalware/05-udev-early.rules new file mode 100644 index 0000000000..417ee67d6f --- /dev/null +++ b/etc/udev/frugalware/05-udev-early.rules @@ -0,0 +1,4 @@ +# sysfs is populated after the event is sent +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" + diff --git a/etc/udev/frugalware/50-udev-default.rules b/etc/udev/frugalware/50-udev-default.rules new file mode 100644 index 0000000000..920d4706fd --- /dev/null +++ b/etc/udev/frugalware/50-udev-default.rules @@ -0,0 +1,157 @@ +# console +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="console", NAME="%k", MODE="600", OPTIONS="last_rule" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" + +# serial devices +KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" +KERNEL=="pppox*", NAME="%k", GROUP="uucp" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp" +KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" +KERNEL=="hvc*", NAME="%k", GROUP="uucp" +KERNEL=="hvsi*", NAME="%k", GROUP="uucp" +KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" +KERNEL=="ttyUSB*", SYSFS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" +KERNEL=="ttyUSB*", SYSFS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" + +# video/graphics +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="graphics" GROUP="video" +KERNEL=="vtx*", NAME="%k", GROUP="video" +KERNEL=="vbi*", NAME="%k", GROUP="video" +KERNEL=="winradio*", NAME="%k", GROUP="video" +KERNEL=="vttuner*", NAME="%k", GROUP="video" +KERNEL=="nvidia*", NAME="%k", GROUP="video" +KERNEL=="nvidiactl*", NAME="%k", GROUP="video" +KERNEL=="video0", SYMLINK+="video" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="pmu", GROUP="video" + +# dvb +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" + +# input devices +KERNEL=="mice", NAME="input/%k", MODE="0640" +KERNEL=="mouse*", NAME="input/%k", MODE="0640" +KERNEL=="event*", NAME="input/%k", MODE="0640" +KERNEL=="js*", NAME="input/%k", MODE="0644" +KERNEL=="ts*", NAME="input/%k", MODE="0600" +KERNEL=="uinput", NAME="input/%k", MODE="0600" +KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" + +# printer +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp" +KERNEL=="irlpt*", NAME="%k", GROUP="lp" + +# cpu devices +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# IEEE1394 devices +KERNEL=="raw1394*", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" + +# 183 = /dev/hwrng Generic random number generator +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +# 219 /dev/modems/mwave MWave modem firmware upload +KERNEL=="mwave", NAME="modems/%k" +# 169 /dev/specialix_rioctl Specialix RIO serial control +KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" +# 167 /dev/specialix_sxctl Specialix serial control +KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" + +# network +KERNEL=="tun", NAME="net/%k", MODE="0600" + +# misc devices +KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" +KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" +KERNEL=="null", NAME="%k", MODE="666" +KERNEL=="zero", NAME="%k", MODE="666" +KERNEL=="full", NAME="%k", MODE="622" +KERNEL=="random", NAME="%k", MODE="666" +KERNEL=="urandom", NAME="%k", MODE="644" +KERNEL=="rtc", MODE="600" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", MODE="0600", GROUP="video" +KERNEL=="djs*", NAME="%k", MODE="644" +KERNEL=="sgi_*", NAME="%k", MODE="666" +KERNEL=="rrom*", NAME="%k", MODE="400" +KERNEL=="rflash*", NAME="%k", MODE="400" +KERNEL=="usbscanner*", NAME="%k", MODE="644" +KERNEL=="3270/ttycons*", NAME="%k", MODE="600" +KERNEL=="3270/tub*", NAME="%k", MODE="666" +KERNEL=="3270/tubcons*", NAME="%k", MODE="600" +KERNEL=="ica", NAME="%k", MODE="666" +KERNEL=="z90crypt", NAME="%k", MODE="666" +KERNEL=="mmtimer", NAME="%k", MODE="644" +KERNEL=="auer[0-9]*" NAME="usb/%k" + +# packet writing interface +KERNEL=="pktcdvd", NAME="pktcdvd/control" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" + +# fix floppy devices +KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" +KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{cmos} -m %M /dev/%k" +KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/rm -f $root/%k*" + +# block devices +SUBSYSTEM=="block", GROUP="disk", MODE="0640" + +# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC +# sr: 4 TYPE_WORM, 5 TYPE_ROM +# st/osst: 1 TYPE_TAPE +ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" +ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" + +# device mapper +KERNEL=="device-mapper", NAME="%k", SYMLINK+="mapper/control" + +# misc storage devices (non-block) +KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" +KERNEL=="st*", NAME="%k", GROUP="disk" +KERNEL=="nst*", NAME="%k", GROUP="disk" +KERNEL=="initrd", NAME="%k", GROUP="disk" +KERNEL=="qft*", NAME="%k", GROUP="disk" +KERNEL=="nqft*", NAME="%k", GROUP="disk" +KERNEL=="zqft*", NAME="%k", GROUP="disk" +KERNEL=="nzqft*", NAME="%k", GROUP="disk" +KERNEL=="rawqft*", NAME="%k", GROUP="disk" +KERNEL=="nrawqft*", NAME="%k", GROUP="disk" +KERNEL=="pf*", NAME="%k", GROUP="disk" +KERNEL=="sch*", NAME="%k", GROUP="disk" +KERNEL=="pt*", NAME="%k", GROUP="disk" +KERNEL=="npt*", NAME="%k", GROUP="disk" +KERNEL=="pg*", NAME="%k", GROUP="disk" +KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" +KERNEL=="rawctl*", NAME="raw/%k", GROUP="disk" +KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="osst*", NAME="%k", GROUP="disk" +KERNEL=="nosst*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" + +# libusb device access +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" + +# kernel firmware loader +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" + diff --git a/etc/udev/frugalware/60-persistent-storage.rules b/etc/udev/frugalware/60-persistent-storage.rules new file mode 100644 index 0000000000..5a63a4fa70 --- /dev/null +++ b/etc/udev/frugalware/60-persistent-storage.rules @@ -0,0 +1,48 @@ +# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" + +# never access removable ide devices, the drivers are causing event loops on open() +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" + +# for partitions import parent information +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="sr*|st*", GOTO="persistent_storage_end" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +LABEL="persistent_storage_end" diff --git a/etc/udev/frugalware/64-device-mapper.rules b/etc/udev/frugalware/64-device-mapper.rules new file mode 100644 index 0000000000..3837d3f2c7 --- /dev/null +++ b/etc/udev/frugalware/64-device-mapper.rules @@ -0,0 +1,15 @@ +# device mapper links hook into "online" event, when the dm table +# is available, while some table types must be ignored + +KERNEL=="dm-*", ACTION=="add|online", GOTO="device_mapper_do" +GOTO="device_mapper_end" + +LABEL="device_mapper_do" +PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" +RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" + +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +LABEL="device_mapper_end" diff --git a/etc/udev/frugalware/udev.rules b/etc/udev/frugalware/udev.rules deleted file mode 100644 index a7c19cb967..0000000000 --- a/etc/udev/frugalware/udev.rules +++ /dev/null @@ -1,170 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# See the udev.rules.examples file for more examples of how to create rules -# - -# if this is a ide cdrom, name it the default name, and create a symlink to cdrom -# BUS="ide", KERNEL="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT="cdrom", NAME="%k", SYMLINK="cdrom" - -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" - -# USB devices -KERNEL="hiddev*", NAME="usb/%k" -KERNEL="auer*", NAME="usb/%k" -KERNEL="legousbtower*", NAME="usb/%k" -KERNEL="dabusb*", NAME="usb/%k" -BUS="usb", KERNEL="lp[0-9]*", NAME="usb/%k" - -# CAPI devices -KERNEL="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL="capi*", NAME="capi/%n" - -# Network devices -KERNEL="tun", NAME="net/%k" - -# permissions -KERNEL="pl2303", NAME="%k", OWNER="500", GROUP="500", MODE="0666" -KERNEL="visor", NAME="%k", OWNER="root", GROUP="uucp", MODE="0666" -KERNEL="camera*" NAME="%k", OWNER="500", GROUP="500", MODE="0666" - -# console devices -KERNEL="console" NAME="%k", OWNER="root", GROUP="tty", MODE="0600" -KERNEL="tty", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL="tty[0-9]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" -KERNEL="vcs*", NAME="%k", OWNER="root", GROUP="tty", MODE="0620" -KERNEL="tty[CIS]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" -KERNEL="ttyUB[0-9]", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" -KERNEL="ttyUSB0", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" -KERNEL="ttyUSB1", NAME="%k", OWNER="root" GROUP="uucp", MODE="0666" - -# pty devices -KERNEL="ptmx" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL="pty[p-za-e][0-9a-f]*" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL="tty[p-za-e][0-9a-f]*" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL="cu[abiu]*" NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" - -# sound devices -KERNEL="audio*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="beep" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="dsp*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="midi*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="mixer*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="music" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="sequencer*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="controlC[0-9]*", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="hw[CD0-9]*", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="pcm[CD0-9cp]*", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="midiC[D0-9]*", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="timer", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="seq", NAME="snd/%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="sndstat" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="speaker" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="sound/*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" -KERNEL="admmidi*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" -KERNEL="adsp*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" -KERNEL="aload*" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="amidi*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" -KERNEL="amixer*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" - -# input devices (mouse, joystick, etc) -KERNEL="mice", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="mouse*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="event*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="js*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="ts*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="input/js*" NAME="%k", OWNER="root", GROUP="games",0 MODE="0666" -KERNEL="djs[0-3]" NAME="%k", OWNER="root", GROUP="games", MODE="0660" -KERNEL="psaux" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL="crash" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL="logibm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL="jbm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL="hwtrap" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="inportbm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL="sexec" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL="jsflash" NAME="%k", OWNER="root", GROUP="root", MODE="0660" - -# power manager device -KERNEL="apm_bios" NAME="%k", OWNER="root", GROUP="root", MODE="0644" - -# printer device -KERNEL="lp[0-9]" NAME="%k", OWNER="root", GROUP="lp", MODE="0660" -KERNEL="parport*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" - -# video devices -KERNEL="card*" NAME="dri/card%n", OWNER="root", GROUP="root", MODE="0666" -KERNEL="fb[0-9]" NAME="%k", OWNER="root", GROUP="tty", MODE="0660" -KERNEL="agpgart" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL="nvidia*" NAME="%k", OWNER="root", GROUP="root", MODE="0666" -KERNEL="video*" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" - -# DISK devices -KERNEL="ed[ab]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="gscd0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="initrd" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="lmscd" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="mcd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="md*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="mtd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="userdma" NAME="%k", OWNER="root", GROUP="root", MODE="0660" - -# floppy devices -KERNEL="fd[0-3]*" NAME="%k", OWNER="root", GROUP="floppy", MODE="0660" - -# IDE devices (hd, cdrom) -KERNEL="hd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL="ht0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" - -# RAID IDE -KERNEL="ataraid[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL="ataraid/*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" - -# SCSI devices -KERNEL="scsi/*/cd" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL="scsi/*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL="sd[a-h]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="s[rt][0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="scd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" - -# generic scsi devices -KERNEL="sg*" NAME="%k", OWNER="root", GROUP="root", MODE="0600" - -# old CD-ROM -KERNEL="sbpcd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" - -# loop devices -KERNEL="loop[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" - -# network block devices -KERNEL="nb[0-7]" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL="nht0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="npt[0-3]" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL="n[qrs]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" - -# memory access devices -KERNEL="kmem" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL="mem" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL="null" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="nvram" NAME="%k", OWNER="root", GROUP="root", MODE="0640" -KERNEL="port" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL="ram[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL="random" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="rtc" NAME="%k", OWNER="root", GROUP="root", MODE="0444" -KERNEL="urandom" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="full" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL="zero" NAME="%k", OWNER="root", GROUP="root", MODE="0666" -KERNEL="raw[0-9]*" NAME="raw/%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL="modreq" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="msr" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL="profile*" NAME="%k", OWNER="root", GROUP="root", MODE="0640" - -# ISDN devices -KERNEL="isdn*" NAME="%k", OWNER="root", GROUP="tty", MODE="0660" - -# net devices -KERNEL="ippp*" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="ipstate*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL="spx" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL="fwmonitor*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -- cgit v1.2.3-54-g00ecf From 4699afe1fd965e62f69d4c130d58566d17fce657 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 11 Aug 2006 14:39:13 +0200 Subject: update SUSE rules --- etc/udev/suse/05-udev-early.rules | 1 - etc/udev/suse/40-alsa.rules | 16 ---- etc/udev/suse/40-bluetooth.rules | 82 ------------------ etc/udev/suse/50-pcmcia.rules | 5 -- etc/udev/suse/50-udev-default.rules | 139 +++++++++++++----------------- etc/udev/suse/60-persistent-storage.rules | 2 +- etc/udev/suse/64-device-mapper.rules | 8 +- etc/udev/suse/80-sysconfig.rules | 17 ---- 8 files changed, 66 insertions(+), 204 deletions(-) delete mode 100644 etc/udev/suse/40-alsa.rules delete mode 100644 etc/udev/suse/40-bluetooth.rules delete mode 100644 etc/udev/suse/50-pcmcia.rules delete mode 100644 etc/udev/suse/80-sysconfig.rules diff --git a/etc/udev/suse/05-udev-early.rules b/etc/udev/suse/05-udev-early.rules index 417ee67d6f..4dc497bac2 100644 --- a/etc/udev/suse/05-udev-early.rules +++ b/etc/udev/suse/05-udev-early.rules @@ -1,4 +1,3 @@ # sysfs is populated after the event is sent -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" diff --git a/etc/udev/suse/40-alsa.rules b/etc/udev/suse/40-alsa.rules deleted file mode 100644 index 87097a49e0..0000000000 --- a/etc/udev/suse/40-alsa.rules +++ /dev/null @@ -1,16 +0,0 @@ -SUBSYSTEM=="sound", GROUP="audio" -SUBSYSTEM=="snd", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8000/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us428fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8004/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us224fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8006/*", RUN+="/sbin/fxload -s /usr/share/alsa/firmware/usx2yloader/tascam_loader.ihx -I /usr/share/alsa/firmware/usx2yloader/us122fw.ihx" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8001/*", RUN+="/sbin/startproc /usr/bin/us428control" -SUBSYSTEM=="usb", ACTION=="add", ENV{PRODUCT}=="1604/8005/*", RUN+="/sbin/startproc /usr/bin/us428control" -SUBSYSTEM=="sound", KERNEL=="controlC?", RUN+="/usr/sbin/alsactl -F restore %n" -SUBSYSTEM=="sound", KERNEL=="hwC?D2", DRIVER=="EMU10K1_Audigy", RUN+="/etc/alsa.d/udev-soundfont" - diff --git a/etc/udev/suse/40-bluetooth.rules b/etc/udev/suse/40-bluetooth.rules deleted file mode 100644 index b6d706cabf..0000000000 --- a/etc/udev/suse/40-bluetooth.rules +++ /dev/null @@ -1,82 +0,0 @@ -# bluetooth subsystem -SUBSYSTEM=="bluetooth", RUN+="/lib/udev/bluetooth.sh" - -# uncomment this if you have configured an automatic rfcomm-bind in -# /etc/bluetooth/rfcomm.conf -# KERNEL=="rfcomm*", NAME="%k" GROUP="uucp" MODE="0660" OPTIONS="resmgr" - -## PCMCIA-Cards -# "Brain Boxes BL-620 Bluetooth Adapter" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Brain Boxes", SYSFS{prod_id2}=="Bluetooth PC Card", RUN+="/etc/pcmcia/bluetooth.sh" -# "Xircom CreditCard Bluetooth Adapter" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Xircom", SYSFS{prod_id3}=="CBT", RUN+="/etc/pcmcia/bluetooth.sh" -# "Xircom RealPort2 Bluetooth Adapter" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Xircom", SYSFS{prod_id3}=="CBT", RUN+="/etc/pcmcia/bluetooth.sh" -# "IBM Bluetooth PC Card II" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="IBM", SYSFS{prod_id2}=="Bluetooth PC Card II", RUN+="/etc/pcmcia/bluetooth.sh" -# "TDK Bluetooth PC Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="TDK", SYSFS{prod_id2}=="Bluetooth PC Card II", RUN+="/etc/pcmcia/bluetooth.sh" -# "AmbiCom BT2000C Bluetooth PC/CF Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="AmbiCom BT2000C", SYSFS{prod_id2}=="Bluetooth PC/CF Card", RUN+="/etc/pcmcia/bluetooth.sh" -# "COM One Platinium Bluetooth PC Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="COM1 SA", SYSFS{prod_id2}=="MC310 CARD", RUN+="/etc/pcmcia/bluetooth.sh" -# "Sphinx PICO Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="SPHINX", SYSFS{prod_id2}=="BT-CARD", RUN+="/etc/pcmcia/bluetooth.sh" -# "H-Soft blue+Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="H-Soft", SYSFS{prod_id2}=="Blue+CARD", RUN+="/etc/pcmcia/bluetooth.sh" -# "Compaq iPAQ Bluetooth Sleeve" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="CF CARD", SYSFS{prod_id2}=="GENERIC", RUN+="/etc/pcmcia/bluetooth.sh" -# "Zoom Bluetooth Card" -# "Sitecom CN-504 Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="PCMCIA", SYSFS{prod_id2}=="Bluetooth Card", RUN+="/etc/pcmcia/bluetooth.sh" - - -# -# dtl1_cs -# -# card "Nokia Bluetooth Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Nokia Mobile Phones", SYSFS{prod_id2}=="DTL-1", RUN+="/etc/pcmcia/bluetooth.sh" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Nokia Mobile Phones", SYSFS{prod_id2}=="DTL-4", RUN+="/etc/pcmcia/bluetooth.sh" -# "Socket Bluetooth Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Socket", SYSFS{prod_id2}=="CF+ Personal Network Card", RUN+="/etc/pcmcia/bluetooth.sh" - - -# -# bt3c_cs -# - -# "3Com Bluetooth PC Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="3COM", SYSFS{prod_id3}=="Bluetooth PC Card", RUN+="/etc/pcmcia/bluetooth.sh" - -# -# bluecard_cs -# - -# "LSE041 Bluetooth PC Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="BlueCard", SYSFS{prod_id2}=="LSE041", RUN+="/etc/pcmcia/bluetooth.sh" -# "LSE039 Bluetooth Compact Flash Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="WSS", SYSFS{prod_id2}=="LSE039", RUN+="/etc/pcmcia/bluetooth.sh" -# "LSE139 Bluetooth Compact Flash Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="BTCFCARD", SYSFS{prod_id2}=="LSE139", RUN+="/etc/pcmcia/bluetooth.sh" - - -# -# bt950_cs -# - -# "AmbiCom BT2000E Bluetooth Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="AmbiCom,Inc", SYSFS{prod_id2}=="BT2000E", RUN+="/etc/pcmcia/bluetooth.sh" -# "Pretec BT2000E Bluetooth Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Pretec", SYSFS{prod_id2}=="BT2000E", RUN+="/etc/pcmcia/bluetooth.sh" -# "Billionton Bluetooth Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="Compact Flash", SYSFS{prod_id2}=="Bluetooth Card", RUN+="/etc/pcmcia/bluetooth.sh" - - -# -# btuart_cs -# - -# "Cyber-blue Compact Flash Card" -SUBSYSTEM=="tty", ENV{PHYSDEVBUS}=="pcmcia", SYSFS{prod_id1}=="BT", SYSFS{prod_id2}=="", SYSFS{prod_id3}=="", SYSFS{prod_id4}=="", RUN+="/etc/pcmcia/bluetooth.sh" - - diff --git a/etc/udev/suse/50-pcmcia.rules b/etc/udev/suse/50-pcmcia.rules deleted file mode 100644 index 11ccde56e7..0000000000 --- a/etc/udev/suse/50-pcmcia.rules +++ /dev/null @@ -1,5 +0,0 @@ -SUBSYSTEM=="pcmcia_socket", ACTION=="add", RUN+="/sbin/hwup pcmcia_socket-devpath-%p -o hotplug" -SUBSYSTEM=="pcmcia", ACTION=="add", RUN+="/sbin/hwup pcmcia-devpath-%p -o hotplug" - -LABEL="after_pcmcia" - diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 920d4706fd..021f7ec0e0 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -1,33 +1,30 @@ # console -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", MODE="600", OPTIONS="last_rule" -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="vcs*", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="vcsa*", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="tty", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="tty[0-9]*", GROUP="tty", MODE="620", OPTIONS="last_rule" +KERNEL=="console", MODE="600", OPTIONS="last_rule" +KERNEL=="ptmx", GROUP="tty", MODE="666", OPTIONS="last_rule" # serial devices -KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" -KERNEL=="pppox*", NAME="%k", GROUP="uucp" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp" -KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" -KERNEL=="hvc*", NAME="%k", GROUP="uucp" -KERNEL=="hvsi*", NAME="%k", GROUP="uucp" -KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" +KERNEL=="tty[A-Z]*", GROUP="uucp" +KERNEL=="pppox*", GROUP="uucp" +KERNEL=="ircomm*", GROUP="uucp" +KERNEL=="modems/mwave*", GROUP="uucp" +KERNEL=="hvc*|hvsi*", GROUP="uucp" +KERNEL=="iseries/vtty*", GROUP="uucp" KERNEL=="ttyUSB*", SYSFS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" KERNEL=="ttyUSB*", SYSFS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" # video/graphics SUBSYSTEM=="video4linux", GROUP="video" SUBSYSTEM=="graphics" GROUP="video" -KERNEL=="vtx*", NAME="%k", GROUP="video" -KERNEL=="vbi*", NAME="%k", GROUP="video" -KERNEL=="winradio*", NAME="%k", GROUP="video" -KERNEL=="vttuner*", NAME="%k", GROUP="video" -KERNEL=="nvidia*", NAME="%k", GROUP="video" -KERNEL=="nvidiactl*", NAME="%k", GROUP="video" +KERNEL=="vtx*|vbi*", GROUP="video" +KERNEL=="winradio*", GROUP="video" +KERNEL=="vttuner*", GROUP="video" +KERNEL=="nvidia*|nvidiactl*", GROUP="video" KERNEL=="video0", SYMLINK+="video" KERNEL=="radio0", SYMLINK+="radio" KERNEL=="vbi0", SYMLINK+="vbi" @@ -37,18 +34,17 @@ KERNEL=="pmu", GROUP="video" SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" # input devices -KERNEL=="mice", NAME="input/%k", MODE="0640" -KERNEL=="mouse*", NAME="input/%k", MODE="0640" +KERNEL=="mouse*|mice", NAME="input/%k", MODE="0640" KERNEL=="event*", NAME="input/%k", MODE="0640" KERNEL=="js*", NAME="input/%k", MODE="0644" KERNEL=="ts*", NAME="input/%k", MODE="0600" KERNEL=="uinput", NAME="input/%k", MODE="0600" -KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" +KERNEL=="lirc0", SYMLINK+="lirc" # printer SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp" -KERNEL=="irlpt*", NAME="%k", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" +KERNEL=="irlpt*", GROUP="lp" # cpu devices KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" @@ -56,46 +52,41 @@ KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" # IEEE1394 devices -KERNEL=="raw1394*", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" +KERNEL=="raw1394*", GROUP="video" +KERNEL=="dv1394*", SYMLINK+="dv1394/%n", GROUP="video" +KERNEL=="video1394*", SYMLINK+="video1394/%n", GROUP="video" -# 183 = /dev/hwrng Generic random number generator KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" -# 219 /dev/modems/mwave MWave modem firmware upload KERNEL=="mwave", NAME="modems/%k" -# 169 /dev/specialix_rioctl Specialix RIO serial control KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" -# 167 /dev/specialix_sxctl Specialix serial control KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" # network -KERNEL=="tun", NAME="net/%k", MODE="0600" +KERNEL=="tun", NAME="net/%k", MODE="0600" # misc devices -KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" -KERNEL=="null", NAME="%k", MODE="666" -KERNEL=="zero", NAME="%k", MODE="666" -KERNEL=="full", NAME="%k", MODE="622" -KERNEL=="random", NAME="%k", MODE="666" -KERNEL=="urandom", NAME="%k", MODE="644" +KERNEL=="mem|kmem", GROUP="kmem", MODE="640" +KERNEL=="port", GROUP="kmem", MODE="640" +KERNEL=="nvram", GROUP="kmem", MODE="600" +KERNEL=="null", MODE="666" +KERNEL=="zero", MODE="666" +KERNEL=="full", MODE="622" +KERNEL=="random", MODE="666" +KERNEL=="urandom", MODE="644" KERNEL=="rtc", MODE="600" KERNEL=="sonypi", MODE="0666" KERNEL=="agpgart", MODE="0600", GROUP="video" -KERNEL=="djs*", NAME="%k", MODE="644" -KERNEL=="sgi_*", NAME="%k", MODE="666" -KERNEL=="rrom*", NAME="%k", MODE="400" -KERNEL=="rflash*", NAME="%k", MODE="400" -KERNEL=="usbscanner*", NAME="%k", MODE="644" -KERNEL=="3270/ttycons*", NAME="%k", MODE="600" -KERNEL=="3270/tub*", NAME="%k", MODE="666" -KERNEL=="3270/tubcons*", NAME="%k", MODE="600" -KERNEL=="ica", NAME="%k", MODE="666" -KERNEL=="z90crypt", NAME="%k", MODE="666" -KERNEL=="mmtimer", NAME="%k", MODE="644" +KERNEL=="djs*", MODE="644" +KERNEL=="sgi_*", MODE="666" +KERNEL=="rrom*", MODE="400" +KERNEL=="rflash*", MODE="400" +KERNEL=="usbscanner*", MODE="644" +KERNEL=="3270/ttycons*", MODE="600" +KERNEL=="3270/tub*", MODE="666" +KERNEL=="3270/tubcons*", MODE="600" +KERNEL=="ica", MODE="666" +KERNEL=="z90crypt", MODE="666" +KERNEL=="mmtimer", MODE="644" KERNEL=="auer[0-9]*" NAME="usb/%k" # packet writing interface @@ -113,38 +104,28 @@ SUBSYSTEM=="block", GROUP="disk", MODE="0640" # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC # sr: 4 TYPE_WORM, 5 TYPE_ROM # st/osst: 1 TYPE_TAPE -ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" +SUBSYSTEM=="scsi", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" +SUBSYSTEM=="scsi", ACTION=="add", SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", RUN+="/sbin/modprobe st" SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" - -# device mapper -KERNEL=="device-mapper", NAME="%k", SYMLINK+="mapper/control" +KERNEL=="hd*", BUS=="ide", SYSFS{media}=="floppy", OPTIONS+="all_partitions" +SUBSYTEM=="ide", ACTION=="add", SYSFS{media}=="tape", RUN+="/sbin/modprobe ide-scsi" # misc storage devices (non-block) -KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" -KERNEL=="st*", NAME="%k", GROUP="disk" -KERNEL=="nst*", NAME="%k", GROUP="disk" -KERNEL=="initrd", NAME="%k", GROUP="disk" -KERNEL=="qft*", NAME="%k", GROUP="disk" -KERNEL=="nqft*", NAME="%k", GROUP="disk" -KERNEL=="zqft*", NAME="%k", GROUP="disk" -KERNEL=="nzqft*", NAME="%k", GROUP="disk" -KERNEL=="rawqft*", NAME="%k", GROUP="disk" -KERNEL=="nrawqft*", NAME="%k", GROUP="disk" -KERNEL=="pf*", NAME="%k", GROUP="disk" -KERNEL=="sch*", NAME="%k", GROUP="disk" -KERNEL=="pt*", NAME="%k", GROUP="disk" -KERNEL=="npt*", NAME="%k", GROUP="disk" -KERNEL=="pg*", NAME="%k", GROUP="disk" -KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" -KERNEL=="rawctl*", NAME="raw/%k", GROUP="disk" -KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL=="osst*", NAME="%k", GROUP="disk" -KERNEL=="nosst*", NAME="%k", GROUP="disk" +KERNEL=="sg*", GROUP="disk", MODE="640" +KERNEL=="st*|nst*", GROUP="disk" +KERNEL=="qft*|nqft*|zqft*|nzqft*|rawqft*|nrawqft", GROUP="disk" +KERNEL=="ht*|nht*", GROUP="disk" +KERNEL=="pf*", GROUP="disk" +KERNEL=="sch*", GROUP="disk" +KERNEL=="pt*|npt*", GROUP="disk" +KERNEL=="pg*", GROUP="disk" +KERNEL=="evms/block_device*", GROUP="disk" +KERNEL=="rawctl*|raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="osst*|nosst*", NAME="%k", GROUP="disk" KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index 5a63a4fa70..f24b999a4a 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -37,7 +37,7 @@ KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part% # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # BIOS Enhanced Disk Device diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index 3837d3f2c7..c4b7032153 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -1,15 +1,17 @@ # device mapper links hook into "online" event, when the dm table # is available, while some table types must be ignored -KERNEL=="dm-*", ACTION=="add|online", GOTO="device_mapper_do" +KERNEL=="device-mapper", SYMLINK+="mapper/control" + +KERNEL=="dm-*", ACTION=="add|change", GOTO="device_mapper_do" GOTO="device_mapper_end" LABEL="device_mapper_do" PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="device_mapper_end" diff --git a/etc/udev/suse/80-sysconfig.rules b/etc/udev/suse/80-sysconfig.rules deleted file mode 100644 index 8efb7901a0..0000000000 --- a/etc/udev/suse/80-sysconfig.rules +++ /dev/null @@ -1,17 +0,0 @@ -ENV{SYSCONFIG}=="no|off|0", GOTO="sysconfig_end" - -# SUSE system integration -SUBSYSTEM=="pci", ACTION=="add", RUN+="/sbin/hwup bus-pci-%k -o hotplug" -SUBSYSTEM=="usb", ACTION=="add", RUN+="/sbin/hwup usb-devpath-%p -o hotplug" -SUBSYSTEM=="ieee1394", ACTION=="add", RUN+="/sbin/hwup ieee1394-devpath-%p -o hotplug" -SUBSYSTEM=="scsi", DEVPATH=="/devices/css*", ACTION=="remove", RUN+="/sbin/hwdown scsi-devpath-%p -o hotplug" -SUBSYSTEM=="scsi_host", ACTION=="add", SYSFS{proc_name}=="zfcp", RUN+="/sbin/hwup scsi_host-devpath-%p -o hotplug" -SUBSYSTEM=="vio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" -SUBSYSTEM=="macio", ACTION=="add", RUN+="/sbin/hwup bus-macio-%k -o hotplug" -SUBSYSTEM=="ccw", ACTION=="add", RUN+="/sbin/hwup ccw-devpath-%p -o hotplug" -SUBSYSTEM=="ccwgroup", ACTION=="add", RUN+="/sbin/hwup ccwgroup-devpath-%p -o hotplug" -SUBSYSTEM=="pnp", ACTION=="add", RUN+="/sbin/hwup pnp-devpath-%p -o hotplug" -SUBSYSTEM=="ide", ACTION=="add", RUN+="/sbin/hwup ide-devpath-%p -o hotplug" -SUBSYSTEM=="input", KERNEL=="input[0-9]*", ACTION=="add", RUN+="/sbin/hwup input-devpath-%p -o hotplug" - -LABEL="sysconfig_end" -- cgit v1.2.3-54-g00ecf From eb1f908a2b40beefbc376878a4ff4d6d3e0db44c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 11 Aug 2006 14:48:38 +0200 Subject: move default rules to etc/udev/rules.d/ --- etc/udev/05-udev-early.rules | 4 --- etc/udev/60-persistent-input.rules | 28 ---------------- etc/udev/60-persistent-storage.rules | 48 ---------------------------- etc/udev/rules.d/05-udev-early.rules | 4 +++ etc/udev/rules.d/60-persistent-input.rules | 28 ++++++++++++++++ etc/udev/rules.d/60-persistent-storage.rules | 48 ++++++++++++++++++++++++++++ 6 files changed, 80 insertions(+), 80 deletions(-) delete mode 100644 etc/udev/05-udev-early.rules delete mode 100644 etc/udev/60-persistent-input.rules delete mode 100644 etc/udev/60-persistent-storage.rules create mode 100644 etc/udev/rules.d/05-udev-early.rules create mode 100644 etc/udev/rules.d/60-persistent-input.rules create mode 100644 etc/udev/rules.d/60-persistent-storage.rules diff --git a/etc/udev/05-udev-early.rules b/etc/udev/05-udev-early.rules deleted file mode 100644 index 417ee67d6f..0000000000 --- a/etc/udev/05-udev-early.rules +++ /dev/null @@ -1,4 +0,0 @@ -# sysfs is populated after the event is sent -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" - diff --git a/etc/udev/60-persistent-input.rules b/etc/udev/60-persistent-input.rules deleted file mode 100644 index c177e1f19c..0000000000 --- a/etc/udev/60-persistent-input.rules +++ /dev/null @@ -1,28 +0,0 @@ -ACTION!="add", GOTO="persistent_input_end" -SUBSYSTEM!="input", GOTO="persistent_input_end" -KERNEL=="input[0-9]*", GOTO="persistent_input_end" - -# usb devices -BUS=="usb", IMPORT{program}="usb_id -x" -BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" -BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" - -# other devices -DRIVER=="pcspkr", ENV{ID_CLASS}="spkr" -DRIVER=="atkbd", ENV{ID_CLASS}="kbd" -DRIVER=="psmouse", ENV{ID_CLASS}="mouse" -SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" - -ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" - -# by-id links -KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" - -# by-path -IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="mouse*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" -ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" - -LABEL="persistent_input_end" - diff --git a/etc/udev/60-persistent-storage.rules b/etc/udev/60-persistent-storage.rules deleted file mode 100644 index 5a63a4fa70..0000000000 --- a/etc/udev/60-persistent-storage.rules +++ /dev/null @@ -1,48 +0,0 @@ -# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_storage_end" -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" - -# never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" - -# for partitions import parent information -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_storage_end" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" -IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -LABEL="persistent_storage_end" diff --git a/etc/udev/rules.d/05-udev-early.rules b/etc/udev/rules.d/05-udev-early.rules new file mode 100644 index 0000000000..417ee67d6f --- /dev/null +++ b/etc/udev/rules.d/05-udev-early.rules @@ -0,0 +1,4 @@ +# sysfs is populated after the event is sent +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" + diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules new file mode 100644 index 0000000000..c177e1f19c --- /dev/null +++ b/etc/udev/rules.d/60-persistent-input.rules @@ -0,0 +1,28 @@ +ACTION!="add", GOTO="persistent_input_end" +SUBSYSTEM!="input", GOTO="persistent_input_end" +KERNEL=="input[0-9]*", GOTO="persistent_input_end" + +# usb devices +BUS=="usb", IMPORT{program}="usb_id -x" +BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" +BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" + +# other devices +DRIVER=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVER=="atkbd", ENV{ID_CLASS}="kbd" +DRIVER=="psmouse", ENV{ID_CLASS}="mouse" +SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" + +ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + +# by-id links +KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" + +# by-path +IMPORT{program}="path_id %p" +ENV{ID_PATH}=="?*", KERNEL=="mouse*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" + +LABEL="persistent_input_end" + diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules new file mode 100644 index 0000000000..5a63a4fa70 --- /dev/null +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -0,0 +1,48 @@ +# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +ACTION!="add", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" + +# never access removable ide devices, the drivers are causing event loops on open() +KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" + +# for partitions import parent information +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="sr*|st*", GOTO="persistent_storage_end" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From e37938510a4de28cfe06dc1223e99d88294919e0 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Fri, 11 Aug 2006 16:40:20 +0200 Subject: add joystick support to persistent input rules --- etc/udev/rules.d/60-persistent-input.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules index c177e1f19c..21f23f71c2 100644 --- a/etc/udev/rules.d/60-persistent-input.rules +++ b/etc/udev/rules.d/60-persistent-input.rules @@ -12,6 +12,7 @@ DRIVER=="pcspkr", ENV{ID_CLASS}="spkr" DRIVER=="atkbd", ENV{ID_CLASS}="kbd" DRIVER=="psmouse", ENV{ID_CLASS}="mouse" SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +SYSFS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", SYSFS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" -- cgit v1.2.3-54-g00ecf From 6afe0d748625e72c8954714f7a654738d30d5faf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 11 Aug 2006 16:41:15 +0200 Subject: add 'crypto' devices to persistent storage rules --- etc/udev/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 5a63a4fa70..f24b999a4a 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -37,7 +37,7 @@ KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part% # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # BIOS Enhanced Disk Device -- cgit v1.2.3-54-g00ecf From d146fa8f722a570f530a2f7da7ac181124b8df73 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 11 Aug 2006 16:41:52 +0200 Subject: add late.rules to default rules --- etc/udev/rules.d/95-udev-late.rules | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 etc/udev/rules.d/95-udev-late.rules diff --git a/etc/udev/rules.d/95-udev-late.rules b/etc/udev/rules.d/95-udev-late.rules new file mode 100644 index 0000000000..6b79a24641 --- /dev/null +++ b/etc/udev/rules.d/95-udev-late.rules @@ -0,0 +1,3 @@ +# event to be catched by udevmonitor +RUN+="socket:/org/kernel/udev/monitor" + -- cgit v1.2.3-54-g00ecf From 9a8ad783a48791c5eaa35697d0a4befd705085fd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 13 Aug 2006 04:22:21 +0200 Subject: update Fedora rules --- etc/udev/redhat/05-udev-early.rules | 1 + etc/udev/redhat/50-udev.rules | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/etc/udev/redhat/05-udev-early.rules b/etc/udev/redhat/05-udev-early.rules index 9a96b6a198..970feb853b 100644 --- a/etc/udev/redhat/05-udev-early.rules +++ b/etc/udev/redhat/05-udev-early.rules @@ -1,6 +1,7 @@ # sysfs is populated after the event is sent ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" # ignore these events until someone needs them SUBSYSTEM=="drivers", OPTIONS="ignore_device" diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index 04541a55f0..64c91fc5cb 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -28,7 +28,8 @@ KERNEL=="pty/m*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" KERNEL=="ippp*", NAME="%k", MODE="0660" KERNEL=="isdn*", NAME="%k", MODE="0660" KERNEL=="isdnctrl*", NAME="%k", MODE="0660" -KERNEL=="capi*", NAME="%k", MODE="0660" +KERNEL=="capi", NAME="capi20", GROUP="uucp", MODE="0660" +KERNEL=="capi*", NAME="capi/%n", GROUP="uucp", MODE="0660" KERNEL=="dcbri*", NAME="%k", MODE="0660" KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="tts/[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" @@ -217,8 +218,11 @@ KERNEL=="fd[0-9]*", SYMLINK+="floppy-%k" KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK+="tape-%k", MODE="0660" KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK+="tape-%k", MODE="0660" -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="umad*", NAME="infiniband/%k", MODE="0660" +KERNEL=="issm*", NAME="infiniband/%k", MODE="0660" +KERNEL=="uverbs*", NAME="infiniband/%k", MODE="0660" +KERNEL=="ucm*", NAME="infiniband/%k", MODE="0660" +KERNEL=="rdma_cm", NAME="infiniband/%k", MODE="0660" # Section for zaptel device KERNEL=="zapctl", NAME="zap/ctl" @@ -229,8 +233,6 @@ KERNEL=="zap[0-9]*", NAME="zap/%n" KERNEL=="pktcdvd", NAME="%k/control" - - KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", \ SYSFS{device/media}=="floppy", \ SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions" -- cgit v1.2.3-54-g00ecf From d4ae9925eecf6df33ca5bc4d285bdc71f9274952 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 13 Aug 2006 04:23:16 +0200 Subject: don't report an error on overlong comment lines --- test/udev-test.pl | 12 ++++++++++++ udev_rules_parse.c | 14 +++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 9a88d06271..63715ac093 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1498,6 +1498,18 @@ EOF rules => < "overlong comment line", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "yes", + rules => <= sizeof(line)) { - err("line too long, rule skipped '%s:%u'", filename, lineno); - continue; - } - /* eat the whitespace */ while ((count > 0) && isspace(bufline[0])) { bufline++; @@ -620,7 +615,12 @@ static int parse_file(struct udev_rules *rules, const char *filename) if (bufline[0] == COMMENT_CHARACTER) continue; - /* skip backslash and newline from multi line rules */ + if (count >= sizeof(line)) { + err("line too long, rule skipped '%s:%u'", filename, lineno); + continue; + } + + /* skip backslash and newline from multiline rules */ for (i = j = 0; i < count; i++) { if (bufline[i] == '\\' && bufline[i+1] == '\n') continue; -- cgit v1.2.3-54-g00ecf From 258e77a55577f1cdf9209bb2a4add0bbee182d6e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 13 Aug 2006 04:24:40 +0200 Subject: update SUSE rules --- etc/udev/suse/50-udev-default.rules | 2 +- etc/udev/suse/60-persistent-input.rules | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 021f7ec0e0..309e4031c5 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -112,7 +112,7 @@ SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", RUN+="/sbin/modprobe SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" KERNEL=="hd*", BUS=="ide", SYSFS{media}=="floppy", OPTIONS+="all_partitions" -SUBSYTEM=="ide", ACTION=="add", SYSFS{media}=="tape", RUN+="/sbin/modprobe ide-scsi" +SUBSYSTEM=="ide", ACTION=="add", SYSFS{media}=="tape", RUN+="/sbin/modprobe ide-scsi" # misc storage devices (non-block) KERNEL=="sg*", GROUP="disk", MODE="640" diff --git a/etc/udev/suse/60-persistent-input.rules b/etc/udev/suse/60-persistent-input.rules index 2fd530b712..21f23f71c2 100644 --- a/etc/udev/suse/60-persistent-input.rules +++ b/etc/udev/suse/60-persistent-input.rules @@ -7,9 +7,18 @@ BUS=="usb", IMPORT{program}="usb_id -x" BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" +# other devices +DRIVER=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVER=="atkbd", ENV{ID_CLASS}="kbd" +DRIVER=="psmouse", ENV{ID_CLASS}="mouse" +SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +SYSFS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", SYSFS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" + +ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + # by-id links -KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" +KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" # by-path IMPORT{program}="path_id %p" -- cgit v1.2.3-54-g00ecf From 254efc14a40204969fcf861498fb8b62a16141d1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 13 Aug 2006 05:32:09 +0200 Subject: udevd: read DRIVER from the environment --- udev.h | 3 ++- udev_sysfs.c | 7 +++++-- udevd.c | 4 +++- udevd.h | 1 + 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/udev.h b/udev.h index 95a2b88f5e..be01aeaa2a 100644 --- a/udev.h +++ b/udev.h @@ -109,7 +109,8 @@ extern dev_t udev_device_get_devt(struct udevice *udev); extern char sysfs_path[PATH_SIZE]; extern int sysfs_init(void); extern void sysfs_cleanup(void); -extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, const char *subsystem); +extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, + const char *subsystem, const char *driver); extern struct sysfs_device *sysfs_device_get(const char *devpath); extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem); diff --git a/udev_sysfs.c b/udev_sysfs.c index ddc0b46790..85ea4d15e9 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -79,13 +79,16 @@ void sysfs_cleanup(void) } } -void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, const char *subsystem) +void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, + const char *subsystem, const char *driver) { char *pos; strlcpy(dev->devpath, devpath, sizeof(dev->devpath)); if (subsystem != NULL) strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); + if (driver != NULL) + strlcpy(dev->driver, driver, sizeof(dev->driver)); /* set kernel name */ pos = strrchr(dev->devpath, '/'); @@ -181,7 +184,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) return NULL; memset(dev, 0x00, sizeof(struct sysfs_device)); - sysfs_device_set_values(dev, devpath_real, NULL); + sysfs_device_set_values(dev, devpath_real, NULL, NULL); /* get subsystem */ if (strncmp(dev->devpath, "/class/", 7) == 0) { diff --git a/udevd.c b/udevd.c index af9e118c55..f4f918900a 100644 --- a/udevd.c +++ b/udevd.c @@ -118,7 +118,7 @@ static int udev_event_process(struct udevd_uevent_msg *msg) if (udev == NULL) return -1; strlcpy(udev->action, msg->action, sizeof(udev->action)); - sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem); + sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem, msg->driver); udev->devt = msg->devt; retval = udev_device_event(&rules, udev); @@ -593,6 +593,8 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz msg->devpath = &key[8]; else if (strncmp(key, "SUBSYSTEM=", 10) == 0) msg->subsystem = &key[10]; + else if (strncmp(key, "DRIVER=", 7) == 0) + msg->driver = &key[7]; else if (strncmp(key, "SEQNUM=", 7) == 0) msg->seqnum = strtoull(&key[7], NULL, 10); else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) diff --git a/udevd.h b/udevd.h index 688e6d52ef..c1f0fd6a12 100644 --- a/udevd.h +++ b/udevd.h @@ -64,6 +64,7 @@ struct udevd_uevent_msg { char *action; char *devpath; char *subsystem; + char *driver; dev_t devt; unsigned long long seqnum; char *physdevpath; -- cgit v1.2.3-54-g00ecf From be31371fbb70b5799f30ff081585216715687b6b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 13 Aug 2006 05:34:05 +0200 Subject: 097 release --- ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 6 +++++- 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a92b509cb4..080c91b665 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,51 @@ +Summary of changes from v096 to v097 +============================================ + +Anssi Hannula: + add joystick support to persistent input rules + +Kay Sievers: + firmware.sh: remove needless '/' + vol_id: add --skip-raid and --probe-all option + switch uevent netlink socket to group 1 only + increase /proc/stat read buffer + use "change" instead of "online" events + remove 'static' from local variable + libvolume_id: add parameter 'size' to all probe functions + man pages: replace 'device-path' by 'devpath' + man pages: work around xmlto which tries to be smart + refresh vol_id man page + udevinfo: add DRIVER== + Makefile: fix dependency + libvolume_id: read ufs2 label + switch ifdef __KLIBC__ to ifndef __GLIBC__ + report failing getpwnam/getgrnam as error + rename udevcontrol message types and variables + initialize unused sockets to -1 + udevd: remove useless udevinitsend parameter + update README + udevd: autotune max_childs/max_childs_running + update frugalware rules + update SUSE rules + move default rules to etc/udev/rules.d/ + add 'crypto' devices to persistent storage rules + add late.rules to default rules + update Fedora rules + don't report an error on overlong comment lines + update SUSE rules + udevd: read DRIVER from the environment + +Marco d'Itri: + make rename_netif() error messages useful + path_id: fix an harmless syntax error + +Piter PUNK: + update slackware rules + +Richard Purdie: + Fix inotify syscalls on ARM + + Summary of changes from v095 to v096 ============================================ diff --git a/Makefile b/Makefile index bab1732da4..209ab10487 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 096 +VERSION = 097 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 5fc6380ea6..7980b452c7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,6 +1,10 @@ +udev 097 +======== +Bugfixes and small improvements. + udev 096 ======== -fix path_id for recent kernels +Fix path_id for recent kernels. udev 095 ======== -- cgit v1.2.3-54-g00ecf From 469aa1df95d90a047fa0030ff48fe4a06214fa5d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Aug 2006 00:00:16 +0200 Subject: udevd: remove huge socket buffer on the control socket --- udevd.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/udevd.c b/udevd.c index f4f918900a..5c51beed1e 100644 --- a/udevd.c +++ b/udevd.c @@ -812,7 +812,6 @@ static void reap_sigchilds(void) static int init_udevd_socket(void) { struct sockaddr_un saddr; - const int buffersize = 16 * 1024 * 1024; socklen_t addrlen; const int feature_on = 1; int retval; @@ -829,9 +828,6 @@ static int init_udevd_socket(void) return -1; } - /* set receive buffersize */ - setsockopt(udevd_sock, SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize)); - /* the bind takes care of ensuring only one copy running */ retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { -- cgit v1.2.3-54-g00ecf From 226b96927176ff8db3bc0519a661220b1b980a55 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Aug 2006 19:38:13 +0200 Subject: man page: fix typo --- udev.7 | 4 ++-- udev.xml | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/udev.7 b/udev.7 index 8a2ea16a61..eef10d4afb 100644 --- a/udev.7 +++ b/udev.7 @@ -63,7 +63,7 @@ Compare for equality. Compare for non\-equality. .TP 3n \fB=\fR -Asign a value to a key. Keys that represent a list, are reset and only this single value is assigned. +Assign a value to a key. Keys that represent a list, are reset and only this single value is assigned. .TP 3n \fB+=\fR Add the value to a key that holds a list of entries. @@ -162,7 +162,7 @@ will ignore this event completely. \fBignore_remove\fR will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. \fBall_partitions\fR -will create device nodes for all available partitions of a block device. This may be useful for removable media. +will create the device nodes for all available partitions of a block device. This may be useful for removable media devices where media changes are not detected. .PP The \fBNAME\fR, diff --git a/udev.xml b/udev.xml index 84c66c626e..4896c2bb27 100644 --- a/udev.xml +++ b/udev.xml @@ -110,7 +110,7 @@ - Asign a value to a key. Keys that represent a list, are reset + Assign a value to a key. Keys that represent a list, are reset and only this single value is assigned. @@ -337,8 +337,9 @@ will ignore this event completely. will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. - will create device nodes for all available partitions of - a block device. This may be useful for removable media. + will create the device nodes for all available + partitions of a block device. This may be useful for removable media devices where + media changes are not detected. -- cgit v1.2.3-54-g00ecf From aa9a49b4b39bfaa465ae9d0f6ac4621cd519b719 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 15 Aug 2006 23:53:14 +0200 Subject: volume_id: fix fat32 cluster chain traversal --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/fat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index e5fd5fcddd..e93f8b5af5 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 69 +SHLIB_REV = 70 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 92f316a275..9a2e4784d8 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -349,7 +349,7 @@ fat32: /* set next cluster */ next = le32_to_cpu(*((uint32_t *) buf)) & 0x0fffffff; - if (next == 0) + if (next < 2 || next >= 0x0ffffff0) break; } if (maxloop == 0) -- cgit v1.2.3-54-g00ecf From dbd16d2684f77a74dc272ce0421315ea357dcaf7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Aug 2006 02:04:04 +0200 Subject: rename udev_libc_wrapper -> udev_sysdeps --- Makefile | 4 +- udev.h | 2 +- udev_libc_wrapper.c | 208 ---------------------------------------------------- udev_libc_wrapper.h | 172 ------------------------------------------- udev_sysdeps.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++ udev_sysdeps.h | 171 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 381 insertions(+), 383 deletions(-) delete mode 100644 udev_libc_wrapper.c delete mode 100644 udev_libc_wrapper.h create mode 100644 udev_sysdeps.c create mode 100644 udev_sysdeps.h diff --git a/Makefile b/Makefile index 209ab10487..1b3815f3bb 100644 --- a/Makefile +++ b/Makefile @@ -59,7 +59,7 @@ HEADERS = \ udevd.h \ udev_rules.h \ logging.h \ - udev_libc_wrapper.h \ + udev_sysdeps.h \ udev_selinux.h \ list.h @@ -75,7 +75,7 @@ UDEV_OBJS = \ udev_utils_string.o \ udev_utils_file.o \ udev_utils_run.o \ - udev_libc_wrapper.o + udev_sysdeps.o LIBUDEV = libudev.a MAN_PAGES = \ diff --git a/udev.h b/udev.h index be01aeaa2a..a69ce0893f 100644 --- a/udev.h +++ b/udev.h @@ -27,7 +27,7 @@ #include "list.h" #include "logging.h" -#include "udev_libc_wrapper.h" +#include "udev_sysdeps.h" #include "udev_version.h" #define COMMENT_CHARACTER '#' diff --git a/udev_libc_wrapper.c b/udev_libc_wrapper.c deleted file mode 100644 index 35e01e619d..0000000000 --- a/udev_libc_wrapper.c +++ /dev/null @@ -1,208 +0,0 @@ -/* - * udev_libc_wrapper - wrapping of functions missing in a specific libc - * or not working in a statically compiled binary - * - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2005 Kay Sievers - * - * 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 02139, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -#ifndef __GLIBC__ -#define __OWN_USERDB_PARSER__ -#endif - -#ifdef __GLIBC__ -#define __OWN_STRLCPYCAT__ -#endif - -#ifdef USE_STATIC -#define __OWN_USERDB_PARSER__ -#endif - -#ifdef __OWN_STRLCPYCAT__ -size_t strlcpy(char *dst, const char *src, size_t size) -{ - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while ((ch = *p++)) { - if (bytes+1 < size) - *q++ = ch; - bytes++; - } - - /* If size == 0 there is no space for a final null... */ - if (size) - *q = '\0'; - - return bytes; -} - -size_t strlcat(char *dst, const char *src, size_t size) -{ - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while (bytes < size && *q) { - q++; - bytes++; - } - if (bytes == size) - return (bytes + strlen(src)); - - while ((ch = *p++)) { - if (bytes+1 < size) - *q++ = ch; - bytes++; - } - - *q = '\0'; - return bytes; -} -#endif /* __OWN_STRLCPYCAT__ */ - -#ifndef __OWN_USERDB_PARSER__ -#include -#include -#include - -uid_t lookup_user(const char *user) -{ - struct passwd *pw; - uid_t uid = 0; - - pw = getpwnam(user); - if (pw == NULL) - err("error resolving user '%s': %s", user, strerror(errno)); - else - uid = pw->pw_uid; - - return uid; -} - -gid_t lookup_group(const char *group) -{ - struct group *gr; - gid_t gid = 0; - - gr = getgrnam(group); - if (gr == NULL) - err("error resolving group '%s': %s", group, strerror(errno)); - else - gid = gr->gr_gid; - - return gid; -} - -#else /* __OWN_USERDB_PARSER__ */ - -#define PASSWD_FILE "/etc/passwd" -#define GROUP_FILE "/etc/group" - -/* return the id of a passwd style line, selected by the users name */ -static unsigned long get_id_by_name(const char *uname, const char *dbfile) -{ - unsigned long id = 0; - char line[LINE_SIZE]; - char *buf; - char *bufline; - size_t bufsize; - size_t cur; - size_t count; - char *pos; - char *name; - char *idstr; - char *tail; - - if (file_map(dbfile, &buf, &bufsize) != 0) { - err("can't open '%s' as db file: %s", dbfile, strerror(errno)); - return 0; - } - dbg("search '%s' in '%s'", uname, dbfile); - - /* loop through the whole file */ - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - - if (count >= sizeof(line)) - continue; - - memcpy(line, bufline, count-1); - line[count-1] = '\0'; - pos = line; - - /* get name */ - name = strsep(&pos, ":"); - if (name == NULL) - continue; - - /* skip pass */ - if (strsep(&pos, ":") == NULL) - continue; - - /* get id */ - idstr = strsep(&pos, ":"); - if (idstr == NULL) - continue; - - if (strcmp(uname, name) == 0) { - id = strtoul(idstr, &tail, 10); - if (tail[0] != '\0') { - id = 0; - dbg("no id found for '%s'", name); - } else - dbg("id for '%s' is '%li'", name, id); - break; - } - } - - file_unmap(buf, bufsize); - return id; -} - -uid_t lookup_user(const char *user) -{ - unsigned long id; - - id = get_id_by_name(user, PASSWD_FILE); - return (uid_t) id; -} - -gid_t lookup_group(const char *group) -{ - unsigned long id; - - id = get_id_by_name(group, GROUP_FILE); - return (gid_t) id; -} -#endif /* __OWN_USERDB_PARSER__ */ diff --git a/udev_libc_wrapper.h b/udev_libc_wrapper.h deleted file mode 100644 index 21dbce6474..0000000000 --- a/udev_libc_wrapper.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * udev_libc_wrapper - wrapping of functions missing in a specific libc - * or not working in a statically compiled binary - * - * Copyright (C) 2005 Kay Sievers - * - * 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 02139, USA. - * - */ - -#ifndef _UDEV_LIBC_WRAPPER_H_ -#define _UDEV_LIBC_WRAPPER_H_ - -#include -#include -#include - -/* needed until Inotify! syscalls reach glibc */ -#include -#ifndef __NR_inotify_init -#if defined(__i386__) -# define __NR_inotify_init 291 -# define __NR_inotify_add_watch 292 -# define __NR_inotify_rm_watch 293 -#elif defined(__x86_64__) -# define __NR_inotify_init 253 -# define __NR_inotify_add_watch 254 -# define __NR_inotify_rm_watch 255 -#elif defined(__powerpc__) || defined(__powerpc64__) -# define __NR_inotify_init 275 -# define __NR_inotify_add_watch 276 -# define __NR_inotify_rm_watch 277 -#elif defined (__ia64__) -# define __NR_inotify_init 1277 -# define __NR_inotify_add_watch 1278 -# define __NR_inotify_rm_watch 1279 -#elif defined (__s390__) -# define __NR_inotify_init 284 -# define __NR_inotify_add_watch 285 -# define __NR_inotify_rm_watch 286 -#elif defined (__alpha__) -# define __NR_inotify_init 444 -# define __NR_inotify_add_watch 445 -# define __NR_inotify_rm_watch 446 -#elif defined (__sparc__) || defined (__sparc64__) -# define __NR_inotify_init 151 -# define __NR_inotify_add_watch 152 -# define __NR_inotify_rm_watch 156 -#elif defined (__arm__) -# define __NR_inotify_init __NR_SYSCALL_BASE+316 -# define __NR_inotify_add_watch __NR_SYSCALL_BASE+317 -# define __NR_inotify_rm_watch __NR_SYSCALL_BASE+318 -#elif defined (__sh__) -# define __NR_inotify_init 290 -# define __NR_inotify_add_watch 291 -# define __NR_inotify_rm_watch 292 -#elif defined (__hppa__) -# define __NR_inotify_init 269 -# define __NR_inotify_add_watch 270 -# define __NR_inotify_rm_watch 271 -#elif defined (__mips__) -# include -# if _MIPS_SIM == _MIPS_SIM_ABI32 -# define __NR_Linux 4000 -# define __NR_inotify_init (__NR_Linux + 284) -# define __NR_inotify_add_watch (__NR_Linux + 285) -# define __NR_inotify_rm_watch (__NR_Linux + 286) -# elif _MIPS_SIM == _MIPS_SIM_ABI64 -# define __NR_Linux 5000 -# define __NR_inotify_init (__NR_Linux + 243) -# define __NR_inotify_add_watch (__NR_Linux + 244) -# define __NR_inotify_rm_watch (__NR_Linux + 245) -# elif _MIPS_SIM == _MIPS_SIM_NABI32 -# define __NR_Linux 6000 -# define __NR_inotify_init (__NR_Linux + 247) -# define __NR_inotify_add_watch (__NR_Linux + 248) -# define __NR_inotify_rm_watch (__NR_Linux + 249) -# endif -#else -#warning "inotify unsupported on this architecture!" -#endif -#endif /* __NR_inotify_init */ - -/* dummy if we don't have the syscalls defined */ -#ifndef __NR_inotify_init -static inline int inotify_init(void) -{ - return -1; -} - -static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) -{ - return -1; -} -#else -/* needed until /usr/include/sys/inotify.h is working */ -#ifndef __GLIBC__ -#include -#else -static inline int inotify_init(void) -{ - return syscall(__NR_inotify_init); -} - -static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) -{ - return syscall(__NR_inotify_add_watch, fd, name, mask); -} -#endif /* __GLIBC__ */ -#endif /* __NR_inotify_init */ - -#ifndef IN_CREATE -#define IN_CREATE 0x00000100 /* Subfile was created */ -#define IN_MOVED_FROM 0x00000040 /* File was moved from X */ -#define IN_MOVED_TO 0x00000080 /* File was moved to Y */ -#define IN_DELETE 0x00000200 /* Subfile was deleted */ -#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ -#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ -#endif /* IN_CREATE */ - -/* needed for our signal handlers to work */ -#undef asmlinkage -#ifdef __i386__ -#define asmlinkage __attribute__((regparm(0))) -#else -#define asmlinkage -#endif /* __i386__ */ - -/* headers are broken on some architectures */ -#ifndef __FD_SET -#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) -#endif -#ifndef __FD_CLR -#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) -#endif -#ifndef __FD_ISSET -#define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) -#endif -#ifndef __FD_ZERO -#define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) -#endif - -#ifndef NETLINK_KOBJECT_UEVENT -#define NETLINK_KOBJECT_UEVENT 15 -#endif - -#ifndef SO_RCVBUFFORCE -#if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || defined(__sparc_v9__) -#define SO_RCVBUFFORCE 0x100b -#else -#define SO_RCVBUFFORCE 33 -#endif -#endif - -extern uid_t lookup_user(const char *user); -extern gid_t lookup_group(const char *group); - -extern size_t strlcpy(char *dst, const char *src, size_t size); -extern size_t strlcat(char *dst, const char *src, size_t size); - -#endif /* _UDEV_LIBC_WRAPPER_H_ */ diff --git a/udev_sysdeps.c b/udev_sysdeps.c new file mode 100644 index 0000000000..152b7f0c5c --- /dev/null +++ b/udev_sysdeps.c @@ -0,0 +1,207 @@ +/* + * udev_sysdeps.c - wrapping of libc features and kernel defines + * + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2005-2006 Kay Sievers + * + * 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 02139, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +#ifndef __GLIBC__ +#define __OWN_USERDB_PARSER__ +#endif + +#ifdef __GLIBC__ +#define __OWN_STRLCPYCAT__ +#endif + +#ifdef USE_STATIC +#define __OWN_USERDB_PARSER__ +#endif + +#ifdef __OWN_STRLCPYCAT__ +size_t strlcpy(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + /* If size == 0 there is no space for a final null... */ + if (size) + *q = '\0'; + + return bytes; +} + +size_t strlcat(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while (bytes < size && *q) { + q++; + bytes++; + } + if (bytes == size) + return (bytes + strlen(src)); + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + *q = '\0'; + return bytes; +} +#endif /* __OWN_STRLCPYCAT__ */ + +#ifndef __OWN_USERDB_PARSER__ +#include +#include +#include + +uid_t lookup_user(const char *user) +{ + struct passwd *pw; + uid_t uid = 0; + + pw = getpwnam(user); + if (pw == NULL) + err("error resolving user '%s': %s", user, strerror(errno)); + else + uid = pw->pw_uid; + + return uid; +} + +gid_t lookup_group(const char *group) +{ + struct group *gr; + gid_t gid = 0; + + gr = getgrnam(group); + if (gr == NULL) + err("error resolving group '%s': %s", group, strerror(errno)); + else + gid = gr->gr_gid; + + return gid; +} + +#else /* __OWN_USERDB_PARSER__ */ + +#define PASSWD_FILE "/etc/passwd" +#define GROUP_FILE "/etc/group" + +/* return the id of a passwd style line, selected by the users name */ +static unsigned long get_id_by_name(const char *uname, const char *dbfile) +{ + unsigned long id = 0; + char line[LINE_SIZE]; + char *buf; + char *bufline; + size_t bufsize; + size_t cur; + size_t count; + char *pos; + char *name; + char *idstr; + char *tail; + + if (file_map(dbfile, &buf, &bufsize) != 0) { + err("can't open '%s' as db file: %s", dbfile, strerror(errno)); + return 0; + } + dbg("search '%s' in '%s'", uname, dbfile); + + /* loop through the whole file */ + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + + if (count >= sizeof(line)) + continue; + + memcpy(line, bufline, count-1); + line[count-1] = '\0'; + pos = line; + + /* get name */ + name = strsep(&pos, ":"); + if (name == NULL) + continue; + + /* skip pass */ + if (strsep(&pos, ":") == NULL) + continue; + + /* get id */ + idstr = strsep(&pos, ":"); + if (idstr == NULL) + continue; + + if (strcmp(uname, name) == 0) { + id = strtoul(idstr, &tail, 10); + if (tail[0] != '\0') { + id = 0; + dbg("no id found for '%s'", name); + } else + dbg("id for '%s' is '%li'", name, id); + break; + } + } + + file_unmap(buf, bufsize); + return id; +} + +uid_t lookup_user(const char *user) +{ + unsigned long id; + + id = get_id_by_name(user, PASSWD_FILE); + return (uid_t) id; +} + +gid_t lookup_group(const char *group) +{ + unsigned long id; + + id = get_id_by_name(group, GROUP_FILE); + return (gid_t) id; +} +#endif /* __OWN_USERDB_PARSER__ */ diff --git a/udev_sysdeps.h b/udev_sysdeps.h new file mode 100644 index 0000000000..530218f7b9 --- /dev/null +++ b/udev_sysdeps.h @@ -0,0 +1,171 @@ +/* + * udev_sysdeps.h - wrapping of libc features and kernel defines + * + * Copyright (C) 2005-2006 Kay Sievers + * + * 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 02139, USA. + * + */ + +#ifndef _UDEV_SYSDEPS_H_ +#define _UDEV_SYSDEPS_H_ + +#include +#include +#include + +/* needed until Inotify! syscalls reach glibc */ +#include +#ifndef __NR_inotify_init +#if defined(__i386__) +# define __NR_inotify_init 291 +# define __NR_inotify_add_watch 292 +# define __NR_inotify_rm_watch 293 +#elif defined(__x86_64__) +# define __NR_inotify_init 253 +# define __NR_inotify_add_watch 254 +# define __NR_inotify_rm_watch 255 +#elif defined(__powerpc__) || defined(__powerpc64__) +# define __NR_inotify_init 275 +# define __NR_inotify_add_watch 276 +# define __NR_inotify_rm_watch 277 +#elif defined (__ia64__) +# define __NR_inotify_init 1277 +# define __NR_inotify_add_watch 1278 +# define __NR_inotify_rm_watch 1279 +#elif defined (__s390__) +# define __NR_inotify_init 284 +# define __NR_inotify_add_watch 285 +# define __NR_inotify_rm_watch 286 +#elif defined (__alpha__) +# define __NR_inotify_init 444 +# define __NR_inotify_add_watch 445 +# define __NR_inotify_rm_watch 446 +#elif defined (__sparc__) || defined (__sparc64__) +# define __NR_inotify_init 151 +# define __NR_inotify_add_watch 152 +# define __NR_inotify_rm_watch 156 +#elif defined (__arm__) +# define __NR_inotify_init __NR_SYSCALL_BASE+316 +# define __NR_inotify_add_watch __NR_SYSCALL_BASE+317 +# define __NR_inotify_rm_watch __NR_SYSCALL_BASE+318 +#elif defined (__sh__) +# define __NR_inotify_init 290 +# define __NR_inotify_add_watch 291 +# define __NR_inotify_rm_watch 292 +#elif defined (__hppa__) +# define __NR_inotify_init 269 +# define __NR_inotify_add_watch 270 +# define __NR_inotify_rm_watch 271 +#elif defined (__mips__) +# include +# if _MIPS_SIM == _MIPS_SIM_ABI32 +# define __NR_Linux 4000 +# define __NR_inotify_init (__NR_Linux + 284) +# define __NR_inotify_add_watch (__NR_Linux + 285) +# define __NR_inotify_rm_watch (__NR_Linux + 286) +# elif _MIPS_SIM == _MIPS_SIM_ABI64 +# define __NR_Linux 5000 +# define __NR_inotify_init (__NR_Linux + 243) +# define __NR_inotify_add_watch (__NR_Linux + 244) +# define __NR_inotify_rm_watch (__NR_Linux + 245) +# elif _MIPS_SIM == _MIPS_SIM_NABI32 +# define __NR_Linux 6000 +# define __NR_inotify_init (__NR_Linux + 247) +# define __NR_inotify_add_watch (__NR_Linux + 248) +# define __NR_inotify_rm_watch (__NR_Linux + 249) +# endif +#else +#warning "inotify unsupported on this architecture!" +#endif +#endif /* __NR_inotify_init */ + +/* dummy if we don't have the syscalls defined */ +#ifndef __NR_inotify_init +static inline int inotify_init(void) +{ + return -1; +} + +static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) +{ + return -1; +} +#else +/* needed until /usr/include/sys/inotify.h is working */ +#ifndef __GLIBC__ +#include +#else +static inline int inotify_init(void) +{ + return syscall(__NR_inotify_init); +} + +static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) +{ + return syscall(__NR_inotify_add_watch, fd, name, mask); +} +#endif /* __GLIBC__ */ +#endif /* __NR_inotify_init */ + +#ifndef IN_CREATE +#define IN_CREATE 0x00000100 /* Subfile was created */ +#define IN_MOVED_FROM 0x00000040 /* File was moved from X */ +#define IN_MOVED_TO 0x00000080 /* File was moved to Y */ +#define IN_DELETE 0x00000200 /* Subfile was deleted */ +#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ +#endif /* IN_CREATE */ + +/* needed for our signal handlers to work */ +#undef asmlinkage +#ifdef __i386__ +#define asmlinkage __attribute__((regparm(0))) +#else +#define asmlinkage +#endif /* __i386__ */ + +/* headers are broken on some architectures */ +#ifndef __FD_SET +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) +#endif +#ifndef __FD_CLR +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) +#endif +#ifndef __FD_ISSET +#define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) +#endif +#ifndef __FD_ZERO +#define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) +#endif + +#ifndef NETLINK_KOBJECT_UEVENT +#define NETLINK_KOBJECT_UEVENT 15 +#endif + +#ifndef SO_RCVBUFFORCE +#if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || defined(__sparc_v9__) +#define SO_RCVBUFFORCE 0x100b +#else +#define SO_RCVBUFFORCE 33 +#endif +#endif + +extern uid_t lookup_user(const char *user); +extern gid_t lookup_group(const char *group); + +extern size_t strlcpy(char *dst, const char *src, size_t size); +extern size_t strlcat(char *dst, const char *src, size_t size); + +#endif -- cgit v1.2.3-54-g00ecf From 33a570f38b02c4946abda3b94ecaa3657f70fb4f Mon Sep 17 00:00:00 2001 From: Michał Bartoszkiewicz Date: Thu, 17 Aug 2006 00:58:37 +0200 Subject: man pages: fix typos --- udev.7 | 6 +++--- udev.xml | 8 ++++---- udevtest.8 | 2 +- udevtest.xml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/udev.7 b/udev.7 index eef10d4afb..cef84de041 100644 --- a/udev.7 +++ b/udev.7 @@ -52,7 +52,7 @@ and .PP The udev rules are read from the files located in the \fI/etc/udev/rules.d\fR -directory or at the location specified value in the configuraton file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignement keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. +directory or at the location specified value in the configuration file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. .PP A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: .TP 3n @@ -119,7 +119,7 @@ Matches zero, or any number of characters. Matches any single character. .TP 3n \fB[]\fR -Matches any single character specified within the brackets. example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. +Matches any single character specified within the brackets. For example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. .PP The following keys can get values assigned: .TP 3n @@ -149,7 +149,7 @@ Import the printed result or the value of a file in environment key format into \fBprogram\fR will execute an external program and read its output. \fBfile\fR -will inport a text file. If no option is given, udev will determine it from the executable bit of of the file permissions. +will import a text file. If no option is given, udev will determine it from the executable bit of of the file permissions. .TP 3n \fBWAIT_FOR_SYSFS\fR Wait for the specified sysfs file of the device to be created. Can be used to fight against kernel sysfs timing issues. diff --git a/udev.xml b/udev.xml index 4896c2bb27..01e9d522ed 100644 --- a/udev.xml +++ b/udev.xml @@ -81,8 +81,8 @@ Rules files The udev rules are read from the files located in the /etc/udev/rules.d directory or at the location specified - value in the configuraton file. Every line in the rules file contains at least - one key value pair. There are two kind of keys, match and assignement keys. + value in the configuration file. Every line in the rules file contains at least + one key value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified @@ -238,7 +238,7 @@ - Matches any single character specified within the brackets. + Matches any single character specified within the brackets. For example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '-' character. For example, to match on the range of all digits, the pattern [0-9] would @@ -315,7 +315,7 @@ Import the printed result or the value of a file in environment key format into the event environment. will execute an - external program and read its output. will inport a + external program and read its output. will import a text file. If no option is given, udev will determine it from the executable bit of of the file permissions. diff --git a/udevtest.8 b/udevtest.8 index da435bc4e4..9e11f93b24 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -17,7 +17,7 @@ udevtest \- simulate a udev run and print the action to the console \fBudevtest \fR\fB\fIdevice\-path\fR\fR .SH "DESCRIPTION" .PP -udevtest simulates a udev run for the given device and prints out the name of the node udev would have created, or the name of the network interface, that would have been renamend. +udevtest simulates a udev run for the given device and prints out the name of the node udev would have created, or the name of the network interface, that would have been renamed. .SH "AUTHOR" .PP Written by Greg Kroah\-Hartman diff --git a/udevtest.xml b/udevtest.xml index 81f674da9d..259558dd5a 100644 --- a/udevtest.xml +++ b/udevtest.xml @@ -32,7 +32,7 @@ DESCRIPTION udevtest simulates a udev run for the given device and prints out the name of the node udev would have created, or the name of the network interface, - that would have been renamend. + that would have been renamed. AUTHOR -- cgit v1.2.3-54-g00ecf From 878b47da74dd0f24741ced985d4f8cdc058c9f42 Mon Sep 17 00:00:00 2001 From: Alex Merry Date: Thu, 17 Aug 2006 21:14:45 +0200 Subject: udevtest: allow /sys in the devpath paramter --- udevtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevtest.c b/udevtest.c index d736711a3f..078674a01d 100644 --- a/udevtest.c +++ b/udevtest.c @@ -64,6 +64,7 @@ int main(int argc, char *argv[], char *envp[]) udev_config_init(); if (udev_log_priority < LOG_INFO) udev_log_priority = LOG_INFO; + sysfs_init(); if (argc != 2) { info("Usage: udevtest "); @@ -82,7 +83,6 @@ int main(int argc, char *argv[], char *envp[]) } else devpath = argv[1]; - sysfs_init(); udev_rules_init(&rules, 0); dev = sysfs_device_get(devpath); -- cgit v1.2.3-54-g00ecf From 554dde8e9a2e1e8bdf2816f04af985b227937c32 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Aug 2006 02:27:16 +0200 Subject: db: store devpath - node relationship for all devices If we don't have any interesting values to store, we just use a symlink (doesn't occupy a whole page on tmpfs like a file) to store the name of the node belonging to a devpath. This will allow udevinfo to resolve all names, even when we don't have a full database entry. --- udev_db.c | 117 +++++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 85 insertions(+), 32 deletions(-) diff --git a/udev_db.c b/udev_db.c index e9ae799132..b058351d27 100644 --- a/udev_db.c +++ b/udev_db.c @@ -70,49 +70,55 @@ static int db_file_to_devpath(const char *filename, char *devpath, size_t len) int udev_db_add_device(struct udevice *udev) { char filename[PATH_SIZE]; - struct name_entry *name_loop; - FILE *f; if (udev->test_run) return 0; - /* don't write anything if udev created only the node with the - * kernel name without any interesting data to remember + devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); + create_path(filename); + + /* + * create only a symlink with the name as the target + * if we don't have any interesting data to remember */ if (strcmp(udev->name, udev->dev->kernel_name) == 0 && list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && !udev->partitions && !udev->ignore_remove) { - dbg("nothing interesting to store in udevdb, skip"); - goto exit; - } - - devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); - create_path(filename); - f = fopen(filename, "w"); - if (f == NULL) { - err("unable to create db file '%s': %s", filename, strerror(errno)); - return -1; + dbg("nothing interesting to store, create symlink"); + unlink(filename); + if (symlink(udev->name, filename) != 0) { + err("unable to create db link '%s': %s", filename, strerror(errno)); + return -1; + } + } else { + struct name_entry *name_loop; + FILE *f; + + f = fopen(filename, "w"); + if (f == NULL) { + err("unable to create db file '%s': %s", filename, strerror(errno)); + return -1; + } + dbg("storing data for device '%s' in '%s'", udev->dev->devpath, filename); + + fprintf(f, "N:%s\n", udev->name); + list_for_each_entry(name_loop, &udev->symlink_list, node) + fprintf(f, "S:%s\n", name_loop->name); + fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); + if (udev->partitions) + fprintf(f, "A:%u\n", udev->partitions); + if (udev->ignore_remove) + fprintf(f, "R:%u\n", udev->ignore_remove); + list_for_each_entry(name_loop, &udev->env_list, node) + fprintf(f, "E:%s\n", name_loop->name); + fclose(f); } - dbg("storing data for device '%s' in '%s'", udev->dev->devpath, filename); - - fprintf(f, "N:%s\n", udev->name); - list_for_each_entry(name_loop, &udev->symlink_list, node) - fprintf(f, "S:%s\n", name_loop->name); - fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); - if (udev->partitions) - fprintf(f, "A:%u\n", udev->partitions); - if (udev->ignore_remove) - fprintf(f, "R:%u\n", udev->ignore_remove); - list_for_each_entry(name_loop, &udev->env_list, node) - fprintf(f, "E:%s\n", name_loop->name); - fclose(f); - -exit: return 0; } int udev_db_get_device(struct udevice *udev, const char *devpath) { + struct stat stats; char filename[PATH_SIZE]; char line[PATH_SIZE]; unsigned int major, minor; @@ -122,13 +128,35 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) size_t cur; size_t count; + strlcpy(udev->dev->devpath, devpath, sizeof(udev->dev->devpath)); devpath_to_db_path(devpath, filename, sizeof(filename)); - if (file_map(filename, &buf, &bufsize) != 0) { + + if (lstat(filename, &stats) != 0) { info("no db file to read %s: %s", filename, strerror(errno)); return -1; } + if ((stats.st_mode & S_IFMT) == S_IFLNK) { + char target[NAME_SIZE]; + int target_len; + + info("found a symlink as db file"); + target_len = readlink(filename, target, sizeof(target)); + if (target_len > 0) + target[target_len] = '\0'; + else { + info("error reading db link %s: %s", filename, strerror(errno)); + return -1; + } + dbg("db link points to '%s'", target); + strlcpy(udev->name, target, sizeof(udev->name)); + return 0; + } + + if (file_map(filename, &buf, &bufsize) != 0) { + info("error reading db file %s: %s", filename, strerror(errno)); + return -1; + } - strlcpy(udev->dev->devpath, devpath, sizeof(udev->dev->devpath)); cur = 0; while (cur < bufsize) { count = buf_get_line(buf, bufsize, cur); @@ -216,6 +244,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) struct dirent *ent; char filename[PATH_SIZE]; char nodename[PATH_SIZE]; + struct stat stats; char *bufline; char *buf; size_t bufsize; @@ -232,8 +261,32 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) filename[sizeof(filename)-1] = '\0'; dbg("looking at '%s'", filename); + if (lstat(filename, &stats) != 0) { + info("unable to read %s: %s", filename, strerror(errno)); + continue; + } + if ((stats.st_mode & S_IFMT) == S_IFLNK) { + char target[NAME_SIZE]; + int target_len; + + info("found a symlink as db file"); + target_len = readlink(filename, target, sizeof(target)); + if (target_len > 0) + target[target_len] = '\0'; + else { + info("error reading db link %s: %s", filename, strerror(errno)); + return -1; + } + dbg("db link points to '%s'", target); + if (strcmp(name, target) == 0) { + db_file_to_devpath(ent->d_name, devpath, len); + found =1; + } + continue; + } + if (file_map(filename, &buf, &bufsize) != 0) { - err("unable to read db file '%s': %s", filename, strerror(errno)); + info("unable to read db file '%s': %s", filename, strerror(errno)); continue; } -- cgit v1.2.3-54-g00ecf From 1aa0c52b4458be4cf6e55b2faf5c602761f5d3a3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Aug 2006 02:31:37 +0200 Subject: udevinfo: allow -a -n --- udevinfo.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index e0ea5fb4ed..6b7368119f 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -376,12 +376,22 @@ int main(int argc, char *argv[], char *envp[]) } break; case ACTION_ATTRIBUTE_WALK: - if (path[0] == '\0') { - fprintf(stderr, "attribute walk on device chain needs path(-p) specified\n"); - rc = 4; - goto exit; - } else + if (path[0] != '\0') { print_device_chain(path); + } else if (name[0] != '\0') { + char devpath[PATH_SIZE]; + + if (udev_db_lookup_name(name, devpath, sizeof(devpath)) != 0) { + fprintf(stderr, "node name not found\n"); + rc = 4; + goto exit; + } + print_device_chain(devpath); + } else { + fprintf(stderr, "attribute walk needs device path(-p) or node name(-n) specified\n"); + rc = 5; + goto exit; + } break; case ACTION_ROOT: printf("%s\n", udev_root); -- cgit v1.2.3-54-g00ecf From 2362eea6019e07a2e79e67ebe626bfacf40ff40f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Aug 2006 02:33:46 +0200 Subject: udevinfo, udevtest: simplify '/sys' stripping from devpath argument --- udev_utils_file.c | 2 +- udevinfo.c | 47 ++++++++++++++--------------------------------- udevtest.c | 14 ++++---------- 3 files changed, 19 insertions(+), 44 deletions(-) diff --git a/udev_utils_file.c b/udev_utils_file.c index acaffdc918..6a046e822d 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -49,7 +49,7 @@ int create_path(const char *path) pos[0] = '\0'; dbg("stat '%s'\n", p); - if (stat (p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) return 0; if (create_path (p) != 0) diff --git a/udevinfo.c b/udevinfo.c index 6b7368119f..1a10f9ad07 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -209,9 +209,7 @@ int main(int argc, char *argv[], char *envp[]) char path[PATH_SIZE] = ""; char name[PATH_SIZE] = ""; - char temp[PATH_SIZE]; struct name_entry *name_loop; - char *pos; int rc = 0; logging_init("udevinfo"); @@ -234,16 +232,20 @@ int main(int argc, char *argv[], char *envp[]) dbg("option '%c'", option); switch (option) { case 'n': - dbg("udev name: %s\n", optarg); - strlcpy(name, optarg, sizeof(name)); + /* remove /dev if given */ + if (strncmp(optarg, udev_root, strlen(udev_root)) == 0) + strlcpy(name, &optarg[strlen(udev_root)+1], sizeof(name)); + else + strlcpy(name, optarg, sizeof(name)); + dbg("name: %s\n", name); break; case 'p': - dbg("udev path: %s\n", optarg); - /* remove sysfs mountpoint if not given */ + /* remove /sys if given */ if (strncmp(optarg, sysfs_path, strlen(sysfs_path)) == 0) strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path)); else strlcpy(path, optarg, sizeof(path)); + dbg("path: %s\n", path); break; case 'q': dbg("udev query: %s\n", optarg); @@ -299,40 +301,19 @@ int main(int argc, char *argv[], char *envp[]) /* run action */ switch (action) { case ACTION_QUERY: - /* need devpath or node/symlink name for query */ + /* needs devpath or node/symlink name for query */ if (path[0] != '\0') { - /* remove sysfs_path if given */ - if (strncmp(path, sysfs_path, strlen(sysfs_path)) == 0) { - pos = path + strlen(sysfs_path); - } else { - if (path[0] != '/') { - /* prepend '/' if missing */ - strcpy(temp, "/"); - strlcpy(temp, path, sizeof(temp)); - pos = temp; - } else { - pos = path; - } - } - if (udev_db_get_device(udev, pos) != 0) { - fprintf(stderr, "no record for '%s' in database\n", pos); + if (udev_db_get_device(udev, path) != 0) { + fprintf(stderr, "no record for '%s' in database\n", path); rc = 3; goto exit; } } else if (name[0] != '\0') { char devpath[PATH_SIZE]; - int len; - /* remove udev_root if given */ - len = strlen(udev_root); - if (strncmp(name, udev_root, len) == 0) { - pos = &name[len+1]; - } else - pos = name; - - if (udev_db_lookup_name(pos, devpath, sizeof(devpath)) != 0) { - fprintf(stderr, "no record for '%s' in database\n", pos); - rc = 3; + if (udev_db_lookup_name(name, devpath, sizeof(devpath)) != 0) { + fprintf(stderr, "node name not found\n"); + rc = 4; goto exit; } udev_db_get_device(udev, devpath); diff --git a/udevtest.c b/udevtest.c index 078674a01d..22627c05a7 100644 --- a/udevtest.c +++ b/udevtest.c @@ -52,7 +52,6 @@ int main(int argc, char *argv[], char *envp[]) { struct udev_rules rules; char *devpath; - char temp[PATH_SIZE]; struct udevice *udev; struct sysfs_device *dev; int retval; @@ -64,24 +63,19 @@ int main(int argc, char *argv[], char *envp[]) udev_config_init(); if (udev_log_priority < LOG_INFO) udev_log_priority = LOG_INFO; - sysfs_init(); if (argc != 2) { info("Usage: udevtest "); return 1; } - /* remove sysfs_path if given */ + sysfs_init(); + + /* remove /sys if given */ if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) devpath = &argv[1][strlen(sysfs_path)]; else - if (argv[1][0] != '/') { - /* prepend '/' if missing */ - snprintf(temp, sizeof(temp), "/%s", argv[1]); - temp[sizeof(temp)-1] = '\0'; - devpath = temp; - } else - devpath = argv[1]; + devpath = argv[1]; udev_rules_init(&rules, 0); -- cgit v1.2.3-54-g00ecf From 36dddd1ca40b4abbe3352b4cb93b465f4038666e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Aug 2006 03:15:26 +0200 Subject: lookup_user, lookup_group: report "unknown user" and "lookup failed" Patch from Marco, but both cases are reported as an error. --- udev_sysdeps.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/udev_sysdeps.c b/udev_sysdeps.c index 152b7f0c5c..c0b2d70b6e 100644 --- a/udev_sysdeps.c +++ b/udev_sysdeps.c @@ -98,9 +98,12 @@ uid_t lookup_user(const char *user) uid_t uid = 0; pw = getpwnam(user); - if (pw == NULL) - err("error resolving user '%s': %s", user, strerror(errno)); - else + if (pw == NULL) { + if (errno == 0) + err("specified user unknown '%s'", user); + else + err("error resolving user '%s': %s", user, strerror(errno)); + } else uid = pw->pw_uid; return uid; @@ -112,9 +115,12 @@ gid_t lookup_group(const char *group) gid_t gid = 0; gr = getgrnam(group); - if (gr == NULL) - err("error resolving group '%s': %s", group, strerror(errno)); - else + if (gr == NULL) { + if (errno == 0) + err("specified group unknown '%s'", group); + else + err("error resolving group '%s': %s", group, strerror(errno)); + } else gid = gr->gr_gid; return gid; -- cgit v1.2.3-54-g00ecf From eef7c9a385575375a3e3310900022b37777aeb6c Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 18 Aug 2006 03:47:59 +0200 Subject: selinux: init once in the daemon, not in every event process --- udev.c | 2 ++ udev_node.c | 2 -- udevd.c | 2 ++ udevstart.c | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/udev.c b/udev.c index 17ab635f1e..c633fff14b 100644 --- a/udev.c +++ b/udev.c @@ -32,6 +32,7 @@ #include "udev.h" #include "udev_rules.h" +#include "udev_selinux.h" #ifdef USE_LOG void log_message(int priority, const char *format, ...) @@ -93,6 +94,7 @@ int main(int argc, char *argv[], char *envp[]) if (devnull < 0) err("fatal, could not open /dev/null: %s", strerror(errno)); udev_config_init(); + selinux_init(); dbg("version %s", UDEV_VERSION); /* set signal handlers */ diff --git a/udev_node.c b/udev_node.c index ee59d4ae7c..12a738e4e2 100644 --- a/udev_node.c +++ b/udev_node.c @@ -130,8 +130,6 @@ int udev_node_add(struct udevice *udev, struct udevice *udev_old) int i; int retval = 0; - selinux_init(); - snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); filename[sizeof(filename)-1] = '\0'; diff --git a/udevd.c b/udevd.c index 5c51beed1e..bec4e3d7b4 100644 --- a/udevd.c +++ b/udevd.c @@ -45,6 +45,7 @@ #include "udev.h" #include "udev_rules.h" #include "udevd.h" +#include "udev_selinux.h" static struct udev_rules rules; static int udevd_sock = -1; @@ -931,6 +932,7 @@ int main(int argc, char *argv[], char *envp[]) err("fatal, could not open /dev/null: %s", strerror(errno)); udev_config_init(); + selinux_init(); dbg("version %s", UDEV_VERSION); if (getuid() != 0) { diff --git a/udevstart.c b/udevstart.c index 0d9b4f4004..d0a1ded2be 100644 --- a/udevstart.c +++ b/udevstart.c @@ -40,6 +40,7 @@ #include "udev.h" #include "udev_rules.h" +#include "udev_selinux.h" static const char *udev_run_str; static const char *udev_log_str; @@ -339,6 +340,7 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevstart"); udev_config_init(); + selinux_init(); dbg("version %s", UDEV_VERSION); udev_run_str = getenv("UDEV_RUN"); -- cgit v1.2.3-54-g00ecf From 95776dc6ec174f47fa4dd4d8abf5d457223e5dd4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 19 Aug 2006 16:06:25 +0200 Subject: consistent key naming to match only the event device or include all parent devices This scheme is more consistent and makes it obvious if a match happens against the event device only, or the full chain of parent devices. The old key names are now: BUS -> SUBSYSTEMS ID -> KERNELS SYSFS -> ATTRS DRIVER -> DRIVERS Match keys for the event device: KERNEL SUBSYSTEM ATTR DRIVER (in a future release, for now the same as DRIVERS) Match keys for all devices along the parent device chain: KERNELS SUBSYSTEMS ATTRS DRIVERS ID, BUS, SYSFS are no longer mentioned in the man page but still work. DRIVER must be converted to DRIVERS to match the new scheme. For now, an error is logged, if DRIVER is used. In a future release, the DRIVER key behaviour will change. --- extras/scsi_id/scsi_id.c | 2 +- extras/scsi_id/scsi_serial.c | 70 +++++++++++------------ extras/usb_id/usb_id.c | 10 ++-- test/udev-test.pl | 6 +- udev.7 | 39 +++++++------ udev.h | 4 +- udev.xml | 47 +++++++++++----- udev_db.c | 2 +- udev_device.c | 16 +++--- udev_node.c | 4 +- udev_rules.c | 125 ++++++++++++++++++++++++++--------------- udev_rules.h | 24 ++++---- udev_rules_parse.c | 131 +++++++++++++++++++++++++++---------------- udev_sysfs.c | 8 +-- udevinfo.c | 16 +++--- 15 files changed, 299 insertions(+), 205 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 446df70949..c64e203aff 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -679,7 +679,7 @@ static int scsi_id(const char *devpath, char *maj_min_dev) if (reformat_serial) format_serial(serial); if (display_bus_id) - printf("%s: ", dev_scsi->kernel_name); + printf("%s: ", dev_scsi->kernel); printf("%s\n", serial); } dbg("%s\n", serial); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 0ecfebe1b6..a0a3ae97d8 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -179,7 +179,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) sb_len = io->sb_len_wr; if (sb_len < 1) { - info("%s: sense buffer empty", dev_scsi->kernel_name); + info("%s: sense buffer empty", dev_scsi->kernel); return -1; } @@ -194,7 +194,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) s = sense_buffer[7] + 8; if (sb_len < s) { info("%s: sense buffer too small %d bytes, %d bytes too short", - dev_scsi->kernel_name, sb_len, s - sb_len); + dev_scsi->kernel, sb_len, s - sb_len); return -1; } if ((code == 0x0) || (code == 0x1)) { @@ -205,7 +205,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) * Possible? */ info("%s: sense result too" " small %d bytes", - dev_scsi->kernel_name, s); + dev_scsi->kernel, s); return -1; } asc = sense_buffer[12]; @@ -217,25 +217,25 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) ascq = sense_buffer[3]; } else { info("%s: invalid sense code 0x%x", - dev_scsi->kernel_name, code); + dev_scsi->kernel, code); return -1; } info("%s: sense key 0x%x ASC 0x%x ASCQ 0x%x", - dev_scsi->kernel_name, sense_key, asc, ascq); + dev_scsi->kernel, sense_key, asc, ascq); } else { if (sb_len < 4) { info("%s: sense buffer too small %d bytes, %d bytes too short", - dev_scsi->kernel_name, sb_len, 4 - sb_len); + dev_scsi->kernel, sb_len, 4 - sb_len); return -1; } if (sense_buffer[0] < 15) - info("%s: old sense key: 0x%x", dev_scsi->kernel_name, sense_buffer[0] & 0x0f); + info("%s: old sense key: 0x%x", dev_scsi->kernel, sense_buffer[0] & 0x0f); else info("%s: sense = %2x %2x", - dev_scsi->kernel_name, sense_buffer[0], sense_buffer[2]); + dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); info("%s: non-extended sense class %d code 0x%0x", - dev_scsi->kernel_name, sense_class, code); + dev_scsi->kernel, sense_class, code); } @@ -247,8 +247,8 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) out_buffer[j++] = ' '; } out_buffer[j] = '\0'; - info("%s: sense dump:", dev_scsi->kernel_name); - info("%s: %s", dev_scsi->kernel_name, out_buffer); + info("%s: sense dump:", dev_scsi->kernel); + info("%s: %s", dev_scsi->kernel, out_buffer); #endif return -1; @@ -266,7 +266,7 @@ static int scsi_dump(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) } info("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x", - dev_scsi->kernel_name, io->driver_status, io->host_status, io->msg_status, io->status); + dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); if (io->status == SCSI_CHECK_CONDITION) return scsi_dump_sense(dev_scsi, io); else @@ -290,7 +290,7 @@ static int scsi_inquiry(struct sysfs_device *dev_scsi, int fd, } resend: - dbg("%s evpd %d, page 0x%x\n", dev_scsi->kernel_name, evpd, page); + dbg("%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); io_hdr.interface_id = 'S'; @@ -304,7 +304,7 @@ resend: io_hdr.timeout = DEF_TIMEOUT; if (ioctl(fd, SG_IO, &io_hdr) < 0) { - info("%s: ioctl failed: %s", dev_scsi->kernel_name, strerror(errno)); + info("%s: ioctl failed: %s", dev_scsi->kernel, strerror(errno)); retval = -1; goto error; } @@ -328,7 +328,7 @@ resend: retval = buflen; } else if (retval > 0) { if (--retry > 0) { - dbg("%s: Retrying ...\n", dev_scsi->kernel_name); + dbg("%s: Retrying ...\n", dev_scsi->kernel); goto resend; } retval = -1; @@ -337,7 +337,7 @@ resend: error: if (retval < 0) info("%s: Unable to get INQUIRY vpd %d page 0x%x.", - dev_scsi->kernel_name, evpd, page); + dev_scsi->kernel, evpd, page); return retval; } @@ -355,11 +355,11 @@ static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, return 1; if (buffer[1] != 0) { - info("%s: page 0 not available.", dev_scsi->kernel_name); + info("%s: page 0 not available.", dev_scsi->kernel); return 1; } if (buffer[3] > len) { - info("%s: page 0 buffer too long %d", dev_scsi->kernel_name, buffer[3]); + info("%s: page 0 buffer too long %d", dev_scsi->kernel, buffer[3]); return 1; } @@ -377,11 +377,11 @@ static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, */ vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!vendor) { - info("%s: cannot get model attribute", dev_scsi->kernel_name); + info("%s: cannot get model attribute", dev_scsi->kernel); return 1; } if (!strncmp((char *)&buffer[VENDOR_LENGTH], vendor, VENDOR_LENGTH)) { - info("%s: invalid page0 data", dev_scsi->kernel_name); + info("%s: invalid page0 data", dev_scsi->kernel); return 1; } } @@ -399,7 +399,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) attr = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!attr) { - info("%s: cannot get vendor attribute", dev_scsi->kernel_name); + info("%s: cannot get vendor attribute", dev_scsi->kernel); return 1; } strncpy(serial, attr, VENDOR_LENGTH); @@ -407,7 +407,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) attr = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!attr) { - info("%s: cannot get model attribute", dev_scsi->kernel_name); + info("%s: cannot get model attribute", dev_scsi->kernel); return 1; } strncat(serial, attr, MODEL_LENGTH); @@ -420,7 +420,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) */ if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { info("%s: expected length %d, got length %d", - dev_scsi->kernel_name, (VENDOR_LENGTH + MODEL_LENGTH), ind); + dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); return 1; } return ind; @@ -478,7 +478,7 @@ static int check_fill_0x83_id(struct sysfs_device *dev_scsi, if (max_len < len) { info("%s: length %d too short - need %d", - dev_scsi->kernel_name, max_len, len); + dev_scsi->kernel, max_len, len); return 1; } @@ -534,7 +534,7 @@ static int check_fill_0x83_prespc3(struct sysfs_device *dev_scsi, serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; serial[j++] = hex_str[ page_83[4+i] & 0x0f]; } - dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel_name); + dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); return 0; } @@ -554,7 +554,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, return 1; if (page_83[1] != PAGE_83) { - info("%s: Invalid page 0x83", dev_scsi->kernel_name); + info("%s: Invalid page 0x83", dev_scsi->kernel); return 1; } @@ -605,7 +605,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, retval = check_fill_0x83_id(dev_scsi, &page_83[j], &id_search_list[id_ind], serial, len); - dbg("%s id desc %d/%d/%d\n", dev_scsi->kernel_name, + dbg("%s id desc %d/%d/%d\n", dev_scsi->kernel, id_search_list[id_ind].id_type, id_search_list[id_ind].naa_type, id_search_list[id_ind].code_set); @@ -643,7 +643,7 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, return 1; if (page_83[1] != PAGE_83) { - info("%s: Invalid page 0x83", dev_scsi->kernel_name); + info("%s: Invalid page 0x83", dev_scsi->kernel); return 1; } /* @@ -687,7 +687,7 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, serial[j++] = hex_str[page_83[i] & 0x0f]; i++; } - dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel_name); + dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); return 0; } @@ -707,14 +707,14 @@ static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, return retval; if (buf[1] != PAGE_80) { - info("%s: Invalid page 0x80", dev_scsi->kernel_name); + info("%s: Invalid page 0x80", dev_scsi->kernel); return 1; } len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; if (max_len < len) { info("%s: length %d too short - need %d", - dev_scsi->kernel_name, max_len, len); + dev_scsi->kernel, max_len, len); return 1; } /* @@ -744,7 +744,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { info("%s: cannot open %s: %s", - dev_scsi->kernel_name, devname, strerror(errno)); + dev_scsi->kernel, devname, strerror(errno)); return 1; } @@ -790,7 +790,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, goto completed; } } else if (page_code != 0x00) { - info("%s: unsupported page code 0x%d", dev_scsi->kernel_name, page_code); + info("%s: unsupported page code 0x%d", dev_scsi->kernel, page_code); return 1; } @@ -808,7 +808,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, goto completed; } - dbg("%s: Checking page0\n", dev_scsi->kernel_name); + dbg("%s: Checking page0\n", dev_scsi->kernel); for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) @@ -834,6 +834,6 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, retval = 1; completed: if (close(fd) < 0) - info("%s: close failed: %s", dev_scsi->kernel_name, strerror(errno)); + info("%s: close failed: %s", dev_scsi->kernel, strerror(errno)); return retval; } diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 85c6beda40..ba8bfdf8c5 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -255,7 +255,7 @@ static int usb_id(const char *devpath) if_class = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceClass"); if (!if_class) { - info("%s: cannot get bInterfaceClass attribute", dev_interface->kernel_name); + info("%s: cannot get bInterfaceClass attribute", dev_interface->kernel); return 1; } if_class_num = strtoul(if_class, NULL, 16); @@ -289,28 +289,28 @@ static int usb_id(const char *devpath) /* Generic SPC-2 device */ scsi_vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!scsi_vendor) { - info("%s: cannot get SCSI vendor attribute", dev_scsi->kernel_name); + info("%s: cannot get SCSI vendor attribute", dev_scsi->kernel); goto fallback; } set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); scsi_model = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!scsi_model) { - info("%s: cannot get SCSI model attribute", dev_scsi->kernel_name); + info("%s: cannot get SCSI model attribute", dev_scsi->kernel); goto fallback; } set_str(model_str, scsi_model, sizeof(model_str)-1); scsi_type = sysfs_attr_get_value(dev_scsi->devpath, "type"); if (!scsi_type) { - info("%s: cannot get SCSI type attribute", dev_scsi->kernel_name); + info("%s: cannot get SCSI type attribute", dev_scsi->kernel); goto fallback; } set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); scsi_rev = sysfs_attr_get_value(dev_scsi->devpath, "rev"); if (!scsi_rev) { - info("%s: cannot get SCSI revision attribute", dev_scsi->kernel_name); + info("%s: cannot get SCSI revision attribute", dev_scsi->kernel); goto fallback; } set_str(revision_str, scsi_rev, sizeof(revision_str)-1); diff --git a/test/udev-test.pl b/test/udev-test.pl index 63715ac093..c1c5302caf 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1075,13 +1075,13 @@ BUS=="scsi", KERNEL=="sda", NAME="should_not_match2", SUBSYSTEM=="vc" EOF }, { - desc => "DRIVER match test", + desc => "DRIVERS match test", subsys => "block", devpath => "/block/sda", exp_name => "node", rules => < - + - Match the name of the device. + Match the devpath of the event device. - + - Match the devpath of the device. + Match the name of the event device. - Match the subsystem of the device. + Match the subsystem of the event device. + + + + + + + Match sysfs attribute values of the event device. Up to five + keys can be specified per rule. Trailing + whitespace in the attribute values is ignored, if the specified match + value does not contain trailing whitespace itself. - + - Search the devpath upwards for a matching device subsystem name. + Search the devpath upwards for a matching device name. - + - Search the devpath upwards for a matching device driver name. + Search the devpath upwards for a matching device subsystem name. - + - Search the devpath upwards for a matching device name. + Search the devpath upwards for a matching device driver name. - + Search the devpath upwards for a device with matching sysfs attribute values. - Up to five keys can be specified per rule. All attributes + Up to five keys can be specified per rule. All attributes must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. @@ -378,13 +395,13 @@ , The name of the device matched while searching the devpath upwards for - , and . + , and . - , + , The value of a sysfs attribute found at the current or a parent device. diff --git a/udev_db.c b/udev_db.c index b058351d27..c3034f5037 100644 --- a/udev_db.c +++ b/udev_db.c @@ -81,7 +81,7 @@ int udev_db_add_device(struct udevice *udev) * create only a symlink with the name as the target * if we don't have any interesting data to remember */ - if (strcmp(udev->name, udev->dev->kernel_name) == 0 && + if (strcmp(udev->name, udev->dev->kernel) == 0 && list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && !udev->partitions && !udev->ignore_remove) { dbg("nothing interesting to store, create symlink"); diff --git a/udev_device.c b/udev_device.c index 87f90c7676..b680246bf8 100644 --- a/udev_device.c +++ b/udev_device.c @@ -87,7 +87,7 @@ static int rename_netif(struct udevice *udev) struct ifreq ifr; int retval; - info("changing net interface name from '%s' to '%s'", udev->dev->kernel_name, udev->name); + info("changing net interface name from '%s' to '%s'", udev->dev->kernel, udev->name); if (udev->test_run) return 0; @@ -98,7 +98,7 @@ static int rename_netif(struct udevice *udev) } memset(&ifr, 0x00, sizeof(struct ifreq)); - strlcpy(ifr.ifr_name, udev->dev->kernel_name, IFNAMSIZ); + strlcpy(ifr.ifr_name, udev->dev->kernel, IFNAMSIZ); strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) { @@ -111,7 +111,7 @@ static int rename_netif(struct udevice *udev) } /* free our own name, another process may wait for us */ - strlcpy(ifr.ifr_newname, udev->dev->kernel_name, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ); strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) { @@ -211,7 +211,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) } /* look if we want to change the name of the netif */ - if (strcmp(udev->name, udev->dev->kernel_name) != 0) { + if (strcmp(udev->name, udev->dev->kernel) != 0) { char *pos; retval = rename_netif(udev); @@ -220,14 +220,14 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) info("renamed netif to '%s'", udev->name); /* export old name */ - setenv("INTERFACE_OLD", udev->dev->kernel_name, 1); + setenv("INTERFACE_OLD", udev->dev->kernel, 1); /* now fake the devpath, because the kernel name changed silently */ pos = strrchr(udev->dev->devpath, '/'); if (pos != NULL) { pos[1] = '\0'; strlcat(udev->dev->devpath, udev->name, sizeof(udev->dev->devpath)); - strlcpy(udev->dev->kernel_name, udev->name, sizeof(udev->dev->kernel_name)); + strlcpy(udev->dev->kernel, udev->name, sizeof(udev->dev->kernel)); setenv("DEVPATH", udev->dev->devpath, 1); setenv("INTERFACE", udev->name, 1); } @@ -250,8 +250,8 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) list_for_each_entry(name_loop, &udev->env_list, node) putenv(name_loop->name); } else { - dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel_name); - strlcpy(udev->name, udev->dev->kernel_name, sizeof(udev->name)); + dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel); + strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); } udev_rules_get_run(rules, udev); diff --git a/udev_node.c b/udev_node.c index 12a738e4e2..4ba1c26c5e 100644 --- a/udev_node.c +++ b/udev_node.c @@ -51,7 +51,7 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m /* preserve node with already correct numbers, to prevent changing the inode number */ if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { info("preserve file '%s', because it has correct dev_t", file); - selinux_setfilecon(file, udev->dev->kernel_name, stats.st_mode); + selinux_setfilecon(file, udev->dev->kernel, stats.st_mode); goto perms; } @@ -61,7 +61,7 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m dbg("already present file '%s' unlinked", file); create: - selinux_setfscreatecon(file, udev->dev->kernel_name, mode); + selinux_setfscreatecon(file, udev->dev->kernel, mode); retval = mknod(file, mode, devt); selinux_resetfscreatecon(); if (retval != 0) { diff --git a/udev_rules.c b/udev_rules.c index 979b81d821..49306295ff 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -307,13 +307,13 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) enum subst_type { SUBST_UNKNOWN, SUBST_DEVPATH, + SUBST_KERNEL, SUBST_KERNEL_NUMBER, - SUBST_KERNEL_NAME, SUBST_ID, SUBST_MAJOR, SUBST_MINOR, SUBST_RESULT, - SUBST_SYSFS, + SUBST_ATTR, SUBST_PARENT, SUBST_TEMP_NODE, SUBST_ROOT, @@ -324,18 +324,19 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) char fmt; enum subst_type type; } map[] = { - { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, - { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, - { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL_NAME }, - { .name = "id", .fmt = 'b', .type = SUBST_ID }, - { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, - { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, - { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, - { .name = "sysfs", .fmt = 's', .type = SUBST_SYSFS }, - { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, - { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, - { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, - { .name = "env", .fmt = 'E', .type = SUBST_ENV }, + { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, + { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, + { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, + { .name = "id", .fmt = 'b', .type = SUBST_ID }, + { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, + { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, + { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, + { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, + { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, + { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, + { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, + { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, + { .name = "env", .fmt = 'E', .type = SUBST_ENV }, { NULL, '\0', 0 } }; enum subst_type type; @@ -399,9 +400,9 @@ found: strlcat(string, udev->dev->devpath, maxsize); dbg("substitute devpath '%s'", udev->dev->devpath); break; - case SUBST_KERNEL_NAME: - strlcat(string, udev->dev->kernel_name, maxsize); - dbg("substitute kernel name '%s'", udev->dev->kernel_name); + case SUBST_KERNEL: + strlcat(string, udev->dev->kernel, maxsize); + dbg("substitute kernel name '%s'", udev->dev->kernel); break; case SUBST_KERNEL_NUMBER: strlcat(string, udev->dev->kernel_number, maxsize); @@ -409,8 +410,8 @@ found: break; case SUBST_ID: if (udev->dev_parent != NULL) { - strlcat(string, udev->dev_parent->kernel_name, maxsize); - dbg("substitute id '%s'", udev->dev_parent->kernel_name); + strlcat(string, udev->dev_parent->kernel, maxsize); + dbg("substitute id '%s'", udev->dev_parent->kernel); } break; case SUBST_MAJOR: @@ -457,7 +458,7 @@ found: dbg("substitute result string '%s'", udev->program_result); } break; - case SUBST_SYSFS: + case SUBST_ATTR: if (attr == NULL) { dbg("missing attribute"); break; @@ -605,7 +606,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (match_key("ACTION", rule, &rule->action, udev->action)) goto nomatch; - if (match_key("KERNEL", rule, &rule->kernel_name, udev->dev->kernel_name)) + if (match_key("KERNEL", rule, &rule->kernel, udev->dev->kernel)) goto nomatch; if (match_key("SUBSYSTEM", rule, &rule->subsystem, udev->dev->subsystem)) @@ -614,7 +615,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (match_key("DEVPATH", rule, &rule->devpath, udev->dev->devpath)) goto nomatch; - /* compare NAME against a previously assigned value */ + if (match_key("DRIVER", rule, &rule->driver, udev->dev->driver)) + goto nomatch; + + /* match NAME against a value assigned by an earlier rule */ if (match_key("NAME", rule, &rule->name, udev->name)) goto nomatch; @@ -646,26 +650,57 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) } } + /* check for matching sysfs attrubute pairs */ + if (rule->attr.count) { + dbg("check %i ATTR keys", rule->attr.count); + for (i = 0; i < rule->attr.count; i++) { + struct key_pair *pair = &rule->attr.keys[i]; + const char *key_name = key_pair_name(rule, pair); + const char *key_value = key_val(rule, &pair->key); + const char *value; + char val[VALUE_SIZE]; + size_t len; + + value = sysfs_attr_get_value(udev->dev->devpath, key_name); + if (value == NULL) + goto nomatch; + strlcpy(val, value, sizeof(val)); + + /* strip trailing whitespace of value, if not asked to match for it */ + len = strlen(key_value); + if (len > 0 && !isspace(key_value[len-1])) { + len = strlen(val); + while (len > 0 && isspace(val[len-1])) + val[--len] = '\0'; + dbg("removed %zi trailing whitespace chars from '%s'", strlen(val)-len, val); + } + + if (match_key("ATTR", rule, &pair->key, val)) + goto nomatch; + } + dbg("all %i ATTR keys matched", rule->attr.count); + } + /* walk up the chain of parent devices and find a match */ udev->dev_parent = udev->dev; while (1) { - /* check for matching driver */ - if (match_key("DRIVER", rule, &rule->driver, udev->dev_parent->driver)) + /* check for matching kernel device name */ + if (match_key("KERNELS", rule, &rule->kernels, udev->dev_parent->kernel)) goto try_parent; - /* check for matching subsystem/bus value */ - if (match_key("BUS", rule, &rule->bus, udev->dev_parent->subsystem)) + /* check for matching subsystem value */ + if (match_key("SUBSYSTEMS", rule, &rule->subsystems, udev->dev_parent->subsystem)) goto try_parent; - /* check for matching bus id (device name) */ - if (match_key("ID", rule, &rule->id, udev->dev_parent->kernel_name)) + /* check for matching driver */ + if (match_key("DRIVERS", rule, &rule->drivers, udev->dev_parent->driver)) goto try_parent; - /* check for matching sysfs pairs */ - if (rule->sysfs.count) { - dbg("check %i SYSFS keys", rule->sysfs.count); - for (i = 0; i < rule->sysfs.count; i++) { - struct key_pair *pair = &rule->sysfs.keys[i]; + /* check for matching sysfs attrubute pairs */ + if (rule->attrs.count) { + dbg("check %i ATTRS keys", rule->attrs.count); + for (i = 0; i < rule->attrs.count; i++) { + struct key_pair *pair = &rule->attrs.keys[i]; const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); const char *value; @@ -688,10 +723,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) dbg("removed %zi trailing whitespace chars from '%s'", strlen(val)-len, val); } - if (match_key("SYSFS", rule, &pair->key, val)) + if (match_key("ATTRS", rule, &pair->key, val)) goto try_parent; } - dbg("all %i SYSFS keys matched", rule->sysfs.count); + dbg("all %i ATTRS keys matched", rule->attrs.count); } /* found matching device */ @@ -703,7 +738,7 @@ try_parent: if (udev->dev_parent == NULL) goto nomatch; dbg("looking at dev_parent->devpath='%s'", udev->dev_parent->devpath); - dbg("looking at dev_parent->bus_kernel_name='%s'", udev->dev_parent->kernel_name); + dbg("looking at dev_parent->kernel='%s'", udev->dev_parent->kernel); } /* execute external program */ @@ -794,7 +829,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) int name_set = 0; dbg("udev->dev->devpath='%s'", udev->dev->devpath); - dbg("udev->dev->kernel_name='%s'", udev->dev->kernel_name); + dbg("udev->dev->kernel='%s'", udev->dev->kernel); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -815,7 +850,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (match_rule(udev, rule) == 0) { /* apply options */ if (rule->ignore_device) { - info("rule applied, '%s' is ignored", udev->dev->kernel_name); + info("rule applied, '%s' is ignored", udev->dev->kernel); udev->ignore_device = 1; return 0; } @@ -835,21 +870,21 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (rule->mode_operation == KEY_OP_ASSIGN_FINAL) udev->mode_final = 1; udev->mode = rule->mode; - dbg("applied mode=%#o to '%s'", rule->mode, udev->dev->kernel_name); + dbg("applied mode=%#o to '%s'", rule->mode, udev->dev->kernel); } if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) udev->owner_final = 1; strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner)); udev_rules_apply_format(udev, udev->owner, sizeof(udev->owner)); - dbg("applied owner='%s' to '%s'", udev->owner, udev->dev->kernel_name); + dbg("applied owner='%s' to '%s'", udev->owner, udev->dev->kernel); } if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) { if (rule->group.operation == KEY_OP_ASSIGN_FINAL) udev->group_final = 1; strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); udev_rules_apply_format(udev, udev->group, sizeof(udev->group)); - dbg("applied group='%s' to '%s'", udev->group, udev->dev->kernel_name); + dbg("applied group='%s' to '%s'", udev->group, udev->dev->kernel); } /* collect symlinks */ @@ -904,7 +939,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (count) info("%i untrusted character(s) replaced", count); - info("rule applied, '%s' becomes '%s'", udev->dev->kernel_name, udev->name); + info("rule applied, '%s' becomes '%s'", udev->dev->kernel, udev->name); if (strcmp(udev->dev->subsystem, "net") != 0) dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", udev->name, udev->owner, udev->group, udev->mode, udev->partitions); @@ -934,7 +969,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) } if (!name_set) { - strlcpy(udev->name, udev->dev->kernel_name, sizeof(udev->name)); + strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); info("no node name set, will use kernel name '%s'", udev->name); } @@ -951,7 +986,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) { struct udev_rule *rule; - dbg("udev->kernel_name='%s'", udev->dev->kernel_name); + dbg("udev->kernel='%s'", udev->dev->kernel); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -969,7 +1004,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) if (match_rule(udev, rule) == 0) { if (rule->ignore_device) { - info("rule applied, '%s' is ignored", udev->dev->kernel_name); + info("rule applied, '%s' is ignored", udev->dev->kernel); udev->ignore_device = 1; return 0; } diff --git a/udev_rules.h b/udev_rules.h index 2c956fcccc..dac0dfcbb3 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -60,30 +60,34 @@ enum import_type { }; struct udev_rule { - struct key label; - struct key goto_label; - struct key kernel_name; - struct key subsystem; struct key action; struct key devpath; - struct key bus; - struct key id; + struct key kernel; + struct key subsystem; struct key driver; + struct key_pairs attr; + + struct key kernels; + struct key subsystems; + struct key drivers; + struct key_pairs attrs; + + struct key_pairs env; struct key program; struct key result; struct key import; enum import_type import_type; + struct key run; struct key wait_for_sysfs; - struct key_pairs sysfs; - struct key_pairs env; + struct key label; + struct key goto_label; struct key name; struct key symlink; - struct key run; struct key owner; struct key group; - enum key_operation mode_operation; mode_t mode; + enum key_operation mode_operation; unsigned int partitions; unsigned int last_rule:1, diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 8d69e74864..5e93e60d4f 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -263,14 +263,24 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (retval) break; - if (strcasecmp(key, "LABEL") == 0) { - add_rule_key(rule, &rule->label, operation, value); + if (strcasecmp(key, "ACTION") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid ACTION operation"); + goto invalid; + } + add_rule_key(rule, &rule->action, operation, value); valid = 1; continue; } - if (strcasecmp(key, "GOTO") == 0) { - add_rule_key(rule, &rule->goto_label, operation, value); + if (strcasecmp(key, "DEVPATH") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid DEVPATH operation"); + goto invalid; + } + add_rule_key(rule, &rule->devpath, operation, value); valid = 1; continue; } @@ -281,7 +291,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena err("invalid KERNEL operation"); goto invalid; } - add_rule_key(rule, &rule->kernel_name, operation, value); + add_rule_key(rule, &rule->kernel, operation, value); valid = 1; continue; } @@ -297,68 +307,84 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strcasecmp(key, "ACTION") == 0) { + if (strcasecmp(key, "DRIVER") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid ACTION operation"); + err("invalid DRIVER operation"); goto invalid; } - add_rule_key(rule, &rule->action, operation, value); + err("DRIVER== will change in a future relase, " + "please use DRIVERS== in %s:%u", filename, lineno); + /* FIXME: this should be rule->driver to match only the event device */ + add_rule_key(rule, &rule->drivers, operation, value); valid = 1; continue; } - if (strcasecmp(key, "DEVPATH") == 0) { + if (strncasecmp(key, "ATTR", sizeof("ATTR")-1) == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DEVPATH operation"); + err("invalid ATTR operation"); goto invalid; } - add_rule_key(rule, &rule->devpath, operation, value); + attr = get_key_attribute(key + sizeof("ATTR")-1); + if (attr == NULL) { + err("error parsing ATTR attribute in '%s'", line); + continue; + } + add_rule_key_pair(rule, &rule->attr, operation, attr, value); valid = 1; continue; } - if (strcasecmp(key, "BUS") == 0) { + if (strcasecmp(key, "KERNELS") == 0 || + strcasecmp(key, "ID") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid BUS operation"); + err("invalid KERNELS operation"); goto invalid; } - add_rule_key(rule, &rule->bus, operation, value); + add_rule_key(rule, &rule->kernels, operation, value); valid = 1; continue; } - if (strcasecmp(key, "ID") == 0) { + if (strcasecmp(key, "SUBSYTEMS") == 0 || + strcasecmp(key, "BUS") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid ID operation"); + err("invalid SUBSYSTEMS operation"); goto invalid; } - add_rule_key(rule, &rule->id, operation, value); + add_rule_key(rule, &rule->subsystems, operation, value); valid = 1; continue; } - if (strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) { + if (strcasecmp(key, "DRIVERS") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid SYSFS operation"); + err("invalid DRIVERS operation"); goto invalid; } - attr = get_key_attribute(key + sizeof("SYSFS")-1); - if (attr == NULL) { - err("error parsing SYSFS attribute in '%s'", line); - continue; - } - add_rule_key_pair(rule, &rule->sysfs, operation, attr, value); + add_rule_key(rule, &rule->drivers, operation, value); valid = 1; continue; } - if (strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { - add_rule_key(rule, &rule->wait_for_sysfs, operation, value); + if (strncasecmp(key, "ATTRS", sizeof("ATTRS")-1) == 0 || + strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid ATTRSS operation"); + goto invalid; + } + attr = get_key_attribute(key + sizeof("ATTRS")-1); + if (attr == NULL) { + err("error parsing ATTRS attribute in '%s'", line); + continue; + } + add_rule_key_pair(rule, &rule->attrs, operation, attr, value); valid = 1; continue; } @@ -374,6 +400,23 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } + if (strcasecmp(key, "PROGRAM") == 0) { + add_rule_key(rule, &rule->program, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "RESULT") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid RESULT operation"); + goto invalid; + } + add_rule_key(rule, &rule->result, operation, value); + valid = 1; + continue; + } + if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { attr = get_key_attribute(key + sizeof("IMPORT")-1); if (attr && strstr(attr, "program")) { @@ -419,30 +462,26 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strcasecmp(key, "DRIVER") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid DRIVER operation"); - goto invalid; - } - add_rule_key(rule, &rule->driver, operation, value); + if (strcasecmp(key, "RUN") == 0) { + add_rule_key(rule, &rule->run, operation, value); valid = 1; continue; } - if (strcasecmp(key, "RESULT") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid RESULT operation"); - goto invalid; - } - add_rule_key(rule, &rule->result, operation, value); + if (strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { + add_rule_key(rule, &rule->wait_for_sysfs, operation, value); valid = 1; continue; } - if (strcasecmp(key, "PROGRAM") == 0) { - add_rule_key(rule, &rule->program, operation, value); + if (strcasecmp(key, "LABEL") == 0) { + add_rule_key(rule, &rule->label, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "GOTO") == 0) { + add_rule_key(rule, &rule->goto_label, operation, value); valid = 1; continue; } @@ -516,12 +555,6 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strcasecmp(key, "RUN") == 0) { - add_rule_key(rule, &rule->run, operation, value); - valid = 1; - continue; - } - if (strcasecmp(key, "OPTIONS") == 0) { if (strstr(value, "last_rule") != NULL) { dbg("last rule to be applied"); diff --git a/udev_sysfs.c b/udev_sysfs.c index 85ea4d15e9..c4afe0cffb 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -95,11 +95,11 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, if (pos == NULL) return; - strlcpy(dev->kernel_name, &pos[1], sizeof(dev->kernel_name)); - dbg("kernel_name='%s'", dev->kernel_name); + strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); + dbg("kernel='%s'", dev->kernel); /* some devices have '!' in their name, change that to '/' */ - pos = dev->kernel_name; + pos = dev->kernel; while (pos[0] != '\0') { if (pos[0] == '!') pos[0] = '/'; @@ -107,7 +107,7 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, } /* get kernel number */ - pos = &dev->kernel_name[strlen(dev->kernel_name)]; + pos = &dev->kernel[strlen(dev->kernel)]; while (isdigit(pos[-1])) pos--; strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); diff --git a/udevinfo.c b/udevinfo.c index 1a10f9ad07..d6f564079f 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -45,7 +45,7 @@ void log_message (int priority, const char *format, ...) } #endif -static void print_all_attributes(const char *devpath) +static void print_all_attributes(const char *devpath, const char *key) { char path[PATH_SIZE]; DIR *dir; @@ -80,7 +80,7 @@ static void print_all_attributes(const char *devpath) } replace_untrusted_chars(value); - printf(" SYSFS{%s}==\"%s\"\n", dent->d_name, value); + printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); } } printf("\n"); @@ -103,10 +103,10 @@ static int print_device_chain(const char *devpath) return -1; printf(" looking at device '%s':\n", dev->devpath); - printf(" KERNEL==\"%s\"\n", dev->kernel_name); + printf(" KERNEL==\"%s\"\n", dev->kernel); printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); printf(" DRIVER==\"%s\"\n", dev->driver); - print_all_attributes(dev->devpath); + print_all_attributes(dev->devpath, "ATTR"); /* walk up the chain of devices */ while (1) { @@ -114,11 +114,11 @@ static int print_device_chain(const char *devpath) if (dev == NULL) break; printf(" looking at parent device '%s':\n", dev->devpath); - printf(" ID==\"%s\"\n", dev->kernel_name); - printf(" BUS==\"%s\"\n", dev->subsystem); - printf(" DRIVER==\"%s\"\n", dev->driver); + printf(" KERNELS==\"%s\"\n", dev->kernel); + printf(" SUBSYTEMS==\"%s\"\n", dev->subsystem); + printf(" DRIVERS==\"%s\"\n", dev->driver); - print_all_attributes(dev->devpath); + print_all_attributes(dev->devpath, "ATTRS"); } return 0; -- cgit v1.2.3-54-g00ecf From 38895e573c6f17014393dc35a9e53d5f016172c3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:15:29 +0200 Subject: skip rule, if too may keys of the same type are used --- test/udev-test.pl | 2 +- udev_rules_parse.c | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index c1c5302caf..c7662326ea 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -79,7 +79,7 @@ EOF devpath => "/block/sda/sda1", exp_name => "boot_disk1" , rules => <attr, operation, attr, value); + if (add_rule_key_pair(rule, &rule->attr, operation, attr, value) != 0) + goto invalid; valid = 1; continue; } @@ -381,10 +382,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } attr = get_key_attribute(key + sizeof("ATTRS")-1); if (attr == NULL) { - err("error parsing ATTRS attribute in '%s'", line); - continue; + err("error parsing ATTRS attribute"); + goto invalid; } - add_rule_key_pair(rule, &rule->attrs, operation, attr, value); + if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0) + goto invalid; valid = 1; continue; } @@ -393,9 +395,10 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena attr = get_key_attribute(key + sizeof("ENV")-1); if (attr == NULL) { err("error parsing ENV attribute"); - continue; + goto invalid; } - add_rule_key_pair(rule, &rule->env, operation, attr, value); + if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0) + goto invalid; valid = 1; continue; } -- cgit v1.2.3-54-g00ecf From d0c8cb7d9c6e610a9f5ed840d023362c25413d7e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:16:27 +0200 Subject: introduce ATTR{file}="value" to set sysfs attributes --- udev_rules.c | 50 ++++++++++++++++++++++++++++++++++++-------------- udev_rules_parse.c | 12 +----------- 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 49306295ff..d9e1d89e6c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -644,17 +644,16 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) int found; found = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0); - if (!found && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) { - dbg("WAIT_FOR_SYSFS failed"); + if (!found && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) goto nomatch; - } } - /* check for matching sysfs attrubute pairs */ - if (rule->attr.count) { - dbg("check %i ATTR keys", rule->attr.count); - for (i = 0; i < rule->attr.count; i++) { - struct key_pair *pair = &rule->attr.keys[i]; + /* check for matching sysfs attribute pairs */ + for (i = 0; i < rule->attr.count; i++) { + struct key_pair *pair = &rule->attr.keys[i]; + + if (pair->key.operation == KEY_OP_MATCH || + pair->key.operation == KEY_OP_NOMATCH) { const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); const char *value; @@ -678,7 +677,6 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (match_key("ATTR", rule, &pair->key, val)) goto nomatch; } - dbg("all %i ATTR keys matched", rule->attr.count); } /* walk up the chain of parent devices and find a match */ @@ -697,10 +695,11 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) goto try_parent; /* check for matching sysfs attrubute pairs */ - if (rule->attrs.count) { - dbg("check %i ATTRS keys", rule->attrs.count); - for (i = 0; i < rule->attrs.count; i++) { - struct key_pair *pair = &rule->attrs.keys[i]; + for (i = 0; i < rule->attrs.count; i++) { + struct key_pair *pair = &rule->attrs.keys[i]; + + if (pair->key.operation == KEY_OP_MATCH || + pair->key.operation == KEY_OP_NOMATCH) { const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); const char *value; @@ -726,7 +725,6 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (match_key("ATTRS", rule, &pair->key, val)) goto try_parent; } - dbg("all %i ATTRS keys matched", rule->attrs.count); } /* found matching device */ @@ -817,6 +815,30 @@ try_parent: } } + /* if we have ATTR assignements write value to sysfs file */ + for (i = 0; i < rule->attr.count; i++) { + struct key_pair *pair = &rule->attr.keys[i]; + + if (pair->key.operation == KEY_OP_ASSIGN) { + const char *key_name = key_pair_name(rule, pair); + const char *key_value = key_val(rule, &pair->key); + char attr[PATH_SIZE]; + FILE *f; + + strlcpy(attr, sysfs_path, sizeof(attr)); + strlcat(attr, udev->dev->devpath, sizeof(attr)); + strlcat(attr, "/", sizeof(attr)); + strlcat(attr, key_name, sizeof(attr)); + dbg("write '%s' to '%s'", key_value, attr); + f = fopen(attr, "w"); + if (f != NULL) { + if (fprintf(f, "%s\n", key_value) <= 0) + err("error writing ATTR{%s}: %s", attr, strerror(errno)); + fclose(f); + } else + err("error opening ATTR{%s} for writing: %s", attr, strerror(errno)); + } + } return 0; nomatch: diff --git a/udev_rules_parse.c b/udev_rules_parse.c index d527bf4bad..ecb6a7be31 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -219,7 +219,7 @@ static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs, size_t key_len = strnlen(key, PATH_SIZE); if (pairs->count >= PAIRS_MAX) { - err("skip, too many keys in a single rule"); + err("skip, too many keys of the same type in a single rule"); return -1; } @@ -322,11 +322,6 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strncasecmp(key, "ATTR", sizeof("ATTR")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid ATTR operation"); - goto invalid; - } attr = get_key_attribute(key + sizeof("ATTR")-1); if (attr == NULL) { err("error parsing ATTR attribute"); @@ -375,11 +370,6 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "ATTRS", sizeof("ATTRS")-1) == 0 || strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid ATTRSS operation"); - goto invalid; - } attr = get_key_attribute(key + sizeof("ATTRS")-1); if (attr == NULL) { err("error parsing ATTRS attribute"); -- cgit v1.2.3-54-g00ecf From a990821d93889cf087f150b0b8d03b1f7b8e3682 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:17:58 +0200 Subject: update SUSE rules --- etc/udev/suse/50-udev-default.rules | 22 +++++++++++----------- etc/udev/suse/60-persistent-input.rules | 16 ++++++++-------- etc/udev/suse/60-persistent-storage.rules | 8 ++++---- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 309e4031c5..bbbcc7f585 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -15,8 +15,8 @@ KERNEL=="ircomm*", GROUP="uucp" KERNEL=="modems/mwave*", GROUP="uucp" KERNEL=="hvc*|hvsi*", GROUP="uucp" KERNEL=="iseries/vtty*", GROUP="uucp" -KERNEL=="ttyUSB*", SYSFS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" -KERNEL=="ttyUSB*", SYSFS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" +KERNEL=="ttyUSB*", ATTRS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" +KERNEL=="ttyUSB*", ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" # video/graphics SUBSYSTEM=="video4linux", GROUP="video" @@ -95,7 +95,7 @@ KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" # fix floppy devices KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" -KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{cmos} -m %M /dev/%k" +KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M $root/%k" KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/rm -f $root/%k*" # block devices @@ -104,15 +104,15 @@ SUBSYSTEM=="block", GROUP="disk", MODE="0640" # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC # sr: 4 TYPE_WORM, 5 TYPE_ROM # st/osst: 1 TYPE_TAPE -SUBSYSTEM=="scsi", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" -SUBSYSTEM=="scsi", ACTION=="add", SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" +SUBSYSTEM=="scsi", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" +SUBSYSTEM=="scsi_device", ACTION=="add", ATTR{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", ATTR{type}=="1", ATTR{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", ATTR{type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", ATTR{type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" -KERNEL=="hd*", BUS=="ide", SYSFS{media}=="floppy", OPTIONS+="all_partitions" -SUBSYSTEM=="ide", ACTION=="add", SYSFS{media}=="tape", RUN+="/sbin/modprobe ide-scsi" +KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" +SUBSYSTEM=="ide", ACTION=="add", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" # misc storage devices (non-block) KERNEL=="sg*", GROUP="disk", MODE="640" diff --git a/etc/udev/suse/60-persistent-input.rules b/etc/udev/suse/60-persistent-input.rules index 21f23f71c2..4bc034ce1a 100644 --- a/etc/udev/suse/60-persistent-input.rules +++ b/etc/udev/suse/60-persistent-input.rules @@ -3,16 +3,16 @@ SUBSYSTEM!="input", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" # usb devices -BUS=="usb", IMPORT{program}="usb_id -x" -BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" -BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" +SUBSYSTEMS=="usb", IMPORT{program}="usb_id -x" +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" # other devices -DRIVER=="pcspkr", ENV{ID_CLASS}="spkr" -DRIVER=="atkbd", ENV{ID_CLASS}="kbd" -DRIVER=="psmouse", ENV{ID_CLASS}="mouse" -SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" -SYSFS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", SYSFS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" +DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" +DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index f24b999a4a..da433cb565 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -8,8 +8,8 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end" KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" # never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" +KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", ATTRS{../removable}=="1", GOTO="persistent_storage_end" # for partitions import parent information KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" @@ -19,7 +19,7 @@ KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" @@ -35,7 +35,7 @@ KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" +KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -- cgit v1.2.3-54-g00ecf From 775f5e35871b665f9cf95698928377c49e3b13fa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:18:24 +0200 Subject: update default rules --- etc/udev/rules.d/60-persistent-input.rules | 16 ++++++++-------- etc/udev/rules.d/60-persistent-storage.rules | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules index 21f23f71c2..4bc034ce1a 100644 --- a/etc/udev/rules.d/60-persistent-input.rules +++ b/etc/udev/rules.d/60-persistent-input.rules @@ -3,16 +3,16 @@ SUBSYSTEM!="input", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" # usb devices -BUS=="usb", IMPORT{program}="usb_id -x" -BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" -BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" +SUBSYSTEMS=="usb", IMPORT{program}="usb_id -x" +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" # other devices -DRIVER=="pcspkr", ENV{ID_CLASS}="spkr" -DRIVER=="atkbd", ENV{ID_CLASS}="kbd" -DRIVER=="psmouse", ENV{ID_CLASS}="mouse" -SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" -SYSFS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", SYSFS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" +DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" +DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index f24b999a4a..da433cb565 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -8,8 +8,8 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end" KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" # never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" +KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", ATTRS{../removable}=="1", GOTO="persistent_storage_end" # for partitions import parent information KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" @@ -19,7 +19,7 @@ KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" @@ -35,7 +35,7 @@ KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" +KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -- cgit v1.2.3-54-g00ecf From 220dac4c5eb3d82b5473c7532eb731df184e11f7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:19:08 +0200 Subject: export DRIVER for older kernels as a replacement for PHYSDEVDRIVER --- udevd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/udevd.c b/udevd.c index bec4e3d7b4..3da56ca294 100644 --- a/udevd.c +++ b/udevd.c @@ -566,6 +566,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz int bufpos; int i; struct udevd_uevent_msg *msg; + char *physdevdriver_key = NULL; int major = 0; int minor = 0; @@ -600,6 +601,8 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz msg->seqnum = strtoull(&key[7], NULL, 10); else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) msg->physdevpath = &key[12]; + else if (strncmp(key, "PHYSDEVDRIVER=", 14) == 0) + physdevdriver_key = key; else if (strncmp(key, "MAJOR=", 6) == 0) major = strtoull(&key[6], NULL, 10); else if (strncmp(key, "MINOR=", 6) == 0) @@ -609,6 +612,13 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz } msg->devt = makedev(major, minor); msg->envp[i++] = "UDEVD_EVENT=1"; + + if (msg->driver == NULL && msg->physdevpath == NULL && physdevdriver_key != NULL) { + /* for older kernels DRIVER is empty for a bus device, export PHYSDEVDRIVER as DRIVER */ + msg->envp[i++] = &physdevdriver_key[7]; + msg->driver = &physdevdriver_key[14]; + } + msg->envp[i] = NULL; if (msg->devpath == NULL || msg->action == NULL) { -- cgit v1.2.3-54-g00ecf From c472055c900014849fff93a1de551c42561c21c9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:20:55 +0200 Subject: fix typo in SUBSYSTEMS key parsing --- udev_rules_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index ecb6a7be31..b9456b5fb0 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -345,7 +345,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strcasecmp(key, "SUBSYTEMS") == 0 || + if (strcasecmp(key, "SUBSYSTEMS") == 0 || strcasecmp(key, "BUS") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { -- cgit v1.2.3-54-g00ecf From 3770f6093f89198151ca872c2115aff0b6079772 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Sun, 20 Aug 2006 18:21:50 +0200 Subject: fix 'unknow user' error from getpwnam/getgrnam --- udev_sysdeps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_sysdeps.c b/udev_sysdeps.c index c0b2d70b6e..9ec5a73ed9 100644 --- a/udev_sysdeps.c +++ b/udev_sysdeps.c @@ -99,7 +99,7 @@ uid_t lookup_user(const char *user) pw = getpwnam(user); if (pw == NULL) { - if (errno == 0) + if (errno == 0 || errno == ENOENT || errno == ESRCH) err("specified user unknown '%s'", user); else err("error resolving user '%s': %s", user, strerror(errno)); @@ -116,7 +116,7 @@ gid_t lookup_group(const char *group) gr = getgrnam(group); if (gr == NULL) { - if (errno == 0) + if (errno == 0 || errno == ENOENT || errno == ESRCH) err("specified group unknown '%s'", group); else err("error resolving group '%s': %s", group, strerror(errno)); -- cgit v1.2.3-54-g00ecf From 04cc3a81d02af4d131b9c92defd7538f22089774 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:22:44 +0200 Subject: udevtrigger: add --retry-failed --- udevtrigger.8 | 9 +++++--- udevtrigger.c | 72 ++++++++++++++++++++++++++++++++++++++++++++------------- udevtrigger.xml | 11 +++++++-- 3 files changed, 71 insertions(+), 21 deletions(-) diff --git a/udevtrigger.8 b/udevtrigger.8 index de31f2e745..1e14a7b101 100644 --- a/udevtrigger.8 +++ b/udevtrigger.8 @@ -14,17 +14,20 @@ udevtrigger \- request kernel devices events for coldplug .SH "SYNOPSIS" .HP 12 -\fBudevtrigger\fR [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] +\fBudevtrigger\fR [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] [\fB\-\-retry\-failed\fR] .SH "DESCRIPTION" .PP Trigger kernel device uevents to replay missing events at system coldplug. .SH "OPTIONS" .TP 3n \fB\-\-verbose\fR -print out the devices found in sysfs. +Print the list of devices found in sysfs. .TP 3n \fB\-\-dry\-run\fR -don't actually trigger the event. +Do not actually trigger the event. +.TP 3n +\fB\-\-retry\-failed\fR +Trigger events which are failed during a previous run. .SH "ENVIRONMENT" .TP 3n \fBUDEV_LOG\fR diff --git a/udevtrigger.c b/udevtrigger.c index 2d5772fd6b..9345a06ab7 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -32,8 +32,8 @@ #include #include "udev.h" +#include "udevd.h" -static const char *udev_log_str; static int verbose; static int dry_run; @@ -166,7 +166,7 @@ static int is_device(const char *path) return 1; } -static void udev_scan_bus(void) +static void scan_bus(void) { char base[PATH_SIZE]; DIR *dir; @@ -213,7 +213,7 @@ static void udev_scan_bus(void) } } -static void udev_scan_block(void) +static void scan_block(void) { char base[PATH_SIZE]; DIR *dir; @@ -272,7 +272,7 @@ static void udev_scan_block(void) } } -static void udev_scan_class(void) +static void scan_class(void) { char base[PATH_SIZE]; DIR *dir; @@ -318,6 +318,44 @@ static void udev_scan_class(void) } } +static void scan_failed(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(base, udev_root, sizeof(base)); + strlcat(base, "/", sizeof(base)); + strlcat(base, EVENT_FAILED_DIR, sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char linkname[PATH_SIZE]; + char target[PATH_SIZE]; + int len; + + if (dent->d_name[0] == '.') + continue; + + strlcpy(linkname, base, sizeof(linkname)); + strlcat(linkname, "/", sizeof(linkname)); + strlcat(linkname, dent->d_name, sizeof(linkname)); + + len = readlink(linkname, target, sizeof(target)); + if (len <= 0) + continue; + target[len] = '\0'; + + if (is_device(target)) + device_list_insert(target); + else + continue; + } + closedir(dir); + } +} + int main(int argc, char *argv[], char *envp[]) { int i; @@ -325,31 +363,33 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevtrigger"); udev_config_init(); dbg("version %s", UDEV_VERSION); - - udev_log_str = getenv("UDEV_LOG"); + sysfs_init(); for (i = 1 ; i < argc; i++) { char *arg = argv[i]; - if (strcmp(arg, "--verbose") == 0 || strcmp(arg, "-v") == 0) + if (strcmp(arg, "--verbose") == 0 || strcmp(arg, "-v") == 0) { verbose = 1; - else if (strcmp(arg, "--dry-run") == 0 || strcmp(arg, "-n") == 0) + } else if (strcmp(arg, "--dry-run") == 0 || strcmp(arg, "-n") == 0) { dry_run = 1; - else { - fprintf(stderr, "Usage: udevtrigger [--verbose] [--dry-run]\n"); + } else if (strcmp(arg, "--retry-failed") == 0 || strcmp(arg, "-F") == 0) { + scan_failed(); + exec_lists(); + goto exit; + } else { + fprintf(stderr, "Usage: udevtrigger [--verbose] [--dry-run] [--retry-failed]\n"); goto exit; } } - sysfs_init(); - - udev_scan_bus(); - udev_scan_class(); - udev_scan_block(); + /* default action */ + scan_bus(); + scan_class(); + scan_block(); exec_lists(); - sysfs_cleanup(); exit: + sysfs_cleanup(); logging_close(); return 0; } diff --git a/udevtrigger.xml b/udevtrigger.xml index 990cf63589..170fcd6291 100644 --- a/udevtrigger.xml +++ b/udevtrigger.xml @@ -27,6 +27,7 @@ udevtrigger + @@ -39,13 +40,19 @@ - print out the devices found in sysfs. + Print the list of devices found in sysfs. - don't actually trigger the event. + Do not actually trigger the event. + + + + + + Trigger events which are failed during a previous run. -- cgit v1.2.3-54-g00ecf From 708cb3594139f28f7d99b4ea1cf91b4ccd032273 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:23:48 +0200 Subject: volume_id: add suspend partition detection Based on a patch from: Scott James Remnant --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/linux_swap.c | 38 ++++++++++++++++++++++++++------------ extras/volume_id/vol_id.c | 5 ++--- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index e93f8b5af5..02be060a62 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 70 +SHLIB_REV = 71 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 21cb2bce8c..8aca564d72 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -26,14 +26,14 @@ #include "libvolume_id.h" #include "util.h" -static struct swap_header_v1_2 { +struct swap_header_v1_2 { uint8_t bootbits[1024]; uint32_t version; uint32_t last_page; uint32_t nr_badpages; uint8_t uuid[16]; uint8_t volume_name[16]; -} PACKED *sw; +} PACKED; #define LARGEST_PAGESIZE 0x4000 @@ -41,10 +41,11 @@ int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size { const uint8_t *buf; unsigned int page; + struct swap_header_v1_2 *sw; info("probing at offset 0x%llx", (unsigned long long) off); - /* the swap signature is at the end of the PAGE_SIZE */ + /* eek, the swap signature is at the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { buf = volume_id_get_buffer(id, off + page-10, 10); if (buf == NULL) @@ -56,21 +57,34 @@ int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size } if (memcmp(buf, "SWAPSPACE2", 10) == 0) { - sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); - if (sw == NULL) - return -1; + id->type = "swap"; strcpy(id->type_version, "2"); - volume_id_set_label_raw(id, sw->volume_name, 16); - volume_id_set_label_string(id, sw->volume_name, 16); - volume_id_set_uuid(id, sw->uuid, UUID_DCE); - goto found; + goto found_label; + } + + if (memcmp(buf, "S1SUSPEND", 9) == 0) { + id->type = "suspend"; + strcpy(id->type_version, "s1suspend"); + goto found_label; + } + + if (memcmp(buf, "ULSUSPEND", 9) == 0) { + id->type = "suspend"; + strcpy(id->type_version, "ulsuspend"); + goto found_label; } } return -1; +found_label: + sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); + if (sw != NULL) { + volume_id_set_label_raw(id, sw->volume_name, 16); + volume_id_set_label_string(id, sw->volume_name, 16); + volume_id_set_uuid(id, sw->uuid, UUID_DCE); + } + found: volume_id_set_usage(id, VOLUME_ID_OTHER); - id->type = "swap"; - return 0; } diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 96ccaf3637..7bdfda17e7 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -291,15 +291,14 @@ int main(int argc, char *argv[]) printf("%s\n", vid->type); break; case PRINT_LABEL: - if (name[0] == '\0' || - (vid->usage_id != VOLUME_ID_FILESYSTEM && vid->usage_id != VOLUME_ID_DISKLABEL)) { + if (name[0] == '\0' || vid->usage_id == VOLUME_ID_RAID) { rc = 3; goto exit; } printf("%s\n", name); break; case PRINT_UUID: - if (vid->uuid[0] == '\0' || vid->usage_id != VOLUME_ID_FILESYSTEM) { + if (vid->uuid[0] == '\0' || vid->usage_id == VOLUME_ID_RAID) { rc = 4; goto exit; } -- cgit v1.2.3-54-g00ecf From 5c51e31e0e794d8fcdc1225c65985571c9820949 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:24:34 +0200 Subject: vol_id: use primary group of 'nobody' instead of 'nogroup' This fixes a Fedora issue not having the group 'nogroup'. --- extras/volume_id/vol_id.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 7bdfda17e7..0a1b756fa3 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include @@ -131,8 +133,7 @@ int main(int argc, char *argv[]) int skip_raid = 0; int probe_all = 0; const char *node = NULL; - uid_t nobody_uid; - gid_t nobody_gid; + struct passwd *pw; int retval; int rc = 0; @@ -180,13 +181,14 @@ int main(int argc, char *argv[]) size = 0; dbg("BLKGETSIZE64=%llu", size); - /* drop all privileges */ - nobody_uid = lookup_user("nobody"); - nobody_gid = lookup_group("nogroup"); - if (nobody_uid > 0 && nobody_gid > 0) { + /* try to drop all privileges before reading disk content */ + pw = getpwnam ("nobody"); + if (pw != NULL && pw->pw_uid > 0 && pw->pw_gid > 0) { + dbg("dropping privileges to %u:%u", (unsigned int)pw->pw_uid, (unsigned int)pw->pw_gid); if (setgroups(0, NULL) != 0 || - setgid(nobody_gid) != 0 || - setuid(nobody_uid) != 0) { + setgid(pw->pw_gid) != 0 || + setuid(pw->pw_uid) != 0) { + fprintf(stderr, "error dropping privileges: %s\n", strerror(errno)); rc = 3; goto exit; } -- cgit v1.2.3-54-g00ecf From 3a020a85da768808a03f1574b001d1d06d55ae07 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 18:25:57 +0200 Subject: remove built-in /etc/passwd /etc/group parser --- udev.h | 2 + udev_sysdeps.c | 139 +-------------------------------------------------------- udev_sysdeps.h | 3 -- udev_utils.c | 40 +++++++++++++++++ 4 files changed, 43 insertions(+), 141 deletions(-) diff --git a/udev.h b/udev.h index d681ad5613..0377a8a65b 100644 --- a/udev.h +++ b/udev.h @@ -139,6 +139,8 @@ extern char *name_list_add(struct list_head *name_list, const char *name, int so extern char *name_list_key_add(struct list_head *name_list, const char *key, const char *value); extern void name_list_cleanup(struct list_head *name_list); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); +extern uid_t lookup_user(const char *user); +extern gid_t lookup_group(const char *group); /* udev_utils_string.c */ extern int strcmp_pattern(const char *p, const char *s); diff --git a/udev_sysdeps.c b/udev_sysdeps.c index 9ec5a73ed9..3cd12277cf 100644 --- a/udev_sysdeps.c +++ b/udev_sysdeps.c @@ -29,19 +29,7 @@ #include "udev.h" -#ifndef __GLIBC__ -#define __OWN_USERDB_PARSER__ -#endif - #ifdef __GLIBC__ -#define __OWN_STRLCPYCAT__ -#endif - -#ifdef USE_STATIC -#define __OWN_USERDB_PARSER__ -#endif - -#ifdef __OWN_STRLCPYCAT__ size_t strlcpy(char *dst, const char *src, size_t size) { size_t bytes = 0; @@ -85,129 +73,4 @@ size_t strlcat(char *dst, const char *src, size_t size) *q = '\0'; return bytes; } -#endif /* __OWN_STRLCPYCAT__ */ - -#ifndef __OWN_USERDB_PARSER__ -#include -#include -#include - -uid_t lookup_user(const char *user) -{ - struct passwd *pw; - uid_t uid = 0; - - pw = getpwnam(user); - if (pw == NULL) { - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified user unknown '%s'", user); - else - err("error resolving user '%s': %s", user, strerror(errno)); - } else - uid = pw->pw_uid; - - return uid; -} - -gid_t lookup_group(const char *group) -{ - struct group *gr; - gid_t gid = 0; - - gr = getgrnam(group); - if (gr == NULL) { - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified group unknown '%s'", group); - else - err("error resolving group '%s': %s", group, strerror(errno)); - } else - gid = gr->gr_gid; - - return gid; -} - -#else /* __OWN_USERDB_PARSER__ */ - -#define PASSWD_FILE "/etc/passwd" -#define GROUP_FILE "/etc/group" - -/* return the id of a passwd style line, selected by the users name */ -static unsigned long get_id_by_name(const char *uname, const char *dbfile) -{ - unsigned long id = 0; - char line[LINE_SIZE]; - char *buf; - char *bufline; - size_t bufsize; - size_t cur; - size_t count; - char *pos; - char *name; - char *idstr; - char *tail; - - if (file_map(dbfile, &buf, &bufsize) != 0) { - err("can't open '%s' as db file: %s", dbfile, strerror(errno)); - return 0; - } - dbg("search '%s' in '%s'", uname, dbfile); - - /* loop through the whole file */ - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - - if (count >= sizeof(line)) - continue; - - memcpy(line, bufline, count-1); - line[count-1] = '\0'; - pos = line; - - /* get name */ - name = strsep(&pos, ":"); - if (name == NULL) - continue; - - /* skip pass */ - if (strsep(&pos, ":") == NULL) - continue; - - /* get id */ - idstr = strsep(&pos, ":"); - if (idstr == NULL) - continue; - - if (strcmp(uname, name) == 0) { - id = strtoul(idstr, &tail, 10); - if (tail[0] != '\0') { - id = 0; - dbg("no id found for '%s'", name); - } else - dbg("id for '%s' is '%li'", name, id); - break; - } - } - - file_unmap(buf, bufsize); - return id; -} - -uid_t lookup_user(const char *user) -{ - unsigned long id; - - id = get_id_by_name(user, PASSWD_FILE); - return (uid_t) id; -} - -gid_t lookup_group(const char *group) -{ - unsigned long id; - - id = get_id_by_name(group, GROUP_FILE); - return (gid_t) id; -} -#endif /* __OWN_USERDB_PARSER__ */ +#endif /* __GLIBC__ */ diff --git a/udev_sysdeps.h b/udev_sysdeps.h index 530218f7b9..36c86f3356 100644 --- a/udev_sysdeps.h +++ b/udev_sysdeps.h @@ -162,9 +162,6 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) #endif #endif -extern uid_t lookup_user(const char *user); -extern gid_t lookup_group(const char *group); - extern size_t strlcpy(char *dst, const char *src, size_t size); extern size_t strlcat(char *dst, const char *src, size_t size); diff --git a/udev_utils.c b/udev_utils.c index 003d7bded9..b198892c01 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -28,6 +28,9 @@ #include #include #include +#include +#include +#include #include #include "udev.h" @@ -161,3 +164,40 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c closedir(dir); return 0; } + +uid_t lookup_user(const char *user) +{ + struct passwd *pw; + uid_t uid = 0; + + errno = 0; + pw = getpwnam(user); + if (pw == NULL) { + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err("specified user unknown '%s'", user); + else + err("error resolving user '%s': %s", user, strerror(errno)); + } else + uid = pw->pw_uid; + + return uid; +} + +extern gid_t lookup_group(const char *group) +{ + struct group *gr; + gid_t gid = 0; + + errno = 0; + gr = getgrnam(group); + if (gr == NULL) { + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err("specified group unknown '%s'", group); + else + err("error resolving group '%s': %s", group, strerror(errno)); + } else + gid = gr->gr_gid; + + return gid; +} + -- cgit v1.2.3-54-g00ecf From 8bb39322f092fde89bf1082f51715a2f2da1c187 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 19:08:37 +0200 Subject: always expect KEY{value} on ATTR, ATTRS, ENV keys --- udev_rules_parse.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index b9456b5fb0..5603ee1d11 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -321,7 +321,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strncasecmp(key, "ATTR", sizeof("ATTR")-1) == 0) { + if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { attr = get_key_attribute(key + sizeof("ATTR")-1); if (attr == NULL) { err("error parsing ATTR attribute"); @@ -368,8 +368,8 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strncasecmp(key, "ATTRS", sizeof("ATTRS")-1) == 0 || - strncasecmp(key, "SYSFS", sizeof("SYSFS")-1) == 0) { + if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || + strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { attr = get_key_attribute(key + sizeof("ATTRS")-1); if (attr == NULL) { err("error parsing ATTRS attribute"); @@ -381,7 +381,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strncasecmp(key, "ENV", sizeof("ENV")-1) == 0) { + if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { attr = get_key_attribute(key + sizeof("ENV")-1); if (attr == NULL) { err("error parsing ENV attribute"); -- cgit v1.2.3-54-g00ecf From c4edd0adb55ebf625a0f190071b930b469c58dd8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Aug 2006 19:11:32 +0200 Subject: use new key names in test programs --- test/udev-test.pl | 300 +++++++++++++++++++++++++++---------------------- test/udevstart-test.pl | 2 - 2 files changed, 163 insertions(+), 139 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index c7662326ea..1117ecb40c 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -14,8 +14,8 @@ # After creation and removal the result is checked against the # expected value and the result is printed. # -# Kay Sievers , 2003 -# Leann Ogasawara , 2004 +# Copyright (C) 2004-2006 Kay Sievers +# Copyright (C) 2004 Leann Ogasawara use warnings; use strict; @@ -32,13 +32,33 @@ my $udev_rules = "udev-test.rules"; #my $udev_bin = "valgrind --tool=memcheck --leak-check=yes ../udev"; my @tests = ( + { + desc => "label test of scsi disc (old key names)", + subsys => "block", + devpath => "/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi disc (old key names)", + subsys => "block", + devpath => "/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi disc", subsys => "block", devpath => "/block/sda", exp_name => "boot_disk" , rules => < "/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/block/sda/sda3", exp_name => "first_disk3" , rules => < "test substitution chars", + desc => "test substitution chars (old key names)", subsys => "block", devpath => "/block/sda/sda3", exp_name => "Major:8:minor:3:kernelnumber:3:id:0:0:0:0" , rules => < "test substitution chars", + subsys => "block", + devpath => "/block/sda/sda3", + exp_name => "Major:8:minor:3:kernelnumber:3:id:0:0:0:0" , + rules => < "/block/sda/sda3", exp_name => "M8-m3-n3-b0:0-sIBM" , rules => < "/block/sda", exp_name => "subdir/info/node" , rules => < "/block/sda", exp_name => "node12345678", rules => < "/block/sda", exp_name => "disk-IBM-ESXS-sda" , rules => < "/block/sda/sda3", exp_name => "special-device-3" , rules => < "/block/sda/sda3", exp_name => "newline_removed" , rules => < "/block/sda/sda3", exp_name => "test-0:0:0:0" , rules => < "/block/sda/sda3", exp_name => "escape-3" , rules => < "/block/sda/sda3", exp_name => "foo9" , rules => < "/block/sda/sda3", exp_name => "bar9" , rules => < "/block/sda/sda3", exp_name => "foo7" , rules => < "/block/sda/sda3", exp_name => "my-foo9" , rules => < "/block/sda/sda3", exp_name => "my-foo8" , rules => < "/block/sda/sda3", exp_name => "Major:8-minor:3-kernelnumber:3-id:0:0:0:0", rules => < "/block/sda/sda3", exp_name => "Major:8-minor:3-kernelnumber:3-id:0:0:0:0", rules => < "/block/sda/sda3", exp_name => "830:0:0:03" , rules => < "/block/sda/sda3", exp_name => "833" , rules => < "/block/sda/sda3", exp_name => "8330:0:0:0" , rules => < "non matching BUS for device with no parent", + desc => "non matching SUBSYSTEMS for device with no parent", subsys => "tty", devpath => "/class/tty/console", exp_name => "TTY", rules => < "non matching BUS", + desc => "non matching SUBSYSTEMS", subsys => "tty", devpath => "/class/tty/console", exp_name => "TTY" , rules => < "SYSFS match", + desc => "ATTRS match", subsys => "tty", devpath => "/class/tty/console", exp_name => "foo" , rules => < "/block/sda", exp_name => "scsi-0:0:0:0" , rules => < "boot_disk15" , exp_majorminor => "8:15", rules => < "/class/tty/ttyUSB0", exp_name => "visor" , rules => < "/block/rd!c0d0", exp_name => "rd/c0d0" , rules => < "/block/cciss!c0d0/cciss!c0d0p1", exp_name => "cciss/c0d0p1" , rules => < "ID rule", + desc => "KERNELS rule", subsys => "block", devpath => "/block/sda", exp_name => "scsi-0:0:0:0", rules => < "ID wildcard all", + desc => "KERNELS wildcard all", subsys => "block", devpath => "/block/sda", exp_name => "scsi-0:0:0:0", rules => < "ID wildcard partial", + desc => "KERNELS wildcard partial", subsys => "block", devpath => "/block/sda", exp_name => "scsi-0:0:0:0", rules => < "ID wildcard partial 2", + desc => "KERNELS wildcard partial 2", subsys => "block", devpath => "/block/sda", exp_name => "scsi-0:0:0:0", rules => < "ignore SYSFS attribute whitespace", + desc => "ignore ATTRS attribute whitespace", subsys => "block", devpath => "/block/sda", exp_name => "ignored", rules => < "do not ignore SYSFS attribute whitespace", + desc => "do not ignore ATTRS attribute whitespace", subsys => "block", devpath => "/block/sda", exp_name => "matched-with-space", rules => < "node", exp_perms => "5000::0660", rules => < "node", exp_perms => ":100:0660", rules => < "node", exp_perms => "nobody::0660", rules => < "node", exp_perms => ":daemon:0660", rules => < "node", exp_perms => "root:mail:0660", rules => < "node", exp_perms => "::0777", rules => < "node", exp_perms => "5000:100:0777", rules => < "node", exp_majorminor => "8:0", rules => < "1/2/symlink" , exp_target => "a/b/node", rules => < "1/2/c/d/symlink" , exp_target => "../../a/b/node", rules => < "symlink-only2", exp_target => "link", rules => < "yes", exp_rem_error => "yes", rules => < "symlink-0:0:0:0", exp_target => "node", rules => < "test", exp_target => "link", rules => < "link1", exp_target => "node", rules => < "link4", exp_target => "node", rules => < "node", exp_add_error => "yes", rules => < "node6", rules => < "yes", rules => < "node", exp_rem_error => "yes", rules => < "yes", option => "clean", rules => < "/block/sda", exp_name => "node", rules => < "/block/sda", exp_name => "node", rules => < "/block/sda", exp_name => "node", rules => < "/block/sda", exp_name => "sda", rules => < "main_device", option => "keep", rules => < "main_device-part-1", option => "clean", rules => < "/block/sda/sda1", exp_name => "start-udev-root-end", rules => < "/block/sda/sda1", exp_name => "last", rules => < "/block/sda/sda1", exp_name => "match", rules => < "/block/sda/sda1", exp_name => "not-anything", rules => < "nonzero-program", rules => < "true", rules => < "/block/sda/sda1", exp_name => "true", rules => < "/block/sda/sda1", exp_name => "true", rules => < "/block/sda/sda1", exp_name => "true", rules => < "/block/sda/sda1", exp_name => "sane", rules => < "/block/sda/sda1", exp_name => "uber", rules => < "/block/sda/sda1", exp_name => "replaced", rules => < "/block/sda", exp_name => "ok", rules => < Date: Mon, 21 Aug 2006 02:38:20 +0200 Subject: cleanup commandline argument handling Print and log failure, but don't fail for tools which are usually not used iteractively. Add '--help' to all tools. --- udev.c | 4 ++-- udevcontrol.c | 29 +++++++++++------------------ udevd.c | 55 ++++++++++++++++++++++++++++++------------------------- udevinfo.c | 53 ++++++++++++++++++++++++++--------------------------- udevmonitor.c | 9 ++++----- udevsettle.c | 23 ++++++++++++----------- udevtest.c | 38 +++++++++++++++++++++++--------------- udevtrigger.c | 22 ++++++++++++++-------- 8 files changed, 122 insertions(+), 111 deletions(-) diff --git a/udev.c b/udev.c index c633fff14b..6b454f3157 100644 --- a/udev.c +++ b/udev.c @@ -77,7 +77,7 @@ int main(int argc, char *argv[], char *envp[]) exit(0); } - /* set std fd's to /dev/null, if the kernel forks us, we don't have them at all */ + /* set std fd's to /dev/null, /sbin/hotplug forks us, we don't have them at all */ devnull = open("/dev/null", O_RDWR); if (devnull >= 0) { if (devnull != STDIN_FILENO) @@ -92,7 +92,7 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udev"); if (devnull < 0) - err("fatal, could not open /dev/null: %s", strerror(errno)); + err("open /dev/null failed: %s", strerror(errno)); udev_config_init(); selinux_init(); dbg("version %s", UDEV_VERSION); diff --git a/udevcontrol.c b/udevcontrol.c index 9231f2e084..431befe39c 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -1,7 +1,7 @@ /* * udevcontrol.c * - * Copyright (C) 2005 Kay Sievers + * Copyright (C) 2005-2006 Kay Sievers * * 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 @@ -50,18 +50,6 @@ void log_message (int priority, const char *format, ...) } #endif -static void usage(void) -{ - printf("Usage: udevcontrol COMMAND\n" - " log_priority= set the udev log level for the daemon\n" - " stop_exec_queue keep udevd from executing events, queue only\n" - " start_exec_queue execute events, flush queue\n" - " reload_rules reloads the rules files\n" - " max_childs= maximum number of childs\n" - " max_childs_running= maximum number of childs running at the same time\n" - " --help print this help text\n\n"); -} - int main(int argc, char *argv[], char *envp[]) { static struct udevd_ctrl_msg ctrl_msg; @@ -82,7 +70,6 @@ int main(int argc, char *argv[], char *envp[]) if (argc < 2) { fprintf(stderr, "missing command\n\n"); - usage(); goto exit; } @@ -133,17 +120,23 @@ int main(int argc, char *argv[], char *envp[]) *intval = count; info("send max_childs_running=%i", *intval); } else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { - usage(); + printf("Usage: udevcontrol COMMAND\n" + " log_priority= set the udev log level for the daemon\n" + " stop_exec_queue keep udevd from executing events, queue only\n" + " start_exec_queue execute events, flush queue\n" + " reload_rules reloads the rules files\n" + " max_childs= maximum number of childs\n" + " max_childs_running= maximum number of childs running at the same time\n" + " --help print this help text\n\n"); goto exit; } else { - fprintf(stderr, "unknown option\n\n"); - usage(); + fprintf(stderr, "unrecognized command '%s'\n", arg); goto exit; } } if (getuid() != 0) { - fprintf(stderr, "need to be root, exit\n\n"); + fprintf(stderr, "root privileges required\n"); goto exit; } diff --git a/udevd.c b/udevd.c index 3da56ca294..e27dd78db3 100644 --- a/udevd.c +++ b/udevd.c @@ -921,63 +921,56 @@ int main(int argc, char *argv[], char *envp[]) const char *value; int daemonize = 0; int i; - int rc = 0; + int rc = 1; int maxfd; - /* redirect std fd's, if the kernel forks us, we don't have them at all */ - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - if (fd != STDIN_FILENO) - dup2(fd, STDIN_FILENO); - if (fd != STDOUT_FILENO) - dup2(fd, STDOUT_FILENO); - if (fd != STDERR_FILENO) - dup2(fd, STDERR_FILENO); - if (fd > STDERR_FILENO) - close(fd); - } - logging_init("udevd"); - if (fd < 0) - err("fatal, could not open /dev/null: %s", strerror(errno)); - udev_config_init(); selinux_init(); dbg("version %s", UDEV_VERSION); if (getuid() != 0) { - err("need to be root, exit"); + fprintf(stderr, "root privileges required\n"); + err("root privileges required"); goto exit; } /* parse commandline options */ for (i = 1 ; i < argc; i++) { char *arg = argv[i]; - if (strcmp(arg, "--daemon") == 0 || strcmp(arg, "-d") == 0) { - info("will daemonize"); + if (strcmp(arg, "--daemon") == 0 || strcmp(arg, "-d") == 0) daemonize = 1; + else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + printf("Usage: udevd [--help] [--daemon]\n"); + goto exit; + } else { + fprintf(stderr, "unrecognized option '%s'\n", arg); + err("unrecognized option '%s'\n", arg); } } /* init sockets to receive events */ if (init_udevd_socket() < 0) { if (errno == EADDRINUSE) { - err("another udevd running, exit"); + fprintf(stderr, "another udev daemon already running\n"); + err("another udev daemon already running"); rc = 1; } else { - err("error initializing udevd socket: %s", strerror(errno)); + fprintf(stderr, "error initializing udevd socket\n"); + err("error initializing udevd socket"); rc = 2; } goto exit; } if (init_uevent_netlink_sock() < 0) { - err("uevent socket not available"); + fprintf(stderr, "error initializing netlink socket\n"); + err("error initializing netlink socket"); rc = 3; goto exit; } - /* parse the rules and keep it in memory */ + /* parse the rules and keep them in memory */ sysfs_init(); udev_rules_init(&rules, 1); @@ -1001,6 +994,17 @@ int main(int argc, char *argv[], char *envp[]) } } + /* redirect std fd's */ + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) + close(fd); + } else + err("error opening /dev/null: %s", strerror(errno)); + /* set scheduling priority for the daemon */ setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); @@ -1162,7 +1166,7 @@ int main(int argc, char *argv[], char *envp[]) } } - /* rules changed, set by inotify or a signal*/ + /* rules changed, set by inotify or a HUP signal */ if (reload_config) { reload_config = 0; udev_rules_cleanup(&rules); @@ -1181,6 +1185,7 @@ int main(int argc, char *argv[], char *envp[]) msg_queue_manager(); } } + rc = 0; exit: udev_rules_cleanup(&rules); diff --git a/udevinfo.c b/udevinfo.c index d6f564079f..a0a17c40b4 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -163,30 +163,8 @@ static void export_db(void fnct(struct udevice *udev)) { name_list_cleanup(&name_list); } -static void print_help(void) -{ - fprintf(stderr, "Usage: udevinfo [-anpqrVh]\n" - " -q TYPE query database for the specified value:\n" - " 'name' name of device node\n" - " 'symlink' pointing to node\n" - " 'path' sysfs device path\n" - " 'env' the device related imported environment\n" - " 'all' all values\n" - "\n" - " -p PATH sysfs device path used for query or chain\n" - " -n NAME node/symlink name used for query\n" - "\n" - " -r prepend to query result or print udev_root\n" - " -a print all SYSFS_attributes along the device chain\n" - " -e export the content of the udev database\n" - " -V print udev version\n" - " -h print this help text\n" - "\n"); -} - int main(int argc, char *argv[], char *envp[]) { - static const char short_options[] = "aden:p:q:rVh"; int option; struct udevice *udev; int root = 0; @@ -213,7 +191,6 @@ int main(int argc, char *argv[], char *envp[]) int rc = 0; logging_init("udevinfo"); - udev_config_init(); sysfs_init(); @@ -224,8 +201,9 @@ int main(int argc, char *argv[], char *envp[]) } /* get command line options */ + opterr = 0; while (1) { - option = getopt(argc, argv, short_options); + option = getopt(argc, argv, ":aden:p:q:rVh"); if (option == -1) break; @@ -291,9 +269,30 @@ int main(int argc, char *argv[], char *envp[]) printf("udevinfo, version %s\n", UDEV_VERSION); goto exit; case 'h': + printf("Usage: udevinfo [-anpqrVh]\n" + " -q TYPE query database for the specified value:\n" + " 'name' name of device node\n" + " 'symlink' pointing to node\n" + " 'path' sysfs device path\n" + " 'env' the device related imported environment\n" + " 'all' all values\n" + "\n" + " -p PATH sysfs device path used for query or chain\n" + " -n NAME node/symlink name used for query\n" + "\n" + " -r prepend to query result or print udev_root\n" + " -a print all SYSFS_attributes along the device chain\n" + " -e export the content of the udev database\n" + " -V print udev version\n" + " -h print this help text\n" + "\n"); + goto exit; + case ':': + fprintf(stderr, "missing argument for '%c'\n", optopt); + goto exit; case '?': default: - print_help(); + fprintf(stderr, "unrecognized option '%c'\n", optopt); goto exit; } } @@ -352,7 +351,7 @@ int main(int argc, char *argv[], char *envp[]) print_record(udev); break; default: - print_help(); + fprintf(stderr, "unknown query type\n"); break; } break; @@ -378,7 +377,7 @@ int main(int argc, char *argv[], char *envp[]) printf("%s\n", udev_root); break; default: - print_help(); + fprintf(stderr, "missing option\n"); rc = 1; break; } diff --git a/udevmonitor.c b/udevmonitor.c index 4c59a495db..6f2844ff15 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -118,22 +118,21 @@ int main(int argc, char *argv[]) for (i = 1 ; i < argc; i++) { char *arg = argv[i]; - if (strcmp(arg, "--env") == 0 || strcmp(arg, "-e") == 0) { + if (strcmp(arg, "--env") == 0 || strcmp(arg, "-e") == 0) env = 1; - } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0){ - printf("Usage: udevmonitor [--env]\n" + printf("Usage: udevmonitor [--help] [--env]\n" " --env print the whole event environment\n" " --help print this help text\n\n"); exit(0); } else { - fprintf(stderr, "unknown option\n\n"); + fprintf(stderr, "unrecognized option '%s'\n", arg); exit(1); } } if (getuid() != 0) { - fprintf(stderr, "need to be root, exit\n\n"); + fprintf(stderr, "root privileges required\n"); exit(2); } diff --git a/udevsettle.c b/udevsettle.c index 3215b3c5ba..b38968e7df 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -36,7 +36,6 @@ #define DEFAULT_TIMEOUT 180 #define LOOP_PER_SECOND 20 -static const char *udev_log_str; #ifdef USE_LOG void log_message(int priority, const char *format, ...) @@ -69,28 +68,30 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevsettle"); udev_config_init(); dbg("version %s", UDEV_VERSION); - - udev_log_str = getenv("UDEV_LOG"); + sysfs_init(); for (i = 1 ; i < argc; i++) { char *arg = argv[i]; if (strncmp(arg, "--timeout=", 10) == 0) { char *str = &arg[10]; + int seconds; - timeout = atoi(str); + seconds = atoi(str); + if (seconds > 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); dbg("timeout=%i", timeout); - if (timeout <= 0) { - fprintf(stderr, "Invalid timeout value.\n"); - goto exit; - } - } else { - fprintf(stderr, "Usage: udevsettle [--timeout=]\n"); + } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + printf("Usage: udevsettle [--help] [--timeout=]\n"); goto exit; + } else { + fprintf(stderr, "unrecognized option '%s'\n", arg); + err("unrecognized option '%s'\n", arg); } } - sysfs_init(); strlcpy(queuename, udev_root, sizeof(queuename)); strlcat(queuename, "/" EVENT_QUEUE_DIR, sizeof(queuename)); diff --git a/udevtest.c b/udevtest.c index 22627c05a7..f8010ca5b8 100644 --- a/udevtest.c +++ b/udevtest.c @@ -2,6 +2,7 @@ * udevtest.c * * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -50,45 +51,52 @@ void log_message (int priority, const char *format, ...) int main(int argc, char *argv[], char *envp[]) { - struct udev_rules rules; - char *devpath; + struct udev_rules rules = {}; + char *devpath = NULL; struct udevice *udev; struct sysfs_device *dev; + int i; int retval; int rc = 0; info("version %s", UDEV_VERSION); - - /* initialize our configuration */ udev_config_init(); if (udev_log_priority < LOG_INFO) udev_log_priority = LOG_INFO; - if (argc != 2) { - info("Usage: udevtest "); - return 1; + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + printf("Usage: udevtest [--help] \n"); + goto exit; + } else + devpath = arg; + } + + if (devpath == NULL) { + fprintf(stderr, "devpath parameter missing\n"); + rc = 1; + goto exit; } sysfs_init(); + udev_rules_init(&rules, 0); /* remove /sys if given */ - if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) - devpath = &argv[1][strlen(sysfs_path)]; - else - devpath = argv[1]; - - udev_rules_init(&rules, 0); + if (strncmp(devpath, sysfs_path, strlen(sysfs_path)) == 0) + devpath = &devpath[strlen(sysfs_path)]; dev = sysfs_device_get(devpath); if (dev == NULL) { - info("unable to open '%s'", devpath); + fprintf(stderr, "unable to open device '%s'\n", devpath); rc = 2; goto exit; } udev = udev_device_init(); if (udev == NULL) { - info("can't open device"); + fprintf(stderr, "error initializing device\n"); rc = 3; goto exit; } diff --git a/udevtrigger.c b/udevtrigger.c index 9345a06ab7..e530a61c0b 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -359,6 +359,7 @@ static void scan_failed(void) int main(int argc, char *argv[], char *envp[]) { int i; + int failed = 0; logging_init("udevtrigger"); udev_config_init(); @@ -373,19 +374,24 @@ int main(int argc, char *argv[], char *envp[]) } else if (strcmp(arg, "--dry-run") == 0 || strcmp(arg, "-n") == 0) { dry_run = 1; } else if (strcmp(arg, "--retry-failed") == 0 || strcmp(arg, "-F") == 0) { - scan_failed(); - exec_lists(); + failed = 1; + } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + printf("Usage: udevtrigger [--help] [--verbose] [--dry-run] [--retry-failed]\n"); goto exit; } else { - fprintf(stderr, "Usage: udevtrigger [--verbose] [--dry-run] [--retry-failed]\n"); - goto exit; + fprintf(stderr, "unrecognized option '%s'\n", arg); + err("unrecognized option '%s'\n", arg); } } - /* default action */ - scan_bus(); - scan_class(); - scan_block(); + if (failed) + scan_failed(); + else { + /* default action */ + scan_bus(); + scan_class(); + scan_block(); + } exec_lists(); exit: -- cgit v1.2.3-54-g00ecf From e3e7358137a35849f81a8e18ca548ded22a2b5cc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Aug 2006 02:38:48 +0200 Subject: db: don't create a db file for only a node name to store --- udev_db.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/udev_db.c b/udev_db.c index c3034f5037..86a3ea7a39 100644 --- a/udev_db.c +++ b/udev_db.c @@ -81,8 +81,7 @@ int udev_db_add_device(struct udevice *udev) * create only a symlink with the name as the target * if we don't have any interesting data to remember */ - if (strcmp(udev->name, udev->dev->kernel) == 0 && - list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && + if (list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && !udev->partitions && !udev->ignore_remove) { dbg("nothing interesting to store, create symlink"); unlink(filename); -- cgit v1.2.3-54-g00ecf From 02adc0cbd637862f6e9cf8319c80def0fa31b4e7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Aug 2006 02:39:22 +0200 Subject: man: add ATTR{file}="value" assignment --- udev.7 | 9 ++++++--- udev.xml | 21 ++++++++++++++++----- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/udev.7 b/udev.7 index e6828ee4ee..fa6e52fdf3 100644 --- a/udev.7 +++ b/udev.7 @@ -88,7 +88,7 @@ Match the subsystem of the event device. \fBATTR{\fR\fB\fIfilename\fR\fR\fB}\fR Match sysfs attribute values of the event device. Up to five \fBATTR\fR -keys can be specified per rule. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. +keys can be specified per rule. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. Depending on the type of operator, this key is also used to set the value of a sysfs attribute. .TP 3n \fBKERNELS\fR Search the devpath upwards for a matching device name. @@ -107,7 +107,7 @@ keys can be specified per rule. All attributes must match on the same device. Tr \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR Match against the value of an environment variable. Up to five \fBENV\fR -keys can be specified per rule. This key can also be used to export a variable to the environment. +keys can be specified per rule. Depending on the type of operator, this key is also used to export a variable to the environment. .TP 3n \fBPROGRAM\fR Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key. @@ -137,8 +137,11 @@ The name of a symlink targeting the node. Every matching rule can add this value \fBOWNER, GROUP, MODE\fR The permissions for the device node. Every specified value overwrites the compiled\-in default value. .TP 3n +\fBATTR{\fR\fB\fIkey\fR\fR\fB}\fR +The value that should be written to a sysfs attribute of the event device. Depending on the type of operator, this key is also used to match against the value of a sysfs attribute. +.TP 3n \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -Export a variable to the environment. This key can also be used to match against an environment variable. +Export a variable to the environment. Depending on the type of operator, this key is also to match against an environment variable. .TP 3n \fBRUN\fR Add a program to the list of programs to be executed for a specific device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. diff --git a/udev.xml b/udev.xml index 8434156530..b2781b767d 100644 --- a/udev.xml +++ b/udev.xml @@ -174,7 +174,9 @@ Match sysfs attribute values of the event device. Up to five keys can be specified per rule. Trailing whitespace in the attribute values is ignored, if the specified match - value does not contain trailing whitespace itself. + value does not contain trailing whitespace itself. Depending on the type + of operator, this key is also used to set the value of a sysfs attribute. + @@ -213,8 +215,8 @@ Match against the value of an environment variable. Up to five - keys can be specified per rule. This key can also be used to export a variable to - the environment. + keys can be specified per rule. Depending on the type of operator, this key is also used + to export a variable to the environment. @@ -294,11 +296,20 @@ + + + + The value that should be written to a sysfs attribute of the + event device. Depending on the type of operator, this key is also + used to match against the value of a sysfs attribute. + + + - Export a variable to the environment. This key can also be used to match - against an environment variable. + Export a variable to the environment. Depending on the type of operator, + this key is also to match against an environment variable. -- cgit v1.2.3-54-g00ecf From 2f64aa4056835231ed297a79d39d5416e0045d0c Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 22 Aug 2006 23:20:15 +0200 Subject: fix rc when using udev --daemon --- udevd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevd.c b/udevd.c index e27dd78db3..de7cace3e1 100644 --- a/udevd.c +++ b/udevd.c @@ -990,6 +990,7 @@ int main(int argc, char *argv[], char *envp[]) goto exit; default: dbg("child [%u] running, parent exits", pid); + rc = 0; goto exit; } } -- cgit v1.2.3-54-g00ecf From 49e7f5a05f7fc2a223aa9592530a6dbdc0ebfd4a Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Wed, 23 Aug 2006 01:20:56 +0200 Subject: update Debian rules --- etc/udev/debian/devfs.rules | 28 +++++++++++++++------------- etc/udev/debian/hotplug.rules | 24 +++++++++++++----------- etc/udev/debian/permissions.rules | 28 ++++++++++++++++------------ etc/udev/debian/persistent-input.rules | 26 +++++++++++++++----------- etc/udev/debian/persistent.rules | 17 +++++++++++------ etc/udev/debian/udev.rules | 24 +++++++++++++----------- 6 files changed, 83 insertions(+), 64 deletions(-) diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index 14a67bbdc2..107b197d91 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -3,7 +3,6 @@ # # %n the "kernel number" of the device. # For example, 'sda3' has a "kernel number" of '3' -# %e the smallest number for that name which does not matches an existing node # %k the kernel name for the device # %M the kernel major number for the device # %m the kernel minor number for the device @@ -14,15 +13,17 @@ # # workaround for devices which do not report media changes -BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{removable}=="1", \ ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ + OPTIONS+="all_partitions" # IDE devices -BUS=="ide", KERNEL=="hd[a-z]*", PROGRAM="ide-devfs.sh %k %b %n", \ +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]*", PROGRAM="ide-devfs.sh %k %b %n", \ NAME="%c{1}", SYMLINK+="%k %c{2}" # SCSI devices -BUS=="scsi", PROGRAM="scsi-devfs.sh %k %b %n", \ +SUBSYSTEMS=="scsi", PROGRAM="scsi-devfs.sh %k %b %n", \ NAME="%c{1}", SYMLINK+="%k %c{2}" # RAID controllers @@ -35,15 +36,15 @@ KERNEL=="loop[0-9]*", NAME="loop/%n" KERNEL=="ram[0-9]*", NAME="rd/%n" # USB devices -BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" -BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" -BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" -BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="ttyUSB*", \ - SYSFS{product}=="Palm Handheld*|Handspring Visor", \ - SYMLINK+="pilot" +SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ + ATTRS{product}=="Palm Handheld*|Handspring Visor|palmOne Handheld", \ + SYMLINK+="pilot" # usbfs-like devices SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ @@ -81,6 +82,7 @@ KERNEL=="nvram", NAME="misc/%k" KERNEL=="psaux", NAME="misc/%k" KERNEL=="rtc", NAME="misc/%k" KERNEL=="tun", NAME="net/%k" +KERNEL=="evtchn", NAME="xen/%k" # printers and parallel devices KERNEL=="lp[0-9]*", NAME="printers/%n" diff --git a/etc/udev/debian/hotplug.rules b/etc/udev/debian/hotplug.rules index 426424de5a..eae68864c9 100644 --- a/etc/udev/debian/hotplug.rules +++ b/etc/udev/debian/hotplug.rules @@ -12,24 +12,26 @@ SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" # rules for subsystems which lack proper hotplug support -#SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o-block" +SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o-block" #SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc-block" -SUBSYSTEM=="scsi_device", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe osst", \ - SYSFS{vendor}=="Onstream", SYSFS{model}!="ADR*" -SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe st", \ - SYSFS{vendor}=="Onstream", SYSFS{model}=="ADR*" -SUBSYSTEM=="scsi_device", SYSFS{type}=="1", RUN+="/sbin/modprobe st", \ - SYSFS{vendor}!="Onstream" -SUBSYSTEM=="scsi_device", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", SYSFS{type}=="[235689]", RUN+="/sbin/modprobe sg" +SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe osst", \ + ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ + ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ + ATTRS{vendor}!="Onstream" +SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", RUN+="/sbin/modprobe sg" + +SUBSYSTEM=="ide", ATTRS{media}=="tape", RUN+="/sbin/modprobe ide-scsi" # From here on follows the hotplug agents which do not load modules LABEL="hotplug_driver_loaded" # FIXME: does a sane default exist? -#SUBSYSTEM=="scsi_device", SYSFS{idVendor}=="...", \ +#SUBSYSTEM=="scsi_device", ATTRS{idVendor}=="...", \ # RUN+="scsi-re-add" SUBSYSTEM=="firmware", RUN+="firmware.agent" diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index 8da35c3090..8b369596a3 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -1,6 +1,7 @@ ACTION!="add", GOTO="permissions_end" # workarounds needed to synchronize with sysfs +# only needed for kernels < v2.6.18-rc1 DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" # only needed for kernels < 2.6.16 @@ -10,31 +11,32 @@ SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" # default permissions for block devices SUBSYSTEM=="block", GROUP="disk" -SUBSYSTEM=="block", SYSFS{removable}=="1", GROUP="floppy" +SUBSYSTEM=="block", ATTRS{removable}=="1", GROUP="floppy" # IDE devices -BUS=="ide", KERNEL=="hd[a-z]|pcd[0-9]*", DRIVER=="ide-cdrom|pcd", \ +KERNEL=="hd[a-z]|pcd[0-9]*", DRIVERS=="ide-cdrom|pcd", \ IMPORT{program}="cdrom_id --export $tempnode" ENV{ID_CDROM}=="?*", GROUP="cdrom" -BUS=="ide", KERNEL=="ht[0-9]*", GROUP="tape" -BUS=="ide", KERNEL=="nht[0-9]*", GROUP="tape" +KERNEL=="ht[0-9]*", GROUP="tape" +KERNEL=="nht[0-9]*", GROUP="tape" # SCSI devices -BUS=="scsi", SYSFS{type}=="1", GROUP="tape" -BUS=="scsi", SYSFS{type}=="3", SYSFS{vendor}=="HP", GROUP="scanner" -BUS=="scsi", SYSFS{type}=="5", GROUP="cdrom" -BUS=="scsi", SYSFS{type}=="6", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" # USB devices -BUS=="usb", KERNEL=="legousbtower*", MODE="0666" -BUS=="usb", KERNEL=="lp[0-9]*", GROUP="lp" +KERNEL=="legousbtower*", MODE="0666" +KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" # usbfs-like devices SUBSYSTEM=="usb_device", MODE="0664" # iRiver music players SUBSYSTEM=="usb_device", GROUP="plugdev", \ - SYSFS{idVendor}=="4102", SYSFS{idProduct}=="10[01][135789]" + ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" # serial devices SUBSYSTEM=="tty", GROUP="dialout" @@ -74,6 +76,7 @@ KERNEL=="nvram", GROUP="nvram" KERNEL=="rtc", GROUP="audio" KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" KERNEL=="fuse", GROUP="fuse" +KERNEL=="kqemu", MODE="0666" KERNEL=="cdemu[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" @@ -85,6 +88,7 @@ KERNEL=="ucm*", GROUP="rdma" # printers and parallel devices SUBSYSTEM=="printer", GROUP="lp" SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="irlpt*", GROUP="lp" KERNEL=="pt[0-9]*", GROUP="tape" KERNEL=="pht[0-9]*", GROUP="tape" @@ -97,7 +101,7 @@ KERNEL=="dv1394*", GROUP="video" KERNEL=="video1394*", GROUP="video" # input devices -KERNEL=="event[0-9]*", SYSFS{name}=="*dvb*|*DVB*|* IR *" \ +KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ MODE="0664", GROUP="video" KERNEL=="js[0-9]*", MODE="0664" diff --git a/etc/udev/debian/persistent-input.rules b/etc/udev/debian/persistent-input.rules index 293971266e..a9005e075b 100644 --- a/etc/udev/debian/persistent-input.rules +++ b/etc/udev/debian/persistent-input.rules @@ -4,26 +4,30 @@ ACTION!="add", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" # usb devices -BUS=="usb", IMPORT{program}="usb_id -x" -BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="01", \ +SUBSYSTEMS=="usb", IMPORT{program}="usb_id -x" +SUBSYSTEMS=="usb", \ + ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", \ ENV{ID_CLASS}="kbd" -BUS=="usb", SYSFS{bInterfaceClass}=="03", SYSFS{bInterfaceProtocol}=="02", \ +SUBSYSTEMS=="usb", \ + ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", \ ENV{ID_CLASS}="mouse" # other devices -DRIVER=="pcspkr", ENV{ID_CLASS}="spkr" -DRIVER=="atkbd", ENV{ID_CLASS}="kbd" -DRIVER=="psmouse", ENV{ID_CLASS}="mouse" -SYSFS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" +DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +# this means (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", \ + ATTRS{modalias}!="input:*-*k*14A,*r*", \ + ENV{ID_CLASS}="joystick" ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" # by-id links, generic and for the event devices -KERNEL=="mouse*", \ - ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", \ +KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -KERNEL=="event*", \ - ENV{ID_BUS}=="?*", ENV{ID_SERIAL}=="?*", ENV{ID_CLASS}=="?*", \ +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" # by-path links diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index 349817d797..ce8a6a0af2 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -8,16 +8,19 @@ ACTION!="add", GOTO="no_volume_id" KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="no_volume_id" # skip removable ide devices, because open(2) on them causes an events loop -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", \ +KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ GOTO="no_volume_id" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", \ +KERNEL=="hd*[0-9]", ATTRS{../removable}=="1", \ GOTO="no_volume_id" +# skip xen virtual hard disks +DRIVERS=="vbd", GOTO="no_hardware_id" + # look for different kinds of unique identificators KERNEL=="hd*[!0-9]", \ IMPORT{program}="ata_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="?*", \ +KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", \ ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$sysfs{ieee1394_id}" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", \ IMPORT{program}="usb_id -x" @@ -35,6 +38,8 @@ KERNEL=="*[!0-9]", \ # find the physical path of the device KERNEL=="*[!0-9]|sr*|st*", IMPORT{program}="path_id $devpath" +LABEL="no_hardware_id" + # import the variables of partitions from the parent disks KERNEL=="*[0-9]", IMPORT{parent}="ID_*" @@ -62,11 +67,11 @@ KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # UUID and volume label -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" +KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="no_volume_id" IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ +ENV{ID_FS_UUID}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ +ENV{ID_FS_LABEL_SAFE}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # end of processing diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index 023337445c..6498a131da 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -3,7 +3,6 @@ # # %n the "kernel number" of the device. # For example, 'sda3' has a "kernel number" of '3' -# %e the smallest number for that name which does not matches an existing node # %k the kernel name for the device # %M the kernel major number for the device # %m the kernel minor number for the device @@ -14,21 +13,23 @@ # # workaround for devices which do not report media changes -BUS=="ide", KERNEL=="hd[a-z]", SYSFS{removable}=="1", \ +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{removable}=="1", \ ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ + OPTIONS+="all_partitions" # SCSI devices -BUS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" +SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" # USB devices -BUS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="dabusb*", NAME="usb/%k" -BUS=="usb", KERNEL=="hiddev*", NAME="usb/%k" -BUS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" -BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" -BUS=="usb", KERNEL=="ttyUSB*", \ - SYSFS{product}=="Palm Handheld*|Handspring Visor", \ +SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ + ATTRS{product}=="Palm Handheld*|Handspring Visor|palmOne Handheld", \ SYMLINK+="pilot" # usbfs-like devices @@ -47,6 +48,7 @@ KERNEL=="card[0-9]*", NAME="dri/%k" # misc devices KERNEL=="hw_random", NAME="hwrng" KERNEL=="tun", NAME="net/%k" +KERNEL=="evtchn", NAME="xen/%k" KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" -- cgit v1.2.3-54-g00ecf From 56f914e63b2295b2755cf66be02a8874de7f2b8a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Aug 2006 01:32:25 +0200 Subject: 098 release --- Makefile | 8 ++++---- RELEASE-NOTES | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- TODO | 33 +++++++++++++++++++++++++++++---- 3 files changed, 91 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 1b3815f3bb..d7801296bd 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ # Makefile for udev # -# Copyright (C) 2003,2004 Greg Kroah-Hartman +# Copyright (C) 2003-2004 Greg Kroah-Hartman # Copyright (C) 2004-2006 Kay Sievers # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -VERSION = 097 +VERSION = 098 # set this to make use of syslog USE_LOG = true @@ -91,7 +91,7 @@ MAN_PAGES = \ GEN_HEADERS = \ udev_version.h -prefix = +prefix ?= etcdir = ${prefix}/etc sbindir = ${prefix}/sbin usrbindir = ${prefix}/usr/bin @@ -108,7 +108,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL_PROGRAM} PWD = $(shell pwd) -CROSS_COMPILE = +CROSS_COMPILE ?= CC = $(CROSS_COMPILE)gcc LD = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 7980b452c7..9fe4542dd5 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,60 @@ +udev 098 +======== +Bugfixes. + +Renaming of some key names (the old names still work): +BUS -> SUBSYSTEMS, ID -> KERNELS, SYSFS -> ATTRS, DRIVER -> DRIVERS. +(The behavior of the key DRIVER will change soon in one of the next +releases, to match only the event device, please switch to DRIVERS +instead. If DRIVER is used, it will behave like DRIVERS, but an error +is logged. +With the new key names, we have a more consistent and simpler scheme. +We can match the properties of the event device only, with: KERNEL, +SUBSYSTEM, ATTR, DRIVER. Or include all the parent devices in the match, +with: KERNELS, SUBSYSTEMS, ATTRS, DRIVERS. ID, BUS, SYSFS, DRIVER are no +longer mentioned in the man page and should be switched in the rule +files. + +ATTR{file}="value" can be used now, to write to a sysfs file of the +event device. Instead of: + ..., SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" +we now can do: + ..., ATTR{type}=="0|7|14", ATTR{timeout}="60" + +All the PHYSDEV* keys are deprecated and will be removed from a +future kernel: + PHYDEVPATH - is the path of a parent device and should not be + needed at all. + PHYSDEVBUS - is just a SUBSYSTEM value of a parent, and can be + matched with SUBSYSTEMS== + PHYSDEVDRIVER - for bus devices it is available as ENV{DRIVER}. + Newer kernels will have DRIVER in the environment, + for older kernels udev puts in. Class device will + no longer carry this property of a parent and + DRIVERS== can be used to match such a parent value. +Note that ENV{DRIVER} is only available for a few bus devices, where +the driver is already bound at device event time. On coldplug, the +events for a lot devices are already bound to a driver, and they will have +that value set. But on hotplug, at the time the kernel creates the device, +it can't know what driver may claim the device after that, therefore +in most cases it will be empty. + +Failed events should now be re-triggered with: + udevtrigger --retry-failed. +Please switch to this command, so we keep the details of the /dev/.udev/failed/ +files private to the udev tools. We may need to switch the current symlink +target, cause some obviously broken tools try to scan all files in /dev +including /dev/.udev/, find the links to /sys and end up stat()'ing sysfs files +million times. This takes ages on slow boxes. + +The udevinfo attribute walk (-a) now works with giving a device node +name (-n) instead of a devpath (-p). The query now always works, also when +no database file was created by udev. + +The built-in /etc/passwd /etc/group parser is removed, we always depend on +getpwnam() and getgrnam() now. One of the next releases will depend on +fnmatch() and may use getopt_long(). + udev 097 ======== Bugfixes and small improvements. @@ -8,7 +65,7 @@ Fix path_id for recent kernels. udev 095 ======== -%e is finaly gone. +%e is finally gone. Added support for swapping network interface names, by temporarily renaming the device and wait for the target name to become free. diff --git a/TODO b/TODO index b0df3c12d3..7954deb500 100644 --- a/TODO +++ b/TODO @@ -1,13 +1,38 @@ -These things need to be done, or would be nice to have: - - o Log the relationship of the kernel name and the persistent disk name +These things would be nice to have: + o log the relationship of the kernel name and the persistent disk name to syslog, so any error logged from the kernel can be associated with - any of the links at that time. + any of the links at that time + +These things will change in future udev versions: + o remove /sys prefix from symlinks in /dev/.udev/{queue,failed} + (broken tools search /dev for files and get lost following to /sys + and stat() sysfs files million times) + + o make DRIVER== to match only the event device + (DRIVERS must be used, we currently translate it to DRIVERS and print + an error if DRIVER is used) + + o switch to fnmatch() instead of our own implementation + + o warn if PHYSDEV* keys are used in ENV keys + (they are deprecated and will be removed from a future kernel) + + o warn if "/device/" is used in a ATTR, ATTRS, $sysfs key + (the device link must not be used in rules or tools, udev resolves + the link and makes the devices available as parents, which can + be matched with the normal keys) + + o warn if BUS, ID, SYSFS are used as keys + (they are SUBSYSTEMS, KERNELS, ATTRS now) These things are deprecated and scheduled for removal in a future udev version: + o remove old udevdb dump 'udevinfo -d' + (-e exports everything) o remove udevstart (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer want to guess event properties from sysfs like udevstart is doing it) + o remove extra for /etc/dev.d/ /etc/hotplug.d/ + (that inefficient stuff should finally go away) -- cgit v1.2.3-54-g00ecf From 34bb5d057c99fa433392e0d5c17f604c8c111381 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Aug 2006 00:13:07 +0200 Subject: udev_db.c: include --- udev_db.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_db.c b/udev_db.c index 86a3ea7a39..99d73bd5af 100644 --- a/udev_db.c +++ b/udev_db.c @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include "udev.h" -- cgit v1.2.3-54-g00ecf From cea61f5c0303d7e2f0886688e789c091d7e4b9e2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Aug 2006 09:03:15 +0200 Subject: use fnmatch() instead of our own pattern match code --- udev.h | 1 - udev_rules.c | 5 +++-- udev_utils_string.c | 53 ----------------------------------------------------- 3 files changed, 3 insertions(+), 56 deletions(-) diff --git a/udev.h b/udev.h index 0377a8a65b..fc22cc76cb 100644 --- a/udev.h +++ b/udev.h @@ -143,7 +143,6 @@ extern uid_t lookup_user(const char *user); extern gid_t lookup_group(const char *group); /* udev_utils_string.c */ -extern int strcmp_pattern(const char *p, const char *s); extern int string_is_true(const char *str); extern void remove_trailing_chars(char *path, char c); extern int utf8_encoded_valid_unichar(const char *str); diff --git a/udev_rules.c b/udev_rules.c index d9e1d89e6c..267c79de03 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -246,7 +247,7 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) if (pos) { pos[0] = '\0'; pos++; - if (strcmp_pattern(filter, name) == 0) { + if (fnmatch(filter, name, 0) == 0) { dbg("import key '%s'", name_loop->name); name_list_add(&udev->env_list, name_loop->name, 0); setenv(name, pos, 1); @@ -583,7 +584,7 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k pos++; } dbg("match %s '%s' <-> '%s'", key_name, key_value, val); - match = (strcmp_pattern(key_value, val) == 0); + match = (fnmatch(key_value, val, 0) == 0); if (match && (key->operation != KEY_OP_NOMATCH)) { dbg("%s is true (matching value)", key_name); return 0; diff --git a/udev_utils_string.c b/udev_utils_string.c index 5aebfed523..225e198587 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -32,59 +32,6 @@ #include "udev.h" -/* compare string with pattern (like fnmatch(), supports * ? [0-9] [!A-Z]) */ -int strcmp_pattern(const char *p, const char *s) -{ - if (s[0] == '\0') { - while (p[0] == '*') - p++; - return (p[0] != '\0'); - } - switch (p[0]) { - case '[': - { - int not = 0; - p++; - if (p[0] == '!') { - not = 1; - p++; - } - while ((p[0] != '\0') && (p[0] != ']')) { - int match = 0; - if (p[1] == '-') { - if ((s[0] >= p[0]) && (s[0] <= p[2])) - match = 1; - p += 3; - } else { - match = (p[0] == s[0]); - p++; - } - if (match ^ not) { - while ((p[0] != '\0') && (p[0] != ']')) - p++; - if (p[0] == ']') - return strcmp_pattern(p+1, s+1); - } - } - } - break; - case '*': - if (strcmp_pattern(p, s+1)) - return strcmp_pattern(p+1, s); - return 0; - case '\0': - if (s[0] == '\0') { - return 0; - } - break; - default: - if ((p[0] == s[0]) || (p[0] == '?')) - return strcmp_pattern(p+1, s+1); - break; - } - return 1; -} - int string_is_true(const char *str) { if (strcasecmp(str, "true") == 0) -- cgit v1.2.3-54-g00ecf From 5780be9eab8e72dcce9d8bcfe15e8e1d3ae6bed8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Aug 2006 10:25:34 +0200 Subject: rename major/minor variable to maj/min to avoid warning --- udev_db.c | 6 +++--- udev_device.c | 6 +++--- udevd.c | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/udev_db.c b/udev_db.c index 99d73bd5af..797d0eeffb 100644 --- a/udev_db.c +++ b/udev_db.c @@ -122,7 +122,7 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) struct stat stats; char filename[PATH_SIZE]; char line[PATH_SIZE]; - unsigned int major, minor; + unsigned int maj, min; char *bufline; char *buf; size_t bufsize; @@ -176,8 +176,8 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) count = sizeof(line); memcpy(line, &bufline[2], count-2); line[count-2] = '\0'; - sscanf(line, "%u:%u", &major, &minor); - udev->devt = makedev(major, minor); + sscanf(line, "%u:%u", &maj, &min); + udev->devt = makedev(maj, min); break; case 'S': if (count > sizeof(line)) diff --git a/udev_device.c b/udev_device.c index b680246bf8..21af91b443 100644 --- a/udev_device.c +++ b/udev_device.c @@ -70,13 +70,13 @@ void udev_device_cleanup(struct udevice *udev) dev_t udev_device_get_devt(struct udevice *udev) { const char *attr; - unsigned int major, minor; + unsigned int maj, min; /* read it from sysfs */ attr = sysfs_attr_get_value(udev->dev->devpath, "dev"); if (attr != NULL) { - if (sscanf(attr, "%u:%u", &major, &minor) == 2) - return makedev(major, minor); + if (sscanf(attr, "%u:%u", &maj, &min) == 2) + return makedev(maj, min); } return makedev(0, 0); } diff --git a/udevd.c b/udevd.c index de7cace3e1..7c917fd56e 100644 --- a/udevd.c +++ b/udevd.c @@ -567,8 +567,8 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz int i; struct udevd_uevent_msg *msg; char *physdevdriver_key = NULL; - int major = 0; - int minor = 0; + int maj = 0; + int min = 0; msg = malloc(sizeof(struct udevd_uevent_msg) + buf_size); if (msg == NULL) @@ -604,13 +604,13 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz else if (strncmp(key, "PHYSDEVDRIVER=", 14) == 0) physdevdriver_key = key; else if (strncmp(key, "MAJOR=", 6) == 0) - major = strtoull(&key[6], NULL, 10); + maj = strtoull(&key[6], NULL, 10); else if (strncmp(key, "MINOR=", 6) == 0) - minor = strtoull(&key[6], NULL, 10); + min = strtoull(&key[6], NULL, 10); else if (strncmp(key, "TIMEOUT=", 8) == 0) msg->timeout = strtoull(&key[8], NULL, 10); } - msg->devt = makedev(major, minor); + msg->devt = makedev(maj, min); msg->envp[i++] = "UDEVD_EVENT=1"; if (msg->driver == NULL && msg->physdevpath == NULL && physdevdriver_key != NULL) { -- cgit v1.2.3-54-g00ecf From a1e6bd93d3d650c2064daafdb253120ae6e89398 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Sun, 27 Aug 2006 02:28:31 +0200 Subject: update Debian rules --- etc/udev/debian/devfs.rules | 2 +- etc/udev/debian/hotplug.rules | 8 ++++---- etc/udev/debian/permissions.rules | 7 ++++--- etc/udev/debian/persistent.rules | 8 ++++---- etc/udev/debian/udev.rules | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index 107b197d91..37e4ae1bc9 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -13,7 +13,7 @@ # # workaround for devices which do not report media changes -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{removable}=="1", \ +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ OPTIONS+="all_partitions" diff --git a/etc/udev/debian/hotplug.rules b/etc/udev/debian/hotplug.rules index eae68864c9..8b48d77f56 100644 --- a/etc/udev/debian/hotplug.rules +++ b/etc/udev/debian/hotplug.rules @@ -1,7 +1,7 @@ ACTION!="add", GOTO="hotplug_not_add_event" # check if the device has already been claimed by a driver -ENV{PHYSDEVDRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" +ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" # load the drivers ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" @@ -25,7 +25,7 @@ SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", RUN+="/sbin/modprobe sg" -SUBSYSTEM=="ide", ATTRS{media}=="tape", RUN+="/sbin/modprobe ide-scsi" +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" # From here on follows the hotplug agents which do not load modules LABEL="hotplug_driver_loaded" @@ -34,11 +34,11 @@ LABEL="hotplug_driver_loaded" #SUBSYSTEM=="scsi_device", ATTRS{idVendor}=="...", \ # RUN+="scsi-re-add" -SUBSYSTEM=="firmware", RUN+="firmware.agent" +SUBSYSTEM=="firmware", RUN+="firmware.agent" LABEL="hotplug_not_add_event" -SUBSYSTEM=="net", RUN+="/bin/sh -c '/lib/udev/net.agent &'" +SUBSYSTEM=="net", RUN+="net.agent" # Log every event to /dev/hotplug.log (for debugging). #RUN+="logger.agent" diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index 8b369596a3..06bbf66260 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -2,16 +2,16 @@ ACTION!="add", GOTO="permissions_end" # workarounds needed to synchronize with sysfs # only needed for kernels < v2.6.18-rc1 -DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ENV{PHYSDEVPATH}!="?*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" # only needed for kernels < 2.6.16 SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" # only needed for kernels < 2.6.17 -SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" +SUBSYSTEM=="net", ENV{DRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" # default permissions for block devices SUBSYSTEM=="block", GROUP="disk" -SUBSYSTEM=="block", ATTRS{removable}=="1", GROUP="floppy" +SUBSYSTEM=="block", ATTR{removable}=="1", GROUP="floppy" # IDE devices KERNEL=="hd[a-z]|pcd[0-9]*", DRIVERS=="ide-cdrom|pcd", \ @@ -21,6 +21,7 @@ KERNEL=="ht[0-9]*", GROUP="tape" KERNEL=="nht[0-9]*", GROUP="tape" # SCSI devices +KERNEL=="sr[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index ce8a6a0af2..277d03dea8 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -8,9 +8,9 @@ ACTION!="add", GOTO="no_volume_id" KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="no_volume_id" # skip removable ide devices, because open(2) on them causes an events loop -KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ GOTO="no_volume_id" -KERNEL=="hd*[0-9]", ATTRS{../removable}=="1", \ +KERNEL=="hd*[0-9]", ATTR{../removable}=="1", \ GOTO="no_volume_id" # skip xen virtual hard disks @@ -21,7 +21,7 @@ KERNEL=="hd*[!0-9]", \ IMPORT{program}="ata_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", \ - ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$sysfs{ieee1394_id}" + ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", \ IMPORT{program}="usb_id -x" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", \ @@ -67,7 +67,7 @@ KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # UUID and volume label -KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="no_volume_id" +KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="no_volume_id" IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index 6498a131da..3da6fadf8f 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -13,7 +13,7 @@ # # workaround for devices which do not report media changes -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{removable}=="1", \ +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ OPTIONS+="all_partitions" -- cgit v1.2.3-54-g00ecf From b83b299141ccbe2b60cf49a766a540c43f32167c Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Sun, 27 Aug 2006 02:53:16 +0200 Subject: run_program: close pipe fd's which are connected to child process When udev_log="debug", the children of udev inherit the file descriptors of the pipes used to capture output. If they are not properly closed then udev will not exit until all programs started in the background by the children are terminated or have closed the fds themselves, and this may cause deadlocks with udevsettle. --- udev_utils_run.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/udev_utils_run.c b/udev_utils_run.c index 76a704c52c..2771861cf5 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -151,10 +151,14 @@ int run_program(const char *command, const char *subsystem, close(devnull); } else err("open /dev/null failed: %s", strerror(errno)); - if (outpipe[WRITE_END] > 0) + if (outpipe[WRITE_END] > 0) { dup2(outpipe[WRITE_END], STDOUT_FILENO); - if (errpipe[WRITE_END] > 0) + close(outpipe[WRITE_END]); + } + if (errpipe[WRITE_END] > 0) { dup2(errpipe[WRITE_END], STDERR_FILENO); + close(errpipe[WRITE_END]); + } execv(argv[0], argv); /* we should never reach this */ -- cgit v1.2.3-54-g00ecf From 27b77df44daebbd7597c572343105c16de099233 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 28 Aug 2006 00:29:11 +0200 Subject: update source file headers --- COPYING | 25 ++-- Makefile | 3 +- extras/scsi_id/COPYING | 340 ------------------------------------------------- logging.h | 8 +- udev.c | 6 +- udev.h | 6 +- udev_config.c | 8 +- udev_db.c | 4 +- udev_device.c | 4 +- udev_node.c | 6 +- udev_rules.c | 4 +- udev_rules.h | 6 +- udev_rules_parse.c | 6 +- udev_selinux.c | 4 +- udev_selinux.h | 4 +- udev_sysdeps.c | 4 +- udev_sysdeps.h | 4 +- udev_sysfs.c | 6 +- udev_utils.c | 4 +- udev_utils_file.c | 4 +- udev_utils_run.c | 4 +- udev_utils_string.c | 4 +- udevcontrol.c | 4 +- udevd.c | 5 +- udevd.h | 6 +- udevinfo.c | 6 +- udevmonitor.c | 4 +- udevsettle.c | 4 +- udevstart.c | 12 +- udevtest.c | 4 +- udevtrigger.c | 4 +- 31 files changed, 57 insertions(+), 456 deletions(-) delete mode 100644 extras/scsi_id/COPYING diff --git a/COPYING b/COPYING index 5b6e7c66c2..d511905c16 100644 --- a/COPYING +++ b/COPYING @@ -1,8 +1,8 @@ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to +the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest @@ -303,10 +303,9 @@ the "copyright" line and a pointer to where the full notice is found. 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - + 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., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. @@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General +library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. diff --git a/Makefile b/Makefile index d7801296bd..0027421d01 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -# Makefile for udev # # Copyright (C) 2003-2004 Greg Kroah-Hartman # Copyright (C) 2004-2006 Kay Sievers @@ -14,7 +13,7 @@ # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # VERSION = 098 diff --git a/extras/scsi_id/COPYING b/extras/scsi_id/COPYING deleted file mode 100644 index 60549be514..0000000000 --- a/extras/scsi_id/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - 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; either version 2 of the License, or - (at your option) any later version. - - 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/logging.h b/logging.h index 00b5f23b25..f49f272d74 100644 --- a/logging.h +++ b/logging.h @@ -1,10 +1,8 @@ /* - * logging.h - * * Simple logging functions that can be compiled away into nothing. * - * Copyright (C) 2003,2004 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -17,7 +15,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev.c b/udev.c index 6b454f3157..bbe50eeeb4 100644 --- a/udev.c +++ b/udev.c @@ -1,8 +1,6 @@ /* - * udev.c - * * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev.h b/udev.h index fc22cc76cb..3899669868 100644 --- a/udev.h +++ b/udev.h @@ -1,8 +1,6 @@ /* - * udev.h - * * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2005 Kay Sievers + * Copyright (C) 2003-2006 Kay Sievers * * 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 @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_config.c b/udev_config.c index 204827407d..3d18e59796 100644 --- a/udev_config.c +++ b/udev_config.c @@ -1,8 +1,6 @@ /* - * udev_config.c - * - * Copyright (C) 2003,2004 Greg Kroah-Hartman - * Copyright (C) 2004, 2005 Kay Sievers + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2005 Kay Sievers * * 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 @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_db.c b/udev_db.c index 797d0eeffb..f3c9509dcc 100644 --- a/udev_db.c +++ b/udev_db.c @@ -1,6 +1,4 @@ /* - * udev_db.c - * * Copyright (C) 2003 Greg Kroah-Hartman * Copyright (C) 2004-2005 Kay Sievers * @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_device.c b/udev_device.c index 21af91b443..bc0b33077e 100644 --- a/udev_device.c +++ b/udev_device.c @@ -1,6 +1,4 @@ /* - * udev_device.c - main udev data object - * * Copyright (C) 2004-2006 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_node.c b/udev_node.c index 4ba1c26c5e..e1b62293bb 100644 --- a/udev_node.c +++ b/udev_node.c @@ -1,8 +1,6 @@ /* - * udev-node.c - device node handling - * * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_rules.c b/udev_rules.c index 267c79de03..8a2066d709 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1,6 +1,4 @@ /* - * udev_rules.c - * * Copyright (C) 2003 Greg Kroah-Hartman * Copyright (C) 2003-2006 Kay Sievers * @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_rules.h b/udev_rules.h index dac0dfcbb3..4a9cd58484 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -1,8 +1,6 @@ /* - * udev_rules.h - * * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 5603ee1d11..111fead9ad 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -1,8 +1,6 @@ /* - * udev_rules_parse.c - * * Copyright (C) 2003,2004 Greg Kroah-Hartman - * Copyright (C) 2003-2005 Kay Sievers + * Copyright (C) 2003-2006 Kay Sievers * * 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 @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_selinux.c b/udev_selinux.c index 446fedc3c3..b802e1fc6e 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -1,6 +1,4 @@ /* - * udev_selinux.h - * * Copyright (C) 2004 Daniel Walsh * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_selinux.h b/udev_selinux.h index d9dfeffad0..73567d6cfe 100644 --- a/udev_selinux.h +++ b/udev_selinux.h @@ -1,6 +1,4 @@ /* - * udev_selinux.h - * * Copyright (C) 2004 Daniel Walsh * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ #ifndef _UDEV_SELINUX_H diff --git a/udev_sysdeps.c b/udev_sysdeps.c index 3cd12277cf..0cb2540659 100644 --- a/udev_sysdeps.c +++ b/udev_sysdeps.c @@ -1,6 +1,4 @@ /* - * udev_sysdeps.c - wrapping of libc features and kernel defines - * * Copyright (C) 2003 Greg Kroah-Hartman * Copyright (C) 2005-2006 Kay Sievers * @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_sysdeps.h b/udev_sysdeps.h index 36c86f3356..be97e57b1f 100644 --- a/udev_sysdeps.h +++ b/udev_sysdeps.h @@ -1,5 +1,5 @@ /* - * udev_sysdeps.h - wrapping of libc features and kernel defines + * wrapping of libc features and kernel interfaces * * Copyright (C) 2005-2006 Kay Sievers * @@ -14,7 +14,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_sysfs.c b/udev_sysfs.c index c4afe0cffb..c192696689 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -1,7 +1,5 @@ /* - * udev_sysfs.c - sysfs access - * - * Copyright (C) 2005 Kay Sievers + * Copyright (C) 2005-2006 Kay Sievers * * 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 @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_utils.c b/udev_utils.c index b198892c01..87e7979c68 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -1,6 +1,4 @@ /* - * udev_utils.c - generic stuff used by udev - * * Copyright (C) 2004-2005 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_utils_file.c b/udev_utils_file.c index 6a046e822d..9bf60696d9 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -1,6 +1,4 @@ /* - * udev_utils_file.c - files operations - * * Copyright (C) 2004-2005 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_utils_run.c b/udev_utils_run.c index 2771861cf5..c9bbc97bad 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -1,6 +1,4 @@ /* - * udev_utils_run.c - execute programs from udev and read its output - * * Copyright (C) 2004-2005 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udev_utils_string.c b/udev_utils_string.c index 225e198587..8cda47272f 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -1,6 +1,4 @@ /* - * udev_utils_string.c - string manipulation - * * Copyright (C) 2004-2005 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udevcontrol.c b/udevcontrol.c index 431befe39c..a983f22835 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -1,6 +1,4 @@ /* - * udevcontrol.c - * * Copyright (C) 2005-2006 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udevd.c b/udevd.c index 7c917fd56e..bb956b520c 100644 --- a/udevd.c +++ b/udevd.c @@ -1,10 +1,7 @@ /* - * udevd.c - event listener and serializer - * * Copyright (C) 2004-2006 Kay Sievers * Copyright (C) 2004 Chris Friesen * - * * 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. @@ -16,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udevd.h b/udevd.h index c1f0fd6a12..fce86e7126 100644 --- a/udevd.h +++ b/udevd.h @@ -1,8 +1,6 @@ /* - * udevd.h - * * Copyright (C) 2004 Ling, Xiaofeng - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udevinfo.c b/udevinfo.c index a0a17c40b4..3146a96119 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -1,7 +1,5 @@ /* - * udevinfo.c - fetches stored device information or sysfs attributes - * - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udevmonitor.c b/udevmonitor.c index 6f2844ff15..35c3721f76 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -1,6 +1,4 @@ /* - * udevmonitor.c - * * Copyright (C) 2004-2006 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udevsettle.c b/udevsettle.c index b38968e7df..9e3e03b1af 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -1,6 +1,4 @@ /* - * udevsettle.c - * * Copyright (C) 2006 Kay Sievers * * This program is free software; you can redistribute it and/or modify it @@ -14,7 +12,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udevstart.c b/udevstart.c index d0a1ded2be..6e1cb050c4 100644 --- a/udevstart.c +++ b/udevstart.c @@ -1,13 +1,9 @@ /* - * udevstart.c + * quick and dirty way to populate a /dev directory * + * Copyright (C) 2004 Harald Hoyer * Copyright (C) 2004 Greg Kroah-Hartman - * Copyright (C) 2004 Kay Sievers - * - * Quick and dirty way to populate a /dev with udev if your system - * does not have access to a shell. Based originally on a patch - * from: - * Harald Hoyer + * Copyright (C) 2004-2006 Kay Sievers * * 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 @@ -20,7 +16,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udevtest.c b/udevtest.c index f8010ca5b8..d17157cbd1 100644 --- a/udevtest.c +++ b/udevtest.c @@ -1,6 +1,4 @@ /* - * udevtest.c - * * Copyright (C) 2003-2004 Greg Kroah-Hartman * Copyright (C) 2004-2006 Kay Sievers * @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ diff --git a/udevtrigger.c b/udevtrigger.c index e530a61c0b..09ef60addb 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -1,6 +1,4 @@ /* - * udevtrigger.c - * * Copyright (C) 2004-2006 Kay Sievers * Copyright (C) 2006 Hannes Reinecke * @@ -15,7 +13,7 @@ * * 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 02139, USA. + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -- cgit v1.2.3-54-g00ecf From 7b0859746791a6af264862f420e04d52fe05e767 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 28 Aug 2006 02:38:53 +0200 Subject: udevtest: print header that ENV{} can't work --- udevtest.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/udevtest.c b/udevtest.c index d17157cbd1..2854f7558f 100644 --- a/udevtest.c +++ b/udevtest.c @@ -111,6 +111,11 @@ int main(int argc, char *argv[], char *envp[]) setenv("SUBSYSTEM", udev->dev->subsystem, 1); setenv("ACTION", "add", 1); + printf("This program is for debugging only, it does not create any node,\n" + "or run any program specified by a RUN key. It may show incorrect results,\n" + "if rules match against subsystem specfic kernel event variables.\n" + "\n"); + info("looking at device '%s' from subsystem '%s'", udev->dev->devpath, udev->dev->subsystem); retval = udev_device_event(&rules, udev); if (retval == 0 && !udev->ignore_device && udev_run) { -- cgit v1.2.3-54-g00ecf From 3c2081fcb7e3c5483953aa8226112360fcb1aed7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 2 Sep 2006 14:26:44 +0200 Subject: update TODO --- TODO | 8 +++----- logging.h | 2 +- udev_sysdeps.c | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 7954deb500..a08cb84f7b 100644 --- a/TODO +++ b/TODO @@ -4,20 +4,18 @@ These things would be nice to have: any of the links at that time These things will change in future udev versions: - o remove /sys prefix from symlinks in /dev/.udev/{queue,failed} + o use zero sized files instead of symlinks in /dev/.udev/{queue,failed} (broken tools search /dev for files and get lost following to /sys and stat() sysfs files million times) o make DRIVER== to match only the event device (DRIVERS must be used, we currently translate it to DRIVERS and print - an error if DRIVER is used) - - o switch to fnmatch() instead of our own implementation + a warning if DRIVER is used) o warn if PHYSDEV* keys are used in ENV keys (they are deprecated and will be removed from a future kernel) - o warn if "/device/" is used in a ATTR, ATTRS, $sysfs key + o warn if "device/" is used in a ATTR{}, ATTRS{}, $attr{} key (the device link must not be used in rules or tools, udev resolves the link and makes the devices available as parents, which can be matched with the normal keys) diff --git a/logging.h b/logging.h index f49f272d74..6e1d5a20ef 100644 --- a/logging.h +++ b/logging.h @@ -1,5 +1,5 @@ /* - * Simple logging functions that can be compiled away into nothing. + * simple logging functions that can be expanded into nothing * * Copyright (C) 2003-2004 Greg Kroah-Hartman * Copyright (C) 2004-2006 Kay Sievers diff --git a/udev_sysdeps.c b/udev_sysdeps.c index 0cb2540659..9447cca936 100644 --- a/udev_sysdeps.c +++ b/udev_sysdeps.c @@ -44,7 +44,6 @@ size_t strlcpy(char *dst, const char *src, size_t size) /* If size == 0 there is no space for a final null... */ if (size) *q = '\0'; - return bytes; } -- cgit v1.2.3-54-g00ecf From fc89fe7edf83af465c1835d8eb985e4298ad2417 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Sep 2006 03:04:20 +0200 Subject: udevtrigger: options to filter by subsystem and sysfs attribute --- udevd.c | 12 ++-- udevtrigger.8 | 18 +++++- udevtrigger.c | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++----- udevtrigger.xml | 41 ++++++++++++- 4 files changed, 228 insertions(+), 27 deletions(-) diff --git a/udevd.c b/udevd.c index bb956b520c..0702f5e2cb 100644 --- a/udevd.c +++ b/udevd.c @@ -926,12 +926,6 @@ int main(int argc, char *argv[], char *envp[]) selinux_init(); dbg("version %s", UDEV_VERSION); - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - err("root privileges required"); - goto exit; - } - /* parse commandline options */ for (i = 1 ; i < argc; i++) { char *arg = argv[i]; @@ -946,6 +940,12 @@ int main(int argc, char *argv[], char *envp[]) } } + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); + err("root privileges required"); + goto exit; + } + /* init sockets to receive events */ if (init_udevd_socket() < 0) { if (errno == EADDRINUSE) { diff --git a/udevtrigger.8 b/udevtrigger.8 index 1e14a7b101..4525aeeddf 100644 --- a/udevtrigger.8 +++ b/udevtrigger.8 @@ -14,20 +14,32 @@ udevtrigger \- request kernel devices events for coldplug .SH "SYNOPSIS" .HP 12 -\fBudevtrigger\fR [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] [\fB\-\-retry\-failed\fR] +\fBudevtrigger\fR [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] [\fB\-\-retry\-failed\fR] [\fB\-\-help\fR] [\fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR] [\fB\-\-attr\-nomatch=\fR\fB\fIattribute=value\fR\fR] .SH "DESCRIPTION" .PP Trigger kernel device uevents to replay missing events at system coldplug. .SH "OPTIONS" .TP 3n \fB\-\-verbose\fR -Print the list of devices found in sysfs. +Print the list of devices which will be triggered. .TP 3n \fB\-\-dry\-run\fR Do not actually trigger the event. .TP 3n \fB\-\-retry\-failed\fR -Trigger events which are failed during a previous run. +Trigger only the events which are failed during a previous run. +.TP 3n +\fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR +Trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and supports shell style pattern matching. +.TP 3n +\fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR +Do not trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and supports shell style pattern matching. +.TP 3n +\fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR +Trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. This option can be specified multiple times. +.TP 3n +\fB\-\-attr\-nomatch\fR\fB\fIattribute=value\fR\fR +Do not trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. This option can be specified multiple times. .SH "ENVIRONMENT" .TP 3n \fBUDEV_LOG\fR diff --git a/udevtrigger.c b/udevtrigger.c index 09ef60addb..9a1e82887b 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -22,19 +22,18 @@ #include #include #include +#include #include #include #include #include +#include #include #include #include "udev.h" #include "udevd.h" -static int verbose; -static int dry_run; - #ifdef USE_LOG void log_message(int priority, const char *format, ...) { @@ -49,6 +48,9 @@ void log_message(int priority, const char *format, ...) } #endif +static int verbose; +static int dry_run; + /* list of devices that we should run last due to any one of a number of reasons */ static char *last_list[] = { "/class/block/md", @@ -69,6 +71,11 @@ LIST_HEAD(device_first_list); LIST_HEAD(device_default_list); LIST_HEAD(device_last_list); +LIST_HEAD(filter_subsytem_match_list); +LIST_HEAD(filter_subsytem_nomatch_list); +LIST_HEAD(filter_attr_match_list); +LIST_HEAD(filter_attr_nomatch_list); + static int device_list_insert(const char *path) { struct list_head *device_list = &device_default_list; @@ -164,6 +171,93 @@ static int is_device(const char *path) return 1; } +static int subsystem_filtered(const char *subsystem) +{ + struct name_entry *loop_name; + + /* skip devices matching the listed subsystems */ + list_for_each_entry(loop_name, &filter_subsytem_nomatch_list, node) + if (fnmatch(subsystem, loop_name->name, 0) == 0) + return 1; + + /* skip devices not matching the listed subsystems */ + if (!list_empty(&filter_subsytem_match_list)) { + list_for_each_entry(loop_name, &filter_subsytem_match_list, node) + if (fnmatch(subsystem, loop_name->name, 0) == 0) + return 0; + return 1; + } + + return 0; +} + +static int attr_match(const char *path, const char *attr_value) +{ + char attr[NAME_SIZE]; + char file[PATH_SIZE]; + char *match_value; + + strlcpy(attr, attr_value, sizeof(attr)); + + /* separate attr and match value */ + match_value = strchr(attr, '='); + if (match_value != NULL) { + match_value[0] = '\0'; + match_value = &match_value[1]; + } + + strlcpy(file, path, sizeof(file)); + strlcat(file, "/", sizeof(file)); + strlcat(file, attr, sizeof(file)); + + if (match_value != NULL) { + /* match file content */ + char value[NAME_SIZE]; + int fd; + ssize_t size; + + fd = open(file, O_RDONLY); + if (fd < 0) + return 0; + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + return 0; + value[size] = '\0'; + remove_trailing_chars(value, '\n'); + + /* match if attribute value matches */ + if (fnmatch(match_value, value, 0) == 0) + return 1; + } else { + /* match if attribute exists */ + struct stat statbuf; + + if (stat(file, &statbuf) == 0) + return 1; + } + return 0; +} + +static int attr_filtered(const char *path) +{ + struct name_entry *loop_name; + + /* skip devices matching the listed sysfs attributes */ + list_for_each_entry(loop_name, &filter_attr_nomatch_list, node) + if (attr_match(path, loop_name->name)) + return 1; + + /* skip devices not matching the listed sysfs attributes */ + if (!list_empty(&filter_attr_match_list)) { + list_for_each_entry(loop_name, &filter_attr_match_list, node) + if (attr_match(path, loop_name->name)) + return 0; + return 1; + } + return 0; +} + static void scan_bus(void) { char base[PATH_SIZE]; @@ -183,6 +277,9 @@ static void scan_bus(void) if (dent->d_name[0] == '.') continue; + if (subsystem_filtered(dent->d_name)) + continue; + strlcpy(dirname, base, sizeof(dirname)); strlcat(dirname, "/", sizeof(dirname)); strlcat(dirname, dent->d_name, sizeof(dirname)); @@ -200,7 +297,8 @@ static void scan_bus(void) strlcpy(dirname2, dirname, sizeof(dirname2)); strlcat(dirname2, "/", sizeof(dirname2)); strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - + if (attr_filtered(dirname2)) + continue; if (is_device(dirname2)) device_list_insert(dirname2); } @@ -224,6 +322,9 @@ static void scan_block(void) if (stat(base, &statbuf) == 0) return; + if (subsystem_filtered("block")) + return; + strlcpy(base, sysfs_path, sizeof(base)); strlcat(base, "/block", sizeof(base)); @@ -240,6 +341,8 @@ static void scan_block(void) strlcpy(dirname, base, sizeof(dirname)); strlcat(dirname, "/", sizeof(dirname)); strlcat(dirname, dent->d_name, sizeof(dirname)); + if (attr_filtered(dirname)) + continue; if (is_device(dirname)) device_list_insert(dirname); else @@ -260,6 +363,8 @@ static void scan_block(void) strlcpy(dirname2, dirname, sizeof(dirname2)); strlcat(dirname2, "/", sizeof(dirname2)); strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (attr_filtered(dirname2)) + continue; if (is_device(dirname2)) device_list_insert(dirname2); } @@ -289,6 +394,9 @@ static void scan_class(void) if (dent->d_name[0] == '.') continue; + if (subsystem_filtered(dent->d_name)) + continue; + strlcpy(dirname, base, sizeof(dirname)); strlcat(dirname, "/", sizeof(dirname)); strlcat(dirname, dent->d_name, sizeof(dirname)); @@ -306,6 +414,8 @@ static void scan_class(void) strlcpy(dirname2, dirname, sizeof(dirname2)); strlcat(dirname2, "/", sizeof(dirname2)); strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (attr_filtered(dirname2)) + continue; if (is_device(dirname2)) device_list_insert(dirname2); } @@ -356,36 +466,73 @@ static void scan_failed(void) int main(int argc, char *argv[], char *envp[]) { - int i; int failed = 0; + int option; + int longindex; + struct option options[] = { + { "verbose", 0, NULL, 'v' }, + { "dry-run", 0, NULL, 'n' }, + { "retry-failed", 0, NULL, 'F' }, + { "help", 0, NULL, 'h' }, + { "subsystem-match", 1, NULL, 's' }, + { "subsystem-nomatch", 1, NULL, 'S' }, + { "attr-match", 1, NULL, 'a' }, + { "attr-nomatch", 1, NULL, 'A' }, + {} + }; logging_init("udevtrigger"); udev_config_init(); dbg("version %s", UDEV_VERSION); sysfs_init(); - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; + while (1) { + option = getopt_long(argc, argv, "vnFhs:S:a:A:", options, &longindex); + if (option == -1) + break; - if (strcmp(arg, "--verbose") == 0 || strcmp(arg, "-v") == 0) { + switch (option) { + case 'v': verbose = 1; - } else if (strcmp(arg, "--dry-run") == 0 || strcmp(arg, "-n") == 0) { + break; + case 'n': dry_run = 1; - } else if (strcmp(arg, "--retry-failed") == 0 || strcmp(arg, "-F") == 0) { + break; + case 'F': failed = 1; - } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { - printf("Usage: udevtrigger [--help] [--verbose] [--dry-run] [--retry-failed]\n"); + break; + case 's': + name_list_add(&filter_subsytem_match_list, optarg, 0); + break; + case 'S': + name_list_add(&filter_subsytem_nomatch_list, optarg, 0); + break; + case 'a': + name_list_add(&filter_attr_match_list, optarg, 0); + break; + case 'A': + name_list_add(&filter_attr_nomatch_list, optarg, 0); + break; + case 'h': + printf("Usage: udevtrigger OPTIONS\n" + " --verbose print the list of devices which will be triggered\n" + " --dry-run do not actually trigger the event\n" + " --retry-failed trigger only the events which are failed during a previous run\n" + " --subsystem-match select only devices from the specified subystem\n" + " --subsystem-nomatch exclude devices from the specified subystem\n" + " --attr-match=]> select only devices with a matching sysfs attribute\n" + " --attr-nomatch=]> exclude devices with a matching sysfs attribute\n" + " --help print this text\n" + "\n"); + goto exit; + default: goto exit; - } else { - fprintf(stderr, "unrecognized option '%s'\n", arg); - err("unrecognized option '%s'\n", arg); } } if (failed) scan_failed(); else { - /* default action */ scan_bus(); scan_class(); scan_block(); @@ -393,6 +540,11 @@ int main(int argc, char *argv[], char *envp[]) exec_lists(); exit: + name_list_cleanup(&filter_subsytem_match_list); + name_list_cleanup(&filter_subsytem_nomatch_list); + name_list_cleanup(&filter_attr_match_list); + name_list_cleanup(&filter_attr_nomatch_list); + sysfs_cleanup(); logging_close(); return 0; diff --git a/udevtrigger.xml b/udevtrigger.xml index 170fcd6291..60a7b1eaf7 100644 --- a/udevtrigger.xml +++ b/udevtrigger.xml @@ -28,6 +28,11 @@ + + + + + @@ -40,7 +45,7 @@ - Print the list of devices found in sysfs. + Print the list of devices which will be triggered. @@ -52,7 +57,39 @@ - Trigger events which are failed during a previous run. + Trigger only the events which are failed during a previous run. + + + + + + Trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Do not trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Trigger events for devices with a matching sysfs attribute. If a value is specified + along with the attribute name, the content of the attribute is matched against the given + value using shell style pattern matching. If no value is specified, the existence of the + sysfs attribute is checked. This option can be specified multiple times. + + + + + + Do not trigger events for devices with a matching sysfs attribute. If a value is + specified along with the attribute name, the content of the attribute is matched against + the given value using shell style pattern matching. If no value is specified, the existence + of the sysfs attribute is checked. This option can be specified multiple times. -- cgit v1.2.3-54-g00ecf From a44a30f6642ce49280012c551b532936a3a68729 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Sep 2006 03:36:20 +0200 Subject: udevtrigger: remove unused longindex --- udevtrigger.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/udevtrigger.c b/udevtrigger.c index 9a1e82887b..571bcadfc5 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -468,7 +468,6 @@ int main(int argc, char *argv[], char *envp[]) { int failed = 0; int option; - int longindex; struct option options[] = { { "verbose", 0, NULL, 'v' }, { "dry-run", 0, NULL, 'n' }, @@ -487,7 +486,7 @@ int main(int argc, char *argv[], char *envp[]) sysfs_init(); while (1) { - option = getopt_long(argc, argv, "vnFhs:S:a:A:", options, &longindex); + option = getopt_long(argc, argv, "vnFhs:S:a:A:", options, NULL); if (option == -1) break; @@ -518,8 +517,8 @@ int main(int argc, char *argv[], char *envp[]) " --verbose print the list of devices which will be triggered\n" " --dry-run do not actually trigger the event\n" " --retry-failed trigger only the events which are failed during a previous run\n" - " --subsystem-match select only devices from the specified subystem\n" - " --subsystem-nomatch exclude devices from the specified subystem\n" + " --subsystem-match= select only devices from the specified subystem\n" + " --subsystem-nomatch= exclude devices from the specified subystem\n" " --attr-match=]> select only devices with a matching sysfs attribute\n" " --attr-nomatch=]> exclude devices with a matching sysfs attribute\n" " --help print this text\n" -- cgit v1.2.3-54-g00ecf From 11f1bb5ab42571fae5cc607d42b8d918c9e170ab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Sep 2006 04:05:20 +0200 Subject: udevinfo: use long options --- udevinfo.8 | 26 +++++++++++++------------- udevinfo.c | 53 ++++++++++++++++++++++++++++++----------------------- udevinfo.xml | 53 ++++++++++++++++++++++++----------------------------- 3 files changed, 67 insertions(+), 65 deletions(-) diff --git a/udevinfo.8 b/udevinfo.8 index 4430f5d9d3..01c9090031 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -14,17 +14,17 @@ udevinfo \- query device information from the udev database .SH "SYNOPSIS" .HP 9 -\fBudevinfo\fR [\fB\-q\ \fR\fB\fIquery\-type\fR\fR] [\fB\-a\ \fR] [\fB\-p\ \fR\fB\fIdevpath\fR\fR] [\fB\-n\ \fR\fB\fInode\fR\fR] [\fB\-r\fR] [\fB\-e\fR] [\fB\-V\fR] [\fB\-h\fR] +\fBudevinfo\fR [\fB\-\-query=\fR\fB\fIquery\-type\fR\fR] [\fB\-\-attribute\-walk\fR] [\fB\-\-path=\fR\fB\fIdevpath\fR\fR] [\fB\-\-name=\fR\fB\fInode\fR\fR] [\fB\-\-root\fR] [\fB\-\-export\-db\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] .SH "DESCRIPTION" .PP udevinfo queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device. .SH "OPTIONS" .TP 3n -\fB\-q\fR +\fB\-\-query=\fR\fB\fItype\fR\fR Query the database for specified type of device data. It needs the -\fB\-p\fR +\fB\-\-path\fR or -\fB\-n\fR +\fB\-\-name\fR to identify the specified device. Valid queries are: \fBname\fR, \fBsymlink\fR, @@ -32,27 +32,27 @@ to identify the specified device. Valid queries are: \fBenv\fR, \fBall\fR. .TP 3n -\fB\-a\fR -Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules. -.TP 3n -\fB\-p \fR\fB\fIdevpath\fR\fR +\fB\-\-path=\fR\fB\fIdevpath\fR\fR The devpath of the device to query. .TP 3n -\fB\-n \fR\fB\fInode\fR\fR +\fB\-\-name=\fR\fB\fInode\fR\fR The name of the device node or a symlink to query .TP 3n -\fB\-r\fR +\fB\-\-root\fR The udev root directory: \fI/dev\fR. If used in conjunction with a \fBname\fR or \fBsymlink\fR -query, the query returns the absolute path. +query, the query returns the absolute path including the root directory. +.TP 3n +\fB\-\-attribute\-walk\fR +Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules. .TP 3n -\fB\-e\fR +\fB\-\-export\fR Export the content of the udev database. .TP 3n -\fB\-h\fR +\fB\-\-help\fR Print help text. .SH "AUTHOR" .PP diff --git a/udevinfo.c b/udevinfo.c index 3146a96119..d1d77152c3 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "udev.h" @@ -167,6 +168,18 @@ int main(int argc, char *argv[], char *envp[]) struct udevice *udev; int root = 0; + struct option options[] = { + { "name", 1, NULL, 'n' }, + { "path", 1, NULL, 'p' }, + { "query", 1, NULL, 'q' }, + { "attribute-walk", 0, NULL, 'a' }, + { "export-db", 0, NULL, 'e' }, + { "root", 0, NULL, 'r' }, + { "version", 0, NULL, 'V' }, + { "help", 0, NULL, 'h' }, + {} + }; + enum action_type { ACTION_NONE, ACTION_QUERY, @@ -199,9 +212,8 @@ int main(int argc, char *argv[], char *envp[]) } /* get command line options */ - opterr = 0; while (1) { - option = getopt(argc, argv, ":aden:p:q:rVh"); + option = getopt_long(argc, argv, "aden:p:q:rVh", options, NULL); if (option == -1) break; @@ -267,30 +279,25 @@ int main(int argc, char *argv[], char *envp[]) printf("udevinfo, version %s\n", UDEV_VERSION); goto exit; case 'h': - printf("Usage: udevinfo [-anpqrVh]\n" - " -q TYPE query database for the specified value:\n" - " 'name' name of device node\n" - " 'symlink' pointing to node\n" - " 'path' sysfs device path\n" - " 'env' the device related imported environment\n" - " 'all' all values\n" + printf("Usage: udevinfo OPTIONS\n" + " --query= query database for the specified value:\n" + " name name of device node\n" + " symlink pointing to node\n" + " path sysfs device path\n" + " env the device related imported environment\n" + " all all values\n" "\n" - " -p PATH sysfs device path used for query or chain\n" - " -n NAME node/symlink name used for query\n" + " --path= sysfs device path used for query or chain\n" + " --name= node or symlink name used for query\n" "\n" - " -r prepend to query result or print udev_root\n" - " -a print all SYSFS_attributes along the device chain\n" - " -e export the content of the udev database\n" - " -V print udev version\n" - " -h print this help text\n" + " --root prepend to query result or print udev_root\n" + " --attribute-walk print all SYSFS_attributes along the device chain\n" + " --export-db export the content of the udev database\n" + " --verision print udev version\n" + " --help print this text\n" "\n"); goto exit; - case ':': - fprintf(stderr, "missing argument for '%c'\n", optopt); - goto exit; - case '?': default: - fprintf(stderr, "unrecognized option '%c'\n", optopt); goto exit; } } @@ -315,7 +322,7 @@ int main(int argc, char *argv[], char *envp[]) } udev_db_get_device(udev, devpath); } else { - fprintf(stderr, "query needs device path(-p) or node name(-n) specified\n"); + fprintf(stderr, "query needs --path or node --name specified\n"); rc = 4; goto exit; } @@ -366,7 +373,7 @@ int main(int argc, char *argv[], char *envp[]) } print_device_chain(devpath); } else { - fprintf(stderr, "attribute walk needs device path(-p) or node name(-n) specified\n"); + fprintf(stderr, "attribute walk needs --path or node --name specified\n"); rc = 5; goto exit; } diff --git a/udevinfo.xml b/udevinfo.xml index 9bd0b8dc17..6c08eee58f 100644 --- a/udevinfo.xml +++ b/udevinfo.xml @@ -25,14 +25,14 @@ udevinfo - - - - - - - - + + + + + + + + @@ -46,57 +46,52 @@ OPTIONS - + Query the database for specified type of device data. It needs the - or to identify the specified + or to identify the specified device. Valid queries are: name, symlink, path, env, all. - - - - - Print all sysfs properties of the specified device that can be used - in udev rules to match the specified device. It prints all devices - along the chain, up to the root of sysfs that can be used in udev rules. - - - - + The devpath of the device to query. - - + The name of the device node or a symlink to query - - + The udev root directory: /dev. If used in conjunction with a name or symlink query, the - query returns the absolute path. + query returns the absolute path including the root directory. + + + + + + Print all sysfs properties of the specified device that can be used + in udev rules to match the specified device. It prints all devices + along the chain, up to the root of sysfs that can be used in udev rules. - - + Export the content of the udev database. - + Print help text. -- cgit v1.2.3-54-g00ecf From 051445e078ab1a6d0cbbc1bd7f1a6fbd80e8bed1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Sep 2006 04:44:33 +0200 Subject: udevd: use files instead of symlinks for /dev/.udev/queue,failed --- TODO | 4 ---- udevd.c | 9 ++++----- udevtrigger.c | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/TODO b/TODO index a08cb84f7b..8667b87e91 100644 --- a/TODO +++ b/TODO @@ -4,10 +4,6 @@ These things would be nice to have: any of the links at that time These things will change in future udev versions: - o use zero sized files instead of symlinks in /dev/.udev/{queue,failed} - (broken tools search /dev for files and get lost following to /sys - and stat() sysfs files million times) - o make DRIVER== to match only the event device (DRIVERS must be used, we currently translate it to DRIVERS and print a warning if DRIVER is used) diff --git a/udevd.c b/udevd.c index 0702f5e2cb..a21d2ab77d 100644 --- a/udevd.c +++ b/udevd.c @@ -155,9 +155,9 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st { char filename[PATH_SIZE]; char filename_failed[PATH_SIZE]; - char target[PATH_SIZE]; size_t start, end, i; struct udevd_uevent_msg *loop_msg; + int fd; /* add location of queue files */ strlcpy(filename, udev_root, sizeof(filename)); @@ -189,11 +189,10 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st case EVENT_QUEUED: unlink(filename_failed); delete_path(filename_failed); - - strlcpy(target, sysfs_path, sizeof(target)); - strlcat(target, msg->devpath, sizeof(target)); create_path(filename); - symlink(target, filename); + fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); + if (fd > 0) + close(fd); return; case EVENT_FINISHED: case EVENT_FAILED: diff --git a/udevtrigger.c b/udevtrigger.c index 571bcadfc5..64a2ebdd72 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -433,30 +433,30 @@ static void scan_failed(void) struct dirent *dent; strlcpy(base, udev_root, sizeof(base)); - strlcat(base, "/", sizeof(base)); - strlcat(base, EVENT_FAILED_DIR, sizeof(base)); + strlcat(base, "/" EVENT_FAILED_DIR, sizeof(base)); dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char linkname[PATH_SIZE]; - char target[PATH_SIZE]; - int len; + char device[PATH_SIZE]; + size_t start, end, i; if (dent->d_name[0] == '.') continue; - strlcpy(linkname, base, sizeof(linkname)); - strlcat(linkname, "/", sizeof(linkname)); - strlcat(linkname, dent->d_name, sizeof(linkname)); + strlcpy(device, sysfs_path, sizeof(device)); + start = strlcat(device, "/", sizeof(device)); + end = strlcat(device, dent->d_name, sizeof(device)); + if (end > sizeof(device)) + end = sizeof(device); - len = readlink(linkname, target, sizeof(target)); - if (len <= 0) - continue; - target[len] = '\0'; + /* replace PATH_TO_NAME_CHAR with '/' */ + for (i = start; i < end; i++) + if (device[i] == PATH_TO_NAME_CHAR) + device[i] = '/'; - if (is_device(target)) - device_list_insert(target); + if (is_device(device)) + device_list_insert(device); else continue; } -- cgit v1.2.3-54-g00ecf From 7c27c752a2c08f78c9e7043c3d2eefdd846c8da3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Sep 2006 05:45:51 +0200 Subject: udevtrigger: fix pattern match --- udevtrigger.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/udevtrigger.c b/udevtrigger.c index 64a2ebdd72..d332e088ca 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -177,13 +177,13 @@ static int subsystem_filtered(const char *subsystem) /* skip devices matching the listed subsystems */ list_for_each_entry(loop_name, &filter_subsytem_nomatch_list, node) - if (fnmatch(subsystem, loop_name->name, 0) == 0) + if (fnmatch(loop_name->name, subsystem, 0) == 0) return 1; /* skip devices not matching the listed subsystems */ if (!list_empty(&filter_subsytem_match_list)) { list_for_each_entry(loop_name, &filter_subsytem_match_list, node) - if (fnmatch(subsystem, loop_name->name, 0) == 0) + if (fnmatch(loop_name->name, subsystem, 0) == 0) return 0; return 1; } @@ -514,14 +514,17 @@ int main(int argc, char *argv[], char *envp[]) break; case 'h': printf("Usage: udevtrigger OPTIONS\n" - " --verbose print the list of devices which will be triggered\n" - " --dry-run do not actually trigger the event\n" - " --retry-failed trigger only the events which are failed during a previous run\n" - " --subsystem-match= select only devices from the specified subystem\n" - " --subsystem-nomatch= exclude devices from the specified subystem\n" - " --attr-match=]> select only devices with a matching sysfs attribute\n" - " --attr-nomatch=]> exclude devices with a matching sysfs attribute\n" - " --help print this text\n" + " --verbose print the list of devices while running\n" + " --dry-run do not actually trigger the events\n" + " --retry-failed trigger only the events which have been\n" + " marked as failed during a previous run\n" + " --subsystem-match= trigger devices from a matching subystem\n" + " --subsystem-nomatch= exclude devices from a matching subystem\n" + " --attr-match=]> trigger devices with a matching sysfs\n" + " attribute\n" + " --attr-nomatch=]> exclude devices with a matching sysfs\n" + " attribute\n" + " --help print this text\n" "\n"); goto exit; default: -- cgit v1.2.3-54-g00ecf From ee6b4b95015b1641d55d1ea75242491f90a69843 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Sep 2006 05:46:52 +0200 Subject: reorder options in udevinfo man page --- udevinfo.8 | 2 +- udevinfo.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udevinfo.8 b/udevinfo.8 index 01c9090031..65c4e3b3de 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -14,7 +14,7 @@ udevinfo \- query device information from the udev database .SH "SYNOPSIS" .HP 9 -\fBudevinfo\fR [\fB\-\-query=\fR\fB\fIquery\-type\fR\fR] [\fB\-\-attribute\-walk\fR] [\fB\-\-path=\fR\fB\fIdevpath\fR\fR] [\fB\-\-name=\fR\fB\fInode\fR\fR] [\fB\-\-root\fR] [\fB\-\-export\-db\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] +\fBudevinfo\fR [\fB\-\-query=\fR\fB\fIquery\-type\fR\fR] [\fB\-\-path=\fR\fB\fIdevpath\fR\fR] [\fB\-\-name=\fR\fB\fInode\fR\fR] [\fB\-\-root\fR] [\fB\-\-attribute\-walk\fR] [\fB\-\-export\-db\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] .SH "DESCRIPTION" .PP udevinfo queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device. diff --git a/udevinfo.xml b/udevinfo.xml index 6c08eee58f..77432f9c8d 100644 --- a/udevinfo.xml +++ b/udevinfo.xml @@ -26,10 +26,10 @@ udevinfo - + -- cgit v1.2.3-54-g00ecf From c3d6ca8767427b4b0ba9248a7787510903e7d34a Mon Sep 17 00:00:00 2001 From: Greg KH Date: Sun, 3 Sep 2006 06:09:40 +0200 Subject: update Gentoo rules --- etc/udev/gentoo/udev.rules | 102 +++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 64 deletions(-) diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 24f67be85a..bc1c84d4e5 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -33,14 +33,14 @@ KERNEL=="ircomm*", NAME="%k", GROUP="tty" SUBSYSTEM=="block", GROUP="disk" # cdrom symlinks and other good cdrom naming -BUS=="ide", KERNEL=="hd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" -BUS=="scsi", KERNEL="sr[0-9]*", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" -BUS=="scsi", KERNEL="scd[a-z]", ACTION=="add", IMPORT="/sbin/cdrom_id --export $tempnode" -BUS=="scsi", KERNEL="sg[0-9]*", ACTION=="add", DRIVER=="sr", GROUP="cdrom" -ENV{ID_CDROM}=="?*", SYMLINK+="cdrom%e", GROUP="cdrom" -ENV{ID_CDROM_CD_RW}=="?*", SYMLINK+="cdrw%e" -ENV{ID_CDROM_DVD}=="?*", SYMLINK+="dvd%e" -ENV{ID_CDROM_DVD_R}=="?*", SYMLINK+="dvdrw%e" +BUS=="ide", KERNEL=="hd[a-z]", ACTION=="add", IMPORT="cdrom_id --export $tempnode" +BUS=="scsi", KERNEL=="sr[0-9]*", ACTION=="add", IMPORT="cdrom_id --export $tempnode" +BUS=="scsi", KERNEL=="scd[a-z]", ACTION=="add", IMPORT="cdrom_id --export $tempnode" +BUS=="scsi", KERNEL=="sg[0-9]*", ACTION=="add", DRIVERS=="sr", GROUP="cdrom" +ENV{ID_CDROM}=="?*", PROGRAM="seq_node.sh %r %k cdrom", SYMLINK+="%c", GROUP="cdrom" +ENV{ID_CDROM_CD_RW}=="?*", PROGRAM="seq_node.sh %r %k cdrw", SYMLINK+="%c" +ENV{ID_CDROM_DVD}=="?*", PROGRAM="seq_node.sh %r %k dvd", SYMLINK+="%c" +ENV{ID_CDROM_DVD_R}=="?*", PROGRAM="seq_node.sh %r %k dvdrw", SYMLINK+="%c" # disk devices KERNEL=="sd*", NAME="%k", GROUP="disk" @@ -48,11 +48,11 @@ KERNEL=="dasd*", NAME="%k", GROUP="disk" KERNEL=="ataraid*", NAME="%k", GROUP="disk" # compaq smart array -KERNEL=="cciss*", PROGRAM="raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" -KERNEL=="ida*", PROGRAM="raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +KERNEL=="cciss*", NAME="%k" +KERNEL=="ida*", NAME="%k" # mylex -KERNEL=="rd*", PROGRAM="raid-devfs.sh %k", NAME="%c{1}", SYMLINK+="%k" +KERNEL=="rd*", NAME="%k" # dri devices KERNEL=="card*", NAME="dri/card%n", GROUP="video" @@ -242,68 +242,42 @@ KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" -# tpm devices -KERNEL=="tpm*", NAME="%k", OWNER="tss", GROUP="tss", MODE="0600" - -####################################### -# Persistant block device stuff - begin -####################################### - -# Skip all of this if we are not adding a block device -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" - -# skip accessing removable ide devices, cause the ide drivers are horrible broken -BUS=="ide", SYSFS{removable}="1", GOTO="no_volume_id" -BUS=="ide", SYSFS{../removable}="1", GOTO="no_volume_id" - -# persistent disk device links /dev/disk/ -KERNEL=="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]", SYSFS{ieee1394_id}=="*", IMPORT="/bin/echo -e 'ID_SERIAL=$sysfs{ieee1394_id}\nID_BUS=ieee1394'" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/usb_id -x" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -s %p -d %N" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="", IMPORT="/sbin/scsi_id -g -x -a -s %p -d %N" -KERNEL=="sd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# Skip id for ram / loop / fd -KERNEL=="ram*", GOTO="no_volume_id" -KERNEL=="loop*", GOTO="no_volume_id" -KERNEL=="fd*", GOTO="no_volume_id" - -KERNEL=="*[!0-9]", ENV{ID_TYPE}=="?*", IMPORT="/sbin/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# volume-label/uuid -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="no_volume_id" -KERNEL=="sr*", GOTO="no_volume_id" -KERNEL=="*[0-9]", IMPORT="/sbin/vol_id --export $tempnode" -KERNEL=="*[0-9]", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -KERNEL=="*[0-9]", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -LABEL="no_volume_id" - -LABEL="persistent_end" - -##################################### -# Persistant block device stuff - end -##################################### # usbfs-like device nodes SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" +# Module autoloading + +# Autoload modules that lack aliases but have them defined inutoload modules +SYSFS{modalias}=="?*", ACTION=="add", RUN+="/sbin/modprobe $env{MODALIAS}" + +# /etc/modprobe.conf. +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" +# If you have problems with some pnp modules being loaded, please enter the +# following aliases into the modprobe configuration files. These are needed by +# udev to autoload some modules +# alias pnp:dPNP0510 irtty-sir +# alias pnp:dPNP0511 irtty-sir +# alias pnp:dPNP0700 floppy +# alias pnp:dPNP0800 pcspkr +# alias pnp:dPNP0b00 rtc +# alias pnp:dPNP0303 atkbd +# alias pnp:dPNP0f13 psmouse +# alias pnp:dPNPb02f analog + + + +# Load firmware +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" + + # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems # run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart -ENV{UDEVD_EVENT}=="1", RUN+="/sbin/udev_run_hotplugd $env{SUBSYSTEM}" +ENV{UDEVD_EVENT}=="1", RUN+="udev_run_hotplugd $env{SUBSYSTEM}" # always run /etc/dev.d/ stuff for now. -RUN+="/sbin/udev_run_devd $env{SUBSYSTEM}" +RUN+="udev_run_devd $env{SUBSYSTEM}" # debugging monitor RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From e97717bac286ce7b13f20f95a56281807d9feeb1 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Sun, 3 Sep 2006 14:12:51 +0200 Subject: make struct option arrays static const --- udevinfo.c | 2 +- udevtrigger.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index d1d77152c3..dca4616958 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -168,7 +168,7 @@ int main(int argc, char *argv[], char *envp[]) struct udevice *udev; int root = 0; - struct option options[] = { + static const struct option options[] = { { "name", 1, NULL, 'n' }, { "path", 1, NULL, 'p' }, { "query", 1, NULL, 'q' }, diff --git a/udevtrigger.c b/udevtrigger.c index d332e088ca..2e001db5c9 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -468,7 +468,7 @@ int main(int argc, char *argv[], char *envp[]) { int failed = 0; int option; - struct option options[] = { + static const struct option options[] = { { "verbose", 0, NULL, 'v' }, { "dry-run", 0, NULL, 'n' }, { "retry-failed", 0, NULL, 'F' }, -- cgit v1.2.3-54-g00ecf From f14326adfe13d244b40286357655958ed52e9458 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Sun, 3 Sep 2006 14:13:11 +0200 Subject: fix "subsytem" typo --- udevtrigger.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/udevtrigger.c b/udevtrigger.c index 2e001db5c9..bf5ec25aca 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -71,8 +71,8 @@ LIST_HEAD(device_first_list); LIST_HEAD(device_default_list); LIST_HEAD(device_last_list); -LIST_HEAD(filter_subsytem_match_list); -LIST_HEAD(filter_subsytem_nomatch_list); +LIST_HEAD(filter_subsystem_match_list); +LIST_HEAD(filter_subsystem_nomatch_list); LIST_HEAD(filter_attr_match_list); LIST_HEAD(filter_attr_nomatch_list); @@ -176,13 +176,13 @@ static int subsystem_filtered(const char *subsystem) struct name_entry *loop_name; /* skip devices matching the listed subsystems */ - list_for_each_entry(loop_name, &filter_subsytem_nomatch_list, node) + list_for_each_entry(loop_name, &filter_subsystem_nomatch_list, node) if (fnmatch(loop_name->name, subsystem, 0) == 0) return 1; /* skip devices not matching the listed subsystems */ - if (!list_empty(&filter_subsytem_match_list)) { - list_for_each_entry(loop_name, &filter_subsytem_match_list, node) + if (!list_empty(&filter_subsystem_match_list)) { + list_for_each_entry(loop_name, &filter_subsystem_match_list, node) if (fnmatch(loop_name->name, subsystem, 0) == 0) return 0; return 1; @@ -501,10 +501,10 @@ int main(int argc, char *argv[], char *envp[]) failed = 1; break; case 's': - name_list_add(&filter_subsytem_match_list, optarg, 0); + name_list_add(&filter_subsystem_match_list, optarg, 0); break; case 'S': - name_list_add(&filter_subsytem_nomatch_list, optarg, 0); + name_list_add(&filter_subsystem_nomatch_list, optarg, 0); break; case 'a': name_list_add(&filter_attr_match_list, optarg, 0); @@ -542,8 +542,8 @@ int main(int argc, char *argv[], char *envp[]) exec_lists(); exit: - name_list_cleanup(&filter_subsytem_match_list); - name_list_cleanup(&filter_subsytem_nomatch_list); + name_list_cleanup(&filter_subsystem_match_list); + name_list_cleanup(&filter_subsystem_nomatch_list); name_list_cleanup(&filter_attr_match_list); name_list_cleanup(&filter_attr_nomatch_list); -- cgit v1.2.3-54-g00ecf From 64e0ce85de834bfd442228c18fe602d1d988064b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Sep 2006 17:47:27 +0200 Subject: udevinfo: fix SUBSYTEMS spelling error --- udevinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index dca4616958..e7225c8831 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -114,7 +114,7 @@ static int print_device_chain(const char *devpath) break; printf(" looking at parent device '%s':\n", dev->devpath); printf(" KERNELS==\"%s\"\n", dev->kernel); - printf(" SUBSYTEMS==\"%s\"\n", dev->subsystem); + printf(" SUBSYSTEMS==\"%s\"\n", dev->subsystem); printf(" DRIVERS==\"%s\"\n", dev->driver); print_all_attributes(dev->devpath, "ATTRS"); -- cgit v1.2.3-54-g00ecf From ac528431dd60c6b7f6b664ba430b937a11a32230 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 5 Sep 2006 00:50:25 +0200 Subject: fix ENV{TEST}="Test: $env{TEST}" --- test/udev-test.pl | 13 +++++++++++++ udev_rules.c | 10 ++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 1117ecb40c..464098fa65 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1245,6 +1245,19 @@ SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="true" SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="yes", NAME="no" SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}=="true", NAME="true" SUBSYSTEMS=="scsi", KERNEL=="sda1", NAME="bad" +EOF + }, + { + desc => "ENV{} test (assign 2 times)", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "true", + rules => <env.keys[i]; if (pair->key.operation == KEY_OP_ASSIGN) { + char temp_value[NAME_SIZE]; const char *key_name = key_pair_name(rule, pair); const char *value = key_val(rule, &pair->key); - char *key_value = name_list_key_add(&udev->env_list, key_name, value); + char *key_value; + + /* make sure we don't write to the same string we possibly read from */ + strlcpy(temp_value, value, sizeof(temp_value)); + udev_rules_apply_format(udev, temp_value, NAME_SIZE); + + key_value = name_list_key_add(&udev->env_list, key_name, temp_value); if (key_value == NULL) break; - udev_rules_apply_format(udev, key_value, NAME_SIZE); putenv(key_value); dbg("export ENV '%s'", key_value); } -- cgit v1.2.3-54-g00ecf From eef5447934a07279bc76f3f65b0302ddea8556ab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 5 Sep 2006 02:18:06 +0200 Subject: let $attr{symlink} return the last element of the path Example for /block/sda: SUBSYSTEMS="scsi", ENV{COMMENT}="$attr{driver}" sets COMMENT=sd SUBSYSTEMS="pci", ENV{COMMENT}="$attr{driver}" sets COMMENT=ata_piix --- test/udev-test.pl | 18 ++++++++++++++++++ udev_rules.c | 56 +++++++++++++++++++++++++++++++++---------------------- udev_sysfs.c | 56 +++++++++++++++++++++++++++++++++++++++---------------- 3 files changed, 92 insertions(+), 38 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 464098fa65..54c3378392 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -579,6 +579,24 @@ EOF rules => < "substitute attr with link target value (first match)", + subsys => "block", + devpath => "/block/sda", + exp_name => "driver-is-sd", + rules => < "substitute attr with link target value (currently selected device)", + subsys => "block", + devpath => "/block/sda", + exp_name => "driver-is-aic7xxx", + rules => <dev_parent != NULL && udev->dev_parent != udev->dev) + value = sysfs_attr_get_value(udev->dev_parent->devpath, attr); + + /* look at all devices along the chain of parents */ + if (value == NULL) { + struct sysfs_device *dev_parent = udev->dev; + + do { + dbg("looking at '%s'", dev_parent->devpath); + value = sysfs_attr_get_value(dev_parent->devpath, attr); + if (value != NULL) { + strlcpy(temp2, value, sizeof(temp2)); + break; + } + dev_parent = sysfs_device_get_parent(dev_parent); + } while (dev_parent != NULL); + } - dev_parent = udev->dev; - do { - dbg("looking at '%s'", dev_parent->devpath); - value = sysfs_attr_get_value(dev_parent->devpath, attr); - if (value != NULL) { - strlcpy(temp2, value, sizeof(temp2)); - break; - } - dev_parent = sysfs_device_get_parent(dev_parent); - } while (dev_parent != NULL); + if (value == NULL) + break; - /* strip trailing whitespace of sysfs value */ - i = strlen(temp2); - while (i > 0 && isspace(temp2[i-1])) - temp2[--i] = '\0'; + /* strip trailing whitespace and replace untrusted characters of sysfs value */ + size = strlcpy(temp2, value, sizeof(temp2)); + if (size >= sizeof(temp2)) + size = sizeof(temp2)-1; + while (size > 0 && isspace(temp2[size-1])) + temp2[--size] = '\0'; count = replace_untrusted_chars(temp2); - if (count) + if (count > 0) info("%i untrusted character(s) replaced" , count); strlcat(string, temp2, maxsize); dbg("substitute sysfs value '%s'", temp2); @@ -693,7 +705,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (match_key("DRIVERS", rule, &rule->drivers, udev->dev_parent->driver)) goto try_parent; - /* check for matching sysfs attrubute pairs */ + /* check for matching sysfs attribute pairs */ for (i = 0; i < rule->attrs.count; i++) { struct key_pair *pair = &rule->attrs.keys[i]; diff --git a/udev_sysfs.c b/udev_sysfs.c index c192696689..e733d417c5 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -346,6 +346,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) char value[NAME_SIZE]; struct sysfs_attr *attr_loop; struct sysfs_attr *attr; + struct stat statbuf; int fd; ssize_t size; size_t sysfs_len; @@ -375,25 +376,48 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) dbg("add to cache '%s'", path_full); list_add(&attr->node, &attr_list); - /* read attribute value */ - fd = open(path_full, O_RDONLY); - if (fd < 0) { - dbg("attribute '%s' does not exist", path_full); + if (lstat(path_full, &statbuf) != 0) { + dbg("stat '%s' failed: %s", path_full, strerror(errno)); goto out; } - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - if (size == sizeof(value)) - goto out; - /* got a valid value, store and return it */ - value[size] = '\0'; - remove_trailing_chars(value, '\n'); - dbg("cache '%s' with value '%s'", path_full, value); - strlcpy(attr->value_local, value, sizeof(attr->value_local)); - attr->value = attr->value_local; + if (S_ISLNK(statbuf.st_mode)) { + /* links return the last element of the target path */ + char link_target[PATH_SIZE]; + int len; + const char *pos; + + len = readlink(path_full, link_target, sizeof(link_target)); + if (len > 0) { + link_target[len] = '\0'; + pos = strrchr(link_target, '/'); + if (pos != NULL) { + dbg("cache '%s' with link value '%s'", path_full, value); + strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); + attr->value = attr->value_local; + } + } + } else { + /* read attribute value */ + fd = open(path_full, O_RDONLY); + if (fd < 0) { + dbg("attribute '%s' does not exist", path_full); + goto out; + } + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + if (size == sizeof(value)) + goto out; + + /* got a valid value, store and return it */ + value[size] = '\0'; + remove_trailing_chars(value, '\n'); + dbg("cache '%s' with attribute value '%s'", path_full, value); + strlcpy(attr->value_local, value, sizeof(attr->value_local)); + attr->value = attr->value_local; + } out: return attr->value; -- cgit v1.2.3-54-g00ecf From e136a3360b9a0b746e585b9c3b2403e6dd1e7f7c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 5 Sep 2006 03:43:14 +0200 Subject: cdrom_id: add rules file to call cdrom_id --- extras/cdrom_id/60-cdrom_id.rules | 3 +++ extras/cdrom_id/Makefile | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 extras/cdrom_id/60-cdrom_id.rules diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules new file mode 100644 index 0000000000..b06dafddb7 --- /dev/null +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -0,0 +1,3 @@ +# import optical drive properties + +KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index f5890a0c6a..d5138c5933 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -18,7 +18,7 @@ usrbindir = ${prefix}/usr/bin usrsbindir = ${prefix}/usr/sbin libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ +configdir = ${etcdir}/udev INSTALL = /usr/bin/install -c INSTALL_PROGRAM = ${INSTALL} @@ -50,10 +50,12 @@ clean: install-bin: all $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL_DATA) -D 60-cdrom_id.rules $(DESTDIR)$(configdir)/rules.d/60-cdrom_id.rules .PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(libudevdir)/$(PROG) + - rm $(DESTDIR)$(configdir)/rules.d/60-cdrom_id.rules .PHONY: uninstall-bin install-man: -- cgit v1.2.3-54-g00ecf From 492e76c9c1108a28eae356cc8bd7955ccf234980 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 5 Sep 2006 13:54:08 +0200 Subject: udevinfo: do not show symlinks as attributes in --attribute-walk --- udev_sysfs.c | 49 +++++++++++++++++++++++++++++-------------------- udevinfo.c | 15 +++++++++++++++ 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index e733d417c5..0b7561f0eb 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -397,27 +397,36 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) attr->value = attr->value_local; } } - } else { - /* read attribute value */ - fd = open(path_full, O_RDONLY); - if (fd < 0) { - dbg("attribute '%s' does not exist", path_full); - goto out; - } - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - if (size == sizeof(value)) - goto out; - - /* got a valid value, store and return it */ - value[size] = '\0'; - remove_trailing_chars(value, '\n'); - dbg("cache '%s' with attribute value '%s'", path_full, value); - strlcpy(attr->value_local, value, sizeof(attr->value_local)); - attr->value = attr->value_local; + goto out; + } + + /* skip directories */ + if (S_ISDIR(statbuf.st_mode)) + goto out; + + /* skip non-readable files */ + if ((statbuf.st_mode & S_IRUSR) == 0) + goto out; + + /* read attribute value */ + fd = open(path_full, O_RDONLY); + if (fd < 0) { + dbg("attribute '%s' does not exist", path_full); + goto out; } + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + if (size == sizeof(value)) + goto out; + + /* got a valid value, store and return it */ + value[size] = '\0'; + remove_trailing_chars(value, '\n'); + dbg("cache '%s' with attribute value '%s'", path_full, value); + strlcpy(attr->value_local, value, sizeof(attr->value_local)); + attr->value = attr->value_local; out: return attr->value; diff --git a/udevinfo.c b/udevinfo.c index e7225c8831..5445b0fcc1 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "udev.h" @@ -56,10 +58,23 @@ static void print_all_attributes(const char *devpath, const char *key) dir = opendir(path); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat statbuf; + char filename[PATH_SIZE]; char *attr_value; char value[NAME_SIZE]; size_t len; + if (dent->d_name[0] == '.') + continue; + + strlcpy(filename, path, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, dent->d_name, sizeof(filename)); + if (lstat(filename, &statbuf) != 0) + continue; + if (S_ISLNK(statbuf.st_mode)) + continue; + attr_value = sysfs_attr_get_value(devpath, dent->d_name); if (attr_value == NULL) continue; -- cgit v1.2.3-54-g00ecf From d60fd52af868ec6043d9a6dc641a6a64feabd238 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 5 Sep 2006 14:00:47 +0200 Subject: remove broken name_cdrom.pl We never get an event on media change, so this script can't work. --- extras/name_cdrom.pl | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100755 extras/name_cdrom.pl diff --git a/extras/name_cdrom.pl b/extras/name_cdrom.pl deleted file mode 100755 index 28d2d29a3d..0000000000 --- a/extras/name_cdrom.pl +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl - -# Horrible but funny script that shows how flexible udev can really be -# This is to be executed by udev with the following rule: -# KERNEL="hd*[!0-9]|sr*", PROGRAM="name_cdrom.pl $tempnode", SYMLINK+="%c" - -use strict; -use warnings; - -use CDDB_get qw(get_cddb); - -# following variables just need to be declared if different from defaults -my %config; -$config{'CDDB_HOST'} = "freedb.freedb.org"; # set cddb host -$config{'CDDB_PORT'} = 8880; # set cddb port -$config{'CDDB_MODE'} = "cddb"; # set cddb mode: cddb or http -$config{'CD_DEVICE'} = $ARGV[0]; # set cd device -$config{'input'} = 0; # no user interaction - -my %cd = get_cddb(\%config); - -if (!defined $cd{title}) { - exit 1; -} - -# print out our cd name -$cd{artist} =~ s/ /_/g; -$cd{title} =~ s/ /_/g; -print "$cd{artist}-$cd{title}\n"; - -exit 0; -- cgit v1.2.3-54-g00ecf From fbcbf70bb21a618024ce8c1ea0b4f6718c2a8dd2 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 5 Sep 2006 15:20:28 +0200 Subject: add persistent rules generator for net devices and optical drives --- .../rule_generator/75-cd-aliases-generator.rules | 3 + .../75-persistent-net-generator.rules | 17 +++ extras/rule_generator/Makefile | 68 +++++++++++ extras/rule_generator/rule_generator.functions | 98 ++++++++++++++++ extras/rule_generator/write_cd_rules | 78 +++++++++++++ extras/rule_generator/write_net_rules | 130 +++++++++++++++++++++ test/simple-build-check.sh | 4 +- 7 files changed, 397 insertions(+), 1 deletion(-) create mode 100644 extras/rule_generator/75-cd-aliases-generator.rules create mode 100644 extras/rule_generator/75-persistent-net-generator.rules create mode 100644 extras/rule_generator/Makefile create mode 100644 extras/rule_generator/rule_generator.functions create mode 100644 extras/rule_generator/write_cd_rules create mode 100644 extras/rule_generator/write_net_rules diff --git a/extras/rule_generator/75-cd-aliases-generator.rules b/extras/rule_generator/75-cd-aliases-generator.rules new file mode 100644 index 0000000000..c3eb887cb5 --- /dev/null +++ b/extras/rule_generator/75-cd-aliases-generator.rules @@ -0,0 +1,3 @@ +# these rules generate rules for the /dev/{cdrom,dvd,...} symlinks + +ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules", SYMLINK+="%c" diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules new file mode 100644 index 0000000000..fdebb919bc --- /dev/null +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -0,0 +1,17 @@ +# these rules generate rules for persistent network device naming + +ACTION=="add", SUBSYSTEM=="net", NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do" +GOTO="persistent_net_generator_end" + +LABEL="persistent_net_generator_do" +# export device description to comment the generated rule +SUBSYSTEMS=="pci", ENV{COMMENT}="PCI Device: $attr{vendor}:$attr{device} ($attr{driver})" +SUBSYSTEMS=="usb", ENV{COMMENT}="USB Device: 0x$attr{idVendor}:0x$attr{idProduct} ($attr{driver})" +SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire Device: $attr{host_id} ($attr{driver})" +SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device" + +KERNEL=="eth*|ath*|wlan*|ra*|sta*", IMPORT{program}="write_net_rules $attr{address}" +ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" + +LABEL="persistent_net_generator_end" + diff --git a/extras/rule_generator/Makefile b/extras/rule_generator/Makefile new file mode 100644 index 0000000000..810be24d2b --- /dev/null +++ b/extras/rule_generator/Makefile @@ -0,0 +1,68 @@ +# Makefile for udev extra invoked from the udev main Makefile +# +# Copyright (C) 2004-2006 Kay Sievers +# +# Released under the GNU General Public License, version 2. +# + +PROG = +MAN_PAGES = + +prefix = +etcdir = ${prefix}/etc +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev +mandir = ${prefix}/usr/share/man +configdir = ${etcdir}/udev + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} + +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all + +# man pages +%.8: %.xml + $(E) " XMLTO " $@ + $(Q) xmlto man $? +.PRECIOUS: %.8 + +clean: + $(E) " CLEAN " +.PHONY: clean + +install-bin: all + $(INSTALL_PROGRAM) -D rule_generator.functions $(DESTDIR)$(libudevdir)/rule_generator.functions + $(INSTALL_PROGRAM) -D write_cd_rules $(DESTDIR)$(libudevdir)/write_cd_rules + $(INSTALL_PROGRAM) -D write_net_rules $(DESTDIR)$(libudevdir)/write_net_rules + $(INSTALL_DATA) -D 75-cd-aliases-generator.rules \ + $(DESTDIR)$(configdir)/rules.d/75-cd-aliases-generator.rules + $(INSTALL_DATA) -D 75-persistent-net-generator.rules \ + $(DESTDIR)$(configdir)/rules.d/75-persistent-net-generator.rules +.PHONY: install-bin + +uninstall-bin: + - rm $(DESTDIR)$(libudevdir)/rule_generator.functions + - rm $(DESTDIR)$(libudevdir)/write_cd_rules + - rm $(DESTDIR)$(libudevdir)/write_net_rules + - rm $(DESTDIR)$(configdir)/rules.d/75-cd-aliases-generator.rules + - rm $(DESTDIR)$(configdir)/rules.d/75-persistent-net-generator.rules +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: install-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config + diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions new file mode 100644 index 0000000000..14c585a86a --- /dev/null +++ b/extras/rule_generator/rule_generator.functions @@ -0,0 +1,98 @@ +# functions used by the udev rule generator +# +# 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. + +PATH='/sbin:/bin' + +# Read a single line from file $1 in the $DEVPATH directory. +# The function must not return an error even if the file does not exist. +sysread() { + local file="$1" + [ -e "/sys$DEVPATH/$file" ] || return 0 + local value + read value < "/sys$DEVPATH/$file" || return 0 + echo "$value" +} + +sysreadlink() { + local file="$1" + [ -e "/sys$DEVPATH/$file" ] || return 0 + readlink -f /sys$DEVPATH/$file 2> /dev/null || true +} + +# Return true if a directory is writeable. +writeable() { + if ln -s test-link $1/.is-writeable 2> /dev/null; then + rm -f $1/.is-writeable + return 0 + else + return 1 + fi +} + +# Create a lock file for the current rules file. +lock_rules_file() { + [ -e /dev/.udev/ ] || return 0 + + RULES_LOCK="/dev/.udev/.lock-${RULES_FILE##*/}" + + retry=30 + while ! mkdir $RULES_LOCK 2> /dev/null; do + if [ $retry -eq 0 ]; then + echo "Cannot lock $RULES_FILE!" >&2 + exit 2 + fi + sleep 1 + retry=$(($retry - 1)) + done +} + +unlock_rules_file() { + [ "$RULES_LOCK" ] || return 0 + rmdir $RULES_LOCK || true +} + +# Choose the real rules file if it is writeable or a temporary file if not. +# Both files should be checked later when looking for existing rules. +choose_rules_file() { + local tmp_rules_file="/dev/.udev/tmp-rules--${RULES_FILE##*/}" + [ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1 + + if writeable ${RULES_FILE%/*}; then + RO_RULES_FILE='/dev/null' + else + RO_RULES_FILE=$RULES_FILE + RULES_FILE=$tmp_rules_file + fi +} + +# Return the name of the first free device. +raw_find_next_available() { + local links="$1" + + local basename=${links%%[ 0-9]*} + local max=-1 + for name in $links; do + local num=${name#$basename} + [ "$num" ] || num=0 + [ $num -gt $max ] && max=$num + done + + local max=$(($max + 1)) + # "name0" actually is just "name" + [ $max -eq 0 ] && return + echo "$max" +} + +# Find all rules matching a key (with action) and a pattern. +find_all_rules() { + local key="$1" + local linkre="$2" + local match="$3" + + [ -e $RULES_FILE ] || return + local search='.*[[:space:],]'"$key"'"\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$' + echo $(sed -n -e "${match}s/${search}/\1/p" $RO_RULES_FILE $RULES_FILE) +} diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules new file mode 100644 index 0000000000..232daeb86b --- /dev/null +++ b/extras/rule_generator/write_cd_rules @@ -0,0 +1,78 @@ +#!/bin/sh -e + +# This script is run if an optical drive lacks a rule for persistent naming. +# +# It adds symlinks for optical drives based on the device class determined +# by cdrom_id and used ID_PATH to identify the device. +# +# (C) 2006 Marco d'Itri +# +# 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. + +RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" + +. /lib/udev/rule_generator.functions + +find_next_available() { + raw_find_next_available "$(find_all_rules 'SYMLINK+=' $1)" +} + +write_rule() { + local match="$1" + local link="$2" + local comment="$3" + + { + if [ "$PRINT_HEADER" ]; then + PRINT_HEADER= + echo "# This file was automatically generated by the $0" + echo "# program, probably run by the cd-aliases-generator.rules rules file." + echo "#" + echo "# You can modify it, as long as you keep each rule on a single line" + echo "# and set the \$GENERATED variable." + echo "" + fi + + [ "$comment" ] && echo "# $comment" + echo "$match, SYMLINK+=\"$link\", ENV{GENERATED}=\"1\"" + } >> $RULES_FILE + SYMLINKS="$SYMLINKS $link" +} + +if [ -z "$DEVPATH" ]; then + echo "Missing \$DEVPATH." >&2 + exit 1 +fi +if [ -z "$ID_CDROM" ]; then + echo "$DEVPATH is not a CD reader." >&2 + exit 1 +fi + +# Prevent concurrent processes from modifying the file at the same time. +lock_rules_file + +# Check if the rules file is writeable. +choose_rules_file + +link_num=$(find_next_available 'cdrom[0-9]*') + +match="ENV{ID_CDROM}==\"?*\", ENV{ID_PATH}==\"$ID_PATH\"" + +comment="$ID_MODEL ($ID_PATH)" + + write_rule "$match" "cdrom$link_num" "$comment" +[ "$ID_CDROM_CD_R" -o "$ID_CDROM_CD_RW" ] && \ + write_rule "$match" "cdrw$link_num" +[ "$ID_CDROM_DVD" ] && \ + write_rule "$match" "dvd$link_num" +[ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ] && \ + write_rule "$match" "dvdrw$link_num" + +unlock_rules_file + +echo $SYMLINKS + +exit 0 + diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules new file mode 100644 index 0000000000..b709200a35 --- /dev/null +++ b/extras/rule_generator/write_net_rules @@ -0,0 +1,130 @@ +#!/bin/sh -e +# +# This script is run if the interface (recognized by its MAC address) lacks +# a rule for persistent naming. +# +# If there is already a persistent rule with that interface name then the +# current interface needs to be renamed. +# +# If the interface needs to be renamed, a NAME=value pair will be printed +# on stdout to allow udev to IMPORT it. Then a rule for the MAC address and +# interface name is written. +# +# (C) 2006 Marco d'Itri +# +# 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. + +RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' + +. /lib/udev/rule_generator.functions + +interface_name_taken() { + local value="$(find_all_rules 'NAME=' $INTERFACE)" + if [ "$value" ]; then + return 0 + else + return 1 + fi +} + +find_next_available() { + raw_find_next_available "$(find_all_rules 'NAME=' "$1")" +} + +write_rule() { + local match="$1" + local name="$2" + local comment="$3" + + { + if [ "$PRINT_HEADER" ]; then + PRINT_HEADER= + echo "# This file was automatically generated by the $0" + echo "# program, probably run by the persistent-net-generator.rules rules file." + echo "#" + echo "# You can modify it, as long as you keep each rule on a single line." + fi + + echo "" + [ "$comment" ] && echo "# $comment" + echo "SUBSYSTEM==\"net\", $match, NAME=\"$name\"" + } >> $RULES_FILE +} + +# used only if $RULES_FILE is empty, like on installation +if [ "$1" = "all_interfaces" ]; then + if [ -e $RULES_FILE ]; then + printf "$RULES_FILE exists, persistent interface names\nnot saved.\n" >&2 + exit 0 + fi + + if [ ! -e /sys/class/net/ ]; then + echo "/sys/class/net/ is not available, persistent interface names not saved." >&2 + exit 0 + fi + + cd /sys/class/net/ || return 0 + + for INTERFACE in *; do + case $INTERFACE in + eth*|ath*|wlan*|ra*|sta*) ;; + *) continue ;; + esac + + INTERFACE="$INTERFACE" DEVPATH="/class/net/$INTERFACE" \ + /lib/udev/write_net_rules || true + done + + exit 0 +fi + +if [ -z "$INTERFACE" ]; then + echo "Missing \$INTERFACE." >&2 + exit 1 +fi + +if [ "$1" ]; then + MAC_ADDR="$1" +else + MAC_ADDR=$(sysread address) +fi + +if [ -z "$MAC_ADDR" ]; then + echo "No MAC address for $INTERFACE." >&2 + exit 1 +fi +if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then + echo "NULL MAC address for $INTERFACE." >&2 + exit 1 +fi + +# Prevent concurrent processes from modifying the file at the same time. +lock_rules_file + +# Check if the rules file is writeable. +choose_rules_file + +# If a rule using the current name already exists then find a new name and +# report it to udev which will rename the interface. +basename=${INTERFACE%%[0-9]*} +if interface_name_taken; then + INTERFACE="$basename$(find_next_available "$basename[0-9]*")" + if [ ! -t 1 ]; then + echo "INTERFACE_NEW=$INTERFACE" + fi +fi + +# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces +match="DRIVERS==\"?*\", ATTRS{address}==\"$MAC_ADDR\"" +if [ $basename = "ath" -o $basename = "wlan" ]; then + match="$match, ATTRS{type}==\"1\"" # do not match the wifi* interfaces +fi + +write_rule "$match" "$INTERFACE" "$COMMENT" + +unlock_rules_file + +exit 0 + diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 6a03608477..385abbd09c 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -11,7 +11,9 @@ EXTRAS="\ extras/edd_id \ extras/floppy \ extras/run_directory \ - extras/firmware" + extras/firmware \ + extras/path_id \ + extras/rule_generator" # with debug make clean EXTRAS="$EXTRAS" >/dev/null -- cgit v1.2.3-54-g00ecf From 0b07eaa0837516e84b3e804a3af3307ab57b0ed0 Mon Sep 17 00:00:00 2001 From: MUNEDA Takahiro Date: Wed, 6 Sep 2006 22:08:20 +0200 Subject: changes rules for ata disk from '_' to '-' by-id symlink rules for ata disk only have '_' before $env{ID_SERIAL}. The rules for SCSI disk, SCSI tape, mouse, event are not '_' but '-' --- etc/udev/rules.d/60-persistent-storage.rules | 4 ++-- etc/udev/suse/60-persistent-storage.rules | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index da433cb565..547afa2b1a 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -16,8 +16,8 @@ KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index da433cb565..547afa2b1a 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -16,8 +16,8 @@ KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" -- cgit v1.2.3-54-g00ecf From 4a51530993e28c9a689be535fd1d34b259b39f2a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Sep 2006 22:18:04 +0200 Subject: release 099 --- ChangeLog | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 21 ++++++++++++++++ TODO | 9 ++++--- 4 files changed, 105 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 080c91b665..cf0a398fd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,81 @@ +Summary of changes from v097 to v098 +============================================ + +Alex Merry: + udevtest: allow /sys in the devpath paramter + +Greg KH: + update Gentoo rules + +Harald Hoyer: + selinux: init once in the daemon, not in every event process + +Kay Sievers: + udevd: remove huge socket buffer on the control socket + man page: fix typo + rename udev_libc_wrapper -> udev_sysdeps + db: store devpath - node relationship for all devices + udevinfo: allow -a -n + udevinfo, udevtest: simplify '/sys' stripping from devpath argument + lookup_user, lookup_group: report "unknown user" and "lookup failed" + consistent key naming to match only the event device or include all parent devices + skip rule, if too may keys of the same type are used + introduce ATTR{file}="value" to set sysfs attributes + update SUSE rules + update default rules + export DRIVER for older kernels as a replacement for PHYSDEVDRIVER + fix typo in SUBSYSTEMS key parsing + udevtrigger: add --retry-failed + volume_id: add suspend partition detection + vol_id: use primary group of 'nobody' instead of 'nogroup' + remove built-in /etc/passwd /etc/group parser + always expect KEY{value} on ATTR, ATTRS, ENV keys + use new key names in test programs + cleanup commandline argument handling + db: don't create a db file for only a node name to store + man: add ATTR{file}="value" assignment + 098 release + udev_db.c: include + use fnmatch() instead of our own pattern match code + rename major/minor variable to maj/min to avoid warning + update source file headers + udevtest: print header that ENV{} can't work + update TODO + udevtrigger: options to filter by subsystem and sysfs attribute + udevtrigger: remove unused longindex + udevinfo: use long options + udevd: use files instead of symlinks for /dev/.udev/queue,failed + udevtrigger: fix pattern match + reorder options in udevinfo man page + udevinfo: fix SUBSYTEMS spelling error + fix ENV{TEST}="Test: $env{TEST}" + let $attr{symlink} return the last element of the path + cdrom_id: add rules file to call cdrom_id + udevinfo: do not show symlinks as attributes in --attribute-walk + remove broken name_cdrom.pl + +Lennart Poettering: + volume_id: fix fat32 cluster chain traversal + +Marco d'Itri: + fix 'unknow user' error from getpwnam/getgrnam + fix rc when using udev --daemon + update Debian rules + update Debian rules + run_program: close pipe fd's which are connected to child process + add persistent rules generator for net devices and optical drives + +Michał Bartoszkiewicz: + man pages: fix typos + +MUNEDA Takahiro: + changes rules for ata disk from '_' to '-' + +Sergey Vlasov: + make struct option arrays static const + fix "subsytem" typo + + Summary of changes from v096 to v097 ============================================ diff --git a/Makefile b/Makefile index 0027421d01..18de421906 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 098 +VERSION = 099 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9fe4542dd5..c7e7a053ea 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,24 @@ +udev 099 +======== +Bugfixes. + +Udevtrigger can now filter the list of devices to be triggered. Matches +for subsystems or sysfs attributes can be specified. + +The entries in /dev/.udev/queue and /dev/.udev/failed have changed to +zero-sized files to avoid pointing to /sys and confuse broken tools which +scan the /dev directory. To retry failed events, udevtrigger --retry-failed +should be used now. + +The rules and scripts to create udev rules for persistent network +devices and optical drives are in the extras/rules_generator directory +now. If you use something similar, please consider replacing your own +version with this, to share the support effort. The rule_generator +installs its own rules into /etc/udev/rules.d. + +The cdrom_id tool installs its own rule now in /etc/udev/rules.d, cause +the rule_generator depends on cdrom_id to be called in an earlier rule. + udev 098 ======== Bugfixes. diff --git a/TODO b/TODO index 8667b87e91..58d9c1efe9 100644 --- a/TODO +++ b/TODO @@ -11,10 +11,11 @@ These things will change in future udev versions: o warn if PHYSDEV* keys are used in ENV keys (they are deprecated and will be removed from a future kernel) - o warn if "device/" is used in a ATTR{}, ATTRS{}, $attr{} key - (the device link must not be used in rules or tools, udev resolves - the link and makes the devices available as parents, which can - be matched with the normal keys) + o warn if any path component is used in a ATTR{}, ATTRS{}, + $attr{} key, like ATTR{device/}== + (parent attributes must not referenced directly in rules or tools, + udev finds the parents and makes them available, which can be matched + with the normal keys) o warn if BUS, ID, SYSFS are used as keys (they are SUBSYSTEMS, KERNELS, ATTRS now) -- cgit v1.2.3-54-g00ecf From eb0fd1eea9a8df90dc5af4380b407e34a09b4068 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Sep 2006 22:51:30 +0200 Subject: update SUSE rules --- etc/udev/suse/50-udev-default.rules | 8 ++++---- etc/udev/suse/60-persistent-storage.rules | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index bbbcc7f585..317046c204 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -106,10 +106,10 @@ SUBSYSTEM=="block", GROUP="disk", MODE="0640" # st/osst: 1 TYPE_TAPE SUBSYSTEM=="scsi", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" SUBSYSTEM=="scsi", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" -SUBSYSTEM=="scsi_device", ACTION=="add", ATTR{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", ATTR{type}=="1", ATTR{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", ATTR{type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", ATTR{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="1", ATTR{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" SUBSYSTEM=="ide", ACTION=="add", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index 547afa2b1a..518d1187bb 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -7,9 +7,9 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" -# never access removable ide devices, the drivers are causing event loops on open() +# never access non-cdrom removable ide devices, the drivers are causing event loops on open() KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", ATTRS{../removable}=="1", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # for partitions import parent information KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" @@ -35,7 +35,7 @@ KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" +KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" -- cgit v1.2.3-54-g00ecf From 070cdac978bb34080094fdb357e88d83c849f4b9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Sep 2006 23:18:28 +0200 Subject: fix messed up ChangeLog from release 099 --- ChangeLog | 77 +++++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf0a398fd8..688cac1ab3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,49 @@ +Summary of changes from v098 to v099 +============================================ + +Greg KH: + update Gentoo rules + +Kay Sievers: + udev_db.c: include + use fnmatch() instead of our own pattern match code + rename major/minor variable to maj/min to avoid warning + update source file headers + udevtest: print header that ENV{} can't work + update TODO + udevtrigger: options to filter by subsystem and sysfs attribute + udevtrigger: remove unused longindex + udevinfo: use long options + udevd: use files instead of symlinks for /dev/.udev/queue,failed + udevtrigger: fix pattern match + reorder options in udevinfo man page + udevinfo: fix SUBSYTEMS spelling error + fix ENV{TEST}="Test: $env{TEST}" + let $attr{symlink} return the last element of the path + cdrom_id: add rules file to call cdrom_id + udevinfo: do not show symlinks as attributes in --attribute-walk + remove broken name_cdrom.pl + release 099 + +Marco d'Itri: + update Debian rules + run_program: close pipe fd's which are connected to child process + add persistent rules generator for net devices and optical drives + +MUNEDA Takahiro: + changes rules for ata disk from '_' to '-' + +Sergey Vlasov: + make struct option arrays static const + fix "subsytem" typo + Summary of changes from v097 to v098 ============================================ + Alex Merry: udevtest: allow /sys in the devpath paramter -Greg KH: - update Gentoo rules - Harald Hoyer: selinux: init once in the daemon, not in every event process @@ -35,24 +72,6 @@ Kay Sievers: db: don't create a db file for only a node name to store man: add ATTR{file}="value" assignment 098 release - udev_db.c: include - use fnmatch() instead of our own pattern match code - rename major/minor variable to maj/min to avoid warning - update source file headers - udevtest: print header that ENV{} can't work - update TODO - udevtrigger: options to filter by subsystem and sysfs attribute - udevtrigger: remove unused longindex - udevinfo: use long options - udevd: use files instead of symlinks for /dev/.udev/queue,failed - udevtrigger: fix pattern match - reorder options in udevinfo man page - udevinfo: fix SUBSYTEMS spelling error - fix ENV{TEST}="Test: $env{TEST}" - let $attr{symlink} return the last element of the path - cdrom_id: add rules file to call cdrom_id - udevinfo: do not show symlinks as attributes in --attribute-walk - remove broken name_cdrom.pl Lennart Poettering: volume_id: fix fat32 cluster chain traversal @@ -61,20 +80,10 @@ Marco d'Itri: fix 'unknow user' error from getpwnam/getgrnam fix rc when using udev --daemon update Debian rules - update Debian rules - run_program: close pipe fd's which are connected to child process - add persistent rules generator for net devices and optical drives Michał Bartoszkiewicz: man pages: fix typos -MUNEDA Takahiro: - changes rules for ata disk from '_' to '-' - -Sergey Vlasov: - make struct option arrays static const - fix "subsytem" typo - Summary of changes from v096 to v097 ============================================ @@ -653,7 +662,7 @@ Greg Kroah-Hartman: fix nbd error messages with a gentoo rule hack fix scsi_id rule in gentoo config file -Jrg Billeter: +Jürg Billeter: EXTRAS/Makefile: fix install targets to match main Makefile Kay Sievers: @@ -866,7 +875,7 @@ Kay Sievers: ata_id: check for empty serial number compile dasd only on s390 -Ville Skytt: +Ville Skyttä: correct default mode documentation in udev @@ -1236,7 +1245,7 @@ Summary of changes from v050 to v051 : o I tried to compile udev 050plus with the GCC 4.0 snapshot 200412119 and got two errors about possibly uninitialized structs, so I fixed this. -Christian Borntrger: +Christian Bornträger: o udev_volume_id: fix -d option Greg Kroah-Hartman: -- cgit v1.2.3-54-g00ecf From 4febf7f076fa4abaa36b0ae047aa893b1334fc93 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Sep 2006 11:08:07 +0200 Subject: man: add $attr{} section about symlinks --- udev.7 | 4 ++-- udev.xml | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/udev.7 b/udev.7 index fa6e52fdf3..05fa2e622b 100644 --- a/udev.7 +++ b/udev.7 @@ -196,13 +196,13 @@ The devpath of the device. \fB$id\fR, \fB%b\fR The name of the device matched while searching the devpath upwards for \fBSUBSYSTEMS\fR, -\fBKERNELS\fR +\fBKERNELS\fR, \fBDRIVERS\fR and \fBATTRS\fR. .TP 3n \fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR -The value of a sysfs attribute found at the current or a parent device. +The value of a sysfs attribute found at the device, where all keys of the rule have matched. If the matching device does not have such an attribute, all devices along the chain of parents are searched for a matching attribute. If the attribute is a symlink, the last element of the symlink target is returned as the value. .TP 3n \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR The value of an environment variable. diff --git a/udev.xml b/udev.xml index b2781b767d..852ae039e7 100644 --- a/udev.xml +++ b/udev.xml @@ -406,7 +406,7 @@ , The name of the device matched while searching the devpath upwards for - , and . + , , and . @@ -414,7 +414,12 @@ , - The value of a sysfs attribute found at the current or a parent device. + The value of a sysfs attribute found at the device, where + all keys of the rule have matched. If the matching device does not have + such an attribute, all devices along the chain of parents are searched + for a matching attribute. + If the attribute is a symlink, the last element of the symlink target is + returned as the value. -- cgit v1.2.3-54-g00ecf From 1376ba59f6f78846c7db17c62a97b980f4167b4e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Sep 2006 11:30:29 +0200 Subject: revert persistent-storage ata-serial '_' '-' replacement It's not worth changing it, also scsi usually has an underscore in the SERIAL string itself: scsi-SSEAGATE_ST3146854SS_3KN0JH8600008609GTBW scsi-SATA_HTS726060M9AT00_MRH453M4HWHG7B --- etc/udev/rules.d/60-persistent-storage.rules | 10 +++++----- etc/udev/suse/60-persistent-storage.rules | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 547afa2b1a..5a4843e495 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -7,17 +7,17 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" -# never access removable ide devices, the drivers are causing event loops on open() +# never access non-cdrom removable ide devices, the drivers are causing event loops on open() KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", ATTRS{../removable}=="1", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # for partitions import parent information KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL}-part%n" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" @@ -35,7 +35,7 @@ KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" +KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index 518d1187bb..5a4843e495 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -16,8 +16,8 @@ KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL}-part%n" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" -- cgit v1.2.3-54-g00ecf From eed8b2ff91a371ec7c6d9c41f63c4522863474f3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Sep 2006 11:32:45 +0200 Subject: release 100 --- ChangeLog | 14 +++++++++++--- Makefile | 2 +- RELEASE-NOTES | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 688cac1ab3..c40be32c4c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Summary of changes from v099 to v100 +============================================ + +Kay Sievers: + update SUSE rules + fix messed up ChangeLog from release 099 + man: add $attr{} section about symlinks + revert persistent-storage ata-serial '_' '-' replacement + + Summary of changes from v098 to v099 ============================================ @@ -23,7 +33,6 @@ Kay Sievers: cdrom_id: add rules file to call cdrom_id udevinfo: do not show symlinks as attributes in --attribute-walk remove broken name_cdrom.pl - release 099 Marco d'Itri: update Debian rules @@ -37,10 +46,10 @@ Sergey Vlasov: make struct option arrays static const fix "subsytem" typo + Summary of changes from v097 to v098 ============================================ - Alex Merry: udevtest: allow /sys in the devpath paramter @@ -71,7 +80,6 @@ Kay Sievers: cleanup commandline argument handling db: don't create a db file for only a node name to store man: add ATTR{file}="value" assignment - 098 release Lennart Poettering: volume_id: fix fat32 cluster chain traversal diff --git a/Makefile b/Makefile index 18de421906..8145f253ef 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 099 +VERSION = 100 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c7e7a053ea..24e582ade9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 100 +======== +Revert persistent-storage ata-serial '_' '-' replacement. + udev 099 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From adc8e4b91ef4719489b4d9b2b2b298166674ffbb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Sep 2006 11:49:51 +0200 Subject: remove Makefile magic for leading '0' in version --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 8145f253ef..2261d3488b 100644 --- a/Makefile +++ b/Makefile @@ -326,10 +326,10 @@ buildtest: ChangeLog: Makefile @ mv $@ $@.tmp - @ echo "Summary of changes from v$(shell printf '%03i' $$(expr $(VERSION) - 1)) to v$(VERSION)" >> $@ + @ echo "Summary of changes from v$(shell echo $$(($(VERSION) - 1))) to v$(VERSION)" >> $@ @ echo "============================================" >> $@ @ echo >> $@ - @ git log --pretty=short $(shell printf '%03i' $$(expr $(VERSION) - 1))..HEAD | git shortlog >> $@ + @ git log --pretty=short $(shell echo $$(($(VERSION) - 1)))..HEAD | git shortlog >> $@ @ echo >> $@ @ cat $@ @ cat $@.tmp >> $@ -- cgit v1.2.3-54-g00ecf From b52a01ee39dad3b04aaa7e3af7435f062d3e887f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Sep 2006 11:27:03 +0200 Subject: udevd: use getopt_long() --- udevd.8 | 5 ++++- udevd.c | 27 +++++++++++++++++++-------- udevd.xml | 7 +++++++ 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/udevd.8 b/udevd.8 index a57ff7aab0..bb6d27fb41 100644 --- a/udevd.8 +++ b/udevd.8 @@ -14,7 +14,7 @@ udevd \- event managing daemon .SH "SYNOPSIS" .HP 6 -\fBudevd\fR [\fB\-\-daemon\fR] +\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-help\fR] .HP 20 \fBudevcontrol \fR\fB\fIcommand\fR\fR .SH "DESCRIPTION" @@ -25,6 +25,9 @@ udevd listens to kernel uevents and passes the incoming events to udev. It ensur \fB\-\-daemon\fR Detach and run in the background. .TP 3n +\fB\-\-help\fR +Print usage. +.TP 3n \fBlog_priority=\fR\fB\fIvalue\fR\fR udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, diff --git a/udevd.c b/udevd.c index a21d2ab77d..df6e222810 100644 --- a/udevd.c +++ b/udevd.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,7 @@ void log_message(int priority, const char *format, ...) vsyslog(priority, format, args); va_end(args); } + #endif static void asmlinkage udev_event_sig_handler(int signum) @@ -916,7 +918,12 @@ int main(int argc, char *argv[], char *envp[]) fd_set readfds; const char *value; int daemonize = 0; - int i; + int option; + static const struct option options[] = { + { "daemon", 0, NULL, 'd' }, + { "help", 0, NULL, 'h' }, + {} + }; int rc = 1; int maxfd; @@ -926,16 +933,20 @@ int main(int argc, char *argv[], char *envp[]) dbg("version %s", UDEV_VERSION); /* parse commandline options */ - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; - if (strcmp(arg, "--daemon") == 0 || strcmp(arg, "-d") == 0) + while (1) { + option = getopt_long(argc, argv, "dtvh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': daemonize = 1; - else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + break; + case 'h': printf("Usage: udevd [--help] [--daemon]\n"); goto exit; - } else { - fprintf(stderr, "unrecognized option '%s'\n", arg); - err("unrecognized option '%s'\n", arg); + default: + goto exit; } } diff --git a/udevd.xml b/udevd.xml index 7feede2777..f0682ed00c 100644 --- a/udevd.xml +++ b/udevd.xml @@ -26,6 +26,7 @@ udevd + udevcontrol command @@ -46,6 +47,12 @@ Detach and run in the background. + + + + Print usage. + + -- cgit v1.2.3-54-g00ecf From 9e8fe79b8e84177fc9479d6c6af039b7402d52d3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Sep 2006 11:28:38 +0200 Subject: udevd: add --verbose option to log also to stdout --- udevd.8 | 5 ++++- udevd.c | 20 ++++++++++++++++++-- udevd.xml | 7 +++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/udevd.8 b/udevd.8 index bb6d27fb41..aef2090236 100644 --- a/udevd.8 +++ b/udevd.8 @@ -14,7 +14,7 @@ udevd \- event managing daemon .SH "SYNOPSIS" .HP 6 -\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-help\fR] +\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-verbose\fR] [\fB\-\-help\fR] .HP 20 \fBudevcontrol \fR\fB\fIcommand\fR\fR .SH "DESCRIPTION" @@ -25,6 +25,9 @@ udevd listens to kernel uevents and passes the incoming events to udev. It ensur \fB\-\-daemon\fR Detach and run in the background. .TP 3n +\fB\-\-verbose\fR +Print log messages to stdout. +.TP 3n \fB\-\-help\fR Print usage. .TP 3n diff --git a/udevd.c b/udevd.c index df6e222810..eb632bd852 100644 --- a/udevd.c +++ b/udevd.c @@ -45,6 +45,8 @@ #include "udevd.h" #include "udev_selinux.h" +static int verbose; + static struct udev_rules rules; static int udevd_sock = -1; static int uevent_netlink_sock = -1; @@ -76,6 +78,13 @@ void log_message(int priority, const char *format, ...) va_start(args, format); vsyslog(priority, format, args); va_end(args); + + if (verbose) { + va_start(args, format); + vprintf(format, args); + va_end(args); + printf("\n"); + } } #endif @@ -921,6 +930,7 @@ int main(int argc, char *argv[], char *envp[]) int option; static const struct option options[] = { { "daemon", 0, NULL, 'd' }, + { "verbose", 0, NULL, 'v' }, { "help", 0, NULL, 'h' }, {} }; @@ -942,8 +952,13 @@ int main(int argc, char *argv[], char *envp[]) case 'd': daemonize = 1; break; + case 'v': + verbose = 1; + if (udev_log_priority < LOG_INFO) + udev_log_priority = LOG_INFO; + break; case 'h': - printf("Usage: udevd [--help] [--daemon]\n"); + printf("Usage: udevd [--help] [--daemon] [--verbose]\n"); goto exit; default: goto exit; @@ -1006,7 +1021,8 @@ int main(int argc, char *argv[], char *envp[]) fd = open("/dev/null", O_RDWR); if (fd >= 0) { dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); + if (!verbose) + dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > STDERR_FILENO) close(fd); diff --git a/udevd.xml b/udevd.xml index f0682ed00c..cc2a1bcd22 100644 --- a/udevd.xml +++ b/udevd.xml @@ -26,6 +26,7 @@ udevd + @@ -47,6 +48,12 @@ Detach and run in the background. + + + + Print log messages to stdout. + + -- cgit v1.2.3-54-g00ecf From c7c00276f6f26ff7f38e99d887137bc1f172a978 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Sep 2006 11:30:00 +0200 Subject: udevd: add --debug-trace option --- udevd.8 | 5 ++++- udevd.c | 18 +++++++++++++++++- udevd.xml | 10 ++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/udevd.8 b/udevd.8 index aef2090236..cc724dceda 100644 --- a/udevd.8 +++ b/udevd.8 @@ -14,7 +14,7 @@ udevd \- event managing daemon .SH "SYNOPSIS" .HP 6 -\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-verbose\fR] [\fB\-\-help\fR] +\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-verbose\fR] [\fB\-\-help\fR] .HP 20 \fBudevcontrol \fR\fB\fIcommand\fR\fR .SH "DESCRIPTION" @@ -25,6 +25,9 @@ udevd listens to kernel uevents and passes the incoming events to udev. It ensur \fB\-\-daemon\fR Detach and run in the background. .TP 3n +\fB\-\-debug\-trace\fR +Run all events completely serialized. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continiuous operation is needed, where no events are processed in parallel. +.TP 3n \fB\-\-verbose\fR Print log messages to stdout. .TP 3n diff --git a/udevd.c b/udevd.c index eb632bd852..3adedac080 100644 --- a/udevd.c +++ b/udevd.c @@ -45,6 +45,7 @@ #include "udevd.h" #include "udev_selinux.h" +static int debug_trace; static int verbose; static struct udev_rules rules; @@ -307,6 +308,15 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) export_event_state(msg, EVENT_QUEUED); + /* run one event after the other in debug mode */ + if (debug_trace) { + list_add_tail(&msg->node, &running_list); + udev_event_run(msg); + waitpid(msg->pid, NULL, 0); + msg_queue_delete(msg); + return; + } + /* run all events with a timeout set immediately */ if (msg->timeout != 0) { list_add_tail(&msg->node, &running_list); @@ -930,6 +940,7 @@ int main(int argc, char *argv[], char *envp[]) int option; static const struct option options[] = { { "daemon", 0, NULL, 'd' }, + { "debug-trace", 0, NULL, 't' }, { "verbose", 0, NULL, 'v' }, { "help", 0, NULL, 'h' }, {} @@ -952,13 +963,16 @@ int main(int argc, char *argv[], char *envp[]) case 'd': daemonize = 1; break; + case 't': + debug_trace = 1; + break; case 'v': verbose = 1; if (udev_log_priority < LOG_INFO) udev_log_priority = LOG_INFO; break; case 'h': - printf("Usage: udevd [--help] [--daemon] [--verbose]\n"); + printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--verbose]\n"); goto exit; default: goto exit; @@ -1128,6 +1142,8 @@ int main(int argc, char *argv[], char *envp[]) /* export log_priority , as called programs may want to follow that setting */ sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); putenv(udev_log); + if (debug_trace) + putenv("DEBUG=1"); maxfd = udevd_sock; maxfd = UDEV_MAX(maxfd, uevent_netlink_sock); diff --git a/udevd.xml b/udevd.xml index cc2a1bcd22..938707bee1 100644 --- a/udevd.xml +++ b/udevd.xml @@ -26,6 +26,7 @@ udevd + @@ -48,6 +49,15 @@ Detach and run in the background. + + + + Run all events completely serialized. This may be useful if udev triggers + actions or loads kernel modules which cause problems and a slow but continiuous + operation is needed, where no events are processed in parallel. + + + -- cgit v1.2.3-54-g00ecf From 8091f6a90ccca1dd86271aec3441b01c2af4fbd5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 9 Sep 2006 14:45:45 +0200 Subject: rule_generator: improve net rule comment generation --- extras/rule_generator/75-persistent-net-generator.rules | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index fdebb919bc..21eb0c6649 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -1,16 +1,19 @@ # these rules generate rules for persistent network device naming -ACTION=="add", SUBSYSTEM=="net", NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do" -GOTO="persistent_net_generator_end" +ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|ath*|wlan*|ra*|sta*" \ + NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do" +GOTO="persistent_net_generator_end" LABEL="persistent_net_generator_do" -# export device description to comment the generated rule -SUBSYSTEMS=="pci", ENV{COMMENT}="PCI Device: $attr{vendor}:$attr{device} ($attr{driver})" -SUBSYSTEMS=="usb", ENV{COMMENT}="USB Device: 0x$attr{idVendor}:0x$attr{idProduct} ($attr{driver})" -SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire Device: $attr{host_id} ($attr{driver})" + +# build device description string to add a comment the generated rule +SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($attr{driver})" +SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($attr{driver})" +SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device" +ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($attr{driver})" -KERNEL=="eth*|ath*|wlan*|ra*|sta*", IMPORT{program}="write_net_rules $attr{address}" +IMPORT{program}="write_net_rules $attr{address}" ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" LABEL="persistent_net_generator_end" -- cgit v1.2.3-54-g00ecf From 4ca254b382d7ddebaef6ad62dbd5ead0babbf7ad Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 Sep 2006 14:33:06 +0200 Subject: volume_id: correct iso9660 high sierra header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to David Härdeman. --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/iso9660.c | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 02be060a62..3e7d8c010d 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 71 +SHLIB_REV = 72 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c index f8f5aa18ea..227641e42a 100644 --- a/extras/volume_id/lib/iso9660.c +++ b/extras/volume_id/lib/iso9660.c @@ -35,9 +35,9 @@ #define ISO_VD_MAX 16 struct iso_volume_descriptor { - uint8_t vd_type; - uint8_t vd_id[5]; - uint8_t vd_version; + uint8_t type; + uint8_t id[5]; + uint8_t version; uint8_t flags; uint8_t system_id[32]; uint8_t volume_id[32]; @@ -49,7 +49,7 @@ struct iso_volume_descriptor { struct high_sierra_volume_descriptor { uint8_t foo[8]; uint8_t type; - uint8_t id[4]; + uint8_t id[5]; uint8_t version; } PACKED; @@ -67,7 +67,7 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) is = (struct iso_volume_descriptor *) buf; - if (memcmp(is->vd_id, "CD001", 5) == 0) { + if (memcmp(is->id, "CD001", 5) == 0) { int vd_offset; int i; @@ -81,9 +81,9 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) uint8_t svd_label[64]; is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200); - if (is == NULL || is->vd_type == ISO_VD_END) + if (is == NULL || is->type == ISO_VD_END) break; - if (is->vd_type != ISO_VD_SUPPLEMENTARY) + if (is->type != ISO_VD_SUPPLEMENTARY) continue; dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset)); -- cgit v1.2.3-54-g00ecf From fe0c4102add2b362e1e21ac591dc679ac18b2fce Mon Sep 17 00:00:00 2001 From: Miles Lane Date: Sat, 16 Sep 2006 16:35:52 +0200 Subject: clarify "specified user/group unknown" error --- udev_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_utils.c b/udev_utils.c index 87e7979c68..b6e5275a16 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -172,7 +172,7 @@ uid_t lookup_user(const char *user) pw = getpwnam(user); if (pw == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified user unknown '%s'", user); + err("specified user '%s' unknown", user); else err("error resolving user '%s': %s", user, strerror(errno)); } else @@ -190,7 +190,7 @@ extern gid_t lookup_group(const char *group) gr = getgrnam(group); if (gr == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified group unknown '%s'", group); + err("specified group '%s' unknown", group); else err("error resolving group '%s': %s", group, strerror(errno)); } else -- cgit v1.2.3-54-g00ecf From 091a660d43704cf2085f4dd8ffeb8463b8977657 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 18 Sep 2006 02:01:29 +0200 Subject: warn if a PHYSEDV* key, the "device" link, or a parent attribute is used --- udev_rules_parse.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 111fead9ad..bc16f72e2c 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -373,6 +373,12 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena err("error parsing ATTRS attribute"); goto invalid; } + if (strncmp(attr, "device/", 7) == 0) + err("the 'device' link is deprecated and will be removed from a future kernel, " + "please fix it in %s:%u", filename, lineno); + else if (strchr(attr, '/') != NULL) + err("do not reference parent sysfs directories directly, that may break with a future kernel, " + "please fix it in %s:%u", filename, lineno); if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0) goto invalid; valid = 1; @@ -385,6 +391,9 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena err("error parsing ENV attribute"); goto invalid; } + if (strncmp(attr, "PHYSDEV", 7) == 0) + err("PHYSDEV* values are deprected and will be removed from a future kernel, " + "please fix it in %s:%u", filename, lineno); if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0) goto invalid; valid = 1; -- cgit v1.2.3-54-g00ecf From 7b5206d60917aeb8d2438b4022b2755b4eb5f126 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 18 Sep 2006 22:14:18 +0200 Subject: don't print PHYSDEV* warnings for old WAIT_FOR_SYSFS rules --- udev_rules_parse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index bc16f72e2c..a137331273 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -241,6 +241,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena char *linepos; char *attr; size_t padding; + int physdev = 0; int retval; /* get all the keys */ @@ -392,8 +393,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena goto invalid; } if (strncmp(attr, "PHYSDEV", 7) == 0) - err("PHYSDEV* values are deprected and will be removed from a future kernel, " - "please fix it in %s:%u", filename, lineno); + physdev = 1; if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0) goto invalid; valid = 1; @@ -579,6 +579,10 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena err("unknown key '%s' in %s:%u", key, filename, lineno); } + if (physdev && rule->wait_for_sysfs.operation == KEY_OP_UNSET) + err("PHYSDEV* values are deprected and will be removed from a future kernel, " + "please fix it in %s:%u", filename, lineno); + /* skip line if not any valid key was found */ if (!valid) goto invalid; -- cgit v1.2.3-54-g00ecf From bc2a89fad6a5935e241d2f50d5b4f620dc343233 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 19 Sep 2006 17:07:25 +0200 Subject: udevinfo: print error in --attribute-walk --- udevinfo.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 5445b0fcc1..2832ea0ee3 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -104,6 +104,10 @@ static int print_device_chain(const char *devpath) { struct sysfs_device *dev; + dev = sysfs_device_get(devpath); + if (dev == NULL) + return -1; + printf("\n" "Udevinfo starts with the device specified by the devpath and then\n" "walks up the chain of parent devices. It prints for every device\n" @@ -112,10 +116,6 @@ static int print_device_chain(const char *devpath) "and the attributes from one single parent device.\n" "\n"); - dev = sysfs_device_get(devpath); - if (dev == NULL) - return -1; - printf(" looking at device '%s':\n", dev->devpath); printf(" KERNEL==\"%s\"\n", dev->kernel); printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); @@ -377,7 +377,11 @@ int main(int argc, char *argv[], char *envp[]) break; case ACTION_ATTRIBUTE_WALK: if (path[0] != '\0') { - print_device_chain(path); + if (print_device_chain(path) != 0) { + fprintf(stderr, "device not found\n"); + rc = 4; + goto exit; + } } else if (name[0] != '\0') { char devpath[PATH_SIZE]; @@ -386,7 +390,11 @@ int main(int argc, char *argv[], char *envp[]) rc = 4; goto exit; } - print_device_chain(devpath); + if (print_device_chain(devpath) != 0) { + fprintf(stderr, "device not found\n"); + rc = 4; + goto exit; + } } else { fprintf(stderr, "attribute walk needs --path or node --name specified\n"); rc = 5; -- cgit v1.2.3-54-g00ecf From 82c60ce57206148d00e8d3a210a72a0e7f2aa380 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 19 Sep 2006 17:46:04 +0200 Subject: udev_sysfs: unify symlink resolving --- udev.h | 1 + udev_sysfs.c | 82 ++++++++++++++++++++++++++---------------------------------- 2 files changed, 37 insertions(+), 46 deletions(-) diff --git a/udev.h b/udev.h index 3899669868..d09c9922cd 100644 --- a/udev.h +++ b/udev.h @@ -113,6 +113,7 @@ extern struct sysfs_device *sysfs_device_get(const char *devpath); extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem); extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); +extern int sysfs_resolve_link(char *path, size_t size); /* udev_node.c */ extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); diff --git a/udev_sysfs.c b/udev_sysfs.c index 0b7561f0eb..0e448894fe 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -112,6 +112,38 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, dbg("kernel_number='%s'", dev->kernel_number); } +int sysfs_resolve_link(char *devpath, size_t size) +{ + char link_path[PATH_SIZE]; + char link_target[PATH_SIZE]; + int len; + int i; + int back; + + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, devpath, sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len <= 0) + return -1; + link_target[len] = '\0'; + dbg("path link '%s' points to '%s'", devpath, link_target); + + for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) + ; + dbg("base '%s', tail '%s', back %i", devpath, &link_target[back * 3], back); + for (i = 0; i <= back; i++) { + char *pos = strrchr(devpath, '/'); + + if (pos == NULL) + return -1; + pos[0] = '\0'; + } + dbg("after moving back '%s'", devpath); + strlcat(devpath, "/", size); + strlcat(devpath, &link_target[back * 3], size); + return 0; +} + struct sysfs_device *sysfs_device_get(const char *devpath) { char path[PATH_SIZE]; @@ -144,27 +176,8 @@ struct sysfs_device *sysfs_device_get(const char *devpath) return NULL; } if (S_ISLNK(statbuf.st_mode)) { - int i; - int back; - - len = readlink(path, link_target, sizeof(link_target)); - if (len <= 0) + if (sysfs_resolve_link(devpath_real, sizeof(devpath_real)) != 0) return NULL; - link_target[len] = '\0'; - dbg("devpath link '%s' points to '%s'", path, link_target); - - for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) - ; - dbg("base '%s', tail '%s', back %i", devpath_real, &link_target[back * 3], back); - for (i = 0; i <= back; i++) { - pos = strrchr(devpath_real, '/'); - if (pos == NULL) - return NULL; - pos[0] = '\0'; - } - dbg("after moving back '%s'", devpath_real); - strlcat(devpath_real, "/", sizeof(devpath_real)); - strlcat(devpath_real, &link_target[back * 3], sizeof(devpath_real)); /* now look for device in cache after path translation */ list_for_each_entry(dev_loop, &dev_list, node) { @@ -247,12 +260,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) { char parent_devpath[PATH_SIZE]; - char device_link[PATH_SIZE]; - char device_link_target[PATH_SIZE]; char *pos; - int i; - int len; - int back; dbg("open '%s'", dev->devpath); @@ -298,28 +306,10 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) return dev->parent; device_link: - strlcpy(device_link, sysfs_path, sizeof(device_link)); - strlcat(device_link, dev->devpath, sizeof(device_link)); - strlcat(device_link, "/device", sizeof(device_link)); - len = readlink(device_link, device_link_target, sizeof(device_link_target)); - if (len < 0) - return NULL; - device_link_target[len] = '\0'; - dbg("device link '%s' points to '%s'", device_link, device_link_target); - - for (back = 0; strncmp(&device_link_target[back * 3], "../", 3) == 0; back++) - ; strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - dbg("base='%s', tail='%s', back=%i", parent_devpath, &device_link_target[back * 3], back); - for (i = 0; i < back; i++) { - pos = strrchr(parent_devpath, '/'); - if (pos == NULL) - return NULL; - pos[0] = '\0'; - } - dbg("after moving back '%s'", parent_devpath); - strlcat(parent_devpath, "/", sizeof(parent_devpath)); - strlcat(parent_devpath, &device_link_target[back * 3], sizeof(parent_devpath)); + strlcat(parent_devpath, "/device", sizeof(parent_devpath)); + if (sysfs_resolve_link(parent_devpath, sizeof(parent_devpath)) != 0) + return NULL; /* get parent and remember it */ dev->parent = sysfs_device_get(parent_devpath); -- cgit v1.2.3-54-g00ecf From c48622cc25bad59aadb9f8e1d66c6ed5fb85cbe0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 19 Sep 2006 17:51:31 +0200 Subject: udevtrigger: trigger devices sorted by their dependency Resolve the links to the real device location in the tree, and sort the list, to make sure that parent devices are triggered before their childs. --- udevtrigger.c | 149 +++++++++++++++++++++++----------------------------------- 1 file changed, 60 insertions(+), 89 deletions(-) diff --git a/udevtrigger.c b/udevtrigger.c index bf5ec25aca..c5d88b9ee0 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -34,6 +34,14 @@ #include "udev.h" #include "udevd.h" +static int verbose; +static int dry_run; +LIST_HEAD(device_list); +LIST_HEAD(filter_subsystem_match_list); +LIST_HEAD(filter_subsystem_nomatch_list); +LIST_HEAD(filter_attr_match_list); +LIST_HEAD(filter_attr_nomatch_list); + #ifdef USE_LOG void log_message(int priority, const char *format, ...) { @@ -48,69 +56,62 @@ void log_message(int priority, const char *format, ...) } #endif -static int verbose; -static int dry_run; - -/* list of devices that we should run last due to any one of a number of reasons */ -static char *last_list[] = { - "/class/block/md", - "/class/block/dm-", - "/block/md", - "/block/dm-", - NULL -}; - -/* list of devices that we should run first due to any one of a number of reasons */ -static char *first_list[] = { - "/class/mem", - "/class/tty", - NULL -}; - -LIST_HEAD(device_first_list); -LIST_HEAD(device_default_list); -LIST_HEAD(device_last_list); +/* devices that should run last cause of their dependencies */ +static int delay_device(const char *devpath) +{ + static const char *delay_device_list[] = { + "*/md*", + "*/dm-*", + NULL + }; + int i; -LIST_HEAD(filter_subsystem_match_list); -LIST_HEAD(filter_subsystem_nomatch_list); -LIST_HEAD(filter_attr_match_list); -LIST_HEAD(filter_attr_nomatch_list); + for (i = 0; delay_device_list[i] != NULL; i++) + if (fnmatch(delay_device_list[i], devpath, 0) == 0) + return 1; + return 0; +} static int device_list_insert(const char *path) { - struct list_head *device_list = &device_default_list; - const char *devpath = &path[strlen(sysfs_path)]; - int i; - - for (i = 0; first_list[i] != NULL; i++) { - if (strncmp(devpath, first_list[i], strlen(first_list[i])) == 0) { - device_list = &device_first_list; - break; - } - } - for (i = 0; last_list[i] != NULL; i++) { - if (strncmp(devpath, last_list[i], strlen(last_list[i])) == 0) { - device_list = &device_last_list; - break; - } - } + char filename[PATH_SIZE]; + char devpath[PATH_SIZE]; + struct stat statbuf; dbg("add '%s'" , path); - /* double entries will be ignored */ - name_list_add(device_list, path, 0); + + /* we only have a device, if we have an uevent file */ + strlcpy(filename, path, sizeof(filename)); + strlcat(filename, "/uevent", sizeof(filename)); + if (stat(filename, &statbuf) < 0) + return -1; + if (!(statbuf.st_mode & S_IWUSR)) + return -1; + + strlcpy(devpath, &path[strlen(sysfs_path)], sizeof(devpath)); + + /* resolve possible link to real target */ + if (lstat(path, &statbuf) < 0) + return -1; + if (S_ISLNK(statbuf.st_mode)) + if (sysfs_resolve_link(devpath, sizeof(devpath)) != 0) + return -1; + + name_list_add(&device_list, devpath, 1); return 0; } -static void trigger_uevent(const char *path) +static void trigger_uevent(const char *devpath) { char filename[PATH_SIZE]; int fd; - strlcpy(filename, path, sizeof(filename)); + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, devpath, sizeof(filename)); strlcat(filename, "/uevent", sizeof(filename)); if (verbose) - printf("%s\n", path); + printf("%s\n", devpath); if (dry_run) return; @@ -127,50 +128,28 @@ static void trigger_uevent(const char *path) close(fd); } -static void exec_lists(void) +static void exec_list(void) { struct name_entry *loop_device; struct name_entry *tmp_device; - /* handle the devices on the "first" list first */ - list_for_each_entry_safe(loop_device, tmp_device, &device_first_list, node) { - trigger_uevent(loop_device->name); - list_del(&loop_device->node); - free(loop_device); - } + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { + if (delay_device(loop_device->name)) + continue; - /* handle the devices on the "default" list next */ - list_for_each_entry_safe(loop_device, tmp_device, &device_default_list, node) { trigger_uevent(loop_device->name); list_del(&loop_device->node); free(loop_device); } - /* handle devices on the "last" list, if any */ - list_for_each_entry_safe(loop_device, tmp_device, &device_last_list, node) { + /* trigger remaining delayed devices */ + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { trigger_uevent(loop_device->name); list_del(&loop_device->node); free(loop_device); } } -static int is_device(const char *path) -{ - char filename[PATH_SIZE]; - struct stat statbuf; - - /* look for the uevent file of the kobject */ - strlcpy(filename, path, sizeof(filename)); - strlcat(filename, "/uevent", sizeof(filename)); - if (stat(filename, &statbuf) < 0) - return 0; - - if (!(statbuf.st_mode & S_IWUSR)) - return 0; - - return 1; -} - static int subsystem_filtered(const char *subsystem) { struct name_entry *loop_name; @@ -299,8 +278,7 @@ static void scan_bus(void) strlcat(dirname2, dent2->d_name, sizeof(dirname2)); if (attr_filtered(dirname2)) continue; - if (is_device(dirname2)) - device_list_insert(dirname2); + device_list_insert(dirname2); } closedir(dir2); } @@ -343,9 +321,7 @@ static void scan_block(void) strlcat(dirname, dent->d_name, sizeof(dirname)); if (attr_filtered(dirname)) continue; - if (is_device(dirname)) - device_list_insert(dirname); - else + if (device_list_insert(dirname) != 0); continue; /* look for partitions */ @@ -365,8 +341,7 @@ static void scan_block(void) strlcat(dirname2, dent2->d_name, sizeof(dirname2)); if (attr_filtered(dirname2)) continue; - if (is_device(dirname2)) - device_list_insert(dirname2); + device_list_insert(dirname2); } closedir(dir2); } @@ -416,8 +391,7 @@ static void scan_class(void) strlcat(dirname2, dent2->d_name, sizeof(dirname2)); if (attr_filtered(dirname2)) continue; - if (is_device(dirname2)) - device_list_insert(dirname2); + device_list_insert(dirname2); } closedir(dir2); } @@ -455,10 +429,7 @@ static void scan_failed(void) if (device[i] == PATH_TO_NAME_CHAR) device[i] = '/'; - if (is_device(device)) - device_list_insert(device); - else - continue; + device_list_insert(device); } closedir(dir); } @@ -539,7 +510,7 @@ int main(int argc, char *argv[], char *envp[]) scan_class(); scan_block(); } - exec_lists(); + exec_list(); exit: name_list_cleanup(&filter_subsystem_match_list); -- cgit v1.2.3-54-g00ecf From 9a00cb9efdcc6a9de3f722f88963ca31ec50dcc1 Mon Sep 17 00:00:00 2001 From: VMiklos Date: Wed, 20 Sep 2006 00:02:50 +0200 Subject: update Frugalware rules --- etc/udev/frugalware/05-udev-early.rules | 4 - etc/udev/frugalware/50-udev-default.rules | 355 +++++++++++++----------- etc/udev/frugalware/60-persistent-storage.rules | 48 ---- 3 files changed, 198 insertions(+), 209 deletions(-) delete mode 100644 etc/udev/frugalware/05-udev-early.rules delete mode 100644 etc/udev/frugalware/60-persistent-storage.rules diff --git a/etc/udev/frugalware/05-udev-early.rules b/etc/udev/frugalware/05-udev-early.rules deleted file mode 100644 index 417ee67d6f..0000000000 --- a/etc/udev/frugalware/05-udev-early.rules +++ /dev/null @@ -1,4 +0,0 @@ -# sysfs is populated after the event is sent -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" - diff --git a/etc/udev/frugalware/50-udev-default.rules b/etc/udev/frugalware/50-udev-default.rules index 920d4706fd..2f47773e5a 100644 --- a/etc/udev/frugalware/50-udev-default.rules +++ b/etc/udev/frugalware/50-udev-default.rules @@ -1,157 +1,198 @@ -# console -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="vcs*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="vcsa*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", MODE="600", OPTIONS="last_rule" -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" - -# serial devices -KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp" -KERNEL=="pppox*", NAME="%k", GROUP="uucp" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp" -KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp" -KERNEL=="hvc*", NAME="%k", GROUP="uucp" -KERNEL=="hvsi*", NAME="%k", GROUP="uucp" -KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp" -KERNEL=="ttyUSB*", SYSFS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" -KERNEL=="ttyUSB*", SYSFS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" - -# video/graphics -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="graphics" GROUP="video" -KERNEL=="vtx*", NAME="%k", GROUP="video" -KERNEL=="vbi*", NAME="%k", GROUP="video" -KERNEL=="winradio*", NAME="%k", GROUP="video" -KERNEL=="vttuner*", NAME="%k", GROUP="video" -KERNEL=="nvidia*", NAME="%k", GROUP="video" -KERNEL=="nvidiactl*", NAME="%k", GROUP="video" -KERNEL=="video0", SYMLINK+="video" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="vbi0", SYMLINK+="vbi" -KERNEL=="pmu", GROUP="video" - -# dvb -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" - -# input devices -KERNEL=="mice", NAME="input/%k", MODE="0640" -KERNEL=="mouse*", NAME="input/%k", MODE="0640" -KERNEL=="event*", NAME="input/%k", MODE="0640" -KERNEL=="js*", NAME="input/%k", MODE="0644" -KERNEL=="ts*", NAME="input/%k", MODE="0600" -KERNEL=="uinput", NAME="input/%k", MODE="0600" -KERNEL=="lirc0", NAME="%k", SYMLINK+="lirc" - -# printer -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp" -KERNEL=="irlpt*", NAME="%k", GROUP="lp" - -# cpu devices -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" - -# IEEE1394 devices -KERNEL=="raw1394*", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="%k", SYMLINK+="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="%k", SYMLINK+="video1394/%n", GROUP="video" - -# 183 = /dev/hwrng Generic random number generator -KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" -# 219 /dev/modems/mwave MWave modem firmware upload -KERNEL=="mwave", NAME="modems/%k" -# 169 /dev/specialix_rioctl Specialix RIO serial control -KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" -# 167 /dev/specialix_sxctl Specialix serial control -KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" - -# network -KERNEL=="tun", NAME="net/%k", MODE="0600" - -# misc devices -KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="port", NAME="%k", GROUP="kmem", MODE="640" -KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" -KERNEL=="null", NAME="%k", MODE="666" -KERNEL=="zero", NAME="%k", MODE="666" -KERNEL=="full", NAME="%k", MODE="622" -KERNEL=="random", NAME="%k", MODE="666" -KERNEL=="urandom", NAME="%k", MODE="644" -KERNEL=="rtc", MODE="600" -KERNEL=="sonypi", MODE="0666" -KERNEL=="agpgart", MODE="0600", GROUP="video" -KERNEL=="djs*", NAME="%k", MODE="644" -KERNEL=="sgi_*", NAME="%k", MODE="666" -KERNEL=="rrom*", NAME="%k", MODE="400" -KERNEL=="rflash*", NAME="%k", MODE="400" -KERNEL=="usbscanner*", NAME="%k", MODE="644" -KERNEL=="3270/ttycons*", NAME="%k", MODE="600" -KERNEL=="3270/tub*", NAME="%k", MODE="666" -KERNEL=="3270/tubcons*", NAME="%k", MODE="600" -KERNEL=="ica", NAME="%k", MODE="666" -KERNEL=="z90crypt", NAME="%k", MODE="666" -KERNEL=="mmtimer", NAME="%k", MODE="644" -KERNEL=="auer[0-9]*" NAME="usb/%k" - -# packet writing interface -KERNEL=="pktcdvd", NAME="pktcdvd/control" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" - -# fix floppy devices -KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" -KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{cmos} -m %M /dev/%k" -KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/rm -f $root/%k*" - -# block devices -SUBSYSTEM=="block", GROUP="disk", MODE="0640" - -# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC -# sr: 4 TYPE_WORM, 5 TYPE_ROM -# st/osst: 1 TYPE_TAPE -ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="1", RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", SYSFS{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" - -# device mapper -KERNEL=="device-mapper", NAME="%k", SYMLINK+="mapper/control" - -# misc storage devices (non-block) -KERNEL=="sg*", NAME="%k", GROUP="disk", MODE="640" -KERNEL=="st*", NAME="%k", GROUP="disk" -KERNEL=="nst*", NAME="%k", GROUP="disk" -KERNEL=="initrd", NAME="%k", GROUP="disk" -KERNEL=="qft*", NAME="%k", GROUP="disk" -KERNEL=="nqft*", NAME="%k", GROUP="disk" -KERNEL=="zqft*", NAME="%k", GROUP="disk" -KERNEL=="nzqft*", NAME="%k", GROUP="disk" -KERNEL=="rawqft*", NAME="%k", GROUP="disk" -KERNEL=="nrawqft*", NAME="%k", GROUP="disk" -KERNEL=="pf*", NAME="%k", GROUP="disk" -KERNEL=="sch*", NAME="%k", GROUP="disk" -KERNEL=="pt*", NAME="%k", GROUP="disk" -KERNEL=="npt*", NAME="%k", GROUP="disk" -KERNEL=="pg*", NAME="%k", GROUP="disk" -KERNEL=="evms/block_device*", NAME="%k", GROUP="disk" -KERNEL=="rawctl*", NAME="raw/%k", GROUP="disk" -KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL=="osst*", NAME="%k", GROUP="disk" -KERNEL=="nosst*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" - -# libusb device access -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" - -# kernel firmware loader -SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" - +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# See the udev.rules.examples file for more examples of how to create rules +# + +# permissions for IDE CD devices +SUBSYSTEMS=="ide", KERNEL=="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom*", NAME="%k", GROUP="cdrom", MODE="0660" + +# permissions for SCSI cd/sg/tape devices +SUBSYSTEMS=="scsi", KERNEL=="s[grt][0-9]*", ATTRS{type}=="5", NAME="%k", GROUP="cdrom", MODE="0660" + +# USB devices +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="auer*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k" +KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" + +# CAPI devices +KERNEL=="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# Network devices +KERNEL=="tun", NAME="net/%k" + +# permissions +KERNEL=="pl2303", NAME="%k", OWNER="500", GROUP="500", MODE="0666" +KERNEL=="visor", NAME="%k", OWNER="root", GROUP="uucp", MODE="0666" +KERNEL=="camera*" NAME="%k", OWNER="root", GROUP="camera", MODE="0666" + +# console devices +KERNEL=="console" NAME="%k", OWNER="root", GROUP="tty", MODE="0600" +KERNEL=="tty", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="tty[0-9]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" +KERNEL=="vcs*", NAME="%k", OWNER="root", GROUP="tty", MODE="0620" +KERNEL=="tty[CIS]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL=="ttyUB[0-9]", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB0", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB1", NAME="%k", OWNER="root" GROUP="uucp", MODE="0666" + +# pty devices +KERNEL=="ptmx" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="pty[p-za-e][0-9a-f]*" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="tty[p-za-e][0-9a-f]*" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="cu[abiu]*" NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" + +# sound devices +KERNEL=="audio*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="beep" NAME="%k", OWNER="root", GROUP="audio", MODE="0644" +KERNEL=="dsp*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="midi*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="mixer*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="music" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="sequencer*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="controlC[0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="hw[CD0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="midiC[D0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="timer", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="seq", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="sndstat" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="speaker" NAME="%k", OWNER="root", GROUP="audio", MODE="0644" +KERNEL=="sound/*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="admmidi*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="adsp*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="aload*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="amidi*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="amixer*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" + +# input devices (mouse, joystick, etc) +KERNEL=="mice", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="mouse*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="event*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="js*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="ts*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="input/js*" NAME="%k", OWNER="root", GROUP="games",0 MODE="0666" +KERNEL=="djs[0-3]" NAME="%k", OWNER="root", GROUP="games", MODE="0660" +KERNEL=="psaux" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="crash" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="logibm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="jbm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="hwtrap" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="inportbm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="sexec" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="jsflash" NAME="%k", OWNER="root", GROUP="root", MODE="0660" + +# power manager device +KERNEL=="apm_bios" NAME="%k", OWNER="root", GROUP="root", MODE="0644" + +# printer device +KERNEL=="lp[0-9]" NAME="%k", OWNER="root", GROUP="lp", MODE="0660" +KERNEL=="parport*" NAME="%k", OWNER="root", GROUP="lp", MODE="0660" + +# video devices +KERNEL=="card*" NAME="dri/card%n", OWNER="root", GROUP="video", MODE="0666" +KERNEL=="fb[0-9]" NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="agpgart" NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="nvidia*" NAME="%k", OWNER="root", GROUP="video", MODE="0666" +KERNEL=="video*" NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="vbi*" NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; A=$${K%%%%.*}; D=$${K#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video", MODE="0660" + +# DISK devices +KERNEL=="ed[ab]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="gscd0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="initrd" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="lmscd" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="mcd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="md*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="mtd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="userdma" NAME="%k", OWNER="root", GROUP="root", MODE="0660" + +# floppy devices +KERNEL=="fd[0-3]*" NAME="%k", OWNER="root", GROUP="floppy", MODE="0660" +KERNEL=="fd0" SYMLINK="floppy" + +# permissions for removable devices like cardreaders or sticks +KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="0", NAME="%k", GROUP="storage" + +# permissions for firewire external drives +KERNEL=="sd*", ATTRS{scsi_level}=="5", NAME="%k", GROUP="storage" + +# permissions for usb to scsi external adapters +KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="7", NAME="%k", GROUP="storage" + +# IDE devices (hd, cdrom) +KERNEL=="hd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="ht0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" + +# RAID IDE +KERNEL=="ataraid[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="ataraid/*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" + +# SCSI devices +KERNEL=="scsi/*/cd" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="scsi/*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="sd[a-h]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="s[rt][0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="scd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" + +# generic scsi devices +KERNEL=="sg*" NAME="%k", OWNER="root", GROUP="root", MODE="0600" + +# old CD-ROM +KERNEL=="sbpcd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" + +# loop devices +KERNEL=="loop[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" + +# network block devices +KERNEL=="nb[0-7]" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="nht0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="npt[0-3]" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="n[qrs]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" + +# memory access devices +KERNEL=="kmem" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL=="mem" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL=="null" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL=="nvram" NAME="%k", OWNER="root", GROUP="root", MODE="0640" +KERNEL=="port" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL=="ram[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="random" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="rtc" NAME="%k", OWNER="root", GROUP="root", MODE="0444" +KERNEL=="urandom" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="full" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL=="zero" NAME="%k", OWNER="root", GROUP="root", MODE="0666" +KERNEL=="raw[0-9]*" NAME="raw/%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="modreq" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="msr" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="profile*" NAME="%k", OWNER="root", GROUP="root", MODE="0640" + +# ISDN devices +KERNEL=="isdn*" NAME="%k", OWNER="root", GROUP="tty", MODE="0660" + +# net devices +KERNEL=="ippp*" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="ipstate*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="spx" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="fwmonitor*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" + +# hotplug rules - module autoloading for different buses +ACTION=="add", SUBSYSTEM=="pci", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" +ACTION=="add", SUBSYSTEM=="usb", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" +ACTION=="add", SUBSYSTEM=="ieee1394", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[07]", RUN+="/sbin/modprobe sd_mod" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="14", RUN+="/sbin/modprobe sd_mod" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*", RUN+="/sbin/modprobe st" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}!="Onstream", RUN+="/sbin/modprobe st" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[23689]", RUN+="/sbin/modprobe sg" + +# firmware +ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN+="/lib/udev/firmware.sh" diff --git a/etc/udev/frugalware/60-persistent-storage.rules b/etc/udev/frugalware/60-persistent-storage.rules deleted file mode 100644 index 5a63a4fa70..0000000000 --- a/etc/udev/frugalware/60-persistent-storage.rules +++ /dev/null @@ -1,48 +0,0 @@ -# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_storage_end" -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" - -# never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", SYSFS{removable}=="1", DRIVER=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_storage_end" - -# for partitions import parent information -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*|st*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_storage_end" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_storage_end" -IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From d6e3953888bbaa3d052c4ef6ec022aa62c077f51 Mon Sep 17 00:00:00 2001 From: Michał Bartoszkiewicz Date: Wed, 20 Sep 2006 12:22:24 +0200 Subject: udevtrigger: fix typo that prevents partition events --- udevtrigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevtrigger.c b/udevtrigger.c index c5d88b9ee0..2b4ab80901 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -321,7 +321,7 @@ static void scan_block(void) strlcat(dirname, dent->d_name, sizeof(dirname)); if (attr_filtered(dirname)) continue; - if (device_list_insert(dirname) != 0); + if (device_list_insert(dirname) != 0) continue; /* look for partitions */ -- cgit v1.2.3-54-g00ecf From 92be0b870032fdbd5634bf75742d47a7a2276f24 Mon Sep 17 00:00:00 2001 From: Arjan Opmeer Date: Wed, 20 Sep 2006 20:20:35 +0200 Subject: fix udevinfo help text typo --- udevinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index 2832ea0ee3..0551eb2e32 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -308,7 +308,7 @@ int main(int argc, char *argv[], char *envp[]) " --root prepend to query result or print udev_root\n" " --attribute-walk print all SYSFS_attributes along the device chain\n" " --export-db export the content of the udev database\n" - " --verision print udev version\n" + " --version print udev version\n" " --help print this text\n" "\n"); goto exit; -- cgit v1.2.3-54-g00ecf From b4e4b5a5db32177ec422c96d4440651a85d59704 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Sep 2006 20:22:57 +0200 Subject: fix spelling in deprecation warning Found by Andreas Hanke. --- udev_rules_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index a137331273..535b59590a 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -580,7 +580,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (physdev && rule->wait_for_sysfs.operation == KEY_OP_UNSET) - err("PHYSDEV* values are deprected and will be removed from a future kernel, " + err("PHYSDEV* values are deprecated and will be removed from a future kernel, " "please fix it in %s:%u", filename, lineno); /* skip line if not any valid key was found */ -- cgit v1.2.3-54-g00ecf From d3641ff2ac10e9969b5c6c003db03604e2a2aac4 Mon Sep 17 00:00:00 2001 From: Piter PUNK Date: Wed, 20 Sep 2006 21:00:29 +0200 Subject: update slackware rules --- etc/udev/slackware/udev.rules | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/etc/udev/slackware/udev.rules b/etc/udev/slackware/udev.rules index 4b36091528..12dac4d84d 100644 --- a/etc/udev/slackware/udev.rules +++ b/etc/udev/slackware/udev.rules @@ -15,8 +15,12 @@ ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" # all block devices SUBSYSTEM=="block", GROUP="disk" -# permissions for IDE CD devices -BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660", RUN+="/lib/udev/cdrom-symlinks.sh %k" +# permissions for IDE CD devices (without symbolic link creation) +BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660" + +# permissions for IDE CD devices (with symbolic link creation) +# THIS RULE COMMENTED OUT BY DEFAULT: read /lib/udev/rc.optical-symlinks for more information... +#BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660", RUN+="/lib/udev/cdrom-symlinks.sh %k" # permissions for IDE floppy devices BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-floppy*", NAME="%k", GROUP="floppy", MODE="0660" @@ -81,8 +85,8 @@ KERNEL=="*[!0-9]", IMPORT{program}="/lib/udev/edd_id --export $tempnode" KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" -# No dmsetup in slackware by default (LVM2 is in testing) -#KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" +# LVM2 dmsetup +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" LABEL="persistent_end" @@ -128,7 +132,7 @@ KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" # input devices KERNEL=="mice", NAME="input/%k", MODE="0644", SYMLINK+="mouse" KERNEL=="mouse*", NAME="input/%k", MODE="0644" -KERNEL=="event*", NAME="input/%k", MODE="0600" +KERNEL=="event*", NAME="input/%k", MODE="0640" KERNEL=="js*", NAME="input/%k", MODE="664" KERNEL=="ts*", NAME="input/%k", MODE="0600" SUBSYSTEM=="input[0-9]*", RUN+="/lib/udev/input_device.sh" @@ -183,7 +187,7 @@ KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK+="%k", GROUP="tty" KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0600" +KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" KERNEL=="ippp0", NAME="%k", GROUP="tty" KERNEL=="isdn*", NAME="%k", GROUP="tty" KERNEL=="dcbri*", NAME="%k", GROUP="tty" -- cgit v1.2.3-54-g00ecf From fa0bca0120fb5b219d8a97d969587e89471a4476 Mon Sep 17 00:00:00 2001 From: Bryan Kadzban Date: Sat, 23 Sep 2006 22:09:41 +0200 Subject: cleanup default rules --- etc/udev/rules.d/05-udev-early.rules | 1 - etc/udev/rules.d/60-persistent-storage.rules | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/etc/udev/rules.d/05-udev-early.rules b/etc/udev/rules.d/05-udev-early.rules index 417ee67d6f..4dc497bac2 100644 --- a/etc/udev/rules.d/05-udev-early.rules +++ b/etc/udev/rules.d/05-udev-early.rules @@ -1,4 +1,3 @@ # sysfs is populated after the event is sent -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 5a4843e495..fec0aa8225 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -12,14 +12,14 @@ KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO=" KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # for partitions import parent information -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", IMPORT{parent}="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -- cgit v1.2.3-54-g00ecf From 53fc01d5073962e94cb32b686c0146b08ea8fef5 Mon Sep 17 00:00:00 2001 From: Bryan Kadzban Date: Sat, 23 Sep 2006 22:10:55 +0200 Subject: add IMPORT operations to the udev man page --- extras/volume_id/vol_id.8 | 22 +++-- udev.7 | 224 +++++++++++++++++++++++++++++++++++----------- udev.xml | 36 ++++++-- udevd.8 | 34 +++++-- udevinfo.8 | 30 +++++-- udevmonitor.8 | 6 +- udevsettle.8 | 10 ++- udevstart.8 | 2 +- udevtest.8 | 2 +- udevtrigger.8 | 34 +++++-- 10 files changed, 302 insertions(+), 98 deletions(-) diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index 3129ab1b91..d57ecc6bf7 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -1,6 +1,6 @@ .\" Title: vol_id .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: March 2006 .\" Manual: vol_id .\" Source: volume_id @@ -22,22 +22,32 @@ is usually called from a udev rule, to provide udev with the filesystem type, th \fBvol_id\fR supports all common filesystem formats and detects various raid setups to prevent the recognition of raid members as a volume with a filesystem. .SH "OPTIONS" -.TP 3n +.PP \fB\-\-export\fR +.RS 3n print all values in key/value format to import them into the environment. -.TP 3n +.RE +.PP \fB\-t\fR +.RS 3n print the filesystem type -.TP 3n +.RE +.PP \fB\-l\fR +.RS 3n print the label of a volume -.TP 3n +.RE +.PP \fB\-u\fR +.RS 3n print the uuid of a volume +.RE .SH "ENVIRONMENT" -.TP 3n +.PP \fBUDEV_LOG\fR +.RS 3n Set the syslog priority. +.RE .SH "EXIT STATUS" .PP \fBvol_id\fR diff --git a/udev.7 b/udev.7 index 05fa2e622b..3d80e133e3 100644 --- a/udev.7 +++ b/udev.7 @@ -1,6 +1,6 @@ .\" Title: udev .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: August 2005 .\" Manual: udev .\" Source: udev @@ -31,23 +31,28 @@ All udev configuration files are placed in .PP udev expects its main configuration file at \fI/etc/udev/udev.conf\fR. It consists of a set of variables allowing the user to override default udev values. The following variables can be set: -.TP 3n +.PP \fBudev_root\fR +.RS 3n Specifies where to place the device nodes in the filesystem. The default value is \fI/dev\fR. -.TP 3n +.RE +.PP \fBudev_rules\fR +.RS 3n The name of the udev rules file or directory to look for files with the suffix \fI.rules\fR. Multiple rule files are read in lexical order. The default value is \fI/etc/udev/rules.d\fR. -.TP 3n +.RE +.PP \fBudev_log\fR +.RS 3n The logging priority. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, \fBinfo\fR and \fBdebug\fR. -.\" end of SS subsection "Configuration file" +.RE .SS "Rules files" .PP The udev rules are read from the files located in the @@ -55,114 +60,197 @@ The udev rules are read from the files located in the directory or at the location specified value in the configuration file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. .PP A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: -.TP 3n +.PP \fB==\fR +.RS 3n Compare for equality. -.TP 3n +.RE +.PP \fB!=\fR +.RS 3n Compare for non\-equality. -.TP 3n +.RE +.PP \fB=\fR +.RS 3n Assign a value to a key. Keys that represent a list, are reset and only this single value is assigned. -.TP 3n +.RE +.PP \fB+=\fR +.RS 3n Add the value to a key that holds a list of entries. -.TP 3n +.RE +.PP \fB:=\fR +.RS 3n Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules. +.RE .PP The following key names can be used to match against device properties: -.TP 3n +.PP \fBACTION\fR +.RS 3n Match the name of the event action. -.TP 3n +.RE +.PP \fBDEVPATH\fR +.RS 3n Match the devpath of the event device. -.TP 3n +.RE +.PP \fBKERNEL\fR +.RS 3n Match the name of the event device. -.TP 3n +.RE +.PP \fBSUBSYSTEM\fR +.RS 3n Match the subsystem of the event device. -.TP 3n +.RE +.PP \fBATTR{\fR\fB\fIfilename\fR\fR\fB}\fR +.RS 3n Match sysfs attribute values of the event device. Up to five \fBATTR\fR keys can be specified per rule. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. Depending on the type of operator, this key is also used to set the value of a sysfs attribute. -.TP 3n +.RE +.PP \fBKERNELS\fR +.RS 3n Search the devpath upwards for a matching device name. -.TP 3n +.RE +.PP \fBSUBSYSTEMS\fR +.RS 3n Search the devpath upwards for a matching device subsystem name. -.TP 3n +.RE +.PP \fBDRIVERS\fR +.RS 3n Search the devpath upwards for a matching device driver name. -.TP 3n +.RE +.PP \fBATTRS{\fR\fB\fIfilename\fR\fR\fB}\fR +.RS 3n Search the devpath upwards for a device with matching sysfs attribute values. Up to five \fBATTRS\fR keys can be specified per rule. All attributes must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. -.TP 3n +.RE +.PP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR +.RS 3n Match against the value of an environment variable. Up to five \fBENV\fR keys can be specified per rule. Depending on the type of operator, this key is also used to export a variable to the environment. -.TP 3n +.RE +.PP \fBPROGRAM\fR +.RS 3n Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key. -.TP 3n +.RE +.PP \fBRESULT\fR +.RS 3n Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call. +.RE .PP Most of the fields support a shell style pattern matching. The following pattern characters are supported: -.TP 3n +.PP \fB*\fR +.RS 3n Matches zero, or any number of characters. -.TP 3n +.RE +.PP \fB?\fR +.RS 3n Matches any single character. -.TP 3n +.RE +.PP \fB[]\fR +.RS 3n Matches any single character specified within the brackets. For example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. +.RE .PP The following keys can get values assigned: -.TP 3n +.PP \fBNAME\fR +.RS 3n The name of the node to be created, or the name the network interface should be renamed to. Only one rule can set the node name, all later rules with a NAME key will be ignored. -.TP 3n +.RE +.PP \fBSYMLINK\fR +.RS 3n The name of a symlink targeting the node. Every matching rule can add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character. -.TP 3n +.RE +.PP \fBOWNER, GROUP, MODE\fR +.RS 3n The permissions for the device node. Every specified value overwrites the compiled\-in default value. -.TP 3n +.RE +.PP \fBATTR{\fR\fB\fIkey\fR\fR\fB}\fR +.RS 3n The value that should be written to a sysfs attribute of the event device. Depending on the type of operator, this key is also used to match against the value of a sysfs attribute. -.TP 3n +.RE +.PP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR +.RS 3n Export a variable to the environment. Depending on the type of operator, this key is also to match against an environment variable. -.TP 3n +.RE +.PP \fBRUN\fR +.RS 3n Add a program to the list of programs to be executed for a specific device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. -.TP 3n +.RE +.PP \fBLABEL\fR +.RS 3n Named label where a GOTO can jump to. -.TP 3n +.RE +.PP \fBGOTO\fR +.RS 3n Jumps to the next LABEL with a matching name -.TP 3n +.RE +.PP \fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR -Import the printed result or the value of a file in environment key format into the event environment. +.RS 3n +Import a set of variables into the event environment, depending on +\fItype\fR: +.RS 3n +.PP +\fBprogram\fR +.RS 3n +Execute an external program specified as the assigned value and import its output, which must be in environment key format. +.RE +.PP +\fBfile\fR +.RS 3n +Import a text file specified as the assigned value, which must be in environment key format. +.RE +.PP +\fBparent\fR +.RS 3n +Import the stored keys from the parent device by reading the database entry of the parent device. The value assigned to +\fBIMPORT{parent}\fR +is used as a filter of key names to import (with the same shell\-style pattern matching used for comparisons). +.RE +.RE +.IP "" 3n +If no option is given, udev will choose between \fBprogram\fR -will execute an external program and read its output. +and \fBfile\fR -will import a text file. If no option is given, udev will determine it from the executable bit of of the file permissions. -.TP 3n +based on the executable bit of of the file permissions. +.RE +.PP \fBWAIT_FOR_SYSFS\fR +.RS 3n Wait for the specified sysfs file of the device to be created. Can be used to fight against kernel sysfs timing issues. -.TP 3n +.RE +.PP \fBOPTIONS\fR +.RS 3n \fBlast_rule\fR stops further rules application. No later rules will have any effect. \fBignore_device\fR @@ -171,6 +259,7 @@ will ignore this event completely. will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. \fBall_partitions\fR will create the device nodes for all available partitions of a block device. This may be useful for removable media devices where media changes are not detected. +.RE .PP The \fBNAME\fR, @@ -183,58 +272,85 @@ and fields support simple printf\-like string substitutions. The \fBRUN\fR format chars gets applied after all rules have been processed, right before the program is executed. It allows the use of the complete environment set by earlier matching rules. For all other fields, substitutions are applied while the individual rule is being processed. The available substitutions are: -.TP 3n +.PP \fB$kernel\fR, \fB%k\fR +.RS 3n The kernel name for this device. -.TP 3n +.RE +.PP \fB$number\fR, \fB%n\fR +.RS 3n The kernel number for this device. For example, 'sda3' has kernel number of '3' -.TP 3n +.RE +.PP \fB$devpath\fR, \fB%p\fR +.RS 3n The devpath of the device. -.TP 3n +.RE +.PP \fB$id\fR, \fB%b\fR +.RS 3n The name of the device matched while searching the devpath upwards for \fBSUBSYSTEMS\fR, \fBKERNELS\fR, \fBDRIVERS\fR and \fBATTRS\fR. -.TP 3n +.RE +.PP \fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR +.RS 3n The value of a sysfs attribute found at the device, where all keys of the rule have matched. If the matching device does not have such an attribute, all devices along the chain of parents are searched for a matching attribute. If the attribute is a symlink, the last element of the symlink target is returned as the value. -.TP 3n +.RE +.PP \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR +.RS 3n The value of an environment variable. -.TP 3n +.RE +.PP \fB$major\fR, \fB%M\fR +.RS 3n The kernel major number for the device. -.TP 3n +.RE +.PP \fB$minor\fR \fB%m\fR +.RS 3n The kernel minor number for the device. -.TP 3n +.RE +.PP \fB$result\fR, \fB%c\fR +.RS 3n The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: \fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: \fB%c{N+}\fR -.TP 3n +.RE +.PP \fB$parent\fR, \fB%P\fR +.RS 3n The node name of the parent device. -.TP 3n +.RE +.PP \fB$root\fR, \fB%r\fR +.RS 3n The udev_root value. -.TP 3n +.RE +.PP \fB$tempnode\fR, \fB%N\fR +.RS 3n The name of a created temporary device node to provide access to the device from a external program before the real node is created. -.TP 3n +.RE +.PP \fB%%\fR +.RS 3n The '%' character itself. -.TP 3n +.RE +.PP \fB$$\fR +.RS 3n The '$' character itself. +.RE .PP The count of characters to be substituted may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute -.\" end of SS subsection "Rules files" .SH "AUTHOR" .PP Written by Greg Kroah\-Hartman diff --git a/udev.xml b/udev.xml index 852ae039e7..5e5388da51 100644 --- a/udev.xml +++ b/udev.xml @@ -341,11 +341,37 @@ - Import the printed result or the value of a file in environment key - format into the event environment. will execute an - external program and read its output. will import a - text file. If no option is given, udev will determine it from the executable - bit of of the file permissions. + Import a set of variables into the event environment, + depending on type: + + + + + Execute an external program specified as the assigned value and + import its output, which must be in environment key format. + + + + + + Import a text file specified as the assigned value, which must be in + environment key format. + + + + + + Import the stored keys from the parent device by reading + the database entry of the parent device. The value assigned to + is used as a filter of key names + to import (with the same shell-style pattern matching used for + comparisons). + + + + If no option is given, udev will choose between + and based on the executable bit of of the file + permissions. diff --git a/udevd.8 b/udevd.8 index cc724dceda..4243064383 100644 --- a/udevd.8 +++ b/udevd.8 @@ -1,6 +1,6 @@ .\" Title: udevd .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: August 2005 .\" Manual: udevd, udevcontrol .\" Source: udev @@ -21,35 +21,51 @@ udevd \- event managing daemon .PP udevd listens to kernel uevents and passes the incoming events to udev. It ensures the right event order and takes care, that events for child devices are delayed until the parent has finished the device handling. .SH "OPTIONS" -.TP 3n +.PP \fB\-\-daemon\fR +.RS 3n Detach and run in the background. -.TP 3n +.RE +.PP \fB\-\-debug\-trace\fR +.RS 3n Run all events completely serialized. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continiuous operation is needed, where no events are processed in parallel. -.TP 3n +.RE +.PP \fB\-\-verbose\fR +.RS 3n Print log messages to stdout. -.TP 3n +.RE +.PP \fB\-\-help\fR +.RS 3n Print usage. -.TP 3n +.RE +.PP \fBlog_priority=\fR\fB\fIvalue\fR\fR +.RS 3n udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, \fBinfo\fR and \fBdebug\fR. -.TP 3n +.RE +.PP \fBstop_exec_queue\fR +.RS 3n udevcontrol stops the execution of events from udevd. -.TP 3n +.RE +.PP \fBstart_exec_queue\fR +.RS 3n udevcontrol starts the execution of events from udevd. +.RE .SH "ENVIRONMENT" -.TP 3n +.PP \fBUDEV_LOG\fR +.RS 3n Overrides the syslog priority specified in the config file. +.RE .SH "AUTHOR" .PP Written by Kay Sievers diff --git a/udevinfo.8 b/udevinfo.8 index 65c4e3b3de..7ba7e70128 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -1,6 +1,6 @@ .\" Title: udevinfo .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: August 2005 .\" Manual: udevinfo .\" Source: udev @@ -19,8 +19,9 @@ udevinfo \- query device information from the udev database .PP udevinfo queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device. .SH "OPTIONS" -.TP 3n +.PP \fB\-\-query=\fR\fB\fItype\fR\fR +.RS 3n Query the database for specified type of device data. It needs the \fB\-\-path\fR or @@ -31,29 +32,42 @@ to identify the specified device. Valid queries are: \fBpath\fR, \fBenv\fR, \fBall\fR. -.TP 3n +.RE +.PP \fB\-\-path=\fR\fB\fIdevpath\fR\fR +.RS 3n The devpath of the device to query. -.TP 3n +.RE +.PP \fB\-\-name=\fR\fB\fInode\fR\fR +.RS 3n The name of the device node or a symlink to query -.TP 3n +.RE +.PP \fB\-\-root\fR +.RS 3n The udev root directory: \fI/dev\fR. If used in conjunction with a \fBname\fR or \fBsymlink\fR query, the query returns the absolute path including the root directory. -.TP 3n +.RE +.PP \fB\-\-attribute\-walk\fR +.RS 3n Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules. -.TP 3n +.RE +.PP \fB\-\-export\fR +.RS 3n Export the content of the udev database. -.TP 3n +.RE +.PP \fB\-\-help\fR +.RS 3n Print help text. +.RE .SH "AUTHOR" .PP Written by Kay Sievers diff --git a/udevmonitor.8 b/udevmonitor.8 index 4577aef95c..a43ea405bf 100644 --- a/udevmonitor.8 +++ b/udevmonitor.8 @@ -1,6 +1,6 @@ .\" Title: udevmonitor .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: August 2005 .\" Manual: udevmonitor .\" Source: udev @@ -19,9 +19,11 @@ udevmonitor \- print the kernel and udev event sequence to the console .PP udevmonitor listens to the kernel uevents and events send out by a udev rule and prints the devpath of the event to the console. It can be used analyze to the event timing by comparing the timestamps of the kernel uevent with the udev event. .SH "OPTIONS" -.TP 3n +.PP \fB\-\-env\fR +.RS 3n Print the complete environment for all events. Can be used to compare the kernel supplied and the udev added environment values. +.RE .SH "AUTHOR" .PP Written by Kay Sievers diff --git a/udevsettle.8 b/udevsettle.8 index 2a51948d74..bf0cb06ada 100644 --- a/udevsettle.8 +++ b/udevsettle.8 @@ -1,6 +1,6 @@ .\" Title: udevsettle .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: March 2006 .\" Manual: udevsettle .\" Source: udev @@ -19,13 +19,17 @@ udevsettle \- wait until queued kernel/udev events are handled .PP Waits watching the udev event queue and exits if all current events are handled. .SH "OPTIONS" -.TP 3n +.PP \fB\-\-timeout=\fR\fB\fIseconds\fR\fR +.RS 3n maximum seconds to wait for the queue to become empty. +.RE .SH "ENVIRONMENT" -.TP 3n +.PP \fBUDEV_LOG\fR +.RS 3n Overrides the syslog priority specified in the config file. +.RE .SH "AUTHOR" .PP Written by Kay Sievers diff --git a/udevstart.8 b/udevstart.8 index 9f18c05d07..3357c89d73 100644 --- a/udevstart.8 +++ b/udevstart.8 @@ -1,6 +1,6 @@ .\" Title: udevstart .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: August 2005 .\" Manual: udevstart .\" Source: udev diff --git a/udevtest.8 b/udevtest.8 index 9e11f93b24..bb5e98c078 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -1,6 +1,6 @@ .\" Title: udevtest .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: August 2005 .\" Manual: udevtest .\" Source: udev diff --git a/udevtrigger.8 b/udevtrigger.8 index 4525aeeddf..300f8e8984 100644 --- a/udevtrigger.8 +++ b/udevtrigger.8 @@ -1,6 +1,6 @@ .\" Title: udevtrigger .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: March 2006 .\" Manual: udevtrigger .\" Source: udev @@ -19,31 +19,47 @@ udevtrigger \- request kernel devices events for coldplug .PP Trigger kernel device uevents to replay missing events at system coldplug. .SH "OPTIONS" -.TP 3n +.PP \fB\-\-verbose\fR +.RS 3n Print the list of devices which will be triggered. -.TP 3n +.RE +.PP \fB\-\-dry\-run\fR +.RS 3n Do not actually trigger the event. -.TP 3n +.RE +.PP \fB\-\-retry\-failed\fR +.RS 3n Trigger only the events which are failed during a previous run. -.TP 3n +.RE +.PP \fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR +.RS 3n Trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and supports shell style pattern matching. -.TP 3n +.RE +.PP \fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR +.RS 3n Do not trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and supports shell style pattern matching. -.TP 3n +.RE +.PP \fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR +.RS 3n Trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. This option can be specified multiple times. -.TP 3n +.RE +.PP \fB\-\-attr\-nomatch\fR\fB\fIattribute=value\fR\fR +.RS 3n Do not trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. This option can be specified multiple times. +.RE .SH "ENVIRONMENT" -.TP 3n +.PP \fBUDEV_LOG\fR +.RS 3n Overrides the syslog priority specified in the config file. +.RE .SH "AUTHOR" .PP Written by Kay Sievers -- cgit v1.2.3-54-g00ecf From 9b2a90381277b821316b548f7472a4d226545b15 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Sep 2006 14:30:00 +0200 Subject: release 101 --- Makefile | 2 +- RELEASE-NOTES | 16 ++++++++++++++++ TODO | 9 --------- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 2261d3488b..cf52e16a02 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 100 +VERSION = 101 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 24e582ade9..f1661f44c4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,19 @@ +udev 101 +======== +The udev daemon can be started with --debug-trace now, which will +execute all events serialized to get a chance to catch a possible +action that crashes the box. + +A warning is logged, if PHYSDEV* keys, the "device" link, or a parent +device attribute like $attr{../file} is used, only WAIT_FOR_SYSFS rules +are excluded from the warning. Referencing parent attributes directly +may break when something in the kernel driver model changes. Udev will +just find the attribute by walking up the parent chain. + +Udevtrigger now sorts the list of devices depending on the device +dependency, so a "usb" device is triggered after the parent "pci" +device. + udev 100 ======== Revert persistent-storage ata-serial '_' '-' replacement. diff --git a/TODO b/TODO index 58d9c1efe9..f64273cab4 100644 --- a/TODO +++ b/TODO @@ -8,15 +8,6 @@ These things will change in future udev versions: (DRIVERS must be used, we currently translate it to DRIVERS and print a warning if DRIVER is used) - o warn if PHYSDEV* keys are used in ENV keys - (they are deprecated and will be removed from a future kernel) - - o warn if any path component is used in a ATTR{}, ATTRS{}, - $attr{} key, like ATTR{device/}== - (parent attributes must not referenced directly in rules or tools, - udev finds the parents and makes them available, which can be matched - with the normal keys) - o warn if BUS, ID, SYSFS are used as keys (they are SUBSYSTEMS, KERNELS, ATTRS now) -- cgit v1.2.3-54-g00ecf From fe547f13fc5defcc4dbd1a1d18ec57f60b5590c0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Sep 2006 17:09:55 +0200 Subject: create missing ChangeLog for version 101 --- ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/ChangeLog b/ChangeLog index c40be32c4c..c12823c6e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +Summary of changes from v100 to v101 +============================================ + +Arjan Opmeer: + fix udevinfo help text typo + +Bryan Kadzban: + cleanup default rules + add IMPORT operations to the udev man page + +Kay Sievers: + remove Makefile magic for leading '0' in version + udevd: use getopt_long() + udevd: add --verbose option to log also to stdout + udevd: add --debug-trace option + rule_generator: improve net rule comment generation + volume_id: correct iso9660 high sierra header + warn if a PHYSEDV* key, the "device" link, or a parent attribute is used + don't print PHYSDEV* warnings for old WAIT_FOR_SYSFS rules + udevinfo: print error in --attribute-walk + udev_sysfs: unify symlink resolving + udevtrigger: trigger devices sorted by their dependency + fix spelling in deprecation warning + release 101 + +Michał Bartoszkiewicz: + udevtrigger: fix typo that prevents partition events + +Miles Lane: + clarify "specified user/group unknown" error + +Piter PUNK: + update slackware rules + +VMiklos: + update Frugalware rules + + Summary of changes from v099 to v100 ============================================ -- cgit v1.2.3-54-g00ecf From 965039b860cc5df7802d4faf601a5b923870ce7d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Sep 2006 17:12:25 +0200 Subject: update SUSE rules --- etc/udev/suse/50-udev-default.rules | 4 ++-- etc/udev/suse/60-persistent-storage.rules | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 317046c204..5b031416d3 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -62,7 +62,7 @@ KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" # network -KERNEL=="tun", NAME="net/%k", MODE="0600" +KERNEL=="tun", NAME="net/%k", MODE="0666" # misc devices KERNEL=="mem|kmem", GROUP="kmem", MODE="640" @@ -131,7 +131,7 @@ KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" # libusb device access -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" +SUBSYSTEM=="usb_device", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" # kernel firmware loader SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index 5a4843e495..ed979e3ce6 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -12,14 +12,14 @@ KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO=" KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # for partitions import parent information -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", IMPORT{parent}="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -- cgit v1.2.3-54-g00ecf From 178b824905220a84b2bfc7665e6c4b45420e0b05 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Sep 2006 17:12:48 +0200 Subject: update default rules --- etc/udev/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index fec0aa8225..ed979e3ce6 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -17,7 +17,7 @@ KERNEL=="*[0-9]", IMPORT{parent}="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" -- cgit v1.2.3-54-g00ecf From 56baaedc90fcc7d358d6cfc29e3e95ab70b5cbff Mon Sep 17 00:00:00 2001 From: MUNEDA Takahiro Date: Mon, 2 Oct 2006 16:02:42 +0200 Subject: path_id: fix SAS disk handling --- extras/path_id/path_id | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index a9182af6e0..44754cdedd 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -278,15 +278,17 @@ handle_sas () { local DEV=$1 local cil adapter controller_dev # SAS device - sas_host_path="${DEV%%/phy*}" + sas_host_path="${DEV%%/port*}" sas_phy_path="${DEV#*/host*/}" sas_phy_path="${sas_phy_path%%/target*}" sas_phy_id="${sas_phy_path%%/*}" - sas_rphy_id="${sas_phy_path##*/}" - sas_phy_dev="/sys/class/sas_phy/${sas_phy_id}" + sas_phy_id="${sas_phy_id##*port-}" + sas_port_id="${sas_phy_path%%/end_device*}" + sas_port_id="${sas_port_id##*port-}" + sas_end_id="${sas_phy_path##*end_device-}" + sas_phy_dev="/sys/class/sas_phy/phy-${sas_phy_id}" if [ -e "$sas_phy_dev/sas_address" ]; then read phy_address < $sas_phy_dev/sas_address - read phy_port < $sas_phy_dev/port_identifier read phy_id < $sas_phy_dev/phy_identifier fi if [ -z "$phy_address" ] ; then @@ -295,22 +297,32 @@ handle_sas () { RESULT=1 return fi + sas_port_dev="/sys/class/sas_port/port-${sas_port_id}" + if [ -e "$sas_port_dev/num_phys" ] ; then + read phy_port < $sas_port_dev/num_phys + fi + if [ -z "$phy_port" ] ; then + : no initiator address + D= + RESULT=1 + return + fi sas_phy_address="$phy_address:$phy_port:$phy_id" - sas_rphy_dev="/sys/class/sas_device/${sas_rphy_id}" - if [ -e "$sas_rphy_dev/sas_address" ]; then - read rphy_address < $sas_rphy_dev/sas_address - read rphy_id < $sas_rphy_dev/phy_identifier + sas_end_dev="/sys/class/sas_device/end_device-${sas_end_id}" + if [ -e "$sas_end_dev/sas_address" ]; then + read end_address < $sas_end_dev/sas_address + read end_id < $sas_end_dev/phy_identifier fi - if [ -z "$rphy_address" ] ; then + if [ -z "$end_address" ] ; then : no initiator address D= RESULT=1 return fi - sas_rphy_address="$rphy_address:$rphy_id" + sas_end_address="$end_address:$end_id" controller_dev="${sas_host_path%/host[0-9]*}" # SAS devices are always endpoints - d="sas-${sas_phy_address}-${sas_rphy_address}" + d="sas-${sas_phy_address}-${sas_end_address}" D="$controller_dev" RESULT=0 } @@ -470,7 +482,7 @@ handle_device () { */rport-[0-9]*:[0-9]*-[0-9]*/*) handle_fc "$D" ;; - */phy-[0-9]*:[0-9]*/*) + */end_device-[0-9]*:[0-9]*:[0-9]*/*) handle_sas "$D" ;; */fw-host[0-9]*/*) -- cgit v1.2.3-54-g00ecf From 72605f8b019b3bff4343d2a794b455425d8ccae8 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Tue, 3 Oct 2006 01:45:56 +0200 Subject: writing_udev_rules: fix typo in example rule This was pointed out by SG Wilkinson. --- docs/writing_udev_rules/index.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index ce33bbb011..cc8fbd60c7 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -16,7 +16,7 @@

            Writing udev rules

            by Daniel Drake (dsd)
            -Version 0.7

            +Version 0.72

            The most recent version of this document can always be found at:
            @@ -112,6 +112,7 @@ This document uses various examples (many of which are entirely fictional) to il

            History

              +
                October 2nd 2006 v0.72: Fixed a typo in one of the example rules.
              • June 10th 2006 v0.71: Misc changes based on recent feedback - thanks!
              • June 3rd 2006 v0.7: Complete rework, to be more suited for the modern-day udev.
              • May 9th 2005 v0.6: Misc updates, including information about udevinfo, groups and permissions, logging, and udevtest.
              • @@ -671,7 +672,7 @@ To get around this, you simply need to think about what differs between sdb and My rule:

                -
                NAME=="sd?1", BUS=="scsi", SYSFS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"
                +
                KERNEL=="sd?1", BUS=="scsi", SYSFS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"

                USB Hard Disk

                -- cgit v1.2.3-54-g00ecf From 66ec64e9adcba6e619a48729f50c992875ed6c88 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 8 Oct 2006 16:04:54 +0200 Subject: first try "subsystem" link at a parent device, before guessing --- udev_sysfs.c | 73 ++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index 0e448894fe..7431dd6111 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -197,8 +197,20 @@ struct sysfs_device *sysfs_device_get(const char *devpath) sysfs_device_set_values(dev, devpath_real, NULL, NULL); - /* get subsystem */ - if (strncmp(dev->devpath, "/class/", 7) == 0) { + /* get subsystem name */ + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, dev->devpath, sizeof(link_path)); + strlcat(link_path, "/subsystem", sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len > 0) { + /* get subsystem from "subsystem" link */ + link_target[len] = '\0'; + dbg("subsystem link '%s' points to '%s'", link_path, link_target); + pos = strrchr(link_target, '/'); + if (pos != NULL) + strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); + } else if (strncmp(dev->devpath, "/class/", 7) == 0) { + /* get subsystem from class dir */ strlcpy(dev->subsystem, &dev->devpath[7], sizeof(dev->subsystem)); pos = strchr(dev->subsystem, '/'); if (pos != NULL) @@ -219,38 +231,26 @@ struct sysfs_device *sysfs_device_get(const char *devpath) pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); - } else { - /* get subsystem from "subsystem" link */ - strlcpy(link_path, sysfs_path, sizeof(link_path)); - strlcat(link_path, dev->devpath, sizeof(link_path)); - strlcat(link_path, "/subsystem", sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len > 0) { - link_target[len] = '\0'; - dbg("subsystem link '%s' points to '%s'", link_path, link_target); - pos = strrchr(link_target, '/'); - if (pos != NULL) - strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); - } - } - /* get driver name */ - strlcpy(link_path, sysfs_path, sizeof(link_path)); - strlcat(link_path, dev->devpath, sizeof(link_path)); - strlcat(link_path, "/driver", sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len > 0) { - link_target[len] = '\0'; - dbg("driver link '%s' points to '%s'", link_path, link_target); - pos = strrchr(link_target, '/'); - if (pos != NULL) - strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); } - } else if (strncmp(dev->devpath, "/bus/", 5) == 0 && strstr(dev->devpath, "/drivers/")) { + } else if (strstr(dev->devpath, "/drivers/") != NULL) { strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/module/", 8) == 0) { strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); } + /* get driver name */ + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, dev->devpath, sizeof(link_path)); + strlcat(link_path, "/driver", sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len > 0) { + link_target[len] = '\0'; + dbg("driver link '%s' points to '%s'", link_path, link_target); + pos = strrchr(link_target, '/'); + if (pos != NULL) + strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); + } + dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'", dev->devpath, dev->subsystem, dev->driver); list_add(&dev->node, &dev_list); @@ -270,6 +270,7 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) /* requesting a parent is only valid for devices */ if ((strncmp(dev->devpath, "/devices/", 9) != 0) && + (strncmp(dev->devpath, "/subsystem/", 11) != 0) && (strncmp(dev->devpath, "/class/", 7) != 0) && (strncmp(dev->devpath, "/block/", 7) != 0)) return NULL; @@ -289,10 +290,13 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) return NULL; } - /* at the top level of class/block we want to follow the "device" link */ - if (strcmp(parent_devpath, "/block") == 0) { - dbg("/block top level, look for device link"); - goto device_link; + /* at the subsystems top level we want to follow the old-style "device" link */ + if (strncmp(parent_devpath, "/subsystem", 10) == 0) { + pos = strrchr(parent_devpath, '/'); + if (pos == &parent_devpath[10] || pos == parent_devpath || strcmp(pos, "/devices") == 0) { + dbg("/subsystem top level, look for device link"); + goto device_link; + } } if (strncmp(parent_devpath, "/class", 6) == 0) { pos = strrchr(parent_devpath, '/'); @@ -301,6 +305,11 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) goto device_link; } } + if (strcmp(parent_devpath, "/block") == 0) { + dbg("/block top level, look for device link"); + goto device_link; + } + /* get parent and remember it */ dev->parent = sysfs_device_get(parent_devpath); return dev->parent; -- cgit v1.2.3-54-g00ecf From 5ac285437500a857f69d8b883d5aac3692662d0f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 8 Oct 2006 16:06:14 +0200 Subject: if /sys/subsystem exists, skip class, bus, block scanning --- udevtrigger.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/udevtrigger.c b/udevtrigger.c index 2b4ab80901..c809d2d47b 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -237,14 +237,15 @@ static int attr_filtered(const char *path) return 0; } -static void scan_bus(void) +static void scan_subsystem(const char *subsys) { char base[PATH_SIZE]; DIR *dir; struct dirent *dent; strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/bus", sizeof(base)); + strlcat(base, "/", sizeof(base)); + strlcat(base, subsys, sizeof(base)); dir = opendir(base); if (dir != NULL) { @@ -292,13 +293,6 @@ static void scan_block(void) char base[PATH_SIZE]; DIR *dir; struct dirent *dent; - struct stat statbuf; - - /* skip if "block" is already a "class" */ - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/class/block", sizeof(base)); - if (stat(base, &statbuf) == 0) - return; if (subsystem_filtered("block")) return; @@ -506,9 +500,24 @@ int main(int argc, char *argv[], char *envp[]) if (failed) scan_failed(); else { - scan_bus(); - scan_class(); - scan_block(); + char base[PATH_SIZE]; + struct stat statbuf; + + /* if we have /sys/subsystem, forget all the old stuff */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/subsystem", sizeof(base)); + if (stat(base, &statbuf) == 0) + scan_subsystem("subsystem"); + else { + scan_subsystem("bus"); + scan_class(); + + /* scan "block" if it isn't a "class" */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/class/block", sizeof(base)); + if (stat(base, &statbuf) != 0) + scan_block(); + } } exec_list(); -- cgit v1.2.3-54-g00ecf From 11678eff6a40b05d192be65146a66d5e1e8252ec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Oct 2006 16:56:09 +0200 Subject: scsi_id: export ID_SERIAL_SHORT without vendor/product --- extras/scsi_id/scsi_id.c | 17 +++++++--------- extras/scsi_id/scsi_id.h | 2 +- extras/scsi_id/scsi_serial.c | 48 ++++++++++++++++++++++++-------------------- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index c64e203aff..7fd6066c01 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -614,11 +614,12 @@ static int scsi_id(const char *devpath, char *maj_min_dev) { int retval; int dev_type = 0; - char *serial, *unaligned_buf; struct sysfs_device *dev; struct sysfs_device *dev_scsi; int good_dev; int page_code; + char serial[MAX_SERIAL_LEN]; + char serial_short[MAX_SERIAL_LEN]; dbg("devpath %s\n", devpath); @@ -650,29 +651,25 @@ static int scsi_id(const char *devpath, char *maj_min_dev) retval = per_dev_options(dev_scsi, &good_dev, &page_code); dbg("per dev options: good %d; page code 0x%x", good_dev, page_code); -#define ALIGN 512 - unaligned_buf = malloc(MAX_SERIAL_LEN + ALIGN); - serial = (char*) (((unsigned long) unaligned_buf + (ALIGN - 1)) - & ~(ALIGN - 1)); - dbg("buffer unaligned 0x%p; aligned 0x%p\n", unaligned_buf, serial); -#undef ALIGN - if (!good_dev) { retval = 1; } else if (scsi_get_serial(dev_scsi, maj_min_dev, page_code, - serial, MAX_SERIAL_LEN)) { + serial, serial_short, MAX_SERIAL_LEN)) { retval = always_info?0:1; } else { retval = 0; } if (!retval) { if (export) { - static char serial_str[64]; + char serial_str[MAX_SERIAL_LEN]; + printf("ID_VENDOR=%s\n", vendor_str); printf("ID_MODEL=%s\n", model_str); printf("ID_REVISION=%s\n", revision_str); set_str(serial_str, serial, sizeof(serial_str)); printf("ID_SERIAL=%s\n", serial_str); + set_str(serial_str, serial_short, sizeof(serial_str)); + printf("ID_SERIAL_SHORT=%s\n", serial_str); printf("ID_TYPE=%s\n", type_str); printf("ID_BUS=scsi\n"); } else { diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 64ea349064..d7f675fa0b 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -31,7 +31,7 @@ #define MAX_BUFFER_LEN 256 extern int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, - int page_code, char *serial, int len); + int page_code, char *serial, char *serial_short, int len); /* * Page code values. diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index a0a3ae97d8..513d922559 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -433,9 +433,9 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) static int check_fill_0x83_id(struct sysfs_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values - *id_search, char *serial, int max_len) + *id_search, char *serial, char *serial_short, int max_len) { - int i, j, len; + int i, j, s, len; /* * ASSOCIATION must be with the device (value 0) @@ -469,7 +469,7 @@ static int check_fill_0x83_id(struct sysfs_device *dev_scsi, */ len *= 2; - /* + /* * Add one byte for the NUL termination, and one for the id_type. */ len += 2; @@ -497,7 +497,7 @@ static int check_fill_0x83_id(struct sysfs_device *dev_scsi, } i = 4; /* offset to the start of the identifier */ - j = strlen(serial); + s = j = strlen(serial); if ((page_83[0] & 0x0f) == SCSI_ID_ASCII) { /* * ASCII descriptor. @@ -515,6 +515,8 @@ static int check_fill_0x83_id(struct sysfs_device *dev_scsi, i++; } } + + strcpy(serial_short, &serial[s]); return 0; } @@ -522,10 +524,11 @@ static int check_fill_0x83_id(struct sysfs_device *dev_scsi, static int check_fill_0x83_prespc3(struct sysfs_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values - *id_search, char *serial, int max_len) + *id_search, char *serial, char *serial_short, int max_len) { int i, j; - + + dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); serial[0] = hex_str[id_search->id_type]; /* serial has been memset to zero before */ j = strlen(serial); /* j = 1; */ @@ -534,14 +537,14 @@ static int check_fill_0x83_prespc3(struct sysfs_device *dev_scsi, serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; serial[j++] = hex_str[ page_83[4+i] & 0x0f]; } - dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); + strcpy(serial_short, serial); return 0; } /* Get device identification VPD page */ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, - char *serial, int len) + char *serial, char *serial_short, int len) { int retval; unsigned int id_ind, j; @@ -588,8 +591,8 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, */ if (page_83[6] != 0) - return check_fill_0x83_prespc3(dev_scsi, page_83, - id_search_list, serial, len); + return check_fill_0x83_prespc3(dev_scsi, page_83, id_search_list, + serial, serial_short, len); /* * Search for a match in the prioritized id_search_list. @@ -604,7 +607,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { retval = check_fill_0x83_id(dev_scsi, &page_83[j], &id_search_list[id_ind], - serial, len); + serial, serial_short, len); dbg("%s id desc %d/%d/%d\n", dev_scsi->kernel, id_search_list[id_ind].id_type, id_search_list[id_ind].naa_type, @@ -631,7 +634,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, * conformant to the SCSI-2 format. */ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, - char *serial, int len) + char *serial, char *serial_short, int len) { int retval; int i, j; @@ -693,7 +696,7 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, /* Get unit serial number VPD page */ static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, - char *serial, int max_len) + char *serial, char *serial_short, int max_len) { int retval; int ser_ind; @@ -728,11 +731,12 @@ static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, len = buf[3]; for (i = 4; i < len + 4; i++, ser_ind++) serial[ser_ind] = buf[i]; + memcpy(serial_short, &buf[4], len); return 0; } int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, - int page_code, char *serial, int len) + int page_code, char *serial, char *serial_short, int len) { unsigned char page0[SCSI_INQ_BUFF_LEN]; int fd; @@ -749,7 +753,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, } if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(dev_scsi, fd, serial, len)) { + if (do_scsi_page80_inquiry(dev_scsi, fd, serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -757,7 +761,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, goto completed; } } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(dev_scsi, fd, serial, len)) { + if (do_scsi_page83_inquiry(dev_scsi, fd, serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -765,7 +769,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, goto completed; } } else if (page_code == PAGE_83_PRE_SPC3) { - retval = do_scsi_page83_prespc3_inquiry(dev_scsi, fd, serial, len); + retval = do_scsi_page83_prespc3_inquiry(dev_scsi, fd, serial, serial_short, len); if (retval) { /* * Fallback to servicing a SPC-2/3 compliant page 83 @@ -773,7 +777,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, * conform to pre-SPC3 expectations. */ if (retval == 2) { - if (do_scsi_page83_inquiry(dev_scsi, fd, serial, len)) { + if (do_scsi_page83_inquiry(dev_scsi, fd, serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -812,8 +816,8 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) - if (!do_scsi_page83_inquiry(dev_scsi, fd, serial, - len)) { + if (!do_scsi_page83_inquiry(dev_scsi, fd, + serial, serial_short, len)) { /* * Success */ @@ -823,8 +827,8 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_80) - if (!do_scsi_page80_inquiry(dev_scsi, fd, serial, - len)) { + if (!do_scsi_page80_inquiry(dev_scsi, fd, + serial, serial_short, len)) { /* * Success */ -- cgit v1.2.3-54-g00ecf From 2c6185636c1ca9bc3f9b78277359a1bdfb231b3d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Oct 2006 16:56:33 +0200 Subject: update SUSE rules --- etc/udev/suse/60-persistent-storage.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index ed979e3ce6..dfc1ba1e23 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -26,6 +26,8 @@ KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}-part%n" KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # by-path (shortest physical path) -- cgit v1.2.3-54-g00ecf From 0a9e36df4f85dda22c771a4f6604b68cec2e5b31 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Oct 2006 17:07:35 +0200 Subject: release 102 --- ChangeLog | 19 +++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 4 ++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c12823c6e8..11a62db21a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Summary of changes from v101 to v102 +============================================ + +Daniel Drake: + writing_udev_rules: fix typo in example rule + +Kay Sievers: + create missing ChangeLog for version 101 + update SUSE rules + update default rules + first try "subsystem" link at a parent device, before guessing + if /sys/subsystem exists, skip class, bus, block scanning + scsi_id: export ID_SERIAL_SHORT without vendor/product + update SUSE rules + +MUNEDA Takahiro: + path_id: fix SAS disk handling + + Summary of changes from v100 to v101 ============================================ diff --git a/Makefile b/Makefile index cf52e16a02..e2a67f8a7a 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 101 +VERSION = 102 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f1661f44c4..c1e7910166 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 102 +======== +Fix path_id for SAS devices. + udev 101 ======== The udev daemon can be started with --debug-trace now, which will -- cgit v1.2.3-54-g00ecf From f2f957c394ee3560b0c53ea41055d2d4ce457868 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 13 Oct 2006 13:16:08 +0200 Subject: persistent storage rules: skip gnbd devices --- etc/udev/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index ed979e3ce6..5c68010913 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -5,7 +5,7 @@ ACTION!="add", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*", GOTO="persistent_storage_end" # never access non-cdrom removable ide devices, the drivers are causing event loops on open() KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From 2658afdcf147afd384e27f0ac9019e27de7ba397 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 13 Oct 2006 13:17:13 +0200 Subject: volume_id: add checksum check to via_raid --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/via_raid.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 3e7d8c010d..438d84df44 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 72 +SHLIB_REV = 73 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/via_raid.c b/extras/volume_id/lib/via_raid.c index 42cb098065..62c165e034 100644 --- a/extras/volume_id/lib/via_raid.c +++ b/extras/volume_id/lib/via_raid.c @@ -3,6 +3,9 @@ * * Copyright (C) 2005 Kay Sievers * + * Based on information taken from dmraid: + * Copyright (C) 2004-2006 Heinz Mauelshagen, Red Hat GmbH + * * 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. @@ -30,7 +33,7 @@ struct via_meta { uint16_t signature; uint8_t version_number; struct via_array { - uint16_t disk_bits; + uint16_t disk_bit_mask; uint8_t disk_array_ex; uint32_t capacity_low; uint32_t capacity_high; @@ -42,6 +45,18 @@ struct via_meta { #define VIA_SIGNATURE 0xAA55 +/* 8 bit checksum on first 50 bytes of metadata. */ +static uint8_t meta_checksum(struct via_meta *via) +{ + uint8_t i = 50, sum = 0; + + while (i--) + sum += ((uint8_t*) via)[i]; + + return sum == via->checksum; +} + + int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; @@ -67,6 +82,9 @@ int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) if (via->version_number > 1) return -1; + if (!meta_checksum(via)) + return -1; + volume_id_set_usage(id, VOLUME_ID_RAID); snprintf(id->type_version, sizeof(id->type_version)-1, "%u", via->version_number); id->type = "via_raid_member"; -- cgit v1.2.3-54-g00ecf From 2412f0886d0432643e77243da718a80a44e4d30c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 15 Oct 2006 18:20:15 +0200 Subject: volume_id: add comment about hfs uuid conversion --- extras/volume_id/lib/hfs.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index 03b2aa0819..303ad6b041 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -137,6 +137,32 @@ static struct hfsplus_vol_header { #define HFS_NODE_LEAF 0xff #define HFSPLUS_POR_CNID 1 +static void hfsid_set_uuid(struct volume_id *id, const uint8_t *hfs_id) +{ +#if 0 + MD5_CTX md5c; + static const uint8_t hash_init[16] = { + 0xb3, 0xe2, 0x0f, 0x39, 0xf2, 0x92, 0x11, 0xd6, + 0x97, 0xa4, 0x00, 0x30, 0x65, 0x43, 0xec, 0xac + }; + uint8_t uuid[16]; + + if (*((uint64_t *)hfs_id) == 0) + return; + + MD5_Init(&md5c); + MD5_Update(&md5c, &hash_init, 16); + MD5_Update(&md5c, hfs_id, 8); + MD5_Final(uuid, &md5c); + + uuid[6] = 0x30 | (uuid[6] & 0x0f); + uuid[8] = 0x80 | (uuid[8] & 0x3f); + volume_id_set_uuid(id, uuid, UUID_DCE); +#endif + + volume_id_set_uuid(id, hfs_id, UUID_HFS); +} + int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size) { unsigned int blocksize; @@ -196,7 +222,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t siz volume_id_set_label_string(id, hfs->label, hfs->label_len) ; } - volume_id_set_uuid(id, hfs->finder_info.id, UUID_HFS); + hfsid_set_uuid(id, hfs->finder_info.id); volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "hfs"; @@ -212,7 +238,7 @@ checkplus: return -1; hfsplus: - volume_id_set_uuid(id, hfsplus->finder_info.id, UUID_HFS); + hfsid_set_uuid(id, hfsplus->finder_info.id); blocksize = be32_to_cpu(hfsplus->blocksize); dbg("blocksize %u", blocksize); -- cgit v1.2.3-54-g00ecf From 7cc15d93003f427bb092581d575414fe5b268e8b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 15 Oct 2006 18:29:05 +0200 Subject: update SUSE rules --- etc/udev/suse/50-udev-default.rules | 2 ++ etc/udev/suse/60-persistent-storage.rules | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 5b031416d3..27dbc950c7 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -114,6 +114,8 @@ SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" SUBSYSTEM=="ide", ACTION=="add", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" + # misc storage devices (non-block) KERNEL=="sg*", GROUP="disk", MODE="640" KERNEL=="st*|nst*", GROUP="disk" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index dfc1ba1e23..1277a1a076 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -5,7 +5,7 @@ ACTION!="add", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="persistent_storage_end" +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*", GOTO="persistent_storage_end" # never access non-cdrom removable ide devices, the drivers are causing event loops on open() KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" @@ -30,6 +30,9 @@ KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}-part%n" KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + # by-path (shortest physical path) KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" -- cgit v1.2.3-54-g00ecf From 69ed35366ffe9aa26f1736dbfc10bf6aaaf2e3d6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 15 Oct 2006 18:40:08 +0200 Subject: update Fedora rules --- etc/udev/redhat/50-udev.rules | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index 64c91fc5cb..c5dbb9068f 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -150,16 +150,14 @@ KERNEL=="usb/rio500", MODE="0660" # s390 devices KERNEL=="z90crypt", MODE="0666" +KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" # DVB KERNEL=="dvb", MODE="0660" SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", \ NAME="%c", MODE="0660" -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" - +KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" # alsa devices KERNEL=="controlC[0-9]*", NAME="snd/%k" @@ -264,7 +262,7 @@ ACTION!="add", GOTO="persistent_end" SUBSYSTEM!="block", GOTO="persistent_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*", GOTO="persistent_end" # never access removable ide devices, the drivers are causing event loops on open() BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}=="1", GOTO="persistent_end" @@ -347,5 +345,8 @@ ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}= ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}!="On[sS]tream", \ RUN+="/sbin/modprobe st" +# mmc block devices +ACTION=="add", SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" + RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From 1810a9d7bb1a253836516d8fb1b5b1070c6ce288 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 Oct 2006 14:43:35 +0200 Subject: release 103 --- ChangeLog | 11 +++++++++++ Makefile | 2 +- RELEASE-NOTES | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 11a62db21a..76fa8aa516 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Summary of changes from v102 to v103 +============================================ + +Kay Sievers: + persistent storage rules: skip gnbd devices + volume_id: add checksum check to via_raid + volume_id: add comment about hfs uuid conversion + update SUSE rules + update Fedora rules + + Summary of changes from v101 to v102 ============================================ diff --git a/Makefile b/Makefile index e2a67f8a7a..947eacaf44 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 102 +VERSION = 103 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index c1e7910166..0e364a30a1 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,9 @@ +udev 103 +======== +Add additional check to volume_id detection of via_raid, cause +some company decided to put a matching pattern all over the empty +storage area of their music players. + udev 102 ======== Fix path_id for SAS devices. -- cgit v1.2.3-54-g00ecf From 151418db12eec29cafa4426aaab2e4c13db10a44 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Nov 2006 17:38:04 +0100 Subject: update Fedora rules --- etc/udev/redhat/50-udev.rules | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index c5dbb9068f..331da6977f 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -41,9 +41,9 @@ KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="hvc*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="hvsi*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB*", SYSFS{product}=="Palm Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB*", SYSFS{product}=="palmOne Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB*", SYSFS{product}=="Handspring Visor*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB*", ATTRS{product}=="Palm Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB*", ATTRS{product}=="palmOne Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB*", ATTRS{product}=="Handspring Visor*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" # vc devices KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" @@ -72,7 +72,7 @@ KERNEL=="rtc", MODE="0644" KERNEL=="fd[01]*", GROUP="floppy", MODE="0660" # fix floppy devices KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" -KERNEL=="fd[0-9]*", ACTION=="add", SYSFS{device/cmos}=="*", RUN+="create_floppy_devices -c -t $sysfs{device/cmos} -m %M /dev/%k" +KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M /dev/%k" KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f /dev/%k*'" # audio devices @@ -231,24 +231,24 @@ KERNEL=="zap[0-9]*", NAME="zap/%n" KERNEL=="pktcdvd", NAME="%k/control" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", \ - SYSFS{device/media}=="floppy", \ +KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", \ + ATTRS{media}=="floppy", \ SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", SYSFS{device/media}=="cdrom", SYMLINK+="cdrom cdrom-%k" +KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", ATTRS{media}=="cdrom", SYMLINK+="cdrom cdrom-%k" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" +KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" +KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" -KERNEL=="hd[a-z]", BUS=="ide", SYSFS{removable}=="1", PROGRAM="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" +KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", PROGRAM="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" # rename sr* to scd* KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n" -KERNEL=="hd*[0-9]", BUS=="ide", SYSFS{../removable}=="1", \ +KERNEL=="hd*[0-9]", BUS=="ide", ATTRS{removable}=="1", \ OPTIONS+="ignore_remove" @@ -265,15 +265,15 @@ SUBSYSTEM!="block", GOTO="persistent_end" KERNEL=="ram*|loop*|fd*|nbd*|gnbd*", GOTO="persistent_end" # never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}=="1", GOTO="persistent_end" -BUS=="ide", KERNEL=="hd*[0-9]", SYSFS{../removable}=="1", GOTO="persistent_end" +BUS=="ide", DRIVER!="ide-cdrom", ATTRS{removable}=="1", GOTO="persistent_end" +BUS=="ide", KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_end" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode" @@ -291,7 +291,7 @@ KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="persistent_end" IMPORT{program}="/lib/udev/vol_id --export $tempnode" ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" @@ -320,29 +320,29 @@ ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c 'echo # sr: 4 TYPE_WORM, 5 TYPE_ROM # st/osst: 1 TYPE_TAPE # sg: 8 changer, [36] scanner -ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="0|7|14", \ +ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="0|7|14", \ RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM=="scsi" , SYSFS{type}=="1", \ +ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="1", \ RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="/sbin/modprobe sg" -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="0|7|14", \ +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \ RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="[45]", \ +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \ RUN+="/sbin/modprobe sr_mod" -ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", SYSFS{type}=="[36]", \ +ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="[36]", \ SYMLINK+="scanner scanner-%k", MODE="0660" -ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", SYSFS{type}=="8", \ +ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", \ SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}=="On[sS]tream", \ - SYSFS{model}!="ADR*", RUN+="/sbin/modprobe osst" -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}=="On[sS]tream", \ - SYSFS{model}=="ADR*", RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi_device", SYSFS{type}=="1", SYSFS{device/vendor}!="On[sS]tream", \ +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst" +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}=="ADR*", RUN+="/sbin/modprobe st" +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}!="On[sS]tream", \ RUN+="/sbin/modprobe st" # mmc block devices -- cgit v1.2.3-54-g00ecf From 50fec657157623d2c537df5fa1debc9d7b919279 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Nov 2006 17:38:42 +0100 Subject: update example rules --- etc/udev/rules.d/60-persistent-storage.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 5c68010913..1a25560163 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -5,10 +5,10 @@ ACTION!="add", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*", GOTO="persistent_storage_end" +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" # never access non-cdrom removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # for partitions import parent information -- cgit v1.2.3-54-g00ecf From bf1cea46bbcab45b37bb1a27642690bd73996a6e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Nov 2006 20:16:35 +0100 Subject: update SUSE rules --- etc/udev/suse/50-udev-default.rules | 10 +++------- etc/udev/suse/60-persistent-storage.rules | 4 ++-- etc/udev/suse/64-device-mapper.rules | 4 ++-- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 27dbc950c7..acbf198bb5 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -9,12 +9,10 @@ KERNEL=="console", MODE="600", OPTIONS="last_rule" KERNEL=="ptmx", GROUP="tty", MODE="666", OPTIONS="last_rule" # serial devices -KERNEL=="tty[A-Z]*", GROUP="uucp" -KERNEL=="pppox*", GROUP="uucp" -KERNEL=="ircomm*", GROUP="uucp" -KERNEL=="modems/mwave*", GROUP="uucp" +KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" KERNEL=="hvc*|hvsi*", GROUP="uucp" KERNEL=="iseries/vtty*", GROUP="uucp" +KERNEL=="mwave", NAME="modems/%k", GROUP="uucp" KERNEL=="ttyUSB*", ATTRS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" KERNEL=="ttyUSB*", ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" @@ -57,7 +55,6 @@ KERNEL=="dv1394*", SYMLINK+="dv1394/%n", GROUP="video" KERNEL=="video1394*", SYMLINK+="video1394/%n", GROUP="video" KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" -KERNEL=="mwave", NAME="modems/%k" KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" @@ -113,8 +110,7 @@ SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="[45]", RUN+="/sbin/modpro SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" SUBSYSTEM=="ide", ACTION=="add", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" - -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +SUBSYSTEM=="mmc", ACTION=="add", RUN+="/sbin/modprobe mmc_block" # misc storage devices (non-block) KERNEL=="sg*", GROUP="disk", MODE="640" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index 1277a1a076..1ac915cc17 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -5,10 +5,10 @@ ACTION!="add", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*", GOTO="persistent_storage_end" +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" # never access non-cdrom removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", ATTRS{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # for partitions import parent information diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index c4b7032153..377af786a6 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -1,5 +1,5 @@ -# device mapper links hook into "online" event, when the dm table -# is available, while some table types must be ignored +# device mapper links hook into "change" events, when the dm table +# becomes available; some table-types must be ignored KERNEL=="device-mapper", SYMLINK+="mapper/control" -- cgit v1.2.3-54-g00ecf From 77ab93ed972d3a83d8f48d434c7e28153ae6dab6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Nov 2006 20:40:26 +0100 Subject: update SUSE rules --- etc/udev/suse/50-udev-default.rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index acbf198bb5..bf1fbdd599 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -122,7 +122,8 @@ KERNEL=="sch*", GROUP="disk" KERNEL=="pt*|npt*", GROUP="disk" KERNEL=="pg*", GROUP="disk" KERNEL=="evms/block_device*", GROUP="disk" -KERNEL=="rawctl*|raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="rawctl*", NAME="raw/%k", GROUP="disk" +SUBSYSTEM=="block", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="osst*|nosst*", NAME="%k", GROUP="disk" KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" -- cgit v1.2.3-54-g00ecf From aa68c048f84b95fd982cb0fb2210ea740dbebc64 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Nov 2006 20:41:25 +0100 Subject: volume_id: fix endianess bug in linux_raid detection --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/linux_raid.c | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 438d84df44..1bf7de4aeb 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 73 +SHLIB_REV = 74 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 17819375ba..b8a819f671 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -27,7 +27,7 @@ #include "util.h" static struct mdp_super_block { - uint32_t md_magic; + uint8_t md_magic[4]; uint32_t major_version; uint32_t minor_version; uint32_t patch_version; @@ -46,7 +46,7 @@ static struct mdp_super_block { } PACKED *mdp; #define MD_RESERVED_BYTES 0x10000 -#define MD_MAGIC 0xa92b4efc +#define MD_MAGIC "\xa9\x2b\x4e\xfc" int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) { @@ -56,7 +56,6 @@ int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); - if (size < 0x10000) return -1; @@ -64,24 +63,20 @@ int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size buf = volume_id_get_buffer(id, off + sboff, 0x800); if (buf == NULL) return -1; - mdp = (struct mdp_super_block *) buf; - if (le32_to_cpu(mdp->md_magic) != MD_MAGIC) + if (memcmp(mdp->md_magic, MD_MAGIC, 4) != 0) return -1; memcpy(uuid, &mdp->set_uuid0, 4); memcpy(&uuid[4], &mdp->set_uuid1, 12); volume_id_set_uuid(id, uuid, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", le32_to_cpu(mdp->major_version), le32_to_cpu(mdp->minor_version), le32_to_cpu(mdp->patch_version)); - dbg("found raid signature"); volume_id_set_usage(id, VOLUME_ID_RAID); id->type = "linux_raid_member"; - return 0; } -- cgit v1.2.3-54-g00ecf From 3620d03b22a5d0734126595e175bc64b79b5f472 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 27 Nov 2006 10:29:50 +0100 Subject: man: fix udevmonitor text Thanks to Bauke Jan Douma. --- udevmonitor.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udevmonitor.xml b/udevmonitor.xml index d40a14c698..dc81ff26b2 100644 --- a/udevmonitor.xml +++ b/udevmonitor.xml @@ -31,9 +31,9 @@ DESCRIPTION - udevmonitor listens to the kernel uevents and events send out by a udev rule - and prints the devpath of the event to the console. It can be used analyze to the - event timing by comparing the timestamps of the kernel uevent with the udev event. + udevmonitor listens to the kernel uevents and events sent out by a udev rule + and prints the devpath of the event to the console. It can be used to analyze the + event timing, by comparing the timestamps of the kernel uevent and the udev event. -- cgit v1.2.3-54-g00ecf From 26133d54e06806456cc990e1cb63ca5ae35052ab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 27 Nov 2006 10:30:17 +0100 Subject: man: recreate from xml --- extras/volume_id/vol_id.8 | 12 +++--- udev.7 | 108 +++++++++++++++++++++++----------------------- udevd.8 | 18 ++++---- udevinfo.8 | 16 +++---- udevmonitor.8 | 6 +-- udevsettle.8 | 6 +-- udevstart.8 | 2 +- udevtest.8 | 2 +- udevtrigger.8 | 18 ++++---- 9 files changed, 94 insertions(+), 94 deletions(-) diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index d57ecc6bf7..1d7e1330c0 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -1,6 +1,6 @@ .\" Title: vol_id .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.0 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: March 2006 .\" Manual: vol_id .\" Source: volume_id @@ -24,28 +24,28 @@ supports all common filesystem formats and detects various raid setups to preven .SH "OPTIONS" .PP \fB\-\-export\fR -.RS 3n +.RS 4 print all values in key/value format to import them into the environment. .RE .PP \fB\-t\fR -.RS 3n +.RS 4 print the filesystem type .RE .PP \fB\-l\fR -.RS 3n +.RS 4 print the label of a volume .RE .PP \fB\-u\fR -.RS 3n +.RS 4 print the uuid of a volume .RE .SH "ENVIRONMENT" .PP \fBUDEV_LOG\fR -.RS 3n +.RS 4 Set the syslog priority. .RE .SH "EXIT STATUS" diff --git a/udev.7 b/udev.7 index 3d80e133e3..825f74efd8 100644 --- a/udev.7 +++ b/udev.7 @@ -1,6 +1,6 @@ .\" Title: udev .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.0 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: August 2005 .\" Manual: udev .\" Source: udev @@ -33,20 +33,20 @@ udev expects its main configuration file at \fI/etc/udev/udev.conf\fR. It consists of a set of variables allowing the user to override default udev values. The following variables can be set: .PP \fBudev_root\fR -.RS 3n +.RS 4 Specifies where to place the device nodes in the filesystem. The default value is \fI/dev\fR. .RE .PP \fBudev_rules\fR -.RS 3n +.RS 4 The name of the udev rules file or directory to look for files with the suffix \fI.rules\fR. Multiple rule files are read in lexical order. The default value is \fI/etc/udev/rules.d\fR. .RE .PP \fBudev_log\fR -.RS 3n +.RS 4 The logging priority. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, \fBinfo\fR @@ -62,181 +62,181 @@ directory or at the location specified value in the configuration file. Every li A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: .PP \fB==\fR -.RS 3n +.RS 4 Compare for equality. .RE .PP \fB!=\fR -.RS 3n +.RS 4 Compare for non\-equality. .RE .PP \fB=\fR -.RS 3n +.RS 4 Assign a value to a key. Keys that represent a list, are reset and only this single value is assigned. .RE .PP \fB+=\fR -.RS 3n +.RS 4 Add the value to a key that holds a list of entries. .RE .PP \fB:=\fR -.RS 3n +.RS 4 Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules. .RE .PP The following key names can be used to match against device properties: .PP \fBACTION\fR -.RS 3n +.RS 4 Match the name of the event action. .RE .PP \fBDEVPATH\fR -.RS 3n +.RS 4 Match the devpath of the event device. .RE .PP \fBKERNEL\fR -.RS 3n +.RS 4 Match the name of the event device. .RE .PP \fBSUBSYSTEM\fR -.RS 3n +.RS 4 Match the subsystem of the event device. .RE .PP \fBATTR{\fR\fB\fIfilename\fR\fR\fB}\fR -.RS 3n +.RS 4 Match sysfs attribute values of the event device. Up to five \fBATTR\fR keys can be specified per rule. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. Depending on the type of operator, this key is also used to set the value of a sysfs attribute. .RE .PP \fBKERNELS\fR -.RS 3n +.RS 4 Search the devpath upwards for a matching device name. .RE .PP \fBSUBSYSTEMS\fR -.RS 3n +.RS 4 Search the devpath upwards for a matching device subsystem name. .RE .PP \fBDRIVERS\fR -.RS 3n +.RS 4 Search the devpath upwards for a matching device driver name. .RE .PP \fBATTRS{\fR\fB\fIfilename\fR\fR\fB}\fR -.RS 3n +.RS 4 Search the devpath upwards for a device with matching sysfs attribute values. Up to five \fBATTRS\fR keys can be specified per rule. All attributes must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. .RE .PP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -.RS 3n +.RS 4 Match against the value of an environment variable. Up to five \fBENV\fR keys can be specified per rule. Depending on the type of operator, this key is also used to export a variable to the environment. .RE .PP \fBPROGRAM\fR -.RS 3n +.RS 4 Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key. .RE .PP \fBRESULT\fR -.RS 3n +.RS 4 Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call. .RE .PP Most of the fields support a shell style pattern matching. The following pattern characters are supported: .PP \fB*\fR -.RS 3n +.RS 4 Matches zero, or any number of characters. .RE .PP \fB?\fR -.RS 3n +.RS 4 Matches any single character. .RE .PP \fB[]\fR -.RS 3n +.RS 4 Matches any single character specified within the brackets. For example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. .RE .PP The following keys can get values assigned: .PP \fBNAME\fR -.RS 3n +.RS 4 The name of the node to be created, or the name the network interface should be renamed to. Only one rule can set the node name, all later rules with a NAME key will be ignored. .RE .PP \fBSYMLINK\fR -.RS 3n +.RS 4 The name of a symlink targeting the node. Every matching rule can add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character. .RE .PP \fBOWNER, GROUP, MODE\fR -.RS 3n +.RS 4 The permissions for the device node. Every specified value overwrites the compiled\-in default value. .RE .PP \fBATTR{\fR\fB\fIkey\fR\fR\fB}\fR -.RS 3n +.RS 4 The value that should be written to a sysfs attribute of the event device. Depending on the type of operator, this key is also used to match against the value of a sysfs attribute. .RE .PP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -.RS 3n +.RS 4 Export a variable to the environment. Depending on the type of operator, this key is also to match against an environment variable. .RE .PP \fBRUN\fR -.RS 3n +.RS 4 Add a program to the list of programs to be executed for a specific device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. .RE .PP \fBLABEL\fR -.RS 3n +.RS 4 Named label where a GOTO can jump to. .RE .PP \fBGOTO\fR -.RS 3n +.RS 4 Jumps to the next LABEL with a matching name .RE .PP \fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR -.RS 3n +.RS 4 Import a set of variables into the event environment, depending on \fItype\fR: -.RS 3n +.RS 4 .PP \fBprogram\fR -.RS 3n +.RS 4 Execute an external program specified as the assigned value and import its output, which must be in environment key format. .RE .PP \fBfile\fR -.RS 3n +.RS 4 Import a text file specified as the assigned value, which must be in environment key format. .RE .PP \fBparent\fR -.RS 3n +.RS 4 Import the stored keys from the parent device by reading the database entry of the parent device. The value assigned to \fBIMPORT{parent}\fR is used as a filter of key names to import (with the same shell\-style pattern matching used for comparisons). .RE .RE -.IP "" 3n +.IP "" 4 If no option is given, udev will choose between \fBprogram\fR and @@ -245,12 +245,12 @@ based on the executable bit of of the file permissions. .RE .PP \fBWAIT_FOR_SYSFS\fR -.RS 3n +.RS 4 Wait for the specified sysfs file of the device to be created. Can be used to fight against kernel sysfs timing issues. .RE .PP \fBOPTIONS\fR -.RS 3n +.RS 4 \fBlast_rule\fR stops further rules application. No later rules will have any effect. \fBignore_device\fR @@ -274,22 +274,22 @@ fields support simple printf\-like string substitutions. The format chars gets applied after all rules have been processed, right before the program is executed. It allows the use of the complete environment set by earlier matching rules. For all other fields, substitutions are applied while the individual rule is being processed. The available substitutions are: .PP \fB$kernel\fR, \fB%k\fR -.RS 3n +.RS 4 The kernel name for this device. .RE .PP \fB$number\fR, \fB%n\fR -.RS 3n +.RS 4 The kernel number for this device. For example, 'sda3' has kernel number of '3' .RE .PP \fB$devpath\fR, \fB%p\fR -.RS 3n +.RS 4 The devpath of the device. .RE .PP \fB$id\fR, \fB%b\fR -.RS 3n +.RS 4 The name of the device matched while searching the devpath upwards for \fBSUBSYSTEMS\fR, \fBKERNELS\fR, @@ -299,54 +299,54 @@ and .RE .PP \fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR -.RS 3n +.RS 4 The value of a sysfs attribute found at the device, where all keys of the rule have matched. If the matching device does not have such an attribute, all devices along the chain of parents are searched for a matching attribute. If the attribute is a symlink, the last element of the symlink target is returned as the value. .RE .PP \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR -.RS 3n +.RS 4 The value of an environment variable. .RE .PP \fB$major\fR, \fB%M\fR -.RS 3n +.RS 4 The kernel major number for the device. .RE .PP \fB$minor\fR \fB%m\fR -.RS 3n +.RS 4 The kernel minor number for the device. .RE .PP \fB$result\fR, \fB%c\fR -.RS 3n +.RS 4 The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: \fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: \fB%c{N+}\fR .RE .PP \fB$parent\fR, \fB%P\fR -.RS 3n +.RS 4 The node name of the parent device. .RE .PP \fB$root\fR, \fB%r\fR -.RS 3n +.RS 4 The udev_root value. .RE .PP \fB$tempnode\fR, \fB%N\fR -.RS 3n +.RS 4 The name of a created temporary device node to provide access to the device from a external program before the real node is created. .RE .PP \fB%%\fR -.RS 3n +.RS 4 The '%' character itself. .RE .PP \fB$$\fR -.RS 3n +.RS 4 The '$' character itself. .RE .PP diff --git a/udevd.8 b/udevd.8 index 4243064383..f40a959005 100644 --- a/udevd.8 +++ b/udevd.8 @@ -1,6 +1,6 @@ .\" Title: udevd .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.0 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: August 2005 .\" Manual: udevd, udevcontrol .\" Source: udev @@ -23,27 +23,27 @@ udevd listens to kernel uevents and passes the incoming events to udev. It ensur .SH "OPTIONS" .PP \fB\-\-daemon\fR -.RS 3n +.RS 4 Detach and run in the background. .RE .PP \fB\-\-debug\-trace\fR -.RS 3n +.RS 4 Run all events completely serialized. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continiuous operation is needed, where no events are processed in parallel. .RE .PP \fB\-\-verbose\fR -.RS 3n +.RS 4 Print log messages to stdout. .RE .PP \fB\-\-help\fR -.RS 3n +.RS 4 Print usage. .RE .PP \fBlog_priority=\fR\fB\fIvalue\fR\fR -.RS 3n +.RS 4 udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, \fBinfo\fR @@ -52,18 +52,18 @@ and .RE .PP \fBstop_exec_queue\fR -.RS 3n +.RS 4 udevcontrol stops the execution of events from udevd. .RE .PP \fBstart_exec_queue\fR -.RS 3n +.RS 4 udevcontrol starts the execution of events from udevd. .RE .SH "ENVIRONMENT" .PP \fBUDEV_LOG\fR -.RS 3n +.RS 4 Overrides the syslog priority specified in the config file. .RE .SH "AUTHOR" diff --git a/udevinfo.8 b/udevinfo.8 index 7ba7e70128..c22ddfd4bc 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -1,6 +1,6 @@ .\" Title: udevinfo .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.0 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: August 2005 .\" Manual: udevinfo .\" Source: udev @@ -21,7 +21,7 @@ udevinfo queries the udev database for device information stored in the udev dat .SH "OPTIONS" .PP \fB\-\-query=\fR\fB\fItype\fR\fR -.RS 3n +.RS 4 Query the database for specified type of device data. It needs the \fB\-\-path\fR or @@ -35,17 +35,17 @@ to identify the specified device. Valid queries are: .RE .PP \fB\-\-path=\fR\fB\fIdevpath\fR\fR -.RS 3n +.RS 4 The devpath of the device to query. .RE .PP \fB\-\-name=\fR\fB\fInode\fR\fR -.RS 3n +.RS 4 The name of the device node or a symlink to query .RE .PP \fB\-\-root\fR -.RS 3n +.RS 4 The udev root directory: \fI/dev\fR. If used in conjunction with a \fBname\fR @@ -55,17 +55,17 @@ query, the query returns the absolute path including the root directory. .RE .PP \fB\-\-attribute\-walk\fR -.RS 3n +.RS 4 Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules. .RE .PP \fB\-\-export\fR -.RS 3n +.RS 4 Export the content of the udev database. .RE .PP \fB\-\-help\fR -.RS 3n +.RS 4 Print help text. .RE .SH "AUTHOR" diff --git a/udevmonitor.8 b/udevmonitor.8 index a43ea405bf..1fbf01e615 100644 --- a/udevmonitor.8 +++ b/udevmonitor.8 @@ -1,6 +1,6 @@ .\" Title: udevmonitor .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.0 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: August 2005 .\" Manual: udevmonitor .\" Source: udev @@ -17,11 +17,11 @@ udevmonitor \- print the kernel and udev event sequence to the console \fBudevmonitor\fR [\fB\-\-env\fR] .SH "DESCRIPTION" .PP -udevmonitor listens to the kernel uevents and events send out by a udev rule and prints the devpath of the event to the console. It can be used analyze to the event timing by comparing the timestamps of the kernel uevent with the udev event. +udevmonitor listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console. It can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event. .SH "OPTIONS" .PP \fB\-\-env\fR -.RS 3n +.RS 4 Print the complete environment for all events. Can be used to compare the kernel supplied and the udev added environment values. .RE .SH "AUTHOR" diff --git a/udevsettle.8 b/udevsettle.8 index bf0cb06ada..0e463bd902 100644 --- a/udevsettle.8 +++ b/udevsettle.8 @@ -1,6 +1,6 @@ .\" Title: udevsettle .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.0 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: March 2006 .\" Manual: udevsettle .\" Source: udev @@ -21,13 +21,13 @@ Waits watching the udev event queue and exits if all current events are handled. .SH "OPTIONS" .PP \fB\-\-timeout=\fR\fB\fIseconds\fR\fR -.RS 3n +.RS 4 maximum seconds to wait for the queue to become empty. .RE .SH "ENVIRONMENT" .PP \fBUDEV_LOG\fR -.RS 3n +.RS 4 Overrides the syslog priority specified in the config file. .RE .SH "AUTHOR" diff --git a/udevstart.8 b/udevstart.8 index 3357c89d73..c8a7c6fb4f 100644 --- a/udevstart.8 +++ b/udevstart.8 @@ -1,6 +1,6 @@ .\" Title: udevstart .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.0 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: August 2005 .\" Manual: udevstart .\" Source: udev diff --git a/udevtest.8 b/udevtest.8 index bb5e98c078..cf6057ef87 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -1,6 +1,6 @@ .\" Title: udevtest .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.0 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: August 2005 .\" Manual: udevtest .\" Source: udev diff --git a/udevtrigger.8 b/udevtrigger.8 index 300f8e8984..957deccad5 100644 --- a/udevtrigger.8 +++ b/udevtrigger.8 @@ -1,6 +1,6 @@ .\" Title: udevtrigger .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.0 +.\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: March 2006 .\" Manual: udevtrigger .\" Source: udev @@ -21,43 +21,43 @@ Trigger kernel device uevents to replay missing events at system coldplug. .SH "OPTIONS" .PP \fB\-\-verbose\fR -.RS 3n +.RS 4 Print the list of devices which will be triggered. .RE .PP \fB\-\-dry\-run\fR -.RS 3n +.RS 4 Do not actually trigger the event. .RE .PP \fB\-\-retry\-failed\fR -.RS 3n +.RS 4 Trigger only the events which are failed during a previous run. .RE .PP \fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR -.RS 3n +.RS 4 Trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and supports shell style pattern matching. .RE .PP \fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR -.RS 3n +.RS 4 Do not trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and supports shell style pattern matching. .RE .PP \fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR -.RS 3n +.RS 4 Trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. This option can be specified multiple times. .RE .PP \fB\-\-attr\-nomatch\fR\fB\fIattribute=value\fR\fR -.RS 3n +.RS 4 Do not trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. This option can be specified multiple times. .RE .SH "ENVIRONMENT" .PP \fBUDEV_LOG\fR -.RS 3n +.RS 4 Overrides the syslog priority specified in the config file. .RE .SH "AUTHOR" -- cgit v1.2.3-54-g00ecf From 64e6d9dd705f418307fb474a5185d31470f21989 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 27 Nov 2006 10:34:43 +0100 Subject: write_cd_rules: identity-based persistence Bryan Kadzban wrote: > Marco d'Itri wrote: > > Bryan Kadzban wrote: > > > > > This is a sort of follow-up of my path-based persistence patch for > > > net devices; it's the opposite type of addition for CD symlinks. > > > > Looks good. I am attaching a slightly reformatted version, I think it > > should be applied. > > That's probably a lot more clear than my version anyway: what you posted > looks like it does basically the same thing, just with some changes in > the order and sense of checks. --- extras/rule_generator/write_cd_rules | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules index 232daeb86b..1dbe6b70de 100644 --- a/extras/rule_generator/write_cd_rules +++ b/extras/rule_generator/write_cd_rules @@ -50,6 +50,38 @@ if [ -z "$ID_CDROM" ]; then exit 1 fi +if [ "$1" ]; then + METHOD="$1" +else + METHOD='by-path' +fi + +case "$METHOD" in + by-path) + if [ -z "$ID_PATH" ]; then + echo "$DEVPATH not supported by path_id. by-id may work." >&2 + exit 1 + fi + RULE="ENV{ID_PATH}==\"$ID_PATH\"" + ;; + + by-id) + if [ "$ID_SERIAL" ]; then + RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\"" + elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then + RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\"" + else + echo "$DEVPATH not supported by ata_id. by-path may work." >&2 + exit 1 + fi + ;; + + *) + echo "Invalid argument (must be either by-path or by-id)." >&2 + exit 1 + ;; +esac + # Prevent concurrent processes from modifying the file at the same time. lock_rules_file @@ -58,7 +90,7 @@ choose_rules_file link_num=$(find_next_available 'cdrom[0-9]*') -match="ENV{ID_CDROM}==\"?*\", ENV{ID_PATH}==\"$ID_PATH\"" +match="ENV{ID_CDROM}==\"?*\", $RULE" comment="$ID_MODEL ($ID_PATH)" -- cgit v1.2.3-54-g00ecf From 5284454d5f4e7ebe6c7095cf78318020ca9991bf Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 27 Nov 2006 17:13:19 +0100 Subject: scsi_id: remove trailing garbage from ID_SERIAL_SHORT --- extras/scsi_id/scsi_serial.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 513d922559..e1726bbd70 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -732,6 +732,7 @@ static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, for (i = 4; i < len + 4; i++, ser_ind++) serial[ser_ind] = buf[i]; memcpy(serial_short, &buf[4], len); + serial_short[len] = '\0'; return 0; } -- cgit v1.2.3-54-g00ecf From eb8b496e890de4ba347f78f0e7e978117ab2a479 Mon Sep 17 00:00:00 2001 From: Russell Coker Date: Tue, 5 Dec 2006 14:32:44 +0100 Subject: SELinux: label created symlink instead of node The current code will label the target of a symlink rather than the link itself. This means that the link does not get it's context set and the target gets the wrong context. Incidentally this affects the labelling of hard disk device nodes and can get in the way of booting. Also get_media() should not be called with devname==NULL. --- udev_selinux.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/udev_selinux.c b/udev_selinux.c index b802e1fc6e..a305e24136 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -90,10 +90,13 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode char *media; int ret = -1; - media = get_media(devname, mode); - if (media) { - ret = matchmediacon(media, &scontext); - free(media); + if(devname) + { + media = get_media(devname, mode); + if (media) { + ret = matchmediacon(media, &scontext); + free(media); + } } if (ret < 0) @@ -102,7 +105,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode return; } - if (setfilecon(file, scontext) < 0) + if (lsetfilecon(file, scontext) < 0) err("setfilecon %s failed: %s", file, strerror(errno)); freecon(scontext); -- cgit v1.2.3-54-g00ecf From 768cd81b7db0737240c759f59edd6d3399e1707a Mon Sep 17 00:00:00 2001 From: Kazuhiro Inaoka Date: Wed, 6 Dec 2006 15:01:30 +0100 Subject: inotify syscall definitions for M32R --- udev_sysdeps.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udev_sysdeps.h b/udev_sysdeps.h index be97e57b1f..d4f03686af 100644 --- a/udev_sysdeps.h +++ b/udev_sysdeps.h @@ -64,6 +64,10 @@ # define __NR_inotify_init 290 # define __NR_inotify_add_watch 291 # define __NR_inotify_rm_watch 292 +#elif defined (__m32r__) +# define __NR_inotify_init 290 +# define __NR_inotify_add_watch 291 +# define __NR_inotify_rm_watch 292 #elif defined (__hppa__) # define __NR_inotify_init 269 # define __NR_inotify_add_watch 270 -- cgit v1.2.3-54-g00ecf From 9dd0c2573b1e3a6f18356e4db6cee5e5329ecb67 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Dec 2006 09:48:53 +0100 Subject: rename config "filename" to "dir" --- Makefile | 2 +- udev.h | 2 +- udev_config.c | 10 +++++----- udev_rules.h | 2 +- udev_rules_parse.c | 12 ++++++------ udev_utils.c | 19 ++++++++++--------- udevd.c | 2 +- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 947eacaf44..b3a5005757 100644 --- a/Makefile +++ b/Makefile @@ -199,7 +199,7 @@ udev_version.h: $(Q) echo \#define UDEV_VERSION \"$(VERSION)\" >> $@ $(Q) echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ $(Q) echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ - $(Q) echo \#define UDEV_RULES_FILE \"$(configdir)/rules.d\" >> $@ + $(Q) echo \#define UDEV_RULES_DIR \"$(configdir)/rules.d\" >> $@ # man pages %.8 %.7: %.xml diff --git a/udev.h b/udev.h index d09c9922cd..849de96459 100644 --- a/udev.h +++ b/udev.h @@ -92,7 +92,7 @@ struct udevice { /* udev_config.c */ extern char udev_root[PATH_SIZE]; extern char udev_config_filename[PATH_SIZE]; -extern char udev_rules_filename[PATH_SIZE]; +extern char udev_rules_dir[PATH_SIZE]; extern int udev_log_priority; extern int udev_run; extern void udev_config_init(void); diff --git a/udev_config.c b/udev_config.c index 3d18e59796..3f226b9d7c 100644 --- a/udev_config.c +++ b/udev_config.c @@ -31,7 +31,7 @@ /* global variables */ char udev_root[PATH_SIZE]; char udev_config_filename[PATH_SIZE]; -char udev_rules_filename[PATH_SIZE]; +char udev_rules_dir[PATH_SIZE]; int udev_log_priority; int udev_run; @@ -145,8 +145,8 @@ static int parse_config_file(void) } if (strcasecmp(variable, "udev_rules") == 0) { - strlcpy(udev_rules_filename, value, sizeof(udev_rules_filename)); - remove_trailing_chars(udev_rules_filename, '/'); + strlcpy(udev_rules_dir, value, sizeof(udev_rules_dir)); + remove_trailing_chars(udev_rules_dir, '/'); continue; } @@ -166,7 +166,7 @@ void udev_config_init(void) strcpy(udev_root, UDEV_ROOT); strcpy(udev_config_filename, UDEV_CONFIG_FILE); - strcpy(udev_rules_filename, UDEV_RULES_FILE); + strcpy(udev_rules_dir, UDEV_RULES_DIR); udev_log_priority = LOG_ERR; udev_run = 1; @@ -195,6 +195,6 @@ void udev_config_init(void) dbg("UDEV_CONFIG_FILE='%s'", udev_config_filename); dbg("udev_root='%s'", udev_root); - dbg("udev_rules='%s'", udev_rules_filename); + dbg("udev_rules='%s'", udev_rules_dir); dbg("udev_log=%d", udev_log_priority); } diff --git a/udev_rules.h b/udev_rules.h index 4a9cd58484..56153519d4 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -24,7 +24,7 @@ #include "list.h" #define PAIRS_MAX 5 -#define RULEFILE_SUFFIX ".rules" +#define RULESFILE_SUFFIX ".rules" enum key_operation { KEY_OP_UNSET, diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 535b59590a..3f7e43f839 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -627,7 +627,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) err("can't open '%s' as rules file: %s", filename, strerror(errno)); return -1; } - dbg("reading '%s' as rules file", filename); + info("reading '%s' as rules file", filename); /* loop through the whole file */ cur = 0; @@ -683,18 +683,18 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) rules->resolve_names = resolve_names; /* parse rules file or all matching files in directory */ - if (stat(udev_rules_filename, &stats) != 0) + if (stat(udev_rules_dir, &stats) != 0) return -1; if ((stats.st_mode & S_IFMT) != S_IFDIR) { - dbg("parse single rules file '%s'", udev_rules_filename); - retval = parse_file(rules, udev_rules_filename); + dbg("parse single rules file '%s'", udev_rules_dir); + retval = parse_file(rules, udev_rules_dir); } else { struct name_entry *name_loop, *name_tmp; LIST_HEAD(name_list); - dbg("parse rules directory '%s'", udev_rules_filename); - retval = add_matching_files(&name_list, udev_rules_filename, RULEFILE_SUFFIX); + dbg("parse rules directory '%s'", udev_rules_dir); + retval = add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX); list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { if (stat(name_loop->name, &stats) == 0) { diff --git a/udev_utils.c b/udev_utils.c index b6e5275a16..e892012132 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -126,7 +126,6 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c { struct dirent *ent; DIR *dir; - char *ext; char filename[PATH_SIZE]; dbg("open directory '%s'", dirname); @@ -145,14 +144,16 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c continue; /* look for file matching with specified suffix */ - ext = strrchr(ent->d_name, '.'); - if (ext == NULL) - continue; - - if (strcmp(ext, suffix) != 0) - continue; - - dbg("put file '%s/%s' in list", dirname, ent->d_name); + if (suffix != NULL) { + const char *ext; + + ext = strrchr(ent->d_name, '.'); + if (ext == NULL) + continue; + if (strcmp(ext, suffix) != 0) + continue; + } + dbg("put file '%s/%s' into list", dirname, ent->d_name); snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); filename[sizeof(filename)-1] = '\0'; diff --git a/udevd.c b/udevd.c index 3adedac080..79465a1da0 100644 --- a/udevd.c +++ b/udevd.c @@ -1104,7 +1104,7 @@ int main(int argc, char *argv[], char *envp[]) /* watch rules directory */ inotify_fd = inotify_init(); if (inotify_fd >= 0) - inotify_add_watch(inotify_fd, udev_rules_filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + inotify_add_watch(inotify_fd, udev_rules_dir, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); else if (errno == ENOSYS) err("the kernel does not support inotify, udevd can't monitor configuration file changes"); else -- cgit v1.2.3-54-g00ecf From 8af231997824fd1e51a372ae16d4086358c4e83d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Dec 2006 10:10:56 +0100 Subject: remove outdated documentation --- docs/writing_udev_rules/index.html | 2 - docs/writing_udev_rules/index.jp.html | 598 ---------------------------------- 2 files changed, 600 deletions(-) delete mode 100644 docs/writing_udev_rules/index.jp.html diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index cc8fbd60c7..b41664bf69 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -238,8 +238,6 @@ Here is an example rule to illustrate the above: The above rule includes one match key (KERNEL) and one assignment key (NAME). The semantics of these keys and their properties will be detailed later. It is important to note that the match key is related to its value through the equality operator (==), whereas the assignment key is related to its value through the assignment operator (=).

                - -

                Basic Rules

                diff --git a/docs/writing_udev_rules/index.jp.html b/docs/writing_udev_rules/index.jp.html deleted file mode 100644 index e94eae8a46..0000000000 --- a/docs/writing_udev_rules/index.jp.html +++ /dev/null @@ -1,598 +0,0 @@ -udevルールの書き方 - - - - - -

                udevルールの書き方

                -Daniel Drake (dsd) 著
                -バージョン 0.6

                - -この文書の最新バージョンは、常に以下のサイトにあります。
                -http://www.reactivated.net/udevrules.php(英語オリジナルサイト)
                -http://www.gentoo.gr.jp/transdocs/udevrules/udevrules.html(日本語翻訳版)

                - -日本語翻訳版は、著者に許可を得て、五十嵐 正尚(igarashi@gentoo.gr.jp)が翻訳し、GentooJPで公開しているものです。翻訳版に関することは訳者に連絡してください。
                -日本語翻訳版 最終更新日 2005-05-16 - -

                内容

                -
                  -
                1. この文書について
                2. -
                3. 更新履歴
                4. -
                5. 執筆時に使用したソフトウェアのバージョン
                6. -
                7. 用語紹介: devfs、sysfs、ノードなど
                8. - -
                9. なぜルールを書く必要がありますか? (この文書の目的)
                10. -
                11. ルールを書く上での基本事項
                12. -
                13. NAMEとSYMLINKパラメータでの設定自動化のための付加機能
                14. -
                15. キーでのシェル形式パターン照合の使い方
                16. -
                17. キーを書く上での基本事項
                18. -
                19. 基本キーによるデバイス識別方法
                20. -
                21. SYSFSファイルによるデバイス識別方法
                22. -
                23. 複数SYMLINK形式の使い方
                24. -
                25. 所有権とパーミッション制御
                26. -
                27. 例: 著者所有のUSBプリンタ向けのルールの書き方
                28. -
                29. 例: USBストレージ方式対応デジカメ向けのルールの書き方
                30. - -
                31. USBストレージ向けルールの書き方に関する追記
                32. -
                33. 例: 著者所有のCDドライブに便利なルールの書き方
                34. -
                35. 例: 著者所有のネットワークインターフェースに名前を付けるルールの書き方
                36. -
                37. SYSFS内におけるudevinfoを実行すべき場所を探し出すコツ
                38. -
                39. ルールのデバッグ方法
                40. -
                41. 著者と謝辞
                42. -
                - - -

                この文書について

                -udevはLinuxカーネル2.6以降を対象とし、デバイス名を固定する機能を備え、動的な/devディレクトリをユーザスペースで実現する方法を提供します。 -これまでの/devの実装であるdevfsは、現在後方互換のためだけに残されており、udevはその後任と考えられています。 -udevとdevfsではどちらが良いかということは、慎重に議論されるべき問題です。 -ご自分で比較する前に、まずこの文書を読むべきです。

                -udevはよく考え抜かれていますが、私は最初、自分のシステムではどのように調整すればよいのかとても戸惑いました。この文書では、ルールを書く手順がもう少し明確になることを目指しています。

                - -いつでも意見や感想をお待ちしております。どんな意見、問題、改善案でも連絡先にお願いします。

                -この文書は、udev/hotplugをインストール済みであり、初期設定で問題なく動作していることを想定しています。まだudevを設定しておらず、動作していないなら、Decibels udev Primer(日本語訳)に従ってその作業を行うことをお勧めします(少しGentoo Linux固有のことが含まれていますが、他のディストリビューションにも有用なはずです)。

                - - - -

                更新履歴

                - -2005年5月9日 v0.6: udevinfo、グループとパーミッション、ログ取り、udevtestに関する情報を含む様々な更新。

                -2004年6月20日 v0.55: 複数シンボリックリンク形式に関する情報を追加。細かい変更/更新。

                -2004年4月26日 v0.54: Debian情報を追加。細かい修正。 -ルールファイルをなんと呼ぶべきかに関しての情報を過去ものに戻した。 -ネットワークインターフェースの名前付けに関する情報を追加。

                -2004年4月15日 v0.53: 細かい修正。NAME{all_partitions}に関する情報を追加。udevinfoを使用する際のコツに関する別の情報を追加。

                -2004年4月14日 v0.52: udevの初期設定が他のファイルを考慮するようになるまで、udev.rulesの使用を推奨するように戻した。細かい作業。

                -2004年4月6日 v0.51: udev.rulesの先頭に追加するより、各自のlocal.rulesファイルの使用を推奨するように書いた。

                -2004年4月3日 v0.5: ちょっとした整理とudev配布物に含まれる可能性があるため、その準備。

                -2004年3月20日 v0.4: 全体的に改良、明確化、および整理。USBストレージ向けのルールの書き方に関する情報をさらに追加。

                -2004年2月23日 v0.3: sysfsの名前付け動作方法とそれにどのように一致させるかを強調するために、いろんな部分を書き直し。 -udev 018の新しいSYSFS{filename}名前付け規則を説明するルールの書き方を更新。 -セクションの体裁を改良と、いろんな箇所をわかりやすくした。KDEに関する情報を追加。

                -2004年2月18日 v0.2: 例の中のちょっとした間違いを修正。 -マスストレージデバイスの識別に関するセクションを更新。nvidiaのセクションを更新

                -2004年2月15日 v0.1: 最初の公開。

                - - -

                執筆時に使用したソフトウェアのバージョン

                -Linuxカーネル 2.6.11
                -udev 056

                - - -

                用語紹介: devfs、sysfs、ノードなど

                -基本的な紹介だけです。完全に正確ではないかもしれません。

                - -標準的なlinuxを基本とするシステムでは、/devディレクトリは、ファイルに似たデバイスノードを保持するために使用されます。 -デバイスノードは、システムに含まれる特定のデバイスに対応します。 -各ノードは、システム構成の一部(デバイス)を指します。デバイスは、実際に存在するかもしれないし、存在しないかもしれません。 -ユーザスペースで動作するアプリケーションは、システムハードウェアとやり取りをするためにこれらのデバイスノードを使用できます。例えば、ユーザが行うマウス動作を、画面上のマウスポインタの動きに結びつけるために、XFree86は/dev/input/miceを監視します。

                - -もともとの/devディレクトリは、システムに組み込まれる可能性のある全てのデバイスが配置されていました。 -そんなわけで/devディレクトリは、一般的にとても大きくなっていました。 -devfsは、もろもろの機能に加え、より扱いやすい手法(特に目を引くのは、システムに接続されたハードウェアだけが/devに配置されたことでした)を提供するために登場しました。 -しかし、devfsには簡単に解決することができない問題があることが判明しました。

                - -udevは、/devディレクトリを管理する新しい手法です。 -過去の/dev実装にある問題を解決するように設計され、将来にわたって破綻しないものを提供します。 -udevは、ユーザが指定するルールsysfsによって提供される情報を照合して、システムに組み込まれたデバイスに相当する/devデバイスノードを作成し命名します。 -ルールを書く工程は、ユーザが(選択的に)行う必要がある数少ないudevに関係する作業のうちの一つです。 -この文書は、そのルールを書く工程を詳しく説明することが目的です。

                - -sysfsは、2.6カーネル向けの新しいファイルシステムです。 -sysfsはカーネルによって管理され、システムに接続されているデバイスに関する基本情報をユーザスペースに提供します。 -udevは、ハードウェアに相当するデバイスノードを作成するために、この情報を使用します。 -sysfsは/sysにマウントされることで、情報を読み出せる状態になります。 -udevに取り組む前に、まず/sysにあるファイル群を調査したいとお思いになるでしょう。この文書全体に渡って、用語/sysSYSFSを使用します。どちらにも読み替え可能です。


                - - -

                なぜルールを書く必要がありますか?

                -上で述べたように、udevのルールを書くかどうかは、自由に選択できます。 -初期設定でも、デバイスを接続することができ、過去の/dev実装でのように、そのデバイスに適切なノード(例えば、マスストレージデバイス用である/dev/sdaなど)が作成されるでしょう。

                -しかし、udevはデバイスノードの名前を自由に変えることができます。 -名前を変更したくなる理由には、利便性とデバイス名の固定化の二つが考えられます。

                - -プリンタが接続されたときに、/dev/printerとして命名され、さらにいつもの/dev/lp0も存在するようにする場合のudevの使用例を挙げます。 -この例は、利便性(例えば、lp0ではなくprinterに読み替える)だけではなく、変更になる可能性のある名前への対策であることを意図しています。 -私は二つのプリンタ(HPのレーザプリンタと、EPSONのインクジェット)を持っています。 -それらプリンタの両方が接続され、システムに組み込まれるた場合、/dev/lp0と/dev/lp1になります。
                -どうすれば、どちらのノードがどちらのプリンタを指しているかを知ることができるでしょう。 -簡単な方法はありません。接続された順で、最初のプリンタがlp0を割り当てられ、二番目がlp1に割り当てられます。異なる順番でプリンタが接続されると、この名前は逆になります。そして、それは常にHPのレーザプリンタがlp1であることを想定している私のスクリプトを混乱させるでしょう。

                -しかし、もしHPレーザプリンタに(lpXに加えて)lp_hpの名前が与えられ、一方のプリンタに(lpYに加えて)lp_epsonの名前が与えられるなら、私のスクリプトは、これらの名前を使えるでしょう。udevの魔法は、このようなことを制御でき、このような固定された名前が常に意図するデバイスを指すことを確実にします。

                -この名前の固定化機能は、外部マスストレージデバイス(例えば、USBハードディスク)において、/etc/fstabに正確なデバイスを書き込むことを可能にするのに、とても役に立ちます。

                - -ルールを書くことは、udevの動作を調整する一つの手段でしかないという認識を持つことが大切です。 -ルールを書くことは、既存の特定デバイスに対応するデバイスノードがない場合の問題に対する回避策ではありません。 -該当する既存のルールがない場合、udevはカーネルが提供する名前を使ってとにかくノードを作成します。

                - - -

                ルールを書く上での基本事項

                - -udevは、/devの下を配置するときに、一連のルールファイルを読んで、どのノードを含めるかと、それらのノードにどのような名前を付けるかを決定します。

                - -初期設定のudevルールは、/etc/udev/rules.d/50-udev.rulesにあります。 -このファイルにざっと目を通すとおもしろいことが分かるかもしれません。 -そこには少しの例や、いくつかのdevfs形式の/devレイアウトを提供する初期設定ルールが含まれています。 -しかし、今後udevを更新するときに起こりうる面倒を軽減するために、このファイルにルールを直接書くべきではありません。

                - -/etc/udev/rules.d/にあるファイルは、辞書順で解析されます。 -udevは、ファイル中に新しく検出されたハードウェアに一致するルールを見つけるとすぐに、ルール処理を止めます。 -udevの初期設定と照合される前に、ユーザが用意したルールが処理されることが重要です。そうでないと、ユーザの命名規則は無効になってしまうでしょう。 -/etc/udev/rules.d/10-local.rulesファイル(デフォルトでは存在しないので、作成してください)の中にユーザ指定のルールを保持しておくことを推奨します。 -10は50より前なので、ユーザ指定のルールが最初に評価されることがおわかりでしょう。 -ユーザ指定のルールファイルの名前は、.rulesサフィックスで終わっている必要があります。そうしないと利用されません。

                - -ユーザ指定のルールは、基本の/devレイアウトを作成するudevの初期設定を、事実上無効にしてしまいます。したがって、ユーザが記述するルールには、実用的である初期設定の名前とユーザ指定の名前両方を得るために、devfs形式の名前やシンボリックリンクも指定することをお勧めします。

                - -ルールファイルでは、"#"で始まる行は、コメントとして扱われます。 -ルールファイルの中のコメントされてない全ての行が、ルールに相当します。

                - -ルールは複数のキーで構成されます。複数のキーはコンマによって区切られます。 -一部のキーは情報の読み込みと照合用で、その他のものは、情報の割当てやアクションの実行用です。 -
                  -
                1. システムにあるいろいろなデバイスに一致する、少なくとも一つの識別キー(identification key)を指定する必要があります。 -識別キーついては、後にある基本キーによるデバイス識別方法セクションに記載されています。
                2. -
                3. 結果としてデバイスノードがどのようにして作成されるかを制御するための、少なくとも一つの割当てキー(assignment key)を指定する必要があります。 -割当てキーには、NAME、SYMLINK、OWNER、GROUP、MODEがあり、このドキュメントですべて説明しています。
                4. -
                - -一般的なルールは、デバイスに名前を付けることを決定するために、複数の基本識別キーが使われます。そして、デバイスノード名を決めるために一つのNAME割当てキーが指定されます。 -udevは、一つのデバイスに対し一つのノードだけを作成します。 -したがって、一つのデバイスに対し複数のノードを通してアクセスしたい場合は、SYMLINK割当てキーに、別のノードを指定する必要があります。

                - -以下に例を示すためにudevの例にあるルールをちょっと修正したものを取り上げます。 -
                BUS="usb", SYSFS{serial}="HXOLL0012202323480", NAME="lp_epson", SYMLINK="printers/epson_stylus"
                - -この場合の識別キーは、BUSSYSFS{serial}で、割当てキーは、NAMESYMLINKです。 -udevは、このルールをUSBバスによって接続されかつHXOLL0012202323480のシリアルナンバーを持つデバイスに対して一致させます。 -udevがデバイスに名前を付けるルールとして採用するには、(どれか一つではなく)すべての指定されたキーが一致する必要があります。
                - -udevは、このノードをlp_epsonと命名し、/dev/lp_epsonに作成するでしょう。
                -udevは、さらに/dev/lp_epsonへのシンボリックリンクを、/dev/printers/epson_stylusに作成します(printersディレクトリは、自動的に作成されます。)。 -これで、/dev/printers/epson_stylusもしくは/dev/lp_epsonにデータを送ることで、EPSONプリンタで印刷することができます。

                - -ユーザが追加または修正したどんなルールも、udevに通知するまで有効にはなりません。 -何かルールファイルを修正した場合は常に以下のコマンドを確実に実行することを忘れないでくささい。 -
                # udevstart
                - - -

                NAMEとSYMLINKパラメータでの設定自動化のための付加機能

                -ルールのNAMEとSYMLINKパラメータに、デバイスの名前づけを支援する基本オペレータを使用することができます。 -プログラム言語が分かる人は、この種のものをprintf形式に似た文字列置換として知っていると思います。 -NAME/SYMLINKパラメータの一部もしくは全てを組み立てることが可能な、いくつかのオペレータがあります。 -これらオペレータは、デバイスに関するカーネルデータを参照します。 -以下の例を見てみましょう。 -
                BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n"
                - -%nオペレータは、camera0、camera1、などのようなNAMEを作成するために、カメラデバイスに対する"カーネル番号"に置き換えられます。

                - -他にはよく使われるオペレータとして、%kがあります。 -これは、例えば"hda1"などのような、カーネルがデバイスに付けると予想される名前を表します。 -ハードウェアのデフォルトの名前を作成するための、NAME="%k"が指定されているルールをよく見るでしょう。 -このようなルールでは、ユーザ指定のものは通常SYMLINKパラメータによって設定されます。

                - -udevのmanページに説明付きでオペレータの全リストがあります。

                - - -

                キーでのシェル形式パターン照合の使い方

                - -キーを書く場合、より柔軟性を高めるためにシェル形式のパターン照合を使用することができます。以下に初期設定のudevルールを取り上げます。 - -
                KERNEL="ts*", NAME="input/%k"
                -ここでは*オペレータが使われています。これは、文字列長が0以上のすべての種類の文字で構成される文字列全体に一致します。 -このルールの書き方は、以下のことを意味します。 - -
                "ts"の文字列で始まり、その後に任意で何かの文字が続くKERNEL名によって識別されるデバイスに一致し、指定ディレクトリの下にKERNEL名(%k)で名前をつけます。
                - -?オペレータはよく似ており、何かの一文字に一致します(0文字には一致しません)。

                - -どれかの一文字に一致する、かぎ括弧[ ]も使用できます。以下にudevのmanページから直接引用します。
                -
                例えば, パターン文字列"tty[SR]"は、"ttyS"か"ttyR"に一致します。
                -一致範囲を指定することもできます。 -例えば、[0-9]はいずれかの一文字の数字に一致します。 -以下にudevインストール直後の初期設定にあるルール例を示します。 -
                KERNEL="fd[0-9]*", NAME="floppy/%n"
                - -このルールは以下のことを意味します。
                - -
                "fd"で始まり、それに一文字の何かの数字が続き、その後に任意で何かの文字が続くKERNEL名によって識別されるデバイスに一致します。フロッピーのディレクトリの下にデバイスのカーネル番号(%n)でデバイスに名前をつけます。
                -これらのワイルドカード/パターン一致は、基本キーとsysfsでの識別情報の両方を含め、どのキータイプででも使用できます(キータイプに関しては後の説明を参照してください)。

                - -ここでは、ルールの書き方に関する基本事項の範囲外である一部の情報(特に[ ]オペレータの柔軟性)をわざと割愛しています。 -これに関する詳しい情報は、udevのmanページにあります。

                - - -

                キーを書く上での基本事項

                -udevは、いくつかの基本キーを照合する仕組みを提供しています。さらにSYSFS内のデバイス情報と照合するための柔軟な方法も提供します。 -標準的なルールは、普通のキー(BUSとKERNELなど)と、 -同一ポートに接続された異なるハードウェア間で区別をするSYSFSキーの両方が一致します。

                -「自分のプリンタのシリアルナンバーをどうやって探せばいいの? 私のカメラのモデルは何だろう?」と疑問に思うかもしれません。 -ルールの書き方は、思うほど難しくありません。 -一番やっかいなのは/sys内で対象のデバイスを探して、どの情報を使うかを決めることです。

                - - -

                基本キーによるデバイス識別方法

                - -基本キーに関するより詳しい情報はudevのmanページを参照してください。

                - -有効なキーは次のとおりです。 -
                • BUS - デバイスのバスの種類と照合されます。
                • -
                • KERNEL - カーネルデバイス名と照合されます。
                • -
                • DRIVER - カーネルドライバの名前と照合されます。
                • -
                • SUBSYSTEM -カーネルサブシステム名と照合されます。
                • -
                • ID - バス上のデバイスナンバー(PCIバスIDなど)と照合されます。
                • -
                • PLACE - デバイスが接続された物理的な位置と照合されます(USBに役に立ちます)。
                • - -
                -IDとPLACEキーは、役に立つこともありますが、一般的にルールでは使用されません。 -この文書は、BUSとKERNELキーやSYSFS{...}キー(次のセクションで説明します)の使い方に重点を置きます。 -例を使ってこれらのキーの使い方を示します。

                - -さらに柔軟な方法として、udevは外部のスクリプトを呼び出してその結果を使うためのキーや、環境変数を使うためのキーも準備しています。 -これは、この文書の範囲外とします。より詳細な説明は、udevのmanページを見てください。 - - -

                SYSFSファイルによるデバイス識別方法

                - -前提となる知識: SYSFSは、ディレクトリツリーの下にハードウェアに関する情報を提供するたくさんの小さなファイルを保持しています。 -一つのファイルは、一般に一つだけ"データ項目"を持ちます。- 例えば、デバイス名や製造者情報やプロダクトIDがあります。

                -SYSFS{...}キーは、前のセクションで説明した基本キーと組み合わせることができます。


                - -特定のSYSFSの情報と照合するために、SYSFS{ファイル名}形式のキーを使えます。ファイル名は、SYSFSツリーの中のファイルに相当します。 -例としては、私のカメラが接続された場合、"USB 2.0M DSC"という内容で/sys/block/sda/device/modelにファイルが存在します。これと照合するために、次のようなキーを使えます。SYSFS{model} = "USB 2.0M DSC"

                - -sysfsにあるすべてのファイルが、この方法で照合することができます。 -ただ、(複数のキーを使って)一つ以上のファイルと照合させる場合、同一ディレクトリにあるファイルとだけに照合させる必要があります。 -一般的には、一つのデバイスに関する情報を提供するディレクトリは、いくつか存在します。 -(後の例で示すとおり、)それらを混合して照合することはできません。

                - -幸いにして、ルールを書く過程において、SYSFSにある無数のファイルを探し回る必要はありません。udevinfoユーティリティがその大変な作業を代わりにやってくれます。このプログラムはudevの配布物の中に含まれています。

                -まず始めにしなければならないことは、対象のハードウェアに対応する、"dev"というファイルを含むディレクトリが/sysのどこにあるかを見つけることです。 -udevinfoは、そのようなディレクトリ上でだけ動作可能です。 -これらのディレクトリは、すべてが/sys/block/sys/classのどちらか一方の下で見つかります。 -- その他の場所は、どこも参照する意味がありません! -しかし、udevinfoはこれらのディレクトリを経由してリンクを辿って、sysfsの別のセクションで見つかる情報を読み出します。

                -一度だけこのようなディレクトリを見つければ、udevルールのキーを書く作業を手助けしてくれる以下のコマンドが使えます。 -
                # udevinfo -a -p /sys/path/to/hardware/info
                - -udevinfoを実行するための/sys内の適切な位置を見つけることについては、まだ明確になっていないことが分かるでしょう。 -接続したデバイスに対し既にデバイスノード(例えば、/dev/sda)が作成されている可能性があり、その場合はudevinfoが役に立ちます! -私の/dev/sdaノードの例でいうと、以下のコマンドを実行するとsysfsの適切な位置を示してくれます。 -
                # udevinfo -q path -n /dev/sda
                -
                -/block/sda
                -
                - -(上記で示した)このコマンドの出力は、sysfsパスが/sys/block/sdaで始まることを示しています。 -これで私は"udevinfo -a -p /sys/block/sda"を実行できます。 -これらの二つのコマンドは、以下のように連ねることができます。 - -
                # udevinfo -a -p $(udevinfo -q path -n /dev/sda)
                - -注記: 前に示したものには、udevinfoにあらかじめフルパス(/sys/なんとか/パス)を指定していて、今回はこれらのコマンドを連結することでsysfsに関係するパスを指定していることに気が付くかもしれません。 -どちらでも特に問題はありません。どちらのパス形式も受け付けられます。

                -ここでルールの書き方に移り、私の環境での"udevinfo -a -p /sys/block/sda"の実行結果の抜粋を、色づけをして以下に示します。
                - -
                
                -follow the class device's "device"
                -  looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3/3-3:1.0/host0/0:0:0:0':
                -    BUS="scsi"
                -    ID="0:0:0:0"
                -    SYSFS{detach_state}="0"
                -    SYSFS{type}="0"
                -    SYSFS{max_sectors}="240"
                -    SYSFS{device_blocked}="0"
                -    SYSFS{queue_depth}="1"
                -    SYSFS{scsi_level}="3"
                -    SYSFS{vendor}="        "
                -    SYSFS{model}="USB 2.0M DSC    "
                -    SYSFS{rev}="1.00"
                -    SYSFS{online}="1"
                -
                -  looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
                -    BUS="usb"
                -    ID="3-3"
                -    SYSFS{detach_state}="0"
                -    SYSFS{bNumInterfaces}=" 1"
                -    SYSFS{bConfigurationValue}="1"
                -    SYSFS{bmAttributes}="c0"
                -    SYSFS{bMaxPower}="  0mA"
                -    SYSFS{idVendor}="052b"
                -    SYSFS{idProduct}="1514"
                -    SYSFS{bcdDevice}="0100"
                -    SYSFS{bDeviceClass}="00"
                -    SYSFS{bDeviceSubClass}="00"
                -    SYSFS{bDeviceProtocol}="00"
                -    SYSFS{bNumConfigurations}="1"
                -    SYSFS{speed}="12"
                -    SYSFS{manufacturer}="Tekom Technologies, Inc"
                -    SYSFS{product}="USB 2.0M DSC"
                -
                - -udevinfoツールは、udevルールにそのままコピーペーストして使うことができる多くの情報を提供してくれます。 -上記の出力結果に色をつけた理由は、 -通常はudevinfoの出力の異なる箇所からの情報を組み合わせて照合することができないことを示すためです。 -上記の出力結果で、異なる色が付いているセクションの情報を組み合わせることはできません。 - 出力結果の各セクションが、SYSFS内での異なるディレクトリを参照している情報だからです。 -例えば、以下のルールは機能しません。 -
                BUS="scsi", SYSFS{manufacturer}="Tekom Technologies, Inc", NAME="%k"
                このルールは、青いセクションにだけ存在する情報とBUS="scsi"(緑)で始まるセクションにある情報と組み合わさっているので機能しません。 -BUS="usb"と、上記の青いセクションにある情報だけを使用しているならちゃんと機能するでしょう。

                -多くの情報が、基本的なルールの書き方には関係ないことがわかるでしょう(本当にたくさんあります!)。 -一般的には、変更にならないことが分かっている情報(例えばモデル名)を探すべきです。

                - -デバイスを識別するユーザ指定のルールを記述すると、初期設定のdevfs形式のルールが機能しなくなることに注意してください。 -たいていの場合、NAME="%k"を使用するのが賢明で、初期設定の実用的な名前がなくならないように、SYMLINKパラメータに追加の名前を指定してください。

                - -以下にudevinfoの出力を基にしたルールの書き方の手順を三つの例で示します。 -その後、正確な情報を提供するために各デバイス固有の小技やコツをいくつか記述しようと思います。

                - -読者の一人が、KDEのコントロールセンターがルールを書くのに役に立つということを、知らせてきました。 -USBデバイス(やその他)に関する情報が、KDEコントロールセンターの"Info Centre"セクションで見つかるということです。 -このインターフェースは、シリアルナンバー、ベンダIDなどのような情報を表示します。 -GUI的なやり方が好ましいなら、こちらを調査したいと思うでしょう。

                -現在リリースされているGNOMEボリューム管理は、実デバイスとしてシンボリックリンクノードを扱うことができません。 -上記で説明したのとは反対に、NAMEパラメータにユーザ指定の名前を指定して、SYMLINKパラメータに%kを指定しようと思うかもしれません。

                - -複数SYMLINK形式を使えば、ユーザ指定ルールが初期設定を上書きする仕様に対処できます。 - -
                - - -

                複数SYMLINK形式の使い方

                -最近取り入れられた機能の一つに、NAMEを指定せずに、複数のSYMLINKキーを単純に指定するルールが書けるようになったことがあります。 -これで、ユーザ指定ルールがudevの初期設定を実質的に無効にする問題を避けることができます。

                - -そのルールを以下に取り上げます。
                -
                KERNEL="hdc", SYMLINK="dvd"
                -udevはこのルールを見つけると、記憶しておきます。 -そして、NAMEパラメータも含む同一デバイスに一致する別のルールを見つけたときに、そのNAMEパラメータで指定されているノードに加え、両方のルールにあるSYMLINKパラメータで指定されているシンボリックリンクも作成します。
                -実際問題として、udevは私のhdcデバイスのノードを命名する際に、いつものようにブロックデバイス用の初期設定ルールを使い、追加の私個人指定の"dvd"シンボリックリンクを作成します。

                - -普通のルールと同様に、udevがNAMEパラメータを指定しているルールを見つける前にこの形式のルールを見つけたときだけ有効になります。

                - - -

                所有権とパーミッション制御

                -作成されるデバイスノードの名前付け制御と同様に、udevルールは、そのデバイスノードの所有権とパーミッション属性の制御も可能にします。

                - -GROUPキーは、どのunixグループにデバイスノードを所有させるかを定義できます。 -ここにudevの初期設定から例を示します。 -この例は、フレームバッファ(fb)デバイスをvideoグループにするように定義しています。 - -
                KERNEL="fb[0-9]*", NAME="fb/%n", SYMLINK="%k", GROUP="video"
                - -おそらくあまり使えないOWNERキーは、どのunixユーザにデバイスノードを所有させるかを定義できます。 -フロッピーデバイスを"john"の所有にする場合のちょっと変な状況を仮定すると、次のように使います。 -
                KERNEL="fd[0-9]*", OWNER="john"
                - -上記のルールには、NAMESYMLINKが一つも指定されていないことがわかるでしょう。 -これは、udevが、フロッピーノードをjohnの所有にしたいということを記憶しておき、フロッピーデバイスノードに対するNAMEが定義されたルールを見つけると、所有者を適用する点で、複数シンボリック形式に似ています。

                -上で記述した形式を使用すると、もっと華麗なこともできます。 -udevの初期設定では、すべてのサウンドデバイスノードが"audio"グループによって所有されるように定義するのに以下のルールを使用しています。 -
                SUBSYSTEM="sound", GROUP="audio"
                - -これに続くサウンドデバイスに名前を付ける全てのルールにGROUP="audio"キーをやたらと指定する必要をなくします。

                - -udevのデフォルトでは、unixパーミッションに0660(所有者とグループだけが読み書き可能)を持つノードを作成するようになっています。 -これは、/etc/udev/udev.confの中のdefault_mode設定によって設定されています。 -デバイスノードにデフォルトパーミッションを適用したくない場合もあるかもしれません。幸いにして、ルールにMODE割当てキーを使うことで簡単にデフォルト設定より優先させることができます。 -例として、以下のルールはinotifyノードが全てのユーザに読み書き可能になるように定義しています。 - -
                KERNEL="inotify", NAME="misc/%k", SYMLINK="%k", MODE="0666"
                - - -

                例: 著者所有のUSBプリンタ向けのルールの書き方

                -私は、プリンタを接続した後、ルールを書くために/sysディレクトリから関連する位置を探し始めました。 -どこにも見つからなかったのですが、私のプリンタにデバイスノード/dev/lp0が割り当てられていることに気づきました。 -udevinfoは、便利なpathを指定すると以下のように教えてくれます。 -
                # udevinfo -q path -n /dev/lp0
                -/class/usb/lp0
                -
                -"udevinfo -a -p /sys/class/usb/lp0"を実行すると、通常通りに多くの情報を提供してくれます。 -デバイスを識別する以下の固有の情報を選択しました。 -
                looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
                -BUS="usb"
                -SYSFS{manufacturer}="EPSON"
                -SYSFS{product}="USB Printer"
                -SYSFS{serial}="L72010011070626380"
                -
                - -この場合のudevルールは以下のようになります。 -
                BUS="usb", SYSFS{serial}="L72010011070626380", NAME="%k", SYMLINK="epson_680"
                - -そうすると、私のプリンタのノードは/dev/lp0(または、別のプリンタが前もって接続されている場合は/dev/lp1)で存在し、/dev/epson_680常にそのプリンタのためのデバイスノードを指します。

                - - -

                例: 著者所有のUSBストレージ方式対応デジカメ向けのルールの書き方

                - -簡単な説明: 私のカメラは外付けSCSIハードディスクとして認識されます(USBハードディスクやフラッシュメモリカードリーダのようなデバイスにも使用されるusb-strageドライバを使います)。 -そして、そのディスク上のパーティションをマウントして、画像ファイルをコピーできます。すべてのカメラがこのように動作するわけではありません。ほとんどのカメラは、画像ファイルを扱うために、さらにソフトウェア(gphoto2など)を必要とします。

                - -これにはちょっとしたコツがあります。私のカメラが接続されると、デフォルトでいくつかのノードが作成されます。 -/dev/sda/dev/sda1/dev/sg1さえも作成されるかもしれません。 -この例が示しているものは重要です。もしルールが上手に指定されなければ、上記3つのノードすべてに一致することがありえます。

                - -sda1は、私がマウント用に/dev/cameraとして使用しようと思うノードです。 -udevinfoはsda、sda1、sg1の間に利用できそうな差異は何も提示してくれません。 -これら3つのノードを区別するために信頼できる方法は、KERNEL名を見ることであると私は判断しました。

                - -KERNEL="sd?1"のようなキーは、"sda1"、"sda1"、"sdc1"のようなKERNEL名に一致し、そして同様に重要なことに、それは、sda、sdb、sg1のようなKERNEL名に一致しないであろうということです。 -このようなキー指定には、/dev/sda/dev/sg1ノードに一致させないという目的があります。 -対象のデバイスはデジタルカメラです。その上ではfdiskやその類の操作をしようなんて夢にも思わないので、私にとってこれらの2つのノードは、まったく使いものになりません。 -このキーは/dev/sda1ノードを捕捉しようとします。これはマウント可能なので、使いものになります!

                - -このノード(sda1)は、ブロックデバイスとして扱われるので、/sys/blockから探すことは、作業を始めるのに向いています。

                - -私の環境での/sys/blockには、sdaというディレクトリがあります。 -/sys/block/sdaには、sda1というディレクトリがあります。 -これら両方のディレクトリにdevファイルがあるので、そこでudevinfoを実行できます。 -以下を実行すると、私のカメラとそれが接続されているUSBポートに関するたくさんの情報を表示してくれます。 - -
                # udevinfo -a -p /sys/block/sda/sda1
                - -udevinfoの出力に、以下のちょっと役に立つ意味がわかりやすい情報を見つけました。
                SYSFS{product}="USB 2.0M DSC"
                - -よってこれで私のルールを書くことができます。ルールを完全にするために、BUSキーも加えます(これもudevinfoの出力で見つかります)。 -
                BUS="usb", SYSFS{product}="USB 2.0M DSC", KERNEL="sd?1", NAME="%k", SYMLINK="camera"
                - -こうして、私のカメラを接続すると、/dev/sda1(もしくは、sda1が利用できないなら、/dev/sdb1になるかもしれません)という名前で、常に間違いなく/dev/cameraからリンクされます。 -/dev/sda(もしくはsdb)ノードは、いつものようにまだ出現します。 -しかし私が指定する不変の"camera"シンボリックが、マウント可能パーティションを指しているということが重要です。

                - - -

                USBストレージ向けルールの書き方に関する追記

                - -大容量のUSBハードディスクを所持するCarl Streeterが、/dev/sdaノードが役に立たなかった私のデジタルカメラの例とは違った説明をメールしてきました。 -/dev/sdaのようなノード上でfdiskhdparmなどのツールをちょくちょく使う必要があることを指摘しています。

                - -以下にCarlのルールを示します。 -
                BUS="usb", KERNEL="sd*", SYSFS{product}="USB 2.0 Storage Device", NAME="%k", SYMLINK="usbhd%n"
                - -このルールは、以下のようなシンボリックリンクを作成します。 -
                  -
                • /dev/usbhd - fdiskすることができるノード
                • -
                • /dev/usbhd1 - 一つ目のパーティション (マウント可能)
                • -
                • /dev/usbhd2 - 二つ目のパーティション (マウント可能)
                • - -
                -Carlとはマウント不可の/dev/sdaノードが必要かどうかは、状況と対象のデバイスに依存するということで共通認識を持っています。 -どちらの設定方法にしろ都合のよい方を使用してください。

                -これとは別の複雑な状況として、複数のスロットを持つUSBストレージカードリーダを持っている場合があります。 -新しいカードが刺されたり抜かれたりしたときに、一般的にこのような種類のデバイスはその情報を通知しません。 -よって、リーダが接続されている間に未使用スロットにカードを刺しても、マウントする必要がある追加のデバイスノードは、作成されないでしょう!
                -この問題は、他のUSBディスクにも当てはまります。 -例えば、新しいパーティションを作成した場合、デバイスを再接続するまで、新しいパーティションノードは出現しないでしょう。

                -udevは、これに対する一つの解決方法を提供します。 -ブロックデバイスのすべてのパーティション用のノードを作成することができます。 -指定したすべてのルールに対して、ブロックデバイスで16個のパーティションノードを作成します。 -これをするには、以下に示すように単にNAMEキーを修正します。
                - -
                BUS="usb", SYSFS{product}="USB 2.0 Storage Device", NAME{all_partitions}="usbhd"
                - -こうすることで、usbhd、usbhd1、usbhd2、usbhd3、...、usbhd15というノードが作成されるでしょう。

                - - -

                例: 著者所有のCDドライブ向けの有用なルールの書き方

                -私のPCには二つのCDドライブがあります。一つは、DVD読み込み対応で、一つはCD読み書き対応のものです。 -DVDのノードはhdcで、CDRWのノードはhddです。 -あえてシステムの結線を変更する場合を除いて、これを変更するつもりはありません。

                - -でも、利便性のために/dev/dvd/dev/cdrwのようなノードを好む人が(私自身も含めて)います。 -これらドライバの"hdX"の値がわかっているので、ルールを書くのは簡単です。 -以下の例は、それだけで自明でしょう。 -
                BUS="ide", KERNEL="hdc", NAME="%k", SYMLINK="dvd cdroms/cdrom%n"
                -BUS="ide", KERNEL="hdd", NAME="%k", SYMLINK="cdrw cdroms/cdrom%n"
                -
                - -デフォルトの50-udev.rulesファイルにブロックデバイス用の名前を生成するスクリプトを実行するルールがあることに気が付くかもしれません。 -これに惑わされないでください。やはりユーザ指定のルールは、デフォルトルールの前に処理されるファイルに設定するので、デフォルト設定は、ルールを設定済みのハードウェアに名前をつけるときには使用されません。

                - - -

                例: USB Visor Palm Pilot向けのルールの書き方

                - -これらのデバイスは、USBシリアルデバイスのように動作します。よってデフォルトではttyUSB1ノードだけが得られます。 -ユーザスペースのpalmユーティリティは、/dev/pilotがあることを前提としています。 -よってそのノードを作成するルールを使う必要があります。 -以下のルールはこれを行います。

                - -
                BUS="usb", SYSFS{product}="Palm Handheld", KERNEL="ttyUSB*", SYMLINK="pilot"
                - -この状況に関する有用な議論があるCarsten Clasohm's blog entry(訳注: Carsten Clasohmのブロブ)から応用しました。 -さらに個々の設定に合わせるために、上記ルールに所有権とパーミッションキーを追加したいと思うかもしれません。

                - - -

                例: 著者所有のネットワークインターフェースに名前を付けるルールの書き方

                -最近のバージョンのudevにある興味深い新しい機能に、nameifユーティリティのように、ネットワークインタフェースの名前を付け直す機能があります。 -ネットワークインターフェースは、/devに出現しませんが、一般的にはそれらは名前によって参照されます(例えば、ifconfigで使用される場合)。 -ネットワークデバイスには様々ありますが、ルールを書く工程はほとんど同じです。

                -やはりudevinfoはルールを書く手がかりになります。 -以下は私の"eth0"のネットワークデバイスの名前を変更したい場合の例です(以下の出力結果は省略されています)。 -
                # udevinfo -a -p /sys/class/net/eth0/
                -  looking at class device '/sys/class/net/eth0':
                -    SYSFS{address}="00:52:8b:d5:04:48"
                -
                -すべてのネットワークアダプタには固有のMACアドレスがありますので、ルールを書く場合にはこれを使うことを選択しました。 -この値は、ネットワークカードを変更しない限り変更がありません。 -以下に一つ警告があります。 -大文字小文字を区別しますので、必ず(上記のように)udevinfoから取得したMACアドレスを使ってください。 -ifconfigのようなユーティリティを使う場合は、それらは大文字を使うので、気をつけてください。

                - -ルールの例を以下に示します。 -
                KERNEL="eth*", SYSFS{address}="00:52:8b:d5:04:48", NAME="lan"
                -このルールを有効にするためにネットワークドライバをリロードしなければならないでしょう。 -モジュールをアンロードして再度ロードするか、もしくは単にシステムをリブートすればよいです。 -"eth0"ではなく"lan"を使うようにシステムを構成しなおす必要もあります。 -私の場合、eth0を参照するものすべてを完全に削除しないで、これを進めてしまい、少々苦労をしました。
                -これが完了すれば、ifconfigやそれに似たユーティリティのどれにでも"eth0"の代わりに"lan"を使えるはずです。

                - - -

                SYSFS内におけるudevinfoを実行すべき場所を探すためのコツ

                -ここではより多くのデバイス固有のコツを求めています。 -提供できることならなんでも連絡してください - -
                  -
                • ルールを書こうとしているデバイスに対し、すでに/devの下にデバイスノードが作成されているなら、運がよいです! -適切な/sysのパスを得るために、次のコマンドを実行してください。udevinfo -q path -n /dev/ノード名
                • -
                • ルールを書く手間を軽くするために、常にudevinfoを使用してください。 -/sys/blockや/sys/classの下を参照するために、常にudevinfoを使用してください(別のところから、チェイン情報を読むことはありません)。
                • -
                • 何も手がかりがなければ、/sysの下のすべて"dev"ファイルを探すために、次のコマンドを使用してくだい(udevinfoは、このファイルがあるディレクトリ上でのみ動作します。)。find /sys -iname dev
                • -
                • 対象のデバイスが、フラッシュカードリーダや、USBフラッシュドライブ、/dev/sdXが作成されるUSBストレージとして振舞うデジタルカメラの場合、/sys/block/sdXを探してみてください。
                • -
                • 上記の状況に該当する場合、必ずsdXとsdX1とを区別して下さい。sdX1に一致するキーKERNEL="sd?1"もしくは、sdXに一致するKERNEL="sd?"で区別できます。
                • -
                • /dev/lpXとして作成されるUSBプリンタについては、/sys/class/usb/lpXから探すべきです。
                • - -
                • USBスキャナドライバは、最近カーネルから削除され、(SANEパッケージの一部として)ユーザスペースで再実装されました。 -特定のカーネルドライバに依存しないように、この種のハードウェア用のルールを書いてはいけません(し、書けないでしょう)。
                • -
                • あいにくカーネルはsysfsですべてのデバイスの情報を開示するわけではありません。 -よって、まだ一部のデバイスに対してはルールを簡単に書くことができません。 -2004年2月20日時点で、udevの作者はsysfsに未対応のドライバが162個残っていると言っています。
                • -
                - - -

                ルールのデバッグ方法

                - -ルールを書き終わって忘れずにudevstartを実行しても、有効にならないなら、それをデバッグするのには二つの方法があります。

                - -/etc/udev/udev.confには、udev_logオプションがあります。 -そのオプションをyesに設定すると、udevはどのノードにどのルールを適用したかに関するいくつかの役に立つ情報をシステムロガーに出力します。 -そのログ情報は、ほとんどの場合/var/log/messagesにあるでしょう。

                - -さらに、ユーザが作成したいノードのsysfsにおけるパスを調べたいなら、ノードに対しudevがするはずであったことを一つずつ追って確認するために、udevtestを使用できます。 -以下に例を示します。 - -
                # udevtest /sys/class/sound/dsp/
                -version 056
                -looking at '/class/sound/dsp/'
                -opened class_dev->name='dsp'
                -configured rule in '/etc/udev/rules.d/50-udev.rules[132]' applied, added symlink '%k'
                -configured rule in '/etc/udev/rules.d/50-udev.rules[132]' applied, 'dsp' becomes 'sound/%k'
                -creating device node '/dev/sound/dsp', major = '14', minor = '3', mode = '0660', uid = '0', gid = '18'
                - -udevtestは、デバッグ/テストだけをするツールです。たとえ作成しているように表示しても、実際にはデバイスノードを作成しません!

                - - -

                著者と謝辞

                -この文書はDaniel Drake <dan@reactivated.net>
                によって書かれました。 -ご意見ご感想などなんなりと送ってください!

                - -Copyright (C) 2003-2005 Daniel Drake
                -この文書はGNU General Public License, Version 2の下に公開されています。 - - \ No newline at end of file -- cgit v1.2.3-54-g00ecf From de49bbb223a1150991226a60e3171acb29651408 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Dec 2006 10:29:17 +0100 Subject: rename "udev.c" to "test-udev.c" - it is only for testing --- .gitignore | 3 +- Makefile | 2 +- test-udev.c | 184 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/udev-test.pl | 2 +- udev.c | 184 ------------------------------------------------------ 5 files changed, 187 insertions(+), 188 deletions(-) create mode 100644 test-udev.c delete mode 100644 udev.c diff --git a/.gitignore b/.gitignore index 499e9c4d90..db03272a77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,5 @@ *.o *.a -ccdv -udev udevd udevcontrol udevtrigger @@ -12,4 +10,5 @@ udevmonitor udevstart udevtest udev_version.h +test-udev diff --git a/Makefile b/Makefile index b3a5005757..990f00f319 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,6 @@ EXTRAS = V = PROGRAMS = \ - udev \ udevd \ udevtrigger \ udevsettle \ @@ -51,6 +50,7 @@ PROGRAMS = \ udevmonitor \ udevinfo \ udevtest \ + test-udev \ udevstart HEADERS = \ diff --git a/test-udev.c b/test-udev.c new file mode 100644 index 0000000000..bbe50eeeb4 --- /dev/null +++ b/test-udev.c @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" +#include "udev_selinux.h" + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + + if (priority > udev_log_priority) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +static void asmlinkage sig_handler(int signum) +{ + switch (signum) { + case SIGALRM: + exit(1); + case SIGINT: + case SIGTERM: + exit(20 + signum); + } +} + +int main(int argc, char *argv[], char *envp[]) +{ + struct sysfs_device *dev; + struct udevice *udev; + const char *maj, *min; + struct udev_rules rules; + const char *action; + const char *devpath; + const char *subsystem; + struct sigaction act; + int devnull; + int retval = -EINVAL; + + if (argc == 2 && strcmp(argv[1], "-V") == 0) { + printf("%s\n", UDEV_VERSION); + exit(0); + } + + /* set std fd's to /dev/null, /sbin/hotplug forks us, we don't have them at all */ + devnull = open("/dev/null", O_RDWR); + if (devnull >= 0) { + if (devnull != STDIN_FILENO) + dup2(devnull, STDIN_FILENO); + if (devnull != STDOUT_FILENO) + dup2(devnull, STDOUT_FILENO); + if (devnull != STDERR_FILENO) + dup2(devnull, STDERR_FILENO); + if (devnull > STDERR_FILENO) + close(devnull); + } + + logging_init("udev"); + if (devnull < 0) + err("open /dev/null failed: %s", strerror(errno)); + udev_config_init(); + selinux_init(); + dbg("version %s", UDEV_VERSION); + + /* set signal handlers */ + memset(&act, 0x00, sizeof(act)); + act.sa_handler = (void (*)(int)) sig_handler; + sigemptyset (&act.sa_mask); + act.sa_flags = 0; + sigaction(SIGALRM, &act, NULL); + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + + /* trigger timeout to prevent hanging processes */ + alarm(UDEV_ALARM_TIMEOUT); + + action = getenv("ACTION"); + devpath = getenv("DEVPATH"); + subsystem = getenv("SUBSYSTEM"); + /* older kernels passed the SUBSYSTEM only as argument */ + if (subsystem == NULL && argc == 2) + subsystem = argv[1]; + + if (action == NULL || subsystem == NULL || devpath == NULL) { + err("action, subsystem or devpath missing"); + goto exit; + } + + /* export log_priority , as called programs may want to do the same as udev */ + if (udev_log_priority) { + char priority[32]; + + sprintf(priority, "%i", udev_log_priority); + setenv("UDEV_LOG", priority, 1); + } + + sysfs_init(); + udev_rules_init(&rules, 0); + + dev = sysfs_device_get(devpath); + if (dev == NULL) { + info("unable to open '%s'", devpath); + goto fail; + } + + udev = udev_device_init(); + if (udev == NULL) + goto fail; + + /* override built-in sysfs device */ + udev->dev = dev; + strlcpy(udev->action, action, sizeof(udev->action)); + + /* get dev_t from environment, which is needed for "remove" to work, "add" works also from sysfs */ + maj = getenv("MAJOR"); + min = getenv("MINOR"); + if (maj != NULL && min != NULL) + udev->devt = makedev(atoi(maj), atoi(min)); + else + udev->devt = udev_device_get_devt(udev); + + retval = udev_device_event(&rules, udev); + + if (retval == 0 && !udev->ignore_device && udev_run) { + struct name_entry *name_loop; + + dbg("executing run list"); + list_for_each_entry(name_loop, &udev->run_list, node) { + if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) + pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action); + else { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); + run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + } + } + } + + udev_device_cleanup(udev); +fail: + udev_rules_cleanup(&rules); + sysfs_cleanup(); + +exit: + logging_close(); + if (retval != 0) + return 1; + return 0; +} diff --git a/test/udev-test.pl b/test/udev-test.pl index 54c3378392..73d99297d2 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -22,7 +22,7 @@ use strict; my $PWD = $ENV{PWD}; my $sysfs = "sys/"; -my $udev_bin = "../udev"; +my $udev_bin = "../test-udev"; my $udev_root = "udev-root/"; # !!! directory will be removed !!! my $udev_conf = "udev-test.conf"; my $udev_rules = "udev-test.rules"; diff --git a/udev.c b/udev.c deleted file mode 100644 index bbe50eeeb4..0000000000 --- a/udev.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" -#include "udev_selinux.h" - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -static void asmlinkage sig_handler(int signum) -{ - switch (signum) { - case SIGALRM: - exit(1); - case SIGINT: - case SIGTERM: - exit(20 + signum); - } -} - -int main(int argc, char *argv[], char *envp[]) -{ - struct sysfs_device *dev; - struct udevice *udev; - const char *maj, *min; - struct udev_rules rules; - const char *action; - const char *devpath; - const char *subsystem; - struct sigaction act; - int devnull; - int retval = -EINVAL; - - if (argc == 2 && strcmp(argv[1], "-V") == 0) { - printf("%s\n", UDEV_VERSION); - exit(0); - } - - /* set std fd's to /dev/null, /sbin/hotplug forks us, we don't have them at all */ - devnull = open("/dev/null", O_RDWR); - if (devnull >= 0) { - if (devnull != STDIN_FILENO) - dup2(devnull, STDIN_FILENO); - if (devnull != STDOUT_FILENO) - dup2(devnull, STDOUT_FILENO); - if (devnull != STDERR_FILENO) - dup2(devnull, STDERR_FILENO); - if (devnull > STDERR_FILENO) - close(devnull); - } - - logging_init("udev"); - if (devnull < 0) - err("open /dev/null failed: %s", strerror(errno)); - udev_config_init(); - selinux_init(); - dbg("version %s", UDEV_VERSION); - - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = (void (*)(int)) sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - - /* trigger timeout to prevent hanging processes */ - alarm(UDEV_ALARM_TIMEOUT); - - action = getenv("ACTION"); - devpath = getenv("DEVPATH"); - subsystem = getenv("SUBSYSTEM"); - /* older kernels passed the SUBSYSTEM only as argument */ - if (subsystem == NULL && argc == 2) - subsystem = argv[1]; - - if (action == NULL || subsystem == NULL || devpath == NULL) { - err("action, subsystem or devpath missing"); - goto exit; - } - - /* export log_priority , as called programs may want to do the same as udev */ - if (udev_log_priority) { - char priority[32]; - - sprintf(priority, "%i", udev_log_priority); - setenv("UDEV_LOG", priority, 1); - } - - sysfs_init(); - udev_rules_init(&rules, 0); - - dev = sysfs_device_get(devpath); - if (dev == NULL) { - info("unable to open '%s'", devpath); - goto fail; - } - - udev = udev_device_init(); - if (udev == NULL) - goto fail; - - /* override built-in sysfs device */ - udev->dev = dev; - strlcpy(udev->action, action, sizeof(udev->action)); - - /* get dev_t from environment, which is needed for "remove" to work, "add" works also from sysfs */ - maj = getenv("MAJOR"); - min = getenv("MINOR"); - if (maj != NULL && min != NULL) - udev->devt = makedev(atoi(maj), atoi(min)); - else - udev->devt = udev_device_get_devt(udev); - - retval = udev_device_event(&rules, udev); - - if (retval == 0 && !udev->ignore_device && udev_run) { - struct name_entry *name_loop; - - dbg("executing run list"); - list_for_each_entry(name_loop, &udev->run_list, node) { - if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) - pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action); - else { - char program[PATH_SIZE]; - - strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); - } - } - } - - udev_device_cleanup(udev); -fail: - udev_rules_cleanup(&rules); - sysfs_cleanup(); - -exit: - logging_close(); - if (retval != 0) - return 1; - return 0; -} -- cgit v1.2.3-54-g00ecf From 71f178cf2437977ad606e160249f44c73bca87d8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Jan 2007 15:36:04 +0100 Subject: update Fedora rules --- etc/udev/redhat/50-udev.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index 331da6977f..d72cb83472 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -265,7 +265,7 @@ SUBSYSTEM!="block", GOTO="persistent_end" KERNEL=="ram*|loop*|fd*|nbd*|gnbd*", GOTO="persistent_end" # never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", ATTRS{removable}=="1", GOTO="persistent_end" +BUS=="ide", DRIVERS!="ide-cdrom", ATTRS{removable}=="1", GOTO="persistent_end" BUS=="ide", KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_end" # by-id (hardware serial number) -- cgit v1.2.3-54-g00ecf From 2576a836ff78872c4b89e0260bdae504361a2d03 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Jan 2007 15:57:45 +0100 Subject: use git-archive instead of git-tar-tree --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 990f00f319..d34c027452 100644 --- a/Makefile +++ b/Makefile @@ -226,8 +226,8 @@ clean: .PHONY: clean release: - git-tar-tree HEAD udev-$(VERSION) | gzip -9v > udev-$(VERSION).tar.gz - git-tar-tree HEAD udev-$(VERSION) | bzip2 -9v > udev-$(VERSION).tar.bz2 + git-archive --format=tar --prefix=udev-104/ HEAD | gzip -9v > udev-$(VERSION).tar.gz + git-archive --format=tar --prefix=udev-104/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 .PHONY: release install-config: -- cgit v1.2.3-54-g00ecf From 8fdad27d613807a4bfa578e378a4dcae6559399a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Jan 2007 15:58:41 +0100 Subject: release 104 --- ChangeLog | 28 ++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 4 ++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 76fa8aa516..e9e50655ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +Summary of changes from v103 to v104 +============================================ + +Kay Sievers (12): + update Fedora rules + update example rules + update SUSE rules + update SUSE rules + volume_id: fix endianess bug in linux_raid detection + man: fix udevmonitor text + man: recreate from xml + rename config "filename" to "dir" + remove outdated documentation + rename "udev.c" to "test-udev.c" - it is only for testing + update Fedora rules + use git-archive instead of git-tar-tree + +Kazuhiro Inaoka (1): + inotify syscall definitions for M32R + +Marco d'Itri (2): + write_cd_rules: identity-based persistence + scsi_id: remove trailing garbage from ID_SERIAL_SHORT + +Russell Coker (1): + SELinux: label created symlink instead of node + + Summary of changes from v102 to v103 ============================================ diff --git a/Makefile b/Makefile index d34c027452..0ef15df202 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 103 +VERSION = 104 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0e364a30a1..e3aeb68f3e 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 104 +======== +Bugfixes. + udev 103 ======== Add additional check to volume_id detection of via_raid, cause -- cgit v1.2.3-54-g00ecf From 86f4ea067e9667d577a6c4af7f8ac355494eb28e Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Sun, 21 Jan 2007 15:48:58 +0100 Subject: fix INSTALL_PROGRAM vs. INSTALL_SCRIPT --- Makefile | 4 ++-- extras/ata_id/Makefile | 4 ++-- extras/cdrom_id/Makefile | 4 ++-- extras/dasd_id/Makefile | 4 ++-- extras/edd_id/Makefile | 4 ++-- extras/firmware/Makefile | 6 +++--- extras/floppy/Makefile | 4 ++-- extras/path_id/Makefile | 6 +++--- extras/rule_generator/Makefile | 10 +++++----- extras/run_directory/Makefile | 4 ++-- extras/scsi_id/Makefile | 4 ++-- extras/usb_id/Makefile | 4 ++-- extras/volume_id/Makefile | 4 ++-- extras/volume_id/lib/Makefile | 2 +- 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Makefile b/Makefile index 0ef15df202..536467edf3 100644 --- a/Makefile +++ b/Makefile @@ -101,10 +101,10 @@ configdir = ${etcdir}/udev udevdir = /dev DESTDIR = -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} PWD = $(shell pwd) CROSS_COMPILE ?= diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index c55bdac7c4..c9691da1e2 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -20,10 +20,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index d5138c5933..7cd7c1d74a 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -20,10 +20,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile index 627b6cf42f..493c80ef8d 100644 --- a/extras/dasd_id/Makefile +++ b/extras/dasd_id/Makefile @@ -20,10 +20,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 01c2657e20..71cc3dad7c 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -20,10 +20,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index cfc7cd5153..c187b47635 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -17,10 +17,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all @@ -37,7 +37,7 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL_SCRIPT) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 4416559c4a..2044ac56fd 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -20,10 +20,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all diff --git a/extras/path_id/Makefile b/extras/path_id/Makefile index 7884a5ef5a..2f6890cb32 100644 --- a/extras/path_id/Makefile +++ b/extras/path_id/Makefile @@ -17,10 +17,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all @@ -37,7 +37,7 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL_SCRIPT) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: diff --git a/extras/rule_generator/Makefile b/extras/rule_generator/Makefile index 810be24d2b..f023848b0b 100644 --- a/extras/rule_generator/Makefile +++ b/extras/rule_generator/Makefile @@ -17,10 +17,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all @@ -37,9 +37,9 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D rule_generator.functions $(DESTDIR)$(libudevdir)/rule_generator.functions - $(INSTALL_PROGRAM) -D write_cd_rules $(DESTDIR)$(libudevdir)/write_cd_rules - $(INSTALL_PROGRAM) -D write_net_rules $(DESTDIR)$(libudevdir)/write_net_rules + $(INSTALL_SCRIPT) -D rule_generator.functions $(DESTDIR)$(libudevdir)/rule_generator.functions + $(INSTALL_SCRIPT) -D write_cd_rules $(DESTDIR)$(libudevdir)/write_cd_rules + $(INSTALL_SCRIPT) -D write_net_rules $(DESTDIR)$(libudevdir)/write_net_rules $(INSTALL_DATA) -D 75-cd-aliases-generator.rules \ $(DESTDIR)$(configdir)/rules.d/75-cd-aliases-generator.rules $(INSTALL_DATA) -D 75-persistent-net-generator.rules \ diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 6a4e4df5ca..7a72e83dae 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -19,10 +19,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 8ebe7026bb..32b2eaeecf 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -23,10 +23,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index d045a64857..7787161b63 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -20,10 +20,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index a0401b04e8..80f9755d19 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -18,10 +18,10 @@ libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev/ -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL_PROGRAM} +INSTALL_SCRIPT = ${INSTALL} all: $(PROG) $(MAN_PAGES) .PHONY: all diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 1bf7de4aeb..a3e947ceac 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -8,7 +8,7 @@ includedir = ${prefix}/usr/include libdir = ${prefix}/lib usrlibdir = ${prefix}/usr/lib -INSTALL = /usr/bin/install -c +INSTALL = install -c INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 -- cgit v1.2.3-54-g00ecf From bb0f7466a07bfa5968ee2cb25201fba7576dcb2d Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sun, 21 Jan 2007 15:51:28 +0100 Subject: correct typo in extras/scsi_id/scsi_id.conf --- extras/scsi_id/scsi_id.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/scsi_id/scsi_id.config b/extras/scsi_id/scsi_id.config index d1768509ad..d2a10a5f7b 100644 --- a/extras/scsi_id/scsi_id.config +++ b/extras/scsi_id/scsi_id.config @@ -1,7 +1,7 @@ # # scsi_id configuration # -# lower or upper case has no affect on the left side. Quotes (") are +# lower or upper case has no effect on the left side. Quotes (") are # required for spaces in values. Model is the same as the SCSI # INQUIRY product identification field. Per the SCSI INQUIRY, the vendor # is limited to 8 bytes, model to 16 bytes. -- cgit v1.2.3-54-g00ecf From ede9b541712f0f7366f5481d55f5d56d0e47fcc8 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Sun, 21 Jan 2007 22:49:45 +0100 Subject: vol_id: add -L to print raw partition label --- extras/volume_id/vol_id.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 0a1b756fa3..73843ef699 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -116,6 +116,7 @@ int main(int argc, char *argv[]) " -t filesystem type\n" " -l filesystem label\n" " -u filesystem uuid\n" + " -L raw label\n" " --skip-raid don't probe for raid\n" " --probe-all find possibly conflicting signatures\n" " --help\n" @@ -125,6 +126,7 @@ int main(int argc, char *argv[]) PRINT_TYPE, PRINT_LABEL, PRINT_UUID, + PRINT_RAW_LABEL, } print = PRINT_EXPORT; struct volume_id *vid = NULL; static char name[VOLUME_ID_LABEL_SIZE]; @@ -153,6 +155,8 @@ int main(int argc, char *argv[]) print = PRINT_LABEL; } else if (strcmp(arg, "-u") == 0) { print = PRINT_UUID; + } else if (strcmp(arg, "-L") == 0) { + print = PRINT_RAW_LABEL; } else if (strcmp(arg, "--skip-raid") == 0) { skip_raid = 1; } else if (strcmp(arg, "--probe-all") == 0) { @@ -306,6 +310,13 @@ int main(int argc, char *argv[]) } printf("%s\n", vid->uuid); break; + case PRINT_RAW_LABEL: + if (vid->label[0] == '\0' || vid->usage_id == VOLUME_ID_RAID) { + rc = 3; + goto exit; + } + printf("%s\n", vid->label); + break; } exit: -- cgit v1.2.3-54-g00ecf From ff2eecef88733e669ff5a43083534b32b435e2b0 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Sun, 21 Jan 2007 22:51:53 +0100 Subject: udevd: init signal pipe before daemonizing --- udevd.c | 58 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/udevd.c b/udevd.c index 79465a1da0..8c550d38aa 100644 --- a/udevd.c +++ b/udevd.c @@ -1006,6 +1006,35 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + /* setup signal handler pipe */ + retval = pipe(signal_pipe); + if (retval < 0) { + err("error getting pipes: %s", strerror(errno)); + goto exit; + } + + retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); + if (retval < 0) { + err("error fcntl on read pipe: %s", strerror(errno)); + goto exit; + } + retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); + if (retval < 0) { + err("error fcntl on read pipe: %s", strerror(errno)); + goto exit; + } + + retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); + if (retval < 0) { + err("error fcntl on write pipe: %s", strerror(errno)); + goto exit; + } + retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); + if (retval < 0) { + err("error fcntl on write pipe: %s", strerror(errno)); + goto exit; + } + /* parse the rules and keep them in memory */ sysfs_init(); udev_rules_init(&rules, 1); @@ -1062,35 +1091,6 @@ int main(int argc, char *argv[], char *envp[]) close(fd); } - /* setup signal handler pipe */ - retval = pipe(signal_pipe); - if (retval < 0) { - err("error getting pipes: %s", strerror(errno)); - goto exit; - } - - retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); - if (retval < 0) { - err("error fcntl on read pipe: %s", strerror(errno)); - goto exit; - } - retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); - if (retval < 0) { - err("error fcntl on read pipe: %s", strerror(errno)); - goto exit; - } - - retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); - if (retval < 0) { - err("error fcntl on write pipe: %s", strerror(errno)); - goto exit; - } - retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); - if (retval < 0) { - err("error fcntl on write pipe: %s", strerror(errno)); - goto exit; - } - /* set signal handlers */ memset(&act, 0x00, sizeof(struct sigaction)); act.sa_handler = (void (*)(int)) sig_handler; -- cgit v1.2.3-54-g00ecf From 27283c2fdaefd9c7fd557fd4663566eacccca33a Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Mon, 22 Jan 2007 22:27:16 +0100 Subject: vol_id: document -L --- extras/volume_id/vol_id.8 | 9 ++++++++- extras/volume_id/vol_id.xml | 13 ++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index 1d7e1330c0..47837de7b5 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -35,13 +35,20 @@ print the filesystem type .PP \fB\-l\fR .RS 4 -print the label of a volume +print the safe version of volume label suitable for use as filename. Use +\fB\-L\fR +to print literal label .RE .PP \fB\-u\fR .RS 4 print the uuid of a volume .RE +.PP +\fB\-L\fR +.RS 4 +print raw volume label +.RE .SH "ENVIRONMENT" .PP \fBUDEV_LOG\fR diff --git a/extras/volume_id/vol_id.xml b/extras/volume_id/vol_id.xml index b9b35abaa4..2b26b3bddd 100644 --- a/extras/volume_id/vol_id.xml +++ b/extras/volume_id/vol_id.xml @@ -59,7 +59,10 @@ - print the label of a volume + + print the safe version of volume label suitable for + use as filename. Use to print literal label + @@ -68,6 +71,14 @@ print the uuid of a volume + + + + + print raw volume label + + + -- cgit v1.2.3-54-g00ecf From e0c0807ab32fde7f55776e0a300016bad922e636 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Tue, 23 Jan 2007 19:55:38 +0100 Subject: unlink old database file before creating a new one udev_db_add_device() can be called when the corressponding database entry already exists - it should overwrite the old entry in this case. However, if the old entry was a symlink, fopen(filename, "w") will not overwrite it properly - it will keep the symlink and create a file named after the symlink target. Calling unlink(filename) before trying to create the database file fixes the problem. Signed-off-by: Sergey Vlasov --- udev_db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev_db.c b/udev_db.c index f3c9509dcc..b1217d80e1 100644 --- a/udev_db.c +++ b/udev_db.c @@ -93,6 +93,7 @@ int udev_db_add_device(struct udevice *udev) struct name_entry *name_loop; FILE *f; + unlink(filename); f = fopen(filename, "w"); if (f == NULL) { err("unable to create db file '%s': %s", filename, strerror(errno)); -- cgit v1.2.3-54-g00ecf From ca714ef70e549aad486a62f4d6ef849572e3a7f1 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 23 Jan 2007 20:01:30 +0100 Subject: fix retry-loop in netif-rename code --- udev_device.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/udev_device.c b/udev_device.c index bc0b33077e..1eebd61cc5 100644 --- a/udev_device.c +++ b/udev_device.c @@ -122,16 +122,17 @@ static int rename_netif(struct udevice *udev) strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); loop = 30 * 20; while (loop--) { - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval != 0) { - if (errno != EEXIST) { - err("error changing net interface name %s to %s: %s", - ifr.ifr_name, ifr.ifr_newname, strerror(errno)); - break; - } - dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop); - usleep(1000 * 1000 / 20); + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval == 0) + break; + + if (errno != EEXIST) { + err("error changing net interface name %s to %s: %s", + ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + break; } + dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop); + usleep(1000 * 1000 / 20); } } -- cgit v1.2.3-54-g00ecf From 6ff4253618303d8ab77627e4b9afe115604b07f8 Mon Sep 17 00:00:00 2001 From: "A. Costa" Date: Sun, 28 Jan 2007 15:13:36 +0100 Subject: man: fix typos in scsi_id and udevd --- extras/scsi_id/scsi_id.8 | 2 +- udevd.8 | 2 +- udevd.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index ccb8f9d744..86237a7e81 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -95,7 +95,7 @@ the SCSI device. Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83. .sp The default -behaviour is to query the availabe VPD pages, and use page 0x83 if found, +behaviour is to query the available VPD pages, and use page 0x83 if found, else page 0x80 if found, else nothing. .sp Page pre-spc3-83 should only be utilized for those scsi devices which diff --git a/udevd.8 b/udevd.8 index f40a959005..d0655bf48b 100644 --- a/udevd.8 +++ b/udevd.8 @@ -29,7 +29,7 @@ Detach and run in the background. .PP \fB\-\-debug\-trace\fR .RS 4 -Run all events completely serialized. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continiuous operation is needed, where no events are processed in parallel. +Run all events completely serialized. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continuous operation is needed, where no events are processed in parallel. .RE .PP \fB\-\-verbose\fR diff --git a/udevd.xml b/udevd.xml index 938707bee1..fbff8bab97 100644 --- a/udevd.xml +++ b/udevd.xml @@ -53,7 +53,7 @@ Run all events completely serialized. This may be useful if udev triggers - actions or loads kernel modules which cause problems and a slow but continiuous + actions or loads kernel modules which cause problems and a slow but continuous operation is needed, where no events are processed in parallel. -- cgit v1.2.3-54-g00ecf From c0c865d4664ea10309b0ffc12b2fad19ecb98129 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Thu, 1 Feb 2007 20:18:52 +0100 Subject: fix %c $string substitution Fix udev_rules_apply_format() to give error messages for unknown format elements and pass such elements to the output string unmodified. When truncating the substitution string to the length specified in the format string, head[len] = '\0' could write outside the buffer if that length was too large. --- udev_rules.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/udev_rules.c b/udev_rules.c index edaaa71d12..d1c3f042c3 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -364,6 +364,8 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) goto found; } } + head[0] = '$'; + err("unknown format variable '%s'", head); } else if (head[0] == '%') { /* substitute format char */ if (head[1] == '\0') @@ -385,6 +387,8 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) goto found; } } + head[0] = '%'; + err("unknown format char '%c'", tail[0]); } head++; } @@ -554,7 +558,7 @@ found: break; } /* possibly truncate to format-char specified length */ - if (len != -1) { + if (len >= 0 && len < (int)strlen(head)) { head[len] = '\0'; dbg("truncate to %i chars, subtitution string becomes '%s'", len, head); } -- cgit v1.2.3-54-g00ecf From 273bebdba66cd5543dc1b076447e3275c81c221c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 1 Feb 2007 20:23:41 +0100 Subject: exclude parent devices from DRIVER== match We have DRIVERS= for this. --- RELEASE-NOTES | 6 ++++++ udev_rules_parse.c | 15 ++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e3aeb68f3e..39abb7262c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,9 @@ +udev 105 +======== +Bugfixes. DRIVER== will match only for devices that actually have +a driver. DRIVERS== must be used, to include the parent devices +in the match. + udev 104 ======== Bugfixes. diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 3f7e43f839..00b53285fa 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -307,15 +307,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strcasecmp(key, "DRIVER") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid DRIVER operation"); - goto invalid; - } - err("DRIVER== will change in a future relase, " - "please use DRIVERS== in %s:%u", filename, lineno); - /* FIXME: this should be rule->driver to match only the event device */ - add_rule_key(rule, &rule->drivers, operation, value); + add_rule_key(rule, &rule->driver, operation, value); valid = 1; continue; } @@ -369,6 +361,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid ATTRS operation"); + goto invalid; + } attr = get_key_attribute(key + sizeof("ATTRS")-1); if (attr == NULL) { err("error parsing ATTRS attribute"); -- cgit v1.2.3-54-g00ecf From ac77e95948edc199cdd690de38f08e4d1e615840 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Feb 2007 01:12:34 +0100 Subject: volume_id: really fix endianess bug in linux_raid detection Seems we find the md signature in cpu-order on the disk. Let's look for both endian encodings ... Thanks to Michael Prokop for his help finding the bug. --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/linux_raid.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index a3e947ceac..5ad9f2e561 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 74 +SHLIB_REV = 75 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index b8a819f671..a9c5d61adc 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -46,7 +46,8 @@ static struct mdp_super_block { } PACKED *mdp; #define MD_RESERVED_BYTES 0x10000 -#define MD_MAGIC "\xa9\x2b\x4e\xfc" +#define MD_MAGIC "\xfc\x4e\x2b\xa9" +#define MD_MAGIC_SWAP "\xa9\x2b\x4e\xfc" int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) { @@ -65,7 +66,8 @@ int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size return -1; mdp = (struct mdp_super_block *) buf; - if (memcmp(mdp->md_magic, MD_MAGIC, 4) != 0) + if ((memcmp(mdp->md_magic, MD_MAGIC, 4) != 0) && + (memcmp(mdp->md_magic, MD_MAGIC_SWAP, 4) != 0)) return -1; memcpy(uuid, &mdp->set_uuid0, 4); -- cgit v1.2.3-54-g00ecf From 1bcfb137e838a9fa8c607aa2e88b1b1f0716f296 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Feb 2007 01:24:48 +0100 Subject: release 105 --- ChangeLog | 27 +++++++++++++++++++++++++++ Makefile | 6 +++--- RELEASE-NOTES | 10 +++++++--- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9e50655ba..c4b97662d5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +Summary of changes from v104 to v105 +============================================ + +A. Costa (1): + man: fix typos in scsi_id and udevd + +Andrey Borzenkov (2): + vol_id: add -L to print raw partition label + vol_id: document -L + +Kay Sievers (2): + exclude parent devices from DRIVER== match + volume_id: really fix endianess bug in linux_raid detection + +Matthias Schwarzott (2): + correct typo in extras/scsi_id/scsi_id.conf + fix retry-loop in netif-rename code + +Peter Breitenlohner (1): + fix INSTALL_PROGRAM vs. INSTALL_SCRIPT + +Sergey Vlasov (3): + udevd: init signal pipe before daemonizing + unlink old database file before creating a new one + fix %c $string substitution + + Summary of changes from v103 to v104 ============================================ diff --git a/Makefile b/Makefile index 536467edf3..29c2044906 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 104 +VERSION = 105 # set this to make use of syslog USE_LOG = true @@ -226,8 +226,8 @@ clean: .PHONY: clean release: - git-archive --format=tar --prefix=udev-104/ HEAD | gzip -9v > udev-$(VERSION).tar.gz - git-archive --format=tar --prefix=udev-104/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 + git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | gzip -9v > udev-$(VERSION).tar.gz + git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 .PHONY: release install-config: diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 39abb7262c..f4966ac98a 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,8 +1,12 @@ udev 105 ======== -Bugfixes. DRIVER== will match only for devices that actually have -a driver. DRIVERS== must be used, to include the parent devices -in the match. +Bugfixes. + +DRIVER== will match only for devices that actually have a real +driver. DRIVERS== must be used, if parent devices should be +included in the match. + +Libvolume_id's "linux_raid" detection needed another fix. udev 104 ======== -- cgit v1.2.3-54-g00ecf From bba8160f5166264b5cfd120e113a9187b7ed6c46 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 5 Feb 2007 16:03:00 +0100 Subject: man: correct udevinfo --export-db Thanks to: Matthias Schwarzott --- extras/volume_id/vol_id.8 | 2 +- udev.7 | 2 +- udevd.8 | 2 +- udevinfo.8 | 4 ++-- udevinfo.xml | 2 +- udevmonitor.8 | 2 +- udevsettle.8 | 2 +- udevstart.8 | 2 +- udevtest.8 | 2 +- udevtrigger.8 | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index 47837de7b5..bb248a45e0 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -1,6 +1,6 @@ .\" Title: vol_id .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: March 2006 .\" Manual: vol_id .\" Source: volume_id diff --git a/udev.7 b/udev.7 index 825f74efd8..207214821d 100644 --- a/udev.7 +++ b/udev.7 @@ -1,6 +1,6 @@ .\" Title: udev .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: August 2005 .\" Manual: udev .\" Source: udev diff --git a/udevd.8 b/udevd.8 index d0655bf48b..858e9aab6b 100644 --- a/udevd.8 +++ b/udevd.8 @@ -1,6 +1,6 @@ .\" Title: udevd .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: August 2005 .\" Manual: udevd, udevcontrol .\" Source: udev diff --git a/udevinfo.8 b/udevinfo.8 index c22ddfd4bc..7a1680cc53 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -1,6 +1,6 @@ .\" Title: udevinfo .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: August 2005 .\" Manual: udevinfo .\" Source: udev @@ -59,7 +59,7 @@ query, the query returns the absolute path including the root directory. Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules. .RE .PP -\fB\-\-export\fR +\fB\-\-export\-db\fR .RS 4 Export the content of the udev database. .RE diff --git a/udevinfo.xml b/udevinfo.xml index 77432f9c8d..1d44d4082b 100644 --- a/udevinfo.xml +++ b/udevinfo.xml @@ -84,7 +84,7 @@ - + Export the content of the udev database. diff --git a/udevmonitor.8 b/udevmonitor.8 index 1fbf01e615..205030fbc0 100644 --- a/udevmonitor.8 +++ b/udevmonitor.8 @@ -1,6 +1,6 @@ .\" Title: udevmonitor .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: August 2005 .\" Manual: udevmonitor .\" Source: udev diff --git a/udevsettle.8 b/udevsettle.8 index 0e463bd902..818a7ff1aa 100644 --- a/udevsettle.8 +++ b/udevsettle.8 @@ -1,6 +1,6 @@ .\" Title: udevsettle .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: March 2006 .\" Manual: udevsettle .\" Source: udev diff --git a/udevstart.8 b/udevstart.8 index c8a7c6fb4f..ac7d070c91 100644 --- a/udevstart.8 +++ b/udevstart.8 @@ -1,6 +1,6 @@ .\" Title: udevstart .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: August 2005 .\" Manual: udevstart .\" Source: udev diff --git a/udevtest.8 b/udevtest.8 index cf6057ef87..9ab92497f6 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -1,6 +1,6 @@ .\" Title: udevtest .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: August 2005 .\" Manual: udevtest .\" Source: udev diff --git a/udevtrigger.8 b/udevtrigger.8 index 957deccad5..58a379495f 100644 --- a/udevtrigger.8 +++ b/udevtrigger.8 @@ -1,6 +1,6 @@ .\" Title: udevtrigger .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.71.1 +.\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: March 2006 .\" Manual: udevtrigger .\" Source: udev -- cgit v1.2.3-54-g00ecf From 5ab2e3c2c3efe9b25861ddf560b3760b9384090d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 5 Feb 2007 16:15:52 +0100 Subject: path_id: append LUN to iSCSI path --- extras/path_id/path_id | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 44754cdedd..8927d84ffb 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -332,6 +332,7 @@ handle_iscsi() { local iscsi_session_dir local iscsi_session iscsi_session_path local iscsi_connection iscsi_connection_path + local iscsi_scsi_lun # iSCSI device iscsi_session_dir="${DEV%%/target*}" iscsi_session="${iscsi_session_dir##*/}" @@ -378,7 +379,8 @@ handle_iscsi() { if [ -e "${iscsi_connection_path}/persistent_port" ] ; then read iscsi_port < ${iscsi_connection_path}/persistent_port fi - d="ip-${iscsi_address}:${iscsi_port}-iscsi-${iscsi_tgtname}" + iscsi_scsi_lun="${DEV##*:}" + d="ip-${iscsi_address}:${iscsi_port}-iscsi-${iscsi_tgtname}-lun-${iscsi_scsi_lun}" RESULT=0 } -- cgit v1.2.3-54-g00ecf From e5f76f66138d8ef50d04034dcd4d3272eb00b740 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Feb 2007 22:29:03 +0100 Subject: create_floppy_devices: add option for owner/group --- extras/floppy/create_floppy_devices.c | 82 ++++++++++++++++++++++++++++------- udev_selinux.c | 3 +- 2 files changed, 68 insertions(+), 17 deletions(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 91d3a58195..7b61ef05b1 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -21,6 +21,11 @@ #include #include #include +#include +#include + +#include "../../udev.h" +#include "../../udev_selinux.h" static char *table[] = { "", "d360", "h1200", "u360", "u720", "h360", "h720", @@ -34,8 +39,32 @@ static char *table[] = { static int t360[] = { 1, 0 }; static int t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 }; static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, 17, 21, 22, 30, 0 }; +static int *table_sup[] = { NULL, t360, t1200, t3in+5+8, t3in+5, t3in, t3in }; + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + } -static int *table_sup[] = { NULL, t360, t1200, t3in + 5 + 8, t3in + 5, t3in, t3in }; + if (priority > udev_log) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif int main(int argc, char **argv) { @@ -43,33 +72,42 @@ int main(int argc, char **argv) char node[64]; int type = 0, i, fdnum, c; int major = 2, minor; - int mode = 0; + uid_t uid = 0; + gid_t gid = 0; + mode_t mode = 0; int create_nodes = 0; int print_nodes = 0; int unlink_nodes = 0; int is_err = 0; - while ((c = getopt(argc, argv, "cdm:M:t:u")) != -1) { + while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { switch (c) { case 'c': create_nodes = 1; unlink_nodes = 0; break; + case 'u': + unlink_nodes = 1; + create_nodes = 0; + break; case 'd': print_nodes = 1; break; + case 'U': + uid = lookup_user(optarg); + break; + case 'G': + gid = lookup_group(optarg); + break; case 'M': - mode = strtol(optarg, NULL, 10); + mode = strtol(optarg, NULL, 0); + mode = mode & 0666; break; case 'm': - major = strtol(optarg, NULL, 10); + major = strtol(optarg, NULL, 0); break; case 't': - type = strtol(optarg, NULL, 10); - break; - case 'u': - unlink_nodes = 1; - create_nodes = 0; + type = strtol(optarg, NULL, 0); break; default: is_err++; @@ -78,8 +116,15 @@ int main(int argc, char **argv) } if (is_err || optind >= argc) { - fprintf(stderr,"Usage: %s [-d|-c|-u|-m |-t ] \n", - argv[0]); + printf("Usage: %s [OPTION] device\n" + " -c create\n" + " -d debug\n" + " -m Major number\n" + " -t floppy type number\n" + " -U device node user ownership\n" + " -G device node group owner\n" + " -M device node mode\n" + "\n", argv[0]); return 1; } @@ -110,17 +155,24 @@ int main(int argc, char **argv) if (type == 0) return 0; + selinux_init(); + i = 0; while (table_sup[type][i]) { - sprintf(node, "%s%s",dev, table[table_sup[type][i]]); + sprintf(node, "%s%s", dev, table[table_sup[type][i]]); minor = (table_sup[type][i] << 2) + fdnum; if (print_nodes) printf("%s b %d %d %d\n", node, mode, major, minor); - if (create_nodes) + if (create_nodes) { + unlink(node); + selinux_setfscreatecon(node, NULL, mode); mknod(node, S_IFBLK | mode, makedev(major,minor)); + selinux_resetfscreatecon(); + chown(node, uid, gid); + } i++; } + selinux_exit(); return 0; } - diff --git a/udev_selinux.c b/udev_selinux.c index a305e24136..42568e4195 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -90,8 +90,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode char *media; int ret = -1; - if(devname) - { + if (devname) { media = get_media(devname, mode); if (media) { ret = matchmediacon(media, &scontext); -- cgit v1.2.3-54-g00ecf From 1a4144498aaf4a457d3dd03c25ccb9b8e1f848c7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Feb 2007 22:39:39 +0100 Subject: update example rules --- etc/udev/redhat/50-udev.rules | 47 +++++++++++++++------------- etc/udev/rules.d/60-persistent-storage.rules | 3 ++ etc/udev/suse/50-udev-default.rules | 4 +-- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index d72cb83472..6dc8768f85 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -68,6 +68,9 @@ KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" KERNEL=="nvram", MODE="0660" KERNEL=="rtc", MODE="0644" +# pnp devices +ACTION=="add", SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe pnp:d$$id; done < /sys/$devpath/id'" + # floppy devices KERNEL=="fd[01]*", GROUP="floppy", MODE="0660" # fix floppy devices @@ -75,6 +78,8 @@ KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M /dev/%k" KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f /dev/%k*'" +BUS=="usb", KERNEL=="sd*", SYSFS{bInterfaceClass}=="08", SYSFS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", SYMLINK+="floppy floppy-%k" + # audio devices KERNEL=="dsp*", MODE="0660" KERNEL=="audio*", MODE="0660" @@ -100,6 +105,8 @@ KERNEL=="usblp*", GROUP="lp", MODE="0660" KERNEL=="usb/lp*", GROUP="lp", MODE="0660" # tape devices +SUBSYSTEM=="ide", SYSFS{media}=="tape", ACTION=="add", \ + RUN+="modprobe ide-scsi idescsi_nocd=1" KERNEL=="ht*", GROUP="disk", MODE="0660" KERNEL=="nht*", GROUP="disk", MODE="0660" KERNEL=="pt[0-9]*", GROUP="disk", MODE="0660" @@ -157,7 +164,7 @@ KERNEL=="dvb", MODE="0660" SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", \ NAME="%c", MODE="0660" -KERNEL=="dm-[0-9]*", OPTIONS+="ignore_device" +KERNEL=="dm-[0-9]*", ACTION=="add", OPTIONS+="ignore_device" # alsa devices KERNEL=="controlC[0-9]*", NAME="snd/%k" @@ -173,6 +180,7 @@ KERNEL=="mouse*", NAME="input/%k" KERNEL=="event*", NAME="input/%k" KERNEL=="js*", NAME="input/%k", SYMLINK+="%k" KERNEL=="ts*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" # IEEE1394 (firewire) devices (must be before raw devices below) KERNEL=="raw1394", NAME="%k" @@ -212,15 +220,9 @@ KERNEL=="device-mapper", NAME="mapper/control" KERNEL=="sr[0-9]*", SYMLINK+="cdrom cdrom-%k" KERNEL=="scd[0-9]*", SYMLINK+="cdrom cdrom-%k" KERNEL=="pcd[0-9]*", SYMLINK+="cdrom cdrom-%k" -KERNEL=="fd[0-9]*", SYMLINK+="floppy-%k" -KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK+="tape-%k", MODE="0660" -KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK+="tape-%k", MODE="0660" - -KERNEL=="umad*", NAME="infiniband/%k", MODE="0660" -KERNEL=="issm*", NAME="infiniband/%k", MODE="0660" -KERNEL=="uverbs*", NAME="infiniband/%k", MODE="0660" -KERNEL=="ucm*", NAME="infiniband/%k", MODE="0660" -KERNEL=="rdma_cm", NAME="infiniband/%k", MODE="0660" +KERNEL=="fd[0-9]*", SYMLINK+="floppy floppy-%k" +KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK+="tape tape-%k", MODE="0660" +KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK+="tape tape-%k", MODE="0660" # Section for zaptel device KERNEL=="zapctl", NAME="zap/ctl" @@ -231,9 +233,10 @@ KERNEL=="zap[0-9]*", NAME="zap/%n" KERNEL=="pktcdvd", NAME="%k/control" -KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", \ - ATTRS{media}=="floppy", \ +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", \ + ATTR{media}=="floppy", \ SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions" +KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", SYMLINK+="floppy-%k" KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", ATTRS{media}=="cdrom", SYMLINK+="cdrom cdrom-%k" @@ -265,8 +268,8 @@ SUBSYSTEM!="block", GOTO="persistent_end" KERNEL=="ram*|loop*|fd*|nbd*|gnbd*", GOTO="persistent_end" # never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVERS!="ide-cdrom", ATTRS{removable}=="1", GOTO="persistent_end" -BUS=="ide", KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_end" +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_end" +KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_end" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode" @@ -312,7 +315,7 @@ ACTION=="add", SUBSYSTEM=="usb_device", \ PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ NAME="%c", MODE="0644" -ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" +ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="modprobe $env{MODALIAS}" ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" @@ -326,11 +329,11 @@ ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="1", \ RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="/sbin/modprobe sg" +ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="modprobe sg" ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \ - RUN+="/sbin/modprobe sd_mod" + RUN+="modprobe sd_mod" ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \ - RUN+="/sbin/modprobe sr_mod" + RUN+="modprobe sr_mod" ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="[36]", \ SYMLINK+="scanner scanner-%k", MODE="0660" @@ -339,14 +342,14 @@ ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", \ SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst" + ATTRS{model}!="ADR*", RUN+="modprobe osst" ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}=="ADR*", RUN+="/sbin/modprobe st" + ATTRS{model}=="ADR*", RUN+="modprobe st" ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}!="On[sS]tream", \ - RUN+="/sbin/modprobe st" + RUN+="modprobe st" # mmc block devices -ACTION=="add", SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +ACTION=="add", SUBSYSTEM=="mmc", RUN+="modprobe mmc_block" RUN+="socket:/org/kernel/udev/monitor" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 1a25560163..a0cb8caa68 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -28,6 +28,9 @@ KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + # by-path (shortest physical path) KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index bf1fbdd599..74a8def6f5 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -92,7 +92,7 @@ KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" # fix floppy devices KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" -KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M $root/%k" +KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G disk $root/%k" KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/rm -f $root/%k*" # block devices @@ -123,7 +123,7 @@ KERNEL=="pt*|npt*", GROUP="disk" KERNEL=="pg*", GROUP="disk" KERNEL=="evms/block_device*", GROUP="disk" KERNEL=="rawctl*", NAME="raw/%k", GROUP="disk" -SUBSYSTEM=="block", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="osst*|nosst*", NAME="%k", GROUP="disk" KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" -- cgit v1.2.3-54-g00ecf From 6e82f66ea263d432e483505566f8f13ae83f3ac5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Feb 2007 13:20:34 +0100 Subject: apply format chars to ATTR before writing to sysfs --- udev_rules.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index d1c3f042c3..200b4e7024 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -842,18 +842,20 @@ try_parent: if (pair->key.operation == KEY_OP_ASSIGN) { const char *key_name = key_pair_name(rule, pair); - const char *key_value = key_val(rule, &pair->key); char attr[PATH_SIZE]; + char value[NAME_SIZE]; FILE *f; strlcpy(attr, sysfs_path, sizeof(attr)); strlcat(attr, udev->dev->devpath, sizeof(attr)); strlcat(attr, "/", sizeof(attr)); strlcat(attr, key_name, sizeof(attr)); - dbg("write '%s' to '%s'", key_value, attr); + strlcpy(value, key_val(rule, &pair->key), sizeof(value)); + udev_rules_apply_format(udev, value, sizeof(value)); + info("writing '%s' to sysfs file '%s'", value, attr); f = fopen(attr, "w"); if (f != NULL) { - if (fprintf(f, "%s\n", key_value) <= 0) + if (fprintf(f, "%s", value) <= 0) err("error writing ATTR{%s}: %s", attr, strerror(errno)); fclose(f); } else -- cgit v1.2.3-54-g00ecf From 8f4bc5f1df8699761bdc09b954fc6c86aee0ce89 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Feb 2007 13:57:08 +0100 Subject: add (subsystem) to udevmonitor output --- udevmonitor.c | 46 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/udevmonitor.c b/udevmonitor.c index 35c3721f76..89053185e0 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -106,6 +106,26 @@ static void asmlinkage sig_handler(int signum) udev_exit = 1; } +static const char *search_key(const char *searchkey, const char *buf, size_t buflen) +{ + size_t bufpos = 0; + size_t searchkeylen = strlen(searchkey); + + while (bufpos < buflen) { + const char *key; + int keylen; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + if ((strncmp(searchkey, key, searchkeylen) == 0) && key[searchkeylen] == '=') + return &key[searchkeylen + 1]; + bufpos += keylen + 1; + } + return NULL; +} + int main(int argc, char *argv[]) { struct sigaction act; @@ -156,10 +176,14 @@ int main(int argc, char *argv[]) while (!udev_exit) { char buf[UEVENT_BUFFER_SIZE*2]; ssize_t buflen; + ssize_t bufpos; + ssize_t keys; int fdcount; struct timeval tv; struct timezone tz; char timestr[64]; + const char *source = NULL; + const char *devpath, *action, *subsys; buflen = 0; FD_ZERO(&readfds); @@ -183,33 +207,35 @@ int main(int argc, char *argv[]) if ((uevent_netlink_sock >= 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); - if (buflen <= 0) { + if (buflen <= 0) { fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); continue; } - printf("UEVENT[%s] %s\n", timestr, buf); + source = "UEVENT"; } if ((udev_monitor_sock >= 0) && FD_ISSET(udev_monitor_sock, &readfds)) { buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); - if (buflen <= 0) { + if (buflen <= 0) { fprintf(stderr, "error receiving udev message: %s\n", strerror(errno)); continue; } - printf("UDEV [%s] %s\n", timestr, buf); + source = "UDEV "; } if (buflen == 0) continue; + keys = strlen(buf) + 1; /* start of payload */ + devpath = search_key("DEVPATH", &buf[keys], buflen); + action = search_key("ACTION", &buf[keys], buflen); + subsys = search_key("SUBSYSTEM", &buf[keys], buflen); + printf("%s[%s] %-8s %s (%s)\n", source, timestr, action, devpath, subsys); + /* print environment */ + bufpos = keys; if (env) { - size_t bufpos; - - /* start of payload */ - bufpos = strlen(buf) + 1; - - while (bufpos < (size_t)buflen) { + while (bufpos < buflen) { int keylen; char *key; -- cgit v1.2.3-54-g00ecf From 915fde17387f7245164fbda21a0f5bbc185f7dc2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 24 Feb 2007 23:43:04 +0100 Subject: update DRIVER== changes --- TODO | 4 ---- extras/volume_id/vol_id.c | 3 ++- udev_rules_parse.c | 5 +++++ 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index f64273cab4..7afef5fe9d 100644 --- a/TODO +++ b/TODO @@ -4,10 +4,6 @@ These things would be nice to have: any of the links at that time These things will change in future udev versions: - o make DRIVER== to match only the event device - (DRIVERS must be used, we currently translate it to DRIVERS and print - a warning if DRIVER is used) - o warn if BUS, ID, SYSFS are used as keys (they are SUBSYSTEMS, KERNELS, ATTRS now) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 73843ef699..92f00e0c50 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -188,7 +188,8 @@ int main(int argc, char *argv[]) /* try to drop all privileges before reading disk content */ pw = getpwnam ("nobody"); if (pw != NULL && pw->pw_uid > 0 && pw->pw_gid > 0) { - dbg("dropping privileges to %u:%u", (unsigned int)pw->pw_uid, (unsigned int)pw->pw_gid); + dbg("dropping privileges to %u:%u", + (unsigned int)pw->pw_uid, (unsigned int)pw->pw_gid); if (setgroups(0, NULL) != 0 || setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) { diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 00b53285fa..8ef5ffee46 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -307,6 +307,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strcasecmp(key, "DRIVER") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid DRIVER operation"); + goto invalid; + } add_rule_key(rule, &rule->driver, operation, value); valid = 1; continue; -- cgit v1.2.3-54-g00ecf From 841e168c76403c058437bceda4e679dd7c82ae79 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sat, 24 Feb 2007 23:43:36 +0100 Subject: add option --version to udevd --- udevd.8 | 7 ++++++- udevd.c | 8 ++++++-- udevd.xml | 7 +++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/udevd.8 b/udevd.8 index 858e9aab6b..d21f1d754c 100644 --- a/udevd.8 +++ b/udevd.8 @@ -14,7 +14,7 @@ udevd \- event managing daemon .SH "SYNOPSIS" .HP 6 -\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-verbose\fR] [\fB\-\-help\fR] +\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-verbose\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] .HP 20 \fBudevcontrol \fR\fB\fIcommand\fR\fR .SH "DESCRIPTION" @@ -37,6 +37,11 @@ Run all events completely serialized. This may be useful if udev triggers action Print log messages to stdout. .RE .PP +\fB\-\-version\fR +.RS 4 +Print version number. +.RE +.PP \fB\-\-help\fR .RS 4 Print usage. diff --git a/udevd.c b/udevd.c index 8c550d38aa..23f5fd6980 100644 --- a/udevd.c +++ b/udevd.c @@ -943,6 +943,7 @@ int main(int argc, char *argv[], char *envp[]) { "debug-trace", 0, NULL, 't' }, { "verbose", 0, NULL, 'v' }, { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, {} }; int rc = 1; @@ -955,7 +956,7 @@ int main(int argc, char *argv[], char *envp[]) /* parse commandline options */ while (1) { - option = getopt_long(argc, argv, "dtvh", options, NULL); + option = getopt_long(argc, argv, "dtvhV", options, NULL); if (option == -1) break; @@ -972,7 +973,10 @@ int main(int argc, char *argv[], char *envp[]) udev_log_priority = LOG_INFO; break; case 'h': - printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--verbose]\n"); + printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--verbose] [--version]\n"); + goto exit; + case 'V': + printf("%s\n", UDEV_VERSION); goto exit; default: goto exit; diff --git a/udevd.xml b/udevd.xml index fbff8bab97..84182884b6 100644 --- a/udevd.xml +++ b/udevd.xml @@ -28,6 +28,7 @@ + @@ -64,6 +65,12 @@ Print log messages to stdout. + + + + Print version number. + + -- cgit v1.2.3-54-g00ecf From 4e13cb5fb7c4b28c89c29437c9d1fbf2dbf372fc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 24 Feb 2007 23:57:04 +0100 Subject: remove --version from the udevinfo man page We have: udevd --version now, which is always available, unlike udevinfo which is installed in /usr. --- udevinfo.8 | 4 ++-- udevinfo.c | 1 - udevinfo.xml | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/udevinfo.8 b/udevinfo.8 index 7a1680cc53..a6ab1bbf0b 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -11,10 +11,10 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -udevinfo \- query device information from the udev database +udevinfo \- query udev device information .SH "SYNOPSIS" .HP 9 -\fBudevinfo\fR [\fB\-\-query=\fR\fB\fIquery\-type\fR\fR] [\fB\-\-path=\fR\fB\fIdevpath\fR\fR] [\fB\-\-name=\fR\fB\fInode\fR\fR] [\fB\-\-root\fR] [\fB\-\-attribute\-walk\fR] [\fB\-\-export\-db\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] +\fBudevinfo\fR [\fB\-\-query=\fR\fB\fIquery\-type\fR\fR] [\fB\-\-path=\fR\fB\fIdevpath\fR\fR] [\fB\-\-name=\fR\fB\fInode\fR\fR] [\fB\-\-root\fR] [\fB\-\-attribute\-walk\fR] [\fB\-\-export\-db\fR] [\fB\-\-help\fR] .SH "DESCRIPTION" .PP udevinfo queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device. diff --git a/udevinfo.c b/udevinfo.c index 0551eb2e32..ef4750dbf4 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -308,7 +308,6 @@ int main(int argc, char *argv[], char *envp[]) " --root prepend to query result or print udev_root\n" " --attribute-walk print all SYSFS_attributes along the device chain\n" " --export-db export the content of the udev database\n" - " --version print udev version\n" " --help print this text\n" "\n"); goto exit; diff --git a/udevinfo.xml b/udevinfo.xml index 1d44d4082b..82de79f6d8 100644 --- a/udevinfo.xml +++ b/udevinfo.xml @@ -19,7 +19,8 @@ - udevinfoquery device information from the udev database + udevinfo + query udev device information @@ -31,7 +32,6 @@ - -- cgit v1.2.3-54-g00ecf From 7db33ac19c430c9a4c4af415e2febbd6b17aff2a Mon Sep 17 00:00:00 2001 From: "Theodoros V. Kalamatianos" Date: Sun, 25 Feb 2007 01:04:23 +0100 Subject: fix udev attribute names with a colon --- udev_rules_parse.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 8ef5ffee46..5ce91df383 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -104,12 +104,9 @@ static int get_key(char **line, char **key, enum key_operation *operation, char break; if (linepos[0] == '=') break; - if (linepos[0] == '+') - break; - if (linepos[0] == '!') - break; - if (linepos[0] == ':') - break; + if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) + if (linepos[1] == '=') + break; } /* remember end of key */ -- cgit v1.2.3-54-g00ecf From 864b9b5e37b5e480d0e23507d4dd8360525ad453 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Feb 2007 01:06:20 +0100 Subject: add test for an attribute which contains an operator char --- TODO | 2 ++ test/sys/block/sda/test:colon+plus | 1 + test/udev-test.pl | 11 ++++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 test/sys/block/sda/test:colon+plus diff --git a/TODO b/TODO index 7afef5fe9d..5d5a058e98 100644 --- a/TODO +++ b/TODO @@ -3,10 +3,12 @@ These things would be nice to have: to syslog, so any error logged from the kernel can be associated with any of the links at that time + These things will change in future udev versions: o warn if BUS, ID, SYSFS are used as keys (they are SUBSYSTEMS, KERNELS, ATTRS now) + These things are deprecated and scheduled for removal in a future udev version: o remove old udevdb dump 'udevinfo -d' diff --git a/test/sys/block/sda/test:colon+plus b/test/sys/block/sda/test:colon+plus new file mode 100644 index 0000000000..0fed9a5d60 --- /dev/null +++ b/test/sys/block/sda/test:colon+plus @@ -0,0 +1 @@ +colon diff --git a/test/udev-test.pl b/test/udev-test.pl index 73d99297d2..36cbe8ac75 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1556,8 +1556,17 @@ EOF devpath => "/block/sda/sda1", exp_name => "yes", rules => < "operator chars in attribute", + subsys => "block", + devpath => "/block/sda", + exp_name => "yes", + rules => < Date: Sun, 25 Feb 2007 01:26:53 +0100 Subject: man: add note about parent matching behavior --- udev.7 | 13 ++++++++++--- udev.xml | 22 +++++++++++++--------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/udev.7 b/udev.7 index 207214821d..7dd3c1f2b7 100644 --- a/udev.7 +++ b/udev.7 @@ -57,7 +57,9 @@ and .PP The udev rules are read from the files located in the \fI/etc/udev/rules.d\fR -directory or at the location specified value in the configuration file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. +directory or at the location specified value in the configuration file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. +.PP +A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. .PP A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: .PP @@ -86,7 +88,7 @@ Add the value to a key that holds a list of entries. Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules. .RE .PP -The following key names can be used to match against device properties: +The following key names can be used to match against device properties. Some of the keys also match against properties of the parent devices in sysfs, not only the device that has generated the event. If multiple keys that match a parent device are specified in a single rule, all these keys must match at one and the same parent device. .PP \fBACTION\fR .RS 4 @@ -108,6 +110,11 @@ Match the name of the event device. Match the subsystem of the event device. .RE .PP +\fBDRIVER\fR +.RS 4 +Match the driver name of the event device. Only set for devices which are bound to a driver at the time the event is generated. +.RE +.PP \fBATTR{\fR\fB\fIfilename\fR\fR\fB}\fR .RS 4 Match sysfs attribute values of the event device. Up to five @@ -134,7 +141,7 @@ Search the devpath upwards for a matching device driver name. .RS 4 Search the devpath upwards for a device with matching sysfs attribute values. Up to five \fBATTRS\fR -keys can be specified per rule. All attributes must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. +keys can be specified per rule, but all of them must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. .RE .PP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR diff --git a/udev.xml b/udev.xml index 5e5388da51..68edb8fb99 100644 --- a/udev.xml +++ b/udev.xml @@ -84,10 +84,11 @@ value in the configuration file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the - assign keys get the specified value assigned. A matching rule may specify the - name of the device node, add a symlink pointing to the node, or run a specified - program as part of the event handling. If no matching rule is found, the default - device node name is used. + assign keys get the specified value assigned. + + A matching rule may specify the name of the device node, add a symlink + pointing to the node, or run a specified program as part of the event handling. + If no matching rule is found, the default device node name is used. A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid @@ -131,7 +132,11 @@ - The following key names can be used to match against device properties: + The following key names can be used to match against device properties. + Some of the keys also match against properties of the parent devices in sysfs, + not only the device that has generated the event. If multiple keys that match + a parent device are specified in a single rule, all these keys must match at + one and the same parent device. @@ -160,14 +165,13 @@ Match the subsystem of the event device. - @@ -205,7 +209,7 @@ Search the devpath upwards for a device with matching sysfs attribute values. - Up to five keys can be specified per rule. All attributes + Up to five keys can be specified per rule, but all of them must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. -- cgit v1.2.3-54-g00ecf From 58310f6698b69e78a782e2caa7c1c5d34ebdd1b5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Feb 2007 22:14:14 +0100 Subject: scsi_id: accept tabs in /etc/scsi_id.conf --- extras/scsi_id/scsi_id.8 | 2 +- extras/scsi_id/scsi_id.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 86237a7e81..ba7e42f8c7 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -154,7 +154,7 @@ of 312345: .sp .nf -BUS=="scsi", PROGRAM=="/sbin/scsi_id -d %N -s %p", RESULT=="312345", NAME="disk%n" +SUBSYSTEMS=="scsi", PROGRAM=="/sbin/scsi_id -d %N -s %p", RESULT=="312345", NAME="disk%n" .fi .P diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 7fd6066c01..c00145f30e 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -377,11 +377,11 @@ static int get_file_options(const char *vendor, const char *model, /* * argv[0] at 0 is skipped by getopt, but * store the buffer address there for - * alter freeing. + * later freeing */ (*newargv)[c] = buffer; for (c = 1; c < *argc; c++) - (*newargv)[c] = strsep(&buffer, " "); + (*newargv)[c] = strsep(&buffer, " \t"); } } else { /* No matches */ -- cgit v1.2.3-54-g00ecf From 1f889fb84fa14d1e7e3c2a1a3bc5e0df5c6fba23 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Mon, 26 Feb 2007 15:07:42 +0100 Subject: rule_generator: fix for creating rules on read-only filesystem --- extras/rule_generator/rule_generator.functions | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index 14c585a86a..712ed269e0 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -92,7 +92,6 @@ find_all_rules() { local linkre="$2" local match="$3" - [ -e $RULES_FILE ] || return local search='.*[[:space:],]'"$key"'"\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$' echo $(sed -n -e "${match}s/${search}/\1/p" $RO_RULES_FILE $RULES_FILE) } -- cgit v1.2.3-54-g00ecf From 0fe4cffde6628b54af6163b2fc253fb9bc556ded Mon Sep 17 00:00:00 2001 From: Jamie Wellnitz Date: Tue, 27 Feb 2007 21:02:07 +0100 Subject: persistent device naming: tape devices and medium changers This adds persistent symlinks for nst tape devices to the example rules. The symlinks live under /dev/tape/by-id/. Signed-off-by: Jamie Wellnitz --- etc/udev/rules.d/60-persistent-storage.rules | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index a0cb8caa68..ef9cb3f28b 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -2,6 +2,19 @@ # scheme based on "Linux persistent device names", 2004, Hannes Reinecke ACTION!="add", GOTO="persistent_storage_end" +ACTION!="add", GOTO="persistent_tape_end" + +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" + +# type 8 devices are "Medium Changers" +KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +LABEL="persistent_tape_end" + SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices @@ -26,7 +39,6 @@ KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From 0ef409f6ca59495b76aa002ce149e00f80f058d3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 28 Feb 2007 17:26:05 +0100 Subject: remove dead rule in persistent tape rules Thanks to Matthias Schwarzott for spotting this. --- etc/udev/rules.d/60-persistent-storage.rules | 3 --- 1 file changed, 3 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index ef9cb3f28b..252bf6eaab 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -2,7 +2,6 @@ # scheme based on "Linux persistent device names", 2004, Hannes Reinecke ACTION!="add", GOTO="persistent_storage_end" -ACTION!="add", GOTO="persistent_tape_end" KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" @@ -13,8 +12,6 @@ KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{ KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -LABEL="persistent_tape_end" - SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -- cgit v1.2.3-54-g00ecf From 159ba1c5314b160d7036009eac690fe399c7917d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Mar 2007 18:42:09 +0100 Subject: release 106 --- ChangeLog | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c4b97662d5..135db2b38d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,54 @@ Summary of changes from v104 to v105 ============================================ +A. Costa (1): + man: fix typos in scsi_id and udevd + +Andrey Borzenkov (2): + vol_id: add -L to print raw partition label + vol_id: document -L + +Jamie Wellnitz (1): + persistent device naming: tape devices and medium changers + +Kay Sievers (15): + exclude parent devices from DRIVER== match + volume_id: really fix endianess bug in linux_raid detection + release 105 + man: correct udevinfo --export-db + path_id: append LUN to iSCSI path + create_floppy_devices: add option for owner/group + update example rules + apply format chars to ATTR before writing to sysfs + add (subsystem) to udevmonitor output + update DRIVER== changes + remove --version from the udevinfo man page + add test for an attribute which contains an operator char + man: add note about parent matching behavior + scsi_id: accept tabs in /etc/scsi_id.conf + remove dead rule in persistent tape rules + +Matthias Schwarzott (4): + correct typo in extras/scsi_id/scsi_id.conf + fix retry-loop in netif-rename code + add option --version to udevd + rule_generator: fix for creating rules on read-only filesystem + +Peter Breitenlohner (1): + fix INSTALL_PROGRAM vs. INSTALL_SCRIPT + +Sergey Vlasov (3): + udevd: init signal pipe before daemonizing + unlink old database file before creating a new one + fix %c $string substitution + +Theodoros V. Kalamatianos (1): + fix udev attribute names with a colon + + +Summary of changes from v104 to v105 +============================================ + A. Costa (1): man: fix typos in scsi_id and udevd diff --git a/Makefile b/Makefile index 29c2044906..97c3528037 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 105 +VERSION = 106 # set this to make use of syslog USE_LOG = true -- cgit v1.2.3-54-g00ecf From 88caa9da18841561c604c5a237cb776375eee035 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2007 18:00:12 +0100 Subject: man: add missing options to various man pages --- udevcontrol.c | 2 +- udevd.8 | 26 +++++++++++++++++++++++--- udevd.xml | 38 ++++++++++++++++++++++++++++++++------ udevinfo.8 | 7 ++++++- udevinfo.c | 5 ++++- udevinfo.xml | 8 ++++++++ 6 files changed, 74 insertions(+), 12 deletions(-) diff --git a/udevcontrol.c b/udevcontrol.c index a983f22835..6ca90855c5 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -125,7 +125,7 @@ int main(int argc, char *argv[], char *envp[]) " reload_rules reloads the rules files\n" " max_childs= maximum number of childs\n" " max_childs_running= maximum number of childs running at the same time\n" - " --help print this help text\n\n"); + " help print this help text\n\n"); goto exit; } else { fprintf(stderr, "unrecognized command '%s'\n", arg); diff --git a/udevd.8 b/udevd.8 index d21f1d754c..614e4f338f 100644 --- a/udevd.8 +++ b/udevd.8 @@ -49,7 +49,7 @@ Print usage. .PP \fBlog_priority=\fR\fB\fIvalue\fR\fR .RS 4 -udevcontrol can dynamically set the log level of udevd. Valid values are the numerical syslog priorities or their textual representations: +Set the internal log level of udevd. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, \fBinfo\fR and @@ -58,12 +58,32 @@ and .PP \fBstop_exec_queue\fR .RS 4 -udevcontrol stops the execution of events from udevd. +Signal udevd to stop executing new events. Incoming events will be queued. .RE .PP \fBstart_exec_queue\fR .RS 4 -udevcontrol starts the execution of events from udevd. +Signal udevd to enable the execution of events. +.RE +.PP +\fBreload_rules\fR +.RS 4 +Signal udevd to reload the rules from the config. +.RE +.PP +\fBmax_childs\fR +.RS 4 +Set the maximum number of events, udevd will handle at the same time. +.RE +.PP +\fBmax_childs_running\fR +.RS 4 +Set the maximum number of events, which are allowed to run at the same time. +.RE +.PP +\fBhelp\fR +.RS 4 +Print help text. .RE .SH "ENVIRONMENT" .PP diff --git a/udevd.xml b/udevd.xml index 84182884b6..674fa4d755 100644 --- a/udevd.xml +++ b/udevd.xml @@ -80,22 +80,48 @@ - udevcontrol can dynamically set the log level of udevd. - Valid values are the numerical syslog priorities or their textual - representations: , - and . + Set the internal log level of udevd. Valid values are the numerical + syslog priorities or their textual representations: , + and . - udevcontrol stops the execution of events from udevd. + Signal udevd to stop executing new events. Incoming events + will be queued. - udevcontrol starts the execution of events from udevd. + Signal udevd to enable the execution of events. + + + + + + Signal udevd to reload the rules from the config. + + + + + + Set the maximum number of events, udevd will handle at the + same time. + + + + + + Set the maximum number of events, which are allowed to run at the + same time. + + + + + + Print help text. diff --git a/udevinfo.8 b/udevinfo.8 index a6ab1bbf0b..337f2064e4 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -14,7 +14,7 @@ udevinfo \- query udev device information .SH "SYNOPSIS" .HP 9 -\fBudevinfo\fR [\fB\-\-query=\fR\fB\fIquery\-type\fR\fR] [\fB\-\-path=\fR\fB\fIdevpath\fR\fR] [\fB\-\-name=\fR\fB\fInode\fR\fR] [\fB\-\-root\fR] [\fB\-\-attribute\-walk\fR] [\fB\-\-export\-db\fR] [\fB\-\-help\fR] +\fBudevinfo\fR [\fB\-\-query=\fR\fB\fIquery\-type\fR\fR] [\fB\-\-path=\fR\fB\fIdevpath\fR\fR] [\fB\-\-name=\fR\fB\fInode\fR\fR] [\fB\-\-root\fR] [\fB\-\-attribute\-walk\fR] [\fB\-\-export\-db\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] .SH "DESCRIPTION" .PP udevinfo queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device. @@ -64,6 +64,11 @@ Print all sysfs properties of the specified device that can be used in udev rule Export the content of the udev database. .RE .PP +\fB\-\-version\fR +.RS 4 +Print version. +.RE +.PP \fB\-\-help\fR .RS 4 Print help text. diff --git a/udevinfo.c b/udevinfo.c index ef4750dbf4..3f47add87c 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -190,7 +190,7 @@ int main(int argc, char *argv[], char *envp[]) { "attribute-walk", 0, NULL, 'a' }, { "export-db", 0, NULL, 'e' }, { "root", 0, NULL, 'r' }, - { "version", 0, NULL, 'V' }, + { "version", 0, NULL, 1 }, /* -V outputs braindead format */ { "help", 0, NULL, 'h' }, {} }; @@ -290,6 +290,9 @@ int main(int argc, char *argv[], char *envp[]) case 'e': export_db(export_record); goto exit; + case 1: + printf("%s\n", UDEV_VERSION); + goto exit; case 'V': printf("udevinfo, version %s\n", UDEV_VERSION); goto exit; diff --git a/udevinfo.xml b/udevinfo.xml index 82de79f6d8..bb3571cc23 100644 --- a/udevinfo.xml +++ b/udevinfo.xml @@ -32,6 +32,7 @@ + @@ -90,6 +91,13 @@ + + + + Print version. + + + -- cgit v1.2.3-54-g00ecf From 684e935fafdf75c57f1cfd6b91666353270bce8d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2007 21:02:17 +0100 Subject: man: fix typo --- udev.7 | 2 +- udev.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/udev.7 b/udev.7 index 7dd3c1f2b7..6d0c3c897c 100644 --- a/udev.7 +++ b/udev.7 @@ -153,7 +153,7 @@ keys can be specified per rule. Depending on the type of operator, this key is a .PP \fBPROGRAM\fR .RS 4 -Execute external program. The key is true, if the program returns without exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout is available for the RESULT key. +Execute external program. The key is true, if the program returns with exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout, is available in the RESULT key. .RE .PP \fBRESULT\fR diff --git a/udev.xml b/udev.xml index 68edb8fb99..bd099479f2 100644 --- a/udev.xml +++ b/udev.xml @@ -228,8 +228,8 @@ Execute external program. The key is true, if the program returns - without exit code zero. The whole event environment is available to the - executed program. The program's output printed to stdout is available for + with exit code zero. The whole event environment is available to the + executed program. The program's output printed to stdout, is available in the RESULT key. -- cgit v1.2.3-54-g00ecf From 5b7363c0642c2c513b7ebd58bd0cbbcbea355fdf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Mar 2007 12:28:03 +0100 Subject: create_floppy_devices: apply specified mode without umask --- extras/floppy/create_floppy_devices.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 7b61ef05b1..7a3ddb2ffe 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -74,7 +74,7 @@ int main(int argc, char **argv) int major = 2, minor; uid_t uid = 0; gid_t gid = 0; - mode_t mode = 0; + mode_t mode = 0660; int create_nodes = 0; int print_nodes = 0; int unlink_nodes = 0; @@ -165,10 +165,11 @@ int main(int argc, char **argv) printf("%s b %d %d %d\n", node, mode, major, minor); if (create_nodes) { unlink(node); - selinux_setfscreatecon(node, NULL, mode); + selinux_setfscreatecon(node, NULL, S_IFBLK | mode); mknod(node, S_IFBLK | mode, makedev(major,minor)); selinux_resetfscreatecon(); chown(node, uid, gid); + chmod(node, S_IFBLK | mode); } i++; } -- cgit v1.2.3-54-g00ecf From 7f7238062c29f5334c41077e05bf3f0e312386f5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Mar 2007 13:59:28 +0100 Subject: man: spelling fixes Thanks to Robert P. J. Day. --- udev.7 | 10 +++++----- udev.xml | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/udev.7 b/udev.7 index 6d0c3c897c..1eb766fd9e 100644 --- a/udev.7 +++ b/udev.7 @@ -20,9 +20,9 @@ directory, or it renames network interfaces. .PP Usually udev runs as \fBudevd\fR(8) -and receives uevents directly from the kernel if a device is added or removed form the system. +and receives uevents directly from the kernel if a device is added or removed from the system. .PP -If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. Rules that match, may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling. +If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. Rules that match may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling. .SH "CONFIGURATION" .PP All udev configuration files are placed in @@ -61,7 +61,7 @@ directory or at the location specified value in the configuration file. Every li .PP A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. .PP -A rule may consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: +A rule may consist of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: .PP \fB==\fR .RS 4 @@ -248,7 +248,7 @@ If no option is given, udev will choose between \fBprogram\fR and \fBfile\fR -based on the executable bit of of the file permissions. +based on the executable bit of the file permissions. .RE .PP \fBWAIT_FOR_SYSFS\fR @@ -320,7 +320,7 @@ The value of an environment variable. The kernel major number for the device. .RE .PP -\fB$minor\fR \fB%m\fR +\fB$minor\fR, \fB%m\fR .RS 4 The kernel minor number for the device. .RE diff --git a/udev.xml b/udev.xml index bd099479f2..e31df45458 100644 --- a/udev.xml +++ b/udev.xml @@ -30,11 +30,11 @@ Usually udev runs as udevd 8 and receives uevents directly from the - kernel if a device is added or removed form the system. + kernel if a device is added or removed from the system. If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. - Rules that match, may provide additional device information or specify a device + Rules that match may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling. @@ -90,7 +90,7 @@ pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. - A rule may consists of a list of one or more key value pairs separated by + A rule may consist of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: @@ -374,7 +374,7 @@ If no option is given, udev will choose between - and based on the executable bit of of the file + and based on the executable bit of the file permissions. @@ -468,7 +468,7 @@ - + , The kernel minor number for the device. -- cgit v1.2.3-54-g00ecf From 0d2516c3366066e0758f2c5a26d94f41df518e76 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 10 Mar 2007 15:12:42 +0100 Subject: udevmonitor: add switch for kernel and udev events --- udevmonitor.8 | 19 +++++++++++-- udevmonitor.c | 83 +++++++++++++++++++++++++++++++++++++++------------------ udevmonitor.xml | 25 +++++++++++++++-- 3 files changed, 97 insertions(+), 30 deletions(-) diff --git a/udevmonitor.8 b/udevmonitor.8 index 205030fbc0..0adb9988ea 100644 --- a/udevmonitor.8 +++ b/udevmonitor.8 @@ -14,16 +14,31 @@ udevmonitor \- print the kernel and udev event sequence to the console .SH "SYNOPSIS" .HP 12 -\fBudevmonitor\fR [\fB\-\-env\fR] +\fBudevmonitor\fR [\fB\-\-environment\fR] [\fB\-\-kernel\fR] [\fB\-\-udev\fR] [\fB\-\-help\fR] .SH "DESCRIPTION" .PP udevmonitor listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console. It can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event. .SH "OPTIONS" .PP -\fB\-\-env\fR +\fB\-\-environment\fR .RS 4 Print the complete environment for all events. Can be used to compare the kernel supplied and the udev added environment values. .RE +.PP +\fB\-\-kernel\fR +.RS 4 +Print the kernel uevents. +.RE +.PP +\fB\-\-udev\fR +.RS 4 +Print the udev event after the rule processing. +.RE +.PP +\fB\-\-help\fR +.RS 4 +Print usage. +.RE .SH "AUTHOR" .PP Written by Kay Sievers diff --git a/udevmonitor.c b/udevmonitor.c index 89053185e0..d04cb0dcd3 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -129,29 +130,55 @@ static const char *search_key(const char *searchkey, const char *buf, size_t buf int main(int argc, char *argv[]) { struct sigaction act; + int option; int env = 0; + int kernel = 0; + int udev = 0; fd_set readfds; - int i; int retval = 0; - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; - if (strcmp(arg, "--env") == 0 || strcmp(arg, "-e") == 0) + static const struct option options[] = { + { "environment", 0, NULL, 'e' }, + { "kernel", 0, NULL, 'k' }, + { "udev", 0, NULL, 'u' }, + { "help", 0, NULL, 'h' }, + {} + }; + + while (1) { + option = getopt_long(argc, argv, "ekuh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'e': env = 1; - else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0){ - printf("Usage: udevmonitor [--help] [--env]\n" - " --env print the whole event environment\n" - " --help print this help text\n\n"); - exit(0); - } else { - fprintf(stderr, "unrecognized option '%s'\n", arg); - exit(1); + break; + case 'k': + kernel = 1; + break; + case 'u': + udev = 1; + break; + case 'h': + printf("Usage: udevmonitor [--environment] [--kernel] [--udev] [--help]\n" + " --env print the whole event environment\n" + " --kernel print kernel uevents\n" + " --udev print udev events\n" + " --help print this help text\n\n"); + default: + goto out; } } - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - exit(2); + if (!kernel && !udev) { + kernel = 1; + udev =1; + } + + if (getuid() != 0 && kernel) { + fprintf(stderr, "root privileges needed to subscribe to kernel events\n"); + goto out; } /* set signal handlers */ @@ -162,16 +189,20 @@ int main(int argc, char *argv[]) sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); - retval = init_udev_monitor_socket(); - if (retval) - goto out; - - retval = init_uevent_netlink_sock(); - if (retval) - goto out; - - printf("udevmonitor prints the received event from the kernel [UEVENT]\n" - "and the event which udev sends out after rule processing [UDEV]\n\n"); + printf("udevmonitor will print the received events for:\n"); + if (udev) { + retval = init_udev_monitor_socket(); + if (retval) + goto out; + printf("UEVENT the kernel uevent\n"); + } + if (kernel) { + retval = init_uevent_netlink_sock(); + if (retval) + goto out; + printf("UDEV the event which udev sends out after rule processing\n"); + } + printf("\n"); while (!udev_exit) { char buf[UEVENT_BUFFER_SIZE*2]; @@ -257,6 +288,6 @@ out: close(udev_monitor_sock); if (retval) - return 3; + return 1; return 0; } diff --git a/udevmonitor.xml b/udevmonitor.xml index dc81ff26b2..1ab87ab351 100644 --- a/udevmonitor.xml +++ b/udevmonitor.xml @@ -26,7 +26,10 @@ udevmonitor - + + + + @@ -40,12 +43,30 @@ OPTIONS - + Print the complete environment for all events. Can be used to compare the kernel supplied and the udev added environment values. + + + + Print the kernel uevents. + + + + + + Print the udev event after the rule processing. + + + + + + Print usage. + + -- cgit v1.2.3-54-g00ecf From 188394ce8eb235b67226f9166dfe7ca958387e6a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 11 Mar 2007 20:23:42 +0100 Subject: default rules: wait for 0:0:0:0 scsi devices only --- etc/udev/rules.d/05-udev-early.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/05-udev-early.rules b/etc/udev/rules.d/05-udev-early.rules index 4dc497bac2..ec94c35816 100644 --- a/etc/udev/rules.d/05-udev-early.rules +++ b/etc/udev/rules.d/05-udev-early.rules @@ -1,3 +1,3 @@ # sysfs is populated after the event is sent -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" -- cgit v1.2.3-54-g00ecf From 50e3e2b0df91cd81ba20ddd2f35030cc6a877c70 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Mar 2007 13:05:34 +0100 Subject: update Fedora rules --- etc/udev/redhat/50-udev.rules | 4 ---- 1 file changed, 4 deletions(-) diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index 6dc8768f85..c6ab1b5570 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -41,9 +41,6 @@ KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="hvc*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="hvsi*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB*", ATTRS{product}=="Palm Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB*", ATTRS{product}=="palmOne Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB*", ATTRS{product}=="Handspring Visor*", SYMLINK+="pilot", GROUP="uucp", MODE="0660" # vc devices KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" @@ -280,7 +277,6 @@ KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394 KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/lib/udev/dasd_id --export $tempnode" KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # for partitions import parent information -- cgit v1.2.3-54-g00ecf From 9923ff145022a346612ceac7c6534b33814376f6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Mar 2007 13:17:23 +0100 Subject: delete dasd_id, it moved to s390-tools These s390-tools-1.6.0 (applicable for the "October 2005 stream") replace s390-tools-1.5.4. New tools: * tape390_crypt: Tool to control and query crypto settings for 3592 zSeries tape devices. * mon_fsstatd: Daemon that writes filesystem utilization data to the z/VM monitor stream. * dumpconf: Allows to configure the dump device used for system dump in case a kernel panic occurs. * dasdinfo: Display unique DASD ID, either uid or volser. * 59-dasd.rules: udev rules for unique DASD device nodes created in /dev/disk/. http://www.ibm.com/developerworks/linux/linux390/s390-tools-1.6.0.html --- etc/udev/rules.d/60-persistent-storage.rules | 5 +- extras/dasd_id/Makefile | 70 ------- extras/dasd_id/dasd_id.8 | 28 --- extras/dasd_id/dasd_id.c | 262 --------------------------- test/simple-build-check.sh | 1 - 5 files changed, 2 insertions(+), 364 deletions(-) delete mode 100644 extras/dasd_id/Makefile delete mode 100644 extras/dasd_id/dasd_id.8 delete mode 100644 extras/dasd_id/dasd_id.c diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 252bf6eaab..a7efb327a2 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -33,9 +33,8 @@ KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{iee KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" diff --git a/extras/dasd_id/Makefile b/extras/dasd_id/Makefile deleted file mode 100644 index 493c80ef8d..0000000000 --- a/extras/dasd_id/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2005 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = dasd_id -OBJ = -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: uninstall-bin - -install-man: - $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: install-man - -uninstall-man: - -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config - diff --git a/extras/dasd_id/dasd_id.8 b/extras/dasd_id/dasd_id.8 deleted file mode 100644 index 3c38eacf27..0000000000 --- a/extras/dasd_id/dasd_id.8 +++ /dev/null @@ -1,28 +0,0 @@ -.TH DASD_ID 8 "November 2005" "" "Linux Administrator's Manual" -.SH NAME -dasd_id \- udev callout to read label from s390 block device -.SH SYNOPSIS -.BI dasd_id -[\fI--export\fP] \fIblockdevice\fP -.SH "DESCRIPTION" -.B dasd_id -is normally called from a udev rule, to provide udev with a unique string and -additional information (type, serial) for an S390 drive. Udev can use this -information to create symlinks in /dev/disk/by-id and /dev/disk/by-label -to the real device node. -.SH USAGE -.B dasd_id -opens the blockdevice node specified at the commandline and prints the -information chosen by the options. -.SH OPTIONS -The following commandline switches are supported to specify what dasd_id -should print: -.TP -.BI --export -print all values (instead of only the serial) -.RE -.SH SEE ALSO -.BR udev (7) -.SH AUTHORS -Developed by Arnd Bergmann and Kay Sievers . - diff --git a/extras/dasd_id/dasd_id.c b/extras/dasd_id/dasd_id.c deleted file mode 100644 index b2496e99f8..0000000000 --- a/extras/dasd_id/dasd_id.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * dasdlabel - read label from s390 block device - * - * Copyright (C) 2004 Arnd Bergmann - * - * 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. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "../../udev.h" - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -/* - * Only compile this on S/390. Doesn't make any sense - * for other architectures. - */ - -static unsigned char EBCtoASC[256] = -{ -/* 0x00 NUL SOH STX ETX *SEL HT *RNL DEL */ - 0x00, 0x01, 0x02, 0x03, 0x07, 0x09, 0x07, 0x7F, -/* 0x08 -GE -SPS -RPT VT FF CR SO SI */ - 0x07, 0x07, 0x07, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -/* 0x10 DLE DC1 DC2 DC3 -RES -NL BS -POC - -ENP ->LF */ - 0x10, 0x11, 0x12, 0x13, 0x07, 0x0A, 0x08, 0x07, -/* 0x18 CAN EM -UBS -CU1 -IFS -IGS -IRS -ITB - -IUS */ - 0x18, 0x19, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -/* 0x20 -DS -SOS FS -WUS -BYP LF ETB ESC - -INP */ - 0x07, 0x07, 0x1C, 0x07, 0x07, 0x0A, 0x17, 0x1B, -/* 0x28 -SA -SFE -SM -CSP -MFA ENQ ACK BEL - -SW */ - 0x07, 0x07, 0x07, 0x07, 0x07, 0x05, 0x06, 0x07, -/* 0x30 ---- ---- SYN -IR -PP -TRN -NBS EOT */ - 0x07, 0x07, 0x16, 0x07, 0x07, 0x07, 0x07, 0x04, -/* 0x38 -SBS -IT -RFF -CU3 DC4 NAK ---- SUB */ - 0x07, 0x07, 0x07, 0x07, 0x14, 0x15, 0x07, 0x1A, -/* 0x40 SP RSP ä ---- */ - 0x20, 0xFF, 0x83, 0x84, 0x85, 0xA0, 0x07, 0x86, -/* 0x48 . < ( + | */ - 0x87, 0xA4, 0x9B, 0x2E, 0x3C, 0x28, 0x2B, 0x7C, -/* 0x50 & ---- */ - 0x26, 0x82, 0x88, 0x89, 0x8A, 0xA1, 0x8C, 0x07, -/* 0x58 ß ! $ * ) ; */ - 0x8D, 0xE1, 0x21, 0x24, 0x2A, 0x29, 0x3B, 0xAA, -/* 0x60 - / ---- Ä ---- ---- ---- */ - 0x2D, 0x2F, 0x07, 0x8E, 0x07, 0x07, 0x07, 0x8F, -/* 0x68 ---- , % _ > ? */ - 0x80, 0xA5, 0x07, 0x2C, 0x25, 0x5F, 0x3E, 0x3F, -/* 0x70 --- ---- ---- ---- ---- ---- ---- */ - 0x07, 0x90, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, -/* 0x78 * ` : # @ ' = " */ - 0x70, 0x60, 0x3A, 0x23, 0x40, 0x27, 0x3D, 0x22, -/* 0x80 * a b c d e f g */ - 0x07, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, -/* 0x88 h i ---- ---- ---- */ - 0x68, 0x69, 0xAE, 0xAF, 0x07, 0x07, 0x07, 0xF1, -/* 0x90 ° j k l m n o p */ - 0xF8, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, -/* 0x98 q r ---- ---- */ - 0x71, 0x72, 0xA6, 0xA7, 0x91, 0x07, 0x92, 0x07, -/* 0xA0 ~ s t u v w x */ - 0xE6, 0x7E, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, -/* 0xA8 y z ---- ---- ---- ---- */ - 0x79, 0x7A, 0xAD, 0xAB, 0x07, 0x07, 0x07, 0x07, -/* 0xB0 ^ ---- § ---- */ - 0x5E, 0x9C, 0x9D, 0xFA, 0x07, 0x07, 0x07, 0xAC, -/* 0xB8 ---- [ ] ---- ---- ---- ---- */ - 0xAB, 0x07, 0x5B, 0x5D, 0x07, 0x07, 0x07, 0x07, -/* 0xC0 { A B C D E F G */ - 0x7B, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, -/* 0xC8 H I ---- ö ---- */ - 0x48, 0x49, 0x07, 0x93, 0x94, 0x95, 0xA2, 0x07, -/* 0xD0 } J K L M N O P */ - 0x7D, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, -/* 0xD8 Q R ---- ü */ - 0x51, 0x52, 0x07, 0x96, 0x81, 0x97, 0xA3, 0x98, -/* 0xE0 \ S T U V W X */ - 0x5C, 0xF6, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, -/* 0xE8 Y Z ---- Ö ---- ---- ---- */ - 0x59, 0x5A, 0xFD, 0x07, 0x99, 0x07, 0x07, 0x07, -/* 0xF0 0 1 2 3 4 5 6 7 */ - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, -/* 0xF8 8 9 ---- ---- Ü ---- ---- ---- */ - 0x38, 0x39, 0x07, 0x07, 0x9A, 0x07, 0x07, 0x07 -}; - -static void vtoc_ebcdic_dec (const unsigned char *source, unsigned char *target, int l) -{ - int i; - - for (i = 0; i < l; i++) - target[i]=(char)EBCtoASC[(unsigned char)(source[i])]; -} - -/* - * struct dasd_information_t - * represents any data about the data, which is visible to userspace - */ -typedef struct dasd_information_t { - unsigned int devno; /* S/390 devno */ - unsigned int real_devno; /* for aliases */ - unsigned int schid; /* S/390 subchannel identifier */ - unsigned int cu_type : 16; /* from SenseID */ - unsigned int cu_model : 8; /* from SenseID */ - unsigned int dev_type : 16; /* from SenseID */ - unsigned int dev_model : 8; /* from SenseID */ - unsigned int open_count; - unsigned int req_queue_len; - unsigned int chanq_len; /* length of chanq */ - char type[4]; /* from discipline.name, 'none' for unknown */ - unsigned int status; /* current device level */ - unsigned int label_block; /* where to find the VOLSER */ - unsigned int FBA_layout; /* fixed block size (like AIXVOL) */ - unsigned int characteristics_size; - unsigned int confdata_size; - char characteristics[64]; /* from read_device_characteristics */ - char configuration_data[256]; /* from read_configuration_data */ -} dasd_information_t; - -#define DASD_IOCTL_LETTER 'D' -#define BIODASDINFO _IOR(DASD_IOCTL_LETTER,1,dasd_information_t) -#define BLKSSZGET _IO(0x12,104) - -unsigned char serial[8]; - -static int dasd_id(int fd) -{ - int blocksize; - dasd_information_t info; - unsigned char *data; - unsigned char *label_raw; - - if (ioctl(fd, BIODASDINFO, &info) != 0) { - dbg("not a dasd"); - return -1; - } - - if (ioctl(fd, BLKSSZGET, &blocksize) != 0) { - err("failed to get blocksize"); - return -1; - } - - if (lseek(fd,info.label_block * blocksize, SEEK_SET) == -1) { - err("seek failed on dasd"); - return -1; - } - - data = malloc(blocksize); - if (data == NULL) - return -1; - - if (read(fd, data, blocksize) == -1) { - err("read disklabel failed"); - free(data); - return -1; - } - - if ((!info.FBA_layout) && (!strcmp(info.type, "ECKD"))) - label_raw = &data[8]; - else - label_raw = &data[4]; - serial[6] = '\0'; - - vtoc_ebcdic_dec(label_raw, serial, 6); - free(data); - - return 0; - } - -int main(int argc, char *argv[]) -{ - const char *node = NULL; - int i; - int export = 0; - int fd; - int rc = 0; - - logging_init("dasd_id"); - - for (i = 1; i < argc; i++) { - char *arg = argv[i]; - - if (strcmp(arg, "--export") == 0) { - export = 1; - } else - node = arg; - } - if (!node) { - err("no node specified"); - rc = 1; - goto exit; - } - - fd = open(node, O_RDONLY); - if (fd < 0) { - err("unable to open '%s'", node); - rc = 1; - goto exit; - } - - if (dasd_id(fd) < 0) { - err("dasd_id failed: %s", strerror(errno)); - rc = 1; - } - - if (export) { - printf("ID_TYPE=disk\n"); - printf("ID_SERIAL=%s\n",serial); - printf("ID_BUS=ccw\n"); - } else - printf("%s\n", serial); - - close(fd); -exit: - logging_close(); - return rc; -} - diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 385abbd09c..7a82521111 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -6,7 +6,6 @@ EXTRAS="\ extras/ata_id \ extras/volume_id \ extras/usb_id \ - extras/dasd_id \ extras/cdrom_id \ extras/edd_id \ extras/floppy \ -- cgit v1.2.3-54-g00ecf From d7eeab1194a370c23405eecf2074f4b25d7a7ce0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 13 Mar 2007 22:20:53 +0100 Subject: update Gentoo rules --- etc/udev/gentoo/05-udev-early.rules | 13 ++++ etc/udev/gentoo/95-net.rules | 15 +++++ etc/udev/gentoo/udev.rules | 115 ++++++++++++++++++++++++------------ 3 files changed, 104 insertions(+), 39 deletions(-) create mode 100644 etc/udev/gentoo/05-udev-early.rules create mode 100644 etc/udev/gentoo/95-net.rules diff --git a/etc/udev/gentoo/05-udev-early.rules b/etc/udev/gentoo/05-udev-early.rules new file mode 100644 index 0000000000..b4d24ae216 --- /dev/null +++ b/etc/udev/gentoo/05-udev-early.rules @@ -0,0 +1,13 @@ +# ignore these events until someone needs them +SUBSYSTEM=="drivers", OPTIONS="ignore_device" +SUBSYSTEM=="module", OPTIONS="ignore_device" + +# sysfs is populated after the event is sent +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" +ACTION=="add", SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" + +# Set IN_HOTPLUG for compatibility with init-scripts called from udev +ENV{IN_HOTPLUG}="1" + diff --git a/etc/udev/gentoo/95-net.rules b/etc/udev/gentoo/95-net.rules new file mode 100644 index 0000000000..182e8738f6 --- /dev/null +++ b/etc/udev/gentoo/95-net.rules @@ -0,0 +1,15 @@ +# /etc/udev/rules/95-net.rules: device naming rules for udev +# +# Gentoo specific rules +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# Try not to modify this file, if you wish to change things, create a new rule +# file that can be run before this one. +# + +# Activate our network if we can +SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start", OPTIONS="last_rule" +SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop", OPTIONS="last_rule" + diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index bc1c84d4e5..380029fb4c 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -9,6 +9,10 @@ # file that can be run before this one. # +# Net devices can have arbitrary names, even +# ones set by the user. Not try to match normal +# rules on net devices (Bug #166652) +SUBSYSTEM=="net", GOTO="gentoo_device_rules_end" # console KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTIONS="last_rule" @@ -22,25 +26,22 @@ KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" # tty devices -KERNEL=="ttyS[0-9]*", NAME="%k", SYMLINK="tts/%n", GROUP="tty" -KERNEL=="ttyUSB[0-9]*", NAME="%k", SYMLINK="tts/USB%n", GROUP="tty", MODE="0660" -KERNEL=="ippp0", NAME="%k", GROUP="tty" -KERNEL=="isdn*" NAME="%k", GROUP="tty" -KERNEL=="dcbri*", NAME="%k", GROUP="tty" -KERNEL=="ircomm*", NAME="%k", GROUP="tty" +KERNEL=="ttyS[0-9]*", NAME="%k", SYMLINK="tts/%n", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB[0-9]*", NAME="%k", SYMLINK="tts/USB%n", GROUP="uucp", MODE="0660" +KERNEL=="ippp0", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="isdn*" NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="dcbri*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" # all block devices SUBSYSTEM=="block", GROUP="disk" # cdrom symlinks and other good cdrom naming -BUS=="ide", KERNEL=="hd[a-z]", ACTION=="add", IMPORT="cdrom_id --export $tempnode" -BUS=="scsi", KERNEL=="sr[0-9]*", ACTION=="add", IMPORT="cdrom_id --export $tempnode" -BUS=="scsi", KERNEL=="scd[a-z]", ACTION=="add", IMPORT="cdrom_id --export $tempnode" -BUS=="scsi", KERNEL=="sg[0-9]*", ACTION=="add", DRIVERS=="sr", GROUP="cdrom" -ENV{ID_CDROM}=="?*", PROGRAM="seq_node.sh %r %k cdrom", SYMLINK+="%c", GROUP="cdrom" -ENV{ID_CDROM_CD_RW}=="?*", PROGRAM="seq_node.sh %r %k cdrw", SYMLINK+="%c" -ENV{ID_CDROM_DVD}=="?*", PROGRAM="seq_node.sh %r %k dvd", SYMLINK+="%c" -ENV{ID_CDROM_DVD_R}=="?*", PROGRAM="seq_node.sh %r %k dvdrw", SYMLINK+="%c" +KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", ACTION=="add", IMPORT{program}="cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", GROUP="cdrom" + +# assign cdrom-permission also to associated generic device (for cd-burning ...) +KERNEL=="sg[0-9]*", ACTION=="add", ATTRS{type}=="4|5", GROUP="cdrom" # disk devices KERNEL=="sd*", NAME="%k", GROUP="disk" @@ -69,26 +70,29 @@ KERNEL=="timer", NAME="snd/%k" KERNEL=="seq", NAME="snd/%k" # capi devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20", GROUP="dialout" -KERNEL=="capi*", NAME="capi/%n", GROUP="dialout" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20", GROUP="uucp", MODE="0660" +KERNEL=="capi*", NAME="capi/%n", GROUP="uucp", MODE="0660" # cpu devices KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" KERNEL=="microcode", NAME="cpu/microcode" -# dm devices (ignore them) -KERNEL=="dm-[0-9]*", OPTIONS="ignore_device" -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" +# dm devices +# lookup device name and create device in /dev/mapper +# use dmsetup, until devmap_name is provided by sys-fs/device-mapper +ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="dm-*", \ + PROGRAM="/sbin/dmsetup -j %M -m %m --noopencount --noheadings -c -o name info", \ + NAME="mapper/%c" KERNEL=="device-mapper", NAME="mapper/control" # fb devices KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" # floppy devices -KERNEL=="fd[0-9]*", NAME="floppy/%n", SYMLINK+="%k", GROUP="floppy" +KERNEL=="fd[0-9]*", NAME="floppy/%k", SYMLINK+="%k", GROUP="floppy" +KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0660 -G floppy $root/floppy/%k" +KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f $root/floppy/%k?*'" # i2c devices KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" @@ -144,7 +148,7 @@ KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" # raw devices -KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="ram*", NAME="%k", GROUP="disk" # sound devices @@ -244,37 +248,70 @@ KERNEL=="issm*", NAME="infiniband/%k" # usbfs-like device nodes -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" + + +# Setting timeout for tape-devices to 900 seconds +# if you need timeouts for other devices add a similar rule +# with correct type-value, or open a bug on bugs.gentoo.org. +ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="1", \ + RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" # Module autoloading +ACTION!="add", GOTO="hotplug_no_add_event" + +# check if the device has already been claimed by a driver +ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_load_end" + +# this driver is broken and should not be loaded automatically +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_load_end" # Autoload modules that lack aliases but have them defined inutoload modules -SYSFS{modalias}=="?*", ACTION=="add", RUN+="/sbin/modprobe $env{MODALIAS}" +ENV{MODALIAS}=="?*", RUN+="modprobe.sh $env{MODALIAS}" # /etc/modprobe.conf. -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" -# If you have problems with some pnp modules being loaded, please enter the -# following aliases into the modprobe configuration files. These are needed by -# udev to autoload some modules -# alias pnp:dPNP0510 irtty-sir -# alias pnp:dPNP0511 irtty-sir -# alias pnp:dPNP0700 floppy -# alias pnp:dPNP0800 pcspkr -# alias pnp:dPNP0b00 rtc -# alias pnp:dPNP0303 atkbd -# alias pnp:dPNP0f13 psmouse -# alias pnp:dPNPb02f analog +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" +# needed aliases are defined in /etc/modprobe.d/pnp-aliases + + +SUBSYSTEM=="i2o", RUN+="modprobe.sh i2o_block" +SUBSYSTEM=="mmc", RUN+="modprobe.sh mmc_block" +# Parts taken from redhat-rules +# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC +# sr: 4 TYPE_WORM, 5 TYPE_ROM +# st/osst: 1 TYPE_TAPE + +# Load driver for scsi-device +SUBSYSTEM!="scsi_device", GOTO="hotplug_scsi_end" +ATTRS{type}=="?*", RUN+="modprobe.sh sg" +ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" +ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" +ATTRS{type}=="8", RUN+="modprobe.sh ch" + +ATTRS{type}=="1", ENV{ID_SCSI_TAPE_DRIVER}="st" +ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}!="ADR*", ENV{ID_SCSI_TAPE_DRIVER}="osst" +ENV{ID_SCSI_TAPE_DRIVER}=="?*", RUN+="modprobe.sh $env{ID_SCSI_TAPE_DRIVER}" +LABEL="hotplug_scsi_end" + + +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="modprobe.sh ide-scsi" + +LABEL="hotplug_load_end" # Load firmware -SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" +SUBSYSTEM=="firmware", RUN+="firmware.sh" + +LABEL="hotplug_no_add_event" +LABEL="gentoo_device_rules_end" # be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems # run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart -ENV{UDEVD_EVENT}=="1", RUN+="udev_run_hotplugd $env{SUBSYSTEM}" +#ENV{UDEVD_EVENT}=="1", RUN+="udev_run_hotplugd $env{SUBSYSTEM}" # always run /etc/dev.d/ stuff for now. RUN+="udev_run_devd $env{SUBSYSTEM}" -- cgit v1.2.3-54-g00ecf From 5edec024b1ed7bbdf73095791c13df324038c31d Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 13 Mar 2007 22:27:21 +0100 Subject: udevd: cleanup std{in,our,err} on startup It occurs, when root-partition has no /dev/console, meaning that kernel could not open it, and such udevd is started without open filedescriptors 0 1 2. In that case udevd openes its sockets (netlink and control). They get fds between 0 and 2. Later duping /dev/null to 0 1 2 closes the sockets and replaces them with /dev/null. The error condition can also be reproduced by starting udevd with this command-line: udevd --daemon <&- >&- 2>&- --- udevd.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/udevd.c b/udevd.c index 23f5fd6980..961ceb587a 100644 --- a/udevd.c +++ b/udevd.c @@ -989,6 +989,19 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + /* make sure std{in,out,err} fd's are in a sane state */ + fd = open("/dev/null", O_RDWR); + if (fd < 0) { + fprintf(stderr, "cannot open /dev/null\n"); + err("cannot open /dev/null"); + } + if (fd > STDIN_FILENO) + dup2(fd, STDIN_FILENO); + if (write(STDOUT_FILENO, 0, 0) < 0) + dup2(fd, STDOUT_FILENO); + if (write(STDERR_FILENO, 0, 0) < 0) + dup2(fd, STDERR_FILENO); + /* init sockets to receive events */ if (init_udevd_socket() < 0) { if (errno == EADDRINUSE) { @@ -1064,17 +1077,12 @@ int main(int argc, char *argv[], char *envp[]) } } - /* redirect std fd's */ - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDIN_FILENO); - if (!verbose) - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - if (fd > STDERR_FILENO) - close(fd); - } else - err("error opening /dev/null: %s", strerror(errno)); + /* redirect std{out,err} fd's */ + if (!verbose) + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) + close(fd); /* set scheduling priority for the daemon */ setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); -- cgit v1.2.3-54-g00ecf From 9c6ad9fbbac82e517f5e748ddbe166f96f120afe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Mar 2007 21:41:33 +0100 Subject: encode db-file names, instead of just replacing '/' --- udev.h | 3 ++- udev_db.c | 40 ++++++++++------------------------------ udev_utils_string.c | 43 +++++++++++++++++++++++++++++++++++++++++++ udevd.c | 22 +++++----------------- udevtrigger.c | 13 +++---------- 5 files changed, 63 insertions(+), 58 deletions(-) diff --git a/udev.h b/udev.h index 849de96459..200d7e8369 100644 --- a/udev.h +++ b/udev.h @@ -29,7 +29,6 @@ #include "udev_version.h" #define COMMENT_CHARACTER '#' -#define PATH_TO_NAME_CHAR '@' #define LINE_SIZE 512 #define PATH_SIZE 512 #define NAME_SIZE 128 @@ -144,6 +143,8 @@ extern gid_t lookup_group(const char *group); /* udev_utils_string.c */ extern int string_is_true(const char *str); extern void remove_trailing_chars(char *path, char c); +extern size_t path_encode(char *s, size_t len); +extern size_t path_decode(char *s); extern int utf8_encoded_valid_unichar(const char *str); extern int replace_untrusted_chars(char *str); diff --git a/udev_db.c b/udev_db.c index b1217d80e1..9032eefb8a 100644 --- a/udev_db.c +++ b/udev_db.c @@ -33,38 +33,22 @@ #include "udev.h" -static int devpath_to_db_path(const char *devpath, char *filename, size_t len) +static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len) { - size_t start, end, i; + size_t start; /* add location of db files */ strlcpy(filename, udev_root, len); start = strlcat(filename, "/"DB_DIR, len); - end = strlcat(filename, devpath, len); - if (end > len) - end = len; - - /* replace '/' to transform path into a filename */ - for (i = start+1; i < end; i++) - if (filename[i] == '/') - filename[i] = PATH_TO_NAME_CHAR; - - return 0; + strlcat(filename, devpath, len); + return path_encode(&filename[start+1], len - (start+1)); } static int db_file_to_devpath(const char *filename, char *devpath, size_t len) { - size_t end, i; - strlcpy(devpath, "/", len); - end = strlcat(devpath, filename, len); - - /* replace PATH_TO_NAME_CHAR to transform name into devpath */ - for (i = 1; i < end; i++) - if (devpath[i] == PATH_TO_NAME_CHAR) - devpath[i] = '/'; - - return 0; + strlcat(devpath, filename, len); + return path_decode(devpath); } int udev_db_add_device(struct udevice *udev) @@ -338,8 +322,7 @@ int udev_db_get_all_entries(struct list_head *name_list) while (1) { struct dirent *ent; - char filename[PATH_SIZE] = "/"; - size_t end, i; + char device[PATH_SIZE]; ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') @@ -347,12 +330,9 @@ int udev_db_get_all_entries(struct list_head *name_list) if (ent->d_name[0] == '.') continue; - end = strlcat(filename, ent->d_name, sizeof(filename)); - for (i = 1; i < end; i++) - if (filename[i] == PATH_TO_NAME_CHAR) - filename[i] = '/'; - name_list_add(name_list, filename, 1); - dbg("added '%s'", filename); + db_file_to_devpath(ent->d_name, device, sizeof(device)); + name_list_add(name_list, device, 1); + dbg("added '%s'", device); } closedir(dir); diff --git a/udev_utils_string.c b/udev_utils_string.c index 8cda47272f..b0641f002b 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -50,6 +50,49 @@ void remove_trailing_chars(char *path, char c) path[--len] = '\0'; } +size_t path_encode(char *s, size_t len) +{ + char t[(len * 3)+1]; + size_t i, j; + + t[0] = '\0'; + for (i = 0, j = 0; s[i] != '\0'; i++) { + if (s[i] == '/') { + memcpy(&t[j], "%2f", 3); + j += 3; + } else if (s[i] == '%') { + memcpy(&t[j], "%25", 3); + j += 3; + } else { + t[j] = s[i]; + j++; + } + } + t[j] = '\0'; + strncpy(s, t, len); + return j; +} + +size_t path_decode(char *s) +{ + size_t i, j; + + for (i = 0, j = 0; s[i] != '\0'; j++) { + if (memcmp(&s[i], "%2f", 3) == 0) { + s[j] = '/'; + i += 3; + }else if (memcmp(&s[i], "%25", 3) == 0) { + s[j] = '%'; + i += 3; + } else { + s[j] = s[i]; + i++; + } + } + s[j] = '\0'; + return j; +} + /* count of characters used to encode one unicode char */ static int utf8_encoded_expected_len(const char *str) { diff --git a/udevd.c b/udevd.c index 961ceb587a..07f1c48103 100644 --- a/udevd.c +++ b/udevd.c @@ -167,7 +167,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st { char filename[PATH_SIZE]; char filename_failed[PATH_SIZE]; - size_t start, end, i; + size_t start; struct udevd_uevent_msg *loop_msg; int fd; @@ -175,27 +175,15 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st strlcpy(filename, udev_root, sizeof(filename)); strlcat(filename, "/", sizeof(filename)); start = strlcat(filename, EVENT_QUEUE_DIR, sizeof(filename)); - end = strlcat(filename, msg->devpath, sizeof(filename)); - if (end > sizeof(filename)) - end = sizeof(filename); - - /* replace '/' to transform path into a filename */ - for (i = start+1; i < end; i++) - if (filename[i] == '/') - filename[i] = PATH_TO_NAME_CHAR; + strlcat(filename, msg->devpath, sizeof(filename)); + path_encode(&filename[start+1], sizeof(filename) - (start+1)); /* add location of failed files */ strlcpy(filename_failed, udev_root, sizeof(filename_failed)); strlcat(filename_failed, "/", sizeof(filename_failed)); start = strlcat(filename_failed, EVENT_FAILED_DIR, sizeof(filename_failed)); - end = strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); - if (end > sizeof(filename_failed)) - end = sizeof(filename_failed); - - /* replace '/' to transform path into a filename */ - for (i = start+1; i < end; i++) - if (filename_failed[i] == '/') - filename_failed[i] = PATH_TO_NAME_CHAR; + strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); + path_encode(&filename_failed[start+1], sizeof(filename) - (start+1)); switch (state) { case EVENT_QUEUED: diff --git a/udevtrigger.c b/udevtrigger.c index c809d2d47b..2bdd0c8d07 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -407,22 +407,15 @@ static void scan_failed(void) if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char device[PATH_SIZE]; - size_t start, end, i; + size_t start; if (dent->d_name[0] == '.') continue; strlcpy(device, sysfs_path, sizeof(device)); start = strlcat(device, "/", sizeof(device)); - end = strlcat(device, dent->d_name, sizeof(device)); - if (end > sizeof(device)) - end = sizeof(device); - - /* replace PATH_TO_NAME_CHAR with '/' */ - for (i = start; i < end; i++) - if (device[i] == PATH_TO_NAME_CHAR) - device[i] = '/'; - + strlcat(device, dent->d_name, sizeof(device)); + path_decode(&device[start]); device_list_insert(device); } closedir(dir); -- cgit v1.2.3-54-g00ecf From 4a7e6bcef059af60baab92a3c0fbe01ed44465d5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Mar 2007 00:10:22 +0100 Subject: update internal variables if we see $DEVPATH during IMPORT --- udev_device.c | 4 ++++ udev_rules.c | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/udev_device.c b/udev_device.c index 1eebd61cc5..91fa655480 100644 --- a/udev_device.c +++ b/udev_device.c @@ -208,6 +208,10 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) info("device event will be ignored"); goto exit; } + if (udev->name[0] == '\0') { + info("device renaming supressed"); + goto exit; + } /* look if we want to change the name of the netif */ if (strcmp(udev->name, udev->dev->kernel) != 0) { diff --git a/udev_rules.c b/udev_rules.c index 200b4e7024..7ab3bba71c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -186,7 +186,13 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu linepos = line; if (get_key(&linepos, &variable, &value) == 0) { dbg("import '%s=%s'", variable, value); - name_list_key_add(&udev->env_list, variable, value); + + /* handle device, renamed by external tool, returning new path */ + if (strcmp(variable, "DEVPATH") == 0) { + info("updating devpath from '%s' to '%s'", udev->dev->devpath, value); + sysfs_device_set_values(udev->dev, value, NULL, NULL); + } else + name_list_key_add(&udev->env_list, variable, value); setenv(variable, value, 1); } } -- cgit v1.2.3-54-g00ecf From 8d48959a23415d3e960cebd8381b95388dcf127e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Mar 2007 00:10:59 +0100 Subject: increase /proc/stat buffer --- udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevd.c b/udevd.c index 07f1c48103..efb24ff651 100644 --- a/udevd.c +++ b/udevd.c @@ -348,7 +348,7 @@ static int mem_size_mb(void) static int cpu_count(void) { int f; - char buf[32768]; + char buf[65536]; int len; const char *pos; int count = 0; -- cgit v1.2.3-54-g00ecf From fbda4babec842382d704eb41b2040d73ad995886 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Mar 2007 02:09:39 +0100 Subject: maintain index over device-names to devpath relation --- udev.h | 1 + udev_db.c | 134 ++++++++++++++++++++++++++++++-------------------------------- 2 files changed, 66 insertions(+), 69 deletions(-) diff --git a/udev.h b/udev.h index 200d7e8369..7fc7fd3b82 100644 --- a/udev.h +++ b/udev.h @@ -44,6 +44,7 @@ #define WRITE_END 1 #define DB_DIR ".udev/db" +#define DB_NAME_INDEX_DIR ".udev/names" struct udev_rules; diff --git a/udev_db.c b/udev_db.c index 9032eefb8a..c07588db24 100644 --- a/udev_db.c +++ b/udev_db.c @@ -44,13 +44,46 @@ static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len return path_encode(&filename[start+1], len - (start+1)); } -static int db_file_to_devpath(const char *filename, char *devpath, size_t len) +static size_t db_file_to_devpath(const char *filename, char *devpath, size_t len) { strlcpy(devpath, "/", len); strlcat(devpath, filename, len); return path_decode(devpath); } + +/* reverse mapping from the device file name to the devpath */ +static int name_index(const char *devpath, const char *name, int add) +{ + char device[PATH_SIZE]; + char filename[PATH_SIZE * 2]; + size_t start; + int fd; + + /* directory with device name */ + strlcpy(filename, udev_root, sizeof(filename)); + start = strlcat(filename, "/"DB_NAME_INDEX_DIR"/", sizeof(filename)); + strlcat(filename, name, sizeof(filename)); + path_encode(&filename[start+1], sizeof(filename) - (start+1)); + /* entry with the devpath */ + strlcpy(device, devpath, sizeof(device)); + path_encode(&device[1], sizeof(device)-1); + strlcat(filename, device, sizeof(filename)); + + if (add) { + dbg("creating: '%s'", filename); + create_path(filename); + fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); + if (fd > 0) + close(fd); + } else { + dbg("removing: '%s'", filename); + unlink(filename); + delete_path(filename); + } + return 0; +} + int udev_db_add_device(struct udevice *udev) { char filename[PATH_SIZE]; @@ -60,6 +93,7 @@ int udev_db_add_device(struct udevice *udev) devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); create_path(filename); + name_index(udev->dev->devpath, udev->name, 1); /* * create only a symlink with the name as the target @@ -86,8 +120,10 @@ int udev_db_add_device(struct udevice *udev) dbg("storing data for device '%s' in '%s'", udev->dev->devpath, filename); fprintf(f, "N:%s\n", udev->name); - list_for_each_entry(name_loop, &udev->symlink_list, node) + list_for_each_entry(name_loop, &udev->symlink_list, node) { fprintf(f, "S:%s\n", name_loop->name); + name_index(udev->dev->devpath, name_loop->name, 1); + } fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); if (udev->partitions) fprintf(f, "A:%u\n", udev->partitions); @@ -203,37 +239,42 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) int udev_db_delete_device(struct udevice *udev) { char filename[PATH_SIZE]; + struct name_entry *name_loop; devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); unlink(filename); + name_index(udev->dev->devpath, udev->name, 0); + list_for_each_entry(name_loop, &udev->symlink_list, node) + name_index(udev->dev->devpath, name_loop->name, 0); + return 0; } int udev_db_lookup_name(const char *name, char *devpath, size_t len) { - char dbpath[PATH_MAX]; + char dirname[PATH_MAX]; + size_t start; DIR *dir; int found = 0; - strlcpy(dbpath, udev_root, sizeof(dbpath)); - strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); - dir = opendir(dbpath); + strlcpy(dirname, udev_root, sizeof(dirname)); + start = strlcat(dirname, "/"DB_NAME_INDEX_DIR"/", sizeof(dirname)); + strlcat(dirname, name, sizeof(dirname)); + path_encode(&dirname[start+1], sizeof(dirname) - (start+1)); + + dir = opendir(dirname); if (dir == NULL) { - info("no udev_db available '%s': %s", dbpath, strerror(errno)); + info("no index directory '%s': %s", dirname, strerror(errno)); return -1; } + info("found index directory '%s'", dirname); while (!found) { struct dirent *ent; + char device[PATH_SIZE]; char filename[PATH_SIZE]; - char nodename[PATH_SIZE]; - struct stat stats; - char *bufline; - char *buf; - size_t bufsize; - size_t cur; - size_t count; + struct stat statbuf; ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') @@ -241,63 +282,18 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) if (ent->d_name[0] == '.') continue; - snprintf(filename, sizeof(filename), "%s/%s", dbpath, ent->d_name); - filename[sizeof(filename)-1] = '\0'; - dbg("looking at '%s'", filename); - - if (lstat(filename, &stats) != 0) { - info("unable to read %s: %s", filename, strerror(errno)); - continue; - } - if ((stats.st_mode & S_IFMT) == S_IFLNK) { - char target[NAME_SIZE]; - int target_len; - - info("found a symlink as db file"); - target_len = readlink(filename, target, sizeof(target)); - if (target_len > 0) - target[target_len] = '\0'; - else { - info("error reading db link %s: %s", filename, strerror(errno)); - return -1; - } - dbg("db link points to '%s'", target); - if (strcmp(name, target) == 0) { - db_file_to_devpath(ent->d_name, devpath, len); - found =1; - } - continue; - } - - if (file_map(filename, &buf, &bufsize) != 0) { - info("unable to read db file '%s': %s", filename, strerror(errno)); - continue; - } + strlcpy(device, "/", len); + strlcat(device, ent->d_name, sizeof(device)); + path_decode(device); - cur = 0; - while (cur < bufsize && !found) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - - switch(bufline[0]) { - case 'N': - case 'S': - if (count > sizeof(nodename)) - count = sizeof(nodename); - memcpy(nodename, &bufline[2], count-2); - nodename[count-2] = '\0'; - dbg("compare '%s' '%s'", nodename, name); - if (strcmp(nodename, name) == 0) { - db_file_to_devpath(ent->d_name, devpath, len); - found = 1; - } - break; - default: - continue; - } + dbg("looking at '%s'", device); + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, device, sizeof(filename)); + if (stat(filename, &statbuf) == 0) { + strlcpy(devpath, device, len); + found = 1; + break; } - file_unmap(buf, bufsize); } closedir(dir); -- cgit v1.2.3-54-g00ecf From 27d4bf1817259873b0a1e118d03978f0d2f2595e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Mar 2007 03:54:12 +0100 Subject: restore overwritten symlinks when the device goes away --- udev_node.c | 126 ++++++++++++++++++++++++++++++------------------------ udev_utils_file.c | 3 ++ 2 files changed, 73 insertions(+), 56 deletions(-) diff --git a/udev_node.c b/udev_node.c index e1b62293bb..d069dfc4aa 100644 --- a/udev_node.c +++ b/udev_node.c @@ -88,30 +88,45 @@ exit: return retval; } -static int udev_node_symlink(struct udevice *udev, const char *linktarget, const char *filename) +static int node_symlink(const char *node, const char *slink) { - char target[PATH_SIZE]; + char target[PATH_SIZE] = ""; + char buf[PATH_SIZE]; + int i = 0; + int tail = 0; int len; + /* use relative link */ + while (node[i] && (node[i] == slink[i])) { + if (node[i] == '/') + tail = i+1; + i++; + } + while (slink[i] != '\0') { + if (slink[i] == '/') + strlcat(target, "../", sizeof(target)); + i++; + } + strlcat(target, &node[tail], sizeof(target)); + /* look if symlink already exists */ - len = readlink(filename, target, sizeof(target)); + len = readlink(slink, buf, sizeof(buf)); if (len > 0) { - target[len] = '\0'; - if (strcmp(linktarget, target) == 0) { - info("preserving symlink '%s' to '%s'", filename, linktarget); - selinux_setfilecon(filename, NULL, S_IFLNK); + buf[len] = '\0'; + if (strcmp(target, buf) == 0) { + info("preserving symlink '%s' to '%s'", slink, target); + selinux_setfilecon(slink, NULL, S_IFLNK); goto exit; - } else { - info("link '%s' points to different target '%s', delete it", filename, target); - unlink(filename); } + info("link '%s' points to different target '%s', delete it", slink, buf); + unlink(slink); } /* create link */ - info("creating symlink '%s' to '%s'", filename, linktarget); - selinux_setfscreatecon(filename, NULL, S_IFLNK); - if (symlink(linktarget, filename) != 0) - err("symlink(%s, %s) failed: %s", linktarget, filename, strerror(errno)); + info("creating symlink '%s' to '%s'", slink, target); + selinux_setfscreatecon(slink, NULL, S_IFLNK); + if (symlink(target, slink) != 0) + err("symlink(%s, %s) failed: %s", target, slink, strerror(errno)); selinux_resetfscreatecon(); exit: @@ -121,10 +136,8 @@ exit: int udev_node_add(struct udevice *udev, struct udevice *udev_old) { char filename[PATH_SIZE]; - struct name_entry *name_loop; uid_t uid; gid_t gid; - int tail; int i; int retval = 0; @@ -132,8 +145,7 @@ int udev_node_add(struct udevice *udev, struct udevice *udev_old) filename[sizeof(filename)-1] = '\0'; /* create parent directories if needed */ - if (strchr(udev->name, '/')) - create_path(filename); + create_path(filename); if (strcmp(udev->owner, "root") == 0) uid = 0; @@ -200,41 +212,23 @@ int udev_node_add(struct udevice *udev, struct udevice *udev_old) /* create symlink(s) if requested */ if (!list_empty(&udev->symlink_list)) { - char symlinks[512] = ""; + struct name_entry *name_loop; + char symlinks[PATH_SIZE] = ""; list_for_each_entry(name_loop, &udev->symlink_list, node) { - char linktarget[PATH_SIZE]; + char slink[PATH_SIZE]; - snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); - filename[sizeof(filename)-1] = '\0'; + strlcpy(slink, udev_root, sizeof(slink)); + strlcat(slink, "/", sizeof(slink)); + strlcat(slink, name_loop->name, sizeof(slink)); - dbg("symlink '%s' to node '%s' requested", filename, udev->name); - if (!udev->test_run) - if (strchr(filename, '/')) - create_path(filename); - - /* optimize relative link */ - linktarget[0] = '\0'; - i = 0; - tail = 0; - while (udev->name[i] && (udev->name[i] == name_loop->name[i])) { - if (udev->name[i] == '/') - tail = i+1; - i++; - } - while (name_loop->name[i] != '\0') { - if (name_loop->name[i] == '/') - strlcat(linktarget, "../", sizeof(linktarget)); - i++; + info("creating symlink '%s' to node '%s'", slink, filename); + if (!udev->test_run) { + create_path(slink); + node_symlink(filename, slink); } - strlcat(linktarget, &udev->name[tail], sizeof(linktarget)); - - info("creating symlink '%s' to '%s'", filename, linktarget); - if (!udev->test_run) - udev_node_symlink(udev, linktarget, filename); - - strlcat(symlinks, filename, sizeof(symlinks)); + strlcat(symlinks, slink, sizeof(symlinks)); strlcat(symlinks, " ", sizeof(symlinks)); } @@ -254,9 +248,11 @@ void udev_node_remove_symlinks(struct udevice *udev) struct stat stats; if (!list_empty(&udev->symlink_list)) { - char symlinks[512] = ""; + char symlinks[PATH_SIZE] = ""; list_for_each_entry(name_loop, &udev->symlink_list, node) { + char devpath[PATH_SIZE]; + snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); filename[sizeof(filename)-1] = '\0'; @@ -272,9 +268,32 @@ void udev_node_remove_symlinks(struct udevice *udev) info("removing symlink '%s'", filename); if (!udev->test_run) { unlink(filename); + delete_path(filename); + } - if (strchr(filename, '/')) - delete_path(filename); + /* see if another device wants this symlink */ + if (udev_db_lookup_name(name_loop->name, devpath, sizeof(devpath)) == 0) { + struct udevice *old; + + info("found overwritten symlink '%s' of '%s'", name_loop->name, devpath); + old = udev_device_init(); + if (old != NULL) { + if (udev_db_get_device(old, devpath) == 0) { + char slink[PATH_SIZE]; + char node[PATH_SIZE]; + + strlcpy(slink, udev_root, sizeof(slink)); + strlcat(slink, "/", sizeof(slink)); + strlcat(slink, name_loop->name, sizeof(slink)); + strlcpy(node, udev_root, sizeof(node)); + strlcat(node, "/", sizeof(node)); + strlcat(node, old->name, sizeof(node)); + info("restore symlink '%s' to '%s'", slink, node); + if (!udev->test_run) + node_symlink(node, slink); + } + udev_device_cleanup(old); + } } strlcat(symlinks, filename, sizeof(symlinks)); @@ -299,7 +318,6 @@ int udev_node_remove(struct udevice *udev) snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); filename[sizeof(filename)-1] = '\0'; - if (stat(filename, &stats) != 0) { dbg("device node '%s' not found", filename); return -1; @@ -315,7 +333,6 @@ int udev_node_remove(struct udevice *udev) return retval; setenv("DEVNAME", filename, 1); - num = udev->partitions; if (num > 0) { int i; @@ -331,9 +348,6 @@ int udev_node_remove(struct udevice *udev) unlink_secure(partitionname); } } - - if (strchr(udev->name, '/')) - delete_path(filename); - + delete_path(filename); return retval; } diff --git a/udev_utils_file.c b/udev_utils_file.c index 9bf60696d9..e4d5802ff8 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -65,6 +65,9 @@ int delete_path(const char *path) strcpy (p, path); pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + while (1) { *pos = '\0'; pos = strrchr(p, '/'); -- cgit v1.2.3-54-g00ecf From 3f641815ec524bee6bcd47df0103a8b4c05794dd Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Thu, 15 Mar 2007 16:30:08 +0100 Subject: udevmonitor: fix swapped event switch descriptions --- udevmonitor.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevmonitor.c b/udevmonitor.c index d04cb0dcd3..a9cc0614ff 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -194,13 +194,13 @@ int main(int argc, char *argv[]) retval = init_udev_monitor_socket(); if (retval) goto out; - printf("UEVENT the kernel uevent\n"); + printf("UDEV the event which udev sends out after rule processing\n"); } if (kernel) { retval = init_uevent_netlink_sock(); if (retval) goto out; - printf("UDEV the event which udev sends out after rule processing\n"); + printf("UEVENT the kernel uevent\n"); } printf("\n"); -- cgit v1.2.3-54-g00ecf From 043c6f6d4a97ab3a4aeea8cca16c1cc754b0e5ee Mon Sep 17 00:00:00 2001 From: Jean Tourrilhes Date: Fri, 16 Mar 2007 01:09:47 +0100 Subject: udevtest: export UDEV_LOG if we changed it --- udevtest.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/udevtest.c b/udevtest.c index 2854f7558f..73bf7dd1f8 100644 --- a/udevtest.c +++ b/udevtest.c @@ -59,8 +59,13 @@ int main(int argc, char *argv[], char *envp[]) info("version %s", UDEV_VERSION); udev_config_init(); - if (udev_log_priority < LOG_INFO) + if (udev_log_priority < LOG_INFO) { + char priority[32]; + udev_log_priority = LOG_INFO; + sprintf(priority, "%i", udev_log_priority); + setenv("UDEV_LOG", priority, 1); + } for (i = 1 ; i < argc; i++) { char *arg = argv[i]; -- cgit v1.2.3-54-g00ecf From fc6da921ad3bcb251aa317376e81701700e925c9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Mar 2007 03:09:02 +0100 Subject: store devpath with the usual leading slash --- udev_db.c | 25 +++++++++---------------- udevd.c | 8 ++++---- udevtrigger.c | 3 +-- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/udev_db.c b/udev_db.c index c07588db24..13d96894af 100644 --- a/udev_db.c +++ b/udev_db.c @@ -39,19 +39,11 @@ static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len /* add location of db files */ strlcpy(filename, udev_root, len); - start = strlcat(filename, "/"DB_DIR, len); + start = strlcat(filename, "/"DB_DIR"/", len); strlcat(filename, devpath, len); - return path_encode(&filename[start+1], len - (start+1)); + return path_encode(&filename[start], len - start); } -static size_t db_file_to_devpath(const char *filename, char *devpath, size_t len) -{ - strlcpy(devpath, "/", len); - strlcat(devpath, filename, len); - return path_decode(devpath); -} - - /* reverse mapping from the device file name to the devpath */ static int name_index(const char *devpath, const char *name, int add) { @@ -64,10 +56,11 @@ static int name_index(const char *devpath, const char *name, int add) strlcpy(filename, udev_root, sizeof(filename)); start = strlcat(filename, "/"DB_NAME_INDEX_DIR"/", sizeof(filename)); strlcat(filename, name, sizeof(filename)); - path_encode(&filename[start+1], sizeof(filename) - (start+1)); + path_encode(&filename[start], sizeof(filename) - start); /* entry with the devpath */ strlcpy(device, devpath, sizeof(device)); - path_encode(&device[1], sizeof(device)-1); + path_encode(device, sizeof(device)); + strlcat(filename, "/", sizeof(filename)); strlcat(filename, device, sizeof(filename)); if (add) { @@ -261,7 +254,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) strlcpy(dirname, udev_root, sizeof(dirname)); start = strlcat(dirname, "/"DB_NAME_INDEX_DIR"/", sizeof(dirname)); strlcat(dirname, name, sizeof(dirname)); - path_encode(&dirname[start+1], sizeof(dirname) - (start+1)); + path_encode(&dirname[start], sizeof(dirname) - start); dir = opendir(dirname); if (dir == NULL) { @@ -282,8 +275,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) if (ent->d_name[0] == '.') continue; - strlcpy(device, "/", len); - strlcat(device, ent->d_name, sizeof(device)); + strlcpy(device, ent->d_name, sizeof(device)); path_decode(device); dbg("looking at '%s'", device); @@ -326,7 +318,8 @@ int udev_db_get_all_entries(struct list_head *name_list) if (ent->d_name[0] == '.') continue; - db_file_to_devpath(ent->d_name, device, sizeof(device)); + strlcpy(device, ent->d_name, sizeof(device)); + path_decode(device); name_list_add(name_list, device, 1); dbg("added '%s'", device); } diff --git a/udevd.c b/udevd.c index efb24ff651..2c92590dcd 100644 --- a/udevd.c +++ b/udevd.c @@ -174,16 +174,16 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st /* add location of queue files */ strlcpy(filename, udev_root, sizeof(filename)); strlcat(filename, "/", sizeof(filename)); - start = strlcat(filename, EVENT_QUEUE_DIR, sizeof(filename)); + start = strlcat(filename, EVENT_QUEUE_DIR"/", sizeof(filename)); strlcat(filename, msg->devpath, sizeof(filename)); - path_encode(&filename[start+1], sizeof(filename) - (start+1)); + path_encode(&filename[start], sizeof(filename) - start); /* add location of failed files */ strlcpy(filename_failed, udev_root, sizeof(filename_failed)); strlcat(filename_failed, "/", sizeof(filename_failed)); - start = strlcat(filename_failed, EVENT_FAILED_DIR, sizeof(filename_failed)); + start = strlcat(filename_failed, EVENT_FAILED_DIR"/", sizeof(filename_failed)); strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); - path_encode(&filename_failed[start+1], sizeof(filename) - (start+1)); + path_encode(&filename_failed[start], sizeof(filename) - start); switch (state) { case EVENT_QUEUED: diff --git a/udevtrigger.c b/udevtrigger.c index 2bdd0c8d07..7577c5f15f 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -412,8 +412,7 @@ static void scan_failed(void) if (dent->d_name[0] == '.') continue; - strlcpy(device, sysfs_path, sizeof(device)); - start = strlcat(device, "/", sizeof(device)); + start = strlcpy(device, sysfs_path, sizeof(device)); strlcat(device, dent->d_name, sizeof(device)); path_decode(&device[start]); device_list_insert(device); -- cgit v1.2.3-54-g00ecf From 2dbb47f8606d18b14e981fb5cf245e8aaaad2de1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Mar 2007 15:16:08 +0100 Subject: add link_priority to rule options, and store it in database --- udev.h | 1 + udev_db.c | 9 +++++++++ udev_rules.c | 4 ++++ udev_rules.h | 1 + udev_rules_parse.c | 7 +++++++ 5 files changed, 22 insertions(+) diff --git a/udev.h b/udev.h index 7fc7fd3b82..31542243e2 100644 --- a/udev.h +++ b/udev.h @@ -86,6 +86,7 @@ struct udevice { int ignore_device; int ignore_remove; char program_result[PATH_SIZE]; + int link_priority; int test_run; }; diff --git a/udev_db.c b/udev_db.c index 13d96894af..5ac016a051 100644 --- a/udev_db.c +++ b/udev_db.c @@ -118,6 +118,8 @@ int udev_db_add_device(struct udevice *udev) name_index(udev->dev->devpath, name_loop->name, 1); } fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); + if (udev->link_priority) + fprintf(f, "L:%u\n", udev->link_priority); if (udev->partitions) fprintf(f, "A:%u\n", udev->partitions); if (udev->ignore_remove) @@ -198,6 +200,13 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) line[count-2] = '\0'; name_list_add(&udev->symlink_list, line, 0); break; + case 'L': + if (count > sizeof(line)) + count = sizeof(line); + memcpy(line, &bufline[2], count-2); + line[count-2] = '\0'; + udev->link_priority = atoi(line); + break; case 'A': if (count > sizeof(line)) count = sizeof(line); diff --git a/udev_rules.c b/udev_rules.c index 7ab3bba71c..c0f4cd2077 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -909,6 +909,10 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) udev->ignore_remove = 1; dbg("remove event should be ignored"); } + if (rule->link_priority) { + udev->link_priority = rule->link_priority; + info("link_priority=%i", udev->link_priority); + } /* apply all_partitions option only at a main block device */ if (rule->partitions && strcmp(udev->dev->subsystem, "block") == 0 && udev->dev->kernel_number[0] == '\0') { diff --git a/udev_rules.h b/udev_rules.h index 56153519d4..7fbf88ba57 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -87,6 +87,7 @@ struct udev_rule { mode_t mode; enum key_operation mode_operation; + unsigned int link_priority; unsigned int partitions; unsigned int last_rule:1, ignore_device:1, diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 5ce91df383..bfbad367e9 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -555,6 +555,8 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strcasecmp(key, "OPTIONS") == 0) { + const char *pos; + if (strstr(value, "last_rule") != NULL) { dbg("last rule to be applied"); rule->last_rule = 1; @@ -567,6 +569,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena dbg("remove event should be ignored"); rule->ignore_remove = 1; } + pos = strstr(value, "link_priority="); + if (pos != NULL) { + rule->link_priority = atoi(&pos[strlen("link_priority=")]); + info("link priority=%i", rule->link_priority); + } if (strstr(value, "all_partitions") != NULL) { dbg("creation of partition nodes requested"); rule->partitions = DEFAULT_PARTITIONS_COUNT; -- cgit v1.2.3-54-g00ecf From 2afb8cb37af32495e4f4ff9188e21cbe3a44ce6c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Mar 2007 16:02:22 +0100 Subject: pick actual valid device in udev_db_lookup_name --- udev_db.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/udev_db.c b/udev_db.c index 5ac016a051..728d74a030 100644 --- a/udev_db.c +++ b/udev_db.c @@ -275,8 +275,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) while (!found) { struct dirent *ent; char device[PATH_SIZE]; - char filename[PATH_SIZE]; - struct stat statbuf; + struct udevice *udev; ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') @@ -286,15 +285,27 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) strlcpy(device, ent->d_name, sizeof(device)); path_decode(device); - - dbg("looking at '%s'", device); - strlcpy(filename, sysfs_path, sizeof(filename)); - strlcat(filename, device, sizeof(filename)); - if (stat(filename, &statbuf) == 0) { - strlcpy(devpath, device, len); - found = 1; + udev = udev_device_init(); + if (udev == NULL) break; + if (udev_db_get_device(udev, device) == 0) { + char filename[PATH_SIZE]; + struct stat statbuf; + + info("found db entry '%s'", device); + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, name, sizeof(filename)); + /* make sure device entry matches dev_t */ + if (stat(filename, &statbuf) == 0) { + if (statbuf.st_rdev == udev->devt) { + info("node '%s' matches dev_t", udev->name); + strlcpy(devpath, device, len); + found = 1; + } + } } + udev_device_cleanup(udev); } closedir(dir); -- cgit v1.2.3-54-g00ecf From 6eee03ef45fa3b04cf7ac94fd5bc5f982a33bfb7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Mar 2007 17:24:39 +0100 Subject: cleanup already existing db-entries and db-index on device update --- udev_db.c | 19 +++++++++++-------- udev_device.c | 47 +++++++++++++++++++++++------------------------ 2 files changed, 34 insertions(+), 32 deletions(-) diff --git a/udev_db.c b/udev_db.c index 728d74a030..40082abf03 100644 --- a/udev_db.c +++ b/udev_db.c @@ -64,13 +64,13 @@ static int name_index(const char *devpath, const char *name, int add) strlcat(filename, device, sizeof(filename)); if (add) { - dbg("creating: '%s'", filename); + info("creating index: '%s'", filename); create_path(filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd > 0) close(fd); } else { - dbg("removing: '%s'", filename); + info("removing index: '%s'", filename); unlink(filename); delete_path(filename); } @@ -86,25 +86,23 @@ int udev_db_add_device(struct udevice *udev) devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); create_path(filename); - name_index(udev->dev->devpath, udev->name, 1); + unlink(filename); /* - * create only a symlink with the name as the target - * if we don't have any interesting data to remember + * don't waste tmpfs memory pages, if we don't have any data to store + * create fake db-file; store the node-name in a symlink target */ if (list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && !udev->partitions && !udev->ignore_remove) { dbg("nothing interesting to store, create symlink"); - unlink(filename); if (symlink(udev->name, filename) != 0) { err("unable to create db link '%s': %s", filename, strerror(errno)); return -1; } } else { - struct name_entry *name_loop; FILE *f; + struct name_entry *name_loop; - unlink(filename); f = fopen(filename, "w"); if (f == NULL) { err("unable to create db file '%s': %s", filename, strerror(errno)); @@ -115,6 +113,7 @@ int udev_db_add_device(struct udevice *udev) fprintf(f, "N:%s\n", udev->name); list_for_each_entry(name_loop, &udev->symlink_list, node) { fprintf(f, "S:%s\n", name_loop->name); + /* add symlink-name to index */ name_index(udev->dev->devpath, name_loop->name, 1); } fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); @@ -128,6 +127,10 @@ int udev_db_add_device(struct udevice *udev) fprintf(f, "E:%s\n", name_loop->name); fclose(f); } + + /* add name to index */ + name_index(udev->dev->devpath, udev->name, 1); + return 0; } diff --git a/udev_device.c b/udev_device.c index 91fa655480..daf94a5772 100644 --- a/udev_device.c +++ b/udev_device.c @@ -162,40 +162,39 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) goto exit; } - /* read current database entry, we may want to cleanup symlinks */ + /* read current database entry, we may need to cleanup */ udev_old = udev_device_init(); if (udev_old != NULL) { - if (udev_db_get_device(udev_old, udev->dev->devpath) != 0) { + if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { + info("device '%s' already in database, cleanup", udev->dev->devpath); + udev_db_delete_device(udev_old); + } else { udev_device_cleanup(udev_old); udev_old = NULL; - } else - info("device '%s' already in database, validate currently present symlinks", - udev->dev->devpath); + } } /* create node and symlinks */ retval = udev_node_add(udev, udev_old); - if (retval == 0) { - /* store record in database */ + if (retval == 0) udev_db_add_device(udev); - /* remove possibly left-over symlinks */ - if (udev_old != NULL) { - struct name_entry *link_loop; - struct name_entry *link_old_loop; - struct name_entry *link_old_tmp_loop; - - /* remove still valid symlinks from old list */ - list_for_each_entry_safe(link_old_loop, link_old_tmp_loop, &udev_old->symlink_list, node) - list_for_each_entry(link_loop, &udev->symlink_list, node) - if (strcmp(link_old_loop->name, link_loop->name) == 0) { - dbg("symlink '%s' still valid, keep it", link_old_loop->name); - list_del(&link_old_loop->node); - free(link_old_loop); - } - udev_node_remove_symlinks(udev_old); - udev_device_cleanup(udev_old); - } + /* remove possibly left-over symlinks */ + if (udev_old != NULL) { + struct name_entry *link_loop; + struct name_entry *link_old_loop; + struct name_entry *link_old_tmp_loop; + + /* remove still valid symlinks from old list */ + list_for_each_entry_safe(link_old_loop, link_old_tmp_loop, &udev_old->symlink_list, node) + list_for_each_entry(link_loop, &udev->symlink_list, node) + if (strcmp(link_old_loop->name, link_loop->name) == 0) { + dbg("symlink '%s' still valid, keep it", link_old_loop->name); + list_del(&link_old_loop->node); + free(link_old_loop); + } + udev_node_remove_symlinks(udev_old); + udev_device_cleanup(udev_old); } goto exit; } -- cgit v1.2.3-54-g00ecf From 456cb387567da8a2beadf003dcbd874022dbc873 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Mar 2007 21:13:07 +0100 Subject: selinux: move selinux_exit() to the main programs --- test-udev.c | 1 + udev_node.c | 1 - udevd.c | 1 + udevstart.c | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/test-udev.c b/test-udev.c index bbe50eeeb4..e40a448436 100644 --- a/test-udev.c +++ b/test-udev.c @@ -175,6 +175,7 @@ int main(int argc, char *argv[], char *envp[]) fail: udev_rules_cleanup(&rules); sysfs_cleanup(); + selinux_exit(); exit: logging_close(); diff --git a/udev_node.c b/udev_node.c index d069dfc4aa..1632c2cc3c 100644 --- a/udev_node.c +++ b/udev_node.c @@ -237,7 +237,6 @@ int udev_node_add(struct udevice *udev, struct udevice *udev_old) } exit: - selinux_exit(); return retval; } diff --git a/udevd.c b/udevd.c index 2c92590dcd..4aad165d8a 100644 --- a/udevd.c +++ b/udevd.c @@ -1230,6 +1230,7 @@ int main(int argc, char *argv[], char *envp[]) exit: udev_rules_cleanup(&rules); sysfs_cleanup(); + selinux_exit(); if (signal_pipe[READ_END] >= 0) close(signal_pipe[READ_END]); diff --git a/udevstart.c b/udevstart.c index 6e1cb050c4..6ea18272ea 100644 --- a/udevstart.c +++ b/udevstart.c @@ -367,6 +367,7 @@ int main(int argc, char *argv[], char *envp[]) udev_rules_cleanup(&rules); sysfs_cleanup(); + selinux_exit(); logging_close(); return 0; } -- cgit v1.2.3-54-g00ecf From d7fdcd61927e9439ad7079bb0967e0b6edac7646 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Mar 2007 21:15:54 +0100 Subject: remove old error message --- udev_node.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/udev_node.c b/udev_node.c index 1632c2cc3c..ed323e9449 100644 --- a/udev_node.c +++ b/udev_node.c @@ -337,10 +337,8 @@ int udev_node_remove(struct udevice *udev) int i; info("removing all_partitions '%s[1-%i]'", filename, num); - if (num > 255) { - info("garbage from udev database, skip all_partitions removal"); + if (num > 255) return -1; - } for (i = 1; i <= num; i++) { snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); partitionname[sizeof(partitionname)-1] = '\0'; -- cgit v1.2.3-54-g00ecf From 31de3a2ba18ffa011f5054016ccc4a500cbe0cc3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 17 Mar 2007 10:08:25 +0100 Subject: read list of devices from index, make index private to database --- test-udev.c | 2 +- udev.h | 3 ++- udev_db.c | 42 +++++++++++++++++++++++++++++++++++++++++- udev_device.c | 13 ++++++------- udev_node.c | 2 +- udev_rules.c | 4 ++-- udevd.c | 2 +- udevinfo.c | 50 ++++++++++++++++++++++++++++++++++++++++---------- udevstart.c | 2 +- udevtest.c | 2 +- 10 files changed, 96 insertions(+), 26 deletions(-) diff --git a/test-udev.c b/test-udev.c index e40a448436..ba36015911 100644 --- a/test-udev.c +++ b/test-udev.c @@ -136,7 +136,7 @@ int main(int argc, char *argv[], char *envp[]) goto fail; } - udev = udev_device_init(); + udev = udev_device_init(NULL); if (udev == NULL) goto fail; diff --git a/udev.h b/udev.h index 31542243e2..16a107a33d 100644 --- a/udev.h +++ b/udev.h @@ -99,7 +99,7 @@ extern int udev_run; extern void udev_config_init(void); /* udev_device.c */ -extern struct udevice *udev_device_init(void); +extern struct udevice *udev_device_init(struct udevice *udev); extern void udev_device_cleanup(struct udevice *udev); extern int udev_device_event(struct udev_rules *rules, struct udevice *udev); extern dev_t udev_device_get_devt(struct udevice *udev); @@ -127,6 +127,7 @@ extern int udev_db_add_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); extern int udev_db_get_device(struct udevice *udev, const char *devpath); extern int udev_db_lookup_name(const char *name, char *devpath, size_t len); +extern int udev_db_get_devices_by_name(const char *name, struct list_head *name_list); extern int udev_db_get_all_entries(struct list_head *name_list); /* udev_utils.c */ diff --git a/udev_db.c b/udev_db.c index 40082abf03..8c9e474ad4 100644 --- a/udev_db.c +++ b/udev_db.c @@ -77,6 +77,46 @@ static int name_index(const char *devpath, const char *name, int add) return 0; } +int udev_db_get_devices_by_name(const char *name, struct list_head *name_list) +{ + char dirname[PATH_MAX]; + size_t start; + DIR *dir; + int rc = 0; + + strlcpy(dirname, udev_root, sizeof(dirname)); + start = strlcat(dirname, "/"DB_NAME_INDEX_DIR"/", sizeof(dirname)); + strlcat(dirname, name, sizeof(dirname)); + path_encode(&dirname[start], sizeof(dirname) - start); + + dir = opendir(dirname); + if (dir == NULL) { + info("no index directory '%s': %s", dirname, strerror(errno)); + rc = -1; + goto out; + } + + info("found index directory '%s'", dirname); + while (1) { + struct dirent *ent; + char device[PATH_SIZE]; + + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + if (ent->d_name[0] == '.') + continue; + + strlcpy(device, ent->d_name, sizeof(device)); + path_decode(device); + name_list_add(name_list, device, 0); + rc++; + } + closedir(dir); +out: + return rc; +} + int udev_db_add_device(struct udevice *udev) { char filename[PATH_SIZE]; @@ -288,7 +328,7 @@ int udev_db_lookup_name(const char *name, char *devpath, size_t len) strlcpy(device, ent->d_name, sizeof(device)); path_decode(device); - udev = udev_device_init(); + udev = udev_device_init(NULL); if (udev == NULL) break; if (udev_db_get_device(udev, device) == 0) { diff --git a/udev_device.c b/udev_device.c index daf94a5772..4cd5526dea 100644 --- a/udev_device.c +++ b/udev_device.c @@ -33,11 +33,10 @@ #include "udev_rules.h" -struct udevice *udev_device_init(void) +struct udevice *udev_device_init(struct udevice *udev) { - struct udevice *udev; - - udev = malloc(sizeof(struct udevice)); + if (udev == NULL) + udev = malloc(sizeof(struct udevice)); if (udev == NULL) return NULL; memset(udev, 0x00, sizeof(struct udevice)); @@ -162,8 +161,8 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) goto exit; } - /* read current database entry, we may need to cleanup */ - udev_old = udev_device_init(); + /* read current database entry; cleanup, if it is known device */ + udev_old = udev_device_init(NULL); if (udev_old != NULL) { if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { info("device '%s' already in database, cleanup", udev->dev->devpath); @@ -241,7 +240,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { struct name_entry *name_loop; - /* import and delete database entry */ + /* import database entry, and delete it */ if (udev_db_get_device(udev, udev->dev->devpath) == 0) { udev_db_delete_device(udev); if (udev->ignore_remove) { diff --git a/udev_node.c b/udev_node.c index ed323e9449..1558df849c 100644 --- a/udev_node.c +++ b/udev_node.c @@ -275,7 +275,7 @@ void udev_node_remove_symlinks(struct udevice *udev) struct udevice *old; info("found overwritten symlink '%s' of '%s'", name_loop->name, devpath); - old = udev_device_init(); + old = udev_device_init(NULL); if (old != NULL) { if (udev_db_get_device(old, devpath) == 0) { char slink[PATH_SIZE]; diff --git a/udev_rules.c b/udev_rules.c index c0f4cd2077..ea02b8e945 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -236,7 +236,7 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) struct name_entry *name_loop; dbg("found parent '%s', get the node name", dev_parent->devpath); - udev_parent = udev_device_init(); + udev_parent = udev_device_init(NULL); if (udev_parent == NULL) return -1; /* import the udev_db of the parent */ @@ -518,7 +518,7 @@ found: struct udevice *udev_parent; dbg("found parent '%s', get the node name", dev_parent->devpath); - udev_parent = udev_device_init(); + udev_parent = udev_device_init(NULL); if (udev_parent != NULL) { /* lookup the name in the udev_db with the DEVPATH of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { diff --git a/udevd.c b/udevd.c index 4aad165d8a..8f3329ea63 100644 --- a/udevd.c +++ b/udevd.c @@ -124,7 +124,7 @@ static int udev_event_process(struct udevd_uevent_msg *msg) for (i = 0; msg->envp[i]; i++) putenv(msg->envp[i]); - udev = udev_device_init(); + udev = udev_device_init(NULL); if (udev == NULL) return -1; strlcpy(udev->action, msg->action, sizeof(udev->action)); diff --git a/udevinfo.c b/udevinfo.c index 3f47add87c..e892b1092e 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -167,7 +167,7 @@ static void export_db(void fnct(struct udevice *udev)) { list_for_each_entry(name_loop, &name_list, node) { struct udevice *udev_db; - udev_db = udev_device_init(); + udev_db = udev_device_init(NULL); if (udev_db == NULL) continue; if (udev_db_get_device(udev_db, name_loop->name) == 0) @@ -177,6 +177,41 @@ static void export_db(void fnct(struct udevice *udev)) { name_list_cleanup(&name_list); } +static int lookup_device_by_name(struct udevice *udev, const char *name) +{ + LIST_HEAD(name_list); + struct name_entry *device; + int rc = -1; + + if (udev_db_get_devices_by_name(name, &name_list) <= 0) + goto out; + + /* select the device that matches the dev_t of name */ + list_for_each_entry(device, &name_list, node) { + char filename[PATH_SIZE]; + struct stat statbuf; + + udev_device_init(udev); + if (udev_db_get_device(udev, device->name) != 0) + continue; + info("found db entry '%s'", device->name); + + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, name, sizeof(filename)); + if (stat(filename, &statbuf) != 0) + continue; + if (statbuf.st_rdev == udev->devt) { + info("found '%s', dev_t matches", udev->name); + rc = 0; + break; + } + } +out: + name_list_cleanup(&name_list); + return rc; +} + int main(int argc, char *argv[], char *envp[]) { int option; @@ -220,7 +255,7 @@ int main(int argc, char *argv[], char *envp[]) udev_config_init(); sysfs_init(); - udev = udev_device_init(); + udev = udev_device_init(NULL); if (udev == NULL) { rc = 1; goto exit; @@ -330,14 +365,11 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } } else if (name[0] != '\0') { - char devpath[PATH_SIZE]; - - if (udev_db_lookup_name(name, devpath, sizeof(devpath)) != 0) { + if (lookup_device_by_name(udev, name) != 0) { fprintf(stderr, "node name not found\n"); rc = 4; goto exit; } - udev_db_get_device(udev, devpath); } else { fprintf(stderr, "query needs --path or node --name specified\n"); rc = 4; @@ -385,14 +417,12 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } } else if (name[0] != '\0') { - char devpath[PATH_SIZE]; - - if (udev_db_lookup_name(name, devpath, sizeof(devpath)) != 0) { + if (lookup_device_by_name(udev, name) != 0) { fprintf(stderr, "node name not found\n"); rc = 4; goto exit; } - if (print_device_chain(devpath) != 0) { + if (print_device_chain(udev->dev->devpath) != 0) { fprintf(stderr, "device not found\n"); rc = 4; goto exit; diff --git a/udevstart.c b/udevstart.c index 6ea18272ea..a381c411a8 100644 --- a/udevstart.c +++ b/udevstart.c @@ -120,7 +120,7 @@ static int add_device(const char *devpath) if (dev == NULL) return -1; - udev = udev_device_init(); + udev = udev_device_init(NULL); if (udev == NULL) return -1; diff --git a/udevtest.c b/udevtest.c index 73bf7dd1f8..bb889a70fd 100644 --- a/udevtest.c +++ b/udevtest.c @@ -97,7 +97,7 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - udev = udev_device_init(); + udev = udev_device_init(NULL); if (udev == NULL) { fprintf(stderr, "error initializing device\n"); rc = 3; -- cgit v1.2.3-54-g00ecf From 24f0605c1fec98b77eddb880a405289b08cb5670 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Mar 2007 12:51:57 +0100 Subject: priority based symlink handling Symlinks can have priorities now, the priority is assigned to the device and specified with OPTIONS="link_priority=100". Devices with higher priorities overwrite the symlinks of devices with lower priorities. If the device, that currently owns the link goes away, the symlink will be removed, and recreated, pointing to the next device with the highest actual priority. This should solve the issue, that inserting an USB-stick may overwrite the /dev/disk/by-id/-link of another disk, and removes the entire link after the USB-stick is disconnected. If no priorities are specified, the new link will overwrite the current one, and if the device goes away, it will restore the old link. It should be possible to assign lower priorities to removable devices, if needed. In multipath setups, we see several devices, which all connect to the same volume, and therefore all try to create the same metadata-links. The different path-devices are combined into one device-mapper device, which also contains the same metadata. It should be possible, to assign multipath-table device-mapper devices a higher priority, so path-devices that appear and disappear, will not overwrite or delete the device-mapper device links. --- udev.h | 5 +- udev_db.c | 62 ---------------- udev_device.c | 38 +++++----- udev_node.c | 235 +++++++++++++++++++++++++++++++++------------------------- 4 files changed, 152 insertions(+), 188 deletions(-) diff --git a/udev.h b/udev.h index 16a107a33d..5bd0e301c6 100644 --- a/udev.h +++ b/udev.h @@ -118,15 +118,14 @@ extern int sysfs_resolve_link(char *path, size_t size); /* udev_node.c */ extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); -extern int udev_node_add(struct udevice *udev, struct udevice *udev_old); -extern void udev_node_remove_symlinks(struct udevice *udev); +extern void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old); +extern int udev_node_add(struct udevice *udev); extern int udev_node_remove(struct udevice *udev); /* udev_db.c */ extern int udev_db_add_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); extern int udev_db_get_device(struct udevice *udev, const char *devpath); -extern int udev_db_lookup_name(const char *name, char *devpath, size_t len); extern int udev_db_get_devices_by_name(const char *name, struct list_head *name_list); extern int udev_db_get_all_entries(struct list_head *name_list); diff --git a/udev_db.c b/udev_db.c index 8c9e474ad4..83d3f9bbf8 100644 --- a/udev_db.c +++ b/udev_db.c @@ -296,68 +296,6 @@ int udev_db_delete_device(struct udevice *udev) return 0; } -int udev_db_lookup_name(const char *name, char *devpath, size_t len) -{ - char dirname[PATH_MAX]; - size_t start; - DIR *dir; - int found = 0; - - strlcpy(dirname, udev_root, sizeof(dirname)); - start = strlcat(dirname, "/"DB_NAME_INDEX_DIR"/", sizeof(dirname)); - strlcat(dirname, name, sizeof(dirname)); - path_encode(&dirname[start], sizeof(dirname) - start); - - dir = opendir(dirname); - if (dir == NULL) { - info("no index directory '%s': %s", dirname, strerror(errno)); - return -1; - } - - info("found index directory '%s'", dirname); - while (!found) { - struct dirent *ent; - char device[PATH_SIZE]; - struct udevice *udev; - - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - if (ent->d_name[0] == '.') - continue; - - strlcpy(device, ent->d_name, sizeof(device)); - path_decode(device); - udev = udev_device_init(NULL); - if (udev == NULL) - break; - if (udev_db_get_device(udev, device) == 0) { - char filename[PATH_SIZE]; - struct stat statbuf; - - info("found db entry '%s'", device); - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, name, sizeof(filename)); - /* make sure device entry matches dev_t */ - if (stat(filename, &statbuf) == 0) { - if (statbuf.st_rdev == udev->devt) { - info("node '%s' matches dev_t", udev->name); - strlcpy(devpath, device, len); - found = 1; - } - } - } - udev_device_cleanup(udev); - } - - closedir(dir); - if (found) - return 0; - else - return -1; -} - int udev_db_get_all_entries(struct list_head *name_list) { char dbpath[PATH_MAX]; diff --git a/udev_device.c b/udev_device.c index 4cd5526dea..24f65ca045 100644 --- a/udev_device.c +++ b/udev_device.c @@ -173,28 +173,19 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) } } - /* create node and symlinks */ - retval = udev_node_add(udev, udev_old); - if (retval == 0) - udev_db_add_device(udev); + /* create node */ + retval = udev_node_add(udev); + if (retval != 0) + goto exit; - /* remove possibly left-over symlinks */ - if (udev_old != NULL) { - struct name_entry *link_loop; - struct name_entry *link_old_loop; - struct name_entry *link_old_tmp_loop; - - /* remove still valid symlinks from old list */ - list_for_each_entry_safe(link_old_loop, link_old_tmp_loop, &udev_old->symlink_list, node) - list_for_each_entry(link_loop, &udev->symlink_list, node) - if (strcmp(link_old_loop->name, link_loop->name) == 0) { - dbg("symlink '%s' still valid, keep it", link_old_loop->name); - list_del(&link_old_loop->node); - free(link_old_loop); - } - udev_node_remove_symlinks(udev_old); + /* store in database */ + udev_db_add_device(udev); + + /* create, replace, delete symlinks according to priority */ + udev_node_update_symlinks(udev, udev_old); + + if (udev_old != NULL) udev_device_cleanup(udev_old); - } goto exit; } @@ -251,7 +242,8 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) list_for_each_entry(name_loop, &udev->env_list, node) putenv(name_loop->name); } else { - dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel); + dbg("'%s' not found in database, using kernel name '%s'", + udev->dev->devpath, udev->dev->kernel); strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); } @@ -261,7 +253,11 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) goto exit; } + /* remove the node */ retval = udev_node_remove(udev); + + /* delete or restore symlinks according to priority */ + udev_node_update_symlinks(udev, NULL); goto exit; } diff --git a/udev_node.c b/udev_node.c index 1558df849c..526d713516 100644 --- a/udev_node.c +++ b/udev_node.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -114,7 +115,7 @@ static int node_symlink(const char *node, const char *slink) if (len > 0) { buf[len] = '\0'; if (strcmp(target, buf) == 0) { - info("preserving symlink '%s' to '%s'", slink, target); + info("preserve already existing symlink '%s' to '%s'", slink, target); selinux_setfilecon(slink, NULL, S_IFLNK); goto exit; } @@ -133,7 +134,131 @@ exit: return 0; } -int udev_node_add(struct udevice *udev, struct udevice *udev_old) +static int update_link(struct udevice *udev, const char *name) +{ + LIST_HEAD(name_list); + char slink[PATH_SIZE]; + char node[PATH_SIZE]; + struct udevice *udev_db; + struct name_entry *device; + char target[PATH_MAX] = ""; + int count; + int priority = 0; + int rc = 0; + + strlcpy(slink, udev_root, sizeof(slink)); + strlcat(slink, "/", sizeof(slink)); + strlcat(slink, name, sizeof(slink)); + + count = udev_db_get_devices_by_name(name, &name_list); + info("found %i devices with name '%s'", count, name); + + /* if we don't have any reference, we can delete the link */ + if (count <= 0) { + info("no reference left, remove '%s'", name); + if (!udev->test_run) { + unlink(slink); + delete_path(slink); + } + goto out; + } + + /* find the device with the highest priority */ + list_for_each_entry(device, &name_list, node) { + info("found '%s' for '%s'", device->name, name); + + /* did we find ourself? we win, if we have the same priority */ + if (strcmp(udev->dev->devpath, device->name) == 0) { + info("compare (our own) priority of '%s' %i >= %i", + udev->dev->devpath, udev->link_priority, priority); + if (target[0] == '\0' || udev->link_priority >= priority) { + priority = udev->link_priority; + strlcpy(target, udev->name, sizeof(target)); + } + continue; + } + + /* or something else, then read priority from database */ + udev_db = udev_device_init(NULL); + if (udev_db == NULL) + continue; + if (udev_db_get_device(udev_db, device->name) == 0) { + info("compare priority of '%s' %i > %i", + udev_db->dev->devpath, udev_db->link_priority, priority); + if (target[0] == '\0' || udev_db->link_priority > priority) { + priority = udev_db->link_priority; + strlcpy(target, udev_db->name, sizeof(target)); + } + } + udev_device_cleanup(udev_db); + } + name_list_cleanup(&name_list); + + if (target[0] == '\0') { + err("missing target for '%s'", name); + rc = -1; + goto out; + } + + /* create symlink to the target with the highest priority */ + strlcpy(node, udev_root, sizeof(node)); + strlcat(node, "/", sizeof(node)); + strlcat(node, target, sizeof(node)); + info("'%s' with target '%s' has the highest priority %i, create it", name, target, priority); + if (!udev->test_run) { + create_path(slink); + node_symlink(node, slink); + } +out: + return rc; +} + +void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) +{ + struct name_entry *name_loop; + char symlinks[PATH_SIZE] = ""; + + list_for_each_entry(name_loop, &udev->symlink_list, node) { + info("update symlink '%s' of '%s'", name_loop->name, udev->dev->devpath); + update_link(udev, name_loop->name); + strlcat(symlinks, udev_root, sizeof(symlinks)); + strlcat(symlinks, "/", sizeof(symlinks)); + strlcat(symlinks, name_loop->name, sizeof(symlinks)); + strlcat(symlinks, " ", sizeof(symlinks)); + } + + /* export symlinks to environment */ + remove_trailing_chars(symlinks, ' '); + if (symlinks[0] != '\0') + setenv("DEVLINKS", symlinks, 1); + + /* update possible left-over symlinks (device metadata changed) */ + if (udev_old != NULL) { + struct name_entry *link_loop; + struct name_entry *link_old_loop; + struct name_entry *link_old_tmp_loop; + int found; + + /* remove current symlinks from old list */ + list_for_each_entry_safe(link_old_loop, link_old_tmp_loop, &udev_old->symlink_list, node) { + found = 0; + list_for_each_entry(link_loop, &udev->symlink_list, node) { + if (strcmp(link_old_loop->name, link_loop->name) == 0) { + found = 1; + break; + } + } + if (!found) { + /* link does no longer belong to this device */ + info("update old symlink '%s' no longer belonging to '%s'", + link_old_loop->name, udev->dev->devpath); + update_link(udev, link_old_loop->name); + } + } + } +} + +int udev_node_add(struct udevice *udev) { char filename[PATH_SIZE]; uid_t uid; @@ -141,10 +266,9 @@ int udev_node_add(struct udevice *udev, struct udevice *udev_old) int i; int retval = 0; - snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); - filename[sizeof(filename)-1] = '\0'; - - /* create parent directories if needed */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, udev->name, sizeof(filename)); create_path(filename); if (strcmp(udev->owner, "root") == 0) @@ -209,102 +333,10 @@ int udev_node_add(struct udevice *udev, struct udevice *udev_old) } } } - - /* create symlink(s) if requested */ - if (!list_empty(&udev->symlink_list)) { - struct name_entry *name_loop; - char symlinks[PATH_SIZE] = ""; - - list_for_each_entry(name_loop, &udev->symlink_list, node) { - char slink[PATH_SIZE]; - - strlcpy(slink, udev_root, sizeof(slink)); - strlcat(slink, "/", sizeof(slink)); - strlcat(slink, name_loop->name, sizeof(slink)); - - info("creating symlink '%s' to node '%s'", slink, filename); - if (!udev->test_run) { - create_path(slink); - node_symlink(filename, slink); - } - - strlcat(symlinks, slink, sizeof(symlinks)); - strlcat(symlinks, " ", sizeof(symlinks)); - } - - remove_trailing_chars(symlinks, ' '); - setenv("DEVLINKS", symlinks, 1); - } - exit: return retval; } -void udev_node_remove_symlinks(struct udevice *udev) -{ - char filename[PATH_SIZE]; - struct name_entry *name_loop; - struct stat stats; - - if (!list_empty(&udev->symlink_list)) { - char symlinks[PATH_SIZE] = ""; - - list_for_each_entry(name_loop, &udev->symlink_list, node) { - char devpath[PATH_SIZE]; - - snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name); - filename[sizeof(filename)-1] = '\0'; - - if (stat(filename, &stats) != 0) { - dbg("symlink '%s' not found", filename); - continue; - } - if (udev->devt && stats.st_rdev != udev->devt) { - info("symlink '%s' points to a different device, skip removal", filename); - continue; - } - - info("removing symlink '%s'", filename); - if (!udev->test_run) { - unlink(filename); - delete_path(filename); - } - - /* see if another device wants this symlink */ - if (udev_db_lookup_name(name_loop->name, devpath, sizeof(devpath)) == 0) { - struct udevice *old; - - info("found overwritten symlink '%s' of '%s'", name_loop->name, devpath); - old = udev_device_init(NULL); - if (old != NULL) { - if (udev_db_get_device(old, devpath) == 0) { - char slink[PATH_SIZE]; - char node[PATH_SIZE]; - - strlcpy(slink, udev_root, sizeof(slink)); - strlcat(slink, "/", sizeof(slink)); - strlcat(slink, name_loop->name, sizeof(slink)); - strlcpy(node, udev_root, sizeof(node)); - strlcat(node, "/", sizeof(node)); - strlcat(node, old->name, sizeof(node)); - info("restore symlink '%s' to '%s'", slink, node); - if (!udev->test_run) - node_symlink(node, slink); - } - udev_device_cleanup(old); - } - } - - strlcat(symlinks, filename, sizeof(symlinks)); - strlcat(symlinks, " ", sizeof(symlinks)); - } - - remove_trailing_chars(symlinks, ' '); - if (symlinks[0] != '\0') - setenv("DEVLINKS", symlinks, 1); - } -} - int udev_node_remove(struct udevice *udev) { char filename[PATH_SIZE]; @@ -313,10 +345,9 @@ int udev_node_remove(struct udevice *udev) int retval; int num; - udev_node_remove_symlinks(udev); - - snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name); - filename[sizeof(filename)-1] = '\0'; + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, udev->name, sizeof(filename)); if (stat(filename, &stats) != 0) { dbg("device node '%s' not found", filename); return -1; -- cgit v1.2.3-54-g00ecf From f0f7c715ae59a0a08019a6a697c5bd0a490b6f0c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Mar 2007 12:55:21 +0100 Subject: volume_id: get rid of compiler warning --- extras/volume_id/vol_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 92f00e0c50..0427d70da1 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -183,7 +183,7 @@ int main(int argc, char *argv[]) if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) size = 0; - dbg("BLKGETSIZE64=%llu", size); + dbg("BLKGETSIZE64=%llu", (unsigned long long)size); /* try to drop all privileges before reading disk content */ pw = getpwnam ("nobody"); -- cgit v1.2.3-54-g00ecf From 3045132a0df944c33f459f4e8cafdc6b84800174 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Mar 2007 15:08:53 +0100 Subject: udevinfo: remove -d option --- TODO | 3 --- udevinfo.c | 21 +++++---------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/TODO b/TODO index 5d5a058e98..881f7c1ee2 100644 --- a/TODO +++ b/TODO @@ -11,9 +11,6 @@ These things will change in future udev versions: These things are deprecated and scheduled for removal in a future udev version: - o remove old udevdb dump 'udevinfo -d' - (-e exports everything) - o remove udevstart (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer want to guess event properties from sysfs like udevstart is doing it) diff --git a/udevinfo.c b/udevinfo.c index e892b1092e..52c49b824f 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -150,16 +150,7 @@ static void print_record(struct udevice *udev) printf("E: %s\n", name_loop->name); } -static void export_name_devpath(struct udevice *udev) { - printf("%s=%s/%s\n", udev->dev->devpath, udev_root, udev->name); -} - -static void export_record(struct udevice *udev) { - print_record(udev); - printf("\n"); -} - -static void export_db(void fnct(struct udevice *udev)) { +static void export_db(void) { LIST_HEAD(name_list); struct name_entry *name_loop; @@ -171,7 +162,8 @@ static void export_db(void fnct(struct udevice *udev)) { if (udev_db == NULL) continue; if (udev_db_get_device(udev_db, name_loop->name) == 0) - fnct(udev_db); + print_record(udev_db); + printf("\n"); udev_device_cleanup(udev_db); } name_list_cleanup(&name_list); @@ -263,7 +255,7 @@ int main(int argc, char *argv[], char *envp[]) /* get command line options */ while (1) { - option = getopt_long(argc, argv, "aden:p:q:rVh", options, NULL); + option = getopt_long(argc, argv, "aen:p:q:rVh", options, NULL); if (option == -1) break; @@ -319,11 +311,8 @@ int main(int argc, char *argv[], char *envp[]) case 'a': action = ACTION_ATTRIBUTE_WALK; break; - case 'd': - export_db(export_name_devpath); - goto exit; case 'e': - export_db(export_record); + export_db(); goto exit; case 1: printf("%s\n", UDEV_VERSION); -- cgit v1.2.3-54-g00ecf From eb5b86405b14ca2ac2508f9dec9862cc57110131 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 19 Mar 2007 09:56:53 +0100 Subject: update %n on netif name change --- udev_device.c | 11 +++++++---- udev_rules.c | 2 +- udev_sysfs.c | 1 - 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/udev_device.c b/udev_device.c index 24f65ca045..03514e1d48 100644 --- a/udev_device.c +++ b/udev_device.c @@ -204,6 +204,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* look if we want to change the name of the netif */ if (strcmp(udev->name, udev->dev->kernel) != 0) { + char devpath[PATH_MAX]; char *pos; retval = rename_netif(udev); @@ -214,14 +215,16 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* export old name */ setenv("INTERFACE_OLD", udev->dev->kernel, 1); - /* now fake the devpath, because the kernel name changed silently */ - pos = strrchr(udev->dev->devpath, '/'); + /* now change the devpath, because the kernel device name has changed */ + strlcpy(devpath, udev->dev->devpath, sizeof(devpath)); + pos = strrchr(devpath, '/'); if (pos != NULL) { pos[1] = '\0'; - strlcat(udev->dev->devpath, udev->name, sizeof(udev->dev->devpath)); - strlcpy(udev->dev->kernel, udev->name, sizeof(udev->dev->kernel)); + strlcat(devpath, udev->name, sizeof(devpath)); + sysfs_device_set_values(udev->dev, devpath, NULL, NULL); setenv("DEVPATH", udev->dev->devpath, 1); setenv("INTERFACE", udev->name, 1); + info("changed devpath to '%s'", udev->dev->devpath); } } goto exit; diff --git a/udev_rules.c b/udev_rules.c index ea02b8e945..f8844a8438 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -289,7 +289,7 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) info("file '%s' appeared after %i loops", filepath, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } - /* make sure the device does not have disappeared in the meantime */ + /* make sure, the device did not disappear in the meantime */ if (stat(devicepath, &stats) != 0) { info("device disappeared while waiting for '%s'", filepath); return -2; diff --git a/udev_sysfs.c b/udev_sysfs.c index 7431dd6111..1846a42f6a 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -92,7 +92,6 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, pos = strrchr(dev->devpath, '/'); if (pos == NULL) return; - strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); dbg("kernel='%s'", dev->kernel); -- cgit v1.2.3-54-g00ecf From 604f104af43aa40ff07e43179909604a9a780800 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 19 Mar 2007 11:57:54 +0100 Subject: if a node goes away, possibly restore a waiting symlink --- udev_node.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/udev_node.c b/udev_node.c index 526d713516..f30ae876ec 100644 --- a/udev_node.c +++ b/udev_node.c @@ -44,7 +44,7 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m else mode |= S_IFCHR; - if (stat(file, &stats) != 0) + if (lstat(file, &stats) != 0) goto create; /* preserve node with already correct numbers, to prevent changing the inode number */ @@ -255,6 +255,9 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) update_link(udev, link_old_loop->name); } } + + /* the old node is gone, maybe we have a device with a symlink now */ + update_link(udev, udev_old->name); } } -- cgit v1.2.3-54-g00ecf From 3d1f807b89a8963c5a5e1a5b75a32a2ba71a61bd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 19 Mar 2007 12:50:44 +0100 Subject: update TODO --- TODO | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 881f7c1ee2..129ae9df10 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,4 @@ These things would be nice to have: - o log the relationship of the kernel name and the persistent disk name - to syslog, so any error logged from the kernel can be associated with - any of the links at that time These things will change in future udev versions: @@ -12,8 +9,8 @@ These things will change in future udev versions: These things are deprecated and scheduled for removal in a future udev version: o remove udevstart - (we rely on the kernel "uevent" triggers of kernel 2.6.15 and no longer - want to guess event properties from sysfs like udevstart is doing it) + (we rely on the kernel "uevent"-triggers of kernel 2.6.15 and no longer + want to guess event-properties from sysfs like udevstart is doing it) o remove extra for /etc/dev.d/ /etc/hotplug.d/ (that inefficient stuff should finally go away) -- cgit v1.2.3-54-g00ecf From 7a17ca7e798bd97678eb5e053f710b35b4674250 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 19 Mar 2007 15:41:06 +0100 Subject: man: add "link_priority" option --- udev.7 | 28 ++++++++++++++++++++++++---- udev.xml | 46 ++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 62 insertions(+), 12 deletions(-) diff --git a/udev.7 b/udev.7 index 1eb766fd9e..a4b15886c7 100644 --- a/udev.7 +++ b/udev.7 @@ -258,14 +258,34 @@ Wait for the specified sysfs file of the device to be created. Can be used to fi .PP \fBOPTIONS\fR .RS 4 +Rule and device options: +.RS 4 +.PP \fBlast_rule\fR -stops further rules application. No later rules will have any effect. +.RS 4 +Stops further rules application. No later rules will have any effect. +.RE +.PP \fBignore_device\fR -will ignore this event completely. +.RS 4 +Ignore this event completely. +.RE +.PP \fBignore_remove\fR -will ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. +.RS 4 +Ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. +.RE +.PP +\fBlink_priority=\fR\fB\fIvalue\fR\fR +.RS 4 +Specify the priority of the created symlinks. Devices with higher priorities overwrite existing symlinks of other devices. +.RE +.PP \fBall_partitions\fR -will create the device nodes for all available partitions of a block device. This may be useful for removable media devices where media changes are not detected. +.RS 4 +Create the device nodes for all available partitions of a block device. This may be useful for removable media devices where media changes are not detected. +.RE +.RE .RE .PP The diff --git a/udev.xml b/udev.xml index e31df45458..5ba3d3636c 100644 --- a/udev.xml +++ b/udev.xml @@ -390,14 +390,44 @@ - stops further rules application. No later rules - will have any effect. - will ignore this event completely. - will ignore any later remove event for this - device. This may be useful as a workaround for broken device drivers. - will create the device nodes for all available - partitions of a block device. This may be useful for removable media devices where - media changes are not detected. + Rule and device options: + + + + + Stops further rules application. No later rules will have + any effect. + + + + + + Ignore this event completely. + + + + + + Ignore any later remove event for this device. This may be useful + as a workaround for broken device drivers. + + + + + + Specify the priority of the created symlinks. Devices with higher + priorities overwrite existing symlinks of other devices. + + + + + + Create the device nodes for all available partitions of a block device. + This may be useful for removable media devices where media changes are not + detected. + + + -- cgit v1.2.3-54-g00ecf From 7586b637193968e8ef15b12d984b975eec66a803 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Mar 2007 01:58:24 +0100 Subject: update SUSE rules --- etc/udev/suse/05-udev-early.rules | 2 +- etc/udev/suse/50-udev-default.rules | 3 +-- etc/udev/suse/60-persistent-storage.rules | 20 ++++++++++++++------ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/etc/udev/suse/05-udev-early.rules b/etc/udev/suse/05-udev-early.rules index 4dc497bac2..7e94ee95c9 100644 --- a/etc/udev/suse/05-udev-early.rules +++ b/etc/udev/suse/05-udev-early.rules @@ -1,3 +1,3 @@ # sysfs is populated after the event is sent -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +ACTION=="add", SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt" diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 74a8def6f5..2d4c418e1e 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -90,10 +90,9 @@ KERNEL=="auer[0-9]*" NAME="usb/%k" KERNEL=="pktcdvd", NAME="pktcdvd/control" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" -# fix floppy devices +# additional floppy devices (no sysfs entries) KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G disk $root/%k" -KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/rm -f $root/%k*" # block devices SUBSYSTEM=="block", GROUP="disk", MODE="0640" diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index 1ac915cc17..a946bc1d2e 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -2,6 +2,16 @@ # scheme based on "Linux persistent device names", 2004, Hannes Reinecke ACTION!="add", GOTO="persistent_storage_end" + +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" + +# type 8 devices are "Medium Changers" +KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices @@ -23,12 +33,10 @@ KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{iee KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}-part%n" -KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}" +KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}-part%n" KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From eff4a6736937fb9d55c09c598d0d232d38c5b06a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Mar 2007 11:55:26 +0100 Subject: udevtest: add --force mode --- udev_db.c | 3 +++ udev_device.c | 1 + udev_node.c | 21 +++++++++++++-------- udevtest.c | 55 +++++++++++++++++++++++++++++++++++++++++-------------- 4 files changed, 58 insertions(+), 22 deletions(-) diff --git a/udev_db.c b/udev_db.c index 83d3f9bbf8..00d68d6d13 100644 --- a/udev_db.c +++ b/udev_db.c @@ -286,6 +286,9 @@ int udev_db_delete_device(struct udevice *udev) char filename[PATH_SIZE]; struct name_entry *name_loop; + if (udev->test_run) + return 0; + devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); unlink(filename); diff --git a/udev_device.c b/udev_device.c index 03514e1d48..d50c5ae043 100644 --- a/udev_device.c +++ b/udev_device.c @@ -164,6 +164,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* read current database entry; cleanup, if it is known device */ udev_old = udev_device_init(NULL); if (udev_old != NULL) { + udev_old->test_run = udev->test_run; if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { info("device '%s' already in database, cleanup", udev->dev->devpath); udev_db_delete_device(udev_old); diff --git a/udev_node.c b/udev_node.c index f30ae876ec..b1bbda8369 100644 --- a/udev_node.c +++ b/udev_node.c @@ -153,7 +153,7 @@ static int update_link(struct udevice *udev, const char *name) count = udev_db_get_devices_by_name(name, &name_list); info("found %i devices with name '%s'", count, name); - /* if we don't have any reference, we can delete the link */ + /* if we don't have a reference, delete it */ if (count <= 0) { info("no reference left, remove '%s'", name); if (!udev->test_run) { @@ -236,11 +236,10 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) if (udev_old != NULL) { struct name_entry *link_loop; struct name_entry *link_old_loop; - struct name_entry *link_old_tmp_loop; int found; /* remove current symlinks from old list */ - list_for_each_entry_safe(link_old_loop, link_old_tmp_loop, &udev_old->symlink_list, node) { + list_for_each_entry(link_old_loop, &udev_old->symlink_list, node) { found = 0; list_for_each_entry(link_loop, &udev->symlink_list, node) { if (strcmp(link_old_loop->name, link_loop->name) == 0) { @@ -256,8 +255,12 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) } } - /* the old node is gone, maybe we have a device with a symlink now */ - update_link(udev, udev_old->name); + /* + * if the node name has changed, delete the node, + * or possibly restore a symlink of another device + */ + if (strcmp(udev->name, udev_old->name) != 0) + update_link(udev, udev_old->name); } } @@ -345,7 +348,7 @@ int udev_node_remove(struct udevice *udev) char filename[PATH_SIZE]; char partitionname[PATH_SIZE]; struct stat stats; - int retval; + int retval = 0; int num; strlcpy(filename, udev_root, sizeof(filename)); @@ -361,7 +364,8 @@ int udev_node_remove(struct udevice *udev) } info("removing device node '%s'", filename); - retval = unlink_secure(filename); + if (!udev->test_run) + retval = unlink_secure(filename); if (retval) return retval; @@ -376,7 +380,8 @@ int udev_node_remove(struct udevice *udev) for (i = 1; i <= num; i++) { snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); partitionname[sizeof(partitionname)-1] = '\0'; - unlink_secure(partitionname); + if (!udev->test_run) + unlink_secure(partitionname); } } delete_path(filename); diff --git a/udevtest.c b/udevtest.c index bb889a70fd..8c56dba0f1 100644 --- a/udevtest.c +++ b/udevtest.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "udev.h" #include "udev_rules.h" @@ -49,14 +50,22 @@ void log_message (int priority, const char *format, ...) int main(int argc, char *argv[], char *envp[]) { + int force = 0; + char *action = "add"; struct udev_rules rules = {}; char *devpath = NULL; struct udevice *udev; struct sysfs_device *dev; - int i; int retval; int rc = 0; + static const struct option options[] = { + { "action", 1, NULL, 'a' }, + { "force", 0, NULL, 'f' }, + { "help", 0, NULL, 'h' }, + {} + }; + info("version %s", UDEV_VERSION); udev_config_init(); if (udev_log_priority < LOG_INFO) { @@ -67,15 +76,32 @@ int main(int argc, char *argv[], char *envp[]) setenv("UDEV_LOG", priority, 1); } - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; - - if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { - printf("Usage: udevtest [--help] \n"); - goto exit; - } else - devpath = arg; + while (1) { + int option; + + option = getopt_long(argc, argv, "a:fh", options, NULL); + if (option == -1) + break; + + dbg("option '%c'", option); + switch (option) { + case 'a': + action = optarg; + break; + case 'f': + force = 1; + break; + case 'h': + printf("Usage: udevtest [--action=] [--force] [--help] \n" + " --action= set action string\n" + " --force don't skip node/link creation\n" + " --help print this help text\n\n"); + exit(0); + default: + exit(1); + } } + devpath = argv[optind]; if (devpath == NULL) { fprintf(stderr, "devpath parameter missing\n"); @@ -106,19 +132,20 @@ int main(int argc, char *argv[], char *envp[]) /* override built-in sysfs device */ udev->dev = dev; - strcpy(udev->action, "add"); + strcpy(udev->action, action); udev->devt = udev_device_get_devt(udev); /* simulate node creation with test flag */ - udev->test_run = 1; + if (!force) + udev->test_run = 1; setenv("DEVPATH", udev->dev->devpath, 1); setenv("SUBSYSTEM", udev->dev->subsystem, 1); setenv("ACTION", "add", 1); - printf("This program is for debugging only, it does not create any node,\n" - "or run any program specified by a RUN key. It may show incorrect results,\n" - "if rules match against subsystem specfic kernel event variables.\n" + printf("This program is for debugging only, it does not run any program,\n" + "specified by a RUN key. It may show incorrect results, if rules\n" + "match against subsystem specfic kernel event variables.\n" "\n"); info("looking at device '%s' from subsystem '%s'", udev->dev->devpath, udev->dev->subsystem); -- cgit v1.2.3-54-g00ecf From 3d0bb292b5738dc173285a0a3cf2703fd15ca9be Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Mar 2007 12:13:28 +0100 Subject: udevinfo: print link priority --- udevinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevinfo.c b/udevinfo.c index 52c49b824f..3f25be03f8 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -144,6 +144,7 @@ static void print_record(struct udevice *udev) printf("P: %s\n", udev->dev->devpath); printf("N: %s\n", udev->name); + printf("L: %i\n", udev->link_priority); list_for_each_entry(name_loop, &udev->symlink_list, node) printf("S: %s\n", name_loop->name); list_for_each_entry(name_loop, &udev->env_list, node) -- cgit v1.2.3-54-g00ecf From e578a447463ec58fd543f7b978b0804d37d854dd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Mar 2007 13:55:48 +0100 Subject: usb_id: append target:lun to storage device serial Some broken usb-storage devices implement multiple luns with all the same SCSI identifiers. Append the target:lun to get unique names in /dev/disk/by-id/. --- extras/usb_id/usb_id.c | 119 +++++++++++++++++++++++++++++-------------------- 1 file changed, 70 insertions(+), 49 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index ba8bfdf8c5..50918f060b 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "../../udev.h" @@ -55,12 +56,12 @@ void log_message(int priority, const char *format, ...) static char vendor_str[64]; static char model_str[64]; static char serial_str[MAX_SERIAL_LEN]; -static char revision_str[16]; -static char type_str[16]; +static char revision_str[64]; +static char type_str[64]; +static char instance_str[64]; static int use_usb_info; static int use_num_info; -static int export; static void set_str(char *to, const char *from, size_t count) { @@ -115,7 +116,7 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len) type = "printer"; break; case 8: - type = "disk"; + type = "storage"; break; case 2: /* CDC-Control */ case 5: /* Physical */ @@ -164,48 +165,40 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len break; } } - strncpy(to, type, len); - to[len-1] = '\0'; + strlcpy(to, type, len); return type_num; } -static void set_scsi_type(char *to, const char *from, int count) +static void set_scsi_type(char *to, const char *from, size_t len) { int type_num; char *eptr; + char *type = "generic"; type_num = strtoul(from, &eptr, 0); if (eptr != from) { switch (type_num) { case 0: - sprintf(to, "disk"); + case 0xe: + type = "disk"; break; case 1: - sprintf(to, "tape"); + type = "tape"; break; case 4: - sprintf(to, "optical"); - break; - case 5: - sprintf(to, "cd"); - break; case 7: - sprintf(to, "optical"); - break; - case 0xe: - sprintf(to, "disk"); - break; case 0xf: - sprintf(to, "optical"); + type = "optical"; + break; + case 5: + type = "cd"; break; default: - sprintf(to, "generic"); break; } - } else { - sprintf(to, "generic"); } + strlcpy(to, type, len); } /* @@ -278,6 +271,7 @@ static int usb_id(const char *devpath) /* mass storage */ if (protocol == 6 && !use_usb_info) { struct sysfs_device *dev_scsi; + int host, bus, target, lun; /* get scsi device */ dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); @@ -285,6 +279,10 @@ static int usb_id(const char *devpath) info("unable to find parent 'scsi' device of '%s'", devpath); goto fallback; } + if (sscanf(dev_scsi->kernel, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { + info("invalid scsi device '%s'", dev_scsi->kernel); + goto fallback; + } /* Generic SPC-2 device */ scsi_vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); @@ -314,6 +312,12 @@ static int usb_id(const char *devpath) goto fallback; } set_str(revision_str, scsi_rev, sizeof(revision_str)-1); + + /* + * some broken devices have the same identifiers + * for all luns, export the target:lun number + */ + sprintf(instance_str, "%d:%d", target, lun); } fallback: @@ -363,18 +367,25 @@ int main(int argc, char **argv) int retval = 0; const char *env; char devpath[MAX_PATH_LEN]; - int option; + static int export; logging_init("usb_id"); sysfs_init(); - dbg("argc is %d", argc); + static const struct option options[] = { + { "usb-info", 0, NULL, 'u' }, + { "num-info", 0, NULL, 'n' }, + { "export", 0, NULL, 'x' }, + { "help", 0, NULL, 'h' }, + {} + }; - while ((option = getopt(argc, argv, "dnux")) != -1 ) { - if (optarg) - dbg("option '%c' arg '%s'", option, optarg); - else - dbg("option '%c'", option); + while (1) { + int option; + + option = getopt_long(argc, argv, "nuxh", options, NULL); + if (option == -1) + break; switch (option) { case 'n': @@ -387,10 +398,15 @@ int main(int argc, char **argv) case 'x': export = 1; break; + case 'h': + printf("Usage: usb_id [--usb-info] [--num-info] [--export] [--help]\n" + " --usb-info use usb strings instead\n" + " --num-info use numerical values\n" + " --export print values as environemt keys\n" + " --help print this help text\n\n"); default: - info("Unknown or bad option '%c' (0x%x)", option, option); retval = 1; - break; + goto exit; } } @@ -398,7 +414,7 @@ int main(int argc, char **argv) if (env != NULL) strlcpy(devpath, env, sizeof(devpath)); else { - if (optind == argc) { + if (argv[optind] == NULL) { fprintf(stderr, "No device specified\n"); retval = 1; goto exit; @@ -409,28 +425,33 @@ int main(int argc, char **argv) retval = usb_id(devpath); if (retval == 0) { + char serial[256]; + + strlcpy(serial, vendor_str, sizeof(serial)); + strlcat(serial, "_", sizeof(serial)); + strlcat(serial, model_str, sizeof(serial)); + if (serial_str[0] != '\0') { + strlcat(serial, "_", sizeof(serial)); + strlcat(serial, serial_str, sizeof(serial)); + } + if (instance_str[0] != '\0') { + strlcat(serial, "-", sizeof(serial)); + strlcat(serial, instance_str, sizeof(serial)); + } + if (export) { printf("ID_VENDOR=%s\n", vendor_str); printf("ID_MODEL=%s\n", model_str); printf("ID_REVISION=%s\n", revision_str); - if (serial_str[0] == '\0') { - printf("ID_SERIAL=%s_%s\n", - vendor_str, model_str); - } else { - printf("ID_SERIAL=%s_%s_%s\n", - vendor_str, model_str, serial_str); - } + printf("ID_SERIAL=%s\n", serial); + if (serial_str[0] != '\0') + printf("ID_SERIAL_SHORT=%s\n", serial_str); printf("ID_TYPE=%s\n", type_str); + if (instance_str[0] != '\0') + printf("ID_INSTANCE=%s\n", instance_str); printf("ID_BUS=usb\n"); - } else { - if (serial_str[0] == '\0') { - printf("%s_%s\n", - vendor_str, model_str); - } else { - printf("%s_%s_%s\n", - vendor_str, model_str, serial_str); - } - } + } else + printf("%s\n", serial); } exit: -- cgit v1.2.3-54-g00ecf From 1ce3e4fef08b9e5af230f9fc25972473aa23b8db Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Mar 2007 14:22:50 +0100 Subject: run_directory: add final warning before removal --- extras/run_directory/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile index 7a72e83dae..3d1674436b 100644 --- a/extras/run_directory/Makefile +++ b/extras/run_directory/Makefile @@ -33,6 +33,7 @@ all: $(PROG) $(MAN_PAGES) $(Q) $(CC) -c $(CFLAGS) $< -o $@ $(PROG): %: $(HEADERS) %.o $(OBJS) + @echo $@ "is DEPRECATED and will be removed, don't use it" $(E) " LD " $@ $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) @@ -48,6 +49,7 @@ clean: .PHONY: clean install-bin: all + @echo $@ "is DEPRECATED and will be removed, don't use it" $(INSTALL_PROGRAM) -D udev_run_devd $(DESTDIR)$(libudevdir)/udev_run_devd $(INSTALL_PROGRAM) -D udev_run_hotplugd $(DESTDIR)$(libudevdir)/udev_run_hotplugd .PHONY: install-bin -- cgit v1.2.3-54-g00ecf From 89d3ee2b3af5752e4710cef0bf489ebf9fb55268 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Wed, 21 Mar 2007 20:05:08 +0100 Subject: update Debian rules --- etc/udev/debian/devfs.rules | 10 ++++----- etc/udev/debian/hotplug.rules | 12 +++++++---- etc/udev/debian/permissions.rules | 13 ++++++++++-- etc/udev/debian/persistent.rules | 43 ++++++++++++++++++++++++++++++--------- etc/udev/debian/udev.rules | 5 ++--- 5 files changed, 59 insertions(+), 24 deletions(-) diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index 37e4ae1bc9..2e0caa1d69 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -20,14 +20,15 @@ SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ # IDE devices SUBSYSTEMS=="ide", KERNEL=="hd[a-z]*", PROGRAM="ide-devfs.sh %k %b %n", \ + ACTION=="add", \ NAME="%c{1}", SYMLINK+="%k %c{2}" # SCSI devices -SUBSYSTEMS=="scsi", PROGRAM="scsi-devfs.sh %k %b %n", \ +SUBSYSTEMS=="scsi", PROGRAM="scsi-devfs.sh %k %b %n", ACTION=="add", \ NAME="%c{1}", SYMLINK+="%k %c{2}" # RAID controllers -KERNEL=="cciss!*|ida!*|rd!*", PROGRAM="raid-devfs.sh %k", \ +KERNEL=="cciss!*|ida!*|rd!*", PROGRAM="raid-devfs.sh %k", ACTION=="add", \ NAME="%c{1}", SYMLINK+="%k" # other block devices @@ -47,7 +48,7 @@ SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ SYMLINK+="pilot" # usbfs-like devices -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ NAME="%c" # serial devices @@ -69,7 +70,7 @@ KERNEL=="video[0-9]*", NAME="v4l/%k" KERNEL=="radio[0-9]*", NAME="v4l/%k" KERNEL=="vbi[0-9]*", NAME="v4l/%k" KERNEL=="vtx[0-9]*", NAME="v4l/%k" -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ NAME="%c" KERNEL=="fb[0-9]*", NAME="fb/%n" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -147,6 +148,5 @@ SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k" # device mapper creates its own device nodes, so ignore these -KERNEL=="dm-[0-9]*", NAME="" KERNEL=="device-mapper", NAME="mapper/control" diff --git a/etc/udev/debian/hotplug.rules b/etc/udev/debian/hotplug.rules index 8b48d77f56..0b2fc57126 100644 --- a/etc/udev/debian/hotplug.rules +++ b/etc/udev/debian/hotplug.rules @@ -3,17 +3,20 @@ ACTION!="add", GOTO="hotplug_not_add_event" # check if the device has already been claimed by a driver ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" +# this driver is broken and should not be loaded automatically (see #398962) +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_driver_loaded" + # load the drivers -ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" +ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe --use-blacklist $env{MODALIAS}" SUBSYSTEM=="ide", ENV{MODALIAS}!="?*", RUN+="ide.agent" -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe --use-blacklist pnp:d$$id; done < /sys$devpath/id'" SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" # rules for subsystems which lack proper hotplug support -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o-block" -#SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc-block" +SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe osst", \ @@ -23,6 +26,7 @@ SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ ATTRS{vendor}!="Onstream" SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ATTRS{type}=="8", RUN+="/sbin/modprobe ch" SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", RUN+="/sbin/modprobe sg" SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index 06bbf66260..ac6c0be38b 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -11,7 +11,11 @@ SUBSYSTEM=="net", ENV{DRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" # default permissions for block devices SUBSYSTEM=="block", GROUP="disk" -SUBSYSTEM=="block", ATTR{removable}=="1", GROUP="floppy" +# the aacraid driver is broken and reports that disks removable (see #404927) +SUBSYSTEM=="block", ATTRS{removable}=="1", \ + DRIVERS!="aacraid", GROUP="floppy" +# all block devices on these buses are "removable" +SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" # IDE devices KERNEL=="hd[a-z]|pcd[0-9]*", DRIVERS=="ide-cdrom|pcd", \ @@ -25,8 +29,10 @@ KERNEL=="sr[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner" SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" # USB devices KERNEL=="legousbtower*", MODE="0666" @@ -74,10 +80,12 @@ KERNEL=="sgi_fetchop", MODE="0666" KERNEL=="sonypi", MODE="0666" KERNEL=="agpgart", GROUP="video" KERNEL=="nvram", GROUP="nvram" -KERNEL=="rtc", GROUP="audio" +KERNEL=="rtc|rtc[0-9]*", GROUP="audio" KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" KERNEL=="fuse", GROUP="fuse" KERNEL=="kqemu", MODE="0666" +KERNEL=="kvm", GROUP="kvm" +KERNEL=="tun", MODE="0666" KERNEL=="cdemu[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" @@ -105,6 +113,7 @@ KERNEL=="video1394*", GROUP="video" KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ MODE="0664", GROUP="video" KERNEL=="js[0-9]*", MODE="0664" +KERNEL=="lirc[0-9]*", GROUP="video" # AOE character devices SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index 277d03dea8..c82a639556 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -5,12 +5,12 @@ SUBSYSTEM!="block", GOTO="no_volume_id" ACTION!="add", GOTO="no_volume_id" # and we can safely ignore these kinds of devices -KERNEL=="ram*|loop*|fd*|nbd*|dm-*", GOTO="no_volume_id" +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="no_volume_id" # skip removable ide devices, because open(2) on them causes an events loop KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ GOTO="no_volume_id" -KERNEL=="hd*[0-9]", ATTR{../removable}=="1", \ +KERNEL=="hd*[0-9]", ATTRS{removable}=="1", \ GOTO="no_volume_id" # skip xen virtual hard disks @@ -20,13 +20,17 @@ DRIVERS=="vbd", GOTO="no_hardware_id" KERNEL=="hd*[!0-9]", \ IMPORT{program}="ata_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", \ +KERNEL=="sd*[!0-9]|sr*|st*|nst*", ATTRS{ieee1394_id}=="?*", \ ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", \ +KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ IMPORT{program}="usb_id -x" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", \ +KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ IMPORT{program}="scsi_id -g -x -s $devpath -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", \ +KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ + IMPORT{program}="scsi_id -g -x -a -s $devpath -d $tempnode" +KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="", \ + IMPORT{program}="scsi_id -g -x -s $devpath -d $tempnode" +KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="", \ IMPORT{program}="scsi_id -g -x -a -s $devpath -d $tempnode" KERNEL=="dasd*[!0-9]", \ @@ -47,16 +51,35 @@ KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL_SHORT}=="?*", \ + ENV{ID_VENDOR}=="ATA", \ + SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}" +KERNEL=="sd*[0-9]", ENV{ID_SERIAL_SHORT}=="?*", \ + ENV{ID_VENDOR}=="ATA", \ + SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}-part%n" + +KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ + ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ + SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ + ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ + SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + KERNEL=="sd*[!0-9]|dasd[!0-9]*|sr*", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" KERNEL=="st*", ENV{ID_SERIAL}=="?*", \ SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" +KERNEL=="nst*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" +KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="*[!0-9]|sr*", ENV{ID_PATH}=="?*", \ SYMLINK+="disk/by-path/$env{ID_PATH}" diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index 3da6fadf8f..3f7b704f78 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -33,7 +33,7 @@ SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ SYMLINK+="pilot" # usbfs-like devices -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ NAME="%c" # serial devices @@ -41,7 +41,7 @@ KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" KERNEL=="capi[0-9]*", NAME="capi/%n" # video devices -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ NAME="%c" KERNEL=="card[0-9]*", NAME="dri/%k" @@ -97,6 +97,5 @@ SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k" # device mapper creates its own device nodes, so ignore these -KERNEL=="dm-[0-9]*", NAME="" KERNEL=="device-mapper", NAME="mapper/control" -- cgit v1.2.3-54-g00ecf From 9d534c0e764a6d2c20032d130e40e867133af149 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Mar 2007 20:17:01 +0100 Subject: release 107 --- ChangeLog | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++- Makefile | 2 +- RELEASE-NOTES | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 135db2b38d..1294601689 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,53 @@ -Summary of changes from v104 to v105 +Summary of changes from v106 to v107 +============================================ + +Jean Tourrilhes (1): + udevtest: export UDEV_LOG if we changed it + +Kay Sievers (33): + man: add missing options to various man pages + man: fix typo + create_floppy_devices: apply specified mode without umask + man: spelling fixes + udevmonitor: add switch for kernel and udev events + default rules: wait for 0:0:0:0 scsi devices only + update Fedora rules + delete dasd_id, it moved to s390-tools + update Gentoo rules + encode db-file names, instead of just replacing '/' + update internal variables if we see $DEVPATH during IMPORT + increase /proc/stat buffer + maintain index over device-names to devpath relation + restore overwritten symlinks when the device goes away + store devpath with the usual leading slash + add link_priority to rule options, and store it in database + pick actual valid device in udev_db_lookup_name + cleanup already existing db-entries and db-index on device update + selinux: move selinux_exit() to the main programs + remove old error message + read list of devices from index, make index private to database + priority based symlink handling + volume_id: get rid of compiler warning + udevinfo: remove -d option + update %n on netif name change + if a node goes away, possibly restore a waiting symlink + update TODO + man: add "link_priority" option + update SUSE rules + udevtest: add --force mode + udevinfo: print link priority + usb_id: append target:lun to storage device serial + run_directory: add final warning before removal + +Marco d'Itri (1): + update Debian rules + +Matthias Schwarzott (2): + udevd: cleanup std{in,our,err} on startup + udevmonitor: fix swapped event switch descriptions + + +Summary of changes from v105 to v106 ============================================ A. Costa (1): diff --git a/Makefile b/Makefile index 97c3528037..4dcdc9250b 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 106 +VERSION = 107 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f4966ac98a..461ced5dbc 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,39 @@ +udev 107 +======== +Bugfixes. + +Symlinks can have priorities now, the priority is assigned to the device +and specified with OPTIONS="link_priority=100". Devices with higher +priorities overwrite the symlinks of devices with lower priorities. +If the device that currently owns the link, goes away, the symlink +will be removed, and recreated, pointing to the next device with the +highest actual priority. This should make /dev/disk/by-{label,uuid,id} +more reliable, if multiple devices contain the same metadata and overwrite +these symlinks. + +The dasd_id program is removed from the udev tree, and dasdinfo, with the +needed rules, are part of the s390-tools now. + +Please add KERNEL=="[0-9]*:[0-9]*" to the scsi wait-for-sysfs rule, +we may get the scsi sysfs mess fixed some day, and this will only catch +the devices we are looking for. + +USB serial numbers for storage devices have the target:lun now appended, +to make it possibble to distinguish broken multi-lun devices with all +the same SCSI identifiers. + +Note: The extra "run_directory" which searches and executes stuff in +/etc/hotplug.d/ and /etc/dev.d/ is long deprecated, and will be removed +with the next release. Make sure, that you don't use it anymore, or +provides your own implementation of that inefficient stuff. +We are tired of reports about a "slow udev", because these directories +contain stuff, that runs with _every_ event, instead of using rules, +that run programs only for the matching events. + +udev 106 +======== +Bugfixes. + udev 105 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 491a6a71ff685373422621f4b67f550806072d17 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Thu, 22 Mar 2007 21:05:56 +0100 Subject: write_cd_rules: set default link type to "by-id" for usb and ieee1394 devices --- extras/rule_generator/write_cd_rules | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules index 1dbe6b70de..bd951c5146 100644 --- a/extras/rule_generator/write_cd_rules +++ b/extras/rule_generator/write_cd_rules @@ -53,7 +53,15 @@ fi if [ "$1" ]; then METHOD="$1" else - METHOD='by-path' + case "$ID_BUS" in + usb|ieee1394) + METHOD='by-id' + ;; + + *) + METHOD='by-path' + ;; + esac fi case "$METHOD" in -- cgit v1.2.3-54-g00ecf From be8594ab14f15203fcea4b2aa0115171472f3e43 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Mar 2007 17:17:18 +0100 Subject: udevinfo: relax check for the correct device if looked up by name --- udev_db.c | 2 +- udevinfo.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/udev_db.c b/udev_db.c index 00d68d6d13..7b8d02bf81 100644 --- a/udev_db.c +++ b/udev_db.c @@ -186,7 +186,7 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) size_t cur; size_t count; - strlcpy(udev->dev->devpath, devpath, sizeof(udev->dev->devpath)); + sysfs_device_set_values(udev->dev, devpath, NULL, NULL); devpath_to_db_path(devpath, filename, sizeof(filename)); if (lstat(filename, &stats) != 0) { diff --git a/udevinfo.c b/udevinfo.c index 3f25be03f8..4b4876cc11 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -173,13 +173,17 @@ static void export_db(void) { static int lookup_device_by_name(struct udevice *udev, const char *name) { LIST_HEAD(name_list); + int count; struct name_entry *device; int rc = -1; - if (udev_db_get_devices_by_name(name, &name_list) <= 0) + count = udev_db_get_devices_by_name(name, &name_list); + if (count <= 0) goto out; - /* select the device that matches the dev_t of name */ + info("found %i devices for '%s'", count, name); + + /* select the device that seems to match */ list_for_each_entry(device, &name_list, node) { char filename[PATH_SIZE]; struct stat statbuf; @@ -189,16 +193,18 @@ static int lookup_device_by_name(struct udevice *udev, const char *name) continue; info("found db entry '%s'", device->name); + /* make sure, we don't get a link of a differnt device */ strlcpy(filename, udev_root, sizeof(filename)); strlcat(filename, "/", sizeof(filename)); strlcat(filename, name, sizeof(filename)); if (stat(filename, &statbuf) != 0) continue; - if (statbuf.st_rdev == udev->devt) { - info("found '%s', dev_t matches", udev->name); - rc = 0; - break; + if (major(udev->devt) > 0 && udev->devt != statbuf.st_rdev) { + info("skip '%s', dev_t doesn't match", udev->name); + continue; } + rc = 0; + break; } out: name_list_cleanup(&name_list); -- cgit v1.2.3-54-g00ecf From d2c9a56e0e624ed448aed8ad18460deed63973e1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Mar 2007 17:18:03 +0100 Subject: don't write to sysfs files during test run --- udev_rules.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index f8844a8438..5078f2d3d1 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -861,8 +861,9 @@ try_parent: info("writing '%s' to sysfs file '%s'", value, attr); f = fopen(attr, "w"); if (f != NULL) { - if (fprintf(f, "%s", value) <= 0) - err("error writing ATTR{%s}: %s", attr, strerror(errno)); + if (!udev->test_run) + if (fprintf(f, "%s", value) <= 0) + err("error writing ATTR{%s}: %s", attr, strerror(errno)); fclose(f); } else err("error opening ATTR{%s} for writing: %s", attr, strerror(errno)); -- cgit v1.2.3-54-g00ecf From 4e2b290821d083361260f8cdbe7c54886463673e Mon Sep 17 00:00:00 2001 From: Pozsar Balazs Date: Fri, 23 Mar 2007 17:21:46 +0100 Subject: udevsettle: read udev not kernel seqnum first --- udevsettle.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/udevsettle.c b/udevsettle.c index 9e3e03b1af..f76ad7160d 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -110,9 +110,9 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - /* read current kernel seqnum */ - strlcpy(filename, sysfs_path, sizeof(filename)); - strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + /* read current udev seqnum */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); fd = open(filename, O_RDONLY); if (fd < 0) goto exit; @@ -121,12 +121,12 @@ int main(int argc, char *argv[], char *envp[]) if (len <= 0) goto exit; seqnum[len] = '\0'; - seq_kernel = strtoull(seqnum, NULL, 10); - info("kernel seqnum = %llu", seq_kernel); + seq_udev = strtoull(seqnum, NULL, 10); + info("udev seqnum = %llu", seq_udev); - /* read current udev seqnum */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + /* read current kernel seqnum */ + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); fd = open(filename, O_RDONLY); if (fd < 0) goto exit; @@ -135,8 +135,8 @@ int main(int argc, char *argv[], char *envp[]) if (len <= 0) goto exit; seqnum[len] = '\0'; - seq_udev = strtoull(seqnum, NULL, 10); - info("udev seqnum = %llu", seq_udev); + seq_kernel = strtoull(seqnum, NULL, 10); + info("kernel seqnum = %llu", seq_kernel); /* make sure all kernel events have arrived in the queue */ if (seq_udev >= seq_kernel) { -- cgit v1.2.3-54-g00ecf From 1532b47bdf8cabc86d7e0f6d5e81342c42c48b2a Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Wed, 28 Mar 2007 20:31:19 +0200 Subject: update Gentoo rules --- etc/udev/gentoo/05-udev-early.rules | 2 +- etc/udev/gentoo/64-device-mapper.rules | 31 +++++++++++++++++++++++++++++++ etc/udev/gentoo/95-net.rules | 15 --------------- etc/udev/gentoo/95-udev-late.rules | 21 +++++++++++++++++++++ etc/udev/gentoo/udev.rules | 20 +------------------- 5 files changed, 54 insertions(+), 35 deletions(-) create mode 100644 etc/udev/gentoo/64-device-mapper.rules delete mode 100644 etc/udev/gentoo/95-net.rules create mode 100644 etc/udev/gentoo/95-udev-late.rules diff --git a/etc/udev/gentoo/05-udev-early.rules b/etc/udev/gentoo/05-udev-early.rules index b4d24ae216..ecf079c057 100644 --- a/etc/udev/gentoo/05-udev-early.rules +++ b/etc/udev/gentoo/05-udev-early.rules @@ -4,7 +4,7 @@ SUBSYSTEM=="module", OPTIONS="ignore_device" # sysfs is populated after the event is sent ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" ACTION=="add", SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" diff --git a/etc/udev/gentoo/64-device-mapper.rules b/etc/udev/gentoo/64-device-mapper.rules new file mode 100644 index 0000000000..1100c1b7bd --- /dev/null +++ b/etc/udev/gentoo/64-device-mapper.rules @@ -0,0 +1,31 @@ +# device mapper links hook into "change" events, when the dm table +# becomes available; some table-types must be ignored + +KERNEL=="device-mapper", NAME="mapper/control" + +KERNEL=="dm-*", ACTION=="add|change", GOTO="device_mapper_do" +GOTO="device_mapper_end" +LABEL="device_mapper_do" + +# lookup device name +# use dmsetup, until devmap_name is provided by sys-fs/device-mapper +PROGRAM=="/sbin/dmsetup -j %M -m %m --noopencount --noheadings -c -o name info", + ENV{ID_DM_NAME}="%c" + +# do not do anything if dmsetup does not provide a name +ENV{ID_DM_NAME}=="", NAME="", OPTIONS="ignore_device" + +# ignore luks crypt devices while not fully up +ENV{ID_DM_NAME}=="temporary-cryptsetup-*", NAME="", OPTIONS="ignore_device" + +# use queried name +ENV{ID_DM_NAME}=="?*", NAME="mapper/$env{ID_DM_NAME}" + +PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" +RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" + +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}", OPTIONS="link_priority=50" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}", OPTIONS="link_priority=50" + +LABEL="device_mapper_end" diff --git a/etc/udev/gentoo/95-net.rules b/etc/udev/gentoo/95-net.rules deleted file mode 100644 index 182e8738f6..0000000000 --- a/etc/udev/gentoo/95-net.rules +++ /dev/null @@ -1,15 +0,0 @@ -# /etc/udev/rules/95-net.rules: device naming rules for udev -# -# Gentoo specific rules -# -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# Try not to modify this file, if you wish to change things, create a new rule -# file that can be run before this one. -# - -# Activate our network if we can -SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start", OPTIONS="last_rule" -SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop", OPTIONS="last_rule" - diff --git a/etc/udev/gentoo/95-udev-late.rules b/etc/udev/gentoo/95-udev-late.rules new file mode 100644 index 0000000000..5d7a6a8a4e --- /dev/null +++ b/etc/udev/gentoo/95-udev-late.rules @@ -0,0 +1,21 @@ +# /etc/udev/rules/95-udev-late.rules: device naming rules for udev +# +# Gentoo specific rules +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# Try not to modify this file, if you wish to change things, create a new rule +# file that can be run before this one. +# + +# Activate our network if we can +SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start" +SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop" + +# debug events to /events, but not on default udev_log="err" +ENV{UDEV_LOG}=="[4-9]", RUN+="eventrecorder.sh" + +# event to be catched by udevmonitor +RUN+="socket:/org/kernel/udev/monitor" + diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules index 380029fb4c..28875536a0 100644 --- a/etc/udev/gentoo/udev.rules +++ b/etc/udev/gentoo/udev.rules @@ -78,14 +78,6 @@ KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" KERNEL=="microcode", NAME="cpu/microcode" -# dm devices -# lookup device name and create device in /dev/mapper -# use dmsetup, until devmap_name is provided by sys-fs/device-mapper -ACTION=="add|change", SUBSYSTEM=="block", KERNEL=="dm-*", \ - PROGRAM="/sbin/dmsetup -j %M -m %m --noopencount --noheadings -c -o name info", \ - NAME="mapper/%c" -KERNEL=="device-mapper", NAME="mapper/control" - # fb devices KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" @@ -101,7 +93,7 @@ KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" KERNEL=="mice", NAME="input/%k", MODE="0644" KERNEL=="mouse*", NAME="input/%k", MODE="0644" KERNEL=="event*", NAME="input/%k", MODE="0600" -KERNEL=="js*", NAME="input/%k", MODE="664" +KERNEL=="js*", NAME="input/%k", MODE="0664" KERNEL=="ts*", NAME="input/%k", MODE="0600" # loop devices @@ -308,13 +300,3 @@ SUBSYSTEM=="firmware", RUN+="firmware.sh" LABEL="hotplug_no_add_event" LABEL="gentoo_device_rules_end" - -# be backward compatible for a while with the /etc/dev.d and /etc/hotplug.d/ systems -# run /etc/hotplug.d/ stuff only if we came from a hotplug event, not for udevstart -#ENV{UDEVD_EVENT}=="1", RUN+="udev_run_hotplugd $env{SUBSYSTEM}" - -# always run /etc/dev.d/ stuff for now. -RUN+="udev_run_devd $env{SUBSYSTEM}" - -# debugging monitor -RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From a401355d5aed89f686d178f01400432c71cf6380 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 28 Mar 2007 20:35:05 +0200 Subject: finally remove the directory event-multiplexer crap --- TODO | 3 - extras/run_directory/Makefile | 72 ---------------- extras/run_directory/README | 17 ---- extras/run_directory/RFC-dev.d | 50 ------------ extras/run_directory/dev.d/default/pam_console.dev | 52 ------------ extras/run_directory/dev.d/net/hotplug.dev | 21 ----- extras/run_directory/dev.d/snd/controlC0/alsa.dev | 2 - extras/run_directory/run_directory.c | 73 ----------------- extras/run_directory/run_directory.h | 3 - extras/run_directory/udev_run_devd.c | 95 ---------------------- extras/run_directory/udev_run_hotplugd.c | 77 ------------------ test/simple-build-check.sh | 1 - 12 files changed, 466 deletions(-) delete mode 100644 extras/run_directory/Makefile delete mode 100644 extras/run_directory/README delete mode 100644 extras/run_directory/RFC-dev.d delete mode 100644 extras/run_directory/dev.d/default/pam_console.dev delete mode 100644 extras/run_directory/dev.d/net/hotplug.dev delete mode 100644 extras/run_directory/dev.d/snd/controlC0/alsa.dev delete mode 100644 extras/run_directory/run_directory.c delete mode 100644 extras/run_directory/run_directory.h delete mode 100644 extras/run_directory/udev_run_devd.c delete mode 100644 extras/run_directory/udev_run_hotplugd.c diff --git a/TODO b/TODO index 129ae9df10..380de4896c 100644 --- a/TODO +++ b/TODO @@ -11,6 +11,3 @@ udev version: o remove udevstart (we rely on the kernel "uevent"-triggers of kernel 2.6.15 and no longer want to guess event-properties from sysfs like udevstart is doing it) - - o remove extra for /etc/dev.d/ /etc/hotplug.d/ - (that inefficient stuff should finally go away) diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile deleted file mode 100644 index 3d1674436b..0000000000 --- a/extras/run_directory/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2005 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# -PROG = udev_run_devd udev_run_hotplugd -OBJS = run_directory.o -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - @echo $@ "is DEPRECATED and will be removed, don't use it" - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - @echo $@ "is DEPRECATED and will be removed, don't use it" - $(INSTALL_PROGRAM) -D udev_run_devd $(DESTDIR)$(libudevdir)/udev_run_devd - $(INSTALL_PROGRAM) -D udev_run_hotplugd $(DESTDIR)$(libudevdir)/udev_run_hotplugd -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/udev_run_devd - - rm $(DESTDIR)$(libudevdir)/udev_run_hotplugd -.PHONY: uninstall-bin - -install-man: - @echo "Please create a man page for this tool." -.PHONY: install-man - -uninstall-man: - @echo "Please create a man page for this tool." -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config diff --git a/extras/run_directory/README b/extras/run_directory/README deleted file mode 100644 index feae2f81bf..0000000000 --- a/extras/run_directory/README +++ /dev/null @@ -1,17 +0,0 @@ -Use these binaries only if you need backward compatibility with -older udev versions. The use of /etc/dev.d/ is no longer recommended. -Use explicit udev rules with RUN keys to hook into the processing. - - /etc/dev.d/ + /etc/hotplug.d/ directory multiplexing is completely - removed from udev itself and must be emulated by calling small - helper binaries provided by these helpers: - make EXTRAS=extras/run_directory/ - will build udev_run_devd and udev_run_hotplugd, which can be called - from a rule if needed: - RUN+="/sbin/udev_run_hotplugd" - The recommended way to handle this is to convert all the calls from - the directories to explicit udev rules and get completely rid of the - multiplexing. (To catch a ttyUSB event, you now no longer need to - fork and exit 300 tty script instances on bootup you are not interested - in, it is just one rule that matches exactly that single device.) - diff --git a/extras/run_directory/RFC-dev.d b/extras/run_directory/RFC-dev.d deleted file mode 100644 index 1aca1aa393..0000000000 --- a/extras/run_directory/RFC-dev.d +++ /dev/null @@ -1,50 +0,0 @@ - /etc/dev.d/ How it works, and what it is for - - by Greg Kroah-Hartman March 2004 - -The /etc/dev.d directory works much like the /etc/hotplug.d/ directory -in that it is a place to put symlinks or programs that get called when -an event happens in the system. Programs will get called whenever the -device naming program in the system has either named a new device and -created a /dev node for it, or when a /dev node has been removed from -the system due to a device being removed. - -The directory tree under /etc/dev.d/ dictate which program is run first, -and when some programs will be run or not. The device naming program -calls the programs in the following order: - /etc/dev.d/DEVNAME/*.dev - /etc/dev.d/SUBSYSTEM/*.dev - /etc/dev.d/default/*.dev - -The .dev extension is needed to allow automatic package managers to -deposit backup files in these directories safely. - -The DEVNAME name is the name of the /dev file that has been created, or -for network devices, the name of the newly named network device. This -value, including the /dev path, will also be exported to userspace in -the DEVNAME environment variable. - -The SUBSYSTEM name is the name of the sysfs subsystem that originally -generated the hotplug event that caused the device naming program to -create or remove the /dev node originally. This value is passed to -userspace as the first argument to the program. - -The default directory will always be run, to enable programs to catch -every device add and remove in a single place. - -All environment variables that were originally passed by the hotplug -call that caused this device action will also be passed to the program -called in the /etc/dev.d/ directories. Examples of these variables are -ACTION, DEVPATH, and others. See the hotplug documentation for full -description of this - -An equivalent shell script that would do this same kind of action would -be: - DIR="/etc/dev.d" - export DEVNAME="whatever_dev_name_udev_just_gave" - for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do - if [ -f $I ]; then $I $1 ; fi - done - exit 1; - - diff --git a/extras/run_directory/dev.d/default/pam_console.dev b/extras/run_directory/dev.d/default/pam_console.dev deleted file mode 100644 index 4c69ea3576..0000000000 --- a/extras/run_directory/dev.d/default/pam_console.dev +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# Fedora solution to set the ownership/permissions of s device to the local -# logged in user. Uses the program pam_console_setowner to match the names of -# the device node and the symlinks against a device list and applies the -# configured ownership and permission to the node. - -[ "$ACTION" != "add" ] && exit 0 - -# we do not have console users in rc.sysinit -[ -n "$IN_INITLOG" ] && exit 0 - -if [ -x /sbin/pam_console_setowner -a -f /var/run/console/console.lock \ - -a -e "$DEVNAME" ]; then - - if [ -x /usr/bin/logger ]; then - LOGGER=/usr/bin/logger - elif [ -x /bin/logger ]; then - LOGGER=/bin/logger - else - unset LOGGER - fi - # - # for diagnostics - # - if [ -t 1 -o -z "$LOGGER" ]; then - mesg () { - echo "$@" - } - else - mesg () { - $LOGGER -t $(basename $0)"[$$]" "$@" - } - fi - - debug_mesg () { - test "$udev_log" = "" -o "$udev_log" = "no" && return - mesg "$@" - } - - if [ -f /etc/udev/udev.conf ]; then - . /etc/udev/udev.conf - fi - - SYMLINKS="" - for i in $(/usr/bin/udevinfo -q symlink -p "$DEVPATH"); do - [ $? -gt 0 ] && break - SYMLINKS="$SYMLINKS ${udev_root%%/}/$i" - done - debug_mesg "Restoring console permissions for $DEVNAME $SYMLINKS" - /sbin/pam_console_setowner "$DEVNAME" $SYMLINKS -fi diff --git a/extras/run_directory/dev.d/net/hotplug.dev b/extras/run_directory/dev.d/net/hotplug.dev deleted file mode 100644 index e195b0f034..0000000000 --- a/extras/run_directory/dev.d/net/hotplug.dev +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Script to ensure that any network device that udev renames -# still gets the hotplug script run with the proper name. -# -# Released under the GPL v2 -# -# Copyright (C) 2004 Greg Kroah-Hartman -# - -# Do nothing if udev handles hotplug.d. -if [ "$MANAGED_EVENT" == "1" ]; then - exit 0 -fi - -# ok, we have renamed this device, so let the network hotplug script -# know about it to setup the device properly... -if [ -f /etc/hotplug.d/default/default.hotplug ]; then - exec /etc/hotplug.d/default/default.hotplug net -fi - diff --git a/extras/run_directory/dev.d/snd/controlC0/alsa.dev b/extras/run_directory/dev.d/snd/controlC0/alsa.dev deleted file mode 100644 index 642dde4f36..0000000000 --- a/extras/run_directory/dev.d/snd/controlC0/alsa.dev +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -e -exec /usr/sbin/alsactl restore 0 diff --git a/extras/run_directory/run_directory.c b/extras/run_directory/run_directory.c deleted file mode 100644 index c715ca6bd3..0000000000 --- a/extras/run_directory/run_directory.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * udev_run_directory.c - directory multiplexer - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../udev.h" -#include "run_directory.h" - -static int exec_program(const char *filename, const char *subsystem) -{ - pid_t pid; - - dbg("running %s", filename); - pid = fork(); - switch (pid) { - case 0: - /* child */ - execl(filename, filename, subsystem, NULL); - dbg("exec of child failed"); - _exit(1); - case -1: - dbg("fork of child failed"); - break; - return -1; - default: - waitpid(pid, NULL, 0); - } - - return 0; -} - -int run_directory(const char *dir, const char *suffix, const char *subsystem) -{ - struct name_entry *name_loop, *name_tmp; - struct stat buf; - LIST_HEAD(name_list); - - dbg("looking at '%s'", dir); - - if (stat(dir, &buf) != 0) { - dbg("directory '%s' not found", dir); - return 0; - } - - add_matching_files(&name_list, dir, suffix); - - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - exec_program(name_loop->name, subsystem); - list_del(&name_loop->node); - } - - logging_close(); - return 0; -} diff --git a/extras/run_directory/run_directory.h b/extras/run_directory/run_directory.h deleted file mode 100644 index edb46ddd73..0000000000 --- a/extras/run_directory/run_directory.h +++ /dev/null @@ -1,3 +0,0 @@ - -extern int run_directory(const char *dir, const char *suffix, const char *subsystem); - diff --git a/extras/run_directory/udev_run_devd.c b/extras/run_directory/udev_run_devd.c deleted file mode 100644 index 59ea766ac2..0000000000 --- a/extras/run_directory/udev_run_devd.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * udev_run_devd.c - directory multiplexer - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../udev.h" -#include "run_directory.h" - - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) -{ - char dirname[NAME_SIZE]; - const char *devname; - const char *my_devname; - const char *subsystem; - int fd; - - devname = getenv("DEVNAME"); - if (devname == NULL) - exit(0); - /* - * Hack, we are assuming that the device nodes are in /dev, - * if not, this will not work, but you should be using the - * RUN= rule anyway... - */ - my_devname = strstr(devname, "/dev/"); - if (my_devname != NULL) - my_devname = &my_devname[5]; - else - my_devname = devname; - - subsystem = argv[1]; - logging_init("udev_run_devd"); - - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDOUT_FILENO); - dup2(fd, STDIN_FILENO); - dup2(fd, STDERR_FILENO); - close(fd); - } - dbg("running dev.d directory"); - - sprintf(dirname, "/etc/dev.d/%s", my_devname); - run_directory(dirname, ".dev", subsystem); - sprintf(dirname, "/etc/dev.d/%s", subsystem); - run_directory(dirname, ".dev", subsystem); - run_directory("/etc/dev.d/default", ".dev", subsystem); - - exit(0); -} diff --git a/extras/run_directory/udev_run_hotplugd.c b/extras/run_directory/udev_run_hotplugd.c deleted file mode 100644 index f94c237e37..0000000000 --- a/extras/run_directory/udev_run_hotplugd.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * udev_run_hotplugd.c - directory multiplexer - * - * Copyright (C) 2005 Kay Sievers - * - * 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. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../../udev.h" -#include "run_directory.h" - - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) -{ - char dirname[NAME_SIZE]; - const char *subsystem; - int fd; - - subsystem = argv[1]; - logging_init("udev_run_hotplugd"); - - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDOUT_FILENO); - dup2(fd, STDIN_FILENO); - dup2(fd, STDERR_FILENO); - close(fd); - } - - dbg("running hotplug.d directory"); - - sprintf(dirname, "/etc/hotplug.d/%s", subsystem); - run_directory(dirname, ".hotplug", subsystem); - run_directory("/etc/hotplug.d/default", ".hotplug", subsystem); - exit(0); -} diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 7a82521111..a2cbbfd631 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -9,7 +9,6 @@ EXTRAS="\ extras/cdrom_id \ extras/edd_id \ extras/floppy \ - extras/run_directory \ extras/firmware \ extras/path_id \ extras/rule_generator" -- cgit v1.2.3-54-g00ecf From b8eb7940bb609e21697c7ded759536b039320886 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 28 Mar 2007 20:47:26 +0200 Subject: release 108 --- ChangeLog | 16 ++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 1294601689..9ac5246c13 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +Summary of changes from v107 to v108 +============================================ + +Kay Sievers (3): + udevinfo: relax check for the correct device if looked up by name + don't write to sysfs files during test run + finally remove the directory event-multiplexer crap + +Matthias Schwarzott (2): + write_cd_rules: set default link type to "by-id" for usb and ieee1394 devices + update Gentoo rules + +Pozsar Balazs (1): + udevsettle: read udev not kernel seqnum first + + Summary of changes from v106 to v107 ============================================ diff --git a/Makefile b/Makefile index 4dcdc9250b..4e32312a58 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 107 +VERSION = 108 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 461ced5dbc..2c4e64ae7f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,10 @@ +udev 108 +======== +Bugfixes. + +The directory multiplexer for dev.d/ and hotplug.d are finally removed +from the udev package. + udev 107 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 1c73ceeb9448c4398ea143faa4e1ccdc56d64238 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 31 Mar 2007 02:42:14 +0200 Subject: udevtest: export ACTION string if given as option --- udevtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevtest.c b/udevtest.c index 8c56dba0f1..9d73996bcf 100644 --- a/udevtest.c +++ b/udevtest.c @@ -141,7 +141,7 @@ int main(int argc, char *argv[], char *envp[]) setenv("DEVPATH", udev->dev->devpath, 1); setenv("SUBSYSTEM", udev->dev->subsystem, 1); - setenv("ACTION", "add", 1); + setenv("ACTION", udev->action, 1); printf("This program is for debugging only, it does not run any program,\n" "specified by a RUN key. It may show incorrect results, if rules\n" -- cgit v1.2.3-54-g00ecf From 2dc2396aaf73dc2609abccff8b4a97ba400b873c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 31 Mar 2007 02:42:32 +0200 Subject: update SUSE rules --- etc/udev/suse/60-persistent-storage.rules | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules index a946bc1d2e..b7af0bcb70 100644 --- a/etc/udev/suse/60-persistent-storage.rules +++ b/etc/udev/suse/60-persistent-storage.rules @@ -35,8 +35,11 @@ KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", ENV{ID_VENDOR}=="ATA", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL_SHORT}-part%n" + +# libata compat (links like hd*) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", ENV{ID_ATA_COMPAT}="$result" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" +KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From 81313e1b48866efb9e40eb88420643de05275b56 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 31 Mar 2007 02:46:32 +0200 Subject: make ACTION!="add|change" working Thanks to Scott for the suggestion. --- udev_rules.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 5078f2d3d1..d77d5ec196 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -584,18 +584,18 @@ static char *key_pair_name(struct udev_rule *rule, struct key_pair *pair) static int match_key(const char *key_name, struct udev_rule *rule, struct key *key, const char *val) { - int match; char value[PATH_SIZE]; char *key_value; char *pos; + int match = 0; if (key->operation != KEY_OP_MATCH && key->operation != KEY_OP_NOMATCH) return 0; + /* look for a matching string, parts are separated by '|' */ strlcpy(value, rule->buf + key->val_off, sizeof(value)); key_value = value; - dbg("key %s value='%s'", key_name, key_value); while (key_value) { pos = strchr(key_value, '|'); @@ -603,19 +603,23 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k pos[0] = '\0'; pos++; } + dbg("match %s '%s' <-> '%s'", key_name, key_value, val); match = (fnmatch(key_value, val, 0) == 0); - if (match && (key->operation != KEY_OP_NOMATCH)) { - dbg("%s is true (matching value)", key_name); - return 0; - } - if (!match && (key->operation == KEY_OP_NOMATCH)) { - dbg("%s is true (non-matching value)", key_name); - return 0; - } + if (match) + break; + key_value = pos; } - dbg("%s is false", key_name); + + if (match && (key->operation == KEY_OP_MATCH)) { + dbg("%s is true (matching value)", key_name); + return 0; + } + if (!match && (key->operation == KEY_OP_NOMATCH)) { + dbg("%s is true (non-matching value)", key_name); + return 0; + } return -1; } -- cgit v1.2.3-54-g00ecf From 68d4af11cae0af3a8e06770228b16613700b363e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 6 Apr 2007 19:18:33 +0200 Subject: udevtest: import uevent variables if possible --- udevtest.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/udevtest.c b/udevtest.c index 9d73996bcf..9868c9bcd3 100644 --- a/udevtest.c +++ b/udevtest.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,45 @@ void log_message (int priority, const char *format, ...) } #endif +static int import_uevent_var(const char *devpath) +{ + char path[PATH_SIZE]; + static char value[4096]; /* must stay, used with putenv */ + ssize_t size; + int fd; + char *key; + char *next; + int rc = -1; + + /* read uevent file */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/uevent", sizeof(path)); + fd = open(path, O_RDONLY); + if (fd < 0) + goto out; + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + value[size] = '\0'; + + /* import keys into environment */ + key = value; + while (key[0] != '\0') { + next = strchr(key, '\n'); + if (next == NULL) + goto out; + next[0] = '\0'; + info("import into environment: '%s'", key); + putenv(key); + key = &next[1]; + } + rc = 0; +out: + return rc; +} + int main(int argc, char *argv[], char *envp[]) { int force = 0; @@ -142,10 +182,11 @@ int main(int argc, char *argv[], char *envp[]) setenv("DEVPATH", udev->dev->devpath, 1); setenv("SUBSYSTEM", udev->dev->subsystem, 1); setenv("ACTION", udev->action, 1); + import_uevent_var(udev->dev->devpath); printf("This program is for debugging only, it does not run any program,\n" - "specified by a RUN key. It may show incorrect results, if rules\n" - "match against subsystem specfic kernel event variables.\n" + "specified by a RUN key. It may show incorrect results, because\n" + "some values may be different, or not available at a simulation run.\n" "\n"); info("looking at device '%s' from subsystem '%s'", udev->dev->devpath, udev->dev->subsystem); -- cgit v1.2.3-54-g00ecf From 019d6669076f52994cca199fbbae6eefbb96aeb8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 6 Apr 2007 19:50:19 +0200 Subject: udevinfo: export all information stored in database --- udev_db.c | 4 ++-- udev_rules.c | 2 +- udevinfo.c | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/udev_db.c b/udev_db.c index 7b8d02bf81..abc1e5ad5a 100644 --- a/udev_db.c +++ b/udev_db.c @@ -157,9 +157,9 @@ int udev_db_add_device(struct udevice *udev) name_index(udev->dev->devpath, name_loop->name, 1); } fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); - if (udev->link_priority) + if (udev->link_priority != 0) fprintf(f, "L:%u\n", udev->link_priority); - if (udev->partitions) + if (udev->partitions != 0) fprintf(f, "A:%u\n", udev->partitions); if (udev->ignore_remove) fprintf(f, "R:%u\n", udev->ignore_remove); diff --git a/udev_rules.c b/udev_rules.c index d77d5ec196..6bd28ad4b7 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -914,7 +914,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) udev->ignore_remove = 1; dbg("remove event should be ignored"); } - if (rule->link_priority) { + if (rule->link_priority != 0) { udev->link_priority = rule->link_priority; info("link_priority=%i", udev->link_priority); } diff --git a/udevinfo.c b/udevinfo.c index 4b4876cc11..f36f240f0a 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -144,9 +144,14 @@ static void print_record(struct udevice *udev) printf("P: %s\n", udev->dev->devpath); printf("N: %s\n", udev->name); - printf("L: %i\n", udev->link_priority); list_for_each_entry(name_loop, &udev->symlink_list, node) printf("S: %s\n", name_loop->name); + if (udev->link_priority != 0) + printf("L: %i\n", udev->link_priority); + if (udev->partitions != 0) + printf("A:%u\n", udev->partitions); + if (udev->ignore_remove) + printf("R:%u\n", udev->ignore_remove); list_for_each_entry(name_loop, &udev->env_list, node) printf("E: %s\n", name_loop->name); } -- cgit v1.2.3-54-g00ecf From 0809c264e9878cdd1c61d9fb0e077972bc596ef8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 6 Apr 2007 19:53:20 +0200 Subject: default rules: add libata compat links --- etc/udev/rules.d/60-persistent-input.rules | 3 ++- etc/udev/rules.d/60-persistent-storage.rules | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules index 4bc034ce1a..623eb7d24c 100644 --- a/etc/udev/rules.d/60-persistent-input.rules +++ b/etc/udev/rules.d/60-persistent-input.rules @@ -14,7 +14,8 @@ DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" -ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" +# fill empty serial number +ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" # by-id links KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index a7efb327a2..b7af0bcb70 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -36,6 +36,11 @@ KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +# libata compat (links like hd*) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", ENV{ID_ATA_COMPAT}="$result" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" +KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" + KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From 7c70c25212fe1b4918c4d7f270c46430111ad365 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 12 Apr 2007 01:10:08 +0200 Subject: create_floppy_devices: create nodes with correct selinux context --- extras/floppy/create_floppy_devices.c | 1 + udev_selinux.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 7a3ddb2ffe..7c1ea0715a 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -155,6 +155,7 @@ int main(int argc, char **argv) if (type == 0) return 0; + udev_config_init(); selinux_init(); i = 0; diff --git a/udev_selinux.c b/udev_selinux.c index 42568e4195..77c0e7dc4a 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -118,10 +118,12 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int char *media; int ret = -1; - media = get_media(devname, mode); - if (media) { - ret = matchmediacon(media, &scontext); - free(media); + if (devname) { + media = get_media(devname, mode); + if (media) { + ret = matchmediacon(media, &scontext); + free(media); + } } if (ret < 0) @@ -152,6 +154,8 @@ void selinux_init(void) * restoration creation purposes. */ if (is_selinux_running()) { + if (!udev_root[0]) + err("selinux_init: udev_root not set\n"); matchpathcon_init_prefix(NULL, udev_root); if (getfscreatecon(&prev_scontext) < 0) { err("getfscreatecon failed\n"); -- cgit v1.2.3-54-g00ecf From 730cf8a7b34f5ae5722283c957701709f2849ad8 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Thu, 12 Apr 2007 10:15:40 +0200 Subject: update Gentoo rules --- etc/udev/gentoo/05-udev-early.rules | 4 - etc/udev/gentoo/50-udev.rules | 302 ++++++++++++++++++++++++++++++++++++ etc/udev/gentoo/udev.rules | 302 ------------------------------------ 3 files changed, 302 insertions(+), 306 deletions(-) create mode 100644 etc/udev/gentoo/50-udev.rules delete mode 100644 etc/udev/gentoo/udev.rules diff --git a/etc/udev/gentoo/05-udev-early.rules b/etc/udev/gentoo/05-udev-early.rules index ecf079c057..ee349dc981 100644 --- a/etc/udev/gentoo/05-udev-early.rules +++ b/etc/udev/gentoo/05-udev-early.rules @@ -7,7 +7,3 @@ ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" ACTION=="add", SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" - -# Set IN_HOTPLUG for compatibility with init-scripts called from udev -ENV{IN_HOTPLUG}="1" - diff --git a/etc/udev/gentoo/50-udev.rules b/etc/udev/gentoo/50-udev.rules new file mode 100644 index 0000000000..28875536a0 --- /dev/null +++ b/etc/udev/gentoo/50-udev.rules @@ -0,0 +1,302 @@ +# /etc/udev/rules/50-udev.rules: device naming rules for udev +# +# Gentoo specific rules +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# Try not to modify this file, if you wish to change things, create a new rule +# file that can be run before this one. +# + +# Net devices can have arbitrary names, even +# ones set by the user. Not try to match normal +# rules on net devices (Bug #166652) +SUBSYSTEM=="net", GOTO="gentoo_device_rules_end" + +# console +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcs*", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcsa*", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty[0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="tty[0-9][0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" +KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" + +# tty devices +KERNEL=="ttyS[0-9]*", NAME="%k", SYMLINK="tts/%n", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB[0-9]*", NAME="%k", SYMLINK="tts/USB%n", GROUP="uucp", MODE="0660" +KERNEL=="ippp0", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="isdn*" NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="dcbri*", NAME="%k", GROUP="uucp", MODE="0660" +KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" + +# all block devices +SUBSYSTEM=="block", GROUP="disk" + +# cdrom symlinks and other good cdrom naming +KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", ACTION=="add", IMPORT{program}="cdrom_id --export $tempnode" +ENV{ID_CDROM}=="?*", GROUP="cdrom" + +# assign cdrom-permission also to associated generic device (for cd-burning ...) +KERNEL=="sg[0-9]*", ACTION=="add", ATTRS{type}=="4|5", GROUP="cdrom" + +# disk devices +KERNEL=="sd*", NAME="%k", GROUP="disk" +KERNEL=="dasd*", NAME="%k", GROUP="disk" +KERNEL=="ataraid*", NAME="%k", GROUP="disk" + +# compaq smart array +KERNEL=="cciss*", NAME="%k" +KERNEL=="ida*", NAME="%k" + +# mylex +KERNEL=="rd*", NAME="%k" + +# dri devices +KERNEL=="card*", NAME="dri/card%n", GROUP="video" +KERNEL=="nvidia*", NAME="%k", GROUP="video" +KERNEL=="3dfx*", NAME="%k", GROUP="video" + +# alsa devices +SUBSYSTEM=="sound", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hw[CD0-9]*", NAME="snd/%k" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# capi devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20", GROUP="uucp", MODE="0660" +KERNEL=="capi*", NAME="capi/%n", GROUP="uucp", MODE="0660" + +# cpu devices +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +# fb devices +KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" + +# floppy devices +KERNEL=="fd[0-9]*", NAME="floppy/%k", SYMLINK+="%k", GROUP="floppy" +KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0660 -G floppy $root/floppy/%k" +KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f $root/floppy/%k?*'" + +# i2c devices +KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" + +# input devices +KERNEL=="mice", NAME="input/%k", MODE="0644" +KERNEL=="mouse*", NAME="input/%k", MODE="0644" +KERNEL=="event*", NAME="input/%k", MODE="0600" +KERNEL=="js*", NAME="input/%k", MODE="0664" +KERNEL=="ts*", NAME="input/%k", MODE="0600" + +# loop devices +KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k", GROUP="disk" + +# md block devices +KERNEL=="md[0-9]*", NAME="md/%n", SYMLINK+="%k", GROUP="disk" + +# aoe char devices, +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" + +# misc devices +KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="rtc", NAME="misc/%k", SYMLINK+="%k", MODE="0664" +KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" + +# netlink devices +KERNEL=="route", NAME="netlink/%k" +KERNEL=="skip", NAME="netlink/%k" +KERNEL=="usersock", NAME="netlink/%k" +KERNEL=="fwmonitor", NAME="netlink/%k" +KERNEL=="tcpdiag", NAME="netlink/%k" +KERNEL=="nflog", NAME="netlink/%k" +KERNEL=="xfrm", NAME="netlink/%k" +KERNEL=="arpd", NAME="netlink/%k" +KERNEL=="route6", NAME="netlink/%k" +KERNEL=="ip6_fw", NAME="netlink/%k" +KERNEL=="dnrtmsg", NAME="netlink/%k" +KERNEL=="tap*", NAME="netlink/%k" + +# network devices +KERNEL=="tun", NAME="net/%k", MODE="0600" + +# ramdisk devices +KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" + +# IEEE1394 (firewire) devices (must be before raw devices below) +KERNEL=="raw1394", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" + +# raw devices +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="ram*", NAME="%k", GROUP="disk" + +# sound devices +KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" + +# memory devices +KERNEL=="random", NAME="%k", MODE="0666" +KERNEL=="urandom", NAME="%k", MODE="0444" +KERNEL=="mem", NAME="%k", MODE="0640" +KERNEL=="kmem", NAME="%k", MODE="0640" +KERNEL=="port", NAME="%k", MODE="0640" +KERNEL=="full", NAME="%k", MODE="0666" +KERNEL=="null", NAME="%k", MODE="0666" +KERNEL=="zero", NAME="%k", MODE="0666" + +# usb devices +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="auer*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k", GROUP="usb" +KERNEL=="dabusb*", NAME="usb/%k" +BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" + +# v4l devices +KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" +KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" +KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" +KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" + +# dvb devices +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" + +# Asterisk Zaptel devices +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# pilot/palm devices +KERNEL=="pilot", NAME="%k", GROUP="uucp" + +# jaz devices +KERNEL=="jaz*", NAME="%k", GROUP="disk" + +# zip devices +KERNEL=="pocketzip*", NAME="%k", GROUP="disk" +KERNEL=="zip*", NAME="%k", GROUP="disk" + +# ls120 devices +KERNEL=="ls120", NAME="%k", GROUP="disk" + +# lp devices +KERNEL=="lp*", NAME="%k", GROUP="lp" +KERNEL=="irlpt", NAME="%k", GROUP="lp" +KERNEL=="usblp", NAME="%k", GROUP="lp" +KERNEL=="lp*", NAME="%k", GROUP="lp" +KERNEL=="parport*", NAME="%k", GROUP="lp" + +# tape devices +KERNEL=="ht*", NAME="%k", GROUP="tape" +KERNEL=="nht*", NAME="%k", GROUP="tape" +KERNEL=="pt*", NAME="%k", GROUP="tape" +KERNEL=="npt*", NAME="%k", GROUP="tape" +KERNEL=="st*", NAME="%k", GROUP="tape" +KERNEL=="nst*", NAME="%k", GROUP="tape" +KERNEL=="osst*", NAME="%k", GROUP="tape" +KERNEL=="nosst*", NAME="%k", GROUP="tape" + +# diskonkey devices +KERNEL=="diskonkey*", NAME="%k", GROUP="disk" + +# rem_ide devices +KERNEL=="microdrive*", NAME="%k", GROUP="disk" + +# kbd devices +KERNEL=="kbd", NAME="%k", MODE="0664" + +# Sony Vaio Jogdial sonypi device +KERNEL=="sonypi", NAME="%k", MODE="0666" + +# packet devices +KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrw", MODE="0660" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" + +# infiniband devices +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" + + +# usbfs-like device nodes +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" + + +# Setting timeout for tape-devices to 900 seconds +# if you need timeouts for other devices add a similar rule +# with correct type-value, or open a bug on bugs.gentoo.org. +ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="1", \ + RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" + + +# Module autoloading +ACTION!="add", GOTO="hotplug_no_add_event" + +# check if the device has already been claimed by a driver +ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_load_end" + +# this driver is broken and should not be loaded automatically +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_load_end" + +# Autoload modules that lack aliases but have them defined inutoload modules +ENV{MODALIAS}=="?*", RUN+="modprobe.sh $env{MODALIAS}" + +# /etc/modprobe.conf. +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" +# needed aliases are defined in /etc/modprobe.d/pnp-aliases + + +SUBSYSTEM=="i2o", RUN+="modprobe.sh i2o_block" +SUBSYSTEM=="mmc", RUN+="modprobe.sh mmc_block" + +# Parts taken from redhat-rules +# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC +# sr: 4 TYPE_WORM, 5 TYPE_ROM +# st/osst: 1 TYPE_TAPE + +# Load driver for scsi-device +SUBSYSTEM!="scsi_device", GOTO="hotplug_scsi_end" +ATTRS{type}=="?*", RUN+="modprobe.sh sg" +ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" +ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" +ATTRS{type}=="8", RUN+="modprobe.sh ch" + +ATTRS{type}=="1", ENV{ID_SCSI_TAPE_DRIVER}="st" +ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}!="ADR*", ENV{ID_SCSI_TAPE_DRIVER}="osst" +ENV{ID_SCSI_TAPE_DRIVER}=="?*", RUN+="modprobe.sh $env{ID_SCSI_TAPE_DRIVER}" +LABEL="hotplug_scsi_end" + + +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="modprobe.sh ide-scsi" + +LABEL="hotplug_load_end" + + +# Load firmware +SUBSYSTEM=="firmware", RUN+="firmware.sh" + +LABEL="hotplug_no_add_event" + +LABEL="gentoo_device_rules_end" diff --git a/etc/udev/gentoo/udev.rules b/etc/udev/gentoo/udev.rules deleted file mode 100644 index 28875536a0..0000000000 --- a/etc/udev/gentoo/udev.rules +++ /dev/null @@ -1,302 +0,0 @@ -# /etc/udev/rules/50-udev.rules: device naming rules for udev -# -# Gentoo specific rules -# -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# Try not to modify this file, if you wish to change things, create a new rule -# file that can be run before this one. -# - -# Net devices can have arbitrary names, even -# ones set by the user. Not try to match normal -# rules on net devices (Bug #166652) -SUBSYSTEM=="net", GOTO="gentoo_device_rules_end" - -# console -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcs*", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcsa*", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="tty[0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="tty[0-9][0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" - -# tty devices -KERNEL=="ttyS[0-9]*", NAME="%k", SYMLINK="tts/%n", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB[0-9]*", NAME="%k", SYMLINK="tts/USB%n", GROUP="uucp", MODE="0660" -KERNEL=="ippp0", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="isdn*" NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="dcbri*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" - -# all block devices -SUBSYSTEM=="block", GROUP="disk" - -# cdrom symlinks and other good cdrom naming -KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", ACTION=="add", IMPORT{program}="cdrom_id --export $tempnode" -ENV{ID_CDROM}=="?*", GROUP="cdrom" - -# assign cdrom-permission also to associated generic device (for cd-burning ...) -KERNEL=="sg[0-9]*", ACTION=="add", ATTRS{type}=="4|5", GROUP="cdrom" - -# disk devices -KERNEL=="sd*", NAME="%k", GROUP="disk" -KERNEL=="dasd*", NAME="%k", GROUP="disk" -KERNEL=="ataraid*", NAME="%k", GROUP="disk" - -# compaq smart array -KERNEL=="cciss*", NAME="%k" -KERNEL=="ida*", NAME="%k" - -# mylex -KERNEL=="rd*", NAME="%k" - -# dri devices -KERNEL=="card*", NAME="dri/card%n", GROUP="video" -KERNEL=="nvidia*", NAME="%k", GROUP="video" -KERNEL=="3dfx*", NAME="%k", GROUP="video" - -# alsa devices -SUBSYSTEM=="sound", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hw[CD0-9]*", NAME="snd/%k" -KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# capi devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20", GROUP="uucp", MODE="0660" -KERNEL=="capi*", NAME="capi/%n", GROUP="uucp", MODE="0660" - -# cpu devices -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode" - -# fb devices -KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" - -# floppy devices -KERNEL=="fd[0-9]*", NAME="floppy/%k", SYMLINK+="%k", GROUP="floppy" -KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0660 -G floppy $root/floppy/%k" -KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f $root/floppy/%k?*'" - -# i2c devices -KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" - -# input devices -KERNEL=="mice", NAME="input/%k", MODE="0644" -KERNEL=="mouse*", NAME="input/%k", MODE="0644" -KERNEL=="event*", NAME="input/%k", MODE="0600" -KERNEL=="js*", NAME="input/%k", MODE="0664" -KERNEL=="ts*", NAME="input/%k", MODE="0600" - -# loop devices -KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k", GROUP="disk" - -# md block devices -KERNEL=="md[0-9]*", NAME="md/%n", SYMLINK+="%k", GROUP="disk" - -# aoe char devices, -SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" -SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" - -# misc devices -KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="rtc", NAME="misc/%k", SYMLINK+="%k", MODE="0664" -KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" - -# netlink devices -KERNEL=="route", NAME="netlink/%k" -KERNEL=="skip", NAME="netlink/%k" -KERNEL=="usersock", NAME="netlink/%k" -KERNEL=="fwmonitor", NAME="netlink/%k" -KERNEL=="tcpdiag", NAME="netlink/%k" -KERNEL=="nflog", NAME="netlink/%k" -KERNEL=="xfrm", NAME="netlink/%k" -KERNEL=="arpd", NAME="netlink/%k" -KERNEL=="route6", NAME="netlink/%k" -KERNEL=="ip6_fw", NAME="netlink/%k" -KERNEL=="dnrtmsg", NAME="netlink/%k" -KERNEL=="tap*", NAME="netlink/%k" - -# network devices -KERNEL=="tun", NAME="net/%k", MODE="0600" - -# ramdisk devices -KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" - -# IEEE1394 (firewire) devices (must be before raw devices below) -KERNEL=="raw1394", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" - -# raw devices -SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL=="ram*", NAME="%k", GROUP="disk" - -# sound devices -KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" - -# memory devices -KERNEL=="random", NAME="%k", MODE="0666" -KERNEL=="urandom", NAME="%k", MODE="0444" -KERNEL=="mem", NAME="%k", MODE="0640" -KERNEL=="kmem", NAME="%k", MODE="0640" -KERNEL=="port", NAME="%k", MODE="0640" -KERNEL=="full", NAME="%k", MODE="0666" -KERNEL=="null", NAME="%k", MODE="0666" -KERNEL=="zero", NAME="%k", MODE="0666" - -# usb devices -KERNEL=="hiddev*", NAME="usb/%k" -KERNEL=="auer*", NAME="usb/%k" -KERNEL=="legousbtower*", NAME="usb/%k", GROUP="usb" -KERNEL=="dabusb*", NAME="usb/%k" -BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" - -# v4l devices -KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" -KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" -KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" -KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" - -# dvb devices -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" - -# Asterisk Zaptel devices -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -# pilot/palm devices -KERNEL=="pilot", NAME="%k", GROUP="uucp" - -# jaz devices -KERNEL=="jaz*", NAME="%k", GROUP="disk" - -# zip devices -KERNEL=="pocketzip*", NAME="%k", GROUP="disk" -KERNEL=="zip*", NAME="%k", GROUP="disk" - -# ls120 devices -KERNEL=="ls120", NAME="%k", GROUP="disk" - -# lp devices -KERNEL=="lp*", NAME="%k", GROUP="lp" -KERNEL=="irlpt", NAME="%k", GROUP="lp" -KERNEL=="usblp", NAME="%k", GROUP="lp" -KERNEL=="lp*", NAME="%k", GROUP="lp" -KERNEL=="parport*", NAME="%k", GROUP="lp" - -# tape devices -KERNEL=="ht*", NAME="%k", GROUP="tape" -KERNEL=="nht*", NAME="%k", GROUP="tape" -KERNEL=="pt*", NAME="%k", GROUP="tape" -KERNEL=="npt*", NAME="%k", GROUP="tape" -KERNEL=="st*", NAME="%k", GROUP="tape" -KERNEL=="nst*", NAME="%k", GROUP="tape" -KERNEL=="osst*", NAME="%k", GROUP="tape" -KERNEL=="nosst*", NAME="%k", GROUP="tape" - -# diskonkey devices -KERNEL=="diskonkey*", NAME="%k", GROUP="disk" - -# rem_ide devices -KERNEL=="microdrive*", NAME="%k", GROUP="disk" - -# kbd devices -KERNEL=="kbd", NAME="%k", MODE="0664" - -# Sony Vaio Jogdial sonypi device -KERNEL=="sonypi", NAME="%k", MODE="0666" - -# packet devices -KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrw", MODE="0660" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" - -# infiniband devices -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" - - -# usbfs-like device nodes -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" - - -# Setting timeout for tape-devices to 900 seconds -# if you need timeouts for other devices add a similar rule -# with correct type-value, or open a bug on bugs.gentoo.org. -ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="1", \ - RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" - - -# Module autoloading -ACTION!="add", GOTO="hotplug_no_add_event" - -# check if the device has already been claimed by a driver -ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_load_end" - -# this driver is broken and should not be loaded automatically -SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_load_end" - -# Autoload modules that lack aliases but have them defined inutoload modules -ENV{MODALIAS}=="?*", RUN+="modprobe.sh $env{MODALIAS}" - -# /etc/modprobe.conf. -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" -# needed aliases are defined in /etc/modprobe.d/pnp-aliases - - -SUBSYSTEM=="i2o", RUN+="modprobe.sh i2o_block" -SUBSYSTEM=="mmc", RUN+="modprobe.sh mmc_block" - -# Parts taken from redhat-rules -# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC -# sr: 4 TYPE_WORM, 5 TYPE_ROM -# st/osst: 1 TYPE_TAPE - -# Load driver for scsi-device -SUBSYSTEM!="scsi_device", GOTO="hotplug_scsi_end" -ATTRS{type}=="?*", RUN+="modprobe.sh sg" -ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" -ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" -ATTRS{type}=="8", RUN+="modprobe.sh ch" - -ATTRS{type}=="1", ENV{ID_SCSI_TAPE_DRIVER}="st" -ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", ENV{ID_SCSI_TAPE_DRIVER}="osst" -ENV{ID_SCSI_TAPE_DRIVER}=="?*", RUN+="modprobe.sh $env{ID_SCSI_TAPE_DRIVER}" -LABEL="hotplug_scsi_end" - - -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="modprobe.sh ide-scsi" - -LABEL="hotplug_load_end" - - -# Load firmware -SUBSYSTEM=="firmware", RUN+="firmware.sh" - -LABEL="hotplug_no_add_event" - -LABEL="gentoo_device_rules_end" -- cgit v1.2.3-54-g00ecf From 878645dca35c0297f1a997b6084d26534086ad35 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Thu, 12 Apr 2007 14:38:46 +0200 Subject: persistent device naming: add joystick links --- etc/udev/rules.d/60-persistent-input.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules index 623eb7d24c..503e61e035 100644 --- a/etc/udev/rules.d/60-persistent-input.rules +++ b/etc/udev/rules.d/60-persistent-input.rules @@ -18,12 +18,12 @@ ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="inp ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" # by-id links -KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" # by-path IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="mouse*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" LABEL="persistent_input_end" -- cgit v1.2.3-54-g00ecf From 3a6704cba7f0e37bcb957f836fa1d5f873f20dae Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Apr 2007 18:55:59 +0200 Subject: create_path: don't fail if something else created the directory Thanks to Jeremy for the patch. --- udev_utils_file.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/udev_utils_file.c b/udev_utils_file.c index e4d5802ff8..ba70b6b395 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -36,14 +36,13 @@ int create_path(const char *path) char *pos; struct stat stats; - strcpy (p, path); + strlcpy(p, path, sizeof(p)); pos = strrchr(p, '/'); if (pos == p || pos == NULL) return 0; while (pos[-1] == '/') pos--; - pos[0] = '\0'; dbg("stat '%s'\n", p); @@ -54,7 +53,12 @@ int create_path(const char *path) return -1; dbg("mkdir '%s'\n", p); - return mkdir(p, 0755); + if (mkdir(p, 0755) == 0) + return 0; + if (errno == EEXIST) + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + return -1; } int delete_path(const char *path) -- cgit v1.2.3-54-g00ecf From fc630edad4631f4c046052f504a67ce9df381531 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 19 Apr 2007 22:21:05 +0200 Subject: udevd: fix serialization of events We see sequences like: UEVENT[1176966403.907336] add@/block/dasda UDEV [1176966403.920359] add@/block/dasda UEVENT[1176966403.964379] add@/block/dasda/dasda1 UEVENT[1176966403.964438] add@/block/dasda/dasda2 UEVENT[1176966403.964483] online@/block/dasda UEVENT[1176966403.964519] online@/block/dasda/dasda1 UEVENT[1176966403.964555] online@/block/dasda/dasda2 UDEV [1176966403.967413] add@/block/dasda/dasda1 UDEV [1176966403.968719] add@/block/dasda/dasda2 UDEV [1176966403.974750] online@/block/dasda/dasda1 UDEV [1176966403.982241] online@/block/dasda/dasda2 UDEV [1176966403.999847] online@/block/dasda where the event for the disk (last event) should come before the events for the partitons. We skipped events for dependency reasons, but the dependency check for later events did not see the skipped events. --- udevd.c | 42 ++++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/udevd.c b/udevd.c index 8f3329ea63..dccc745eff 100644 --- a/udevd.c +++ b/udevd.c @@ -495,26 +495,49 @@ static int compare_devpath(const char *running, const char *waiting) return 0; } -/* returns still running task for the same device, its parent or its physical device */ -static int running_with_devpath(struct udevd_uevent_msg *msg, int limit) +/* lookup event for identical, parent, child, or physical device */ +static int devpath_busy(struct udevd_uevent_msg *msg, int limit) { struct udevd_uevent_msg *loop_msg; int childs_count = 0; + /* check exec-queue which may still contain delayed events we depend on */ + list_for_each_entry(loop_msg, &exec_list, node) { + /* skip ourself and all later events */ + if (loop_msg->seqnum >= msg->seqnum) + break; + + /* check identical, parent, or child device event */ + if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { + dbg("%llu, device event still pending %llu (%s)", + msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + return 2; + } + + /* check physical device event (special case of parent) */ + if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) + if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { + dbg("%llu, physical device event still pending %llu (%s)", + msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + return 3; + } + } + + /* check runing-queue for still running events */ list_for_each_entry(loop_msg, &running_list, node) { if (limit && childs_count++ > limit) { - dbg("%llu, maximum number (%i) of child reached", msg->seqnum, childs_count); + dbg("%llu, maximum number (%i) of childs reached", msg->seqnum, childs_count); return 1; } - /* return running parent/child device event */ + /* check identical, parent, or child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg("%llu, child device event still running %llu (%s)", + dbg("%llu, device event still running %llu (%s)", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 2; } - /* return running physical device event */ + /* check physical device event (special case of parent) */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { dbg("%llu, physical device event still running %llu (%s)", @@ -522,11 +545,10 @@ static int running_with_devpath(struct udevd_uevent_msg *msg, int limit) return 3; } } - return 0; } -/* exec queue management routine executes the events and serializes events in the same sequence */ +/* serializes events for the identical and parent and child devices */ static void msg_queue_manager(void) { struct udevd_uevent_msg *loop_msg; @@ -552,8 +574,8 @@ static void msg_queue_manager(void) } } - /* don't run two processes for the same devpath and wait for the parent*/ - if (running_with_devpath(loop_msg, max_childs)) { + /* serialize and wait for parent or child events */ + if (devpath_busy(loop_msg, max_childs) != 0) { dbg("delay seq %llu (%s)", loop_msg->seqnum, loop_msg->devpath); continue; } -- cgit v1.2.3-54-g00ecf From 8127859217bcc4db6f42f8d549f157df93a44557 Mon Sep 17 00:00:00 2001 From: VMiklos Date: Sun, 22 Apr 2007 14:10:18 +0200 Subject: path_id: add man page --- extras/path_id/Makefile | 2 +- extras/path_id/path_id.8 | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 extras/path_id/path_id.8 diff --git a/extras/path_id/Makefile b/extras/path_id/Makefile index 2f6890cb32..24b47b425a 100644 --- a/extras/path_id/Makefile +++ b/extras/path_id/Makefile @@ -45,7 +45,7 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - @echo "Please create a man page for this tool." + $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: install-man uninstall-man: diff --git a/extras/path_id/path_id.8 b/extras/path_id/path_id.8 new file mode 100644 index 0000000000..e55914de31 --- /dev/null +++ b/extras/path_id/path_id.8 @@ -0,0 +1,26 @@ +.TH PATH_ID 8 "April 2007" "" "Linux Administrator's Manual" +.SH NAME +path_id \- udev callout to provide the shortest possible unique hardware path +to a device for the Linux Persistent Device Naming scheme +.SH SYNOPSIS +DEVPATH=; path_id + +path_id +.SH "DESCRIPTION" +.B path_id +is normally called from a udev rule, to provide udev a unique hardware path for +a device. Udev can use this information to create symlinks in /dev/ to the real +device node. +.SH EXAMPLES +For all block devices on a system: + +.nf +for i in `find /sys/class/block` +do + DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`"; path_id +done +.fi +.SH SEE ALSO +.BR udev (7) +.SH AUTHORS +Developed by Hannes Reinecke . -- cgit v1.2.3-54-g00ecf From 6ecad86d49c7d9602d4b0f36ce53ccb66eb2b80a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 22 Apr 2007 14:19:14 +0200 Subject: path_id: remove broken example --- extras/path_id/path_id | 7 ------- extras/path_id/path_id.8 | 21 +++++---------------- 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 8927d84ffb..a7d650bf42 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -10,13 +10,6 @@ # 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. -# -# to be called from a udev rule to return the name for a symlink -# DEVPATH=; path_id -# path_id - -# examples for all block devices on a system: -# for i in `find /sys/class/block`; do DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`"; path_id; done SYSFS=/sys RESULT=1 diff --git a/extras/path_id/path_id.8 b/extras/path_id/path_id.8 index e55914de31..9dc5965979 100644 --- a/extras/path_id/path_id.8 +++ b/extras/path_id/path_id.8 @@ -1,25 +1,14 @@ .TH PATH_ID 8 "April 2007" "" "Linux Administrator's Manual" .SH NAME -path_id \- udev callout to provide the shortest possible unique hardware path -to a device for the Linux Persistent Device Naming scheme +path_id \- udev callout to create a device path based unique name +for a device to implement the Linux Persistent Device Naming scheme .SH SYNOPSIS -DEVPATH=; path_id - path_id .SH "DESCRIPTION" .B path_id -is normally called from a udev rule, to provide udev a unique hardware path for -a device. Udev can use this information to create symlinks in /dev/ to the real -device node. -.SH EXAMPLES -For all block devices on a system: - -.nf -for i in `find /sys/class/block` -do - DEVPATH="`echo $i | sed -e 's@^/sys\|/dev@@g'`"; path_id -done -.fi +is normally called from a udev rule, to create a unique name, based on +the device properties along the chain of parent devices. Udev uses this +information to create a persistent symlink to the real device node. .SH SEE ALSO .BR udev (7) .SH AUTHORS -- cgit v1.2.3-54-g00ecf From 285e2f52186c9462a0d3ae1aca94077ea3ddfc63 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Apr 2007 17:44:19 +0200 Subject: libvolume_id: do not install static library --- extras/volume_id/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 5ad9f2e561..9858fb02d8 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -102,8 +102,8 @@ libvolume_id.pc: install: all $(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h - $(INSTALL_LIB) -D libvolume_id.a $(DESTDIR)$(usrlibdir)/libvolume_id.a $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) + mkdir -p $(DESTDIR)$(usrlibdir)/ ln -sf $(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) ln -sf $(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc -- cgit v1.2.3-54-g00ecf From 6ff9f552a20ebd2168c65d0c56d7919b8a9d5bba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Apr 2007 18:22:08 +0200 Subject: update SUSE rules --- etc/udev/suse/05-udev-early.rules | 2 +- etc/udev/suse/50-udev-default.rules | 2 +- etc/udev/suse/60-persistent-input.rules | 7 ++++--- etc/udev/suse/64-device-mapper.rules | 7 ++++--- etc/udev/suse/64-md-raid.rules | 12 ++++++++++++ 5 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 etc/udev/suse/64-md-raid.rules diff --git a/etc/udev/suse/05-udev-early.rules b/etc/udev/suse/05-udev-early.rules index 7e94ee95c9..ec94c35816 100644 --- a/etc/udev/suse/05-udev-early.rules +++ b/etc/udev/suse/05-udev-early.rules @@ -1,3 +1,3 @@ # sysfs is populated after the event is sent -ACTION=="add", SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt" +ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 2d4c418e1e..d63c047611 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -91,7 +91,6 @@ KERNEL=="pktcdvd", NAME="pktcdvd/control" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" # additional floppy devices (no sysfs entries) -KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G disk $root/%k" # block devices @@ -130,6 +129,7 @@ KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" # libusb device access SUBSYSTEM=="usb_device", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" +#SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" # kernel firmware loader SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" diff --git a/etc/udev/suse/60-persistent-input.rules b/etc/udev/suse/60-persistent-input.rules index 4bc034ce1a..503e61e035 100644 --- a/etc/udev/suse/60-persistent-input.rules +++ b/etc/udev/suse/60-persistent-input.rules @@ -14,15 +14,16 @@ DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" -ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" +# fill empty serial number +ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" # by-id links -KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" # by-path IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="mouse*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" LABEL="persistent_input_end" diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index 377af786a6..a84b1077d0 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -3,14 +3,15 @@ KERNEL=="device-mapper", SYMLINK+="mapper/control" -KERNEL=="dm-*", ACTION=="add|change", GOTO="device_mapper_do" -GOTO="device_mapper_end" +KERNEL!="dm-*", GOTO="device_mapper_end" +ACTION!="add|change", GOTO="device_mapper_end" -LABEL="device_mapper_do" +# skip snapshot and error tables PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" IMPORT{program}="vol_id --export $tempnode" +OPTIONS="link_priority=-100" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" diff --git a/etc/udev/suse/64-md-raid.rules b/etc/udev/suse/64-md-raid.rules new file mode 100644 index 0000000000..9070e215bc --- /dev/null +++ b/etc/udev/suse/64-md-raid.rules @@ -0,0 +1,12 @@ +# md links hook into "change" events, when the array becomes available + +KERNEL!="md[0-9]*", GOTO="md_end" +ACTION!="add|change", GOTO="md_end" + +ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" + +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +LABEL="md_end" -- cgit v1.2.3-54-g00ecf From 7c1ecbfbf1985bb32165d40bb41009d510d6cb16 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Apr 2007 18:22:43 +0200 Subject: release 109 --- ChangeLog | 27 +++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 4 ++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9ac5246c13..19902091c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +Summary of changes from v108 to v109 +============================================ + +Harald Hoyer (1): + create_floppy_devices: create nodes with correct selinux context + +Kay Sievers (11): + udevtest: export ACTION string if given as option + update SUSE rules + make ACTION!="add|change" working + udevtest: import uevent variables if possible + udevinfo: export all information stored in database + default rules: add libata compat links + create_path: don't fail if something else created the directory + udevd: fix serialization of events + path_id: remove broken example + libvolume_id: do not install static library + update SUSE rules + +Matthias Schwarzott (2): + update Gentoo rules + persistent device naming: add joystick links + +VMiklos (1): + path_id: add man page + + Summary of changes from v107 to v108 ============================================ diff --git a/Makefile b/Makefile index 4e32312a58..a7a2cbfcdc 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 108 +VERSION = 109 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2c4e64ae7f..0d984bcc73 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 109 +======== +Bugfixes. + udev 108 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 9c84cf964c2aa8f5aa7b800c5622b21140854701 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Apr 2007 01:49:43 +0200 Subject: remove eventrecorder.sh --- extras/eventrecorder.sh | 4 ---- 1 file changed, 4 deletions(-) delete mode 100755 extras/eventrecorder.sh diff --git a/extras/eventrecorder.sh b/extras/eventrecorder.sh deleted file mode 100755 index d3e4a70c95..0000000000 --- a/extras/eventrecorder.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -[ -d /events ] || exit 0 -set > /events/debug.$SEQNUM.$SUBSYSTEM.$ACTION.$$ -- cgit v1.2.3-54-g00ecf From c77f75cad59710c4c36521a922931678c60077d4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Apr 2007 01:50:16 +0200 Subject: update SUSE rules --- etc/udev/suse/64-md-raid.rules | 1 + etc/udev/suse/95-udev-late.rules | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/etc/udev/suse/64-md-raid.rules b/etc/udev/suse/64-md-raid.rules index 9070e215bc..3da64150ae 100644 --- a/etc/udev/suse/64-md-raid.rules +++ b/etc/udev/suse/64-md-raid.rules @@ -6,6 +6,7 @@ ACTION!="add|change", GOTO="md_end" ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" IMPORT{program}="vol_id --export $tempnode" +OPTIONS="link_priority=100" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" diff --git a/etc/udev/suse/95-udev-late.rules b/etc/udev/suse/95-udev-late.rules index 81331ad6b7..6b79a24641 100644 --- a/etc/udev/suse/95-udev-late.rules +++ b/etc/udev/suse/95-udev-late.rules @@ -1,6 +1,3 @@ -# debug events to /events, but not on default udev_log="err" -ENV{UDEV_LOG}=="[4-9]", RUN+="eventrecorder.sh" - # event to be catched by udevmonitor RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From 07bc6002cac04de7dc80fae0287695f91b2c3f23 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Apr 2007 18:35:24 +0200 Subject: volume_id: add md metadata 1.0, 1.1, 1.2 support --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/linux_raid.c | 110 ++++++++++++++++++++++++++++++-------- 2 files changed, 90 insertions(+), 22 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 9858fb02d8..41b7ecb7af 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 75 +SHLIB_REV = 76 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index a9c5d61adc..009c714bd1 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -22,12 +22,13 @@ #include #include #include +#include #include "libvolume_id.h" #include "util.h" -static struct mdp_super_block { - uint8_t md_magic[4]; +static struct mdp0_super_block { + uint32_t md_magic; uint32_t major_version; uint32_t minor_version; uint32_t patch_version; @@ -43,42 +44,109 @@ static struct mdp_super_block { uint32_t set_uuid1; uint32_t set_uuid2; uint32_t set_uuid3; -} PACKED *mdp; +} PACKED *mdp0; + +struct mdp1_super_block { + uint32_t magic; + uint32_t major_version; + uint32_t feature_map; + uint32_t pad0; + uint8_t set_uuid[16]; + uint8_t set_name[32]; +} PACKED *mdp1; #define MD_RESERVED_BYTES 0x10000 -#define MD_MAGIC "\xfc\x4e\x2b\xa9" -#define MD_MAGIC_SWAP "\xa9\x2b\x4e\xfc" +#define MD_SB_MAGIC 0xa92b4efc -int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) +static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; - uint64_t sboff; - uint8_t uuid[16]; + union { + uint32_t ints[4]; + uint8_t bytes[16]; + } uuid; info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) return -1; - sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; - buf = volume_id_get_buffer(id, off + sboff, 0x800); + buf = volume_id_get_buffer(id, off, 0x800); + if (buf == NULL) + return -1; + mdp0 = (struct mdp0_super_block *) buf; + + if (le32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) { + uuid.ints[0] = bswap_32(mdp0->set_uuid0); + uuid.ints[1] = bswap_32(mdp0->set_uuid1); + uuid.ints[2] = bswap_32(mdp0->set_uuid2); + uuid.ints[3] = bswap_32(mdp0->set_uuid3); + volume_id_set_uuid(id, uuid.bytes, UUID_DCE); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", + le32_to_cpu(mdp0->major_version), + le32_to_cpu(mdp0->minor_version), + le32_to_cpu(mdp0->patch_version)); + } else if (be32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) { + uuid.ints[0] = mdp0->set_uuid0; + uuid.ints[1] = mdp0->set_uuid1; + uuid.ints[2] = mdp0->set_uuid2; + uuid.ints[3] = mdp0->set_uuid3; + volume_id_set_uuid(id, uuid.bytes, UUID_DCE); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", + be32_to_cpu(mdp0->major_version), + be32_to_cpu(mdp0->minor_version), + be32_to_cpu(mdp0->patch_version)); + } else + return -1; + + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "linux_raid_member"; + return 0; +} + +static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + + info("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + + buf = volume_id_get_buffer(id, off, 0x800); if (buf == NULL) return -1; - mdp = (struct mdp_super_block *) buf; + mdp1 = (struct mdp1_super_block *) buf; - if ((memcmp(mdp->md_magic, MD_MAGIC, 4) != 0) && - (memcmp(mdp->md_magic, MD_MAGIC_SWAP, 4) != 0)) + if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC) return -1; - memcpy(uuid, &mdp->set_uuid0, 4); - memcpy(&uuid[4], &mdp->set_uuid1, 12); - volume_id_set_uuid(id, uuid, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", - le32_to_cpu(mdp->major_version), - le32_to_cpu(mdp->minor_version), - le32_to_cpu(mdp->patch_version)); - dbg("found raid signature"); + volume_id_set_uuid(id, mdp1->set_uuid, UUID_DCE); + volume_id_set_label_raw(id, mdp1->set_name, 32); + volume_id_set_label_string(id, mdp1->set_name, 32); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le32_to_cpu(mdp1->major_version)); volume_id_set_usage(id, VOLUME_ID_RAID); id->type = "linux_raid_member"; return 0; } + +int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + uint64_t sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; + + /* version 0 at the end of the device */ + if (volume_id_probe_linux_raid0(id, off + sboff, size) == 0) + return 0; + + /* version 1.0 at the end of the device */ + if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) + return 0; + + /* version 1.1 at the start of the device */ + if (volume_id_probe_linux_raid1(id, off, size) == 0) + return 0; + + /* version 1.2 at 4k offset from the start */ + if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0) + return 0; + + return -1; +} -- cgit v1.2.3-54-g00ecf From db6e59df561dbedb89a27d7362d6564847258bfe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Apr 2007 01:52:00 +0200 Subject: unset variable with ENV{VAR}="" --- udev.h | 1 + udev_rules.c | 17 +++++++++++------ udev_utils.c | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/udev.h b/udev.h index 5bd0e301c6..6ef95133d5 100644 --- a/udev.h +++ b/udev.h @@ -137,6 +137,7 @@ struct name_entry { extern int log_priority(const char *priority); extern char *name_list_add(struct list_head *name_list, const char *name, int sort); extern char *name_list_key_add(struct list_head *name_list, const char *key, const char *value); +extern int name_list_key_remove(struct list_head *name_list, const char *key); extern void name_list_cleanup(struct list_head *name_list); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); extern uid_t lookup_user(const char *user); diff --git a/udev_rules.c b/udev_rules.c index 6bd28ad4b7..61b39b45c8 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -831,18 +831,23 @@ try_parent: char temp_value[NAME_SIZE]; const char *key_name = key_pair_name(rule, pair); const char *value = key_val(rule, &pair->key); - char *key_value; /* make sure we don't write to the same string we possibly read from */ strlcpy(temp_value, value, sizeof(temp_value)); udev_rules_apply_format(udev, temp_value, NAME_SIZE); - key_value = name_list_key_add(&udev->env_list, key_name, temp_value); - if (key_value == NULL) - break; + if (temp_value[0] == '\0') { + name_list_key_remove(&udev->env_list, key_name); + unsetenv(key_name); + info("unset ENV '%s'", key_name); + } else { + char *key_value = name_list_key_add(&udev->env_list, key_name, temp_value); - putenv(key_value); - dbg("export ENV '%s'", key_value); + if (key_value == NULL) + break; + putenv(key_value); + info("set ENV '%s'", key_value); + } } } diff --git a/udev_utils.c b/udev_utils.c index e892012132..6d646b0ee6 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -110,6 +110,26 @@ char *name_list_key_add(struct list_head *name_list, const char *key, const char return new_name->name; } +int name_list_key_remove(struct list_head *name_list, const char *key) +{ + struct name_entry *name_loop; + struct name_entry *temp_loop; + size_t keylen = strlen(key); + int retval = 0; + + list_for_each_entry_safe(name_loop, temp_loop, name_list, node) { + if (strncmp(name_loop->name, key, keylen) != 0) + continue; + if (name_loop->name[keylen] != '=') + continue; + list_del(&name_loop->node); + free(name_loop); + retval = 1; + break; + } + return retval; +} + void name_list_cleanup(struct list_head *name_list) { struct name_entry *name_loop; -- cgit v1.2.3-54-g00ecf From a0ee4ac513469c9974c878348a52bd42c82574a6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Apr 2007 12:56:50 +0200 Subject: delete copies of default rules in SUSE rules --- etc/udev/suse/05-udev-early.rules | 3 -- etc/udev/suse/60-persistent-input.rules | 30 --------------- etc/udev/suse/60-persistent-storage.rules | 64 ------------------------------- etc/udev/suse/95-udev-late.rules | 3 -- 4 files changed, 100 deletions(-) delete mode 100644 etc/udev/suse/05-udev-early.rules delete mode 100644 etc/udev/suse/60-persistent-input.rules delete mode 100644 etc/udev/suse/60-persistent-storage.rules delete mode 100644 etc/udev/suse/95-udev-late.rules diff --git a/etc/udev/suse/05-udev-early.rules b/etc/udev/suse/05-udev-early.rules deleted file mode 100644 index ec94c35816..0000000000 --- a/etc/udev/suse/05-udev-early.rules +++ /dev/null @@ -1,3 +0,0 @@ -# sysfs is populated after the event is sent -ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" - diff --git a/etc/udev/suse/60-persistent-input.rules b/etc/udev/suse/60-persistent-input.rules deleted file mode 100644 index 503e61e035..0000000000 --- a/etc/udev/suse/60-persistent-input.rules +++ /dev/null @@ -1,30 +0,0 @@ -ACTION!="add", GOTO="persistent_input_end" -SUBSYSTEM!="input", GOTO="persistent_input_end" -KERNEL=="input[0-9]*", GOTO="persistent_input_end" - -# usb devices -SUBSYSTEMS=="usb", IMPORT{program}="usb_id -x" -SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" -SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" - -# other devices -DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" -DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" -DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" -ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" -ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" - -# fill empty serial number -ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" - -# by-id links -KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" - -# by-path -IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" -ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" - -LABEL="persistent_input_end" - diff --git a/etc/udev/suse/60-persistent-storage.rules b/etc/udev/suse/60-persistent-storage.rules deleted file mode 100644 index b7af0bcb70..0000000000 --- a/etc/udev/suse/60-persistent-storage.rules +++ /dev/null @@ -1,64 +0,0 @@ -# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_storage_end" - -KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" -KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" - -# type 8 devices are "Medium Changers" -KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" - -# never access non-cdrom removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" - -# for partitions import parent information -KERNEL=="*[0-9]", IMPORT{parent}="ID_*" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# libata compat (links like hd*) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", ENV{ID_ATA_COMPAT}="$result" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" -KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" - -KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_storage_end" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" -IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -LABEL="persistent_storage_end" diff --git a/etc/udev/suse/95-udev-late.rules b/etc/udev/suse/95-udev-late.rules deleted file mode 100644 index 6b79a24641..0000000000 --- a/etc/udev/suse/95-udev-late.rules +++ /dev/null @@ -1,3 +0,0 @@ -# event to be catched by udevmonitor -RUN+="socket:/org/kernel/udev/monitor" - -- cgit v1.2.3-54-g00ecf From 702e02313cffa3b7f91f6e0aa163bc6a7df0c2bd Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Wed, 25 Apr 2007 23:22:25 +0200 Subject: Makefile: respect CFLAGS/LDFLAGS --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a7a2cbfcdc..072ae7f5cd 100644 --- a/Makefile +++ b/Makefile @@ -113,13 +113,13 @@ LD = $(CROSS_COMPILE)gcc AR = $(CROSS_COMPILE)ar RANLIB = $(CROSS_COMPILE)ranlib -CFLAGS = -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 +CFLAGS += -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes CFLAGS += $(WARNINGS) -LDFLAGS = -Wl,-warn-common +LDFLAGS += -Wl,-warn-common OPTFLAGS = -Os CFLAGS += $(OPTFLAGS) -- cgit v1.2.3-54-g00ecf From 01ad1ef5f367f1e3e777d03f08b78a1fc37a8f05 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 Apr 2007 22:46:27 +0200 Subject: volume_id: ext - fix endianess in version number --- extras/volume_id/lib/ext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index 8fc7a747dc..8b3af3aab0 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -94,8 +94,8 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_label_raw(id, es->s_volume_name, 16); volume_id_set_label_string(id, es->s_volume_name, 16); volume_id_set_uuid(id, es->s_uuid, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", es->s_rev_level, es->s_minor_rev_level); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", + le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level)); /* check for external journal device */ if ((le32_to_cpu(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { -- cgit v1.2.3-54-g00ecf From 1343a9524f9d2145dfbf2ba479eb859faf6a1e95 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 26 Apr 2007 22:52:20 +0200 Subject: udevcontrol: allow to set global variables in udevd The initial patch is from Harald, possible new bugs are from me. --- udevcontrol.c | 120 ++++++++++++++++++++++++++++++---------------------------- udevd.8 | 5 +++ udevd.c | 16 ++++++++ udevd.h | 1 + udevd.xml | 6 +++ 5 files changed, 91 insertions(+), 57 deletions(-) diff --git a/udevcontrol.c b/udevcontrol.c index 6ca90855c5..b20ce2e071 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -54,9 +54,9 @@ int main(int argc, char *argv[], char *envp[]) struct sockaddr_un saddr; socklen_t addrlen; const char *env; + const char *arg; const char *val; int *intval; - int i; int retval = 1; env = getenv("UDEV_LOG"); @@ -70,67 +70,73 @@ int main(int argc, char *argv[], char *envp[]) fprintf(stderr, "missing command\n\n"); goto exit; } - memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); - - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; - - if (!strcmp(arg, "stop_exec_queue")) - ctrl_msg.type = UDEVD_CTRL_STOP_EXEC_QUEUE; - else if (!strcmp(arg, "start_exec_queue")) - ctrl_msg.type = UDEVD_CTRL_START_EXEC_QUEUE; - else if (!strcmp(arg, "reload_rules")) - ctrl_msg.type = UDEVD_CTRL_RELOAD_RULES; - else if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { - intval = (int *) ctrl_msg.buf; - val = &arg[strlen("log_priority=")]; - ctrl_msg.type = UDEVD_CTRL_SET_LOG_LEVEL; - *intval = log_priority(val); - info("send log_priority=%i", *intval); - } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { - char *endp; - int count; - - intval = (int *) ctrl_msg.buf; - val = &arg[strlen("max_childs=")]; - ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS; - count = strtoul(val, &endp, 0); - if (endp[0] != '\0' || count < 1) { - fprintf(stderr, "invalid number\n"); - goto exit; - } - *intval = count; - info("send max_childs=%i", *intval); - } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { - char *endp; - int count; - - intval = (int *) ctrl_msg.buf; - val = &arg[strlen("max_childs_running=")]; - ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS_RUNNING; - count = strtoul(val, &endp, 0); - if (endp[0] != '\0' || count < 1) { - fprintf(stderr, "invalid number\n"); - goto exit; - } - *intval = count; - info("send max_childs_running=%i", *intval); - } else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { - printf("Usage: udevcontrol COMMAND\n" - " log_priority= set the udev log level for the daemon\n" - " stop_exec_queue keep udevd from executing events, queue only\n" - " start_exec_queue execute events, flush queue\n" - " reload_rules reloads the rules files\n" - " max_childs= maximum number of childs\n" - " max_childs_running= maximum number of childs running at the same time\n" - " help print this help text\n\n"); + arg = argv[1]; + + if (!strcmp(arg, "stop_exec_queue")) + ctrl_msg.type = UDEVD_CTRL_STOP_EXEC_QUEUE; + else if (!strcmp(arg, "start_exec_queue")) + ctrl_msg.type = UDEVD_CTRL_START_EXEC_QUEUE; + else if (!strcmp(arg, "reload_rules")) + ctrl_msg.type = UDEVD_CTRL_RELOAD_RULES; + else if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { + intval = (int *) ctrl_msg.buf; + val = &arg[strlen("log_priority=")]; + ctrl_msg.type = UDEVD_CTRL_SET_LOG_LEVEL; + *intval = log_priority(val); + info("send log_priority=%i", *intval); + } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { + char *endp; + int count; + + intval = (int *) ctrl_msg.buf; + val = &arg[strlen("max_childs=")]; + ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS; + count = strtoul(val, &endp, 0); + if (endp[0] != '\0' || count < 1) { + fprintf(stderr, "invalid number\n"); + goto exit; + } + *intval = count; + info("send max_childs=%i", *intval); + } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { + char *endp; + int count; + + intval = (int *) ctrl_msg.buf; + val = &arg[strlen("max_childs_running=")]; + ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS_RUNNING; + count = strtoul(val, &endp, 0); + if (endp[0] != '\0' || count < 1) { + fprintf(stderr, "invalid number\n"); goto exit; - } else { - fprintf(stderr, "unrecognized command '%s'\n", arg); + } + *intval = count; + info("send max_childs_running=%i", *intval); + } else if (!strncmp(arg, "env", strlen("env"))) { + val = argv[2]; + if (val == NULL) { + fprintf(stderr, "missing key\n"); goto exit; } + ctrl_msg.type = UDEVD_CTRL_ENV; + strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf)); + info("send env '%s'", val); + } else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + printf("Usage: udevcontrol COMMAND\n" + " log_priority= set the udev log level for the daemon\n" + " stop_exec_queue keep udevd from executing events, queue only\n" + " start_exec_queue execute events, flush queue\n" + " reload_rules reloads the rules files\n" + " env = set a global environment variable\n" + " max_childs= maximum number of childs\n" + " max_childs_running= maximum number of childs running at the same time\n" + " help print this help text\n\n"); + goto exit; + } else { + fprintf(stderr, "unrecognized command '%s'\n", arg); + goto exit; } if (getuid() != 0) { diff --git a/udevd.8 b/udevd.8 index 614e4f338f..25996d1c8d 100644 --- a/udevd.8 +++ b/udevd.8 @@ -71,6 +71,11 @@ Signal udevd to enable the execution of events. Signal udevd to reload the rules from the config. .RE .PP +\fBenv \fR\fB\fIvar\fR\fR\fB=\fR\fB\fIvalue\fR\fR +.RS 4 +Set global variable. +.RE +.PP \fBmax_childs\fR .RS 4 Set the maximum number of events, udevd will handle at the same time. diff --git a/udevd.c b/udevd.c index dccc745eff..645b068c0e 100644 --- a/udevd.c +++ b/udevd.c @@ -667,6 +667,7 @@ static void get_ctrl_msg(void) struct ucred *cred; char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; int *intval; + char *pos; memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); iov.iov_base = &ctrl_msg; @@ -703,6 +704,21 @@ static void get_ctrl_msg(void) } switch (ctrl_msg.type) { + case UDEVD_CTRL_ENV: + pos = strchr(ctrl_msg.buf, '='); + if (pos == NULL) { + err("wrong key format '%s'", ctrl_msg.buf); + break; + } + pos[0] = '\0'; + if (pos[1] == '\0') { + info("udevd message (ENV) received, unset '%s'", ctrl_msg.buf); + unsetenv(ctrl_msg.buf); + } else { + info("udevd message (ENV) received, set '%s=%s'", ctrl_msg.buf, &pos[1]); + setenv(ctrl_msg.buf, &pos[1], 1); + } + break; case UDEVD_CTRL_STOP_EXEC_QUEUE: info("udevd message (STOP_EXEC_QUEUE) received"); stop_exec_q = 1; diff --git a/udevd.h b/udevd.h index fce86e7126..4ca6d1dcf2 100644 --- a/udevd.h +++ b/udevd.h @@ -46,6 +46,7 @@ enum udevd_ctrl_msg_type { UDEVD_CTRL_SET_MAX_CHILDS, UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, UDEVD_CTRL_RELOAD_RULES, + UDEVD_CTRL_ENV, }; struct udevd_ctrl_msg { diff --git a/udevd.xml b/udevd.xml index 674fa4d755..cf033a06b2 100644 --- a/udevd.xml +++ b/udevd.xml @@ -104,6 +104,12 @@ Signal udevd to reload the rules from the config. + + + + Set global variable. + + -- cgit v1.2.3-54-g00ecf From 54b813ba0d750900a961dd2d5c586dd814234218 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Fri, 27 Apr 2007 11:42:34 +0200 Subject: rules: Gentoo update --- etc/udev/gentoo/50-udev.rules | 2 +- etc/udev/gentoo/64-device-mapper.rules | 10 +++++----- etc/udev/gentoo/95-udev-late.rules | 3 --- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/etc/udev/gentoo/50-udev.rules b/etc/udev/gentoo/50-udev.rules index 28875536a0..57f2387a5c 100644 --- a/etc/udev/gentoo/50-udev.rules +++ b/etc/udev/gentoo/50-udev.rules @@ -170,7 +170,7 @@ KERNEL=="hiddev*", NAME="usb/%k" KERNEL=="auer*", NAME="usb/%k" KERNEL=="legousbtower*", NAME="usb/%k", GROUP="usb" KERNEL=="dabusb*", NAME="usb/%k" -BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" +KERNEL=="lp[0-9]*", SUBSYSTEM=="usb", NAME="usb/%k", GROUP="lp" # v4l devices KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" diff --git a/etc/udev/gentoo/64-device-mapper.rules b/etc/udev/gentoo/64-device-mapper.rules index 1100c1b7bd..d2639af5dd 100644 --- a/etc/udev/gentoo/64-device-mapper.rules +++ b/etc/udev/gentoo/64-device-mapper.rules @@ -3,9 +3,8 @@ KERNEL=="device-mapper", NAME="mapper/control" -KERNEL=="dm-*", ACTION=="add|change", GOTO="device_mapper_do" -GOTO="device_mapper_end" -LABEL="device_mapper_do" +KERNEL!="dm-*", GOTO="device_mapper_end" +ACTION!="add|change", GOTO="device_mapper_end" # lookup device name # use dmsetup, until devmap_name is provided by sys-fs/device-mapper @@ -25,7 +24,8 @@ PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}", OPTIONS="link_priority=50" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}", OPTIONS="link_priority=50" +OPTIONS="link_priority=50" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="device_mapper_end" diff --git a/etc/udev/gentoo/95-udev-late.rules b/etc/udev/gentoo/95-udev-late.rules index 5d7a6a8a4e..40ada28b14 100644 --- a/etc/udev/gentoo/95-udev-late.rules +++ b/etc/udev/gentoo/95-udev-late.rules @@ -13,9 +13,6 @@ SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start" SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop" -# debug events to /events, but not on default udev_log="err" -ENV{UDEV_LOG}=="[4-9]", RUN+="eventrecorder.sh" - # event to be catched by udevmonitor RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From 900878ac803eb298c7adfe2b35a8b4ee9708ef6e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 28 Apr 2007 13:29:24 +0200 Subject: rules: Fedora update --- etc/udev/redhat/05-udev-early.rules | 13 ++++++++++--- etc/udev/redhat/50-udev.rules | 9 +++------ etc/udev/redhat/95-pam-console.rules | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/etc/udev/redhat/05-udev-early.rules b/etc/udev/redhat/05-udev-early.rules index 970feb853b..c3024569fe 100644 --- a/etc/udev/redhat/05-udev-early.rules +++ b/etc/udev/redhat/05-udev-early.rules @@ -1,10 +1,17 @@ # sysfs is populated after the event is sent ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" - # ignore these events until someone needs them SUBSYSTEM=="drivers", OPTIONS="ignore_device" SUBSYSTEM=="module", OPTIONS="ignore_device" + +ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="modprobe $env{MODALIAS}", OPTIONS="last_rule" + +# pnp devices +ACTION=="add", SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe pnp:d$$id; done < /sys/$devpath/id'", OPTIONS="last_rule" + +ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" + +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" + ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN="/sbin/firmware_helper", OPTIONS="last_rule" diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index c6ab1b5570..9e946dae25 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -65,9 +65,6 @@ KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" KERNEL=="nvram", MODE="0660" KERNEL=="rtc", MODE="0644" -# pnp devices -ACTION=="add", SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe pnp:d$$id; done < /sys/$devpath/id'" - # floppy devices KERNEL=="fd[01]*", GROUP="floppy", MODE="0660" # fix floppy devices @@ -230,6 +227,7 @@ KERNEL=="zap[0-9]*", NAME="zap/%n" KERNEL=="pktcdvd", NAME="%k/control" + KERNEL=="hd*[!0-9]", ATTR{removable}=="1", \ ATTR{media}=="floppy", \ SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions" @@ -252,6 +250,7 @@ KERNEL=="hd*[0-9]", BUS=="ide", ATTRS{removable}=="1", \ OPTIONS+="ignore_remove" + ####################################### # Persistent block device stuff - begin ####################################### @@ -311,9 +310,6 @@ ACTION=="add", SUBSYSTEM=="usb_device", \ PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ NAME="%c", MODE="0644" -ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="modprobe $env{MODALIAS}" - -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC # sr: 4 TYPE_WORM, 5 TYPE_ROM @@ -347,5 +343,6 @@ ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}!="On[sS # mmc block devices ACTION=="add", SUBSYSTEM=="mmc", RUN+="modprobe mmc_block" + RUN+="socket:/org/kernel/udev/monitor" diff --git a/etc/udev/redhat/95-pam-console.rules b/etc/udev/redhat/95-pam-console.rules index ff54b3cbac..cbb2d4aaf9 100644 --- a/etc/udev/redhat/95-pam-console.rules +++ b/etc/udev/redhat/95-pam-console.rules @@ -1 +1 @@ -ACTION=="add", SYSFS{dev}=="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}" +ENV{STARTUP}!="1", ACTION=="add", SYSFS{dev}=="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}" -- cgit v1.2.3-54-g00ecf From e18e6d79996edeeb07e122f3582a688c3ef4f6b9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 28 Apr 2007 23:06:20 +0200 Subject: volume_id: old md metadata has only 32 bit for the uuid --- extras/volume_id/lib/linux_raid.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 009c714bd1..8ce2eb52da 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -78,9 +78,15 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 if (le32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) { uuid.ints[0] = bswap_32(mdp0->set_uuid0); - uuid.ints[1] = bswap_32(mdp0->set_uuid1); - uuid.ints[2] = bswap_32(mdp0->set_uuid2); - uuid.ints[3] = bswap_32(mdp0->set_uuid3); + if (le32_to_cpu(mdp0->minor_version >= 90)) { + uuid.ints[1] = bswap_32(mdp0->set_uuid1); + uuid.ints[2] = bswap_32(mdp0->set_uuid2); + uuid.ints[3] = bswap_32(mdp0->set_uuid3); + } else { + uuid.ints[1] = 0; + uuid.ints[2] = 0; + uuid.ints[3] = 0; + } volume_id_set_uuid(id, uuid.bytes, UUID_DCE); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", le32_to_cpu(mdp0->major_version), @@ -88,9 +94,15 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 le32_to_cpu(mdp0->patch_version)); } else if (be32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) { uuid.ints[0] = mdp0->set_uuid0; - uuid.ints[1] = mdp0->set_uuid1; - uuid.ints[2] = mdp0->set_uuid2; - uuid.ints[3] = mdp0->set_uuid3; + if (be32_to_cpu(mdp0->minor_version >= 90)) { + uuid.ints[1] = mdp0->set_uuid1; + uuid.ints[2] = mdp0->set_uuid2; + uuid.ints[3] = mdp0->set_uuid3; + } else { + uuid.ints[1] = 0; + uuid.ints[2] = 0; + uuid.ints[3] = 0; + } volume_id_set_uuid(id, uuid.bytes, UUID_DCE); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", be32_to_cpu(mdp0->major_version), -- cgit v1.2.3-54-g00ecf From 6ed3edfb6901d76d0ad91e992aee41e42e816516 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 28 Apr 2007 23:45:49 +0200 Subject: volume_id: minix version 3 support --- extras/volume_id/lib/minix.c | 55 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c index dffc52a4d8..64945067e8 100644 --- a/extras/volume_id/lib/minix.c +++ b/extras/volume_id/lib/minix.c @@ -1,7 +1,7 @@ /* * volume_id - reads filesystem label and uuid * - * Copyright (C) 2005 Kay Sievers + * Copyright (C) 2005-2007 Kay Sievers * * 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 @@ -26,6 +26,14 @@ #include "libvolume_id.h" #include "util.h" +#define MINIX_SUPERBLOCK_OFFSET 0x400 + +#define MINIX_SUPER_MAGIC 0x137F +#define MINIX_SUPER_MAGIC2 0x138F +#define MINIX2_SUPER_MAGIC 0x2468 +#define MINIX2_SUPER_MAGIC2 0x2478 +#define MINIX3_SUPER_MAGIC 0x4d5a + struct minix_super_block { uint16_t s_ninodes; @@ -40,38 +48,63 @@ struct minix_super_block uint32_t s_zones; } PACKED; -#define MINIX_SUPERBLOCK_OFFSET 0x400 +struct minix3_super_block { + uint32_t s_ninodes; + uint16_t s_pad0; + uint16_t s_imap_blocks; + uint16_t s_zmap_blocks; + uint16_t s_firstdatazone; + uint16_t s_log_zone_size; + uint16_t s_pad1; + uint32_t s_max_size; + uint32_t s_zones; + uint16_t s_magic; + uint16_t s_pad2; + uint16_t s_blocksize; + uint8_t s_disk_version; +} PACKED; int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size) { + uint8_t *buf; struct minix_super_block *ms; + struct minix3_super_block *m3s; info("probing at offset 0x%llx", (unsigned long long) off); - ms = (struct minix_super_block *) volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); - if (ms == NULL) + buf = volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); + if (buf == NULL) return -1; - if (le16_to_cpu(ms->s_magic) == 0x137f) { + ms = (struct minix_super_block *) buf; + + if (ms->s_magic == MINIX_SUPER_MAGIC || + ms->s_magic == bswap_16(MINIX_SUPER_MAGIC)) { strcpy(id->type_version, "1"); goto found; } - - if (le16_to_cpu(ms->s_magic) == 0x1387) { + if (ms->s_magic == MINIX_SUPER_MAGIC2 || + ms->s_magic == bswap_16(MINIX_SUPER_MAGIC2)) { strcpy(id->type_version, "1"); goto found; } - - if (le16_to_cpu(ms->s_magic) == 0x2468) { + if (ms->s_magic == MINIX2_SUPER_MAGIC || + ms->s_magic == bswap_16(MINIX2_SUPER_MAGIC)) { strcpy(id->type_version, "2"); goto found; } - - if (le16_to_cpu(ms->s_magic) == 0x2478) { + if (ms->s_magic == MINIX2_SUPER_MAGIC2 || + ms->s_magic == bswap_16(MINIX2_SUPER_MAGIC2)) { strcpy(id->type_version, "2"); goto found; } + m3s = (struct minix3_super_block *) buf; + if (m3s->s_magic == MINIX3_SUPER_MAGIC || + m3s->s_magic == bswap_16(MINIX3_SUPER_MAGIC)) { + strcpy(id->type_version, "3"); + goto found; + } goto exit; found: -- cgit v1.2.3-54-g00ecf From cfdea0f647720222bb2fde67ab0a083167e9b2b4 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sun, 29 Apr 2007 00:08:30 +0200 Subject: ata_id: don't log error for libata devices on older kernels --- extras/ata_id/ata_id.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index aedebff711..ddd4151257 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -120,8 +120,13 @@ int main(int argc, char *argv[]) } if (ioctl(fd, HDIO_GET_IDENTITY, &id)) { - err("HDIO_GET_IDENTITY failed for '%s'", node); - rc = 3; + if (errno == ENOTTY) { + info("HDIO_GET_IDENTITY unsupported for '%s'", node); + rc = 2; + } else { + err("HDIO_GET_IDENTITY failed for '%s'", node); + rc = 3; + } goto close; } -- cgit v1.2.3-54-g00ecf From 68ab3e137b2ed017ca5d210dedfff702e21b25cf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 30 Apr 2007 21:48:30 +0200 Subject: don't create $tempnode for devices without major --- udev_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_rules.c b/udev_rules.c index 61b39b45c8..5c3d7d5d06 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -532,7 +532,7 @@ found: } break; case SUBST_TEMP_NODE: - if (udev->tmp_node[0] == '\0') { + if (udev->tmp_node[0] == '\0' && major(udev->devt) > 0) { dbg("create temporary device node for callout"); snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", udev_root, major(udev->devt), minor(udev->devt)); -- cgit v1.2.3-54-g00ecf From 5f605a6cf1850f17a0d24b57094c2e275e31d4da Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 1 May 2007 14:18:36 +0200 Subject: usb_id: add to help text --- extras/usb_id/usb_id.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 50918f060b..d36a27b3cc 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -368,10 +368,6 @@ int main(int argc, char **argv) const char *env; char devpath[MAX_PATH_LEN]; static int export; - - logging_init("usb_id"); - sysfs_init(); - static const struct option options[] = { { "usb-info", 0, NULL, 'u' }, { "num-info", 0, NULL, 'n' }, @@ -380,6 +376,9 @@ int main(int argc, char **argv) {} }; + logging_init("usb_id"); + sysfs_init(); + while (1) { int option; @@ -399,7 +398,7 @@ int main(int argc, char **argv) export = 1; break; case 'h': - printf("Usage: usb_id [--usb-info] [--num-info] [--export] [--help]\n" + printf("Usage: usb_id [--usb-info] [--num-info] [--export] [--help] \n" " --usb-info use usb strings instead\n" " --num-info use numerical values\n" " --export print values as environemt keys\n" -- cgit v1.2.3-54-g00ecf From 4fa3d99db7825a815c5a75a737b3288b9f048346 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 1 May 2007 14:19:31 +0200 Subject: ata_id: use getopt_long() --- extras/ata_id/ata_id.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index ddd4151257..f94cdc0fd3 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -91,22 +92,40 @@ int main(int argc, char *argv[]) char serial[21]; char revision[9]; const char *node = NULL; - int i; int export = 0; int fd; int rc = 0; + static const struct option options[] = { + { "export", 0, NULL, 'x' }, + { "help", 0, NULL, 'h' }, + {} + }; logging_init("ata_id"); - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; + while (1) { + int option; - if (strcmp(arg, "--export") == 0) { + option = getopt_long(argc, argv, "xh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'x': export = 1; - } else - node = arg; + break; + case 'h': + printf("Usage: ata_id [--export] [--help] \n" + " --export print values as environemt keys\n" + " --help print this help text\n\n"); + default: + rc = 1; + goto exit; + } } - if (!node) { + + node = argv[optind]; + if (node == NULL) { err("no node specified"); rc = 1; goto exit; -- cgit v1.2.3-54-g00ecf From 97ad45b2198b9964a27cf0756aa99bd64eb94ad6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 1 May 2007 14:21:04 +0200 Subject: rules: SUSE update --- etc/udev/suse/64-md-raid.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/suse/64-md-raid.rules b/etc/udev/suse/64-md-raid.rules index 3da64150ae..39af3ef6be 100644 --- a/etc/udev/suse/64-md-raid.rules +++ b/etc/udev/suse/64-md-raid.rules @@ -1,5 +1,6 @@ # md links hook into "change" events, when the array becomes available +SUBSYSTEM!="block", GOTO="md_end" KERNEL!="md[0-9]*", GOTO="md_end" ACTION!="add|change", GOTO="md_end" -- cgit v1.2.3-54-g00ecf From 25b5bb4245824ac0ba90fa04e3baaa39011d7528 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 1 May 2007 14:33:39 +0200 Subject: release 110 --- ChangeLog | 27 +++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 6 ++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 19902091c7..57c6e35abe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +Summary of changes from v109 to v110 +============================================ + +Harald Hoyer (1): + udevcontrol: allow to set global variables in udevd + +Kay Sievers (13): + remove eventrecorder.sh + update SUSE rules + volume_id: add md metadata 1.0, 1.1, 1.2 support + unset variable with ENV{VAR}="" + delete copies of default rules in SUSE rules + volume_id: ext - fix endianess in version number + rules: Fedora update + volume_id: old md metadata has only 32 bit for the uuid + volume_id: minix version 3 support + don't create $tempnode for devices without major + usb_id: add to help text + ata_id: use getopt_long() + rules: SUSE update + +Matthias Schwarzott (3): + Makefile: respect CFLAGS/LDFLAGS + rules: Gentoo update + ata_id: don't log error for libata devices on older kernels + + Summary of changes from v108 to v109 ============================================ diff --git a/Makefile b/Makefile index 072ae7f5cd..c4311ddc19 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 109 +VERSION = 110 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 0d984bcc73..81167fe71d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,9 @@ +udev 110 +======== +Bugfixes. + +Removal of useless extras/eventrecorder.sh. + udev 109 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 8d8a237425ad45818e6747f20e0564afaa3e5ad4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 May 2007 02:04:19 +0200 Subject: rules: SUSE update --- etc/udev/suse/50-udev-default.rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index d63c047611..3a6a8a975c 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -71,6 +71,7 @@ KERNEL=="full", MODE="622" KERNEL=="random", MODE="666" KERNEL=="urandom", MODE="644" KERNEL=="rtc", MODE="600" +KERNEL=="fuse", MODE="0666" KERNEL=="sonypi", MODE="0666" KERNEL=="agpgart", MODE="0600", GROUP="video" KERNEL=="djs*", MODE="644" @@ -128,8 +129,8 @@ KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" # libusb device access +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" SUBSYSTEM=="usb_device", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" -#SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" # kernel firmware loader SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" -- cgit v1.2.3-54-g00ecf From 34ee018186c8af32552a289cf904ba5c98100b99 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 May 2007 02:12:18 +0200 Subject: rules: Fedora update --- etc/udev/redhat/05-udev-early.rules | 6 ++++-- etc/udev/redhat/50-udev.rules | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/etc/udev/redhat/05-udev-early.rules b/etc/udev/redhat/05-udev-early.rules index c3024569fe..a58cc033d2 100644 --- a/etc/udev/redhat/05-udev-early.rules +++ b/etc/udev/redhat/05-udev-early.rules @@ -5,13 +5,15 @@ SUBSYSTEM=="drivers", OPTIONS="ignore_device" SUBSYSTEM=="module", OPTIONS="ignore_device" -ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="modprobe $env{MODALIAS}", OPTIONS="last_rule" +ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="modprobe $env{MODALIAS}", GOTO="skip_wait" # pnp devices -ACTION=="add", SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe pnp:d$$id; done < /sys/$devpath/id'", OPTIONS="last_rule" +ACTION=="add", SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe pnp:d$$id; done < /sys/$devpath/id'" ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +LABEL="skip_wait" + ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN="/sbin/firmware_helper", OPTIONS="last_rule" diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index 9e946dae25..c410e8575a 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -206,7 +206,7 @@ KERNEL=="tty0", SYMLINK+="systty" KERNEL=="vbi0", SYMLINK+="vbi" KERNEL=="null", SYMLINK+="XOR" -KERNEL=="tun", NAME="net/%k" +KERNEL=="tun", NAME="net/%k", MODE="0666" KERNEL=="device-mapper", NAME="mapper/control" -- cgit v1.2.3-54-g00ecf From 4c13270a77d0a6b7c440af6f80e6dff4e078b3a6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 May 2007 09:24:16 +0200 Subject: volume_id: use md native uuid format --- extras/volume_id/lib/linux_raid.c | 6 +++--- extras/volume_id/lib/util.c | 11 +++++++++++ extras/volume_id/lib/util.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 8ce2eb52da..6f37e2a358 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -87,7 +87,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 uuid.ints[2] = 0; uuid.ints[3] = 0; } - volume_id_set_uuid(id, uuid.bytes, UUID_DCE); + volume_id_set_uuid(id, uuid.bytes, UUID_FOURINT); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", le32_to_cpu(mdp0->major_version), le32_to_cpu(mdp0->minor_version), @@ -103,7 +103,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 uuid.ints[2] = 0; uuid.ints[3] = 0; } - volume_id_set_uuid(id, uuid.bytes, UUID_DCE); + volume_id_set_uuid(id, uuid.bytes, UUID_FOURINT); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", be32_to_cpu(mdp0->major_version), be32_to_cpu(mdp0->minor_version), @@ -131,7 +131,7 @@ static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint6 if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC) return -1; - volume_id_set_uuid(id, mdp1->set_uuid, UUID_DCE); + volume_id_set_uuid(id, mdp1->set_uuid, UUID_FOURINT); volume_id_set_label_raw(id, mdp1->set_name, 32); volume_id_set_label_string(id, mdp1->set_name, 32); snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le32_to_cpu(mdp1->major_version)); diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 09bfc67500..762e84e170 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -134,6 +134,9 @@ void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_form case UUID_DCE_STRING: count = 36; break; + case UUID_FOURINT: + count = 35; + break; } memcpy(id->uuid_raw, buf, count); id->uuid_raw_len = count; @@ -173,6 +176,14 @@ set: memcpy(id->uuid, buf, count); id->uuid[count] = '\0'; break; + case UUID_FOURINT: + sprintf(id->uuid, + "%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x", + buf[0], buf[1], buf[2], buf[3], + buf[4], buf[5], buf[6], buf[7], + buf[8], buf[9], buf[10], buf[11], + buf[12], buf[13], buf[14],buf[15]); + break; } } diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index dc60a09123..2abf05df74 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -64,6 +64,7 @@ enum uuid_format { UUID_DOS, UUID_NTFS, UUID_HFS, + UUID_FOURINT, }; enum endian { -- cgit v1.2.3-54-g00ecf From 4a86b682ab3f0473a24ef66d56db100eb592a9bb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 May 2007 11:00:02 +0200 Subject: vol_id: use long options --- extras/volume_id/vol_id.8 | 41 ++++++++++++-------- extras/volume_id/vol_id.c | 91 +++++++++++++++++++++++++++++---------------- extras/volume_id/vol_id.xml | 60 ++++++++++++++++++++---------- 3 files changed, 126 insertions(+), 66 deletions(-) diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index bb248a45e0..75942536d1 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -14,40 +14,51 @@ vol_id \- probe filesystem type and read label and uuid .SH "SYNOPSIS" .HP 7 -\fBvol_id\fR [\fB\-\-export\fR] [\fB\-t\fR] [\fB\-l\fR] [\fB\-u\fR] [\fIdevice\fR] +\fBvol_id\fR [\fB\-\-export\fR] [\fB\-\-type\fR] [\fB\-\-label\fR] [\fB\-\-label\-raw\fR] [\fB\-\-uuid\fR] [\fB\-\-skip\-raid\fR] [\fB\-\-probe\-all\fR] [\fB\-\-help\fR] [\fIdevice\fR] .SH "DESCRIPTION" .PP \fBvol_id\fR -is usually called from a udev rule, to provide udev with the filesystem type, the label and the uuid of a volume. -\fBvol_id\fR -supports all common filesystem formats and detects various raid setups to prevent the recognition of raid members as a volume with a filesystem. +is usually called from a udev rule, to provide udev with the filesystem type, the label and the uuid of a volume. It supports most of the common filesystem formats and detects various raid setups to prevent the recognition of raid members as a volume with a filesystem. .SH "OPTIONS" .PP \fB\-\-export\fR .RS 4 -print all values in key/value format to import them into the environment. +Print all values in key/value format to import them into the environment. +.RE +.PP +\fB\-\-type\fR +.RS 4 +Print the filesystem type. +.RE +.PP +\fB\-\-label\fR +.RS 4 +Print the safe version of volume label suitable for use as filename. +.RE +.PP +\fB\-\-label\-raw\fR +.RS 4 +Print the raw volume label. .RE .PP -\fB\-t\fR +\fB\-\-uuid\fR .RS 4 -print the filesystem type +Print the uuid of a volume. .RE .PP -\fB\-l\fR +\fB\-\-skip\-raid\fR .RS 4 -print the safe version of volume label suitable for use as filename. Use -\fB\-L\fR -to print literal label +Skip detection of raid metadata. .RE .PP -\fB\-u\fR +\fB\-\-probe\-all\fR .RS 4 -print the uuid of a volume +Probe for all types and print all matches. .RE .PP -\fB\-L\fR +\fB\-\-help\fR .RS 4 -print raw volume label +Print usage. .RE .SH "ENVIRONMENT" .PP diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 0427d70da1..f6967603fa 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include "../../udev.h" @@ -111,30 +112,32 @@ static void set_str(char *to, const char *from, size_t count) int main(int argc, char *argv[]) { - const char help[] = "Usage: vol_id [options] \n" - " --export export key/value pairs\n" - " -t filesystem type\n" - " -l filesystem label\n" - " -u filesystem uuid\n" - " -L raw label\n" - " --skip-raid don't probe for raid\n" - " --probe-all find possibly conflicting signatures\n" - " --help\n" - "\n"; + static const struct option options[] = { + { "label", 0, NULL, 'l' }, + { "label-raw", 0, NULL, 'L' }, + { "uuid", 0, NULL, 'u' }, + { "type", 0, NULL, 't' }, + { "export", 0, NULL, 'x' }, + { "skip-raid", 0, NULL, 's' }, + { "probe-all", 0, NULL, 'a' }, + { "help", 0, NULL, 'h' }, + {} + }; + enum print_type { PRINT_EXPORT, PRINT_TYPE, PRINT_LABEL, PRINT_UUID, - PRINT_RAW_LABEL, + PRINT_LABEL_RAW, } print = PRINT_EXPORT; + struct volume_id *vid = NULL; static char name[VOLUME_ID_LABEL_SIZE]; - int i; uint64_t size; int skip_raid = 0; int probe_all = 0; - const char *node = NULL; + const char *node; struct passwd *pw; int retval; int rc = 0; @@ -144,32 +147,56 @@ int main(int argc, char *argv[]) /* hook in our debug into libvolume_id */ volume_id_log_fn = vid_log; - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; + while (1) { + int option; - if (strcmp(arg, "--export") == 0) { - print = PRINT_EXPORT; - } else if (strcmp(arg, "-t") == 0) { - print = PRINT_TYPE; - } else if (strcmp(arg, "-l") == 0) { + option = getopt_long(argc, argv, "lLutxsah", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'l': print = PRINT_LABEL; - } else if (strcmp(arg, "-u") == 0) { + break; + case 'L': + print = PRINT_LABEL_RAW; + break; + case 'u': print = PRINT_UUID; - } else if (strcmp(arg, "-L") == 0) { - print = PRINT_RAW_LABEL; - } else if (strcmp(arg, "--skip-raid") == 0) { + break; + case 't': + print = PRINT_TYPE; + break; + case 'x': + print = PRINT_EXPORT; + break; + case 's': skip_raid = 1; - } else if (strcmp(arg, "--probe-all") == 0) { + break; + case 'a': probe_all = 1; - } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { - printf(help); + break; + case 'h': + printf("Usage: vol_id [options] \n" + " --export export key/value pairs\n" + " --type filesystem type\n" + " --label filesystem label\n" + " --label-raw raw label\n" + " --uuid filesystem uuid\n" + " --skip-raid don't probe for raid\n" + " --probe-all find possibly conflicting signatures\n" + " --help\n\n"); + goto exit; + default: + retval = 1; goto exit; - } else - node = arg; + } } + + node = argv[optind]; if (!node) { - err("no node specified"); - fprintf(stderr, help); + err("no device"); + fprintf(stderr, "no device\n"); rc = 1; goto exit; } @@ -311,7 +338,7 @@ int main(int argc, char *argv[]) } printf("%s\n", vid->uuid); break; - case PRINT_RAW_LABEL: + case PRINT_LABEL_RAW: if (vid->label[0] == '\0' || vid->usage_id == VOLUME_ID_RAID) { rc = 3; goto exit; diff --git a/extras/volume_id/vol_id.xml b/extras/volume_id/vol_id.xml index 2b26b3bddd..6d0a6c6923 100644 --- a/extras/volume_id/vol_id.xml +++ b/extras/volume_id/vol_id.xml @@ -26,9 +26,13 @@ vol_id - - - + + + + + + + device @@ -36,8 +40,8 @@ DESCRIPTION vol_id is usually called from a udev rule, to provide udev with the filesystem type, the label and the uuid of a - volume. vol_id supports all common filesystem formats - and detects various raid setups to prevent the recognition of raid members + volume. It supports most of the common filesystem formats and detects + various raid setups to prevent the recognition of raid members as a volume with a filesystem. @@ -46,37 +50,55 @@ - print all values in key/value format to import them into the + Print all values in key/value format to import them into the environment. - + - print the filesystem type + Print the filesystem type. - + - - print the safe version of volume label suitable for - use as filename. Use to print literal label - + + Print the safe version of volume label suitable for + use as filename. + - + - print the uuid of a volume + + Print the raw volume label. + - + - - print raw volume label - + Print the uuid of a volume. + + + + + + Skip detection of raid metadata. + + + + + + Probe for all types and print all matches. + + + + + + Print usage. -- cgit v1.2.3-54-g00ecf From e7ea9c50e8eaab772206268739db2d59ba7bd709 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 May 2007 14:22:39 +0200 Subject: volume_id: add volume_id_get_* functions In a future version of libvolume_id, struct volume_id will be an opaque data type, which can't be accessed directly. No interface has changed for now, until all known users are converted not to access the structure directly. --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/exported_symbols | 9 ++++ extras/volume_id/lib/libvolume_id.h | 15 +++--- extras/volume_id/lib/util.h | 4 ++ extras/volume_id/lib/volume_id.c | 99 ++++++++++++++++++++++++++++++++++- 5 files changed, 121 insertions(+), 8 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 41b7ecb7af..fafcc52794 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 76 +SHLIB_REV = 77 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index 57a1feb3dc..c88d993e01 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -1,5 +1,14 @@ { global: volume_id_log_fn; + + volume_id_get_label; + volume_id_get_label_raw; + volume_id_get_uuid; + volume_id_get_uuid_raw; + volume_id_get_usage; + volume_id_get_type; + volume_id_get_type_version; + volume_id_open_fd; volume_id_open_node; volume_id_probe_all; diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index 98423f08cc..523543f7ee 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -1,7 +1,7 @@ /* * volume_id - reads volume label and uuid * - * Copyright (C) 2005 Kay Sievers + * Copyright (C) 2005-2007 Kay Sievers * * 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 @@ -14,11 +14,6 @@ #include #include -#ifndef PACKED -#define PACKED __attribute__((packed)) -#endif - - typedef void (*volume_id_log_fn_t)(int priority, const char *file, int line, const char *format, ...) __attribute__ ((format(printf, 4, 5))); @@ -61,6 +56,14 @@ struct volume_id { int fd_close:1; }; +extern int volume_id_get_label(struct volume_id *id, const char **label); +extern int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len); +extern int volume_id_get_uuid(struct volume_id *id, const char **uuid); +extern int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len); +extern int volume_id_get_usage(struct volume_id *id, const char **usage); +extern int volume_id_get_type(struct volume_id *id, const char **type); +extern int volume_id_get_type_version(struct volume_id *id, const char **type_version); + extern struct volume_id *volume_id_open_fd(int fd); extern struct volume_id *volume_id_open_node(const char *path); extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index 2abf05df74..964e70196a 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -23,6 +23,10 @@ #include #include +#ifndef PACKED +#define PACKED __attribute__((packed)) +#endif + #define err(format, arg...) volume_id_log_fn(LOG_ERR, __FILE__, __LINE__, format, ##arg) #define info(format, arg...) volume_id_log_fn(LOG_INFO, __FILE__, __LINE__, format, ##arg) #ifdef DEBUG diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index c6c8d5af6d..bf009c7203 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -1,7 +1,7 @@ /* * volume_id - reads volume label and uuid * - * Copyright (C) 2005 Kay Sievers + * Copyright (C) 2005-2007 Kay Sievers * * 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 @@ -36,6 +36,103 @@ static void default_log(int priority, const char *file, int line, const char *fo volume_id_log_fn_t volume_id_log_fn = default_log; +int volume_id_get_label(struct volume_id *id, const char **label) +{ + if (id == NULL) + return -EINVAL; + if (label == NULL) + return -EINVAL; + if (id->usage_id == VOLUME_ID_UNUSED) + return 0; + + *label = id->label; + return 1; +} + +int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len) +{ + if (id == NULL) + return -EINVAL; + if (label == NULL) + return -EINVAL; + if (len == NULL) + return -EINVAL; + if (id->usage_id == VOLUME_ID_UNUSED) + return 0; + + *label = id->label_raw; + *len = id->label_raw_len; + return 1; +} + +int volume_id_get_uuid(struct volume_id *id, const char **uuid) +{ + if (id == NULL) + return -EINVAL; + if (uuid == NULL) + return -EINVAL; + if (id->usage_id == VOLUME_ID_UNUSED) + return 0; + + *uuid = id->uuid; + return 1; +} + +int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len) +{ + if (id == NULL) + return -EINVAL; + if (uuid == NULL) + return -EINVAL; + if (len == NULL) + return -EINVAL; + if (id->usage_id == VOLUME_ID_UNUSED) + return 0; + + *uuid = id->uuid_raw; + *len = id->uuid_raw_len; + return 1; +} + +int volume_id_get_usage(struct volume_id *id, const char **usage) +{ + if (id == NULL) + return -EINVAL; + if (usage == NULL) + return -EINVAL; + if (id->usage_id == VOLUME_ID_UNUSED) + return 0; + + *usage = id->usage; + return 1; +} + +int volume_id_get_type(struct volume_id *id, const char **type) +{ + if (id == NULL) + return -EINVAL; + if (type == NULL) + return -EINVAL; + if (id->usage_id == VOLUME_ID_UNUSED) + return 0; + + *type = id->type; + return 1; +} + +int volume_id_get_type_version(struct volume_id *id, const char **type_version) +{ + if (id == NULL) + return -EINVAL; + if (type_version == NULL) + return -EINVAL; + if (id->usage_id == VOLUME_ID_UNUSED) + return 0; + + *type_version = id->type_version; + return 1; +} + int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) { if (id == NULL) -- cgit v1.2.3-54-g00ecf From 1d9cdcdf91f9ad0159be530a5b23170e73bffbe8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 May 2007 14:24:56 +0200 Subject: vol_id: use volume_id_get_* --- extras/volume_id/vol_id.c | 152 ++++++++++++++++++++++++++++++---------------- 1 file changed, 101 insertions(+), 51 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index f6967603fa..fbf9832b50 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "../../udev.h" @@ -133,12 +134,14 @@ int main(int argc, char *argv[]) } print = PRINT_EXPORT; struct volume_id *vid = NULL; - static char name[VOLUME_ID_LABEL_SIZE]; + char name[128]; uint64_t size; int skip_raid = 0; int probe_all = 0; const char *node; struct passwd *pw; + int fd; + const char *label, *uuid, *type, *type_version, *usage; int retval; int rc = 0; @@ -201,14 +204,20 @@ int main(int argc, char *argv[]) goto exit; } - vid = volume_id_open_node(node); + fd = open(node, O_RDONLY); + if (fd < 0) { + fprintf(stderr, "%s: error opening volume\n", node); + rc = 2; + goto exit; + } + + vid = volume_id_open_fd(fd); if (vid == NULL) { - fprintf(stderr, "%s: error open volume\n", node); rc = 2; goto exit; } - if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0) + if (ioctl(fd, BLKGETSIZE64, &size) != 0) size = 0; dbg("BLKGETSIZE64=%llu", (unsigned long long)size); @@ -228,74 +237,107 @@ int main(int argc, char *argv[]) if (probe_all) { if (volume_id_probe_linux_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_intel_software_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_lsi_mega_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_via_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_silicon_medley_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_nvidia_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_promise_fasttrack_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_highpoint_45x_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_adaptec_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_jmicron_raid(vid, 0, size) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_vfat(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_linux_swap(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_luks(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_xfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_ext(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_reiserfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_jfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_udf(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_iso9660(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_hfs_hfsplus(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_ufs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_ntfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_cramfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_romfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_hpfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_sysv(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_minix(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_ocfs1(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_ocfs2(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_vxfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_squashfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_netware(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_gfs(vid, 0, 0) == 0) - printf("%s\n", vid->type); + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_gfs2(vid, 0, 0) == 0) - printf("%s\n", vid->type); - + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); goto exit; } @@ -309,41 +351,49 @@ int main(int argc, char *argv[]) goto exit; } - set_str(name, vid->label, sizeof(vid->label)); + if (!volume_id_get_label(vid, &label) || + !volume_id_get_usage(vid, &usage) || + !volume_id_get_type(vid, &type) || + !volume_id_get_type_version(vid, &type_version) || + !volume_id_get_uuid(vid, &uuid)) { + rc = 4; + goto exit; + } + set_str(name, label, sizeof(name)); replace_untrusted_chars(name); switch (print) { case PRINT_EXPORT: - printf("ID_FS_USAGE=%s\n", vid->usage); - printf("ID_FS_TYPE=%s\n", vid->type); - printf("ID_FS_VERSION=%s\n", vid->type_version); - printf("ID_FS_UUID=%s\n", vid->uuid); - printf("ID_FS_LABEL=%s\n", vid->label); + printf("ID_FS_USAGE=%s\n", usage); + printf("ID_FS_TYPE=%s\n", type); + printf("ID_FS_VERSION=%s\n", type_version); + printf("ID_FS_UUID=%s\n", uuid); + printf("ID_FS_LABEL=%s\n", label); printf("ID_FS_LABEL_SAFE=%s\n", name); break; case PRINT_TYPE: - printf("%s\n", vid->type); + printf("%s\n", type); break; case PRINT_LABEL: - if (name[0] == '\0' || vid->usage_id == VOLUME_ID_RAID) { + if (name[0] == '\0' || strcmp(usage, "raid") == 0) { rc = 3; goto exit; } printf("%s\n", name); break; case PRINT_UUID: - if (vid->uuid[0] == '\0' || vid->usage_id == VOLUME_ID_RAID) { + if (uuid[0] == '\0' || strcmp(usage, "raid") == 0) { rc = 4; goto exit; } - printf("%s\n", vid->uuid); + printf("%s\n", uuid); break; case PRINT_LABEL_RAW: - if (vid->label[0] == '\0' || vid->usage_id == VOLUME_ID_RAID) { + if (label[0] == '\0' || strcmp(usage, "raid") == 0) { rc = 3; goto exit; } - printf("%s\n", vid->label); + printf("%s\n", label); break; } -- cgit v1.2.3-54-g00ecf From 9f1f67b168b78c24e3ecfc4c50e00bf142f6746f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 May 2007 23:21:11 +0200 Subject: udevd: use fgets() to read /proc files Based on a patch by: George Beshers --- udevd.c | 90 ++++++++++++++++++++++++----------------------------------------- 1 file changed, 33 insertions(+), 57 deletions(-) diff --git a/udevd.c b/udevd.c index 645b068c0e..fe01d8d4b9 100644 --- a/udevd.c +++ b/udevd.c @@ -318,61 +318,42 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) static int mem_size_mb(void) { - int f; - char buf[8192]; - long int len; - const char *pos; - long int memsize; - - f = open("/proc/meminfo", O_RDONLY); - if (f == -1) - return -1; - - len = read(f, buf, sizeof(buf)-1); - close(f); + FILE* f; + char buf[4096]; + long int memsize = -1; - if (len <= 0) + f = fopen("/proc/meminfo", "r"); + if (f == NULL) return -1; - buf[len] = '\0'; - pos = strstr(buf, "MemTotal: "); - if (pos == NULL) - return -1; + while (fgets(buf, sizeof(buf), f) != NULL) { + long int value; - if (sscanf(pos, "MemTotal: %ld kB", &memsize) != 1) - return -1; + if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { + memsize = value / 1024; + break; + } + } - return memsize / 1024; + return memsize; } static int cpu_count(void) { - int f; - char buf[65536]; - int len; - const char *pos; + FILE* f; + char buf[4096]; int count = 0; - f = open("/proc/stat", O_RDONLY); - if (f == -1) + f = fopen("/proc/stat", "r"); + if (f == NULL) return -1; - len = read(f, buf, sizeof(buf)-1); - close(f); - if (len <= 0) - return -1; - buf[len] = '\0'; - - pos = strstr(buf, "cpu"); - if (pos == NULL) - return -1; - - while (pos != NULL) { - if (strncmp(pos, "cpu", 3) == 0 &&isdigit(pos[3])) + while (fgets(buf, sizeof(buf), f) != NULL) { + if (strncmp(buf, "cpu", 3) == 0 && isdigit(buf[3])) count++; - pos = strstr(&pos[3], "cpu"); } + fclose(f); if (count == 0) return -1; return count; @@ -380,29 +361,24 @@ static int cpu_count(void) static int running_processes(void) { - int f; - char buf[32768]; - int len; - int running; - const char *pos; + FILE* f; + char buf[4096]; + int running = -1; - f = open("/proc/stat", O_RDONLY); - if (f == -1) + f = fopen("/proc/stat", "r"); + if (f == NULL) return -1; - len = read(f, buf, sizeof(buf)-1); - close(f); - if (len <= 0) - return -1; - buf[len] = '\0'; - - pos = strstr(buf, "procs_running "); - if (pos == NULL) - return -1; + while (fgets(buf, sizeof(buf), f) != NULL) { + int value; - if (sscanf(pos, "procs_running %u", &running) != 1) - return -1; + if (sscanf(buf, "procs_running %u", &value) == 1) { + running = value; + break; + } + } + fclose(f); return running; } -- cgit v1.2.3-54-g00ecf From ee466b321e5f4bb9f587f65ed05c87a51bc6fef2 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Thu, 3 May 2007 23:24:17 +0200 Subject: volume_id: fix Makefile for parallel make --- extras/volume_id/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index fafcc52794..5618b96a51 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -69,7 +69,7 @@ all: libvolume_id.a $(SHLIB) libvolume_id.pc .shlib: $(Q) mkdir .shlib -.shlib/%.o: %.c +.shlib/%.o: %.c .shlib $(E) " CC " $@ $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@ -- cgit v1.2.3-54-g00ecf From 444f07fea49bc40207df5e7910907492529b9bce Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 4 May 2007 16:53:19 +0200 Subject: volume_id: add internal UUID_STRING --- extras/volume_id/lib/ext.c | 2 +- extras/volume_id/lib/fat.c | 4 ++-- extras/volume_id/lib/hfs.c | 2 +- extras/volume_id/lib/jfs.c | 2 +- extras/volume_id/lib/linux_raid.c | 6 +++--- extras/volume_id/lib/linux_swap.c | 2 +- extras/volume_id/lib/luks.c | 10 ++++------ extras/volume_id/lib/netware.c | 2 +- extras/volume_id/lib/ntfs.c | 2 +- extras/volume_id/lib/ocfs.c | 4 ++-- extras/volume_id/lib/reiserfs.c | 4 ++-- extras/volume_id/lib/util.c | 19 +++++++++++++++---- extras/volume_id/lib/util.h | 5 +++-- extras/volume_id/lib/volume_id.c | 3 +++ extras/volume_id/lib/xfs.c | 2 +- 15 files changed, 41 insertions(+), 28 deletions(-) diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index 8b3af3aab0..e5f1e22f6e 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -93,7 +93,7 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_label_raw(id, es->s_volume_name, 16); volume_id_set_label_string(id, es->s_volume_name, 16); - volume_id_set_uuid(id, es->s_uuid, UUID_DCE); + volume_id_set_uuid(id, es->s_uuid, 0, UUID_DCE); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level)); diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 9a2e4784d8..6ed16ccee0 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -288,7 +288,7 @@ magic: volume_id_set_label_raw(id, vs->type.fat.label, 11); volume_id_set_label_string(id, vs->type.fat.label, 11); } - volume_id_set_uuid(id, vs->type.fat.serno, UUID_DOS); + volume_id_set_uuid(id, vs->type.fat.serno, 0, UUID_DOS); goto found; fat32: @@ -366,7 +366,7 @@ fat32: volume_id_set_label_raw(id, vs->type.fat32.label, 11); volume_id_set_label_string(id, vs->type.fat32.label, 11); } - volume_id_set_uuid(id, vs->type.fat32.serno, UUID_DOS); + volume_id_set_uuid(id, vs->type.fat32.serno, 0, UUID_DOS); found: volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index 303ad6b041..8156008f61 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -160,7 +160,7 @@ static void hfsid_set_uuid(struct volume_id *id, const uint8_t *hfs_id) volume_id_set_uuid(id, uuid, UUID_DCE); #endif - volume_id_set_uuid(id, hfs_id, UUID_HFS); + volume_id_set_uuid(id, hfs_id, 0, UUID_HFS); } int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size) diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c index 6d4124cd05..00b66cccc7 100644 --- a/extras/volume_id/lib/jfs.c +++ b/extras/volume_id/lib/jfs.c @@ -56,7 +56,7 @@ int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_label_raw(id, js->label, 16); volume_id_set_label_string(id, js->label, 16); - volume_id_set_uuid(id, js->uuid, UUID_DCE); + volume_id_set_uuid(id, js->uuid, 0, UUID_DCE); volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "jfs"; diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 6f37e2a358..6d1d19cb74 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -87,7 +87,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 uuid.ints[2] = 0; uuid.ints[3] = 0; } - volume_id_set_uuid(id, uuid.bytes, UUID_FOURINT); + volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", le32_to_cpu(mdp0->major_version), le32_to_cpu(mdp0->minor_version), @@ -103,7 +103,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 uuid.ints[2] = 0; uuid.ints[3] = 0; } - volume_id_set_uuid(id, uuid.bytes, UUID_FOURINT); + volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", be32_to_cpu(mdp0->major_version), be32_to_cpu(mdp0->minor_version), @@ -131,7 +131,7 @@ static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint6 if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC) return -1; - volume_id_set_uuid(id, mdp1->set_uuid, UUID_FOURINT); + volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_FOURINT); volume_id_set_label_raw(id, mdp1->set_name, 32); volume_id_set_label_string(id, mdp1->set_name, 32); snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le32_to_cpu(mdp1->major_version)); diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 8aca564d72..50d43ccce6 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -81,7 +81,7 @@ found_label: if (sw != NULL) { volume_id_set_label_raw(id, sw->volume_name, 16); volume_id_set_label_string(id, sw->volume_name, 16); - volume_id_set_uuid(id, sw->uuid, UUID_DCE); + volume_id_set_uuid(id, sw->uuid, 0, UUID_DCE); } found: diff --git a/extras/volume_id/lib/luks.c b/extras/volume_id/lib/luks.c index a141a0f5c3..231374e507 100644 --- a/extras/volume_id/lib/luks.c +++ b/extras/volume_id/lib/luks.c @@ -36,10 +36,10 @@ #define LUKS_SALTSIZE 32 #define LUKS_NUMKEYS 8 +#define LUKS_MAGIC_L 6 +#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) +#define UUID_STRING_L 40 static const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; -#define LUKS_MAGIC_L 6 -#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) -#define UUID_STRING_L 40 struct luks_phdr { uint8_t magic[LUKS_MAGIC_L]; @@ -74,9 +74,7 @@ int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size) return -1; volume_id_set_usage(id, VOLUME_ID_CRYPTO); - volume_id_set_uuid(id, header->uuid, UUID_DCE_STRING); - + volume_id_set_uuid(id, header->uuid, 36, UUID_HEX_STRING); id->type = "crypto_LUKS"; - return 0; } diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c index 67af561331..4d157aaf5d 100644 --- a/extras/volume_id/lib/netware.c +++ b/extras/volume_id/lib/netware.c @@ -91,7 +91,7 @@ int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size) if (memcmp(nw->SBH_Signature, "SPB5", 4) != 0) return -1; - volume_id_set_uuid(id, nw->SBH_PoolID, UUID_DCE); + volume_id_set_uuid(id, nw->SBH_PoolID, 0, UUID_DCE); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%02u", le16_to_cpu(nw->SBH_VersionMediaMajor), le16_to_cpu(nw->SBH_VersionMediaMinor)); diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index f7675a3434..6e91db687b 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -114,7 +114,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) if (memcmp(ns->oem_id, "NTFS", 4) != 0) return -1; - volume_id_set_uuid(id, ns->volume_serial, UUID_NTFS); + volume_id_set_uuid(id, ns->volume_serial, 0, UUID_NTFS); sector_size = le16_to_cpu(ns->bytes_per_sector); cluster_size = ns->sectors_per_cluster * sector_size; diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c index 349527b7e0..9f251f1794 100644 --- a/extras/volume_id/lib/ocfs.c +++ b/extras/volume_id/lib/ocfs.c @@ -156,7 +156,7 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_label_string(id, osl->label, 64); } if (osl->vol_id_len == 16) - volume_id_set_uuid(id, osl->vol_id, UUID_DCE); + volume_id_set_uuid(id, osl->vol_id, 0, UUID_DCE); id->type = "ocfs"; return 0; } @@ -184,7 +184,7 @@ int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); volume_id_set_label_raw(id, os->s_label, 64); volume_id_set_label_string(id, os->s_label, 64); - volume_id_set_uuid(id, os->s_uuid, UUID_DCE); + volume_id_set_uuid(id, os->s_uuid, 0, UUID_DCE); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", os->s_major_rev_level, os->s_minor_rev_level); id->type = "ocfs2"; diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c index 1f219e5bde..18db63817a 100644 --- a/extras/volume_id/lib/reiserfs.c +++ b/extras/volume_id/lib/reiserfs.c @@ -88,7 +88,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size) strcpy(id->type_version, "4"); volume_id_set_label_raw(id, rs4->label, 16); volume_id_set_label_string(id, rs4->label, 16); - volume_id_set_uuid(id, rs4->uuid, UUID_DCE); + volume_id_set_uuid(id, rs4->uuid, 0, UUID_DCE); id->type = "reiser4"; goto found; } @@ -109,7 +109,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size) found_label: volume_id_set_label_raw(id, rs->label, 16); volume_id_set_label_string(id, rs->label, 16); - volume_id_set_uuid(id, rs->uuid, UUID_DCE); + volume_id_set_uuid(id, rs->uuid, 0, UUID_DCE); found: volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 762e84e170..d65fc2c1d6 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -115,11 +115,14 @@ void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enu volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count); } -void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format) +void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format) { unsigned int i; unsigned int count = 0; + if (len > sizeof(id->uuid_raw)) + len = sizeof(id->uuid_raw); + switch(format) { case UUID_DOS: count = 4; @@ -131,8 +134,11 @@ void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_form case UUID_DCE: count = 16; break; - case UUID_DCE_STRING: - count = 36; + case UUID_HEX_STRING: + count = len; + break; + case UUID_STRING: + count = len; break; case UUID_FOURINT: count = 35; @@ -172,7 +178,12 @@ set: buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); break; - case UUID_DCE_STRING: + case UUID_HEX_STRING: + for (i = 0; i < count; i++) + id->uuid[i] = tolower(buf[i]); + id->uuid[count] = '\0'; + break; + case UUID_STRING: memcpy(id->uuid, buf, count); id->uuid[count] = '\0'; break; diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index 964e70196a..cd8dac557c 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -63,7 +63,8 @@ #endif /* __BYTE_ORDER */ enum uuid_format { - UUID_DCE_STRING, + UUID_HEX_STRING, + UUID_STRING, UUID_DCE, UUID_DOS, UUID_NTFS, @@ -81,7 +82,7 @@ extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); -extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, enum uuid_format format); +extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format); extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); extern void volume_id_free_buffer(struct volume_id *id); diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index bf009c7203..a66b4a5769 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -146,6 +146,9 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (volume_id_probe_linux_raid(id, off, size) == 0) goto found; + if (volume_id_probe_ddf_raid(id, off, size) == 0) + goto found; + if (volume_id_probe_intel_software_raid(id, off, size) == 0) goto found; diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c index 5c1a82e1d3..9eac8273c8 100644 --- a/extras/volume_id/lib/xfs.c +++ b/extras/volume_id/lib/xfs.c @@ -56,7 +56,7 @@ int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_label_raw(id, xs->fname, 12); volume_id_set_label_string(id, xs->fname, 12); - volume_id_set_uuid(id, xs->uuid, UUID_DCE); + volume_id_set_uuid(id, xs->uuid, 0, UUID_DCE); volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "xfs"; -- cgit v1.2.3-54-g00ecf From a6abdbfc7e216e5c84009fabbc8cff99a880485d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 4 May 2007 16:54:46 +0200 Subject: volume_id: add DDF support --- extras/volume_id/lib/Makefile | 1 + extras/volume_id/lib/ddf_raid.c | 64 +++++++++++++++++++++++++++++++++++ extras/volume_id/lib/exported_symbols | 1 + extras/volume_id/lib/libvolume_id.h | 1 + 4 files changed, 67 insertions(+) create mode 100644 extras/volume_id/lib/ddf_raid.c diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 5618b96a51..b73172e37e 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -30,6 +30,7 @@ OBJS= \ promise_raid.o \ adaptec_raid.o \ jmicron_raid.o \ + ddf_raid.o \ iso9660.o \ jfs.o \ linux_raid.o \ diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c new file mode 100644 index 0000000000..9ac5c91e5a --- /dev/null +++ b/extras/volume_id/lib/ddf_raid.c @@ -0,0 +1,64 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +#define DDF_HEADER 0xDE11DE11 +#define DDF_GUID_LENGTH 24 +#define DDF_REV_LENGTH 8 + +static struct ddf_header { + uint32_t signature; + uint32_t crc; + uint8_t guid[DDF_GUID_LENGTH]; + uint8_t ddf_rev[DDF_REV_LENGTH]; +} PACKED *ddf; + +int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) +{ + uint64_t ddf_off = ((size / 0x200)-1) * 0x200; + const uint8_t *buf; + + info("probing at offset 0x%llx, size 0x%llx", + (unsigned long long) off, (unsigned long long) size); + if (size < 0x10000) + return -1; + + buf = volume_id_get_buffer(id, off + ddf_off, 0x200); + if (buf == NULL) + return -1; + ddf = (struct ddf_header *) buf; + + if (ddf->signature != cpu_to_be32(DDF_HEADER)) + return -1; + + volume_id_set_uuid(id, ddf->guid, DDF_GUID_LENGTH, UUID_STRING); + snprintf(id->type_version, DDF_REV_LENGTH, "%s", ddf->ddf_rev); + volume_id_set_usage(id, VOLUME_ID_RAID); + id->type = "ddf_raid_member"; + return 0; +} diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index c88d993e01..d11634a948 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -44,6 +44,7 @@ volume_id_probe_linux_raid; volume_id_probe_lvm1; volume_id_probe_lvm2; + volume_id_probe_ddf_raid; volume_id_probe_intel_software_raid; volume_id_probe_highpoint_37x_raid; volume_id_probe_highpoint_45x_raid; diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index 523543f7ee..adfc75cb99 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -103,6 +103,7 @@ extern int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t siz extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size); /* bios raid */ extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); -- cgit v1.2.3-54-g00ecf From 68d557885247632558e8c14ffc4b16e916810bee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 4 May 2007 17:16:08 +0200 Subject: vol_id: README update --- extras/volume_id/README | 27 ++++++++++++++------------- extras/volume_id/lib/ddf_raid.c | 4 +++- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/extras/volume_id/README b/extras/volume_id/README index b458ca59ba..217be3114c 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -4,18 +4,21 @@ This program is normally called from a udev rule, to provide udev with the filesystem type of a volume and the label and uuid to name a device node. vol_id opens the blockdevice node specified at the commandline. The following commandline switches are supported to specify what vol_id should print: - - --export prints all values - -h prints help text - -l prints the label of the volume - -u prints the uuid of the volume + --export export key/value pairs + --type filesystem type + --label filesystem label + --label-raw raw label + --uuid filesystem uuid + --skip-raid don't probe for raid + --probe-all find possibly conflicting signatures + --help vol_id will only return successful if the string asked for, is not empty. All trailing whitespace will be removed, spaces replaced by underscore and slashes ignored. -fstype probe label uuid fsversion ----------------------------------------------------- +fstype probe label uuid version +-------------------------------------------------- linux swap * * * * ext * * * * reiserfs jr/3.5/3.6/4 * * * * @@ -41,9 +44,10 @@ gfs, gfs2 * - - - Raid members are detected to prevent the probing for a filesystem ----------------------------------------------------------------- -linux raid * - * * +linux raid (md) * * * * LVM 1 * - - - LVM 2 * - - * +ddf * - * * highpoint * - - - isw_raid * - - - lsi_raid * - - - @@ -54,9 +58,6 @@ via_raid * - - - jmicron * - - - adaptec * - - - -If no label is found vol_id exits with nonzero and the rule will be -ignored. - To give it a try, you may call it on the commandline: $ extras/volume_id/vol_id --export /dev/sda6 ID_FS_USAGE=filesystem @@ -66,10 +67,10 @@ To give it a try, you may call it on the commandline: ID_FS_LABEL=devel ID_FS_LABEL_SAFE=devel - $ extras/volume_id/vol_id -l /dev/sda6 + $ extras/volume_id/vol_id --label /dev/sda6 devel - $ extras/volume_id/vol_id -t /dev/sda6 + $ extras/volume_id/vol_id --type /dev/sda6 ext3 diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c index 9ac5c91e5a..560e6bd603 100644 --- a/extras/volume_id/lib/ddf_raid.c +++ b/extras/volume_id/lib/ddf_raid.c @@ -1,7 +1,7 @@ /* * volume_id - reads filesystem label and uuid * - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2007 Kay Sievers * * 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 @@ -27,6 +27,8 @@ #include "libvolume_id.h" #include "util.h" +/* http://www.snia.org/standards/home */ + #define DDF_HEADER 0xDE11DE11 #define DDF_GUID_LENGTH 24 #define DDF_REV_LENGTH 8 -- cgit v1.2.3-54-g00ecf From 13361e47049d14eeb76234ad14403f4d86fc8ba5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 6 May 2007 02:23:48 +0200 Subject: volume_id: rename UUID_64BIT_LE/BE --- extras/volume_id/lib/hfs.c | 2 +- extras/volume_id/lib/ntfs.c | 2 +- extras/volume_id/lib/util.c | 27 +++++++++++++++------------ extras/volume_id/lib/util.h | 6 +++--- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index 8156008f61..70a6b4ae2c 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -160,7 +160,7 @@ static void hfsid_set_uuid(struct volume_id *id, const uint8_t *hfs_id) volume_id_set_uuid(id, uuid, UUID_DCE); #endif - volume_id_set_uuid(id, hfs_id, 0, UUID_HFS); + volume_id_set_uuid(id, hfs_id, 0, UUID_64BIT_BE); } int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size) diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index 6e91db687b..9262454321 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -114,7 +114,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) if (memcmp(ns->oem_id, "NTFS", 4) != 0) return -1; - volume_id_set_uuid(id, ns->volume_serial, 0, UUID_NTFS); + volume_id_set_uuid(id, ns->volume_serial, 0, UUID_64BIT_LE); sector_size = le16_to_cpu(ns->bytes_per_sector); cluster_size = ns->sectors_per_cluster * sector_size; diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index d65fc2c1d6..54d9fd0d80 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -1,7 +1,7 @@ /* * volume_id - reads filesystem label and uuid * - * Copyright (C) 2005 Kay Sievers + * Copyright (C) 2005-2007 Kay Sievers * * 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 @@ -124,22 +124,22 @@ void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, en len = sizeof(id->uuid_raw); switch(format) { + case UUID_STRING: + count = len; + break; + case UUID_HEX_STRING: + count = len; + break; case UUID_DOS: count = 4; break; - case UUID_NTFS: - case UUID_HFS: + case UUID_64BIT_LE: + case UUID_64BIT_BE: count = 8; break; case UUID_DCE: count = 16; break; - case UUID_HEX_STRING: - count = len; - break; - case UUID_STRING: - count = len; - break; case UUID_FOURINT: count = 35; break; @@ -159,12 +159,12 @@ set: sprintf(id->uuid, "%02X%02X-%02X%02X", buf[3], buf[2], buf[1], buf[0]); break; - case UUID_NTFS: + case UUID_64BIT_LE: sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); break; - case UUID_HFS: + case UUID_64BIT_BE: sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); @@ -179,8 +179,11 @@ set: buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); break; case UUID_HEX_STRING: + /* translate A..F to a..f */ + memcpy(id->uuid, buf, count); for (i = 0; i < count; i++) - id->uuid[i] = tolower(buf[i]); + if (id->uuid[i] >= 'A' && id->uuid[i] <= 'F') + id->uuid[i] = (id->uuid[i] - 'A') + 'a'; id->uuid[count] = '\0'; break; case UUID_STRING: diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index cd8dac557c..1206116ce2 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -63,12 +63,12 @@ #endif /* __BYTE_ORDER */ enum uuid_format { - UUID_HEX_STRING, UUID_STRING, + UUID_HEX_STRING, UUID_DCE, UUID_DOS, - UUID_NTFS, - UUID_HFS, + UUID_64BIT_LE, + UUID_64BIT_BE, UUID_FOURINT, }; -- cgit v1.2.3-54-g00ecf From 1c6c7ab118b1ddbf91b3f4582187d462dd3e8d8e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 6 May 2007 02:24:21 +0200 Subject: vol_id: add ID_FS_UUID_SAFE --- extras/volume_id/vol_id.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index fbf9832b50..9830929ef4 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -134,7 +134,8 @@ int main(int argc, char *argv[]) } print = PRINT_EXPORT; struct volume_id *vid = NULL; - char name[128]; + char label_safe[128]; + char uuid_safe[128]; uint64_t size; int skip_raid = 0; int probe_all = 0; @@ -239,6 +240,9 @@ int main(int argc, char *argv[]) if (volume_id_probe_linux_raid(vid, 0, size) == 0) if (volume_id_get_type(vid, &type)) printf("%s\n", type); + if (volume_id_probe_ddf_raid(vid, 0, 0) == 0) + if (volume_id_get_type(vid, &type)) + printf("%s\n", type); if (volume_id_probe_intel_software_raid(vid, 0, size) == 0) if (volume_id_get_type(vid, &type)) printf("%s\n", type); @@ -359,8 +363,11 @@ int main(int argc, char *argv[]) rc = 4; goto exit; } - set_str(name, label, sizeof(name)); - replace_untrusted_chars(name); + + set_str(label_safe, label, sizeof(label_safe)); + replace_untrusted_chars(label_safe); + set_str(uuid_safe, uuid, sizeof(uuid_safe)); + replace_untrusted_chars(uuid_safe); switch (print) { case PRINT_EXPORT: @@ -368,25 +375,26 @@ int main(int argc, char *argv[]) printf("ID_FS_TYPE=%s\n", type); printf("ID_FS_VERSION=%s\n", type_version); printf("ID_FS_UUID=%s\n", uuid); + printf("ID_FS_UUID_SAFE=%s\n", uuid_safe); printf("ID_FS_LABEL=%s\n", label); - printf("ID_FS_LABEL_SAFE=%s\n", name); + printf("ID_FS_LABEL_SAFE=%s\n", label_safe); break; case PRINT_TYPE: printf("%s\n", type); break; case PRINT_LABEL: - if (name[0] == '\0' || strcmp(usage, "raid") == 0) { + if (label_safe[0] == '\0' || strcmp(usage, "raid") == 0) { rc = 3; goto exit; } - printf("%s\n", name); + printf("%s\n", label_safe); break; case PRINT_UUID: - if (uuid[0] == '\0' || strcmp(usage, "raid") == 0) { + if (uuid_safe[0] == '\0' || strcmp(usage, "raid") == 0) { rc = 4; goto exit; } - printf("%s\n", uuid); + printf("%s\n", uuid_safe); break; case PRINT_LABEL_RAW: if (label[0] == '\0' || strcmp(usage, "raid") == 0) { -- cgit v1.2.3-54-g00ecf From 02c38c8033ad5f9f5d3aa7dd2e879007f1a7d883 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 May 2007 15:34:49 +0200 Subject: rules: use ID_FS_UUID_SAFE --- etc/udev/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index b7af0bcb70..2af837dc40 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -53,7 +53,7 @@ KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part% # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_SAFE}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_SAFE}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" # BIOS Enhanced Disk Device -- cgit v1.2.3-54-g00ecf From 1b679f0a8bca9a17107b501b2c754293f9202135 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 May 2007 15:35:10 +0200 Subject: rules: SUSE update --- etc/udev/suse/50-udev-default.rules | 59 ++++++++++++++++-------------------- etc/udev/suse/64-device-mapper.rules | 10 ++++-- etc/udev/suse/64-md-raid.rules | 6 +++- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 3a6a8a975c..4a74bbb6d6 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -1,12 +1,10 @@ # console -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="vcs*", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="vcsa*", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="tty", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="tty[0-9]*", GROUP="tty", MODE="620", OPTIONS="last_rule" -KERNEL=="console", MODE="600", OPTIONS="last_rule" -KERNEL=="ptmx", GROUP="tty", MODE="666", OPTIONS="last_rule" +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty[0-9]*|vcs*", GROUP="tty", MODE="0620", OPTIONS="last_rule" +KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="console", MODE="0600", OPTIONS="last_rule" # serial devices KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" @@ -32,11 +30,9 @@ KERNEL=="pmu", GROUP="video" SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" # input devices -KERNEL=="mouse*|mice", NAME="input/%k", MODE="0640" -KERNEL=="event*", NAME="input/%k", MODE="0640" +KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" KERNEL=="js*", NAME="input/%k", MODE="0644" -KERNEL=="ts*", NAME="input/%k", MODE="0600" -KERNEL=="uinput", NAME="input/%k", MODE="0600" +KERNEL=="ts*|uinput", NAME="input/%k", MODE="0600" KERNEL=="lirc0", SYMLINK+="lirc" # printer @@ -62,29 +58,26 @@ KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" KERNEL=="tun", NAME="net/%k", MODE="0666" # misc devices -KERNEL=="mem|kmem", GROUP="kmem", MODE="640" -KERNEL=="port", GROUP="kmem", MODE="640" -KERNEL=="nvram", GROUP="kmem", MODE="600" -KERNEL=="null", MODE="666" -KERNEL=="zero", MODE="666" -KERNEL=="full", MODE="622" -KERNEL=="random", MODE="666" -KERNEL=="urandom", MODE="644" -KERNEL=="rtc", MODE="600" +KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" +KERNEL=="nvram", GROUP="kmem", MODE="0600" +KERNEL=="null|zero|random", MODE="0666" +KERNEL=="full", MODE="0622" +KERNEL=="urandom", MODE="0644" +KERNEL=="rtc", MODE="0600" KERNEL=="fuse", MODE="0666" KERNEL=="sonypi", MODE="0666" KERNEL=="agpgart", MODE="0600", GROUP="video" -KERNEL=="djs*", MODE="644" -KERNEL=="sgi_*", MODE="666" -KERNEL=="rrom*", MODE="400" -KERNEL=="rflash*", MODE="400" -KERNEL=="usbscanner*", MODE="644" -KERNEL=="3270/ttycons*", MODE="600" -KERNEL=="3270/tub*", MODE="666" -KERNEL=="3270/tubcons*", MODE="600" -KERNEL=="ica", MODE="666" -KERNEL=="z90crypt", MODE="666" -KERNEL=="mmtimer", MODE="644" +KERNEL=="djs*", MODE="0644" +KERNEL=="sgi_*", MODE="0666" +KERNEL=="rrom*", MODE="0400" +KERNEL=="rflash*", MODE="0400" +KERNEL=="usbscanner*", MODE="0644" +KERNEL=="3270/ttycons*", MODE="0600" +KERNEL=="3270/tub*", MODE="0666" +KERNEL=="3270/tubcons*", MODE="0600" +KERNEL=="ica", MODE="0666" +KERNEL=="z90crypt", MODE="0666" +KERNEL=="mmtimer", MODE="0644" KERNEL=="auer[0-9]*" NAME="usb/%k" # packet writing interface @@ -112,7 +105,7 @@ SUBSYSTEM=="ide", ACTION=="add", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-s SUBSYSTEM=="mmc", ACTION=="add", RUN+="/sbin/modprobe mmc_block" # misc storage devices (non-block) -KERNEL=="sg*", GROUP="disk", MODE="640" +KERNEL=="sg*", GROUP="disk", MODE="0640" KERNEL=="st*|nst*", GROUP="disk" KERNEL=="qft*|nqft*|zqft*|nzqft*|rawqft*|nrawqft", GROUP="disk" KERNEL=="ht*|nht*", GROUP="disk" diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index a84b1077d0..2c63b1fb70 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -7,12 +7,16 @@ KERNEL!="dm-*", GOTO="device_mapper_end" ACTION!="add|change", GOTO="device_mapper_end" # skip snapshot and error tables -PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" -RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" +IMPORT{program}="/sbin/dmsetup export -j%M -m%m" +ENV{DM_STATE}!="ACTIVE", GOTO="device_mapper_end" +ENV{DM_TARGET_TYPES}=="|*snapshot*|*error*", GOTO="device_mapper_end" + +SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" +ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" IMPORT{program}="vol_id --export $tempnode" OPTIONS="link_priority=-100" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_SAFE}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_SAFE}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="device_mapper_end" diff --git a/etc/udev/suse/64-md-raid.rules b/etc/udev/suse/64-md-raid.rules index 39af3ef6be..4745deb0e9 100644 --- a/etc/udev/suse/64-md-raid.rules +++ b/etc/udev/suse/64-md-raid.rules @@ -6,9 +6,13 @@ ACTION!="add|change", GOTO="md_end" ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" +#IMPORT{program}="/sbin/mdadm -D --export $tempnode" +ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" +ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" + IMPORT{program}="vol_id --export $tempnode" OPTIONS="link_priority=100" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_SAFE}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_SAFE}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="md_end" -- cgit v1.2.3-54-g00ecf From c1091150be0ae32584dcc1be20433a561928a30c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 8 May 2007 19:59:23 +0200 Subject: volume_id: give access to list of all available probers --- extras/volume_id/lib/exported_symbols | 7 +- extras/volume_id/lib/libvolume_id.h | 46 +++++--- extras/volume_id/lib/volume_id.c | 212 +++++++++++++++------------------- 3 files changed, 128 insertions(+), 137 deletions(-) diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index d11634a948..3422152edb 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -10,11 +10,14 @@ volume_id_get_type_version; volume_id_open_fd; - volume_id_open_node; + volume_id_close; volume_id_probe_all; volume_id_probe_filesystem; volume_id_probe_raid; - volume_id_close; + volume_id_all_probers; + volume_id_get_prober_by_type; + + volume_id_open_node; volume_id_probe_linux_swap; volume_id_probe_luks; diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index adfc75cb99..c0ab29e0f7 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -16,9 +16,38 @@ typedef void (*volume_id_log_fn_t)(int priority, const char *file, int line, const char *format, ...) __attribute__ ((format(printf, 4, 5))); - extern volume_id_log_fn_t volume_id_log_fn; +struct volume_id; +typedef int (*volume_id_probe_fn_t)(struct volume_id *id, uint64_t off, uint64_t size); +typedef int (*all_probers_fn_t)(volume_id_probe_fn_t probe_fn, + struct volume_id *id, uint64_t off, uint64_t size, + void *data); + +extern struct volume_id *volume_id_open_fd(int fd); +extern void volume_id_close(struct volume_id *id); +extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); +extern const volume_id_probe_fn_t *volume_id_get_prober_by_type(const char *type); +extern void volume_id_all_probers(all_probers_fn_t all_probers_fn, + struct volume_id *id, uint64_t off, uint64_t size, + void *data); +extern int volume_id_get_label(struct volume_id *id, const char **label); +extern int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len); +extern int volume_id_get_uuid(struct volume_id *id, const char **uuid); +extern int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len); +extern int volume_id_get_usage(struct volume_id *id, const char **usage); +extern int volume_id_get_type(struct volume_id *id, const char **type); +extern int volume_id_get_type_version(struct volume_id *id, const char **type_version); + +/* + * Note: everything below will be made private or removed from + * a future version, and a new major release of libvolume_id + */ + +extern struct volume_id *volume_id_open_node(const char *path); + #define VOLUME_ID_LABEL_SIZE 64 #define VOLUME_ID_UUID_SIZE 36 #define VOLUME_ID_FORMAT_SIZE 32 @@ -56,21 +85,6 @@ struct volume_id { int fd_close:1; }; -extern int volume_id_get_label(struct volume_id *id, const char **label); -extern int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len); -extern int volume_id_get_uuid(struct volume_id *id, const char **uuid); -extern int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len); -extern int volume_id_get_usage(struct volume_id *id, const char **usage); -extern int volume_id_get_type(struct volume_id *id, const char **type); -extern int volume_id_get_type_version(struct volume_id *id, const char **type_version); - -extern struct volume_id *volume_id_open_fd(int fd); -extern struct volume_id *volume_id_open_node(const char *path); -extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern void volume_id_close(struct volume_id *id); - /* filesystems */ extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size); diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index a66b4a5769..42c67d905a 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -28,6 +28,57 @@ #include "libvolume_id.h" #include "util.h" +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +struct prober { + const char *type; + volume_id_probe_fn_t prober; +}; + +static const struct prober prober_raid[] = { + {"linux_raid_member", volume_id_probe_linux_raid }, + {"ddf_raid_member", volume_id_probe_ddf_raid }, + {"isw_raid_member", volume_id_probe_intel_software_raid }, + {"lsi_mega_raid_member", volume_id_probe_lsi_mega_raid }, + {"via_raid_member", volume_id_probe_via_raid }, + {"silicon_medley_raid_member", volume_id_probe_silicon_medley_raid }, + {"nvidia_raid_member", volume_id_probe_nvidia_raid }, + {"promise_fasttrack_raid_member", volume_id_probe_promise_fasttrack_raid }, + {"highpoint_raid_member", volume_id_probe_highpoint_45x_raid }, + {"adaptec_raid_member", volume_id_probe_adaptec_raid }, + {"jmicron_raid_member", volume_id_probe_jmicron_raid }, + {"LVM1_member", volume_id_probe_lvm1 }, + {"LVM2_member", volume_id_probe_lvm2 }, + {"highpoint_raid_member", volume_id_probe_highpoint_37x_raid }, +}; + +static const struct prober prober_filesystem[] = { + { "vfat", volume_id_probe_vfat }, + { "linux_swap", volume_id_probe_linux_swap }, + { "luks", volume_id_probe_luks }, + { "xfs", volume_id_probe_xfs }, + { "ext", volume_id_probe_ext }, + { "reiserfs", volume_id_probe_reiserfs }, + { "jfs", volume_id_probe_jfs }, + { "udf", volume_id_probe_udf }, + { "iso9660", volume_id_probe_iso9660 }, + { "hfs", volume_id_probe_hfs_hfsplus }, + { "ufs", volume_id_probe_ufs }, + { "ntfs", volume_id_probe_ntfs }, + { "cramfs", volume_id_probe_cramfs }, + { "romfs", volume_id_probe_romfs }, + { "hpfs", volume_id_probe_hpfs }, + { "sysv", volume_id_probe_sysv }, + { "minix", volume_id_probe_minix }, + { "ocfs1", volume_id_probe_ocfs1 }, + { "ocfs2", volume_id_probe_ocfs2 }, + { "vxfs", volume_id_probe_vxfs }, + { "squashfs", volume_id_probe_squashfs }, + { "netware", volume_id_probe_netware }, + { "gfs", volume_id_probe_gfs }, + { "gfs2", volume_id_probe_gfs2 }, +}; + /* the user can overwrite this log function */ static void default_log(int priority, const char *file, int line, const char *format, ...) { @@ -36,6 +87,19 @@ static void default_log(int priority, const char *file, int line, const char *fo volume_id_log_fn_t volume_id_log_fn = default_log; +const volume_id_probe_fn_t *volume_id_get_prober_by_type(const char *type) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(prober_raid); i++) + if (strcmp(type, prober_raid[i].type) == 0) + return &prober_raid[i].prober; + for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) + if (strcmp(type, prober_filesystem[i].type) == 0) + return &prober_filesystem[i].prober; + return NULL; +} + int volume_id_get_label(struct volume_id *id, const char **label) { if (id == NULL) @@ -135,57 +199,17 @@ int volume_id_get_type_version(struct volume_id *id, const char **type_version) int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) { + unsigned int i; + if (id == NULL) return -EINVAL; info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); - /* probe for raid first, because fs probes may be successful on raid members */ - if (size) { - if (volume_id_probe_linux_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_ddf_raid(id, off, size) == 0) + for (i = 0; i < ARRAY_SIZE(prober_raid); i++) + if (prober_raid[i].prober(id, off, size) == 0) goto found; - - if (volume_id_probe_intel_software_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_lsi_mega_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_via_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_silicon_medley_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_nvidia_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_promise_fasttrack_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_highpoint_45x_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_adaptec_raid(id, off, size) == 0) - goto found; - - if (volume_id_probe_jmicron_raid(id, off, size) == 0) - goto found; - } - - if (volume_id_probe_lvm1(id, off, size) == 0) - goto found; - - if (volume_id_probe_lvm2(id, off, size) == 0) - goto found; - - if (volume_id_probe_highpoint_37x_raid(id, off, size) == 0) - goto found; - return -1; found: @@ -196,87 +220,17 @@ found: int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size) { + unsigned int i; + if (id == NULL) return -EINVAL; info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); - if (volume_id_probe_vfat(id, off, size) == 0) - goto found; - - /* fill buffer with maximum */ - volume_id_get_buffer(id, 0, SB_BUFFER_SIZE); - - if (volume_id_probe_linux_swap(id, off, size) == 0) - goto found; - - if (volume_id_probe_luks(id, off, size) == 0) - goto found; - - if (volume_id_probe_xfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_ext(id, off, size) == 0) - goto found; - - if (volume_id_probe_reiserfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_jfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_udf(id, off, size) == 0) - goto found; - - if (volume_id_probe_iso9660(id, off, size) == 0) - goto found; - - if (volume_id_probe_hfs_hfsplus(id, off, size) == 0) - goto found; - - if (volume_id_probe_ufs(id, off, size) == 0) - goto found; - - if (volume_id_probe_ntfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_cramfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_romfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_hpfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_sysv(id, off, size) == 0) - goto found; - - if (volume_id_probe_minix(id, off, size) == 0) - goto found; - - if (volume_id_probe_ocfs1(id, off, size) == 0) - goto found; - - if (volume_id_probe_ocfs2(id, off, size) == 0) - goto found; - - if (volume_id_probe_vxfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_squashfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_netware(id, off, size) == 0) - goto found; - - if (volume_id_probe_gfs(id, off, size) == 0) - goto found; - - if (volume_id_probe_gfs2(id, off, size) == 0) - goto found; - + for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) + if (prober_filesystem[i].prober(id, off, size) == 0) + goto found; return -1; found: @@ -290,6 +244,7 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; + /* probe for raid first, because fs probes may be successful on raid members */ if (volume_id_probe_raid(id, off, size) == 0) return 0; @@ -299,6 +254,25 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) return -1; } +void volume_id_all_probers(all_probers_fn_t all_probers_fn, + struct volume_id *id, uint64_t off, uint64_t size, + void *data) +{ + unsigned int i; + + if (all_probers_fn == NULL) + return; + + for (i = 0; i < ARRAY_SIZE(prober_raid); i++) + if (all_probers_fn(prober_raid[i].prober, id, off, size, data) != 0) + goto out; + for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) + if (all_probers_fn(prober_filesystem[i].prober, id, off, size, data) != 0) + goto out; +out: + return; +} + /* open volume by already open file descriptor */ struct volume_id *volume_id_open_fd(int fd) { -- cgit v1.2.3-54-g00ecf From 9377c8d80c1530c7b006115daa0ccab4d40f4d93 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 8 May 2007 20:00:02 +0200 Subject: vol_id: use libvolume_id prober list for --probe-all --- extras/volume_id/vol_id.c | 119 ++++++---------------------------------------- 1 file changed, 14 insertions(+), 105 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 9830929ef4..cb1d455891 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -111,6 +111,19 @@ static void set_str(char *to, const char *from, size_t count) to[j] = '\0'; } +static int all_probers(volume_id_probe_fn_t probe_fn, + struct volume_id *id, uint64_t off, uint64_t size, + void *data) +{ + const char *type; + + if (probe_fn(id, off, size) == 0) + if (volume_id_get_type(id, &type)) + printf("%s\n", type); + + return 0; +} + int main(int argc, char *argv[]) { static const struct option options[] = { @@ -237,111 +250,7 @@ int main(int argc, char *argv[]) } if (probe_all) { - if (volume_id_probe_linux_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_ddf_raid(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_intel_software_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_lsi_mega_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_via_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_silicon_medley_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_nvidia_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_promise_fasttrack_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_highpoint_45x_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_adaptec_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_jmicron_raid(vid, 0, size) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_vfat(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_linux_swap(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_luks(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_xfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_ext(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_reiserfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_jfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_udf(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_iso9660(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_hfs_hfsplus(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_ufs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_ntfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_cramfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_romfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_hpfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_sysv(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_minix(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_ocfs1(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_ocfs2(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_vxfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_squashfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_netware(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_gfs(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); - if (volume_id_probe_gfs2(vid, 0, 0) == 0) - if (volume_id_get_type(vid, &type)) - printf("%s\n", type); + volume_id_all_probers(all_probers, vid, 0, size, NULL); goto exit; } -- cgit v1.2.3-54-g00ecf From 564794bbd3758371e5b4fbc745b2c67c50dd4de1 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Wed, 9 May 2007 08:25:51 +0200 Subject: rules: Gentoo update --- etc/udev/gentoo/64-device-mapper.rules | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/etc/udev/gentoo/64-device-mapper.rules b/etc/udev/gentoo/64-device-mapper.rules index d2639af5dd..e104a175d6 100644 --- a/etc/udev/gentoo/64-device-mapper.rules +++ b/etc/udev/gentoo/64-device-mapper.rules @@ -9,23 +9,25 @@ ACTION!="add|change", GOTO="device_mapper_end" # lookup device name # use dmsetup, until devmap_name is provided by sys-fs/device-mapper PROGRAM=="/sbin/dmsetup -j %M -m %m --noopencount --noheadings -c -o name info", - ENV{ID_DM_NAME}="%c" + ENV{DM_NAME}="%c" # do not do anything if dmsetup does not provide a name -ENV{ID_DM_NAME}=="", NAME="", OPTIONS="ignore_device" +ENV{DM_NAME}=="", NAME="", OPTIONS="ignore_device" # ignore luks crypt devices while not fully up -ENV{ID_DM_NAME}=="temporary-cryptsetup-*", NAME="", OPTIONS="ignore_device" +ENV{DM_NAME}=="temporary-cryptsetup-*", NAME="", OPTIONS="ignore_device" # use queried name -ENV{ID_DM_NAME}=="?*", NAME="mapper/$env{ID_DM_NAME}" +ENV{DM_NAME}=="?*", NAME="mapper/$env{DM_NAME}" + +SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" IMPORT{program}="vol_id --export $tempnode" OPTIONS="link_priority=50" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_SAFE}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_SAFE}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" LABEL="device_mapper_end" -- cgit v1.2.3-54-g00ecf From 223cfa97fcd474ae16d8f98f2d3f9c2c3ad07410 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 May 2007 16:06:15 +0200 Subject: volume_id: add remaining names for prober lookup by type --- extras/volume_id/lib/volume_id.c | 95 +++++++++++++++++++++------------------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 42c67d905a..f767429347 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -31,52 +31,50 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) struct prober { - const char *type; volume_id_probe_fn_t prober; + const char *name[4]; }; static const struct prober prober_raid[] = { - {"linux_raid_member", volume_id_probe_linux_raid }, - {"ddf_raid_member", volume_id_probe_ddf_raid }, - {"isw_raid_member", volume_id_probe_intel_software_raid }, - {"lsi_mega_raid_member", volume_id_probe_lsi_mega_raid }, - {"via_raid_member", volume_id_probe_via_raid }, - {"silicon_medley_raid_member", volume_id_probe_silicon_medley_raid }, - {"nvidia_raid_member", volume_id_probe_nvidia_raid }, - {"promise_fasttrack_raid_member", volume_id_probe_promise_fasttrack_raid }, - {"highpoint_raid_member", volume_id_probe_highpoint_45x_raid }, - {"adaptec_raid_member", volume_id_probe_adaptec_raid }, - {"jmicron_raid_member", volume_id_probe_jmicron_raid }, - {"LVM1_member", volume_id_probe_lvm1 }, - {"LVM2_member", volume_id_probe_lvm2 }, - {"highpoint_raid_member", volume_id_probe_highpoint_37x_raid }, + { volume_id_probe_linux_raid, { "linux_raid", } }, + { volume_id_probe_ddf_raid, { "ddf_raid", } }, + { volume_id_probe_intel_software_raid, { "isw_raid", } }, + { volume_id_probe_lsi_mega_raid, { "lsi_mega_raid", } }, + { volume_id_probe_via_raid, { "via_raid", } }, + { volume_id_probe_silicon_medley_raid, { "silicon_medley_raid", } }, + { volume_id_probe_nvidia_raid, { "nvidia_raid", } }, + { volume_id_probe_promise_fasttrack_raid, { "promise_fasttrack_raid", } }, + { volume_id_probe_highpoint_45x_raid, { "highpoint_raid", } }, + { volume_id_probe_adaptec_raid, { "adaptec_raid", } }, + { volume_id_probe_jmicron_raid, { "jmicron_raid", } }, + { volume_id_probe_lvm1, { "lvm1", } }, + { volume_id_probe_lvm2, { "lvm2", } }, + { volume_id_probe_highpoint_37x_raid, { "highpoint_raid", } }, }; static const struct prober prober_filesystem[] = { - { "vfat", volume_id_probe_vfat }, - { "linux_swap", volume_id_probe_linux_swap }, - { "luks", volume_id_probe_luks }, - { "xfs", volume_id_probe_xfs }, - { "ext", volume_id_probe_ext }, - { "reiserfs", volume_id_probe_reiserfs }, - { "jfs", volume_id_probe_jfs }, - { "udf", volume_id_probe_udf }, - { "iso9660", volume_id_probe_iso9660 }, - { "hfs", volume_id_probe_hfs_hfsplus }, - { "ufs", volume_id_probe_ufs }, - { "ntfs", volume_id_probe_ntfs }, - { "cramfs", volume_id_probe_cramfs }, - { "romfs", volume_id_probe_romfs }, - { "hpfs", volume_id_probe_hpfs }, - { "sysv", volume_id_probe_sysv }, - { "minix", volume_id_probe_minix }, - { "ocfs1", volume_id_probe_ocfs1 }, - { "ocfs2", volume_id_probe_ocfs2 }, - { "vxfs", volume_id_probe_vxfs }, - { "squashfs", volume_id_probe_squashfs }, - { "netware", volume_id_probe_netware }, - { "gfs", volume_id_probe_gfs }, - { "gfs2", volume_id_probe_gfs2 }, + { volume_id_probe_vfat, { "vfat", } }, + { volume_id_probe_linux_swap, { "swap", } }, + { volume_id_probe_luks, { "luks", } }, + { volume_id_probe_xfs, { "xfs", } }, + { volume_id_probe_ext, { "ext2", "ext3", "jbd", } }, + { volume_id_probe_reiserfs, { "reiserfs", "reiser4", } }, + { volume_id_probe_jfs, { "jfs", } }, + { volume_id_probe_udf, { "udf", } }, + { volume_id_probe_iso9660, { "iso9660", } }, + { volume_id_probe_hfs_hfsplus, { "hfs", "hfsplus", } }, + { volume_id_probe_ufs, { "ufs", } }, + { volume_id_probe_ntfs, { "ntfs", } }, + { volume_id_probe_cramfs, { "cramfs", } }, + { volume_id_probe_romfs, { "romfs", } }, + { volume_id_probe_hpfs, { "hpfs", } }, + { volume_id_probe_sysv, { "sysv", "xenix", } }, + { volume_id_probe_minix, { "minix", } }, + { volume_id_probe_ocfs1, { "ocfs1", } }, + { volume_id_probe_ocfs2, { "ocfs2", } }, + { volume_id_probe_vxfs, { "vxfs", } }, + { volume_id_probe_squashfs, { "squashfs", } }, + { volume_id_probe_netware, { "netware", } }, }; /* the user can overwrite this log function */ @@ -89,14 +87,19 @@ volume_id_log_fn_t volume_id_log_fn = default_log; const volume_id_probe_fn_t *volume_id_get_prober_by_type(const char *type) { - unsigned int i; + unsigned int p, n; - for (i = 0; i < ARRAY_SIZE(prober_raid); i++) - if (strcmp(type, prober_raid[i].type) == 0) - return &prober_raid[i].prober; - for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) - if (strcmp(type, prober_filesystem[i].type) == 0) - return &prober_filesystem[i].prober; + if (type == NULL) + return NULL; + + for (p = 0; p < ARRAY_SIZE(prober_raid); p++) + for (n = 0; prober_raid[p].name[n] != NULL; n++) + if (strcmp(type, prober_raid[p].name[n]) == 0) + return &prober_raid[p].prober; + for (p = 0; p < ARRAY_SIZE(prober_filesystem); p++) + for (n = 0; prober_filesystem[p].name[n] != NULL; n++) + if (strcmp(type, prober_filesystem[p].name[n]) == 0) + return &prober_filesystem[p].prober; return NULL; } -- cgit v1.2.3-54-g00ecf From c7301bb3ce36b3098eb25d5a29babd4248bc0b32 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 May 2007 16:26:00 +0200 Subject: rules: SUSE update --- etc/udev/suse/64-md-raid.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/suse/64-md-raid.rules b/etc/udev/suse/64-md-raid.rules index 4745deb0e9..5da0bae35a 100644 --- a/etc/udev/suse/64-md-raid.rules +++ b/etc/udev/suse/64-md-raid.rules @@ -6,7 +6,7 @@ ACTION!="add|change", GOTO="md_end" ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" -#IMPORT{program}="/sbin/mdadm -D --export $tempnode" +IMPORT{program}="/sbin/mdadm -D --export $tempnode" ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" -- cgit v1.2.3-54-g00ecf From f29fdd3cef35d6282c4af499b4e137021ace62e0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 May 2007 12:40:18 +0200 Subject: volume_id: vol_id depends on libvolume_id --- extras/volume_id/Makefile | 11 ++++++++--- extras/volume_id/lib/Makefile | 10 +++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 80f9755d19..6e5006594a 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -23,16 +23,21 @@ INSTALL_PROGRAM = ${INSTALL} INSTALL_DATA = ${INSTALL} -m 644 INSTALL_SCRIPT = ${INSTALL} -all: $(PROG) $(MAN_PAGES) +all: lib $(PROG) $(MAN_PAGES) .PHONY: all .DEFAULT: all +.SUFFIXES: + %.o: %.c $(GEN_HEADERS) $(E) " CC " $@ $(Q) $(CC) -c $(CFLAGS) $< -o $@ -lib/libvolume_id.a: - $(Q) $(MAKE) -C lib +lib: + $(Q) $(MAKE) -C $@ +.PHONY: lib + +lib/libvolume_id.a: lib $(PROG): %: $(HEADERS) %.o lib/libvolume_id.a $(E) " LD " $@ diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index b73172e37e..17992ba02e 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -63,15 +63,15 @@ all: libvolume_id.a $(SHLIB) libvolume_id.pc .PHONY: all .DEFAULT: all +.SUFFIXES: + %.o: %.c $(E) " CC " $@ $(Q) $(CC) -c $(CFLAGS) $< -o $@ -.shlib: - $(Q) mkdir .shlib - -.shlib/%.o: %.c .shlib +.shlib/%.o: %.c $(E) " CC " $@ + $(Q) mkdir -p $(dir $@) $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@ libvolume_id.a: $(HEADERS) $(OBJS) @@ -81,7 +81,7 @@ libvolume_id.a: $(HEADERS) $(OBJS) $(E) " RANLIB " $@ $(Q) $(RANLIB) $@ -$(SHLIB): $(HEADERS) .shlib $(addprefix .shlib/,$(OBJS)) +$(SHLIB): $(HEADERS) $(addprefix .shlib/,$(OBJS)) $(E) " CC " $@ $(Q) $(CC) -shared $(CFLAGS) -o $@ \ -Wl,-soname,libvolume_id.so.$(SHLIB_CUR),--version-script,exported_symbols \ -- cgit v1.2.3-54-g00ecf From 85135c740b36a26baad5e9ea92d9afd79c468d9d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 May 2007 12:42:56 +0200 Subject: release 111 --- ChangeLog | 29 +++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 13 +++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 57c6e35abe..61a412a9ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +Summary of changes from v110 to v111 +============================================ + +Kay Sievers (19): + rules: SUSE update + rules: Fedora update + volume_id: use md native uuid format + vol_id: use long options + volume_id: add volume_id_get_* functions + vol_id: use volume_id_get_* + udevd: use fgets() to read /proc files + volume_id: add internal UUID_STRING + volume_id: add DDF support + vol_id: README update + volume_id: rename UUID_64BIT_LE/BE + vol_id: add ID_FS_UUID_SAFE + rules: use ID_FS_UUID_SAFE + rules: SUSE update + volume_id: give access to list of all available probers + vol_id: use libvolume_id prober list for --probe-all + volume_id: add remaining names for prober lookup by type + rules: SUSE update + volume_id: vol_id depends on libvolume_id + +Matthias Schwarzott (2): + volume_id: fix Makefile for parallel make + rules: Gentoo update + + Summary of changes from v109 to v110 ============================================ diff --git a/Makefile b/Makefile index c4311ddc19..da89f86274 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 110 +VERSION = 111 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 81167fe71d..70d04b3e13 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,16 @@ +udev 111 +======== +Bugfixes. + +In the future, we may see uuid's which are just simple character +strings (see the DDF Raid Specification). For that reason vol_id now +exports ID_UUID_SAFE, just like ID_LABEL_SAFE. For things like +the creation of symlinks, the *_SAFE values ensure, that no control +or whitespace characters are used in the filename. + +Possible users of libvolume_id, please use the volume_id_get_* functions. +The public struct will go away in a future release of the library. + udev 110 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From fdc9a0b52a03e632f7bfde13d3e1c9e1ca94c757 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 11 May 2007 16:53:56 +0200 Subject: udevd: close /proc/meminfo after reading --- udevd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udevd.c b/udevd.c index fe01d8d4b9..05df871a34 100644 --- a/udevd.c +++ b/udevd.c @@ -335,6 +335,7 @@ static int mem_size_mb(void) } } + fclose(f); return memsize; } -- cgit v1.2.3-54-g00ecf From 74ced8c8900991db8650ba7cfaa4a16ee18558ab Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sun, 13 May 2007 00:02:20 +0200 Subject: create_floppy_devices: add man page --- extras/floppy/Makefile | 4 ++-- extras/floppy/create_floppy_devices.8 | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 extras/floppy/create_floppy_devices.8 diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 2044ac56fd..784464a843 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -57,11 +57,11 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - @echo "Please create a man page for this tool." + $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: install-man uninstall-man: - @echo "Please create a man page for this tool." + -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man install-config: diff --git a/extras/floppy/create_floppy_devices.8 b/extras/floppy/create_floppy_devices.8 new file mode 100644 index 0000000000..8f5f048f6a --- /dev/null +++ b/extras/floppy/create_floppy_devices.8 @@ -0,0 +1,35 @@ +.TH CREATE_FLOPPY_DEVICES 8 "May 2007" "" "Linux Administrator's Manual" +.SH NAME +create_floppy_devices \- udev callout to create all possible floppy device +based on the CMOS type. +.SH SYNOPSIS +create_floppy_devices [options] device +.SH OPTIONS +.TP +\fB\-c\fR +Create nodes. +.TP +\fB\-u\fR +Unlink nodes. +.TP +\fB\-d\fR +Print nodes. +.TP +\fB\-m\fR +Set major number. +.TP +\fB\-U\fR +Set user ownership. +.TP +\fB\-G\fR +Set group ownership. +.TP +\fB\-M\fR +Set device node mode. +.TP +\fB\-t\fR +Sed floppy type number. +.SH SEE ALSO +.BR udev (7) +.SH AUTHORS +Developed by Hannes Reinecke . -- cgit v1.2.3-54-g00ecf From 88243f0974b9855d7b50a3f1e080823d88d473f4 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Sun, 13 May 2007 00:06:26 +0200 Subject: path_id: remove on make uninstall --- extras/path_id/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/path_id/Makefile b/extras/path_id/Makefile index 24b47b425a..d8efe64187 100644 --- a/extras/path_id/Makefile +++ b/extras/path_id/Makefile @@ -49,7 +49,7 @@ install-man: .PHONY: install-man uninstall-man: - @echo "Please create a man page for this tool." + -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: uninstall-man install-config: -- cgit v1.2.3-54-g00ecf From f1a9ac32b992c0c6ca09e90035eca2c8da3bf548 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 May 2007 01:08:48 +0200 Subject: create_floppy_devices: remove dead "unlink" code --- extras/floppy/create_floppy_devices.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 7c1ea0715a..b9fa4ef41d 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -77,18 +77,12 @@ int main(int argc, char **argv) mode_t mode = 0660; int create_nodes = 0; int print_nodes = 0; - int unlink_nodes = 0; int is_err = 0; while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { switch (c) { case 'c': create_nodes = 1; - unlink_nodes = 0; - break; - case 'u': - unlink_nodes = 1; - create_nodes = 0; break; case 'd': print_nodes = 1; -- cgit v1.2.3-54-g00ecf From c6594afda43575c740aedccef65491420ca3851e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 May 2007 01:11:48 +0200 Subject: volume_id: add function documentation --- extras/volume_id/lib/volume_id.c | 165 ++++++++++++++++++++++++++++++++++----- 1 file changed, 147 insertions(+), 18 deletions(-) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index f767429347..15e9cda4da 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -85,6 +85,14 @@ static void default_log(int priority, const char *file, int line, const char *fo volume_id_log_fn_t volume_id_log_fn = default_log; +/** + * volume_id_get_label: + * @type: Type string. + * + * Lookup the probing function for a specific type. + * + * Returns: The probing function for the given type, #NULL otherwise. + **/ const volume_id_probe_fn_t *volume_id_get_prober_by_type(const char *type) { unsigned int p, n; @@ -103,12 +111,22 @@ const volume_id_probe_fn_t *volume_id_get_prober_by_type(const char *type) return NULL; } +/** + * volume_id_get_label: + * @id: Probing context. + * @label: Label string. Must not be freed by the caller. + * + * Get the label string after a successful probe. Unicode + * is translated to UTF-8. + * + * Returns: 1 if the value was set, 0 otherwise. + **/ int volume_id_get_label(struct volume_id *id, const char **label) { if (id == NULL) - return -EINVAL; + return 0; if (label == NULL) - return -EINVAL; + return 0; if (id->usage_id == VOLUME_ID_UNUSED) return 0; @@ -116,14 +134,25 @@ int volume_id_get_label(struct volume_id *id, const char **label) return 1; } +/** + * volume_id_get_label_raw: + * @id: Probing context. + * @label: Label byte array. Must not be freed by the caller. + * @len: Length of raw label byte array. + * + * Get the raw label byte array after a successful probe. It may + * contain undecoded multibyte character streams. + * + * Returns: 1 if the value was set, 0 otherwise. + **/ int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len) { if (id == NULL) - return -EINVAL; + return 0; if (label == NULL) - return -EINVAL; + return 0; if (len == NULL) - return -EINVAL; + return 0; if (id->usage_id == VOLUME_ID_UNUSED) return 0; @@ -132,12 +161,21 @@ int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t return 1; } +/** + * volume_id_get_uuid: + * @id: Probing context. + * @uuid: UUID string. Must not be freed by the caller. + * + * Get the raw UUID string after a successful probe. + * + * Returns: 1 if the value was set, 0 otherwise. + **/ int volume_id_get_uuid(struct volume_id *id, const char **uuid) { if (id == NULL) - return -EINVAL; + return 0; if (uuid == NULL) - return -EINVAL; + return 0; if (id->usage_id == VOLUME_ID_UNUSED) return 0; @@ -145,14 +183,25 @@ int volume_id_get_uuid(struct volume_id *id, const char **uuid) return 1; } +/** + * volume_id_get_uuid_raw: + * @id: Probing context. + * @uuid: UUID byte array. Must not be freed by the caller. + * @len: Length of raw UUID byte array. + * + * Get the raw UUID byte array after a successful probe. It may + * contain unconverted endianes values. + * + * Returns: 1 if the value was set, 0 otherwise. + **/ int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len) { if (id == NULL) - return -EINVAL; + return 0; if (uuid == NULL) - return -EINVAL; + return 0; if (len == NULL) - return -EINVAL; + return 0; if (id->usage_id == VOLUME_ID_UNUSED) return 0; @@ -161,12 +210,21 @@ int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *l return 1; } +/** + * volume_id_get_usage: + * @id: Probing context. + * @usage: Usage string. Must not be freed by the caller. + * + * Get the usage string after a successful probe. + * + * Returns: 1 if the value was set, 0 otherwise. + **/ int volume_id_get_usage(struct volume_id *id, const char **usage) { if (id == NULL) - return -EINVAL; + return 0; if (usage == NULL) - return -EINVAL; + return 0; if (id->usage_id == VOLUME_ID_UNUSED) return 0; @@ -174,12 +232,21 @@ int volume_id_get_usage(struct volume_id *id, const char **usage) return 1; } +/** + * volume_id_get_type: + * @id: Probing context + * @type: Type string. Must not be freed by the caller. + * + * Get the type string after a successful probe. + * + * Returns: 1 if the value was set, 0 otherwise. + **/ int volume_id_get_type(struct volume_id *id, const char **type) { if (id == NULL) - return -EINVAL; + return 0; if (type == NULL) - return -EINVAL; + return 0; if (id->usage_id == VOLUME_ID_UNUSED) return 0; @@ -187,12 +254,21 @@ int volume_id_get_type(struct volume_id *id, const char **type) return 1; } +/** + * volume_id_get_type_version: + * @id: Probing context. + * @type_version: Type version string. Must not be freed by the caller. + * + * Get the Type version string after a successful probe. + * + * Returns: 1 if the value was set, 0 otherwise. + **/ int volume_id_get_type_version(struct volume_id *id, const char **type_version) { if (id == NULL) - return -EINVAL; + return 0; if (type_version == NULL) - return -EINVAL; + return 0; if (id->usage_id == VOLUME_ID_UNUSED) return 0; @@ -200,6 +276,16 @@ int volume_id_get_type_version(struct volume_id *id, const char **type_version) return 1; } +/** + * volume_id_probe_raid: + * @id: Probing context. + * @off: Probing offset relative to the start of the device. + * @size: Total size of the device. + * + * Probe device for all known raid signatures. + * + * Returns: 0 on successful probe, otherwise negative value. + **/ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) { unsigned int i; @@ -221,6 +307,16 @@ found: return 0; } +/** + * volume_id_probe_filesystem: + * @id: Probing context. + * @off: Probing offset relative to the start of the device. + * @size: Total size of the device. + * + * Probe device for all known filesystem signatures. + * + * Returns: 0 on successful probe, otherwise negative value. + **/ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size) { unsigned int i; @@ -242,6 +338,16 @@ found: return 0; } +/** + * volume_id_probe_all: + * @id: Probing context. + * @off: Probing offset relative to the start of the device. + * @size: Total size of the device. + * + * Probe device for all known raid and filesystem signatures. + * + * Returns: 0 on successful probe, otherwise negative value. + **/ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) { if (id == NULL) @@ -257,6 +363,16 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) return -1; } +/** + * volume_id_probe_raid: + * @all_probers_fn: prober function to called for all known probing routines. + * @id: Context passed to prober function. + * @off: Offset value passed to prober function. + * @size: Size value passed to prober function. + * @data: Arbitrary data passed to the prober function. + * + * Run a custom function for all known probing routines. + **/ void volume_id_all_probers(all_probers_fn_t all_probers_fn, struct volume_id *id, uint64_t off, uint64_t size, void *data) @@ -276,7 +392,15 @@ out: return; } -/* open volume by already open file descriptor */ +/** + * volume_id_open_fd: + * @id: Probing context. + * @fd: Open file descriptor of device to read from. + * + * Create the context for probing. + * + * Returns: Probing context, or #NULL on failure. + **/ struct volume_id *volume_id_open_fd(int fd) { struct volume_id *id; @@ -291,7 +415,6 @@ struct volume_id *volume_id_open_fd(int fd) return id; } -/* open volume by device node */ struct volume_id *volume_id_open_node(const char *path) { struct volume_id *id; @@ -313,6 +436,12 @@ struct volume_id *volume_id_open_node(const char *path) return id; } +/** + * volume_id_close: + * @id: Probing context. + * + * Release probing context and free all associated data. + */ void volume_id_close(struct volume_id *id) { if (id == NULL) -- cgit v1.2.3-54-g00ecf From 05610c088ee9ea668d4750f69a35bf833a63616d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 May 2007 19:51:13 +0200 Subject: udev_db: escape path names with \x00 instead of %00 --- udev.h | 2 +- udev_rules.c | 11 +++-------- udev_utils_string.c | 25 +++++++++++++++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/udev.h b/udev.h index 6ef95133d5..bb018ba195 100644 --- a/udev.h +++ b/udev.h @@ -31,7 +31,7 @@ #define COMMENT_CHARACTER '#' #define LINE_SIZE 512 #define PATH_SIZE 512 -#define NAME_SIZE 128 +#define NAME_SIZE 256 #define VALUE_SIZE 128 #define DEFAULT_PARTITIONS_COUNT 15 diff --git a/udev_rules.c b/udev_rules.c index 5c3d7d5d06..edfe3fd94c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -79,14 +79,9 @@ static int get_key(char **line, char **key, char **value) char *temp; linepos = *line; - if (!linepos) + if (linepos == NULL) return -1; - if (strchr(linepos, '\\')) { - dbg("escaped characters are not supported, skip"); - return -1; - } - /* skip whitespace */ while (isspace(linepos[0])) linepos++; @@ -217,7 +212,7 @@ static int import_file_into_env(struct udevice *udev, const char *filename) static int import_program_into_env(struct udevice *udev, const char *program) { - char result[1024]; + char result[2048]; size_t reslen; if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_INFO)) != 0) @@ -851,7 +846,7 @@ try_parent: } } - /* if we have ATTR assignements write value to sysfs file */ + /* if we have ATTR assignments, write value to sysfs file */ for (i = 0; i < rule->attr.count; i++) { struct key_pair *pair = &rule->attr.keys[i]; diff --git a/udev_utils_string.c b/udev_utils_string.c index b0641f002b..38b91aa0bd 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -58,11 +58,11 @@ size_t path_encode(char *s, size_t len) t[0] = '\0'; for (i = 0, j = 0; s[i] != '\0'; i++) { if (s[i] == '/') { - memcpy(&t[j], "%2f", 3); - j += 3; - } else if (s[i] == '%') { - memcpy(&t[j], "%25", 3); - j += 3; + memcpy(&t[j], "\\x2f", 4); + j += 4; + } else if (s[i] == '\\') { + memcpy(&t[j], "\\x5c", 4); + j += 4; } else { t[j] = s[i]; j++; @@ -78,12 +78,12 @@ size_t path_decode(char *s) size_t i, j; for (i = 0, j = 0; s[i] != '\0'; j++) { - if (memcmp(&s[i], "%2f", 3) == 0) { + if (memcmp(&s[i], "\\x2f", 4) == 0) { s[j] = '/'; - i += 3; - }else if (memcmp(&s[i], "%25", 3) == 0) { - s[j] = '%'; - i += 3; + i += 4; + }else if (memcmp(&s[i], "\\x5c", 4) == 0) { + s[j] = '\\'; + i += 4; } else { s[j] = s[i]; i++; @@ -233,6 +233,11 @@ int replace_untrusted_chars(char *str) i++; continue; } + /* hex encoding */ + if (str[i] == '\\' && str[i+1] == 'x') { + i += 2; + continue; + } /* valid utf8 is accepted */ len = utf8_encoded_valid_unichar(&str[i]); if (len > 1) { -- cgit v1.2.3-54-g00ecf From ca4f2c41b016530b5865b40b8dbbf0a3a0e8e634 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Wed, 16 May 2007 20:00:29 +0200 Subject: replace_untrusted_chars: replace all whitespace with space --- udev_utils_string.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/udev_utils_string.c b/udev_utils_string.c index 38b91aa0bd..6f51aef014 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -229,15 +229,17 @@ int replace_untrusted_chars(char *str) if ((str[i] >= '0' && str[i] <= '9') || (str[i] >= 'A' && str[i] <= 'Z') || (str[i] >= 'a' && str[i] <= 'z') || - strchr(" #$%+-./:=?@_,", str[i])) { + strchr("#$%+-./:=?@_,", str[i])) { i++; continue; } + /* hex encoding */ if (str[i] == '\\' && str[i+1] == 'x') { i += 2; continue; } + /* valid utf8 is accepted */ len = utf8_encoded_valid_unichar(&str[i]); if (len > 1) { @@ -245,6 +247,14 @@ int replace_untrusted_chars(char *str) continue; } + /* whitespace replaced with ordinary space */ + if (isspace(str[i])) { + str[i] = ' '; + i++; + replaced++; + continue; + } + /* everything else is garbage */ str[i] = '_'; i++; -- cgit v1.2.3-54-g00ecf From 8246d00d886fe0968bac065efbc455019483fe4e Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Wed, 16 May 2007 20:06:39 +0200 Subject: run_program: log "info" not "error" if program is missing --- udev_utils_run.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/udev_utils_run.c b/udev_utils_run.c index c9bbc97bad..8137ec1c66 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -158,9 +158,13 @@ int run_program(const char *command, const char *subsystem, close(errpipe[WRITE_END]); } execv(argv[0], argv); - - /* we should never reach this */ - err("exec of program '%s' failed", argv[0]); + if ((errno == ENOENT) || (errno = ENOTDIR)) { + /* may be on a filesytem which is not mounted right now */ + info("program '%s' not found", argv[0]); + } else { + /* other problems */ + err("exec of program '%s' failed", argv[0]); + } _exit(1); case -1: err("fork of '%s' failed: %s", argv[0], strerror(errno)); -- cgit v1.2.3-54-g00ecf From 51b5c5f889620632d39ea40a1f74c5ed2fdd6578 Mon Sep 17 00:00:00 2001 From: Fabio Massimo Di Nitto Date: Wed, 16 May 2007 20:15:21 +0200 Subject: rules: ignore partitons that span the entire disk --- etc/udev/rules.d/60-persistent-storage.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 2af837dc40..a14025999f 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -21,6 +21,9 @@ KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" +# ignore partitions that span the entire disk +ATTR{whole_disk}=="", GOTO="persistent_storage_end" + # for partitions import parent information KERNEL=="*[0-9]", IMPORT{parent}="ID_*" -- cgit v1.2.3-54-g00ecf From c2666405031cfda5720ddb9ecd88c1b476babc2a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 May 2007 02:17:13 +0200 Subject: udevsettle: use long options --- udevsettle.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/udevsettle.c b/udevsettle.c index f76ad7160d..42a03bafe3 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -60,33 +61,37 @@ int main(int argc, char *argv[], char *envp[]) ssize_t len; int timeout = DEFAULT_TIMEOUT; int loop; - int i; + static const struct option options[] = { + { "timeout", 1, NULL, 't' }, + { "help", 0, NULL, 'h' }, + {} + }; + int option; int rc = 1; + int seconds; logging_init("udevsettle"); udev_config_init(); dbg("version %s", UDEV_VERSION); sysfs_init(); - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; + while (1) { + option = getopt_long(argc, argv, "t:h", options, NULL); + if (option == -1) + break; - if (strncmp(arg, "--timeout=", 10) == 0) { - char *str = &arg[10]; - int seconds; - - seconds = atoi(str); + switch (option) { + case 't': + seconds = atoi(optarg); if (seconds > 0) timeout = seconds; else fprintf(stderr, "invalid timeout value\n"); dbg("timeout=%i", timeout); - } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { - printf("Usage: udevsettle [--help] [--timeout=]\n"); + break; + case 'h': + printf("Usage: udevsettle [--help] [--timeout=]\n\n"); goto exit; - } else { - fprintf(stderr, "unrecognized option '%s'\n", arg); - err("unrecognized option '%s'\n", arg); } } -- cgit v1.2.3-54-g00ecf From 2f2c4fa442f33d7eaee02eda016d6149b9aa0be6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 May 2007 20:01:54 +0200 Subject: replace_chars: replace spaces in node name --- extras/volume_id/vol_id.c | 4 ++-- udev.h | 6 +++++- udev_rules.c | 21 ++++++++++----------- udev_utils_string.c | 25 +++++++++++++++---------- udevinfo.c | 2 +- 5 files changed, 33 insertions(+), 25 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index cb1d455891..53b4cfff0b 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -274,9 +274,9 @@ int main(int argc, char *argv[]) } set_str(label_safe, label, sizeof(label_safe)); - replace_untrusted_chars(label_safe); + replace_chars(label_safe, ALLOWED_CHARS_INPUT); set_str(uuid_safe, uuid, sizeof(uuid_safe)); - replace_untrusted_chars(uuid_safe); + replace_chars(uuid_safe, ALLOWED_CHARS_INPUT); switch (print) { case PRINT_EXPORT: diff --git a/udev.h b/udev.h index bb018ba195..454ea4280b 100644 --- a/udev.h +++ b/udev.h @@ -34,6 +34,10 @@ #define NAME_SIZE 256 #define VALUE_SIZE 128 +#define ALLOWED_CHARS "#+-.:=@_%" +#define ALLOWED_CHARS_FILE ALLOWED_CHARS "/" +#define ALLOWED_CHARS_INPUT ALLOWED_CHARS " $/?," + #define DEFAULT_PARTITIONS_COUNT 15 #define UDEV_ALARM_TIMEOUT 180 @@ -149,7 +153,7 @@ extern void remove_trailing_chars(char *path, char c); extern size_t path_encode(char *s, size_t len); extern size_t path_decode(char *s); extern int utf8_encoded_valid_unichar(const char *str); -extern int replace_untrusted_chars(char *str); +extern int replace_chars(char *str, const char *white); /* udev_utils_file.c */ extern int create_path(const char *path); diff --git a/udev_rules.c b/udev_rules.c index edfe3fd94c..526993e21c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -491,15 +491,15 @@ found: if (value == NULL) break; - /* strip trailing whitespace and replace untrusted characters of sysfs value */ + /* strip trailing whitespace, and replace unwanted characters */ size = strlcpy(temp2, value, sizeof(temp2)); if (size >= sizeof(temp2)) size = sizeof(temp2)-1; while (size > 0 && isspace(temp2[size-1])) temp2[--size] = '\0'; - count = replace_untrusted_chars(temp2); + count = replace_chars(temp2, ALLOWED_CHARS_INPUT); if (count > 0) - info("%i untrusted character(s) replaced" , count); + info("%i character(s) replaced" , count); strlcat(string, temp2, maxsize); dbg("substitute sysfs value '%s'", temp2); } @@ -776,9 +776,9 @@ try_parent: dbg("PROGRAM matches"); remove_trailing_chars(result, '\n'); - count = replace_untrusted_chars(result); + count = replace_chars(result, ALLOWED_CHARS_INPUT); if (count) - info("%i untrusted character(s) replaced" , count); + info("%i character(s) replaced" , count); dbg("result is '%s'", result); strlcpy(udev->program_result, result, sizeof(udev->program_result)); dbg("PROGRAM returned successful"); @@ -959,14 +959,13 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) info("reset symlink list"); name_list_cleanup(&udev->symlink_list); } + /* allow multiple symlinks separated by spaces */ strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); udev_rules_apply_format(udev, temp, sizeof(temp)); - count = replace_untrusted_chars(temp); + count = replace_chars(temp, ALLOWED_CHARS_FILE " "); if (count) - info("%i untrusted character(s) replaced" , count); + info("%i character(s) replaced" , count); dbg("rule applied, added symlink(s) '%s'", temp); - - /* add multiple symlinks separated by spaces */ pos = temp; while (isspace(pos[0])) pos++; @@ -995,9 +994,9 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) name_set = 1; strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); udev_rules_apply_format(udev, udev->name, sizeof(udev->name)); - count = replace_untrusted_chars(udev->name); + count = replace_chars(udev->name, ALLOWED_CHARS_FILE); if (count) - info("%i untrusted character(s) replaced", count); + info("%i character(s) replaced", count); info("rule applied, '%s' becomes '%s'", udev->dev->kernel, udev->name); if (strcmp(udev->dev->subsystem, "net") != 0) diff --git a/udev_utils_string.c b/udev_utils_string.c index 6f51aef014..e3dc137e63 100644 --- a/udev_utils_string.c +++ b/udev_utils_string.c @@ -216,8 +216,8 @@ int utf8_encoded_valid_unichar(const char *str) return len; } -/* replace everything but whitelisted plain ascii and valid utf8 */ -int replace_untrusted_chars(char *str) +/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ +int replace_chars(char *str, const char *white) { size_t i = 0; int replaced = 0; @@ -225,37 +225,42 @@ int replace_untrusted_chars(char *str) while (str[i] != '\0') { int len; - /* valid printable ascii char */ + /* accept whitelist */ + if (white != NULL && strchr(white, str[i]) != NULL) { + i++; + continue; + } + + /* accept plain ascii char */ if ((str[i] >= '0' && str[i] <= '9') || (str[i] >= 'A' && str[i] <= 'Z') || - (str[i] >= 'a' && str[i] <= 'z') || - strchr("#$%+-./:=?@_,", str[i])) { + (str[i] >= 'a' && str[i] <= 'z')) { i++; continue; } - /* hex encoding */ + /* accept hex encoding */ if (str[i] == '\\' && str[i+1] == 'x') { i += 2; continue; } - /* valid utf8 is accepted */ + /* accept valid utf8 */ len = utf8_encoded_valid_unichar(&str[i]); if (len > 1) { i += len; continue; } - /* whitespace replaced with ordinary space */ - if (isspace(str[i])) { + /* if space is allowed, replace whitespace with ordinary space */ + if (isspace(str[i]) && strchr(white, ' ') != NULL) { str[i] = ' '; i++; replaced++; continue; } - /* everything else is garbage */ + /* everything else is replaced with '_' */ str[i] = '_'; i++; replaced++; diff --git a/udevinfo.c b/udevinfo.c index f36f240f0a..cda229244d 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -93,7 +93,7 @@ static void print_all_attributes(const char *devpath, const char *key) continue; } - replace_untrusted_chars(value); + replace_chars(value, ALLOWED_CHARS_INPUT); printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); } } -- cgit v1.2.3-54-g00ecf From b10941c08db89f52038e19ee8a29f26d7808a448 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 May 2007 20:09:24 +0200 Subject: volume_id: add and export string encoding function Needed for mount(8) to lookup LABEL=* in /dev/disk/by-label/*. Characters not suited for a filename will be escaped and the encoded LABEL=* string is able to find the corresponding symlink. --- extras/volume_id/lib/Makefile | 4 +- extras/volume_id/lib/exported_symbols | 1 + extras/volume_id/lib/libvolume_id.h | 1 + extras/volume_id/lib/util.c | 123 ++++++++++++++++++++++++++++++++++ extras/volume_id/lib/util.h | 3 + extras/volume_id/lib/volume_id.c | 54 +++++++++++++++ 6 files changed, 184 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 17992ba02e..328758d039 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 77 +SHLIB_REV = 78 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) @@ -81,7 +81,7 @@ libvolume_id.a: $(HEADERS) $(OBJS) $(E) " RANLIB " $@ $(Q) $(RANLIB) $@ -$(SHLIB): $(HEADERS) $(addprefix .shlib/,$(OBJS)) +$(SHLIB): $(HEADERS) exported_symbols $(addprefix .shlib/,$(OBJS)) $(E) " CC " $@ $(Q) $(CC) -shared $(CFLAGS) -o $@ \ -Wl,-soname,libvolume_id.so.$(SHLIB_CUR),--version-script,exported_symbols \ diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index 3422152edb..05b6e52bc4 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -16,6 +16,7 @@ volume_id_probe_raid; volume_id_all_probers; volume_id_get_prober_by_type; + volume_id_encode_string; volume_id_open_node; diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index c0ab29e0f7..19aee68d01 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -40,6 +40,7 @@ extern int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, si extern int volume_id_get_usage(struct volume_id *id, const char **usage); extern int volume_id_get_type(struct volume_id *id, const char **type); extern int volume_id_get_type_version(struct volume_id *id, const char **type_version); +extern int volume_id_encode_string(const char *str, char *str_enc, size_t len); /* * Note: everything below will be made private or removed from diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 54d9fd0d80..eaaececadb 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -28,6 +28,129 @@ #include "libvolume_id.h" #include "util.h" +/* count of characters used to encode one unicode char */ +static int utf8_encoded_expected_len(const char *str) +{ + unsigned char c = (unsigned char)str[0]; + + if (c < 0x80) + return 1; + if ((c & 0xe0) == 0xc0) + return 2; + if ((c & 0xf0) == 0xe0) + return 3; + if ((c & 0xf8) == 0xf0) + return 4; + if ((c & 0xfc) == 0xf8) + return 5; + if ((c & 0xfe) == 0xfc) + return 6; + return 0; +} + +/* decode one unicode char */ +static int utf8_encoded_to_unichar(const char *str) +{ + int unichar; + int len; + int i; + + len = utf8_encoded_expected_len(str); + switch (len) { + case 1: + return (int)str[0]; + case 2: + unichar = str[0] & 0x1f; + break; + case 3: + unichar = (int)str[0] & 0x0f; + break; + case 4: + unichar = (int)str[0] & 0x07; + break; + case 5: + unichar = (int)str[0] & 0x03; + break; + case 6: + unichar = (int)str[0] & 0x01; + break; + default: + return -1; + } + + for (i = 1; i < len; i++) { + if (((int)str[i] & 0xc0) != 0x80) + return -1; + unichar <<= 6; + unichar |= (int)str[i] & 0x3f; + } + + return unichar; +} + +/* expected size used to encode one unicode char */ +static int utf8_unichar_to_encoded_len(int unichar) +{ + if (unichar < 0x80) + return 1; + if (unichar < 0x800) + return 2; + if (unichar < 0x10000) + return 3; + if (unichar < 0x200000) + return 4; + if (unichar < 0x4000000) + return 5; + return 6; +} + +/* check if unicode char has a valid numeric range */ +static int utf8_unichar_valid_range(int unichar) +{ + if (unichar > 0x10ffff) + return 0; + if ((unichar & 0xfffff800) == 0xd800) + return 0; + if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) + return 0; + if ((unichar & 0xffff) == 0xffff) + return 0; + return 1; +} + +/* validate one encoded unicode char and return its length */ +int volume_id_utf8_encoded_valid_unichar(const char *str) +{ + int len; + int unichar; + int i; + + len = utf8_encoded_expected_len(str); + if (len == 0) + return -1; + + /* ascii is valid */ + if (len == 1) + return 1; + + /* check if expected encoded chars are available */ + for (i = 0; i < len; i++) + if ((str[i] & 0x80) != 0x80) + return -1; + + unichar = utf8_encoded_to_unichar(str); + + /* check if encoded length matches encoded value */ + if (utf8_unichar_to_encoded_len(unichar) != len) + return -1; + + /* check if value has valid range */ + if (!utf8_unichar_valid_range(unichar)) + return -1; + + return len; +} + void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) { unsigned int i, j; diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index 1206116ce2..6ed7b48b50 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -23,6 +23,8 @@ #include #include +#define ALLOWED_CHARS "#+-.:=@_%" + #ifndef PACKED #define PACKED __attribute__((packed)) #endif @@ -77,6 +79,7 @@ enum endian { BE = 1 }; +extern int volume_id_utf8_encoded_valid_unichar(const char *str); extern void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 15e9cda4da..59303d5bff 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -276,6 +276,60 @@ int volume_id_get_type_version(struct volume_id *id, const char **type_version) return 1; } +static int needs_encoding(const char c) +{ + if ((c >= '0' && c <= '9') || + (c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') || + strchr(ALLOWED_CHARS, c)) + return 0; + return 1; +} + +/** + * volume_id_encode_string: + * @str: Input string to be encoded. + * @str_enc: Target string to store the encoded input. + * @len: Location to store the encoded string. The target string, + * which may be four times as long as the input string. + * + * Encode all potentially unsafe characters of a string to the + * corresponding hex value prefixed by '\x'. + * + * Returns: 1 if the entire string was copied, 0 otherwise. + **/ +int volume_id_encode_string(const char *str, char *str_enc, size_t len) +{ + size_t i, j; + + if (str == NULL || str_enc == NULL || len == 0) + return 0; + + str_enc[0] = '\0'; + for (i = 0, j = 0; str[i] != '\0'; i++) { + int seqlen; + + seqlen = volume_id_utf8_encoded_valid_unichar(&str[i]); + if (seqlen > 1) { + memcpy(&str_enc[j], &str[i], seqlen); + j += seqlen; + i += (seqlen-1); + } else if (str[i] == '\\' || needs_encoding(str[i])) { + sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); + j += 4; + } else { + str_enc[j] = str[i]; + j++; + } + if (j+3 >= len) + goto err; + } + str_enc[j] = '\0'; + return 1; +err: + return 0; +} + /** * volume_id_probe_raid: * @id: Probing context. -- cgit v1.2.3-54-g00ecf From d727cb90753179dd0a26911f679c668216a026ed Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 May 2007 20:10:09 +0200 Subject: vol_id: export encoded strings --- extras/volume_id/vol_id.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 53b4cfff0b..e17e7abb0c 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -147,8 +147,9 @@ int main(int argc, char *argv[]) } print = PRINT_EXPORT; struct volume_id *vid = NULL; - char label_safe[128]; - char uuid_safe[128]; + char label_safe[256]; + char label_enc[256]; + char uuid_enc[256]; uint64_t size; int skip_raid = 0; int probe_all = 0; @@ -275,8 +276,9 @@ int main(int argc, char *argv[]) set_str(label_safe, label, sizeof(label_safe)); replace_chars(label_safe, ALLOWED_CHARS_INPUT); - set_str(uuid_safe, uuid, sizeof(uuid_safe)); - replace_chars(uuid_safe, ALLOWED_CHARS_INPUT); + + volume_id_encode_string(label, label_enc, sizeof(label_enc)); + volume_id_encode_string(uuid, uuid_enc, sizeof(uuid_enc)); switch (print) { case PRINT_EXPORT: @@ -284,8 +286,9 @@ int main(int argc, char *argv[]) printf("ID_FS_TYPE=%s\n", type); printf("ID_FS_VERSION=%s\n", type_version); printf("ID_FS_UUID=%s\n", uuid); - printf("ID_FS_UUID_SAFE=%s\n", uuid_safe); + printf("ID_FS_UUID_ENC=%s\n", uuid_enc); printf("ID_FS_LABEL=%s\n", label); + printf("ID_FS_LABEL_ENC=%s\n", label_enc); printf("ID_FS_LABEL_SAFE=%s\n", label_safe); break; case PRINT_TYPE: @@ -299,11 +302,11 @@ int main(int argc, char *argv[]) printf("%s\n", label_safe); break; case PRINT_UUID: - if (uuid_safe[0] == '\0' || strcmp(usage, "raid") == 0) { + if (uuid_enc[0] == '\0' || strcmp(usage, "raid") == 0) { rc = 4; goto exit; } - printf("%s\n", uuid_safe); + printf("%s\n", uuid_enc); break; case PRINT_LABEL_RAW: if (label[0] == '\0' || strcmp(usage, "raid") == 0) { -- cgit v1.2.3-54-g00ecf From 9e23328e5357589f7a2edfff933513aa72df112e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 May 2007 20:19:25 +0200 Subject: rules: use encoded strings instead of skipping characters This is needed for mount(8) and LABEL=* to find symlinks of label strings with special character in it. --- etc/udev/rules.d/60-persistent-storage.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index a14025999f..04c7e7740d 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -56,8 +56,8 @@ KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part% # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_SAFE}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_SAFE}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" # BIOS Enhanced Disk Device KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" -- cgit v1.2.3-54-g00ecf From 86fd6b4f61cefe402d81d61db7d8cb1f79d5ba71 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 May 2007 07:02:04 +0200 Subject: udevtest: print message before log output --- udevtest.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/udevtest.c b/udevtest.c index 9868c9bcd3..91749a4eef 100644 --- a/udevtest.c +++ b/udevtest.c @@ -149,6 +149,11 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + printf("This program is for debugging only, it does not run any program,\n" + "specified by a RUN key. It may show incorrect results, because\n" + "some values may be different, or not available at a simulation run.\n" + "\n"); + sysfs_init(); udev_rules_init(&rules, 0); @@ -184,11 +189,6 @@ int main(int argc, char *argv[], char *envp[]) setenv("ACTION", udev->action, 1); import_uevent_var(udev->dev->devpath); - printf("This program is for debugging only, it does not run any program,\n" - "specified by a RUN key. It may show incorrect results, because\n" - "some values may be different, or not available at a simulation run.\n" - "\n"); - info("looking at device '%s' from subsystem '%s'", udev->dev->devpath, udev->dev->subsystem); retval = udev_device_event(&rules, udev); if (retval == 0 && !udev->ignore_device && udev_run) { -- cgit v1.2.3-54-g00ecf From 8cc6c96f1b8f77defb953e0d75de790d9737f0c4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 May 2007 07:17:09 +0200 Subject: volume_id: escape % character --- extras/volume_id/lib/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index 6ed7b48b50..ed868001fa 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -23,7 +23,7 @@ #include #include -#define ALLOWED_CHARS "#+-.:=@_%" +#define ALLOWED_CHARS "#+-.:=@_" #ifndef PACKED #define PACKED __attribute__((packed)) -- cgit v1.2.3-54-g00ecf From c19870519d0a23bbf7f5cf206cefab6418a9f4be Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 May 2007 07:59:40 +0200 Subject: replace_chars: replace % character --- test/udev-test.pl | 22 +--------------------- udev.h | 4 ++-- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 36cbe8ac75..10d87ed54a 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -302,7 +302,7 @@ EOF devpath => "/block/sda", exp_name => "node12345678", rules => < "ttyUSB0", rules => < "symlink with '%' in name", - subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "percent%sign", - exp_target => "ttyUSB0", - rules => < "symlink with '%' in name", - subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "%ttyUSB0_name", - exp_target => "ttyUSB0", - rules => < Date: Mon, 21 May 2007 08:00:09 +0200 Subject: IMPORT: do not mangle whitespace --- udev_rules.c | 59 +++++++++++++++++------------------------------------------ 1 file changed, 17 insertions(+), 42 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 526993e21c..1139c99a7d 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -87,54 +87,29 @@ static int get_key(char **line, char **key, char **value) linepos++; /* get the key */ + temp = strchr(linepos, '='); + if (temp == NULL || temp == linepos) + return -1; + temp[0] = '\0'; *key = linepos; - while (1) { - linepos++; - if (linepos[0] == '\0') - return -1; - if (isspace(linepos[0])) - break; - if (linepos[0] == '=') - break; + linepos = &temp[1]; + + /* get a quoted value */ + if (linepos[0] == '"' || linepos[0] == '\'') { + temp = strchr(&linepos[1], linepos[0]); + if (temp != NULL) { + temp[0] = '\0'; + *value = &linepos[1]; + goto out; + } } - /* terminate key */ - linepos[0] = '\0'; - linepos++; - - /* skip whitespace */ - while (isspace(linepos[0])) - linepos++; - /* get the value*/ - if (linepos[0] == '"') { - linepos++; - temp = strchr(linepos, '"'); - if (!temp) { - dbg("missing closing quote"); - return -1; - } - dbg("value is quoted"); + temp = strchr(linepos, '\n'); + if (temp != NULL) temp[0] = '\0'; - } else if (linepos[0] == '\'') { - linepos++; - temp = strchr(linepos, '\''); - if (!temp) { - dbg("missing closing quote"); - return -1; - } - dbg("value is quoted"); - temp[0] = '\0'; - } else if (linepos[0] == '\0') { - dbg("value is empty"); - } else { - temp = linepos; - while (temp[0] && !isspace(temp[0])) - temp++; - temp[0] = '\0'; - } *value = linepos; - +out: return 0; } -- cgit v1.2.3-54-g00ecf From b8cf73a533d887daaadaa47e0ba07d603ce64e1f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 May 2007 08:00:45 +0200 Subject: scsi_id: do not install symlink in /sbin --- extras/scsi_id/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 32b2eaeecf..349eeef1de 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -59,12 +59,10 @@ clean: install-bin: all $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - ln -sf $(libudevdir)/$(PROG) $(DESTDIR)$(sbindir)/$(PROG) .PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(libudevdir)/$(PROG) - - rm -f $(DESTDIR)$(sbindir)/$(PROG) .PHONY: uninstall-bin install-man: -- cgit v1.2.3-54-g00ecf From 52e1af940af52a4f1c2f512eef82249aa081535e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 May 2007 08:01:19 +0200 Subject: rules: SUSE update --- etc/udev/suse/64-device-mapper.rules | 4 ++-- etc/udev/suse/64-md-raid.rules | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index 2c63b1fb70..567772ab7c 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -16,7 +16,7 @@ ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" IMPORT{program}="vol_id --export $tempnode" OPTIONS="link_priority=-100" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_SAFE}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_SAFE}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" LABEL="device_mapper_end" diff --git a/etc/udev/suse/64-md-raid.rules b/etc/udev/suse/64-md-raid.rules index 5da0bae35a..3011a903ec 100644 --- a/etc/udev/suse/64-md-raid.rules +++ b/etc/udev/suse/64-md-raid.rules @@ -12,7 +12,7 @@ ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" IMPORT{program}="vol_id --export $tempnode" OPTIONS="link_priority=100" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_SAFE}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_SAFE}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" LABEL="md_end" -- cgit v1.2.3-54-g00ecf From a3b836c6c22614d2aa746d89ddfaa6888e47691f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 May 2007 03:35:18 +0200 Subject: volume_id: terminate overlong label strings --- extras/volume_id/lib/iso9660.c | 2 +- extras/volume_id/lib/util.c | 19 +++++++++++++++---- extras/volume_id/lib/util.h | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c index 227641e42a..1d8bdff878 100644 --- a/extras/volume_id/lib/iso9660.c +++ b/extras/volume_id/lib/iso9660.c @@ -91,7 +91,7 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) memcmp(is->escape_sequences, "%/C", 3) == 0|| memcmp(is->escape_sequences, "%/E", 3) == 0) { dbg("Joliet extension found"); - volume_id_set_unicode16((char *)svd_label, sizeof(svd_label), is->volume_id, BE, 32); + volume_id_set_unicode16(svd_label, sizeof(svd_label), is->volume_id, BE, 32); if (memcmp(id->label, svd_label, 16) == 0) { dbg("SVD label is identical, use the possibly longer PVD one"); break; diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index eaaececadb..395e81bbf3 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -151,9 +151,9 @@ int volume_id_utf8_encoded_valid_unichar(const char *str) return len; } -void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) +size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) { - unsigned int i, j; + size_t i, j; uint16_t c; j = 0; @@ -183,6 +183,7 @@ void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum end } } str[j] = '\0'; + return j; } static char *usage_to_string(enum volume_id_usage usage_id) @@ -214,15 +215,22 @@ void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count) { + if (count > sizeof(id->label)) + count = sizeof(id->label); + memcpy(id->label_raw, buf, count); id->label_raw_len = count; } void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) { - unsigned int i; + size_t i; + + if (count >= sizeof(id->label)) + count = sizeof(id->label)-1; memcpy(id->label, buf, count); + id->label[count] = '\0'; /* remove trailing whitespace */ i = strnlen(id->label, count); @@ -235,7 +243,10 @@ void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count) { - volume_id_set_unicode16(id->label, sizeof(id->label), buf, endianess, count); + if (count >= sizeof(id->label)) + count = sizeof(id->label)-1; + + volume_id_set_unicode16((uint8_t *)id->label, sizeof(id->label), buf, endianess, count); } void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format) diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index ed868001fa..14a76c8fd2 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -80,7 +80,7 @@ enum endian { }; extern int volume_id_utf8_encoded_valid_unichar(const char *str); -extern void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); +extern size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); -- cgit v1.2.3-54-g00ecf From 335b8aace33a2018c947381d32c33bcebe6cbe37 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Fri, 25 May 2007 03:36:59 +0200 Subject: volume_id: support for long-filename based labels --- extras/volume_id/lib/fat.c | 142 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 127 insertions(+), 15 deletions(-) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 6ed16ccee0..54e6bab7d2 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -1,7 +1,8 @@ /* * volume_id - reads filesystem label and uuid * - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004-2007 Kay Sievers + * Copyright (C) 2007 Ryan Lortie * * 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 @@ -34,6 +35,13 @@ #define FAT_ATTR_MASK 0x3f #define FAT_ENTRY_FREE 0xe5 +#define VFAT_LFN_SEQ_MASK 0x3f +#define VFAT_LFN_SEQ_LAST 0x40 +#define VFAT_LFN_SEQ_MAX 20 +#define VFAT_LFN_CHARS_PER_ENTRY (5 + 6 + 2) +#define VFAT_LOWERCASE_NAME 0x10 +#define VFAT_LOWERCASE_EXT 0x08 + struct vfat_super_block { uint8_t boot_jump[3]; uint8_t sysid[8]; @@ -88,9 +96,10 @@ struct fat32_fsinfo { struct vfat_dir_entry { uint8_t name[11]; uint8_t attr; + uint8_t lowercase; + uint8_t fine_time_creat; uint16_t time_creat; uint16_t date_creat; - uint16_t time_acc; uint16_t date_acc; uint16_t cluster_high; uint16_t time_write; @@ -99,7 +108,109 @@ struct vfat_dir_entry { uint32_t size; } PACKED; -static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int count) + +struct vfat_lfn_entry { + uint8_t seq; + uint16_t name0[5]; + uint8_t attr; + uint8_t reserved; + uint8_t cksum; + uint16_t name1[6]; + uint16_t cluster; + uint16_t name2[2]; +} PACKED; + +static uint8_t fat_lfn_checksum(const uint8_t name[11]) +{ + uint8_t cksum = 0; + int i; + + /* http://en.wikipedia.org/wiki/File_Allocation_Table */ + for (i = 0; i < 11; i++) + cksum = ((cksum & 1) ? 0x80 : 0) + (cksum >> 1) + name[i]; + + return cksum; +} + +static size_t fat_read_lfn(uint8_t *filename, size_t fnsize, + struct vfat_dir_entry *dir, + struct vfat_dir_entry *entry) +{ + uint8_t buffer[VFAT_LFN_SEQ_MAX * VFAT_LFN_CHARS_PER_ENTRY * 2]; + uint8_t expected_seq = 1; + uint8_t cksum; + size_t len = 0; + size_t fnlen = 0; + + cksum = fat_lfn_checksum(entry->name); + + while (--entry >= dir) { + struct vfat_lfn_entry *lfn = (struct vfat_lfn_entry *) entry; + + if (expected_seq > VFAT_LFN_SEQ_MAX) + break; + + if ((lfn->attr & FAT_ATTR_MASK) != FAT_ATTR_LONG_NAME) + break; + + if (lfn->cksum != cksum) + break; + + if ((lfn->seq & VFAT_LFN_SEQ_MASK) != expected_seq++) + break; + + if (lfn->cluster != 0) + break; + + /* extra paranoia -- should never happen */ + if (len + sizeof(lfn->name0) + sizeof(lfn->name1) + + sizeof(lfn->name2) > sizeof(buffer)) + break; + + memcpy (&buffer[len], lfn->name0, sizeof(lfn->name0)); + len += sizeof(lfn->name0); + memcpy (&buffer[len], lfn->name1, sizeof(lfn->name1)); + len += sizeof(lfn->name1); + memcpy (&buffer[len], lfn->name2, sizeof(lfn->name2)); + len += sizeof(lfn->name2); + + if (lfn->seq & VFAT_LFN_SEQ_LAST) { + fnlen = volume_id_set_unicode16(filename, fnsize, buffer, LE, len); + break; + } + } + + return fnlen; +} + +static size_t fat_read_filename(uint8_t *filename, size_t fnsize, + struct vfat_dir_entry *dir, struct vfat_dir_entry *entry) +{ + size_t len; + int i; + + /* check if maybe we have LFN entries */ + len = fat_read_lfn(filename, fnsize, dir, entry); + if (len > 0) + goto out; + + /* else, read the normal 8.3 name */ + for (i = 0; i < 11; i++) { + if (entry->lowercase & ((i < 8) ? VFAT_LOWERCASE_NAME : VFAT_LOWERCASE_EXT)) + filename[i] = tolower(entry->name[i]); + else + filename[i] = entry->name[i]; + } + len = 11; + +out: + filename[len] = '\0'; + return len; +} + +/* fills filename, returns string length */ +static size_t get_fat_attr_volume_id(uint8_t *filename, size_t fnsize, + struct vfat_dir_entry *dir, unsigned int count) { unsigned int i; @@ -124,17 +235,18 @@ static uint8_t *get_attr_volume_id(struct vfat_dir_entry *dir, unsigned int coun continue; dbg("found ATTR_VOLUME_ID id in root dir"); - return dir[i].name; + return fat_read_filename(filename, fnsize, dir, &dir[i]); } dbg("skip dir entry"); } - return NULL; + return 0; } int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) { + uint8_t filename[255 * 3]; struct vfat_super_block *vs; struct vfat_dir_entry *dir; struct fat32_fsinfo *fsinfo; @@ -154,9 +266,9 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) uint16_t fsinfo_sect; uint8_t *buf; uint32_t buf_size; - uint8_t *label = NULL; uint32_t next; int maxloop; + size_t fnlen; info("probing at offset 0x%llx", (unsigned long long) off); @@ -275,15 +387,15 @@ magic: dir = (struct vfat_dir_entry*) buf; - label = get_attr_volume_id(dir, root_dir_entries); + fnlen = get_fat_attr_volume_id(filename, sizeof(filename), dir, root_dir_entries); vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); if (vs == NULL) return -1; - if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, label, 11); - volume_id_set_label_string(id, label, 11); + if (fnlen > 0 && memcmp(filename, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, filename, fnlen); + volume_id_set_label_string(id, filename, fnlen); } else if (memcmp(vs->type.fat.label, "NO NAME ", 11) != 0) { volume_id_set_label_raw(id, vs->type.fat.label, 11); volume_id_set_label_string(id, vs->type.fat.label, 11); @@ -337,8 +449,8 @@ fat32: count = buf_size / sizeof(struct vfat_dir_entry); dbg("expected entries 0x%x", count); - label = get_attr_volume_id(dir, count); - if (label) + fnlen = get_fat_attr_volume_id(filename, sizeof(filename), dir, count); + if (fnlen > 0) break; /* get FAT entry */ @@ -359,9 +471,9 @@ fat32: if (vs == NULL) return -1; - if (label != NULL && memcmp(label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, label, 11); - volume_id_set_label_string(id, label, 11); + if (fnlen > 0 && memcmp(filename, "NO NAME ", 11) != 0) { + volume_id_set_label_raw(id, filename, fnlen); + volume_id_set_label_string(id, filename, fnlen); } else if (memcmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { volume_id_set_label_raw(id, vs->type.fat32.label, 11); volume_id_set_label_string(id, vs->type.fat32.label, 11); -- cgit v1.2.3-54-g00ecf From 87cf9f5aacf65d0bc186e5e525026cc760290379 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Fri, 25 May 2007 14:48:08 +0200 Subject: cciss device support --- etc/udev/rules.d/60-persistent-storage.rules | 9 ++- extras/path_id/path_id | 11 +++ extras/scsi_id/scsi_id.c | 116 ++++++++++++++++++--------- extras/scsi_id/scsi_id.h | 2 + extras/scsi_id/scsi_serial.c | 31 +++++++ 5 files changed, 127 insertions(+), 42 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 04c7e7740d..8de3e63410 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -36,8 +36,9 @@ KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{iee KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -n -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # libata compat (links like hd*) KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", ENV{ID_ATA_COMPAT}="$result" @@ -48,10 +49,10 @@ KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[!0-9]|sr*|cciss?c[0-9]d[0-9]", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[0-9]|cciss*p[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" KERNEL=="sr*|st*", GOTO="persistent_storage_end" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" # by-label/by-uuid (filesystem properties) KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" diff --git a/extras/path_id/path_id b/extras/path_id/path_id index a7d650bf42..ee26dc1f8a 100644 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -74,6 +74,17 @@ handle_pci () { DEV=${PWD} pci_id=${DEV##*/} host_dev_path=$DEV + + # cciss devices don't have a separate sysfs node + for blk_link in block*; do + if [ -L "$blk_link" ]; then + case "$blk_link" in + *cciss*) + d=cciss-${blk_link#*cciss\!} + ;; + esac + fi + done while [ ! -z "$host_dev_path" ] ; do case "$host_dev_path" in */pci[0-9]*) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index c00145f30e..79a8d7e51b 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -34,7 +34,7 @@ #define TMP_DIR "/dev" #define TMP_PREFIX "tmp-scsi" -static const char short_options[] = "abd:f:gip:s:uvVx"; +static const char short_options[] = "abd:f:ginp:s:uvVx"; static const char dev_short_options[] = "bgp:"; static int all_good; @@ -48,6 +48,7 @@ static int use_stderr; static int debug; static int hotplug_mode; static int reformat_serial; +static int ignore_sysfs; static int export; static char vendor_str[64]; static char model_str[64]; @@ -459,6 +460,10 @@ static int set_options(int argc, char **argv, const char *short_opts, } break; + case 'n': + ignore_sysfs = 1; + break; + case 's': sys_specified = 1; strncpy(target, optarg, MAX_PATH_LEN); @@ -495,41 +500,12 @@ static int per_dev_options(struct sysfs_device *dev_scsi, int *good_bad, int *pa int retval; int newargc; char **newargv = NULL; - const char *vendor, *model, *type; int option; *good_bad = all_good; *page_code = default_page_code; - vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); - if (!vendor) { - info("%s: cannot get vendor attribute", dev_scsi->devpath); - return -1; - } - set_str(vendor_str, vendor, sizeof(vendor_str)-1); - - model = sysfs_attr_get_value(dev_scsi->devpath, "model"); - if (!model) { - info("%s: cannot get model attribute\n", dev_scsi->devpath); - return -1; - } - set_str(model_str, model, sizeof(model_str)-1); - - type = sysfs_attr_get_value(dev_scsi->devpath, "type"); - if (!type) { - info("%s: cannot get type attribute", dev_scsi->devpath); - return -1; - } - set_type(type_str, type, sizeof(type_str)); - - type = sysfs_attr_get_value(dev_scsi->devpath, "rev"); - if (!type) { - info("%s: cannot get type attribute\n", dev_scsi->devpath); - return -1; - } - set_str(revision_str, type, sizeof(revision_str)-1); - - retval = get_file_options(vendor, model, &newargc, &newargv); + retval = get_file_options(vendor_str, model_str, &newargc, &newargv); optind = 1; /* reset this global extern */ while (retval == 0) { @@ -578,6 +554,58 @@ static int per_dev_options(struct sysfs_device *dev_scsi, int *good_bad, int *pa return retval; } +static int set_sysfs_values(struct sysfs_device *dev_scsi) +{ + const char *vendor, *model, *type; + + vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); + if (!vendor) { + info("%s: cannot get vendor attribute", dev_scsi->devpath); + return -1; + } + set_str(vendor_str, vendor, sizeof(vendor_str)-1); + + model = sysfs_attr_get_value(dev_scsi->devpath, "model"); + if (!model) { + info("%s: cannot get model attribute\n", dev_scsi->devpath); + return -1; + } + set_str(model_str, model, sizeof(model_str)-1); + + type = sysfs_attr_get_value(dev_scsi->devpath, "type"); + if (!type) { + info("%s: cannot get type attribute", dev_scsi->devpath); + return -1; + } + set_type(type_str, type, sizeof(type_str)); + + type = sysfs_attr_get_value(dev_scsi->devpath, "rev"); + if (!type) { + info("%s: cannot get type attribute\n", dev_scsi->devpath); + return -1; + } + set_str(revision_str, type, sizeof(revision_str)-1); + + return 0; +} + +static int set_inq_values(struct sysfs_device *dev_scsi, const char *path) +{ + int retval; + char vendor[8], model[16], type[4], rev[4]; + + retval = scsi_std_inquiry(dev_scsi, path, vendor, model, rev, type); + if (retval) + return retval; + + set_str(vendor_str, vendor, 8); + set_str(model_str, model, 16); + set_type(type_str, type, sizeof(type_str) - 1); + set_str(revision_str, rev, sizeof(revision_str) -1); + + return 0; +} + /* * format_serial: replace to whitespaces by underscores for calling * programs that use the serial for device naming (multipath, Suse @@ -615,11 +643,12 @@ static int scsi_id(const char *devpath, char *maj_min_dev) int retval; int dev_type = 0; struct sysfs_device *dev; - struct sysfs_device *dev_scsi; + struct sysfs_device *dev_scsi = NULL; int good_dev; int page_code; char serial[MAX_SERIAL_LEN]; char serial_short[MAX_SERIAL_LEN]; + char bus_str[8]; dbg("devpath %s\n", devpath); @@ -634,11 +663,13 @@ static int scsi_id(const char *devpath, char *maj_min_dev) else dev_type = S_IFCHR; - /* get scsi parent device */ - dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); - if (dev_scsi == NULL) { - err("unable to access parent device of '%s'", devpath); - return 1; + if (!ignore_sysfs) { + /* get scsi parent device */ + dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); + if (dev_scsi == NULL) { + err("unable to access parent device of '%s'", devpath); + return 1; + } } /* mknod a temp dev to communicate with the device */ @@ -647,6 +678,15 @@ static int scsi_id(const char *devpath, char *maj_min_dev) return 1; } + if (!ignore_sysfs) { + set_sysfs_values(dev_scsi); + strcpy(bus_str,"scsi"); + } else { + dev_scsi = dev; + set_inq_values(dev_scsi, maj_min_dev); + strcpy(bus_str,"cciss"); + } + /* get per device (vendor + model) options from the config file */ retval = per_dev_options(dev_scsi, &good_dev, &page_code); dbg("per dev options: good %d; page code 0x%x", good_dev, page_code); @@ -671,7 +711,7 @@ static int scsi_id(const char *devpath, char *maj_min_dev) set_str(serial_str, serial_short, sizeof(serial_str)); printf("ID_SERIAL_SHORT=%s\n", serial_str); printf("ID_TYPE=%s\n", type_str); - printf("ID_BUS=scsi\n"); + printf("ID_BUS=%s\n", bus_str); } else { if (reformat_serial) format_serial(serial); diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index d7f675fa0b..0e2b297d28 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -30,6 +30,8 @@ */ #define MAX_BUFFER_LEN 256 +extern int scsi_std_inquiry(struct sysfs_device *dev_scsi, const char *devname, + char *vendor, char *model, char *rev, char *type); extern int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, int page_code, char *serial, char *serial_short, int len); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index e1726bbd70..c84f41e043 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -736,6 +736,37 @@ static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, return 0; } +int scsi_std_inquiry(struct sysfs_device *dev_scsi, const char *devname, + char *vendor, char *model, char *rev, char *type) +{ + int retval; + int fd; + unsigned char buf[SCSI_INQ_BUFF_LEN]; + + dbg("opening %s\n", devname); + fd = open(devname, O_RDONLY | O_NONBLOCK); + if (fd < 0) { + info("%s: cannot open %s: %s", + dev_scsi->kernel, devname, strerror(errno)); + return 1; + } + + memset(buf, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); + if (retval < 0) + return retval; + + memcpy(vendor, buf + 8, 8); + memcpy(model, buf + 16, 16); + memcpy(rev, buf + 32, 4); + sprintf(type,"%x", buf[0] & 0x1f); + + if (close(fd) < 0) + info("%s: close failed: %s", dev_scsi->kernel, strerror(errno)); + + return 0; +} + int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, int page_code, char *serial, char *serial_short, int len) { -- cgit v1.2.3-54-g00ecf From 9eaa50d0e7d7ec15f89ecd667ddbb2935cf78593 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 May 2007 17:37:47 +0200 Subject: scsi_id: add long options --- extras/scsi_id/scsi_id.8 | 77 +++++++++++++++--------------------------------- extras/scsi_id/scsi_id.c | 71 ++++++++++++++++++++++++++++++++------------ 2 files changed, 75 insertions(+), 73 deletions(-) diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index ba7e42f8c7..927549bf60 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -17,7 +17,7 @@ with a non\-zero value. \fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP that require a unique SCSI identifier. -By default all devices are assume black listed, the \fB\-g\fP option must +By default all devices are assume black listed, the \fB\-\-whitelisted\fP option must be specified on the command line or in the config file for any useful behaviour. @@ -33,7 +33,7 @@ by page 0x80. For example: .sp .nf -# scsi_id -p 0x80 -s /block/sdg +# scsi_id --page=0x80 --devpath=/block/sdg SIBM 3542 1T05078453 .fi .P @@ -45,28 +45,26 @@ identifier starts with the NAA value of 6): .sp .nf -# /sbin/scsi_id -p 0x83 -s /block/sdg +# /sbin/scsi_id --page=0x83 --devpath=/block/sdg 3600a0b80000b174b000000d63efc5c8c .fi .P .SH OPTIONS .TP -.BI subsystem -Deprecated method: when called with only a single argument without a -leading \-, runs in a hotplug mode, and expects the environment variable -DEVPATH to specify the corresponding sysfs device. See section below on -usage with \fBudev\fP. -.TP -.BI \-a +.BI \-\-fallback-to-sysfs Always print information (model, vendor strings) about the device even if it does not support VPD pages. .TP -.BI \-b +.BI \-\-ignore-sysfs +Ignore sysfs entries. Used for devices which are not represented as SCSI +devices, but understand SG_IO commands. +.TP +.BI \-\-blacklisted The default behaviour \- treat the device as black listed, and do nothing unless a white listed device is found in the scsi_id config\-file. .TP -.BI \-d "\| device\^" +.BI \-\-device=\| device\^ Instead of determining and creating a device node based on a sysfs dev entry as done for the \fB\-s\fP, send SG_IO commands to @@ -74,24 +72,24 @@ entry as done for the \fB\-s\fP, send SG_IO commands to This argument should also be used when invoked via udev to avoid problems with creation of temporary files on not-yet writable directories. .TP -.BI \-f "\| config\-file" +.BI \-\-config=\| config\-file Read configuration and black/white list entries from .B config\-file rather than the default .B /etc/scsi_id.config file. .TP -.BI \-g -Treat the device as white listed. The \fB\-g\fP option must be specified +.BI \-\-whitelisted +Treat the device as white listed. The \fB\-\-whitelisted\fP option must be specified on the command line or in the scsi_id configuration file for .B scsi_id to generate any output. .TP -.BI \-i +.BI \-\-prefix-bus-id Prefix the identification string with the driver model (sysfs) bus id of the SCSI device. .TP -.BI \-p "\| 0x80 | 0x83 | pre-spc3-83" +.BI \-\-page=\| 0x80 | 0x83 | pre-spc3-83 Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83. .sp The default @@ -104,58 +102,29 @@ option is used for older model 4, 5, and 6 EMC Symmetrix devices, its use with SPC-2 or SPC-3 compliant devices will fallback to the page 83 format supported by these devices. .TP -.BI \-s "\| sysfs\-device" +.BI \-\-devpath=\| sysfs\-devpath Generate an id for the -.B sysfs\-device. -The sysfs mount point must not be included. For example, use /block/sd, -not /sys/block/sd. +.B sysfs\-devpath. +The sysfs mount point must not be included. .TP -.BI \-u +.BI \-\-replace-whitespace Reformat the output : replace all whitespaces by underscores. .TP -.BI \-x +.BI \-\-export Export all data in KEY= format used to import in other programs. .TP -.BI \-v +.BI \-\-verbose Generate verbose debugging output. .TP -.BI \-V +.BI \-\-version Display version number and exit. .RE -.SH USAGE WITH UDEV - -If \fBscsi_id\fP is invoked with one argument without a leading \-, it -assumes it is called for a hotplug event, and looks for the sysfs device -in the DEVPATH environment variable. This mode is deprecated, but -available for backwards compatibility. +.SH ENVIRONMENT If the DEVPATH environment variable is set, scsi_id assumes it has been invoked via udev (or some other hotplug program), and all errors or warnings are sent using syslog. - -To determine the specific value needed in a RESULT key, use the \-s option, -for example: - -.sp -.nf -/sbin/scsi_id -s /block/sda -.fi -.P - -\fBscsi_id\fP is one of the tools used in the "Linux Persistent Device Names" -scheme that creates persistent device links in /dev/disk. It is called with -the -x option which will print all values in a defined format to let udev -import it into its own environment for later event processing. -.sp -An example custom \fBudev\fP rule using \fBscsi_id\fP, that will name a block -device and any partitions for the device matching the \fBscsi_id\fP output -of 312345: - -.sp -.nf -SUBSYSTEMS=="scsi", PROGRAM=="/sbin/scsi_id -d %N -s %p", RESULT=="312345", NAME="disk%n" -.fi .P .SH "FILES" diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 79a8d7e51b..e9818a635a 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "../../udev.h" @@ -34,7 +35,25 @@ #define TMP_DIR "/dev" #define TMP_PREFIX "tmp-scsi" -static const char short_options[] = "abd:f:ginp:s:uvVx"; +static const struct option options[] = { + { "device", 1, NULL, 'd' }, + { "config", 1, NULL, 'f' }, + { "page", 1, NULL, 'p' }, + { "devpath", 1, NULL, 's' }, + { "fallback-to-sysfs", 0, NULL, 'a' }, + { "blacklisted", 0, NULL, 'b' }, + { "whitelisted", 0, NULL, 'g' }, + { "prefix-bus-id", 0, NULL, 'i' }, + { "replace-whitespace", 0, NULL, 'u' }, + { "ignore-sysfs", 0, NULL, 'n' }, + { "verbose", 0, NULL, 'v' }, + { "version", 0, NULL, 'V' }, + { "export", 0, NULL, 'x' }, + { "help", 0, NULL, 'h' }, + {} +}; + +static const char short_options[] = "abd:f:ghinp:s:uvVx"; static const char dev_short_options[] = "bgp:"; static int all_good; @@ -407,7 +426,7 @@ static int set_options(int argc, char **argv, const char *short_opts, */ optind = 1; while (1) { - option = getopt(argc, argv, short_opts); + option = getopt_long(argc, argv, short_opts, options, NULL); if (option == -1) break; @@ -443,6 +462,24 @@ static int set_options(int argc, char **argv, const char *short_opts, all_good = 1; break; + case 'h': + printf("Usage: scsi_id OPTIONS \n" + " --device device node for SG_IO commands\n" + " --devpath sysfs devpath\n" + " --config location of config file\n" + " --page SCSI page (0x80, 0x83, pre-spc3-83)\n" + " --fallback-to-sysfs print sysfs values if inquiry fails\n" + " --ignore-sysfs ignore sysfs entries\n" + " --blacklisted threat device as blacklisted\n" + " --whitelisted threat device as whitelisted\n" + " --prefix-bus-id prefix SCSI bus id\n" + " --replace-whitespace replace all whitespaces by underscores\n" + " --verbose verbose logging\n" + " --version print version\n" + " --export print values as environemt keys\n" + " --help print this help text\n\n"); + exit(0); + case 'i': display_bus_id = 1; break; @@ -483,13 +520,12 @@ static int set_options(int argc, char **argv, const char *short_opts, break; case 'V': - info("scsi_id version: %s\n", SCSI_ID_VERSION); + printf("%s\n", SCSI_ID_VERSION); exit(0); break; default: - info("Unknown or bad option '%c' (0x%x)", option, option); - return -1; + exit(1); } } return 0; @@ -509,7 +545,7 @@ static int per_dev_options(struct sysfs_device *dev_scsi, int *good_bad, int *pa optind = 1; /* reset this global extern */ while (retval == 0) { - option = getopt(newargc, newargv, dev_short_options); + option = getopt_long(newargc, newargv, dev_short_options, options, NULL); if (option == -1) break; @@ -648,7 +684,7 @@ static int scsi_id(const char *devpath, char *maj_min_dev) int page_code; char serial[MAX_SERIAL_LEN]; char serial_short[MAX_SERIAL_LEN]; - char bus_str[8]; + const char *bus_str = NULL; dbg("devpath %s\n", devpath); @@ -663,15 +699,6 @@ static int scsi_id(const char *devpath, char *maj_min_dev) else dev_type = S_IFCHR; - if (!ignore_sysfs) { - /* get scsi parent device */ - dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); - if (dev_scsi == NULL) { - err("unable to access parent device of '%s'", devpath); - return 1; - } - } - /* mknod a temp dev to communicate with the device */ if (!dev_specified && create_tmp_dev(dev->devpath, maj_min_dev, dev_type)) { dbg("create_tmp_dev failed\n"); @@ -679,12 +706,17 @@ static int scsi_id(const char *devpath, char *maj_min_dev) } if (!ignore_sysfs) { + /* get scsi parent device */ + dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); + if (dev_scsi == NULL) { + err("unable to access parent device of '%s'", devpath); + return 1; + } set_sysfs_values(dev_scsi); - strcpy(bus_str,"scsi"); + bus_str = "scsi"; } else { dev_scsi = dev; set_inq_values(dev_scsi, maj_min_dev); - strcpy(bus_str,"cciss"); } /* get per device (vendor + model) options from the config file */ @@ -711,7 +743,8 @@ static int scsi_id(const char *devpath, char *maj_min_dev) set_str(serial_str, serial_short, sizeof(serial_str)); printf("ID_SERIAL_SHORT=%s\n", serial_str); printf("ID_TYPE=%s\n", type_str); - printf("ID_BUS=%s\n", bus_str); + if (bus_str != NULL) + printf("ID_BUS=%s\n", bus_str); } else { if (reformat_serial) format_serial(serial); -- cgit v1.2.3-54-g00ecf From 97f39d487a0cf891cbd2db3d9b5a7cc93f6617b7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 May 2007 17:40:04 +0200 Subject: rules: use long options for scsi_id --- etc/udev/rules.d/60-persistent-input.rules | 2 +- etc/udev/rules.d/60-persistent-storage.rules | 15 ++++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules index 503e61e035..acf5ebe7d5 100644 --- a/etc/udev/rules.d/60-persistent-input.rules +++ b/etc/udev/rules.d/60-persistent-input.rules @@ -3,7 +3,7 @@ SUBSYSTEM!="input", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" # usb devices -SUBSYSTEMS=="usb", IMPORT{program}="usb_id -x" +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 8de3e63410..064ac9feb8 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -3,13 +3,11 @@ ACTION!="add", GOTO="persistent_storage_end" -KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" -KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" # type 8 devices are "Medium Changers" -KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" SUBSYSTEM!="block", GOTO="persistent_storage_end" @@ -33,15 +31,14 @@ KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODE KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id -x" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id -n -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id --export" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" +KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --page=0x80 --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss" KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # libata compat (links like hd*) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", ENV{ID_ATA_COMPAT}="$result" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id --export $tempnode", ENV{ID_ATA_COMPAT}="$result" KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" -- cgit v1.2.3-54-g00ecf From 596714857b0c6b2779e861e4069d63f0fa27aa28 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 29 May 2007 21:23:20 +0200 Subject: path_id: skip subsystem directory --- extras/path_id/path_id | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) mode change 100644 => 100755 extras/path_id/path_id diff --git a/extras/path_id/path_id b/extras/path_id/path_id old mode 100644 new mode 100755 index ee26dc1f8a..57879b5a9a --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -427,27 +427,32 @@ handle_device () { full_sysfs_path="$SYSFS$DEVPATH" case "$DEVPATH" in /devices/*) - # new sysfs layout + full_sysfs_path="${full_sysfs_path%/*}" + # skip parent device of the same subsystem if [ -L $full_sysfs_path/subsystem ]; then - full_sysfs_path="${full_sysfs_path%/*}" cd "$full_sysfs_path/subsystem"; subsys="`pwd -P`" cd "$OPWD" subsys="${subsys##*/}" - if [ "$subsys" = "block" ]; then - # parent is "block", it's a partition, move one up - full_sysfs_path="${full_sysfs_path%/*}" + if [ "$subsys" = "$TYPE" ]; then + : skip same subsystem parent + full_sysfs_path="${full_sysfs_path%/*}" fi - cd $full_sysfs_path fi + # skip subsystem directory + subsys="${full_sysfs_path##*/}" + if [ "$subsys" = "$TYPE" ]; then + : skip subsystem directory + full_sysfs_path="${full_sysfs_path%/*}" + fi + cd $full_sysfs_path ;; *) # old sysfs layout - if [ ! -L $full_sysfs_path/device ] ; then - if [ -f $full_sysfs_path/range ] ; then return ; fi + if [ ! -L $full_sysfs_path/device ]; then full_sysfs_path="${full_sysfs_path%/*}" : full_sysfs_path "$full_sysfs_path" - if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then + if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ]; then return fi fi @@ -456,6 +461,7 @@ handle_device () { esac full_sysfs_device_path="`pwd -P`" cd "$OPWD" + D=$full_sysfs_device_path while [ ! -z "$D" ] ; do case "$D" in -- cgit v1.2.3-54-g00ecf From a7e2961c0f6dfb50bed2c66f30c4be16cadfa088 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 29 May 2007 21:24:27 +0200 Subject: rules: fix cciss rule --- etc/udev/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 064ac9feb8..fc0ea44053 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -33,7 +33,7 @@ KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id --export" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" -KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --page=0x80 --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss" KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From 31a828683457e1639e51affd6507918a9dfe021f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 29 May 2007 21:25:21 +0200 Subject: rules: SUSE update --- etc/udev/suse/64-device-mapper.rules | 6 +++--- etc/udev/suse/64-md-raid.rules | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index 567772ab7c..838b022593 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -6,14 +6,14 @@ KERNEL=="device-mapper", SYMLINK+="mapper/control" KERNEL!="dm-*", GOTO="device_mapper_end" ACTION!="add|change", GOTO="device_mapper_end" -# skip snapshot and error tables IMPORT{program}="/sbin/dmsetup export -j%M -m%m" -ENV{DM_STATE}!="ACTIVE", GOTO="device_mapper_end" -ENV{DM_TARGET_TYPES}=="|*snapshot*|*error*", GOTO="device_mapper_end" +ENV{DM_NAME}!="?*", GOTO="device_mapper_end" SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" +ENV{DM_STATE}!="ACTIVE", GOTO="device_mapper_end" +ENV{DM_TARGET_TYPES}=="|*snapshot*|*error*", GOTO="device_mapper_end" IMPORT{program}="vol_id --export $tempnode" OPTIONS="link_priority=-100" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" diff --git a/etc/udev/suse/64-md-raid.rules b/etc/udev/suse/64-md-raid.rules index 3011a903ec..6bbfd126df 100644 --- a/etc/udev/suse/64-md-raid.rules +++ b/etc/udev/suse/64-md-raid.rules @@ -6,7 +6,7 @@ ACTION!="add|change", GOTO="md_end" ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" -IMPORT{program}="/sbin/mdadm -D --export $tempnode" +IMPORT{program}="/sbin/mdadm --detail --export $tempnode" ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" -- cgit v1.2.3-54-g00ecf From fd40749e68c000f9d80083a5bcdb8183bac4bfdf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 29 May 2007 21:26:01 +0200 Subject: scsi_id: fix typo in help text --- extras/scsi_id/scsi_id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index e9818a635a..d8b269a950 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -476,7 +476,7 @@ static int set_options(int argc, char **argv, const char *short_opts, " --replace-whitespace replace all whitespaces by underscores\n" " --verbose verbose logging\n" " --version print version\n" - " --export print values as environemt keys\n" + " --export print values as environment keys\n" " --help print this help text\n\n"); exit(0); @@ -817,7 +817,7 @@ int main(int argc, char **argv) exit(1); if (!sys_specified) { - info("-s must be specified\n"); + info("--devpath= must be specified\n"); retval = 1; goto exit; } -- cgit v1.2.3-54-g00ecf From d419e96238f295996f5b8fc1743ab4835f62fcc2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 1 Jun 2007 16:37:43 +0200 Subject: fix "do not access parent" warning for ATTR{} --- udev_rules_parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index bfbad367e9..02bddbd0a8 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -376,7 +376,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncmp(attr, "device/", 7) == 0) err("the 'device' link is deprecated and will be removed from a future kernel, " "please fix it in %s:%u", filename, lineno); - else if (strchr(attr, '/') != NULL) + else if (strstr(attr, "../") != NULL) err("do not reference parent sysfs directories directly, that may break with a future kernel, " "please fix it in %s:%u", filename, lineno); if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0) -- cgit v1.2.3-54-g00ecf From 4722274ca048e245fe017b8ca6f776b45cfc4ead Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 2 Jun 2007 09:43:57 +0200 Subject: sysfs: add device lookup by $SUBSYSYTEM:$KERNEL --- udev_sysfs.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/udev_sysfs.c b/udev_sysfs.c index 1846a42f6a..8525620a09 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -429,3 +429,95 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) out: return attr->value; } + +int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char *subsystem, const char *id) +{ + size_t sysfs_len; + char path_full[PATH_SIZE]; + char *path; + struct stat statbuf; + + sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); + path = &path_full[sysfs_len]; + + if (strcmp(subsystem, "subsystem") == 0) { + strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "module") == 0) { + strlcpy(path, "/module/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "drivers") == 0) { + char subsys[NAME_SIZE]; + char *driver; + + strlcpy(subsys, id, sizeof(subsys)); + driver = strchr(subsys, ':'); + if (driver != NULL) { + driver[0] = '\0'; + driver = &driver[1]; + strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); + strlcat(path, subsys, sizeof(path_full) - sysfs_len); + strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); + strlcat(path, driver, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + strlcat(path, subsys, sizeof(path_full) - sysfs_len); + strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); + strlcat(path, driver, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + } + goto out; + } + + strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); + strlcat(path, subsystem, sizeof(path_full) - sysfs_len); + strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); + strlcat(path, subsystem, sizeof(path_full) - sysfs_len); + strlcat(path, "/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + strlcat(path, subsystem, sizeof(path_full) - sysfs_len); + strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; +out: + return 0; + +found: + if (S_ISLNK(statbuf.st_mode)) + sysfs_resolve_link(path, sizeof(path_full) - sysfs_len); + strlcpy(devpath_full, path, len); + return 1; +} -- cgit v1.2.3-54-g00ecf From f7e34eb3e7e8c84cb7ce55ad64e4813e7985936a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 2 Jun 2007 10:02:32 +0200 Subject: events for "bus" and "class" registration must be matched as "subsystem" --- udev_rules_parse.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 02bddbd0a8..9166980488 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -298,7 +298,16 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena err("invalid SUBSYSTEM operation"); goto invalid; } - add_rule_key(rule, &rule->subsystem, operation, value); + /* bus, class, subsystem events should all be the same */ + if (strcmp(value, "subsystem") == 0 || + strcmp(value, "bus") == 0 || + strcmp(value, "class") == 0) { + if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) + err("'%s' must be specified as 'subsystem' " + "please fix it in %s:%u", value, filename, lineno); + add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); + } else + add_rule_key(rule, &rule->subsystem, operation, value); valid = 1; continue; } -- cgit v1.2.3-54-g00ecf From df97701ec607a81e5724b7ac2c9b9511fa22ee45 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 2 Jun 2007 10:14:50 +0200 Subject: udevtest: add --subsystem option --- udevtest.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/udevtest.c b/udevtest.c index 91749a4eef..f230b66628 100644 --- a/udevtest.c +++ b/udevtest.c @@ -92,15 +92,17 @@ int main(int argc, char *argv[], char *envp[]) { int force = 0; char *action = "add"; - struct udev_rules rules = {}; + char *subsystem = NULL; char *devpath = NULL; struct udevice *udev; struct sysfs_device *dev; + struct udev_rules rules = {}; int retval; int rc = 0; static const struct option options[] = { { "action", 1, NULL, 'a' }, + { "subsystem", 1, NULL, 's' }, { "force", 0, NULL, 'f' }, { "help", 0, NULL, 'h' }, {} @@ -119,7 +121,7 @@ int main(int argc, char *argv[], char *envp[]) while (1) { int option; - option = getopt_long(argc, argv, "a:fh", options, NULL); + option = getopt_long(argc, argv, "a:s:fh", options, NULL); if (option == -1) break; @@ -128,14 +130,18 @@ int main(int argc, char *argv[], char *envp[]) case 'a': action = optarg; break; + case 's': + subsystem = optarg; + break; case 'f': force = 1; break; case 'h': - printf("Usage: udevtest [--action=] [--force] [--help] \n" - " --action= set action string\n" - " --force don't skip node/link creation\n" - " --help print this help text\n\n"); + printf("Usage: udevtest OPTIONS \n" + " --action= set action string\n" + " --subsystem= set subsystem string\n" + " --force don't skip node/link creation\n" + " --help print this help text\n\n"); exit(0); default: exit(1); @@ -175,9 +181,12 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } + if (subsystem != NULL) + strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); + /* override built-in sysfs device */ udev->dev = dev; - strcpy(udev->action, action); + strlcpy(udev->action, action, sizeof(udev->action)); udev->devt = udev_device_get_devt(udev); /* simulate node creation with test flag */ -- cgit v1.2.3-54-g00ecf From 03178b0ccec2d4eed7e57563f17fc60adc0a4446 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 2 Jun 2007 22:00:10 +0200 Subject: sysfs: change order of subsystem lookup --- udev_sysfs.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index 8525620a09..98be9a5352 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -446,16 +446,16 @@ int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char if (stat(path_full, &statbuf) == 0) goto found; - strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); + strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; + goto out; - strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; - goto out; } if (strcmp(subsystem, "module") == 0) { @@ -499,22 +499,21 @@ int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char if (stat(path_full, &statbuf) == 0) goto found; - strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); + strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - strlcat(path, "/", sizeof(path_full) - sysfs_len); + strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; - strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); + strlcat(path, "/", sizeof(path_full) - sysfs_len); strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; out: return 0; - found: if (S_ISLNK(statbuf.st_mode)) sysfs_resolve_link(path, sizeof(path_full) - sysfs_len); -- cgit v1.2.3-54-g00ecf From 5e9eb88f2f6d99eaee16aeeb76ac08a1bf98a668 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 2 Jun 2007 22:06:01 +0200 Subject: add $sys substitution --- udev.7 | 5 +++++ udev.xml | 7 +++++++ udev_rules.c | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/udev.7 b/udev.7 index a4b15886c7..4fbaf92432 100644 --- a/udev.7 +++ b/udev.7 @@ -362,6 +362,11 @@ The node name of the parent device. The udev_root value. .RE .PP +\fB$sys\fR, \fB%S\fR +.RS 4 +The sysfs mount point. +.RE +.PP \fB$tempnode\fR, \fB%N\fR .RS 4 The name of a created temporary device node to provide access to the device from a external program before the real node is created. diff --git a/udev.xml b/udev.xml index 5ba3d3636c..1f9e6d9197 100644 --- a/udev.xml +++ b/udev.xml @@ -529,6 +529,13 @@ + + , + + The sysfs mount point. + + + , diff --git a/udev_rules.c b/udev_rules.c index 1139c99a7d..e61c9a69b0 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -292,6 +292,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) SUBST_PARENT, SUBST_TEMP_NODE, SUBST_ROOT, + SUBST_SYS, SUBST_ENV, }; static const struct subst_map { @@ -311,6 +312,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, + { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, { .name = "env", .fmt = 'E', .type = SUBST_ENV }, { NULL, '\0', 0 } }; @@ -516,6 +518,10 @@ found: strlcat(string, udev_root, maxsize); dbg("substitute udev_root '%s'", udev_root); break; + case SUBST_SYS: + strlcat(string, sysfs_path, maxsize); + dbg("substitute sysfs_path '%s'", sysfs_path); + break; case SUBST_ENV: if (attr == NULL) { dbg("missing attribute"); -- cgit v1.2.3-54-g00ecf From 953249a3a01cbd442b42558168da6c76a92a0e40 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Jun 2007 00:01:46 +0200 Subject: add TEST=="" key --- udev.7 | 5 +++++ udev.h | 1 + udev.xml | 8 ++++++++ udev_node.c | 2 +- udev_rules.c | 29 +++++++++++++++++++++++++++-- udev_rules.h | 2 ++ udev_rules_parse.c | 9 +++++++++ 7 files changed, 53 insertions(+), 3 deletions(-) diff --git a/udev.7 b/udev.7 index 4fbaf92432..a253581581 100644 --- a/udev.7 +++ b/udev.7 @@ -151,6 +151,11 @@ Match against the value of an environment variable. Up to five keys can be specified per rule. Depending on the type of operator, this key is also used to export a variable to the environment. .RE .PP +\fBTEST{\fR\fB\fIoctal mode mask\fR\fR\fB}\fR +.RS 4 +Test the existence of a file. An octal mode mask can be specified if needed. +.RE +.PP \fBPROGRAM\fR .RS 4 Execute external program. The key is true, if the program returns with exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout, is available in the RESULT key. diff --git a/udev.h b/udev.h index 94d054f760..64510ed35f 100644 --- a/udev.h +++ b/udev.h @@ -119,6 +119,7 @@ extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem); extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); extern int sysfs_resolve_link(char *path, size_t size); +extern int sysfs_lookup_devpath_by_subsys_id(char *devpath, size_t len, const char *subsystem, const char *id); /* udev_node.c */ extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); diff --git a/udev.xml b/udev.xml index 1f9e6d9197..a3658bd548 100644 --- a/udev.xml +++ b/udev.xml @@ -224,6 +224,14 @@ + + + + Test the existence of a file. An octal mode mask can be specified + if needed. + + + diff --git a/udev_node.c b/udev_node.c index b1bbda8369..338948fc54 100644 --- a/udev_node.c +++ b/udev_node.c @@ -322,7 +322,7 @@ int udev_node_add(struct udevice *udev) /* take the maximum registered minor range */ attr = sysfs_attr_get_value(udev->dev->devpath, "range"); - if (attr) { + if (attr != NULL) { range = atoi(attr); if (range > 1) udev->partitions = range-1; diff --git a/udev_rules.c b/udev_rules.c index e61c9a69b0..5ded26d049 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -641,6 +641,29 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) } } + if (rule->test.operation != KEY_OP_UNSET) { + char filename[PATH_SIZE]; + struct stat statbuf; + int match; + + strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); + udev_rules_apply_format(udev, filename, sizeof(filename)); + + match = (stat(filename, &statbuf) == 0); + info("'%s' %s", filename, match ? "exists" : "does not exist"); + if (match && rule->test_mode_mask > 0) { + match = ((statbuf.st_mode & rule->test_mode_mask) > 0); + info("'%s' has mode=%#o and %s %#o", filename, statbuf.st_mode, + match ? "matches" : "does not match", + rule->test_mode_mask); + } + if (match && rule->test.operation == KEY_OP_NOMATCH) + goto nomatch; + if (!match && rule->test.operation == KEY_OP_MATCH) + goto nomatch; + dbg("TEST key is true"); + } + if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { int found; @@ -1037,7 +1060,8 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) dbg("process rule"); if (rule->name.operation != KEY_OP_UNSET || rule->symlink.operation != KEY_OP_UNSET || - rule->mode_operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { + rule->mode_operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || + rule->group.operation != KEY_OP_UNSET) { dbg("skip rule that names a device"); continue; } @@ -1050,7 +1074,8 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) } if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { - if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { + if (rule->run.operation == KEY_OP_ASSIGN || + rule->run.operation == KEY_OP_ASSIGN_FINAL) { info("reset run list"); name_list_cleanup(&udev->run_list); } diff --git a/udev_rules.h b/udev_rules.h index 7fbf88ba57..0e1ff76b42 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -75,6 +75,8 @@ struct udev_rule { struct key result; struct key import; enum import_type import_type; + struct key test; + mode_t test_mode_mask; struct key run; struct key wait_for_sysfs; struct key label; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 9166980488..4420616903 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -470,6 +470,15 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } + if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { + attr = get_key_attribute(key + sizeof("TEST")-1); + if (attr != NULL) + rule->test_mode_mask = strtol(attr, NULL, 8); + add_rule_key(rule, &rule->test, operation, value); + valid = 1; + continue; + } + if (strcasecmp(key, "RUN") == 0) { add_rule_key(rule, &rule->run, operation, value); valid = 1; -- cgit v1.2.3-54-g00ecf From 4ad47b2de6534dce23fd3182ec1e7472e299b05f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 3 Jun 2007 12:29:46 +0200 Subject: add "[$SUBSYSTEM/$KERNEL]" lookup --- test/udev-test.pl | 9 +++++++ udev_rules.c | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 81 insertions(+), 5 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 10d87ed54a..53499d8871 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1559,6 +1559,15 @@ EOF # 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 KERNEL="sda1", NAME=="no" KERNEL=="sda1", NAME="yes" +EOF + }, + { + desc => "magic subsys/kernel lookup", + subsys => "block", + devpath => "/block/sda", + exp_name => "00:e0:00:fb:04:e1", + rules => <" lookup */ +static int attr_get_by_subsys_id(const char *attrstr, char *devpath, size_t len, char **attr) +{ + char subsys[NAME_SIZE]; + char *attrib; + char *id; + int found = 0; + + if (attrstr[0] != '[') + goto out; + + strlcpy(subsys, &attrstr[1], sizeof(subsys)); + + attrib = strchr(subsys, ']'); + if (attrib == NULL) + goto out; + attrib[0] = '\0'; + attrib = &attrib[1]; + + id = strchr(subsys, '/'); + if (id == NULL) + goto out; + id[0] = '\0'; + id = &id[1]; + + if (sysfs_lookup_devpath_by_subsys_id(devpath, len, subsys, id)) { + if (attr != NULL) { + if (attrib[0] != '\0') + *attr = attrib; + else + *attr = NULL; + } + found = 1; + } +out: + return found; +} + void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) { char temp[PATH_SIZE]; @@ -443,11 +481,20 @@ found: if (attr == NULL) err("missing file parameter for attr"); else { + char devpath[PATH_SIZE]; + char *attrib; const char *value = NULL; size_t size; - /* first try the current device, other matches may have selected */ - if (udev->dev_parent != NULL && udev->dev_parent != udev->dev) + if (attr_get_by_subsys_id(attr, devpath, sizeof(devpath), &attrib)) { + if (attrib != NULL) + value = sysfs_attr_get_value(devpath, attrib); + else + break; + } + + /* try the current device, other matches may have selected */ + if (value == NULL && udev->dev_parent != NULL && udev->dev_parent != udev->dev) value = sysfs_attr_get_value(udev->dev_parent->devpath, attr); /* look at all devices along the chain of parents */ @@ -643,12 +690,23 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (rule->test.operation != KEY_OP_UNSET) { char filename[PATH_SIZE]; + char devpath[PATH_SIZE]; + char *attr; struct stat statbuf; int match; strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); udev_rules_apply_format(udev, filename, sizeof(filename)); + if (attr_get_by_subsys_id(filename, devpath, sizeof(devpath), &attr)) { + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, devpath, sizeof(filename)); + if (attr != NULL) { + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, attr, sizeof(filename)); + } + } + match = (stat(filename, &statbuf) == 0); info("'%s' %s", filename, match ? "exists" : "does not exist"); if (match && rule->test_mode_mask > 0) { @@ -680,11 +738,20 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) pair->key.operation == KEY_OP_NOMATCH) { const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); - const char *value; + char devpath[PATH_SIZE]; + char *attrib; + const char *value = NULL; char val[VALUE_SIZE]; size_t len; - value = sysfs_attr_get_value(udev->dev->devpath, key_name); + if (attr_get_by_subsys_id(key_name, devpath, sizeof(devpath), &attrib)) { + if (attrib != NULL) + value = sysfs_attr_get_value(devpath, attrib); + else + goto nomatch; + } + if (value == NULL) + value = sysfs_attr_get_value(udev->dev->devpath, key_name); if (value == NULL) goto nomatch; strlcpy(val, value, sizeof(val)); -- cgit v1.2.3-54-g00ecf From 96d3d86145124f1c401d1f1aa74c0e3184fd6ddc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 4 Jun 2007 10:50:05 +0200 Subject: sysfs: handle bus/class top-level directories --- udev_sysfs.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index 98be9a5352..6e6f16c16f 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -215,7 +215,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) if (pos != NULL) pos[0] = '\0'; else - dev->subsystem[0] = '\0'; + strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/block/", 7) == 0) { strlcpy(dev->subsystem, "block", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/devices/", 9) == 0) { @@ -235,6 +235,14 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/module/", 8) == 0) { strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); + } else if (strncmp(dev->devpath, "/subsystem/", 11) == 0) { + pos = strrchr(dev->devpath, '/'); + if (pos == &dev->devpath[10]) + strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); + } else if (strncmp(dev->devpath, "/bus/", 5) == 0) { + pos = strrchr(dev->devpath, '/'); + if (pos == &dev->devpath[4]) + strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); } /* get driver name */ @@ -267,9 +275,10 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) if (dev->parent != NULL) return dev->parent; - /* requesting a parent is only valid for devices */ + /* requesting a parent is only valid for these devpathes */ if ((strncmp(dev->devpath, "/devices/", 9) != 0) && (strncmp(dev->devpath, "/subsystem/", 11) != 0) && + (strncmp(dev->devpath, "/bus/", 5) != 0) && (strncmp(dev->devpath, "/class/", 7) != 0) && (strncmp(dev->devpath, "/block/", 7) != 0)) return NULL; @@ -283,20 +292,6 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) return NULL; pos[0] = '\0'; - /* are we at the top level of /devices */ - if (strcmp(parent_devpath, "/devices") == 0) { - dbg("/devices top level"); - return NULL; - } - - /* at the subsystems top level we want to follow the old-style "device" link */ - if (strncmp(parent_devpath, "/subsystem", 10) == 0) { - pos = strrchr(parent_devpath, '/'); - if (pos == &parent_devpath[10] || pos == parent_devpath || strcmp(pos, "/devices") == 0) { - dbg("/subsystem top level, look for device link"); - goto device_link; - } - } if (strncmp(parent_devpath, "/class", 6) == 0) { pos = strrchr(parent_devpath, '/'); if (pos == &parent_devpath[6] || pos == parent_devpath) { @@ -309,6 +304,11 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) goto device_link; } + /* are we at the top level? */ + pos = strrchr(parent_devpath, '/'); + if (pos == NULL || pos == parent_devpath) + return NULL; + /* get parent and remember it */ dev->parent = sysfs_device_get(parent_devpath); return dev->parent; -- cgit v1.2.3-54-g00ecf From fd80719273b9d58f88fc5d576cdb67a1fd92e2bb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 4 Jun 2007 11:20:18 +0200 Subject: sysfs: skip unknown sysfs directories --- udev_sysfs.c | 20 ++++++++++++-------- udevinfo.c | 4 ++-- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index 6e6f16c16f..34ae9ac14f 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -155,9 +155,21 @@ struct sysfs_device *sysfs_device_get(const char *devpath) int len; char *pos; + /* we handle only these devpathes */ + if (devpath != NULL && + strncmp(devpath, "/devices/", 9) != 0 && + strncmp(devpath, "/subsystem/", 11) != 0 && + strncmp(devpath, "/module/", 8) != 0 && + strncmp(devpath, "/bus/", 5) != 0 && + strncmp(devpath, "/class/", 7) != 0 && + strncmp(devpath, "/block/", 7) != 0) + return NULL; + dbg("open '%s'", devpath); strlcpy(devpath_real, devpath, sizeof(devpath_real)); remove_trailing_chars(devpath_real, '/'); + if (devpath[0] == '\0' ) + return NULL; /* look for device already in cache (we never put an untranslated path in the cache) */ list_for_each_entry(dev_loop, &dev_list, node) { @@ -275,14 +287,6 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) if (dev->parent != NULL) return dev->parent; - /* requesting a parent is only valid for these devpathes */ - if ((strncmp(dev->devpath, "/devices/", 9) != 0) && - (strncmp(dev->devpath, "/subsystem/", 11) != 0) && - (strncmp(dev->devpath, "/bus/", 5) != 0) && - (strncmp(dev->devpath, "/class/", 7) != 0) && - (strncmp(dev->devpath, "/block/", 7) != 0)) - return NULL; - strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); dbg("'%s'", parent_devpath); diff --git a/udevinfo.c b/udevinfo.c index cda229244d..82057de54c 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -413,7 +413,7 @@ int main(int argc, char *argv[], char *envp[]) case ACTION_ATTRIBUTE_WALK: if (path[0] != '\0') { if (print_device_chain(path) != 0) { - fprintf(stderr, "device not found\n"); + fprintf(stderr, "no valid sysfs device found\n"); rc = 4; goto exit; } @@ -424,7 +424,7 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } if (print_device_chain(udev->dev->devpath) != 0) { - fprintf(stderr, "device not found\n"); + fprintf(stderr, "no valid sysfs device found\n"); rc = 4; goto exit; } -- cgit v1.2.3-54-g00ecf From 3f504ce7dc8739c5ede3ad7f0e5918605ff4bf57 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 4 Jun 2007 15:05:12 +0200 Subject: rules: SUSE update --- etc/udev/rules.d/60-persistent-storage.rules | 2 +- etc/udev/suse/50-udev-default.rules | 10 +++------- etc/udev/suse/64-device-mapper.rules | 5 +---- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index fc0ea44053..f5d4dca12c 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -38,7 +38,7 @@ KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # libata compat (links like hd*) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id --export $tempnode", ENV{ID_ATA_COMPAT}="$result" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", ENV{ID_ATA_COMPAT}="$result" KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 4a74bbb6d6..3017634f1a 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -93,13 +93,10 @@ SUBSYSTEM=="block", GROUP="disk", MODE="0640" # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC # sr: 4 TYPE_WORM, 5 TYPE_ROM # st/osst: 1 TYPE_TAPE -SUBSYSTEM=="scsi", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" -SUBSYSTEM=="scsi", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" -SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="1", ATTR{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" +SUBSYSTEM=="scsi_device", ACTION=="add", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" SUBSYSTEM=="ide", ACTION=="add", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" SUBSYSTEM=="mmc", ACTION=="add", RUN+="/sbin/modprobe mmc_block" @@ -123,7 +120,6 @@ KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" # libusb device access SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" -SUBSYSTEM=="usb_device", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" # kernel firmware loader SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index 838b022593..9555e9799f 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -1,6 +1,3 @@ -# device mapper links hook into "change" events, when the dm table -# becomes available; some table-types must be ignored - KERNEL=="device-mapper", SYMLINK+="mapper/control" KERNEL!="dm-*", GOTO="device_mapper_end" @@ -13,7 +10,7 @@ SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" ENV{DM_STATE}!="ACTIVE", GOTO="device_mapper_end" -ENV{DM_TARGET_TYPES}=="|*snapshot*|*error*", GOTO="device_mapper_end" +ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" IMPORT{program}="vol_id --export $tempnode" OPTIONS="link_priority=-100" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -- cgit v1.2.3-54-g00ecf From 83a4c0f8b8981fb31cb6db70fcbe3a1f62c1913e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 4 Jun 2007 15:05:23 +0200 Subject: release 112 --- Makefile | 2 +- RELEASE-NOTES | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index da89f86274..af7d9555ad 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 111 +VERSION = 112 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 70d04b3e13..66d44f8a93 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,10 +1,27 @@ +udev 112 +======== +Bugfixes. + +Control characters in filesystem label strings are no longer silenty +removed, but hex-encoded, to be able to uniquely identify the device +by its symlink in /dev/disk/by-label/. +If libvolume_id is used by mount(8), LABEL= will work as expected, +if slashes or other characters are used in the label string. + +To test the existence of a file, TEST=="" and TEST!="" +can be specified now. The TEST key accepts an optional mode mask +TEST{0100}=="". + +Scsi_id now supports a mode without expecting scsi-specific sysfs +entries to allow the extraction of cciss-device persistent properties. + udev 111 ======== Bugfixes. In the future, we may see uuid's which are just simple character strings (see the DDF Raid Specification). For that reason vol_id now -exports ID_UUID_SAFE, just like ID_LABEL_SAFE. For things like +exports ID_FS_UUID_SAFE, just like ID_FS_LABEL_SAFE. For things like the creation of symlinks, the *_SAFE values ensure, that no control or whitespace characters are used in the filename. -- cgit v1.2.3-54-g00ecf From e883be3e1387328c5042bc76c18e7beb157bbddc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 4 Jun 2007 15:48:24 +0200 Subject: add missing ChangeLog --- ChangeLog | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/ChangeLog b/ChangeLog index 61a412a9ca..4c20217ee0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,60 @@ +Summary of changes from v111 to v112 +============================================ + +Fabio Massimo Di Nitto (1): + rules: ignore partitons that span the entire disk + +Hannes Reinecke (1): + cciss device support + +Kay Sievers (34): + udevd: close /proc/meminfo after reading + create_floppy_devices: remove dead "unlink" code + volume_id: add function documentation + udev_db: escape path names with \x00 instead of %00 + udevsettle: use long options + replace_chars: replace spaces in node name + volume_id: add and export string encoding function + vol_id: export encoded strings + rules: use encoded strings instead of skipping characters + udevtest: print message before log output + volume_id: escape % character + replace_chars: replace % character + IMPORT: do not mangle whitespace + scsi_id: do not install symlink in /sbin + rules: SUSE update + volume_id: terminate overlong label strings + scsi_id: add long options + rules: use long options for scsi_id + path_id: skip subsystem directory + rules: fix cciss rule + rules: SUSE update + scsi_id: fix typo in help text + fix "do not access parent" warning for ATTR{} + sysfs: add device lookup by $SUBSYSYTEM:$KERNEL + events for "bus" and "class" registration must be matched as "subsystem" + udevtest: add --subsystem option + sysfs: change order of subsystem lookup + add $sys substitution + add TEST=="" key + add "[$SUBSYSTEM/$KERNEL]" lookup + sysfs: handle bus/class top-level directories + sysfs: skip unknown sysfs directories + rules: SUSE update + release 112 + +Miklos Vajna (2): + create_floppy_devices: add man page + path_id: remove on make uninstall + +Ryan Lortie (1): + volume_id: support for long-filename based labels + +Scott James Remnant (2): + replace_untrusted_chars: replace all whitespace with space + run_program: log "info" not "error" if program is missing + + Summary of changes from v110 to v111 ============================================ -- cgit v1.2.3-54-g00ecf From 1fdce2f39dd5be0a722d34866e8823c4760738f2 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Thu, 7 Jun 2007 00:56:20 +0200 Subject: vol_id: do not fail if unable to drop privileges --- extras/volume_id/vol_id.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index e17e7abb0c..38950ee85f 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -154,7 +154,6 @@ int main(int argc, char *argv[]) int skip_raid = 0; int probe_all = 0; const char *node; - struct passwd *pw; int fd; const char *label, *uuid, *type, *type_version, *usage; int retval; @@ -237,16 +236,15 @@ int main(int argc, char *argv[]) dbg("BLKGETSIZE64=%llu", (unsigned long long)size); /* try to drop all privileges before reading disk content */ - pw = getpwnam ("nobody"); - if (pw != NULL && pw->pw_uid > 0 && pw->pw_gid > 0) { - dbg("dropping privileges to %u:%u", - (unsigned int)pw->pw_uid, (unsigned int)pw->pw_gid); - if (setgroups(0, NULL) != 0 || - setgid(pw->pw_gid) != 0 || - setuid(pw->pw_uid) != 0) { - fprintf(stderr, "error dropping privileges: %s\n", strerror(errno)); - rc = 3; - goto exit; + if (getuid() == 0) { + struct passwd *pw; + + pw = getpwnam("nobody"); + if (pw != NULL && pw->pw_uid > 0 && pw->pw_gid > 0) { + if (setgroups(0, NULL) != 0 || + setgid(pw->pw_gid) != 0 || + setuid(pw->pw_uid) != 0) + info("unable to drop privileges: %s\n", strerror(errno)); } } -- cgit v1.2.3-54-g00ecf From 9b2e2d4a8a4007dc34e6979c985ee2ff24e5a9ca Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sat, 9 Jun 2007 19:18:46 +0200 Subject: fix typo in udev_utils_run.c --- udev_utils_run.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_utils_run.c b/udev_utils_run.c index 8137ec1c66..1a92cddd8a 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -158,7 +158,7 @@ int run_program(const char *command, const char *subsystem, close(errpipe[WRITE_END]); } execv(argv[0], argv); - if ((errno == ENOENT) || (errno = ENOTDIR)) { + if (errno == ENOENT || errno == ENOTDIR) { /* may be on a filesytem which is not mounted right now */ info("program '%s' not found", argv[0]); } else { -- cgit v1.2.3-54-g00ecf From 956cf79390e303925135663a858456dd0a26e6c6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 10 Jun 2007 23:53:40 +0200 Subject: make ATTR{[$SUBSYSTEM/$KERNEL]}="" working --- udev_rules.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 598c1ba739..6ef320dfc7 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -923,14 +923,28 @@ try_parent: if (pair->key.operation == KEY_OP_ASSIGN) { const char *key_name = key_pair_name(rule, pair); - char attr[PATH_SIZE]; + char devpath[PATH_SIZE]; + char *attrib; + char attr[PATH_SIZE] = ""; char value[NAME_SIZE]; FILE *f; - strlcpy(attr, sysfs_path, sizeof(attr)); - strlcat(attr, udev->dev->devpath, sizeof(attr)); - strlcat(attr, "/", sizeof(attr)); - strlcat(attr, key_name, sizeof(attr)); + if (attr_get_by_subsys_id(key_name, devpath, sizeof(devpath), &attrib)) { + if (attrib != NULL) { + strlcpy(attr, sysfs_path, sizeof(attr)); + strlcat(attr, devpath, sizeof(attr)); + strlcat(attr, "/", sizeof(attr)); + strlcat(attr, attrib, sizeof(attr)); + } + } + + if (attr[0] == '\0') { + strlcpy(attr, sysfs_path, sizeof(attr)); + strlcat(attr, udev->dev->devpath, sizeof(attr)); + strlcat(attr, "/", sizeof(attr)); + strlcat(attr, key_name, sizeof(attr)); + } + strlcpy(value, key_val(rule, &pair->key), sizeof(value)); udev_rules_apply_format(udev, value, sizeof(value)); info("writing '%s' to sysfs file '%s'", value, attr); -- cgit v1.2.3-54-g00ecf From f809fdffbfe056c226d8a2002b14d28f74303a87 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Jun 2007 02:15:17 +0200 Subject: rules: recognize partitions and disk devices properly --- etc/udev/rules.d/60-persistent-storage.rules | 46 +++++++++++++++------------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index f5d4dca12c..a6f0069358 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -3,12 +3,10 @@ ACTION!="add", GOTO="persistent_storage_end" -KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" -KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" # type 8 devices are "Medium Changers" -KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" -KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" SUBSYSTEM!="block", GOTO="persistent_storage_end" @@ -20,46 +18,52 @@ KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="p KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # ignore partitions that span the entire disk -ATTR{whole_disk}=="", GOTO="persistent_storage_end" +ATTR{whole_disk}=="*", GOTO="persistent_storage_end" + +# /sys/class/block will export this +ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" +ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" # for partitions import parent information -KERNEL=="*[0-9]", IMPORT{parent}="ID_*" +ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="usb_id --export" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" -KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="", IMPORT{program}="scsi_id --export --whitelisted --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", IMPORT{program}="usb_id --export %p" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" +KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss" KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # libata compat (links like hd*) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", ENV{ID_ATA_COMPAT}="$result" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" -KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" +KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*|cciss?c[0-9]d[0-9]", IMPORT{program}="path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="*[0-9]|cciss*p[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -KERNEL=="st*", IMPORT{program}="path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p" +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" +ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" +KERNEL=="st*", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" + KERNEL=="sr*|st*", GOTO="persistent_storage_end" +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" # by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" # BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" +ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $tempnode" +ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From 3b62a5690376e8caebf6d49c17e639a3992dbfe7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Jun 2007 02:15:45 +0200 Subject: rules: SUSE update --- etc/udev/suse/64-device-mapper.rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index 9555e9799f..f1d6c40308 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -9,10 +9,13 @@ ENV{DM_NAME}!="?*", GOTO="device_mapper_end" SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" -ENV{DM_STATE}!="ACTIVE", GOTO="device_mapper_end" +ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end" ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" IMPORT{program}="vol_id --export $tempnode" + OPTIONS="link_priority=-100" +ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS="link_priority=-90" + ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" -- cgit v1.2.3-54-g00ecf From e54f0b4ad2f10ecfefe01d607c43f086e9e889fe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Jun 2007 02:28:09 +0200 Subject: atomically replace existing nodes and symlinks Based on a patch from Scott James Remnant . --- udev_node.c | 108 +++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 77 insertions(+), 31 deletions(-) diff --git a/udev_node.c b/udev_node.c index 338948fc54..8c0287405c 100644 --- a/udev_node.c +++ b/udev_node.c @@ -33,9 +33,11 @@ #include "udev_rules.h" #include "udev_selinux.h" +#define TMP_FILE_EXT ".udev-tmp" int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) { + char file_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; struct stat stats; int retval = 0; @@ -44,28 +46,37 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m else mode |= S_IFCHR; - if (lstat(file, &stats) != 0) - goto create; - /* preserve node with already correct numbers, to prevent changing the inode number */ - if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { - info("preserve file '%s', because it has correct dev_t", file); - selinux_setfilecon(file, udev->dev->kernel, stats.st_mode); - goto perms; + if (lstat(file, &stats) == 0) { + if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { + info("preserve file '%s', because it has correct dev_t", file); + selinux_setfilecon(file, udev->dev->kernel, stats.st_mode); + goto perms; + } } - if (unlink(file) != 0) - err("unlink(%s) failed: %s", file, strerror(errno)); - else - dbg("already present file '%s' unlinked", file); - -create: selinux_setfscreatecon(file, udev->dev->kernel, mode); retval = mknod(file, mode, devt); selinux_resetfscreatecon(); + if (retval == 0) + goto perms; + + info("atomically replace '%s'", file); + strlcpy(file_tmp, file, sizeof(file_tmp)); + strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); + selinux_setfscreatecon(file_tmp, udev->dev->kernel, mode); + retval = mknod(file_tmp, mode, devt); + selinux_resetfscreatecon(); if (retval != 0) { err("mknod(%s, %#o, %u, %u) failed: %s", - file, mode, major(devt), minor(devt), strerror(errno)); + file_tmp, mode, major(devt), minor(devt), strerror(errno)); + goto exit; + } + retval = rename(file_tmp, file); + if (retval != 0) { + err("rename(%s, %s) failed: %s", + file_tmp, file, strerror(errno)); + unlink(file_tmp); goto exit; } @@ -84,18 +95,19 @@ perms: goto exit; } } - exit: return retval; } static int node_symlink(const char *node, const char *slink) { + struct stat stats; char target[PATH_SIZE] = ""; - char buf[PATH_SIZE]; + char slink_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; int i = 0; int tail = 0; int len; + int retval = 0; /* use relative link */ while (node[i] && (node[i] == slink[i])) { @@ -110,28 +122,62 @@ static int node_symlink(const char *node, const char *slink) } strlcat(target, &node[tail], sizeof(target)); - /* look if symlink already exists */ - len = readlink(slink, buf, sizeof(buf)); - if (len > 0) { - buf[len] = '\0'; - if (strcmp(target, buf) == 0) { - info("preserve already existing symlink '%s' to '%s'", slink, target); - selinux_setfilecon(slink, NULL, S_IFLNK); - goto exit; + /* preserve link with correct target, do not replace node of other device */ + if (lstat(slink, &stats) == 0) { + if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { + struct stat stats2; + + info("found existing node instead of symlink '%s'", slink); + if (lstat(node, &stats2) == 0) { + if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && + stats.st_rdev == stats2.st_rdev) { + info("replace device node '%s' with symlink to our node '%s'", slink, node); + } else { + err("device node '%s' already exists, link '%s' will not overwrite it", node, slink); + goto exit; + } + } + } else if (S_ISLNK(stats.st_mode)) { + char buf[PATH_SIZE]; + + info("found existing symlink '%s'", slink); + len = readlink(slink, buf, sizeof(buf)); + if (len > 0) { + buf[len] = '\0'; + if (strcmp(target, buf) == 0) { + info("preserve already existing symlink '%s' to '%s'", slink, target); + selinux_setfilecon(slink, NULL, S_IFLNK); + goto exit; + } + } } - info("link '%s' points to different target '%s', delete it", slink, buf); - unlink(slink); } - /* create link */ info("creating symlink '%s' to '%s'", slink, target); selinux_setfscreatecon(slink, NULL, S_IFLNK); - if (symlink(target, slink) != 0) - err("symlink(%s, %s) failed: %s", target, slink, strerror(errno)); + retval = symlink(target, slink); selinux_resetfscreatecon(); + if (retval == 0) + goto exit; + info("atomically replace '%s'", slink); + strlcpy(slink_tmp, slink, sizeof(slink_tmp)); + strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); + selinux_setfscreatecon(slink_tmp, NULL, S_IFLNK); + retval = symlink(target, slink_tmp); + selinux_resetfscreatecon(); + if (retval != 0) { + err("symlink(%s, %s) failed: %s", target, slink_tmp, strerror(errno)); + goto exit; + } + retval = rename(slink_tmp, slink); + if (retval != 0) { + err("rename(%s, %s) failed: %s", slink_tmp, slink, strerror(errno)); + unlink(slink_tmp); + goto exit; + } exit: - return 0; + return retval; } static int update_link(struct udevice *udev, const char *name) @@ -303,7 +349,7 @@ int udev_node_add(struct udevice *udev) gid = lookup_group(udev->group); } - info("creating device node '%s', major = '%d', minor = '%d', " "mode = '%#o', uid = '%d', gid = '%d'", + info("creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d", filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid); if (!udev->test_run) -- cgit v1.2.3-54-g00ecf From 678484af64d322816dd8007030b136200dd038e3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Jun 2007 09:00:35 +0200 Subject: do not try to create existing file --- udev_node.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/udev_node.c b/udev_node.c index 8c0287405c..9e09e58ba8 100644 --- a/udev_node.c +++ b/udev_node.c @@ -46,21 +46,20 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m else mode |= S_IFCHR; - /* preserve node with already correct numbers, to prevent changing the inode number */ if (lstat(file, &stats) == 0) { if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { info("preserve file '%s', because it has correct dev_t", file); selinux_setfilecon(file, udev->dev->kernel, stats.st_mode); goto perms; } + } else { + selinux_setfscreatecon(file, udev->dev->kernel, mode); + retval = mknod(file, mode, devt); + selinux_resetfscreatecon(); + if (retval == 0) + goto perms; } - selinux_setfscreatecon(file, udev->dev->kernel, mode); - retval = mknod(file, mode, devt); - selinux_resetfscreatecon(); - if (retval == 0) - goto perms; - info("atomically replace '%s'", file); strlcpy(file_tmp, file, sizeof(file_tmp)); strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); @@ -151,15 +150,15 @@ static int node_symlink(const char *node, const char *slink) } } } + } else { + info("creating symlink '%s' to '%s'", slink, target); + selinux_setfscreatecon(slink, NULL, S_IFLNK); + retval = symlink(target, slink); + selinux_resetfscreatecon(); + if (retval == 0) + goto exit; } - info("creating symlink '%s' to '%s'", slink, target); - selinux_setfscreatecon(slink, NULL, S_IFLNK); - retval = symlink(target, slink); - selinux_resetfscreatecon(); - if (retval == 0) - goto exit; - info("atomically replace '%s'", slink); strlcpy(slink_tmp, slink, sizeof(slink_tmp)); strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); -- cgit v1.2.3-54-g00ecf From 845cb370d28c89de23e8994afe74c05b0eb9c76d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Jun 2007 11:40:07 +0200 Subject: info() for ignore_remove --- udev_device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_device.c b/udev_device.c index d50c5ae043..bbf7963afc 100644 --- a/udev_device.c +++ b/udev_device.c @@ -239,8 +239,8 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) if (udev_db_get_device(udev, udev->dev->devpath) == 0) { udev_db_delete_device(udev); if (udev->ignore_remove) { - dbg("remove event for '%s' requested to be ignored by rule", udev->name); - return 0; + info("ignore_remove for '%s'", udev->name); + goto exit; } /* restore stored persistent data */ list_for_each_entry(name_loop, &udev->env_list, node) -- cgit v1.2.3-54-g00ecf From 2b6679cbfd8d1e34454416cf53154403845d27b3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Jun 2007 11:40:23 +0200 Subject: rules: SUSE update --- etc/udev/suse/50-udev-default.rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 3017634f1a..d8598276fb 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -13,6 +13,7 @@ KERNEL=="iseries/vtty*", GROUP="uucp" KERNEL=="mwave", NAME="modems/%k", GROUP="uucp" KERNEL=="ttyUSB*", ATTRS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" KERNEL=="ttyUSB*", ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" +KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" # video/graphics SUBSYSTEM=="video4linux", GROUP="video" @@ -55,7 +56,7 @@ KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" # network -KERNEL=="tun", NAME="net/%k", MODE="0666" +KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" # misc devices KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" -- cgit v1.2.3-54-g00ecf From d847330cf25d16c6ca1fcd29be354f3c77c71069 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Jun 2007 11:41:41 +0200 Subject: Makefile: check for missing ChangeLog or RELEASE-NOTES at release --- Makefile | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index af7d9555ad..213e59c6a4 100644 --- a/Makefile +++ b/Makefile @@ -225,11 +225,6 @@ clean: done; .PHONY: clean -release: - git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | gzip -9v > udev-$(VERSION).tar.gz - git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 -.PHONY: release - install-config: $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d @ if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ @@ -324,7 +319,8 @@ buildtest: test/simple-build-check.sh .PHONY: buildtest -ChangeLog: Makefile +ChangeLog: + head -1 $@ | grep -q "to v$(shell echo $$(($(VERSION) - 1)))" @ mv $@ $@.tmp @ echo "Summary of changes from v$(shell echo $$(($(VERSION) - 1))) to v$(VERSION)" >> $@ @ echo "============================================" >> $@ @@ -334,6 +330,21 @@ ChangeLog: Makefile @ cat $@ @ cat $@.tmp >> $@ @ rm $@.tmp + head -1 $@ | grep -q "to v$(VERSION)" +.PHONY: ChangeLog +.PRECIOUS: ChangeLog + +release: + $(Q) - rm -f udev-$(VERSION).tar.gz + $(Q) - rm -f udev-$(VERSION).tar.bz2 + head -1 ChangeLog | grep -q "to v$(VERSION)" + head -1 RELEASE-NOTES | grep -q "udev $(VERSION)" + git commit -a -m "release $(VERSION)" + cat .git/refs/heads/master > .git/refs/tags/$(VERSION) + @ echo + git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | gzip -9v > udev-$(VERSION).tar.gz + git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 +.PHONY: release gcov-all: $(MAKE) clean all USE_GCOV=true -- cgit v1.2.3-54-g00ecf From 3df3c93e2500b0dcf23989171d27c2b04d149407 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 22 Jun 2007 01:27:02 +0200 Subject: allow to disable the replacement of unusual characters --- udev.7 | 5 +++++ udev.xml | 8 ++++++++ udev_rules.c | 30 ++++++++++++++++++++---------- udev_rules.h | 7 +++++++ udev_rules_parse.c | 20 ++++++++++++-------- udevtest.c | 1 + 6 files changed, 53 insertions(+), 18 deletions(-) diff --git a/udev.7 b/udev.7 index a253581581..d3ed4b71d6 100644 --- a/udev.7 +++ b/udev.7 @@ -290,6 +290,11 @@ Specify the priority of the created symlinks. Devices with higher priorities ove .RS 4 Create the device nodes for all available partitions of a block device. This may be useful for removable media devices where media changes are not detected. .RE +.PP +\fBstring_escape=\fR\fB\fInone|replace\fR\fR +.RS 4 +Usually control and other possibly unsafe characters are replaced in strings used for device naming. The mode of replacement can be specified with this option. +.RE .RE .RE .PP diff --git a/udev.xml b/udev.xml index a3658bd548..520c718c7a 100644 --- a/udev.xml +++ b/udev.xml @@ -435,6 +435,14 @@ detected. + + + + Usually control and other possibly unsafe characters are replaced + in strings used for device naming. The mode of replacement can be specified + with this option. + + diff --git a/udev_rules.c b/udev_rules.c index 6ef320dfc7..cb74da56e3 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -837,7 +837,8 @@ try_parent: strlcpy(program, key_val(rule, &rule->program), sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); - if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_INFO)) != 0) { + if (run_program(program, udev->dev->subsystem, result, sizeof(result), + NULL, (udev_log_priority >= LOG_INFO)) != 0) { dbg("PROGRAM is false"); udev->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) @@ -847,9 +848,12 @@ try_parent: dbg("PROGRAM matches"); remove_trailing_chars(result, '\n'); - count = replace_chars(result, ALLOWED_CHARS_INPUT); - if (count) - info("%i character(s) replaced" , count); + if (rule->string_escape == ESCAPE_UNSET || + rule->string_escape == ESCAPE_REPLACE) { + count = replace_chars(result, ALLOWED_CHARS_INPUT); + if (count > 0) + info("%i character(s) replaced" , count); + } dbg("result is '%s'", result); strlcpy(udev->program_result, result, sizeof(udev->program_result)); dbg("PROGRAM returned successful"); @@ -1047,9 +1051,12 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) /* allow multiple symlinks separated by spaces */ strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); udev_rules_apply_format(udev, temp, sizeof(temp)); - count = replace_chars(temp, ALLOWED_CHARS_FILE " "); - if (count) - info("%i character(s) replaced" , count); + if (rule->string_escape == ESCAPE_UNSET || + rule->string_escape == ESCAPE_REPLACE) { + count = replace_chars(temp, ALLOWED_CHARS_FILE " "); + if (count > 0) + info("%i character(s) replaced" , count); + } dbg("rule applied, added symlink(s) '%s'", temp); pos = temp; while (isspace(pos[0])) @@ -1079,9 +1086,12 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) name_set = 1; strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); udev_rules_apply_format(udev, udev->name, sizeof(udev->name)); - count = replace_chars(udev->name, ALLOWED_CHARS_FILE); - if (count) - info("%i character(s) replaced", count); + if (rule->string_escape == ESCAPE_UNSET || + rule->string_escape == ESCAPE_REPLACE) { + count = replace_chars(udev->name, ALLOWED_CHARS_FILE); + if (count > 0) + info("%i character(s) replaced", count); + } info("rule applied, '%s' becomes '%s'", udev->dev->kernel, udev->name); if (strcmp(udev->dev->subsystem, "net") != 0) diff --git a/udev_rules.h b/udev_rules.h index 0e1ff76b42..682bedac01 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -57,6 +57,12 @@ enum import_type { IMPORT_PARENT, }; +enum escape_type { + ESCAPE_UNSET, + ESCAPE_NONE, + ESCAPE_REPLACE, +}; + struct udev_rule { struct key action; struct key devpath; @@ -88,6 +94,7 @@ struct udev_rule { struct key group; mode_t mode; enum key_operation mode_operation; + enum escape_type string_escape; unsigned int link_priority; unsigned int partitions; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 4420616903..9a12d53816 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -232,6 +232,7 @@ static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs, static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) { + char buf[sizeof(struct udev_rule) + LINE_SIZE]; struct udev_rule *rule; size_t rule_size; int valid; @@ -241,15 +242,12 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena int physdev = 0; int retval; - /* get all the keys */ - rule = calloc(1, sizeof (struct udev_rule) + LINE_SIZE); - if (!rule) { - err("malloc failed"); - return -1; - } + memset(buf, 0x00, sizeof(buf)); + rule = (struct udev_rule *) buf; linepos = line; valid = 0; + /* get all the keys */ while (1) { char *key; char *value; @@ -592,6 +590,14 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena rule->link_priority = atoi(&pos[strlen("link_priority=")]); info("link priority=%i", rule->link_priority); } + pos = strstr(value, "string_escape="); + if (pos != NULL) { + pos = &pos[strlen("string_escape=")]; + if (strncmp(pos, "none", strlen("none")) == 0) + rule->string_escape = ESCAPE_NONE; + else if (strncmp(pos, "replace", strlen("replace")) == 0) + rule->string_escape = ESCAPE_REPLACE; + } if (strstr(value, "all_partitions") != NULL) { dbg("creation of partition nodes requested"); rule->partitions = DEFAULT_PARTITIONS_COUNT; @@ -627,11 +633,9 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena memcpy(rules->buf + rules->bufsize, rule, rule_size); rules->bufsize += rule_size; exit: - free(rule); return 0; invalid: - free(rule); err("invalid rule '%s:%u'", filename, lineno); return -1; } diff --git a/udevtest.c b/udevtest.c index f230b66628..292a94916e 100644 --- a/udevtest.c +++ b/udevtest.c @@ -211,6 +211,7 @@ int main(int argc, char *argv[], char *envp[]) info("run: '%s'", program); } } + udev_device_cleanup(udev); exit: udev_rules_cleanup(&rules); -- cgit v1.2.3-54-g00ecf From 92b229c727e34164a88f59142054d4cdee510f4c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 23 Jun 2007 16:21:47 +0200 Subject: no newline in log messages --- etc/udev/suse/64-device-mapper.rules | 3 +-- udev_selinux.c | 10 +++++----- udev_utils_file.c | 4 ++-- udevd.c | 1 - udevinfo.c | 6 ++---- udevstart.c | 2 +- udevtest.c | 3 +-- udevtrigger.c | 4 ++-- 8 files changed, 14 insertions(+), 19 deletions(-) diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index f1d6c40308..e8af567e26 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -11,11 +11,10 @@ ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end" ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" -IMPORT{program}="vol_id --export $tempnode" +IMPORT{program}="vol_id --export $tempnode" OPTIONS="link_priority=-100" ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS="link_priority=-90" - ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" diff --git a/udev_selinux.c b/udev_selinux.c index 77c0e7dc4a..1ad6e8ad12 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -75,7 +75,7 @@ static char *get_media(const char *devname, int mode) } media = strdup(mediabuf); - info("selinux_get_media(%s)='%s'\n", devname, media); + info("selinux_get_media(%s)='%s'", devname, media); close_out: fclose(fp); @@ -100,7 +100,7 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed\n", file); + err("matchpathcon(%s) failed", file); return; } @@ -128,7 +128,7 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed\n", file); + err("matchpathcon(%s) failed", file); return; } @@ -155,10 +155,10 @@ void selinux_init(void) */ if (is_selinux_running()) { if (!udev_root[0]) - err("selinux_init: udev_root not set\n"); + err("selinux_init: udev_root not set"); matchpathcon_init_prefix(NULL, udev_root); if (getfscreatecon(&prev_scontext) < 0) { - err("getfscreatecon failed\n"); + err("getfscreatecon failed"); prev_scontext = NULL; } } diff --git a/udev_utils_file.c b/udev_utils_file.c index ba70b6b395..44c3686361 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -45,14 +45,14 @@ int create_path(const char *path) pos--; pos[0] = '\0'; - dbg("stat '%s'\n", p); + dbg("stat '%s'", p); if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) return 0; if (create_path (p) != 0) return -1; - dbg("mkdir '%s'\n", p); + dbg("mkdir '%s'", p); if (mkdir(p, 0755) == 0) return 0; if (errno == EEXIST) diff --git a/udevd.c b/udevd.c index 05df871a34..23df5359bb 100644 --- a/udevd.c +++ b/udevd.c @@ -957,7 +957,6 @@ int main(int argc, char *argv[], char *envp[]) selinux_init(); dbg("version %s", UDEV_VERSION); - /* parse commandline options */ while (1) { option = getopt_long(argc, argv, "dtvhV", options, NULL); if (option == -1) diff --git a/udevinfo.c b/udevinfo.c index 82057de54c..d0b1c447f4 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -265,7 +265,6 @@ int main(int argc, char *argv[], char *envp[]) goto exit; } - /* get command line options */ while (1) { option = getopt_long(argc, argv, "aen:p:q:rVh", options, NULL); if (option == -1) @@ -279,7 +278,7 @@ int main(int argc, char *argv[], char *envp[]) strlcpy(name, &optarg[strlen(udev_root)+1], sizeof(name)); else strlcpy(name, optarg, sizeof(name)); - dbg("name: %s\n", name); + dbg("name: %s", name); break; case 'p': /* remove /sys if given */ @@ -287,10 +286,9 @@ int main(int argc, char *argv[], char *envp[]) strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path)); else strlcpy(path, optarg, sizeof(path)); - dbg("path: %s\n", path); + dbg("path: %s", path); break; case 'q': - dbg("udev query: %s\n", optarg); action = ACTION_QUERY; if (strcmp(optarg, "name") == 0) { query = QUERY_NAME; diff --git a/udevstart.c b/udevstart.c index a381c411a8..6af5860e27 100644 --- a/udevstart.c +++ b/udevstart.c @@ -68,7 +68,7 @@ static int device_list_insert(const char *path, struct list_head *device_list) struct device *new_device; const char *devpath = &path[strlen(sysfs_path)]; - dbg("insert: '%s'\n", devpath); + dbg("insert: '%s'", devpath); list_for_each_entry(loop_device, device_list, node) { if (strcmp(loop_device->path, devpath) > 0) { diff --git a/udevtest.c b/udevtest.c index 292a94916e..418d43de14 100644 --- a/udevtest.c +++ b/udevtest.c @@ -44,8 +44,7 @@ void log_message (int priority, const char *format, ...) va_start(args, format); vprintf(format, args); va_end(args); - if (format[strlen(format)-1] != '\n') - printf("\n"); + printf("\n"); } #endif diff --git a/udevtrigger.c b/udevtrigger.c index 7577c5f15f..3b5be2006e 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -118,12 +118,12 @@ static void trigger_uevent(const char *devpath) fd = open(filename, O_WRONLY); if (fd < 0) { - dbg("error on opening %s: %s\n", filename, strerror(errno)); + dbg("error on opening %s: %s", filename, strerror(errno)); return; } if (write(fd, "add", 3) < 0) - info("error on triggering %s: %s\n", filename, strerror(errno)); + info("error on triggering %s: %s", filename, strerror(errno)); close(fd); } -- cgit v1.2.3-54-g00ecf From 3bf1efa8ddee3999656b0454734bc6b39fc7c00b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 23 Jun 2007 17:35:37 +0200 Subject: udevd: do not use syslog if --verbose (debugging) is used --- udevd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/udevd.c b/udevd.c index 23df5359bb..0999b5fa75 100644 --- a/udevd.c +++ b/udevd.c @@ -76,15 +76,16 @@ void log_message(int priority, const char *format, ...) if (priority > udev_log_priority) return; - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); - if (verbose) { + printf("[%d] ", (int) getpid()); va_start(args, format); vprintf(format, args); va_end(args); printf("\n"); + } else { + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); } } -- cgit v1.2.3-54-g00ecf From de96652486539a47cc687116a34515e2a54ff8cd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 23 Jun 2007 17:44:48 +0200 Subject: release 113 --- ChangeLog | 24 ++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 6 ++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4c20217ee0..bc7a20db0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +Summary of changes from v112 to v113 +============================================ + +David Zeuthen (1): + vol_id: do not fail if unable to drop privileges + +Kay Sievers (12): + add missing ChangeLog + make ATTR{[$SUBSYSTEM/$KERNEL]}="" working + rules: recognize partitions and disk devices properly + rules: SUSE update + atomically replace existing nodes and symlinks + do not try to create existing file + info() for ignore_remove + rules: SUSE update + Makefile: check for missing ChangeLog or RELEASE-NOTES at release + allow to disable the replacement of unusual characters + no newline in log messages + udevd: do not use syslog if --verbose (debugging) is used + +Tobias Klauser (1): + fix typo in udev_utils_run.c + + Summary of changes from v111 to v112 ============================================ diff --git a/Makefile b/Makefile index 213e59c6a4..1571e82326 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 112 +VERSION = 113 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 66d44f8a93..2dd24929a6 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,9 @@ +udev 113 +======== +Bugfixes. + +Final merge of patches/features from the Ubuntu package. + udev 112 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From c51d06d3b7e3209d5cf695de05aa25707f66780b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 25 Jun 2007 16:02:38 +0200 Subject: rules_generator: remove executable flag from include file --- extras/rule_generator/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/rule_generator/Makefile b/extras/rule_generator/Makefile index f023848b0b..cc6fe056c6 100644 --- a/extras/rule_generator/Makefile +++ b/extras/rule_generator/Makefile @@ -37,7 +37,7 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_SCRIPT) -D rule_generator.functions $(DESTDIR)$(libudevdir)/rule_generator.functions + $(INSTALL_DATA) -D rule_generator.functions $(DESTDIR)$(libudevdir)/rule_generator.functions $(INSTALL_SCRIPT) -D write_cd_rules $(DESTDIR)$(libudevdir)/write_cd_rules $(INSTALL_SCRIPT) -D write_net_rules $(DESTDIR)$(libudevdir)/write_net_rules $(INSTALL_DATA) -D 75-cd-aliases-generator.rules \ -- cgit v1.2.3-54-g00ecf From 14c7994263150b01d7ffbf89969cf8e3df893dc8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 25 Jun 2007 16:03:11 +0200 Subject: always unlink temporary file before creating new one --- udev_node.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev_node.c b/udev_node.c index 9e09e58ba8..fcd52d0e45 100644 --- a/udev_node.c +++ b/udev_node.c @@ -63,6 +63,7 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m info("atomically replace '%s'", file); strlcpy(file_tmp, file, sizeof(file_tmp)); strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); + unlink(file_tmp); selinux_setfscreatecon(file_tmp, udev->dev->kernel, mode); retval = mknod(file_tmp, mode, devt); selinux_resetfscreatecon(); @@ -162,6 +163,7 @@ static int node_symlink(const char *node, const char *slink) info("atomically replace '%s'", slink); strlcpy(slink_tmp, slink, sizeof(slink_tmp)); strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); + unlink(slink_tmp); selinux_setfscreatecon(slink_tmp, NULL, S_IFLNK); retval = symlink(target, slink_tmp); selinux_resetfscreatecon(); -- cgit v1.2.3-54-g00ecf From 2e23125e112c0a56e1ccee193c2cfe0e26af1bad Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 Jul 2007 22:48:36 +0200 Subject: rules: SUSE update --- etc/udev/suse/50-udev-default.rules | 4 ---- etc/udev/suse/80-drivers.rules | 13 +++++++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) create mode 100644 etc/udev/suse/80-drivers.rules diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index d8598276fb..32e5008e79 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -96,11 +96,7 @@ SUBSYSTEM=="block", GROUP="disk", MODE="0640" # st/osst: 1 TYPE_TAPE SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" -SUBSYSTEM=="scsi_device", ACTION=="add", ATTRS{type}=="1", ATTR{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" -SUBSYSTEM=="ide", ACTION=="add", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" -SUBSYSTEM=="mmc", ACTION=="add", RUN+="/sbin/modprobe mmc_block" # misc storage devices (non-block) KERNEL=="sg*", GROUP="disk", MODE="0640" diff --git a/etc/udev/suse/80-drivers.rules b/etc/udev/suse/80-drivers.rules new file mode 100644 index 0000000000..0351b11d32 --- /dev/null +++ b/etc/udev/suse/80-drivers.rules @@ -0,0 +1,13 @@ +ACTION!="add", GOTO="drivers_end" + +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe --quiet $env{MODALIAS}" + +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe --quiet pnp:d$$id; done < /sys$devpath/id'" + +SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --quiet -all tifm_sd tifm_ms" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTR{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" + +LABEL="drivers_end" -- cgit v1.2.3-54-g00ecf From 2e08169ed4618718636e162bca5be147179da91c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 8 Jul 2007 17:25:55 +0200 Subject: volume_id: ext4 detection --- extras/volume_id/lib/ext.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index e5f1e22f6e..1997d42e0b 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -63,8 +63,12 @@ struct ext2_super_block { } PACKED; #define EXT_SUPER_MAGIC 0xEF53 -#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x00000004 -#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x00000008 +#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 +#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 +#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040 +#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 +#define EXT4_FEATURE_INCOMPAT_MMP 0x0100 + #define EXT_SUPERBLOCK_OFFSET 0x400 #define EXT3_MIN_BLOCK_SIZE 0x400 @@ -74,6 +78,8 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) { struct ext2_super_block *es; size_t bsize; + uint32_t feature_compat; + uint32_t feature_incompat; info("probing at offset 0x%llx", (unsigned long long) off); @@ -97,19 +103,32 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level)); + feature_compat = le32_to_cpu(es->s_feature_compat); + feature_incompat = le32_to_cpu(es->s_feature_incompat); + /* check for external journal device */ - if ((le32_to_cpu(es->s_feature_incompat) & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { + if ((feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { volume_id_set_usage(id, VOLUME_ID_OTHER); id->type = "jbd"; - return 0; + goto out; } - /* check for ext2 / ext3 */ volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - if ((le32_to_cpu(es->s_feature_compat) & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) + + if ((feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS) != 0 || + (feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) != 0 || + (feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) != 0) { + id->type = "ext4"; + goto out; + } + + if ((feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) { id->type = "ext3"; - else - id->type = "ext2"; + goto out; + } + + id->type = "ext2"; +out: return 0; } -- cgit v1.2.3-54-g00ecf From 285e2a24f67b1c09d7b4c54587802fc0a9d623eb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 9 Jul 2007 03:59:08 +0200 Subject: udevtrigger: allow to specify action string --- udevtest.c | 6 +++--- udevtrigger.8 | 7 ++++++- udevtrigger.c | 21 +++++++++++++-------- udevtrigger.xml | 7 +++++++ 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/udevtest.c b/udevtest.c index 418d43de14..7b3ea6311d 100644 --- a/udevtest.c +++ b/udevtest.c @@ -90,9 +90,9 @@ out: int main(int argc, char *argv[], char *envp[]) { int force = 0; - char *action = "add"; - char *subsystem = NULL; - char *devpath = NULL; + const char *action = "add"; + const char *subsystem = NULL; + const char *devpath = NULL; struct udevice *udev; struct sysfs_device *dev; struct udev_rules rules = {}; diff --git a/udevtrigger.8 b/udevtrigger.8 index 58a379495f..5ef9e8f812 100644 --- a/udevtrigger.8 +++ b/udevtrigger.8 @@ -14,7 +14,7 @@ udevtrigger \- request kernel devices events for coldplug .SH "SYNOPSIS" .HP 12 -\fBudevtrigger\fR [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] [\fB\-\-retry\-failed\fR] [\fB\-\-help\fR] [\fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR] [\fB\-\-attr\-nomatch=\fR\fB\fIattribute=value\fR\fR] +\fBudevtrigger\fR [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] [\fB\-\-retry\-failed\fR] [\fB\-\-help\fR] [\fB\-\-action=\fR\fB\fIaction\fR\fR] [\fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR] [\fB\-\-attr\-nomatch=\fR\fB\fIattribute=value\fR\fR] .SH "DESCRIPTION" .PP Trigger kernel device uevents to replay missing events at system coldplug. @@ -35,6 +35,11 @@ Do not actually trigger the event. Trigger only the events which are failed during a previous run. .RE .PP +\fB\-\-action=\fR\fB\fIaction\fR\fR +.RS 4 +Type of event to be triggered. The default value is "add". +.RE +.PP \fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR .RS 4 Trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and supports shell style pattern matching. diff --git a/udevtrigger.c b/udevtrigger.c index 3b5be2006e..4ef9612af0 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -101,7 +101,7 @@ static int device_list_insert(const char *path) return 0; } -static void trigger_uevent(const char *devpath) +static void trigger_uevent(const char *devpath, const char *action) { char filename[PATH_SIZE]; int fd; @@ -122,13 +122,13 @@ static void trigger_uevent(const char *devpath) return; } - if (write(fd, "add", 3) < 0) - info("error on triggering %s: %s", filename, strerror(errno)); + if (write(fd, action, strlen(action)) < 0) + info("error writing '%s' to '%s': %s", action, filename, strerror(errno)); close(fd); } -static void exec_list(void) +static void exec_list(const char *action) { struct name_entry *loop_device; struct name_entry *tmp_device; @@ -137,14 +137,14 @@ static void exec_list(void) if (delay_device(loop_device->name)) continue; - trigger_uevent(loop_device->name); + trigger_uevent(loop_device->name, action); list_del(&loop_device->node); free(loop_device); } /* trigger remaining delayed devices */ list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - trigger_uevent(loop_device->name); + trigger_uevent(loop_device->name, action); list_del(&loop_device->node); free(loop_device); } @@ -425,11 +425,13 @@ int main(int argc, char *argv[], char *envp[]) { int failed = 0; int option; + const char *action = "add"; static const struct option options[] = { { "verbose", 0, NULL, 'v' }, { "dry-run", 0, NULL, 'n' }, { "retry-failed", 0, NULL, 'F' }, { "help", 0, NULL, 'h' }, + { "action", 1, NULL, 'c' }, { "subsystem-match", 1, NULL, 's' }, { "subsystem-nomatch", 1, NULL, 'S' }, { "attr-match", 1, NULL, 'a' }, @@ -443,7 +445,7 @@ int main(int argc, char *argv[], char *envp[]) sysfs_init(); while (1) { - option = getopt_long(argc, argv, "vnFhs:S:a:A:", options, NULL); + option = getopt_long(argc, argv, "vnFhc:s:S:a:A:", options, NULL); if (option == -1) break; @@ -457,6 +459,9 @@ int main(int argc, char *argv[], char *envp[]) case 'F': failed = 1; break; + case 'c': + action = optarg; + break; case 's': name_list_add(&filter_subsystem_match_list, optarg, 0); break; @@ -511,7 +516,7 @@ int main(int argc, char *argv[], char *envp[]) scan_block(); } } - exec_list(); + exec_list(action); exit: name_list_cleanup(&filter_subsystem_match_list); diff --git a/udevtrigger.xml b/udevtrigger.xml index 60a7b1eaf7..eb2b9851cd 100644 --- a/udevtrigger.xml +++ b/udevtrigger.xml @@ -29,6 +29,7 @@ + @@ -60,6 +61,12 @@ Trigger only the events which are failed during a previous run. + + + + Type of event to be triggered. The default value is "add". + + -- cgit v1.2.3-54-g00ecf From 4110664d4f25f203b7d76ee56e5e23220b04eb69 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 14 Jul 2007 20:43:01 +0200 Subject: add option to RUN key to ignore the return value of the program --- udev.h | 6 ++++-- udev_rules.c | 21 +++++++++++++++------ udev_rules.h | 1 + udev_rules_parse.c | 5 ++++- udev_utils.c | 12 ++++++------ udevd.c | 7 ++++--- 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/udev.h b/udev.h index 64510ed35f..baf58a8163 100644 --- a/udev.h +++ b/udev.h @@ -138,10 +138,12 @@ extern int udev_db_get_all_entries(struct list_head *name_list); struct name_entry { struct list_head node; char name[PATH_SIZE]; + unsigned int ignore_error:1; }; + extern int log_priority(const char *priority); -extern char *name_list_add(struct list_head *name_list, const char *name, int sort); -extern char *name_list_key_add(struct list_head *name_list, const char *key, const char *value); +extern struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort); +extern struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value); extern int name_list_key_remove(struct list_head *name_list, const char *key); extern void name_list_cleanup(struct list_head *name_list); extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); diff --git a/udev_rules.c b/udev_rules.c index cb74da56e3..b2b4809d79 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -911,12 +911,13 @@ try_parent: unsetenv(key_name); info("unset ENV '%s'", key_name); } else { - char *key_value = name_list_key_add(&udev->env_list, key_name, temp_value); + struct name_entry *entry; - if (key_value == NULL) + entry = name_list_key_add(&udev->env_list, key_name, temp_value); + if (entry == NULL) break; - putenv(key_value); - info("set ENV '%s'", key_value); + putenv(entry->name); + info("set ENV '%s'", entry->name); } } } @@ -1100,6 +1101,8 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) } if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { + struct name_entry *entry; + if (rule->run.operation == KEY_OP_ASSIGN_FINAL) udev->run_final = 1; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { @@ -1107,7 +1110,9 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) name_list_cleanup(&udev->run_list); } dbg("add run '%s'", key_val(rule, &rule->run)); - name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); + entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); + if (rule->run_ignore_error) + entry->ignore_error = 1; } if (rule->last_rule) { @@ -1165,13 +1170,17 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) } if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { + struct name_entry *entry; + if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { info("reset run list"); name_list_cleanup(&udev->run_list); } dbg("add run '%s'", key_val(rule, &rule->run)); - name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); + entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); + if (rule->run_ignore_error) + entry->ignore_error = 1; if (rule->run.operation == KEY_OP_ASSIGN_FINAL) break; } diff --git a/udev_rules.h b/udev_rules.h index 682bedac01..038f6da84d 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -99,6 +99,7 @@ struct udev_rule { unsigned int link_priority; unsigned int partitions; unsigned int last_rule:1, + run_ignore_error:1, ignore_device:1, ignore_remove:1; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 9a12d53816..c4fa142b04 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -477,7 +477,10 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strcasecmp(key, "RUN") == 0) { + if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { + attr = get_key_attribute(key + sizeof("RUN")-1); + if (attr && strstr(attr, "ignore_error")) + rule->run_ignore_error = 1; add_rule_key(rule, &rule->run, operation, value); valid = 1; continue; diff --git a/udev_utils.c b/udev_utils.c index 6d646b0ee6..e2f84cf24a 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -54,7 +54,7 @@ int log_priority(const char *priority) return 0; } -char *name_list_add(struct list_head *name_list, const char *name, int sort) +struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort) { struct name_entry *loop_name; struct name_entry *new_name; @@ -63,7 +63,7 @@ char *name_list_add(struct list_head *name_list, const char *name, int sort) /* avoid doubles */ if (strcmp(loop_name->name, name) == 0) { dbg("'%s' is already in the list", name); - return loop_name->name; + return loop_name; } } @@ -81,10 +81,10 @@ char *name_list_add(struct list_head *name_list, const char *name, int sort) dbg("adding '%s'", new_name->name); list_add_tail(&new_name->node, &loop_name->node); - return new_name->name; + return new_name; } -char *name_list_key_add(struct list_head *name_list, const char *key, const char *value) +struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value) { struct name_entry *loop_name; struct name_entry *new_name; @@ -94,7 +94,7 @@ char *name_list_key_add(struct list_head *name_list, const char *key, const char dbg("key already present '%s', replace it", loop_name->name); snprintf(loop_name->name, sizeof(loop_name->name), "%s=%s", key, value); loop_name->name[sizeof(loop_name->name)-1] = '\0'; - return loop_name->name; + return loop_name; } } @@ -107,7 +107,7 @@ char *name_list_key_add(struct list_head *name_list, const char *key, const char dbg("adding '%s'", new_name->name); list_add_tail(&new_name->node, &loop_name->node); - return new_name->name; + return new_name; } int name_list_key_remove(struct list_head *name_list, const char *key) diff --git a/udevd.c b/udevd.c index 0999b5fa75..afefb91483 100644 --- a/udevd.c +++ b/udevd.c @@ -148,8 +148,9 @@ static int udev_event_process(struct udevd_uevent_msg *msg) strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); if (run_program(program, udev->dev->subsystem, NULL, 0, NULL, - (udev_log_priority >= LOG_INFO))) - retval = -1; + (udev_log_priority >= LOG_INFO)) != 0) + if (!name_loop->ignore_error) + retval = -1; } } } @@ -258,7 +259,7 @@ static void udev_event_run(struct udevd_uevent_msg *msg) setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); retval = udev_event_process(msg); - info("seq %llu finished", msg->seqnum); + info("seq %llu finished with %i", msg->seqnum, retval); logging_close(); if (retval) -- cgit v1.2.3-54-g00ecf From fb819f5554530dd136d50aa40438e9dbeeceac01 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 14 Jul 2007 20:43:43 +0200 Subject: use global udev_log variable instead of parameter in run_program --- test-udev.c | 2 +- udev.h | 2 +- udev_rules.c | 5 ++--- udev_utils_run.c | 9 +++++---- udevd.c | 3 +-- udevstart.c | 2 +- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/test-udev.c b/test-udev.c index ba36015911..f114609e5b 100644 --- a/test-udev.c +++ b/test-udev.c @@ -166,7 +166,7 @@ int main(int argc, char *argv[], char *envp[]) strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); - run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + run_program(program, udev->dev->subsystem, NULL, 0, NULL); } } } diff --git a/udev.h b/udev.h index baf58a8163..c056835f39 100644 --- a/udev.h +++ b/udev.h @@ -169,6 +169,6 @@ extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); /* udev_utils_run.c */ extern int pass_env_to_socket(const char *name, const char *devpath, const char *action); extern int run_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen, int log); + char *result, size_t ressize, size_t *reslen); #endif diff --git a/udev_rules.c b/udev_rules.c index b2b4809d79..9483c2b8f8 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -190,7 +190,7 @@ static int import_program_into_env(struct udevice *udev, const char *program) char result[2048]; size_t reslen; - if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_INFO)) != 0) + if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen) != 0) return -1; return import_keys_into_env(udev, result, reslen); } @@ -837,8 +837,7 @@ try_parent: strlcpy(program, key_val(rule, &rule->program), sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); - if (run_program(program, udev->dev->subsystem, result, sizeof(result), - NULL, (udev_log_priority >= LOG_INFO)) != 0) { + if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL) != 0) { dbg("PROGRAM is false"); udev->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) diff --git a/udev_utils_run.c b/udev_utils_run.c index 1a92cddd8a..69b54f47a7 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -69,9 +70,8 @@ int pass_env_to_socket(const char *sockname, const char *devpath, const char *ac } int run_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen, int log) + char *result, size_t ressize, size_t *reslen) { - int retval = 0; int status; int outpipe[2] = {-1, -1}; int errpipe[2] = {-1, -1}; @@ -81,6 +81,7 @@ int run_program(const char *command, const char *subsystem, char *argv[(sizeof(arg) / 2) + 1]; int devnull; int i; + int retval = 0; /* build argv from comand */ strlcpy(arg, command, sizeof(arg)); @@ -109,13 +110,13 @@ int run_program(const char *command, const char *subsystem, info("'%s'", command); /* prepare pipes from child to parent */ - if (result || log) { + if (result != NULL || udev_log_priority >= LOG_INFO) { if (pipe(outpipe) != 0) { err("pipe failed: %s", strerror(errno)); return -1; } } - if (log) { + if (udev_log_priority >= LOG_INFO) { if (pipe(errpipe) != 0) { err("pipe failed: %s", strerror(errno)); return -1; diff --git a/udevd.c b/udevd.c index afefb91483..5ed8e38c98 100644 --- a/udevd.c +++ b/udevd.c @@ -147,8 +147,7 @@ static int udev_event_process(struct udevd_uevent_msg *msg) strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); - if (run_program(program, udev->dev->subsystem, NULL, 0, NULL, - (udev_log_priority >= LOG_INFO)) != 0) + if (run_program(program, udev->dev->subsystem, NULL, 0, NULL) != 0) if (!name_loop->ignore_error) retval = -1; } diff --git a/udevstart.c b/udevstart.c index 6af5860e27..1e67a0615a 100644 --- a/udevstart.c +++ b/udevstart.c @@ -160,7 +160,7 @@ static int add_device(const char *devpath) strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); - run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO)); + run_program(program, udev->dev->subsystem, NULL, 0, NULL); } } } -- cgit v1.2.3-54-g00ecf From 274da2b23d37f2dd174f765e9cfcc485e4a5a898 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 14 Jul 2007 20:44:19 +0200 Subject: add udev_rules_run() to handle RUN list --- test-udev.c | 18 ++---------------- udev_rules.c | 23 +++++++++++++++++++++++ udev_rules.h | 1 + udev_rules_parse.c | 12 +++++++----- udevd.c | 20 ++------------------ udevstart.c | 18 ++---------------- 6 files changed, 37 insertions(+), 55 deletions(-) diff --git a/test-udev.c b/test-udev.c index f114609e5b..0c25778aa6 100644 --- a/test-udev.c +++ b/test-udev.c @@ -154,22 +154,8 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_device_event(&rules, udev); - if (retval == 0 && !udev->ignore_device && udev_run) { - struct name_entry *name_loop; - - dbg("executing run list"); - list_for_each_entry(name_loop, &udev->run_list, node) { - if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) - pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, action); - else { - char program[PATH_SIZE]; - - strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - run_program(program, udev->dev->subsystem, NULL, 0, NULL); - } - } - } + if (retval == 0 && !udev->ignore_device && udev_run) + udev_rules_run(udev); udev_device_cleanup(udev); fail: diff --git a/udev_rules.c b/udev_rules.c index 9483c2b8f8..a8fd18cf8a 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -238,6 +238,29 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) return rc; } +int udev_rules_run(struct udevice *udev) +{ + struct name_entry *name_loop; + int retval = 0; + + dbg("executing run list"); + list_for_each_entry(name_loop, &udev->run_list, node) { + if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) { + pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, udev->action); + } else { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); + if (run_program(program, udev->dev->subsystem, NULL, 0, NULL) != 0) + if (!name_loop->ignore_error) + retval = -1; + } + } + + return retval; +} + #define WAIT_LOOP_PER_SECOND 50 static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) { diff --git a/udev_rules.h b/udev_rules.h index 038f6da84d..556f55087d 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -123,6 +123,7 @@ extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const c extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev); extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev); +extern int udev_rules_run(struct udevice *udev); extern void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize); diff --git a/udev_rules_parse.c b/udev_rules_parse.c index c4fa142b04..638ea159fb 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -425,13 +425,13 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { attr = get_key_attribute(key + sizeof("IMPORT")-1); - if (attr && strstr(attr, "program")) { + if (attr != NULL && strstr(attr, "program")) { dbg("IMPORT will be executed"); rule->import_type = IMPORT_PROGRAM; - } else if (attr && strstr(attr, "file")) { + } else if (attr != NULL && strstr(attr, "file")) { dbg("IMPORT will be included as file"); rule->import_type = IMPORT_FILE; - } else if (attr && strstr(attr, "parent")) { + } else if (attr != NULL && strstr(attr, "parent")) { dbg("IMPORT will include the parent values"); rule->import_type = IMPORT_PARENT; } else { @@ -479,8 +479,10 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { attr = get_key_attribute(key + sizeof("RUN")-1); - if (attr && strstr(attr, "ignore_error")) - rule->run_ignore_error = 1; + if (attr != NULL) { + if (strstr(attr, "ignore_error")) + rule->run_ignore_error = 1; + } add_rule_key(rule, &rule->run, operation, value); valid = 1; continue; diff --git a/udevd.c b/udevd.c index 5ed8e38c98..7dedf078f3 100644 --- a/udevd.c +++ b/udevd.c @@ -135,24 +135,8 @@ static int udev_event_process(struct udevd_uevent_msg *msg) retval = udev_device_event(&rules, udev); /* run programs collected by RUN-key*/ - if (retval == 0 && !udev->ignore_device && udev_run) { - struct name_entry *name_loop; - - dbg("executing run list"); - list_for_each_entry(name_loop, &udev->run_list, node) { - if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) - pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, udev->action); - else { - char program[PATH_SIZE]; - - strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - if (run_program(program, udev->dev->subsystem, NULL, 0, NULL) != 0) - if (!name_loop->ignore_error) - retval = -1; - } - } - } + if (retval == 0 && !udev->ignore_device && udev_run) + retval = udev_rules_run(udev); udev_device_cleanup(udev); return retval; diff --git a/udevstart.c b/udevstart.c index 1e67a0615a..66b96a2186 100644 --- a/udevstart.c +++ b/udevstart.c @@ -148,22 +148,8 @@ static int add_device(const char *devpath) else info("device node creation supressed"); - if (retval == 0 && udev_run) { - struct name_entry *name_loop; - - dbg("executing run list"); - list_for_each_entry(name_loop, &udev->run_list, node) { - if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) - pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, "add"); - else { - char program[PATH_SIZE]; - - strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - run_program(program, udev->dev->subsystem, NULL, 0, NULL); - } - } - } + if (retval == 0 && udev_run) + udev_rules_run(udev); exit: udev_device_cleanup(udev); -- cgit v1.2.3-54-g00ecf From e2ecb34ffd4fd8b0d31a65ec0c59dc4f8023ad6d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 14 Jul 2007 20:59:03 +0200 Subject: move udev_utils_run.c into udev_rules.c --- Makefile | 6 +- udev.h | 5 - udev_rules.c | 251 ++++++++++++++++++++++++++++++++++++++++++++++++ udev_utils_run.c | 283 ------------------------------------------------------- 4 files changed, 256 insertions(+), 289 deletions(-) delete mode 100644 udev_utils_run.c diff --git a/Makefile b/Makefile index 1571e82326..63142ca6b5 100644 --- a/Makefile +++ b/Makefile @@ -73,7 +73,6 @@ UDEV_OBJS = \ udev_utils.o \ udev_utils_string.o \ udev_utils_file.o \ - udev_utils_run.o \ udev_sysdeps.o LIBUDEV = libudev.a @@ -220,6 +219,7 @@ clean: $(Q) - rm -f core $(PROGRAMS) $(GEN_HEADERS) $(Q) - rm -f udev-$(VERSION).tar.gz $(Q) - rm -f udev-$(VERSION).tar.bz2 + $(Q) - rm -f udev-git-HEAD.patch @ extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; @@ -346,6 +346,10 @@ release: git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 .PHONY: release +patch: + git diff $(shell echo $$(($(VERSION) - 1))) HEAD > udev-git-HEAD.patch +.PHONY: patch + gcov-all: $(MAKE) clean all USE_GCOV=true @ echo diff --git a/udev.h b/udev.h index c056835f39..9b22c42b8c 100644 --- a/udev.h +++ b/udev.h @@ -166,9 +166,4 @@ extern void file_unmap(void *buf, size_t bufsize); extern int unlink_secure(const char *filename); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); -/* udev_utils_run.c */ -extern int pass_env_to_socket(const char *name, const char *devpath, const char *action); -extern int run_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen); - #endif diff --git a/udev_rules.c b/udev_rules.c index a8fd18cf8a..400ebad9e3 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -27,12 +27,15 @@ #include #include #include +#include +#include #include #include #include "udev.h" #include "udev_rules.h" +extern char **environ; /* extract possible {attr} and move str behind it */ static char *get_format_attribute(char **str) @@ -113,6 +116,219 @@ out: return 0; } +static int run_program(const char *command, const char *subsystem, + char *result, size_t ressize, size_t *reslen) +{ + int status; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[PATH_SIZE]; + char program[PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; + int devnull; + int i; + int retval = 0; + + /* build argv from comand */ + strlcpy(arg, command, sizeof(arg)); + i = 0; + if (strchr(arg, ' ') != NULL) { + char *pos = arg; + + while (pos != NULL) { + if (pos[0] == '\'') { + /* don't separate if in apostrophes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos != NULL && pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg("arg[%i] '%s'", i, argv[i]); + i++; + } + argv[i] = NULL; + } else { + argv[0] = arg; + argv[1] = NULL; + } + info("'%s'", command); + + /* prepare pipes from child to parent */ + if (result != NULL || udev_log_priority >= LOG_INFO) { + if (pipe(outpipe) != 0) { + err("pipe failed: %s", strerror(errno)); + return -1; + } + } + if (udev_log_priority >= LOG_INFO) { + if (pipe(errpipe) != 0) { + err("pipe failed: %s", strerror(errno)); + return -1; + } + } + + /* allow programs in /lib/udev called without the path */ + if (strchr(argv[0], '/') == NULL) { + strlcpy(program, "/lib/udev/", sizeof(program)); + strlcat(program, argv[0], sizeof(program)); + argv[0] = program; + } + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent ends of pipes */ + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* discard child output or connect to pipe */ + devnull = open("/dev/null", O_RDWR); + if (devnull > 0) { + dup2(devnull, STDIN_FILENO); + if (outpipe[WRITE_END] < 0) + dup2(devnull, STDOUT_FILENO); + if (errpipe[WRITE_END] < 0) + dup2(devnull, STDERR_FILENO); + close(devnull); + } else + err("open /dev/null failed: %s", strerror(errno)); + if (outpipe[WRITE_END] > 0) { + dup2(outpipe[WRITE_END], STDOUT_FILENO); + close(outpipe[WRITE_END]); + } + if (errpipe[WRITE_END] > 0) { + dup2(errpipe[WRITE_END], STDERR_FILENO); + close(errpipe[WRITE_END]); + } + execv(argv[0], argv); + if (errno == ENOENT || errno == ENOTDIR) { + /* may be on a filesytem which is not mounted right now */ + info("program '%s' not found", argv[0]); + } else { + /* other problems */ + err("exec of program '%s' failed", argv[0]); + } + _exit(1); + case -1: + err("fork of '%s' failed: %s", argv[0], strerror(errno)); + return -1; + default: + /* read from child if requested */ + if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + ssize_t count; + size_t respos = 0; + + /* parent closes child ends of pipes */ + if (outpipe[WRITE_END] > 0) + close(outpipe[WRITE_END]); + if (errpipe[WRITE_END] > 0) + close(errpipe[WRITE_END]); + + /* read child output */ + while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + int fdcount; + fd_set readfds; + + FD_ZERO(&readfds); + if (outpipe[READ_END] > 0) + FD_SET(outpipe[READ_END], &readfds); + if (errpipe[READ_END] > 0) + FD_SET(errpipe[READ_END], &readfds); + fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno == EINTR) + continue; + retval = -1; + break; + } + + /* get stdout */ + if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { + char inbuf[1024]; + char *pos; + char *line; + + count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); + if (count <= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + if (count < 0) { + err("stdin read failed: %s", strerror(errno)); + retval = -1; + } + continue; + } + inbuf[count] = '\0'; + + /* store result for rule processing */ + if (result) { + if (respos + count < ressize) { + memcpy(&result[respos], inbuf, count); + respos += count; + } else { + err("ressize %ld too short", (long)ressize); + retval = -1; + } + } + pos = inbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info("'%s' (stdout) '%s'", argv[0], line); + } + + /* get stderr */ + if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { + char errbuf[1024]; + char *pos; + char *line; + + count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); + if (count <= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + if (count < 0) + err("stderr read failed: %s", strerror(errno)); + continue; + } + errbuf[count] = '\0'; + pos = errbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info("'%s' (stderr) '%s'", argv[0], line); + } + } + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* return the childs stdout string */ + if (result) { + result[respos] = '\0'; + dbg("result='%s'", result); + if (reslen) + *reslen = respos; + } + } + waitpid(pid, &status, 0); + if (WIFEXITED(status)) { + info("'%s' returned with status %i", argv[0], WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + retval = -1; + } else { + err("'%s' abnormal exit", argv[0]); + retval = -1; + } + } + + return retval; +} + static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bufsize) { char line[LINE_SIZE]; @@ -238,6 +454,41 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) return rc; } +static int pass_env_to_socket(const char *sockname, const char *devpath, const char *action) +{ + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; + char buf[2048]; + size_t bufpos = 0; + int i; + ssize_t count; + int retval = 0; + + dbg("pass environment to socket '%s'", sockname); + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + /* abstract namespace only */ + strcpy(&saddr.sun_path[1], sockname); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + + bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); + bufpos++; + for (i = 0; environ[i] != NULL && bufpos < sizeof(buf); i++) { + bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); + bufpos++; + } + + count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, addrlen); + if (count < 0) + retval = -1; + info("passed %zi bytes to socket '%s', ", count, sockname); + + close(sock); + return retval; +} + int udev_rules_run(struct udevice *udev) { struct name_entry *name_loop; diff --git a/udev_utils_run.c b/udev_utils_run.c deleted file mode 100644 index 69b54f47a7..0000000000 --- a/udev_utils_run.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright (C) 2004-2005 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -extern char **environ; - -int pass_env_to_socket(const char *sockname, const char *devpath, const char *action) -{ - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; - char buf[2048]; - size_t bufpos = 0; - int i; - ssize_t count; - int retval = 0; - - dbg("pass environment to socket '%s'", sockname); - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - /* abstract namespace only */ - strcpy(&saddr.sun_path[1], sockname); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; - - bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); - bufpos++; - for (i = 0; environ[i] != NULL && bufpos < sizeof(buf); i++) { - bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); - bufpos++; - } - - count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, addrlen); - if (count < 0) - retval = -1; - info("passed %zi bytes to socket '%s', ", count, sockname); - - close(sock); - return retval; -} - -int run_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen) -{ - int status; - int outpipe[2] = {-1, -1}; - int errpipe[2] = {-1, -1}; - pid_t pid; - char arg[PATH_SIZE]; - char program[PATH_SIZE]; - char *argv[(sizeof(arg) / 2) + 1]; - int devnull; - int i; - int retval = 0; - - /* build argv from comand */ - strlcpy(arg, command, sizeof(arg)); - i = 0; - if (strchr(arg, ' ') != NULL) { - char *pos = arg; - - while (pos != NULL) { - if (pos[0] == '\'') { - /* don't separate if in apostrophes */ - pos++; - argv[i] = strsep(&pos, "\'"); - while (pos != NULL && pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - } - dbg("arg[%i] '%s'", i, argv[i]); - i++; - } - argv[i] = NULL; - } else { - argv[0] = arg; - argv[1] = NULL; - } - info("'%s'", command); - - /* prepare pipes from child to parent */ - if (result != NULL || udev_log_priority >= LOG_INFO) { - if (pipe(outpipe) != 0) { - err("pipe failed: %s", strerror(errno)); - return -1; - } - } - if (udev_log_priority >= LOG_INFO) { - if (pipe(errpipe) != 0) { - err("pipe failed: %s", strerror(errno)); - return -1; - } - } - - /* allow programs in /lib/udev called without the path */ - if (strchr(argv[0], '/') == NULL) { - strlcpy(program, "/lib/udev/", sizeof(program)); - strlcat(program, argv[0], sizeof(program)); - argv[0] = program; - } - - pid = fork(); - switch(pid) { - case 0: - /* child closes parent ends of pipes */ - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* discard child output or connect to pipe */ - devnull = open("/dev/null", O_RDWR); - if (devnull > 0) { - dup2(devnull, STDIN_FILENO); - if (outpipe[WRITE_END] < 0) - dup2(devnull, STDOUT_FILENO); - if (errpipe[WRITE_END] < 0) - dup2(devnull, STDERR_FILENO); - close(devnull); - } else - err("open /dev/null failed: %s", strerror(errno)); - if (outpipe[WRITE_END] > 0) { - dup2(outpipe[WRITE_END], STDOUT_FILENO); - close(outpipe[WRITE_END]); - } - if (errpipe[WRITE_END] > 0) { - dup2(errpipe[WRITE_END], STDERR_FILENO); - close(errpipe[WRITE_END]); - } - execv(argv[0], argv); - if (errno == ENOENT || errno == ENOTDIR) { - /* may be on a filesytem which is not mounted right now */ - info("program '%s' not found", argv[0]); - } else { - /* other problems */ - err("exec of program '%s' failed", argv[0]); - } - _exit(1); - case -1: - err("fork of '%s' failed: %s", argv[0], strerror(errno)); - return -1; - default: - /* read from child if requested */ - if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - ssize_t count; - size_t respos = 0; - - /* parent closes child ends of pipes */ - if (outpipe[WRITE_END] > 0) - close(outpipe[WRITE_END]); - if (errpipe[WRITE_END] > 0) - close(errpipe[WRITE_END]); - - /* read child output */ - while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - int fdcount; - fd_set readfds; - - FD_ZERO(&readfds); - if (outpipe[READ_END] > 0) - FD_SET(outpipe[READ_END], &readfds); - if (errpipe[READ_END] > 0) - FD_SET(errpipe[READ_END], &readfds); - fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno == EINTR) - continue; - retval = -1; - break; - } - - /* get stdout */ - if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { - char inbuf[1024]; - char *pos; - char *line; - - count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); - if (count <= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - if (count < 0) { - err("stdin read failed: %s", strerror(errno)); - retval = -1; - } - continue; - } - inbuf[count] = '\0'; - - /* store result for rule processing */ - if (result) { - if (respos + count < ressize) { - memcpy(&result[respos], inbuf, count); - respos += count; - } else { - err("ressize %ld too short", (long)ressize); - retval = -1; - } - } - pos = inbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info("'%s' (stdout) '%s'", argv[0], line); - } - - /* get stderr */ - if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { - char errbuf[1024]; - char *pos; - char *line; - - count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); - if (count <= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - if (count < 0) - err("stderr read failed: %s", strerror(errno)); - continue; - } - errbuf[count] = '\0'; - pos = errbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info("'%s' (stderr) '%s'", argv[0], line); - } - } - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* return the childs stdout string */ - if (result) { - result[respos] = '\0'; - dbg("result='%s'", result); - if (reslen) - *reslen = respos; - } - } - waitpid(pid, &status, 0); - if (WIFEXITED(status)) { - info("'%s' returned with status %i", argv[0], WEXITSTATUS(status)); - if (WEXITSTATUS(status) != 0) - retval = -1; - } else { - err("'%s' abnormal exit", argv[0]); - retval = -1; - } - } - - return retval; -} -- cgit v1.2.3-54-g00ecf From 84654a89135a0044f1abc380b1bd5f8c29637120 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 14 Jul 2007 21:01:51 +0200 Subject: rules: SUSE update --- etc/udev/suse/50-udev-default.rules | 1 + etc/udev/suse/80-drivers.rules | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 32e5008e79..1d57f0a836 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -90,6 +90,7 @@ KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_device # block devices SUBSYSTEM=="block", GROUP="disk", MODE="0640" +SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC # sr: 4 TYPE_WORM, 5 TYPE_ROM diff --git a/etc/udev/suse/80-drivers.rules b/etc/udev/suse/80-drivers.rules index 0351b11d32..51c4bf4e90 100644 --- a/etc/udev/suse/80-drivers.rules +++ b/etc/udev/suse/80-drivers.rules @@ -1,8 +1,8 @@ ACTION!="add", GOTO="drivers_end" -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe --quiet $env{MODALIAS}" +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe --quiet pnp:d$$id; done < /sys$devpath/id'" +SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --quiet -all tifm_sd tifm_ms" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" -- cgit v1.2.3-54-g00ecf From 9aeded07a0229a64cdc1ec8999ad2e2c58e4d38f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 15 Jul 2007 19:01:01 +0200 Subject: name_list: rename loop_name -> name_loop --- udev_utils.c | 68 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/udev_utils.c b/udev_utils.c index e2f84cf24a..e1630b67b5 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -56,68 +56,68 @@ int log_priority(const char *priority) struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort) { - struct name_entry *loop_name; - struct name_entry *new_name; + struct name_entry *name_loop; + struct name_entry *name_new; - list_for_each_entry(loop_name, name_list, node) { - /* avoid doubles */ - if (strcmp(loop_name->name, name) == 0) { + /* avoid duplicate entries */ + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) == 0) { dbg("'%s' is already in the list", name); - return loop_name; + return name_loop; } } if (sort) - list_for_each_entry(loop_name, name_list, node) { - if (sort && strcmp(loop_name->name, name) > 0) + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) > 0) break; } - new_name = malloc(sizeof(struct name_entry)); - if (new_name == NULL) + name_new = malloc(sizeof(struct name_entry)); + if (name_new == NULL) return NULL; - strlcpy(new_name->name, name, sizeof(new_name->name)); - dbg("adding '%s'", new_name->name); - list_add_tail(&new_name->node, &loop_name->node); + strlcpy(name_new->name, name, sizeof(name_new->name)); + dbg("adding '%s'", name_new->name); + list_add_tail(&name_new->node, &name_loop->node); - return new_name; + return name_new; } struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value) { - struct name_entry *loop_name; - struct name_entry *new_name; - - list_for_each_entry(loop_name, name_list, node) { - if (strncmp(loop_name->name, key, strlen(key)) == 0) { - dbg("key already present '%s', replace it", loop_name->name); - snprintf(loop_name->name, sizeof(loop_name->name), "%s=%s", key, value); - loop_name->name[sizeof(loop_name->name)-1] = '\0'; - return loop_name; + struct name_entry *name_loop; + struct name_entry *name_new; + + list_for_each_entry(name_loop, name_list, node) { + if (strncmp(name_loop->name, key, strlen(key)) == 0) { + dbg("key already present '%s', replace it", name_loop->name); + snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); + name_loop->name[sizeof(name_loop->name)-1] = '\0'; + return name_loop; } } - new_name = malloc(sizeof(struct name_entry)); - if (new_name == NULL) + name_new = malloc(sizeof(struct name_entry)); + if (name_new == NULL) return NULL; - snprintf(new_name->name, sizeof(new_name->name), "%s=%s", key, value); - new_name->name[sizeof(new_name->name)-1] = '\0'; - dbg("adding '%s'", new_name->name); - list_add_tail(&new_name->node, &loop_name->node); + snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); + name_new->name[sizeof(name_new->name)-1] = '\0'; + dbg("adding '%s'", name_new->name); + list_add_tail(&name_new->node, &name_loop->node); - return new_name; + return name_new; } int name_list_key_remove(struct list_head *name_list, const char *key) { struct name_entry *name_loop; - struct name_entry *temp_loop; + struct name_entry *name_tmp; size_t keylen = strlen(key); int retval = 0; - list_for_each_entry_safe(name_loop, temp_loop, name_list, node) { + list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { if (strncmp(name_loop->name, key, keylen) != 0) continue; if (name_loop->name[keylen] != '=') @@ -133,9 +133,9 @@ int name_list_key_remove(struct list_head *name_list, const char *key) void name_list_cleanup(struct list_head *name_list) { struct name_entry *name_loop; - struct name_entry *temp_loop; + struct name_entry *name_tmp; - list_for_each_entry_safe(name_loop, temp_loop, name_list, node) { + list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { list_del(&name_loop->node); free(name_loop); } -- cgit v1.2.3-54-g00ecf From 254d6d3ca2188a396706b363d0840431d360fbd9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 15 Jul 2007 19:10:06 +0200 Subject: handle dynamic rules created in /dev/.udev/rules.d/ --- udev.h | 1 + udev_rules_parse.c | 75 ++++++++++++++++++++++++++++++++++++++---------------- udev_utils_file.c | 2 +- udevd.c | 17 +++++++++---- 4 files changed, 67 insertions(+), 28 deletions(-) diff --git a/udev.h b/udev.h index 9b22c42b8c..f13eb8366e 100644 --- a/udev.h +++ b/udev.h @@ -49,6 +49,7 @@ #define DB_DIR ".udev/db" #define DB_NAME_INDEX_DIR ".udev/names" +#define RULES_DYN_DIR ".udev/rules.d" struct udev_rules; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 638ea159fb..124410a340 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -438,7 +438,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena /* figure it out if it is executable */ char file[PATH_SIZE]; char *pos; - struct stat stats; + struct stat statbuf; strlcpy(file, value, sizeof(file)); pos = strchr(file, ' '); @@ -455,7 +455,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } dbg("IMPORT auto mode for '%s'", file); - if (!lstat(file, &stats) && (stats.st_mode & S_IXUSR)) { + if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { dbg("IMPORT is executable, will be executed (autotype)"); rule->import_type = IMPORT_PROGRAM; } else { @@ -593,7 +593,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena pos = strstr(value, "link_priority="); if (pos != NULL) { rule->link_priority = atoi(&pos[strlen("link_priority=")]); - info("link priority=%i", rule->link_priority); + dbg("link priority=%i", rule->link_priority); } pos = strstr(value, "string_escape="); if (pos != NULL) { @@ -709,39 +709,70 @@ static int parse_file(struct udev_rules *rules, const char *filename) int udev_rules_init(struct udev_rules *rules, int resolve_names) { - struct stat stats; - int retval; + struct stat statbuf; + char filename[PATH_MAX]; + LIST_HEAD(name_list); + LIST_HEAD(dyn_list); + struct name_entry *name_loop, *name_tmp; + struct name_entry *dyn_loop, *dyn_tmp; + int retval = 0; memset(rules, 0x00, sizeof(struct udev_rules)); rules->resolve_names = resolve_names; - /* parse rules file or all matching files in directory */ - if (stat(udev_rules_dir, &stats) != 0) + /* read main config from single file or all files in a directory */ + if (stat(udev_rules_dir, &statbuf) != 0) return -1; - - if ((stats.st_mode & S_IFMT) != S_IFDIR) { + if ((statbuf.st_mode & S_IFMT) != S_IFDIR) { dbg("parse single rules file '%s'", udev_rules_dir); - retval = parse_file(rules, udev_rules_dir); + name_list_add(&name_list, udev_rules_dir, 1); } else { - struct name_entry *name_loop, *name_tmp; - LIST_HEAD(name_list); - dbg("parse rules directory '%s'", udev_rules_dir); retval = add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX); + } + + /* read dynamic rules directory */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); + if (stat(filename, &statbuf) != 0) { + create_path(filename); + mkdir(filename, 0755); + } + add_matching_files(&dyn_list, filename, RULESFILE_SUFFIX); + + /* sort dynamic rules files by basename into list of files */ + list_for_each_entry_safe(dyn_loop, dyn_tmp, &dyn_list, node) { + const char *dyn_base = strrchr(dyn_loop->name, '/'); + + if (dyn_base == NULL) + continue; list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - if (stat(name_loop->name, &stats) == 0) { - if (stats.st_size) - parse_file(rules, name_loop->name); - else - dbg("empty rules file '%s'", name_loop->name); - } else - err("could not read '%s': %s", name_loop->name, strerror(errno)); - list_del(&name_loop->node); - free(name_loop); + const char *name_base = strrchr(name_loop->name, '/'); + + if (name_base == NULL) + continue; + + if (strcmp(name_base, dyn_base) > 0) { + list_move_tail(&dyn_loop->node, &name_loop->node); + break; + } } } + /* parse list of files */ + list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { + if (stat(name_loop->name, &statbuf) == 0) { + if (statbuf.st_size) + parse_file(rules, name_loop->name); + else + dbg("empty rules file '%s'", name_loop->name); + } else + err("could not read '%s': %s", name_loop->name, strerror(errno)); + list_del(&name_loop->node); + free(name_loop); + } + return retval; } diff --git a/udev_utils_file.c b/udev_utils_file.c index 44c3686361..0ceefe1720 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -49,7 +49,7 @@ int create_path(const char *path) if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) return 0; - if (create_path (p) != 0) + if (create_path(p) != 0) return -1; dbg("mkdir '%s'", p); diff --git a/udevd.c b/udevd.c index 7dedf078f3..69572c6268 100644 --- a/udevd.c +++ b/udevd.c @@ -1102,10 +1102,17 @@ int main(int argc, char *argv[], char *envp[]) /* watch rules directory */ inotify_fd = inotify_init(); - if (inotify_fd >= 0) + if (inotify_fd >= 0) { + char filename[PATH_MAX]; + inotify_add_watch(inotify_fd, udev_rules_dir, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - else if (errno == ENOSYS) - err("the kernel does not support inotify, udevd can't monitor configuration file changes"); + + /* watch dynamic rules directory */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); + inotify_add_watch(inotify_fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + } else if (errno == ENOSYS) + err("the kernel does not support inotify, udevd can't monitor rules file changes"); else err("inotify_init failed: %s", strerror(errno)); @@ -1190,12 +1197,12 @@ int main(int argc, char *argv[], char *envp[]) int nbytes; /* discard all possible events, we can just reload the config */ - if ((ioctl(inotify_fd, FIONREAD, &nbytes) == 0) && nbytes) { + if ((ioctl(inotify_fd, FIONREAD, &nbytes) == 0) && nbytes > 0) { char *buf; reload_config = 1; buf = malloc(nbytes); - if (!buf) { + if (buf != NULL) { err("error getting buffer for inotify, disable watching"); close(inotify_fd); inotify_fd = -1; -- cgit v1.2.3-54-g00ecf From 1ff1aa424baa05a0fd06deeb6609a11b289ecd65 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Jul 2007 13:29:28 +0200 Subject: allow SYMLINK== match --- test/udev-test.pl | 12 ------------ udev_rules.c | 32 ++++++++++++++++++++++++++------ udev_rules.h | 1 + udev_rules_parse.c | 6 +++++- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 53499d8871..a2043080e9 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1516,18 +1516,6 @@ KERNEL=="sda2", NAME="wrong" KERNEL=="sda1", NAME=="wrong*", SYMLINK+="wronglink" KERNEL=="sda1", NAME=="?*", SYMLINK+="link" KERNEL=="sda1", NAME=="node*", SYMLINK+="link2" -EOF - }, - { - desc => "NAME compare test 2", - subsys => "block", - devpath => "/block/sda/sda1", - exp_name => "link2", - exp_target => "sda1", - not_exp_name => "link", - rules => <driver, udev->dev->driver)) goto nomatch; - /* match NAME against a value assigned by an earlier rule */ if (match_key("NAME", rule, &rule->name, udev->name)) goto nomatch; + /* match against current list of symlinks */ + if (rule->symlink_match.operation == KEY_OP_MATCH || + rule->symlink_match.operation == KEY_OP_NOMATCH) { + struct name_entry *name_loop; + int match = 0; + + list_for_each_entry(name_loop, &udev->symlink_list, node) { + if (match_key("SYMLINK", rule, &rule->symlink_match, name_loop->name) == 0) { + match = 1; + break; + } + } + if (!match) + goto nomatch; + } + for (i = 0; i < rule->env.count; i++) { struct key_pair *pair = &rule->env.keys[i]; @@ -1250,6 +1265,9 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) dbg("udev->dev->devpath='%s'", udev->dev->devpath); dbg("udev->dev->kernel='%s'", udev->dev->kernel); + /* use kernel name as default node name */ + strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); + /* look for a matching rule to apply */ udev_rules_iter_init(rules); while (1) { @@ -1311,14 +1329,18 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) } /* collect symlinks */ - if (!udev->symlink_final && rule->symlink.operation != KEY_OP_UNSET) { + if (!udev->symlink_final && + (rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL || + rule->symlink.operation == KEY_OP_ADD)) { char temp[PATH_SIZE]; char *pos, *next; int count; if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) udev->symlink_final = 1; - if (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { + if (rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { info("reset symlink list"); name_list_cleanup(&udev->symlink_list); } @@ -1400,10 +1422,8 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) } } - if (!name_set) { - strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); + if (!name_set) info("no node name set, will use kernel name '%s'", udev->name); - } if (udev->tmp_node[0] != '\0') { dbg("removing temporary device node"); diff --git a/udev_rules.h b/udev_rules.h index 556f55087d..0ad4ec3271 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -90,6 +90,7 @@ struct udev_rule { struct key name; struct key symlink; + struct key symlink_match; struct key owner; struct key group; mode_t mode; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 124410a340..81c24b9cc1 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -525,7 +525,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strcasecmp(key, "SYMLINK") == 0) { - add_rule_key(rule, &rule->symlink, operation, value); + if (operation == KEY_OP_MATCH || + operation == KEY_OP_NOMATCH) + add_rule_key(rule, &rule->symlink_match, operation, value); + else + add_rule_key(rule, &rule->symlink, operation, value); valid = 1; continue; } -- cgit v1.2.3-54-g00ecf From 2ff5082a7409b0cf9af0e520e616d3a698a19d56 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Sun, 22 Jul 2007 00:09:19 +0200 Subject: Makefile: add "make dist" for nightly snapshots --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 63142ca6b5..acf3ae42a3 100644 --- a/Makefile +++ b/Makefile @@ -346,6 +346,11 @@ release: git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 .PHONY: release +dist: + git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | gzip -9v > udev-$(VERSION).tar.gz + git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 +.PHONY: dist + patch: git diff $(shell echo $$(($(VERSION) - 1))) HEAD > udev-git-HEAD.patch .PHONY: patch -- cgit v1.2.3-54-g00ecf From 9ea893ae25aaedbad9b91a9f49114abcb79135b7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 22 Jul 2007 19:58:04 +0200 Subject: libvolume_id: use /usr/$libdir in pc file --- extras/volume_id/lib/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 328758d039..0a37c26e8b 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 78 +SHLIB_REV = 79 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) @@ -91,8 +91,7 @@ $(SHLIB): $(HEADERS) exported_symbols $(addprefix .shlib/,$(OBJS)) libvolume_id.pc: $(E) " GENPC " $@ - $(Q) echo "prefix=${prefix}" > $@ - $(Q) echo "libdir=${libdir}" >> $@ + $(Q) echo "libdir=${usrlibdir}" >> $@ $(Q) echo "includedir=${includedir}" >> $@ $(Q) echo "" >> $@ $(Q) echo "Name: libvolume_id" >> $@ -- cgit v1.2.3-54-g00ecf From c7ae0d343bfe168975e01ca4f1026dd52a7f044d Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Tue, 24 Jul 2007 13:28:18 +0200 Subject: collect: extra to synchronize actions across events --- extras/collect/Makefile | 64 +++++++ extras/collect/collect.c | 429 +++++++++++++++++++++++++++++++++++++++++++++ test/simple-build-check.sh | 1 + 3 files changed, 494 insertions(+) create mode 100644 extras/collect/Makefile create mode 100644 extras/collect/collect.c diff --git a/extras/collect/Makefile b/extras/collect/Makefile new file mode 100644 index 0000000000..6168a8b805 --- /dev/null +++ b/extras/collect/Makefile @@ -0,0 +1,64 @@ +# Makefile for udev extra invoked by the udev main Makefile + +PROG = collect +OBJ = +HEADERS = +GEN_HEADERS = +MAN_PAGES = + +prefix = +etcdir = ${prefix}/etc +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev +mandir = ${prefix}/usr/share/man +configdir = ${etcdir}/udev/ + +INSTALL = install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL} + +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all + +%.o: %.c $(GEN_HEADERS) + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ + +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) + +# man pages +%.8: %.xml + $(E) " XMLTO " $@ + $(Q) xmlto man $? +.PRECIOUS: %.8 + +clean: + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean + +install-bin: all + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) +.PHONY: install-bin + +uninstall-bin: + - rm $(DESTDIR)$(libudevdir)/$(PROG) +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: install-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config diff --git a/extras/collect/collect.c b/extras/collect/collect.c new file mode 100644 index 0000000000..0a852f2db2 --- /dev/null +++ b/extras/collect/collect.c @@ -0,0 +1,429 @@ +/* + * Collect variables across events. + * + * usage: collect [--add|--remove] + * + * Adds ID to the list governed by . + * must be part of the ID list . + * If all IDs given by are listed (ie collect has been + * invoked for each ID in ) collect returns 0, the + * number of missing IDs otherwise. + * A negative number is returned on error. + * + * Copyright(C) 2007, Hannes Reinecke + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../list.h" + +#define TMPFILE "/dev/.udev/collect" +#define BUFSIZE 16 +#define UDEV_ALARM_TIMEOUT 180 + +enum collect_state { + STATE_NONE, + STATE_OLD, + STATE_CONFIRMED, +}; + +struct _mate { + struct list_head node; + char *name; + enum collect_state state; +}; + +static LIST_HEAD(bunch); +static int debug; + +/* This can increase dynamically */ +static int bufsize = BUFSIZE; + +static void sig_alrm(int signo) +{ + exit(4); +} + +static void usage(void) +{ + printf("usage: collect [--add|--remove] [--debug] \n" + "\n" + " Adds ID to the list governed by .\n" + " must be part of the list .\n" + " If all IDs given by are listed (ie collect has been\n" + " invoked for each ID in ) collect returns 0, the\n" + " number of missing IDs otherwise.\n" + " On error a negative number is returned.\n" + "\n"); +} + +/* + * prepare + * + * Prepares the database file + */ +static int prepare(char *dir, char *filename) +{ + struct stat statbuf; + char buf[512]; + int fd; + + if (stat(dir, &statbuf) < 0) + mkdir(dir, 0700); + + sprintf(buf, "%s/%s", dir, filename); + + fd = open(buf,O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); + if (fd < 0) + fprintf(stderr, "Cannot open %s: %s\n", buf, strerror(errno)); + + if (lockf(fd,F_TLOCK,0) < 0) { + if (debug) + fprintf(stderr, "Lock taken, wait for %d seconds\n", UDEV_ALARM_TIMEOUT); + if (errno == EAGAIN || errno == EACCES) { + alarm(UDEV_ALARM_TIMEOUT); + lockf(fd, F_LOCK, 0); + if (debug) + fprintf(stderr, "Acquired lock on %s\n", buf); + } else { + if (debug) + fprintf(stderr, "Could not get lock on %s: %s\n", buf, strerror(errno)); + } + } + + return fd; +} + +/* + * Read checkpoint file + * + * Tricky reading this. We allocate a buffer twice as large + * as we're goint to read. Then we read into the upper half + * of that buffer and start parsing. + * Once we do _not_ find end-of-work terminator (whitespace + * character) we move the upper half to the lower half, + * adjust the read pointer and read the next bit. + * Quite clever methinks :-) + * I should become a programmer ... + * + * Yes, one could have used fgets() for this. But then we'd + * have to use freopen etc which I found quite tedious. + */ +static int checkout(int fd) +{ + int len; + char *buf, *ptr, *word = NULL; + struct _mate *him; + + restart: + len = bufsize >> 1; + buf = calloc(1,bufsize + 1); + if (!buf) { + fprintf(stderr, "Out of memory\n"); + return -1; + } + memset(buf, ' ', bufsize); + ptr = buf + len; + while ((read(fd, buf + len, len)) > 0) { + while (ptr && *ptr) { + word = ptr; + ptr = strpbrk(word," \n\t\r"); + if (!ptr && word < (buf + len)) { + bufsize = bufsize << 1; + if (debug) + fprintf(stderr, "ID overflow, restarting with size %d\n", bufsize); + free(buf); + lseek(fd, 0, SEEK_SET); + goto restart; + } + if (ptr) { + *ptr = '\0'; + ptr++; + if (!strlen(word)) + continue; + + if (debug) + fprintf(stderr, "Found word %s\n", word); + him = malloc(sizeof (struct _mate)); + him->name = malloc(strlen(word) + 1); + strcpy(him->name, word); + him->state = STATE_OLD; + list_add_tail(&him->node, &bunch); + word = NULL; + } + } + memcpy(buf, buf + len, len); + memset(buf + len, ' ', len); + + if (!ptr) + ptr = word; + if (!ptr) + break; + ptr -= len; + } + + free(buf); + return 0; +} + +/* + * invite + * + * Adds a new ID 'us' to the internal list, + * marks it as confirmed. + */ +static void invite(char *us) +{ + struct _mate *him, *who; + + if (debug) + fprintf(stderr, "Adding ID '%s'\n", us); + + who = NULL; + list_for_each_entry(him, &bunch, node) { + if (!strcmp(him->name, us)) { + him->state = STATE_CONFIRMED; + who = him; + } + } + if (debug && !who) + fprintf(stderr, "ID '%s' not in database\n", us); + +} + +/* + * reject + * + * Marks the ID 'us' as invalid, + * causing it to be removed when the + * list is written out. + */ +static void reject(char *us) +{ + struct _mate *him, *who; + + if (debug) + fprintf(stderr, "Removing ID '%s'\n", us); + + who = NULL; + list_for_each_entry(him, &bunch, node) { + if (!strcmp(him->name, us)) { + him->state = STATE_NONE; + who = him; + } + } + if (debug && !who) + fprintf(stderr, "ID '%s' not in database\n", us); + +} + +/* + * kickout + * + * Remove all IDs in the internal list which are not part + * of the list passed via the commandline. + */ +static void kickout(void) +{ + struct _mate *him, *them; + + list_for_each_entry_safe(him, them, &bunch, node) { + if (him->state == STATE_OLD) { + list_del(&him->node); + free(him->name); + free(him); + } + } +} + +/* + * missing + * + * Counts all missing IDs in the internal list. + */ +static int missing(int fd) +{ + char *buf; + int ret = 0; + struct _mate *him; + + buf = malloc(bufsize); + if (!buf) + return -1; + + list_for_each_entry(him, &bunch, node) { + if (him->state == STATE_NONE) { + ret++; + } else { + sprintf(buf, "%s ", him->name); + write(fd, buf, strlen(buf)); + } + } + + free(buf); + + return ret; +} + +/* + * everybody + * + * Prints out the status of the internal list. + */ +static void everybody(void) +{ + struct _mate *him; + const char *state = ""; + + list_for_each_entry(him, &bunch, node) { + switch (him->state) { + case STATE_NONE: + state = "none"; + break; + case STATE_OLD: + state = "old"; + break; + case STATE_CONFIRMED: + state = "confirmed"; + break; + fprintf(stderr, "ID: %s=%s\n", him->name, state); + } + } +} + +int main(int argc, char **argv) +{ + static const struct option options[] = { + { "add", 0, NULL, 'a' }, + { "remove", 0, NULL, 'r' }, + { "debug", 0, NULL, 'd' }, + { "help", 0, NULL, 'h' }, + {} + }; + int argi; + char *checkpoint, *us; + struct _mate *him, *who; + int fd; + int i; + int ret = 0; + int prune = 0; + + while (1) { + int option; + + option = getopt_long(argc, argv, "ardh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'a': + prune = 0; + break; + case 'r': + prune = 1; + break; + case 'd': + debug = 1; + break; + case 'h': + usage(); + goto exit; + default: + ret = 1; + goto exit; + } + } + + argi = optind; + if (argi + 2 > argc) { + printf("Missing parameter(s)\n"); + ret = 1; + goto exit; + } + checkpoint = argv[argi++]; + us = argv[argi++]; + + if (signal(SIGALRM, sig_alrm) == SIG_ERR) { + fprintf(stderr, "Cannot set SIGALRM: %s\n", strerror(errno)); + ret = 2; + goto exit; + } + + INIT_LIST_HEAD(&bunch); + + if (debug) + fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); + + fd = prepare(TMPFILE, checkpoint); + if (fd < 0) { + ret = 3; + goto out; + } + + if (checkout(fd) < 0) { + ret = 2; + goto out; + } + + for (i = argi; i < argc; i++) { + who = NULL; + list_for_each_entry(him, &bunch, node) { + if (!strcmp(him->name, argv[i])) + who = him; + } + if (!who) { + if (debug) + fprintf(stderr, "ID %s: not in database\n", argv[i]); + him = malloc(sizeof (struct _mate)); + him->name = malloc(strlen(argv[i]) + 1); + strcpy(him->name, argv[i]); + him->state = STATE_NONE; + list_add_tail(&him->node, &bunch); + } else { + if (debug) + fprintf(stderr, "ID %s: found in database\n", argv[i]); + who->state = STATE_CONFIRMED; + } + } + + if (prune) + reject(us); + else + invite(us); + + if (debug) { + everybody(); + fprintf(stderr, "Prune lists\n"); + } + kickout(); + + lseek(fd, 0, SEEK_SET); + ftruncate(fd, 0); + ret = missing(fd); + + lockf(fd, F_ULOCK, 0); + close(fd); + out: + if (debug) + everybody(); + if (ret >= 0) + printf("COLLECT_%s=%d\n", checkpoint, ret); + exit: + return ret; +} diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index a2cbbfd631..9939b88fb3 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -11,6 +11,7 @@ EXTRAS="\ extras/floppy \ extras/firmware \ extras/path_id \ + extras/collect \ extras/rule_generator" # with debug -- cgit v1.2.3-54-g00ecf From 6d86cda476fd519105e642afae01fff5fc1a3e29 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 24 Jul 2007 18:22:02 +0200 Subject: rules: Gentoo update --- etc/udev/gentoo/50-udev.rules | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/etc/udev/gentoo/50-udev.rules b/etc/udev/gentoo/50-udev.rules index 57f2387a5c..ddabe1acc6 100644 --- a/etc/udev/gentoo/50-udev.rules +++ b/etc/udev/gentoo/50-udev.rules @@ -39,6 +39,7 @@ SUBSYSTEM=="block", GROUP="disk" # cdrom symlinks and other good cdrom naming KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", ACTION=="add", IMPORT{program}="cdrom_id --export $tempnode" ENV{ID_CDROM}=="?*", GROUP="cdrom" +SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" # assign cdrom-permission also to associated generic device (for cd-burning ...) KERNEL=="sg[0-9]*", ACTION=="add", ATTRS{type}=="4|5", GROUP="cdrom" @@ -129,7 +130,8 @@ KERNEL=="dnrtmsg", NAME="netlink/%k" KERNEL=="tap*", NAME="netlink/%k" # network devices -KERNEL=="tun", NAME="net/%k", MODE="0600" +KERNEL=="tun", NAME="net/%k", MODE="0660", OPTIONS+="ignore_remove" +KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" # ramdisk devices KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" @@ -240,15 +242,18 @@ KERNEL=="issm*", NAME="infiniband/%k" # usbfs-like device nodes +# the way to go up to kernel 2.6.21 (and above if setting USB_DEVICE_CLASS=y) SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" +# starting from kernel 2.6.22 use this rule +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ + NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", GROUP="usb", MODE="0664" - -# Setting timeout for tape-devices to 900 seconds +# Setting timeout for tape-devices (type 1) to 900 seconds +# and 60 seconds for device types 0, 7 and 14 # if you need timeouts for other devices add a similar rule # with correct type-value, or open a bug on bugs.gentoo.org. -ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="1", \ - RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" - +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" # Module autoloading ACTION!="add", GOTO="hotplug_no_add_event" @@ -260,10 +265,10 @@ ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_load_end" SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_load_end" # Autoload modules that lack aliases but have them defined inutoload modules -ENV{MODALIAS}=="?*", RUN+="modprobe.sh $env{MODALIAS}" +ENV{MODALIAS}=="?*", RUN{ignore_error}+="modprobe.sh $env{MODALIAS}" # /etc/modprobe.conf. -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" # needed aliases are defined in /etc/modprobe.d/pnp-aliases @@ -277,7 +282,7 @@ SUBSYSTEM=="mmc", RUN+="modprobe.sh mmc_block" # Load driver for scsi-device SUBSYSTEM!="scsi_device", GOTO="hotplug_scsi_end" -ATTRS{type}=="?*", RUN+="modprobe.sh sg" +ATTRS{type}=="?*", TEST!="[module/sg]", RUN+="modprobe.sh sg" ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" ATTRS{type}=="8", RUN+="modprobe.sh ch" -- cgit v1.2.3-54-g00ecf From 76bd9d319e0d4376d14032cd65503da3a6c2529e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jul 2007 15:19:32 +0200 Subject: Makefile: add --as-needed flag to ld --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index acf3ae42a3..8179710be1 100644 --- a/Makefile +++ b/Makefile @@ -118,7 +118,7 @@ WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes CFLAGS += $(WARNINGS) -LDFLAGS += -Wl,-warn-common +LDFLAGS += -Wl,-warn-common,--as-needed OPTFLAGS = -Os CFLAGS += $(OPTFLAGS) -- cgit v1.2.3-54-g00ecf From fea9b2d2924235a459e888ecd35a8b43093b9542 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Wed, 25 Jul 2007 15:24:58 +0200 Subject: add $driver subtitution --- udev.7 | 10 ++++++++++ udev.xml | 9 +++++++++ udev_rules.c | 8 ++++++++ 3 files changed, 27 insertions(+) diff --git a/udev.7 b/udev.7 index d3ed4b71d6..821a476aef 100644 --- a/udev.7 +++ b/udev.7 @@ -335,6 +335,16 @@ and \fBATTRS\fR. .RE .PP +\fB$driver\fR, \fB%d\fR +.RS 4 +The driver name of the device matched while searching the devpath upwards for +\fBSUBSYSTEMS\fR, +\fBKERNELS\fR, +\fBDRIVERS\fR +and +\fBATTRS\fR. +.RE +.PP \fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR .RS 4 The value of a sysfs attribute found at the device, where all keys of the rule have matched. If the matching device does not have such an attribute, all devices along the chain of parents are searched for a matching attribute. If the attribute is a symlink, the last element of the symlink target is returned as the value. diff --git a/udev.xml b/udev.xml index 520c718c7a..b43abb779b 100644 --- a/udev.xml +++ b/udev.xml @@ -487,6 +487,15 @@ + + , + + The driver name of the device matched while searching the devpath upwards for + , , and . + + + + , diff --git a/udev_rules.c b/udev_rules.c index daf3d7fff7..3674a27d63 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -597,6 +597,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) SUBST_KERNEL, SUBST_KERNEL_NUMBER, SUBST_ID, + SUBST_DRIVER, SUBST_MAJOR, SUBST_MINOR, SUBST_RESULT, @@ -616,6 +617,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, { .name = "id", .fmt = 'b', .type = SUBST_ID }, + { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, @@ -707,6 +709,12 @@ found: dbg("substitute id '%s'", udev->dev_parent->kernel); } break; + case SUBST_DRIVER: + if (udev->dev_parent != NULL) { + strlcat(string, udev->dev_parent->driver, maxsize); + dbg("substitute driver '%s'", udev->dev_parent->driver); + } + break; case SUBST_MAJOR: sprintf(temp2, "%d", major(udev->devt)); strlcat(string, temp2, maxsize); -- cgit v1.2.3-54-g00ecf From 19096c087f8e1fc9f60ceb948f8be9b179885569 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jul 2007 15:29:14 +0200 Subject: restore behavior of NAME== --- test/udev-test.pl | 12 ++++++++++++ udev_rules.c | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index a2043080e9..53499d8871 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1516,6 +1516,18 @@ KERNEL=="sda2", NAME="wrong" KERNEL=="sda1", NAME=="wrong*", SYMLINK+="wronglink" KERNEL=="sda1", NAME=="?*", SYMLINK+="link" KERNEL=="sda1", NAME=="node*", SYMLINK+="link2" +EOF + }, + { + desc => "NAME compare test 2", + subsys => "block", + devpath => "/block/sda/sda1", + exp_name => "link2", + exp_target => "sda1", + not_exp_name => "link", + rules => <driver, udev->dev->driver)) goto nomatch; + /* match NAME against a value assigned by an earlier rule */ if (match_key("NAME", rule, &rule->name, udev->name)) goto nomatch; @@ -1273,9 +1274,6 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) dbg("udev->dev->devpath='%s'", udev->dev->devpath); dbg("udev->dev->kernel='%s'", udev->dev->kernel); - /* use kernel name as default node name */ - strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); - /* look for a matching rule to apply */ udev_rules_iter_init(rules); while (1) { @@ -1430,8 +1428,10 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) } } - if (!name_set) + if (!name_set) { info("no node name set, will use kernel name '%s'", udev->name); + strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); + } if (udev->tmp_node[0] != '\0') { dbg("removing temporary device node"); -- cgit v1.2.3-54-g00ecf From 49369cafe412e734e174fa3dccd5878499d28702 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Wed, 25 Jul 2007 15:42:39 +0200 Subject: rules_generator: add S/390 persistent network support --- .../75-persistent-net-generator.rules | 12 ++++--- extras/rule_generator/write_net_rules | 42 ++++++++++++++++++---- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 21eb0c6649..0ff395d136 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -1,19 +1,21 @@ # these rules generate rules for persistent network device naming -ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|ath*|wlan*|ra*|sta*" \ +ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|ath*|wlan*|ra*|sta*|ctc*|lcs*|hsi*" \ NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do" GOTO="persistent_net_generator_end" LABEL="persistent_net_generator_do" # build device description string to add a comment the generated rule -SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($attr{driver})" -SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($attr{driver})" +SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)" +SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)" +SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{NETDEV}="$id", ENV{NETDRV}="$driver" SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device" -ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($attr{driver})" +ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($driver)" -IMPORT{program}="write_net_rules $attr{address}" +ENV{NETDEV}=="?*", IMPORT{program}="write_net_rules --driver $env{NETDRV} --id $env{NETDEV}" +ENV{NETDEV}!="?*", IMPORT{program}="write_net_rules $attr{address}" ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" LABEL="persistent_net_generator_end" diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index b709200a35..e7386b057c 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -69,7 +69,7 @@ if [ "$1" = "all_interfaces" ]; then for INTERFACE in *; do case $INTERFACE in - eth*|ath*|wlan*|ra*|sta*) ;; + eth*|ath*|wlan*|ra*|sta*|ctc*|hsi*) ;; *) continue ;; esac @@ -86,18 +86,42 @@ if [ -z "$INTERFACE" ]; then fi if [ "$1" ]; then - MAC_ADDR="$1" + while [ "$*" ] ; do + case $1 in + --mac) + shift + MAC_ADDR=$1 + shift + ;; + --driver) + shift + DRIVER=$1 + shift + ;; + --id) + shift + ID=$1 + shift + ;; + *) + MAC_ADDR=$1 + shift + ;; + esac + done else - MAC_ADDR=$(sysread address) + MAC_ADDR=$(sysread address) fi -if [ -z "$MAC_ADDR" ]; then +if [ -z "$DRIVER" ] && [ -z "$ID" ] ; then + if [ -z "$MAC_ADDR" ]; then echo "No MAC address for $INTERFACE." >&2 exit 1 -fi -if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then + fi + if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then echo "NULL MAC address for $INTERFACE." >&2 exit 1 + fi fi # Prevent concurrent processes from modifying the file at the same time. @@ -117,7 +141,11 @@ if interface_name_taken; then fi # the DRIVERS key is needed to not match bridges and VLAN sub-interfaces -match="DRIVERS==\"?*\", ATTRS{address}==\"$MAC_ADDR\"" +if [ "$MAC_ADDR" ] ; then + match="DRIVERS==\"?*\", ATTRS{address}==\"$MAC_ADDR\"" +else + match="DRIVERS==\"$DRIVER\", KERNELS==\"$ID\"" +fi if [ $basename = "ath" -o $basename = "wlan" ]; then match="$match, ATTRS{type}==\"1\"" # do not match the wifi* interfaces fi -- cgit v1.2.3-54-g00ecf From 9b23e594bf2533b7fadeea1680b186e4775cfe17 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jul 2007 18:16:11 +0200 Subject: rules_generator: remove "installation" function This should be called by triggering events not by looping with the script itself. It also keeps a second blacklist outside of the rules which we do not want to maintain. --- .../75-persistent-net-generator.rules | 1 + extras/rule_generator/write_net_rules | 29 +--------------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 0ff395d136..90d7f82d63 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -9,6 +9,7 @@ LABEL="persistent_net_generator_do" # build device description string to add a comment the generated rule SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)" SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)" +SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)" SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{NETDEV}="$id", ENV{NETDRV}="$driver" SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device" diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index e7386b057c..b873b5bf8c 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -42,7 +42,7 @@ write_rule() { if [ "$PRINT_HEADER" ]; then PRINT_HEADER= echo "# This file was automatically generated by the $0" - echo "# program, probably run by the persistent-net-generator.rules rules file." + echo "# program run by the persistent-net-generator.rules rules file." echo "#" echo "# You can modify it, as long as you keep each rule on a single line." fi @@ -53,33 +53,6 @@ write_rule() { } >> $RULES_FILE } -# used only if $RULES_FILE is empty, like on installation -if [ "$1" = "all_interfaces" ]; then - if [ -e $RULES_FILE ]; then - printf "$RULES_FILE exists, persistent interface names\nnot saved.\n" >&2 - exit 0 - fi - - if [ ! -e /sys/class/net/ ]; then - echo "/sys/class/net/ is not available, persistent interface names not saved." >&2 - exit 0 - fi - - cd /sys/class/net/ || return 0 - - for INTERFACE in *; do - case $INTERFACE in - eth*|ath*|wlan*|ra*|sta*|ctc*|hsi*) ;; - *) continue ;; - esac - - INTERFACE="$INTERFACE" DEVPATH="/class/net/$INTERFACE" \ - /lib/udev/write_net_rules || true - done - - exit 0 -fi - if [ -z "$INTERFACE" ]; then echo "Missing \$INTERFACE." >&2 exit 1 -- cgit v1.2.3-54-g00ecf From f4dce170d5eb4b798b4ca6c8480f10cacbc7d72c Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Thu, 26 Jul 2007 13:04:13 +0200 Subject: fix inotify to work not only once --- udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevd.c b/udevd.c index 69572c6268..8f56de6ffb 100644 --- a/udevd.c +++ b/udevd.c @@ -1202,7 +1202,7 @@ int main(int argc, char *argv[], char *envp[]) reload_config = 1; buf = malloc(nbytes); - if (buf != NULL) { + if (buf == NULL) { err("error getting buffer for inotify, disable watching"); close(inotify_fd); inotify_fd = -1; -- cgit v1.2.3-54-g00ecf From 584fbf1ba459b4425c6757ca08918d760def62ef Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 27 Jul 2007 03:34:31 +0200 Subject: udevtrigger: trigger "driver" events --- udevtrigger.c | 52 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 40 insertions(+), 12 deletions(-) diff --git a/udevtrigger.c b/udevtrigger.c index 4ef9612af0..cf8f209b1c 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -237,11 +237,24 @@ static int attr_filtered(const char *path) return 0; } -static void scan_subsystem(const char *subsys) +enum scan_type { + SCAN_DEVICES, + SCAN_SUBSYSTEM, +}; + +static void scan_subsystem(const char *subsys, enum scan_type scan) { char base[PATH_SIZE]; DIR *dir; struct dirent *dent; + const char *subdir; + + if (scan == SCAN_DEVICES) + subdir = "/devices"; + else if (scan == SCAN_SUBSYSTEM) + subdir = "/drivers"; + else + return; strlcpy(base, sysfs_path, sizeof(base)); strlcat(base, "/", sizeof(base)); @@ -257,15 +270,24 @@ static void scan_subsystem(const char *subsys) if (dent->d_name[0] == '.') continue; - if (subsystem_filtered(dent->d_name)) - continue; + if (scan == SCAN_DEVICES) + if (subsystem_filtered(dent->d_name)) + continue; strlcpy(dirname, base, sizeof(dirname)); strlcat(dirname, "/", sizeof(dirname)); strlcat(dirname, dent->d_name, sizeof(dirname)); - strlcat(dirname, "/devices", sizeof(dirname)); - /* look for devices */ + if (scan == SCAN_SUBSYSTEM) { + if (!subsystem_filtered("subsystem")) + device_list_insert(dirname); + if (subsystem_filtered("drivers")) + continue; + } + + strlcat(dirname, subdir, sizeof(dirname)); + + /* look for devices/drivers */ dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { @@ -494,19 +516,25 @@ int main(int argc, char *argv[], char *envp[]) } } - if (failed) + if (failed) { scan_failed(); - else { + exec_list(action); + } else { char base[PATH_SIZE]; struct stat statbuf; /* if we have /sys/subsystem, forget all the old stuff */ strlcpy(base, sysfs_path, sizeof(base)); strlcat(base, "/subsystem", sizeof(base)); - if (stat(base, &statbuf) == 0) - scan_subsystem("subsystem"); - else { - scan_subsystem("bus"); + if (stat(base, &statbuf) == 0) { + scan_subsystem("subsystem", SCAN_SUBSYSTEM); + exec_list(action); + scan_subsystem("subsystem", SCAN_DEVICES); + exec_list(action); + } else { + scan_subsystem("bus", SCAN_SUBSYSTEM); + exec_list(action); + scan_subsystem("bus", SCAN_DEVICES); scan_class(); /* scan "block" if it isn't a "class" */ @@ -514,9 +542,9 @@ int main(int argc, char *argv[], char *envp[]) strlcat(base, "/class/block", sizeof(base)); if (stat(base, &statbuf) != 0) scan_block(); + exec_list(action); } } - exec_list(action); exit: name_list_cleanup(&filter_subsystem_match_list); -- cgit v1.2.3-54-g00ecf From e0bc97692b25a26352a65ab4a2ca3f53bb377458 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 27 Jul 2007 03:39:43 +0200 Subject: rules: update SUSE --- etc/udev/suse/80-drivers.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/suse/80-drivers.rules b/etc/udev/suse/80-drivers.rules index 51c4bf4e90..cf7157bead 100644 --- a/etc/udev/suse/80-drivers.rules +++ b/etc/udev/suse/80-drivers.rules @@ -4,7 +4,7 @@ DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODAL SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" -SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --quiet -all tifm_sd tifm_ms" +SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTR{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -- cgit v1.2.3-54-g00ecf From 2457dbc1c64d792551f08eec6e2d73f6fa68c045 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 28 Jul 2007 01:07:49 +0200 Subject: rules: Fedora update --- etc/udev/redhat/05-udev-early.rules | 19 ---- etc/udev/redhat/50-udev.rules | 178 +++++++++++++++--------------------- etc/udev/redhat/51-hotplug.rules | 15 --- 3 files changed, 76 insertions(+), 136 deletions(-) delete mode 100644 etc/udev/redhat/05-udev-early.rules delete mode 100644 etc/udev/redhat/51-hotplug.rules diff --git a/etc/udev/redhat/05-udev-early.rules b/etc/udev/redhat/05-udev-early.rules deleted file mode 100644 index a58cc033d2..0000000000 --- a/etc/udev/redhat/05-udev-early.rules +++ /dev/null @@ -1,19 +0,0 @@ -# sysfs is populated after the event is sent -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -# ignore these events until someone needs them -SUBSYSTEM=="drivers", OPTIONS="ignore_device" -SUBSYSTEM=="module", OPTIONS="ignore_device" - - -ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="modprobe $env{MODALIAS}", GOTO="skip_wait" - -# pnp devices -ACTION=="add", SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe pnp:d$$id; done < /sys/$devpath/id'" - -ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" - -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" - -LABEL="skip_wait" - -ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN="/sbin/firmware_helper", OPTIONS="last_rule" diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules index c410e8575a..668785f4ce 100644 --- a/etc/udev/redhat/50-udev.rules +++ b/etc/udev/redhat/50-udev.rules @@ -4,25 +4,25 @@ # default is OWNER="root" GROUP="root", MODE="0600" # -KERNEL=="*", OWNER="root" GROUP="root", MODE="0600" +KERNEL=="*", OWNER="root", GROUP="root", MODE="0600" # all block devices SUBSYSTEM=="block", GROUP="disk", MODE="0640" KERNEL=="root", GROUP="disk", MODE="0640" # console devices -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", MODE="0600", OPTIONS="last_rule" -KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" -KERNEL=="vc/[0-9]*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" +KERNEL=="console", NAME="%k", MODE="0600" +KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="0660" +KERNEL=="vc/[0-9]*", NAME="%k", GROUP="tty", MODE="0660" # pty devices # Set this to 0660 if you only want users belonging to tty group # to be able to allocate PTYs -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666", OPTIONS="last_rule" -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660", OPTIONS="last_rule" -KERNEL=="pty/m*", NAME="%k", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666" +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660" +KERNEL=="pty/m*", NAME="%k", GROUP="tty", MODE="0660" # serial+dialup devices KERNEL=="ippp*", NAME="%k", MODE="0660" @@ -43,21 +43,21 @@ KERNEL=="hvsi*", NAME="%k", GROUP="uucp", MODE="0660" KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp", MODE="0660" # vc devices -KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcs[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcsa", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcsa[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcc/*", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule" +KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty" +KERNEL=="vcs[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty" +KERNEL=="vcsa", NAME="%k", OWNER="vcsa", GROUP="tty" +KERNEL=="vcsa[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty" +KERNEL=="vcc/*", NAME="%k", OWNER="vcsa", GROUP="tty" # memory devices -KERNEL=="random", MODE="0666", OPTIONS="last_rule" -KERNEL=="urandom", MODE="0444", OPTIONS="last_rule" -KERNEL=="mem", GROUP="kmem", MODE="0640", OPTIONS="last_rule" -KERNEL=="kmem", GROUP="kmem", MODE="0640", OPTIONS="last_rule" -KERNEL=="port", GROUP="kmem", MODE="0640", OPTIONS="last_rule" -KERNEL=="full", MODE="0666", OPTIONS="last_rule" -KERNEL=="null", MODE="0666", OPTIONS="last_rule" -KERNEL=="zero", MODE="0666", OPTIONS="last_rule" +KERNEL=="random", MODE="0666" +KERNEL=="urandom", MODE="0444" +KERNEL=="mem", GROUP="kmem", MODE="0640" +KERNEL=="kmem", GROUP="kmem", MODE="0640" +KERNEL=="port", GROUP="kmem", MODE="0640" +KERNEL=="full", MODE="0666" +KERNEL=="null", MODE="0666" +KERNEL=="zero", MODE="0666" # 183 = /dev/hwrng Generic random number generator KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" @@ -67,12 +67,18 @@ KERNEL=="rtc", MODE="0644" # floppy devices KERNEL=="fd[01]*", GROUP="floppy", MODE="0660" + # fix floppy devices KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" -KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M /dev/%k" + +KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", \ + RUN+="create_floppy_devices -c -t $attr{cmos} -m %M /dev/%k" + KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f /dev/%k*'" -BUS=="usb", KERNEL=="sd*", SYSFS{bInterfaceClass}=="08", SYSFS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", SYMLINK+="floppy floppy-%k" +BUS=="usb", KERNEL=="sd*", ATTRS{bInterfaceClass}=="08", \ + ATTRS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", \ + SYMLINK+="floppy floppy-%k" # audio devices KERNEL=="dsp*", MODE="0660" @@ -99,8 +105,8 @@ KERNEL=="usblp*", GROUP="lp", MODE="0660" KERNEL=="usb/lp*", GROUP="lp", MODE="0660" # tape devices -SUBSYSTEM=="ide", SYSFS{media}=="tape", ACTION=="add", \ - RUN+="modprobe ide-scsi idescsi_nocd=1" +SUBSYSTEM=="ide", ATTRS{media}=="tape", ACTION=="add", \ + RUN+="/sbin/modprobe ide-scsi idescsi_nocd=1" KERNEL=="ht*", GROUP="disk", MODE="0660" KERNEL=="nht*", GROUP="disk", MODE="0660" KERNEL=="pt[0-9]*", GROUP="disk", MODE="0660" @@ -155,7 +161,8 @@ KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" # DVB KERNEL=="dvb", MODE="0660" -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", \ +SUBSYSTEM=="dvb", \ + PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", \ NAME="%c", MODE="0660" KERNEL=="dm-[0-9]*", ACTION=="add", OPTIONS+="ignore_device" @@ -181,6 +188,8 @@ KERNEL=="raw1394", NAME="%k" KERNEL=="dv1394*", NAME="dv1394/%n" KERNEL=="video1394*", NAME="video1394/%n" +KERNEL=="fw*", PROGRAM="fw_unit_symlinks.sh %k %n", SYMLINK+="$result" + KERNEL=="raw[0-9]*", NAME="raw/%k" KERNEL=="lp[0-9]*", SYMLINK+="par%n" @@ -227,89 +236,51 @@ KERNEL=="zap[0-9]*", NAME="zap/%n" KERNEL=="pktcdvd", NAME="%k/control" - KERNEL=="hd*[!0-9]", ATTR{removable}=="1", \ ATTR{media}=="floppy", \ SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions" -KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", SYMLINK+="floppy-%k" -KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", ATTRS{media}=="cdrom", SYMLINK+="cdrom cdrom-%k" +KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", \ + SYMLINK+="floppy-%k" + +KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", ATTRS{media}=="cdrom", \ + SYMLINK+="cdrom cdrom-%k" -KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" +KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", \ + PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD", \ + SYMLINK+="dvd dvd-%k" -KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k CD-R", SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" +KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", \ + PROGRAM=="check-cdrom.sh %k CD-R", \ + SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" -KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", PROGRAM="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD-R", SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k CD-R", \ + SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" + +KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", \ + PROGRAM="check-cdrom.sh %k DVD-R", \ + SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" + +KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD-R", \ + SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" # rename sr* to scd* KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n" KERNEL=="hd*[0-9]", BUS=="ide", ATTRS{removable}=="1", \ OPTIONS+="ignore_remove" - - -####################################### -# Persistent block device stuff - begin -####################################### -# persistent disk links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*", GOTO="persistent_end" - -# never access removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_end" -KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="sr*", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", ATTRS{removable}=="1", GOTO="persistent_end" -IMPORT{program}="/lib/udev/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/lib/udev/edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -LABEL="persistent_end" - -##################################### -# Persistent block device stuff - end -##################################### - +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ + NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" ACTION=="add", SUBSYSTEM=="usb_device", \ PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ NAME="%c", MODE="0644" +ACTION=="add", SUBSYSTEM=="usb_endpoint", \ + ATTR{bEndpointAddress}=="?*", ATTRS{devnum}=="?*", ATTRS{busnum}=="?*", \ + NAME="bus/usb/$attr{busnum}/$attr{devnum}_ep/$attr{bEndpointAddress}", \ + MODE="0644", SYMLINK+="%k" # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC # sr: 4 TYPE_WORM, 5 TYPE_ROM @@ -321,11 +292,11 @@ ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="1", \ RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="modprobe sg" +ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="/sbin/modprobe sg" ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \ - RUN+="modprobe sd_mod" + RUN+="/sbin/modprobe sd_mod" ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \ - RUN+="modprobe sr_mod" + RUN+="/sbin/modprobe sr_mod" ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="[36]", \ SYMLINK+="scanner scanner-%k", MODE="0660" @@ -333,15 +304,18 @@ ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="[36]", \ ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", \ SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", RUN+="modprobe osst" -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}=="ADR*", RUN+="modprobe st" -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTRS{vendor}!="On[sS]tream", \ - RUN+="modprobe st" +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", \ + ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst" +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", \ + ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}=="ADR*", RUN+="/sbin/modprobe st" +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", \ + ATTRS{vendor}!="On[sS]tream", \ + RUN+="/sbin/modprobe st" # mmc block devices -ACTION=="add", SUBSYSTEM=="mmc", RUN+="modprobe mmc_block" +ACTION=="add", SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" RUN+="socket:/org/kernel/udev/monitor" diff --git a/etc/udev/redhat/51-hotplug.rules b/etc/udev/redhat/51-hotplug.rules deleted file mode 100644 index d665d3e7a5..0000000000 --- a/etc/udev/redhat/51-hotplug.rules +++ /dev/null @@ -1,15 +0,0 @@ -# do not call hotplug.d and dev.d for "drivers" and "module" events -SUBSYSTEM=="drivers", GOTO="hotplug_end" -SUBSYSTEM=="module", GOTO="hotplug_end" -ACTION=="add", GOTO="hotplug_comp" -ACTION=="remove", GOTO="hotplug_comp" - -GOTO="hotplug_end" - -LABEL="hotplug_comp" -# compatibility support for the obsolete hotplug.d and dev.d directories -ENV{UDEVD_EVENT}=="1", RUN+="/lib/udev/udev_run_hotplugd" -RUN+="/lib/udev/udev_run_devd" - - -LABEL="hotplug_end" -- cgit v1.2.3-54-g00ecf From 4beaed365266fc5927100c9634c603e039fcf7ed Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 31 Jul 2007 13:14:04 +0200 Subject: rules: add "do not edit" comment Default udev rules are not system configuration for users to edit, we need to be able to replace them with a package update. Custom rules have to go into their own files. --- etc/udev/rules.d/05-udev-early.rules | 2 ++ etc/udev/rules.d/60-persistent-input.rules | 2 ++ etc/udev/rules.d/60-persistent-storage.rules | 2 ++ etc/udev/rules.d/95-udev-late.rules | 2 ++ etc/udev/suse/50-udev-default.rules | 2 ++ etc/udev/suse/64-device-mapper.rules | 2 ++ etc/udev/suse/64-md-raid.rules | 2 +- etc/udev/suse/80-drivers.rules | 2 ++ 8 files changed, 15 insertions(+), 1 deletion(-) diff --git a/etc/udev/rules.d/05-udev-early.rules b/etc/udev/rules.d/05-udev-early.rules index ec94c35816..4c3055b626 100644 --- a/etc/udev/rules.d/05-udev-early.rules +++ b/etc/udev/rules.d/05-udev-early.rules @@ -1,3 +1,5 @@ +# do not edit this file, it will be overwritten on update + # sysfs is populated after the event is sent ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules index acf5ebe7d5..fbebe86244 100644 --- a/etc/udev/rules.d/60-persistent-input.rules +++ b/etc/udev/rules.d/60-persistent-input.rules @@ -1,3 +1,5 @@ +# do not edit this file, it will be overwritten on update + ACTION!="add", GOTO="persistent_input_end" SUBSYSTEM!="input", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index a6f0069358..a49321c5fc 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -1,3 +1,5 @@ +# do not edit this file, it will be overwritten on update + # persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} # scheme based on "Linux persistent device names", 2004, Hannes Reinecke diff --git a/etc/udev/rules.d/95-udev-late.rules b/etc/udev/rules.d/95-udev-late.rules index 6b79a24641..1755d0855c 100644 --- a/etc/udev/rules.d/95-udev-late.rules +++ b/etc/udev/rules.d/95-udev-late.rules @@ -1,3 +1,5 @@ +# do not edit this file, it will be overwritten on update + # event to be catched by udevmonitor RUN+="socket:/org/kernel/udev/monitor" diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules index 1d57f0a836..4a3fe2c948 100644 --- a/etc/udev/suse/50-udev-default.rules +++ b/etc/udev/suse/50-udev-default.rules @@ -1,3 +1,5 @@ +# do not edit this file, it will be overwritten on update + # console KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0666", OPTIONS="last_rule" KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0666", OPTIONS="last_rule" diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index e8af567e26..c6142ea115 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -1,3 +1,5 @@ +# do not edit this file, it will be overwritten on update + KERNEL=="device-mapper", SYMLINK+="mapper/control" KERNEL!="dm-*", GOTO="device_mapper_end" diff --git a/etc/udev/suse/64-md-raid.rules b/etc/udev/suse/64-md-raid.rules index 6bbfd126df..02f27ee07e 100644 --- a/etc/udev/suse/64-md-raid.rules +++ b/etc/udev/suse/64-md-raid.rules @@ -1,4 +1,4 @@ -# md links hook into "change" events, when the array becomes available +# do not edit this file, it will be overwritten on update SUBSYSTEM!="block", GOTO="md_end" KERNEL!="md[0-9]*", GOTO="md_end" diff --git a/etc/udev/suse/80-drivers.rules b/etc/udev/suse/80-drivers.rules index cf7157bead..e7ae8dc19e 100644 --- a/etc/udev/suse/80-drivers.rules +++ b/etc/udev/suse/80-drivers.rules @@ -1,3 +1,5 @@ +# do not edit this file, it will be overwritten on update + ACTION!="add", GOTO="drivers_end" DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" -- cgit v1.2.3-54-g00ecf From b5485961d7001a4137411e1e16e2e13644c19653 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 31 Jul 2007 13:15:17 +0200 Subject: rules: Fedora update --- etc/udev/redhat/06-udev-rh-early.rules | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 etc/udev/redhat/06-udev-rh-early.rules diff --git a/etc/udev/redhat/06-udev-rh-early.rules b/etc/udev/redhat/06-udev-rh-early.rules new file mode 100644 index 0000000000..7268a5f3bf --- /dev/null +++ b/etc/udev/redhat/06-udev-rh-early.rules @@ -0,0 +1,8 @@ +# sysfs is populated after the event is sent +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" + +ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" +# pnp devices +ACTION=="add", SUBSYSTEM=="pnp", ATTR{id}=="?*", RUN+="/sbin/modprobe pnp:d$attr{id}" +ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN="/sbin/firmware_helper", OPTIONS="last_rule" -- cgit v1.2.3-54-g00ecf From dcfa2acce30c0574bcec761b72cad4141da78e1b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Aug 2007 21:19:41 +0200 Subject: rules_generator: skip random MAC addresses --- .../75-persistent-net-generator.rules | 27 +++++++++++++++------- extras/rule_generator/rule_generator.functions | 2 +- extras/rule_generator/write_net_rules | 4 ++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 90d7f82d63..cfb13f182b 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -1,22 +1,33 @@ +# do not edit this file, it will be overwritten on update + # these rules generate rules for persistent network device naming -ACTION=="add", SUBSYSTEM=="net", KERNEL=="eth*|ath*|wlan*|ra*|sta*|ctc*|lcs*|hsi*" \ - NAME!="?*", DRIVERS=="?*", GOTO="persistent_net_generator_do" +ACTION!="add", GOTO="persistent_net_generator_end" +SUBSYSTEM!="net", GOTO="persistent_net_generator_end" + +# device name whitelist +KERNEL!="eth*|ath*|wlan*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" + +# ignore the interface if a name has already been set +NAME=="?*", GOTO="persistent_net_generator_end" -GOTO="persistent_net_generator_end" -LABEL="persistent_net_generator_do" +# ignore Xen virtual interfaces +SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" -# build device description string to add a comment the generated rule +# build device description string to add a comment to the generated rule SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)" SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)" SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)" SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{NETDEV}="$id", ENV{NETDRV}="$driver" SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" -SUBSYSTEMS=="xen", ENV{COMMENT}="Xen virtual device" ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($driver)" -ENV{NETDEV}=="?*", IMPORT{program}="write_net_rules --driver $env{NETDRV} --id $env{NETDEV}" -ENV{NETDEV}!="?*", IMPORT{program}="write_net_rules $attr{address}" +DRIVERS!="?*", ENV{NETDEV}=="?*", IMPORT{program}="write_net_rules --driver $env{NETDRV} --id $env{NETDEV}" + +# skip "locally administered" MAC addresses +ATTR{address}=="?[2367abef]:*", GOTO="persistent_net_generator_end" + +DRIVERS!="?*", ENV{NETDEV}!="?*", IMPORT{program}="write_net_rules $attr{address}" ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" LABEL="persistent_net_generator_end" diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index 712ed269e0..495bb7b047 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -93,5 +93,5 @@ find_all_rules() { local match="$3" local search='.*[[:space:],]'"$key"'"\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$' - echo $(sed -n -e "${match}s/${search}/\1/p" $RO_RULES_FILE $RULES_FILE) + echo $(sed -n -e "${match}s/${search}/\1/p" $RO_RULES_FILE $RULES_FILE 2>/dev/null) } diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index b873b5bf8c..62acb8820c 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -115,12 +115,12 @@ fi # the DRIVERS key is needed to not match bridges and VLAN sub-interfaces if [ "$MAC_ADDR" ] ; then - match="DRIVERS==\"?*\", ATTRS{address}==\"$MAC_ADDR\"" + match="DRIVERS==\"?*\", ATTR{address}==\"$MAC_ADDR\"" else match="DRIVERS==\"$DRIVER\", KERNELS==\"$ID\"" fi if [ $basename = "ath" -o $basename = "wlan" ]; then - match="$match, ATTRS{type}==\"1\"" # do not match the wifi* interfaces + match="$match, ATTR{type}==\"1\"" # do not match the wifi* interfaces fi write_rule "$match" "$INTERFACE" "$COMMENT" -- cgit v1.2.3-54-g00ecf From 56a8a8836d5d3955939c9cd0060d5ebdf00ddfc5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Aug 2007 23:54:10 +0200 Subject: write changed network interface names to the kernel log --- udev_device.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/udev_device.c b/udev_device.c index bbf7963afc..23ba313db3 100644 --- a/udev_device.c +++ b/udev_device.c @@ -78,6 +78,26 @@ dev_t udev_device_get_devt(struct udevice *udev) return makedev(0, 0); } +static void kernel_log(struct ifreq ifr) +{ + int klog; + FILE *f; + + klog = open("/dev/kmsg", O_WRONLY); + if (klog < 0) + return; + + f = fdopen(klog, "w"); + if (f == NULL) { + close(klog); + return; + } + + fprintf(f, "<6>udev: renamed network interface %s to %s\n", + ifr.ifr_name, ifr.ifr_newname); + fclose(f); +} + static int rename_netif(struct udevice *udev) { int sk; @@ -98,7 +118,9 @@ static int rename_netif(struct udevice *udev) strlcpy(ifr.ifr_name, udev->dev->kernel, IFNAMSIZ); strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval != 0) { + if (retval == 0) + kernel_log(ifr); + else { int loop; /* see if the destination interface name already exists */ @@ -122,8 +144,10 @@ static int rename_netif(struct udevice *udev) loop = 30 * 20; while (loop--) { retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval == 0) + if (retval == 0) { + kernel_log(ifr); break; + } if (errno != EEXIST) { err("error changing net interface name %s to %s: %s", -- cgit v1.2.3-54-g00ecf From 538876cdc8cd1ad0cc7575d641feae2df91b507a Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Fri, 3 Aug 2007 00:06:00 +0200 Subject: rules: Gentoo update --- etc/udev/gentoo/50-udev.rules | 48 ++---------------------------- etc/udev/gentoo/64-device-mapper.rules | 33 --------------------- etc/udev/gentoo/80-hotplug.rules | 54 ++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 79 deletions(-) delete mode 100644 etc/udev/gentoo/64-device-mapper.rules create mode 100644 etc/udev/gentoo/80-hotplug.rules diff --git a/etc/udev/gentoo/50-udev.rules b/etc/udev/gentoo/50-udev.rules index ddabe1acc6..dd329712dd 100644 --- a/etc/udev/gentoo/50-udev.rules +++ b/etc/udev/gentoo/50-udev.rules @@ -248,6 +248,7 @@ SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/u SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", GROUP="usb", MODE="0664" +# Timeouts for scsi devices # Setting timeout for tape-devices (type 1) to 900 seconds # and 60 seconds for device types 0, 7 and 14 # if you need timeouts for other devices add a similar rule @@ -255,53 +256,8 @@ SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" -# Module autoloading -ACTION!="add", GOTO="hotplug_no_add_event" - -# check if the device has already been claimed by a driver -ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_load_end" - -# this driver is broken and should not be loaded automatically -SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_load_end" - -# Autoload modules that lack aliases but have them defined inutoload modules -ENV{MODALIAS}=="?*", RUN{ignore_error}+="modprobe.sh $env{MODALIAS}" - -# /etc/modprobe.conf. -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" -# needed aliases are defined in /etc/modprobe.d/pnp-aliases - - -SUBSYSTEM=="i2o", RUN+="modprobe.sh i2o_block" -SUBSYSTEM=="mmc", RUN+="modprobe.sh mmc_block" - -# Parts taken from redhat-rules -# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC -# sr: 4 TYPE_WORM, 5 TYPE_ROM -# st/osst: 1 TYPE_TAPE - -# Load driver for scsi-device -SUBSYSTEM!="scsi_device", GOTO="hotplug_scsi_end" -ATTRS{type}=="?*", TEST!="[module/sg]", RUN+="modprobe.sh sg" -ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" -ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" -ATTRS{type}=="8", RUN+="modprobe.sh ch" - -ATTRS{type}=="1", ENV{ID_SCSI_TAPE_DRIVER}="st" -ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", ENV{ID_SCSI_TAPE_DRIVER}="osst" -ENV{ID_SCSI_TAPE_DRIVER}=="?*", RUN+="modprobe.sh $env{ID_SCSI_TAPE_DRIVER}" -LABEL="hotplug_scsi_end" - - -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="modprobe.sh ide-scsi" - -LABEL="hotplug_load_end" - # Load firmware -SUBSYSTEM=="firmware", RUN+="firmware.sh" - -LABEL="hotplug_no_add_event" +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" LABEL="gentoo_device_rules_end" diff --git a/etc/udev/gentoo/64-device-mapper.rules b/etc/udev/gentoo/64-device-mapper.rules deleted file mode 100644 index e104a175d6..0000000000 --- a/etc/udev/gentoo/64-device-mapper.rules +++ /dev/null @@ -1,33 +0,0 @@ -# device mapper links hook into "change" events, when the dm table -# becomes available; some table-types must be ignored - -KERNEL=="device-mapper", NAME="mapper/control" - -KERNEL!="dm-*", GOTO="device_mapper_end" -ACTION!="add|change", GOTO="device_mapper_end" - -# lookup device name -# use dmsetup, until devmap_name is provided by sys-fs/device-mapper -PROGRAM=="/sbin/dmsetup -j %M -m %m --noopencount --noheadings -c -o name info", - ENV{DM_NAME}="%c" - -# do not do anything if dmsetup does not provide a name -ENV{DM_NAME}=="", NAME="", OPTIONS="ignore_device" - -# ignore luks crypt devices while not fully up -ENV{DM_NAME}=="temporary-cryptsetup-*", NAME="", OPTIONS="ignore_device" - -# use queried name -ENV{DM_NAME}=="?*", NAME="mapper/$env{DM_NAME}" - -SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" - -PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" -RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" - -IMPORT{program}="vol_id --export $tempnode" -OPTIONS="link_priority=50" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_SAFE}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_SAFE}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -LABEL="device_mapper_end" diff --git a/etc/udev/gentoo/80-hotplug.rules b/etc/udev/gentoo/80-hotplug.rules new file mode 100644 index 0000000000..0637dbc83a --- /dev/null +++ b/etc/udev/gentoo/80-hotplug.rules @@ -0,0 +1,54 @@ +# /etc/udev/rules/80-hotplug.rules: module loading rules for udev +# +# Gentoo specific rules +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# Try not to modify this file, if you wish to change things, create a new rule +# file that can be run before this one. +# + +# Module autoloading +ACTION!="add", GOTO="hotplug_load_end" + +# check if the device has already been claimed by a driver +ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_load_end" + +# this driver is broken and should not be loaded automatically +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_load_end" + +# Autoload modules that lack aliases but have them defined in autoload modules +ENV{MODALIAS}=="?*", RUN{ignore_error}+="modprobe.sh $env{MODALIAS}" + +# /etc/modprobe.conf. +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" +# needed aliases are defined in /etc/modprobe.d/pnp-aliases + + +SUBSYSTEM=="i2o", RUN+="modprobe.sh i2o_block" +SUBSYSTEM=="mmc", RUN+="modprobe.sh mmc_block" +SUBSYSTEM=="tifm", RUN+="modprobe.sh tifm_sd" +SUBSYSTEM=="tifm", RUN+="modprobe.sh tifm_ms" +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="modprobe.sh ide-scsi" + +# Load driver for scsi-device +SUBSYSTEM!="scsi_device", GOTO="hotplug_scsi_end" + + # Parts taken from redhat-rules + # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC + # sr: 4 TYPE_WORM, 5 TYPE_ROM + # st/osst: 1 TYPE_TAPE + + ATTRS{type}=="?*", TEST!="[module/sg]", RUN+="modprobe.sh sg" + ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" + ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" + ATTRS{type}=="8", RUN+="modprobe.sh ch" + + ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}!="ADR*", RUN+="modprobe.sh osst", GOTO="hotplug_scsi_end" + ATTRS{type}=="1", RUN+="modprobe.sh st" +LABEL="hotplug_scsi_end" + +LABEL="hotplug_load_end" + -- cgit v1.2.3-54-g00ecf From 585e83885622af3b915b92bee71a575a11a6943a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Aug 2007 14:08:47 +0200 Subject: release 114 --- ChangeLog | 43 +++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 14 ++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bc7a20db0a..679e66f12c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,46 @@ +Summary of changes from v113 to v114 +============================================ + +Hannes Reinecke (3): + collect: extra to synchronize actions across events + add $driver subtitution + rules_generator: add S/390 persistent network support + +Kay Sievers (24): + rules_generator: remove executable flag from include file + always unlink temporary file before creating new one + rules: SUSE update + volume_id: ext4 detection + udevtrigger: allow to specify action string + add option to RUN key to ignore the return value of the program + use global udev_log variable instead of parameter in run_program + add udev_rules_run() to handle RUN list + move udev_utils_run.c into udev_rules.c + rules: SUSE update + name_list: rename loop_name -> name_loop + handle dynamic rules created in /dev/.udev/rules.d/ + allow SYMLINK== match + libvolume_id: use /usr/$libdir in pc file + Makefile: add --as-needed flag to ld + restore behavior of NAME== + rules_generator: remove "installation" function + udevtrigger: trigger "driver" events + rules: update SUSE + rules: Fedora update + rules: add "do not edit" comment + rules: Fedora update + rules_generator: skip random MAC addresses + write changed network interface names to the kernel log + +Matthias Schwarzott (3): + rules: Gentoo update + fix inotify to work not only once + rules: Gentoo update + +Richard Hughes (1): + Makefile: add "make dist" for nightly snapshots + + Summary of changes from v112 to v113 ============================================ diff --git a/Makefile b/Makefile index 8179710be1..1c0fda3e0e 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 113 +VERSION = 114 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2dd24929a6..e69db23378 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,17 @@ +udev 114 +======== +Bugfixes. + +Dynamic rules can be created in /dev/.udev/rules.d/ to trigger +actions by dynamically created rules. + +SYMLINK=="" matches agains the entries in the list of +currently defined symlinks. The links are not created in the +filesystem at that point in time, but the values can be matched. + +RUN{ignore_error}+="" will ignore any exit code from the +program and not record as a failed event. + udev 113 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 14e1e49484401d573eac1a99002242dbf7c072f0 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 7 Aug 2007 10:37:58 +0200 Subject: rules_generator: remove policy from write_cd_rules The decision about when to create by-id or by-path persistent rules should be made in the generator rules file where it's obvious and easy to modify locally, not in the script. --- extras/rule_generator/75-cd-aliases-generator.rules | 3 +++ extras/rule_generator/write_cd_rules | 10 +--------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/extras/rule_generator/75-cd-aliases-generator.rules b/extras/rule_generator/75-cd-aliases-generator.rules index c3eb887cb5..e357a6a8bd 100644 --- a/extras/rule_generator/75-cd-aliases-generator.rules +++ b/extras/rule_generator/75-cd-aliases-generator.rules @@ -1,3 +1,6 @@ # these rules generate rules for the /dev/{cdrom,dvd,...} symlinks +# the path of removable devices changes frequently +ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules by-id", SYMLINK+="%c" + ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules", SYMLINK+="%c" diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules index bd951c5146..1dbe6b70de 100644 --- a/extras/rule_generator/write_cd_rules +++ b/extras/rule_generator/write_cd_rules @@ -53,15 +53,7 @@ fi if [ "$1" ]; then METHOD="$1" else - case "$ID_BUS" in - usb|ieee1394) - METHOD='by-id' - ;; - - *) - METHOD='by-path' - ;; - esac + METHOD='by-path' fi case "$METHOD" in -- cgit v1.2.3-54-g00ecf From 0837c28e9b3bc1fc42ed0d4212abdddd3277e1fa Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 7 Aug 2007 10:39:07 +0200 Subject: rules_generator: fix write_cd_rules when similar names exist in the root directory The argument to find_all_rules must be quoted or it will be subject to shell expansion, which will happen if in the root directory there are mount points with the same base name. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=407738 for details. --- extras/rule_generator/write_cd_rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules index 1dbe6b70de..d74b20128d 100644 --- a/extras/rule_generator/write_cd_rules +++ b/extras/rule_generator/write_cd_rules @@ -16,7 +16,7 @@ RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" . /lib/udev/rule_generator.functions find_next_available() { - raw_find_next_available "$(find_all_rules 'SYMLINK+=' $1)" + raw_find_next_available "$(find_all_rules 'SYMLINK+=' "$1")" } write_rule() { -- cgit v1.2.3-54-g00ecf From 7134ab1b332250e03b58da9f39e1823f2ae6c172 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 7 Aug 2007 10:41:42 +0200 Subject: rules: Debian update --- etc/udev/debian/cd-aliases-generator.rules | 13 +++++++ etc/udev/debian/devfs.rules | 2 ++ etc/udev/debian/hotplug.rules | 8 +++-- etc/udev/debian/hotplugd.rules | 8 ----- etc/udev/debian/permissions.rules | 16 ++++++--- etc/udev/debian/persistent-input.rules | 6 ++-- etc/udev/debian/persistent-net-generator.rules | 48 ++++++++++++++++++++++++++ etc/udev/debian/persistent.rules | 39 ++++++++++++--------- etc/udev/debian/udev.rules | 2 ++ 9 files changed, 108 insertions(+), 34 deletions(-) create mode 100644 etc/udev/debian/cd-aliases-generator.rules delete mode 100644 etc/udev/debian/hotplugd.rules create mode 100644 etc/udev/debian/persistent-net-generator.rules diff --git a/etc/udev/debian/cd-aliases-generator.rules b/etc/udev/debian/cd-aliases-generator.rules new file mode 100644 index 0000000000..f65548816e --- /dev/null +++ b/etc/udev/debian/cd-aliases-generator.rules @@ -0,0 +1,13 @@ +# These rules generate rules for the /dev/{cdrom,dvd,...} symlinks and +# write them to /etc/udev/rules.d/z20_persistent-cd.rules. +# +# The default name for this file is z75_cd-aliases-generator.rules. + +ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ + SUBSYSTEMS!="usb|ieee1394", \ + PROGRAM="write_cd_rules", SYMLINK+="%c" + +ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ + SUBSYSTEMS=="usb|ieee1394", \ + PROGRAM="write_cd_rules by-id", SYMLINK+="%c" + diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules index 2e0caa1d69..56ed1a8807 100644 --- a/etc/udev/debian/devfs.rules +++ b/etc/udev/debian/devfs.rules @@ -50,6 +50,7 @@ SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ # usbfs-like devices SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ NAME="%c" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" # serial devices KERNEL=="ttyS[0-9]*", NAME="tts/%n" @@ -104,6 +105,7 @@ KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" KERNEL=="uverbs*", NAME="infiniband/%k" KERNEL=="ucm*", NAME="infiniband/%k" +KERNEL=="rdma_ucm", NAME="infiniband/%k" # sound devices KERNEL=="controlC[0-9]*", NAME="snd/%k" diff --git a/etc/udev/debian/hotplug.rules b/etc/udev/debian/hotplug.rules index 0b2fc57126..662e997c81 100644 --- a/etc/udev/debian/hotplug.rules +++ b/etc/udev/debian/hotplug.rules @@ -7,16 +7,20 @@ ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_driver_loaded" # load the drivers -ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe --use-blacklist $env{MODALIAS}" +ENV{MODALIAS}=="?*", \ + RUN+="/sbin/modprobe --use-blacklist $env{MODALIAS}" SUBSYSTEM=="ide", ENV{MODALIAS}!="?*", RUN+="ide.agent" -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN+="/bin/sh -c 'while read id; do /sbin/modprobe --use-blacklist pnp:d$$id; done < /sys$devpath/id'" +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ + RUN+="/bin/sh -c 'while read id; do /sbin/modprobe --use-blacklist pnp:d$$id; done < /sys$devpath/id'" SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" # rules for subsystems which lack proper hotplug support SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe tifm_ms" SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe osst", \ diff --git a/etc/udev/debian/hotplugd.rules b/etc/udev/debian/hotplugd.rules deleted file mode 100644 index cd30fa49ba..0000000000 --- a/etc/udev/debian/hotplugd.rules +++ /dev/null @@ -1,8 +0,0 @@ -# do not call hotplug.d and dev.d for "drivers" and "module" events -SUBSYSTEM=="drivers", OPTIONS="last_rule" -SUBSYSTEM=="module", OPTIONS="last_rule" - -# compatibility support for the obsolete hotplug.d and dev.d directories -RUN+="udev_run_hotplugd $env{SUBSYSTEM}" -RUN+="udev_run_devd $env{SUBSYSTEM}" - diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules index ac6c0be38b..205b733292 100644 --- a/etc/udev/debian/permissions.rules +++ b/etc/udev/debian/permissions.rules @@ -3,12 +3,17 @@ ACTION!="add", GOTO="permissions_end" # workarounds needed to synchronize with sysfs # only needed for kernels < v2.6.18-rc1 ENV{PHYSDEVPATH}!="?*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt" # only needed for kernels < 2.6.16 SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" # only needed for kernels < 2.6.17 SUBSYSTEM=="net", ENV{DRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" +# devices needed to load the drivers providing them +KERNEL=="tun", OPTIONS+="ignore_remove" +KERNEL=="ppp", OPTIONS+="ignore_remove" +KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" + # default permissions for block devices SUBSYSTEM=="block", GROUP="disk" # the aacraid driver is broken and reports that disks removable (see #404927) @@ -30,6 +35,7 @@ SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" @@ -39,10 +45,11 @@ KERNEL=="legousbtower*", MODE="0666" KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" # usbfs-like devices -SUBSYSTEM=="usb_device", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ + MODE="0664" # iRiver music players -SUBSYSTEM=="usb_device", GROUP="plugdev", \ +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" # serial devices @@ -85,7 +92,7 @@ KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" KERNEL=="fuse", GROUP="fuse" KERNEL=="kqemu", MODE="0666" KERNEL=="kvm", GROUP="kvm" -KERNEL=="tun", MODE="0666" +KERNEL=="tun", MODE="0666", KERNEL=="cdemu[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" @@ -93,6 +100,7 @@ KERNEL=="pktcdvd", MODE="0644" KERNEL=="uverbs*", GROUP="rdma" KERNEL=="ucm*", GROUP="rdma" +KERNEL=="rdma_ucm", GROUP="rdma" # printers and parallel devices SUBSYSTEM=="printer", GROUP="lp" diff --git a/etc/udev/debian/persistent-input.rules b/etc/udev/debian/persistent-input.rules index a9005e075b..47c4ae98cb 100644 --- a/etc/udev/debian/persistent-input.rules +++ b/etc/udev/debian/persistent-input.rules @@ -4,7 +4,7 @@ ACTION!="add", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" # usb devices -SUBSYSTEMS=="usb", IMPORT{program}="usb_id -x" +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" SUBSYSTEMS=="usb", \ ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", \ ENV{ID_CLASS}="kbd" @@ -25,14 +25,14 @@ ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", \ ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" # by-id links, generic and for the event devices -KERNEL=="mouse*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" # by-path links IMPORT{program}="path_id %p" -KERNEL=="mouse*", ENV{ID_PATH}=="?*", \ +KERNEL=="mouse*|js*", ENV{ID_PATH}=="?*", \ SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" KERNEL=="event*", ENV{ID_PATH}=="?*", \ SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" diff --git a/etc/udev/debian/persistent-net-generator.rules b/etc/udev/debian/persistent-net-generator.rules new file mode 100644 index 0000000000..6df00bff2f --- /dev/null +++ b/etc/udev/debian/persistent-net-generator.rules @@ -0,0 +1,48 @@ +# These rules generate rules to keep network interface names unchanged +# across reboots write them to /etc/udev/rules.d/z25_persistent-net.rules. +# +# The default name for this file is z45_persistent-net-generator.rules. + +ACTION!="add", GOTO="persistent_net_generator_end" +SUBSYSTEM!="net", GOTO="persistent_net_generator_end" + +# ignore the interface if a name has already been set +NAME=="?*", GOTO="persistent_net_generator_end" + +# ignore Xen virtual interfaces +SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" + +# ignore UML virtual interfaces +DRIVERS=="uml-netdev", GOTO="persistent_net_generator_end" + +# ignore VMWare virtual interfaces +ATTR{address}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" + +# ignore interfaces with random MAC addresses +ATTR{address}=="?[2367abef]:*", GOTO="persistent_net_generator_end" + +# ignore "secondary" raw interfaces of the madwifi driver +KERNEL=="ath*", ATTRS{type}=="802", GOTO="persistent_net_generator_end" + +# provide nice comments for the generated rules +SUBSYSTEMS=="pci", \ + ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}" +SUBSYSTEMS=="usb", \ + ENV{COMMENT}="USB device $attr{idVendor}:$attr{idProduct}" +SUBSYSTEMS=="ccwgroup", \ + ENV{COMMENT}="S/390 device at $id", +SUBSYSTEMS=="ieee1394", \ + ENV{COMMENT}="Firewire device $attr{host_id}" +ENV{COMMENT}=="", \ + ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})" +ATTRS{driver}=="?*", \ + ENV{COMMENT}="$env{COMMENT} ($attr{driver})" + +# ignore interfaces without a driver link like bridges and VLANs +KERNEL=="eth*|ath*|wlan*|ra*|sta*|ctc*|lcs*|hsi*", DRIVERS=="?*",\ + IMPORT{program}="write_net_rules $attr{address}" + +ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" + +LABEL="persistent_net_generator_end" + diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules index c82a639556..de2fa2a928 100644 --- a/etc/udev/debian/persistent.rules +++ b/etc/udev/debian/persistent.rules @@ -1,17 +1,20 @@ # This file contains the rules needed to create persistent device names. # we are only interested in add actions for block devices -SUBSYSTEM!="block", GOTO="no_volume_id" -ACTION!="add", GOTO="no_volume_id" +ACTION!="add", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" # and we can safely ignore these kinds of devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="no_volume_id" +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" # skip removable ide devices, because open(2) on them causes an events loop KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ - GOTO="no_volume_id" + GOTO="persistent_storage_end" KERNEL=="hd*[0-9]", ATTRS{removable}=="1", \ - GOTO="no_volume_id" + GOTO="persistent_storage_end" + +# ignore partitions that span the entire disk +ATTR{whole_disk}=="*", GOTO="persistent_storage_end" # skip xen virtual hard disks DRIVERS=="vbd", GOTO="no_hardware_id" @@ -28,6 +31,8 @@ KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ IMPORT{program}="scsi_id -g -x -s $devpath -d $tempnode" KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ IMPORT{program}="scsi_id -g -x -a -s $devpath -d $tempnode" +KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="", + IMPORT{program}="scsi_id -g -x -n -s $devpath -d $tempnode" KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="", \ IMPORT{program}="scsi_id -g -x -s $devpath -d $tempnode" KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="", \ @@ -51,10 +56,10 @@ KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL_SHORT}=="?*", \ +KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL_SHORT}=="?*", \ ENV{ID_VENDOR}=="ATA", \ SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}" -KERNEL=="sd*[0-9]", ENV{ID_SERIAL_SHORT}=="?*", \ +KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL_SHORT}=="?*", \ ENV{ID_VENDOR}=="ATA", \ SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}-part%n" @@ -81,22 +86,22 @@ KERNEL=="nst*", ENV{ID_SERIAL}=="?*", \ KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="*[!0-9]|sr*", ENV{ID_PATH}=="?*", \ +KERNEL=="*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_PATH}=="?*", \ SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="*[0-9]|cciss*p[0-9]", ENV{ID_PATH}=="?*", \ + SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" KERNEL=="st*", ENV{ID_PATH}=="?*", \ SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="no_volume_id" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" +KERNEL=="sr*|st*", GOTO="persistent_storage_end" # UUID and volume label -KERNEL=="*[!0-9]", ATTR{removable}=="1", GOTO="no_volume_id" +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ - SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ - SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" +ENV{ID_FS_UUID_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ + SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_LABEL_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ + SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" # end of processing -LABEL="no_volume_id" +LABEL="persistent_storage_end" diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules index 3f7b704f78..af16c17f48 100644 --- a/etc/udev/debian/udev.rules +++ b/etc/udev/debian/udev.rules @@ -35,6 +35,7 @@ SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ # usbfs-like devices SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ NAME="%c" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" # serial devices KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" @@ -62,6 +63,7 @@ KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" KERNEL=="uverbs*", NAME="infiniband/%k" KERNEL=="ucm*", NAME="infiniband/%k" +KERNEL=="rdma_ucm", NAME="infiniband/%k" # ALSA devices KERNEL=="controlC[0-9]*", NAME="snd/%k" -- cgit v1.2.3-54-g00ecf From d638611c44672dea8d8a498dbe84c7d650ef2194 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 10 Aug 2007 12:36:59 +0200 Subject: rules: add default rules --- etc/udev/rules.d/50-udev-default.rules | 104 +++++++++++++++++++++++++++++++++ etc/udev/rules.d/80-drivers.rules | 14 +++++ 2 files changed, 118 insertions(+) create mode 100644 etc/udev/rules.d/50-udev-default.rules create mode 100644 etc/udev/rules.d/80-drivers.rules diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules new file mode 100644 index 0000000000..35ac99e362 --- /dev/null +++ b/etc/udev/rules.d/50-udev-default.rules @@ -0,0 +1,104 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS="last_rule" +KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS="last_rule" +KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", OPTIONS="last_rule" +KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty", OPTIONS="last_rule" +KERNEL=="console", MODE="0600", OPTIONS="last_rule" +KERNEL=="tty0", SYMLINK+="systty" + +# serial +KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" +KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" +KERNEL=="mwave", NAME="modems/mwave", GROUP="uucp" +KERNEL=="hvc*|hvsi*", GROUP="uucp" +KERNEL=="lirc0", SYMLINK+="lirc" + +# mem +KERNEL=="null|zero|random", MODE="0666" +KERNEL=="null", SYMLINK+="XOR" +KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" +KERNEL=="nvram", GROUP="kmem", MODE="0600" +KERNEL=="ram0", SYMLINK+="ramdisk" +KERNEL=="ram1", SYMLINK+="ram" +KERNEL=="urandom", MODE="0644" +KERNEL=="full", MODE="0666" + +# input +KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" +KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0600" +KERNEL=="js[0-9]*", NAME="input/%k", MODE="0644", SYMLINK+="%k" + +# video4linux +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="video0", SYMLINK+="video" + +# graphics +KERNEL=="agpgart", MODE="0600" +KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666" +KERNEL=="fb0", SYMLINK+="fb" + +# DVB video +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" + +# Firewire +KERNEL=="dv1394*", SYMLINK+="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# firmware class requests +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" + +# libusb device nodes +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" + +# printer +KERNEL=="parport[0-9]*", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +KERNEL=="lp[0-9]*", GROUP="lp" SYMLINK+="par%n" +KERNEL=="irlpt[0-9]*", GROUP="lp" + +# block, tapes, block-releated +SUBSYSTEM=="block", GROUP="disk", MODE="0640" +SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" +KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" +KERNEL=="fd[0-9]", GROUP="floppy" +KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" +KERNEL=="sch[0-9]*", GROUP="disk" +KERNEL=="sg[0-9]*", GROUP="disk", MODE="0640" +KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk"" +KERNEL=="pg[0-9]*", GROUP="disk" +KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" +KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" +KERNEL=="rawctl", NAME="raw/%k", GROUP="disk" +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" +KERNEL=="pktcdvd", NAME="pktcdvd/control" +KERNEL=="qft0", SYMLINK+="ftape" + +# network +KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" + +# CPU +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# miscellaneous +KERNEL=="fuse", MODE="0666" +KERNEL=="rtc", MODE="0644" +KERNEL=="auer[0-9]*" NAME="usb/%k" +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +KERNEL=="mmtimer", MODE="0644" +KERNEL=="rflash[0-9]*", MODE="0400" +KERNEL=="rrom[0-9]*", MODE="0400" +KERNEL=="sbpcd0", SYMLINK+="sbpcd" +KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" +KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" +KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" + diff --git a/etc/udev/rules.d/80-drivers.rules b/etc/udev/rules.d/80-drivers.rules new file mode 100644 index 0000000000..c7ba54fe4f --- /dev/null +++ b/etc/udev/rules.d/80-drivers.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="drivers_end" + +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" +SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \ + RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" +SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" +SUBSYSTEM=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" + +LABEL="drivers_end" + -- cgit v1.2.3-54-g00ecf From 95ea93bc6a54cc2bf0e2028f6e86ae7cbee3bfa2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 10 Aug 2007 12:37:34 +0200 Subject: ruls: update SUSE rules --- etc/udev/suse/40-suse.rules | 14 ++++ etc/udev/suse/50-udev-default.rules | 126 ------------------------------------ etc/udev/suse/80-drivers.rules | 15 ----- 3 files changed, 14 insertions(+), 141 deletions(-) create mode 100644 etc/udev/suse/40-suse.rules delete mode 100644 etc/udev/suse/50-udev-default.rules delete mode 100644 etc/udev/suse/80-drivers.rules diff --git a/etc/udev/suse/40-suse.rules b/etc/udev/suse/40-suse.rules new file mode 100644 index 0000000000..863da886db --- /dev/null +++ b/etc/udev/suse/40-suse.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="pmu", GROUP="video" +KERNEL=="nvidia*|nvidiactl*", GROUP="video" +KERNEL=="nvidia*|nvidiactl*", GROUP="video" +KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" +KERNEL=="vttuner*", GROUP="video" +KERNEL=="vtx*|vbi*", GROUP="video" +KERNEL=="winradio*", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="graphics" GROUP="video" +SUBSYSTEM=="video4linux", GROUP="video" +KERNEL=="agpgart", GROUP="video" + diff --git a/etc/udev/suse/50-udev-default.rules b/etc/udev/suse/50-udev-default.rules deleted file mode 100644 index 4a3fe2c948..0000000000 --- a/etc/udev/suse/50-udev-default.rules +++ /dev/null @@ -1,126 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# console -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="tty[0-9]*|vcs*", GROUP="tty", MODE="0620", OPTIONS="last_rule" -KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="console", MODE="0600", OPTIONS="last_rule" - -# serial devices -KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" -KERNEL=="hvc*|hvsi*", GROUP="uucp" -KERNEL=="iseries/vtty*", GROUP="uucp" -KERNEL=="mwave", NAME="modems/%k", GROUP="uucp" -KERNEL=="ttyUSB*", ATTRS{product}=="[Pp]alm*Handheld*", SYMLINK+="pilot" -KERNEL=="ttyUSB*", ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*", SYMLINK+="pilot" -KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" - -# video/graphics -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="graphics" GROUP="video" -KERNEL=="vtx*|vbi*", GROUP="video" -KERNEL=="winradio*", GROUP="video" -KERNEL=="vttuner*", GROUP="video" -KERNEL=="nvidia*|nvidiactl*", GROUP="video" -KERNEL=="video0", SYMLINK+="video" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="vbi0", SYMLINK+="vbi" -KERNEL=="pmu", GROUP="video" - -# dvb -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" - -# input devices -KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" -KERNEL=="js*", NAME="input/%k", MODE="0644" -KERNEL=="ts*|uinput", NAME="input/%k", MODE="0600" -KERNEL=="lirc0", SYMLINK+="lirc" - -# printer -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" -KERNEL=="irlpt*", GROUP="lp" - -# cpu devices -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" - -# IEEE1394 devices -KERNEL=="raw1394*", GROUP="video" -KERNEL=="dv1394*", SYMLINK+="dv1394/%n", GROUP="video" -KERNEL=="video1394*", SYMLINK+="video1394/%n", GROUP="video" - -KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" -KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" -KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" - -# network -KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" - -# misc devices -KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" -KERNEL=="nvram", GROUP="kmem", MODE="0600" -KERNEL=="null|zero|random", MODE="0666" -KERNEL=="full", MODE="0622" -KERNEL=="urandom", MODE="0644" -KERNEL=="rtc", MODE="0600" -KERNEL=="fuse", MODE="0666" -KERNEL=="sonypi", MODE="0666" -KERNEL=="agpgart", MODE="0600", GROUP="video" -KERNEL=="djs*", MODE="0644" -KERNEL=="sgi_*", MODE="0666" -KERNEL=="rrom*", MODE="0400" -KERNEL=="rflash*", MODE="0400" -KERNEL=="usbscanner*", MODE="0644" -KERNEL=="3270/ttycons*", MODE="0600" -KERNEL=="3270/tub*", MODE="0666" -KERNEL=="3270/tubcons*", MODE="0600" -KERNEL=="ica", MODE="0666" -KERNEL=="z90crypt", MODE="0666" -KERNEL=="mmtimer", MODE="0644" -KERNEL=="auer[0-9]*" NAME="usb/%k" - -# packet writing interface -KERNEL=="pktcdvd", NAME="pktcdvd/control" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" - -# additional floppy devices (no sysfs entries) -KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G disk $root/%k" - -# block devices -SUBSYSTEM=="block", GROUP="disk", MODE="0640" -SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" - -# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC -# sr: 4 TYPE_WORM, 5 TYPE_ROM -# st/osst: 1 TYPE_TAPE -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" -KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" - -# misc storage devices (non-block) -KERNEL=="sg*", GROUP="disk", MODE="0640" -KERNEL=="st*|nst*", GROUP="disk" -KERNEL=="qft*|nqft*|zqft*|nzqft*|rawqft*|nrawqft", GROUP="disk" -KERNEL=="ht*|nht*", GROUP="disk" -KERNEL=="pf*", GROUP="disk" -KERNEL=="sch*", GROUP="disk" -KERNEL=="pt*|npt*", GROUP="disk" -KERNEL=="pg*", GROUP="disk" -KERNEL=="evms/block_device*", GROUP="disk" -KERNEL=="rawctl*", NAME="raw/%k", GROUP="disk" -SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL=="osst*|nosst*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" - -# libusb device access -SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" - -# kernel firmware loader -SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" - diff --git a/etc/udev/suse/80-drivers.rules b/etc/udev/suse/80-drivers.rules deleted file mode 100644 index e7ae8dc19e..0000000000 --- a/etc/udev/suse/80-drivers.rules +++ /dev/null @@ -1,15 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="drivers_end" - -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" - -SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" - -SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", ATTR{vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" - -LABEL="drivers_end" -- cgit v1.2.3-54-g00ecf From fcfeda1907035a3d3c7afc67ad38b032b87f36d9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 10 Aug 2007 12:40:17 +0200 Subject: rules: add packages rules --- etc/udev/packages/40-alsa.rules | 11 +++++++++++ etc/udev/packages/40-pilot-links.rules | 4 ++++ etc/udev/packages/40-ppc.rules | 6 ++++++ etc/udev/packages/40-s390.rules | 4 ++++ etc/udev/packages/40-zaptel.rules | 8 ++++++++ etc/udev/packages/64-device-mapper.rules | 4 ++++ 6 files changed, 37 insertions(+) create mode 100644 etc/udev/packages/40-alsa.rules create mode 100644 etc/udev/packages/40-pilot-links.rules create mode 100644 etc/udev/packages/40-ppc.rules create mode 100644 etc/udev/packages/40-s390.rules create mode 100644 etc/udev/packages/40-zaptel.rules create mode 100644 etc/udev/packages/64-device-mapper.rules diff --git a/etc/udev/packages/40-alsa.rules b/etc/udev/packages/40-alsa.rules new file mode 100644 index 0000000000..d30a1da8fc --- /dev/null +++ b/etc/udev/packages/40-alsa.rules @@ -0,0 +1,11 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" +KERNEL=="mixer0", SYMLINK+="mixer" +KERNEL=="dsp0", SYMLINK+="dsp" +KERNEL=="audio0", SYMLINK+="audio" diff --git a/etc/udev/packages/40-pilot-links.rules b/etc/udev/packages/40-pilot-links.rules new file mode 100644 index 0000000000..1242fff102 --- /dev/null +++ b/etc/udev/packages/40-pilot-links.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="ttyUSB*", ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", SYMLINK+="pilot" + diff --git a/etc/udev/packages/40-ppc.rules b/etc/udev/packages/40-ppc.rules new file mode 100644 index 0000000000..8b62d79e0c --- /dev/null +++ b/etc/udev/packages/40-ppc.rules @@ -0,0 +1,6 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" +KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vtty*", GROUP="uucp" diff --git a/etc/udev/packages/40-s390.rules b/etc/udev/packages/40-s390.rules new file mode 100644 index 0000000000..43035dbe60 --- /dev/null +++ b/etc/udev/packages/40-s390.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="z90crypt", MODE="0666" + diff --git a/etc/udev/packages/40-zaptel.rules b/etc/udev/packages/40-zaptel.rules new file mode 100644 index 0000000000..4313a9172e --- /dev/null +++ b/etc/udev/packages/40-zaptel.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="zap[0-9]*", NAME="zap/%n" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zaptimer", NAME="zap/timer" + diff --git a/etc/udev/packages/64-device-mapper.rules b/etc/udev/packages/64-device-mapper.rules new file mode 100644 index 0000000000..8154ef3702 --- /dev/null +++ b/etc/udev/packages/64-device-mapper.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="device-mapper", NAME="mapper/control" + -- cgit v1.2.3-54-g00ecf From 8cfe6b456ef7c15d3af20e9efa710b7cf4ea0f76 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 10 Aug 2007 13:30:35 +0200 Subject: rules: add ia64 rules --- etc/udev/packages/40-ia64.rules | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 etc/udev/packages/40-ia64.rules diff --git a/etc/udev/packages/40-ia64.rules b/etc/udev/packages/40-ia64.rules new file mode 100644 index 0000000000..5846f88b1b --- /dev/null +++ b/etc/udev/packages/40-ia64.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="sgi_*", MODE="0666" + -- cgit v1.2.3-54-g00ecf From 6ffa398695ded5594e6706e17aadfd95a7ea7d76 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 10 Aug 2007 14:53:31 +0200 Subject: rules: fix typo in 80-drivers.rules --- etc/udev/rules.d/80-drivers.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/80-drivers.rules b/etc/udev/rules.d/80-drivers.rules index c7ba54fe4f..e71f1350e0 100644 --- a/etc/udev/rules.d/80-drivers.rules +++ b/etc/udev/rules.d/80-drivers.rules @@ -4,7 +4,7 @@ ACTION!="add", GOTO="drivers_end" DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \ - RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" + RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" -- cgit v1.2.3-54-g00ecf From 21ac1311d806e5506e01809ff5cb68b2d6ae8a92 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 10 Aug 2007 15:23:34 +0200 Subject: rules: move md-raid rules to packages dir --- etc/udev/packages/64-md-raid.rules | 18 ++++++++++++++++++ etc/udev/suse/64-md-raid.rules | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 etc/udev/packages/64-md-raid.rules delete mode 100644 etc/udev/suse/64-md-raid.rules diff --git a/etc/udev/packages/64-md-raid.rules b/etc/udev/packages/64-md-raid.rules new file mode 100644 index 0000000000..02f27ee07e --- /dev/null +++ b/etc/udev/packages/64-md-raid.rules @@ -0,0 +1,18 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM!="block", GOTO="md_end" +KERNEL!="md[0-9]*", GOTO="md_end" +ACTION!="add|change", GOTO="md_end" + +ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" + +IMPORT{program}="/sbin/mdadm --detail --export $tempnode" +ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" +ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" + +IMPORT{program}="vol_id --export $tempnode" +OPTIONS="link_priority=100" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="md_end" diff --git a/etc/udev/suse/64-md-raid.rules b/etc/udev/suse/64-md-raid.rules deleted file mode 100644 index 02f27ee07e..0000000000 --- a/etc/udev/suse/64-md-raid.rules +++ /dev/null @@ -1,18 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM!="block", GOTO="md_end" -KERNEL!="md[0-9]*", GOTO="md_end" -ACTION!="add|change", GOTO="md_end" - -ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" - -IMPORT{program}="/sbin/mdadm --detail --export $tempnode" -ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" -ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" - -IMPORT{program}="vol_id --export $tempnode" -OPTIONS="link_priority=100" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="md_end" -- cgit v1.2.3-54-g00ecf From 1bc19dbc6b3d9bfbb8d5d63b16c672f5c37e79ff Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 11 Aug 2007 14:01:54 +0200 Subject: rules: run vol_id only for partitions Until we add support to the kernel to report media changes with a "change" event, do not read the device content, because it will not get updated when the media is removed or replaced. --- etc/udev/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index a49321c5fc..62cdad67cb 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -59,7 +59,7 @@ KERNEL=="sr*|st*", GOTO="persistent_storage_end" KERNEL=="hd*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" # by-label/by-uuid (filesystem properties) -IMPORT{program}="vol_id --export $tempnode" +ENV{DEVTYPE}=="partition", IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" -- cgit v1.2.3-54-g00ecf From b1a2b83f2da105c0b98fd9636477ca7632986243 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 11 Aug 2007 14:06:03 +0200 Subject: rules: update Fedora rules --- etc/udev/redhat/40-redhat.rules | 27 ++++ etc/udev/redhat/50-udev.rules | 322 ---------------------------------------- 2 files changed, 27 insertions(+), 322 deletions(-) create mode 100644 etc/udev/redhat/40-redhat.rules delete mode 100644 etc/udev/redhat/50-udev.rules diff --git a/etc/udev/redhat/40-redhat.rules b/etc/udev/redhat/40-redhat.rules new file mode 100644 index 0000000000..30da7d3bdc --- /dev/null +++ b/etc/udev/redhat/40-redhat.rules @@ -0,0 +1,27 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="hd*[!0-9]", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove" +KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", SYMLINK+="floppy-%k", OPTIONS+="ignore_remove" + +KERNEL=="fw*", PROGRAM="fw_unit_symlinks.sh %k %n", SYMLINK+="$result" + +ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="[36]", SYMLINK+="scanner scanner-%k", MODE="0660" + +ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" + +ACTION=="add", SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" + +BUS=="usb", KERNEL=="sd*", ATTRS{bInterfaceClass}=="08", ATTRS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", SYMLINK+="floppy floppy-%k" + +KERNEL=="fd[0-9]*", SYMLINK+="floppy floppy-%k" + +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \ + RUN+="/sbin/modprobe sd_mod" +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \ + RUN+="/sbin/modprobe sr_mod" + +KERNEL=="vcs", OWNER="vcsa", GROUP="tty" +KERNEL=="vcs[0-9]*", OWNER="vcsa", GROUP="tty" +KERNEL=="vcsa", OWNER="vcsa", GROUP="tty" +KERNEL=="vcsa[0-9]*", OWNER="vcsa", GROUP="tty" +KERNEL=="vcc/*", OWNER="vcsa", GROUP="tty" diff --git a/etc/udev/redhat/50-udev.rules b/etc/udev/redhat/50-udev.rules deleted file mode 100644 index 668785f4ce..0000000000 --- a/etc/udev/redhat/50-udev.rules +++ /dev/null @@ -1,322 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# default is OWNER="root" GROUP="root", MODE="0600" -# - -KERNEL=="*", OWNER="root", GROUP="root", MODE="0600" - -# all block devices -SUBSYSTEM=="block", GROUP="disk", MODE="0640" -KERNEL=="root", GROUP="disk", MODE="0640" - -# console devices -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL=="console", NAME="%k", MODE="0600" -KERNEL=="tty[0-9]*", NAME="%k", GROUP="tty", MODE="0660" -KERNEL=="vc/[0-9]*", NAME="%k", GROUP="tty", MODE="0660" - -# pty devices -# Set this to 0660 if you only want users belonging to tty group -# to be able to allocate PTYs -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="666" -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", MODE="660" -KERNEL=="pty/m*", NAME="%k", GROUP="tty", MODE="0660" - -# serial+dialup devices -KERNEL=="ippp*", NAME="%k", MODE="0660" -KERNEL=="isdn*", NAME="%k", MODE="0660" -KERNEL=="isdnctrl*", NAME="%k", MODE="0660" -KERNEL=="capi", NAME="capi20", GROUP="uucp", MODE="0660" -KERNEL=="capi*", NAME="capi/%n", GROUP="uucp", MODE="0660" -KERNEL=="dcbri*", NAME="%k", MODE="0660" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="tts/[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="tts/USB[0-9]*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="tty[A-Z]*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="pppox*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="modems/mwave*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="hvc*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="hvsi*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp", MODE="0660" - -# vc devices -KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty" -KERNEL=="vcs[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty" -KERNEL=="vcsa", NAME="%k", OWNER="vcsa", GROUP="tty" -KERNEL=="vcsa[0-9]*", NAME="%k", OWNER="vcsa", GROUP="tty" -KERNEL=="vcc/*", NAME="%k", OWNER="vcsa", GROUP="tty" - -# memory devices -KERNEL=="random", MODE="0666" -KERNEL=="urandom", MODE="0444" -KERNEL=="mem", GROUP="kmem", MODE="0640" -KERNEL=="kmem", GROUP="kmem", MODE="0640" -KERNEL=="port", GROUP="kmem", MODE="0640" -KERNEL=="full", MODE="0666" -KERNEL=="null", MODE="0666" -KERNEL=="zero", MODE="0666" -# 183 = /dev/hwrng Generic random number generator -KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" - -# misc devices -KERNEL=="nvram", MODE="0660" -KERNEL=="rtc", MODE="0644" - -# floppy devices -KERNEL=="fd[01]*", GROUP="floppy", MODE="0660" - -# fix floppy devices -KERNEL=="nvram", ACTION=="add", RUN+="load_floppy_module.sh" - -KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", \ - RUN+="create_floppy_devices -c -t $attr{cmos} -m %M /dev/%k" - -KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f /dev/%k*'" - -BUS=="usb", KERNEL=="sd*", ATTRS{bInterfaceClass}=="08", \ - ATTRS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", \ - SYMLINK+="floppy floppy-%k" - -# audio devices -KERNEL=="dsp*", MODE="0660" -KERNEL=="audio*", MODE="0660" -KERNEL=="midi*", MODE="0660" -KERNEL=="mixer*", MODE="0660" -KERNEL=="sequencer*", MODE="0660" -KERNEL=="sound/*", MODE="0660" -KERNEL=="snd/*", MODE="0660" -KERNEL=="beep", MODE="0660" -KERNEL=="admm*", MODE="0660" -KERNEL=="adsp*", MODE="0660" -KERNEL=="aload*", MODE="0660" -KERNEL=="amidi*", MODE="0660" -KERNEL=="dmfm*", MODE="0660" -KERNEL=="dmmidi*", MODE="0660" -KERNEL=="sndstat", MODE="0660" - -# lp devices -KERNEL=="lp*", GROUP="lp", MODE="0660" -KERNEL=="parport*", GROUP="lp", MODE="0660" -KERNEL=="irlpt*", GROUP="lp", MODE="0660" -KERNEL=="usblp*", GROUP="lp", MODE="0660" -KERNEL=="usb/lp*", GROUP="lp", MODE="0660" - -# tape devices -SUBSYSTEM=="ide", ATTRS{media}=="tape", ACTION=="add", \ - RUN+="/sbin/modprobe ide-scsi idescsi_nocd=1" -KERNEL=="ht*", GROUP="disk", MODE="0660" -KERNEL=="nht*", GROUP="disk", MODE="0660" -KERNEL=="pt[0-9]*", GROUP="disk", MODE="0660" -KERNEL=="npt*", GROUP="disk", MODE="0660" -KERNEL=="st*", GROUP="disk", MODE="0660" -KERNEL=="nst*", GROUP="disk", MODE="0660" -KERNEL=="osst*", GROUP="disk", MODE="0660" -KERNEL=="nosst*", GROUP="disk", MODE="0660" - -# diskonkey devices -KERNEL=="diskonkey*", GROUP="disk", MODE="0640" - -# rem_ide devices -KERNEL=="microdrive*", GROUP="disk", MODE="0640" - -# kbd devices -KERNEL=="kbd", MODE="0644" - -# joystick devices -KERNEL=="js[0-9]*", MODE="0644" -KERNEL=="djs[0-9]*", MODE="0644" - -# v4l devices -KERNEL=="video*", MODE="0660" -KERNEL=="radio*", MODE="0660" -KERNEL=="winradio*", MODE="0660" -KERNEL=="vtx*", MODE="0660" -KERNEL=="vbi*", MODE="0660" -KERNEL=="video/*", MODE="0660" -KERNEL=="vttuner", MODE="0660" -KERNEL=="v4l/*", MODE="0660" - -# input devices -KERNEL=="input/*", MODE="0660" - -# gpm devices -KERNEL=="gpmctl", MODE="0700" - -# dri devices -KERNEL=="nvidia*", MODE="0660" -KERNEL=="3dfx*", MODE="0660" -KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666" - -# usb devices -KERNEL=="usb/dabusb*", MODE="0660" -KERNEL=="usb/mdc800*", MODE="0660" -KERNEL=="usb/rio500", MODE="0660" - -# s390 devices -KERNEL=="z90crypt", MODE="0666" -KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" - -# DVB -KERNEL=="dvb", MODE="0660" -SUBSYSTEM=="dvb", \ - PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", \ - NAME="%c", MODE="0660" - -KERNEL=="dm-[0-9]*", ACTION=="add", OPTIONS+="ignore_device" - -# alsa devices -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hw[CD0-9]*", NAME="snd/%k" -KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL=="midi[CD0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# input devices -KERNEL=="mice", NAME="input/%k" -KERNEL=="mouse*", NAME="input/%k" -KERNEL=="event*", NAME="input/%k" -KERNEL=="js*", NAME="input/%k", SYMLINK+="%k" -KERNEL=="ts*", NAME="input/%k" -KERNEL=="uinput", NAME="input/%k" - -# IEEE1394 (firewire) devices (must be before raw devices below) -KERNEL=="raw1394", NAME="%k" -KERNEL=="dv1394*", NAME="dv1394/%n" -KERNEL=="video1394*", NAME="video1394/%n" - -KERNEL=="fw*", PROGRAM="fw_unit_symlinks.sh %k %n", SYMLINK+="$result" - -KERNEL=="raw[0-9]*", NAME="raw/%k" - -KERNEL=="lp[0-9]*", SYMLINK+="par%n" -BUS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" - -KERNEL=="microcode", NAME="cpu/%k" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" - -KERNEL=="ram1", SYMLINK+="ram" -KERNEL=="video0", SYMLINK+="video" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="audio0", SYMLINK+="audio" -KERNEL=="dsp0", SYMLINK+="dsp" -KERNEL=="fb0", SYMLINK+="fb" -KERNEL=="qft0", SYMLINK+="ftape" -KERNEL=="isdnctrl0", SYMLINK+="isdnctrl" -KERNEL=="mixer0", SYMLINK+="mixer" -KERNEL=="ram0", SYMLINK+="ramdisk" -KERNEL=="sbpcd0", SYMLINK+="sbpcd" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="tty0", SYMLINK+="systty" -KERNEL=="vbi0", SYMLINK+="vbi" -KERNEL=="null", SYMLINK+="XOR" - -KERNEL=="tun", NAME="net/%k", MODE="0666" - -KERNEL=="device-mapper", NAME="mapper/control" - -# old compat symlinks with enumeration -KERNEL=="sr[0-9]*", SYMLINK+="cdrom cdrom-%k" -KERNEL=="scd[0-9]*", SYMLINK+="cdrom cdrom-%k" -KERNEL=="pcd[0-9]*", SYMLINK+="cdrom cdrom-%k" -KERNEL=="fd[0-9]*", SYMLINK+="floppy floppy-%k" -KERNEL=="nst[0-9]", BUS=="scsi", SYMLINK+="tape tape-%k", MODE="0660" -KERNEL=="nosst[0-9]", BUS=="scsi", SYMLINK+="tape tape-%k", MODE="0660" - -# Section for zaptel device -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -KERNEL=="pktcdvd", NAME="%k/control" - -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", \ - ATTR{media}=="floppy", \ - SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions" - -KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", \ - SYMLINK+="floppy-%k" - -KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", ATTRS{media}=="cdrom", \ - SYMLINK+="cdrom cdrom-%k" - -KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", \ - PROGRAM=="check-cdrom.sh %k DVD", SYMLINK+="dvd dvd-%k" -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD", \ - SYMLINK+="dvd dvd-%k" - -KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", \ - PROGRAM=="check-cdrom.sh %k CD-R", \ - SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" - -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k CD-R", \ - SYMLINK+="cdwriter cdwriter-%k cdrw cdrw-%k" - -KERNEL=="hd[a-z]", BUS=="ide", ATTRS{removable}=="1", \ - PROGRAM="check-cdrom.sh %k DVD-R", \ - SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" - -KERNEL=="sr[0-9]*", BUS=="scsi", PROGRAM=="check-cdrom.sh %k DVD-R", \ - SYMLINK+="dvdwriter dvdwriter-%k dvdrw dvdrw-%k" - -# rename sr* to scd* -KERNEL=="sr[0-9]*", BUS=="scsi", NAME="scd%n" -KERNEL=="hd*[0-9]", BUS=="ide", ATTRS{removable}=="1", \ - OPTIONS+="ignore_remove" - -SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ - NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" - -ACTION=="add", SUBSYSTEM=="usb_device", \ - PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \ - NAME="%c", MODE="0644" - -ACTION=="add", SUBSYSTEM=="usb_endpoint", \ - ATTR{bEndpointAddress}=="?*", ATTRS{devnum}=="?*", ATTRS{busnum}=="?*", \ - NAME="bus/usb/$attr{busnum}/$attr{devnum}_ep/$attr{bEndpointAddress}", \ - MODE="0644", SYMLINK+="%k" - -# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC -# sr: 4 TYPE_WORM, 5 TYPE_ROM -# st/osst: 1 TYPE_TAPE -# sg: 8 changer, [36] scanner -ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="0|7|14", \ - RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" -ACTION=="add", SUBSYSTEM=="scsi" , ATTRS{type}=="1", \ - RUN+="/bin/sh -c 'echo 900 > /sys$$DEVPATH/timeout'" - - -ACTION=="add", SUBSYSTEM=="scsi_device" RUN+="/sbin/modprobe sg" -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \ - RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \ - RUN+="/sbin/modprobe sr_mod" - -ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="[36]", \ - SYMLINK+="scanner scanner-%k", MODE="0660" - -ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", \ - SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" - -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", \ - ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst" -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", \ - ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}=="ADR*", RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="1", \ - ATTRS{vendor}!="On[sS]tream", \ - RUN+="/sbin/modprobe st" - -# mmc block devices -ACTION=="add", SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" - - -RUN+="socket:/org/kernel/udev/monitor" - -- cgit v1.2.3-54-g00ecf From 88b74dc69226ff64e5ab7a80077f331729202083 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Aug 2007 11:06:39 +0200 Subject: edd_id: move persistent rules to its own file --- etc/udev/rules.d/60-persistent-storage.rules | 5 ----- extras/edd_id/61-persistent-storage-edd.rules | 10 ++++++++++ extras/edd_id/Makefile | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 extras/edd_id/61-persistent-storage-edd.rules diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 62cdad67cb..63e715d415 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -63,9 +63,4 @@ ENV{DEVTYPE}=="partition", IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" -# BIOS Enhanced Disk Device -ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $tempnode" -ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - LABEL="persistent_storage_end" diff --git a/extras/edd_id/61-persistent-storage-edd.rules b/extras/edd_id/61-persistent-storage-edd.rules new file mode 100644 index 0000000000..aed60db493 --- /dev/null +++ b/extras/edd_id/61-persistent-storage-edd.rules @@ -0,0 +1,10 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="persistent_storage_edd_end" + +# BIOS Enhanced Disk Device +ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $tempnode" +ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +LABEL="persistent_storage_edd_end" diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index 71cc3dad7c..f52c3bc3f0 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -50,10 +50,12 @@ clean: install-bin: all $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL_DATA) -D 61-persistent-storage-edd.rules $(DESTDIR)$(configdir)/rules.d/61-persistent-storage-edd.rules .PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(libudevdir)/$(PROG) + - rm $(DESTDIR)$(configdir)/rules.d/61-persistent-storage-edd.rules .PHONY: uninstall-bin install-man: -- cgit v1.2.3-54-g00ecf From 03f65fe6a9cd32a5861b1a929cdf4f7eddbd593f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Aug 2007 12:45:31 +0200 Subject: accept relative path for TEST --- test/udev-test.pl | 28 ++++++++++++++++++++++++++++ udev_rules.c | 8 ++++++++ 2 files changed, 36 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 53499d8871..fe1c6da4f9 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1568,6 +1568,34 @@ EOF exp_name => "00:e0:00:fb:04:e1", rules => < "TEST absolute path", + subsys => "block", + devpath => "/block/sda", + exp_name => "there", + rules => < "TEST subsys/kernel lookup", + subsys => "block", + devpath => "/block/sda", + exp_name => "yes", + rules => < "TEST relative path", + subsys => "block", + devpath => "/block/sda", + exp_name => "relative", + rules => <dev->devpath, sizeof(tmp)); + strlcat(tmp, "/", sizeof(tmp)); + strlcat(tmp, filename, sizeof(tmp)); + strlcpy(filename, tmp, sizeof(filename)); } match = (stat(filename, &statbuf) == 0); -- cgit v1.2.3-54-g00ecf From 05f9e004eda6391262e085245c4bcfb64f322e5d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Aug 2007 12:47:37 +0200 Subject: rules: add iowarrior rule --- etc/udev/rules.d/50-udev-default.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index 35ac99e362..bff2fe58db 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -101,4 +101,5 @@ KERNEL=="sbpcd0", SYMLINK+="sbpcd" KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" +KERNEL=="iowarrior[0-9]*", NAME="usb/%k" -- cgit v1.2.3-54-g00ecf From 82d4209792035676f1aea2cdaa38bbbf2bd43e04 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Aug 2007 15:02:53 +0200 Subject: volume_id: fix sqashfs detection --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/squashfs.c | 30 ++++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 0a37c26e8b..ce07d8dd20 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 79 +SHLIB_REV = 80 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index 99cc78aa41..402a114e1b 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -29,7 +29,15 @@ #define SQUASHFS_MAGIC 0x73717368 struct squashfs_super { - uint32_t s_magic; + uint32_t s_magic; + uint32_t inodes; + uint32_t bytes_used_2; + uint32_t uid_start_2; + uint32_t guid_start_2; + uint32_t inode_table_start_2; + uint32_t directory_table_start_2; + uint16_t s_major; + uint16_t s_minor; } PACKED; int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size) @@ -38,15 +46,25 @@ int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size) info("probing at offset 0x%llx", (unsigned long long) off); - sqs = (struct squashfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); + sqs = (struct squashfs_super *) volume_id_get_buffer(id, off, 0x200); if (sqs == NULL) return -1; - if (sqs->s_magic == SQUASHFS_MAGIC || sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) { - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "squashfs"; - return 0; + if (sqs->s_magic == SQUASHFS_MAGIC) { + snprintf(id->type_version, sizeof(id->type_version), "%u.%u", + sqs->s_major, sqs->s_minor); + goto found; + } + if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) { + snprintf(id->type_version, sizeof(id->type_version), "%u.%u", + bswap_16(sqs->s_major), bswap_16(sqs->s_minor)); + goto found; } return -1; + +found: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "squashfs"; + return 0; } -- cgit v1.2.3-54-g00ecf From a7567d497333f7f845c634d477c01d90b954a570 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Aug 2007 20:16:47 +0200 Subject: do not ignore dynamic rule if it is the last one in the list --- udev_rules_parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 81c24b9cc1..3afc31a0fa 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -757,11 +757,10 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) if (name_base == NULL) continue; - if (strcmp(name_base, dyn_base) > 0) { - list_move_tail(&dyn_loop->node, &name_loop->node); + if (strcmp(name_base, dyn_base) > 0) break; - } } + list_move_tail(&dyn_loop->node, &name_loop->node); } /* parse list of files */ @@ -787,3 +786,4 @@ void udev_rules_cleanup(struct udev_rules *rules) rules->buf = NULL; } } + -- cgit v1.2.3-54-g00ecf From 7d6ffc72163f94ebde5cf63a360c9ac95e103014 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Aug 2007 23:05:47 +0200 Subject: rule_generator: fix wrong DRIVERS!= logic Thanks to Matthias for identifying that. --- extras/rule_generator/75-persistent-net-generator.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index cfb13f182b..f88627d384 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -22,12 +22,12 @@ SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{NETDEV}= SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($driver)" -DRIVERS!="?*", ENV{NETDEV}=="?*", IMPORT{program}="write_net_rules --driver $env{NETDRV} --id $env{NETDEV}" +DRIVERS=="?*", ENV{NETDEV}=="?*", IMPORT{program}="write_net_rules --driver $env{NETDRV} --id $env{NETDEV}" # skip "locally administered" MAC addresses ATTR{address}=="?[2367abef]:*", GOTO="persistent_net_generator_end" -DRIVERS!="?*", ENV{NETDEV}!="?*", IMPORT{program}="write_net_rules $attr{address}" +DRIVERS=="?*", ENV{NETDEV}!="?*", IMPORT{program}="write_net_rules $attr{address}" ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" LABEL="persistent_net_generator_end" -- cgit v1.2.3-54-g00ecf From ae9d3bbd3dde5f6e7d2cf434a916c5f3d3bf68b0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Aug 2007 02:42:23 +0200 Subject: rules: update Fedora --- etc/udev/redhat/06-udev-rh-early.rules | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 etc/udev/redhat/06-udev-rh-early.rules diff --git a/etc/udev/redhat/06-udev-rh-early.rules b/etc/udev/redhat/06-udev-rh-early.rules deleted file mode 100644 index 7268a5f3bf..0000000000 --- a/etc/udev/redhat/06-udev-rh-early.rules +++ /dev/null @@ -1,8 +0,0 @@ -# sysfs is populated after the event is sent -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" - -ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" -# pnp devices -ACTION=="add", SUBSYSTEM=="pnp", ATTR{id}=="?*", RUN+="/sbin/modprobe pnp:d$attr{id}" -ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN="/sbin/firmware_helper", OPTIONS="last_rule" -- cgit v1.2.3-54-g00ecf From 3df9102b678b36de97f924e9ba7cad2c91f98b27 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Aug 2007 03:31:04 +0200 Subject: Makefile: install default rules --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 1c0fda3e0e..36b9547601 100644 --- a/Makefile +++ b/Makefile @@ -230,11 +230,11 @@ install-config: @ if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ $(INSTALL_DATA) etc/udev/udev.conf $(DESTDIR)$(configdir); \ fi - @ if [ ! -r $(DESTDIR)$(configdir)/rules.d/50-udev.rules ]; then \ - echo; \ - echo "pick a udev rules file from the etc/udev directory that matches your distribution"; \ - echo; \ - fi + @ for i in $(shell ls -1 etc/udev/rules.d); do \ + if [ ! -r $(DESTDIR)$(configdir)/rules.d/$$i ]; then \ + $(INSTALL_DATA) etc/udev/rules.d/$$i $(DESTDIR)$(configdir)/rules.d; \ + fi \ + done @ extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; -- cgit v1.2.3-54-g00ecf From 7e599863919a62b0a072b5ca7a0037527d54d335 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Aug 2007 01:29:54 +0200 Subject: release 115 --- ChangeLog | 29 +++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 12 ++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 679e66f12c..87176cbcb3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,32 @@ +Summary of changes from v114 to v115 +============================================ + +Harald Hoyer (1): + rules: fix typo in 80-drivers.rules + +Kay Sievers (15): + rules: add default rules + rules: update SUSE rules + rules: add packages rules + rules: add ia64 rules + rules: move md-raid rules to packages dir + rules: run vol_id only for partitions + rules: update Fedora rules + edd_id: move persistent rules to its own file + accept relative path for TEST + rules: add iowarrior rule + volume_id: fix sqashfs detection + do not ignore dynamic rule if it is the last one in the list + rule_generator: fix wrong DRIVERS!= logic + rules: update Fedora + Makefile: install default rules + +Marco d'Itri (3): + rules_generator: remove policy from write_cd_rules + rules_generator: fix write_cd_rules when similar names exist in the root directory + rules: Debian update + + Summary of changes from v113 to v114 ============================================ diff --git a/Makefile b/Makefile index 36b9547601..39ffc7dd0e 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 114 +VERSION = 115 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e69db23378..664ff42bf3 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,15 @@ +udev 115 +======== +Bugfixes. + +The etc/udev/rules.d/ directory now contains a default set of basic +udev rules. This initial version is the result of a rules file merge +of Fedora and openSUSE. For these both distros only a few specific +rules are left in their own file, named after the distro. Rules which +are optionally installed, because they are only valid for a specific +architecture, or rules for subsystems which are not always used are +in etc/udev/packages/. + udev 114 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 1f7a36f2c0953c60a8d7acadc281285a0b84fb46 Mon Sep 17 00:00:00 2001 From: Michael Morony Date: Fri, 24 Aug 2007 08:14:21 +0200 Subject: set buffer size if strlcpy/strlcat indicate truncation --- udev_rules.c | 4 +++- udev_sysfs.c | 2 ++ udevinfo.c | 2 ++ udevmonitor.c | 4 ---- udevtrigger.c | 2 ++ 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/udev_rules.c b/udev_rules.c index 0dcbf156ea..35db958c8d 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -475,10 +475,12 @@ static int pass_env_to_socket(const char *sockname, const char *devpath, const c bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); bufpos++; - for (i = 0; environ[i] != NULL && bufpos < sizeof(buf); i++) { + for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)-1); i++) { bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); bufpos++; } + if (bufpos > sizeof(buf)) + bufpos = sizeof(buf); count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, addrlen); if (count < 0) diff --git a/udev_sysfs.c b/udev_sysfs.c index 34ae9ac14f..d5b04c310f 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -355,6 +355,8 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) dbg("open '%s'/'%s'", devpath, attr_name); sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); + if(sysfs_len >= sizeof(path_full)) + sysfs_len = sizeof(path_full) - 1; path = &path_full[sysfs_len]; strlcat(path_full, devpath, sizeof(path_full)); strlcat(path_full, "/", sizeof(path_full)); diff --git a/udevinfo.c b/udevinfo.c index d0b1c447f4..be9aa769e1 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -79,6 +79,8 @@ static void print_all_attributes(const char *devpath, const char *key) if (attr_value == NULL) continue; len = strlcpy(value, attr_value, sizeof(value)); + if(len >= sizeof(value)) + len = sizeof(value) - 1; dbg("attr '%s'='%s'(%zi)", dent->d_name, value, len); /* remove trailing newlines */ diff --git a/udevmonitor.c b/udevmonitor.c index a9cc0614ff..644a955090 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -43,7 +43,6 @@ static int init_udev_monitor_socket(void) { struct sockaddr_un saddr; socklen_t addrlen; - const int feature_on = 1; int retval; memset(&saddr, 0x00, sizeof(saddr)); @@ -67,9 +66,6 @@ static int init_udev_monitor_socket(void) return -1; } - /* enable receiving of the sender credentials */ - setsockopt(udev_monitor_sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); - return 0; } diff --git a/udevtrigger.c b/udevtrigger.c index cf8f209b1c..309c54ab68 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -435,6 +435,8 @@ static void scan_failed(void) continue; start = strlcpy(device, sysfs_path, sizeof(device)); + if(start >= sizeof(device)) + start = sizeof(device) - 1; strlcat(device, dent->d_name, sizeof(device)); path_decode(&device[start]); device_list_insert(device); -- cgit v1.2.3-54-g00ecf From d98c6dfebc2186b841c92eeb002c03938f28cdc6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Aug 2007 20:34:44 +0200 Subject: rules: fix two trivial typos Thanks to: Alexander E. Patrakov --- etc/udev/rules.d/50-udev-default.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index bff2fe58db..b3c0cfcff9 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -58,7 +58,7 @@ SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{ KERNEL=="parport[0-9]*", GROUP="lp" SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -KERNEL=="lp[0-9]*", GROUP="lp" SYMLINK+="par%n" +KERNEL=="lp[0-9]*", GROUP="lp", SYMLINK+="par%n" KERNEL=="irlpt[0-9]*", GROUP="lp" # block, tapes, block-releated @@ -71,7 +71,7 @@ KERNEL=="fd[0-9]", GROUP="floppy" KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" KERNEL=="sch[0-9]*", GROUP="disk" KERNEL=="sg[0-9]*", GROUP="disk", MODE="0640" -KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk"" +KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" -- cgit v1.2.3-54-g00ecf From b6e4b08dc14444790c1560108e93a67e57e1148b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 25 Aug 2007 14:07:02 +0200 Subject: rules: random and urandom are 0666 Thanks to: Alexander E. Patrakov . --- etc/udev/rules.d/50-udev-default.rules | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index b3c0cfcff9..f869f51550 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -17,18 +17,16 @@ KERNEL=="hvc*|hvsi*", GROUP="uucp" KERNEL=="lirc0", SYMLINK+="lirc" # mem -KERNEL=="null|zero|random", MODE="0666" +KERNEL=="null|zero|full|random|urandom", MODE="0666" KERNEL=="null", SYMLINK+="XOR" KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" KERNEL=="nvram", GROUP="kmem", MODE="0600" KERNEL=="ram0", SYMLINK+="ramdisk" KERNEL=="ram1", SYMLINK+="ram" -KERNEL=="urandom", MODE="0644" -KERNEL=="full", MODE="0666" # input KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" -KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0600" +KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0600" KERNEL=="js[0-9]*", NAME="input/%k", MODE="0644", SYMLINK+="%k" # video4linux -- cgit v1.2.3-54-g00ecf From 3f781cab37dbee76340c65602555a524ffea96f9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Aug 2007 00:48:49 +0200 Subject: rules: add REMOVE_CMD rule --- etc/udev/rules.d/95-udev-late.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/udev/rules.d/95-udev-late.rules b/etc/udev/rules.d/95-udev-late.rules index 1755d0855c..4a015b9eed 100644 --- a/etc/udev/rules.d/95-udev-late.rules +++ b/etc/udev/rules.d/95-udev-late.rules @@ -1,5 +1,8 @@ # do not edit this file, it will be overwritten on update +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + # event to be catched by udevmonitor RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From a2f2270eef499f6f60075a149011e3e3851ab5ef Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Aug 2007 05:22:35 +0200 Subject: track "move" events to rename database and failed files --- udev.h | 2 ++ udev_db.c | 10 ++++++++++ udev_device.c | 4 ++++ udevd.c | 54 ++++++++++++++++++++++++++++++++++++++++++------------ udevd.h | 1 + 5 files changed, 59 insertions(+), 12 deletions(-) diff --git a/udev.h b/udev.h index f13eb8366e..33b39aaa53 100644 --- a/udev.h +++ b/udev.h @@ -69,6 +69,7 @@ struct udevice { struct sysfs_device dev_local; struct sysfs_device *dev_parent; /* current parent device used for matching */ char action[NAME_SIZE]; + char *devpath_old; /* node */ char name[PATH_SIZE]; @@ -131,6 +132,7 @@ extern int udev_node_remove(struct udevice *udev); /* udev_db.c */ extern int udev_db_add_device(struct udevice *dev); extern int udev_db_delete_device(struct udevice *dev); +extern int udev_db_rename(const char *devpath_old, const char *devpath); extern int udev_db_get_device(struct udevice *udev, const char *devpath); extern int udev_db_get_devices_by_name(const char *name, struct list_head *name_list); extern int udev_db_get_all_entries(struct list_head *name_list); diff --git a/udev_db.c b/udev_db.c index abc1e5ad5a..29aa0316d2 100644 --- a/udev_db.c +++ b/udev_db.c @@ -117,6 +117,16 @@ out: return rc; } +int udev_db_rename(const char *devpath_old, const char *devpath) +{ + char filename[PATH_SIZE]; + char filename_old[PATH_SIZE]; + + devpath_to_db_path(devpath_old, filename_old, sizeof(filename_old)); + devpath_to_db_path(devpath, filename, sizeof(filename)); + return rename(filename_old, filename); +} + int udev_db_add_device(struct udevice *udev) { char filename[PATH_SIZE]; diff --git a/udev_device.c b/udev_device.c index 23ba313db3..2b7ffe0bf4 100644 --- a/udev_device.c +++ b/udev_device.c @@ -168,6 +168,10 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) { int retval = 0; + if (udev->devpath_old != NULL) + if (udev_db_rename(udev->devpath_old, udev->dev->devpath) == 0) + info("moved database from '%s' to '%s'", udev->devpath_old, udev->dev->devpath); + /* add device node */ if (major(udev->devt) != 0 && (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "change") == 0)) { diff --git a/udevd.c b/udevd.c index 8f56de6ffb..3c46617e47 100644 --- a/udevd.c +++ b/udevd.c @@ -130,6 +130,7 @@ static int udev_event_process(struct udevd_uevent_msg *msg) return -1; strlcpy(udev->action, msg->action, sizeof(udev->action)); sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem, msg->driver); + udev->devpath_old = msg->devpath_old; udev->devt = msg->devt; retval = udev_device_event(&rules, udev); @@ -156,14 +157,14 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st struct udevd_uevent_msg *loop_msg; int fd; - /* add location of queue files */ + /* location of queue file */ strlcpy(filename, udev_root, sizeof(filename)); strlcat(filename, "/", sizeof(filename)); start = strlcat(filename, EVENT_QUEUE_DIR"/", sizeof(filename)); strlcat(filename, msg->devpath, sizeof(filename)); path_encode(&filename[start], sizeof(filename) - start); - /* add location of failed files */ + /* location of failed file */ strlcpy(filename_failed, udev_root, sizeof(filename_failed)); strlcat(filename_failed, "/", sizeof(filename_failed)); start = strlcat(filename_failed, EVENT_FAILED_DIR"/", sizeof(filename_failed)); @@ -174,6 +175,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st case EVENT_QUEUED: unlink(filename_failed); delete_path(filename_failed); + create_path(filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd > 0) @@ -181,10 +183,25 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st return; case EVENT_FINISHED: case EVENT_FAILED: - unlink(filename_failed); - delete_path(filename_failed); + if (msg->devpath_old != NULL) { + /* "move" event - rename failed file to current name, do not delete failed */ + char filename_failed_old[PATH_SIZE]; + + strlcpy(filename_failed_old, udev_root, sizeof(filename_failed_old)); + strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); + start = strlcat(filename_failed_old, EVENT_FAILED_DIR"/", sizeof(filename_failed_old)); + strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); + path_encode(&filename_failed_old[start], sizeof(filename) - start); + + if (rename(filename_failed_old, filename_failed) == 0) + info("renamed devpath, moved failed state of '%s' to %s'", + msg->devpath_old, msg->devpath); + } else { + unlink(filename_failed); + delete_path(filename_failed); + } - /* don't remove, if events for the same path are still pending */ + /* skip if events for the same path are still pending */ list_for_each_entry(loop_msg, &running_list, node) if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0) return; @@ -193,7 +210,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0) return; - /* move failed events to the failed directory */ + /* move failed event to the failed directory */ if (state == EVENT_FAILED) { create_path(filename_failed); rename(filename, filename_failed); @@ -201,7 +218,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st unlink(filename); } - /* clean up the queue directory */ + /* clean up possibly empty queue directory */ delete_path(filename); return; @@ -212,7 +229,7 @@ static void msg_queue_delete(struct udevd_uevent_msg *msg) { list_del(&msg->node); - /* mark as failed, if add event returns non-zero */ + /* mark as failed, if "add" event returns non-zero */ if (msg->exitstatus && strcmp(msg->action, "add") == 0) export_event_state(msg, EVENT_FAILED); else @@ -280,6 +297,7 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) } export_event_state(msg, EVENT_QUEUED); + info("seq %llu forked, '%s' '%s'", msg->seqnum, msg->action, msg->subsystem); /* run one event after the other in debug mode */ if (debug_trace) { @@ -469,11 +487,16 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) if (loop_msg->seqnum >= msg->seqnum) break; + /* check our old name */ + if (msg->devpath_old != NULL) + if (strcmp(loop_msg->devpath , msg->devpath_old) == 0) + return 2; + /* check identical, parent, or child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { dbg("%llu, device event still pending %llu (%s)", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 2; + return 3; } /* check physical device event (special case of parent) */ @@ -481,7 +504,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { dbg("%llu, physical device event still pending %llu (%s)", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 3; + return 4; } } @@ -492,11 +515,16 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) return 1; } + /* check our old name */ + if (msg->devpath_old != NULL) + if (strcmp(loop_msg->devpath , msg->devpath_old) == 0) + return 2; + /* check identical, parent, or child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { dbg("%llu, device event still running %llu (%s)", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 2; + return 3; } /* check physical device event (special case of parent) */ @@ -504,7 +532,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { dbg("%llu, physical device event still running %llu (%s)", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 3; + return 4; } } return 0; @@ -588,6 +616,8 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz msg->driver = &key[7]; else if (strncmp(key, "SEQNUM=", 7) == 0) msg->seqnum = strtoull(&key[7], NULL, 10); + else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) + msg->devpath_old = &key[12]; else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) msg->physdevpath = &key[12]; else if (strncmp(key, "PHYSDEVDRIVER=", 14) == 0) diff --git a/udevd.h b/udevd.h index 4ca6d1dcf2..9be34cb0cc 100644 --- a/udevd.h +++ b/udevd.h @@ -66,6 +66,7 @@ struct udevd_uevent_msg { char *driver; dev_t devt; unsigned long long seqnum; + char *devpath_old; char *physdevpath; unsigned int timeout; char *envp[UEVENT_NUM_ENVP+1]; -- cgit v1.2.3-54-g00ecf From 2bf0a506bc13abc5632079232bee6f8784934633 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Aug 2007 13:54:32 +0200 Subject: rules: Gentoo update --- etc/udev/gentoo/05-udev-early.rules | 7 +++-- etc/udev/gentoo/50-udev.rules | 8 ++---- etc/udev/gentoo/80-drivers.rules | 44 ++++++++++++++++++++++++++++++ etc/udev/gentoo/80-hotplug.rules | 54 ------------------------------------- etc/udev/gentoo/90-network.rules | 8 ++++++ etc/udev/gentoo/95-udev-late.rules | 18 ------------- 6 files changed, 57 insertions(+), 82 deletions(-) create mode 100644 etc/udev/gentoo/80-drivers.rules delete mode 100644 etc/udev/gentoo/80-hotplug.rules create mode 100644 etc/udev/gentoo/90-network.rules delete mode 100644 etc/udev/gentoo/95-udev-late.rules diff --git a/etc/udev/gentoo/05-udev-early.rules b/etc/udev/gentoo/05-udev-early.rules index ee349dc981..fc15e2bb63 100644 --- a/etc/udev/gentoo/05-udev-early.rules +++ b/etc/udev/gentoo/05-udev-early.rules @@ -1,9 +1,8 @@ -# ignore these events until someone needs them -SUBSYSTEM=="drivers", OPTIONS="ignore_device" -SUBSYSTEM=="module", OPTIONS="ignore_device" +# do not edit this file, it will be overwritten on update # sysfs is populated after the event is sent -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" ACTION=="add", SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" + diff --git a/etc/udev/gentoo/50-udev.rules b/etc/udev/gentoo/50-udev.rules index dd329712dd..9e06029af3 100644 --- a/etc/udev/gentoo/50-udev.rules +++ b/etc/udev/gentoo/50-udev.rules @@ -1,13 +1,9 @@ +# do not edit this file, it will be overwritten on update + # /etc/udev/rules/50-udev.rules: device naming rules for udev # # Gentoo specific rules # -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# Try not to modify this file, if you wish to change things, create a new rule -# file that can be run before this one. -# # Net devices can have arbitrary names, even # ones set by the user. Not try to match normal diff --git a/etc/udev/gentoo/80-drivers.rules b/etc/udev/gentoo/80-drivers.rules new file mode 100644 index 0000000000..df6c8802bb --- /dev/null +++ b/etc/udev/gentoo/80-drivers.rules @@ -0,0 +1,44 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="drivers_end" + +# check if the device has already been claimed by a driver +ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="drivers_end" + +# this driver is broken and should not be loaded automatically +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="drivers_end" + +# Autoload modules that lack aliases but have them defined in autoload modules +ENV{MODALIAS}=="?*", RUN{ignore_error}+="modprobe.sh $env{MODALIAS}" + +# /etc/modprobe.conf. +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" +# needed aliases are defined in /etc/modprobe.d/pnp-aliases + + +SUBSYSTEM=="i2o", RUN+="modprobe.sh i2o_block" +SUBSYSTEM=="mmc", RUN+="modprobe.sh mmc_block" +SUBSYSTEM=="tifm", RUN+="modprobe.sh tifm_sd" +SUBSYSTEM=="tifm", RUN+="modprobe.sh tifm_ms" +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="modprobe.sh ide-scsi" + +# Load driver for scsi-device +SUBSYSTEM!="scsi_device", GOTO="hotplug_scsi_end" + + # Parts taken from redhat-rules + # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC + # sr: 4 TYPE_WORM, 5 TYPE_ROM + # st/osst: 1 TYPE_TAPE + + ATTRS{type}=="?*", TEST!="[module/sg]", RUN+="modprobe.sh sg" + ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" + ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" + ATTRS{type}=="8", RUN+="modprobe.sh ch" + + ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}!="ADR*", RUN+="modprobe.sh osst", GOTO="hotplug_scsi_end" + ATTRS{type}=="1", RUN+="modprobe.sh st" +LABEL="hotplug_scsi_end" + +LABEL="drivers_end" + diff --git a/etc/udev/gentoo/80-hotplug.rules b/etc/udev/gentoo/80-hotplug.rules deleted file mode 100644 index 0637dbc83a..0000000000 --- a/etc/udev/gentoo/80-hotplug.rules +++ /dev/null @@ -1,54 +0,0 @@ -# /etc/udev/rules/80-hotplug.rules: module loading rules for udev -# -# Gentoo specific rules -# -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# Try not to modify this file, if you wish to change things, create a new rule -# file that can be run before this one. -# - -# Module autoloading -ACTION!="add", GOTO="hotplug_load_end" - -# check if the device has already been claimed by a driver -ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_load_end" - -# this driver is broken and should not be loaded automatically -SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_load_end" - -# Autoload modules that lack aliases but have them defined in autoload modules -ENV{MODALIAS}=="?*", RUN{ignore_error}+="modprobe.sh $env{MODALIAS}" - -# /etc/modprobe.conf. -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" -# needed aliases are defined in /etc/modprobe.d/pnp-aliases - - -SUBSYSTEM=="i2o", RUN+="modprobe.sh i2o_block" -SUBSYSTEM=="mmc", RUN+="modprobe.sh mmc_block" -SUBSYSTEM=="tifm", RUN+="modprobe.sh tifm_sd" -SUBSYSTEM=="tifm", RUN+="modprobe.sh tifm_ms" -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="modprobe.sh ide-scsi" - -# Load driver for scsi-device -SUBSYSTEM!="scsi_device", GOTO="hotplug_scsi_end" - - # Parts taken from redhat-rules - # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC - # sr: 4 TYPE_WORM, 5 TYPE_ROM - # st/osst: 1 TYPE_TAPE - - ATTRS{type}=="?*", TEST!="[module/sg]", RUN+="modprobe.sh sg" - ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" - ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" - ATTRS{type}=="8", RUN+="modprobe.sh ch" - - ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", RUN+="modprobe.sh osst", GOTO="hotplug_scsi_end" - ATTRS{type}=="1", RUN+="modprobe.sh st" -LABEL="hotplug_scsi_end" - -LABEL="hotplug_load_end" - diff --git a/etc/udev/gentoo/90-network.rules b/etc/udev/gentoo/90-network.rules new file mode 100644 index 0000000000..50903af157 --- /dev/null +++ b/etc/udev/gentoo/90-network.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +# /etc/udev/rules/90-network.rules: triggering network init-scripts + +# Activate our network if we can +SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start" +SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop" + diff --git a/etc/udev/gentoo/95-udev-late.rules b/etc/udev/gentoo/95-udev-late.rules deleted file mode 100644 index 40ada28b14..0000000000 --- a/etc/udev/gentoo/95-udev-late.rules +++ /dev/null @@ -1,18 +0,0 @@ -# /etc/udev/rules/95-udev-late.rules: device naming rules for udev -# -# Gentoo specific rules -# -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# Try not to modify this file, if you wish to change things, create a new rule -# file that can be run before this one. -# - -# Activate our network if we can -SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start" -SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop" - -# event to be catched by udevmonitor -RUN+="socket:/org/kernel/udev/monitor" - -- cgit v1.2.3-54-g00ecf From 79ef8431c952349d9f31c899adb579c3ff83a80b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Aug 2007 04:16:54 +0200 Subject: rules: add i2o driver rule --- etc/udev/rules.d/80-drivers.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/rules.d/80-drivers.rules b/etc/udev/rules.d/80-drivers.rules index e71f1350e0..3388266001 100644 --- a/etc/udev/rules.d/80-drivers.rules +++ b/etc/udev/rules.d/80-drivers.rules @@ -7,6 +7,7 @@ SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \ RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" SUBSYSTEM=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" -- cgit v1.2.3-54-g00ecf From dbb2c414d77362a9279f4fc50458054f71ffb7e2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Aug 2007 04:24:08 +0200 Subject: man: recreate man pages --- extras/volume_id/vol_id.8 | 28 +++---- udev.7 | 182 +++++++++++++++++++++++----------------------- udevd.8 | 38 +++++----- udevinfo.8 | 28 +++---- udevmonitor.8 | 16 ++-- udevsettle.8 | 12 +-- udevstart.8 | 8 +- udevtest.8 | 8 +- udevtrigger.8 | 28 +++---- 9 files changed, 172 insertions(+), 176 deletions(-) diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index 75942536d1..daa583b855 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -1,6 +1,6 @@ .\" Title: vol_id .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.72.0 +.\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: March 2006 .\" Manual: vol_id .\" Source: volume_id @@ -11,69 +11,69 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -vol_id \- probe filesystem type and read label and uuid +vol_id - probe filesystem type and read label and uuid .SH "SYNOPSIS" .HP 7 \fBvol_id\fR [\fB\-\-export\fR] [\fB\-\-type\fR] [\fB\-\-label\fR] [\fB\-\-label\-raw\fR] [\fB\-\-uuid\fR] [\fB\-\-skip\-raid\fR] [\fB\-\-probe\-all\fR] [\fB\-\-help\fR] [\fIdevice\fR] .SH "DESCRIPTION" .PP \fBvol_id\fR -is usually called from a udev rule, to provide udev with the filesystem type, the label and the uuid of a volume. It supports most of the common filesystem formats and detects various raid setups to prevent the recognition of raid members as a volume with a filesystem. +is usually called from a udev rule, to provide udev with the filesystem type, the label and the uuid of a volume\. It supports most of the common filesystem formats and detects various raid setups to prevent the recognition of raid members as a volume with a filesystem\. .SH "OPTIONS" .PP \fB\-\-export\fR .RS 4 -Print all values in key/value format to import them into the environment. +Print all values in key/value format to import them into the environment\. .RE .PP \fB\-\-type\fR .RS 4 -Print the filesystem type. +Print the filesystem type\. .RE .PP \fB\-\-label\fR .RS 4 -Print the safe version of volume label suitable for use as filename. +Print the safe version of volume label suitable for use as filename\. .RE .PP \fB\-\-label\-raw\fR .RS 4 -Print the raw volume label. +Print the raw volume label\. .RE .PP \fB\-\-uuid\fR .RS 4 -Print the uuid of a volume. +Print the uuid of a volume\. .RE .PP \fB\-\-skip\-raid\fR .RS 4 -Skip detection of raid metadata. +Skip detection of raid metadata\. .RE .PP \fB\-\-probe\-all\fR .RS 4 -Probe for all types and print all matches. +Probe for all types and print all matches\. .RE .PP \fB\-\-help\fR .RS 4 -Print usage. +Print usage\. .RE .SH "ENVIRONMENT" .PP \fBUDEV_LOG\fR .RS 4 -Set the syslog priority. +Set the syslog priority\. .RE .SH "EXIT STATUS" .PP \fBvol_id\fR -will only return successful if the value asked for is not empty. All trailing whitespace will be removed, spaces replaced by underscore and slashes ignored. +will only return successful if the value asked for is not empty\. All trailing whitespace will be removed, spaces replaced by underscore and slashes ignored\. .SH "AUTHOR" .PP Written by Kay Sievers - + .SH "SEE ALSO" .PP \fBudev\fR(7) diff --git a/udev.7 b/udev.7 index 821a476aef..5f0ebb9974 100644 --- a/udev.7 +++ b/udev.7 @@ -1,6 +1,6 @@ .\" Title: udev .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.72.0 +.\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: August 2005 .\" Manual: udev .\" Source: udev @@ -11,213 +11,213 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -udev \- dynamic device management +udev - dynamic device management .SH "DESCRIPTION" .PP -udev provides a dynamic device directory containing only the files for actually present devices. It creates or removes device node files in the +udev provides a dynamic device directory containing only the files for actually present devices\. It creates or removes device node files in the \fI/dev\fR -directory, or it renames network interfaces. +directory, or it renames network interfaces\. .PP Usually udev runs as \fBudevd\fR(8) -and receives uevents directly from the kernel if a device is added or removed from the system. +and receives uevents directly from the kernel if a device is added or removed from the system\. .PP -If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device. Rules that match may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling. +If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device\. Rules that match may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling\. .SH "CONFIGURATION" .PP All udev configuration files are placed in -\fI/etc/udev/*\fR. Every file consists of a set of lines of text. All empty lines or lines beginning with '#' will be ignored. +\fI/etc/udev/*\fR\. Every file consists of a set of lines of text\. All empty lines or lines beginning with \'#\' will be ignored\. .SS "Configuration file" .PP udev expects its main configuration file at -\fI/etc/udev/udev.conf\fR. It consists of a set of variables allowing the user to override default udev values. The following variables can be set: +\fI/etc/udev/udev\.conf\fR\. It consists of a set of variables allowing the user to override default udev values\. The following variables can be set: .PP \fBudev_root\fR .RS 4 -Specifies where to place the device nodes in the filesystem. The default value is -\fI/dev\fR. +Specifies where to place the device nodes in the filesystem\. The default value is +\fI/dev\fR\. .RE .PP \fBudev_rules\fR .RS 4 The name of the udev rules file or directory to look for files with the suffix -\fI.rules\fR. Multiple rule files are read in lexical order. The default value is -\fI/etc/udev/rules.d\fR. +\fI\.rules\fR\. Multiple rule files are read in lexical order\. The default value is +\fI/etc/udev/rules\.d\fR\. .RE .PP \fBudev_log\fR .RS 4 -The logging priority. Valid values are the numerical syslog priorities or their textual representations: +The logging priority\. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, \fBinfo\fR and -\fBdebug\fR. +\fBdebug\fR\. .RE .SS "Rules files" .PP The udev rules are read from the files located in the -\fI/etc/udev/rules.d\fR -directory or at the location specified value in the configuration file. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. +\fI/etc/udev/rules\.d\fR +directory or at the location specified value in the configuration file\. Every line in the rules file contains at least one key value pair\. There are two kind of keys, match and assignment keys\. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned\. .PP -A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling. If no matching rule is found, the default device node name is used. +A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling\. If no matching rule is found, the default device node name is used\. .PP -A rule may consist of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: +A rule may consist of a list of one or more key value pairs separated by a comma\. Each key has a distinct operation, depending on the used operator\. Valid operators are: .PP \fB==\fR .RS 4 -Compare for equality. +Compare for equality\. .RE .PP \fB!=\fR .RS 4 -Compare for non\-equality. +Compare for non\-equality\. .RE .PP \fB=\fR .RS 4 -Assign a value to a key. Keys that represent a list, are reset and only this single value is assigned. +Assign a value to a key\. Keys that represent a list, are reset and only this single value is assigned\. .RE .PP \fB+=\fR .RS 4 -Add the value to a key that holds a list of entries. +Add the value to a key that holds a list of entries\. .RE .PP \fB:=\fR .RS 4 -Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules. +Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules\. .RE .PP -The following key names can be used to match against device properties. Some of the keys also match against properties of the parent devices in sysfs, not only the device that has generated the event. If multiple keys that match a parent device are specified in a single rule, all these keys must match at one and the same parent device. +The following key names can be used to match against device properties\. Some of the keys also match against properties of the parent devices in sysfs, not only the device that has generated the event\. If multiple keys that match a parent device are specified in a single rule, all these keys must match at one and the same parent device\. .PP \fBACTION\fR .RS 4 -Match the name of the event action. +Match the name of the event action\. .RE .PP \fBDEVPATH\fR .RS 4 -Match the devpath of the event device. +Match the devpath of the event device\. .RE .PP \fBKERNEL\fR .RS 4 -Match the name of the event device. +Match the name of the event device\. .RE .PP \fBSUBSYSTEM\fR .RS 4 -Match the subsystem of the event device. +Match the subsystem of the event device\. .RE .PP \fBDRIVER\fR .RS 4 -Match the driver name of the event device. Only set for devices which are bound to a driver at the time the event is generated. +Match the driver name of the event device\. Only set for devices which are bound to a driver at the time the event is generated\. .RE .PP \fBATTR{\fR\fB\fIfilename\fR\fR\fB}\fR .RS 4 -Match sysfs attribute values of the event device. Up to five +Match sysfs attribute values of the event device\. Up to five \fBATTR\fR -keys can be specified per rule. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. Depending on the type of operator, this key is also used to set the value of a sysfs attribute. +keys can be specified per rule\. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself\. Depending on the type of operator, this key is also used to set the value of a sysfs attribute\. .RE .PP \fBKERNELS\fR .RS 4 -Search the devpath upwards for a matching device name. +Search the devpath upwards for a matching device name\. .RE .PP \fBSUBSYSTEMS\fR .RS 4 -Search the devpath upwards for a matching device subsystem name. +Search the devpath upwards for a matching device subsystem name\. .RE .PP \fBDRIVERS\fR .RS 4 -Search the devpath upwards for a matching device driver name. +Search the devpath upwards for a matching device driver name\. .RE .PP \fBATTRS{\fR\fB\fIfilename\fR\fR\fB}\fR .RS 4 -Search the devpath upwards for a device with matching sysfs attribute values. Up to five +Search the devpath upwards for a device with matching sysfs attribute values\. Up to five \fBATTRS\fR -keys can be specified per rule, but all of them must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. +keys can be specified per rule, but all of them must match on the same device\. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself\. .RE .PP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR .RS 4 -Match against the value of an environment variable. Up to five +Match against the value of an environment variable\. Up to five \fBENV\fR -keys can be specified per rule. Depending on the type of operator, this key is also used to export a variable to the environment. +keys can be specified per rule\. Depending on the type of operator, this key is also used to export a variable to the environment\. .RE .PP \fBTEST{\fR\fB\fIoctal mode mask\fR\fR\fB}\fR .RS 4 -Test the existence of a file. An octal mode mask can be specified if needed. +Test the existence of a file\. An octal mode mask can be specified if needed\. .RE .PP \fBPROGRAM\fR .RS 4 -Execute external program. The key is true, if the program returns with exit code zero. The whole event environment is available to the executed program. The program's output printed to stdout, is available in the RESULT key. +Execute external program\. The key is true, if the program returns with exit code zero\. The whole event environment is available to the executed program\. The program\'s output printed to stdout, is available in the RESULT key\. .RE .PP \fBRESULT\fR .RS 4 -Match the returned string of the last PROGRAM call. This key can be used in the same or in any later rule after a PROGRAM call. +Match the returned string of the last PROGRAM call\. This key can be used in the same or in any later rule after a PROGRAM call\. .RE .PP -Most of the fields support a shell style pattern matching. The following pattern characters are supported: +Most of the fields support a shell style pattern matching\. The following pattern characters are supported: .PP \fB*\fR .RS 4 -Matches zero, or any number of characters. +Matches zero, or any number of characters\. .RE .PP \fB?\fR .RS 4 -Matches any single character. +Matches any single character\. .RE .PP \fB[]\fR .RS 4 -Matches any single character specified within the brackets. For example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. Ranges are also supported within this match with the '\-' character. For example, to match on the range of all digits, the pattern [0\-9] would be used. If the first character following the '[' is a '!', any characters not enclosed are matched. +Matches any single character specified within the brackets\. For example, the pattern string \'tty[SR]\' would match either \'ttyS\' or \'ttyR\'\. Ranges are also supported within this match with the \'\-\' character\. For example, to match on the range of all digits, the pattern [0\-9] would be used\. If the first character following the \'[\' is a \'!\', any characters not enclosed are matched\. .RE .PP The following keys can get values assigned: .PP \fBNAME\fR .RS 4 -The name of the node to be created, or the name the network interface should be renamed to. Only one rule can set the node name, all later rules with a NAME key will be ignored. +The name of the node to be created, or the name the network interface should be renamed to\. Only one rule can set the node name, all later rules with a NAME key will be ignored\. .RE .PP \fBSYMLINK\fR .RS 4 -The name of a symlink targeting the node. Every matching rule can add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character. +The name of a symlink targeting the node\. Every matching rule can add this value to the list of symlinks to be created along with the device node\. Multiple symlinks may be specified by separating the names by the space character\. .RE .PP \fBOWNER, GROUP, MODE\fR .RS 4 -The permissions for the device node. Every specified value overwrites the compiled\-in default value. +The permissions for the device node\. Every specified value overwrites the compiled\-in default value\. .RE .PP \fBATTR{\fR\fB\fIkey\fR\fR\fB}\fR .RS 4 -The value that should be written to a sysfs attribute of the event device. Depending on the type of operator, this key is also used to match against the value of a sysfs attribute. +The value that should be written to a sysfs attribute of the event device\. Depending on the type of operator, this key is also used to match against the value of a sysfs attribute\. .RE .PP \fBENV{\fR\fB\fIkey\fR\fR\fB}\fR .RS 4 -Export a variable to the environment. Depending on the type of operator, this key is also to match against an environment variable. +Export a variable to the environment\. Depending on the type of operator, this key is also to match against an environment variable\. .RE .PP \fBRUN\fR .RS 4 -Add a program to the list of programs to be executed for a specific device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. +Add a program to the list of programs to be executed for a specific device\. This can only be used for very short running tasks\. Running an event process for a long period of time may block all further events for this or a dependent device\. Long running tasks need to be immediately detached from the event process itself\. .RE .PP \fBLABEL\fR .RS 4 -Named label where a GOTO can jump to. +Named label where a GOTO can jump to\. .RE .PP \fBGOTO\fR @@ -229,72 +229,68 @@ Jumps to the next LABEL with a matching name .RS 4 Import a set of variables into the event environment, depending on \fItype\fR: -.RS 4 .PP \fBprogram\fR .RS 4 -Execute an external program specified as the assigned value and import its output, which must be in environment key format. +Execute an external program specified as the assigned value and import its output, which must be in environment key format\. .RE .PP \fBfile\fR .RS 4 -Import a text file specified as the assigned value, which must be in environment key format. +Import a text file specified as the assigned value, which must be in environment key format\. .RE .PP \fBparent\fR .RS 4 -Import the stored keys from the parent device by reading the database entry of the parent device. The value assigned to +Import the stored keys from the parent device by reading the database entry of the parent device\. The value assigned to \fBIMPORT{parent}\fR -is used as a filter of key names to import (with the same shell\-style pattern matching used for comparisons). -.RE +is used as a filter of key names to import (with the same shell\-style pattern matching used for comparisons)\. .RE -.IP "" 4 +.sp If no option is given, udev will choose between \fBprogram\fR and \fBfile\fR -based on the executable bit of the file permissions. +based on the executable bit of the file permissions\. .RE .PP \fBWAIT_FOR_SYSFS\fR .RS 4 -Wait for the specified sysfs file of the device to be created. Can be used to fight against kernel sysfs timing issues. +Wait for the specified sysfs file of the device to be created\. Can be used to fight against kernel sysfs timing issues\. .RE .PP \fBOPTIONS\fR .RS 4 Rule and device options: -.RS 4 .PP \fBlast_rule\fR .RS 4 -Stops further rules application. No later rules will have any effect. +Stops further rules application\. No later rules will have any effect\. .RE .PP \fBignore_device\fR .RS 4 -Ignore this event completely. +Ignore this event completely\. .RE .PP \fBignore_remove\fR .RS 4 -Ignore any later remove event for this device. This may be useful as a workaround for broken device drivers. +Ignore any later remove event for this device\. This may be useful as a workaround for broken device drivers\. .RE .PP \fBlink_priority=\fR\fB\fIvalue\fR\fR .RS 4 -Specify the priority of the created symlinks. Devices with higher priorities overwrite existing symlinks of other devices. +Specify the priority of the created symlinks\. Devices with higher priorities overwrite existing symlinks of other devices\. .RE .PP \fBall_partitions\fR .RS 4 -Create the device nodes for all available partitions of a block device. This may be useful for removable media devices where media changes are not detected. +Create the device nodes for all available partitions of a block device\. This may be useful for removable media devices where media changes are not detected\. .RE .PP \fBstring_escape=\fR\fB\fInone|replace\fR\fR .RS 4 -Usually control and other possibly unsafe characters are replaced in strings used for device naming. The mode of replacement can be specified with this option. -.RE +Usually control and other possibly unsafe characters are replaced in strings used for device naming\. The mode of replacement can be specified with this option\. .RE .RE .PP @@ -306,23 +302,23 @@ The \fBGROUP\fR and \fBRUN\fR -fields support simple printf\-like string substitutions. The +fields support simple printf\-like string substitutions\. The \fBRUN\fR -format chars gets applied after all rules have been processed, right before the program is executed. It allows the use of the complete environment set by earlier matching rules. For all other fields, substitutions are applied while the individual rule is being processed. The available substitutions are: +format chars gets applied after all rules have been processed, right before the program is executed\. It allows the use of the complete environment set by earlier matching rules\. For all other fields, substitutions are applied while the individual rule is being processed\. The available substitutions are: .PP \fB$kernel\fR, \fB%k\fR .RS 4 -The kernel name for this device. +The kernel name for this device\. .RE .PP \fB$number\fR, \fB%n\fR .RS 4 -The kernel number for this device. For example, 'sda3' has kernel number of '3' +The kernel number for this device\. For example, \'sda3\' has kernel number of \'3\' .RE .PP \fB$devpath\fR, \fB%p\fR .RS 4 -The devpath of the device. +The devpath of the device\. .RE .PP \fB$id\fR, \fB%b\fR @@ -332,7 +328,7 @@ The name of the device matched while searching the devpath upwards for \fBKERNELS\fR, \fBDRIVERS\fR and -\fBATTRS\fR. +\fBATTRS\fR\. .RE .PP \fB$driver\fR, \fB%d\fR @@ -342,75 +338,75 @@ The driver name of the device matched while searching the devpath upwards for \fBKERNELS\fR, \fBDRIVERS\fR and -\fBATTRS\fR. +\fBATTRS\fR\. .RE .PP \fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR .RS 4 -The value of a sysfs attribute found at the device, where all keys of the rule have matched. If the matching device does not have such an attribute, all devices along the chain of parents are searched for a matching attribute. If the attribute is a symlink, the last element of the symlink target is returned as the value. +The value of a sysfs attribute found at the device, where all keys of the rule have matched\. If the matching device does not have such an attribute, all devices along the chain of parents are searched for a matching attribute\. If the attribute is a symlink, the last element of the symlink target is returned as the value\. .RE .PP \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR .RS 4 -The value of an environment variable. +The value of an environment variable\. .RE .PP \fB$major\fR, \fB%M\fR .RS 4 -The kernel major number for the device. +The kernel major number for the device\. .RE .PP \fB$minor\fR, \fB%m\fR .RS 4 -The kernel minor number for the device. +The kernel minor number for the device\. .RE .PP \fB$result\fR, \fB%c\fR .RS 4 -The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: -\fB%c{N}\fR. If the number is followed by the '+' char this part plus all remaining parts of the result string are substituted: +The string returned by the external program requested with PROGRAM\. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: +\fB%c{N}\fR\. If the number is followed by the \'+\' char this part plus all remaining parts of the result string are substituted: \fB%c{N+}\fR .RE .PP \fB$parent\fR, \fB%P\fR .RS 4 -The node name of the parent device. +The node name of the parent device\. .RE .PP \fB$root\fR, \fB%r\fR .RS 4 -The udev_root value. +The udev_root value\. .RE .PP \fB$sys\fR, \fB%S\fR .RS 4 -The sysfs mount point. +The sysfs mount point\. .RE .PP \fB$tempnode\fR, \fB%N\fR .RS 4 -The name of a created temporary device node to provide access to the device from a external program before the real node is created. +The name of a created temporary device node to provide access to the device from a external program before the real node is created\. .RE .PP \fB%%\fR .RS 4 -The '%' character itself. +The \'%\' character itself\. .RE .PP \fB$$\fR .RS 4 -The '$' character itself. +The \'$\' character itself\. .RE .PP -The count of characters to be substituted may be limited by specifying the format length value. For example, '%3s{file}' will only insert the first three characters of the sysfs attribute +The count of characters to be substituted may be limited by specifying the format length value\. For example, \'%3s{file}\' will only insert the first three characters of the sysfs attribute .SH "AUTHOR" .PP Written by Greg Kroah\-Hartman - + and Kay Sievers -. With much help from Dan Stekloff - -and many others. +\. With much help from Dan Stekloff + +and many others\. .SH "SEE ALSO" .PP \fBudevd\fR(8), diff --git a/udevd.8 b/udevd.8 index 25996d1c8d..46edde4356 100644 --- a/udevd.8 +++ b/udevd.8 @@ -1,6 +1,6 @@ .\" Title: udevd .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.72.0 +.\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: August 2005 .\" Manual: udevd, udevcontrol .\" Source: udev @@ -11,7 +11,7 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -udevd \- event managing daemon +udevd - event managing daemon .SH "SYNOPSIS" .HP 6 \fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-verbose\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] @@ -19,87 +19,87 @@ udevd \- event managing daemon \fBudevcontrol \fR\fB\fIcommand\fR\fR .SH "DESCRIPTION" .PP -udevd listens to kernel uevents and passes the incoming events to udev. It ensures the right event order and takes care, that events for child devices are delayed until the parent has finished the device handling. +udevd listens to kernel uevents and passes the incoming events to udev\. It ensures the right event order and takes care, that events for child devices are delayed until the parent has finished the device handling\. .SH "OPTIONS" .PP \fB\-\-daemon\fR .RS 4 -Detach and run in the background. +Detach and run in the background\. .RE .PP \fB\-\-debug\-trace\fR .RS 4 -Run all events completely serialized. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continuous operation is needed, where no events are processed in parallel. +Run all events completely serialized\. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continuous operation is needed, where no events are processed in parallel\. .RE .PP \fB\-\-verbose\fR .RS 4 -Print log messages to stdout. +Print log messages to stdout\. .RE .PP \fB\-\-version\fR .RS 4 -Print version number. +Print version number\. .RE .PP \fB\-\-help\fR .RS 4 -Print usage. +Print usage\. .RE .PP \fBlog_priority=\fR\fB\fIvalue\fR\fR .RS 4 -Set the internal log level of udevd. Valid values are the numerical syslog priorities or their textual representations: +Set the internal log level of udevd\. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, \fBinfo\fR and -\fBdebug\fR. +\fBdebug\fR\. .RE .PP \fBstop_exec_queue\fR .RS 4 -Signal udevd to stop executing new events. Incoming events will be queued. +Signal udevd to stop executing new events\. Incoming events will be queued\. .RE .PP \fBstart_exec_queue\fR .RS 4 -Signal udevd to enable the execution of events. +Signal udevd to enable the execution of events\. .RE .PP \fBreload_rules\fR .RS 4 -Signal udevd to reload the rules from the config. +Signal udevd to reload the rules from the config\. .RE .PP \fBenv \fR\fB\fIvar\fR\fR\fB=\fR\fB\fIvalue\fR\fR .RS 4 -Set global variable. +Set global variable\. .RE .PP \fBmax_childs\fR .RS 4 -Set the maximum number of events, udevd will handle at the same time. +Set the maximum number of events, udevd will handle at the same time\. .RE .PP \fBmax_childs_running\fR .RS 4 -Set the maximum number of events, which are allowed to run at the same time. +Set the maximum number of events, which are allowed to run at the same time\. .RE .PP \fBhelp\fR .RS 4 -Print help text. +Print help text\. .RE .SH "ENVIRONMENT" .PP \fBUDEV_LOG\fR .RS 4 -Overrides the syslog priority specified in the config file. +Overrides the syslog priority specified in the config file\. .RE .SH "AUTHOR" .PP Written by Kay Sievers -. +\. .SH "SEE ALSO" .PP \fBudev\fR(7) diff --git a/udevinfo.8 b/udevinfo.8 index 337f2064e4..6115f29bbc 100644 --- a/udevinfo.8 +++ b/udevinfo.8 @@ -1,6 +1,6 @@ .\" Title: udevinfo .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.72.0 +.\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: August 2005 .\" Manual: udevinfo .\" Source: udev @@ -11,32 +11,32 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -udevinfo \- query udev device information +udevinfo - query udev device information .SH "SYNOPSIS" .HP 9 \fBudevinfo\fR [\fB\-\-query=\fR\fB\fIquery\-type\fR\fR] [\fB\-\-path=\fR\fB\fIdevpath\fR\fR] [\fB\-\-name=\fR\fB\fInode\fR\fR] [\fB\-\-root\fR] [\fB\-\-attribute\-walk\fR] [\fB\-\-export\-db\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] .SH "DESCRIPTION" .PP -udevinfo queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device. +udevinfo queries the udev database for device information stored in the udev database\. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device\. .SH "OPTIONS" .PP \fB\-\-query=\fR\fB\fItype\fR\fR .RS 4 -Query the database for specified type of device data. It needs the +Query the database for specified type of device data\. It needs the \fB\-\-path\fR or \fB\-\-name\fR -to identify the specified device. Valid queries are: +to identify the specified device\. Valid queries are: \fBname\fR, \fBsymlink\fR, \fBpath\fR, \fBenv\fR, -\fBall\fR. +\fBall\fR\. .RE .PP \fB\-\-path=\fR\fB\fIdevpath\fR\fR .RS 4 -The devpath of the device to query. +The devpath of the device to query\. .RE .PP \fB\-\-name=\fR\fB\fInode\fR\fR @@ -47,36 +47,36 @@ The name of the device node or a symlink to query \fB\-\-root\fR .RS 4 The udev root directory: -\fI/dev\fR. If used in conjunction with a +\fI/dev\fR\. If used in conjunction with a \fBname\fR or \fBsymlink\fR -query, the query returns the absolute path including the root directory. +query, the query returns the absolute path including the root directory\. .RE .PP \fB\-\-attribute\-walk\fR .RS 4 -Print all sysfs properties of the specified device that can be used in udev rules to match the specified device. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules. +Print all sysfs properties of the specified device that can be used in udev rules to match the specified device\. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules\. .RE .PP \fB\-\-export\-db\fR .RS 4 -Export the content of the udev database. +Export the content of the udev database\. .RE .PP \fB\-\-version\fR .RS 4 -Print version. +Print version\. .RE .PP \fB\-\-help\fR .RS 4 -Print help text. +Print help text\. .RE .SH "AUTHOR" .PP Written by Kay Sievers -. +\. .SH "SEE ALSO" .PP \fBudev\fR(7) diff --git a/udevmonitor.8 b/udevmonitor.8 index 0adb9988ea..5b624a795f 100644 --- a/udevmonitor.8 +++ b/udevmonitor.8 @@ -1,6 +1,6 @@ .\" Title: udevmonitor .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.72.0 +.\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: August 2005 .\" Manual: udevmonitor .\" Source: udev @@ -11,38 +11,38 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -udevmonitor \- print the kernel and udev event sequence to the console +udevmonitor - print the kernel and udev event sequence to the console .SH "SYNOPSIS" .HP 12 \fBudevmonitor\fR [\fB\-\-environment\fR] [\fB\-\-kernel\fR] [\fB\-\-udev\fR] [\fB\-\-help\fR] .SH "DESCRIPTION" .PP -udevmonitor listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console. It can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event. +udevmonitor listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console\. It can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event\. .SH "OPTIONS" .PP \fB\-\-environment\fR .RS 4 -Print the complete environment for all events. Can be used to compare the kernel supplied and the udev added environment values. +Print the complete environment for all events\. Can be used to compare the kernel supplied and the udev added environment values\. .RE .PP \fB\-\-kernel\fR .RS 4 -Print the kernel uevents. +Print the kernel uevents\. .RE .PP \fB\-\-udev\fR .RS 4 -Print the udev event after the rule processing. +Print the udev event after the rule processing\. .RE .PP \fB\-\-help\fR .RS 4 -Print usage. +Print usage\. .RE .SH "AUTHOR" .PP Written by Kay Sievers -. +\. .SH "SEE ALSO" .PP \fBudev\fR(7) diff --git a/udevsettle.8 b/udevsettle.8 index 818a7ff1aa..39054d9f40 100644 --- a/udevsettle.8 +++ b/udevsettle.8 @@ -1,6 +1,6 @@ .\" Title: udevsettle .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.72.0 +.\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: March 2006 .\" Manual: udevsettle .\" Source: udev @@ -11,29 +11,29 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -udevsettle \- wait until queued kernel/udev events are handled +udevsettle - wait until queued kernel/udev events are handled .SH "SYNOPSIS" .HP 11 \fBudevsettle\fR [\fB\-\-timeout=\fR\fB\fIseconds\fR\fR] .SH "DESCRIPTION" .PP -Waits watching the udev event queue and exits if all current events are handled. +Waits watching the udev event queue and exits if all current events are handled\. .SH "OPTIONS" .PP \fB\-\-timeout=\fR\fB\fIseconds\fR\fR .RS 4 -maximum seconds to wait for the queue to become empty. +maximum seconds to wait for the queue to become empty\. .RE .SH "ENVIRONMENT" .PP \fBUDEV_LOG\fR .RS 4 -Overrides the syslog priority specified in the config file. +Overrides the syslog priority specified in the config file\. .RE .SH "AUTHOR" .PP Written by Kay Sievers -. +\. .SH "SEE ALSO" .PP \fBudev\fR(7) diff --git a/udevstart.8 b/udevstart.8 index ac7d070c91..6b463cf1b6 100644 --- a/udevstart.8 +++ b/udevstart.8 @@ -1,6 +1,6 @@ .\" Title: udevstart .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.72.0 +.\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: August 2005 .\" Manual: udevstart .\" Source: udev @@ -11,17 +11,17 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -udevstart \- populate initial device directory +udevstart - populate initial device directory .SH "SYNOPSIS" .HP 10 \fBudevstart\fR .SH "DESCRIPTION" .PP -udevstart scans the kernel exported device information available in sysfs for devices which require a device node to operate and creates the node using the specified udev rules. udevstart is used to create the initial device directory after system bootup. +udevstart scans the kernel exported device information available in sysfs for devices which require a device node to operate and creates the node using the specified udev rules\. udevstart is used to create the initial device directory after system bootup\. .SH "AUTHOR" .PP Written by Harald Hoyer -. +\. .SH "SEE ALSO" .PP \fBudev\fR(7) diff --git a/udevtest.8 b/udevtest.8 index 9ab92497f6..a090465486 100644 --- a/udevtest.8 +++ b/udevtest.8 @@ -1,6 +1,6 @@ .\" Title: udevtest .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.72.0 +.\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: August 2005 .\" Manual: udevtest .\" Source: udev @@ -11,17 +11,17 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -udevtest \- simulate a udev run and print the action to the console +udevtest - simulate a udev run and print the action to the console .SH "SYNOPSIS" .HP 21 \fBudevtest \fR\fB\fIdevice\-path\fR\fR .SH "DESCRIPTION" .PP -udevtest simulates a udev run for the given device and prints out the name of the node udev would have created, or the name of the network interface, that would have been renamed. +udevtest simulates a udev run for the given device and prints out the name of the node udev would have created, or the name of the network interface, that would have been renamed\. .SH "AUTHOR" .PP Written by Greg Kroah\-Hartman -. +\. .SH "SEE ALSO" .PP \fBudev\fR(7) diff --git a/udevtrigger.8 b/udevtrigger.8 index 5ef9e8f812..06c7e4526e 100644 --- a/udevtrigger.8 +++ b/udevtrigger.8 @@ -1,6 +1,6 @@ .\" Title: udevtrigger .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.72.0 +.\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: March 2006 .\" Manual: udevtrigger .\" Source: udev @@ -11,66 +11,66 @@ .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -udevtrigger \- request kernel devices events for coldplug +udevtrigger - request kernel devices events for coldplug .SH "SYNOPSIS" .HP 12 \fBudevtrigger\fR [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] [\fB\-\-retry\-failed\fR] [\fB\-\-help\fR] [\fB\-\-action=\fR\fB\fIaction\fR\fR] [\fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR] [\fB\-\-attr\-nomatch=\fR\fB\fIattribute=value\fR\fR] .SH "DESCRIPTION" .PP -Trigger kernel device uevents to replay missing events at system coldplug. +Trigger kernel device uevents to replay missing events at system coldplug\. .SH "OPTIONS" .PP \fB\-\-verbose\fR .RS 4 -Print the list of devices which will be triggered. +Print the list of devices which will be triggered\. .RE .PP \fB\-\-dry\-run\fR .RS 4 -Do not actually trigger the event. +Do not actually trigger the event\. .RE .PP \fB\-\-retry\-failed\fR .RS 4 -Trigger only the events which are failed during a previous run. +Trigger only the events which are failed during a previous run\. .RE .PP \fB\-\-action=\fR\fB\fIaction\fR\fR .RS 4 -Type of event to be triggered. The default value is "add". +Type of event to be triggered\. The default value is "add"\. .RE .PP \fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR .RS 4 -Trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and supports shell style pattern matching. +Trigger events for devices which belong to a matching subsystem\. This option can be specified multiple times and supports shell style pattern matching\. .RE .PP \fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR .RS 4 -Do not trigger events for devices which belong to a matching subsystem. This option can be specified multiple times and supports shell style pattern matching. +Do not trigger events for devices which belong to a matching subsystem\. This option can be specified multiple times and supports shell style pattern matching\. .RE .PP \fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR .RS 4 -Trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. This option can be specified multiple times. +Trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. .RE .PP \fB\-\-attr\-nomatch\fR\fB\fIattribute=value\fR\fR .RS 4 -Do not trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching. If no value is specified, the existence of the sysfs attribute is checked. This option can be specified multiple times. +Do not trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. .RE .SH "ENVIRONMENT" .PP \fBUDEV_LOG\fR .RS 4 -Overrides the syslog priority specified in the config file. +Overrides the syslog priority specified in the config file\. .RE .SH "AUTHOR" .PP Written by Kay Sievers - + and Hannes Reinecke -. +\. .SH "SEE ALSO" .PP \fBudev\fR(7) -- cgit v1.2.3-54-g00ecf From 7b6fd01651ce89e4985f9afc344b7d49c4e5fcd7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Aug 2007 06:06:00 +0200 Subject: volume_id: fix linux_raid metadata version 1.0 detection Fixes: https://bugs.launchpad.net/ubuntu/+source/udev/+bug/133773 --- extras/volume_id/lib/linux_raid.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 6d1d19cb74..ff2c47c473 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -142,13 +142,15 @@ static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint6 int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) { - uint64_t sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; + uint64_t sboff; /* version 0 at the end of the device */ + sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; if (volume_id_probe_linux_raid0(id, off + sboff, size) == 0) return 0; /* version 1.0 at the end of the device */ + sboff = (size & ~(0x1000 - 1)) - 0x2000; if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) return 0; -- cgit v1.2.3-54-g00ecf From 739b614721580b95aebdfd295eebb0a6246803ad Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Wed, 29 Aug 2007 13:19:16 +0200 Subject: rules: Gentoo update --- etc/udev/gentoo/05-udev-early.rules | 8 ------ etc/udev/gentoo/30-kernel-compat.rules | 47 ++++++++++++++++++++++++++++++++++ etc/udev/gentoo/50-udev.rules | 4 --- etc/udev/gentoo/80-drivers.rules | 44 ------------------------------- 4 files changed, 47 insertions(+), 56 deletions(-) delete mode 100644 etc/udev/gentoo/05-udev-early.rules create mode 100644 etc/udev/gentoo/30-kernel-compat.rules delete mode 100644 etc/udev/gentoo/80-drivers.rules diff --git a/etc/udev/gentoo/05-udev-early.rules b/etc/udev/gentoo/05-udev-early.rules deleted file mode 100644 index fc15e2bb63..0000000000 --- a/etc/udev/gentoo/05-udev-early.rules +++ /dev/null @@ -1,8 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# sysfs is populated after the event is sent -ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" -ACTION=="add", SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" - diff --git a/etc/udev/gentoo/30-kernel-compat.rules b/etc/udev/gentoo/30-kernel-compat.rules new file mode 100644 index 0000000000..7bc55c6f75 --- /dev/null +++ b/etc/udev/gentoo/30-kernel-compat.rules @@ -0,0 +1,47 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="kernel_compat_end" + +# workarounds needed to synchronize with sysfs +DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" + +# needed for kernels <2.6.16 +SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" + +# needed for kernels <2.6.17 +SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" + + + +# needed for kernels <2.6.22 +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" + + + +# this driver is broken and should not be loaded automatically +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=398962 +# needed for kernels <2.6.21 +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", ENV{MODALIAS}="" + +# No need for more code, as MODALIAS is present +ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" + +# needed for kernels <2.6.22 +SUBSYSTEM!="scsi_device", GOTO="kernel_compat_end" + + # Parts taken from redhat-rules + # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC + # sr: 4 TYPE_WORM, 5 TYPE_ROM + # st/osst: 1 TYPE_TAPE + + ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" + ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" + ATTRS{type}=="8", RUN+="modprobe.sh ch" + + ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}!="ADR*", RUN+="modprobe.sh osst", GOTO="kernel_compat_end" + ATTRS{type}=="1", RUN+="modprobe.sh st" + +LABEL="kernel_compat_end" + + diff --git a/etc/udev/gentoo/50-udev.rules b/etc/udev/gentoo/50-udev.rules index 9e06029af3..7c2ac81b9f 100644 --- a/etc/udev/gentoo/50-udev.rules +++ b/etc/udev/gentoo/50-udev.rules @@ -237,10 +237,6 @@ KERNEL=="umad*", NAME="infiniband/%k" KERNEL=="issm*", NAME="infiniband/%k" -# usbfs-like device nodes -# the way to go up to kernel 2.6.21 (and above if setting USB_DEVICE_CLASS=y) -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" -# starting from kernel 2.6.22 use this rule SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", GROUP="usb", MODE="0664" diff --git a/etc/udev/gentoo/80-drivers.rules b/etc/udev/gentoo/80-drivers.rules deleted file mode 100644 index df6c8802bb..0000000000 --- a/etc/udev/gentoo/80-drivers.rules +++ /dev/null @@ -1,44 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="drivers_end" - -# check if the device has already been claimed by a driver -ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="drivers_end" - -# this driver is broken and should not be loaded automatically -SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="drivers_end" - -# Autoload modules that lack aliases but have them defined in autoload modules -ENV{MODALIAS}=="?*", RUN{ignore_error}+="modprobe.sh $env{MODALIAS}" - -# /etc/modprobe.conf. -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", RUN{ignore_error}+="/bin/sh -c 'while read id; do /lib/udev/modprobe.sh pnp:d$$id; done < /sys$devpath/id'" -# needed aliases are defined in /etc/modprobe.d/pnp-aliases - - -SUBSYSTEM=="i2o", RUN+="modprobe.sh i2o_block" -SUBSYSTEM=="mmc", RUN+="modprobe.sh mmc_block" -SUBSYSTEM=="tifm", RUN+="modprobe.sh tifm_sd" -SUBSYSTEM=="tifm", RUN+="modprobe.sh tifm_ms" -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="modprobe.sh ide-scsi" - -# Load driver for scsi-device -SUBSYSTEM!="scsi_device", GOTO="hotplug_scsi_end" - - # Parts taken from redhat-rules - # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC - # sr: 4 TYPE_WORM, 5 TYPE_ROM - # st/osst: 1 TYPE_TAPE - - ATTRS{type}=="?*", TEST!="[module/sg]", RUN+="modprobe.sh sg" - ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" - ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" - ATTRS{type}=="8", RUN+="modprobe.sh ch" - - ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", RUN+="modprobe.sh osst", GOTO="hotplug_scsi_end" - ATTRS{type}=="1", RUN+="modprobe.sh st" -LABEL="hotplug_scsi_end" - -LABEL="drivers_end" - -- cgit v1.2.3-54-g00ecf From 1113044be205f9d78642744ffaa01329a77bee79 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Aug 2007 14:04:55 +0200 Subject: add $name substitution --- udev.7 | 7 ++++++- udev.xml | 10 +++++++++- udev_rules.c | 6 ++++++ udevd.c | 2 +- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/udev.7 b/udev.7 index 5f0ebb9974..0ea554923d 100644 --- a/udev.7 +++ b/udev.7 @@ -331,7 +331,7 @@ and \fBATTRS\fR\. .RE .PP -\fB$driver\fR, \fB%d\fR +\fB$driver\fR .RS 4 The driver name of the device matched while searching the devpath upwards for \fBSUBSYSTEMS\fR, @@ -373,6 +373,11 @@ The string returned by the external program requested with PROGRAM\. A single pa The node name of the parent device\. .RE .PP +\fB$name\fR +.RS 4 +The name of the device node\. The value is only set if an earlier rule assigned a value, or during a remove events\. +.RE +.PP \fB$root\fR, \fB%r\fR .RS 4 The udev_root value\. diff --git a/udev.xml b/udev.xml index b43abb779b..9fb6152941 100644 --- a/udev.xml +++ b/udev.xml @@ -488,7 +488,7 @@ - , + The driver name of the device matched while searching the devpath upwards for , , and . @@ -547,6 +547,14 @@ + + + + The name of the device node. The value is only set if an earlier + rule assigned a value, or during a remove events. + + + , diff --git a/udev_rules.c b/udev_rules.c index 35db958c8d..01fb2117b2 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -606,6 +606,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) SUBST_ATTR, SUBST_PARENT, SUBST_TEMP_NODE, + SUBST_NAME, SUBST_ROOT, SUBST_SYS, SUBST_ENV, @@ -627,6 +628,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, + { .name = "name", .fmt = 'D', .type = SUBST_NAME }, { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, { .name = "env", .fmt = 'E', .type = SUBST_ENV }, @@ -845,6 +847,10 @@ found: strlcat(string, udev->tmp_node, maxsize); dbg("substitute temporary device node name '%s'", udev->tmp_node); break; + case SUBST_NAME: + strlcat(string, udev->name, maxsize); + dbg("substitute udev->name '%s'", udev->name); + break; case SUBST_ROOT: strlcat(string, udev_root, maxsize); dbg("substitute udev_root '%s'", udev_root); diff --git a/udevd.c b/udevd.c index 3c46617e47..5ff5d3f66f 100644 --- a/udevd.c +++ b/udevd.c @@ -508,7 +508,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) } } - /* check runing-queue for still running events */ + /* check run queue for still running events */ list_for_each_entry(loop_msg, &running_list, node) { if (limit && childs_count++ > limit) { dbg("%llu, maximum number (%i) of childs reached", msg->seqnum, childs_count); -- cgit v1.2.3-54-g00ecf From a75689bad504e35e346b84960b2b604532b1d6b5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Aug 2007 14:11:37 +0200 Subject: do not delete the device node with ignore_remove, but handle the event --- udev.7 | 2 +- udev.xml | 4 ++-- udev_device.c | 8 ++++---- udev_rules.c | 15 ++++++++++++--- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/udev.7 b/udev.7 index 0ea554923d..874c9abe38 100644 --- a/udev.7 +++ b/udev.7 @@ -275,7 +275,7 @@ Ignore this event completely\. .PP \fBignore_remove\fR .RS 4 -Ignore any later remove event for this device\. This may be useful as a workaround for broken device drivers\. +Do not remove the device node when the device goes away\. This may be useful as a workaround for broken device drivers\. .RE .PP \fBlink_priority=\fR\fB\fIvalue\fR\fR diff --git a/udev.xml b/udev.xml index 9fb6152941..83a9d754ca 100644 --- a/udev.xml +++ b/udev.xml @@ -416,8 +416,8 @@ - Ignore any later remove event for this device. This may be useful - as a workaround for broken device drivers. + Do not remove the device node when the device goes away. This may be + useful as a workaround for broken device drivers. diff --git a/udev_device.c b/udev_device.c index 2b7ffe0bf4..62217ff585 100644 --- a/udev_device.c +++ b/udev_device.c @@ -266,10 +266,6 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* import database entry, and delete it */ if (udev_db_get_device(udev, udev->dev->devpath) == 0) { udev_db_delete_device(udev); - if (udev->ignore_remove) { - info("ignore_remove for '%s'", udev->name); - goto exit; - } /* restore stored persistent data */ list_for_each_entry(name_loop, &udev->env_list, node) putenv(name_loop->name); @@ -285,6 +281,10 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) goto exit; } + if (udev->ignore_remove) { + info("ignore_remove for '%s'", udev->name); + goto exit; + } /* remove the node */ retval = udev_node_remove(udev); diff --git a/udev_rules.c b/udev_rules.c index 01fb2117b2..364d1b7adc 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1472,9 +1472,14 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) break; dbg("process rule"); - if (rule->name.operation != KEY_OP_UNSET || rule->symlink.operation != KEY_OP_UNSET || - rule->mode_operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || - rule->group.operation != KEY_OP_UNSET) { + if (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD || + rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL || + rule->symlink.operation == KEY_OP_ADD || + rule->mode_operation != KEY_OP_UNSET || + rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { dbg("skip rule that names a device"); continue; } @@ -1485,6 +1490,10 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) udev->ignore_device = 1; return 0; } + if (rule->ignore_remove) { + udev->ignore_remove = 1; + dbg("remove event should be ignored"); + } if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { struct name_entry *entry; -- cgit v1.2.3-54-g00ecf From a506e6298cffed4576f9cea8df15b2f8945fc731 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Aug 2007 22:19:28 +0200 Subject: print warning for invalid TEST operations --- udev_rules.c | 3 ++- udev_rules_parse.c | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/udev_rules.c b/udev_rules.c index 364d1b7adc..ef352ca2bc 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -994,7 +994,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) } } - if (rule->test.operation != KEY_OP_UNSET) { + if (rule->test.operation == KEY_OP_MATCH || + rule->test.operation == KEY_OP_NOMATCH) { char filename[PATH_SIZE]; char devpath[PATH_SIZE]; char *attr; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 3afc31a0fa..9e435819f0 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -469,6 +469,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid TEST operation"); + goto invalid; + } attr = get_key_attribute(key + sizeof("TEST")-1); if (attr != NULL) rule->test_mode_mask = strtol(attr, NULL, 8); -- cgit v1.2.3-54-g00ecf From b5bc27029a82ff37c36f6e9d06f23c3005fe3382 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Aug 2007 14:14:54 +0200 Subject: rules: do not delete /lib/udev/devices/ nodes on "remove" --- etc/udev/rules.d/50-udev-default.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index f869f51550..76f0976c95 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -101,3 +101,6 @@ KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" KERNEL=="iowarrior[0-9]*", NAME="usb/%k" +# do not delete static device nodes +ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove" + -- cgit v1.2.3-54-g00ecf From 9d1f93803f166149b3c467a465a126b2fb31e93c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Aug 2007 14:25:17 +0200 Subject: rules: remove broken nvram group assignment without any permission --- etc/udev/rules.d/50-udev-default.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index 76f0976c95..633e2e7831 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -20,7 +20,6 @@ KERNEL=="lirc0", SYMLINK+="lirc" KERNEL=="null|zero|full|random|urandom", MODE="0666" KERNEL=="null", SYMLINK+="XOR" KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" -KERNEL=="nvram", GROUP="kmem", MODE="0600" KERNEL=="ram0", SYMLINK+="ramdisk" KERNEL=="ram1", SYMLINK+="ram" -- cgit v1.2.3-54-g00ecf From 89e0a02226cbadf6a58c4d234e31c7111eed20bc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Aug 2007 15:03:21 +0200 Subject: add /dev/rtc symlink if new rtc drivers are used --- etc/udev/rules.d/50-udev-default.rules | 3 ++- udev_node.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index 633e2e7831..854809a7d3 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -88,7 +88,8 @@ KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" # miscellaneous KERNEL=="fuse", MODE="0666" -KERNEL=="rtc", MODE="0644" +KERNEL=="rtc|rtc0", MODE="0644" +KERNEL=="rtc0", SYMLINK+="rtc" KERNEL=="auer[0-9]*" NAME="usb/%k" KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" KERNEL=="mmtimer", MODE="0644" diff --git a/udev_node.c b/udev_node.c index fcd52d0e45..25eed86935 100644 --- a/udev_node.c +++ b/udev_node.c @@ -133,7 +133,7 @@ static int node_symlink(const char *node, const char *slink) stats.st_rdev == stats2.st_rdev) { info("replace device node '%s' with symlink to our node '%s'", slink, node); } else { - err("device node '%s' already exists, link '%s' will not overwrite it", node, slink); + err("device node '%s' already exists, link to '%s' will not overwrite it", slink, node); goto exit; } } -- cgit v1.2.3-54-g00ecf From 39ea7c6c67de69379b603196a0eff6f7ce2e469a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 31 Aug 2007 11:01:35 +0200 Subject: increase WAIT_FOR_SYSFS timeout to 10 seconds We see SCSI disks where it takes 6.5 seconds to populate the sysfs attributes. --- udev_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_rules.c b/udev_rules.c index ef352ca2bc..dcd091485b 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1040,7 +1040,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { int found; - found = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 3) == 0); + found = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 10) == 0); if (!found && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) goto nomatch; } -- cgit v1.2.3-54-g00ecf From 07acdb0f7413eeb261bdb52eba6abe75371cc202 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Thu, 6 Sep 2007 13:12:48 +0200 Subject: correct includes in udev_selinux.c --- udev_selinux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_selinux.c b/udev_selinux.c index 1ad6e8ad12..3fa84a0d43 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -24,8 +24,8 @@ #include #include #include -#include #include +#include #include #include "udev.h" -- cgit v1.2.3-54-g00ecf From 8aab4ce40b821d7b759b98bb97afcd3e0b7c80d8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 Sep 2007 04:01:21 +0200 Subject: rules: put bsd nodes in /dev/bsd/ directory --- etc/udev/rules.d/50-udev-default.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index 854809a7d3..bdce004717 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -77,6 +77,7 @@ SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" KERNEL=="pktcdvd", NAME="pktcdvd/control" KERNEL=="qft0", SYMLINK+="ftape" +SUBSYSTEM=="bsg" NAME="bsg/%k" # network KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" -- cgit v1.2.3-54-g00ecf From b1ac36ff5e3756cefc79967a26280056da31bf6f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 10 Sep 2007 00:59:07 +0200 Subject: path_id: fix for stacked class devices --- extras/path_id/path_id | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 57879b5a9a..a3a627e407 100755 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -456,7 +456,11 @@ handle_device () { return fi fi - cd $full_sysfs_path/device + if [ -L $full_sysfs_path/device/device ]; then + cd $full_sysfs_path/device/device + else + cd $full_sysfs_path/device + fi ;; esac full_sysfs_device_path="`pwd -P`" -- cgit v1.2.3-54-g00ecf From 16511863d928e7fd82f15ae64850ab21e74f0f16 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 11 Sep 2007 17:17:29 +0200 Subject: check line length after comment check and whitespace strip --- udev_config.c | 10 +++++----- udev_rules.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/udev_config.c b/udev_config.c index 3f226b9d7c..2f2a69eb48 100644 --- a/udev_config.c +++ b/udev_config.c @@ -111,11 +111,6 @@ static int parse_config_file(void) cur += count+1; lineno++; - if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); - continue; - } - /* eat the whitespace */ while ((count > 0) && isspace(bufline[0])) { bufline++; @@ -128,6 +123,11 @@ static int parse_config_file(void) if (bufline[0] == COMMENT_CHARACTER) continue; + if (count >= sizeof(line)) { + err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); + continue; + } + memcpy(line, bufline, count); line[count] = '\0'; diff --git a/udev_rules.c b/udev_rules.c index dcd091485b..3ec8477461 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -349,11 +349,6 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu cur += count+1; lineno++; - if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); - continue; - } - /* eat the whitespace */ while ((count > 0) && isspace(bufline[0])) { bufline++; @@ -366,6 +361,11 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu if (bufline[0] == COMMENT_CHARACTER) continue; + if (count >= sizeof(line)) { + err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); + continue; + } + memcpy(line, bufline, count); line[count] = '\0'; -- cgit v1.2.3-54-g00ecf From 554074c9ca2f1b8876176887e4656d06b870f2cd Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 11 Sep 2007 17:20:54 +0200 Subject: only install *.rules --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 39ffc7dd0e..92ca846bec 100644 --- a/Makefile +++ b/Makefile @@ -230,9 +230,9 @@ install-config: @ if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ $(INSTALL_DATA) etc/udev/udev.conf $(DESTDIR)$(configdir); \ fi - @ for i in $(shell ls -1 etc/udev/rules.d); do \ - if [ ! -r $(DESTDIR)$(configdir)/rules.d/$$i ]; then \ - $(INSTALL_DATA) etc/udev/rules.d/$$i $(DESTDIR)$(configdir)/rules.d; \ + @ for i in etc/udev/rules.d/*.rules; do \ + if [ ! -r $(DESTDIR)$(configdir)/rules.d/$$(basename $$i) ]; then \ + $(INSTALL_DATA) $$i $(DESTDIR)$(configdir)/rules.d; \ fi \ done @ extras="$(EXTRAS)"; for target in $$extras; do \ -- cgit v1.2.3-54-g00ecf From 25c208d659cf0f8bc887a1f7c62e9d2e0c546aec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 12 Sep 2007 00:21:53 +0200 Subject: ignore device node names while restoring symlinks from the stack --- udev_node.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/udev_node.c b/udev_node.c index 25eed86935..556a442a33 100644 --- a/udev_node.c +++ b/udev_node.c @@ -230,11 +230,15 @@ static int update_link(struct udevice *udev, const char *name) if (udev_db == NULL) continue; if (udev_db_get_device(udev_db, device->name) == 0) { - info("compare priority of '%s' %i > %i", - udev_db->dev->devpath, udev_db->link_priority, priority); - if (target[0] == '\0' || udev_db->link_priority > priority) { - priority = udev_db->link_priority; - strlcpy(target, udev_db->name, sizeof(target)); + if (strcmp(udev_db->name, name) == 0) { + info("'%s' is a device node of '%s', skip link update", udev_db->name, device->name); + } else { + info("compare priority of '%s' %i > %i", + udev_db->dev->devpath, udev_db->link_priority, priority); + if (target[0] == '\0' || udev_db->link_priority > priority) { + priority = udev_db->link_priority; + strlcpy(target, udev_db->name, sizeof(target)); + } } } udev_device_cleanup(udev_db); @@ -242,8 +246,8 @@ static int update_link(struct udevice *udev, const char *name) name_list_cleanup(&name_list); if (target[0] == '\0') { - err("missing target for '%s'", name); - rc = -1; + info("no current target for '%s' found", name); + rc = 1; goto out; } -- cgit v1.2.3-54-g00ecf From ce39874580829dc97f77b78114874b5086056e5c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Sep 2007 00:41:54 +0200 Subject: use SEQNUM in /dev/.udev/queue/ instead of devpath --- udevd.c | 45 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) diff --git a/udevd.c b/udevd.c index 5ff5d3f66f..eb311dfba7 100644 --- a/udevd.c +++ b/udevd.c @@ -154,22 +154,16 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st char filename[PATH_SIZE]; char filename_failed[PATH_SIZE]; size_t start; - struct udevd_uevent_msg *loop_msg; - int fd; /* location of queue file */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - start = strlcat(filename, EVENT_QUEUE_DIR"/", sizeof(filename)); - strlcat(filename, msg->devpath, sizeof(filename)); - path_encode(&filename[start], sizeof(filename) - start); + snprintf(filename, sizeof(filename), "%s/"EVENT_QUEUE_DIR"/%llu", udev_root, msg->seqnum); /* location of failed file */ strlcpy(filename_failed, udev_root, sizeof(filename_failed)); strlcat(filename_failed, "/", sizeof(filename_failed)); start = strlcat(filename_failed, EVENT_FAILED_DIR"/", sizeof(filename_failed)); strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); - path_encode(&filename_failed[start], sizeof(filename) - start); + path_encode(&filename_failed[start], sizeof(filename_failed) - start); switch (state) { case EVENT_QUEUED: @@ -177,12 +171,9 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st delete_path(filename_failed); create_path(filename); - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd > 0) - close(fd); - return; + symlink(msg->devpath, filename); + break; case EVENT_FINISHED: - case EVENT_FAILED: if (msg->devpath_old != NULL) { /* "move" event - rename failed file to current name, do not delete failed */ char filename_failed_old[PATH_SIZE]; @@ -201,28 +192,20 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st delete_path(filename_failed); } - /* skip if events for the same path are still pending */ - list_for_each_entry(loop_msg, &running_list, node) - if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0) - return; - - list_for_each_entry(loop_msg, &exec_list, node) - if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0) - return; - + unlink(filename); + delete_path(filename); + break; + case EVENT_FAILED: /* move failed event to the failed directory */ - if (state == EVENT_FAILED) { - create_path(filename_failed); - rename(filename, filename_failed); - } else { - unlink(filename); - } + create_path(filename_failed); + rename(filename, filename_failed); /* clean up possibly empty queue directory */ delete_path(filename); - - return; + break; } + + return; } static void msg_queue_delete(struct udevd_uevent_msg *msg) @@ -297,7 +280,7 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) } export_event_state(msg, EVENT_QUEUED); - info("seq %llu forked, '%s' '%s'", msg->seqnum, msg->action, msg->subsystem); + info("seq %llu queued, '%s' '%s'", msg->seqnum, msg->action, msg->subsystem); /* run one event after the other in debug mode */ if (debug_trace) { -- cgit v1.2.3-54-g00ecf From 3a58ef80dfbc08fd8722af5408a26abe12fe053c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Sep 2007 00:46:44 +0200 Subject: rules: add memstick module loading --- etc/udev/rules.d/80-drivers.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/rules.d/80-drivers.rules b/etc/udev/rules.d/80-drivers.rules index 3388266001..534056528d 100644 --- a/etc/udev/rules.d/80-drivers.rules +++ b/etc/udev/rules.d/80-drivers.rules @@ -6,6 +6,7 @@ DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODAL SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \ RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" +SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" -- cgit v1.2.3-54-g00ecf From c952356635a30f610a4d1b84e84d678fee7772c8 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 20 Sep 2007 15:24:42 +0200 Subject: remove extra space from udevinfo symlink output --- udevinfo.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index be9aa769e1..8e54705fe3 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -389,10 +389,16 @@ int main(int argc, char *argv[], char *envp[]) goto exit; if (root) list_for_each_entry(name_loop, &udev->symlink_list, node) - printf("%s/%s ", udev_root, name_loop->name); + if (name_loop->node.next != &udev->symlink_list) + printf("%s/%s ", udev_root, name_loop->name); + else + printf("%s/%s", udev_root, name_loop->name); else list_for_each_entry(name_loop, &udev->symlink_list, node) - printf("%s ", name_loop->name); + if (name_loop->node.next != &udev->symlink_list) + printf("%s ", name_loop->name); + else + printf("%s", name_loop->name); printf("\n"); break; case QUERY_PATH: -- cgit v1.2.3-54-g00ecf From 18770246edda383eef523a7e3aedd08ebbbde5cf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Sep 2007 15:25:29 +0200 Subject: udevinfo: simplify symlink printing logic --- udevinfo.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 8e54705fe3..eb9b353404 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -385,21 +385,14 @@ int main(int argc, char *argv[], char *envp[]) printf("%s\n", udev->name); break; case QUERY_SYMLINK: - if (list_empty(&udev->symlink_list)) - goto exit; - if (root) - list_for_each_entry(name_loop, &udev->symlink_list, node) - if (name_loop->node.next != &udev->symlink_list) - printf("%s/%s ", udev_root, name_loop->name); - else - printf("%s/%s", udev_root, name_loop->name); - else - list_for_each_entry(name_loop, &udev->symlink_list, node) - if (name_loop->node.next != &udev->symlink_list) - printf("%s ", name_loop->name); - else - printf("%s", name_loop->name); - printf("\n"); + list_for_each_entry(name_loop, &udev->symlink_list, node) { + char c = name_loop->node.next != &udev->symlink_list ? ' ' : '\n'; + + if (root) + printf("%s/%s%c", udev_root, name_loop->name, c); + else + printf("%s%c", name_loop->name, c); + } break; case QUERY_PATH: printf("%s\n", udev->dev->devpath); -- cgit v1.2.3-54-g00ecf From b2d1ae727e78ac3e22caa11798360d87775095ff Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Sep 2007 19:38:58 +0200 Subject: prevent wrong symlink creation if database disagress with current rules --- udev_node.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/udev_node.c b/udev_node.c index 556a442a33..c620e4aa0b 100644 --- a/udev_node.c +++ b/udev_node.c @@ -218,14 +218,16 @@ static int update_link(struct udevice *udev, const char *name) if (strcmp(udev->dev->devpath, device->name) == 0) { info("compare (our own) priority of '%s' %i >= %i", udev->dev->devpath, udev->link_priority, priority); - if (target[0] == '\0' || udev->link_priority >= priority) { + if (strcmp(udev->name, name) == 0) { + info("'%s' is our device node, database inconsistent, skip link update", udev->name); + } else if (target[0] == '\0' || udev->link_priority >= priority) { priority = udev->link_priority; strlcpy(target, udev->name, sizeof(target)); } continue; } - /* or something else, then read priority from database */ + /* another device, read priority from database */ udev_db = udev_device_init(NULL); if (udev_db == NULL) continue; -- cgit v1.2.3-54-g00ecf From 3a3d078cfd3a3adb1c9f66e0df95d704c3a92504 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Sep 2007 00:55:19 +0200 Subject: fix wrong variable used in logged string --- udev_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_rules.c b/udev_rules.c index 3ec8477461..5ae4aa2b78 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1446,7 +1446,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) } if (!name_set) { - info("no node name set, will use kernel name '%s'", udev->name); + info("no node name set, will use kernel name '%s'", udev->dev->kernel); strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); } -- cgit v1.2.3-54-g00ecf From b317b96c15bc61d59f138515e71f05bbd8f7b2ff Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Sep 2007 10:33:36 +0200 Subject: update README --- README | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/README b/README index 74aa7901cf..b37d0d5949 100644 --- a/README +++ b/README @@ -3,13 +3,10 @@ udev - userspace device management For more information see the files in the docs/ directory. Important Note: - Integrating udev in the system is a whole lot of work, has complex dependencies - and differs a lot from distro to distro. All major distros depend on udev these - days and the system may not work without a proper installed version. The upstream - udev project does not support or recommend to replace a distro's udev installation - with the upstream version. The installation of a unmodified upstream version may - render your system unusable. Until now, there is no "default" setup or a set of - "default" rules provided by the upstream udev version. + Integrating udev in the system has complex dependencies and differs from distro + to distro. All major distros depend on udev these days and the system may not + work without a properly installed version. The upstream udev project does not + recommend to replace a distro's udev installation with the upstream version. Requirements: - Version 2.6.15 of the Linux kernel for reliable operation of this release of @@ -21,7 +18,7 @@ Requirements: but it is completely silly - don't complain if anything goes wrong.) - The proc filesystem must be mounted on /proc, the sysfs filesystem must - be mounted at /sys. No other location will be supported by udev. + be mounted at /sys. No other location is supported by udev. Operation: -- cgit v1.2.3-54-g00ecf From c746922ca26fe18f6b3f3a4516e7236bfc0106b7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Sep 2007 17:42:46 +0200 Subject: rule_generator: move all policy from write_net_rules to the rules file --- .../75-persistent-net-generator.rules | 43 ++++++-- extras/rule_generator/write_net_rules | 119 +++++++++------------ 2 files changed, 84 insertions(+), 78 deletions(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index f88627d384..d09bc38028 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -1,33 +1,56 @@ # do not edit this file, it will be overwritten on update # these rules generate rules for persistent network device naming +# +# variables used to communicate: +# MATCHADDR MAC address used for the match +# MATCHID bus_id used for the match +# MATCHDRV driver name used for the match +# MATCHIFTYPE interface type match +# COMMENT comment to add to the generated rule +# INTERFACE_NAME requested name supplied by external tool +# INTERFACE_NEW new interface name returned by rule writer ACTION!="add", GOTO="persistent_net_generator_end" SUBSYSTEM!="net", GOTO="persistent_net_generator_end" -# device name whitelist -KERNEL!="eth*|ath*|wlan*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" - # ignore the interface if a name has already been set NAME=="?*", GOTO="persistent_net_generator_end" +# device name whitelist +KERNEL!="eth*|ath*|wlan*[0-9]|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" + +# add interface type match for some devices +KERNEL=="wlan*|ath*", ENV{MATCHIFTYPE}="1" + # ignore Xen virtual interfaces SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" -# build device description string to add a comment to the generated rule +# read MAC address +ENV{MATCHADDR}="$attr{address}" + +# do not use "locally administered" MAC address +ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" + +# do not use empty address +ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" + +# build comment line for generated rule: SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)" SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)" SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)" -SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{NETDEV}="$id", ENV{NETDRV}="$driver" SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" -ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device ($driver)" -DRIVERS=="?*", ENV{NETDEV}=="?*", IMPORT{program}="write_net_rules --driver $env{NETDRV} --id $env{NETDEV}" +# S/390 uses id matches only, do not use MAC address match +SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID}="$id", ENV{MATCHDRV}="$driver", ENV{MATCHADDR}="" + +# default comment +ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device" -# skip "locally administered" MAC addresses -ATTR{address}=="?[2367abef]:*", GOTO="persistent_net_generator_end" +# write rule +DRIVERS=="?*", IMPORT{program}="write_net_rules" -DRIVERS=="?*", ENV{NETDEV}!="?*", IMPORT{program}="write_net_rules $attr{address}" +# rename interface if needed ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" LABEL="persistent_net_generator_end" diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index 62acb8820c..b25ecfd806 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -1,20 +1,25 @@ #!/bin/sh -e # -# This script is run if the interface (recognized by its MAC address) lacks -# a rule for persistent naming. -# -# If there is already a persistent rule with that interface name then the -# current interface needs to be renamed. -# -# If the interface needs to be renamed, a NAME=value pair will be printed -# on stdout to allow udev to IMPORT it. Then a rule for the MAC address and -# interface name is written. -# -# (C) 2006 Marco d'Itri +# Copyright (C) 2006 Marco d'Itri +# Copyright (C) 2007 Kay Sievers # # 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 script is run to create persistent network device naming rules +# based on properties of the device. +# If the interface needs to be renamed, INTERFACE_NEW= will be printed +# on stdout to allow udev to IMPORT it. + +# variables used to communicate: +# MATCHADDR MAC address used for the match +# MATCHID bus_id used for the match +# MATCHDRV driver name used for the match +# MATCHIFTYPE interface type match +# COMMENT comment to add to the generated rule +# INTERFACE_NAME requested name supplied by external tool +# INTERFACE_NEW new interface name returned by rule writer RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' @@ -49,78 +54,57 @@ write_rule() { echo "" [ "$comment" ] && echo "# $comment" - echo "SUBSYSTEM==\"net\", $match, NAME=\"$name\"" + echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\"" } >> $RULES_FILE } if [ -z "$INTERFACE" ]; then - echo "Missing \$INTERFACE." >&2 + echo "missing \$INTERFACE" >&2 exit 1 fi -if [ "$1" ]; then - while [ "$*" ] ; do - case $1 in - --mac) - shift - MAC_ADDR=$1 - shift - ;; - --driver) - shift - DRIVER=$1 - shift - ;; - --id) - shift - ID=$1 - shift - ;; - *) - MAC_ADDR=$1 - shift - ;; - esac - done -else - MAC_ADDR=$(sysread address) -fi - -if [ -z "$DRIVER" ] && [ -z "$ID" ] ; then - if [ -z "$MAC_ADDR" ]; then - echo "No MAC address for $INTERFACE." >&2 - exit 1 - fi - if [ "$MAC_ADDR" = "00:00:00:00:00:00" ]; then - echo "NULL MAC address for $INTERFACE." >&2 - exit 1 - fi -fi - # Prevent concurrent processes from modifying the file at the same time. lock_rules_file # Check if the rules file is writeable. choose_rules_file -# If a rule using the current name already exists then find a new name and -# report it to udev which will rename the interface. -basename=${INTERFACE%%[0-9]*} -if interface_name_taken; then - INTERFACE="$basename$(find_next_available "$basename[0-9]*")" - if [ ! -t 1 ]; then - echo "INTERFACE_NEW=$INTERFACE" - fi +# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces +if [ "$MATCHADDR" ]; then + match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\"" fi -# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces -if [ "$MAC_ADDR" ] ; then - match="DRIVERS==\"?*\", ATTR{address}==\"$MAC_ADDR\"" -else - match="DRIVERS==\"$DRIVER\", KERNELS==\"$ID\"" +if [ "$MATCHDRV" ]; then + match="$match, DRIVERS==\"$MATCHDRV\"" +fi + +if [ "$MATCHID" ]; then + match="$match, KERNELS==\"$MATCHID\"" +fi + +if [ "$MATCHIFTYPE" ]; then + match="$match, ATTR{type}==\"$MATCHIFTYPE\"" fi -if [ $basename = "ath" -o $basename = "wlan" ]; then - match="$match, ATTR{type}==\"1\"" # do not match the wifi* interfaces + +if [ -z "$match" ]; then + echo "missing valid match" >&2 + exit 1 +fi + +if [ "$INTERFACE_NAME" ]; then + # external tools may request a custom name + COMMENT="$COMMENT (custom name provided by external tool)" + if [ "$INTERFACE_NAME" != "$INTERFACE" ]; then + INTERFACE=$INTERFACE_NAME; + echo "INTERFACE_NEW=$INTERFACE" + fi +else + # if a rule using the current name already exists, find a new name + basename=${INTERFACE%%[0-9]*} + if interface_name_taken; then + INTERFACE="$basename$(find_next_available "$basename[0-9]*")" + echo "INTERFACE_NEW=$INTERFACE" + fi fi write_rule "$match" "$INTERFACE" "$COMMENT" @@ -128,4 +112,3 @@ write_rule "$match" "$INTERFACE" "$COMMENT" unlock_rules_file exit 0 - -- cgit v1.2.3-54-g00ecf From fdec9861b9ee473c98229f3f4d9178e2c85b5dc5 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Mon, 24 Sep 2007 02:59:22 +0200 Subject: rules: Gentoo update --- etc/udev/gentoo/30-kernel-compat.rules | 10 +- etc/udev/gentoo/40-audio.rules | 23 +++ etc/udev/gentoo/40-video.rules | 24 ++++ etc/udev/gentoo/50-udev.rules | 255 --------------------------------- etc/udev/gentoo/65-permissions.rules | 20 +++ 5 files changed, 72 insertions(+), 260 deletions(-) create mode 100644 etc/udev/gentoo/40-audio.rules create mode 100644 etc/udev/gentoo/40-video.rules delete mode 100644 etc/udev/gentoo/50-udev.rules create mode 100644 etc/udev/gentoo/65-permissions.rules diff --git a/etc/udev/gentoo/30-kernel-compat.rules b/etc/udev/gentoo/30-kernel-compat.rules index 7bc55c6f75..1f767df8d8 100644 --- a/etc/udev/gentoo/30-kernel-compat.rules +++ b/etc/udev/gentoo/30-kernel-compat.rules @@ -34,13 +34,13 @@ SUBSYSTEM!="scsi_device", GOTO="kernel_compat_end" # sr: 4 TYPE_WORM, 5 TYPE_ROM # st/osst: 1 TYPE_TAPE - ATTRS{type}=="0|7|14", RUN+="modprobe.sh sd_mod" - ATTRS{type}=="4|5", RUN+="modprobe.sh sr_mod" - ATTRS{type}=="8", RUN+="modprobe.sh ch" + ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" + ATTRS{type}=="4|5", RUN+="/sbin/modprobe sr_mod" + ATTRS{type}=="8", RUN+="/sbin/modprobe ch" ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", RUN+="modprobe.sh osst", GOTO="kernel_compat_end" - ATTRS{type}=="1", RUN+="modprobe.sh st" + ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst", GOTO="kernel_compat_end" + ATTRS{type}=="1", RUN+="/sbin/modprobe st" LABEL="kernel_compat_end" diff --git a/etc/udev/gentoo/40-audio.rules b/etc/udev/gentoo/40-audio.rules new file mode 100644 index 0000000000..8dfcb28624 --- /dev/null +++ b/etc/udev/gentoo/40-audio.rules @@ -0,0 +1,23 @@ +# do not edit this file, it will be overwritten on update + +# alsa devices +SUBSYSTEM=="sound", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# Do we need these? upstream has this in 40-alsa.rules, but we never had these +#KERNEL=="mixer0", SYMLINK+="mixer" +#KERNEL=="dsp0", SYMLINK+="dsp" +#KERNEL=="audio0", SYMLINK+="audio" + +# sound devices +KERNEL=="adsp|adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="audio|audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="dsp|dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="mixer|mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" +KERNEL=="sequencer|sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" + diff --git a/etc/udev/gentoo/40-video.rules b/etc/udev/gentoo/40-video.rules new file mode 100644 index 0000000000..aafcb2d629 --- /dev/null +++ b/etc/udev/gentoo/40-video.rules @@ -0,0 +1,24 @@ +# do not edit this file, it will be overwritten on update + +# video4linux +KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="%k", GROUP="video" +KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="%k", GROUP="video" +KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="%k", GROUP="video" +KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" + +SUBSYSTEM=="dvb", GROUP="video" + +# device node will be /dev/dri/card? +KERNEL=="card*", GROUP="video" +KERNEL=="nvidia*", GROUP="video" +KERNEL=="3dfx*", GROUP="video" + +# Framebuffer +# do we need /dev/fb/0 really? +# it conflicts with symlink /dev/fb -> /dev/fb0 upstream rules create +#KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" +KERNEL=="fb[0-9]*", GROUP="video" + +# IEEE1394 (firewire) devices +KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" + diff --git a/etc/udev/gentoo/50-udev.rules b/etc/udev/gentoo/50-udev.rules deleted file mode 100644 index 7c2ac81b9f..0000000000 --- a/etc/udev/gentoo/50-udev.rules +++ /dev/null @@ -1,255 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# /etc/udev/rules/50-udev.rules: device naming rules for udev -# -# Gentoo specific rules -# - -# Net devices can have arbitrary names, even -# ones set by the user. Not try to match normal -# rules on net devices (Bug #166652) -SUBSYSTEM=="net", GOTO="gentoo_device_rules_end" - -# console -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcs*", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="vcsa*", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="tty[0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="tty[0-9][0-9]", NAME="%k", GROUP="tty", OPTIONS="last_rule" -KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" - -# tty devices -KERNEL=="ttyS[0-9]*", NAME="%k", SYMLINK="tts/%n", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB[0-9]*", NAME="%k", SYMLINK="tts/USB%n", GROUP="uucp", MODE="0660" -KERNEL=="ippp0", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="isdn*" NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="dcbri*", NAME="%k", GROUP="uucp", MODE="0660" -KERNEL=="ircomm*", NAME="%k", GROUP="uucp", MODE="0660" - -# all block devices -SUBSYSTEM=="block", GROUP="disk" - -# cdrom symlinks and other good cdrom naming -KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", ACTION=="add", IMPORT{program}="cdrom_id --export $tempnode" -ENV{ID_CDROM}=="?*", GROUP="cdrom" -SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" - -# assign cdrom-permission also to associated generic device (for cd-burning ...) -KERNEL=="sg[0-9]*", ACTION=="add", ATTRS{type}=="4|5", GROUP="cdrom" - -# disk devices -KERNEL=="sd*", NAME="%k", GROUP="disk" -KERNEL=="dasd*", NAME="%k", GROUP="disk" -KERNEL=="ataraid*", NAME="%k", GROUP="disk" - -# compaq smart array -KERNEL=="cciss*", NAME="%k" -KERNEL=="ida*", NAME="%k" - -# mylex -KERNEL=="rd*", NAME="%k" - -# dri devices -KERNEL=="card*", NAME="dri/card%n", GROUP="video" -KERNEL=="nvidia*", NAME="%k", GROUP="video" -KERNEL=="3dfx*", NAME="%k", GROUP="video" - -# alsa devices -SUBSYSTEM=="sound", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hw[CD0-9]*", NAME="snd/%k" -KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# capi devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20", GROUP="uucp", MODE="0660" -KERNEL=="capi*", NAME="capi/%n", GROUP="uucp", MODE="0660" - -# cpu devices -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode" - -# fb devices -KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" - -# floppy devices -KERNEL=="fd[0-9]*", NAME="floppy/%k", SYMLINK+="%k", GROUP="floppy" -KERNEL=="fd[0-9]*", ACTION=="add", ATTRS{cmos}=="*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0660 -G floppy $root/floppy/%k" -KERNEL=="fd[0-9]*", ACTION=="remove", RUN+="/bin/sh -c 'rm -f $root/floppy/%k?*'" - -# i2c devices -KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" - -# input devices -KERNEL=="mice", NAME="input/%k", MODE="0644" -KERNEL=="mouse*", NAME="input/%k", MODE="0644" -KERNEL=="event*", NAME="input/%k", MODE="0600" -KERNEL=="js*", NAME="input/%k", MODE="0664" -KERNEL=="ts*", NAME="input/%k", MODE="0600" - -# loop devices -KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k", GROUP="disk" - -# md block devices -KERNEL=="md[0-9]*", NAME="md/%n", SYMLINK+="%k", GROUP="disk" - -# aoe char devices, -SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" -SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" - -# misc devices -KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="rtc", NAME="misc/%k", SYMLINK+="%k", MODE="0664" -KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" - -# netlink devices -KERNEL=="route", NAME="netlink/%k" -KERNEL=="skip", NAME="netlink/%k" -KERNEL=="usersock", NAME="netlink/%k" -KERNEL=="fwmonitor", NAME="netlink/%k" -KERNEL=="tcpdiag", NAME="netlink/%k" -KERNEL=="nflog", NAME="netlink/%k" -KERNEL=="xfrm", NAME="netlink/%k" -KERNEL=="arpd", NAME="netlink/%k" -KERNEL=="route6", NAME="netlink/%k" -KERNEL=="ip6_fw", NAME="netlink/%k" -KERNEL=="dnrtmsg", NAME="netlink/%k" -KERNEL=="tap*", NAME="netlink/%k" - -# network devices -KERNEL=="tun", NAME="net/%k", MODE="0660", OPTIONS+="ignore_remove" -KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" - -# ramdisk devices -KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" - -# IEEE1394 (firewire) devices (must be before raw devices below) -KERNEL=="raw1394", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" - -# raw devices -SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL=="ram*", NAME="%k", GROUP="disk" - -# sound devices -KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" - -# memory devices -KERNEL=="random", NAME="%k", MODE="0666" -KERNEL=="urandom", NAME="%k", MODE="0444" -KERNEL=="mem", NAME="%k", MODE="0640" -KERNEL=="kmem", NAME="%k", MODE="0640" -KERNEL=="port", NAME="%k", MODE="0640" -KERNEL=="full", NAME="%k", MODE="0666" -KERNEL=="null", NAME="%k", MODE="0666" -KERNEL=="zero", NAME="%k", MODE="0666" - -# usb devices -KERNEL=="hiddev*", NAME="usb/%k" -KERNEL=="auer*", NAME="usb/%k" -KERNEL=="legousbtower*", NAME="usb/%k", GROUP="usb" -KERNEL=="dabusb*", NAME="usb/%k" -KERNEL=="lp[0-9]*", SUBSYSTEM=="usb", NAME="usb/%k", GROUP="lp" - -# v4l devices -KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" -KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" -KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" -KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" - -# dvb devices -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" - -# Asterisk Zaptel devices -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -# pilot/palm devices -KERNEL=="pilot", NAME="%k", GROUP="uucp" - -# jaz devices -KERNEL=="jaz*", NAME="%k", GROUP="disk" - -# zip devices -KERNEL=="pocketzip*", NAME="%k", GROUP="disk" -KERNEL=="zip*", NAME="%k", GROUP="disk" - -# ls120 devices -KERNEL=="ls120", NAME="%k", GROUP="disk" - -# lp devices -KERNEL=="lp*", NAME="%k", GROUP="lp" -KERNEL=="irlpt", NAME="%k", GROUP="lp" -KERNEL=="usblp", NAME="%k", GROUP="lp" -KERNEL=="lp*", NAME="%k", GROUP="lp" -KERNEL=="parport*", NAME="%k", GROUP="lp" - -# tape devices -KERNEL=="ht*", NAME="%k", GROUP="tape" -KERNEL=="nht*", NAME="%k", GROUP="tape" -KERNEL=="pt*", NAME="%k", GROUP="tape" -KERNEL=="npt*", NAME="%k", GROUP="tape" -KERNEL=="st*", NAME="%k", GROUP="tape" -KERNEL=="nst*", NAME="%k", GROUP="tape" -KERNEL=="osst*", NAME="%k", GROUP="tape" -KERNEL=="nosst*", NAME="%k", GROUP="tape" - -# diskonkey devices -KERNEL=="diskonkey*", NAME="%k", GROUP="disk" - -# rem_ide devices -KERNEL=="microdrive*", NAME="%k", GROUP="disk" - -# kbd devices -KERNEL=="kbd", NAME="%k", MODE="0664" - -# Sony Vaio Jogdial sonypi device -KERNEL=="sonypi", NAME="%k", MODE="0666" - -# packet devices -KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrw", MODE="0660" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrw", MODE="0660" - -# infiniband devices -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" - - -SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", \ - NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", GROUP="usb", MODE="0664" - -# Timeouts for scsi devices -# Setting timeout for tape-devices (type 1) to 900 seconds -# and 60 seconds for device types 0, 7 and 14 -# if you need timeouts for other devices add a similar rule -# with correct type-value, or open a bug on bugs.gentoo.org. -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" - - -# Load firmware -SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" - -LABEL="gentoo_device_rules_end" diff --git a/etc/udev/gentoo/65-permissions.rules b/etc/udev/gentoo/65-permissions.rules new file mode 100644 index 0000000000..1cc31af9ee --- /dev/null +++ b/etc/udev/gentoo/65-permissions.rules @@ -0,0 +1,20 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb", MODE="664" + +# cdrom devices +ENV{ID_CDROM}=="?*", GROUP="cdrom", MODE="660" +KERNEL=="pktcdvd|pktcdvd[0-9]*", GROUP="cdrom", MODE="660" +# assign cdrom-permission also to associated generic device (for cd-burning ...) +SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[45]", GROUP="cdrom", MODE="660" + + +# tape devices +KERNEL=="st[0-9]*|nst[0-9]*|ht[0-9]*|nht[0-9]*|pt[0-9]*|npt[0-9]*", \ + GROUP="tape", MODE="660" +SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[18]", GROUP="tape", MODE="660" + +# dialout devices +KERNEL=="ippp*|isdn*|dcbri*", GROUP="uucp" +KERNEL=="pilot", GROUP="uucp" + -- cgit v1.2.3-54-g00ecf From 5d374a84fff74853b872ec3a661fb841a2c51d8d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Sep 2007 02:24:29 +0200 Subject: rules: call usb_id only for SUBSYSTEMS=="usb" --- etc/udev/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 63e715d415..017f0cd23d 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -35,7 +35,7 @@ KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODE KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", IMPORT{program}="usb_id --export %p" +KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss" KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -- cgit v1.2.3-54-g00ecf From 31150fbbc7ee47260e5446ede5e24c8b87f4412a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Sep 2007 12:20:17 +0200 Subject: rules: split out and fix persistent tape rules Thanks to: Robin H. Johnson for the suggestion. --- etc/udev/rules.d/60-persistent-storage-tape.rules | 21 +++++++++++++++++++++ etc/udev/rules.d/60-persistent-storage.rules | 18 +++++------------- 2 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 etc/udev/rules.d/60-persistent-storage-tape.rules diff --git a/etc/udev/rules.d/60-persistent-storage-tape.rules b/etc/udev/rules.d/60-persistent-storage-tape.rules new file mode 100644 index 0000000000..d2dbc71c60 --- /dev/null +++ b/etc/udev/rules.d/60-persistent-storage-tape.rules @@ -0,0 +1,21 @@ +# do not edit this file, it will be overwritten on update + +# persistent storage links: /dev/tape/{by-id,by-path} + +ACTION!="add", GOTO="persistent_storage_tape_end" + +KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" + +# type 8 devices are "Medium Changers" +KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +KERNEL=="st[0-9]*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="st[0-9]*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="st[0-9]*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" +KERNEL=="st[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# by-path (shortest physical path) +KERNEL=="st[0-9]*", IMPORT{program}="path_id %p" +KERNEL=="st[0-9]*", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" + +LABEL="persistent_storage_tape_end" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 017f0cd23d..68fe59fd95 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -1,15 +1,9 @@ # do not edit this file, it will be overwritten on update -# persistent storage links: /dev/{disk,tape}/{by-id,by-uuid,by-label,by-path,by-name} +# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} # scheme based on "Linux persistent device names", 2004, Hannes Reinecke ACTION!="add", GOTO="persistent_storage_end" - -KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" - -# type 8 devices are "Medium Changers" -KERNEL=="sg*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices @@ -34,13 +28,12 @@ KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*|st*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="sd*[!0-9]|sr*|st*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss" KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -KERNEL=="st*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" # libata compat (links like hd*) KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" @@ -53,9 +46,8 @@ KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+= ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -KERNEL=="st*", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_storage_end" +KERNEL=="sr*", GOTO="persistent_storage_end" KERNEL=="hd*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" # by-label/by-uuid (filesystem properties) -- cgit v1.2.3-54-g00ecf From d438c80e57b1cc98540399f817eda7fc2568cc72 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Sep 2007 13:45:49 +0200 Subject: fix debug output string --- udev_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index d5b04c310f..e8909f94f1 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -415,7 +415,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* read attribute value */ fd = open(path_full, O_RDONLY); if (fd < 0) { - dbg("attribute '%s' does not exist", path_full); + dbg("attribute '%s' can not be opened", path_full); goto out; } size = read(fd, value, sizeof(value)); -- cgit v1.2.3-54-g00ecf From 8fe5f78b7e53bcae858824f40e03d60ba19eae73 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Sep 2007 17:18:49 +0200 Subject: rule_generator: always match netif type in generated rule --- extras/rule_generator/75-persistent-net-generator.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index d09bc38028..726bf27871 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -20,15 +20,15 @@ NAME=="?*", GOTO="persistent_net_generator_end" # device name whitelist KERNEL!="eth*|ath*|wlan*[0-9]|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" -# add interface type match for some devices -KERNEL=="wlan*|ath*", ENV{MATCHIFTYPE}="1" - # ignore Xen virtual interfaces SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" # read MAC address ENV{MATCHADDR}="$attr{address}" +# match interface type +ENV{MATCHIFTYPE}="$attr{type}" + # do not use "locally administered" MAC address ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" -- cgit v1.2.3-54-g00ecf From 38e62fef89097ec3604320104197c48ebda0d591 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 25 Sep 2007 17:52:42 +0200 Subject: rules: Gentoo update --- etc/udev/gentoo/40-audio.rules | 23 ----------------------- etc/udev/gentoo/65-permissions.rules | 2 ++ 2 files changed, 2 insertions(+), 23 deletions(-) delete mode 100644 etc/udev/gentoo/40-audio.rules diff --git a/etc/udev/gentoo/40-audio.rules b/etc/udev/gentoo/40-audio.rules deleted file mode 100644 index 8dfcb28624..0000000000 --- a/etc/udev/gentoo/40-audio.rules +++ /dev/null @@ -1,23 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# alsa devices -SUBSYSTEM=="sound", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# Do we need these? upstream has this in 40-alsa.rules, but we never had these -#KERNEL=="mixer0", SYMLINK+="mixer" -#KERNEL=="dsp0", SYMLINK+="dsp" -#KERNEL=="audio0", SYMLINK+="audio" - -# sound devices -KERNEL=="adsp|adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="audio|audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="dsp|dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="mixer|mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" -KERNEL=="sequencer|sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio" - diff --git a/etc/udev/gentoo/65-permissions.rules b/etc/udev/gentoo/65-permissions.rules index 1cc31af9ee..523c79d7f8 100644 --- a/etc/udev/gentoo/65-permissions.rules +++ b/etc/udev/gentoo/65-permissions.rules @@ -18,3 +18,5 @@ SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[18]", GROUP="tape", MODE= KERNEL=="ippp*|isdn*|dcbri*", GROUP="uucp" KERNEL=="pilot", GROUP="uucp" +# sound devices (sound=alsa, snd=oss) +SUBSYSTEM=="sound|snd", GROUP="audio" -- cgit v1.2.3-54-g00ecf From 091b42826c3bbcac309cc97207e5dc438e33ef00 Mon Sep 17 00:00:00 2001 From: Bryan Kadzban Date: Sun, 14 Oct 2007 14:48:14 +0200 Subject: rules: fix typos --- etc/udev/rules.d/50-udev-default.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index bdce004717..00b6a891d9 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -39,7 +39,7 @@ KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666" KERNEL=="fb0", SYMLINK+="fb" # DVB video -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" # Firewire KERNEL=="dv1394*", SYMLINK+="dv1394/%n" @@ -77,7 +77,7 @@ SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" KERNEL=="pktcdvd", NAME="pktcdvd/control" KERNEL=="qft0", SYMLINK+="ftape" -SUBSYSTEM=="bsg" NAME="bsg/%k" +SUBSYSTEM=="bsg", NAME="bsg/%k" # network KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" @@ -91,7 +91,7 @@ KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" KERNEL=="fuse", MODE="0666" KERNEL=="rtc|rtc0", MODE="0644" KERNEL=="rtc0", SYMLINK+="rtc" -KERNEL=="auer[0-9]*" NAME="usb/%k" +KERNEL=="auer[0-9]*", NAME="usb/%k" KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" -- cgit v1.2.3-54-g00ecf From 8e37efe4223c4e495aa2e907e60684c54fdec356 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 14 Oct 2007 15:17:32 +0200 Subject: release 116 --- ChangeLog | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 4 ++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 87176cbcb3..c8bc3cbe56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,57 @@ +Summary of changes from v115 to v116 +============================================ + +Bryan Kadzban (1): + rules: fix typos + +Harald Hoyer (3): + check line length after comment check and whitespace strip + only install *.rules + remove extra space from udevinfo symlink output + +Kay Sievers (29): + rules: fix two trivial typos + rules: random and urandom are 0666 + rules: add REMOVE_CMD rule + track "move" events to rename database and failed files + rules: Gentoo update + rules: add i2o driver rule + man: recreate man pages + volume_id: fix linux_raid metadata version 1.0 detection + add $name substitution + do not delete the device node with ignore_remove, but handle the event + print warning for invalid TEST operations + rules: do not delete /lib/udev/devices/ nodes on "remove" + rules: remove broken nvram group assignment without any permission + add /dev/rtc symlink if new rtc drivers are used + increase WAIT_FOR_SYSFS timeout to 10 seconds + rules: put bsd nodes in /dev/bsd/ directory + path_id: fix for stacked class devices + ignore device node names while restoring symlinks from the stack + use SEQNUM in /dev/.udev/queue/ instead of devpath + rules: add memstick module loading + udevinfo: simplify symlink printing logic + prevent wrong symlink creation if database disagress with current rules + fix wrong variable used in logged string + update README + rule_generator: move all policy from write_net_rules to the rules file + rules: call usb_id only for SUBSYSTEMS=="usb" + rules: split out and fix persistent tape rules + fix debug output string + rule_generator: always match netif type in generated rule + +Matthias Schwarzott (3): + rules: Gentoo update + rules: Gentoo update + rules: Gentoo update + +Michael Morony (1): + set buffer size if strlcpy/strlcat indicate truncation + +maximilian attems (1): + correct includes in udev_selinux.c + + Summary of changes from v114 to v115 ============================================ diff --git a/Makefile b/Makefile index 92ca846bec..0c143d6d01 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 115 +VERSION = 116 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 664ff42bf3..fb1f1fd10b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 116 +======== +Bugfixes. + udev 115 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 963033472f8d2aab0bf77147b916de8f3b0b5450 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Oct 2007 20:38:20 +0200 Subject: usb_id: fail if vendor/product can not be retrieved Thanks to Daniel Drake for identifying the bug. --- extras/usb_id/usb_id.c | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index d36a27b3cc..5fb030db56 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -1,7 +1,5 @@ /* - * usb_id.c - * - * Identify an USB (block) device + * usb_id - identify an USB device * * Copyright (c) 2005 SUSE Linux Products GmbH, Germany * @@ -224,8 +222,6 @@ static int usb_id(const char *devpath) struct sysfs_device *dev; struct sysfs_device *dev_interface; struct sysfs_device *dev_usb; - const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; - const char *usb_model = NULL, *usb_vendor = NULL, *usb_rev, *usb_serial; const char *if_class, *if_subclass; int if_class_num; int protocol = 0; @@ -271,6 +267,7 @@ static int usb_id(const char *devpath) /* mass storage */ if (protocol == 6 && !use_usb_info) { struct sysfs_device *dev_scsi; + const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; int host, bus, target, lun; /* get scsi device */ @@ -321,40 +318,50 @@ static int usb_id(const char *devpath) } fallback: - /* Fallback to USB vendor & device */ + /* fallback to USB vendor & device */ if (vendor_str[0] == '\0') { + const char *usb_vendor = NULL; + if (!use_num_info) - if (!(usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "manufacturer"))) - dbg("No USB vendor string found, using idVendor"); + usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "manufacturer"); + + if (!usb_vendor) + usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "idVendor"); if (!usb_vendor) { - if (!(usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "idVendor"))) { - dbg("No USB vendor information available\n"); - sprintf(vendor_str,"0000"); - } + info("No USB vendor information available"); + return 1; } - set_str(vendor_str,usb_vendor, sizeof(vendor_str) - 1); + set_str(vendor_str, usb_vendor, sizeof(vendor_str)-1); } - + if (model_str[0] == '\0') { + const char *usb_model = NULL; + if (!use_num_info) - if (!(usb_model = sysfs_attr_get_value(dev_usb->devpath, "product"))) - dbg("No USB model string found, using idProduct"); - + usb_model = sysfs_attr_get_value(dev_usb->devpath, "product"); + + if (!usb_model) + usb_model = sysfs_attr_get_value(dev_usb->devpath, "idProduct"); + if (!usb_model) { - if (!(usb_model = sysfs_attr_get_value(dev_usb->devpath, "idProduct"))) - dbg("No USB model information available\n"); sprintf(model_str,"0000"); + dbg("No USB model information available"); + return 1; } - set_str(model_str, usb_model, sizeof(model_str) - 1); + set_str(model_str, usb_model, sizeof(model_str)-1); } if (revision_str[0] == '\0') { + const char *usb_rev; + usb_rev = sysfs_attr_get_value(dev_usb->devpath, "bcdDevice"); if (usb_rev) set_str(revision_str, usb_rev, sizeof(revision_str)-1); } if (serial_str[0] == '\0') { + const char *usb_serial; + usb_serial = sysfs_attr_get_value(dev_usb->devpath, "serial"); if (usb_serial) set_str(serial_str, usb_serial, sizeof(serial_str)-1); -- cgit v1.2.3-54-g00ecf From 760200f03f50eafee05f106fbbd819e94445c3a9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Oct 2007 23:53:48 +0200 Subject: rules: SUSE update Thanks to Bryan Kadzban and Matthias Schwarzott for checking the rules. --- etc/udev/suse/40-suse.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/suse/40-suse.rules b/etc/udev/suse/40-suse.rules index 863da886db..d07a72eced 100644 --- a/etc/udev/suse/40-suse.rules +++ b/etc/udev/suse/40-suse.rules @@ -8,7 +8,7 @@ KERNEL=="vttuner*", GROUP="video" KERNEL=="vtx*|vbi*", GROUP="video" KERNEL=="winradio*", GROUP="video" SUBSYSTEM=="dvb", GROUP="video" -SUBSYSTEM=="graphics" GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" SUBSYSTEM=="video4linux", GROUP="video" KERNEL=="agpgart", GROUP="video" -- cgit v1.2.3-54-g00ecf From 80f7d89ac4bd1d6c3d03746910054536efe4d64c Mon Sep 17 00:00:00 2001 From: VMiklos Date: Mon, 15 Oct 2007 23:56:12 +0200 Subject: rules: Frugalware update --- etc/udev/frugalware/50-udev-default.rules | 172 +++++++++++++++--------------- 1 file changed, 86 insertions(+), 86 deletions(-) diff --git a/etc/udev/frugalware/50-udev-default.rules b/etc/udev/frugalware/50-udev-default.rules index 2f47773e5a..89ffd7b442 100644 --- a/etc/udev/frugalware/50-udev-default.rules +++ b/etc/udev/frugalware/50-udev-default.rules @@ -27,10 +27,10 @@ KERNEL=="tun", NAME="net/%k" # permissions KERNEL=="pl2303", NAME="%k", OWNER="500", GROUP="500", MODE="0666" KERNEL=="visor", NAME="%k", OWNER="root", GROUP="uucp", MODE="0666" -KERNEL=="camera*" NAME="%k", OWNER="root", GROUP="camera", MODE="0666" +KERNEL=="camera*", NAME="%k", OWNER="root", GROUP="camera", MODE="0666" # console devices -KERNEL=="console" NAME="%k", OWNER="root", GROUP="tty", MODE="0600" +KERNEL=="console", NAME="%k", OWNER="root", GROUP="tty", MODE="0600" KERNEL=="tty", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" KERNEL=="tty[0-9]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" KERNEL=="vcs*", NAME="%k", OWNER="root", GROUP="tty", MODE="0620" @@ -40,33 +40,33 @@ KERNEL=="ttyUSB0", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" KERNEL=="ttyUSB1", NAME="%k", OWNER="root" GROUP="uucp", MODE="0666" # pty devices -KERNEL=="ptmx" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="pty[p-za-e][0-9a-f]*" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="tty[p-za-e][0-9a-f]*" NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="cu[abiu]*" NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL=="ptmx", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="pty[p-za-e][0-9a-f]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="tty[p-za-e][0-9a-f]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="cu[abiu]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" # sound devices -KERNEL=="audio*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="beep" NAME="%k", OWNER="root", GROUP="audio", MODE="0644" -KERNEL=="dsp*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="midi*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="mixer*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="music" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="sequencer*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="audio*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="beep", NAME="%k", OWNER="root", GROUP="audio", MODE="0644" +KERNEL=="dsp*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="midi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="mixer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="music", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="sequencer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" KERNEL=="controlC[0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" KERNEL=="hw[CD0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" KERNEL=="midiC[D0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" KERNEL=="timer", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" KERNEL=="seq", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="sndstat" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="speaker" NAME="%k", OWNER="root", GROUP="audio", MODE="0644" -KERNEL=="sound/*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="admmidi*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="adsp*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="aload*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="amidi*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="amixer*" NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="sndstat", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="speaker", NAME="%k", OWNER="root", GROUP="audio", MODE="0644" +KERNEL=="sound/*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="admmidi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="adsp*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="aload*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="amidi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="amixer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" # input devices (mouse, joystick, etc) KERNEL=="mice", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" @@ -74,46 +74,46 @@ KERNEL=="mouse*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" KERNEL=="event*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" KERNEL=="js*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" KERNEL=="ts*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="input/js*" NAME="%k", OWNER="root", GROUP="games",0 MODE="0666" -KERNEL=="djs[0-3]" NAME="%k", OWNER="root", GROUP="games", MODE="0660" -KERNEL=="psaux" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="crash" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="logibm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="jbm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="hwtrap" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="inportbm" NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="sexec" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="jsflash" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="input/js*", NAME="%k", OWNER="root", GROUP="games",0 MODE="0666" +KERNEL=="djs[0-3]", NAME="%k", OWNER="root", GROUP="games", MODE="0660" +KERNEL=="psaux", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="crash", NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="logibm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="jbm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="hwtrap", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="inportbm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="sexec", NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="jsflash", NAME="%k", OWNER="root", GROUP="root", MODE="0660" # power manager device -KERNEL=="apm_bios" NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="apm_bios", NAME="%k", OWNER="root", GROUP="root", MODE="0644" # printer device -KERNEL=="lp[0-9]" NAME="%k", OWNER="root", GROUP="lp", MODE="0660" -KERNEL=="parport*" NAME="%k", OWNER="root", GROUP="lp", MODE="0660" +KERNEL=="lp[0-9]", NAME="%k", OWNER="root", GROUP="lp", MODE="0660" +KERNEL=="parport*", NAME="%k", OWNER="root", GROUP="lp", MODE="0660" # video devices -KERNEL=="card*" NAME="dri/card%n", OWNER="root", GROUP="video", MODE="0666" -KERNEL=="fb[0-9]" NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="agpgart" NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="nvidia*" NAME="%k", OWNER="root", GROUP="video", MODE="0666" -KERNEL=="video*" NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="vbi*" NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="card*", NAME="dri/card%n", OWNER="root", GROUP="video", MODE="0666" +KERNEL=="fb[0-9]", NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="agpgart", NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="nvidia*", NAME="%k", OWNER="root", GROUP="video", MODE="0666" +KERNEL=="video*", NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="vbi*", NAME="%k", OWNER="root", GROUP="video", MODE="0660" KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; A=$${K%%%%.*}; D=$${K#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video", MODE="0660" # DISK devices -KERNEL=="ed[ab]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="gscd0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="initrd" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="lmscd" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="mcd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="md*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="mtd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="userdma" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="ed[ab]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="gscd0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="initrd", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="lmscd", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="mcd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="md*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="mtd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="userdma", NAME="%k", OWNER="root", GROUP="root", MODE="0660" # floppy devices -KERNEL=="fd[0-3]*" NAME="%k", OWNER="root", GROUP="floppy", MODE="0660" -KERNEL=="fd0" SYMLINK="floppy" +KERNEL=="fd[0-3]*", NAME="%k", OWNER="root", GROUP="floppy", MODE="0660" +KERNEL=="fd0", SYMLINK="floppy" # permissions for removable devices like cardreaders or sticks KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="0", NAME="%k", GROUP="storage" @@ -125,60 +125,60 @@ KERNEL=="sd*", ATTRS{scsi_level}=="5", NAME="%k", GROUP="storage" KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="7", NAME="%k", GROUP="storage" # IDE devices (hd, cdrom) -KERNEL=="hd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="ht0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="hd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="ht0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" # RAID IDE -KERNEL=="ataraid[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="ataraid/*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="ataraid[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="ataraid/*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" # SCSI devices -KERNEL=="scsi/*/cd" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="scsi/*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="sd[a-h]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="s[rt][0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="scd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="scsi/*/cd", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="scsi/*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="sd[a-h]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="s[rt][0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="scd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" # generic scsi devices -KERNEL=="sg*" NAME="%k", OWNER="root", GROUP="root", MODE="0600" +KERNEL=="sg*", NAME="%k", OWNER="root", GROUP="root", MODE="0600" # old CD-ROM -KERNEL=="sbpcd*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="sbpcd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" # loop devices -KERNEL=="loop[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="loop[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" # network block devices -KERNEL=="nb[0-7]" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="nht0" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="npt[0-3]" NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="n[qrs]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="nb[0-7]", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="nht0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="npt[0-3]", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="n[qrs]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" # memory access devices -KERNEL=="kmem" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL=="mem" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL=="null" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL=="nvram" NAME="%k", OWNER="root", GROUP="root", MODE="0640" -KERNEL=="port" NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL=="ram[0-9]*" NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="random" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="rtc" NAME="%k", OWNER="root", GROUP="root", MODE="0444" -KERNEL=="urandom" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="full" NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL=="zero" NAME="%k", OWNER="root", GROUP="root", MODE="0666" -KERNEL=="raw[0-9]*" NAME="raw/%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="modreq" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="msr" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="profile*" NAME="%k", OWNER="root", GROUP="root", MODE="0640" +KERNEL=="kmem", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL=="mem", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL=="null", NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL=="nvram", NAME="%k", OWNER="root", GROUP="root", MODE="0640" +KERNEL=="port", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL=="ram[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="random", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="rtc", NAME="%k", OWNER="root", GROUP="root", MODE="0444" +KERNEL=="urandom", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="full", NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL=="zero", NAME="%k", OWNER="root", GROUP="root", MODE="0666" +KERNEL=="raw[0-9]*", NAME="raw/%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="modreq", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="msr", NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="profile*", NAME="%k", OWNER="root", GROUP="root", MODE="0640" # ISDN devices -KERNEL=="isdn*" NAME="%k", OWNER="root", GROUP="tty", MODE="0660" +KERNEL=="isdn*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" # net devices -KERNEL=="ippp*" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="ipstate*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="spx" NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="fwmonitor*" NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="ippp*", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="ipstate*", NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="spx", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="fwmonitor*", NAME="%k", OWNER="root", GROUP="root", MODE="0660" # hotplug rules - module autoloading for different buses ACTION=="add", SUBSYSTEM=="pci", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" -- cgit v1.2.3-54-g00ecf From dab3fe36cfad807bb9cb8389b1c95825a4b04e6b Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 16 Oct 2007 00:50:48 +0200 Subject: firmware: remove hardcoded path to logger --- extras/firmware/firmware.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/firmware/firmware.sh b/extras/firmware/firmware.sh index 89b985ef3b..49845bad0f 100755 --- a/extras/firmware/firmware.sh +++ b/extras/firmware/firmware.sh @@ -4,8 +4,8 @@ FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware" err() { echo "$@" >&2 - if [ -x /bin/logger ]; then - /bin/logger -t "${0##*/}[$$]" "$@" + if type logger >/dev/null; then + logger -t "${0##*/}[$$]" "$@" fi } -- cgit v1.2.3-54-g00ecf From 6e9edde6c962ab183e8d86086bddda7aa6e3cb9b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Oct 2007 00:54:14 +0200 Subject: firmware: do not print error if logger is missing --- extras/firmware/firmware.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/extras/firmware/firmware.sh b/extras/firmware/firmware.sh index 49845bad0f..b89b4282c7 100755 --- a/extras/firmware/firmware.sh +++ b/extras/firmware/firmware.sh @@ -3,23 +3,21 @@ FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware" err() { - echo "$@" >&2 - if type logger >/dev/null; then - logger -t "${0##*/}[$$]" "$@" - fi + echo "$@" >&2 + logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true } if [ ! -e /sys$DEVPATH/loading ]; then - err "udev firmware loader misses sysfs directory" - exit 1 + err "udev firmware loader misses sysfs directory" + exit 1 fi for DIR in $FIRMWARE_DIRS; do - [ -e "$DIR/$FIRMWARE" ] || continue - echo 1 > /sys$DEVPATH/loading - cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data - echo 0 > /sys$DEVPATH/loading - exit 0 + [ -e "$DIR/$FIRMWARE" ] || continue + echo 1 > /sys$DEVPATH/loading + cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data + echo 0 > /sys$DEVPATH/loading + exit 0 done echo -1 > /sys$DEVPATH/loading -- cgit v1.2.3-54-g00ecf From 424520043aa0ea509399ca8c86fea2c79ddc91ee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Oct 2007 17:59:27 +0200 Subject: volume_id: vfat - allow all possible sector sizes https://bugs.launchpad.net/bugs/147807 --- extras/volume_id/lib/fat.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 54e6bab7d2..3ddf0258eb 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -310,7 +310,7 @@ magic: if (!vs->reserved) return -1; - /* fat count*/ + /* fat count */ if (!vs->fats) return -1; @@ -318,15 +318,14 @@ magic: if (vs->media < 0xf8 && vs->media != 0xf0) return -1; - /* cluster size check*/ + /* cluster size check */ if (vs->sectors_per_cluster == 0 || (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) return -1; /* sector size check */ sector_size = le16_to_cpu(vs->sector_size); - if (sector_size != 0x200 && sector_size != 0x400 && - sector_size != 0x800 && sector_size != 0x1000) + if (sector_size == 0 || ((sector_size & (sector_size-1)) != 0)) return -1; dbg("sector_size 0x%x", sector_size); -- cgit v1.2.3-54-g00ecf From 74534dbde84f7f2ba7dce60ebb9f651eab095bbe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Oct 2007 18:13:49 +0200 Subject: volume_id: LUKS - export version --- extras/volume_id/lib/luks.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/volume_id/lib/luks.c b/extras/volume_id/lib/luks.c index 231374e507..20b50d0efd 100644 --- a/extras/volume_id/lib/luks.c +++ b/extras/volume_id/lib/luks.c @@ -75,6 +75,7 @@ int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_usage(id, VOLUME_ID_CRYPTO); volume_id_set_uuid(id, header->uuid, 36, UUID_HEX_STRING); + snprintf(id->type_version, sizeof(header->version), "%u", le16_to_cpu(header->version)); id->type = "crypto_LUKS"; return 0; } -- cgit v1.2.3-54-g00ecf From 02ee0e3312d1061d39c623ecef15bb653f2148cd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 23 Oct 2007 02:38:23 +0200 Subject: volume_id: ntfs - rely on valid master file table --- extras/volume_id/lib/ntfs.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index 9262454321..f63804d711 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -117,6 +117,9 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_uuid(id, ns->volume_serial, 0, UUID_64BIT_LE); sector_size = le16_to_cpu(ns->bytes_per_sector); + if (sector_size < 0x200) + return -1; + cluster_size = ns->sectors_per_cluster * sector_size; mft_cluster = le64_to_cpu(ns->mft_cluster_location); mft_off = mft_cluster * cluster_size; @@ -137,13 +140,12 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), mft_record_size); if (buf == NULL) - goto found; + return -1; mftr = (struct master_file_table_record*) buf; - dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); if (memcmp(mftr->magic, "FILE", 4) != 0) - goto found; + return -1; attr_off = le16_to_cpu(mftr->attrs_offset); dbg("file $Volume's attributes are at offset %i", attr_off); @@ -186,7 +188,6 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) } } -found: volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "ntfs"; -- cgit v1.2.3-54-g00ecf From f1bc0fdb0f411614f380a93d639c641701440d8f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 24 Oct 2007 16:51:03 +0200 Subject: volume_id: bump version --- extras/volume_id/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index ce07d8dd20..b553111c61 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 80 +SHLIB_REV = 81 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) -- cgit v1.2.3-54-g00ecf From e9b647708440d4bff4c250292b72b0c59087e3df Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 24 Oct 2007 16:51:33 +0200 Subject: udevinfo: exclude "uevent" file from --attribute-walk --- udevinfo.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udevinfo.c b/udevinfo.c index eb9b353404..a2bc013691 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -67,6 +67,9 @@ static void print_all_attributes(const char *devpath, const char *key) if (dent->d_name[0] == '.') continue; + if (strcmp(dent->d_name, "uevent") == 0) + continue; + strlcpy(filename, path, sizeof(filename)); strlcat(filename, "/", sizeof(filename)); strlcat(filename, dent->d_name, sizeof(filename)); -- cgit v1.2.3-54-g00ecf From c8e826147a0e39cf09079ea4e546f732f58b4eba Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 8 Nov 2007 00:13:40 +0100 Subject: extras: ignore built and generated files --- extras/ata_id/.gitignore | 1 + extras/cdrom_id/.gitignore | 1 + extras/collect/.gitignore | 1 + extras/edd_id/.gitignore | 1 + extras/floppy/.gitignore | 1 + extras/scsi_id/.gitignore | 2 ++ extras/usb_id/.gitignore | 1 + extras/volume_id/.gitignore | 1 + extras/volume_id/lib/.gitignore | 2 ++ 9 files changed, 11 insertions(+) create mode 100644 extras/ata_id/.gitignore create mode 100644 extras/cdrom_id/.gitignore create mode 100644 extras/collect/.gitignore create mode 100644 extras/edd_id/.gitignore create mode 100644 extras/floppy/.gitignore create mode 100644 extras/scsi_id/.gitignore create mode 100644 extras/usb_id/.gitignore create mode 100644 extras/volume_id/.gitignore create mode 100644 extras/volume_id/lib/.gitignore diff --git a/extras/ata_id/.gitignore b/extras/ata_id/.gitignore new file mode 100644 index 0000000000..77837266e6 --- /dev/null +++ b/extras/ata_id/.gitignore @@ -0,0 +1 @@ +ata_id diff --git a/extras/cdrom_id/.gitignore b/extras/cdrom_id/.gitignore new file mode 100644 index 0000000000..7d817ea74e --- /dev/null +++ b/extras/cdrom_id/.gitignore @@ -0,0 +1 @@ +cdrom_id diff --git a/extras/collect/.gitignore b/extras/collect/.gitignore new file mode 100644 index 0000000000..c30ad6527c --- /dev/null +++ b/extras/collect/.gitignore @@ -0,0 +1 @@ +collect diff --git a/extras/edd_id/.gitignore b/extras/edd_id/.gitignore new file mode 100644 index 0000000000..14fb67c634 --- /dev/null +++ b/extras/edd_id/.gitignore @@ -0,0 +1 @@ +edd_id diff --git a/extras/floppy/.gitignore b/extras/floppy/.gitignore new file mode 100644 index 0000000000..939f625a4a --- /dev/null +++ b/extras/floppy/.gitignore @@ -0,0 +1 @@ +create_floppy_devices diff --git a/extras/scsi_id/.gitignore b/extras/scsi_id/.gitignore new file mode 100644 index 0000000000..8372f68193 --- /dev/null +++ b/extras/scsi_id/.gitignore @@ -0,0 +1,2 @@ +scsi_id +scsi_id_version.h diff --git a/extras/usb_id/.gitignore b/extras/usb_id/.gitignore new file mode 100644 index 0000000000..309b59fc3a --- /dev/null +++ b/extras/usb_id/.gitignore @@ -0,0 +1 @@ +usb_id diff --git a/extras/volume_id/.gitignore b/extras/volume_id/.gitignore new file mode 100644 index 0000000000..31cd6885b3 --- /dev/null +++ b/extras/volume_id/.gitignore @@ -0,0 +1 @@ +vol_id diff --git a/extras/volume_id/lib/.gitignore b/extras/volume_id/lib/.gitignore new file mode 100644 index 0000000000..33b7fea2be --- /dev/null +++ b/extras/volume_id/lib/.gitignore @@ -0,0 +1,2 @@ +libvolume_id.pc +libvolume_id.so* -- cgit v1.2.3-54-g00ecf From 01ac7d96fa65e83c71d5bba40633e813e9b4015b Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Thu, 8 Nov 2007 00:14:39 +0100 Subject: volume_id: create relative symlink when $(libdir) = $(usrlibdir) --- extras/volume_id/lib/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index b553111c61..b206854f55 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -105,7 +105,11 @@ install: all $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) mkdir -p $(DESTDIR)$(usrlibdir)/ ln -sf $(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) +ifeq ($(libdir),$(usrlibdir)) + ln -sf $(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so +else ln -sf $(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so +endif $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc .PHONY: install -- cgit v1.2.3-54-g00ecf From 225cb03bd851adc6d269b13bdf2b1bfded2b96b9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Nov 2007 17:51:59 +0100 Subject: udevadm: merge all udev tools into a single binary --- .gitignore | 8 +- Makefile | 56 ++++----- RELEASE-NOTES | 9 ++ udev.7 | 3 +- udev.h | 8 ++ udev.xml | 5 +- udevadm.8 | 255 ++++++++++++++++++++++++++++++++++++++++ udevadm.c | 165 ++++++++++++++++++++++++++ udevadm.xml | 354 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ udevcontrol.c | 18 +-- udevd.8 | 3 +- udevd.c | 9 +- udevd.xml | 5 +- udevinfo.8 | 82 ------------- udevinfo.c | 19 +-- udevinfo.xml | 122 ------------------- udevmonitor.8 | 48 -------- udevmonitor.c | 4 +- udevmonitor.xml | 85 -------------- udevsettle.8 | 39 ------- udevsettle.c | 19 +-- udevsettle.xml | 70 ----------- udevstart.8 | 27 ----- udevstart.xml | 50 -------- udevtest.8 | 27 ----- udevtest.c | 20 +--- udevtest.xml | 50 -------- udevtrigger.8 | 76 ------------ udevtrigger.c | 18 +-- udevtrigger.xml | 129 --------------------- 30 files changed, 844 insertions(+), 939 deletions(-) create mode 100644 udevadm.8 create mode 100644 udevadm.c create mode 100644 udevadm.xml delete mode 100644 udevinfo.8 delete mode 100644 udevinfo.xml delete mode 100644 udevmonitor.8 delete mode 100644 udevmonitor.xml delete mode 100644 udevsettle.8 delete mode 100644 udevsettle.xml delete mode 100644 udevstart.8 delete mode 100644 udevstart.xml delete mode 100644 udevtest.8 delete mode 100644 udevtest.xml delete mode 100644 udevtrigger.8 delete mode 100644 udevtrigger.xml diff --git a/.gitignore b/.gitignore index db03272a77..d21eb7bf03 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,8 @@ *.o *.a udevd -udevcontrol -udevtrigger -udevsettle -udevsend -udevinfo -udevmonitor +udevadm udevstart -udevtest udev_version.h test-udev diff --git a/Makefile b/Makefile index 0c143d6d01..3b254f1226 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 116 +VERSION = 118 # set this to make use of syslog USE_LOG = true @@ -44,14 +44,9 @@ V = PROGRAMS = \ udevd \ - udevtrigger \ - udevsettle \ - udevcontrol \ - udevmonitor \ - udevinfo \ - udevtest \ - test-udev \ - udevstart + udevadm \ + udevstart \ + test-udev HEADERS = \ udev.h \ @@ -73,18 +68,19 @@ UDEV_OBJS = \ udev_utils.o \ udev_utils_string.o \ udev_utils_file.o \ + udevmonitor.o \ + udevinfo.o \ + udevcontrol.o \ + udevtrigger.o \ + udevsettle.o \ + udevtest.o \ udev_sysdeps.o LIBUDEV = libudev.a MAN_PAGES = \ udev.7 \ - udevmonitor.8 \ udevd.8 \ - udevtrigger.8 \ - udevsettle.8 \ - udevtest.8 \ - udevinfo.8 \ - udevstart.8 + udevadm.8 GEN_HEADERS = \ udev_version.h @@ -242,13 +238,14 @@ install-config: install-man: $(INSTALL_DATA) -D udev.7 $(DESTDIR)$(mandir)/man7/udev.7 - $(INSTALL_DATA) -D udevinfo.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 - $(INSTALL_DATA) -D udevtest.8 $(DESTDIR)$(mandir)/man8/udevtest.8 $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 - $(INSTALL_DATA) -D udevtrigger.8 $(DESTDIR)$(mandir)/man8/udevtrigger.8 - $(INSTALL_DATA) -D udevsettle.8 $(DESTDIR)$(mandir)/man8/udevsettle.8 - $(INSTALL_DATA) -D udevmonitor.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - - ln -f -s udevd.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 + $(INSTALL_DATA) -D udevadm.8 $(DESTDIR)$(mandir)/man8/udevadm.8 + ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 + ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevtest.8 + ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevtrigger.8 + ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevsettle.8 + ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 + ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; @@ -256,6 +253,7 @@ install-man: uninstall-man: - rm -f $(DESTDIR)$(mandir)/man7/udev.7 + - rm -f $(DESTDIR)$(mandir)/man8/udevadm.8 - rm -f $(DESTDIR)$(mandir)/man8/udevinfo.8 - rm -f $(DESTDIR)$(mandir)/man8/udevtest.8 - rm -f $(DESTDIR)$(mandir)/man8/udevd.8 @@ -271,12 +269,15 @@ uninstall-man: install-bin: $(INSTALL) -d $(DESTDIR)$(udevdir) $(INSTALL_PROGRAM) -D udevd $(DESTDIR)$(sbindir)/udevd - $(INSTALL_PROGRAM) -D udevtrigger $(DESTDIR)$(sbindir)/udevtrigger - $(INSTALL_PROGRAM) -D udevsettle $(DESTDIR)$(sbindir)/udevsettle - $(INSTALL_PROGRAM) -D udevcontrol $(DESTDIR)$(sbindir)/udevcontrol - $(INSTALL_PROGRAM) -D udevmonitor $(DESTDIR)$(usrsbindir)/udevmonitor - $(INSTALL_PROGRAM) -D udevinfo $(DESTDIR)$(usrbindir)/udevinfo - $(INSTALL_PROGRAM) -D udevtest $(DESTDIR)$(usrbindir)/udevtest + $(INSTALL_PROGRAM) -D udevadm $(DESTDIR)$(sbindir)/udevadm + ln -f -s udevadm $(DESTDIR)$(sbindir)/udevtrigger + ln -f -s udevadm $(DESTDIR)$(sbindir)/udevsettle + ln -f -s udevadm $(DESTDIR)$(sbindir)/udevcontrol + mkdir -p -m 0755 $(DESTDIR)$(usrsbindir) + ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrsbindir)/udevmonitor + mkdir -p -m 0755 $(DESTDIR)$(usrbindir) + ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrbindir)/udevinfo + ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrbindir)/udevtest @extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; @@ -289,6 +290,7 @@ endif uninstall-bin: - rm -f $(DESTDIR)$(sbindir)/udevd + - rm -f $(DESTDIR)$(sbindir)/udevadm - rm -f $(DESTDIR)$(sbindir)/udevtrigger - rm -f $(DESTDIR)$(sbindir)/udevsettle - rm -f $(DESTDIR)$(sbindir)/udevcontrol diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fb1f1fd10b..6fadd2baf0 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,12 @@ +udev 117 +======== +Bugfixes. + +All udev tools are merged into a single binary called udevadm now. +The old names of the binary are commands for udevadm now. Symlinks +provide the functionality of the standalone tools. There is only a +single udevadm.8 man page for all tools left. + udev 116 ======== Bugfixes. diff --git a/udev.7 b/udev.7 index 874c9abe38..e237ba7d46 100644 --- a/udev.7 +++ b/udev.7 @@ -415,5 +415,4 @@ and many others\. .SH "SEE ALSO" .PP \fBudevd\fR(8), -\fBudevinfo\fR(8), -\fBudevmonitor\fR(8) +\fBudevadm\fR(8) diff --git a/udev.h b/udev.h index 33b39aaa53..e6e953b25d 100644 --- a/udev.h +++ b/udev.h @@ -169,4 +169,12 @@ extern void file_unmap(void *buf, size_t bufsize); extern int unlink_secure(const char *filename); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); +/* udev commands */ +extern int udevmonitor(int argc, char *argv[], char *envp[]); +extern int udevinfo(int argc, char *argv[], char *envp[]); +extern int udevcontrol(int argc, char *argv[], char *envp[]); +extern int udevtrigger(int argc, char *argv[], char *envp[]); +extern int udevsettle(int argc, char *argv[], char *envp[]); +extern int udevtest(int argc, char *argv[], char *envp[]); + #endif diff --git a/udev.xml b/udev.xml index 83a9d754ca..71832a2fe5 100644 --- a/udev.xml +++ b/udev.xml @@ -609,10 +609,7 @@ udevd8 , - udevinfo8 - , - - udevmonitor8 + udevadm8 diff --git a/udevadm.8 b/udevadm.8 new file mode 100644 index 0000000000..23502215ec --- /dev/null +++ b/udevadm.8 @@ -0,0 +1,255 @@ +.\" Title: udevadm +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.73.1 +.\" Date: November 2007 +.\" Manual: udevadm +.\" Source: udev +.\" +.TH "UDEVADM" "8" "November 2007" "udev" "udevadm" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +udevadm - udev management tool +.SH "SYNOPSIS" +.HP 21 +\fBudevadm info \fR\fB[options]\fR +.HP 24 +\fBudevadm trigger \fR\fB[options]\fR +.HP 23 +\fBudevadm settle \fR\fB[options]\fR +.HP 36 +\fBudevadm control \fR\fB[options]\fR\fB \fR\fB\fIinstruction\fR\fR +.HP 24 +\fBudevadm monitor \fR\fB[options]\fR +.HP 29 +\fBudevadm test \fR\fB[options]\fR\fB \fR\fB\fIdevpath\fR\fR +.HP 16 +\fBudevadm version\fR +.HP 13 +\fBudevadm help\fR +.SH "DESCRIPTION" +.PP +udevadm expects a command and command specific options\. It controls the runtime behavior of udev, request kernel events, manages the event queue, and provides simple debugging mechanisms\. +.SH "OPTIONS" +.SS "udevadm info" +.PP +Queries the udev database for device information stored in the udev database\. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device\. +.PP +\fB\-\-query=\fR\fB\fItype\fR\fR +.RS 4 +Query the database for specified type of device data\. It needs the +\fB\-\-path\fR +or +\fB\-\-name\fR +to identify the specified device\. Valid queries are: +\fBname\fR, +\fBsymlink\fR, +\fBpath\fR, +\fBenv\fR, +\fBall\fR\. +.RE +.PP +\fB\-\-path=\fR\fB\fIdevpath\fR\fR +.RS 4 +The devpath of the device to query\. +.RE +.PP +\fB\-\-name=\fR\fB\fInode\fR\fR +.RS 4 +The name of the device node or a symlink to query +.RE +.PP +\fB\-\-root\fR +.RS 4 +The udev root directory: +\fI/dev\fR\. If used in conjunction with a +\fBname\fR +or +\fBsymlink\fR +query, the query returns the absolute path including the root directory\. +.RE +.PP +\fB\-\-attribute\-walk\fR +.RS 4 +Print all sysfs properties of the specified device that can be used in udev rules to match the specified device\. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules\. +.RE +.PP +\fB\-\-export\-db\fR +.RS 4 +Export the content of the udev database\. +.RE +.PP +\fB\-\-version\fR +.RS 4 +Print version\. +.RE +.PP +\fB\-\-help\fR +.RS 4 +Print help text\. +.RE +.SS "udevadm trigger" +.PP +Request kernel device uevents, usually used to replay events at system coldplug\. +.PP +\fB\-\-verbose\fR +.RS 4 +Print the list of devices which will be triggered\. +.RE +.PP +\fB\-\-dry\-run\fR +.RS 4 +Do not actually trigger the event\. +.RE +.PP +\fB\-\-retry\-failed\fR +.RS 4 +Trigger only the events which are failed during a previous run\. +.RE +.PP +\fB\-\-action=\fR\fB\fIaction\fR\fR +.RS 4 +Type of event to be triggered\. The default value is "add"\. +.RE +.PP +\fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR +.RS 4 +Trigger events for devices which belong to a matching subsystem\. This option can be specified multiple times and supports shell style pattern matching\. +.RE +.PP +\fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR +.RS 4 +Do not trigger events for devices which belong to a matching subsystem\. This option can be specified multiple times and supports shell style pattern matching\. +.RE +.PP +\fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR +.RS 4 +Trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. +.RE +.PP +\fB\-\-attr\-nomatch\fR\fB\fIattribute=value\fR\fR +.RS 4 +Do not trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. +.RE +.SS "udevadm settle" +.PP +Watches the udev event queue, and exits if all current events are handled\. +.PP +\fB\-\-timeout=\fR\fB\fIseconds\fR\fR +.RS 4 +Maximum seconds to wait for the queue to become empty\. +.RE +.PP +\fB\-\-help\fR +.RS 4 +Print help text\. +.RE +.SS "udevadm control \fIinstruction\fR" +.PP +Modify the internal state of the running udev daemon\. +.PP +\fBlog_priority=\fR\fB\fIvalue\fR\fR +.RS 4 +Set the internal log level of udevd\. Valid values are the numerical syslog priorities or their textual representations: +\fBerr\fR, +\fBinfo\fR +and +\fBdebug\fR\. +.RE +.PP +\fBstop_exec_queue\fR +.RS 4 +Signal udevd to stop executing new events\. Incoming events will be queued\. +.RE +.PP +\fBstart_exec_queue\fR +.RS 4 +Signal udevd to enable the execution of events\. +.RE +.PP +\fBreload_rules\fR +.RS 4 +Signal udevd to reload the rules from the config\. +.RE +.PP +\fBenv \fR\fB\fIvar\fR\fR\fB=\fR\fB\fIvalue\fR\fR +.RS 4 +Set global variable\. +.RE +.PP +\fBmax_childs\fR +.RS 4 +Set the maximum number of events, udevd will handle at the same time\. +.RE +.PP +\fBmax_childs_running\fR +.RS 4 +Set the maximum number of events, which are allowed to run at the same time\. +.RE +.PP +\fBhelp\fR +.RS 4 +Print help text\. +.RE +.SS "udevadm monitor" +.PP +Listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console\. It can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event\. +.PP +\fB\-\-environment\fR +.RS 4 +Print the complete environment for all events\. Can be used to compare the kernel supplied and the udev added environment values\. +.RE +.PP +\fB\-\-kernel\fR +.RS 4 +Print the kernel uevents\. +.RE +.PP +\fB\-\-udev\fR +.RS 4 +Print the udev event after the rule processing\. +.RE +.PP +\fB\-\-help\fR +.RS 4 +Print help text\. +.RE +.SS "udevadm test" +.PP +Simulate a udev event run for the given device, and print out debug output\. Unless forced to, no device node or symlink will be created\. +.PP +\fB\-\-action=\fR\fB\fIstring\fR\fR +.RS 4 +The action string\. +.RE +.PP +\fB\-\-subsystem=\fR\fB\fIstring\fR\fR +.RS 4 +The subsystem string\. +.RE +.PP +\fB\-\-force\fR +.RS 4 +Force the creation of a device node or symlink\. Usually the test run prints only debug output\. +.RE +.PP +\fB\-\-help\fR +.RS 4 +Print help text\. +.RE +.SS "udevadm version" +.PP +Print version number\. +.SS "udevadm help" +.PP +Print help text\. +.SH "AUTHOR" +.PP +Written by Kay Sievers +\. +.SH "SEE ALSO" +.PP +\fBudev\fR(7) +\fBudevd\fR(8) diff --git a/udevadm.c b/udevadm.c new file mode 100644 index 0000000000..24e4d991be --- /dev/null +++ b/udevadm.c @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2007 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int verbose; + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + + if (priority > udev_log_priority) + return; + + va_start(args, format); + if (verbose) { + vprintf(format, args); + printf("\n"); + } else + vsyslog(priority, format, args); + va_end(args); +} +#endif + +struct command { + const char *name; + int (*cmd)(int argc, char *argv[], char *envp[]); + const char *help; + int verbose; +}; + +static const struct command cmds[]; + +static int version(int argc, char *argv[], char *envp[]) +{ + printf("%s\n", UDEV_VERSION); + return 0; +} + +static int help(int argc, char *argv[], char *envp[]) +{ + const struct command *cmd; + + printf("Usage: udev COMMAND [OPTIONS]\n"); + for (cmd = cmds; cmd->name != NULL; cmd++) + printf(" %-12s %s\n", cmd->name, cmd->help); + printf("\n"); + return 0; +} + +static const struct command cmds[] = { + { + .name = "info", + .cmd = udevinfo, + .help = "query sysfs or the udev database", + }, + { + .name = "trigger", + .cmd = udevtrigger, + .help = "request events from the kernel", + }, + { + .name = "settle", + .cmd = udevsettle, "", + .help = "wait for the event queue to finish", + }, + { + .name = "control", + .cmd = udevcontrol, + .help = "control the udev daemon", + }, + { + .name = "monitor", + .cmd = udevmonitor, + .help = "listen to kernel and udev events", + }, + { + .name = "test", + .cmd = udevtest, + .help = "simulation run", + .verbose = 1, + }, + { + .name = "version", + .cmd = version, + .help = "print the version number", + }, + { + .name = "help", + .cmd = help, + .help = "print this help text", + }, + {} +}; + +int main(int argc, char *argv[], char *envp[]) +{ + const char *command; + const char *pos; + const struct command *cmd; + int rc; + + /* get binary or symlink name */ + pos = strrchr(argv[0], '/'); + if (pos != NULL) + command = &pos[1]; + else + command = argv[0]; + + /* the trailing part of the binary or symlink name is the command */ + if (strncmp(command, "udev", 4) == 0) + command = &command[4]; + + if (command == NULL || command[0] == '\0') + goto err_unknown; + + /* udevadm itself needs to strip its name from the passed options */ + if (strcmp(command, "adm") == 0) { + command = argv[1]; + argv++; + argc--; + } + + if (command == NULL || command[0] == '\0') + goto err_unknown; + + /* find and execute command */ + for (cmd = cmds; cmd->name != NULL; cmd++) { + if (strcmp(cmd->name, command) == 0) { + verbose = cmd->verbose; + rc = cmd->cmd(argc, argv, envp); + goto out; + } + } + +err_unknown: + fprintf(stderr, "unknown command, try help\n\n"); + rc = 2; +out: + return rc; +} diff --git a/udevadm.xml b/udevadm.xml new file mode 100644 index 0000000000..0dd1570bd2 --- /dev/null +++ b/udevadm.xml @@ -0,0 +1,354 @@ + + + +
                +
                + udevadm + + + udevd + November 2007 + udev + + + + udevadm + 8 + + + + + udevadmudev management tool + + + + + udevadm info options + + + udevadm trigger options + + + udevadm settle options + + + udevadm control options instruction + + + udevadm monitor options + + + udevadm test options devpath + + + udevadm version + + + udevadm help + + + + DESCRIPTION + udevadm expects a command and command specific options. It + controls the runtime behavior of udev, request kernel events, + manages the event queue, and provides simple debugging mechanisms. + + + OPTIONS + + udevadm info + Queries the udev database for device information + stored in the udev database. It can also query the properties + of a device from its sysfs representation to help creating udev + rules that match this device. + + + + + Query the database for specified type of device data. It needs the + or to identify the specified + device. Valid queries are: + name, symlink, path, + env, all. + + + + + + The devpath of the device to query. + + + + + + The name of the device node or a symlink to query + + + + + + The udev root directory: /dev. If used in conjunction + with a name or symlink query, the + query returns the absolute path including the root directory. + + + + + + Print all sysfs properties of the specified device that can be used + in udev rules to match the specified device. It prints all devices + along the chain, up to the root of sysfs that can be used in udev rules. + + + + + + Export the content of the udev database. + + + + + + Print version. + + + + + + Print help text. + + + + + + udevadm trigger + Request kernel device uevents, usually used to replay events at system coldplug. + + + + + Print the list of devices which will be triggered. + + + + + + Do not actually trigger the event. + + + + + + Trigger only the events which are failed during a previous run. + + + + + + Type of event to be triggered. The default value is "add". + + + + + + Trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Do not trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Trigger events for devices with a matching sysfs attribute. If a value is specified + along with the attribute name, the content of the attribute is matched against the given + value using shell style pattern matching. If no value is specified, the existence of the + sysfs attribute is checked. This option can be specified multiple times. + + + + + + Do not trigger events for devices with a matching sysfs attribute. If a value is + specified along with the attribute name, the content of the attribute is matched against + the given value using shell style pattern matching. If no value is specified, the existence + of the sysfs attribute is checked. This option can be specified multiple times. + + + + + + udevadm settle + Watches the udev event queue, and exits if all current events are handled. + + + + + Maximum seconds to wait for the queue to become empty. + + + + + + Print help text. + + + + + + udevadm control <replaceable>instruction</replaceable> + Modify the internal state of the running udev daemon. + + + + + Set the internal log level of udevd. Valid values are the numerical + syslog priorities or their textual representations: , + and . + + + + + + Signal udevd to stop executing new events. Incoming events + will be queued. + + + + + + Signal udevd to enable the execution of events. + + + + + + Signal udevd to reload the rules from the config. + + + + + + Set global variable. + + + + + + Set the maximum number of events, udevd will handle at the + same time. + + + + + + Set the maximum number of events, which are allowed to run at the + same time. + + + + + + Print help text. + + + + + + udevadm monitor + Listens to the kernel uevents and events sent out by a udev rule + and prints the devpath of the event to the console. It can be used to analyze the + event timing, by comparing the timestamps of the kernel uevent and the udev event. + + + + + + Print the complete environment for all events. Can be used to compare the + kernel supplied and the udev added environment values. + + + + + + Print the kernel uevents. + + + + + + Print the udev event after the rule processing. + + + + + + Print help text. + + + + + + udevadm test + Simulate a udev event run for the given device, and print out debug + output. Unless forced to, no device node or symlink will be created. + + + + + The action string. + + + + + + The subsystem string. + + + + + + Force the creation of a device node or symlink. Usually the test run + prints only debug output. + + + + + + Print help text. + + + + + + udevadm version + Print version number. + + + udevadm help + Print help text. + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev7 + + + udevd8 + + + +
                +
                diff --git a/udevcontrol.c b/udevcontrol.c index b20ce2e071..54a0744683 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -34,21 +34,7 @@ static int sock = -1; static int udev_log = 0; -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) +int udevcontrol(int argc, char *argv[], char *envp[]) { static struct udevd_ctrl_msg ctrl_msg; struct sockaddr_un saddr; @@ -124,7 +110,7 @@ int main(int argc, char *argv[], char *envp[]) strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf)); info("send env '%s'", val); } else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { - printf("Usage: udevcontrol COMMAND\n" + printf("Usage: udevadm control COMMAND\n" " log_priority= set the udev log level for the daemon\n" " stop_exec_queue keep udevd from executing events, queue only\n" " start_exec_queue execute events, flush queue\n" diff --git a/udevd.8 b/udevd.8 index 46edde4356..8c20daeba2 100644 --- a/udevd.8 +++ b/udevd.8 @@ -102,4 +102,5 @@ Written by Kay Sievers \. .SH "SEE ALSO" .PP -\fBudev\fR(7) +\fBudev\fR(8), +\fBudevadm\fR(8) diff --git a/udevd.c b/udevd.c index eb311dfba7..7f32a2aa79 100644 --- a/udevd.c +++ b/udevd.c @@ -76,17 +76,14 @@ void log_message(int priority, const char *format, ...) if (priority > udev_log_priority) return; + va_start(args, format); if (verbose) { printf("[%d] ", (int) getpid()); - va_start(args, format); vprintf(format, args); - va_end(args); printf("\n"); - } else { - va_start(args, format); + } else vsyslog(priority, format, args); - va_end(args); - } + va_end(args); } #endif diff --git a/udevd.xml b/udevd.xml index cf033a06b2..21e1c21f52 100644 --- a/udevd.xml +++ b/udevd.xml @@ -151,7 +151,10 @@ SEE ALSO - udev7 + udev8 + , + + udevadm8 diff --git a/udevinfo.8 b/udevinfo.8 deleted file mode 100644 index 6115f29bbc..0000000000 --- a/udevinfo.8 +++ /dev/null @@ -1,82 +0,0 @@ -.\" Title: udevinfo -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 -.\" Date: August 2005 -.\" Manual: udevinfo -.\" Source: udev -.\" -.TH "UDEVINFO" "8" "August 2005" "udev" "udevinfo" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevinfo - query udev device information -.SH "SYNOPSIS" -.HP 9 -\fBudevinfo\fR [\fB\-\-query=\fR\fB\fIquery\-type\fR\fR] [\fB\-\-path=\fR\fB\fIdevpath\fR\fR] [\fB\-\-name=\fR\fB\fInode\fR\fR] [\fB\-\-root\fR] [\fB\-\-attribute\-walk\fR] [\fB\-\-export\-db\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] -.SH "DESCRIPTION" -.PP -udevinfo queries the udev database for device information stored in the udev database\. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device\. -.SH "OPTIONS" -.PP -\fB\-\-query=\fR\fB\fItype\fR\fR -.RS 4 -Query the database for specified type of device data\. It needs the -\fB\-\-path\fR -or -\fB\-\-name\fR -to identify the specified device\. Valid queries are: -\fBname\fR, -\fBsymlink\fR, -\fBpath\fR, -\fBenv\fR, -\fBall\fR\. -.RE -.PP -\fB\-\-path=\fR\fB\fIdevpath\fR\fR -.RS 4 -The devpath of the device to query\. -.RE -.PP -\fB\-\-name=\fR\fB\fInode\fR\fR -.RS 4 -The name of the device node or a symlink to query -.RE -.PP -\fB\-\-root\fR -.RS 4 -The udev root directory: -\fI/dev\fR\. If used in conjunction with a -\fBname\fR -or -\fBsymlink\fR -query, the query returns the absolute path including the root directory\. -.RE -.PP -\fB\-\-attribute\-walk\fR -.RS 4 -Print all sysfs properties of the specified device that can be used in udev rules to match the specified device\. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules\. -.RE -.PP -\fB\-\-export\-db\fR -.RS 4 -Export the content of the udev database\. -.RE -.PP -\fB\-\-version\fR -.RS 4 -Print version\. -.RE -.PP -\fB\-\-help\fR -.RS 4 -Print help text\. -.RE -.SH "AUTHOR" -.PP -Written by Kay Sievers -\. -.SH "SEE ALSO" -.PP -\fBudev\fR(7) diff --git a/udevinfo.c b/udevinfo.c index a2bc013691..fc45f7565d 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -31,21 +31,6 @@ #include "udev.h" - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - static void print_all_attributes(const char *devpath, const char *key) { char path[PATH_SIZE]; @@ -221,7 +206,7 @@ out: return rc; } -int main(int argc, char *argv[], char *envp[]) +int udevinfo(int argc, char *argv[], char *envp[]) { int option; struct udevice *udev; @@ -336,7 +321,7 @@ int main(int argc, char *argv[], char *envp[]) printf("udevinfo, version %s\n", UDEV_VERSION); goto exit; case 'h': - printf("Usage: udevinfo OPTIONS\n" + printf("Usage: udevadm info OPTIONS\n" " --query= query database for the specified value:\n" " name name of device node\n" " symlink pointing to node\n" diff --git a/udevinfo.xml b/udevinfo.xml deleted file mode 100644 index bb3571cc23..0000000000 --- a/udevinfo.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - -
                -
                - udevinfo - - - udevinfo - August 2005 - udev - - - - udevinfo - 8 - - - - - udevinfo - query udev device information - - - - - udevinfo - - - - - - - - - - - - DESCRIPTION - udevinfo queries the udev database for device information - stored in the udev database. It can also query the properties - of a device from its sysfs representation to help creating udev - rules that match this device. - - - OPTIONS - - - - - Query the database for specified type of device data. It needs the - or to identify the specified - device. Valid queries are: - name, symlink, path, - env, all. - - - - - - The devpath of the device to query. - - - - - - The name of the device node or a symlink to query - - - - - - The udev root directory: /dev. If used in conjunction - with a name or symlink query, the - query returns the absolute path including the root directory. - - - - - - Print all sysfs properties of the specified device that can be used - in udev rules to match the specified device. It prints all devices - along the chain, up to the root of sysfs that can be used in udev rules. - - - - - - Export the content of the udev database. - - - - - - - Print version. - - - - - - - Print help text. - - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev7 - - - -
                -
                diff --git a/udevmonitor.8 b/udevmonitor.8 deleted file mode 100644 index 5b624a795f..0000000000 --- a/udevmonitor.8 +++ /dev/null @@ -1,48 +0,0 @@ -.\" Title: udevmonitor -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 -.\" Date: August 2005 -.\" Manual: udevmonitor -.\" Source: udev -.\" -.TH "UDEVMONITOR" "8" "August 2005" "udev" "udevmonitor" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevmonitor - print the kernel and udev event sequence to the console -.SH "SYNOPSIS" -.HP 12 -\fBudevmonitor\fR [\fB\-\-environment\fR] [\fB\-\-kernel\fR] [\fB\-\-udev\fR] [\fB\-\-help\fR] -.SH "DESCRIPTION" -.PP -udevmonitor listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console\. It can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event\. -.SH "OPTIONS" -.PP -\fB\-\-environment\fR -.RS 4 -Print the complete environment for all events\. Can be used to compare the kernel supplied and the udev added environment values\. -.RE -.PP -\fB\-\-kernel\fR -.RS 4 -Print the kernel uevents\. -.RE -.PP -\fB\-\-udev\fR -.RS 4 -Print the udev event after the rule processing\. -.RE -.PP -\fB\-\-help\fR -.RS 4 -Print usage\. -.RE -.SH "AUTHOR" -.PP -Written by Kay Sievers -\. -.SH "SEE ALSO" -.PP -\fBudev\fR(7) diff --git a/udevmonitor.c b/udevmonitor.c index 644a955090..75e39481a0 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -123,7 +123,7 @@ static const char *search_key(const char *searchkey, const char *buf, size_t buf return NULL; } -int main(int argc, char *argv[]) +int udevmonitor(int argc, char *argv[], char *envp[]) { struct sigaction act; int option; @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) udev = 1; break; case 'h': - printf("Usage: udevmonitor [--environment] [--kernel] [--udev] [--help]\n" + printf("Usage: udevadm monitor [--environment] [--kernel] [--udev] [--help]\n" " --env print the whole event environment\n" " --kernel print kernel uevents\n" " --udev print udev events\n" diff --git a/udevmonitor.xml b/udevmonitor.xml deleted file mode 100644 index 1ab87ab351..0000000000 --- a/udevmonitor.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - -
                -
                - udevmonitor - - - udevmonitor - August 2005 - udev - - - - udevmonitor - 8 - - - - - udevmonitor - print the kernel and udev event sequence to the console - - - - - udevmonitor - - - - - - - - DESCRIPTION - udevmonitor listens to the kernel uevents and events sent out by a udev rule - and prints the devpath of the event to the console. It can be used to analyze the - event timing, by comparing the timestamps of the kernel uevent and the udev event. - - - - OPTIONS - - - - - Print the complete environment for all events. Can be used to compare the - kernel supplied and the udev added environment values. - - - - - - Print the kernel uevents. - - - - - - Print the udev event after the rule processing. - - - - - - Print usage. - - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev7 - - - -
                -
                diff --git a/udevsettle.8 b/udevsettle.8 deleted file mode 100644 index 39054d9f40..0000000000 --- a/udevsettle.8 +++ /dev/null @@ -1,39 +0,0 @@ -.\" Title: udevsettle -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 -.\" Date: March 2006 -.\" Manual: udevsettle -.\" Source: udev -.\" -.TH "UDEVSETTLE" "8" "March 2006" "udev" "udevsettle" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevsettle - wait until queued kernel/udev events are handled -.SH "SYNOPSIS" -.HP 11 -\fBudevsettle\fR [\fB\-\-timeout=\fR\fB\fIseconds\fR\fR] -.SH "DESCRIPTION" -.PP -Waits watching the udev event queue and exits if all current events are handled\. -.SH "OPTIONS" -.PP -\fB\-\-timeout=\fR\fB\fIseconds\fR\fR -.RS 4 -maximum seconds to wait for the queue to become empty\. -.RE -.SH "ENVIRONMENT" -.PP -\fBUDEV_LOG\fR -.RS 4 -Overrides the syslog priority specified in the config file\. -.RE -.SH "AUTHOR" -.PP -Written by Kay Sievers -\. -.SH "SEE ALSO" -.PP -\fBudev\fR(7) diff --git a/udevsettle.c b/udevsettle.c index 42a03bafe3..e3982a42b0 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -35,22 +35,7 @@ #define DEFAULT_TIMEOUT 180 #define LOOP_PER_SECOND 20 - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -int main(int argc, char *argv[], char *envp[]) +int udevsettle(int argc, char *argv[], char *envp[]) { char queuename[PATH_SIZE]; char filename[PATH_SIZE]; @@ -90,7 +75,7 @@ int main(int argc, char *argv[], char *envp[]) dbg("timeout=%i", timeout); break; case 'h': - printf("Usage: udevsettle [--help] [--timeout=]\n\n"); + printf("Usage: udevadm settle [--help] [--timeout=]\n\n"); goto exit; } } diff --git a/udevsettle.xml b/udevsettle.xml deleted file mode 100644 index 8eb8cbd523..0000000000 --- a/udevsettle.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - -
                -
                - udevsettle - - - udevsettle - March 2006 - udev - - - - udevsettle - 8 - - - - - udevsettlewait until queued kernel/udev events are handled - - - - - udevsettle - - - - - DESCRIPTION - Waits watching the udev event queue and exits if all current events are handled. - - - OPTIONS - - - - - maximum seconds to wait for the queue to become empty. - - - - - - ENVIRONMENT - - - - - Overrides the syslog priority specified in the config file. - - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev7 - - - -
                -
                diff --git a/udevstart.8 b/udevstart.8 deleted file mode 100644 index 6b463cf1b6..0000000000 --- a/udevstart.8 +++ /dev/null @@ -1,27 +0,0 @@ -.\" Title: udevstart -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 -.\" Date: August 2005 -.\" Manual: udevstart -.\" Source: udev -.\" -.TH "UDEVSTART" "8" "August 2005" "udev" "udevstart" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevstart - populate initial device directory -.SH "SYNOPSIS" -.HP 10 -\fBudevstart\fR -.SH "DESCRIPTION" -.PP -udevstart scans the kernel exported device information available in sysfs for devices which require a device node to operate and creates the node using the specified udev rules\. udevstart is used to create the initial device directory after system bootup\. -.SH "AUTHOR" -.PP -Written by Harald Hoyer -\. -.SH "SEE ALSO" -.PP -\fBudev\fR(7) diff --git a/udevstart.xml b/udevstart.xml deleted file mode 100644 index c48de7c32c..0000000000 --- a/udevstart.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - -
                -
                - udevstart - - - udevstart - August 2005 - udev - - - - udevstart - 8 - - - - - udevstartpopulate initial device directory - - - - - udevstart - - - - DESCRIPTION - udevstart scans the kernel exported device information available in - sysfs for devices which require a device node to operate and creates the node - using the specified udev rules. udevstart is used to create the initial - device directory after system bootup. - - - AUTHOR - Written by Harald Hoyer harald@redhat.com. - - - - SEE ALSO - - udev7 - - - -
                -
                diff --git a/udevtest.8 b/udevtest.8 deleted file mode 100644 index a090465486..0000000000 --- a/udevtest.8 +++ /dev/null @@ -1,27 +0,0 @@ -.\" Title: udevtest -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 -.\" Date: August 2005 -.\" Manual: udevtest -.\" Source: udev -.\" -.TH "UDEVTEST" "8" "August 2005" "udev" "udevtest" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevtest - simulate a udev run and print the action to the console -.SH "SYNOPSIS" -.HP 21 -\fBudevtest \fR\fB\fIdevice\-path\fR\fR -.SH "DESCRIPTION" -.PP -udevtest simulates a udev run for the given device and prints out the name of the node udev would have created, or the name of the network interface, that would have been renamed\. -.SH "AUTHOR" -.PP -Written by Greg Kroah\-Hartman -\. -.SH "SEE ALSO" -.PP -\fBudev\fR(7) diff --git a/udevtest.c b/udevtest.c index 7b3ea6311d..a36e503fd4 100644 --- a/udevtest.c +++ b/udevtest.c @@ -32,22 +32,6 @@ #include "udev.h" #include "udev_rules.h" - -#ifdef USE_LOG -void log_message (int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vprintf(format, args); - va_end(args); - printf("\n"); -} -#endif - static int import_uevent_var(const char *devpath) { char path[PATH_SIZE]; @@ -87,7 +71,7 @@ out: return rc; } -int main(int argc, char *argv[], char *envp[]) +int udevtest(int argc, char *argv[], char *envp[]) { int force = 0; const char *action = "add"; @@ -136,7 +120,7 @@ int main(int argc, char *argv[], char *envp[]) force = 1; break; case 'h': - printf("Usage: udevtest OPTIONS \n" + printf("Usage: udevadm test OPTIONS \n" " --action= set action string\n" " --subsystem= set subsystem string\n" " --force don't skip node/link creation\n" diff --git a/udevtest.xml b/udevtest.xml deleted file mode 100644 index 259558dd5a..0000000000 --- a/udevtest.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - -
                -
                - udevtest - - - udevtest - August 2005 - udev - - - - udevtest - 8 - - - - - udevtest - simulate a udev run and print the action to the console - - - - - udevtest device-path - - - - DESCRIPTION - udevtest simulates a udev run for the given device and prints out the - name of the node udev would have created, or the name of the network interface, - that would have been renamed. - - - AUTHOR - Written by Greg Kroah-Hartman greg@kroah.com. - - - - SEE ALSO - - udev7 - - - -
                -
                diff --git a/udevtrigger.8 b/udevtrigger.8 deleted file mode 100644 index 06c7e4526e..0000000000 --- a/udevtrigger.8 +++ /dev/null @@ -1,76 +0,0 @@ -.\" Title: udevtrigger -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 -.\" Date: March 2006 -.\" Manual: udevtrigger -.\" Source: udev -.\" -.TH "UDEVTRIGGER" "8" "March 2006" "udev" "udevtrigger" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevtrigger - request kernel devices events for coldplug -.SH "SYNOPSIS" -.HP 12 -\fBudevtrigger\fR [\fB\-\-verbose\fR] [\fB\-\-dry\-run\fR] [\fB\-\-retry\-failed\fR] [\fB\-\-help\fR] [\fB\-\-action=\fR\fB\fIaction\fR\fR] [\fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR] [\fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR] [\fB\-\-attr\-nomatch=\fR\fB\fIattribute=value\fR\fR] -.SH "DESCRIPTION" -.PP -Trigger kernel device uevents to replay missing events at system coldplug\. -.SH "OPTIONS" -.PP -\fB\-\-verbose\fR -.RS 4 -Print the list of devices which will be triggered\. -.RE -.PP -\fB\-\-dry\-run\fR -.RS 4 -Do not actually trigger the event\. -.RE -.PP -\fB\-\-retry\-failed\fR -.RS 4 -Trigger only the events which are failed during a previous run\. -.RE -.PP -\fB\-\-action=\fR\fB\fIaction\fR\fR -.RS 4 -Type of event to be triggered\. The default value is "add"\. -.RE -.PP -\fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR -.RS 4 -Trigger events for devices which belong to a matching subsystem\. This option can be specified multiple times and supports shell style pattern matching\. -.RE -.PP -\fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR -.RS 4 -Do not trigger events for devices which belong to a matching subsystem\. This option can be specified multiple times and supports shell style pattern matching\. -.RE -.PP -\fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR -.RS 4 -Trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. -.RE -.PP -\fB\-\-attr\-nomatch\fR\fB\fIattribute=value\fR\fR -.RS 4 -Do not trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. -.RE -.SH "ENVIRONMENT" -.PP -\fBUDEV_LOG\fR -.RS 4 -Overrides the syslog priority specified in the config file\. -.RE -.SH "AUTHOR" -.PP -Written by Kay Sievers - -and Hannes Reinecke -\. -.SH "SEE ALSO" -.PP -\fBudev\fR(7) diff --git a/udevtrigger.c b/udevtrigger.c index 309c54ab68..0a9dc66909 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -42,20 +42,6 @@ LIST_HEAD(filter_subsystem_nomatch_list); LIST_HEAD(filter_attr_match_list); LIST_HEAD(filter_attr_nomatch_list); -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - /* devices that should run last cause of their dependencies */ static int delay_device(const char *devpath) { @@ -445,7 +431,7 @@ static void scan_failed(void) } } -int main(int argc, char *argv[], char *envp[]) +int udevtrigger(int argc, char *argv[], char *envp[]) { int failed = 0; int option; @@ -499,7 +485,7 @@ int main(int argc, char *argv[], char *envp[]) name_list_add(&filter_attr_nomatch_list, optarg, 0); break; case 'h': - printf("Usage: udevtrigger OPTIONS\n" + printf("Usage: udevadm trigger OPTIONS\n" " --verbose print the list of devices while running\n" " --dry-run do not actually trigger the events\n" " --retry-failed trigger only the events which have been\n" diff --git a/udevtrigger.xml b/udevtrigger.xml deleted file mode 100644 index eb2b9851cd..0000000000 --- a/udevtrigger.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - -
                -
                - udevtrigger - - - udevtrigger - March 2006 - udev - - - - udevtrigger - 8 - - - - - udevtriggerrequest kernel devices events for coldplug - - - - - udevtrigger - - - - - - - - - - - - - DESCRIPTION - Trigger kernel device uevents to replay missing events at system coldplug. - - - OPTIONS - - - - - Print the list of devices which will be triggered. - - - - - - Do not actually trigger the event. - - - - - - Trigger only the events which are failed during a previous run. - - - - - - Type of event to be triggered. The default value is "add". - - - - - - Trigger events for devices which belong to a matching subsystem. This option - can be specified multiple times and supports shell style pattern matching. - - - - - - Do not trigger events for devices which belong to a matching subsystem. This option - can be specified multiple times and supports shell style pattern matching. - - - - - - Trigger events for devices with a matching sysfs attribute. If a value is specified - along with the attribute name, the content of the attribute is matched against the given - value using shell style pattern matching. If no value is specified, the existence of the - sysfs attribute is checked. This option can be specified multiple times. - - - - - - Do not trigger events for devices with a matching sysfs attribute. If a value is - specified along with the attribute name, the content of the attribute is matched against - the given value using shell style pattern matching. If no value is specified, the existence - of the sysfs attribute is checked. This option can be specified multiple times. - - - - - - ENVIRONMENT - - - - - Overrides the syslog priority specified in the config file. - - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org and - Hannes Reinecke hare@suse.de. - - - - SEE ALSO - - udev7 - - - -
                -
                -- cgit v1.2.3-54-g00ecf From 3ca494515ccc7ba3cdfa946325bcf0273b899510 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 9 Nov 2007 00:49:50 +0100 Subject: udevadm: accept command as option, like --help, --version --- RELEASE-NOTES | 12 ++++++++---- udevadm.c | 8 ++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6fadd2baf0..1b68833253 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -2,10 +2,14 @@ udev 117 ======== Bugfixes. -All udev tools are merged into a single binary called udevadm now. -The old names of the binary are commands for udevadm now. Symlinks -provide the functionality of the standalone tools. There is only a -single udevadm.8 man page for all tools left. +All udev tools are merged into a single binary called udevadm. +The old names of the tools are built-in commands in udevadm now. +Symlinks to udevadm, with the names of the old tools, provide +the same functionality as the standalone tools. There is also +only a single udevadm.8 man page left for all tools. + +Tools like mkinitramfs should be checked, if they need to include +udevadm in the list of files. udev 116 ======== diff --git a/udevadm.c b/udevadm.c index 24e4d991be..e2b7779a91 100644 --- a/udevadm.c +++ b/udevadm.c @@ -65,7 +65,7 @@ static int help(int argc, char *argv[], char *envp[]) { const struct command *cmd; - printf("Usage: udev COMMAND [OPTIONS]\n"); + printf("Usage: udevadm COMMAND [OPTIONS]\n"); for (cmd = cmds; cmd->name != NULL; cmd++) printf(" %-12s %s\n", cmd->name, cmd->help); printf("\n"); @@ -145,9 +145,13 @@ int main(int argc, char *argv[], char *envp[]) argc--; } - if (command == NULL || command[0] == '\0') + if (command == NULL) goto err_unknown; + /* allow command to be specified as an option */ + if (strncmp(command, "--", 2) == 0) + command += 2; + /* find and execute command */ for (cmd = cmds; cmd->name != NULL; cmd++) { if (strcmp(cmd->name, command) == 0) { -- cgit v1.2.3-54-g00ecf From a9780590f4459da37368ab55a32568ca7f0d6821 Mon Sep 17 00:00:00 2001 From: MUNEDA Takahiro Date: Fri, 9 Nov 2007 16:24:42 +0900 Subject: man: fix udevadm.8 typo Signed-off-by: MUNEDA Takahiro --- udevadm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udevadm.xml b/udevadm.xml index 0dd1570bd2..0518c3ba1a 100644 --- a/udevadm.xml +++ b/udevadm.xml @@ -51,7 +51,7 @@ DESCRIPTION udevadm expects a command and command specific options. It - controls the runtime behavior of udev, request kernel events, + controls the runtime behavior of udev, requests kernel events, manages the event queue, and provides simple debugging mechanisms. -- cgit v1.2.3-54-g00ecf From f338bac88574c68a71520dd71e325ddcce6fef56 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 9 Nov 2007 10:22:30 +0100 Subject: udevadm: add info option --device-id-of-file= Now, that udevinfo is no longer in /usr, we can add this: $ udevadm info --device-id-of-file=/ 8 5 to create a dynamic rule to provide /dev/root. --- udevadm.8 | 9 +++++++-- udevadm.xml | 9 ++++++++- udevinfo.c | 54 +++++++++++++++++++++++++++++++++++++++--------------- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/udevadm.8 b/udevadm.8 index 23502215ec..c07e7c60f0 100644 --- a/udevadm.8 +++ b/udevadm.8 @@ -31,7 +31,7 @@ udevadm - udev management tool \fBudevadm help\fR .SH "DESCRIPTION" .PP -udevadm expects a command and command specific options\. It controls the runtime behavior of udev, request kernel events, manages the event queue, and provides simple debugging mechanisms\. +udevadm expects a command and command specific options\. It controls the runtime behavior of udev, requests kernel events, manages the event queue, and provides simple debugging mechanisms\. .SH "OPTIONS" .SS "udevadm info" .PP @@ -56,7 +56,7 @@ to identify the specified device\. Valid queries are: The devpath of the device to query\. .RE .PP -\fB\-\-name=\fR\fB\fInode\fR\fR +\fB\-\-name=\fR\fB\fIfile\fR\fR .RS 4 The name of the device node or a symlink to query .RE @@ -76,6 +76,11 @@ query, the query returns the absolute path including the root directory\. Print all sysfs properties of the specified device that can be used in udev rules to match the specified device\. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules\. .RE .PP +\fB\-\-device\-id\-of\-file=\fR\fB\fIfile\fR\fR +.RS 4 +Print major/minor numbers of the underlying device, where the file lives on\. +.RE +.PP \fB\-\-export\-db\fR .RS 4 Export the content of the udev database\. diff --git a/udevadm.xml b/udevadm.xml index 0518c3ba1a..14bc897c11 100644 --- a/udevadm.xml +++ b/udevadm.xml @@ -80,7 +80,7 @@
                - + The name of the device node or a symlink to query @@ -101,6 +101,13 @@ along the chain, up to the root of sysfs that can be used in udev rules. + + + + Print major/minor numbers of the underlying device, where the file + lives on. + + diff --git a/udevinfo.c b/udevinfo.c index fc45f7565d..3fc40faf14 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -206,6 +206,20 @@ out: return rc; } +static int stat_device(const char *name) +{ + struct stat statbuf; + + if (stat(name, &statbuf) != 0) + return -1; + + if (major(statbuf.st_dev) == 0) + return -1; + + printf("%d %d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); + return 0; +} + int udevinfo(int argc, char *argv[], char *envp[]) { int option; @@ -219,6 +233,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) { "attribute-walk", 0, NULL, 'a' }, { "export-db", 0, NULL, 'e' }, { "root", 0, NULL, 'r' }, + { "device-id-of-file", 1, NULL, 'd' }, { "version", 0, NULL, 1 }, /* -V outputs braindead format */ { "help", 0, NULL, 'h' }, {} @@ -229,6 +244,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) ACTION_QUERY, ACTION_ATTRIBUTE_WALK, ACTION_ROOT, + ACTION_DEVICE_ID_FILE, } action = ACTION_NONE; enum query_type { @@ -256,7 +272,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) } while (1) { - option = getopt_long(argc, argv, "aen:p:q:rVh", options, NULL); + option = getopt_long(argc, argv, "aed:n:p:q:rVh", options, NULL); if (option == -1) break; @@ -308,6 +324,10 @@ int udevinfo(int argc, char *argv[], char *envp[]) action = ACTION_ROOT; root = 1; break; + case 'd': + action = ACTION_DEVICE_ID_FILE; + strlcpy(name, optarg, sizeof(name)); + break; case 'a': action = ACTION_ATTRIBUTE_WALK; break; @@ -322,20 +342,20 @@ int udevinfo(int argc, char *argv[], char *envp[]) goto exit; case 'h': printf("Usage: udevadm info OPTIONS\n" - " --query= query database for the specified value:\n" - " name name of device node\n" - " symlink pointing to node\n" - " path sysfs device path\n" - " env the device related imported environment\n" - " all all values\n" - "\n" - " --path= sysfs device path used for query or chain\n" - " --name= node or symlink name used for query\n" - "\n" - " --root prepend to query result or print udev_root\n" - " --attribute-walk print all SYSFS_attributes along the device chain\n" - " --export-db export the content of the udev database\n" - " --help print this text\n" + " --query= query database for the specified value:\n" + " name name of device node\n" + " symlink pointing to node\n" + " path sysfs device path\n" + " env the device related imported environment\n" + " all all values\n" + " --path= sysfs device path used for query or chain\n" + " --name= node or symlink name used for query\n" + " --root prepend to query result or print udev_root\n" + " --attribute-walk print all key matches while walking along chain\n" + " of parent devices\n" + " --device-id-of-file= print major/minor of underlying device\n" + " --export-db export the content of the udev database\n" + " --help print this text\n" "\n"); goto exit; default: @@ -421,6 +441,10 @@ int udevinfo(int argc, char *argv[], char *envp[]) goto exit; } break; + case ACTION_DEVICE_ID_FILE: + if (stat_device(name) != 0) + rc = 6; + break; case ACTION_ROOT: printf("%s\n", udev_root); break; -- cgit v1.2.3-54-g00ecf From d1bba79592fde43163dc1023bbb8a56046b1932c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 9 Nov 2007 15:13:25 +0100 Subject: Makefile: fix bogus version number than got committed --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3b254f1226..047d767630 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 118 +VERSION = 116 # set this to make use of syslog USE_LOG = true -- cgit v1.2.3-54-g00ecf From a5258107d254e70f41ec620e77518b78f71297e9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 9 Nov 2007 17:05:34 +0100 Subject: udevadm: also return major==0 results for --device-id-of-file --- udevinfo.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index 3fc40faf14..948aaccc36 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -213,9 +213,6 @@ static int stat_device(const char *name) if (stat(name, &statbuf) != 0) return -1; - if (major(statbuf.st_dev) == 0) - return -1; - printf("%d %d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); return 0; } -- cgit v1.2.3-54-g00ecf From 3c52e8d8bb37bfbd67b8a53f9142353b543505f2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 9 Nov 2007 17:55:45 +0100 Subject: man: udevd.8 - remove udevcontrol section --- udevd.8 | 53 ++++------------------------------------------------ udevd.xml | 64 +++++---------------------------------------------------------- 2 files changed, 9 insertions(+), 108 deletions(-) diff --git a/udevd.8 b/udevd.8 index 8c20daeba2..0f0dd1ac2d 100644 --- a/udevd.8 +++ b/udevd.8 @@ -2,10 +2,10 @@ .\" Author: .\" Generator: DocBook XSL Stylesheets v1.73.1 .\" Date: August 2005 -.\" Manual: udevd, udevcontrol +.\" Manual: udevd .\" Source: udev .\" -.TH "UDEVD" "8" "August 2005" "udev" "udevd, udevcontrol" +.TH "UDEVD" "8" "August 2005" "udev" "udevd" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) @@ -15,11 +15,10 @@ udevd - event managing daemon .SH "SYNOPSIS" .HP 6 \fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-verbose\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] -.HP 20 -\fBudevcontrol \fR\fB\fIcommand\fR\fR .SH "DESCRIPTION" .PP -udevd listens to kernel uevents and passes the incoming events to udev\. It ensures the right event order and takes care, that events for child devices are delayed until the parent has finished the device handling\. +udevd listens to kernel uevents and passes the incoming events to udev\. It ensures the correct event order and takes care, that events for child devices are delayed until the parent event has finished the device handling\. The behavior of the running daemon can be changed with +\fBudevadm control\fR\. .SH "OPTIONS" .PP \fB\-\-daemon\fR @@ -42,50 +41,6 @@ Print log messages to stdout\. Print version number\. .RE .PP -\fB\-\-help\fR -.RS 4 -Print usage\. -.RE -.PP -\fBlog_priority=\fR\fB\fIvalue\fR\fR -.RS 4 -Set the internal log level of udevd\. Valid values are the numerical syslog priorities or their textual representations: -\fBerr\fR, -\fBinfo\fR -and -\fBdebug\fR\. -.RE -.PP -\fBstop_exec_queue\fR -.RS 4 -Signal udevd to stop executing new events\. Incoming events will be queued\. -.RE -.PP -\fBstart_exec_queue\fR -.RS 4 -Signal udevd to enable the execution of events\. -.RE -.PP -\fBreload_rules\fR -.RS 4 -Signal udevd to reload the rules from the config\. -.RE -.PP -\fBenv \fR\fB\fIvar\fR\fR\fB=\fR\fB\fIvalue\fR\fR -.RS 4 -Set global variable\. -.RE -.PP -\fBmax_childs\fR -.RS 4 -Set the maximum number of events, udevd will handle at the same time\. -.RE -.PP -\fBmax_childs_running\fR -.RS 4 -Set the maximum number of events, which are allowed to run at the same time\. -.RE -.PP \fBhelp\fR .RS 4 Print help text\. diff --git a/udevd.xml b/udevd.xml index 21e1c21f52..0b3c01787a 100644 --- a/udevd.xml +++ b/udevd.xml @@ -4,7 +4,7 @@
                - udevd, udevcontrol + udevd udevd @@ -31,15 +31,14 @@ - - udevcontrol command - DESCRIPTION udevd listens to kernel uevents and passes the incoming events to - udev. It ensures the right event order and takes care, that events for child - devices are delayed until the parent has finished the device handling. + udev. It ensures the correct event order and takes care, that events for child + devices are delayed until the parent event has finished the device handling. + The behavior of the running daemon can be changed with + udevadm control. OPTIONS @@ -71,59 +70,6 @@ Print version number. - - - - Print usage. - - - - - - Set the internal log level of udevd. Valid values are the numerical - syslog priorities or their textual representations: , - and . - - - - - - Signal udevd to stop executing new events. Incoming events - will be queued. - - - - - - Signal udevd to enable the execution of events. - - - - - - Signal udevd to reload the rules from the config. - - - - - - Set global variable. - - - - - - Set the maximum number of events, udevd will handle at the - same time. - - - - - - Set the maximum number of events, which are allowed to run at the - same time. - - -- cgit v1.2.3-54-g00ecf From d6856b85a1fb022fb2ba7c860290341af8bc75bd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 9 Nov 2007 19:30:12 +0100 Subject: udevadm: control - allow command to be passed as option --- TODO | 4 ++++ udevadm.8 | 28 ++++++++++++++-------------- udevadm.xml | 28 ++++++++++++++-------------- udevcontrol.c | 22 +++++++++++++--------- 4 files changed, 45 insertions(+), 37 deletions(-) diff --git a/TODO b/TODO index 380de4896c..10c5f9bdcc 100644 --- a/TODO +++ b/TODO @@ -11,3 +11,7 @@ udev version: o remove udevstart (we rely on the kernel "uevent"-triggers of kernel 2.6.15 and no longer want to guess event-properties from sysfs like udevstart is doing it) + + o remove man page symlinks for old tool names + + o some day, remove the symlinks to udevadm diff --git a/udevadm.8 b/udevadm.8 index c07e7c60f0..c9a1178b4d 100644 --- a/udevadm.8 +++ b/udevadm.8 @@ -33,7 +33,7 @@ udevadm - udev management tool .PP udevadm expects a command and command specific options\. It controls the runtime behavior of udev, requests kernel events, manages the event queue, and provides simple debugging mechanisms\. .SH "OPTIONS" -.SS "udevadm info" +.SS "udevadm info \fIoptions\fR" .PP Queries the udev database for device information stored in the udev database\. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device\. .PP @@ -95,7 +95,7 @@ Print version\. .RS 4 Print help text\. .RE -.SS "udevadm trigger" +.SS "udevadm trigger [options]" .PP Request kernel device uevents, usually used to replay events at system coldplug\. .PP @@ -138,7 +138,7 @@ Trigger events for devices with a matching sysfs attribute\. If a value is speci .RS 4 Do not trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. .RE -.SS "udevadm settle" +.SS "udevadm settle [options]" .PP Watches the udev event queue, and exits if all current events are handled\. .PP @@ -151,11 +151,11 @@ Maximum seconds to wait for the queue to become empty\. .RS 4 Print help text\. .RE -.SS "udevadm control \fIinstruction\fR" +.SS "udevadm control \fIcommand\fR" .PP Modify the internal state of the running udev daemon\. .PP -\fBlog_priority=\fR\fB\fIvalue\fR\fR +\fB\-\-log_priority=\fR\fB\fIvalue\fR\fR .RS 4 Set the internal log level of udevd\. Valid values are the numerical syslog priorities or their textual representations: \fBerr\fR, @@ -164,41 +164,41 @@ and \fBdebug\fR\. .RE .PP -\fBstop_exec_queue\fR +\fB\-\-stop_exec_queue\fR .RS 4 Signal udevd to stop executing new events\. Incoming events will be queued\. .RE .PP -\fBstart_exec_queue\fR +\fB\-\-start_exec_queue\fR .RS 4 Signal udevd to enable the execution of events\. .RE .PP -\fBreload_rules\fR +\fB\-\-reload_rules\fR .RS 4 Signal udevd to reload the rules from the config\. .RE .PP -\fBenv \fR\fB\fIvar\fR\fR\fB=\fR\fB\fIvalue\fR\fR +\fB\-\-env \fR\fB\fIvar\fR\fR\fB=\fR\fB\fIvalue\fR\fR .RS 4 Set global variable\. .RE .PP -\fBmax_childs\fR +\fB\-\-max_childs\fR .RS 4 Set the maximum number of events, udevd will handle at the same time\. .RE .PP -\fBmax_childs_running\fR +\fB\-\-max_childs_running\fR .RS 4 Set the maximum number of events, which are allowed to run at the same time\. .RE .PP -\fBhelp\fR +\fB\-\-help\fR .RS 4 Print help text\. .RE -.SS "udevadm monitor" +.SS "udevadm monitor [options]" .PP Listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console\. It can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event\. .PP @@ -221,7 +221,7 @@ Print the udev event after the rule processing\. .RS 4 Print help text\. .RE -.SS "udevadm test" +.SS "udevadm test [options] \fIdevpath\fR" .PP Simulate a udev event run for the given device, and print out debug output\. Unless forced to, no device node or symlink will be created\. .PP diff --git a/udevadm.xml b/udevadm.xml index 14bc897c11..5a47b734b5 100644 --- a/udevadm.xml +++ b/udevadm.xml @@ -57,7 +57,7 @@ OPTIONS - udevadm info + udevadm info <replaceable>options</replaceable> Queries the udev database for device information stored in the udev database. It can also query the properties of a device from its sysfs representation to help creating udev @@ -129,7 +129,7 @@ - udevadm trigger + udevadm trigger <optional>options</optional> Request kernel device uevents, usually used to replay events at system coldplug. @@ -191,7 +191,7 @@ - udevadm settle + udevadm settle <optional>options</optional> Watches the udev event queue, and exits if all current events are handled. @@ -209,11 +209,11 @@ - udevadm control <replaceable>instruction</replaceable> + udevadm control <replaceable>command</replaceable> Modify the internal state of the running udev daemon. - + Set the internal log level of udevd. Valid values are the numerical syslog priorities or their textual representations: , @@ -221,46 +221,46 @@ - + Signal udevd to stop executing new events. Incoming events will be queued. - + Signal udevd to enable the execution of events. - + Signal udevd to reload the rules from the config. - + Set global variable. - + Set the maximum number of events, udevd will handle at the same time. - + Set the maximum number of events, which are allowed to run at the same time. - + Print help text. @@ -268,7 +268,7 @@ - udevadm monitor + udevadm monitor <optional>options</optional> Listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console. It can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event. @@ -302,7 +302,7 @@ - udevadm test + udevadm test <optional>options</optional> <replaceable>devpath</replaceable> Simulate a udev event run for the given device, and print out debug output. Unless forced to, no device node or symlink will be created. diff --git a/udevcontrol.c b/udevcontrol.c index 54a0744683..2442a3e0a9 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -60,6 +60,10 @@ int udevcontrol(int argc, char *argv[], char *envp[]) strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); arg = argv[1]; + /* allow instructions passed as options */ + if (strncmp(arg, "--", 2) == 0) + arg += 2; + if (!strcmp(arg, "stop_exec_queue")) ctrl_msg.type = UDEVD_CTRL_STOP_EXEC_QUEUE; else if (!strcmp(arg, "start_exec_queue")) @@ -109,16 +113,16 @@ int udevcontrol(int argc, char *argv[], char *envp[]) ctrl_msg.type = UDEVD_CTRL_ENV; strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf)); info("send env '%s'", val); - } else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) { + } else if (strcmp(arg, "help") == 0 || strcmp(arg, "-h") == 0) { printf("Usage: udevadm control COMMAND\n" - " log_priority= set the udev log level for the daemon\n" - " stop_exec_queue keep udevd from executing events, queue only\n" - " start_exec_queue execute events, flush queue\n" - " reload_rules reloads the rules files\n" - " env = set a global environment variable\n" - " max_childs= maximum number of childs\n" - " max_childs_running= maximum number of childs running at the same time\n" - " help print this help text\n\n"); + " --log_priority= set the udev log level for the daemon\n" + " --stop_exec_queue keep udevd from executing events, queue only\n" + " --start_exec_queue execute events, flush queue\n" + " --reload_rules reloads the rules files\n" + " --env = set a global environment variable\n" + " --max_childs= maximum number of childs\n" + " --max_childs_running= maximum number of childs running at the same time\n" + " --help print this help text\n\n"); goto exit; } else { fprintf(stderr, "unrecognized command '%s'\n", arg); -- cgit v1.2.3-54-g00ecf From 765729b9081f3b8edda4ed5e286bec69db1f3ca3 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sat, 10 Nov 2007 16:17:47 +0100 Subject: rules: Gentoo update --- etc/udev/gentoo/40-gentoo.rules | 12 ++++++++++++ etc/udev/gentoo/65-permissions.rules | 6 +++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 etc/udev/gentoo/40-gentoo.rules diff --git a/etc/udev/gentoo/40-gentoo.rules b/etc/udev/gentoo/40-gentoo.rules new file mode 100644 index 0000000000..99a1c66c69 --- /dev/null +++ b/etc/udev/gentoo/40-gentoo.rules @@ -0,0 +1,12 @@ +# do not edit this file, it will be overwritten on update + +# capi devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# old devfs path, removing this could break systems +# Bug 195839 +KERNEL=="md[0-9]*", SYMLINK+="md/%n" +KERNEL=="loop[0-9]*", SYMLINK+="loop/%n" +KERNEL=="ram[0-9]*", SYMLINK+="rd/%n" + diff --git a/etc/udev/gentoo/65-permissions.rules b/etc/udev/gentoo/65-permissions.rules index 523c79d7f8..494f19e63f 100644 --- a/etc/udev/gentoo/65-permissions.rules +++ b/etc/udev/gentoo/65-permissions.rules @@ -15,8 +15,12 @@ KERNEL=="st[0-9]*|nst[0-9]*|ht[0-9]*|nht[0-9]*|pt[0-9]*|npt[0-9]*", \ SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[18]", GROUP="tape", MODE="660" # dialout devices -KERNEL=="ippp*|isdn*|dcbri*", GROUP="uucp" +KERNEL=="ippp*|isdn*|dcbri*|capi*", GROUP="uucp" KERNEL=="pilot", GROUP="uucp" # sound devices (sound=alsa, snd=oss) SUBSYSTEM=="sound|snd", GROUP="audio" + +# Sony Vaio Jogdial sonypi device +KERNEL=="sonypi", MODE="0666" + -- cgit v1.2.3-54-g00ecf From 6d83d9a62468c2db4357b362f910b121c633a965 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 13 Nov 2007 20:47:34 +0100 Subject: release 117 --- ChangeLog | 35 +++++++++++++++++++++++++++++++++++ Makefile | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index c8bc3cbe56..d317b97760 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +Summary of changes from v116 to v117 +============================================ + +Dan Nicholson (2): + extras: ignore built and generated files + volume_id: create relative symlink when $(libdir) = $(usrlibdir) + +Kay Sievers (15): + usb_id: fail if vendor/product can not be retrieved + rules: SUSE update + firmware: do not print error if logger is missing + volume_id: vfat - allow all possible sector sizes + volume_id: LUKS - export version + volume_id: ntfs - rely on valid master file table + volume_id: bump version + udevinfo: exclude "uevent" file from --attribute-walk + udevadm: merge all udev tools into a single binary + udevadm: accept command as option, like --help, --version + udevadm: add info option --device-id-of-file= + Makefile: fix bogus version number than got committed + udevadm: also return major==0 results for --device-id-of-file + man: udevd.8 - remove udevcontrol section + udevadm: control - allow command to be passed as option + +MUNEDA Takahiro (1): + man: fix udevadm.8 typo + +Matthias Schwarzott (2): + firmware: remove hardcoded path to logger + rules: Gentoo update + +VMiklos (1): + rules: Frugalware update + + Summary of changes from v115 to v116 ============================================ diff --git a/Makefile b/Makefile index 047d767630..c22c8a80e9 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 116 +VERSION = 117 # set this to make use of syslog USE_LOG = true -- cgit v1.2.3-54-g00ecf From c645b98b7ee51c5700a54e7674083756de67affe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 13 Nov 2007 23:44:12 +0100 Subject: remove udevstart --- .gitignore | 1 - Makefile | 2 - RELEASE-NOTES | 5 + TODO | 4 - test/udevstart-test.pl | 61 --------- udevstart.c | 359 ------------------------------------------------- 6 files changed, 5 insertions(+), 427 deletions(-) delete mode 100755 test/udevstart-test.pl delete mode 100644 udevstart.c diff --git a/.gitignore b/.gitignore index d21eb7bf03..ae9c0fe4ec 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.a udevd udevadm -udevstart udev_version.h test-udev diff --git a/Makefile b/Makefile index c22c8a80e9..1998c8517c 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,6 @@ V = PROGRAMS = \ udevd \ udevadm \ - udevstart \ test-udev HEADERS = \ @@ -314,7 +313,6 @@ uninstall: uninstall-bin uninstall-man test tests: all @ cd test && ./udev-test.pl - @ cd test && ./udevstart-test.pl .PHONY: test tests buildtest: diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 1b68833253..249ec95915 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,8 @@ +udev 118 +======== +udevstart is removed from the tree, it did not get installed for +a long time now and is long replaced by trigger and settle. + udev 117 ======== Bugfixes. diff --git a/TODO b/TODO index 10c5f9bdcc..7f7b1b0f2b 100644 --- a/TODO +++ b/TODO @@ -8,10 +8,6 @@ These things will change in future udev versions: These things are deprecated and scheduled for removal in a future udev version: - o remove udevstart - (we rely on the kernel "uevent"-triggers of kernel 2.6.15 and no longer - want to guess event-properties from sysfs like udevstart is doing it) - o remove man page symlinks for old tool names o some day, remove the symlinks to udevadm diff --git a/test/udevstart-test.pl b/test/udevstart-test.pl deleted file mode 100755 index 6829bc05cf..0000000000 --- a/test/udevstart-test.pl +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/perl - -# udevstart-test -# -# runs udevstart in a temporary directory with our test sysfs-tree -# and counts the created nodes to compare it with the expected numbers. -# -# Kay Sievers , 2005 -# - -use warnings; -use strict; - -my $PWD = $ENV{PWD}; -my $sysfs = "sys/"; -my $udevstart_bin = "../udevstart"; -my $udev_root = "udev-root/"; # !!! directory will be removed !!! -my $udev_db = ".udevdb"; -my $udev_conf = "udev-test.conf"; -my $udev_rules = "udev-test.rules"; - -# set env -$ENV{SYSFS_PATH} = $sysfs; -$ENV{UDEV_CONFIG_FILE} = $udev_conf; - -# due to mknod restrictions -if (!($<==0)) { - print "Must have root permissions to run properly.\n"; - exit; -} - -# prepare -system("rm -rf $udev_root"); -mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; - -# create config file -open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; -print CONF "udev_root=\"$udev_root\"\n"; -print CONF "udev_db=\"$udev_db\"\n"; -print CONF "udev_rules=\"$udev_rules\"\n"; -close CONF; - -# create rules file -open RULES, ">$udev_rules" || die "unable to create rules file: $udev_rules"; -print RULES "\n"; -close RULES; - -system("$udevstart_bin"); -my $block = int(`find $udev_root -type b -print | wc -l`); -my $char = int(`find $udev_root -type c -print | wc -l`); - -print "block devices: $block/10\n"; -print "char devices: $char/91\n"; -print "\n"; - -# cleanup -system("rm -rf $udev_db"); -system("rm -rf $udev_root"); -unlink($udev_rules); -unlink($udev_conf); - diff --git a/udevstart.c b/udevstart.c deleted file mode 100644 index 66b96a2186..0000000000 --- a/udevstart.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * quick and dirty way to populate a /dev directory - * - * Copyright (C) 2004 Harald Hoyer - * Copyright (C) 2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" -#include "udev_selinux.h" - -static const char *udev_run_str; -static const char *udev_log_str; -static struct udev_rules rules; - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -struct device { - struct list_head node; - char path[PATH_SIZE]; -}; - -/* sort files in lexical order */ -static int device_list_insert(const char *path, struct list_head *device_list) -{ - struct device *loop_device; - struct device *new_device; - const char *devpath = &path[strlen(sysfs_path)]; - - dbg("insert: '%s'", devpath); - - list_for_each_entry(loop_device, device_list, node) { - if (strcmp(loop_device->path, devpath) > 0) { - break; - } - } - - new_device = malloc(sizeof(struct device)); - if (new_device == NULL) { - dbg("error malloc"); - return -ENOMEM; - } - - strlcpy(new_device->path, devpath, sizeof(new_device->path)); - list_add_tail(&new_device->node, &loop_device->node); - dbg("add '%s'" , new_device->path); - return 0; -} - -/* list of devices that we should run last due to any one of a number of reasons */ -static char *last_list[] = { - "/block/dm", /* on here because dm wants to have the block devices around before it */ - NULL, -}; - -/* list of devices that we should run first due to any one of a number of reasons */ -static char *first_list[] = { - "/class/mem", - "/class/tty", - NULL, -}; - -static int add_device(const char *devpath) -{ - struct sysfs_device *dev; - struct udevice *udev; - int retval = 0; - - /* clear and set environment for next event */ - clearenv(); - setenv("ACTION", "add", 1); - setenv("UDEV_START", "1", 1); - if (udev_log_str) - setenv("UDEV_LOG", udev_log_str, 1); - if (udev_run_str) - setenv("UDEV_RUN", udev_run_str, 1); - - dev = sysfs_device_get(devpath); - if (dev == NULL) - return -1; - - udev = udev_device_init(NULL); - if (udev == NULL) - return -1; - - /* override built-in sysfs device */ - udev->dev = dev; - strcpy(udev->action, "add"); - - if (strcmp(udev->dev->subsystem, "net") != 0) { - udev->devt = udev_device_get_devt(udev); - if (major(udev->devt) == 0) - return -1; - } - - dbg("add '%s'", udev->dev->devpath); - setenv("DEVPATH", udev->dev->devpath, 1); - setenv("SUBSYSTEM", udev->dev->subsystem, 1); - - udev_rules_get_name(&rules, udev); - if (udev->ignore_device) { - dbg("device event will be ignored"); - goto exit; - } - if (udev->name[0] != '\0') - retval = udev_device_event(&rules, udev); - else - info("device node creation supressed"); - - if (retval == 0 && udev_run) - udev_rules_run(udev); - -exit: - udev_device_cleanup(udev); - return 0; -} - -static void exec_list(struct list_head *device_list) -{ - struct device *loop_device; - struct device *tmp_device; - int i; - - /* handle the "first" type devices first */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { - for (i = 0; first_list[i] != NULL; i++) { - if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) { - add_device(loop_device->path); - list_del(&loop_device->node); - free(loop_device); - break; - } - } - } - - /* handle the devices we are allowed to, excluding the "last" type devices */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { - int found = 0; - for (i = 0; last_list[i] != NULL; i++) { - if (strncmp(loop_device->path, last_list[i], strlen(last_list[i])) == 0) { - found = 1; - break; - } - } - if (found) - continue; - - add_device(loop_device->path); - list_del(&loop_device->node); - free(loop_device); - } - - /* handle the rest of the devices left over, if any */ - list_for_each_entry_safe(loop_device, tmp_device, device_list, node) { - add_device(loop_device->path); - list_del(&loop_device->node); - free(loop_device); - } -} - -static int has_devt(const char *path) -{ - char filename[PATH_SIZE]; - struct stat statbuf; - - snprintf(filename, sizeof(filename), "%s/dev", path); - filename[sizeof(filename)-1] = '\0'; - - if (stat(filename, &statbuf) == 0) - return 1; - - return 0; -} - -static void udev_scan_block(struct list_head *device_list) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - snprintf(base, sizeof(base), "%s/block", sysfs_path); - base[sizeof(base)-1] = '\0'; - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); - dirname[sizeof(dirname)-1] = '\0'; - if (has_devt(dirname)) - device_list_insert(dirname, device_list); - else - continue; - - /* look for partitions */ - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name); - dirname2[sizeof(dirname2)-1] = '\0'; - - if (has_devt(dirname2)) - device_list_insert(dirname2, device_list); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void udev_scan_class(struct list_head *device_list) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - snprintf(base, sizeof(base), "%s/class", sysfs_path); - base[sizeof(base)-1] = '\0'; - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - snprintf(dirname, sizeof(dirname), "%s/%s", base, dent->d_name); - dirname[sizeof(dirname)-1] = '\0'; - - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name); - dirname2[sizeof(dirname2)-1] = '\0'; - - if (has_devt(dirname2) || strcmp(dent->d_name, "net") == 0) - device_list_insert(dirname2, device_list); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void asmlinkage sig_handler(int signum) -{ - switch (signum) { - case SIGALRM: - exit(1); - case SIGINT: - case SIGTERM: - exit(20 + signum); - } -} - -int main(int argc, char *argv[], char *envp[]) -{ - LIST_HEAD(device_list); - struct sigaction act; - - logging_init("udevstart"); - udev_config_init(); - selinux_init(); - dbg("version %s", UDEV_VERSION); - - udev_run_str = getenv("UDEV_RUN"); - udev_log_str = getenv("UDEV_LOG"); - - /* disable all logging if not explicitely requested */ - if (udev_log_str == NULL) - udev_log_priority = 0; - - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = (void (*) (int))sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - - /* trigger timeout to prevent hanging processes */ - alarm(UDEV_ALARM_TIMEOUT); - - sysfs_init(); - udev_rules_init(&rules, 1); - - udev_scan_class(&device_list); - udev_scan_block(&device_list); - exec_list(&device_list); - - udev_rules_cleanup(&rules); - sysfs_cleanup(); - selinux_exit(); - logging_close(); - return 0; -} -- cgit v1.2.3-54-g00ecf From c8ee8f983f351929066cbab75ae4f8c4256f425d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 20 Nov 2007 18:18:03 +0100 Subject: rules_generator: do not create rules with insufficient matches Thanks to Alexander E. Patrakov for pointing out that we create invalid rules. We still need a proper fix for devices we skip creating rules (locally administered MAC), but want to swap names with interface names we created rules for. --- extras/rule_generator/75-persistent-net-generator.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 726bf27871..2aa3076a59 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -44,6 +44,9 @@ SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" # S/390 uses id matches only, do not use MAC address match SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID}="$id", ENV{MATCHDRV}="$driver", ENV{MATCHADDR}="" +# see if we got enough data to create a rule +ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", GOTO="persistent_net_generator_end" + # default comment ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device" -- cgit v1.2.3-54-g00ecf From 101d112e38c2315cac6eb1b7067ea7ef31d9c430 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Nov 2007 23:49:30 +0100 Subject: man: udevadm settle - mention 180 seconds default timeout Based on a patch from Jonas Meurer. Thanks! --- udevadm.8 | 2 +- udevadm.xml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/udevadm.8 b/udevadm.8 index c9a1178b4d..acad283bc3 100644 --- a/udevadm.8 +++ b/udevadm.8 @@ -144,7 +144,7 @@ Watches the udev event queue, and exits if all current events are handled\. .PP \fB\-\-timeout=\fR\fB\fIseconds\fR\fR .RS 4 -Maximum seconds to wait for the queue to become empty\. +Maximum number of seconds to wait for the event queue to become empty\. The default value is 180 seconds\. .RE .PP \fB\-\-help\fR diff --git a/udevadm.xml b/udevadm.xml index 5a47b734b5..ccbeeca404 100644 --- a/udevadm.xml +++ b/udevadm.xml @@ -197,7 +197,8 @@ - Maximum seconds to wait for the queue to become empty. + Maximum number of seconds to wait for the event queue to become empty. + The default value is 180 seconds. -- cgit v1.2.3-54-g00ecf From d7515c7bb95748f3afc2156451dd10f3e0ee4c84 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 26 Nov 2007 01:03:08 +0100 Subject: libvolume_id: squashfs+LZMA compression detection --- extras/volume_id/lib/squashfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index 402a114e1b..70b322df0c 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -27,6 +27,7 @@ #include "util.h" #define SQUASHFS_MAGIC 0x73717368 +#define SQUASHFS_MAGIC_LZMA 0x73687371 struct squashfs_super { uint32_t s_magic; @@ -60,6 +61,11 @@ int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size) bswap_16(sqs->s_major), bswap_16(sqs->s_minor)); goto found; } + if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC_LZMA)) { + snprintf(id->type_version, sizeof(id->type_version), "%u.%u", + sqs->s_major, sqs->s_minor); + goto found; + } return -1; -- cgit v1.2.3-54-g00ecf From 1e8b8e564ca66c11b79278156b834920219d9845 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 26 Nov 2007 01:09:03 +0100 Subject: libvolume_id: squashfs - add endianess support for LZMA compression --- extras/volume_id/lib/squashfs.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index 70b322df0c..035d6fb22a 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -27,7 +27,7 @@ #include "util.h" #define SQUASHFS_MAGIC 0x73717368 -#define SQUASHFS_MAGIC_LZMA 0x73687371 +#define SQUASHFS_MAGIC_LZMA 0x71736873 struct squashfs_super { uint32_t s_magic; @@ -51,21 +51,16 @@ int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size) if (sqs == NULL) return -1; - if (sqs->s_magic == SQUASHFS_MAGIC) { + if (sqs->s_magic == SQUASHFS_MAGIC || sqs->s_magic == SQUASHFS_MAGIC_LZMA) { snprintf(id->type_version, sizeof(id->type_version), "%u.%u", sqs->s_major, sqs->s_minor); goto found; } - if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC)) { + if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC) || sqs->s_magic == bswap_32(SQUASHFS_MAGIC_LZMA)) { snprintf(id->type_version, sizeof(id->type_version), "%u.%u", bswap_16(sqs->s_major), bswap_16(sqs->s_minor)); goto found; } - if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC_LZMA)) { - snprintf(id->type_version, sizeof(id->type_version), "%u.%u", - sqs->s_major, sqs->s_minor); - goto found; - } return -1; -- cgit v1.2.3-54-g00ecf From fbb002f9d31c76f9445c4c16b3b88b11e34f8e86 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Mon, 3 Dec 2007 19:04:32 +0100 Subject: doc: update "writing udev rules" --- docs/writing_udev_rules/index.html | 185 ++++++++++++++++++++++++------------- 1 file changed, 119 insertions(+), 66 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index b41664bf69..92891376f5 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -7,6 +7,7 @@ Writing udev rules @@ -16,7 +17,7 @@

                Writing udev rules

                by Daniel Drake (dsd)
                -Version 0.72

                +Version 0.73

                The most recent version of this document can always be found at:
                @@ -43,6 +44,7 @@ The most recent version of this document can always be found at:
              • Rule syntax
              • Basic rules
              • Matching sysfs attributes
              • +
              • Device hierarchy
              • String substitutions
              • String matching
              @@ -68,7 +70,7 @@ The most recent version of this document can always be found at:
            • USB Printer
            • USB Camera
            • USB Hard Disk
            • -
            • USB Hard Disk
            • +
            • USB Card Reader
            • USB Palm Pilot
            • CD/DVD drives
            • Network interfaces
            • @@ -112,7 +114,8 @@ This document uses various examples (many of which are entirely fictional) to il

              History

                -
                  October 2nd 2006 v0.72: Fixed a typo in one of the example rules. +
                • December 3rd 2007 v0.73: Update for new udev versions, and some miscellaneous improvements.
                • +
                • October 2nd 2006 v0.72: Fixed a typo in one of the example rules.
                • June 10th 2006 v0.71: Misc changes based on recent feedback - thanks!
                • June 3rd 2006 v0.7: Complete rework, to be more suited for the modern-day udev.
                • May 9th 2005 v0.6: Misc updates, including information about udevinfo, groups and permissions, logging, and udevtest.
                • @@ -238,6 +241,10 @@ Here is an example rule to illustrate the above: The above rule includes one match key (KERNEL) and one assignment key (NAME). The semantics of these keys and their properties will be detailed later. It is important to note that the match key is related to its value through the equality operator (==), whereas the assignment key is related to its value through the assignment operator (=).

                  +

                  +Be aware that udev does not support any form of line continuation. Do not insert any line breaks in your rules, as this will cause udev to see your one rule as multiple rules and will not work as expected. +

                  +

                  Basic Rules

                  @@ -248,7 +255,7 @@ udev provides several different match keys which can be used to write rules whic
                  • KERNEL - match against the kernel name for the device
                  • SUBSYSTEM - match against the subsystem of the device
                  • -
                  • DRIVER - match against the driver name for the device
                  • +
                  • DRIVER - match against the name of the driver backing the device

                  @@ -290,19 +297,39 @@ The match keys introduced so far only provide limited matching capabilities. Rea

                  -Many drivers export information like this into sysfs, and udev allows us to incorporate sysfs-matching into our rules, using the SYSFS key with a slightly different syntax. +Many drivers export information like this into sysfs, and udev allows us to incorporate sysfs-matching into our rules, using the ATTR key with a slightly different syntax.

                  -Here are some examples of rules which match data from sysfs. Further detail will be provided later in this document which will aid you in writing rules based on sysfs attributes. +Here is an example rule which matches a single attribute from sysfs. Further detail will be provided later in this document which will aid you in writing rules based on sysfs attributes.

                  -KERNEL=="sda", SYSFS{model}=="ST3120827AS", SYMLINK+="my_hard_disk"
                  -SUBSYSTEM=="block", SYSFS{size}=="234441648", SYMLINK+="my_disk"
                  -BUS=="usb", SYSFS{manufacturer}=="OLYMPUS", SYSFS{product}=="X250,D560Z,C350Z", SYMLINK+="camera"
                  +SUBSYSTEM=="block", ATTR{size}=="234441648", SYMLINK+="my_disk"
                   
                  + +

                  Device hierarchy

                  + +

                  +The Linux kernel actually represents devices in a tree-like structure, and this information is exposed through sysfs and useful when writing rules. For example, the device representation of my hard disk device is a child of the SCSI disk device, which is in turn a child of the Serial ATA controller device, which is in turn a child of the PCI bus device. It is likely that you will find yourself needing to refer to information from a parent of the device in question, for example the serial number of my hard disk device is not exposed at the device level, it is exposed by its direct parent at the SCSI disk level. +

                  + +

                  +The four main match keys introduced so far (KERNEL/SUBSYSTEM/DRIVER/ATTR) only match against values corresponding to the device in question, and do not match values from parent devices. udev provides variants of the match keys that will search upwards through the tree: +

                  + +
                    +
                  • KERNELS - match against the kernel name for the device, or the kernel name for any of the parent devices
                  • +
                  • SUBSYSTEMS - match against the subsystem of the device, or the subsystem of any of the parent devices
                  • +
                  • DRIVERS - match against the name of the driver backing the device, or the name of the driver backing any of the parent devices
                  • +
                  • ATTRS - match a sysfs attribute of the device, or a sysfs attribute of any of the parent devices
                  • +
                  + +

                  +With hierarchy considerations in mind, you may feel that rule writing is becoming a little complicated. Rest assured that there are tools that help out here, which will be introduced later. +

                  +

                  String substitutions

                  @@ -371,17 +398,17 @@ The concept of using interesting information from sysfs was briefly touched upon

                  -sysfs is actually a very simple structure. It is logically divided into directories. Each directory contains a number of files (attributes) which typically contain just one value. Some symbolic links are present, which link various parts of the tree together. +sysfs is actually a very simple structure. It is logically divided into directories. Each directory contains a number of files (attributes) which typically contain just one value. Some symbolic links are present, which link devices to their parents. The hierarchical structure was touched upon above.

                  -Some directories are referred to as top-level device paths. These directories act as the top-level glue which chain other parts of sysfs to the device in question. Top-level device paths can be classified as sysfs directories which contain a dev file, the following command will list these for you: +Some directories are referred to as top-level device paths. These directories represent actual devices that have corresponding device nodes. Top-level device paths can be classified as sysfs directories which contain a dev file, the following command will list these for you:

                  # find /sys -name dev

                  -For example, on my system, the /sys/block/sda directory is the device path for my hard disk. It is chained to the controller through the /sys/block/sda/device/ symbolic link, which is in turn chained to the device driver through the /sys/block/sda/device/driver/ symbolic link. +For example, on my system, the /sys/block/sda directory is the device path for my hard disk. It is linked to it's parent, the SCSI disk device, through the /sys/block/sda/device symbolic link.

                  @@ -394,7 +421,7 @@ When you write rules based on sysfs information, you are simply matching attribu

                  -In a udev rule, I could use SYSFS{size}=="234441648" to identify this disk. As udev iterates through the entire device chain, I could alternatively opt to match attributes in another part of the chain (e.g. attributes in /sys/class/block/sda/device/), however there are some caveats when dealing with different parts of the chain which are described later. +In a udev rule, I could use ATTR{size}=="234441648" to identify this disk. As udev iterates through the entire device chain, I could alternatively opt to match attributes in another part of the chain (e.g. attributes in /sys/class/block/sda/device/) using ATTRS, however there are some caveats when dealing with different parts of the chain which are described later.

                  @@ -414,30 +441,37 @@ Enter udevinfo, which is probably the most straightforward tool you can looking at device '/block/sda': KERNEL=="sda" SUBSYSTEM=="block" - SYSFS{stat}==" 128535 2246 2788977 766188 73998 317300 3132216 5735004 0 516516 6503316" - SYSFS{size}=="234441648" - SYSFS{removable}=="0" - SYSFS{range}=="16" - SYSFS{dev}=="8:0" - - looking at device '/devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0': - ID=="0:0:0:0" - BUS=="scsi" - DRIVER=="sd" - SYSFS{ioerr_cnt}=="0x0" - SYSFS{iodone_cnt}=="0x31737" - SYSFS{iorequest_cnt}=="0x31737" - SYSFS{iocounterbits}=="32" - SYSFS{timeout}=="30" - SYSFS{state}=="running" - SYSFS{rev}=="3.42" - SYSFS{model}=="ST3120827AS " - SYSFS{vendor}=="ATA " - SYSFS{scsi_level}=="6" - SYSFS{type}=="0" - SYSFS{queue_type}=="none" - SYSFS{queue_depth}=="1" - SYSFS{device_blocked}=="0" + ATTR{stat}==" 128535 2246 2788977 766188 73998 317300 3132216 5735004 0 516516 6503316" + ATTR{size}=="234441648" + ATTR{removable}=="0" + ATTR{range}=="16" + ATTR{dev}=="8:0" + + looking at parent device '/devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0': + KERNELS=="0:0:0:0" + SUBSYSTEMS=="scsi" + DRIVERS=="sd" + ATTRS{ioerr_cnt}=="0x0" + ATTRS{iodone_cnt}=="0x31737" + ATTRS{iorequest_cnt}=="0x31737" + ATTRS{iocounterbits}=="32" + ATTRS{timeout}=="30" + ATTRS{state}=="running" + ATTRS{rev}=="3.42" + ATTRS{model}=="ST3120827AS " + ATTRS{vendor}=="ATA " + ATTRS{scsi_level}=="6" + ATTRS{type}=="0" + ATTRS{queue_type}=="none" + ATTRS{queue_depth}=="1" + ATTRS{device_blocked}=="0" + + looking at parent device '/devices/pci0000:00/0000:00:07.0': + KERNELS=="0000:00:07.0" + SUBSYSTEMS=="pci" + DRIVERS=="sata_nv" + ATTRS{vendor}=="0x10de" + ATTRS{device}=="0x037f"

                  @@ -445,18 +479,22 @@ As you can see, udevinfo simply produces a list of attributes you can use as-is

                  -SUBSYSTEM=="block", SYSFS{size}=="234441648", NAME="my_hard_disk"
                  -BUS=="scsi", SYSFS{model}=="ST3120827AS", NAME="my_hard_disk"
                  +SUBSYSTEM=="block", ATTR{size}=="234441648", NAME="my_hard_disk" +SUBSYSTEM="block", SUBSYSTEMS=="scsi", ATTRS{model}=="ST3120827AS", NAME="my_hard_disk"

                  -You may have noted the use of colour in the above examples. This is to demonstrate that you generally can not mix-and-match attributes from different sections of the udevinfo output - your rule will not work. For example, the following rule is invalid: +You may have noted the use of colour in the above examples. This is to demonstrate that while it is legal to combine the attributes from the device in question and a single parent device, you cannot mix-and-match attributes from multiple parent devices - your rule will not work. For example, the following rule is invalid as it attempts to match attributes from two parent devices:

                  -SUBSYSTEM=="block", SYSFS{size}=="234441648", SYSFS{model}=="ST3120827AS", NAME="my_hard_disk"
                  +SUBSYSTEM=="block", ATTRS{model}=="ST3120827AS", DRIVERS=="sata_nv", NAME="my_hard_disk" + +

                  +You are usually provided with a large number of attributes, and you must pick a number of them to construct your rule. In general, you want to choose attributes which identify your device in a persistent and human-recognisable way. In the examples above, I chose the size of my disk and its model number. I did not use meaningless numbers such as ATTRS{iodone_cnt}=="0x31737". +

                  -You are usually provided with a large number of attributes, and you must pick a number of them (from the same section) to construct your rule. In general, you want to choose attributes which identify your device in a persistent and human-recognisable way. In the examples above, I chose the size of my disk and its model number. I did not use meaningless numbers such as SYSFS{iodone_cnt}=="0x31737". +Observe the effects of hierarchy in the udevinfo output. The green section corresponding to the device in question uses the standard match keys such as KERNEL and ATTR. The blue and maroon sections corresponding to parent devices use the parent-traversing variants such as SUBSYSTEMS and ATTRS. This is why the complexity introduced by the hierarchical structure is actually quite easy to deal with, just be sure to use the exact values that udevinfo suggests.

                  @@ -567,6 +605,10 @@ Here is an example rule which demonstrates the use of the RUN list assi When /usr/bin/my_program is executed, various parts of the udev environment are available as environment variables, including key values such as SUBSYSTEM. You can also use the ACTION environment variable to detect whether the device is being connected or disconnected - ACTION will be either "add" or "remove" respectively.

                  +

                  +udev does not run these programs on any active terminal, and it does not execute them under the context of a shell. Be sure to ensure your program is marked executable, if it is a shell script ensure it starts with an appropriate shebang (e.g. #!/bin/sh), and do not expect any standard output to appear on your terminal. +

                  +

                  Environment interaction

                  @@ -621,18 +663,24 @@ I power on my printer, and it is assigned device node /dev/lp0. Not sat
                   # udevinfo -a -p $(udevinfo -q path -n /dev/lp0)
                  -looking at the device chain at '/sys/devices/pci0000:00/0000:00:02.1/usb3/3-3':
                  -BUS=="usb"
                  -SYSFS{manufacturer}=="EPSON"
                  -SYSFS{product}=="USB Printer"
                  -SYSFS{serial}=="L72010011070626380"
                  +  looking at device '/class/usb/lp0':
                  +    KERNEL=="lp0"
                  +    SUBSYSTEM=="usb"
                  +    DRIVER==""
                  +    ATTR{dev}=="180:0"
                  +
                  +  looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb1/1-1':
                  +    SUBSYSTEMS=="usb"
                  +    ATTRS{manufacturer}=="EPSON"
                  +    ATTRS{product}=="USB Printer"
                  +    ATTRS{serial}=="L72010011070626380"
                   

                  My rule becomes:

                  -
                  BUS=="usb", SYSFS{serial}=="L72010011070626380", SYMLINK+="epson_680"
                  +
                  SUBSYSTEM=="usb", ATTRS{serial}=="L72010011070626380", SYMLINK+="epson_680"

                  USB Camera

                  @@ -655,22 +703,26 @@ To get around this, you simply need to think about what differs between sdb and
                   # udevinfo -a -p $(udevinfo -q path -n /dev/sdb1)
                  -  looking at device '/devices/pci0000:00/0000:00:02.0/usb2/2-1/2-1:1.0/host6/target6:0:0/6:0:0:0':
                  -    ID=="6:0:0:0"
                  -    BUS=="scsi"
                  -    DRIVER=="sd"
                  -    SYSFS{rev}=="1.00"
                  -    SYSFS{model}=="X250,D560Z,C350Z"
                  -    SYSFS{vendor}=="OLYMPUS "
                  -    SYSFS{scsi_level}=="3"
                  -    SYSFS{type}=="0"
                  +  looking at device '/block/sdb/sdb1':
                  +    KERNEL=="sdb1"
                  +    SUBSYSTEM=="block"
                  +
                  +  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-1/1-1:1.0/host6/target6:0:0/6:0:0:0':
                  +    KERNELS=="6:0:0:0"
                  +    SUBSYSTEMS=="scsi"
                  +    DRIVERS=="sd"
                  +    ATTRS{rev}=="1.00"
                  +    ATTRS{model}=="X250,D560Z,C350Z"
                  +    ATTRS{vendor}=="OLYMPUS "
                  +    ATTRS{scsi_level}=="3"
                  +    ATTRS{type}=="0"
                   

                  My rule:

                  -
                  KERNEL=="sd?1", BUS=="scsi", SYSFS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"
                  +
                  KERNEL=="sd?1", SUBSYSTEMS=="scsi", ATTRS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"

                  USB Hard Disk

                  @@ -683,7 +735,7 @@ A USB hard disk is comparable to the USB camera I described above, however typic Of course, if you have a 100GB USB hard disk, it is perfectly understandable that you might want to partition it, in which case we can take advantage of udev's string substitutions:

                  -
                  BUS=="usb", KERNEL=="sd*", SYSFS{product}=="USB 2.0 Storage Device", NAME="%k", SYMLINK+="usbhd%n"
                  +
                  KERNEL=="sd*", SUBSYSTEMS="scsi", ATTRS{model}=="USB 2.0 Storage Device", SYMLINK+="usbhd%n"

                  This rule creates symlinks such as: @@ -710,7 +762,7 @@ These devices typically do not inform the host computer upon media change. So, i One possible solution is to take advantage of the all_partitions option, which will create 16 partition nodes for every block device that the rule matches:

                  -
                  BUS=="usb", SYSFS{product}=="USB 2.0 CompactFlash Reader", SYMLINK+="cfrdr%n", OPTIONS+="all_partitions"
                  +
                  KERNEL="sd*", SUBSYSTEMS=="scsi", ATTRS{model}=="USB 2.0 CompactFlash Reader", SYMLINK+="cfrdr%n", OPTIONS+="all_partitions"
                  You will now have nodes named: cfrdr, cfrdr1, cfrdr2, cfrdr3, ..., cfrdr15. @@ -725,7 +777,7 @@ These devices work as USB-serial devices, so by default, you only get the tt Carsten Clasohm's blog post appears to be the definitive source for this. Carsten's rule is shown below:

                  -
                  BUS=="usb", SYSFS{product}=="Palm Handheld", KERNEL=="ttyUSB*", SYMLINK+="pilot"
                  +
                  SUBSYSTEMS=="usb", ATTRS{product}=="Palm Handheld", KERNEL=="ttyUSB*", SYMLINK+="pilot"

                  Note that the product string seems to vary from product to product, so make sure that you check (using udevinfo) which one applies to you. @@ -743,8 +795,8 @@ As we know the KERNEL names for these devices, rule writing is simple. Here are

                  -BUS=="ide", KERNEL=="hdc", SYMLINK+="dvd", GROUP="cdrom"
                  -BUS=="ide", KERNEL=="hdd", SYMLINK+="dvdrw", GROUP="cdrom"
                  +SUBSYSTEM=="block", KERNEL=="hdc", SYMLINK+="dvd", GROUP="cdrom"
                  +SUBSYSTEM=="block", KERNEL=="hdd", SYMLINK+="dvdrw", GROUP="cdrom"
                   
                  @@ -761,14 +813,15 @@ It makes sense to simply match the MAC address of your interface in the rule, as
                   # udevinfo -a -p /sys/class/net/eth0
                     looking at class device '/sys/class/net/eth0':
                  -    SYSFS{address}=="00:52:8b:d5:04:48"
                  +    KERNEL=="eth0"
                  +    ATTR{address}=="00:52:8b:d5:04:48"
                   

                  Here is my rule:

                  -
                  KERNEL=="eth*", SYSFS{address}=="00:52:8b:d5:04:48", NAME="lan"
                  +
                  KERNEL=="eth*", ATTR{address}=="00:52:8b:d5:04:48", NAME="lan"

                  You will need to reload the net driver for this rule to take effect. You can either unload and reload the module, or simply reboot the system. You will also need to reconfigure your system to use "lan" rather than "eth0". I had some troubles getting this going (the interface wasn't being renamed) until I had completely dropped all references to eth0. @@ -830,7 +883,7 @@ For support, you should mail the linux-hotplug mailing list: GNU General Public License, Version 2. +This document is licensed under the GNU General Public License, Version 2.

                  -- cgit v1.2.3-54-g00ecf From 6bdec550afa1e3485233dac1e0c6727e5548e7f7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 Dec 2007 17:20:10 +0100 Subject: rules: add AOE rule --- etc/udev/rules.d/50-udev-default.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index 00b6a891d9..93e9ccd405 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -78,6 +78,7 @@ KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" KERNEL=="pktcdvd", NAME="pktcdvd/control" KERNEL=="qft0", SYMLINK+="ftape" SUBSYSTEM=="bsg", NAME="bsg/%k" +SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk" # network KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" -- cgit v1.2.3-54-g00ecf From 9e5920842b0b414e78b04ddd40fb4cf29b0d855c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 Dec 2007 17:26:15 +0100 Subject: volume_id: md - add metadata minor version Thanks to Hannes. --- extras/volume_id/lib/linux_raid.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index ff2c47c473..3c2e86e422 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -131,10 +131,12 @@ static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint6 if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC) return -1; + if (le32_to_cpu(mdp1->major_version) != 1) + return -1; + volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_FOURINT); volume_id_set_label_raw(id, mdp1->set_name, 32); volume_id_set_label_string(id, mdp1->set_name, 32); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le32_to_cpu(mdp1->major_version)); volume_id_set_usage(id, VOLUME_ID_RAID); id->type = "linux_raid_member"; return 0; @@ -151,16 +153,22 @@ int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size /* version 1.0 at the end of the device */ sboff = (size & ~(0x1000 - 1)) - 0x2000; - if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) + if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) { + strcpy(id->type_version, "1.0"); return 0; + } /* version 1.1 at the start of the device */ - if (volume_id_probe_linux_raid1(id, off, size) == 0) + if (volume_id_probe_linux_raid1(id, off, size) == 0) { + strcpy(id->type_version, "1.1"); return 0; + } /* version 1.2 at 4k offset from the start */ - if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0) + if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0) { + strcpy(id->type_version, "1.2"); return 0; + } return -1; } -- cgit v1.2.3-54-g00ecf From 5caa40bea22b9ac07dbe667985d1b8556d8b6b80 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Sun, 16 Dec 2007 19:22:32 +0100 Subject: volume_id: LVM - add uuid --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/linux_raid.c | 6 +++--- extras/volume_id/lib/lvm.c | 11 +++++++++++ extras/volume_id/lib/util.c | 18 ++++++++++++++++-- extras/volume_id/lib/util.h | 3 ++- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index b206854f55..925eff9f98 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 81 +SHLIB_REV = 82 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 3c2e86e422..5e0c4a494f 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -87,7 +87,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 uuid.ints[2] = 0; uuid.ints[3] = 0; } - volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT); + volume_id_set_uuid(id, uuid.bytes, 0, UUID_MD); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", le32_to_cpu(mdp0->major_version), le32_to_cpu(mdp0->minor_version), @@ -103,7 +103,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 uuid.ints[2] = 0; uuid.ints[3] = 0; } - volume_id_set_uuid(id, uuid.bytes, 0, UUID_FOURINT); + volume_id_set_uuid(id, uuid.bytes, 0, UUID_MD); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", be32_to_cpu(mdp0->major_version), be32_to_cpu(mdp0->minor_version), @@ -134,7 +134,7 @@ static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint6 if (le32_to_cpu(mdp1->major_version) != 1) return -1; - volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_FOURINT); + volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_MD); volume_id_set_label_raw(id, mdp1->set_name, 32); volume_id_set_label_string(id, mdp1->set_name, 32); volume_id_set_usage(id, VOLUME_ID_RAID); diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c index 9c83c55307..7c4f81131c 100644 --- a/extras/volume_id/lib/lvm.c +++ b/extras/volume_id/lib/lvm.c @@ -38,6 +38,11 @@ struct lvm2_super_block { uint8_t type[8]; } PACKED; +struct lvm2_pv_header { + uint8_t id[32]; + uint64_t devsize_xl; +} PACKED; + #define LVM1_SB_OFF 0x400 #define LVM1_MAGIC "HM" @@ -71,6 +76,7 @@ int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; unsigned int soff; struct lvm2_super_block *lvm; + struct lvm2_pv_header *pvhdr; dbg("probing at offset 0x%llx", (unsigned long long) off); @@ -89,8 +95,13 @@ int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size) return -1; found: + dbg("found at offset 0x%x (pv hdr offset 0x%x)", + soff, cpu_to_le32(lvm->offset_xl)); + soff += cpu_to_le32(lvm->offset_xl); + pvhdr = (struct lvm2_pv_header *) &buf[soff]; memcpy(id->type_version, lvm->type, 8); volume_id_set_usage(id, VOLUME_ID_RAID); + volume_id_set_uuid(id, pvhdr->id, 0, UUID_LVM); id->type = "LVM2_member"; return 0; diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 395e81bbf3..c094661ccc 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -274,9 +274,12 @@ void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, en case UUID_DCE: count = 16; break; - case UUID_FOURINT: + case UUID_MD: count = 35; break; + case UUID_LVM: + count = 32; + break; } memcpy(id->uuid_raw, buf, count); id->uuid_raw_len = count; @@ -324,7 +327,7 @@ set: memcpy(id->uuid, buf, count); id->uuid[count] = '\0'; break; - case UUID_FOURINT: + case UUID_MD: sprintf(id->uuid, "%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x", buf[0], buf[1], buf[2], buf[3], @@ -332,6 +335,17 @@ set: buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); break; + case UUID_LVM: + sprintf(id->uuid, + "%c%c%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c%c%c", + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], + buf[6], buf[7], buf[8], buf[9], + buf[10], buf[11], buf[12], buf[13], + buf[14], buf[15], buf[16], buf[17], + buf[18], buf[19], buf[20], buf[21], + buf[22], buf[23], buf[24], buf[25], + buf[26], buf[27], buf[28], buf[29], buf[30], buf[31]); + break; } } diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index 14a76c8fd2..e3c766d4ab 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -71,7 +71,8 @@ enum uuid_format { UUID_DOS, UUID_64BIT_LE, UUID_64BIT_BE, - UUID_FOURINT, + UUID_MD, + UUID_LVM, }; enum endian { -- cgit v1.2.3-54-g00ecf From 2bb4dd9766479348a2829ceb8ef583a788bfd840 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 16 Dec 2007 19:56:04 +0100 Subject: volume_id: run only once into a timeout for unreadable devices --- extras/volume_id/lib/volume_id.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 59303d5bff..b82de2344d 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -347,6 +347,10 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; + /* run only once into a timeout for unreadable devices */ + if (volume_id_get_buffer(id, 0x00, 0x200) == NULL) + return -1; + info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); @@ -378,6 +382,10 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (id == NULL) return -EINVAL; + /* run only once into a timeout for unreadable devices */ + if (volume_id_get_buffer(id, 0x00, 0x200) == NULL) + return -1; + info("probing at offset 0x%llx, size 0x%llx", (unsigned long long) off, (unsigned long long) size); -- cgit v1.2.3-54-g00ecf From be580fa5d83ef4b73b71f29ebd76b1f26eb12e9c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 17 Dec 2007 03:41:30 +0100 Subject: create_floppy_devices: fix logic for more than one floppy device --- extras/floppy/create_floppy_devices.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index b9fa4ef41d..d79a782abf 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -69,6 +69,7 @@ void log_message(int priority, const char *format, ...) int main(int argc, char **argv) { char *dev; + char *devname; char node[64]; int type = 0, i, fdnum, c; int major = 2, minor; @@ -123,12 +124,17 @@ int main(int argc, char **argv) } dev = argv[optind]; - if (dev[strlen(dev) - 3] != 'f' || dev[strlen(dev) -2 ] != 'd') { + devname = strrchr(dev, '/'); + if (devname != NULL) + devname = &devname[1]; + else + devname = dev; + if (strncmp(devname, "fd", 2) != 0) { fprintf(stderr,"Device '%s' is not a floppy device\n", dev); return 1; } - fdnum = strtol(dev + 2, NULL, 10); + fdnum = strtol(&devname[2], NULL, 10); if (fdnum < 0 || fdnum > 7) { fprintf(stderr,"Floppy device number %d out of range (0-7)\n", fdnum); return 1; -- cgit v1.2.3-54-g00ecf From 73ff769c90307e9ef2947c7ba013626fb65c1478 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 17 Dec 2007 15:32:41 +0100 Subject: volume_id: also add readable check to probe_all() Otherwise probe_all will run two times into a timout, one for the raid, and one for the filesystem probe. Thanks to Tore Anderson for the debugging. --- extras/volume_id/lib/volume_id.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index b82de2344d..9edbb69fb9 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -330,6 +330,14 @@ err: return 0; } +/* run only once into a timeout for unreadable devices */ +static int device_is_readable(struct volume_id *id) +{ + if (volume_id_get_buffer(id, 0x00, 0x200) != NULL) + return 1; + return 0; +} + /** * volume_id_probe_raid: * @id: Probing context. @@ -347,8 +355,7 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; - /* run only once into a timeout for unreadable devices */ - if (volume_id_get_buffer(id, 0x00, 0x200) == NULL) + if (!device_is_readable(id)) return -1; info("probing at offset 0x%llx, size 0x%llx", @@ -382,8 +389,7 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (id == NULL) return -EINVAL; - /* run only once into a timeout for unreadable devices */ - if (volume_id_get_buffer(id, 0x00, 0x200) == NULL) + if (!device_is_readable(id)) return -1; info("probing at offset 0x%llx, size 0x%llx", @@ -415,6 +421,9 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; + if (!device_is_readable(id)) + return -1; + /* probe for raid first, because fs probes may be successful on raid members */ if (volume_id_probe_raid(id, off, size) == 0) return 0; -- cgit v1.2.3-54-g00ecf From 3924280a896a274dcbbe08400bdb4ea11c3fbe97 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Mon, 17 Dec 2007 17:58:21 +0100 Subject: rules: Gentoo update --- etc/udev/gentoo/40-video.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/udev/gentoo/40-video.rules b/etc/udev/gentoo/40-video.rules index aafcb2d629..2d5e53411c 100644 --- a/etc/udev/gentoo/40-video.rules +++ b/etc/udev/gentoo/40-video.rules @@ -13,10 +13,10 @@ KERNEL=="card*", GROUP="video" KERNEL=="nvidia*", GROUP="video" KERNEL=="3dfx*", GROUP="video" +# svgalib +KERNEL=="svga*", GROUP="video" + # Framebuffer -# do we need /dev/fb/0 really? -# it conflicts with symlink /dev/fb -> /dev/fb0 upstream rules create -#KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" KERNEL=="fb[0-9]*", GROUP="video" # IEEE1394 (firewire) devices -- cgit v1.2.3-54-g00ecf From 7094df0a8fc24b15c602b9ef197a4ec76f64d528 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 19 Dec 2007 00:50:56 +0100 Subject: release 118 --- ChangeLog | 27 +++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 6 ++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index d317b97760..fac6b5f226 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,30 @@ +Summary of changes from v117 to v118 +============================================ + +Daniel Drake (1): + doc: update "writing udev rules" + +Hannes Reinecke (1): + volume_id: LVM - add uuid + +Kay Sievers (9): + remove udevstart + rules_generator: do not create rules with insufficient matches + man: udevadm settle - mention 180 seconds default timeout + libvolume_id: squashfs - add endianess support for LZMA compression + rules: add AOE rule + volume_id: md - add metadata minor version + volume_id: run only once into a timeout for unreadable devices + create_floppy_devices: fix logic for more than one floppy device + volume_id: also add readable check to probe_all() + +Matthias Schwarzott (1): + rules: Gentoo update + +Michael Prokop (1): + libvolume_id: squashfs+LZMA compression detection + + Summary of changes from v116 to v117 ============================================ diff --git a/Makefile b/Makefile index 1998c8517c..6c7f139e2c 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 117 +VERSION = 118 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 249ec95915..58564edcd8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,7 +1,9 @@ udev 118 ======== -udevstart is removed from the tree, it did not get installed for -a long time now and is long replaced by trigger and settle. +Bugfixes. + +Udevstart is removed from the tree, it did not get installed for +a long time now, and is long replaced by trigger and settle. udev 117 ======== -- cgit v1.2.3-54-g00ecf From 98520be72f9a0167df1da3c7b1a4ca2e88c3c831 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Dec 2007 04:17:46 +0100 Subject: switch mailing lists to linux-hotplug@vger.kernel.org --- FAQ | 4 ++-- README | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/FAQ b/FAQ index b34c38eeb8..2117a15fdf 100644 --- a/FAQ +++ b/FAQ @@ -105,7 +105,7 @@ A: When using dynamic device numbers, a given pair of major/minor numbers may Q: I have other questions about udev, where do I ask them? A: The linux-hotplug-devel mailing list is the proper place for it. The address for it is: - linux-hotplug-devel@lists.sourceforge.net + linux-hotplug@vger.kernel.org Information on joining can be found at: - https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel + http://vger.kernel.org/vger-lists.html diff --git a/README b/README index b37d0d5949..f37c12a8e0 100644 --- a/README +++ b/README @@ -90,5 +90,5 @@ Installation: and should be installed by default with every udev installation. Please direct any comment/question/concern to the linux-hotplug-devel mailing list at: - linux-hotplug-devel@lists.sourceforge.net + linux-hotplug@vger.kernel.org -- cgit v1.2.3-54-g00ecf From a0092d28dbb2c1c75c2fac17303b703343f03a35 Mon Sep 17 00:00:00 2001 From: "Anthony L. Awtrey" Date: Sat, 29 Dec 2007 17:19:06 +0100 Subject: do not skip RUN execution if device node removal fails --- udev_node.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev_node.c b/udev_node.c index c620e4aa0b..bd58a6c485 100644 --- a/udev_node.c +++ b/udev_node.c @@ -408,8 +408,8 @@ int udev_node_remove(struct udevice *udev) strlcat(filename, "/", sizeof(filename)); strlcat(filename, udev->name, sizeof(filename)); if (stat(filename, &stats) != 0) { - dbg("device node '%s' not found", filename); - return -1; + info("device node '%s' not found", filename); + return 0; } if (udev->devt && stats.st_rdev != udev->devt) { info("device node '%s' points to a different device, skip removal", filename); -- cgit v1.2.3-54-g00ecf From c74fd7a768fc3efc2950186e3fb879de9f358d8d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Dec 2007 17:23:31 +0100 Subject: rules: remove tty rule which can never run because of an earlier "last_rule" --- etc/udev/rules.d/50-udev-default.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index 93e9ccd405..aedc6ae8b4 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -7,7 +7,6 @@ KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS="last_rule" KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", OPTIONS="last_rule" KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty", OPTIONS="last_rule" KERNEL=="console", MODE="0600", OPTIONS="last_rule" -KERNEL=="tty0", SYMLINK+="systty" # serial KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" -- cgit v1.2.3-54-g00ecf From 6e509e539b15ae882afd8ce3fafe1fbd33008509 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Mon, 31 Dec 2007 14:24:55 +0100 Subject: rules_generator: add missing write_net_rules unlock --- extras/rule_generator/write_net_rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index b25ecfd806..9b66c938f3 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -88,6 +88,7 @@ fi if [ -z "$match" ]; then echo "missing valid match" >&2 + unlock_rules_file exit 1 fi -- cgit v1.2.3-54-g00ecf From 1b4f9b167b2d71fc12acdc953aa34474bfa93f73 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 9 Jan 2008 15:13:38 +0100 Subject: volume_id: fix UUID raw buffer usage Signed-off-by: Karel Zak --- extras/volume_id/lib/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index c094661ccc..0a3bd39992 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -215,8 +215,8 @@ void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count) { - if (count > sizeof(id->label)) - count = sizeof(id->label); + if (count > sizeof(id->label_raw)) + count = sizeof(id->label_raw); memcpy(id->label_raw, buf, count); id->label_raw_len = count; -- cgit v1.2.3-54-g00ecf From a141b43506c20f6681e428c5c73f3c35adb8ea2d Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Wed, 9 Jan 2008 22:36:36 +0100 Subject: volume_id: add prefix=, exec_prefix= --- extras/volume_id/lib/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 925eff9f98..499d486623 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -91,6 +91,8 @@ $(SHLIB): $(HEADERS) exported_symbols $(addprefix .shlib/,$(OBJS)) libvolume_id.pc: $(E) " GENPC " $@ + $(Q) echo "prefix=${prefix}/usr" >> $@ + $(Q) echo "exec_prefix=\$${prefix}" >> $@ $(Q) echo "libdir=${usrlibdir}" >> $@ $(Q) echo "includedir=${includedir}" >> $@ $(Q) echo "" >> $@ -- cgit v1.2.3-54-g00ecf From bf79d61233ab73c6987ba51b62ebb7070acec407 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 23 Jan 2008 12:31:10 +0100 Subject: volume_id: fix typo in function documentation Signed-off-by: Karel Zak --- extras/volume_id/lib/volume_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 9edbb69fb9..e8f6de35fd 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -86,7 +86,7 @@ static void default_log(int priority, const char *file, int line, const char *fo volume_id_log_fn_t volume_id_log_fn = default_log; /** - * volume_id_get_label: + * volume_id_get_prober_by_type: * @type: Type string. * * Lookup the probing function for a specific type. -- cgit v1.2.3-54-g00ecf From 3f91a27d16cf5440f0cb1db7c5972b4924a41d01 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 9 Feb 2008 12:17:32 +0100 Subject: volume_id: update ext detection --- extras/volume_id/lib/ext.c | 116 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 91 insertions(+), 25 deletions(-) diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index 1997d42e0b..ac21f12501 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -1,7 +1,10 @@ /* * volume_id - reads filesystem label and uuid * - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers + * Copyright (C) 2008 Theodore Ts'o + * + * The probe logic is based on libblkid from e2fsutils. * * 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 @@ -60,17 +63,63 @@ struct ext2_super_block { uint32_t s_feature_ro_compat; uint8_t s_uuid[16]; uint8_t s_volume_name[16]; + uint8_t s_last_mounted[64]; + uint32_t s_algorithm_usage_bitmap; + uint8_t s_prealloc_blocks; + uint8_t s_prealloc_dir_blocks; + uint16_t s_reserved_gdt_blocks; + uint8_t s_journal_uuid[16]; + uint32_t s_journal_inum; + uint32_t s_journal_dev; + uint32_t s_last_orphan; + uint32_t s_hash_seed[4]; + uint8_t s_def_hash_version; + uint8_t s_jnl_backup_type; + uint16_t s_reserved_word_pad; + uint32_t s_default_mount_opts; + uint32_t s_first_meta_bg; + uint32_t s_mkfs_time; + uint32_t s_jnl_blocks[17]; + uint32_t s_blocks_count_hi; + uint32_t s_r_blocks_count_hi; + uint32_t s_free_blocks_hi; + uint16_t s_min_extra_isize; + uint16_t s_want_extra_isize; + uint32_t s_flags; } PACKED; #define EXT_SUPER_MAGIC 0xEF53 +#define EXT2_FLAGS_TEST_FILESYS 0x0004 +#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 +#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 +#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 +#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 +#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 #define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 #define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 -#define EXT3_FEATURE_INCOMPAT_EXTENTS 0x0040 -#define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 -#define EXT4_FEATURE_INCOMPAT_MMP 0x0100 +#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 -#define EXT_SUPERBLOCK_OFFSET 0x400 +#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ + EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ + EXT2_FEATURE_RO_COMPAT_BTREE_DIR) +#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP + +#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ + EXT2_FEATURE_INCOMPAT_META_BG) +#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP + +#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ + EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ + EXT2_FEATURE_RO_COMPAT_BTREE_DIR) +#define EXT3_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT3_FEATURE_RO_COMPAT_SUPP + +#define EXT3_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ + EXT3_FEATURE_INCOMPAT_RECOVER| \ + EXT2_FEATURE_INCOMPAT_META_BG) +#define EXT3_FEATURE_INCOMPAT_UNSUPPORTED ~EXT3_FEATURE_INCOMPAT_SUPP + +#define EXT_SUPERBLOCK_OFFSET 0x400 #define EXT3_MIN_BLOCK_SIZE 0x400 #define EXT3_MAX_BLOCK_SIZE 0x1000 @@ -79,7 +128,9 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) struct ext2_super_block *es; size_t bsize; uint32_t feature_compat; + uint32_t feature_ro_compat; uint32_t feature_incompat; + uint32_t flags; info("probing at offset 0x%llx", (unsigned long long) off); @@ -97,38 +148,53 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) return -1; } - volume_id_set_label_raw(id, es->s_volume_name, 16); - volume_id_set_label_string(id, es->s_volume_name, 16); - volume_id_set_uuid(id, es->s_uuid, 0, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", - le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level)); - feature_compat = le32_to_cpu(es->s_feature_compat); + feature_ro_compat = le32_to_cpu(es->s_feature_ro_compat); feature_incompat = le32_to_cpu(es->s_feature_incompat); + flags = le32_to_cpu(es->s_flags); - /* check for external journal device */ + /* external journal device is jbd */ if ((feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { volume_id_set_usage(id, VOLUME_ID_OTHER); id->type = "jbd"; - goto out; - } - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - - if ((feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS) != 0 || - (feature_incompat & EXT4_FEATURE_INCOMPAT_64BIT) != 0 || - (feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) != 0) { - id->type = "ext4"; - goto out; + goto found; } + /* has journal */ if ((feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) { + /* "use on development code" is ext4dev */ + if ((flags & EXT2_FLAGS_TEST_FILESYS) != 0) { + id->type = "ext4dev"; + goto found; + } + + /* incompatible ext3 features is ext4 */ + if ((feature_ro_compat & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) != 0 || + (feature_incompat & EXT3_FEATURE_INCOMPAT_UNSUPPORTED) != 0) { + id->type = "ext4"; + goto found; + } + id->type = "ext3"; - goto out; + goto found; + } else { + /* no incompatible ext2 feature is ext2 */ + if ((feature_ro_compat & EXT2_FEATURE_RO_COMPAT_UNSUPPORTED) == 0 && + (feature_incompat & EXT2_FEATURE_INCOMPAT_UNSUPPORTED) == 0) { + id->type = "ext2"; + goto found; + } } - id->type = "ext2"; + return -1; + +found: + volume_id_set_label_raw(id, es->s_volume_name, 16); + volume_id_set_label_string(id, es->s_volume_name, 16); + volume_id_set_uuid(id, es->s_uuid, 0, UUID_DCE); + snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", + le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level)); -out: + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); return 0; } -- cgit v1.2.3-54-g00ecf From 44d01dced113203c2c3eda7cb6e34ab8fb5c88d5 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Thu, 21 Feb 2008 12:28:45 +0100 Subject: volume_id: respect LDFLAGS --- extras/volume_id/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 499d486623..105549a946 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -83,7 +83,7 @@ libvolume_id.a: $(HEADERS) $(OBJS) $(SHLIB): $(HEADERS) exported_symbols $(addprefix .shlib/,$(OBJS)) $(E) " CC " $@ - $(Q) $(CC) -shared $(CFLAGS) -o $@ \ + $(Q) $(CC) -shared $(CFLAGS) $(LDFLAGS) -o $@ \ -Wl,-soname,libvolume_id.so.$(SHLIB_CUR),--version-script,exported_symbols \ $(addprefix .shlib/,$(OBJS)) $(Q) ln -sf $@ libvolume_id.so.$(SHLIB_CUR) -- cgit v1.2.3-54-g00ecf From 35ea39e277338192f1140492234ce993a56ecb2c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Mar 2008 15:54:21 +0100 Subject: selinux: set context for real file name not the temp name --- udev_node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev_node.c b/udev_node.c index bd58a6c485..6ca0601ea4 100644 --- a/udev_node.c +++ b/udev_node.c @@ -164,7 +164,7 @@ static int node_symlink(const char *node, const char *slink) strlcpy(slink_tmp, slink, sizeof(slink_tmp)); strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); unlink(slink_tmp); - selinux_setfscreatecon(slink_tmp, NULL, S_IFLNK); + selinux_setfscreatecon(slink, NULL, S_IFLNK); retval = symlink(target, slink_tmp); selinux_resetfscreatecon(); if (retval != 0) { -- cgit v1.2.3-54-g00ecf From 0d57399d92cfc6ff082df22ff0047e41927490d1 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 13 Mar 2008 15:57:33 +0100 Subject: rules: Fedora update --- etc/udev/redhat/40-redhat.rules | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/etc/udev/redhat/40-redhat.rules b/etc/udev/redhat/40-redhat.rules index 30da7d3bdc..446cc6d1d5 100644 --- a/etc/udev/redhat/40-redhat.rules +++ b/etc/udev/redhat/40-redhat.rules @@ -5,12 +5,10 @@ KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", SYMLINK+="flo KERNEL=="fw*", PROGRAM="fw_unit_symlinks.sh %k %n", SYMLINK+="$result" -ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="[36]", SYMLINK+="scanner scanner-%k", MODE="0660" +ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="3|6", SYMLINK+="scanner scanner-%k", MODE="0660" ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" -ACTION=="add", SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0644" - BUS=="usb", KERNEL=="sd*", ATTRS{bInterfaceClass}=="08", ATTRS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", SYMLINK+="floppy floppy-%k" KERNEL=="fd[0-9]*", SYMLINK+="floppy floppy-%k" -- cgit v1.2.3-54-g00ecf From 025d3cc960f4b8648e597f5f2cee6f89daf8ee5b Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 13 Mar 2008 15:59:02 +0100 Subject: rules: do not set GROUP="disk" for scanners --- etc/udev/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index aedc6ae8b4..d201b05608 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -66,7 +66,7 @@ KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitio KERNEL=="fd[0-9]", GROUP="floppy" KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" KERNEL=="sch[0-9]*", GROUP="disk" -KERNEL=="sg[0-9]*", GROUP="disk", MODE="0640" +KERNEL=="sg[0-9]*", ATTRS{type}!="3|6", GROUP="disk", MODE="0640" KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" -- cgit v1.2.3-54-g00ecf From 5ee7ecfb0f07e8c98c1c2b3d988191ad458cf097 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Mar 2008 16:00:25 +0100 Subject: hack to allow ATTR{block/*/uevent}="change" --- udev_rules.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/udev_rules.c b/udev_rules.c index 5ae4aa2b78..e464404b59 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -1243,6 +1244,7 @@ try_parent: if (pair->key.operation == KEY_OP_ASSIGN) { const char *key_name = key_pair_name(rule, pair); char devpath[PATH_SIZE]; + char *pos; char *attrib; char attr[PATH_SIZE] = ""; char value[NAME_SIZE]; @@ -1264,6 +1266,28 @@ try_parent: strlcat(attr, key_name, sizeof(attr)); } + pos = strstr(attr, "/*/"); + if (pos != NULL) { + char str[PATH_SIZE]; + DIR *dir; + + pos[1] = '\0'; + strlcpy(str, &pos[2], sizeof(str)); + dir = opendir(attr); + if (dir != NULL) { + struct dirent *dent; + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + strlcat(attr, dent->d_name, sizeof(attr)); + break; + } + closedir(dir); + } + strlcat(attr, str, sizeof(attr)); + } + strlcpy(value, key_val(rule, &pair->key), sizeof(value)); udev_rules_apply_format(udev, value, sizeof(value)); info("writing '%s' to sysfs file '%s'", value, attr); -- cgit v1.2.3-54-g00ecf From 9138bcba99ebf0498a43b106100cb0ffd3dc222e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Mar 2008 16:31:14 +0100 Subject: rules_generator: add KERNEL=="*" to generated rules Some boxes, like the PS3, have multiple independent hardware interfaces, all sharing the same MAC address. If they have different interface names base names, we can distinguish them that way. --- extras/rule_generator/write_net_rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index 9b66c938f3..765e56f6d3 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -102,6 +102,7 @@ if [ "$INTERFACE_NAME" ]; then else # if a rule using the current name already exists, find a new name basename=${INTERFACE%%[0-9]*} + match="$match, KERNEL==\"$basename*\"" if interface_name_taken; then INTERFACE="$basename$(find_next_available "$basename[0-9]*")" echo "INTERFACE_NEW=$INTERFACE" -- cgit v1.2.3-54-g00ecf From 58cfbcaea1e97364f932bd146958b889ba8528e5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Mar 2008 23:18:19 +0100 Subject: persistent device naming: also run on "change" event --- etc/udev/rules.d/60-persistent-input.rules | 2 +- etc/udev/rules.d/60-persistent-storage-tape.rules | 2 +- etc/udev/rules.d/60-persistent-storage.rules | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules index fbebe86244..34d5ef1557 100644 --- a/etc/udev/rules.d/60-persistent-input.rules +++ b/etc/udev/rules.d/60-persistent-input.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add", GOTO="persistent_input_end" +ACTION!="add|change", GOTO="persistent_input_end" SUBSYSTEM!="input", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" diff --git a/etc/udev/rules.d/60-persistent-storage-tape.rules b/etc/udev/rules.d/60-persistent-storage-tape.rules index d2dbc71c60..9c68fdf1a1 100644 --- a/etc/udev/rules.d/60-persistent-storage-tape.rules +++ b/etc/udev/rules.d/60-persistent-storage-tape.rules @@ -2,7 +2,7 @@ # persistent storage links: /dev/tape/{by-id,by-path} -ACTION!="add", GOTO="persistent_storage_tape_end" +ACTION!="add|change", GOTO="persistent_storage_tape_end" KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 68fe59fd95..990703cef3 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -3,7 +3,7 @@ # persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} # scheme based on "Linux persistent device names", 2004, Hannes Reinecke -ACTION!="add", GOTO="persistent_storage_end" +ACTION!="add|change", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -- cgit v1.2.3-54-g00ecf From caea9fcf56126c4415c66969fae5fcf4cbcd6a65 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Mar 2008 23:19:12 +0100 Subject: test: add "subsystem" links to all devices --- test/sys/block/sda/sda1/subsystem | 1 + test/sys/block/sda/sda2/subsystem | 1 + test/sys/block/sda/sda3/subsystem | 1 + test/sys/block/sda/sda4/subsystem | 1 + test/sys/block/sda/subsystem | 1 + test/sys/class/i2c-dev/i2c-300/subsystem | 1 + test/sys/class/i2c-dev/i2c-fake1/subsystem | 1 + test/sys/class/i2c-dev/i2c-fake2/subsystem | 1 + test/sys/class/mem/full/subsystem | 1 + test/sys/class/mem/kmem/subsystem | 1 + test/sys/class/mem/kmsg/subsystem | 1 + test/sys/class/mem/mem/subsystem | 1 + test/sys/class/mem/null/subsystem | 1 + test/sys/class/mem/port/subsystem | 1 + test/sys/class/mem/random/subsystem | 1 + test/sys/class/mem/urandom/subsystem | 1 + test/sys/class/mem/zero/subsystem | 1 + test/sys/class/misc/psaux/subsystem | 1 + test/sys/class/misc/rtc/subsystem | 1 + test/sys/class/misc/uinput/subsystem | 1 + test/sys/class/net/eth0/subsystem | 1 + test/sys/class/net/eth1/subsystem | 1 + test/sys/class/net/lo/subsystem | 1 + test/sys/class/tty/console/subsystem | 1 + test/sys/class/tty/ptmx/subsystem | 1 + test/sys/class/tty/tty/subsystem | 1 + test/sys/class/tty/tty0/subsystem | 1 + test/sys/class/tty/tty1/subsystem | 1 + test/sys/class/tty/tty10/subsystem | 1 + test/sys/class/tty/tty11/subsystem | 1 + test/sys/class/tty/tty12/subsystem | 1 + test/sys/class/tty/tty13/subsystem | 1 + test/sys/class/tty/tty14/subsystem | 1 + test/sys/class/tty/tty15/subsystem | 1 + test/sys/class/tty/tty16/subsystem | 1 + test/sys/class/tty/tty17/subsystem | 1 + test/sys/class/tty/tty18/subsystem | 1 + test/sys/class/tty/tty19/subsystem | 1 + test/sys/class/tty/tty2/subsystem | 1 + test/sys/class/tty/tty20/subsystem | 1 + test/sys/class/tty/tty21/subsystem | 1 + test/sys/class/tty/tty22/subsystem | 1 + test/sys/class/tty/tty23/subsystem | 1 + test/sys/class/tty/tty24/subsystem | 1 + test/sys/class/tty/tty25/subsystem | 1 + test/sys/class/tty/tty26/subsystem | 1 + test/sys/class/tty/tty27/subsystem | 1 + test/sys/class/tty/tty28/subsystem | 1 + test/sys/class/tty/tty29/subsystem | 1 + test/sys/class/tty/tty3/subsystem | 1 + test/sys/class/tty/tty30/subsystem | 1 + test/sys/class/tty/tty31/subsystem | 1 + test/sys/class/tty/tty32/subsystem | 1 + test/sys/class/tty/tty33/subsystem | 1 + test/sys/class/tty/tty34/subsystem | 1 + test/sys/class/tty/tty35/subsystem | 1 + test/sys/class/tty/tty36/subsystem | 1 + test/sys/class/tty/tty37/subsystem | 1 + test/sys/class/tty/tty38/subsystem | 1 + test/sys/class/tty/tty39/subsystem | 1 + test/sys/class/tty/tty4/subsystem | 1 + test/sys/class/tty/tty40/subsystem | 1 + test/sys/class/tty/tty41/subsystem | 1 + test/sys/class/tty/tty42/subsystem | 1 + test/sys/class/tty/tty43/subsystem | 1 + test/sys/class/tty/tty44/subsystem | 1 + test/sys/class/tty/tty45/subsystem | 1 + test/sys/class/tty/tty46/subsystem | 1 + test/sys/class/tty/tty47/subsystem | 1 + test/sys/class/tty/tty48/subsystem | 1 + test/sys/class/tty/tty49/subsystem | 1 + test/sys/class/tty/tty5/subsystem | 1 + test/sys/class/tty/tty50/subsystem | 1 + test/sys/class/tty/tty51/subsystem | 1 + test/sys/class/tty/tty52/subsystem | 1 + test/sys/class/tty/tty53/subsystem | 1 + test/sys/class/tty/tty54/subsystem | 1 + test/sys/class/tty/tty55/subsystem | 1 + test/sys/class/tty/tty56/subsystem | 1 + test/sys/class/tty/tty57/subsystem | 1 + test/sys/class/tty/tty58/subsystem | 1 + test/sys/class/tty/tty59/subsystem | 1 + test/sys/class/tty/tty6/subsystem | 1 + test/sys/class/tty/tty60/subsystem | 1 + test/sys/class/tty/tty61/subsystem | 1 + test/sys/class/tty/tty62/subsystem | 1 + test/sys/class/tty/tty63/subsystem | 1 + test/sys/class/tty/tty7/subsystem | 1 + test/sys/class/tty/tty8/subsystem | 1 + test/sys/class/tty/tty9/subsystem | 1 + test/sys/class/tty/ttyS0/subsystem | 1 + test/sys/class/tty/ttyS1/subsystem | 1 + test/sys/class/tty/ttyS2/subsystem | 1 + test/sys/class/tty/ttyS3/subsystem | 1 + test/sys/class/tty/ttyS4/subsystem | 1 + test/sys/class/tty/ttyS5/subsystem | 1 + test/sys/class/tty/ttyS6/subsystem | 1 + test/sys/class/tty/ttyS7/subsystem | 1 + test/sys/class/tty/ttyUSB0/subsystem | 1 + test/sys/devices/pci0000:00/0000:00:09.0/bus | 1 - test/sys/devices/pci0000:00/0000:00:09.0/subsystem | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/subsystem | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/subsystem | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/subsystem | 1 + test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus | 1 - test/sys/devices/pci0000:00/0000:00:09.0/usb3/subsystem | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus | 1 - .../0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/subsystem | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/bus | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/subsystem | 1 + 117 files changed, 108 insertions(+), 9 deletions(-) create mode 120000 test/sys/block/sda/sda1/subsystem create mode 120000 test/sys/block/sda/sda2/subsystem create mode 120000 test/sys/block/sda/sda3/subsystem create mode 120000 test/sys/block/sda/sda4/subsystem create mode 120000 test/sys/block/sda/subsystem create mode 120000 test/sys/class/i2c-dev/i2c-300/subsystem create mode 120000 test/sys/class/i2c-dev/i2c-fake1/subsystem create mode 120000 test/sys/class/i2c-dev/i2c-fake2/subsystem create mode 120000 test/sys/class/mem/full/subsystem create mode 120000 test/sys/class/mem/kmem/subsystem create mode 120000 test/sys/class/mem/kmsg/subsystem create mode 120000 test/sys/class/mem/mem/subsystem create mode 120000 test/sys/class/mem/null/subsystem create mode 120000 test/sys/class/mem/port/subsystem create mode 120000 test/sys/class/mem/random/subsystem create mode 120000 test/sys/class/mem/urandom/subsystem create mode 120000 test/sys/class/mem/zero/subsystem create mode 120000 test/sys/class/misc/psaux/subsystem create mode 120000 test/sys/class/misc/rtc/subsystem create mode 120000 test/sys/class/misc/uinput/subsystem create mode 120000 test/sys/class/net/eth0/subsystem create mode 120000 test/sys/class/net/eth1/subsystem create mode 120000 test/sys/class/net/lo/subsystem create mode 120000 test/sys/class/tty/console/subsystem create mode 120000 test/sys/class/tty/ptmx/subsystem create mode 120000 test/sys/class/tty/tty/subsystem create mode 120000 test/sys/class/tty/tty0/subsystem create mode 120000 test/sys/class/tty/tty1/subsystem create mode 120000 test/sys/class/tty/tty10/subsystem create mode 120000 test/sys/class/tty/tty11/subsystem create mode 120000 test/sys/class/tty/tty12/subsystem create mode 120000 test/sys/class/tty/tty13/subsystem create mode 120000 test/sys/class/tty/tty14/subsystem create mode 120000 test/sys/class/tty/tty15/subsystem create mode 120000 test/sys/class/tty/tty16/subsystem create mode 120000 test/sys/class/tty/tty17/subsystem create mode 120000 test/sys/class/tty/tty18/subsystem create mode 120000 test/sys/class/tty/tty19/subsystem create mode 120000 test/sys/class/tty/tty2/subsystem create mode 120000 test/sys/class/tty/tty20/subsystem create mode 120000 test/sys/class/tty/tty21/subsystem create mode 120000 test/sys/class/tty/tty22/subsystem create mode 120000 test/sys/class/tty/tty23/subsystem create mode 120000 test/sys/class/tty/tty24/subsystem create mode 120000 test/sys/class/tty/tty25/subsystem create mode 120000 test/sys/class/tty/tty26/subsystem create mode 120000 test/sys/class/tty/tty27/subsystem create mode 120000 test/sys/class/tty/tty28/subsystem create mode 120000 test/sys/class/tty/tty29/subsystem create mode 120000 test/sys/class/tty/tty3/subsystem create mode 120000 test/sys/class/tty/tty30/subsystem create mode 120000 test/sys/class/tty/tty31/subsystem create mode 120000 test/sys/class/tty/tty32/subsystem create mode 120000 test/sys/class/tty/tty33/subsystem create mode 120000 test/sys/class/tty/tty34/subsystem create mode 120000 test/sys/class/tty/tty35/subsystem create mode 120000 test/sys/class/tty/tty36/subsystem create mode 120000 test/sys/class/tty/tty37/subsystem create mode 120000 test/sys/class/tty/tty38/subsystem create mode 120000 test/sys/class/tty/tty39/subsystem create mode 120000 test/sys/class/tty/tty4/subsystem create mode 120000 test/sys/class/tty/tty40/subsystem create mode 120000 test/sys/class/tty/tty41/subsystem create mode 120000 test/sys/class/tty/tty42/subsystem create mode 120000 test/sys/class/tty/tty43/subsystem create mode 120000 test/sys/class/tty/tty44/subsystem create mode 120000 test/sys/class/tty/tty45/subsystem create mode 120000 test/sys/class/tty/tty46/subsystem create mode 120000 test/sys/class/tty/tty47/subsystem create mode 120000 test/sys/class/tty/tty48/subsystem create mode 120000 test/sys/class/tty/tty49/subsystem create mode 120000 test/sys/class/tty/tty5/subsystem create mode 120000 test/sys/class/tty/tty50/subsystem create mode 120000 test/sys/class/tty/tty51/subsystem create mode 120000 test/sys/class/tty/tty52/subsystem create mode 120000 test/sys/class/tty/tty53/subsystem create mode 120000 test/sys/class/tty/tty54/subsystem create mode 120000 test/sys/class/tty/tty55/subsystem create mode 120000 test/sys/class/tty/tty56/subsystem create mode 120000 test/sys/class/tty/tty57/subsystem create mode 120000 test/sys/class/tty/tty58/subsystem create mode 120000 test/sys/class/tty/tty59/subsystem create mode 120000 test/sys/class/tty/tty6/subsystem create mode 120000 test/sys/class/tty/tty60/subsystem create mode 120000 test/sys/class/tty/tty61/subsystem create mode 120000 test/sys/class/tty/tty62/subsystem create mode 120000 test/sys/class/tty/tty63/subsystem create mode 120000 test/sys/class/tty/tty7/subsystem create mode 120000 test/sys/class/tty/tty8/subsystem create mode 120000 test/sys/class/tty/tty9/subsystem create mode 120000 test/sys/class/tty/ttyS0/subsystem create mode 120000 test/sys/class/tty/ttyS1/subsystem create mode 120000 test/sys/class/tty/ttyS2/subsystem create mode 120000 test/sys/class/tty/ttyS3/subsystem create mode 120000 test/sys/class/tty/ttyS4/subsystem create mode 120000 test/sys/class/tty/ttyS5/subsystem create mode 120000 test/sys/class/tty/ttyS6/subsystem create mode 120000 test/sys/class/tty/ttyS7/subsystem create mode 120000 test/sys/class/tty/ttyUSB0/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/subsystem create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/bus create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/subsystem diff --git a/test/sys/block/sda/sda1/subsystem b/test/sys/block/sda/sda1/subsystem new file mode 120000 index 0000000000..bc3873f9ee --- /dev/null +++ b/test/sys/block/sda/sda1/subsystem @@ -0,0 +1 @@ +../../../block \ No newline at end of file diff --git a/test/sys/block/sda/sda2/subsystem b/test/sys/block/sda/sda2/subsystem new file mode 120000 index 0000000000..bc3873f9ee --- /dev/null +++ b/test/sys/block/sda/sda2/subsystem @@ -0,0 +1 @@ +../../../block \ No newline at end of file diff --git a/test/sys/block/sda/sda3/subsystem b/test/sys/block/sda/sda3/subsystem new file mode 120000 index 0000000000..bc3873f9ee --- /dev/null +++ b/test/sys/block/sda/sda3/subsystem @@ -0,0 +1 @@ +../../../block \ No newline at end of file diff --git a/test/sys/block/sda/sda4/subsystem b/test/sys/block/sda/sda4/subsystem new file mode 120000 index 0000000000..bc3873f9ee --- /dev/null +++ b/test/sys/block/sda/sda4/subsystem @@ -0,0 +1 @@ +../../../block \ No newline at end of file diff --git a/test/sys/block/sda/subsystem b/test/sys/block/sda/subsystem new file mode 120000 index 0000000000..f33eb2721f --- /dev/null +++ b/test/sys/block/sda/subsystem @@ -0,0 +1 @@ +../../block \ No newline at end of file diff --git a/test/sys/class/i2c-dev/i2c-300/subsystem b/test/sys/class/i2c-dev/i2c-300/subsystem new file mode 120000 index 0000000000..5545800cc7 --- /dev/null +++ b/test/sys/class/i2c-dev/i2c-300/subsystem @@ -0,0 +1 @@ +../../i2c-dev \ No newline at end of file diff --git a/test/sys/class/i2c-dev/i2c-fake1/subsystem b/test/sys/class/i2c-dev/i2c-fake1/subsystem new file mode 120000 index 0000000000..5545800cc7 --- /dev/null +++ b/test/sys/class/i2c-dev/i2c-fake1/subsystem @@ -0,0 +1 @@ +../../i2c-dev \ No newline at end of file diff --git a/test/sys/class/i2c-dev/i2c-fake2/subsystem b/test/sys/class/i2c-dev/i2c-fake2/subsystem new file mode 120000 index 0000000000..5545800cc7 --- /dev/null +++ b/test/sys/class/i2c-dev/i2c-fake2/subsystem @@ -0,0 +1 @@ +../../i2c-dev \ No newline at end of file diff --git a/test/sys/class/mem/full/subsystem b/test/sys/class/mem/full/subsystem new file mode 120000 index 0000000000..142e1f4ba7 --- /dev/null +++ b/test/sys/class/mem/full/subsystem @@ -0,0 +1 @@ +../../mem \ No newline at end of file diff --git a/test/sys/class/mem/kmem/subsystem b/test/sys/class/mem/kmem/subsystem new file mode 120000 index 0000000000..142e1f4ba7 --- /dev/null +++ b/test/sys/class/mem/kmem/subsystem @@ -0,0 +1 @@ +../../mem \ No newline at end of file diff --git a/test/sys/class/mem/kmsg/subsystem b/test/sys/class/mem/kmsg/subsystem new file mode 120000 index 0000000000..142e1f4ba7 --- /dev/null +++ b/test/sys/class/mem/kmsg/subsystem @@ -0,0 +1 @@ +../../mem \ No newline at end of file diff --git a/test/sys/class/mem/mem/subsystem b/test/sys/class/mem/mem/subsystem new file mode 120000 index 0000000000..142e1f4ba7 --- /dev/null +++ b/test/sys/class/mem/mem/subsystem @@ -0,0 +1 @@ +../../mem \ No newline at end of file diff --git a/test/sys/class/mem/null/subsystem b/test/sys/class/mem/null/subsystem new file mode 120000 index 0000000000..142e1f4ba7 --- /dev/null +++ b/test/sys/class/mem/null/subsystem @@ -0,0 +1 @@ +../../mem \ No newline at end of file diff --git a/test/sys/class/mem/port/subsystem b/test/sys/class/mem/port/subsystem new file mode 120000 index 0000000000..142e1f4ba7 --- /dev/null +++ b/test/sys/class/mem/port/subsystem @@ -0,0 +1 @@ +../../mem \ No newline at end of file diff --git a/test/sys/class/mem/random/subsystem b/test/sys/class/mem/random/subsystem new file mode 120000 index 0000000000..142e1f4ba7 --- /dev/null +++ b/test/sys/class/mem/random/subsystem @@ -0,0 +1 @@ +../../mem \ No newline at end of file diff --git a/test/sys/class/mem/urandom/subsystem b/test/sys/class/mem/urandom/subsystem new file mode 120000 index 0000000000..142e1f4ba7 --- /dev/null +++ b/test/sys/class/mem/urandom/subsystem @@ -0,0 +1 @@ +../../mem \ No newline at end of file diff --git a/test/sys/class/mem/zero/subsystem b/test/sys/class/mem/zero/subsystem new file mode 120000 index 0000000000..142e1f4ba7 --- /dev/null +++ b/test/sys/class/mem/zero/subsystem @@ -0,0 +1 @@ +../../mem \ No newline at end of file diff --git a/test/sys/class/misc/psaux/subsystem b/test/sys/class/misc/psaux/subsystem new file mode 120000 index 0000000000..2825552c9b --- /dev/null +++ b/test/sys/class/misc/psaux/subsystem @@ -0,0 +1 @@ +../../misc \ No newline at end of file diff --git a/test/sys/class/misc/rtc/subsystem b/test/sys/class/misc/rtc/subsystem new file mode 120000 index 0000000000..2825552c9b --- /dev/null +++ b/test/sys/class/misc/rtc/subsystem @@ -0,0 +1 @@ +../../misc \ No newline at end of file diff --git a/test/sys/class/misc/uinput/subsystem b/test/sys/class/misc/uinput/subsystem new file mode 120000 index 0000000000..2825552c9b --- /dev/null +++ b/test/sys/class/misc/uinput/subsystem @@ -0,0 +1 @@ +../../misc \ No newline at end of file diff --git a/test/sys/class/net/eth0/subsystem b/test/sys/class/net/eth0/subsystem new file mode 120000 index 0000000000..f138bf38f8 --- /dev/null +++ b/test/sys/class/net/eth0/subsystem @@ -0,0 +1 @@ +../../net \ No newline at end of file diff --git a/test/sys/class/net/eth1/subsystem b/test/sys/class/net/eth1/subsystem new file mode 120000 index 0000000000..f138bf38f8 --- /dev/null +++ b/test/sys/class/net/eth1/subsystem @@ -0,0 +1 @@ +../../net \ No newline at end of file diff --git a/test/sys/class/net/lo/subsystem b/test/sys/class/net/lo/subsystem new file mode 120000 index 0000000000..f138bf38f8 --- /dev/null +++ b/test/sys/class/net/lo/subsystem @@ -0,0 +1 @@ +../../net \ No newline at end of file diff --git a/test/sys/class/tty/console/subsystem b/test/sys/class/tty/console/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/console/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ptmx/subsystem b/test/sys/class/tty/ptmx/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ptmx/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty/subsystem b/test/sys/class/tty/tty/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty0/subsystem b/test/sys/class/tty/tty0/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty0/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty1/subsystem b/test/sys/class/tty/tty1/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty1/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty10/subsystem b/test/sys/class/tty/tty10/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty10/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty11/subsystem b/test/sys/class/tty/tty11/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty11/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty12/subsystem b/test/sys/class/tty/tty12/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty12/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty13/subsystem b/test/sys/class/tty/tty13/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty13/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty14/subsystem b/test/sys/class/tty/tty14/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty14/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty15/subsystem b/test/sys/class/tty/tty15/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty15/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty16/subsystem b/test/sys/class/tty/tty16/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty16/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty17/subsystem b/test/sys/class/tty/tty17/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty17/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty18/subsystem b/test/sys/class/tty/tty18/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty18/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty19/subsystem b/test/sys/class/tty/tty19/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty19/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty2/subsystem b/test/sys/class/tty/tty2/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty2/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty20/subsystem b/test/sys/class/tty/tty20/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty20/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty21/subsystem b/test/sys/class/tty/tty21/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty21/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty22/subsystem b/test/sys/class/tty/tty22/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty22/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty23/subsystem b/test/sys/class/tty/tty23/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty23/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty24/subsystem b/test/sys/class/tty/tty24/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty24/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty25/subsystem b/test/sys/class/tty/tty25/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty25/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty26/subsystem b/test/sys/class/tty/tty26/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty26/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty27/subsystem b/test/sys/class/tty/tty27/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty27/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty28/subsystem b/test/sys/class/tty/tty28/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty28/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty29/subsystem b/test/sys/class/tty/tty29/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty29/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty3/subsystem b/test/sys/class/tty/tty3/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty3/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty30/subsystem b/test/sys/class/tty/tty30/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty30/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty31/subsystem b/test/sys/class/tty/tty31/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty31/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty32/subsystem b/test/sys/class/tty/tty32/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty32/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty33/subsystem b/test/sys/class/tty/tty33/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty33/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty34/subsystem b/test/sys/class/tty/tty34/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty34/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty35/subsystem b/test/sys/class/tty/tty35/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty35/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty36/subsystem b/test/sys/class/tty/tty36/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty36/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty37/subsystem b/test/sys/class/tty/tty37/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty37/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty38/subsystem b/test/sys/class/tty/tty38/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty38/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty39/subsystem b/test/sys/class/tty/tty39/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty39/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty4/subsystem b/test/sys/class/tty/tty4/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty4/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty40/subsystem b/test/sys/class/tty/tty40/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty40/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty41/subsystem b/test/sys/class/tty/tty41/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty41/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty42/subsystem b/test/sys/class/tty/tty42/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty42/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty43/subsystem b/test/sys/class/tty/tty43/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty43/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty44/subsystem b/test/sys/class/tty/tty44/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty44/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty45/subsystem b/test/sys/class/tty/tty45/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty45/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty46/subsystem b/test/sys/class/tty/tty46/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty46/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty47/subsystem b/test/sys/class/tty/tty47/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty47/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty48/subsystem b/test/sys/class/tty/tty48/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty48/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty49/subsystem b/test/sys/class/tty/tty49/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty49/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty5/subsystem b/test/sys/class/tty/tty5/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty5/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty50/subsystem b/test/sys/class/tty/tty50/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty50/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty51/subsystem b/test/sys/class/tty/tty51/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty51/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty52/subsystem b/test/sys/class/tty/tty52/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty52/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty53/subsystem b/test/sys/class/tty/tty53/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty53/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty54/subsystem b/test/sys/class/tty/tty54/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty54/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty55/subsystem b/test/sys/class/tty/tty55/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty55/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty56/subsystem b/test/sys/class/tty/tty56/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty56/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty57/subsystem b/test/sys/class/tty/tty57/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty57/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty58/subsystem b/test/sys/class/tty/tty58/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty58/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty59/subsystem b/test/sys/class/tty/tty59/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty59/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty6/subsystem b/test/sys/class/tty/tty6/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty6/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty60/subsystem b/test/sys/class/tty/tty60/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty60/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty61/subsystem b/test/sys/class/tty/tty61/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty61/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty62/subsystem b/test/sys/class/tty/tty62/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty62/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty63/subsystem b/test/sys/class/tty/tty63/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty63/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty7/subsystem b/test/sys/class/tty/tty7/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty7/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty8/subsystem b/test/sys/class/tty/tty8/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty8/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty9/subsystem b/test/sys/class/tty/tty9/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/tty9/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS0/subsystem b/test/sys/class/tty/ttyS0/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ttyS0/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS1/subsystem b/test/sys/class/tty/ttyS1/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ttyS1/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS2/subsystem b/test/sys/class/tty/ttyS2/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ttyS2/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS3/subsystem b/test/sys/class/tty/ttyS3/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ttyS3/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS4/subsystem b/test/sys/class/tty/ttyS4/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ttyS4/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS5/subsystem b/test/sys/class/tty/ttyS5/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ttyS5/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS6/subsystem b/test/sys/class/tty/ttyS6/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ttyS6/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS7/subsystem b/test/sys/class/tty/ttyS7/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ttyS7/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyUSB0/subsystem b/test/sys/class/tty/ttyUSB0/subsystem new file mode 120000 index 0000000000..31a1be456d --- /dev/null +++ b/test/sys/class/tty/ttyUSB0/subsystem @@ -0,0 +1 @@ +../../tty \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/bus b/test/sys/devices/pci0000:00/0000:00:09.0/bus deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/bus +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bus +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bus +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bus +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus deleted file mode 120000 index dd0c04b01d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/bus +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb-serial \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/subsystem new file mode 120000 index 0000000000..dd0c04b01d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb-serial \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus deleted file mode 120000 index 77682faf80..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bus +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/subsystem new file mode 120000 index 0000000000..77682faf80 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/subsystem @@ -0,0 +1 @@ +../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus deleted file mode 120000 index d6210992bb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/bus +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus deleted file mode 120000 index 2edcea4660..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/bus +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/subsystem new file mode 120000 index 0000000000..2edcea4660 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem new file mode 120000 index 0000000000..d6210992bb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem @@ -0,0 +1 @@ +../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/bus b/test/sys/devices/pci0000:00/0000:00:1e.0/bus deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/bus +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file -- cgit v1.2.3-54-g00ecf From 544c2923dbe2822f38b6caa31fef3f1fbf501db3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Mar 2008 23:32:45 +0100 Subject: sysfs: depend on "subsystem" link --- udev_sysfs.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/udev_sysfs.c b/udev_sysfs.c index e8909f94f1..9293305b81 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -220,29 +220,6 @@ struct sysfs_device *sysfs_device_get(const char *devpath) pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/class/", 7) == 0) { - /* get subsystem from class dir */ - strlcpy(dev->subsystem, &dev->devpath[7], sizeof(dev->subsystem)); - pos = strchr(dev->subsystem, '/'); - if (pos != NULL) - pos[0] = '\0'; - else - strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/block/", 7) == 0) { - strlcpy(dev->subsystem, "block", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/devices/", 9) == 0) { - /* get subsystem from "bus" link */ - strlcpy(link_path, sysfs_path, sizeof(link_path)); - strlcat(link_path, dev->devpath, sizeof(link_path)); - strlcat(link_path, "/bus", sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len > 0) { - link_target[len] = '\0'; - dbg("bus link '%s' points to '%s'", link_path, link_target); - pos = strrchr(link_target, '/'); - if (pos != NULL) - strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); - } } else if (strstr(dev->devpath, "/drivers/") != NULL) { strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/module/", 8) == 0) { @@ -251,6 +228,10 @@ struct sysfs_device *sysfs_device_get(const char *devpath) pos = strrchr(dev->devpath, '/'); if (pos == &dev->devpath[10]) strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); + } else if (strncmp(dev->devpath, "/class/", 7) == 0) { + pos = strrchr(dev->devpath, '/'); + if (pos == &dev->devpath[6]) + strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/bus/", 5) == 0) { pos = strrchr(dev->devpath, '/'); if (pos == &dev->devpath[4]) -- cgit v1.2.3-54-g00ecf From 0ea5e96edbc66319d7711d9eab8719a2c98c843d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Mar 2008 23:40:06 +0100 Subject: extend hack to allow TEST=="*/start" --- test/udev-test.pl | 9 ++++++++ udev_rules.c | 63 ++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 50 insertions(+), 22 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index fe1c6da4f9..2621e2b13a 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1596,6 +1596,15 @@ EOF exp_name => "relative", rules => < "TEST wildcard substitution (find queue/nr_requests)", + subsys => "block", + devpath => "/block/sda", + exp_name => "found-subdir", + rules => <d_name[0] == '.') + continue; + strlcat(attr, dent->d_name, len); + strlcat(attr, str, len); + if (stat(attr, &stats) == 0) { + found = 1; + break; + } + pos[1] = '\0'; + } + closedir(dir); + } + if (!found) + strlcat(attr, str, len); + } + + return found; +} + void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) { char temp[PATH_SIZE]; @@ -1023,6 +1061,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) strlcpy(filename, tmp, sizeof(filename)); } + attr_subst_subdir(filename, sizeof(filename)); + match = (stat(filename, &statbuf) == 0); info("'%s' %s", filename, match ? "exists" : "does not exist"); if (match && rule->test_mode_mask > 0) { @@ -1244,7 +1284,6 @@ try_parent: if (pair->key.operation == KEY_OP_ASSIGN) { const char *key_name = key_pair_name(rule, pair); char devpath[PATH_SIZE]; - char *pos; char *attrib; char attr[PATH_SIZE] = ""; char value[NAME_SIZE]; @@ -1266,27 +1305,7 @@ try_parent: strlcat(attr, key_name, sizeof(attr)); } - pos = strstr(attr, "/*/"); - if (pos != NULL) { - char str[PATH_SIZE]; - DIR *dir; - - pos[1] = '\0'; - strlcpy(str, &pos[2], sizeof(str)); - dir = opendir(attr); - if (dir != NULL) { - struct dirent *dent; - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - if (dent->d_name[0] == '.') - continue; - strlcat(attr, dent->d_name, sizeof(attr)); - break; - } - closedir(dir); - } - strlcat(attr, str, sizeof(attr)); - } + attr_subst_subdir(attr, sizeof(attr)); strlcpy(value, key_val(rule, &pair->key), sizeof(value)); udev_rules_apply_format(udev, value, sizeof(value)); -- cgit v1.2.3-54-g00ecf From 064360cde8f35d8ac6faf418ddfa39b9f3da4347 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sat, 15 Mar 2008 00:02:39 +0100 Subject: Makefile: do not require GNU install --- Makefile | 16 +++++++++------- extras/ata_id/Makefile | 4 +++- extras/cdrom_id/Makefile | 9 ++++++--- extras/collect/Makefile | 3 ++- extras/edd_id/Makefile | 9 ++++++--- extras/firmware/Makefile | 3 ++- extras/floppy/Makefile | 6 ++++-- extras/path_id/Makefile | 6 ++++-- extras/rule_generator/Makefile | 12 +++++++----- extras/scsi_id/Makefile | 12 ++++++++---- extras/usb_id/Makefile | 3 ++- extras/volume_id/Makefile | 6 ++++-- extras/volume_id/lib/Makefile | 11 +++++++---- 13 files changed, 64 insertions(+), 36 deletions(-) diff --git a/Makefile b/Makefile index 6c7f139e2c..2fcc4247fa 100644 --- a/Makefile +++ b/Makefile @@ -236,9 +236,11 @@ install-config: .PHONY: install-config install-man: - $(INSTALL_DATA) -D udev.7 $(DESTDIR)$(mandir)/man7/udev.7 - $(INSTALL_DATA) -D udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 - $(INSTALL_DATA) -D udevadm.8 $(DESTDIR)$(mandir)/man8/udevadm.8 + $(INSTALL) -d $(DESTDIR)$(mandir)/man7 + $(INSTALL_DATA) udev.7 $(DESTDIR)$(mandir)/man7/udev.7 + $(INSTALL) -d $(DESTDIR)$(mandir)/man8 + $(INSTALL_DATA) udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 + $(INSTALL_DATA) udevadm.8 $(DESTDIR)$(mandir)/man8/udevadm.8 ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevtest.8 ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevtrigger.8 @@ -266,13 +268,13 @@ uninstall-man: .PHONY: uninstall-man install-bin: - $(INSTALL) -d $(DESTDIR)$(udevdir) - $(INSTALL_PROGRAM) -D udevd $(DESTDIR)$(sbindir)/udevd - $(INSTALL_PROGRAM) -D udevadm $(DESTDIR)$(sbindir)/udevadm + $(INSTALL) -d $(DESTDIR)$(sbindir) + $(INSTALL_PROGRAM) udevd $(DESTDIR)$(sbindir)/udevd + $(INSTALL_PROGRAM) udevadm $(DESTDIR)$(sbindir)/udevadm ln -f -s udevadm $(DESTDIR)$(sbindir)/udevtrigger ln -f -s udevadm $(DESTDIR)$(sbindir)/udevsettle ln -f -s udevadm $(DESTDIR)$(sbindir)/udevcontrol - mkdir -p -m 0755 $(DESTDIR)$(usrsbindir) + $(INSTALL) -d $(DESTDIR)$(usrsbindir) ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrsbindir)/udevmonitor mkdir -p -m 0755 $(DESTDIR)$(usrbindir) ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrbindir)/udevinfo diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile index c9691da1e2..bab49a250d 100644 --- a/extras/ata_id/Makefile +++ b/extras/ata_id/Makefile @@ -49,7 +49,8 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: @@ -57,6 +58,7 @@ uninstall-bin: .PHONY: uninstall-bin install-man: + $(INSTALL) -d $(DESTDIR)$(mandir)/man8 $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: install-man diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index 7cd7c1d74a..caab2beaf5 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -49,8 +49,10 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - $(INSTALL_DATA) -D 60-cdrom_id.rules $(DESTDIR)$(configdir)/rules.d/60-cdrom_id.rules + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d + $(INSTALL_DATA) 60-cdrom_id.rules $(DESTDIR)$(configdir)/rules.d/60-cdrom_id.rules .PHONY: install-bin uninstall-bin: @@ -59,7 +61,8 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 + $(INSTALL) -d $(DESTDIR)$(mandir)/man8 + $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: install-man uninstall-man: diff --git a/extras/collect/Makefile b/extras/collect/Makefile index 6168a8b805..76487017dd 100644 --- a/extras/collect/Makefile +++ b/extras/collect/Makefile @@ -44,7 +44,8 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index f52c3bc3f0..f17a5b8c65 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -49,8 +49,10 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - $(INSTALL_DATA) -D 61-persistent-storage-edd.rules $(DESTDIR)$(configdir)/rules.d/61-persistent-storage-edd.rules + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d/ + $(INSTALL_DATA) 61-persistent-storage-edd.rules $(DESTDIR)$(configdir)/rules.d/61-persistent-storage-edd.rules .PHONY: install-bin uninstall-bin: @@ -59,7 +61,8 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 + $(INSTALL) -d $(DESTDIR)$(mandir)/man8 + $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: install-man uninstall-man: diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile index c187b47635..5e84acb156 100644 --- a/extras/firmware/Makefile +++ b/extras/firmware/Makefile @@ -37,7 +37,8 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_SCRIPT) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_SCRIPT) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile index 784464a843..0adc373c94 100644 --- a/extras/floppy/Makefile +++ b/extras/floppy/Makefile @@ -49,7 +49,8 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: @@ -57,7 +58,8 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 + $(INSTALL) -d $(DESTDIR)$(mandir)/man8/ + $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: install-man uninstall-man: diff --git a/extras/path_id/Makefile b/extras/path_id/Makefile index d8efe64187..2f0b882e65 100644 --- a/extras/path_id/Makefile +++ b/extras/path_id/Makefile @@ -37,7 +37,8 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_SCRIPT) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_SCRIPT) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: @@ -45,7 +46,8 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 + $(INSTALL) -d $(DESTDIR)$(mandir)/man8/ + $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: install-man uninstall-man: diff --git a/extras/rule_generator/Makefile b/extras/rule_generator/Makefile index cc6fe056c6..d6f1265eb9 100644 --- a/extras/rule_generator/Makefile +++ b/extras/rule_generator/Makefile @@ -37,12 +37,14 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_DATA) -D rule_generator.functions $(DESTDIR)$(libudevdir)/rule_generator.functions - $(INSTALL_SCRIPT) -D write_cd_rules $(DESTDIR)$(libudevdir)/write_cd_rules - $(INSTALL_SCRIPT) -D write_net_rules $(DESTDIR)$(libudevdir)/write_net_rules - $(INSTALL_DATA) -D 75-cd-aliases-generator.rules \ + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_DATA) rule_generator.functions $(DESTDIR)$(libudevdir)/rule_generator.functions + $(INSTALL_SCRIPT) write_cd_rules $(DESTDIR)$(libudevdir)/write_cd_rules + $(INSTALL_SCRIPT) write_net_rules $(DESTDIR)$(libudevdir)/write_net_rules + $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d + $(INSTALL_DATA) 75-cd-aliases-generator.rules \ $(DESTDIR)$(configdir)/rules.d/75-cd-aliases-generator.rules - $(INSTALL_DATA) -D 75-persistent-net-generator.rules \ + $(INSTALL_DATA) 75-persistent-net-generator.rules \ $(DESTDIR)$(configdir)/rules.d/75-persistent-net-generator.rules .PHONY: install-bin diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 349eeef1de..870296a666 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -58,7 +58,8 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: @@ -66,7 +67,8 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - $(INSTALL_DATA) -D scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 + $(INSTALL) -d $(DESTDIR)$(mandir)/man8 + $(INSTALL_DATA) scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 .PHONY: install-man uninstall-man: @@ -75,8 +77,10 @@ uninstall-man: install-config: @ if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \ - echo $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir); \ - $(INSTALL_DATA) -D ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \ + echo $(INSTALL) -d $(DESTDIR)$(etcdir); \ + echo $(INSTALL_DATA) ./scsi_id.config $(DESTDIR)$(etcdir); \ + $(INSTALL) -d $(DESTDIR)$(etcdir); \ + $(INSTALL_DATA) ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \ fi .PHONY: install-config diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile index 7787161b63..09496049a5 100644 --- a/extras/usb_id/Makefile +++ b/extras/usb_id/Makefile @@ -49,7 +49,8 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) .PHONY: install-bin uninstall-bin: diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile index 6e5006594a..50d5e338c2 100644 --- a/extras/volume_id/Makefile +++ b/extras/volume_id/Makefile @@ -60,7 +60,8 @@ clean: .PHONY: clean install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL) -d $(DESTDIR)$(libudevdir) + $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) $(MAKE) -C lib install .PHONY: install-bin @@ -70,7 +71,8 @@ uninstall-bin: .PHONY: uninstall-bin install-man: - $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 + $(INSTALL) -d $(DESTDIR)$(mandir)/man8 + $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 .PHONY: install-man uninstall-man: diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 105549a946..c0905f4a06 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -103,16 +103,19 @@ libvolume_id.pc: $(Q) echo "Cflags: -I\$${includedir}" >> $@ install: all - $(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h - $(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) - mkdir -p $(DESTDIR)$(usrlibdir)/ + $(INSTALL) -d $(DESTDIR)$(includedir) + $(INSTALL_DATA) libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h + $(INSTALL) -d $(DESTDIR)$(libdir) + $(INSTALL_LIB) $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) + $(INSTALL) -d $(DESTDIR)$(usrlibdir) ln -sf $(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) ifeq ($(libdir),$(usrlibdir)) ln -sf $(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so else ln -sf $(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so endif - $(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc + $(INSTALL) -d $(DESTDIR)$(usrlibdir)/pkgconfig + $(INSTALL_DATA) libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc .PHONY: install uninstall: -- cgit v1.2.3-54-g00ecf From 65e9e8c5e8de192b2b6eea0dcb6089268eb9ad2a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 15 Mar 2008 00:05:02 +0100 Subject: release 119 --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- README | 21 +++++++++------------ RELEASE-NOTES | 4 ++++ 4 files changed, 53 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index fac6b5f226..299e613ce7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Summary of changes from v118 to v119 +============================================ + +Anthony L. Awtrey (1): + do not skip RUN execution if device node removal fails + +Harald Hoyer (2): + rules: Fedora update + rules: do not set GROUP="disk" for scanners + +Jiri Slaby (1): + rules_generator: add missing write_net_rules unlock + +Karel Zak (2): + volume_id: fix UUID raw buffer usage + volume_id: fix typo in function documentation + +Kay Sievers (10): + switch mailing lists to linux-hotplug@vger.kernel.org + rules: remove tty rule which can never run because of an earlier "last_rule" + volume_id: update ext detection + selinux: set context for real file name not the temp name + hack to allow ATTR{block/*/uevent}="change" + rules_generator: add KERNEL=="*" to generated rules + persistent device naming: also run on "change" event + test: add "subsystem" links to all devices + sysfs: depend on "subsystem" link + extend hack to allow TEST=="*/start" + +Matthias Schwarzott (1): + volume_id: respect LDFLAGS + +Neil Williams (1): + volume_id: add prefix=, exec_prefix= + +Roy Marples (1): + Makefile: do not require GNU install + + Summary of changes from v117 to v118 ============================================ diff --git a/Makefile b/Makefile index 2fcc4247fa..a53bd1fe0a 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 118 +VERSION = 119 # set this to make use of syslog USE_LOG = true diff --git a/README b/README index f37c12a8e0..00acf97c27 100644 --- a/README +++ b/README @@ -9,16 +9,16 @@ Important Note: recommend to replace a distro's udev installation with the upstream version. Requirements: - - Version 2.6.15 of the Linux kernel for reliable operation of this release of + - Version 2.6.18 of the Linux kernel for reliable operation of this release of udev. The kernel may have a requirement on udev too, see Documentation/Changes in the kernel source tree for the actual dependency. - The kernel must have sysfs, unix domain sockets and networking enabled. (unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, - but it is completely silly - don't complain if anything goes wrong.) + but it does not make any sense - don't complain if anything goes wrong.) - The proc filesystem must be mounted on /proc, the sysfs filesystem must - be mounted at /sys. No other location is supported by udev. + be mounted at /sys. No other locations are supported by udev. Operation: @@ -45,7 +45,7 @@ Operation: /etc/udev/rules.d/ which make it possible to hook into the event processing to load required kernel modules and setup devices. For all devices the kernel exports a major/minor number, udev will create a - device node with the default kernel name or the one specified by a + device node with the default kernel name, or the one specified by a matching udev rule. @@ -71,22 +71,19 @@ Compile Options: Installation: - The install target intalls the udev binaries in the default locations, - All at boot time reqired binaries will be installed in /lib/udev or /sbin. + All binaries will be installed in /lib/udev or /sbin. - The default location for scripts and binaries that are called from - rules is /lib/udev. Other packages who install udev rules, should use + rules is /lib/udev. Other packages who install udev rules, may use that directory too. - - It is recommended to use the /lib/udev/devices directory to place + - It is recommended to use the /lib/udev/devices/ directory to place device nodes and symlinks in, which are copied to /dev at every boot. That way, nodes for broken subsystems or devices which can't be detected automatically by the kernel, will always be available. - - Copies of the rules files for the major distros are provided as examples - in the etc/udev directory. - - - The persistent device naming links in /dev/disk/ are required by other - software that depends on the data udev has collected from the devices + - Default udev rules and persistent device naming rules are required by other + software that depends on the data udev collects from the devices, and should be installed by default with every udev installation. Please direct any comment/question/concern to the linux-hotplug-devel mailing list at: diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 58564edcd8..9446a68b3c 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 119 +======== +Bugfixes. + udev 118 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 15015a5c9c5fd06d4e236d23f1f6bc45738b0d39 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Mar 2008 04:03:24 +0100 Subject: test: remove duplicated EXTRA entry --- test/simple-build-check.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 9939b88fb3..6bf12013d8 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -10,7 +10,6 @@ EXTRAS="\ extras/edd_id \ extras/floppy \ extras/firmware \ - extras/path_id \ extras/collect \ extras/rule_generator" -- cgit v1.2.3-54-g00ecf From ddf9cacf611fac839f8417ccc9b86959da90860e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Mar 2008 13:32:22 +0100 Subject: rules: remove last WAIT_FOR_SYSFS, load ppdev, switch scsi_device --- etc/udev/rules.d/05-udev-early.rules | 5 ----- etc/udev/rules.d/80-drivers.rules | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) delete mode 100644 etc/udev/rules.d/05-udev-early.rules diff --git a/etc/udev/rules.d/05-udev-early.rules b/etc/udev/rules.d/05-udev-early.rules deleted file mode 100644 index 4c3055b626..0000000000 --- a/etc/udev/rules.d/05-udev-early.rules +++ /dev/null @@ -1,5 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# sysfs is populated after the event is sent -ACTION=="add", KERNEL=="[0-9]*:[0-9]*", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" - diff --git a/etc/udev/rules.d/80-drivers.rules b/etc/udev/rules.d/80-drivers.rules index 534056528d..881d7581bf 100644 --- a/etc/udev/rules.d/80-drivers.rules +++ b/etc/udev/rules.d/80-drivers.rules @@ -10,7 +10,8 @@ SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" -SUBSYSTEM=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" +SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe ppdev" LABEL="drivers_end" -- cgit v1.2.3-54-g00ecf From ab815cae7f974ec77b2cd3861f01edf92269a88a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Mar 2008 00:58:20 +0100 Subject: udevadm: trigger - option to synthesize events and pass them to a socket --- udevtrigger.c | 142 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 138 insertions(+), 4 deletions(-) diff --git a/udevtrigger.c b/udevtrigger.c index 0a9dc66909..7584e02a67 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -30,9 +30,12 @@ #include #include #include +#include +#include #include "udev.h" #include "udevd.h" +#include "udev_rules.h" static int verbose; static int dry_run; @@ -41,6 +44,9 @@ LIST_HEAD(filter_subsystem_match_list); LIST_HEAD(filter_subsystem_nomatch_list); LIST_HEAD(filter_attr_match_list); LIST_HEAD(filter_attr_nomatch_list); +static int sock = -1; +static struct sockaddr_un saddr; +static socklen_t saddrlen; /* devices that should run last cause of their dependencies */ static int delay_device(const char *devpath) @@ -114,6 +120,113 @@ static void trigger_uevent(const char *devpath, const char *action) close(fd); } +static int pass_to_socket(const char *devpath, const char *action) +{ + struct udevice udev; + struct name_entry *name_loop; + char buf[4096]; + size_t bufpos = 0; + ssize_t count; + char path[PATH_SIZE]; + int fd; + char link_target[PATH_SIZE]; + int len; + int err = 0; + + udev_device_init(&udev); + udev_db_get_device(&udev, devpath); + + /* add header */ + bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); + bufpos++; + + /* add standard keys */ + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVPATH=%s", devpath); + bufpos++; + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "ACTION=%s", action); + bufpos++; + + /* add subsystem */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/subsystem", sizeof(path)); + len = readlink(path, link_target, sizeof(link_target)); + if (len > 0) { + char *pos; + + link_target[len] = '\0'; + pos = strrchr(link_target, '/'); + if (pos != NULL) { + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "SUBSYSTEM=%s", &pos[1]); + bufpos++; + } + } + + /* add symlinks and node name */ + path[0] = '\0'; + list_for_each_entry(name_loop, &udev.symlink_list, node) { + strlcat(path, udev_root, sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, name_loop->name, sizeof(path)); + strlcat(path, " ", sizeof(path)); + } + remove_trailing_chars(path, ' '); + if (path[0] != '\0') { + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path); + bufpos++; + } + if (udev.name[0] != '\0') { + strlcpy(path, udev_root, sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, udev.name, sizeof(path)); + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path); + bufpos++; + } + + /* add keys from device "uevent" file */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/uevent", sizeof(path)); + fd = open(path, O_RDONLY); + if (fd >= 0) { + char value[4096]; + + count = read(fd, value, sizeof(value)); + close(fd); + if (count > 0) { + char *key; + + value[count] = '\0'; + key = value; + while (key[0] != '\0') { + char *next; + + next = strchr(key, '\n'); + if (next == NULL) + break; + next[0] = '\0'; + bufpos += strlcpy(&buf[bufpos], key, sizeof(buf) - bufpos-1); + bufpos++; + key = &next[1]; + } + } + } + + /* add keys from database */ + list_for_each_entry(name_loop, &udev.env_list, node) { + bufpos += strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); + bufpos++; + } + if (bufpos > sizeof(buf)) + bufpos = sizeof(buf); + + count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); + if (count < 0) + err = -1; + + return err; +} + static void exec_list(const char *action) { struct name_entry *loop_device; @@ -122,15 +235,20 @@ static void exec_list(const char *action) list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { if (delay_device(loop_device->name)) continue; - - trigger_uevent(loop_device->name, action); + if (sock) + pass_to_socket(loop_device->name, action); + else + trigger_uevent(loop_device->name, action); list_del(&loop_device->node); free(loop_device); } /* trigger remaining delayed devices */ list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - trigger_uevent(loop_device->name, action); + if (sock) + pass_to_socket(loop_device->name, action); + else + trigger_uevent(loop_device->name, action); list_del(&loop_device->node); free(loop_device); } @@ -434,12 +552,14 @@ static void scan_failed(void) int udevtrigger(int argc, char *argv[], char *envp[]) { int failed = 0; + const char *sockpath = NULL; int option; const char *action = "add"; static const struct option options[] = { { "verbose", 0, NULL, 'v' }, { "dry-run", 0, NULL, 'n' }, { "retry-failed", 0, NULL, 'F' }, + { "socket", 1, NULL, 'o' }, { "help", 0, NULL, 'h' }, { "action", 1, NULL, 'c' }, { "subsystem-match", 1, NULL, 's' }, @@ -455,7 +575,7 @@ int udevtrigger(int argc, char *argv[], char *envp[]) sysfs_init(); while (1) { - option = getopt_long(argc, argv, "vnFhc:s:S:a:A:", options, NULL); + option = getopt_long(argc, argv, "vnFo:hc:s:S:a:A:", options, NULL); if (option == -1) break; @@ -469,6 +589,9 @@ int udevtrigger(int argc, char *argv[], char *envp[]) case 'F': failed = 1; break; + case 'o': + sockpath = optarg; + break; case 'c': action = optarg; break; @@ -504,6 +627,15 @@ int udevtrigger(int argc, char *argv[], char *envp[]) } } + if (sockpath != NULL) { + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + /* abstract namespace only */ + strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + } + if (failed) { scan_failed(); exec_list(action); @@ -540,6 +672,8 @@ exit: name_list_cleanup(&filter_attr_match_list); name_list_cleanup(&filter_attr_nomatch_list); + if (sock >= 0) + close(sock); sysfs_cleanup(); logging_close(); return 0; -- cgit v1.2.3-54-g00ecf From e7e194a088e984972d6a18c7f7a36a1e8f1f58e6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Mar 2008 16:12:41 +0100 Subject: udevadm: info - resolve devpath if symlink is given --- udev_db.c | 2 +- udevinfo.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/udev_db.c b/udev_db.c index 29aa0316d2..518ace9a5d 100644 --- a/udev_db.c +++ b/udev_db.c @@ -37,7 +37,7 @@ static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len { size_t start; - /* add location of db files */ + /* translate to location of db file */ strlcpy(filename, udev_root, len); start = strlcat(filename, "/"DB_DIR"/", len); strlcat(filename, devpath, len); diff --git a/udevinfo.c b/udevinfo.c index 948aaccc36..85899cfd9d 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -281,6 +281,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) strlcpy(name, &optarg[strlen(udev_root)+1], sizeof(name)); else strlcpy(name, optarg, sizeof(name)); + remove_trailing_chars(name, '/'); dbg("name: %s", name); break; case 'p': @@ -289,6 +290,27 @@ int udevinfo(int argc, char *argv[], char *envp[]) strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path)); else strlcpy(path, optarg, sizeof(path)); + remove_trailing_chars(path, '/'); + + /* possibly resolve to real devpath */ + if (sysfs_resolve_link(path, sizeof(path)) != 0) { + char temp[PATH_SIZE]; + char *pos; + + /* also check if the parent is a link */ + strlcpy(temp, path, sizeof(temp)); + pos = strrchr(temp, '/'); + if (pos != 0) { + char tail[PATH_SIZE]; + + strlcpy(tail, pos, sizeof(tail)); + pos[0] = '\0'; + if (sysfs_resolve_link(temp, sizeof(temp)) == 0) { + strlcpy(path, temp, sizeof(path)); + strlcat(path, tail, sizeof(path)); + } + } + } dbg("path: %s", path); break; case 'q': -- cgit v1.2.3-54-g00ecf From e18bd73b7245a6374352aafe72d0e1736227c7e1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Mar 2008 16:29:36 +0100 Subject: udevadm: remove old man page links and compat links for debugging tools --- Makefile | 20 +------------------- TODO | 5 ++--- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index a53bd1fe0a..a560ef32ac 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,6 @@ prefix ?= etcdir = ${prefix}/etc sbindir = ${prefix}/sbin usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin libudevdir = ${prefix}/lib/udev mandir = ${prefix}/usr/share/man configdir = ${etcdir}/udev @@ -241,12 +240,6 @@ install-man: $(INSTALL) -d $(DESTDIR)$(mandir)/man8 $(INSTALL_DATA) udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 $(INSTALL_DATA) udevadm.8 $(DESTDIR)$(mandir)/man8/udevadm.8 - ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevinfo.8 - ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevtest.8 - ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevtrigger.8 - ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevsettle.8 - ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevmonitor.8 - ln -f -s udevadm.8 $(DESTDIR)$(mandir)/man8/udevcontrol.8 @extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; @@ -255,13 +248,7 @@ install-man: uninstall-man: - rm -f $(DESTDIR)$(mandir)/man7/udev.7 - rm -f $(DESTDIR)$(mandir)/man8/udevadm.8 - - rm -f $(DESTDIR)$(mandir)/man8/udevinfo.8 - - rm -f $(DESTDIR)$(mandir)/man8/udevtest.8 - rm -f $(DESTDIR)$(mandir)/man8/udevd.8 - - rm -f $(DESTDIR)$(mandir)/man8/udevtrigger.8 - - rm -f $(DESTDIR)$(mandir)/man8/udevsettle.8 - - rm -f $(DESTDIR)$(mandir)/man8/udevmonitor.8 - - rm -f $(DESTDIR)$(mandir)/man8/udevcontrol.8 @ extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; @@ -274,11 +261,8 @@ install-bin: ln -f -s udevadm $(DESTDIR)$(sbindir)/udevtrigger ln -f -s udevadm $(DESTDIR)$(sbindir)/udevsettle ln -f -s udevadm $(DESTDIR)$(sbindir)/udevcontrol - $(INSTALL) -d $(DESTDIR)$(usrsbindir) - ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrsbindir)/udevmonitor - mkdir -p -m 0755 $(DESTDIR)$(usrbindir) + $(INSTALL) -d $(DESTDIR)$(usrbindir) ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrbindir)/udevinfo - ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrbindir)/udevtest @extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; @@ -295,9 +279,7 @@ uninstall-bin: - rm -f $(DESTDIR)$(sbindir)/udevtrigger - rm -f $(DESTDIR)$(sbindir)/udevsettle - rm -f $(DESTDIR)$(sbindir)/udevcontrol - - rm -f $(DESTDIR)$(usrsbindir)/udevmonitor - rm -f $(DESTDIR)$(usrbindir)/udevinfo - - rm -f $(DESTDIR)$(usrbindir)/udevtest ifndef DESTDIR - killall udevd - rm -rf /dev/.udev diff --git a/TODO b/TODO index 7f7b1b0f2b..7c0407949e 100644 --- a/TODO +++ b/TODO @@ -5,9 +5,8 @@ These things will change in future udev versions: o warn if BUS, ID, SYSFS are used as keys (they are SUBSYSTEMS, KERNELS, ATTRS now) + o warn if links to udevadm are used These things are deprecated and scheduled for removal in a future udev version: - o remove man page symlinks for old tool names - - o some day, remove the symlinks to udevadm + o some day, remove all symlinks to udevadm -- cgit v1.2.3-54-g00ecf From 52434fb98b2e8920e8e254d87ecfff2789ebd6b7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Mar 2008 17:16:41 +0100 Subject: udevadm: trigger - fix broken socket option check --- udevtrigger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udevtrigger.c b/udevtrigger.c index 7584e02a67..cebc518c43 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -235,7 +235,7 @@ static void exec_list(const char *action) list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { if (delay_device(loop_device->name)) continue; - if (sock) + if (sock >= 0) pass_to_socket(loop_device->name, action); else trigger_uevent(loop_device->name, action); @@ -245,7 +245,7 @@ static void exec_list(const char *action) /* trigger remaining delayed devices */ list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (sock) + if (sock >= 0) pass_to_socket(loop_device->name, action); else trigger_uevent(loop_device->name, action); -- cgit v1.2.3-54-g00ecf From bdfcd075872d8086cd9e4e416f7793d4c78e8af8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Mar 2008 17:20:34 +0100 Subject: udevadm: trigger - fix --socket== + --verbose --- udevtrigger.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udevtrigger.c b/udevtrigger.c index cebc518c43..4e3a8fab2d 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -133,6 +133,9 @@ static int pass_to_socket(const char *devpath, const char *action) int len; int err = 0; + if (verbose) + printf("%s\n", devpath); + udev_device_init(&udev); udev_db_get_device(&udev, devpath); -- cgit v1.2.3-54-g00ecf From c3b145a381090f18c4c5f4149e19183343880ec2 Mon Sep 17 00:00:00 2001 From: Michael Kralka Date: Wed, 2 Apr 2008 04:32:17 +0200 Subject: udevd: serialize events if they refer to the same major:minor number --- udevd.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/udevd.c b/udevd.c index 7f32a2aa79..82ebd22dba 100644 --- a/udevd.c +++ b/udevd.c @@ -479,12 +479,20 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) return 3; } + /* check for our major:minor number */ + if (msg->devt && loop_msg->devt == msg->devt && + strcmp(msg->subsystem, loop_msg->subsystem) == 0) { + dbg("%llu, device event still pending %llu (%d:%d)", msg->seqnum, + loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); + return 4; + } + /* check physical device event (special case of parent) */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { dbg("%llu, physical device event still pending %llu (%s)", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 4; + return 5; } } @@ -507,12 +515,20 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) return 3; } + /* check for our major:minor number */ + if (msg->devt && loop_msg->devt == msg->devt && + strcmp(msg->subsystem, loop_msg->subsystem) == 0) { + dbg("%llu, device event still running %llu (%d:%d)", msg->seqnum, + loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); + return 4; + } + /* check physical device event (special case of parent) */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { dbg("%llu, physical device event still running %llu (%s)", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 4; + return 5; } } return 0; -- cgit v1.2.3-54-g00ecf From c7969cdbcb1f6d39177f6cc2e28597fabe186594 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Apr 2008 04:43:25 +0200 Subject: also accept real socket files for RUN+="socket:" --- etc/udev/rules.d/95-udev-late.rules | 2 +- udev.7 | 9 +++++---- udev.xml | 8 +++++++- udev_rules.c | 27 +++++++++++++++++++-------- udevadm.8 | 11 +++++++++-- udevadm.xml | 12 +++++++++++- udevcontrol.c | 2 +- udevd.8 | 2 +- udevd.c | 2 +- udevmonitor.c | 2 +- udevtrigger.c | 18 +++++++++++++++--- 11 files changed, 71 insertions(+), 24 deletions(-) diff --git a/etc/udev/rules.d/95-udev-late.rules b/etc/udev/rules.d/95-udev-late.rules index 4a015b9eed..7207081d46 100644 --- a/etc/udev/rules.d/95-udev-late.rules +++ b/etc/udev/rules.d/95-udev-late.rules @@ -4,5 +4,5 @@ ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" # event to be catched by udevmonitor -RUN+="socket:/org/kernel/udev/monitor" +RUN+="socket:@/org/kernel/udev/monitor" diff --git a/udev.7 b/udev.7 index e237ba7d46..3bc04b7c63 100644 --- a/udev.7 +++ b/udev.7 @@ -1,6 +1,6 @@ .\" Title: udev .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 +.\" Generator: DocBook XSL Stylesheets v1.73.2 .\" Date: August 2005 .\" Manual: udev .\" Source: udev @@ -213,6 +213,9 @@ Export a variable to the environment\. Depending on the type of operator, this k \fBRUN\fR .RS 4 Add a program to the list of programs to be executed for a specific device\. This can only be used for very short running tasks\. Running an event process for a long period of time may block all further events for this or a dependent device\. Long running tasks need to be immediately detached from the event process itself\. +.sp +If the specifiefd string starts with +\fBsocket:\fR\fB\fIpath\fR\fR, all current event values will be passed to the specified socket, as a message in the same format the kernel sends an uevent\. If the first character of the specified path is an @ character, an abstract namespace socket is used, instead of an existing socket file\. .RE .PP \fBLABEL\fR @@ -409,9 +412,7 @@ The count of characters to be substituted may be limited by specifying the forma Written by Greg Kroah\-Hartman and Kay Sievers -\. With much help from Dan Stekloff - -and many others\. +\. With much help from Dan Stekloff and many others\. .SH "SEE ALSO" .PP \fBudevd\fR(8), diff --git a/udev.xml b/udev.xml index 71832a2fe5..e432965317 100644 --- a/udev.xml +++ b/udev.xml @@ -333,6 +333,12 @@ event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. + If the specifiefd string starts with + , all current event + values will be passed to the specified socket, as a message in the same + format the kernel sends an uevent. If the first character of the specified path + is an @ character, an abstract namespace socket is used, instead of an existing + socket file. @@ -600,7 +606,7 @@ AUTHOR Written by Greg Kroah-Hartman greg@kroah.com and Kay Sievers kay.sievers@vrfy.org. With much help from - Dan Stekloff dsteklof@us.ibm.com and many others. + Dan Stekloff and many others. diff --git a/udev_rules.c b/udev_rules.c index 1521db08de..eccea3b57c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -455,24 +455,35 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) return rc; } -static int pass_env_to_socket(const char *sockname, const char *devpath, const char *action) +static int pass_env_to_socket(const char *sockpath, const char *devpath, const char *action) { int sock; struct sockaddr_un saddr; - socklen_t addrlen; + socklen_t saddrlen; + struct stat stats; char buf[2048]; size_t bufpos = 0; int i; ssize_t count; int retval = 0; - dbg("pass environment to socket '%s'", sockname); + dbg("pass environment to socket '%s'", sockpath); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; - /* abstract namespace only */ - strcpy(&saddr.sun_path[1], sockname); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + if (sockpath[0] == '@') { + /* abstract namespace socket requested */ + strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { + /* existing socket file */ + strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); + saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); + } else { + /* no socket file, assume abstract namespace socket */ + strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); bufpos++; @@ -483,10 +494,10 @@ static int pass_env_to_socket(const char *sockname, const char *devpath, const c if (bufpos > sizeof(buf)) bufpos = sizeof(buf); - count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, addrlen); + count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); if (count < 0) retval = -1; - info("passed %zi bytes to socket '%s', ", count, sockname); + info("passed %zi bytes to socket '%s', ", count, sockpath); close(sock); return retval; diff --git a/udevadm.8 b/udevadm.8 index acad283bc3..0db30126bd 100644 --- a/udevadm.8 +++ b/udevadm.8 @@ -1,6 +1,6 @@ .\" Title: udevadm .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 +.\" Generator: DocBook XSL Stylesheets v1.73.2 .\" Date: November 2007 .\" Manual: udevadm .\" Source: udev @@ -97,7 +97,7 @@ Print help text\. .RE .SS "udevadm trigger [options]" .PP -Request kernel device uevents, usually used to replay events at system coldplug\. +Request device uevents, usually used to replay events at system coldplug\. .PP \fB\-\-verbose\fR .RS 4 @@ -138,6 +138,13 @@ Trigger events for devices with a matching sysfs attribute\. If a value is speci .RS 4 Do not trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. .RE +.PP +\fB\-\-socket\fR\fB\fIpath\fR\fR +.RS 4 +Pass the synthesized events to the specified socket, instead of triggering a global kernel event\. All available event values will be send in the same format the kernel sends an uevent, or +\fBRUN+="socket:\fR\fB\fIpath\fR\fR\fB"\fR +sends a message\. If the first character of the specified path is an @ character, an abstract namespace socket is used, instead of an existing socket file\. +.RE .SS "udevadm settle [options]" .PP Watches the udev event queue, and exits if all current events are handled\. diff --git a/udevadm.xml b/udevadm.xml index ccbeeca404..121c1401d6 100644 --- a/udevadm.xml +++ b/udevadm.xml @@ -130,7 +130,7 @@ udevadm trigger <optional>options</optional> - Request kernel device uevents, usually used to replay events at system coldplug. + Request device uevents, usually used to replay events at system coldplug. @@ -188,6 +188,16 @@ of the sysfs attribute is checked. This option can be specified multiple times. + + + + Pass the synthesized events to the specified socket, instead of triggering + a global kernel event. All available event values will be send in the same format + the kernel sends an uevent, or + sends a message. If the first character of the specified path is an @ character, + an abstract namespace socket is used, instead of an existing socket file. + + diff --git a/udevcontrol.c b/udevcontrol.c index 2442a3e0a9..f6b5dd9053 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -144,7 +144,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); retval = sendto(sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&saddr, addrlen); if (retval == -1) { diff --git a/udevd.8 b/udevd.8 index 0f0dd1ac2d..1323313a0d 100644 --- a/udevd.8 +++ b/udevd.8 @@ -1,6 +1,6 @@ .\" Title: udevd .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 +.\" Generator: DocBook XSL Stylesheets v1.73.2 .\" Date: August 2005 .\" Manual: udevd .\" Source: udev diff --git a/udevd.c b/udevd.c index 82ebd22dba..493bb54514 100644 --- a/udevd.c +++ b/udevd.c @@ -862,7 +862,7 @@ static int init_udevd_socket(void) saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udevd_sock == -1) { diff --git a/udevmonitor.c b/udevmonitor.c index 75e39481a0..2430dd39a5 100644 --- a/udevmonitor.c +++ b/udevmonitor.c @@ -49,7 +49,7 @@ static int init_udev_monitor_socket(void) saddr.sun_family = AF_LOCAL; /* use abstract namespace for socket path */ strcpy(&saddr.sun_path[1], "/org/kernel/udev/monitor"); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); udev_monitor_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udev_monitor_sock == -1) { diff --git a/udevtrigger.c b/udevtrigger.c index 4e3a8fab2d..e50fd4ee04 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -631,12 +631,24 @@ int udevtrigger(int argc, char *argv[], char *envp[]) } if (sockpath != NULL) { + struct stat stats; + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; - /* abstract namespace only */ - strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path+1) + 1; + if (sockpath[0] == '@') { + /* abstract namespace socket requested */ + strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { + /* existing socket file */ + strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); + saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); + } else { + /* no socket file, assume abstract namespace socket */ + strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } } if (failed) { -- cgit v1.2.3-54-g00ecf From 1ed38f41749dde482e164e692255b60c38b5d876 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 Apr 2008 21:05:19 +0200 Subject: persistent device naming: cleanup storage rules --- etc/udev/rules.d/60-persistent-storage.rules | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 990703cef3..a1e0917ab5 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -14,7 +14,7 @@ KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="p KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # ignore partitions that span the entire disk -ATTR{whole_disk}=="*", GOTO="persistent_storage_end" +TEST=="whole_disk", GOTO="persistent_storage_end" # /sys/class/block will export this ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" @@ -47,9 +47,6 @@ ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -KERNEL=="sr*", GOTO="persistent_storage_end" -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" - # by-label/by-uuid (filesystem properties) ENV{DEVTYPE}=="partition", IMPORT{program}="vol_id --export $tempnode" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -- cgit v1.2.3-54-g00ecf From cb0b4b70ddd7385ab2e3425257ed3c220dbf030e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 Apr 2008 21:12:53 +0200 Subject: release 120 --- ChangeLog | 18 ++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 16 ++++++++++++++++ TODO | 10 ++-------- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 299e613ce7..5826cac3fa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +Summary of changes from v119 to v120 +============================================ + +Kay Sievers (9): + test: remove duplicated EXTRA entry + rules: remove last WAIT_FOR_SYSFS, load ppdev, switch scsi_device + udevadm: trigger - option to synthesize events and pass them to a socket + udevadm: info - resolve devpath if symlink is given + udevadm: remove old man page links and compat links for debugging tools + udevadm: trigger - fix broken socket option check + udevadm: trigger - fix --socket== + --verbose + also accept real socket files for RUN+="socket:" + persistent device naming: cleanup storage rules + +Michael Kralka (1): + udevd: serialize events if they refer to the same major:minor number + + Summary of changes from v118 to v119 ============================================ diff --git a/Makefile b/Makefile index a560ef32ac..baa3df9b8f 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 119 +VERSION = 120 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 9446a68b3c..e087631c30 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,19 @@ +udev 120 +======== +Bugfixes. + +The last WAIT_FOR_SYSFS rule is removed from the default rules. + +The symlinks to udevadm for the debugging tools: udevmonitor and +udevtest are no longer created. + +The symlinks to the udevadm man page for the old tool names are +no longer created. + +Abstract namespace sockets paths in RUN+="socket:@" rules, +should be prefixed with '@' to indicate that the path is not a +real file. + udev 119 ======== Bugfixes. diff --git a/TODO b/TODO index 7c0407949e..8a217b0fbb 100644 --- a/TODO +++ b/TODO @@ -1,12 +1,6 @@ These things would be nice to have: - These things will change in future udev versions: - o warn if BUS, ID, SYSFS are used as keys - (they are SUBSYSTEMS, KERNELS, ATTRS now) - - o warn if links to udevadm are used -These things are deprecated and scheduled for removal in a future -udev version: - o some day, remove all symlinks to udevadm +These things are deprecated and scheduled for removal in a future udev version: + o the installation of symlinks to udevadm -- cgit v1.2.3-54-g00ecf From 8c1711dcd03e84bfec4bb2ee767d0467fd32f6a5 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Sun, 6 Apr 2008 07:12:20 +0200 Subject: writing udev rules: fix rule typos --- docs/writing_udev_rules/index.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index 92891376f5..5fedb3f8c0 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -17,7 +17,7 @@

                  Writing udev rules

                  by Daniel Drake (dsd)
                  -Version 0.73

                  +Version 0.74

                  The most recent version of this document can always be found at:
                  @@ -114,6 +114,7 @@ This document uses various examples (many of which are entirely fictional) to il

                  History

                    +
                  • April 5th 2008 v0.74: Typo fixes.
                  • December 3rd 2007 v0.73: Update for new udev versions, and some miscellaneous improvements.
                  • October 2nd 2006 v0.72: Fixed a typo in one of the example rules.
                  • June 10th 2006 v0.71: Misc changes based on recent feedback - thanks!
                  • @@ -480,7 +481,7 @@ As you can see, udevinfo simply produces a list of attributes you can use as-is
                     SUBSYSTEM=="block", ATTR{size}=="234441648", NAME="my_hard_disk"
                    -SUBSYSTEM="block", SUBSYSTEMS=="scsi", ATTRS{model}=="ST3120827AS", NAME="my_hard_disk"
                    +SUBSYSTEM=="block", SUBSYSTEMS=="scsi", ATTRS{model}=="ST3120827AS", NAME="my_hard_disk"

                    You may have noted the use of colour in the above examples. This is to demonstrate that while it is legal to combine the attributes from the device in question and a single parent device, you cannot mix-and-match attributes from multiple parent devices - your rule will not work. For example, the following rule is invalid as it attempts to match attributes from two parent devices: @@ -735,7 +736,7 @@ A USB hard disk is comparable to the USB camera I described above, however typic Of course, if you have a 100GB USB hard disk, it is perfectly understandable that you might want to partition it, in which case we can take advantage of udev's string substitutions:

                    -
                    KERNEL=="sd*", SUBSYSTEMS="scsi", ATTRS{model}=="USB 2.0 Storage Device", SYMLINK+="usbhd%n"
                    +
                    KERNEL=="sd*", SUBSYSTEMS=="scsi", ATTRS{model}=="USB 2.0 Storage Device", SYMLINK+="usbhd%n"

                    This rule creates symlinks such as: -- cgit v1.2.3-54-g00ecf From 573bdd7e7588b70105c2976859696037899e9d4d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Apr 2008 01:57:31 +0200 Subject: udevinfo: do not replace chars when printing ATTR== matches --- udevinfo.c | 1 - 1 file changed, 1 deletion(-) diff --git a/udevinfo.c b/udevinfo.c index 85899cfd9d..52d409df88 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -83,7 +83,6 @@ static void print_all_attributes(const char *devpath, const char *key) continue; } - replace_chars(value, ALLOWED_CHARS_INPUT); printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); } } -- cgit v1.2.3-54-g00ecf From 8b5238670d2e741bc71ae3e79b499682965dc2fd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Apr 2008 12:35:03 +0200 Subject: vol_id: add --offset option --- extras/volume_id/lib/Makefile | 2 +- extras/volume_id/lib/volume_id.c | 10 +++++----- extras/volume_id/vol_id.c | 14 ++++++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index c0905f4a06..0e1565f98a 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 82 +SHLIB_REV = 83 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index e8f6de35fd..7c68fb1ef9 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -331,9 +331,9 @@ err: } /* run only once into a timeout for unreadable devices */ -static int device_is_readable(struct volume_id *id) +static int device_is_readable(struct volume_id *id, uint64_t off) { - if (volume_id_get_buffer(id, 0x00, 0x200) != NULL) + if (volume_id_get_buffer(id, off, 0x200) != NULL) return 1; return 0; } @@ -355,7 +355,7 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; - if (!device_is_readable(id)) + if (!device_is_readable(id, off)) return -1; info("probing at offset 0x%llx, size 0x%llx", @@ -389,7 +389,7 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (id == NULL) return -EINVAL; - if (!device_is_readable(id)) + if (!device_is_readable(id, off)) return -1; info("probing at offset 0x%llx, size 0x%llx", @@ -421,7 +421,7 @@ int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) if (id == NULL) return -EINVAL; - if (!device_is_readable(id)) + if (!device_is_readable(id, off)) return -1; /* probe for raid first, because fs probes may be successful on raid members */ diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 38950ee85f..04e85abb7f 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -134,6 +134,7 @@ int main(int argc, char *argv[]) { "export", 0, NULL, 'x' }, { "skip-raid", 0, NULL, 's' }, { "probe-all", 0, NULL, 'a' }, + { "offset", 1, NULL, 'o' }, { "help", 0, NULL, 'h' }, {} }; @@ -153,6 +154,7 @@ int main(int argc, char *argv[]) uint64_t size; int skip_raid = 0; int probe_all = 0; + uint64_t offset = 0; const char *node; int fd; const char *label, *uuid, *type, *type_version, *usage; @@ -167,7 +169,7 @@ int main(int argc, char *argv[]) while (1) { int option; - option = getopt_long(argc, argv, "lLutxsah", options, NULL); + option = getopt_long(argc, argv, "lLutxsaoh", options, NULL); if (option == -1) break; @@ -193,6 +195,9 @@ int main(int argc, char *argv[]) case 'a': probe_all = 1; break; + case 'o': + offset = strtoull(optarg, NULL, 0); + break; case 'h': printf("Usage: vol_id [options] \n" " --export export key/value pairs\n" @@ -202,6 +207,7 @@ int main(int argc, char *argv[]) " --uuid filesystem uuid\n" " --skip-raid don't probe for raid\n" " --probe-all find possibly conflicting signatures\n" + " --offset skip given number of bytes of input\n" " --help\n\n"); goto exit; default: @@ -249,14 +255,14 @@ int main(int argc, char *argv[]) } if (probe_all) { - volume_id_all_probers(all_probers, vid, 0, size, NULL); + volume_id_all_probers(all_probers, vid, offset, size, NULL); goto exit; } if (skip_raid) - retval = volume_id_probe_filesystem(vid, 0, size); + retval = volume_id_probe_filesystem(vid, offset, size); else - retval = volume_id_probe_all(vid, 0, size); + retval = volume_id_probe_all(vid, offset, size); if (retval != 0) { fprintf(stderr, "%s: unknown volume type\n", node); rc = 4; -- cgit v1.2.3-54-g00ecf From fd7a285e6293fddd3fbc68b519dcd367adeb72c4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Apr 2008 23:17:39 +0200 Subject: cdrom_id: replace with version which also exports media properties This is a 12 track audio CD with additional data session: $ extras/cdrom_id/cdrom_id /dev/dvd ID_CDROM=1 ID_CDROM_CD_R=1 ID_CDROM_CD_RW=1 ID_CDROM_DVD=1 ID_CDROM_DVD_R=1 ID_CDROM_DVD_RW=1 ID_CDROM_DVD_RAM=1 ID_CDROM_DVD_PLUS_R=1 ID_CDROM_DVD_PLUS_RW=1 ID_CDROM_DVD_PLUS_R_DL=1 ID_CDROM_MEDIA_CD=1 ID_CDROM_MEDIA_STATE=complete ID_CDROM_MEDIA_HAS_AUDIO=1 ID_CDROM_MEDIA_SESSION_COUNT=2 ID_CDROM_MEDIA_TRACK_COUNT=13 ID_CDROM_MEDIA_SESSION_LAST_OFFSET=444508160 --- extras/cdrom_id/60-cdrom_id.rules | 2 +- extras/cdrom_id/cdrom_id.8 | 15 +- extras/cdrom_id/cdrom_id.c | 677 ++++++++++++++++++++++++++++++++++---- 3 files changed, 617 insertions(+), 77 deletions(-) diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index b06dafddb7..12fbf63779 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -1,3 +1,3 @@ # import optical drive properties -KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" +ACTION=="add|change", KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" diff --git a/extras/cdrom_id/cdrom_id.8 b/extras/cdrom_id/cdrom_id.8 index 4194ae477e..1d4d70dc85 100644 --- a/extras/cdrom_id/cdrom_id.8 +++ b/extras/cdrom_id/cdrom_id.8 @@ -1,17 +1,16 @@ -.TH CDROM_ID 8 "November 2005" "" "Linux Administrator's Manual" +.TH CDROM_ID 8 "April 2008" "" "Linux Administrator's Manual" .SH NAME -cdrom_id \- udev callout to determine the capabilities of cd/dvd drives +cdrom_id \- udev callout to determine the capabilities of optical drives and media .SH SYNOPSIS .BI cdrom_id -[\fI--export\fP] \fIblockdevice\fP +[\fI--export\fP] \fIdevice\fP .SH "DESCRIPTION" .B cdrom_id -is normally called from a udev rule, to provide udev with the capabilities -of a cdrom or dvdrom drive. Udev can use this information to create -symlinks like /dev/cdrom or /dev/dvd to the real device node. +is normally called from a udev rule, to provide udev with the list of +capabilities of a optical drive. .SH USAGE .B cdrom_id -opens the blockdevice node specified at the commandline and prints the +opens the device node specified at the commandline and prints the discovered capabilities. .SH OPTIONS The following commandline switches are supported to specify what cdrom_id @@ -23,5 +22,5 @@ print all values (default) .SH SEE ALSO .BR udev (7) .SH AUTHORS -Developed by Greg Kroah\-Hartman . +Developed by Kay Sievers . diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 0d4a8c10f0..315d27610f 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -1,12 +1,21 @@ /* - * cdrom_id - determines the capabilities of cdrom drives + * cdrom_id - optical drive and media information prober * - * Copyright (C) 2005 Greg Kroah-Hartman + * Copyright (C) 2008 Kay Sievers * * 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 02139, USA. + * */ #ifndef _GNU_SOURCE @@ -14,50 +23,27 @@ #endif #include +#include #include #include -#include -#include #include +#include +#include #include -#include +#include +#include #include #include -#include - +#include +#include +#include #include "../../udev.h" -/* - * Taken from the cdrom.h kernel include file. - * Included here as some distros don't have an updated version - * with all of the DVD flags. So we just include our own, aren't - * we so nice... - */ -#define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ - -/* capability flags used with the uniform CD-ROM driver */ -#define CDC_CLOSE_TRAY 0x1 /* caddy systems _can't_ close */ -#define CDC_OPEN_TRAY 0x2 /* but _can_ eject. */ -#define CDC_LOCK 0x4 /* disable manual eject */ -#define CDC_SELECT_SPEED 0x8 /* programmable speed */ -#define CDC_SELECT_DISC 0x10 /* select disc from juke-box */ -#define CDC_MULTI_SESSION 0x20 /* read sessions>1 */ -#define CDC_MCN 0x40 /* Medium Catalog Number */ -#define CDC_MEDIA_CHANGED 0x80 /* media changed */ -#define CDC_PLAY_AUDIO 0x100 /* audio functions */ -#define CDC_RESET 0x200 /* hard reset device */ -#define CDC_IOCTLS 0x400 /* driver has non-standard ioctls */ -#define CDC_DRIVE_STATUS 0x800 /* driver implements drive status */ -#define CDC_GENERIC_PACKET 0x1000 /* driver implements generic packets */ -#define CDC_CD_R 0x2000 /* drive is a CD-R */ -#define CDC_CD_RW 0x4000 /* drive is a CD-RW */ -#define CDC_DVD 0x8000 /* drive is a DVD */ -#define CDC_DVD_R 0x10000 /* drive can write DVD-R */ -#define CDC_DVD_RAM 0x20000 /* drive can write DVD-RAM */ -#define CDC_MO_DRIVE 0x40000 /* drive is an MO device */ -#define CDC_MRW 0x80000 /* drive can read MRW */ -#define CDC_MRW_W 0x100000 /* drive can write MRW */ -#define CDC_RAM 0x200000 /* ok to open for WRITE */ +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) +#endif + +static int debug; #ifdef USE_LOG void log_message(int priority, const char *format, ...) @@ -73,80 +59,635 @@ void log_message(int priority, const char *format, ...) udev_log = log_priority(value); else udev_log = LOG_ERR; + + if (debug && udev_log < LOG_INFO) + udev_log = LOG_INFO; } if (priority > udev_log) return; va_start(args, format); - vsyslog(priority, format, args); + if (debug) { + fprintf(stderr, "[%d] ", (int) getpid()); + vfprintf(stderr, format, args); + fprintf(stderr, "\n"); + } else + vsyslog(priority, format, args); va_end(args); } #endif +/* device info */ +static unsigned int cd_cd_rom; +static unsigned int cd_cd_r; +static unsigned int cd_cd_rw; +static unsigned int cd_dvd_rom; +static unsigned int cd_dvd_r; +static unsigned int cd_dvd_rw; +static unsigned int cd_dvd_ram; +static unsigned int cd_dvd_plus_r; +static unsigned int cd_dvd_plus_rw; +static unsigned int cd_dvd_plus_r_dl; +static unsigned int cd_dvd_plus_rw_dl; +static unsigned int cd_bd; +static unsigned int cd_bd_r; +static unsigned int cd_bd_re; +static unsigned int cd_hddvd; +static unsigned int cd_hddvd_r; +static unsigned int cd_hddvd_rw; +static unsigned int cd_mo; +static unsigned int cd_mrw; +static unsigned int cd_mrw_w; + +/* media info */ +static unsigned int cd_media_cd_rom; +static unsigned int cd_media_cd_r; +static unsigned int cd_media_cd_rw; +static unsigned int cd_media_dvd_rom; +static unsigned int cd_media_dvd_r; +static unsigned int cd_media_dvd_rw; +static unsigned int cd_media_dvd_ram; +static unsigned int cd_media_dvd_plus_r; +static unsigned int cd_media_dvd_plus_rw; +static unsigned int cd_media_dvd_plus_r_dl; +static unsigned int cd_media_dvd_plus_rw_dl; +static unsigned int cd_media_bd; +static unsigned int cd_media_bd_r; +static unsigned int cd_media_bd_re; +static unsigned int cd_media_hddvd; +static unsigned int cd_media_hddvd_r; +static unsigned int cd_media_hddvd_rw; +static unsigned int cd_media_mo; +static unsigned int cd_media_mrw; +static unsigned int cd_media_mrw_w; + +static const char *cd_media_state; +static unsigned int cd_media_has_audio; +static unsigned int cd_media_session_next; +static unsigned int cd_media_session_count; +static unsigned int cd_media_track_count; +static unsigned long long int cd_media_session_last_offset; + +#define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) +#define SK(errcode) (((errcode) >> 16) & 0xF) +#define ASC(errcode) (((errcode) >> 8) & 0xFF) +#define ASCQ(errcode) ((errcode) & 0xFF) + +static void info_scsi_cmd_err(const char *cmd, int err) +{ + if (err == -1) { + info("%s failed", cmd); + return; + } + info("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh", cmd, SK(err), ASC(err), ASCQ(err)); +} + +struct scsi_cmd { + struct cdrom_generic_command cgc; + union { + struct request_sense s; + unsigned char u[18]; + } _sense; + struct sg_io_hdr sg_io; +}; + +static void scsi_cmd_set(struct scsi_cmd *cmd, size_t i, int arg) +{ + if (i == 0) { + memset(cmd, 0x00, sizeof(struct scsi_cmd)); + cmd->cgc.quiet = 1; + cmd->cgc.sense = &cmd->_sense.s; + memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); + cmd->sg_io.interface_id = 'S'; + cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); + cmd->sg_io.cmdp = cmd->cgc.cmd; + cmd->sg_io.sbp = cmd->_sense.u; + cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; + } + cmd->sg_io.cmd_len = i + 1; + cmd->cgc.cmd[i] = arg; +} + +#define CHECK_CONDITION 0x01 + +static int scsi_cmd_run(struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize) +{ + int ret = 0; + + cmd->sg_io.dxferp = buf; + cmd->sg_io.dxfer_len = bufsize; + cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + if (ioctl(fd, SG_IO, &cmd->sg_io)) + return -1; + + if ((cmd->sg_io.info & SG_INFO_OK_MASK) != SG_INFO_OK) { + errno = EIO; + ret = -1; + if (cmd->sg_io.masked_status & CHECK_CONDITION) { + ret = ERRCODE(cmd->_sense.u); + if (ret == 0) + ret = -1; + } + } + return ret; +} + +static int cd_capability_compat(int fd) +{ + int capabilty; + + capabilty = ioctl(fd, CDROM_GET_CAPABILITY, NULL); + if (capabilty < 0) { + info("CDROM_GET_CAPABILITY failed"); + return -1; + } + + if (capabilty & CDC_CD_R) + cd_cd_r = 1; + if (capabilty & CDC_CD_RW) + cd_cd_rw = 1; + if (capabilty & CDC_DVD) + cd_dvd_rom = 1; + if (capabilty & CDC_DVD_R) + cd_dvd_r = 1; + if (capabilty & CDC_DVD_RAM) + cd_dvd_ram = 1; + if (capabilty & CDC_MRW) + cd_mrw = 1; + if (capabilty & CDC_MRW_W) + cd_mrw_w = 1; + return 0; +} + +static int cd_inquiry(int fd) { + struct scsi_cmd sc; + unsigned char inq[128]; + int err; + + scsi_cmd_set(&sc, 0, 0x12); + scsi_cmd_set(&sc, 4, 36); + scsi_cmd_set(&sc, 5, 0); + err = scsi_cmd_run(&sc, fd, inq, 36); + if ((err < 0)) { + info_scsi_cmd_err("INQUIRY", err); + return -1; + } + + if ((inq[0] & 0x1F) != 5) { + info("not an MMC unit"); + return -1; + } + + info("INQUIRY: [%.8s][%.16s][%.4s]", inq + 8, inq + 16, inq + 32); + return 0; +} + +static int cd_profiles(int fd) +{ + struct scsi_cmd sc; + unsigned char header[8]; + unsigned char profiles[512]; + unsigned int cur_profile; + unsigned int len; + unsigned int i; + int err; + + scsi_cmd_set(&sc, 0, 0x46); + scsi_cmd_set(&sc, 1, 0); + scsi_cmd_set(&sc, 8, sizeof(header)); + scsi_cmd_set(&sc, 9, 0); + err = scsi_cmd_run(&sc, fd, header, sizeof(header)); + if ((err < 0)) { + info_scsi_cmd_err("GET CONFIGURATION", err); + return -1; + } + + len = 4 + (header[0] << 24 | header[1] << 16 | header[2] << 8 | header[3]); + info("GET CONFIGURATION: number of profiles %i", len); + if (len > sizeof(profiles)) { + info("invalid number of profiles"); + return -1; + } + + scsi_cmd_set(&sc, 0, 0x46); + scsi_cmd_set(&sc, 1, 1); + scsi_cmd_set(&sc, 6, len >> 16); + scsi_cmd_set(&sc, 7, len >> 8); + scsi_cmd_set(&sc, 8, len); + scsi_cmd_set(&sc, 9, 0); + err = scsi_cmd_run(&sc, fd, profiles, len); + if ((err < 0)) { + info_scsi_cmd_err("GET CONFIGURATION", err); + return -1; + } + + /* device profiles */ + for (i = 12; i < profiles[11]; i += 4) { + unsigned int profile = (profiles[i] << 8 | profiles[i + 1]); + if (profile == 0) + continue; + info("profile 0x%02x", profile); + + switch (profile) { + case 0x03: + case 0x04: + case 0x05: + cd_mo = 1; + break; + case 0x10: + cd_dvd_rom = 1; + break; + case 0x12: + cd_dvd_ram = 1; + break; + case 0x13: + case 0x14: + cd_dvd_rw = 1; + break; + case 0x1B: + cd_dvd_plus_r = 1; + break; + case 0x1A: + cd_dvd_plus_rw = 1; + break; + case 0x2A: + cd_dvd_plus_rw_dl = 1; + break; + case 0x2B: + cd_dvd_plus_r_dl = 1; + break; + case 0x40: + cd_bd = 1; + break; + case 0x41: + case 0x42: + cd_bd_r = 1; + break; + case 0x43: + cd_bd_re = 1; + break; + case 0x50: + cd_hddvd = 1; + break; + case 0x51: + cd_hddvd_r = 1; + break; + case 0x52: + cd_hddvd_rw = 1; + break; + default: + break; + } + } + + /* current media profile */ + cur_profile = header[6] << 8 | header[7]; + info("current profile 0x%02x", cur_profile); + if (cur_profile == 0) { + info("no current profile, assuming no media"); + return -1; + } + + switch (cur_profile) { + case 0x03: + case 0x04: + case 0x05: + cd_media_mo = 1; + break; + case 0x08: + cd_media_cd_rom = 1; + break; + case 0x09: + cd_media_cd_r = 1; + break; + case 0x0a: + cd_media_cd_rw = 1; + break; + case 0x10: + cd_media_dvd_rom = 1; + break; + case 0x11: + cd_media_dvd_r = 1; + break; + case 0x12: + cd_media_dvd_ram = 1; + break; + case 0x13: + case 0x14: + cd_media_dvd_rw = 1; + break; + case 0x1B: + cd_media_dvd_plus_r = 1; + break; + case 0x1A: + cd_media_dvd_plus_rw = 1; + break; + case 0x2A: + cd_media_dvd_plus_rw_dl = 1; + break; + case 0x2B: + cd_media_dvd_plus_r_dl = 1; + break; + case 0x40: + cd_media_bd = 1; + break; + case 0x41: + case 0x42: + cd_media_bd_r = 1; + break; + case 0x43: + cd_media_bd_re = 1; + break; + case 0x50: + cd_media_hddvd = 1; + break; + case 0x51: + cd_media_hddvd_r = 1; + break; + case 0x52: + cd_media_hddvd_rw = 1; + break; + default: + break; + } + return 0; +} + +static int cd_media_info(int fd) +{ + struct scsi_cmd sc; + unsigned char header[32]; + static const char *media_status[] = { + "blank", + "appendable", + "complete", + "other" + }; + int err; + + scsi_cmd_set(&sc, 0, 0x51); + scsi_cmd_set(&sc, 8, sizeof(header)); + scsi_cmd_set(&sc, 9, 0); + err = scsi_cmd_run(&sc, fd, header, sizeof(header)); + if ((err < 0)) { + info_scsi_cmd_err("READ DISC INFORMATION", err); + return -1; + }; + + info("disk type %02x", header[8]); + + if ((header[2] & 3) < 4) + cd_media_state = media_status[header[2] & 3]; + if ((header[2] & 3) != 2) + cd_media_session_next = header[10] << 8 | header[5]; + cd_media_session_count = header[9] << 8 | header[4]; + cd_media_track_count = header[11] << 8 | header[6]; + + return 0; +} + +static int cd_media_toc(int fd) +{ + struct scsi_cmd sc; + unsigned char header[12]; + unsigned char toc[2048]; + unsigned int len, i; + unsigned char *p; + int err; + + scsi_cmd_set(&sc, 0, 0x43); + scsi_cmd_set(&sc, 6, 1); + scsi_cmd_set(&sc, 8, sizeof(header)); + scsi_cmd_set(&sc, 9, 0); + err = scsi_cmd_run(&sc, fd, header, sizeof(header)); + if ((err < 0)) { + info_scsi_cmd_err("READ TOC", err); + return -1; + } + + len = (header[0] << 8 | header[1]) + 2; + info("READ TOC: len: %d", len); + if (len > sizeof(toc)) + return -1; + + /* check if we have a data track */ + info("ctl %02x (0x04 is data/audio)", header[5]); + cd_media_has_audio = (header[5] & 0x04) == 0; + + scsi_cmd_set(&sc, 0, 0x43); + scsi_cmd_set(&sc, 6, header[2]); /* First Track/Session Number */ + scsi_cmd_set(&sc, 7, len >> 8); + scsi_cmd_set(&sc, 8, len); + scsi_cmd_set(&sc, 9, 0); + err = scsi_cmd_run(&sc, fd, toc, len); + if ((err < 0)) { + info_scsi_cmd_err("READ TOC (tracks)", err); + return -1; + } + + for (p = toc+4, i = 4; i < len-8; i += 8, p += 8) { + unsigned int block; + + block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; + info("track %u starts at block %u", p[2], block); + } + + scsi_cmd_set(&sc, 0, 0x43); + scsi_cmd_set(&sc, 2, 1); /* Session Info */ + scsi_cmd_set(&sc, 8, 12); + scsi_cmd_set(&sc, 9, 0); + err = scsi_cmd_run(&sc, fd, header, sizeof(header)); + if ((err < 0)) { + info_scsi_cmd_err("READ TOC (multi session)", err); + return -1; + } + len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; + info("last track %u starts at block %u", header[4+2], len); + cd_media_session_last_offset = (unsigned long long int)len * 2048; + return 0; +} + int main(int argc, char *argv[]) { + static const struct option options[] = { + { "export", 0, NULL, 'x' }, + { "debug", 0, NULL, 'd' }, + { "help", 0, NULL, 'h' }, + {} + }; const char *node = NULL; - int i; int export = 0; - int fd; + int fd = -1; int rc = 0; - int result; logging_init("cdrom_id"); - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; + while (1) { + int option; - if (strcmp(arg, "--export") == 0) { + option = getopt_long(argc, argv, "dxh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = 1; + break; + case 'x': export = 1; - } else - node = arg; + break; + case 'h': + printf("Usage: cdrom_id [options] \n" + " --export export key/value pairs\n" + " --help\n\n"); + goto exit; + default: + rc = 1; + goto exit; + } } + + node = argv[optind]; if (!node) { - info("no node specified"); + err("no device"); + fprintf(stderr, "no device\n"); rc = 1; goto exit; } - fd = open(node, O_RDONLY|O_NONBLOCK); + fd = open(node, O_RDONLY | O_NONBLOCK); if (fd < 0) { info("unable to open '%s'", node); rc = 1; goto exit; } + info("probing: '%s'", node); + + /* same data as original cdrom_id */ + if (cd_capability_compat(fd) < 0) { + rc = 1; + goto exit; + } - result = ioctl(fd, CDROM_GET_CAPABILITY, NULL); - if (result < 0) { - info("CDROM_GET_CAPABILITY failed for '%s'", node); - rc = 3; - goto close; + /* check drive */ + if (cd_inquiry(fd) < 0) { + rc = 2; + goto exit; } - printf("ID_CDROM=1\n"); + /* read drive and possibly current profile */ + if (cd_profiles(fd) < 0) + goto print; + + /* get session/track info */ + if (cd_media_toc(fd) < 0) + goto print; - if (result & CDC_CD_R) + /* get writable media state */ + if (cd_media_info(fd) < 0) + goto print; + +print: + printf("ID_CDROM=1\n"); + if (cd_cd_rom) + printf("ID_CDROM_CD=1\n"); + if (cd_cd_r) printf("ID_CDROM_CD_R=1\n"); - if (result & CDC_CD_RW) + if (cd_cd_rw) printf("ID_CDROM_CD_RW=1\n"); - - if (result & CDC_DVD) + if (cd_dvd_rom) printf("ID_CDROM_DVD=1\n"); - if (result & CDC_DVD_R) + if (cd_dvd_r) printf("ID_CDROM_DVD_R=1\n"); - if (result & CDC_DVD_RAM) + if (cd_dvd_rw) + printf("ID_CDROM_DVD_RW=1\n"); + if (cd_dvd_ram) printf("ID_CDROM_DVD_RAM=1\n"); - - if (result & CDC_MRW) + if (cd_dvd_plus_r) + printf("ID_CDROM_DVD_PLUS_R=1\n"); + if (cd_dvd_plus_rw) + printf("ID_CDROM_DVD_PLUS_RW=1\n"); + if (cd_dvd_plus_r_dl) + printf("ID_CDROM_DVD_PLUS_R_DL=1\n"); + if (cd_dvd_plus_rw_dl) + printf("ID_CDROM_DVD_PLUS_RW_DL=1\n"); + if (cd_bd) + printf("ID_CDROM_BD=1\n"); + if (cd_bd_r) + printf("ID_CDROM_BD_R=1\n"); + if (cd_bd_re) + printf("ID_CDROM_BD_RE=1\n"); + if (cd_hddvd) + printf("ID_CDROM_HDDVD=1\n"); + if (cd_hddvd_r) + printf("ID_CDROM_HDDVD_R=1\n"); + if (cd_hddvd_rw) + printf("ID_CDROM_HDDVD_RW=1\n"); + if (cd_mo) + printf("ID_CDROM_MO=1\n"); + if (cd_mrw) printf("ID_CDROM_MRW=1\n"); - if (result & CDC_MRW_W) + if (cd_mrw_w) printf("ID_CDROM_MRW_W=1\n"); - if (result & CDC_RAM) - printf("ID_CDROM_RAM=1\n"); -close: - close(fd); + if (cd_media_mo) + printf("ID_CDROM_MEDIA_MO=1\n"); + if (cd_media_mrw) + printf("ID_CDROM_MEDIA_MRW=1\n"); + if (cd_media_mrw_w) + printf("ID_CDROM_MEDIA_MRW_W=1\n"); + if (cd_media_cd_rom) + printf("ID_CDROM_MEDIA_CD=1\n"); + if (cd_media_cd_r) + printf("ID_CDROM_MEDIA_CD_R=1\n"); + if (cd_media_cd_rw) + printf("ID_CDROM_MEDIA_CD_RW=1\n"); + if (cd_media_dvd_rom) + printf("ID_CDROM_MEDIA_DVD=1\n"); + if (cd_media_dvd_r) + printf("ID_CDROM_MEDIA_DVD_R=1\n"); + if (cd_media_dvd_ram) + printf("ID_CDROM_MEDIA_DVD_RAM=1\n"); + if (cd_media_dvd_rw) + printf("ID_CDROM_MEDIA_DVD_RW=1\n"); + if (cd_media_dvd_plus_r) + printf("ID_CDROM_MEDIA_DVD_PLUS_R=1\n"); + if (cd_media_dvd_plus_rw) + printf("ID_CDROM_MEDIA_DVD_PLUS_RW=1\n"); + if (cd_media_dvd_plus_rw_dl) + printf("ID_CDROM_MEDIA_DVD_PLUS_RW_DL=1\n"); + if (cd_media_dvd_plus_r_dl) + printf("ID_CDROM_MEDIA_DVD_PLUS_R_DL=1\n"); + if (cd_media_bd) + printf("ID_CDROM_MEDIA_BD=1\n"); + if (cd_media_bd_r) + printf("ID_CDROM_MEDIA_BD_R=1\n"); + if (cd_media_bd_re) + printf("ID_CDROM_MEDIA_BD_RE=1\n"); + if (cd_media_hddvd) + printf("ID_CDROM_MEDIA_HDDVD=1\n"); + if (cd_media_hddvd_r) + printf("ID_CDROM_MEDIA_HDDVD_R=1\n"); + if (cd_media_hddvd_rw) + printf("ID_CDROM_MEDIA_HDDVD_RW=1\n"); + + if (cd_media_state != NULL) + printf("ID_CDROM_MEDIA_STATE=%s\n", cd_media_state); + if (cd_media_has_audio) + printf("ID_CDROM_MEDIA_HAS_AUDIO=1\n"); + if (cd_media_session_next > 0) + printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); + if (cd_media_session_count > 0) + printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); + if (cd_media_track_count > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); + if (cd_media_session_last_offset) + printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); exit: + if (fd >= 0) + close(fd); logging_close(); return rc; } + -- cgit v1.2.3-54-g00ecf From 798d7ab60c476a2c7bcef6918a40dce1756204d1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Apr 2008 21:35:40 +0200 Subject: udevd: at startup write message including version number to kernel log --- udevd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/udevd.c b/udevd.c index 493bb54514..530fc59a36 100644 --- a/udevd.c +++ b/udevd.c @@ -1116,6 +1116,14 @@ int main(int argc, char *argv[], char *envp[]) close(fd); } + fd = open("/dev/kmsg", O_WRONLY); + if (fd > 0) { + const char *str = "<6>udevd version " UDEV_VERSION " started\n"; + + write(fd, str, strlen(str)); + close(fd); + } + /* set signal handlers */ memset(&act, 0x00, sizeof(struct sigaction)); act.sa_handler = (void (*)(int)) sig_handler; -- cgit v1.2.3-54-g00ecf From e6d70ed63a03f39de148e6b0afb47cbbc5ec78eb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Apr 2008 00:21:51 +0200 Subject: rules_generator: net rules - always add KERNEL== match to generated rules --- extras/rule_generator/75-persistent-net-generator.rules | 2 +- extras/rule_generator/write_net_rules | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 2aa3076a59..85a4c5b55b 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -18,7 +18,7 @@ SUBSYSTEM!="net", GOTO="persistent_net_generator_end" NAME=="?*", GOTO="persistent_net_generator_end" # device name whitelist -KERNEL!="eth*|ath*|wlan*[0-9]|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" +KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" # ignore Xen virtual interfaces SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index 765e56f6d3..322398bce4 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -92,6 +92,9 @@ if [ -z "$match" ]; then exit 1 fi +basename=${INTERFACE%%[0-9]*} +match="$match, KERNEL==\"$basename*\"" + if [ "$INTERFACE_NAME" ]; then # external tools may request a custom name COMMENT="$COMMENT (custom name provided by external tool)" @@ -101,8 +104,6 @@ if [ "$INTERFACE_NAME" ]; then fi else # if a rule using the current name already exists, find a new name - basename=${INTERFACE%%[0-9]*} - match="$match, KERNEL==\"$basename*\"" if interface_name_taken; then INTERFACE="$basename$(find_next_available "$basename[0-9]*")" echo "INTERFACE_NEW=$INTERFACE" -- cgit v1.2.3-54-g00ecf From 6056d9b3400fe0349d86636cbbf93f069bb5639a Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 17 Apr 2008 16:03:03 +0200 Subject: selinux: more context settings Signed-off-by: Harald Hoyer --- udev_db.c | 6 +++++- udev_rules_parse.c | 2 ++ udev_utils_file.c | 7 ++++++- udevd.c | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/udev_db.c b/udev_db.c index 518ace9a5d..444725329f 100644 --- a/udev_db.c +++ b/udev_db.c @@ -144,8 +144,12 @@ int udev_db_add_device(struct udevice *udev) */ if (list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && !udev->partitions && !udev->ignore_remove) { + int ret; dbg("nothing interesting to store, create symlink"); - if (symlink(udev->name, filename) != 0) { + selinux_setfscreatecon(filename, NULL, S_IFLNK); + ret = symlink(udev->name, filename); + selinux_resetfscreatecon(); + if (ret != 0) { err("unable to create db link '%s': %s", filename, strerror(errno)); return -1; } diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 9e435819f0..d2392c36e0 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -745,7 +745,9 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); if (stat(filename, &statbuf) != 0) { create_path(filename); + selinux_setfscreatecon(filename, NULL, S_IFDIR|0755); mkdir(filename, 0755); + selinux_resetfscreatecon(); } add_matching_files(&dyn_list, filename, RULESFILE_SUFFIX); diff --git a/udev_utils_file.c b/udev_utils_file.c index 0ceefe1720..9ab34705e2 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -35,6 +35,7 @@ int create_path(const char *path) char p[PATH_SIZE]; char *pos; struct stat stats; + int ret; strlcpy(p, path, sizeof(p)); pos = strrchr(p, '/'); @@ -53,8 +54,12 @@ int create_path(const char *path) return -1; dbg("mkdir '%s'", p); - if (mkdir(p, 0755) == 0) + selinux_setfscreatecon(p, NULL, S_IFDIR|0755); + ret = mkdir(p, 0755); + selinux_resetfscreatecon(); + if (ret == 0) return 0; + if (errno == EEXIST) if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) return 0; diff --git a/udevd.c b/udevd.c index 530fc59a36..7786ae6b8d 100644 --- a/udevd.c +++ b/udevd.c @@ -168,7 +168,9 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st delete_path(filename_failed); create_path(filename); + selinux_setfscreatecon(filename, NULL, S_IFLNK); symlink(msg->devpath, filename); + selinux_resetfscreatecon(); break; case EVENT_FINISHED: if (msg->devpath_old != NULL) { -- cgit v1.2.3-54-g00ecf From 4278ab015d76876f61821b293df07e0c3746bfd5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 Apr 2008 23:31:09 +0200 Subject: selinux: fix missing includes --- udev_db.c | 1 + udev_rules.c | 1 + udev_rules_parse.c | 1 + udev_utils_file.c | 1 + 4 files changed, 4 insertions(+) diff --git a/udev_db.c b/udev_db.c index 444725329f..1feab7d63f 100644 --- a/udev_db.c +++ b/udev_db.c @@ -31,6 +31,7 @@ #include #include "udev.h" +#include "udev_selinux.h" static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len) diff --git a/udev_rules.c b/udev_rules.c index eccea3b57c..6565a2e51d 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -35,6 +35,7 @@ #include "udev.h" #include "udev_rules.h" +#include "udev_selinux.h" extern char **environ; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index d2392c36e0..ce659d73ce 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -28,6 +28,7 @@ #include "udev.h" #include "udev_rules.h" +#include "udev_selinux.h" void udev_rules_iter_init(struct udev_rules *rules) diff --git a/udev_utils_file.c b/udev_utils_file.c index 9ab34705e2..19668b936f 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -29,6 +29,7 @@ #include #include "udev.h" +#include "udev_selinux.h" int create_path(const char *path) { -- cgit v1.2.3-54-g00ecf From cf100ca71bf365d8898e97d4ec9dd05c3941cae8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Apr 2008 21:07:29 +0200 Subject: allow setting of MODE="0000" --- test/udev-test.pl | 10 ++++++++++ udev_rules.c | 10 +++++----- udev_rules.h | 3 +-- udev_rules_parse.c | 3 +-- 4 files changed, 17 insertions(+), 9 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 2621e2b13a..fee62a6406 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1605,6 +1605,16 @@ EOF exp_name => "found-subdir", rules => < "TEST MODE=0000", + subsys => "block", + devpath => "/block/sda", + exp_name => "sda", + exp_perms => "0:0:0000", + rules => <mode_final && rule->mode != 0000) { - if (rule->mode_operation == KEY_OP_ASSIGN_FINAL) + if (!udev->mode_final && rule->mode.operation != KEY_OP_UNSET) { + if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) udev->mode_final = 1; - udev->mode = rule->mode; - dbg("applied mode=%#o to '%s'", rule->mode, udev->dev->kernel); + udev->mode = strtol(key_val(rule, &rule->mode), NULL, 8); + dbg("applied mode=%#o to '%s'", udev->mode, udev->dev->kernel); } if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) @@ -1534,7 +1534,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL || rule->symlink.operation == KEY_OP_ADD || - rule->mode_operation != KEY_OP_UNSET || + rule->mode.operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { dbg("skip rule that names a device"); continue; diff --git a/udev_rules.h b/udev_rules.h index 0ad4ec3271..a84b0de837 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -93,8 +93,7 @@ struct udev_rule { struct key symlink_match; struct key owner; struct key group; - mode_t mode; - enum key_operation mode_operation; + struct key mode; enum escape_type string_escape; unsigned int link_priority; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index ce659d73ce..6d88354dbd 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -579,8 +579,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strcasecmp(key, "MODE") == 0) { - rule->mode = strtol(value, NULL, 8); - rule->mode_operation = operation; + add_rule_key(rule, &rule->mode, operation, value); valid = 1; continue; } -- cgit v1.2.3-54-g00ecf From 1d918b50cddc975abbfd06af134a6d843d9bc7f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Apr 2008 21:08:07 +0200 Subject: path_id: remove subsystem whitelist --- extras/path_id/path_id | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index a3a627e407..7a37700289 100755 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -549,7 +549,7 @@ handle_device () { ;; *) mode="" - ;; + ;; esac if [ "$d" ]; then d="$d-${rewind}st${mode}" @@ -557,22 +557,9 @@ handle_device () { fi } -case "$TYPE" in - block) - handle_device - echo "ID_PATH=$d" - ;; - scsi_tape) - handle_device - echo "ID_PATH=$d" - ;; - input) - handle_device - echo "ID_PATH=$d" - ;; - *) - RESULT=1 - ;; -esac - -exit $RESULT +handle_device +if [ -z "$d" ]; then + exit 1 +fi +echo "ID_PATH=$d" +exit 0 -- cgit v1.2.3-54-g00ecf From c70560feef0eb61a150cd2f956f0beead4313ffe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Apr 2008 21:07:06 +0200 Subject: logging: add trailing newline to all strings --- extras/ata_id/ata_id.c | 8 +- extras/cdrom_id/cdrom_id.c | 37 +++-- extras/edd_id/edd_id.c | 28 ++-- extras/scsi_id/scsi_id.c | 40 +++--- extras/scsi_id/scsi_serial.c | 76 +++++----- extras/usb_id/usb_id.c | 24 ++-- extras/volume_id/lib/adaptec_raid.c | 2 +- extras/volume_id/lib/cramfs.c | 2 +- extras/volume_id/lib/ddf_raid.c | 2 +- extras/volume_id/lib/ext.c | 6 +- extras/volume_id/lib/fat.c | 40 +++--- extras/volume_id/lib/gfs.c | 2 +- extras/volume_id/lib/hfs.c | 32 ++--- extras/volume_id/lib/highpoint.c | 4 +- extras/volume_id/lib/hpfs.c | 2 +- extras/volume_id/lib/iso9660.c | 12 +- extras/volume_id/lib/isw_raid.c | 2 +- extras/volume_id/lib/jfs.c | 2 +- extras/volume_id/lib/jmicron_raid.c | 2 +- extras/volume_id/lib/linux_raid.c | 4 +- extras/volume_id/lib/linux_swap.c | 2 +- extras/volume_id/lib/lsi_raid.c | 2 +- extras/volume_id/lib/lvm.c | 6 +- extras/volume_id/lib/minix.c | 2 +- extras/volume_id/lib/netware.c | 2 +- extras/volume_id/lib/ntfs.c | 24 ++-- extras/volume_id/lib/nvidia_raid.c | 2 +- extras/volume_id/lib/ocfs.c | 6 +- extras/volume_id/lib/promise_raid.c | 2 +- extras/volume_id/lib/reiserfs.c | 2 +- extras/volume_id/lib/romfs.c | 2 +- extras/volume_id/lib/silicon_raid.c | 2 +- extras/volume_id/lib/squashfs.c | 2 +- extras/volume_id/lib/sysv.c | 2 +- extras/volume_id/lib/udf.c | 12 +- extras/volume_id/lib/ufs.c | 8 +- extras/volume_id/lib/util.c | 28 ++-- extras/volume_id/lib/via_raid.c | 2 +- extras/volume_id/lib/volume_id.c | 6 +- extras/volume_id/lib/vxfs.c | 2 +- extras/volume_id/lib/xfs.c | 2 +- extras/volume_id/vol_id.c | 6 +- test-udev.c | 8 +- udev_config.c | 14 +- udev_db.c | 30 ++-- udev_device.c | 40 +++--- udev_node.c | 68 ++++----- udev_rules.c | 268 ++++++++++++++++++------------------ udev_rules_parse.c | 128 ++++++++--------- udev_selinux.c | 18 +-- udev_sysfs.c | 52 +++---- udev_utils.c | 22 +-- udev_utils_file.c | 14 +- udevadm.c | 11 +- udevcontrol.c | 16 +-- udevd.8 | 4 +- udevd.c | 147 ++++++++++---------- udevd.xml | 4 +- udevinfo.c | 16 +-- udevsettle.c | 16 +-- udevtest.c | 10 +- udevtrigger.c | 8 +- 62 files changed, 671 insertions(+), 674 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index f94cdc0fd3..6d3c2330b4 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -126,24 +126,24 @@ int main(int argc, char *argv[]) node = argv[optind]; if (node == NULL) { - err("no node specified"); + err("no node specified\n"); rc = 1; goto exit; } fd = open(node, O_RDONLY|O_NONBLOCK); if (fd < 0) { - err("unable to open '%s'", node); + err("unable to open '%s'\n", node); rc = 1; goto exit; } if (ioctl(fd, HDIO_GET_IDENTITY, &id)) { if (errno == ENOTTY) { - info("HDIO_GET_IDENTITY unsupported for '%s'", node); + info("HDIO_GET_IDENTITY unsupported for '%s'\n", node); rc = 2; } else { - err("HDIO_GET_IDENTITY failed for '%s'", node); + err("HDIO_GET_IDENTITY failed for '%s'\n", node); rc = 3; } goto close; diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 315d27610f..b88f5b4b1e 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -71,7 +71,6 @@ void log_message(int priority, const char *format, ...) if (debug) { fprintf(stderr, "[%d] ", (int) getpid()); vfprintf(stderr, format, args); - fprintf(stderr, "\n"); } else vsyslog(priority, format, args); va_end(args); @@ -137,10 +136,10 @@ static unsigned long long int cd_media_session_last_offset; static void info_scsi_cmd_err(const char *cmd, int err) { if (err == -1) { - info("%s failed", cmd); + info("%s failed\n", cmd); return; } - info("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh", cmd, SK(err), ASC(err), ASCQ(err)); + info("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); } struct scsi_cmd { @@ -199,7 +198,7 @@ static int cd_capability_compat(int fd) capabilty = ioctl(fd, CDROM_GET_CAPABILITY, NULL); if (capabilty < 0) { - info("CDROM_GET_CAPABILITY failed"); + info("CDROM_GET_CAPABILITY failed\n"); return -1; } @@ -235,11 +234,11 @@ static int cd_inquiry(int fd) { } if ((inq[0] & 0x1F) != 5) { - info("not an MMC unit"); + info("not an MMC unit\n"); return -1; } - info("INQUIRY: [%.8s][%.16s][%.4s]", inq + 8, inq + 16, inq + 32); + info("INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); return 0; } @@ -264,9 +263,9 @@ static int cd_profiles(int fd) } len = 4 + (header[0] << 24 | header[1] << 16 | header[2] << 8 | header[3]); - info("GET CONFIGURATION: number of profiles %i", len); + info("GET CONFIGURATION: number of profiles %i\n", len); if (len > sizeof(profiles)) { - info("invalid number of profiles"); + info("invalid number of profiles\n"); return -1; } @@ -287,7 +286,7 @@ static int cd_profiles(int fd) unsigned int profile = (profiles[i] << 8 | profiles[i + 1]); if (profile == 0) continue; - info("profile 0x%02x", profile); + info("profile 0x%02x\n", profile); switch (profile) { case 0x03: @@ -343,9 +342,9 @@ static int cd_profiles(int fd) /* current media profile */ cur_profile = header[6] << 8 | header[7]; - info("current profile 0x%02x", cur_profile); + info("current profile 0x%02x\n", cur_profile); if (cur_profile == 0) { - info("no current profile, assuming no media"); + info("no current profile, assuming no media\n"); return -1; } @@ -435,7 +434,7 @@ static int cd_media_info(int fd) return -1; }; - info("disk type %02x", header[8]); + info("disk type %02x\n", header[8]); if ((header[2] & 3) < 4) cd_media_state = media_status[header[2] & 3]; @@ -467,12 +466,12 @@ static int cd_media_toc(int fd) } len = (header[0] << 8 | header[1]) + 2; - info("READ TOC: len: %d", len); + info("READ TOC: len: %d\n", len); if (len > sizeof(toc)) return -1; /* check if we have a data track */ - info("ctl %02x (0x04 is data/audio)", header[5]); + info("ctl %02x (0x04 is data/audio)\n", header[5]); cd_media_has_audio = (header[5] & 0x04) == 0; scsi_cmd_set(&sc, 0, 0x43); @@ -490,7 +489,7 @@ static int cd_media_toc(int fd) unsigned int block; block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; - info("track %u starts at block %u", p[2], block); + info("track %u starts at block %u\n", p[2], block); } scsi_cmd_set(&sc, 0, 0x43); @@ -503,7 +502,7 @@ static int cd_media_toc(int fd) return -1; } len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; - info("last track %u starts at block %u", header[4+2], len); + info("last track %u starts at block %u\n", header[4+2], len); cd_media_session_last_offset = (unsigned long long int)len * 2048; return 0; } @@ -550,7 +549,7 @@ int main(int argc, char *argv[]) node = argv[optind]; if (!node) { - err("no device"); + err("no device\n"); fprintf(stderr, "no device\n"); rc = 1; goto exit; @@ -558,11 +557,11 @@ int main(int argc, char *argv[]) fd = open(node, O_RDONLY | O_NONBLOCK); if (fd < 0) { - info("unable to open '%s'", node); + info("unable to open '%s'\n", node); rc = 1; goto exit; } - info("probing: '%s'", node); + info("probing: '%s'\n", node); /* same data as original cdrom_id */ if (cd_capability_compat(fd) < 0) { diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 4ba89ede89..4a177709a8 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -75,7 +75,7 @@ int main(int argc, char *argv[]) node = arg; } if (node == NULL) { - err("no node specified"); + err("no node specified\n"); fprintf(stderr, "no node specified\n"); goto exit; } @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) /* check for kernel support */ dir = opendir("/sys/firmware/edd"); if (dir == NULL) { - info("no kernel EDD support"); + info("no kernel EDD support\n"); fprintf(stderr, "no kernel EDD support\n"); rc = 2; goto exit; @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) disk_fd = open(node, O_RDONLY); if (disk_fd < 0) { - info("unable to open '%s'", node); + info("unable to open '%s'\n", node); fprintf(stderr, "unable to open '%s'\n", node); rc = 3; goto closedir; @@ -99,38 +99,38 @@ int main(int argc, char *argv[]) /* check for valid MBR signature */ if (lseek(disk_fd, 510, SEEK_SET) < 0) { - info("seek to MBR validity failed '%s'", node); + info("seek to MBR validity failed '%s'\n", node); rc = 4; goto close; } if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { - info("read MBR validity failed '%s'", node); + info("read MBR validity failed '%s'\n", node); rc = 5; goto close; } if (mbr_valid != 0xAA55) { fprintf(stderr, "no valid MBR signature '%s'\n", node); - info("no valid MBR signature '%s'", node); + info("no valid MBR signature '%s'\n", node); rc=6; goto close; } /* read EDD signature */ if (lseek(disk_fd, 440, SEEK_SET) < 0) { - info("seek to signature failed '%s'", node); + info("seek to signature failed '%s'\n", node); rc = 7; goto close; } if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { - info("read signature failed '%s'", node); + info("read signature failed '%s'\n", node); rc = 8; goto close; } /* all zero is invalid */ - info("read id 0x%08x from '%s'", disk_id, node); + info("read id 0x%08x from '%s'\n", disk_id, node); if (disk_id == 0) { fprintf(stderr, "no EDD signature '%s'\n", node); - info("'%s' signature is zero", node); + info("'%s' signature is zero\n", node); rc = 9; goto close; } @@ -150,18 +150,18 @@ int main(int argc, char *argv[]) sysfs_fd = open(file, O_RDONLY); if (sysfs_fd < 0) { - info("unable to open sysfs '%s'", file); + info("unable to open sysfs '%s'\n", file); continue; } size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); close(sysfs_fd); if (size <= 0) { - info("read sysfs '%s' failed", file); + info("read sysfs '%s' failed\n", file); continue; } sysfs_id_buf[size] = '\0'; - info("read '%s' from '%s'", sysfs_id_buf, file); + info("read '%s' from '%s'\n", sysfs_id_buf, file); sysfs_id = strtoul(sysfs_id_buf, NULL, 16); /* look for matching value, that appears only once */ @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) strlcpy(match, dent->d_name, sizeof(match)); } else { /* error, same signature for another device */ - info("'%s' does not have a unique signature", node); + info("'%s' does not have a unique signature\n", node); fprintf(stderr, "'%s' does not have a unique signature\n", node); rc = 10; goto exit; diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index d8b269a950..463b3775cf 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -174,25 +174,25 @@ static int create_tmp_dev(const char *devpath, char *tmpdev, int dev_type) unsigned int maj, min; const char *attr; - dbg("%s", devpath); + dbg("%s\n", devpath); attr = sysfs_attr_get_value(devpath, "dev"); if (attr == NULL) { - dbg("%s: could not get dev attribute: %s", devpath, strerror(errno)); + dbg("%s: could not get dev attribute: %s\n", devpath, strerror(errno)); return -1; } - dbg("dev value %s", attr); + dbg("dev value %s\n", attr); if (sscanf(attr, "%u:%u", &maj, &min) != 2) { - err("%s: invalid dev major/minor", devpath); + err("%s: invalid dev major/minor\n", devpath); return -1; } snprintf(tmpdev, MAX_PATH_LEN, "%s/%s-maj%d-min%d-%u", TMP_DIR, TMP_PREFIX, maj, min, getpid()); - dbg("tmpdev '%s'", tmpdev); + dbg("tmpdev '%s'\n", tmpdev); if (mknod(tmpdev, 0600 | dev_type, makedev(maj, min))) { - err("mknod failed: %s", strerror(errno)); + err("mknod failed: %s\n", strerror(errno)); return -1; } return 0; @@ -273,7 +273,7 @@ static int get_file_options(const char *vendor, const char *model, if (errno == ENOENT) { return 1; } else { - err("can't open %s: %s", config_file, strerror(errno)); + err("can't open %s: %s\n", config_file, strerror(errno)); return -1; } } @@ -285,7 +285,7 @@ static int get_file_options(const char *vendor, const char *model, */ buffer = malloc(MAX_BUFFER_LEN); if (!buffer) { - err("Can't allocate memory."); + err("can't allocate memory\n"); return -1; } @@ -299,7 +299,7 @@ static int get_file_options(const char *vendor, const char *model, break; lineno++; if (buf[strlen(buffer) - 1] != '\n') { - info("Config file line %d too long.\n", lineno); + info("Config file line %d too long\n", lineno); break; } @@ -344,14 +344,14 @@ static int get_file_options(const char *vendor, const char *model, } options_in = str1; } - dbg("config file line %d:" + dbg("config file line %d:\n" " vendor '%s'; model '%s'; options '%s'\n", lineno, vendor_in, model_in, options_in); /* * Only allow: [vendor=foo[,model=bar]]options=stuff */ if (!options_in || (!vendor_in && model_in)) { - info("Error parsing config file line %d '%s'", lineno, buffer); + info("Error parsing config file line %d '%s'\n", lineno, buffer); retval = -1; break; } @@ -389,7 +389,7 @@ static int get_file_options(const char *vendor, const char *model, c = argc_count(buffer) + 2; *newargv = calloc(c, sizeof(**newargv)); if (!*newargv) { - err("Can't allocate memory."); + err("can't allocate memory\n"); retval = -1; } else { *argc = c; @@ -492,7 +492,7 @@ static int set_options(int argc, char **argv, const char *short_opts, } else if (strcmp(optarg, "pre-spc3-83") == 0) { default_page_code = PAGE_83_PRE_SPC3; } else { - info("Unknown page code '%s'", optarg); + info("Unknown page code '%s'\n", optarg); return -1; } break; @@ -571,13 +571,13 @@ static int per_dev_options(struct sysfs_device *dev_scsi, int *good_bad, int *pa } else if (strcmp(optarg, "pre-spc3-83") == 0) { *page_code = PAGE_83_PRE_SPC3; } else { - info("Unknown page code '%s'", optarg); + info("Unknown page code '%s'\n", optarg); retval = -1; } break; default: - info("Unknown or bad option '%c' (0x%x)", option, option); + info("Unknown or bad option '%c' (0x%x)\n", option, option); retval = -1; break; } @@ -596,7 +596,7 @@ static int set_sysfs_values(struct sysfs_device *dev_scsi) vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!vendor) { - info("%s: cannot get vendor attribute", dev_scsi->devpath); + info("%s: cannot get vendor attribute\n", dev_scsi->devpath); return -1; } set_str(vendor_str, vendor, sizeof(vendor_str)-1); @@ -610,7 +610,7 @@ static int set_sysfs_values(struct sysfs_device *dev_scsi) type = sysfs_attr_get_value(dev_scsi->devpath, "type"); if (!type) { - info("%s: cannot get type attribute", dev_scsi->devpath); + info("%s: cannot get type attribute\n", dev_scsi->devpath); return -1; } set_type(type_str, type, sizeof(type_str)); @@ -690,7 +690,7 @@ static int scsi_id(const char *devpath, char *maj_min_dev) dev = sysfs_device_get(devpath); if (dev == NULL) { - err("unable to access '%s'", devpath); + err("unable to access '%s'\n", devpath); return 1; } @@ -709,7 +709,7 @@ static int scsi_id(const char *devpath, char *maj_min_dev) /* get scsi parent device */ dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); if (dev_scsi == NULL) { - err("unable to access parent device of '%s'", devpath); + err("unable to access parent device of '%s'\n", devpath); return 1; } set_sysfs_values(dev_scsi); @@ -721,7 +721,7 @@ static int scsi_id(const char *devpath, char *maj_min_dev) /* get per device (vendor + model) options from the config file */ retval = per_dev_options(dev_scsi, &good_dev, &page_code); - dbg("per dev options: good %d; page code 0x%x", good_dev, page_code); + dbg("per dev options: good %d; page code 0x%x\n", good_dev, page_code); if (!good_dev) { retval = 1; diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index c84f41e043..28e82db3ca 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -179,7 +179,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) sb_len = io->sb_len_wr; if (sb_len < 1) { - info("%s: sense buffer empty", dev_scsi->kernel); + info("%s: sense buffer empty\n", dev_scsi->kernel); return -1; } @@ -193,7 +193,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) */ s = sense_buffer[7] + 8; if (sb_len < s) { - info("%s: sense buffer too small %d bytes, %d bytes too short", + info("%s: sense buffer too small %d bytes, %d bytes too short\n", dev_scsi->kernel, sb_len, s - sb_len); return -1; } @@ -204,7 +204,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) /* * Possible? */ - info("%s: sense result too" " small %d bytes", + info("%s: sense result too" " small %d bytes\n", dev_scsi->kernel, s); return -1; } @@ -216,25 +216,25 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) asc = sense_buffer[2]; ascq = sense_buffer[3]; } else { - info("%s: invalid sense code 0x%x", + info("%s: invalid sense code 0x%x\n", dev_scsi->kernel, code); return -1; } - info("%s: sense key 0x%x ASC 0x%x ASCQ 0x%x", + info("%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", dev_scsi->kernel, sense_key, asc, ascq); } else { if (sb_len < 4) { - info("%s: sense buffer too small %d bytes, %d bytes too short", + info("%s: sense buffer too small %d bytes, %d bytes too short\n", dev_scsi->kernel, sb_len, 4 - sb_len); return -1; } if (sense_buffer[0] < 15) - info("%s: old sense key: 0x%x", dev_scsi->kernel, sense_buffer[0] & 0x0f); + info("%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); else - info("%s: sense = %2x %2x", + info("%s: sense = %2x %2x\n", dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); - info("%s: non-extended sense class %d code 0x%0x", + info("%s: non-extended sense class %d code 0x%0x\n", dev_scsi->kernel, sense_class, code); } @@ -247,8 +247,8 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) out_buffer[j++] = ' '; } out_buffer[j] = '\0'; - info("%s: sense dump:", dev_scsi->kernel); - info("%s: %s", dev_scsi->kernel, out_buffer); + info("%s: sense dump:\n", dev_scsi->kernel); + info("%s: %s\n", dev_scsi->kernel, out_buffer); #endif return -1; @@ -261,11 +261,11 @@ static int scsi_dump(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) /* * Impossible, should not be called. */ - info("%s: called with no error", __FUNCTION__); + info("%s: called with no error\n", __FUNCTION__); return -1; } - info("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x", + info("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); if (io->status == SCSI_CHECK_CONDITION) return scsi_dump_sense(dev_scsi, io); @@ -285,7 +285,7 @@ static int scsi_inquiry(struct sysfs_device *dev_scsi, int fd, int retry = 3; /* rather random */ if (buflen > SCSI_INQ_BUFF_LEN) { - info("buflen %d too long", buflen); + info("buflen %d too long\n", buflen); return -1; } @@ -304,7 +304,7 @@ resend: io_hdr.timeout = DEF_TIMEOUT; if (ioctl(fd, SG_IO, &io_hdr) < 0) { - info("%s: ioctl failed: %s", dev_scsi->kernel, strerror(errno)); + info("%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); retval = -1; goto error; } @@ -336,7 +336,7 @@ resend: error: if (retval < 0) - info("%s: Unable to get INQUIRY vpd %d page 0x%x.", + info("%s: Unable to get INQUIRY vpd %d page 0x%x.\n", dev_scsi->kernel, evpd, page); return retval; @@ -355,11 +355,11 @@ static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, return 1; if (buffer[1] != 0) { - info("%s: page 0 not available.", dev_scsi->kernel); + info("%s: page 0 not available.\n", dev_scsi->kernel); return 1; } if (buffer[3] > len) { - info("%s: page 0 buffer too long %d", dev_scsi->kernel, buffer[3]); + info("%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); return 1; } @@ -377,11 +377,11 @@ static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, */ vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!vendor) { - info("%s: cannot get model attribute", dev_scsi->kernel); + info("%s: cannot get model attribute\n", dev_scsi->kernel); return 1; } if (!strncmp((char *)&buffer[VENDOR_LENGTH], vendor, VENDOR_LENGTH)) { - info("%s: invalid page0 data", dev_scsi->kernel); + info("%s: invalid page0 data\n", dev_scsi->kernel); return 1; } } @@ -399,7 +399,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) attr = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!attr) { - info("%s: cannot get vendor attribute", dev_scsi->kernel); + info("%s: cannot get vendor attribute\n", dev_scsi->kernel); return 1; } strncpy(serial, attr, VENDOR_LENGTH); @@ -407,7 +407,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) attr = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!attr) { - info("%s: cannot get model attribute", dev_scsi->kernel); + info("%s: cannot get model attribute\n", dev_scsi->kernel); return 1; } strncat(serial, attr, MODEL_LENGTH); @@ -419,7 +419,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) * above, ind will never be too large. */ if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { - info("%s: expected length %d, got length %d", + info("%s: expected length %d, got length %d\n", dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); return 1; } @@ -477,7 +477,7 @@ static int check_fill_0x83_id(struct sysfs_device *dev_scsi, len += VENDOR_LENGTH + MODEL_LENGTH; if (max_len < len) { - info("%s: length %d too short - need %d", + info("%s: length %d too short - need %d\n", dev_scsi->kernel, max_len, len); return 1; } @@ -528,7 +528,7 @@ static int check_fill_0x83_prespc3(struct sysfs_device *dev_scsi, { int i, j; - dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); + dbg("using pre-spc3-83 for %s\n", dev_scsi->kernel); serial[0] = hex_str[id_search->id_type]; /* serial has been memset to zero before */ j = strlen(serial); /* j = 1; */ @@ -557,7 +557,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, return 1; if (page_83[1] != PAGE_83) { - info("%s: Invalid page 0x83", dev_scsi->kernel); + info("%s: Invalid page 0x83\n", dev_scsi->kernel); return 1; } @@ -613,13 +613,13 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, id_search_list[id_ind].naa_type, id_search_list[id_ind].code_set); if (!retval) { - dbg(" used\n"); + dbg(" used\n"); return retval; } else if (retval < 0) { - dbg(" failed\n"); + dbg(" failed\n"); return retval; } else { - dbg(" not used\n"); + dbg(" not used\n"); } } } @@ -646,7 +646,7 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, return 1; if (page_83[1] != PAGE_83) { - info("%s: Invalid page 0x83", dev_scsi->kernel); + info("%s: Invalid page 0x83\n", dev_scsi->kernel); return 1; } /* @@ -690,7 +690,7 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, serial[j++] = hex_str[page_83[i] & 0x0f]; i++; } - dbg("using pre-spc3-83 for %s.\n", dev_scsi->kernel); + dbg("using pre-spc3-83 for %s\n", dev_scsi->kernel); return 0; } @@ -710,13 +710,13 @@ static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, return retval; if (buf[1] != PAGE_80) { - info("%s: Invalid page 0x80", dev_scsi->kernel); + info("%s: Invalid page 0x80\n", dev_scsi->kernel); return 1; } len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; if (max_len < len) { - info("%s: length %d too short - need %d", + info("%s: length %d too short - need %d\n", dev_scsi->kernel, max_len, len); return 1; } @@ -746,7 +746,7 @@ int scsi_std_inquiry(struct sysfs_device *dev_scsi, const char *devname, dbg("opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { - info("%s: cannot open %s: %s", + info("%s: cannot open %s: %s\n", dev_scsi->kernel, devname, strerror(errno)); return 1; } @@ -762,7 +762,7 @@ int scsi_std_inquiry(struct sysfs_device *dev_scsi, const char *devname, sprintf(type,"%x", buf[0] & 0x1f); if (close(fd) < 0) - info("%s: close failed: %s", dev_scsi->kernel, strerror(errno)); + info("%s: close failed: %s\n", dev_scsi->kernel, strerror(errno)); return 0; } @@ -779,7 +779,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, dbg("opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { - info("%s: cannot open %s: %s", + info("%s: cannot open %s: %s\n", dev_scsi->kernel, devname, strerror(errno)); return 1; } @@ -826,7 +826,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, goto completed; } } else if (page_code != 0x00) { - info("%s: unsupported page code 0x%d", dev_scsi->kernel, page_code); + info("%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); return 1; } @@ -870,6 +870,6 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, retval = 1; completed: if (close(fd) < 0) - info("%s: close failed: %s", dev_scsi->kernel, strerror(errno)); + info("%s: close failed: %s\n", dev_scsi->kernel, strerror(errno)); return retval; } diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 5fb030db56..fed6631b90 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -231,20 +231,20 @@ static int usb_id(const char *devpath) /* get all usb specific information: dev_interface, if_class, dev_usb */ dev = sysfs_device_get(devpath); if (dev == NULL) { - err("unable to access '%s'", devpath); + err("unable to access '%s'\n", devpath); return 1; } /* usb interface directory */ dev_interface = sysfs_device_get_parent_with_subsystem(dev, "usb"); if (dev_interface == NULL) { - info("unable to access usb_interface device of '%s'", devpath); + info("unable to access usb_interface device of '%s'\n", devpath); return 1; } if_class = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceClass"); if (!if_class) { - info("%s: cannot get bInterfaceClass attribute", dev_interface->kernel); + info("%s: cannot get bInterfaceClass attribute\n", dev_interface->kernel); return 1; } if_class_num = strtoul(if_class, NULL, 16); @@ -260,7 +260,7 @@ static int usb_id(const char *devpath) /* usb device directory */ dev_usb = sysfs_device_get_parent_with_subsystem(dev_interface, "usb"); if (!dev_usb) { - info("unable to find parent 'usb' device of '%s'", devpath); + info("unable to find parent 'usb' device of '%s'\n", devpath); return 1; } @@ -273,39 +273,39 @@ static int usb_id(const char *devpath) /* get scsi device */ dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); if (dev_scsi == NULL) { - info("unable to find parent 'scsi' device of '%s'", devpath); + info("unable to find parent 'scsi' device of '%s'\n", devpath); goto fallback; } if (sscanf(dev_scsi->kernel, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { - info("invalid scsi device '%s'", dev_scsi->kernel); + info("invalid scsi device '%s'\n", dev_scsi->kernel); goto fallback; } /* Generic SPC-2 device */ scsi_vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); if (!scsi_vendor) { - info("%s: cannot get SCSI vendor attribute", dev_scsi->kernel); + info("%s: cannot get SCSI vendor attribute\n", dev_scsi->kernel); goto fallback; } set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); scsi_model = sysfs_attr_get_value(dev_scsi->devpath, "model"); if (!scsi_model) { - info("%s: cannot get SCSI model attribute", dev_scsi->kernel); + info("%s: cannot get SCSI model attribute\n", dev_scsi->kernel); goto fallback; } set_str(model_str, scsi_model, sizeof(model_str)-1); scsi_type = sysfs_attr_get_value(dev_scsi->devpath, "type"); if (!scsi_type) { - info("%s: cannot get SCSI type attribute", dev_scsi->kernel); + info("%s: cannot get SCSI type attribute\n", dev_scsi->kernel); goto fallback; } set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); scsi_rev = sysfs_attr_get_value(dev_scsi->devpath, "rev"); if (!scsi_rev) { - info("%s: cannot get SCSI revision attribute", dev_scsi->kernel); + info("%s: cannot get SCSI revision attribute\n", dev_scsi->kernel); goto fallback; } set_str(revision_str, scsi_rev, sizeof(revision_str)-1); @@ -329,7 +329,7 @@ fallback: usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "idVendor"); if (!usb_vendor) { - info("No USB vendor information available"); + info("No USB vendor information available\n"); return 1; } set_str(vendor_str, usb_vendor, sizeof(vendor_str)-1); @@ -345,7 +345,7 @@ fallback: usb_model = sysfs_attr_get_value(dev_usb->devpath, "idProduct"); if (!usb_model) { - dbg("No USB model information available"); + dbg("No USB model information available\n"); return 1; } set_str(model_str, usb_model, sizeof(model_str)-1); diff --git a/extras/volume_id/lib/adaptec_raid.c b/extras/volume_id/lib/adaptec_raid.c index 858c3ba09e..5ab9451890 100644 --- a/extras/volume_id/lib/adaptec_raid.c +++ b/extras/volume_id/lib/adaptec_raid.c @@ -86,7 +86,7 @@ int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t si uint64_t meta_off; struct adaptec_meta *ad; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/cramfs.c b/extras/volume_id/lib/cramfs.c index bf329506e1..9c7eaf6177 100644 --- a/extras/volume_id/lib/cramfs.c +++ b/extras/volume_id/lib/cramfs.c @@ -45,7 +45,7 @@ int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size) { struct cramfs_super *cs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); if (cs == NULL) diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c index 560e6bd603..60837a48b1 100644 --- a/extras/volume_id/lib/ddf_raid.c +++ b/extras/volume_id/lib/ddf_raid.c @@ -45,7 +45,7 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) uint64_t ddf_off = ((size / 0x200)-1) * 0x200; const uint8_t *buf; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index ac21f12501..56edd2531f 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -132,7 +132,7 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) uint32_t feature_incompat; uint32_t flags; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); if (es == NULL) @@ -142,9 +142,9 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) return -1; bsize = 0x400 << le32_to_cpu(es->s_log_block_size); - dbg("ext blocksize 0x%zx", bsize); + dbg("ext blocksize 0x%zx\n", bsize); if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { - dbg("invalid ext blocksize"); + dbg("invalid ext blocksize\n"); return -1; } diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 3ddf0258eb..58f8f825c4 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -217,7 +217,7 @@ static size_t get_fat_attr_volume_id(uint8_t *filename, size_t fnsize, for (i = 0; i < count; i++) { /* end marker */ if (dir[i].name[0] == 0x00) { - dbg("end of dir"); + dbg("end of dir\n"); break; } @@ -234,11 +234,11 @@ static size_t get_fat_attr_volume_id(uint8_t *filename, size_t fnsize, if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) continue; - dbg("found ATTR_VOLUME_ID id in root dir"); + dbg("found ATTR_VOLUME_ID id in root dir\n"); return fat_read_filename(filename, fnsize, dir, &dir[i]); } - dbg("skip dir entry"); + dbg("skip dir entry\n"); } return 0; @@ -270,7 +270,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) int maxloop; size_t fnlen; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off, 0x400); if (buf == NULL) @@ -328,22 +328,22 @@ magic: if (sector_size == 0 || ((sector_size & (sector_size-1)) != 0)) return -1; - dbg("sector_size 0x%x", sector_size); - dbg("sectors_per_cluster 0x%x", vs->sectors_per_cluster); + dbg("sector_size 0x%x\n", sector_size); + dbg("sectors_per_cluster 0x%x\n", vs->sectors_per_cluster); dir_entries = le16_to_cpu(vs->dir_entries); reserved = le16_to_cpu(vs->reserved); - dbg("reserved 0x%x", reserved); + dbg("reserved 0x%x\n", reserved); sect_count = le16_to_cpu(vs->sectors); if (sect_count == 0) sect_count = le32_to_cpu(vs->total_sect); - dbg("sect_count 0x%x", sect_count); + dbg("sect_count 0x%x\n", sect_count); fat_length = le16_to_cpu(vs->fat_length); - dbg("fat_length 0x%x", fat_length); + dbg("fat_length 0x%x\n", fat_length); fat32_length = le32_to_cpu(vs->type.fat32.fat32_length); - dbg("fat32_length 0x%x", fat32_length); + dbg("fat32_length 0x%x\n", fat32_length); if (fat_length) fat_size = fat_length * vs->fats; @@ -351,15 +351,15 @@ magic: fat_size = fat32_length * vs->fats; else return -1; - dbg("fat_size 0x%x", fat_size); + dbg("fat_size 0x%x\n", fat_size); dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + (sector_size-1)) / sector_size; - dbg("dir_size 0x%x", dir_size); + dbg("dir_size 0x%x\n", dir_size); cluster_count = sect_count - (reserved + fat_size + dir_size); cluster_count /= vs->sectors_per_cluster; - dbg("cluster_count 0x%x", cluster_count); + dbg("cluster_count 0x%x\n", cluster_count); /* must be FAT32 */ if (!fat_length && fat32_length) @@ -375,9 +375,9 @@ magic: /* the label may be an attribute in the root directory */ root_start = (reserved + fat_size) * sector_size; - dbg("root dir start 0x%llx", (unsigned long long) root_start); + dbg("root dir start 0x%llx\n", (unsigned long long) root_start); root_dir_entries = le16_to_cpu(vs->dir_entries); - dbg("expected entries 0x%x", root_dir_entries); + dbg("expected entries 0x%x\n", root_dir_entries); buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); buf = volume_id_get_buffer(id, off + root_start, buf_size); @@ -423,7 +423,7 @@ fat32: /* FAT32 root dir is a cluster chain like any other directory */ buf_size = vs->sectors_per_cluster * sector_size; root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); - dbg("root dir cluster %u", root_cluster); + dbg("root dir cluster %u\n", root_cluster); start_data_sect = reserved + fat_size; next = root_cluster; @@ -434,10 +434,10 @@ fat32: uint64_t fat_entry_off; int count; - dbg("next cluster %u", next); + dbg("next cluster %u\n", next); next_sect_off = (next - 2) * vs->sectors_per_cluster; next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%llx", (unsigned long long) next_off); + dbg("cluster offset 0x%llx\n", (unsigned long long) next_off); /* get cluster */ buf = volume_id_get_buffer(id, off + next_off, buf_size); @@ -446,7 +446,7 @@ fat32: dir = (struct vfat_dir_entry*) buf; count = buf_size / sizeof(struct vfat_dir_entry); - dbg("expected entries 0x%x", count); + dbg("expected entries 0x%x\n", count); fnlen = get_fat_attr_volume_id(filename, sizeof(filename), dir, count); if (fnlen > 0) @@ -464,7 +464,7 @@ fat32: break; } if (maxloop == 0) - dbg("reached maximum follow count of root cluster chain, give up"); + dbg("reached maximum follow count of root cluster chain, give up\n"); vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); if (vs == NULL) diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c index 1d3a4a0f1e..53382222ac 100644 --- a/extras/volume_id/lib/gfs.c +++ b/extras/volume_id/lib/gfs.c @@ -78,7 +78,7 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v { struct gfs2_sb *sbd; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); sbd = (struct gfs2_sb *) volume_id_get_buffer(id, off + GFS_SUPERBLOCK_OFFSET, sizeof(struct gfs2_sb)); diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index 70a6b4ae2c..b6d7e0290b 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -186,7 +186,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t siz struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; const uint8_t *buf; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) @@ -199,17 +199,17 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t siz /* it may be just a hfs wrapper for hfs+ */ if (memcmp(hfs->embed_sig, "H+", 2) == 0) { alloc_block_size = be32_to_cpu(hfs->al_blk_size); - dbg("alloc_block_size 0x%x", alloc_block_size); + dbg("alloc_block_size 0x%x\n", alloc_block_size); alloc_first_block = be16_to_cpu(hfs->al_bl_st); - dbg("alloc_first_block 0x%x", alloc_first_block); + dbg("alloc_first_block 0x%x\n", alloc_first_block); embed_first_block = be16_to_cpu(hfs->embed_startblock); - dbg("embed_first_block 0x%x", embed_first_block); + dbg("embed_first_block 0x%x\n", embed_first_block); off += (alloc_first_block * 512) + (embed_first_block * alloc_block_size); - dbg("hfs wrapped hfs+ found at offset 0x%llx", (unsigned long long) off); + dbg("hfs wrapped hfs+ found at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) @@ -241,11 +241,11 @@ hfsplus: hfsid_set_uuid(id, hfsplus->finder_info.id); blocksize = be32_to_cpu(hfsplus->blocksize); - dbg("blocksize %u", blocksize); + dbg("blocksize %u\n", blocksize); memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); cat_block = be32_to_cpu(extents[0].start_block); - dbg("catalog start block 0x%x", cat_block); + dbg("catalog start block 0x%x\n", cat_block); buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); if (buf == NULL) @@ -255,13 +255,13 @@ hfsplus: &buf[sizeof(struct hfsplus_bnode_descriptor)]; leaf_node_head = be32_to_cpu(bnode->leaf_head); - dbg("catalog leaf node 0x%x", leaf_node_head); + dbg("catalog leaf node 0x%x\n", leaf_node_head); leaf_node_size = be16_to_cpu(bnode->node_size); - dbg("leaf node size 0x%x", leaf_node_size); + dbg("leaf node size 0x%x\n", leaf_node_size); leaf_node_count = be32_to_cpu(bnode->leaf_count); - dbg("leaf node count 0x%x", leaf_node_count); + dbg("leaf node count 0x%x\n", leaf_node_count); if (leaf_node_count == 0) goto found; @@ -271,7 +271,7 @@ hfsplus: for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { ext_block_start = be32_to_cpu(extents[ext].start_block); ext_block_count = be32_to_cpu(extents[ext].block_count); - dbg("extent start block 0x%x, count 0x%x", ext_block_start, ext_block_count); + dbg("extent start block 0x%x, count 0x%x\n", ext_block_start, ext_block_count); if (ext_block_count == 0) goto found; @@ -284,7 +284,7 @@ hfsplus: } if (ext == HFSPLUS_EXTENT_COUNT) goto found; - dbg("found block in extent %i", ext); + dbg("found block in extent %i\n", ext); leaf_off = (ext_block_start + leaf_block) * blocksize; @@ -293,10 +293,10 @@ hfsplus: goto found; descr = (struct hfsplus_bnode_descriptor *) buf; - dbg("descriptor type 0x%x", descr->type); + dbg("descriptor type 0x%x\n", descr->type); record_count = be16_to_cpu(descr->num_recs); - dbg("number of records %u", record_count); + dbg("number of records %u\n", record_count); if (record_count == 0) goto found; @@ -306,12 +306,12 @@ hfsplus: key = (struct hfsplus_catalog_key *) &buf[sizeof(struct hfsplus_bnode_descriptor)]; - dbg("parent id 0x%x", be32_to_cpu(key->parent_id)); + dbg("parent id 0x%x\n", be32_to_cpu(key->parent_id)); if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) goto found; label_len = be16_to_cpu(key->unicode_len) * 2; - dbg("label unicode16 len %i", label_len); + dbg("label unicode16 len %i\n", label_len); volume_id_set_label_raw(id, key->unicode, label_len); volume_id_set_label_unicode16(id, key->unicode, BE, label_len); diff --git a/extras/volume_id/lib/highpoint.c b/extras/volume_id/lib/highpoint.c index f2c4069cc6..0629015117 100644 --- a/extras/volume_id/lib/highpoint.c +++ b/extras/volume_id/lib/highpoint.c @@ -49,7 +49,7 @@ int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint6 struct hpt37x_meta *hpt; uint32_t magic; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); if (buf == NULL) @@ -73,7 +73,7 @@ int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint6 uint64_t meta_off; uint32_t magic; - dbg("probing at offset 0x%llx, size 0x%llx", + dbg("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c index edcf0666ae..ac5a35437a 100644 --- a/extras/volume_id/lib/hpfs.c +++ b/extras/volume_id/lib/hpfs.c @@ -38,7 +38,7 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size) { struct hpfs_super *hs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); if (hs == NULL) diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c index 1d8bdff878..0e2c686fa2 100644 --- a/extras/volume_id/lib/iso9660.c +++ b/extras/volume_id/lib/iso9660.c @@ -59,7 +59,7 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) struct iso_volume_descriptor *is; struct high_sierra_volume_descriptor *hs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) @@ -71,11 +71,11 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) int vd_offset; int i; - dbg("read label from PVD"); + dbg("read label from PVD\n"); volume_id_set_label_raw(id, is->volume_id, 32); volume_id_set_label_string(id, is->volume_id, 32); - dbg("looking for SVDs"); + dbg("looking for SVDs\n"); vd_offset = ISO_VD_OFFSET; for (i = 0; i < ISO_VD_MAX; i++) { uint8_t svd_label[64]; @@ -86,14 +86,14 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) if (is->type != ISO_VD_SUPPLEMENTARY) continue; - dbg("found SVD at offset 0x%llx", (unsigned long long) (off + vd_offset)); + dbg("found SVD at offset 0x%llx\n", (unsigned long long) (off + vd_offset)); if (memcmp(is->escape_sequences, "%/@", 3) == 0|| memcmp(is->escape_sequences, "%/C", 3) == 0|| memcmp(is->escape_sequences, "%/E", 3) == 0) { - dbg("Joliet extension found"); + dbg("Joliet extension found\n"); volume_id_set_unicode16(svd_label, sizeof(svd_label), is->volume_id, BE, 32); if (memcmp(id->label, svd_label, 16) == 0) { - dbg("SVD label is identical, use the possibly longer PVD one"); + dbg("SVD label is identical, use the possibly longer PVD one\n"); break; } diff --git a/extras/volume_id/lib/isw_raid.c b/extras/volume_id/lib/isw_raid.c index f5761e826b..337a9cecbd 100644 --- a/extras/volume_id/lib/isw_raid.c +++ b/extras/volume_id/lib/isw_raid.c @@ -43,7 +43,7 @@ int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint uint64_t meta_off; struct isw_meta *isw; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c index 00b66cccc7..950ba43e1c 100644 --- a/extras/volume_id/lib/jfs.c +++ b/extras/volume_id/lib/jfs.c @@ -45,7 +45,7 @@ int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size) { struct jfs_super_block *js; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); if (js == NULL) diff --git a/extras/volume_id/lib/jmicron_raid.c b/extras/volume_id/lib/jmicron_raid.c index 5182a3e825..6cb1f6f315 100644 --- a/extras/volume_id/lib/jmicron_raid.c +++ b/extras/volume_id/lib/jmicron_raid.c @@ -39,7 +39,7 @@ int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t si uint64_t meta_off; struct jmicron_meta *jm; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 5e0c4a494f..96ae7c32e3 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -66,7 +66,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 uint8_t bytes[16]; } uuid; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) return -1; @@ -120,7 +120,7 @@ static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint6 { const uint8_t *buf; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); buf = volume_id_get_buffer(id, off, 0x800); diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 50d43ccce6..9ff16e2798 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -43,7 +43,7 @@ int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size unsigned int page; struct swap_header_v1_2 *sw; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); /* eek, the swap signature is at the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { diff --git a/extras/volume_id/lib/lsi_raid.c b/extras/volume_id/lib/lsi_raid.c index 56fd5671d3..eef87142b8 100644 --- a/extras/volume_id/lib/lsi_raid.c +++ b/extras/volume_id/lib/lsi_raid.c @@ -38,7 +38,7 @@ int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t s uint64_t meta_off; struct lsi_meta *lsi; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c index 7c4f81131c..d234113d77 100644 --- a/extras/volume_id/lib/lvm.c +++ b/extras/volume_id/lib/lvm.c @@ -51,7 +51,7 @@ int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; struct lvm1_super_block *lvm; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); if (buf == NULL) @@ -78,7 +78,7 @@ int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size) struct lvm2_super_block *lvm; struct lvm2_pv_header *pvhdr; - dbg("probing at offset 0x%llx", (unsigned long long) off); + dbg("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); if (buf == NULL) @@ -95,7 +95,7 @@ int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size) return -1; found: - dbg("found at offset 0x%x (pv hdr offset 0x%x)", + dbg("found at offset 0x%x (pv hdr offset 0x%x)\n", soff, cpu_to_le32(lvm->offset_xl)); soff += cpu_to_le32(lvm->offset_xl); pvhdr = (struct lvm2_pv_header *) &buf[soff]; diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c index 64945067e8..88b4c189c4 100644 --- a/extras/volume_id/lib/minix.c +++ b/extras/volume_id/lib/minix.c @@ -70,7 +70,7 @@ int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size) struct minix_super_block *ms; struct minix3_super_block *m3s; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c index 4d157aaf5d..c03455791c 100644 --- a/extras/volume_id/lib/netware.c +++ b/extras/volume_id/lib/netware.c @@ -82,7 +82,7 @@ int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size) { struct netware_super_block *nw; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); nw = (struct netware_super_block *) volume_id_get_buffer(id, off + NW_SUPERBLOCK_OFFSET, 0x200); if (nw == NULL) diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index f63804d711..1e73bc8f15 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -105,7 +105,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; const uint8_t *val; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (ns == NULL) @@ -130,12 +130,12 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) else mft_record_size = ns->cluster_per_mft_record * cluster_size; - dbg("sectorsize 0x%x", sector_size); - dbg("clustersize 0x%x", cluster_size); - dbg("mftcluster %llu", (unsigned long long) mft_cluster); - dbg("mftoffset 0x%llx", (unsigned long long) mft_off); - dbg("cluster per mft_record %i", ns->cluster_per_mft_record); - dbg("mft record size %i", mft_record_size); + dbg("sectorsize 0x%x\n", sector_size); + dbg("clustersize 0x%x\n", cluster_size); + dbg("mftcluster %llu\n", (unsigned long long) mft_cluster); + dbg("mftoffset 0x%llx\n", (unsigned long long) mft_off); + dbg("cluster per mft_record %i\n", ns->cluster_per_mft_record); + dbg("mft record size %i\n", mft_record_size); buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), mft_record_size); @@ -143,12 +143,12 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) return -1; mftr = (struct master_file_table_record*) buf; - dbg("mftr->magic '%c%c%c%c'", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); + dbg("mftr->magic '%c%c%c%c'\n", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); if (memcmp(mftr->magic, "FILE", 4) != 0) return -1; attr_off = le16_to_cpu(mftr->attrs_offset); - dbg("file $Volume's attributes are at offset %i", attr_off); + dbg("file $Volume's attributes are at offset %i\n", attr_off); while (1) { attr = (struct file_attribute*) &buf[attr_off]; @@ -167,18 +167,18 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) if (attr_type == MFT_RECORD_ATTR_END) break; - dbg("found attribute type 0x%x, len %i, at offset %i", + dbg("found attribute type 0x%x, len %i, at offset %i\n", attr_type, attr_len, attr_off); if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { - dbg("found info, len %i", val_len); + dbg("found info, len %i\n", val_len); info = (struct volume_info*) (((uint8_t *) attr) + val_off); snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", info->major_ver, info->minor_ver); } if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { - dbg("found label, len %i", val_len); + dbg("found label, len %i\n", val_len); if (val_len > VOLUME_ID_LABEL_SIZE) val_len = VOLUME_ID_LABEL_SIZE; diff --git a/extras/volume_id/lib/nvidia_raid.c b/extras/volume_id/lib/nvidia_raid.c index ca42459307..c6b5185399 100644 --- a/extras/volume_id/lib/nvidia_raid.c +++ b/extras/volume_id/lib/nvidia_raid.c @@ -41,7 +41,7 @@ int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t siz uint64_t meta_off; struct nvidia_meta *nv; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c index 9f251f1794..ec81f5e8e3 100644 --- a/extras/volume_id/lib/ocfs.c +++ b/extras/volume_id/lib/ocfs.c @@ -132,7 +132,7 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size) struct ocfs1_super_block_header *osh; struct ocfs1_super_block_label *osl; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off, 0x200); if (buf == NULL) @@ -144,7 +144,7 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size) snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", osh->major_version, osh->minor_version); - dbg("found OracleCFS signature, now reading label"); + dbg("found OracleCFS signature, now reading label\n"); buf = volume_id_get_buffer(id, off + 0x200, 0x200); if (buf == NULL) return -1; @@ -170,7 +170,7 @@ int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size) struct ocfs2_super_block *os; size_t blksize; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); diff --git a/extras/volume_id/lib/promise_raid.c b/extras/volume_id/lib/promise_raid.c index 1c4d3658ce..ecaed00986 100644 --- a/extras/volume_id/lib/promise_raid.c +++ b/extras/volume_id/lib/promise_raid.c @@ -42,7 +42,7 @@ int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, u 63, 255, 256, 16, 399, 0 }; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x40000) diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c index 18db63817a..0f30233eaf 100644 --- a/extras/volume_id/lib/reiserfs.c +++ b/extras/volume_id/lib/reiserfs.c @@ -60,7 +60,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size) struct reiser4_super_block *rs4; uint8_t *buf; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/romfs.c b/extras/volume_id/lib/romfs.c index 2db36d61a5..303a1fb40e 100644 --- a/extras/volume_id/lib/romfs.c +++ b/extras/volume_id/lib/romfs.c @@ -37,7 +37,7 @@ int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size) { struct romfs_super *rfs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); if (rfs == NULL) diff --git a/extras/volume_id/lib/silicon_raid.c b/extras/volume_id/lib/silicon_raid.c index 634e4abd0b..cfdcbcb868 100644 --- a/extras/volume_id/lib/silicon_raid.c +++ b/extras/volume_id/lib/silicon_raid.c @@ -53,7 +53,7 @@ int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint uint64_t meta_off; struct silicon_meta *sil; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index 035d6fb22a..18e44abcb4 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -45,7 +45,7 @@ int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size) { struct squashfs_super *sqs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); sqs = (struct squashfs_super *) volume_id_get_buffer(id, off, 0x200); if (sqs == NULL) diff --git a/extras/volume_id/lib/sysv.c b/extras/volume_id/lib/sysv.c index e48013c2bd..ba37c4d0a6 100644 --- a/extras/volume_id/lib/sysv.c +++ b/extras/volume_id/lib/sysv.c @@ -95,7 +95,7 @@ int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size) struct xenix_super *xs; unsigned int boff; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { vs = (struct sysv_super *) diff --git a/extras/volume_id/lib/udf.c b/extras/volume_id/lib/udf.c index ac2f40a9e8..2a589c5f2a 100644 --- a/extras/volume_id/lib/udf.c +++ b/extras/volume_id/lib/udf.c @@ -72,7 +72,7 @@ int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size) unsigned int loc; unsigned int clen; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); if (vsd == NULL) @@ -100,7 +100,7 @@ blocksize: vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); if (vsd == NULL) return -1; - dbg("test for blocksize: 0x%x", bs); + dbg("test for blocksize: 0x%x\n", bs); if (vsd->id[0] != '\0') goto nsr; } @@ -113,7 +113,7 @@ nsr: if (vsd == NULL) return -1; - dbg("vsd: %c%c%c%c%c", + dbg("vsd: %c%c%c%c%c\n", vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); if (vsd->id[0] == '\0') @@ -138,7 +138,7 @@ anchor: /* get desriptor list address and block count */ count = le32_to_cpu(vd->type.anchor.length) / bs; loc = le32_to_cpu(vd->type.anchor.location); - dbg("0x%x descriptors starting at logical secor 0x%x", count, loc); + dbg("0x%x descriptors starting at logical secor 0x%x\n", count, loc); /* pick the primary descriptor from the list */ for (b = 0; b < count; b++) { @@ -147,7 +147,7 @@ anchor: return -1; type = le16_to_cpu(vd->tag.id); - dbg("descriptor type %i", type); + dbg("descriptor type %i\n", type); /* check validity */ if (type == 0) @@ -164,7 +164,7 @@ pvd: volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); clen = vd->type.primary.ident.clen; - dbg("label string charsize=%i bit", clen); + dbg("label string charsize=%i bit\n", clen); if (clen == 8) volume_id_set_label_string(id, vd->type.primary.ident.c, 31); else if (clen == 16) diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c index 4ace8c99fd..bedcfa47da 100644 --- a/extras/volume_id/lib/ufs.c +++ b/extras/volume_id/lib/ufs.c @@ -175,20 +175,20 @@ int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size) struct ufs_super_block *ufs; int offsets[] = {0, 8, 64, 256, -1}; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); for (i = 0; offsets[i] >= 0; i++) { ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); if (ufs == NULL) return -1; - dbg("offset 0x%x", offsets[i] * 0x400); + dbg("offset 0x%x\n", offsets[i] * 0x400); magic = be32_to_cpu(ufs->fs_magic); if ((magic == UFS_MAGIC) || (magic == UFS2_MAGIC) || (magic == UFS_MAGIC_FEA) || (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(be)", magic); + dbg("magic 0x%08x(be)\n", magic); goto found; } magic = le32_to_cpu(ufs->fs_magic); @@ -196,7 +196,7 @@ int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size) (magic == UFS2_MAGIC) || (magic == UFS_MAGIC_FEA) || (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(le)", magic); + dbg("magic 0x%08x(le)\n", magic); goto found; } } diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 0a3bd39992..2a63efe8f7 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -353,33 +353,33 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) { ssize_t buf_len; - info("get buffer off 0x%llx(%llu), len 0x%zx", (unsigned long long) off, (unsigned long long) off, len); + info("get buffer off 0x%llx(%llu), len 0x%zx\n", (unsigned long long) off, (unsigned long long) off, len); /* check if requested area fits in superblock buffer */ if (off + len <= SB_BUFFER_SIZE) { if (id->sbbuf == NULL) { id->sbbuf = malloc(SB_BUFFER_SIZE); if (id->sbbuf == NULL) { - dbg("error malloc"); + dbg("error malloc\n"); return NULL; } } /* check if we need to read */ if ((off + len) > id->sbbuf_len) { - info("read sbbuf len:0x%llx", (unsigned long long) (off + len)); + info("read sbbuf len:0x%llx\n", (unsigned long long) (off + len)); if (lseek(id->fd, 0, SEEK_SET) < 0) { - dbg("lseek failed (%s)", strerror(errno)); + dbg("lseek failed (%s)\n", strerror(errno)); return NULL; } buf_len = read(id->fd, id->sbbuf, off + len); if (buf_len < 0) { - dbg("read failed (%s)", strerror(errno)); + dbg("read failed (%s)\n", strerror(errno)); return NULL; } - dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); + dbg("got 0x%zx (%zi) bytes\n", buf_len, buf_len); id->sbbuf_len = buf_len; if ((size_t)buf_len < off + len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); + dbg("requested 0x%zx bytes, got only 0x%zx bytes\n", len, buf_len); return NULL; } } @@ -387,7 +387,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) return &(id->sbbuf[off]); } else { if (len > SEEK_BUFFER_SIZE) { - dbg("seek buffer too small %d", SEEK_BUFFER_SIZE); + dbg("seek buffer too small %d\n", SEEK_BUFFER_SIZE); return NULL; } @@ -395,28 +395,28 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) if (id->seekbuf == NULL) { id->seekbuf = malloc(SEEK_BUFFER_SIZE); if (id->seekbuf == NULL) { - dbg("error malloc"); + dbg("error malloc\n"); return NULL; } } /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - info("read seekbuf off:0x%llx len:0x%zx", (unsigned long long) off, len); + info("read seekbuf off:0x%llx len:0x%zx\n", (unsigned long long) off, len); if (lseek(id->fd, off, SEEK_SET) < 0) { - dbg("lseek failed (%s)", strerror(errno)); + dbg("lseek failed (%s)\n", strerror(errno)); return NULL; } buf_len = read(id->fd, id->seekbuf, len); if (buf_len < 0) { - dbg("read failed (%s)", strerror(errno)); + dbg("read failed (%s)\n", strerror(errno)); return NULL; } - dbg("got 0x%zx (%zi) bytes", buf_len, buf_len); + dbg("got 0x%zx (%zi) bytes\n", buf_len, buf_len); id->seekbuf_off = off; id->seekbuf_len = buf_len; if ((size_t)buf_len < len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes", len, buf_len); + dbg("requested 0x%zx bytes, got only 0x%zx bytes\n", len, buf_len); return NULL; } } diff --git a/extras/volume_id/lib/via_raid.c b/extras/volume_id/lib/via_raid.c index 62c165e034..9965e13bc2 100644 --- a/extras/volume_id/lib/via_raid.c +++ b/extras/volume_id/lib/via_raid.c @@ -63,7 +63,7 @@ int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) uint64_t meta_off; struct via_meta *via; - dbg("probing at offset 0x%llx, size 0x%llx", + dbg("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); if (size < 0x10000) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 7c68fb1ef9..bb909c9956 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -358,7 +358,7 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (!device_is_readable(id, off)) return -1; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); for (i = 0; i < ARRAY_SIZE(prober_raid); i++) @@ -392,7 +392,7 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (!device_is_readable(id, off)) return -1; - info("probing at offset 0x%llx, size 0x%llx", + info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) @@ -493,7 +493,7 @@ struct volume_id *volume_id_open_node(const char *path) fd = open(path, O_RDONLY); if (fd < 0) { - dbg("unable to open '%s'", path); + dbg("unable to open '%s'\n", path); return NULL; } diff --git a/extras/volume_id/lib/vxfs.c b/extras/volume_id/lib/vxfs.c index c9b76285e8..33d357b7d8 100644 --- a/extras/volume_id/lib/vxfs.c +++ b/extras/volume_id/lib/vxfs.c @@ -37,7 +37,7 @@ int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size) { struct vxfs_super *vxs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); if (vxs == NULL) diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c index 9eac8273c8..3e10560af9 100644 --- a/extras/volume_id/lib/xfs.c +++ b/extras/volume_id/lib/xfs.c @@ -45,7 +45,7 @@ int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size) { struct xfs_super_block *xs; - info("probing at offset 0x%llx", (unsigned long long) off); + info("probing at offset 0x%llx\n", (unsigned long long) off); xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (xs == NULL) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 04e85abb7f..5c4e05d794 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -218,7 +218,7 @@ int main(int argc, char *argv[]) node = argv[optind]; if (!node) { - err("no device"); + err("no device\n"); fprintf(stderr, "no device\n"); rc = 1; goto exit; @@ -239,7 +239,7 @@ int main(int argc, char *argv[]) if (ioctl(fd, BLKGETSIZE64, &size) != 0) size = 0; - dbg("BLKGETSIZE64=%llu", (unsigned long long)size); + dbg("BLKGETSIZE64=%llu\n", (unsigned long long)size); /* try to drop all privileges before reading disk content */ if (getuid() == 0) { @@ -250,7 +250,7 @@ int main(int argc, char *argv[]) if (setgroups(0, NULL) != 0 || setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) - info("unable to drop privileges: %s\n", strerror(errno)); + info("unable to drop privileges: %s\n\n", strerror(errno)); } } diff --git a/test-udev.c b/test-udev.c index 0c25778aa6..e341b74f2f 100644 --- a/test-udev.c +++ b/test-udev.c @@ -90,10 +90,10 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udev"); if (devnull < 0) - err("open /dev/null failed: %s", strerror(errno)); + err("open /dev/null failed: %s\n", strerror(errno)); udev_config_init(); selinux_init(); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); @@ -115,7 +115,7 @@ int main(int argc, char *argv[], char *envp[]) subsystem = argv[1]; if (action == NULL || subsystem == NULL || devpath == NULL) { - err("action, subsystem or devpath missing"); + err("action, subsystem or devpath missing\n"); goto exit; } @@ -132,7 +132,7 @@ int main(int argc, char *argv[], char *envp[]) dev = sysfs_device_get(devpath); if (dev == NULL) { - info("unable to open '%s'", devpath); + info("unable to open '%s'\n", devpath); goto fail; } diff --git a/udev_config.c b/udev_config.c index 2f2a69eb48..42190945fc 100644 --- a/udev_config.c +++ b/udev_config.c @@ -98,7 +98,7 @@ static int parse_config_file(void) int retval = 0; if (file_map(udev_config_filename, &buf, &bufsize) != 0) { - err("can't open '%s' as config file: %s", udev_config_filename, strerror(errno)); + err("can't open '%s' as config file: %s\n", udev_config_filename, strerror(errno)); return -ENODEV; } @@ -124,7 +124,7 @@ static int parse_config_file(void) continue; if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); + err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); continue; } @@ -134,7 +134,7 @@ static int parse_config_file(void) linepos = line; retval = get_key(&linepos, &variable, &value); if (retval != 0) { - err("error parsing %s, line %d:%d", udev_config_filename, lineno, (int)(linepos-line)); + err("error parsing %s, line %d:%d\n", udev_config_filename, lineno, (int)(linepos-line)); continue; } @@ -193,8 +193,8 @@ void udev_config_init(void) if (env) udev_log_priority = log_priority(env); - dbg("UDEV_CONFIG_FILE='%s'", udev_config_filename); - dbg("udev_root='%s'", udev_root); - dbg("udev_rules='%s'", udev_rules_dir); - dbg("udev_log=%d", udev_log_priority); + dbg("UDEV_CONFIG_FILE='%s'\n", udev_config_filename); + dbg("udev_root='%s'\n", udev_root); + dbg("udev_rules='%s'\n", udev_rules_dir); + dbg("udev_log=%d\n", udev_log_priority); } diff --git a/udev_db.c b/udev_db.c index 1feab7d63f..ddcf85ee5c 100644 --- a/udev_db.c +++ b/udev_db.c @@ -65,13 +65,13 @@ static int name_index(const char *devpath, const char *name, int add) strlcat(filename, device, sizeof(filename)); if (add) { - info("creating index: '%s'", filename); + info("creating index: '%s'\n", filename); create_path(filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd > 0) close(fd); } else { - info("removing index: '%s'", filename); + info("removing index: '%s'\n", filename); unlink(filename); delete_path(filename); } @@ -92,12 +92,12 @@ int udev_db_get_devices_by_name(const char *name, struct list_head *name_list) dir = opendir(dirname); if (dir == NULL) { - info("no index directory '%s': %s", dirname, strerror(errno)); + info("no index directory '%s': %s\n", dirname, strerror(errno)); rc = -1; goto out; } - info("found index directory '%s'", dirname); + info("found index directory '%s'\n", dirname); while (1) { struct dirent *ent; char device[PATH_SIZE]; @@ -146,12 +146,12 @@ int udev_db_add_device(struct udevice *udev) if (list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && !udev->partitions && !udev->ignore_remove) { int ret; - dbg("nothing interesting to store, create symlink"); + dbg("nothing interesting to store, create symlink\n"); selinux_setfscreatecon(filename, NULL, S_IFLNK); ret = symlink(udev->name, filename); selinux_resetfscreatecon(); if (ret != 0) { - err("unable to create db link '%s': %s", filename, strerror(errno)); + err("unable to create db link '%s': %s\n", filename, strerror(errno)); return -1; } } else { @@ -160,10 +160,10 @@ int udev_db_add_device(struct udevice *udev) f = fopen(filename, "w"); if (f == NULL) { - err("unable to create db file '%s': %s", filename, strerror(errno)); + err("unable to create db file '%s': %s\n", filename, strerror(errno)); return -1; } - dbg("storing data for device '%s' in '%s'", udev->dev->devpath, filename); + dbg("storing data for device '%s' in '%s'\n", udev->dev->devpath, filename); fprintf(f, "N:%s\n", udev->name); list_for_each_entry(name_loop, &udev->symlink_list, node) { @@ -205,28 +205,28 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) devpath_to_db_path(devpath, filename, sizeof(filename)); if (lstat(filename, &stats) != 0) { - info("no db file to read %s: %s", filename, strerror(errno)); + info("no db file to read %s: %s\n", filename, strerror(errno)); return -1; } if ((stats.st_mode & S_IFMT) == S_IFLNK) { char target[NAME_SIZE]; int target_len; - info("found a symlink as db file"); + info("found a symlink as db file\n"); target_len = readlink(filename, target, sizeof(target)); if (target_len > 0) target[target_len] = '\0'; else { - info("error reading db link %s: %s", filename, strerror(errno)); + info("error reading db link %s: %s\n", filename, strerror(errno)); return -1; } - dbg("db link points to '%s'", target); + dbg("db link points to '%s'\n", target); strlcpy(udev->name, target, sizeof(udev->name)); return 0; } if (file_map(filename, &buf, &bufsize) != 0) { - info("error reading db file %s: %s", filename, strerror(errno)); + info("error reading db file %s: %s\n", filename, strerror(errno)); return -1; } @@ -323,7 +323,7 @@ int udev_db_get_all_entries(struct list_head *name_list) strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); dir = opendir(dbpath); if (dir == NULL) { - info("no udev_db available '%s': %s", dbpath, strerror(errno)); + info("no udev_db available '%s': %s\n", dbpath, strerror(errno)); return -1; } @@ -340,7 +340,7 @@ int udev_db_get_all_entries(struct list_head *name_list) strlcpy(device, ent->d_name, sizeof(device)); path_decode(device); name_list_add(name_list, device, 1); - dbg("added '%s'", device); + dbg("added '%s'\n", device); } closedir(dir); diff --git a/udev_device.c b/udev_device.c index 62217ff585..6546db482c 100644 --- a/udev_device.c +++ b/udev_device.c @@ -104,13 +104,13 @@ static int rename_netif(struct udevice *udev) struct ifreq ifr; int retval; - info("changing net interface name from '%s' to '%s'", udev->dev->kernel, udev->name); + info("changing net interface name from '%s' to '%s'\n", udev->dev->kernel, udev->name); if (udev->test_run) return 0; sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { - err("error opening socket: %s", strerror(errno)); + err("error opening socket: %s\n", strerror(errno)); return -1; } @@ -125,7 +125,7 @@ static int rename_netif(struct udevice *udev) /* see if the destination interface name already exists */ if (errno != EEXIST) { - err("error changing netif name %s to %s: %s", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } @@ -134,7 +134,7 @@ static int rename_netif(struct udevice *udev) strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) { - err("error changing netif name %s to %s: %s", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } @@ -150,11 +150,11 @@ static int rename_netif(struct udevice *udev) } if (errno != EEXIST) { - err("error changing net interface name %s to %s: %s", + err("error changing net interface name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); break; } - dbg("wait for netif '%s' to become free, loop=%i", udev->name, (30 * 20) - loop); + dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop); usleep(1000 * 1000 / 20); } } @@ -170,22 +170,22 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) if (udev->devpath_old != NULL) if (udev_db_rename(udev->devpath_old, udev->dev->devpath) == 0) - info("moved database from '%s' to '%s'", udev->devpath_old, udev->dev->devpath); + info("moved database from '%s' to '%s'\n", udev->devpath_old, udev->dev->devpath); /* add device node */ if (major(udev->devt) != 0 && (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "change") == 0)) { struct udevice *udev_old; - dbg("device node add '%s'", udev->dev->devpath); + dbg("device node add '%s'\n", udev->dev->devpath); udev_rules_get_name(rules, udev); if (udev->ignore_device) { - info("device event will be ignored"); + info("device event will be ignored\n"); goto exit; } if (udev->name[0] == '\0') { - info("device node creation supressed"); + info("device node creation supressed\n"); goto exit; } @@ -194,7 +194,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) if (udev_old != NULL) { udev_old->test_run = udev->test_run; if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { - info("device '%s' already in database, cleanup", udev->dev->devpath); + info("device '%s' already in database, cleanup\n", udev->dev->devpath); udev_db_delete_device(udev_old); } else { udev_device_cleanup(udev_old); @@ -220,14 +220,14 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* add netif */ if (strcmp(udev->dev->subsystem, "net") == 0 && strcmp(udev->action, "add") == 0) { - dbg("netif add '%s'", udev->dev->devpath); + dbg("netif add '%s'\n", udev->dev->devpath); udev_rules_get_name(rules, udev); if (udev->ignore_device) { - info("device event will be ignored"); + info("device event will be ignored\n"); goto exit; } if (udev->name[0] == '\0') { - info("device renaming supressed"); + info("device renaming supressed\n"); goto exit; } @@ -239,7 +239,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) retval = rename_netif(udev); if (retval != 0) goto exit; - info("renamed netif to '%s'", udev->name); + info("renamed netif to '%s'\n", udev->name); /* export old name */ setenv("INTERFACE_OLD", udev->dev->kernel, 1); @@ -253,7 +253,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) sysfs_device_set_values(udev->dev, devpath, NULL, NULL); setenv("DEVPATH", udev->dev->devpath, 1); setenv("INTERFACE", udev->name, 1); - info("changed devpath to '%s'", udev->dev->devpath); + info("changed devpath to '%s'\n", udev->dev->devpath); } } goto exit; @@ -270,19 +270,19 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) list_for_each_entry(name_loop, &udev->env_list, node) putenv(name_loop->name); } else { - dbg("'%s' not found in database, using kernel name '%s'", + dbg("'%s' not found in database, using kernel name '%s'\n", udev->dev->devpath, udev->dev->kernel); strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); } udev_rules_get_run(rules, udev); if (udev->ignore_device) { - info("device event will be ignored"); + info("device event will be ignored\n"); goto exit; } if (udev->ignore_remove) { - info("ignore_remove for '%s'", udev->name); + info("ignore_remove for '%s'\n", udev->name); goto exit; } /* remove the node */ @@ -296,7 +296,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) /* default devices */ udev_rules_get_run(rules, udev); if (udev->ignore_device) - info("device event will be ignored"); + info("device event will be ignored\n"); exit: return retval; diff --git a/udev_node.c b/udev_node.c index 6ca0601ea4..0e59e2dbc9 100644 --- a/udev_node.c +++ b/udev_node.c @@ -48,7 +48,7 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m if (lstat(file, &stats) == 0) { if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { - info("preserve file '%s', because it has correct dev_t", file); + info("preserve file '%s', because it has correct dev_t\n", file); selinux_setfilecon(file, udev->dev->kernel, stats.st_mode); goto perms; } @@ -60,7 +60,7 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m goto perms; } - info("atomically replace '%s'", file); + info("atomically replace '%s'\n", file); strlcpy(file_tmp, file, sizeof(file_tmp)); strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); unlink(file_tmp); @@ -68,29 +68,29 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m retval = mknod(file_tmp, mode, devt); selinux_resetfscreatecon(); if (retval != 0) { - err("mknod(%s, %#o, %u, %u) failed: %s", + err("mknod(%s, %#o, %u, %u) failed: %s\n", file_tmp, mode, major(devt), minor(devt), strerror(errno)); goto exit; } retval = rename(file_tmp, file); if (retval != 0) { - err("rename(%s, %s) failed: %s", + err("rename(%s, %s) failed: %s\n", file_tmp, file, strerror(errno)); unlink(file_tmp); goto exit; } perms: - dbg("chmod(%s, %#o)", file, mode); + dbg("chmod(%s, %#o)\n", file, mode); if (chmod(file, mode) != 0) { - err("chmod(%s, %#o) failed: %s", file, mode, strerror(errno)); + err("chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); goto exit; } if (uid != 0 || gid != 0) { - dbg("chown(%s, %u, %u)", file, uid, gid); + dbg("chown(%s, %u, %u)\n", file, uid, gid); if (chown(file, uid, gid) != 0) { - err("chown(%s, %u, %u) failed: %s", + err("chown(%s, %u, %u) failed: %s\n", file, uid, gid, strerror(errno)); goto exit; } @@ -127,32 +127,32 @@ static int node_symlink(const char *node, const char *slink) if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { struct stat stats2; - info("found existing node instead of symlink '%s'", slink); + info("found existing node instead of symlink '%s'\n", slink); if (lstat(node, &stats2) == 0) { if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && stats.st_rdev == stats2.st_rdev) { - info("replace device node '%s' with symlink to our node '%s'", slink, node); + info("replace device node '%s' with symlink to our node '%s'\n", slink, node); } else { - err("device node '%s' already exists, link to '%s' will not overwrite it", slink, node); + err("device node '%s' already exists, link to '%s' will not overwrite it\n", slink, node); goto exit; } } } else if (S_ISLNK(stats.st_mode)) { char buf[PATH_SIZE]; - info("found existing symlink '%s'", slink); + info("found existing symlink '%s'\n", slink); len = readlink(slink, buf, sizeof(buf)); if (len > 0) { buf[len] = '\0'; if (strcmp(target, buf) == 0) { - info("preserve already existing symlink '%s' to '%s'", slink, target); + info("preserve already existing symlink '%s' to '%s'\n", slink, target); selinux_setfilecon(slink, NULL, S_IFLNK); goto exit; } } } } else { - info("creating symlink '%s' to '%s'", slink, target); + info("creating symlink '%s' to '%s'\n", slink, target); selinux_setfscreatecon(slink, NULL, S_IFLNK); retval = symlink(target, slink); selinux_resetfscreatecon(); @@ -160,7 +160,7 @@ static int node_symlink(const char *node, const char *slink) goto exit; } - info("atomically replace '%s'", slink); + info("atomically replace '%s'\n", slink); strlcpy(slink_tmp, slink, sizeof(slink_tmp)); strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); unlink(slink_tmp); @@ -168,12 +168,12 @@ static int node_symlink(const char *node, const char *slink) retval = symlink(target, slink_tmp); selinux_resetfscreatecon(); if (retval != 0) { - err("symlink(%s, %s) failed: %s", target, slink_tmp, strerror(errno)); + err("symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno)); goto exit; } retval = rename(slink_tmp, slink); if (retval != 0) { - err("rename(%s, %s) failed: %s", slink_tmp, slink, strerror(errno)); + err("rename(%s, %s) failed: %s\n", slink_tmp, slink, strerror(errno)); unlink(slink_tmp); goto exit; } @@ -198,11 +198,11 @@ static int update_link(struct udevice *udev, const char *name) strlcat(slink, name, sizeof(slink)); count = udev_db_get_devices_by_name(name, &name_list); - info("found %i devices with name '%s'", count, name); + info("found %i devices with name '%s'\n", count, name); /* if we don't have a reference, delete it */ if (count <= 0) { - info("no reference left, remove '%s'", name); + info("no reference left, remove '%s'\n", name); if (!udev->test_run) { unlink(slink); delete_path(slink); @@ -212,14 +212,14 @@ static int update_link(struct udevice *udev, const char *name) /* find the device with the highest priority */ list_for_each_entry(device, &name_list, node) { - info("found '%s' for '%s'", device->name, name); + info("found '%s' for '%s'\n", device->name, name); /* did we find ourself? we win, if we have the same priority */ if (strcmp(udev->dev->devpath, device->name) == 0) { - info("compare (our own) priority of '%s' %i >= %i", + info("compare (our own) priority of '%s' %i >= %i\n", udev->dev->devpath, udev->link_priority, priority); if (strcmp(udev->name, name) == 0) { - info("'%s' is our device node, database inconsistent, skip link update", udev->name); + info("'%s' is our device node, database inconsistent, skip link update\n", udev->name); } else if (target[0] == '\0' || udev->link_priority >= priority) { priority = udev->link_priority; strlcpy(target, udev->name, sizeof(target)); @@ -233,9 +233,9 @@ static int update_link(struct udevice *udev, const char *name) continue; if (udev_db_get_device(udev_db, device->name) == 0) { if (strcmp(udev_db->name, name) == 0) { - info("'%s' is a device node of '%s', skip link update", udev_db->name, device->name); + info("'%s' is a device node of '%s', skip link update\n", udev_db->name, device->name); } else { - info("compare priority of '%s' %i > %i", + info("compare priority of '%s' %i > %i\n", udev_db->dev->devpath, udev_db->link_priority, priority); if (target[0] == '\0' || udev_db->link_priority > priority) { priority = udev_db->link_priority; @@ -248,7 +248,7 @@ static int update_link(struct udevice *udev, const char *name) name_list_cleanup(&name_list); if (target[0] == '\0') { - info("no current target for '%s' found", name); + info("no current target for '%s' found\n", name); rc = 1; goto out; } @@ -257,7 +257,7 @@ static int update_link(struct udevice *udev, const char *name) strlcpy(node, udev_root, sizeof(node)); strlcat(node, "/", sizeof(node)); strlcat(node, target, sizeof(node)); - info("'%s' with target '%s' has the highest priority %i, create it", name, target, priority); + info("'%s' with target '%s' has the highest priority %i, create it\n", name, target, priority); if (!udev->test_run) { create_path(slink); node_symlink(node, slink); @@ -272,7 +272,7 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) char symlinks[PATH_SIZE] = ""; list_for_each_entry(name_loop, &udev->symlink_list, node) { - info("update symlink '%s' of '%s'", name_loop->name, udev->dev->devpath); + info("update symlink '%s' of '%s'\n", name_loop->name, udev->dev->devpath); update_link(udev, name_loop->name); strlcat(symlinks, udev_root, sizeof(symlinks)); strlcat(symlinks, "/", sizeof(symlinks)); @@ -302,7 +302,7 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) } if (!found) { /* link does no longer belong to this device */ - info("update old symlink '%s' no longer belonging to '%s'", + info("update old symlink '%s' no longer belonging to '%s'\n", link_old_loop->name, udev->dev->devpath); update_link(udev, link_old_loop->name); } @@ -356,7 +356,7 @@ int udev_node_add(struct udevice *udev) gid = lookup_group(udev->group); } - info("creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d", + info("creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d\n", filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid); if (!udev->test_run) @@ -380,7 +380,7 @@ int udev_node_add(struct udevice *udev) if (range > 1) udev->partitions = range-1; } - info("creating device partition nodes '%s[1-%i]'", filename, udev->partitions); + info("creating device partition nodes '%s[1-%i]'\n", filename, udev->partitions); if (!udev->test_run) { for (i = 1; i <= udev->partitions; i++) { dev_t part_devt; @@ -408,15 +408,15 @@ int udev_node_remove(struct udevice *udev) strlcat(filename, "/", sizeof(filename)); strlcat(filename, udev->name, sizeof(filename)); if (stat(filename, &stats) != 0) { - info("device node '%s' not found", filename); + info("device node '%s' not found\n", filename); return 0; } if (udev->devt && stats.st_rdev != udev->devt) { - info("device node '%s' points to a different device, skip removal", filename); + info("device node '%s' points to a different device, skip removal\n", filename); return -1; } - info("removing device node '%s'", filename); + info("removing device node '%s'\n", filename); if (!udev->test_run) retval = unlink_secure(filename); if (retval) @@ -427,7 +427,7 @@ int udev_node_remove(struct udevice *udev) if (num > 0) { int i; - info("removing all_partitions '%s[1-%i]'", filename, num); + info("removing all_partitions '%s[1-%i]'\n", filename, num); if (num > 255) return -1; for (i = 1; i <= num; i++) { diff --git a/udev_rules.c b/udev_rules.c index 8a793ffded..884cb7098c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -48,13 +48,13 @@ static char *get_format_attribute(char **str) if (*str[0] == '{') { pos = strchr(*str, '}'); if (pos == NULL) { - err("missing closing brace for format"); + err("missing closing brace for format\n"); return NULL; } pos[0] = '\0'; attr = *str+1; *str = pos+1; - dbg("attribute='%s', str='%s'", attr, *str); + dbg("attribute='%s', str='%s'\n", attr, *str); } return attr; } @@ -69,10 +69,10 @@ static int get_format_len(char **str) num = (int) strtoul(*str, &tail, 10); if (num > 0) { *str = tail; - dbg("format length=%i", num); + dbg("format length=%i\n", num); return num; } else { - err("format parsing error '%s'", *str); + err("format parsing error '%s'\n", *str); } } return -1; @@ -148,7 +148,7 @@ static int run_program(const char *command, const char *subsystem, } else { argv[i] = strsep(&pos, " "); } - dbg("arg[%i] '%s'", i, argv[i]); + dbg("arg[%i] '%s'\n", i, argv[i]); i++; } argv[i] = NULL; @@ -156,18 +156,18 @@ static int run_program(const char *command, const char *subsystem, argv[0] = arg; argv[1] = NULL; } - info("'%s'", command); + info("'%s'\n", command); /* prepare pipes from child to parent */ if (result != NULL || udev_log_priority >= LOG_INFO) { if (pipe(outpipe) != 0) { - err("pipe failed: %s", strerror(errno)); + err("pipe failed: %s\n", strerror(errno)); return -1; } } if (udev_log_priority >= LOG_INFO) { if (pipe(errpipe) != 0) { - err("pipe failed: %s", strerror(errno)); + err("pipe failed: %s\n", strerror(errno)); return -1; } } @@ -198,7 +198,7 @@ static int run_program(const char *command, const char *subsystem, dup2(devnull, STDERR_FILENO); close(devnull); } else - err("open /dev/null failed: %s", strerror(errno)); + err("open /dev/null failed: %s\n", strerror(errno)); if (outpipe[WRITE_END] > 0) { dup2(outpipe[WRITE_END], STDOUT_FILENO); close(outpipe[WRITE_END]); @@ -210,14 +210,14 @@ static int run_program(const char *command, const char *subsystem, execv(argv[0], argv); if (errno == ENOENT || errno == ENOTDIR) { /* may be on a filesytem which is not mounted right now */ - info("program '%s' not found", argv[0]); + info("program '%s' not found\n", argv[0]); } else { /* other problems */ - err("exec of program '%s' failed", argv[0]); + err("exec of program '%s' failed\n", argv[0]); } _exit(1); case -1: - err("fork of '%s' failed: %s", argv[0], strerror(errno)); + err("fork of '%s' failed: %s\n", argv[0], strerror(errno)); return -1; default: /* read from child if requested */ @@ -260,7 +260,7 @@ static int run_program(const char *command, const char *subsystem, close(outpipe[READ_END]); outpipe[READ_END] = -1; if (count < 0) { - err("stdin read failed: %s", strerror(errno)); + err("stdin read failed: %s\n", strerror(errno)); retval = -1; } continue; @@ -273,14 +273,14 @@ static int run_program(const char *command, const char *subsystem, memcpy(&result[respos], inbuf, count); respos += count; } else { - err("ressize %ld too short", (long)ressize); + err("ressize %ld too short\n", (long)ressize); retval = -1; } } pos = inbuf; while ((line = strsep(&pos, "\n"))) if (pos || line[0] != '\0') - info("'%s' (stdout) '%s'", argv[0], line); + info("'%s' (stdout) '%s'\n", argv[0], line); } /* get stderr */ @@ -294,14 +294,14 @@ static int run_program(const char *command, const char *subsystem, close(errpipe[READ_END]); errpipe[READ_END] = -1; if (count < 0) - err("stderr read failed: %s", strerror(errno)); + err("stderr read failed: %s\n", strerror(errno)); continue; } errbuf[count] = '\0'; pos = errbuf; while ((line = strsep(&pos, "\n"))) if (pos || line[0] != '\0') - info("'%s' (stderr) '%s'", argv[0], line); + info("'%s' (stderr) '%s'\n", argv[0], line); } } if (outpipe[READ_END] > 0) @@ -312,18 +312,18 @@ static int run_program(const char *command, const char *subsystem, /* return the childs stdout string */ if (result) { result[respos] = '\0'; - dbg("result='%s'", result); + dbg("result='%s'\n", result); if (reslen) *reslen = respos; } } waitpid(pid, &status, 0); if (WIFEXITED(status)) { - info("'%s' returned with status %i", argv[0], WEXITSTATUS(status)); + info("'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); if (WEXITSTATUS(status) != 0) retval = -1; } else { - err("'%s' abnormal exit", argv[0]); + err("'%s' abnormal exit\n", argv[0]); retval = -1; } } @@ -364,7 +364,7 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu continue; if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d", udev_config_filename, lineno); + err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); continue; } @@ -373,11 +373,11 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu linepos = line; if (get_key(&linepos, &variable, &value) == 0) { - dbg("import '%s=%s'", variable, value); + dbg("import '%s=%s'\n", variable, value); /* handle device, renamed by external tool, returning new path */ if (strcmp(variable, "DEVPATH") == 0) { - info("updating devpath from '%s' to '%s'", udev->dev->devpath, value); + info("updating devpath from '%s' to '%s'\n", udev->dev->devpath, value); sysfs_device_set_values(udev->dev, value, NULL, NULL); } else name_list_key_add(&udev->env_list, variable, value); @@ -394,7 +394,7 @@ static int import_file_into_env(struct udevice *udev, const char *filename) size_t bufsize; if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s': %s", filename, strerror(errno)); + err("can't open '%s': %s\n", filename, strerror(errno)); return -1; } import_keys_into_env(udev, buf, bufsize); @@ -423,13 +423,13 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) struct udevice *udev_parent; struct name_entry *name_loop; - dbg("found parent '%s', get the node name", dev_parent->devpath); + dbg("found parent '%s', get the node name\n", dev_parent->devpath); udev_parent = udev_device_init(NULL); if (udev_parent == NULL) return -1; /* import the udev_db of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { - dbg("import stored parent env '%s'", udev_parent->name); + dbg("import stored parent env '%s'\n", udev_parent->name); list_for_each_entry(name_loop, &udev_parent->env_list, node) { char name[NAME_SIZE]; char *pos; @@ -440,16 +440,16 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) pos[0] = '\0'; pos++; if (fnmatch(filter, name, 0) == 0) { - dbg("import key '%s'", name_loop->name); + dbg("import key '%s'\n", name_loop->name); name_list_add(&udev->env_list, name_loop->name, 0); setenv(name, pos, 1); } else - dbg("skip key '%s'", name_loop->name); + dbg("skip key '%s'\n", name_loop->name); } } rc = 0; } else - dbg("parent not found in database"); + dbg("parent not found in database\n"); udev_device_cleanup(udev_parent); } @@ -468,7 +468,7 @@ static int pass_env_to_socket(const char *sockpath, const char *devpath, const c ssize_t count; int retval = 0; - dbg("pass environment to socket '%s'", sockpath); + dbg("pass environment to socket '%s'\n", sockpath); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; @@ -498,7 +498,7 @@ static int pass_env_to_socket(const char *sockpath, const char *devpath, const c count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); if (count < 0) retval = -1; - info("passed %zi bytes to socket '%s', ", count, sockpath); + info("passed %zi bytes to socket '%s', \n", count, sockpath); close(sock); return retval; @@ -509,7 +509,7 @@ int udev_rules_run(struct udevice *udev) struct name_entry *name_loop; int retval = 0; - dbg("executing run list"); + dbg("executing run list\n"); list_for_each_entry(name_loop, &udev->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) { pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, udev->action); @@ -541,22 +541,22 @@ static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) strlcat(filepath, "/", sizeof(filepath)); strlcat(filepath, file, sizeof(filepath)); - dbg("will wait %i sec for '%s'", timeout, filepath); + dbg("will wait %i sec for '%s'\n", timeout, filepath); while (--loop) { /* lookup file */ if (stat(filepath, &stats) == 0) { - info("file '%s' appeared after %i loops", filepath, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + info("file '%s' appeared after %i loops\n", filepath, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } /* make sure, the device did not disappear in the meantime */ if (stat(devicepath, &stats) != 0) { - info("device disappeared while waiting for '%s'", filepath); + info("device disappeared while waiting for '%s'\n", filepath); return -2; } - info("wait for '%s' for %i mseconds", filepath, 1000 / WAIT_LOOP_PER_SECOND); + info("wait for '%s' for %i mseconds\n", filepath, 1000 / WAIT_LOOP_PER_SECOND); usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - info("waiting for '%s' failed", filepath); + info("waiting for '%s' failed\n", filepath); return -1; } @@ -707,12 +707,12 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { type = subst->type; tail = head + strlen(subst->name)+1; - dbg("will substitute format name '%s'", subst->name); + dbg("will substitute format name '%s'\n", subst->name); goto found; } } head[0] = '$'; - err("unknown format variable '%s'", head); + err("unknown format variable '%s'\n", head); } else if (head[0] == '%') { /* substitute format char */ if (head[1] == '\0') @@ -730,12 +730,12 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) if (tail[0] == subst->fmt) { type = subst->type; tail++; - dbg("will substitute format char '%c'", subst->fmt); + dbg("will substitute format char '%c'\n", subst->fmt); goto found; } } head[0] = '%'; - err("unknown format char '%c'", tail[0]); + err("unknown format char '%c'\n", tail[0]); } head++; } @@ -743,42 +743,42 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) found: attr = get_format_attribute(&tail); strlcpy(temp, tail, sizeof(temp)); - dbg("format=%i, string='%s', tail='%s'", type ,string, tail); + dbg("format=%i, string='%s', tail='%s'\n", type ,string, tail); switch (type) { case SUBST_DEVPATH: strlcat(string, udev->dev->devpath, maxsize); - dbg("substitute devpath '%s'", udev->dev->devpath); + dbg("substitute devpath '%s'\n", udev->dev->devpath); break; case SUBST_KERNEL: strlcat(string, udev->dev->kernel, maxsize); - dbg("substitute kernel name '%s'", udev->dev->kernel); + dbg("substitute kernel name '%s'\n", udev->dev->kernel); break; case SUBST_KERNEL_NUMBER: strlcat(string, udev->dev->kernel_number, maxsize); - dbg("substitute kernel number '%s'", udev->dev->kernel_number); + dbg("substitute kernel number '%s'\n", udev->dev->kernel_number); break; case SUBST_ID: if (udev->dev_parent != NULL) { strlcat(string, udev->dev_parent->kernel, maxsize); - dbg("substitute id '%s'", udev->dev_parent->kernel); + dbg("substitute id '%s'\n", udev->dev_parent->kernel); } break; case SUBST_DRIVER: if (udev->dev_parent != NULL) { strlcat(string, udev->dev_parent->driver, maxsize); - dbg("substitute driver '%s'", udev->dev_parent->driver); + dbg("substitute driver '%s'\n", udev->dev_parent->driver); } break; case SUBST_MAJOR: sprintf(temp2, "%d", major(udev->devt)); strlcat(string, temp2, maxsize); - dbg("substitute major number '%s'", temp2); + dbg("substitute major number '%s'\n", temp2); break; case SUBST_MINOR: sprintf(temp2, "%d", minor(udev->devt)); strlcat(string, temp2, maxsize); - dbg("substitute minor number '%s'", temp2); + dbg("substitute minor number '%s'\n", temp2); break; case SUBST_RESULT: if (udev->program_result[0] == '\0') @@ -788,7 +788,7 @@ found: if (attr != NULL) i = strtoul(attr, &rest, 10); if (i > 0) { - dbg("request part #%d of result string", i); + dbg("request part #%d of result string\n", i); cpos = udev->program_result; while (--i) { while (cpos[0] != '\0' && !isspace(cpos[0])) @@ -797,7 +797,7 @@ found: cpos++; } if (i > 0) { - err("requested part of result string not found"); + err("requested part of result string not found\n"); break; } strlcpy(temp2, cpos, sizeof(temp2)); @@ -808,15 +808,15 @@ found: cpos[0] = '\0'; } strlcat(string, temp2, maxsize); - dbg("substitute part of result string '%s'", temp2); + dbg("substitute part of result string '%s'\n", temp2); } else { strlcat(string, udev->program_result, maxsize); - dbg("substitute result string '%s'", udev->program_result); + dbg("substitute result string '%s'\n", udev->program_result); } break; case SUBST_ATTR: if (attr == NULL) - err("missing file parameter for attr"); + err("missing file parameter for attr\n"); else { char devpath[PATH_SIZE]; char *attrib; @@ -839,7 +839,7 @@ found: struct sysfs_device *dev_parent = udev->dev; do { - dbg("looking at '%s'", dev_parent->devpath); + dbg("looking at '%s'\n", dev_parent->devpath); value = sysfs_attr_get_value(dev_parent->devpath, attr); if (value != NULL) { strlcpy(temp2, value, sizeof(temp2)); @@ -860,9 +860,9 @@ found: temp2[--size] = '\0'; count = replace_chars(temp2, ALLOWED_CHARS_INPUT); if (count > 0) - info("%i character(s) replaced" , count); + info("%i character(s) replaced\n" , count); strlcat(string, temp2, maxsize); - dbg("substitute sysfs value '%s'", temp2); + dbg("substitute sysfs value '%s'\n", temp2); } break; case SUBST_PARENT: @@ -873,15 +873,15 @@ found: if (dev_parent != NULL) { struct udevice *udev_parent; - dbg("found parent '%s', get the node name", dev_parent->devpath); + dbg("found parent '%s', get the node name\n", dev_parent->devpath); udev_parent = udev_device_init(NULL); if (udev_parent != NULL) { /* lookup the name in the udev_db with the DEVPATH of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { strlcat(string, udev_parent->name, maxsize); - dbg("substitute parent node name'%s'", udev_parent->name); + dbg("substitute parent node name'%s'\n", udev_parent->name); } else - dbg("parent not found in database"); + dbg("parent not found in database\n"); udev_device_cleanup(udev_parent); } } @@ -889,48 +889,48 @@ found: break; case SUBST_TEMP_NODE: if (udev->tmp_node[0] == '\0' && major(udev->devt) > 0) { - dbg("create temporary device node for callout"); + dbg("create temporary device node for callout\n"); snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", udev_root, major(udev->devt), minor(udev->devt)); udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0'; udev_node_mknod(udev, udev->tmp_node, udev->devt, 0600, 0, 0); } strlcat(string, udev->tmp_node, maxsize); - dbg("substitute temporary device node name '%s'", udev->tmp_node); + dbg("substitute temporary device node name '%s'\n", udev->tmp_node); break; case SUBST_NAME: strlcat(string, udev->name, maxsize); - dbg("substitute udev->name '%s'", udev->name); + dbg("substitute udev->name '%s'\n", udev->name); break; case SUBST_ROOT: strlcat(string, udev_root, maxsize); - dbg("substitute udev_root '%s'", udev_root); + dbg("substitute udev_root '%s'\n", udev_root); break; case SUBST_SYS: strlcat(string, sysfs_path, maxsize); - dbg("substitute sysfs_path '%s'", sysfs_path); + dbg("substitute sysfs_path '%s'\n", sysfs_path); break; case SUBST_ENV: if (attr == NULL) { - dbg("missing attribute"); + dbg("missing attribute\n"); break; } pos = getenv(attr); if (pos == NULL) { - dbg("env '%s' not available", attr); + dbg("env '%s' not available\n", attr); break; } - dbg("substitute env '%s=%s'", attr, pos); + dbg("substitute env '%s=%s'\n", attr, pos); strlcat(string, pos, maxsize); break; default: - err("unknown substitution type=%i", type); + err("unknown substitution type=%i\n", type); break; } /* possibly truncate to format-char specified length */ if (len >= 0 && len < (int)strlen(head)) { head[len] = '\0'; - dbg("truncate to %i chars, subtitution string becomes '%s'", len, head); + dbg("truncate to %i chars, subtitution string becomes '%s'\n", len, head); } strlcat(string, temp, maxsize); } @@ -960,7 +960,7 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k /* look for a matching string, parts are separated by '|' */ strlcpy(value, rule->buf + key->val_off, sizeof(value)); key_value = value; - dbg("key %s value='%s'", key_name, key_value); + dbg("key %s value='%s'\n", key_name, key_value); while (key_value) { pos = strchr(key_value, '|'); if (pos) { @@ -968,7 +968,7 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k pos++; } - dbg("match %s '%s' <-> '%s'", key_name, key_value, val); + dbg("match %s '%s' <-> '%s'\n", key_name, key_value, val); match = (fnmatch(key_value, val, 0) == 0); if (match) break; @@ -977,11 +977,11 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k } if (match && (key->operation == KEY_OP_MATCH)) { - dbg("%s is true (matching value)", key_name); + dbg("%s is true (matching value)\n", key_name); return 0; } if (!match && (key->operation == KEY_OP_NOMATCH)) { - dbg("%s is true (non-matching value)", key_name); + dbg("%s is true (non-matching value)\n", key_name); return 0; } return -1; @@ -1037,7 +1037,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) const char *value = getenv(key_name); if (!value) { - dbg("ENV{'%s'} is not set, treat as empty", key_name); + dbg("ENV{'%s'} is not set, treat as empty\n", key_name); value = ""; } if (match_key("ENV", rule, &pair->key, value)) @@ -1076,10 +1076,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) attr_subst_subdir(filename, sizeof(filename)); match = (stat(filename, &statbuf) == 0); - info("'%s' %s", filename, match ? "exists" : "does not exist"); + info("'%s' %s", filename, match ? "exists" : "does not exist\n"); if (match && rule->test_mode_mask > 0) { match = ((statbuf.st_mode & rule->test_mode_mask) > 0); - info("'%s' has mode=%#o and %s %#o", filename, statbuf.st_mode, + info("'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, match ? "matches" : "does not match", rule->test_mode_mask); } @@ -1087,7 +1087,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) goto nomatch; if (!match && rule->test.operation == KEY_OP_MATCH) goto nomatch; - dbg("TEST key is true"); + dbg("TEST key is true\n"); } if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { @@ -1130,7 +1130,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) len = strlen(val); while (len > 0 && isspace(val[len-1])) val[--len] = '\0'; - dbg("removed %zi trailing whitespace chars from '%s'", strlen(val)-len, val); + dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); } if (match_key("ATTR", rule, &pair->key, val)) @@ -1178,7 +1178,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) len = strlen(val); while (len > 0 && isspace(val[len-1])) val[--len] = '\0'; - dbg("removed %zi trailing whitespace chars from '%s'", strlen(val)-len, val); + dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); } if (match_key("ATTRS", rule, &pair->key, val)) @@ -1190,12 +1190,12 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) break; try_parent: /* move to parent device */ - dbg("try parent sysfs device"); + dbg("try parent sysfs device\n"); udev->dev_parent = sysfs_device_get_parent(udev->dev_parent); if (udev->dev_parent == NULL) goto nomatch; - dbg("looking at dev_parent->devpath='%s'", udev->dev_parent->devpath); - dbg("looking at dev_parent->kernel='%s'", udev->dev_parent->kernel); + dbg("looking at dev_parent->devpath='%s'\n", udev->dev_parent->devpath); + dbg("looking at dev_parent->kernel='%s'\n", udev->dev_parent->kernel); } /* execute external program */ @@ -1206,28 +1206,28 @@ try_parent: strlcpy(program, key_val(rule, &rule->program), sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL) != 0) { - dbg("PROGRAM is false"); + dbg("PROGRAM is false\n"); udev->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) goto nomatch; } else { int count; - dbg("PROGRAM matches"); + dbg("PROGRAM matches\n"); remove_trailing_chars(result, '\n'); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { count = replace_chars(result, ALLOWED_CHARS_INPUT); if (count > 0) - info("%i character(s) replaced" , count); + info("%i character(s) replaced\n" , count); } - dbg("result is '%s'", result); + dbg("result is '%s'\n", result); strlcpy(udev->program_result, result, sizeof(udev->program_result)); - dbg("PROGRAM returned successful"); + dbg("PROGRAM returned successful\n"); if (rule->program.operation == KEY_OP_NOMATCH) goto nomatch; } - dbg("PROGRAM key is true"); + dbg("PROGRAM key is true\n"); } /* check for matching result of external program */ @@ -1241,23 +1241,23 @@ try_parent: strlcpy(import, key_val(rule, &rule->import), sizeof(import)); udev_rules_apply_format(udev, import, sizeof(import)); - dbg("check for IMPORT import='%s'", import); + dbg("check for IMPORT import='%s'\n", import); if (rule->import_type == IMPORT_PROGRAM) { rc = import_program_into_env(udev, import); } else if (rule->import_type == IMPORT_FILE) { - dbg("import file import='%s'", import); + dbg("import file import='%s'\n", import); rc = import_file_into_env(udev, import); } else if (rule->import_type == IMPORT_PARENT) { - dbg("import parent import='%s'", import); + dbg("import parent import='%s'\n", import); rc = import_parent_into_env(udev, import); } if (rc != 0) { - dbg("IMPORT failed"); + dbg("IMPORT failed\n"); if (rule->import.operation != KEY_OP_NOMATCH) goto nomatch; } else - dbg("IMPORT '%s' imported", key_val(rule, &rule->import)); - dbg("IMPORT key is true"); + dbg("IMPORT '%s' imported\n", key_val(rule, &rule->import)); + dbg("IMPORT key is true\n"); } /* rule matches, if we have ENV assignments export it */ @@ -1276,7 +1276,7 @@ try_parent: if (temp_value[0] == '\0') { name_list_key_remove(&udev->env_list, key_name); unsetenv(key_name); - info("unset ENV '%s'", key_name); + info("unset ENV '%s'\n", key_name); } else { struct name_entry *entry; @@ -1284,7 +1284,7 @@ try_parent: if (entry == NULL) break; putenv(entry->name); - info("set ENV '%s'", entry->name); + info("set ENV '%s'\n", entry->name); } } } @@ -1321,15 +1321,15 @@ try_parent: strlcpy(value, key_val(rule, &pair->key), sizeof(value)); udev_rules_apply_format(udev, value, sizeof(value)); - info("writing '%s' to sysfs file '%s'", value, attr); + info("writing '%s' to sysfs file '%s'\n", value, attr); f = fopen(attr, "w"); if (f != NULL) { if (!udev->test_run) if (fprintf(f, "%s", value) <= 0) - err("error writing ATTR{%s}: %s", attr, strerror(errno)); + err("error writing ATTR{%s}: %s\n", attr, strerror(errno)); fclose(f); } else - err("error opening ATTR{%s} for writing: %s", attr, strerror(errno)); + err("error opening ATTR{%s} for writing: %s\n", attr, strerror(errno)); } } return 0; @@ -1343,8 +1343,8 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) struct udev_rule *rule; int name_set = 0; - dbg("udev->dev->devpath='%s'", udev->dev->devpath); - dbg("udev->dev->kernel='%s'", udev->dev->kernel); + dbg("udev->dev->devpath='%s'\n", udev->dev->devpath); + dbg("udev->dev->kernel='%s'\n", udev->dev->kernel); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -1357,31 +1357,31 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) (rule->name.operation == KEY_OP_ASSIGN || rule->name.operation == KEY_OP_ASSIGN_FINAL || rule->name.operation == KEY_OP_ADD)) { - dbg("node name already set, rule ignored"); + dbg("node name already set, rule ignored\n"); continue; } - dbg("process rule"); + dbg("process rule\n"); if (match_rule(udev, rule) == 0) { /* apply options */ if (rule->ignore_device) { - info("rule applied, '%s' is ignored", udev->dev->kernel); + info("rule applied, '%s' is ignored\n", udev->dev->kernel); udev->ignore_device = 1; return 0; } if (rule->ignore_remove) { udev->ignore_remove = 1; - dbg("remove event should be ignored"); + dbg("remove event should be ignored\n"); } if (rule->link_priority != 0) { udev->link_priority = rule->link_priority; - info("link_priority=%i", udev->link_priority); + info("link_priority=%i\n", udev->link_priority); } /* apply all_partitions option only at a main block device */ if (rule->partitions && strcmp(udev->dev->subsystem, "block") == 0 && udev->dev->kernel_number[0] == '\0') { udev->partitions = rule->partitions; - dbg("creation of partition nodes requested"); + dbg("creation of partition nodes requested\n"); } /* apply permissions */ @@ -1389,21 +1389,21 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) udev->mode_final = 1; udev->mode = strtol(key_val(rule, &rule->mode), NULL, 8); - dbg("applied mode=%#o to '%s'", udev->mode, udev->dev->kernel); + dbg("applied mode=%#o to '%s'\n", udev->mode, udev->dev->kernel); } if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) udev->owner_final = 1; strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner)); udev_rules_apply_format(udev, udev->owner, sizeof(udev->owner)); - dbg("applied owner='%s' to '%s'", udev->owner, udev->dev->kernel); + dbg("applied owner='%s' to '%s'\n", udev->owner, udev->dev->kernel); } if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) { if (rule->group.operation == KEY_OP_ASSIGN_FINAL) udev->group_final = 1; strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); udev_rules_apply_format(udev, udev->group, sizeof(udev->group)); - dbg("applied group='%s' to '%s'", udev->group, udev->dev->kernel); + dbg("applied group='%s' to '%s'\n", udev->group, udev->dev->kernel); } /* collect symlinks */ @@ -1419,7 +1419,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) udev->symlink_final = 1; if (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { - info("reset symlink list"); + info("reset symlink list\n"); name_list_cleanup(&udev->symlink_list); } /* allow multiple symlinks separated by spaces */ @@ -1429,16 +1429,16 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) rule->string_escape == ESCAPE_REPLACE) { count = replace_chars(temp, ALLOWED_CHARS_FILE " "); if (count > 0) - info("%i character(s) replaced" , count); + info("%i character(s) replaced\n" , count); } - dbg("rule applied, added symlink(s) '%s'", temp); + dbg("rule applied, added symlink(s) '%s'\n", temp); pos = temp; while (isspace(pos[0])) pos++; next = strchr(pos, ' '); while (next) { next[0] = '\0'; - info("add symlink '%s'", pos); + info("add symlink '%s'\n", pos); name_list_add(&udev->symlink_list, pos, 0); while (isspace(next[1])) next++; @@ -1446,7 +1446,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) next = strchr(pos, ' '); } if (pos[0] != '\0') { - info("add symlink '%s'", pos); + info("add symlink '%s'\n", pos); name_list_add(&udev->symlink_list, pos, 0); } } @@ -1464,12 +1464,12 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) rule->string_escape == ESCAPE_REPLACE) { count = replace_chars(udev->name, ALLOWED_CHARS_FILE); if (count > 0) - info("%i character(s) replaced", count); + info("%i character(s) replaced\n", count); } - info("rule applied, '%s' becomes '%s'", udev->dev->kernel, udev->name); + info("rule applied, '%s' becomes '%s'\n", udev->dev->kernel, udev->name); if (strcmp(udev->dev->subsystem, "net") != 0) - dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i", + dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i\n", udev->name, udev->owner, udev->group, udev->mode, udev->partitions); } @@ -1479,34 +1479,34 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (rule->run.operation == KEY_OP_ASSIGN_FINAL) udev->run_final = 1; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info("reset run list"); + info("reset run list\n"); name_list_cleanup(&udev->run_list); } - dbg("add run '%s'", key_val(rule, &rule->run)); + dbg("add run '%s'\n", key_val(rule, &rule->run)); entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); if (rule->run_ignore_error) entry->ignore_error = 1; } if (rule->last_rule) { - dbg("last rule to be applied"); + dbg("last rule to be applied\n"); break; } if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg("moving forward to label '%s'", key_val(rule, &rule->goto_label)); + dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); } } } if (!name_set) { - info("no node name set, will use kernel name '%s'", udev->dev->kernel); + info("no node name set, will use kernel name '%s'\n", udev->dev->kernel); strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); } if (udev->tmp_node[0] != '\0') { - dbg("removing temporary device node"); + dbg("removing temporary device node\n"); unlink_secure(udev->tmp_node); udev->tmp_node[0] = '\0'; } @@ -1518,7 +1518,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) { struct udev_rule *rule; - dbg("udev->kernel='%s'", udev->dev->kernel); + dbg("udev->kernel='%s'\n", udev->dev->kernel); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -1527,7 +1527,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) if (rule == NULL) break; - dbg("process rule"); + dbg("process rule\n"); if (rule->name.operation == KEY_OP_ASSIGN || rule->name.operation == KEY_OP_ASSIGN_FINAL || rule->name.operation == KEY_OP_ADD || @@ -1536,19 +1536,19 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) rule->symlink.operation == KEY_OP_ADD || rule->mode.operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { - dbg("skip rule that names a device"); + dbg("skip rule that names a device\n"); continue; } if (match_rule(udev, rule) == 0) { if (rule->ignore_device) { - info("rule applied, '%s' is ignored", udev->dev->kernel); + info("rule applied, '%s' is ignored\n", udev->dev->kernel); udev->ignore_device = 1; return 0; } if (rule->ignore_remove) { udev->ignore_remove = 1; - dbg("remove event should be ignored"); + dbg("remove event should be ignored\n"); } if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { @@ -1556,10 +1556,10 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info("reset run list"); + info("reset run list\n"); name_list_cleanup(&udev->run_list); } - dbg("add run '%s'", key_val(rule, &rule->run)); + dbg("add run '%s'\n", key_val(rule, &rule->run)); entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); if (rule->run_ignore_error) entry->ignore_error = 1; @@ -1568,12 +1568,12 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) } if (rule->last_rule) { - dbg("last rule to be applied"); + dbg("last rule to be applied\n"); break; } if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg("moving forward to label '%s'", key_val(rule, &rule->goto_label)); + dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); } } diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 6d88354dbd..b586df1324 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -33,7 +33,7 @@ void udev_rules_iter_init(struct udev_rules *rules) { - dbg("bufsize=%zi", rules->bufsize); + dbg("bufsize=%zi\n", rules->bufsize); rules->current = 0; } @@ -44,9 +44,9 @@ struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) if (!rules) return NULL; - dbg("current=%zi", rules->current); + dbg("current=%zi\n", rules->current); if (rules->current >= rules->bufsize) { - dbg("no more rules"); + dbg("no more rules\n"); return NULL; } @@ -62,20 +62,20 @@ struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *la static struct udev_rule *rule; next: - dbg("current=%zi", rules->current); + dbg("current=%zi\n", rules->current); if (rules->current >= rules->bufsize) { - dbg("no more rules"); + dbg("no more rules\n"); return NULL; } rule = (struct udev_rule *) (rules->buf + rules->current); if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { - dbg("moving forward, looking for label '%s'", label); + dbg("moving forward, looking for label '%s'\n", label); rules->current += sizeof(struct udev_rule) + rule->bufsize; goto next; } - dbg("found label '%s'", label); + dbg("found label '%s'\n", label); return rule; } @@ -123,29 +123,29 @@ static int get_key(char **line, char **key, enum key_operation *operation, char if (linepos[0] == '=' && linepos[1] == '=') { *operation = KEY_OP_MATCH; linepos += 2; - dbg("operator=match"); + dbg("operator=match\n"); } else if (linepos[0] == '!' && linepos[1] == '=') { *operation = KEY_OP_NOMATCH; linepos += 2; - dbg("operator=nomatch"); + dbg("operator=nomatch\n"); } else if (linepos[0] == '+' && linepos[1] == '=') { *operation = KEY_OP_ADD; linepos += 2; - dbg("operator=add"); + dbg("operator=add\n"); } else if (linepos[0] == '=') { *operation = KEY_OP_ASSIGN; linepos++; - dbg("operator=assign"); + dbg("operator=assign\n"); } else if (linepos[0] == ':' && linepos[1] == '=') { *operation = KEY_OP_ASSIGN_FINAL; linepos += 2; - dbg("operator=assign_final"); + dbg("operator=assign_final\n"); } else return -1; /* terminate key */ temp[0] = '\0'; - dbg("key='%s'", *key); + dbg("key='%s'\n", *key); /* skip whitespace after operator */ while (isspace(linepos[0])) @@ -165,7 +165,7 @@ static int get_key(char **line, char **key, enum key_operation *operation, char return -1; temp[0] = '\0'; temp++; - dbg("value='%s'", *value); + dbg("value='%s'\n", *value); /* move line to next key */ *line = temp; @@ -184,11 +184,11 @@ static char *get_key_attribute(char *str) attr++; pos = strchr(attr, '}'); if (pos == NULL) { - err("missing closing brace for format"); + err("missing closing brace for format\n"); return NULL; } pos[0] = '\0'; - dbg("attribute='%s'", attr); + dbg("attribute='%s'\n", attr); return attr; } @@ -215,7 +215,7 @@ static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs, size_t key_len = strnlen(key, PATH_SIZE); if (pairs->count >= PAIRS_MAX) { - err("skip, too many keys of the same type in a single rule"); + err("skip, too many keys of the same type in a single rule\n"); return -1; } @@ -261,7 +261,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "ACTION") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid ACTION operation"); + err("invalid ACTION operation\n"); goto invalid; } add_rule_key(rule, &rule->action, operation, value); @@ -272,7 +272,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "DEVPATH") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DEVPATH operation"); + err("invalid DEVPATH operation\n"); goto invalid; } add_rule_key(rule, &rule->devpath, operation, value); @@ -283,7 +283,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "KERNEL") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid KERNEL operation"); + err("invalid KERNEL operation\n"); goto invalid; } add_rule_key(rule, &rule->kernel, operation, value); @@ -294,7 +294,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "SUBSYSTEM") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid SUBSYSTEM operation"); + err("invalid SUBSYSTEM operation\n"); goto invalid; } /* bus, class, subsystem events should all be the same */ @@ -302,7 +302,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) { if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) - err("'%s' must be specified as 'subsystem' " + err("'%s' must be specified as 'subsystem' \n" "please fix it in %s:%u", value, filename, lineno); add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); } else @@ -314,7 +314,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "DRIVER") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DRIVER operation"); + err("invalid DRIVER operation\n"); goto invalid; } add_rule_key(rule, &rule->driver, operation, value); @@ -325,7 +325,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { attr = get_key_attribute(key + sizeof("ATTR")-1); if (attr == NULL) { - err("error parsing ATTR attribute"); + err("error parsing ATTR attribute\n"); goto invalid; } if (add_rule_key_pair(rule, &rule->attr, operation, attr, value) != 0) @@ -338,7 +338,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strcasecmp(key, "ID") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid KERNELS operation"); + err("invalid KERNELS operation\n"); goto invalid; } add_rule_key(rule, &rule->kernels, operation, value); @@ -350,7 +350,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strcasecmp(key, "BUS") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid SUBSYSTEMS operation"); + err("invalid SUBSYSTEMS operation\n"); goto invalid; } add_rule_key(rule, &rule->subsystems, operation, value); @@ -361,7 +361,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "DRIVERS") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DRIVERS operation"); + err("invalid DRIVERS operation\n"); goto invalid; } add_rule_key(rule, &rule->drivers, operation, value); @@ -373,19 +373,19 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid ATTRS operation"); + err("invalid ATTRS operation\n"); goto invalid; } attr = get_key_attribute(key + sizeof("ATTRS")-1); if (attr == NULL) { - err("error parsing ATTRS attribute"); + err("error parsing ATTRS attribute\n"); goto invalid; } if (strncmp(attr, "device/", 7) == 0) - err("the 'device' link is deprecated and will be removed from a future kernel, " + err("the 'device' link is deprecated and will be removed from a future kernel, \n" "please fix it in %s:%u", filename, lineno); else if (strstr(attr, "../") != NULL) - err("do not reference parent sysfs directories directly, that may break with a future kernel, " + err("do not reference parent sysfs directories directly, that may break with a future kernel, \n" "please fix it in %s:%u", filename, lineno); if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0) goto invalid; @@ -396,7 +396,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { attr = get_key_attribute(key + sizeof("ENV")-1); if (attr == NULL) { - err("error parsing ENV attribute"); + err("error parsing ENV attribute\n"); goto invalid; } if (strncmp(attr, "PHYSDEV", 7) == 0) @@ -416,7 +416,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "RESULT") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid RESULT operation"); + err("invalid RESULT operation\n"); goto invalid; } add_rule_key(rule, &rule->result, operation, value); @@ -427,13 +427,13 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { attr = get_key_attribute(key + sizeof("IMPORT")-1); if (attr != NULL && strstr(attr, "program")) { - dbg("IMPORT will be executed"); + dbg("IMPORT will be executed\n"); rule->import_type = IMPORT_PROGRAM; } else if (attr != NULL && strstr(attr, "file")) { - dbg("IMPORT will be included as file"); + dbg("IMPORT will be included as file\n"); rule->import_type = IMPORT_FILE; } else if (attr != NULL && strstr(attr, "parent")) { - dbg("IMPORT will include the parent values"); + dbg("IMPORT will include the parent values\n"); rule->import_type = IMPORT_PARENT; } else { /* figure it out if it is executable */ @@ -455,12 +455,12 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena pos[0] = '\0'; } - dbg("IMPORT auto mode for '%s'", file); + dbg("IMPORT auto mode for '%s'\n", file); if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { - dbg("IMPORT is executable, will be executed (autotype)"); + dbg("IMPORT is executable, will be executed (autotype)\n"); rule->import_type = IMPORT_PROGRAM; } else { - dbg("IMPORT is not executable, will be included as file (autotype)"); + dbg("IMPORT is not executable, will be included as file (autotype)\n"); rule->import_type = IMPORT_FILE; } } @@ -472,7 +472,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid TEST operation"); + err("invalid TEST operation\n"); goto invalid; } attr = get_key_attribute(key + sizeof("TEST")-1); @@ -516,16 +516,16 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena attr = get_key_attribute(key + sizeof("NAME")-1); if (attr != NULL) { if (strstr(attr, "all_partitions") != NULL) { - dbg("creation of partition nodes requested"); + dbg("creation of partition nodes requested\n"); rule->partitions = DEFAULT_PARTITIONS_COUNT; } if (strstr(attr, "ignore_remove") != NULL) { - dbg("remove event should be ignored"); + dbg("remove event should be ignored\n"); rule->ignore_remove = 1; } } if (value[0] == '\0') - dbg("name empty, node creation supressed"); + dbg("name empty, node creation supressed\n"); add_rule_key(rule, &rule->name, operation, value); continue; } @@ -548,7 +548,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (endptr[0] != '\0') { char owner[32]; uid_t uid = lookup_user(value); - dbg("replacing username='%s' by id=%i", value, uid); + dbg("replacing username='%s' by id=%i\n", value, uid); sprintf(owner, "%u", (unsigned int) uid); add_rule_key(rule, &rule->owner, operation, owner); continue; @@ -567,7 +567,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (endptr[0] != '\0') { char group[32]; gid_t gid = lookup_group(value); - dbg("replacing groupname='%s' by id=%i", value, gid); + dbg("replacing groupname='%s' by id=%i\n", value, gid); sprintf(group, "%u", (unsigned int) gid); add_rule_key(rule, &rule->group, operation, group); continue; @@ -588,21 +588,21 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena const char *pos; if (strstr(value, "last_rule") != NULL) { - dbg("last rule to be applied"); + dbg("last rule to be applied\n"); rule->last_rule = 1; } if (strstr(value, "ignore_device") != NULL) { - dbg("device should be ignored"); + dbg("device should be ignored\n"); rule->ignore_device = 1; } if (strstr(value, "ignore_remove") != NULL) { - dbg("remove event should be ignored"); + dbg("remove event should be ignored\n"); rule->ignore_remove = 1; } pos = strstr(value, "link_priority="); if (pos != NULL) { rule->link_priority = atoi(&pos[strlen("link_priority=")]); - dbg("link priority=%i", rule->link_priority); + dbg("link priority=%i\n", rule->link_priority); } pos = strstr(value, "string_escape="); if (pos != NULL) { @@ -613,18 +613,18 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena rule->string_escape = ESCAPE_REPLACE; } if (strstr(value, "all_partitions") != NULL) { - dbg("creation of partition nodes requested"); + dbg("creation of partition nodes requested\n"); rule->partitions = DEFAULT_PARTITIONS_COUNT; } valid = 1; continue; } - err("unknown key '%s' in %s:%u", key, filename, lineno); + err("unknown key '%s' in %s:%u\n", key, filename, lineno); } if (physdev && rule->wait_for_sysfs.operation == KEY_OP_UNSET) - err("PHYSDEV* values are deprecated and will be removed from a future kernel, " + err("PHYSDEV* values are deprecated and will be removed from a future kernel, \n" "please fix it in %s:%u", filename, lineno); /* skip line if not any valid key was found */ @@ -634,23 +634,23 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena /* grow buffer and add rule */ rule_size = sizeof(struct udev_rule) + rule->bufsize; padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); - dbg("add %zi padding bytes", padding); + dbg("add %zi padding bytes\n", padding); rule_size += padding; rule->bufsize += padding; rules->buf = realloc(rules->buf, rules->bufsize + rule_size); if (!rules->buf) { - err("realloc failed"); + err("realloc failed\n"); goto exit; } - dbg("adding rule to offset %zi", rules->bufsize); + dbg("adding rule to offset %zi\n", rules->bufsize); memcpy(rules->buf + rules->bufsize, rule, rule_size); rules->bufsize += rule_size; exit: return 0; invalid: - err("invalid rule '%s:%u'", filename, lineno); + err("invalid rule '%s:%u'\n", filename, lineno); return -1; } @@ -666,10 +666,10 @@ static int parse_file(struct udev_rules *rules, const char *filename) int retval = 0; if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s' as rules file: %s", filename, strerror(errno)); + err("can't open '%s' as rules file: %s\n", filename, strerror(errno)); return -1; } - info("reading '%s' as rules file", filename); + info("reading '%s' as rules file\n", filename); /* loop through the whole file */ cur = 0; @@ -695,7 +695,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) continue; if (count >= sizeof(line)) { - err("line too long, rule skipped '%s:%u'", filename, lineno); + err("line too long, rule skipped '%s:%u'\n", filename, lineno); continue; } @@ -708,7 +708,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) } line[j] = '\0'; - dbg("read '%s'", line); + dbg("read '%s'\n", line); add_to_rules(rules, line, filename, lineno); } @@ -733,10 +733,10 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) if (stat(udev_rules_dir, &statbuf) != 0) return -1; if ((statbuf.st_mode & S_IFMT) != S_IFDIR) { - dbg("parse single rules file '%s'", udev_rules_dir); + dbg("parse single rules file '%s'\n", udev_rules_dir); name_list_add(&name_list, udev_rules_dir, 1); } else { - dbg("parse rules directory '%s'", udev_rules_dir); + dbg("parse rules directory '%s'\n", udev_rules_dir); retval = add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX); } @@ -776,9 +776,9 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) if (statbuf.st_size) parse_file(rules, name_loop->name); else - dbg("empty rules file '%s'", name_loop->name); + dbg("empty rules file '%s'\n", name_loop->name); } else - err("could not read '%s': %s", name_loop->name, strerror(errno)); + err("could not read '%s': %s\n", name_loop->name, strerror(errno)); list_del(&name_loop->node); free(name_loop); } diff --git a/udev_selinux.c b/udev_selinux.c index 3fa84a0d43..eec950194c 100644 --- a/udev_selinux.c +++ b/udev_selinux.c @@ -40,7 +40,7 @@ static int is_selinux_running(void) if (selinux_enabled == -1) selinux_enabled = (is_selinux_enabled() > 0); - dbg("selinux=%i", selinux_enabled); + dbg("selinux=%i\n", selinux_enabled); return selinux_enabled; } @@ -75,7 +75,7 @@ static char *get_media(const char *devname, int mode) } media = strdup(mediabuf); - info("selinux_get_media(%s)='%s'", devname, media); + info("selinux_get_media(%s)='%s'\n", devname, media); close_out: fclose(fp); @@ -100,12 +100,12 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed", file); + err("matchpathcon(%s) failed\n", file); return; } if (lsetfilecon(file, scontext) < 0) - err("setfilecon %s failed: %s", file, strerror(errno)); + err("setfilecon %s failed: %s\n", file, strerror(errno)); freecon(scontext); } @@ -128,12 +128,12 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed", file); + err("matchpathcon(%s) failed\n", file); return; } if (setfscreatecon(scontext) < 0) - err("setfscreatecon %s failed: %s", file, strerror(errno)); + err("setfscreatecon %s failed: %s\n", file, strerror(errno)); freecon(scontext); } @@ -143,7 +143,7 @@ void selinux_resetfscreatecon(void) { if (is_selinux_running()) { if (setfscreatecon(prev_scontext) < 0) - err("setfscreatecon failed: %s", strerror(errno)); + err("setfscreatecon failed: %s\n", strerror(errno)); } } @@ -155,10 +155,10 @@ void selinux_init(void) */ if (is_selinux_running()) { if (!udev_root[0]) - err("selinux_init: udev_root not set"); + err("selinux_init: udev_root not set\n"); matchpathcon_init_prefix(NULL, udev_root); if (getfscreatecon(&prev_scontext) < 0) { - err("getfscreatecon failed"); + err("getfscreatecon failed\n"); prev_scontext = NULL; } } diff --git a/udev_sysfs.c b/udev_sysfs.c index 9293305b81..c4cd4ab75d 100644 --- a/udev_sysfs.c +++ b/udev_sysfs.c @@ -52,7 +52,7 @@ int sysfs_init(void) remove_trailing_chars(sysfs_path, '/'); } else strlcpy(sysfs_path, "/sys", sizeof(sysfs_path)); - dbg("sysfs_path='%s'", sysfs_path); + dbg("sysfs_path='%s'\n", sysfs_path); INIT_LIST_HEAD(&dev_list); INIT_LIST_HEAD(&attr_list); @@ -93,7 +93,7 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, if (pos == NULL) return; strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); - dbg("kernel='%s'", dev->kernel); + dbg("kernel='%s'\n", dev->kernel); /* some devices have '!' in their name, change that to '/' */ pos = dev->kernel; @@ -108,7 +108,7 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, while (isdigit(pos[-1])) pos--; strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); - dbg("kernel_number='%s'", dev->kernel_number); + dbg("kernel_number='%s'\n", dev->kernel_number); } int sysfs_resolve_link(char *devpath, size_t size) @@ -125,11 +125,11 @@ int sysfs_resolve_link(char *devpath, size_t size) if (len <= 0) return -1; link_target[len] = '\0'; - dbg("path link '%s' points to '%s'", devpath, link_target); + dbg("path link '%s' points to '%s'\n", devpath, link_target); for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) ; - dbg("base '%s', tail '%s', back %i", devpath, &link_target[back * 3], back); + dbg("base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); for (i = 0; i <= back; i++) { char *pos = strrchr(devpath, '/'); @@ -137,7 +137,7 @@ int sysfs_resolve_link(char *devpath, size_t size) return -1; pos[0] = '\0'; } - dbg("after moving back '%s'", devpath); + dbg("after moving back '%s'\n", devpath); strlcat(devpath, "/", size); strlcat(devpath, &link_target[back * 3], size); return 0; @@ -165,7 +165,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strncmp(devpath, "/block/", 7) != 0) return NULL; - dbg("open '%s'", devpath); + dbg("open '%s'\n", devpath); strlcpy(devpath_real, devpath, sizeof(devpath_real)); remove_trailing_chars(devpath_real, '/'); if (devpath[0] == '\0' ) @@ -174,7 +174,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) /* look for device already in cache (we never put an untranslated path in the cache) */ list_for_each_entry(dev_loop, &dev_list, node) { if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'", dev_loop->devpath); + dbg("found in cache '%s'\n", dev_loop->devpath); return dev_loop; } } @@ -183,7 +183,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strlcpy(path, sysfs_path, sizeof(path)); strlcat(path, devpath_real, sizeof(path)); if (lstat(path, &statbuf) != 0) { - dbg("stat '%s' failed: %s", path, strerror(errno)); + dbg("stat '%s' failed: %s\n", path, strerror(errno)); return NULL; } if (S_ISLNK(statbuf.st_mode)) { @@ -193,14 +193,14 @@ struct sysfs_device *sysfs_device_get(const char *devpath) /* now look for device in cache after path translation */ list_for_each_entry(dev_loop, &dev_list, node) { if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'", dev_loop->devpath); + dbg("found in cache '%s'\n", dev_loop->devpath); return dev_loop; } } } /* it is a new device */ - dbg("new uncached device '%s'", devpath_real); + dbg("new uncached device '%s'\n", devpath_real); dev = malloc(sizeof(struct sysfs_device)); if (dev == NULL) return NULL; @@ -216,7 +216,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) if (len > 0) { /* get subsystem from "subsystem" link */ link_target[len] = '\0'; - dbg("subsystem link '%s' points to '%s'", link_path, link_target); + dbg("subsystem link '%s' points to '%s'\n", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); @@ -245,13 +245,13 @@ struct sysfs_device *sysfs_device_get(const char *devpath) len = readlink(link_path, link_target, sizeof(link_target)); if (len > 0) { link_target[len] = '\0'; - dbg("driver link '%s' points to '%s'", link_path, link_target); + dbg("driver link '%s' points to '%s'\n", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); } - dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'", dev->devpath, dev->subsystem, dev->driver); + dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'\n", dev->devpath, dev->subsystem, dev->driver); list_add(&dev->node, &dev_list); return dev; @@ -262,14 +262,14 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) char parent_devpath[PATH_SIZE]; char *pos; - dbg("open '%s'", dev->devpath); + dbg("open '%s'\n", dev->devpath); /* look if we already know the parent */ if (dev->parent != NULL) return dev->parent; strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - dbg("'%s'", parent_devpath); + dbg("'%s'\n", parent_devpath); /* strip last element */ pos = strrchr(parent_devpath, '/'); @@ -280,12 +280,12 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) if (strncmp(parent_devpath, "/class", 6) == 0) { pos = strrchr(parent_devpath, '/'); if (pos == &parent_devpath[6] || pos == parent_devpath) { - dbg("/class top level, look for device link"); + dbg("/class top level, look for device link\n"); goto device_link; } } if (strcmp(parent_devpath, "/block") == 0) { - dbg("/block top level, look for device link"); + dbg("/block top level, look for device link\n"); goto device_link; } @@ -334,7 +334,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) ssize_t size; size_t sysfs_len; - dbg("open '%s'/'%s'", devpath, attr_name); + dbg("open '%s'/'%s'\n", devpath, attr_name); sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); if(sysfs_len >= sizeof(path_full)) sysfs_len = sizeof(path_full) - 1; @@ -346,23 +346,23 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* look for attribute in cache */ list_for_each_entry(attr_loop, &attr_list, node) { if (strcmp(attr_loop->path, path) == 0) { - dbg("found in cache '%s'", attr_loop->path); + dbg("found in cache '%s'\n", attr_loop->path); return attr_loop->value; } } /* store attribute in cache (also negatives are kept in cache) */ - dbg("new uncached attribute '%s'", path_full); + dbg("new uncached attribute '%s'\n", path_full); attr = malloc(sizeof(struct sysfs_attr)); if (attr == NULL) return NULL; memset(attr, 0x00, sizeof(struct sysfs_attr)); strlcpy(attr->path, path, sizeof(attr->path)); - dbg("add to cache '%s'", path_full); + dbg("add to cache '%s'\n", path_full); list_add(&attr->node, &attr_list); if (lstat(path_full, &statbuf) != 0) { - dbg("stat '%s' failed: %s", path_full, strerror(errno)); + dbg("stat '%s' failed: %s\n", path_full, strerror(errno)); goto out; } @@ -377,7 +377,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) link_target[len] = '\0'; pos = strrchr(link_target, '/'); if (pos != NULL) { - dbg("cache '%s' with link value '%s'", path_full, value); + dbg("cache '%s' with link value '%s'\n", path_full, value); strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); attr->value = attr->value_local; } @@ -396,7 +396,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* read attribute value */ fd = open(path_full, O_RDONLY); if (fd < 0) { - dbg("attribute '%s' can not be opened", path_full); + dbg("attribute '%s' can not be opened\n", path_full); goto out; } size = read(fd, value, sizeof(value)); @@ -409,7 +409,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* got a valid value, store and return it */ value[size] = '\0'; remove_trailing_chars(value, '\n'); - dbg("cache '%s' with attribute value '%s'", path_full, value); + dbg("cache '%s' with attribute value '%s'\n", path_full, value); strlcpy(attr->value_local, value, sizeof(attr->value_local)); attr->value = attr->value_local; diff --git a/udev_utils.c b/udev_utils.c index e1630b67b5..00b67dadc6 100644 --- a/udev_utils.c +++ b/udev_utils.c @@ -62,7 +62,7 @@ struct name_entry *name_list_add(struct list_head *name_list, const char *name, /* avoid duplicate entries */ list_for_each_entry(name_loop, name_list, node) { if (strcmp(name_loop->name, name) == 0) { - dbg("'%s' is already in the list", name); + dbg("'%s' is already in the list\n", name); return name_loop; } } @@ -78,7 +78,7 @@ struct name_entry *name_list_add(struct list_head *name_list, const char *name, return NULL; strlcpy(name_new->name, name, sizeof(name_new->name)); - dbg("adding '%s'", name_new->name); + dbg("adding '%s'\n", name_new->name); list_add_tail(&name_new->node, &name_loop->node); return name_new; @@ -91,7 +91,7 @@ struct name_entry *name_list_key_add(struct list_head *name_list, const char *ke list_for_each_entry(name_loop, name_list, node) { if (strncmp(name_loop->name, key, strlen(key)) == 0) { - dbg("key already present '%s', replace it", name_loop->name); + dbg("key already present '%s', replace it\n", name_loop->name); snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); name_loop->name[sizeof(name_loop->name)-1] = '\0'; return name_loop; @@ -104,7 +104,7 @@ struct name_entry *name_list_key_add(struct list_head *name_list, const char *ke snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); name_new->name[sizeof(name_new->name)-1] = '\0'; - dbg("adding '%s'", name_new->name); + dbg("adding '%s'\n", name_new->name); list_add_tail(&name_new->node, &name_loop->node); return name_new; @@ -148,10 +148,10 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c DIR *dir; char filename[PATH_SIZE]; - dbg("open directory '%s'", dirname); + dbg("open directory '%s'\n", dirname); dir = opendir(dirname); if (dir == NULL) { - err("unable to open '%s': %s", dirname, strerror(errno)); + err("unable to open '%s': %s\n", dirname, strerror(errno)); return -1; } @@ -173,7 +173,7 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c if (strcmp(ext, suffix) != 0) continue; } - dbg("put file '%s/%s' into list", dirname, ent->d_name); + dbg("put file '%s/%s' into list\n", dirname, ent->d_name); snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); filename[sizeof(filename)-1] = '\0'; @@ -193,9 +193,9 @@ uid_t lookup_user(const char *user) pw = getpwnam(user); if (pw == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified user '%s' unknown", user); + err("specified user '%s' unknown\n", user); else - err("error resolving user '%s': %s", user, strerror(errno)); + err("error resolving user '%s': %s\n", user, strerror(errno)); } else uid = pw->pw_uid; @@ -211,9 +211,9 @@ extern gid_t lookup_group(const char *group) gr = getgrnam(group); if (gr == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified group '%s' unknown", group); + err("specified group '%s' unknown\n", group); else - err("error resolving group '%s': %s", group, strerror(errno)); + err("error resolving group '%s': %s\n", group, strerror(errno)); } else gid = gr->gr_gid; diff --git a/udev_utils_file.c b/udev_utils_file.c index 19668b936f..a492785af9 100644 --- a/udev_utils_file.c +++ b/udev_utils_file.c @@ -47,14 +47,14 @@ int create_path(const char *path) pos--; pos[0] = '\0'; - dbg("stat '%s'", p); + dbg("stat '%s'\n", p); if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) return 0; if (create_path(p) != 0) return -1; - dbg("mkdir '%s'", p); + dbg("mkdir '%s'\n", p); selinux_setfscreatecon(p, NULL, S_IFDIR|0755); ret = mkdir(p, 0755); selinux_resetfscreatecon(); @@ -93,10 +93,10 @@ int delete_path(const char *path) if (retval) { if (errno == ENOTEMPTY) return 0; - err("rmdir(%s) failed: %s", p, strerror(errno)); + err("rmdir(%s) failed: %s\n", p, strerror(errno)); break; } - dbg("removed '%s'", p); + dbg("removed '%s'\n", p); } return 0; } @@ -110,18 +110,18 @@ int unlink_secure(const char *filename) retval = chown(filename, 0, 0); if (retval) - err("chown(%s, 0, 0) failed: %s", filename, strerror(errno)); + err("chown(%s, 0, 0) failed: %s\n", filename, strerror(errno)); retval = chmod(filename, 0000); if (retval) - err("chmod(%s, 0000) failed: %s", filename, strerror(errno)); + err("chmod(%s, 0000) failed: %s\n", filename, strerror(errno)); retval = unlink(filename); if (errno == ENOENT) retval = 0; if (retval) - err("unlink(%s) failed: %s", filename, strerror(errno)); + err("unlink(%s) failed: %s\n", filename, strerror(errno)); return retval; } diff --git a/udevadm.c b/udevadm.c index e2b7779a91..6e7d7734d2 100644 --- a/udevadm.c +++ b/udevadm.c @@ -26,7 +26,7 @@ #include "udev.h" -static int verbose; +static int debug; #ifdef USE_LOG void log_message(int priority, const char *format, ...) @@ -37,9 +37,8 @@ void log_message(int priority, const char *format, ...) return; va_start(args, format); - if (verbose) { + if (debug) { vprintf(format, args); - printf("\n"); } else vsyslog(priority, format, args); va_end(args); @@ -50,7 +49,7 @@ struct command { const char *name; int (*cmd)(int argc, char *argv[], char *envp[]); const char *help; - int verbose; + int debug; }; static const struct command cmds[]; @@ -102,7 +101,7 @@ static const struct command cmds[] = { .name = "test", .cmd = udevtest, .help = "simulation run", - .verbose = 1, + .debug = 1, }, { .name = "version", @@ -155,7 +154,7 @@ int main(int argc, char *argv[], char *envp[]) /* find and execute command */ for (cmd = cmds; cmd->name != NULL; cmd++) { if (strcmp(cmd->name, command) == 0) { - verbose = cmd->verbose; + debug = cmd->debug; rc = cmd->cmd(argc, argv, envp); goto out; } diff --git a/udevcontrol.c b/udevcontrol.c index f6b5dd9053..287e8aaf99 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -50,7 +50,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) udev_log = log_priority(env); logging_init("udevcontrol"); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); if (argc < 2) { fprintf(stderr, "missing command\n\n"); @@ -75,7 +75,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) val = &arg[strlen("log_priority=")]; ctrl_msg.type = UDEVD_CTRL_SET_LOG_LEVEL; *intval = log_priority(val); - info("send log_priority=%i", *intval); + info("send log_priority=%i\n", *intval); } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { char *endp; int count; @@ -89,7 +89,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) goto exit; } *intval = count; - info("send max_childs=%i", *intval); + info("send max_childs=%i\n", *intval); } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { char *endp; int count; @@ -103,7 +103,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) goto exit; } *intval = count; - info("send max_childs_running=%i", *intval); + info("send max_childs_running=%i\n", *intval); } else if (!strncmp(arg, "env", strlen("env"))) { val = argv[2]; if (val == NULL) { @@ -112,7 +112,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) } ctrl_msg.type = UDEVD_CTRL_ENV; strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf)); - info("send env '%s'", val); + info("send env '%s'\n", val); } else if (strcmp(arg, "help") == 0 || strcmp(arg, "-h") == 0) { printf("Usage: udevadm control COMMAND\n" " --log_priority= set the udev log level for the daemon\n" @@ -136,7 +136,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (sock == -1) { - err("error getting socket: %s", strerror(errno)); + err("error getting socket: %s\n", strerror(errno)); goto exit; } @@ -148,10 +148,10 @@ int udevcontrol(int argc, char *argv[], char *envp[]) retval = sendto(sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&saddr, addrlen); if (retval == -1) { - err("error sending message: %s", strerror(errno)); + err("error sending message: %s\n", strerror(errno)); retval = 1; } else { - dbg("sent message type=0x%02x, %u bytes sent", ctrl_msg.type, retval); + dbg("sent message type=0x%02x, %u bytes sent\n", ctrl_msg.type, retval); retval = 0; } diff --git a/udevd.8 b/udevd.8 index 1323313a0d..210ed3fe7f 100644 --- a/udevd.8 +++ b/udevd.8 @@ -14,7 +14,7 @@ udevd - event managing daemon .SH "SYNOPSIS" .HP 6 -\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-verbose\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] +\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-debug\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] .SH "DESCRIPTION" .PP udevd listens to kernel uevents and passes the incoming events to udev\. It ensures the correct event order and takes care, that events for child devices are delayed until the parent event has finished the device handling\. The behavior of the running daemon can be changed with @@ -31,7 +31,7 @@ Detach and run in the background\. Run all events completely serialized\. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continuous operation is needed, where no events are processed in parallel\. .RE .PP -\fB\-\-verbose\fR +\fB\-\-debug\fR .RS 4 Print log messages to stdout\. .RE diff --git a/udevd.c b/udevd.c index 7786ae6b8d..66a410ec77 100644 --- a/udevd.c +++ b/udevd.c @@ -46,7 +46,7 @@ #include "udev_selinux.h" static int debug_trace; -static int verbose; +static int debug; static struct udev_rules rules; static int udevd_sock = -1; @@ -77,10 +77,9 @@ void log_message(int priority, const char *format, ...) return; va_start(args, format); - if (verbose) { + if (debug) { printf("[%d] ", (int) getpid()); vprintf(format, args); - printf("\n"); } else vsyslog(priority, format, args); va_end(args); @@ -184,7 +183,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st path_encode(&filename_failed_old[start], sizeof(filename) - start); if (rename(filename_failed_old, filename_failed) == 0) - info("renamed devpath, moved failed state of '%s' to %s'", + info("renamed devpath, moved failed state of '%s' to %s'\n", msg->devpath_old, msg->devpath); } else { unlink(filename_failed); @@ -241,19 +240,19 @@ static void udev_event_run(struct udevd_uevent_msg *msg) setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); retval = udev_event_process(msg); - info("seq %llu finished with %i", msg->seqnum, retval); + info("seq %llu finished with %i\n", msg->seqnum, retval); logging_close(); if (retval) exit(1); exit(0); case -1: - err("fork of child failed: %s", strerror(errno)); + err("fork of child failed: %s\n", strerror(errno)); msg_queue_delete(msg); break; default: /* get SIGCHLD in main loop */ - info("seq %llu forked, pid [%d], '%s' '%s', %ld seconds old", + info("seq %llu forked, pid [%d], '%s' '%s', %ld seconds old\n", msg->seqnum, pid, msg->action, msg->subsystem, time(NULL) - msg->queue_time); msg->pid = pid; } @@ -279,7 +278,7 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) } export_event_state(msg, EVENT_QUEUED); - info("seq %llu queued, '%s' '%s'", msg->seqnum, msg->action, msg->subsystem); + info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); /* run one event after the other in debug mode */ if (debug_trace) { @@ -476,7 +475,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check identical, parent, or child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg("%llu, device event still pending %llu (%s)", + dbg("%llu, device event still pending %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 3; } @@ -484,7 +483,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check for our major:minor number */ if (msg->devt && loop_msg->devt == msg->devt && strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg("%llu, device event still pending %llu (%d:%d)", msg->seqnum, + dbg("%llu, device event still pending %llu (%d:%d)\n", msg->seqnum, loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); return 4; } @@ -492,7 +491,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check physical device event (special case of parent) */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg("%llu, physical device event still pending %llu (%s)", + dbg("%llu, physical device event still pending %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 5; } @@ -501,7 +500,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check run queue for still running events */ list_for_each_entry(loop_msg, &running_list, node) { if (limit && childs_count++ > limit) { - dbg("%llu, maximum number (%i) of childs reached", msg->seqnum, childs_count); + dbg("%llu, maximum number (%i) of childs reached\n", msg->seqnum, childs_count); return 1; } @@ -512,7 +511,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check identical, parent, or child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg("%llu, device event still running %llu (%s)", + dbg("%llu, device event still running %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 3; } @@ -520,7 +519,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check for our major:minor number */ if (msg->devt && loop_msg->devt == msg->devt && strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg("%llu, device event still running %llu (%d:%d)", msg->seqnum, + dbg("%llu, device event still running %llu (%d:%d)\n", msg->seqnum, loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); return 4; } @@ -528,7 +527,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check physical device event (special case of parent) */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg("%llu, physical device event still running %llu (%s)", + dbg("%llu, physical device event still running %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 5; } @@ -547,7 +546,7 @@ static void msg_queue_manager(void) return; running = running_processes(); - dbg("%d processes runnning on system", running); + dbg("%d processes runnning on system\n", running); if (running < 0) running = max_childs_running; @@ -555,16 +554,16 @@ static void msg_queue_manager(void) /* check running processes in our session and possibly throttle */ if (running >= max_childs_running) { running = running_processes_in_session(sid, max_childs_running+10); - dbg("at least %d processes running in session", running); + dbg("at least %d processes running in session\n", running); if (running >= max_childs_running) { - dbg("delay seq %llu, too many processes already running", loop_msg->seqnum); + dbg("delay seq %llu, too many processes already running\n", loop_msg->seqnum); return; } } /* serialize and wait for parent or child events */ if (devpath_busy(loop_msg, max_childs) != 0) { - dbg("delay seq %llu (%s)", loop_msg->seqnum, loop_msg->devpath); + dbg("delay seq %llu (%s)\n", loop_msg->seqnum, loop_msg->devpath); continue; } @@ -572,7 +571,7 @@ static void msg_queue_manager(void) list_move_tail(&loop_msg->node, &running_list); udev_event_run(loop_msg); running++; - dbg("moved seq %llu to running list", loop_msg->seqnum); + dbg("moved seq %llu to running list\n", loop_msg->seqnum); } } @@ -601,7 +600,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz keylen = strlen(key); msg->envp[i] = key; bufpos += keylen + 1; - dbg("add '%s' to msg.envp[%i]", msg->envp[i], i); + dbg("add '%s' to msg.envp[%i]\n", msg->envp[i], i); /* remember some keys for further processing */ if (strncmp(key, "ACTION=", 7) == 0) @@ -639,7 +638,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz msg->envp[i] = NULL; if (msg->devpath == NULL || msg->action == NULL) { - info("DEVPATH or ACTION missing, ignore message"); + info("DEVPATH or ACTION missing, ignore message\n"); free(msg); return NULL; } @@ -672,24 +671,24 @@ static void get_ctrl_msg(void) size = recvmsg(udevd_sock, &smsg, 0); if (size < 0) { if (errno != EINTR) - err("unable to receive user udevd message: %s", strerror(errno)); + err("unable to receive user udevd message: %s\n", strerror(errno)); return; } cmsg = CMSG_FIRSTHDR(&smsg); cred = (struct ucred *) CMSG_DATA(cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err("no sender credentials received, message ignored"); + err("no sender credentials received, message ignored\n"); return; } if (cred->uid != 0) { - err("sender uid=%i, message ignored", cred->uid); + err("sender uid=%i, message ignored\n", cred->uid); return; } if (strncmp(ctrl_msg.magic, UDEVD_CTRL_MAGIC, sizeof(UDEVD_CTRL_MAGIC)) != 0 ) { - err("message magic '%s' doesn't match, ignore it", ctrl_msg.magic); + err("message magic '%s' doesn't match, ignore it\n", ctrl_msg.magic); return; } @@ -697,50 +696,50 @@ static void get_ctrl_msg(void) case UDEVD_CTRL_ENV: pos = strchr(ctrl_msg.buf, '='); if (pos == NULL) { - err("wrong key format '%s'", ctrl_msg.buf); + err("wrong key format '%s'\n", ctrl_msg.buf); break; } pos[0] = '\0'; if (pos[1] == '\0') { - info("udevd message (ENV) received, unset '%s'", ctrl_msg.buf); + info("udevd message (ENV) received, unset '%s'\n", ctrl_msg.buf); unsetenv(ctrl_msg.buf); } else { - info("udevd message (ENV) received, set '%s=%s'", ctrl_msg.buf, &pos[1]); + info("udevd message (ENV) received, set '%s=%s'\n", ctrl_msg.buf, &pos[1]); setenv(ctrl_msg.buf, &pos[1], 1); } break; case UDEVD_CTRL_STOP_EXEC_QUEUE: - info("udevd message (STOP_EXEC_QUEUE) received"); + info("udevd message (STOP_EXEC_QUEUE) received\n"); stop_exec_q = 1; break; case UDEVD_CTRL_START_EXEC_QUEUE: - info("udevd message (START_EXEC_QUEUE) received"); + info("udevd message (START_EXEC_QUEUE) received\n"); stop_exec_q = 0; msg_queue_manager(); break; case UDEVD_CTRL_SET_LOG_LEVEL: intval = (int *) ctrl_msg.buf; - info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i", *intval); + info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i\n", *intval); udev_log_priority = *intval; sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); putenv(udev_log); break; case UDEVD_CTRL_SET_MAX_CHILDS: intval = (int *) ctrl_msg.buf; - info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i", *intval); + info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i\n", *intval); max_childs = *intval; break; case UDEVD_CTRL_SET_MAX_CHILDS_RUNNING: intval = (int *) ctrl_msg.buf; - info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs=%i", *intval); + info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs=%i\n", *intval); max_childs_running = *intval; break; case UDEVD_CTRL_RELOAD_RULES: - info("udevd message (RELOAD_RULES) received"); + info("udevd message (RELOAD_RULES) received\n"); reload_config = 1; break; default: - err("unknown control message type"); + err("unknown control message type\n"); } } @@ -756,14 +755,14 @@ static struct udevd_uevent_msg *get_netlink_msg(void) size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); if (size < 0) { if (errno != EINTR) - err("unable to receive kernel netlink message: %s", strerror(errno)); + err("unable to receive kernel netlink message: %s\n", strerror(errno)); return NULL; } if ((size_t)size > sizeof(buffer)-1) size = sizeof(buffer)-1; buffer[size] = '\0'; - dbg("uevent_size=%zi", size); + dbg("uevent_size=%zi\n", size); /* start of event payload */ bufpos = strlen(buffer)+1; @@ -774,20 +773,20 @@ static struct udevd_uevent_msg *get_netlink_msg(void) /* validate message */ pos = strchr(buffer, '@'); if (pos == NULL) { - err("invalid uevent '%s'", buffer); + err("invalid uevent '%s'\n", buffer); free(msg); return NULL; } pos[0] = '\0'; if (msg->action == NULL) { - info("no ACTION in payload found, skip event '%s'", buffer); + info("no ACTION in payload found, skip event '%s'\n", buffer); free(msg); return NULL; } if (strcmp(msg->action, buffer) != 0) { - err("ACTION in payload does not match uevent, skip event '%s'", buffer); + err("ACTION in payload does not match uevent, skip event '%s'\n", buffer); free(msg); return NULL; } @@ -822,7 +821,7 @@ static void udev_done(int pid, int exitstatus) list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { - info("seq %llu, pid [%d] exit with %i, %ld seconds old", msg->seqnum, msg->pid, + info("seq %llu, pid [%d] exit with %i, %ld seconds old\n", msg->seqnum, msg->pid, exitstatus, time(NULL) - msg->queue_time); msg->exitstatus = exitstatus; msg_queue_delete(msg); @@ -868,14 +867,14 @@ static int init_udevd_socket(void) udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udevd_sock == -1) { - err("error getting socket: %s", strerror(errno)); + err("error getting socket: %s\n", strerror(errno)); return -1; } /* the bind takes care of ensuring only one copy running */ retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { - err("bind failed: %s", strerror(errno)); + err("bind failed: %s\n", strerror(errno)); close(udevd_sock); udevd_sock = -1; return -1; @@ -900,7 +899,7 @@ static int init_uevent_netlink_sock(void) uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_netlink_sock == -1) { - err("error getting socket: %s", strerror(errno)); + err("error getting socket: %s\n", strerror(errno)); return -1; } @@ -909,7 +908,7 @@ static int init_uevent_netlink_sock(void) retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { - err("bind failed: %s", strerror(errno)); + err("bind failed: %s\n", strerror(errno)); close(uevent_netlink_sock); uevent_netlink_sock = -1; return -1; @@ -957,7 +956,7 @@ int main(int argc, char *argv[], char *envp[]) static const struct option options[] = { { "daemon", 0, NULL, 'd' }, { "debug-trace", 0, NULL, 't' }, - { "verbose", 0, NULL, 'v' }, + { "debug", 0, NULL, 'D' }, { "help", 0, NULL, 'h' }, { "version", 0, NULL, 'V' }, {} @@ -968,10 +967,10 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevd"); udev_config_init(); selinux_init(); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); while (1) { - option = getopt_long(argc, argv, "dtvhV", options, NULL); + option = getopt_long(argc, argv, "dDthV", options, NULL); if (option == -1) break; @@ -982,13 +981,13 @@ int main(int argc, char *argv[], char *envp[]) case 't': debug_trace = 1; break; - case 'v': - verbose = 1; + case 'D': + debug = 1; if (udev_log_priority < LOG_INFO) udev_log_priority = LOG_INFO; break; case 'h': - printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--verbose] [--version]\n"); + printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n"); goto exit; case 'V': printf("%s\n", UDEV_VERSION); @@ -1000,7 +999,7 @@ int main(int argc, char *argv[], char *envp[]) if (getuid() != 0) { fprintf(stderr, "root privileges required\n"); - err("root privileges required"); + err("root privileges required\n"); goto exit; } @@ -1008,7 +1007,7 @@ int main(int argc, char *argv[], char *envp[]) fd = open("/dev/null", O_RDWR); if (fd < 0) { fprintf(stderr, "cannot open /dev/null\n"); - err("cannot open /dev/null"); + err("cannot open /dev/null\n"); } if (fd > STDIN_FILENO) dup2(fd, STDIN_FILENO); @@ -1021,11 +1020,11 @@ int main(int argc, char *argv[], char *envp[]) if (init_udevd_socket() < 0) { if (errno == EADDRINUSE) { fprintf(stderr, "another udev daemon already running\n"); - err("another udev daemon already running"); + err("another udev daemon already running\n"); rc = 1; } else { fprintf(stderr, "error initializing udevd socket\n"); - err("error initializing udevd socket"); + err("error initializing udevd socket\n"); rc = 2; } goto exit; @@ -1033,7 +1032,7 @@ int main(int argc, char *argv[], char *envp[]) if (init_uevent_netlink_sock() < 0) { fprintf(stderr, "error initializing netlink socket\n"); - err("error initializing netlink socket"); + err("error initializing netlink socket\n"); rc = 3; goto exit; } @@ -1041,29 +1040,29 @@ int main(int argc, char *argv[], char *envp[]) /* setup signal handler pipe */ retval = pipe(signal_pipe); if (retval < 0) { - err("error getting pipes: %s", strerror(errno)); + err("error getting pipes: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); if (retval < 0) { - err("error fcntl on read pipe: %s", strerror(errno)); + err("error fcntl on read pipe: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { - err("error fcntl on read pipe: %s", strerror(errno)); + err("error fcntl on read pipe: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); if (retval < 0) { - err("error fcntl on write pipe: %s", strerror(errno)); + err("error fcntl on write pipe: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { - err("error fcntl on write pipe: %s", strerror(errno)); + err("error fcntl on write pipe: %s\n", strerror(errno)); goto exit; } @@ -1079,21 +1078,21 @@ int main(int argc, char *argv[], char *envp[]) pid = fork(); switch (pid) { case 0: - dbg("daemonized fork running"); + dbg("daemonized fork running\n"); break; case -1: - err("fork of daemon failed: %s", strerror(errno)); + err("fork of daemon failed: %s\n", strerror(errno)); rc = 4; goto exit; default: - dbg("child [%u] running, parent exits", pid); + dbg("child [%u] running, parent exits\n", pid); rc = 0; goto exit; } } /* redirect std{out,err} fd's */ - if (!verbose) + if (!debug) dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > STDERR_FILENO) @@ -1107,12 +1106,12 @@ int main(int argc, char *argv[], char *envp[]) /* become session leader */ sid = setsid(); - dbg("our session is %d", sid); + dbg("our session is %d\n", sid); /* OOM_DISABLE == -17 */ fd = open("/proc/self/oom_adj", O_RDWR); if (fd < 0) - err("error disabling OOM: %s", strerror(errno)); + err("error disabling OOM: %s\n", strerror(errno)); else { write(fd, "-17", 3); close(fd); @@ -1148,9 +1147,9 @@ int main(int argc, char *argv[], char *envp[]) strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); inotify_add_watch(inotify_fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } else if (errno == ENOSYS) - err("the kernel does not support inotify, udevd can't monitor rules file changes"); + err("the kernel does not support inotify, udevd can't monitor rules file changes\n"); else - err("inotify_init failed: %s", strerror(errno)); + err("inotify_init failed: %s\n", strerror(errno)); /* maximum limit of forked childs */ value = getenv("UDEVD_MAX_CHILDS"); @@ -1163,7 +1162,7 @@ int main(int argc, char *argv[], char *envp[]) else max_childs = UDEVD_MAX_CHILDS; } - info("initialize max_childs to %u", max_childs); + info("initialize max_childs to %u\n", max_childs); /* start to throttle forking if maximum number of _running_ childs is reached */ value = getenv("UDEVD_MAX_CHILDS_RUNNING"); @@ -1176,7 +1175,7 @@ int main(int argc, char *argv[], char *envp[]) else max_childs_running = UDEVD_MAX_CHILDS_RUNNING; } - info("initialize max_childs_running to %u", max_childs_running); + info("initialize max_childs_running to %u\n", max_childs_running); /* clear environment for forked event processes */ clearenv(); @@ -1206,7 +1205,7 @@ int main(int argc, char *argv[], char *envp[]) fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) - err("error in select: %s", strerror(errno)); + err("error in select: %s\n", strerror(errno)); continue; } @@ -1239,7 +1238,7 @@ int main(int argc, char *argv[], char *envp[]) reload_config = 1; buf = malloc(nbytes); if (buf == NULL) { - err("error getting buffer for inotify, disable watching"); + err("error getting buffer for inotify, disable watching\n"); close(inotify_fd); inotify_fd = -1; } diff --git a/udevd.xml b/udevd.xml index 0b3c01787a..178af4cb6c 100644 --- a/udevd.xml +++ b/udevd.xml @@ -27,7 +27,7 @@ udevd - + @@ -59,7 +59,7 @@ - + Print log messages to stdout. diff --git a/udevinfo.c b/udevinfo.c index 52d409df88..a0d6cac401 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -69,7 +69,7 @@ static void print_all_attributes(const char *devpath, const char *key) len = strlcpy(value, attr_value, sizeof(value)); if(len >= sizeof(value)) len = sizeof(value) - 1; - dbg("attr '%s'='%s'(%zi)", dent->d_name, value, len); + dbg("attr '%s'='%s'(%zi)\n", dent->d_name, value, len); /* remove trailing newlines */ while (len && value[len-1] == '\n') @@ -79,7 +79,7 @@ static void print_all_attributes(const char *devpath, const char *key) while (len && isprint(value[len-1])) len--; if (len) { - dbg("attribute value of '%s' non-printable, skip", dent->d_name); + dbg("attribute value of '%s' non-printable, skip\n", dent->d_name); continue; } @@ -175,7 +175,7 @@ static int lookup_device_by_name(struct udevice *udev, const char *name) if (count <= 0) goto out; - info("found %i devices for '%s'", count, name); + info("found %i devices for '%s'\n", count, name); /* select the device that seems to match */ list_for_each_entry(device, &name_list, node) { @@ -185,7 +185,7 @@ static int lookup_device_by_name(struct udevice *udev, const char *name) udev_device_init(udev); if (udev_db_get_device(udev, device->name) != 0) continue; - info("found db entry '%s'", device->name); + info("found db entry '%s'\n", device->name); /* make sure, we don't get a link of a differnt device */ strlcpy(filename, udev_root, sizeof(filename)); @@ -194,7 +194,7 @@ static int lookup_device_by_name(struct udevice *udev, const char *name) if (stat(filename, &statbuf) != 0) continue; if (major(udev->devt) > 0 && udev->devt != statbuf.st_rdev) { - info("skip '%s', dev_t doesn't match", udev->name); + info("skip '%s', dev_t doesn't match\n", udev->name); continue; } rc = 0; @@ -272,7 +272,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) if (option == -1) break; - dbg("option '%c'", option); + dbg("option '%c'\n", option); switch (option) { case 'n': /* remove /dev if given */ @@ -281,7 +281,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) else strlcpy(name, optarg, sizeof(name)); remove_trailing_chars(name, '/'); - dbg("name: %s", name); + dbg("name: %s\n", name); break; case 'p': /* remove /sys if given */ @@ -310,7 +310,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) } } } - dbg("path: %s", path); + dbg("path: %s\n", path); break; case 'q': action = ACTION_QUERY; diff --git a/udevsettle.c b/udevsettle.c index e3982a42b0..4b66f89cd6 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -57,7 +57,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) logging_init("udevsettle"); udev_config_init(); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); sysfs_init(); while (1) { @@ -72,7 +72,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) timeout = seconds; else fprintf(stderr, "invalid timeout value\n"); - dbg("timeout=%i", timeout); + dbg("timeout=%i\n", timeout); break; case 'h': printf("Usage: udevadm settle [--help] [--timeout=]\n\n"); @@ -90,13 +90,13 @@ int udevsettle(int argc, char *argv[], char *envp[]) struct stat statbuf; if (stat(queuename, &statbuf) < 0) { - info("queue is empty"); + info("queue is empty\n"); break; } usleep(1000 * 1000 / LOOP_PER_SECOND); } if (loop <= 0) { - info("timeout waiting for queue"); + info("timeout waiting for queue\n"); goto exit; } @@ -112,7 +112,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) goto exit; seqnum[len] = '\0'; seq_udev = strtoull(seqnum, NULL, 10); - info("udev seqnum = %llu", seq_udev); + info("udev seqnum = %llu\n", seq_udev); /* read current kernel seqnum */ strlcpy(filename, sysfs_path, sizeof(filename)); @@ -126,16 +126,16 @@ int udevsettle(int argc, char *argv[], char *envp[]) goto exit; seqnum[len] = '\0'; seq_kernel = strtoull(seqnum, NULL, 10); - info("kernel seqnum = %llu", seq_kernel); + info("kernel seqnum = %llu\n", seq_kernel); /* make sure all kernel events have arrived in the queue */ if (seq_udev >= seq_kernel) { - info("queue is empty and no pending events left"); + info("queue is empty and no pending events left\n"); rc = 0; goto exit; } usleep(1000 * 1000 / LOOP_PER_SECOND); - info("queue is empty, but events still pending"); + info("queue is empty, but events still pending\n"); } exit: diff --git a/udevtest.c b/udevtest.c index a36e503fd4..8beba217ea 100644 --- a/udevtest.c +++ b/udevtest.c @@ -62,7 +62,7 @@ static int import_uevent_var(const char *devpath) if (next == NULL) goto out; next[0] = '\0'; - info("import into environment: '%s'", key); + info("import into environment: '%s'\n", key); putenv(key); key = &next[1]; } @@ -91,7 +91,7 @@ int udevtest(int argc, char *argv[], char *envp[]) {} }; - info("version %s", UDEV_VERSION); + info("version %s\n", UDEV_VERSION); udev_config_init(); if (udev_log_priority < LOG_INFO) { char priority[32]; @@ -108,7 +108,7 @@ int udevtest(int argc, char *argv[], char *envp[]) if (option == -1) break; - dbg("option '%c'", option); + dbg("option '%c'\n", option); switch (option) { case 'a': action = optarg; @@ -181,7 +181,7 @@ int udevtest(int argc, char *argv[], char *envp[]) setenv("ACTION", udev->action, 1); import_uevent_var(udev->dev->devpath); - info("looking at device '%s' from subsystem '%s'", udev->dev->devpath, udev->dev->subsystem); + info("looking at device '%s' from subsystem '%s'\n", udev->dev->devpath, udev->dev->subsystem); retval = udev_device_event(&rules, udev); if (retval == 0 && !udev->ignore_device && udev_run) { struct name_entry *name_loop; @@ -191,7 +191,7 @@ int udevtest(int argc, char *argv[], char *envp[]) strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udev, program, sizeof(program)); - info("run: '%s'", program); + info("run: '%s'\n", program); } } udev_device_cleanup(udev); diff --git a/udevtrigger.c b/udevtrigger.c index e50fd4ee04..72464c8381 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -70,7 +70,7 @@ static int device_list_insert(const char *path) char devpath[PATH_SIZE]; struct stat statbuf; - dbg("add '%s'" , path); + dbg("add '%s'\n" , path); /* we only have a device, if we have an uevent file */ strlcpy(filename, path, sizeof(filename)); @@ -110,12 +110,12 @@ static void trigger_uevent(const char *devpath, const char *action) fd = open(filename, O_WRONLY); if (fd < 0) { - dbg("error on opening %s: %s", filename, strerror(errno)); + dbg("error on opening %s: %s\n", filename, strerror(errno)); return; } if (write(fd, action, strlen(action)) < 0) - info("error writing '%s' to '%s': %s", action, filename, strerror(errno)); + info("error writing '%s' to '%s': %s\n", action, filename, strerror(errno)); close(fd); } @@ -574,7 +574,7 @@ int udevtrigger(int argc, char *argv[], char *envp[]) logging_init("udevtrigger"); udev_config_init(); - dbg("version %s", UDEV_VERSION); + dbg("version %s\n", UDEV_VERSION); sysfs_init(); while (1) { -- cgit v1.2.3-54-g00ecf From 803ac7a6d8d06787305a01a068c2e0ca47e2536d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Apr 2008 21:08:45 +0200 Subject: scsi_id: initialize serial strings --- extras/scsi_id/scsi_id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 463b3775cf..538108717d 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -682,8 +682,8 @@ static int scsi_id(const char *devpath, char *maj_min_dev) struct sysfs_device *dev_scsi = NULL; int good_dev; int page_code; - char serial[MAX_SERIAL_LEN]; - char serial_short[MAX_SERIAL_LEN]; + char serial[MAX_SERIAL_LEN] = ""; + char serial_short[MAX_SERIAL_LEN] = ""; const char *bus_str = NULL; dbg("devpath %s\n", devpath); -- cgit v1.2.3-54-g00ecf From 41677cf51fb2c14aa512ecf9410e43eb35560408 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 20 Apr 2008 21:15:00 +0200 Subject: persistent device naming: also read unpartitioned media --- etc/udev/rules.d/60-persistent-storage.rules | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index a1e0917ab5..85a9270027 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -3,6 +3,9 @@ # persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} # scheme based on "Linux persistent device names", 2004, Hannes Reinecke +# forward scsi device event to corresponding block device +ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" + ACTION!="add|change", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" @@ -47,8 +50,13 @@ ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -# by-label/by-uuid (filesystem properties) -ENV{DEVTYPE}=="partition", IMPORT{program}="vol_id --export $tempnode" +# skip unpartitioned removable media devices from drivers which do not send "change" events +ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" + +# import filesystem metadata +IMPORT{program}="vol_id --export $tempnode" + +# by-label/by-uuid links (filesystem metadata) ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" -- cgit v1.2.3-54-g00ecf From be9c76b4345b36ec40d8b7b22dc687b4042fe56f Mon Sep 17 00:00:00 2001 From: Damjan Georgievski Date: Mon, 21 Apr 2008 12:44:25 +0200 Subject: libvolume_id: recognize swap partitions with a tuxonice hibernate image --- extras/volume_id/lib/linux_swap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 9ff16e2798..592a38570d 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -73,6 +73,12 @@ int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size strcpy(id->type_version, "ulsuspend"); goto found_label; } + + if (memcmp(buf, "\xed\xc3\x02\xe9\x98\x56\xe5\x0c", 8) == 0) { + id->type = "suspend"; + strcpy(id->type_version, "tuxonice"); + goto found_label; + } } return -1; -- cgit v1.2.3-54-g00ecf From 953080abd9873dd92159c25cd34252c4cc366011 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Apr 2008 17:41:39 +0200 Subject: cdrom_id: add more help text --- extras/cdrom_id/cdrom_id.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index b88f5b4b1e..0e0a463d94 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -538,8 +538,9 @@ int main(int argc, char *argv[]) break; case 'h': printf("Usage: cdrom_id [options] \n" - " --export export key/value pairs\n" - " --help\n\n"); + " --export export key/value pairs\n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); goto exit; default: rc = 1; -- cgit v1.2.3-54-g00ecf From 927e994219e7d6ddbe9c14800b15fd1bc1613613 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Apr 2008 17:43:12 +0200 Subject: add $links substitution --- udev.7 | 7 ++++++- udev.xml | 12 ++++++++++-- udev_rules.c | 24 ++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/udev.7 b/udev.7 index 3bc04b7c63..1cad58d18b 100644 --- a/udev.7 +++ b/udev.7 @@ -378,7 +378,12 @@ The node name of the parent device\. .PP \fB$name\fR .RS 4 -The name of the device node\. The value is only set if an earlier rule assigned a value, or during a remove events\. +The current name of the device node\. If not changed by a rule, it is the name of the kernel device\. +.RE +.PP +\fB$links\fR +.RS 4 +The current list of symlinks, separated by a space character\. The value is only set if an earlier rule assigned a value, or during a remove events\. .RE .PP \fB$root\fR, \fB%r\fR diff --git a/udev.xml b/udev.xml index e432965317..15651e006e 100644 --- a/udev.xml +++ b/udev.xml @@ -556,8 +556,16 @@ - The name of the device node. The value is only set if an earlier - rule assigned a value, or during a remove events. + The current name of the device node. If not changed by a rule, it is the + name of the kernel device. + + + + + + + The current list of symlinks, separated by a space character. The value is + only set if an earlier rule assigned a value, or during a remove events. diff --git a/udev_rules.c b/udev_rules.c index 884cb7098c..d476e699e4 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -658,6 +658,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) SUBST_PARENT, SUBST_TEMP_NODE, SUBST_NAME, + SUBST_LINKS, SUBST_ROOT, SUBST_SYS, SUBST_ENV, @@ -680,6 +681,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, { .name = "name", .fmt = 'D', .type = SUBST_NAME }, + { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, { .name = "env", .fmt = 'E', .type = SUBST_ENV }, @@ -899,8 +901,26 @@ found: dbg("substitute temporary device node name '%s'\n", udev->tmp_node); break; case SUBST_NAME: - strlcat(string, udev->name, maxsize); - dbg("substitute udev->name '%s'\n", udev->name); + if (udev->name[0] == '\0') { + strlcat(string, udev->dev->kernel, maxsize); + dbg("substitute udev->kernel '%s'\n", udev->name); + } else { + strlcat(string, udev->name, maxsize); + dbg("substitute udev->name '%s'\n", udev->name); + } + break; + case SUBST_LINKS: + if (!list_empty(&udev->symlink_list)) { + struct name_entry *name_loop; + char symlinks[PATH_SIZE] = ""; + + list_for_each_entry(name_loop, &udev->symlink_list, node) { + strlcat(symlinks, name_loop->name, sizeof(symlinks)); + strlcat(symlinks, " ", sizeof(symlinks)); + } + remove_trailing_chars(symlinks, ' '); + strlcat(string, symlinks, maxsize); + } break; case SUBST_ROOT: strlcat(string, udev_root, maxsize); -- cgit v1.2.3-54-g00ecf From 6b795c99e00c92dd29abafcc1022cace7bbcb795 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Apr 2008 18:07:05 +0200 Subject: fstab_import: add program to IMPORT matching fstab entry DEVPATH=/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6 SUBSYSTEM=block ... ID_FS_USAGE=filesystem ID_FS_TYPE=ext3 ID_FS_VERSION=1.0 ... FSTAB_NAME=/dev/disk/by-id/scsi-SATA_ST910021AS_3MH0Y3KF-part6 FSTAB_DIR=/home/kay/work FSTAB_TYPE=ext3 FSTAB_OPTS=defaults FSTAB_FREQ=1 FSTAB_PASSNO=1 --- extras/fstab_import/79-fstab_import.rules | 2 + extras/fstab_import/Makefile | 72 ++++++++++ extras/fstab_import/fstab_import.c | 213 ++++++++++++++++++++++++++++++ test/simple-build-check.sh | 3 +- 4 files changed, 289 insertions(+), 1 deletion(-) create mode 100644 extras/fstab_import/79-fstab_import.rules create mode 100644 extras/fstab_import/Makefile create mode 100644 extras/fstab_import/fstab_import.c diff --git a/extras/fstab_import/79-fstab_import.rules b/extras/fstab_import/79-fstab_import.rules new file mode 100644 index 0000000000..ccd718c5f0 --- /dev/null +++ b/extras/fstab_import/79-fstab_import.rules @@ -0,0 +1,2 @@ +ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem|other", IMPORT="fstab_import --root=$root $name $links mapper/$env{DM_NAME}" + diff --git a/extras/fstab_import/Makefile b/extras/fstab_import/Makefile new file mode 100644 index 0000000000..23448f3217 --- /dev/null +++ b/extras/fstab_import/Makefile @@ -0,0 +1,72 @@ +# Makefile for udev extra invoked from the udev main Makefile +# +# Copyright (C) 2008 Kay Sievers +# +# Released under the GNU General Public License, version 2. +# + +PROG = fstab_import +OBJ = +HEADERS = +GEN_HEADERS = +MAN_PAGES = + +prefix = +etcdir = ${prefix}/etc +sbindir = ${prefix}/sbin +usrbindir = ${prefix}/usr/bin +usrsbindir = ${prefix}/usr/sbin +libudevdir = ${prefix}/lib/udev +mandir = ${prefix}/usr/share/man +configdir = ${etcdir}/udev/ + +INSTALL = install -c +INSTALL_PROGRAM = ${INSTALL} +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL} + +all: $(PROG) $(MAN_PAGES) +.PHONY: all +.DEFAULT: all + +%.o: %.c $(GEN_HEADERS) + $(E) " CC " $@ + $(Q) $(CC) -c $(CFLAGS) $< -o $@ + +$(PROG): %: $(HEADERS) %.o $(OBJS) + $(E) " LD " $@ + $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) + +# man pages +%.8: %.xml + $(E) " XMLTO " $@ + $(Q) xmlto man $? +.PRECIOUS: %.8 + +clean: + $(E) " CLEAN " + $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) +.PHONY: clean + +install-bin: all + $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) + $(INSTALL_DATA) 79-fstab_import.rules $(DESTDIR)$(configdir)/rules.d/79-fstab_import.rules +.PHONY: install-bin + +uninstall-bin: + - rm $(DESTDIR)$(libudevdir)/$(PROG) + - rm $(DESTDIR)$(configdir)/rules.d/79-fstab_import.rules +.PHONY: uninstall-bin + +install-man: + @echo "Please create a man page for this tool." +.PHONY: install-man + +uninstall-man: + @echo "Please create a man page for this tool." +.PHONY: uninstall-man + +install-config: + @echo "no config file to install" +.PHONY: install-config + diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c new file mode 100644 index 0000000000..a8de067b38 --- /dev/null +++ b/extras/fstab_import/fstab_import.c @@ -0,0 +1,213 @@ +/* + * find matching entry in fstab and export it + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../../udev.h" + +static int debug; +static char root[PATH_SIZE] = "/dev"; +static char **devices; + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + static int udev_log = -1; + + if (udev_log == -1) { + const char *value; + + value = getenv("UDEV_LOG"); + if (value) + udev_log = log_priority(value); + else + udev_log = LOG_ERR; + + if (debug && udev_log < LOG_INFO) + udev_log = LOG_INFO; + } + + if (priority > udev_log) + return; + + va_start(args, format); + if (debug) { + fprintf(stderr, "[%d] ", (int) getpid()); + vfprintf(stderr, format, args); + } else + vsyslog(priority, format, args); + va_end(args); +} +#endif + +static int matches_device_list(const char *name) +{ + int i; + + for (i = 0; devices[i] != NULL; i++) { + info("compare '%s' == '%s'\n", name, devices[i]); + if (strcmp(devices[i], name) == 0) + return 1; + } + return 0; +} + +static void print_fstab_entry(struct mntent *mnt) +{ + printf("FSTAB_NAME=%s\n", mnt->mnt_fsname); + printf("FSTAB_DIR=%s\n", mnt->mnt_dir); + printf("FSTAB_TYPE=%s\n", mnt->mnt_type); + printf("FSTAB_OPTS=%s\n", mnt->mnt_opts); + printf("FSTAB_FREQ=%d\n", mnt->mnt_freq); + printf("FSTAB_PASSNO=%d\n", mnt->mnt_passno); +} + +int main(int argc, char *argv[]) +{ + static const struct option options[] = { + { "export", 0, NULL, 'x' }, + { "root", 1, NULL, 'r' }, + { "debug", 0, NULL, 'd' }, + { "help", 0, NULL, 'h' }, + {} + }; + + FILE *fp; + struct mntent *mnt; + int rc = 0; + + logging_init("fstab_id"); + + while (1) { + int option; + + option = getopt_long(argc, argv, "dr:xh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'r': + strlcpy(root, optarg, sizeof(root)); + break; + case 'd': + debug = 1; + break; + case 'h': + printf("Usage: fstab_id [OPTIONS] name [...]\n" + " --export print environment keys\n" + " --root device node root (default /dev)\n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); + default: + rc = 1; + goto exit; + } + } + + devices = &argv[optind]; + if (devices[0] == NULL) { + fprintf(stderr, "error: missing device(s) to match\n"); + rc = 2; + goto exit; + } + + fp = setmntent ("/etc/fstab", "r"); + if (fp == NULL) { + fprintf(stderr, "error: opening fstab: %s\n", strerror(errno)); + rc = 2; + goto exit; + } + + while (1) { + mnt = getmntent(fp); + if (mnt == NULL) + break; + + /* skip root device */ + if (strcmp(mnt->mnt_dir, "/") == 0) + continue; + + /* match LABEL */ + if (strncmp(mnt->mnt_fsname, "LABEL=", 6) == 0) { + const char *label; + char str[256]; + + label = &mnt->mnt_fsname[6]; + if (label[0] == '"' || label[0] == '\'') { + char *pos; + + strlcpy(str, &label[1], sizeof(str)); + pos = strrchr(str, label[0]); + if (pos == NULL) + continue; + pos[0] = '\0'; + label = str; + } + if (matches_device_list(str)) { + print_fstab_entry(mnt); + break; + } + continue; + } + + /* match UUID */ + if (strncmp(mnt->mnt_fsname, "UUID=", 5) == 0) { + const char *uuid; + char str[256]; + + uuid = &mnt->mnt_fsname[5]; + if (uuid[0] == '"' || uuid[0] == '\'') { + char *pos; + + strlcpy(str, &uuid[1], sizeof(str)); + pos = strrchr(str, uuid[0]); + if (pos == NULL) + continue; + pos[0] = '\0'; + uuid = str; + } + if (matches_device_list(str)) { + print_fstab_entry(mnt); + break; + } + continue; + } + + /* only devices */ + if (strncmp(mnt->mnt_fsname, root, strlen(root)) != 0) + continue; + + if (matches_device_list(&mnt->mnt_fsname[strlen(root)+1])) { + print_fstab_entry(mnt); + break; + } + } + + endmntent(fp); + +exit: + logging_close(); + return rc; +} diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh index 6bf12013d8..e391846de9 100755 --- a/test/simple-build-check.sh +++ b/test/simple-build-check.sh @@ -11,7 +11,8 @@ EXTRAS="\ extras/floppy \ extras/firmware \ extras/collect \ - extras/rule_generator" + extras/rule_generator \ + extras/fstab_import" # with debug make clean EXTRAS="$EXTRAS" >/dev/null -- cgit v1.2.3-54-g00ecf From bf50425b58da6f112197f79241dd6d64af2e9ea7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Apr 2008 19:00:54 +0200 Subject: add OPTIONS+="event_timeout=" --- test-udev.c | 6 +++++- udev.7 | 5 +++++ udev.h | 3 ++- udev.xml | 7 +++++++ udev_device.c | 2 ++ udev_rules.c | 4 ++++ udev_rules.h | 1 + udev_rules_parse.c | 6 ++++++ udevd.c | 6 +++++- udevtest.c | 4 ++++ 10 files changed, 41 insertions(+), 3 deletions(-) diff --git a/test-udev.c b/test-udev.c index e341b74f2f..4ac2d5a889 100644 --- a/test-udev.c +++ b/test-udev.c @@ -105,7 +105,7 @@ int main(int argc, char *argv[], char *envp[]) sigaction(SIGTERM, &act, NULL); /* trigger timeout to prevent hanging processes */ - alarm(UDEV_ALARM_TIMEOUT); + alarm(UDEV_EVENT_TIMEOUT); action = getenv("ACTION"); devpath = getenv("DEVPATH"); @@ -154,6 +154,10 @@ int main(int argc, char *argv[], char *envp[]) retval = udev_device_event(&rules, udev); + /* rules may change/disable the timeout */ + if (udev->event_timeout >= 0) + alarm(udev->event_timeout); + if (retval == 0 && !udev->ignore_device && udev_run) udev_rules_run(udev); diff --git a/udev.7 b/udev.7 index 1cad58d18b..096bf38554 100644 --- a/udev.7 +++ b/udev.7 @@ -291,6 +291,11 @@ Specify the priority of the created symlinks\. Devices with higher priorities ov Create the device nodes for all available partitions of a block device\. This may be useful for removable media devices where media changes are not detected\. .RE .PP +\fBevent_timeout=\fR +.RS 4 +Number of seconds an event will wait for operations to finish, before it will terminate itself\. +.RE +.PP \fBstring_escape=\fR\fB\fInone|replace\fR\fR .RS 4 Usually control and other possibly unsafe characters are replaced in strings used for device naming\. The mode of replacement can be specified with this option\. diff --git a/udev.h b/udev.h index e6e953b25d..e1b7ac0d8a 100644 --- a/udev.h +++ b/udev.h @@ -39,7 +39,7 @@ #define ALLOWED_CHARS_INPUT ALLOWED_CHARS_FILE " $%?," #define DEFAULT_PARTITIONS_COUNT 15 -#define UDEV_ALARM_TIMEOUT 180 +#define UDEV_EVENT_TIMEOUT 180 #define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) @@ -93,6 +93,7 @@ struct udevice { int ignore_remove; char program_result[PATH_SIZE]; int link_priority; + int event_timeout; int test_run; }; diff --git a/udev.xml b/udev.xml index 15651e006e..ac3676e466 100644 --- a/udev.xml +++ b/udev.xml @@ -441,6 +441,13 @@ detected. + + + + Number of seconds an event will wait for operations to finish, before it + will terminate itself. + + diff --git a/udev_device.c b/udev_device.c index 6546db482c..cf21191ca0 100644 --- a/udev_device.c +++ b/udev_device.c @@ -53,6 +53,8 @@ struct udevice *udev_device_init(struct udevice *udev) strcpy(udev->owner, "root"); strcpy(udev->group, "root"); + udev->event_timeout = -1; + return udev; } diff --git a/udev_rules.c b/udev_rules.c index d476e699e4..55a079be87 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1397,6 +1397,10 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) udev->link_priority = rule->link_priority; info("link_priority=%i\n", udev->link_priority); } + if (rule->event_timeout >= 0) { + udev->event_timeout = rule->event_timeout; + info("event_timeout=%i\n", udev->event_timeout); + } /* apply all_partitions option only at a main block device */ if (rule->partitions && strcmp(udev->dev->subsystem, "block") == 0 && udev->dev->kernel_number[0] == '\0') { diff --git a/udev_rules.h b/udev_rules.h index a84b0de837..da5ac3ea18 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -97,6 +97,7 @@ struct udev_rule { enum escape_type string_escape; unsigned int link_priority; + int event_timeout; unsigned int partitions; unsigned int last_rule:1, run_ignore_error:1, diff --git a/udev_rules_parse.c b/udev_rules_parse.c index b586df1324..5119b7e84f 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -245,6 +245,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena memset(buf, 0x00, sizeof(buf)); rule = (struct udev_rule *) buf; + rule->event_timeout = -1; linepos = line; valid = 0; @@ -604,6 +605,11 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena rule->link_priority = atoi(&pos[strlen("link_priority=")]); dbg("link priority=%i\n", rule->link_priority); } + pos = strstr(value, "event_timeout="); + if (pos != NULL) { + rule->event_timeout = atoi(&pos[strlen("event_timeout=")]); + dbg("event timout=%i\n", rule->event_timeout); + } pos = strstr(value, "string_escape="); if (pos != NULL) { pos = &pos[strlen("string_escape=")]; diff --git a/udevd.c b/udevd.c index 66a410ec77..c895c1dc6a 100644 --- a/udevd.c +++ b/udevd.c @@ -115,7 +115,7 @@ static int udev_event_process(struct udevd_uevent_msg *msg) sigaction(SIGHUP, &act, NULL); /* trigger timeout to prevent hanging processes */ - alarm(UDEV_ALARM_TIMEOUT); + alarm(UDEV_EVENT_TIMEOUT); /* reconstruct event environment from message */ for (i = 0; msg->envp[i]; i++) @@ -131,6 +131,10 @@ static int udev_event_process(struct udevd_uevent_msg *msg) retval = udev_device_event(&rules, udev); + /* rules may change/disable the timeout */ + if (udev->event_timeout >= 0) + alarm(udev->event_timeout); + /* run programs collected by RUN-key*/ if (retval == 0 && !udev->ignore_device && udev_run) retval = udev_rules_run(udev); diff --git a/udevtest.c b/udevtest.c index 8beba217ea..d5e90b02c6 100644 --- a/udevtest.c +++ b/udevtest.c @@ -183,6 +183,10 @@ int udevtest(int argc, char *argv[], char *envp[]) info("looking at device '%s' from subsystem '%s'\n", udev->dev->devpath, udev->dev->subsystem); retval = udev_device_event(&rules, udev); + + if (udev->event_timeout >= 0) + info("custom event timeout: %i\n", udev->event_timeout); + if (retval == 0 && !udev->ignore_device && udev_run) { struct name_entry *name_loop; -- cgit v1.2.3-54-g00ecf From ca0ac81f36f343047847168665c19d2080a64a6e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Apr 2008 20:22:56 +0200 Subject: write "event_timeout" to db --- udev_db.c | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/udev_db.c b/udev_db.c index ddcf85ee5c..3348c9a02c 100644 --- a/udev_db.c +++ b/udev_db.c @@ -174,6 +174,8 @@ int udev_db_add_device(struct udevice *udev) fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); if (udev->link_priority != 0) fprintf(f, "L:%u\n", udev->link_priority); + if (udev->event_timeout >= 0) + fprintf(f, "T:%u\n", udev->event_timeout); if (udev->partitions != 0) fprintf(f, "A:%u\n", udev->partitions); if (udev->ignore_remove) @@ -236,54 +238,35 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) bufline = &buf[cur]; cur += count+1; + if (count > sizeof(line)) + count = sizeof(line); + memcpy(line, &bufline[2], count-2); + line[count-2] = '\0'; + switch(bufline[0]) { case 'N': - if (count > sizeof(udev->name)) - count = sizeof(udev->name); - memcpy(udev->name, &bufline[2], count-2); - udev->name[count-2] = '\0'; + strlcpy(udev->name, line, sizeof(udev->name)); break; case 'M': - if (count > sizeof(line)) - count = sizeof(line); - memcpy(line, &bufline[2], count-2); - line[count-2] = '\0'; sscanf(line, "%u:%u", &maj, &min); udev->devt = makedev(maj, min); break; case 'S': - if (count > sizeof(line)) - count = sizeof(line); - memcpy(line, &bufline[2], count-2); - line[count-2] = '\0'; name_list_add(&udev->symlink_list, line, 0); break; case 'L': - if (count > sizeof(line)) - count = sizeof(line); - memcpy(line, &bufline[2], count-2); - line[count-2] = '\0'; udev->link_priority = atoi(line); break; + case 'T': + udev->event_timeout = atoi(line); + break; case 'A': - if (count > sizeof(line)) - count = sizeof(line); - memcpy(line, &bufline[2], count-2); - line[count-2] = '\0'; udev->partitions = atoi(line); break; case 'R': - if (count > sizeof(line)) - count = sizeof(line); - memcpy(line, &bufline[2], count-2); - line[count-2] = '\0'; udev->ignore_remove = atoi(line); break; case 'E': - if (count > sizeof(line)) - count = sizeof(line); - memcpy(line, &bufline[2], count-2); - line[count-2] = '\0'; name_list_add(&udev->env_list, line, 0); break; } -- cgit v1.2.3-54-g00ecf From 7b2aad3343f8523db35ff2edfcfa9fcb816b7264 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 22 Apr 2008 03:01:29 +0200 Subject: udevadm: trigger - add --env= option --- udevadm.8 | 9 +++++++-- udevadm.xml | 11 +++++++++-- udevtrigger.c | 37 +++++++++++++++++++++++++++---------- 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/udevadm.8 b/udevadm.8 index 0db30126bd..9cd91e209a 100644 --- a/udevadm.8 +++ b/udevadm.8 @@ -134,17 +134,22 @@ Do not trigger events for devices which belong to a matching subsystem\. This op Trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. .RE .PP -\fB\-\-attr\-nomatch\fR\fB\fIattribute=value\fR\fR +\fB\-\-attr\-nomatch=\fR\fB\fIattribute=value\fR\fR .RS 4 Do not trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. .RE .PP -\fB\-\-socket\fR\fB\fIpath\fR\fR +\fB\-\-socket=\fR\fB\fIpath\fR\fR .RS 4 Pass the synthesized events to the specified socket, instead of triggering a global kernel event\. All available event values will be send in the same format the kernel sends an uevent, or \fBRUN+="socket:\fR\fB\fIpath\fR\fR\fB"\fR sends a message\. If the first character of the specified path is an @ character, an abstract namespace socket is used, instead of an existing socket file\. .RE +.PP +\fB\-\-env=\fR\fB\fIKEY\fR\fR\fB=\fR\fB\fIvalue\fR\fR +.RS 4 +Pass an additional environemt key to the event\. This works only with the \-\-socket option\. +.RE .SS "udevadm settle [options]" .PP Watches the udev event queue, and exits if all current events are handled\. diff --git a/udevadm.xml b/udevadm.xml index 121c1401d6..8537d2ad40 100644 --- a/udevadm.xml +++ b/udevadm.xml @@ -180,7 +180,7 @@ - + Do not trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against @@ -189,7 +189,7 @@ - + Pass the synthesized events to the specified socket, instead of triggering a global kernel event. All available event values will be send in the same format @@ -198,6 +198,13 @@ an abstract namespace socket is used, instead of an existing socket file. + + + + Pass an additional environemt key to the event. This works only with the + --socket option. + + diff --git a/udevtrigger.c b/udevtrigger.c index 72464c8381..d4b10d06ab 100644 --- a/udevtrigger.c +++ b/udevtrigger.c @@ -120,7 +120,7 @@ static void trigger_uevent(const char *devpath, const char *action) close(fd); } -static int pass_to_socket(const char *devpath, const char *action) +static int pass_to_socket(const char *devpath, const char *action, const char *env) { struct udevice udev; struct name_entry *name_loop; @@ -143,6 +143,12 @@ static int pass_to_socket(const char *devpath, const char *action) bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); bufpos++; + /* add cookie */ + if (env != NULL) { + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "%s", env); + bufpos++; + } + /* add standard keys */ bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVPATH=%s", devpath); bufpos++; @@ -230,7 +236,7 @@ static int pass_to_socket(const char *devpath, const char *action) return err; } -static void exec_list(const char *action) +static void exec_list(const char *action, const char *env) { struct name_entry *loop_device; struct name_entry *tmp_device; @@ -239,7 +245,7 @@ static void exec_list(const char *action) if (delay_device(loop_device->name)) continue; if (sock >= 0) - pass_to_socket(loop_device->name, action); + pass_to_socket(loop_device->name, action, env); else trigger_uevent(loop_device->name, action); list_del(&loop_device->node); @@ -249,7 +255,7 @@ static void exec_list(const char *action) /* trigger remaining delayed devices */ list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { if (sock >= 0) - pass_to_socket(loop_device->name, action); + pass_to_socket(loop_device->name, action, env); else trigger_uevent(loop_device->name, action); list_del(&loop_device->node); @@ -558,6 +564,7 @@ int udevtrigger(int argc, char *argv[], char *envp[]) const char *sockpath = NULL; int option; const char *action = "add"; + const char *env = NULL; static const struct option options[] = { { "verbose", 0, NULL, 'v' }, { "dry-run", 0, NULL, 'n' }, @@ -569,6 +576,7 @@ int udevtrigger(int argc, char *argv[], char *envp[]) { "subsystem-nomatch", 1, NULL, 'S' }, { "attr-match", 1, NULL, 'a' }, { "attr-nomatch", 1, NULL, 'A' }, + { "env", 1, NULL, 'e' }, {} }; @@ -578,7 +586,7 @@ int udevtrigger(int argc, char *argv[], char *envp[]) sysfs_init(); while (1) { - option = getopt_long(argc, argv, "vnFo:hc:s:S:a:A:", options, NULL); + option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL); if (option == -1) break; @@ -598,6 +606,10 @@ int udevtrigger(int argc, char *argv[], char *envp[]) case 'c': action = optarg; break; + case 'e': + if (strchr(optarg, '=') != NULL) + env = optarg; + break; case 's': name_list_add(&filter_subsystem_match_list, optarg, 0); break; @@ -616,6 +628,8 @@ int udevtrigger(int argc, char *argv[], char *envp[]) " --dry-run do not actually trigger the events\n" " --retry-failed trigger only the events which have been\n" " marked as failed during a previous run\n" + " --socket= pass events to socket instead of triggering kernel events\n" + " --env== pass an additional key (works only with --socket=)\n" " --subsystem-match= trigger devices from a matching subystem\n" " --subsystem-nomatch= exclude devices from a matching subystem\n" " --attr-match=]> trigger devices with a matching sysfs\n" @@ -649,11 +663,14 @@ int udevtrigger(int argc, char *argv[], char *envp[]) strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); } + } else if (env != NULL) { + fprintf(stderr, "error: --env= only valid with --socket= option\n"); + goto exit; } if (failed) { scan_failed(); - exec_list(action); + exec_list(action, env); } else { char base[PATH_SIZE]; struct stat statbuf; @@ -663,12 +680,12 @@ int udevtrigger(int argc, char *argv[], char *envp[]) strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { scan_subsystem("subsystem", SCAN_SUBSYSTEM); - exec_list(action); + exec_list(action, env); scan_subsystem("subsystem", SCAN_DEVICES); - exec_list(action); + exec_list(action, env); } else { scan_subsystem("bus", SCAN_SUBSYSTEM); - exec_list(action); + exec_list(action, env); scan_subsystem("bus", SCAN_DEVICES); scan_class(); @@ -677,7 +694,7 @@ int udevtrigger(int argc, char *argv[], char *envp[]) strlcat(base, "/class/block", sizeof(base)); if (stat(base, &statbuf) != 0) scan_block(); - exec_list(action); + exec_list(action, env); } } -- cgit v1.2.3-54-g00ecf From d8a9d017046661e3433779611f0e23266b68ba3d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 22 Apr 2008 03:19:21 +0200 Subject: udevadm: control - fix --env key to accept --env== --- extras/volume_id/vol_id.8 | 2 +- udevadm.8 | 10 +++++----- udevadm.xml | 10 +++++----- udevcontrol.c | 7 +++++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 index daa583b855..2e4a8c3811 100644 --- a/extras/volume_id/vol_id.8 +++ b/extras/volume_id/vol_id.8 @@ -1,6 +1,6 @@ .\" Title: vol_id .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.1 +.\" Generator: DocBook XSL Stylesheets v1.73.2 .\" Date: March 2006 .\" Manual: vol_id .\" Source: volume_id diff --git a/udevadm.8 b/udevadm.8 index 9cd91e209a..65e85e6bc0 100644 --- a/udevadm.8 +++ b/udevadm.8 @@ -129,12 +129,12 @@ Trigger events for devices which belong to a matching subsystem\. This option ca Do not trigger events for devices which belong to a matching subsystem\. This option can be specified multiple times and supports shell style pattern matching\. .RE .PP -\fB\-\-attr\-match=\fR\fB\fIattribute=value\fR\fR +\fB\-\-attr\-match=\fR\fB\fIattribute\fR\fR\fB=\fR\fB\fIvalue\fR\fR .RS 4 Trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. .RE .PP -\fB\-\-attr\-nomatch=\fR\fB\fIattribute=value\fR\fR +\fB\-\-attr\-nomatch=\fR\fB\fIattribute\fR\fR\fB=\fR\fB\fIvalue\fR\fR .RS 4 Do not trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. .RE @@ -191,17 +191,17 @@ Signal udevd to enable the execution of events\. Signal udevd to reload the rules from the config\. .RE .PP -\fB\-\-env \fR\fB\fIvar\fR\fR\fB=\fR\fB\fIvalue\fR\fR +\fB\-\-env=\fR\fB\fIKEY\fR\fR\fB=\fR\fB\fIvalue\fR\fR .RS 4 Set global variable\. .RE .PP -\fB\-\-max_childs\fR +\fB\-\-max_childs=\fR\fIvalue\fR .RS 4 Set the maximum number of events, udevd will handle at the same time\. .RE .PP -\fB\-\-max_childs_running\fR +\fB\-\-max_childs_running=\fR\fB\fIvalue\fR\fR .RS 4 Set the maximum number of events, which are allowed to run at the same time\. .RE diff --git a/udevadm.xml b/udevadm.xml index 8537d2ad40..670c991457 100644 --- a/udevadm.xml +++ b/udevadm.xml @@ -171,7 +171,7 @@ - + Trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against the given @@ -180,7 +180,7 @@ - + Do not trigger events for devices with a matching sysfs attribute. If a value is specified along with the attribute name, the content of the attribute is matched against @@ -258,20 +258,20 @@ - + Set global variable. - + value Set the maximum number of events, udevd will handle at the same time. - + Set the maximum number of events, which are allowed to run at the same time. diff --git a/udevcontrol.c b/udevcontrol.c index 287e8aaf99..4c93b8f464 100644 --- a/udevcontrol.c +++ b/udevcontrol.c @@ -105,7 +105,10 @@ int udevcontrol(int argc, char *argv[], char *envp[]) *intval = count; info("send max_childs_running=%i\n", *intval); } else if (!strncmp(arg, "env", strlen("env"))) { - val = argv[2]; + if (!strncmp(arg, "env=", strlen("env="))) + val = &arg[strlen("env=")]; + else + val = argv[2]; if (val == NULL) { fprintf(stderr, "missing key\n"); goto exit; @@ -119,7 +122,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) " --stop_exec_queue keep udevd from executing events, queue only\n" " --start_exec_queue execute events, flush queue\n" " --reload_rules reloads the rules files\n" - " --env = set a global environment variable\n" + " --env== set a global environment variable\n" " --max_childs= maximum number of childs\n" " --max_childs_running= maximum number of childs running at the same time\n" " --help print this help text\n\n"); -- cgit v1.2.3-54-g00ecf From 8b6e9f287d4ba774a12c023c2ef8fc78def29df8 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sun, 27 Apr 2008 20:19:44 +0200 Subject: rules_generator: net rules - add "dev_id" value to generated rules --- extras/rule_generator/75-persistent-net-generator.rules | 3 +++ extras/rule_generator/write_net_rules | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 85a4c5b55b..2c42de0d78 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -29,6 +29,9 @@ ENV{MATCHADDR}="$attr{address}" # match interface type ENV{MATCHIFTYPE}="$attr{type}" +# match interface dev_id +ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}" + # do not use "locally administered" MAC address ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index 322398bce4..d1086f086e 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -15,6 +15,7 @@ # variables used to communicate: # MATCHADDR MAC address used for the match # MATCHID bus_id used for the match +# MATCHDEVID dev_id used for the match # MATCHDRV driver name used for the match # MATCHIFTYPE interface type match # COMMENT comment to add to the generated rule @@ -78,6 +79,10 @@ if [ "$MATCHDRV" ]; then match="$match, DRIVERS==\"$MATCHDRV\"" fi +if [ "$MATCHDEVID" ]; then + match="$match, ATTR{dev_id}==\"$MATCHDEVID\"" +fi + if [ "$MATCHID" ]; then match="$match, KERNELS==\"$MATCHID\"" fi -- cgit v1.2.3-54-g00ecf From 4c46d72a93409860aea84242f4dcbe37b2afab19 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 28 Apr 2008 05:07:47 +0200 Subject: udevadm: info - do not print ATTR{dev}== --- udevinfo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udevinfo.c b/udevinfo.c index a0d6cac401..b8e97c4074 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -54,6 +54,8 @@ static void print_all_attributes(const char *devpath, const char *key) if (strcmp(dent->d_name, "uevent") == 0) continue; + if (strcmp(dent->d_name, "dev") == 0) + continue; strlcpy(filename, path, sizeof(filename)); strlcat(filename, "/", sizeof(filename)); -- cgit v1.2.3-54-g00ecf From 0654a21c78caf312fa612059725d1b47c78e7802 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 9 May 2008 09:05:15 +0200 Subject: persistent device naming: update tape rules Thanks to John Huttley for the fixes. All new bugs are introduced by me. :) --- etc/udev/rules.d/60-persistent-storage-tape.rules | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage-tape.rules b/etc/udev/rules.d/60-persistent-storage-tape.rules index 9c68fdf1a1..e56d57a415 100644 --- a/etc/udev/rules.d/60-persistent-storage-tape.rules +++ b/etc/udev/rules.d/60-persistent-storage-tape.rules @@ -4,18 +4,20 @@ ACTION!="add|change", GOTO="persistent_storage_tape_end" -KERNEL=="nst[0-9]", SUBSYSTEMS=="scsi", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" - # type 8 devices are "Medium Changers" KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="st[0-9]*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="st[0-9]*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="st[0-9]*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" -KERNEL=="st[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" + +KERNEL=="st*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="st*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" + +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" +KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" # by-path (shortest physical path) -KERNEL=="st[0-9]*", IMPORT{program}="path_id %p" -KERNEL=="st[0-9]*", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="st*[0-9]", IMPORT{program}="path_id %p" +KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" LABEL="persistent_storage_tape_end" -- cgit v1.2.3-54-g00ecf From f76f82f8342978640da8be47e7296f0e01c0dcba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 9 May 2008 09:05:42 +0200 Subject: rules: update md rules Activate the rule for autoassembly later. The needed options are merged into mdadm git, but not released. --- etc/udev/packages/64-md-raid.rules | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/udev/packages/64-md-raid.rules b/etc/udev/packages/64-md-raid.rules index 02f27ee07e..b8baea207f 100644 --- a/etc/udev/packages/64-md-raid.rules +++ b/etc/udev/packages/64-md-raid.rules @@ -1,9 +1,13 @@ # do not edit this file, it will be overwritten on update SUBSYSTEM!="block", GOTO="md_end" -KERNEL!="md[0-9]*", GOTO="md_end" ACTION!="add|change", GOTO="md_end" +# import data from a raid member and activate it +#ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}" +# import data from a raid set +KERNEL!="md*", GOTO="md_end" + ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" IMPORT{program}="/sbin/mdadm --detail --export $tempnode" -- cgit v1.2.3-54-g00ecf From 8325c84dba74ef8b9bd10d5dc5e4d0ec2574cf68 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 9 May 2008 09:22:23 +0200 Subject: release 121 --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 9 +++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5826cac3fa..dfe1c30854 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Summary of changes from v120 to v121 +============================================ + +Damjan Georgievski (1): + libvolume_id: recognize swap partitions with a tuxonice hibernate image + +Daniel Drake (1): + writing udev rules: fix rule typos + +David Woodhouse (1): + rules_generator: net rules - add "dev_id" value to generated rules + +Harald Hoyer (1): + selinux: more context settings + +Kay Sievers (21): + udevinfo: do not replace chars when printing ATTR== matches + vol_id: add --offset option + cdrom_id: replace with version which also exports media properties + udevd: at startup write message including version number to kernel log + rules_generator: net rules - always add KERNEL== match to generated rules + selinux: fix missing includes + allow setting of MODE="0000" + path_id: remove subsystem whitelist + logging: add trailing newline to all strings + scsi_id: initialize serial strings + persistent device naming: also read unpartitioned media + cdrom_id: add more help text + add $links substitution + fstab_import: add program to IMPORT matching fstab entry + add OPTIONS+="event_timeout=" + write "event_timeout" to db + udevadm: trigger - add --env= option + udevadm: control - fix --env key to accept --env== + udevadm: info - do not print ATTR{dev}== + persistent device naming: update tape rules + rules: update md rules + + Summary of changes from v119 to v120 ============================================ diff --git a/Makefile b/Makefile index baa3df9b8f..cf8c1d1eed 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 120 +VERSION = 121 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e087631c30..e9d4d9922b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,12 @@ +udev 121 +======== +Many bugfixes. + +The cdrom_id program is replaced by an advanced version, which can +detect most common device types, and also properties of the inserted +media. This is part of moving some basic functionality from HAL into +udev (and the kernel). + udev 120 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 661a0bea80d129d5df708e36dbaed745c9d8392e Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 13 May 2008 00:55:53 +0200 Subject: volume_id: clean up linux_raid code extra global and/or non-static variables suck in shared libraries use "else if" rather than many "return" calls Signed-off-by: Karel Zak --- extras/volume_id/lib/linux_raid.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 96ae7c32e3..af496584c4 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -27,7 +27,7 @@ #include "libvolume_id.h" #include "util.h" -static struct mdp0_super_block { +struct mdp0_super_block { uint32_t md_magic; uint32_t major_version; uint32_t minor_version; @@ -44,7 +44,7 @@ static struct mdp0_super_block { uint32_t set_uuid1; uint32_t set_uuid2; uint32_t set_uuid3; -} PACKED *mdp0; +} PACKED; struct mdp1_super_block { uint32_t magic; @@ -53,7 +53,7 @@ struct mdp1_super_block { uint32_t pad0; uint8_t set_uuid[16]; uint8_t set_name[32]; -} PACKED *mdp1; +} PACKED; #define MD_RESERVED_BYTES 0x10000 #define MD_SB_MAGIC 0xa92b4efc @@ -61,6 +61,7 @@ struct mdp1_super_block { static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; + struct mdp0_super_block *mdp0; union { uint32_t ints[4]; uint8_t bytes[16]; @@ -119,6 +120,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint64_t size) { const uint8_t *buf; + struct mdp1_super_block *mdp1; info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); @@ -153,22 +155,19 @@ int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size /* version 1.0 at the end of the device */ sboff = (size & ~(0x1000 - 1)) - 0x2000; - if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) { + if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) strcpy(id->type_version, "1.0"); - return 0; - } /* version 1.1 at the start of the device */ - if (volume_id_probe_linux_raid1(id, off, size) == 0) { + else if (volume_id_probe_linux_raid1(id, off, size) == 0) strcpy(id->type_version, "1.1"); - return 0; - } /* version 1.2 at 4k offset from the start */ - if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0) { + else if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0) strcpy(id->type_version, "1.2"); - return 0; - } - return -1; + else + return -1; + + return 0; } -- cgit v1.2.3-54-g00ecf From 877bded34a528b6436c12678f2430e2ad466f327 Mon Sep 17 00:00:00 2001 From: MUNEDA Takahiro Date: Wed, 14 May 2008 04:33:34 +0200 Subject: man: udevd- fix udev(8) reference --- udevd.8 | 2 +- udevd.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udevd.8 b/udevd.8 index 210ed3fe7f..c6b481134d 100644 --- a/udevd.8 +++ b/udevd.8 @@ -57,5 +57,5 @@ Written by Kay Sievers \. .SH "SEE ALSO" .PP -\fBudev\fR(8), +\fBudev\fR(7), \fBudevadm\fR(8) diff --git a/udevd.xml b/udevd.xml index 178af4cb6c..8d22a0c14d 100644 --- a/udevd.xml +++ b/udevd.xml @@ -97,7 +97,7 @@ SEE ALSO - udev8 + udev7 , udevadm8 -- cgit v1.2.3-54-g00ecf From 838436fa328345ffb0b355e6921b6d75a9b2992f Mon Sep 17 00:00:00 2001 From: MUNEDA Takahiro Date: Wed, 14 May 2008 04:47:33 +0200 Subject: man: scsi_id --- extras/scsi_id/scsi_id.8 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 927549bf60..aa429a580c 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -45,7 +45,7 @@ identifier starts with the NAA value of 6): .sp .nf -# /sbin/scsi_id --page=0x83 --devpath=/block/sdg +# scsi_id --page=0x83 --devpath=/block/sdg 3600a0b80000b174b000000d63efc5c8c .fi .P @@ -131,7 +131,10 @@ warnings are sent using syslog. .nf .ft B .ft -/etc/scsi_id.config configuration and black/white list entries +.TP +\fI/etc/scsi_id.config\fP +configuration and black/white list entries +.RE .fi .LP .SH "SEE ALSO" -- cgit v1.2.3-54-g00ecf From 753417db2ba6faafa3aa30f6b15678e1557e20b8 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Wed, 14 May 2008 13:42:41 +0200 Subject: scsi_id: remove all sysfs dependencies --- extras/scsi_id/scsi_id.c | 213 +++++++------------------------------------ extras/scsi_id/scsi_id.h | 19 +++- extras/scsi_id/scsi_serial.c | 85 ++++++++--------- 3 files changed, 83 insertions(+), 234 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 538108717d..4f0233ed0d 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -31,21 +31,14 @@ #include "scsi_id.h" #include "scsi_id_version.h" -/* temporary names for mknod */ -#define TMP_DIR "/dev" -#define TMP_PREFIX "tmp-scsi" - static const struct option options[] = { { "device", 1, NULL, 'd' }, { "config", 1, NULL, 'f' }, { "page", 1, NULL, 'p' }, - { "devpath", 1, NULL, 's' }, - { "fallback-to-sysfs", 0, NULL, 'a' }, { "blacklisted", 0, NULL, 'b' }, { "whitelisted", 0, NULL, 'g' }, { "prefix-bus-id", 0, NULL, 'i' }, { "replace-whitespace", 0, NULL, 'u' }, - { "ignore-sysfs", 0, NULL, 'n' }, { "verbose", 0, NULL, 'v' }, { "version", 0, NULL, 'V' }, { "export", 0, NULL, 'x' }, @@ -53,21 +46,17 @@ static const struct option options[] = { {} }; -static const char short_options[] = "abd:f:ghinp:s:uvVx"; +static const char short_options[] = "d:f:ghip:uvVx"; static const char dev_short_options[] = "bgp:"; static int all_good; -static int always_info; static int dev_specified; -static int sys_specified; static char config_file[MAX_PATH_LEN] = SCSI_ID_CONFIG_FILE; static int display_bus_id; static enum page_code default_page_code; static int use_stderr; static int debug; -static int hotplug_mode; static int reformat_serial; -static int ignore_sysfs; static int export; static char vendor_str[64]; static char model_str[64]; @@ -169,35 +158,6 @@ static void set_type(char *to, const char *from, size_t len) to[len-1] = '\0'; } -static int create_tmp_dev(const char *devpath, char *tmpdev, int dev_type) -{ - unsigned int maj, min; - const char *attr; - - dbg("%s\n", devpath); - attr = sysfs_attr_get_value(devpath, "dev"); - if (attr == NULL) { - dbg("%s: could not get dev attribute: %s\n", devpath, strerror(errno)); - return -1; - } - - dbg("dev value %s\n", attr); - if (sscanf(attr, "%u:%u", &maj, &min) != 2) { - err("%s: invalid dev major/minor\n", devpath); - return -1; - } - - snprintf(tmpdev, MAX_PATH_LEN, "%s/%s-maj%d-min%d-%u", - TMP_DIR, TMP_PREFIX, maj, min, getpid()); - - dbg("tmpdev '%s'\n", tmpdev); - if (mknod(tmpdev, 0600 | dev_type, makedev(maj, min))) { - err("mknod failed: %s\n", strerror(errno)); - return -1; - } - return 0; -} - /* * get_value: * @@ -415,7 +375,7 @@ static int get_file_options(const char *vendor, const char *model, } static int set_options(int argc, char **argv, const char *short_opts, - char *target, char *maj_min_dev) + char *maj_min_dev) { int option; @@ -436,9 +396,6 @@ static int set_options(int argc, char **argv, const char *short_opts, dbg("option '%c'\n", option); switch (option) { - case 'a': - always_info = 1; - break; case 'b': all_good = 0; break; @@ -465,11 +422,8 @@ static int set_options(int argc, char **argv, const char *short_opts, case 'h': printf("Usage: scsi_id OPTIONS \n" " --device device node for SG_IO commands\n" - " --devpath sysfs devpath\n" " --config location of config file\n" " --page SCSI page (0x80, 0x83, pre-spc3-83)\n" - " --fallback-to-sysfs print sysfs values if inquiry fails\n" - " --ignore-sysfs ignore sysfs entries\n" " --blacklisted threat device as blacklisted\n" " --whitelisted threat device as whitelisted\n" " --prefix-bus-id prefix SCSI bus id\n" @@ -497,16 +451,6 @@ static int set_options(int argc, char **argv, const char *short_opts, } break; - case 'n': - ignore_sysfs = 1; - break; - - case 's': - sys_specified = 1; - strncpy(target, optarg, MAX_PATH_LEN); - target[MAX_PATH_LEN-1] = '\0'; - break; - case 'u': reformat_serial = 1; break; @@ -528,10 +472,15 @@ static int set_options(int argc, char **argv, const char *short_opts, exit(1); } } + if (optind < argc && !dev_specified) { + dev_specified = 1; + strncpy(maj_min_dev, argv[optind], MAX_PATH_LEN); + maj_min_dev[MAX_PATH_LEN-1] = '\0'; + } return 0; } -static int per_dev_options(struct sysfs_device *dev_scsi, int *good_bad, int *page_code) +static int per_dev_options(struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) { int retval; int newargc; @@ -590,54 +539,18 @@ static int per_dev_options(struct sysfs_device *dev_scsi, int *good_bad, int *pa return retval; } -static int set_sysfs_values(struct sysfs_device *dev_scsi) -{ - const char *vendor, *model, *type; - - vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); - if (!vendor) { - info("%s: cannot get vendor attribute\n", dev_scsi->devpath); - return -1; - } - set_str(vendor_str, vendor, sizeof(vendor_str)-1); - - model = sysfs_attr_get_value(dev_scsi->devpath, "model"); - if (!model) { - info("%s: cannot get model attribute\n", dev_scsi->devpath); - return -1; - } - set_str(model_str, model, sizeof(model_str)-1); - - type = sysfs_attr_get_value(dev_scsi->devpath, "type"); - if (!type) { - info("%s: cannot get type attribute\n", dev_scsi->devpath); - return -1; - } - set_type(type_str, type, sizeof(type_str)); - - type = sysfs_attr_get_value(dev_scsi->devpath, "rev"); - if (!type) { - info("%s: cannot get type attribute\n", dev_scsi->devpath); - return -1; - } - set_str(revision_str, type, sizeof(revision_str)-1); - - return 0; -} - -static int set_inq_values(struct sysfs_device *dev_scsi, const char *path) +static int set_inq_values(struct scsi_id_device *dev_scsi, const char *path) { int retval; - char vendor[8], model[16], type[4], rev[4]; - retval = scsi_std_inquiry(dev_scsi, path, vendor, model, rev, type); + retval = scsi_std_inquiry(dev_scsi, path); if (retval) return retval; - set_str(vendor_str, vendor, 8); - set_str(model_str, model, 16); - set_type(type_str, type, sizeof(type_str) - 1); - set_str(revision_str, rev, sizeof(revision_str) -1); + set_str(vendor_str, dev_scsi->vendor, 8); + set_str(model_str, dev_scsi->model, 16); + set_type(type_str, dev_scsi->type, sizeof(type_str) - 1); + set_str(revision_str, dev_scsi->revision, sizeof(revision_str) -1); return 0; } @@ -674,60 +587,25 @@ static void format_serial(char *serial) * memory etc. return 2, and return 1 for expected cases (like broken * device found) that do not print an id. */ -static int scsi_id(const char *devpath, char *maj_min_dev) +static int scsi_id(char *maj_min_dev) { int retval; - int dev_type = 0; - struct sysfs_device *dev; - struct sysfs_device *dev_scsi = NULL; + struct scsi_id_device dev_scsi; int good_dev; int page_code; - char serial[MAX_SERIAL_LEN] = ""; char serial_short[MAX_SERIAL_LEN] = ""; - const char *bus_str = NULL; - - dbg("devpath %s\n", devpath); - dev = sysfs_device_get(devpath); - if (dev == NULL) { - err("unable to access '%s'\n", devpath); - return 1; - } - - if (strcmp(dev->subsystem, "block") == 0) - dev_type = S_IFBLK; - else - dev_type = S_IFCHR; - - /* mknod a temp dev to communicate with the device */ - if (!dev_specified && create_tmp_dev(dev->devpath, maj_min_dev, dev_type)) { - dbg("create_tmp_dev failed\n"); - return 1; - } - - if (!ignore_sysfs) { - /* get scsi parent device */ - dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); - if (dev_scsi == NULL) { - err("unable to access parent device of '%s'\n", devpath); - return 1; - } - set_sysfs_values(dev_scsi); - bus_str = "scsi"; - } else { - dev_scsi = dev; - set_inq_values(dev_scsi, maj_min_dev); - } + set_inq_values(&dev_scsi, maj_min_dev); /* get per device (vendor + model) options from the config file */ - retval = per_dev_options(dev_scsi, &good_dev, &page_code); + retval = per_dev_options(&dev_scsi, &good_dev, &page_code); dbg("per dev options: good %d; page code 0x%x\n", good_dev, page_code); if (!good_dev) { retval = 1; - } else if (scsi_get_serial(dev_scsi, maj_min_dev, page_code, - serial, serial_short, MAX_SERIAL_LEN)) { - retval = always_info?0:1; + } else if (scsi_get_serial(&dev_scsi, maj_min_dev, page_code, + serial_short, MAX_SERIAL_LEN)) { + retval = 1; } else { retval = 0; } @@ -738,59 +616,33 @@ static int scsi_id(const char *devpath, char *maj_min_dev) printf("ID_VENDOR=%s\n", vendor_str); printf("ID_MODEL=%s\n", model_str); printf("ID_REVISION=%s\n", revision_str); - set_str(serial_str, serial, sizeof(serial_str)); + set_str(serial_str, dev_scsi.serial, sizeof(serial_str)); printf("ID_SERIAL=%s\n", serial_str); set_str(serial_str, serial_short, sizeof(serial_str)); printf("ID_SERIAL_SHORT=%s\n", serial_str); printf("ID_TYPE=%s\n", type_str); - if (bus_str != NULL) - printf("ID_BUS=%s\n", bus_str); } else { if (reformat_serial) - format_serial(serial); - if (display_bus_id) - printf("%s: ", dev_scsi->kernel); - printf("%s\n", serial); + format_serial(dev_scsi.serial); + printf("%s\n", dev_scsi.serial); } - dbg("%s\n", serial); + dbg("%s\n", dev_scsi.serial); retval = 0; } - if (!dev_specified) - unlink(maj_min_dev); - return retval; } int main(int argc, char **argv) { int retval = 0; - char devpath[MAX_PATH_LEN]; char maj_min_dev[MAX_PATH_LEN]; int newargc; - const char *env; char **newargv; logging_init("scsi_id"); - sysfs_init(); dbg("argc is %d\n", argc); - /* sysfs path can be overridden for testing */ - env = getenv("SYSFS_PATH"); - if (env) { - strncpy(sysfs_path, env, sizeof(sysfs_path)); - sysfs_path[sizeof(sysfs_path)-1] = '\0'; - } else - strcpy(sysfs_path, "/sys"); - - env = getenv("DEVPATH"); - if (env) { - hotplug_mode = 1; - sys_specified = 1; - strncpy(devpath, env, MAX_PATH_LEN); - devpath[sizeof(devpath)-1] = '\0'; - } - /* * Get config file options. */ @@ -801,8 +653,7 @@ int main(int argc, char **argv) goto exit; } if (newargv && (retval == 0)) { - if (set_options(newargc, newargv, short_options, devpath, - maj_min_dev) < 0) { + if (set_options(newargc, newargv, short_options, maj_min_dev) < 0) { retval = 2; goto exit; } @@ -810,22 +661,20 @@ int main(int argc, char **argv) } /* - * Get command line options (overriding any config file or DEVPATH - * settings). + * Get command line options (overriding any config file settings). */ - if (set_options(argc, argv, short_options, devpath, maj_min_dev) < 0) + if (set_options(argc, argv, short_options, maj_min_dev) < 0) exit(1); - if (!sys_specified) { - info("--devpath= must be specified\n"); + if (!dev_specified) { + info("no device specified\n"); retval = 1; goto exit; } - retval = scsi_id(devpath, maj_min_dev); + retval = scsi_id(maj_min_dev); exit: - sysfs_cleanup(); logging_close(); return retval; } diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 0e2b297d28..3b3a000dd7 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -30,13 +30,21 @@ */ #define MAX_BUFFER_LEN 256 -extern int scsi_std_inquiry(struct sysfs_device *dev_scsi, const char *devname, - char *vendor, char *model, char *rev, char *type); -extern int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, - int page_code, char *serial, char *serial_short, int len); +struct scsi_id_device { + char vendor[9]; + char model[17]; + char revision[5]; + char type[33]; + char kernel[64]; + char serial[MAX_SERIAL_LEN]; +}; + +extern int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname); +extern int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, + int page_code, char *serial_short, int len); /* - * Page code values. + * Page code values. */ enum page_code { PAGE_83_PRE_SPC3 = -0x83, @@ -44,3 +52,4 @@ enum page_code { PAGE_80 = 0x80, PAGE_83 = 0x83, }; + diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 28e82db3ca..32bb0f423e 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -148,7 +148,7 @@ static int sg_err_category3(struct sg_io_hdr *hp) hp->sbp, hp->sb_len_wr); } -static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) +static int scsi_dump_sense(struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) { unsigned char *sense_buffer; int s; @@ -254,7 +254,7 @@ static int scsi_dump_sense(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) return -1; } -static int scsi_dump(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) +static int scsi_dump(struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) { if (!io->status && !io->host_status && !io->msg_status && !io->driver_status) { @@ -273,7 +273,7 @@ static int scsi_dump(struct sysfs_device *dev_scsi, struct sg_io_hdr *io) return -1; } -static int scsi_inquiry(struct sysfs_device *dev_scsi, int fd, +static int scsi_inquiry(struct scsi_id_device *dev_scsi, int fd, unsigned char evpd, unsigned char page, unsigned char *buf, unsigned int buflen) { @@ -343,11 +343,10 @@ error: } /* Get list of supported EVPD pages */ -static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, +static int do_scsi_page0_inquiry(struct scsi_id_device *dev_scsi, int fd, unsigned char *buffer, unsigned int len) { int retval; - const char *vendor; memset(buffer, 0, len); retval = scsi_inquiry(dev_scsi, fd, 1, 0x0, buffer, len); @@ -375,12 +374,7 @@ static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, * If the vendor id appears in the page assume the page is * invalid. */ - vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); - if (!vendor) { - info("%s: cannot get model attribute\n", dev_scsi->kernel); - return 1; - } - if (!strncmp((char *)&buffer[VENDOR_LENGTH], vendor, VENDOR_LENGTH)) { + if (!strncmp((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) { info("%s: invalid page0 data\n", dev_scsi->kernel); return 1; } @@ -392,25 +386,14 @@ static int do_scsi_page0_inquiry(struct sysfs_device *dev_scsi, int fd, * The caller checks that serial is long enough to include the vendor + * model. */ -static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) +static int prepend_vendor_model(struct scsi_id_device *dev_scsi, char *serial) { - const char *attr; int ind; - attr = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); - if (!attr) { - info("%s: cannot get vendor attribute\n", dev_scsi->kernel); - return 1; - } - strncpy(serial, attr, VENDOR_LENGTH); + strncpy(serial, dev_scsi->vendor, VENDOR_LENGTH); ind = strlen(serial) - 1; - attr = sysfs_attr_get_value(dev_scsi->devpath, "model"); - if (!attr) { - info("%s: cannot get model attribute\n", dev_scsi->kernel); - return 1; - } - strncat(serial, attr, MODEL_LENGTH); + strncat(serial, dev_scsi->model, MODEL_LENGTH); ind = strlen(serial) - 1; ind++; @@ -430,7 +413,7 @@ static int prepend_vendor_model(struct sysfs_device *dev_scsi, char *serial) * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill * serial number. **/ -static int check_fill_0x83_id(struct sysfs_device *dev_scsi, +static int check_fill_0x83_id(struct scsi_id_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values *id_search, char *serial, char *serial_short, int max_len) @@ -521,7 +504,7 @@ static int check_fill_0x83_id(struct sysfs_device *dev_scsi, } /* Extract the raw binary from VPD 0x83 pre-SPC devices */ -static int check_fill_0x83_prespc3(struct sysfs_device *dev_scsi, +static int check_fill_0x83_prespc3(struct scsi_id_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values *id_search, char *serial, char *serial_short, int max_len) @@ -543,7 +526,7 @@ static int check_fill_0x83_prespc3(struct sysfs_device *dev_scsi, /* Get device identification VPD page */ -static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, +static int do_scsi_page83_inquiry(struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int len) { int retval; @@ -633,7 +616,7 @@ static int do_scsi_page83_inquiry(struct sysfs_device *dev_scsi, int fd, * Return the hard coded error code value 2 if the page 83 reply is not * conformant to the SCSI-2 format. */ -static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, +static int do_scsi_page83_prespc3_inquiry(struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int len) { int retval; @@ -695,7 +678,7 @@ static int do_scsi_page83_prespc3_inquiry(struct sysfs_device *dev_scsi, int fd, } /* Get unit serial number VPD page */ -static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, +static int do_scsi_page80_inquiry(struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int max_len) { int retval; @@ -736,30 +719,38 @@ static int do_scsi_page80_inquiry(struct sysfs_device *dev_scsi, int fd, return 0; } -int scsi_std_inquiry(struct sysfs_device *dev_scsi, const char *devname, - char *vendor, char *model, char *rev, char *type) +int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) { int retval; int fd; unsigned char buf[SCSI_INQ_BUFF_LEN]; + struct stat statbuf; dbg("opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { - info("%s: cannot open %s: %s\n", - dev_scsi->kernel, devname, strerror(errno)); + info("scsi_id: cannot open %s: %s\n", + devname, strerror(errno)); return 1; } + if (fstat(fd, &statbuf) < 0) { + info("scsi_id: cannot stat %s: %s\n", + devname, strerror(errno)); + return 2; + } + sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev), + minor(statbuf.st_rdev)); + memset(buf, 0, SCSI_INQ_BUFF_LEN); retval = scsi_inquiry(dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); if (retval < 0) return retval; - memcpy(vendor, buf + 8, 8); - memcpy(model, buf + 16, 16); - memcpy(rev, buf + 32, 4); - sprintf(type,"%x", buf[0] & 0x1f); + memcpy(dev_scsi->vendor, buf + 8, 8); + memcpy(dev_scsi->model, buf + 16, 16); + memcpy(dev_scsi->revision, buf + 32, 4); + sprintf(dev_scsi->type,"%x", buf[0] & 0x1f); if (close(fd) < 0) info("%s: close failed: %s\n", dev_scsi->kernel, strerror(errno)); @@ -767,15 +758,15 @@ int scsi_std_inquiry(struct sysfs_device *dev_scsi, const char *devname, return 0; } -int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, - int page_code, char *serial, char *serial_short, int len) +int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, + int page_code, char *serial_short, int len) { unsigned char page0[SCSI_INQ_BUFF_LEN]; int fd; int ind; int retval; - memset(serial, 0, len); + memset(dev_scsi->serial, 0, len); dbg("opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { @@ -785,7 +776,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, } if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(dev_scsi, fd, serial, serial_short, len)) { + if (do_scsi_page80_inquiry(dev_scsi, fd, dev_scsi->serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -793,7 +784,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, goto completed; } } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(dev_scsi, fd, serial, serial_short, len)) { + if (do_scsi_page83_inquiry(dev_scsi, fd, dev_scsi->serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -801,7 +792,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, goto completed; } } else if (page_code == PAGE_83_PRE_SPC3) { - retval = do_scsi_page83_prespc3_inquiry(dev_scsi, fd, serial, serial_short, len); + retval = do_scsi_page83_prespc3_inquiry(dev_scsi, fd, dev_scsi->serial, serial_short, len); if (retval) { /* * Fallback to servicing a SPC-2/3 compliant page 83 @@ -809,7 +800,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, * conform to pre-SPC3 expectations. */ if (retval == 2) { - if (do_scsi_page83_inquiry(dev_scsi, fd, serial, serial_short, len)) { + if (do_scsi_page83_inquiry(dev_scsi, fd, dev_scsi->serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -849,7 +840,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) if (!do_scsi_page83_inquiry(dev_scsi, fd, - serial, serial_short, len)) { + dev_scsi->serial, serial_short, len)) { /* * Success */ @@ -860,7 +851,7 @@ int scsi_get_serial (struct sysfs_device *dev_scsi, const char *devname, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_80) if (!do_scsi_page80_inquiry(dev_scsi, fd, - serial, serial_short, len)) { + dev_scsi->serial, serial_short, len)) { /* * Success */ -- cgit v1.2.3-54-g00ecf From 78d9ecfd4f1e37f7453e55e71f2909a58706ae10 Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Wed, 14 May 2008 13:55:49 +0200 Subject: scsi_id: add SGv4 support Fall back to SGv3, if SGv3 returns a failure/is not available. --- extras/scsi_id/Makefile | 4 +- extras/scsi_id/scsi_id.c | 2 + extras/scsi_id/scsi_id.h | 1 + extras/scsi_id/scsi_serial.c | 103 +++++++++++++++++++++++++++++++++---------- 4 files changed, 84 insertions(+), 26 deletions(-) diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile index 870296a666..ca067d0cb9 100644 --- a/extras/scsi_id/Makefile +++ b/extras/scsi_id/Makefile @@ -6,11 +6,11 @@ # Released under the GNU General Public License, version 2. # -SCSI_ID_VERSION = 0.9 +SCSI_ID_VERSION = 2.0 PROG = scsi_id OBJS= scsi_serial.o -HEADERS = scsi_id.h scsi.h scsi_id_version.h +HEADERS = scsi_id.h scsi.h scsi_id_version.h bsg.h GEN_HEADERS = scsi_id_version.h MAN_PAGES = scsi_id.8 diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 4f0233ed0d..0f09f29b64 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -543,6 +543,8 @@ static int set_inq_values(struct scsi_id_device *dev_scsi, const char *path) { int retval; + dev_scsi->use_sg = 4; + retval = scsi_std_inquiry(dev_scsi, path); if (retval) return retval; diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 3b3a000dd7..680c39d9ef 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -37,6 +37,7 @@ struct scsi_id_device { char type[33]; char kernel[64]; char serial[MAX_SERIAL_LEN]; + int use_sg; }; extern int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 32bb0f423e..202ffc0a84 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -22,7 +22,12 @@ #include #include #include +#include +#include #include +#include +/* #include */ +#include "bsg.h" #include "../../udev.h" #include "scsi.h" @@ -94,10 +99,7 @@ static int sg_err_category_new(int scsi_status, int msg_status, int * XXX change to return only two values - failed or OK. */ - /* - * checks msg_status - */ - if (!scsi_status && !msg_status && !host_status && !driver_status) + if (!scsi_status && !host_status && !driver_status) return SG_ERR_CAT_CLEAN; if ((scsi_status == SCSI_CHECK_CONDITION) || @@ -148,11 +150,18 @@ static int sg_err_category3(struct sg_io_hdr *hp) hp->sbp, hp->sb_len_wr); } -static int scsi_dump_sense(struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) +static int sg_err_category4(struct sg_io_v4 *hp) +{ + return sg_err_category_new(hp->device_status, 0, + hp->transport_status, hp->driver_status, + (unsigned char *)hp->response, + hp->response_len); +} + +static int scsi_dump_sense(struct scsi_id_device *dev_scsi, + unsigned char *sense_buffer, int sb_len) { - unsigned char *sense_buffer; int s; - int sb_len; int code; int sense_class; int sense_key; @@ -177,13 +186,11 @@ static int scsi_dump_sense(struct scsi_id_device *dev_scsi, struct sg_io_hdr *io dbg("got check condition\n"); - sb_len = io->sb_len_wr; if (sb_len < 1) { info("%s: sense buffer empty\n", dev_scsi->kernel); return -1; } - sense_buffer = io->sbp; sense_class = (sense_buffer[0] >> 4) & 0x07; code = sense_buffer[0] & 0xf; @@ -268,7 +275,28 @@ static int scsi_dump(struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) info("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); if (io->status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(dev_scsi, io); + return scsi_dump_sense(dev_scsi, io->sbp, io->sb_len_wr); + else + return -1; +} + +static int scsi_dump_v4(struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) +{ + if (!io->device_status && !io->transport_status && + !io->driver_status) { + /* + * Impossible, should not be called. + */ + info("%s: called with no error\n", __FUNCTION__); + return -1; + } + + info("%s: sg_io failed status 0x%x 0x%x 0x%x\n", + dev_scsi->kernel, io->driver_status, io->transport_status, + io->device_status); + if (io->device_status == SCSI_CHECK_CONDITION) + return scsi_dump_sense(dev_scsi, (unsigned char *)io->response, + io->response_len); else return -1; } @@ -281,6 +309,8 @@ static int scsi_inquiry(struct scsi_id_device *dev_scsi, int fd, { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; unsigned char sense[SENSE_BUFF_LEN]; struct sg_io_hdr io_hdr; + struct sg_io_v4 io_v4; + void *io_buf; int retval; int retry = 3; /* rather random */ @@ -292,24 +322,46 @@ static int scsi_inquiry(struct scsi_id_device *dev_scsi, int fd, resend: dbg("%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(inq_cmd); - io_hdr.mx_sb_len = sizeof(sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.dxfer_len = buflen; - io_hdr.dxferp = buf; - io_hdr.cmdp = inq_cmd; - io_hdr.sbp = sense; - io_hdr.timeout = DEF_TIMEOUT; - - if (ioctl(fd, SG_IO, &io_hdr) < 0) { + if (dev_scsi->use_sg == 4) { + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof(inq_cmd); + io_v4.request = (uintptr_t)inq_cmd; + io_v4.max_response_len = sizeof(sense); + io_v4.response = (uintptr_t)sense; + io_v4.din_xfer_len = buflen; + io_v4.din_xferp = (uintptr_t)buf; + io_buf = (void *)&io_v4; + } else { + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof(inq_cmd); + io_hdr.mx_sb_len = sizeof(sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = buflen; + io_hdr.dxferp = buf; + io_hdr.cmdp = inq_cmd; + io_hdr.sbp = sense; + io_hdr.timeout = DEF_TIMEOUT; + io_buf = (void *)&io_hdr; + } + + if (ioctl(fd, SG_IO, io_buf) < 0) { + if (errno == EINVAL && dev_scsi->use_sg == 4) { + dev_scsi->use_sg = 3; + goto resend; + } info("%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); retval = -1; goto error; } - retval = sg_err_category3(&io_hdr); + if (dev_scsi->use_sg == 4) + retval = sg_err_category4(io_buf); + else + retval = sg_err_category3(io_buf); switch (retval) { case SG_ERR_CAT_NOTSUPPORTED: @@ -321,7 +373,10 @@ resend: break; default: - retval = scsi_dump(dev_scsi, &io_hdr); + if (dev_scsi->use_sg == 4) + retval = scsi_dump_v4(dev_scsi, io_buf); + else + retval = scsi_dump(dev_scsi, io_buf); } if (!retval) { -- cgit v1.2.3-54-g00ecf From 138cf75e4eda54ab519c0d77ad3ca4b467dfe7ec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 May 2008 13:59:11 +0200 Subject: scsi_id: update man page --- extras/scsi_id/scsi_id.8 | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index aa429a580c..725b7d5317 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -52,25 +52,12 @@ identifier starts with the NAA value of 6): .SH OPTIONS .TP -.BI \-\-fallback-to-sysfs -Always print information (model, vendor strings) about the device even -if it does not support VPD pages. -.TP -.BI \-\-ignore-sysfs -Ignore sysfs entries. Used for devices which are not represented as SCSI -devices, but understand SG_IO commands. -.TP .BI \-\-blacklisted The default behaviour \- treat the device as black listed, and do nothing unless a white listed device is found in the scsi_id config\-file. .TP .BI \-\-device=\| device\^ -Instead -of determining and creating a device node based on a sysfs dev -entry as done for the \fB\-s\fP, send SG_IO commands to -\fBdevice\fP, such as \fB/dev/sdc\fP. -This argument should also be used when invoked via udev to avoid problems -with creation of temporary files on not-yet writable directories. +Send SG_IO commands to \fBdevice\fP, such as \fB/dev/sdc\fP. .TP .BI \-\-config=\| config\-file Read configuration and black/white list entries from @@ -85,10 +72,6 @@ on the command line or in the scsi_id configuration file for .B scsi_id to generate any output. .TP -.BI \-\-prefix-bus-id -Prefix the identification string with the driver model (sysfs) bus id of -the SCSI device. -.TP .BI \-\-page=\| 0x80 | 0x83 | pre-spc3-83 Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83. .sp @@ -102,11 +85,6 @@ option is used for older model 4, 5, and 6 EMC Symmetrix devices, its use with SPC-2 or SPC-3 compliant devices will fallback to the page 83 format supported by these devices. .TP -.BI \-\-devpath=\| sysfs\-devpath -Generate an id for the -.B sysfs\-devpath. -The sysfs mount point must not be included. -.TP .BI \-\-replace-whitespace Reformat the output : replace all whitespaces by underscores. .TP -- cgit v1.2.3-54-g00ecf From 2d05764a77078953849a1f84ac269c927904ca23 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 May 2008 13:59:25 +0200 Subject: scsi_id: remove bus_id option --- extras/scsi_id/scsi_id.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 0f09f29b64..6194b7180a 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -37,7 +37,6 @@ static const struct option options[] = { { "page", 1, NULL, 'p' }, { "blacklisted", 0, NULL, 'b' }, { "whitelisted", 0, NULL, 'g' }, - { "prefix-bus-id", 0, NULL, 'i' }, { "replace-whitespace", 0, NULL, 'u' }, { "verbose", 0, NULL, 'v' }, { "version", 0, NULL, 'V' }, @@ -52,7 +51,6 @@ static const char dev_short_options[] = "bgp:"; static int all_good; static int dev_specified; static char config_file[MAX_PATH_LEN] = SCSI_ID_CONFIG_FILE; -static int display_bus_id; static enum page_code default_page_code; static int use_stderr; static int debug; @@ -426,7 +424,6 @@ static int set_options(int argc, char **argv, const char *short_opts, " --page SCSI page (0x80, 0x83, pre-spc3-83)\n" " --blacklisted threat device as blacklisted\n" " --whitelisted threat device as whitelisted\n" - " --prefix-bus-id prefix SCSI bus id\n" " --replace-whitespace replace all whitespaces by underscores\n" " --verbose verbose logging\n" " --version print version\n" @@ -434,10 +431,6 @@ static int set_options(int argc, char **argv, const char *short_opts, " --help print this help text\n\n"); exit(0); - case 'i': - display_bus_id = 1; - break; - case 'p': if (strcmp(optarg, "0x80") == 0) { default_page_code = PAGE_80; -- cgit v1.2.3-54-g00ecf From 025570aa3e054d92d65f8d2de9f91d202f60c798 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 May 2008 15:02:17 +0200 Subject: scsi_id: add --sg-version= option --- extras/scsi_id/scsi_id.c | 53 ++++++++++++++++++++++++++------------------ extras/scsi_id/scsi_serial.c | 6 +++-- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 6194b7180a..5eb95e890d 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -38,6 +38,7 @@ static const struct option options[] = { { "blacklisted", 0, NULL, 'b' }, { "whitelisted", 0, NULL, 'g' }, { "replace-whitespace", 0, NULL, 'u' }, + { "sg-version", 1, NULL, 's' }, { "verbose", 0, NULL, 'v' }, { "version", 0, NULL, 'V' }, { "export", 0, NULL, 'x' }, @@ -52,6 +53,7 @@ static int all_good; static int dev_specified; static char config_file[MAX_PATH_LEN] = SCSI_ID_CONFIG_FILE; static enum page_code default_page_code; +static int sg_version = 4; static int use_stderr; static int debug; static int reformat_serial; @@ -257,7 +259,7 @@ static int get_file_options(const char *vendor, const char *model, break; lineno++; if (buf[strlen(buffer) - 1] != '\n') { - info("Config file line %d too long\n", lineno); + err("Config file line %d too long\n", lineno); break; } @@ -309,7 +311,7 @@ static int get_file_options(const char *vendor, const char *model, * Only allow: [vendor=foo[,model=bar]]options=stuff */ if (!options_in || (!vendor_in && model_in)) { - info("Error parsing config file line %d '%s'\n", lineno, buffer); + err("Error parsing config file line %d '%s'\n", lineno, buffer); retval = -1; break; } @@ -419,16 +421,17 @@ static int set_options(int argc, char **argv, const char *short_opts, case 'h': printf("Usage: scsi_id OPTIONS \n" - " --device device node for SG_IO commands\n" - " --config location of config file\n" - " --page SCSI page (0x80, 0x83, pre-spc3-83)\n" - " --blacklisted threat device as blacklisted\n" - " --whitelisted threat device as whitelisted\n" - " --replace-whitespace replace all whitespaces by underscores\n" - " --verbose verbose logging\n" - " --version print version\n" - " --export print values as environment keys\n" - " --help print this help text\n\n"); + " --device= device node for SG_IO commands\n" + " --config= location of config file\n" + " --page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\n" + " --sg-version=3|4 use SGv3 or SGv4\n" + " --blacklisted threat device as blacklisted\n" + " --whitelisted threat device as whitelisted\n" + " --replace-whitespace replace all whitespaces by underscores\n" + " --verbose verbose logging\n" + " --version print version\n" + " --export print values as environment keys\n" + " --help print this help text\n\n"); exit(0); case 'p': @@ -439,7 +442,15 @@ static int set_options(int argc, char **argv, const char *short_opts, } else if (strcmp(optarg, "pre-spc3-83") == 0) { default_page_code = PAGE_83_PRE_SPC3; } else { - info("Unknown page code '%s'\n", optarg); + err("Unknown page code '%s'\n", optarg); + return -1; + } + break; + + case 's': + sg_version = atoi(optarg); + if (sg_version < 3 || sg_version > 4) { + err("Unknown SG version '%s'\n", optarg); return -1; } break; @@ -513,13 +524,13 @@ static int per_dev_options(struct scsi_id_device *dev_scsi, int *good_bad, int * } else if (strcmp(optarg, "pre-spc3-83") == 0) { *page_code = PAGE_83_PRE_SPC3; } else { - info("Unknown page code '%s'\n", optarg); + err("Unknown page code '%s'\n", optarg); retval = -1; } break; default: - info("Unknown or bad option '%c' (0x%x)\n", option, option); + err("Unknown or bad option '%c' (0x%x)\n", option, option); retval = -1; break; } @@ -536,16 +547,16 @@ static int set_inq_values(struct scsi_id_device *dev_scsi, const char *path) { int retval; - dev_scsi->use_sg = 4; + dev_scsi->use_sg = sg_version; retval = scsi_std_inquiry(dev_scsi, path); if (retval) return retval; - set_str(vendor_str, dev_scsi->vendor, 8); - set_str(model_str, dev_scsi->model, 16); - set_type(type_str, dev_scsi->type, sizeof(type_str) - 1); - set_str(revision_str, dev_scsi->revision, sizeof(revision_str) -1); + set_str(vendor_str, dev_scsi->vendor, sizeof(vendor_str)); + set_str(model_str, dev_scsi->model, sizeof(model_str)); + set_type(type_str, dev_scsi->type, sizeof(type_str)); + set_str(revision_str, dev_scsi->revision, sizeof(revision_str)); return 0; } @@ -662,7 +673,7 @@ int main(int argc, char **argv) exit(1); if (!dev_specified) { - info("no device specified\n"); + err("no device specified\n"); retval = 1; goto exit; } diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 202ffc0a84..c5cacfa114 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -803,12 +803,14 @@ int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) return retval; memcpy(dev_scsi->vendor, buf + 8, 8); + dev_scsi->vendor[8] = '\0'; memcpy(dev_scsi->model, buf + 16, 16); + dev_scsi->model[16] = '\0'; memcpy(dev_scsi->revision, buf + 32, 4); + dev_scsi->revision[4] = '\0'; sprintf(dev_scsi->type,"%x", buf[0] & 0x1f); - if (close(fd) < 0) - info("%s: close failed: %s\n", dev_scsi->kernel, strerror(errno)); + close(fd); return 0; } -- cgit v1.2.3-54-g00ecf From 3d2aed9e869dc8abadb6f7919dcf9e35837d6181 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 May 2008 15:14:23 +0200 Subject: rules: adapt to new scsi_id --- etc/udev/rules.d/60-persistent-storage.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 85a9270027..b7c4337f4c 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -33,8 +33,8 @@ KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" -KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --ignore-sysfs -s %p -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" +KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From 788096cb59a7ad1cdd08ccc59e5e3b1d2f4828c2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 May 2008 15:17:35 +0200 Subject: rules: adapt tape rules to new scsi_id --- etc/udev/rules.d/60-persistent-storage-tape.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage-tape.rules b/etc/udev/rules.d/60-persistent-storage-tape.rules index e56d57a415..45cac939fe 100644 --- a/etc/udev/rules.d/60-persistent-storage-tape.rules +++ b/etc/udev/rules.d/60-persistent-storage-tape.rules @@ -5,14 +5,14 @@ ACTION!="add|change", GOTO="persistent_storage_tape_end" # type 8 devices are "Medium Changers" -KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" KERNEL=="st*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="st*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted --fallback-to-sysfs -s %p -d $tempnode" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" -- cgit v1.2.3-54-g00ecf From 4cd71da5603898cff68a31774be570750d7fd659 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Wed, 14 May 2008 16:03:49 +0200 Subject: cdrom_id: fix segfault --- extras/cdrom_id/cdrom_id.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 0e0a463d94..e0cbe9e713 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -469,6 +469,8 @@ static int cd_media_toc(int fd) info("READ TOC: len: %d\n", len); if (len > sizeof(toc)) return -1; + if (len < 8) + return -1; /* check if we have a data track */ info("ctl %02x (0x04 is data/audio)\n", header[5]); -- cgit v1.2.3-54-g00ecf From 53ba69a0c2c48ad87cc597518f529812c9a6a69e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 May 2008 12:52:42 +0200 Subject: scsi_id: add bsg.h --- extras/scsi_id/bsg.h | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 extras/scsi_id/bsg.h diff --git a/extras/scsi_id/bsg.h b/extras/scsi_id/bsg.h new file mode 100644 index 0000000000..cf0303a606 --- /dev/null +++ b/extras/scsi_id/bsg.h @@ -0,0 +1,84 @@ +#ifndef BSG_H +#define BSG_H + +#define BSG_PROTOCOL_SCSI 0 + +#define BSG_SUB_PROTOCOL_SCSI_CMD 0 +#define BSG_SUB_PROTOCOL_SCSI_TMF 1 +#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 + +struct sg_io_v4 { + __s32 guard; /* [i] 'Q' to differentiate from v3 */ + __u32 protocol; /* [i] 0 -> SCSI , .... */ + __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task + management function, .... */ + + __u32 request_len; /* [i] in bytes */ + __u64 request; /* [i], [*i] {SCSI: cdb} */ + __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ + __u32 request_attr; /* [i] {SCSI: task attribute} */ + __u32 request_priority; /* [i] {SCSI: task priority} */ + __u32 request_extra; /* [i] {spare, for padding} */ + __u32 max_response_len; /* [i] in bytes */ + __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ + + /* "dout_": data out (to device); "din_": data in (from device) */ + __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else + dout_xfer points to array of iovec */ + __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ + __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */ + __u32 din_xfer_len; /* [i] bytes to be transferred from device */ + __u64 dout_xferp; /* [i], [*i] */ + __u64 din_xferp; /* [i], [*o] */ + + __u32 timeout; /* [i] units: millisecond */ + __u32 flags; /* [i] bit mask */ + __u64 usr_ptr; /* [i->o] unused internally */ + __u32 spare_in; /* [i] */ + + __u32 driver_status; /* [o] 0 -> ok */ + __u32 transport_status; /* [o] 0 -> ok */ + __u32 device_status; /* [o] {SCSI: command completion status} */ + __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */ + __u32 info; /* [o] additional information */ + __u32 duration; /* [o] time to complete, in milliseconds */ + __u32 response_len; /* [o] bytes of response actually written */ + __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */ + __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */ + __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */ + __u32 spare_out; /* [o] */ + + __u32 padding; +}; + +#ifdef __KERNEL__ + +#if defined(CONFIG_BLK_DEV_BSG) +struct bsg_class_device { + struct device *class_dev; + struct device *parent; + int minor; + struct request_queue *queue; + struct kref ref; + void (*release)(struct device *); +}; + +extern int bsg_register_queue(struct request_queue *q, + struct device *parent, const char *name, + void (*release)(struct device *)); +extern void bsg_unregister_queue(struct request_queue *); +#else +static inline int bsg_register_queue(struct request_queue *q, + struct device *parent, const char *name, + void (*release)(struct device *)) +{ + return 0; +} +static inline void bsg_unregister_queue(struct request_queue *q) +{ +} +#endif + +#endif /* __KERNEL__ */ + +#endif -- cgit v1.2.3-54-g00ecf From 7031a67c952ebc9c2b35735fb3e105f779e5701a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 17 May 2008 16:19:12 +0200 Subject: volume_id: bump version --- extras/volume_id/lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 0e1565f98a..0b6c727b98 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 83 +SHLIB_REV = 84 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) -- cgit v1.2.3-54-g00ecf From 7652450a0a21f9075ddc4325e29f38d57e0ca039 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 17 May 2008 16:19:46 +0200 Subject: Makefile: do not create udevcontrol, udevtrigger symlinks --- Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Makefile b/Makefile index cf8c1d1eed..eda9b2f778 100644 --- a/Makefile +++ b/Makefile @@ -258,9 +258,7 @@ install-bin: $(INSTALL) -d $(DESTDIR)$(sbindir) $(INSTALL_PROGRAM) udevd $(DESTDIR)$(sbindir)/udevd $(INSTALL_PROGRAM) udevadm $(DESTDIR)$(sbindir)/udevadm - ln -f -s udevadm $(DESTDIR)$(sbindir)/udevtrigger ln -f -s udevadm $(DESTDIR)$(sbindir)/udevsettle - ln -f -s udevadm $(DESTDIR)$(sbindir)/udevcontrol $(INSTALL) -d $(DESTDIR)$(usrbindir) ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrbindir)/udevinfo @extras="$(EXTRAS)"; for target in $$extras; do \ @@ -276,9 +274,7 @@ endif uninstall-bin: - rm -f $(DESTDIR)$(sbindir)/udevd - rm -f $(DESTDIR)$(sbindir)/udevadm - - rm -f $(DESTDIR)$(sbindir)/udevtrigger - rm -f $(DESTDIR)$(sbindir)/udevsettle - - rm -f $(DESTDIR)$(sbindir)/udevcontrol - rm -f $(DESTDIR)$(usrbindir)/udevinfo ifndef DESTDIR - killall udevd -- cgit v1.2.3-54-g00ecf From 4e548559bacf7a29fcdd2e5eb8a3ad8bfd5441fc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 17 May 2008 16:29:07 +0200 Subject: release 122 --- ChangeLog | 28 ++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 12 ++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dfe1c30854..23aa6b9c93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +Summary of changes from v121 to v122 +============================================ + +Hannes Reinecke (2): + scsi_id: remove all sysfs dependencies + scsi_id: add SGv4 support + +Karel Zak (1): + volume_id: clean up linux_raid code + +Kay Sievers (8): + scsi_id: update man page + scsi_id: remove bus_id option + scsi_id: add --sg-version= option + rules: adapt to new scsi_id + rules: adapt tape rules to new scsi_id + scsi_id: add bsg.h + volume_id: bump version + Makefile: do not create udevcontrol, udevtrigger symlinks + +MUNEDA Takahiro (2): + man: udevd- fix udev(8) reference + man: scsi_id + +Matthias Schwarzott (1): + cdrom_id: fix segfault + + Summary of changes from v120 to v121 ============================================ diff --git a/Makefile b/Makefile index eda9b2f778..9543ca2cc9 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 121 +VERSION = 122 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e9d4d9922b..b0d5349e17 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,15 @@ +udev 122 +======== +Bugfixes. + +The symlinks udevcontrol and udevtrigger are no longer installed by +the Makefile. + +The scsi_id program does not depend on sysfs anymore. It can speak +SGv4 now, so /dev/bsg/* device nodes can be used, to query SCSI device +data, which should solve some old problems with tape devices, where +we better do not open all tape device nodes to identify the device. + udev 121 ======== Many bugfixes. -- cgit v1.2.3-54-g00ecf From ff94cec3d71b5f46eb54645f4bc65e2d67ed5269 Mon Sep 17 00:00:00 2001 From: Erik van Konijnenburg Date: Mon, 19 May 2008 09:05:20 +0200 Subject: add substitution in MODE= field Do substitition processing in MODE field, similar to substitution in OWNER, GROUP etc fields. Add test case for normal and overflow behaviour. Document in manpage. --- test/udev-test.pl | 36 ++++++++++++++++++++++++++++++++---- udev.7 | 3 ++- udev.xml | 2 +- udev_rules.c | 5 ++++- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index fee62a6406..72b4aef6bc 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1617,6 +1617,27 @@ EOF KERNEL=="sda", MODE="0000" EOF }, + { + desc => "TEST PROGRAM feeds MODE", + subsys => "block", + devpath => "/block/sda", + exp_name => "sda", + exp_perms => "0:0:0400", + rules => < "TEST PROGRAM feeds MODE with overflow", + subsys => "block", + devpath => "/block/sda", + exp_name => "sda", + exp_perms => "0:0:0400", + rules => <{option}) && $rules->{option} eq "clean") { - system("rm -rf $udev_root"); - mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; + make_udev_root (); } } @@ -1818,8 +1847,7 @@ if (!($<==0)) { } # prepare -system("rm -rf $udev_root"); -mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; +make_udev_root (); # create config file open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; diff --git a/udev.7 b/udev.7 index 096bf38554..79e61ea9f4 100644 --- a/udev.7 +++ b/udev.7 @@ -307,7 +307,8 @@ The \fBSYMLINK\fR, \fBPROGRAM\fR, \fBOWNER\fR, -\fBGROUP\fR +\fBGROUP\fR, +\fBMODE\fR and \fBRUN\fR fields support simple printf\-like string substitutions\. The diff --git a/udev.xml b/udev.xml index ac3676e466..184457aa6c 100644 --- a/udev.xml +++ b/udev.xml @@ -462,7 +462,7 @@ The , , , - , and + , , and fields support simple printf-like string substitutions. The format chars gets applied after all rules have been processed, right before the program is executed. It allows the use of the complete environment set by earlier matching diff --git a/udev_rules.c b/udev_rules.c index 55a079be87..f4ee11a56c 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1412,7 +1412,10 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) if (!udev->mode_final && rule->mode.operation != KEY_OP_UNSET) { if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) udev->mode_final = 1; - udev->mode = strtol(key_val(rule, &rule->mode), NULL, 8); + char buf[20]; + strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); + udev_rules_apply_format(udev, buf, sizeof(buf)); + udev->mode = strtol(buf, NULL, 8); dbg("applied mode=%#o to '%s'\n", udev->mode, udev->dev->kernel); } if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { -- cgit v1.2.3-54-g00ecf From 834dfd55373494d33fa14f49992d95ed01ec1eaf Mon Sep 17 00:00:00 2001 From: Erik van Konijnenburg Date: Mon, 19 May 2008 09:07:20 +0200 Subject: Makefile: use udevdir in "make install" --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9543ca2cc9..e4392ca09a 100644 --- a/Makefile +++ b/Makefile @@ -266,7 +266,7 @@ install-bin: done; ifndef DESTDIR - killall udevd - - rm -rf /dev/.udev + - rm -rf $(udevdir)/.udev - $(sbindir)/udevd --daemon endif .PHONY: install-bin @@ -278,7 +278,7 @@ uninstall-bin: - rm -f $(DESTDIR)$(usrbindir)/udevinfo ifndef DESTDIR - killall udevd - - rm -rf /dev/.udev + - rm -rf $(udevdir)/.udev endif @extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ -- cgit v1.2.3-54-g00ecf From bc44071db2ea1f20d955e5f1310c8038e78abd73 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 20 May 2008 08:46:29 +0200 Subject: edd_id: call it only for sd* and hd* --- extras/edd_id/61-persistent-storage-edd.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/edd_id/61-persistent-storage-edd.rules b/extras/edd_id/61-persistent-storage-edd.rules index aed60db493..b430fe9fd8 100644 --- a/extras/edd_id/61-persistent-storage-edd.rules +++ b/extras/edd_id/61-persistent-storage-edd.rules @@ -1,6 +1,8 @@ # do not edit this file, it will be overwritten on update ACTION!="add", GOTO="persistent_storage_edd_end" +SUBSYSTEM!="block", GOTO="persistent_storage_edd_end" +KERNEL!="sd*|hd*", GOTO="persistent_storage_edd_end" # BIOS Enhanced Disk Device ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $tempnode" -- cgit v1.2.3-54-g00ecf From ea97dc3792642fa8187a339cc258f9a5a7df4523 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 20 May 2008 15:02:17 +0200 Subject: rename WAIT_FOR_SYSFS to WAIT_FOR and accept an absolute path This allows us to watch any file to appear, not only sysfs attributes. Files without a leading slash will be device sysfs attributes. The key WAIT_FOR_SYSFS still works for backwards compat, but is removed from the man page. --- udev.7 | 4 ++-- udev.xml | 5 ++--- udev_rules.c | 42 +++++++++++++++++++++++++----------------- udev_rules.h | 2 +- udev_rules_parse.c | 6 +++--- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/udev.7 b/udev.7 index 79e61ea9f4..a09bdf9ec7 100644 --- a/udev.7 +++ b/udev.7 @@ -257,9 +257,9 @@ and based on the executable bit of the file permissions\. .RE .PP -\fBWAIT_FOR_SYSFS\fR +\fBWAIT_FOR\fR .RS 4 -Wait for the specified sysfs file of the device to be created\. Can be used to fight against kernel sysfs timing issues\. +Wait for a file to become available\. .RE .PP \fBOPTIONS\fR diff --git a/udev.xml b/udev.xml index 184457aa6c..a7422e1ca0 100644 --- a/udev.xml +++ b/udev.xml @@ -394,10 +394,9 @@ - + - Wait for the specified sysfs file of the device to be created. Can be used - to fight against kernel sysfs timing issues. + Wait for a file to become available. diff --git a/udev_rules.c b/udev_rules.c index f4ee11a56c..a102e2da50 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -528,35 +528,40 @@ int udev_rules_run(struct udevice *udev) } #define WAIT_LOOP_PER_SECOND 50 -static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout) +static int wait_for_file(struct udevice *udev, const char *file, int timeout) { - char devicepath[PATH_SIZE]; char filepath[PATH_SIZE]; + char devicepath[PATH_SIZE] = ""; struct stat stats; int loop = timeout * WAIT_LOOP_PER_SECOND; - strlcpy(devicepath, sysfs_path, sizeof(devicepath)); - strlcat(devicepath, udev->dev->devpath, sizeof(devicepath)); - strlcpy(filepath, devicepath, sizeof(filepath)); - strlcat(filepath, "/", sizeof(filepath)); - strlcat(filepath, file, sizeof(filepath)); + /* a relative path is a device attribute */ + if (file[0] != '/') { + strlcpy(devicepath, sysfs_path, sizeof(devicepath)); + strlcat(devicepath, udev->dev->devpath, sizeof(devicepath)); - dbg("will wait %i sec for '%s'\n", timeout, filepath); + strlcpy(filepath, devicepath, sizeof(filepath)); + strlcat(filepath, "/", sizeof(filepath)); + strlcat(filepath, file, sizeof(filepath)); + file = filepath; + } + + dbg("will wait %i sec for '%s'\n", timeout, file); while (--loop) { /* lookup file */ - if (stat(filepath, &stats) == 0) { - info("file '%s' appeared after %i loops\n", filepath, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + if (stat(file, &stats) == 0) { + info("file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } /* make sure, the device did not disappear in the meantime */ - if (stat(devicepath, &stats) != 0) { - info("device disappeared while waiting for '%s'\n", filepath); + if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { + info("device disappeared while waiting for '%s'\n", file); return -2; } - info("wait for '%s' for %i mseconds\n", filepath, 1000 / WAIT_LOOP_PER_SECOND); + info("wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - info("waiting for '%s' failed\n", filepath); + info("waiting for '%s' failed\n", file); return -1; } @@ -1110,11 +1115,14 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) dbg("TEST key is true\n"); } - if (rule->wait_for_sysfs.operation != KEY_OP_UNSET) { + if (rule->wait_for.operation != KEY_OP_UNSET) { + char filename[PATH_SIZE]; int found; - found = (wait_for_sysfs(udev, key_val(rule, &rule->wait_for_sysfs), 10) == 0); - if (!found && (rule->wait_for_sysfs.operation != KEY_OP_NOMATCH)) + strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); + udev_rules_apply_format(udev, filename, sizeof(filename)); + found = (wait_for_file(udev, filename, 10) == 0); + if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) goto nomatch; } diff --git a/udev_rules.h b/udev_rules.h index da5ac3ea18..fe0f9dfbb5 100644 --- a/udev_rules.h +++ b/udev_rules.h @@ -84,7 +84,7 @@ struct udev_rule { struct key test; mode_t test_mode_mask; struct key run; - struct key wait_for_sysfs; + struct key wait_for; struct key label; struct key goto_label; diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 5119b7e84f..bdaf55bd48 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -495,8 +495,8 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena continue; } - if (strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { - add_rule_key(rule, &rule->wait_for_sysfs, operation, value); + if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { + add_rule_key(rule, &rule->wait_for, operation, value); valid = 1; continue; } @@ -629,7 +629,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena err("unknown key '%s' in %s:%u\n", key, filename, lineno); } - if (physdev && rule->wait_for_sysfs.operation == KEY_OP_UNSET) + if (physdev && rule->wait_for.operation == KEY_OP_UNSET) err("PHYSDEV* values are deprecated and will be removed from a future kernel, \n" "please fix it in %s:%u", filename, lineno); -- cgit v1.2.3-54-g00ecf From 2e6a862a4d0054e5370074803a6bac06aa0569b3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 20 May 2008 15:11:01 +0200 Subject: rules: tape rules - use bsg device nodes for SG_IO --- etc/udev/rules.d/60-persistent-storage-tape.rules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/etc/udev/rules.d/60-persistent-storage-tape.rules b/etc/udev/rules.d/60-persistent-storage-tape.rules index 45cac939fe..b524b47cae 100644 --- a/etc/udev/rules.d/60-persistent-storage-tape.rules +++ b/etc/udev/rules.d/60-persistent-storage-tape.rules @@ -12,7 +12,9 @@ SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" KERNEL=="st*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="st*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{BSG_DEV}="$root/bsg/$id" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", WAIT_FOR="$env{BSG_DEV}", IMPORT="scsi_id --whitelisted --export --device=$env{BSG_DEV}", ENV{ID_BUS}="scsi" + KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" -- cgit v1.2.3-54-g00ecf From 941d40a0747a4cbbb306ba597ff02bbbbb49df96 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 26 May 2008 17:11:13 +0200 Subject: rules: persistent net - handle "locally administered" ibmveth MAC addresses --- extras/rule_generator/75-persistent-net-generator.rules | 8 ++++---- udev_rules.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 2c42de0d78..75b4534af2 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -29,9 +29,6 @@ ENV{MATCHADDR}="$attr{address}" # match interface type ENV{MATCHIFTYPE}="$attr{type}" -# match interface dev_id -ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}" - # do not use "locally administered" MAC address ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" @@ -44,6 +41,9 @@ SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)" SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" +# ibmveth likes to use "locally administered" MAC addresses +DRIVERS=="ibmveth", ENV{MATCHADDR}="$attr{address}", ENV{COMMENT}="ibmveth ($id)" + # S/390 uses id matches only, do not use MAC address match SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID}="$id", ENV{MATCHDRV}="$driver", ENV{MATCHADDR}="" @@ -51,7 +51,7 @@ SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID} ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", GOTO="persistent_net_generator_end" # default comment -ENV{COMMENT}=="", ENV{COMMENT}="$env{SUBSYSTEM} device" +ENV{COMMENT}=="", ENV{COMMENT}="net device ($attr{driver})" # write rule DRIVERS=="?*", IMPORT{program}="write_net_rules" diff --git a/udev_rules.c b/udev_rules.c index a102e2da50..ea850a84c3 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -1101,7 +1101,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) attr_subst_subdir(filename, sizeof(filename)); match = (stat(filename, &statbuf) == 0); - info("'%s' %s", filename, match ? "exists" : "does not exist\n"); + info("'%s' %s", filename, match ? "exists\n" : "does not exist\n"); if (match && rule->test_mode_mask > 0) { match = ((statbuf.st_mode & rule->test_mode_mask) > 0); info("'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, -- cgit v1.2.3-54-g00ecf From 2aae673c967a16276c85726975cade2413b5307b Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 27 May 2008 00:51:17 +0200 Subject: volume_id: remove unnecessary global variable Signed-off-by: Karel Zak --- extras/volume_id/lib/ddf_raid.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c index 60837a48b1..2e83c08098 100644 --- a/extras/volume_id/lib/ddf_raid.c +++ b/extras/volume_id/lib/ddf_raid.c @@ -33,17 +33,18 @@ #define DDF_GUID_LENGTH 24 #define DDF_REV_LENGTH 8 -static struct ddf_header { +struct ddf_header { uint32_t signature; uint32_t crc; uint8_t guid[DDF_GUID_LENGTH]; uint8_t ddf_rev[DDF_REV_LENGTH]; -} PACKED *ddf; +} PACKED; int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) { uint64_t ddf_off = ((size / 0x200)-1) * 0x200; const uint8_t *buf; + struct ddf_header *ddf; info("probing at offset 0x%llx, size 0x%llx\n", (unsigned long long) off, (unsigned long long) size); -- cgit v1.2.3-54-g00ecf From b5254b42032b39e393f5c89102ca71c2b3fa0d11 Mon Sep 17 00:00:00 2001 From: Xinwei Hu Date: Tue, 27 May 2008 19:35:03 +0200 Subject: collect: realloc buffer, if needed --- extras/collect/collect.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 0a852f2db2..feb0e75768 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -271,7 +271,11 @@ static int missing(int fd) if (him->state == STATE_NONE) { ret++; } else { - sprintf(buf, "%s ", him->name); + while (strlen(him->name)+1 >= bufsize) { + bufsize = bufsize << 1; + buf = realloc(buf, bufsize); + } + snprintf(buf, strlen(him->name)+2, "%s ", him->name); write(fd, buf, strlen(buf)); } } -- cgit v1.2.3-54-g00ecf From bbf1599bb57795ba3a627b48c2c26589edc584c1 Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Wed, 28 May 2008 17:20:07 +0200 Subject: man: add NAME== match entry --- udev.7 | 5 +++++ udev.xml | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/udev.7 b/udev.7 index a09bdf9ec7..b27b65c365 100644 --- a/udev.7 +++ b/udev.7 @@ -105,6 +105,11 @@ Match the devpath of the event device\. Match the name of the event device\. .RE .PP +\fBNAME\fR +.RS 4 +Match the name of the node or network interface\. It can be used once the NAME key has been set in one of the preceding rules\. +.RE +.PP \fBSUBSYSTEM\fR .RS 4 Match the subsystem of the event device\. diff --git a/udev.xml b/udev.xml index a7422e1ca0..5eff452b77 100644 --- a/udev.xml +++ b/udev.xml @@ -159,6 +159,15 @@ + + + + Match the name of the node or network interface. It can + be used once the NAME key has been set in one of the preceding + rules. + + + -- cgit v1.2.3-54-g00ecf From 2f2f54c5142c8c56441f9b1b307848531a2f2148 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 28 May 2008 12:25:09 +0200 Subject: volume_id: enable GFS probing code, add LABEL support * enables GFS/GFS2 probing code (it's disabled now!) * adds support for LABELs -- it seems that locktable name is usable as a LABEL (at least according to libblkid). * removes extra check of sb_header.mh_format -- nothing in kernel and blkid checks this superblock entry. It seems that check GFS_MAGIC and GFS_METATYPE_SB is enough. Signed-off-by: Karel Zak --- extras/volume_id/README | 2 +- extras/volume_id/lib/gfs.c | 10 ++++++++-- extras/volume_id/lib/volume_id.c | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/extras/volume_id/README b/extras/volume_id/README index 217be3114c..01b4c446c6 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -40,7 +40,7 @@ minix * - - * ocfs (1, 2) * * * * vxfs * - - * nss (netware) * * * -gfs, gfs2 * - - - +gfs, gfs2 * * - - Raid members are detected to prevent the probing for a filesystem ----------------------------------------------------------------- diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c index 53382222ac..2cb16a8693 100644 --- a/extras/volume_id/lib/gfs.c +++ b/extras/volume_id/lib/gfs.c @@ -86,8 +86,7 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v return -1; if (be32_to_cpu(sbd->sb_header.mh_magic) == GFS_MAGIC && - be32_to_cpu(sbd->sb_header.mh_type) == GFS_METATYPE_SB && - be32_to_cpu(sbd->sb_header.mh_format) == GFS_FORMAT_SB) { + be32_to_cpu(sbd->sb_header.mh_type) == GFS_METATYPE_SB) { if (vers == 1) { if (be32_to_cpu(sbd->sb_fs_format) != GFS_FORMAT_FS || be32_to_cpu(sbd->sb_multihost_format) != GFS_FORMAT_MULTI) @@ -102,6 +101,13 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v } else return -1; + + if (strlen(sbd->sb_locktable)) { + uint8_t *label = (uint8_t *) sbd->sb_locktable; + + volume_id_set_label_raw(id, label, GFS_LOCKNAME_LEN); + volume_id_set_label_string(id, label, GFS_LOCKNAME_LEN); + } strcpy(id->type_version, "1"); volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); return 0; diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index bb909c9956..baeaa9f74e 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -70,6 +70,8 @@ static const struct prober prober_filesystem[] = { { volume_id_probe_hpfs, { "hpfs", } }, { volume_id_probe_sysv, { "sysv", "xenix", } }, { volume_id_probe_minix, { "minix", } }, + { volume_id_probe_gfs, { "gfs", } }, + { volume_id_probe_gfs2, { "gfs2", } }, { volume_id_probe_ocfs1, { "ocfs1", } }, { volume_id_probe_ocfs2, { "ocfs2", } }, { volume_id_probe_vxfs, { "vxfs", } }, -- cgit v1.2.3-54-g00ecf From 0f624f160954b465e3576cac8ed7128e213fda7a Mon Sep 17 00:00:00 2001 From: Xinwei Hu Date: Fri, 30 May 2008 09:43:58 +0200 Subject: udevd: export .udev/queue/$seqnum before .udev/uevent_seqnum --- udevd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udevd.c b/udevd.c index c895c1dc6a..d6977e9655 100644 --- a/udevd.c +++ b/udevd.c @@ -269,6 +269,9 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) msg->queue_time = time(NULL); + export_event_state(msg, EVENT_QUEUED); + info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); + strlcpy(filename, udev_root, sizeof(filename)); strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); @@ -281,9 +284,6 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) close(fd); } - export_event_state(msg, EVENT_QUEUED); - info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); - /* run one event after the other in debug mode */ if (debug_trace) { list_add_tail(&msg->node, &running_list); -- cgit v1.2.3-54-g00ecf From ec404619a6867d14adebe107a1ed74475ae2413f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 11 Jun 2008 23:24:13 +0200 Subject: cdrom_id: export ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=, ID_CDROM_MEDIA_TRACK_COUNT_DATA= Iterate over all tracks, instead of looking only at the first one for audio. Thanks to David! --- extras/cdrom_id/cdrom_id.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index e0cbe9e713..6d3326bd31 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -122,10 +122,11 @@ static unsigned int cd_media_mrw; static unsigned int cd_media_mrw_w; static const char *cd_media_state; -static unsigned int cd_media_has_audio; static unsigned int cd_media_session_next; static unsigned int cd_media_session_count; static unsigned int cd_media_track_count; +static unsigned int cd_media_track_count_data; +static unsigned int cd_media_track_count_audio; static unsigned long long int cd_media_session_last_offset; #define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) @@ -472,10 +473,6 @@ static int cd_media_toc(int fd) if (len < 8) return -1; - /* check if we have a data track */ - info("ctl %02x (0x04 is data/audio)\n", header[5]); - cd_media_has_audio = (header[5] & 0x04) == 0; - scsi_cmd_set(&sc, 0, 0x43); scsi_cmd_set(&sc, 6, header[2]); /* First Track/Session Number */ scsi_cmd_set(&sc, 7, len >> 8); @@ -489,9 +486,18 @@ static int cd_media_toc(int fd) for (p = toc+4, i = 4; i < len-8; i += 8, p += 8) { unsigned int block; + unsigned int is_data_track; + + is_data_track = (p[1] & 0x04) != 0; block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; - info("track %u starts at block %u\n", p[2], block); + info("track=%u info=0x%x(%s) start_block=%u\n", + p[2], p[1] & 0x0f, is_data_track ? "data":"audio", block); + + if (is_data_track) + cd_media_track_count_data++; + else + cd_media_track_count_audio++; } scsi_cmd_set(&sc, 0, 0x43); @@ -676,14 +682,16 @@ print: if (cd_media_state != NULL) printf("ID_CDROM_MEDIA_STATE=%s\n", cd_media_state); - if (cd_media_has_audio) - printf("ID_CDROM_MEDIA_HAS_AUDIO=1\n"); if (cd_media_session_next > 0) printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); if (cd_media_session_count > 0) printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); if (cd_media_track_count > 0) printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); + if (cd_media_track_count_audio) + printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); + if (cd_media_track_count_data) + printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); if (cd_media_session_last_offset) printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); exit: -- cgit v1.2.3-54-g00ecf From 1ecb0864600073a5d63c2298239cd04e7bf8d527 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 11 Jun 2008 23:26:18 +0200 Subject: scsi_id: retry open() on -EBUSY --- extras/scsi_id/scsi_serial.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index c5cacfa114..bea447fdac 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -819,18 +819,24 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, int page_code, char *serial_short, int len) { unsigned char page0[SCSI_INQ_BUFF_LEN]; - int fd; + int fd = -1; + int cnt = 10; int ind; int retval; memset(dev_scsi->serial, 0, len); dbg("opening %s\n", devname); - fd = open(devname, O_RDONLY | O_NONBLOCK); - if (fd < 0) { - info("%s: cannot open %s: %s\n", - dev_scsi->kernel, devname, strerror(errno)); - return 1; + while (--cnt) { + fd = open(devname, O_RDONLY | O_NONBLOCK); + if (fd >= 0) + break; + info("%s: cannot open %s: %s\n", dev_scsi->kernel, devname, strerror(errno)); + if (errno != EBUSY) + break; + usleep(500000 + (rand() % 100000) ); } + if (fd < 0) + return 1; if (page_code == PAGE_80) { if (do_scsi_page80_inquiry(dev_scsi, fd, dev_scsi->serial, serial_short, len)) { -- cgit v1.2.3-54-g00ecf From 0c6ecdfd9f7b7247d8f0258b6cb92aac9eccfb9b Mon Sep 17 00:00:00 2001 From: Erik van Konijnenburg Date: Wed, 11 Jun 2008 21:36:57 +0200 Subject: volume_id: support for oracleasm --- extras/volume_id/README | 1 + extras/volume_id/lib/Makefile | 1 + extras/volume_id/lib/libvolume_id.h | 1 + extras/volume_id/lib/oracleasm.c | 65 +++++++++++++++++++++++++++++++++++++ extras/volume_id/lib/volume_id.c | 1 + 5 files changed, 69 insertions(+) create mode 100644 extras/volume_id/lib/oracleasm.c diff --git a/extras/volume_id/README b/extras/volume_id/README index 01b4c446c6..0c5e37f969 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -41,6 +41,7 @@ ocfs (1, 2) * * * * vxfs * - - * nss (netware) * * * gfs, gfs2 * * - - +oracleasm * * - - Raid members are detected to prevent the probing for a filesystem ----------------------------------------------------------------- diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 0b6c727b98..67006dcf52 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -52,6 +52,7 @@ OBJS= \ vxfs.o \ squashfs.o \ netware.o \ + oracleasm.o \ volume_id.o \ util.o diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index 19aee68d01..6cce6e377d 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -119,6 +119,7 @@ extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64 extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_oracleasm(struct volume_id *id, uint64_t off, uint64_t size); /* bios raid */ extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); diff --git a/extras/volume_id/lib/oracleasm.c b/extras/volume_id/lib/oracleasm.c new file mode 100644 index 0000000000..0f5ff80cfb --- /dev/null +++ b/extras/volume_id/lib/oracleasm.c @@ -0,0 +1,65 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2004 Kay Sievers + * + * 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. + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "util.h" + +struct oracleasm_super_block { + uint8_t tag[8]; + uint8_t id[24]; +} PACKED; + +#define ASM_SB_OFF 0x20 +#define ASM_MAGIC "ORCLDISK" + +/* + * Detect Oracle Automatic Storage Management (ASM). + * It can do mirroring, but don't consider it RAID in the sense + * that an ext3 filesystem could live inside. Thus, mark it 'other'. + * There also is a magic word 'ORCLCLRD'; like blkid(8), we ignore that. + */ +int volume_id_probe_oracleasm(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + struct oracleasm_super_block *oracleasm; + + info("probing at offset 0x%llx\n", (unsigned long long) off); + + buf = volume_id_get_buffer(id, off + ASM_SB_OFF, 0x800); + if (buf == NULL) + return -1; + + oracleasm = (struct oracleasm_super_block *) buf; + + if (memcmp(oracleasm->tag, ASM_MAGIC, 8) != 0) + return -1; + + volume_id_set_usage(id, VOLUME_ID_OTHER); + volume_id_set_label_raw(id, oracleasm->id, 24); + volume_id_set_label_string(id, oracleasm->id, 24); + id->type = "oracleasm"; + + return 0; +} diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index baeaa9f74e..b247fe2ddb 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -77,6 +77,7 @@ static const struct prober prober_filesystem[] = { { volume_id_probe_vxfs, { "vxfs", } }, { volume_id_probe_squashfs, { "squashfs", } }, { volume_id_probe_netware, { "netware", } }, + { volume_id_probe_oracleasm, { "oracleasm", } }, }; /* the user can overwrite this log function */ -- cgit v1.2.3-54-g00ecf From 2c0644c1c2089763601f9f37d0be53711735612c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Jun 2008 00:08:43 +0200 Subject: release 123 --- ChangeLog | 30 ++++++++++++++++++++++++++++++ Makefile | 2 +- RELEASE-NOTES | 7 +++++++ extras/volume_id/lib/Makefile | 2 +- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23aa6b9c93..46bb7b4474 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +Summary of changes from v122 to v123 +============================================ + +Erik van Konijnenburg (3): + add substitution in MODE= field + Makefile: use udevdir in "make install" + volume_id: support for oracleasm + +Harald Hoyer (1): + scsi_id: retry open() on -EBUSY + +Karel Zak (2): + volume_id: remove unnecessary global variable + volume_id: enable GFS probing code, add LABEL support + +Kay Sievers (5): + edd_id: call it only for sd* and hd* + rename WAIT_FOR_SYSFS to WAIT_FOR and accept an absolute path + rules: tape rules - use bsg device nodes for SG_IO + rules: persistent net - handle "locally administered" ibmveth MAC addresses + cdrom_id: export ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=, ID_CDROM_MEDIA_TRACK_COUNT_DATA= + +Michal Soltys (1): + man: add NAME== match entry + +Xinwei Hu (2): + collect: realloc buffer, if needed + udevd: export .udev/queue/$seqnum before .udev/uevent_seqnum + + Summary of changes from v121 to v122 ============================================ diff --git a/Makefile b/Makefile index e4392ca09a..162e353c76 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 122 +VERSION = 123 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b0d5349e17..40de544eca 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,10 @@ +udev 123 +======== +Bugfixes. + +Tape drive id-data is queried from /dev/bsg/* instead of the tape +nodes. This avoids rewinding tapes on open(). + udev 122 ======== Bugfixes. diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 67006dcf52..96ee8f5150 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644 INSTALL_LIB = ${INSTALL} -m 755 SHLIB_CUR = 0 -SHLIB_REV = 84 +SHLIB_REV = 85 SHLIB_AGE = 0 SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) -- cgit v1.2.3-54-g00ecf From 9bbdf6eb3c0d84bf906176a51e4cda10882dadc6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Jun 2008 07:20:14 +0200 Subject: cdrom_id: fix recognition of blank media Thanks to David! --- extras/cdrom_id/cdrom_id.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 6d3326bd31..a1135665a9 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -470,9 +470,13 @@ static int cd_media_toc(int fd) info("READ TOC: len: %d\n", len); if (len > sizeof(toc)) return -1; - if (len < 8) + if (len < 2) return -1; + /* empty media has no tracks */ + if (len < 8) + return 0; + scsi_cmd_set(&sc, 0, 0x43); scsi_cmd_set(&sc, 6, header[2]); /* First Track/Session Number */ scsi_cmd_set(&sc, 7, len >> 8); -- cgit v1.2.3-54-g00ecf From c986ca557ddd2c98807edbd727cda6a20b234642 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Jun 2008 07:24:30 +0200 Subject: release 124 --- ChangeLog | 7 +++++++ Makefile | 2 +- RELEASE-NOTES | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 46bb7b4474..b9d1ac764a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Summary of changes from v123 to v124 +============================================ + +Kay Sievers (1): + cdrom_id: fix recognition of blank media + + Summary of changes from v122 to v123 ============================================ diff --git a/Makefile b/Makefile index 162e353c76..075389b6ea 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 123 +VERSION = 124 # set this to make use of syslog USE_LOG = true diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 40de544eca..d82b7bcb72 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,7 @@ +udev 124 +======== +Fix cdrom_id to properly recognize blank media. + udev 123 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 322fc7a636296ba9a3f93912661f14c65c2af4b2 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Wed, 18 Jun 2008 00:47:33 +0200 Subject: collect: check realloc return value --- extras/collect/collect.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/extras/collect/collect.c b/extras/collect/collect.c index feb0e75768..9fb6737d9b 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -53,7 +53,7 @@ static LIST_HEAD(bunch); static int debug; /* This can increase dynamically */ -static int bufsize = BUFSIZE; +static size_t bufsize = BUFSIZE; static void sig_alrm(int signo) { @@ -272,8 +272,15 @@ static int missing(int fd) ret++; } else { while (strlen(him->name)+1 >= bufsize) { + char *tmpbuf; + bufsize = bufsize << 1; - buf = realloc(buf, bufsize); + tmpbuf = realloc(buf, bufsize); + if (!tmpbuf) { + free(buf); + return -1; + } + buf = tmpbuf; } snprintf(buf, strlen(him->name)+2, "%s ", him->name); write(fd, buf, strlen(buf)); -- cgit v1.2.3-54-g00ecf From 7c389ce8a098fa02c93890205d715ecef6024c3e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 18 Jun 2008 10:12:14 +0200 Subject: collect: fix size_t printf --- extras/collect/collect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 9fb6737d9b..ce49b9f410 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -147,7 +147,7 @@ static int checkout(int fd) if (!ptr && word < (buf + len)) { bufsize = bufsize << 1; if (debug) - fprintf(stderr, "ID overflow, restarting with size %d\n", bufsize); + fprintf(stderr, "ID overflow, restarting with size %zi\n", bufsize); free(buf); lseek(fd, 0, SEEK_SET); goto restart; -- cgit v1.2.3-54-g00ecf From dad1f0924be4ccd7e09ac59237b05ccc354ceb1d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 Jun 2008 13:25:31 +0200 Subject: path_id: suppress trailing '-' like 'ID_PATH=pci-0000:05:01.0-' --- extras/path_id/path_id | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 7a37700289..0fad30cfb2 100755 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -95,7 +95,11 @@ handle_pci () { ;; esac done - d="pci-$pci_id-$d" + if [ "$d" ]; then + d="pci-$pci_id-$d" + else + d="pci-$pci_id" + fi D="$host_dev_path" RESULT=0 } -- cgit v1.2.3-54-g00ecf From ec9611ddb50eba7e38a77372ff1d5137f491144a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 Jun 2008 17:28:13 +0200 Subject: rules: add v4l persistent links Maybe we will have this working, finally. Thanks to Kees and Brandon. --- etc/udev/rules.d/60-persistent-v4l.rules | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 etc/udev/rules.d/60-persistent-v4l.rules diff --git a/etc/udev/rules.d/60-persistent-v4l.rules b/etc/udev/rules.d/60-persistent-v4l.rules new file mode 100644 index 0000000000..0d673ab396 --- /dev/null +++ b/etc/udev/rules.d/60-persistent-v4l.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="persistent_v4l_end" +SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" + +# check for valid "index" number +TEST!="index", GOTO="persistent_v4l_end" +ATTR{index}!="?*", GOTO="persistent_v4l_end" + +IMPORT{program}="path_id %p" +ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" +ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" + +LABEL="persistent_v4l_end" -- cgit v1.2.3-54-g00ecf From 8bf875ff282e683e80849113c87660c7b2a0e772 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 Jun 2008 18:12:50 +0200 Subject: docs: update some docs and delete outdated stuff --- docs/README-gcov_for_udev | 34 ++------ docs/overview | 102 ------------------------ docs/udev_vs_devfs | 192 ---------------------------------------------- 3 files changed, 6 insertions(+), 322 deletions(-) delete mode 100644 docs/overview delete mode 100644 docs/udev_vs_devfs diff --git a/docs/README-gcov_for_udev b/docs/README-gcov_for_udev index c223dc38e8..5acb53a27c 100644 --- a/docs/README-gcov_for_udev +++ b/docs/README-gcov_for_udev @@ -14,37 +14,19 @@ With that said, here is how to get code coverage analysis for udev files. Note that this was developed with udev version 024. - Make sure you've installed udev and that it is working properly. - If you are having problems, refer to the README and HOWTO-udev_for_dev - documents in udev tarball. - -- execute make_gcov.sh from udev top level directory +- Build udev with: make gcov-all - - This will compile udev with gcov support. Basically make_gcov.sh will - run make but override the CFLAGS. It strips any optimization from - CFLAGS in order for gcov to get correct code coverage analysis. It will - also add the -fprofile-arcs and -ftest-coverage options which are the - necessary flags needed to use gcov. - - If you look into your udev directory and see that it has been polluted with - a bunch of *.gcno, *.gcda and *.gcov files. gcov creates and uses these files - to extract the code coverage info. - -- After running make_gcov.sh you need to install udev again. So basically, - - su to root - make install + This will compile udev with gcov support. If you look into your udev directory + and see that it has been polluted with a bunch of *.gcno, *.gcda and *.gcov files. + gcov creates and uses these files to extract the code coverage info. - Then execute some udev tasks. You can run some udev tests, reboot, or do anything your little udev heart desires. Once you are satisfied, you can now see how much udev code was covered. I personally recommend just running test/udev-test.pl for starters. -- To get the udev code coverage analysis, execute run_gcov.sh from udev top - level directory. You need to be root to do this. - - su to root +- To get the udev code coverage analysis: make udev_gcov.txt - This creates udev_gcov.txt in the udev top level directory which holds all @@ -83,8 +65,4 @@ Note that this was developed with udev version 024. - Once you are done with using gcov for udev and want to return to your normal use of udev, run a regular 'make clean' on your udev directory. - Then just run a regular make and make install and you are back to normal: - - make clean all - su to root - make install + Then just run a regular make and make install and you are back to normal. diff --git a/docs/overview b/docs/overview deleted file mode 100644 index 87c1d1df10..0000000000 --- a/docs/overview +++ /dev/null @@ -1,102 +0,0 @@ -------------------------------------------------------------------------- - This is a proposal from the early days of udev. A lot of the things - mentioned here are implemented differently and most of the features - implemented in udev are not part of that document. - This document is only kept in the tree for sentimental reasons. -------------------------------------------------------------------------- - -We've got a couple of goals for udev: - -1) dynamic replacement for /dev -2) device naming -3) API to access info about current system devices - -Splitting these goals into separate subsystems: - -1) udev - dynamic replacement for /dev -2) namedev - device naming -3) libsysfs - a standard library for accessing device information on the - system. - -Udev ------- - -Udev will be responsible for responding to /sbin/hotplug on device -events. It will receive the device class information along with -device's sysfs directory. Udev will call the name_device function from -the naming device subsystem with that information and receive a unique -device name in return. Udev will then query sysfs through the libsysfs -for specific device information required for creating the /dev node like -major and minor number. Once it has the important information, udev -will create a /dev entry for the device, add the device to the in memory -table of current devices, and send notification of the successful event -through a D-BUS message. On a remove call, udev will remove the /dev -entry, remove the device from the in memory table, and send -notification. - -Udev will consist of a command udev - to be called from /sbin/hotplug. -It will require the in memory dynamic database/table for keeping track -of current system devices, and a library of routines for accessing that -database/table. Udev will not care about "how" devices are named, that -will be separated into the device naming subsystem. It's presented a -common device naming API by the device naming subsystem to use for -naming devices. - - - -namedev ----------- - -From comments people have made, the device naming part of udev has been -pushed into its own "subsystem". The reason is to make this as flexible -and pluggable as possible. The device naming subsystem, or namedev, will -present a standard interface for udev to call for naming a particular -device. Under that interface, system administrators can plug in their -own methods for device naming. - -We would provide a default naming scheme. The first prototype -implementation could simply take the sysfs directory passed in with the -device name function, query sysfs for the major and minor numbers, and -then look up in a static device name mapping file the name of the -device. The static device naming file could look just like devices.txt -in the Linux kernel's Documentation directory. Obviously, this isn't a -great implementation because eventually we'd like major an minor numbers -to be dynamic. - -The default naming scheme in the future would have a set of policies to -go through in order to determine the name of the device. The device -naming subsystem would get the sysfs directory of the to be named device -and would use the following information in order to map the device's -name: - -1) Label info - like SCSI's UUID -2) Bus Device Number -3) Topology on Bus -4) Kernel Name - DEFAULT - -System administrators could use the default naming system or enterprise -computing environments could plug in their Universal Unique Identifier -(UUID) policies. The idea is to make the device naming as flexible and -pluggable as possible. - -The device naming subsystem would require accessing sysfs for device -information. It will receive the device's sysfs directory in the call -from udev and use it to get more information to determine naming. The -namedev subsystem will include a standard naming API for udev to use. -The default naming scheme will include a set of functions and a static -device naming file, which will reside in /etc or /var. - - - -libsysfs --------- - -There is a need for a common API to access device information in sysfs. -The device naming subsystem and the udev subsystem need to take the -sysfs directory path and query device information. Instead of copying -code so each one will have to readdir, etc., splitting this logic of -sysfs calls into a separate library that will sit atop sysfs makes more -sense. Sysfs callbacks aren't standard across devices, so this is -another reason for creating a common and standard library interface for -querying device information. - diff --git a/docs/udev_vs_devfs b/docs/udev_vs_devfs deleted file mode 100644 index 9e803ca309..0000000000 --- a/docs/udev_vs_devfs +++ /dev/null @@ -1,192 +0,0 @@ - udev and devfs - The final word - - December 30, 2003 - Greg Kroah-Hartman - - - -Executive summary for those too lazy to read this whole thing: - I don't care about devfs, and I don't want to talk about it at - all anymore. If you love devfs, fine, I'm not trying to tell - anyone what to do. But you really should be looking into using - udev instead. All further email messages sent to me about devfs - will be gladly ignored. - - -First off, some background. For a description of udev, and what its -original design goals were, please see the OLS 2003 paper on udev, -available at: - -and the slides for the talk, available at: - -The OLS paper can also be found in the docs/ directory of the udev -tarball, available on kernel.org in the /pub/linux/utils/kernel/hotplug/ -directory. - -In that OLS paper, I described the current situation of a static /dev -and the current problems that a number of people have with it. I also -detailed how devfs tries to solve a number of these problems. In -hindsight, I should have never mentioned the word "devfs" when talking -about udev. I did so only because it seemed like a good place to start -with. Most people understood what devfs is, and what it does. To -compare udev against it, showing how udev was more powerful, and a more -complete solution to the problems people were having, seemed like a -natural comparison to me. - -But no more. I hereby never want to compare devfs and udev again. With -the exception of this message... - -The Problems: - 1) A static /dev is unwieldy and big. It would be nice to only show - the /dev entries for the devices we actually have running in the - system. - 2) We are (well, were) running out of major and minor numbers for - devices. - 3) Users want a way to name devices in a persistent fashion (i.e. "This - disk here, must _always_ be called "boot_disk" no matter where in - the scsi tree I put it", or "This USB camera must always be called - "camera" no matter if I have other USB scsi devices plugged in or - not.") - 4) Userspace programs want to know when devices are created or removed, - and what /dev entry is associated with them. - -The constraints: - 1) No policy in the kernel! - 2) Follow standards (like the LSB) - 3) must be small so embedded devices will use it. - - -So, how does devfs stack up to the above problems and constraints: - Problems: - 1) devfs only shows the dev entries for the devices in the system. - 2) devfs does not handle the need for dynamic major/minor numbers - 3) devfs does not provide a way to name devices in a persistent - fashion. - 4) devfs does provide a deamon that userspace programs can hook into - to listen to see what devices are being created or removed. - Constraints: - 1) devfs forces the devfs naming policy into the kernel. If you - don't like this naming scheme, tough. - 2) devfs does not follow the LSB device naming standard. - 3) devfs is small, and embedded devices use it. However it is - implemented in non-pagable memory. - -Oh yeah, and there are the insolvable race conditions with the devfs -implementation in the kernel, but I'm not going to talk about them right -now, sorry. See the linux-kernel archives if you care about them (and -if you use devfs, you should care...) - -So devfs is 2 for 7, ignoring the kernel races. - -And now for udev: - Problems: - 1) using udev, the /dev tree only is populated for the devices that - are currently present in the system. - 2) udev does not care about the major/minor number schemes. If the - kernel tomorrow switches to randomly assign major and minor numbers - to different devices, it would work just fine (this is exactly - what I am proposing to do in 2.7...) - 3) This is the main reason udev is around. It provides the ability - to name devices in a persistent manner. More on that below. - 4) udev emits D-BUS messages so that any other userspace program - (like HAL) can listen to see what devices are created or removed. - It also allows userspace programs to query its database to see - what devices are present and what they are currently named as - (providing a pointer into the sysfs tree for that specific device - node.) - Constraints: - 1) udev moves _all_ naming policies out of the kernel and into - userspace. - 2) udev defaults to using the LSB device naming standard. If users - want to deviate away from this standard (for example when naming - some devices in a persistent manner), it is easily possible to do - so. - 3) udev is small and is entirely in userspace, which - is swapable, and doesn't have to be running at all times. - -Nice, 7 out of 7 for udev. Makes you think the problems and constraints -were picked by a udev developer, right? No, the problems and -constraints are ones I've seen over the years and so udev, along with -the kernel driver model and sysfs, were created to solve these real -problems. I also have had the luxury to see the problems that the -current devfs implementation has, and have taken the time to work out -something that does not have those same problems. - -So by just looking at the above descriptions, everyone should instantly -realize that udev is far better than devfs and start helping out udev -development, right? Oh, you want more info, ok... - -Back in May 2003 I released a very tiny version of udev that implemented -everything that devfs currently does, in about 6Kb of userspace code: - http://marc.theaimsgroup.com/?l=linux-kernel&m=105003185331553 - -Yes, that's right, 6Kb. So, you are asking, why are you still working -on udev if it did everything devfs did back in May 2003? That's because -just managing static device nodes based on what the kernel calls the -devices is _not_ the primary goal of udev. It's just a tiny side effect -of its primary goal, the ability to never worry about major/minor -number assignments and provide the ability to achieve persistent device -names if wanted. - -All the people wanting to bring up the udev vs. devfs argument go back -and read the previous paragraph. Yes, all Gentoo users who keep filling -up my inbox with smoking emails, I mean you. - -So, how well does udev solve its goals: - Prevent users from ever worrying about major/minor numbers - And here you were, not knowing you ever needed to worry about - major/minor numbers in the first place, right? Ah, I see you - haven't plugged in 2 USB printers and tried to figure out which - printer was which /dev entry? Or plugged in 4000 SCSI disks and - tried to figure out how to access that 3642nd disk and what it was - called in /dev. Or plugged in a USB camera and a USB flash drive - and then tried to download the pictures off of the flash drive by - accident? - - As the above scenarios show, both desktop users and big iron users - both need to not worry about which device is assigned to what - major/minor device. - - udev doesn't care what major/minor number is assigned to a device. - It merely takes the numbers that the kernel says it assigned to the - device and creates a device node based on it, which the user can - then use (if you don't understand the whole major/minor to device - node issue, or even what a device node is, trust me, you don't - really want to, go install udev and don't worry about it...) As - stated above, if the kernel decides to start randomly assigning - major numbers to all devices, then udev will still work just fine. - - Provide a persistent device naming solution: - Lots of people want to assign a specific name that they can talk to - a device to, no matter where it is in the system, or what order they - plugged the device in. USB printers, SCSI disks, PCI sound cards, - Firewire disks, USB mice, and lots of other devices all need to be - assigned a name in a consistent manner (udev doesn't handle network - devices, naming them is already a solved solution, using nameif). - udev allows users to create simple rules to describe what device to - name. If users want to call a program running a large database - half-way around the world, asking it what to name this device, it - can. We don't put the naming database into the kernel (like other - Unix variants have), everything is in userspace, and easily - accessible. You can even run a perl script to name your device if - you are that crazy... - - For more information on how to create udev rules to name devices, - please see the udev man page, and look at the example udev rules - that ship with the tarball. - - -So, convinced already why you should use udev instead of devfs? No. -Ok, fine, I'm not forcing you to abandon your bloated, stifling policy, -nonextensible, end of life feature if you don't want to. But please -don't bother me about it either, I don't care about devfs, only about -udev. - -This is my last posting about this topic, all further emails sent to me -about why devfs is wonderful, and why are you making fun of this -wonderful, stable gift from the gods, will be gleefully ignored and -possibly posted in a public place where others can see. - -thanks, - -greg k-h -- cgit v1.2.3-54-g00ecf From 01e8dd08ef317175d8299ef4cbe24802de80770a Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Wed, 2 Jul 2008 10:20:58 +0200 Subject: man: clarify $attr{} parent searching --- udev.7 | 2 +- udev.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/udev.7 b/udev.7 index b27b65c365..e7de82ea07 100644 --- a/udev.7 +++ b/udev.7 @@ -357,7 +357,7 @@ and .PP \fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR .RS 4 -The value of a sysfs attribute found at the device, where all keys of the rule have matched\. If the matching device does not have such an attribute, all devices along the chain of parents are searched for a matching attribute\. If the attribute is a symlink, the last element of the symlink target is returned as the value\. +The value of a sysfs attribute found at the device, where all keys of the rule have matched\. If the matching device does not have such an attribute, follow the chain of parent devices and use the value of the first attribute that matches\. If the attribute is a symlink, the last element of the symlink target is returned as the value\. .RE .PP \fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR diff --git a/udev.xml b/udev.xml index 5eff452b77..7fefe48a44 100644 --- a/udev.xml +++ b/udev.xml @@ -522,8 +522,8 @@ The value of a sysfs attribute found at the device, where all keys of the rule have matched. If the matching device does not have - such an attribute, all devices along the chain of parents are searched - for a matching attribute. + such an attribute, follow the chain of parent devices and use the value + of the first attribute that matches. If the attribute is a symlink, the last element of the symlink target is returned as the value. -- cgit v1.2.3-54-g00ecf From 24dabba541060c85d69f4a59f05523f545018f57 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Jul 2008 11:18:49 +0200 Subject: scsi_id: fix fallback to sg v3 for sg nodes --- extras/scsi_id/scsi_serial.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index bea447fdac..7f756954e2 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -308,8 +308,6 @@ static int scsi_inquiry(struct scsi_id_device *dev_scsi, int fd, unsigned char inq_cmd[INQUIRY_CMDLEN] = { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; unsigned char sense[SENSE_BUFF_LEN]; - struct sg_io_hdr io_hdr; - struct sg_io_v4 io_v4; void *io_buf; int retval; int retry = 3; /* rather random */ @@ -323,6 +321,8 @@ resend: dbg("%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); if (dev_scsi->use_sg == 4) { + struct sg_io_v4 io_v4; + memset(&io_v4, 0, sizeof(struct sg_io_v4)); io_v4.guard = 'Q'; io_v4.protocol = BSG_PROTOCOL_SCSI; @@ -335,6 +335,8 @@ resend: io_v4.din_xferp = (uintptr_t)buf; io_buf = (void *)&io_v4; } else { + struct sg_io_hdr io_hdr; + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); io_hdr.interface_id = 'S'; io_hdr.cmd_len = sizeof(inq_cmd); @@ -349,7 +351,7 @@ resend: } if (ioctl(fd, SG_IO, io_buf) < 0) { - if (errno == EINVAL && dev_scsi->use_sg == 4) { + if ((errno == EINVAL || errno == ENOSYS) && dev_scsi->use_sg == 4) { dev_scsi->use_sg = 3; goto resend; } @@ -776,10 +778,10 @@ static int do_scsi_page80_inquiry(struct scsi_id_device *dev_scsi, int fd, int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) { - int retval; int fd; unsigned char buf[SCSI_INQ_BUFF_LEN]; struct stat statbuf; + int err = 0; dbg("opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); @@ -792,15 +794,16 @@ int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) if (fstat(fd, &statbuf) < 0) { info("scsi_id: cannot stat %s: %s\n", devname, strerror(errno)); - return 2; + err = 2; + goto out; } sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev), minor(statbuf.st_rdev)); memset(buf, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); - if (retval < 0) - return retval; + err = scsi_inquiry(dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); + if (err < 0) + goto out; memcpy(dev_scsi->vendor, buf + 8, 8); dev_scsi->vendor[8] = '\0'; @@ -810,9 +813,9 @@ int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) dev_scsi->revision[4] = '\0'; sprintf(dev_scsi->type,"%x", buf[0] & 0x1f); +out: close(fd); - - return 0; + return err; } int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, @@ -922,8 +925,8 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, goto completed; } retval = 1; + completed: - if (close(fd) < 0) - info("%s: close failed: %s\n", dev_scsi->kernel, strerror(errno)); + close(fd); return retval; } -- cgit v1.2.3-54-g00ecf From 66e056f5e7fcaa9cfe7a0c84fe1dbb7f6e96ec2f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Jul 2008 11:20:02 +0200 Subject: rules: fix cciss rules for partition numbers > 9 --- etc/udev/rules.d/60-persistent-storage.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index b7c4337f4c..0299cdfd44 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -34,9 +34,9 @@ KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" -KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" -KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # libata compat (links like hd*) KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" -- cgit v1.2.3-54-g00ecf From 9d2a06d7c6a1a818e42dd95f79b01f7e91a59098 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Jul 2008 11:20:46 +0200 Subject: udev.conf: udevcontrol -> udevadm control Thanks to Marco for pointing that out. --- etc/udev/udev.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/udev/udev.conf b/etc/udev/udev.conf index 41902c4f06..e6ef0814bf 100644 --- a/etc/udev/udev.conf +++ b/etc/udev/udev.conf @@ -2,6 +2,6 @@ # The initial syslog(3) priority: "err", "info", "debug" or its # numerical equivalent. For runtime debugging, the daemons internal -# state can be changed with: "udevcontrol log_priority=". +# state can be changed with: "udevadm control --log_priority=". udev_log="err" -- cgit v1.2.3-54-g00ecf From 03effd3bc9967da27db865ccb6480a805701b09f Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 7 Jul 2008 14:32:33 +0200 Subject: rules_generator: net rules - do not print error if file is missing and ignore commented rules Fix an error message displayed by write_net_rules when the rules file does not exist yet. (See Debian bugs #442796 and #475699.) Ignore commented rules, at least for the easy case. For clarity, use extended instead of standard regular expressions. --- extras/rule_generator/rule_generator.functions | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index 495bb7b047..aaf66a6fa0 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -92,6 +92,10 @@ find_all_rules() { local linkre="$2" local match="$3" - local search='.*[[:space:],]'"$key"'"\('"$linkre"'\)"[[:space:]]*\(,.*\|\\\|\)$' - echo $(sed -n -e "${match}s/${search}/\1/p" $RO_RULES_FILE $RULES_FILE 2>/dev/null) + local search='[[:space:],]'"$key"'"('"$linkre"')"[[:space:]]*(,.*|\\|)$' + + echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \ + $RO_RULES_FILE \ + $([ -e $RULES_FILE ] && echo $RULES_FILE) \ + 2>/dev/null) } -- cgit v1.2.3-54-g00ecf From 3c35425071caa4379ebeeed2680f35829bbfd9a8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Jul 2008 23:50:46 +0200 Subject: rules: use consistently OPTIONS+= Thanks to Marco for the pointer. --- etc/udev/packages/64-md-raid.rules | 2 +- etc/udev/rules.d/50-udev-default.rules | 14 +++++++------- etc/udev/suse/64-device-mapper.rules | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/etc/udev/packages/64-md-raid.rules b/etc/udev/packages/64-md-raid.rules index b8baea207f..d0510b3095 100644 --- a/etc/udev/packages/64-md-raid.rules +++ b/etc/udev/packages/64-md-raid.rules @@ -15,7 +15,7 @@ ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" IMPORT{program}="vol_id --export $tempnode" -OPTIONS="link_priority=100" +OPTIONS+="link_priority=100" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules index d201b05608..718d1899f5 100644 --- a/etc/udev/rules.d/50-udev-default.rules +++ b/etc/udev/rules.d/50-udev-default.rules @@ -1,12 +1,12 @@ # do not edit this file, it will be overwritten on update -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS="last_rule" -KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS="last_rule" -KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", OPTIONS="last_rule" -KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty", OPTIONS="last_rule" -KERNEL=="console", MODE="0600", OPTIONS="last_rule" +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" +KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS+="last_rule" +KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS+="last_rule" +KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", OPTIONS+="last_rule" +KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty", OPTIONS+="last_rule" +KERNEL=="console", MODE="0600", OPTIONS+="last_rule" # serial KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules index c6142ea115..b065aec554 100644 --- a/etc/udev/suse/64-device-mapper.rules +++ b/etc/udev/suse/64-device-mapper.rules @@ -15,8 +15,8 @@ ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end" ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" IMPORT{program}="vol_id --export $tempnode" -OPTIONS="link_priority=-100" -ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS="link_priority=-90" +OPTIONS+="link_priority=-100" +ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" -- cgit v1.2.3-54-g00ecf From 629e57e0d49a768f8c1e02645d81919aeace78e7 Mon Sep 17 00:00:00 2001 From: Thomas Koeller Date: Tue, 8 Jul 2008 00:12:02 +0200 Subject: scsi_id: include sys/stat.h I could not build scsi_id because of a missing #include for sys/stat.h, so I had to add that. Signed-off-by: Thomas Koeller --- extras/scsi_id/scsi_serial.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 7f756954e2..8f160306bd 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include -- cgit v1.2.3-54-g00ecf From ca1ac34daac81f88ae1bbfc332a7b3d982e968ea Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Thu, 10 Jul 2008 00:06:06 +0200 Subject: man: add link_priority default value --- udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.xml b/udev.xml index 7fefe48a44..e198679968 100644 --- a/udev.xml +++ b/udev.xml @@ -438,7 +438,7 @@ Specify the priority of the created symlinks. Devices with higher - priorities overwrite existing symlinks of other devices. + priorities overwrite existing symlinks of other devices. The default is 0. -- cgit v1.2.3-54-g00ecf From 52b375bc3bf07e4901b09707b05ee380bf6680bb Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Thu, 10 Jul 2008 00:17:24 +0200 Subject: scsi_id: man page fix minus signs need to be escaped and the program is not in the $PATH anymore --- extras/scsi_id/scsi_id.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 725b7d5317..4656e6889e 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -33,7 +33,7 @@ by page 0x80. For example: .sp .nf -# scsi_id --page=0x80 --devpath=/block/sdg +# /lib/udev/scsi_id \-\-page=0x80 \-\-whitelisted \-\-device=/dev/sda SIBM 3542 1T05078453 .fi .P @@ -45,7 +45,7 @@ identifier starts with the NAA value of 6): .sp .nf -# scsi_id --page=0x83 --devpath=/block/sdg +# /lib/udev/scsi_id \-\-page=0x83 \-\-whitelisted \-\-device=/dev/sda 3600a0b80000b174b000000d63efc5c8c .fi .P -- cgit v1.2.3-54-g00ecf From 05364975aff0bfaca1b5fb23963cee7d2201f99a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Jul 2008 22:22:10 +0200 Subject: scsi_id: the fallback fix broke error handling --- extras/scsi_id/scsi_id.c | 2 +- extras/scsi_id/scsi_serial.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 5eb95e890d..bc942fac58 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -551,7 +551,7 @@ static int set_inq_values(struct scsi_id_device *dev_scsi, const char *path) retval = scsi_std_inquiry(dev_scsi, path); if (retval) - return retval; + return retval; set_str(vendor_str, dev_scsi->vendor, sizeof(vendor_str)); set_str(model_str, dev_scsi->model, sizeof(model_str)); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 8f160306bd..016075c3ea 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -351,13 +351,13 @@ resend: io_buf = (void *)&io_hdr; } - if (ioctl(fd, SG_IO, io_buf) < 0) { + retval = ioctl(fd, SG_IO, io_buf); + if (retval < 0) { if ((errno == EINVAL || errno == ENOSYS) && dev_scsi->use_sg == 4) { dev_scsi->use_sg = 3; goto resend; } info("%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); - retval = -1; goto error; } @@ -806,6 +806,7 @@ int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) if (err < 0) goto out; + err = 0; memcpy(dev_scsi->vendor, buf + 8, 8); dev_scsi->vendor[8] = '\0'; memcpy(dev_scsi->model, buf + 16, 16); -- cgit v1.2.3-54-g00ecf From a2e657ff2638dfa0a840f58c6b227a410bb69101 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Jul 2008 23:53:54 +0200 Subject: man: rebuild from xml --- udev.7 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev.7 b/udev.7 index e7de82ea07..4bf625df6d 100644 --- a/udev.7 +++ b/udev.7 @@ -288,7 +288,7 @@ Do not remove the device node when the device goes away\. This may be useful as .PP \fBlink_priority=\fR\fB\fIvalue\fR\fR .RS 4 -Specify the priority of the created symlinks\. Devices with higher priorities overwrite existing symlinks of other devices\. +Specify the priority of the created symlinks\. Devices with higher priorities overwrite existing symlinks of other devices\. The default is 0\. .RE .PP \fBall_partitions\fR -- cgit v1.2.3-54-g00ecf From 0cd9f451ab8475e5a2b5c2aa53ed01e611eb8e9c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Jul 2008 23:54:28 +0200 Subject: do not touch node ownership and permissions, if already correct In some cases "change" events reapplied node permissions which changed applied ACL's. So, preserve permissions if already correct. --- udev_node.c | 82 +++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/udev_node.c b/udev_node.c index 0e59e2dbc9..78b6747043 100644 --- a/udev_node.c +++ b/udev_node.c @@ -39,7 +39,8 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m { char file_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; struct stat stats; - int retval = 0; + int preserve = 0; + int err = 0; if (major(devt) != 0 && strcmp(udev->dev->subsystem, "block") == 0) mode |= S_IFBLK; @@ -47,56 +48,61 @@ int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t m mode |= S_IFCHR; if (lstat(file, &stats) == 0) { - if ((stats.st_mode & S_IFMT) == (mode & S_IFMT) && (stats.st_rdev == devt)) { + if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devt)) { info("preserve file '%s', because it has correct dev_t\n", file); - selinux_setfilecon(file, udev->dev->kernel, stats.st_mode); - goto perms; + preserve = 1; + selinux_setfilecon(file, udev->dev->kernel, mode); + } else { + info("atomically replace existing file '%s'\n", file); + strlcpy(file_tmp, file, sizeof(file_tmp)); + strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); + unlink(file_tmp); + selinux_setfscreatecon(file_tmp, udev->dev->kernel, mode); + err = mknod(file_tmp, mode, devt); + selinux_resetfscreatecon(); + if (err != 0) { + err("mknod(%s, %#o, %u, %u) failed: %s\n", + file_tmp, mode, major(devt), minor(devt), strerror(errno)); + goto exit; + } + err = rename(file_tmp, file); + if (err != 0) { + err("rename(%s, %s) failed: %s\n", + file_tmp, file, strerror(errno)); + unlink(file_tmp); + } } } else { + info("mknod(%s, %#o, (%u,%u))\n", file, mode, major(devt), minor(devt)); selinux_setfscreatecon(file, udev->dev->kernel, mode); - retval = mknod(file, mode, devt); + err = mknod(file, mode, devt); selinux_resetfscreatecon(); - if (retval == 0) - goto perms; - } - - info("atomically replace '%s'\n", file); - strlcpy(file_tmp, file, sizeof(file_tmp)); - strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); - unlink(file_tmp); - selinux_setfscreatecon(file_tmp, udev->dev->kernel, mode); - retval = mknod(file_tmp, mode, devt); - selinux_resetfscreatecon(); - if (retval != 0) { - err("mknod(%s, %#o, %u, %u) failed: %s\n", - file_tmp, mode, major(devt), minor(devt), strerror(errno)); - goto exit; - } - retval = rename(file_tmp, file); - if (retval != 0) { - err("rename(%s, %s) failed: %s\n", - file_tmp, file, strerror(errno)); - unlink(file_tmp); - goto exit; + if (err != 0) { + err("mknod(%s, %#o, (%u,%u) failed: %s\n", + file, mode, major(devt), minor(devt), strerror(errno)); + goto exit; + } } -perms: - dbg("chmod(%s, %#o)\n", file, mode); - if (chmod(file, mode) != 0) { - err("chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); - goto exit; + if (!preserve || stats.st_mode != mode) { + info("chmod(%s, %#o)\n", file, mode); + err = chmod(file, mode); + if (err != 0) { + err("chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); + goto exit; + } } - if (uid != 0 || gid != 0) { - dbg("chown(%s, %u, %u)\n", file, uid, gid); - if (chown(file, uid, gid) != 0) { - err("chown(%s, %u, %u) failed: %s\n", - file, uid, gid, strerror(errno)); + if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { + info("chown(%s, %u, %u)\n", file, uid, gid); + err = chown(file, uid, gid); + if (err != 0) { + err("chown(%s, %u, %u) failed: %s\n", file, uid, gid, strerror(errno)); goto exit; } } exit: - return retval; + return err; } static int node_symlink(const char *node, const char *slink) -- cgit v1.2.3-54-g00ecf From 5dabec2a749265619198bc26a382277b109c931d Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Fri, 11 Jul 2008 00:52:22 +0200 Subject: udevadm: settle - add verbose output when running into timeout --- udevsettle.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/udevsettle.c b/udevsettle.c index 4b66f89cd6..cb63a66bba 100644 --- a/udevsettle.c +++ b/udevsettle.c @@ -35,6 +35,38 @@ #define DEFAULT_TIMEOUT 180 #define LOOP_PER_SECOND 20 +static void print_queue(const char *dir) +{ + LIST_HEAD(files); + struct name_entry *item; + + if (add_matching_files(&files, dir, NULL) < 0) + return; + + printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n"); + + list_for_each_entry(item, &files, node) { + char target[NAME_SIZE]; + size_t len; + const char *filename = strrchr(item->name, '/'); + + if (filename == NULL) + continue; + filename++; + if (*filename == '\0') + continue; + + len = readlink(item->name, target, sizeof(target)); + if (len < 0) + continue; + target[len] = '\0'; + + printf("%s: %s\n", filename, target); + } + + printf("\n\n"); +} + int udevsettle(int argc, char *argv[], char *envp[]) { char queuename[PATH_SIZE]; @@ -97,6 +129,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) } if (loop <= 0) { info("timeout waiting for queue\n"); + print_queue(queuename); goto exit; } -- cgit v1.2.3-54-g00ecf From 676229f13693c67e1380f77259f2dbd499c7b1e8 Mon Sep 17 00:00:00 2001 From: John Huttley Date: Fri, 11 Jul 2008 09:26:04 +0200 Subject: rules: tape rules - add nst to usb and 1394 links --- etc/udev/rules.d/60-persistent-storage-tape.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage-tape.rules b/etc/udev/rules.d/60-persistent-storage-tape.rules index b524b47cae..ce9e7bbbc2 100644 --- a/etc/udev/rules.d/60-persistent-storage-tape.rules +++ b/etc/udev/rules.d/60-persistent-storage-tape.rules @@ -5,12 +5,12 @@ ACTION!="add|change", GOTO="persistent_storage_tape_end" # type 8 devices are "Medium Changers" -KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" +KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" -KERNEL=="st*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="st*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{BSG_DEV}="$root/bsg/$id" KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", WAIT_FOR="$env{BSG_DEV}", IMPORT="scsi_id --whitelisted --export --device=$env{BSG_DEV}", ENV{ID_BUS}="scsi" -- cgit v1.2.3-54-g00ecf From 98d8d24bcc668022857e1b4852ac37ce4400ddf8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 11 Jul 2008 09:53:33 +0200 Subject: rules: tape rules - add nst to by-path/ links --- etc/udev/rules.d/60-persistent-storage-tape.rules | 7 +++---- etc/udev/rules.d/60-persistent-storage.rules | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/etc/udev/rules.d/60-persistent-storage-tape.rules b/etc/udev/rules.d/60-persistent-storage-tape.rules index ce9e7bbbc2..d3226f1320 100644 --- a/etc/udev/rules.d/60-persistent-storage-tape.rules +++ b/etc/udev/rules.d/60-persistent-storage-tape.rules @@ -11,15 +11,14 @@ SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" - KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{BSG_DEV}="$root/bsg/$id" KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", WAIT_FOR="$env{BSG_DEV}", IMPORT="scsi_id --whitelisted --export --device=$env{BSG_DEV}", ENV{ID_BUS}="scsi" - KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" -# by-path (shortest physical path) -KERNEL=="st*[0-9]", IMPORT{program}="path_id %p" +# by-path (parent device path) +KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p" KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst" LABEL="persistent_storage_tape_end" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules index 0299cdfd44..5ae0c7fec9 100644 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ b/etc/udev/rules.d/60-persistent-storage.rules @@ -45,7 +45,7 @@ KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_A KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -# by-path (shortest physical path) +# by-path (parent device path) ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -- cgit v1.2.3-54-g00ecf From ad1be3e7ad01b263312eaf2a06db0c24c9c90441 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Fri, 11 Jul 2008 10:27:55 +0200 Subject: rules: Debian update --- etc/udev/debian/50-udev.rules | 98 ++++++++++++++ etc/udev/debian/60-persistent-input.rules | 41 ++++++ etc/udev/debian/60-persistent-storage-tape.rules | 42 ++++++ etc/udev/debian/60-persistent-storage.rules | 109 +++++++++++++++ etc/udev/debian/60-persistent-v4l.rules | 17 +++ etc/udev/debian/75-cd-aliases-generator.rules | 11 ++ etc/udev/debian/75-persistent-net-generator.rules | 86 ++++++++++++ etc/udev/debian/80-drivers.rules | 57 ++++++++ etc/udev/debian/91-permissions.rules | 130 ++++++++++++++++++ etc/udev/debian/95-late.rules | 18 +++ etc/udev/debian/cd-aliases-generator.rules | 13 -- etc/udev/debian/compat.rules | 37 ------ etc/udev/debian/devfs.rules | 154 ---------------------- etc/udev/debian/hotplug.rules | 53 -------- etc/udev/debian/permissions.rules | 131 ------------------ etc/udev/debian/persistent-input.rules | 41 ------ etc/udev/debian/persistent-net-generator.rules | 48 ------- etc/udev/debian/persistent.rules | 107 --------------- etc/udev/debian/run.rules | 14 -- etc/udev/debian/udev.rules | 103 --------------- 20 files changed, 609 insertions(+), 701 deletions(-) create mode 100644 etc/udev/debian/50-udev.rules create mode 100644 etc/udev/debian/60-persistent-input.rules create mode 100644 etc/udev/debian/60-persistent-storage-tape.rules create mode 100644 etc/udev/debian/60-persistent-storage.rules create mode 100644 etc/udev/debian/60-persistent-v4l.rules create mode 100644 etc/udev/debian/75-cd-aliases-generator.rules create mode 100644 etc/udev/debian/75-persistent-net-generator.rules create mode 100644 etc/udev/debian/80-drivers.rules create mode 100644 etc/udev/debian/91-permissions.rules create mode 100644 etc/udev/debian/95-late.rules delete mode 100644 etc/udev/debian/cd-aliases-generator.rules delete mode 100644 etc/udev/debian/compat.rules delete mode 100644 etc/udev/debian/devfs.rules delete mode 100644 etc/udev/debian/hotplug.rules delete mode 100644 etc/udev/debian/permissions.rules delete mode 100644 etc/udev/debian/persistent-input.rules delete mode 100644 etc/udev/debian/persistent-net-generator.rules delete mode 100644 etc/udev/debian/persistent.rules delete mode 100644 etc/udev/debian/run.rules delete mode 100644 etc/udev/debian/udev.rules diff --git a/etc/udev/debian/50-udev.rules b/etc/udev/debian/50-udev.rules new file mode 100644 index 0000000000..e3a10701cf --- /dev/null +++ b/etc/udev/debian/50-udev.rules @@ -0,0 +1,98 @@ +# import the properties of optical drives +KERNEL=="hd[a-z]|pcd[0-9]*", ACTION=="add|change", DRIVERS=="ide-cdrom|pcd", \ + IMPORT{program}="cdrom_id --export $tempnode" +KERNEL=="sr[0-9]*", ACTION=="add|change", \ + IMPORT{program}="cdrom_id --export $tempnode" + +# workarounds for devices which do not report media changes +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ + ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" +SUBSYSTEMS=="scsi", KERNEL=="sd[a-z]", ATTR{removable}=="1", \ + ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", \ + ATTRS{media}=="floppy", OPTIONS+="all_partitions" + +# SCSI devices +SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" +SUBSYSTEM=="bsg", NAME="bsg/%k" + +# USB devices +SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="iowarrior[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ + ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", \ + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", ACTION=="add", \ + PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ + NAME="$result" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" + +# serial devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" + +# video devices +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ + NAME="$result" +KERNEL=="card[0-9]*", NAME="dri/%k" + +# misc devices +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" +KERNEL=="evtchn", NAME="xen/%k" +KERNEL=="rtc0", SYMLINK+="rtc" + +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm*", NAME="infiniband/%k" +KERNEL=="rdma_cm", NAME="infiniband/%k" + +# ALSA devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# Zaptel +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="transcode", NAME="zap/transcode" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# AOE character devices +SUBSYSTEM=="aoe", NAME="etherd/%k" + +KERNEL=="device-mapper", NAME="mapper/control" + diff --git a/etc/udev/debian/60-persistent-input.rules b/etc/udev/debian/60-persistent-input.rules new file mode 100644 index 0000000000..8f49d250b1 --- /dev/null +++ b/etc/udev/debian/60-persistent-input.rules @@ -0,0 +1,41 @@ +SUBSYSTEM!="input", GOTO="persistent_input_end" +ACTION!="add|change", GOTO="persistent_input_end" +# ignore the mid-level drivers +KERNEL=="input[0-9]*", GOTO="persistent_input_end" + +# usb devices +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" +SUBSYSTEMS=="usb", \ + ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", \ + ENV{ID_CLASS}="kbd" +SUBSYSTEMS=="usb", \ + ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", \ + ENV{ID_CLASS}="mouse" + +# other devices +DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" +DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +# this means (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", \ + ATTRS{modalias}!="input:*-*k*14A,*r*", \ + ENV{ID_CLASS}="joystick" + +ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + +# by-id links, generic and for the event devices +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ + SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ + SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" + +# by-path links +IMPORT{program}="path_id $devpath" +KERNEL=="mouse*|js*", ENV{ID_PATH}=="?*", \ + SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_PATH}=="?*", \ + SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" + +LABEL="persistent_input_end" + diff --git a/etc/udev/debian/60-persistent-storage-tape.rules b/etc/udev/debian/60-persistent-storage-tape.rules new file mode 100644 index 0000000000..6d2f5f14e9 --- /dev/null +++ b/etc/udev/debian/60-persistent-storage-tape.rules @@ -0,0 +1,42 @@ +# This file contains the rules needed to create persistent device names. + +# we are only interested in add and change actions for block devices +ACTION!="add|change", GOTO="persistent_storage_tape_end" + +# "Medium Changers" +KERNEL=="sg[0-9]*", \ + SUBSYSTEMS=="scsi", ATTRS{type}=="8", \ + IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" + +KERNEL=="sg[0-9]*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" + +SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" + +KERNEL=="st*[0-9]", ATTRS{ieee1394_id}=="?*", \ + ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" +KERNEL=="st*[0-9]", ENV{ID_SERIAL}!="?*", \ + SUBSYSTEMS=="usb", \ + IMPORT{program}="usb_id --export $devpath" + +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ + SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", \ + ENV{BSG_DEV}="$root/bsg/$id" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ + WAIT_FOR="$env{BSG_DEV}", \ + ENV{ID_BUS}="scsi", \ + IMPORT{program}="scsi_id --export --device=$env{BSG_DEV}" + +KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" + +KERNEL=="st*[0-9]", \ + IMPORT{program}="path_id $devpath" +KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", \ + SYMLINK+="tape/by-path/$env{ID_PATH}" + +# end of processing +LABEL="persistent_storage_tape_end" + diff --git a/etc/udev/debian/60-persistent-storage.rules b/etc/udev/debian/60-persistent-storage.rules new file mode 100644 index 0000000000..65e7204531 --- /dev/null +++ b/etc/udev/debian/60-persistent-storage.rules @@ -0,0 +1,109 @@ +# This file contains the rules needed to create persistent device names. + +# forward scsi device events to the corresponding block device +ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", \ + TEST=="block", ATTR{block/*/uevent}="change" + +# we are only interested in add and change actions for block devices +ACTION!="add|change", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# and we can safely ignore these kinds of devices +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" + +# skip removable ide devices, because open(2) on them causes an events loop +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ + GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", ATTRS{removable}=="1", \ + GOTO="persistent_storage_end" + +# ignore partitions that span the entire disk +TEST=="whole_disk", GOTO="persistent_storage_end" + +# skip xen virtual hard disks +DRIVERS=="vbd", GOTO="no_hardware_id" + +# check these attributes of /sys/class/block nodes +ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" +ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" + +# look for different kinds of unique identificators +KERNEL=="hd*[!0-9]", \ + IMPORT{program}="ata_id --export $tempnode" + +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", \ + ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ + SUBSYSTEMS=="usb", \ + IMPORT{program}="usb_id --export $devpath" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ + ENV{ID_BUS}="scsi", \ + IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" +KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", \ + ENV{ID_BUS}="cciss", \ + IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" + +KERNEL=="dasd*[!0-9]", \ + IMPORT{program}="dasd_id --export $tempnode" + +KERNEL=="sd*[!0-9]|hd*[!0-9]", \ + IMPORT{program}="edd_id --export $tempnode" + +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", \ + PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result" + +# find the physical path of the device +ENV{DEVTYPE}=="disk", IMPORT{program}="path_id $devpath" + +LABEL="no_hardware_id" + +# import the variables of partitions from the parent disks +ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" + +# obsolete PATA driver +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +# hd*-like compatibility links for libata and PATA devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" +KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" + +KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ + ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ + SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ + ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ + SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + +ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +KERNEL=="sd*[!0-9]|sr*|dasd[!0-9]*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|dasd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", \ + SYMLINK+="disk/by-path/$env{ID_PATH}" +ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", \ + SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# skip unpartitioned removable media devices from drivers which do not send +# "change" events +ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", \ + GOTO="persistent_storage_end" + +# UUID and volume label +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_UUID_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ + SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_LABEL_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ + SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="persistent_storage_end" + diff --git a/etc/udev/debian/60-persistent-v4l.rules b/etc/udev/debian/60-persistent-v4l.rules new file mode 100644 index 0000000000..5a317b6c18 --- /dev/null +++ b/etc/udev/debian/60-persistent-v4l.rules @@ -0,0 +1,17 @@ +ACTION!="add|change", GOTO="persistent_v4l_end" +SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" + +# ignore devices without a valid "index" number +TEST!="index", GOTO="persistent_v4l_end" +ATTR{index}!="?*", GOTO="persistent_v4l_end" + +IMPORT{program}="path_id $devpath" + +KERNEL=="video*|vbi*", ENV{ID_PATH}=="?*", \ + SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" + +KERNEL=="audio*", ENV{ID_PATH}=="?*", \ + SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" + +LABEL="persistent_v4l_end" + diff --git a/etc/udev/debian/75-cd-aliases-generator.rules b/etc/udev/debian/75-cd-aliases-generator.rules new file mode 100644 index 0000000000..6b178a0ae7 --- /dev/null +++ b/etc/udev/debian/75-cd-aliases-generator.rules @@ -0,0 +1,11 @@ +# These rules generate rules for the /dev/{cdrom,dvd,...} symlinks and +# write them to /etc/udev/rules.d/70-persistent-cd.rules. + +ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ + SUBSYSTEMS!="usb|ieee1394", \ + PROGRAM="write_cd_rules", SYMLINK+="$result" + +ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ + SUBSYSTEMS=="usb|ieee1394", \ + PROGRAM="write_cd_rules by-id", SYMLINK+="$result" + diff --git a/etc/udev/debian/75-persistent-net-generator.rules b/etc/udev/debian/75-persistent-net-generator.rules new file mode 100644 index 0000000000..e8d3b888e0 --- /dev/null +++ b/etc/udev/debian/75-persistent-net-generator.rules @@ -0,0 +1,86 @@ +# These rules generate rules to keep network interface names unchanged +# across reboots write them to /etc/udev/rules.d/70-persistent-net.rules. + +# variables used to communicate: +# MATCHADDR MAC address used for the match +# MATCHID bus_id used for the match +# MATCHDRV driver name used for the match +# MATCHIFTYPE interface type match +# COMMENT comment to add to the generated rule +# INTERFACE_NAME requested name supplied by external tool +# INTERFACE_NEW new interface name returned by rule writer + +ACTION!="add", GOTO="persistent_net_generator_end" +SUBSYSTEM!="net", GOTO="persistent_net_generator_end" + +# ignore the interface if a name has already been set +NAME=="?*", GOTO="persistent_net_generator_end" + +# ignore interfaces without a driver link like bridges and VLANs +DRIVERS!="?*", GOTO="persistent_net_generator_end" + +# device name whitelist +KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ + GOTO="persistent_net_generator_end" + +# ignore Xen virtual interfaces +SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" + +# ignore UML virtual interfaces +DRIVERS=="uml-netdev", GOTO="persistent_net_generator_end" + +# ignore "secondary" raw interfaces of the madwifi driver +KERNEL=="ath*", ATTRS{type}=="802", GOTO="persistent_net_generator_end" + +# ignore "secondary" monitor interfaces of mac80211 drivers +KERNEL=="wlan*", ATTRS{type}=="803", GOTO="persistent_net_generator_end" + +# by default match on the MAC address and interface type +ENV{MATCHADDR}="$attr{address}" +ENV{MATCHIFTYPE}="$attr{type}" + +# ignore interfaces with locally administered or null MAC addresses +# and VMWare virtual interfaces +ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" +ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" +ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", ENV{MATCHADDR}="" + +# ibmveth interfaces have stable locally administered MAC addresses +SUBSYSTEMS=="ibmveth", ENV{MATCHADDR}="$attr{address}" + +# S/390 interfaces are matched only by id +SUBSYSTEMS=="ccwgroup", \ + ENV{MATCHDRV}="$driver", ENV{MATCHID}="$id", ENV{MATCHADDR}="" + +# terminate processing if there are not enough conditions to create a rule +ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", \ + GOTO="persistent_net_generator_end" + + +# provide nice comments for the generated rules +SUBSYSTEMS=="pci", \ + ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}" +SUBSYSTEMS=="pcmcia", \ + ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id}" +SUBSYSTEMS=="usb", \ + ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct}" +SUBSYSTEMS=="ccwgroup", \ + ENV{COMMENT}="S/390 device at $id" +SUBSYSTEMS=="ibmveth", \ + ENV{COMMENT}="LPAR virtual device at $id" +SUBSYSTEMS=="ieee1394", \ + ENV{COMMENT}="Firewire device $attr{host_id}" +ENV{COMMENT}=="", \ + ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})" +ATTRS{driver}=="?*", \ + ENV{COMMENT}="$env{COMMENT} ($attr{driver})" + + +# generate and write the rule +IMPORT{program}="write_net_rules" + +# rename the interface if requested +ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" + +LABEL="persistent_net_generator_end" + diff --git a/etc/udev/debian/80-drivers.rules b/etc/udev/debian/80-drivers.rules new file mode 100644 index 0000000000..edfcfa5394 --- /dev/null +++ b/etc/udev/debian/80-drivers.rules @@ -0,0 +1,57 @@ +ACTION!="add", GOTO="hotplug_not_add_event" + +# check if the device has already been claimed by a driver +ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" + +# this driver is broken and should not be loaded automatically on kernels +# < 2.6.21 (see #398962) +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_driver_loaded" + +# load the drivers +ENV{MODALIAS}=="?*", \ + RUN+="/sbin/modprobe --use-blacklist $env{MODALIAS}" + +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ + RUN+="/bin/sh -c '/sbin/modprobe --use-blacklist --all $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" + +SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" + +# rules for subsystems which lack proper hotplug support +SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe tifm_ms" + +# needed for kernels < 2.6.22 +SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe osst", \ + ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ + ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ + ATTRS{vendor}!="Onstream" +SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ATTRS{type}=="8", RUN+="/sbin/modprobe ch" + +SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", TEST!="[module/sg]", \ + RUN+="/sbin/modprobe sg" + +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" + +# From here on follows the hotplug agents which do not load modules +LABEL="hotplug_driver_loaded" + +# FIXME: does a sane default exist? +#SUBSYSTEM=="scsi_device", ATTRS{idVendor}=="...", \ +# RUN+="scsi-re-add" + +SUBSYSTEM=="firmware", RUN+="firmware.agent" + +LABEL="hotplug_not_add_event" + +SUBSYSTEM=="net", RUN+="net.agent" + +# Log every event to /dev/hotplug.log (for debugging). +#RUN+="logger.agent" + diff --git a/etc/udev/debian/91-permissions.rules b/etc/udev/debian/91-permissions.rules new file mode 100644 index 0000000000..5182a4bd28 --- /dev/null +++ b/etc/udev/debian/91-permissions.rules @@ -0,0 +1,130 @@ +ACTION!="add", GOTO="permissions_end" + +# devices needed to load the drivers providing them +KERNEL=="tun", OPTIONS+="ignore_remove" +KERNEL=="ppp", OPTIONS+="ignore_remove" +KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" + +# default permissions for block devices +SUBSYSTEM=="block", GROUP="disk" +# the aacraid driver is broken and reports that disks removable (see #404927) +SUBSYSTEM=="block", ATTRS{removable}=="1", \ + DRIVERS!="aacraid", GROUP="floppy" +# all block devices on these buses are "removable" +SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" + +KERNEL=="cbm", GROUP="floppy" + +# IDE devices +ENV{ID_CDROM}=="?*", GROUP="cdrom" +KERNEL=="ht[0-9]*", GROUP="tape" +KERNEL=="nht[0-9]*", GROUP="tape" + +# SCSI devices +SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" + +# USB devices +KERNEL=="legousbtower*", MODE="0666" +KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" + +# usbfs-like devices +SUBSYSTEM=="usb_device", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ + MODE="0664" + +# iRiver music players +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ + ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" + +# serial devices +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="zaptel", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" + +# misc devices +KERNEL=="random", MODE="0666" +KERNEL=="urandom", MODE="0666" +KERNEL=="mem", MODE="0640", GROUP="kmem" +KERNEL=="kmem", MODE="0640", GROUP="kmem" +KERNEL=="port", MODE="0640", GROUP="kmem" +KERNEL=="full", MODE="0666" +KERNEL=="null", MODE="0666" +KERNEL=="zero", MODE="0666" +KERNEL=="inotify", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="nvram", GROUP="nvram" +KERNEL=="rtc|rtc[0-9]*", GROUP="audio" +KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" +KERNEL=="fuse", GROUP="fuse" +KERNEL=="kqemu", MODE="0666" +KERNEL=="kvm", GROUP="kvm" +KERNEL=="tun", MODE="0666" + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +KERNEL=="uverbs*", GROUP="rdma" +KERNEL=="ucm*", GROUP="rdma" +KERNEL=="rdma_cm", GROUP="rdma" + +# printers and parallel devices +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="irlpt*", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" + +# input devices +KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ + MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" +KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", \ + MODE="0664", GROUP="audio" +KERNEL=="lirc[0-9]*", GROUP="video" + +KERNEL=="sgi_*", MODE="0666" +KERNEL=="z90crypt", MODE="0666" +KERNEL=="iseries/ibmsis*", GROUP="disk" +KERNEL=="iseries/nvt*", GROUP="disk" +KERNEL=="iseries/vt*", GROUP="disk" +KERNEL=="iseries/vtty*", GROUP="dialout" + +# AOE character devices +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440", GROUP="disk" + +LABEL="permissions_end" + diff --git a/etc/udev/debian/95-late.rules b/etc/udev/debian/95-late.rules new file mode 100644 index 0000000000..622e019ef3 --- /dev/null +++ b/etc/udev/debian/95-late.rules @@ -0,0 +1,18 @@ +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + +# ignore the events generated by virtual consoles +KERNEL=="ptmx", OPTIONS+="last_rule" +KERNEL=="console", OPTIONS+="last_rule" +KERNEL=="tty" , OPTIONS+="last_rule" +KERNEL=="tty[0-9]*", OPTIONS+="last_rule" +KERNEL=="pty*", OPTIONS+="last_rule" +SUBSYSTEM=="vc", OPTIONS+="last_rule" + +# do not delete static device nodes +ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", \ + OPTIONS+="ignore_remove" + +# debugging monitor +RUN+="socket:/org/kernel/udev/monitor" + diff --git a/etc/udev/debian/cd-aliases-generator.rules b/etc/udev/debian/cd-aliases-generator.rules deleted file mode 100644 index f65548816e..0000000000 --- a/etc/udev/debian/cd-aliases-generator.rules +++ /dev/null @@ -1,13 +0,0 @@ -# These rules generate rules for the /dev/{cdrom,dvd,...} symlinks and -# write them to /etc/udev/rules.d/z20_persistent-cd.rules. -# -# The default name for this file is z75_cd-aliases-generator.rules. - -ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ - SUBSYSTEMS!="usb|ieee1394", \ - PROGRAM="write_cd_rules", SYMLINK+="%c" - -ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ - SUBSYSTEMS=="usb|ieee1394", \ - PROGRAM="write_cd_rules by-id", SYMLINK+="%c" - diff --git a/etc/udev/debian/compat.rules b/etc/udev/debian/compat.rules deleted file mode 100644 index 209e3ce7e4..0000000000 --- a/etc/udev/debian/compat.rules +++ /dev/null @@ -1,37 +0,0 @@ -# compatibility links for a devfs-style /dev - -KERNEL=="md[0-9]*", SYMLINK+="%k" -#KERNEL=="loop[0-9]*", SYMLINK+="%k" - -#KERNEL=="tty[0-9]*", SYMLINK+="%k" -#KERNEL=="ttyS[0-9]*", SYMLINK+="%k" -#KERNEL=="ttyUSB[0-9]*", SYMLINK+="%k" - -#KERNEL=="vcs", SYMLINK+="%k" -#KERNEL=="vcs[0-9]*", SYMLINK+="%k" -#KERNEL=="vcsa", SYMLINK+="%k" -#KERNEL=="vcsa[0-9]*", SYMLINK+="%k" - -KERNEL=="video*", SYMLINK+="%k" -KERNEL=="radio*", SYMLINK+="%k" -KERNEL=="vbi*", SYMLINK+="%k" -KERNEL=="vtx*", SYMLINK+="%k" - -KERNEL=="apm_bios", SYMLINK+="%k" -KERNEL=="agpgart", SYMLINK+="%k" -#KERNEL=="psaux", SYMLINK+="%k" -#KERNEL=="nvram", SYMLINK+="%k" -KERNEL=="rtc", SYMLINK+="%k" -#KERNEL=="ram[0-9]*", SYMLINK+="%k" - -#KERNEL=="i2c-[0-9]*", SYMLINK+="%k" -#KERNEL=="lp[0-9]*", SYMLINK+="%k" - -KERNEL=="audio*", SYMLINK+="%k" -KERNEL=="dsp*", SYMLINK+="%k" -KERNEL=="mixer*", SYMLINK+="%k" - -#KERNEL=="fb[0-9]*", SYMLINK+="%k" -#KERNEL=="fd[0-9]*", SYMLINK+="%k" -#KERNEL=="js[0-9]*", SYMLINK+="%k" - diff --git a/etc/udev/debian/devfs.rules b/etc/udev/debian/devfs.rules deleted file mode 100644 index 56ed1a8807..0000000000 --- a/etc/udev/debian/devfs.rules +++ /dev/null @@ -1,154 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some -# of the different fields. They provide the following subsitutions: -# -# %n the "kernel number" of the device. -# For example, 'sda3' has a "kernel number" of '3' -# %k the kernel name for the device -# %M the kernel major number for the device -# %m the kernel minor number for the device -# %b the bus id for the device -# %c the string returned by the PROGRAM -# %s{filename} the content of a sysfs attribute -# %% the '%' char itself -# - -# workaround for devices which do not report media changes -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ - ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ - OPTIONS+="all_partitions" - -# IDE devices -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]*", PROGRAM="ide-devfs.sh %k %b %n", \ - ACTION=="add", \ - NAME="%c{1}", SYMLINK+="%k %c{2}" - -# SCSI devices -SUBSYSTEMS=="scsi", PROGRAM="scsi-devfs.sh %k %b %n", ACTION=="add", \ - NAME="%c{1}", SYMLINK+="%k %c{2}" - -# RAID controllers -KERNEL=="cciss!*|ida!*|rd!*", PROGRAM="raid-devfs.sh %k", ACTION=="add", \ - NAME="%c{1}", SYMLINK+="%k" - -# other block devices -KERNEL=="md[0-9]*", NAME="md/%n", -KERNEL=="loop[0-9]*", NAME="loop/%n" -KERNEL=="ram[0-9]*", NAME="rd/%n" - -# USB devices -SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ - ATTRS{product}=="Palm Handheld*|Handspring Visor|palmOne Handheld", \ - SYMLINK+="pilot" - -# usbfs-like devices -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ - NAME="%c" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" - -# serial devices -KERNEL=="ttyS[0-9]*", NAME="tts/%n" -KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n" -KERNEL=="rfcomm[0-9]*", NAME="bluetooth/rfcomm/%n", -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi[0-9]*", NAME="capi/%n" - -# vc devices -KERNEL=="tty[0-9]*", NAME="vc/%n" -KERNEL=="vcs", NAME="vcc/0" -KERNEL=="vcs[0-9]*", NAME="vcc/%n" -KERNEL=="vcsa", NAME="vcc/a0" -KERNEL=="vcsa[0-9]*", NAME="vcc/a%n" - -# video devices -KERNEL=="video[0-9]*", NAME="v4l/%k" -KERNEL=="radio[0-9]*", NAME="v4l/%k" -KERNEL=="vbi[0-9]*", NAME="v4l/%k" -KERNEL=="vtx[0-9]*", NAME="v4l/%k" -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ - NAME="%c" -KERNEL=="fb[0-9]*", NAME="fb/%n" -KERNEL=="card[0-9]*", NAME="dri/%k" - -# misc devices -KERNEL=="apm_bios", NAME="misc/%k", -KERNEL=="agpgart", NAME="misc/%k" -KERNEL=="hw_random", NAME="hwrng" -KERNEL=="nvram", NAME="misc/%k" -KERNEL=="psaux", NAME="misc/%k" -KERNEL=="rtc", NAME="misc/%k" -KERNEL=="tun", NAME="net/%k" -KERNEL=="evtchn", NAME="xen/%k" - -# printers and parallel devices -KERNEL=="lp[0-9]*", NAME="printers/%n" -KERNEL=="parport[0-9]*", NAME="parports/%n" - -KERNEL=="i2c-[0-9]*", NAME="i2c/%n" -KERNEL=="fd[0-9]*", NAME="floppy/%n" - -KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL=="pktcdvd", NAME="pktcdvd/control" - -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode" - -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" -KERNEL=="uverbs*", NAME="infiniband/%k" -KERNEL=="ucm*", NAME="infiniband/%k" -KERNEL=="rdma_ucm", NAME="infiniband/%k" - -# sound devices -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" -KERNEL=="audio*", NAME="sound/%k" -KERNEL=="dsp*", NAME="sound/%k" -KERNEL=="adsp*", NAME="sound/%k" -KERNEL=="midi*", NAME="sound/%k" -KERNEL=="mixer*", NAME="sound/%k" -KERNEL=="sequencer*", NAME="sound/%k" -KERNEL=="amidi*", NAME="sound/%k" -KERNEL=="dmmidi*", NAME="sound/%k" -KERNEL=="admmidi*", NAME="sound/%k" - -# ieee1394 devices -KERNEL=="dv1394*", NAME="dv1394/%n" -KERNEL=="video1394*", NAME="video1394/%n" - -# input devices -KERNEL=="mice", NAME="input/%k" -KERNEL=="mouse[0-9]*", NAME="input/%k" -KERNEL=="event[0-9]*", NAME="input/%k" -KERNEL=="js[0-9]*", NAME="input/%k" -KERNEL=="ts[0-9]*", NAME="input/%k" -KERNEL=="uinput", NAME="input/%k" - -# Zaptel -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -# AOE character devices -SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" -SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" -SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" -SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k" - -# device mapper creates its own device nodes, so ignore these -KERNEL=="device-mapper", NAME="mapper/control" - diff --git a/etc/udev/debian/hotplug.rules b/etc/udev/debian/hotplug.rules deleted file mode 100644 index 662e997c81..0000000000 --- a/etc/udev/debian/hotplug.rules +++ /dev/null @@ -1,53 +0,0 @@ -ACTION!="add", GOTO="hotplug_not_add_event" - -# check if the device has already been claimed by a driver -ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" - -# this driver is broken and should not be loaded automatically (see #398962) -SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_driver_loaded" - -# load the drivers -ENV{MODALIAS}=="?*", \ - RUN+="/sbin/modprobe --use-blacklist $env{MODALIAS}" -SUBSYSTEM=="ide", ENV{MODALIAS}!="?*", RUN+="ide.agent" - -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ - RUN+="/bin/sh -c 'while read id; do /sbin/modprobe --use-blacklist pnp:d$$id; done < /sys$devpath/id'" - -SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" - -# rules for subsystems which lack proper hotplug support -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe tifm_ms" - -SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe osst", \ - ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ - ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ - ATTRS{vendor}!="Onstream" -SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ATTRS{type}=="8", RUN+="/sbin/modprobe ch" -SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", RUN+="/sbin/modprobe sg" - -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" - -# From here on follows the hotplug agents which do not load modules -LABEL="hotplug_driver_loaded" - -# FIXME: does a sane default exist? -#SUBSYSTEM=="scsi_device", ATTRS{idVendor}=="...", \ -# RUN+="scsi-re-add" - -SUBSYSTEM=="firmware", RUN+="firmware.agent" - -LABEL="hotplug_not_add_event" - -SUBSYSTEM=="net", RUN+="net.agent" - -# Log every event to /dev/hotplug.log (for debugging). -#RUN+="logger.agent" - diff --git a/etc/udev/debian/permissions.rules b/etc/udev/debian/permissions.rules deleted file mode 100644 index 205b733292..0000000000 --- a/etc/udev/debian/permissions.rules +++ /dev/null @@ -1,131 +0,0 @@ -ACTION!="add", GOTO="permissions_end" - -# workarounds needed to synchronize with sysfs -# only needed for kernels < v2.6.18-rc1 -ENV{PHYSDEVPATH}!="?*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt" -# only needed for kernels < 2.6.16 -SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" -# only needed for kernels < 2.6.17 -SUBSYSTEM=="net", ENV{DRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" - -# devices needed to load the drivers providing them -KERNEL=="tun", OPTIONS+="ignore_remove" -KERNEL=="ppp", OPTIONS+="ignore_remove" -KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" - -# default permissions for block devices -SUBSYSTEM=="block", GROUP="disk" -# the aacraid driver is broken and reports that disks removable (see #404927) -SUBSYSTEM=="block", ATTRS{removable}=="1", \ - DRIVERS!="aacraid", GROUP="floppy" -# all block devices on these buses are "removable" -SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" - -# IDE devices -KERNEL=="hd[a-z]|pcd[0-9]*", DRIVERS=="ide-cdrom|pcd", \ - IMPORT{program}="cdrom_id --export $tempnode" -ENV{ID_CDROM}=="?*", GROUP="cdrom" -KERNEL=="ht[0-9]*", GROUP="tape" -KERNEL=="nht[0-9]*", GROUP="tape" - -# SCSI devices -KERNEL=="sr[0-9]*", IMPORT{program}="cdrom_id --export $tempnode" -SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" -SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" -SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" -SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" - -# USB devices -KERNEL=="legousbtower*", MODE="0666" -KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" - -# usbfs-like devices -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ - MODE="0664" - -# iRiver music players -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ - ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" - -# serial devices -SUBSYSTEM=="tty", GROUP="dialout" -SUBSYSTEM=="capi", GROUP="dialout" -SUBSYSTEM=="slamr", GROUP="dialout" -SUBSYSTEM=="zaptel", GROUP="dialout" - -# vc devices (all members of the tty subsystem) -KERNEL=="ptmx", MODE="0666", GROUP="root" -KERNEL=="console", MODE="0600", GROUP="root" -KERNEL=="tty", MODE="0666", GROUP="root" -KERNEL=="tty[0-9]*", GROUP="root" -KERNEL=="pty*", MODE="0666", GROUP="tty" - -# video devices -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="drm", GROUP="video" -SUBSYSTEM=="dvb", GROUP="video" -SUBSYSTEM=="em8300", GROUP="video" -SUBSYSTEM=="graphics", GROUP="video" -SUBSYSTEM=="nvidia", GROUP="video" - -# misc devices -KERNEL=="random", MODE="0666" -KERNEL=="urandom", MODE="0666" -KERNEL=="mem", MODE="0640", GROUP="kmem" -KERNEL=="kmem", MODE="0640", GROUP="kmem" -KERNEL=="port", MODE="0640", GROUP="kmem" -KERNEL=="full", MODE="0666" -KERNEL=="null", MODE="0666" -KERNEL=="zero", MODE="0666" -KERNEL=="inotify", MODE="0666" -KERNEL=="sgi_fetchop", MODE="0666" -KERNEL=="sonypi", MODE="0666" -KERNEL=="agpgart", GROUP="video" -KERNEL=="nvram", GROUP="nvram" -KERNEL=="rtc|rtc[0-9]*", GROUP="audio" -KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" -KERNEL=="fuse", GROUP="fuse" -KERNEL=="kqemu", MODE="0666" -KERNEL=="kvm", GROUP="kvm" -KERNEL=="tun", MODE="0666", - -KERNEL=="cdemu[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd", MODE="0644" - -KERNEL=="uverbs*", GROUP="rdma" -KERNEL=="ucm*", GROUP="rdma" -KERNEL=="rdma_ucm", GROUP="rdma" - -# printers and parallel devices -SUBSYSTEM=="printer", GROUP="lp" -SUBSYSTEM=="ppdev", GROUP="lp" -KERNEL=="irlpt*", GROUP="lp" -KERNEL=="pt[0-9]*", GROUP="tape" -KERNEL=="pht[0-9]*", GROUP="tape" - -# sound devices -SUBSYSTEM=="sound", GROUP="audio" - -# ieee1394 devices -KERNEL=="raw1394", GROUP="disk" -KERNEL=="dv1394*", GROUP="video" -KERNEL=="video1394*", GROUP="video" - -# input devices -KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ - MODE="0664", GROUP="video" -KERNEL=="js[0-9]*", MODE="0664" -KERNEL=="lirc[0-9]*", GROUP="video" - -# AOE character devices -SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" -SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" - -LABEL="permissions_end" - diff --git a/etc/udev/debian/persistent-input.rules b/etc/udev/debian/persistent-input.rules deleted file mode 100644 index 47c4ae98cb..0000000000 --- a/etc/udev/debian/persistent-input.rules +++ /dev/null @@ -1,41 +0,0 @@ -SUBSYSTEM!="input", GOTO="persistent_input_end" -ACTION!="add", GOTO="persistent_input_end" -# ignore the mid-level drivers -KERNEL=="input[0-9]*", GOTO="persistent_input_end" - -# usb devices -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" -SUBSYSTEMS=="usb", \ - ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", \ - ENV{ID_CLASS}="kbd" -SUBSYSTEMS=="usb", \ - ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", \ - ENV{ID_CLASS}="mouse" - -# other devices -DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" -DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" -DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" -ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" -# this means (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH -ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", \ - ATTRS{modalias}!="input:*-*k*14A,*r*", \ - ENV{ID_CLASS}="joystick" - -ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" - -# by-id links, generic and for the event devices -KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ - SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ - SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" - -# by-path links -IMPORT{program}="path_id %p" -KERNEL=="mouse*|js*", ENV{ID_PATH}=="?*", \ - SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_PATH}=="?*", \ - SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" - -LABEL="persistent_input_end" - diff --git a/etc/udev/debian/persistent-net-generator.rules b/etc/udev/debian/persistent-net-generator.rules deleted file mode 100644 index 6df00bff2f..0000000000 --- a/etc/udev/debian/persistent-net-generator.rules +++ /dev/null @@ -1,48 +0,0 @@ -# These rules generate rules to keep network interface names unchanged -# across reboots write them to /etc/udev/rules.d/z25_persistent-net.rules. -# -# The default name for this file is z45_persistent-net-generator.rules. - -ACTION!="add", GOTO="persistent_net_generator_end" -SUBSYSTEM!="net", GOTO="persistent_net_generator_end" - -# ignore the interface if a name has already been set -NAME=="?*", GOTO="persistent_net_generator_end" - -# ignore Xen virtual interfaces -SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" - -# ignore UML virtual interfaces -DRIVERS=="uml-netdev", GOTO="persistent_net_generator_end" - -# ignore VMWare virtual interfaces -ATTR{address}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" - -# ignore interfaces with random MAC addresses -ATTR{address}=="?[2367abef]:*", GOTO="persistent_net_generator_end" - -# ignore "secondary" raw interfaces of the madwifi driver -KERNEL=="ath*", ATTRS{type}=="802", GOTO="persistent_net_generator_end" - -# provide nice comments for the generated rules -SUBSYSTEMS=="pci", \ - ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}" -SUBSYSTEMS=="usb", \ - ENV{COMMENT}="USB device $attr{idVendor}:$attr{idProduct}" -SUBSYSTEMS=="ccwgroup", \ - ENV{COMMENT}="S/390 device at $id", -SUBSYSTEMS=="ieee1394", \ - ENV{COMMENT}="Firewire device $attr{host_id}" -ENV{COMMENT}=="", \ - ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})" -ATTRS{driver}=="?*", \ - ENV{COMMENT}="$env{COMMENT} ($attr{driver})" - -# ignore interfaces without a driver link like bridges and VLANs -KERNEL=="eth*|ath*|wlan*|ra*|sta*|ctc*|lcs*|hsi*", DRIVERS=="?*",\ - IMPORT{program}="write_net_rules $attr{address}" - -ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" - -LABEL="persistent_net_generator_end" - diff --git a/etc/udev/debian/persistent.rules b/etc/udev/debian/persistent.rules deleted file mode 100644 index de2fa2a928..0000000000 --- a/etc/udev/debian/persistent.rules +++ /dev/null @@ -1,107 +0,0 @@ -# This file contains the rules needed to create persistent device names. - -# we are only interested in add actions for block devices -ACTION!="add", GOTO="persistent_storage_end" -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# and we can safely ignore these kinds of devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" - -# skip removable ide devices, because open(2) on them causes an events loop -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ - GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", ATTRS{removable}=="1", \ - GOTO="persistent_storage_end" - -# ignore partitions that span the entire disk -ATTR{whole_disk}=="*", GOTO="persistent_storage_end" - -# skip xen virtual hard disks -DRIVERS=="vbd", GOTO="no_hardware_id" - -# look for different kinds of unique identificators -KERNEL=="hd*[!0-9]", \ - IMPORT{program}="ata_id --export $tempnode" - -KERNEL=="sd*[!0-9]|sr*|st*|nst*", ATTRS{ieee1394_id}=="?*", \ - ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" -KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ - IMPORT{program}="usb_id -x" -KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ - IMPORT{program}="scsi_id -g -x -s $devpath -d $tempnode" -KERNEL=="sd*[!0-9]|sr*|st*|nst*", ENV{ID_SERIAL}=="", \ - IMPORT{program}="scsi_id -g -x -a -s $devpath -d $tempnode" -KERNEL=="cciss?c[0-9]d[0-9]", ENV{ID_SERIAL}=="", - IMPORT{program}="scsi_id -g -x -n -s $devpath -d $tempnode" -KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="", \ - IMPORT{program}="scsi_id -g -x -s $devpath -d $tempnode" -KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="", \ - IMPORT{program}="scsi_id -g -x -a -s $devpath -d $tempnode" - -KERNEL=="dasd*[!0-9]", \ - IMPORT{program}="dasd_id --export $tempnode" - -KERNEL=="*[!0-9]", \ - IMPORT{program}="edd_id --export $tempnode" - -# find the physical path of the device -KERNEL=="*[!0-9]|sr*|st*", IMPORT{program}="path_id $devpath" - -LABEL="no_hardware_id" - -# import the variables of partitions from the parent disks -KERNEL=="*[0-9]", IMPORT{parent}="ID_*" - -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_SERIAL_SHORT}=="?*", \ - ENV{ID_VENDOR}=="ATA", \ - SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}" -KERNEL=="sd*[0-9]|cciss*p[0-9]", ENV{ID_SERIAL_SHORT}=="?*", \ - ENV{ID_VENDOR}=="ATA", \ - SYMLINK+="disk/by-id/ata-$env{ID_MODEL}-$env{ID_SERIAL_SHORT}-part%n" - -KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ - ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ - SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ - ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ - SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" - -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -KERNEL=="sd*[!0-9]|dasd[!0-9]*|sr*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -KERNEL=="st*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="nst*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" -KERNEL=="sg*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -KERNEL=="*[!0-9]|sr*|cciss?c[0-9]d[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="*[0-9]|cciss*p[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -KERNEL=="st*", ENV{ID_PATH}=="?*", \ - SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_storage_end" - -# UUID and volume label -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", GOTO="persistent_storage_end" -IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_UUID_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ - SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_LABEL_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ - SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -# end of processing -LABEL="persistent_storage_end" - diff --git a/etc/udev/debian/run.rules b/etc/udev/debian/run.rules deleted file mode 100644 index 75d71375bb..0000000000 --- a/etc/udev/debian/run.rules +++ /dev/null @@ -1,14 +0,0 @@ -# debugging monitor -RUN+="socket:/org/kernel/udev/monitor" - -# run a command on remove events -ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" - -# ignore the events generated by virtual consoles -KERNEL=="ptmx", OPTIONS+="last_rule" -KERNEL=="console", OPTIONS+="last_rule" -KERNEL=="tty" , OPTIONS+="last_rule" -KERNEL=="tty[0-9]*", OPTIONS+="last_rule" -KERNEL=="pty*", OPTIONS+="last_rule" -SUBSYSTEM=="vc", OPTIONS+="last_rule" - diff --git a/etc/udev/debian/udev.rules b/etc/udev/debian/udev.rules deleted file mode 100644 index af16c17f48..0000000000 --- a/etc/udev/debian/udev.rules +++ /dev/null @@ -1,103 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some -# of the different fields. They provide the following subsitutions: -# -# %n the "kernel number" of the device. -# For example, 'sda3' has a "kernel number" of '3' -# %k the kernel name for the device -# %M the kernel major number for the device -# %m the kernel minor number for the device -# %b the bus id for the device -# %c the string returned by the PROGRAM -# %s{filename} the content of a sysfs attribute -# %% the '%' char itself -# - -# workaround for devices which do not report media changes -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ - ENV{ID_MODEL}=="IOMEGA_ZIP*", NAME="%k", OPTIONS+="all_partitions" -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTRS{media}=="floppy", \ - OPTIONS+="all_partitions" - -# SCSI devices -SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" - -# USB devices -SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ - ATTRS{product}=="Palm Handheld*|Handspring Visor|palmOne Handheld", \ - SYMLINK+="pilot" - -# usbfs-like devices -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ - NAME="%c" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" - -# serial devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi[0-9]*", NAME="capi/%n" - -# video devices -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ - NAME="%c" -KERNEL=="card[0-9]*", NAME="dri/%k" - -# misc devices -KERNEL=="hw_random", NAME="hwrng" -KERNEL=="tun", NAME="net/%k" -KERNEL=="evtchn", NAME="xen/%k" - -KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL=="pktcdvd", NAME="pktcdvd/control" - -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode" - -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" -KERNEL=="uverbs*", NAME="infiniband/%k" -KERNEL=="ucm*", NAME="infiniband/%k" -KERNEL=="rdma_ucm", NAME="infiniband/%k" - -# ALSA devices -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# ieee1394 devices -KERNEL=="dv1394*", NAME="dv1394/%n" -KERNEL=="video1394*", NAME="video1394/%n" - -# input devices -KERNEL=="mice", NAME="input/%k" -KERNEL=="mouse[0-9]*", NAME="input/%k" -KERNEL=="event[0-9]*", NAME="input/%k" -KERNEL=="js[0-9]*", NAME="input/%k" -KERNEL=="ts[0-9]*", NAME="input/%k" -KERNEL=="uinput", NAME="input/%k" - -# Zaptel -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -# AOE character devices -SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k" -SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k" -SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k" -SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k" - -# device mapper creates its own device nodes, so ignore these -KERNEL=="device-mapper", NAME="mapper/control" - -- cgit v1.2.3-54-g00ecf From d1acfc3e0afbfd138247e9e93da69e5c94821623 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Jul 2008 11:54:18 +0200 Subject: udevadm: info - add --export format to --device-id-of-file= $ udevadm info --export --export-prefix="ROOT_" --device-id-of-file=/ ROOT_MAJOR=8 ROOT_MINOR=5 --- udevinfo.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/udevinfo.c b/udevinfo.c index b8e97c4074..b9ee17c4f1 100644 --- a/udevinfo.c +++ b/udevinfo.c @@ -207,14 +207,22 @@ out: return rc; } -static int stat_device(const char *name) +static int stat_device(const char *name, int export, const char *prefix) { struct stat statbuf; if (stat(name, &statbuf) != 0) return -1; - printf("%d %d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); + if (export) { + if (prefix == NULL) + prefix = "INFO_"; + printf("%sMAJOR=%d\n" + "%sMINOR=%d\n", + prefix, major(statbuf.st_dev), + prefix, minor(statbuf.st_dev)); + } else + printf("%d %d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); return 0; } @@ -223,6 +231,8 @@ int udevinfo(int argc, char *argv[], char *envp[]) int option; struct udevice *udev; int root = 0; + int export = 0; + const char *export_prefix = NULL; static const struct option options[] = { { "name", 1, NULL, 'n' }, @@ -232,6 +242,8 @@ int udevinfo(int argc, char *argv[], char *envp[]) { "export-db", 0, NULL, 'e' }, { "root", 0, NULL, 'r' }, { "device-id-of-file", 1, NULL, 'd' }, + { "export", 0, NULL, 'x' }, + { "export-prefix", 1, NULL, 'P' }, { "version", 0, NULL, 1 }, /* -V outputs braindead format */ { "help", 0, NULL, 'h' }, {} @@ -270,7 +282,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) } while (1) { - option = getopt_long(argc, argv, "aed:n:p:q:rVh", options, NULL); + option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); if (option == -1) break; @@ -354,6 +366,12 @@ int udevinfo(int argc, char *argv[], char *envp[]) case 'e': export_db(); goto exit; + case 'x': + export = 1; + break; + case 'P': + export_prefix = optarg; + break; case 1: printf("%s\n", UDEV_VERSION); goto exit; @@ -462,7 +480,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) } break; case ACTION_DEVICE_ID_FILE: - if (stat_device(name) != 0) + if (stat_device(name, export, export_prefix) != 0) rc = 6; break; case ACTION_ROOT: -- cgit v1.2.3-54-g00ecf From 41dd741442ab496901c38f6cd38404bd954f1857 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 15 Jul 2008 11:56:42 +0200 Subject: rules: Debian update --- etc/udev/debian/60-persistent-storage-tape.rules | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/etc/udev/debian/60-persistent-storage-tape.rules b/etc/udev/debian/60-persistent-storage-tape.rules index 6d2f5f14e9..94a0b816d4 100644 --- a/etc/udev/debian/60-persistent-storage-tape.rules +++ b/etc/udev/debian/60-persistent-storage-tape.rules @@ -6,16 +6,16 @@ ACTION!="add|change", GOTO="persistent_storage_tape_end" # "Medium Changers" KERNEL=="sg[0-9]*", \ SUBSYSTEMS=="scsi", ATTRS{type}=="8", \ - IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" + IMPORT{program}="scsi_id --export --sg-version=3 --whitelisted --device=$tempnode" KERNEL=="sg[0-9]*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" -KERNEL=="st*[0-9]", ATTRS{ieee1394_id}=="?*", \ +KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", \ ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" -KERNEL=="st*[0-9]", ENV{ID_SERIAL}!="?*", \ +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ SUBSYSTEMS=="usb", \ IMPORT{program}="usb_id --export $devpath" @@ -32,10 +32,12 @@ KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", \ KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", \ SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" -KERNEL=="st*[0-9]", \ +KERNEL=="st*[0-9]|nst*[0-9]", \ IMPORT{program}="path_id $devpath" KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", \ SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", \ + SYMLINK+="tape/by-path/$env{ID_PATH}-nst" # end of processing LABEL="persistent_storage_tape_end" -- cgit v1.2.3-54-g00ecf From 282988c4f8a85c28468e6442e86efe51dc71cc93 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Jul 2008 15:56:03 +0200 Subject: move default rules from /etc/udev/rules.d/ to /lib/udev/rules.d/ None of these rules is supposed to be changed by users, so move them out of /etc. Custom rules, and automatically generated rules stay in /etc. All rules are still processed in lexical order, regardless which directory they live in. --- Makefile | 11 +- etc/udev/debian/50-udev.rules | 98 ------ etc/udev/debian/60-persistent-input.rules | 41 --- etc/udev/debian/60-persistent-storage-tape.rules | 44 --- etc/udev/debian/60-persistent-storage.rules | 109 ------- etc/udev/debian/60-persistent-v4l.rules | 17 -- etc/udev/debian/75-cd-aliases-generator.rules | 11 - etc/udev/debian/75-persistent-net-generator.rules | 86 ------ etc/udev/debian/80-drivers.rules | 57 ---- etc/udev/debian/91-permissions.rules | 130 -------- etc/udev/debian/95-late.rules | 18 -- etc/udev/frugalware/50-udev-default.rules | 198 ------------ etc/udev/frugalware/64-device-mapper.rules | 15 - etc/udev/gentoo/30-kernel-compat.rules | 47 --- etc/udev/gentoo/40-gentoo.rules | 12 - etc/udev/gentoo/40-video.rules | 24 -- etc/udev/gentoo/65-permissions.rules | 26 -- etc/udev/gentoo/90-network.rules | 8 - etc/udev/packages/40-alsa.rules | 11 - etc/udev/packages/40-ia64.rules | 4 - etc/udev/packages/40-pilot-links.rules | 4 - etc/udev/packages/40-ppc.rules | 6 - etc/udev/packages/40-s390.rules | 4 - etc/udev/packages/40-zaptel.rules | 8 - etc/udev/packages/64-device-mapper.rules | 4 - etc/udev/packages/64-md-raid.rules | 22 -- etc/udev/redhat/40-redhat.rules | 25 -- etc/udev/redhat/95-pam-console.rules | 1 - etc/udev/rules.d/50-udev-default.rules | 107 ------- etc/udev/rules.d/60-persistent-input.rules | 32 -- etc/udev/rules.d/60-persistent-storage-tape.rules | 24 -- etc/udev/rules.d/60-persistent-storage.rules | 63 ---- etc/udev/rules.d/60-persistent-v4l.rules | 14 - etc/udev/rules.d/80-drivers.rules | 17 -- etc/udev/rules.d/95-udev-late.rules | 8 - etc/udev/slackware/udev.rules | 355 ---------------------- etc/udev/suse/40-suse.rules | 14 - etc/udev/suse/64-device-mapper.rules | 23 -- etc/udev/udev.conf | 7 - extras/cdrom_id/Makefile | 6 +- extras/edd_id/Makefile | 6 +- extras/fstab_import/Makefile | 4 +- extras/rule_generator/Makefile | 6 +- rules/debian/50-udev.rules | 98 ++++++ rules/debian/60-persistent-input.rules | 41 +++ rules/debian/60-persistent-storage-tape.rules | 44 +++ rules/debian/60-persistent-storage.rules | 109 +++++++ rules/debian/60-persistent-v4l.rules | 17 ++ rules/debian/75-cd-aliases-generator.rules | 11 + rules/debian/75-persistent-net-generator.rules | 86 ++++++ rules/debian/80-drivers.rules | 57 ++++ rules/debian/91-permissions.rules | 130 ++++++++ rules/debian/95-late.rules | 18 ++ rules/frugalware/50-udev-default.rules | 198 ++++++++++++ rules/frugalware/64-device-mapper.rules | 15 + rules/gentoo/30-kernel-compat.rules | 47 +++ rules/gentoo/40-gentoo.rules | 12 + rules/gentoo/40-video.rules | 24 ++ rules/gentoo/65-permissions.rules | 26 ++ rules/gentoo/90-network.rules | 8 + rules/packages/40-alsa.rules | 11 + rules/packages/40-ia64.rules | 4 + rules/packages/40-pilot-links.rules | 4 + rules/packages/40-ppc.rules | 6 + rules/packages/40-s390.rules | 4 + rules/packages/40-zaptel.rules | 8 + rules/packages/64-device-mapper.rules | 4 + rules/packages/64-md-raid.rules | 22 ++ rules/redhat/40-redhat.rules | 25 ++ rules/redhat/95-pam-console.rules | 1 + rules/rules.d/50-udev-default.rules | 107 +++++++ rules/rules.d/60-persistent-input.rules | 32 ++ rules/rules.d/60-persistent-storage-tape.rules | 24 ++ rules/rules.d/60-persistent-storage.rules | 63 ++++ rules/rules.d/60-persistent-v4l.rules | 14 + rules/rules.d/80-drivers.rules | 17 ++ rules/rules.d/95-udev-late.rules | 8 + rules/slackware/udev.rules | 355 ++++++++++++++++++++++ rules/suse/40-suse.rules | 14 + rules/suse/64-device-mapper.rules | 23 ++ test/udev-test.pl | 6 +- udev.7 | 21 +- udev.conf | 4 + udev.h | 3 + udev.xml | 23 +- udev_config.c | 6 +- udev_rules_parse.c | 68 ++--- udevd.c | 25 +- 88 files changed, 1782 insertions(+), 1788 deletions(-) delete mode 100644 etc/udev/debian/50-udev.rules delete mode 100644 etc/udev/debian/60-persistent-input.rules delete mode 100644 etc/udev/debian/60-persistent-storage-tape.rules delete mode 100644 etc/udev/debian/60-persistent-storage.rules delete mode 100644 etc/udev/debian/60-persistent-v4l.rules delete mode 100644 etc/udev/debian/75-cd-aliases-generator.rules delete mode 100644 etc/udev/debian/75-persistent-net-generator.rules delete mode 100644 etc/udev/debian/80-drivers.rules delete mode 100644 etc/udev/debian/91-permissions.rules delete mode 100644 etc/udev/debian/95-late.rules delete mode 100644 etc/udev/frugalware/50-udev-default.rules delete mode 100644 etc/udev/frugalware/64-device-mapper.rules delete mode 100644 etc/udev/gentoo/30-kernel-compat.rules delete mode 100644 etc/udev/gentoo/40-gentoo.rules delete mode 100644 etc/udev/gentoo/40-video.rules delete mode 100644 etc/udev/gentoo/65-permissions.rules delete mode 100644 etc/udev/gentoo/90-network.rules delete mode 100644 etc/udev/packages/40-alsa.rules delete mode 100644 etc/udev/packages/40-ia64.rules delete mode 100644 etc/udev/packages/40-pilot-links.rules delete mode 100644 etc/udev/packages/40-ppc.rules delete mode 100644 etc/udev/packages/40-s390.rules delete mode 100644 etc/udev/packages/40-zaptel.rules delete mode 100644 etc/udev/packages/64-device-mapper.rules delete mode 100644 etc/udev/packages/64-md-raid.rules delete mode 100644 etc/udev/redhat/40-redhat.rules delete mode 100644 etc/udev/redhat/95-pam-console.rules delete mode 100644 etc/udev/rules.d/50-udev-default.rules delete mode 100644 etc/udev/rules.d/60-persistent-input.rules delete mode 100644 etc/udev/rules.d/60-persistent-storage-tape.rules delete mode 100644 etc/udev/rules.d/60-persistent-storage.rules delete mode 100644 etc/udev/rules.d/60-persistent-v4l.rules delete mode 100644 etc/udev/rules.d/80-drivers.rules delete mode 100644 etc/udev/rules.d/95-udev-late.rules delete mode 100644 etc/udev/slackware/udev.rules delete mode 100644 etc/udev/suse/40-suse.rules delete mode 100644 etc/udev/suse/64-device-mapper.rules delete mode 100644 etc/udev/udev.conf create mode 100644 rules/debian/50-udev.rules create mode 100644 rules/debian/60-persistent-input.rules create mode 100644 rules/debian/60-persistent-storage-tape.rules create mode 100644 rules/debian/60-persistent-storage.rules create mode 100644 rules/debian/60-persistent-v4l.rules create mode 100644 rules/debian/75-cd-aliases-generator.rules create mode 100644 rules/debian/75-persistent-net-generator.rules create mode 100644 rules/debian/80-drivers.rules create mode 100644 rules/debian/91-permissions.rules create mode 100644 rules/debian/95-late.rules create mode 100644 rules/frugalware/50-udev-default.rules create mode 100644 rules/frugalware/64-device-mapper.rules create mode 100644 rules/gentoo/30-kernel-compat.rules create mode 100644 rules/gentoo/40-gentoo.rules create mode 100644 rules/gentoo/40-video.rules create mode 100644 rules/gentoo/65-permissions.rules create mode 100644 rules/gentoo/90-network.rules create mode 100644 rules/packages/40-alsa.rules create mode 100644 rules/packages/40-ia64.rules create mode 100644 rules/packages/40-pilot-links.rules create mode 100644 rules/packages/40-ppc.rules create mode 100644 rules/packages/40-s390.rules create mode 100644 rules/packages/40-zaptel.rules create mode 100644 rules/packages/64-device-mapper.rules create mode 100644 rules/packages/64-md-raid.rules create mode 100644 rules/redhat/40-redhat.rules create mode 100644 rules/redhat/95-pam-console.rules create mode 100644 rules/rules.d/50-udev-default.rules create mode 100644 rules/rules.d/60-persistent-input.rules create mode 100644 rules/rules.d/60-persistent-storage-tape.rules create mode 100644 rules/rules.d/60-persistent-storage.rules create mode 100644 rules/rules.d/60-persistent-v4l.rules create mode 100644 rules/rules.d/80-drivers.rules create mode 100644 rules/rules.d/95-udev-late.rules create mode 100644 rules/slackware/udev.rules create mode 100644 rules/suse/40-suse.rules create mode 100644 rules/suse/64-device-mapper.rules create mode 100644 udev.conf diff --git a/Makefile b/Makefile index 075389b6ea..ed2b381d07 100644 --- a/Makefile +++ b/Makefile @@ -190,9 +190,7 @@ udev_version.h: $(E) " GENHDR " $@ $(Q) echo "/* Generated by make. */" > $@ $(Q) echo \#define UDEV_VERSION \"$(VERSION)\" >> $@ - $(Q) echo \#define UDEV_ROOT \"$(udevdir)\" >> $@ $(Q) echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ - $(Q) echo \#define UDEV_RULES_DIR \"$(configdir)/rules.d\" >> $@ # man pages %.8 %.7: %.xml @@ -220,15 +218,12 @@ clean: .PHONY: clean install-config: + $(INSTALL) -d $(DESTDIR)$(libudevdir)/rules.d $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d @ if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ - $(INSTALL_DATA) etc/udev/udev.conf $(DESTDIR)$(configdir); \ + $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir); \ fi - @ for i in etc/udev/rules.d/*.rules; do \ - if [ ! -r $(DESTDIR)$(configdir)/rules.d/$$(basename $$i) ]; then \ - $(INSTALL_DATA) $$i $(DESTDIR)$(configdir)/rules.d; \ - fi \ - done + cp rules/rules.d/* $(DESTDIR)$(libudevdir)/rules.d @ extras="$(EXTRAS)"; for target in $$extras; do \ $(MAKE) -C $$target $@ || exit 1; \ done; diff --git a/etc/udev/debian/50-udev.rules b/etc/udev/debian/50-udev.rules deleted file mode 100644 index e3a10701cf..0000000000 --- a/etc/udev/debian/50-udev.rules +++ /dev/null @@ -1,98 +0,0 @@ -# import the properties of optical drives -KERNEL=="hd[a-z]|pcd[0-9]*", ACTION=="add|change", DRIVERS=="ide-cdrom|pcd", \ - IMPORT{program}="cdrom_id --export $tempnode" -KERNEL=="sr[0-9]*", ACTION=="add|change", \ - IMPORT{program}="cdrom_id --export $tempnode" - -# workarounds for devices which do not report media changes -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ - ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" -SUBSYSTEMS=="scsi", KERNEL=="sd[a-z]", ATTR{removable}=="1", \ - ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", \ - ATTRS{media}=="floppy", OPTIONS+="all_partitions" - -# SCSI devices -SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" -SUBSYSTEM=="bsg", NAME="bsg/%k" - -# USB devices -SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="iowarrior[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ - ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", \ - SYMLINK+="pilot" - -# usbfs-like devices -SUBSYSTEM=="usb_device", ACTION=="add", \ - PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ - NAME="$result" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" - -# serial devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi[0-9]*", NAME="capi/%n" - -# video devices -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ - NAME="$result" -KERNEL=="card[0-9]*", NAME="dri/%k" - -# misc devices -KERNEL=="hw_random", NAME="hwrng" -KERNEL=="tun", NAME="net/%k" -KERNEL=="evtchn", NAME="xen/%k" -KERNEL=="rtc0", SYMLINK+="rtc" - -KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL=="pktcdvd", NAME="pktcdvd/control" - -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode" - -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" -KERNEL=="uverbs*", NAME="infiniband/%k" -KERNEL=="ucm*", NAME="infiniband/%k" -KERNEL=="rdma_cm", NAME="infiniband/%k" - -# ALSA devices -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# ieee1394 devices -KERNEL=="dv1394*", NAME="dv1394/%n" -KERNEL=="video1394*", NAME="video1394/%n" - -# input devices -KERNEL=="mice", NAME="input/%k" -KERNEL=="mouse[0-9]*", NAME="input/%k" -KERNEL=="event[0-9]*", NAME="input/%k" -KERNEL=="js[0-9]*", NAME="input/%k" -KERNEL=="ts[0-9]*", NAME="input/%k" -KERNEL=="uinput", NAME="input/%k" - -# Zaptel -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="transcode", NAME="zap/transcode" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -# AOE character devices -SUBSYSTEM=="aoe", NAME="etherd/%k" - -KERNEL=="device-mapper", NAME="mapper/control" - diff --git a/etc/udev/debian/60-persistent-input.rules b/etc/udev/debian/60-persistent-input.rules deleted file mode 100644 index 8f49d250b1..0000000000 --- a/etc/udev/debian/60-persistent-input.rules +++ /dev/null @@ -1,41 +0,0 @@ -SUBSYSTEM!="input", GOTO="persistent_input_end" -ACTION!="add|change", GOTO="persistent_input_end" -# ignore the mid-level drivers -KERNEL=="input[0-9]*", GOTO="persistent_input_end" - -# usb devices -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" -SUBSYSTEMS=="usb", \ - ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", \ - ENV{ID_CLASS}="kbd" -SUBSYSTEMS=="usb", \ - ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", \ - ENV{ID_CLASS}="mouse" - -# other devices -DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" -DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" -DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" -ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" -# this means (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH -ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", \ - ATTRS{modalias}!="input:*-*k*14A,*r*", \ - ENV{ID_CLASS}="joystick" - -ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" - -# by-id links, generic and for the event devices -KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ - SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ - SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" - -# by-path links -IMPORT{program}="path_id $devpath" -KERNEL=="mouse*|js*", ENV{ID_PATH}=="?*", \ - SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_PATH}=="?*", \ - SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" - -LABEL="persistent_input_end" - diff --git a/etc/udev/debian/60-persistent-storage-tape.rules b/etc/udev/debian/60-persistent-storage-tape.rules deleted file mode 100644 index 94a0b816d4..0000000000 --- a/etc/udev/debian/60-persistent-storage-tape.rules +++ /dev/null @@ -1,44 +0,0 @@ -# This file contains the rules needed to create persistent device names. - -# we are only interested in add and change actions for block devices -ACTION!="add|change", GOTO="persistent_storage_tape_end" - -# "Medium Changers" -KERNEL=="sg[0-9]*", \ - SUBSYSTEMS=="scsi", ATTRS{type}=="8", \ - IMPORT{program}="scsi_id --export --sg-version=3 --whitelisted --device=$tempnode" - -KERNEL=="sg[0-9]*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" - -SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" - -KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", \ - ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="usb", \ - IMPORT{program}="usb_id --export $devpath" - -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", \ - ENV{BSG_DEV}="$root/bsg/$id" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ - WAIT_FOR="$env{BSG_DEV}", \ - ENV{ID_BUS}="scsi", \ - IMPORT{program}="scsi_id --export --device=$env{BSG_DEV}" - -KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" - -KERNEL=="st*[0-9]|nst*[0-9]", \ - IMPORT{program}="path_id $devpath" -KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="tape/by-path/$env{ID_PATH}-nst" - -# end of processing -LABEL="persistent_storage_tape_end" - diff --git a/etc/udev/debian/60-persistent-storage.rules b/etc/udev/debian/60-persistent-storage.rules deleted file mode 100644 index 65e7204531..0000000000 --- a/etc/udev/debian/60-persistent-storage.rules +++ /dev/null @@ -1,109 +0,0 @@ -# This file contains the rules needed to create persistent device names. - -# forward scsi device events to the corresponding block device -ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", \ - TEST=="block", ATTR{block/*/uevent}="change" - -# we are only interested in add and change actions for block devices -ACTION!="add|change", GOTO="persistent_storage_end" -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# and we can safely ignore these kinds of devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" - -# skip removable ide devices, because open(2) on them causes an events loop -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ - GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", ATTRS{removable}=="1", \ - GOTO="persistent_storage_end" - -# ignore partitions that span the entire disk -TEST=="whole_disk", GOTO="persistent_storage_end" - -# skip xen virtual hard disks -DRIVERS=="vbd", GOTO="no_hardware_id" - -# check these attributes of /sys/class/block nodes -ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" -ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" - -# look for different kinds of unique identificators -KERNEL=="hd*[!0-9]", \ - IMPORT{program}="ata_id --export $tempnode" - -KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", \ - ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="usb", \ - IMPORT{program}="usb_id --export $devpath" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ - ENV{ID_BUS}="scsi", \ - IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" -KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", \ - ENV{ID_BUS}="cciss", \ - IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" - -KERNEL=="dasd*[!0-9]", \ - IMPORT{program}="dasd_id --export $tempnode" - -KERNEL=="sd*[!0-9]|hd*[!0-9]", \ - IMPORT{program}="edd_id --export $tempnode" - -KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", \ - PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result" - -# find the physical path of the device -ENV{DEVTYPE}=="disk", IMPORT{program}="path_id $devpath" - -LABEL="no_hardware_id" - -# import the variables of partitions from the parent disks -ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" - -# obsolete PATA driver -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -# hd*-like compatibility links for libata and PATA devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" -KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" - -KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ - ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ - SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ - ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ - SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" - -ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -KERNEL=="sd*[!0-9]|sr*|dasd[!0-9]*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|dasd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", \ - SYMLINK+="disk/by-path/$env{ID_PATH}" -ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", \ - SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# skip unpartitioned removable media devices from drivers which do not send -# "change" events -ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", \ - GOTO="persistent_storage_end" - -# UUID and volume label -IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_UUID_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ - SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_LABEL_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ - SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="persistent_storage_end" - diff --git a/etc/udev/debian/60-persistent-v4l.rules b/etc/udev/debian/60-persistent-v4l.rules deleted file mode 100644 index 5a317b6c18..0000000000 --- a/etc/udev/debian/60-persistent-v4l.rules +++ /dev/null @@ -1,17 +0,0 @@ -ACTION!="add|change", GOTO="persistent_v4l_end" -SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" - -# ignore devices without a valid "index" number -TEST!="index", GOTO="persistent_v4l_end" -ATTR{index}!="?*", GOTO="persistent_v4l_end" - -IMPORT{program}="path_id $devpath" - -KERNEL=="video*|vbi*", ENV{ID_PATH}=="?*", \ - SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" - -KERNEL=="audio*", ENV{ID_PATH}=="?*", \ - SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" - -LABEL="persistent_v4l_end" - diff --git a/etc/udev/debian/75-cd-aliases-generator.rules b/etc/udev/debian/75-cd-aliases-generator.rules deleted file mode 100644 index 6b178a0ae7..0000000000 --- a/etc/udev/debian/75-cd-aliases-generator.rules +++ /dev/null @@ -1,11 +0,0 @@ -# These rules generate rules for the /dev/{cdrom,dvd,...} symlinks and -# write them to /etc/udev/rules.d/70-persistent-cd.rules. - -ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ - SUBSYSTEMS!="usb|ieee1394", \ - PROGRAM="write_cd_rules", SYMLINK+="$result" - -ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ - SUBSYSTEMS=="usb|ieee1394", \ - PROGRAM="write_cd_rules by-id", SYMLINK+="$result" - diff --git a/etc/udev/debian/75-persistent-net-generator.rules b/etc/udev/debian/75-persistent-net-generator.rules deleted file mode 100644 index e8d3b888e0..0000000000 --- a/etc/udev/debian/75-persistent-net-generator.rules +++ /dev/null @@ -1,86 +0,0 @@ -# These rules generate rules to keep network interface names unchanged -# across reboots write them to /etc/udev/rules.d/70-persistent-net.rules. - -# variables used to communicate: -# MATCHADDR MAC address used for the match -# MATCHID bus_id used for the match -# MATCHDRV driver name used for the match -# MATCHIFTYPE interface type match -# COMMENT comment to add to the generated rule -# INTERFACE_NAME requested name supplied by external tool -# INTERFACE_NEW new interface name returned by rule writer - -ACTION!="add", GOTO="persistent_net_generator_end" -SUBSYSTEM!="net", GOTO="persistent_net_generator_end" - -# ignore the interface if a name has already been set -NAME=="?*", GOTO="persistent_net_generator_end" - -# ignore interfaces without a driver link like bridges and VLANs -DRIVERS!="?*", GOTO="persistent_net_generator_end" - -# device name whitelist -KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ - GOTO="persistent_net_generator_end" - -# ignore Xen virtual interfaces -SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" - -# ignore UML virtual interfaces -DRIVERS=="uml-netdev", GOTO="persistent_net_generator_end" - -# ignore "secondary" raw interfaces of the madwifi driver -KERNEL=="ath*", ATTRS{type}=="802", GOTO="persistent_net_generator_end" - -# ignore "secondary" monitor interfaces of mac80211 drivers -KERNEL=="wlan*", ATTRS{type}=="803", GOTO="persistent_net_generator_end" - -# by default match on the MAC address and interface type -ENV{MATCHADDR}="$attr{address}" -ENV{MATCHIFTYPE}="$attr{type}" - -# ignore interfaces with locally administered or null MAC addresses -# and VMWare virtual interfaces -ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" -ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" -ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", ENV{MATCHADDR}="" - -# ibmveth interfaces have stable locally administered MAC addresses -SUBSYSTEMS=="ibmveth", ENV{MATCHADDR}="$attr{address}" - -# S/390 interfaces are matched only by id -SUBSYSTEMS=="ccwgroup", \ - ENV{MATCHDRV}="$driver", ENV{MATCHID}="$id", ENV{MATCHADDR}="" - -# terminate processing if there are not enough conditions to create a rule -ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", \ - GOTO="persistent_net_generator_end" - - -# provide nice comments for the generated rules -SUBSYSTEMS=="pci", \ - ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}" -SUBSYSTEMS=="pcmcia", \ - ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id}" -SUBSYSTEMS=="usb", \ - ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct}" -SUBSYSTEMS=="ccwgroup", \ - ENV{COMMENT}="S/390 device at $id" -SUBSYSTEMS=="ibmveth", \ - ENV{COMMENT}="LPAR virtual device at $id" -SUBSYSTEMS=="ieee1394", \ - ENV{COMMENT}="Firewire device $attr{host_id}" -ENV{COMMENT}=="", \ - ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})" -ATTRS{driver}=="?*", \ - ENV{COMMENT}="$env{COMMENT} ($attr{driver})" - - -# generate and write the rule -IMPORT{program}="write_net_rules" - -# rename the interface if requested -ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" - -LABEL="persistent_net_generator_end" - diff --git a/etc/udev/debian/80-drivers.rules b/etc/udev/debian/80-drivers.rules deleted file mode 100644 index edfcfa5394..0000000000 --- a/etc/udev/debian/80-drivers.rules +++ /dev/null @@ -1,57 +0,0 @@ -ACTION!="add", GOTO="hotplug_not_add_event" - -# check if the device has already been claimed by a driver -ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" - -# this driver is broken and should not be loaded automatically on kernels -# < 2.6.21 (see #398962) -SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_driver_loaded" - -# load the drivers -ENV{MODALIAS}=="?*", \ - RUN+="/sbin/modprobe --use-blacklist $env{MODALIAS}" - -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ - RUN+="/bin/sh -c '/sbin/modprobe --use-blacklist --all $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" - -SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" - -# rules for subsystems which lack proper hotplug support -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" -SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe tifm_ms" - -# needed for kernels < 2.6.22 -SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe osst", \ - ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ - ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ - ATTRS{vendor}!="Onstream" -SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ATTRS{type}=="8", RUN+="/sbin/modprobe ch" - -SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", TEST!="[module/sg]", \ - RUN+="/sbin/modprobe sg" - -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" - -# From here on follows the hotplug agents which do not load modules -LABEL="hotplug_driver_loaded" - -# FIXME: does a sane default exist? -#SUBSYSTEM=="scsi_device", ATTRS{idVendor}=="...", \ -# RUN+="scsi-re-add" - -SUBSYSTEM=="firmware", RUN+="firmware.agent" - -LABEL="hotplug_not_add_event" - -SUBSYSTEM=="net", RUN+="net.agent" - -# Log every event to /dev/hotplug.log (for debugging). -#RUN+="logger.agent" - diff --git a/etc/udev/debian/91-permissions.rules b/etc/udev/debian/91-permissions.rules deleted file mode 100644 index 5182a4bd28..0000000000 --- a/etc/udev/debian/91-permissions.rules +++ /dev/null @@ -1,130 +0,0 @@ -ACTION!="add", GOTO="permissions_end" - -# devices needed to load the drivers providing them -KERNEL=="tun", OPTIONS+="ignore_remove" -KERNEL=="ppp", OPTIONS+="ignore_remove" -KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" - -# default permissions for block devices -SUBSYSTEM=="block", GROUP="disk" -# the aacraid driver is broken and reports that disks removable (see #404927) -SUBSYSTEM=="block", ATTRS{removable}=="1", \ - DRIVERS!="aacraid", GROUP="floppy" -# all block devices on these buses are "removable" -SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" - -KERNEL=="cbm", GROUP="floppy" - -# IDE devices -ENV{ID_CDROM}=="?*", GROUP="cdrom" -KERNEL=="ht[0-9]*", GROUP="tape" -KERNEL=="nht[0-9]*", GROUP="tape" - -# SCSI devices -SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" -SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" -SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" -SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" - -# USB devices -KERNEL=="legousbtower*", MODE="0666" -KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" - -# usbfs-like devices -SUBSYSTEM=="usb_device", MODE="0664" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ - MODE="0664" - -# iRiver music players -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ - ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" - -# serial devices -SUBSYSTEM=="tty", GROUP="dialout" -SUBSYSTEM=="capi", GROUP="dialout" -SUBSYSTEM=="slamr", GROUP="dialout" -SUBSYSTEM=="zaptel", GROUP="dialout" - -# vc devices (all members of the tty subsystem) -KERNEL=="ptmx", MODE="0666", GROUP="root" -KERNEL=="console", MODE="0600", GROUP="root" -KERNEL=="tty", MODE="0666", GROUP="root" -KERNEL=="tty[0-9]*", GROUP="root" -KERNEL=="pty*", MODE="0666", GROUP="tty" - -# video devices -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="drm", GROUP="video" -SUBSYSTEM=="dvb", GROUP="video" -SUBSYSTEM=="em8300", GROUP="video" -SUBSYSTEM=="graphics", GROUP="video" -SUBSYSTEM=="nvidia", GROUP="video" - -# misc devices -KERNEL=="random", MODE="0666" -KERNEL=="urandom", MODE="0666" -KERNEL=="mem", MODE="0640", GROUP="kmem" -KERNEL=="kmem", MODE="0640", GROUP="kmem" -KERNEL=="port", MODE="0640", GROUP="kmem" -KERNEL=="full", MODE="0666" -KERNEL=="null", MODE="0666" -KERNEL=="zero", MODE="0666" -KERNEL=="inotify", MODE="0666" -KERNEL=="sonypi", MODE="0666" -KERNEL=="agpgart", GROUP="video" -KERNEL=="nvram", GROUP="nvram" -KERNEL=="rtc|rtc[0-9]*", GROUP="audio" -KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" -KERNEL=="fuse", GROUP="fuse" -KERNEL=="kqemu", MODE="0666" -KERNEL=="kvm", GROUP="kvm" -KERNEL=="tun", MODE="0666" - -KERNEL=="cdemu[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd", MODE="0644" - -KERNEL=="uverbs*", GROUP="rdma" -KERNEL=="ucm*", GROUP="rdma" -KERNEL=="rdma_cm", GROUP="rdma" - -# printers and parallel devices -SUBSYSTEM=="printer", GROUP="lp" -SUBSYSTEM=="ppdev", GROUP="lp" -KERNEL=="irlpt*", GROUP="lp" -KERNEL=="pt[0-9]*", GROUP="tape" -KERNEL=="pht[0-9]*", GROUP="tape" - -# sound devices -SUBSYSTEM=="sound", GROUP="audio" - -# ieee1394 devices -KERNEL=="raw1394", GROUP="disk" -KERNEL=="dv1394*", GROUP="video" -KERNEL=="video1394*", GROUP="video" - -# input devices -KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ - MODE="0664", GROUP="video" -KERNEL=="js[0-9]*", MODE="0664" -KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", \ - MODE="0664", GROUP="audio" -KERNEL=="lirc[0-9]*", GROUP="video" - -KERNEL=="sgi_*", MODE="0666" -KERNEL=="z90crypt", MODE="0666" -KERNEL=="iseries/ibmsis*", GROUP="disk" -KERNEL=="iseries/nvt*", GROUP="disk" -KERNEL=="iseries/vt*", GROUP="disk" -KERNEL=="iseries/vtty*", GROUP="dialout" - -# AOE character devices -SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" -SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440", GROUP="disk" - -LABEL="permissions_end" - diff --git a/etc/udev/debian/95-late.rules b/etc/udev/debian/95-late.rules deleted file mode 100644 index 622e019ef3..0000000000 --- a/etc/udev/debian/95-late.rules +++ /dev/null @@ -1,18 +0,0 @@ -# run a command on remove events -ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" - -# ignore the events generated by virtual consoles -KERNEL=="ptmx", OPTIONS+="last_rule" -KERNEL=="console", OPTIONS+="last_rule" -KERNEL=="tty" , OPTIONS+="last_rule" -KERNEL=="tty[0-9]*", OPTIONS+="last_rule" -KERNEL=="pty*", OPTIONS+="last_rule" -SUBSYSTEM=="vc", OPTIONS+="last_rule" - -# do not delete static device nodes -ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", \ - OPTIONS+="ignore_remove" - -# debugging monitor -RUN+="socket:/org/kernel/udev/monitor" - diff --git a/etc/udev/frugalware/50-udev-default.rules b/etc/udev/frugalware/50-udev-default.rules deleted file mode 100644 index 89ffd7b442..0000000000 --- a/etc/udev/frugalware/50-udev-default.rules +++ /dev/null @@ -1,198 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# See the udev.rules.examples file for more examples of how to create rules -# - -# permissions for IDE CD devices -SUBSYSTEMS=="ide", KERNEL=="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom*", NAME="%k", GROUP="cdrom", MODE="0660" - -# permissions for SCSI cd/sg/tape devices -SUBSYSTEMS=="scsi", KERNEL=="s[grt][0-9]*", ATTRS{type}=="5", NAME="%k", GROUP="cdrom", MODE="0660" - -# USB devices -KERNEL=="hiddev*", NAME="usb/%k" -KERNEL=="auer*", NAME="usb/%k" -KERNEL=="legousbtower*", NAME="usb/%k" -KERNEL=="dabusb*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" - -# CAPI devices -KERNEL=="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# Network devices -KERNEL=="tun", NAME="net/%k" - -# permissions -KERNEL=="pl2303", NAME="%k", OWNER="500", GROUP="500", MODE="0666" -KERNEL=="visor", NAME="%k", OWNER="root", GROUP="uucp", MODE="0666" -KERNEL=="camera*", NAME="%k", OWNER="root", GROUP="camera", MODE="0666" - -# console devices -KERNEL=="console", NAME="%k", OWNER="root", GROUP="tty", MODE="0600" -KERNEL=="tty", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="tty[0-9]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" -KERNEL=="vcs*", NAME="%k", OWNER="root", GROUP="tty", MODE="0620" -KERNEL=="tty[CIS]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" -KERNEL=="ttyUB[0-9]", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB0", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB1", NAME="%k", OWNER="root" GROUP="uucp", MODE="0666" - -# pty devices -KERNEL=="ptmx", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="pty[p-za-e][0-9a-f]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="tty[p-za-e][0-9a-f]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="cu[abiu]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" - -# sound devices -KERNEL=="audio*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="beep", NAME="%k", OWNER="root", GROUP="audio", MODE="0644" -KERNEL=="dsp*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="midi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="mixer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="music", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="sequencer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="controlC[0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="hw[CD0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="midiC[D0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="timer", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="seq", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="sndstat", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="speaker", NAME="%k", OWNER="root", GROUP="audio", MODE="0644" -KERNEL=="sound/*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="admmidi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="adsp*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="aload*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="amidi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="amixer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" - -# input devices (mouse, joystick, etc) -KERNEL=="mice", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="mouse*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="event*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="js*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="ts*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="input/js*", NAME="%k", OWNER="root", GROUP="games",0 MODE="0666" -KERNEL=="djs[0-3]", NAME="%k", OWNER="root", GROUP="games", MODE="0660" -KERNEL=="psaux", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="crash", NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="logibm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="jbm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="hwtrap", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="inportbm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="sexec", NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="jsflash", NAME="%k", OWNER="root", GROUP="root", MODE="0660" - -# power manager device -KERNEL=="apm_bios", NAME="%k", OWNER="root", GROUP="root", MODE="0644" - -# printer device -KERNEL=="lp[0-9]", NAME="%k", OWNER="root", GROUP="lp", MODE="0660" -KERNEL=="parport*", NAME="%k", OWNER="root", GROUP="lp", MODE="0660" - -# video devices -KERNEL=="card*", NAME="dri/card%n", OWNER="root", GROUP="video", MODE="0666" -KERNEL=="fb[0-9]", NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="agpgart", NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="nvidia*", NAME="%k", OWNER="root", GROUP="video", MODE="0666" -KERNEL=="video*", NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="vbi*", NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; A=$${K%%%%.*}; D=$${K#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video", MODE="0660" - -# DISK devices -KERNEL=="ed[ab]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="gscd0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="initrd", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="lmscd", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="mcd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="md*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="mtd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="userdma", NAME="%k", OWNER="root", GROUP="root", MODE="0660" - -# floppy devices -KERNEL=="fd[0-3]*", NAME="%k", OWNER="root", GROUP="floppy", MODE="0660" -KERNEL=="fd0", SYMLINK="floppy" - -# permissions for removable devices like cardreaders or sticks -KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="0", NAME="%k", GROUP="storage" - -# permissions for firewire external drives -KERNEL=="sd*", ATTRS{scsi_level}=="5", NAME="%k", GROUP="storage" - -# permissions for usb to scsi external adapters -KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="7", NAME="%k", GROUP="storage" - -# IDE devices (hd, cdrom) -KERNEL=="hd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="ht0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" - -# RAID IDE -KERNEL=="ataraid[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="ataraid/*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" - -# SCSI devices -KERNEL=="scsi/*/cd", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="scsi/*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="sd[a-h]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="s[rt][0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="scd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" - -# generic scsi devices -KERNEL=="sg*", NAME="%k", OWNER="root", GROUP="root", MODE="0600" - -# old CD-ROM -KERNEL=="sbpcd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" - -# loop devices -KERNEL=="loop[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" - -# network block devices -KERNEL=="nb[0-7]", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="nht0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="npt[0-3]", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="n[qrs]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" - -# memory access devices -KERNEL=="kmem", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL=="mem", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL=="null", NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL=="nvram", NAME="%k", OWNER="root", GROUP="root", MODE="0640" -KERNEL=="port", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL=="ram[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="random", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="rtc", NAME="%k", OWNER="root", GROUP="root", MODE="0444" -KERNEL=="urandom", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="full", NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL=="zero", NAME="%k", OWNER="root", GROUP="root", MODE="0666" -KERNEL=="raw[0-9]*", NAME="raw/%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="modreq", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="msr", NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="profile*", NAME="%k", OWNER="root", GROUP="root", MODE="0640" - -# ISDN devices -KERNEL=="isdn*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" - -# net devices -KERNEL=="ippp*", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="ipstate*", NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="spx", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="fwmonitor*", NAME="%k", OWNER="root", GROUP="root", MODE="0660" - -# hotplug rules - module autoloading for different buses -ACTION=="add", SUBSYSTEM=="pci", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" -ACTION=="add", SUBSYSTEM=="usb", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" -ACTION=="add", SUBSYSTEM=="ieee1394", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[07]", RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="14", RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*", RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}!="Onstream", RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[23689]", RUN+="/sbin/modprobe sg" - -# firmware -ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN+="/lib/udev/firmware.sh" diff --git a/etc/udev/frugalware/64-device-mapper.rules b/etc/udev/frugalware/64-device-mapper.rules deleted file mode 100644 index 3837d3f2c7..0000000000 --- a/etc/udev/frugalware/64-device-mapper.rules +++ /dev/null @@ -1,15 +0,0 @@ -# device mapper links hook into "online" event, when the dm table -# is available, while some table types must be ignored - -KERNEL=="dm-*", ACTION=="add|online", GOTO="device_mapper_do" -GOTO="device_mapper_end" - -LABEL="device_mapper_do" -PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" -RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" - -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -LABEL="device_mapper_end" diff --git a/etc/udev/gentoo/30-kernel-compat.rules b/etc/udev/gentoo/30-kernel-compat.rules deleted file mode 100644 index 1f767df8d8..0000000000 --- a/etc/udev/gentoo/30-kernel-compat.rules +++ /dev/null @@ -1,47 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="kernel_compat_end" - -# workarounds needed to synchronize with sysfs -DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" - -# needed for kernels <2.6.16 -SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" - -# needed for kernels <2.6.17 -SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" - - - -# needed for kernels <2.6.22 -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" - - - -# this driver is broken and should not be loaded automatically -# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=398962 -# needed for kernels <2.6.21 -SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", ENV{MODALIAS}="" - -# No need for more code, as MODALIAS is present -ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" - -# needed for kernels <2.6.22 -SUBSYSTEM!="scsi_device", GOTO="kernel_compat_end" - - # Parts taken from redhat-rules - # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC - # sr: 4 TYPE_WORM, 5 TYPE_ROM - # st/osst: 1 TYPE_TAPE - - ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" - ATTRS{type}=="4|5", RUN+="/sbin/modprobe sr_mod" - ATTRS{type}=="8", RUN+="/sbin/modprobe ch" - - ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst", GOTO="kernel_compat_end" - ATTRS{type}=="1", RUN+="/sbin/modprobe st" - -LABEL="kernel_compat_end" - - diff --git a/etc/udev/gentoo/40-gentoo.rules b/etc/udev/gentoo/40-gentoo.rules deleted file mode 100644 index 99a1c66c69..0000000000 --- a/etc/udev/gentoo/40-gentoo.rules +++ /dev/null @@ -1,12 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# capi devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# old devfs path, removing this could break systems -# Bug 195839 -KERNEL=="md[0-9]*", SYMLINK+="md/%n" -KERNEL=="loop[0-9]*", SYMLINK+="loop/%n" -KERNEL=="ram[0-9]*", SYMLINK+="rd/%n" - diff --git a/etc/udev/gentoo/40-video.rules b/etc/udev/gentoo/40-video.rules deleted file mode 100644 index 2d5e53411c..0000000000 --- a/etc/udev/gentoo/40-video.rules +++ /dev/null @@ -1,24 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# video4linux -KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="%k", GROUP="video" -KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="%k", GROUP="video" -KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="%k", GROUP="video" -KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" - -SUBSYSTEM=="dvb", GROUP="video" - -# device node will be /dev/dri/card? -KERNEL=="card*", GROUP="video" -KERNEL=="nvidia*", GROUP="video" -KERNEL=="3dfx*", GROUP="video" - -# svgalib -KERNEL=="svga*", GROUP="video" - -# Framebuffer -KERNEL=="fb[0-9]*", GROUP="video" - -# IEEE1394 (firewire) devices -KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" - diff --git a/etc/udev/gentoo/65-permissions.rules b/etc/udev/gentoo/65-permissions.rules deleted file mode 100644 index 494f19e63f..0000000000 --- a/etc/udev/gentoo/65-permissions.rules +++ /dev/null @@ -1,26 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb", MODE="664" - -# cdrom devices -ENV{ID_CDROM}=="?*", GROUP="cdrom", MODE="660" -KERNEL=="pktcdvd|pktcdvd[0-9]*", GROUP="cdrom", MODE="660" -# assign cdrom-permission also to associated generic device (for cd-burning ...) -SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[45]", GROUP="cdrom", MODE="660" - - -# tape devices -KERNEL=="st[0-9]*|nst[0-9]*|ht[0-9]*|nht[0-9]*|pt[0-9]*|npt[0-9]*", \ - GROUP="tape", MODE="660" -SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[18]", GROUP="tape", MODE="660" - -# dialout devices -KERNEL=="ippp*|isdn*|dcbri*|capi*", GROUP="uucp" -KERNEL=="pilot", GROUP="uucp" - -# sound devices (sound=alsa, snd=oss) -SUBSYSTEM=="sound|snd", GROUP="audio" - -# Sony Vaio Jogdial sonypi device -KERNEL=="sonypi", MODE="0666" - diff --git a/etc/udev/gentoo/90-network.rules b/etc/udev/gentoo/90-network.rules deleted file mode 100644 index 50903af157..0000000000 --- a/etc/udev/gentoo/90-network.rules +++ /dev/null @@ -1,8 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# /etc/udev/rules/90-network.rules: triggering network init-scripts - -# Activate our network if we can -SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start" -SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop" - diff --git a/etc/udev/packages/40-alsa.rules b/etc/udev/packages/40-alsa.rules deleted file mode 100644 index d30a1da8fc..0000000000 --- a/etc/udev/packages/40-alsa.rules +++ /dev/null @@ -1,11 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" -KERNEL=="mixer0", SYMLINK+="mixer" -KERNEL=="dsp0", SYMLINK+="dsp" -KERNEL=="audio0", SYMLINK+="audio" diff --git a/etc/udev/packages/40-ia64.rules b/etc/udev/packages/40-ia64.rules deleted file mode 100644 index 5846f88b1b..0000000000 --- a/etc/udev/packages/40-ia64.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="sgi_*", MODE="0666" - diff --git a/etc/udev/packages/40-pilot-links.rules b/etc/udev/packages/40-pilot-links.rules deleted file mode 100644 index 1242fff102..0000000000 --- a/etc/udev/packages/40-pilot-links.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="ttyUSB*", ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", SYMLINK+="pilot" - diff --git a/etc/udev/packages/40-ppc.rules b/etc/udev/packages/40-ppc.rules deleted file mode 100644 index 8b62d79e0c..0000000000 --- a/etc/udev/packages/40-ppc.rules +++ /dev/null @@ -1,6 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" -KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vtty*", GROUP="uucp" diff --git a/etc/udev/packages/40-s390.rules b/etc/udev/packages/40-s390.rules deleted file mode 100644 index 43035dbe60..0000000000 --- a/etc/udev/packages/40-s390.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="z90crypt", MODE="0666" - diff --git a/etc/udev/packages/40-zaptel.rules b/etc/udev/packages/40-zaptel.rules deleted file mode 100644 index 4313a9172e..0000000000 --- a/etc/udev/packages/40-zaptel.rules +++ /dev/null @@ -1,8 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="zap[0-9]*", NAME="zap/%n" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zaptimer", NAME="zap/timer" - diff --git a/etc/udev/packages/64-device-mapper.rules b/etc/udev/packages/64-device-mapper.rules deleted file mode 100644 index 8154ef3702..0000000000 --- a/etc/udev/packages/64-device-mapper.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="device-mapper", NAME="mapper/control" - diff --git a/etc/udev/packages/64-md-raid.rules b/etc/udev/packages/64-md-raid.rules deleted file mode 100644 index d0510b3095..0000000000 --- a/etc/udev/packages/64-md-raid.rules +++ /dev/null @@ -1,22 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM!="block", GOTO="md_end" -ACTION!="add|change", GOTO="md_end" - -# import data from a raid member and activate it -#ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}" -# import data from a raid set -KERNEL!="md*", GOTO="md_end" - -ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" - -IMPORT{program}="/sbin/mdadm --detail --export $tempnode" -ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" -ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" - -IMPORT{program}="vol_id --export $tempnode" -OPTIONS+="link_priority=100" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="md_end" diff --git a/etc/udev/redhat/40-redhat.rules b/etc/udev/redhat/40-redhat.rules deleted file mode 100644 index 446cc6d1d5..0000000000 --- a/etc/udev/redhat/40-redhat.rules +++ /dev/null @@ -1,25 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="hd*[!0-9]", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove" -KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", SYMLINK+="floppy-%k", OPTIONS+="ignore_remove" - -KERNEL=="fw*", PROGRAM="fw_unit_symlinks.sh %k %n", SYMLINK+="$result" - -ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="3|6", SYMLINK+="scanner scanner-%k", MODE="0660" - -ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" - -BUS=="usb", KERNEL=="sd*", ATTRS{bInterfaceClass}=="08", ATTRS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", SYMLINK+="floppy floppy-%k" - -KERNEL=="fd[0-9]*", SYMLINK+="floppy floppy-%k" - -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \ - RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \ - RUN+="/sbin/modprobe sr_mod" - -KERNEL=="vcs", OWNER="vcsa", GROUP="tty" -KERNEL=="vcs[0-9]*", OWNER="vcsa", GROUP="tty" -KERNEL=="vcsa", OWNER="vcsa", GROUP="tty" -KERNEL=="vcsa[0-9]*", OWNER="vcsa", GROUP="tty" -KERNEL=="vcc/*", OWNER="vcsa", GROUP="tty" diff --git a/etc/udev/redhat/95-pam-console.rules b/etc/udev/redhat/95-pam-console.rules deleted file mode 100644 index cbb2d4aaf9..0000000000 --- a/etc/udev/redhat/95-pam-console.rules +++ /dev/null @@ -1 +0,0 @@ -ENV{STARTUP}!="1", ACTION=="add", SYSFS{dev}=="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}" diff --git a/etc/udev/rules.d/50-udev-default.rules b/etc/udev/rules.d/50-udev-default.rules deleted file mode 100644 index 718d1899f5..0000000000 --- a/etc/udev/rules.d/50-udev-default.rules +++ /dev/null @@ -1,107 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" -KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS+="last_rule" -KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS+="last_rule" -KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", OPTIONS+="last_rule" -KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty", OPTIONS+="last_rule" -KERNEL=="console", MODE="0600", OPTIONS+="last_rule" - -# serial -KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" -KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" -KERNEL=="mwave", NAME="modems/mwave", GROUP="uucp" -KERNEL=="hvc*|hvsi*", GROUP="uucp" -KERNEL=="lirc0", SYMLINK+="lirc" - -# mem -KERNEL=="null|zero|full|random|urandom", MODE="0666" -KERNEL=="null", SYMLINK+="XOR" -KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" -KERNEL=="ram0", SYMLINK+="ramdisk" -KERNEL=="ram1", SYMLINK+="ram" - -# input -KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" -KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0600" -KERNEL=="js[0-9]*", NAME="input/%k", MODE="0644", SYMLINK+="%k" - -# video4linux -KERNEL=="vbi0", SYMLINK+="vbi" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="video0", SYMLINK+="video" - -# graphics -KERNEL=="agpgart", MODE="0600" -KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666" -KERNEL=="fb0", SYMLINK+="fb" - -# DVB video -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" - -# Firewire -KERNEL=="dv1394*", SYMLINK+="dv1394/%n" -KERNEL=="video1394*", NAME="video1394/%n" - -# firmware class requests -SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" - -# libusb device nodes -SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" - -# printer -KERNEL=="parport[0-9]*", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -KERNEL=="lp[0-9]*", GROUP="lp", SYMLINK+="par%n" -KERNEL=="irlpt[0-9]*", GROUP="lp" - -# block, tapes, block-releated -SUBSYSTEM=="block", GROUP="disk", MODE="0640" -SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" -KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" -KERNEL=="fd[0-9]", GROUP="floppy" -KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" -KERNEL=="sch[0-9]*", GROUP="disk" -KERNEL=="sg[0-9]*", ATTRS{type}!="3|6", GROUP="disk", MODE="0640" -KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk" -KERNEL=="pg[0-9]*", GROUP="disk" -KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" -KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" -KERNEL=="rawctl", NAME="raw/%k", GROUP="disk" -SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" -KERNEL=="pktcdvd", NAME="pktcdvd/control" -KERNEL=="qft0", SYMLINK+="ftape" -SUBSYSTEM=="bsg", NAME="bsg/%k" -SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk" - -# network -KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" - -# CPU -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" - -# miscellaneous -KERNEL=="fuse", MODE="0666" -KERNEL=="rtc|rtc0", MODE="0644" -KERNEL=="rtc0", SYMLINK+="rtc" -KERNEL=="auer[0-9]*", NAME="usb/%k" -KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" -KERNEL=="mmtimer", MODE="0644" -KERNEL=="rflash[0-9]*", MODE="0400" -KERNEL=="rrom[0-9]*", MODE="0400" -KERNEL=="sbpcd0", SYMLINK+="sbpcd" -KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" -KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" -KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" -KERNEL=="iowarrior[0-9]*", NAME="usb/%k" - -# do not delete static device nodes -ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove" - diff --git a/etc/udev/rules.d/60-persistent-input.rules b/etc/udev/rules.d/60-persistent-input.rules deleted file mode 100644 index 34d5ef1557..0000000000 --- a/etc/udev/rules.d/60-persistent-input.rules +++ /dev/null @@ -1,32 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add|change", GOTO="persistent_input_end" -SUBSYSTEM!="input", GOTO="persistent_input_end" -KERNEL=="input[0-9]*", GOTO="persistent_input_end" - -# usb devices -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" -SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" -SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" - -# other devices -DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" -DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" -DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" -ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" -ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" - -# fill empty serial number -ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" - -# by-id links -KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" - -# by-path -IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" -ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" - -LABEL="persistent_input_end" - diff --git a/etc/udev/rules.d/60-persistent-storage-tape.rules b/etc/udev/rules.d/60-persistent-storage-tape.rules deleted file mode 100644 index d3226f1320..0000000000 --- a/etc/udev/rules.d/60-persistent-storage-tape.rules +++ /dev/null @@ -1,24 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# persistent storage links: /dev/tape/{by-id,by-path} - -ACTION!="add|change", GOTO="persistent_storage_tape_end" - -# type 8 devices are "Medium Changers" -KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" - -SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" - -KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{BSG_DEV}="$root/bsg/$id" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", WAIT_FOR="$env{BSG_DEV}", IMPORT="scsi_id --whitelisted --export --device=$env{BSG_DEV}", ENV{ID_BUS}="scsi" -KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" - -# by-path (parent device path) -KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p" -KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst" - -LABEL="persistent_storage_tape_end" diff --git a/etc/udev/rules.d/60-persistent-storage.rules b/etc/udev/rules.d/60-persistent-storage.rules deleted file mode 100644 index 5ae0c7fec9..0000000000 --- a/etc/udev/rules.d/60-persistent-storage.rules +++ /dev/null @@ -1,63 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -# forward scsi device event to corresponding block device -ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" - -ACTION!="add|change", GOTO="persistent_storage_end" -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" - -# never access non-cdrom removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" - -# ignore partitions that span the entire disk -TEST=="whole_disk", GOTO="persistent_storage_end" - -# /sys/class/block will export this -ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" -ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" - -# for partitions import parent information -ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" -KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" -KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# libata compat (links like hd*) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" -KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" - -KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" - -# by-path (parent device path) -ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p" -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" -ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# skip unpartitioned removable media devices from drivers which do not send "change" events -ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" - -# import filesystem metadata -IMPORT{program}="vol_id --export $tempnode" - -# by-label/by-uuid links (filesystem metadata) -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="persistent_storage_end" diff --git a/etc/udev/rules.d/60-persistent-v4l.rules b/etc/udev/rules.d/60-persistent-v4l.rules deleted file mode 100644 index 0d673ab396..0000000000 --- a/etc/udev/rules.d/60-persistent-v4l.rules +++ /dev/null @@ -1,14 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add|change", GOTO="persistent_v4l_end" -SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" - -# check for valid "index" number -TEST!="index", GOTO="persistent_v4l_end" -ATTR{index}!="?*", GOTO="persistent_v4l_end" - -IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" -ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" - -LABEL="persistent_v4l_end" diff --git a/etc/udev/rules.d/80-drivers.rules b/etc/udev/rules.d/80-drivers.rules deleted file mode 100644 index 881d7581bf..0000000000 --- a/etc/udev/rules.d/80-drivers.rules +++ /dev/null @@ -1,17 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="drivers_end" - -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" -SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \ - RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" -SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" -SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" -SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe ppdev" - -LABEL="drivers_end" - diff --git a/etc/udev/rules.d/95-udev-late.rules b/etc/udev/rules.d/95-udev-late.rules deleted file mode 100644 index 7207081d46..0000000000 --- a/etc/udev/rules.d/95-udev-late.rules +++ /dev/null @@ -1,8 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# run a command on remove events -ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" - -# event to be catched by udevmonitor -RUN+="socket:@/org/kernel/udev/monitor" - diff --git a/etc/udev/slackware/udev.rules b/etc/udev/slackware/udev.rules deleted file mode 100644 index 12dac4d84d..0000000000 --- a/etc/udev/slackware/udev.rules +++ /dev/null @@ -1,355 +0,0 @@ -# /etc/udev/udev.rules: device naming rules for udev -# -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# This rules file is a mix of 10.2 Slackware udev.rules file and some -# rules from the udev examples. -# - -# wait for sysfs -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" -ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" - -# all block devices -SUBSYSTEM=="block", GROUP="disk" - -# permissions for IDE CD devices (without symbolic link creation) -BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660" - -# permissions for IDE CD devices (with symbolic link creation) -# THIS RULE COMMENTED OUT BY DEFAULT: read /lib/udev/rc.optical-symlinks for more information... -#BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660", RUN+="/lib/udev/cdrom-symlinks.sh %k" - -# permissions for IDE floppy devices -BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-floppy*", NAME="%k", GROUP="floppy", MODE="0660" - -# permissions for SCSI cd/sg/tape devices -BUS=="scsi", KERNEL=="s[grt][0-9]*", SYSFS{type}=="5", NAME="%k", GROUP="cdrom", MODE="0660" - -# load modules to scsi disks, if they aren't in kernel -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" - -# disk devices -KERNEL=="sd*", NAME="%k", GROUP="disk" -KERNEL=="dasd*", NAME="%k", GROUP="disk" -KERNEL=="ataraid*", NAME="%k", GROUP="disk" - -# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} - -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" - -# never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}=="1", GOTO="persistent_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/lib/udev/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -IMPORT{program}="/lib/udev/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/lib/udev/edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -# LVM2 dmsetup -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" - -LABEL="persistent_end" - -# ALSA devices -SUBSYSTEM=="sound", GROUP="audio" -SUBSYSTEM=="snd", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k", MODE="0666" -KERNEL=="hw[CD0-9]*", NAME="snd/%k", MODE="0662" -KERNEL=="pcm[CD0-9]*c", NAME="snd/%k", MODE="0662" -KERNEL=="pcm[CD0-9]*p", NAME="snd/%k", MODE="0666" -KERNEL=="midiC[D0-9]*", NAME="snd/%k", MODE="0666" -KERNEL=="timer", NAME="snd/%k", MODE="0666" -KERNEL=="seq", NAME="snd/%k", MODE="0666" - -# IEEE1394 raw devices (often used for video) -KERNEL=="raw1394", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" - -# capi devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# cpu devices -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode" - -# dm devices (ignore them) -KERNEL=="dm-[0-9]*", NAME="" -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" -KERNEL=="device-mapper", NAME="mapper/control" - - -# floppy devices -KERNEL=="fd[0-9]*", NAME="floppy/%n", SYMLINK+="%k", GROUP="floppy", PROGRAM="/lib/udev/floppy-extra-devs.sh %k %b %n" - -# i2c devices -KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" - -# input devices -KERNEL=="mice", NAME="input/%k", MODE="0644", SYMLINK+="mouse" -KERNEL=="mouse*", NAME="input/%k", MODE="0644" -KERNEL=="event*", NAME="input/%k", MODE="0640" -KERNEL=="js*", NAME="input/%k", MODE="664" -KERNEL=="ts*", NAME="input/%k", MODE="0600" -SUBSYSTEM=="input[0-9]*", RUN+="/lib/udev/input_device.sh" -KERNEL=="input[0-9]*", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" - -# loop devices -KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k", GROUP="disk" - -# md block devices -KERNEL=="md[0-9]*", NAME="md/%n", SYMLINK+="%k", GROUP="disk" - -# aoe char devices, -SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" -SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" - -# netlink devices -KERNEL=="route", NAME="netlink/%k" -KERNEL=="skip", NAME="netlink/%k" -KERNEL=="usersock", NAME="netlink/%k" -KERNEL=="fwmonitor", NAME="netlink/%k" -KERNEL=="tcpdiag", NAME="netlink/%k" -KERNEL=="nflog", NAME="netlink/%k" -KERNEL=="xfrm", NAME="netlink/%k" -KERNEL=="arpd", NAME="netlink/%k" -KERNEL=="route6", NAME="netlink/%k" -KERNEL=="ip6_fw", NAME="netlink/%k" -KERNEL=="dnrtmsg", NAME="netlink/%k" -KERNEL=="tap*", NAME="netlink/%k" - -# ramdisk devices -KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" - -# raw devices -KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL=="ram*", NAME="%k", GROUP="disk" - -# sound devices -KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" - -# tty devices -KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" -KERNEL=="ippp0", NAME="%k", GROUP="tty" -KERNEL=="isdn*", NAME="%k", GROUP="tty" -KERNEL=="dcbri*", NAME="%k", GROUP="tty" -KERNEL=="ircomm*", NAME="%k", GROUP="tty" - -# pty devices -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" -KERNEL=="pty[p-za-e][0-9a-f]*", NAME="pty/m%m", SYMLINK+="%k", GROUP="tty" -KERNEL=="tty[p-za-e][0-9a-f]*", NAME="pty/s%m", SYMLINK+="%k", GROUP="tty" - -# vc devices -KERNEL=="vcs", NAME="vcc/0", SYMLINK+="%k", GROUP="tty" -KERNEL=="vcs[0-9]*", NAME="vcc/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="vcsa", NAME="vcc/a0", SYMLINK+="%k", GROUP="tty" -KERNEL=="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK+="%k", GROUP="tty" - -# memory devices -KERNEL=="random", NAME="%k", MODE="0664" -KERNEL=="urandom", NAME="%k", MODE="0664" -KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="0640" -KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="0640" -KERNEL=="port", NAME="%k", GROUP="kmem", MODE="0640" -KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" -KERNEL=="full", NAME="%k", MODE="0666" -KERNEL=="null", NAME="%k", MODE="0666" -KERNEL=="zero", NAME="%k", MODE="0666" - -# misc devices -KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="rtc", NAME="misc/%k", SYMLINK+="%k", MODE="0664" -KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" - -# usb devices -KERNEL=="hiddev*", NAME="usb/%k" -KERNEL=="auer*", NAME="usb/%k" -KERNEL=="legousbtower*", NAME="usb/%k" -KERNEL=="dabusb*", NAME="usb/%k" - -# fb devices -KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" - -# DRI devices -KERNEL=="card*", NAME="dri/card%n", GROUP="video" -KERNEL=="nvidia*", NAME="%k", GROUP="video" -KERNEL=="3dfx*", NAME="%k", GROUP="video" - -# v4l devices -KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" -KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" -KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" -KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" - -# dvb devices -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'X=%k; X=$${X#dvb}; A=$${X%%%%.*}; D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" - -# Asterix Zaptel devices -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -# pilot/palm devices -KERNEL=="pilot", NAME="%k", GROUP="uucp" - -# jaz devices -KERNEL=="jaz*", NAME="%k", GROUP="disk" - -# zip devices -KERNEL=="pocketzip*", NAME="%k", GROUP="disk" -KERNEL=="zip*", NAME="%k", GROUP="disk" - -# ls120 devices -KERNEL=="ls120", NAME="%k", GROUP="disk" - -# lp devices -KERNEL=="irlpt", NAME="%k", GROUP="lp", MODE="0664" -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp", MODE="0664" -SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp", MODE="0664" -KERNEL=="parport*", NAME="%k", GROUP="lp", MODE="0664" - -# tape devices -KERNEL=="ht*", NAME="%k" -KERNEL=="nht*", NAME="%k" -KERNEL=="pt*", NAME="%k" -KERNEL=="npt*", NAME="%k" -KERNEL=="st*", NAME="%k" -KERNEL=="nst*", NAME="%k" -KERNEL=="osst*", NAME="%k" -KERNEL=="nosst*", NAME="%k" - -# diskonkey devices -KERNEL=="diskonkey*", NAME="%k", GROUP="disk" - -# rem_ide devices -KERNEL=="microdrive*", NAME="%k", GROUP="disk" - -# kbd devices -KERNEL=="kbd", NAME="%k", MODE="0664" - -# Sony Vaio Jogdial sonypi device -KERNEL=="sonypi", NAME="%k", MODE="0666" - -# packet devices -KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom", MODE="0660" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrom", MODE="0660" - -# infiniband devices -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" - -# PnP -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ - RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" - -# firewire -SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", IMPORT{program}="modalias_ieee1394" - -# libusb device access -DEVPATH=="/module/usbcore", ACTION=="add", \ - RUN+="/bin/sh -c 'sleep 1; /bin/mount none -t usbfs /proc/bus/usb -o devmode=0666,devgid=10'" -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev}; B=$${X%%%%.*}; D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" - -# firmware loader -SUBSYSTEM=="firmware", ACTION=="add", RUN+="/lib/udev/firmware_helper" - -# load module -ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" - -# PCMCIA devices: -# -# Very few CIS firmware entries (which we use for matching) -# are so broken that we need to read out random bytes of it -# instead of the manufactor, card or product ID. Then the -# matching is done in userspace. -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \ - RUN+="/sbin/pcmcia-check-broken-cis" - -# However, the "weak" matching by func_id is only allowed _after_ modprobe -# returns, so that "strong" matches have a higher priority. -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \ - RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" - -# PCMCIA sockets: -# -# modprobe the pcmcia bus module so that 16-bit PCMCIA devices work -ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" - -# if this is a PCMCIA socket which needs a resource database, -# pcmcia-socket-startup sets it up -ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/pcmcia-socket-startup" - -# network devices -KERNEL=="tun", NAME="net/%k" -SUBSYSTEM=="net", ACTION=="add", RUN+="/lib/udev/nethelper.sh $env{INTERFACE} start" -SUBSYSTEM=="net", ACTION=="remove", RUN+="/lib/udev/nethelper.sh $env{INTERFACE} stop" - -# if you use HAL, try this: -# send all events to HAL -#RUN+="socket:/org/freedesktop/hal/udev_event" - -# catch the event in udevmonitor -RUN+="socket:/org/kernel/udev/monitor" diff --git a/etc/udev/suse/40-suse.rules b/etc/udev/suse/40-suse.rules deleted file mode 100644 index d07a72eced..0000000000 --- a/etc/udev/suse/40-suse.rules +++ /dev/null @@ -1,14 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="pmu", GROUP="video" -KERNEL=="nvidia*|nvidiactl*", GROUP="video" -KERNEL=="nvidia*|nvidiactl*", GROUP="video" -KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" -KERNEL=="vttuner*", GROUP="video" -KERNEL=="vtx*|vbi*", GROUP="video" -KERNEL=="winradio*", GROUP="video" -SUBSYSTEM=="dvb", GROUP="video" -SUBSYSTEM=="graphics", GROUP="video" -SUBSYSTEM=="video4linux", GROUP="video" -KERNEL=="agpgart", GROUP="video" - diff --git a/etc/udev/suse/64-device-mapper.rules b/etc/udev/suse/64-device-mapper.rules deleted file mode 100644 index b065aec554..0000000000 --- a/etc/udev/suse/64-device-mapper.rules +++ /dev/null @@ -1,23 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="device-mapper", SYMLINK+="mapper/control" - -KERNEL!="dm-*", GOTO="device_mapper_end" -ACTION!="add|change", GOTO="device_mapper_end" - -IMPORT{program}="/sbin/dmsetup export -j%M -m%m" -ENV{DM_NAME}!="?*", GOTO="device_mapper_end" - -SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" -ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" - -ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end" -ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" - -IMPORT{program}="vol_id --export $tempnode" -OPTIONS+="link_priority=-100" -ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="device_mapper_end" diff --git a/etc/udev/udev.conf b/etc/udev/udev.conf deleted file mode 100644 index e6ef0814bf..0000000000 --- a/etc/udev/udev.conf +++ /dev/null @@ -1,7 +0,0 @@ -# udev.conf - -# The initial syslog(3) priority: "err", "info", "debug" or its -# numerical equivalent. For runtime debugging, the daemons internal -# state can be changed with: "udevadm control --log_priority=". -udev_log="err" - diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile index caab2beaf5..ec03d1fce2 100644 --- a/extras/cdrom_id/Makefile +++ b/extras/cdrom_id/Makefile @@ -51,13 +51,13 @@ clean: install-bin: all $(INSTALL) -d $(DESTDIR)$(libudevdir) $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d - $(INSTALL_DATA) 60-cdrom_id.rules $(DESTDIR)$(configdir)/rules.d/60-cdrom_id.rules + $(INSTALL) -d $(DESTDIR)$(libudevdir)/rules.d + $(INSTALL_DATA) 60-cdrom_id.rules $(DESTDIR)$(libudevdir)/rules.d/60-cdrom_id.rules .PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(libudevdir)/$(PROG) - - rm $(DESTDIR)$(configdir)/rules.d/60-cdrom_id.rules + - rm $(DESTDIR)$(libudevdir)/rules.d/60-cdrom_id.rules .PHONY: uninstall-bin install-man: diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile index f17a5b8c65..0126b859ee 100644 --- a/extras/edd_id/Makefile +++ b/extras/edd_id/Makefile @@ -51,13 +51,13 @@ clean: install-bin: all $(INSTALL) -d $(DESTDIR)$(libudevdir) $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d/ - $(INSTALL_DATA) 61-persistent-storage-edd.rules $(DESTDIR)$(configdir)/rules.d/61-persistent-storage-edd.rules + $(INSTALL) -d $(DESTDIR)$(libudevdir)/rules.d/ + $(INSTALL_DATA) 61-persistent-storage-edd.rules $(DESTDIR)$(libudevdir)/rules.d/61-persistent-storage-edd.rules .PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(libudevdir)/$(PROG) - - rm $(DESTDIR)$(configdir)/rules.d/61-persistent-storage-edd.rules + - rm $(DESTDIR)$(libudevdir)/rules.d/61-persistent-storage-edd.rules .PHONY: uninstall-bin install-man: diff --git a/extras/fstab_import/Makefile b/extras/fstab_import/Makefile index 23448f3217..3f65aa3f64 100644 --- a/extras/fstab_import/Makefile +++ b/extras/fstab_import/Makefile @@ -50,12 +50,12 @@ clean: install-bin: all $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - $(INSTALL_DATA) 79-fstab_import.rules $(DESTDIR)$(configdir)/rules.d/79-fstab_import.rules + $(INSTALL_DATA) 79-fstab_import.rules $(DESTDIR)$(libudevdir)/rules.d/79-fstab_import.rules .PHONY: install-bin uninstall-bin: - rm $(DESTDIR)$(libudevdir)/$(PROG) - - rm $(DESTDIR)$(configdir)/rules.d/79-fstab_import.rules + - rm $(DESTDIR)$(libudevdir)/rules.d/79-fstab_import.rules .PHONY: uninstall-bin install-man: diff --git a/extras/rule_generator/Makefile b/extras/rule_generator/Makefile index d6f1265eb9..e236ca77f0 100644 --- a/extras/rule_generator/Makefile +++ b/extras/rule_generator/Makefile @@ -41,11 +41,11 @@ install-bin: all $(INSTALL_DATA) rule_generator.functions $(DESTDIR)$(libudevdir)/rule_generator.functions $(INSTALL_SCRIPT) write_cd_rules $(DESTDIR)$(libudevdir)/write_cd_rules $(INSTALL_SCRIPT) write_net_rules $(DESTDIR)$(libudevdir)/write_net_rules - $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d + $(INSTALL) -d $(DESTDIR)$(libudevdir)/rules.d $(INSTALL_DATA) 75-cd-aliases-generator.rules \ - $(DESTDIR)$(configdir)/rules.d/75-cd-aliases-generator.rules + $(DESTDIR)$(libudevdir)/rules.d/75-cd-aliases-generator.rules $(INSTALL_DATA) 75-persistent-net-generator.rules \ - $(DESTDIR)$(configdir)/rules.d/75-persistent-net-generator.rules + $(DESTDIR)$(libudevdir)/rules.d/75-persistent-net-generator.rules .PHONY: install-bin uninstall-bin: diff --git a/rules/debian/50-udev.rules b/rules/debian/50-udev.rules new file mode 100644 index 0000000000..e3a10701cf --- /dev/null +++ b/rules/debian/50-udev.rules @@ -0,0 +1,98 @@ +# import the properties of optical drives +KERNEL=="hd[a-z]|pcd[0-9]*", ACTION=="add|change", DRIVERS=="ide-cdrom|pcd", \ + IMPORT{program}="cdrom_id --export $tempnode" +KERNEL=="sr[0-9]*", ACTION=="add|change", \ + IMPORT{program}="cdrom_id --export $tempnode" + +# workarounds for devices which do not report media changes +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ + ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" +SUBSYSTEMS=="scsi", KERNEL=="sd[a-z]", ATTR{removable}=="1", \ + ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" +SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", \ + ATTRS{media}=="floppy", OPTIONS+="all_partitions" + +# SCSI devices +SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" +SUBSYSTEM=="bsg", NAME="bsg/%k" + +# USB devices +SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="iowarrior[0-9]*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ + ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", \ + SYMLINK+="pilot" + +# usbfs-like devices +SUBSYSTEM=="usb_device", ACTION=="add", \ + PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ + NAME="$result" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" + +# serial devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi[0-9]*", NAME="capi/%n" + +# video devices +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ + NAME="$result" +KERNEL=="card[0-9]*", NAME="dri/%k" + +# misc devices +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="tun", NAME="net/%k" +KERNEL=="evtchn", NAME="xen/%k" +KERNEL=="rtc0", SYMLINK+="rtc" + +KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" +KERNEL=="uverbs*", NAME="infiniband/%k" +KERNEL=="ucm*", NAME="infiniband/%k" +KERNEL=="rdma_cm", NAME="infiniband/%k" + +# ALSA devices +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +# ieee1394 devices +KERNEL=="dv1394*", NAME="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# input devices +KERNEL=="mice", NAME="input/%k" +KERNEL=="mouse[0-9]*", NAME="input/%k" +KERNEL=="event[0-9]*", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" +KERNEL=="ts[0-9]*", NAME="input/%k" +KERNEL=="uinput", NAME="input/%k" + +# Zaptel +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="transcode", NAME="zap/transcode" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# AOE character devices +SUBSYSTEM=="aoe", NAME="etherd/%k" + +KERNEL=="device-mapper", NAME="mapper/control" + diff --git a/rules/debian/60-persistent-input.rules b/rules/debian/60-persistent-input.rules new file mode 100644 index 0000000000..8f49d250b1 --- /dev/null +++ b/rules/debian/60-persistent-input.rules @@ -0,0 +1,41 @@ +SUBSYSTEM!="input", GOTO="persistent_input_end" +ACTION!="add|change", GOTO="persistent_input_end" +# ignore the mid-level drivers +KERNEL=="input[0-9]*", GOTO="persistent_input_end" + +# usb devices +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" +SUBSYSTEMS=="usb", \ + ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", \ + ENV{ID_CLASS}="kbd" +SUBSYSTEMS=="usb", \ + ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", \ + ENV{ID_CLASS}="mouse" + +# other devices +DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" +DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +# this means (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", \ + ATTRS{modalias}!="input:*-*k*14A,*r*", \ + ENV{ID_CLASS}="joystick" + +ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + +# by-id links, generic and for the event devices +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ + SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ + SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" + +# by-path links +IMPORT{program}="path_id $devpath" +KERNEL=="mouse*|js*", ENV{ID_PATH}=="?*", \ + SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_PATH}=="?*", \ + SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" + +LABEL="persistent_input_end" + diff --git a/rules/debian/60-persistent-storage-tape.rules b/rules/debian/60-persistent-storage-tape.rules new file mode 100644 index 0000000000..94a0b816d4 --- /dev/null +++ b/rules/debian/60-persistent-storage-tape.rules @@ -0,0 +1,44 @@ +# This file contains the rules needed to create persistent device names. + +# we are only interested in add and change actions for block devices +ACTION!="add|change", GOTO="persistent_storage_tape_end" + +# "Medium Changers" +KERNEL=="sg[0-9]*", \ + SUBSYSTEMS=="scsi", ATTRS{type}=="8", \ + IMPORT{program}="scsi_id --export --sg-version=3 --whitelisted --device=$tempnode" + +KERNEL=="sg[0-9]*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" + +SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" + +KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", \ + ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ + SUBSYSTEMS=="usb", \ + IMPORT{program}="usb_id --export $devpath" + +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ + SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", \ + ENV{BSG_DEV}="$root/bsg/$id" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ + WAIT_FOR="$env{BSG_DEV}", \ + ENV{ID_BUS}="scsi", \ + IMPORT{program}="scsi_id --export --device=$env{BSG_DEV}" + +KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" + +KERNEL=="st*[0-9]|nst*[0-9]", \ + IMPORT{program}="path_id $devpath" +KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", \ + SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", \ + SYMLINK+="tape/by-path/$env{ID_PATH}-nst" + +# end of processing +LABEL="persistent_storage_tape_end" + diff --git a/rules/debian/60-persistent-storage.rules b/rules/debian/60-persistent-storage.rules new file mode 100644 index 0000000000..65e7204531 --- /dev/null +++ b/rules/debian/60-persistent-storage.rules @@ -0,0 +1,109 @@ +# This file contains the rules needed to create persistent device names. + +# forward scsi device events to the corresponding block device +ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", \ + TEST=="block", ATTR{block/*/uevent}="change" + +# we are only interested in add and change actions for block devices +ACTION!="add|change", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# and we can safely ignore these kinds of devices +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" + +# skip removable ide devices, because open(2) on them causes an events loop +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ + GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", ATTRS{removable}=="1", \ + GOTO="persistent_storage_end" + +# ignore partitions that span the entire disk +TEST=="whole_disk", GOTO="persistent_storage_end" + +# skip xen virtual hard disks +DRIVERS=="vbd", GOTO="no_hardware_id" + +# check these attributes of /sys/class/block nodes +ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" +ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" + +# look for different kinds of unique identificators +KERNEL=="hd*[!0-9]", \ + IMPORT{program}="ata_id --export $tempnode" + +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", \ + ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ + SUBSYSTEMS=="usb", \ + IMPORT{program}="usb_id --export $devpath" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ + ENV{ID_BUS}="scsi", \ + IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" +KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", \ + ENV{ID_BUS}="cciss", \ + IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" + +KERNEL=="dasd*[!0-9]", \ + IMPORT{program}="dasd_id --export $tempnode" + +KERNEL=="sd*[!0-9]|hd*[!0-9]", \ + IMPORT{program}="edd_id --export $tempnode" + +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", \ + PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result" + +# find the physical path of the device +ENV{DEVTYPE}=="disk", IMPORT{program}="path_id $devpath" + +LABEL="no_hardware_id" + +# import the variables of partitions from the parent disks +ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" + +# obsolete PATA driver +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +# hd*-like compatibility links for libata and PATA devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" +KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", \ + SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" + +KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ + ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ + SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ + ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ + SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + +ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", \ + SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +KERNEL=="sd*[!0-9]|sr*|dasd[!0-9]*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|dasd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", \ + SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", \ + SYMLINK+="disk/by-path/$env{ID_PATH}" +ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", \ + SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# skip unpartitioned removable media devices from drivers which do not send +# "change" events +ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", \ + GOTO="persistent_storage_end" + +# UUID and volume label +IMPORT{program}="vol_id --export $tempnode" +ENV{ID_FS_UUID_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ + SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_LABEL_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ + SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="persistent_storage_end" + diff --git a/rules/debian/60-persistent-v4l.rules b/rules/debian/60-persistent-v4l.rules new file mode 100644 index 0000000000..5a317b6c18 --- /dev/null +++ b/rules/debian/60-persistent-v4l.rules @@ -0,0 +1,17 @@ +ACTION!="add|change", GOTO="persistent_v4l_end" +SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" + +# ignore devices without a valid "index" number +TEST!="index", GOTO="persistent_v4l_end" +ATTR{index}!="?*", GOTO="persistent_v4l_end" + +IMPORT{program}="path_id $devpath" + +KERNEL=="video*|vbi*", ENV{ID_PATH}=="?*", \ + SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" + +KERNEL=="audio*", ENV{ID_PATH}=="?*", \ + SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" + +LABEL="persistent_v4l_end" + diff --git a/rules/debian/75-cd-aliases-generator.rules b/rules/debian/75-cd-aliases-generator.rules new file mode 100644 index 0000000000..6b178a0ae7 --- /dev/null +++ b/rules/debian/75-cd-aliases-generator.rules @@ -0,0 +1,11 @@ +# These rules generate rules for the /dev/{cdrom,dvd,...} symlinks and +# write them to /etc/udev/rules.d/70-persistent-cd.rules. + +ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ + SUBSYSTEMS!="usb|ieee1394", \ + PROGRAM="write_cd_rules", SYMLINK+="$result" + +ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ + SUBSYSTEMS=="usb|ieee1394", \ + PROGRAM="write_cd_rules by-id", SYMLINK+="$result" + diff --git a/rules/debian/75-persistent-net-generator.rules b/rules/debian/75-persistent-net-generator.rules new file mode 100644 index 0000000000..e8d3b888e0 --- /dev/null +++ b/rules/debian/75-persistent-net-generator.rules @@ -0,0 +1,86 @@ +# These rules generate rules to keep network interface names unchanged +# across reboots write them to /etc/udev/rules.d/70-persistent-net.rules. + +# variables used to communicate: +# MATCHADDR MAC address used for the match +# MATCHID bus_id used for the match +# MATCHDRV driver name used for the match +# MATCHIFTYPE interface type match +# COMMENT comment to add to the generated rule +# INTERFACE_NAME requested name supplied by external tool +# INTERFACE_NEW new interface name returned by rule writer + +ACTION!="add", GOTO="persistent_net_generator_end" +SUBSYSTEM!="net", GOTO="persistent_net_generator_end" + +# ignore the interface if a name has already been set +NAME=="?*", GOTO="persistent_net_generator_end" + +# ignore interfaces without a driver link like bridges and VLANs +DRIVERS!="?*", GOTO="persistent_net_generator_end" + +# device name whitelist +KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ + GOTO="persistent_net_generator_end" + +# ignore Xen virtual interfaces +SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" + +# ignore UML virtual interfaces +DRIVERS=="uml-netdev", GOTO="persistent_net_generator_end" + +# ignore "secondary" raw interfaces of the madwifi driver +KERNEL=="ath*", ATTRS{type}=="802", GOTO="persistent_net_generator_end" + +# ignore "secondary" monitor interfaces of mac80211 drivers +KERNEL=="wlan*", ATTRS{type}=="803", GOTO="persistent_net_generator_end" + +# by default match on the MAC address and interface type +ENV{MATCHADDR}="$attr{address}" +ENV{MATCHIFTYPE}="$attr{type}" + +# ignore interfaces with locally administered or null MAC addresses +# and VMWare virtual interfaces +ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" +ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" +ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", ENV{MATCHADDR}="" + +# ibmveth interfaces have stable locally administered MAC addresses +SUBSYSTEMS=="ibmveth", ENV{MATCHADDR}="$attr{address}" + +# S/390 interfaces are matched only by id +SUBSYSTEMS=="ccwgroup", \ + ENV{MATCHDRV}="$driver", ENV{MATCHID}="$id", ENV{MATCHADDR}="" + +# terminate processing if there are not enough conditions to create a rule +ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", \ + GOTO="persistent_net_generator_end" + + +# provide nice comments for the generated rules +SUBSYSTEMS=="pci", \ + ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}" +SUBSYSTEMS=="pcmcia", \ + ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id}" +SUBSYSTEMS=="usb", \ + ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct}" +SUBSYSTEMS=="ccwgroup", \ + ENV{COMMENT}="S/390 device at $id" +SUBSYSTEMS=="ibmveth", \ + ENV{COMMENT}="LPAR virtual device at $id" +SUBSYSTEMS=="ieee1394", \ + ENV{COMMENT}="Firewire device $attr{host_id}" +ENV{COMMENT}=="", \ + ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})" +ATTRS{driver}=="?*", \ + ENV{COMMENT}="$env{COMMENT} ($attr{driver})" + + +# generate and write the rule +IMPORT{program}="write_net_rules" + +# rename the interface if requested +ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" + +LABEL="persistent_net_generator_end" + diff --git a/rules/debian/80-drivers.rules b/rules/debian/80-drivers.rules new file mode 100644 index 0000000000..edfcfa5394 --- /dev/null +++ b/rules/debian/80-drivers.rules @@ -0,0 +1,57 @@ +ACTION!="add", GOTO="hotplug_not_add_event" + +# check if the device has already been claimed by a driver +ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" + +# this driver is broken and should not be loaded automatically on kernels +# < 2.6.21 (see #398962) +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_driver_loaded" + +# load the drivers +ENV{MODALIAS}=="?*", \ + RUN+="/sbin/modprobe --use-blacklist $env{MODALIAS}" + +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ + RUN+="/bin/sh -c '/sbin/modprobe --use-blacklist --all $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" + +SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" + +# rules for subsystems which lack proper hotplug support +SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe tifm_ms" + +# needed for kernels < 2.6.22 +SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe osst", \ + ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ + ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*" +SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ + ATTRS{vendor}!="Onstream" +SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ATTRS{type}=="8", RUN+="/sbin/modprobe ch" + +SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", TEST!="[module/sg]", \ + RUN+="/sbin/modprobe sg" + +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" + +# From here on follows the hotplug agents which do not load modules +LABEL="hotplug_driver_loaded" + +# FIXME: does a sane default exist? +#SUBSYSTEM=="scsi_device", ATTRS{idVendor}=="...", \ +# RUN+="scsi-re-add" + +SUBSYSTEM=="firmware", RUN+="firmware.agent" + +LABEL="hotplug_not_add_event" + +SUBSYSTEM=="net", RUN+="net.agent" + +# Log every event to /dev/hotplug.log (for debugging). +#RUN+="logger.agent" + diff --git a/rules/debian/91-permissions.rules b/rules/debian/91-permissions.rules new file mode 100644 index 0000000000..5182a4bd28 --- /dev/null +++ b/rules/debian/91-permissions.rules @@ -0,0 +1,130 @@ +ACTION!="add", GOTO="permissions_end" + +# devices needed to load the drivers providing them +KERNEL=="tun", OPTIONS+="ignore_remove" +KERNEL=="ppp", OPTIONS+="ignore_remove" +KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" + +# default permissions for block devices +SUBSYSTEM=="block", GROUP="disk" +# the aacraid driver is broken and reports that disks removable (see #404927) +SUBSYSTEM=="block", ATTRS{removable}=="1", \ + DRIVERS!="aacraid", GROUP="floppy" +# all block devices on these buses are "removable" +SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" + +KERNEL=="cbm", GROUP="floppy" + +# IDE devices +ENV{ID_CDROM}=="?*", GROUP="cdrom" +KERNEL=="ht[0-9]*", GROUP="tape" +KERNEL=="nht[0-9]*", GROUP="tape" + +# SCSI devices +SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" +SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" + +# USB devices +KERNEL=="legousbtower*", MODE="0666" +KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" + +# usbfs-like devices +SUBSYSTEM=="usb_device", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ + MODE="0664" + +# iRiver music players +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ + ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" + +# serial devices +SUBSYSTEM=="tty", GROUP="dialout" +SUBSYSTEM=="capi", GROUP="dialout" +SUBSYSTEM=="slamr", GROUP="dialout" +SUBSYSTEM=="zaptel", GROUP="dialout" + +# vc devices (all members of the tty subsystem) +KERNEL=="ptmx", MODE="0666", GROUP="root" +KERNEL=="console", MODE="0600", GROUP="root" +KERNEL=="tty", MODE="0666", GROUP="root" +KERNEL=="tty[0-9]*", GROUP="root" +KERNEL=="pty*", MODE="0666", GROUP="tty" + +# video devices +SUBSYSTEM=="video4linux", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="em8300", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="nvidia", GROUP="video" + +# misc devices +KERNEL=="random", MODE="0666" +KERNEL=="urandom", MODE="0666" +KERNEL=="mem", MODE="0640", GROUP="kmem" +KERNEL=="kmem", MODE="0640", GROUP="kmem" +KERNEL=="port", MODE="0640", GROUP="kmem" +KERNEL=="full", MODE="0666" +KERNEL=="null", MODE="0666" +KERNEL=="zero", MODE="0666" +KERNEL=="inotify", MODE="0666" +KERNEL=="sonypi", MODE="0666" +KERNEL=="agpgart", GROUP="video" +KERNEL=="nvram", GROUP="nvram" +KERNEL=="rtc|rtc[0-9]*", GROUP="audio" +KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" +KERNEL=="fuse", GROUP="fuse" +KERNEL=="kqemu", MODE="0666" +KERNEL=="kvm", GROUP="kvm" +KERNEL=="tun", MODE="0666" + +KERNEL=="cdemu[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", MODE="0644" + +KERNEL=="uverbs*", GROUP="rdma" +KERNEL=="ucm*", GROUP="rdma" +KERNEL=="rdma_cm", GROUP="rdma" + +# printers and parallel devices +SUBSYSTEM=="printer", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="irlpt*", GROUP="lp" +KERNEL=="pt[0-9]*", GROUP="tape" +KERNEL=="pht[0-9]*", GROUP="tape" + +# sound devices +SUBSYSTEM=="sound", GROUP="audio" + +# ieee1394 devices +KERNEL=="raw1394", GROUP="disk" +KERNEL=="dv1394*", GROUP="video" +KERNEL=="video1394*", GROUP="video" + +# input devices +KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ + MODE="0664", GROUP="video" +KERNEL=="js[0-9]*", MODE="0664" +KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", \ + MODE="0664", GROUP="audio" +KERNEL=="lirc[0-9]*", GROUP="video" + +KERNEL=="sgi_*", MODE="0666" +KERNEL=="z90crypt", MODE="0666" +KERNEL=="iseries/ibmsis*", GROUP="disk" +KERNEL=="iseries/nvt*", GROUP="disk" +KERNEL=="iseries/vt*", GROUP="disk" +KERNEL=="iseries/vtty*", GROUP="dialout" + +# AOE character devices +SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440", GROUP="disk" + +LABEL="permissions_end" + diff --git a/rules/debian/95-late.rules b/rules/debian/95-late.rules new file mode 100644 index 0000000000..622e019ef3 --- /dev/null +++ b/rules/debian/95-late.rules @@ -0,0 +1,18 @@ +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + +# ignore the events generated by virtual consoles +KERNEL=="ptmx", OPTIONS+="last_rule" +KERNEL=="console", OPTIONS+="last_rule" +KERNEL=="tty" , OPTIONS+="last_rule" +KERNEL=="tty[0-9]*", OPTIONS+="last_rule" +KERNEL=="pty*", OPTIONS+="last_rule" +SUBSYSTEM=="vc", OPTIONS+="last_rule" + +# do not delete static device nodes +ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", \ + OPTIONS+="ignore_remove" + +# debugging monitor +RUN+="socket:/org/kernel/udev/monitor" + diff --git a/rules/frugalware/50-udev-default.rules b/rules/frugalware/50-udev-default.rules new file mode 100644 index 0000000000..89ffd7b442 --- /dev/null +++ b/rules/frugalware/50-udev-default.rules @@ -0,0 +1,198 @@ +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# See the udev.rules.examples file for more examples of how to create rules +# + +# permissions for IDE CD devices +SUBSYSTEMS=="ide", KERNEL=="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom*", NAME="%k", GROUP="cdrom", MODE="0660" + +# permissions for SCSI cd/sg/tape devices +SUBSYSTEMS=="scsi", KERNEL=="s[grt][0-9]*", ATTRS{type}=="5", NAME="%k", GROUP="cdrom", MODE="0660" + +# USB devices +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="auer*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k" +KERNEL=="dabusb*", NAME="usb/%k" +SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" + +# CAPI devices +KERNEL=="capi", NAME="capi20", SYMLINK="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# Network devices +KERNEL=="tun", NAME="net/%k" + +# permissions +KERNEL=="pl2303", NAME="%k", OWNER="500", GROUP="500", MODE="0666" +KERNEL=="visor", NAME="%k", OWNER="root", GROUP="uucp", MODE="0666" +KERNEL=="camera*", NAME="%k", OWNER="root", GROUP="camera", MODE="0666" + +# console devices +KERNEL=="console", NAME="%k", OWNER="root", GROUP="tty", MODE="0600" +KERNEL=="tty", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="tty[0-9]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" +KERNEL=="vcs*", NAME="%k", OWNER="root", GROUP="tty", MODE="0620" +KERNEL=="tty[CIS]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL=="ttyUB[0-9]", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB0", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" +KERNEL=="ttyUSB1", NAME="%k", OWNER="root" GROUP="uucp", MODE="0666" + +# pty devices +KERNEL=="ptmx", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="pty[p-za-e][0-9a-f]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="tty[p-za-e][0-9a-f]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" +KERNEL=="cu[abiu]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" + +# sound devices +KERNEL=="audio*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="beep", NAME="%k", OWNER="root", GROUP="audio", MODE="0644" +KERNEL=="dsp*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="midi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="mixer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="music", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="sequencer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="controlC[0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="hw[CD0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="midiC[D0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="timer", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="seq", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="sndstat", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="speaker", NAME="%k", OWNER="root", GROUP="audio", MODE="0644" +KERNEL=="sound/*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="admmidi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="adsp*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="aload*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="amidi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" +KERNEL=="amixer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" + +# input devices (mouse, joystick, etc) +KERNEL=="mice", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="mouse*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="event*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="js*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="ts*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="input/js*", NAME="%k", OWNER="root", GROUP="games",0 MODE="0666" +KERNEL=="djs[0-3]", NAME="%k", OWNER="root", GROUP="games", MODE="0660" +KERNEL=="psaux", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="crash", NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="logibm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="jbm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="hwtrap", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="inportbm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" +KERNEL=="sexec", NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="jsflash", NAME="%k", OWNER="root", GROUP="root", MODE="0660" + +# power manager device +KERNEL=="apm_bios", NAME="%k", OWNER="root", GROUP="root", MODE="0644" + +# printer device +KERNEL=="lp[0-9]", NAME="%k", OWNER="root", GROUP="lp", MODE="0660" +KERNEL=="parport*", NAME="%k", OWNER="root", GROUP="lp", MODE="0660" + +# video devices +KERNEL=="card*", NAME="dri/card%n", OWNER="root", GROUP="video", MODE="0666" +KERNEL=="fb[0-9]", NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="agpgart", NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="nvidia*", NAME="%k", OWNER="root", GROUP="video", MODE="0666" +KERNEL=="video*", NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="vbi*", NAME="%k", OWNER="root", GROUP="video", MODE="0660" +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; A=$${K%%%%.*}; D=$${K#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video", MODE="0660" + +# DISK devices +KERNEL=="ed[ab]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="gscd0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="initrd", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="lmscd", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="mcd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="md*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="mtd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="userdma", NAME="%k", OWNER="root", GROUP="root", MODE="0660" + +# floppy devices +KERNEL=="fd[0-3]*", NAME="%k", OWNER="root", GROUP="floppy", MODE="0660" +KERNEL=="fd0", SYMLINK="floppy" + +# permissions for removable devices like cardreaders or sticks +KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="0", NAME="%k", GROUP="storage" + +# permissions for firewire external drives +KERNEL=="sd*", ATTRS{scsi_level}=="5", NAME="%k", GROUP="storage" + +# permissions for usb to scsi external adapters +KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="7", NAME="%k", GROUP="storage" + +# IDE devices (hd, cdrom) +KERNEL=="hd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="ht0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" + +# RAID IDE +KERNEL=="ataraid[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="ataraid/*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" + +# SCSI devices +KERNEL=="scsi/*/cd", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="scsi/*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="sd[a-h]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="s[rt][0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="scd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" + +# generic scsi devices +KERNEL=="sg*", NAME="%k", OWNER="root", GROUP="root", MODE="0600" + +# old CD-ROM +KERNEL=="sbpcd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" + +# loop devices +KERNEL=="loop[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" + +# network block devices +KERNEL=="nb[0-7]", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="nht0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="npt[0-3]", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="n[qrs]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" + +# memory access devices +KERNEL=="kmem", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL=="mem", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL=="null", NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL=="nvram", NAME="%k", OWNER="root", GROUP="root", MODE="0640" +KERNEL=="port", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" +KERNEL=="ram[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" +KERNEL=="random", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="rtc", NAME="%k", OWNER="root", GROUP="root", MODE="0444" +KERNEL=="urandom", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="full", NAME="%k", OWNER="root", GROUP="sys", MODE="0666" +KERNEL=="zero", NAME="%k", OWNER="root", GROUP="root", MODE="0666" +KERNEL=="raw[0-9]*", NAME="raw/%k", OWNER="root", GROUP="disk", MODE="0660" +KERNEL=="modreq", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="msr", NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="profile*", NAME="%k", OWNER="root", GROUP="root", MODE="0640" + +# ISDN devices +KERNEL=="isdn*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" + +# net devices +KERNEL=="ippp*", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="ipstate*", NAME="%k", OWNER="root", GROUP="root", MODE="0660" +KERNEL=="spx", NAME="%k", OWNER="root", GROUP="root", MODE="0644" +KERNEL=="fwmonitor*", NAME="%k", OWNER="root", GROUP="root", MODE="0660" + +# hotplug rules - module autoloading for different buses +ACTION=="add", SUBSYSTEM=="pci", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" +ACTION=="add", SUBSYSTEM=="usb", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" +ACTION=="add", SUBSYSTEM=="ieee1394", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[07]", RUN+="/sbin/modprobe sd_mod" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="14", RUN+="/sbin/modprobe sd_mod" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*", RUN+="/sbin/modprobe st" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}!="Onstream", RUN+="/sbin/modprobe st" +ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[23689]", RUN+="/sbin/modprobe sg" + +# firmware +ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN+="/lib/udev/firmware.sh" diff --git a/rules/frugalware/64-device-mapper.rules b/rules/frugalware/64-device-mapper.rules new file mode 100644 index 0000000000..3837d3f2c7 --- /dev/null +++ b/rules/frugalware/64-device-mapper.rules @@ -0,0 +1,15 @@ +# device mapper links hook into "online" event, when the dm table +# is available, while some table types must be ignored + +KERNEL=="dm-*", ACTION=="add|online", GOTO="device_mapper_do" +GOTO="device_mapper_end" + +LABEL="device_mapper_do" +PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" +RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" + +IMPORT{program}="/sbin/vol_id --export $tempnode" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +LABEL="device_mapper_end" diff --git a/rules/gentoo/30-kernel-compat.rules b/rules/gentoo/30-kernel-compat.rules new file mode 100644 index 0000000000..1f767df8d8 --- /dev/null +++ b/rules/gentoo/30-kernel-compat.rules @@ -0,0 +1,47 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="kernel_compat_end" + +# workarounds needed to synchronize with sysfs +DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" + +# needed for kernels <2.6.16 +SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" + +# needed for kernels <2.6.17 +SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" + + + +# needed for kernels <2.6.22 +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" + + + +# this driver is broken and should not be loaded automatically +# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=398962 +# needed for kernels <2.6.21 +SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", ENV{MODALIAS}="" + +# No need for more code, as MODALIAS is present +ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" + +# needed for kernels <2.6.22 +SUBSYSTEM!="scsi_device", GOTO="kernel_compat_end" + + # Parts taken from redhat-rules + # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC + # sr: 4 TYPE_WORM, 5 TYPE_ROM + # st/osst: 1 TYPE_TAPE + + ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" + ATTRS{type}=="4|5", RUN+="/sbin/modprobe sr_mod" + ATTRS{type}=="8", RUN+="/sbin/modprobe ch" + + ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ + ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst", GOTO="kernel_compat_end" + ATTRS{type}=="1", RUN+="/sbin/modprobe st" + +LABEL="kernel_compat_end" + + diff --git a/rules/gentoo/40-gentoo.rules b/rules/gentoo/40-gentoo.rules new file mode 100644 index 0000000000..99a1c66c69 --- /dev/null +++ b/rules/gentoo/40-gentoo.rules @@ -0,0 +1,12 @@ +# do not edit this file, it will be overwritten on update + +# capi devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# old devfs path, removing this could break systems +# Bug 195839 +KERNEL=="md[0-9]*", SYMLINK+="md/%n" +KERNEL=="loop[0-9]*", SYMLINK+="loop/%n" +KERNEL=="ram[0-9]*", SYMLINK+="rd/%n" + diff --git a/rules/gentoo/40-video.rules b/rules/gentoo/40-video.rules new file mode 100644 index 0000000000..2d5e53411c --- /dev/null +++ b/rules/gentoo/40-video.rules @@ -0,0 +1,24 @@ +# do not edit this file, it will be overwritten on update + +# video4linux +KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="%k", GROUP="video" +KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="%k", GROUP="video" +KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="%k", GROUP="video" +KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" + +SUBSYSTEM=="dvb", GROUP="video" + +# device node will be /dev/dri/card? +KERNEL=="card*", GROUP="video" +KERNEL=="nvidia*", GROUP="video" +KERNEL=="3dfx*", GROUP="video" + +# svgalib +KERNEL=="svga*", GROUP="video" + +# Framebuffer +KERNEL=="fb[0-9]*", GROUP="video" + +# IEEE1394 (firewire) devices +KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" + diff --git a/rules/gentoo/65-permissions.rules b/rules/gentoo/65-permissions.rules new file mode 100644 index 0000000000..494f19e63f --- /dev/null +++ b/rules/gentoo/65-permissions.rules @@ -0,0 +1,26 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb", MODE="664" + +# cdrom devices +ENV{ID_CDROM}=="?*", GROUP="cdrom", MODE="660" +KERNEL=="pktcdvd|pktcdvd[0-9]*", GROUP="cdrom", MODE="660" +# assign cdrom-permission also to associated generic device (for cd-burning ...) +SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[45]", GROUP="cdrom", MODE="660" + + +# tape devices +KERNEL=="st[0-9]*|nst[0-9]*|ht[0-9]*|nht[0-9]*|pt[0-9]*|npt[0-9]*", \ + GROUP="tape", MODE="660" +SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[18]", GROUP="tape", MODE="660" + +# dialout devices +KERNEL=="ippp*|isdn*|dcbri*|capi*", GROUP="uucp" +KERNEL=="pilot", GROUP="uucp" + +# sound devices (sound=alsa, snd=oss) +SUBSYSTEM=="sound|snd", GROUP="audio" + +# Sony Vaio Jogdial sonypi device +KERNEL=="sonypi", MODE="0666" + diff --git a/rules/gentoo/90-network.rules b/rules/gentoo/90-network.rules new file mode 100644 index 0000000000..50903af157 --- /dev/null +++ b/rules/gentoo/90-network.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +# /etc/udev/rules/90-network.rules: triggering network init-scripts + +# Activate our network if we can +SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start" +SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop" + diff --git a/rules/packages/40-alsa.rules b/rules/packages/40-alsa.rules new file mode 100644 index 0000000000..d30a1da8fc --- /dev/null +++ b/rules/packages/40-alsa.rules @@ -0,0 +1,11 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" +KERNEL=="mixer0", SYMLINK+="mixer" +KERNEL=="dsp0", SYMLINK+="dsp" +KERNEL=="audio0", SYMLINK+="audio" diff --git a/rules/packages/40-ia64.rules b/rules/packages/40-ia64.rules new file mode 100644 index 0000000000..5846f88b1b --- /dev/null +++ b/rules/packages/40-ia64.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="sgi_*", MODE="0666" + diff --git a/rules/packages/40-pilot-links.rules b/rules/packages/40-pilot-links.rules new file mode 100644 index 0000000000..1242fff102 --- /dev/null +++ b/rules/packages/40-pilot-links.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="ttyUSB*", ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", SYMLINK+="pilot" + diff --git a/rules/packages/40-ppc.rules b/rules/packages/40-ppc.rules new file mode 100644 index 0000000000..8b62d79e0c --- /dev/null +++ b/rules/packages/40-ppc.rules @@ -0,0 +1,6 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" +KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" +KERNEL=="iseries/vtty*", GROUP="uucp" diff --git a/rules/packages/40-s390.rules b/rules/packages/40-s390.rules new file mode 100644 index 0000000000..43035dbe60 --- /dev/null +++ b/rules/packages/40-s390.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="z90crypt", MODE="0666" + diff --git a/rules/packages/40-zaptel.rules b/rules/packages/40-zaptel.rules new file mode 100644 index 0000000000..4313a9172e --- /dev/null +++ b/rules/packages/40-zaptel.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="zap[0-9]*", NAME="zap/%n" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zaptimer", NAME="zap/timer" + diff --git a/rules/packages/64-device-mapper.rules b/rules/packages/64-device-mapper.rules new file mode 100644 index 0000000000..8154ef3702 --- /dev/null +++ b/rules/packages/64-device-mapper.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="device-mapper", NAME="mapper/control" + diff --git a/rules/packages/64-md-raid.rules b/rules/packages/64-md-raid.rules new file mode 100644 index 0000000000..d0510b3095 --- /dev/null +++ b/rules/packages/64-md-raid.rules @@ -0,0 +1,22 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM!="block", GOTO="md_end" +ACTION!="add|change", GOTO="md_end" + +# import data from a raid member and activate it +#ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}" +# import data from a raid set +KERNEL!="md*", GOTO="md_end" + +ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" + +IMPORT{program}="/sbin/mdadm --detail --export $tempnode" +ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" +ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" + +IMPORT{program}="vol_id --export $tempnode" +OPTIONS+="link_priority=100" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="md_end" diff --git a/rules/redhat/40-redhat.rules b/rules/redhat/40-redhat.rules new file mode 100644 index 0000000000..446cc6d1d5 --- /dev/null +++ b/rules/redhat/40-redhat.rules @@ -0,0 +1,25 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="hd*[!0-9]", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove" +KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", SYMLINK+="floppy-%k", OPTIONS+="ignore_remove" + +KERNEL=="fw*", PROGRAM="fw_unit_symlinks.sh %k %n", SYMLINK+="$result" + +ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="3|6", SYMLINK+="scanner scanner-%k", MODE="0660" + +ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" + +BUS=="usb", KERNEL=="sd*", ATTRS{bInterfaceClass}=="08", ATTRS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", SYMLINK+="floppy floppy-%k" + +KERNEL=="fd[0-9]*", SYMLINK+="floppy floppy-%k" + +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \ + RUN+="/sbin/modprobe sd_mod" +ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \ + RUN+="/sbin/modprobe sr_mod" + +KERNEL=="vcs", OWNER="vcsa", GROUP="tty" +KERNEL=="vcs[0-9]*", OWNER="vcsa", GROUP="tty" +KERNEL=="vcsa", OWNER="vcsa", GROUP="tty" +KERNEL=="vcsa[0-9]*", OWNER="vcsa", GROUP="tty" +KERNEL=="vcc/*", OWNER="vcsa", GROUP="tty" diff --git a/rules/redhat/95-pam-console.rules b/rules/redhat/95-pam-console.rules new file mode 100644 index 0000000000..cbb2d4aaf9 --- /dev/null +++ b/rules/redhat/95-pam-console.rules @@ -0,0 +1 @@ +ENV{STARTUP}!="1", ACTION=="add", SYSFS{dev}=="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}" diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules new file mode 100644 index 0000000000..718d1899f5 --- /dev/null +++ b/rules/rules.d/50-udev-default.rules @@ -0,0 +1,107 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" +KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS+="last_rule" +KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS+="last_rule" +KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", OPTIONS+="last_rule" +KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty", OPTIONS+="last_rule" +KERNEL=="console", MODE="0600", OPTIONS+="last_rule" + +# serial +KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" +KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" +KERNEL=="mwave", NAME="modems/mwave", GROUP="uucp" +KERNEL=="hvc*|hvsi*", GROUP="uucp" +KERNEL=="lirc0", SYMLINK+="lirc" + +# mem +KERNEL=="null|zero|full|random|urandom", MODE="0666" +KERNEL=="null", SYMLINK+="XOR" +KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" +KERNEL=="ram0", SYMLINK+="ramdisk" +KERNEL=="ram1", SYMLINK+="ram" + +# input +KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" +KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0600" +KERNEL=="js[0-9]*", NAME="input/%k", MODE="0644", SYMLINK+="%k" + +# video4linux +KERNEL=="vbi0", SYMLINK+="vbi" +KERNEL=="radio0", SYMLINK+="radio" +KERNEL=="video0", SYMLINK+="video" + +# graphics +KERNEL=="agpgart", MODE="0600" +KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666" +KERNEL=="fb0", SYMLINK+="fb" + +# DVB video +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" + +# Firewire +KERNEL=="dv1394*", SYMLINK+="dv1394/%n" +KERNEL=="video1394*", NAME="video1394/%n" + +# firmware class requests +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" + +# libusb device nodes +SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" + +# printer +KERNEL=="parport[0-9]*", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +KERNEL=="lp[0-9]*", GROUP="lp", SYMLINK+="par%n" +KERNEL=="irlpt[0-9]*", GROUP="lp" + +# block, tapes, block-releated +SUBSYSTEM=="block", GROUP="disk", MODE="0640" +SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" +KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" +KERNEL=="fd[0-9]", GROUP="floppy" +KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" +KERNEL=="sch[0-9]*", GROUP="disk" +KERNEL=="sg[0-9]*", ATTRS{type}!="3|6", GROUP="disk", MODE="0640" +KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk" +KERNEL=="pg[0-9]*", GROUP="disk" +KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" +KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" +KERNEL=="rawctl", NAME="raw/%k", GROUP="disk" +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" +KERNEL=="pktcdvd", NAME="pktcdvd/control" +KERNEL=="qft0", SYMLINK+="ftape" +SUBSYSTEM=="bsg", NAME="bsg/%k" +SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk" + +# network +KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" + +# CPU +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# miscellaneous +KERNEL=="fuse", MODE="0666" +KERNEL=="rtc|rtc0", MODE="0644" +KERNEL=="rtc0", SYMLINK+="rtc" +KERNEL=="auer[0-9]*", NAME="usb/%k" +KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +KERNEL=="mmtimer", MODE="0644" +KERNEL=="rflash[0-9]*", MODE="0400" +KERNEL=="rrom[0-9]*", MODE="0400" +KERNEL=="sbpcd0", SYMLINK+="sbpcd" +KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" +KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" +KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" +KERNEL=="iowarrior[0-9]*", NAME="usb/%k" + +# do not delete static device nodes +ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove" + diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules new file mode 100644 index 0000000000..34d5ef1557 --- /dev/null +++ b/rules/rules.d/60-persistent-input.rules @@ -0,0 +1,32 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="persistent_input_end" +SUBSYSTEM!="input", GOTO="persistent_input_end" +KERNEL=="input[0-9]*", GOTO="persistent_input_end" + +# usb devices +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd" +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse" + +# other devices +DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" +DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" +DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" + +# fill empty serial number +ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + +# by-id links +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" + +# by-path +IMPORT{program}="path_id %p" +ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" + +LABEL="persistent_input_end" + diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules new file mode 100644 index 0000000000..d3226f1320 --- /dev/null +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -0,0 +1,24 @@ +# do not edit this file, it will be overwritten on update + +# persistent storage links: /dev/tape/{by-id,by-path} + +ACTION!="add|change", GOTO="persistent_storage_tape_end" + +# type 8 devices are "Medium Changers" +KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" + +SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" + +KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{BSG_DEV}="$root/bsg/$id" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", WAIT_FOR="$env{BSG_DEV}", IMPORT="scsi_id --whitelisted --export --device=$env{BSG_DEV}", ENV{ID_BUS}="scsi" +KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" + +# by-path (parent device path) +KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p" +KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst" + +LABEL="persistent_storage_tape_end" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules new file mode 100644 index 0000000000..5ae0c7fec9 --- /dev/null +++ b/rules/rules.d/60-persistent-storage.rules @@ -0,0 +1,63 @@ +# do not edit this file, it will be overwritten on update + +# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +# forward scsi device event to corresponding block device +ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" + +ACTION!="add|change", GOTO="persistent_storage_end" +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" + +# never access non-cdrom removable ide devices, the drivers are causing event loops on open() +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" +KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" + +# ignore partitions that span the entire disk +TEST=="whole_disk", GOTO="persistent_storage_end" + +# /sys/class/block will export this +ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" +ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" + +# for partitions import parent information +ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" +KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# libata compat (links like hd*) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" +KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" + +KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + +# by-path (parent device path) +ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p" +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" +ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# skip unpartitioned removable media devices from drivers which do not send "change" events +ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" + +# import filesystem metadata +IMPORT{program}="vol_id --export $tempnode" + +# by-label/by-uuid links (filesystem metadata) +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="persistent_storage_end" diff --git a/rules/rules.d/60-persistent-v4l.rules b/rules/rules.d/60-persistent-v4l.rules new file mode 100644 index 0000000000..0d673ab396 --- /dev/null +++ b/rules/rules.d/60-persistent-v4l.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="persistent_v4l_end" +SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" + +# check for valid "index" number +TEST!="index", GOTO="persistent_v4l_end" +ATTR{index}!="?*", GOTO="persistent_v4l_end" + +IMPORT{program}="path_id %p" +ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" +ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" + +LABEL="persistent_v4l_end" diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules new file mode 100644 index 0000000000..881d7581bf --- /dev/null +++ b/rules/rules.d/80-drivers.rules @@ -0,0 +1,17 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="drivers_end" + +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" +SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \ + RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" +SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" +SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" +SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" +SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" +SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe ppdev" + +LABEL="drivers_end" + diff --git a/rules/rules.d/95-udev-late.rules b/rules/rules.d/95-udev-late.rules new file mode 100644 index 0000000000..7207081d46 --- /dev/null +++ b/rules/rules.d/95-udev-late.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" + +# event to be catched by udevmonitor +RUN+="socket:@/org/kernel/udev/monitor" + diff --git a/rules/slackware/udev.rules b/rules/slackware/udev.rules new file mode 100644 index 0000000000..12dac4d84d --- /dev/null +++ b/rules/slackware/udev.rules @@ -0,0 +1,355 @@ +# /etc/udev/udev.rules: device naming rules for udev +# +# There are a number of modifiers that are allowed to be used in some of the +# fields. See the udev man page for a full description of them. +# +# This rules file is a mix of 10.2 Slackware udev.rules file and some +# rules from the udev examples. +# + +# wait for sysfs +ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" +ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" + +# all block devices +SUBSYSTEM=="block", GROUP="disk" + +# permissions for IDE CD devices (without symbolic link creation) +BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660" + +# permissions for IDE CD devices (with symbolic link creation) +# THIS RULE COMMENTED OUT BY DEFAULT: read /lib/udev/rc.optical-symlinks for more information... +#BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660", RUN+="/lib/udev/cdrom-symlinks.sh %k" + +# permissions for IDE floppy devices +BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-floppy*", NAME="%k", GROUP="floppy", MODE="0660" + +# permissions for SCSI cd/sg/tape devices +BUS=="scsi", KERNEL=="s[grt][0-9]*", SYSFS{type}=="5", NAME="%k", GROUP="cdrom", MODE="0660" + +# load modules to scsi disks, if they aren't in kernel +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" +SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" +SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" + +# disk devices +KERNEL=="sd*", NAME="%k", GROUP="disk" +KERNEL=="dasd*", NAME="%k", GROUP="disk" +KERNEL=="ataraid*", NAME="%k", GROUP="disk" + +# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} + +ACTION!="add", GOTO="persistent_end" +SUBSYSTEM!="block", GOTO="persistent_end" + +# skip rules for inappropriate block devices +KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" + +# never access removable ide devices, the drivers are causing event loops on open() +BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}=="1", GOTO="persistent_end" + +# by-id (hardware serial number) +KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" + +KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode" +KERNEL=="dasd*[!0-9]", IMPORT{program}="/lib/udev/dasd_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +# for partitions import parent information +KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# by-path (shortest physical path) +KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" +KERNEL=="st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="sr*|st*", GOTO="persistent_end" +KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" +KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# by-label/by-uuid (filesystem properties) +KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" +IMPORT{program}="/lib/udev/vol_id --export $tempnode" +ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" +ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" + +# BIOS Enhanced Disk Device +KERNEL=="*[!0-9]", IMPORT{program}="/lib/udev/edd_id --export $tempnode" +KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +# LVM2 dmsetup +KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" + +LABEL="persistent_end" + +# ALSA devices +SUBSYSTEM=="sound", GROUP="audio" +SUBSYSTEM=="snd", GROUP="audio" +KERNEL=="controlC[0-9]*", NAME="snd/%k", MODE="0666" +KERNEL=="hw[CD0-9]*", NAME="snd/%k", MODE="0662" +KERNEL=="pcm[CD0-9]*c", NAME="snd/%k", MODE="0662" +KERNEL=="pcm[CD0-9]*p", NAME="snd/%k", MODE="0666" +KERNEL=="midiC[D0-9]*", NAME="snd/%k", MODE="0666" +KERNEL=="timer", NAME="snd/%k", MODE="0666" +KERNEL=="seq", NAME="snd/%k", MODE="0666" + +# IEEE1394 raw devices (often used for video) +KERNEL=="raw1394", NAME="%k", GROUP="video" +KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" +KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" + +# capi devices +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" + +# cpu devices +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode" + +# dm devices (ignore them) +KERNEL=="dm-[0-9]*", NAME="" +# create a symlink named after the device map name +# note devmap_name comes with extras/multipath +#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" +KERNEL=="device-mapper", NAME="mapper/control" + + +# floppy devices +KERNEL=="fd[0-9]*", NAME="floppy/%n", SYMLINK+="%k", GROUP="floppy", PROGRAM="/lib/udev/floppy-extra-devs.sh %k %b %n" + +# i2c devices +KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" + +# input devices +KERNEL=="mice", NAME="input/%k", MODE="0644", SYMLINK+="mouse" +KERNEL=="mouse*", NAME="input/%k", MODE="0644" +KERNEL=="event*", NAME="input/%k", MODE="0640" +KERNEL=="js*", NAME="input/%k", MODE="664" +KERNEL=="ts*", NAME="input/%k", MODE="0600" +SUBSYSTEM=="input[0-9]*", RUN+="/lib/udev/input_device.sh" +KERNEL=="input[0-9]*", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" + +# loop devices +KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k", GROUP="disk" + +# md block devices +KERNEL=="md[0-9]*", NAME="md/%n", SYMLINK+="%k", GROUP="disk" + +# aoe char devices, +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" + +# netlink devices +KERNEL=="route", NAME="netlink/%k" +KERNEL=="skip", NAME="netlink/%k" +KERNEL=="usersock", NAME="netlink/%k" +KERNEL=="fwmonitor", NAME="netlink/%k" +KERNEL=="tcpdiag", NAME="netlink/%k" +KERNEL=="nflog", NAME="netlink/%k" +KERNEL=="xfrm", NAME="netlink/%k" +KERNEL=="arpd", NAME="netlink/%k" +KERNEL=="route6", NAME="netlink/%k" +KERNEL=="ip6_fw", NAME="netlink/%k" +KERNEL=="dnrtmsg", NAME="netlink/%k" +KERNEL=="tap*", NAME="netlink/%k" + +# ramdisk devices +KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" + +# raw devices +KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" +KERNEL=="ram*", NAME="%k", GROUP="disk" + +# sound devices +KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" +KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" + +# tty devices +KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" +KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" +KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" +KERNEL=="ippp0", NAME="%k", GROUP="tty" +KERNEL=="isdn*", NAME="%k", GROUP="tty" +KERNEL=="dcbri*", NAME="%k", GROUP="tty" +KERNEL=="ircomm*", NAME="%k", GROUP="tty" + +# pty devices +KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" +KERNEL=="pty[p-za-e][0-9a-f]*", NAME="pty/m%m", SYMLINK+="%k", GROUP="tty" +KERNEL=="tty[p-za-e][0-9a-f]*", NAME="pty/s%m", SYMLINK+="%k", GROUP="tty" + +# vc devices +KERNEL=="vcs", NAME="vcc/0", SYMLINK+="%k", GROUP="tty" +KERNEL=="vcs[0-9]*", NAME="vcc/%n", SYMLINK+="%k", GROUP="tty" +KERNEL=="vcsa", NAME="vcc/a0", SYMLINK+="%k", GROUP="tty" +KERNEL=="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK+="%k", GROUP="tty" + +# memory devices +KERNEL=="random", NAME="%k", MODE="0664" +KERNEL=="urandom", NAME="%k", MODE="0664" +KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="0640" +KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="0640" +KERNEL=="port", NAME="%k", GROUP="kmem", MODE="0640" +KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" +KERNEL=="full", NAME="%k", MODE="0666" +KERNEL=="null", NAME="%k", MODE="0666" +KERNEL=="zero", NAME="%k", MODE="0666" + +# misc devices +KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="rtc", NAME="misc/%k", SYMLINK+="%k", MODE="0664" +KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" +KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" + +# usb devices +KERNEL=="hiddev*", NAME="usb/%k" +KERNEL=="auer*", NAME="usb/%k" +KERNEL=="legousbtower*", NAME="usb/%k" +KERNEL=="dabusb*", NAME="usb/%k" + +# fb devices +KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" + +# DRI devices +KERNEL=="card*", NAME="dri/card%n", GROUP="video" +KERNEL=="nvidia*", NAME="%k", GROUP="video" +KERNEL=="3dfx*", NAME="%k", GROUP="video" + +# v4l devices +KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" +KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" +KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" +KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" + +# dvb devices +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'X=%k; X=$${X#dvb}; A=$${X%%%%.*}; D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" + +# Asterix Zaptel devices +KERNEL=="zapctl", NAME="zap/ctl" +KERNEL=="zaptimer", NAME="zap/timer" +KERNEL=="zapchannel", NAME="zap/channel" +KERNEL=="zappseudo", NAME="zap/pseudo" +KERNEL=="zap[0-9]*", NAME="zap/%n" + +# pilot/palm devices +KERNEL=="pilot", NAME="%k", GROUP="uucp" + +# jaz devices +KERNEL=="jaz*", NAME="%k", GROUP="disk" + +# zip devices +KERNEL=="pocketzip*", NAME="%k", GROUP="disk" +KERNEL=="zip*", NAME="%k", GROUP="disk" + +# ls120 devices +KERNEL=="ls120", NAME="%k", GROUP="disk" + +# lp devices +KERNEL=="irlpt", NAME="%k", GROUP="lp", MODE="0664" +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp", MODE="0664" +SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp", MODE="0664" +KERNEL=="parport*", NAME="%k", GROUP="lp", MODE="0664" + +# tape devices +KERNEL=="ht*", NAME="%k" +KERNEL=="nht*", NAME="%k" +KERNEL=="pt*", NAME="%k" +KERNEL=="npt*", NAME="%k" +KERNEL=="st*", NAME="%k" +KERNEL=="nst*", NAME="%k" +KERNEL=="osst*", NAME="%k" +KERNEL=="nosst*", NAME="%k" + +# diskonkey devices +KERNEL=="diskonkey*", NAME="%k", GROUP="disk" + +# rem_ide devices +KERNEL=="microdrive*", NAME="%k", GROUP="disk" + +# kbd devices +KERNEL=="kbd", NAME="%k", MODE="0664" + +# Sony Vaio Jogdial sonypi device +KERNEL=="sonypi", NAME="%k", MODE="0666" + +# packet devices +KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom", MODE="0660" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrom", MODE="0660" + +# infiniband devices +KERNEL=="umad*", NAME="infiniband/%k" +KERNEL=="issm*", NAME="infiniband/%k" + +# PnP +SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ + RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" + +# firewire +SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", IMPORT{program}="modalias_ieee1394" + +# libusb device access +DEVPATH=="/module/usbcore", ACTION=="add", \ + RUN+="/bin/sh -c 'sleep 1; /bin/mount none -t usbfs /proc/bus/usb -o devmode=0666,devgid=10'" +SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev}; B=$${X%%%%.*}; D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" + +# firmware loader +SUBSYSTEM=="firmware", ACTION=="add", RUN+="/lib/udev/firmware_helper" + +# load module +ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" + +# PCMCIA devices: +# +# Very few CIS firmware entries (which we use for matching) +# are so broken that we need to read out random bytes of it +# instead of the manufactor, card or product ID. Then the +# matching is done in userspace. +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \ + RUN+="/sbin/pcmcia-check-broken-cis" + +# However, the "weak" matching by func_id is only allowed _after_ modprobe +# returns, so that "strong" matches have a higher priority. +ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \ + RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" + +# PCMCIA sockets: +# +# modprobe the pcmcia bus module so that 16-bit PCMCIA devices work +ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" + +# if this is a PCMCIA socket which needs a resource database, +# pcmcia-socket-startup sets it up +ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/pcmcia-socket-startup" + +# network devices +KERNEL=="tun", NAME="net/%k" +SUBSYSTEM=="net", ACTION=="add", RUN+="/lib/udev/nethelper.sh $env{INTERFACE} start" +SUBSYSTEM=="net", ACTION=="remove", RUN+="/lib/udev/nethelper.sh $env{INTERFACE} stop" + +# if you use HAL, try this: +# send all events to HAL +#RUN+="socket:/org/freedesktop/hal/udev_event" + +# catch the event in udevmonitor +RUN+="socket:/org/kernel/udev/monitor" diff --git a/rules/suse/40-suse.rules b/rules/suse/40-suse.rules new file mode 100644 index 0000000000..d07a72eced --- /dev/null +++ b/rules/suse/40-suse.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="pmu", GROUP="video" +KERNEL=="nvidia*|nvidiactl*", GROUP="video" +KERNEL=="nvidia*|nvidiactl*", GROUP="video" +KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" +KERNEL=="vttuner*", GROUP="video" +KERNEL=="vtx*|vbi*", GROUP="video" +KERNEL=="winradio*", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="video4linux", GROUP="video" +KERNEL=="agpgart", GROUP="video" + diff --git a/rules/suse/64-device-mapper.rules b/rules/suse/64-device-mapper.rules new file mode 100644 index 0000000000..b065aec554 --- /dev/null +++ b/rules/suse/64-device-mapper.rules @@ -0,0 +1,23 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="device-mapper", SYMLINK+="mapper/control" + +KERNEL!="dm-*", GOTO="device_mapper_end" +ACTION!="add|change", GOTO="device_mapper_end" + +IMPORT{program}="/sbin/dmsetup export -j%M -m%m" +ENV{DM_NAME}!="?*", GOTO="device_mapper_end" + +SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" +ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" + +ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end" +ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" + +IMPORT{program}="vol_id --export $tempnode" +OPTIONS+="link_priority=-100" +ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90" +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +LABEL="device_mapper_end" diff --git a/test/udev-test.pl b/test/udev-test.pl index 72b4aef6bc..f7f68a1416 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -23,7 +23,7 @@ use strict; my $PWD = $ENV{PWD}; my $sysfs = "sys/"; my $udev_bin = "../test-udev"; -my $udev_root = "udev-root/"; # !!! directory will be removed !!! +my $udev_root = "udev-root/"; my $udev_conf = "udev-test.conf"; my $udev_rules = "udev-test.rules"; @@ -1847,12 +1847,12 @@ if (!($<==0)) { } # prepare -make_udev_root (); +make_udev_root(); # create config file open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; print CONF "udev_root=\"$udev_root\"\n"; -print CONF "udev_rules=\"$udev_rules\"\n"; +print CONF "udev_rules=\"$PWD\"\n"; print CONF "udev_log=\"info\"\n"; close CONF; diff --git a/udev.7 b/udev.7 index 4bf625df6d..c4ca28603d 100644 --- a/udev.7 +++ b/udev.7 @@ -25,8 +25,10 @@ and receives uevents directly from the kernel if a device is added or removed fr If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device\. Rules that match may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling\. .SH "CONFIGURATION" .PP -All udev configuration files are placed in -\fI/etc/udev/*\fR\. Every file consists of a set of lines of text\. All empty lines or lines beginning with \'#\' will be ignored\. +udev configuration files are placed in +\fI/etc/udev/\fR +and +\fI/lib/udev/\fR\. All empty lines, or lines beginning with \'#\' will be ignored\. .SS "Configuration file" .PP udev expects its main configuration file at @@ -38,13 +40,6 @@ Specifies where to place the device nodes in the filesystem\. The default value \fI/dev\fR\. .RE .PP -\fBudev_rules\fR -.RS 4 -The name of the udev rules file or directory to look for files with the suffix -\fI\.rules\fR\. Multiple rule files are read in lexical order\. The default value is -\fI/etc/udev/rules\.d\fR\. -.RE -.PP \fBudev_log\fR .RS 4 The logging priority\. Valid values are the numerical syslog priorities or their textual representations: @@ -55,9 +50,11 @@ and .RE .SS "Rules files" .PP -The udev rules are read from the files located in the -\fI/etc/udev/rules\.d\fR -directory or at the location specified value in the configuration file\. Every line in the rules file contains at least one key value pair\. There are two kind of keys, match and assignment keys\. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned\. +The udev rules are read from the files located in the default rules directory +\fI/lib/udev/rules\.d/\fR, the custom rules directory +\fI/etc/udev/rules\.d/\fR +and the temporary rules directory +\fI/dev/\.udev/rules\.d/\fR\. All rule files are sorted and processed in lexical order, regardless in which of these directories they live\. Every line in the rules file contains at least one key value pair\. There are two kind of keys, match and assignment keys\. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned\. .PP A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling\. If no matching rule is found, the default device node name is used\. .PP diff --git a/udev.conf b/udev.conf new file mode 100644 index 0000000000..998b4a7d18 --- /dev/null +++ b/udev.conf @@ -0,0 +1,4 @@ +# The initial syslog(3) priority: "err", "info", "debug" or its +# numerical equivalent. For runtime debugging, the daemons internal +# state can be changed with: "udevadm control --log_priority=". +udev_log="err" diff --git a/udev.h b/udev.h index e1b7ac0d8a..5ecef4abbd 100644 --- a/udev.h +++ b/udev.h @@ -47,9 +47,12 @@ #define READ_END 0 #define WRITE_END 1 +#define UDEV_ROOT "/dev" #define DB_DIR ".udev/db" #define DB_NAME_INDEX_DIR ".udev/names" +#define RULES_LIB_DIR "/lib/udev/rules.d" #define RULES_DYN_DIR ".udev/rules.d" +#define RULES_ETC_DIR "/etc/udev/rules.d" struct udev_rules; diff --git a/udev.xml b/udev.xml index e198679968..c740c0d807 100644 --- a/udev.xml +++ b/udev.xml @@ -40,9 +40,9 @@ CONFIGURATION - All udev configuration files are placed in /etc/udev/*. - Every file consists of a set of lines of text. All empty lines or lines beginning - with '#' will be ignored. + udev configuration files are placed in /etc/udev/ + and /lib/udev/. All empty lines, or lines beginning with + '#' will be ignored. Configuration file udev expects its main configuration file at /etc/udev/udev.conf. @@ -57,16 +57,6 @@ - - - - The name of the udev rules file or directory to look for files - with the suffix .rules. Multiple rule files are - read in lexical order. The default value is - /etc/udev/rules.d. - - - @@ -80,8 +70,11 @@ Rules files The udev rules are read from the files located in the - /etc/udev/rules.d directory or at the location specified - value in the configuration file. Every line in the rules file contains at least + default rules directory /lib/udev/rules.d/, + the custom rules directory /etc/udev/rules.d/ + and the temporary rules directory /dev/.udev/rules.d/. + All rule files are sorted and processed in lexical order, regardless + in which of these directories they live. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. diff --git a/udev_config.c b/udev_config.c index 42190945fc..55f0361dd2 100644 --- a/udev_config.c +++ b/udev_config.c @@ -164,9 +164,9 @@ void udev_config_init(void) { const char *env; - strcpy(udev_root, UDEV_ROOT); strcpy(udev_config_filename, UDEV_CONFIG_FILE); - strcpy(udev_rules_dir, UDEV_RULES_DIR); + strcpy(udev_root, UDEV_ROOT); + udev_rules_dir[0] = '\0'; udev_log_priority = LOG_ERR; udev_run = 1; @@ -195,6 +195,6 @@ void udev_config_init(void) dbg("UDEV_CONFIG_FILE='%s'\n", udev_config_filename); dbg("udev_root='%s'\n", udev_root); - dbg("udev_rules='%s'\n", udev_rules_dir); + dbg("udev_rules_dir='%s'\n", udev_rules_dir); dbg("udev_log=%d\n", udev_log_priority); } diff --git a/udev_rules_parse.c b/udev_rules_parse.c index bdaf55bd48..999af3b85e 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -727,53 +727,53 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) struct stat statbuf; char filename[PATH_MAX]; LIST_HEAD(name_list); - LIST_HEAD(dyn_list); + LIST_HEAD(sort_list); struct name_entry *name_loop, *name_tmp; - struct name_entry *dyn_loop, *dyn_tmp; + struct name_entry *sort_loop, *sort_tmp; int retval = 0; memset(rules, 0x00, sizeof(struct udev_rules)); rules->resolve_names = resolve_names; - /* read main config from single file or all files in a directory */ - if (stat(udev_rules_dir, &statbuf) != 0) - return -1; - if ((statbuf.st_mode & S_IFMT) != S_IFDIR) { - dbg("parse single rules file '%s'\n", udev_rules_dir); - name_list_add(&name_list, udev_rules_dir, 1); + if (udev_rules_dir[0] != '\0') { + /* custom rules location for testing */ + add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX); } else { - dbg("parse rules directory '%s'\n", udev_rules_dir); - retval = add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX); - } - - /* read dynamic rules directory */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); - if (stat(filename, &statbuf) != 0) { - create_path(filename); - selinux_setfscreatecon(filename, NULL, S_IFDIR|0755); - mkdir(filename, 0755); - selinux_resetfscreatecon(); - } - add_matching_files(&dyn_list, filename, RULESFILE_SUFFIX); + /* read default rules */ + add_matching_files(&name_list, RULES_LIB_DIR, RULESFILE_SUFFIX); + + /* read user/custom rules */ + add_matching_files(&sort_list, RULES_ETC_DIR, RULESFILE_SUFFIX); + + /* read dynamic/temporary rules */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); + if (stat(filename, &statbuf) != 0) { + create_path(filename); + selinux_setfscreatecon(filename, NULL, S_IFDIR|0755); + mkdir(filename, 0755); + selinux_resetfscreatecon(); + } + add_matching_files(&sort_list, filename, RULESFILE_SUFFIX); - /* sort dynamic rules files by basename into list of files */ - list_for_each_entry_safe(dyn_loop, dyn_tmp, &dyn_list, node) { - const char *dyn_base = strrchr(dyn_loop->name, '/'); + /* sort all rules files by basename into list of files */ + list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) { + const char *sort_base = strrchr(sort_loop->name, '/'); - if (dyn_base == NULL) - continue; + if (sort_base == NULL) + continue; - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - const char *name_base = strrchr(name_loop->name, '/'); + list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { + const char *name_base = strrchr(name_loop->name, '/'); - if (name_base == NULL) - continue; + if (name_base == NULL) + continue; - if (strcmp(name_base, dyn_base) > 0) - break; + if (strcmp(name_base, sort_base) > 0) + break; + } + list_move_tail(&sort_loop->node, &name_loop->node); } - list_move_tail(&dyn_loop->node, &name_loop->node); } /* parse list of files */ diff --git a/udevd.c b/udevd.c index d6977e9655..0827a5ceb3 100644 --- a/udevd.c +++ b/udevd.c @@ -1142,14 +1142,23 @@ int main(int argc, char *argv[], char *envp[]) /* watch rules directory */ inotify_fd = inotify_init(); if (inotify_fd >= 0) { - char filename[PATH_MAX]; - - inotify_add_watch(inotify_fd, udev_rules_dir, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - - /* watch dynamic rules directory */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); - inotify_add_watch(inotify_fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + if (udev_rules_dir[0] != '\0') { + inotify_add_watch(inotify_fd, udev_rules_dir, + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + } else { + char filename[PATH_MAX]; + + inotify_add_watch(inotify_fd, RULES_LIB_DIR, + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + inotify_add_watch(inotify_fd, RULES_ETC_DIR, + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + + /* watch dynamic rules directory */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); + inotify_add_watch(inotify_fd, filename, + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + } } else if (errno == ENOSYS) err("the kernel does not support inotify, udevd can't monitor rules file changes\n"); else -- cgit v1.2.3-54-g00ecf From 655a8acf920cd43356003b4499e545a7b2fcc402 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Fri, 18 Jul 2008 16:22:26 +0200 Subject: ignore rule with GOTO to a non-existent label --- udev_rules_parse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 999af3b85e..3ada8b1c7d 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -60,11 +60,13 @@ struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label) { static struct udev_rule *rule; + size_t start = rules->current; next: dbg("current=%zi\n", rules->current); if (rules->current >= rules->bufsize) { - dbg("no more rules\n"); + err("LABEL='%s' not found, GOTO will be ignored\n", label); + rules->current = start; return NULL; } rule = (struct udev_rule *) (rules->buf + rules->current); -- cgit v1.2.3-54-g00ecf From 05b9640022d25a75923cc7809409914491a5f9da Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Jul 2008 16:26:55 +0200 Subject: release 125 --- ChangeLog | 41 +++++++++++++++++++++++++++++++++++++++++ Makefile | 2 +- README | 2 +- RELEASE-NOTES | 23 +++++++++++++++++++++++ TODO | 1 + 5 files changed, 67 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b9d1ac764a..5c6ded726b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,44 @@ +Summary of changes from v124 to v125 +============================================ + +John Huttley (1): + rules: tape rules - add nst to usb and 1394 links + +Karl O. Pinc (1): + man: clarify $attr{} parent searching + +Kay Sievers (14): + collect: fix size_t printf + path_id: suppress trailing '-' like 'ID_PATH=pci-0000:05:01.0-' + rules: add v4l persistent links + docs: update some docs and delete outdated stuff + scsi_id: fix fallback to sg v3 for sg nodes + rules: fix cciss rules for partition numbers > 9 + udev.conf: udevcontrol -> udevadm control + rules: use consistently OPTIONS+= + scsi_id: the fallback fix broke error handling + man: rebuild from xml + do not touch node ownership and permissions, if already correct + rules: tape rules - add nst to by-path/ links + udevadm: info - add --export format to --device-id-of-file= + move default rules from /etc/udev/rules.d/ to /lib/udev/rules.d/ + +Marco d'Itri (7): + rules_generator: net rules - do not print error if file is missing and ignore commented rules + man: add link_priority default value + scsi_id: man page fix + udevadm: settle - add verbose output when running into timeout + rules: Debian update + rules: Debian update + ignore rule with GOTO to a non-existent label + +Thomas Koeller (1): + scsi_id: include sys/stat.h + +Tobias Klauser (1): + collect: check realloc return value + + Summary of changes from v123 to v124 ============================================ diff --git a/Makefile b/Makefile index ed2b381d07..8b391a01fc 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,7 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION = 124 +VERSION = 125 # set this to make use of syslog USE_LOG = true diff --git a/README b/README index 00acf97c27..0af212de9c 100644 --- a/README +++ b/README @@ -42,7 +42,7 @@ Operation: from the kernel driver core. - All kernel events are matched against a set of specified rules in - /etc/udev/rules.d/ which make it possible to hook into the event + /lib/udev/rules.d/ which make it possible to hook into the event processing to load required kernel modules and setup devices. For all devices the kernel exports a major/minor number, udev will create a device node with the default kernel name, or the one specified by a diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d82b7bcb72..fea7db0d2b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -1,3 +1,26 @@ +udev 125 +======== +Bugfixes. + +Default udev rules, which are not supposed to be edited by the user, should +be placed in /lib/udev/rules.d/ now, to make it clear that they are private to +the udev package and will be replaced with an update. Udev will pick up rule +files from: + /lib/udev/rules.d/ - default installed rules + /etc/udev/rules.d/ - user rules + on-the-fly generated rules + /dev/.udev/rules.d/ - temporary non-persistent rules created after bootup +It does not matter in which directory a rule file lives, all files are sorted +in lexical order. + +To help creating /dev/root, we have now: + $ udevadm info --export --export-prefix="ROOT_" --device-id-of-file=/ + ROOT_MAJOR=8 + ROOT_MINOR=5 +In case the current --device-id-of-file is already used, please switch to +the --export format version, it saves the output parsing and the old +format will be changed to use ':' as a separator, like the format in the +sysfs 'dev' file. + udev 124 ======== Fix cdrom_id to properly recognize blank media. diff --git a/TODO b/TODO index 8a217b0fbb..46af966c40 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,7 @@ These things would be nice to have: These things will change in future udev versions: + o --device-id-of-file will print '5:8' instead of '5 8' These things are deprecated and scheduled for removal in a future udev version: o the installation of symlinks to udevadm -- cgit v1.2.3-54-g00ecf From aa5e29a58112aa838be8d04f9e6c994af056f1d1 Mon Sep 17 00:00:00 2001 From: Thomas Koeller Date: Tue, 22 Jul 2008 15:57:40 +0200 Subject: use proper directory lib/lib64 for libvolume_id --- extras/volume_id/lib/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile index 96ee8f5150..95bb2ed394 100644 --- a/extras/volume_id/lib/Makefile +++ b/extras/volume_id/lib/Makefile @@ -5,8 +5,9 @@ # Released under the GNU General Public License, version 2. # includedir = ${prefix}/usr/include -libdir = ${prefix}/lib -usrlibdir = ${prefix}/usr/lib +oslibdir = $(shell $(CC) $(CFLAGS) -print-multi-os-directory) +libdir = $(realpath ${prefix}/lib/$(oslibdir)) +usrlibdir = $(realpath ${prefix}/usr/lib/$(oslibdir)) INSTALL = install -c INSTALL_DATA = ${INSTALL} -m 644 -- cgit v1.2.3-54-g00ecf From 726687ad48bdececed1e7e44387c50e009e28208 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Jul 2008 00:39:15 +0200 Subject: delete all Makefiles and move udev source to udev/ --- Makefile | 354 --------- NEWS | 861 +++++++++++++++++++++ RELEASE-NOTES | 861 --------------------- extras/ata_id/Makefile | 72 -- extras/cdrom_id/Makefile | 74 -- extras/collect/Makefile | 65 -- extras/edd_id/Makefile | 75 -- extras/firmware/Makefile | 59 -- extras/floppy/Makefile | 71 -- extras/fstab_import/.gitignore | 1 + extras/fstab_import/Makefile | 72 -- extras/path_id/Makefile | 60 -- extras/rule_generator/Makefile | 70 -- extras/scsi_id/Makefile | 91 --- extras/usb_id/Makefile | 70 -- extras/volume_id/Makefile | 84 --- extras/volume_id/lib/Makefile | 138 ---- extras/volume_id/vol_id.8 | 79 -- list.h | 289 ------- logging.h | 73 -- test-udev.c | 175 ----- udev.7 | 432 ----------- udev.h | 184 ----- udev.xml | 639 ---------------- udev/list.h | 289 +++++++ udev/logging.h | 73 ++ udev/test-udev.c | 175 +++++ udev/udev.h | 184 +++++ udev/udev.xml | 639 ++++++++++++++++ udev/udev_config.c | 200 +++++ udev/udev_db.c | 331 ++++++++ udev/udev_device.c | 305 ++++++++ udev/udev_node.c | 448 +++++++++++ udev/udev_rules.c | 1618 ++++++++++++++++++++++++++++++++++++++++ udev/udev_rules.h | 131 ++++ udev/udev_rules_parse.c | 804 ++++++++++++++++++++ udev/udev_selinux.c | 173 +++++ udev/udev_selinux.h | 38 + udev/udev_sysdeps.c | 73 ++ udev/udev_sysdeps.h | 172 +++++ udev/udev_sysfs.c | 509 +++++++++++++ udev/udev_utils.c | 222 ++++++ udev/udev_utils_file.c | 178 +++++ udev/udev_utils_string.c | 270 +++++++ udev/udevadm.c | 168 +++++ udev/udevadm.xml | 379 ++++++++++ udev/udevcontrol.c | 165 ++++ udev/udevd.c | 1304 ++++++++++++++++++++++++++++++++ udev/udevd.h | 74 ++ udev/udevd.xml | 108 +++ udev/udevinfo.c | 500 +++++++++++++ udev/udevmonitor.c | 289 +++++++ udev/udevsettle.c | 178 +++++ udev/udevtest.c | 207 +++++ udev/udevtrigger.c | 712 ++++++++++++++++++ udev_config.c | 200 ----- udev_db.c | 331 -------- udev_device.c | 305 -------- udev_node.c | 448 ----------- udev_rules.c | 1618 ---------------------------------------- udev_rules.h | 131 ---- udev_rules_parse.c | 804 -------------------- udev_selinux.c | 173 ----- udev_selinux.h | 38 - udev_sysdeps.c | 73 -- udev_sysdeps.h | 172 ----- udev_sysfs.c | 509 ------------- udev_utils.c | 222 ------ udev_utils_file.c | 178 ----- udev_utils_string.c | 270 ------- udevadm.8 | 272 ------- udevadm.c | 168 ----- udevadm.xml | 379 ---------- udevcontrol.c | 165 ---- udevd.8 | 61 -- udevd.c | 1304 -------------------------------- udevd.h | 74 -- udevd.xml | 108 --- udevinfo.c | 500 ------------- udevmonitor.c | 289 ------- udevsettle.c | 178 ----- udevtest.c | 207 ----- udevtrigger.c | 712 ------------------ 83 files changed, 11778 insertions(+), 13976 deletions(-) delete mode 100644 Makefile create mode 100644 NEWS delete mode 100644 RELEASE-NOTES delete mode 100644 extras/ata_id/Makefile delete mode 100644 extras/cdrom_id/Makefile delete mode 100644 extras/collect/Makefile delete mode 100644 extras/edd_id/Makefile delete mode 100644 extras/firmware/Makefile delete mode 100644 extras/floppy/Makefile create mode 100644 extras/fstab_import/.gitignore delete mode 100644 extras/fstab_import/Makefile delete mode 100644 extras/path_id/Makefile delete mode 100644 extras/rule_generator/Makefile delete mode 100644 extras/scsi_id/Makefile delete mode 100644 extras/usb_id/Makefile delete mode 100644 extras/volume_id/Makefile delete mode 100644 extras/volume_id/lib/Makefile delete mode 100644 extras/volume_id/vol_id.8 delete mode 100644 list.h delete mode 100644 logging.h delete mode 100644 test-udev.c delete mode 100644 udev.7 delete mode 100644 udev.h delete mode 100644 udev.xml create mode 100644 udev/list.h create mode 100644 udev/logging.h create mode 100644 udev/test-udev.c create mode 100644 udev/udev.h create mode 100644 udev/udev.xml create mode 100644 udev/udev_config.c create mode 100644 udev/udev_db.c create mode 100644 udev/udev_device.c create mode 100644 udev/udev_node.c create mode 100644 udev/udev_rules.c create mode 100644 udev/udev_rules.h create mode 100644 udev/udev_rules_parse.c create mode 100644 udev/udev_selinux.c create mode 100644 udev/udev_selinux.h create mode 100644 udev/udev_sysdeps.c create mode 100644 udev/udev_sysdeps.h create mode 100644 udev/udev_sysfs.c create mode 100644 udev/udev_utils.c create mode 100644 udev/udev_utils_file.c create mode 100644 udev/udev_utils_string.c create mode 100644 udev/udevadm.c create mode 100644 udev/udevadm.xml create mode 100644 udev/udevcontrol.c create mode 100644 udev/udevd.c create mode 100644 udev/udevd.h create mode 100644 udev/udevd.xml create mode 100644 udev/udevinfo.c create mode 100644 udev/udevmonitor.c create mode 100644 udev/udevsettle.c create mode 100644 udev/udevtest.c create mode 100644 udev/udevtrigger.c delete mode 100644 udev_config.c delete mode 100644 udev_db.c delete mode 100644 udev_device.c delete mode 100644 udev_node.c delete mode 100644 udev_rules.c delete mode 100644 udev_rules.h delete mode 100644 udev_rules_parse.c delete mode 100644 udev_selinux.c delete mode 100644 udev_selinux.h delete mode 100644 udev_sysdeps.c delete mode 100644 udev_sysdeps.h delete mode 100644 udev_sysfs.c delete mode 100644 udev_utils.c delete mode 100644 udev_utils_file.c delete mode 100644 udev_utils_string.c delete mode 100644 udevadm.8 delete mode 100644 udevadm.c delete mode 100644 udevadm.xml delete mode 100644 udevcontrol.c delete mode 100644 udevd.8 delete mode 100644 udevd.c delete mode 100644 udevd.h delete mode 100644 udevd.xml delete mode 100644 udevinfo.c delete mode 100644 udevmonitor.c delete mode 100644 udevsettle.c delete mode 100644 udevtest.c delete mode 100644 udevtrigger.c diff --git a/Makefile b/Makefile deleted file mode 100644 index 8b391a01fc..0000000000 --- a/Makefile +++ /dev/null @@ -1,354 +0,0 @@ -# -# Copyright (C) 2003-2004 Greg Kroah-Hartman -# Copyright (C) 2004-2006 Kay Sievers -# -# 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 -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# - -VERSION = 125 - -# set this to make use of syslog -USE_LOG = true - -# compile-in development debug messages -# (export UDEV_LOG="debug" or set udev_log="debug" in udev.conf -# to print the debug messages to syslog) -DEBUG = false - -# compile with gcc's code coverage option -USE_GCOV = false - -# include Security-Enhanced Linux support -USE_SELINUX = false - -# set this to create statically linked binaries -USE_STATIC = false - -# to build any of the extras programs pass: -# make EXTRAS="extras/ extras/" -EXTRAS = - -# make the build silent -V = - -PROGRAMS = \ - udevd \ - udevadm \ - test-udev - -HEADERS = \ - udev.h \ - udevd.h \ - udev_rules.h \ - logging.h \ - udev_sysdeps.h \ - udev_selinux.h \ - list.h - -UDEV_OBJS = \ - udev_device.o \ - udev_config.o \ - udev_node.o \ - udev_db.o \ - udev_sysfs.o \ - udev_rules.o \ - udev_rules_parse.o \ - udev_utils.o \ - udev_utils_string.o \ - udev_utils_file.o \ - udevmonitor.o \ - udevinfo.o \ - udevcontrol.o \ - udevtrigger.o \ - udevsettle.o \ - udevtest.o \ - udev_sysdeps.o -LIBUDEV = libudev.a - -MAN_PAGES = \ - udev.7 \ - udevd.8 \ - udevadm.8 - -GEN_HEADERS = \ - udev_version.h - -prefix ?= -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev -udevdir = /dev -DESTDIR = - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} -PWD = $(shell pwd) - -CROSS_COMPILE ?= -CC = $(CROSS_COMPILE)gcc -LD = $(CROSS_COMPILE)gcc -AR = $(CROSS_COMPILE)ar -RANLIB = $(CROSS_COMPILE)ranlib - -CFLAGS += -g -Wall -pipe -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -WARNINGS = -Wstrict-prototypes -Wsign-compare -Wshadow \ - -Wchar-subscripts -Wmissing-declarations -Wnested-externs \ - -Wpointer-arith -Wcast-align -Wsign-compare -Wmissing-prototypes -CFLAGS += $(WARNINGS) - -LDFLAGS += -Wl,-warn-common,--as-needed - -OPTFLAGS = -Os -CFLAGS += $(OPTFLAGS) - -ifeq ($(strip $(USE_LOG)),true) - CFLAGS += -DUSE_LOG -endif - -# if DEBUG is enabled, then we do not strip -ifeq ($(strip $(DEBUG)),true) - CFLAGS += -DDEBUG -endif - -ifeq ($(strip $(USE_GCOV)),true) - CFLAGS += -fprofile-arcs -ftest-coverage - LDFLAGS += -fprofile-arcs -endif - -ifeq ($(strip $(USE_SELINUX)),true) - UDEV_OBJS += udev_selinux.o - LIB_OBJS += -lselinux -lsepol - CFLAGS += -DUSE_SELINUX -endif - -ifeq ($(strip $(USE_STATIC)),true) - CFLAGS += -DUSE_STATIC - LDFLAGS += -static -endif - -ifeq ($(strip $(V)),) - E = @echo - Q = @ -else - E = @\# - Q = -endif -export E Q - -all: $(PROGRAMS) $(MAN_PAGES) - $(Q) extras="$(EXTRAS)"; for target in $$extras; do \ - $(MAKE) CC="$(CC)" \ - CFLAGS="$(CFLAGS)" \ - LD="$(LD)" \ - LDFLAGS="$(LDFLAGS)" \ - AR="$(AR)" \ - RANLIB="$(RANLIB)" \ - LIB_OBJS="$(LIB_OBJS)" \ - LIBUDEV="$(PWD)/$(LIBUDEV)" \ - -C $$target $@ || exit 1; \ - done; -.PHONY: all -.DEFAULT: all - -# clear implicit rules -.SUFFIXES: - -# build the objects -%.o: %.c $(HEADERS) $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -# "Static Pattern Rule" to build all programs -$(PROGRAMS): %: $(HEADERS) $(GEN_HEADERS) $(LIBUDEV) %.o - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o -o $@ $(LIBUDEV) $(LIB_OBJS) - -$(LIBUDEV): $(HEADERS) $(GEN_HEADERS) $(UDEV_OBJS) - $(Q) rm -f $@ - $(E) " AR " $@ - $(Q) $(AR) cq $@ $(UDEV_OBJS) - $(E) " RANLIB " $@ - $(Q) $(RANLIB) $@ - -udev_version.h: - $(E) " GENHDR " $@ - $(Q) echo "/* Generated by make. */" > $@ - $(Q) echo \#define UDEV_VERSION \"$(VERSION)\" >> $@ - $(Q) echo \#define UDEV_CONFIG_FILE \"$(configdir)/udev.conf\" >> $@ - -# man pages -%.8 %.7: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) - find . -type f -name '*.orig' -print0 | xargs -0r rm -f - $(Q) - find . -type f -name '*.rej' -print0 | xargs -0r rm -f - $(Q) - find . -type f -name '*~' -print0 | xargs -0r rm -f - $(Q) - find . -type f -name '*.[oas]' -print0 | xargs -0r rm -f - $(Q) - find . -type f -name "*.gcno" -print0 | xargs -0r rm -f - $(Q) - find . -type f -name "*.gcda" -print0 | xargs -0r rm -f - $(Q) - find . -type f -name "*.gcov" -print0 | xargs -0r rm -f - $(Q) - rm -f udev_gcov.txt - $(Q) - rm -f core $(PROGRAMS) $(GEN_HEADERS) - $(Q) - rm -f udev-$(VERSION).tar.gz - $(Q) - rm -f udev-$(VERSION).tar.bz2 - $(Q) - rm -f udev-git-HEAD.patch - @ extras="$(EXTRAS)"; for target in $$extras; do \ - $(MAKE) -C $$target $@ || exit 1; \ - done; -.PHONY: clean - -install-config: - $(INSTALL) -d $(DESTDIR)$(libudevdir)/rules.d - $(INSTALL) -d $(DESTDIR)$(configdir)/rules.d - @ if [ ! -r $(DESTDIR)$(configdir)/udev.conf ]; then \ - $(INSTALL_DATA) udev.conf $(DESTDIR)$(configdir); \ - fi - cp rules/rules.d/* $(DESTDIR)$(libudevdir)/rules.d - @ extras="$(EXTRAS)"; for target in $$extras; do \ - $(MAKE) -C $$target $@ || exit 1; \ - done; -.PHONY: install-config - -install-man: - $(INSTALL) -d $(DESTDIR)$(mandir)/man7 - $(INSTALL_DATA) udev.7 $(DESTDIR)$(mandir)/man7/udev.7 - $(INSTALL) -d $(DESTDIR)$(mandir)/man8 - $(INSTALL_DATA) udevd.8 $(DESTDIR)$(mandir)/man8/udevd.8 - $(INSTALL_DATA) udevadm.8 $(DESTDIR)$(mandir)/man8/udevadm.8 - @extras="$(EXTRAS)"; for target in $$extras; do \ - $(MAKE) -C $$target $@ || exit 1; \ - done; -.PHONY: install-man - -uninstall-man: - - rm -f $(DESTDIR)$(mandir)/man7/udev.7 - - rm -f $(DESTDIR)$(mandir)/man8/udevadm.8 - - rm -f $(DESTDIR)$(mandir)/man8/udevd.8 - @ extras="$(EXTRAS)"; for target in $$extras; do \ - $(MAKE) -C $$target $@ || exit 1; \ - done; -.PHONY: uninstall-man - -install-bin: - $(INSTALL) -d $(DESTDIR)$(sbindir) - $(INSTALL_PROGRAM) udevd $(DESTDIR)$(sbindir)/udevd - $(INSTALL_PROGRAM) udevadm $(DESTDIR)$(sbindir)/udevadm - ln -f -s udevadm $(DESTDIR)$(sbindir)/udevsettle - $(INSTALL) -d $(DESTDIR)$(usrbindir) - ln -f -s $(sbindir)/udevadm $(DESTDIR)$(usrbindir)/udevinfo - @extras="$(EXTRAS)"; for target in $$extras; do \ - $(MAKE) -C $$target $@ || exit 1; \ - done; -ifndef DESTDIR - - killall udevd - - rm -rf $(udevdir)/.udev - - $(sbindir)/udevd --daemon -endif -.PHONY: install-bin - -uninstall-bin: - - rm -f $(DESTDIR)$(sbindir)/udevd - - rm -f $(DESTDIR)$(sbindir)/udevadm - - rm -f $(DESTDIR)$(sbindir)/udevsettle - - rm -f $(DESTDIR)$(usrbindir)/udevinfo -ifndef DESTDIR - - killall udevd - - rm -rf $(udevdir)/.udev -endif - @extras="$(EXTRAS)"; for target in $$extras; do \ - $(MAKE) -C $$target $@ || exit 1; \ - done; -.PHONY: uninstall-bin - -install: all install-bin install-config install-man -.PHONY: install - -uninstall: uninstall-bin uninstall-man -.PHONY: uninstall - -test tests: all - @ cd test && ./udev-test.pl -.PHONY: test tests - -buildtest: - test/simple-build-check.sh -.PHONY: buildtest - -ChangeLog: - head -1 $@ | grep -q "to v$(shell echo $$(($(VERSION) - 1)))" - @ mv $@ $@.tmp - @ echo "Summary of changes from v$(shell echo $$(($(VERSION) - 1))) to v$(VERSION)" >> $@ - @ echo "============================================" >> $@ - @ echo >> $@ - @ git log --pretty=short $(shell echo $$(($(VERSION) - 1)))..HEAD | git shortlog >> $@ - @ echo >> $@ - @ cat $@ - @ cat $@.tmp >> $@ - @ rm $@.tmp - head -1 $@ | grep -q "to v$(VERSION)" -.PHONY: ChangeLog -.PRECIOUS: ChangeLog - -release: - $(Q) - rm -f udev-$(VERSION).tar.gz - $(Q) - rm -f udev-$(VERSION).tar.bz2 - head -1 ChangeLog | grep -q "to v$(VERSION)" - head -1 RELEASE-NOTES | grep -q "udev $(VERSION)" - git commit -a -m "release $(VERSION)" - cat .git/refs/heads/master > .git/refs/tags/$(VERSION) - @ echo - git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | gzip -9v > udev-$(VERSION).tar.gz - git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 -.PHONY: release - -dist: - git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | gzip -9v > udev-$(VERSION).tar.gz - git-archive --format=tar --prefix=udev-$(VERSION)/ HEAD | bzip2 -9v > udev-$(VERSION).tar.bz2 -.PHONY: dist - -patch: - git diff $(shell echo $$(($(VERSION) - 1))) HEAD > udev-git-HEAD.patch -.PHONY: patch - -gcov-all: - $(MAKE) clean all USE_GCOV=true - @ echo - @ echo "binaries built with gcov support." - @ echo "run the tests and analyze with 'make udev_gcov.txt'" -.PHONY: gcov-all - -# see docs/README-gcov_for_udev -udev_gcov.txt: $(wildcard *.gcda) $(wildcard *.gcno) - for file in `find -maxdepth 1 -name "*.gcno"`; do \ - name=`basename $$file .gcno`; \ - echo "################" >> $@; \ - echo "$$name.c" >> $@; \ - echo "################" >> $@; \ - if [ -e "$$name.gcda" ]; then \ - gcov -l "$$name.c" >> $@ 2>&1; \ - else \ - echo "code for $$name.c was never executed" >> $@ 2>&1; \ - fi; \ - echo >> $@; \ - done; \ - echo "view $@ for the result" diff --git a/NEWS b/NEWS new file mode 100644 index 0000000000..fea7db0d2b --- /dev/null +++ b/NEWS @@ -0,0 +1,861 @@ +udev 125 +======== +Bugfixes. + +Default udev rules, which are not supposed to be edited by the user, should +be placed in /lib/udev/rules.d/ now, to make it clear that they are private to +the udev package and will be replaced with an update. Udev will pick up rule +files from: + /lib/udev/rules.d/ - default installed rules + /etc/udev/rules.d/ - user rules + on-the-fly generated rules + /dev/.udev/rules.d/ - temporary non-persistent rules created after bootup +It does not matter in which directory a rule file lives, all files are sorted +in lexical order. + +To help creating /dev/root, we have now: + $ udevadm info --export --export-prefix="ROOT_" --device-id-of-file=/ + ROOT_MAJOR=8 + ROOT_MINOR=5 +In case the current --device-id-of-file is already used, please switch to +the --export format version, it saves the output parsing and the old +format will be changed to use ':' as a separator, like the format in the +sysfs 'dev' file. + +udev 124 +======== +Fix cdrom_id to properly recognize blank media. + +udev 123 +======== +Bugfixes. + +Tape drive id-data is queried from /dev/bsg/* instead of the tape +nodes. This avoids rewinding tapes on open(). + +udev 122 +======== +Bugfixes. + +The symlinks udevcontrol and udevtrigger are no longer installed by +the Makefile. + +The scsi_id program does not depend on sysfs anymore. It can speak +SGv4 now, so /dev/bsg/* device nodes can be used, to query SCSI device +data, which should solve some old problems with tape devices, where +we better do not open all tape device nodes to identify the device. + +udev 121 +======== +Many bugfixes. + +The cdrom_id program is replaced by an advanced version, which can +detect most common device types, and also properties of the inserted +media. This is part of moving some basic functionality from HAL into +udev (and the kernel). + +udev 120 +======== +Bugfixes. + +The last WAIT_FOR_SYSFS rule is removed from the default rules. + +The symlinks to udevadm for the debugging tools: udevmonitor and +udevtest are no longer created. + +The symlinks to the udevadm man page for the old tool names are +no longer created. + +Abstract namespace sockets paths in RUN+="socket:@" rules, +should be prefixed with '@' to indicate that the path is not a +real file. + +udev 119 +======== +Bugfixes. + +udev 118 +======== +Bugfixes. + +Udevstart is removed from the tree, it did not get installed for +a long time now, and is long replaced by trigger and settle. + +udev 117 +======== +Bugfixes. + +All udev tools are merged into a single binary called udevadm. +The old names of the tools are built-in commands in udevadm now. +Symlinks to udevadm, with the names of the old tools, provide +the same functionality as the standalone tools. There is also +only a single udevadm.8 man page left for all tools. + +Tools like mkinitramfs should be checked, if they need to include +udevadm in the list of files. + +udev 116 +======== +Bugfixes. + +udev 115 +======== +Bugfixes. + +The etc/udev/rules.d/ directory now contains a default set of basic +udev rules. This initial version is the result of a rules file merge +of Fedora and openSUSE. For these both distros only a few specific +rules are left in their own file, named after the distro. Rules which +are optionally installed, because they are only valid for a specific +architecture, or rules for subsystems which are not always used are +in etc/udev/packages/. + +udev 114 +======== +Bugfixes. + +Dynamic rules can be created in /dev/.udev/rules.d/ to trigger +actions by dynamically created rules. + +SYMLINK=="" matches agains the entries in the list of +currently defined symlinks. The links are not created in the +filesystem at that point in time, but the values can be matched. + +RUN{ignore_error}+="" will ignore any exit code from the +program and not record as a failed event. + +udev 113 +======== +Bugfixes. + +Final merge of patches/features from the Ubuntu package. + +udev 112 +======== +Bugfixes. + +Control characters in filesystem label strings are no longer silenty +removed, but hex-encoded, to be able to uniquely identify the device +by its symlink in /dev/disk/by-label/. +If libvolume_id is used by mount(8), LABEL= will work as expected, +if slashes or other characters are used in the label string. + +To test the existence of a file, TEST=="" and TEST!="" +can be specified now. The TEST key accepts an optional mode mask +TEST{0100}=="". + +Scsi_id now supports a mode without expecting scsi-specific sysfs +entries to allow the extraction of cciss-device persistent properties. + +udev 111 +======== +Bugfixes. + +In the future, we may see uuid's which are just simple character +strings (see the DDF Raid Specification). For that reason vol_id now +exports ID_FS_UUID_SAFE, just like ID_FS_LABEL_SAFE. For things like +the creation of symlinks, the *_SAFE values ensure, that no control +or whitespace characters are used in the filename. + +Possible users of libvolume_id, please use the volume_id_get_* functions. +The public struct will go away in a future release of the library. + +udev 110 +======== +Bugfixes. + +Removal of useless extras/eventrecorder.sh. + +udev 109 +======== +Bugfixes. + +udev 108 +======== +Bugfixes. + +The directory multiplexer for dev.d/ and hotplug.d are finally removed +from the udev package. + +udev 107 +======== +Bugfixes. + +Symlinks can have priorities now, the priority is assigned to the device +and specified with OPTIONS="link_priority=100". Devices with higher +priorities overwrite the symlinks of devices with lower priorities. +If the device that currently owns the link, goes away, the symlink +will be removed, and recreated, pointing to the next device with the +highest actual priority. This should make /dev/disk/by-{label,uuid,id} +more reliable, if multiple devices contain the same metadata and overwrite +these symlinks. + +The dasd_id program is removed from the udev tree, and dasdinfo, with the +needed rules, are part of the s390-tools now. + +Please add KERNEL=="[0-9]*:[0-9]*" to the scsi wait-for-sysfs rule, +we may get the scsi sysfs mess fixed some day, and this will only catch +the devices we are looking for. + +USB serial numbers for storage devices have the target:lun now appended, +to make it possibble to distinguish broken multi-lun devices with all +the same SCSI identifiers. + +Note: The extra "run_directory" which searches and executes stuff in +/etc/hotplug.d/ and /etc/dev.d/ is long deprecated, and will be removed +with the next release. Make sure, that you don't use it anymore, or +provides your own implementation of that inefficient stuff. +We are tired of reports about a "slow udev", because these directories +contain stuff, that runs with _every_ event, instead of using rules, +that run programs only for the matching events. + +udev 106 +======== +Bugfixes. + +udev 105 +======== +Bugfixes. + +DRIVER== will match only for devices that actually have a real +driver. DRIVERS== must be used, if parent devices should be +included in the match. + +Libvolume_id's "linux_raid" detection needed another fix. + +udev 104 +======== +Bugfixes. + +udev 103 +======== +Add additional check to volume_id detection of via_raid, cause +some company decided to put a matching pattern all over the empty +storage area of their music players. + +udev 102 +======== +Fix path_id for SAS devices. + +udev 101 +======== +The udev daemon can be started with --debug-trace now, which will +execute all events serialized to get a chance to catch a possible +action that crashes the box. + +A warning is logged, if PHYSDEV* keys, the "device" link, or a parent +device attribute like $attr{../file} is used, only WAIT_FOR_SYSFS rules +are excluded from the warning. Referencing parent attributes directly +may break when something in the kernel driver model changes. Udev will +just find the attribute by walking up the parent chain. + +Udevtrigger now sorts the list of devices depending on the device +dependency, so a "usb" device is triggered after the parent "pci" +device. + +udev 100 +======== +Revert persistent-storage ata-serial '_' '-' replacement. + +udev 099 +======== +Bugfixes. + +Udevtrigger can now filter the list of devices to be triggered. Matches +for subsystems or sysfs attributes can be specified. + +The entries in /dev/.udev/queue and /dev/.udev/failed have changed to +zero-sized files to avoid pointing to /sys and confuse broken tools which +scan the /dev directory. To retry failed events, udevtrigger --retry-failed +should be used now. + +The rules and scripts to create udev rules for persistent network +devices and optical drives are in the extras/rules_generator directory +now. If you use something similar, please consider replacing your own +version with this, to share the support effort. The rule_generator +installs its own rules into /etc/udev/rules.d. + +The cdrom_id tool installs its own rule now in /etc/udev/rules.d, cause +the rule_generator depends on cdrom_id to be called in an earlier rule. + +udev 098 +======== +Bugfixes. + +Renaming of some key names (the old names still work): +BUS -> SUBSYSTEMS, ID -> KERNELS, SYSFS -> ATTRS, DRIVER -> DRIVERS. +(The behavior of the key DRIVER will change soon in one of the next +releases, to match only the event device, please switch to DRIVERS +instead. If DRIVER is used, it will behave like DRIVERS, but an error +is logged. +With the new key names, we have a more consistent and simpler scheme. +We can match the properties of the event device only, with: KERNEL, +SUBSYSTEM, ATTR, DRIVER. Or include all the parent devices in the match, +with: KERNELS, SUBSYSTEMS, ATTRS, DRIVERS. ID, BUS, SYSFS, DRIVER are no +longer mentioned in the man page and should be switched in the rule +files. + +ATTR{file}="value" can be used now, to write to a sysfs file of the +event device. Instead of: + ..., SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" +we now can do: + ..., ATTR{type}=="0|7|14", ATTR{timeout}="60" + +All the PHYSDEV* keys are deprecated and will be removed from a +future kernel: + PHYDEVPATH - is the path of a parent device and should not be + needed at all. + PHYSDEVBUS - is just a SUBSYSTEM value of a parent, and can be + matched with SUBSYSTEMS== + PHYSDEVDRIVER - for bus devices it is available as ENV{DRIVER}. + Newer kernels will have DRIVER in the environment, + for older kernels udev puts in. Class device will + no longer carry this property of a parent and + DRIVERS== can be used to match such a parent value. +Note that ENV{DRIVER} is only available for a few bus devices, where +the driver is already bound at device event time. On coldplug, the +events for a lot devices are already bound to a driver, and they will have +that value set. But on hotplug, at the time the kernel creates the device, +it can't know what driver may claim the device after that, therefore +in most cases it will be empty. + +Failed events should now be re-triggered with: + udevtrigger --retry-failed. +Please switch to this command, so we keep the details of the /dev/.udev/failed/ +files private to the udev tools. We may need to switch the current symlink +target, cause some obviously broken tools try to scan all files in /dev +including /dev/.udev/, find the links to /sys and end up stat()'ing sysfs files +million times. This takes ages on slow boxes. + +The udevinfo attribute walk (-a) now works with giving a device node +name (-n) instead of a devpath (-p). The query now always works, also when +no database file was created by udev. + +The built-in /etc/passwd /etc/group parser is removed, we always depend on +getpwnam() and getgrnam() now. One of the next releases will depend on +fnmatch() and may use getopt_long(). + +udev 097 +======== +Bugfixes and small improvements. + +udev 096 +======== +Fix path_id for recent kernels. + +udev 095 +======== +%e is finally gone. + +Added support for swapping network interface names, by temporarily +renaming the device and wait for the target name to become free. + +udev 094 +======== +The built-in MODALIAS key and substitution is removed. + +udev 093 +======== +The binary firmware helper is replaced by the usual simple +shell script. Udevsend is removed from the tree. + +udev 092 +======== +Bugfix release. + +udev 091 +======== +Some more keys require the correct use of '==' and '=' depending +on the kind of operation beeing an assignment or a match. Rules +with invalid operations are skipped and logged to syslog. Please +test with udevtest if the parsing of your rules throws errors and +fix possibly broken rules. + +udev 090 +======== +Provide "udevsettle" to wait for all current udev events to finish. +It also watches the current kernel netlink queue by comparing the +even sequence number to make sure that there are no current pending +events that have not already arrived in the daemon. + +udev 089 +======== +Fix rule to skip persistent rules for removable IDE devices, which +also skipped optical IDE drives. + +All *_id program are installed in /lib/udev/ by default now. + +No binary is stripped anymore as this should be done in the +packaging process and not at build time. + +libvolume_id is provided as a shared library now and vol_id is +linked against it. Also one of the next HAL versions will require +this library, and the HAL build process will also require the +header file to be installed. The copy of the same code in HAL will +be removed to have only a single copy left on the system. + +udev 088 +======== +Add persistent links for SCSI tapes. The rules file is renamed +to 60-persistent-storage.rules. + +Create persistent path for usb devices. Can be used for all sorts +of devices that can't be distinguished by other properties like +multiple identical keyboards and mice connected to the same box. + +Provide "udevtrigger" program to request events on coldplug. The +shell script is much too slow with thousends of devices. + +udev 087 +======== +Fix persistent disk rules to exclude removable IDE drives. + +Warn if %e, $modalias or MODALIAS is used. + +udev 086 +======== +Fix queue export, which wasn't correct for subsequent add/remove +events for the same device. + +udev 085 +======== +Fix cramfs detection on big endian. + +Make WAIT_FOR_SYSFS usable in "normal" rules and silent if the whole +device goes away. + +udev 084 +======== +If BUS== and SYSFS{}== have been used in the same rule, the sysfs +attributes were only checked at the parent device that matched the +by BUS requested subsystem. Fix it to also look at the device we +received the event for. + +Build variable CROSS has changed to CROSS_COMPILE to match the kernel +build name. + +udev 083 +======== +Fix a bug where NAME="" would prevent RUN from beeing executed. + +RUN="/bin/program" does not longer automatically add the subsystem +as the first parameter. This is from the days of /sbin/hotplug +which is dead now and it's just confusing to need to add a space at +the end of the program name to prevent this. +If you use rules that need the subsystem as the first parameter, +like the old "udev_run_hotlugd" and "udev_run_devd", add the subsystem +to the key like RUN+="/bin/program $env{SUBSYSTEM}". + +udev 082 +======== +The udev man page has moved to udev(7) as it does not describe a command +anymore. The programs udev, udevstart and udevsend are no longer installed +by default and must be copied manually, if they should be installed or +included in a package. + +Fix a bug where "ignore_device" could run earlier collected RUN keys before +the ignore rule was applied. + +More preparation for future sysfs changes. usb_id and scsi_id no longer +depend on a magic order of devices in the /devices chain. Specific devices +should be requested by their subsytem. + +This will always find the scsi parent device without depending on a specific +path position: + dev = sysfs_device_get(devpath); + dev_usb = sysfs_device_get_parent_with_subsystem(dev, "scsi"); + +The "device" link in the current sysfs layout will be automatically +_resolved_ as a parent and in the new sysfs layout it will just _be_ the +parent in the devpath. If a device is requested by it's symlink, like all +class devices in the new sysfs layout will look like, it gets automatically +resolved and substituted with the real devpath and not the symlink path. + +Note: +A similar logic must be applied to _all_ sysfs users, including +scripts, that search along parent devices in sysfs. The explicit use of +the "device" link must be avoided. With the future sysfs layout all +DEVPATH's will start with /devices/ and have a "subsystem" symlink poiting +back to the "class" or the "bus". The layout of the parent devices in +/devices is not necessarily expected to be stable across kernel releases and +searching for parents by their subsystem should make sysfs users tolerant +for changed parent chains. + +udev 081 +======== +Prepare udev to work with the experimental kernel patch, that moves +/sys/class devices to /sys/devices and /sys/block to /sys/class/block. + +Clarify BUS, ID, $id usage and fix $id behavior. This prepares for +moving the class devices to /sys/devices. + +Thanks again to Marco for help finding a hopefully nice compromise +to make %b simpler and working again. + +udev 080 +======== +Complete removal of libsysfs, replaced by simple helper functions +which are much simpler and a bit faster. The udev daemon operatesentirely +on event parameters and does not use sysfs for simple rules anymore. +Please report any new bugs/problems, that may be caused by this big +change. They will be fixed immediately. + +The enumeration format character '%e' is deprecated and will be +removed sometimes from a future udev version. It never worked correctly +outside of udevstart, so we can't use it with the new parallel +coldplug. A simple enumeration is as useless as the devfs naming +scheme, just get rid of both if you still use it. + +MODALIAS and $modalias is not needed and will be removed from one of +the next udev versions, replace it in all rules with ENV{MODALIAS} or +the sysfs "modalias" value. + +Thanks a lot to Marco for all his help on finding and fixing bugs. + +udev 079 +======== +Let scsi_id request libata drive serial numbers from page 0x80. + +Renamed etc/udev/persistent.rules to persistent-disk.rules and +added /dev/disk/by-name/* for device mapper device names. + +Removed %e from the man page. It never worked reliably outside +of udevstart and udevstart is no longer recommended to use. + +udev 078 +======== +Symlinks are now exported to the event environment. Hopefully it's no +longer needed to run udevinfo from an event process, like it was +mentioned on the hotplug list: + UDEV [1134776873.702967] add@/block/sdb + ... + DEVNAME=/dev/sdb + DEVLINKS=/dev/disk/by-id/usb-IBM_Memory_Key_0218B301030027E8 /dev/disk/by-path/usb-0218B301030027E8:0:0:0 + +udev 077 +======== +Fix a problem if udevsend is used as the hotplug handler and tries to use +syslog, which causes a "vc" event loop. 2.6.15 will make udevsend obsolete +and this kind of problems will hopefully go away soon. + +udev 076 +======== +All built-in logic to work around bad sysfs timing is removed with this +version. The need to wait for sysfs files is almost fixed with a kernel +version that doesn't work with this udev version anyway. Until we fix +the timing of the "bus" link creation, the former integrated logic should +be emulated by a rule placed before all other rules: + ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" + +The option "udev_db" does no longer exist. All udev state will be in +/$udev_root/.udev/ now, there is no longer an option to set this +to anything else. +If the init script or something else used this value, just depend on +this hardcoded path. But remember _all_content_ of this directory is +still private to udev and can change at any time. + +Default location for rule sripts and helper programs is now: /lib/udev/. +Everything that is not useful on the commandline should go into this +directory. Some of the helpers in the extras folder are installed there +now. The rules need to be changed, to find the helpers there. + +Also /lib/udev/devices is recommended as a directory where packages or +the user can place real device nodes, which get copied over to /dev at +every boot. This should replace the various solutions with custom config +files. + +Udevsend does no longer start the udev daemon. This must be done with +the init script that prepares /dev on tmpfs and creates the initial nodes, +before starting the daemon. + +udev 075 +======== +Silent a too verbose error logging for the old hotplug.d/ dev.d/ +emulation. + +The copy of klibc is removed. A systemwide installed version of klibc +should be used to build a klibc udev now. + +udev 074 +======== +NAME="" will not create any nodes, but execute RUN keys. To completely +ignore an event the OPTION "ignore_device" should be used. + +After removal of the reorder queue, events with a TIMEOUT can be executed +without any queuing now. + +udev 073 +======== +Fixed bug in udevd, if inotify is not available. We depend on netlink +uevents now, kernels without that event source will not work with that +version of udev anymore. + +udev 072 +======== +The rule parsing happens now in the daemon once at startup, all udev +event processes inherit the already parsed rules from the daemon. +It is shipped with SUSE10.0 and reduces heavily the system load at +startup. The option to save precompiled rules and let the udev process +pick the them up is removed, as it's no longer needed. + +Kernel 2.6.15 will have symlinks at /class/input pointing to the real +device. Libsysfs is changed to "translate" the requested link into the +real device path, as it would happen with the hotplug event. Otherwise +device removal and the udev database will not work. + +Using 'make STRIPCMD=' will leave the binaries unstripped for debugging +and packaging. + +A few improvements for vol_id, the filesytem probing code. + +udev 071 +======== +Fix a stupid typo in extras/run_directory for "make install". + +scsi_id creates the temporary devnode now in /dev for usage with a +non-writable /tmp directory. + +The uevent kernel socket buffer can carry app. 50.000 events now, +let's see who can break this again. :) + +The upcoming kernel will have a new input driver core integration. +Some class devices are now symlinks to the real device. libsysfs +needs a fix for this to work correctly. Udevstart of older udev +versions will _not_ create these devices! + +udev 070 +======== +Fix a 'install' target in the Makefile, that prevents EXTRAS from +beeing installed. + +udev 069 +======== +A bunch of mostly trivial bugfixes. From now on no node name or +symlink name can contain any character than plain whitelisted ascii +characters or validated utf8 byte-streams. This is needed for the +/dev/disk/by-label/* links, because we import untrusted data and +export it to the filesystem. + +udev 068 +======== +More bugfixes. If udevd was started from the kernel, we don't +have stdin/stdout/stderr, which broke the forked tools in some +situations. + +udev 067 +======== +Bugfix. udevstart event ordering was broken for a long time. +The new run_program() uncovered it, because /dev/null was not +available while we try to run external programs. +Now udevstart should create it before we run anything. + +udev 066 +======== +Minor bugfixes and some distro rules updates. If you don't have the +persistent disk rules in /dev/disk/by-*/* on your distro, just +grab it from here. :) + +udev 065 +======== +We can use socket communication now to pass events from udev to +other programs: + RUN+="socket:/org/freedesktop/hal/udev_event" +will pass the whole udev event to the HAL daemon without the need +for a forked helper. (See ChangeLog for udevmonitor, as an example) + +udev 064 +======== +Mostly bugfixes and see ChangeLog. + +The test for the existence of an environment value should be +switched from: + ENV{KEY}=="*" to ENV{KEY}=="?*" +because "*" will not fail anymore, if the key does not exist or +is empty. + +udev 063 +======== +Bugfixes and a few tweaks described in the ChangeLog. + +udev 062 +======== +Mostly a Bugfix release. + +Added WAIT_FOR_SYSFS="" to be able to fight against the sysfs +timing with custom rules. + +udev 061 +======== +We changed the internal rule storage format. Our large rule files took +2 MB of RAM, with the change we are down to 99kB. + +If the device-node has been created with default name and no symlink or +options are to remenber, it is not longer stored in the udevdb. HAL will +need to be updated to work correctly with that change. + +To overrride optimization flags, OPTFLAGS may be used now. + +udev 060 +======== +Bugfix release. + +udev 059 +======== +Major changes happened with this release. The goal is to take over the +complete kernel-event handling and provide a more efficient way to dispatch +kernel events. Replacing most of the current shell script logic and the +kernel forked helper with a netlink-daemon and a rule-based event handling. + +o udevd listens to netlink events now. The first valid netlink event + will make udevd ignore any message from udevsend that contains a + SEQNUM, to avoid duplicate events. The forked events can be disabled + with: + echo "" > /proc/sys/kernel/hotplug + For full support, the broken input-subsytem needs to be fixed, not to + bypass the driver core. + +o /etc/dev.d/ + /etc/hotplug.d/ directory multiplexing is completely + removed from udev itself and must be emulated by calling small + helper binaries provided in the extras folder: + make EXTRAS=extras/run_directory/ + will build udev_run_devd and udev_run_hotplugd, which can be called + from a rule if needed: + RUN+="/sbin/udev_run_hotplugd" + The recommended way to handle this is to convert all the calls from + the directories to explicit udev rules and get completely rid of the + multiplexing. (To catch a ttyUSB event, you now no longer need to + fork and exit 300 tty script instances you are not interested in, it + is just one rule that matches exactly the device.) + +o udev handles now _all_ events not just events for class and block + devices, this way it is possible to control the complete event + behavior with udev rules. Especially useful for rules like: + ACTION="add", DEVPATH="/devices/*", MODALIAS=="?*", RUN+="/sbin/modprobe $modalias" + +o As used in the modalias rule, udev supports now textual + substitution placeholder along with the usual format chars. This + needs to be documented, for now it's only visible in udev_rules_parse.c. + +o The rule keys support now more operations. This is documented in the + man page. It is possible to add values to list-keys like the SYMLINK + and RUN list with KEY+="value" and to clear the list by assigning KEY="". + Also "final"-assignments are supported by using KEY:="value", which will + prevent changing the key by any later rule. + +o kernel 2.6.12 has the "detached_state" attribute removed from + sysfs, which was used to recognize sysfs population. We switched that + to wait for the "bus" link, which is only available in kernels after 2.6.11. + Running this udev version on older kernels may cause a short delay for + some events. + +o To provide infrastructure for persistent device naming, the id programs: + scsi_id, vol_id (former udev_volume_id), and ata_id (new) are able now + to export the probed data in environment key format: + pim:~ # /sbin/ata_id --export /dev/hda + ID_MODEL=HTS726060M9AT00 + ID_SERIAL=MRH401M4G6UM9B + ID_REVISION=MH4OA6BA + + The following rules: + KERNEL="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" + KERNEL="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_MODEL}_$env{ID_SERIAL}" + + Will create: + kay@pim:~> tree /dev/disk + /dev/disk + |-- by-id + | |-- HTS726060M9AT00_MRH401M4G6UM9B -> ../../hda + | `-- IBM-Memory_Key -> ../../sda + |-- by-label + | |-- swap -> ../../hda1 + | |-- date -> ../../sda1 + | `-- home -> ../../hda3 + `-- by-uuid + |-- 2E08712B0870F2E7 -> ../../hda3 + |-- 9352cfef-7687-47bc-a2a3-34cf136f72e1 -> ../../hda1 + |-- E845-7A89 -> ../../sda1 + `-- b2a61681-3812-4f13-a4ff-920d70604299 -> ../../hda2 + + The IMPORT= operation will import these keys in the environment and make + it available for later PROGRAM= and RUN= executed programs. The keys are + also stored in the udevdb and can be queried from there with one of the + next udev versions. + +o A few binaries are silently added to the repository, which can be used + to replay kernel events from initramfs instead of using coldplug. udevd + can be instructed now to queue-up events while the stored events from + initramfs are filled into the udevd-queue. This code is still under + development and there is no documentation now besides the code itself. + The additional binaries get compiled, but are not installed by default. + +o There is also a temporary fix for a performance problem where too many + events happen in parallel and every event needs to parse the rules. + udev can now read precompiled rules stored on disk. This is likely to be + replaced by a more elegant solution in a future udev version. + +udev 058 +======== +With kernel version 2.6.12, the sysfs file "detached_state" was removed. +Fix for libsysfs not to expect this file was added. + +udev 057 +======== +All rules are applied now, but only the first matching rule with a NAME-key +will be applied. All later rules with NAME-key are completely ignored. This +way system supplied symlinks or permissions gets applied to user-defined +naming rules. + +Note: +Please check your rules setup, if you may need to add OPTIONS="last_rule" +to some rules, to keep the old behavior. + +The rules are read on "remove"-events too. That makes is possible to match +with keys that are available on remove (KERNEL, SUBSYSTEM, ID, ENV, ...) to +instruct udev to ignore an event (OPTIONS="ignore_device"). +The new ACTION-key may be used to let a rule act only at a "remove"-event. + +The new RUN-key supports rule-based execution of programs after device-node +handling. This is meant as a general replacement for the dev.d/-directories +to give fine grained control over the execution of programs. + +The %s{}-sysfs format char replacement values are searched at any of the +devices in the device chain now, not only at the class-device. + +We support log priority levels now. The value udev_log in udev.conf is used +to determine what is printed to syslog. This makes it possible to +run a version with compiled-in debug messages in a production environment +which is sometimes needed to find a bug. +It is still possible to supress the inclusion of _any_ syslog usage with +USE_LOG=false to create the smallest possible binaries if needed. +The configured udev_log value can be overridden with the environment variable +UDEV_LOG. + +udev 056 +======== +Possible use of a system-wide klibc: + make USE_KLIBC=true KLCC=/usr/bin/klcc all +will link against an external klibc and our own version will be ignored. + +udev 055 +======== +We support an unlimited count of symlinks now. + +If USE_STATIC=true is passed to a glibc build, we link statically and use +a built-in userdb parser to resolve user and group names. + +The PLACE= key is gone. It can be replaced by an ID= for a long time, because +we walk up the chain of physical devices to find a match. + +The KEY="" format supports '=', '==', '!=,' , '+=' now. This makes it +easy to skip certain attribute matches without composing rules with weird +character class negations like: + KERNEL="[!s][!c][!d]*" +this can now be replaced with: + KERNEL!="scd*" +The current simple '=' is still supported, and should work as it does today, +but existing rules should be converted if possible, to be better readable. + +We have new ENV{}== key now, to match against a maximum of 5 environment +variables. + +udevstart is its own binary again, because we don't need co carry this araound +with every forked event. diff --git a/RELEASE-NOTES b/RELEASE-NOTES deleted file mode 100644 index fea7db0d2b..0000000000 --- a/RELEASE-NOTES +++ /dev/null @@ -1,861 +0,0 @@ -udev 125 -======== -Bugfixes. - -Default udev rules, which are not supposed to be edited by the user, should -be placed in /lib/udev/rules.d/ now, to make it clear that they are private to -the udev package and will be replaced with an update. Udev will pick up rule -files from: - /lib/udev/rules.d/ - default installed rules - /etc/udev/rules.d/ - user rules + on-the-fly generated rules - /dev/.udev/rules.d/ - temporary non-persistent rules created after bootup -It does not matter in which directory a rule file lives, all files are sorted -in lexical order. - -To help creating /dev/root, we have now: - $ udevadm info --export --export-prefix="ROOT_" --device-id-of-file=/ - ROOT_MAJOR=8 - ROOT_MINOR=5 -In case the current --device-id-of-file is already used, please switch to -the --export format version, it saves the output parsing and the old -format will be changed to use ':' as a separator, like the format in the -sysfs 'dev' file. - -udev 124 -======== -Fix cdrom_id to properly recognize blank media. - -udev 123 -======== -Bugfixes. - -Tape drive id-data is queried from /dev/bsg/* instead of the tape -nodes. This avoids rewinding tapes on open(). - -udev 122 -======== -Bugfixes. - -The symlinks udevcontrol and udevtrigger are no longer installed by -the Makefile. - -The scsi_id program does not depend on sysfs anymore. It can speak -SGv4 now, so /dev/bsg/* device nodes can be used, to query SCSI device -data, which should solve some old problems with tape devices, where -we better do not open all tape device nodes to identify the device. - -udev 121 -======== -Many bugfixes. - -The cdrom_id program is replaced by an advanced version, which can -detect most common device types, and also properties of the inserted -media. This is part of moving some basic functionality from HAL into -udev (and the kernel). - -udev 120 -======== -Bugfixes. - -The last WAIT_FOR_SYSFS rule is removed from the default rules. - -The symlinks to udevadm for the debugging tools: udevmonitor and -udevtest are no longer created. - -The symlinks to the udevadm man page for the old tool names are -no longer created. - -Abstract namespace sockets paths in RUN+="socket:@" rules, -should be prefixed with '@' to indicate that the path is not a -real file. - -udev 119 -======== -Bugfixes. - -udev 118 -======== -Bugfixes. - -Udevstart is removed from the tree, it did not get installed for -a long time now, and is long replaced by trigger and settle. - -udev 117 -======== -Bugfixes. - -All udev tools are merged into a single binary called udevadm. -The old names of the tools are built-in commands in udevadm now. -Symlinks to udevadm, with the names of the old tools, provide -the same functionality as the standalone tools. There is also -only a single udevadm.8 man page left for all tools. - -Tools like mkinitramfs should be checked, if they need to include -udevadm in the list of files. - -udev 116 -======== -Bugfixes. - -udev 115 -======== -Bugfixes. - -The etc/udev/rules.d/ directory now contains a default set of basic -udev rules. This initial version is the result of a rules file merge -of Fedora and openSUSE. For these both distros only a few specific -rules are left in their own file, named after the distro. Rules which -are optionally installed, because they are only valid for a specific -architecture, or rules for subsystems which are not always used are -in etc/udev/packages/. - -udev 114 -======== -Bugfixes. - -Dynamic rules can be created in /dev/.udev/rules.d/ to trigger -actions by dynamically created rules. - -SYMLINK=="" matches agains the entries in the list of -currently defined symlinks. The links are not created in the -filesystem at that point in time, but the values can be matched. - -RUN{ignore_error}+="" will ignore any exit code from the -program and not record as a failed event. - -udev 113 -======== -Bugfixes. - -Final merge of patches/features from the Ubuntu package. - -udev 112 -======== -Bugfixes. - -Control characters in filesystem label strings are no longer silenty -removed, but hex-encoded, to be able to uniquely identify the device -by its symlink in /dev/disk/by-label/. -If libvolume_id is used by mount(8), LABEL= will work as expected, -if slashes or other characters are used in the label string. - -To test the existence of a file, TEST=="" and TEST!="" -can be specified now. The TEST key accepts an optional mode mask -TEST{0100}=="". - -Scsi_id now supports a mode without expecting scsi-specific sysfs -entries to allow the extraction of cciss-device persistent properties. - -udev 111 -======== -Bugfixes. - -In the future, we may see uuid's which are just simple character -strings (see the DDF Raid Specification). For that reason vol_id now -exports ID_FS_UUID_SAFE, just like ID_FS_LABEL_SAFE. For things like -the creation of symlinks, the *_SAFE values ensure, that no control -or whitespace characters are used in the filename. - -Possible users of libvolume_id, please use the volume_id_get_* functions. -The public struct will go away in a future release of the library. - -udev 110 -======== -Bugfixes. - -Removal of useless extras/eventrecorder.sh. - -udev 109 -======== -Bugfixes. - -udev 108 -======== -Bugfixes. - -The directory multiplexer for dev.d/ and hotplug.d are finally removed -from the udev package. - -udev 107 -======== -Bugfixes. - -Symlinks can have priorities now, the priority is assigned to the device -and specified with OPTIONS="link_priority=100". Devices with higher -priorities overwrite the symlinks of devices with lower priorities. -If the device that currently owns the link, goes away, the symlink -will be removed, and recreated, pointing to the next device with the -highest actual priority. This should make /dev/disk/by-{label,uuid,id} -more reliable, if multiple devices contain the same metadata and overwrite -these symlinks. - -The dasd_id program is removed from the udev tree, and dasdinfo, with the -needed rules, are part of the s390-tools now. - -Please add KERNEL=="[0-9]*:[0-9]*" to the scsi wait-for-sysfs rule, -we may get the scsi sysfs mess fixed some day, and this will only catch -the devices we are looking for. - -USB serial numbers for storage devices have the target:lun now appended, -to make it possibble to distinguish broken multi-lun devices with all -the same SCSI identifiers. - -Note: The extra "run_directory" which searches and executes stuff in -/etc/hotplug.d/ and /etc/dev.d/ is long deprecated, and will be removed -with the next release. Make sure, that you don't use it anymore, or -provides your own implementation of that inefficient stuff. -We are tired of reports about a "slow udev", because these directories -contain stuff, that runs with _every_ event, instead of using rules, -that run programs only for the matching events. - -udev 106 -======== -Bugfixes. - -udev 105 -======== -Bugfixes. - -DRIVER== will match only for devices that actually have a real -driver. DRIVERS== must be used, if parent devices should be -included in the match. - -Libvolume_id's "linux_raid" detection needed another fix. - -udev 104 -======== -Bugfixes. - -udev 103 -======== -Add additional check to volume_id detection of via_raid, cause -some company decided to put a matching pattern all over the empty -storage area of their music players. - -udev 102 -======== -Fix path_id for SAS devices. - -udev 101 -======== -The udev daemon can be started with --debug-trace now, which will -execute all events serialized to get a chance to catch a possible -action that crashes the box. - -A warning is logged, if PHYSDEV* keys, the "device" link, or a parent -device attribute like $attr{../file} is used, only WAIT_FOR_SYSFS rules -are excluded from the warning. Referencing parent attributes directly -may break when something in the kernel driver model changes. Udev will -just find the attribute by walking up the parent chain. - -Udevtrigger now sorts the list of devices depending on the device -dependency, so a "usb" device is triggered after the parent "pci" -device. - -udev 100 -======== -Revert persistent-storage ata-serial '_' '-' replacement. - -udev 099 -======== -Bugfixes. - -Udevtrigger can now filter the list of devices to be triggered. Matches -for subsystems or sysfs attributes can be specified. - -The entries in /dev/.udev/queue and /dev/.udev/failed have changed to -zero-sized files to avoid pointing to /sys and confuse broken tools which -scan the /dev directory. To retry failed events, udevtrigger --retry-failed -should be used now. - -The rules and scripts to create udev rules for persistent network -devices and optical drives are in the extras/rules_generator directory -now. If you use something similar, please consider replacing your own -version with this, to share the support effort. The rule_generator -installs its own rules into /etc/udev/rules.d. - -The cdrom_id tool installs its own rule now in /etc/udev/rules.d, cause -the rule_generator depends on cdrom_id to be called in an earlier rule. - -udev 098 -======== -Bugfixes. - -Renaming of some key names (the old names still work): -BUS -> SUBSYSTEMS, ID -> KERNELS, SYSFS -> ATTRS, DRIVER -> DRIVERS. -(The behavior of the key DRIVER will change soon in one of the next -releases, to match only the event device, please switch to DRIVERS -instead. If DRIVER is used, it will behave like DRIVERS, but an error -is logged. -With the new key names, we have a more consistent and simpler scheme. -We can match the properties of the event device only, with: KERNEL, -SUBSYSTEM, ATTR, DRIVER. Or include all the parent devices in the match, -with: KERNELS, SUBSYSTEMS, ATTRS, DRIVERS. ID, BUS, SYSFS, DRIVER are no -longer mentioned in the man page and should be switched in the rule -files. - -ATTR{file}="value" can be used now, to write to a sysfs file of the -event device. Instead of: - ..., SYSFS{type}=="0|7|14", RUN+="/bin/sh -c 'echo 60 > /sys$$DEVPATH/timeout'" -we now can do: - ..., ATTR{type}=="0|7|14", ATTR{timeout}="60" - -All the PHYSDEV* keys are deprecated and will be removed from a -future kernel: - PHYDEVPATH - is the path of a parent device and should not be - needed at all. - PHYSDEVBUS - is just a SUBSYSTEM value of a parent, and can be - matched with SUBSYSTEMS== - PHYSDEVDRIVER - for bus devices it is available as ENV{DRIVER}. - Newer kernels will have DRIVER in the environment, - for older kernels udev puts in. Class device will - no longer carry this property of a parent and - DRIVERS== can be used to match such a parent value. -Note that ENV{DRIVER} is only available for a few bus devices, where -the driver is already bound at device event time. On coldplug, the -events for a lot devices are already bound to a driver, and they will have -that value set. But on hotplug, at the time the kernel creates the device, -it can't know what driver may claim the device after that, therefore -in most cases it will be empty. - -Failed events should now be re-triggered with: - udevtrigger --retry-failed. -Please switch to this command, so we keep the details of the /dev/.udev/failed/ -files private to the udev tools. We may need to switch the current symlink -target, cause some obviously broken tools try to scan all files in /dev -including /dev/.udev/, find the links to /sys and end up stat()'ing sysfs files -million times. This takes ages on slow boxes. - -The udevinfo attribute walk (-a) now works with giving a device node -name (-n) instead of a devpath (-p). The query now always works, also when -no database file was created by udev. - -The built-in /etc/passwd /etc/group parser is removed, we always depend on -getpwnam() and getgrnam() now. One of the next releases will depend on -fnmatch() and may use getopt_long(). - -udev 097 -======== -Bugfixes and small improvements. - -udev 096 -======== -Fix path_id for recent kernels. - -udev 095 -======== -%e is finally gone. - -Added support for swapping network interface names, by temporarily -renaming the device and wait for the target name to become free. - -udev 094 -======== -The built-in MODALIAS key and substitution is removed. - -udev 093 -======== -The binary firmware helper is replaced by the usual simple -shell script. Udevsend is removed from the tree. - -udev 092 -======== -Bugfix release. - -udev 091 -======== -Some more keys require the correct use of '==' and '=' depending -on the kind of operation beeing an assignment or a match. Rules -with invalid operations are skipped and logged to syslog. Please -test with udevtest if the parsing of your rules throws errors and -fix possibly broken rules. - -udev 090 -======== -Provide "udevsettle" to wait for all current udev events to finish. -It also watches the current kernel netlink queue by comparing the -even sequence number to make sure that there are no current pending -events that have not already arrived in the daemon. - -udev 089 -======== -Fix rule to skip persistent rules for removable IDE devices, which -also skipped optical IDE drives. - -All *_id program are installed in /lib/udev/ by default now. - -No binary is stripped anymore as this should be done in the -packaging process and not at build time. - -libvolume_id is provided as a shared library now and vol_id is -linked against it. Also one of the next HAL versions will require -this library, and the HAL build process will also require the -header file to be installed. The copy of the same code in HAL will -be removed to have only a single copy left on the system. - -udev 088 -======== -Add persistent links for SCSI tapes. The rules file is renamed -to 60-persistent-storage.rules. - -Create persistent path for usb devices. Can be used for all sorts -of devices that can't be distinguished by other properties like -multiple identical keyboards and mice connected to the same box. - -Provide "udevtrigger" program to request events on coldplug. The -shell script is much too slow with thousends of devices. - -udev 087 -======== -Fix persistent disk rules to exclude removable IDE drives. - -Warn if %e, $modalias or MODALIAS is used. - -udev 086 -======== -Fix queue export, which wasn't correct for subsequent add/remove -events for the same device. - -udev 085 -======== -Fix cramfs detection on big endian. - -Make WAIT_FOR_SYSFS usable in "normal" rules and silent if the whole -device goes away. - -udev 084 -======== -If BUS== and SYSFS{}== have been used in the same rule, the sysfs -attributes were only checked at the parent device that matched the -by BUS requested subsystem. Fix it to also look at the device we -received the event for. - -Build variable CROSS has changed to CROSS_COMPILE to match the kernel -build name. - -udev 083 -======== -Fix a bug where NAME="" would prevent RUN from beeing executed. - -RUN="/bin/program" does not longer automatically add the subsystem -as the first parameter. This is from the days of /sbin/hotplug -which is dead now and it's just confusing to need to add a space at -the end of the program name to prevent this. -If you use rules that need the subsystem as the first parameter, -like the old "udev_run_hotlugd" and "udev_run_devd", add the subsystem -to the key like RUN+="/bin/program $env{SUBSYSTEM}". - -udev 082 -======== -The udev man page has moved to udev(7) as it does not describe a command -anymore. The programs udev, udevstart and udevsend are no longer installed -by default and must be copied manually, if they should be installed or -included in a package. - -Fix a bug where "ignore_device" could run earlier collected RUN keys before -the ignore rule was applied. - -More preparation for future sysfs changes. usb_id and scsi_id no longer -depend on a magic order of devices in the /devices chain. Specific devices -should be requested by their subsytem. - -This will always find the scsi parent device without depending on a specific -path position: - dev = sysfs_device_get(devpath); - dev_usb = sysfs_device_get_parent_with_subsystem(dev, "scsi"); - -The "device" link in the current sysfs layout will be automatically -_resolved_ as a parent and in the new sysfs layout it will just _be_ the -parent in the devpath. If a device is requested by it's symlink, like all -class devices in the new sysfs layout will look like, it gets automatically -resolved and substituted with the real devpath and not the symlink path. - -Note: -A similar logic must be applied to _all_ sysfs users, including -scripts, that search along parent devices in sysfs. The explicit use of -the "device" link must be avoided. With the future sysfs layout all -DEVPATH's will start with /devices/ and have a "subsystem" symlink poiting -back to the "class" or the "bus". The layout of the parent devices in -/devices is not necessarily expected to be stable across kernel releases and -searching for parents by their subsystem should make sysfs users tolerant -for changed parent chains. - -udev 081 -======== -Prepare udev to work with the experimental kernel patch, that moves -/sys/class devices to /sys/devices and /sys/block to /sys/class/block. - -Clarify BUS, ID, $id usage and fix $id behavior. This prepares for -moving the class devices to /sys/devices. - -Thanks again to Marco for help finding a hopefully nice compromise -to make %b simpler and working again. - -udev 080 -======== -Complete removal of libsysfs, replaced by simple helper functions -which are much simpler and a bit faster. The udev daemon operatesentirely -on event parameters and does not use sysfs for simple rules anymore. -Please report any new bugs/problems, that may be caused by this big -change. They will be fixed immediately. - -The enumeration format character '%e' is deprecated and will be -removed sometimes from a future udev version. It never worked correctly -outside of udevstart, so we can't use it with the new parallel -coldplug. A simple enumeration is as useless as the devfs naming -scheme, just get rid of both if you still use it. - -MODALIAS and $modalias is not needed and will be removed from one of -the next udev versions, replace it in all rules with ENV{MODALIAS} or -the sysfs "modalias" value. - -Thanks a lot to Marco for all his help on finding and fixing bugs. - -udev 079 -======== -Let scsi_id request libata drive serial numbers from page 0x80. - -Renamed etc/udev/persistent.rules to persistent-disk.rules and -added /dev/disk/by-name/* for device mapper device names. - -Removed %e from the man page. It never worked reliably outside -of udevstart and udevstart is no longer recommended to use. - -udev 078 -======== -Symlinks are now exported to the event environment. Hopefully it's no -longer needed to run udevinfo from an event process, like it was -mentioned on the hotplug list: - UDEV [1134776873.702967] add@/block/sdb - ... - DEVNAME=/dev/sdb - DEVLINKS=/dev/disk/by-id/usb-IBM_Memory_Key_0218B301030027E8 /dev/disk/by-path/usb-0218B301030027E8:0:0:0 - -udev 077 -======== -Fix a problem if udevsend is used as the hotplug handler and tries to use -syslog, which causes a "vc" event loop. 2.6.15 will make udevsend obsolete -and this kind of problems will hopefully go away soon. - -udev 076 -======== -All built-in logic to work around bad sysfs timing is removed with this -version. The need to wait for sysfs files is almost fixed with a kernel -version that doesn't work with this udev version anyway. Until we fix -the timing of the "bus" link creation, the former integrated logic should -be emulated by a rule placed before all other rules: - ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" - -The option "udev_db" does no longer exist. All udev state will be in -/$udev_root/.udev/ now, there is no longer an option to set this -to anything else. -If the init script or something else used this value, just depend on -this hardcoded path. But remember _all_content_ of this directory is -still private to udev and can change at any time. - -Default location for rule sripts and helper programs is now: /lib/udev/. -Everything that is not useful on the commandline should go into this -directory. Some of the helpers in the extras folder are installed there -now. The rules need to be changed, to find the helpers there. - -Also /lib/udev/devices is recommended as a directory where packages or -the user can place real device nodes, which get copied over to /dev at -every boot. This should replace the various solutions with custom config -files. - -Udevsend does no longer start the udev daemon. This must be done with -the init script that prepares /dev on tmpfs and creates the initial nodes, -before starting the daemon. - -udev 075 -======== -Silent a too verbose error logging for the old hotplug.d/ dev.d/ -emulation. - -The copy of klibc is removed. A systemwide installed version of klibc -should be used to build a klibc udev now. - -udev 074 -======== -NAME="" will not create any nodes, but execute RUN keys. To completely -ignore an event the OPTION "ignore_device" should be used. - -After removal of the reorder queue, events with a TIMEOUT can be executed -without any queuing now. - -udev 073 -======== -Fixed bug in udevd, if inotify is not available. We depend on netlink -uevents now, kernels without that event source will not work with that -version of udev anymore. - -udev 072 -======== -The rule parsing happens now in the daemon once at startup, all udev -event processes inherit the already parsed rules from the daemon. -It is shipped with SUSE10.0 and reduces heavily the system load at -startup. The option to save precompiled rules and let the udev process -pick the them up is removed, as it's no longer needed. - -Kernel 2.6.15 will have symlinks at /class/input pointing to the real -device. Libsysfs is changed to "translate" the requested link into the -real device path, as it would happen with the hotplug event. Otherwise -device removal and the udev database will not work. - -Using 'make STRIPCMD=' will leave the binaries unstripped for debugging -and packaging. - -A few improvements for vol_id, the filesytem probing code. - -udev 071 -======== -Fix a stupid typo in extras/run_directory for "make install". - -scsi_id creates the temporary devnode now in /dev for usage with a -non-writable /tmp directory. - -The uevent kernel socket buffer can carry app. 50.000 events now, -let's see who can break this again. :) - -The upcoming kernel will have a new input driver core integration. -Some class devices are now symlinks to the real device. libsysfs -needs a fix for this to work correctly. Udevstart of older udev -versions will _not_ create these devices! - -udev 070 -======== -Fix a 'install' target in the Makefile, that prevents EXTRAS from -beeing installed. - -udev 069 -======== -A bunch of mostly trivial bugfixes. From now on no node name or -symlink name can contain any character than plain whitelisted ascii -characters or validated utf8 byte-streams. This is needed for the -/dev/disk/by-label/* links, because we import untrusted data and -export it to the filesystem. - -udev 068 -======== -More bugfixes. If udevd was started from the kernel, we don't -have stdin/stdout/stderr, which broke the forked tools in some -situations. - -udev 067 -======== -Bugfix. udevstart event ordering was broken for a long time. -The new run_program() uncovered it, because /dev/null was not -available while we try to run external programs. -Now udevstart should create it before we run anything. - -udev 066 -======== -Minor bugfixes and some distro rules updates. If you don't have the -persistent disk rules in /dev/disk/by-*/* on your distro, just -grab it from here. :) - -udev 065 -======== -We can use socket communication now to pass events from udev to -other programs: - RUN+="socket:/org/freedesktop/hal/udev_event" -will pass the whole udev event to the HAL daemon without the need -for a forked helper. (See ChangeLog for udevmonitor, as an example) - -udev 064 -======== -Mostly bugfixes and see ChangeLog. - -The test for the existence of an environment value should be -switched from: - ENV{KEY}=="*" to ENV{KEY}=="?*" -because "*" will not fail anymore, if the key does not exist or -is empty. - -udev 063 -======== -Bugfixes and a few tweaks described in the ChangeLog. - -udev 062 -======== -Mostly a Bugfix release. - -Added WAIT_FOR_SYSFS="" to be able to fight against the sysfs -timing with custom rules. - -udev 061 -======== -We changed the internal rule storage format. Our large rule files took -2 MB of RAM, with the change we are down to 99kB. - -If the device-node has been created with default name and no symlink or -options are to remenber, it is not longer stored in the udevdb. HAL will -need to be updated to work correctly with that change. - -To overrride optimization flags, OPTFLAGS may be used now. - -udev 060 -======== -Bugfix release. - -udev 059 -======== -Major changes happened with this release. The goal is to take over the -complete kernel-event handling and provide a more efficient way to dispatch -kernel events. Replacing most of the current shell script logic and the -kernel forked helper with a netlink-daemon and a rule-based event handling. - -o udevd listens to netlink events now. The first valid netlink event - will make udevd ignore any message from udevsend that contains a - SEQNUM, to avoid duplicate events. The forked events can be disabled - with: - echo "" > /proc/sys/kernel/hotplug - For full support, the broken input-subsytem needs to be fixed, not to - bypass the driver core. - -o /etc/dev.d/ + /etc/hotplug.d/ directory multiplexing is completely - removed from udev itself and must be emulated by calling small - helper binaries provided in the extras folder: - make EXTRAS=extras/run_directory/ - will build udev_run_devd and udev_run_hotplugd, which can be called - from a rule if needed: - RUN+="/sbin/udev_run_hotplugd" - The recommended way to handle this is to convert all the calls from - the directories to explicit udev rules and get completely rid of the - multiplexing. (To catch a ttyUSB event, you now no longer need to - fork and exit 300 tty script instances you are not interested in, it - is just one rule that matches exactly the device.) - -o udev handles now _all_ events not just events for class and block - devices, this way it is possible to control the complete event - behavior with udev rules. Especially useful for rules like: - ACTION="add", DEVPATH="/devices/*", MODALIAS=="?*", RUN+="/sbin/modprobe $modalias" - -o As used in the modalias rule, udev supports now textual - substitution placeholder along with the usual format chars. This - needs to be documented, for now it's only visible in udev_rules_parse.c. - -o The rule keys support now more operations. This is documented in the - man page. It is possible to add values to list-keys like the SYMLINK - and RUN list with KEY+="value" and to clear the list by assigning KEY="". - Also "final"-assignments are supported by using KEY:="value", which will - prevent changing the key by any later rule. - -o kernel 2.6.12 has the "detached_state" attribute removed from - sysfs, which was used to recognize sysfs population. We switched that - to wait for the "bus" link, which is only available in kernels after 2.6.11. - Running this udev version on older kernels may cause a short delay for - some events. - -o To provide infrastructure for persistent device naming, the id programs: - scsi_id, vol_id (former udev_volume_id), and ata_id (new) are able now - to export the probed data in environment key format: - pim:~ # /sbin/ata_id --export /dev/hda - ID_MODEL=HTS726060M9AT00 - ID_SERIAL=MRH401M4G6UM9B - ID_REVISION=MH4OA6BA - - The following rules: - KERNEL="hd*[!0-9]", IMPORT="/sbin/ata_id --export $tempnode" - KERNEL="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_MODEL}_$env{ID_SERIAL}" - - Will create: - kay@pim:~> tree /dev/disk - /dev/disk - |-- by-id - | |-- HTS726060M9AT00_MRH401M4G6UM9B -> ../../hda - | `-- IBM-Memory_Key -> ../../sda - |-- by-label - | |-- swap -> ../../hda1 - | |-- date -> ../../sda1 - | `-- home -> ../../hda3 - `-- by-uuid - |-- 2E08712B0870F2E7 -> ../../hda3 - |-- 9352cfef-7687-47bc-a2a3-34cf136f72e1 -> ../../hda1 - |-- E845-7A89 -> ../../sda1 - `-- b2a61681-3812-4f13-a4ff-920d70604299 -> ../../hda2 - - The IMPORT= operation will import these keys in the environment and make - it available for later PROGRAM= and RUN= executed programs. The keys are - also stored in the udevdb and can be queried from there with one of the - next udev versions. - -o A few binaries are silently added to the repository, which can be used - to replay kernel events from initramfs instead of using coldplug. udevd - can be instructed now to queue-up events while the stored events from - initramfs are filled into the udevd-queue. This code is still under - development and there is no documentation now besides the code itself. - The additional binaries get compiled, but are not installed by default. - -o There is also a temporary fix for a performance problem where too many - events happen in parallel and every event needs to parse the rules. - udev can now read precompiled rules stored on disk. This is likely to be - replaced by a more elegant solution in a future udev version. - -udev 058 -======== -With kernel version 2.6.12, the sysfs file "detached_state" was removed. -Fix for libsysfs not to expect this file was added. - -udev 057 -======== -All rules are applied now, but only the first matching rule with a NAME-key -will be applied. All later rules with NAME-key are completely ignored. This -way system supplied symlinks or permissions gets applied to user-defined -naming rules. - -Note: -Please check your rules setup, if you may need to add OPTIONS="last_rule" -to some rules, to keep the old behavior. - -The rules are read on "remove"-events too. That makes is possible to match -with keys that are available on remove (KERNEL, SUBSYSTEM, ID, ENV, ...) to -instruct udev to ignore an event (OPTIONS="ignore_device"). -The new ACTION-key may be used to let a rule act only at a "remove"-event. - -The new RUN-key supports rule-based execution of programs after device-node -handling. This is meant as a general replacement for the dev.d/-directories -to give fine grained control over the execution of programs. - -The %s{}-sysfs format char replacement values are searched at any of the -devices in the device chain now, not only at the class-device. - -We support log priority levels now. The value udev_log in udev.conf is used -to determine what is printed to syslog. This makes it possible to -run a version with compiled-in debug messages in a production environment -which is sometimes needed to find a bug. -It is still possible to supress the inclusion of _any_ syslog usage with -USE_LOG=false to create the smallest possible binaries if needed. -The configured udev_log value can be overridden with the environment variable -UDEV_LOG. - -udev 056 -======== -Possible use of a system-wide klibc: - make USE_KLIBC=true KLCC=/usr/bin/klcc all -will link against an external klibc and our own version will be ignored. - -udev 055 -======== -We support an unlimited count of symlinks now. - -If USE_STATIC=true is passed to a glibc build, we link statically and use -a built-in userdb parser to resolve user and group names. - -The PLACE= key is gone. It can be replaced by an ID= for a long time, because -we walk up the chain of physical devices to find a match. - -The KEY="" format supports '=', '==', '!=,' , '+=' now. This makes it -easy to skip certain attribute matches without composing rules with weird -character class negations like: - KERNEL="[!s][!c][!d]*" -this can now be replaced with: - KERNEL!="scd*" -The current simple '=' is still supported, and should work as it does today, -but existing rules should be converted if possible, to be better readable. - -We have new ENV{}== key now, to match against a maximum of 5 environment -variables. - -udevstart is its own binary again, because we don't need co carry this araound -with every forked event. diff --git a/extras/ata_id/Makefile b/extras/ata_id/Makefile deleted file mode 100644 index bab49a250d..0000000000 --- a/extras/ata_id/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2005 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = ata_id -OBJ = -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: uninstall-bin - -install-man: - $(INSTALL) -d $(DESTDIR)$(mandir)/man8 - $(INSTALL_DATA) -D $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: install-man - -uninstall-man: - -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config - diff --git a/extras/cdrom_id/Makefile b/extras/cdrom_id/Makefile deleted file mode 100644 index ec03d1fce2..0000000000 --- a/extras/cdrom_id/Makefile +++ /dev/null @@ -1,74 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2005 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = cdrom_id -OBJ = -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - $(INSTALL) -d $(DESTDIR)$(libudevdir)/rules.d - $(INSTALL_DATA) 60-cdrom_id.rules $(DESTDIR)$(libudevdir)/rules.d/60-cdrom_id.rules -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) - - rm $(DESTDIR)$(libudevdir)/rules.d/60-cdrom_id.rules -.PHONY: uninstall-bin - -install-man: - $(INSTALL) -d $(DESTDIR)$(mandir)/man8 - $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: install-man - -uninstall-man: - -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config diff --git a/extras/collect/Makefile b/extras/collect/Makefile deleted file mode 100644 index 76487017dd..0000000000 --- a/extras/collect/Makefile +++ /dev/null @@ -1,65 +0,0 @@ -# Makefile for udev extra invoked by the udev main Makefile - -PROG = collect -OBJ = -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: uninstall-bin - -install-man: - @echo "Please create a man page for this tool." -.PHONY: install-man - -uninstall-man: - @echo "Please create a man page for this tool." -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config diff --git a/extras/edd_id/Makefile b/extras/edd_id/Makefile deleted file mode 100644 index 0126b859ee..0000000000 --- a/extras/edd_id/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2005 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = edd_id -OBJ = -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - $(INSTALL) -d $(DESTDIR)$(libudevdir)/rules.d/ - $(INSTALL_DATA) 61-persistent-storage-edd.rules $(DESTDIR)$(libudevdir)/rules.d/61-persistent-storage-edd.rules -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) - - rm $(DESTDIR)$(libudevdir)/rules.d/61-persistent-storage-edd.rules -.PHONY: uninstall-bin - -install-man: - $(INSTALL) -d $(DESTDIR)$(mandir)/man8 - $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: install-man - -uninstall-man: - -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config - diff --git a/extras/firmware/Makefile b/extras/firmware/Makefile deleted file mode 100644 index 5e84acb156..0000000000 --- a/extras/firmware/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2006 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = firmware.sh -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_SCRIPT) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: uninstall-bin - -install-man: - @echo "Please create a man page for this tool." -.PHONY: install-man - -uninstall-man: - @echo "Please create a man page for this tool." -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config - diff --git a/extras/floppy/Makefile b/extras/floppy/Makefile deleted file mode 100644 index 0adc373c94..0000000000 --- a/extras/floppy/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2005 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = create_floppy_devices -OBJ = -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: uninstall-bin - -install-man: - $(INSTALL) -d $(DESTDIR)$(mandir)/man8/ - $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: install-man - -uninstall-man: - -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config diff --git a/extras/fstab_import/.gitignore b/extras/fstab_import/.gitignore new file mode 100644 index 0000000000..c9ec5b801c --- /dev/null +++ b/extras/fstab_import/.gitignore @@ -0,0 +1 @@ +fstab_import diff --git a/extras/fstab_import/Makefile b/extras/fstab_import/Makefile deleted file mode 100644 index 3f65aa3f64..0000000000 --- a/extras/fstab_import/Makefile +++ /dev/null @@ -1,72 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2008 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = fstab_import -OBJ = -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - $(INSTALL_PROGRAM) -D $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - $(INSTALL_DATA) 79-fstab_import.rules $(DESTDIR)$(libudevdir)/rules.d/79-fstab_import.rules -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) - - rm $(DESTDIR)$(libudevdir)/rules.d/79-fstab_import.rules -.PHONY: uninstall-bin - -install-man: - @echo "Please create a man page for this tool." -.PHONY: install-man - -uninstall-man: - @echo "Please create a man page for this tool." -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config - diff --git a/extras/path_id/Makefile b/extras/path_id/Makefile deleted file mode 100644 index 2f0b882e65..0000000000 --- a/extras/path_id/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2006 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = path_id -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_SCRIPT) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: uninstall-bin - -install-man: - $(INSTALL) -d $(DESTDIR)$(mandir)/man8/ - $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: install-man - -uninstall-man: - -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config - diff --git a/extras/rule_generator/Makefile b/extras/rule_generator/Makefile deleted file mode 100644 index e236ca77f0..0000000000 --- a/extras/rule_generator/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2006 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_DATA) rule_generator.functions $(DESTDIR)$(libudevdir)/rule_generator.functions - $(INSTALL_SCRIPT) write_cd_rules $(DESTDIR)$(libudevdir)/write_cd_rules - $(INSTALL_SCRIPT) write_net_rules $(DESTDIR)$(libudevdir)/write_net_rules - $(INSTALL) -d $(DESTDIR)$(libudevdir)/rules.d - $(INSTALL_DATA) 75-cd-aliases-generator.rules \ - $(DESTDIR)$(libudevdir)/rules.d/75-cd-aliases-generator.rules - $(INSTALL_DATA) 75-persistent-net-generator.rules \ - $(DESTDIR)$(libudevdir)/rules.d/75-persistent-net-generator.rules -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/rule_generator.functions - - rm $(DESTDIR)$(libudevdir)/write_cd_rules - - rm $(DESTDIR)$(libudevdir)/write_net_rules - - rm $(DESTDIR)$(configdir)/rules.d/75-cd-aliases-generator.rules - - rm $(DESTDIR)$(configdir)/rules.d/75-persistent-net-generator.rules -.PHONY: uninstall-bin - -install-man: - @echo "Please create a man page for this tool." -.PHONY: install-man - -uninstall-man: - @echo "Please create a man page for this tool." -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config - diff --git a/extras/scsi_id/Makefile b/extras/scsi_id/Makefile deleted file mode 100644 index ca067d0cb9..0000000000 --- a/extras/scsi_id/Makefile +++ /dev/null @@ -1,91 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2003 IBM -# Copyright (C) 2004-2005 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -SCSI_ID_VERSION = 2.0 - -PROG = scsi_id -OBJS= scsi_serial.o -HEADERS = scsi_id.h scsi.h scsi_id_version.h bsg.h -GEN_HEADERS = scsi_id_version.h -MAN_PAGES = scsi_id.8 - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -scsi_id_version.h: - $(E) " GENHDR " $@ - $(Q) echo "/* Generated by make. */" > $@ - $(Q) echo \#define SCSI_ID_VERSION \"$(SCSI_ID_VERSION)\" >> $@ - $(Q) echo \#define SCSI_ID_CONFIG_FILE \"$(etcdir)/scsi_id.config\" >> $@ - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: uninstall-bin - -install-man: - $(INSTALL) -d $(DESTDIR)$(mandir)/man8 - $(INSTALL_DATA) scsi_id.8 $(DESTDIR)$(mandir)/man8/scsi_id.8 -.PHONY: install-man - -uninstall-man: - -rm -f $(DESTDIR)$(mandir)/man8/scsi_id.8 -.PHONY: uninstall-man - -install-config: - @ if [ ! -r $(DESTDIR)$(etcdir)/scsi_id.config ]; then \ - echo $(INSTALL) -d $(DESTDIR)$(etcdir); \ - echo $(INSTALL_DATA) ./scsi_id.config $(DESTDIR)$(etcdir); \ - $(INSTALL) -d $(DESTDIR)$(etcdir); \ - $(INSTALL_DATA) ./scsi_id.config $(DESTDIR)$(etcdir)/scsi_id.config; \ - fi -.PHONY: install-config - -install: all install-bin install-config install-man -.PHONY: install - -uninstall: uninstall-bin uninstall-man -.PHONY: uninstall diff --git a/extras/usb_id/Makefile b/extras/usb_id/Makefile deleted file mode 100644 index 09496049a5..0000000000 --- a/extras/usb_id/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2005 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = usb_id -OBJ = -HEADERS = -GEN_HEADERS = -MAN_PAGES = - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -$(PROG): %: $(HEADERS) %.o $(OBJS) - $(E) " LD " $@ - $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS) - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) -.PHONY: uninstall-bin - -install-man: - @echo "Please create a man page for this tool." -.PHONY: install-man - -uninstall-man: - @echo "Please create a man page for this tool." -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config diff --git a/extras/volume_id/Makefile b/extras/volume_id/Makefile deleted file mode 100644 index 50d5e338c2..0000000000 --- a/extras/volume_id/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# Makefile for udev extra invoked from the udev main Makefile -# -# Copyright (C) 2004-2006 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# - -PROG = vol_id -GEN_HEADERS = -MAN_PAGES = vol_id.8 - -prefix = -etcdir = ${prefix}/etc -sbindir = ${prefix}/sbin -usrbindir = ${prefix}/usr/bin -usrsbindir = ${prefix}/usr/sbin -libudevdir = ${prefix}/lib/udev -mandir = ${prefix}/usr/share/man -configdir = ${etcdir}/udev/ - -INSTALL = install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_SCRIPT = ${INSTALL} - -all: lib $(PROG) $(MAN_PAGES) -.PHONY: all -.DEFAULT: all - -.SUFFIXES: - -%.o: %.c $(GEN_HEADERS) - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -lib: - $(Q) $(MAKE) -C $@ -.PHONY: lib - -lib/libvolume_id.a: lib - -$(PROG): %: $(HEADERS) %.o lib/libvolume_id.a - $(E) " LD " $@ -ifeq ($(strip $(VOLUME_ID_STATIC)),true) - $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) lib/libvolume_id.a $(LIB_OBJS) -else - $(Q) $(LD) $(LDFLAGS) -o $@ $@.o $(LIBUDEV) -Llib -lvolume_id $(LIB_OBJS) -endif - -# man pages -%.8: %.xml - $(E) " XMLTO " $@ - $(Q) xmlto man $? -.PRECIOUS: %.8 - -clean: - $(E) " CLEAN " - $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS) - $(Q) $(MAKE) -C lib clean -.PHONY: clean - -install-bin: all - $(INSTALL) -d $(DESTDIR)$(libudevdir) - $(INSTALL_PROGRAM) $(PROG) $(DESTDIR)$(libudevdir)/$(PROG) - $(MAKE) -C lib install -.PHONY: install-bin - -uninstall-bin: - - rm $(DESTDIR)$(libudevdir)/$(PROG) - $(MAKE) -C lib uninstall -.PHONY: uninstall-bin - -install-man: - $(INSTALL) -d $(DESTDIR)$(mandir)/man8 - $(INSTALL_DATA) $(PROG).8 $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: install-man - -uninstall-man: - -rm -f $(DESTDIR)$(mandir)/man8/$(PROG).8 -.PHONY: uninstall-man - -install-config: - @echo "no config file to install" -.PHONY: install-config diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile deleted file mode 100644 index 95bb2ed394..0000000000 --- a/extras/volume_id/lib/Makefile +++ /dev/null @@ -1,138 +0,0 @@ -# libvolume_id - read filesystem label/uuid -# -# Copyright (C) 2004-2006 Kay Sievers -# -# Released under the GNU General Public License, version 2. -# -includedir = ${prefix}/usr/include -oslibdir = $(shell $(CC) $(CFLAGS) -print-multi-os-directory) -libdir = $(realpath ${prefix}/lib/$(oslibdir)) -usrlibdir = $(realpath ${prefix}/usr/lib/$(oslibdir)) - -INSTALL = install -c -INSTALL_DATA = ${INSTALL} -m 644 -INSTALL_LIB = ${INSTALL} -m 755 - -SHLIB_CUR = 0 -SHLIB_REV = 85 -SHLIB_AGE = 0 -SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE) - -OBJS= \ - ext.o \ - fat.o \ - hfs.o \ - highpoint.o \ - isw_raid.o \ - lsi_raid.o \ - via_raid.o \ - silicon_raid.o \ - nvidia_raid.o \ - promise_raid.o \ - adaptec_raid.o \ - jmicron_raid.o \ - ddf_raid.o \ - iso9660.o \ - jfs.o \ - linux_raid.o \ - linux_swap.o \ - lvm.o \ - ntfs.o \ - reiserfs.o \ - udf.o \ - ufs.o \ - xfs.o \ - cramfs.o \ - hpfs.o \ - romfs.o \ - sysv.o \ - minix.o \ - gfs.o \ - luks.o \ - ocfs.o \ - vxfs.o \ - squashfs.o \ - netware.o \ - oracleasm.o \ - volume_id.o \ - util.o - -HEADERS= \ - libvolume_id.h \ - util.h - -all: libvolume_id.a $(SHLIB) libvolume_id.pc -.PHONY: all -.DEFAULT: all - -.SUFFIXES: - -%.o: %.c - $(E) " CC " $@ - $(Q) $(CC) -c $(CFLAGS) $< -o $@ - -.shlib/%.o: %.c - $(E) " CC " $@ - $(Q) mkdir -p $(dir $@) - $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@ - -libvolume_id.a: $(HEADERS) $(OBJS) - $(Q) rm -f $@ - $(E) " AR " $@ - $(Q) $(AR) cq $@ $(OBJS) - $(E) " RANLIB " $@ - $(Q) $(RANLIB) $@ - -$(SHLIB): $(HEADERS) exported_symbols $(addprefix .shlib/,$(OBJS)) - $(E) " CC " $@ - $(Q) $(CC) -shared $(CFLAGS) $(LDFLAGS) -o $@ \ - -Wl,-soname,libvolume_id.so.$(SHLIB_CUR),--version-script,exported_symbols \ - $(addprefix .shlib/,$(OBJS)) - $(Q) ln -sf $@ libvolume_id.so.$(SHLIB_CUR) - $(Q) ln -sf $@ libvolume_id.so - -libvolume_id.pc: - $(E) " GENPC " $@ - $(Q) echo "prefix=${prefix}/usr" >> $@ - $(Q) echo "exec_prefix=\$${prefix}" >> $@ - $(Q) echo "libdir=${usrlibdir}" >> $@ - $(Q) echo "includedir=${includedir}" >> $@ - $(Q) echo "" >> $@ - $(Q) echo "Name: libvolume_id" >> $@ - $(Q) echo "Description: Filesystem label and uuid access" >> $@ - $(Q) echo "Version: $(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)" >> $@ - $(Q) echo "Libs: -L\$${libdir} -lvolume_id" >> $@ - $(Q) echo "Cflags: -I\$${includedir}" >> $@ - -install: all - $(INSTALL) -d $(DESTDIR)$(includedir) - $(INSTALL_DATA) libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h - $(INSTALL) -d $(DESTDIR)$(libdir) - $(INSTALL_LIB) $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB) - $(INSTALL) -d $(DESTDIR)$(usrlibdir) - ln -sf $(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) -ifeq ($(libdir),$(usrlibdir)) - ln -sf $(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so -else - ln -sf $(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so -endif - $(INSTALL) -d $(DESTDIR)$(usrlibdir)/pkgconfig - $(INSTALL_DATA) libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc -.PHONY: install - -uninstall: - rm -f $(DESTDIR)$(includedir)/libvolume_id.h - rm -f $(DESTDIR)$(usrlibdir)/libvolume_id.a - rm -f $(DESTDIR)$(libdir)/$(SHLIB) - rm -f $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR) - rm -f $(DESTDIR)$(libdir)/libvolume_id.so -.PHONY: uninstall - -clean: - $(E) " CLEAN " - $(Q) rm -f libvolume_id.a $(OBJS) - $(Q) rm -f $(SHLIB) libvolume_id.so.$(SHLIB_CUR) libvolume_id.so - $(Q) rm -rf .shlib - $(Q) rm -f libvolume_id.pc -.PHONY: clean - diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8 deleted file mode 100644 index 2e4a8c3811..0000000000 --- a/extras/volume_id/vol_id.8 +++ /dev/null @@ -1,79 +0,0 @@ -.\" Title: vol_id -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: March 2006 -.\" Manual: vol_id -.\" Source: volume_id -.\" -.TH "VOL_ID" "8" "March 2006" "volume_id" "vol_id" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -vol_id - probe filesystem type and read label and uuid -.SH "SYNOPSIS" -.HP 7 -\fBvol_id\fR [\fB\-\-export\fR] [\fB\-\-type\fR] [\fB\-\-label\fR] [\fB\-\-label\-raw\fR] [\fB\-\-uuid\fR] [\fB\-\-skip\-raid\fR] [\fB\-\-probe\-all\fR] [\fB\-\-help\fR] [\fIdevice\fR] -.SH "DESCRIPTION" -.PP -\fBvol_id\fR -is usually called from a udev rule, to provide udev with the filesystem type, the label and the uuid of a volume\. It supports most of the common filesystem formats and detects various raid setups to prevent the recognition of raid members as a volume with a filesystem\. -.SH "OPTIONS" -.PP -\fB\-\-export\fR -.RS 4 -Print all values in key/value format to import them into the environment\. -.RE -.PP -\fB\-\-type\fR -.RS 4 -Print the filesystem type\. -.RE -.PP -\fB\-\-label\fR -.RS 4 -Print the safe version of volume label suitable for use as filename\. -.RE -.PP -\fB\-\-label\-raw\fR -.RS 4 -Print the raw volume label\. -.RE -.PP -\fB\-\-uuid\fR -.RS 4 -Print the uuid of a volume\. -.RE -.PP -\fB\-\-skip\-raid\fR -.RS 4 -Skip detection of raid metadata\. -.RE -.PP -\fB\-\-probe\-all\fR -.RS 4 -Probe for all types and print all matches\. -.RE -.PP -\fB\-\-help\fR -.RS 4 -Print usage\. -.RE -.SH "ENVIRONMENT" -.PP -\fBUDEV_LOG\fR -.RS 4 -Set the syslog priority\. -.RE -.SH "EXIT STATUS" -.PP -\fBvol_id\fR -will only return successful if the value asked for is not empty\. All trailing whitespace will be removed, spaces replaced by underscore and slashes ignored\. -.SH "AUTHOR" -.PP -Written by Kay Sievers - -.SH "SEE ALSO" -.PP -\fBudev\fR(7) diff --git a/list.h b/list.h deleted file mode 100644 index 8626630f6b..0000000000 --- a/list.h +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copied from the Linux kernel source tree, version 2.6.0-test1. - * - * Licensed under the GPL v2 as per the whole kernel source tree. - * - */ - -#ifndef _LIST_H -#define _LIST_H - -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -/* - * These are non-NULL pointers that will result in page faults - * under normal circumstances, used to verify that nobody uses - * non-initialized list entries. - */ -#define LIST_POISON1 ((void *) 0x00100100) -#define LIST_POISON2 ((void *) 0x00200200) - -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_del(struct list_head * prev, struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty on entry does not return true after this, the entry is - * in an undefined state. - */ -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = LIST_POISON1; - entry->prev = LIST_POISON2; -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static inline void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_move - delete from one list and add as another's head - * @list: the entry to move - * @head: the head that will precede our entry - */ -static inline void list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - delete from one list and add as another's tail - * @list: the entry to move - * @head: the head that will follow our entry - */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static inline int list_empty(struct list_head *head) -{ - return head->next == head; -} - -static inline void __list_splice(struct list_head *list, - struct list_head *head) -{ - struct list_head *first = list->next; - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -static inline void list_splice(struct list_head *list, struct list_head *head) -{ - if (!list_empty(list)) - __list_splice(list, head); -} - -/** - * list_splice_init - join two lists and reinitialise the emptied list. - * @list: the new list to add. - * @head: the place to add it in the first list. - * - * The list at @list is reinitialised - */ -static inline void list_splice_init(struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) { - __list_splice(list, head); - INIT_LIST_HEAD(list); - } -} - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); \ - pos = pos->next) - -/** - * __list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - * - * This variant differs from list_for_each() in that it's the - * simplest possible list iteration code. - * Use this for code that knows the list to be very short (empty - * or 1 entry) most of the time. - */ -#define __list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each_prev(pos, head) \ - for (pos = (head)->prev; pos != (head); pos = pos->prev) - -/** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -/** - * list_for_each_entry - iterate over list of given type - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_reverse - iterate backwards over list of given type. - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) - -/** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -#endif /* _LIST_H */ diff --git a/logging.h b/logging.h deleted file mode 100644 index 6e1d5a20ef..0000000000 --- a/logging.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * simple logging functions that can be expanded into nothing - * - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef LOGGING_H -#define LOGGING_H - -#define err(format, arg...) do { } while (0) -#define info(format, arg...) do { } while (0) -#define dbg(format, arg...) do { } while (0) -#define logging_init(foo) do { } while (0) -#define logging_close(foo) do { } while (0) - -#ifdef USE_LOG -#include -#include -#include - -#undef err -#define err(format, arg...) \ - do { \ - log_message(LOG_ERR ,"%s: " format ,__FUNCTION__ ,## arg); \ - } while (0) - -#undef info -#define info(format, arg...) \ - do { \ - log_message(LOG_INFO ,"%s: " format ,__FUNCTION__ ,## arg); \ - } while (0) - -#ifdef DEBUG -#undef dbg -#define dbg(format, arg...) \ - do { \ - log_message(LOG_DEBUG ,"%s: " format ,__FUNCTION__ ,## arg); \ - } while (0) -#endif - -extern void log_message(int priority, const char *format, ...) - __attribute__ ((format (printf, 2, 3))); - -#undef logging_init -static inline void logging_init(const char *program_name) -{ - openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); -} - -#undef logging_close -static inline void logging_close(void) -{ - closelog(); -} - -#endif /* USE_LOG */ - -#endif diff --git a/test-udev.c b/test-udev.c deleted file mode 100644 index 4ac2d5a889..0000000000 --- a/test-udev.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" -#include "udev_selinux.h" - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - -static void asmlinkage sig_handler(int signum) -{ - switch (signum) { - case SIGALRM: - exit(1); - case SIGINT: - case SIGTERM: - exit(20 + signum); - } -} - -int main(int argc, char *argv[], char *envp[]) -{ - struct sysfs_device *dev; - struct udevice *udev; - const char *maj, *min; - struct udev_rules rules; - const char *action; - const char *devpath; - const char *subsystem; - struct sigaction act; - int devnull; - int retval = -EINVAL; - - if (argc == 2 && strcmp(argv[1], "-V") == 0) { - printf("%s\n", UDEV_VERSION); - exit(0); - } - - /* set std fd's to /dev/null, /sbin/hotplug forks us, we don't have them at all */ - devnull = open("/dev/null", O_RDWR); - if (devnull >= 0) { - if (devnull != STDIN_FILENO) - dup2(devnull, STDIN_FILENO); - if (devnull != STDOUT_FILENO) - dup2(devnull, STDOUT_FILENO); - if (devnull != STDERR_FILENO) - dup2(devnull, STDERR_FILENO); - if (devnull > STDERR_FILENO) - close(devnull); - } - - logging_init("udev"); - if (devnull < 0) - err("open /dev/null failed: %s\n", strerror(errno)); - udev_config_init(); - selinux_init(); - dbg("version %s\n", UDEV_VERSION); - - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = (void (*)(int)) sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - - /* trigger timeout to prevent hanging processes */ - alarm(UDEV_EVENT_TIMEOUT); - - action = getenv("ACTION"); - devpath = getenv("DEVPATH"); - subsystem = getenv("SUBSYSTEM"); - /* older kernels passed the SUBSYSTEM only as argument */ - if (subsystem == NULL && argc == 2) - subsystem = argv[1]; - - if (action == NULL || subsystem == NULL || devpath == NULL) { - err("action, subsystem or devpath missing\n"); - goto exit; - } - - /* export log_priority , as called programs may want to do the same as udev */ - if (udev_log_priority) { - char priority[32]; - - sprintf(priority, "%i", udev_log_priority); - setenv("UDEV_LOG", priority, 1); - } - - sysfs_init(); - udev_rules_init(&rules, 0); - - dev = sysfs_device_get(devpath); - if (dev == NULL) { - info("unable to open '%s'\n", devpath); - goto fail; - } - - udev = udev_device_init(NULL); - if (udev == NULL) - goto fail; - - /* override built-in sysfs device */ - udev->dev = dev; - strlcpy(udev->action, action, sizeof(udev->action)); - - /* get dev_t from environment, which is needed for "remove" to work, "add" works also from sysfs */ - maj = getenv("MAJOR"); - min = getenv("MINOR"); - if (maj != NULL && min != NULL) - udev->devt = makedev(atoi(maj), atoi(min)); - else - udev->devt = udev_device_get_devt(udev); - - retval = udev_device_event(&rules, udev); - - /* rules may change/disable the timeout */ - if (udev->event_timeout >= 0) - alarm(udev->event_timeout); - - if (retval == 0 && !udev->ignore_device && udev_run) - udev_rules_run(udev); - - udev_device_cleanup(udev); -fail: - udev_rules_cleanup(&rules); - sysfs_cleanup(); - selinux_exit(); - -exit: - logging_close(); - if (retval != 0) - return 1; - return 0; -} diff --git a/udev.7 b/udev.7 deleted file mode 100644 index c4ca28603d..0000000000 --- a/udev.7 +++ /dev/null @@ -1,432 +0,0 @@ -.\" Title: udev -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: August 2005 -.\" Manual: udev -.\" Source: udev -.\" -.TH "UDEV" "7" "August 2005" "udev" "udev" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udev - dynamic device management -.SH "DESCRIPTION" -.PP -udev provides a dynamic device directory containing only the files for actually present devices\. It creates or removes device node files in the -\fI/dev\fR -directory, or it renames network interfaces\. -.PP -Usually udev runs as -\fBudevd\fR(8) -and receives uevents directly from the kernel if a device is added or removed from the system\. -.PP -If udev receives a device event, it matches its configured rules against the available device attributes provided in sysfs to identify the device\. Rules that match may provide additional device information or specify a device node name and multiple symlink names and instruct udev to run additional programs as part of the device event handling\. -.SH "CONFIGURATION" -.PP -udev configuration files are placed in -\fI/etc/udev/\fR -and -\fI/lib/udev/\fR\. All empty lines, or lines beginning with \'#\' will be ignored\. -.SS "Configuration file" -.PP -udev expects its main configuration file at -\fI/etc/udev/udev\.conf\fR\. It consists of a set of variables allowing the user to override default udev values\. The following variables can be set: -.PP -\fBudev_root\fR -.RS 4 -Specifies where to place the device nodes in the filesystem\. The default value is -\fI/dev\fR\. -.RE -.PP -\fBudev_log\fR -.RS 4 -The logging priority\. Valid values are the numerical syslog priorities or their textual representations: -\fBerr\fR, -\fBinfo\fR -and -\fBdebug\fR\. -.RE -.SS "Rules files" -.PP -The udev rules are read from the files located in the default rules directory -\fI/lib/udev/rules\.d/\fR, the custom rules directory -\fI/etc/udev/rules\.d/\fR -and the temporary rules directory -\fI/dev/\.udev/rules\.d/\fR\. All rule files are sorted and processed in lexical order, regardless in which of these directories they live\. Every line in the rules file contains at least one key value pair\. There are two kind of keys, match and assignment keys\. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned\. -.PP -A matching rule may specify the name of the device node, add a symlink pointing to the node, or run a specified program as part of the event handling\. If no matching rule is found, the default device node name is used\. -.PP -A rule may consist of a list of one or more key value pairs separated by a comma\. Each key has a distinct operation, depending on the used operator\. Valid operators are: -.PP -\fB==\fR -.RS 4 -Compare for equality\. -.RE -.PP -\fB!=\fR -.RS 4 -Compare for non\-equality\. -.RE -.PP -\fB=\fR -.RS 4 -Assign a value to a key\. Keys that represent a list, are reset and only this single value is assigned\. -.RE -.PP -\fB+=\fR -.RS 4 -Add the value to a key that holds a list of entries\. -.RE -.PP -\fB:=\fR -.RS 4 -Assign a value to a key finally; disallow any later changes, which may be used to prevent changes by any later rules\. -.RE -.PP -The following key names can be used to match against device properties\. Some of the keys also match against properties of the parent devices in sysfs, not only the device that has generated the event\. If multiple keys that match a parent device are specified in a single rule, all these keys must match at one and the same parent device\. -.PP -\fBACTION\fR -.RS 4 -Match the name of the event action\. -.RE -.PP -\fBDEVPATH\fR -.RS 4 -Match the devpath of the event device\. -.RE -.PP -\fBKERNEL\fR -.RS 4 -Match the name of the event device\. -.RE -.PP -\fBNAME\fR -.RS 4 -Match the name of the node or network interface\. It can be used once the NAME key has been set in one of the preceding rules\. -.RE -.PP -\fBSUBSYSTEM\fR -.RS 4 -Match the subsystem of the event device\. -.RE -.PP -\fBDRIVER\fR -.RS 4 -Match the driver name of the event device\. Only set for devices which are bound to a driver at the time the event is generated\. -.RE -.PP -\fBATTR{\fR\fB\fIfilename\fR\fR\fB}\fR -.RS 4 -Match sysfs attribute values of the event device\. Up to five -\fBATTR\fR -keys can be specified per rule\. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself\. Depending on the type of operator, this key is also used to set the value of a sysfs attribute\. -.RE -.PP -\fBKERNELS\fR -.RS 4 -Search the devpath upwards for a matching device name\. -.RE -.PP -\fBSUBSYSTEMS\fR -.RS 4 -Search the devpath upwards for a matching device subsystem name\. -.RE -.PP -\fBDRIVERS\fR -.RS 4 -Search the devpath upwards for a matching device driver name\. -.RE -.PP -\fBATTRS{\fR\fB\fIfilename\fR\fR\fB}\fR -.RS 4 -Search the devpath upwards for a device with matching sysfs attribute values\. Up to five -\fBATTRS\fR -keys can be specified per rule, but all of them must match on the same device\. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself\. -.RE -.PP -\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -.RS 4 -Match against the value of an environment variable\. Up to five -\fBENV\fR -keys can be specified per rule\. Depending on the type of operator, this key is also used to export a variable to the environment\. -.RE -.PP -\fBTEST{\fR\fB\fIoctal mode mask\fR\fR\fB}\fR -.RS 4 -Test the existence of a file\. An octal mode mask can be specified if needed\. -.RE -.PP -\fBPROGRAM\fR -.RS 4 -Execute external program\. The key is true, if the program returns with exit code zero\. The whole event environment is available to the executed program\. The program\'s output printed to stdout, is available in the RESULT key\. -.RE -.PP -\fBRESULT\fR -.RS 4 -Match the returned string of the last PROGRAM call\. This key can be used in the same or in any later rule after a PROGRAM call\. -.RE -.PP -Most of the fields support a shell style pattern matching\. The following pattern characters are supported: -.PP -\fB*\fR -.RS 4 -Matches zero, or any number of characters\. -.RE -.PP -\fB?\fR -.RS 4 -Matches any single character\. -.RE -.PP -\fB[]\fR -.RS 4 -Matches any single character specified within the brackets\. For example, the pattern string \'tty[SR]\' would match either \'ttyS\' or \'ttyR\'\. Ranges are also supported within this match with the \'\-\' character\. For example, to match on the range of all digits, the pattern [0\-9] would be used\. If the first character following the \'[\' is a \'!\', any characters not enclosed are matched\. -.RE -.PP -The following keys can get values assigned: -.PP -\fBNAME\fR -.RS 4 -The name of the node to be created, or the name the network interface should be renamed to\. Only one rule can set the node name, all later rules with a NAME key will be ignored\. -.RE -.PP -\fBSYMLINK\fR -.RS 4 -The name of a symlink targeting the node\. Every matching rule can add this value to the list of symlinks to be created along with the device node\. Multiple symlinks may be specified by separating the names by the space character\. -.RE -.PP -\fBOWNER, GROUP, MODE\fR -.RS 4 -The permissions for the device node\. Every specified value overwrites the compiled\-in default value\. -.RE -.PP -\fBATTR{\fR\fB\fIkey\fR\fR\fB}\fR -.RS 4 -The value that should be written to a sysfs attribute of the event device\. Depending on the type of operator, this key is also used to match against the value of a sysfs attribute\. -.RE -.PP -\fBENV{\fR\fB\fIkey\fR\fR\fB}\fR -.RS 4 -Export a variable to the environment\. Depending on the type of operator, this key is also to match against an environment variable\. -.RE -.PP -\fBRUN\fR -.RS 4 -Add a program to the list of programs to be executed for a specific device\. This can only be used for very short running tasks\. Running an event process for a long period of time may block all further events for this or a dependent device\. Long running tasks need to be immediately detached from the event process itself\. -.sp -If the specifiefd string starts with -\fBsocket:\fR\fB\fIpath\fR\fR, all current event values will be passed to the specified socket, as a message in the same format the kernel sends an uevent\. If the first character of the specified path is an @ character, an abstract namespace socket is used, instead of an existing socket file\. -.RE -.PP -\fBLABEL\fR -.RS 4 -Named label where a GOTO can jump to\. -.RE -.PP -\fBGOTO\fR -.RS 4 -Jumps to the next LABEL with a matching name -.RE -.PP -\fBIMPORT{\fR\fB\fItype\fR\fR\fB}\fR -.RS 4 -Import a set of variables into the event environment, depending on -\fItype\fR: -.PP -\fBprogram\fR -.RS 4 -Execute an external program specified as the assigned value and import its output, which must be in environment key format\. -.RE -.PP -\fBfile\fR -.RS 4 -Import a text file specified as the assigned value, which must be in environment key format\. -.RE -.PP -\fBparent\fR -.RS 4 -Import the stored keys from the parent device by reading the database entry of the parent device\. The value assigned to -\fBIMPORT{parent}\fR -is used as a filter of key names to import (with the same shell\-style pattern matching used for comparisons)\. -.RE -.sp -If no option is given, udev will choose between -\fBprogram\fR -and -\fBfile\fR -based on the executable bit of the file permissions\. -.RE -.PP -\fBWAIT_FOR\fR -.RS 4 -Wait for a file to become available\. -.RE -.PP -\fBOPTIONS\fR -.RS 4 -Rule and device options: -.PP -\fBlast_rule\fR -.RS 4 -Stops further rules application\. No later rules will have any effect\. -.RE -.PP -\fBignore_device\fR -.RS 4 -Ignore this event completely\. -.RE -.PP -\fBignore_remove\fR -.RS 4 -Do not remove the device node when the device goes away\. This may be useful as a workaround for broken device drivers\. -.RE -.PP -\fBlink_priority=\fR\fB\fIvalue\fR\fR -.RS 4 -Specify the priority of the created symlinks\. Devices with higher priorities overwrite existing symlinks of other devices\. The default is 0\. -.RE -.PP -\fBall_partitions\fR -.RS 4 -Create the device nodes for all available partitions of a block device\. This may be useful for removable media devices where media changes are not detected\. -.RE -.PP -\fBevent_timeout=\fR -.RS 4 -Number of seconds an event will wait for operations to finish, before it will terminate itself\. -.RE -.PP -\fBstring_escape=\fR\fB\fInone|replace\fR\fR -.RS 4 -Usually control and other possibly unsafe characters are replaced in strings used for device naming\. The mode of replacement can be specified with this option\. -.RE -.RE -.PP -The -\fBNAME\fR, -\fBSYMLINK\fR, -\fBPROGRAM\fR, -\fBOWNER\fR, -\fBGROUP\fR, -\fBMODE\fR -and -\fBRUN\fR -fields support simple printf\-like string substitutions\. The -\fBRUN\fR -format chars gets applied after all rules have been processed, right before the program is executed\. It allows the use of the complete environment set by earlier matching rules\. For all other fields, substitutions are applied while the individual rule is being processed\. The available substitutions are: -.PP -\fB$kernel\fR, \fB%k\fR -.RS 4 -The kernel name for this device\. -.RE -.PP -\fB$number\fR, \fB%n\fR -.RS 4 -The kernel number for this device\. For example, \'sda3\' has kernel number of \'3\' -.RE -.PP -\fB$devpath\fR, \fB%p\fR -.RS 4 -The devpath of the device\. -.RE -.PP -\fB$id\fR, \fB%b\fR -.RS 4 -The name of the device matched while searching the devpath upwards for -\fBSUBSYSTEMS\fR, -\fBKERNELS\fR, -\fBDRIVERS\fR -and -\fBATTRS\fR\. -.RE -.PP -\fB$driver\fR -.RS 4 -The driver name of the device matched while searching the devpath upwards for -\fBSUBSYSTEMS\fR, -\fBKERNELS\fR, -\fBDRIVERS\fR -and -\fBATTRS\fR\. -.RE -.PP -\fB$attr{\fR\fB\fIfile\fR\fR\fB}\fR, \fB%s{\fR\fB\fIfile\fR\fR\fB}\fR -.RS 4 -The value of a sysfs attribute found at the device, where all keys of the rule have matched\. If the matching device does not have such an attribute, follow the chain of parent devices and use the value of the first attribute that matches\. If the attribute is a symlink, the last element of the symlink target is returned as the value\. -.RE -.PP -\fB$env{\fR\fB\fIkey\fR\fR\fB}\fR, \fB%E{\fR\fB\fIkey\fR\fR\fB}\fR -.RS 4 -The value of an environment variable\. -.RE -.PP -\fB$major\fR, \fB%M\fR -.RS 4 -The kernel major number for the device\. -.RE -.PP -\fB$minor\fR, \fB%m\fR -.RS 4 -The kernel minor number for the device\. -.RE -.PP -\fB$result\fR, \fB%c\fR -.RS 4 -The string returned by the external program requested with PROGRAM\. A single part of the string, separated by a space character may be selected by specifying the part number as an attribute: -\fB%c{N}\fR\. If the number is followed by the \'+\' char this part plus all remaining parts of the result string are substituted: -\fB%c{N+}\fR -.RE -.PP -\fB$parent\fR, \fB%P\fR -.RS 4 -The node name of the parent device\. -.RE -.PP -\fB$name\fR -.RS 4 -The current name of the device node\. If not changed by a rule, it is the name of the kernel device\. -.RE -.PP -\fB$links\fR -.RS 4 -The current list of symlinks, separated by a space character\. The value is only set if an earlier rule assigned a value, or during a remove events\. -.RE -.PP -\fB$root\fR, \fB%r\fR -.RS 4 -The udev_root value\. -.RE -.PP -\fB$sys\fR, \fB%S\fR -.RS 4 -The sysfs mount point\. -.RE -.PP -\fB$tempnode\fR, \fB%N\fR -.RS 4 -The name of a created temporary device node to provide access to the device from a external program before the real node is created\. -.RE -.PP -\fB%%\fR -.RS 4 -The \'%\' character itself\. -.RE -.PP -\fB$$\fR -.RS 4 -The \'$\' character itself\. -.RE -.PP -The count of characters to be substituted may be limited by specifying the format length value\. For example, \'%3s{file}\' will only insert the first three characters of the sysfs attribute -.SH "AUTHOR" -.PP -Written by Greg Kroah\-Hartman - -and Kay Sievers -\. With much help from Dan Stekloff and many others\. -.SH "SEE ALSO" -.PP -\fBudevd\fR(8), -\fBudevadm\fR(8) diff --git a/udev.h b/udev.h deleted file mode 100644 index 5ecef4abbd..0000000000 --- a/udev.h +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef _UDEV_H_ -#define _UDEV_H_ - -#include -#include - -#include "list.h" -#include "logging.h" -#include "udev_sysdeps.h" -#include "udev_version.h" - -#define COMMENT_CHARACTER '#' -#define LINE_SIZE 512 -#define PATH_SIZE 512 -#define NAME_SIZE 256 -#define VALUE_SIZE 128 - -#define ALLOWED_CHARS "#+-.:=@_" -#define ALLOWED_CHARS_FILE ALLOWED_CHARS "/" -#define ALLOWED_CHARS_INPUT ALLOWED_CHARS_FILE " $%?," - -#define DEFAULT_PARTITIONS_COUNT 15 -#define UDEV_EVENT_TIMEOUT 180 - -#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) - -/* pipes */ -#define READ_END 0 -#define WRITE_END 1 - -#define UDEV_ROOT "/dev" -#define DB_DIR ".udev/db" -#define DB_NAME_INDEX_DIR ".udev/names" -#define RULES_LIB_DIR "/lib/udev/rules.d" -#define RULES_DYN_DIR ".udev/rules.d" -#define RULES_ETC_DIR "/etc/udev/rules.d" - -struct udev_rules; - -struct sysfs_device { - struct list_head node; /* for device cache */ - struct sysfs_device *parent; /* already cached parent*/ - char devpath[PATH_SIZE]; - char subsystem[NAME_SIZE]; /* $class, $bus, drivers, module */ - char kernel[NAME_SIZE]; /* device instance name */ - char kernel_number[NAME_SIZE]; - char driver[NAME_SIZE]; /* device driver name */ -}; - -struct udevice { - /* device event */ - struct sysfs_device *dev; /* points to dev_local by default */ - struct sysfs_device dev_local; - struct sysfs_device *dev_parent; /* current parent device used for matching */ - char action[NAME_SIZE]; - char *devpath_old; - - /* node */ - char name[PATH_SIZE]; - struct list_head symlink_list; - int symlink_final; - char owner[NAME_SIZE]; - int owner_final; - char group[NAME_SIZE]; - int group_final; - mode_t mode; - int mode_final; - dev_t devt; - - /* event processing */ - struct list_head run_list; - int run_final; - struct list_head env_list; - char tmp_node[PATH_SIZE]; - int partitions; - int ignore_device; - int ignore_remove; - char program_result[PATH_SIZE]; - int link_priority; - int event_timeout; - int test_run; -}; - -/* udev_config.c */ -extern char udev_root[PATH_SIZE]; -extern char udev_config_filename[PATH_SIZE]; -extern char udev_rules_dir[PATH_SIZE]; -extern int udev_log_priority; -extern int udev_run; -extern void udev_config_init(void); - -/* udev_device.c */ -extern struct udevice *udev_device_init(struct udevice *udev); -extern void udev_device_cleanup(struct udevice *udev); -extern int udev_device_event(struct udev_rules *rules, struct udevice *udev); -extern dev_t udev_device_get_devt(struct udevice *udev); - -/* udev_sysfs.c */ -extern char sysfs_path[PATH_SIZE]; -extern int sysfs_init(void); -extern void sysfs_cleanup(void); -extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, - const char *subsystem, const char *driver); -extern struct sysfs_device *sysfs_device_get(const char *devpath); -extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); -extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem); -extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); -extern int sysfs_resolve_link(char *path, size_t size); -extern int sysfs_lookup_devpath_by_subsys_id(char *devpath, size_t len, const char *subsystem, const char *id); - -/* udev_node.c */ -extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); -extern void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old); -extern int udev_node_add(struct udevice *udev); -extern int udev_node_remove(struct udevice *udev); - -/* udev_db.c */ -extern int udev_db_add_device(struct udevice *dev); -extern int udev_db_delete_device(struct udevice *dev); -extern int udev_db_rename(const char *devpath_old, const char *devpath); -extern int udev_db_get_device(struct udevice *udev, const char *devpath); -extern int udev_db_get_devices_by_name(const char *name, struct list_head *name_list); -extern int udev_db_get_all_entries(struct list_head *name_list); - -/* udev_utils.c */ -struct name_entry { - struct list_head node; - char name[PATH_SIZE]; - unsigned int ignore_error:1; -}; - -extern int log_priority(const char *priority); -extern struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort); -extern struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value); -extern int name_list_key_remove(struct list_head *name_list, const char *key); -extern void name_list_cleanup(struct list_head *name_list); -extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); -extern uid_t lookup_user(const char *user); -extern gid_t lookup_group(const char *group); - -/* udev_utils_string.c */ -extern int string_is_true(const char *str); -extern void remove_trailing_chars(char *path, char c); -extern size_t path_encode(char *s, size_t len); -extern size_t path_decode(char *s); -extern int utf8_encoded_valid_unichar(const char *str); -extern int replace_chars(char *str, const char *white); - -/* udev_utils_file.c */ -extern int create_path(const char *path); -extern int delete_path(const char *path); -extern int file_map(const char *filename, char **buf, size_t *bufsize); -extern void file_unmap(void *buf, size_t bufsize); -extern int unlink_secure(const char *filename); -extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); - -/* udev commands */ -extern int udevmonitor(int argc, char *argv[], char *envp[]); -extern int udevinfo(int argc, char *argv[], char *envp[]); -extern int udevcontrol(int argc, char *argv[], char *envp[]); -extern int udevtrigger(int argc, char *argv[], char *envp[]); -extern int udevsettle(int argc, char *argv[], char *envp[]); -extern int udevtest(int argc, char *argv[], char *envp[]); - -#endif diff --git a/udev.xml b/udev.xml deleted file mode 100644 index c740c0d807..0000000000 --- a/udev.xml +++ /dev/null @@ -1,639 +0,0 @@ - - - -

                    -
                    - udev - - - udev - August 2005 - udev - - - - udev - 7 - - - - - udev - dynamic device management - - - DESCRIPTION - udev provides a dynamic device directory containing only the files for - actually present devices. It creates or removes device node files in the - /dev directory, or it renames network interfaces. - - Usually udev runs as udevd - 8 and receives uevents directly from the - kernel if a device is added or removed from the system. - - If udev receives a device event, it matches its configured rules - against the available device attributes provided in sysfs to identify the device. - Rules that match may provide additional device information or specify a device - node name and multiple symlink names and instruct udev to run additional programs - as part of the device event handling. - - - CONFIGURATION - udev configuration files are placed in /etc/udev/ - and /lib/udev/. All empty lines, or lines beginning with - '#' will be ignored. - - Configuration file - udev expects its main configuration file at /etc/udev/udev.conf. - It consists of a set of variables allowing the user to override default udev values. - The following variables can be set: - - - - - Specifies where to place the device nodes in the filesystem. - The default value is /dev. - - - - - - - The logging priority. Valid values are the numerical syslog priorities - or their textual representations: , - and . - - - - - - Rules files - The udev rules are read from the files located in the - default rules directory /lib/udev/rules.d/, - the custom rules directory /etc/udev/rules.d/ - and the temporary rules directory /dev/.udev/rules.d/. - All rule files are sorted and processed in lexical order, regardless - in which of these directories they live. Every line in the rules file contains at least - one key value pair. There are two kind of keys, match and assignment keys. - If all match keys are matching against its value, the rule gets applied and the - assign keys get the specified value assigned. - - A matching rule may specify the name of the device node, add a symlink - pointing to the node, or run a specified program as part of the event handling. - If no matching rule is found, the default device node name is used. - - A rule may consist of a list of one or more key value pairs separated by - a comma. Each key has a distinct operation, depending on the used operator. Valid - operators are: - - - - - Compare for equality. - - - - - - - Compare for non-equality. - - - - - - - Assign a value to a key. Keys that represent a list, are reset - and only this single value is assigned. - - - - - - - Add the value to a key that holds a list of entries. - - - - - - - Assign a value to a key finally; disallow any later changes, - which may be used to prevent changes by any later rules. - - - - - The following key names can be used to match against device properties. - Some of the keys also match against properties of the parent devices in sysfs, - not only the device that has generated the event. If multiple keys that match - a parent device are specified in a single rule, all these keys must match at - one and the same parent device. - - - - - Match the name of the event action. - - - - - - - Match the devpath of the event device. - - - - - - - Match the name of the event device. - - - - - - - Match the name of the node or network interface. It can - be used once the NAME key has been set in one of the preceding - rules. - - - - - - - Match the subsystem of the event device. - - - - - - Match the driver name of the event device. Only set for devices - which are bound to a driver at the time the event is generated. - - - - - - Match sysfs attribute values of the event device. Up to five - keys can be specified per rule. Trailing - whitespace in the attribute values is ignored, if the specified match - value does not contain trailing whitespace itself. Depending on the type - of operator, this key is also used to set the value of a sysfs attribute. - - - - - - - - Search the devpath upwards for a matching device name. - - - - - - - Search the devpath upwards for a matching device subsystem name. - - - - - - - Search the devpath upwards for a matching device driver name. - - - - - - - Search the devpath upwards for a device with matching sysfs attribute values. - Up to five keys can be specified per rule, but all of them - must match on the same device. Trailing whitespace in the attribute values is ignored, - if the specified match value does not contain trailing whitespace itself. - - - - - - - Match against the value of an environment variable. Up to five - keys can be specified per rule. Depending on the type of operator, this key is also used - to export a variable to the environment. - - - - - - - Test the existence of a file. An octal mode mask can be specified - if needed. - - - - - - - Execute external program. The key is true, if the program returns - with exit code zero. The whole event environment is available to the - executed program. The program's output printed to stdout, is available in - the RESULT key. - - - - - - - Match the returned string of the last PROGRAM call. This key can - be used in the same or in any later rule after a PROGRAM call. - - - - - Most of the fields support a shell style pattern matching. The following - pattern characters are supported: - - - - - Matches zero, or any number of characters. - - - - - - Matches any single character. - - - - - - Matches any single character specified within the brackets. For - example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. - Ranges are also supported within this match with the '-' character. - For example, to match on the range of all digits, the pattern [0-9] would - be used. If the first character following the '[' is a '!', any characters - not enclosed are matched. - - - - - The following keys can get values assigned: - - - - - The name of the node to be created, or the name the network interface - should be renamed to. Only one rule can set the node name, all later rules with - a NAME key will be ignored. - - - - - - - The name of a symlink targeting the node. Every matching rule can add - this value to the list of symlinks to be created along with the device node. - Multiple symlinks may be specified by separating the names by the space - character. - - - - - - - The permissions for the device node. Every specified value overwrites - the compiled-in default value. - - - - - - - The value that should be written to a sysfs attribute of the - event device. Depending on the type of operator, this key is also - used to match against the value of a sysfs attribute. - - - - - - - Export a variable to the environment. Depending on the type of operator, - this key is also to match against an environment variable. - - - - - - - Add a program to the list of programs to be executed for a specific - device. This can only be used for very short running tasks. Running an - event process for a long period of time may block all further events for - this or a dependent device. Long running tasks need to be immediately - detached from the event process itself. - If the specifiefd string starts with - , all current event - values will be passed to the specified socket, as a message in the same - format the kernel sends an uevent. If the first character of the specified path - is an @ character, an abstract namespace socket is used, instead of an existing - socket file. - - - - - - - Named label where a GOTO can jump to. - - - - - - - Jumps to the next LABEL with a matching name - - - - - - - Import a set of variables into the event environment, - depending on type: - - - - - Execute an external program specified as the assigned value and - import its output, which must be in environment key format. - - - - - - Import a text file specified as the assigned value, which must be in - environment key format. - - - - - - Import the stored keys from the parent device by reading - the database entry of the parent device. The value assigned to - is used as a filter of key names - to import (with the same shell-style pattern matching used for - comparisons). - - - - If no option is given, udev will choose between - and based on the executable bit of the file - permissions. - - - - - - - Wait for a file to become available. - - - - - - - Rule and device options: - - - - - Stops further rules application. No later rules will have - any effect. - - - - - - Ignore this event completely. - - - - - - Do not remove the device node when the device goes away. This may be - useful as a workaround for broken device drivers. - - - - - - Specify the priority of the created symlinks. Devices with higher - priorities overwrite existing symlinks of other devices. The default is 0. - - - - - - Create the device nodes for all available partitions of a block device. - This may be useful for removable media devices where media changes are not - detected. - - - - - - Number of seconds an event will wait for operations to finish, before it - will terminate itself. - - - - - - Usually control and other possibly unsafe characters are replaced - in strings used for device naming. The mode of replacement can be specified - with this option. - - - - - - - - The , , , - , , and - fields support simple printf-like string substitutions. The - format chars gets applied after all rules have been processed, right before the program - is executed. It allows the use of the complete environment set by earlier matching - rules. For all other fields, substitutions are applied while the individual rule is - being processed. The available substitutions are: - - - , - - The kernel name for this device. - - - - - , - - The kernel number for this device. For example, 'sda3' has - kernel number of '3' - - - - - , - - The devpath of the device. - - - - - , - - The name of the device matched while searching the devpath upwards for - , , and . - - - - - - - - The driver name of the device matched while searching the devpath upwards for - , , and . - - - - - - , - - The value of a sysfs attribute found at the device, where - all keys of the rule have matched. If the matching device does not have - such an attribute, follow the chain of parent devices and use the value - of the first attribute that matches. - If the attribute is a symlink, the last element of the symlink target is - returned as the value. - - - - - , - - The value of an environment variable. - - - - - , - - The kernel major number for the device. - - - - - , - - The kernel minor number for the device. - - - - - , - - The string returned by the external program requested with PROGRAM. - A single part of the string, separated by a space character may be selected - by specifying the part number as an attribute: . - If the number is followed by the '+' char this part plus all remaining parts - of the result string are substituted: - - - - - , - - The node name of the parent device. - - - - - - - The current name of the device node. If not changed by a rule, it is the - name of the kernel device. - - - - - - - The current list of symlinks, separated by a space character. The value is - only set if an earlier rule assigned a value, or during a remove events. - - - - - , - - The udev_root value. - - - - - , - - The sysfs mount point. - - - - - , - - The name of a created temporary device node to provide access to - the device from a external program before the real node is created. - - - - - - - The '%' character itself. - - - - - - - The '$' character itself. - - - - The count of characters to be substituted may be limited by specifying - the format length value. For example, '%3s{file}' will only - insert the first three characters of the sysfs attribute - - - - AUTHOR - Written by Greg Kroah-Hartman greg@kroah.com and - Kay Sievers kay.sievers@vrfy.org. With much help from - Dan Stekloff and many others. - - - - SEE ALSO - - udevd8 - , - - udevadm8 - - - -
                    -
                    diff --git a/udev/list.h b/udev/list.h new file mode 100644 index 0000000000..8626630f6b --- /dev/null +++ b/udev/list.h @@ -0,0 +1,289 @@ +/* + * Copied from the Linux kernel source tree, version 2.6.0-test1. + * + * Licensed under the GPL v2 as per the whole kernel source tree. + * + */ + +#ifndef _LIST_H +#define _LIST_H + +/** + * container_of - cast a member of a structure out to the containing structure + * + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +/* + * These are non-NULL pointers that will result in page faults + * under normal circumstances, used to verify that nobody uses + * non-initialized list entries. + */ +#define LIST_POISON1 ((void *) 0x00100100) +#define LIST_POISON2 ((void *) 0x00200200) + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head * prev, struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is + * in an undefined state. + */ +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(struct list_head *head) +{ + return head->next == head; +} + +static inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static inline void list_splice(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next) + +/** + * __list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + * + * This variant differs from list_for_each() in that it's the + * simplest possible list iteration code. + * Use this for code that knows the list to be very short (empty + * or 1 entry) most of the time. + */ +#define __list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); pos = pos->prev) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_reverse - iterate backwards over list of given type. + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +#endif /* _LIST_H */ diff --git a/udev/logging.h b/udev/logging.h new file mode 100644 index 0000000000..6e1d5a20ef --- /dev/null +++ b/udev/logging.h @@ -0,0 +1,73 @@ +/* + * simple logging functions that can be expanded into nothing + * + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef LOGGING_H +#define LOGGING_H + +#define err(format, arg...) do { } while (0) +#define info(format, arg...) do { } while (0) +#define dbg(format, arg...) do { } while (0) +#define logging_init(foo) do { } while (0) +#define logging_close(foo) do { } while (0) + +#ifdef USE_LOG +#include +#include +#include + +#undef err +#define err(format, arg...) \ + do { \ + log_message(LOG_ERR ,"%s: " format ,__FUNCTION__ ,## arg); \ + } while (0) + +#undef info +#define info(format, arg...) \ + do { \ + log_message(LOG_INFO ,"%s: " format ,__FUNCTION__ ,## arg); \ + } while (0) + +#ifdef DEBUG +#undef dbg +#define dbg(format, arg...) \ + do { \ + log_message(LOG_DEBUG ,"%s: " format ,__FUNCTION__ ,## arg); \ + } while (0) +#endif + +extern void log_message(int priority, const char *format, ...) + __attribute__ ((format (printf, 2, 3))); + +#undef logging_init +static inline void logging_init(const char *program_name) +{ + openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); +} + +#undef logging_close +static inline void logging_close(void) +{ + closelog(); +} + +#endif /* USE_LOG */ + +#endif diff --git a/udev/test-udev.c b/udev/test-udev.c new file mode 100644 index 0000000000..4ac2d5a889 --- /dev/null +++ b/udev/test-udev.c @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" +#include "udev_selinux.h" + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + + if (priority > udev_log_priority) + return; + + va_start(args, format); + vsyslog(priority, format, args); + va_end(args); +} +#endif + +static void asmlinkage sig_handler(int signum) +{ + switch (signum) { + case SIGALRM: + exit(1); + case SIGINT: + case SIGTERM: + exit(20 + signum); + } +} + +int main(int argc, char *argv[], char *envp[]) +{ + struct sysfs_device *dev; + struct udevice *udev; + const char *maj, *min; + struct udev_rules rules; + const char *action; + const char *devpath; + const char *subsystem; + struct sigaction act; + int devnull; + int retval = -EINVAL; + + if (argc == 2 && strcmp(argv[1], "-V") == 0) { + printf("%s\n", UDEV_VERSION); + exit(0); + } + + /* set std fd's to /dev/null, /sbin/hotplug forks us, we don't have them at all */ + devnull = open("/dev/null", O_RDWR); + if (devnull >= 0) { + if (devnull != STDIN_FILENO) + dup2(devnull, STDIN_FILENO); + if (devnull != STDOUT_FILENO) + dup2(devnull, STDOUT_FILENO); + if (devnull != STDERR_FILENO) + dup2(devnull, STDERR_FILENO); + if (devnull > STDERR_FILENO) + close(devnull); + } + + logging_init("udev"); + if (devnull < 0) + err("open /dev/null failed: %s\n", strerror(errno)); + udev_config_init(); + selinux_init(); + dbg("version %s\n", UDEV_VERSION); + + /* set signal handlers */ + memset(&act, 0x00, sizeof(act)); + act.sa_handler = (void (*)(int)) sig_handler; + sigemptyset (&act.sa_mask); + act.sa_flags = 0; + sigaction(SIGALRM, &act, NULL); + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + + /* trigger timeout to prevent hanging processes */ + alarm(UDEV_EVENT_TIMEOUT); + + action = getenv("ACTION"); + devpath = getenv("DEVPATH"); + subsystem = getenv("SUBSYSTEM"); + /* older kernels passed the SUBSYSTEM only as argument */ + if (subsystem == NULL && argc == 2) + subsystem = argv[1]; + + if (action == NULL || subsystem == NULL || devpath == NULL) { + err("action, subsystem or devpath missing\n"); + goto exit; + } + + /* export log_priority , as called programs may want to do the same as udev */ + if (udev_log_priority) { + char priority[32]; + + sprintf(priority, "%i", udev_log_priority); + setenv("UDEV_LOG", priority, 1); + } + + sysfs_init(); + udev_rules_init(&rules, 0); + + dev = sysfs_device_get(devpath); + if (dev == NULL) { + info("unable to open '%s'\n", devpath); + goto fail; + } + + udev = udev_device_init(NULL); + if (udev == NULL) + goto fail; + + /* override built-in sysfs device */ + udev->dev = dev; + strlcpy(udev->action, action, sizeof(udev->action)); + + /* get dev_t from environment, which is needed for "remove" to work, "add" works also from sysfs */ + maj = getenv("MAJOR"); + min = getenv("MINOR"); + if (maj != NULL && min != NULL) + udev->devt = makedev(atoi(maj), atoi(min)); + else + udev->devt = udev_device_get_devt(udev); + + retval = udev_device_event(&rules, udev); + + /* rules may change/disable the timeout */ + if (udev->event_timeout >= 0) + alarm(udev->event_timeout); + + if (retval == 0 && !udev->ignore_device && udev_run) + udev_rules_run(udev); + + udev_device_cleanup(udev); +fail: + udev_rules_cleanup(&rules); + sysfs_cleanup(); + selinux_exit(); + +exit: + logging_close(); + if (retval != 0) + return 1; + return 0; +} diff --git a/udev/udev.h b/udev/udev.h new file mode 100644 index 0000000000..5ecef4abbd --- /dev/null +++ b/udev/udev.h @@ -0,0 +1,184 @@ +/* + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef _UDEV_H_ +#define _UDEV_H_ + +#include +#include + +#include "list.h" +#include "logging.h" +#include "udev_sysdeps.h" +#include "udev_version.h" + +#define COMMENT_CHARACTER '#' +#define LINE_SIZE 512 +#define PATH_SIZE 512 +#define NAME_SIZE 256 +#define VALUE_SIZE 128 + +#define ALLOWED_CHARS "#+-.:=@_" +#define ALLOWED_CHARS_FILE ALLOWED_CHARS "/" +#define ALLOWED_CHARS_INPUT ALLOWED_CHARS_FILE " $%?," + +#define DEFAULT_PARTITIONS_COUNT 15 +#define UDEV_EVENT_TIMEOUT 180 + +#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) + +/* pipes */ +#define READ_END 0 +#define WRITE_END 1 + +#define UDEV_ROOT "/dev" +#define DB_DIR ".udev/db" +#define DB_NAME_INDEX_DIR ".udev/names" +#define RULES_LIB_DIR "/lib/udev/rules.d" +#define RULES_DYN_DIR ".udev/rules.d" +#define RULES_ETC_DIR "/etc/udev/rules.d" + +struct udev_rules; + +struct sysfs_device { + struct list_head node; /* for device cache */ + struct sysfs_device *parent; /* already cached parent*/ + char devpath[PATH_SIZE]; + char subsystem[NAME_SIZE]; /* $class, $bus, drivers, module */ + char kernel[NAME_SIZE]; /* device instance name */ + char kernel_number[NAME_SIZE]; + char driver[NAME_SIZE]; /* device driver name */ +}; + +struct udevice { + /* device event */ + struct sysfs_device *dev; /* points to dev_local by default */ + struct sysfs_device dev_local; + struct sysfs_device *dev_parent; /* current parent device used for matching */ + char action[NAME_SIZE]; + char *devpath_old; + + /* node */ + char name[PATH_SIZE]; + struct list_head symlink_list; + int symlink_final; + char owner[NAME_SIZE]; + int owner_final; + char group[NAME_SIZE]; + int group_final; + mode_t mode; + int mode_final; + dev_t devt; + + /* event processing */ + struct list_head run_list; + int run_final; + struct list_head env_list; + char tmp_node[PATH_SIZE]; + int partitions; + int ignore_device; + int ignore_remove; + char program_result[PATH_SIZE]; + int link_priority; + int event_timeout; + int test_run; +}; + +/* udev_config.c */ +extern char udev_root[PATH_SIZE]; +extern char udev_config_filename[PATH_SIZE]; +extern char udev_rules_dir[PATH_SIZE]; +extern int udev_log_priority; +extern int udev_run; +extern void udev_config_init(void); + +/* udev_device.c */ +extern struct udevice *udev_device_init(struct udevice *udev); +extern void udev_device_cleanup(struct udevice *udev); +extern int udev_device_event(struct udev_rules *rules, struct udevice *udev); +extern dev_t udev_device_get_devt(struct udevice *udev); + +/* udev_sysfs.c */ +extern char sysfs_path[PATH_SIZE]; +extern int sysfs_init(void); +extern void sysfs_cleanup(void); +extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, + const char *subsystem, const char *driver); +extern struct sysfs_device *sysfs_device_get(const char *devpath); +extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); +extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem); +extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); +extern int sysfs_resolve_link(char *path, size_t size); +extern int sysfs_lookup_devpath_by_subsys_id(char *devpath, size_t len, const char *subsystem, const char *id); + +/* udev_node.c */ +extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); +extern void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old); +extern int udev_node_add(struct udevice *udev); +extern int udev_node_remove(struct udevice *udev); + +/* udev_db.c */ +extern int udev_db_add_device(struct udevice *dev); +extern int udev_db_delete_device(struct udevice *dev); +extern int udev_db_rename(const char *devpath_old, const char *devpath); +extern int udev_db_get_device(struct udevice *udev, const char *devpath); +extern int udev_db_get_devices_by_name(const char *name, struct list_head *name_list); +extern int udev_db_get_all_entries(struct list_head *name_list); + +/* udev_utils.c */ +struct name_entry { + struct list_head node; + char name[PATH_SIZE]; + unsigned int ignore_error:1; +}; + +extern int log_priority(const char *priority); +extern struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort); +extern struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value); +extern int name_list_key_remove(struct list_head *name_list, const char *key); +extern void name_list_cleanup(struct list_head *name_list); +extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); +extern uid_t lookup_user(const char *user); +extern gid_t lookup_group(const char *group); + +/* udev_utils_string.c */ +extern int string_is_true(const char *str); +extern void remove_trailing_chars(char *path, char c); +extern size_t path_encode(char *s, size_t len); +extern size_t path_decode(char *s); +extern int utf8_encoded_valid_unichar(const char *str); +extern int replace_chars(char *str, const char *white); + +/* udev_utils_file.c */ +extern int create_path(const char *path); +extern int delete_path(const char *path); +extern int file_map(const char *filename, char **buf, size_t *bufsize); +extern void file_unmap(void *buf, size_t bufsize); +extern int unlink_secure(const char *filename); +extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); + +/* udev commands */ +extern int udevmonitor(int argc, char *argv[], char *envp[]); +extern int udevinfo(int argc, char *argv[], char *envp[]); +extern int udevcontrol(int argc, char *argv[], char *envp[]); +extern int udevtrigger(int argc, char *argv[], char *envp[]); +extern int udevsettle(int argc, char *argv[], char *envp[]); +extern int udevtest(int argc, char *argv[], char *envp[]); + +#endif diff --git a/udev/udev.xml b/udev/udev.xml new file mode 100644 index 0000000000..c740c0d807 --- /dev/null +++ b/udev/udev.xml @@ -0,0 +1,639 @@ + + + +
                    +
                    + udev + + + udev + August 2005 + udev + + + + udev + 7 + + + + + udev + dynamic device management + + + DESCRIPTION + udev provides a dynamic device directory containing only the files for + actually present devices. It creates or removes device node files in the + /dev directory, or it renames network interfaces. + + Usually udev runs as udevd + 8 and receives uevents directly from the + kernel if a device is added or removed from the system. + + If udev receives a device event, it matches its configured rules + against the available device attributes provided in sysfs to identify the device. + Rules that match may provide additional device information or specify a device + node name and multiple symlink names and instruct udev to run additional programs + as part of the device event handling. + + + CONFIGURATION + udev configuration files are placed in /etc/udev/ + and /lib/udev/. All empty lines, or lines beginning with + '#' will be ignored. + + Configuration file + udev expects its main configuration file at /etc/udev/udev.conf. + It consists of a set of variables allowing the user to override default udev values. + The following variables can be set: + + + + + Specifies where to place the device nodes in the filesystem. + The default value is /dev. + + + + + + + The logging priority. Valid values are the numerical syslog priorities + or their textual representations: , + and . + + + + + + Rules files + The udev rules are read from the files located in the + default rules directory /lib/udev/rules.d/, + the custom rules directory /etc/udev/rules.d/ + and the temporary rules directory /dev/.udev/rules.d/. + All rule files are sorted and processed in lexical order, regardless + in which of these directories they live. Every line in the rules file contains at least + one key value pair. There are two kind of keys, match and assignment keys. + If all match keys are matching against its value, the rule gets applied and the + assign keys get the specified value assigned. + + A matching rule may specify the name of the device node, add a symlink + pointing to the node, or run a specified program as part of the event handling. + If no matching rule is found, the default device node name is used. + + A rule may consist of a list of one or more key value pairs separated by + a comma. Each key has a distinct operation, depending on the used operator. Valid + operators are: + + + + + Compare for equality. + + + + + + + Compare for non-equality. + + + + + + + Assign a value to a key. Keys that represent a list, are reset + and only this single value is assigned. + + + + + + + Add the value to a key that holds a list of entries. + + + + + + + Assign a value to a key finally; disallow any later changes, + which may be used to prevent changes by any later rules. + + + + + The following key names can be used to match against device properties. + Some of the keys also match against properties of the parent devices in sysfs, + not only the device that has generated the event. If multiple keys that match + a parent device are specified in a single rule, all these keys must match at + one and the same parent device. + + + + + Match the name of the event action. + + + + + + + Match the devpath of the event device. + + + + + + + Match the name of the event device. + + + + + + + Match the name of the node or network interface. It can + be used once the NAME key has been set in one of the preceding + rules. + + + + + + + Match the subsystem of the event device. + + + + + + Match the driver name of the event device. Only set for devices + which are bound to a driver at the time the event is generated. + + + + + + Match sysfs attribute values of the event device. Up to five + keys can be specified per rule. Trailing + whitespace in the attribute values is ignored, if the specified match + value does not contain trailing whitespace itself. Depending on the type + of operator, this key is also used to set the value of a sysfs attribute. + + + + + + + + Search the devpath upwards for a matching device name. + + + + + + + Search the devpath upwards for a matching device subsystem name. + + + + + + + Search the devpath upwards for a matching device driver name. + + + + + + + Search the devpath upwards for a device with matching sysfs attribute values. + Up to five keys can be specified per rule, but all of them + must match on the same device. Trailing whitespace in the attribute values is ignored, + if the specified match value does not contain trailing whitespace itself. + + + + + + + Match against the value of an environment variable. Up to five + keys can be specified per rule. Depending on the type of operator, this key is also used + to export a variable to the environment. + + + + + + + Test the existence of a file. An octal mode mask can be specified + if needed. + + + + + + + Execute external program. The key is true, if the program returns + with exit code zero. The whole event environment is available to the + executed program. The program's output printed to stdout, is available in + the RESULT key. + + + + + + + Match the returned string of the last PROGRAM call. This key can + be used in the same or in any later rule after a PROGRAM call. + + + + + Most of the fields support a shell style pattern matching. The following + pattern characters are supported: + + + + + Matches zero, or any number of characters. + + + + + + Matches any single character. + + + + + + Matches any single character specified within the brackets. For + example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. + Ranges are also supported within this match with the '-' character. + For example, to match on the range of all digits, the pattern [0-9] would + be used. If the first character following the '[' is a '!', any characters + not enclosed are matched. + + + + + The following keys can get values assigned: + + + + + The name of the node to be created, or the name the network interface + should be renamed to. Only one rule can set the node name, all later rules with + a NAME key will be ignored. + + + + + + + The name of a symlink targeting the node. Every matching rule can add + this value to the list of symlinks to be created along with the device node. + Multiple symlinks may be specified by separating the names by the space + character. + + + + + + + The permissions for the device node. Every specified value overwrites + the compiled-in default value. + + + + + + + The value that should be written to a sysfs attribute of the + event device. Depending on the type of operator, this key is also + used to match against the value of a sysfs attribute. + + + + + + + Export a variable to the environment. Depending on the type of operator, + this key is also to match against an environment variable. + + + + + + + Add a program to the list of programs to be executed for a specific + device. This can only be used for very short running tasks. Running an + event process for a long period of time may block all further events for + this or a dependent device. Long running tasks need to be immediately + detached from the event process itself. + If the specifiefd string starts with + , all current event + values will be passed to the specified socket, as a message in the same + format the kernel sends an uevent. If the first character of the specified path + is an @ character, an abstract namespace socket is used, instead of an existing + socket file. + + + + + + + Named label where a GOTO can jump to. + + + + + + + Jumps to the next LABEL with a matching name + + + + + + + Import a set of variables into the event environment, + depending on type: + + + + + Execute an external program specified as the assigned value and + import its output, which must be in environment key format. + + + + + + Import a text file specified as the assigned value, which must be in + environment key format. + + + + + + Import the stored keys from the parent device by reading + the database entry of the parent device. The value assigned to + is used as a filter of key names + to import (with the same shell-style pattern matching used for + comparisons). + + + + If no option is given, udev will choose between + and based on the executable bit of the file + permissions. + + + + + + + Wait for a file to become available. + + + + + + + Rule and device options: + + + + + Stops further rules application. No later rules will have + any effect. + + + + + + Ignore this event completely. + + + + + + Do not remove the device node when the device goes away. This may be + useful as a workaround for broken device drivers. + + + + + + Specify the priority of the created symlinks. Devices with higher + priorities overwrite existing symlinks of other devices. The default is 0. + + + + + + Create the device nodes for all available partitions of a block device. + This may be useful for removable media devices where media changes are not + detected. + + + + + + Number of seconds an event will wait for operations to finish, before it + will terminate itself. + + + + + + Usually control and other possibly unsafe characters are replaced + in strings used for device naming. The mode of replacement can be specified + with this option. + + + + + + + + The , , , + , , and + fields support simple printf-like string substitutions. The + format chars gets applied after all rules have been processed, right before the program + is executed. It allows the use of the complete environment set by earlier matching + rules. For all other fields, substitutions are applied while the individual rule is + being processed. The available substitutions are: + + + , + + The kernel name for this device. + + + + + , + + The kernel number for this device. For example, 'sda3' has + kernel number of '3' + + + + + , + + The devpath of the device. + + + + + , + + The name of the device matched while searching the devpath upwards for + , , and . + + + + + + + + The driver name of the device matched while searching the devpath upwards for + , , and . + + + + + + , + + The value of a sysfs attribute found at the device, where + all keys of the rule have matched. If the matching device does not have + such an attribute, follow the chain of parent devices and use the value + of the first attribute that matches. + If the attribute is a symlink, the last element of the symlink target is + returned as the value. + + + + + , + + The value of an environment variable. + + + + + , + + The kernel major number for the device. + + + + + , + + The kernel minor number for the device. + + + + + , + + The string returned by the external program requested with PROGRAM. + A single part of the string, separated by a space character may be selected + by specifying the part number as an attribute: . + If the number is followed by the '+' char this part plus all remaining parts + of the result string are substituted: + + + + + , + + The node name of the parent device. + + + + + + + The current name of the device node. If not changed by a rule, it is the + name of the kernel device. + + + + + + + The current list of symlinks, separated by a space character. The value is + only set if an earlier rule assigned a value, or during a remove events. + + + + + , + + The udev_root value. + + + + + , + + The sysfs mount point. + + + + + , + + The name of a created temporary device node to provide access to + the device from a external program before the real node is created. + + + + + + + The '%' character itself. + + + + + + + The '$' character itself. + + + + The count of characters to be substituted may be limited by specifying + the format length value. For example, '%3s{file}' will only + insert the first three characters of the sysfs attribute + + + + AUTHOR + Written by Greg Kroah-Hartman greg@kroah.com and + Kay Sievers kay.sievers@vrfy.org. With much help from + Dan Stekloff and many others. + + + + SEE ALSO + + udevd8 + , + + udevadm8 + + + +
                    +
                    diff --git a/udev/udev_config.c b/udev/udev_config.c new file mode 100644 index 0000000000..55f0361dd2 --- /dev/null +++ b/udev/udev_config.c @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2005 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +/* global variables */ +char udev_root[PATH_SIZE]; +char udev_config_filename[PATH_SIZE]; +char udev_rules_dir[PATH_SIZE]; +int udev_log_priority; +int udev_run; + +static int get_key(char **line, char **key, char **value) +{ + char *linepos; + char *temp; + + linepos = *line; + if (!linepos) + return -1; + + /* skip whitespace */ + while (isspace(linepos[0])) + linepos++; + + /* get the key */ + *key = linepos; + while (1) { + linepos++; + if (linepos[0] == '\0') + return -1; + if (isspace(linepos[0])) + break; + if (linepos[0] == '=') + break; + } + + /* terminate key */ + linepos[0] = '\0'; + linepos++; + + /* skip whitespace */ + while (isspace(linepos[0])) + linepos++; + + /* get the value*/ + if (linepos[0] == '"') + linepos++; + else + return -1; + *value = linepos; + + temp = strchr(linepos, '"'); + if (!temp) + return -1; + temp[0] = '\0'; + + return 0; +} + +static int parse_config_file(void) +{ + char line[LINE_SIZE]; + char *bufline; + char *linepos; + char *variable; + char *value; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + int lineno; + int retval = 0; + + if (file_map(udev_config_filename, &buf, &bufsize) != 0) { + err("can't open '%s' as config file: %s\n", udev_config_filename, strerror(errno)); + return -ENODEV; + } + + /* loop through the whole file */ + lineno = 0; + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + lineno++; + + /* eat the whitespace */ + while ((count > 0) && isspace(bufline[0])) { + bufline++; + count--; + } + if (count == 0) + continue; + + /* see if this is a comment */ + if (bufline[0] == COMMENT_CHARACTER) + continue; + + if (count >= sizeof(line)) { + err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); + continue; + } + + memcpy(line, bufline, count); + line[count] = '\0'; + + linepos = line; + retval = get_key(&linepos, &variable, &value); + if (retval != 0) { + err("error parsing %s, line %d:%d\n", udev_config_filename, lineno, (int)(linepos-line)); + continue; + } + + if (strcasecmp(variable, "udev_root") == 0) { + strlcpy(udev_root, value, sizeof(udev_root)); + remove_trailing_chars(udev_root, '/'); + continue; + } + + if (strcasecmp(variable, "udev_rules") == 0) { + strlcpy(udev_rules_dir, value, sizeof(udev_rules_dir)); + remove_trailing_chars(udev_rules_dir, '/'); + continue; + } + + if (strcasecmp(variable, "udev_log") == 0) { + udev_log_priority = log_priority(value); + continue; + } + } + + file_unmap(buf, bufsize); + return retval; +} + +void udev_config_init(void) +{ + const char *env; + + strcpy(udev_config_filename, UDEV_CONFIG_FILE); + strcpy(udev_root, UDEV_ROOT); + udev_rules_dir[0] = '\0'; + udev_log_priority = LOG_ERR; + udev_run = 1; + + /* disable RUN key execution */ + env = getenv("UDEV_RUN"); + if (env && !string_is_true(env)) + udev_run = 0; + + env = getenv("UDEV_CONFIG_FILE"); + if (env) { + strlcpy(udev_config_filename, env, sizeof(udev_config_filename)); + remove_trailing_chars(udev_config_filename, '/'); + } + + parse_config_file(); + + env = getenv("UDEV_ROOT"); + if (env) { + strlcpy(udev_root, env, sizeof(udev_root)); + remove_trailing_chars(udev_root, '/'); + } + + env = getenv("UDEV_LOG"); + if (env) + udev_log_priority = log_priority(env); + + dbg("UDEV_CONFIG_FILE='%s'\n", udev_config_filename); + dbg("udev_root='%s'\n", udev_root); + dbg("udev_rules_dir='%s'\n", udev_rules_dir); + dbg("udev_log=%d\n", udev_log_priority); +} diff --git a/udev/udev_db.c b/udev/udev_db.c new file mode 100644 index 0000000000..3348c9a02c --- /dev/null +++ b/udev/udev_db.c @@ -0,0 +1,331 @@ +/* + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2004-2005 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_selinux.h" + + +static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len) +{ + size_t start; + + /* translate to location of db file */ + strlcpy(filename, udev_root, len); + start = strlcat(filename, "/"DB_DIR"/", len); + strlcat(filename, devpath, len); + return path_encode(&filename[start], len - start); +} + +/* reverse mapping from the device file name to the devpath */ +static int name_index(const char *devpath, const char *name, int add) +{ + char device[PATH_SIZE]; + char filename[PATH_SIZE * 2]; + size_t start; + int fd; + + /* directory with device name */ + strlcpy(filename, udev_root, sizeof(filename)); + start = strlcat(filename, "/"DB_NAME_INDEX_DIR"/", sizeof(filename)); + strlcat(filename, name, sizeof(filename)); + path_encode(&filename[start], sizeof(filename) - start); + /* entry with the devpath */ + strlcpy(device, devpath, sizeof(device)); + path_encode(device, sizeof(device)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, device, sizeof(filename)); + + if (add) { + info("creating index: '%s'\n", filename); + create_path(filename); + fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); + if (fd > 0) + close(fd); + } else { + info("removing index: '%s'\n", filename); + unlink(filename); + delete_path(filename); + } + return 0; +} + +int udev_db_get_devices_by_name(const char *name, struct list_head *name_list) +{ + char dirname[PATH_MAX]; + size_t start; + DIR *dir; + int rc = 0; + + strlcpy(dirname, udev_root, sizeof(dirname)); + start = strlcat(dirname, "/"DB_NAME_INDEX_DIR"/", sizeof(dirname)); + strlcat(dirname, name, sizeof(dirname)); + path_encode(&dirname[start], sizeof(dirname) - start); + + dir = opendir(dirname); + if (dir == NULL) { + info("no index directory '%s': %s\n", dirname, strerror(errno)); + rc = -1; + goto out; + } + + info("found index directory '%s'\n", dirname); + while (1) { + struct dirent *ent; + char device[PATH_SIZE]; + + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + if (ent->d_name[0] == '.') + continue; + + strlcpy(device, ent->d_name, sizeof(device)); + path_decode(device); + name_list_add(name_list, device, 0); + rc++; + } + closedir(dir); +out: + return rc; +} + +int udev_db_rename(const char *devpath_old, const char *devpath) +{ + char filename[PATH_SIZE]; + char filename_old[PATH_SIZE]; + + devpath_to_db_path(devpath_old, filename_old, sizeof(filename_old)); + devpath_to_db_path(devpath, filename, sizeof(filename)); + return rename(filename_old, filename); +} + +int udev_db_add_device(struct udevice *udev) +{ + char filename[PATH_SIZE]; + + if (udev->test_run) + return 0; + + devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); + create_path(filename); + unlink(filename); + + /* + * don't waste tmpfs memory pages, if we don't have any data to store + * create fake db-file; store the node-name in a symlink target + */ + if (list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && + !udev->partitions && !udev->ignore_remove) { + int ret; + dbg("nothing interesting to store, create symlink\n"); + selinux_setfscreatecon(filename, NULL, S_IFLNK); + ret = symlink(udev->name, filename); + selinux_resetfscreatecon(); + if (ret != 0) { + err("unable to create db link '%s': %s\n", filename, strerror(errno)); + return -1; + } + } else { + FILE *f; + struct name_entry *name_loop; + + f = fopen(filename, "w"); + if (f == NULL) { + err("unable to create db file '%s': %s\n", filename, strerror(errno)); + return -1; + } + dbg("storing data for device '%s' in '%s'\n", udev->dev->devpath, filename); + + fprintf(f, "N:%s\n", udev->name); + list_for_each_entry(name_loop, &udev->symlink_list, node) { + fprintf(f, "S:%s\n", name_loop->name); + /* add symlink-name to index */ + name_index(udev->dev->devpath, name_loop->name, 1); + } + fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); + if (udev->link_priority != 0) + fprintf(f, "L:%u\n", udev->link_priority); + if (udev->event_timeout >= 0) + fprintf(f, "T:%u\n", udev->event_timeout); + if (udev->partitions != 0) + fprintf(f, "A:%u\n", udev->partitions); + if (udev->ignore_remove) + fprintf(f, "R:%u\n", udev->ignore_remove); + list_for_each_entry(name_loop, &udev->env_list, node) + fprintf(f, "E:%s\n", name_loop->name); + fclose(f); + } + + /* add name to index */ + name_index(udev->dev->devpath, udev->name, 1); + + return 0; +} + +int udev_db_get_device(struct udevice *udev, const char *devpath) +{ + struct stat stats; + char filename[PATH_SIZE]; + char line[PATH_SIZE]; + unsigned int maj, min; + char *bufline; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + + sysfs_device_set_values(udev->dev, devpath, NULL, NULL); + devpath_to_db_path(devpath, filename, sizeof(filename)); + + if (lstat(filename, &stats) != 0) { + info("no db file to read %s: %s\n", filename, strerror(errno)); + return -1; + } + if ((stats.st_mode & S_IFMT) == S_IFLNK) { + char target[NAME_SIZE]; + int target_len; + + info("found a symlink as db file\n"); + target_len = readlink(filename, target, sizeof(target)); + if (target_len > 0) + target[target_len] = '\0'; + else { + info("error reading db link %s: %s\n", filename, strerror(errno)); + return -1; + } + dbg("db link points to '%s'\n", target); + strlcpy(udev->name, target, sizeof(udev->name)); + return 0; + } + + if (file_map(filename, &buf, &bufsize) != 0) { + info("error reading db file %s: %s\n", filename, strerror(errno)); + return -1; + } + + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + + if (count > sizeof(line)) + count = sizeof(line); + memcpy(line, &bufline[2], count-2); + line[count-2] = '\0'; + + switch(bufline[0]) { + case 'N': + strlcpy(udev->name, line, sizeof(udev->name)); + break; + case 'M': + sscanf(line, "%u:%u", &maj, &min); + udev->devt = makedev(maj, min); + break; + case 'S': + name_list_add(&udev->symlink_list, line, 0); + break; + case 'L': + udev->link_priority = atoi(line); + break; + case 'T': + udev->event_timeout = atoi(line); + break; + case 'A': + udev->partitions = atoi(line); + break; + case 'R': + udev->ignore_remove = atoi(line); + break; + case 'E': + name_list_add(&udev->env_list, line, 0); + break; + } + } + file_unmap(buf, bufsize); + + if (udev->name[0] == '\0') + return -1; + + return 0; +} + +int udev_db_delete_device(struct udevice *udev) +{ + char filename[PATH_SIZE]; + struct name_entry *name_loop; + + if (udev->test_run) + return 0; + + devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); + unlink(filename); + + name_index(udev->dev->devpath, udev->name, 0); + list_for_each_entry(name_loop, &udev->symlink_list, node) + name_index(udev->dev->devpath, name_loop->name, 0); + + return 0; +} + +int udev_db_get_all_entries(struct list_head *name_list) +{ + char dbpath[PATH_MAX]; + DIR *dir; + + strlcpy(dbpath, udev_root, sizeof(dbpath)); + strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); + dir = opendir(dbpath); + if (dir == NULL) { + info("no udev_db available '%s': %s\n", dbpath, strerror(errno)); + return -1; + } + + while (1) { + struct dirent *ent; + char device[PATH_SIZE]; + + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + if (ent->d_name[0] == '.') + continue; + + strlcpy(device, ent->d_name, sizeof(device)); + path_decode(device); + name_list_add(name_list, device, 1); + dbg("added '%s'\n", device); + } + + closedir(dir); + return 0; +} diff --git a/udev/udev_device.c b/udev/udev_device.c new file mode 100644 index 0000000000..cf21191ca0 --- /dev/null +++ b/udev/udev_device.c @@ -0,0 +1,305 @@ +/* + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" + + +struct udevice *udev_device_init(struct udevice *udev) +{ + if (udev == NULL) + udev = malloc(sizeof(struct udevice)); + if (udev == NULL) + return NULL; + memset(udev, 0x00, sizeof(struct udevice)); + + INIT_LIST_HEAD(&udev->symlink_list); + INIT_LIST_HEAD(&udev->run_list); + INIT_LIST_HEAD(&udev->env_list); + + /* set sysfs device to local storage, can be overridden if needed */ + udev->dev = &udev->dev_local; + + /* default node permissions */ + udev->mode = 0660; + strcpy(udev->owner, "root"); + strcpy(udev->group, "root"); + + udev->event_timeout = -1; + + return udev; +} + +void udev_device_cleanup(struct udevice *udev) +{ + name_list_cleanup(&udev->symlink_list); + name_list_cleanup(&udev->run_list); + name_list_cleanup(&udev->env_list); + free(udev); +} + +dev_t udev_device_get_devt(struct udevice *udev) +{ + const char *attr; + unsigned int maj, min; + + /* read it from sysfs */ + attr = sysfs_attr_get_value(udev->dev->devpath, "dev"); + if (attr != NULL) { + if (sscanf(attr, "%u:%u", &maj, &min) == 2) + return makedev(maj, min); + } + return makedev(0, 0); +} + +static void kernel_log(struct ifreq ifr) +{ + int klog; + FILE *f; + + klog = open("/dev/kmsg", O_WRONLY); + if (klog < 0) + return; + + f = fdopen(klog, "w"); + if (f == NULL) { + close(klog); + return; + } + + fprintf(f, "<6>udev: renamed network interface %s to %s\n", + ifr.ifr_name, ifr.ifr_newname); + fclose(f); +} + +static int rename_netif(struct udevice *udev) +{ + int sk; + struct ifreq ifr; + int retval; + + info("changing net interface name from '%s' to '%s'\n", udev->dev->kernel, udev->name); + if (udev->test_run) + return 0; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) { + err("error opening socket: %s\n", strerror(errno)); + return -1; + } + + memset(&ifr, 0x00, sizeof(struct ifreq)); + strlcpy(ifr.ifr_name, udev->dev->kernel, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval == 0) + kernel_log(ifr); + else { + int loop; + + /* see if the destination interface name already exists */ + if (errno != EEXIST) { + err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + goto exit; + } + + /* free our own name, another process may wait for us */ + strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ); + strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval != 0) { + err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + goto exit; + } + + /* wait 30 seconds for our target to become available */ + strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); + loop = 30 * 20; + while (loop--) { + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval == 0) { + kernel_log(ifr); + break; + } + + if (errno != EEXIST) { + err("error changing net interface name %s to %s: %s\n", + ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + break; + } + dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop); + usleep(1000 * 1000 / 20); + } + } + +exit: + close(sk); + return retval; +} + +int udev_device_event(struct udev_rules *rules, struct udevice *udev) +{ + int retval = 0; + + if (udev->devpath_old != NULL) + if (udev_db_rename(udev->devpath_old, udev->dev->devpath) == 0) + info("moved database from '%s' to '%s'\n", udev->devpath_old, udev->dev->devpath); + + /* add device node */ + if (major(udev->devt) != 0 && + (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "change") == 0)) { + struct udevice *udev_old; + + dbg("device node add '%s'\n", udev->dev->devpath); + + udev_rules_get_name(rules, udev); + if (udev->ignore_device) { + info("device event will be ignored\n"); + goto exit; + } + if (udev->name[0] == '\0') { + info("device node creation supressed\n"); + goto exit; + } + + /* read current database entry; cleanup, if it is known device */ + udev_old = udev_device_init(NULL); + if (udev_old != NULL) { + udev_old->test_run = udev->test_run; + if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { + info("device '%s' already in database, cleanup\n", udev->dev->devpath); + udev_db_delete_device(udev_old); + } else { + udev_device_cleanup(udev_old); + udev_old = NULL; + } + } + + /* create node */ + retval = udev_node_add(udev); + if (retval != 0) + goto exit; + + /* store in database */ + udev_db_add_device(udev); + + /* create, replace, delete symlinks according to priority */ + udev_node_update_symlinks(udev, udev_old); + + if (udev_old != NULL) + udev_device_cleanup(udev_old); + goto exit; + } + + /* add netif */ + if (strcmp(udev->dev->subsystem, "net") == 0 && strcmp(udev->action, "add") == 0) { + dbg("netif add '%s'\n", udev->dev->devpath); + udev_rules_get_name(rules, udev); + if (udev->ignore_device) { + info("device event will be ignored\n"); + goto exit; + } + if (udev->name[0] == '\0') { + info("device renaming supressed\n"); + goto exit; + } + + /* look if we want to change the name of the netif */ + if (strcmp(udev->name, udev->dev->kernel) != 0) { + char devpath[PATH_MAX]; + char *pos; + + retval = rename_netif(udev); + if (retval != 0) + goto exit; + info("renamed netif to '%s'\n", udev->name); + + /* export old name */ + setenv("INTERFACE_OLD", udev->dev->kernel, 1); + + /* now change the devpath, because the kernel device name has changed */ + strlcpy(devpath, udev->dev->devpath, sizeof(devpath)); + pos = strrchr(devpath, '/'); + if (pos != NULL) { + pos[1] = '\0'; + strlcat(devpath, udev->name, sizeof(devpath)); + sysfs_device_set_values(udev->dev, devpath, NULL, NULL); + setenv("DEVPATH", udev->dev->devpath, 1); + setenv("INTERFACE", udev->name, 1); + info("changed devpath to '%s'\n", udev->dev->devpath); + } + } + goto exit; + } + + /* remove device node */ + if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { + struct name_entry *name_loop; + + /* import database entry, and delete it */ + if (udev_db_get_device(udev, udev->dev->devpath) == 0) { + udev_db_delete_device(udev); + /* restore stored persistent data */ + list_for_each_entry(name_loop, &udev->env_list, node) + putenv(name_loop->name); + } else { + dbg("'%s' not found in database, using kernel name '%s'\n", + udev->dev->devpath, udev->dev->kernel); + strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); + } + + udev_rules_get_run(rules, udev); + if (udev->ignore_device) { + info("device event will be ignored\n"); + goto exit; + } + + if (udev->ignore_remove) { + info("ignore_remove for '%s'\n", udev->name); + goto exit; + } + /* remove the node */ + retval = udev_node_remove(udev); + + /* delete or restore symlinks according to priority */ + udev_node_update_symlinks(udev, NULL); + goto exit; + } + + /* default devices */ + udev_rules_get_run(rules, udev); + if (udev->ignore_device) + info("device event will be ignored\n"); + +exit: + return retval; +} diff --git a/udev/udev_node.c b/udev/udev_node.c new file mode 100644 index 0000000000..78b6747043 --- /dev/null +++ b/udev/udev_node.c @@ -0,0 +1,448 @@ +/* + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" +#include "udev_selinux.h" + +#define TMP_FILE_EXT ".udev-tmp" + +int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) +{ + char file_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; + struct stat stats; + int preserve = 0; + int err = 0; + + if (major(devt) != 0 && strcmp(udev->dev->subsystem, "block") == 0) + mode |= S_IFBLK; + else + mode |= S_IFCHR; + + if (lstat(file, &stats) == 0) { + if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devt)) { + info("preserve file '%s', because it has correct dev_t\n", file); + preserve = 1; + selinux_setfilecon(file, udev->dev->kernel, mode); + } else { + info("atomically replace existing file '%s'\n", file); + strlcpy(file_tmp, file, sizeof(file_tmp)); + strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); + unlink(file_tmp); + selinux_setfscreatecon(file_tmp, udev->dev->kernel, mode); + err = mknod(file_tmp, mode, devt); + selinux_resetfscreatecon(); + if (err != 0) { + err("mknod(%s, %#o, %u, %u) failed: %s\n", + file_tmp, mode, major(devt), minor(devt), strerror(errno)); + goto exit; + } + err = rename(file_tmp, file); + if (err != 0) { + err("rename(%s, %s) failed: %s\n", + file_tmp, file, strerror(errno)); + unlink(file_tmp); + } + } + } else { + info("mknod(%s, %#o, (%u,%u))\n", file, mode, major(devt), minor(devt)); + selinux_setfscreatecon(file, udev->dev->kernel, mode); + err = mknod(file, mode, devt); + selinux_resetfscreatecon(); + if (err != 0) { + err("mknod(%s, %#o, (%u,%u) failed: %s\n", + file, mode, major(devt), minor(devt), strerror(errno)); + goto exit; + } + } + + if (!preserve || stats.st_mode != mode) { + info("chmod(%s, %#o)\n", file, mode); + err = chmod(file, mode); + if (err != 0) { + err("chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); + goto exit; + } + } + + if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { + info("chown(%s, %u, %u)\n", file, uid, gid); + err = chown(file, uid, gid); + if (err != 0) { + err("chown(%s, %u, %u) failed: %s\n", file, uid, gid, strerror(errno)); + goto exit; + } + } +exit: + return err; +} + +static int node_symlink(const char *node, const char *slink) +{ + struct stat stats; + char target[PATH_SIZE] = ""; + char slink_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; + int i = 0; + int tail = 0; + int len; + int retval = 0; + + /* use relative link */ + while (node[i] && (node[i] == slink[i])) { + if (node[i] == '/') + tail = i+1; + i++; + } + while (slink[i] != '\0') { + if (slink[i] == '/') + strlcat(target, "../", sizeof(target)); + i++; + } + strlcat(target, &node[tail], sizeof(target)); + + /* preserve link with correct target, do not replace node of other device */ + if (lstat(slink, &stats) == 0) { + if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { + struct stat stats2; + + info("found existing node instead of symlink '%s'\n", slink); + if (lstat(node, &stats2) == 0) { + if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && + stats.st_rdev == stats2.st_rdev) { + info("replace device node '%s' with symlink to our node '%s'\n", slink, node); + } else { + err("device node '%s' already exists, link to '%s' will not overwrite it\n", slink, node); + goto exit; + } + } + } else if (S_ISLNK(stats.st_mode)) { + char buf[PATH_SIZE]; + + info("found existing symlink '%s'\n", slink); + len = readlink(slink, buf, sizeof(buf)); + if (len > 0) { + buf[len] = '\0'; + if (strcmp(target, buf) == 0) { + info("preserve already existing symlink '%s' to '%s'\n", slink, target); + selinux_setfilecon(slink, NULL, S_IFLNK); + goto exit; + } + } + } + } else { + info("creating symlink '%s' to '%s'\n", slink, target); + selinux_setfscreatecon(slink, NULL, S_IFLNK); + retval = symlink(target, slink); + selinux_resetfscreatecon(); + if (retval == 0) + goto exit; + } + + info("atomically replace '%s'\n", slink); + strlcpy(slink_tmp, slink, sizeof(slink_tmp)); + strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); + unlink(slink_tmp); + selinux_setfscreatecon(slink, NULL, S_IFLNK); + retval = symlink(target, slink_tmp); + selinux_resetfscreatecon(); + if (retval != 0) { + err("symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno)); + goto exit; + } + retval = rename(slink_tmp, slink); + if (retval != 0) { + err("rename(%s, %s) failed: %s\n", slink_tmp, slink, strerror(errno)); + unlink(slink_tmp); + goto exit; + } +exit: + return retval; +} + +static int update_link(struct udevice *udev, const char *name) +{ + LIST_HEAD(name_list); + char slink[PATH_SIZE]; + char node[PATH_SIZE]; + struct udevice *udev_db; + struct name_entry *device; + char target[PATH_MAX] = ""; + int count; + int priority = 0; + int rc = 0; + + strlcpy(slink, udev_root, sizeof(slink)); + strlcat(slink, "/", sizeof(slink)); + strlcat(slink, name, sizeof(slink)); + + count = udev_db_get_devices_by_name(name, &name_list); + info("found %i devices with name '%s'\n", count, name); + + /* if we don't have a reference, delete it */ + if (count <= 0) { + info("no reference left, remove '%s'\n", name); + if (!udev->test_run) { + unlink(slink); + delete_path(slink); + } + goto out; + } + + /* find the device with the highest priority */ + list_for_each_entry(device, &name_list, node) { + info("found '%s' for '%s'\n", device->name, name); + + /* did we find ourself? we win, if we have the same priority */ + if (strcmp(udev->dev->devpath, device->name) == 0) { + info("compare (our own) priority of '%s' %i >= %i\n", + udev->dev->devpath, udev->link_priority, priority); + if (strcmp(udev->name, name) == 0) { + info("'%s' is our device node, database inconsistent, skip link update\n", udev->name); + } else if (target[0] == '\0' || udev->link_priority >= priority) { + priority = udev->link_priority; + strlcpy(target, udev->name, sizeof(target)); + } + continue; + } + + /* another device, read priority from database */ + udev_db = udev_device_init(NULL); + if (udev_db == NULL) + continue; + if (udev_db_get_device(udev_db, device->name) == 0) { + if (strcmp(udev_db->name, name) == 0) { + info("'%s' is a device node of '%s', skip link update\n", udev_db->name, device->name); + } else { + info("compare priority of '%s' %i > %i\n", + udev_db->dev->devpath, udev_db->link_priority, priority); + if (target[0] == '\0' || udev_db->link_priority > priority) { + priority = udev_db->link_priority; + strlcpy(target, udev_db->name, sizeof(target)); + } + } + } + udev_device_cleanup(udev_db); + } + name_list_cleanup(&name_list); + + if (target[0] == '\0') { + info("no current target for '%s' found\n", name); + rc = 1; + goto out; + } + + /* create symlink to the target with the highest priority */ + strlcpy(node, udev_root, sizeof(node)); + strlcat(node, "/", sizeof(node)); + strlcat(node, target, sizeof(node)); + info("'%s' with target '%s' has the highest priority %i, create it\n", name, target, priority); + if (!udev->test_run) { + create_path(slink); + node_symlink(node, slink); + } +out: + return rc; +} + +void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) +{ + struct name_entry *name_loop; + char symlinks[PATH_SIZE] = ""; + + list_for_each_entry(name_loop, &udev->symlink_list, node) { + info("update symlink '%s' of '%s'\n", name_loop->name, udev->dev->devpath); + update_link(udev, name_loop->name); + strlcat(symlinks, udev_root, sizeof(symlinks)); + strlcat(symlinks, "/", sizeof(symlinks)); + strlcat(symlinks, name_loop->name, sizeof(symlinks)); + strlcat(symlinks, " ", sizeof(symlinks)); + } + + /* export symlinks to environment */ + remove_trailing_chars(symlinks, ' '); + if (symlinks[0] != '\0') + setenv("DEVLINKS", symlinks, 1); + + /* update possible left-over symlinks (device metadata changed) */ + if (udev_old != NULL) { + struct name_entry *link_loop; + struct name_entry *link_old_loop; + int found; + + /* remove current symlinks from old list */ + list_for_each_entry(link_old_loop, &udev_old->symlink_list, node) { + found = 0; + list_for_each_entry(link_loop, &udev->symlink_list, node) { + if (strcmp(link_old_loop->name, link_loop->name) == 0) { + found = 1; + break; + } + } + if (!found) { + /* link does no longer belong to this device */ + info("update old symlink '%s' no longer belonging to '%s'\n", + link_old_loop->name, udev->dev->devpath); + update_link(udev, link_old_loop->name); + } + } + + /* + * if the node name has changed, delete the node, + * or possibly restore a symlink of another device + */ + if (strcmp(udev->name, udev_old->name) != 0) + update_link(udev, udev_old->name); + } +} + +int udev_node_add(struct udevice *udev) +{ + char filename[PATH_SIZE]; + uid_t uid; + gid_t gid; + int i; + int retval = 0; + + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, udev->name, sizeof(filename)); + create_path(filename); + + if (strcmp(udev->owner, "root") == 0) + uid = 0; + else { + char *endptr; + unsigned long id; + + id = strtoul(udev->owner, &endptr, 10); + if (endptr[0] == '\0') + uid = (uid_t) id; + else + uid = lookup_user(udev->owner); + } + + if (strcmp(udev->group, "root") == 0) + gid = 0; + else { + char *endptr; + unsigned long id; + + id = strtoul(udev->group, &endptr, 10); + if (endptr[0] == '\0') + gid = (gid_t) id; + else + gid = lookup_group(udev->group); + } + + info("creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d\n", + filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid); + + if (!udev->test_run) + if (udev_node_mknod(udev, filename, udev->devt, udev->mode, uid, gid) != 0) { + retval = -1; + goto exit; + } + + setenv("DEVNAME", filename, 1); + + /* create all_partitions if requested */ + if (udev->partitions) { + char partitionname[PATH_SIZE]; + char *attr; + int range; + + /* take the maximum registered minor range */ + attr = sysfs_attr_get_value(udev->dev->devpath, "range"); + if (attr != NULL) { + range = atoi(attr); + if (range > 1) + udev->partitions = range-1; + } + info("creating device partition nodes '%s[1-%i]'\n", filename, udev->partitions); + if (!udev->test_run) { + for (i = 1; i <= udev->partitions; i++) { + dev_t part_devt; + + snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); + partitionname[sizeof(partitionname)-1] = '\0'; + part_devt = makedev(major(udev->devt), minor(udev->devt) + i); + udev_node_mknod(udev, partitionname, part_devt, udev->mode, uid, gid); + } + } + } +exit: + return retval; +} + +int udev_node_remove(struct udevice *udev) +{ + char filename[PATH_SIZE]; + char partitionname[PATH_SIZE]; + struct stat stats; + int retval = 0; + int num; + + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, udev->name, sizeof(filename)); + if (stat(filename, &stats) != 0) { + info("device node '%s' not found\n", filename); + return 0; + } + if (udev->devt && stats.st_rdev != udev->devt) { + info("device node '%s' points to a different device, skip removal\n", filename); + return -1; + } + + info("removing device node '%s'\n", filename); + if (!udev->test_run) + retval = unlink_secure(filename); + if (retval) + return retval; + + setenv("DEVNAME", filename, 1); + num = udev->partitions; + if (num > 0) { + int i; + + info("removing all_partitions '%s[1-%i]'\n", filename, num); + if (num > 255) + return -1; + for (i = 1; i <= num; i++) { + snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); + partitionname[sizeof(partitionname)-1] = '\0'; + if (!udev->test_run) + unlink_secure(partitionname); + } + } + delete_path(filename); + return retval; +} diff --git a/udev/udev_rules.c b/udev/udev_rules.c new file mode 100644 index 0000000000..ea850a84c3 --- /dev/null +++ b/udev/udev_rules.c @@ -0,0 +1,1618 @@ +/* + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" +#include "udev_selinux.h" + +extern char **environ; + +/* extract possible {attr} and move str behind it */ +static char *get_format_attribute(char **str) +{ + char *pos; + char *attr = NULL; + + if (*str[0] == '{') { + pos = strchr(*str, '}'); + if (pos == NULL) { + err("missing closing brace for format\n"); + return NULL; + } + pos[0] = '\0'; + attr = *str+1; + *str = pos+1; + dbg("attribute='%s', str='%s'\n", attr, *str); + } + return attr; +} + +/* extract possible format length and move str behind it*/ +static int get_format_len(char **str) +{ + int num; + char *tail; + + if (isdigit(*str[0])) { + num = (int) strtoul(*str, &tail, 10); + if (num > 0) { + *str = tail; + dbg("format length=%i\n", num); + return num; + } else { + err("format parsing error '%s'\n", *str); + } + } + return -1; +} + +static int get_key(char **line, char **key, char **value) +{ + char *linepos; + char *temp; + + linepos = *line; + if (linepos == NULL) + return -1; + + /* skip whitespace */ + while (isspace(linepos[0])) + linepos++; + + /* get the key */ + temp = strchr(linepos, '='); + if (temp == NULL || temp == linepos) + return -1; + temp[0] = '\0'; + *key = linepos; + linepos = &temp[1]; + + /* get a quoted value */ + if (linepos[0] == '"' || linepos[0] == '\'') { + temp = strchr(&linepos[1], linepos[0]); + if (temp != NULL) { + temp[0] = '\0'; + *value = &linepos[1]; + goto out; + } + } + + /* get the value*/ + temp = strchr(linepos, '\n'); + if (temp != NULL) + temp[0] = '\0'; + *value = linepos; +out: + return 0; +} + +static int run_program(const char *command, const char *subsystem, + char *result, size_t ressize, size_t *reslen) +{ + int status; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[PATH_SIZE]; + char program[PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; + int devnull; + int i; + int retval = 0; + + /* build argv from comand */ + strlcpy(arg, command, sizeof(arg)); + i = 0; + if (strchr(arg, ' ') != NULL) { + char *pos = arg; + + while (pos != NULL) { + if (pos[0] == '\'') { + /* don't separate if in apostrophes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos != NULL && pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg("arg[%i] '%s'\n", i, argv[i]); + i++; + } + argv[i] = NULL; + } else { + argv[0] = arg; + argv[1] = NULL; + } + info("'%s'\n", command); + + /* prepare pipes from child to parent */ + if (result != NULL || udev_log_priority >= LOG_INFO) { + if (pipe(outpipe) != 0) { + err("pipe failed: %s\n", strerror(errno)); + return -1; + } + } + if (udev_log_priority >= LOG_INFO) { + if (pipe(errpipe) != 0) { + err("pipe failed: %s\n", strerror(errno)); + return -1; + } + } + + /* allow programs in /lib/udev called without the path */ + if (strchr(argv[0], '/') == NULL) { + strlcpy(program, "/lib/udev/", sizeof(program)); + strlcat(program, argv[0], sizeof(program)); + argv[0] = program; + } + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent ends of pipes */ + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* discard child output or connect to pipe */ + devnull = open("/dev/null", O_RDWR); + if (devnull > 0) { + dup2(devnull, STDIN_FILENO); + if (outpipe[WRITE_END] < 0) + dup2(devnull, STDOUT_FILENO); + if (errpipe[WRITE_END] < 0) + dup2(devnull, STDERR_FILENO); + close(devnull); + } else + err("open /dev/null failed: %s\n", strerror(errno)); + if (outpipe[WRITE_END] > 0) { + dup2(outpipe[WRITE_END], STDOUT_FILENO); + close(outpipe[WRITE_END]); + } + if (errpipe[WRITE_END] > 0) { + dup2(errpipe[WRITE_END], STDERR_FILENO); + close(errpipe[WRITE_END]); + } + execv(argv[0], argv); + if (errno == ENOENT || errno == ENOTDIR) { + /* may be on a filesytem which is not mounted right now */ + info("program '%s' not found\n", argv[0]); + } else { + /* other problems */ + err("exec of program '%s' failed\n", argv[0]); + } + _exit(1); + case -1: + err("fork of '%s' failed: %s\n", argv[0], strerror(errno)); + return -1; + default: + /* read from child if requested */ + if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + ssize_t count; + size_t respos = 0; + + /* parent closes child ends of pipes */ + if (outpipe[WRITE_END] > 0) + close(outpipe[WRITE_END]); + if (errpipe[WRITE_END] > 0) + close(errpipe[WRITE_END]); + + /* read child output */ + while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + int fdcount; + fd_set readfds; + + FD_ZERO(&readfds); + if (outpipe[READ_END] > 0) + FD_SET(outpipe[READ_END], &readfds); + if (errpipe[READ_END] > 0) + FD_SET(errpipe[READ_END], &readfds); + fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno == EINTR) + continue; + retval = -1; + break; + } + + /* get stdout */ + if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { + char inbuf[1024]; + char *pos; + char *line; + + count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); + if (count <= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + if (count < 0) { + err("stdin read failed: %s\n", strerror(errno)); + retval = -1; + } + continue; + } + inbuf[count] = '\0'; + + /* store result for rule processing */ + if (result) { + if (respos + count < ressize) { + memcpy(&result[respos], inbuf, count); + respos += count; + } else { + err("ressize %ld too short\n", (long)ressize); + retval = -1; + } + } + pos = inbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info("'%s' (stdout) '%s'\n", argv[0], line); + } + + /* get stderr */ + if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { + char errbuf[1024]; + char *pos; + char *line; + + count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); + if (count <= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + if (count < 0) + err("stderr read failed: %s\n", strerror(errno)); + continue; + } + errbuf[count] = '\0'; + pos = errbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info("'%s' (stderr) '%s'\n", argv[0], line); + } + } + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* return the childs stdout string */ + if (result) { + result[respos] = '\0'; + dbg("result='%s'\n", result); + if (reslen) + *reslen = respos; + } + } + waitpid(pid, &status, 0); + if (WIFEXITED(status)) { + info("'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + retval = -1; + } else { + err("'%s' abnormal exit\n", argv[0]); + retval = -1; + } + } + + return retval; +} + +static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bufsize) +{ + char line[LINE_SIZE]; + const char *bufline; + char *linepos; + char *variable; + char *value; + size_t cur; + size_t count; + int lineno; + + /* loop through the whole buffer */ + lineno = 0; + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + lineno++; + + /* eat the whitespace */ + while ((count > 0) && isspace(bufline[0])) { + bufline++; + count--; + } + if (count == 0) + continue; + + /* see if this is a comment */ + if (bufline[0] == COMMENT_CHARACTER) + continue; + + if (count >= sizeof(line)) { + err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); + continue; + } + + memcpy(line, bufline, count); + line[count] = '\0'; + + linepos = line; + if (get_key(&linepos, &variable, &value) == 0) { + dbg("import '%s=%s'\n", variable, value); + + /* handle device, renamed by external tool, returning new path */ + if (strcmp(variable, "DEVPATH") == 0) { + info("updating devpath from '%s' to '%s'\n", udev->dev->devpath, value); + sysfs_device_set_values(udev->dev, value, NULL, NULL); + } else + name_list_key_add(&udev->env_list, variable, value); + setenv(variable, value, 1); + } + } + + return 0; +} + +static int import_file_into_env(struct udevice *udev, const char *filename) +{ + char *buf; + size_t bufsize; + + if (file_map(filename, &buf, &bufsize) != 0) { + err("can't open '%s': %s\n", filename, strerror(errno)); + return -1; + } + import_keys_into_env(udev, buf, bufsize); + file_unmap(buf, bufsize); + + return 0; +} + +static int import_program_into_env(struct udevice *udev, const char *program) +{ + char result[2048]; + size_t reslen; + + if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen) != 0) + return -1; + return import_keys_into_env(udev, result, reslen); +} + +static int import_parent_into_env(struct udevice *udev, const char *filter) +{ + struct sysfs_device *dev_parent; + int rc = -1; + + dev_parent = sysfs_device_get_parent(udev->dev); + if (dev_parent != NULL) { + struct udevice *udev_parent; + struct name_entry *name_loop; + + dbg("found parent '%s', get the node name\n", dev_parent->devpath); + udev_parent = udev_device_init(NULL); + if (udev_parent == NULL) + return -1; + /* import the udev_db of the parent */ + if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { + dbg("import stored parent env '%s'\n", udev_parent->name); + list_for_each_entry(name_loop, &udev_parent->env_list, node) { + char name[NAME_SIZE]; + char *pos; + + strlcpy(name, name_loop->name, sizeof(name)); + pos = strchr(name, '='); + if (pos) { + pos[0] = '\0'; + pos++; + if (fnmatch(filter, name, 0) == 0) { + dbg("import key '%s'\n", name_loop->name); + name_list_add(&udev->env_list, name_loop->name, 0); + setenv(name, pos, 1); + } else + dbg("skip key '%s'\n", name_loop->name); + } + } + rc = 0; + } else + dbg("parent not found in database\n"); + udev_device_cleanup(udev_parent); + } + + return rc; +} + +static int pass_env_to_socket(const char *sockpath, const char *devpath, const char *action) +{ + int sock; + struct sockaddr_un saddr; + socklen_t saddrlen; + struct stat stats; + char buf[2048]; + size_t bufpos = 0; + int i; + ssize_t count; + int retval = 0; + + dbg("pass environment to socket '%s'\n", sockpath); + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + if (sockpath[0] == '@') { + /* abstract namespace socket requested */ + strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { + /* existing socket file */ + strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); + saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); + } else { + /* no socket file, assume abstract namespace socket */ + strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } + + bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); + bufpos++; + for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)-1); i++) { + bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); + bufpos++; + } + if (bufpos > sizeof(buf)) + bufpos = sizeof(buf); + + count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); + if (count < 0) + retval = -1; + info("passed %zi bytes to socket '%s', \n", count, sockpath); + + close(sock); + return retval; +} + +int udev_rules_run(struct udevice *udev) +{ + struct name_entry *name_loop; + int retval = 0; + + dbg("executing run list\n"); + list_for_each_entry(name_loop, &udev->run_list, node) { + if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) { + pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, udev->action); + } else { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); + if (run_program(program, udev->dev->subsystem, NULL, 0, NULL) != 0) + if (!name_loop->ignore_error) + retval = -1; + } + } + + return retval; +} + +#define WAIT_LOOP_PER_SECOND 50 +static int wait_for_file(struct udevice *udev, const char *file, int timeout) +{ + char filepath[PATH_SIZE]; + char devicepath[PATH_SIZE] = ""; + struct stat stats; + int loop = timeout * WAIT_LOOP_PER_SECOND; + + /* a relative path is a device attribute */ + if (file[0] != '/') { + strlcpy(devicepath, sysfs_path, sizeof(devicepath)); + strlcat(devicepath, udev->dev->devpath, sizeof(devicepath)); + + strlcpy(filepath, devicepath, sizeof(filepath)); + strlcat(filepath, "/", sizeof(filepath)); + strlcat(filepath, file, sizeof(filepath)); + file = filepath; + } + + dbg("will wait %i sec for '%s'\n", timeout, file); + while (--loop) { + /* lookup file */ + if (stat(file, &stats) == 0) { + info("file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + return 0; + } + /* make sure, the device did not disappear in the meantime */ + if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { + info("device disappeared while waiting for '%s'\n", file); + return -2; + } + info("wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + info("waiting for '%s' failed\n", file); + return -1; +} + +/* handle "[$SUBSYSTEM/$KERNEL]" lookup */ +static int attr_get_by_subsys_id(const char *attrstr, char *devpath, size_t len, char **attr) +{ + char subsys[NAME_SIZE]; + char *attrib; + char *id; + int found = 0; + + if (attrstr[0] != '[') + goto out; + + strlcpy(subsys, &attrstr[1], sizeof(subsys)); + + attrib = strchr(subsys, ']'); + if (attrib == NULL) + goto out; + attrib[0] = '\0'; + attrib = &attrib[1]; + + id = strchr(subsys, '/'); + if (id == NULL) + goto out; + id[0] = '\0'; + id = &id[1]; + + if (sysfs_lookup_devpath_by_subsys_id(devpath, len, subsys, id)) { + if (attr != NULL) { + if (attrib[0] != '\0') + *attr = attrib; + else + *attr = NULL; + } + found = 1; + } +out: + return found; +} + +static int attr_subst_subdir(char *attr, size_t len) +{ + char *pos; + int found = 0; + + pos = strstr(attr, "/*/"); + if (pos != NULL) { + char str[PATH_SIZE]; + DIR *dir; + + pos[1] = '\0'; + strlcpy(str, &pos[2], sizeof(str)); + dir = opendir(attr); + if (dir != NULL) { + struct dirent *dent; + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + strlcat(attr, dent->d_name, len); + strlcat(attr, str, len); + if (stat(attr, &stats) == 0) { + found = 1; + break; + } + pos[1] = '\0'; + } + closedir(dir); + } + if (!found) + strlcat(attr, str, len); + } + + return found; +} + +void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) +{ + char temp[PATH_SIZE]; + char temp2[PATH_SIZE]; + char *head, *tail, *pos, *cpos, *attr, *rest; + int len; + int i; + int count; + enum subst_type { + SUBST_UNKNOWN, + SUBST_DEVPATH, + SUBST_KERNEL, + SUBST_KERNEL_NUMBER, + SUBST_ID, + SUBST_DRIVER, + SUBST_MAJOR, + SUBST_MINOR, + SUBST_RESULT, + SUBST_ATTR, + SUBST_PARENT, + SUBST_TEMP_NODE, + SUBST_NAME, + SUBST_LINKS, + SUBST_ROOT, + SUBST_SYS, + SUBST_ENV, + }; + static const struct subst_map { + char *name; + char fmt; + enum subst_type type; + } map[] = { + { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, + { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, + { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, + { .name = "id", .fmt = 'b', .type = SUBST_ID }, + { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, + { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, + { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, + { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, + { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, + { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, + { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, + { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, + { .name = "name", .fmt = 'D', .type = SUBST_NAME }, + { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, + { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, + { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, + { .name = "env", .fmt = 'E', .type = SUBST_ENV }, + { NULL, '\0', 0 } + }; + enum subst_type type; + const struct subst_map *subst; + + head = string; + while (1) { + len = -1; + while (head[0] != '\0') { + if (head[0] == '$') { + /* substitute named variable */ + if (head[1] == '\0') + break; + if (head[1] == '$') { + strlcpy(temp, head+2, sizeof(temp)); + strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + for (subst = map; subst->name; subst++) { + if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { + type = subst->type; + tail = head + strlen(subst->name)+1; + dbg("will substitute format name '%s'\n", subst->name); + goto found; + } + } + head[0] = '$'; + err("unknown format variable '%s'\n", head); + } else if (head[0] == '%') { + /* substitute format char */ + if (head[1] == '\0') + break; + if (head[1] == '%') { + strlcpy(temp, head+2, sizeof(temp)); + strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + tail = head+1; + len = get_format_len(&tail); + for (subst = map; subst->name; subst++) { + if (tail[0] == subst->fmt) { + type = subst->type; + tail++; + dbg("will substitute format char '%c'\n", subst->fmt); + goto found; + } + } + head[0] = '%'; + err("unknown format char '%c'\n", tail[0]); + } + head++; + } + break; +found: + attr = get_format_attribute(&tail); + strlcpy(temp, tail, sizeof(temp)); + dbg("format=%i, string='%s', tail='%s'\n", type ,string, tail); + + switch (type) { + case SUBST_DEVPATH: + strlcat(string, udev->dev->devpath, maxsize); + dbg("substitute devpath '%s'\n", udev->dev->devpath); + break; + case SUBST_KERNEL: + strlcat(string, udev->dev->kernel, maxsize); + dbg("substitute kernel name '%s'\n", udev->dev->kernel); + break; + case SUBST_KERNEL_NUMBER: + strlcat(string, udev->dev->kernel_number, maxsize); + dbg("substitute kernel number '%s'\n", udev->dev->kernel_number); + break; + case SUBST_ID: + if (udev->dev_parent != NULL) { + strlcat(string, udev->dev_parent->kernel, maxsize); + dbg("substitute id '%s'\n", udev->dev_parent->kernel); + } + break; + case SUBST_DRIVER: + if (udev->dev_parent != NULL) { + strlcat(string, udev->dev_parent->driver, maxsize); + dbg("substitute driver '%s'\n", udev->dev_parent->driver); + } + break; + case SUBST_MAJOR: + sprintf(temp2, "%d", major(udev->devt)); + strlcat(string, temp2, maxsize); + dbg("substitute major number '%s'\n", temp2); + break; + case SUBST_MINOR: + sprintf(temp2, "%d", minor(udev->devt)); + strlcat(string, temp2, maxsize); + dbg("substitute minor number '%s'\n", temp2); + break; + case SUBST_RESULT: + if (udev->program_result[0] == '\0') + break; + /* get part part of the result string */ + i = 0; + if (attr != NULL) + i = strtoul(attr, &rest, 10); + if (i > 0) { + dbg("request part #%d of result string\n", i); + cpos = udev->program_result; + while (--i) { + while (cpos[0] != '\0' && !isspace(cpos[0])) + cpos++; + while (isspace(cpos[0])) + cpos++; + } + if (i > 0) { + err("requested part of result string not found\n"); + break; + } + strlcpy(temp2, cpos, sizeof(temp2)); + /* %{2+}c copies the whole string from the second part on */ + if (rest[0] != '+') { + cpos = strchr(temp2, ' '); + if (cpos) + cpos[0] = '\0'; + } + strlcat(string, temp2, maxsize); + dbg("substitute part of result string '%s'\n", temp2); + } else { + strlcat(string, udev->program_result, maxsize); + dbg("substitute result string '%s'\n", udev->program_result); + } + break; + case SUBST_ATTR: + if (attr == NULL) + err("missing file parameter for attr\n"); + else { + char devpath[PATH_SIZE]; + char *attrib; + const char *value = NULL; + size_t size; + + if (attr_get_by_subsys_id(attr, devpath, sizeof(devpath), &attrib)) { + if (attrib != NULL) + value = sysfs_attr_get_value(devpath, attrib); + else + break; + } + + /* try the current device, other matches may have selected */ + if (value == NULL && udev->dev_parent != NULL && udev->dev_parent != udev->dev) + value = sysfs_attr_get_value(udev->dev_parent->devpath, attr); + + /* look at all devices along the chain of parents */ + if (value == NULL) { + struct sysfs_device *dev_parent = udev->dev; + + do { + dbg("looking at '%s'\n", dev_parent->devpath); + value = sysfs_attr_get_value(dev_parent->devpath, attr); + if (value != NULL) { + strlcpy(temp2, value, sizeof(temp2)); + break; + } + dev_parent = sysfs_device_get_parent(dev_parent); + } while (dev_parent != NULL); + } + + if (value == NULL) + break; + + /* strip trailing whitespace, and replace unwanted characters */ + size = strlcpy(temp2, value, sizeof(temp2)); + if (size >= sizeof(temp2)) + size = sizeof(temp2)-1; + while (size > 0 && isspace(temp2[size-1])) + temp2[--size] = '\0'; + count = replace_chars(temp2, ALLOWED_CHARS_INPUT); + if (count > 0) + info("%i character(s) replaced\n" , count); + strlcat(string, temp2, maxsize); + dbg("substitute sysfs value '%s'\n", temp2); + } + break; + case SUBST_PARENT: + { + struct sysfs_device *dev_parent; + + dev_parent = sysfs_device_get_parent(udev->dev); + if (dev_parent != NULL) { + struct udevice *udev_parent; + + dbg("found parent '%s', get the node name\n", dev_parent->devpath); + udev_parent = udev_device_init(NULL); + if (udev_parent != NULL) { + /* lookup the name in the udev_db with the DEVPATH of the parent */ + if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { + strlcat(string, udev_parent->name, maxsize); + dbg("substitute parent node name'%s'\n", udev_parent->name); + } else + dbg("parent not found in database\n"); + udev_device_cleanup(udev_parent); + } + } + } + break; + case SUBST_TEMP_NODE: + if (udev->tmp_node[0] == '\0' && major(udev->devt) > 0) { + dbg("create temporary device node for callout\n"); + snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", + udev_root, major(udev->devt), minor(udev->devt)); + udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0'; + udev_node_mknod(udev, udev->tmp_node, udev->devt, 0600, 0, 0); + } + strlcat(string, udev->tmp_node, maxsize); + dbg("substitute temporary device node name '%s'\n", udev->tmp_node); + break; + case SUBST_NAME: + if (udev->name[0] == '\0') { + strlcat(string, udev->dev->kernel, maxsize); + dbg("substitute udev->kernel '%s'\n", udev->name); + } else { + strlcat(string, udev->name, maxsize); + dbg("substitute udev->name '%s'\n", udev->name); + } + break; + case SUBST_LINKS: + if (!list_empty(&udev->symlink_list)) { + struct name_entry *name_loop; + char symlinks[PATH_SIZE] = ""; + + list_for_each_entry(name_loop, &udev->symlink_list, node) { + strlcat(symlinks, name_loop->name, sizeof(symlinks)); + strlcat(symlinks, " ", sizeof(symlinks)); + } + remove_trailing_chars(symlinks, ' '); + strlcat(string, symlinks, maxsize); + } + break; + case SUBST_ROOT: + strlcat(string, udev_root, maxsize); + dbg("substitute udev_root '%s'\n", udev_root); + break; + case SUBST_SYS: + strlcat(string, sysfs_path, maxsize); + dbg("substitute sysfs_path '%s'\n", sysfs_path); + break; + case SUBST_ENV: + if (attr == NULL) { + dbg("missing attribute\n"); + break; + } + pos = getenv(attr); + if (pos == NULL) { + dbg("env '%s' not available\n", attr); + break; + } + dbg("substitute env '%s=%s'\n", attr, pos); + strlcat(string, pos, maxsize); + break; + default: + err("unknown substitution type=%i\n", type); + break; + } + /* possibly truncate to format-char specified length */ + if (len >= 0 && len < (int)strlen(head)) { + head[len] = '\0'; + dbg("truncate to %i chars, subtitution string becomes '%s'\n", len, head); + } + strlcat(string, temp, maxsize); + } +} + +static char *key_val(struct udev_rule *rule, struct key *key) +{ + return rule->buf + key->val_off; +} + +static char *key_pair_name(struct udev_rule *rule, struct key_pair *pair) +{ + return rule->buf + pair->key_name_off; +} + +static int match_key(const char *key_name, struct udev_rule *rule, struct key *key, const char *val) +{ + char value[PATH_SIZE]; + char *key_value; + char *pos; + int match = 0; + + if (key->operation != KEY_OP_MATCH && + key->operation != KEY_OP_NOMATCH) + return 0; + + /* look for a matching string, parts are separated by '|' */ + strlcpy(value, rule->buf + key->val_off, sizeof(value)); + key_value = value; + dbg("key %s value='%s'\n", key_name, key_value); + while (key_value) { + pos = strchr(key_value, '|'); + if (pos) { + pos[0] = '\0'; + pos++; + } + + dbg("match %s '%s' <-> '%s'\n", key_name, key_value, val); + match = (fnmatch(key_value, val, 0) == 0); + if (match) + break; + + key_value = pos; + } + + if (match && (key->operation == KEY_OP_MATCH)) { + dbg("%s is true (matching value)\n", key_name); + return 0; + } + if (!match && (key->operation == KEY_OP_NOMATCH)) { + dbg("%s is true (non-matching value)\n", key_name); + return 0; + } + return -1; +} + +/* match a single rule against a given device and possibly its parent devices */ +static int match_rule(struct udevice *udev, struct udev_rule *rule) +{ + int i; + + if (match_key("ACTION", rule, &rule->action, udev->action)) + goto nomatch; + + if (match_key("KERNEL", rule, &rule->kernel, udev->dev->kernel)) + goto nomatch; + + if (match_key("SUBSYSTEM", rule, &rule->subsystem, udev->dev->subsystem)) + goto nomatch; + + if (match_key("DEVPATH", rule, &rule->devpath, udev->dev->devpath)) + goto nomatch; + + if (match_key("DRIVER", rule, &rule->driver, udev->dev->driver)) + goto nomatch; + + /* match NAME against a value assigned by an earlier rule */ + if (match_key("NAME", rule, &rule->name, udev->name)) + goto nomatch; + + /* match against current list of symlinks */ + if (rule->symlink_match.operation == KEY_OP_MATCH || + rule->symlink_match.operation == KEY_OP_NOMATCH) { + struct name_entry *name_loop; + int match = 0; + + list_for_each_entry(name_loop, &udev->symlink_list, node) { + if (match_key("SYMLINK", rule, &rule->symlink_match, name_loop->name) == 0) { + match = 1; + break; + } + } + if (!match) + goto nomatch; + } + + for (i = 0; i < rule->env.count; i++) { + struct key_pair *pair = &rule->env.keys[i]; + + /* we only check for matches, assignments will be handled later */ + if (pair->key.operation == KEY_OP_MATCH || + pair->key.operation == KEY_OP_NOMATCH) { + const char *key_name = key_pair_name(rule, pair); + const char *value = getenv(key_name); + + if (!value) { + dbg("ENV{'%s'} is not set, treat as empty\n", key_name); + value = ""; + } + if (match_key("ENV", rule, &pair->key, value)) + goto nomatch; + } + } + + if (rule->test.operation == KEY_OP_MATCH || + rule->test.operation == KEY_OP_NOMATCH) { + char filename[PATH_SIZE]; + char devpath[PATH_SIZE]; + char *attr; + struct stat statbuf; + int match; + + strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); + udev_rules_apply_format(udev, filename, sizeof(filename)); + + if (attr_get_by_subsys_id(filename, devpath, sizeof(devpath), &attr)) { + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, devpath, sizeof(filename)); + if (attr != NULL) { + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, attr, sizeof(filename)); + } + } else if (filename[0] != '/') { + char tmp[PATH_SIZE]; + + strlcpy(tmp, sysfs_path, sizeof(tmp)); + strlcat(tmp, udev->dev->devpath, sizeof(tmp)); + strlcat(tmp, "/", sizeof(tmp)); + strlcat(tmp, filename, sizeof(tmp)); + strlcpy(filename, tmp, sizeof(filename)); + } + + attr_subst_subdir(filename, sizeof(filename)); + + match = (stat(filename, &statbuf) == 0); + info("'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + if (match && rule->test_mode_mask > 0) { + match = ((statbuf.st_mode & rule->test_mode_mask) > 0); + info("'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + match ? "matches" : "does not match", + rule->test_mode_mask); + } + if (match && rule->test.operation == KEY_OP_NOMATCH) + goto nomatch; + if (!match && rule->test.operation == KEY_OP_MATCH) + goto nomatch; + dbg("TEST key is true\n"); + } + + if (rule->wait_for.operation != KEY_OP_UNSET) { + char filename[PATH_SIZE]; + int found; + + strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); + udev_rules_apply_format(udev, filename, sizeof(filename)); + found = (wait_for_file(udev, filename, 10) == 0); + if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) + goto nomatch; + } + + /* check for matching sysfs attribute pairs */ + for (i = 0; i < rule->attr.count; i++) { + struct key_pair *pair = &rule->attr.keys[i]; + + if (pair->key.operation == KEY_OP_MATCH || + pair->key.operation == KEY_OP_NOMATCH) { + const char *key_name = key_pair_name(rule, pair); + const char *key_value = key_val(rule, &pair->key); + char devpath[PATH_SIZE]; + char *attrib; + const char *value = NULL; + char val[VALUE_SIZE]; + size_t len; + + if (attr_get_by_subsys_id(key_name, devpath, sizeof(devpath), &attrib)) { + if (attrib != NULL) + value = sysfs_attr_get_value(devpath, attrib); + else + goto nomatch; + } + if (value == NULL) + value = sysfs_attr_get_value(udev->dev->devpath, key_name); + if (value == NULL) + goto nomatch; + strlcpy(val, value, sizeof(val)); + + /* strip trailing whitespace of value, if not asked to match for it */ + len = strlen(key_value); + if (len > 0 && !isspace(key_value[len-1])) { + len = strlen(val); + while (len > 0 && isspace(val[len-1])) + val[--len] = '\0'; + dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); + } + + if (match_key("ATTR", rule, &pair->key, val)) + goto nomatch; + } + } + + /* walk up the chain of parent devices and find a match */ + udev->dev_parent = udev->dev; + while (1) { + /* check for matching kernel device name */ + if (match_key("KERNELS", rule, &rule->kernels, udev->dev_parent->kernel)) + goto try_parent; + + /* check for matching subsystem value */ + if (match_key("SUBSYSTEMS", rule, &rule->subsystems, udev->dev_parent->subsystem)) + goto try_parent; + + /* check for matching driver */ + if (match_key("DRIVERS", rule, &rule->drivers, udev->dev_parent->driver)) + goto try_parent; + + /* check for matching sysfs attribute pairs */ + for (i = 0; i < rule->attrs.count; i++) { + struct key_pair *pair = &rule->attrs.keys[i]; + + if (pair->key.operation == KEY_OP_MATCH || + pair->key.operation == KEY_OP_NOMATCH) { + const char *key_name = key_pair_name(rule, pair); + const char *key_value = key_val(rule, &pair->key); + const char *value; + char val[VALUE_SIZE]; + size_t len; + + value = sysfs_attr_get_value(udev->dev_parent->devpath, key_name); + if (value == NULL) + value = sysfs_attr_get_value(udev->dev->devpath, key_name); + if (value == NULL) + goto try_parent; + strlcpy(val, value, sizeof(val)); + + /* strip trailing whitespace of value, if not asked to match for it */ + len = strlen(key_value); + if (len > 0 && !isspace(key_value[len-1])) { + len = strlen(val); + while (len > 0 && isspace(val[len-1])) + val[--len] = '\0'; + dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); + } + + if (match_key("ATTRS", rule, &pair->key, val)) + goto try_parent; + } + } + + /* found matching device */ + break; +try_parent: + /* move to parent device */ + dbg("try parent sysfs device\n"); + udev->dev_parent = sysfs_device_get_parent(udev->dev_parent); + if (udev->dev_parent == NULL) + goto nomatch; + dbg("looking at dev_parent->devpath='%s'\n", udev->dev_parent->devpath); + dbg("looking at dev_parent->kernel='%s'\n", udev->dev_parent->kernel); + } + + /* execute external program */ + if (rule->program.operation != KEY_OP_UNSET) { + char program[PATH_SIZE]; + char result[PATH_SIZE]; + + strlcpy(program, key_val(rule, &rule->program), sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); + if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL) != 0) { + dbg("PROGRAM is false\n"); + udev->program_result[0] = '\0'; + if (rule->program.operation != KEY_OP_NOMATCH) + goto nomatch; + } else { + int count; + + dbg("PROGRAM matches\n"); + remove_trailing_chars(result, '\n'); + if (rule->string_escape == ESCAPE_UNSET || + rule->string_escape == ESCAPE_REPLACE) { + count = replace_chars(result, ALLOWED_CHARS_INPUT); + if (count > 0) + info("%i character(s) replaced\n" , count); + } + dbg("result is '%s'\n", result); + strlcpy(udev->program_result, result, sizeof(udev->program_result)); + dbg("PROGRAM returned successful\n"); + if (rule->program.operation == KEY_OP_NOMATCH) + goto nomatch; + } + dbg("PROGRAM key is true\n"); + } + + /* check for matching result of external program */ + if (match_key("RESULT", rule, &rule->result, udev->program_result)) + goto nomatch; + + /* import variables returned from program or or file into environment */ + if (rule->import.operation != KEY_OP_UNSET) { + char import[PATH_SIZE]; + int rc = -1; + + strlcpy(import, key_val(rule, &rule->import), sizeof(import)); + udev_rules_apply_format(udev, import, sizeof(import)); + dbg("check for IMPORT import='%s'\n", import); + if (rule->import_type == IMPORT_PROGRAM) { + rc = import_program_into_env(udev, import); + } else if (rule->import_type == IMPORT_FILE) { + dbg("import file import='%s'\n", import); + rc = import_file_into_env(udev, import); + } else if (rule->import_type == IMPORT_PARENT) { + dbg("import parent import='%s'\n", import); + rc = import_parent_into_env(udev, import); + } + if (rc != 0) { + dbg("IMPORT failed\n"); + if (rule->import.operation != KEY_OP_NOMATCH) + goto nomatch; + } else + dbg("IMPORT '%s' imported\n", key_val(rule, &rule->import)); + dbg("IMPORT key is true\n"); + } + + /* rule matches, if we have ENV assignments export it */ + for (i = 0; i < rule->env.count; i++) { + struct key_pair *pair = &rule->env.keys[i]; + + if (pair->key.operation == KEY_OP_ASSIGN) { + char temp_value[NAME_SIZE]; + const char *key_name = key_pair_name(rule, pair); + const char *value = key_val(rule, &pair->key); + + /* make sure we don't write to the same string we possibly read from */ + strlcpy(temp_value, value, sizeof(temp_value)); + udev_rules_apply_format(udev, temp_value, NAME_SIZE); + + if (temp_value[0] == '\0') { + name_list_key_remove(&udev->env_list, key_name); + unsetenv(key_name); + info("unset ENV '%s'\n", key_name); + } else { + struct name_entry *entry; + + entry = name_list_key_add(&udev->env_list, key_name, temp_value); + if (entry == NULL) + break; + putenv(entry->name); + info("set ENV '%s'\n", entry->name); + } + } + } + + /* if we have ATTR assignments, write value to sysfs file */ + for (i = 0; i < rule->attr.count; i++) { + struct key_pair *pair = &rule->attr.keys[i]; + + if (pair->key.operation == KEY_OP_ASSIGN) { + const char *key_name = key_pair_name(rule, pair); + char devpath[PATH_SIZE]; + char *attrib; + char attr[PATH_SIZE] = ""; + char value[NAME_SIZE]; + FILE *f; + + if (attr_get_by_subsys_id(key_name, devpath, sizeof(devpath), &attrib)) { + if (attrib != NULL) { + strlcpy(attr, sysfs_path, sizeof(attr)); + strlcat(attr, devpath, sizeof(attr)); + strlcat(attr, "/", sizeof(attr)); + strlcat(attr, attrib, sizeof(attr)); + } + } + + if (attr[0] == '\0') { + strlcpy(attr, sysfs_path, sizeof(attr)); + strlcat(attr, udev->dev->devpath, sizeof(attr)); + strlcat(attr, "/", sizeof(attr)); + strlcat(attr, key_name, sizeof(attr)); + } + + attr_subst_subdir(attr, sizeof(attr)); + + strlcpy(value, key_val(rule, &pair->key), sizeof(value)); + udev_rules_apply_format(udev, value, sizeof(value)); + info("writing '%s' to sysfs file '%s'\n", value, attr); + f = fopen(attr, "w"); + if (f != NULL) { + if (!udev->test_run) + if (fprintf(f, "%s", value) <= 0) + err("error writing ATTR{%s}: %s\n", attr, strerror(errno)); + fclose(f); + } else + err("error opening ATTR{%s} for writing: %s\n", attr, strerror(errno)); + } + } + return 0; + +nomatch: + return -1; +} + +int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) +{ + struct udev_rule *rule; + int name_set = 0; + + dbg("udev->dev->devpath='%s'\n", udev->dev->devpath); + dbg("udev->dev->kernel='%s'\n", udev->dev->kernel); + + /* look for a matching rule to apply */ + udev_rules_iter_init(rules); + while (1) { + rule = udev_rules_iter_next(rules); + if (rule == NULL) + break; + + if (name_set && + (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD)) { + dbg("node name already set, rule ignored\n"); + continue; + } + + dbg("process rule\n"); + if (match_rule(udev, rule) == 0) { + /* apply options */ + if (rule->ignore_device) { + info("rule applied, '%s' is ignored\n", udev->dev->kernel); + udev->ignore_device = 1; + return 0; + } + if (rule->ignore_remove) { + udev->ignore_remove = 1; + dbg("remove event should be ignored\n"); + } + if (rule->link_priority != 0) { + udev->link_priority = rule->link_priority; + info("link_priority=%i\n", udev->link_priority); + } + if (rule->event_timeout >= 0) { + udev->event_timeout = rule->event_timeout; + info("event_timeout=%i\n", udev->event_timeout); + } + /* apply all_partitions option only at a main block device */ + if (rule->partitions && + strcmp(udev->dev->subsystem, "block") == 0 && udev->dev->kernel_number[0] == '\0') { + udev->partitions = rule->partitions; + dbg("creation of partition nodes requested\n"); + } + + /* apply permissions */ + if (!udev->mode_final && rule->mode.operation != KEY_OP_UNSET) { + if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) + udev->mode_final = 1; + char buf[20]; + strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); + udev_rules_apply_format(udev, buf, sizeof(buf)); + udev->mode = strtol(buf, NULL, 8); + dbg("applied mode=%#o to '%s'\n", udev->mode, udev->dev->kernel); + } + if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { + if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) + udev->owner_final = 1; + strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner)); + udev_rules_apply_format(udev, udev->owner, sizeof(udev->owner)); + dbg("applied owner='%s' to '%s'\n", udev->owner, udev->dev->kernel); + } + if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) { + if (rule->group.operation == KEY_OP_ASSIGN_FINAL) + udev->group_final = 1; + strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); + udev_rules_apply_format(udev, udev->group, sizeof(udev->group)); + dbg("applied group='%s' to '%s'\n", udev->group, udev->dev->kernel); + } + + /* collect symlinks */ + if (!udev->symlink_final && + (rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL || + rule->symlink.operation == KEY_OP_ADD)) { + char temp[PATH_SIZE]; + char *pos, *next; + int count; + + if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) + udev->symlink_final = 1; + if (rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { + info("reset symlink list\n"); + name_list_cleanup(&udev->symlink_list); + } + /* allow multiple symlinks separated by spaces */ + strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); + udev_rules_apply_format(udev, temp, sizeof(temp)); + if (rule->string_escape == ESCAPE_UNSET || + rule->string_escape == ESCAPE_REPLACE) { + count = replace_chars(temp, ALLOWED_CHARS_FILE " "); + if (count > 0) + info("%i character(s) replaced\n" , count); + } + dbg("rule applied, added symlink(s) '%s'\n", temp); + pos = temp; + while (isspace(pos[0])) + pos++; + next = strchr(pos, ' '); + while (next) { + next[0] = '\0'; + info("add symlink '%s'\n", pos); + name_list_add(&udev->symlink_list, pos, 0); + while (isspace(next[1])) + next++; + pos = &next[1]; + next = strchr(pos, ' '); + } + if (pos[0] != '\0') { + info("add symlink '%s'\n", pos); + name_list_add(&udev->symlink_list, pos, 0); + } + } + + /* set name, later rules with name set will be ignored */ + if (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD) { + int count; + + name_set = 1; + strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); + udev_rules_apply_format(udev, udev->name, sizeof(udev->name)); + if (rule->string_escape == ESCAPE_UNSET || + rule->string_escape == ESCAPE_REPLACE) { + count = replace_chars(udev->name, ALLOWED_CHARS_FILE); + if (count > 0) + info("%i character(s) replaced\n", count); + } + + info("rule applied, '%s' becomes '%s'\n", udev->dev->kernel, udev->name); + if (strcmp(udev->dev->subsystem, "net") != 0) + dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i\n", + udev->name, udev->owner, udev->group, udev->mode, udev->partitions); + } + + if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { + struct name_entry *entry; + + if (rule->run.operation == KEY_OP_ASSIGN_FINAL) + udev->run_final = 1; + if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { + info("reset run list\n"); + name_list_cleanup(&udev->run_list); + } + dbg("add run '%s'\n", key_val(rule, &rule->run)); + entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); + if (rule->run_ignore_error) + entry->ignore_error = 1; + } + + if (rule->last_rule) { + dbg("last rule to be applied\n"); + break; + } + + if (rule->goto_label.operation != KEY_OP_UNSET) { + dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); + udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); + } + } + } + + if (!name_set) { + info("no node name set, will use kernel name '%s'\n", udev->dev->kernel); + strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); + } + + if (udev->tmp_node[0] != '\0') { + dbg("removing temporary device node\n"); + unlink_secure(udev->tmp_node); + udev->tmp_node[0] = '\0'; + } + + return 0; +} + +int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) +{ + struct udev_rule *rule; + + dbg("udev->kernel='%s'\n", udev->dev->kernel); + + /* look for a matching rule to apply */ + udev_rules_iter_init(rules); + while (1) { + rule = udev_rules_iter_next(rules); + if (rule == NULL) + break; + + dbg("process rule\n"); + if (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD || + rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL || + rule->symlink.operation == KEY_OP_ADD || + rule->mode.operation != KEY_OP_UNSET || + rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { + dbg("skip rule that names a device\n"); + continue; + } + + if (match_rule(udev, rule) == 0) { + if (rule->ignore_device) { + info("rule applied, '%s' is ignored\n", udev->dev->kernel); + udev->ignore_device = 1; + return 0; + } + if (rule->ignore_remove) { + udev->ignore_remove = 1; + dbg("remove event should be ignored\n"); + } + + if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { + struct name_entry *entry; + + if (rule->run.operation == KEY_OP_ASSIGN || + rule->run.operation == KEY_OP_ASSIGN_FINAL) { + info("reset run list\n"); + name_list_cleanup(&udev->run_list); + } + dbg("add run '%s'\n", key_val(rule, &rule->run)); + entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); + if (rule->run_ignore_error) + entry->ignore_error = 1; + if (rule->run.operation == KEY_OP_ASSIGN_FINAL) + break; + } + + if (rule->last_rule) { + dbg("last rule to be applied\n"); + break; + } + + if (rule->goto_label.operation != KEY_OP_UNSET) { + dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); + udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); + } + } + } + + return 0; +} diff --git a/udev/udev_rules.h b/udev/udev_rules.h new file mode 100644 index 0000000000..fe0f9dfbb5 --- /dev/null +++ b/udev/udev_rules.h @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef UDEV_RULES_H +#define UDEV_RULES_H + +#include "udev.h" +#include "list.h" + +#define PAIRS_MAX 5 +#define RULESFILE_SUFFIX ".rules" + +enum key_operation { + KEY_OP_UNSET, + KEY_OP_MATCH, + KEY_OP_NOMATCH, + KEY_OP_ADD, + KEY_OP_ASSIGN, + KEY_OP_ASSIGN_FINAL, +}; + +struct key { + enum key_operation operation; + size_t val_off; +}; + +struct key_pair { + struct key key; + size_t key_name_off; +}; + +struct key_pairs { + int count; + struct key_pair keys[PAIRS_MAX]; +}; + +enum import_type { + IMPORT_UNSET, + IMPORT_PROGRAM, + IMPORT_FILE, + IMPORT_PARENT, +}; + +enum escape_type { + ESCAPE_UNSET, + ESCAPE_NONE, + ESCAPE_REPLACE, +}; + +struct udev_rule { + struct key action; + struct key devpath; + struct key kernel; + struct key subsystem; + struct key driver; + struct key_pairs attr; + + struct key kernels; + struct key subsystems; + struct key drivers; + struct key_pairs attrs; + + struct key_pairs env; + struct key program; + struct key result; + struct key import; + enum import_type import_type; + struct key test; + mode_t test_mode_mask; + struct key run; + struct key wait_for; + struct key label; + struct key goto_label; + + struct key name; + struct key symlink; + struct key symlink_match; + struct key owner; + struct key group; + struct key mode; + enum escape_type string_escape; + + unsigned int link_priority; + int event_timeout; + unsigned int partitions; + unsigned int last_rule:1, + run_ignore_error:1, + ignore_device:1, + ignore_remove:1; + + size_t bufsize; + char buf[]; +}; + +struct udev_rules { + char *buf; + size_t bufsize; + size_t current; + int resolve_names; +}; + +extern int udev_rules_init(struct udev_rules *rules, int resolve_names); +extern void udev_rules_cleanup(struct udev_rules *rules); + +extern void udev_rules_iter_init(struct udev_rules *rules); +extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); +extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label); + +extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev); +extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev); +extern int udev_rules_run(struct udevice *udev); + +extern void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize); + +#endif diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c new file mode 100644 index 0000000000..3ada8b1c7d --- /dev/null +++ b/udev/udev_rules_parse.c @@ -0,0 +1,804 @@ +/* + * Copyright (C) 2003,2004 Greg Kroah-Hartman + * Copyright (C) 2003-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" +#include "udev_selinux.h" + + +void udev_rules_iter_init(struct udev_rules *rules) +{ + dbg("bufsize=%zi\n", rules->bufsize); + rules->current = 0; +} + +struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) +{ + static struct udev_rule *rule; + + if (!rules) + return NULL; + + dbg("current=%zi\n", rules->current); + if (rules->current >= rules->bufsize) { + dbg("no more rules\n"); + return NULL; + } + + /* get next rule */ + rule = (struct udev_rule *) (rules->buf + rules->current); + rules->current += sizeof(struct udev_rule) + rule->bufsize; + + return rule; +} + +struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label) +{ + static struct udev_rule *rule; + size_t start = rules->current; + +next: + dbg("current=%zi\n", rules->current); + if (rules->current >= rules->bufsize) { + err("LABEL='%s' not found, GOTO will be ignored\n", label); + rules->current = start; + return NULL; + } + rule = (struct udev_rule *) (rules->buf + rules->current); + + if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { + dbg("moving forward, looking for label '%s'\n", label); + rules->current += sizeof(struct udev_rule) + rule->bufsize; + goto next; + } + + dbg("found label '%s'\n", label); + return rule; +} + +static int get_key(char **line, char **key, enum key_operation *operation, char **value) +{ + char *linepos; + char *temp; + + linepos = *line; + if (linepos == NULL && linepos[0] == '\0') + return -1; + + /* skip whitespace */ + while (isspace(linepos[0]) || linepos[0] == ',') + linepos++; + + /* get the key */ + if (linepos[0] == '\0') + return -1; + *key = linepos; + + while (1) { + linepos++; + if (linepos[0] == '\0') + return -1; + if (isspace(linepos[0])) + break; + if (linepos[0] == '=') + break; + if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) + if (linepos[1] == '=') + break; + } + + /* remember end of key */ + temp = linepos; + + /* skip whitespace after key */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get operation type */ + if (linepos[0] == '=' && linepos[1] == '=') { + *operation = KEY_OP_MATCH; + linepos += 2; + dbg("operator=match\n"); + } else if (linepos[0] == '!' && linepos[1] == '=') { + *operation = KEY_OP_NOMATCH; + linepos += 2; + dbg("operator=nomatch\n"); + } else if (linepos[0] == '+' && linepos[1] == '=') { + *operation = KEY_OP_ADD; + linepos += 2; + dbg("operator=add\n"); + } else if (linepos[0] == '=') { + *operation = KEY_OP_ASSIGN; + linepos++; + dbg("operator=assign\n"); + } else if (linepos[0] == ':' && linepos[1] == '=') { + *operation = KEY_OP_ASSIGN_FINAL; + linepos += 2; + dbg("operator=assign_final\n"); + } else + return -1; + + /* terminate key */ + temp[0] = '\0'; + dbg("key='%s'\n", *key); + + /* skip whitespace after operator */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get the value*/ + if (linepos[0] == '"') + linepos++; + else + return -1; + *value = linepos; + + temp = strchr(linepos, '"'); + if (!temp) + return -1; + temp[0] = '\0'; + temp++; + dbg("value='%s'\n", *value); + + /* move line to next key */ + *line = temp; + + return 0; +} + +/* extract possible KEY{attr} */ +static char *get_key_attribute(char *str) +{ + char *pos; + char *attr; + + attr = strchr(str, '{'); + if (attr != NULL) { + attr++; + pos = strchr(attr, '}'); + if (pos == NULL) { + err("missing closing brace for format\n"); + return NULL; + } + pos[0] = '\0'; + dbg("attribute='%s'\n", attr); + return attr; + } + + return NULL; +} + +static int add_rule_key(struct udev_rule *rule, struct key *key, + enum key_operation operation, const char *value) +{ + size_t val_len = strnlen(value, PATH_SIZE); + + key->operation = operation; + + key->val_off = rule->bufsize; + strlcpy(rule->buf + rule->bufsize, value, val_len+1); + rule->bufsize += val_len+1; + + return 0; +} + +static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs, + enum key_operation operation, const char *key, const char *value) +{ + size_t key_len = strnlen(key, PATH_SIZE); + + if (pairs->count >= PAIRS_MAX) { + err("skip, too many keys of the same type in a single rule\n"); + return -1; + } + + add_rule_key(rule, &pairs->keys[pairs->count].key, operation, value); + + /* add the key-name of the pair */ + pairs->keys[pairs->count].key_name_off = rule->bufsize; + strlcpy(rule->buf + rule->bufsize, key, key_len+1); + rule->bufsize += key_len+1; + + pairs->count++; + + return 0; +} + +static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) +{ + char buf[sizeof(struct udev_rule) + LINE_SIZE]; + struct udev_rule *rule; + size_t rule_size; + int valid; + char *linepos; + char *attr; + size_t padding; + int physdev = 0; + int retval; + + memset(buf, 0x00, sizeof(buf)); + rule = (struct udev_rule *) buf; + rule->event_timeout = -1; + linepos = line; + valid = 0; + + /* get all the keys */ + while (1) { + char *key; + char *value; + enum key_operation operation = KEY_OP_UNSET; + + retval = get_key(&linepos, &key, &operation, &value); + if (retval) + break; + + if (strcasecmp(key, "ACTION") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid ACTION operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->action, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "DEVPATH") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid DEVPATH operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->devpath, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "KERNEL") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid KERNEL operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->kernel, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "SUBSYSTEM") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid SUBSYSTEM operation\n"); + goto invalid; + } + /* bus, class, subsystem events should all be the same */ + if (strcmp(value, "subsystem") == 0 || + strcmp(value, "bus") == 0 || + strcmp(value, "class") == 0) { + if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) + err("'%s' must be specified as 'subsystem' \n" + "please fix it in %s:%u", value, filename, lineno); + add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); + } else + add_rule_key(rule, &rule->subsystem, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "DRIVER") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid DRIVER operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->driver, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { + attr = get_key_attribute(key + sizeof("ATTR")-1); + if (attr == NULL) { + err("error parsing ATTR attribute\n"); + goto invalid; + } + if (add_rule_key_pair(rule, &rule->attr, operation, attr, value) != 0) + goto invalid; + valid = 1; + continue; + } + + if (strcasecmp(key, "KERNELS") == 0 || + strcasecmp(key, "ID") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid KERNELS operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->kernels, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "SUBSYSTEMS") == 0 || + strcasecmp(key, "BUS") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid SUBSYSTEMS operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->subsystems, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "DRIVERS") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid DRIVERS operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->drivers, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || + strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid ATTRS operation\n"); + goto invalid; + } + attr = get_key_attribute(key + sizeof("ATTRS")-1); + if (attr == NULL) { + err("error parsing ATTRS attribute\n"); + goto invalid; + } + if (strncmp(attr, "device/", 7) == 0) + err("the 'device' link is deprecated and will be removed from a future kernel, \n" + "please fix it in %s:%u", filename, lineno); + else if (strstr(attr, "../") != NULL) + err("do not reference parent sysfs directories directly, that may break with a future kernel, \n" + "please fix it in %s:%u", filename, lineno); + if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0) + goto invalid; + valid = 1; + continue; + } + + if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { + attr = get_key_attribute(key + sizeof("ENV")-1); + if (attr == NULL) { + err("error parsing ENV attribute\n"); + goto invalid; + } + if (strncmp(attr, "PHYSDEV", 7) == 0) + physdev = 1; + if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0) + goto invalid; + valid = 1; + continue; + } + + if (strcasecmp(key, "PROGRAM") == 0) { + add_rule_key(rule, &rule->program, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "RESULT") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid RESULT operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->result, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { + attr = get_key_attribute(key + sizeof("IMPORT")-1); + if (attr != NULL && strstr(attr, "program")) { + dbg("IMPORT will be executed\n"); + rule->import_type = IMPORT_PROGRAM; + } else if (attr != NULL && strstr(attr, "file")) { + dbg("IMPORT will be included as file\n"); + rule->import_type = IMPORT_FILE; + } else if (attr != NULL && strstr(attr, "parent")) { + dbg("IMPORT will include the parent values\n"); + rule->import_type = IMPORT_PARENT; + } else { + /* figure it out if it is executable */ + char file[PATH_SIZE]; + char *pos; + struct stat statbuf; + + strlcpy(file, value, sizeof(file)); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + + /* allow programs in /lib/udev called without the path */ + if (strchr(file, '/') == NULL) { + strlcpy(file, "/lib/udev/", sizeof(file)); + strlcat(file, value, sizeof(file)); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + } + + dbg("IMPORT auto mode for '%s'\n", file); + if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { + dbg("IMPORT is executable, will be executed (autotype)\n"); + rule->import_type = IMPORT_PROGRAM; + } else { + dbg("IMPORT is not executable, will be included as file (autotype)\n"); + rule->import_type = IMPORT_FILE; + } + } + add_rule_key(rule, &rule->import, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err("invalid TEST operation\n"); + goto invalid; + } + attr = get_key_attribute(key + sizeof("TEST")-1); + if (attr != NULL) + rule->test_mode_mask = strtol(attr, NULL, 8); + add_rule_key(rule, &rule->test, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { + attr = get_key_attribute(key + sizeof("RUN")-1); + if (attr != NULL) { + if (strstr(attr, "ignore_error")) + rule->run_ignore_error = 1; + } + add_rule_key(rule, &rule->run, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { + add_rule_key(rule, &rule->wait_for, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "LABEL") == 0) { + add_rule_key(rule, &rule->label, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "GOTO") == 0) { + add_rule_key(rule, &rule->goto_label, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { + attr = get_key_attribute(key + sizeof("NAME")-1); + if (attr != NULL) { + if (strstr(attr, "all_partitions") != NULL) { + dbg("creation of partition nodes requested\n"); + rule->partitions = DEFAULT_PARTITIONS_COUNT; + } + if (strstr(attr, "ignore_remove") != NULL) { + dbg("remove event should be ignored\n"); + rule->ignore_remove = 1; + } + } + if (value[0] == '\0') + dbg("name empty, node creation supressed\n"); + add_rule_key(rule, &rule->name, operation, value); + continue; + } + + if (strcasecmp(key, "SYMLINK") == 0) { + if (operation == KEY_OP_MATCH || + operation == KEY_OP_NOMATCH) + add_rule_key(rule, &rule->symlink_match, operation, value); + else + add_rule_key(rule, &rule->symlink, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "OWNER") == 0) { + valid = 1; + if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { + char *endptr; + strtoul(value, &endptr, 10); + if (endptr[0] != '\0') { + char owner[32]; + uid_t uid = lookup_user(value); + dbg("replacing username='%s' by id=%i\n", value, uid); + sprintf(owner, "%u", (unsigned int) uid); + add_rule_key(rule, &rule->owner, operation, owner); + continue; + } + } + + add_rule_key(rule, &rule->owner, operation, value); + continue; + } + + if (strcasecmp(key, "GROUP") == 0) { + valid = 1; + if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { + char *endptr; + strtoul(value, &endptr, 10); + if (endptr[0] != '\0') { + char group[32]; + gid_t gid = lookup_group(value); + dbg("replacing groupname='%s' by id=%i\n", value, gid); + sprintf(group, "%u", (unsigned int) gid); + add_rule_key(rule, &rule->group, operation, group); + continue; + } + } + + add_rule_key(rule, &rule->group, operation, value); + continue; + } + + if (strcasecmp(key, "MODE") == 0) { + add_rule_key(rule, &rule->mode, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "OPTIONS") == 0) { + const char *pos; + + if (strstr(value, "last_rule") != NULL) { + dbg("last rule to be applied\n"); + rule->last_rule = 1; + } + if (strstr(value, "ignore_device") != NULL) { + dbg("device should be ignored\n"); + rule->ignore_device = 1; + } + if (strstr(value, "ignore_remove") != NULL) { + dbg("remove event should be ignored\n"); + rule->ignore_remove = 1; + } + pos = strstr(value, "link_priority="); + if (pos != NULL) { + rule->link_priority = atoi(&pos[strlen("link_priority=")]); + dbg("link priority=%i\n", rule->link_priority); + } + pos = strstr(value, "event_timeout="); + if (pos != NULL) { + rule->event_timeout = atoi(&pos[strlen("event_timeout=")]); + dbg("event timout=%i\n", rule->event_timeout); + } + pos = strstr(value, "string_escape="); + if (pos != NULL) { + pos = &pos[strlen("string_escape=")]; + if (strncmp(pos, "none", strlen("none")) == 0) + rule->string_escape = ESCAPE_NONE; + else if (strncmp(pos, "replace", strlen("replace")) == 0) + rule->string_escape = ESCAPE_REPLACE; + } + if (strstr(value, "all_partitions") != NULL) { + dbg("creation of partition nodes requested\n"); + rule->partitions = DEFAULT_PARTITIONS_COUNT; + } + valid = 1; + continue; + } + + err("unknown key '%s' in %s:%u\n", key, filename, lineno); + } + + if (physdev && rule->wait_for.operation == KEY_OP_UNSET) + err("PHYSDEV* values are deprecated and will be removed from a future kernel, \n" + "please fix it in %s:%u", filename, lineno); + + /* skip line if not any valid key was found */ + if (!valid) + goto invalid; + + /* grow buffer and add rule */ + rule_size = sizeof(struct udev_rule) + rule->bufsize; + padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); + dbg("add %zi padding bytes\n", padding); + rule_size += padding; + rule->bufsize += padding; + + rules->buf = realloc(rules->buf, rules->bufsize + rule_size); + if (!rules->buf) { + err("realloc failed\n"); + goto exit; + } + dbg("adding rule to offset %zi\n", rules->bufsize); + memcpy(rules->buf + rules->bufsize, rule, rule_size); + rules->bufsize += rule_size; +exit: + return 0; + +invalid: + err("invalid rule '%s:%u'\n", filename, lineno); + return -1; +} + +static int parse_file(struct udev_rules *rules, const char *filename) +{ + char line[LINE_SIZE]; + char *bufline; + unsigned int lineno; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + int retval = 0; + + if (file_map(filename, &buf, &bufsize) != 0) { + err("can't open '%s' as rules file: %s\n", filename, strerror(errno)); + return -1; + } + info("reading '%s' as rules file\n", filename); + + /* loop through the whole file */ + cur = 0; + lineno = 0; + while (cur < bufsize) { + unsigned int i, j; + + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + lineno++; + + /* eat the whitespace */ + while ((count > 0) && isspace(bufline[0])) { + bufline++; + count--; + } + if (count == 0) + continue; + + /* see if this is a comment */ + if (bufline[0] == COMMENT_CHARACTER) + continue; + + if (count >= sizeof(line)) { + err("line too long, rule skipped '%s:%u'\n", filename, lineno); + continue; + } + + /* skip backslash and newline from multiline rules */ + for (i = j = 0; i < count; i++) { + if (bufline[i] == '\\' && bufline[i+1] == '\n') + continue; + + line[j++] = bufline[i]; + } + line[j] = '\0'; + + dbg("read '%s'\n", line); + add_to_rules(rules, line, filename, lineno); + } + + file_unmap(buf, bufsize); + return retval; +} + +int udev_rules_init(struct udev_rules *rules, int resolve_names) +{ + struct stat statbuf; + char filename[PATH_MAX]; + LIST_HEAD(name_list); + LIST_HEAD(sort_list); + struct name_entry *name_loop, *name_tmp; + struct name_entry *sort_loop, *sort_tmp; + int retval = 0; + + memset(rules, 0x00, sizeof(struct udev_rules)); + rules->resolve_names = resolve_names; + + if (udev_rules_dir[0] != '\0') { + /* custom rules location for testing */ + add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX); + } else { + /* read default rules */ + add_matching_files(&name_list, RULES_LIB_DIR, RULESFILE_SUFFIX); + + /* read user/custom rules */ + add_matching_files(&sort_list, RULES_ETC_DIR, RULESFILE_SUFFIX); + + /* read dynamic/temporary rules */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); + if (stat(filename, &statbuf) != 0) { + create_path(filename); + selinux_setfscreatecon(filename, NULL, S_IFDIR|0755); + mkdir(filename, 0755); + selinux_resetfscreatecon(); + } + add_matching_files(&sort_list, filename, RULESFILE_SUFFIX); + + /* sort all rules files by basename into list of files */ + list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) { + const char *sort_base = strrchr(sort_loop->name, '/'); + + if (sort_base == NULL) + continue; + + list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { + const char *name_base = strrchr(name_loop->name, '/'); + + if (name_base == NULL) + continue; + + if (strcmp(name_base, sort_base) > 0) + break; + } + list_move_tail(&sort_loop->node, &name_loop->node); + } + } + + /* parse list of files */ + list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { + if (stat(name_loop->name, &statbuf) == 0) { + if (statbuf.st_size) + parse_file(rules, name_loop->name); + else + dbg("empty rules file '%s'\n", name_loop->name); + } else + err("could not read '%s': %s\n", name_loop->name, strerror(errno)); + list_del(&name_loop->node); + free(name_loop); + } + + return retval; +} + +void udev_rules_cleanup(struct udev_rules *rules) +{ + if (rules->buf) { + free(rules->buf); + rules->buf = NULL; + } +} + diff --git a/udev/udev_selinux.c b/udev/udev_selinux.c new file mode 100644 index 0000000000..eec950194c --- /dev/null +++ b/udev/udev_selinux.c @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2004 Daniel Walsh + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_selinux.h" + +static security_context_t prev_scontext = NULL; + +static int is_selinux_running(void) +{ + static int selinux_enabled = -1; + + if (selinux_enabled == -1) + selinux_enabled = (is_selinux_enabled() > 0); + + dbg("selinux=%i\n", selinux_enabled); + return selinux_enabled; +} + +static char *get_media(const char *devname, int mode) +{ + FILE *fp; + char procfile[PATH_MAX]; + char mediabuf[256]; + int size; + char *media = NULL; + + if (!(mode & S_IFBLK)) + return NULL; + + snprintf(procfile, PATH_MAX, "/proc/ide/%s/media", devname); + procfile[PATH_MAX-1] = '\0'; + + fp = fopen(procfile, "r"); + if (!fp) + goto out; + + if (fgets(mediabuf, sizeof(mediabuf), fp) == NULL) + goto close_out; + + size = strlen(mediabuf); + while (size-- > 0) { + if (isspace(mediabuf[size])) { + mediabuf[size] = '\0'; + } else { + break; + } + } + + media = strdup(mediabuf); + info("selinux_get_media(%s)='%s'\n", devname, media); + +close_out: + fclose(fp); +out: + return media; +} + +void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) +{ + if (is_selinux_running()) { + security_context_t scontext = NULL; + char *media; + int ret = -1; + + if (devname) { + media = get_media(devname, mode); + if (media) { + ret = matchmediacon(media, &scontext); + free(media); + } + } + + if (ret < 0) + if (matchpathcon(file, mode, &scontext) < 0) { + err("matchpathcon(%s) failed\n", file); + return; + } + + if (lsetfilecon(file, scontext) < 0) + err("setfilecon %s failed: %s\n", file, strerror(errno)); + + freecon(scontext); + } +} + +void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) +{ + if (is_selinux_running()) { + security_context_t scontext = NULL; + char *media; + int ret = -1; + + if (devname) { + media = get_media(devname, mode); + if (media) { + ret = matchmediacon(media, &scontext); + free(media); + } + } + + if (ret < 0) + if (matchpathcon(file, mode, &scontext) < 0) { + err("matchpathcon(%s) failed\n", file); + return; + } + + if (setfscreatecon(scontext) < 0) + err("setfscreatecon %s failed: %s\n", file, strerror(errno)); + + freecon(scontext); + } +} + +void selinux_resetfscreatecon(void) +{ + if (is_selinux_running()) { + if (setfscreatecon(prev_scontext) < 0) + err("setfscreatecon failed: %s\n", strerror(errno)); + } +} + +void selinux_init(void) +{ + /* + * record the present security context, for file-creation + * restoration creation purposes. + */ + if (is_selinux_running()) { + if (!udev_root[0]) + err("selinux_init: udev_root not set\n"); + matchpathcon_init_prefix(NULL, udev_root); + if (getfscreatecon(&prev_scontext) < 0) { + err("getfscreatecon failed\n"); + prev_scontext = NULL; + } + } +} + +void selinux_exit(void) +{ + if (is_selinux_running() && prev_scontext) { + freecon(prev_scontext); + prev_scontext = NULL; + } +} diff --git a/udev/udev_selinux.h b/udev/udev_selinux.h new file mode 100644 index 0000000000..73567d6cfe --- /dev/null +++ b/udev/udev_selinux.h @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2004 Daniel Walsh + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#ifndef _UDEV_SELINUX_H +#define _UDEV_SELINUX_H + +#ifdef USE_SELINUX + +extern void selinux_setfilecon(const char *file, const char *devname, unsigned int mode); +extern void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode); +extern void selinux_resetfscreatecon(void); +extern void selinux_init(void); +extern void selinux_exit(void); + +#else + +static inline void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) {} +static inline void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) {} +static inline void selinux_resetfscreatecon(void) {} +static inline void selinux_init(void) {} +static inline void selinux_exit(void) {} + +#endif /* USE_SELINUX */ +#endif /* _UDEV_USE_SELINUX */ diff --git a/udev/udev_sysdeps.c b/udev/udev_sysdeps.c new file mode 100644 index 0000000000..9447cca936 --- /dev/null +++ b/udev/udev_sysdeps.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2005-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +#ifdef __GLIBC__ +size_t strlcpy(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + /* If size == 0 there is no space for a final null... */ + if (size) + *q = '\0'; + return bytes; +} + +size_t strlcat(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while (bytes < size && *q) { + q++; + bytes++; + } + if (bytes == size) + return (bytes + strlen(src)); + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + *q = '\0'; + return bytes; +} +#endif /* __GLIBC__ */ diff --git a/udev/udev_sysdeps.h b/udev/udev_sysdeps.h new file mode 100644 index 0000000000..d4f03686af --- /dev/null +++ b/udev/udev_sysdeps.h @@ -0,0 +1,172 @@ +/* + * wrapping of libc features and kernel interfaces + * + * Copyright (C) 2005-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#ifndef _UDEV_SYSDEPS_H_ +#define _UDEV_SYSDEPS_H_ + +#include +#include +#include + +/* needed until Inotify! syscalls reach glibc */ +#include +#ifndef __NR_inotify_init +#if defined(__i386__) +# define __NR_inotify_init 291 +# define __NR_inotify_add_watch 292 +# define __NR_inotify_rm_watch 293 +#elif defined(__x86_64__) +# define __NR_inotify_init 253 +# define __NR_inotify_add_watch 254 +# define __NR_inotify_rm_watch 255 +#elif defined(__powerpc__) || defined(__powerpc64__) +# define __NR_inotify_init 275 +# define __NR_inotify_add_watch 276 +# define __NR_inotify_rm_watch 277 +#elif defined (__ia64__) +# define __NR_inotify_init 1277 +# define __NR_inotify_add_watch 1278 +# define __NR_inotify_rm_watch 1279 +#elif defined (__s390__) +# define __NR_inotify_init 284 +# define __NR_inotify_add_watch 285 +# define __NR_inotify_rm_watch 286 +#elif defined (__alpha__) +# define __NR_inotify_init 444 +# define __NR_inotify_add_watch 445 +# define __NR_inotify_rm_watch 446 +#elif defined (__sparc__) || defined (__sparc64__) +# define __NR_inotify_init 151 +# define __NR_inotify_add_watch 152 +# define __NR_inotify_rm_watch 156 +#elif defined (__arm__) +# define __NR_inotify_init __NR_SYSCALL_BASE+316 +# define __NR_inotify_add_watch __NR_SYSCALL_BASE+317 +# define __NR_inotify_rm_watch __NR_SYSCALL_BASE+318 +#elif defined (__sh__) +# define __NR_inotify_init 290 +# define __NR_inotify_add_watch 291 +# define __NR_inotify_rm_watch 292 +#elif defined (__m32r__) +# define __NR_inotify_init 290 +# define __NR_inotify_add_watch 291 +# define __NR_inotify_rm_watch 292 +#elif defined (__hppa__) +# define __NR_inotify_init 269 +# define __NR_inotify_add_watch 270 +# define __NR_inotify_rm_watch 271 +#elif defined (__mips__) +# include +# if _MIPS_SIM == _MIPS_SIM_ABI32 +# define __NR_Linux 4000 +# define __NR_inotify_init (__NR_Linux + 284) +# define __NR_inotify_add_watch (__NR_Linux + 285) +# define __NR_inotify_rm_watch (__NR_Linux + 286) +# elif _MIPS_SIM == _MIPS_SIM_ABI64 +# define __NR_Linux 5000 +# define __NR_inotify_init (__NR_Linux + 243) +# define __NR_inotify_add_watch (__NR_Linux + 244) +# define __NR_inotify_rm_watch (__NR_Linux + 245) +# elif _MIPS_SIM == _MIPS_SIM_NABI32 +# define __NR_Linux 6000 +# define __NR_inotify_init (__NR_Linux + 247) +# define __NR_inotify_add_watch (__NR_Linux + 248) +# define __NR_inotify_rm_watch (__NR_Linux + 249) +# endif +#else +#warning "inotify unsupported on this architecture!" +#endif +#endif /* __NR_inotify_init */ + +/* dummy if we don't have the syscalls defined */ +#ifndef __NR_inotify_init +static inline int inotify_init(void) +{ + return -1; +} + +static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) +{ + return -1; +} +#else +/* needed until /usr/include/sys/inotify.h is working */ +#ifndef __GLIBC__ +#include +#else +static inline int inotify_init(void) +{ + return syscall(__NR_inotify_init); +} + +static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) +{ + return syscall(__NR_inotify_add_watch, fd, name, mask); +} +#endif /* __GLIBC__ */ +#endif /* __NR_inotify_init */ + +#ifndef IN_CREATE +#define IN_CREATE 0x00000100 /* Subfile was created */ +#define IN_MOVED_FROM 0x00000040 /* File was moved from X */ +#define IN_MOVED_TO 0x00000080 /* File was moved to Y */ +#define IN_DELETE 0x00000200 /* Subfile was deleted */ +#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ +#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ +#endif /* IN_CREATE */ + +/* needed for our signal handlers to work */ +#undef asmlinkage +#ifdef __i386__ +#define asmlinkage __attribute__((regparm(0))) +#else +#define asmlinkage +#endif /* __i386__ */ + +/* headers are broken on some architectures */ +#ifndef __FD_SET +#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) +#endif +#ifndef __FD_CLR +#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) +#endif +#ifndef __FD_ISSET +#define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) +#endif +#ifndef __FD_ZERO +#define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) +#endif + +#ifndef NETLINK_KOBJECT_UEVENT +#define NETLINK_KOBJECT_UEVENT 15 +#endif + +#ifndef SO_RCVBUFFORCE +#if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || defined(__sparc_v9__) +#define SO_RCVBUFFORCE 0x100b +#else +#define SO_RCVBUFFORCE 33 +#endif +#endif + +extern size_t strlcpy(char *dst, const char *src, size_t size); +extern size_t strlcat(char *dst, const char *src, size_t size); + +#endif diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c new file mode 100644 index 0000000000..c4cd4ab75d --- /dev/null +++ b/udev/udev_sysfs.c @@ -0,0 +1,509 @@ +/* + * Copyright (C) 2005-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +char sysfs_path[PATH_SIZE]; + +/* device cache */ +static LIST_HEAD(dev_list); + +/* attribute value cache */ +static LIST_HEAD(attr_list); +struct sysfs_attr { + struct list_head node; + char path[PATH_SIZE]; + char *value; /* points to value_local if value is cached */ + char value_local[NAME_SIZE]; +}; + +int sysfs_init(void) +{ + const char *env; + + env = getenv("SYSFS_PATH"); + if (env) { + strlcpy(sysfs_path, env, sizeof(sysfs_path)); + remove_trailing_chars(sysfs_path, '/'); + } else + strlcpy(sysfs_path, "/sys", sizeof(sysfs_path)); + dbg("sysfs_path='%s'\n", sysfs_path); + + INIT_LIST_HEAD(&dev_list); + INIT_LIST_HEAD(&attr_list); + return 0; +} + +void sysfs_cleanup(void) +{ + struct sysfs_attr *attr_loop; + struct sysfs_attr *attr_temp; + struct sysfs_device *dev_loop; + struct sysfs_device *dev_temp; + + list_for_each_entry_safe(attr_loop, attr_temp, &attr_list, node) { + list_del(&attr_loop->node); + free(attr_loop); + } + + list_for_each_entry_safe(dev_loop, dev_temp, &dev_list, node) { + list_del(&dev_loop->node); + free(dev_loop); + } +} + +void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, + const char *subsystem, const char *driver) +{ + char *pos; + + strlcpy(dev->devpath, devpath, sizeof(dev->devpath)); + if (subsystem != NULL) + strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); + if (driver != NULL) + strlcpy(dev->driver, driver, sizeof(dev->driver)); + + /* set kernel name */ + pos = strrchr(dev->devpath, '/'); + if (pos == NULL) + return; + strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); + dbg("kernel='%s'\n", dev->kernel); + + /* some devices have '!' in their name, change that to '/' */ + pos = dev->kernel; + while (pos[0] != '\0') { + if (pos[0] == '!') + pos[0] = '/'; + pos++; + } + + /* get kernel number */ + pos = &dev->kernel[strlen(dev->kernel)]; + while (isdigit(pos[-1])) + pos--; + strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); + dbg("kernel_number='%s'\n", dev->kernel_number); +} + +int sysfs_resolve_link(char *devpath, size_t size) +{ + char link_path[PATH_SIZE]; + char link_target[PATH_SIZE]; + int len; + int i; + int back; + + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, devpath, sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len <= 0) + return -1; + link_target[len] = '\0'; + dbg("path link '%s' points to '%s'\n", devpath, link_target); + + for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) + ; + dbg("base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); + for (i = 0; i <= back; i++) { + char *pos = strrchr(devpath, '/'); + + if (pos == NULL) + return -1; + pos[0] = '\0'; + } + dbg("after moving back '%s'\n", devpath); + strlcat(devpath, "/", size); + strlcat(devpath, &link_target[back * 3], size); + return 0; +} + +struct sysfs_device *sysfs_device_get(const char *devpath) +{ + char path[PATH_SIZE]; + char devpath_real[PATH_SIZE]; + struct sysfs_device *dev; + struct sysfs_device *dev_loop; + struct stat statbuf; + char link_path[PATH_SIZE]; + char link_target[PATH_SIZE]; + int len; + char *pos; + + /* we handle only these devpathes */ + if (devpath != NULL && + strncmp(devpath, "/devices/", 9) != 0 && + strncmp(devpath, "/subsystem/", 11) != 0 && + strncmp(devpath, "/module/", 8) != 0 && + strncmp(devpath, "/bus/", 5) != 0 && + strncmp(devpath, "/class/", 7) != 0 && + strncmp(devpath, "/block/", 7) != 0) + return NULL; + + dbg("open '%s'\n", devpath); + strlcpy(devpath_real, devpath, sizeof(devpath_real)); + remove_trailing_chars(devpath_real, '/'); + if (devpath[0] == '\0' ) + return NULL; + + /* look for device already in cache (we never put an untranslated path in the cache) */ + list_for_each_entry(dev_loop, &dev_list, node) { + if (strcmp(dev_loop->devpath, devpath_real) == 0) { + dbg("found in cache '%s'\n", dev_loop->devpath); + return dev_loop; + } + } + + /* if we got a link, resolve it to the real device */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath_real, sizeof(path)); + if (lstat(path, &statbuf) != 0) { + dbg("stat '%s' failed: %s\n", path, strerror(errno)); + return NULL; + } + if (S_ISLNK(statbuf.st_mode)) { + if (sysfs_resolve_link(devpath_real, sizeof(devpath_real)) != 0) + return NULL; + + /* now look for device in cache after path translation */ + list_for_each_entry(dev_loop, &dev_list, node) { + if (strcmp(dev_loop->devpath, devpath_real) == 0) { + dbg("found in cache '%s'\n", dev_loop->devpath); + return dev_loop; + } + } + } + + /* it is a new device */ + dbg("new uncached device '%s'\n", devpath_real); + dev = malloc(sizeof(struct sysfs_device)); + if (dev == NULL) + return NULL; + memset(dev, 0x00, sizeof(struct sysfs_device)); + + sysfs_device_set_values(dev, devpath_real, NULL, NULL); + + /* get subsystem name */ + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, dev->devpath, sizeof(link_path)); + strlcat(link_path, "/subsystem", sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len > 0) { + /* get subsystem from "subsystem" link */ + link_target[len] = '\0'; + dbg("subsystem link '%s' points to '%s'\n", link_path, link_target); + pos = strrchr(link_target, '/'); + if (pos != NULL) + strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); + } else if (strstr(dev->devpath, "/drivers/") != NULL) { + strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); + } else if (strncmp(dev->devpath, "/module/", 8) == 0) { + strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); + } else if (strncmp(dev->devpath, "/subsystem/", 11) == 0) { + pos = strrchr(dev->devpath, '/'); + if (pos == &dev->devpath[10]) + strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); + } else if (strncmp(dev->devpath, "/class/", 7) == 0) { + pos = strrchr(dev->devpath, '/'); + if (pos == &dev->devpath[6]) + strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); + } else if (strncmp(dev->devpath, "/bus/", 5) == 0) { + pos = strrchr(dev->devpath, '/'); + if (pos == &dev->devpath[4]) + strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); + } + + /* get driver name */ + strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcat(link_path, dev->devpath, sizeof(link_path)); + strlcat(link_path, "/driver", sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len > 0) { + link_target[len] = '\0'; + dbg("driver link '%s' points to '%s'\n", link_path, link_target); + pos = strrchr(link_target, '/'); + if (pos != NULL) + strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); + } + + dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'\n", dev->devpath, dev->subsystem, dev->driver); + list_add(&dev->node, &dev_list); + + return dev; +} + +struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) +{ + char parent_devpath[PATH_SIZE]; + char *pos; + + dbg("open '%s'\n", dev->devpath); + + /* look if we already know the parent */ + if (dev->parent != NULL) + return dev->parent; + + strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); + dbg("'%s'\n", parent_devpath); + + /* strip last element */ + pos = strrchr(parent_devpath, '/'); + if (pos == NULL || pos == parent_devpath) + return NULL; + pos[0] = '\0'; + + if (strncmp(parent_devpath, "/class", 6) == 0) { + pos = strrchr(parent_devpath, '/'); + if (pos == &parent_devpath[6] || pos == parent_devpath) { + dbg("/class top level, look for device link\n"); + goto device_link; + } + } + if (strcmp(parent_devpath, "/block") == 0) { + dbg("/block top level, look for device link\n"); + goto device_link; + } + + /* are we at the top level? */ + pos = strrchr(parent_devpath, '/'); + if (pos == NULL || pos == parent_devpath) + return NULL; + + /* get parent and remember it */ + dev->parent = sysfs_device_get(parent_devpath); + return dev->parent; + +device_link: + strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); + strlcat(parent_devpath, "/device", sizeof(parent_devpath)); + if (sysfs_resolve_link(parent_devpath, sizeof(parent_devpath)) != 0) + return NULL; + + /* get parent and remember it */ + dev->parent = sysfs_device_get(parent_devpath); + return dev->parent; +} + +struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem) +{ + struct sysfs_device *dev_parent; + + dev_parent = sysfs_device_get_parent(dev); + while (dev_parent != NULL) { + if (strcmp(dev_parent->subsystem, subsystem) == 0) + return dev_parent; + dev_parent = sysfs_device_get_parent(dev_parent); + } + return NULL; +} + +char *sysfs_attr_get_value(const char *devpath, const char *attr_name) +{ + char path_full[PATH_SIZE]; + const char *path; + char value[NAME_SIZE]; + struct sysfs_attr *attr_loop; + struct sysfs_attr *attr; + struct stat statbuf; + int fd; + ssize_t size; + size_t sysfs_len; + + dbg("open '%s'/'%s'\n", devpath, attr_name); + sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); + if(sysfs_len >= sizeof(path_full)) + sysfs_len = sizeof(path_full) - 1; + path = &path_full[sysfs_len]; + strlcat(path_full, devpath, sizeof(path_full)); + strlcat(path_full, "/", sizeof(path_full)); + strlcat(path_full, attr_name, sizeof(path_full)); + + /* look for attribute in cache */ + list_for_each_entry(attr_loop, &attr_list, node) { + if (strcmp(attr_loop->path, path) == 0) { + dbg("found in cache '%s'\n", attr_loop->path); + return attr_loop->value; + } + } + + /* store attribute in cache (also negatives are kept in cache) */ + dbg("new uncached attribute '%s'\n", path_full); + attr = malloc(sizeof(struct sysfs_attr)); + if (attr == NULL) + return NULL; + memset(attr, 0x00, sizeof(struct sysfs_attr)); + strlcpy(attr->path, path, sizeof(attr->path)); + dbg("add to cache '%s'\n", path_full); + list_add(&attr->node, &attr_list); + + if (lstat(path_full, &statbuf) != 0) { + dbg("stat '%s' failed: %s\n", path_full, strerror(errno)); + goto out; + } + + if (S_ISLNK(statbuf.st_mode)) { + /* links return the last element of the target path */ + char link_target[PATH_SIZE]; + int len; + const char *pos; + + len = readlink(path_full, link_target, sizeof(link_target)); + if (len > 0) { + link_target[len] = '\0'; + pos = strrchr(link_target, '/'); + if (pos != NULL) { + dbg("cache '%s' with link value '%s'\n", path_full, value); + strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); + attr->value = attr->value_local; + } + } + goto out; + } + + /* skip directories */ + if (S_ISDIR(statbuf.st_mode)) + goto out; + + /* skip non-readable files */ + if ((statbuf.st_mode & S_IRUSR) == 0) + goto out; + + /* read attribute value */ + fd = open(path_full, O_RDONLY); + if (fd < 0) { + dbg("attribute '%s' can not be opened\n", path_full); + goto out; + } + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + if (size == sizeof(value)) + goto out; + + /* got a valid value, store and return it */ + value[size] = '\0'; + remove_trailing_chars(value, '\n'); + dbg("cache '%s' with attribute value '%s'\n", path_full, value); + strlcpy(attr->value_local, value, sizeof(attr->value_local)); + attr->value = attr->value_local; + +out: + return attr->value; +} + +int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char *subsystem, const char *id) +{ + size_t sysfs_len; + char path_full[PATH_SIZE]; + char *path; + struct stat statbuf; + + sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); + path = &path_full[sysfs_len]; + + if (strcmp(subsystem, "subsystem") == 0) { + strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + + strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + } + + if (strcmp(subsystem, "module") == 0) { + strlcpy(path, "/module/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "drivers") == 0) { + char subsys[NAME_SIZE]; + char *driver; + + strlcpy(subsys, id, sizeof(subsys)); + driver = strchr(subsys, ':'); + if (driver != NULL) { + driver[0] = '\0'; + driver = &driver[1]; + strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); + strlcat(path, subsys, sizeof(path_full) - sysfs_len); + strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); + strlcat(path, driver, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + strlcat(path, subsys, sizeof(path_full) - sysfs_len); + strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); + strlcat(path, driver, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + } + goto out; + } + + strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); + strlcat(path, subsystem, sizeof(path_full) - sysfs_len); + strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + strlcat(path, subsystem, sizeof(path_full) - sysfs_len); + strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); + strlcat(path, subsystem, sizeof(path_full) - sysfs_len); + strlcat(path, "/", sizeof(path_full) - sysfs_len); + strlcat(path, id, sizeof(path_full) - sysfs_len); + if (stat(path_full, &statbuf) == 0) + goto found; +out: + return 0; +found: + if (S_ISLNK(statbuf.st_mode)) + sysfs_resolve_link(path, sizeof(path_full) - sysfs_len); + strlcpy(devpath_full, path, len); + return 1; +} diff --git a/udev/udev_utils.c b/udev/udev_utils.c new file mode 100644 index 0000000000..00b67dadc6 --- /dev/null +++ b/udev/udev_utils.c @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2004-2005 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + + +int log_priority(const char *priority) +{ + char *endptr; + int prio; + + prio = strtol(priority, &endptr, 10); + if (endptr[0] == '\0') + return prio; + if (strncasecmp(priority, "err", 3) == 0) + return LOG_ERR; + if (strcasecmp(priority, "info") == 0) + return LOG_INFO; + if (strcasecmp(priority, "debug") == 0) + return LOG_DEBUG; + if (string_is_true(priority)) + return LOG_ERR; + + return 0; +} + +struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort) +{ + struct name_entry *name_loop; + struct name_entry *name_new; + + /* avoid duplicate entries */ + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) == 0) { + dbg("'%s' is already in the list\n", name); + return name_loop; + } + } + + if (sort) + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) > 0) + break; + } + + name_new = malloc(sizeof(struct name_entry)); + if (name_new == NULL) + return NULL; + + strlcpy(name_new->name, name, sizeof(name_new->name)); + dbg("adding '%s'\n", name_new->name); + list_add_tail(&name_new->node, &name_loop->node); + + return name_new; +} + +struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value) +{ + struct name_entry *name_loop; + struct name_entry *name_new; + + list_for_each_entry(name_loop, name_list, node) { + if (strncmp(name_loop->name, key, strlen(key)) == 0) { + dbg("key already present '%s', replace it\n", name_loop->name); + snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); + name_loop->name[sizeof(name_loop->name)-1] = '\0'; + return name_loop; + } + } + + name_new = malloc(sizeof(struct name_entry)); + if (name_new == NULL) + return NULL; + + snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); + name_new->name[sizeof(name_new->name)-1] = '\0'; + dbg("adding '%s'\n", name_new->name); + list_add_tail(&name_new->node, &name_loop->node); + + return name_new; +} + +int name_list_key_remove(struct list_head *name_list, const char *key) +{ + struct name_entry *name_loop; + struct name_entry *name_tmp; + size_t keylen = strlen(key); + int retval = 0; + + list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { + if (strncmp(name_loop->name, key, keylen) != 0) + continue; + if (name_loop->name[keylen] != '=') + continue; + list_del(&name_loop->node); + free(name_loop); + retval = 1; + break; + } + return retval; +} + +void name_list_cleanup(struct list_head *name_list) +{ + struct name_entry *name_loop; + struct name_entry *name_tmp; + + list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { + list_del(&name_loop->node); + free(name_loop); + } +} + +/* calls function for every file found in specified directory */ +int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix) +{ + struct dirent *ent; + DIR *dir; + char filename[PATH_SIZE]; + + dbg("open directory '%s'\n", dirname); + dir = opendir(dirname); + if (dir == NULL) { + err("unable to open '%s': %s\n", dirname, strerror(errno)); + return -1; + } + + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + + if ((ent->d_name[0] == '.') || (ent->d_name[0] == COMMENT_CHARACTER)) + continue; + + /* look for file matching with specified suffix */ + if (suffix != NULL) { + const char *ext; + + ext = strrchr(ent->d_name, '.'); + if (ext == NULL) + continue; + if (strcmp(ext, suffix) != 0) + continue; + } + dbg("put file '%s/%s' into list\n", dirname, ent->d_name); + + snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); + filename[sizeof(filename)-1] = '\0'; + name_list_add(name_list, filename, 1); + } + + closedir(dir); + return 0; +} + +uid_t lookup_user(const char *user) +{ + struct passwd *pw; + uid_t uid = 0; + + errno = 0; + pw = getpwnam(user); + if (pw == NULL) { + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err("specified user '%s' unknown\n", user); + else + err("error resolving user '%s': %s\n", user, strerror(errno)); + } else + uid = pw->pw_uid; + + return uid; +} + +extern gid_t lookup_group(const char *group) +{ + struct group *gr; + gid_t gid = 0; + + errno = 0; + gr = getgrnam(group); + if (gr == NULL) { + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err("specified group '%s' unknown\n", group); + else + err("error resolving group '%s': %s\n", group, strerror(errno)); + } else + gid = gr->gr_gid; + + return gid; +} + diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c new file mode 100644 index 0000000000..a492785af9 --- /dev/null +++ b/udev/udev_utils_file.c @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2004-2005 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_selinux.h" + +int create_path(const char *path) +{ + char p[PATH_SIZE]; + char *pos; + struct stat stats; + int ret; + + strlcpy(p, path, sizeof(p)); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (pos[-1] == '/') + pos--; + pos[0] = '\0'; + + dbg("stat '%s'\n", p); + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + + if (create_path(p) != 0) + return -1; + + dbg("mkdir '%s'\n", p); + selinux_setfscreatecon(p, NULL, S_IFDIR|0755); + ret = mkdir(p, 0755); + selinux_resetfscreatecon(); + if (ret == 0) + return 0; + + if (errno == EEXIST) + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + return -1; +} + +int delete_path(const char *path) +{ + char p[PATH_SIZE]; + char *pos; + int retval; + + strcpy (p, path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (1) { + *pos = '\0'; + pos = strrchr(p, '/'); + + /* don't remove the last one */ + if ((pos == p) || (pos == NULL)) + break; + + /* remove if empty */ + retval = rmdir(p); + if (errno == ENOENT) + retval = 0; + if (retval) { + if (errno == ENOTEMPTY) + return 0; + err("rmdir(%s) failed: %s\n", p, strerror(errno)); + break; + } + dbg("removed '%s'\n", p); + } + return 0; +} + +/* Reset permissions on the device node, before unlinking it to make sure, + * that permisions of possible hard links will be removed too. + */ +int unlink_secure(const char *filename) +{ + int retval; + + retval = chown(filename, 0, 0); + if (retval) + err("chown(%s, 0, 0) failed: %s\n", filename, strerror(errno)); + + retval = chmod(filename, 0000); + if (retval) + err("chmod(%s, 0000) failed: %s\n", filename, strerror(errno)); + + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; + + if (retval) + err("unlink(%s) failed: %s\n", filename, strerror(errno)); + + return retval; +} + +int file_map(const char *filename, char **buf, size_t *bufsize) +{ + struct stat stats; + int fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) { + return -1; + } + + if (fstat(fd, &stats) < 0) { + close(fd); + return -1; + } + + *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); + if (*buf == MAP_FAILED) { + close(fd); + return -1; + } + *bufsize = stats.st_size; + + close(fd); + + return 0; +} + +void file_unmap(void *buf, size_t bufsize) +{ + munmap(buf, bufsize); +} + +/* return number of chars until the next newline, skip escaped newline */ +size_t buf_get_line(const char *buf, size_t buflen, size_t cur) +{ + int escape = 0; + size_t count; + + for (count = cur; count < buflen; count++) { + if (!escape && buf[count] == '\n') + break; + + if (buf[count] == '\\') + escape = 1; + else + escape = 0; + } + + return count - cur; +} diff --git a/udev/udev_utils_string.c b/udev/udev_utils_string.c new file mode 100644 index 0000000000..e3dc137e63 --- /dev/null +++ b/udev/udev_utils_string.c @@ -0,0 +1,270 @@ +/* + * Copyright (C) 2004-2005 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +int string_is_true(const char *str) +{ + if (strcasecmp(str, "true") == 0) + return 1; + if (strcasecmp(str, "yes") == 0) + return 1; + if (strcasecmp(str, "1") == 0) + return 1; + return 0; +} + +void remove_trailing_chars(char *path, char c) +{ + size_t len; + + len = strlen(path); + while (len > 0 && path[len-1] == c) + path[--len] = '\0'; +} + +size_t path_encode(char *s, size_t len) +{ + char t[(len * 3)+1]; + size_t i, j; + + t[0] = '\0'; + for (i = 0, j = 0; s[i] != '\0'; i++) { + if (s[i] == '/') { + memcpy(&t[j], "\\x2f", 4); + j += 4; + } else if (s[i] == '\\') { + memcpy(&t[j], "\\x5c", 4); + j += 4; + } else { + t[j] = s[i]; + j++; + } + } + t[j] = '\0'; + strncpy(s, t, len); + return j; +} + +size_t path_decode(char *s) +{ + size_t i, j; + + for (i = 0, j = 0; s[i] != '\0'; j++) { + if (memcmp(&s[i], "\\x2f", 4) == 0) { + s[j] = '/'; + i += 4; + }else if (memcmp(&s[i], "\\x5c", 4) == 0) { + s[j] = '\\'; + i += 4; + } else { + s[j] = s[i]; + i++; + } + } + s[j] = '\0'; + return j; +} + +/* count of characters used to encode one unicode char */ +static int utf8_encoded_expected_len(const char *str) +{ + unsigned char c = (unsigned char)str[0]; + + if (c < 0x80) + return 1; + if ((c & 0xe0) == 0xc0) + return 2; + if ((c & 0xf0) == 0xe0) + return 3; + if ((c & 0xf8) == 0xf0) + return 4; + if ((c & 0xfc) == 0xf8) + return 5; + if ((c & 0xfe) == 0xfc) + return 6; + return 0; +} + +/* decode one unicode char */ +static int utf8_encoded_to_unichar(const char *str) +{ + int unichar; + int len; + int i; + + len = utf8_encoded_expected_len(str); + switch (len) { + case 1: + return (int)str[0]; + case 2: + unichar = str[0] & 0x1f; + break; + case 3: + unichar = (int)str[0] & 0x0f; + break; + case 4: + unichar = (int)str[0] & 0x07; + break; + case 5: + unichar = (int)str[0] & 0x03; + break; + case 6: + unichar = (int)str[0] & 0x01; + break; + default: + return -1; + } + + for (i = 1; i < len; i++) { + if (((int)str[i] & 0xc0) != 0x80) + return -1; + unichar <<= 6; + unichar |= (int)str[i] & 0x3f; + } + + return unichar; +} + +/* expected size used to encode one unicode char */ +static int utf8_unichar_to_encoded_len(int unichar) +{ + if (unichar < 0x80) + return 1; + if (unichar < 0x800) + return 2; + if (unichar < 0x10000) + return 3; + if (unichar < 0x200000) + return 4; + if (unichar < 0x4000000) + return 5; + return 6; +} + +/* check if unicode char has a valid numeric range */ +static int utf8_unichar_valid_range(int unichar) +{ + if (unichar > 0x10ffff) + return 0; + if ((unichar & 0xfffff800) == 0xd800) + return 0; + if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) + return 0; + if ((unichar & 0xffff) == 0xffff) + return 0; + return 1; +} + +/* validate one encoded unicode char and return its length */ +int utf8_encoded_valid_unichar(const char *str) +{ + int len; + int unichar; + int i; + + len = utf8_encoded_expected_len(str); + if (len == 0) + return -1; + + /* ascii is valid */ + if (len == 1) + return 1; + + /* check if expected encoded chars are available */ + for (i = 0; i < len; i++) + if ((str[i] & 0x80) != 0x80) + return -1; + + unichar = utf8_encoded_to_unichar(str); + + /* check if encoded length matches encoded value */ + if (utf8_unichar_to_encoded_len(unichar) != len) + return -1; + + /* check if value has valid range */ + if (!utf8_unichar_valid_range(unichar)) + return -1; + + return len; +} + +/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ +int replace_chars(char *str, const char *white) +{ + size_t i = 0; + int replaced = 0; + + while (str[i] != '\0') { + int len; + + /* accept whitelist */ + if (white != NULL && strchr(white, str[i]) != NULL) { + i++; + continue; + } + + /* accept plain ascii char */ + if ((str[i] >= '0' && str[i] <= '9') || + (str[i] >= 'A' && str[i] <= 'Z') || + (str[i] >= 'a' && str[i] <= 'z')) { + i++; + continue; + } + + /* accept hex encoding */ + if (str[i] == '\\' && str[i+1] == 'x') { + i += 2; + continue; + } + + /* accept valid utf8 */ + len = utf8_encoded_valid_unichar(&str[i]); + if (len > 1) { + i += len; + continue; + } + + /* if space is allowed, replace whitespace with ordinary space */ + if (isspace(str[i]) && strchr(white, ' ') != NULL) { + str[i] = ' '; + i++; + replaced++; + continue; + } + + /* everything else is replaced with '_' */ + str[i] = '_'; + i++; + replaced++; + } + + return replaced; +} diff --git a/udev/udevadm.c b/udev/udevadm.c new file mode 100644 index 0000000000..6e7d7734d2 --- /dev/null +++ b/udev/udevadm.c @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2007 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int debug; + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + + if (priority > udev_log_priority) + return; + + va_start(args, format); + if (debug) { + vprintf(format, args); + } else + vsyslog(priority, format, args); + va_end(args); +} +#endif + +struct command { + const char *name; + int (*cmd)(int argc, char *argv[], char *envp[]); + const char *help; + int debug; +}; + +static const struct command cmds[]; + +static int version(int argc, char *argv[], char *envp[]) +{ + printf("%s\n", UDEV_VERSION); + return 0; +} + +static int help(int argc, char *argv[], char *envp[]) +{ + const struct command *cmd; + + printf("Usage: udevadm COMMAND [OPTIONS]\n"); + for (cmd = cmds; cmd->name != NULL; cmd++) + printf(" %-12s %s\n", cmd->name, cmd->help); + printf("\n"); + return 0; +} + +static const struct command cmds[] = { + { + .name = "info", + .cmd = udevinfo, + .help = "query sysfs or the udev database", + }, + { + .name = "trigger", + .cmd = udevtrigger, + .help = "request events from the kernel", + }, + { + .name = "settle", + .cmd = udevsettle, "", + .help = "wait for the event queue to finish", + }, + { + .name = "control", + .cmd = udevcontrol, + .help = "control the udev daemon", + }, + { + .name = "monitor", + .cmd = udevmonitor, + .help = "listen to kernel and udev events", + }, + { + .name = "test", + .cmd = udevtest, + .help = "simulation run", + .debug = 1, + }, + { + .name = "version", + .cmd = version, + .help = "print the version number", + }, + { + .name = "help", + .cmd = help, + .help = "print this help text", + }, + {} +}; + +int main(int argc, char *argv[], char *envp[]) +{ + const char *command; + const char *pos; + const struct command *cmd; + int rc; + + /* get binary or symlink name */ + pos = strrchr(argv[0], '/'); + if (pos != NULL) + command = &pos[1]; + else + command = argv[0]; + + /* the trailing part of the binary or symlink name is the command */ + if (strncmp(command, "udev", 4) == 0) + command = &command[4]; + + if (command == NULL || command[0] == '\0') + goto err_unknown; + + /* udevadm itself needs to strip its name from the passed options */ + if (strcmp(command, "adm") == 0) { + command = argv[1]; + argv++; + argc--; + } + + if (command == NULL) + goto err_unknown; + + /* allow command to be specified as an option */ + if (strncmp(command, "--", 2) == 0) + command += 2; + + /* find and execute command */ + for (cmd = cmds; cmd->name != NULL; cmd++) { + if (strcmp(cmd->name, command) == 0) { + debug = cmd->debug; + rc = cmd->cmd(argc, argv, envp); + goto out; + } + } + +err_unknown: + fprintf(stderr, "unknown command, try help\n\n"); + rc = 2; +out: + return rc; +} diff --git a/udev/udevadm.xml b/udev/udevadm.xml new file mode 100644 index 0000000000..670c991457 --- /dev/null +++ b/udev/udevadm.xml @@ -0,0 +1,379 @@ + + + +
                    +
                    + udevadm + + + udevd + November 2007 + udev + + + + udevadm + 8 + + + + + udevadmudev management tool + + + + + udevadm info options + + + udevadm trigger options + + + udevadm settle options + + + udevadm control options instruction + + + udevadm monitor options + + + udevadm test options devpath + + + udevadm version + + + udevadm help + + + + DESCRIPTION + udevadm expects a command and command specific options. It + controls the runtime behavior of udev, requests kernel events, + manages the event queue, and provides simple debugging mechanisms. + + + OPTIONS + + udevadm info <replaceable>options</replaceable> + Queries the udev database for device information + stored in the udev database. It can also query the properties + of a device from its sysfs representation to help creating udev + rules that match this device. + + + + + Query the database for specified type of device data. It needs the + or to identify the specified + device. Valid queries are: + name, symlink, path, + env, all. + + + + + + The devpath of the device to query. + + + + + + The name of the device node or a symlink to query + + + + + + The udev root directory: /dev. If used in conjunction + with a name or symlink query, the + query returns the absolute path including the root directory. + + + + + + Print all sysfs properties of the specified device that can be used + in udev rules to match the specified device. It prints all devices + along the chain, up to the root of sysfs that can be used in udev rules. + + + + + + Print major/minor numbers of the underlying device, where the file + lives on. + + + + + + Export the content of the udev database. + + + + + + Print version. + + + + + + Print help text. + + + + + + udevadm trigger <optional>options</optional> + Request device uevents, usually used to replay events at system coldplug. + + + + + Print the list of devices which will be triggered. + + + + + + Do not actually trigger the event. + + + + + + Trigger only the events which are failed during a previous run. + + + + + + Type of event to be triggered. The default value is "add". + + + + + + Trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Do not trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Trigger events for devices with a matching sysfs attribute. If a value is specified + along with the attribute name, the content of the attribute is matched against the given + value using shell style pattern matching. If no value is specified, the existence of the + sysfs attribute is checked. This option can be specified multiple times. + + + + + + Do not trigger events for devices with a matching sysfs attribute. If a value is + specified along with the attribute name, the content of the attribute is matched against + the given value using shell style pattern matching. If no value is specified, the existence + of the sysfs attribute is checked. This option can be specified multiple times. + + + + + + Pass the synthesized events to the specified socket, instead of triggering + a global kernel event. All available event values will be send in the same format + the kernel sends an uevent, or + sends a message. If the first character of the specified path is an @ character, + an abstract namespace socket is used, instead of an existing socket file. + + + + + + Pass an additional environemt key to the event. This works only with the + --socket option. + + + + + + udevadm settle <optional>options</optional> + Watches the udev event queue, and exits if all current events are handled. + + + + + Maximum number of seconds to wait for the event queue to become empty. + The default value is 180 seconds. + + + + + + Print help text. + + + + + + udevadm control <replaceable>command</replaceable> + Modify the internal state of the running udev daemon. + + + + + Set the internal log level of udevd. Valid values are the numerical + syslog priorities or their textual representations: , + and . + + + + + + Signal udevd to stop executing new events. Incoming events + will be queued. + + + + + + Signal udevd to enable the execution of events. + + + + + + Signal udevd to reload the rules from the config. + + + + + + Set global variable. + + + + value + + Set the maximum number of events, udevd will handle at the + same time. + + + + + + Set the maximum number of events, which are allowed to run at the + same time. + + + + + + Print help text. + + + + + + udevadm monitor <optional>options</optional> + Listens to the kernel uevents and events sent out by a udev rule + and prints the devpath of the event to the console. It can be used to analyze the + event timing, by comparing the timestamps of the kernel uevent and the udev event. + + + + + + Print the complete environment for all events. Can be used to compare the + kernel supplied and the udev added environment values. + + + + + + Print the kernel uevents. + + + + + + Print the udev event after the rule processing. + + + + + + Print help text. + + + + + + udevadm test <optional>options</optional> <replaceable>devpath</replaceable> + Simulate a udev event run for the given device, and print out debug + output. Unless forced to, no device node or symlink will be created. + + + + + The action string. + + + + + + The subsystem string. + + + + + + Force the creation of a device node or symlink. Usually the test run + prints only debug output. + + + + + + Print help text. + + + + + + udevadm version + Print version number. + + + udevadm help + Print help text. + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev7 + + + udevd8 + + + +
                    +
                    diff --git a/udev/udevcontrol.c b/udev/udevcontrol.c new file mode 100644 index 0000000000..4c93b8f464 --- /dev/null +++ b/udev/udevcontrol.c @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2005-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" + +static int sock = -1; +static int udev_log = 0; + +int udevcontrol(int argc, char *argv[], char *envp[]) +{ + static struct udevd_ctrl_msg ctrl_msg; + struct sockaddr_un saddr; + socklen_t addrlen; + const char *env; + const char *arg; + const char *val; + int *intval; + int retval = 1; + + env = getenv("UDEV_LOG"); + if (env) + udev_log = log_priority(env); + + logging_init("udevcontrol"); + dbg("version %s\n", UDEV_VERSION); + + if (argc < 2) { + fprintf(stderr, "missing command\n\n"); + goto exit; + } + memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); + strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); + arg = argv[1]; + + /* allow instructions passed as options */ + if (strncmp(arg, "--", 2) == 0) + arg += 2; + + if (!strcmp(arg, "stop_exec_queue")) + ctrl_msg.type = UDEVD_CTRL_STOP_EXEC_QUEUE; + else if (!strcmp(arg, "start_exec_queue")) + ctrl_msg.type = UDEVD_CTRL_START_EXEC_QUEUE; + else if (!strcmp(arg, "reload_rules")) + ctrl_msg.type = UDEVD_CTRL_RELOAD_RULES; + else if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { + intval = (int *) ctrl_msg.buf; + val = &arg[strlen("log_priority=")]; + ctrl_msg.type = UDEVD_CTRL_SET_LOG_LEVEL; + *intval = log_priority(val); + info("send log_priority=%i\n", *intval); + } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { + char *endp; + int count; + + intval = (int *) ctrl_msg.buf; + val = &arg[strlen("max_childs=")]; + ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS; + count = strtoul(val, &endp, 0); + if (endp[0] != '\0' || count < 1) { + fprintf(stderr, "invalid number\n"); + goto exit; + } + *intval = count; + info("send max_childs=%i\n", *intval); + } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { + char *endp; + int count; + + intval = (int *) ctrl_msg.buf; + val = &arg[strlen("max_childs_running=")]; + ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS_RUNNING; + count = strtoul(val, &endp, 0); + if (endp[0] != '\0' || count < 1) { + fprintf(stderr, "invalid number\n"); + goto exit; + } + *intval = count; + info("send max_childs_running=%i\n", *intval); + } else if (!strncmp(arg, "env", strlen("env"))) { + if (!strncmp(arg, "env=", strlen("env="))) + val = &arg[strlen("env=")]; + else + val = argv[2]; + if (val == NULL) { + fprintf(stderr, "missing key\n"); + goto exit; + } + ctrl_msg.type = UDEVD_CTRL_ENV; + strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf)); + info("send env '%s'\n", val); + } else if (strcmp(arg, "help") == 0 || strcmp(arg, "-h") == 0) { + printf("Usage: udevadm control COMMAND\n" + " --log_priority= set the udev log level for the daemon\n" + " --stop_exec_queue keep udevd from executing events, queue only\n" + " --start_exec_queue execute events, flush queue\n" + " --reload_rules reloads the rules files\n" + " --env== set a global environment variable\n" + " --max_childs= maximum number of childs\n" + " --max_childs_running= maximum number of childs running at the same time\n" + " --help print this help text\n\n"); + goto exit; + } else { + fprintf(stderr, "unrecognized command '%s'\n", arg); + goto exit; + } + + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); + goto exit; + } + + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (sock == -1) { + err("error getting socket: %s\n", strerror(errno)); + goto exit; + } + + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); + addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + + retval = sendto(sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&saddr, addrlen); + if (retval == -1) { + err("error sending message: %s\n", strerror(errno)); + retval = 1; + } else { + dbg("sent message type=0x%02x, %u bytes sent\n", ctrl_msg.type, retval); + retval = 0; + } + + close(sock); +exit: + logging_close(); + return retval; +} diff --git a/udev/udevd.c b/udev/udevd.c new file mode 100644 index 0000000000..0827a5ceb3 --- /dev/null +++ b/udev/udevd.c @@ -0,0 +1,1304 @@ +/* + * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004 Chris Friesen + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" +#include "udevd.h" +#include "udev_selinux.h" + +static int debug_trace; +static int debug; + +static struct udev_rules rules; +static int udevd_sock = -1; +static int uevent_netlink_sock = -1; +static int inotify_fd = -1; +static pid_t sid; + +static int signal_pipe[2] = {-1, -1}; +static volatile int sigchilds_waiting; +static volatile int udev_exit; +static volatile int reload_config; +static int run_exec_q; +static int stop_exec_q; +static int max_childs; +static int max_childs_running; +static char udev_log[32]; + +static LIST_HEAD(exec_list); +static LIST_HEAD(running_list); + + +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + + if (priority > udev_log_priority) + return; + + va_start(args, format); + if (debug) { + printf("[%d] ", (int) getpid()); + vprintf(format, args); + } else + vsyslog(priority, format, args); + va_end(args); +} + +#endif + +static void asmlinkage udev_event_sig_handler(int signum) +{ + if (signum == SIGALRM) + exit(1); +} + +static int udev_event_process(struct udevd_uevent_msg *msg) +{ + struct sigaction act; + struct udevice *udev; + int i; + int retval; + + /* set signal handlers */ + memset(&act, 0x00, sizeof(act)); + act.sa_handler = (void (*)(int)) udev_event_sig_handler; + sigemptyset (&act.sa_mask); + act.sa_flags = 0; + sigaction(SIGALRM, &act, NULL); + + /* reset to default */ + act.sa_handler = SIG_DFL; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + sigaction(SIGCHLD, &act, NULL); + sigaction(SIGHUP, &act, NULL); + + /* trigger timeout to prevent hanging processes */ + alarm(UDEV_EVENT_TIMEOUT); + + /* reconstruct event environment from message */ + for (i = 0; msg->envp[i]; i++) + putenv(msg->envp[i]); + + udev = udev_device_init(NULL); + if (udev == NULL) + return -1; + strlcpy(udev->action, msg->action, sizeof(udev->action)); + sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem, msg->driver); + udev->devpath_old = msg->devpath_old; + udev->devt = msg->devt; + + retval = udev_device_event(&rules, udev); + + /* rules may change/disable the timeout */ + if (udev->event_timeout >= 0) + alarm(udev->event_timeout); + + /* run programs collected by RUN-key*/ + if (retval == 0 && !udev->ignore_device && udev_run) + retval = udev_rules_run(udev); + + udev_device_cleanup(udev); + return retval; +} + +enum event_state { + EVENT_QUEUED, + EVENT_FINISHED, + EVENT_FAILED, +}; + +static void export_event_state(struct udevd_uevent_msg *msg, enum event_state state) +{ + char filename[PATH_SIZE]; + char filename_failed[PATH_SIZE]; + size_t start; + + /* location of queue file */ + snprintf(filename, sizeof(filename), "%s/"EVENT_QUEUE_DIR"/%llu", udev_root, msg->seqnum); + + /* location of failed file */ + strlcpy(filename_failed, udev_root, sizeof(filename_failed)); + strlcat(filename_failed, "/", sizeof(filename_failed)); + start = strlcat(filename_failed, EVENT_FAILED_DIR"/", sizeof(filename_failed)); + strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); + path_encode(&filename_failed[start], sizeof(filename_failed) - start); + + switch (state) { + case EVENT_QUEUED: + unlink(filename_failed); + delete_path(filename_failed); + + create_path(filename); + selinux_setfscreatecon(filename, NULL, S_IFLNK); + symlink(msg->devpath, filename); + selinux_resetfscreatecon(); + break; + case EVENT_FINISHED: + if (msg->devpath_old != NULL) { + /* "move" event - rename failed file to current name, do not delete failed */ + char filename_failed_old[PATH_SIZE]; + + strlcpy(filename_failed_old, udev_root, sizeof(filename_failed_old)); + strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); + start = strlcat(filename_failed_old, EVENT_FAILED_DIR"/", sizeof(filename_failed_old)); + strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); + path_encode(&filename_failed_old[start], sizeof(filename) - start); + + if (rename(filename_failed_old, filename_failed) == 0) + info("renamed devpath, moved failed state of '%s' to %s'\n", + msg->devpath_old, msg->devpath); + } else { + unlink(filename_failed); + delete_path(filename_failed); + } + + unlink(filename); + delete_path(filename); + break; + case EVENT_FAILED: + /* move failed event to the failed directory */ + create_path(filename_failed); + rename(filename, filename_failed); + + /* clean up possibly empty queue directory */ + delete_path(filename); + break; + } + + return; +} + +static void msg_queue_delete(struct udevd_uevent_msg *msg) +{ + list_del(&msg->node); + + /* mark as failed, if "add" event returns non-zero */ + if (msg->exitstatus && strcmp(msg->action, "add") == 0) + export_event_state(msg, EVENT_FAILED); + else + export_event_state(msg, EVENT_FINISHED); + + free(msg); +} + +static void udev_event_run(struct udevd_uevent_msg *msg) +{ + pid_t pid; + int retval; + + pid = fork(); + switch (pid) { + case 0: + /* child */ + close(uevent_netlink_sock); + close(udevd_sock); + if (inotify_fd >= 0) + close(inotify_fd); + close(signal_pipe[READ_END]); + close(signal_pipe[WRITE_END]); + logging_close(); + + logging_init("udevd-event"); + setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); + + retval = udev_event_process(msg); + info("seq %llu finished with %i\n", msg->seqnum, retval); + + logging_close(); + if (retval) + exit(1); + exit(0); + case -1: + err("fork of child failed: %s\n", strerror(errno)); + msg_queue_delete(msg); + break; + default: + /* get SIGCHLD in main loop */ + info("seq %llu forked, pid [%d], '%s' '%s', %ld seconds old\n", + msg->seqnum, pid, msg->action, msg->subsystem, time(NULL) - msg->queue_time); + msg->pid = pid; + } +} + +static void msg_queue_insert(struct udevd_uevent_msg *msg) +{ + char filename[PATH_SIZE]; + int fd; + + msg->queue_time = time(NULL); + + export_event_state(msg, EVENT_QUEUED); + info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); + + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); + if (fd >= 0) { + char str[32]; + int len; + + len = sprintf(str, "%llu\n", msg->seqnum); + write(fd, str, len); + close(fd); + } + + /* run one event after the other in debug mode */ + if (debug_trace) { + list_add_tail(&msg->node, &running_list); + udev_event_run(msg); + waitpid(msg->pid, NULL, 0); + msg_queue_delete(msg); + return; + } + + /* run all events with a timeout set immediately */ + if (msg->timeout != 0) { + list_add_tail(&msg->node, &running_list); + udev_event_run(msg); + return; + } + + list_add_tail(&msg->node, &exec_list); + run_exec_q = 1; +} + +static int mem_size_mb(void) +{ + FILE* f; + char buf[4096]; + long int memsize = -1; + + f = fopen("/proc/meminfo", "r"); + if (f == NULL) + return -1; + + while (fgets(buf, sizeof(buf), f) != NULL) { + long int value; + + if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { + memsize = value / 1024; + break; + } + } + + fclose(f); + return memsize; +} + +static int cpu_count(void) +{ + FILE* f; + char buf[4096]; + int count = 0; + + f = fopen("/proc/stat", "r"); + if (f == NULL) + return -1; + + while (fgets(buf, sizeof(buf), f) != NULL) { + if (strncmp(buf, "cpu", 3) == 0 && isdigit(buf[3])) + count++; + } + + fclose(f); + if (count == 0) + return -1; + return count; +} + +static int running_processes(void) +{ + FILE* f; + char buf[4096]; + int running = -1; + + f = fopen("/proc/stat", "r"); + if (f == NULL) + return -1; + + while (fgets(buf, sizeof(buf), f) != NULL) { + int value; + + if (sscanf(buf, "procs_running %u", &value) == 1) { + running = value; + break; + } + } + + fclose(f); + return running; +} + +/* return the number of process es in our session, count only until limit */ +static int running_processes_in_session(pid_t session, int limit) +{ + DIR *dir; + struct dirent *dent; + int running = 0; + + dir = opendir("/proc"); + if (!dir) + return -1; + + /* read process info from /proc */ + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + int f; + char procdir[64]; + char line[256]; + const char *pos; + char state; + pid_t ppid, pgrp, sess; + int len; + + if (!isdigit(dent->d_name[0])) + continue; + + snprintf(procdir, sizeof(procdir), "/proc/%s/stat", dent->d_name); + procdir[sizeof(procdir)-1] = '\0'; + + f = open(procdir, O_RDONLY); + if (f == -1) + continue; + + len = read(f, line, sizeof(line)-1); + close(f); + + if (len <= 0) + continue; + else + line[len] = '\0'; + + /* skip ugly program name */ + pos = strrchr(line, ')') + 2; + if (pos == NULL) + continue; + + if (sscanf(pos, "%c %d %d %d ", &state, &ppid, &pgrp, &sess) != 4) + continue; + + /* count only processes in our session */ + if (sess != session) + continue; + + /* count only running, no sleeping processes */ + if (state != 'R') + continue; + + running++; + if (limit > 0 && running >= limit) + break; + } + closedir(dir); + + return running; +} + +static int compare_devpath(const char *running, const char *waiting) +{ + int i; + + for (i = 0; i < PATH_SIZE; i++) { + /* identical device event found */ + if (running[i] == '\0' && waiting[i] == '\0') + return 1; + + /* parent device event found */ + if (running[i] == '\0' && waiting[i] == '/') + return 2; + + /* child device event found */ + if (running[i] == '/' && waiting[i] == '\0') + return 3; + + /* no matching event */ + if (running[i] != waiting[i]) + break; + } + + return 0; +} + +/* lookup event for identical, parent, child, or physical device */ +static int devpath_busy(struct udevd_uevent_msg *msg, int limit) +{ + struct udevd_uevent_msg *loop_msg; + int childs_count = 0; + + /* check exec-queue which may still contain delayed events we depend on */ + list_for_each_entry(loop_msg, &exec_list, node) { + /* skip ourself and all later events */ + if (loop_msg->seqnum >= msg->seqnum) + break; + + /* check our old name */ + if (msg->devpath_old != NULL) + if (strcmp(loop_msg->devpath , msg->devpath_old) == 0) + return 2; + + /* check identical, parent, or child device event */ + if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { + dbg("%llu, device event still pending %llu (%s)\n", + msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + return 3; + } + + /* check for our major:minor number */ + if (msg->devt && loop_msg->devt == msg->devt && + strcmp(msg->subsystem, loop_msg->subsystem) == 0) { + dbg("%llu, device event still pending %llu (%d:%d)\n", msg->seqnum, + loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); + return 4; + } + + /* check physical device event (special case of parent) */ + if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) + if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { + dbg("%llu, physical device event still pending %llu (%s)\n", + msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + return 5; + } + } + + /* check run queue for still running events */ + list_for_each_entry(loop_msg, &running_list, node) { + if (limit && childs_count++ > limit) { + dbg("%llu, maximum number (%i) of childs reached\n", msg->seqnum, childs_count); + return 1; + } + + /* check our old name */ + if (msg->devpath_old != NULL) + if (strcmp(loop_msg->devpath , msg->devpath_old) == 0) + return 2; + + /* check identical, parent, or child device event */ + if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { + dbg("%llu, device event still running %llu (%s)\n", + msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + return 3; + } + + /* check for our major:minor number */ + if (msg->devt && loop_msg->devt == msg->devt && + strcmp(msg->subsystem, loop_msg->subsystem) == 0) { + dbg("%llu, device event still running %llu (%d:%d)\n", msg->seqnum, + loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); + return 4; + } + + /* check physical device event (special case of parent) */ + if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) + if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { + dbg("%llu, physical device event still running %llu (%s)\n", + msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + return 5; + } + } + return 0; +} + +/* serializes events for the identical and parent and child devices */ +static void msg_queue_manager(void) +{ + struct udevd_uevent_msg *loop_msg; + struct udevd_uevent_msg *tmp_msg; + int running; + + if (list_empty(&exec_list)) + return; + + running = running_processes(); + dbg("%d processes runnning on system\n", running); + if (running < 0) + running = max_childs_running; + + list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, node) { + /* check running processes in our session and possibly throttle */ + if (running >= max_childs_running) { + running = running_processes_in_session(sid, max_childs_running+10); + dbg("at least %d processes running in session\n", running); + if (running >= max_childs_running) { + dbg("delay seq %llu, too many processes already running\n", loop_msg->seqnum); + return; + } + } + + /* serialize and wait for parent or child events */ + if (devpath_busy(loop_msg, max_childs) != 0) { + dbg("delay seq %llu (%s)\n", loop_msg->seqnum, loop_msg->devpath); + continue; + } + + /* move event to run list */ + list_move_tail(&loop_msg->node, &running_list); + udev_event_run(loop_msg); + running++; + dbg("moved seq %llu to running list\n", loop_msg->seqnum); + } +} + +static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) +{ + int bufpos; + int i; + struct udevd_uevent_msg *msg; + char *physdevdriver_key = NULL; + int maj = 0; + int min = 0; + + msg = malloc(sizeof(struct udevd_uevent_msg) + buf_size); + if (msg == NULL) + return NULL; + memset(msg, 0x00, sizeof(struct udevd_uevent_msg) + buf_size); + + /* copy environment buffer and reconstruct envp */ + memcpy(msg->envbuf, buf, buf_size); + bufpos = 0; + for (i = 0; (bufpos < buf_size) && (i < UEVENT_NUM_ENVP-2); i++) { + int keylen; + char *key; + + key = &msg->envbuf[bufpos]; + keylen = strlen(key); + msg->envp[i] = key; + bufpos += keylen + 1; + dbg("add '%s' to msg.envp[%i]\n", msg->envp[i], i); + + /* remember some keys for further processing */ + if (strncmp(key, "ACTION=", 7) == 0) + msg->action = &key[7]; + else if (strncmp(key, "DEVPATH=", 8) == 0) + msg->devpath = &key[8]; + else if (strncmp(key, "SUBSYSTEM=", 10) == 0) + msg->subsystem = &key[10]; + else if (strncmp(key, "DRIVER=", 7) == 0) + msg->driver = &key[7]; + else if (strncmp(key, "SEQNUM=", 7) == 0) + msg->seqnum = strtoull(&key[7], NULL, 10); + else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) + msg->devpath_old = &key[12]; + else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) + msg->physdevpath = &key[12]; + else if (strncmp(key, "PHYSDEVDRIVER=", 14) == 0) + physdevdriver_key = key; + else if (strncmp(key, "MAJOR=", 6) == 0) + maj = strtoull(&key[6], NULL, 10); + else if (strncmp(key, "MINOR=", 6) == 0) + min = strtoull(&key[6], NULL, 10); + else if (strncmp(key, "TIMEOUT=", 8) == 0) + msg->timeout = strtoull(&key[8], NULL, 10); + } + msg->devt = makedev(maj, min); + msg->envp[i++] = "UDEVD_EVENT=1"; + + if (msg->driver == NULL && msg->physdevpath == NULL && physdevdriver_key != NULL) { + /* for older kernels DRIVER is empty for a bus device, export PHYSDEVDRIVER as DRIVER */ + msg->envp[i++] = &physdevdriver_key[7]; + msg->driver = &physdevdriver_key[14]; + } + + msg->envp[i] = NULL; + + if (msg->devpath == NULL || msg->action == NULL) { + info("DEVPATH or ACTION missing, ignore message\n"); + free(msg); + return NULL; + } + return msg; +} + +/* receive the udevd message from userspace */ +static void get_ctrl_msg(void) +{ + struct udevd_ctrl_msg ctrl_msg; + ssize_t size; + struct msghdr smsg; + struct cmsghdr *cmsg; + struct iovec iov; + struct ucred *cred; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + int *intval; + char *pos; + + memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); + iov.iov_base = &ctrl_msg; + iov.iov_len = sizeof(struct udevd_ctrl_msg); + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + + size = recvmsg(udevd_sock, &smsg, 0); + if (size < 0) { + if (errno != EINTR) + err("unable to receive user udevd message: %s\n", strerror(errno)); + return; + } + cmsg = CMSG_FIRSTHDR(&smsg); + cred = (struct ucred *) CMSG_DATA(cmsg); + + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + err("no sender credentials received, message ignored\n"); + return; + } + + if (cred->uid != 0) { + err("sender uid=%i, message ignored\n", cred->uid); + return; + } + + if (strncmp(ctrl_msg.magic, UDEVD_CTRL_MAGIC, sizeof(UDEVD_CTRL_MAGIC)) != 0 ) { + err("message magic '%s' doesn't match, ignore it\n", ctrl_msg.magic); + return; + } + + switch (ctrl_msg.type) { + case UDEVD_CTRL_ENV: + pos = strchr(ctrl_msg.buf, '='); + if (pos == NULL) { + err("wrong key format '%s'\n", ctrl_msg.buf); + break; + } + pos[0] = '\0'; + if (pos[1] == '\0') { + info("udevd message (ENV) received, unset '%s'\n", ctrl_msg.buf); + unsetenv(ctrl_msg.buf); + } else { + info("udevd message (ENV) received, set '%s=%s'\n", ctrl_msg.buf, &pos[1]); + setenv(ctrl_msg.buf, &pos[1], 1); + } + break; + case UDEVD_CTRL_STOP_EXEC_QUEUE: + info("udevd message (STOP_EXEC_QUEUE) received\n"); + stop_exec_q = 1; + break; + case UDEVD_CTRL_START_EXEC_QUEUE: + info("udevd message (START_EXEC_QUEUE) received\n"); + stop_exec_q = 0; + msg_queue_manager(); + break; + case UDEVD_CTRL_SET_LOG_LEVEL: + intval = (int *) ctrl_msg.buf; + info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i\n", *intval); + udev_log_priority = *intval; + sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); + putenv(udev_log); + break; + case UDEVD_CTRL_SET_MAX_CHILDS: + intval = (int *) ctrl_msg.buf; + info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i\n", *intval); + max_childs = *intval; + break; + case UDEVD_CTRL_SET_MAX_CHILDS_RUNNING: + intval = (int *) ctrl_msg.buf; + info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs=%i\n", *intval); + max_childs_running = *intval; + break; + case UDEVD_CTRL_RELOAD_RULES: + info("udevd message (RELOAD_RULES) received\n"); + reload_config = 1; + break; + default: + err("unknown control message type\n"); + } +} + +/* receive the kernel user event message and do some sanity checks */ +static struct udevd_uevent_msg *get_netlink_msg(void) +{ + struct udevd_uevent_msg *msg; + int bufpos; + ssize_t size; + static char buffer[UEVENT_BUFFER_SIZE+512]; + char *pos; + + size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); + if (size < 0) { + if (errno != EINTR) + err("unable to receive kernel netlink message: %s\n", strerror(errno)); + return NULL; + } + + if ((size_t)size > sizeof(buffer)-1) + size = sizeof(buffer)-1; + buffer[size] = '\0'; + dbg("uevent_size=%zi\n", size); + + /* start of event payload */ + bufpos = strlen(buffer)+1; + msg = get_msg_from_envbuf(&buffer[bufpos], size-bufpos); + if (msg == NULL) + return NULL; + + /* validate message */ + pos = strchr(buffer, '@'); + if (pos == NULL) { + err("invalid uevent '%s'\n", buffer); + free(msg); + return NULL; + } + pos[0] = '\0'; + + if (msg->action == NULL) { + info("no ACTION in payload found, skip event '%s'\n", buffer); + free(msg); + return NULL; + } + + if (strcmp(msg->action, buffer) != 0) { + err("ACTION in payload does not match uevent, skip event '%s'\n", buffer); + free(msg); + return NULL; + } + + return msg; +} + +static void asmlinkage sig_handler(int signum) +{ + switch (signum) { + case SIGINT: + case SIGTERM: + udev_exit = 1; + break; + case SIGCHLD: + /* set flag, then write to pipe if needed */ + sigchilds_waiting = 1; + break; + case SIGHUP: + reload_config = 1; + break; + } + + /* write to pipe, which will wakeup select() in our mainloop */ + write(signal_pipe[WRITE_END], "", 1); +} + +static void udev_done(int pid, int exitstatus) +{ + /* find msg associated with pid and delete it */ + struct udevd_uevent_msg *msg; + + list_for_each_entry(msg, &running_list, node) { + if (msg->pid == pid) { + info("seq %llu, pid [%d] exit with %i, %ld seconds old\n", msg->seqnum, msg->pid, + exitstatus, time(NULL) - msg->queue_time); + msg->exitstatus = exitstatus; + msg_queue_delete(msg); + + /* there may be events waiting with the same devpath */ + run_exec_q = 1; + return; + } + } +} + +static void reap_sigchilds(void) +{ + pid_t pid; + int status; + + while (1) { + pid = waitpid(-1, &status, WNOHANG); + if (pid <= 0) + break; + if (WIFEXITED(status)) + status = WEXITSTATUS(status); + else if (WIFSIGNALED(status)) + status = WTERMSIG(status) + 128; + else + status = 0; + udev_done(pid, status); + } +} + +static int init_udevd_socket(void) +{ + struct sockaddr_un saddr; + socklen_t addrlen; + const int feature_on = 1; + int retval; + + memset(&saddr, 0x00, sizeof(saddr)); + saddr.sun_family = AF_LOCAL; + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); + addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + + udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udevd_sock == -1) { + err("error getting socket: %s\n", strerror(errno)); + return -1; + } + + /* the bind takes care of ensuring only one copy running */ + retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); + if (retval < 0) { + err("bind failed: %s\n", strerror(errno)); + close(udevd_sock); + udevd_sock = -1; + return -1; + } + + /* enable receiving of the sender credentials */ + setsockopt(udevd_sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); + + return 0; +} + +static int init_uevent_netlink_sock(void) +{ + struct sockaddr_nl snl; + const int buffersize = 16 * 1024 * 1024; + int retval; + + memset(&snl, 0x00, sizeof(struct sockaddr_nl)); + snl.nl_family = AF_NETLINK; + snl.nl_pid = getpid(); + snl.nl_groups = 1; + + uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + if (uevent_netlink_sock == -1) { + err("error getting socket: %s\n", strerror(errno)); + return -1; + } + + /* set receive buffersize */ + setsockopt(uevent_netlink_sock, SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize)); + + retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); + if (retval < 0) { + err("bind failed: %s\n", strerror(errno)); + close(uevent_netlink_sock); + uevent_netlink_sock = -1; + return -1; + } + return 0; +} + +static void export_initial_seqnum(void) +{ + char filename[PATH_SIZE]; + int fd; + char seqnum[32]; + ssize_t len = 0; + + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd >= 0) { + len = read(fd, seqnum, sizeof(seqnum)-1); + close(fd); + } + if (len <= 0) { + strcpy(seqnum, "0\n"); + len = 3; + } + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + create_path(filename); + fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); + if (fd >= 0) { + write(fd, seqnum, len); + close(fd); + } +} + +int main(int argc, char *argv[], char *envp[]) +{ + int retval; + int fd; + struct sigaction act; + fd_set readfds; + const char *value; + int daemonize = 0; + int option; + static const struct option options[] = { + { "daemon", 0, NULL, 'd' }, + { "debug-trace", 0, NULL, 't' }, + { "debug", 0, NULL, 'D' }, + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + {} + }; + int rc = 1; + int maxfd; + + logging_init("udevd"); + udev_config_init(); + selinux_init(); + dbg("version %s\n", UDEV_VERSION); + + while (1) { + option = getopt_long(argc, argv, "dDthV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + daemonize = 1; + break; + case 't': + debug_trace = 1; + break; + case 'D': + debug = 1; + if (udev_log_priority < LOG_INFO) + udev_log_priority = LOG_INFO; + break; + case 'h': + printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n"); + goto exit; + case 'V': + printf("%s\n", UDEV_VERSION); + goto exit; + default: + goto exit; + } + } + + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); + err("root privileges required\n"); + goto exit; + } + + /* make sure std{in,out,err} fd's are in a sane state */ + fd = open("/dev/null", O_RDWR); + if (fd < 0) { + fprintf(stderr, "cannot open /dev/null\n"); + err("cannot open /dev/null\n"); + } + if (fd > STDIN_FILENO) + dup2(fd, STDIN_FILENO); + if (write(STDOUT_FILENO, 0, 0) < 0) + dup2(fd, STDOUT_FILENO); + if (write(STDERR_FILENO, 0, 0) < 0) + dup2(fd, STDERR_FILENO); + + /* init sockets to receive events */ + if (init_udevd_socket() < 0) { + if (errno == EADDRINUSE) { + fprintf(stderr, "another udev daemon already running\n"); + err("another udev daemon already running\n"); + rc = 1; + } else { + fprintf(stderr, "error initializing udevd socket\n"); + err("error initializing udevd socket\n"); + rc = 2; + } + goto exit; + } + + if (init_uevent_netlink_sock() < 0) { + fprintf(stderr, "error initializing netlink socket\n"); + err("error initializing netlink socket\n"); + rc = 3; + goto exit; + } + + /* setup signal handler pipe */ + retval = pipe(signal_pipe); + if (retval < 0) { + err("error getting pipes: %s\n", strerror(errno)); + goto exit; + } + + retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); + if (retval < 0) { + err("error fcntl on read pipe: %s\n", strerror(errno)); + goto exit; + } + retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); + if (retval < 0) { + err("error fcntl on read pipe: %s\n", strerror(errno)); + goto exit; + } + + retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); + if (retval < 0) { + err("error fcntl on write pipe: %s\n", strerror(errno)); + goto exit; + } + retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); + if (retval < 0) { + err("error fcntl on write pipe: %s\n", strerror(errno)); + goto exit; + } + + /* parse the rules and keep them in memory */ + sysfs_init(); + udev_rules_init(&rules, 1); + + export_initial_seqnum(); + + if (daemonize) { + pid_t pid; + + pid = fork(); + switch (pid) { + case 0: + dbg("daemonized fork running\n"); + break; + case -1: + err("fork of daemon failed: %s\n", strerror(errno)); + rc = 4; + goto exit; + default: + dbg("child [%u] running, parent exits\n", pid); + rc = 0; + goto exit; + } + } + + /* redirect std{out,err} fd's */ + if (!debug) + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) + close(fd); + + /* set scheduling priority for the daemon */ + setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); + + chdir("/"); + umask(022); + + /* become session leader */ + sid = setsid(); + dbg("our session is %d\n", sid); + + /* OOM_DISABLE == -17 */ + fd = open("/proc/self/oom_adj", O_RDWR); + if (fd < 0) + err("error disabling OOM: %s\n", strerror(errno)); + else { + write(fd, "-17", 3); + close(fd); + } + + fd = open("/dev/kmsg", O_WRONLY); + if (fd > 0) { + const char *str = "<6>udevd version " UDEV_VERSION " started\n"; + + write(fd, str, strlen(str)); + close(fd); + } + + /* set signal handlers */ + memset(&act, 0x00, sizeof(struct sigaction)); + act.sa_handler = (void (*)(int)) sig_handler; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_RESTART; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + sigaction(SIGCHLD, &act, NULL); + sigaction(SIGHUP, &act, NULL); + + /* watch rules directory */ + inotify_fd = inotify_init(); + if (inotify_fd >= 0) { + if (udev_rules_dir[0] != '\0') { + inotify_add_watch(inotify_fd, udev_rules_dir, + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + } else { + char filename[PATH_MAX]; + + inotify_add_watch(inotify_fd, RULES_LIB_DIR, + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + inotify_add_watch(inotify_fd, RULES_ETC_DIR, + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + + /* watch dynamic rules directory */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); + inotify_add_watch(inotify_fd, filename, + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + } + } else if (errno == ENOSYS) + err("the kernel does not support inotify, udevd can't monitor rules file changes\n"); + else + err("inotify_init failed: %s\n", strerror(errno)); + + /* maximum limit of forked childs */ + value = getenv("UDEVD_MAX_CHILDS"); + if (value) + max_childs = strtoul(value, NULL, 10); + else { + int memsize = mem_size_mb(); + if (memsize > 0) + max_childs = 128 + (memsize / 4); + else + max_childs = UDEVD_MAX_CHILDS; + } + info("initialize max_childs to %u\n", max_childs); + + /* start to throttle forking if maximum number of _running_ childs is reached */ + value = getenv("UDEVD_MAX_CHILDS_RUNNING"); + if (value) + max_childs_running = strtoull(value, NULL, 10); + else { + int cpus = cpu_count(); + if (cpus > 0) + max_childs_running = 8 + (8 * cpus); + else + max_childs_running = UDEVD_MAX_CHILDS_RUNNING; + } + info("initialize max_childs_running to %u\n", max_childs_running); + + /* clear environment for forked event processes */ + clearenv(); + + /* export log_priority , as called programs may want to follow that setting */ + sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); + putenv(udev_log); + if (debug_trace) + putenv("DEBUG=1"); + + maxfd = udevd_sock; + maxfd = UDEV_MAX(maxfd, uevent_netlink_sock); + maxfd = UDEV_MAX(maxfd, signal_pipe[READ_END]); + maxfd = UDEV_MAX(maxfd, inotify_fd); + + while (!udev_exit) { + struct udevd_uevent_msg *msg; + int fdcount; + + FD_ZERO(&readfds); + FD_SET(signal_pipe[READ_END], &readfds); + FD_SET(udevd_sock, &readfds); + FD_SET(uevent_netlink_sock, &readfds); + if (inotify_fd >= 0) + FD_SET(inotify_fd, &readfds); + + fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno != EINTR) + err("error in select: %s\n", strerror(errno)); + continue; + } + + /* get control message */ + if (FD_ISSET(udevd_sock, &readfds)) + get_ctrl_msg(); + + /* get netlink message */ + if (FD_ISSET(uevent_netlink_sock, &readfds)) { + msg = get_netlink_msg(); + if (msg) + msg_queue_insert(msg); + } + + /* received a signal, clear our notification pipe */ + if (FD_ISSET(signal_pipe[READ_END], &readfds)) { + char buf[256]; + + read(signal_pipe[READ_END], &buf, sizeof(buf)); + } + + /* rules directory inotify watch */ + if ((inotify_fd >= 0) && FD_ISSET(inotify_fd, &readfds)) { + int nbytes; + + /* discard all possible events, we can just reload the config */ + if ((ioctl(inotify_fd, FIONREAD, &nbytes) == 0) && nbytes > 0) { + char *buf; + + reload_config = 1; + buf = malloc(nbytes); + if (buf == NULL) { + err("error getting buffer for inotify, disable watching\n"); + close(inotify_fd); + inotify_fd = -1; + } + read(inotify_fd, buf, nbytes); + free(buf); + } + } + + /* rules changed, set by inotify or a HUP signal */ + if (reload_config) { + reload_config = 0; + udev_rules_cleanup(&rules); + udev_rules_init(&rules, 1); + } + + /* forked child has returned */ + if (sigchilds_waiting) { + sigchilds_waiting = 0; + reap_sigchilds(); + } + + if (run_exec_q) { + run_exec_q = 0; + if (!stop_exec_q) + msg_queue_manager(); + } + } + rc = 0; + +exit: + udev_rules_cleanup(&rules); + sysfs_cleanup(); + selinux_exit(); + + if (signal_pipe[READ_END] >= 0) + close(signal_pipe[READ_END]); + if (signal_pipe[WRITE_END] >= 0) + close(signal_pipe[WRITE_END]); + + if (udevd_sock >= 0) + close(udevd_sock); + if (inotify_fd >= 0) + close(inotify_fd); + if (uevent_netlink_sock >= 0) + close(uevent_netlink_sock); + + logging_close(); + + return rc; +} diff --git a/udev/udevd.h b/udev/udevd.h new file mode 100644 index 0000000000..9be34cb0cc --- /dev/null +++ b/udev/udevd.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2004 Ling, Xiaofeng + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "list.h" + +#define UDEVD_PRIORITY -4 +#define UDEV_PRIORITY -2 + +#define EVENT_QUEUE_DIR ".udev/queue" +#define EVENT_FAILED_DIR ".udev/failed" +#define EVENT_SEQNUM ".udev/uevent_seqnum" + +/* maximum limit of forked childs */ +#define UDEVD_MAX_CHILDS 256 +/* start to throttle forking if maximum number of running childs in our session is reached */ +#define UDEVD_MAX_CHILDS_RUNNING 16 + +/* linux/include/linux/kobject.h */ +#define UEVENT_BUFFER_SIZE 2048 +#define UEVENT_NUM_ENVP 32 + +#define UDEVD_CTRL_SOCK_PATH "/org/kernel/udev/udevd" +#define UDEVD_CTRL_MAGIC "udevd_" UDEV_VERSION + +enum udevd_ctrl_msg_type { + UDEVD_CTRL_UNKNOWN, + UDEVD_CTRL_STOP_EXEC_QUEUE, + UDEVD_CTRL_START_EXEC_QUEUE, + UDEVD_CTRL_SET_LOG_LEVEL, + UDEVD_CTRL_SET_MAX_CHILDS, + UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, + UDEVD_CTRL_RELOAD_RULES, + UDEVD_CTRL_ENV, +}; + +struct udevd_ctrl_msg { + char magic[32]; + enum udevd_ctrl_msg_type type; + char buf[256]; +}; + +struct udevd_uevent_msg { + struct list_head node; + pid_t pid; + int exitstatus; + time_t queue_time; + char *action; + char *devpath; + char *subsystem; + char *driver; + dev_t devt; + unsigned long long seqnum; + char *devpath_old; + char *physdevpath; + unsigned int timeout; + char *envp[UEVENT_NUM_ENVP+1]; + char envbuf[]; +}; diff --git a/udev/udevd.xml b/udev/udevd.xml new file mode 100644 index 0000000000..8d22a0c14d --- /dev/null +++ b/udev/udevd.xml @@ -0,0 +1,108 @@ + + + +
                    +
                    + udevd + + + udevd + August 2005 + udev + + + + udevd + 8 + + + + + udevdevent managing daemon + + + + + udevd + + + + + + + + + DESCRIPTION + udevd listens to kernel uevents and passes the incoming events to + udev. It ensures the correct event order and takes care, that events for child + devices are delayed until the parent event has finished the device handling. + The behavior of the running daemon can be changed with + udevadm control. + + + OPTIONS + + + + + Detach and run in the background. + + + + + + Run all events completely serialized. This may be useful if udev triggers + actions or loads kernel modules which cause problems and a slow but continuous + operation is needed, where no events are processed in parallel. + + + + + + + Print log messages to stdout. + + + + + + Print version number. + + + + + + Print help text. + + + + + + ENVIRONMENT + + + + + Overrides the syslog priority specified in the config file. + + + + + + AUTHOR + Written by Kay Sievers kay.sievers@vrfy.org. + + + + SEE ALSO + + udev7 + , + + udevadm8 + + + +
                    +
                    diff --git a/udev/udevinfo.c b/udev/udevinfo.c new file mode 100644 index 0000000000..b9ee17c4f1 --- /dev/null +++ b/udev/udevinfo.c @@ -0,0 +1,500 @@ +/* + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static void print_all_attributes(const char *devpath, const char *key) +{ + char path[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + + dir = opendir(path); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat statbuf; + char filename[PATH_SIZE]; + char *attr_value; + char value[NAME_SIZE]; + size_t len; + + if (dent->d_name[0] == '.') + continue; + + if (strcmp(dent->d_name, "uevent") == 0) + continue; + if (strcmp(dent->d_name, "dev") == 0) + continue; + + strlcpy(filename, path, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, dent->d_name, sizeof(filename)); + if (lstat(filename, &statbuf) != 0) + continue; + if (S_ISLNK(statbuf.st_mode)) + continue; + + attr_value = sysfs_attr_get_value(devpath, dent->d_name); + if (attr_value == NULL) + continue; + len = strlcpy(value, attr_value, sizeof(value)); + if(len >= sizeof(value)) + len = sizeof(value) - 1; + dbg("attr '%s'='%s'(%zi)\n", dent->d_name, value, len); + + /* remove trailing newlines */ + while (len && value[len-1] == '\n') + value[--len] = '\0'; + + /* skip nonprintable attributes */ + while (len && isprint(value[len-1])) + len--; + if (len) { + dbg("attribute value of '%s' non-printable, skip\n", dent->d_name); + continue; + } + + printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); + } + } + printf("\n"); +} + +static int print_device_chain(const char *devpath) +{ + struct sysfs_device *dev; + + dev = sysfs_device_get(devpath); + if (dev == NULL) + return -1; + + printf("\n" + "Udevinfo starts with the device specified by the devpath and then\n" + "walks up the chain of parent devices. It prints for every device\n" + "found, all possible attributes in the udev rules key format.\n" + "A rule to match, can be composed by the attributes of the device\n" + "and the attributes from one single parent device.\n" + "\n"); + + printf(" looking at device '%s':\n", dev->devpath); + printf(" KERNEL==\"%s\"\n", dev->kernel); + printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); + printf(" DRIVER==\"%s\"\n", dev->driver); + print_all_attributes(dev->devpath, "ATTR"); + + /* walk up the chain of devices */ + while (1) { + dev = sysfs_device_get_parent(dev); + if (dev == NULL) + break; + printf(" looking at parent device '%s':\n", dev->devpath); + printf(" KERNELS==\"%s\"\n", dev->kernel); + printf(" SUBSYSTEMS==\"%s\"\n", dev->subsystem); + printf(" DRIVERS==\"%s\"\n", dev->driver); + + print_all_attributes(dev->devpath, "ATTRS"); + } + + return 0; +} + +static void print_record(struct udevice *udev) +{ + struct name_entry *name_loop; + + printf("P: %s\n", udev->dev->devpath); + printf("N: %s\n", udev->name); + list_for_each_entry(name_loop, &udev->symlink_list, node) + printf("S: %s\n", name_loop->name); + if (udev->link_priority != 0) + printf("L: %i\n", udev->link_priority); + if (udev->partitions != 0) + printf("A:%u\n", udev->partitions); + if (udev->ignore_remove) + printf("R:%u\n", udev->ignore_remove); + list_for_each_entry(name_loop, &udev->env_list, node) + printf("E: %s\n", name_loop->name); +} + +static void export_db(void) { + LIST_HEAD(name_list); + struct name_entry *name_loop; + + udev_db_get_all_entries(&name_list); + list_for_each_entry(name_loop, &name_list, node) { + struct udevice *udev_db; + + udev_db = udev_device_init(NULL); + if (udev_db == NULL) + continue; + if (udev_db_get_device(udev_db, name_loop->name) == 0) + print_record(udev_db); + printf("\n"); + udev_device_cleanup(udev_db); + } + name_list_cleanup(&name_list); +} + +static int lookup_device_by_name(struct udevice *udev, const char *name) +{ + LIST_HEAD(name_list); + int count; + struct name_entry *device; + int rc = -1; + + count = udev_db_get_devices_by_name(name, &name_list); + if (count <= 0) + goto out; + + info("found %i devices for '%s'\n", count, name); + + /* select the device that seems to match */ + list_for_each_entry(device, &name_list, node) { + char filename[PATH_SIZE]; + struct stat statbuf; + + udev_device_init(udev); + if (udev_db_get_device(udev, device->name) != 0) + continue; + info("found db entry '%s'\n", device->name); + + /* make sure, we don't get a link of a differnt device */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, name, sizeof(filename)); + if (stat(filename, &statbuf) != 0) + continue; + if (major(udev->devt) > 0 && udev->devt != statbuf.st_rdev) { + info("skip '%s', dev_t doesn't match\n", udev->name); + continue; + } + rc = 0; + break; + } +out: + name_list_cleanup(&name_list); + return rc; +} + +static int stat_device(const char *name, int export, const char *prefix) +{ + struct stat statbuf; + + if (stat(name, &statbuf) != 0) + return -1; + + if (export) { + if (prefix == NULL) + prefix = "INFO_"; + printf("%sMAJOR=%d\n" + "%sMINOR=%d\n", + prefix, major(statbuf.st_dev), + prefix, minor(statbuf.st_dev)); + } else + printf("%d %d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); + return 0; +} + +int udevinfo(int argc, char *argv[], char *envp[]) +{ + int option; + struct udevice *udev; + int root = 0; + int export = 0; + const char *export_prefix = NULL; + + static const struct option options[] = { + { "name", 1, NULL, 'n' }, + { "path", 1, NULL, 'p' }, + { "query", 1, NULL, 'q' }, + { "attribute-walk", 0, NULL, 'a' }, + { "export-db", 0, NULL, 'e' }, + { "root", 0, NULL, 'r' }, + { "device-id-of-file", 1, NULL, 'd' }, + { "export", 0, NULL, 'x' }, + { "export-prefix", 1, NULL, 'P' }, + { "version", 0, NULL, 1 }, /* -V outputs braindead format */ + { "help", 0, NULL, 'h' }, + {} + }; + + enum action_type { + ACTION_NONE, + ACTION_QUERY, + ACTION_ATTRIBUTE_WALK, + ACTION_ROOT, + ACTION_DEVICE_ID_FILE, + } action = ACTION_NONE; + + enum query_type { + QUERY_NONE, + QUERY_NAME, + QUERY_PATH, + QUERY_SYMLINK, + QUERY_ENV, + QUERY_ALL, + } query = QUERY_NONE; + + char path[PATH_SIZE] = ""; + char name[PATH_SIZE] = ""; + struct name_entry *name_loop; + int rc = 0; + + logging_init("udevinfo"); + udev_config_init(); + sysfs_init(); + + udev = udev_device_init(NULL); + if (udev == NULL) { + rc = 1; + goto exit; + } + + while (1) { + option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); + if (option == -1) + break; + + dbg("option '%c'\n", option); + switch (option) { + case 'n': + /* remove /dev if given */ + if (strncmp(optarg, udev_root, strlen(udev_root)) == 0) + strlcpy(name, &optarg[strlen(udev_root)+1], sizeof(name)); + else + strlcpy(name, optarg, sizeof(name)); + remove_trailing_chars(name, '/'); + dbg("name: %s\n", name); + break; + case 'p': + /* remove /sys if given */ + if (strncmp(optarg, sysfs_path, strlen(sysfs_path)) == 0) + strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path)); + else + strlcpy(path, optarg, sizeof(path)); + remove_trailing_chars(path, '/'); + + /* possibly resolve to real devpath */ + if (sysfs_resolve_link(path, sizeof(path)) != 0) { + char temp[PATH_SIZE]; + char *pos; + + /* also check if the parent is a link */ + strlcpy(temp, path, sizeof(temp)); + pos = strrchr(temp, '/'); + if (pos != 0) { + char tail[PATH_SIZE]; + + strlcpy(tail, pos, sizeof(tail)); + pos[0] = '\0'; + if (sysfs_resolve_link(temp, sizeof(temp)) == 0) { + strlcpy(path, temp, sizeof(path)); + strlcat(path, tail, sizeof(path)); + } + } + } + dbg("path: %s\n", path); + break; + case 'q': + action = ACTION_QUERY; + if (strcmp(optarg, "name") == 0) { + query = QUERY_NAME; + break; + } + if (strcmp(optarg, "symlink") == 0) { + query = QUERY_SYMLINK; + break; + } + if (strcmp(optarg, "path") == 0) { + query = QUERY_PATH; + break; + } + if (strcmp(optarg, "env") == 0) { + query = QUERY_ENV; + break; + } + if (strcmp(optarg, "all") == 0) { + query = QUERY_ALL; + break; + } + fprintf(stderr, "unknown query type\n"); + rc = 2; + goto exit; + case 'r': + if (action == ACTION_NONE) + action = ACTION_ROOT; + root = 1; + break; + case 'd': + action = ACTION_DEVICE_ID_FILE; + strlcpy(name, optarg, sizeof(name)); + break; + case 'a': + action = ACTION_ATTRIBUTE_WALK; + break; + case 'e': + export_db(); + goto exit; + case 'x': + export = 1; + break; + case 'P': + export_prefix = optarg; + break; + case 1: + printf("%s\n", UDEV_VERSION); + goto exit; + case 'V': + printf("udevinfo, version %s\n", UDEV_VERSION); + goto exit; + case 'h': + printf("Usage: udevadm info OPTIONS\n" + " --query= query database for the specified value:\n" + " name name of device node\n" + " symlink pointing to node\n" + " path sysfs device path\n" + " env the device related imported environment\n" + " all all values\n" + " --path= sysfs device path used for query or chain\n" + " --name= node or symlink name used for query\n" + " --root prepend to query result or print udev_root\n" + " --attribute-walk print all key matches while walking along chain\n" + " of parent devices\n" + " --device-id-of-file= print major/minor of underlying device\n" + " --export-db export the content of the udev database\n" + " --help print this text\n" + "\n"); + goto exit; + default: + goto exit; + } + } + + /* run action */ + switch (action) { + case ACTION_QUERY: + /* needs devpath or node/symlink name for query */ + if (path[0] != '\0') { + if (udev_db_get_device(udev, path) != 0) { + fprintf(stderr, "no record for '%s' in database\n", path); + rc = 3; + goto exit; + } + } else if (name[0] != '\0') { + if (lookup_device_by_name(udev, name) != 0) { + fprintf(stderr, "node name not found\n"); + rc = 4; + goto exit; + } + } else { + fprintf(stderr, "query needs --path or node --name specified\n"); + rc = 4; + goto exit; + } + + switch(query) { + case QUERY_NAME: + if (root) + printf("%s/%s\n", udev_root, udev->name); + else + printf("%s\n", udev->name); + break; + case QUERY_SYMLINK: + list_for_each_entry(name_loop, &udev->symlink_list, node) { + char c = name_loop->node.next != &udev->symlink_list ? ' ' : '\n'; + + if (root) + printf("%s/%s%c", udev_root, name_loop->name, c); + else + printf("%s%c", name_loop->name, c); + } + break; + case QUERY_PATH: + printf("%s\n", udev->dev->devpath); + goto exit; + case QUERY_ENV: + list_for_each_entry(name_loop, &udev->env_list, node) + printf("%s\n", name_loop->name); + break; + case QUERY_ALL: + print_record(udev); + break; + default: + fprintf(stderr, "unknown query type\n"); + break; + } + break; + case ACTION_ATTRIBUTE_WALK: + if (path[0] != '\0') { + if (print_device_chain(path) != 0) { + fprintf(stderr, "no valid sysfs device found\n"); + rc = 4; + goto exit; + } + } else if (name[0] != '\0') { + if (lookup_device_by_name(udev, name) != 0) { + fprintf(stderr, "node name not found\n"); + rc = 4; + goto exit; + } + if (print_device_chain(udev->dev->devpath) != 0) { + fprintf(stderr, "no valid sysfs device found\n"); + rc = 4; + goto exit; + } + } else { + fprintf(stderr, "attribute walk needs --path or node --name specified\n"); + rc = 5; + goto exit; + } + break; + case ACTION_DEVICE_ID_FILE: + if (stat_device(name, export, export_prefix) != 0) + rc = 6; + break; + case ACTION_ROOT: + printf("%s\n", udev_root); + break; + default: + fprintf(stderr, "missing option\n"); + rc = 1; + break; + } + +exit: + udev_device_cleanup(udev); + sysfs_cleanup(); + logging_close(); + return rc; +} diff --git a/udev/udevmonitor.c b/udev/udevmonitor.c new file mode 100644 index 0000000000..2430dd39a5 --- /dev/null +++ b/udev/udevmonitor.c @@ -0,0 +1,289 @@ +/* + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" + +static int uevent_netlink_sock = -1; +static int udev_monitor_sock = -1; +static volatile int udev_exit; + +static int init_udev_monitor_socket(void) +{ + struct sockaddr_un saddr; + socklen_t addrlen; + int retval; + + memset(&saddr, 0x00, sizeof(saddr)); + saddr.sun_family = AF_LOCAL; + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], "/org/kernel/udev/monitor"); + addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + + udev_monitor_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udev_monitor_sock == -1) { + fprintf(stderr, "error getting socket: %s\n", strerror(errno)); + return -1; + } + + /* the bind takes care of ensuring only one copy running */ + retval = bind(udev_monitor_sock, (struct sockaddr *) &saddr, addrlen); + if (retval < 0) { + fprintf(stderr, "bind failed: %s\n", strerror(errno)); + close(udev_monitor_sock); + udev_monitor_sock = -1; + return -1; + } + + return 0; +} + +static int init_uevent_netlink_sock(void) +{ + struct sockaddr_nl snl; + int retval; + + memset(&snl, 0x00, sizeof(struct sockaddr_nl)); + snl.nl_family = AF_NETLINK; + snl.nl_pid = getpid(); + snl.nl_groups = 1; + + uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + if (uevent_netlink_sock == -1) { + fprintf(stderr, "error getting socket: %s\n", strerror(errno)); + return -1; + } + + retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, + sizeof(struct sockaddr_nl)); + if (retval < 0) { + fprintf(stderr, "bind failed: %s\n", strerror(errno)); + close(uevent_netlink_sock); + uevent_netlink_sock = -1; + return -1; + } + + return 0; +} + +static void asmlinkage sig_handler(int signum) +{ + if (signum == SIGINT || signum == SIGTERM) + udev_exit = 1; +} + +static const char *search_key(const char *searchkey, const char *buf, size_t buflen) +{ + size_t bufpos = 0; + size_t searchkeylen = strlen(searchkey); + + while (bufpos < buflen) { + const char *key; + int keylen; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + if ((strncmp(searchkey, key, searchkeylen) == 0) && key[searchkeylen] == '=') + return &key[searchkeylen + 1]; + bufpos += keylen + 1; + } + return NULL; +} + +int udevmonitor(int argc, char *argv[], char *envp[]) +{ + struct sigaction act; + int option; + int env = 0; + int kernel = 0; + int udev = 0; + fd_set readfds; + int retval = 0; + + static const struct option options[] = { + { "environment", 0, NULL, 'e' }, + { "kernel", 0, NULL, 'k' }, + { "udev", 0, NULL, 'u' }, + { "help", 0, NULL, 'h' }, + {} + }; + + while (1) { + option = getopt_long(argc, argv, "ekuh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'e': + env = 1; + break; + case 'k': + kernel = 1; + break; + case 'u': + udev = 1; + break; + case 'h': + printf("Usage: udevadm monitor [--environment] [--kernel] [--udev] [--help]\n" + " --env print the whole event environment\n" + " --kernel print kernel uevents\n" + " --udev print udev events\n" + " --help print this help text\n\n"); + default: + goto out; + } + } + + if (!kernel && !udev) { + kernel = 1; + udev =1; + } + + if (getuid() != 0 && kernel) { + fprintf(stderr, "root privileges needed to subscribe to kernel events\n"); + goto out; + } + + /* set signal handlers */ + memset(&act, 0x00, sizeof(struct sigaction)); + act.sa_handler = (void (*)(int)) sig_handler; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_RESTART; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + + printf("udevmonitor will print the received events for:\n"); + if (udev) { + retval = init_udev_monitor_socket(); + if (retval) + goto out; + printf("UDEV the event which udev sends out after rule processing\n"); + } + if (kernel) { + retval = init_uevent_netlink_sock(); + if (retval) + goto out; + printf("UEVENT the kernel uevent\n"); + } + printf("\n"); + + while (!udev_exit) { + char buf[UEVENT_BUFFER_SIZE*2]; + ssize_t buflen; + ssize_t bufpos; + ssize_t keys; + int fdcount; + struct timeval tv; + struct timezone tz; + char timestr[64]; + const char *source = NULL; + const char *devpath, *action, *subsys; + + buflen = 0; + FD_ZERO(&readfds); + if (uevent_netlink_sock >= 0) + FD_SET(uevent_netlink_sock, &readfds); + if (udev_monitor_sock >= 0) + FD_SET(udev_monitor_sock, &readfds); + + fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno != EINTR) + fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); + continue; + } + + if (gettimeofday(&tv, &tz) == 0) { + snprintf(timestr, sizeof(timestr), "%llu.%06u", + (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec); + } else + timestr[0] = '\0'; + + if ((uevent_netlink_sock >= 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { + buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); + if (buflen <= 0) { + fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); + continue; + } + source = "UEVENT"; + } + + if ((udev_monitor_sock >= 0) && FD_ISSET(udev_monitor_sock, &readfds)) { + buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); + if (buflen <= 0) { + fprintf(stderr, "error receiving udev message: %s\n", strerror(errno)); + continue; + } + source = "UDEV "; + } + + if (buflen == 0) + continue; + + keys = strlen(buf) + 1; /* start of payload */ + devpath = search_key("DEVPATH", &buf[keys], buflen); + action = search_key("ACTION", &buf[keys], buflen); + subsys = search_key("SUBSYSTEM", &buf[keys], buflen); + printf("%s[%s] %-8s %s (%s)\n", source, timestr, action, devpath, subsys); + + /* print environment */ + bufpos = keys; + if (env) { + while (bufpos < buflen) { + int keylen; + char *key; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + printf("%s\n", key); + bufpos += keylen + 1; + } + printf("\n"); + } + } + +out: + if (uevent_netlink_sock >= 0) + close(uevent_netlink_sock); + if (udev_monitor_sock >= 0) + close(udev_monitor_sock); + + if (retval) + return 1; + return 0; +} diff --git a/udev/udevsettle.c b/udev/udevsettle.c new file mode 100644 index 0000000000..cb63a66bba --- /dev/null +++ b/udev/udevsettle.c @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" + +#define DEFAULT_TIMEOUT 180 +#define LOOP_PER_SECOND 20 + +static void print_queue(const char *dir) +{ + LIST_HEAD(files); + struct name_entry *item; + + if (add_matching_files(&files, dir, NULL) < 0) + return; + + printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n"); + + list_for_each_entry(item, &files, node) { + char target[NAME_SIZE]; + size_t len; + const char *filename = strrchr(item->name, '/'); + + if (filename == NULL) + continue; + filename++; + if (*filename == '\0') + continue; + + len = readlink(item->name, target, sizeof(target)); + if (len < 0) + continue; + target[len] = '\0'; + + printf("%s: %s\n", filename, target); + } + + printf("\n\n"); +} + +int udevsettle(int argc, char *argv[], char *envp[]) +{ + char queuename[PATH_SIZE]; + char filename[PATH_SIZE]; + unsigned long long seq_kernel; + unsigned long long seq_udev; + char seqnum[32]; + int fd; + ssize_t len; + int timeout = DEFAULT_TIMEOUT; + int loop; + static const struct option options[] = { + { "timeout", 1, NULL, 't' }, + { "help", 0, NULL, 'h' }, + {} + }; + int option; + int rc = 1; + int seconds; + + logging_init("udevsettle"); + udev_config_init(); + dbg("version %s\n", UDEV_VERSION); + sysfs_init(); + + while (1) { + option = getopt_long(argc, argv, "t:h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 't': + seconds = atoi(optarg); + if (seconds > 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); + dbg("timeout=%i\n", timeout); + break; + case 'h': + printf("Usage: udevadm settle [--help] [--timeout=]\n\n"); + goto exit; + } + } + + strlcpy(queuename, udev_root, sizeof(queuename)); + strlcat(queuename, "/" EVENT_QUEUE_DIR, sizeof(queuename)); + + loop = timeout * LOOP_PER_SECOND; + while (loop--) { + /* wait for events in queue to finish */ + while (loop--) { + struct stat statbuf; + + if (stat(queuename, &statbuf) < 0) { + info("queue is empty\n"); + break; + } + usleep(1000 * 1000 / LOOP_PER_SECOND); + } + if (loop <= 0) { + info("timeout waiting for queue\n"); + print_queue(queuename); + goto exit; + } + + /* read current udev seqnum */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd < 0) + goto exit; + len = read(fd, seqnum, sizeof(seqnum)-1); + close(fd); + if (len <= 0) + goto exit; + seqnum[len] = '\0'; + seq_udev = strtoull(seqnum, NULL, 10); + info("udev seqnum = %llu\n", seq_udev); + + /* read current kernel seqnum */ + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd < 0) + goto exit; + len = read(fd, seqnum, sizeof(seqnum)-1); + close(fd); + if (len <= 0) + goto exit; + seqnum[len] = '\0'; + seq_kernel = strtoull(seqnum, NULL, 10); + info("kernel seqnum = %llu\n", seq_kernel); + + /* make sure all kernel events have arrived in the queue */ + if (seq_udev >= seq_kernel) { + info("queue is empty and no pending events left\n"); + rc = 0; + goto exit; + } + usleep(1000 * 1000 / LOOP_PER_SECOND); + info("queue is empty, but events still pending\n"); + } + +exit: + sysfs_cleanup(); + logging_close(); + return rc; +} diff --git a/udev/udevtest.c b/udev/udevtest.c new file mode 100644 index 0000000000..d5e90b02c6 --- /dev/null +++ b/udev/udevtest.c @@ -0,0 +1,207 @@ +/* + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" + +static int import_uevent_var(const char *devpath) +{ + char path[PATH_SIZE]; + static char value[4096]; /* must stay, used with putenv */ + ssize_t size; + int fd; + char *key; + char *next; + int rc = -1; + + /* read uevent file */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/uevent", sizeof(path)); + fd = open(path, O_RDONLY); + if (fd < 0) + goto out; + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + value[size] = '\0'; + + /* import keys into environment */ + key = value; + while (key[0] != '\0') { + next = strchr(key, '\n'); + if (next == NULL) + goto out; + next[0] = '\0'; + info("import into environment: '%s'\n", key); + putenv(key); + key = &next[1]; + } + rc = 0; +out: + return rc; +} + +int udevtest(int argc, char *argv[], char *envp[]) +{ + int force = 0; + const char *action = "add"; + const char *subsystem = NULL; + const char *devpath = NULL; + struct udevice *udev; + struct sysfs_device *dev; + struct udev_rules rules = {}; + int retval; + int rc = 0; + + static const struct option options[] = { + { "action", 1, NULL, 'a' }, + { "subsystem", 1, NULL, 's' }, + { "force", 0, NULL, 'f' }, + { "help", 0, NULL, 'h' }, + {} + }; + + info("version %s\n", UDEV_VERSION); + udev_config_init(); + if (udev_log_priority < LOG_INFO) { + char priority[32]; + + udev_log_priority = LOG_INFO; + sprintf(priority, "%i", udev_log_priority); + setenv("UDEV_LOG", priority, 1); + } + + while (1) { + int option; + + option = getopt_long(argc, argv, "a:s:fh", options, NULL); + if (option == -1) + break; + + dbg("option '%c'\n", option); + switch (option) { + case 'a': + action = optarg; + break; + case 's': + subsystem = optarg; + break; + case 'f': + force = 1; + break; + case 'h': + printf("Usage: udevadm test OPTIONS \n" + " --action= set action string\n" + " --subsystem= set subsystem string\n" + " --force don't skip node/link creation\n" + " --help print this help text\n\n"); + exit(0); + default: + exit(1); + } + } + devpath = argv[optind]; + + if (devpath == NULL) { + fprintf(stderr, "devpath parameter missing\n"); + rc = 1; + goto exit; + } + + printf("This program is for debugging only, it does not run any program,\n" + "specified by a RUN key. It may show incorrect results, because\n" + "some values may be different, or not available at a simulation run.\n" + "\n"); + + sysfs_init(); + udev_rules_init(&rules, 0); + + /* remove /sys if given */ + if (strncmp(devpath, sysfs_path, strlen(sysfs_path)) == 0) + devpath = &devpath[strlen(sysfs_path)]; + + dev = sysfs_device_get(devpath); + if (dev == NULL) { + fprintf(stderr, "unable to open device '%s'\n", devpath); + rc = 2; + goto exit; + } + + udev = udev_device_init(NULL); + if (udev == NULL) { + fprintf(stderr, "error initializing device\n"); + rc = 3; + goto exit; + } + + if (subsystem != NULL) + strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); + + /* override built-in sysfs device */ + udev->dev = dev; + strlcpy(udev->action, action, sizeof(udev->action)); + udev->devt = udev_device_get_devt(udev); + + /* simulate node creation with test flag */ + if (!force) + udev->test_run = 1; + + setenv("DEVPATH", udev->dev->devpath, 1); + setenv("SUBSYSTEM", udev->dev->subsystem, 1); + setenv("ACTION", udev->action, 1); + import_uevent_var(udev->dev->devpath); + + info("looking at device '%s' from subsystem '%s'\n", udev->dev->devpath, udev->dev->subsystem); + retval = udev_device_event(&rules, udev); + + if (udev->event_timeout >= 0) + info("custom event timeout: %i\n", udev->event_timeout); + + if (retval == 0 && !udev->ignore_device && udev_run) { + struct name_entry *name_loop; + + list_for_each_entry(name_loop, &udev->run_list, node) { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); + info("run: '%s'\n", program); + } + } + udev_device_cleanup(udev); + +exit: + udev_rules_cleanup(&rules); + sysfs_cleanup(); + return rc; +} diff --git a/udev/udevtrigger.c b/udev/udevtrigger.c new file mode 100644 index 0000000000..d4b10d06ab --- /dev/null +++ b/udev/udevtrigger.c @@ -0,0 +1,712 @@ +/* + * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2006 Hannes Reinecke + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" +#include "udev_rules.h" + +static int verbose; +static int dry_run; +LIST_HEAD(device_list); +LIST_HEAD(filter_subsystem_match_list); +LIST_HEAD(filter_subsystem_nomatch_list); +LIST_HEAD(filter_attr_match_list); +LIST_HEAD(filter_attr_nomatch_list); +static int sock = -1; +static struct sockaddr_un saddr; +static socklen_t saddrlen; + +/* devices that should run last cause of their dependencies */ +static int delay_device(const char *devpath) +{ + static const char *delay_device_list[] = { + "*/md*", + "*/dm-*", + NULL + }; + int i; + + for (i = 0; delay_device_list[i] != NULL; i++) + if (fnmatch(delay_device_list[i], devpath, 0) == 0) + return 1; + return 0; +} + +static int device_list_insert(const char *path) +{ + char filename[PATH_SIZE]; + char devpath[PATH_SIZE]; + struct stat statbuf; + + dbg("add '%s'\n" , path); + + /* we only have a device, if we have an uevent file */ + strlcpy(filename, path, sizeof(filename)); + strlcat(filename, "/uevent", sizeof(filename)); + if (stat(filename, &statbuf) < 0) + return -1; + if (!(statbuf.st_mode & S_IWUSR)) + return -1; + + strlcpy(devpath, &path[strlen(sysfs_path)], sizeof(devpath)); + + /* resolve possible link to real target */ + if (lstat(path, &statbuf) < 0) + return -1; + if (S_ISLNK(statbuf.st_mode)) + if (sysfs_resolve_link(devpath, sizeof(devpath)) != 0) + return -1; + + name_list_add(&device_list, devpath, 1); + return 0; +} + +static void trigger_uevent(const char *devpath, const char *action) +{ + char filename[PATH_SIZE]; + int fd; + + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, devpath, sizeof(filename)); + strlcat(filename, "/uevent", sizeof(filename)); + + if (verbose) + printf("%s\n", devpath); + + if (dry_run) + return; + + fd = open(filename, O_WRONLY); + if (fd < 0) { + dbg("error on opening %s: %s\n", filename, strerror(errno)); + return; + } + + if (write(fd, action, strlen(action)) < 0) + info("error writing '%s' to '%s': %s\n", action, filename, strerror(errno)); + + close(fd); +} + +static int pass_to_socket(const char *devpath, const char *action, const char *env) +{ + struct udevice udev; + struct name_entry *name_loop; + char buf[4096]; + size_t bufpos = 0; + ssize_t count; + char path[PATH_SIZE]; + int fd; + char link_target[PATH_SIZE]; + int len; + int err = 0; + + if (verbose) + printf("%s\n", devpath); + + udev_device_init(&udev); + udev_db_get_device(&udev, devpath); + + /* add header */ + bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); + bufpos++; + + /* add cookie */ + if (env != NULL) { + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "%s", env); + bufpos++; + } + + /* add standard keys */ + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVPATH=%s", devpath); + bufpos++; + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "ACTION=%s", action); + bufpos++; + + /* add subsystem */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/subsystem", sizeof(path)); + len = readlink(path, link_target, sizeof(link_target)); + if (len > 0) { + char *pos; + + link_target[len] = '\0'; + pos = strrchr(link_target, '/'); + if (pos != NULL) { + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "SUBSYSTEM=%s", &pos[1]); + bufpos++; + } + } + + /* add symlinks and node name */ + path[0] = '\0'; + list_for_each_entry(name_loop, &udev.symlink_list, node) { + strlcat(path, udev_root, sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, name_loop->name, sizeof(path)); + strlcat(path, " ", sizeof(path)); + } + remove_trailing_chars(path, ' '); + if (path[0] != '\0') { + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path); + bufpos++; + } + if (udev.name[0] != '\0') { + strlcpy(path, udev_root, sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, udev.name, sizeof(path)); + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path); + bufpos++; + } + + /* add keys from device "uevent" file */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/uevent", sizeof(path)); + fd = open(path, O_RDONLY); + if (fd >= 0) { + char value[4096]; + + count = read(fd, value, sizeof(value)); + close(fd); + if (count > 0) { + char *key; + + value[count] = '\0'; + key = value; + while (key[0] != '\0') { + char *next; + + next = strchr(key, '\n'); + if (next == NULL) + break; + next[0] = '\0'; + bufpos += strlcpy(&buf[bufpos], key, sizeof(buf) - bufpos-1); + bufpos++; + key = &next[1]; + } + } + } + + /* add keys from database */ + list_for_each_entry(name_loop, &udev.env_list, node) { + bufpos += strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); + bufpos++; + } + if (bufpos > sizeof(buf)) + bufpos = sizeof(buf); + + count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); + if (count < 0) + err = -1; + + return err; +} + +static void exec_list(const char *action, const char *env) +{ + struct name_entry *loop_device; + struct name_entry *tmp_device; + + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { + if (delay_device(loop_device->name)) + continue; + if (sock >= 0) + pass_to_socket(loop_device->name, action, env); + else + trigger_uevent(loop_device->name, action); + list_del(&loop_device->node); + free(loop_device); + } + + /* trigger remaining delayed devices */ + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { + if (sock >= 0) + pass_to_socket(loop_device->name, action, env); + else + trigger_uevent(loop_device->name, action); + list_del(&loop_device->node); + free(loop_device); + } +} + +static int subsystem_filtered(const char *subsystem) +{ + struct name_entry *loop_name; + + /* skip devices matching the listed subsystems */ + list_for_each_entry(loop_name, &filter_subsystem_nomatch_list, node) + if (fnmatch(loop_name->name, subsystem, 0) == 0) + return 1; + + /* skip devices not matching the listed subsystems */ + if (!list_empty(&filter_subsystem_match_list)) { + list_for_each_entry(loop_name, &filter_subsystem_match_list, node) + if (fnmatch(loop_name->name, subsystem, 0) == 0) + return 0; + return 1; + } + + return 0; +} + +static int attr_match(const char *path, const char *attr_value) +{ + char attr[NAME_SIZE]; + char file[PATH_SIZE]; + char *match_value; + + strlcpy(attr, attr_value, sizeof(attr)); + + /* separate attr and match value */ + match_value = strchr(attr, '='); + if (match_value != NULL) { + match_value[0] = '\0'; + match_value = &match_value[1]; + } + + strlcpy(file, path, sizeof(file)); + strlcat(file, "/", sizeof(file)); + strlcat(file, attr, sizeof(file)); + + if (match_value != NULL) { + /* match file content */ + char value[NAME_SIZE]; + int fd; + ssize_t size; + + fd = open(file, O_RDONLY); + if (fd < 0) + return 0; + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + return 0; + value[size] = '\0'; + remove_trailing_chars(value, '\n'); + + /* match if attribute value matches */ + if (fnmatch(match_value, value, 0) == 0) + return 1; + } else { + /* match if attribute exists */ + struct stat statbuf; + + if (stat(file, &statbuf) == 0) + return 1; + } + return 0; +} + +static int attr_filtered(const char *path) +{ + struct name_entry *loop_name; + + /* skip devices matching the listed sysfs attributes */ + list_for_each_entry(loop_name, &filter_attr_nomatch_list, node) + if (attr_match(path, loop_name->name)) + return 1; + + /* skip devices not matching the listed sysfs attributes */ + if (!list_empty(&filter_attr_match_list)) { + list_for_each_entry(loop_name, &filter_attr_match_list, node) + if (attr_match(path, loop_name->name)) + return 0; + return 1; + } + return 0; +} + +enum scan_type { + SCAN_DEVICES, + SCAN_SUBSYSTEM, +}; + +static void scan_subsystem(const char *subsys, enum scan_type scan) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + const char *subdir; + + if (scan == SCAN_DEVICES) + subdir = "/devices"; + else if (scan == SCAN_SUBSYSTEM) + subdir = "/drivers"; + else + return; + + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/", sizeof(base)); + strlcat(base, subsys, sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[PATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + if (scan == SCAN_DEVICES) + if (subsystem_filtered(dent->d_name)) + continue; + + strlcpy(dirname, base, sizeof(dirname)); + strlcat(dirname, "/", sizeof(dirname)); + strlcat(dirname, dent->d_name, sizeof(dirname)); + + if (scan == SCAN_SUBSYSTEM) { + if (!subsystem_filtered("subsystem")) + device_list_insert(dirname); + if (subsystem_filtered("drivers")) + continue; + } + + strlcat(dirname, subdir, sizeof(dirname)); + + /* look for devices/drivers */ + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[PATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (attr_filtered(dirname2)) + continue; + device_list_insert(dirname2); + } + closedir(dir2); + } + } + closedir(dir); + } +} + +static void scan_block(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + if (subsystem_filtered("block")) + return; + + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/block", sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[PATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + strlcpy(dirname, base, sizeof(dirname)); + strlcat(dirname, "/", sizeof(dirname)); + strlcat(dirname, dent->d_name, sizeof(dirname)); + if (attr_filtered(dirname)) + continue; + if (device_list_insert(dirname) != 0) + continue; + + /* look for partitions */ + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[PATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + if (!strcmp(dent2->d_name,"device")) + continue; + + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (attr_filtered(dirname2)) + continue; + device_list_insert(dirname2); + } + closedir(dir2); + } + } + closedir(dir); + } +} + +static void scan_class(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/class", sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[PATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + if (subsystem_filtered(dent->d_name)) + continue; + + strlcpy(dirname, base, sizeof(dirname)); + strlcat(dirname, "/", sizeof(dirname)); + strlcat(dirname, dent->d_name, sizeof(dirname)); + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[PATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + if (!strcmp(dent2->d_name, "device")) + continue; + + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (attr_filtered(dirname2)) + continue; + device_list_insert(dirname2); + } + closedir(dir2); + } + } + closedir(dir); + } +} + +static void scan_failed(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(base, udev_root, sizeof(base)); + strlcat(base, "/" EVENT_FAILED_DIR, sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char device[PATH_SIZE]; + size_t start; + + if (dent->d_name[0] == '.') + continue; + + start = strlcpy(device, sysfs_path, sizeof(device)); + if(start >= sizeof(device)) + start = sizeof(device) - 1; + strlcat(device, dent->d_name, sizeof(device)); + path_decode(&device[start]); + device_list_insert(device); + } + closedir(dir); + } +} + +int udevtrigger(int argc, char *argv[], char *envp[]) +{ + int failed = 0; + const char *sockpath = NULL; + int option; + const char *action = "add"; + const char *env = NULL; + static const struct option options[] = { + { "verbose", 0, NULL, 'v' }, + { "dry-run", 0, NULL, 'n' }, + { "retry-failed", 0, NULL, 'F' }, + { "socket", 1, NULL, 'o' }, + { "help", 0, NULL, 'h' }, + { "action", 1, NULL, 'c' }, + { "subsystem-match", 1, NULL, 's' }, + { "subsystem-nomatch", 1, NULL, 'S' }, + { "attr-match", 1, NULL, 'a' }, + { "attr-nomatch", 1, NULL, 'A' }, + { "env", 1, NULL, 'e' }, + {} + }; + + logging_init("udevtrigger"); + udev_config_init(); + dbg("version %s\n", UDEV_VERSION); + sysfs_init(); + + while (1) { + option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'v': + verbose = 1; + break; + case 'n': + dry_run = 1; + break; + case 'F': + failed = 1; + break; + case 'o': + sockpath = optarg; + break; + case 'c': + action = optarg; + break; + case 'e': + if (strchr(optarg, '=') != NULL) + env = optarg; + break; + case 's': + name_list_add(&filter_subsystem_match_list, optarg, 0); + break; + case 'S': + name_list_add(&filter_subsystem_nomatch_list, optarg, 0); + break; + case 'a': + name_list_add(&filter_attr_match_list, optarg, 0); + break; + case 'A': + name_list_add(&filter_attr_nomatch_list, optarg, 0); + break; + case 'h': + printf("Usage: udevadm trigger OPTIONS\n" + " --verbose print the list of devices while running\n" + " --dry-run do not actually trigger the events\n" + " --retry-failed trigger only the events which have been\n" + " marked as failed during a previous run\n" + " --socket= pass events to socket instead of triggering kernel events\n" + " --env== pass an additional key (works only with --socket=)\n" + " --subsystem-match= trigger devices from a matching subystem\n" + " --subsystem-nomatch= exclude devices from a matching subystem\n" + " --attr-match=]> trigger devices with a matching sysfs\n" + " attribute\n" + " --attr-nomatch=]> exclude devices with a matching sysfs\n" + " attribute\n" + " --help print this text\n" + "\n"); + goto exit; + default: + goto exit; + } + } + + if (sockpath != NULL) { + struct stat stats; + + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + if (sockpath[0] == '@') { + /* abstract namespace socket requested */ + strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { + /* existing socket file */ + strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); + saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); + } else { + /* no socket file, assume abstract namespace socket */ + strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } + } else if (env != NULL) { + fprintf(stderr, "error: --env= only valid with --socket= option\n"); + goto exit; + } + + if (failed) { + scan_failed(); + exec_list(action, env); + } else { + char base[PATH_SIZE]; + struct stat statbuf; + + /* if we have /sys/subsystem, forget all the old stuff */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/subsystem", sizeof(base)); + if (stat(base, &statbuf) == 0) { + scan_subsystem("subsystem", SCAN_SUBSYSTEM); + exec_list(action, env); + scan_subsystem("subsystem", SCAN_DEVICES); + exec_list(action, env); + } else { + scan_subsystem("bus", SCAN_SUBSYSTEM); + exec_list(action, env); + scan_subsystem("bus", SCAN_DEVICES); + scan_class(); + + /* scan "block" if it isn't a "class" */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/class/block", sizeof(base)); + if (stat(base, &statbuf) != 0) + scan_block(); + exec_list(action, env); + } + } + +exit: + name_list_cleanup(&filter_subsystem_match_list); + name_list_cleanup(&filter_subsystem_nomatch_list); + name_list_cleanup(&filter_attr_match_list); + name_list_cleanup(&filter_attr_nomatch_list); + + if (sock >= 0) + close(sock); + sysfs_cleanup(); + logging_close(); + return 0; +} diff --git a/udev_config.c b/udev_config.c deleted file mode 100644 index 55f0361dd2..0000000000 --- a/udev_config.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2005 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -/* global variables */ -char udev_root[PATH_SIZE]; -char udev_config_filename[PATH_SIZE]; -char udev_rules_dir[PATH_SIZE]; -int udev_log_priority; -int udev_run; - -static int get_key(char **line, char **key, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (!linepos) - return -1; - - /* skip whitespace */ - while (isspace(linepos[0])) - linepos++; - - /* get the key */ - *key = linepos; - while (1) { - linepos++; - if (linepos[0] == '\0') - return -1; - if (isspace(linepos[0])) - break; - if (linepos[0] == '=') - break; - } - - /* terminate key */ - linepos[0] = '\0'; - linepos++; - - /* skip whitespace */ - while (isspace(linepos[0])) - linepos++; - - /* get the value*/ - if (linepos[0] == '"') - linepos++; - else - return -1; - *value = linepos; - - temp = strchr(linepos, '"'); - if (!temp) - return -1; - temp[0] = '\0'; - - return 0; -} - -static int parse_config_file(void) -{ - char line[LINE_SIZE]; - char *bufline; - char *linepos; - char *variable; - char *value; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - int lineno; - int retval = 0; - - if (file_map(udev_config_filename, &buf, &bufsize) != 0) { - err("can't open '%s' as config file: %s\n", udev_config_filename, strerror(errno)); - return -ENODEV; - } - - /* loop through the whole file */ - lineno = 0; - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; - - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) - continue; - - /* see if this is a comment */ - if (bufline[0] == COMMENT_CHARACTER) - continue; - - if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); - continue; - } - - memcpy(line, bufline, count); - line[count] = '\0'; - - linepos = line; - retval = get_key(&linepos, &variable, &value); - if (retval != 0) { - err("error parsing %s, line %d:%d\n", udev_config_filename, lineno, (int)(linepos-line)); - continue; - } - - if (strcasecmp(variable, "udev_root") == 0) { - strlcpy(udev_root, value, sizeof(udev_root)); - remove_trailing_chars(udev_root, '/'); - continue; - } - - if (strcasecmp(variable, "udev_rules") == 0) { - strlcpy(udev_rules_dir, value, sizeof(udev_rules_dir)); - remove_trailing_chars(udev_rules_dir, '/'); - continue; - } - - if (strcasecmp(variable, "udev_log") == 0) { - udev_log_priority = log_priority(value); - continue; - } - } - - file_unmap(buf, bufsize); - return retval; -} - -void udev_config_init(void) -{ - const char *env; - - strcpy(udev_config_filename, UDEV_CONFIG_FILE); - strcpy(udev_root, UDEV_ROOT); - udev_rules_dir[0] = '\0'; - udev_log_priority = LOG_ERR; - udev_run = 1; - - /* disable RUN key execution */ - env = getenv("UDEV_RUN"); - if (env && !string_is_true(env)) - udev_run = 0; - - env = getenv("UDEV_CONFIG_FILE"); - if (env) { - strlcpy(udev_config_filename, env, sizeof(udev_config_filename)); - remove_trailing_chars(udev_config_filename, '/'); - } - - parse_config_file(); - - env = getenv("UDEV_ROOT"); - if (env) { - strlcpy(udev_root, env, sizeof(udev_root)); - remove_trailing_chars(udev_root, '/'); - } - - env = getenv("UDEV_LOG"); - if (env) - udev_log_priority = log_priority(env); - - dbg("UDEV_CONFIG_FILE='%s'\n", udev_config_filename); - dbg("udev_root='%s'\n", udev_root); - dbg("udev_rules_dir='%s'\n", udev_rules_dir); - dbg("udev_log=%d\n", udev_log_priority); -} diff --git a/udev_db.c b/udev_db.c deleted file mode 100644 index 3348c9a02c..0000000000 --- a/udev_db.c +++ /dev/null @@ -1,331 +0,0 @@ -/* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004-2005 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_selinux.h" - - -static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len) -{ - size_t start; - - /* translate to location of db file */ - strlcpy(filename, udev_root, len); - start = strlcat(filename, "/"DB_DIR"/", len); - strlcat(filename, devpath, len); - return path_encode(&filename[start], len - start); -} - -/* reverse mapping from the device file name to the devpath */ -static int name_index(const char *devpath, const char *name, int add) -{ - char device[PATH_SIZE]; - char filename[PATH_SIZE * 2]; - size_t start; - int fd; - - /* directory with device name */ - strlcpy(filename, udev_root, sizeof(filename)); - start = strlcat(filename, "/"DB_NAME_INDEX_DIR"/", sizeof(filename)); - strlcat(filename, name, sizeof(filename)); - path_encode(&filename[start], sizeof(filename) - start); - /* entry with the devpath */ - strlcpy(device, devpath, sizeof(device)); - path_encode(device, sizeof(device)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, device, sizeof(filename)); - - if (add) { - info("creating index: '%s'\n", filename); - create_path(filename); - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd > 0) - close(fd); - } else { - info("removing index: '%s'\n", filename); - unlink(filename); - delete_path(filename); - } - return 0; -} - -int udev_db_get_devices_by_name(const char *name, struct list_head *name_list) -{ - char dirname[PATH_MAX]; - size_t start; - DIR *dir; - int rc = 0; - - strlcpy(dirname, udev_root, sizeof(dirname)); - start = strlcat(dirname, "/"DB_NAME_INDEX_DIR"/", sizeof(dirname)); - strlcat(dirname, name, sizeof(dirname)); - path_encode(&dirname[start], sizeof(dirname) - start); - - dir = opendir(dirname); - if (dir == NULL) { - info("no index directory '%s': %s\n", dirname, strerror(errno)); - rc = -1; - goto out; - } - - info("found index directory '%s'\n", dirname); - while (1) { - struct dirent *ent; - char device[PATH_SIZE]; - - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - if (ent->d_name[0] == '.') - continue; - - strlcpy(device, ent->d_name, sizeof(device)); - path_decode(device); - name_list_add(name_list, device, 0); - rc++; - } - closedir(dir); -out: - return rc; -} - -int udev_db_rename(const char *devpath_old, const char *devpath) -{ - char filename[PATH_SIZE]; - char filename_old[PATH_SIZE]; - - devpath_to_db_path(devpath_old, filename_old, sizeof(filename_old)); - devpath_to_db_path(devpath, filename, sizeof(filename)); - return rename(filename_old, filename); -} - -int udev_db_add_device(struct udevice *udev) -{ - char filename[PATH_SIZE]; - - if (udev->test_run) - return 0; - - devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); - create_path(filename); - unlink(filename); - - /* - * don't waste tmpfs memory pages, if we don't have any data to store - * create fake db-file; store the node-name in a symlink target - */ - if (list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && - !udev->partitions && !udev->ignore_remove) { - int ret; - dbg("nothing interesting to store, create symlink\n"); - selinux_setfscreatecon(filename, NULL, S_IFLNK); - ret = symlink(udev->name, filename); - selinux_resetfscreatecon(); - if (ret != 0) { - err("unable to create db link '%s': %s\n", filename, strerror(errno)); - return -1; - } - } else { - FILE *f; - struct name_entry *name_loop; - - f = fopen(filename, "w"); - if (f == NULL) { - err("unable to create db file '%s': %s\n", filename, strerror(errno)); - return -1; - } - dbg("storing data for device '%s' in '%s'\n", udev->dev->devpath, filename); - - fprintf(f, "N:%s\n", udev->name); - list_for_each_entry(name_loop, &udev->symlink_list, node) { - fprintf(f, "S:%s\n", name_loop->name); - /* add symlink-name to index */ - name_index(udev->dev->devpath, name_loop->name, 1); - } - fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); - if (udev->link_priority != 0) - fprintf(f, "L:%u\n", udev->link_priority); - if (udev->event_timeout >= 0) - fprintf(f, "T:%u\n", udev->event_timeout); - if (udev->partitions != 0) - fprintf(f, "A:%u\n", udev->partitions); - if (udev->ignore_remove) - fprintf(f, "R:%u\n", udev->ignore_remove); - list_for_each_entry(name_loop, &udev->env_list, node) - fprintf(f, "E:%s\n", name_loop->name); - fclose(f); - } - - /* add name to index */ - name_index(udev->dev->devpath, udev->name, 1); - - return 0; -} - -int udev_db_get_device(struct udevice *udev, const char *devpath) -{ - struct stat stats; - char filename[PATH_SIZE]; - char line[PATH_SIZE]; - unsigned int maj, min; - char *bufline; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - - sysfs_device_set_values(udev->dev, devpath, NULL, NULL); - devpath_to_db_path(devpath, filename, sizeof(filename)); - - if (lstat(filename, &stats) != 0) { - info("no db file to read %s: %s\n", filename, strerror(errno)); - return -1; - } - if ((stats.st_mode & S_IFMT) == S_IFLNK) { - char target[NAME_SIZE]; - int target_len; - - info("found a symlink as db file\n"); - target_len = readlink(filename, target, sizeof(target)); - if (target_len > 0) - target[target_len] = '\0'; - else { - info("error reading db link %s: %s\n", filename, strerror(errno)); - return -1; - } - dbg("db link points to '%s'\n", target); - strlcpy(udev->name, target, sizeof(udev->name)); - return 0; - } - - if (file_map(filename, &buf, &bufsize) != 0) { - info("error reading db file %s: %s\n", filename, strerror(errno)); - return -1; - } - - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - - if (count > sizeof(line)) - count = sizeof(line); - memcpy(line, &bufline[2], count-2); - line[count-2] = '\0'; - - switch(bufline[0]) { - case 'N': - strlcpy(udev->name, line, sizeof(udev->name)); - break; - case 'M': - sscanf(line, "%u:%u", &maj, &min); - udev->devt = makedev(maj, min); - break; - case 'S': - name_list_add(&udev->symlink_list, line, 0); - break; - case 'L': - udev->link_priority = atoi(line); - break; - case 'T': - udev->event_timeout = atoi(line); - break; - case 'A': - udev->partitions = atoi(line); - break; - case 'R': - udev->ignore_remove = atoi(line); - break; - case 'E': - name_list_add(&udev->env_list, line, 0); - break; - } - } - file_unmap(buf, bufsize); - - if (udev->name[0] == '\0') - return -1; - - return 0; -} - -int udev_db_delete_device(struct udevice *udev) -{ - char filename[PATH_SIZE]; - struct name_entry *name_loop; - - if (udev->test_run) - return 0; - - devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); - unlink(filename); - - name_index(udev->dev->devpath, udev->name, 0); - list_for_each_entry(name_loop, &udev->symlink_list, node) - name_index(udev->dev->devpath, name_loop->name, 0); - - return 0; -} - -int udev_db_get_all_entries(struct list_head *name_list) -{ - char dbpath[PATH_MAX]; - DIR *dir; - - strlcpy(dbpath, udev_root, sizeof(dbpath)); - strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); - dir = opendir(dbpath); - if (dir == NULL) { - info("no udev_db available '%s': %s\n", dbpath, strerror(errno)); - return -1; - } - - while (1) { - struct dirent *ent; - char device[PATH_SIZE]; - - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - if (ent->d_name[0] == '.') - continue; - - strlcpy(device, ent->d_name, sizeof(device)); - path_decode(device); - name_list_add(name_list, device, 1); - dbg("added '%s'\n", device); - } - - closedir(dir); - return 0; -} diff --git a/udev_device.c b/udev_device.c deleted file mode 100644 index cf21191ca0..0000000000 --- a/udev_device.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" - - -struct udevice *udev_device_init(struct udevice *udev) -{ - if (udev == NULL) - udev = malloc(sizeof(struct udevice)); - if (udev == NULL) - return NULL; - memset(udev, 0x00, sizeof(struct udevice)); - - INIT_LIST_HEAD(&udev->symlink_list); - INIT_LIST_HEAD(&udev->run_list); - INIT_LIST_HEAD(&udev->env_list); - - /* set sysfs device to local storage, can be overridden if needed */ - udev->dev = &udev->dev_local; - - /* default node permissions */ - udev->mode = 0660; - strcpy(udev->owner, "root"); - strcpy(udev->group, "root"); - - udev->event_timeout = -1; - - return udev; -} - -void udev_device_cleanup(struct udevice *udev) -{ - name_list_cleanup(&udev->symlink_list); - name_list_cleanup(&udev->run_list); - name_list_cleanup(&udev->env_list); - free(udev); -} - -dev_t udev_device_get_devt(struct udevice *udev) -{ - const char *attr; - unsigned int maj, min; - - /* read it from sysfs */ - attr = sysfs_attr_get_value(udev->dev->devpath, "dev"); - if (attr != NULL) { - if (sscanf(attr, "%u:%u", &maj, &min) == 2) - return makedev(maj, min); - } - return makedev(0, 0); -} - -static void kernel_log(struct ifreq ifr) -{ - int klog; - FILE *f; - - klog = open("/dev/kmsg", O_WRONLY); - if (klog < 0) - return; - - f = fdopen(klog, "w"); - if (f == NULL) { - close(klog); - return; - } - - fprintf(f, "<6>udev: renamed network interface %s to %s\n", - ifr.ifr_name, ifr.ifr_newname); - fclose(f); -} - -static int rename_netif(struct udevice *udev) -{ - int sk; - struct ifreq ifr; - int retval; - - info("changing net interface name from '%s' to '%s'\n", udev->dev->kernel, udev->name); - if (udev->test_run) - return 0; - - sk = socket(PF_INET, SOCK_DGRAM, 0); - if (sk < 0) { - err("error opening socket: %s\n", strerror(errno)); - return -1; - } - - memset(&ifr, 0x00, sizeof(struct ifreq)); - strlcpy(ifr.ifr_name, udev->dev->kernel, IFNAMSIZ); - strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval == 0) - kernel_log(ifr); - else { - int loop; - - /* see if the destination interface name already exists */ - if (errno != EEXIST) { - err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); - goto exit; - } - - /* free our own name, another process may wait for us */ - strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ); - strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval != 0) { - err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); - goto exit; - } - - /* wait 30 seconds for our target to become available */ - strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); - strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); - loop = 30 * 20; - while (loop--) { - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval == 0) { - kernel_log(ifr); - break; - } - - if (errno != EEXIST) { - err("error changing net interface name %s to %s: %s\n", - ifr.ifr_name, ifr.ifr_newname, strerror(errno)); - break; - } - dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop); - usleep(1000 * 1000 / 20); - } - } - -exit: - close(sk); - return retval; -} - -int udev_device_event(struct udev_rules *rules, struct udevice *udev) -{ - int retval = 0; - - if (udev->devpath_old != NULL) - if (udev_db_rename(udev->devpath_old, udev->dev->devpath) == 0) - info("moved database from '%s' to '%s'\n", udev->devpath_old, udev->dev->devpath); - - /* add device node */ - if (major(udev->devt) != 0 && - (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "change") == 0)) { - struct udevice *udev_old; - - dbg("device node add '%s'\n", udev->dev->devpath); - - udev_rules_get_name(rules, udev); - if (udev->ignore_device) { - info("device event will be ignored\n"); - goto exit; - } - if (udev->name[0] == '\0') { - info("device node creation supressed\n"); - goto exit; - } - - /* read current database entry; cleanup, if it is known device */ - udev_old = udev_device_init(NULL); - if (udev_old != NULL) { - udev_old->test_run = udev->test_run; - if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { - info("device '%s' already in database, cleanup\n", udev->dev->devpath); - udev_db_delete_device(udev_old); - } else { - udev_device_cleanup(udev_old); - udev_old = NULL; - } - } - - /* create node */ - retval = udev_node_add(udev); - if (retval != 0) - goto exit; - - /* store in database */ - udev_db_add_device(udev); - - /* create, replace, delete symlinks according to priority */ - udev_node_update_symlinks(udev, udev_old); - - if (udev_old != NULL) - udev_device_cleanup(udev_old); - goto exit; - } - - /* add netif */ - if (strcmp(udev->dev->subsystem, "net") == 0 && strcmp(udev->action, "add") == 0) { - dbg("netif add '%s'\n", udev->dev->devpath); - udev_rules_get_name(rules, udev); - if (udev->ignore_device) { - info("device event will be ignored\n"); - goto exit; - } - if (udev->name[0] == '\0') { - info("device renaming supressed\n"); - goto exit; - } - - /* look if we want to change the name of the netif */ - if (strcmp(udev->name, udev->dev->kernel) != 0) { - char devpath[PATH_MAX]; - char *pos; - - retval = rename_netif(udev); - if (retval != 0) - goto exit; - info("renamed netif to '%s'\n", udev->name); - - /* export old name */ - setenv("INTERFACE_OLD", udev->dev->kernel, 1); - - /* now change the devpath, because the kernel device name has changed */ - strlcpy(devpath, udev->dev->devpath, sizeof(devpath)); - pos = strrchr(devpath, '/'); - if (pos != NULL) { - pos[1] = '\0'; - strlcat(devpath, udev->name, sizeof(devpath)); - sysfs_device_set_values(udev->dev, devpath, NULL, NULL); - setenv("DEVPATH", udev->dev->devpath, 1); - setenv("INTERFACE", udev->name, 1); - info("changed devpath to '%s'\n", udev->dev->devpath); - } - } - goto exit; - } - - /* remove device node */ - if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { - struct name_entry *name_loop; - - /* import database entry, and delete it */ - if (udev_db_get_device(udev, udev->dev->devpath) == 0) { - udev_db_delete_device(udev); - /* restore stored persistent data */ - list_for_each_entry(name_loop, &udev->env_list, node) - putenv(name_loop->name); - } else { - dbg("'%s' not found in database, using kernel name '%s'\n", - udev->dev->devpath, udev->dev->kernel); - strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); - } - - udev_rules_get_run(rules, udev); - if (udev->ignore_device) { - info("device event will be ignored\n"); - goto exit; - } - - if (udev->ignore_remove) { - info("ignore_remove for '%s'\n", udev->name); - goto exit; - } - /* remove the node */ - retval = udev_node_remove(udev); - - /* delete or restore symlinks according to priority */ - udev_node_update_symlinks(udev, NULL); - goto exit; - } - - /* default devices */ - udev_rules_get_run(rules, udev); - if (udev->ignore_device) - info("device event will be ignored\n"); - -exit: - return retval; -} diff --git a/udev_node.c b/udev_node.c deleted file mode 100644 index 78b6747043..0000000000 --- a/udev_node.c +++ /dev/null @@ -1,448 +0,0 @@ -/* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" -#include "udev_selinux.h" - -#define TMP_FILE_EXT ".udev-tmp" - -int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) -{ - char file_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; - struct stat stats; - int preserve = 0; - int err = 0; - - if (major(devt) != 0 && strcmp(udev->dev->subsystem, "block") == 0) - mode |= S_IFBLK; - else - mode |= S_IFCHR; - - if (lstat(file, &stats) == 0) { - if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devt)) { - info("preserve file '%s', because it has correct dev_t\n", file); - preserve = 1; - selinux_setfilecon(file, udev->dev->kernel, mode); - } else { - info("atomically replace existing file '%s'\n", file); - strlcpy(file_tmp, file, sizeof(file_tmp)); - strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); - unlink(file_tmp); - selinux_setfscreatecon(file_tmp, udev->dev->kernel, mode); - err = mknod(file_tmp, mode, devt); - selinux_resetfscreatecon(); - if (err != 0) { - err("mknod(%s, %#o, %u, %u) failed: %s\n", - file_tmp, mode, major(devt), minor(devt), strerror(errno)); - goto exit; - } - err = rename(file_tmp, file); - if (err != 0) { - err("rename(%s, %s) failed: %s\n", - file_tmp, file, strerror(errno)); - unlink(file_tmp); - } - } - } else { - info("mknod(%s, %#o, (%u,%u))\n", file, mode, major(devt), minor(devt)); - selinux_setfscreatecon(file, udev->dev->kernel, mode); - err = mknod(file, mode, devt); - selinux_resetfscreatecon(); - if (err != 0) { - err("mknod(%s, %#o, (%u,%u) failed: %s\n", - file, mode, major(devt), minor(devt), strerror(errno)); - goto exit; - } - } - - if (!preserve || stats.st_mode != mode) { - info("chmod(%s, %#o)\n", file, mode); - err = chmod(file, mode); - if (err != 0) { - err("chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); - goto exit; - } - } - - if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { - info("chown(%s, %u, %u)\n", file, uid, gid); - err = chown(file, uid, gid); - if (err != 0) { - err("chown(%s, %u, %u) failed: %s\n", file, uid, gid, strerror(errno)); - goto exit; - } - } -exit: - return err; -} - -static int node_symlink(const char *node, const char *slink) -{ - struct stat stats; - char target[PATH_SIZE] = ""; - char slink_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; - int i = 0; - int tail = 0; - int len; - int retval = 0; - - /* use relative link */ - while (node[i] && (node[i] == slink[i])) { - if (node[i] == '/') - tail = i+1; - i++; - } - while (slink[i] != '\0') { - if (slink[i] == '/') - strlcat(target, "../", sizeof(target)); - i++; - } - strlcat(target, &node[tail], sizeof(target)); - - /* preserve link with correct target, do not replace node of other device */ - if (lstat(slink, &stats) == 0) { - if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { - struct stat stats2; - - info("found existing node instead of symlink '%s'\n", slink); - if (lstat(node, &stats2) == 0) { - if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && - stats.st_rdev == stats2.st_rdev) { - info("replace device node '%s' with symlink to our node '%s'\n", slink, node); - } else { - err("device node '%s' already exists, link to '%s' will not overwrite it\n", slink, node); - goto exit; - } - } - } else if (S_ISLNK(stats.st_mode)) { - char buf[PATH_SIZE]; - - info("found existing symlink '%s'\n", slink); - len = readlink(slink, buf, sizeof(buf)); - if (len > 0) { - buf[len] = '\0'; - if (strcmp(target, buf) == 0) { - info("preserve already existing symlink '%s' to '%s'\n", slink, target); - selinux_setfilecon(slink, NULL, S_IFLNK); - goto exit; - } - } - } - } else { - info("creating symlink '%s' to '%s'\n", slink, target); - selinux_setfscreatecon(slink, NULL, S_IFLNK); - retval = symlink(target, slink); - selinux_resetfscreatecon(); - if (retval == 0) - goto exit; - } - - info("atomically replace '%s'\n", slink); - strlcpy(slink_tmp, slink, sizeof(slink_tmp)); - strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); - unlink(slink_tmp); - selinux_setfscreatecon(slink, NULL, S_IFLNK); - retval = symlink(target, slink_tmp); - selinux_resetfscreatecon(); - if (retval != 0) { - err("symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno)); - goto exit; - } - retval = rename(slink_tmp, slink); - if (retval != 0) { - err("rename(%s, %s) failed: %s\n", slink_tmp, slink, strerror(errno)); - unlink(slink_tmp); - goto exit; - } -exit: - return retval; -} - -static int update_link(struct udevice *udev, const char *name) -{ - LIST_HEAD(name_list); - char slink[PATH_SIZE]; - char node[PATH_SIZE]; - struct udevice *udev_db; - struct name_entry *device; - char target[PATH_MAX] = ""; - int count; - int priority = 0; - int rc = 0; - - strlcpy(slink, udev_root, sizeof(slink)); - strlcat(slink, "/", sizeof(slink)); - strlcat(slink, name, sizeof(slink)); - - count = udev_db_get_devices_by_name(name, &name_list); - info("found %i devices with name '%s'\n", count, name); - - /* if we don't have a reference, delete it */ - if (count <= 0) { - info("no reference left, remove '%s'\n", name); - if (!udev->test_run) { - unlink(slink); - delete_path(slink); - } - goto out; - } - - /* find the device with the highest priority */ - list_for_each_entry(device, &name_list, node) { - info("found '%s' for '%s'\n", device->name, name); - - /* did we find ourself? we win, if we have the same priority */ - if (strcmp(udev->dev->devpath, device->name) == 0) { - info("compare (our own) priority of '%s' %i >= %i\n", - udev->dev->devpath, udev->link_priority, priority); - if (strcmp(udev->name, name) == 0) { - info("'%s' is our device node, database inconsistent, skip link update\n", udev->name); - } else if (target[0] == '\0' || udev->link_priority >= priority) { - priority = udev->link_priority; - strlcpy(target, udev->name, sizeof(target)); - } - continue; - } - - /* another device, read priority from database */ - udev_db = udev_device_init(NULL); - if (udev_db == NULL) - continue; - if (udev_db_get_device(udev_db, device->name) == 0) { - if (strcmp(udev_db->name, name) == 0) { - info("'%s' is a device node of '%s', skip link update\n", udev_db->name, device->name); - } else { - info("compare priority of '%s' %i > %i\n", - udev_db->dev->devpath, udev_db->link_priority, priority); - if (target[0] == '\0' || udev_db->link_priority > priority) { - priority = udev_db->link_priority; - strlcpy(target, udev_db->name, sizeof(target)); - } - } - } - udev_device_cleanup(udev_db); - } - name_list_cleanup(&name_list); - - if (target[0] == '\0') { - info("no current target for '%s' found\n", name); - rc = 1; - goto out; - } - - /* create symlink to the target with the highest priority */ - strlcpy(node, udev_root, sizeof(node)); - strlcat(node, "/", sizeof(node)); - strlcat(node, target, sizeof(node)); - info("'%s' with target '%s' has the highest priority %i, create it\n", name, target, priority); - if (!udev->test_run) { - create_path(slink); - node_symlink(node, slink); - } -out: - return rc; -} - -void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) -{ - struct name_entry *name_loop; - char symlinks[PATH_SIZE] = ""; - - list_for_each_entry(name_loop, &udev->symlink_list, node) { - info("update symlink '%s' of '%s'\n", name_loop->name, udev->dev->devpath); - update_link(udev, name_loop->name); - strlcat(symlinks, udev_root, sizeof(symlinks)); - strlcat(symlinks, "/", sizeof(symlinks)); - strlcat(symlinks, name_loop->name, sizeof(symlinks)); - strlcat(symlinks, " ", sizeof(symlinks)); - } - - /* export symlinks to environment */ - remove_trailing_chars(symlinks, ' '); - if (symlinks[0] != '\0') - setenv("DEVLINKS", symlinks, 1); - - /* update possible left-over symlinks (device metadata changed) */ - if (udev_old != NULL) { - struct name_entry *link_loop; - struct name_entry *link_old_loop; - int found; - - /* remove current symlinks from old list */ - list_for_each_entry(link_old_loop, &udev_old->symlink_list, node) { - found = 0; - list_for_each_entry(link_loop, &udev->symlink_list, node) { - if (strcmp(link_old_loop->name, link_loop->name) == 0) { - found = 1; - break; - } - } - if (!found) { - /* link does no longer belong to this device */ - info("update old symlink '%s' no longer belonging to '%s'\n", - link_old_loop->name, udev->dev->devpath); - update_link(udev, link_old_loop->name); - } - } - - /* - * if the node name has changed, delete the node, - * or possibly restore a symlink of another device - */ - if (strcmp(udev->name, udev_old->name) != 0) - update_link(udev, udev_old->name); - } -} - -int udev_node_add(struct udevice *udev) -{ - char filename[PATH_SIZE]; - uid_t uid; - gid_t gid; - int i; - int retval = 0; - - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, udev->name, sizeof(filename)); - create_path(filename); - - if (strcmp(udev->owner, "root") == 0) - uid = 0; - else { - char *endptr; - unsigned long id; - - id = strtoul(udev->owner, &endptr, 10); - if (endptr[0] == '\0') - uid = (uid_t) id; - else - uid = lookup_user(udev->owner); - } - - if (strcmp(udev->group, "root") == 0) - gid = 0; - else { - char *endptr; - unsigned long id; - - id = strtoul(udev->group, &endptr, 10); - if (endptr[0] == '\0') - gid = (gid_t) id; - else - gid = lookup_group(udev->group); - } - - info("creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d\n", - filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid); - - if (!udev->test_run) - if (udev_node_mknod(udev, filename, udev->devt, udev->mode, uid, gid) != 0) { - retval = -1; - goto exit; - } - - setenv("DEVNAME", filename, 1); - - /* create all_partitions if requested */ - if (udev->partitions) { - char partitionname[PATH_SIZE]; - char *attr; - int range; - - /* take the maximum registered minor range */ - attr = sysfs_attr_get_value(udev->dev->devpath, "range"); - if (attr != NULL) { - range = atoi(attr); - if (range > 1) - udev->partitions = range-1; - } - info("creating device partition nodes '%s[1-%i]'\n", filename, udev->partitions); - if (!udev->test_run) { - for (i = 1; i <= udev->partitions; i++) { - dev_t part_devt; - - snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); - partitionname[sizeof(partitionname)-1] = '\0'; - part_devt = makedev(major(udev->devt), minor(udev->devt) + i); - udev_node_mknod(udev, partitionname, part_devt, udev->mode, uid, gid); - } - } - } -exit: - return retval; -} - -int udev_node_remove(struct udevice *udev) -{ - char filename[PATH_SIZE]; - char partitionname[PATH_SIZE]; - struct stat stats; - int retval = 0; - int num; - - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, udev->name, sizeof(filename)); - if (stat(filename, &stats) != 0) { - info("device node '%s' not found\n", filename); - return 0; - } - if (udev->devt && stats.st_rdev != udev->devt) { - info("device node '%s' points to a different device, skip removal\n", filename); - return -1; - } - - info("removing device node '%s'\n", filename); - if (!udev->test_run) - retval = unlink_secure(filename); - if (retval) - return retval; - - setenv("DEVNAME", filename, 1); - num = udev->partitions; - if (num > 0) { - int i; - - info("removing all_partitions '%s[1-%i]'\n", filename, num); - if (num > 255) - return -1; - for (i = 1; i <= num; i++) { - snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); - partitionname[sizeof(partitionname)-1] = '\0'; - if (!udev->test_run) - unlink_secure(partitionname); - } - } - delete_path(filename); - return retval; -} diff --git a/udev_rules.c b/udev_rules.c deleted file mode 100644 index ea850a84c3..0000000000 --- a/udev_rules.c +++ /dev/null @@ -1,1618 +0,0 @@ -/* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" -#include "udev_selinux.h" - -extern char **environ; - -/* extract possible {attr} and move str behind it */ -static char *get_format_attribute(char **str) -{ - char *pos; - char *attr = NULL; - - if (*str[0] == '{') { - pos = strchr(*str, '}'); - if (pos == NULL) { - err("missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - attr = *str+1; - *str = pos+1; - dbg("attribute='%s', str='%s'\n", attr, *str); - } - return attr; -} - -/* extract possible format length and move str behind it*/ -static int get_format_len(char **str) -{ - int num; - char *tail; - - if (isdigit(*str[0])) { - num = (int) strtoul(*str, &tail, 10); - if (num > 0) { - *str = tail; - dbg("format length=%i\n", num); - return num; - } else { - err("format parsing error '%s'\n", *str); - } - } - return -1; -} - -static int get_key(char **line, char **key, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (linepos == NULL) - return -1; - - /* skip whitespace */ - while (isspace(linepos[0])) - linepos++; - - /* get the key */ - temp = strchr(linepos, '='); - if (temp == NULL || temp == linepos) - return -1; - temp[0] = '\0'; - *key = linepos; - linepos = &temp[1]; - - /* get a quoted value */ - if (linepos[0] == '"' || linepos[0] == '\'') { - temp = strchr(&linepos[1], linepos[0]); - if (temp != NULL) { - temp[0] = '\0'; - *value = &linepos[1]; - goto out; - } - } - - /* get the value*/ - temp = strchr(linepos, '\n'); - if (temp != NULL) - temp[0] = '\0'; - *value = linepos; -out: - return 0; -} - -static int run_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen) -{ - int status; - int outpipe[2] = {-1, -1}; - int errpipe[2] = {-1, -1}; - pid_t pid; - char arg[PATH_SIZE]; - char program[PATH_SIZE]; - char *argv[(sizeof(arg) / 2) + 1]; - int devnull; - int i; - int retval = 0; - - /* build argv from comand */ - strlcpy(arg, command, sizeof(arg)); - i = 0; - if (strchr(arg, ' ') != NULL) { - char *pos = arg; - - while (pos != NULL) { - if (pos[0] == '\'') { - /* don't separate if in apostrophes */ - pos++; - argv[i] = strsep(&pos, "\'"); - while (pos != NULL && pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - } - dbg("arg[%i] '%s'\n", i, argv[i]); - i++; - } - argv[i] = NULL; - } else { - argv[0] = arg; - argv[1] = NULL; - } - info("'%s'\n", command); - - /* prepare pipes from child to parent */ - if (result != NULL || udev_log_priority >= LOG_INFO) { - if (pipe(outpipe) != 0) { - err("pipe failed: %s\n", strerror(errno)); - return -1; - } - } - if (udev_log_priority >= LOG_INFO) { - if (pipe(errpipe) != 0) { - err("pipe failed: %s\n", strerror(errno)); - return -1; - } - } - - /* allow programs in /lib/udev called without the path */ - if (strchr(argv[0], '/') == NULL) { - strlcpy(program, "/lib/udev/", sizeof(program)); - strlcat(program, argv[0], sizeof(program)); - argv[0] = program; - } - - pid = fork(); - switch(pid) { - case 0: - /* child closes parent ends of pipes */ - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* discard child output or connect to pipe */ - devnull = open("/dev/null", O_RDWR); - if (devnull > 0) { - dup2(devnull, STDIN_FILENO); - if (outpipe[WRITE_END] < 0) - dup2(devnull, STDOUT_FILENO); - if (errpipe[WRITE_END] < 0) - dup2(devnull, STDERR_FILENO); - close(devnull); - } else - err("open /dev/null failed: %s\n", strerror(errno)); - if (outpipe[WRITE_END] > 0) { - dup2(outpipe[WRITE_END], STDOUT_FILENO); - close(outpipe[WRITE_END]); - } - if (errpipe[WRITE_END] > 0) { - dup2(errpipe[WRITE_END], STDERR_FILENO); - close(errpipe[WRITE_END]); - } - execv(argv[0], argv); - if (errno == ENOENT || errno == ENOTDIR) { - /* may be on a filesytem which is not mounted right now */ - info("program '%s' not found\n", argv[0]); - } else { - /* other problems */ - err("exec of program '%s' failed\n", argv[0]); - } - _exit(1); - case -1: - err("fork of '%s' failed: %s\n", argv[0], strerror(errno)); - return -1; - default: - /* read from child if requested */ - if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - ssize_t count; - size_t respos = 0; - - /* parent closes child ends of pipes */ - if (outpipe[WRITE_END] > 0) - close(outpipe[WRITE_END]); - if (errpipe[WRITE_END] > 0) - close(errpipe[WRITE_END]); - - /* read child output */ - while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - int fdcount; - fd_set readfds; - - FD_ZERO(&readfds); - if (outpipe[READ_END] > 0) - FD_SET(outpipe[READ_END], &readfds); - if (errpipe[READ_END] > 0) - FD_SET(errpipe[READ_END], &readfds); - fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno == EINTR) - continue; - retval = -1; - break; - } - - /* get stdout */ - if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { - char inbuf[1024]; - char *pos; - char *line; - - count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); - if (count <= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - if (count < 0) { - err("stdin read failed: %s\n", strerror(errno)); - retval = -1; - } - continue; - } - inbuf[count] = '\0'; - - /* store result for rule processing */ - if (result) { - if (respos + count < ressize) { - memcpy(&result[respos], inbuf, count); - respos += count; - } else { - err("ressize %ld too short\n", (long)ressize); - retval = -1; - } - } - pos = inbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info("'%s' (stdout) '%s'\n", argv[0], line); - } - - /* get stderr */ - if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { - char errbuf[1024]; - char *pos; - char *line; - - count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); - if (count <= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - if (count < 0) - err("stderr read failed: %s\n", strerror(errno)); - continue; - } - errbuf[count] = '\0'; - pos = errbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info("'%s' (stderr) '%s'\n", argv[0], line); - } - } - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* return the childs stdout string */ - if (result) { - result[respos] = '\0'; - dbg("result='%s'\n", result); - if (reslen) - *reslen = respos; - } - } - waitpid(pid, &status, 0); - if (WIFEXITED(status)) { - info("'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); - if (WEXITSTATUS(status) != 0) - retval = -1; - } else { - err("'%s' abnormal exit\n", argv[0]); - retval = -1; - } - } - - return retval; -} - -static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bufsize) -{ - char line[LINE_SIZE]; - const char *bufline; - char *linepos; - char *variable; - char *value; - size_t cur; - size_t count; - int lineno; - - /* loop through the whole buffer */ - lineno = 0; - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; - - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) - continue; - - /* see if this is a comment */ - if (bufline[0] == COMMENT_CHARACTER) - continue; - - if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); - continue; - } - - memcpy(line, bufline, count); - line[count] = '\0'; - - linepos = line; - if (get_key(&linepos, &variable, &value) == 0) { - dbg("import '%s=%s'\n", variable, value); - - /* handle device, renamed by external tool, returning new path */ - if (strcmp(variable, "DEVPATH") == 0) { - info("updating devpath from '%s' to '%s'\n", udev->dev->devpath, value); - sysfs_device_set_values(udev->dev, value, NULL, NULL); - } else - name_list_key_add(&udev->env_list, variable, value); - setenv(variable, value, 1); - } - } - - return 0; -} - -static int import_file_into_env(struct udevice *udev, const char *filename) -{ - char *buf; - size_t bufsize; - - if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s': %s\n", filename, strerror(errno)); - return -1; - } - import_keys_into_env(udev, buf, bufsize); - file_unmap(buf, bufsize); - - return 0; -} - -static int import_program_into_env(struct udevice *udev, const char *program) -{ - char result[2048]; - size_t reslen; - - if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen) != 0) - return -1; - return import_keys_into_env(udev, result, reslen); -} - -static int import_parent_into_env(struct udevice *udev, const char *filter) -{ - struct sysfs_device *dev_parent; - int rc = -1; - - dev_parent = sysfs_device_get_parent(udev->dev); - if (dev_parent != NULL) { - struct udevice *udev_parent; - struct name_entry *name_loop; - - dbg("found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(NULL); - if (udev_parent == NULL) - return -1; - /* import the udev_db of the parent */ - if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { - dbg("import stored parent env '%s'\n", udev_parent->name); - list_for_each_entry(name_loop, &udev_parent->env_list, node) { - char name[NAME_SIZE]; - char *pos; - - strlcpy(name, name_loop->name, sizeof(name)); - pos = strchr(name, '='); - if (pos) { - pos[0] = '\0'; - pos++; - if (fnmatch(filter, name, 0) == 0) { - dbg("import key '%s'\n", name_loop->name); - name_list_add(&udev->env_list, name_loop->name, 0); - setenv(name, pos, 1); - } else - dbg("skip key '%s'\n", name_loop->name); - } - } - rc = 0; - } else - dbg("parent not found in database\n"); - udev_device_cleanup(udev_parent); - } - - return rc; -} - -static int pass_env_to_socket(const char *sockpath, const char *devpath, const char *action) -{ - int sock; - struct sockaddr_un saddr; - socklen_t saddrlen; - struct stat stats; - char buf[2048]; - size_t bufpos = 0; - int i; - ssize_t count; - int retval = 0; - - dbg("pass environment to socket '%s'\n", sockpath); - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - if (sockpath[0] == '@') { - /* abstract namespace socket requested */ - strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { - /* existing socket file */ - strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); - saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); - } else { - /* no socket file, assume abstract namespace socket */ - strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } - - bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); - bufpos++; - for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)-1); i++) { - bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); - bufpos++; - } - if (bufpos > sizeof(buf)) - bufpos = sizeof(buf); - - count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); - if (count < 0) - retval = -1; - info("passed %zi bytes to socket '%s', \n", count, sockpath); - - close(sock); - return retval; -} - -int udev_rules_run(struct udevice *udev) -{ - struct name_entry *name_loop; - int retval = 0; - - dbg("executing run list\n"); - list_for_each_entry(name_loop, &udev->run_list, node) { - if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) { - pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, udev->action); - } else { - char program[PATH_SIZE]; - - strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - if (run_program(program, udev->dev->subsystem, NULL, 0, NULL) != 0) - if (!name_loop->ignore_error) - retval = -1; - } - } - - return retval; -} - -#define WAIT_LOOP_PER_SECOND 50 -static int wait_for_file(struct udevice *udev, const char *file, int timeout) -{ - char filepath[PATH_SIZE]; - char devicepath[PATH_SIZE] = ""; - struct stat stats; - int loop = timeout * WAIT_LOOP_PER_SECOND; - - /* a relative path is a device attribute */ - if (file[0] != '/') { - strlcpy(devicepath, sysfs_path, sizeof(devicepath)); - strlcat(devicepath, udev->dev->devpath, sizeof(devicepath)); - - strlcpy(filepath, devicepath, sizeof(filepath)); - strlcat(filepath, "/", sizeof(filepath)); - strlcat(filepath, file, sizeof(filepath)); - file = filepath; - } - - dbg("will wait %i sec for '%s'\n", timeout, file); - while (--loop) { - /* lookup file */ - if (stat(file, &stats) == 0) { - info("file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); - return 0; - } - /* make sure, the device did not disappear in the meantime */ - if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { - info("device disappeared while waiting for '%s'\n", file); - return -2; - } - info("wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - info("waiting for '%s' failed\n", file); - return -1; -} - -/* handle "[$SUBSYSTEM/$KERNEL]" lookup */ -static int attr_get_by_subsys_id(const char *attrstr, char *devpath, size_t len, char **attr) -{ - char subsys[NAME_SIZE]; - char *attrib; - char *id; - int found = 0; - - if (attrstr[0] != '[') - goto out; - - strlcpy(subsys, &attrstr[1], sizeof(subsys)); - - attrib = strchr(subsys, ']'); - if (attrib == NULL) - goto out; - attrib[0] = '\0'; - attrib = &attrib[1]; - - id = strchr(subsys, '/'); - if (id == NULL) - goto out; - id[0] = '\0'; - id = &id[1]; - - if (sysfs_lookup_devpath_by_subsys_id(devpath, len, subsys, id)) { - if (attr != NULL) { - if (attrib[0] != '\0') - *attr = attrib; - else - *attr = NULL; - } - found = 1; - } -out: - return found; -} - -static int attr_subst_subdir(char *attr, size_t len) -{ - char *pos; - int found = 0; - - pos = strstr(attr, "/*/"); - if (pos != NULL) { - char str[PATH_SIZE]; - DIR *dir; - - pos[1] = '\0'; - strlcpy(str, &pos[2], sizeof(str)); - dir = opendir(attr); - if (dir != NULL) { - struct dirent *dent; - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat stats; - - if (dent->d_name[0] == '.') - continue; - strlcat(attr, dent->d_name, len); - strlcat(attr, str, len); - if (stat(attr, &stats) == 0) { - found = 1; - break; - } - pos[1] = '\0'; - } - closedir(dir); - } - if (!found) - strlcat(attr, str, len); - } - - return found; -} - -void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) -{ - char temp[PATH_SIZE]; - char temp2[PATH_SIZE]; - char *head, *tail, *pos, *cpos, *attr, *rest; - int len; - int i; - int count; - enum subst_type { - SUBST_UNKNOWN, - SUBST_DEVPATH, - SUBST_KERNEL, - SUBST_KERNEL_NUMBER, - SUBST_ID, - SUBST_DRIVER, - SUBST_MAJOR, - SUBST_MINOR, - SUBST_RESULT, - SUBST_ATTR, - SUBST_PARENT, - SUBST_TEMP_NODE, - SUBST_NAME, - SUBST_LINKS, - SUBST_ROOT, - SUBST_SYS, - SUBST_ENV, - }; - static const struct subst_map { - char *name; - char fmt; - enum subst_type type; - } map[] = { - { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, - { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, - { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, - { .name = "id", .fmt = 'b', .type = SUBST_ID }, - { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, - { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, - { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, - { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, - { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, - { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, - { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, - { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, - { .name = "name", .fmt = 'D', .type = SUBST_NAME }, - { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, - { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, - { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, - { .name = "env", .fmt = 'E', .type = SUBST_ENV }, - { NULL, '\0', 0 } - }; - enum subst_type type; - const struct subst_map *subst; - - head = string; - while (1) { - len = -1; - while (head[0] != '\0') { - if (head[0] == '$') { - /* substitute named variable */ - if (head[1] == '\0') - break; - if (head[1] == '$') { - strlcpy(temp, head+2, sizeof(temp)); - strlcpy(head+1, temp, maxsize); - head++; - continue; - } - head[0] = '\0'; - for (subst = map; subst->name; subst++) { - if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { - type = subst->type; - tail = head + strlen(subst->name)+1; - dbg("will substitute format name '%s'\n", subst->name); - goto found; - } - } - head[0] = '$'; - err("unknown format variable '%s'\n", head); - } else if (head[0] == '%') { - /* substitute format char */ - if (head[1] == '\0') - break; - if (head[1] == '%') { - strlcpy(temp, head+2, sizeof(temp)); - strlcpy(head+1, temp, maxsize); - head++; - continue; - } - head[0] = '\0'; - tail = head+1; - len = get_format_len(&tail); - for (subst = map; subst->name; subst++) { - if (tail[0] == subst->fmt) { - type = subst->type; - tail++; - dbg("will substitute format char '%c'\n", subst->fmt); - goto found; - } - } - head[0] = '%'; - err("unknown format char '%c'\n", tail[0]); - } - head++; - } - break; -found: - attr = get_format_attribute(&tail); - strlcpy(temp, tail, sizeof(temp)); - dbg("format=%i, string='%s', tail='%s'\n", type ,string, tail); - - switch (type) { - case SUBST_DEVPATH: - strlcat(string, udev->dev->devpath, maxsize); - dbg("substitute devpath '%s'\n", udev->dev->devpath); - break; - case SUBST_KERNEL: - strlcat(string, udev->dev->kernel, maxsize); - dbg("substitute kernel name '%s'\n", udev->dev->kernel); - break; - case SUBST_KERNEL_NUMBER: - strlcat(string, udev->dev->kernel_number, maxsize); - dbg("substitute kernel number '%s'\n", udev->dev->kernel_number); - break; - case SUBST_ID: - if (udev->dev_parent != NULL) { - strlcat(string, udev->dev_parent->kernel, maxsize); - dbg("substitute id '%s'\n", udev->dev_parent->kernel); - } - break; - case SUBST_DRIVER: - if (udev->dev_parent != NULL) { - strlcat(string, udev->dev_parent->driver, maxsize); - dbg("substitute driver '%s'\n", udev->dev_parent->driver); - } - break; - case SUBST_MAJOR: - sprintf(temp2, "%d", major(udev->devt)); - strlcat(string, temp2, maxsize); - dbg("substitute major number '%s'\n", temp2); - break; - case SUBST_MINOR: - sprintf(temp2, "%d", minor(udev->devt)); - strlcat(string, temp2, maxsize); - dbg("substitute minor number '%s'\n", temp2); - break; - case SUBST_RESULT: - if (udev->program_result[0] == '\0') - break; - /* get part part of the result string */ - i = 0; - if (attr != NULL) - i = strtoul(attr, &rest, 10); - if (i > 0) { - dbg("request part #%d of result string\n", i); - cpos = udev->program_result; - while (--i) { - while (cpos[0] != '\0' && !isspace(cpos[0])) - cpos++; - while (isspace(cpos[0])) - cpos++; - } - if (i > 0) { - err("requested part of result string not found\n"); - break; - } - strlcpy(temp2, cpos, sizeof(temp2)); - /* %{2+}c copies the whole string from the second part on */ - if (rest[0] != '+') { - cpos = strchr(temp2, ' '); - if (cpos) - cpos[0] = '\0'; - } - strlcat(string, temp2, maxsize); - dbg("substitute part of result string '%s'\n", temp2); - } else { - strlcat(string, udev->program_result, maxsize); - dbg("substitute result string '%s'\n", udev->program_result); - } - break; - case SUBST_ATTR: - if (attr == NULL) - err("missing file parameter for attr\n"); - else { - char devpath[PATH_SIZE]; - char *attrib; - const char *value = NULL; - size_t size; - - if (attr_get_by_subsys_id(attr, devpath, sizeof(devpath), &attrib)) { - if (attrib != NULL) - value = sysfs_attr_get_value(devpath, attrib); - else - break; - } - - /* try the current device, other matches may have selected */ - if (value == NULL && udev->dev_parent != NULL && udev->dev_parent != udev->dev) - value = sysfs_attr_get_value(udev->dev_parent->devpath, attr); - - /* look at all devices along the chain of parents */ - if (value == NULL) { - struct sysfs_device *dev_parent = udev->dev; - - do { - dbg("looking at '%s'\n", dev_parent->devpath); - value = sysfs_attr_get_value(dev_parent->devpath, attr); - if (value != NULL) { - strlcpy(temp2, value, sizeof(temp2)); - break; - } - dev_parent = sysfs_device_get_parent(dev_parent); - } while (dev_parent != NULL); - } - - if (value == NULL) - break; - - /* strip trailing whitespace, and replace unwanted characters */ - size = strlcpy(temp2, value, sizeof(temp2)); - if (size >= sizeof(temp2)) - size = sizeof(temp2)-1; - while (size > 0 && isspace(temp2[size-1])) - temp2[--size] = '\0'; - count = replace_chars(temp2, ALLOWED_CHARS_INPUT); - if (count > 0) - info("%i character(s) replaced\n" , count); - strlcat(string, temp2, maxsize); - dbg("substitute sysfs value '%s'\n", temp2); - } - break; - case SUBST_PARENT: - { - struct sysfs_device *dev_parent; - - dev_parent = sysfs_device_get_parent(udev->dev); - if (dev_parent != NULL) { - struct udevice *udev_parent; - - dbg("found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(NULL); - if (udev_parent != NULL) { - /* lookup the name in the udev_db with the DEVPATH of the parent */ - if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { - strlcat(string, udev_parent->name, maxsize); - dbg("substitute parent node name'%s'\n", udev_parent->name); - } else - dbg("parent not found in database\n"); - udev_device_cleanup(udev_parent); - } - } - } - break; - case SUBST_TEMP_NODE: - if (udev->tmp_node[0] == '\0' && major(udev->devt) > 0) { - dbg("create temporary device node for callout\n"); - snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", - udev_root, major(udev->devt), minor(udev->devt)); - udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0'; - udev_node_mknod(udev, udev->tmp_node, udev->devt, 0600, 0, 0); - } - strlcat(string, udev->tmp_node, maxsize); - dbg("substitute temporary device node name '%s'\n", udev->tmp_node); - break; - case SUBST_NAME: - if (udev->name[0] == '\0') { - strlcat(string, udev->dev->kernel, maxsize); - dbg("substitute udev->kernel '%s'\n", udev->name); - } else { - strlcat(string, udev->name, maxsize); - dbg("substitute udev->name '%s'\n", udev->name); - } - break; - case SUBST_LINKS: - if (!list_empty(&udev->symlink_list)) { - struct name_entry *name_loop; - char symlinks[PATH_SIZE] = ""; - - list_for_each_entry(name_loop, &udev->symlink_list, node) { - strlcat(symlinks, name_loop->name, sizeof(symlinks)); - strlcat(symlinks, " ", sizeof(symlinks)); - } - remove_trailing_chars(symlinks, ' '); - strlcat(string, symlinks, maxsize); - } - break; - case SUBST_ROOT: - strlcat(string, udev_root, maxsize); - dbg("substitute udev_root '%s'\n", udev_root); - break; - case SUBST_SYS: - strlcat(string, sysfs_path, maxsize); - dbg("substitute sysfs_path '%s'\n", sysfs_path); - break; - case SUBST_ENV: - if (attr == NULL) { - dbg("missing attribute\n"); - break; - } - pos = getenv(attr); - if (pos == NULL) { - dbg("env '%s' not available\n", attr); - break; - } - dbg("substitute env '%s=%s'\n", attr, pos); - strlcat(string, pos, maxsize); - break; - default: - err("unknown substitution type=%i\n", type); - break; - } - /* possibly truncate to format-char specified length */ - if (len >= 0 && len < (int)strlen(head)) { - head[len] = '\0'; - dbg("truncate to %i chars, subtitution string becomes '%s'\n", len, head); - } - strlcat(string, temp, maxsize); - } -} - -static char *key_val(struct udev_rule *rule, struct key *key) -{ - return rule->buf + key->val_off; -} - -static char *key_pair_name(struct udev_rule *rule, struct key_pair *pair) -{ - return rule->buf + pair->key_name_off; -} - -static int match_key(const char *key_name, struct udev_rule *rule, struct key *key, const char *val) -{ - char value[PATH_SIZE]; - char *key_value; - char *pos; - int match = 0; - - if (key->operation != KEY_OP_MATCH && - key->operation != KEY_OP_NOMATCH) - return 0; - - /* look for a matching string, parts are separated by '|' */ - strlcpy(value, rule->buf + key->val_off, sizeof(value)); - key_value = value; - dbg("key %s value='%s'\n", key_name, key_value); - while (key_value) { - pos = strchr(key_value, '|'); - if (pos) { - pos[0] = '\0'; - pos++; - } - - dbg("match %s '%s' <-> '%s'\n", key_name, key_value, val); - match = (fnmatch(key_value, val, 0) == 0); - if (match) - break; - - key_value = pos; - } - - if (match && (key->operation == KEY_OP_MATCH)) { - dbg("%s is true (matching value)\n", key_name); - return 0; - } - if (!match && (key->operation == KEY_OP_NOMATCH)) { - dbg("%s is true (non-matching value)\n", key_name); - return 0; - } - return -1; -} - -/* match a single rule against a given device and possibly its parent devices */ -static int match_rule(struct udevice *udev, struct udev_rule *rule) -{ - int i; - - if (match_key("ACTION", rule, &rule->action, udev->action)) - goto nomatch; - - if (match_key("KERNEL", rule, &rule->kernel, udev->dev->kernel)) - goto nomatch; - - if (match_key("SUBSYSTEM", rule, &rule->subsystem, udev->dev->subsystem)) - goto nomatch; - - if (match_key("DEVPATH", rule, &rule->devpath, udev->dev->devpath)) - goto nomatch; - - if (match_key("DRIVER", rule, &rule->driver, udev->dev->driver)) - goto nomatch; - - /* match NAME against a value assigned by an earlier rule */ - if (match_key("NAME", rule, &rule->name, udev->name)) - goto nomatch; - - /* match against current list of symlinks */ - if (rule->symlink_match.operation == KEY_OP_MATCH || - rule->symlink_match.operation == KEY_OP_NOMATCH) { - struct name_entry *name_loop; - int match = 0; - - list_for_each_entry(name_loop, &udev->symlink_list, node) { - if (match_key("SYMLINK", rule, &rule->symlink_match, name_loop->name) == 0) { - match = 1; - break; - } - } - if (!match) - goto nomatch; - } - - for (i = 0; i < rule->env.count; i++) { - struct key_pair *pair = &rule->env.keys[i]; - - /* we only check for matches, assignments will be handled later */ - if (pair->key.operation == KEY_OP_MATCH || - pair->key.operation == KEY_OP_NOMATCH) { - const char *key_name = key_pair_name(rule, pair); - const char *value = getenv(key_name); - - if (!value) { - dbg("ENV{'%s'} is not set, treat as empty\n", key_name); - value = ""; - } - if (match_key("ENV", rule, &pair->key, value)) - goto nomatch; - } - } - - if (rule->test.operation == KEY_OP_MATCH || - rule->test.operation == KEY_OP_NOMATCH) { - char filename[PATH_SIZE]; - char devpath[PATH_SIZE]; - char *attr; - struct stat statbuf; - int match; - - strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); - udev_rules_apply_format(udev, filename, sizeof(filename)); - - if (attr_get_by_subsys_id(filename, devpath, sizeof(devpath), &attr)) { - strlcpy(filename, sysfs_path, sizeof(filename)); - strlcat(filename, devpath, sizeof(filename)); - if (attr != NULL) { - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, attr, sizeof(filename)); - } - } else if (filename[0] != '/') { - char tmp[PATH_SIZE]; - - strlcpy(tmp, sysfs_path, sizeof(tmp)); - strlcat(tmp, udev->dev->devpath, sizeof(tmp)); - strlcat(tmp, "/", sizeof(tmp)); - strlcat(tmp, filename, sizeof(tmp)); - strlcpy(filename, tmp, sizeof(filename)); - } - - attr_subst_subdir(filename, sizeof(filename)); - - match = (stat(filename, &statbuf) == 0); - info("'%s' %s", filename, match ? "exists\n" : "does not exist\n"); - if (match && rule->test_mode_mask > 0) { - match = ((statbuf.st_mode & rule->test_mode_mask) > 0); - info("'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, - match ? "matches" : "does not match", - rule->test_mode_mask); - } - if (match && rule->test.operation == KEY_OP_NOMATCH) - goto nomatch; - if (!match && rule->test.operation == KEY_OP_MATCH) - goto nomatch; - dbg("TEST key is true\n"); - } - - if (rule->wait_for.operation != KEY_OP_UNSET) { - char filename[PATH_SIZE]; - int found; - - strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); - udev_rules_apply_format(udev, filename, sizeof(filename)); - found = (wait_for_file(udev, filename, 10) == 0); - if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) - goto nomatch; - } - - /* check for matching sysfs attribute pairs */ - for (i = 0; i < rule->attr.count; i++) { - struct key_pair *pair = &rule->attr.keys[i]; - - if (pair->key.operation == KEY_OP_MATCH || - pair->key.operation == KEY_OP_NOMATCH) { - const char *key_name = key_pair_name(rule, pair); - const char *key_value = key_val(rule, &pair->key); - char devpath[PATH_SIZE]; - char *attrib; - const char *value = NULL; - char val[VALUE_SIZE]; - size_t len; - - if (attr_get_by_subsys_id(key_name, devpath, sizeof(devpath), &attrib)) { - if (attrib != NULL) - value = sysfs_attr_get_value(devpath, attrib); - else - goto nomatch; - } - if (value == NULL) - value = sysfs_attr_get_value(udev->dev->devpath, key_name); - if (value == NULL) - goto nomatch; - strlcpy(val, value, sizeof(val)); - - /* strip trailing whitespace of value, if not asked to match for it */ - len = strlen(key_value); - if (len > 0 && !isspace(key_value[len-1])) { - len = strlen(val); - while (len > 0 && isspace(val[len-1])) - val[--len] = '\0'; - dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); - } - - if (match_key("ATTR", rule, &pair->key, val)) - goto nomatch; - } - } - - /* walk up the chain of parent devices and find a match */ - udev->dev_parent = udev->dev; - while (1) { - /* check for matching kernel device name */ - if (match_key("KERNELS", rule, &rule->kernels, udev->dev_parent->kernel)) - goto try_parent; - - /* check for matching subsystem value */ - if (match_key("SUBSYSTEMS", rule, &rule->subsystems, udev->dev_parent->subsystem)) - goto try_parent; - - /* check for matching driver */ - if (match_key("DRIVERS", rule, &rule->drivers, udev->dev_parent->driver)) - goto try_parent; - - /* check for matching sysfs attribute pairs */ - for (i = 0; i < rule->attrs.count; i++) { - struct key_pair *pair = &rule->attrs.keys[i]; - - if (pair->key.operation == KEY_OP_MATCH || - pair->key.operation == KEY_OP_NOMATCH) { - const char *key_name = key_pair_name(rule, pair); - const char *key_value = key_val(rule, &pair->key); - const char *value; - char val[VALUE_SIZE]; - size_t len; - - value = sysfs_attr_get_value(udev->dev_parent->devpath, key_name); - if (value == NULL) - value = sysfs_attr_get_value(udev->dev->devpath, key_name); - if (value == NULL) - goto try_parent; - strlcpy(val, value, sizeof(val)); - - /* strip trailing whitespace of value, if not asked to match for it */ - len = strlen(key_value); - if (len > 0 && !isspace(key_value[len-1])) { - len = strlen(val); - while (len > 0 && isspace(val[len-1])) - val[--len] = '\0'; - dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); - } - - if (match_key("ATTRS", rule, &pair->key, val)) - goto try_parent; - } - } - - /* found matching device */ - break; -try_parent: - /* move to parent device */ - dbg("try parent sysfs device\n"); - udev->dev_parent = sysfs_device_get_parent(udev->dev_parent); - if (udev->dev_parent == NULL) - goto nomatch; - dbg("looking at dev_parent->devpath='%s'\n", udev->dev_parent->devpath); - dbg("looking at dev_parent->kernel='%s'\n", udev->dev_parent->kernel); - } - - /* execute external program */ - if (rule->program.operation != KEY_OP_UNSET) { - char program[PATH_SIZE]; - char result[PATH_SIZE]; - - strlcpy(program, key_val(rule, &rule->program), sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL) != 0) { - dbg("PROGRAM is false\n"); - udev->program_result[0] = '\0'; - if (rule->program.operation != KEY_OP_NOMATCH) - goto nomatch; - } else { - int count; - - dbg("PROGRAM matches\n"); - remove_trailing_chars(result, '\n'); - if (rule->string_escape == ESCAPE_UNSET || - rule->string_escape == ESCAPE_REPLACE) { - count = replace_chars(result, ALLOWED_CHARS_INPUT); - if (count > 0) - info("%i character(s) replaced\n" , count); - } - dbg("result is '%s'\n", result); - strlcpy(udev->program_result, result, sizeof(udev->program_result)); - dbg("PROGRAM returned successful\n"); - if (rule->program.operation == KEY_OP_NOMATCH) - goto nomatch; - } - dbg("PROGRAM key is true\n"); - } - - /* check for matching result of external program */ - if (match_key("RESULT", rule, &rule->result, udev->program_result)) - goto nomatch; - - /* import variables returned from program or or file into environment */ - if (rule->import.operation != KEY_OP_UNSET) { - char import[PATH_SIZE]; - int rc = -1; - - strlcpy(import, key_val(rule, &rule->import), sizeof(import)); - udev_rules_apply_format(udev, import, sizeof(import)); - dbg("check for IMPORT import='%s'\n", import); - if (rule->import_type == IMPORT_PROGRAM) { - rc = import_program_into_env(udev, import); - } else if (rule->import_type == IMPORT_FILE) { - dbg("import file import='%s'\n", import); - rc = import_file_into_env(udev, import); - } else if (rule->import_type == IMPORT_PARENT) { - dbg("import parent import='%s'\n", import); - rc = import_parent_into_env(udev, import); - } - if (rc != 0) { - dbg("IMPORT failed\n"); - if (rule->import.operation != KEY_OP_NOMATCH) - goto nomatch; - } else - dbg("IMPORT '%s' imported\n", key_val(rule, &rule->import)); - dbg("IMPORT key is true\n"); - } - - /* rule matches, if we have ENV assignments export it */ - for (i = 0; i < rule->env.count; i++) { - struct key_pair *pair = &rule->env.keys[i]; - - if (pair->key.operation == KEY_OP_ASSIGN) { - char temp_value[NAME_SIZE]; - const char *key_name = key_pair_name(rule, pair); - const char *value = key_val(rule, &pair->key); - - /* make sure we don't write to the same string we possibly read from */ - strlcpy(temp_value, value, sizeof(temp_value)); - udev_rules_apply_format(udev, temp_value, NAME_SIZE); - - if (temp_value[0] == '\0') { - name_list_key_remove(&udev->env_list, key_name); - unsetenv(key_name); - info("unset ENV '%s'\n", key_name); - } else { - struct name_entry *entry; - - entry = name_list_key_add(&udev->env_list, key_name, temp_value); - if (entry == NULL) - break; - putenv(entry->name); - info("set ENV '%s'\n", entry->name); - } - } - } - - /* if we have ATTR assignments, write value to sysfs file */ - for (i = 0; i < rule->attr.count; i++) { - struct key_pair *pair = &rule->attr.keys[i]; - - if (pair->key.operation == KEY_OP_ASSIGN) { - const char *key_name = key_pair_name(rule, pair); - char devpath[PATH_SIZE]; - char *attrib; - char attr[PATH_SIZE] = ""; - char value[NAME_SIZE]; - FILE *f; - - if (attr_get_by_subsys_id(key_name, devpath, sizeof(devpath), &attrib)) { - if (attrib != NULL) { - strlcpy(attr, sysfs_path, sizeof(attr)); - strlcat(attr, devpath, sizeof(attr)); - strlcat(attr, "/", sizeof(attr)); - strlcat(attr, attrib, sizeof(attr)); - } - } - - if (attr[0] == '\0') { - strlcpy(attr, sysfs_path, sizeof(attr)); - strlcat(attr, udev->dev->devpath, sizeof(attr)); - strlcat(attr, "/", sizeof(attr)); - strlcat(attr, key_name, sizeof(attr)); - } - - attr_subst_subdir(attr, sizeof(attr)); - - strlcpy(value, key_val(rule, &pair->key), sizeof(value)); - udev_rules_apply_format(udev, value, sizeof(value)); - info("writing '%s' to sysfs file '%s'\n", value, attr); - f = fopen(attr, "w"); - if (f != NULL) { - if (!udev->test_run) - if (fprintf(f, "%s", value) <= 0) - err("error writing ATTR{%s}: %s\n", attr, strerror(errno)); - fclose(f); - } else - err("error opening ATTR{%s} for writing: %s\n", attr, strerror(errno)); - } - } - return 0; - -nomatch: - return -1; -} - -int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) -{ - struct udev_rule *rule; - int name_set = 0; - - dbg("udev->dev->devpath='%s'\n", udev->dev->devpath); - dbg("udev->dev->kernel='%s'\n", udev->dev->kernel); - - /* look for a matching rule to apply */ - udev_rules_iter_init(rules); - while (1) { - rule = udev_rules_iter_next(rules); - if (rule == NULL) - break; - - if (name_set && - (rule->name.operation == KEY_OP_ASSIGN || - rule->name.operation == KEY_OP_ASSIGN_FINAL || - rule->name.operation == KEY_OP_ADD)) { - dbg("node name already set, rule ignored\n"); - continue; - } - - dbg("process rule\n"); - if (match_rule(udev, rule) == 0) { - /* apply options */ - if (rule->ignore_device) { - info("rule applied, '%s' is ignored\n", udev->dev->kernel); - udev->ignore_device = 1; - return 0; - } - if (rule->ignore_remove) { - udev->ignore_remove = 1; - dbg("remove event should be ignored\n"); - } - if (rule->link_priority != 0) { - udev->link_priority = rule->link_priority; - info("link_priority=%i\n", udev->link_priority); - } - if (rule->event_timeout >= 0) { - udev->event_timeout = rule->event_timeout; - info("event_timeout=%i\n", udev->event_timeout); - } - /* apply all_partitions option only at a main block device */ - if (rule->partitions && - strcmp(udev->dev->subsystem, "block") == 0 && udev->dev->kernel_number[0] == '\0') { - udev->partitions = rule->partitions; - dbg("creation of partition nodes requested\n"); - } - - /* apply permissions */ - if (!udev->mode_final && rule->mode.operation != KEY_OP_UNSET) { - if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) - udev->mode_final = 1; - char buf[20]; - strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); - udev_rules_apply_format(udev, buf, sizeof(buf)); - udev->mode = strtol(buf, NULL, 8); - dbg("applied mode=%#o to '%s'\n", udev->mode, udev->dev->kernel); - } - if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { - if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) - udev->owner_final = 1; - strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner)); - udev_rules_apply_format(udev, udev->owner, sizeof(udev->owner)); - dbg("applied owner='%s' to '%s'\n", udev->owner, udev->dev->kernel); - } - if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) { - if (rule->group.operation == KEY_OP_ASSIGN_FINAL) - udev->group_final = 1; - strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); - udev_rules_apply_format(udev, udev->group, sizeof(udev->group)); - dbg("applied group='%s' to '%s'\n", udev->group, udev->dev->kernel); - } - - /* collect symlinks */ - if (!udev->symlink_final && - (rule->symlink.operation == KEY_OP_ASSIGN || - rule->symlink.operation == KEY_OP_ASSIGN_FINAL || - rule->symlink.operation == KEY_OP_ADD)) { - char temp[PATH_SIZE]; - char *pos, *next; - int count; - - if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) - udev->symlink_final = 1; - if (rule->symlink.operation == KEY_OP_ASSIGN || - rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { - info("reset symlink list\n"); - name_list_cleanup(&udev->symlink_list); - } - /* allow multiple symlinks separated by spaces */ - strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); - udev_rules_apply_format(udev, temp, sizeof(temp)); - if (rule->string_escape == ESCAPE_UNSET || - rule->string_escape == ESCAPE_REPLACE) { - count = replace_chars(temp, ALLOWED_CHARS_FILE " "); - if (count > 0) - info("%i character(s) replaced\n" , count); - } - dbg("rule applied, added symlink(s) '%s'\n", temp); - pos = temp; - while (isspace(pos[0])) - pos++; - next = strchr(pos, ' '); - while (next) { - next[0] = '\0'; - info("add symlink '%s'\n", pos); - name_list_add(&udev->symlink_list, pos, 0); - while (isspace(next[1])) - next++; - pos = &next[1]; - next = strchr(pos, ' '); - } - if (pos[0] != '\0') { - info("add symlink '%s'\n", pos); - name_list_add(&udev->symlink_list, pos, 0); - } - } - - /* set name, later rules with name set will be ignored */ - if (rule->name.operation == KEY_OP_ASSIGN || - rule->name.operation == KEY_OP_ASSIGN_FINAL || - rule->name.operation == KEY_OP_ADD) { - int count; - - name_set = 1; - strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); - udev_rules_apply_format(udev, udev->name, sizeof(udev->name)); - if (rule->string_escape == ESCAPE_UNSET || - rule->string_escape == ESCAPE_REPLACE) { - count = replace_chars(udev->name, ALLOWED_CHARS_FILE); - if (count > 0) - info("%i character(s) replaced\n", count); - } - - info("rule applied, '%s' becomes '%s'\n", udev->dev->kernel, udev->name); - if (strcmp(udev->dev->subsystem, "net") != 0) - dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i\n", - udev->name, udev->owner, udev->group, udev->mode, udev->partitions); - } - - if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { - struct name_entry *entry; - - if (rule->run.operation == KEY_OP_ASSIGN_FINAL) - udev->run_final = 1; - if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info("reset run list\n"); - name_list_cleanup(&udev->run_list); - } - dbg("add run '%s'\n", key_val(rule, &rule->run)); - entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); - if (rule->run_ignore_error) - entry->ignore_error = 1; - } - - if (rule->last_rule) { - dbg("last rule to be applied\n"); - break; - } - - if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); - } - } - } - - if (!name_set) { - info("no node name set, will use kernel name '%s'\n", udev->dev->kernel); - strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); - } - - if (udev->tmp_node[0] != '\0') { - dbg("removing temporary device node\n"); - unlink_secure(udev->tmp_node); - udev->tmp_node[0] = '\0'; - } - - return 0; -} - -int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) -{ - struct udev_rule *rule; - - dbg("udev->kernel='%s'\n", udev->dev->kernel); - - /* look for a matching rule to apply */ - udev_rules_iter_init(rules); - while (1) { - rule = udev_rules_iter_next(rules); - if (rule == NULL) - break; - - dbg("process rule\n"); - if (rule->name.operation == KEY_OP_ASSIGN || - rule->name.operation == KEY_OP_ASSIGN_FINAL || - rule->name.operation == KEY_OP_ADD || - rule->symlink.operation == KEY_OP_ASSIGN || - rule->symlink.operation == KEY_OP_ASSIGN_FINAL || - rule->symlink.operation == KEY_OP_ADD || - rule->mode.operation != KEY_OP_UNSET || - rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { - dbg("skip rule that names a device\n"); - continue; - } - - if (match_rule(udev, rule) == 0) { - if (rule->ignore_device) { - info("rule applied, '%s' is ignored\n", udev->dev->kernel); - udev->ignore_device = 1; - return 0; - } - if (rule->ignore_remove) { - udev->ignore_remove = 1; - dbg("remove event should be ignored\n"); - } - - if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { - struct name_entry *entry; - - if (rule->run.operation == KEY_OP_ASSIGN || - rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info("reset run list\n"); - name_list_cleanup(&udev->run_list); - } - dbg("add run '%s'\n", key_val(rule, &rule->run)); - entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); - if (rule->run_ignore_error) - entry->ignore_error = 1; - if (rule->run.operation == KEY_OP_ASSIGN_FINAL) - break; - } - - if (rule->last_rule) { - dbg("last rule to be applied\n"); - break; - } - - if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); - } - } - } - - return 0; -} diff --git a/udev_rules.h b/udev_rules.h deleted file mode 100644 index fe0f9dfbb5..0000000000 --- a/udev_rules.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef UDEV_RULES_H -#define UDEV_RULES_H - -#include "udev.h" -#include "list.h" - -#define PAIRS_MAX 5 -#define RULESFILE_SUFFIX ".rules" - -enum key_operation { - KEY_OP_UNSET, - KEY_OP_MATCH, - KEY_OP_NOMATCH, - KEY_OP_ADD, - KEY_OP_ASSIGN, - KEY_OP_ASSIGN_FINAL, -}; - -struct key { - enum key_operation operation; - size_t val_off; -}; - -struct key_pair { - struct key key; - size_t key_name_off; -}; - -struct key_pairs { - int count; - struct key_pair keys[PAIRS_MAX]; -}; - -enum import_type { - IMPORT_UNSET, - IMPORT_PROGRAM, - IMPORT_FILE, - IMPORT_PARENT, -}; - -enum escape_type { - ESCAPE_UNSET, - ESCAPE_NONE, - ESCAPE_REPLACE, -}; - -struct udev_rule { - struct key action; - struct key devpath; - struct key kernel; - struct key subsystem; - struct key driver; - struct key_pairs attr; - - struct key kernels; - struct key subsystems; - struct key drivers; - struct key_pairs attrs; - - struct key_pairs env; - struct key program; - struct key result; - struct key import; - enum import_type import_type; - struct key test; - mode_t test_mode_mask; - struct key run; - struct key wait_for; - struct key label; - struct key goto_label; - - struct key name; - struct key symlink; - struct key symlink_match; - struct key owner; - struct key group; - struct key mode; - enum escape_type string_escape; - - unsigned int link_priority; - int event_timeout; - unsigned int partitions; - unsigned int last_rule:1, - run_ignore_error:1, - ignore_device:1, - ignore_remove:1; - - size_t bufsize; - char buf[]; -}; - -struct udev_rules { - char *buf; - size_t bufsize; - size_t current; - int resolve_names; -}; - -extern int udev_rules_init(struct udev_rules *rules, int resolve_names); -extern void udev_rules_cleanup(struct udev_rules *rules); - -extern void udev_rules_iter_init(struct udev_rules *rules); -extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); -extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label); - -extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev); -extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev); -extern int udev_rules_run(struct udevice *udev); - -extern void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize); - -#endif diff --git a/udev_rules_parse.c b/udev_rules_parse.c deleted file mode 100644 index 3ada8b1c7d..0000000000 --- a/udev_rules_parse.c +++ /dev/null @@ -1,804 +0,0 @@ -/* - * Copyright (C) 2003,2004 Greg Kroah-Hartman - * Copyright (C) 2003-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" -#include "udev_selinux.h" - - -void udev_rules_iter_init(struct udev_rules *rules) -{ - dbg("bufsize=%zi\n", rules->bufsize); - rules->current = 0; -} - -struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) -{ - static struct udev_rule *rule; - - if (!rules) - return NULL; - - dbg("current=%zi\n", rules->current); - if (rules->current >= rules->bufsize) { - dbg("no more rules\n"); - return NULL; - } - - /* get next rule */ - rule = (struct udev_rule *) (rules->buf + rules->current); - rules->current += sizeof(struct udev_rule) + rule->bufsize; - - return rule; -} - -struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label) -{ - static struct udev_rule *rule; - size_t start = rules->current; - -next: - dbg("current=%zi\n", rules->current); - if (rules->current >= rules->bufsize) { - err("LABEL='%s' not found, GOTO will be ignored\n", label); - rules->current = start; - return NULL; - } - rule = (struct udev_rule *) (rules->buf + rules->current); - - if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { - dbg("moving forward, looking for label '%s'\n", label); - rules->current += sizeof(struct udev_rule) + rule->bufsize; - goto next; - } - - dbg("found label '%s'\n", label); - return rule; -} - -static int get_key(char **line, char **key, enum key_operation *operation, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (linepos == NULL && linepos[0] == '\0') - return -1; - - /* skip whitespace */ - while (isspace(linepos[0]) || linepos[0] == ',') - linepos++; - - /* get the key */ - if (linepos[0] == '\0') - return -1; - *key = linepos; - - while (1) { - linepos++; - if (linepos[0] == '\0') - return -1; - if (isspace(linepos[0])) - break; - if (linepos[0] == '=') - break; - if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) - if (linepos[1] == '=') - break; - } - - /* remember end of key */ - temp = linepos; - - /* skip whitespace after key */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get operation type */ - if (linepos[0] == '=' && linepos[1] == '=') { - *operation = KEY_OP_MATCH; - linepos += 2; - dbg("operator=match\n"); - } else if (linepos[0] == '!' && linepos[1] == '=') { - *operation = KEY_OP_NOMATCH; - linepos += 2; - dbg("operator=nomatch\n"); - } else if (linepos[0] == '+' && linepos[1] == '=') { - *operation = KEY_OP_ADD; - linepos += 2; - dbg("operator=add\n"); - } else if (linepos[0] == '=') { - *operation = KEY_OP_ASSIGN; - linepos++; - dbg("operator=assign\n"); - } else if (linepos[0] == ':' && linepos[1] == '=') { - *operation = KEY_OP_ASSIGN_FINAL; - linepos += 2; - dbg("operator=assign_final\n"); - } else - return -1; - - /* terminate key */ - temp[0] = '\0'; - dbg("key='%s'\n", *key); - - /* skip whitespace after operator */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get the value*/ - if (linepos[0] == '"') - linepos++; - else - return -1; - *value = linepos; - - temp = strchr(linepos, '"'); - if (!temp) - return -1; - temp[0] = '\0'; - temp++; - dbg("value='%s'\n", *value); - - /* move line to next key */ - *line = temp; - - return 0; -} - -/* extract possible KEY{attr} */ -static char *get_key_attribute(char *str) -{ - char *pos; - char *attr; - - attr = strchr(str, '{'); - if (attr != NULL) { - attr++; - pos = strchr(attr, '}'); - if (pos == NULL) { - err("missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - dbg("attribute='%s'\n", attr); - return attr; - } - - return NULL; -} - -static int add_rule_key(struct udev_rule *rule, struct key *key, - enum key_operation operation, const char *value) -{ - size_t val_len = strnlen(value, PATH_SIZE); - - key->operation = operation; - - key->val_off = rule->bufsize; - strlcpy(rule->buf + rule->bufsize, value, val_len+1); - rule->bufsize += val_len+1; - - return 0; -} - -static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs, - enum key_operation operation, const char *key, const char *value) -{ - size_t key_len = strnlen(key, PATH_SIZE); - - if (pairs->count >= PAIRS_MAX) { - err("skip, too many keys of the same type in a single rule\n"); - return -1; - } - - add_rule_key(rule, &pairs->keys[pairs->count].key, operation, value); - - /* add the key-name of the pair */ - pairs->keys[pairs->count].key_name_off = rule->bufsize; - strlcpy(rule->buf + rule->bufsize, key, key_len+1); - rule->bufsize += key_len+1; - - pairs->count++; - - return 0; -} - -static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) -{ - char buf[sizeof(struct udev_rule) + LINE_SIZE]; - struct udev_rule *rule; - size_t rule_size; - int valid; - char *linepos; - char *attr; - size_t padding; - int physdev = 0; - int retval; - - memset(buf, 0x00, sizeof(buf)); - rule = (struct udev_rule *) buf; - rule->event_timeout = -1; - linepos = line; - valid = 0; - - /* get all the keys */ - while (1) { - char *key; - char *value; - enum key_operation operation = KEY_OP_UNSET; - - retval = get_key(&linepos, &key, &operation, &value); - if (retval) - break; - - if (strcasecmp(key, "ACTION") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid ACTION operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->action, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DEVPATH") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid DEVPATH operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->devpath, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "KERNEL") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid KERNEL operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->kernel, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "SUBSYSTEM") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid SUBSYSTEM operation\n"); - goto invalid; - } - /* bus, class, subsystem events should all be the same */ - if (strcmp(value, "subsystem") == 0 || - strcmp(value, "bus") == 0 || - strcmp(value, "class") == 0) { - if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) - err("'%s' must be specified as 'subsystem' \n" - "please fix it in %s:%u", value, filename, lineno); - add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); - } else - add_rule_key(rule, &rule->subsystem, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DRIVER") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid DRIVER operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->driver, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { - attr = get_key_attribute(key + sizeof("ATTR")-1); - if (attr == NULL) { - err("error parsing ATTR attribute\n"); - goto invalid; - } - if (add_rule_key_pair(rule, &rule->attr, operation, attr, value) != 0) - goto invalid; - valid = 1; - continue; - } - - if (strcasecmp(key, "KERNELS") == 0 || - strcasecmp(key, "ID") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid KERNELS operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->kernels, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "SUBSYSTEMS") == 0 || - strcasecmp(key, "BUS") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid SUBSYSTEMS operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->subsystems, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DRIVERS") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid DRIVERS operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->drivers, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || - strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid ATTRS operation\n"); - goto invalid; - } - attr = get_key_attribute(key + sizeof("ATTRS")-1); - if (attr == NULL) { - err("error parsing ATTRS attribute\n"); - goto invalid; - } - if (strncmp(attr, "device/", 7) == 0) - err("the 'device' link is deprecated and will be removed from a future kernel, \n" - "please fix it in %s:%u", filename, lineno); - else if (strstr(attr, "../") != NULL) - err("do not reference parent sysfs directories directly, that may break with a future kernel, \n" - "please fix it in %s:%u", filename, lineno); - if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0) - goto invalid; - valid = 1; - continue; - } - - if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { - attr = get_key_attribute(key + sizeof("ENV")-1); - if (attr == NULL) { - err("error parsing ENV attribute\n"); - goto invalid; - } - if (strncmp(attr, "PHYSDEV", 7) == 0) - physdev = 1; - if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0) - goto invalid; - valid = 1; - continue; - } - - if (strcasecmp(key, "PROGRAM") == 0) { - add_rule_key(rule, &rule->program, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "RESULT") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid RESULT operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->result, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { - attr = get_key_attribute(key + sizeof("IMPORT")-1); - if (attr != NULL && strstr(attr, "program")) { - dbg("IMPORT will be executed\n"); - rule->import_type = IMPORT_PROGRAM; - } else if (attr != NULL && strstr(attr, "file")) { - dbg("IMPORT will be included as file\n"); - rule->import_type = IMPORT_FILE; - } else if (attr != NULL && strstr(attr, "parent")) { - dbg("IMPORT will include the parent values\n"); - rule->import_type = IMPORT_PARENT; - } else { - /* figure it out if it is executable */ - char file[PATH_SIZE]; - char *pos; - struct stat statbuf; - - strlcpy(file, value, sizeof(file)); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - - /* allow programs in /lib/udev called without the path */ - if (strchr(file, '/') == NULL) { - strlcpy(file, "/lib/udev/", sizeof(file)); - strlcat(file, value, sizeof(file)); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - } - - dbg("IMPORT auto mode for '%s'\n", file); - if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { - dbg("IMPORT is executable, will be executed (autotype)\n"); - rule->import_type = IMPORT_PROGRAM; - } else { - dbg("IMPORT is not executable, will be included as file (autotype)\n"); - rule->import_type = IMPORT_FILE; - } - } - add_rule_key(rule, &rule->import, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err("invalid TEST operation\n"); - goto invalid; - } - attr = get_key_attribute(key + sizeof("TEST")-1); - if (attr != NULL) - rule->test_mode_mask = strtol(attr, NULL, 8); - add_rule_key(rule, &rule->test, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { - attr = get_key_attribute(key + sizeof("RUN")-1); - if (attr != NULL) { - if (strstr(attr, "ignore_error")) - rule->run_ignore_error = 1; - } - add_rule_key(rule, &rule->run, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { - add_rule_key(rule, &rule->wait_for, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "LABEL") == 0) { - add_rule_key(rule, &rule->label, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "GOTO") == 0) { - add_rule_key(rule, &rule->goto_label, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { - attr = get_key_attribute(key + sizeof("NAME")-1); - if (attr != NULL) { - if (strstr(attr, "all_partitions") != NULL) { - dbg("creation of partition nodes requested\n"); - rule->partitions = DEFAULT_PARTITIONS_COUNT; - } - if (strstr(attr, "ignore_remove") != NULL) { - dbg("remove event should be ignored\n"); - rule->ignore_remove = 1; - } - } - if (value[0] == '\0') - dbg("name empty, node creation supressed\n"); - add_rule_key(rule, &rule->name, operation, value); - continue; - } - - if (strcasecmp(key, "SYMLINK") == 0) { - if (operation == KEY_OP_MATCH || - operation == KEY_OP_NOMATCH) - add_rule_key(rule, &rule->symlink_match, operation, value); - else - add_rule_key(rule, &rule->symlink, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "OWNER") == 0) { - valid = 1; - if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { - char *endptr; - strtoul(value, &endptr, 10); - if (endptr[0] != '\0') { - char owner[32]; - uid_t uid = lookup_user(value); - dbg("replacing username='%s' by id=%i\n", value, uid); - sprintf(owner, "%u", (unsigned int) uid); - add_rule_key(rule, &rule->owner, operation, owner); - continue; - } - } - - add_rule_key(rule, &rule->owner, operation, value); - continue; - } - - if (strcasecmp(key, "GROUP") == 0) { - valid = 1; - if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { - char *endptr; - strtoul(value, &endptr, 10); - if (endptr[0] != '\0') { - char group[32]; - gid_t gid = lookup_group(value); - dbg("replacing groupname='%s' by id=%i\n", value, gid); - sprintf(group, "%u", (unsigned int) gid); - add_rule_key(rule, &rule->group, operation, group); - continue; - } - } - - add_rule_key(rule, &rule->group, operation, value); - continue; - } - - if (strcasecmp(key, "MODE") == 0) { - add_rule_key(rule, &rule->mode, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "OPTIONS") == 0) { - const char *pos; - - if (strstr(value, "last_rule") != NULL) { - dbg("last rule to be applied\n"); - rule->last_rule = 1; - } - if (strstr(value, "ignore_device") != NULL) { - dbg("device should be ignored\n"); - rule->ignore_device = 1; - } - if (strstr(value, "ignore_remove") != NULL) { - dbg("remove event should be ignored\n"); - rule->ignore_remove = 1; - } - pos = strstr(value, "link_priority="); - if (pos != NULL) { - rule->link_priority = atoi(&pos[strlen("link_priority=")]); - dbg("link priority=%i\n", rule->link_priority); - } - pos = strstr(value, "event_timeout="); - if (pos != NULL) { - rule->event_timeout = atoi(&pos[strlen("event_timeout=")]); - dbg("event timout=%i\n", rule->event_timeout); - } - pos = strstr(value, "string_escape="); - if (pos != NULL) { - pos = &pos[strlen("string_escape=")]; - if (strncmp(pos, "none", strlen("none")) == 0) - rule->string_escape = ESCAPE_NONE; - else if (strncmp(pos, "replace", strlen("replace")) == 0) - rule->string_escape = ESCAPE_REPLACE; - } - if (strstr(value, "all_partitions") != NULL) { - dbg("creation of partition nodes requested\n"); - rule->partitions = DEFAULT_PARTITIONS_COUNT; - } - valid = 1; - continue; - } - - err("unknown key '%s' in %s:%u\n", key, filename, lineno); - } - - if (physdev && rule->wait_for.operation == KEY_OP_UNSET) - err("PHYSDEV* values are deprecated and will be removed from a future kernel, \n" - "please fix it in %s:%u", filename, lineno); - - /* skip line if not any valid key was found */ - if (!valid) - goto invalid; - - /* grow buffer and add rule */ - rule_size = sizeof(struct udev_rule) + rule->bufsize; - padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); - dbg("add %zi padding bytes\n", padding); - rule_size += padding; - rule->bufsize += padding; - - rules->buf = realloc(rules->buf, rules->bufsize + rule_size); - if (!rules->buf) { - err("realloc failed\n"); - goto exit; - } - dbg("adding rule to offset %zi\n", rules->bufsize); - memcpy(rules->buf + rules->bufsize, rule, rule_size); - rules->bufsize += rule_size; -exit: - return 0; - -invalid: - err("invalid rule '%s:%u'\n", filename, lineno); - return -1; -} - -static int parse_file(struct udev_rules *rules, const char *filename) -{ - char line[LINE_SIZE]; - char *bufline; - unsigned int lineno; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - int retval = 0; - - if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s' as rules file: %s\n", filename, strerror(errno)); - return -1; - } - info("reading '%s' as rules file\n", filename); - - /* loop through the whole file */ - cur = 0; - lineno = 0; - while (cur < bufsize) { - unsigned int i, j; - - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; - - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) - continue; - - /* see if this is a comment */ - if (bufline[0] == COMMENT_CHARACTER) - continue; - - if (count >= sizeof(line)) { - err("line too long, rule skipped '%s:%u'\n", filename, lineno); - continue; - } - - /* skip backslash and newline from multiline rules */ - for (i = j = 0; i < count; i++) { - if (bufline[i] == '\\' && bufline[i+1] == '\n') - continue; - - line[j++] = bufline[i]; - } - line[j] = '\0'; - - dbg("read '%s'\n", line); - add_to_rules(rules, line, filename, lineno); - } - - file_unmap(buf, bufsize); - return retval; -} - -int udev_rules_init(struct udev_rules *rules, int resolve_names) -{ - struct stat statbuf; - char filename[PATH_MAX]; - LIST_HEAD(name_list); - LIST_HEAD(sort_list); - struct name_entry *name_loop, *name_tmp; - struct name_entry *sort_loop, *sort_tmp; - int retval = 0; - - memset(rules, 0x00, sizeof(struct udev_rules)); - rules->resolve_names = resolve_names; - - if (udev_rules_dir[0] != '\0') { - /* custom rules location for testing */ - add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX); - } else { - /* read default rules */ - add_matching_files(&name_list, RULES_LIB_DIR, RULESFILE_SUFFIX); - - /* read user/custom rules */ - add_matching_files(&sort_list, RULES_ETC_DIR, RULESFILE_SUFFIX); - - /* read dynamic/temporary rules */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); - if (stat(filename, &statbuf) != 0) { - create_path(filename); - selinux_setfscreatecon(filename, NULL, S_IFDIR|0755); - mkdir(filename, 0755); - selinux_resetfscreatecon(); - } - add_matching_files(&sort_list, filename, RULESFILE_SUFFIX); - - /* sort all rules files by basename into list of files */ - list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) { - const char *sort_base = strrchr(sort_loop->name, '/'); - - if (sort_base == NULL) - continue; - - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - const char *name_base = strrchr(name_loop->name, '/'); - - if (name_base == NULL) - continue; - - if (strcmp(name_base, sort_base) > 0) - break; - } - list_move_tail(&sort_loop->node, &name_loop->node); - } - } - - /* parse list of files */ - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - if (stat(name_loop->name, &statbuf) == 0) { - if (statbuf.st_size) - parse_file(rules, name_loop->name); - else - dbg("empty rules file '%s'\n", name_loop->name); - } else - err("could not read '%s': %s\n", name_loop->name, strerror(errno)); - list_del(&name_loop->node); - free(name_loop); - } - - return retval; -} - -void udev_rules_cleanup(struct udev_rules *rules) -{ - if (rules->buf) { - free(rules->buf); - rules->buf = NULL; - } -} - diff --git a/udev_selinux.c b/udev_selinux.c deleted file mode 100644 index eec950194c..0000000000 --- a/udev_selinux.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2004 Daniel Walsh - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_selinux.h" - -static security_context_t prev_scontext = NULL; - -static int is_selinux_running(void) -{ - static int selinux_enabled = -1; - - if (selinux_enabled == -1) - selinux_enabled = (is_selinux_enabled() > 0); - - dbg("selinux=%i\n", selinux_enabled); - return selinux_enabled; -} - -static char *get_media(const char *devname, int mode) -{ - FILE *fp; - char procfile[PATH_MAX]; - char mediabuf[256]; - int size; - char *media = NULL; - - if (!(mode & S_IFBLK)) - return NULL; - - snprintf(procfile, PATH_MAX, "/proc/ide/%s/media", devname); - procfile[PATH_MAX-1] = '\0'; - - fp = fopen(procfile, "r"); - if (!fp) - goto out; - - if (fgets(mediabuf, sizeof(mediabuf), fp) == NULL) - goto close_out; - - size = strlen(mediabuf); - while (size-- > 0) { - if (isspace(mediabuf[size])) { - mediabuf[size] = '\0'; - } else { - break; - } - } - - media = strdup(mediabuf); - info("selinux_get_media(%s)='%s'\n", devname, media); - -close_out: - fclose(fp); -out: - return media; -} - -void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) -{ - if (is_selinux_running()) { - security_context_t scontext = NULL; - char *media; - int ret = -1; - - if (devname) { - media = get_media(devname, mode); - if (media) { - ret = matchmediacon(media, &scontext); - free(media); - } - } - - if (ret < 0) - if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed\n", file); - return; - } - - if (lsetfilecon(file, scontext) < 0) - err("setfilecon %s failed: %s\n", file, strerror(errno)); - - freecon(scontext); - } -} - -void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) -{ - if (is_selinux_running()) { - security_context_t scontext = NULL; - char *media; - int ret = -1; - - if (devname) { - media = get_media(devname, mode); - if (media) { - ret = matchmediacon(media, &scontext); - free(media); - } - } - - if (ret < 0) - if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed\n", file); - return; - } - - if (setfscreatecon(scontext) < 0) - err("setfscreatecon %s failed: %s\n", file, strerror(errno)); - - freecon(scontext); - } -} - -void selinux_resetfscreatecon(void) -{ - if (is_selinux_running()) { - if (setfscreatecon(prev_scontext) < 0) - err("setfscreatecon failed: %s\n", strerror(errno)); - } -} - -void selinux_init(void) -{ - /* - * record the present security context, for file-creation - * restoration creation purposes. - */ - if (is_selinux_running()) { - if (!udev_root[0]) - err("selinux_init: udev_root not set\n"); - matchpathcon_init_prefix(NULL, udev_root); - if (getfscreatecon(&prev_scontext) < 0) { - err("getfscreatecon failed\n"); - prev_scontext = NULL; - } - } -} - -void selinux_exit(void) -{ - if (is_selinux_running() && prev_scontext) { - freecon(prev_scontext); - prev_scontext = NULL; - } -} diff --git a/udev_selinux.h b/udev_selinux.h deleted file mode 100644 index 73567d6cfe..0000000000 --- a/udev_selinux.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2004 Daniel Walsh - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ -#ifndef _UDEV_SELINUX_H -#define _UDEV_SELINUX_H - -#ifdef USE_SELINUX - -extern void selinux_setfilecon(const char *file, const char *devname, unsigned int mode); -extern void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode); -extern void selinux_resetfscreatecon(void); -extern void selinux_init(void); -extern void selinux_exit(void); - -#else - -static inline void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) {} -static inline void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) {} -static inline void selinux_resetfscreatecon(void) {} -static inline void selinux_init(void) {} -static inline void selinux_exit(void) {} - -#endif /* USE_SELINUX */ -#endif /* _UDEV_USE_SELINUX */ diff --git a/udev_sysdeps.c b/udev_sysdeps.c deleted file mode 100644 index 9447cca936..0000000000 --- a/udev_sysdeps.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2005-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -#ifdef __GLIBC__ -size_t strlcpy(char *dst, const char *src, size_t size) -{ - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while ((ch = *p++)) { - if (bytes+1 < size) - *q++ = ch; - bytes++; - } - - /* If size == 0 there is no space for a final null... */ - if (size) - *q = '\0'; - return bytes; -} - -size_t strlcat(char *dst, const char *src, size_t size) -{ - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while (bytes < size && *q) { - q++; - bytes++; - } - if (bytes == size) - return (bytes + strlen(src)); - - while ((ch = *p++)) { - if (bytes+1 < size) - *q++ = ch; - bytes++; - } - - *q = '\0'; - return bytes; -} -#endif /* __GLIBC__ */ diff --git a/udev_sysdeps.h b/udev_sysdeps.h deleted file mode 100644 index d4f03686af..0000000000 --- a/udev_sysdeps.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * wrapping of libc features and kernel interfaces - * - * Copyright (C) 2005-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef _UDEV_SYSDEPS_H_ -#define _UDEV_SYSDEPS_H_ - -#include -#include -#include - -/* needed until Inotify! syscalls reach glibc */ -#include -#ifndef __NR_inotify_init -#if defined(__i386__) -# define __NR_inotify_init 291 -# define __NR_inotify_add_watch 292 -# define __NR_inotify_rm_watch 293 -#elif defined(__x86_64__) -# define __NR_inotify_init 253 -# define __NR_inotify_add_watch 254 -# define __NR_inotify_rm_watch 255 -#elif defined(__powerpc__) || defined(__powerpc64__) -# define __NR_inotify_init 275 -# define __NR_inotify_add_watch 276 -# define __NR_inotify_rm_watch 277 -#elif defined (__ia64__) -# define __NR_inotify_init 1277 -# define __NR_inotify_add_watch 1278 -# define __NR_inotify_rm_watch 1279 -#elif defined (__s390__) -# define __NR_inotify_init 284 -# define __NR_inotify_add_watch 285 -# define __NR_inotify_rm_watch 286 -#elif defined (__alpha__) -# define __NR_inotify_init 444 -# define __NR_inotify_add_watch 445 -# define __NR_inotify_rm_watch 446 -#elif defined (__sparc__) || defined (__sparc64__) -# define __NR_inotify_init 151 -# define __NR_inotify_add_watch 152 -# define __NR_inotify_rm_watch 156 -#elif defined (__arm__) -# define __NR_inotify_init __NR_SYSCALL_BASE+316 -# define __NR_inotify_add_watch __NR_SYSCALL_BASE+317 -# define __NR_inotify_rm_watch __NR_SYSCALL_BASE+318 -#elif defined (__sh__) -# define __NR_inotify_init 290 -# define __NR_inotify_add_watch 291 -# define __NR_inotify_rm_watch 292 -#elif defined (__m32r__) -# define __NR_inotify_init 290 -# define __NR_inotify_add_watch 291 -# define __NR_inotify_rm_watch 292 -#elif defined (__hppa__) -# define __NR_inotify_init 269 -# define __NR_inotify_add_watch 270 -# define __NR_inotify_rm_watch 271 -#elif defined (__mips__) -# include -# if _MIPS_SIM == _MIPS_SIM_ABI32 -# define __NR_Linux 4000 -# define __NR_inotify_init (__NR_Linux + 284) -# define __NR_inotify_add_watch (__NR_Linux + 285) -# define __NR_inotify_rm_watch (__NR_Linux + 286) -# elif _MIPS_SIM == _MIPS_SIM_ABI64 -# define __NR_Linux 5000 -# define __NR_inotify_init (__NR_Linux + 243) -# define __NR_inotify_add_watch (__NR_Linux + 244) -# define __NR_inotify_rm_watch (__NR_Linux + 245) -# elif _MIPS_SIM == _MIPS_SIM_NABI32 -# define __NR_Linux 6000 -# define __NR_inotify_init (__NR_Linux + 247) -# define __NR_inotify_add_watch (__NR_Linux + 248) -# define __NR_inotify_rm_watch (__NR_Linux + 249) -# endif -#else -#warning "inotify unsupported on this architecture!" -#endif -#endif /* __NR_inotify_init */ - -/* dummy if we don't have the syscalls defined */ -#ifndef __NR_inotify_init -static inline int inotify_init(void) -{ - return -1; -} - -static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) -{ - return -1; -} -#else -/* needed until /usr/include/sys/inotify.h is working */ -#ifndef __GLIBC__ -#include -#else -static inline int inotify_init(void) -{ - return syscall(__NR_inotify_init); -} - -static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) -{ - return syscall(__NR_inotify_add_watch, fd, name, mask); -} -#endif /* __GLIBC__ */ -#endif /* __NR_inotify_init */ - -#ifndef IN_CREATE -#define IN_CREATE 0x00000100 /* Subfile was created */ -#define IN_MOVED_FROM 0x00000040 /* File was moved from X */ -#define IN_MOVED_TO 0x00000080 /* File was moved to Y */ -#define IN_DELETE 0x00000200 /* Subfile was deleted */ -#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ -#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ -#endif /* IN_CREATE */ - -/* needed for our signal handlers to work */ -#undef asmlinkage -#ifdef __i386__ -#define asmlinkage __attribute__((regparm(0))) -#else -#define asmlinkage -#endif /* __i386__ */ - -/* headers are broken on some architectures */ -#ifndef __FD_SET -#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) -#endif -#ifndef __FD_CLR -#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) -#endif -#ifndef __FD_ISSET -#define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) -#endif -#ifndef __FD_ZERO -#define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) -#endif - -#ifndef NETLINK_KOBJECT_UEVENT -#define NETLINK_KOBJECT_UEVENT 15 -#endif - -#ifndef SO_RCVBUFFORCE -#if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || defined(__sparc_v9__) -#define SO_RCVBUFFORCE 0x100b -#else -#define SO_RCVBUFFORCE 33 -#endif -#endif - -extern size_t strlcpy(char *dst, const char *src, size_t size); -extern size_t strlcat(char *dst, const char *src, size_t size); - -#endif diff --git a/udev_sysfs.c b/udev_sysfs.c deleted file mode 100644 index c4cd4ab75d..0000000000 --- a/udev_sysfs.c +++ /dev/null @@ -1,509 +0,0 @@ -/* - * Copyright (C) 2005-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -char sysfs_path[PATH_SIZE]; - -/* device cache */ -static LIST_HEAD(dev_list); - -/* attribute value cache */ -static LIST_HEAD(attr_list); -struct sysfs_attr { - struct list_head node; - char path[PATH_SIZE]; - char *value; /* points to value_local if value is cached */ - char value_local[NAME_SIZE]; -}; - -int sysfs_init(void) -{ - const char *env; - - env = getenv("SYSFS_PATH"); - if (env) { - strlcpy(sysfs_path, env, sizeof(sysfs_path)); - remove_trailing_chars(sysfs_path, '/'); - } else - strlcpy(sysfs_path, "/sys", sizeof(sysfs_path)); - dbg("sysfs_path='%s'\n", sysfs_path); - - INIT_LIST_HEAD(&dev_list); - INIT_LIST_HEAD(&attr_list); - return 0; -} - -void sysfs_cleanup(void) -{ - struct sysfs_attr *attr_loop; - struct sysfs_attr *attr_temp; - struct sysfs_device *dev_loop; - struct sysfs_device *dev_temp; - - list_for_each_entry_safe(attr_loop, attr_temp, &attr_list, node) { - list_del(&attr_loop->node); - free(attr_loop); - } - - list_for_each_entry_safe(dev_loop, dev_temp, &dev_list, node) { - list_del(&dev_loop->node); - free(dev_loop); - } -} - -void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, - const char *subsystem, const char *driver) -{ - char *pos; - - strlcpy(dev->devpath, devpath, sizeof(dev->devpath)); - if (subsystem != NULL) - strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); - if (driver != NULL) - strlcpy(dev->driver, driver, sizeof(dev->driver)); - - /* set kernel name */ - pos = strrchr(dev->devpath, '/'); - if (pos == NULL) - return; - strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); - dbg("kernel='%s'\n", dev->kernel); - - /* some devices have '!' in their name, change that to '/' */ - pos = dev->kernel; - while (pos[0] != '\0') { - if (pos[0] == '!') - pos[0] = '/'; - pos++; - } - - /* get kernel number */ - pos = &dev->kernel[strlen(dev->kernel)]; - while (isdigit(pos[-1])) - pos--; - strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); - dbg("kernel_number='%s'\n", dev->kernel_number); -} - -int sysfs_resolve_link(char *devpath, size_t size) -{ - char link_path[PATH_SIZE]; - char link_target[PATH_SIZE]; - int len; - int i; - int back; - - strlcpy(link_path, sysfs_path, sizeof(link_path)); - strlcat(link_path, devpath, sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len <= 0) - return -1; - link_target[len] = '\0'; - dbg("path link '%s' points to '%s'\n", devpath, link_target); - - for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) - ; - dbg("base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); - for (i = 0; i <= back; i++) { - char *pos = strrchr(devpath, '/'); - - if (pos == NULL) - return -1; - pos[0] = '\0'; - } - dbg("after moving back '%s'\n", devpath); - strlcat(devpath, "/", size); - strlcat(devpath, &link_target[back * 3], size); - return 0; -} - -struct sysfs_device *sysfs_device_get(const char *devpath) -{ - char path[PATH_SIZE]; - char devpath_real[PATH_SIZE]; - struct sysfs_device *dev; - struct sysfs_device *dev_loop; - struct stat statbuf; - char link_path[PATH_SIZE]; - char link_target[PATH_SIZE]; - int len; - char *pos; - - /* we handle only these devpathes */ - if (devpath != NULL && - strncmp(devpath, "/devices/", 9) != 0 && - strncmp(devpath, "/subsystem/", 11) != 0 && - strncmp(devpath, "/module/", 8) != 0 && - strncmp(devpath, "/bus/", 5) != 0 && - strncmp(devpath, "/class/", 7) != 0 && - strncmp(devpath, "/block/", 7) != 0) - return NULL; - - dbg("open '%s'\n", devpath); - strlcpy(devpath_real, devpath, sizeof(devpath_real)); - remove_trailing_chars(devpath_real, '/'); - if (devpath[0] == '\0' ) - return NULL; - - /* look for device already in cache (we never put an untranslated path in the cache) */ - list_for_each_entry(dev_loop, &dev_list, node) { - if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'\n", dev_loop->devpath); - return dev_loop; - } - } - - /* if we got a link, resolve it to the real device */ - strlcpy(path, sysfs_path, sizeof(path)); - strlcat(path, devpath_real, sizeof(path)); - if (lstat(path, &statbuf) != 0) { - dbg("stat '%s' failed: %s\n", path, strerror(errno)); - return NULL; - } - if (S_ISLNK(statbuf.st_mode)) { - if (sysfs_resolve_link(devpath_real, sizeof(devpath_real)) != 0) - return NULL; - - /* now look for device in cache after path translation */ - list_for_each_entry(dev_loop, &dev_list, node) { - if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'\n", dev_loop->devpath); - return dev_loop; - } - } - } - - /* it is a new device */ - dbg("new uncached device '%s'\n", devpath_real); - dev = malloc(sizeof(struct sysfs_device)); - if (dev == NULL) - return NULL; - memset(dev, 0x00, sizeof(struct sysfs_device)); - - sysfs_device_set_values(dev, devpath_real, NULL, NULL); - - /* get subsystem name */ - strlcpy(link_path, sysfs_path, sizeof(link_path)); - strlcat(link_path, dev->devpath, sizeof(link_path)); - strlcat(link_path, "/subsystem", sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len > 0) { - /* get subsystem from "subsystem" link */ - link_target[len] = '\0'; - dbg("subsystem link '%s' points to '%s'\n", link_path, link_target); - pos = strrchr(link_target, '/'); - if (pos != NULL) - strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); - } else if (strstr(dev->devpath, "/drivers/") != NULL) { - strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/module/", 8) == 0) { - strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/subsystem/", 11) == 0) { - pos = strrchr(dev->devpath, '/'); - if (pos == &dev->devpath[10]) - strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/class/", 7) == 0) { - pos = strrchr(dev->devpath, '/'); - if (pos == &dev->devpath[6]) - strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/bus/", 5) == 0) { - pos = strrchr(dev->devpath, '/'); - if (pos == &dev->devpath[4]) - strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); - } - - /* get driver name */ - strlcpy(link_path, sysfs_path, sizeof(link_path)); - strlcat(link_path, dev->devpath, sizeof(link_path)); - strlcat(link_path, "/driver", sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len > 0) { - link_target[len] = '\0'; - dbg("driver link '%s' points to '%s'\n", link_path, link_target); - pos = strrchr(link_target, '/'); - if (pos != NULL) - strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); - } - - dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'\n", dev->devpath, dev->subsystem, dev->driver); - list_add(&dev->node, &dev_list); - - return dev; -} - -struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) -{ - char parent_devpath[PATH_SIZE]; - char *pos; - - dbg("open '%s'\n", dev->devpath); - - /* look if we already know the parent */ - if (dev->parent != NULL) - return dev->parent; - - strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - dbg("'%s'\n", parent_devpath); - - /* strip last element */ - pos = strrchr(parent_devpath, '/'); - if (pos == NULL || pos == parent_devpath) - return NULL; - pos[0] = '\0'; - - if (strncmp(parent_devpath, "/class", 6) == 0) { - pos = strrchr(parent_devpath, '/'); - if (pos == &parent_devpath[6] || pos == parent_devpath) { - dbg("/class top level, look for device link\n"); - goto device_link; - } - } - if (strcmp(parent_devpath, "/block") == 0) { - dbg("/block top level, look for device link\n"); - goto device_link; - } - - /* are we at the top level? */ - pos = strrchr(parent_devpath, '/'); - if (pos == NULL || pos == parent_devpath) - return NULL; - - /* get parent and remember it */ - dev->parent = sysfs_device_get(parent_devpath); - return dev->parent; - -device_link: - strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - strlcat(parent_devpath, "/device", sizeof(parent_devpath)); - if (sysfs_resolve_link(parent_devpath, sizeof(parent_devpath)) != 0) - return NULL; - - /* get parent and remember it */ - dev->parent = sysfs_device_get(parent_devpath); - return dev->parent; -} - -struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem) -{ - struct sysfs_device *dev_parent; - - dev_parent = sysfs_device_get_parent(dev); - while (dev_parent != NULL) { - if (strcmp(dev_parent->subsystem, subsystem) == 0) - return dev_parent; - dev_parent = sysfs_device_get_parent(dev_parent); - } - return NULL; -} - -char *sysfs_attr_get_value(const char *devpath, const char *attr_name) -{ - char path_full[PATH_SIZE]; - const char *path; - char value[NAME_SIZE]; - struct sysfs_attr *attr_loop; - struct sysfs_attr *attr; - struct stat statbuf; - int fd; - ssize_t size; - size_t sysfs_len; - - dbg("open '%s'/'%s'\n", devpath, attr_name); - sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); - if(sysfs_len >= sizeof(path_full)) - sysfs_len = sizeof(path_full) - 1; - path = &path_full[sysfs_len]; - strlcat(path_full, devpath, sizeof(path_full)); - strlcat(path_full, "/", sizeof(path_full)); - strlcat(path_full, attr_name, sizeof(path_full)); - - /* look for attribute in cache */ - list_for_each_entry(attr_loop, &attr_list, node) { - if (strcmp(attr_loop->path, path) == 0) { - dbg("found in cache '%s'\n", attr_loop->path); - return attr_loop->value; - } - } - - /* store attribute in cache (also negatives are kept in cache) */ - dbg("new uncached attribute '%s'\n", path_full); - attr = malloc(sizeof(struct sysfs_attr)); - if (attr == NULL) - return NULL; - memset(attr, 0x00, sizeof(struct sysfs_attr)); - strlcpy(attr->path, path, sizeof(attr->path)); - dbg("add to cache '%s'\n", path_full); - list_add(&attr->node, &attr_list); - - if (lstat(path_full, &statbuf) != 0) { - dbg("stat '%s' failed: %s\n", path_full, strerror(errno)); - goto out; - } - - if (S_ISLNK(statbuf.st_mode)) { - /* links return the last element of the target path */ - char link_target[PATH_SIZE]; - int len; - const char *pos; - - len = readlink(path_full, link_target, sizeof(link_target)); - if (len > 0) { - link_target[len] = '\0'; - pos = strrchr(link_target, '/'); - if (pos != NULL) { - dbg("cache '%s' with link value '%s'\n", path_full, value); - strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); - attr->value = attr->value_local; - } - } - goto out; - } - - /* skip directories */ - if (S_ISDIR(statbuf.st_mode)) - goto out; - - /* skip non-readable files */ - if ((statbuf.st_mode & S_IRUSR) == 0) - goto out; - - /* read attribute value */ - fd = open(path_full, O_RDONLY); - if (fd < 0) { - dbg("attribute '%s' can not be opened\n", path_full); - goto out; - } - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - if (size == sizeof(value)) - goto out; - - /* got a valid value, store and return it */ - value[size] = '\0'; - remove_trailing_chars(value, '\n'); - dbg("cache '%s' with attribute value '%s'\n", path_full, value); - strlcpy(attr->value_local, value, sizeof(attr->value_local)); - attr->value = attr->value_local; - -out: - return attr->value; -} - -int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char *subsystem, const char *id) -{ - size_t sysfs_len; - char path_full[PATH_SIZE]; - char *path; - struct stat statbuf; - - sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); - path = &path_full[sysfs_len]; - - if (strcmp(subsystem, "subsystem") == 0) { - strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - - strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - - strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - } - - if (strcmp(subsystem, "module") == 0) { - strlcpy(path, "/module/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - } - - if (strcmp(subsystem, "drivers") == 0) { - char subsys[NAME_SIZE]; - char *driver; - - strlcpy(subsys, id, sizeof(subsys)); - driver = strchr(subsys, ':'); - if (driver != NULL) { - driver[0] = '\0'; - driver = &driver[1]; - strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); - strlcat(path, subsys, sizeof(path_full) - sysfs_len); - strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); - strlcat(path, driver, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - - strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); - strlcat(path, subsys, sizeof(path_full) - sysfs_len); - strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); - strlcat(path, driver, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - } - goto out; - } - - strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); - strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - - strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); - strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - - strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); - strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - strlcat(path, "/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; -out: - return 0; -found: - if (S_ISLNK(statbuf.st_mode)) - sysfs_resolve_link(path, sizeof(path_full) - sysfs_len); - strlcpy(devpath_full, path, len); - return 1; -} diff --git a/udev_utils.c b/udev_utils.c deleted file mode 100644 index 00b67dadc6..0000000000 --- a/udev_utils.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright (C) 2004-2005 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - - -int log_priority(const char *priority) -{ - char *endptr; - int prio; - - prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0') - return prio; - if (strncasecmp(priority, "err", 3) == 0) - return LOG_ERR; - if (strcasecmp(priority, "info") == 0) - return LOG_INFO; - if (strcasecmp(priority, "debug") == 0) - return LOG_DEBUG; - if (string_is_true(priority)) - return LOG_ERR; - - return 0; -} - -struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort) -{ - struct name_entry *name_loop; - struct name_entry *name_new; - - /* avoid duplicate entries */ - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) == 0) { - dbg("'%s' is already in the list\n", name); - return name_loop; - } - } - - if (sort) - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) > 0) - break; - } - - name_new = malloc(sizeof(struct name_entry)); - if (name_new == NULL) - return NULL; - - strlcpy(name_new->name, name, sizeof(name_new->name)); - dbg("adding '%s'\n", name_new->name); - list_add_tail(&name_new->node, &name_loop->node); - - return name_new; -} - -struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value) -{ - struct name_entry *name_loop; - struct name_entry *name_new; - - list_for_each_entry(name_loop, name_list, node) { - if (strncmp(name_loop->name, key, strlen(key)) == 0) { - dbg("key already present '%s', replace it\n", name_loop->name); - snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); - name_loop->name[sizeof(name_loop->name)-1] = '\0'; - return name_loop; - } - } - - name_new = malloc(sizeof(struct name_entry)); - if (name_new == NULL) - return NULL; - - snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); - name_new->name[sizeof(name_new->name)-1] = '\0'; - dbg("adding '%s'\n", name_new->name); - list_add_tail(&name_new->node, &name_loop->node); - - return name_new; -} - -int name_list_key_remove(struct list_head *name_list, const char *key) -{ - struct name_entry *name_loop; - struct name_entry *name_tmp; - size_t keylen = strlen(key); - int retval = 0; - - list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { - if (strncmp(name_loop->name, key, keylen) != 0) - continue; - if (name_loop->name[keylen] != '=') - continue; - list_del(&name_loop->node); - free(name_loop); - retval = 1; - break; - } - return retval; -} - -void name_list_cleanup(struct list_head *name_list) -{ - struct name_entry *name_loop; - struct name_entry *name_tmp; - - list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { - list_del(&name_loop->node); - free(name_loop); - } -} - -/* calls function for every file found in specified directory */ -int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix) -{ - struct dirent *ent; - DIR *dir; - char filename[PATH_SIZE]; - - dbg("open directory '%s'\n", dirname); - dir = opendir(dirname); - if (dir == NULL) { - err("unable to open '%s': %s\n", dirname, strerror(errno)); - return -1; - } - - while (1) { - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - - if ((ent->d_name[0] == '.') || (ent->d_name[0] == COMMENT_CHARACTER)) - continue; - - /* look for file matching with specified suffix */ - if (suffix != NULL) { - const char *ext; - - ext = strrchr(ent->d_name, '.'); - if (ext == NULL) - continue; - if (strcmp(ext, suffix) != 0) - continue; - } - dbg("put file '%s/%s' into list\n", dirname, ent->d_name); - - snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); - filename[sizeof(filename)-1] = '\0'; - name_list_add(name_list, filename, 1); - } - - closedir(dir); - return 0; -} - -uid_t lookup_user(const char *user) -{ - struct passwd *pw; - uid_t uid = 0; - - errno = 0; - pw = getpwnam(user); - if (pw == NULL) { - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified user '%s' unknown\n", user); - else - err("error resolving user '%s': %s\n", user, strerror(errno)); - } else - uid = pw->pw_uid; - - return uid; -} - -extern gid_t lookup_group(const char *group) -{ - struct group *gr; - gid_t gid = 0; - - errno = 0; - gr = getgrnam(group); - if (gr == NULL) { - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified group '%s' unknown\n", group); - else - err("error resolving group '%s': %s\n", group, strerror(errno)); - } else - gid = gr->gr_gid; - - return gid; -} - diff --git a/udev_utils_file.c b/udev_utils_file.c deleted file mode 100644 index a492785af9..0000000000 --- a/udev_utils_file.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2004-2005 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_selinux.h" - -int create_path(const char *path) -{ - char p[PATH_SIZE]; - char *pos; - struct stat stats; - int ret; - - strlcpy(p, path, sizeof(p)); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (pos[-1] == '/') - pos--; - pos[0] = '\0'; - - dbg("stat '%s'\n", p); - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - - if (create_path(p) != 0) - return -1; - - dbg("mkdir '%s'\n", p); - selinux_setfscreatecon(p, NULL, S_IFDIR|0755); - ret = mkdir(p, 0755); - selinux_resetfscreatecon(); - if (ret == 0) - return 0; - - if (errno == EEXIST) - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - return -1; -} - -int delete_path(const char *path) -{ - char p[PATH_SIZE]; - char *pos; - int retval; - - strcpy (p, path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (1) { - *pos = '\0'; - pos = strrchr(p, '/'); - - /* don't remove the last one */ - if ((pos == p) || (pos == NULL)) - break; - - /* remove if empty */ - retval = rmdir(p); - if (errno == ENOENT) - retval = 0; - if (retval) { - if (errno == ENOTEMPTY) - return 0; - err("rmdir(%s) failed: %s\n", p, strerror(errno)); - break; - } - dbg("removed '%s'\n", p); - } - return 0; -} - -/* Reset permissions on the device node, before unlinking it to make sure, - * that permisions of possible hard links will be removed too. - */ -int unlink_secure(const char *filename) -{ - int retval; - - retval = chown(filename, 0, 0); - if (retval) - err("chown(%s, 0, 0) failed: %s\n", filename, strerror(errno)); - - retval = chmod(filename, 0000); - if (retval) - err("chmod(%s, 0000) failed: %s\n", filename, strerror(errno)); - - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - - if (retval) - err("unlink(%s) failed: %s\n", filename, strerror(errno)); - - return retval; -} - -int file_map(const char *filename, char **buf, size_t *bufsize) -{ - struct stat stats; - int fd; - - fd = open(filename, O_RDONLY); - if (fd < 0) { - return -1; - } - - if (fstat(fd, &stats) < 0) { - close(fd); - return -1; - } - - *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (*buf == MAP_FAILED) { - close(fd); - return -1; - } - *bufsize = stats.st_size; - - close(fd); - - return 0; -} - -void file_unmap(void *buf, size_t bufsize) -{ - munmap(buf, bufsize); -} - -/* return number of chars until the next newline, skip escaped newline */ -size_t buf_get_line(const char *buf, size_t buflen, size_t cur) -{ - int escape = 0; - size_t count; - - for (count = cur; count < buflen; count++) { - if (!escape && buf[count] == '\n') - break; - - if (buf[count] == '\\') - escape = 1; - else - escape = 0; - } - - return count - cur; -} diff --git a/udev_utils_string.c b/udev_utils_string.c deleted file mode 100644 index e3dc137e63..0000000000 --- a/udev_utils_string.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (C) 2004-2005 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -int string_is_true(const char *str) -{ - if (strcasecmp(str, "true") == 0) - return 1; - if (strcasecmp(str, "yes") == 0) - return 1; - if (strcasecmp(str, "1") == 0) - return 1; - return 0; -} - -void remove_trailing_chars(char *path, char c) -{ - size_t len; - - len = strlen(path); - while (len > 0 && path[len-1] == c) - path[--len] = '\0'; -} - -size_t path_encode(char *s, size_t len) -{ - char t[(len * 3)+1]; - size_t i, j; - - t[0] = '\0'; - for (i = 0, j = 0; s[i] != '\0'; i++) { - if (s[i] == '/') { - memcpy(&t[j], "\\x2f", 4); - j += 4; - } else if (s[i] == '\\') { - memcpy(&t[j], "\\x5c", 4); - j += 4; - } else { - t[j] = s[i]; - j++; - } - } - t[j] = '\0'; - strncpy(s, t, len); - return j; -} - -size_t path_decode(char *s) -{ - size_t i, j; - - for (i = 0, j = 0; s[i] != '\0'; j++) { - if (memcmp(&s[i], "\\x2f", 4) == 0) { - s[j] = '/'; - i += 4; - }else if (memcmp(&s[i], "\\x5c", 4) == 0) { - s[j] = '\\'; - i += 4; - } else { - s[j] = s[i]; - i++; - } - } - s[j] = '\0'; - return j; -} - -/* count of characters used to encode one unicode char */ -static int utf8_encoded_expected_len(const char *str) -{ - unsigned char c = (unsigned char)str[0]; - - if (c < 0x80) - return 1; - if ((c & 0xe0) == 0xc0) - return 2; - if ((c & 0xf0) == 0xe0) - return 3; - if ((c & 0xf8) == 0xf0) - return 4; - if ((c & 0xfc) == 0xf8) - return 5; - if ((c & 0xfe) == 0xfc) - return 6; - return 0; -} - -/* decode one unicode char */ -static int utf8_encoded_to_unichar(const char *str) -{ - int unichar; - int len; - int i; - - len = utf8_encoded_expected_len(str); - switch (len) { - case 1: - return (int)str[0]; - case 2: - unichar = str[0] & 0x1f; - break; - case 3: - unichar = (int)str[0] & 0x0f; - break; - case 4: - unichar = (int)str[0] & 0x07; - break; - case 5: - unichar = (int)str[0] & 0x03; - break; - case 6: - unichar = (int)str[0] & 0x01; - break; - default: - return -1; - } - - for (i = 1; i < len; i++) { - if (((int)str[i] & 0xc0) != 0x80) - return -1; - unichar <<= 6; - unichar |= (int)str[i] & 0x3f; - } - - return unichar; -} - -/* expected size used to encode one unicode char */ -static int utf8_unichar_to_encoded_len(int unichar) -{ - if (unichar < 0x80) - return 1; - if (unichar < 0x800) - return 2; - if (unichar < 0x10000) - return 3; - if (unichar < 0x200000) - return 4; - if (unichar < 0x4000000) - return 5; - return 6; -} - -/* check if unicode char has a valid numeric range */ -static int utf8_unichar_valid_range(int unichar) -{ - if (unichar > 0x10ffff) - return 0; - if ((unichar & 0xfffff800) == 0xd800) - return 0; - if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) - return 0; - if ((unichar & 0xffff) == 0xffff) - return 0; - return 1; -} - -/* validate one encoded unicode char and return its length */ -int utf8_encoded_valid_unichar(const char *str) -{ - int len; - int unichar; - int i; - - len = utf8_encoded_expected_len(str); - if (len == 0) - return -1; - - /* ascii is valid */ - if (len == 1) - return 1; - - /* check if expected encoded chars are available */ - for (i = 0; i < len; i++) - if ((str[i] & 0x80) != 0x80) - return -1; - - unichar = utf8_encoded_to_unichar(str); - - /* check if encoded length matches encoded value */ - if (utf8_unichar_to_encoded_len(unichar) != len) - return -1; - - /* check if value has valid range */ - if (!utf8_unichar_valid_range(unichar)) - return -1; - - return len; -} - -/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ -int replace_chars(char *str, const char *white) -{ - size_t i = 0; - int replaced = 0; - - while (str[i] != '\0') { - int len; - - /* accept whitelist */ - if (white != NULL && strchr(white, str[i]) != NULL) { - i++; - continue; - } - - /* accept plain ascii char */ - if ((str[i] >= '0' && str[i] <= '9') || - (str[i] >= 'A' && str[i] <= 'Z') || - (str[i] >= 'a' && str[i] <= 'z')) { - i++; - continue; - } - - /* accept hex encoding */ - if (str[i] == '\\' && str[i+1] == 'x') { - i += 2; - continue; - } - - /* accept valid utf8 */ - len = utf8_encoded_valid_unichar(&str[i]); - if (len > 1) { - i += len; - continue; - } - - /* if space is allowed, replace whitespace with ordinary space */ - if (isspace(str[i]) && strchr(white, ' ') != NULL) { - str[i] = ' '; - i++; - replaced++; - continue; - } - - /* everything else is replaced with '_' */ - str[i] = '_'; - i++; - replaced++; - } - - return replaced; -} diff --git a/udevadm.8 b/udevadm.8 deleted file mode 100644 index 65e85e6bc0..0000000000 --- a/udevadm.8 +++ /dev/null @@ -1,272 +0,0 @@ -.\" Title: udevadm -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: November 2007 -.\" Manual: udevadm -.\" Source: udev -.\" -.TH "UDEVADM" "8" "November 2007" "udev" "udevadm" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevadm - udev management tool -.SH "SYNOPSIS" -.HP 21 -\fBudevadm info \fR\fB[options]\fR -.HP 24 -\fBudevadm trigger \fR\fB[options]\fR -.HP 23 -\fBudevadm settle \fR\fB[options]\fR -.HP 36 -\fBudevadm control \fR\fB[options]\fR\fB \fR\fB\fIinstruction\fR\fR -.HP 24 -\fBudevadm monitor \fR\fB[options]\fR -.HP 29 -\fBudevadm test \fR\fB[options]\fR\fB \fR\fB\fIdevpath\fR\fR -.HP 16 -\fBudevadm version\fR -.HP 13 -\fBudevadm help\fR -.SH "DESCRIPTION" -.PP -udevadm expects a command and command specific options\. It controls the runtime behavior of udev, requests kernel events, manages the event queue, and provides simple debugging mechanisms\. -.SH "OPTIONS" -.SS "udevadm info \fIoptions\fR" -.PP -Queries the udev database for device information stored in the udev database\. It can also query the properties of a device from its sysfs representation to help creating udev rules that match this device\. -.PP -\fB\-\-query=\fR\fB\fItype\fR\fR -.RS 4 -Query the database for specified type of device data\. It needs the -\fB\-\-path\fR -or -\fB\-\-name\fR -to identify the specified device\. Valid queries are: -\fBname\fR, -\fBsymlink\fR, -\fBpath\fR, -\fBenv\fR, -\fBall\fR\. -.RE -.PP -\fB\-\-path=\fR\fB\fIdevpath\fR\fR -.RS 4 -The devpath of the device to query\. -.RE -.PP -\fB\-\-name=\fR\fB\fIfile\fR\fR -.RS 4 -The name of the device node or a symlink to query -.RE -.PP -\fB\-\-root\fR -.RS 4 -The udev root directory: -\fI/dev\fR\. If used in conjunction with a -\fBname\fR -or -\fBsymlink\fR -query, the query returns the absolute path including the root directory\. -.RE -.PP -\fB\-\-attribute\-walk\fR -.RS 4 -Print all sysfs properties of the specified device that can be used in udev rules to match the specified device\. It prints all devices along the chain, up to the root of sysfs that can be used in udev rules\. -.RE -.PP -\fB\-\-device\-id\-of\-file=\fR\fB\fIfile\fR\fR -.RS 4 -Print major/minor numbers of the underlying device, where the file lives on\. -.RE -.PP -\fB\-\-export\-db\fR -.RS 4 -Export the content of the udev database\. -.RE -.PP -\fB\-\-version\fR -.RS 4 -Print version\. -.RE -.PP -\fB\-\-help\fR -.RS 4 -Print help text\. -.RE -.SS "udevadm trigger [options]" -.PP -Request device uevents, usually used to replay events at system coldplug\. -.PP -\fB\-\-verbose\fR -.RS 4 -Print the list of devices which will be triggered\. -.RE -.PP -\fB\-\-dry\-run\fR -.RS 4 -Do not actually trigger the event\. -.RE -.PP -\fB\-\-retry\-failed\fR -.RS 4 -Trigger only the events which are failed during a previous run\. -.RE -.PP -\fB\-\-action=\fR\fB\fIaction\fR\fR -.RS 4 -Type of event to be triggered\. The default value is "add"\. -.RE -.PP -\fB\-\-subsystem\-match=\fR\fB\fIsubsystem\fR\fR -.RS 4 -Trigger events for devices which belong to a matching subsystem\. This option can be specified multiple times and supports shell style pattern matching\. -.RE -.PP -\fB\-\-subsystem\-nomatch=\fR\fB\fIsubsystem\fR\fR -.RS 4 -Do not trigger events for devices which belong to a matching subsystem\. This option can be specified multiple times and supports shell style pattern matching\. -.RE -.PP -\fB\-\-attr\-match=\fR\fB\fIattribute\fR\fR\fB=\fR\fB\fIvalue\fR\fR -.RS 4 -Trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. -.RE -.PP -\fB\-\-attr\-nomatch=\fR\fB\fIattribute\fR\fR\fB=\fR\fB\fIvalue\fR\fR -.RS 4 -Do not trigger events for devices with a matching sysfs attribute\. If a value is specified along with the attribute name, the content of the attribute is matched against the given value using shell style pattern matching\. If no value is specified, the existence of the sysfs attribute is checked\. This option can be specified multiple times\. -.RE -.PP -\fB\-\-socket=\fR\fB\fIpath\fR\fR -.RS 4 -Pass the synthesized events to the specified socket, instead of triggering a global kernel event\. All available event values will be send in the same format the kernel sends an uevent, or -\fBRUN+="socket:\fR\fB\fIpath\fR\fR\fB"\fR -sends a message\. If the first character of the specified path is an @ character, an abstract namespace socket is used, instead of an existing socket file\. -.RE -.PP -\fB\-\-env=\fR\fB\fIKEY\fR\fR\fB=\fR\fB\fIvalue\fR\fR -.RS 4 -Pass an additional environemt key to the event\. This works only with the \-\-socket option\. -.RE -.SS "udevadm settle [options]" -.PP -Watches the udev event queue, and exits if all current events are handled\. -.PP -\fB\-\-timeout=\fR\fB\fIseconds\fR\fR -.RS 4 -Maximum number of seconds to wait for the event queue to become empty\. The default value is 180 seconds\. -.RE -.PP -\fB\-\-help\fR -.RS 4 -Print help text\. -.RE -.SS "udevadm control \fIcommand\fR" -.PP -Modify the internal state of the running udev daemon\. -.PP -\fB\-\-log_priority=\fR\fB\fIvalue\fR\fR -.RS 4 -Set the internal log level of udevd\. Valid values are the numerical syslog priorities or their textual representations: -\fBerr\fR, -\fBinfo\fR -and -\fBdebug\fR\. -.RE -.PP -\fB\-\-stop_exec_queue\fR -.RS 4 -Signal udevd to stop executing new events\. Incoming events will be queued\. -.RE -.PP -\fB\-\-start_exec_queue\fR -.RS 4 -Signal udevd to enable the execution of events\. -.RE -.PP -\fB\-\-reload_rules\fR -.RS 4 -Signal udevd to reload the rules from the config\. -.RE -.PP -\fB\-\-env=\fR\fB\fIKEY\fR\fR\fB=\fR\fB\fIvalue\fR\fR -.RS 4 -Set global variable\. -.RE -.PP -\fB\-\-max_childs=\fR\fIvalue\fR -.RS 4 -Set the maximum number of events, udevd will handle at the same time\. -.RE -.PP -\fB\-\-max_childs_running=\fR\fB\fIvalue\fR\fR -.RS 4 -Set the maximum number of events, which are allowed to run at the same time\. -.RE -.PP -\fB\-\-help\fR -.RS 4 -Print help text\. -.RE -.SS "udevadm monitor [options]" -.PP -Listens to the kernel uevents and events sent out by a udev rule and prints the devpath of the event to the console\. It can be used to analyze the event timing, by comparing the timestamps of the kernel uevent and the udev event\. -.PP -\fB\-\-environment\fR -.RS 4 -Print the complete environment for all events\. Can be used to compare the kernel supplied and the udev added environment values\. -.RE -.PP -\fB\-\-kernel\fR -.RS 4 -Print the kernel uevents\. -.RE -.PP -\fB\-\-udev\fR -.RS 4 -Print the udev event after the rule processing\. -.RE -.PP -\fB\-\-help\fR -.RS 4 -Print help text\. -.RE -.SS "udevadm test [options] \fIdevpath\fR" -.PP -Simulate a udev event run for the given device, and print out debug output\. Unless forced to, no device node or symlink will be created\. -.PP -\fB\-\-action=\fR\fB\fIstring\fR\fR -.RS 4 -The action string\. -.RE -.PP -\fB\-\-subsystem=\fR\fB\fIstring\fR\fR -.RS 4 -The subsystem string\. -.RE -.PP -\fB\-\-force\fR -.RS 4 -Force the creation of a device node or symlink\. Usually the test run prints only debug output\. -.RE -.PP -\fB\-\-help\fR -.RS 4 -Print help text\. -.RE -.SS "udevadm version" -.PP -Print version number\. -.SS "udevadm help" -.PP -Print help text\. -.SH "AUTHOR" -.PP -Written by Kay Sievers -\. -.SH "SEE ALSO" -.PP -\fBudev\fR(7) -\fBudevd\fR(8) diff --git a/udevadm.c b/udevadm.c deleted file mode 100644 index 6e7d7734d2..0000000000 --- a/udevadm.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright (C) 2007 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int debug; - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - if (debug) { - vprintf(format, args); - } else - vsyslog(priority, format, args); - va_end(args); -} -#endif - -struct command { - const char *name; - int (*cmd)(int argc, char *argv[], char *envp[]); - const char *help; - int debug; -}; - -static const struct command cmds[]; - -static int version(int argc, char *argv[], char *envp[]) -{ - printf("%s\n", UDEV_VERSION); - return 0; -} - -static int help(int argc, char *argv[], char *envp[]) -{ - const struct command *cmd; - - printf("Usage: udevadm COMMAND [OPTIONS]\n"); - for (cmd = cmds; cmd->name != NULL; cmd++) - printf(" %-12s %s\n", cmd->name, cmd->help); - printf("\n"); - return 0; -} - -static const struct command cmds[] = { - { - .name = "info", - .cmd = udevinfo, - .help = "query sysfs or the udev database", - }, - { - .name = "trigger", - .cmd = udevtrigger, - .help = "request events from the kernel", - }, - { - .name = "settle", - .cmd = udevsettle, "", - .help = "wait for the event queue to finish", - }, - { - .name = "control", - .cmd = udevcontrol, - .help = "control the udev daemon", - }, - { - .name = "monitor", - .cmd = udevmonitor, - .help = "listen to kernel and udev events", - }, - { - .name = "test", - .cmd = udevtest, - .help = "simulation run", - .debug = 1, - }, - { - .name = "version", - .cmd = version, - .help = "print the version number", - }, - { - .name = "help", - .cmd = help, - .help = "print this help text", - }, - {} -}; - -int main(int argc, char *argv[], char *envp[]) -{ - const char *command; - const char *pos; - const struct command *cmd; - int rc; - - /* get binary or symlink name */ - pos = strrchr(argv[0], '/'); - if (pos != NULL) - command = &pos[1]; - else - command = argv[0]; - - /* the trailing part of the binary or symlink name is the command */ - if (strncmp(command, "udev", 4) == 0) - command = &command[4]; - - if (command == NULL || command[0] == '\0') - goto err_unknown; - - /* udevadm itself needs to strip its name from the passed options */ - if (strcmp(command, "adm") == 0) { - command = argv[1]; - argv++; - argc--; - } - - if (command == NULL) - goto err_unknown; - - /* allow command to be specified as an option */ - if (strncmp(command, "--", 2) == 0) - command += 2; - - /* find and execute command */ - for (cmd = cmds; cmd->name != NULL; cmd++) { - if (strcmp(cmd->name, command) == 0) { - debug = cmd->debug; - rc = cmd->cmd(argc, argv, envp); - goto out; - } - } - -err_unknown: - fprintf(stderr, "unknown command, try help\n\n"); - rc = 2; -out: - return rc; -} diff --git a/udevadm.xml b/udevadm.xml deleted file mode 100644 index 670c991457..0000000000 --- a/udevadm.xml +++ /dev/null @@ -1,379 +0,0 @@ - - - -
                    -
                    - udevadm - - - udevd - November 2007 - udev - - - - udevadm - 8 - - - - - udevadmudev management tool - - - - - udevadm info options - - - udevadm trigger options - - - udevadm settle options - - - udevadm control options instruction - - - udevadm monitor options - - - udevadm test options devpath - - - udevadm version - - - udevadm help - - - - DESCRIPTION - udevadm expects a command and command specific options. It - controls the runtime behavior of udev, requests kernel events, - manages the event queue, and provides simple debugging mechanisms. - - - OPTIONS - - udevadm info <replaceable>options</replaceable> - Queries the udev database for device information - stored in the udev database. It can also query the properties - of a device from its sysfs representation to help creating udev - rules that match this device. - - - - - Query the database for specified type of device data. It needs the - or to identify the specified - device. Valid queries are: - name, symlink, path, - env, all. - - - - - - The devpath of the device to query. - - - - - - The name of the device node or a symlink to query - - - - - - The udev root directory: /dev. If used in conjunction - with a name or symlink query, the - query returns the absolute path including the root directory. - - - - - - Print all sysfs properties of the specified device that can be used - in udev rules to match the specified device. It prints all devices - along the chain, up to the root of sysfs that can be used in udev rules. - - - - - - Print major/minor numbers of the underlying device, where the file - lives on. - - - - - - Export the content of the udev database. - - - - - - Print version. - - - - - - Print help text. - - - - - - udevadm trigger <optional>options</optional> - Request device uevents, usually used to replay events at system coldplug. - - - - - Print the list of devices which will be triggered. - - - - - - Do not actually trigger the event. - - - - - - Trigger only the events which are failed during a previous run. - - - - - - Type of event to be triggered. The default value is "add". - - - - - - Trigger events for devices which belong to a matching subsystem. This option - can be specified multiple times and supports shell style pattern matching. - - - - - - Do not trigger events for devices which belong to a matching subsystem. This option - can be specified multiple times and supports shell style pattern matching. - - - - - - Trigger events for devices with a matching sysfs attribute. If a value is specified - along with the attribute name, the content of the attribute is matched against the given - value using shell style pattern matching. If no value is specified, the existence of the - sysfs attribute is checked. This option can be specified multiple times. - - - - - - Do not trigger events for devices with a matching sysfs attribute. If a value is - specified along with the attribute name, the content of the attribute is matched against - the given value using shell style pattern matching. If no value is specified, the existence - of the sysfs attribute is checked. This option can be specified multiple times. - - - - - - Pass the synthesized events to the specified socket, instead of triggering - a global kernel event. All available event values will be send in the same format - the kernel sends an uevent, or - sends a message. If the first character of the specified path is an @ character, - an abstract namespace socket is used, instead of an existing socket file. - - - - - - Pass an additional environemt key to the event. This works only with the - --socket option. - - - - - - udevadm settle <optional>options</optional> - Watches the udev event queue, and exits if all current events are handled. - - - - - Maximum number of seconds to wait for the event queue to become empty. - The default value is 180 seconds. - - - - - - Print help text. - - - - - - udevadm control <replaceable>command</replaceable> - Modify the internal state of the running udev daemon. - - - - - Set the internal log level of udevd. Valid values are the numerical - syslog priorities or their textual representations: , - and . - - - - - - Signal udevd to stop executing new events. Incoming events - will be queued. - - - - - - Signal udevd to enable the execution of events. - - - - - - Signal udevd to reload the rules from the config. - - - - - - Set global variable. - - - - value - - Set the maximum number of events, udevd will handle at the - same time. - - - - - - Set the maximum number of events, which are allowed to run at the - same time. - - - - - - Print help text. - - - - - - udevadm monitor <optional>options</optional> - Listens to the kernel uevents and events sent out by a udev rule - and prints the devpath of the event to the console. It can be used to analyze the - event timing, by comparing the timestamps of the kernel uevent and the udev event. - - - - - - Print the complete environment for all events. Can be used to compare the - kernel supplied and the udev added environment values. - - - - - - Print the kernel uevents. - - - - - - Print the udev event after the rule processing. - - - - - - Print help text. - - - - - - udevadm test <optional>options</optional> <replaceable>devpath</replaceable> - Simulate a udev event run for the given device, and print out debug - output. Unless forced to, no device node or symlink will be created. - - - - - The action string. - - - - - - The subsystem string. - - - - - - Force the creation of a device node or symlink. Usually the test run - prints only debug output. - - - - - - Print help text. - - - - - - udevadm version - Print version number. - - - udevadm help - Print help text. - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev7 - - - udevd8 - - - -
                    -
                    diff --git a/udevcontrol.c b/udevcontrol.c deleted file mode 100644 index 4c93b8f464..0000000000 --- a/udevcontrol.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2005-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" - -static int sock = -1; -static int udev_log = 0; - -int udevcontrol(int argc, char *argv[], char *envp[]) -{ - static struct udevd_ctrl_msg ctrl_msg; - struct sockaddr_un saddr; - socklen_t addrlen; - const char *env; - const char *arg; - const char *val; - int *intval; - int retval = 1; - - env = getenv("UDEV_LOG"); - if (env) - udev_log = log_priority(env); - - logging_init("udevcontrol"); - dbg("version %s\n", UDEV_VERSION); - - if (argc < 2) { - fprintf(stderr, "missing command\n\n"); - goto exit; - } - memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); - strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); - arg = argv[1]; - - /* allow instructions passed as options */ - if (strncmp(arg, "--", 2) == 0) - arg += 2; - - if (!strcmp(arg, "stop_exec_queue")) - ctrl_msg.type = UDEVD_CTRL_STOP_EXEC_QUEUE; - else if (!strcmp(arg, "start_exec_queue")) - ctrl_msg.type = UDEVD_CTRL_START_EXEC_QUEUE; - else if (!strcmp(arg, "reload_rules")) - ctrl_msg.type = UDEVD_CTRL_RELOAD_RULES; - else if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { - intval = (int *) ctrl_msg.buf; - val = &arg[strlen("log_priority=")]; - ctrl_msg.type = UDEVD_CTRL_SET_LOG_LEVEL; - *intval = log_priority(val); - info("send log_priority=%i\n", *intval); - } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { - char *endp; - int count; - - intval = (int *) ctrl_msg.buf; - val = &arg[strlen("max_childs=")]; - ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS; - count = strtoul(val, &endp, 0); - if (endp[0] != '\0' || count < 1) { - fprintf(stderr, "invalid number\n"); - goto exit; - } - *intval = count; - info("send max_childs=%i\n", *intval); - } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { - char *endp; - int count; - - intval = (int *) ctrl_msg.buf; - val = &arg[strlen("max_childs_running=")]; - ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS_RUNNING; - count = strtoul(val, &endp, 0); - if (endp[0] != '\0' || count < 1) { - fprintf(stderr, "invalid number\n"); - goto exit; - } - *intval = count; - info("send max_childs_running=%i\n", *intval); - } else if (!strncmp(arg, "env", strlen("env"))) { - if (!strncmp(arg, "env=", strlen("env="))) - val = &arg[strlen("env=")]; - else - val = argv[2]; - if (val == NULL) { - fprintf(stderr, "missing key\n"); - goto exit; - } - ctrl_msg.type = UDEVD_CTRL_ENV; - strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf)); - info("send env '%s'\n", val); - } else if (strcmp(arg, "help") == 0 || strcmp(arg, "-h") == 0) { - printf("Usage: udevadm control COMMAND\n" - " --log_priority= set the udev log level for the daemon\n" - " --stop_exec_queue keep udevd from executing events, queue only\n" - " --start_exec_queue execute events, flush queue\n" - " --reload_rules reloads the rules files\n" - " --env== set a global environment variable\n" - " --max_childs= maximum number of childs\n" - " --max_childs_running= maximum number of childs running at the same time\n" - " --help print this help text\n\n"); - goto exit; - } else { - fprintf(stderr, "unrecognized command '%s'\n", arg); - goto exit; - } - - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - goto exit; - } - - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (sock == -1) { - err("error getting socket: %s\n", strerror(errno)); - goto exit; - } - - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - - retval = sendto(sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&saddr, addrlen); - if (retval == -1) { - err("error sending message: %s\n", strerror(errno)); - retval = 1; - } else { - dbg("sent message type=0x%02x, %u bytes sent\n", ctrl_msg.type, retval); - retval = 0; - } - - close(sock); -exit: - logging_close(); - return retval; -} diff --git a/udevd.8 b/udevd.8 deleted file mode 100644 index c6b481134d..0000000000 --- a/udevd.8 +++ /dev/null @@ -1,61 +0,0 @@ -.\" Title: udevd -.\" Author: -.\" Generator: DocBook XSL Stylesheets v1.73.2 -.\" Date: August 2005 -.\" Manual: udevd -.\" Source: udev -.\" -.TH "UDEVD" "8" "August 2005" "udev" "udevd" -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH "NAME" -udevd - event managing daemon -.SH "SYNOPSIS" -.HP 6 -\fBudevd\fR [\fB\-\-daemon\fR] [\fB\-\-debug\-trace\fR] [\fB\-\-debug\fR] [\fB\-\-version\fR] [\fB\-\-help\fR] -.SH "DESCRIPTION" -.PP -udevd listens to kernel uevents and passes the incoming events to udev\. It ensures the correct event order and takes care, that events for child devices are delayed until the parent event has finished the device handling\. The behavior of the running daemon can be changed with -\fBudevadm control\fR\. -.SH "OPTIONS" -.PP -\fB\-\-daemon\fR -.RS 4 -Detach and run in the background\. -.RE -.PP -\fB\-\-debug\-trace\fR -.RS 4 -Run all events completely serialized\. This may be useful if udev triggers actions or loads kernel modules which cause problems and a slow but continuous operation is needed, where no events are processed in parallel\. -.RE -.PP -\fB\-\-debug\fR -.RS 4 -Print log messages to stdout\. -.RE -.PP -\fB\-\-version\fR -.RS 4 -Print version number\. -.RE -.PP -\fBhelp\fR -.RS 4 -Print help text\. -.RE -.SH "ENVIRONMENT" -.PP -\fBUDEV_LOG\fR -.RS 4 -Overrides the syslog priority specified in the config file\. -.RE -.SH "AUTHOR" -.PP -Written by Kay Sievers -\. -.SH "SEE ALSO" -.PP -\fBudev\fR(7), -\fBudevadm\fR(8) diff --git a/udevd.c b/udevd.c deleted file mode 100644 index 0827a5ceb3..0000000000 --- a/udevd.c +++ /dev/null @@ -1,1304 +0,0 @@ -/* - * Copyright (C) 2004-2006 Kay Sievers - * Copyright (C) 2004 Chris Friesen - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" -#include "udevd.h" -#include "udev_selinux.h" - -static int debug_trace; -static int debug; - -static struct udev_rules rules; -static int udevd_sock = -1; -static int uevent_netlink_sock = -1; -static int inotify_fd = -1; -static pid_t sid; - -static int signal_pipe[2] = {-1, -1}; -static volatile int sigchilds_waiting; -static volatile int udev_exit; -static volatile int reload_config; -static int run_exec_q; -static int stop_exec_q; -static int max_childs; -static int max_childs_running; -static char udev_log[32]; - -static LIST_HEAD(exec_list); -static LIST_HEAD(running_list); - - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - if (debug) { - printf("[%d] ", (int) getpid()); - vprintf(format, args); - } else - vsyslog(priority, format, args); - va_end(args); -} - -#endif - -static void asmlinkage udev_event_sig_handler(int signum) -{ - if (signum == SIGALRM) - exit(1); -} - -static int udev_event_process(struct udevd_uevent_msg *msg) -{ - struct sigaction act; - struct udevice *udev; - int i; - int retval; - - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = (void (*)(int)) udev_event_sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - - /* reset to default */ - act.sa_handler = SIG_DFL; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigaction(SIGCHLD, &act, NULL); - sigaction(SIGHUP, &act, NULL); - - /* trigger timeout to prevent hanging processes */ - alarm(UDEV_EVENT_TIMEOUT); - - /* reconstruct event environment from message */ - for (i = 0; msg->envp[i]; i++) - putenv(msg->envp[i]); - - udev = udev_device_init(NULL); - if (udev == NULL) - return -1; - strlcpy(udev->action, msg->action, sizeof(udev->action)); - sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem, msg->driver); - udev->devpath_old = msg->devpath_old; - udev->devt = msg->devt; - - retval = udev_device_event(&rules, udev); - - /* rules may change/disable the timeout */ - if (udev->event_timeout >= 0) - alarm(udev->event_timeout); - - /* run programs collected by RUN-key*/ - if (retval == 0 && !udev->ignore_device && udev_run) - retval = udev_rules_run(udev); - - udev_device_cleanup(udev); - return retval; -} - -enum event_state { - EVENT_QUEUED, - EVENT_FINISHED, - EVENT_FAILED, -}; - -static void export_event_state(struct udevd_uevent_msg *msg, enum event_state state) -{ - char filename[PATH_SIZE]; - char filename_failed[PATH_SIZE]; - size_t start; - - /* location of queue file */ - snprintf(filename, sizeof(filename), "%s/"EVENT_QUEUE_DIR"/%llu", udev_root, msg->seqnum); - - /* location of failed file */ - strlcpy(filename_failed, udev_root, sizeof(filename_failed)); - strlcat(filename_failed, "/", sizeof(filename_failed)); - start = strlcat(filename_failed, EVENT_FAILED_DIR"/", sizeof(filename_failed)); - strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); - path_encode(&filename_failed[start], sizeof(filename_failed) - start); - - switch (state) { - case EVENT_QUEUED: - unlink(filename_failed); - delete_path(filename_failed); - - create_path(filename); - selinux_setfscreatecon(filename, NULL, S_IFLNK); - symlink(msg->devpath, filename); - selinux_resetfscreatecon(); - break; - case EVENT_FINISHED: - if (msg->devpath_old != NULL) { - /* "move" event - rename failed file to current name, do not delete failed */ - char filename_failed_old[PATH_SIZE]; - - strlcpy(filename_failed_old, udev_root, sizeof(filename_failed_old)); - strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); - start = strlcat(filename_failed_old, EVENT_FAILED_DIR"/", sizeof(filename_failed_old)); - strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); - path_encode(&filename_failed_old[start], sizeof(filename) - start); - - if (rename(filename_failed_old, filename_failed) == 0) - info("renamed devpath, moved failed state of '%s' to %s'\n", - msg->devpath_old, msg->devpath); - } else { - unlink(filename_failed); - delete_path(filename_failed); - } - - unlink(filename); - delete_path(filename); - break; - case EVENT_FAILED: - /* move failed event to the failed directory */ - create_path(filename_failed); - rename(filename, filename_failed); - - /* clean up possibly empty queue directory */ - delete_path(filename); - break; - } - - return; -} - -static void msg_queue_delete(struct udevd_uevent_msg *msg) -{ - list_del(&msg->node); - - /* mark as failed, if "add" event returns non-zero */ - if (msg->exitstatus && strcmp(msg->action, "add") == 0) - export_event_state(msg, EVENT_FAILED); - else - export_event_state(msg, EVENT_FINISHED); - - free(msg); -} - -static void udev_event_run(struct udevd_uevent_msg *msg) -{ - pid_t pid; - int retval; - - pid = fork(); - switch (pid) { - case 0: - /* child */ - close(uevent_netlink_sock); - close(udevd_sock); - if (inotify_fd >= 0) - close(inotify_fd); - close(signal_pipe[READ_END]); - close(signal_pipe[WRITE_END]); - logging_close(); - - logging_init("udevd-event"); - setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); - - retval = udev_event_process(msg); - info("seq %llu finished with %i\n", msg->seqnum, retval); - - logging_close(); - if (retval) - exit(1); - exit(0); - case -1: - err("fork of child failed: %s\n", strerror(errno)); - msg_queue_delete(msg); - break; - default: - /* get SIGCHLD in main loop */ - info("seq %llu forked, pid [%d], '%s' '%s', %ld seconds old\n", - msg->seqnum, pid, msg->action, msg->subsystem, time(NULL) - msg->queue_time); - msg->pid = pid; - } -} - -static void msg_queue_insert(struct udevd_uevent_msg *msg) -{ - char filename[PATH_SIZE]; - int fd; - - msg->queue_time = time(NULL); - - export_event_state(msg, EVENT_QUEUED); - info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); - - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd >= 0) { - char str[32]; - int len; - - len = sprintf(str, "%llu\n", msg->seqnum); - write(fd, str, len); - close(fd); - } - - /* run one event after the other in debug mode */ - if (debug_trace) { - list_add_tail(&msg->node, &running_list); - udev_event_run(msg); - waitpid(msg->pid, NULL, 0); - msg_queue_delete(msg); - return; - } - - /* run all events with a timeout set immediately */ - if (msg->timeout != 0) { - list_add_tail(&msg->node, &running_list); - udev_event_run(msg); - return; - } - - list_add_tail(&msg->node, &exec_list); - run_exec_q = 1; -} - -static int mem_size_mb(void) -{ - FILE* f; - char buf[4096]; - long int memsize = -1; - - f = fopen("/proc/meminfo", "r"); - if (f == NULL) - return -1; - - while (fgets(buf, sizeof(buf), f) != NULL) { - long int value; - - if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { - memsize = value / 1024; - break; - } - } - - fclose(f); - return memsize; -} - -static int cpu_count(void) -{ - FILE* f; - char buf[4096]; - int count = 0; - - f = fopen("/proc/stat", "r"); - if (f == NULL) - return -1; - - while (fgets(buf, sizeof(buf), f) != NULL) { - if (strncmp(buf, "cpu", 3) == 0 && isdigit(buf[3])) - count++; - } - - fclose(f); - if (count == 0) - return -1; - return count; -} - -static int running_processes(void) -{ - FILE* f; - char buf[4096]; - int running = -1; - - f = fopen("/proc/stat", "r"); - if (f == NULL) - return -1; - - while (fgets(buf, sizeof(buf), f) != NULL) { - int value; - - if (sscanf(buf, "procs_running %u", &value) == 1) { - running = value; - break; - } - } - - fclose(f); - return running; -} - -/* return the number of process es in our session, count only until limit */ -static int running_processes_in_session(pid_t session, int limit) -{ - DIR *dir; - struct dirent *dent; - int running = 0; - - dir = opendir("/proc"); - if (!dir) - return -1; - - /* read process info from /proc */ - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - int f; - char procdir[64]; - char line[256]; - const char *pos; - char state; - pid_t ppid, pgrp, sess; - int len; - - if (!isdigit(dent->d_name[0])) - continue; - - snprintf(procdir, sizeof(procdir), "/proc/%s/stat", dent->d_name); - procdir[sizeof(procdir)-1] = '\0'; - - f = open(procdir, O_RDONLY); - if (f == -1) - continue; - - len = read(f, line, sizeof(line)-1); - close(f); - - if (len <= 0) - continue; - else - line[len] = '\0'; - - /* skip ugly program name */ - pos = strrchr(line, ')') + 2; - if (pos == NULL) - continue; - - if (sscanf(pos, "%c %d %d %d ", &state, &ppid, &pgrp, &sess) != 4) - continue; - - /* count only processes in our session */ - if (sess != session) - continue; - - /* count only running, no sleeping processes */ - if (state != 'R') - continue; - - running++; - if (limit > 0 && running >= limit) - break; - } - closedir(dir); - - return running; -} - -static int compare_devpath(const char *running, const char *waiting) -{ - int i; - - for (i = 0; i < PATH_SIZE; i++) { - /* identical device event found */ - if (running[i] == '\0' && waiting[i] == '\0') - return 1; - - /* parent device event found */ - if (running[i] == '\0' && waiting[i] == '/') - return 2; - - /* child device event found */ - if (running[i] == '/' && waiting[i] == '\0') - return 3; - - /* no matching event */ - if (running[i] != waiting[i]) - break; - } - - return 0; -} - -/* lookup event for identical, parent, child, or physical device */ -static int devpath_busy(struct udevd_uevent_msg *msg, int limit) -{ - struct udevd_uevent_msg *loop_msg; - int childs_count = 0; - - /* check exec-queue which may still contain delayed events we depend on */ - list_for_each_entry(loop_msg, &exec_list, node) { - /* skip ourself and all later events */ - if (loop_msg->seqnum >= msg->seqnum) - break; - - /* check our old name */ - if (msg->devpath_old != NULL) - if (strcmp(loop_msg->devpath , msg->devpath_old) == 0) - return 2; - - /* check identical, parent, or child device event */ - if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg("%llu, device event still pending %llu (%s)\n", - msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 3; - } - - /* check for our major:minor number */ - if (msg->devt && loop_msg->devt == msg->devt && - strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg("%llu, device event still pending %llu (%d:%d)\n", msg->seqnum, - loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); - return 4; - } - - /* check physical device event (special case of parent) */ - if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) - if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg("%llu, physical device event still pending %llu (%s)\n", - msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 5; - } - } - - /* check run queue for still running events */ - list_for_each_entry(loop_msg, &running_list, node) { - if (limit && childs_count++ > limit) { - dbg("%llu, maximum number (%i) of childs reached\n", msg->seqnum, childs_count); - return 1; - } - - /* check our old name */ - if (msg->devpath_old != NULL) - if (strcmp(loop_msg->devpath , msg->devpath_old) == 0) - return 2; - - /* check identical, parent, or child device event */ - if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg("%llu, device event still running %llu (%s)\n", - msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 3; - } - - /* check for our major:minor number */ - if (msg->devt && loop_msg->devt == msg->devt && - strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg("%llu, device event still running %llu (%d:%d)\n", msg->seqnum, - loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); - return 4; - } - - /* check physical device event (special case of parent) */ - if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) - if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg("%llu, physical device event still running %llu (%s)\n", - msg->seqnum, loop_msg->seqnum, loop_msg->devpath); - return 5; - } - } - return 0; -} - -/* serializes events for the identical and parent and child devices */ -static void msg_queue_manager(void) -{ - struct udevd_uevent_msg *loop_msg; - struct udevd_uevent_msg *tmp_msg; - int running; - - if (list_empty(&exec_list)) - return; - - running = running_processes(); - dbg("%d processes runnning on system\n", running); - if (running < 0) - running = max_childs_running; - - list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, node) { - /* check running processes in our session and possibly throttle */ - if (running >= max_childs_running) { - running = running_processes_in_session(sid, max_childs_running+10); - dbg("at least %d processes running in session\n", running); - if (running >= max_childs_running) { - dbg("delay seq %llu, too many processes already running\n", loop_msg->seqnum); - return; - } - } - - /* serialize and wait for parent or child events */ - if (devpath_busy(loop_msg, max_childs) != 0) { - dbg("delay seq %llu (%s)\n", loop_msg->seqnum, loop_msg->devpath); - continue; - } - - /* move event to run list */ - list_move_tail(&loop_msg->node, &running_list); - udev_event_run(loop_msg); - running++; - dbg("moved seq %llu to running list\n", loop_msg->seqnum); - } -} - -static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) -{ - int bufpos; - int i; - struct udevd_uevent_msg *msg; - char *physdevdriver_key = NULL; - int maj = 0; - int min = 0; - - msg = malloc(sizeof(struct udevd_uevent_msg) + buf_size); - if (msg == NULL) - return NULL; - memset(msg, 0x00, sizeof(struct udevd_uevent_msg) + buf_size); - - /* copy environment buffer and reconstruct envp */ - memcpy(msg->envbuf, buf, buf_size); - bufpos = 0; - for (i = 0; (bufpos < buf_size) && (i < UEVENT_NUM_ENVP-2); i++) { - int keylen; - char *key; - - key = &msg->envbuf[bufpos]; - keylen = strlen(key); - msg->envp[i] = key; - bufpos += keylen + 1; - dbg("add '%s' to msg.envp[%i]\n", msg->envp[i], i); - - /* remember some keys for further processing */ - if (strncmp(key, "ACTION=", 7) == 0) - msg->action = &key[7]; - else if (strncmp(key, "DEVPATH=", 8) == 0) - msg->devpath = &key[8]; - else if (strncmp(key, "SUBSYSTEM=", 10) == 0) - msg->subsystem = &key[10]; - else if (strncmp(key, "DRIVER=", 7) == 0) - msg->driver = &key[7]; - else if (strncmp(key, "SEQNUM=", 7) == 0) - msg->seqnum = strtoull(&key[7], NULL, 10); - else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) - msg->devpath_old = &key[12]; - else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) - msg->physdevpath = &key[12]; - else if (strncmp(key, "PHYSDEVDRIVER=", 14) == 0) - physdevdriver_key = key; - else if (strncmp(key, "MAJOR=", 6) == 0) - maj = strtoull(&key[6], NULL, 10); - else if (strncmp(key, "MINOR=", 6) == 0) - min = strtoull(&key[6], NULL, 10); - else if (strncmp(key, "TIMEOUT=", 8) == 0) - msg->timeout = strtoull(&key[8], NULL, 10); - } - msg->devt = makedev(maj, min); - msg->envp[i++] = "UDEVD_EVENT=1"; - - if (msg->driver == NULL && msg->physdevpath == NULL && physdevdriver_key != NULL) { - /* for older kernels DRIVER is empty for a bus device, export PHYSDEVDRIVER as DRIVER */ - msg->envp[i++] = &physdevdriver_key[7]; - msg->driver = &physdevdriver_key[14]; - } - - msg->envp[i] = NULL; - - if (msg->devpath == NULL || msg->action == NULL) { - info("DEVPATH or ACTION missing, ignore message\n"); - free(msg); - return NULL; - } - return msg; -} - -/* receive the udevd message from userspace */ -static void get_ctrl_msg(void) -{ - struct udevd_ctrl_msg ctrl_msg; - ssize_t size; - struct msghdr smsg; - struct cmsghdr *cmsg; - struct iovec iov; - struct ucred *cred; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - int *intval; - char *pos; - - memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); - iov.iov_base = &ctrl_msg; - iov.iov_len = sizeof(struct udevd_ctrl_msg); - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - - size = recvmsg(udevd_sock, &smsg, 0); - if (size < 0) { - if (errno != EINTR) - err("unable to receive user udevd message: %s\n", strerror(errno)); - return; - } - cmsg = CMSG_FIRSTHDR(&smsg); - cred = (struct ucred *) CMSG_DATA(cmsg); - - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err("no sender credentials received, message ignored\n"); - return; - } - - if (cred->uid != 0) { - err("sender uid=%i, message ignored\n", cred->uid); - return; - } - - if (strncmp(ctrl_msg.magic, UDEVD_CTRL_MAGIC, sizeof(UDEVD_CTRL_MAGIC)) != 0 ) { - err("message magic '%s' doesn't match, ignore it\n", ctrl_msg.magic); - return; - } - - switch (ctrl_msg.type) { - case UDEVD_CTRL_ENV: - pos = strchr(ctrl_msg.buf, '='); - if (pos == NULL) { - err("wrong key format '%s'\n", ctrl_msg.buf); - break; - } - pos[0] = '\0'; - if (pos[1] == '\0') { - info("udevd message (ENV) received, unset '%s'\n", ctrl_msg.buf); - unsetenv(ctrl_msg.buf); - } else { - info("udevd message (ENV) received, set '%s=%s'\n", ctrl_msg.buf, &pos[1]); - setenv(ctrl_msg.buf, &pos[1], 1); - } - break; - case UDEVD_CTRL_STOP_EXEC_QUEUE: - info("udevd message (STOP_EXEC_QUEUE) received\n"); - stop_exec_q = 1; - break; - case UDEVD_CTRL_START_EXEC_QUEUE: - info("udevd message (START_EXEC_QUEUE) received\n"); - stop_exec_q = 0; - msg_queue_manager(); - break; - case UDEVD_CTRL_SET_LOG_LEVEL: - intval = (int *) ctrl_msg.buf; - info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i\n", *intval); - udev_log_priority = *intval; - sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); - putenv(udev_log); - break; - case UDEVD_CTRL_SET_MAX_CHILDS: - intval = (int *) ctrl_msg.buf; - info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i\n", *intval); - max_childs = *intval; - break; - case UDEVD_CTRL_SET_MAX_CHILDS_RUNNING: - intval = (int *) ctrl_msg.buf; - info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs=%i\n", *intval); - max_childs_running = *intval; - break; - case UDEVD_CTRL_RELOAD_RULES: - info("udevd message (RELOAD_RULES) received\n"); - reload_config = 1; - break; - default: - err("unknown control message type\n"); - } -} - -/* receive the kernel user event message and do some sanity checks */ -static struct udevd_uevent_msg *get_netlink_msg(void) -{ - struct udevd_uevent_msg *msg; - int bufpos; - ssize_t size; - static char buffer[UEVENT_BUFFER_SIZE+512]; - char *pos; - - size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); - if (size < 0) { - if (errno != EINTR) - err("unable to receive kernel netlink message: %s\n", strerror(errno)); - return NULL; - } - - if ((size_t)size > sizeof(buffer)-1) - size = sizeof(buffer)-1; - buffer[size] = '\0'; - dbg("uevent_size=%zi\n", size); - - /* start of event payload */ - bufpos = strlen(buffer)+1; - msg = get_msg_from_envbuf(&buffer[bufpos], size-bufpos); - if (msg == NULL) - return NULL; - - /* validate message */ - pos = strchr(buffer, '@'); - if (pos == NULL) { - err("invalid uevent '%s'\n", buffer); - free(msg); - return NULL; - } - pos[0] = '\0'; - - if (msg->action == NULL) { - info("no ACTION in payload found, skip event '%s'\n", buffer); - free(msg); - return NULL; - } - - if (strcmp(msg->action, buffer) != 0) { - err("ACTION in payload does not match uevent, skip event '%s'\n", buffer); - free(msg); - return NULL; - } - - return msg; -} - -static void asmlinkage sig_handler(int signum) -{ - switch (signum) { - case SIGINT: - case SIGTERM: - udev_exit = 1; - break; - case SIGCHLD: - /* set flag, then write to pipe if needed */ - sigchilds_waiting = 1; - break; - case SIGHUP: - reload_config = 1; - break; - } - - /* write to pipe, which will wakeup select() in our mainloop */ - write(signal_pipe[WRITE_END], "", 1); -} - -static void udev_done(int pid, int exitstatus) -{ - /* find msg associated with pid and delete it */ - struct udevd_uevent_msg *msg; - - list_for_each_entry(msg, &running_list, node) { - if (msg->pid == pid) { - info("seq %llu, pid [%d] exit with %i, %ld seconds old\n", msg->seqnum, msg->pid, - exitstatus, time(NULL) - msg->queue_time); - msg->exitstatus = exitstatus; - msg_queue_delete(msg); - - /* there may be events waiting with the same devpath */ - run_exec_q = 1; - return; - } - } -} - -static void reap_sigchilds(void) -{ - pid_t pid; - int status; - - while (1) { - pid = waitpid(-1, &status, WNOHANG); - if (pid <= 0) - break; - if (WIFEXITED(status)) - status = WEXITSTATUS(status); - else if (WIFSIGNALED(status)) - status = WTERMSIG(status) + 128; - else - status = 0; - udev_done(pid, status); - } -} - -static int init_udevd_socket(void) -{ - struct sockaddr_un saddr; - socklen_t addrlen; - const int feature_on = 1; - int retval; - - memset(&saddr, 0x00, sizeof(saddr)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - - udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (udevd_sock == -1) { - err("error getting socket: %s\n", strerror(errno)); - return -1; - } - - /* the bind takes care of ensuring only one copy running */ - retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); - if (retval < 0) { - err("bind failed: %s\n", strerror(errno)); - close(udevd_sock); - udevd_sock = -1; - return -1; - } - - /* enable receiving of the sender credentials */ - setsockopt(udevd_sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); - - return 0; -} - -static int init_uevent_netlink_sock(void) -{ - struct sockaddr_nl snl; - const int buffersize = 16 * 1024 * 1024; - int retval; - - memset(&snl, 0x00, sizeof(struct sockaddr_nl)); - snl.nl_family = AF_NETLINK; - snl.nl_pid = getpid(); - snl.nl_groups = 1; - - uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); - if (uevent_netlink_sock == -1) { - err("error getting socket: %s\n", strerror(errno)); - return -1; - } - - /* set receive buffersize */ - setsockopt(uevent_netlink_sock, SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize)); - - retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); - if (retval < 0) { - err("bind failed: %s\n", strerror(errno)); - close(uevent_netlink_sock); - uevent_netlink_sock = -1; - return -1; - } - return 0; -} - -static void export_initial_seqnum(void) -{ - char filename[PATH_SIZE]; - int fd; - char seqnum[32]; - ssize_t len = 0; - - strlcpy(filename, sysfs_path, sizeof(filename)); - strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); - fd = open(filename, O_RDONLY); - if (fd >= 0) { - len = read(fd, seqnum, sizeof(seqnum)-1); - close(fd); - } - if (len <= 0) { - strcpy(seqnum, "0\n"); - len = 3; - } - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); - create_path(filename); - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd >= 0) { - write(fd, seqnum, len); - close(fd); - } -} - -int main(int argc, char *argv[], char *envp[]) -{ - int retval; - int fd; - struct sigaction act; - fd_set readfds; - const char *value; - int daemonize = 0; - int option; - static const struct option options[] = { - { "daemon", 0, NULL, 'd' }, - { "debug-trace", 0, NULL, 't' }, - { "debug", 0, NULL, 'D' }, - { "help", 0, NULL, 'h' }, - { "version", 0, NULL, 'V' }, - {} - }; - int rc = 1; - int maxfd; - - logging_init("udevd"); - udev_config_init(); - selinux_init(); - dbg("version %s\n", UDEV_VERSION); - - while (1) { - option = getopt_long(argc, argv, "dDthV", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - daemonize = 1; - break; - case 't': - debug_trace = 1; - break; - case 'D': - debug = 1; - if (udev_log_priority < LOG_INFO) - udev_log_priority = LOG_INFO; - break; - case 'h': - printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n"); - goto exit; - case 'V': - printf("%s\n", UDEV_VERSION); - goto exit; - default: - goto exit; - } - } - - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - err("root privileges required\n"); - goto exit; - } - - /* make sure std{in,out,err} fd's are in a sane state */ - fd = open("/dev/null", O_RDWR); - if (fd < 0) { - fprintf(stderr, "cannot open /dev/null\n"); - err("cannot open /dev/null\n"); - } - if (fd > STDIN_FILENO) - dup2(fd, STDIN_FILENO); - if (write(STDOUT_FILENO, 0, 0) < 0) - dup2(fd, STDOUT_FILENO); - if (write(STDERR_FILENO, 0, 0) < 0) - dup2(fd, STDERR_FILENO); - - /* init sockets to receive events */ - if (init_udevd_socket() < 0) { - if (errno == EADDRINUSE) { - fprintf(stderr, "another udev daemon already running\n"); - err("another udev daemon already running\n"); - rc = 1; - } else { - fprintf(stderr, "error initializing udevd socket\n"); - err("error initializing udevd socket\n"); - rc = 2; - } - goto exit; - } - - if (init_uevent_netlink_sock() < 0) { - fprintf(stderr, "error initializing netlink socket\n"); - err("error initializing netlink socket\n"); - rc = 3; - goto exit; - } - - /* setup signal handler pipe */ - retval = pipe(signal_pipe); - if (retval < 0) { - err("error getting pipes: %s\n", strerror(errno)); - goto exit; - } - - retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); - if (retval < 0) { - err("error fcntl on read pipe: %s\n", strerror(errno)); - goto exit; - } - retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); - if (retval < 0) { - err("error fcntl on read pipe: %s\n", strerror(errno)); - goto exit; - } - - retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); - if (retval < 0) { - err("error fcntl on write pipe: %s\n", strerror(errno)); - goto exit; - } - retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); - if (retval < 0) { - err("error fcntl on write pipe: %s\n", strerror(errno)); - goto exit; - } - - /* parse the rules and keep them in memory */ - sysfs_init(); - udev_rules_init(&rules, 1); - - export_initial_seqnum(); - - if (daemonize) { - pid_t pid; - - pid = fork(); - switch (pid) { - case 0: - dbg("daemonized fork running\n"); - break; - case -1: - err("fork of daemon failed: %s\n", strerror(errno)); - rc = 4; - goto exit; - default: - dbg("child [%u] running, parent exits\n", pid); - rc = 0; - goto exit; - } - } - - /* redirect std{out,err} fd's */ - if (!debug) - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - if (fd > STDERR_FILENO) - close(fd); - - /* set scheduling priority for the daemon */ - setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); - - chdir("/"); - umask(022); - - /* become session leader */ - sid = setsid(); - dbg("our session is %d\n", sid); - - /* OOM_DISABLE == -17 */ - fd = open("/proc/self/oom_adj", O_RDWR); - if (fd < 0) - err("error disabling OOM: %s\n", strerror(errno)); - else { - write(fd, "-17", 3); - close(fd); - } - - fd = open("/dev/kmsg", O_WRONLY); - if (fd > 0) { - const char *str = "<6>udevd version " UDEV_VERSION " started\n"; - - write(fd, str, strlen(str)); - close(fd); - } - - /* set signal handlers */ - memset(&act, 0x00, sizeof(struct sigaction)); - act.sa_handler = (void (*)(int)) sig_handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_RESTART; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigaction(SIGCHLD, &act, NULL); - sigaction(SIGHUP, &act, NULL); - - /* watch rules directory */ - inotify_fd = inotify_init(); - if (inotify_fd >= 0) { - if (udev_rules_dir[0] != '\0') { - inotify_add_watch(inotify_fd, udev_rules_dir, - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - } else { - char filename[PATH_MAX]; - - inotify_add_watch(inotify_fd, RULES_LIB_DIR, - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - inotify_add_watch(inotify_fd, RULES_ETC_DIR, - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - - /* watch dynamic rules directory */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); - inotify_add_watch(inotify_fd, filename, - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - } - } else if (errno == ENOSYS) - err("the kernel does not support inotify, udevd can't monitor rules file changes\n"); - else - err("inotify_init failed: %s\n", strerror(errno)); - - /* maximum limit of forked childs */ - value = getenv("UDEVD_MAX_CHILDS"); - if (value) - max_childs = strtoul(value, NULL, 10); - else { - int memsize = mem_size_mb(); - if (memsize > 0) - max_childs = 128 + (memsize / 4); - else - max_childs = UDEVD_MAX_CHILDS; - } - info("initialize max_childs to %u\n", max_childs); - - /* start to throttle forking if maximum number of _running_ childs is reached */ - value = getenv("UDEVD_MAX_CHILDS_RUNNING"); - if (value) - max_childs_running = strtoull(value, NULL, 10); - else { - int cpus = cpu_count(); - if (cpus > 0) - max_childs_running = 8 + (8 * cpus); - else - max_childs_running = UDEVD_MAX_CHILDS_RUNNING; - } - info("initialize max_childs_running to %u\n", max_childs_running); - - /* clear environment for forked event processes */ - clearenv(); - - /* export log_priority , as called programs may want to follow that setting */ - sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); - putenv(udev_log); - if (debug_trace) - putenv("DEBUG=1"); - - maxfd = udevd_sock; - maxfd = UDEV_MAX(maxfd, uevent_netlink_sock); - maxfd = UDEV_MAX(maxfd, signal_pipe[READ_END]); - maxfd = UDEV_MAX(maxfd, inotify_fd); - - while (!udev_exit) { - struct udevd_uevent_msg *msg; - int fdcount; - - FD_ZERO(&readfds); - FD_SET(signal_pipe[READ_END], &readfds); - FD_SET(udevd_sock, &readfds); - FD_SET(uevent_netlink_sock, &readfds); - if (inotify_fd >= 0) - FD_SET(inotify_fd, &readfds); - - fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno != EINTR) - err("error in select: %s\n", strerror(errno)); - continue; - } - - /* get control message */ - if (FD_ISSET(udevd_sock, &readfds)) - get_ctrl_msg(); - - /* get netlink message */ - if (FD_ISSET(uevent_netlink_sock, &readfds)) { - msg = get_netlink_msg(); - if (msg) - msg_queue_insert(msg); - } - - /* received a signal, clear our notification pipe */ - if (FD_ISSET(signal_pipe[READ_END], &readfds)) { - char buf[256]; - - read(signal_pipe[READ_END], &buf, sizeof(buf)); - } - - /* rules directory inotify watch */ - if ((inotify_fd >= 0) && FD_ISSET(inotify_fd, &readfds)) { - int nbytes; - - /* discard all possible events, we can just reload the config */ - if ((ioctl(inotify_fd, FIONREAD, &nbytes) == 0) && nbytes > 0) { - char *buf; - - reload_config = 1; - buf = malloc(nbytes); - if (buf == NULL) { - err("error getting buffer for inotify, disable watching\n"); - close(inotify_fd); - inotify_fd = -1; - } - read(inotify_fd, buf, nbytes); - free(buf); - } - } - - /* rules changed, set by inotify or a HUP signal */ - if (reload_config) { - reload_config = 0; - udev_rules_cleanup(&rules); - udev_rules_init(&rules, 1); - } - - /* forked child has returned */ - if (sigchilds_waiting) { - sigchilds_waiting = 0; - reap_sigchilds(); - } - - if (run_exec_q) { - run_exec_q = 0; - if (!stop_exec_q) - msg_queue_manager(); - } - } - rc = 0; - -exit: - udev_rules_cleanup(&rules); - sysfs_cleanup(); - selinux_exit(); - - if (signal_pipe[READ_END] >= 0) - close(signal_pipe[READ_END]); - if (signal_pipe[WRITE_END] >= 0) - close(signal_pipe[WRITE_END]); - - if (udevd_sock >= 0) - close(udevd_sock); - if (inotify_fd >= 0) - close(inotify_fd); - if (uevent_netlink_sock >= 0) - close(uevent_netlink_sock); - - logging_close(); - - return rc; -} diff --git a/udevd.h b/udevd.h deleted file mode 100644 index 9be34cb0cc..0000000000 --- a/udevd.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2004 Ling, Xiaofeng - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "list.h" - -#define UDEVD_PRIORITY -4 -#define UDEV_PRIORITY -2 - -#define EVENT_QUEUE_DIR ".udev/queue" -#define EVENT_FAILED_DIR ".udev/failed" -#define EVENT_SEQNUM ".udev/uevent_seqnum" - -/* maximum limit of forked childs */ -#define UDEVD_MAX_CHILDS 256 -/* start to throttle forking if maximum number of running childs in our session is reached */ -#define UDEVD_MAX_CHILDS_RUNNING 16 - -/* linux/include/linux/kobject.h */ -#define UEVENT_BUFFER_SIZE 2048 -#define UEVENT_NUM_ENVP 32 - -#define UDEVD_CTRL_SOCK_PATH "/org/kernel/udev/udevd" -#define UDEVD_CTRL_MAGIC "udevd_" UDEV_VERSION - -enum udevd_ctrl_msg_type { - UDEVD_CTRL_UNKNOWN, - UDEVD_CTRL_STOP_EXEC_QUEUE, - UDEVD_CTRL_START_EXEC_QUEUE, - UDEVD_CTRL_SET_LOG_LEVEL, - UDEVD_CTRL_SET_MAX_CHILDS, - UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, - UDEVD_CTRL_RELOAD_RULES, - UDEVD_CTRL_ENV, -}; - -struct udevd_ctrl_msg { - char magic[32]; - enum udevd_ctrl_msg_type type; - char buf[256]; -}; - -struct udevd_uevent_msg { - struct list_head node; - pid_t pid; - int exitstatus; - time_t queue_time; - char *action; - char *devpath; - char *subsystem; - char *driver; - dev_t devt; - unsigned long long seqnum; - char *devpath_old; - char *physdevpath; - unsigned int timeout; - char *envp[UEVENT_NUM_ENVP+1]; - char envbuf[]; -}; diff --git a/udevd.xml b/udevd.xml deleted file mode 100644 index 8d22a0c14d..0000000000 --- a/udevd.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - -
                    -
                    - udevd - - - udevd - August 2005 - udev - - - - udevd - 8 - - - - - udevdevent managing daemon - - - - - udevd - - - - - - - - - DESCRIPTION - udevd listens to kernel uevents and passes the incoming events to - udev. It ensures the correct event order and takes care, that events for child - devices are delayed until the parent event has finished the device handling. - The behavior of the running daemon can be changed with - udevadm control. - - - OPTIONS - - - - - Detach and run in the background. - - - - - - Run all events completely serialized. This may be useful if udev triggers - actions or loads kernel modules which cause problems and a slow but continuous - operation is needed, where no events are processed in parallel. - - - - - - - Print log messages to stdout. - - - - - - Print version number. - - - - - - Print help text. - - - - - - ENVIRONMENT - - - - - Overrides the syslog priority specified in the config file. - - - - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - - - - SEE ALSO - - udev7 - , - - udevadm8 - - - -
                    -
                    diff --git a/udevinfo.c b/udevinfo.c deleted file mode 100644 index b9ee17c4f1..0000000000 --- a/udevinfo.c +++ /dev/null @@ -1,500 +0,0 @@ -/* - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static void print_all_attributes(const char *devpath, const char *key) -{ - char path[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - strlcpy(path, sysfs_path, sizeof(path)); - strlcat(path, devpath, sizeof(path)); - - dir = opendir(path); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat statbuf; - char filename[PATH_SIZE]; - char *attr_value; - char value[NAME_SIZE]; - size_t len; - - if (dent->d_name[0] == '.') - continue; - - if (strcmp(dent->d_name, "uevent") == 0) - continue; - if (strcmp(dent->d_name, "dev") == 0) - continue; - - strlcpy(filename, path, sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, dent->d_name, sizeof(filename)); - if (lstat(filename, &statbuf) != 0) - continue; - if (S_ISLNK(statbuf.st_mode)) - continue; - - attr_value = sysfs_attr_get_value(devpath, dent->d_name); - if (attr_value == NULL) - continue; - len = strlcpy(value, attr_value, sizeof(value)); - if(len >= sizeof(value)) - len = sizeof(value) - 1; - dbg("attr '%s'='%s'(%zi)\n", dent->d_name, value, len); - - /* remove trailing newlines */ - while (len && value[len-1] == '\n') - value[--len] = '\0'; - - /* skip nonprintable attributes */ - while (len && isprint(value[len-1])) - len--; - if (len) { - dbg("attribute value of '%s' non-printable, skip\n", dent->d_name); - continue; - } - - printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); - } - } - printf("\n"); -} - -static int print_device_chain(const char *devpath) -{ - struct sysfs_device *dev; - - dev = sysfs_device_get(devpath); - if (dev == NULL) - return -1; - - printf("\n" - "Udevinfo starts with the device specified by the devpath and then\n" - "walks up the chain of parent devices. It prints for every device\n" - "found, all possible attributes in the udev rules key format.\n" - "A rule to match, can be composed by the attributes of the device\n" - "and the attributes from one single parent device.\n" - "\n"); - - printf(" looking at device '%s':\n", dev->devpath); - printf(" KERNEL==\"%s\"\n", dev->kernel); - printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); - printf(" DRIVER==\"%s\"\n", dev->driver); - print_all_attributes(dev->devpath, "ATTR"); - - /* walk up the chain of devices */ - while (1) { - dev = sysfs_device_get_parent(dev); - if (dev == NULL) - break; - printf(" looking at parent device '%s':\n", dev->devpath); - printf(" KERNELS==\"%s\"\n", dev->kernel); - printf(" SUBSYSTEMS==\"%s\"\n", dev->subsystem); - printf(" DRIVERS==\"%s\"\n", dev->driver); - - print_all_attributes(dev->devpath, "ATTRS"); - } - - return 0; -} - -static void print_record(struct udevice *udev) -{ - struct name_entry *name_loop; - - printf("P: %s\n", udev->dev->devpath); - printf("N: %s\n", udev->name); - list_for_each_entry(name_loop, &udev->symlink_list, node) - printf("S: %s\n", name_loop->name); - if (udev->link_priority != 0) - printf("L: %i\n", udev->link_priority); - if (udev->partitions != 0) - printf("A:%u\n", udev->partitions); - if (udev->ignore_remove) - printf("R:%u\n", udev->ignore_remove); - list_for_each_entry(name_loop, &udev->env_list, node) - printf("E: %s\n", name_loop->name); -} - -static void export_db(void) { - LIST_HEAD(name_list); - struct name_entry *name_loop; - - udev_db_get_all_entries(&name_list); - list_for_each_entry(name_loop, &name_list, node) { - struct udevice *udev_db; - - udev_db = udev_device_init(NULL); - if (udev_db == NULL) - continue; - if (udev_db_get_device(udev_db, name_loop->name) == 0) - print_record(udev_db); - printf("\n"); - udev_device_cleanup(udev_db); - } - name_list_cleanup(&name_list); -} - -static int lookup_device_by_name(struct udevice *udev, const char *name) -{ - LIST_HEAD(name_list); - int count; - struct name_entry *device; - int rc = -1; - - count = udev_db_get_devices_by_name(name, &name_list); - if (count <= 0) - goto out; - - info("found %i devices for '%s'\n", count, name); - - /* select the device that seems to match */ - list_for_each_entry(device, &name_list, node) { - char filename[PATH_SIZE]; - struct stat statbuf; - - udev_device_init(udev); - if (udev_db_get_device(udev, device->name) != 0) - continue; - info("found db entry '%s'\n", device->name); - - /* make sure, we don't get a link of a differnt device */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, name, sizeof(filename)); - if (stat(filename, &statbuf) != 0) - continue; - if (major(udev->devt) > 0 && udev->devt != statbuf.st_rdev) { - info("skip '%s', dev_t doesn't match\n", udev->name); - continue; - } - rc = 0; - break; - } -out: - name_list_cleanup(&name_list); - return rc; -} - -static int stat_device(const char *name, int export, const char *prefix) -{ - struct stat statbuf; - - if (stat(name, &statbuf) != 0) - return -1; - - if (export) { - if (prefix == NULL) - prefix = "INFO_"; - printf("%sMAJOR=%d\n" - "%sMINOR=%d\n", - prefix, major(statbuf.st_dev), - prefix, minor(statbuf.st_dev)); - } else - printf("%d %d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); - return 0; -} - -int udevinfo(int argc, char *argv[], char *envp[]) -{ - int option; - struct udevice *udev; - int root = 0; - int export = 0; - const char *export_prefix = NULL; - - static const struct option options[] = { - { "name", 1, NULL, 'n' }, - { "path", 1, NULL, 'p' }, - { "query", 1, NULL, 'q' }, - { "attribute-walk", 0, NULL, 'a' }, - { "export-db", 0, NULL, 'e' }, - { "root", 0, NULL, 'r' }, - { "device-id-of-file", 1, NULL, 'd' }, - { "export", 0, NULL, 'x' }, - { "export-prefix", 1, NULL, 'P' }, - { "version", 0, NULL, 1 }, /* -V outputs braindead format */ - { "help", 0, NULL, 'h' }, - {} - }; - - enum action_type { - ACTION_NONE, - ACTION_QUERY, - ACTION_ATTRIBUTE_WALK, - ACTION_ROOT, - ACTION_DEVICE_ID_FILE, - } action = ACTION_NONE; - - enum query_type { - QUERY_NONE, - QUERY_NAME, - QUERY_PATH, - QUERY_SYMLINK, - QUERY_ENV, - QUERY_ALL, - } query = QUERY_NONE; - - char path[PATH_SIZE] = ""; - char name[PATH_SIZE] = ""; - struct name_entry *name_loop; - int rc = 0; - - logging_init("udevinfo"); - udev_config_init(); - sysfs_init(); - - udev = udev_device_init(NULL); - if (udev == NULL) { - rc = 1; - goto exit; - } - - while (1) { - option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); - if (option == -1) - break; - - dbg("option '%c'\n", option); - switch (option) { - case 'n': - /* remove /dev if given */ - if (strncmp(optarg, udev_root, strlen(udev_root)) == 0) - strlcpy(name, &optarg[strlen(udev_root)+1], sizeof(name)); - else - strlcpy(name, optarg, sizeof(name)); - remove_trailing_chars(name, '/'); - dbg("name: %s\n", name); - break; - case 'p': - /* remove /sys if given */ - if (strncmp(optarg, sysfs_path, strlen(sysfs_path)) == 0) - strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path)); - else - strlcpy(path, optarg, sizeof(path)); - remove_trailing_chars(path, '/'); - - /* possibly resolve to real devpath */ - if (sysfs_resolve_link(path, sizeof(path)) != 0) { - char temp[PATH_SIZE]; - char *pos; - - /* also check if the parent is a link */ - strlcpy(temp, path, sizeof(temp)); - pos = strrchr(temp, '/'); - if (pos != 0) { - char tail[PATH_SIZE]; - - strlcpy(tail, pos, sizeof(tail)); - pos[0] = '\0'; - if (sysfs_resolve_link(temp, sizeof(temp)) == 0) { - strlcpy(path, temp, sizeof(path)); - strlcat(path, tail, sizeof(path)); - } - } - } - dbg("path: %s\n", path); - break; - case 'q': - action = ACTION_QUERY; - if (strcmp(optarg, "name") == 0) { - query = QUERY_NAME; - break; - } - if (strcmp(optarg, "symlink") == 0) { - query = QUERY_SYMLINK; - break; - } - if (strcmp(optarg, "path") == 0) { - query = QUERY_PATH; - break; - } - if (strcmp(optarg, "env") == 0) { - query = QUERY_ENV; - break; - } - if (strcmp(optarg, "all") == 0) { - query = QUERY_ALL; - break; - } - fprintf(stderr, "unknown query type\n"); - rc = 2; - goto exit; - case 'r': - if (action == ACTION_NONE) - action = ACTION_ROOT; - root = 1; - break; - case 'd': - action = ACTION_DEVICE_ID_FILE; - strlcpy(name, optarg, sizeof(name)); - break; - case 'a': - action = ACTION_ATTRIBUTE_WALK; - break; - case 'e': - export_db(); - goto exit; - case 'x': - export = 1; - break; - case 'P': - export_prefix = optarg; - break; - case 1: - printf("%s\n", UDEV_VERSION); - goto exit; - case 'V': - printf("udevinfo, version %s\n", UDEV_VERSION); - goto exit; - case 'h': - printf("Usage: udevadm info OPTIONS\n" - " --query= query database for the specified value:\n" - " name name of device node\n" - " symlink pointing to node\n" - " path sysfs device path\n" - " env the device related imported environment\n" - " all all values\n" - " --path= sysfs device path used for query or chain\n" - " --name= node or symlink name used for query\n" - " --root prepend to query result or print udev_root\n" - " --attribute-walk print all key matches while walking along chain\n" - " of parent devices\n" - " --device-id-of-file= print major/minor of underlying device\n" - " --export-db export the content of the udev database\n" - " --help print this text\n" - "\n"); - goto exit; - default: - goto exit; - } - } - - /* run action */ - switch (action) { - case ACTION_QUERY: - /* needs devpath or node/symlink name for query */ - if (path[0] != '\0') { - if (udev_db_get_device(udev, path) != 0) { - fprintf(stderr, "no record for '%s' in database\n", path); - rc = 3; - goto exit; - } - } else if (name[0] != '\0') { - if (lookup_device_by_name(udev, name) != 0) { - fprintf(stderr, "node name not found\n"); - rc = 4; - goto exit; - } - } else { - fprintf(stderr, "query needs --path or node --name specified\n"); - rc = 4; - goto exit; - } - - switch(query) { - case QUERY_NAME: - if (root) - printf("%s/%s\n", udev_root, udev->name); - else - printf("%s\n", udev->name); - break; - case QUERY_SYMLINK: - list_for_each_entry(name_loop, &udev->symlink_list, node) { - char c = name_loop->node.next != &udev->symlink_list ? ' ' : '\n'; - - if (root) - printf("%s/%s%c", udev_root, name_loop->name, c); - else - printf("%s%c", name_loop->name, c); - } - break; - case QUERY_PATH: - printf("%s\n", udev->dev->devpath); - goto exit; - case QUERY_ENV: - list_for_each_entry(name_loop, &udev->env_list, node) - printf("%s\n", name_loop->name); - break; - case QUERY_ALL: - print_record(udev); - break; - default: - fprintf(stderr, "unknown query type\n"); - break; - } - break; - case ACTION_ATTRIBUTE_WALK: - if (path[0] != '\0') { - if (print_device_chain(path) != 0) { - fprintf(stderr, "no valid sysfs device found\n"); - rc = 4; - goto exit; - } - } else if (name[0] != '\0') { - if (lookup_device_by_name(udev, name) != 0) { - fprintf(stderr, "node name not found\n"); - rc = 4; - goto exit; - } - if (print_device_chain(udev->dev->devpath) != 0) { - fprintf(stderr, "no valid sysfs device found\n"); - rc = 4; - goto exit; - } - } else { - fprintf(stderr, "attribute walk needs --path or node --name specified\n"); - rc = 5; - goto exit; - } - break; - case ACTION_DEVICE_ID_FILE: - if (stat_device(name, export, export_prefix) != 0) - rc = 6; - break; - case ACTION_ROOT: - printf("%s\n", udev_root); - break; - default: - fprintf(stderr, "missing option\n"); - rc = 1; - break; - } - -exit: - udev_device_cleanup(udev); - sysfs_cleanup(); - logging_close(); - return rc; -} diff --git a/udevmonitor.c b/udevmonitor.c deleted file mode 100644 index 2430dd39a5..0000000000 --- a/udevmonitor.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" - -static int uevent_netlink_sock = -1; -static int udev_monitor_sock = -1; -static volatile int udev_exit; - -static int init_udev_monitor_socket(void) -{ - struct sockaddr_un saddr; - socklen_t addrlen; - int retval; - - memset(&saddr, 0x00, sizeof(saddr)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], "/org/kernel/udev/monitor"); - addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - - udev_monitor_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (udev_monitor_sock == -1) { - fprintf(stderr, "error getting socket: %s\n", strerror(errno)); - return -1; - } - - /* the bind takes care of ensuring only one copy running */ - retval = bind(udev_monitor_sock, (struct sockaddr *) &saddr, addrlen); - if (retval < 0) { - fprintf(stderr, "bind failed: %s\n", strerror(errno)); - close(udev_monitor_sock); - udev_monitor_sock = -1; - return -1; - } - - return 0; -} - -static int init_uevent_netlink_sock(void) -{ - struct sockaddr_nl snl; - int retval; - - memset(&snl, 0x00, sizeof(struct sockaddr_nl)); - snl.nl_family = AF_NETLINK; - snl.nl_pid = getpid(); - snl.nl_groups = 1; - - uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); - if (uevent_netlink_sock == -1) { - fprintf(stderr, "error getting socket: %s\n", strerror(errno)); - return -1; - } - - retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, - sizeof(struct sockaddr_nl)); - if (retval < 0) { - fprintf(stderr, "bind failed: %s\n", strerror(errno)); - close(uevent_netlink_sock); - uevent_netlink_sock = -1; - return -1; - } - - return 0; -} - -static void asmlinkage sig_handler(int signum) -{ - if (signum == SIGINT || signum == SIGTERM) - udev_exit = 1; -} - -static const char *search_key(const char *searchkey, const char *buf, size_t buflen) -{ - size_t bufpos = 0; - size_t searchkeylen = strlen(searchkey); - - while (bufpos < buflen) { - const char *key; - int keylen; - - key = &buf[bufpos]; - keylen = strlen(key); - if (keylen == 0) - break; - if ((strncmp(searchkey, key, searchkeylen) == 0) && key[searchkeylen] == '=') - return &key[searchkeylen + 1]; - bufpos += keylen + 1; - } - return NULL; -} - -int udevmonitor(int argc, char *argv[], char *envp[]) -{ - struct sigaction act; - int option; - int env = 0; - int kernel = 0; - int udev = 0; - fd_set readfds; - int retval = 0; - - static const struct option options[] = { - { "environment", 0, NULL, 'e' }, - { "kernel", 0, NULL, 'k' }, - { "udev", 0, NULL, 'u' }, - { "help", 0, NULL, 'h' }, - {} - }; - - while (1) { - option = getopt_long(argc, argv, "ekuh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'e': - env = 1; - break; - case 'k': - kernel = 1; - break; - case 'u': - udev = 1; - break; - case 'h': - printf("Usage: udevadm monitor [--environment] [--kernel] [--udev] [--help]\n" - " --env print the whole event environment\n" - " --kernel print kernel uevents\n" - " --udev print udev events\n" - " --help print this help text\n\n"); - default: - goto out; - } - } - - if (!kernel && !udev) { - kernel = 1; - udev =1; - } - - if (getuid() != 0 && kernel) { - fprintf(stderr, "root privileges needed to subscribe to kernel events\n"); - goto out; - } - - /* set signal handlers */ - memset(&act, 0x00, sizeof(struct sigaction)); - act.sa_handler = (void (*)(int)) sig_handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_RESTART; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - - printf("udevmonitor will print the received events for:\n"); - if (udev) { - retval = init_udev_monitor_socket(); - if (retval) - goto out; - printf("UDEV the event which udev sends out after rule processing\n"); - } - if (kernel) { - retval = init_uevent_netlink_sock(); - if (retval) - goto out; - printf("UEVENT the kernel uevent\n"); - } - printf("\n"); - - while (!udev_exit) { - char buf[UEVENT_BUFFER_SIZE*2]; - ssize_t buflen; - ssize_t bufpos; - ssize_t keys; - int fdcount; - struct timeval tv; - struct timezone tz; - char timestr[64]; - const char *source = NULL; - const char *devpath, *action, *subsys; - - buflen = 0; - FD_ZERO(&readfds); - if (uevent_netlink_sock >= 0) - FD_SET(uevent_netlink_sock, &readfds); - if (udev_monitor_sock >= 0) - FD_SET(udev_monitor_sock, &readfds); - - fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno != EINTR) - fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); - continue; - } - - if (gettimeofday(&tv, &tz) == 0) { - snprintf(timestr, sizeof(timestr), "%llu.%06u", - (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec); - } else - timestr[0] = '\0'; - - if ((uevent_netlink_sock >= 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { - buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); - if (buflen <= 0) { - fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); - continue; - } - source = "UEVENT"; - } - - if ((udev_monitor_sock >= 0) && FD_ISSET(udev_monitor_sock, &readfds)) { - buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); - if (buflen <= 0) { - fprintf(stderr, "error receiving udev message: %s\n", strerror(errno)); - continue; - } - source = "UDEV "; - } - - if (buflen == 0) - continue; - - keys = strlen(buf) + 1; /* start of payload */ - devpath = search_key("DEVPATH", &buf[keys], buflen); - action = search_key("ACTION", &buf[keys], buflen); - subsys = search_key("SUBSYSTEM", &buf[keys], buflen); - printf("%s[%s] %-8s %s (%s)\n", source, timestr, action, devpath, subsys); - - /* print environment */ - bufpos = keys; - if (env) { - while (bufpos < buflen) { - int keylen; - char *key; - - key = &buf[bufpos]; - keylen = strlen(key); - if (keylen == 0) - break; - printf("%s\n", key); - bufpos += keylen + 1; - } - printf("\n"); - } - } - -out: - if (uevent_netlink_sock >= 0) - close(uevent_netlink_sock); - if (udev_monitor_sock >= 0) - close(udev_monitor_sock); - - if (retval) - return 1; - return 0; -} diff --git a/udevsettle.c b/udevsettle.c deleted file mode 100644 index cb63a66bba..0000000000 --- a/udevsettle.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" - -#define DEFAULT_TIMEOUT 180 -#define LOOP_PER_SECOND 20 - -static void print_queue(const char *dir) -{ - LIST_HEAD(files); - struct name_entry *item; - - if (add_matching_files(&files, dir, NULL) < 0) - return; - - printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n"); - - list_for_each_entry(item, &files, node) { - char target[NAME_SIZE]; - size_t len; - const char *filename = strrchr(item->name, '/'); - - if (filename == NULL) - continue; - filename++; - if (*filename == '\0') - continue; - - len = readlink(item->name, target, sizeof(target)); - if (len < 0) - continue; - target[len] = '\0'; - - printf("%s: %s\n", filename, target); - } - - printf("\n\n"); -} - -int udevsettle(int argc, char *argv[], char *envp[]) -{ - char queuename[PATH_SIZE]; - char filename[PATH_SIZE]; - unsigned long long seq_kernel; - unsigned long long seq_udev; - char seqnum[32]; - int fd; - ssize_t len; - int timeout = DEFAULT_TIMEOUT; - int loop; - static const struct option options[] = { - { "timeout", 1, NULL, 't' }, - { "help", 0, NULL, 'h' }, - {} - }; - int option; - int rc = 1; - int seconds; - - logging_init("udevsettle"); - udev_config_init(); - dbg("version %s\n", UDEV_VERSION); - sysfs_init(); - - while (1) { - option = getopt_long(argc, argv, "t:h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 't': - seconds = atoi(optarg); - if (seconds > 0) - timeout = seconds; - else - fprintf(stderr, "invalid timeout value\n"); - dbg("timeout=%i\n", timeout); - break; - case 'h': - printf("Usage: udevadm settle [--help] [--timeout=]\n\n"); - goto exit; - } - } - - strlcpy(queuename, udev_root, sizeof(queuename)); - strlcat(queuename, "/" EVENT_QUEUE_DIR, sizeof(queuename)); - - loop = timeout * LOOP_PER_SECOND; - while (loop--) { - /* wait for events in queue to finish */ - while (loop--) { - struct stat statbuf; - - if (stat(queuename, &statbuf) < 0) { - info("queue is empty\n"); - break; - } - usleep(1000 * 1000 / LOOP_PER_SECOND); - } - if (loop <= 0) { - info("timeout waiting for queue\n"); - print_queue(queuename); - goto exit; - } - - /* read current udev seqnum */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); - fd = open(filename, O_RDONLY); - if (fd < 0) - goto exit; - len = read(fd, seqnum, sizeof(seqnum)-1); - close(fd); - if (len <= 0) - goto exit; - seqnum[len] = '\0'; - seq_udev = strtoull(seqnum, NULL, 10); - info("udev seqnum = %llu\n", seq_udev); - - /* read current kernel seqnum */ - strlcpy(filename, sysfs_path, sizeof(filename)); - strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); - fd = open(filename, O_RDONLY); - if (fd < 0) - goto exit; - len = read(fd, seqnum, sizeof(seqnum)-1); - close(fd); - if (len <= 0) - goto exit; - seqnum[len] = '\0'; - seq_kernel = strtoull(seqnum, NULL, 10); - info("kernel seqnum = %llu\n", seq_kernel); - - /* make sure all kernel events have arrived in the queue */ - if (seq_udev >= seq_kernel) { - info("queue is empty and no pending events left\n"); - rc = 0; - goto exit; - } - usleep(1000 * 1000 / LOOP_PER_SECOND); - info("queue is empty, but events still pending\n"); - } - -exit: - sysfs_cleanup(); - logging_close(); - return rc; -} diff --git a/udevtest.c b/udevtest.c deleted file mode 100644 index d5e90b02c6..0000000000 --- a/udevtest.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" - -static int import_uevent_var(const char *devpath) -{ - char path[PATH_SIZE]; - static char value[4096]; /* must stay, used with putenv */ - ssize_t size; - int fd; - char *key; - char *next; - int rc = -1; - - /* read uevent file */ - strlcpy(path, sysfs_path, sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/uevent", sizeof(path)); - fd = open(path, O_RDONLY); - if (fd < 0) - goto out; - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - value[size] = '\0'; - - /* import keys into environment */ - key = value; - while (key[0] != '\0') { - next = strchr(key, '\n'); - if (next == NULL) - goto out; - next[0] = '\0'; - info("import into environment: '%s'\n", key); - putenv(key); - key = &next[1]; - } - rc = 0; -out: - return rc; -} - -int udevtest(int argc, char *argv[], char *envp[]) -{ - int force = 0; - const char *action = "add"; - const char *subsystem = NULL; - const char *devpath = NULL; - struct udevice *udev; - struct sysfs_device *dev; - struct udev_rules rules = {}; - int retval; - int rc = 0; - - static const struct option options[] = { - { "action", 1, NULL, 'a' }, - { "subsystem", 1, NULL, 's' }, - { "force", 0, NULL, 'f' }, - { "help", 0, NULL, 'h' }, - {} - }; - - info("version %s\n", UDEV_VERSION); - udev_config_init(); - if (udev_log_priority < LOG_INFO) { - char priority[32]; - - udev_log_priority = LOG_INFO; - sprintf(priority, "%i", udev_log_priority); - setenv("UDEV_LOG", priority, 1); - } - - while (1) { - int option; - - option = getopt_long(argc, argv, "a:s:fh", options, NULL); - if (option == -1) - break; - - dbg("option '%c'\n", option); - switch (option) { - case 'a': - action = optarg; - break; - case 's': - subsystem = optarg; - break; - case 'f': - force = 1; - break; - case 'h': - printf("Usage: udevadm test OPTIONS \n" - " --action= set action string\n" - " --subsystem= set subsystem string\n" - " --force don't skip node/link creation\n" - " --help print this help text\n\n"); - exit(0); - default: - exit(1); - } - } - devpath = argv[optind]; - - if (devpath == NULL) { - fprintf(stderr, "devpath parameter missing\n"); - rc = 1; - goto exit; - } - - printf("This program is for debugging only, it does not run any program,\n" - "specified by a RUN key. It may show incorrect results, because\n" - "some values may be different, or not available at a simulation run.\n" - "\n"); - - sysfs_init(); - udev_rules_init(&rules, 0); - - /* remove /sys if given */ - if (strncmp(devpath, sysfs_path, strlen(sysfs_path)) == 0) - devpath = &devpath[strlen(sysfs_path)]; - - dev = sysfs_device_get(devpath); - if (dev == NULL) { - fprintf(stderr, "unable to open device '%s'\n", devpath); - rc = 2; - goto exit; - } - - udev = udev_device_init(NULL); - if (udev == NULL) { - fprintf(stderr, "error initializing device\n"); - rc = 3; - goto exit; - } - - if (subsystem != NULL) - strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); - - /* override built-in sysfs device */ - udev->dev = dev; - strlcpy(udev->action, action, sizeof(udev->action)); - udev->devt = udev_device_get_devt(udev); - - /* simulate node creation with test flag */ - if (!force) - udev->test_run = 1; - - setenv("DEVPATH", udev->dev->devpath, 1); - setenv("SUBSYSTEM", udev->dev->subsystem, 1); - setenv("ACTION", udev->action, 1); - import_uevent_var(udev->dev->devpath); - - info("looking at device '%s' from subsystem '%s'\n", udev->dev->devpath, udev->dev->subsystem); - retval = udev_device_event(&rules, udev); - - if (udev->event_timeout >= 0) - info("custom event timeout: %i\n", udev->event_timeout); - - if (retval == 0 && !udev->ignore_device && udev_run) { - struct name_entry *name_loop; - - list_for_each_entry(name_loop, &udev->run_list, node) { - char program[PATH_SIZE]; - - strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - info("run: '%s'\n", program); - } - } - udev_device_cleanup(udev); - -exit: - udev_rules_cleanup(&rules); - sysfs_cleanup(); - return rc; -} diff --git a/udevtrigger.c b/udevtrigger.c deleted file mode 100644 index d4b10d06ab..0000000000 --- a/udevtrigger.c +++ /dev/null @@ -1,712 +0,0 @@ -/* - * Copyright (C) 2004-2006 Kay Sievers - * Copyright (C) 2006 Hannes Reinecke - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" -#include "udev_rules.h" - -static int verbose; -static int dry_run; -LIST_HEAD(device_list); -LIST_HEAD(filter_subsystem_match_list); -LIST_HEAD(filter_subsystem_nomatch_list); -LIST_HEAD(filter_attr_match_list); -LIST_HEAD(filter_attr_nomatch_list); -static int sock = -1; -static struct sockaddr_un saddr; -static socklen_t saddrlen; - -/* devices that should run last cause of their dependencies */ -static int delay_device(const char *devpath) -{ - static const char *delay_device_list[] = { - "*/md*", - "*/dm-*", - NULL - }; - int i; - - for (i = 0; delay_device_list[i] != NULL; i++) - if (fnmatch(delay_device_list[i], devpath, 0) == 0) - return 1; - return 0; -} - -static int device_list_insert(const char *path) -{ - char filename[PATH_SIZE]; - char devpath[PATH_SIZE]; - struct stat statbuf; - - dbg("add '%s'\n" , path); - - /* we only have a device, if we have an uevent file */ - strlcpy(filename, path, sizeof(filename)); - strlcat(filename, "/uevent", sizeof(filename)); - if (stat(filename, &statbuf) < 0) - return -1; - if (!(statbuf.st_mode & S_IWUSR)) - return -1; - - strlcpy(devpath, &path[strlen(sysfs_path)], sizeof(devpath)); - - /* resolve possible link to real target */ - if (lstat(path, &statbuf) < 0) - return -1; - if (S_ISLNK(statbuf.st_mode)) - if (sysfs_resolve_link(devpath, sizeof(devpath)) != 0) - return -1; - - name_list_add(&device_list, devpath, 1); - return 0; -} - -static void trigger_uevent(const char *devpath, const char *action) -{ - char filename[PATH_SIZE]; - int fd; - - strlcpy(filename, sysfs_path, sizeof(filename)); - strlcat(filename, devpath, sizeof(filename)); - strlcat(filename, "/uevent", sizeof(filename)); - - if (verbose) - printf("%s\n", devpath); - - if (dry_run) - return; - - fd = open(filename, O_WRONLY); - if (fd < 0) { - dbg("error on opening %s: %s\n", filename, strerror(errno)); - return; - } - - if (write(fd, action, strlen(action)) < 0) - info("error writing '%s' to '%s': %s\n", action, filename, strerror(errno)); - - close(fd); -} - -static int pass_to_socket(const char *devpath, const char *action, const char *env) -{ - struct udevice udev; - struct name_entry *name_loop; - char buf[4096]; - size_t bufpos = 0; - ssize_t count; - char path[PATH_SIZE]; - int fd; - char link_target[PATH_SIZE]; - int len; - int err = 0; - - if (verbose) - printf("%s\n", devpath); - - udev_device_init(&udev); - udev_db_get_device(&udev, devpath); - - /* add header */ - bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); - bufpos++; - - /* add cookie */ - if (env != NULL) { - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "%s", env); - bufpos++; - } - - /* add standard keys */ - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVPATH=%s", devpath); - bufpos++; - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "ACTION=%s", action); - bufpos++; - - /* add subsystem */ - strlcpy(path, sysfs_path, sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/subsystem", sizeof(path)); - len = readlink(path, link_target, sizeof(link_target)); - if (len > 0) { - char *pos; - - link_target[len] = '\0'; - pos = strrchr(link_target, '/'); - if (pos != NULL) { - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "SUBSYSTEM=%s", &pos[1]); - bufpos++; - } - } - - /* add symlinks and node name */ - path[0] = '\0'; - list_for_each_entry(name_loop, &udev.symlink_list, node) { - strlcat(path, udev_root, sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, name_loop->name, sizeof(path)); - strlcat(path, " ", sizeof(path)); - } - remove_trailing_chars(path, ' '); - if (path[0] != '\0') { - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path); - bufpos++; - } - if (udev.name[0] != '\0') { - strlcpy(path, udev_root, sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, udev.name, sizeof(path)); - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path); - bufpos++; - } - - /* add keys from device "uevent" file */ - strlcpy(path, sysfs_path, sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/uevent", sizeof(path)); - fd = open(path, O_RDONLY); - if (fd >= 0) { - char value[4096]; - - count = read(fd, value, sizeof(value)); - close(fd); - if (count > 0) { - char *key; - - value[count] = '\0'; - key = value; - while (key[0] != '\0') { - char *next; - - next = strchr(key, '\n'); - if (next == NULL) - break; - next[0] = '\0'; - bufpos += strlcpy(&buf[bufpos], key, sizeof(buf) - bufpos-1); - bufpos++; - key = &next[1]; - } - } - } - - /* add keys from database */ - list_for_each_entry(name_loop, &udev.env_list, node) { - bufpos += strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); - bufpos++; - } - if (bufpos > sizeof(buf)) - bufpos = sizeof(buf); - - count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); - if (count < 0) - err = -1; - - return err; -} - -static void exec_list(const char *action, const char *env) -{ - struct name_entry *loop_device; - struct name_entry *tmp_device; - - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (delay_device(loop_device->name)) - continue; - if (sock >= 0) - pass_to_socket(loop_device->name, action, env); - else - trigger_uevent(loop_device->name, action); - list_del(&loop_device->node); - free(loop_device); - } - - /* trigger remaining delayed devices */ - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (sock >= 0) - pass_to_socket(loop_device->name, action, env); - else - trigger_uevent(loop_device->name, action); - list_del(&loop_device->node); - free(loop_device); - } -} - -static int subsystem_filtered(const char *subsystem) -{ - struct name_entry *loop_name; - - /* skip devices matching the listed subsystems */ - list_for_each_entry(loop_name, &filter_subsystem_nomatch_list, node) - if (fnmatch(loop_name->name, subsystem, 0) == 0) - return 1; - - /* skip devices not matching the listed subsystems */ - if (!list_empty(&filter_subsystem_match_list)) { - list_for_each_entry(loop_name, &filter_subsystem_match_list, node) - if (fnmatch(loop_name->name, subsystem, 0) == 0) - return 0; - return 1; - } - - return 0; -} - -static int attr_match(const char *path, const char *attr_value) -{ - char attr[NAME_SIZE]; - char file[PATH_SIZE]; - char *match_value; - - strlcpy(attr, attr_value, sizeof(attr)); - - /* separate attr and match value */ - match_value = strchr(attr, '='); - if (match_value != NULL) { - match_value[0] = '\0'; - match_value = &match_value[1]; - } - - strlcpy(file, path, sizeof(file)); - strlcat(file, "/", sizeof(file)); - strlcat(file, attr, sizeof(file)); - - if (match_value != NULL) { - /* match file content */ - char value[NAME_SIZE]; - int fd; - ssize_t size; - - fd = open(file, O_RDONLY); - if (fd < 0) - return 0; - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - return 0; - value[size] = '\0'; - remove_trailing_chars(value, '\n'); - - /* match if attribute value matches */ - if (fnmatch(match_value, value, 0) == 0) - return 1; - } else { - /* match if attribute exists */ - struct stat statbuf; - - if (stat(file, &statbuf) == 0) - return 1; - } - return 0; -} - -static int attr_filtered(const char *path) -{ - struct name_entry *loop_name; - - /* skip devices matching the listed sysfs attributes */ - list_for_each_entry(loop_name, &filter_attr_nomatch_list, node) - if (attr_match(path, loop_name->name)) - return 1; - - /* skip devices not matching the listed sysfs attributes */ - if (!list_empty(&filter_attr_match_list)) { - list_for_each_entry(loop_name, &filter_attr_match_list, node) - if (attr_match(path, loop_name->name)) - return 0; - return 1; - } - return 0; -} - -enum scan_type { - SCAN_DEVICES, - SCAN_SUBSYSTEM, -}; - -static void scan_subsystem(const char *subsys, enum scan_type scan) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - const char *subdir; - - if (scan == SCAN_DEVICES) - subdir = "/devices"; - else if (scan == SCAN_SUBSYSTEM) - subdir = "/drivers"; - else - return; - - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/", sizeof(base)); - strlcat(base, subsys, sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - if (scan == SCAN_DEVICES) - if (subsystem_filtered(dent->d_name)) - continue; - - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); - - if (scan == SCAN_SUBSYSTEM) { - if (!subsystem_filtered("subsystem")) - device_list_insert(dirname); - if (subsystem_filtered("drivers")) - continue; - } - - strlcat(dirname, subdir, sizeof(dirname)); - - /* look for devices/drivers */ - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - strlcpy(dirname2, dirname, sizeof(dirname2)); - strlcat(dirname2, "/", sizeof(dirname2)); - strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - if (attr_filtered(dirname2)) - continue; - device_list_insert(dirname2); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void scan_block(void) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - if (subsystem_filtered("block")) - return; - - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/block", sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); - if (attr_filtered(dirname)) - continue; - if (device_list_insert(dirname) != 0) - continue; - - /* look for partitions */ - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - if (!strcmp(dent2->d_name,"device")) - continue; - - strlcpy(dirname2, dirname, sizeof(dirname2)); - strlcat(dirname2, "/", sizeof(dirname2)); - strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - if (attr_filtered(dirname2)) - continue; - device_list_insert(dirname2); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void scan_class(void) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/class", sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - if (subsystem_filtered(dent->d_name)) - continue; - - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - if (!strcmp(dent2->d_name, "device")) - continue; - - strlcpy(dirname2, dirname, sizeof(dirname2)); - strlcat(dirname2, "/", sizeof(dirname2)); - strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - if (attr_filtered(dirname2)) - continue; - device_list_insert(dirname2); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void scan_failed(void) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - strlcpy(base, udev_root, sizeof(base)); - strlcat(base, "/" EVENT_FAILED_DIR, sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char device[PATH_SIZE]; - size_t start; - - if (dent->d_name[0] == '.') - continue; - - start = strlcpy(device, sysfs_path, sizeof(device)); - if(start >= sizeof(device)) - start = sizeof(device) - 1; - strlcat(device, dent->d_name, sizeof(device)); - path_decode(&device[start]); - device_list_insert(device); - } - closedir(dir); - } -} - -int udevtrigger(int argc, char *argv[], char *envp[]) -{ - int failed = 0; - const char *sockpath = NULL; - int option; - const char *action = "add"; - const char *env = NULL; - static const struct option options[] = { - { "verbose", 0, NULL, 'v' }, - { "dry-run", 0, NULL, 'n' }, - { "retry-failed", 0, NULL, 'F' }, - { "socket", 1, NULL, 'o' }, - { "help", 0, NULL, 'h' }, - { "action", 1, NULL, 'c' }, - { "subsystem-match", 1, NULL, 's' }, - { "subsystem-nomatch", 1, NULL, 'S' }, - { "attr-match", 1, NULL, 'a' }, - { "attr-nomatch", 1, NULL, 'A' }, - { "env", 1, NULL, 'e' }, - {} - }; - - logging_init("udevtrigger"); - udev_config_init(); - dbg("version %s\n", UDEV_VERSION); - sysfs_init(); - - while (1) { - option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'v': - verbose = 1; - break; - case 'n': - dry_run = 1; - break; - case 'F': - failed = 1; - break; - case 'o': - sockpath = optarg; - break; - case 'c': - action = optarg; - break; - case 'e': - if (strchr(optarg, '=') != NULL) - env = optarg; - break; - case 's': - name_list_add(&filter_subsystem_match_list, optarg, 0); - break; - case 'S': - name_list_add(&filter_subsystem_nomatch_list, optarg, 0); - break; - case 'a': - name_list_add(&filter_attr_match_list, optarg, 0); - break; - case 'A': - name_list_add(&filter_attr_nomatch_list, optarg, 0); - break; - case 'h': - printf("Usage: udevadm trigger OPTIONS\n" - " --verbose print the list of devices while running\n" - " --dry-run do not actually trigger the events\n" - " --retry-failed trigger only the events which have been\n" - " marked as failed during a previous run\n" - " --socket= pass events to socket instead of triggering kernel events\n" - " --env== pass an additional key (works only with --socket=)\n" - " --subsystem-match= trigger devices from a matching subystem\n" - " --subsystem-nomatch= exclude devices from a matching subystem\n" - " --attr-match=]> trigger devices with a matching sysfs\n" - " attribute\n" - " --attr-nomatch=]> exclude devices with a matching sysfs\n" - " attribute\n" - " --help print this text\n" - "\n"); - goto exit; - default: - goto exit; - } - } - - if (sockpath != NULL) { - struct stat stats; - - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - if (sockpath[0] == '@') { - /* abstract namespace socket requested */ - strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { - /* existing socket file */ - strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); - saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); - } else { - /* no socket file, assume abstract namespace socket */ - strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } - } else if (env != NULL) { - fprintf(stderr, "error: --env= only valid with --socket= option\n"); - goto exit; - } - - if (failed) { - scan_failed(); - exec_list(action, env); - } else { - char base[PATH_SIZE]; - struct stat statbuf; - - /* if we have /sys/subsystem, forget all the old stuff */ - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/subsystem", sizeof(base)); - if (stat(base, &statbuf) == 0) { - scan_subsystem("subsystem", SCAN_SUBSYSTEM); - exec_list(action, env); - scan_subsystem("subsystem", SCAN_DEVICES); - exec_list(action, env); - } else { - scan_subsystem("bus", SCAN_SUBSYSTEM); - exec_list(action, env); - scan_subsystem("bus", SCAN_DEVICES); - scan_class(); - - /* scan "block" if it isn't a "class" */ - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/class/block", sizeof(base)); - if (stat(base, &statbuf) != 0) - scan_block(); - exec_list(action, env); - } - } - -exit: - name_list_cleanup(&filter_subsystem_match_list); - name_list_cleanup(&filter_subsystem_nomatch_list); - name_list_cleanup(&filter_attr_match_list); - name_list_cleanup(&filter_attr_nomatch_list); - - if (sock >= 0) - close(sock); - sysfs_cleanup(); - logging_close(); - return 0; -} -- cgit v1.2.3-54-g00ecf From 01618658fd82dbc5e6315b639f00e87c6fee3c54 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Jul 2008 01:45:23 +0200 Subject: use autotools --- .gitignore | 28 +++++-- INSTALL | 44 ++++++++++ Makefile.am | 41 ++++++++++ NEWS | 24 ++++++ README | 50 ++--------- autogen.sh | 57 +++++++++++++ configure.ac | 118 ++++++++++++++++++++++++++ extras/Makefile.am | 16 ++++ extras/ata_id/Makefile.am | 20 +++++ extras/ata_id/ata_id.c | 2 +- extras/cdrom_id/Makefile.am | 24 ++++++ extras/cdrom_id/cdrom_id.c | 3 +- extras/collect/Makefile.am | 11 +++ extras/collect/collect.c | 4 +- extras/edd_id/Makefile.am | 24 ++++++ extras/edd_id/edd_id.c | 2 +- extras/firmware/Makefile.am | 7 ++ extras/floppy/Makefile.am | 29 +++++++ extras/floppy/create_floppy_devices.c | 4 +- extras/fstab_import/Makefile.am | 21 +++++ extras/fstab_import/fstab_import.c | 2 +- extras/path_id/Makefile.am | 10 +++ extras/rule_generator/Makefile.am | 16 ++++ extras/scsi_id/Makefile.am | 27 ++++++ extras/scsi_id/scsi_id.c | 9 +- extras/scsi_id/scsi_serial.c | 3 +- extras/usb_id/Makefile.am | 18 ++++ extras/usb_id/usb_id.c | 2 +- extras/volume_id/Makefile.am | 33 ++++++++ extras/volume_id/lib/Makefile.am | 69 ++++++++++++++++ extras/volume_id/lib/exported_symbols | 119 +++++++++++++-------------- extras/volume_id/lib/libvolume_id.pc.in | 10 +++ extras/volume_id/vol_id.c | 2 +- rules/Makefile.am | 25 ++++++ test/udev-test.pl | 2 +- udev/.gitignore | 6 ++ udev/Makefile.am | 115 ++++++++++++++++++++++++++ udev/logging.h | 2 + udev/test-udev.c | 6 +- udev/udev.h | 8 -- udev/udev_config.c | 4 +- udev/udev_db.c | 8 +- udev/udev_device.c | 1 + udev/udev_rules.c | 2 +- udev/udev_rules.h | 1 - udev/udev_rules_parse.c | 12 +-- udev/udev_selinux.c | 2 + udev/udev_selinux.h | 7 +- udev/udev_sysdeps.c | 12 +-- udev/udev_sysdeps.h | 141 +++----------------------------- udev/udev_sysfs.c | 1 + udev/udev_utils.c | 1 + udev/udev_utils_file.c | 1 + udev/udev_utils_string.c | 1 + udev/udevadm.c | 8 +- udev/udevcontrol.c | 4 +- udev/udevd.c | 27 +++--- udev/udevd.h | 8 +- udev/udevinfo.c | 6 +- udev/udevsettle.c | 6 +- udev/udevtest.c | 2 +- udev/udevtrigger.c | 4 +- 62 files changed, 943 insertions(+), 329 deletions(-) create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100755 autogen.sh create mode 100644 configure.ac create mode 100644 extras/Makefile.am create mode 100644 extras/ata_id/Makefile.am create mode 100644 extras/cdrom_id/Makefile.am create mode 100644 extras/collect/Makefile.am create mode 100644 extras/edd_id/Makefile.am create mode 100644 extras/firmware/Makefile.am create mode 100644 extras/floppy/Makefile.am create mode 100644 extras/fstab_import/Makefile.am create mode 100644 extras/path_id/Makefile.am create mode 100644 extras/rule_generator/Makefile.am create mode 100644 extras/scsi_id/Makefile.am create mode 100644 extras/usb_id/Makefile.am create mode 100644 extras/volume_id/Makefile.am create mode 100644 extras/volume_id/lib/Makefile.am create mode 100644 extras/volume_id/lib/libvolume_id.pc.in create mode 100644 rules/Makefile.am create mode 100644 udev/.gitignore create mode 100644 udev/Makefile.am diff --git a/.gitignore b/.gitignore index ae9c0fe4ec..e96d00e30c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,23 @@ *.o -*.a -udevd -udevadm -udev_version.h -test-udev - +*.lo +*.la +.libs/ +.deps/ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache/ +config.h +config.h.in +config.log +config.status +config.guess +config.sub +libtool +ltmain.sh +install-sh +missing +configure +stamp-h1 +depcomp +udev-test-install/ diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000000..855259930e --- /dev/null +++ b/INSTALL @@ -0,0 +1,44 @@ + ./configure + --prefix= + "/usr" - prefix for man pages, include files + --exec-prefix= + "" - the root filesystem, prefix for libs and binaries + --sysconfdir= + "/etc" + --with-libdir-name= + "lib" - directory name for libraries, not a path name + multilib 64bit systems may use "lib64" instead of "lib" + --enable-debug + compile-in verbose debug messages + --disable-logging + disable all logging and compile-out all log strings + --enable-selinux + link against SELInux libraries to set the expected context + for created files + +The installation directories are controlled by $prefix, $exec_prefix +$sysconfdir and $libdir-name. Documentation, development files are +installed below $prefix, binaries are installed below $exec_prefix, +libraries below $exec_prefix/$libdir-name. + +The default configuration for a RPM spec file may look like: + --prefix=%{_prefix} + --exec-prefix="" + --sysconfdir=%{_sysconfdir} + --with-libdir-name=%{_lib} + +The well defined location for scripts and binaries which are called +from rules is /lib/udev/ on all systems and architectures, anything +else is broken. Other packages who use udev, may use the /lib/udev/ +directory to install their rule helper and udev rule files. + +It is recommended to use the /lib/udev/devices/ directory to place +device nodes, directories and symlinks, which are copied to /dev/ +at every bootup. That way, nodes for devices which can not be +detected automatically, or are activated on-demand by opening the +pre-existing device node, will be available. + +Default udev rules and persistent device naming rules are required +by other software that depends on the data udev collects from the +devices, and should therefore be installed by default with every udev +installation. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000000..8152af012d --- /dev/null +++ b/Makefile.am @@ -0,0 +1,41 @@ +SUBDIRS = \ + udev \ + rules \ + extras + +udevconfdir = $(sysconfdir)/udev +udevconf_DATA = \ + udev.conf + +EXTRA_DIST = \ + udev.conf \ + docs \ + autogen.sh + +distclean-local: + rm -f *~ + rm -rf autom4te.cache + rm -f depcomp aclocal.m4 config.h.in configure install-sh + rm -f Makefile.in missing config.guess config.sub ltmain.sh + rm -rf udev-test-install + rm -f udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 + +ChangeLog: + @ mv $@ $@.tmp + @ echo "Summary of changes from v$(shell echo $$(($(VERSION) - 1))) to v$(VERSION)" >> $@ + @ echo "============================================" >> $@ + @ echo >> $@ + @ git log --pretty=short $(shell echo $$(($(VERSION) - 1)))..HEAD | git shortlog >> $@ + @ echo >> $@ + @ cat $@ + @ cat $@.tmp >> $@ + @ rm $@.tmp + +test-run: + cd test && ./udev-test.pl + +test-install: + rm -rf $(PWD)/udev-test-install/ + make DESTDIR=$(PWD)/udev-test-install install + tree $(PWD)/udev-test-install/ + diff --git a/NEWS b/NEWS index fea7db0d2b..767a9b753f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,27 @@ +udev 126 +======== +We use ./configure now. See INSTALL for details. Current +options are: + --prefix= + "/usr" - prefix for man pages, include files + --exec-prefix= + "" - the root filesystem, prefix for libs and binaries + --sysconfdir= + "/etc" + --with-libdir-name= + "lib" - directory name for libraries, not a path name + multilib 64bit systems may use "lib64" instead of "lib" + --enable-debug + compile-in verbose debug messages + --disable-logging + disable all logging and compile-out all log strings + --enable-selinux + link against SELInux libraries to set the expected context + for created files + +No symlinks to udevadm are installed anymore, if still neded, the +package should create them. + udev 125 ======== Bugfixes. diff --git a/README b/README index 0af212de9c..2cde586ce2 100644 --- a/README +++ b/README @@ -17,19 +17,19 @@ Requirements: (unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, but it does not make any sense - don't complain if anything goes wrong.) - - The proc filesystem must be mounted on /proc, the sysfs filesystem must - be mounted at /sys. No other locations are supported by udev. + - The proc filesystem must be mounted on /proc/, the sysfs filesystem must + be mounted at /sys/. No other locations are supported by udev. Operation: - Udev creates and removes device nodes in /dev, based on events the kernel + Udev creates and removes device nodes in /dev/, based on events the kernel sends out on device discovery or removal. - - Very early in the boot process, the /dev directory should get a 'tmpfs' + - Very early in the boot process, the /dev/ directory should get a 'tmpfs' filesystem mounted, which is populated from scratch by udev. Created nodes or changed permissions will not survive a reboot, which is intentional. - - The content of /lib/udev/devices directory which contains the nodes, + - The content of /lib/udev/devices/ directory which contains the nodes, symlinks and directories, which are always expected to be in /dev, should be copied over to the tmpfs mounted /dev, to provide the required nodes to initialize udev and continue booting. @@ -48,44 +48,6 @@ Operation: device node with the default kernel name, or the one specified by a matching udev rule. - -Compile Options: - DESTDIR - Prefix of install target, used for package building. - USE_LOG - If set to 'true', udev is able to pass errors or debug information - to syslog. This is very useful to see what udev is doing or not doing. - It is enabled by default, don't expect any useful answer, if you - need to hunt a bug, but you can't enable syslog. - DEBUG - If set to 'true', very verbose debugging messages will be compiled - into the udev binaries. The actual level of debugging is specified - in the udev config file. - USE_SELINUX - If set to 'true', udev will be built with SELinux support - enabled. This is disabled by default. - EXTRAS - list of helper programs in extras/ to build. - make EXTRAS="extras/cdrom_id extras/scsi_id extras/volume_id" - - -Installation: - - The install target intalls the udev binaries in the default locations, - All binaries will be installed in /lib/udev or /sbin. - - - The default location for scripts and binaries that are called from - rules is /lib/udev. Other packages who install udev rules, may use - that directory too. - - - It is recommended to use the /lib/udev/devices/ directory to place - device nodes and symlinks in, which are copied to /dev at every boot. - That way, nodes for broken subsystems or devices which can't be - detected automatically by the kernel, will always be available. - - - Default udev rules and persistent device naming rules are required by other - software that depends on the data udev collects from the devices, - and should be installed by default with every udev installation. - -Please direct any comment/question/concern to the linux-hotplug-devel mailing list at: +Please direct any comment/question/concern to the linux-hotplug mailing list at: linux-hotplug@vger.kernel.org diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000000..b01012eb2e --- /dev/null +++ b/autogen.sh @@ -0,0 +1,57 @@ +#!/bin/sh -e + +(autopoint --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autopoint installed to generate the build system.." + echo + exit 1 +} +(autoconf --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoconf installed to generate the build system." + echo + exit 1 +} +(libtoolize --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have libtool installed to generate the build system." + echo + exit 1 +} +(autoheader --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have autoheader installed to generate the build system." + echo + exit 1 +} +(automake --version) < /dev/null > /dev/null 2>&1 || { + echo + echo "You must have automake installed to generate the build system." + echo + exit 1 +} + +test -f udev/udevd.c || { + echo "You must run this script in the top-level source directory" + exit 1 +} + +echo " aclocal: $(aclocal --version | head -1)" +aclocal +echo " autoconf: $(autoconf --version | head -1)" +autoconf +echo " libtool: $(automake --version | head -1)" +libtoolize --force +echo " autoheader: $(autoheader --version | head -1)" +autoheader +echo " automake: $(automake --version | head -1)" +automake --add-missing + +if test -z "$@"; then + args="--prefix=/usr --exec-prefix= --sysconfdir=/etc" +else + args=$@ +fi +echo " configure: $args" +echo +./configure $args diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000000..0ec8e204e3 --- /dev/null +++ b/configure.ac @@ -0,0 +1,118 @@ +AC_INIT(udev, + 126, + kay.sievers@vrfy.org) + +AC_PREREQ(2.60) +AC_CONFIG_SRCDIR(udev/udevd.c) +AM_INIT_AUTOMAKE([check-news foreign -Wall 1.9 dist-bzip2]) +AC_GNU_SOURCE +AC_DISABLE_STATIC +AC_SYS_LARGEFILE +AC_PROG_LIBTOOL + +dnl /* libvolume_id version */ +VOLID_LT_CURRENT=0 +VOLID_LT_REVISION=86 +VOLID_LT_AGE=0 +AC_SUBST(VOLID_LT_CURRENT) +AC_SUBST(VOLID_LT_REVISION) +AC_SUBST(VOLID_LT_AGE) + +AC_PATH_PROG([XSLTPROC], [xsltproc]) + +AC_CHECK_LIB(c, inotify_init, + [AC_DEFINE([HAVE_INOTIFY], 1, [inotify available])], + [AC_MSG_WARN([inotify support disabled])]) + +AC_CHECK_LIB(c, strlcpy, + [AC_DEFINE([HAVE_STRLCPY], 1, [strlcpy available])], + []) + +AC_ARG_WITH(udev-prefix, + AS_HELP_STRING([--with-udev-prefix=DIR], [add prefix to internal udev path names]), + [], [with_udev_prefix='${exec_prefix}']) +udev_prefix=$with_udev_prefix +AC_SUBST(udev_prefix) + +AC_ARG_WITH(libdir-name, + AS_HELP_STRING([--with-libdir-name=DIR], [name of the arch lib directory]), + [], [with_libdir_name=lib]) +libdir_name=$with_libdir_name +AC_SUBST(libdir_name) + +AC_ARG_WITH(selinux, + AS_HELP_STRING([--with-selinux], [compile with SELinux support]), + [], with_selinux=no) +if test "x$with_selinux" = xyes; then + LIBS_save=$LIBS + AC_CHECK_LIB(selinux, getprevcon, + [], + AC_MSG_ERROR([SELinux selected but libselinux not found])) + LIBS=$LIBS_save + AC_DEFINE(USE_SELINUX, [1] ,[compile with SELinux support]) + SELINUX_LIBS="-lselinux" +fi +AC_SUBST([SELINUX_LIBS]) +AM_CONDITIONAL(USE_SELINUX, [test "x$with_selinux" = xyes], [compile with SELinux support]) + +AC_ARG_ENABLE(debug, + AS_HELP_STRING([--enable-debug], [turn on debugging]), + [], enable_debug=no) +if test "x$enable_debug" = "xyes"; then + AC_DEFINE(DEBUG, [1] ,[Compile in debug messages]) + DEBUG_CFLAGS="-DDEBUG" +fi +AC_SUBST(DEBUG_CFLAGS) + +AC_ARG_ENABLE(logging, + AS_HELP_STRING([--disable-logging], [turn off logging/syslog]), + [], enable_logging=yes) +if test "x$enable_logging" != "xno"; then + AC_DEFINE(USE_LOG, [1] ,[Use logging/syslog]) +fi + +AC_CONFIG_HEADERS(config.h) +AC_CONFIG_FILES([ + Makefile + udev/Makefile + rules/Makefile + extras/Makefile + extras/ata_id/Makefile + extras/cdrom_id/Makefile + extras/edd_id/Makefile + extras/path_id/Makefile + extras/firmware/Makefile + extras/collect/Makefile + extras/floppy/Makefile + extras/fstab_import/Makefile + extras/rule_generator/Makefile + extras/scsi_id/Makefile + extras/usb_id/Makefile + extras/volume_id/Makefile + extras/volume_id/lib/Makefile + extras/volume_id/lib/libvolume_id.pc +]) +AC_OUTPUT + +echo " + udev $VERSION + ======== + + prefix: ${prefix} + exec_prefix: ${exec_prefix} + udev_prefix: ${udev_prefix} + libdir_name: ${libdir_name} + datarootdir: ${datarootdir} + mandir: ${mandir} + includedir: ${includedir} + + logging: ${enable_logging} + debug: ${enable_debug} + selinux: ${with_selinux} + + compiler: ${CC} + cflags: ${CFLAGS} + ldflags: ${LDFLAGS} + + xsltproc: ${XSLTPROC} +" diff --git a/extras/Makefile.am b/extras/Makefile.am new file mode 100644 index 0000000000..f72e0b1f5f --- /dev/null +++ b/extras/Makefile.am @@ -0,0 +1,16 @@ +SUBDIRS = \ + ata_id \ + cdrom_id \ + edd_id \ + path_id \ + firmware \ + collect \ + floppy \ + fstab_import \ + rule_generator \ + scsi_id \ + usb_id \ + volume_id + +distclean-local: + rm -f Makefile.in diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am new file mode 100644 index 0000000000..81332dd3f6 --- /dev/null +++ b/extras/ata_id/Makefile.am @@ -0,0 +1,20 @@ +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = \ + ata_id + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +ata_id_SOURCES = \ + ata_id.c \ + ../../udev/udev_sysdeps.c \ + ../../udev/udev_utils.c \ + ../../udev/udev_utils_string.c + +dist_man_MANS = \ + ata_id.8 + +distclean-local: + rm -f Makefile.in + diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 6d3c2330b4..125c3f3dd7 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -26,7 +26,7 @@ #include #include -#include "../../udev.h" +#include "../../udev/udev.h" #ifdef USE_LOG void log_message(int priority, const char *format, ...) diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am new file mode 100644 index 0000000000..88de1379cd --- /dev/null +++ b/extras/cdrom_id/Makefile.am @@ -0,0 +1,24 @@ +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = \ + cdrom_id + +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = \ + 60-cdrom_id.rules + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +cdrom_id_SOURCES = \ + cdrom_id.c \ + ../../udev/udev_sysdeps.c \ + ../../udev/udev_utils.c \ + ../../udev/udev_utils_string.c + +dist_man_MANS = \ + cdrom_id.8 + +distclean-local: + rm -f Makefile.in + diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index a1135665a9..acf7a97e41 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -37,7 +37,8 @@ #include #include #include -#include "../../udev.h" + +#include "../../udev/udev.h" #ifndef ARRAY_SIZE #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am new file mode 100644 index 0000000000..a92f4aa9f5 --- /dev/null +++ b/extras/collect/Makefile.am @@ -0,0 +1,11 @@ +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = \ + collect + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +distclean-local: + rm -f Makefile.in + diff --git a/extras/collect/collect.c b/extras/collect/collect.c index ce49b9f410..14184a5e05 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -31,9 +31,9 @@ #include #include -#include "../../list.h" +#include "../../udev/list.h" -#define TMPFILE "/dev/.udev/collect" +#define TMPFILE UDEV_PREFIX "/dev/.udev/collect" #define BUFSIZE 16 #define UDEV_ALARM_TIMEOUT 180 diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am new file mode 100644 index 0000000000..fa4f18c9fb --- /dev/null +++ b/extras/edd_id/Makefile.am @@ -0,0 +1,24 @@ +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = \ + edd_id + +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = \ + 61-persistent-storage-edd.rules + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +edd_id_SOURCES = \ + edd_id.c \ + ../../udev/udev_sysdeps.c \ + ../../udev/udev_utils.c \ + ../../udev/udev_utils_string.c + +dist_man_MANS = \ + edd_id.8 + +distclean-local: + rm -f Makefile.in + diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 4a177709a8..9d745c505a 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -23,7 +23,7 @@ #include #include -#include "../../udev.h" +#include "../../udev/udev.h" #ifdef USE_LOG void log_message(int priority, const char *format, ...) diff --git a/extras/firmware/Makefile.am b/extras/firmware/Makefile.am new file mode 100644 index 0000000000..0c69de9161 --- /dev/null +++ b/extras/firmware/Makefile.am @@ -0,0 +1,7 @@ +udevhomedir = $(udev_prefix)/lib/udev +dist_udevhome_SCRIPTS = \ + firmware.sh + +distclean-local: + rm -f Makefile.in + diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am new file mode 100644 index 0000000000..4854d5245b --- /dev/null +++ b/extras/floppy/Makefile.am @@ -0,0 +1,29 @@ +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = \ + create_floppy_devices + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +create_floppy_devices_SOURCES = \ + create_floppy_devices.c \ + ../../udev/udev_config.c \ + ../../udev/udev_sysdeps.c \ + ../../udev/udev_utils.c \ + ../../udev/udev_utils_string.c \ + ../../udev/udev_utils_file.c +if USE_SELINUX +create_floppy_devices_SOURCES += \ + ../../udev/udev_selinux.c + +create_floppy_devices_LDADD = \ + $(SELINUX_LIBS) +endif + +dist_man_MANS = \ + create_floppy_devices.8 + +distclean-local: + rm -f Makefile.in + diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index d79a782abf..3e73aa83c3 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -24,8 +24,8 @@ #include #include -#include "../../udev.h" -#include "../../udev_selinux.h" +#include "../../udev/udev.h" +#include "../../udev/udev_selinux.h" static char *table[] = { "", "d360", "h1200", "u360", "u720", "h360", "h720", diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am new file mode 100644 index 0000000000..0ee7efb9ce --- /dev/null +++ b/extras/fstab_import/Makefile.am @@ -0,0 +1,21 @@ +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = \ + fstab_import + +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = \ + 79-fstab_import.rules + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +fstab_import_SOURCES = \ + fstab_import.c \ + ../../udev/udev_sysdeps.c \ + ../../udev/udev_utils.c \ + ../../udev/udev_utils_string.c + +distclean-local: + rm -f Makefile.in + diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c index a8de067b38..2d24cfb38a 100644 --- a/extras/fstab_import/fstab_import.c +++ b/extras/fstab_import/fstab_import.c @@ -24,7 +24,7 @@ #include #include -#include "../../udev.h" +#include "../../udev/udev.h" static int debug; static char root[PATH_SIZE] = "/dev"; diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am new file mode 100644 index 0000000000..966a03dfaf --- /dev/null +++ b/extras/path_id/Makefile.am @@ -0,0 +1,10 @@ +udevhomedir = $(udev_prefix)/lib/udev +dist_udevhome_SCRIPTS = \ + path_id + +dist_man_MANS = \ + path_id.8 + +distclean-local: + rm -f Makefile.in + diff --git a/extras/rule_generator/Makefile.am b/extras/rule_generator/Makefile.am new file mode 100644 index 0000000000..1f0248b215 --- /dev/null +++ b/extras/rule_generator/Makefile.am @@ -0,0 +1,16 @@ +udevhomedir = $(udev_prefix)/lib/udev +dist_udevhome_SCRIPTS = \ + write_cd_rules \ + write_net_rules + +dist_udevhome_DATA = \ + rule_generator.functions + +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = \ + 75-cd-aliases-generator.rules \ + 75-persistent-net-generator.rules + +distclean-local: + rm -f Makefile.in + diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am new file mode 100644 index 0000000000..7f890b04cf --- /dev/null +++ b/extras/scsi_id/Makefile.am @@ -0,0 +1,27 @@ +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = \ + scsi_id + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +scsi_id_SOURCES = \ + scsi_id.c \ + scsi_serial.c \ + scsi.h \ + scsi_id.h \ + bsg.h \ + ../../udev/udev_sysdeps.c \ + ../../udev/udev_utils.c \ + ../../udev/udev_utils_string.c + +dist_sysconf_DATA = \ + scsi_id.config + +dist_man_MANS = \ + scsi_id.8 + +distclean-local: + rm -f Makefile.in + diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index bc942fac58..23bcb9468e 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -14,6 +14,8 @@ * Free Software Foundation version 2 of the License. */ +#include "config.h" + #include #include #include @@ -27,9 +29,8 @@ #include #include -#include "../../udev.h" +#include "../../udev/udev.h" #include "scsi_id.h" -#include "scsi_id_version.h" static const struct option options[] = { { "device", 1, NULL, 'd' }, @@ -51,7 +52,7 @@ static const char dev_short_options[] = "bgp:"; static int all_good; static int dev_specified; -static char config_file[MAX_PATH_LEN] = SCSI_ID_CONFIG_FILE; +static char config_file[MAX_PATH_LEN] = SYSCONFDIR "/scsi_id.config"; static enum page_code default_page_code; static int sg_version = 4; static int use_stderr; @@ -468,7 +469,7 @@ static int set_options(int argc, char **argv, const char *short_opts, break; case 'V': - printf("%s\n", SCSI_ID_VERSION); + printf("%s\n", VERSION); exit(0); break; diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 016075c3ea..104db3d95f 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -30,10 +30,9 @@ /* #include */ #include "bsg.h" -#include "../../udev.h" +#include "../../udev/udev.h" #include "scsi.h" #include "scsi_id.h" -#include "scsi_id_version.h" /* * A priority based list of id, naa, and binary/ascii for the identifier diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am new file mode 100644 index 0000000000..0de004a228 --- /dev/null +++ b/extras/usb_id/Makefile.am @@ -0,0 +1,18 @@ +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = \ + usb_id + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +usb_id_SOURCES = \ + usb_id.c \ + ../../udev/udev_sysfs.c \ + ../../udev/udev_sysdeps.c \ + ../../udev/udev_utils.c \ + ../../udev/udev_utils_string.c + +distclean-local: + rm -f Makefile.in + diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index fed6631b90..5b78b975d8 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -20,7 +20,7 @@ #include #include -#include "../../udev.h" +#include "../../udev/udev.h" #define MAX_PATH_LEN 512 #define MAX_SERIAL_LEN 256 diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am new file mode 100644 index 0000000000..bc1b262f27 --- /dev/null +++ b/extras/volume_id/Makefile.am @@ -0,0 +1,33 @@ +SUBDIRS = \ + lib + +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = \ + vol_id + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +vol_id_SOURCES = \ + vol_id.c \ + ../../udev/udev_sysdeps.c \ + ../../udev/udev_utils.c \ + ../../udev/udev_utils_string.c + +vol_id_LDADD = \ + lib/libvolume_id.la + +dist_man_MANS = \ + vol_id.8 + +EXTRA_DIST = \ + vol_id.xml + +%.7 %.8 : %.xml + $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + +distclean-local: + rm -f Makefile.in + rm -f $(dist_man_MANS) + diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am new file mode 100644 index 0000000000..de37f9e8b8 --- /dev/null +++ b/extras/volume_id/lib/Makefile.am @@ -0,0 +1,69 @@ +rootlibdir = $(exec_prefix)/$(libdir_name) +rootlib_LTLIBRARIES = \ + libvolume_id.la + +include_HEADERS =\ + libvolume_id.h + +libvolume_id_la_SOURCES =\ + ext.c \ + fat.c \ + hfs.c \ + highpoint.c \ + isw_raid.c \ + lsi_raid.c \ + via_raid.c \ + silicon_raid.c \ + nvidia_raid.c \ + promise_raid.c \ + adaptec_raid.c \ + jmicron_raid.c \ + ddf_raid.c \ + iso9660.c \ + jfs.c \ + linux_raid.c \ + linux_swap.c \ + lvm.c \ + ntfs.c \ + reiserfs.c \ + udf.c \ + ufs.c \ + xfs.c \ + cramfs.c \ + hpfs.c \ + romfs.c \ + sysv.c \ + minix.c \ + gfs.c \ + luks.c \ + ocfs.c \ + vxfs.c \ + squashfs.c \ + netware.c \ + oracleasm.c \ + volume_id.c \ + util.h \ + util.c + +libvolume_id_la_LDFLAGS = \ + -version-info $(VOLID_LT_CURRENT):$(VOLID_LT_REVISION):$(VOLID_LT_AGE) \ + -export-symbols $(top_srcdir)/extras/volume_id/lib/exported_symbols + +# move devel files to $(prefix)$(libdir_name) if needed +install-data-hook: + rm $(DESTDIR)$(rootlibdir)/libvolume_id.la + if test "$(prefix)" != "$(exec_prefix)"; then \ + rm $(DESTDIR)$(rootlibdir)/libvolume_id.so; \ + mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \ + ln -sf $(rootlibdir)/libvolume_id.so.$(VOLID_LT_CURRENT).$(VOLID_LT_AGE).$(VOLID_LT_REVISION) \ + $(DESTDIR)$(prefix)/$(libdir_name)/libvolume_id.so; \ + fi + +EXTRA_DIST = \ + exported_symbols + +pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig +pkgconfig_DATA = libvolume_id.pc + +distclean-local: + rm -f Makefile.in diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index 05b6e52bc4..55b0265825 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -1,64 +1,55 @@ -{ global: - volume_id_log_fn; - - volume_id_get_label; - volume_id_get_label_raw; - volume_id_get_uuid; - volume_id_get_uuid_raw; - volume_id_get_usage; - volume_id_get_type; - volume_id_get_type_version; - - volume_id_open_fd; - volume_id_close; - volume_id_probe_all; - volume_id_probe_filesystem; - volume_id_probe_raid; - volume_id_all_probers; - volume_id_get_prober_by_type; - volume_id_encode_string; - - volume_id_open_node; - - volume_id_probe_linux_swap; - volume_id_probe_luks; - volume_id_probe_cramfs; - volume_id_probe_ext; - volume_id_probe_vfat; - volume_id_probe_hfs_hfsplus; - volume_id_probe_hpfs; - volume_id_probe_iso9660; - volume_id_probe_jfs; - volume_id_probe_minix; - volume_id_probe_ntfs; - volume_id_probe_ocfs1; - volume_id_probe_ocfs2; - volume_id_probe_reiserfs; - volume_id_probe_romfs; - volume_id_probe_sysv; - volume_id_probe_udf; - volume_id_probe_ufs; - volume_id_probe_vxfs; - volume_id_probe_xfs; - volume_id_probe_squashfs; - volume_id_probe_netware; - volume_id_probe_gfs; - volume_id_probe_gfs2; - - volume_id_probe_linux_raid; - volume_id_probe_lvm1; - volume_id_probe_lvm2; - volume_id_probe_ddf_raid; - volume_id_probe_intel_software_raid; - volume_id_probe_highpoint_37x_raid; - volume_id_probe_highpoint_45x_raid; - volume_id_probe_lsi_mega_raid; - volume_id_probe_nvidia_raid; - volume_id_probe_promise_fasttrack_raid; - volume_id_probe_silicon_medley_raid; - volume_id_probe_via_raid; - volume_id_probe_adaptec_raid; - volume_id_probe_jmicron_raid; -local: - *; -}; +volume_id_log_fn +volume_id_get_label +volume_id_get_label_raw +volume_id_get_uuid +volume_id_get_uuid_raw +volume_id_get_usage +volume_id_get_type +volume_id_get_type_version +volume_id_open_fd +volume_id_close +volume_id_probe_all +volume_id_probe_filesystem +volume_id_probe_raid +volume_id_all_probers +volume_id_get_prober_by_type +volume_id_encode_string +volume_id_open_node +volume_id_probe_linux_swap +volume_id_probe_luks +volume_id_probe_cramfs +volume_id_probe_ext +volume_id_probe_vfat +volume_id_probe_hfs_hfsplus +volume_id_probe_hpfs +volume_id_probe_iso9660 +volume_id_probe_jfs +volume_id_probe_minix +volume_id_probe_ntfs +volume_id_probe_ocfs1 +volume_id_probe_ocfs2 +volume_id_probe_reiserfs +volume_id_probe_romfs +volume_id_probe_sysv +volume_id_probe_udf +volume_id_probe_ufs +volume_id_probe_vxfs +volume_id_probe_xfs +volume_id_probe_squashfs +volume_id_probe_netware +volume_id_probe_gfs +volume_id_probe_gfs2 +volume_id_probe_linux_raid +volume_id_probe_lvm1 +volume_id_probe_lvm2 +volume_id_probe_ddf_raid +volume_id_probe_intel_software_raid +volume_id_probe_highpoint_37x_raid +volume_id_probe_highpoint_45x_raid +volume_id_probe_lsi_mega_raid +volume_id_probe_nvidia_raid +volume_id_probe_promise_fasttrack_raid +volume_id_probe_silicon_medley_raid +volume_id_probe_via_raid +volume_id_probe_adaptec_raid +volume_id_probe_jmicron_raid diff --git a/extras/volume_id/lib/libvolume_id.pc.in b/extras/volume_id/lib/libvolume_id.pc.in new file mode 100644 index 0000000000..5a1e1b77ba --- /dev/null +++ b/extras/volume_id/lib/libvolume_id.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=@prefix@/@libdir_name@ +includedir=@prefix@/include + +Name: libvolume_id +Description: Library for reading metadata, label, uuid from various filesystems +Version: @VERSION@ +Libs: -L${libdir} -lvolume_id +Cflags: -I${includedir} diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 5c4e05d794..60428ab582 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -34,7 +34,7 @@ #include #include -#include "../../udev.h" +#include "../../udev/udev.h" #include "lib/libvolume_id.h" #define BLKGETSIZE64 _IOR(0x12,114,size_t) diff --git a/rules/Makefile.am b/rules/Makefile.am new file mode 100644 index 0000000000..45a64b725b --- /dev/null +++ b/rules/Makefile.am @@ -0,0 +1,25 @@ +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = \ + rules.d/50-udev-default.rules \ + rules.d/60-persistent-storage.rules \ + rules.d/60-persistent-storage-tape.rules \ + rules.d/60-persistent-input.rules \ + rules.d/60-persistent-v4l.rules \ + rules.d/80-drivers.rules \ + rules.d/95-udev-late.rules + +install-data-local: + -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d + +EXTRA_DIST = \ + packages \ + debian \ + redhat \ + suse \ + gentoo \ + slackware \ + frugalware + + +distclean-local: + rm -f Makefile.in diff --git a/test/udev-test.pl b/test/udev-test.pl index f7f68a1416..ad551dd042 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -22,7 +22,7 @@ use strict; my $PWD = $ENV{PWD}; my $sysfs = "sys/"; -my $udev_bin = "../test-udev"; +my $udev_bin = "../udev/test-udev"; my $udev_root = "udev-root/"; my $udev_conf = "udev-test.conf"; my $udev_rules = "udev-test.rules"; diff --git a/udev/.gitignore b/udev/.gitignore new file mode 100644 index 0000000000..5ce11acc15 --- /dev/null +++ b/udev/.gitignore @@ -0,0 +1,6 @@ +*.o +*.a +udevd +udevadm +test-udev +.deps/ diff --git a/udev/Makefile.am b/udev/Makefile.am new file mode 100644 index 0000000000..6402f231f9 --- /dev/null +++ b/udev/Makefile.am @@ -0,0 +1,115 @@ +sbin_PROGRAMS = \ + udevd \ + udevadm + +noinst_PROGRAMS = \ + test-udev + +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +udevd_SOURCES = \ + list.h \ + logging.h \ + udev.h \ + udev_rules.h \ + udev_selinux.h \ + udev_sysdeps.h \ + udevd.h \ + udevd.c \ + udev_config.c \ + udev_db.c \ + udev_device.c \ + udev_node.c \ + udev_rules.c \ + udev_rules_parse.c \ + udev_sysdeps.c \ + udev_sysfs.c \ + udev_utils.c \ + udev_utils_file.c \ + udev_utils_string.c +if USE_SELINUX +udevd_SOURCES += \ + udev_selinux.c + +udevd_LDADD = \ + $(SELINUX_LIBS) +endif + +udevadm_SOURCES = \ + list.h \ + logging.h \ + udev.h \ + udev_rules.h \ + udev_selinux.h \ + udev_sysdeps.h \ + udevadm.c \ + udevinfo.c \ + udevcontrol.c \ + udevtest.c \ + udevmonitor.c \ + udevsettle.c \ + udevtrigger.c \ + udev_config.c \ + udev_db.c \ + udev_device.c \ + udev_node.c \ + udev_rules.c \ + udev_rules_parse.c \ + udev_sysdeps.c \ + udev_sysfs.c \ + udev_utils.c \ + udev_utils_file.c \ + udev_utils_string.c +if USE_SELINUX +udevadm_SOURCES += \ + udev_selinux.c + +udevadm_LDADD = \ + $(SELINUX_LIBS) +endif + +test_udev_SOURCES = \ + list.h \ + logging.h \ + udev.h \ + udev_rules.h \ + udev_selinux.h \ + udev_sysdeps.h \ + test-udev.c \ + udev_config.c \ + udev_db.c \ + udev_device.c \ + udev_node.c \ + udev_rules.c \ + udev_rules_parse.c \ + udev_sysdeps.c \ + udev_sysfs.c \ + udev_utils.c \ + udev_utils_file.c \ + udev_utils_string.c +if USE_SELINUX +test_udev_SOURCES += \ + udev_selinux.c + +test_udev_LDADD = \ + $(SELINUX_LIBS) +endif + +dist_man_MANS = \ + udev.7 \ + udevadm.8 \ + udevd.8 + +EXTRA_DIST = \ + udev.xml \ + udevadm.xml \ + udevd.xml + +%.7 %.8 : %.xml + $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + +distclean-local: + rm -f Makefile.in + rm -f $(dist_man_MANS) diff --git a/udev/logging.h b/udev/logging.h index 6e1d5a20ef..6766ac3efa 100644 --- a/udev/logging.h +++ b/udev/logging.h @@ -22,6 +22,8 @@ #ifndef LOGGING_H #define LOGGING_H +#include "config.h" + #define err(format, arg...) do { } while (0) #define info(format, arg...) do { } while (0) #define dbg(format, arg...) do { } while (0) diff --git a/udev/test-udev.c b/udev/test-udev.c index 4ac2d5a889..591e93058a 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -17,6 +17,8 @@ * */ +#include "config.h" + #include #include #include @@ -71,7 +73,7 @@ int main(int argc, char *argv[], char *envp[]) int retval = -EINVAL; if (argc == 2 && strcmp(argv[1], "-V") == 0) { - printf("%s\n", UDEV_VERSION); + printf("%s\n", VERSION); exit(0); } @@ -93,7 +95,7 @@ int main(int argc, char *argv[], char *envp[]) err("open /dev/null failed: %s\n", strerror(errno)); udev_config_init(); selinux_init(); - dbg("version %s\n", UDEV_VERSION); + dbg("version %s\n", VERSION); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); diff --git a/udev/udev.h b/udev/udev.h index 5ecef4abbd..2648e2aa06 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -26,7 +26,6 @@ #include "list.h" #include "logging.h" #include "udev_sysdeps.h" -#include "udev_version.h" #define COMMENT_CHARACTER '#' #define LINE_SIZE 512 @@ -47,13 +46,6 @@ #define READ_END 0 #define WRITE_END 1 -#define UDEV_ROOT "/dev" -#define DB_DIR ".udev/db" -#define DB_NAME_INDEX_DIR ".udev/names" -#define RULES_LIB_DIR "/lib/udev/rules.d" -#define RULES_DYN_DIR ".udev/rules.d" -#define RULES_ETC_DIR "/etc/udev/rules.d" - struct udev_rules; struct sysfs_device { diff --git a/udev/udev_config.c b/udev/udev_config.c index 55f0361dd2..8a1dac51d2 100644 --- a/udev/udev_config.c +++ b/udev/udev_config.c @@ -164,8 +164,8 @@ void udev_config_init(void) { const char *env; - strcpy(udev_config_filename, UDEV_CONFIG_FILE); - strcpy(udev_root, UDEV_ROOT); + strcpy(udev_config_filename, SYSCONFDIR "/udev/udev.conf"); + strcpy(udev_root, UDEV_PREFIX "/dev"); udev_rules_dir[0] = '\0'; udev_log_priority = LOG_ERR; udev_run = 1; diff --git a/udev/udev_db.c b/udev/udev_db.c index 3348c9a02c..e3f0f7fd58 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -40,7 +40,7 @@ static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len /* translate to location of db file */ strlcpy(filename, udev_root, len); - start = strlcat(filename, "/"DB_DIR"/", len); + start = strlcat(filename, "/.udev/db/", len); strlcat(filename, devpath, len); return path_encode(&filename[start], len - start); } @@ -55,7 +55,7 @@ static int name_index(const char *devpath, const char *name, int add) /* directory with device name */ strlcpy(filename, udev_root, sizeof(filename)); - start = strlcat(filename, "/"DB_NAME_INDEX_DIR"/", sizeof(filename)); + start = strlcat(filename, "/.udev/names/", sizeof(filename)); strlcat(filename, name, sizeof(filename)); path_encode(&filename[start], sizeof(filename) - start); /* entry with the devpath */ @@ -86,7 +86,7 @@ int udev_db_get_devices_by_name(const char *name, struct list_head *name_list) int rc = 0; strlcpy(dirname, udev_root, sizeof(dirname)); - start = strlcat(dirname, "/"DB_NAME_INDEX_DIR"/", sizeof(dirname)); + start = strlcat(dirname, "/.udev/names/", sizeof(dirname)); strlcat(dirname, name, sizeof(dirname)); path_encode(&dirname[start], sizeof(dirname) - start); @@ -303,7 +303,7 @@ int udev_db_get_all_entries(struct list_head *name_list) DIR *dir; strlcpy(dbpath, udev_root, sizeof(dbpath)); - strlcat(dbpath, "/"DB_DIR, sizeof(dbpath)); + strlcat(dbpath, "/.udev/db", sizeof(dbpath)); dir = opendir(dbpath); if (dir == NULL) { info("no udev_db available '%s': %s\n", dbpath, strerror(errno)); diff --git a/udev/udev_device.c b/udev/udev_device.c index cf21191ca0..bce5b29986 100644 --- a/udev/udev_device.c +++ b/udev/udev_device.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff --git a/udev/udev_rules.c b/udev/udev_rules.c index ea850a84c3..693bce261c 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -174,7 +174,7 @@ static int run_program(const char *command, const char *subsystem, /* allow programs in /lib/udev called without the path */ if (strchr(argv[0], '/') == NULL) { - strlcpy(program, "/lib/udev/", sizeof(program)); + strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); strlcat(program, argv[0], sizeof(program)); argv[0] = program; } diff --git a/udev/udev_rules.h b/udev/udev_rules.h index fe0f9dfbb5..9a41ccbdd8 100644 --- a/udev/udev_rules.h +++ b/udev/udev_rules.h @@ -24,7 +24,6 @@ #include "list.h" #define PAIRS_MAX 5 -#define RULESFILE_SUFFIX ".rules" enum key_operation { KEY_OP_UNSET, diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 3ada8b1c7d..273f92f486 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -451,7 +451,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena /* allow programs in /lib/udev called without the path */ if (strchr(file, '/') == NULL) { - strlcpy(file, "/lib/udev/", sizeof(file)); + strlcpy(file, UDEV_PREFIX "/lib/udev/", sizeof(file)); strlcat(file, value, sizeof(file)); pos = strchr(file, ' '); if (pos) @@ -739,24 +739,24 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) if (udev_rules_dir[0] != '\0') { /* custom rules location for testing */ - add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX); + add_matching_files(&name_list, udev_rules_dir, ".rules"); } else { /* read default rules */ - add_matching_files(&name_list, RULES_LIB_DIR, RULESFILE_SUFFIX); + add_matching_files(&name_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); /* read user/custom rules */ - add_matching_files(&sort_list, RULES_ETC_DIR, RULESFILE_SUFFIX); + add_matching_files(&sort_list, SYSCONFDIR "/udev/rules.d", ".rules"); /* read dynamic/temporary rules */ strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); + strlcat(filename, "/.udev/rules.d", sizeof(filename)); if (stat(filename, &statbuf) != 0) { create_path(filename); selinux_setfscreatecon(filename, NULL, S_IFDIR|0755); mkdir(filename, 0755); selinux_resetfscreatecon(); } - add_matching_files(&sort_list, filename, RULESFILE_SUFFIX); + add_matching_files(&sort_list, filename, ".rules"); /* sort all rules files by basename into list of files */ list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) { diff --git a/udev/udev_selinux.c b/udev/udev_selinux.c index eec950194c..66742e1fec 100644 --- a/udev/udev_selinux.c +++ b/udev/udev_selinux.c @@ -16,6 +16,8 @@ * */ +#include "config.h" + #include #include #include diff --git a/udev/udev_selinux.h b/udev/udev_selinux.h index 73567d6cfe..fcdd9dbe5f 100644 --- a/udev/udev_selinux.h +++ b/udev/udev_selinux.h @@ -19,20 +19,17 @@ #define _UDEV_SELINUX_H #ifdef USE_SELINUX - extern void selinux_setfilecon(const char *file, const char *devname, unsigned int mode); extern void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode); extern void selinux_resetfscreatecon(void); extern void selinux_init(void); extern void selinux_exit(void); - #else - static inline void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) {} static inline void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) {} static inline void selinux_resetfscreatecon(void) {} static inline void selinux_init(void) {} static inline void selinux_exit(void) {} +#endif -#endif /* USE_SELINUX */ -#endif /* _UDEV_USE_SELINUX */ +#endif diff --git a/udev/udev_sysdeps.c b/udev/udev_sysdeps.c index 9447cca936..ef5b09ef89 100644 --- a/udev/udev_sysdeps.c +++ b/udev/udev_sysdeps.c @@ -1,6 +1,5 @@ /* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2005-2006 Kay Sievers + * Copyright (C) 2005-2008 Kay Sievers * * 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 @@ -20,14 +19,9 @@ #include #include #include -#include -#include -#include #include -#include "udev.h" - -#ifdef __GLIBC__ +#ifndef HAVE_STRLCPY size_t strlcpy(char *dst, const char *src, size_t size) { size_t bytes = 0; @@ -70,4 +64,4 @@ size_t strlcat(char *dst, const char *src, size_t size) *q = '\0'; return bytes; } -#endif /* __GLIBC__ */ +#endif /* HAVE_STRLCPY */ diff --git a/udev/udev_sysdeps.h b/udev/udev_sysdeps.h index d4f03686af..f08053e5f1 100644 --- a/udev/udev_sysdeps.h +++ b/udev/udev_sysdeps.h @@ -1,7 +1,7 @@ /* * wrapping of libc features and kernel interfaces * - * Copyright (C) 2005-2006 Kay Sievers + * Copyright (C) 2005-2008 Kay Sievers * * 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 @@ -21,82 +21,17 @@ #ifndef _UDEV_SYSDEPS_H_ #define _UDEV_SYSDEPS_H_ -#include -#include #include -/* needed until Inotify! syscalls reach glibc */ -#include -#ifndef __NR_inotify_init -#if defined(__i386__) -# define __NR_inotify_init 291 -# define __NR_inotify_add_watch 292 -# define __NR_inotify_rm_watch 293 -#elif defined(__x86_64__) -# define __NR_inotify_init 253 -# define __NR_inotify_add_watch 254 -# define __NR_inotify_rm_watch 255 -#elif defined(__powerpc__) || defined(__powerpc64__) -# define __NR_inotify_init 275 -# define __NR_inotify_add_watch 276 -# define __NR_inotify_rm_watch 277 -#elif defined (__ia64__) -# define __NR_inotify_init 1277 -# define __NR_inotify_add_watch 1278 -# define __NR_inotify_rm_watch 1279 -#elif defined (__s390__) -# define __NR_inotify_init 284 -# define __NR_inotify_add_watch 285 -# define __NR_inotify_rm_watch 286 -#elif defined (__alpha__) -# define __NR_inotify_init 444 -# define __NR_inotify_add_watch 445 -# define __NR_inotify_rm_watch 446 -#elif defined (__sparc__) || defined (__sparc64__) -# define __NR_inotify_init 151 -# define __NR_inotify_add_watch 152 -# define __NR_inotify_rm_watch 156 -#elif defined (__arm__) -# define __NR_inotify_init __NR_SYSCALL_BASE+316 -# define __NR_inotify_add_watch __NR_SYSCALL_BASE+317 -# define __NR_inotify_rm_watch __NR_SYSCALL_BASE+318 -#elif defined (__sh__) -# define __NR_inotify_init 290 -# define __NR_inotify_add_watch 291 -# define __NR_inotify_rm_watch 292 -#elif defined (__m32r__) -# define __NR_inotify_init 290 -# define __NR_inotify_add_watch 291 -# define __NR_inotify_rm_watch 292 -#elif defined (__hppa__) -# define __NR_inotify_init 269 -# define __NR_inotify_add_watch 270 -# define __NR_inotify_rm_watch 271 -#elif defined (__mips__) -# include -# if _MIPS_SIM == _MIPS_SIM_ABI32 -# define __NR_Linux 4000 -# define __NR_inotify_init (__NR_Linux + 284) -# define __NR_inotify_add_watch (__NR_Linux + 285) -# define __NR_inotify_rm_watch (__NR_Linux + 286) -# elif _MIPS_SIM == _MIPS_SIM_ABI64 -# define __NR_Linux 5000 -# define __NR_inotify_init (__NR_Linux + 243) -# define __NR_inotify_add_watch (__NR_Linux + 244) -# define __NR_inotify_rm_watch (__NR_Linux + 245) -# elif _MIPS_SIM == _MIPS_SIM_NABI32 -# define __NR_Linux 6000 -# define __NR_inotify_init (__NR_Linux + 247) -# define __NR_inotify_add_watch (__NR_Linux + 248) -# define __NR_inotify_rm_watch (__NR_Linux + 249) -# endif +/* needed for our signal handlers to work */ +#undef asmlinkage +#ifdef __i386__ +#define asmlinkage __attribute__((regparm(0))) #else -#warning "inotify unsupported on this architecture!" -#endif -#endif /* __NR_inotify_init */ +#define asmlinkage +#endif /* __i386__ */ -/* dummy if we don't have the syscalls defined */ -#ifndef __NR_inotify_init +#ifndef HAVE_INOTIFY static inline int inotify_init(void) { return -1; @@ -106,67 +41,11 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) { return -1; } -#else -/* needed until /usr/include/sys/inotify.h is working */ -#ifndef __GLIBC__ -#include -#else -static inline int inotify_init(void) -{ - return syscall(__NR_inotify_init); -} - -static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) -{ - return syscall(__NR_inotify_add_watch, fd, name, mask); -} -#endif /* __GLIBC__ */ -#endif /* __NR_inotify_init */ - -#ifndef IN_CREATE -#define IN_CREATE 0x00000100 /* Subfile was created */ -#define IN_MOVED_FROM 0x00000040 /* File was moved from X */ -#define IN_MOVED_TO 0x00000080 /* File was moved to Y */ -#define IN_DELETE 0x00000200 /* Subfile was deleted */ -#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */ -#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */ -#endif /* IN_CREATE */ - -/* needed for our signal handlers to work */ -#undef asmlinkage -#ifdef __i386__ -#define asmlinkage __attribute__((regparm(0))) -#else -#define asmlinkage -#endif /* __i386__ */ - -/* headers are broken on some architectures */ -#ifndef __FD_SET -#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) -#endif -#ifndef __FD_CLR -#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) -#endif -#ifndef __FD_ISSET -#define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0) -#endif -#ifndef __FD_ZERO -#define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set))) -#endif - -#ifndef NETLINK_KOBJECT_UEVENT -#define NETLINK_KOBJECT_UEVENT 15 -#endif - -#ifndef SO_RCVBUFFORCE -#if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || defined(__sparc_v9__) -#define SO_RCVBUFFORCE 0x100b -#else -#define SO_RCVBUFFORCE 33 -#endif #endif +#ifndef HAVE_STRLCPY extern size_t strlcpy(char *dst, const char *src, size_t size); extern size_t strlcat(char *dst, const char *src, size_t size); +#endif #endif diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c index c4cd4ab75d..91f5997d0c 100644 --- a/udev/udev_sysfs.c +++ b/udev/udev_sysfs.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/udev/udev_utils.c b/udev/udev_utils.c index 00b67dadc6..9b22de783f 100644 --- a/udev/udev_utils.c +++ b/udev/udev_utils.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c index a492785af9..3e73c8769e 100644 --- a/udev/udev_utils_file.c +++ b/udev/udev_utils_file.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/udev/udev_utils_string.c b/udev/udev_utils_string.c index e3dc137e63..78bfca800c 100644 --- a/udev/udev_utils_string.c +++ b/udev/udev_utils_string.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include diff --git a/udev/udevadm.c b/udev/udevadm.c index 6e7d7734d2..7adb7c5732 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -16,6 +16,8 @@ * */ +#include "config.h" + #include #include #include @@ -37,9 +39,9 @@ void log_message(int priority, const char *format, ...) return; va_start(args, format); - if (debug) { + if (debug) vprintf(format, args); - } else + else vsyslog(priority, format, args); va_end(args); } @@ -56,7 +58,7 @@ static const struct command cmds[]; static int version(int argc, char *argv[], char *envp[]) { - printf("%s\n", UDEV_VERSION); + printf("%s\n", VERSION); return 0; } diff --git a/udev/udevcontrol.c b/udev/udevcontrol.c index 4c93b8f464..a02bfc4d65 100644 --- a/udev/udevcontrol.c +++ b/udev/udevcontrol.c @@ -16,6 +16,8 @@ * */ +#include "config.h" + #include #include #include @@ -50,7 +52,7 @@ int udevcontrol(int argc, char *argv[], char *envp[]) udev_log = log_priority(env); logging_init("udevcontrol"); - dbg("version %s\n", UDEV_VERSION); + dbg("version %s\n", VERSION); if (argc < 2) { fprintf(stderr, "missing command\n\n"); diff --git a/udev/udevd.c b/udev/udevd.c index 0827a5ceb3..22d261fccb 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -17,6 +17,8 @@ * */ +#include "config.h" + #include #include #include @@ -39,6 +41,9 @@ #include #include #include +#ifdef HAVE_INOTIFY +#include +#endif #include "udev.h" #include "udev_rules.h" @@ -156,12 +161,12 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st size_t start; /* location of queue file */ - snprintf(filename, sizeof(filename), "%s/"EVENT_QUEUE_DIR"/%llu", udev_root, msg->seqnum); + snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", udev_root, msg->seqnum); /* location of failed file */ strlcpy(filename_failed, udev_root, sizeof(filename_failed)); strlcat(filename_failed, "/", sizeof(filename_failed)); - start = strlcat(filename_failed, EVENT_FAILED_DIR"/", sizeof(filename_failed)); + start = strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed)); strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); path_encode(&filename_failed[start], sizeof(filename_failed) - start); @@ -182,7 +187,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st strlcpy(filename_failed_old, udev_root, sizeof(filename_failed_old)); strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); - start = strlcat(filename_failed_old, EVENT_FAILED_DIR"/", sizeof(filename_failed_old)); + start = strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old)); strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); path_encode(&filename_failed_old[start], sizeof(filename) - start); @@ -273,7 +278,7 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { char str[32]; @@ -939,7 +944,7 @@ static void export_initial_seqnum(void) len = 3; } strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); create_path(filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { @@ -971,7 +976,7 @@ int main(int argc, char *argv[], char *envp[]) logging_init("udevd"); udev_config_init(); selinux_init(); - dbg("version %s\n", UDEV_VERSION); + dbg("version %s\n", VERSION); while (1) { option = getopt_long(argc, argv, "dDthV", options, NULL); @@ -994,7 +999,7 @@ int main(int argc, char *argv[], char *envp[]) printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n"); goto exit; case 'V': - printf("%s\n", UDEV_VERSION); + printf("%s\n", VERSION); goto exit; default: goto exit; @@ -1123,7 +1128,7 @@ int main(int argc, char *argv[], char *envp[]) fd = open("/dev/kmsg", O_WRONLY); if (fd > 0) { - const char *str = "<6>udevd version " UDEV_VERSION " started\n"; + const char *str = "<6>udevd version " VERSION " started\n"; write(fd, str, strlen(str)); close(fd); @@ -1148,14 +1153,14 @@ int main(int argc, char *argv[], char *envp[]) } else { char filename[PATH_MAX]; - inotify_add_watch(inotify_fd, RULES_LIB_DIR, + inotify_add_watch(inotify_fd, UDEV_PREFIX "/lib/udev/rules.d", IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - inotify_add_watch(inotify_fd, RULES_ETC_DIR, + inotify_add_watch(inotify_fd, SYSCONFDIR "/udev/rules.d", IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename)); + strlcat(filename, "/.udev/rules.d", sizeof(filename)); inotify_add_watch(inotify_fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } diff --git a/udev/udevd.h b/udev/udevd.h index 9be34cb0cc..1f4d6e417f 100644 --- a/udev/udevd.h +++ b/udev/udevd.h @@ -22,10 +22,6 @@ #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 -#define EVENT_QUEUE_DIR ".udev/queue" -#define EVENT_FAILED_DIR ".udev/failed" -#define EVENT_SEQNUM ".udev/uevent_seqnum" - /* maximum limit of forked childs */ #define UDEVD_MAX_CHILDS 256 /* start to throttle forking if maximum number of running childs in our session is reached */ @@ -35,8 +31,8 @@ #define UEVENT_BUFFER_SIZE 2048 #define UEVENT_NUM_ENVP 32 -#define UDEVD_CTRL_SOCK_PATH "/org/kernel/udev/udevd" -#define UDEVD_CTRL_MAGIC "udevd_" UDEV_VERSION +#define UDEVD_CTRL_SOCK_PATH UDEV_PREFIX "/org/kernel/udev/udevd" +#define UDEVD_CTRL_MAGIC "udevd_" VERSION enum udevd_ctrl_msg_type { UDEVD_CTRL_UNKNOWN, diff --git a/udev/udevinfo.c b/udev/udevinfo.c index b9ee17c4f1..a97f09c3e6 100644 --- a/udev/udevinfo.c +++ b/udev/udevinfo.c @@ -16,6 +16,8 @@ * */ +#include "config.h" + #include #include #include @@ -373,10 +375,10 @@ int udevinfo(int argc, char *argv[], char *envp[]) export_prefix = optarg; break; case 1: - printf("%s\n", UDEV_VERSION); + printf("%s\n", VERSION); goto exit; case 'V': - printf("udevinfo, version %s\n", UDEV_VERSION); + printf("udevinfo, version %s\n", VERSION); goto exit; case 'h': printf("Usage: udevadm info OPTIONS\n" diff --git a/udev/udevsettle.c b/udev/udevsettle.c index cb63a66bba..f00a38b4b7 100644 --- a/udev/udevsettle.c +++ b/udev/udevsettle.c @@ -89,7 +89,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) logging_init("udevsettle"); udev_config_init(); - dbg("version %s\n", UDEV_VERSION); + dbg("version %s\n", VERSION); sysfs_init(); while (1) { @@ -113,7 +113,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) } strlcpy(queuename, udev_root, sizeof(queuename)); - strlcat(queuename, "/" EVENT_QUEUE_DIR, sizeof(queuename)); + strlcat(queuename, "/.udev/queue", sizeof(queuename)); loop = timeout * LOOP_PER_SECOND; while (loop--) { @@ -135,7 +135,7 @@ int udevsettle(int argc, char *argv[], char *envp[]) /* read current udev seqnum */ strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename)); + strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); fd = open(filename, O_RDONLY); if (fd < 0) goto exit; diff --git a/udev/udevtest.c b/udev/udevtest.c index d5e90b02c6..2b43691f39 100644 --- a/udev/udevtest.c +++ b/udev/udevtest.c @@ -91,7 +91,7 @@ int udevtest(int argc, char *argv[], char *envp[]) {} }; - info("version %s\n", UDEV_VERSION); + info("version %s\n", VERSION); udev_config_init(); if (udev_log_priority < LOG_INFO) { char priority[32]; diff --git a/udev/udevtrigger.c b/udev/udevtrigger.c index d4b10d06ab..d338f82664 100644 --- a/udev/udevtrigger.c +++ b/udev/udevtrigger.c @@ -536,7 +536,7 @@ static void scan_failed(void) struct dirent *dent; strlcpy(base, udev_root, sizeof(base)); - strlcat(base, "/" EVENT_FAILED_DIR, sizeof(base)); + strlcat(base, "/.udev/failed", sizeof(base)); dir = opendir(base); if (dir != NULL) { @@ -582,7 +582,7 @@ int udevtrigger(int argc, char *argv[], char *envp[]) logging_init("udevtrigger"); udev_config_init(); - dbg("version %s\n", UDEV_VERSION); + dbg("version %s\n", VERSION); sysfs_init(); while (1) { -- cgit v1.2.3-54-g00ecf From f63dc3b74f67483b38f7fbd926bf10f5cac73387 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Jul 2008 13:20:31 +0200 Subject: rules: mode 0660 for group "disk" --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 718d1899f5..75a3e6d39f 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -58,7 +58,7 @@ KERNEL=="lp[0-9]*", GROUP="lp", SYMLINK+="par%n" KERNEL=="irlpt[0-9]*", GROUP="lp" # block, tapes, block-releated -SUBSYSTEM=="block", GROUP="disk", MODE="0640" +SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" -- cgit v1.2.3-54-g00ecf From 75d7bb02bffd5b11a900175b7268cf8669200f8d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Jul 2008 13:21:20 +0200 Subject: rules: update Fedora rules --- rules/redhat/40-redhat.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/redhat/40-redhat.rules b/rules/redhat/40-redhat.rules index 446cc6d1d5..47ce9e503d 100644 --- a/rules/redhat/40-redhat.rules +++ b/rules/redhat/40-redhat.rules @@ -23,3 +23,5 @@ KERNEL=="vcs[0-9]*", OWNER="vcsa", GROUP="tty" KERNEL=="vcsa", OWNER="vcsa", GROUP="tty" KERNEL=="vcsa[0-9]*", OWNER="vcsa", GROUP="tty" KERNEL=="vcc/*", OWNER="vcsa", GROUP="tty" + +KERNEL=="event*", ATTRS{idVendor}=="03f0", ATTRS{interface}=="Virtual Mouse", ATTRS{bInterfaceProtocol}=="02", SYMLINK+="input/hp_ilo_mouse" -- cgit v1.2.3-54-g00ecf From e1b802a7dbcd88fc4965dbee9faf55c6bd3f5601 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Jul 2008 13:38:53 +0200 Subject: update ChangeLog --- ChangeLog | 13 +++++++++++++ Makefile.am | 21 +++++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5c6ded726b..106bdd1797 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Summary of changes from v125 to v126 +============================================ + +Kay Sievers (4): + delete all Makefiles and move udev source to udev/ + use autotools + rules: mode 0660 for group "disk" + rules: update Fedora rules + +Thomas Koeller (1): + use proper directory lib/lib64 for libvolume_id + + Summary of changes from v124 to v125 ============================================ diff --git a/Makefile.am b/Makefile.am index 8152af012d..60f54ea9e4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,16 +20,17 @@ distclean-local: rm -rf udev-test-install rm -f udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 -ChangeLog: - @ mv $@ $@.tmp - @ echo "Summary of changes from v$(shell echo $$(($(VERSION) - 1))) to v$(VERSION)" >> $@ - @ echo "============================================" >> $@ - @ echo >> $@ - @ git log --pretty=short $(shell echo $$(($(VERSION) - 1)))..HEAD | git shortlog >> $@ - @ echo >> $@ - @ cat $@ - @ cat $@.tmp >> $@ - @ rm $@.tmp +changelog: + @ head -1 ChangeLog | grep -q "to v$(shell echo $$(($(VERSION) - 1)))" + @ mv ChangeLog ChangeLog.tmp + @ echo "Summary of changes from v$(shell echo $$(($(VERSION) - 1))) to v$(VERSION)" >> ChangeLog + @ echo "============================================" >> ChangeLog + @ echo >> ChangeLog + @ git log --pretty=short $(shell echo $$(($(VERSION) - 1)))..HEAD | git shortlog >> ChangeLog + @ echo >> ChangeLog + @ cat ChangeLog + @ cat ChangeLog.tmp >> ChangeLog + @ rm ChangeLog.tmp test-run: cd test && ./udev-test.pl -- cgit v1.2.3-54-g00ecf From 47b0c350952116cb09130cf02f172aa12a37f829 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Jul 2008 13:57:51 +0200 Subject: INSTALL: --enable-selinux not --with-selinux --- ChangeLog | 4 +++- INSTALL | 2 +- NEWS | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 106bdd1797..1e6afb3224 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,13 @@ Summary of changes from v125 to v126 ============================================ -Kay Sievers (4): +Kay Sievers (6): delete all Makefiles and move udev source to udev/ use autotools rules: mode 0660 for group "disk" rules: update Fedora rules + update ChangeLog + INSTALL: --enable-selinux not --with-selinux Thomas Koeller (1): use proper directory lib/lib64 for libvolume_id diff --git a/INSTALL b/INSTALL index 855259930e..17cd7b683f 100644 --- a/INSTALL +++ b/INSTALL @@ -12,7 +12,7 @@ compile-in verbose debug messages --disable-logging disable all logging and compile-out all log strings - --enable-selinux + --with-selinux link against SELInux libraries to set the expected context for created files diff --git a/NEWS b/NEWS index 767a9b753f..a7a5579de9 100644 --- a/NEWS +++ b/NEWS @@ -15,7 +15,7 @@ options are: compile-in verbose debug messages --disable-logging disable all logging and compile-out all log strings - --enable-selinux + --with-selinux link against SELInux libraries to set the expected context for created files -- cgit v1.2.3-54-g00ecf From 4cf46e2c02934e08844cb4b849e022aaca04d34a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Jul 2008 14:45:43 +0200 Subject: volume_id: move static lib to $prefix --- extras/volume_id/lib/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am index de37f9e8b8..592b390987 100644 --- a/extras/volume_id/lib/Makefile.am +++ b/extras/volume_id/lib/Makefile.am @@ -53,8 +53,9 @@ libvolume_id_la_LDFLAGS = \ install-data-hook: rm $(DESTDIR)$(rootlibdir)/libvolume_id.la if test "$(prefix)" != "$(exec_prefix)"; then \ - rm $(DESTDIR)$(rootlibdir)/libvolume_id.so; \ mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \ + mv $(DESTDIR)$(rootlibdir)/libvolume_id.a $(DESTDIR)$(prefix)/$(libdir_name)/; \ + rm $(DESTDIR)$(rootlibdir)/libvolume_id.so; \ ln -sf $(rootlibdir)/libvolume_id.so.$(VOLID_LT_CURRENT).$(VOLID_LT_AGE).$(VOLID_LT_REVISION) \ $(DESTDIR)$(prefix)/$(libdir_name)/libvolume_id.so; \ fi -- cgit v1.2.3-54-g00ecf From 4337f8fcf14ab49f55ea325d94a4595e5e49a3b8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Jul 2008 15:50:12 +0200 Subject: volume_id: create relative links --- extras/volume_id/lib/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am index 592b390987..6313962e68 100644 --- a/extras/volume_id/lib/Makefile.am +++ b/extras/volume_id/lib/Makefile.am @@ -55,8 +55,10 @@ install-data-hook: if test "$(prefix)" != "$(exec_prefix)"; then \ mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \ mv $(DESTDIR)$(rootlibdir)/libvolume_id.a $(DESTDIR)$(prefix)/$(libdir_name)/; \ + so_img_name=$$(readlink $(DESTDIR)$(rootlibdir)/libvolume_id.so); \ rm $(DESTDIR)$(rootlibdir)/libvolume_id.so; \ - ln -sf $(rootlibdir)/libvolume_id.so.$(VOLID_LT_CURRENT).$(VOLID_LT_AGE).$(VOLID_LT_REVISION) \ + so_img_rel_target_prefix=$$(echo $(prefix)/$(libdir_name) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ + ln -sf $$so_img_rel_target_prefix$(exec_prefix)/$(libdir_name)/$$so_img_name \ $(DESTDIR)$(prefix)/$(libdir_name)/libvolume_id.so; \ fi -- cgit v1.2.3-54-g00ecf From e8e9cd5d739447d58288e6251e533b07f8352928 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Thu, 31 Jul 2008 10:29:39 +0200 Subject: rules: Debian update --- rules/debian/50-udev.rules | 6 +++--- rules/debian/75-persistent-net-generator.rules | 8 +++----- rules/debian/80-drivers.rules | 2 ++ rules/debian/91-permissions.rules | 2 +- rules/debian/95-late.rules | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rules/debian/50-udev.rules b/rules/debian/50-udev.rules index e3a10701cf..0ac5d8cfbc 100644 --- a/rules/debian/50-udev.rules +++ b/rules/debian/50-udev.rules @@ -29,8 +29,8 @@ SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ SYMLINK+="pilot" # usbfs-like devices -SUBSYSTEM=="usb_device", ACTION=="add", \ - PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add", \ +SUBSYSTEM=="usb_device", ACTION=="add|change", \ + PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add|change", \ NAME="$result" SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" @@ -39,7 +39,7 @@ KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" KERNEL=="capi[0-9]*", NAME="capi/%n" # video devices -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add", \ +KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add|change", \ NAME="$result" KERNEL=="card[0-9]*", NAME="dri/%k" diff --git a/rules/debian/75-persistent-net-generator.rules b/rules/debian/75-persistent-net-generator.rules index e8d3b888e0..9fdf106045 100644 --- a/rules/debian/75-persistent-net-generator.rules +++ b/rules/debian/75-persistent-net-generator.rules @@ -1,5 +1,5 @@ # These rules generate rules to keep network interface names unchanged -# across reboots write them to /etc/udev/rules.d/70-persistent-net.rules. +# across reboots and write them to /etc/udev/rules.d/70-persistent-net.rules. # variables used to communicate: # MATCHADDR MAC address used for the match @@ -16,9 +16,6 @@ SUBSYSTEM!="net", GOTO="persistent_net_generator_end" # ignore the interface if a name has already been set NAME=="?*", GOTO="persistent_net_generator_end" -# ignore interfaces without a driver link like bridges and VLANs -DRIVERS!="?*", GOTO="persistent_net_generator_end" - # device name whitelist KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ GOTO="persistent_net_generator_end" @@ -76,8 +73,9 @@ ATTRS{driver}=="?*", \ ENV{COMMENT}="$env{COMMENT} ($attr{driver})" +# ignore interfaces without a driver link like bridges and VLANs, otherwise # generate and write the rule -IMPORT{program}="write_net_rules" +DRIVERS=="?*", IMPORT{program}="write_net_rules" # rename the interface if requested ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" diff --git a/rules/debian/80-drivers.rules b/rules/debian/80-drivers.rules index edfcfa5394..417bfd5de4 100644 --- a/rules/debian/80-drivers.rules +++ b/rules/debian/80-drivers.rules @@ -52,6 +52,8 @@ LABEL="hotplug_not_add_event" SUBSYSTEM=="net", RUN+="net.agent" +SUBSYSTEM=="atm", RUN+="dsl-modem.agent" + # Log every event to /dev/hotplug.log (for debugging). #RUN+="logger.agent" diff --git a/rules/debian/91-permissions.rules b/rules/debian/91-permissions.rules index 5182a4bd28..3270d41aa3 100644 --- a/rules/debian/91-permissions.rules +++ b/rules/debian/91-permissions.rules @@ -1,4 +1,4 @@ -ACTION!="add", GOTO="permissions_end" +ACTION!="add|change", GOTO="permissions_end" # devices needed to load the drivers providing them KERNEL=="tun", OPTIONS+="ignore_remove" diff --git a/rules/debian/95-late.rules b/rules/debian/95-late.rules index 622e019ef3..1b52c0f002 100644 --- a/rules/debian/95-late.rules +++ b/rules/debian/95-late.rules @@ -14,5 +14,5 @@ ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", \ OPTIONS+="ignore_remove" # debugging monitor -RUN+="socket:/org/kernel/udev/monitor" +RUN+="socket:@/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From f755fd5657b619fd27160ad202fc5d773d096e9c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 2 Aug 2008 10:26:48 +0200 Subject: rules: run vol_id on opticals only if media is found Opening an optical drive device node without O_NONBLOCK autocloses the tray, we run vol_id on every media change by kernel emitted "change" events, which can make it hard to change the media when the tray closes immediatey again.:) We check for cdrom_id to indicate an existing track, if no media is found, we will not open the device with vol_id. Thanks to Christian Krause and DavidZ for debugging and testing. --- rules/rules.d/60-persistent-storage.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 5ae0c7fec9..097e8640c4 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -52,6 +52,8 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA # skip unpartitioned removable media devices from drivers which do not send "change" events ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" +# skip optical drives without media +ENV{DEVTYPE}=="disk", KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}!="?*", GOTO="persistent_storage_end" # import filesystem metadata IMPORT{program}="vol_id --export $tempnode" -- cgit v1.2.3-54-g00ecf From 58a63088871a0b51850351f0217d2f180a440b6c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 2 Aug 2008 10:51:23 +0200 Subject: release 126 --- ChangeLog | 8 +++++++- Makefile.am | 8 ++++++++ NEWS | 10 +++++++--- TODO | 1 - 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1e6afb3224..2c2272ec15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,13 +1,19 @@ Summary of changes from v125 to v126 ============================================ -Kay Sievers (6): +Kay Sievers (9): delete all Makefiles and move udev source to udev/ use autotools rules: mode 0660 for group "disk" rules: update Fedora rules update ChangeLog INSTALL: --enable-selinux not --with-selinux + volume_id: move static lib to $prefix + volume_id: create relative links + rules: run vol_id on opticals only if media is found + +Marco d'Itri (1): + rules: Debian update Thomas Koeller (1): use proper directory lib/lib64 for libvolume_id diff --git a/Makefile.am b/Makefile.am index 60f54ea9e4..ae21bca16c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,3 +40,11 @@ test-install: make DESTDIR=$(PWD)/udev-test-install install tree $(PWD)/udev-test-install/ +git-release: + head -1 ChangeLog | grep -q "to v$(VERSION)" + head -1 NEWS | grep -q "udev $(VERSION)" + git commit -a -m "release $(VERSION)" + cat .git/refs/heads/master > .git/refs/tags/$(VERSION) + git gc + git prune + git-update-server-info diff --git a/NEWS b/NEWS index a7a5579de9..f0615d53b3 100644 --- a/NEWS +++ b/NEWS @@ -16,11 +16,15 @@ options are: --disable-logging disable all logging and compile-out all log strings --with-selinux - link against SELInux libraries to set the expected context + link against SELInux libraries, to set the expected context for created files -No symlinks to udevadm are installed anymore, if still neded, the -package should create them. +In the default rules, the group "disk" gets permissions 0660 instead +of 0640. One small step closer to unify distro rules. Some day, all +distros hopefully end up with the same set of rules. + +No symlinks to udevadm are installed anymore, if they are still needed, +they should be provided by the package. udev 125 ======== diff --git a/TODO b/TODO index 46af966c40..a78e551f11 100644 --- a/TODO +++ b/TODO @@ -4,4 +4,3 @@ These things will change in future udev versions: o --device-id-of-file will print '5:8' instead of '5 8' These things are deprecated and scheduled for removal in a future udev version: - o the installation of symlinks to udevadm -- cgit v1.2.3-54-g00ecf From 6b8c150e12dba22e600da918828b9e648c10018e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Aug 2008 22:36:58 +0200 Subject: add inotify dummy definitions if inotify is not available --- udev/udev_sysdeps.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/udev/udev_sysdeps.h b/udev/udev_sysdeps.h index f08053e5f1..d0e9bfcf2b 100644 --- a/udev/udev_sysdeps.h +++ b/udev/udev_sysdeps.h @@ -41,6 +41,12 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) { return -1; } + +#define IN_CREATE 0 +#define IN_DELETE 0 +#define IN_MOVE 0 +#define IN_CLOSE_WRITE 0 + #endif #ifndef HAVE_STRLCPY -- cgit v1.2.3-54-g00ecf From 72a157b9ad240a075d0a6936168a297df51e3c50 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Aug 2008 22:38:46 +0200 Subject: build: remove autopoint check --- autogen.sh | 6 ------ configure.ac | 9 ++++----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/autogen.sh b/autogen.sh index b01012eb2e..43c763bf2f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,11 +1,5 @@ #!/bin/sh -e -(autopoint --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autopoint installed to generate the build system.." - echo - exit 1 -} (autoconf --version) < /dev/null > /dev/null 2>&1 || { echo echo "You must have autoconf installed to generate the build system." diff --git a/configure.ac b/configure.ac index 0ec8e204e3..8d5228ff91 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,8 @@ -AC_INIT(udev, - 126, - kay.sievers@vrfy.org) - +AC_INIT([udev], + [126], + [kay.sievers@vrfy.org]) AC_PREREQ(2.60) -AC_CONFIG_SRCDIR(udev/udevd.c) +AC_CONFIG_SRCDIR([udev/udevd.c]) AM_INIT_AUTOMAKE([check-news foreign -Wall 1.9 dist-bzip2]) AC_GNU_SOURCE AC_DISABLE_STATIC -- cgit v1.2.3-54-g00ecf From 661c67953de513bbcabc9ed6147801c44846fdbb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Aug 2008 22:39:32 +0200 Subject: udevadm: trigger - add missing attr filter to synthesized "subsystem" register events --- udev/udevtrigger.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev/udevtrigger.c b/udev/udevtrigger.c index d338f82664..19a3dbb10e 100644 --- a/udev/udevtrigger.c +++ b/udev/udevtrigger.c @@ -392,6 +392,8 @@ static void scan_subsystem(const char *subsys, enum scan_type scan) strlcat(dirname, dent->d_name, sizeof(dirname)); if (scan == SCAN_SUBSYSTEM) { + if (attr_filtered(dirname)) + continue; if (!subsystem_filtered("subsystem")) device_list_insert(dirname); if (subsystem_filtered("drivers")) -- cgit v1.2.3-54-g00ecf From 8ef5af2db83cea4b7d2d02f1fed71fca82f9e20d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 9 Aug 2008 14:05:01 +0200 Subject: ignore duplicated rules file names --- udev/udev.xml | 11 +++++++++-- udev/udev_rules_parse.c | 20 +++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index c740c0d807..51e2fdc84e 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -74,8 +74,15 @@ the custom rules directory /etc/udev/rules.d/ and the temporary rules directory /dev/.udev/rules.d/. All rule files are sorted and processed in lexical order, regardless - in which of these directories they live. Every line in the rules file contains at least - one key value pair. There are two kind of keys, match and assignment keys. + in which of these directories they live. + + Rule files are required to have a unique name, duplicate file names + are ignored. Files in /etc/udev/rules.d/ have precedence + over files with the same name in /lib/udev/rules.d/. This + can be used to ignore a default rules file if needed. + + Every line in the rules file contains at least one key value pair. + There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 273f92f486..bf833bae54 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -741,11 +741,8 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) /* custom rules location for testing */ add_matching_files(&name_list, udev_rules_dir, ".rules"); } else { - /* read default rules */ - add_matching_files(&name_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); - /* read user/custom rules */ - add_matching_files(&sort_list, SYSCONFDIR "/udev/rules.d", ".rules"); + add_matching_files(&name_list, SYSCONFDIR "/udev/rules.d", ".rules"); /* read dynamic/temporary rules */ strlcpy(filename, udev_root, sizeof(filename)); @@ -758,6 +755,9 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) } add_matching_files(&sort_list, filename, ".rules"); + /* read default rules */ + add_matching_files(&sort_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); + /* sort all rules files by basename into list of files */ list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) { const char *sort_base = strrchr(sort_loop->name, '/'); @@ -771,10 +771,20 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) if (name_base == NULL) continue; + if (strcmp(name_base, sort_base) == 0) { + info("rule file '%s' already added, ignoring '%s'\n", + name_loop->name, sort_loop->name); + list_del(&sort_loop->node); + free(sort_loop); + sort_loop = NULL; + continue; + } + if (strcmp(name_base, sort_base) > 0) break; } - list_move_tail(&sort_loop->node, &name_loop->node); + if (sort_loop != NULL) + list_move_tail(&sort_loop->node, &name_loop->node); } } -- cgit v1.2.3-54-g00ecf From 88db3905576720349e8bfb1734776c227e6ec3d8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 9 Aug 2008 14:05:54 +0200 Subject: fix .gitignore --- .gitignore | 8 ++++---- TODO | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e96d00e30c..7acc4a688e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,12 @@ *.o *.lo *.la -.libs/ -.deps/ +.libs +.deps Makefile Makefile.in aclocal.m4 -autom4te.cache/ +autom4te.cache config.h config.h.in config.log @@ -20,4 +20,4 @@ missing configure stamp-h1 depcomp -udev-test-install/ +udev-test-install diff --git a/TODO b/TODO index a78e551f11..88d3e59486 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ These things would be nice to have: + o get all distros to agree on a default set of rules These things will change in future udev versions: o --device-id-of-file will print '5:8' instead of '5 8' -- cgit v1.2.3-54-g00ecf From 6c84234d269a0a550476e0bce74646d16db2d669 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 9 Aug 2008 22:06:59 +0200 Subject: rules: delete all distro rules which do not use default rules --- rules/debian/50-udev.rules | 98 ------- rules/debian/60-persistent-input.rules | 41 --- rules/debian/60-persistent-storage-tape.rules | 44 --- rules/debian/60-persistent-storage.rules | 109 -------- rules/debian/60-persistent-v4l.rules | 17 -- rules/debian/75-cd-aliases-generator.rules | 11 - rules/debian/75-persistent-net-generator.rules | 84 ------ rules/debian/80-drivers.rules | 59 ---- rules/debian/91-permissions.rules | 130 --------- rules/debian/95-late.rules | 18 -- rules/frugalware/50-udev-default.rules | 198 -------------- rules/frugalware/64-device-mapper.rules | 15 -- rules/slackware/udev.rules | 355 ------------------------- 13 files changed, 1179 deletions(-) delete mode 100644 rules/debian/50-udev.rules delete mode 100644 rules/debian/60-persistent-input.rules delete mode 100644 rules/debian/60-persistent-storage-tape.rules delete mode 100644 rules/debian/60-persistent-storage.rules delete mode 100644 rules/debian/60-persistent-v4l.rules delete mode 100644 rules/debian/75-cd-aliases-generator.rules delete mode 100644 rules/debian/75-persistent-net-generator.rules delete mode 100644 rules/debian/80-drivers.rules delete mode 100644 rules/debian/91-permissions.rules delete mode 100644 rules/debian/95-late.rules delete mode 100644 rules/frugalware/50-udev-default.rules delete mode 100644 rules/frugalware/64-device-mapper.rules delete mode 100644 rules/slackware/udev.rules diff --git a/rules/debian/50-udev.rules b/rules/debian/50-udev.rules deleted file mode 100644 index 0ac5d8cfbc..0000000000 --- a/rules/debian/50-udev.rules +++ /dev/null @@ -1,98 +0,0 @@ -# import the properties of optical drives -KERNEL=="hd[a-z]|pcd[0-9]*", ACTION=="add|change", DRIVERS=="ide-cdrom|pcd", \ - IMPORT{program}="cdrom_id --export $tempnode" -KERNEL=="sr[0-9]*", ACTION=="add|change", \ - IMPORT{program}="cdrom_id --export $tempnode" - -# workarounds for devices which do not report media changes -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", ATTR{removable}=="1", \ - ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" -SUBSYSTEMS=="scsi", KERNEL=="sd[a-z]", ATTR{removable}=="1", \ - ATTRS{model}=="IOMEGA_ZIP*|ZIP *", OPTIONS+="all_partitions" -SUBSYSTEMS=="ide", KERNEL=="hd[a-z]", \ - ATTRS{media}=="floppy", OPTIONS+="all_partitions" - -# SCSI devices -SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n", SYMLINK+="sr%n" -SUBSYSTEM=="bsg", NAME="bsg/%k" - -# USB devices -SUBSYSTEMS=="usb", KERNEL=="auer[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="cpad[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="dabusb*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="hiddev*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="legousbtower*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="iowarrior[0-9]*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="ttyUSB*", \ - ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", \ - SYMLINK+="pilot" - -# usbfs-like devices -SUBSYSTEM=="usb_device", ACTION=="add|change", \ - PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", ACTION=="add|change", \ - NAME="$result" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" - -# serial devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi[0-9]*", NAME="capi/%n" - -# video devices -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}", ACTION=="add|change", \ - NAME="$result" -KERNEL=="card[0-9]*", NAME="dri/%k" - -# misc devices -KERNEL=="hw_random", NAME="hwrng" -KERNEL=="tun", NAME="net/%k" -KERNEL=="evtchn", NAME="xen/%k" -KERNEL=="rtc0", SYMLINK+="rtc" - -KERNEL=="cdemu[0-9]*", NAME="cdemu/%n" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%n" -KERNEL=="pktcdvd", NAME="pktcdvd/control" - -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode" - -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" -KERNEL=="uverbs*", NAME="infiniband/%k" -KERNEL=="ucm*", NAME="infiniband/%k" -KERNEL=="rdma_cm", NAME="infiniband/%k" - -# ALSA devices -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -# ieee1394 devices -KERNEL=="dv1394*", NAME="dv1394/%n" -KERNEL=="video1394*", NAME="video1394/%n" - -# input devices -KERNEL=="mice", NAME="input/%k" -KERNEL=="mouse[0-9]*", NAME="input/%k" -KERNEL=="event[0-9]*", NAME="input/%k" -KERNEL=="js[0-9]*", NAME="input/%k" -KERNEL=="ts[0-9]*", NAME="input/%k" -KERNEL=="uinput", NAME="input/%k" - -# Zaptel -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="transcode", NAME="zap/transcode" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -# AOE character devices -SUBSYSTEM=="aoe", NAME="etherd/%k" - -KERNEL=="device-mapper", NAME="mapper/control" - diff --git a/rules/debian/60-persistent-input.rules b/rules/debian/60-persistent-input.rules deleted file mode 100644 index 8f49d250b1..0000000000 --- a/rules/debian/60-persistent-input.rules +++ /dev/null @@ -1,41 +0,0 @@ -SUBSYSTEM!="input", GOTO="persistent_input_end" -ACTION!="add|change", GOTO="persistent_input_end" -# ignore the mid-level drivers -KERNEL=="input[0-9]*", GOTO="persistent_input_end" - -# usb devices -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" -SUBSYSTEMS=="usb", \ - ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", \ - ENV{ID_CLASS}="kbd" -SUBSYSTEMS=="usb", \ - ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", \ - ENV{ID_CLASS}="mouse" - -# other devices -DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" -DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" -DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" -ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" -# this means (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH -ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", \ - ATTRS{modalias}!="input:*-*k*14A,*r*", \ - ENV{ID_CLASS}="joystick" - -ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" - -# by-id links, generic and for the event devices -KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ - SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", \ - SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" - -# by-path links -IMPORT{program}="path_id $devpath" -KERNEL=="mouse*|js*", ENV{ID_PATH}=="?*", \ - SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_PATH}=="?*", \ - SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" - -LABEL="persistent_input_end" - diff --git a/rules/debian/60-persistent-storage-tape.rules b/rules/debian/60-persistent-storage-tape.rules deleted file mode 100644 index 94a0b816d4..0000000000 --- a/rules/debian/60-persistent-storage-tape.rules +++ /dev/null @@ -1,44 +0,0 @@ -# This file contains the rules needed to create persistent device names. - -# we are only interested in add and change actions for block devices -ACTION!="add|change", GOTO="persistent_storage_tape_end" - -# "Medium Changers" -KERNEL=="sg[0-9]*", \ - SUBSYSTEMS=="scsi", ATTRS{type}=="8", \ - IMPORT{program}="scsi_id --export --sg-version=3 --whitelisted --device=$tempnode" - -KERNEL=="sg[0-9]*", ATTRS{type}=="8", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" - -SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" - -KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", \ - ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="usb", \ - IMPORT{program}="usb_id --export $devpath" - -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", \ - ENV{BSG_DEV}="$root/bsg/$id" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", \ - WAIT_FOR="$env{BSG_DEV}", \ - ENV{ID_BUS}="scsi", \ - IMPORT{program}="scsi_id --export --device=$env{BSG_DEV}" - -KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" - -KERNEL=="st*[0-9]|nst*[0-9]", \ - IMPORT{program}="path_id $devpath" -KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", \ - SYMLINK+="tape/by-path/$env{ID_PATH}-nst" - -# end of processing -LABEL="persistent_storage_tape_end" - diff --git a/rules/debian/60-persistent-storage.rules b/rules/debian/60-persistent-storage.rules deleted file mode 100644 index 65e7204531..0000000000 --- a/rules/debian/60-persistent-storage.rules +++ /dev/null @@ -1,109 +0,0 @@ -# This file contains the rules needed to create persistent device names. - -# forward scsi device events to the corresponding block device -ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", \ - TEST=="block", ATTR{block/*/uevent}="change" - -# we are only interested in add and change actions for block devices -ACTION!="add|change", GOTO="persistent_storage_end" -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# and we can safely ignore these kinds of devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" - -# skip removable ide devices, because open(2) on them causes an events loop -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", \ - GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", ATTRS{removable}=="1", \ - GOTO="persistent_storage_end" - -# ignore partitions that span the entire disk -TEST=="whole_disk", GOTO="persistent_storage_end" - -# skip xen virtual hard disks -DRIVERS=="vbd", GOTO="no_hardware_id" - -# check these attributes of /sys/class/block nodes -ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" -ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" - -# look for different kinds of unique identificators -KERNEL=="hd*[!0-9]", \ - IMPORT{program}="ata_id --export $tempnode" - -KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", \ - ENV{ID_BUS}="ieee1394", ENV{ID_SERIAL}="$attr{ieee1394_id}" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ - SUBSYSTEMS=="usb", \ - IMPORT{program}="usb_id --export $devpath" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", \ - ENV{ID_BUS}="scsi", \ - IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" -KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", \ - ENV{ID_BUS}="cciss", \ - IMPORT{program}="scsi_id --export --whitelisted --device=$tempnode" - -KERNEL=="dasd*[!0-9]", \ - IMPORT{program}="dasd_id --export $tempnode" - -KERNEL=="sd*[!0-9]|hd*[!0-9]", \ - IMPORT{program}="edd_id --export $tempnode" - -KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", \ - PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result" - -# find the physical path of the device -ENV{DEVTYPE}=="disk", IMPORT{program}="path_id $devpath" - -LABEL="no_hardware_id" - -# import the variables of partitions from the parent disks -ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" - -# obsolete PATA driver -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -# hd*-like compatibility links for libata and PATA devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_ATA_COMPAT}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" -KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", \ - SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" - -KERNEL=="mmcblk[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ - ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ - SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mmcblk[0-9]p[0-9]", ATTR{name}=="?*", ATTR{serial}=="?*", \ - ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", \ - SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" - -ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", \ - SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -KERNEL=="sd*[!0-9]|sr*|dasd[!0-9]*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|dasd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", \ - SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", \ - SYMLINK+="disk/by-path/$env{ID_PATH}" -ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", \ - SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# skip unpartitioned removable media devices from drivers which do not send -# "change" events -ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", \ - GOTO="persistent_storage_end" - -# UUID and volume label -IMPORT{program}="vol_id --export $tempnode" -ENV{ID_FS_UUID_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other|crypto", \ - SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_LABEL_ENC}=="?*", ENV{ID_FS_USAGE}=="filesystem|other", \ - SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="persistent_storage_end" - diff --git a/rules/debian/60-persistent-v4l.rules b/rules/debian/60-persistent-v4l.rules deleted file mode 100644 index 5a317b6c18..0000000000 --- a/rules/debian/60-persistent-v4l.rules +++ /dev/null @@ -1,17 +0,0 @@ -ACTION!="add|change", GOTO="persistent_v4l_end" -SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" - -# ignore devices without a valid "index" number -TEST!="index", GOTO="persistent_v4l_end" -ATTR{index}!="?*", GOTO="persistent_v4l_end" - -IMPORT{program}="path_id $devpath" - -KERNEL=="video*|vbi*", ENV{ID_PATH}=="?*", \ - SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" - -KERNEL=="audio*", ENV{ID_PATH}=="?*", \ - SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" - -LABEL="persistent_v4l_end" - diff --git a/rules/debian/75-cd-aliases-generator.rules b/rules/debian/75-cd-aliases-generator.rules deleted file mode 100644 index 6b178a0ae7..0000000000 --- a/rules/debian/75-cd-aliases-generator.rules +++ /dev/null @@ -1,11 +0,0 @@ -# These rules generate rules for the /dev/{cdrom,dvd,...} symlinks and -# write them to /etc/udev/rules.d/70-persistent-cd.rules. - -ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ - SUBSYSTEMS!="usb|ieee1394", \ - PROGRAM="write_cd_rules", SYMLINK+="$result" - -ACTION=="add", SUBSYSTEM=="block", ENV{GENERATED}!="?*", ENV{ID_CDROM}=="?*", \ - SUBSYSTEMS=="usb|ieee1394", \ - PROGRAM="write_cd_rules by-id", SYMLINK+="$result" - diff --git a/rules/debian/75-persistent-net-generator.rules b/rules/debian/75-persistent-net-generator.rules deleted file mode 100644 index 9fdf106045..0000000000 --- a/rules/debian/75-persistent-net-generator.rules +++ /dev/null @@ -1,84 +0,0 @@ -# These rules generate rules to keep network interface names unchanged -# across reboots and write them to /etc/udev/rules.d/70-persistent-net.rules. - -# variables used to communicate: -# MATCHADDR MAC address used for the match -# MATCHID bus_id used for the match -# MATCHDRV driver name used for the match -# MATCHIFTYPE interface type match -# COMMENT comment to add to the generated rule -# INTERFACE_NAME requested name supplied by external tool -# INTERFACE_NEW new interface name returned by rule writer - -ACTION!="add", GOTO="persistent_net_generator_end" -SUBSYSTEM!="net", GOTO="persistent_net_generator_end" - -# ignore the interface if a name has already been set -NAME=="?*", GOTO="persistent_net_generator_end" - -# device name whitelist -KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ - GOTO="persistent_net_generator_end" - -# ignore Xen virtual interfaces -SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" - -# ignore UML virtual interfaces -DRIVERS=="uml-netdev", GOTO="persistent_net_generator_end" - -# ignore "secondary" raw interfaces of the madwifi driver -KERNEL=="ath*", ATTRS{type}=="802", GOTO="persistent_net_generator_end" - -# ignore "secondary" monitor interfaces of mac80211 drivers -KERNEL=="wlan*", ATTRS{type}=="803", GOTO="persistent_net_generator_end" - -# by default match on the MAC address and interface type -ENV{MATCHADDR}="$attr{address}" -ENV{MATCHIFTYPE}="$attr{type}" - -# ignore interfaces with locally administered or null MAC addresses -# and VMWare virtual interfaces -ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" -ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" -ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", ENV{MATCHADDR}="" - -# ibmveth interfaces have stable locally administered MAC addresses -SUBSYSTEMS=="ibmveth", ENV{MATCHADDR}="$attr{address}" - -# S/390 interfaces are matched only by id -SUBSYSTEMS=="ccwgroup", \ - ENV{MATCHDRV}="$driver", ENV{MATCHID}="$id", ENV{MATCHADDR}="" - -# terminate processing if there are not enough conditions to create a rule -ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", \ - GOTO="persistent_net_generator_end" - - -# provide nice comments for the generated rules -SUBSYSTEMS=="pci", \ - ENV{COMMENT}="PCI device $attr{vendor}:$attr{device}" -SUBSYSTEMS=="pcmcia", \ - ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id}" -SUBSYSTEMS=="usb", \ - ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct}" -SUBSYSTEMS=="ccwgroup", \ - ENV{COMMENT}="S/390 device at $id" -SUBSYSTEMS=="ibmveth", \ - ENV{COMMENT}="LPAR virtual device at $id" -SUBSYSTEMS=="ieee1394", \ - ENV{COMMENT}="Firewire device $attr{host_id}" -ENV{COMMENT}=="", \ - ENV{COMMENT}="Unknown $env{SUBSYSTEM} device ($env{DEVPATH})" -ATTRS{driver}=="?*", \ - ENV{COMMENT}="$env{COMMENT} ($attr{driver})" - - -# ignore interfaces without a driver link like bridges and VLANs, otherwise -# generate and write the rule -DRIVERS=="?*", IMPORT{program}="write_net_rules" - -# rename the interface if requested -ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" - -LABEL="persistent_net_generator_end" - diff --git a/rules/debian/80-drivers.rules b/rules/debian/80-drivers.rules deleted file mode 100644 index 417bfd5de4..0000000000 --- a/rules/debian/80-drivers.rules +++ /dev/null @@ -1,59 +0,0 @@ -ACTION!="add", GOTO="hotplug_not_add_event" - -# check if the device has already been claimed by a driver -ENV{DRIVER}=="?*", SUBSYSTEM!="input", GOTO="hotplug_driver_loaded" - -# this driver is broken and should not be loaded automatically on kernels -# < 2.6.21 (see #398962) -SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", GOTO="hotplug_driver_loaded" - -# load the drivers -ENV{MODALIAS}=="?*", \ - RUN+="/sbin/modprobe --use-blacklist $env{MODALIAS}" - -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ - RUN+="/bin/sh -c '/sbin/modprobe --use-blacklist --all $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" - -SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" - -# rules for subsystems which lack proper hotplug support -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" -SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe tifm_ms" - -# needed for kernels < 2.6.22 -SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe osst", \ - ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ - ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*" -SUBSYSTEM=="scsi_device", ATTRS{type}=="1", RUN+="/sbin/modprobe st", \ - ATTRS{vendor}!="Onstream" -SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ATTRS{type}=="8", RUN+="/sbin/modprobe ch" - -SUBSYSTEM=="scsi_device", ATTRS{type}=="[235689]", TEST!="[module/sg]", \ - RUN+="/sbin/modprobe sg" - -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" - -# From here on follows the hotplug agents which do not load modules -LABEL="hotplug_driver_loaded" - -# FIXME: does a sane default exist? -#SUBSYSTEM=="scsi_device", ATTRS{idVendor}=="...", \ -# RUN+="scsi-re-add" - -SUBSYSTEM=="firmware", RUN+="firmware.agent" - -LABEL="hotplug_not_add_event" - -SUBSYSTEM=="net", RUN+="net.agent" - -SUBSYSTEM=="atm", RUN+="dsl-modem.agent" - -# Log every event to /dev/hotplug.log (for debugging). -#RUN+="logger.agent" - diff --git a/rules/debian/91-permissions.rules b/rules/debian/91-permissions.rules deleted file mode 100644 index 3270d41aa3..0000000000 --- a/rules/debian/91-permissions.rules +++ /dev/null @@ -1,130 +0,0 @@ -ACTION!="add|change", GOTO="permissions_end" - -# devices needed to load the drivers providing them -KERNEL=="tun", OPTIONS+="ignore_remove" -KERNEL=="ppp", OPTIONS+="ignore_remove" -KERNEL=="loop[0-9]*", OPTIONS+="ignore_remove" - -# default permissions for block devices -SUBSYSTEM=="block", GROUP="disk" -# the aacraid driver is broken and reports that disks removable (see #404927) -SUBSYSTEM=="block", ATTRS{removable}=="1", \ - DRIVERS!="aacraid", GROUP="floppy" -# all block devices on these buses are "removable" -SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394|mmc|pcmcia", GROUP="floppy" - -KERNEL=="cbm", GROUP="floppy" - -# IDE devices -ENV{ID_CDROM}=="?*", GROUP="cdrom" -KERNEL=="ht[0-9]*", GROUP="tape" -KERNEL=="nht[0-9]*", GROUP="tape" - -# SCSI devices -SUBSYSTEMS=="scsi", ATTRS{type}=="1", GROUP="tape" -SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="HP", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="Epson", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="3", ATTRS{vendor}=="EPSON", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="4", GROUP="cdrom" -SUBSYSTEMS=="scsi", ATTRS{type}=="5", GROUP="cdrom" -SUBSYSTEMS=="scsi", ATTRS{type}=="6", GROUP="scanner" -SUBSYSTEMS=="scsi", ATTRS{type}=="8", GROUP="tape" - -# USB devices -KERNEL=="legousbtower*", MODE="0666" -KERNEL=="lp[0-9]*", SUBSYSTEMS=="usb", GROUP="lp" - -# usbfs-like devices -SUBSYSTEM=="usb_device", MODE="0664" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", \ - MODE="0664" - -# iRiver music players -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="plugdev", \ - ATTRS{idVendor}=="4102", ATTRS{idProduct}=="10[01][135789]" - -# serial devices -SUBSYSTEM=="tty", GROUP="dialout" -SUBSYSTEM=="capi", GROUP="dialout" -SUBSYSTEM=="slamr", GROUP="dialout" -SUBSYSTEM=="zaptel", GROUP="dialout" - -# vc devices (all members of the tty subsystem) -KERNEL=="ptmx", MODE="0666", GROUP="root" -KERNEL=="console", MODE="0600", GROUP="root" -KERNEL=="tty", MODE="0666", GROUP="root" -KERNEL=="tty[0-9]*", GROUP="root" -KERNEL=="pty*", MODE="0666", GROUP="tty" - -# video devices -SUBSYSTEM=="video4linux", GROUP="video" -SUBSYSTEM=="drm", GROUP="video" -SUBSYSTEM=="dvb", GROUP="video" -SUBSYSTEM=="em8300", GROUP="video" -SUBSYSTEM=="graphics", GROUP="video" -SUBSYSTEM=="nvidia", GROUP="video" - -# misc devices -KERNEL=="random", MODE="0666" -KERNEL=="urandom", MODE="0666" -KERNEL=="mem", MODE="0640", GROUP="kmem" -KERNEL=="kmem", MODE="0640", GROUP="kmem" -KERNEL=="port", MODE="0640", GROUP="kmem" -KERNEL=="full", MODE="0666" -KERNEL=="null", MODE="0666" -KERNEL=="zero", MODE="0666" -KERNEL=="inotify", MODE="0666" -KERNEL=="sonypi", MODE="0666" -KERNEL=="agpgart", GROUP="video" -KERNEL=="nvram", GROUP="nvram" -KERNEL=="rtc|rtc[0-9]*", GROUP="audio" -KERNEL=="tpm*", MODE="0600", OWNER="tss", GROUP="tss" -KERNEL=="fuse", GROUP="fuse" -KERNEL=="kqemu", MODE="0666" -KERNEL=="kvm", GROUP="kvm" -KERNEL=="tun", MODE="0666" - -KERNEL=="cdemu[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd", MODE="0644" - -KERNEL=="uverbs*", GROUP="rdma" -KERNEL=="ucm*", GROUP="rdma" -KERNEL=="rdma_cm", GROUP="rdma" - -# printers and parallel devices -SUBSYSTEM=="printer", GROUP="lp" -SUBSYSTEM=="ppdev", GROUP="lp" -KERNEL=="irlpt*", GROUP="lp" -KERNEL=="pt[0-9]*", GROUP="tape" -KERNEL=="pht[0-9]*", GROUP="tape" - -# sound devices -SUBSYSTEM=="sound", GROUP="audio" - -# ieee1394 devices -KERNEL=="raw1394", GROUP="disk" -KERNEL=="dv1394*", GROUP="video" -KERNEL=="video1394*", GROUP="video" - -# input devices -KERNEL=="event[0-9]*", ATTRS{name}=="*dvb*|*DVB*|* IR *" \ - MODE="0664", GROUP="video" -KERNEL=="js[0-9]*", MODE="0664" -KERNEL=="event[0-9]*", ENV{ID_CLASS}=="joystick", \ - MODE="0664", GROUP="audio" -KERNEL=="lirc[0-9]*", GROUP="video" - -KERNEL=="sgi_*", MODE="0666" -KERNEL=="z90crypt", MODE="0666" -KERNEL=="iseries/ibmsis*", GROUP="disk" -KERNEL=="iseries/nvt*", GROUP="disk" -KERNEL=="iseries/vt*", GROUP="disk" -KERNEL=="iseries/vtty*", GROUP="dialout" - -# AOE character devices -SUBSYSTEM=="aoe", MODE="0220", GROUP="disk" -SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440", GROUP="disk" - -LABEL="permissions_end" - diff --git a/rules/debian/95-late.rules b/rules/debian/95-late.rules deleted file mode 100644 index 1b52c0f002..0000000000 --- a/rules/debian/95-late.rules +++ /dev/null @@ -1,18 +0,0 @@ -# run a command on remove events -ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" - -# ignore the events generated by virtual consoles -KERNEL=="ptmx", OPTIONS+="last_rule" -KERNEL=="console", OPTIONS+="last_rule" -KERNEL=="tty" , OPTIONS+="last_rule" -KERNEL=="tty[0-9]*", OPTIONS+="last_rule" -KERNEL=="pty*", OPTIONS+="last_rule" -SUBSYSTEM=="vc", OPTIONS+="last_rule" - -# do not delete static device nodes -ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", \ - OPTIONS+="ignore_remove" - -# debugging monitor -RUN+="socket:@/org/kernel/udev/monitor" - diff --git a/rules/frugalware/50-udev-default.rules b/rules/frugalware/50-udev-default.rules deleted file mode 100644 index 89ffd7b442..0000000000 --- a/rules/frugalware/50-udev-default.rules +++ /dev/null @@ -1,198 +0,0 @@ -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# See the udev.rules.examples file for more examples of how to create rules -# - -# permissions for IDE CD devices -SUBSYSTEMS=="ide", KERNEL=="*[!0-9]", PROGRAM="/bin/cat /proc/ide/%k/media", RESULT=="cdrom*", NAME="%k", GROUP="cdrom", MODE="0660" - -# permissions for SCSI cd/sg/tape devices -SUBSYSTEMS=="scsi", KERNEL=="s[grt][0-9]*", ATTRS{type}=="5", NAME="%k", GROUP="cdrom", MODE="0660" - -# USB devices -KERNEL=="hiddev*", NAME="usb/%k" -KERNEL=="auer*", NAME="usb/%k" -KERNEL=="legousbtower*", NAME="usb/%k" -KERNEL=="dabusb*", NAME="usb/%k" -SUBSYSTEMS=="usb", KERNEL=="lp[0-9]*", NAME="usb/%k", GROUP="lp" - -# CAPI devices -KERNEL=="capi", NAME="capi20", SYMLINK="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# Network devices -KERNEL=="tun", NAME="net/%k" - -# permissions -KERNEL=="pl2303", NAME="%k", OWNER="500", GROUP="500", MODE="0666" -KERNEL=="visor", NAME="%k", OWNER="root", GROUP="uucp", MODE="0666" -KERNEL=="camera*", NAME="%k", OWNER="root", GROUP="camera", MODE="0666" - -# console devices -KERNEL=="console", NAME="%k", OWNER="root", GROUP="tty", MODE="0600" -KERNEL=="tty", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="tty[0-9]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" -KERNEL=="vcs*", NAME="%k", OWNER="root", GROUP="tty", MODE="0620" -KERNEL=="tty[CIS]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" -KERNEL=="ttyUB[0-9]", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB0", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" -KERNEL=="ttyUSB1", NAME="%k", OWNER="root" GROUP="uucp", MODE="0666" - -# pty devices -KERNEL=="ptmx", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="pty[p-za-e][0-9a-f]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="tty[p-za-e][0-9a-f]*", NAME="%k", OWNER="root", GROUP="tty", MODE="0666" -KERNEL=="cu[abiu]*", NAME="%k", OWNER="root", GROUP="uucp", MODE="0660" - -# sound devices -KERNEL=="audio*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="beep", NAME="%k", OWNER="root", GROUP="audio", MODE="0644" -KERNEL=="dsp*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="midi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="mixer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="music", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="sequencer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="controlC[0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="hw[CD0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="pcm[CD0-9cp]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="midiC[D0-9]*", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="timer", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="seq", NAME="snd/%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="sndstat", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="speaker", NAME="%k", OWNER="root", GROUP="audio", MODE="0644" -KERNEL=="sound/*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="admmidi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="adsp*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="aload*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="amidi*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" -KERNEL=="amixer*", NAME="%k", OWNER="root", GROUP="audio", MODE="0666" - -# input devices (mouse, joystick, etc) -KERNEL=="mice", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="mouse*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="event*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="js*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="ts*", NAME="input/%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="input/js*", NAME="%k", OWNER="root", GROUP="games",0 MODE="0666" -KERNEL=="djs[0-3]", NAME="%k", OWNER="root", GROUP="games", MODE="0660" -KERNEL=="psaux", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="crash", NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="logibm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="jbm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="hwtrap", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="inportbm", NAME="%k", OWNER="root", GROUP="sys", MODE="0660" -KERNEL=="sexec", NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="jsflash", NAME="%k", OWNER="root", GROUP="root", MODE="0660" - -# power manager device -KERNEL=="apm_bios", NAME="%k", OWNER="root", GROUP="root", MODE="0644" - -# printer device -KERNEL=="lp[0-9]", NAME="%k", OWNER="root", GROUP="lp", MODE="0660" -KERNEL=="parport*", NAME="%k", OWNER="root", GROUP="lp", MODE="0660" - -# video devices -KERNEL=="card*", NAME="dri/card%n", OWNER="root", GROUP="video", MODE="0666" -KERNEL=="fb[0-9]", NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="agpgart", NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="nvidia*", NAME="%k", OWNER="root", GROUP="video", MODE="0666" -KERNEL=="video*", NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="vbi*", NAME="%k", OWNER="root", GROUP="video", MODE="0660" -KERNEL=="dvb*", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; A=$${K%%%%.*}; D=$${K#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video", MODE="0660" - -# DISK devices -KERNEL=="ed[ab]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="gscd0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="initrd", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="lmscd", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="mcd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="md*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="mtd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="userdma", NAME="%k", OWNER="root", GROUP="root", MODE="0660" - -# floppy devices -KERNEL=="fd[0-3]*", NAME="%k", OWNER="root", GROUP="floppy", MODE="0660" -KERNEL=="fd0", SYMLINK="floppy" - -# permissions for removable devices like cardreaders or sticks -KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="0", NAME="%k", GROUP="storage" - -# permissions for firewire external drives -KERNEL=="sd*", ATTRS{scsi_level}=="5", NAME="%k", GROUP="storage" - -# permissions for usb to scsi external adapters -KERNEL=="sd*", ATTRS{scsi_level}=="3", ATTRS{type}=="7", NAME="%k", GROUP="storage" - -# IDE devices (hd, cdrom) -KERNEL=="hd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="ht0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" - -# RAID IDE -KERNEL=="ataraid[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="ataraid/*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" - -# SCSI devices -KERNEL=="scsi/*/cd", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="scsi/*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="sd[a-h]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="s[rt][0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="scd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" - -# generic scsi devices -KERNEL=="sg*", NAME="%k", OWNER="root", GROUP="root", MODE="0600" - -# old CD-ROM -KERNEL=="sbpcd*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" - -# loop devices -KERNEL=="loop[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" - -# network block devices -KERNEL=="nb[0-7]", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="nht0", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="npt[0-3]", NAME="%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="n[qrs]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" - -# memory access devices -KERNEL=="kmem", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL=="mem", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL=="null", NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL=="nvram", NAME="%k", OWNER="root", GROUP="root", MODE="0640" -KERNEL=="port", NAME="%k", OWNER="root", GROUP="kmem", MODE="0640" -KERNEL=="ram[0-9]*", NAME="%k", OWNER="root", GROUP="disk", MODE="0640" -KERNEL=="random", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="rtc", NAME="%k", OWNER="root", GROUP="root", MODE="0444" -KERNEL=="urandom", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="full", NAME="%k", OWNER="root", GROUP="sys", MODE="0666" -KERNEL=="zero", NAME="%k", OWNER="root", GROUP="root", MODE="0666" -KERNEL=="raw[0-9]*", NAME="raw/%k", OWNER="root", GROUP="disk", MODE="0660" -KERNEL=="modreq", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="msr", NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="profile*", NAME="%k", OWNER="root", GROUP="root", MODE="0640" - -# ISDN devices -KERNEL=="isdn*", NAME="%k", OWNER="root", GROUP="tty", MODE="0660" - -# net devices -KERNEL=="ippp*", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="ipstate*", NAME="%k", OWNER="root", GROUP="root", MODE="0660" -KERNEL=="spx", NAME="%k", OWNER="root", GROUP="root", MODE="0644" -KERNEL=="fwmonitor*", NAME="%k", OWNER="root", GROUP="root", MODE="0660" - -# hotplug rules - module autoloading for different buses -ACTION=="add", SUBSYSTEM=="pci", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" -ACTION=="add", SUBSYSTEM=="usb", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="*", RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" -ACTION=="add", SUBSYSTEM=="ieee1394", ENV{MODALIAS}=="*", RUN+="/sbin/modprobe $env{MODALIAS}" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[07]", RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="14", RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[45]", RUN+="/sbin/modprobe sr_mod" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}=="Onstream", ATTRS{model}=="ADR*", RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="1", ATTRS{vendor}!="Onstream", RUN+="/sbin/modprobe st" -ACTION=="add", SUBSYSTEM=="scsi", ATTRS{type}=="[23689]", RUN+="/sbin/modprobe sg" - -# firmware -ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN+="/lib/udev/firmware.sh" diff --git a/rules/frugalware/64-device-mapper.rules b/rules/frugalware/64-device-mapper.rules deleted file mode 100644 index 3837d3f2c7..0000000000 --- a/rules/frugalware/64-device-mapper.rules +++ /dev/null @@ -1,15 +0,0 @@ -# device mapper links hook into "online" event, when the dm table -# is available, while some table types must be ignored - -KERNEL=="dm-*", ACTION=="add|online", GOTO="device_mapper_do" -GOTO="device_mapper_end" - -LABEL="device_mapper_do" -PROGRAM!="/sbin/dmsetup status -j %M -m %m", GOTO="device_mapper_end" -RESULT=="|*snapshot*|*error*", GOTO="device_mapper_end" - -IMPORT{program}="/sbin/vol_id --export $tempnode" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -LABEL="device_mapper_end" diff --git a/rules/slackware/udev.rules b/rules/slackware/udev.rules deleted file mode 100644 index 12dac4d84d..0000000000 --- a/rules/slackware/udev.rules +++ /dev/null @@ -1,355 +0,0 @@ -# /etc/udev/udev.rules: device naming rules for udev -# -# There are a number of modifiers that are allowed to be used in some of the -# fields. See the udev man page for a full description of them. -# -# This rules file is a mix of 10.2 Slackware udev.rules file and some -# rules from the udev examples. -# - -# wait for sysfs -ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt" -ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" - -# all block devices -SUBSYSTEM=="block", GROUP="disk" - -# permissions for IDE CD devices (without symbolic link creation) -BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660" - -# permissions for IDE CD devices (with symbolic link creation) -# THIS RULE COMMENTED OUT BY DEFAULT: read /lib/udev/rc.optical-symlinks for more information... -#BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-cdrom", NAME="%k", GROUP="cdrom", MODE="0660", RUN+="/lib/udev/cdrom-symlinks.sh %k" - -# permissions for IDE floppy devices -BUS=="ide", KERNEL=="*[!0-9]", ENV{PHYSDEVDRIVER}=="ide-floppy*", NAME="%k", GROUP="floppy", MODE="0660" - -# permissions for SCSI cd/sg/tape devices -BUS=="scsi", KERNEL=="s[grt][0-9]*", SYSFS{type}=="5", NAME="%k", GROUP="cdrom", MODE="0660" - -# load modules to scsi disks, if they aren't in kernel -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", SYSFS{device/vendor}=="On[sS]tream", RUN+="/sbin/modprobe osst" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="1", RUN+="/sbin/modprobe st" -SUBSYSTEM=="scsi_device", ACTION=="add", SYSFS{device/type}=="[45]", RUN+="/sbin/modprobe sr_mod" -SUBSYSTEM=="scsi_device", ACTION=="add", RUN+="/sbin/modprobe sg" - -# disk devices -KERNEL=="sd*", NAME="%k", GROUP="disk" -KERNEL=="dasd*", NAME="%k", GROUP="disk" -KERNEL=="ataraid*", NAME="%k", GROUP="disk" - -# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} - -ACTION!="add", GOTO="persistent_end" -SUBSYSTEM!="block", GOTO="persistent_end" - -# skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*", GOTO="persistent_end" - -# never access removable ide devices, the drivers are causing event loops on open() -BUS=="ide", DRIVER!="ide-cdrom", SYSFS{removable}=="1", GOTO="persistent_end" - -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="/lib/udev/ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", IMPORT{parent}=="ID_*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" - -KERNEL=="sd*[!0-9]|sr*", SYSFS{ieee1394_id}=="*", ENV{ID_SERIAL}="$sysfs{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode" -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode" -KERNEL=="dasd*[!0-9]", IMPORT{program}="/lib/udev/dasd_id --export $tempnode" -KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -# for partitions import parent information -KERNEL=="sd*[0-9]|dasd*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="sd*[0-9]|dasd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# by-path (shortest physical path) -KERNEL=="*[!0-9]|sr*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="disk/by-path/$env{ID_PATH}" -KERNEL=="st*", ENV{ID_TYPE}=="?*", IMPORT{program}="/lib/udev/path_id %p", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="sr*|st*", GOTO="persistent_end" -KERNEL=="*[0-9]", IMPORT{parent}=="ID_*" -KERNEL=="*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# by-label/by-uuid (filesystem properties) -KERNEL=="*[!0-9]", SYSFS{removable}=="1", GOTO="persistent_end" -IMPORT{program}="/lib/udev/vol_id --export $tempnode" -ENV{ID_FS_UUID}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID}" -ENV{ID_FS_LABEL_SAFE}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_SAFE}" - -# BIOS Enhanced Disk Device -KERNEL=="*[!0-9]", IMPORT{program}="/lib/udev/edd_id --export $tempnode" -KERNEL=="*[!0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -KERNEL=="*[0-9]", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -# LVM2 dmsetup -KERNEL=="dm-[0-9]*", ACTION=="add", PROGRAM="/sbin/dmsetup info -c --noopencount --noheadings -o name -j %M -m %m", SYMLINK+="disk/by-name/%c" - -LABEL="persistent_end" - -# ALSA devices -SUBSYSTEM=="sound", GROUP="audio" -SUBSYSTEM=="snd", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k", MODE="0666" -KERNEL=="hw[CD0-9]*", NAME="snd/%k", MODE="0662" -KERNEL=="pcm[CD0-9]*c", NAME="snd/%k", MODE="0662" -KERNEL=="pcm[CD0-9]*p", NAME="snd/%k", MODE="0666" -KERNEL=="midiC[D0-9]*", NAME="snd/%k", MODE="0666" -KERNEL=="timer", NAME="snd/%k", MODE="0666" -KERNEL=="seq", NAME="snd/%k", MODE="0666" - -# IEEE1394 raw devices (often used for video) -KERNEL=="raw1394", NAME="%k", GROUP="video" -KERNEL=="dv1394*", NAME="dv1394/%n", GROUP="video" -KERNEL=="video1394*", NAME="video1394/%n", GROUP="video" - -# capi devices -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" - -# cpu devices -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode" - -# dm devices (ignore them) -KERNEL=="dm-[0-9]*", NAME="" -# create a symlink named after the device map name -# note devmap_name comes with extras/multipath -#KERNEL=="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK+="%c" -KERNEL=="device-mapper", NAME="mapper/control" - - -# floppy devices -KERNEL=="fd[0-9]*", NAME="floppy/%n", SYMLINK+="%k", GROUP="floppy", PROGRAM="/lib/udev/floppy-extra-devs.sh %k %b %n" - -# i2c devices -KERNEL=="i2c-[0-9]*", NAME="i2c/%n", SYMLINK+="%k" - -# input devices -KERNEL=="mice", NAME="input/%k", MODE="0644", SYMLINK+="mouse" -KERNEL=="mouse*", NAME="input/%k", MODE="0644" -KERNEL=="event*", NAME="input/%k", MODE="0640" -KERNEL=="js*", NAME="input/%k", MODE="664" -KERNEL=="ts*", NAME="input/%k", MODE="0600" -SUBSYSTEM=="input[0-9]*", RUN+="/lib/udev/input_device.sh" -KERNEL=="input[0-9]*", ACTION=="add", ENV{ABS}=="[1-9]*", RUN+="/sbin/modprobe joydev" - -# loop devices -KERNEL=="loop[0-9]*", NAME="loop/%n", SYMLINK+="%k", GROUP="disk" - -# md block devices -KERNEL=="md[0-9]*", NAME="md/%n", SYMLINK+="%k", GROUP="disk" - -# aoe char devices, -SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" -SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" - -# netlink devices -KERNEL=="route", NAME="netlink/%k" -KERNEL=="skip", NAME="netlink/%k" -KERNEL=="usersock", NAME="netlink/%k" -KERNEL=="fwmonitor", NAME="netlink/%k" -KERNEL=="tcpdiag", NAME="netlink/%k" -KERNEL=="nflog", NAME="netlink/%k" -KERNEL=="xfrm", NAME="netlink/%k" -KERNEL=="arpd", NAME="netlink/%k" -KERNEL=="route6", NAME="netlink/%k" -KERNEL=="ip6_fw", NAME="netlink/%k" -KERNEL=="dnrtmsg", NAME="netlink/%k" -KERNEL=="tap*", NAME="netlink/%k" - -# ramdisk devices -KERNEL=="ram[0-9]*", NAME="rd/%n", SYMLINK+="%k" - -# raw devices -KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL=="ram*", NAME="%k", GROUP="disk" - -# sound devices -KERNEL=="adsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="adsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="audio", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="audio[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="dsp", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="dsp[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="mixer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="mixer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="sequencer", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" -KERNEL=="sequencer[0-9]*", NAME="sound/%k", SYMLINK+="%k", GROUP="audio", MODE="0662" - -# tty devices -KERNEL=="console", NAME="%k", GROUP="tty", MODE="0600" -KERNEL=="tty", NAME="%k", GROUP="tty", MODE="0666" -KERNEL=="tty[0-9]*", NAME="vc/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="ttyS[0-9]*", NAME="tts/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="ttyUSB[0-9]*", NAME="tts/USB%n", GROUP="tty", MODE="0660" -KERNEL=="ippp0", NAME="%k", GROUP="tty" -KERNEL=="isdn*", NAME="%k", GROUP="tty" -KERNEL=="dcbri*", NAME="%k", GROUP="tty" -KERNEL=="ircomm*", NAME="%k", GROUP="tty" - -# pty devices -KERNEL=="ptmx", NAME="%k", GROUP="tty", MODE="0666" -KERNEL=="pty[p-za-e][0-9a-f]*", NAME="pty/m%m", SYMLINK+="%k", GROUP="tty" -KERNEL=="tty[p-za-e][0-9a-f]*", NAME="pty/s%m", SYMLINK+="%k", GROUP="tty" - -# vc devices -KERNEL=="vcs", NAME="vcc/0", SYMLINK+="%k", GROUP="tty" -KERNEL=="vcs[0-9]*", NAME="vcc/%n", SYMLINK+="%k", GROUP="tty" -KERNEL=="vcsa", NAME="vcc/a0", SYMLINK+="%k", GROUP="tty" -KERNEL=="vcsa[0-9]*", NAME="vcc/a%n", SYMLINK+="%k", GROUP="tty" - -# memory devices -KERNEL=="random", NAME="%k", MODE="0664" -KERNEL=="urandom", NAME="%k", MODE="0664" -KERNEL=="mem", NAME="%k", GROUP="kmem", MODE="0640" -KERNEL=="kmem", NAME="%k", GROUP="kmem", MODE="0640" -KERNEL=="port", NAME="%k", GROUP="kmem", MODE="0640" -KERNEL=="nvram", NAME="%k", GROUP="kmem", MODE="600" -KERNEL=="full", NAME="%k", MODE="0666" -KERNEL=="null", NAME="%k", MODE="0666" -KERNEL=="zero", NAME="%k", MODE="0666" - -# misc devices -KERNEL=="agpgart", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="psaux", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="rtc", NAME="misc/%k", SYMLINK+="%k", MODE="0664" -KERNEL=="uinput", NAME="misc/%k", SYMLINK+="%k" -KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666" - -# usb devices -KERNEL=="hiddev*", NAME="usb/%k" -KERNEL=="auer*", NAME="usb/%k" -KERNEL=="legousbtower*", NAME="usb/%k" -KERNEL=="dabusb*", NAME="usb/%k" - -# fb devices -KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video" - -# DRI devices -KERNEL=="card*", NAME="dri/card%n", GROUP="video" -KERNEL=="nvidia*", NAME="%k", GROUP="video" -KERNEL=="3dfx*", NAME="%k", GROUP="video" - -# v4l devices -KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="video%n", GROUP="video" -KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="radio%n", GROUP="video" -KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="vbi%n", GROUP="video" -KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" - -# dvb devices -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'X=%k; X=$${X#dvb}; A=$${X%%%%.*}; D=$${X#*.}; echo dvb/adapter$$A/$$D'", NAME="%c", GROUP="video" - -# Asterix Zaptel devices -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zaptimer", NAME="zap/timer" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zap[0-9]*", NAME="zap/%n" - -# pilot/palm devices -KERNEL=="pilot", NAME="%k", GROUP="uucp" - -# jaz devices -KERNEL=="jaz*", NAME="%k", GROUP="disk" - -# zip devices -KERNEL=="pocketzip*", NAME="%k", GROUP="disk" -KERNEL=="zip*", NAME="%k", GROUP="disk" - -# ls120 devices -KERNEL=="ls120", NAME="%k", GROUP="disk" - -# lp devices -KERNEL=="irlpt", NAME="%k", GROUP="lp", MODE="0664" -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp", MODE="0664" -SUBSYSTEM=="printer", KERNEL=="lp*", NAME="%k", GROUP="lp", MODE="0664" -KERNEL=="parport*", NAME="%k", GROUP="lp", MODE="0664" - -# tape devices -KERNEL=="ht*", NAME="%k" -KERNEL=="nht*", NAME="%k" -KERNEL=="pt*", NAME="%k" -KERNEL=="npt*", NAME="%k" -KERNEL=="st*", NAME="%k" -KERNEL=="nst*", NAME="%k" -KERNEL=="osst*", NAME="%k" -KERNEL=="nosst*", NAME="%k" - -# diskonkey devices -KERNEL=="diskonkey*", NAME="%k", GROUP="disk" - -# rem_ide devices -KERNEL=="microdrive*", NAME="%k", GROUP="disk" - -# kbd devices -KERNEL=="kbd", NAME="%k", MODE="0664" - -# Sony Vaio Jogdial sonypi device -KERNEL=="sonypi", NAME="%k", MODE="0666" - -# packet devices -KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom", MODE="0660" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/pktcdvd%n", GROUP="cdrom", MODE="0660" - -# infiniband devices -KERNEL=="umad*", NAME="infiniband/%k" -KERNEL=="issm*", NAME="infiniband/%k" - -# PnP -SUBSYSTEM=="pnp", ENV{MODALIAS}!="?*", \ - RUN+="/bin/sh -c 'while read id; do /sbin/modprobe pnp:d$$id; done < /sys$devpath/id'" - -# firewire -SUBSYSTEM=="ieee1394", ENV{MODALIAS}!="?*", IMPORT{program}="modalias_ieee1394" - -# libusb device access -DEVPATH=="/module/usbcore", ACTION=="add", \ - RUN+="/bin/sh -c 'sleep 1; /bin/mount none -t usbfs /proc/bus/usb -o devmode=0666,devgid=10'" -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'X=%k X=$${X#usbdev}; B=$${X%%%%.*}; D=$${X#*.}; echo bus/usb/$$B/$$D'", SYMLINK+="%c" - -# firmware loader -SUBSYSTEM=="firmware", ACTION=="add", RUN+="/lib/udev/firmware_helper" - -# load module -ACTION=="add", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" - -# PCMCIA devices: -# -# Very few CIS firmware entries (which we use for matching) -# are so broken that we need to read out random bytes of it -# instead of the manufactor, card or product ID. Then the -# matching is done in userspace. -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \ - RUN+="/sbin/pcmcia-check-broken-cis" - -# However, the "weak" matching by func_id is only allowed _after_ modprobe -# returns, so that "strong" matches have a higher priority. -ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", \ - RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'" - -# PCMCIA sockets: -# -# modprobe the pcmcia bus module so that 16-bit PCMCIA devices work -ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/modprobe pcmcia" - -# if this is a PCMCIA socket which needs a resource database, -# pcmcia-socket-startup sets it up -ACTION=="add", SUBSYSTEM=="pcmcia_socket", RUN+="/sbin/pcmcia-socket-startup" - -# network devices -KERNEL=="tun", NAME="net/%k" -SUBSYSTEM=="net", ACTION=="add", RUN+="/lib/udev/nethelper.sh $env{INTERFACE} start" -SUBSYSTEM=="net", ACTION=="remove", RUN+="/lib/udev/nethelper.sh $env{INTERFACE} stop" - -# if you use HAL, try this: -# send all events to HAL -#RUN+="socket:/org/freedesktop/hal/udev_event" - -# catch the event in udevmonitor -RUN+="socket:/org/kernel/udev/monitor" -- cgit v1.2.3-54-g00ecf From 38701863749cac0cc1c33694434282abbb0f04fa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Aug 2008 10:34:18 +0200 Subject: rules: add nvram --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 75a3e6d39f..6eeb541b4d 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -18,7 +18,7 @@ KERNEL=="lirc0", SYMLINK+="lirc" # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" KERNEL=="null", SYMLINK+="XOR" -KERNEL=="mem|kmem|port", GROUP="kmem", MODE="0640" +KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" KERNEL=="ram0", SYMLINK+="ramdisk" KERNEL=="ram1", SYMLINK+="ram" -- cgit v1.2.3-54-g00ecf From 88591d55438abf62906b928336564ce96d64f41b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Aug 2008 10:34:36 +0200 Subject: rules: add isdn rules --- rules/packages/40-isdn.rules | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 rules/packages/40-isdn.rules diff --git a/rules/packages/40-isdn.rules b/rules/packages/40-isdn.rules new file mode 100644 index 0000000000..f2bc34e5c8 --- /dev/null +++ b/rules/packages/40-isdn.rules @@ -0,0 +1,5 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="capi", GROUP="uucp" +KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" +KERNEL=="capi*", NAME="capi/%n" -- cgit v1.2.3-54-g00ecf From 21a6e5940d1c3e9299e398fc224f3b864397744e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Aug 2008 16:55:38 +0200 Subject: rules: Gentoo update --- rules/gentoo/65-permissions.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/gentoo/65-permissions.rules b/rules/gentoo/65-permissions.rules index 494f19e63f..173e08783d 100644 --- a/rules/gentoo/65-permissions.rules +++ b/rules/gentoo/65-permissions.rules @@ -15,7 +15,7 @@ KERNEL=="st[0-9]*|nst[0-9]*|ht[0-9]*|nht[0-9]*|pt[0-9]*|npt[0-9]*", \ SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[18]", GROUP="tape", MODE="660" # dialout devices -KERNEL=="ippp*|isdn*|dcbri*|capi*", GROUP="uucp" +KERNEL=="ippp*|isdn*|dcbri*|capi*|rfcomm*|ttyACM[0-9]*", GROUP="uucp" KERNEL=="pilot", GROUP="uucp" # sound devices (sound=alsa, snd=oss) -- cgit v1.2.3-54-g00ecf From b7ec267e176021803e27941ae8a2860facff692b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 Aug 2008 11:18:39 +0200 Subject: add missing includes --- extras/usb_id/usb_id.c | 2 ++ udev/udev_rules_parse.c | 2 ++ udev/udev_sysdeps.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 5b78b975d8..92492c8665 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -11,6 +11,8 @@ * Free Software Foundation version 2 of the License. */ +#include + #include #include #include diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index bf833bae54..705b3feb04 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -17,6 +17,8 @@ * */ +#include "config.h" + #include #include #include diff --git a/udev/udev_sysdeps.c b/udev/udev_sysdeps.c index ef5b09ef89..cd7d148398 100644 --- a/udev/udev_sysdeps.c +++ b/udev/udev_sysdeps.c @@ -21,6 +21,8 @@ #include #include +#include "udev_sysdeps.h" + #ifndef HAVE_STRLCPY size_t strlcpy(char *dst, const char *src, size_t size) { -- cgit v1.2.3-54-g00ecf From e231a5db51f1b21252b2404d0aa2f243baa87a1a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 Aug 2008 11:19:32 +0200 Subject: add some warnings --- autogen.sh | 5 +++++ configure.ac | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 43c763bf2f..4ec4e0551a 100755 --- a/autogen.sh +++ b/autogen.sh @@ -43,6 +43,11 @@ automake --add-missing if test -z "$@"; then args="--prefix=/usr --exec-prefix= --sysconfdir=/etc" + export CFLAGS="-g -Wall \ +-Wmissing-declarations -Wmissing-prototypes \ +-Wnested-externs -Wpointer-arith \ +-Wpointer-arith -Wsign-compare -Wchar-subscripts \ +-Wstrict-prototypes -Wshadow" else args=$@ fi diff --git a/configure.ac b/configure.ac index 8d5228ff91..eb22a5cb61 100644 --- a/configure.ac +++ b/configure.ac @@ -3,7 +3,7 @@ AC_INIT([udev], [kay.sievers@vrfy.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) -AM_INIT_AUTOMAKE([check-news foreign -Wall 1.9 dist-bzip2]) +AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) AC_GNU_SOURCE AC_DISABLE_STATIC AC_SYS_LARGEFILE -- cgit v1.2.3-54-g00ecf From a3b55b1c4744ab0e7f78057db04f6832688a5a3f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 13 Aug 2008 00:01:44 +0200 Subject: build-sys: don't duplicate file names Almost all filenames in udev/Makefile.am are duplicated in {udevd,udevadm,test_udev}_SOURCE lists. Signed-off-by: Karel Zak --- udev/Makefile.am | 75 ++++++++++++++++++-------------------------------------- 1 file changed, 24 insertions(+), 51 deletions(-) diff --git a/udev/Makefile.am b/udev/Makefile.am index 6402f231f9..3d285462a9 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -9,15 +9,15 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DUDEV_PREFIX=\""$(udev_prefix)"\" -udevd_SOURCES = \ +common_ldadd = + +common_files = \ list.h \ logging.h \ udev.h \ udev_rules.h \ udev_selinux.h \ udev_sysdeps.h \ - udevd.h \ - udevd.c \ udev_config.c \ udev_db.c \ udev_device.c \ @@ -29,73 +29,46 @@ udevd_SOURCES = \ udev_utils.c \ udev_utils_file.c \ udev_utils_string.c + + if USE_SELINUX -udevd_SOURCES += \ +common_files += \ udev_selinux.c -udevd_LDADD = \ +common_ldadd += \ $(SELINUX_LIBS) endif +udevd_SOURCES = \ + $(common_files) \ + udevd.h \ + udevd.c + +udevd_LDADD = \ + $(common_ldadd) + + udevadm_SOURCES = \ - list.h \ - logging.h \ - udev.h \ - udev_rules.h \ - udev_selinux.h \ - udev_sysdeps.h \ + $(common_files) \ udevadm.c \ udevinfo.c \ udevcontrol.c \ udevtest.c \ udevmonitor.c \ udevsettle.c \ - udevtrigger.c \ - udev_config.c \ - udev_db.c \ - udev_device.c \ - udev_node.c \ - udev_rules.c \ - udev_rules_parse.c \ - udev_sysdeps.c \ - udev_sysfs.c \ - udev_utils.c \ - udev_utils_file.c \ - udev_utils_string.c -if USE_SELINUX -udevadm_SOURCES += \ - udev_selinux.c + udevtrigger.c udevadm_LDADD = \ - $(SELINUX_LIBS) -endif + $(common_ldadd) + test_udev_SOURCES = \ - list.h \ - logging.h \ - udev.h \ - udev_rules.h \ - udev_selinux.h \ - udev_sysdeps.h \ - test-udev.c \ - udev_config.c \ - udev_db.c \ - udev_device.c \ - udev_node.c \ - udev_rules.c \ - udev_rules_parse.c \ - udev_sysdeps.c \ - udev_sysfs.c \ - udev_utils.c \ - udev_utils_file.c \ - udev_utils_string.c -if USE_SELINUX -test_udev_SOURCES += \ - udev_selinux.c + $(common_files) \ + test-udev.c test_udev_LDADD = \ - $(SELINUX_LIBS) -endif + $(common_ldadd) + dist_man_MANS = \ udev.7 \ -- cgit v1.2.3-54-g00ecf From 4c538fb5273c596bb6a63e04c5c6df3586e21ffd Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 13 Aug 2008 00:01:46 +0200 Subject: build-sys: remove non-POSIX variable names Makefile.am:24: shell echo $$(( $(VERSION: non-POSIX variable name Makefile.am:24: (probably a GNU make extension) Makefile.am:26: shell echo $$(($(VERSION: non-POSIX variable name Makefile.am:26: (probably a GNU make extension) Makefile.am:29: shell echo $$(($(VERSION: non-POSIX variable name Makefile.am:29: (probably a GNU make extension) Signed-off-by: Karel Zak --- Makefile.am | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index ae21bca16c..a4260ea8e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,6 +12,8 @@ EXTRA_DIST = \ docs \ autogen.sh +PREVIOUS_VERSION = `expr $(VERSION) - 1` + distclean-local: rm -f *~ rm -rf autom4te.cache @@ -21,12 +23,12 @@ distclean-local: rm -f udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 changelog: - @ head -1 ChangeLog | grep -q "to v$(shell echo $$(($(VERSION) - 1)))" + @ head -1 ChangeLog | grep -q "to $(PREVIOUS_VERSION)" @ mv ChangeLog ChangeLog.tmp - @ echo "Summary of changes from v$(shell echo $$(($(VERSION) - 1))) to v$(VERSION)" >> ChangeLog + @ echo "Summary of changes from v$(PREVIOUS_VERSION) to v$(VERSION)" >> ChangeLog @ echo "============================================" >> ChangeLog @ echo >> ChangeLog - @ git log --pretty=short $(shell echo $$(($(VERSION) - 1)))..HEAD | git shortlog >> ChangeLog + @ git log --pretty=short $(PREVIOUS_VERSION)..HEAD | git shortlog >> ChangeLog @ echo >> ChangeLog @ cat ChangeLog @ cat ChangeLog.tmp >> ChangeLog -- cgit v1.2.3-54-g00ecf From d7c709c9186918e59411423e0c4e2b12ac9735d6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Aug 2008 11:30:26 +0200 Subject: update .gitignore Based on Karel's patch. Thanks! --- .gitignore | 3 +++ udev/.gitignore | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7acc4a688e..358bc4db12 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ +*~ *.o +*.[78] +*.a *.lo *.la .libs diff --git a/udev/.gitignore b/udev/.gitignore index 5ce11acc15..1e1ee3632f 100644 --- a/udev/.gitignore +++ b/udev/.gitignore @@ -1,6 +1,3 @@ -*.o -*.a udevd udevadm test-udev -.deps/ -- cgit v1.2.3-54-g00ecf From da8ba809e1f846353da8f53b62741fe13d0b021c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Aug 2008 11:41:25 +0200 Subject: add missing 'v' for "make changelog" --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index a4260ea8e7..d4afefdf71 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,7 @@ distclean-local: rm -f udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 changelog: - @ head -1 ChangeLog | grep -q "to $(PREVIOUS_VERSION)" + @ head -1 ChangeLog | grep -q "to v$(PREVIOUS_VERSION)" @ mv ChangeLog ChangeLog.tmp @ echo "Summary of changes from v$(PREVIOUS_VERSION) to v$(VERSION)" >> ChangeLog @ echo "============================================" >> ChangeLog -- cgit v1.2.3-54-g00ecf From 4ade7486a562821df5b337cb238c7c69267dd1fc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Aug 2008 11:48:42 +0200 Subject: build: fix "make dist" --- rules/Makefile.am | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/rules/Makefile.am b/rules/Makefile.am index 45a64b725b..22de28220a 100644 --- a/rules/Makefile.am +++ b/rules/Makefile.am @@ -13,12 +13,9 @@ install-data-local: EXTRA_DIST = \ packages \ - debian \ redhat \ suse \ - gentoo \ - slackware \ - frugalware + gentoo distclean-local: -- cgit v1.2.3-54-g00ecf From f46a8a98a79afcbb9e9910d7d71c1f8ef4e6637f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 22 Aug 2008 10:04:55 +0200 Subject: vol_id: make the --offset= argument optional --- extras/cdrom_id/cdrom_id.c | 6 +++--- extras/volume_id/vol_id.c | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index acf7a97e41..9e27471863 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -693,11 +693,11 @@ print: printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); if (cd_media_track_count > 0) printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); - if (cd_media_track_count_audio) + if (cd_media_track_count_audio > 0) printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); - if (cd_media_track_count_data) + if (cd_media_track_count_data > 0) printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); - if (cd_media_session_last_offset) + if (cd_media_session_last_offset > 0) printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); exit: if (fd >= 0) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 60428ab582..b3f810fc9d 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -134,7 +134,7 @@ int main(int argc, char *argv[]) { "export", 0, NULL, 'x' }, { "skip-raid", 0, NULL, 's' }, { "probe-all", 0, NULL, 'a' }, - { "offset", 1, NULL, 'o' }, + { "offset", 2, NULL, 'o' }, { "help", 0, NULL, 'h' }, {} }; @@ -196,7 +196,8 @@ int main(int argc, char *argv[]) probe_all = 1; break; case 'o': - offset = strtoull(optarg, NULL, 0); + if (optarg[0] != '\0') + offset = strtoull(optarg, NULL, 0); break; case 'h': printf("Usage: vol_id [options] \n" -- cgit v1.2.3-54-g00ecf From 8eb4ab836cb022f5ae7e9154fda20a3f536e8444 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 22 Aug 2008 10:11:34 +0200 Subject: rules: optical drives - probe at last session offset, do not probe for raid --- rules/rules.d/60-persistent-storage.rules | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 097e8640c4..5218b2c570 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -38,7 +38,7 @@ KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id -- KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" -# libata compat (links like hd*) +# libata compat (ata-* links, like old hd* devices did create) KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" @@ -52,11 +52,12 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA # skip unpartitioned removable media devices from drivers which do not send "change" events ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" -# skip optical drives without media -ENV{DEVTYPE}=="disk", KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}!="?*", GOTO="persistent_storage_end" -# import filesystem metadata -IMPORT{program}="vol_id --export $tempnode" +# probe filesystem metadata of optical drives which have a media inserted +KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" + +# probe filesystem metadata of disks +KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode" # by-label/by-uuid links (filesystem metadata) ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -- cgit v1.2.3-54-g00ecf From 41ac13f49f0153d544fcf5099bb201cf3a3e19d4 Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Wed, 27 Aug 2008 16:58:10 +0200 Subject: rules: fix md rules for partitioned devices --- rules/packages/64-md-raid.rules | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rules/packages/64-md-raid.rules b/rules/packages/64-md-raid.rules index d0510b3095..02a321093a 100644 --- a/rules/packages/64-md-raid.rules +++ b/rules/packages/64-md-raid.rules @@ -11,8 +11,10 @@ KERNEL!="md*", GOTO="md_end" ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" IMPORT{program}="/sbin/mdadm --detail --export $tempnode" -ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" -ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" +ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" +ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" +ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n" +ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n" IMPORT{program}="vol_id --export $tempnode" OPTIONS+="link_priority=100" -- cgit v1.2.3-54-g00ecf From 33a5cc297680f20e791c792a45fe949f715f5f69 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 27 Aug 2008 17:11:58 +0200 Subject: libudev: add library to access udev information --- NEWS | 4 + TODO | 3 + configure.ac | 10 + udev/Makefile.am | 3 + udev/lib/.gitignore | 4 + udev/lib/Makefile.am | 63 +++++ udev/lib/exported_symbols | 17 ++ udev/lib/libudev-private.h | 60 +++++ udev/lib/libudev.c | 583 +++++++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev.h | 57 +++++ udev/lib/libudev.pc.in | 10 + udev/lib/test-libudev.c | 107 +++++++++ 12 files changed, 921 insertions(+) create mode 100644 udev/lib/.gitignore create mode 100644 udev/lib/Makefile.am create mode 100644 udev/lib/exported_symbols create mode 100644 udev/lib/libudev-private.h create mode 100644 udev/lib/libudev.c create mode 100644 udev/lib/libudev.h create mode 100644 udev/lib/libudev.pc.in create mode 100644 udev/lib/test-libudev.c diff --git a/NEWS b/NEWS index f0615d53b3..016ec198e8 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 127 +======== +Bugfixes. + udev 126 ======== We use ./configure now. See INSTALL for details. Current diff --git a/TODO b/TODO index 88d3e59486..5afde0c8de 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,10 @@ These things would be nice to have: o get all distros to agree on a default set of rules + o fix (non important) memleak in udevinfo at udev_device_init() loop + o rework rules to a match-action list, instead of a rules array These things will change in future udev versions: o --device-id-of-file will print '5:8' instead of '5 8' These things are deprecated and scheduled for removal in a future udev version: + o DEVTYPE for disks is set by the kernel, remove it from the rules diff --git a/configure.ac b/configure.ac index eb22a5cb61..4be3ed583a 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,14 @@ AC_DISABLE_STATIC AC_SYS_LARGEFILE AC_PROG_LIBTOOL +dnl /* libudev version */ +LIBUDEV_LT_CURRENT=0 +LIBUDEV_LT_REVISION=0 +LIBUDEV_LT_AGE=0 +AC_SUBST(LIBUDEV_LT_CURRENT) +AC_SUBST(LIBUDEV_LT_REVISION) +AC_SUBST(LIBUDEV_LT_AGE) + dnl /* libvolume_id version */ VOLID_LT_CURRENT=0 VOLID_LT_REVISION=86 @@ -74,6 +82,8 @@ AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile udev/Makefile + udev/lib/Makefile + udev/lib/libudev.pc rules/Makefile extras/Makefile extras/ata_id/Makefile diff --git a/udev/Makefile.am b/udev/Makefile.am index 3d285462a9..d9f14057c8 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -1,3 +1,6 @@ +SUBDIRS = \ + lib + sbin_PROGRAMS = \ udevd \ udevadm diff --git a/udev/lib/.gitignore b/udev/lib/.gitignore new file mode 100644 index 0000000000..74a5f1d379 --- /dev/null +++ b/udev/lib/.gitignore @@ -0,0 +1,4 @@ +test-libudev +libudev.pc +libudev.so* + diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am new file mode 100644 index 0000000000..791191c643 --- /dev/null +++ b/udev/lib/Makefile.am @@ -0,0 +1,63 @@ +AM_CPPFLAGS = \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" + +noinst_PROGRAMS = \ + test-libudev + +test_libudev_SOURCES = \ + test-libudev.c + +test_libudev_LDADD = \ + libudev.la + +rootlibdir = $(exec_prefix)/$(libdir_name) +rootlib_LTLIBRARIES = \ + libudev.la + +include_HEADERS =\ + libudev.h + +libudev_la_SOURCES =\ + libudev-private.h \ + libudev.c \ + ../list.h \ + ../udev.h \ + ../udev_utils.c \ + ../udev_utils_string.c \ + ../udev_utils_file.c \ + ../udev_sysfs.c \ + ../udev_node.c \ + ../udev_device.c \ + ../udev_config.c \ + ../udev_rules.c \ + ../udev_rules_parse.c \ + ../udev_db.c \ + ../udev_sysdeps.c + +libudev_la_LDFLAGS = \ + -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ + -export-symbols $(top_srcdir)/udev/lib/exported_symbols + +pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig +pkgconfig_DATA = libudev.pc + +EXTRA_DIST = \ + exported_symbols + +# move devel files to $(prefix)$(libdir_name) if needed +install-data-hook: + rm $(DESTDIR)$(rootlibdir)/libudev.la + if test "$(prefix)" != "$(exec_prefix)"; then \ + mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \ + mv $(DESTDIR)$(rootlibdir)/libudev.a $(DESTDIR)$(prefix)/$(libdir_name)/; \ + so_img_name=$$(readlink $(DESTDIR)$(rootlibdir)/libudev.so); \ + rm $(DESTDIR)$(rootlibdir)/libudev.so; \ + so_img_rel_target_prefix=$$(echo $(prefix)/$(libdir_name) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ + ln -sf $$so_img_rel_target_prefix$(exec_prefix)/$(libdir_name)/$$so_img_name \ + $(DESTDIR)$(prefix)/$(libdir_name)/libudev.so; \ + fi + +uninstall-hook: + rm -f $(DESTDIR)$(prefix)/$(libdir_name)/libudev.a + rm -f $(DESTDIR)$(prefix)/$(libdir_name)/libudev.so* diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols new file mode 100644 index 0000000000..c3a7cafe00 --- /dev/null +++ b/udev/lib/exported_symbols @@ -0,0 +1,17 @@ +udev_log_fn +udev_new +udev_ref +udev_unref +udev_set_log_fn +udev_get_sys_path +udev_get_dev_path +udev_device_new_from_devpath +udev_device_ref +udev_device_unref +udev_device_get_udev +udev_device_get_devpath +udev_device_get_devname +udev_device_get_subsystem +udev_device_get_devlinks +udev_device_get_properties +udev_devices_enumerate diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h new file mode 100644 index 0000000000..8f7e247f58 --- /dev/null +++ b/udev/lib/libudev-private.h @@ -0,0 +1,60 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef _LIBUDEV_PRIVATE_H_ +#define _LIBUDEV_PRIVATE_H_ + +#include "libudev.h" +#include "../udev.h" + +struct udev { + int refcount; + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args); +}; + +struct udev_device { + int refcount; + struct udev *udev; + struct udevice *udevice; +}; + +#ifdef USE_LOG +#define log_dbg(udev, arg...) \ + udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) + +#define log_info(udev, arg...) \ + udev_log(udev, LOG_INFO, __FILE__, __LINE__, __FUNCTION__, ## arg) + +#define log_err(udev, arg...) \ + udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) + +void udev_log(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, ...) + __attribute__ ((format(printf, 6, 7))); +#else +static inline void udev_log(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, ...) + __attribute__ ((format(printf, 6, 7))) {} +#endif + +#endif diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c new file mode 100644 index 0000000000..098ca8f602 --- /dev/null +++ b/udev/lib/libudev.c @@ -0,0 +1,583 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "../udev.h" + +void udev_log(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, ...) +{ + va_list args; + + va_start(args, format); + udev->log_fn(udev, priority, file, line, fn, format, args); + va_end(args); +} + +static void log_stderr(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args) +{ + static int log = -1; + + if (log == -1) { + if (getenv("LIBUDEV_DEBUG") != NULL) + log = 1; + else + log = 0; + } + + if (log == 1) { + fprintf(stderr, "libudev: %s: ", fn); + vfprintf(stderr, format, args); + } +} + +/* glue to udev logging, needed until udev logging code is "fixed" */ +#ifdef USE_LOG +void log_message(int priority, const char *format, ...) +{ + va_list args; + + va_start(args, format); + log_stderr(NULL, priority, NULL, 0, "", format, args); + va_end(args); +} +#endif + +static ssize_t get_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size) +{ + char path[PATH_SIZE]; + ssize_t len; + const char *pos; + + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/subsystem", sizeof(path)); + len = readlink(path, path, sizeof(path)); + if (len < 0 || len >= (ssize_t) sizeof(path)) + return -1; + path[len] = '\0'; + pos = strrchr(path, '/'); + if (pos == NULL) + return -1; + pos = &pos[1]; + return strlcpy(subsystem, pos, size); +} + +/** + * udev_new: + * + * Create udev library context. + * + * The initial refcount is 1, and needs to be decremented to + * release the ressources of the udev library context. + * + * Returns: a new udev library context + **/ +struct udev *udev_new(void) +{ + struct udev *udev; + + udev = malloc(sizeof(struct udev)); + if (udev == NULL) + return NULL; + memset(udev, 0x00, (sizeof(struct udev))); + udev->refcount = 1; + udev->log_fn = log_stderr; + udev_config_init(); + sysfs_init(); + log_info(udev, "context %p created\n", udev); + return udev; +} + +/** + * udev_ref: + * @udev: udev library context + * + * Take a reference of the udev library context. + * + * Returns: the passed udev library context + **/ +struct udev *udev_ref(struct udev *udev) +{ + udev->refcount++; + return udev; +} + +/** + * udev_unref: + * @udev: udev library context + * + * Drop a reference of the udev library context. If the refcount + * reaches zero, the ressources of the context will be released. + * + **/ +void udev_unref(struct udev *udev) +{ + udev->refcount--; + if (udev->refcount > 0) + return; + sysfs_cleanup(); + log_info(udev, "context %p released\n", udev); + free(udev); +} + +/** + * udev_set_log_fn: + * @udev: udev library context + * @log_fn: function to be called for logging messages + * + * The built-in logging, which writes to stderr if the + * LIBUDEV_DEBUG environment variable is set, can be + * overridden by a custom function, to plug log messages + * into the users logging functionality. + * + **/ +void udev_set_log_fn(struct udev *udev, + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args)) +{ + udev->log_fn = log_fn; + log_info(udev, "custom logging function %p registered\n", udev); +} + +/** + * udev_get_sys_path: + * @udev: udev library context + * + * Retrieve the sysfs mount point. The default is "/sys". For + * testing purposes, it can be overridden with the environment + * variable SYSFS_PATH. + * + * Returns: the sys mount point + **/ +const char *udev_get_sys_path(struct udev *udev) +{ + return sysfs_path; +} + +/** + * udev_get_dev_path: + * @udev: udev library context + * + * Retrieve the device directory path. The default value is "/dev", + * the actual value may be overridden in the udev configuration + * file. + * + * Returns: the device directory path + **/ +const char *udev_get_dev_path(struct udev *udev) +{ + return udev_root; +} + +static struct udev_device *device_init(struct udev *udev) +{ + struct udev_device *udev_device; + + udev_device = malloc(sizeof(struct udev_device)); + if (udev_device == NULL) + return NULL; + memset(udev_device, 0x00, sizeof(struct udev_device)); + udev_device->refcount = 1; + udev_device->udev = udev; + return udev_device; +} + +/** + * udev_device_new_from_devpath: + * @udev: udev library context + * @devpath: sys device path + * + * Create new udev device, and fill in information from the sysfs + * device and the udev database entry. The devpath must not contain + * the sysfs mount path, and must contain a leading '/'. + * + * The initial refcount is 1, and needs to be decremented to + * release the ressources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ +struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath) +{ + char path[PATH_SIZE]; + struct stat statbuf; + struct udev_device *udev_device; + int err; + + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + strlcat(path, devpath, sizeof(path)); + if (stat(path, &statbuf) != 0) + return NULL; + if (!S_ISDIR(statbuf.st_mode)) + return NULL; + + udev_device = device_init(udev); + if (udev_device == NULL) + return NULL; + + udev_device->udevice = udev_device_init(NULL); + if (udev_device->udevice == NULL) { + free(udev_device); + return NULL; + } + log_info(udev, "device %p created\n", udev_device); + + strlcpy(path, devpath, sizeof(path)); + sysfs_resolve_link(path, sizeof(path)); + + err = udev_db_get_device(udev_device->udevice, path); + if (err >= 0) + log_info(udev, "device %p filled with udev database data\n", udev_device); + log_info(udev, "device %p filled with %s data\n", udev_device, udev_device_get_devpath(udev_device)); + return udev_device; +} + +/** + * udev_device_get_udev: + * + * Retrieve the udev library context the device was created with. + * + * Returns: the udev library context + **/ +struct udev *udev_device_get_udev(struct udev_device *udev_device) +{ + return udev_device->udev; +} + +/** + * udev_device_ref: + * @udev_device: udev device + * + * Take a reference of a udev device. + * + * Returns: the passed udev device + **/ +struct udev_device *udev_device_ref(struct udev_device *udev_device) +{ + udev_device->refcount++; + return udev_device; +} + +/** + * udev_device_unref: + * @udev_device: udev device + * + * Drop a reference of a udev device. If the refcount reaches zero, + * the ressources of the device will be released. + * + **/ +void udev_device_unref(struct udev_device *udev_device) +{ + udev_device->refcount--; + if (udev_device->refcount > 0) + return; + udev_device_cleanup(udev_device->udevice); + free(udev_device); +} + +/** + * udev_device_get_devpath: + * @udev_device: udev device + * + * Retrieve the sys path of the udev device. The path does not contain + * the sys mount point. + * + * Returns: the sys path of the udev device + **/ +const char *udev_device_get_devpath(struct udev_device *udev_device) +{ + return udev_device->udevice->dev->devpath; +} + +/** + * udev_device_get_devname: + * @udev_device: udev device + * + * Retrieve the device node file name belonging to the udev device. + * The path does not contain the device directory, and does not contain + * a leading '/'. + * + * Returns: the device node file name of the udev device, or #NULL if no device node exists + **/ +const char *udev_device_get_devname(struct udev_device *udev_device) +{ + if (udev_device->udevice->name[0] == '\0') + return NULL; + return udev_device->udevice->name; +} + +/** + * udev_device_get_subsystem: + * @udev_device: udev device + * + * Retrieve the subsystem string of the udev device. The string does not + * contain any "/". + * + * Returns: the subsystem name of the udev device, or #NULL if it can not be determined + **/ +const char *udev_device_get_subsystem(struct udev_device *udev_device) +{ + struct sysfs_device *dev = udev_device->udevice->dev; + if (dev->subsystem[0] != '\0') + return dev->subsystem; + if (get_subsystem(udev_device->udev, dev->devpath, + dev->subsystem, sizeof(dev->subsystem)) < 2) + return NULL; + return dev->subsystem; +} + +/** + * udev_device_get_devlinks: + * @udev_device: udev device + * @cb: function to be called for every device link found + * @data: data to be passed to the function + * + * Retrieve the device links pointing to the device file of the + * udev device. For every device link, the passed function will be + * called with the device link string. If the function returns 1, + * remaning device links will be ignored. The device link path + * does not contain the device directory, and does not contain + * a leading '/'. + * + * Returns: the number of device links passed to the caller, or a negative value on error + **/ +int udev_device_get_devlinks(struct udev_device *udev_device, + int (*cb)(struct udev_device *udev_device, const char *value, void *data), + void *data) +{ + struct name_entry *name_loop; + int count = 0; + + list_for_each_entry(name_loop, &udev_device->udevice->symlink_list, node) { + count++; + if (cb(udev_device, name_loop->name, data) != 0) + break; + } + return count; +} + +/** + * udev_device_get_properties: + * @udev_device: udev device + * @cb: function to be called for every property found + * @data: data to be passed to the function + * + * Retrieve the property key/value pairs belonging to the + * udev device. For every key/value pair, the passed function will be + * called. If the function returns 1, remaning properties will be + * ignored. + * + * Returns: the number of properties passed to the caller, or a negative value on error + **/ +int udev_device_get_properties(struct udev_device *udev_device, + int (*cb)(struct udev_device *udev_device, const char *key, const char *value, void *data), + void *data) +{ + struct name_entry *name_loop; + int count = 0; + + list_for_each_entry(name_loop, &udev_device->udevice->env_list, node) { + char name[PATH_SIZE]; + char *val; + + strncpy(name, name_loop->name, PATH_SIZE); + name[PATH_SIZE-1] = '\0'; + val = strchr(name, '='); + if (val == NULL) + continue; + val[0] = '\0'; + val = &val[1]; + if (cb(udev_device, name, val, data) != 0) + break; + } + return count; +} + +static int devices_scan_subsystem(struct udev *udev, + const char *basedir, const char *subsystem, const char *subdir, + struct list_head *device_list) +{ + char path[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + size_t len; + + len = strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + strlcat(path, basedir, sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, subsystem, sizeof(path)); + if (subdir != NULL) + strlcat(path, subdir, sizeof(path)); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char devpath[PATH_SIZE]; + + if (dent->d_name[0] == '.') + continue; + strlcpy(devpath, &path[len], sizeof(devpath)); + strlcat(devpath, "/", sizeof(devpath)); + strlcat(devpath, dent->d_name, sizeof(devpath)); + sysfs_resolve_link(devpath, sizeof(devpath)); + name_list_add(device_list, devpath, 1); + } + closedir(dir); + return 0; +} + +static int devices_scan_subsystems(struct udev *udev, + const char *basedir, const char *subsystem, const char *subdir, + struct list_head *device_list) +{ + char path[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + if (subsystem != NULL) + return devices_scan_subsystem(udev, basedir, subsystem, subdir, device_list); + + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + strlcat(path, basedir, sizeof(path)); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + devices_scan_subsystem(udev, basedir, dent->d_name, subdir, device_list); + } + closedir(dir); + return 0; +} + +static int devices_delay(struct udev *udev, const char *devpath) +{ + static const char *delay_device_list[] = { + "/block/md", + "/block/dm-", + NULL + }; + int i; + + for (i = 0; delay_device_list[i] != NULL; i++) { + if (strstr(devpath, delay_device_list[i]) != NULL) { + log_info(udev, "delaying: %s\n", devpath); + return 1; + } + } + return 0; +} + +static int devices_call(struct udev *udev, const char *devpath, + int (*cb)(struct udev *udev, + const char *devpath, const char *subsystem, const char *name, + void *data), + void *data, + int *cb_rc) +{ + char subsystem[NAME_SIZE]; + const char *name; + + name = strrchr(devpath, '/'); + if (name == NULL) + return -1; + name++; + + if (get_subsystem(udev, devpath, subsystem, sizeof(subsystem)) < 2) + return -1; + *cb_rc = cb(udev, devpath, subsystem, name, data); + return 0; +} + +/** + * udev_devices_enumerate: + * @udev_device: udev device + * @cb: function to be called for every property found + * @data: data to be passed to the function + * + * Retrieve the property key/value pairs belonging to the + * udev device. For every key/value pair, the passed function will be + * called. If the function returns 1, remaning properties will be + * ignored. + * + * Returns: the number of properties passed to the caller, or a negative value on error + **/ +int udev_devices_enumerate(struct udev *udev, const char *subsystem, + int (*cb)(struct udev *udev, + const char *devpath, const char *subsystem, const char *name, void *data), + void *data) +{ + char base[PATH_SIZE]; + struct stat statbuf; + struct list_head device_list; + struct name_entry *loop_device; + struct name_entry *tmp_device; + int cb_rc = 0; + int count = 0; + + INIT_LIST_HEAD(&device_list); + + /* if we have /sys/subsystem/, forget all the old stuff */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/subsystem", sizeof(base)); + if (stat(base, &statbuf) == 0) { + devices_scan_subsystems(udev, "/subsystem", subsystem, "/devices", &device_list); + } else { + devices_scan_subsystems(udev, "/bus", subsystem, "/devices", &device_list); + devices_scan_subsystems(udev, "/class", subsystem, NULL, &device_list); + } + + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { + if (devices_delay(udev, loop_device->name)) + continue; + if (cb_rc == 0) + if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) + count++; + list_del(&loop_device->node); + free(loop_device); + } + + /* handle remaining delayed devices */ + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { + if (cb_rc == 0) + if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) + count++; + list_del(&loop_device->node); + free(loop_device); + } + + return count; +} diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h new file mode 100644 index 0000000000..e740f3670e --- /dev/null +++ b/udev/lib/libudev.h @@ -0,0 +1,57 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef _LIBUDEV_H_ +#define _LIBUDEV_H_ + +struct udev; +struct udev_device; + +extern struct udev *udev_new(void); +extern struct udev *udev_ref(struct udev *udev); +extern void udev_unref(struct udev *udev); +extern void udev_set_log_fn(struct udev *udev, + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args)); +extern const char *udev_get_sys_path(struct udev *udev); +extern const char *udev_get_dev_path(struct udev *udev); + +extern struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath); +extern struct udev_device *udev_device_ref(struct udev_device *udev_device); +extern void udev_device_unref(struct udev_device *udev_device); +extern struct udev *udev_device_get_udev(struct udev_device *udev_device); +extern const char *udev_device_get_devpath(struct udev_device *udev_device); +extern const char *udev_device_get_devname(struct udev_device *udev_device); +extern const char *udev_device_get_subsystem(struct udev_device *udev_device); +extern int udev_device_get_devlinks(struct udev_device *udev_device, + int (*cb)(struct udev_device *udev_device, + const char *value, void *data), + void *data); +extern int udev_device_get_properties(struct udev_device *udev_device, + int (*cb)(struct udev_device *udev_device, + const char *key, const char *value, void *data), + void *data); + +extern int udev_devices_enumerate(struct udev *udev, const char *subsystem, + int (*cb)(struct udev *udev, + const char *devpath, const char *subsystem, const char *name, void *data), + void *data); + +#endif diff --git a/udev/lib/libudev.pc.in b/udev/lib/libudev.pc.in new file mode 100644 index 0000000000..4d5a1d2500 --- /dev/null +++ b/udev/lib/libudev.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=@prefix@/@libdir_name@ +includedir=@prefix@/include + +Name: libudev +Description: Library to access udev device information +Version: @VERSION@ +Libs: -L${libdir} -ludev +Cflags: -I${includedir} diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c new file mode 100644 index 0000000000..e86c660e64 --- /dev/null +++ b/udev/lib/test-libudev.c @@ -0,0 +1,107 @@ +/* + * test-libudev + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include "config.h" + +#include +#include +#include "libudev.h" + +static void log_fn(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args) +{ + printf("test-libudev: %s %s:%d ", fn, file, line); + vprintf(format, args); +} + +static int devlinks_cb(struct udev_device *udev_device, const char *value, void *data) +{ + printf("link: %s\n", value); + return 0; +} + +static int devices_enum_cb(struct udev *udev, + const char *devpath, const char *subsystem, const char *name, + void *data) +{ + printf("device: %s (%s) %s\n", devpath, subsystem, name); + return 0; +} + +static int properties_cb(struct udev_device *udev_device, const char *key, const char *value, void *data) +{ + printf("property: %s=%s\n", key, value); + return 0; +} + +int main(int argc, char *argv[], char *envp[]) +{ + struct udev *udev; + struct udev_device *device; + const char *str; + const char *devpath = "/devices/virtual/mem/null"; + const char *subsystem = NULL; + + if (argv[1] != NULL) { + devpath = argv[1]; + if (argv[2] != NULL) + subsystem = argv[2]; + } + + udev = udev_new(); + printf("context: %p\n", udev); + if (udev == NULL) { + printf("no context\n"); + return 1; + } + udev_set_log_fn(udev, log_fn); + printf("set log: %p\n", log_fn); + + str = udev_get_sys_path(udev); + printf("sys_path: %s\n", str); + str = udev_get_dev_path(udev); + printf("dev_path: %s\n", str); + + printf("looking at device: %s\n", devpath); + device = udev_device_new_from_devpath(udev, devpath); + printf("device: %p\n", device); + if (device == NULL) { + printf("no device\n"); + return 1; + } + str = udev_device_get_devpath(device); + printf("devpath: %s\n", str); + str = udev_device_get_subsystem(device); + printf("subsystem: %s\n", str); + str = udev_device_get_devname(device); + printf("devname: %s\n", str); + udev_device_get_devlinks(device, devlinks_cb, NULL); + udev_device_get_properties(device, properties_cb, NULL); + udev_device_unref(device); + + if (subsystem == NULL) + printf("enumerating devices from all subsystems\n"); + else + printf("enumerating devices from subsystem: %s\n", subsystem); + udev_devices_enumerate(udev, subsystem, devices_enum_cb, NULL); + + udev_unref(udev); + return 0; +} -- cgit v1.2.3-54-g00ecf From eb1f0e6615642ec59b2c436d7f4589f7b738436e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 27 Aug 2008 22:02:41 +0200 Subject: libudev: split source files --- udev/lib/Makefile.am | 3 + udev/lib/libudev-device.c | 256 +++++++++++++++++++++++++++ udev/lib/libudev-enumerate.c | 190 ++++++++++++++++++++ udev/lib/libudev-private.h | 2 + udev/lib/libudev-utils.c | 53 ++++++ udev/lib/libudev.c | 400 ------------------------------------------- 6 files changed, 504 insertions(+), 400 deletions(-) create mode 100644 udev/lib/libudev-device.c create mode 100644 udev/lib/libudev-enumerate.c create mode 100644 udev/lib/libudev-utils.c diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 791191c643..2e5b81d4e4 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -21,6 +21,9 @@ include_HEADERS =\ libudev_la_SOURCES =\ libudev-private.h \ libudev.c \ + libudev-utils.c \ + libudev-device.c \ + libudev-enumerate.c \ ../list.h \ ../udev.h \ ../udev_utils.c \ diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c new file mode 100644 index 0000000000..805eef9467 --- /dev/null +++ b/udev/lib/libudev-device.c @@ -0,0 +1,256 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "../udev.h" + +static struct udev_device *device_init(struct udev *udev) +{ + struct udev_device *udev_device; + + udev_device = malloc(sizeof(struct udev_device)); + if (udev_device == NULL) + return NULL; + memset(udev_device, 0x00, sizeof(struct udev_device)); + udev_device->refcount = 1; + udev_device->udev = udev; + return udev_device; +} + +/** + * udev_device_new_from_devpath: + * @udev: udev library context + * @devpath: sys device path + * + * Create new udev device, and fill in information from the sysfs + * device and the udev database entry. The devpath must not contain + * the sysfs mount path, and must contain a leading '/'. + * + * The initial refcount is 1, and needs to be decremented to + * release the ressources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ +struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath) +{ + char path[PATH_SIZE]; + struct stat statbuf; + struct udev_device *udev_device; + int err; + + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + strlcat(path, devpath, sizeof(path)); + if (stat(path, &statbuf) != 0) + return NULL; + if (!S_ISDIR(statbuf.st_mode)) + return NULL; + + udev_device = device_init(udev); + if (udev_device == NULL) + return NULL; + + udev_device->udevice = udev_device_init(NULL); + if (udev_device->udevice == NULL) { + free(udev_device); + return NULL; + } + log_info(udev, "device %p created\n", udev_device); + + strlcpy(path, devpath, sizeof(path)); + sysfs_resolve_link(path, sizeof(path)); + + err = udev_db_get_device(udev_device->udevice, path); + if (err >= 0) + log_info(udev, "device %p filled with udev database data\n", udev_device); + log_info(udev, "device %p filled with %s data\n", udev_device, udev_device_get_devpath(udev_device)); + return udev_device; +} + +/** + * udev_device_get_udev: + * + * Retrieve the udev library context the device was created with. + * + * Returns: the udev library context + **/ +struct udev *udev_device_get_udev(struct udev_device *udev_device) +{ + return udev_device->udev; +} + +/** + * udev_device_ref: + * @udev_device: udev device + * + * Take a reference of a udev device. + * + * Returns: the passed udev device + **/ +struct udev_device *udev_device_ref(struct udev_device *udev_device) +{ + udev_device->refcount++; + return udev_device; +} + +/** + * udev_device_unref: + * @udev_device: udev device + * + * Drop a reference of a udev device. If the refcount reaches zero, + * the ressources of the device will be released. + * + **/ +void udev_device_unref(struct udev_device *udev_device) +{ + udev_device->refcount--; + if (udev_device->refcount > 0) + return; + udev_device_cleanup(udev_device->udevice); + free(udev_device); +} + +/** + * udev_device_get_devpath: + * @udev_device: udev device + * + * Retrieve the sys path of the udev device. The path does not contain + * the sys mount point. + * + * Returns: the sys path of the udev device + **/ +const char *udev_device_get_devpath(struct udev_device *udev_device) +{ + return udev_device->udevice->dev->devpath; +} + +/** + * udev_device_get_devname: + * @udev_device: udev device + * + * Retrieve the device node file name belonging to the udev device. + * The path does not contain the device directory, and does not contain + * a leading '/'. + * + * Returns: the device node file name of the udev device, or #NULL if no device node exists + **/ +const char *udev_device_get_devname(struct udev_device *udev_device) +{ + if (udev_device->udevice->name[0] == '\0') + return NULL; + return udev_device->udevice->name; +} + +/** + * udev_device_get_subsystem: + * @udev_device: udev device + * + * Retrieve the subsystem string of the udev device. The string does not + * contain any "/". + * + * Returns: the subsystem name of the udev device, or #NULL if it can not be determined + **/ +const char *udev_device_get_subsystem(struct udev_device *udev_device) +{ + struct sysfs_device *dev = udev_device->udevice->dev; + if (dev->subsystem[0] != '\0') + return dev->subsystem; + if (util_get_sys_subsystem(udev_device->udev, dev->devpath, + dev->subsystem, sizeof(dev->subsystem)) < 2) + return NULL; + return dev->subsystem; +} + +/** + * udev_device_get_devlinks: + * @udev_device: udev device + * @cb: function to be called for every device link found + * @data: data to be passed to the function + * + * Retrieve the device links pointing to the device file of the + * udev device. For every device link, the passed function will be + * called with the device link string. If the function returns 1, + * remaning device links will be ignored. The device link path + * does not contain the device directory, and does not contain + * a leading '/'. + * + * Returns: the number of device links passed to the caller, or a negative value on error + **/ +int udev_device_get_devlinks(struct udev_device *udev_device, + int (*cb)(struct udev_device *udev_device, const char *value, void *data), + void *data) +{ + struct name_entry *name_loop; + int count = 0; + + list_for_each_entry(name_loop, &udev_device->udevice->symlink_list, node) { + count++; + if (cb(udev_device, name_loop->name, data) != 0) + break; + } + return count; +} + +/** + * udev_device_get_properties: + * @udev_device: udev device + * @cb: function to be called for every property found + * @data: data to be passed to the function + * + * Retrieve the property key/value pairs belonging to the + * udev device. For every key/value pair, the passed function will be + * called. If the function returns 1, remaning properties will be + * ignored. + * + * Returns: the number of properties passed to the caller, or a negative value on error + **/ +int udev_device_get_properties(struct udev_device *udev_device, + int (*cb)(struct udev_device *udev_device, const char *key, const char *value, void *data), + void *data) +{ + struct name_entry *name_loop; + int count = 0; + + list_for_each_entry(name_loop, &udev_device->udevice->env_list, node) { + char name[PATH_SIZE]; + char *val; + + strncpy(name, name_loop->name, PATH_SIZE); + name[PATH_SIZE-1] = '\0'; + val = strchr(name, '='); + if (val == NULL) + continue; + val[0] = '\0'; + val = &val[1]; + if (cb(udev_device, name, val, data) != 0) + break; + } + return count; +} diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c new file mode 100644 index 0000000000..e3198665fc --- /dev/null +++ b/udev/lib/libudev-enumerate.c @@ -0,0 +1,190 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "../udev.h" + +static int devices_scan_subsystem(struct udev *udev, + const char *basedir, const char *subsystem, const char *subdir, + struct list_head *device_list) +{ + char path[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + size_t len; + + len = strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + strlcat(path, basedir, sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, subsystem, sizeof(path)); + if (subdir != NULL) + strlcat(path, subdir, sizeof(path)); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char devpath[PATH_SIZE]; + + if (dent->d_name[0] == '.') + continue; + strlcpy(devpath, &path[len], sizeof(devpath)); + strlcat(devpath, "/", sizeof(devpath)); + strlcat(devpath, dent->d_name, sizeof(devpath)); + sysfs_resolve_link(devpath, sizeof(devpath)); + name_list_add(device_list, devpath, 1); + } + closedir(dir); + return 0; +} + +static int devices_scan_subsystems(struct udev *udev, + const char *basedir, const char *subsystem, const char *subdir, + struct list_head *device_list) +{ + char path[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + if (subsystem != NULL) + return devices_scan_subsystem(udev, basedir, subsystem, subdir, device_list); + + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + strlcat(path, basedir, sizeof(path)); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + devices_scan_subsystem(udev, basedir, dent->d_name, subdir, device_list); + } + closedir(dir); + return 0; +} + +static int devices_delay(struct udev *udev, const char *devpath) +{ + static const char *delay_device_list[] = { + "/block/md", + "/block/dm-", + NULL + }; + int i; + + for (i = 0; delay_device_list[i] != NULL; i++) { + if (strstr(devpath, delay_device_list[i]) != NULL) { + log_info(udev, "delaying: %s\n", devpath); + return 1; + } + } + return 0; +} + +static int devices_call(struct udev *udev, const char *devpath, + int (*cb)(struct udev *udev, + const char *devpath, const char *subsystem, const char *name, + void *data), + void *data, + int *cb_rc) +{ + char subsystem[NAME_SIZE]; + const char *name; + + name = strrchr(devpath, '/'); + if (name == NULL) + return -1; + name++; + + if (util_get_sys_subsystem(udev, devpath, subsystem, sizeof(subsystem)) < 2) + return -1; + *cb_rc = cb(udev, devpath, subsystem, name, data); + return 0; +} + +/** + * udev_devices_enumerate: + * @udev_device: udev device + * @cb: function to be called for every property found + * @data: data to be passed to the function + * + * Retrieve the property key/value pairs belonging to the + * udev device. For every key/value pair, the passed function will be + * called. If the function returns 1, remaning properties will be + * ignored. + * + * Returns: the number of properties passed to the caller, or a negative value on error + **/ +int udev_devices_enumerate(struct udev *udev, const char *subsystem, + int (*cb)(struct udev *udev, + const char *devpath, const char *subsystem, const char *name, void *data), + void *data) +{ + char base[PATH_SIZE]; + struct stat statbuf; + struct list_head device_list; + struct name_entry *loop_device; + struct name_entry *tmp_device; + int cb_rc = 0; + int count = 0; + + INIT_LIST_HEAD(&device_list); + + /* if we have /sys/subsystem/, forget all the old stuff */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/subsystem", sizeof(base)); + if (stat(base, &statbuf) == 0) { + devices_scan_subsystems(udev, "/subsystem", subsystem, "/devices", &device_list); + } else { + devices_scan_subsystems(udev, "/bus", subsystem, "/devices", &device_list); + devices_scan_subsystems(udev, "/class", subsystem, NULL, &device_list); + } + + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { + if (devices_delay(udev, loop_device->name)) + continue; + if (cb_rc == 0) + if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) + count++; + list_del(&loop_device->node); + free(loop_device); + } + + /* handle remaining delayed devices */ + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { + if (cb_rc == 0) + if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) + count++; + list_del(&loop_device->node); + free(loop_device); + } + + return count; +} diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 8f7e247f58..4697f84da8 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -57,4 +57,6 @@ static inline void udev_log(struct udev *udev, __attribute__ ((format(printf, 6, 7))) {} #endif +extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); + #endif diff --git a/udev/lib/libudev-utils.c b/udev/lib/libudev-utils.c new file mode 100644 index 0000000000..8251b64da9 --- /dev/null +++ b/udev/lib/libudev-utils.c @@ -0,0 +1,53 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "../udev.h" + +ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size) +{ + char path[PATH_SIZE]; + ssize_t len; + const char *pos; + + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/subsystem", sizeof(path)); + len = readlink(path, path, sizeof(path)); + if (len < 0 || len >= (ssize_t) sizeof(path)) + return -1; + path[len] = '\0'; + pos = strrchr(path, '/'); + if (pos == NULL) + return -1; + pos = &pos[1]; + return strlcpy(subsystem, pos, size); +} diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 098ca8f602..56bd47741d 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -74,26 +74,6 @@ void log_message(int priority, const char *format, ...) } #endif -static ssize_t get_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size) -{ - char path[PATH_SIZE]; - ssize_t len; - const char *pos; - - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/subsystem", sizeof(path)); - len = readlink(path, path, sizeof(path)); - if (len < 0 || len >= (ssize_t) sizeof(path)) - return -1; - path[len] = '\0'; - pos = strrchr(path, '/'); - if (pos == NULL) - return -1; - pos = &pos[1]; - return strlcpy(subsystem, pos, size); -} - /** * udev_new: * @@ -201,383 +181,3 @@ const char *udev_get_dev_path(struct udev *udev) { return udev_root; } - -static struct udev_device *device_init(struct udev *udev) -{ - struct udev_device *udev_device; - - udev_device = malloc(sizeof(struct udev_device)); - if (udev_device == NULL) - return NULL; - memset(udev_device, 0x00, sizeof(struct udev_device)); - udev_device->refcount = 1; - udev_device->udev = udev; - return udev_device; -} - -/** - * udev_device_new_from_devpath: - * @udev: udev library context - * @devpath: sys device path - * - * Create new udev device, and fill in information from the sysfs - * device and the udev database entry. The devpath must not contain - * the sysfs mount path, and must contain a leading '/'. - * - * The initial refcount is 1, and needs to be decremented to - * release the ressources of the udev device. - * - * Returns: a new udev device, or #NULL, if it does not exist - **/ -struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath) -{ - char path[PATH_SIZE]; - struct stat statbuf; - struct udev_device *udev_device; - int err; - - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); - if (stat(path, &statbuf) != 0) - return NULL; - if (!S_ISDIR(statbuf.st_mode)) - return NULL; - - udev_device = device_init(udev); - if (udev_device == NULL) - return NULL; - - udev_device->udevice = udev_device_init(NULL); - if (udev_device->udevice == NULL) { - free(udev_device); - return NULL; - } - log_info(udev, "device %p created\n", udev_device); - - strlcpy(path, devpath, sizeof(path)); - sysfs_resolve_link(path, sizeof(path)); - - err = udev_db_get_device(udev_device->udevice, path); - if (err >= 0) - log_info(udev, "device %p filled with udev database data\n", udev_device); - log_info(udev, "device %p filled with %s data\n", udev_device, udev_device_get_devpath(udev_device)); - return udev_device; -} - -/** - * udev_device_get_udev: - * - * Retrieve the udev library context the device was created with. - * - * Returns: the udev library context - **/ -struct udev *udev_device_get_udev(struct udev_device *udev_device) -{ - return udev_device->udev; -} - -/** - * udev_device_ref: - * @udev_device: udev device - * - * Take a reference of a udev device. - * - * Returns: the passed udev device - **/ -struct udev_device *udev_device_ref(struct udev_device *udev_device) -{ - udev_device->refcount++; - return udev_device; -} - -/** - * udev_device_unref: - * @udev_device: udev device - * - * Drop a reference of a udev device. If the refcount reaches zero, - * the ressources of the device will be released. - * - **/ -void udev_device_unref(struct udev_device *udev_device) -{ - udev_device->refcount--; - if (udev_device->refcount > 0) - return; - udev_device_cleanup(udev_device->udevice); - free(udev_device); -} - -/** - * udev_device_get_devpath: - * @udev_device: udev device - * - * Retrieve the sys path of the udev device. The path does not contain - * the sys mount point. - * - * Returns: the sys path of the udev device - **/ -const char *udev_device_get_devpath(struct udev_device *udev_device) -{ - return udev_device->udevice->dev->devpath; -} - -/** - * udev_device_get_devname: - * @udev_device: udev device - * - * Retrieve the device node file name belonging to the udev device. - * The path does not contain the device directory, and does not contain - * a leading '/'. - * - * Returns: the device node file name of the udev device, or #NULL if no device node exists - **/ -const char *udev_device_get_devname(struct udev_device *udev_device) -{ - if (udev_device->udevice->name[0] == '\0') - return NULL; - return udev_device->udevice->name; -} - -/** - * udev_device_get_subsystem: - * @udev_device: udev device - * - * Retrieve the subsystem string of the udev device. The string does not - * contain any "/". - * - * Returns: the subsystem name of the udev device, or #NULL if it can not be determined - **/ -const char *udev_device_get_subsystem(struct udev_device *udev_device) -{ - struct sysfs_device *dev = udev_device->udevice->dev; - if (dev->subsystem[0] != '\0') - return dev->subsystem; - if (get_subsystem(udev_device->udev, dev->devpath, - dev->subsystem, sizeof(dev->subsystem)) < 2) - return NULL; - return dev->subsystem; -} - -/** - * udev_device_get_devlinks: - * @udev_device: udev device - * @cb: function to be called for every device link found - * @data: data to be passed to the function - * - * Retrieve the device links pointing to the device file of the - * udev device. For every device link, the passed function will be - * called with the device link string. If the function returns 1, - * remaning device links will be ignored. The device link path - * does not contain the device directory, and does not contain - * a leading '/'. - * - * Returns: the number of device links passed to the caller, or a negative value on error - **/ -int udev_device_get_devlinks(struct udev_device *udev_device, - int (*cb)(struct udev_device *udev_device, const char *value, void *data), - void *data) -{ - struct name_entry *name_loop; - int count = 0; - - list_for_each_entry(name_loop, &udev_device->udevice->symlink_list, node) { - count++; - if (cb(udev_device, name_loop->name, data) != 0) - break; - } - return count; -} - -/** - * udev_device_get_properties: - * @udev_device: udev device - * @cb: function to be called for every property found - * @data: data to be passed to the function - * - * Retrieve the property key/value pairs belonging to the - * udev device. For every key/value pair, the passed function will be - * called. If the function returns 1, remaning properties will be - * ignored. - * - * Returns: the number of properties passed to the caller, or a negative value on error - **/ -int udev_device_get_properties(struct udev_device *udev_device, - int (*cb)(struct udev_device *udev_device, const char *key, const char *value, void *data), - void *data) -{ - struct name_entry *name_loop; - int count = 0; - - list_for_each_entry(name_loop, &udev_device->udevice->env_list, node) { - char name[PATH_SIZE]; - char *val; - - strncpy(name, name_loop->name, PATH_SIZE); - name[PATH_SIZE-1] = '\0'; - val = strchr(name, '='); - if (val == NULL) - continue; - val[0] = '\0'; - val = &val[1]; - if (cb(udev_device, name, val, data) != 0) - break; - } - return count; -} - -static int devices_scan_subsystem(struct udev *udev, - const char *basedir, const char *subsystem, const char *subdir, - struct list_head *device_list) -{ - char path[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - size_t len; - - len = strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, basedir, sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, subsystem, sizeof(path)); - if (subdir != NULL) - strlcat(path, subdir, sizeof(path)); - dir = opendir(path); - if (dir == NULL) - return -1; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char devpath[PATH_SIZE]; - - if (dent->d_name[0] == '.') - continue; - strlcpy(devpath, &path[len], sizeof(devpath)); - strlcat(devpath, "/", sizeof(devpath)); - strlcat(devpath, dent->d_name, sizeof(devpath)); - sysfs_resolve_link(devpath, sizeof(devpath)); - name_list_add(device_list, devpath, 1); - } - closedir(dir); - return 0; -} - -static int devices_scan_subsystems(struct udev *udev, - const char *basedir, const char *subsystem, const char *subdir, - struct list_head *device_list) -{ - char path[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - if (subsystem != NULL) - return devices_scan_subsystem(udev, basedir, subsystem, subdir, device_list); - - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, basedir, sizeof(path)); - dir = opendir(path); - if (dir == NULL) - return -1; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - if (dent->d_name[0] == '.') - continue; - devices_scan_subsystem(udev, basedir, dent->d_name, subdir, device_list); - } - closedir(dir); - return 0; -} - -static int devices_delay(struct udev *udev, const char *devpath) -{ - static const char *delay_device_list[] = { - "/block/md", - "/block/dm-", - NULL - }; - int i; - - for (i = 0; delay_device_list[i] != NULL; i++) { - if (strstr(devpath, delay_device_list[i]) != NULL) { - log_info(udev, "delaying: %s\n", devpath); - return 1; - } - } - return 0; -} - -static int devices_call(struct udev *udev, const char *devpath, - int (*cb)(struct udev *udev, - const char *devpath, const char *subsystem, const char *name, - void *data), - void *data, - int *cb_rc) -{ - char subsystem[NAME_SIZE]; - const char *name; - - name = strrchr(devpath, '/'); - if (name == NULL) - return -1; - name++; - - if (get_subsystem(udev, devpath, subsystem, sizeof(subsystem)) < 2) - return -1; - *cb_rc = cb(udev, devpath, subsystem, name, data); - return 0; -} - -/** - * udev_devices_enumerate: - * @udev_device: udev device - * @cb: function to be called for every property found - * @data: data to be passed to the function - * - * Retrieve the property key/value pairs belonging to the - * udev device. For every key/value pair, the passed function will be - * called. If the function returns 1, remaning properties will be - * ignored. - * - * Returns: the number of properties passed to the caller, or a negative value on error - **/ -int udev_devices_enumerate(struct udev *udev, const char *subsystem, - int (*cb)(struct udev *udev, - const char *devpath, const char *subsystem, const char *name, void *data), - void *data) -{ - char base[PATH_SIZE]; - struct stat statbuf; - struct list_head device_list; - struct name_entry *loop_device; - struct name_entry *tmp_device; - int cb_rc = 0; - int count = 0; - - INIT_LIST_HEAD(&device_list); - - /* if we have /sys/subsystem/, forget all the old stuff */ - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/subsystem", sizeof(base)); - if (stat(base, &statbuf) == 0) { - devices_scan_subsystems(udev, "/subsystem", subsystem, "/devices", &device_list); - } else { - devices_scan_subsystems(udev, "/bus", subsystem, "/devices", &device_list); - devices_scan_subsystems(udev, "/class", subsystem, NULL, &device_list); - } - - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (devices_delay(udev, loop_device->name)) - continue; - if (cb_rc == 0) - if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) - count++; - list_del(&loop_device->node); - free(loop_device); - } - - /* handle remaining delayed devices */ - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (cb_rc == 0) - if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) - count++; - list_del(&loop_device->node); - free(loop_device); - } - - return count; -} -- cgit v1.2.3-54-g00ecf From 530fc1f526ee04360f6937812b31cc1df526e505 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 28 Aug 2008 22:58:03 +0200 Subject: update INSTALL --- INSTALL | 61 +++++++++++++++++++++++++++++++++++++------------------------ autogen.sh | 1 + 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/INSTALL b/INSTALL index 17cd7b683f..743580c21e 100644 --- a/INSTALL +++ b/INSTALL @@ -1,36 +1,49 @@ +Usual options for udev installed in the root filesystem are: ./configure - --prefix= - "/usr" - prefix for man pages, include files + --prefix=/usr --exec-prefix= - "" - the root filesystem, prefix for libs and binaries - --sysconfdir= - "/etc" - --with-libdir-name= - "lib" - directory name for libraries, not a path name - multilib 64bit systems may use "lib64" instead of "lib" - --enable-debug - compile-in verbose debug messages - --disable-logging - disable all logging and compile-out all log strings + --sysconfdir=/etc +For 64bit multilib-installations also: + --with-libdir-name=lib64 +For SELinux support: --with-selinux - link against SELInux libraries to set the expected context - for created files -The installation directories are controlled by $prefix, $exec_prefix -$sysconfdir and $libdir-name. Documentation, development files are -installed below $prefix, binaries are installed below $exec_prefix, -libraries below $exec_prefix/$libdir-name. +All options: + --prefix= + Prefix for man pages, include files. + --exec-prefix= + Prefix for libs, binaries, usually the root filesystem. + --with-udev-prefix= + Prefix for internal udev path names, like /dev/, /lib/udev/. + Only useful for testing and development installations. The + value is copied from exec-prefix, if not specified otherwise. + --sysconfdir= + Usually /etc. + --with-libdir-name= + Directory name for libraries. This is not a path name. + --enable-debug + Compile-in verbose debug messages. Usually not needed, + it increases the size of the binaries. + --disable-logging + Disable all logging and compile-out all log strings. This + is not recommended, as it makes it almost impossible to debug + udev in the running system. + --with-selinux + Link against SELInux libraries to set the expected context + for created files. -The default configuration for a RPM spec file may look like: +The options used in a RPM spec file usually look like: --prefix=%{_prefix} - --exec-prefix="" + --exec-prefix= --sysconfdir=%{_sysconfdir} --with-libdir-name=%{_lib} + --with-selinux -The well defined location for scripts and binaries which are called -from rules is /lib/udev/ on all systems and architectures, anything -else is broken. Other packages who use udev, may use the /lib/udev/ -directory to install their rule helper and udev rule files. +The defined location for scripts and binaries which are called +from rules is /lib/udev/ on all systems and architectures. Any +other location will break other packages, who rightfully expect +the /lib/udev/ directory, to install their rule helper and udev +rule files. It is recommended to use the /lib/udev/devices/ directory to place device nodes, directories and symlinks, which are copied to /dev/ diff --git a/autogen.sh b/autogen.sh index 4ec4e0551a..234e82902c 100755 --- a/autogen.sh +++ b/autogen.sh @@ -43,6 +43,7 @@ automake --add-missing if test -z "$@"; then args="--prefix=/usr --exec-prefix= --sysconfdir=/etc" + args="$args --with-libdir-name=$(basename $(gcc -print-multi-os-directory))" export CFLAGS="-g -Wall \ -Wmissing-declarations -Wmissing-prototypes \ -Wnested-externs -Wpointer-arith \ -- cgit v1.2.3-54-g00ecf From ba6929f6690a72485ac3c6b7610ffbd5ab319be7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 28 Aug 2008 23:05:01 +0200 Subject: libudev: add udev event monitor API --- NEWS | 7 ++ udev/lib/Makefile.am | 1 + udev/lib/exported_symbols | 6 ++ udev/lib/libudev-device.c | 98 +++++++++++++++----- udev/lib/libudev-monitor.c | 216 +++++++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev-private.h | 14 ++- udev/lib/libudev.c | 15 ++++ udev/lib/libudev.h | 8 ++ udev/lib/test-libudev.c | 139 ++++++++++++++++++++++------- 9 files changed, 441 insertions(+), 63 deletions(-) create mode 100644 udev/lib/libudev-monitor.c diff --git a/NEWS b/NEWS index 016ec198e8..1a9aa69059 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ udev 127 ======== Bugfixes. +A shared library "libudev" will be installed now, to access udev +device information. DeviceKit, the successor of HAL, will need this +library to access the udev database and search sysfs for devices. +The library is currently in an experimental state, also the API is +expected to change, as long as the DeviceKit integration isn't +finished. + udev 126 ======== We use ./configure now. See INSTALL for details. Current diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 2e5b81d4e4..a1fd77b87b 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -24,6 +24,7 @@ libudev_la_SOURCES =\ libudev-utils.c \ libudev-device.c \ libudev-enumerate.c \ + libudev-monitor.c \ ../list.h \ ../udev.h \ ../udev_utils.c \ diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index c3a7cafe00..0826e6f6f1 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -15,3 +15,9 @@ udev_device_get_subsystem udev_device_get_devlinks udev_device_get_properties udev_devices_enumerate +udev_monitor_new_from_socket +udev_monitor_ref +udev_monitor_unref +udev_monitor_get_udev +udev_monitor_get_fd +udev_monitor_get_device diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 805eef9467..f6ad541de4 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -32,16 +32,22 @@ #include "libudev-private.h" #include "../udev.h" -static struct udev_device *device_init(struct udev *udev) +struct udev_device *device_init(struct udev *udev) { struct udev_device *udev_device; + if (udev == NULL) + return NULL; + udev_device = malloc(sizeof(struct udev_device)); if (udev_device == NULL) return NULL; memset(udev_device, 0x00, sizeof(struct udev_device)); udev_device->refcount = 1; udev_device->udev = udev; + INIT_LIST_HEAD(&udev_device->link_list); + INIT_LIST_HEAD(&udev_device->env_list); + log_info(udev_device->udev, "udev_device: %p created\n", udev_device); return udev_device; } @@ -64,8 +70,15 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * char path[PATH_SIZE]; struct stat statbuf; struct udev_device *udev_device; + struct udevice *udevice; + struct name_entry *name_loop; int err; + if (udev == NULL) + return NULL; + if (devpath == NULL) + return NULL; + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); strlcat(path, devpath, sizeof(path)); if (stat(path, &statbuf) != 0) @@ -77,20 +90,38 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * if (udev_device == NULL) return NULL; - udev_device->udevice = udev_device_init(NULL); - if (udev_device->udevice == NULL) { + udevice = udev_device_init(NULL); + if (udevice == NULL) { free(udev_device); return NULL; } - log_info(udev, "device %p created\n", udev_device); + /* resolve possible symlink to real path */ strlcpy(path, devpath, sizeof(path)); sysfs_resolve_link(path, sizeof(path)); + udev_device->devpath = strdup(path); + log_info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); - err = udev_db_get_device(udev_device->udevice, path); + err = udev_db_get_device(udevice, path); if (err >= 0) log_info(udev, "device %p filled with udev database data\n", udev_device); - log_info(udev, "device %p filled with %s data\n", udev_device, udev_device_get_devpath(udev_device)); + + if (udevice->name[0] != '\0') + asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev), udevice->name); + + list_for_each_entry(name_loop, &udevice->symlink_list, node) { + char name[PATH_SIZE]; + + strlcpy(name, udev_get_dev_path(udev), sizeof(name)); + strlcat(name, "/", sizeof(name)); + strlcat(name, name_loop->name, sizeof(name)); + name_list_add(&udev_device->link_list, name, 0); + } + + list_for_each_entry(name_loop, &udevice->env_list, node) + name_list_add(&udev_device->env_list, name_loop->name, 0); + + udev_device_cleanup(udevice); return udev_device; } @@ -103,6 +134,8 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * **/ struct udev *udev_device_get_udev(struct udev_device *udev_device) { + if (udev_device == NULL) + return NULL; return udev_device->udev; } @@ -116,6 +149,8 @@ struct udev *udev_device_get_udev(struct udev_device *udev_device) **/ struct udev_device *udev_device_ref(struct udev_device *udev_device) { + if (udev_device == NULL) + return NULL; udev_device->refcount++; return udev_device; } @@ -130,10 +165,17 @@ struct udev_device *udev_device_ref(struct udev_device *udev_device) **/ void udev_device_unref(struct udev_device *udev_device) { + if (udev_device == NULL) + return; udev_device->refcount--; if (udev_device->refcount > 0) return; - udev_device_cleanup(udev_device->udevice); + free(udev_device->devpath); + free(udev_device->devname); + free(udev_device->subsystem); + name_list_cleanup(&udev_device->link_list); + name_list_cleanup(&udev_device->env_list); + log_info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } @@ -148,7 +190,9 @@ void udev_device_unref(struct udev_device *udev_device) **/ const char *udev_device_get_devpath(struct udev_device *udev_device) { - return udev_device->udevice->dev->devpath; + if (udev_device == NULL) + return NULL; + return udev_device->devpath; } /** @@ -156,16 +200,15 @@ const char *udev_device_get_devpath(struct udev_device *udev_device) * @udev_device: udev device * * Retrieve the device node file name belonging to the udev device. - * The path does not contain the device directory, and does not contain - * a leading '/'. + * The path is an absolute path, and starts with the device directory. * * Returns: the device node file name of the udev device, or #NULL if no device node exists **/ const char *udev_device_get_devname(struct udev_device *udev_device) { - if (udev_device->udevice->name[0] == '\0') + if (udev_device == NULL) return NULL; - return udev_device->udevice->name; + return udev_device->devname; } /** @@ -179,13 +222,16 @@ const char *udev_device_get_devname(struct udev_device *udev_device) **/ const char *udev_device_get_subsystem(struct udev_device *udev_device) { - struct sysfs_device *dev = udev_device->udevice->dev; - if (dev->subsystem[0] != '\0') - return dev->subsystem; - if (util_get_sys_subsystem(udev_device->udev, dev->devpath, - dev->subsystem, sizeof(dev->subsystem)) < 2) + char subsystem[NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (udev_device->subsystem != NULL) + return udev_device->subsystem; + if (util_get_sys_subsystem(udev_device->udev, udev_device->devpath, subsystem, sizeof(subsystem)) < 2) return NULL; - return dev->subsystem; + udev_device->subsystem = strdup(subsystem); + return udev_device->subsystem; } /** @@ -196,10 +242,9 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) * * Retrieve the device links pointing to the device file of the * udev device. For every device link, the passed function will be - * called with the device link string. If the function returns 1, - * remaning device links will be ignored. The device link path - * does not contain the device directory, and does not contain - * a leading '/'. + * called with the device link string. + * The path is an absolute path, and starts with the device directory. + * If the function returns 1, remaning device links will be ignored. * * Returns: the number of device links passed to the caller, or a negative value on error **/ @@ -210,7 +255,9 @@ int udev_device_get_devlinks(struct udev_device *udev_device, struct name_entry *name_loop; int count = 0; - list_for_each_entry(name_loop, &udev_device->udevice->symlink_list, node) { + if (udev_device == NULL) + return -1; + list_for_each_entry(name_loop, &udev_device->link_list, node) { count++; if (cb(udev_device, name_loop->name, data) != 0) break; @@ -238,7 +285,9 @@ int udev_device_get_properties(struct udev_device *udev_device, struct name_entry *name_loop; int count = 0; - list_for_each_entry(name_loop, &udev_device->udevice->env_list, node) { + if (udev_device == NULL) + return -1; + list_for_each_entry(name_loop, &udev_device->env_list, node) { char name[PATH_SIZE]; char *val; @@ -249,6 +298,7 @@ int udev_device_get_properties(struct udev_device *udev_device, continue; val[0] = '\0'; val = &val[1]; + count++; if (cb(udev_device, name, val, data) != 0) break; } diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c new file mode 100644 index 0000000000..fbb21d04ea --- /dev/null +++ b/udev/lib/libudev-monitor.c @@ -0,0 +1,216 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "../udev.h" + +struct udev_monitor { + struct udev *udev; + int refcount; + int socket; +}; + +struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) +{ + struct udev_monitor *udev_monitor; + struct sockaddr_un saddr; + socklen_t addrlen; + const int on = 1; + + if (udev == NULL) + return NULL; + if (socket_path == NULL) + return NULL; + udev_monitor = malloc(sizeof(struct udev_monitor)); + if (udev_monitor == NULL) + return NULL; + memset(udev_monitor, 0x00, sizeof(struct udev_monitor)); + udev_monitor->refcount = 1; + udev_monitor->udev = udev; + + memset(&saddr, 0x00, sizeof(saddr)); + saddr.sun_family = AF_LOCAL; + strcpy(saddr.sun_path, socket_path); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); + + /* translate leading '@' to abstract namespace */ + if (saddr.sun_path[0] == '@') + saddr.sun_path[0] = '\0'; + + udev_monitor->socket = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udev_monitor->socket == -1) { + log_err(udev, "error getting socket: %s\n", strerror(errno)); + free(udev_monitor); + return NULL; + } + + if (bind(udev_monitor->socket, (struct sockaddr *) &saddr, addrlen) < 0) { + log_err(udev, "bind failed: %s\n", strerror(errno)); + close(udev_monitor->socket); + free(udev_monitor); + return NULL; + } + + /* enable receiving of the sender credentials */ + setsockopt(udev_monitor->socket, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + log_info(udev_monitor->udev, "udev_monitor: %p created\n", udev_monitor); + + return udev_monitor; +} + +struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return NULL; + udev_monitor->refcount++; + return udev_monitor; +} + +void udev_monitor_unref(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return; + udev_monitor->refcount--; + if (udev_monitor->refcount > 0) + return; + close(udev_monitor->socket); + log_info(udev_monitor->udev, "udev_monitor: %p released\n", udev_monitor); + free(udev_monitor); +} + +struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return NULL; + return udev_monitor->udev; +} + +int udev_monitor_get_fd(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return -1; + return udev_monitor->socket; +} + +struct udev_device *udev_monitor_get_device(struct udev_monitor *udev_monitor) +{ + struct udev_device *udev_device; + struct msghdr smsg; + struct cmsghdr *cmsg; + struct iovec iov; + struct ucred *cred; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + char buf[4096]; + size_t bufpos; + + if (udev_monitor == NULL) + return NULL; + memset(buf, 0x00, sizeof(buf)); + iov.iov_base = &buf; + iov.iov_len = sizeof(buf); + memset (&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + + if (recvmsg(udev_monitor->socket, &smsg, 0) < 0) { + if (errno != EINTR) + log_info(udev_monitor->udev, "unable to receive message"); + return NULL; + } + cmsg = CMSG_FIRSTHDR(&smsg); + cred = (struct ucred *)CMSG_DATA (cmsg); + + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + log_info(udev_monitor->udev, "no sender credentials received, message ignored"); + return NULL; + } + + if (cred->uid != 0) { + log_info(udev_monitor->udev, "sender uid=%d, message ignored", cred->uid); + return NULL; + } + + /* skip header */ + bufpos = strlen(buf) + 1; + if (bufpos < sizeof("a@/d") || bufpos >= sizeof(buf)) { + log_info(udev_monitor->udev, "invalid message length"); + return NULL; + } + + /* check message header */ + if (strstr(buf, "@/") == NULL) { + log_info(udev_monitor->udev, "unrecognized message header"); + return NULL; + } + + udev_device = device_init(udev_monitor->udev); + if (udev_device == NULL) { + return NULL; + } + + while (bufpos < sizeof(buf)) { + char *key; + size_t keylen; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + bufpos += keylen + 1; + + if (strncmp(key, "DEVPATH=", 8) == 0) { + udev_device->devpath = strdup(&key[8]); + } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { + udev_device->subsystem = strdup(&key[10]); + } else if (strncmp(key, "DEVNAME=", 8) == 0) { + udev_device->devname = strdup(&key[8]); + } else if (strncmp(key, "DEVLINKS=", 9) == 0) { + char *slink = &key[9]; + char *next = strchr(slink, ' '); + + while (next != NULL) { + next[0] = '\0'; + name_list_add(&udev_device->link_list, slink, 0); + slink = &next[1]; + next = strchr(slink, ' '); + } + if (slink[0] != '\0') + name_list_add(&udev_device->link_list, slink, 0); + } + name_list_add(&udev_device->env_list, key, 0); + } + + return udev_device; +} diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 4697f84da8..7e7d1c6324 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -23,17 +23,14 @@ #include "libudev.h" #include "../udev.h" -struct udev { - int refcount; - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args); -}; - struct udev_device { int refcount; struct udev *udev; - struct udevice *udevice; + char *devpath; + char *devname; + char *subsystem; + struct list_head link_list; + struct list_head env_list; }; #ifdef USE_LOG @@ -57,6 +54,7 @@ static inline void udev_log(struct udev *udev, __attribute__ ((format(printf, 6, 7))) {} #endif +extern struct udev_device *device_init(struct udev *udev); extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); #endif diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 56bd47741d..a5f33eb08f 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -32,6 +32,13 @@ #include "libudev-private.h" #include "../udev.h" +struct udev { + int refcount; + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args); +}; + void udev_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, ...) @@ -110,6 +117,8 @@ struct udev *udev_new(void) **/ struct udev *udev_ref(struct udev *udev) { + if (udev == NULL) + return NULL; udev->refcount++; return udev; } @@ -124,6 +133,8 @@ struct udev *udev_ref(struct udev *udev) **/ void udev_unref(struct udev *udev) { + if (udev == NULL) + return; udev->refcount--; if (udev->refcount > 0) return; @@ -164,6 +175,8 @@ void udev_set_log_fn(struct udev *udev, **/ const char *udev_get_sys_path(struct udev *udev) { + if (udev == NULL) + return NULL; return sysfs_path; } @@ -179,5 +192,7 @@ const char *udev_get_sys_path(struct udev *udev) **/ const char *udev_get_dev_path(struct udev *udev) { + if (udev == NULL) + return NULL; return udev_root; } diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index e740f3670e..1eb3745e6f 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -22,6 +22,7 @@ struct udev; struct udev_device; +struct udev_monitor; extern struct udev *udev_new(void); extern struct udev *udev_ref(struct udev *udev); @@ -54,4 +55,11 @@ extern int udev_devices_enumerate(struct udev *udev, const char *subsystem, const char *devpath, const char *subsystem, const char *name, void *data), void *data); +extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); +extern struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); +extern void udev_monitor_unref(struct udev_monitor *udev_monitor); +extern struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); +extern int udev_monitor_get_fd(struct udev_monitor *udev_monitor); +extern struct udev_device *udev_monitor_get_device(struct udev_monitor *udev_monitor); + #endif diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index e86c660e64..3c38600192 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -21,6 +21,11 @@ #include #include +#include +#include +#include +#include + #include "libudev.h" static void log_fn(struct udev *udev, @@ -31,9 +36,49 @@ static void log_fn(struct udev *udev, vprintf(format, args); } -static int devlinks_cb(struct udev_device *udev_device, const char *value, void *data) +static int print_devlinks_cb(struct udev_device *udev_device, const char *value, void *data) { - printf("link: %s\n", value); + printf("link: '%s'\n", value); + return 0; +} + +static int print_properties_cb(struct udev_device *udev_device, const char *key, const char *value, void *data) +{ + printf("property: '%s=%s'\n", key, value); + return 0; +} + +static void print_device(struct udev_device *device) +{ + const char *str; + int count; + + printf("*** device: %p ***\n", device); + str = udev_device_get_devpath(device); + printf("devpath: '%s'\n", str); + str = udev_device_get_subsystem(device); + printf("subsystem: '%s'\n", str); + str = udev_device_get_devname(device); + printf("devname: '%s'\n", str); + count = udev_device_get_devlinks(device, print_devlinks_cb, NULL); + printf("found %i links\n", count); + count = udev_device_get_properties(device, print_properties_cb, NULL); + printf("found %i properties\n", count); + printf("\n"); +} + +static int test_device(struct udev *udev, const char *devpath) +{ + struct udev_device *device; + + printf("looking at device: %s\n", devpath); + device = udev_device_new_from_devpath(udev, devpath); + if (device == NULL) { + printf("no device\n"); + return -1; + } + print_device(device); + udev_device_unref(device); return 0; } @@ -41,28 +86,79 @@ static int devices_enum_cb(struct udev *udev, const char *devpath, const char *subsystem, const char *name, void *data) { - printf("device: %s (%s) %s\n", devpath, subsystem, name); + printf("device: '%s' (%s) '%s'\n", devpath, subsystem, name); return 0; } -static int properties_cb(struct udev_device *udev_device, const char *key, const char *value, void *data) +static int test_enumerate(struct udev *udev, const char *subsystem) { - printf("property: %s=%s\n", key, value); + int count; + + count = udev_devices_enumerate(udev, subsystem, devices_enum_cb, NULL); + printf("found %i devices\n\n", count); + return count; +} + +static int test_monitor(struct udev *udev, const char *socket_path) +{ + struct udev_monitor *udev_monitor; + fd_set readfds; + int fd; + + udev_monitor = udev_monitor_new_from_socket(udev, socket_path); + if (udev_monitor == NULL) { + printf("no socket\n"); + return -1; + } + + fd = udev_monitor_get_fd(udev_monitor); + FD_ZERO(&readfds); + + while (1) { + struct udev_device *device; + int fdcount; + + FD_SET(STDIN_FILENO, &readfds); + FD_SET(fd, &readfds); + + printf("waiting for events on %s, press ENTER to exit\n", socket_path); + fdcount = select(fd+1, &readfds, NULL, NULL, NULL); + printf("select fd count: %i\n", fdcount); + + if (FD_ISSET(fd, &readfds)) { + device = udev_monitor_get_device(udev_monitor); + if (device == NULL) { + printf("no device from socket\n"); + continue; + } + print_device(device); + udev_device_unref(device); + } + + if (FD_ISSET(STDIN_FILENO, &readfds)) { + printf("exiting loop\n"); + break; + } + } + + udev_monitor_unref(udev_monitor); return 0; } int main(int argc, char *argv[], char *envp[]) { struct udev *udev; - struct udev_device *device; - const char *str; const char *devpath = "/devices/virtual/mem/null"; const char *subsystem = NULL; + const char *socket = "@/org/kernel/udev/monitor"; + const char *str; if (argv[1] != NULL) { devpath = argv[1]; if (argv[2] != NULL) subsystem = argv[2]; + if (argv[3] != NULL) + socket = argv[3]; } udev = udev_new(); @@ -75,32 +171,13 @@ int main(int argc, char *argv[], char *envp[]) printf("set log: %p\n", log_fn); str = udev_get_sys_path(udev); - printf("sys_path: %s\n", str); + printf("sys_path: '%s'\n", str); str = udev_get_dev_path(udev); - printf("dev_path: %s\n", str); - - printf("looking at device: %s\n", devpath); - device = udev_device_new_from_devpath(udev, devpath); - printf("device: %p\n", device); - if (device == NULL) { - printf("no device\n"); - return 1; - } - str = udev_device_get_devpath(device); - printf("devpath: %s\n", str); - str = udev_device_get_subsystem(device); - printf("subsystem: %s\n", str); - str = udev_device_get_devname(device); - printf("devname: %s\n", str); - udev_device_get_devlinks(device, devlinks_cb, NULL); - udev_device_get_properties(device, properties_cb, NULL); - udev_device_unref(device); + printf("dev_path: '%s'\n", str); - if (subsystem == NULL) - printf("enumerating devices from all subsystems\n"); - else - printf("enumerating devices from subsystem: %s\n", subsystem); - udev_devices_enumerate(udev, subsystem, devices_enum_cb, NULL); + test_device(udev, devpath); + test_enumerate(udev, subsystem); + test_monitor(udev, socket); udev_unref(udev); return 0; -- cgit v1.2.3-54-g00ecf From 2603474ff9be2418900581da1af5cccc9f13cae1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 28 Aug 2008 23:39:41 +0200 Subject: volume_id: remove deprecated functions and bump major version --- configure.ac | 4 +- extras/volume_id/lib/Makefile.am | 1 + extras/volume_id/lib/adaptec_raid.c | 1 + extras/volume_id/lib/cramfs.c | 1 + extras/volume_id/lib/ddf_raid.c | 1 + extras/volume_id/lib/exported_symbols | 39 ----------- extras/volume_id/lib/ext.c | 1 + extras/volume_id/lib/fat.c | 1 + extras/volume_id/lib/gfs.c | 1 + extras/volume_id/lib/hfs.c | 1 + extras/volume_id/lib/highpoint.c | 1 + extras/volume_id/lib/hpfs.c | 1 + extras/volume_id/lib/iso9660.c | 1 + extras/volume_id/lib/isw_raid.c | 1 + extras/volume_id/lib/jfs.c | 1 + extras/volume_id/lib/jmicron_raid.c | 1 + extras/volume_id/lib/libvolume_id-private.h | 103 ++++++++++++++++++++++++++++ extras/volume_id/lib/libvolume_id.h | 95 +------------------------ extras/volume_id/lib/linux_raid.c | 1 + extras/volume_id/lib/linux_swap.c | 1 + extras/volume_id/lib/lsi_raid.c | 1 + extras/volume_id/lib/luks.c | 1 + extras/volume_id/lib/lvm.c | 1 + extras/volume_id/lib/minix.c | 1 + extras/volume_id/lib/netware.c | 1 + extras/volume_id/lib/ntfs.c | 1 + extras/volume_id/lib/nvidia_raid.c | 1 + extras/volume_id/lib/ocfs.c | 1 + extras/volume_id/lib/oracleasm.c | 1 + extras/volume_id/lib/promise_raid.c | 1 + extras/volume_id/lib/reiserfs.c | 1 + extras/volume_id/lib/romfs.c | 1 + extras/volume_id/lib/silicon_raid.c | 1 + extras/volume_id/lib/squashfs.c | 1 + extras/volume_id/lib/sysv.c | 1 + extras/volume_id/lib/udf.c | 1 + extras/volume_id/lib/ufs.c | 1 + extras/volume_id/lib/util.c | 1 + extras/volume_id/lib/via_raid.c | 1 + extras/volume_id/lib/volume_id.c | 22 +----- extras/volume_id/lib/vxfs.c | 1 + extras/volume_id/lib/xfs.c | 1 + 42 files changed, 145 insertions(+), 155 deletions(-) create mode 100644 extras/volume_id/lib/libvolume_id-private.h diff --git a/configure.ac b/configure.ac index 4be3ed583a..a98d903c21 100644 --- a/configure.ac +++ b/configure.ac @@ -18,8 +18,8 @@ AC_SUBST(LIBUDEV_LT_REVISION) AC_SUBST(LIBUDEV_LT_AGE) dnl /* libvolume_id version */ -VOLID_LT_CURRENT=0 -VOLID_LT_REVISION=86 +VOLID_LT_CURRENT=1 +VOLID_LT_REVISION=0 VOLID_LT_AGE=0 AC_SUBST(VOLID_LT_CURRENT) AC_SUBST(VOLID_LT_REVISION) diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am index 6313962e68..f9c6fbe306 100644 --- a/extras/volume_id/lib/Makefile.am +++ b/extras/volume_id/lib/Makefile.am @@ -6,6 +6,7 @@ include_HEADERS =\ libvolume_id.h libvolume_id_la_SOURCES =\ + libvolume_id-private.h \ ext.c \ fat.c \ hfs.c \ diff --git a/extras/volume_id/lib/adaptec_raid.c b/extras/volume_id/lib/adaptec_raid.c index 5ab9451890..45a56dcfbd 100644 --- a/extras/volume_id/lib/adaptec_raid.c +++ b/extras/volume_id/lib/adaptec_raid.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct adaptec_meta { diff --git a/extras/volume_id/lib/cramfs.c b/extras/volume_id/lib/cramfs.c index 9c7eaf6177..afbdf886d0 100644 --- a/extras/volume_id/lib/cramfs.c +++ b/extras/volume_id/lib/cramfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct cramfs_super { diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c index 2e83c08098..de7b7a7b63 100644 --- a/extras/volume_id/lib/ddf_raid.c +++ b/extras/volume_id/lib/ddf_raid.c @@ -25,6 +25,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" /* http://www.snia.org/standards/home */ diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index 55b0265825..d3b925c683 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -14,42 +14,3 @@ volume_id_probe_raid volume_id_all_probers volume_id_get_prober_by_type volume_id_encode_string -volume_id_open_node -volume_id_probe_linux_swap -volume_id_probe_luks -volume_id_probe_cramfs -volume_id_probe_ext -volume_id_probe_vfat -volume_id_probe_hfs_hfsplus -volume_id_probe_hpfs -volume_id_probe_iso9660 -volume_id_probe_jfs -volume_id_probe_minix -volume_id_probe_ntfs -volume_id_probe_ocfs1 -volume_id_probe_ocfs2 -volume_id_probe_reiserfs -volume_id_probe_romfs -volume_id_probe_sysv -volume_id_probe_udf -volume_id_probe_ufs -volume_id_probe_vxfs -volume_id_probe_xfs -volume_id_probe_squashfs -volume_id_probe_netware -volume_id_probe_gfs -volume_id_probe_gfs2 -volume_id_probe_linux_raid -volume_id_probe_lvm1 -volume_id_probe_lvm2 -volume_id_probe_ddf_raid -volume_id_probe_intel_software_raid -volume_id_probe_highpoint_37x_raid -volume_id_probe_highpoint_45x_raid -volume_id_probe_lsi_mega_raid -volume_id_probe_nvidia_raid -volume_id_probe_promise_fasttrack_raid -volume_id_probe_silicon_medley_raid -volume_id_probe_via_raid -volume_id_probe_adaptec_raid -volume_id_probe_jmicron_raid diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index 56edd2531f..49b7c5d060 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -27,6 +27,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct ext2_super_block { diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 58f8f825c4..759e106f68 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -25,6 +25,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" #define FAT12_MAX 0xff5 diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c index 2cb16a8693..e1293ebce7 100644 --- a/extras/volume_id/lib/gfs.c +++ b/extras/volume_id/lib/gfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" /* Common gfs/gfs2 constants: */ diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index b6d7e0290b..f8a4baf8fb 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct hfs_finder_info{ diff --git a/extras/volume_id/lib/highpoint.c b/extras/volume_id/lib/highpoint.c index 0629015117..23e25bcca1 100644 --- a/extras/volume_id/lib/highpoint.c +++ b/extras/volume_id/lib/highpoint.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct hpt37x_meta { diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c index ac5a35437a..a95e778e5e 100644 --- a/extras/volume_id/lib/hpfs.c +++ b/extras/volume_id/lib/hpfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct hpfs_super diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c index 0e2c686fa2..367deee4d6 100644 --- a/extras/volume_id/lib/iso9660.c +++ b/extras/volume_id/lib/iso9660.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" #define ISO_SUPERBLOCK_OFFSET 0x8000 diff --git a/extras/volume_id/lib/isw_raid.c b/extras/volume_id/lib/isw_raid.c index 337a9cecbd..f62d106f53 100644 --- a/extras/volume_id/lib/isw_raid.c +++ b/extras/volume_id/lib/isw_raid.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct isw_meta { diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c index 950ba43e1c..d4a5f0febb 100644 --- a/extras/volume_id/lib/jfs.c +++ b/extras/volume_id/lib/jfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct jfs_super_block { diff --git a/extras/volume_id/lib/jmicron_raid.c b/extras/volume_id/lib/jmicron_raid.c index 6cb1f6f315..2279c4df5c 100644 --- a/extras/volume_id/lib/jmicron_raid.c +++ b/extras/volume_id/lib/jmicron_raid.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct jmicron_meta { diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h new file mode 100644 index 0000000000..578f6fc4e7 --- /dev/null +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -0,0 +1,103 @@ +/* + * volume_id - reads volume label and uuid + * + * Copyright (C) 2005-2007 Kay Sievers + * + * 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. + */ + +#ifndef _LIBVOLUME_ID_PRIVATE_H_ +#define _LIBVOLUME_ID_PRIVATE_H_ + +#include +#include + +#include "libvolume_id.h" + +#define VOLUME_ID_LABEL_SIZE 64 +#define VOLUME_ID_UUID_SIZE 36 +#define VOLUME_ID_FORMAT_SIZE 32 +#define VOLUME_ID_PATH_MAX 256 +#define VOLUME_ID_PARTITIONS_MAX 256 + +enum volume_id_usage { + VOLUME_ID_UNUSED, + VOLUME_ID_UNPROBED, + VOLUME_ID_OTHER, + VOLUME_ID_FILESYSTEM, + VOLUME_ID_RAID, + VOLUME_ID_DISKLABEL, + VOLUME_ID_CRYPTO, +}; + +struct volume_id { + uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; + size_t label_raw_len; + char label[VOLUME_ID_LABEL_SIZE+1]; + uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; + size_t uuid_raw_len; + char uuid[VOLUME_ID_UUID_SIZE+1]; + enum volume_id_usage usage_id; + char *usage; + char *type; + char type_version[VOLUME_ID_FORMAT_SIZE]; + + int fd; + uint8_t *sbbuf; + size_t sbbuf_len; + uint8_t *seekbuf; + uint64_t seekbuf_off; + size_t seekbuf_len; + int fd_close:1; +}; + +/* filesystems */ +extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size); + +/* special formats */ +extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size); + +/* raid */ +extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_oracleasm(struct volume_id *id, uint64_t off, uint64_t size); + +/* bios raid */ +extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size); + +#endif diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index 6cce6e377d..d1a0077f0c 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -1,7 +1,7 @@ /* * volume_id - reads volume label and uuid * - * Copyright (C) 2005-2007 Kay Sievers + * Copyright (C) 2005-2008 Kay Sievers * * 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 @@ -14,11 +14,11 @@ #include #include +struct volume_id; typedef void (*volume_id_log_fn_t)(int priority, const char *file, int line, const char *format, ...) __attribute__ ((format(printf, 4, 5))); extern volume_id_log_fn_t volume_id_log_fn; -struct volume_id; typedef int (*volume_id_probe_fn_t)(struct volume_id *id, uint64_t off, uint64_t size); typedef int (*all_probers_fn_t)(volume_id_probe_fn_t probe_fn, struct volume_id *id, uint64_t off, uint64_t size, @@ -42,95 +42,4 @@ extern int volume_id_get_type(struct volume_id *id, const char **type); extern int volume_id_get_type_version(struct volume_id *id, const char **type_version); extern int volume_id_encode_string(const char *str, char *str_enc, size_t len); -/* - * Note: everything below will be made private or removed from - * a future version, and a new major release of libvolume_id - */ - -extern struct volume_id *volume_id_open_node(const char *path); - -#define VOLUME_ID_LABEL_SIZE 64 -#define VOLUME_ID_UUID_SIZE 36 -#define VOLUME_ID_FORMAT_SIZE 32 -#define VOLUME_ID_PATH_MAX 256 -#define VOLUME_ID_PARTITIONS_MAX 256 - -enum volume_id_usage { - VOLUME_ID_UNUSED, - VOLUME_ID_UNPROBED, - VOLUME_ID_OTHER, - VOLUME_ID_FILESYSTEM, - VOLUME_ID_RAID, - VOLUME_ID_DISKLABEL, - VOLUME_ID_CRYPTO, -}; - -struct volume_id { - uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; - size_t label_raw_len; - char label[VOLUME_ID_LABEL_SIZE+1]; - uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; - size_t uuid_raw_len; - char uuid[VOLUME_ID_UUID_SIZE+1]; - enum volume_id_usage usage_id; - char *usage; - char *type; - char type_version[VOLUME_ID_FORMAT_SIZE]; - - int fd; - uint8_t *sbbuf; - size_t sbbuf_len; - uint8_t *seekbuf; - uint64_t seekbuf_off; - size_t seekbuf_len; - int fd_close:1; -}; - -/* filesystems */ -extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size); - -/* special formats */ -extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size); - -/* raid */ -extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_oracleasm(struct volume_id *id, uint64_t off, uint64_t size); - -/* bios raid */ -extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size); - #endif diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index af496584c4..5d95b502e3 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -25,6 +25,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct mdp0_super_block { diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 592a38570d..13a0077f60 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct swap_header_v1_2 { diff --git a/extras/volume_id/lib/lsi_raid.c b/extras/volume_id/lib/lsi_raid.c index eef87142b8..30ebe7b5e6 100644 --- a/extras/volume_id/lib/lsi_raid.c +++ b/extras/volume_id/lib/lsi_raid.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct lsi_meta { diff --git a/extras/volume_id/lib/luks.c b/extras/volume_id/lib/luks.c index 20b50d0efd..4fb97e3598 100644 --- a/extras/volume_id/lib/luks.c +++ b/extras/volume_id/lib/luks.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" #define SECTOR_SHIFT 9 diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c index d234113d77..5dc360f65d 100644 --- a/extras/volume_id/lib/lvm.c +++ b/extras/volume_id/lib/lvm.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct lvm1_super_block { diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c index 88b4c189c4..41bdab2fe6 100644 --- a/extras/volume_id/lib/minix.c +++ b/extras/volume_id/lib/minix.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" #define MINIX_SUPERBLOCK_OFFSET 0x400 diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c index c03455791c..249dbbf20d 100644 --- a/extras/volume_id/lib/netware.c +++ b/extras/volume_id/lib/netware.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" #define NW_SUPERBLOCK_OFFSET 0x1000 diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index 1e73bc8f15..3d1e05798a 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" static struct ntfs_super_block { diff --git a/extras/volume_id/lib/nvidia_raid.c b/extras/volume_id/lib/nvidia_raid.c index c6b5185399..5af3724c49 100644 --- a/extras/volume_id/lib/nvidia_raid.c +++ b/extras/volume_id/lib/nvidia_raid.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct nvidia_meta { diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c index ec81f5e8e3..d56a64ae5e 100644 --- a/extras/volume_id/lib/ocfs.c +++ b/extras/volume_id/lib/ocfs.c @@ -25,6 +25,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" diff --git a/extras/volume_id/lib/oracleasm.c b/extras/volume_id/lib/oracleasm.c index 0f5ff80cfb..9ea00e20cc 100644 --- a/extras/volume_id/lib/oracleasm.c +++ b/extras/volume_id/lib/oracleasm.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct oracleasm_super_block { diff --git a/extras/volume_id/lib/promise_raid.c b/extras/volume_id/lib/promise_raid.c index ecaed00986..09aaaf9665 100644 --- a/extras/volume_id/lib/promise_raid.c +++ b/extras/volume_id/lib/promise_raid.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct promise_meta { diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c index 0f30233eaf..188607b7c1 100644 --- a/extras/volume_id/lib/reiserfs.c +++ b/extras/volume_id/lib/reiserfs.c @@ -25,6 +25,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct reiserfs_super_block { diff --git a/extras/volume_id/lib/romfs.c b/extras/volume_id/lib/romfs.c index 303a1fb40e..01fbf81b79 100644 --- a/extras/volume_id/lib/romfs.c +++ b/extras/volume_id/lib/romfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct romfs_super { diff --git a/extras/volume_id/lib/silicon_raid.c b/extras/volume_id/lib/silicon_raid.c index cfdcbcb868..a0cda375e5 100644 --- a/extras/volume_id/lib/silicon_raid.c +++ b/extras/volume_id/lib/silicon_raid.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct silicon_meta { diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index 18e44abcb4..e39e1a12ee 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" #define SQUASHFS_MAGIC 0x73717368 diff --git a/extras/volume_id/lib/sysv.c b/extras/volume_id/lib/sysv.c index ba37c4d0a6..fe8efecd9b 100644 --- a/extras/volume_id/lib/sysv.c +++ b/extras/volume_id/lib/sysv.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" #define SYSV_NICINOD 100 diff --git a/extras/volume_id/lib/udf.c b/extras/volume_id/lib/udf.c index 2a589c5f2a..b0865b2e8d 100644 --- a/extras/volume_id/lib/udf.c +++ b/extras/volume_id/lib/udf.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct volume_descriptor { diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c index bedcfa47da..26c3df6d14 100644 --- a/extras/volume_id/lib/ufs.c +++ b/extras/volume_id/lib/ufs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct ufs_super_block { diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 2a63efe8f7..ea07cfd6c1 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -26,6 +26,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" /* count of characters used to encode one unicode char */ diff --git a/extras/volume_id/lib/via_raid.c b/extras/volume_id/lib/via_raid.c index 9965e13bc2..7e1ac26084 100644 --- a/extras/volume_id/lib/via_raid.c +++ b/extras/volume_id/lib/via_raid.c @@ -27,6 +27,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct via_meta { diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index b247fe2ddb..86e66bb76c 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -26,6 +26,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) @@ -489,27 +490,6 @@ struct volume_id *volume_id_open_fd(int fd) return id; } -struct volume_id *volume_id_open_node(const char *path) -{ - struct volume_id *id; - int fd; - - fd = open(path, O_RDONLY); - if (fd < 0) { - dbg("unable to open '%s'\n", path); - return NULL; - } - - id = volume_id_open_fd(fd); - if (id == NULL) - return NULL; - - /* close fd on device close */ - id->fd_close = 1; - - return id; -} - /** * volume_id_close: * @id: Probing context. diff --git a/extras/volume_id/lib/vxfs.c b/extras/volume_id/lib/vxfs.c index 33d357b7d8..5d31920113 100644 --- a/extras/volume_id/lib/vxfs.c +++ b/extras/volume_id/lib/vxfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" #define VXFS_SUPER_MAGIC 0xa501FCF5 diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c index 3e10560af9..5b14f449fe 100644 --- a/extras/volume_id/lib/xfs.c +++ b/extras/volume_id/lib/xfs.c @@ -24,6 +24,7 @@ #include #include "libvolume_id.h" +#include "libvolume_id-private.h" #include "util.h" struct xfs_super_block { -- cgit v1.2.3-54-g00ecf From 550d5c28791a1bd50bd70bab6f9c4ee419e3ad50 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Aug 2008 17:06:08 +0200 Subject: volume_id: remove left-over fd close() --- extras/volume_id/lib/libvolume_id-private.h | 1 - extras/volume_id/lib/volume_id.c | 3 --- 2 files changed, 4 deletions(-) diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h index 578f6fc4e7..c9afaf94e7 100644 --- a/extras/volume_id/lib/libvolume_id-private.h +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -50,7 +50,6 @@ struct volume_id { uint8_t *seekbuf; uint64_t seekbuf_off; size_t seekbuf_len; - int fd_close:1; }; /* filesystems */ diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 86e66bb76c..ef2b663f6c 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -501,9 +501,6 @@ void volume_id_close(struct volume_id *id) if (id == NULL) return; - if (id->fd_close != 0) - close(id->fd); - volume_id_free_buffer(id); free(id); -- cgit v1.2.3-54-g00ecf From d46f37fdee02ab5f906518b3c08886cd0eb0a6c8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Aug 2008 20:32:05 +0200 Subject: split udev_device.c to leave out rules handling from libudev --- udev/Makefile.am | 1 + udev/udev.h | 4 +- udev/udev_device.c | 224 ---------------------------------------- udev/udev_device_event.c | 259 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 263 insertions(+), 225 deletions(-) create mode 100644 udev/udev_device_event.c diff --git a/udev/Makefile.am b/udev/Makefile.am index d9f14057c8..4a7c7855ce 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -24,6 +24,7 @@ common_files = \ udev_config.c \ udev_db.c \ udev_device.c \ + udev_device_event.c \ udev_node.c \ udev_rules.c \ udev_rules_parse.c \ diff --git a/udev/udev.h b/udev/udev.h index 2648e2aa06..b633807389 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -103,9 +103,11 @@ extern void udev_config_init(void); /* udev_device.c */ extern struct udevice *udev_device_init(struct udevice *udev); extern void udev_device_cleanup(struct udevice *udev); -extern int udev_device_event(struct udev_rules *rules, struct udevice *udev); extern dev_t udev_device_get_devt(struct udevice *udev); +/* udev_device_event.c */ +extern int udev_device_event(struct udev_rules *rules, struct udevice *udev); + /* udev_sysfs.c */ extern char sysfs_path[PATH_SIZE]; extern int sysfs_init(void); diff --git a/udev/udev_device.c b/udev/udev_device.c index bce5b29986..98886763c4 100644 --- a/udev/udev_device.c +++ b/udev/udev_device.c @@ -80,227 +80,3 @@ dev_t udev_device_get_devt(struct udevice *udev) } return makedev(0, 0); } - -static void kernel_log(struct ifreq ifr) -{ - int klog; - FILE *f; - - klog = open("/dev/kmsg", O_WRONLY); - if (klog < 0) - return; - - f = fdopen(klog, "w"); - if (f == NULL) { - close(klog); - return; - } - - fprintf(f, "<6>udev: renamed network interface %s to %s\n", - ifr.ifr_name, ifr.ifr_newname); - fclose(f); -} - -static int rename_netif(struct udevice *udev) -{ - int sk; - struct ifreq ifr; - int retval; - - info("changing net interface name from '%s' to '%s'\n", udev->dev->kernel, udev->name); - if (udev->test_run) - return 0; - - sk = socket(PF_INET, SOCK_DGRAM, 0); - if (sk < 0) { - err("error opening socket: %s\n", strerror(errno)); - return -1; - } - - memset(&ifr, 0x00, sizeof(struct ifreq)); - strlcpy(ifr.ifr_name, udev->dev->kernel, IFNAMSIZ); - strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval == 0) - kernel_log(ifr); - else { - int loop; - - /* see if the destination interface name already exists */ - if (errno != EEXIST) { - err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); - goto exit; - } - - /* free our own name, another process may wait for us */ - strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ); - strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval != 0) { - err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); - goto exit; - } - - /* wait 30 seconds for our target to become available */ - strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); - strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); - loop = 30 * 20; - while (loop--) { - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval == 0) { - kernel_log(ifr); - break; - } - - if (errno != EEXIST) { - err("error changing net interface name %s to %s: %s\n", - ifr.ifr_name, ifr.ifr_newname, strerror(errno)); - break; - } - dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop); - usleep(1000 * 1000 / 20); - } - } - -exit: - close(sk); - return retval; -} - -int udev_device_event(struct udev_rules *rules, struct udevice *udev) -{ - int retval = 0; - - if (udev->devpath_old != NULL) - if (udev_db_rename(udev->devpath_old, udev->dev->devpath) == 0) - info("moved database from '%s' to '%s'\n", udev->devpath_old, udev->dev->devpath); - - /* add device node */ - if (major(udev->devt) != 0 && - (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "change") == 0)) { - struct udevice *udev_old; - - dbg("device node add '%s'\n", udev->dev->devpath); - - udev_rules_get_name(rules, udev); - if (udev->ignore_device) { - info("device event will be ignored\n"); - goto exit; - } - if (udev->name[0] == '\0') { - info("device node creation supressed\n"); - goto exit; - } - - /* read current database entry; cleanup, if it is known device */ - udev_old = udev_device_init(NULL); - if (udev_old != NULL) { - udev_old->test_run = udev->test_run; - if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { - info("device '%s' already in database, cleanup\n", udev->dev->devpath); - udev_db_delete_device(udev_old); - } else { - udev_device_cleanup(udev_old); - udev_old = NULL; - } - } - - /* create node */ - retval = udev_node_add(udev); - if (retval != 0) - goto exit; - - /* store in database */ - udev_db_add_device(udev); - - /* create, replace, delete symlinks according to priority */ - udev_node_update_symlinks(udev, udev_old); - - if (udev_old != NULL) - udev_device_cleanup(udev_old); - goto exit; - } - - /* add netif */ - if (strcmp(udev->dev->subsystem, "net") == 0 && strcmp(udev->action, "add") == 0) { - dbg("netif add '%s'\n", udev->dev->devpath); - udev_rules_get_name(rules, udev); - if (udev->ignore_device) { - info("device event will be ignored\n"); - goto exit; - } - if (udev->name[0] == '\0') { - info("device renaming supressed\n"); - goto exit; - } - - /* look if we want to change the name of the netif */ - if (strcmp(udev->name, udev->dev->kernel) != 0) { - char devpath[PATH_MAX]; - char *pos; - - retval = rename_netif(udev); - if (retval != 0) - goto exit; - info("renamed netif to '%s'\n", udev->name); - - /* export old name */ - setenv("INTERFACE_OLD", udev->dev->kernel, 1); - - /* now change the devpath, because the kernel device name has changed */ - strlcpy(devpath, udev->dev->devpath, sizeof(devpath)); - pos = strrchr(devpath, '/'); - if (pos != NULL) { - pos[1] = '\0'; - strlcat(devpath, udev->name, sizeof(devpath)); - sysfs_device_set_values(udev->dev, devpath, NULL, NULL); - setenv("DEVPATH", udev->dev->devpath, 1); - setenv("INTERFACE", udev->name, 1); - info("changed devpath to '%s'\n", udev->dev->devpath); - } - } - goto exit; - } - - /* remove device node */ - if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { - struct name_entry *name_loop; - - /* import database entry, and delete it */ - if (udev_db_get_device(udev, udev->dev->devpath) == 0) { - udev_db_delete_device(udev); - /* restore stored persistent data */ - list_for_each_entry(name_loop, &udev->env_list, node) - putenv(name_loop->name); - } else { - dbg("'%s' not found in database, using kernel name '%s'\n", - udev->dev->devpath, udev->dev->kernel); - strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); - } - - udev_rules_get_run(rules, udev); - if (udev->ignore_device) { - info("device event will be ignored\n"); - goto exit; - } - - if (udev->ignore_remove) { - info("ignore_remove for '%s'\n", udev->name); - goto exit; - } - /* remove the node */ - retval = udev_node_remove(udev); - - /* delete or restore symlinks according to priority */ - udev_node_update_symlinks(udev, NULL); - goto exit; - } - - /* default devices */ - udev_rules_get_run(rules, udev); - if (udev->ignore_device) - info("device event will be ignored\n"); - -exit: - return retval; -} diff --git a/udev/udev_device_event.c b/udev/udev_device_event.c new file mode 100644 index 0000000000..045035d44e --- /dev/null +++ b/udev/udev_device_event.c @@ -0,0 +1,259 @@ +/* + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" + + +static void kernel_log(struct ifreq ifr) +{ + int klog; + FILE *f; + + klog = open("/dev/kmsg", O_WRONLY); + if (klog < 0) + return; + + f = fdopen(klog, "w"); + if (f == NULL) { + close(klog); + return; + } + + fprintf(f, "<6>udev: renamed network interface %s to %s\n", + ifr.ifr_name, ifr.ifr_newname); + fclose(f); +} + +static int rename_netif(struct udevice *udev) +{ + int sk; + struct ifreq ifr; + int retval; + + info("changing net interface name from '%s' to '%s'\n", udev->dev->kernel, udev->name); + if (udev->test_run) + return 0; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) { + err("error opening socket: %s\n", strerror(errno)); + return -1; + } + + memset(&ifr, 0x00, sizeof(struct ifreq)); + strlcpy(ifr.ifr_name, udev->dev->kernel, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval == 0) + kernel_log(ifr); + else { + int loop; + + /* see if the destination interface name already exists */ + if (errno != EEXIST) { + err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + goto exit; + } + + /* free our own name, another process may wait for us */ + strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ); + strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval != 0) { + err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + goto exit; + } + + /* wait 30 seconds for our target to become available */ + strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); + loop = 30 * 20; + while (loop--) { + retval = ioctl(sk, SIOCSIFNAME, &ifr); + if (retval == 0) { + kernel_log(ifr); + break; + } + + if (errno != EEXIST) { + err("error changing net interface name %s to %s: %s\n", + ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + break; + } + dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop); + usleep(1000 * 1000 / 20); + } + } + +exit: + close(sk); + return retval; +} + +int udev_device_event(struct udev_rules *rules, struct udevice *udev) +{ + int retval = 0; + + if (udev->devpath_old != NULL) + if (udev_db_rename(udev->devpath_old, udev->dev->devpath) == 0) + info("moved database from '%s' to '%s'\n", udev->devpath_old, udev->dev->devpath); + + /* add device node */ + if (major(udev->devt) != 0 && + (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "change") == 0)) { + struct udevice *udev_old; + + dbg("device node add '%s'\n", udev->dev->devpath); + + udev_rules_get_name(rules, udev); + if (udev->ignore_device) { + info("device event will be ignored\n"); + goto exit; + } + if (udev->name[0] == '\0') { + info("device node creation supressed\n"); + goto exit; + } + + /* read current database entry; cleanup, if it is known device */ + udev_old = udev_device_init(NULL); + if (udev_old != NULL) { + udev_old->test_run = udev->test_run; + if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { + info("device '%s' already in database, cleanup\n", udev->dev->devpath); + udev_db_delete_device(udev_old); + } else { + udev_device_cleanup(udev_old); + udev_old = NULL; + } + } + + /* create node */ + retval = udev_node_add(udev); + if (retval != 0) + goto exit; + + /* store in database */ + udev_db_add_device(udev); + + /* create, replace, delete symlinks according to priority */ + udev_node_update_symlinks(udev, udev_old); + + if (udev_old != NULL) + udev_device_cleanup(udev_old); + goto exit; + } + + /* add netif */ + if (strcmp(udev->dev->subsystem, "net") == 0 && strcmp(udev->action, "add") == 0) { + dbg("netif add '%s'\n", udev->dev->devpath); + udev_rules_get_name(rules, udev); + if (udev->ignore_device) { + info("device event will be ignored\n"); + goto exit; + } + if (udev->name[0] == '\0') { + info("device renaming supressed\n"); + goto exit; + } + + /* look if we want to change the name of the netif */ + if (strcmp(udev->name, udev->dev->kernel) != 0) { + char devpath[PATH_MAX]; + char *pos; + + retval = rename_netif(udev); + if (retval != 0) + goto exit; + info("renamed netif to '%s'\n", udev->name); + + /* export old name */ + setenv("INTERFACE_OLD", udev->dev->kernel, 1); + + /* now change the devpath, because the kernel device name has changed */ + strlcpy(devpath, udev->dev->devpath, sizeof(devpath)); + pos = strrchr(devpath, '/'); + if (pos != NULL) { + pos[1] = '\0'; + strlcat(devpath, udev->name, sizeof(devpath)); + sysfs_device_set_values(udev->dev, devpath, NULL, NULL); + setenv("DEVPATH", udev->dev->devpath, 1); + setenv("INTERFACE", udev->name, 1); + info("changed devpath to '%s'\n", udev->dev->devpath); + } + } + goto exit; + } + + /* remove device node */ + if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { + struct name_entry *name_loop; + + /* import database entry, and delete it */ + if (udev_db_get_device(udev, udev->dev->devpath) == 0) { + udev_db_delete_device(udev); + /* restore stored persistent data */ + list_for_each_entry(name_loop, &udev->env_list, node) + putenv(name_loop->name); + } else { + dbg("'%s' not found in database, using kernel name '%s'\n", + udev->dev->devpath, udev->dev->kernel); + strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); + } + + udev_rules_get_run(rules, udev); + if (udev->ignore_device) { + info("device event will be ignored\n"); + goto exit; + } + + if (udev->ignore_remove) { + info("ignore_remove for '%s'\n", udev->name); + goto exit; + } + /* remove the node */ + retval = udev_node_remove(udev); + + /* delete or restore symlinks according to priority */ + udev_node_update_symlinks(udev, NULL); + goto exit; + } + + /* default devices */ + udev_rules_get_run(rules, udev); + if (udev->ignore_device) + info("device event will be ignored\n"); + +exit: + return retval; +} -- cgit v1.2.3-54-g00ecf From aa1f5304b0f2eb8c2c645eba155baa74ebfecdcb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Aug 2008 20:48:25 +0200 Subject: libudev: link against selinux if needed --- udev/lib/Makefile.am | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index a1fd77b87b..430472735b 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -31,18 +31,25 @@ libudev_la_SOURCES =\ ../udev_utils_string.c \ ../udev_utils_file.c \ ../udev_sysfs.c \ - ../udev_node.c \ ../udev_device.c \ ../udev_config.c \ - ../udev_rules.c \ - ../udev_rules_parse.c \ ../udev_db.c \ ../udev_sysdeps.c +if USE_SELINUX +libudev_la_SOURCES += \ + ../udev_selinux.c +endif + libudev_la_LDFLAGS = \ -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ -export-symbols $(top_srcdir)/udev/lib/exported_symbols +if USE_SELINUX +libudev_la_LIBADD = \ + -lselinux +endif + pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig pkgconfig_DATA = libudev.pc -- cgit v1.2.3-54-g00ecf From 2bb9f412bcd8596d4e8c0197e85c9e4647212674 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Aug 2008 21:00:43 +0200 Subject: firmware.sh: lookup lookup kernel provided firmware directory --- extras/firmware/firmware.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/firmware/firmware.sh b/extras/firmware/firmware.sh index b89b4282c7..466b653226 100755 --- a/extras/firmware/firmware.sh +++ b/extras/firmware/firmware.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -FIRMWARE_DIRS="/lib/firmware /usr/local/lib/firmware" +FIRMWARE_DIRS="/lib/firmware/$(uname -r) /lib/firmware" err() { echo "$@" >&2 -- cgit v1.2.3-54-g00ecf From a689165b5a140cd7d5fdd63cacf8fce2f275033d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Aug 2008 21:22:24 +0200 Subject: libudev: require LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE --- NEWS | 17 +++++++++++++---- rules/rules.d/60-persistent-input.rules | 1 + udev/lib/Makefile.am | 3 ++- udev/lib/libudev.h | 5 +++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 1a9aa69059..db76315034 100644 --- a/NEWS +++ b/NEWS @@ -2,11 +2,20 @@ udev 127 ======== Bugfixes. -A shared library "libudev" will be installed now, to access udev -device information. DeviceKit, the successor of HAL, will need this -library to access the udev database and search sysfs for devices. +Optical drives media is no longer probed for raid signatures, +reading the end of the device causes some devices to malfunction. +Also the offset of the last session is used to probe for the +filesystem + +The volume_id library got a major version number update to 1, +some deprecated functions are removed. + +A shared library "libudev" gets installed now, to provide access +to udev device information. DeviceKit, the successor of HAL, will +need this library to access the udev database and search sysfs for +devices. The library is currently in an experimental state, also the API is -expected to change, as long as the DeviceKit integration isn't +expected to change, as long as the DeviceKit integration is not finished. udev 126 diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index 34d5ef1557..9405b73011 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -14,6 +14,7 @@ DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr" DRIVERS=="atkbd", ENV{ID_CLASS}="kbd" DRIVERS=="psmouse", ENV{ID_CLASS}="mouse" ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir" +# joystick (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick" # fill empty serial number diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 430472735b..dadcd55f0f 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -1,6 +1,7 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -DLIBUDEV_COMPILATION noinst_PROGRAMS = \ test-libudev diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 1eb3745e6f..cd366c7dfc 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -20,6 +20,11 @@ #ifndef _LIBUDEV_H_ #define _LIBUDEV_H_ +/* this will stay as long as the DeviceKit integration of udev is work in progress */ +#if !defined LIBUDEV_COMPILATION && !defined LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE +#error "#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE is needed to use this experimental library version" +#endif + struct udev; struct udev_device; struct udev_monitor; -- cgit v1.2.3-54-g00ecf From 41ff8053c1d713fc83bb5b2cc3fe59adfbfac2dc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Aug 2008 21:41:15 +0200 Subject: release 127 --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ NEWS | 10 +++++----- configure.ac | 2 +- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c2272ec15..64c155635f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Summary of changes from v126 to v127 +============================================ + +Karel Zak (2): + build-sys: don't duplicate file names + build-sys: remove non-POSIX variable names + +Kay Sievers (26): + add inotify dummy definitions if inotify is not available + build: remove autopoint check + udevadm: trigger - add missing attr filter to synthesized "subsystem" register events + ignore duplicated rules file names + fix .gitignore + rules: delete all distro rules which do not use default rules + rules: add nvram + rules: add isdn rules + rules: Gentoo update + add missing includes + add some warnings + update .gitignore + add missing 'v' for "make changelog" + build: fix "make dist" + vol_id: make the --offset= argument optional + rules: optical drives - probe at last session offset, do not probe for raid + libudev: add library to access udev information + libudev: split source files + update INSTALL + libudev: add udev event monitor API + volume_id: remove deprecated functions and bump major version + volume_id: remove left-over fd close() + split udev_device.c to leave out rules handling from libudev + libudev: link against selinux if needed + firmware.sh: lookup lookup kernel provided firmware directory + libudev: require LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE + +Michal Soltys (1): + rules: fix md rules for partitioned devices + + Summary of changes from v125 to v126 ============================================ diff --git a/NEWS b/NEWS index db76315034..93cecab7f8 100644 --- a/NEWS +++ b/NEWS @@ -2,15 +2,15 @@ udev 127 ======== Bugfixes. -Optical drives media is no longer probed for raid signatures, -reading the end of the device causes some devices to malfunction. -Also the offset of the last session is used to probe for the -filesystem +Optical drive's media is no longer probed for raid signatures, +reading the end of the device causes some devices to malfunction. +Also the offset of the last session found is used now to probe +for the filesystem. The volume_id library got a major version number update to 1, some deprecated functions are removed. -A shared library "libudev" gets installed now, to provide access +A shared library "libudev" gets installed now to provide access to udev device information. DeviceKit, the successor of HAL, will need this library to access the udev database and search sysfs for devices. diff --git a/configure.ac b/configure.ac index a98d903c21..0555ccbfe9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [126], + [127], [kay.sievers@vrfy.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) -- cgit v1.2.3-54-g00ecf From 7d8787b3116f602f10a4ad158847588e044a100f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Aug 2008 16:16:37 +0200 Subject: libudev: add monitor documentation --- udev/lib/libudev-device.c | 1 + udev/lib/libudev-monitor.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index f6ad541de4..6465157fbd 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -127,6 +127,7 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * /** * udev_device_get_udev: + * @udev_device: udev device * * Retrieve the udev library context the device was created with. * diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index fbb21d04ea..025ce7f0ef 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -40,6 +40,23 @@ struct udev_monitor { int socket; }; +/** + * udev_monitor_new_from_socket: + * @udev: udev library context + * @socket_path: unix socket path + * + * Create new udev monitor, setup and connect to a specified socket. The + * path to a socket can point to an existing socket file, or it will be + * created if needed. If neccessary, the permissions adjustment as well as + * the later cleanup of the socket file, needs to be done by the caller. + * If the socket path starts with a '@' character, an abstract namespace + * socket will be used. + * + * The initial refcount is 1, and needs to be decremented to + * release the ressources of the udev monitor. + * + * Returns: a new udev monitor, or #NULL, in case of an error + **/ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) { struct udev_monitor *udev_monitor; @@ -88,6 +105,14 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char return udev_monitor; } +/** + * udev_monitor_ref: + * @udev_monitor: udev monitor + * + * Take a reference of a udev monitor. + * + * Returns: the passed udev monitor + **/ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) @@ -96,6 +121,15 @@ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) return udev_monitor; } +/** + * udev_monitor_unref: + * @udev_monitor: udev monitor + * + * Drop a reference of a udev monitor. If the refcount reaches zero, + * the bound socket will be closed, and the ressources of the monitor + * will be released. + * + **/ void udev_monitor_unref(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) @@ -108,6 +142,14 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) free(udev_monitor); } +/** + * udev_monitor_get_udev: + * @udev_monitor: udev monitor + * + * Retrieve the udev library context the device was created with. + * + * Returns: the udev library context + **/ struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) @@ -115,6 +157,14 @@ struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) return udev_monitor->udev; } +/** + * udev_monitor_get_fd: + * @udev_monitor: udev monitor + * + * Retrieve the socket file descriptor associated with the monitor. + * + * Returns: the socket file descriptor + **/ int udev_monitor_get_fd(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) @@ -122,6 +172,22 @@ int udev_monitor_get_fd(struct udev_monitor *udev_monitor) return udev_monitor->socket; } +/** + * udev_monitor_get_device: + * @udev_monitor: udev monitor + * + * Retrieve data from the udev monitor socket, allocate a new udev + * device, and fill in the received data, and return the device. + * + * Only socket connections with uid=0 are accepted. The caller + * need to make sure, that there is data to read from the socket, + * the call will block until the socket becomes readable. + * + * The initial refcount is 1, and needs to be decremented to + * release the ressources of the udev device. + * + * Returns: a new udev device, or #NULL, in case of an error + **/ struct udev_device *udev_monitor_get_device(struct udev_monitor *udev_monitor) { struct udev_device *udev_device; -- cgit v1.2.3-54-g00ecf From 4cf23685101ff9e1a15f47cb0da49a6ec10b8e27 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Aug 2008 23:07:50 +0200 Subject: libudev: fix --disable-log --- udev/lib/libudev-private.h | 28 +++++++++++++--------------- udev/lib/libudev.c | 1 + 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 7e7d1c6324..6331f99d5b 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -23,16 +23,6 @@ #include "libudev.h" #include "../udev.h" -struct udev_device { - int refcount; - struct udev *udev; - char *devpath; - char *devname; - char *subsystem; - struct list_head link_list; - struct list_head env_list; -}; - #ifdef USE_LOG #define log_dbg(udev, arg...) \ udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) @@ -48,13 +38,21 @@ void udev_log(struct udev *udev, const char *format, ...) __attribute__ ((format(printf, 6, 7))); #else -static inline void udev_log(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, ...) - __attribute__ ((format(printf, 6, 7))) {} +#define log_dbg(format, arg...) do { } while (0) +#define log_info(format, arg...) do { } while (0) +#define log_err(format, arg...) do { } while (0) #endif +struct udev_device { + int refcount; + struct udev *udev; + char *devpath; + char *devname; + char *subsystem; + struct list_head link_list; + struct list_head env_list; +}; + extern struct udev_device *device_init(struct udev *udev); extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); - #endif diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index a5f33eb08f..a8a8a5ac3a 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3-54-g00ecf From e407720bbaa718d97eefacb62ff96a7796f54281 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Aug 2008 23:08:19 +0200 Subject: autogen.sh: add --with-selinux --- autogen.sh | 2 +- udev/lib/Makefile.am | 2 +- udev/lib/libudev.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autogen.sh b/autogen.sh index 234e82902c..4532e870bc 100755 --- a/autogen.sh +++ b/autogen.sh @@ -42,7 +42,7 @@ echo " automake: $(automake --version | head -1)" automake --add-missing if test -z "$@"; then - args="--prefix=/usr --exec-prefix= --sysconfdir=/etc" + args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux" args="$args --with-libdir-name=$(basename $(gcc -print-multi-os-directory))" export CFLAGS="-g -Wall \ -Wmissing-declarations -Wmissing-prototypes \ diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index dadcd55f0f..f1f5fb74b1 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -DLIBUDEV_COMPILATION + -D_LIBUDEV_COMPILATION noinst_PROGRAMS = \ test-libudev diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index cd366c7dfc..3a1c1bf3ac 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -21,7 +21,7 @@ #define _LIBUDEV_H_ /* this will stay as long as the DeviceKit integration of udev is work in progress */ -#if !defined LIBUDEV_COMPILATION && !defined LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE +#if !defined _LIBUDEV_COMPILATION && !defined LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE #error "#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE is needed to use this experimental library version" #endif -- cgit v1.2.3-54-g00ecf From ac877d7cf46e25bd50d17450e74f3b0346a8d5a1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 31 Aug 2008 12:20:24 +0200 Subject: volume_id: hfs - calculate proper uuid --- extras/volume_id/lib/Makefile.am | 10 +- extras/volume_id/lib/hfs.c | 17 ++-- extras/volume_id/lib/md5.c | 205 +++++++++++++++++++++++++++++++++++++++ extras/volume_id/lib/md5.h | 30 ++++++ extras/volume_id/lib/util.c | 6 -- extras/volume_id/lib/util.h | 2 - 6 files changed, 248 insertions(+), 22 deletions(-) create mode 100644 extras/volume_id/lib/md5.c create mode 100644 extras/volume_id/lib/md5.h diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am index f9c6fbe306..c5198aba9a 100644 --- a/extras/volume_id/lib/Makefile.am +++ b/extras/volume_id/lib/Makefile.am @@ -7,6 +7,11 @@ include_HEADERS =\ libvolume_id_la_SOURCES =\ libvolume_id-private.h \ + volume_id.c \ + util.h \ + util.c \ + md5.h \ + md5.c \ ext.c \ fat.c \ hfs.c \ @@ -41,10 +46,7 @@ libvolume_id_la_SOURCES =\ vxfs.c \ squashfs.c \ netware.c \ - oracleasm.c \ - volume_id.c \ - util.h \ - util.c + oracleasm.c libvolume_id_la_LDFLAGS = \ -version-info $(VOLID_LT_CURRENT):$(VOLID_LT_REVISION):$(VOLID_LT_AGE) \ diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index f8a4baf8fb..b3370460bc 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -26,6 +26,7 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" #include "util.h" +#include "md5.h" struct hfs_finder_info{ uint32_t boot_folder; @@ -140,8 +141,7 @@ static struct hfsplus_vol_header { static void hfsid_set_uuid(struct volume_id *id, const uint8_t *hfs_id) { -#if 0 - MD5_CTX md5c; + struct md5_ctx md5c; static const uint8_t hash_init[16] = { 0xb3, 0xe2, 0x0f, 0x39, 0xf2, 0x92, 0x11, 0xd6, 0x97, 0xa4, 0x00, 0x30, 0x65, 0x43, 0xec, 0xac @@ -151,17 +151,14 @@ static void hfsid_set_uuid(struct volume_id *id, const uint8_t *hfs_id) if (*((uint64_t *)hfs_id) == 0) return; - MD5_Init(&md5c); - MD5_Update(&md5c, &hash_init, 16); - MD5_Update(&md5c, hfs_id, 8); - MD5_Final(uuid, &md5c); + md5_init(&md5c); + md5_update(&md5c, hash_init, 16); + md5_update(&md5c, hfs_id, 8); + md5_final(&md5c, uuid); uuid[6] = 0x30 | (uuid[6] & 0x0f); uuid[8] = 0x80 | (uuid[8] & 0x3f); - volume_id_set_uuid(id, uuid, UUID_DCE); -#endif - - volume_id_set_uuid(id, hfs_id, 0, UUID_64BIT_BE); + volume_id_set_uuid(id, uuid, 0, UUID_DCE); } int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size) diff --git a/extras/volume_id/lib/md5.c b/extras/volume_id/lib/md5.c new file mode 100644 index 0000000000..0860660066 --- /dev/null +++ b/extras/volume_id/lib/md5.c @@ -0,0 +1,205 @@ +/* + * MD5 Message Digest Algorithm (RFC1321). + * + * Derived from cryptoapi implementation, originally based on the + * public domain implementation written by Colin Plumb in 1993. + * + * Copyright (c) Cryptoapi developers. + * Copyright (c) 2002 James Morris + * + * 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; either version 2 of the License, or (at your option) + * any later version. + * + */ +#include +#include +#include +#include + +#include "md5.h" + +#if !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN) +#error missing __BYTE_ORDER +#endif + +#define F1(x, y, z) (z ^ (x & (y ^ z))) +#define F2(x, y, z) F1(z, x, y) +#define F3(x, y, z) (x ^ y ^ z) +#define F4(x, y, z) (y ^ (x | ~z)) + +#define MD5STEP(f, w, x, y, z, in, s) \ + (w += f(x, y, z) + in, w = (w<>(32-s)) + x) + +static void md5_transform(uint32_t *hash, uint32_t const *in) +{ + uint32_t a, b, c, d; + + a = hash[0]; + b = hash[1]; + c = hash[2]; + d = hash[3]; + + MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); + MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); + MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); + MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); + MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); + MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); + MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); + MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); + MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); + MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); + MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); + MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); + MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); + MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); + MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); + MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); + + MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); + MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); + MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); + MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); + MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); + MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); + MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); + MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); + MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); + MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); + MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); + MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); + MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); + MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); + MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); + MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); + + MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); + MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); + MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); + MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); + MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); + MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); + MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); + MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); + MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); + MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); + MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); + MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); + MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); + MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); + MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); + MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); + + MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); + MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); + MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); + MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); + MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); + MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); + MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); + MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); + MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); + MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); + MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); + MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); + MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); + MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); + MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); + MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); + + hash[0] += a; + hash[1] += b; + hash[2] += c; + hash[3] += d; +} + +static inline void swab32_array(uint32_t *buf, unsigned int words) +{ + unsigned int i; + + for (i = 0; i < words; i++) + buf[i] = bswap_32(buf[i]); +} + +static inline void le32_to_cpu_array(uint32_t *buf, unsigned int words) +{ +#if (__BYTE_ORDER == __BIG_ENDIAN) + swab32_array(buf, words); +#endif +} +static inline void cpu_to_le32_array(uint32_t *buf, unsigned int words) +{ +#if (__BYTE_ORDER == __BIG_ENDIAN) + swab32_array(buf, words); +#endif +} + +static inline void md5_transform_helper(struct md5_ctx *ctx) +{ + le32_to_cpu_array(ctx->block, sizeof(ctx->block) / sizeof(uint32_t)); + md5_transform(ctx->hash, ctx->block); +} + +void md5_init(struct md5_ctx *mctx) +{ + mctx->hash[0] = 0x67452301; + mctx->hash[1] = 0xefcdab89; + mctx->hash[2] = 0x98badcfe; + mctx->hash[3] = 0x10325476; + mctx->byte_count = 0; +} + +void md5_update(struct md5_ctx *mctx, const uint8_t *data, unsigned int len) +{ + const uint32_t avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f); + + mctx->byte_count += len; + + if (avail > len) { + memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), + data, len); + return; + } + + memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), data, avail); + + md5_transform_helper(mctx); + data += avail; + len -= avail; + + while (len >= sizeof(mctx->block)) { + memcpy(mctx->block, data, sizeof(mctx->block)); + md5_transform_helper(mctx); + data += sizeof(mctx->block); + len -= sizeof(mctx->block); + } + + memcpy(mctx->block, data, len); +} + +void md5_final(struct md5_ctx *mctx, uint8_t *out) +{ + const unsigned int offset = mctx->byte_count & 0x3f; + char *p = (char *)mctx->block + offset; + int padding = 56 - (offset + 1); + + *p++ = 0x80; + if (padding < 0) { + memset(p, 0x00, padding + sizeof (uint64_t)); + md5_transform_helper(mctx); + p = (char *)mctx->block; + padding = 56; + } + + memset(p, 0, padding); + mctx->block[14] = mctx->byte_count << 3; + mctx->block[15] = mctx->byte_count >> 29; + le32_to_cpu_array(mctx->block, (sizeof(mctx->block) - + sizeof(uint64_t)) / sizeof(uint32_t)); + md5_transform(mctx->hash, mctx->block); + cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(uint32_t)); + memcpy(out, mctx->hash, sizeof(mctx->hash)); + memset(mctx, 0, sizeof(*mctx)); +} diff --git a/extras/volume_id/lib/md5.h b/extras/volume_id/lib/md5.h new file mode 100644 index 0000000000..3d7bd39a57 --- /dev/null +++ b/extras/volume_id/lib/md5.h @@ -0,0 +1,30 @@ +/* + * MD5 Message Digest Algorithm (RFC1321). + * + * Derived from cryptoapi implementation, originally based on the + * public domain implementation written by Colin Plumb in 1993. + * + * Copyright (c) Cryptoapi developers. + * Copyright (c) 2002 James Morris + * + * 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; either version 2 of the License, or (at your option) + * any later version. + * + */ + +#define MD5_DIGEST_SIZE 16 +#define MD5_HMAC_BLOCK_SIZE 64 +#define MD5_BLOCK_WORDS 16 +#define MD5_HASH_WORDS 4 + +struct md5_ctx { + uint32_t hash[MD5_HASH_WORDS]; + uint32_t block[MD5_BLOCK_WORDS]; + uint64_t byte_count; +}; + +extern void md5_init(struct md5_ctx *mctx); +extern void md5_update(struct md5_ctx *mctx, const uint8_t *data, unsigned int len); +extern void md5_final(struct md5_ctx *mctx, uint8_t *out); diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index ea07cfd6c1..e71d6208c5 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -269,7 +269,6 @@ void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, en count = 4; break; case UUID_64BIT_LE: - case UUID_64BIT_BE: count = 8; break; case UUID_DCE: @@ -302,11 +301,6 @@ set: buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); break; - case UUID_64BIT_BE: - sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], buf[6], buf[7]); - break; case UUID_DCE: sprintf(id->uuid, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h index e3c766d4ab..fe0b56be81 100644 --- a/extras/volume_id/lib/util.h +++ b/extras/volume_id/lib/util.h @@ -70,7 +70,6 @@ enum uuid_format { UUID_DCE, UUID_DOS, UUID_64BIT_LE, - UUID_64BIT_BE, UUID_MD, UUID_LVM, }; @@ -91,4 +90,3 @@ extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t extern void volume_id_free_buffer(struct volume_id *id); #endif /* _VOLUME_ID_UTIL_ */ - -- cgit v1.2.3-54-g00ecf From 424756eda38b13d853fa8a392d6f0df3e4e802ae Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Sep 2008 10:21:05 +0200 Subject: fix dangling pointer returned by attr_get_by_subsys_id() Thanks to Alan Jenkins for finding this. --- udev/udev_rules.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 693bce261c..557513afcc 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -569,27 +569,29 @@ static int wait_for_file(struct udevice *udev, const char *file, int timeout) static int attr_get_by_subsys_id(const char *attrstr, char *devpath, size_t len, char **attr) { char subsys[NAME_SIZE]; - char *attrib; + char *pos; char *id; + char *attrib; int found = 0; if (attrstr[0] != '[') goto out; - strlcpy(subsys, &attrstr[1], sizeof(subsys)); - - attrib = strchr(subsys, ']'); + attrib = strchr(&attrstr[1], ']'); if (attrib == NULL) goto out; - attrib[0] = '\0'; attrib = &attrib[1]; + strlcpy(subsys, &attrstr[1], sizeof(subsys)); + pos = strchr(subsys, ']'); + if (pos == NULL) + goto out; + pos[0] = '\0'; id = strchr(subsys, '/'); if (id == NULL) goto out; id[0] = '\0'; id = &id[1]; - if (sysfs_lookup_devpath_by_subsys_id(devpath, len, subsys, id)) { if (attr != NULL) { if (attrib[0] != '\0') -- cgit v1.2.3-54-g00ecf From e08109cbc82bc37fc0a1deb202697790afdc5474 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Sep 2008 16:20:06 +0200 Subject: udev-test.pl: add --valgrind option --- test/udev-test.pl | 47 ++++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index ad551dd042..6cd4849045 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -20,16 +20,16 @@ use warnings; use strict; -my $PWD = $ENV{PWD}; -my $sysfs = "sys/"; -my $udev_bin = "../udev/test-udev"; -my $udev_root = "udev-root/"; -my $udev_conf = "udev-test.conf"; -my $udev_rules = "udev-test.rules"; +my $PWD = $ENV{PWD}; +my $sysfs = "sys/"; +my $udev_bin = "../udev/test-udev"; +my $valgrind = 0; +my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; +my $udev_root = "udev-root/"; +my $udev_conf = "udev-test.conf"; +my $udev_rules = "udev-test.rules"; # uncomment following line to run udev with valgrind. -# Should make this a runtime option to the script someday... -#my $udev_bin = "valgrind --tool=memcheck --leak-check=yes ../udev"; my @tests = ( { @@ -1656,7 +1656,11 @@ sub udev { close CONF; $ENV{ACTION} = $action; - system("$udev_bin $subsys"); + if ($valgrind > 0) { + system("$udev_bin_valgrind $subsys"); + } else { + system("$udev_bin $subsys"); + } } my $error = 0; @@ -1857,16 +1861,25 @@ print CONF "udev_log=\"info\"\n"; close CONF; my $test_num = 1; +my @list; -if ($ARGV[0]) { - # only run one test - $test_num = $ARGV[0]; - - if (defined($tests[$test_num-1]->{desc})) { - print "udev-test will run test number $test_num only:\n\n"; - run_test($tests[$test_num-1], $test_num); +foreach my $arg (@ARGV) { + if ($arg =~ m/--valgrind/) { + $valgrind = 1; + printf("using valgrind\n"); } else { - print "test does not exist.\n"; + push(@list, $arg); + } +} + +if ($list[0]) { + foreach my $arg (@list) { + if (defined($tests[$arg-1]->{desc})) { + print "udev-test will run test number $arg:\n\n"; + run_test($tests[$arg-1], $arg); + } else { + print "test does not exist.\n"; + } } } else { # test all -- cgit v1.2.3-54-g00ecf From bc1e4a138b6162885e167e55605a03fa82b2cb9b Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 1 Sep 2008 16:36:43 +0200 Subject: fix uninitialized name_list error::ignore_error Running udevd under valgrind (and then udevtrigger): ==17705== Conditional jump or move depends on uninitialised value(s) ==17705== at 0x407BBB: udev_rules_run (udev_rules.c:522) ==17705== by 0x4109F0: udev_event_process (udevd.c:145) ==17705== by 0x410E2C: udev_event_run (udevd.c:251) ==17705== by 0x411A8D: msg_queue_manager (udevd.c:581) ==17705== by 0x41386B: main (udevd.c:1284) Signed-off-by: Alan Jenkins --- udev/udev_utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev_utils.c b/udev/udev_utils.c index 9b22de783f..f63a9fa1d0 100644 --- a/udev/udev_utils.c +++ b/udev/udev_utils.c @@ -77,7 +77,7 @@ struct name_entry *name_list_add(struct list_head *name_list, const char *name, name_new = malloc(sizeof(struct name_entry)); if (name_new == NULL) return NULL; - + memset(name_new, 0x00, sizeof(struct name_entry)); strlcpy(name_new->name, name, sizeof(name_new->name)); dbg("adding '%s'\n", name_new->name); list_add_tail(&name_new->node, &name_loop->node); @@ -102,7 +102,7 @@ struct name_entry *name_list_key_add(struct list_head *name_list, const char *ke name_new = malloc(sizeof(struct name_entry)); if (name_new == NULL) return NULL; - + memset(name_new, 0x00, sizeof(struct name_entry)); snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); name_new->name[sizeof(name_new->name)-1] = '\0'; dbg("adding '%s'\n", name_new->name); -- cgit v1.2.3-54-g00ecf From 1893cf588f3d428a35a46030deca4ea54be71320 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Sep 2008 16:38:10 +0200 Subject: libudev: libudev.pc add Libs.private --- udev/lib/libudev.pc.in | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/lib/libudev.pc.in b/udev/lib/libudev.pc.in index 4d5a1d2500..8437827d8a 100644 --- a/udev/lib/libudev.pc.in +++ b/udev/lib/libudev.pc.in @@ -7,4 +7,5 @@ Name: libudev Description: Library to access udev device information Version: @VERSION@ Libs: -L${libdir} -ludev +Libs.private: @SELINUX_LIBS@ Cflags: -I${includedir} -- cgit v1.2.3-54-g00ecf From c2175d25248fc25356c881798d688d8745cb5359 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Sep 2008 16:39:34 +0200 Subject: volume_id: fail on undefined __BYTE_ORDER --- extras/volume_id/lib/md5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/md5.c b/extras/volume_id/lib/md5.c index 0860660066..9c4b284644 100644 --- a/extras/volume_id/lib/md5.c +++ b/extras/volume_id/lib/md5.c @@ -20,7 +20,7 @@ #include "md5.h" -#if !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN) +#if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN) #error missing __BYTE_ORDER #endif -- cgit v1.2.3-54-g00ecf From 71ac635d7747d6c1d610d0df9f57182aee3f1cdc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Sep 2008 16:40:31 +0200 Subject: remove FAQ --- FAQ | 111 -------------------------------------------------------------------- 1 file changed, 111 deletions(-) delete mode 100644 FAQ diff --git a/FAQ b/FAQ deleted file mode 100644 index 2117a15fdf..0000000000 --- a/FAQ +++ /dev/null @@ -1,111 +0,0 @@ -Frequently Asked Questions about udev - -Q: What's this udev thing, and what is it trying to do? -A: Read the OLS 2003 paper about udev, available in the docs/ directory, - and at: - - There is also a udev presentation given at OLS 2003 available at: - - -Q: How is udev related to devfs? -A: udev works entirely in userspace, using hotplug events the kernel sends - whenever a device is added or removed from the kernel. Details about - the devices are exported by the kernel to the sysfs filesystem at /sys - All device naming policy permission control and event handling is done in - userspace. devfs is operated from within the kernel. - -Q: Why was devfs removed if udev can't do everthing devfs did? -A: To quote Al Viro (Linux VFS kernel maintainer): - - it was determined that the same thing could be done in userspace - - devfs had been shoved into the tree in hope that its quality will - catch up - - devfs was found to have fixable and unfixable bugs - - the former had stayed around for many months with maintainer - claiming that everything works fine - - the latter had stayed, period. - - the devfs maintainer/author disappeared and stopped maintaining - the code. - -Q: But udev will not automatically load a driver if a /dev node is opened - when it is not present like devfs will do. -A: Right, but Linux is supposed to load a module when a device is discovered - not to load a module when it's accessed. - -Q: Oh come on, pretty please. It can't be that hard to do. -A: Such a functionality isn't needed on a properly configured system. All - devices present on the system should generate hotplug events, loading - the appropriate driver, and udev will notice and create the - appropriate device node. If you don't want to keep all drivers for your - hardware in memory, then use something else to manage your modules - (scripts, modules.conf, etc.) This is not a task for udev. - -Q: But I love that feature of devfs, please? -A: The devfs approach caused a lot of spurious modprobe attempts as - programs probed to see if devices were present or not. Every probe - attempt created a process to run modprobe, almost all of which were - spurious. - -Q: I really like the devfs naming scheme, will udev do that? -A: Yes, udev can create /dev nodes using the devfs naming policy. But you - will need a custom configuration and scripts that enumerate your devices - sequentially while events run in parallel, without a predictable order. - The devfs scheme is not recommended or supported because it is a stupid - idea to simply enumerate devices in a world where devices can come and go - at any time. These numbers give you nothing but problems, and are not - useful to identify a device. Have a look at the persistent rules for - examples how to create persistent device names in userspace without any - device enumeration depending on the device probing order. - -Q: What kinds of devices does udev create nodes for? -A: All devices that are shown in the kernel's sysfs tree will work with udev. - -Q: Will udev remove the limit on the number of anonymous devices? -A: udev is entirely in userspace. If the kernel supports a greater number - of anonymous devices, udev will support it. - -Q: Does udev support symlinks? -A: Yes, multiple symlinks per device node are supported. - -Q: How will udev handle the /dev filesystem? -A: /dev is recomended to be a tmpfs filesystem that is recreated on every reboot. - Although, udev does not care what kind of filesystem it runs on. - -Q: How will udev handle devices found before init runs? -A: udev can be placed in initramfs and run for every device that is found. - udev can also populate an initial /dev directory from the content of /sys - after the real root is mounted. - -Q: Can I use udev to automount a USB device when I connect it? -A: Technically, yes, but udev is not intended for this. All major distributions - use HAL (http://freedesktop.org/wiki/Software_2fhal) for this, which also - watches devices with removable media and integrates the Desktop environment. - - Alternatively, it is easy to add the following to fstab: - /dev/disk/by-label/PENDRIVE /media/PENDRIVE vfat user,noauto 0 0 - - This means that users can access the device with: - $mount /media/PENDRIVE - and doen't have to be root, but will get full permissions on the device. - Using the persistent disk links (label, uuid) will always catch the - same device regardless of the actual kernel name. - -Q: Are there any security issues that I should be aware of? -A: When using dynamic device numbers, a given pair of major/minor numbers may - point to different hardware over time. If a user has permission to access a - specific device node directly and is able to create hard links to this node, - he or she can do so to create a copy of the device node. When the device is - unplugged and udev removes the device node, the user's copy remains. - If the device node is later recreated with different permissions the hard - link can still be used to access the device using the old permissions. - (The same problem exists when using PAM to change permissions on login.) - - The simplest solution is to prevent the creation of hard links by putting - /dev on a separate filesystem like tmpfs. - -Q: I have other questions about udev, where do I ask them? -A: The linux-hotplug-devel mailing list is the proper place for it. The - address for it is: - linux-hotplug@vger.kernel.org - Information on joining can be found at: - http://vger.kernel.org/vger-lists.html - -- cgit v1.2.3-54-g00ecf From b98fd8400542472bd0989a4f03358d403fb71f35 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Sep 2008 16:41:41 +0200 Subject: libudev: fix monitor documentation --- udev/lib/libudev-monitor.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 025ce7f0ef..c8f07eae8f 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -146,7 +146,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) * udev_monitor_get_udev: * @udev_monitor: udev monitor * - * Retrieve the udev library context the device was created with. + * Retrieve the udev library context the monitor was created with. * * Returns: the udev library context **/ @@ -177,10 +177,10 @@ int udev_monitor_get_fd(struct udev_monitor *udev_monitor) * @udev_monitor: udev monitor * * Retrieve data from the udev monitor socket, allocate a new udev - * device, and fill in the received data, and return the device. + * device, fill in the received data, and return the device. * * Only socket connections with uid=0 are accepted. The caller - * need to make sure, that there is data to read from the socket, + * needs to make sure, that there is data to read from the socket, * the call will block until the socket becomes readable. * * The initial refcount is 1, and needs to be decremented to -- cgit v1.2.3-54-g00ecf From 11d543c1ee886ef30c3ef66d7176149d0b126fa5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Sep 2008 18:52:22 +0200 Subject: libudev: add udev_device_get_syspath() --- udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 75 ++++++++++++++++++++++++++++++++++++++++++---- udev/lib/libudev-monitor.c | 12 ++++---- udev/lib/libudev-private.h | 20 ++++++------- udev/lib/libudev.h | 3 +- udev/lib/test-libudev.c | 2 ++ 6 files changed, 91 insertions(+), 22 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 0826e6f6f1..4db23b2251 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -10,6 +10,7 @@ udev_device_ref udev_device_unref udev_device_get_udev udev_device_get_devpath +udev_device_get_syspath udev_device_get_devname udev_device_get_subsystem udev_device_get_devlinks diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 6465157fbd..c4d65e9c49 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -32,6 +32,17 @@ #include "libudev-private.h" #include "../udev.h" +struct udev_device { + int refcount; + struct udev *udev; + char *devpath; + char *syspath; + char *devname; + char *subsystem; + struct list_head link_list; + struct list_head env_list; +}; + struct udev_device *device_init(struct udev *udev) { struct udev_device *udev_device; @@ -99,7 +110,7 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * /* resolve possible symlink to real path */ strlcpy(path, devpath, sizeof(path)); sysfs_resolve_link(path, sizeof(path)); - udev_device->devpath = strdup(path); + device_set_devpath(udev_device, devpath); log_info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); err = udev_db_get_device(udevice, path); @@ -171,7 +182,7 @@ void udev_device_unref(struct udev_device *udev_device) udev_device->refcount--; if (udev_device->refcount > 0) return; - free(udev_device->devpath); + free(udev_device->syspath); free(udev_device->devname); free(udev_device->subsystem); name_list_cleanup(&udev_device->link_list); @@ -184,10 +195,10 @@ void udev_device_unref(struct udev_device *udev_device) * udev_device_get_devpath: * @udev_device: udev device * - * Retrieve the sys path of the udev device. The path does not contain - * the sys mount point. + * Retrieve the kernel devpath value of the udev device. The path + * does not contain the sys mount point, and starts with a '/'. * - * Returns: the sys path of the udev device + * Returns: the devpath of the udev device **/ const char *udev_device_get_devpath(struct udev_device *udev_device) { @@ -196,6 +207,22 @@ const char *udev_device_get_devpath(struct udev_device *udev_device) return udev_device->devpath; } +/** + * udev_device_get_syspath: + * @udev_device: udev device + * + * Retrieve the sys path of the udev device. The path is an + * absolute path and starts with the sys mount point. + * + * Returns: the sys path of the udev device + **/ +const char *udev_device_get_syspath(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->syspath; +} + /** * udev_device_get_devname: * @udev_device: udev device @@ -305,3 +332,41 @@ int udev_device_get_properties(struct udev_device *udev_device, } return count; } + +int device_set_devpath(struct udev_device *udev_device, const char *devpath) +{ + if (asprintf(&udev_device->syspath, "%s%s", udev_get_sys_path(udev_device->udev), devpath) < 0) + return -ENOMEM; + udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; + return 0; +} + +int device_set_subsystem(struct udev_device *udev_device, const char *subsystem) +{ + udev_device->subsystem = strdup(subsystem); + if (udev_device->subsystem == NULL) + return -1; + return 0; +} + +int device_set_devname(struct udev_device *udev_device, const char *devname) +{ + udev_device->devname = strdup(devname); + if (udev_device->devname == NULL) + return -ENOMEM; + return 0; +} + +int device_add_devlink(struct udev_device *udev_device, const char *devlink) +{ + if (name_list_add(&udev_device->link_list, devlink, 0) == NULL) + return -ENOMEM; + return 0; +} + +int device_add_property(struct udev_device *udev_device, const char *property) +{ + if (name_list_add(&udev_device->env_list, property, 0) == NULL) + return -ENOMEM; + return 0; +} diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index c8f07eae8f..92617e8888 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -257,25 +257,25 @@ struct udev_device *udev_monitor_get_device(struct udev_monitor *udev_monitor) bufpos += keylen + 1; if (strncmp(key, "DEVPATH=", 8) == 0) { - udev_device->devpath = strdup(&key[8]); + device_set_devpath(udev_device, &key[8]); } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { - udev_device->subsystem = strdup(&key[10]); + device_set_subsystem(udev_device, &key[10]); } else if (strncmp(key, "DEVNAME=", 8) == 0) { - udev_device->devname = strdup(&key[8]); + device_set_devname(udev_device, &key[8]); } else if (strncmp(key, "DEVLINKS=", 9) == 0) { char *slink = &key[9]; char *next = strchr(slink, ' '); while (next != NULL) { next[0] = '\0'; - name_list_add(&udev_device->link_list, slink, 0); + device_add_devlink(udev_device, slink); slink = &next[1]; next = strchr(slink, ' '); } if (slink[0] != '\0') - name_list_add(&udev_device->link_list, slink, 0); + device_add_devlink(udev_device, slink); } - name_list_add(&udev_device->env_list, key, 0); + device_add_property(udev_device, key); } return udev_device; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 6331f99d5b..ffdf571513 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -43,16 +43,16 @@ void udev_log(struct udev *udev, #define log_err(format, arg...) do { } while (0) #endif -struct udev_device { - int refcount; - struct udev *udev; - char *devpath; - char *devname; - char *subsystem; - struct list_head link_list; - struct list_head env_list; -}; - +/* libudev */ extern struct udev_device *device_init(struct udev *udev); + +/* libudev-device */ +extern int device_set_devpath(struct udev_device *udev_device, const char *devpath); +extern int device_set_subsystem(struct udev_device *udev_device, const char *subsystem); +extern int device_set_devname(struct udev_device *udev_device, const char *devname); +extern int device_add_devlink(struct udev_device *udev_device, const char *devlink); +extern int device_add_property(struct udev_device *udev_device, const char *property); + +/* libudev-utils */ extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); #endif diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 3a1c1bf3ac..30753a19a7 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -44,8 +44,9 @@ extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); extern struct udev *udev_device_get_udev(struct udev_device *udev_device); extern const char *udev_device_get_devpath(struct udev_device *udev_device); -extern const char *udev_device_get_devname(struct udev_device *udev_device); extern const char *udev_device_get_subsystem(struct udev_device *udev_device); +extern const char *udev_device_get_syspath(struct udev_device *udev_device); +extern const char *udev_device_get_devname(struct udev_device *udev_device); extern int udev_device_get_devlinks(struct udev_device *udev_device, int (*cb)(struct udev_device *udev_device, const char *value, void *data), diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 3c38600192..d0095f15fc 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -58,6 +58,8 @@ static void print_device(struct udev_device *device) printf("devpath: '%s'\n", str); str = udev_device_get_subsystem(device); printf("subsystem: '%s'\n", str); + str = udev_device_get_syspath(device); + printf("syspath: '%s'\n", str); str = udev_device_get_devname(device); printf("devname: '%s'\n", str); count = udev_device_get_devlinks(device, print_devlinks_cb, NULL); -- cgit v1.2.3-54-g00ecf From 0d1c29c3d143232dfedf0881524bb2ef803c3067 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 1 Sep 2008 19:46:19 +0200 Subject: do not needlessly declare some local variables in udev_rules_parse.c as static --- udev/udev_rules_parse.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 705b3feb04..90b139be4b 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -41,7 +41,7 @@ void udev_rules_iter_init(struct udev_rules *rules) struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) { - static struct udev_rule *rule; + struct udev_rule *rule; if (!rules) return NULL; @@ -61,7 +61,7 @@ struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label) { - static struct udev_rule *rule; + struct udev_rule *rule; size_t start = rules->current; next: -- cgit v1.2.3-54-g00ecf From 44aff4cd6d74d230e4a97f8d59f780472b7cad6e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Sep 2008 20:59:09 +0200 Subject: udev_device_init() remove statically allocated device support --- TODO | 1 - udev/lib/libudev-device.c | 2 +- udev/test-udev.c | 4 +++- udev/udev.h | 2 +- udev/udev_device.c | 10 ++++++---- udev/udev_device_event.c | 2 +- udev/udev_node.c | 2 +- udev/udev_rules.c | 4 ++-- udev/udevd.c | 2 +- udev/udevinfo.c | 43 ++++++++++++++++++++++++------------------- udev/udevtest.c | 2 +- udev/udevtrigger.c | 16 +++++++++------- 12 files changed, 50 insertions(+), 40 deletions(-) diff --git a/TODO b/TODO index 5afde0c8de..20ed648d06 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ These things would be nice to have: o get all distros to agree on a default set of rules - o fix (non important) memleak in udevinfo at udev_device_init() loop o rework rules to a match-action list, instead of a rules array These things will change in future udev versions: diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index c4d65e9c49..629cadbc47 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -101,7 +101,7 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * if (udev_device == NULL) return NULL; - udevice = udev_device_init(NULL); + udevice = udev_device_init(); if (udevice == NULL) { free(udev_device); return NULL; diff --git a/udev/test-udev.c b/udev/test-udev.c index 591e93058a..4d5881deae 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "udev.h" #include "udev_rules.h" @@ -138,7 +139,7 @@ int main(int argc, char *argv[], char *envp[]) goto fail; } - udev = udev_device_init(NULL); + udev = udev_device_init(); if (udev == NULL) goto fail; @@ -171,6 +172,7 @@ fail: exit: logging_close(); + endgrent(); if (retval != 0) return 1; return 0; diff --git a/udev/udev.h b/udev/udev.h index b633807389..94456749a8 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -101,7 +101,7 @@ extern int udev_run; extern void udev_config_init(void); /* udev_device.c */ -extern struct udevice *udev_device_init(struct udevice *udev); +extern struct udevice *udev_device_init(void); extern void udev_device_cleanup(struct udevice *udev); extern dev_t udev_device_get_devt(struct udevice *udev); diff --git a/udev/udev_device.c b/udev/udev_device.c index 98886763c4..130c714301 100644 --- a/udev/udev_device.c +++ b/udev/udev_device.c @@ -34,10 +34,11 @@ #include "udev_rules.h" -struct udevice *udev_device_init(struct udevice *udev) +struct udevice *udev_device_init(void) { - if (udev == NULL) - udev = malloc(sizeof(struct udevice)); + struct udevice *udev; + + udev = malloc(sizeof(struct udevice)); if (udev == NULL) return NULL; memset(udev, 0x00, sizeof(struct udevice)); @@ -55,12 +56,13 @@ struct udevice *udev_device_init(struct udevice *udev) strcpy(udev->group, "root"); udev->event_timeout = -1; - return udev; } void udev_device_cleanup(struct udevice *udev) { + if (udev == NULL) + return; name_list_cleanup(&udev->symlink_list); name_list_cleanup(&udev->run_list); name_list_cleanup(&udev->env_list); diff --git a/udev/udev_device_event.c b/udev/udev_device_event.c index 045035d44e..8ad79644af 100644 --- a/udev/udev_device_event.c +++ b/udev/udev_device_event.c @@ -146,7 +146,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev) } /* read current database entry; cleanup, if it is known device */ - udev_old = udev_device_init(NULL); + udev_old = udev_device_init(); if (udev_old != NULL) { udev_old->test_run = udev->test_run; if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { diff --git a/udev/udev_node.c b/udev/udev_node.c index 78b6747043..33183c8d2a 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -234,7 +234,7 @@ static int update_link(struct udevice *udev, const char *name) } /* another device, read priority from database */ - udev_db = udev_device_init(NULL); + udev_db = udev_device_init(); if (udev_db == NULL) continue; if (udev_db_get_device(udev_db, device->name) == 0) { diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 557513afcc..4719cab5b8 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -424,7 +424,7 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) struct name_entry *name_loop; dbg("found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(NULL); + udev_parent = udev_device_init(); if (udev_parent == NULL) return -1; /* import the udev_db of the parent */ @@ -883,7 +883,7 @@ found: struct udevice *udev_parent; dbg("found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(NULL); + udev_parent = udev_device_init(); if (udev_parent != NULL) { /* lookup the name in the udev_db with the DEVPATH of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { diff --git a/udev/udevd.c b/udev/udevd.c index 22d261fccb..654118e5a9 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -126,7 +126,7 @@ static int udev_event_process(struct udevd_uevent_msg *msg) for (i = 0; msg->envp[i]; i++) putenv(msg->envp[i]); - udev = udev_device_init(NULL); + udev = udev_device_init(); if (udev == NULL) return -1; strlcpy(udev->action, msg->action, sizeof(udev->action)); diff --git a/udev/udevinfo.c b/udev/udevinfo.c index a97f09c3e6..714a69c384 100644 --- a/udev/udevinfo.c +++ b/udev/udevinfo.c @@ -157,7 +157,7 @@ static void export_db(void) { list_for_each_entry(name_loop, &name_list, node) { struct udevice *udev_db; - udev_db = udev_device_init(NULL); + udev_db = udev_device_init(); if (udev_db == NULL) continue; if (udev_db_get_device(udev_db, name_loop->name) == 0) @@ -168,7 +168,7 @@ static void export_db(void) { name_list_cleanup(&name_list); } -static int lookup_device_by_name(struct udevice *udev, const char *name) +static int lookup_device_by_name(struct udevice **udev, const char *name) { LIST_HEAD(name_list); int count; @@ -183,26 +183,32 @@ static int lookup_device_by_name(struct udevice *udev, const char *name) /* select the device that seems to match */ list_for_each_entry(device, &name_list, node) { + struct udevice *udev_loop; char filename[PATH_SIZE]; struct stat statbuf; - udev_device_init(udev); - if (udev_db_get_device(udev, device->name) != 0) - continue; + udev_loop = udev_device_init(); + if (udev_loop == NULL) + break; + if (udev_db_get_device(udev_loop, device->name) != 0) + goto next; info("found db entry '%s'\n", device->name); - /* make sure, we don't get a link of a differnt device */ + /* make sure, we don't get a link of a different device */ strlcpy(filename, udev_root, sizeof(filename)); strlcat(filename, "/", sizeof(filename)); strlcat(filename, name, sizeof(filename)); if (stat(filename, &statbuf) != 0) - continue; - if (major(udev->devt) > 0 && udev->devt != statbuf.st_rdev) { - info("skip '%s', dev_t doesn't match\n", udev->name); - continue; + goto next; + if (major(udev_loop->devt) > 0 && udev_loop->devt != statbuf.st_rdev) { + info("skip '%s', dev_t doesn't match\n", udev_loop->name); + goto next; } rc = 0; + *udev = udev_loop; break; +next: + udev_device_cleanup(udev_loop); } out: name_list_cleanup(&name_list); @@ -231,7 +237,7 @@ static int stat_device(const char *name, int export, const char *prefix) int udevinfo(int argc, char *argv[], char *envp[]) { int option; - struct udevice *udev; + struct udevice *udev = NULL; int root = 0; int export = 0; const char *export_prefix = NULL; @@ -277,12 +283,6 @@ int udevinfo(int argc, char *argv[], char *envp[]) udev_config_init(); sysfs_init(); - udev = udev_device_init(NULL); - if (udev == NULL) { - rc = 1; - goto exit; - } - while (1) { option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); if (option == -1) @@ -408,13 +408,18 @@ int udevinfo(int argc, char *argv[], char *envp[]) case ACTION_QUERY: /* needs devpath or node/symlink name for query */ if (path[0] != '\0') { + udev = udev_device_init(); + if (udev == NULL) { + rc = 1; + goto exit; + } if (udev_db_get_device(udev, path) != 0) { fprintf(stderr, "no record for '%s' in database\n", path); rc = 3; goto exit; } } else if (name[0] != '\0') { - if (lookup_device_by_name(udev, name) != 0) { + if (lookup_device_by_name(&udev, name) != 0) { fprintf(stderr, "node name not found\n"); rc = 4; goto exit; @@ -465,7 +470,7 @@ int udevinfo(int argc, char *argv[], char *envp[]) goto exit; } } else if (name[0] != '\0') { - if (lookup_device_by_name(udev, name) != 0) { + if (lookup_device_by_name(&udev, name) != 0) { fprintf(stderr, "node name not found\n"); rc = 4; goto exit; diff --git a/udev/udevtest.c b/udev/udevtest.c index 2b43691f39..7c6e3f9178 100644 --- a/udev/udevtest.c +++ b/udev/udevtest.c @@ -157,7 +157,7 @@ int udevtest(int argc, char *argv[], char *envp[]) goto exit; } - udev = udev_device_init(NULL); + udev = udev_device_init(); if (udev == NULL) { fprintf(stderr, "error initializing device\n"); rc = 3; diff --git a/udev/udevtrigger.c b/udev/udevtrigger.c index 19a3dbb10e..3dd9109b8b 100644 --- a/udev/udevtrigger.c +++ b/udev/udevtrigger.c @@ -122,7 +122,7 @@ static void trigger_uevent(const char *devpath, const char *action) static int pass_to_socket(const char *devpath, const char *action, const char *env) { - struct udevice udev; + struct udevice *udev; struct name_entry *name_loop; char buf[4096]; size_t bufpos = 0; @@ -136,8 +136,10 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e if (verbose) printf("%s\n", devpath); - udev_device_init(&udev); - udev_db_get_device(&udev, devpath); + udev = udev_device_init(); + if (udev == NULL) + return -1; + udev_db_get_device(udev, devpath); /* add header */ bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); @@ -173,7 +175,7 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e /* add symlinks and node name */ path[0] = '\0'; - list_for_each_entry(name_loop, &udev.symlink_list, node) { + list_for_each_entry(name_loop, &udev->symlink_list, node) { strlcat(path, udev_root, sizeof(path)); strlcat(path, "/", sizeof(path)); strlcat(path, name_loop->name, sizeof(path)); @@ -184,10 +186,10 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path); bufpos++; } - if (udev.name[0] != '\0') { + if (udev->name[0] != '\0') { strlcpy(path, udev_root, sizeof(path)); strlcat(path, "/", sizeof(path)); - strlcat(path, udev.name, sizeof(path)); + strlcat(path, udev->name, sizeof(path)); bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path); bufpos++; } @@ -222,7 +224,7 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e } /* add keys from database */ - list_for_each_entry(name_loop, &udev.env_list, node) { + list_for_each_entry(name_loop, &udev->env_list, node) { bufpos += strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); bufpos++; } -- cgit v1.2.3-54-g00ecf From 593453115b777368252ca4231537ad2a9e6d8ffb Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 2 Sep 2008 23:19:36 +0200 Subject: remove deprecated envp[] in main() envp is not standardized, and may become invalid when environment variables are modified. Since udev never actually uses it, we can simply remove it. Should anyone miss it in future, they can use the standardized environ variable - like udev_rules.c does already. --- udev/test-udev.c | 2 +- udev/udev.h | 12 ++++++------ udev/udevadm.c | 10 +++++----- udev/udevcontrol.c | 2 +- udev/udevd.c | 2 +- udev/udevinfo.c | 2 +- udev/udevmonitor.c | 2 +- udev/udevsettle.c | 2 +- udev/udevtest.c | 2 +- udev/udevtrigger.c | 2 +- 10 files changed, 19 insertions(+), 19 deletions(-) diff --git a/udev/test-udev.c b/udev/test-udev.c index 4d5881deae..07628f74fd 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -60,7 +60,7 @@ static void asmlinkage sig_handler(int signum) } } -int main(int argc, char *argv[], char *envp[]) +int main(int argc, char *argv[]) { struct sysfs_device *dev; struct udevice *udev; diff --git a/udev/udev.h b/udev/udev.h index 94456749a8..da86365056 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -168,11 +168,11 @@ extern int unlink_secure(const char *filename); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); /* udev commands */ -extern int udevmonitor(int argc, char *argv[], char *envp[]); -extern int udevinfo(int argc, char *argv[], char *envp[]); -extern int udevcontrol(int argc, char *argv[], char *envp[]); -extern int udevtrigger(int argc, char *argv[], char *envp[]); -extern int udevsettle(int argc, char *argv[], char *envp[]); -extern int udevtest(int argc, char *argv[], char *envp[]); +extern int udevmonitor(int argc, char *argv[]); +extern int udevinfo(int argc, char *argv[]); +extern int udevcontrol(int argc, char *argv[]); +extern int udevtrigger(int argc, char *argv[]); +extern int udevsettle(int argc, char *argv[]); +extern int udevtest(int argc, char *argv[]); #endif diff --git a/udev/udevadm.c b/udev/udevadm.c index 7adb7c5732..cb356c5252 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -49,20 +49,20 @@ void log_message(int priority, const char *format, ...) struct command { const char *name; - int (*cmd)(int argc, char *argv[], char *envp[]); + int (*cmd)(int argc, char *argv[]); const char *help; int debug; }; static const struct command cmds[]; -static int version(int argc, char *argv[], char *envp[]) +static int version(int argc, char *argv[]) { printf("%s\n", VERSION); return 0; } -static int help(int argc, char *argv[], char *envp[]) +static int help(int argc, char *argv[]) { const struct command *cmd; @@ -118,7 +118,7 @@ static const struct command cmds[] = { {} }; -int main(int argc, char *argv[], char *envp[]) +int main(int argc, char *argv[]) { const char *command; const char *pos; @@ -157,7 +157,7 @@ int main(int argc, char *argv[], char *envp[]) for (cmd = cmds; cmd->name != NULL; cmd++) { if (strcmp(cmd->name, command) == 0) { debug = cmd->debug; - rc = cmd->cmd(argc, argv, envp); + rc = cmd->cmd(argc, argv); goto out; } } diff --git a/udev/udevcontrol.c b/udev/udevcontrol.c index a02bfc4d65..f4830d8423 100644 --- a/udev/udevcontrol.c +++ b/udev/udevcontrol.c @@ -36,7 +36,7 @@ static int sock = -1; static int udev_log = 0; -int udevcontrol(int argc, char *argv[], char *envp[]) +int udevcontrol(int argc, char *argv[]) { static struct udevd_ctrl_msg ctrl_msg; struct sockaddr_un saddr; diff --git a/udev/udevd.c b/udev/udevd.c index 654118e5a9..49159494c4 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -953,7 +953,7 @@ static void export_initial_seqnum(void) } } -int main(int argc, char *argv[], char *envp[]) +int main(int argc, char *argv[]) { int retval; int fd; diff --git a/udev/udevinfo.c b/udev/udevinfo.c index 714a69c384..738ffc67de 100644 --- a/udev/udevinfo.c +++ b/udev/udevinfo.c @@ -234,7 +234,7 @@ static int stat_device(const char *name, int export, const char *prefix) return 0; } -int udevinfo(int argc, char *argv[], char *envp[]) +int udevinfo(int argc, char *argv[]) { int option; struct udevice *udev = NULL; diff --git a/udev/udevmonitor.c b/udev/udevmonitor.c index 2430dd39a5..3b65bcae9b 100644 --- a/udev/udevmonitor.c +++ b/udev/udevmonitor.c @@ -123,7 +123,7 @@ static const char *search_key(const char *searchkey, const char *buf, size_t buf return NULL; } -int udevmonitor(int argc, char *argv[], char *envp[]) +int udevmonitor(int argc, char *argv[]) { struct sigaction act; int option; diff --git a/udev/udevsettle.c b/udev/udevsettle.c index f00a38b4b7..11277f5a43 100644 --- a/udev/udevsettle.c +++ b/udev/udevsettle.c @@ -67,7 +67,7 @@ static void print_queue(const char *dir) printf("\n\n"); } -int udevsettle(int argc, char *argv[], char *envp[]) +int udevsettle(int argc, char *argv[]) { char queuename[PATH_SIZE]; char filename[PATH_SIZE]; diff --git a/udev/udevtest.c b/udev/udevtest.c index 7c6e3f9178..63603aad97 100644 --- a/udev/udevtest.c +++ b/udev/udevtest.c @@ -71,7 +71,7 @@ out: return rc; } -int udevtest(int argc, char *argv[], char *envp[]) +int udevtest(int argc, char *argv[]) { int force = 0; const char *action = "add"; diff --git a/udev/udevtrigger.c b/udev/udevtrigger.c index 3dd9109b8b..4a8f62ab5c 100644 --- a/udev/udevtrigger.c +++ b/udev/udevtrigger.c @@ -562,7 +562,7 @@ static void scan_failed(void) } } -int udevtrigger(int argc, char *argv[], char *envp[]) +int udevtrigger(int argc, char *argv[]) { int failed = 0; const char *sockpath = NULL; -- cgit v1.2.3-54-g00ecf From cce9d77393c1af2c69f441feef8565969e5a417d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 3 Sep 2008 19:50:36 +0200 Subject: udevadm: info - fix broken --device-id-of-file= --- udev/udevinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevinfo.c b/udev/udevinfo.c index 738ffc67de..6501b57d1a 100644 --- a/udev/udevinfo.c +++ b/udev/udevinfo.c @@ -230,7 +230,7 @@ static int stat_device(const char *name, int export, const char *prefix) prefix, major(statbuf.st_dev), prefix, minor(statbuf.st_dev)); } else - printf("%d %d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); + printf("%d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); return 0; } -- cgit v1.2.3-54-g00ecf From 2b725651e5b77e88a314d34b8cf8e375514b400f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 3 Sep 2008 21:56:47 +0200 Subject: udevadm: control - use getopt_long() --- NEWS | 8 ++ udev.conf | 2 +- udev/udevadm.xml | 12 +- udev/udevcontrol.c | 345 +++++++++++++++++++++++++++++++++++++---------------- udev/udevd.c | 24 ++-- udev/udevd.h | 13 +- 6 files changed, 275 insertions(+), 129 deletions(-) diff --git a/NEWS b/NEWS index 93cecab7f8..70cd0debbb 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +udev 128 +======== +Bugfixes. + +The udevadm info --device-id-of-file= output has changed to use +the obvious format. Possible current users should use the --export +option which is not affected. + udev 127 ======== Bugfixes. diff --git a/udev.conf b/udev.conf index 998b4a7d18..31bb6620ee 100644 --- a/udev.conf +++ b/udev.conf @@ -1,4 +1,4 @@ # The initial syslog(3) priority: "err", "info", "debug" or its # numerical equivalent. For runtime debugging, the daemons internal -# state can be changed with: "udevadm control --log_priority=". +# state can be changed with: "udevadm control --log-priority=". udev_log="err" diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 670c991457..de0e026e8f 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -231,7 +231,7 @@ Modify the internal state of the running udev daemon. - + Set the internal log level of udevd. Valid values are the numerical syslog priorities or their textual representations: , @@ -239,20 +239,20 @@ - + Signal udevd to stop executing new events. Incoming events will be queued. - + Signal udevd to enable the execution of events. - + Signal udevd to reload the rules from the config. @@ -264,14 +264,14 @@ - value + value Set the maximum number of events, udevd will handle at the same time. - + Set the maximum number of events, which are allowed to run at the same time. diff --git a/udev/udevcontrol.c b/udev/udevcontrol.c index f4830d8423..5f1952543c 100644 --- a/udev/udevcontrol.c +++ b/udev/udevcontrol.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -33,19 +34,144 @@ #include "udev.h" #include "udevd.h" -static int sock = -1; static int udev_log = 0; -int udevcontrol(int argc, char *argv[]) -{ - static struct udevd_ctrl_msg ctrl_msg; +struct udev_ctrl; +extern struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path); +extern void udev_ctrl_unref(struct udev_ctrl *uctrl); +extern int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority); +extern int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl); +extern int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl); +extern int udev_ctrl_reload_rules(struct udev_ctrl *uctrl); +extern int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key); +extern int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count); +extern int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count); + +struct udev_ctrl { + int sock; struct sockaddr_un saddr; socklen_t addrlen; +}; + +struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path) +{ + struct udev_ctrl *uctrl; + + uctrl = malloc(sizeof(struct udev_ctrl)); + if (uctrl == NULL) + return NULL; + memset(uctrl, 0x00, sizeof(struct udev_ctrl)); + + uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (uctrl->sock < 0) { + err("error getting socket: %s\n", strerror(errno)); + free(uctrl); + return NULL; + } + + uctrl->saddr.sun_family = AF_LOCAL; + strcpy(uctrl->saddr.sun_path, socket_path); + uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); + /* translate leading '@' to abstract namespace */ + if (uctrl->saddr.sun_path[0] == '@') + uctrl->saddr.sun_path[0] = '\0'; + return uctrl; +} + +void udev_ctrl_unref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return; + close(uctrl->sock); +} + +static int ctrl_send(struct udev_ctrl *uctrl, enum udevd_ctrl_msg_type type, int intval, const char *buf) +{ + struct udevd_ctrl_msg ctrl_msg; + int err; + + memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); + strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); + ctrl_msg.type = type; + + if (buf != NULL) + strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); + else + ctrl_msg.intval = intval; + + err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err == -1) { + err("error sending message: %s\n", strerror(errno)); + } + return err; +} + +int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority) +{ + ctrl_send(uctrl, UDEVD_CTRL_SET_LOG_LEVEL, priority, NULL); + return 0; +} + +int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEVD_CTRL_STOP_EXEC_QUEUE, 0, NULL); + return 0; +} + +int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEVD_CTRL_START_EXEC_QUEUE, 0, NULL); + return 0; +} + +int udev_ctrl_reload_rules(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEVD_CTRL_RELOAD_RULES, 0, NULL); + return 0; +} + +int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key) +{ + ctrl_send(uctrl, UDEVD_CTRL_ENV, 0, optarg); + return 0; +} + +int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count) +{ + ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS, count, NULL); + return 0; +} + +int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count) +{ + ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, count, NULL); + return 0; +} + +int udevcontrol(int argc, char *argv[]) +{ + struct udev_ctrl *uctrl; const char *env; - const char *arg; - const char *val; - int *intval; - int retval = 1; + int rc = 1; + + /* compat values with '_' will be removed in a future release */ + static const struct option options[] = { + { "log-priority", 1, NULL, 'l' }, + { "log_priority", 1, NULL, 'l' + 256 }, + { "stop-exec-queue", 0, NULL, 's' }, + { "stop_exec_queue", 0, NULL, 's' + 256 }, + { "start-exec-queue", 0, NULL, 'S' }, + { "start_exec_queue", 0, NULL, 'S' + 256}, + { "reload-rules", 0, NULL, 'R' }, + { "reload_rules", 0, NULL, 'R' + 256}, + { "env", 1, NULL, 'e' }, + { "max-childs", 1, NULL, 'm' }, + { "max_childs", 1, NULL, 'm' + 256}, + { "max-childs-running", 1, NULL, 'M' }, + { "max_childs_running", 1, NULL, 'M' + 256}, + { "help", 0, NULL, 'h' }, + {} + }; env = getenv("UDEV_LOG"); if (env) @@ -54,114 +180,125 @@ int udevcontrol(int argc, char *argv[]) logging_init("udevcontrol"); dbg("version %s\n", VERSION); - if (argc < 2) { - fprintf(stderr, "missing command\n\n"); + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); goto exit; } - memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); - strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); - arg = argv[1]; - - /* allow instructions passed as options */ - if (strncmp(arg, "--", 2) == 0) - arg += 2; - - if (!strcmp(arg, "stop_exec_queue")) - ctrl_msg.type = UDEVD_CTRL_STOP_EXEC_QUEUE; - else if (!strcmp(arg, "start_exec_queue")) - ctrl_msg.type = UDEVD_CTRL_START_EXEC_QUEUE; - else if (!strcmp(arg, "reload_rules")) - ctrl_msg.type = UDEVD_CTRL_RELOAD_RULES; - else if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { - intval = (int *) ctrl_msg.buf; - val = &arg[strlen("log_priority=")]; - ctrl_msg.type = UDEVD_CTRL_SET_LOG_LEVEL; - *intval = log_priority(val); - info("send log_priority=%i\n", *intval); - } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { + + uctrl = udev_ctrl_new_from_socket(UDEVD_CTRL_SOCK_PATH); + if (uctrl == NULL) + goto exit; + + while (1) { + int option; + int i; char *endp; - int count; - - intval = (int *) ctrl_msg.buf; - val = &arg[strlen("max_childs=")]; - ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS; - count = strtoul(val, &endp, 0); - if (endp[0] != '\0' || count < 1) { - fprintf(stderr, "invalid number\n"); - goto exit; + + option = getopt_long(argc, argv, "l:sSRe:m:M:h", options, NULL); + if (option == -1) + break; + + if (option > 255) { + info("udevadm control expects commands without underscore, " + "this will stop working in a future release\n"); + fprintf(stderr, "udevadm control expects commands without underscore, " + "this will stop working in a future release\n"); } - *intval = count; - info("send max_childs=%i\n", *intval); - } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { - char *endp; - int count; - - intval = (int *) ctrl_msg.buf; - val = &arg[strlen("max_childs_running=")]; - ctrl_msg.type = UDEVD_CTRL_SET_MAX_CHILDS_RUNNING; - count = strtoul(val, &endp, 0); - if (endp[0] != '\0' || count < 1) { - fprintf(stderr, "invalid number\n"); + + switch (option) { + case 'l': + case 'l' + 256: + i = log_priority(optarg); + if (i < 0) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto exit; + } + udev_ctrl_set_log_level(uctrl, log_priority(optarg)); + break; + case 's': + case 's' + 256: + udev_ctrl_stop_exec_queue(uctrl); + break; + case 'S': + case 'S' + 256: + udev_ctrl_start_exec_queue(uctrl); + break; + case 'R': + case 'R' + 256: + udev_ctrl_reload_rules(uctrl); + break; + case 'e': + if (strchr(optarg, '=') == NULL) { + fprintf(stderr, "expect = instead of '%s'\n", optarg); + goto exit; + } + udev_ctrl_set_env(uctrl, optarg); + break; + case 'm': + case 'm' + 256: + i = strtoul(optarg, &endp, 0); + if (endp[0] != '\0' || i < 1) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto exit; + } + udev_ctrl_set_max_childs(uctrl, i); + break; + case 'M': + case 'M' + 256: + i = strtoul(optarg, &endp, 0); + if (endp[0] != '\0' || i < 1) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto exit; + } + udev_ctrl_set_max_childs_running(uctrl, i); + break; + break; + case 'h': + printf("Usage: udevadm control COMMAND\n" + " --log-priority= set the udev log level for the daemon\n" + " --stop-exec-queue keep udevd from executing events, queue only\n" + " --start-exec-queue execute events, flush queue\n" + " --reload-rules reloads the rules files\n" + " --env== set a global environment variable\n" + " --max-childs= maximum number of childs\n" + " --max-childs-running= maximum number of childs running at the same time\n" + " --help print this help text\n\n"); goto exit; - } - *intval = count; - info("send max_childs_running=%i\n", *intval); - } else if (!strncmp(arg, "env", strlen("env"))) { - if (!strncmp(arg, "env=", strlen("env="))) - val = &arg[strlen("env=")]; - else - val = argv[2]; - if (val == NULL) { - fprintf(stderr, "missing key\n"); + default: goto exit; } - ctrl_msg.type = UDEVD_CTRL_ENV; - strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf)); - info("send env '%s'\n", val); - } else if (strcmp(arg, "help") == 0 || strcmp(arg, "-h") == 0) { - printf("Usage: udevadm control COMMAND\n" - " --log_priority= set the udev log level for the daemon\n" - " --stop_exec_queue keep udevd from executing events, queue only\n" - " --start_exec_queue execute events, flush queue\n" - " --reload_rules reloads the rules files\n" - " --env== set a global environment variable\n" - " --max_childs= maximum number of childs\n" - " --max_childs_running= maximum number of childs running at the same time\n" - " --help print this help text\n\n"); - goto exit; - } else { - fprintf(stderr, "unrecognized command '%s'\n", arg); - goto exit; - } - - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - goto exit; } - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (sock == -1) { - err("error getting socket: %s\n", strerror(errno)); - goto exit; - } + /* compat stuff which will be removed in a future release */ + if (argv[optind] != NULL) { + const char *arg = argv[optind]; - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + fprintf(stderr, "udevadm control commands requires the -- format, " + "this will stop working in a future release\n"); + err("udevadm control commands requires the -- format, " + "this will stop working in a future release\n"); - retval = sendto(sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&saddr, addrlen); - if (retval == -1) { - err("error sending message: %s\n", strerror(errno)); - retval = 1; - } else { - dbg("sent message type=0x%02x, %u bytes sent\n", ctrl_msg.type, retval); - retval = 0; + if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { + udev_ctrl_set_log_level(uctrl, log_priority(&arg[strlen("log_priority=")])); + } else if (!strcmp(arg, "stop_exec_queue")) { + udev_ctrl_stop_exec_queue(uctrl); + } else if (!strcmp(arg, "start_exec_queue")) { + udev_ctrl_start_exec_queue(uctrl); + } else if (!strcmp(arg, "reload_rules")) { + udev_ctrl_reload_rules(uctrl); + } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { + udev_ctrl_set_max_childs(uctrl, strtoul(&arg[strlen("max_childs=")], NULL, 0)); + } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { + udev_ctrl_set_max_childs_running(uctrl, strtoul(&arg[strlen("max_childs_running=")], NULL, 0)); + } else if (!strncmp(arg, "env", strlen("env"))) { + udev_ctrl_set_env(uctrl, &arg[strlen("env=")]); + } else { + fprintf(stderr, "unrecognized command '%s'\n", arg); + err("unrecognized command '%s'\n", arg); + } } - - close(sock); exit: + udev_ctrl_unref(uctrl); logging_close(); - return retval; + return rc; } diff --git a/udev/udevd.c b/udev/udevd.c index 49159494c4..68cf264369 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -664,7 +664,6 @@ static void get_ctrl_msg(void) struct iovec iov; struct ucred *cred; char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - int *intval; char *pos; memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); @@ -727,21 +726,18 @@ static void get_ctrl_msg(void) msg_queue_manager(); break; case UDEVD_CTRL_SET_LOG_LEVEL: - intval = (int *) ctrl_msg.buf; - info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i\n", *intval); - udev_log_priority = *intval; + info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i\n", ctrl_msg.intval); + udev_log_priority = ctrl_msg.intval; sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); putenv(udev_log); break; case UDEVD_CTRL_SET_MAX_CHILDS: - intval = (int *) ctrl_msg.buf; - info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i\n", *intval); - max_childs = *intval; + info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i\n", ctrl_msg.intval); + max_childs = ctrl_msg.intval; break; case UDEVD_CTRL_SET_MAX_CHILDS_RUNNING: - intval = (int *) ctrl_msg.buf; - info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs=%i\n", *intval); - max_childs_running = *intval; + info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs_running=%i\n", ctrl_msg.intval); + max_childs_running = ctrl_msg.intval; break; case UDEVD_CTRL_RELOAD_RULES: info("udevd message (RELOAD_RULES) received\n"); @@ -870,9 +866,11 @@ static int init_udevd_socket(void) memset(&saddr, 0x00, sizeof(saddr)); saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], UDEVD_CTRL_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + strcpy(saddr.sun_path, UDEVD_CTRL_SOCK_PATH); + addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); + /* translate leading '@' to abstract namespace */ + if (saddr.sun_path[0] == '@') + saddr.sun_path[0] = '\0'; udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udevd_sock == -1) { diff --git a/udev/udevd.h b/udev/udevd.h index 1f4d6e417f..7405704c7a 100644 --- a/udev/udevd.h +++ b/udev/udevd.h @@ -31,24 +31,27 @@ #define UEVENT_BUFFER_SIZE 2048 #define UEVENT_NUM_ENVP 32 -#define UDEVD_CTRL_SOCK_PATH UDEV_PREFIX "/org/kernel/udev/udevd" +#define UDEVD_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd" #define UDEVD_CTRL_MAGIC "udevd_" VERSION enum udevd_ctrl_msg_type { UDEVD_CTRL_UNKNOWN, + UDEVD_CTRL_SET_LOG_LEVEL, UDEVD_CTRL_STOP_EXEC_QUEUE, UDEVD_CTRL_START_EXEC_QUEUE, - UDEVD_CTRL_SET_LOG_LEVEL, - UDEVD_CTRL_SET_MAX_CHILDS, - UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, UDEVD_CTRL_RELOAD_RULES, UDEVD_CTRL_ENV, + UDEVD_CTRL_SET_MAX_CHILDS, + UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, }; struct udevd_ctrl_msg { char magic[32]; enum udevd_ctrl_msg_type type; - char buf[256]; + union { + int intval; + char buf[256]; + }; }; struct udevd_uevent_msg { -- cgit v1.2.3-54-g00ecf From 742f4cad0d7c4af0a5d27ac6597be7410fa127e6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 3 Sep 2008 21:59:21 +0200 Subject: udevadm: print warning to stderr if udevadm is called by symlink --- TODO | 4 +++- udev/udevadm.c | 63 ++++++++++++++++++++++++++++++---------------------------- 2 files changed, 36 insertions(+), 31 deletions(-) diff --git a/TODO b/TODO index 20ed648d06..1dccb901f5 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,9 @@ These things would be nice to have: o rework rules to a match-action list, instead of a rules array These things will change in future udev versions: - o --device-id-of-file will print '5:8' instead of '5 8' These things are deprecated and scheduled for removal in a future udev version: o DEVTYPE for disks is set by the kernel, remove it from the rules + o "udevadm control" commands will only accept the -- syntax + o symlink names to udevadm will no longer be resolved to old command names + diff --git a/udev/udevadm.c b/udev/udevadm.c index cb356c5252..863bc467f0 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -120,49 +120,52 @@ static const struct command cmds[] = { int main(int argc, char *argv[]) { - const char *command; + const char *command = argv[1]; + int i; const char *pos; - const struct command *cmd; int rc; - /* get binary or symlink name */ - pos = strrchr(argv[0], '/'); + /* find command */ + if (command != NULL) + for (i = 0; cmds[i].cmd != NULL; i++) { + if (strcmp(cmds[i].name, command) == 0) { + debug = cmds[i].debug; + rc = cmds[i].cmd(argc-1, &argv[1]); + goto out; + } + } + + /* try to find compat link, will be removed in a future release */ + command = argv[0]; + pos = strrchr(command, '/'); if (pos != NULL) command = &pos[1]; - else - command = argv[0]; - /* the trailing part of the binary or symlink name is the command */ + /* the trailing part of the binary or link name is the command */ if (strncmp(command, "udev", 4) == 0) command = &command[4]; - if (command == NULL || command[0] == '\0') - goto err_unknown; - - /* udevadm itself needs to strip its name from the passed options */ - if (strcmp(command, "adm") == 0) { - command = argv[1]; - argv++; - argc--; - } - - if (command == NULL) - goto err_unknown; - - /* allow command to be specified as an option */ - if (strncmp(command, "--", 2) == 0) - command += 2; - - /* find and execute command */ - for (cmd = cmds; cmd->name != NULL; cmd++) { - if (strcmp(cmd->name, command) == 0) { - debug = cmd->debug; - rc = cmd->cmd(argc, argv); + for (i = 0; cmds[i].cmd != NULL; i++) { + if (strcmp(cmds[i].name, command) == 0) { + char path[128]; + char prog[512]; + ssize_t len; + + snprintf(path, sizeof(path), "/proc/%lu/exe", (unsigned long) getppid()); + len = readlink(path, prog, sizeof(prog)); + if (len > 0) { + prog[len] = '\0'; + fprintf(stderr, "the program '%s' called '%s', it should use 'udevadm %s ', " + "this will stop working in a future release\n", prog, argv[0], command); + info("the program '%s' called '%s', it should use 'udevadm %s ', " + "this will stop working in a future release\n", prog, argv[0], command); + } + debug = cmds[i].debug; + rc = cmds[i].cmd(argc, argv); goto out; } } -err_unknown: fprintf(stderr, "unknown command, try help\n\n"); rc = 2; out: -- cgit v1.2.3-54-g00ecf From e1497488506a5ec589d06cdedd776e55f6dbcef7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 3 Sep 2008 22:00:55 +0200 Subject: udev-test.pl: remove left-over comment from --valgrind option --- test/udev-test.pl | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 6cd4849045..ebed8f72dd 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -29,8 +29,6 @@ my $udev_root = "udev-root/"; my $udev_conf = "udev-test.conf"; my $udev_rules = "udev-test.rules"; -# uncomment following line to run udev with valgrind. - my @tests = ( { desc => "label test of scsi disc (old key names)", -- cgit v1.2.3-54-g00ecf From e4255f115330b949c1caeb561cbe0e39f5225f50 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 3 Sep 2008 23:33:06 +0200 Subject: udevadm: rename source files --- NEWS | 4 + udev/Makefile.am | 12 +- udev/udevadm-control.c | 304 +++++++++++++++++++++ udev/udevadm-info.c | 507 ++++++++++++++++++++++++++++++++++ udev/udevadm-monitor.c | 289 ++++++++++++++++++++ udev/udevadm-settle.c | 178 ++++++++++++ udev/udevadm-test.c | 207 ++++++++++++++ udev/udevadm-trigger.c | 716 +++++++++++++++++++++++++++++++++++++++++++++++++ udev/udevcontrol.c | 304 --------------------- udev/udevd.h | 2 +- udev/udevinfo.c | 507 ---------------------------------- udev/udevmonitor.c | 289 -------------------- udev/udevsettle.c | 178 ------------ udev/udevtest.c | 207 -------------- udev/udevtrigger.c | 716 ------------------------------------------------- 15 files changed, 2212 insertions(+), 2208 deletions(-) create mode 100644 udev/udevadm-control.c create mode 100644 udev/udevadm-info.c create mode 100644 udev/udevadm-monitor.c create mode 100644 udev/udevadm-settle.c create mode 100644 udev/udevadm-test.c create mode 100644 udev/udevadm-trigger.c delete mode 100644 udev/udevcontrol.c delete mode 100644 udev/udevinfo.c delete mode 100644 udev/udevmonitor.c delete mode 100644 udev/udevsettle.c delete mode 100644 udev/udevtest.c delete mode 100644 udev/udevtrigger.c diff --git a/NEWS b/NEWS index 70cd0debbb..8f7871d566 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,10 @@ The udevadm info --device-id-of-file= output has changed to use the obvious format. Possible current users should use the --export option which is not affected. +The old udev commands symlinks to udevadm are not installed since +a while, if these symlinks are used, a deprecation warning to stderr +is printed. + udev 127 ======== Bugfixes. diff --git a/udev/Makefile.am b/udev/Makefile.am index 4a7c7855ce..d123c0b3fd 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -55,12 +55,12 @@ udevd_LDADD = \ udevadm_SOURCES = \ $(common_files) \ udevadm.c \ - udevinfo.c \ - udevcontrol.c \ - udevtest.c \ - udevmonitor.c \ - udevsettle.c \ - udevtrigger.c + udevadm-info.c \ + udevadm-control.c \ + udevadm-test.c \ + udevadm-monitor.c \ + udevadm-settle.c \ + udevadm-trigger.c udevadm_LDADD = \ $(common_ldadd) diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c new file mode 100644 index 0000000000..5f1952543c --- /dev/null +++ b/udev/udevadm-control.c @@ -0,0 +1,304 @@ +/* + * Copyright (C) 2005-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" + +static int udev_log = 0; + +struct udev_ctrl; +extern struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path); +extern void udev_ctrl_unref(struct udev_ctrl *uctrl); +extern int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority); +extern int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl); +extern int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl); +extern int udev_ctrl_reload_rules(struct udev_ctrl *uctrl); +extern int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key); +extern int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count); +extern int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count); + +struct udev_ctrl { + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; +}; + +struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path) +{ + struct udev_ctrl *uctrl; + + uctrl = malloc(sizeof(struct udev_ctrl)); + if (uctrl == NULL) + return NULL; + memset(uctrl, 0x00, sizeof(struct udev_ctrl)); + + uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (uctrl->sock < 0) { + err("error getting socket: %s\n", strerror(errno)); + free(uctrl); + return NULL; + } + + uctrl->saddr.sun_family = AF_LOCAL; + strcpy(uctrl->saddr.sun_path, socket_path); + uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); + /* translate leading '@' to abstract namespace */ + if (uctrl->saddr.sun_path[0] == '@') + uctrl->saddr.sun_path[0] = '\0'; + return uctrl; +} + +void udev_ctrl_unref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return; + close(uctrl->sock); +} + +static int ctrl_send(struct udev_ctrl *uctrl, enum udevd_ctrl_msg_type type, int intval, const char *buf) +{ + struct udevd_ctrl_msg ctrl_msg; + int err; + + memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); + strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); + ctrl_msg.type = type; + + if (buf != NULL) + strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); + else + ctrl_msg.intval = intval; + + err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err == -1) { + err("error sending message: %s\n", strerror(errno)); + } + return err; +} + +int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority) +{ + ctrl_send(uctrl, UDEVD_CTRL_SET_LOG_LEVEL, priority, NULL); + return 0; +} + +int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEVD_CTRL_STOP_EXEC_QUEUE, 0, NULL); + return 0; +} + +int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEVD_CTRL_START_EXEC_QUEUE, 0, NULL); + return 0; +} + +int udev_ctrl_reload_rules(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEVD_CTRL_RELOAD_RULES, 0, NULL); + return 0; +} + +int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key) +{ + ctrl_send(uctrl, UDEVD_CTRL_ENV, 0, optarg); + return 0; +} + +int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count) +{ + ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS, count, NULL); + return 0; +} + +int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count) +{ + ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, count, NULL); + return 0; +} + +int udevcontrol(int argc, char *argv[]) +{ + struct udev_ctrl *uctrl; + const char *env; + int rc = 1; + + /* compat values with '_' will be removed in a future release */ + static const struct option options[] = { + { "log-priority", 1, NULL, 'l' }, + { "log_priority", 1, NULL, 'l' + 256 }, + { "stop-exec-queue", 0, NULL, 's' }, + { "stop_exec_queue", 0, NULL, 's' + 256 }, + { "start-exec-queue", 0, NULL, 'S' }, + { "start_exec_queue", 0, NULL, 'S' + 256}, + { "reload-rules", 0, NULL, 'R' }, + { "reload_rules", 0, NULL, 'R' + 256}, + { "env", 1, NULL, 'e' }, + { "max-childs", 1, NULL, 'm' }, + { "max_childs", 1, NULL, 'm' + 256}, + { "max-childs-running", 1, NULL, 'M' }, + { "max_childs_running", 1, NULL, 'M' + 256}, + { "help", 0, NULL, 'h' }, + {} + }; + + env = getenv("UDEV_LOG"); + if (env) + udev_log = log_priority(env); + + logging_init("udevcontrol"); + dbg("version %s\n", VERSION); + + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); + goto exit; + } + + uctrl = udev_ctrl_new_from_socket(UDEVD_CTRL_SOCK_PATH); + if (uctrl == NULL) + goto exit; + + while (1) { + int option; + int i; + char *endp; + + option = getopt_long(argc, argv, "l:sSRe:m:M:h", options, NULL); + if (option == -1) + break; + + if (option > 255) { + info("udevadm control expects commands without underscore, " + "this will stop working in a future release\n"); + fprintf(stderr, "udevadm control expects commands without underscore, " + "this will stop working in a future release\n"); + } + + switch (option) { + case 'l': + case 'l' + 256: + i = log_priority(optarg); + if (i < 0) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto exit; + } + udev_ctrl_set_log_level(uctrl, log_priority(optarg)); + break; + case 's': + case 's' + 256: + udev_ctrl_stop_exec_queue(uctrl); + break; + case 'S': + case 'S' + 256: + udev_ctrl_start_exec_queue(uctrl); + break; + case 'R': + case 'R' + 256: + udev_ctrl_reload_rules(uctrl); + break; + case 'e': + if (strchr(optarg, '=') == NULL) { + fprintf(stderr, "expect = instead of '%s'\n", optarg); + goto exit; + } + udev_ctrl_set_env(uctrl, optarg); + break; + case 'm': + case 'm' + 256: + i = strtoul(optarg, &endp, 0); + if (endp[0] != '\0' || i < 1) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto exit; + } + udev_ctrl_set_max_childs(uctrl, i); + break; + case 'M': + case 'M' + 256: + i = strtoul(optarg, &endp, 0); + if (endp[0] != '\0' || i < 1) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto exit; + } + udev_ctrl_set_max_childs_running(uctrl, i); + break; + break; + case 'h': + printf("Usage: udevadm control COMMAND\n" + " --log-priority= set the udev log level for the daemon\n" + " --stop-exec-queue keep udevd from executing events, queue only\n" + " --start-exec-queue execute events, flush queue\n" + " --reload-rules reloads the rules files\n" + " --env== set a global environment variable\n" + " --max-childs= maximum number of childs\n" + " --max-childs-running= maximum number of childs running at the same time\n" + " --help print this help text\n\n"); + goto exit; + default: + goto exit; + } + } + + /* compat stuff which will be removed in a future release */ + if (argv[optind] != NULL) { + const char *arg = argv[optind]; + + fprintf(stderr, "udevadm control commands requires the -- format, " + "this will stop working in a future release\n"); + err("udevadm control commands requires the -- format, " + "this will stop working in a future release\n"); + + if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { + udev_ctrl_set_log_level(uctrl, log_priority(&arg[strlen("log_priority=")])); + } else if (!strcmp(arg, "stop_exec_queue")) { + udev_ctrl_stop_exec_queue(uctrl); + } else if (!strcmp(arg, "start_exec_queue")) { + udev_ctrl_start_exec_queue(uctrl); + } else if (!strcmp(arg, "reload_rules")) { + udev_ctrl_reload_rules(uctrl); + } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { + udev_ctrl_set_max_childs(uctrl, strtoul(&arg[strlen("max_childs=")], NULL, 0)); + } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { + udev_ctrl_set_max_childs_running(uctrl, strtoul(&arg[strlen("max_childs_running=")], NULL, 0)); + } else if (!strncmp(arg, "env", strlen("env"))) { + udev_ctrl_set_env(uctrl, &arg[strlen("env=")]); + } else { + fprintf(stderr, "unrecognized command '%s'\n", arg); + err("unrecognized command '%s'\n", arg); + } + } +exit: + udev_ctrl_unref(uctrl); + logging_close(); + return rc; +} diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c new file mode 100644 index 0000000000..6501b57d1a --- /dev/null +++ b/udev/udevadm-info.c @@ -0,0 +1,507 @@ +/* + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static void print_all_attributes(const char *devpath, const char *key) +{ + char path[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + + dir = opendir(path); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat statbuf; + char filename[PATH_SIZE]; + char *attr_value; + char value[NAME_SIZE]; + size_t len; + + if (dent->d_name[0] == '.') + continue; + + if (strcmp(dent->d_name, "uevent") == 0) + continue; + if (strcmp(dent->d_name, "dev") == 0) + continue; + + strlcpy(filename, path, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, dent->d_name, sizeof(filename)); + if (lstat(filename, &statbuf) != 0) + continue; + if (S_ISLNK(statbuf.st_mode)) + continue; + + attr_value = sysfs_attr_get_value(devpath, dent->d_name); + if (attr_value == NULL) + continue; + len = strlcpy(value, attr_value, sizeof(value)); + if(len >= sizeof(value)) + len = sizeof(value) - 1; + dbg("attr '%s'='%s'(%zi)\n", dent->d_name, value, len); + + /* remove trailing newlines */ + while (len && value[len-1] == '\n') + value[--len] = '\0'; + + /* skip nonprintable attributes */ + while (len && isprint(value[len-1])) + len--; + if (len) { + dbg("attribute value of '%s' non-printable, skip\n", dent->d_name); + continue; + } + + printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); + } + } + printf("\n"); +} + +static int print_device_chain(const char *devpath) +{ + struct sysfs_device *dev; + + dev = sysfs_device_get(devpath); + if (dev == NULL) + return -1; + + printf("\n" + "Udevinfo starts with the device specified by the devpath and then\n" + "walks up the chain of parent devices. It prints for every device\n" + "found, all possible attributes in the udev rules key format.\n" + "A rule to match, can be composed by the attributes of the device\n" + "and the attributes from one single parent device.\n" + "\n"); + + printf(" looking at device '%s':\n", dev->devpath); + printf(" KERNEL==\"%s\"\n", dev->kernel); + printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); + printf(" DRIVER==\"%s\"\n", dev->driver); + print_all_attributes(dev->devpath, "ATTR"); + + /* walk up the chain of devices */ + while (1) { + dev = sysfs_device_get_parent(dev); + if (dev == NULL) + break; + printf(" looking at parent device '%s':\n", dev->devpath); + printf(" KERNELS==\"%s\"\n", dev->kernel); + printf(" SUBSYSTEMS==\"%s\"\n", dev->subsystem); + printf(" DRIVERS==\"%s\"\n", dev->driver); + + print_all_attributes(dev->devpath, "ATTRS"); + } + + return 0; +} + +static void print_record(struct udevice *udev) +{ + struct name_entry *name_loop; + + printf("P: %s\n", udev->dev->devpath); + printf("N: %s\n", udev->name); + list_for_each_entry(name_loop, &udev->symlink_list, node) + printf("S: %s\n", name_loop->name); + if (udev->link_priority != 0) + printf("L: %i\n", udev->link_priority); + if (udev->partitions != 0) + printf("A:%u\n", udev->partitions); + if (udev->ignore_remove) + printf("R:%u\n", udev->ignore_remove); + list_for_each_entry(name_loop, &udev->env_list, node) + printf("E: %s\n", name_loop->name); +} + +static void export_db(void) { + LIST_HEAD(name_list); + struct name_entry *name_loop; + + udev_db_get_all_entries(&name_list); + list_for_each_entry(name_loop, &name_list, node) { + struct udevice *udev_db; + + udev_db = udev_device_init(); + if (udev_db == NULL) + continue; + if (udev_db_get_device(udev_db, name_loop->name) == 0) + print_record(udev_db); + printf("\n"); + udev_device_cleanup(udev_db); + } + name_list_cleanup(&name_list); +} + +static int lookup_device_by_name(struct udevice **udev, const char *name) +{ + LIST_HEAD(name_list); + int count; + struct name_entry *device; + int rc = -1; + + count = udev_db_get_devices_by_name(name, &name_list); + if (count <= 0) + goto out; + + info("found %i devices for '%s'\n", count, name); + + /* select the device that seems to match */ + list_for_each_entry(device, &name_list, node) { + struct udevice *udev_loop; + char filename[PATH_SIZE]; + struct stat statbuf; + + udev_loop = udev_device_init(); + if (udev_loop == NULL) + break; + if (udev_db_get_device(udev_loop, device->name) != 0) + goto next; + info("found db entry '%s'\n", device->name); + + /* make sure, we don't get a link of a different device */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, name, sizeof(filename)); + if (stat(filename, &statbuf) != 0) + goto next; + if (major(udev_loop->devt) > 0 && udev_loop->devt != statbuf.st_rdev) { + info("skip '%s', dev_t doesn't match\n", udev_loop->name); + goto next; + } + rc = 0; + *udev = udev_loop; + break; +next: + udev_device_cleanup(udev_loop); + } +out: + name_list_cleanup(&name_list); + return rc; +} + +static int stat_device(const char *name, int export, const char *prefix) +{ + struct stat statbuf; + + if (stat(name, &statbuf) != 0) + return -1; + + if (export) { + if (prefix == NULL) + prefix = "INFO_"; + printf("%sMAJOR=%d\n" + "%sMINOR=%d\n", + prefix, major(statbuf.st_dev), + prefix, minor(statbuf.st_dev)); + } else + printf("%d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); + return 0; +} + +int udevinfo(int argc, char *argv[]) +{ + int option; + struct udevice *udev = NULL; + int root = 0; + int export = 0; + const char *export_prefix = NULL; + + static const struct option options[] = { + { "name", 1, NULL, 'n' }, + { "path", 1, NULL, 'p' }, + { "query", 1, NULL, 'q' }, + { "attribute-walk", 0, NULL, 'a' }, + { "export-db", 0, NULL, 'e' }, + { "root", 0, NULL, 'r' }, + { "device-id-of-file", 1, NULL, 'd' }, + { "export", 0, NULL, 'x' }, + { "export-prefix", 1, NULL, 'P' }, + { "version", 0, NULL, 1 }, /* -V outputs braindead format */ + { "help", 0, NULL, 'h' }, + {} + }; + + enum action_type { + ACTION_NONE, + ACTION_QUERY, + ACTION_ATTRIBUTE_WALK, + ACTION_ROOT, + ACTION_DEVICE_ID_FILE, + } action = ACTION_NONE; + + enum query_type { + QUERY_NONE, + QUERY_NAME, + QUERY_PATH, + QUERY_SYMLINK, + QUERY_ENV, + QUERY_ALL, + } query = QUERY_NONE; + + char path[PATH_SIZE] = ""; + char name[PATH_SIZE] = ""; + struct name_entry *name_loop; + int rc = 0; + + logging_init("udevinfo"); + udev_config_init(); + sysfs_init(); + + while (1) { + option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); + if (option == -1) + break; + + dbg("option '%c'\n", option); + switch (option) { + case 'n': + /* remove /dev if given */ + if (strncmp(optarg, udev_root, strlen(udev_root)) == 0) + strlcpy(name, &optarg[strlen(udev_root)+1], sizeof(name)); + else + strlcpy(name, optarg, sizeof(name)); + remove_trailing_chars(name, '/'); + dbg("name: %s\n", name); + break; + case 'p': + /* remove /sys if given */ + if (strncmp(optarg, sysfs_path, strlen(sysfs_path)) == 0) + strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path)); + else + strlcpy(path, optarg, sizeof(path)); + remove_trailing_chars(path, '/'); + + /* possibly resolve to real devpath */ + if (sysfs_resolve_link(path, sizeof(path)) != 0) { + char temp[PATH_SIZE]; + char *pos; + + /* also check if the parent is a link */ + strlcpy(temp, path, sizeof(temp)); + pos = strrchr(temp, '/'); + if (pos != 0) { + char tail[PATH_SIZE]; + + strlcpy(tail, pos, sizeof(tail)); + pos[0] = '\0'; + if (sysfs_resolve_link(temp, sizeof(temp)) == 0) { + strlcpy(path, temp, sizeof(path)); + strlcat(path, tail, sizeof(path)); + } + } + } + dbg("path: %s\n", path); + break; + case 'q': + action = ACTION_QUERY; + if (strcmp(optarg, "name") == 0) { + query = QUERY_NAME; + break; + } + if (strcmp(optarg, "symlink") == 0) { + query = QUERY_SYMLINK; + break; + } + if (strcmp(optarg, "path") == 0) { + query = QUERY_PATH; + break; + } + if (strcmp(optarg, "env") == 0) { + query = QUERY_ENV; + break; + } + if (strcmp(optarg, "all") == 0) { + query = QUERY_ALL; + break; + } + fprintf(stderr, "unknown query type\n"); + rc = 2; + goto exit; + case 'r': + if (action == ACTION_NONE) + action = ACTION_ROOT; + root = 1; + break; + case 'd': + action = ACTION_DEVICE_ID_FILE; + strlcpy(name, optarg, sizeof(name)); + break; + case 'a': + action = ACTION_ATTRIBUTE_WALK; + break; + case 'e': + export_db(); + goto exit; + case 'x': + export = 1; + break; + case 'P': + export_prefix = optarg; + break; + case 1: + printf("%s\n", VERSION); + goto exit; + case 'V': + printf("udevinfo, version %s\n", VERSION); + goto exit; + case 'h': + printf("Usage: udevadm info OPTIONS\n" + " --query= query database for the specified value:\n" + " name name of device node\n" + " symlink pointing to node\n" + " path sysfs device path\n" + " env the device related imported environment\n" + " all all values\n" + " --path= sysfs device path used for query or chain\n" + " --name= node or symlink name used for query\n" + " --root prepend to query result or print udev_root\n" + " --attribute-walk print all key matches while walking along chain\n" + " of parent devices\n" + " --device-id-of-file= print major/minor of underlying device\n" + " --export-db export the content of the udev database\n" + " --help print this text\n" + "\n"); + goto exit; + default: + goto exit; + } + } + + /* run action */ + switch (action) { + case ACTION_QUERY: + /* needs devpath or node/symlink name for query */ + if (path[0] != '\0') { + udev = udev_device_init(); + if (udev == NULL) { + rc = 1; + goto exit; + } + if (udev_db_get_device(udev, path) != 0) { + fprintf(stderr, "no record for '%s' in database\n", path); + rc = 3; + goto exit; + } + } else if (name[0] != '\0') { + if (lookup_device_by_name(&udev, name) != 0) { + fprintf(stderr, "node name not found\n"); + rc = 4; + goto exit; + } + } else { + fprintf(stderr, "query needs --path or node --name specified\n"); + rc = 4; + goto exit; + } + + switch(query) { + case QUERY_NAME: + if (root) + printf("%s/%s\n", udev_root, udev->name); + else + printf("%s\n", udev->name); + break; + case QUERY_SYMLINK: + list_for_each_entry(name_loop, &udev->symlink_list, node) { + char c = name_loop->node.next != &udev->symlink_list ? ' ' : '\n'; + + if (root) + printf("%s/%s%c", udev_root, name_loop->name, c); + else + printf("%s%c", name_loop->name, c); + } + break; + case QUERY_PATH: + printf("%s\n", udev->dev->devpath); + goto exit; + case QUERY_ENV: + list_for_each_entry(name_loop, &udev->env_list, node) + printf("%s\n", name_loop->name); + break; + case QUERY_ALL: + print_record(udev); + break; + default: + fprintf(stderr, "unknown query type\n"); + break; + } + break; + case ACTION_ATTRIBUTE_WALK: + if (path[0] != '\0') { + if (print_device_chain(path) != 0) { + fprintf(stderr, "no valid sysfs device found\n"); + rc = 4; + goto exit; + } + } else if (name[0] != '\0') { + if (lookup_device_by_name(&udev, name) != 0) { + fprintf(stderr, "node name not found\n"); + rc = 4; + goto exit; + } + if (print_device_chain(udev->dev->devpath) != 0) { + fprintf(stderr, "no valid sysfs device found\n"); + rc = 4; + goto exit; + } + } else { + fprintf(stderr, "attribute walk needs --path or node --name specified\n"); + rc = 5; + goto exit; + } + break; + case ACTION_DEVICE_ID_FILE: + if (stat_device(name, export, export_prefix) != 0) + rc = 6; + break; + case ACTION_ROOT: + printf("%s\n", udev_root); + break; + default: + fprintf(stderr, "missing option\n"); + rc = 1; + break; + } + +exit: + udev_device_cleanup(udev); + sysfs_cleanup(); + logging_close(); + return rc; +} diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c new file mode 100644 index 0000000000..3b65bcae9b --- /dev/null +++ b/udev/udevadm-monitor.c @@ -0,0 +1,289 @@ +/* + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" + +static int uevent_netlink_sock = -1; +static int udev_monitor_sock = -1; +static volatile int udev_exit; + +static int init_udev_monitor_socket(void) +{ + struct sockaddr_un saddr; + socklen_t addrlen; + int retval; + + memset(&saddr, 0x00, sizeof(saddr)); + saddr.sun_family = AF_LOCAL; + /* use abstract namespace for socket path */ + strcpy(&saddr.sun_path[1], "/org/kernel/udev/monitor"); + addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + + udev_monitor_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udev_monitor_sock == -1) { + fprintf(stderr, "error getting socket: %s\n", strerror(errno)); + return -1; + } + + /* the bind takes care of ensuring only one copy running */ + retval = bind(udev_monitor_sock, (struct sockaddr *) &saddr, addrlen); + if (retval < 0) { + fprintf(stderr, "bind failed: %s\n", strerror(errno)); + close(udev_monitor_sock); + udev_monitor_sock = -1; + return -1; + } + + return 0; +} + +static int init_uevent_netlink_sock(void) +{ + struct sockaddr_nl snl; + int retval; + + memset(&snl, 0x00, sizeof(struct sockaddr_nl)); + snl.nl_family = AF_NETLINK; + snl.nl_pid = getpid(); + snl.nl_groups = 1; + + uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + if (uevent_netlink_sock == -1) { + fprintf(stderr, "error getting socket: %s\n", strerror(errno)); + return -1; + } + + retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, + sizeof(struct sockaddr_nl)); + if (retval < 0) { + fprintf(stderr, "bind failed: %s\n", strerror(errno)); + close(uevent_netlink_sock); + uevent_netlink_sock = -1; + return -1; + } + + return 0; +} + +static void asmlinkage sig_handler(int signum) +{ + if (signum == SIGINT || signum == SIGTERM) + udev_exit = 1; +} + +static const char *search_key(const char *searchkey, const char *buf, size_t buflen) +{ + size_t bufpos = 0; + size_t searchkeylen = strlen(searchkey); + + while (bufpos < buflen) { + const char *key; + int keylen; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + if ((strncmp(searchkey, key, searchkeylen) == 0) && key[searchkeylen] == '=') + return &key[searchkeylen + 1]; + bufpos += keylen + 1; + } + return NULL; +} + +int udevmonitor(int argc, char *argv[]) +{ + struct sigaction act; + int option; + int env = 0; + int kernel = 0; + int udev = 0; + fd_set readfds; + int retval = 0; + + static const struct option options[] = { + { "environment", 0, NULL, 'e' }, + { "kernel", 0, NULL, 'k' }, + { "udev", 0, NULL, 'u' }, + { "help", 0, NULL, 'h' }, + {} + }; + + while (1) { + option = getopt_long(argc, argv, "ekuh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'e': + env = 1; + break; + case 'k': + kernel = 1; + break; + case 'u': + udev = 1; + break; + case 'h': + printf("Usage: udevadm monitor [--environment] [--kernel] [--udev] [--help]\n" + " --env print the whole event environment\n" + " --kernel print kernel uevents\n" + " --udev print udev events\n" + " --help print this help text\n\n"); + default: + goto out; + } + } + + if (!kernel && !udev) { + kernel = 1; + udev =1; + } + + if (getuid() != 0 && kernel) { + fprintf(stderr, "root privileges needed to subscribe to kernel events\n"); + goto out; + } + + /* set signal handlers */ + memset(&act, 0x00, sizeof(struct sigaction)); + act.sa_handler = (void (*)(int)) sig_handler; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_RESTART; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + + printf("udevmonitor will print the received events for:\n"); + if (udev) { + retval = init_udev_monitor_socket(); + if (retval) + goto out; + printf("UDEV the event which udev sends out after rule processing\n"); + } + if (kernel) { + retval = init_uevent_netlink_sock(); + if (retval) + goto out; + printf("UEVENT the kernel uevent\n"); + } + printf("\n"); + + while (!udev_exit) { + char buf[UEVENT_BUFFER_SIZE*2]; + ssize_t buflen; + ssize_t bufpos; + ssize_t keys; + int fdcount; + struct timeval tv; + struct timezone tz; + char timestr[64]; + const char *source = NULL; + const char *devpath, *action, *subsys; + + buflen = 0; + FD_ZERO(&readfds); + if (uevent_netlink_sock >= 0) + FD_SET(uevent_netlink_sock, &readfds); + if (udev_monitor_sock >= 0) + FD_SET(udev_monitor_sock, &readfds); + + fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno != EINTR) + fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); + continue; + } + + if (gettimeofday(&tv, &tz) == 0) { + snprintf(timestr, sizeof(timestr), "%llu.%06u", + (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec); + } else + timestr[0] = '\0'; + + if ((uevent_netlink_sock >= 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { + buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); + if (buflen <= 0) { + fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); + continue; + } + source = "UEVENT"; + } + + if ((udev_monitor_sock >= 0) && FD_ISSET(udev_monitor_sock, &readfds)) { + buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); + if (buflen <= 0) { + fprintf(stderr, "error receiving udev message: %s\n", strerror(errno)); + continue; + } + source = "UDEV "; + } + + if (buflen == 0) + continue; + + keys = strlen(buf) + 1; /* start of payload */ + devpath = search_key("DEVPATH", &buf[keys], buflen); + action = search_key("ACTION", &buf[keys], buflen); + subsys = search_key("SUBSYSTEM", &buf[keys], buflen); + printf("%s[%s] %-8s %s (%s)\n", source, timestr, action, devpath, subsys); + + /* print environment */ + bufpos = keys; + if (env) { + while (bufpos < buflen) { + int keylen; + char *key; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + printf("%s\n", key); + bufpos += keylen + 1; + } + printf("\n"); + } + } + +out: + if (uevent_netlink_sock >= 0) + close(uevent_netlink_sock); + if (udev_monitor_sock >= 0) + close(udev_monitor_sock); + + if (retval) + return 1; + return 0; +} diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c new file mode 100644 index 0000000000..11277f5a43 --- /dev/null +++ b/udev/udevadm-settle.c @@ -0,0 +1,178 @@ +/* + * Copyright (C) 2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" + +#define DEFAULT_TIMEOUT 180 +#define LOOP_PER_SECOND 20 + +static void print_queue(const char *dir) +{ + LIST_HEAD(files); + struct name_entry *item; + + if (add_matching_files(&files, dir, NULL) < 0) + return; + + printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n"); + + list_for_each_entry(item, &files, node) { + char target[NAME_SIZE]; + size_t len; + const char *filename = strrchr(item->name, '/'); + + if (filename == NULL) + continue; + filename++; + if (*filename == '\0') + continue; + + len = readlink(item->name, target, sizeof(target)); + if (len < 0) + continue; + target[len] = '\0'; + + printf("%s: %s\n", filename, target); + } + + printf("\n\n"); +} + +int udevsettle(int argc, char *argv[]) +{ + char queuename[PATH_SIZE]; + char filename[PATH_SIZE]; + unsigned long long seq_kernel; + unsigned long long seq_udev; + char seqnum[32]; + int fd; + ssize_t len; + int timeout = DEFAULT_TIMEOUT; + int loop; + static const struct option options[] = { + { "timeout", 1, NULL, 't' }, + { "help", 0, NULL, 'h' }, + {} + }; + int option; + int rc = 1; + int seconds; + + logging_init("udevsettle"); + udev_config_init(); + dbg("version %s\n", VERSION); + sysfs_init(); + + while (1) { + option = getopt_long(argc, argv, "t:h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 't': + seconds = atoi(optarg); + if (seconds > 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); + dbg("timeout=%i\n", timeout); + break; + case 'h': + printf("Usage: udevadm settle [--help] [--timeout=]\n\n"); + goto exit; + } + } + + strlcpy(queuename, udev_root, sizeof(queuename)); + strlcat(queuename, "/.udev/queue", sizeof(queuename)); + + loop = timeout * LOOP_PER_SECOND; + while (loop--) { + /* wait for events in queue to finish */ + while (loop--) { + struct stat statbuf; + + if (stat(queuename, &statbuf) < 0) { + info("queue is empty\n"); + break; + } + usleep(1000 * 1000 / LOOP_PER_SECOND); + } + if (loop <= 0) { + info("timeout waiting for queue\n"); + print_queue(queuename); + goto exit; + } + + /* read current udev seqnum */ + strlcpy(filename, udev_root, sizeof(filename)); + strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd < 0) + goto exit; + len = read(fd, seqnum, sizeof(seqnum)-1); + close(fd); + if (len <= 0) + goto exit; + seqnum[len] = '\0'; + seq_udev = strtoull(seqnum, NULL, 10); + info("udev seqnum = %llu\n", seq_udev); + + /* read current kernel seqnum */ + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd < 0) + goto exit; + len = read(fd, seqnum, sizeof(seqnum)-1); + close(fd); + if (len <= 0) + goto exit; + seqnum[len] = '\0'; + seq_kernel = strtoull(seqnum, NULL, 10); + info("kernel seqnum = %llu\n", seq_kernel); + + /* make sure all kernel events have arrived in the queue */ + if (seq_udev >= seq_kernel) { + info("queue is empty and no pending events left\n"); + rc = 0; + goto exit; + } + usleep(1000 * 1000 / LOOP_PER_SECOND); + info("queue is empty, but events still pending\n"); + } + +exit: + sysfs_cleanup(); + logging_close(); + return rc; +} diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c new file mode 100644 index 0000000000..63603aad97 --- /dev/null +++ b/udev/udevadm-test.c @@ -0,0 +1,207 @@ +/* + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2006 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev_rules.h" + +static int import_uevent_var(const char *devpath) +{ + char path[PATH_SIZE]; + static char value[4096]; /* must stay, used with putenv */ + ssize_t size; + int fd; + char *key; + char *next; + int rc = -1; + + /* read uevent file */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/uevent", sizeof(path)); + fd = open(path, O_RDONLY); + if (fd < 0) + goto out; + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + value[size] = '\0'; + + /* import keys into environment */ + key = value; + while (key[0] != '\0') { + next = strchr(key, '\n'); + if (next == NULL) + goto out; + next[0] = '\0'; + info("import into environment: '%s'\n", key); + putenv(key); + key = &next[1]; + } + rc = 0; +out: + return rc; +} + +int udevtest(int argc, char *argv[]) +{ + int force = 0; + const char *action = "add"; + const char *subsystem = NULL; + const char *devpath = NULL; + struct udevice *udev; + struct sysfs_device *dev; + struct udev_rules rules = {}; + int retval; + int rc = 0; + + static const struct option options[] = { + { "action", 1, NULL, 'a' }, + { "subsystem", 1, NULL, 's' }, + { "force", 0, NULL, 'f' }, + { "help", 0, NULL, 'h' }, + {} + }; + + info("version %s\n", VERSION); + udev_config_init(); + if (udev_log_priority < LOG_INFO) { + char priority[32]; + + udev_log_priority = LOG_INFO; + sprintf(priority, "%i", udev_log_priority); + setenv("UDEV_LOG", priority, 1); + } + + while (1) { + int option; + + option = getopt_long(argc, argv, "a:s:fh", options, NULL); + if (option == -1) + break; + + dbg("option '%c'\n", option); + switch (option) { + case 'a': + action = optarg; + break; + case 's': + subsystem = optarg; + break; + case 'f': + force = 1; + break; + case 'h': + printf("Usage: udevadm test OPTIONS \n" + " --action= set action string\n" + " --subsystem= set subsystem string\n" + " --force don't skip node/link creation\n" + " --help print this help text\n\n"); + exit(0); + default: + exit(1); + } + } + devpath = argv[optind]; + + if (devpath == NULL) { + fprintf(stderr, "devpath parameter missing\n"); + rc = 1; + goto exit; + } + + printf("This program is for debugging only, it does not run any program,\n" + "specified by a RUN key. It may show incorrect results, because\n" + "some values may be different, or not available at a simulation run.\n" + "\n"); + + sysfs_init(); + udev_rules_init(&rules, 0); + + /* remove /sys if given */ + if (strncmp(devpath, sysfs_path, strlen(sysfs_path)) == 0) + devpath = &devpath[strlen(sysfs_path)]; + + dev = sysfs_device_get(devpath); + if (dev == NULL) { + fprintf(stderr, "unable to open device '%s'\n", devpath); + rc = 2; + goto exit; + } + + udev = udev_device_init(); + if (udev == NULL) { + fprintf(stderr, "error initializing device\n"); + rc = 3; + goto exit; + } + + if (subsystem != NULL) + strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); + + /* override built-in sysfs device */ + udev->dev = dev; + strlcpy(udev->action, action, sizeof(udev->action)); + udev->devt = udev_device_get_devt(udev); + + /* simulate node creation with test flag */ + if (!force) + udev->test_run = 1; + + setenv("DEVPATH", udev->dev->devpath, 1); + setenv("SUBSYSTEM", udev->dev->subsystem, 1); + setenv("ACTION", udev->action, 1); + import_uevent_var(udev->dev->devpath); + + info("looking at device '%s' from subsystem '%s'\n", udev->dev->devpath, udev->dev->subsystem); + retval = udev_device_event(&rules, udev); + + if (udev->event_timeout >= 0) + info("custom event timeout: %i\n", udev->event_timeout); + + if (retval == 0 && !udev->ignore_device && udev_run) { + struct name_entry *name_loop; + + list_for_each_entry(name_loop, &udev->run_list, node) { + char program[PATH_SIZE]; + + strlcpy(program, name_loop->name, sizeof(program)); + udev_rules_apply_format(udev, program, sizeof(program)); + info("run: '%s'\n", program); + } + } + udev_device_cleanup(udev); + +exit: + udev_rules_cleanup(&rules); + sysfs_cleanup(); + return rc; +} diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c new file mode 100644 index 0000000000..4a8f62ab5c --- /dev/null +++ b/udev/udevadm-trigger.c @@ -0,0 +1,716 @@ +/* + * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2006 Hannes Reinecke + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" +#include "udev_rules.h" + +static int verbose; +static int dry_run; +LIST_HEAD(device_list); +LIST_HEAD(filter_subsystem_match_list); +LIST_HEAD(filter_subsystem_nomatch_list); +LIST_HEAD(filter_attr_match_list); +LIST_HEAD(filter_attr_nomatch_list); +static int sock = -1; +static struct sockaddr_un saddr; +static socklen_t saddrlen; + +/* devices that should run last cause of their dependencies */ +static int delay_device(const char *devpath) +{ + static const char *delay_device_list[] = { + "*/md*", + "*/dm-*", + NULL + }; + int i; + + for (i = 0; delay_device_list[i] != NULL; i++) + if (fnmatch(delay_device_list[i], devpath, 0) == 0) + return 1; + return 0; +} + +static int device_list_insert(const char *path) +{ + char filename[PATH_SIZE]; + char devpath[PATH_SIZE]; + struct stat statbuf; + + dbg("add '%s'\n" , path); + + /* we only have a device, if we have an uevent file */ + strlcpy(filename, path, sizeof(filename)); + strlcat(filename, "/uevent", sizeof(filename)); + if (stat(filename, &statbuf) < 0) + return -1; + if (!(statbuf.st_mode & S_IWUSR)) + return -1; + + strlcpy(devpath, &path[strlen(sysfs_path)], sizeof(devpath)); + + /* resolve possible link to real target */ + if (lstat(path, &statbuf) < 0) + return -1; + if (S_ISLNK(statbuf.st_mode)) + if (sysfs_resolve_link(devpath, sizeof(devpath)) != 0) + return -1; + + name_list_add(&device_list, devpath, 1); + return 0; +} + +static void trigger_uevent(const char *devpath, const char *action) +{ + char filename[PATH_SIZE]; + int fd; + + strlcpy(filename, sysfs_path, sizeof(filename)); + strlcat(filename, devpath, sizeof(filename)); + strlcat(filename, "/uevent", sizeof(filename)); + + if (verbose) + printf("%s\n", devpath); + + if (dry_run) + return; + + fd = open(filename, O_WRONLY); + if (fd < 0) { + dbg("error on opening %s: %s\n", filename, strerror(errno)); + return; + } + + if (write(fd, action, strlen(action)) < 0) + info("error writing '%s' to '%s': %s\n", action, filename, strerror(errno)); + + close(fd); +} + +static int pass_to_socket(const char *devpath, const char *action, const char *env) +{ + struct udevice *udev; + struct name_entry *name_loop; + char buf[4096]; + size_t bufpos = 0; + ssize_t count; + char path[PATH_SIZE]; + int fd; + char link_target[PATH_SIZE]; + int len; + int err = 0; + + if (verbose) + printf("%s\n", devpath); + + udev = udev_device_init(); + if (udev == NULL) + return -1; + udev_db_get_device(udev, devpath); + + /* add header */ + bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); + bufpos++; + + /* add cookie */ + if (env != NULL) { + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "%s", env); + bufpos++; + } + + /* add standard keys */ + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVPATH=%s", devpath); + bufpos++; + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "ACTION=%s", action); + bufpos++; + + /* add subsystem */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/subsystem", sizeof(path)); + len = readlink(path, link_target, sizeof(link_target)); + if (len > 0) { + char *pos; + + link_target[len] = '\0'; + pos = strrchr(link_target, '/'); + if (pos != NULL) { + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "SUBSYSTEM=%s", &pos[1]); + bufpos++; + } + } + + /* add symlinks and node name */ + path[0] = '\0'; + list_for_each_entry(name_loop, &udev->symlink_list, node) { + strlcat(path, udev_root, sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, name_loop->name, sizeof(path)); + strlcat(path, " ", sizeof(path)); + } + remove_trailing_chars(path, ' '); + if (path[0] != '\0') { + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path); + bufpos++; + } + if (udev->name[0] != '\0') { + strlcpy(path, udev_root, sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, udev->name, sizeof(path)); + bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path); + bufpos++; + } + + /* add keys from device "uevent" file */ + strlcpy(path, sysfs_path, sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/uevent", sizeof(path)); + fd = open(path, O_RDONLY); + if (fd >= 0) { + char value[4096]; + + count = read(fd, value, sizeof(value)); + close(fd); + if (count > 0) { + char *key; + + value[count] = '\0'; + key = value; + while (key[0] != '\0') { + char *next; + + next = strchr(key, '\n'); + if (next == NULL) + break; + next[0] = '\0'; + bufpos += strlcpy(&buf[bufpos], key, sizeof(buf) - bufpos-1); + bufpos++; + key = &next[1]; + } + } + } + + /* add keys from database */ + list_for_each_entry(name_loop, &udev->env_list, node) { + bufpos += strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); + bufpos++; + } + if (bufpos > sizeof(buf)) + bufpos = sizeof(buf); + + count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); + if (count < 0) + err = -1; + + return err; +} + +static void exec_list(const char *action, const char *env) +{ + struct name_entry *loop_device; + struct name_entry *tmp_device; + + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { + if (delay_device(loop_device->name)) + continue; + if (sock >= 0) + pass_to_socket(loop_device->name, action, env); + else + trigger_uevent(loop_device->name, action); + list_del(&loop_device->node); + free(loop_device); + } + + /* trigger remaining delayed devices */ + list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { + if (sock >= 0) + pass_to_socket(loop_device->name, action, env); + else + trigger_uevent(loop_device->name, action); + list_del(&loop_device->node); + free(loop_device); + } +} + +static int subsystem_filtered(const char *subsystem) +{ + struct name_entry *loop_name; + + /* skip devices matching the listed subsystems */ + list_for_each_entry(loop_name, &filter_subsystem_nomatch_list, node) + if (fnmatch(loop_name->name, subsystem, 0) == 0) + return 1; + + /* skip devices not matching the listed subsystems */ + if (!list_empty(&filter_subsystem_match_list)) { + list_for_each_entry(loop_name, &filter_subsystem_match_list, node) + if (fnmatch(loop_name->name, subsystem, 0) == 0) + return 0; + return 1; + } + + return 0; +} + +static int attr_match(const char *path, const char *attr_value) +{ + char attr[NAME_SIZE]; + char file[PATH_SIZE]; + char *match_value; + + strlcpy(attr, attr_value, sizeof(attr)); + + /* separate attr and match value */ + match_value = strchr(attr, '='); + if (match_value != NULL) { + match_value[0] = '\0'; + match_value = &match_value[1]; + } + + strlcpy(file, path, sizeof(file)); + strlcat(file, "/", sizeof(file)); + strlcat(file, attr, sizeof(file)); + + if (match_value != NULL) { + /* match file content */ + char value[NAME_SIZE]; + int fd; + ssize_t size; + + fd = open(file, O_RDONLY); + if (fd < 0) + return 0; + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + return 0; + value[size] = '\0'; + remove_trailing_chars(value, '\n'); + + /* match if attribute value matches */ + if (fnmatch(match_value, value, 0) == 0) + return 1; + } else { + /* match if attribute exists */ + struct stat statbuf; + + if (stat(file, &statbuf) == 0) + return 1; + } + return 0; +} + +static int attr_filtered(const char *path) +{ + struct name_entry *loop_name; + + /* skip devices matching the listed sysfs attributes */ + list_for_each_entry(loop_name, &filter_attr_nomatch_list, node) + if (attr_match(path, loop_name->name)) + return 1; + + /* skip devices not matching the listed sysfs attributes */ + if (!list_empty(&filter_attr_match_list)) { + list_for_each_entry(loop_name, &filter_attr_match_list, node) + if (attr_match(path, loop_name->name)) + return 0; + return 1; + } + return 0; +} + +enum scan_type { + SCAN_DEVICES, + SCAN_SUBSYSTEM, +}; + +static void scan_subsystem(const char *subsys, enum scan_type scan) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + const char *subdir; + + if (scan == SCAN_DEVICES) + subdir = "/devices"; + else if (scan == SCAN_SUBSYSTEM) + subdir = "/drivers"; + else + return; + + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/", sizeof(base)); + strlcat(base, subsys, sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[PATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + if (scan == SCAN_DEVICES) + if (subsystem_filtered(dent->d_name)) + continue; + + strlcpy(dirname, base, sizeof(dirname)); + strlcat(dirname, "/", sizeof(dirname)); + strlcat(dirname, dent->d_name, sizeof(dirname)); + + if (scan == SCAN_SUBSYSTEM) { + if (attr_filtered(dirname)) + continue; + if (!subsystem_filtered("subsystem")) + device_list_insert(dirname); + if (subsystem_filtered("drivers")) + continue; + } + + strlcat(dirname, subdir, sizeof(dirname)); + + /* look for devices/drivers */ + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[PATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (attr_filtered(dirname2)) + continue; + device_list_insert(dirname2); + } + closedir(dir2); + } + } + closedir(dir); + } +} + +static void scan_block(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + if (subsystem_filtered("block")) + return; + + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/block", sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[PATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + strlcpy(dirname, base, sizeof(dirname)); + strlcat(dirname, "/", sizeof(dirname)); + strlcat(dirname, dent->d_name, sizeof(dirname)); + if (attr_filtered(dirname)) + continue; + if (device_list_insert(dirname) != 0) + continue; + + /* look for partitions */ + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[PATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + if (!strcmp(dent2->d_name,"device")) + continue; + + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (attr_filtered(dirname2)) + continue; + device_list_insert(dirname2); + } + closedir(dir2); + } + } + closedir(dir); + } +} + +static void scan_class(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/class", sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char dirname[PATH_SIZE]; + DIR *dir2; + struct dirent *dent2; + + if (dent->d_name[0] == '.') + continue; + + if (subsystem_filtered(dent->d_name)) + continue; + + strlcpy(dirname, base, sizeof(dirname)); + strlcat(dirname, "/", sizeof(dirname)); + strlcat(dirname, dent->d_name, sizeof(dirname)); + dir2 = opendir(dirname); + if (dir2 != NULL) { + for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { + char dirname2[PATH_SIZE]; + + if (dent2->d_name[0] == '.') + continue; + + if (!strcmp(dent2->d_name, "device")) + continue; + + strlcpy(dirname2, dirname, sizeof(dirname2)); + strlcat(dirname2, "/", sizeof(dirname2)); + strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + if (attr_filtered(dirname2)) + continue; + device_list_insert(dirname2); + } + closedir(dir2); + } + } + closedir(dir); + } +} + +static void scan_failed(void) +{ + char base[PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + strlcpy(base, udev_root, sizeof(base)); + strlcat(base, "/.udev/failed", sizeof(base)); + + dir = opendir(base); + if (dir != NULL) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char device[PATH_SIZE]; + size_t start; + + if (dent->d_name[0] == '.') + continue; + + start = strlcpy(device, sysfs_path, sizeof(device)); + if(start >= sizeof(device)) + start = sizeof(device) - 1; + strlcat(device, dent->d_name, sizeof(device)); + path_decode(&device[start]); + device_list_insert(device); + } + closedir(dir); + } +} + +int udevtrigger(int argc, char *argv[]) +{ + int failed = 0; + const char *sockpath = NULL; + int option; + const char *action = "add"; + const char *env = NULL; + static const struct option options[] = { + { "verbose", 0, NULL, 'v' }, + { "dry-run", 0, NULL, 'n' }, + { "retry-failed", 0, NULL, 'F' }, + { "socket", 1, NULL, 'o' }, + { "help", 0, NULL, 'h' }, + { "action", 1, NULL, 'c' }, + { "subsystem-match", 1, NULL, 's' }, + { "subsystem-nomatch", 1, NULL, 'S' }, + { "attr-match", 1, NULL, 'a' }, + { "attr-nomatch", 1, NULL, 'A' }, + { "env", 1, NULL, 'e' }, + {} + }; + + logging_init("udevtrigger"); + udev_config_init(); + dbg("version %s\n", VERSION); + sysfs_init(); + + while (1) { + option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'v': + verbose = 1; + break; + case 'n': + dry_run = 1; + break; + case 'F': + failed = 1; + break; + case 'o': + sockpath = optarg; + break; + case 'c': + action = optarg; + break; + case 'e': + if (strchr(optarg, '=') != NULL) + env = optarg; + break; + case 's': + name_list_add(&filter_subsystem_match_list, optarg, 0); + break; + case 'S': + name_list_add(&filter_subsystem_nomatch_list, optarg, 0); + break; + case 'a': + name_list_add(&filter_attr_match_list, optarg, 0); + break; + case 'A': + name_list_add(&filter_attr_nomatch_list, optarg, 0); + break; + case 'h': + printf("Usage: udevadm trigger OPTIONS\n" + " --verbose print the list of devices while running\n" + " --dry-run do not actually trigger the events\n" + " --retry-failed trigger only the events which have been\n" + " marked as failed during a previous run\n" + " --socket= pass events to socket instead of triggering kernel events\n" + " --env== pass an additional key (works only with --socket=)\n" + " --subsystem-match= trigger devices from a matching subystem\n" + " --subsystem-nomatch= exclude devices from a matching subystem\n" + " --attr-match=]> trigger devices with a matching sysfs\n" + " attribute\n" + " --attr-nomatch=]> exclude devices with a matching sysfs\n" + " attribute\n" + " --help print this text\n" + "\n"); + goto exit; + default: + goto exit; + } + } + + if (sockpath != NULL) { + struct stat stats; + + sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + memset(&saddr, 0x00, sizeof(struct sockaddr_un)); + saddr.sun_family = AF_LOCAL; + if (sockpath[0] == '@') { + /* abstract namespace socket requested */ + strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { + /* existing socket file */ + strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); + saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); + } else { + /* no socket file, assume abstract namespace socket */ + strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); + saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); + } + } else if (env != NULL) { + fprintf(stderr, "error: --env= only valid with --socket= option\n"); + goto exit; + } + + if (failed) { + scan_failed(); + exec_list(action, env); + } else { + char base[PATH_SIZE]; + struct stat statbuf; + + /* if we have /sys/subsystem, forget all the old stuff */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/subsystem", sizeof(base)); + if (stat(base, &statbuf) == 0) { + scan_subsystem("subsystem", SCAN_SUBSYSTEM); + exec_list(action, env); + scan_subsystem("subsystem", SCAN_DEVICES); + exec_list(action, env); + } else { + scan_subsystem("bus", SCAN_SUBSYSTEM); + exec_list(action, env); + scan_subsystem("bus", SCAN_DEVICES); + scan_class(); + + /* scan "block" if it isn't a "class" */ + strlcpy(base, sysfs_path, sizeof(base)); + strlcat(base, "/class/block", sizeof(base)); + if (stat(base, &statbuf) != 0) + scan_block(); + exec_list(action, env); + } + } + +exit: + name_list_cleanup(&filter_subsystem_match_list); + name_list_cleanup(&filter_subsystem_nomatch_list); + name_list_cleanup(&filter_attr_match_list); + name_list_cleanup(&filter_attr_nomatch_list); + + if (sock >= 0) + close(sock); + sysfs_cleanup(); + logging_close(); + return 0; +} diff --git a/udev/udevcontrol.c b/udev/udevcontrol.c deleted file mode 100644 index 5f1952543c..0000000000 --- a/udev/udevcontrol.c +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright (C) 2005-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" - -static int udev_log = 0; - -struct udev_ctrl; -extern struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path); -extern void udev_ctrl_unref(struct udev_ctrl *uctrl); -extern int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority); -extern int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl); -extern int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl); -extern int udev_ctrl_reload_rules(struct udev_ctrl *uctrl); -extern int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key); -extern int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count); -extern int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count); - -struct udev_ctrl { - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; -}; - -struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path) -{ - struct udev_ctrl *uctrl; - - uctrl = malloc(sizeof(struct udev_ctrl)); - if (uctrl == NULL) - return NULL; - memset(uctrl, 0x00, sizeof(struct udev_ctrl)); - - uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (uctrl->sock < 0) { - err("error getting socket: %s\n", strerror(errno)); - free(uctrl); - return NULL; - } - - uctrl->saddr.sun_family = AF_LOCAL; - strcpy(uctrl->saddr.sun_path, socket_path); - uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); - /* translate leading '@' to abstract namespace */ - if (uctrl->saddr.sun_path[0] == '@') - uctrl->saddr.sun_path[0] = '\0'; - return uctrl; -} - -void udev_ctrl_unref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return; - close(uctrl->sock); -} - -static int ctrl_send(struct udev_ctrl *uctrl, enum udevd_ctrl_msg_type type, int intval, const char *buf) -{ - struct udevd_ctrl_msg ctrl_msg; - int err; - - memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); - strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); - ctrl_msg.type = type; - - if (buf != NULL) - strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); - else - ctrl_msg.intval = intval; - - err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err == -1) { - err("error sending message: %s\n", strerror(errno)); - } - return err; -} - -int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority) -{ - ctrl_send(uctrl, UDEVD_CTRL_SET_LOG_LEVEL, priority, NULL); - return 0; -} - -int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl) -{ - ctrl_send(uctrl, UDEVD_CTRL_STOP_EXEC_QUEUE, 0, NULL); - return 0; -} - -int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl) -{ - ctrl_send(uctrl, UDEVD_CTRL_START_EXEC_QUEUE, 0, NULL); - return 0; -} - -int udev_ctrl_reload_rules(struct udev_ctrl *uctrl) -{ - ctrl_send(uctrl, UDEVD_CTRL_RELOAD_RULES, 0, NULL); - return 0; -} - -int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key) -{ - ctrl_send(uctrl, UDEVD_CTRL_ENV, 0, optarg); - return 0; -} - -int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count) -{ - ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS, count, NULL); - return 0; -} - -int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count) -{ - ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, count, NULL); - return 0; -} - -int udevcontrol(int argc, char *argv[]) -{ - struct udev_ctrl *uctrl; - const char *env; - int rc = 1; - - /* compat values with '_' will be removed in a future release */ - static const struct option options[] = { - { "log-priority", 1, NULL, 'l' }, - { "log_priority", 1, NULL, 'l' + 256 }, - { "stop-exec-queue", 0, NULL, 's' }, - { "stop_exec_queue", 0, NULL, 's' + 256 }, - { "start-exec-queue", 0, NULL, 'S' }, - { "start_exec_queue", 0, NULL, 'S' + 256}, - { "reload-rules", 0, NULL, 'R' }, - { "reload_rules", 0, NULL, 'R' + 256}, - { "env", 1, NULL, 'e' }, - { "max-childs", 1, NULL, 'm' }, - { "max_childs", 1, NULL, 'm' + 256}, - { "max-childs-running", 1, NULL, 'M' }, - { "max_childs_running", 1, NULL, 'M' + 256}, - { "help", 0, NULL, 'h' }, - {} - }; - - env = getenv("UDEV_LOG"); - if (env) - udev_log = log_priority(env); - - logging_init("udevcontrol"); - dbg("version %s\n", VERSION); - - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - goto exit; - } - - uctrl = udev_ctrl_new_from_socket(UDEVD_CTRL_SOCK_PATH); - if (uctrl == NULL) - goto exit; - - while (1) { - int option; - int i; - char *endp; - - option = getopt_long(argc, argv, "l:sSRe:m:M:h", options, NULL); - if (option == -1) - break; - - if (option > 255) { - info("udevadm control expects commands without underscore, " - "this will stop working in a future release\n"); - fprintf(stderr, "udevadm control expects commands without underscore, " - "this will stop working in a future release\n"); - } - - switch (option) { - case 'l': - case 'l' + 256: - i = log_priority(optarg); - if (i < 0) { - fprintf(stderr, "invalid number '%s'\n", optarg); - goto exit; - } - udev_ctrl_set_log_level(uctrl, log_priority(optarg)); - break; - case 's': - case 's' + 256: - udev_ctrl_stop_exec_queue(uctrl); - break; - case 'S': - case 'S' + 256: - udev_ctrl_start_exec_queue(uctrl); - break; - case 'R': - case 'R' + 256: - udev_ctrl_reload_rules(uctrl); - break; - case 'e': - if (strchr(optarg, '=') == NULL) { - fprintf(stderr, "expect = instead of '%s'\n", optarg); - goto exit; - } - udev_ctrl_set_env(uctrl, optarg); - break; - case 'm': - case 'm' + 256: - i = strtoul(optarg, &endp, 0); - if (endp[0] != '\0' || i < 1) { - fprintf(stderr, "invalid number '%s'\n", optarg); - goto exit; - } - udev_ctrl_set_max_childs(uctrl, i); - break; - case 'M': - case 'M' + 256: - i = strtoul(optarg, &endp, 0); - if (endp[0] != '\0' || i < 1) { - fprintf(stderr, "invalid number '%s'\n", optarg); - goto exit; - } - udev_ctrl_set_max_childs_running(uctrl, i); - break; - break; - case 'h': - printf("Usage: udevadm control COMMAND\n" - " --log-priority= set the udev log level for the daemon\n" - " --stop-exec-queue keep udevd from executing events, queue only\n" - " --start-exec-queue execute events, flush queue\n" - " --reload-rules reloads the rules files\n" - " --env== set a global environment variable\n" - " --max-childs= maximum number of childs\n" - " --max-childs-running= maximum number of childs running at the same time\n" - " --help print this help text\n\n"); - goto exit; - default: - goto exit; - } - } - - /* compat stuff which will be removed in a future release */ - if (argv[optind] != NULL) { - const char *arg = argv[optind]; - - fprintf(stderr, "udevadm control commands requires the -- format, " - "this will stop working in a future release\n"); - err("udevadm control commands requires the -- format, " - "this will stop working in a future release\n"); - - if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { - udev_ctrl_set_log_level(uctrl, log_priority(&arg[strlen("log_priority=")])); - } else if (!strcmp(arg, "stop_exec_queue")) { - udev_ctrl_stop_exec_queue(uctrl); - } else if (!strcmp(arg, "start_exec_queue")) { - udev_ctrl_start_exec_queue(uctrl); - } else if (!strcmp(arg, "reload_rules")) { - udev_ctrl_reload_rules(uctrl); - } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { - udev_ctrl_set_max_childs(uctrl, strtoul(&arg[strlen("max_childs=")], NULL, 0)); - } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { - udev_ctrl_set_max_childs_running(uctrl, strtoul(&arg[strlen("max_childs_running=")], NULL, 0)); - } else if (!strncmp(arg, "env", strlen("env"))) { - udev_ctrl_set_env(uctrl, &arg[strlen("env=")]); - } else { - fprintf(stderr, "unrecognized command '%s'\n", arg); - err("unrecognized command '%s'\n", arg); - } - } -exit: - udev_ctrl_unref(uctrl); - logging_close(); - return rc; -} diff --git a/udev/udevd.h b/udev/udevd.h index 7405704c7a..a22bc96e5d 100644 --- a/udev/udevd.h +++ b/udev/udevd.h @@ -32,7 +32,7 @@ #define UEVENT_NUM_ENVP 32 #define UDEVD_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd" -#define UDEVD_CTRL_MAGIC "udevd_" VERSION +#define UDEVD_CTRL_MAGIC "udevd-128" enum udevd_ctrl_msg_type { UDEVD_CTRL_UNKNOWN, diff --git a/udev/udevinfo.c b/udev/udevinfo.c deleted file mode 100644 index 6501b57d1a..0000000000 --- a/udev/udevinfo.c +++ /dev/null @@ -1,507 +0,0 @@ -/* - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static void print_all_attributes(const char *devpath, const char *key) -{ - char path[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - strlcpy(path, sysfs_path, sizeof(path)); - strlcat(path, devpath, sizeof(path)); - - dir = opendir(path); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat statbuf; - char filename[PATH_SIZE]; - char *attr_value; - char value[NAME_SIZE]; - size_t len; - - if (dent->d_name[0] == '.') - continue; - - if (strcmp(dent->d_name, "uevent") == 0) - continue; - if (strcmp(dent->d_name, "dev") == 0) - continue; - - strlcpy(filename, path, sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, dent->d_name, sizeof(filename)); - if (lstat(filename, &statbuf) != 0) - continue; - if (S_ISLNK(statbuf.st_mode)) - continue; - - attr_value = sysfs_attr_get_value(devpath, dent->d_name); - if (attr_value == NULL) - continue; - len = strlcpy(value, attr_value, sizeof(value)); - if(len >= sizeof(value)) - len = sizeof(value) - 1; - dbg("attr '%s'='%s'(%zi)\n", dent->d_name, value, len); - - /* remove trailing newlines */ - while (len && value[len-1] == '\n') - value[--len] = '\0'; - - /* skip nonprintable attributes */ - while (len && isprint(value[len-1])) - len--; - if (len) { - dbg("attribute value of '%s' non-printable, skip\n", dent->d_name); - continue; - } - - printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); - } - } - printf("\n"); -} - -static int print_device_chain(const char *devpath) -{ - struct sysfs_device *dev; - - dev = sysfs_device_get(devpath); - if (dev == NULL) - return -1; - - printf("\n" - "Udevinfo starts with the device specified by the devpath and then\n" - "walks up the chain of parent devices. It prints for every device\n" - "found, all possible attributes in the udev rules key format.\n" - "A rule to match, can be composed by the attributes of the device\n" - "and the attributes from one single parent device.\n" - "\n"); - - printf(" looking at device '%s':\n", dev->devpath); - printf(" KERNEL==\"%s\"\n", dev->kernel); - printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); - printf(" DRIVER==\"%s\"\n", dev->driver); - print_all_attributes(dev->devpath, "ATTR"); - - /* walk up the chain of devices */ - while (1) { - dev = sysfs_device_get_parent(dev); - if (dev == NULL) - break; - printf(" looking at parent device '%s':\n", dev->devpath); - printf(" KERNELS==\"%s\"\n", dev->kernel); - printf(" SUBSYSTEMS==\"%s\"\n", dev->subsystem); - printf(" DRIVERS==\"%s\"\n", dev->driver); - - print_all_attributes(dev->devpath, "ATTRS"); - } - - return 0; -} - -static void print_record(struct udevice *udev) -{ - struct name_entry *name_loop; - - printf("P: %s\n", udev->dev->devpath); - printf("N: %s\n", udev->name); - list_for_each_entry(name_loop, &udev->symlink_list, node) - printf("S: %s\n", name_loop->name); - if (udev->link_priority != 0) - printf("L: %i\n", udev->link_priority); - if (udev->partitions != 0) - printf("A:%u\n", udev->partitions); - if (udev->ignore_remove) - printf("R:%u\n", udev->ignore_remove); - list_for_each_entry(name_loop, &udev->env_list, node) - printf("E: %s\n", name_loop->name); -} - -static void export_db(void) { - LIST_HEAD(name_list); - struct name_entry *name_loop; - - udev_db_get_all_entries(&name_list); - list_for_each_entry(name_loop, &name_list, node) { - struct udevice *udev_db; - - udev_db = udev_device_init(); - if (udev_db == NULL) - continue; - if (udev_db_get_device(udev_db, name_loop->name) == 0) - print_record(udev_db); - printf("\n"); - udev_device_cleanup(udev_db); - } - name_list_cleanup(&name_list); -} - -static int lookup_device_by_name(struct udevice **udev, const char *name) -{ - LIST_HEAD(name_list); - int count; - struct name_entry *device; - int rc = -1; - - count = udev_db_get_devices_by_name(name, &name_list); - if (count <= 0) - goto out; - - info("found %i devices for '%s'\n", count, name); - - /* select the device that seems to match */ - list_for_each_entry(device, &name_list, node) { - struct udevice *udev_loop; - char filename[PATH_SIZE]; - struct stat statbuf; - - udev_loop = udev_device_init(); - if (udev_loop == NULL) - break; - if (udev_db_get_device(udev_loop, device->name) != 0) - goto next; - info("found db entry '%s'\n", device->name); - - /* make sure, we don't get a link of a different device */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, name, sizeof(filename)); - if (stat(filename, &statbuf) != 0) - goto next; - if (major(udev_loop->devt) > 0 && udev_loop->devt != statbuf.st_rdev) { - info("skip '%s', dev_t doesn't match\n", udev_loop->name); - goto next; - } - rc = 0; - *udev = udev_loop; - break; -next: - udev_device_cleanup(udev_loop); - } -out: - name_list_cleanup(&name_list); - return rc; -} - -static int stat_device(const char *name, int export, const char *prefix) -{ - struct stat statbuf; - - if (stat(name, &statbuf) != 0) - return -1; - - if (export) { - if (prefix == NULL) - prefix = "INFO_"; - printf("%sMAJOR=%d\n" - "%sMINOR=%d\n", - prefix, major(statbuf.st_dev), - prefix, minor(statbuf.st_dev)); - } else - printf("%d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); - return 0; -} - -int udevinfo(int argc, char *argv[]) -{ - int option; - struct udevice *udev = NULL; - int root = 0; - int export = 0; - const char *export_prefix = NULL; - - static const struct option options[] = { - { "name", 1, NULL, 'n' }, - { "path", 1, NULL, 'p' }, - { "query", 1, NULL, 'q' }, - { "attribute-walk", 0, NULL, 'a' }, - { "export-db", 0, NULL, 'e' }, - { "root", 0, NULL, 'r' }, - { "device-id-of-file", 1, NULL, 'd' }, - { "export", 0, NULL, 'x' }, - { "export-prefix", 1, NULL, 'P' }, - { "version", 0, NULL, 1 }, /* -V outputs braindead format */ - { "help", 0, NULL, 'h' }, - {} - }; - - enum action_type { - ACTION_NONE, - ACTION_QUERY, - ACTION_ATTRIBUTE_WALK, - ACTION_ROOT, - ACTION_DEVICE_ID_FILE, - } action = ACTION_NONE; - - enum query_type { - QUERY_NONE, - QUERY_NAME, - QUERY_PATH, - QUERY_SYMLINK, - QUERY_ENV, - QUERY_ALL, - } query = QUERY_NONE; - - char path[PATH_SIZE] = ""; - char name[PATH_SIZE] = ""; - struct name_entry *name_loop; - int rc = 0; - - logging_init("udevinfo"); - udev_config_init(); - sysfs_init(); - - while (1) { - option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); - if (option == -1) - break; - - dbg("option '%c'\n", option); - switch (option) { - case 'n': - /* remove /dev if given */ - if (strncmp(optarg, udev_root, strlen(udev_root)) == 0) - strlcpy(name, &optarg[strlen(udev_root)+1], sizeof(name)); - else - strlcpy(name, optarg, sizeof(name)); - remove_trailing_chars(name, '/'); - dbg("name: %s\n", name); - break; - case 'p': - /* remove /sys if given */ - if (strncmp(optarg, sysfs_path, strlen(sysfs_path)) == 0) - strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path)); - else - strlcpy(path, optarg, sizeof(path)); - remove_trailing_chars(path, '/'); - - /* possibly resolve to real devpath */ - if (sysfs_resolve_link(path, sizeof(path)) != 0) { - char temp[PATH_SIZE]; - char *pos; - - /* also check if the parent is a link */ - strlcpy(temp, path, sizeof(temp)); - pos = strrchr(temp, '/'); - if (pos != 0) { - char tail[PATH_SIZE]; - - strlcpy(tail, pos, sizeof(tail)); - pos[0] = '\0'; - if (sysfs_resolve_link(temp, sizeof(temp)) == 0) { - strlcpy(path, temp, sizeof(path)); - strlcat(path, tail, sizeof(path)); - } - } - } - dbg("path: %s\n", path); - break; - case 'q': - action = ACTION_QUERY; - if (strcmp(optarg, "name") == 0) { - query = QUERY_NAME; - break; - } - if (strcmp(optarg, "symlink") == 0) { - query = QUERY_SYMLINK; - break; - } - if (strcmp(optarg, "path") == 0) { - query = QUERY_PATH; - break; - } - if (strcmp(optarg, "env") == 0) { - query = QUERY_ENV; - break; - } - if (strcmp(optarg, "all") == 0) { - query = QUERY_ALL; - break; - } - fprintf(stderr, "unknown query type\n"); - rc = 2; - goto exit; - case 'r': - if (action == ACTION_NONE) - action = ACTION_ROOT; - root = 1; - break; - case 'd': - action = ACTION_DEVICE_ID_FILE; - strlcpy(name, optarg, sizeof(name)); - break; - case 'a': - action = ACTION_ATTRIBUTE_WALK; - break; - case 'e': - export_db(); - goto exit; - case 'x': - export = 1; - break; - case 'P': - export_prefix = optarg; - break; - case 1: - printf("%s\n", VERSION); - goto exit; - case 'V': - printf("udevinfo, version %s\n", VERSION); - goto exit; - case 'h': - printf("Usage: udevadm info OPTIONS\n" - " --query= query database for the specified value:\n" - " name name of device node\n" - " symlink pointing to node\n" - " path sysfs device path\n" - " env the device related imported environment\n" - " all all values\n" - " --path= sysfs device path used for query or chain\n" - " --name= node or symlink name used for query\n" - " --root prepend to query result or print udev_root\n" - " --attribute-walk print all key matches while walking along chain\n" - " of parent devices\n" - " --device-id-of-file= print major/minor of underlying device\n" - " --export-db export the content of the udev database\n" - " --help print this text\n" - "\n"); - goto exit; - default: - goto exit; - } - } - - /* run action */ - switch (action) { - case ACTION_QUERY: - /* needs devpath or node/symlink name for query */ - if (path[0] != '\0') { - udev = udev_device_init(); - if (udev == NULL) { - rc = 1; - goto exit; - } - if (udev_db_get_device(udev, path) != 0) { - fprintf(stderr, "no record for '%s' in database\n", path); - rc = 3; - goto exit; - } - } else if (name[0] != '\0') { - if (lookup_device_by_name(&udev, name) != 0) { - fprintf(stderr, "node name not found\n"); - rc = 4; - goto exit; - } - } else { - fprintf(stderr, "query needs --path or node --name specified\n"); - rc = 4; - goto exit; - } - - switch(query) { - case QUERY_NAME: - if (root) - printf("%s/%s\n", udev_root, udev->name); - else - printf("%s\n", udev->name); - break; - case QUERY_SYMLINK: - list_for_each_entry(name_loop, &udev->symlink_list, node) { - char c = name_loop->node.next != &udev->symlink_list ? ' ' : '\n'; - - if (root) - printf("%s/%s%c", udev_root, name_loop->name, c); - else - printf("%s%c", name_loop->name, c); - } - break; - case QUERY_PATH: - printf("%s\n", udev->dev->devpath); - goto exit; - case QUERY_ENV: - list_for_each_entry(name_loop, &udev->env_list, node) - printf("%s\n", name_loop->name); - break; - case QUERY_ALL: - print_record(udev); - break; - default: - fprintf(stderr, "unknown query type\n"); - break; - } - break; - case ACTION_ATTRIBUTE_WALK: - if (path[0] != '\0') { - if (print_device_chain(path) != 0) { - fprintf(stderr, "no valid sysfs device found\n"); - rc = 4; - goto exit; - } - } else if (name[0] != '\0') { - if (lookup_device_by_name(&udev, name) != 0) { - fprintf(stderr, "node name not found\n"); - rc = 4; - goto exit; - } - if (print_device_chain(udev->dev->devpath) != 0) { - fprintf(stderr, "no valid sysfs device found\n"); - rc = 4; - goto exit; - } - } else { - fprintf(stderr, "attribute walk needs --path or node --name specified\n"); - rc = 5; - goto exit; - } - break; - case ACTION_DEVICE_ID_FILE: - if (stat_device(name, export, export_prefix) != 0) - rc = 6; - break; - case ACTION_ROOT: - printf("%s\n", udev_root); - break; - default: - fprintf(stderr, "missing option\n"); - rc = 1; - break; - } - -exit: - udev_device_cleanup(udev); - sysfs_cleanup(); - logging_close(); - return rc; -} diff --git a/udev/udevmonitor.c b/udev/udevmonitor.c deleted file mode 100644 index 3b65bcae9b..0000000000 --- a/udev/udevmonitor.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" - -static int uevent_netlink_sock = -1; -static int udev_monitor_sock = -1; -static volatile int udev_exit; - -static int init_udev_monitor_socket(void) -{ - struct sockaddr_un saddr; - socklen_t addrlen; - int retval; - - memset(&saddr, 0x00, sizeof(saddr)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], "/org/kernel/udev/monitor"); - addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - - udev_monitor_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (udev_monitor_sock == -1) { - fprintf(stderr, "error getting socket: %s\n", strerror(errno)); - return -1; - } - - /* the bind takes care of ensuring only one copy running */ - retval = bind(udev_monitor_sock, (struct sockaddr *) &saddr, addrlen); - if (retval < 0) { - fprintf(stderr, "bind failed: %s\n", strerror(errno)); - close(udev_monitor_sock); - udev_monitor_sock = -1; - return -1; - } - - return 0; -} - -static int init_uevent_netlink_sock(void) -{ - struct sockaddr_nl snl; - int retval; - - memset(&snl, 0x00, sizeof(struct sockaddr_nl)); - snl.nl_family = AF_NETLINK; - snl.nl_pid = getpid(); - snl.nl_groups = 1; - - uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); - if (uevent_netlink_sock == -1) { - fprintf(stderr, "error getting socket: %s\n", strerror(errno)); - return -1; - } - - retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, - sizeof(struct sockaddr_nl)); - if (retval < 0) { - fprintf(stderr, "bind failed: %s\n", strerror(errno)); - close(uevent_netlink_sock); - uevent_netlink_sock = -1; - return -1; - } - - return 0; -} - -static void asmlinkage sig_handler(int signum) -{ - if (signum == SIGINT || signum == SIGTERM) - udev_exit = 1; -} - -static const char *search_key(const char *searchkey, const char *buf, size_t buflen) -{ - size_t bufpos = 0; - size_t searchkeylen = strlen(searchkey); - - while (bufpos < buflen) { - const char *key; - int keylen; - - key = &buf[bufpos]; - keylen = strlen(key); - if (keylen == 0) - break; - if ((strncmp(searchkey, key, searchkeylen) == 0) && key[searchkeylen] == '=') - return &key[searchkeylen + 1]; - bufpos += keylen + 1; - } - return NULL; -} - -int udevmonitor(int argc, char *argv[]) -{ - struct sigaction act; - int option; - int env = 0; - int kernel = 0; - int udev = 0; - fd_set readfds; - int retval = 0; - - static const struct option options[] = { - { "environment", 0, NULL, 'e' }, - { "kernel", 0, NULL, 'k' }, - { "udev", 0, NULL, 'u' }, - { "help", 0, NULL, 'h' }, - {} - }; - - while (1) { - option = getopt_long(argc, argv, "ekuh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'e': - env = 1; - break; - case 'k': - kernel = 1; - break; - case 'u': - udev = 1; - break; - case 'h': - printf("Usage: udevadm monitor [--environment] [--kernel] [--udev] [--help]\n" - " --env print the whole event environment\n" - " --kernel print kernel uevents\n" - " --udev print udev events\n" - " --help print this help text\n\n"); - default: - goto out; - } - } - - if (!kernel && !udev) { - kernel = 1; - udev =1; - } - - if (getuid() != 0 && kernel) { - fprintf(stderr, "root privileges needed to subscribe to kernel events\n"); - goto out; - } - - /* set signal handlers */ - memset(&act, 0x00, sizeof(struct sigaction)); - act.sa_handler = (void (*)(int)) sig_handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_RESTART; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - - printf("udevmonitor will print the received events for:\n"); - if (udev) { - retval = init_udev_monitor_socket(); - if (retval) - goto out; - printf("UDEV the event which udev sends out after rule processing\n"); - } - if (kernel) { - retval = init_uevent_netlink_sock(); - if (retval) - goto out; - printf("UEVENT the kernel uevent\n"); - } - printf("\n"); - - while (!udev_exit) { - char buf[UEVENT_BUFFER_SIZE*2]; - ssize_t buflen; - ssize_t bufpos; - ssize_t keys; - int fdcount; - struct timeval tv; - struct timezone tz; - char timestr[64]; - const char *source = NULL; - const char *devpath, *action, *subsys; - - buflen = 0; - FD_ZERO(&readfds); - if (uevent_netlink_sock >= 0) - FD_SET(uevent_netlink_sock, &readfds); - if (udev_monitor_sock >= 0) - FD_SET(udev_monitor_sock, &readfds); - - fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno != EINTR) - fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); - continue; - } - - if (gettimeofday(&tv, &tz) == 0) { - snprintf(timestr, sizeof(timestr), "%llu.%06u", - (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec); - } else - timestr[0] = '\0'; - - if ((uevent_netlink_sock >= 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { - buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); - if (buflen <= 0) { - fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); - continue; - } - source = "UEVENT"; - } - - if ((udev_monitor_sock >= 0) && FD_ISSET(udev_monitor_sock, &readfds)) { - buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); - if (buflen <= 0) { - fprintf(stderr, "error receiving udev message: %s\n", strerror(errno)); - continue; - } - source = "UDEV "; - } - - if (buflen == 0) - continue; - - keys = strlen(buf) + 1; /* start of payload */ - devpath = search_key("DEVPATH", &buf[keys], buflen); - action = search_key("ACTION", &buf[keys], buflen); - subsys = search_key("SUBSYSTEM", &buf[keys], buflen); - printf("%s[%s] %-8s %s (%s)\n", source, timestr, action, devpath, subsys); - - /* print environment */ - bufpos = keys; - if (env) { - while (bufpos < buflen) { - int keylen; - char *key; - - key = &buf[bufpos]; - keylen = strlen(key); - if (keylen == 0) - break; - printf("%s\n", key); - bufpos += keylen + 1; - } - printf("\n"); - } - } - -out: - if (uevent_netlink_sock >= 0) - close(uevent_netlink_sock); - if (udev_monitor_sock >= 0) - close(udev_monitor_sock); - - if (retval) - return 1; - return 0; -} diff --git a/udev/udevsettle.c b/udev/udevsettle.c deleted file mode 100644 index 11277f5a43..0000000000 --- a/udev/udevsettle.c +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright (C) 2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" - -#define DEFAULT_TIMEOUT 180 -#define LOOP_PER_SECOND 20 - -static void print_queue(const char *dir) -{ - LIST_HEAD(files); - struct name_entry *item; - - if (add_matching_files(&files, dir, NULL) < 0) - return; - - printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n"); - - list_for_each_entry(item, &files, node) { - char target[NAME_SIZE]; - size_t len; - const char *filename = strrchr(item->name, '/'); - - if (filename == NULL) - continue; - filename++; - if (*filename == '\0') - continue; - - len = readlink(item->name, target, sizeof(target)); - if (len < 0) - continue; - target[len] = '\0'; - - printf("%s: %s\n", filename, target); - } - - printf("\n\n"); -} - -int udevsettle(int argc, char *argv[]) -{ - char queuename[PATH_SIZE]; - char filename[PATH_SIZE]; - unsigned long long seq_kernel; - unsigned long long seq_udev; - char seqnum[32]; - int fd; - ssize_t len; - int timeout = DEFAULT_TIMEOUT; - int loop; - static const struct option options[] = { - { "timeout", 1, NULL, 't' }, - { "help", 0, NULL, 'h' }, - {} - }; - int option; - int rc = 1; - int seconds; - - logging_init("udevsettle"); - udev_config_init(); - dbg("version %s\n", VERSION); - sysfs_init(); - - while (1) { - option = getopt_long(argc, argv, "t:h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 't': - seconds = atoi(optarg); - if (seconds > 0) - timeout = seconds; - else - fprintf(stderr, "invalid timeout value\n"); - dbg("timeout=%i\n", timeout); - break; - case 'h': - printf("Usage: udevadm settle [--help] [--timeout=]\n\n"); - goto exit; - } - } - - strlcpy(queuename, udev_root, sizeof(queuename)); - strlcat(queuename, "/.udev/queue", sizeof(queuename)); - - loop = timeout * LOOP_PER_SECOND; - while (loop--) { - /* wait for events in queue to finish */ - while (loop--) { - struct stat statbuf; - - if (stat(queuename, &statbuf) < 0) { - info("queue is empty\n"); - break; - } - usleep(1000 * 1000 / LOOP_PER_SECOND); - } - if (loop <= 0) { - info("timeout waiting for queue\n"); - print_queue(queuename); - goto exit; - } - - /* read current udev seqnum */ - strlcpy(filename, udev_root, sizeof(filename)); - strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); - fd = open(filename, O_RDONLY); - if (fd < 0) - goto exit; - len = read(fd, seqnum, sizeof(seqnum)-1); - close(fd); - if (len <= 0) - goto exit; - seqnum[len] = '\0'; - seq_udev = strtoull(seqnum, NULL, 10); - info("udev seqnum = %llu\n", seq_udev); - - /* read current kernel seqnum */ - strlcpy(filename, sysfs_path, sizeof(filename)); - strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); - fd = open(filename, O_RDONLY); - if (fd < 0) - goto exit; - len = read(fd, seqnum, sizeof(seqnum)-1); - close(fd); - if (len <= 0) - goto exit; - seqnum[len] = '\0'; - seq_kernel = strtoull(seqnum, NULL, 10); - info("kernel seqnum = %llu\n", seq_kernel); - - /* make sure all kernel events have arrived in the queue */ - if (seq_udev >= seq_kernel) { - info("queue is empty and no pending events left\n"); - rc = 0; - goto exit; - } - usleep(1000 * 1000 / LOOP_PER_SECOND); - info("queue is empty, but events still pending\n"); - } - -exit: - sysfs_cleanup(); - logging_close(); - return rc; -} diff --git a/udev/udevtest.c b/udev/udevtest.c deleted file mode 100644 index 63603aad97..0000000000 --- a/udev/udevtest.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" - -static int import_uevent_var(const char *devpath) -{ - char path[PATH_SIZE]; - static char value[4096]; /* must stay, used with putenv */ - ssize_t size; - int fd; - char *key; - char *next; - int rc = -1; - - /* read uevent file */ - strlcpy(path, sysfs_path, sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/uevent", sizeof(path)); - fd = open(path, O_RDONLY); - if (fd < 0) - goto out; - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - value[size] = '\0'; - - /* import keys into environment */ - key = value; - while (key[0] != '\0') { - next = strchr(key, '\n'); - if (next == NULL) - goto out; - next[0] = '\0'; - info("import into environment: '%s'\n", key); - putenv(key); - key = &next[1]; - } - rc = 0; -out: - return rc; -} - -int udevtest(int argc, char *argv[]) -{ - int force = 0; - const char *action = "add"; - const char *subsystem = NULL; - const char *devpath = NULL; - struct udevice *udev; - struct sysfs_device *dev; - struct udev_rules rules = {}; - int retval; - int rc = 0; - - static const struct option options[] = { - { "action", 1, NULL, 'a' }, - { "subsystem", 1, NULL, 's' }, - { "force", 0, NULL, 'f' }, - { "help", 0, NULL, 'h' }, - {} - }; - - info("version %s\n", VERSION); - udev_config_init(); - if (udev_log_priority < LOG_INFO) { - char priority[32]; - - udev_log_priority = LOG_INFO; - sprintf(priority, "%i", udev_log_priority); - setenv("UDEV_LOG", priority, 1); - } - - while (1) { - int option; - - option = getopt_long(argc, argv, "a:s:fh", options, NULL); - if (option == -1) - break; - - dbg("option '%c'\n", option); - switch (option) { - case 'a': - action = optarg; - break; - case 's': - subsystem = optarg; - break; - case 'f': - force = 1; - break; - case 'h': - printf("Usage: udevadm test OPTIONS \n" - " --action= set action string\n" - " --subsystem= set subsystem string\n" - " --force don't skip node/link creation\n" - " --help print this help text\n\n"); - exit(0); - default: - exit(1); - } - } - devpath = argv[optind]; - - if (devpath == NULL) { - fprintf(stderr, "devpath parameter missing\n"); - rc = 1; - goto exit; - } - - printf("This program is for debugging only, it does not run any program,\n" - "specified by a RUN key. It may show incorrect results, because\n" - "some values may be different, or not available at a simulation run.\n" - "\n"); - - sysfs_init(); - udev_rules_init(&rules, 0); - - /* remove /sys if given */ - if (strncmp(devpath, sysfs_path, strlen(sysfs_path)) == 0) - devpath = &devpath[strlen(sysfs_path)]; - - dev = sysfs_device_get(devpath); - if (dev == NULL) { - fprintf(stderr, "unable to open device '%s'\n", devpath); - rc = 2; - goto exit; - } - - udev = udev_device_init(); - if (udev == NULL) { - fprintf(stderr, "error initializing device\n"); - rc = 3; - goto exit; - } - - if (subsystem != NULL) - strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); - - /* override built-in sysfs device */ - udev->dev = dev; - strlcpy(udev->action, action, sizeof(udev->action)); - udev->devt = udev_device_get_devt(udev); - - /* simulate node creation with test flag */ - if (!force) - udev->test_run = 1; - - setenv("DEVPATH", udev->dev->devpath, 1); - setenv("SUBSYSTEM", udev->dev->subsystem, 1); - setenv("ACTION", udev->action, 1); - import_uevent_var(udev->dev->devpath); - - info("looking at device '%s' from subsystem '%s'\n", udev->dev->devpath, udev->dev->subsystem); - retval = udev_device_event(&rules, udev); - - if (udev->event_timeout >= 0) - info("custom event timeout: %i\n", udev->event_timeout); - - if (retval == 0 && !udev->ignore_device && udev_run) { - struct name_entry *name_loop; - - list_for_each_entry(name_loop, &udev->run_list, node) { - char program[PATH_SIZE]; - - strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - info("run: '%s'\n", program); - } - } - udev_device_cleanup(udev); - -exit: - udev_rules_cleanup(&rules); - sysfs_cleanup(); - return rc; -} diff --git a/udev/udevtrigger.c b/udev/udevtrigger.c deleted file mode 100644 index 4a8f62ab5c..0000000000 --- a/udev/udevtrigger.c +++ /dev/null @@ -1,716 +0,0 @@ -/* - * Copyright (C) 2004-2006 Kay Sievers - * Copyright (C) 2006 Hannes Reinecke - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" -#include "udev_rules.h" - -static int verbose; -static int dry_run; -LIST_HEAD(device_list); -LIST_HEAD(filter_subsystem_match_list); -LIST_HEAD(filter_subsystem_nomatch_list); -LIST_HEAD(filter_attr_match_list); -LIST_HEAD(filter_attr_nomatch_list); -static int sock = -1; -static struct sockaddr_un saddr; -static socklen_t saddrlen; - -/* devices that should run last cause of their dependencies */ -static int delay_device(const char *devpath) -{ - static const char *delay_device_list[] = { - "*/md*", - "*/dm-*", - NULL - }; - int i; - - for (i = 0; delay_device_list[i] != NULL; i++) - if (fnmatch(delay_device_list[i], devpath, 0) == 0) - return 1; - return 0; -} - -static int device_list_insert(const char *path) -{ - char filename[PATH_SIZE]; - char devpath[PATH_SIZE]; - struct stat statbuf; - - dbg("add '%s'\n" , path); - - /* we only have a device, if we have an uevent file */ - strlcpy(filename, path, sizeof(filename)); - strlcat(filename, "/uevent", sizeof(filename)); - if (stat(filename, &statbuf) < 0) - return -1; - if (!(statbuf.st_mode & S_IWUSR)) - return -1; - - strlcpy(devpath, &path[strlen(sysfs_path)], sizeof(devpath)); - - /* resolve possible link to real target */ - if (lstat(path, &statbuf) < 0) - return -1; - if (S_ISLNK(statbuf.st_mode)) - if (sysfs_resolve_link(devpath, sizeof(devpath)) != 0) - return -1; - - name_list_add(&device_list, devpath, 1); - return 0; -} - -static void trigger_uevent(const char *devpath, const char *action) -{ - char filename[PATH_SIZE]; - int fd; - - strlcpy(filename, sysfs_path, sizeof(filename)); - strlcat(filename, devpath, sizeof(filename)); - strlcat(filename, "/uevent", sizeof(filename)); - - if (verbose) - printf("%s\n", devpath); - - if (dry_run) - return; - - fd = open(filename, O_WRONLY); - if (fd < 0) { - dbg("error on opening %s: %s\n", filename, strerror(errno)); - return; - } - - if (write(fd, action, strlen(action)) < 0) - info("error writing '%s' to '%s': %s\n", action, filename, strerror(errno)); - - close(fd); -} - -static int pass_to_socket(const char *devpath, const char *action, const char *env) -{ - struct udevice *udev; - struct name_entry *name_loop; - char buf[4096]; - size_t bufpos = 0; - ssize_t count; - char path[PATH_SIZE]; - int fd; - char link_target[PATH_SIZE]; - int len; - int err = 0; - - if (verbose) - printf("%s\n", devpath); - - udev = udev_device_init(); - if (udev == NULL) - return -1; - udev_db_get_device(udev, devpath); - - /* add header */ - bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); - bufpos++; - - /* add cookie */ - if (env != NULL) { - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "%s", env); - bufpos++; - } - - /* add standard keys */ - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVPATH=%s", devpath); - bufpos++; - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "ACTION=%s", action); - bufpos++; - - /* add subsystem */ - strlcpy(path, sysfs_path, sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/subsystem", sizeof(path)); - len = readlink(path, link_target, sizeof(link_target)); - if (len > 0) { - char *pos; - - link_target[len] = '\0'; - pos = strrchr(link_target, '/'); - if (pos != NULL) { - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "SUBSYSTEM=%s", &pos[1]); - bufpos++; - } - } - - /* add symlinks and node name */ - path[0] = '\0'; - list_for_each_entry(name_loop, &udev->symlink_list, node) { - strlcat(path, udev_root, sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, name_loop->name, sizeof(path)); - strlcat(path, " ", sizeof(path)); - } - remove_trailing_chars(path, ' '); - if (path[0] != '\0') { - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path); - bufpos++; - } - if (udev->name[0] != '\0') { - strlcpy(path, udev_root, sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, udev->name, sizeof(path)); - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path); - bufpos++; - } - - /* add keys from device "uevent" file */ - strlcpy(path, sysfs_path, sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/uevent", sizeof(path)); - fd = open(path, O_RDONLY); - if (fd >= 0) { - char value[4096]; - - count = read(fd, value, sizeof(value)); - close(fd); - if (count > 0) { - char *key; - - value[count] = '\0'; - key = value; - while (key[0] != '\0') { - char *next; - - next = strchr(key, '\n'); - if (next == NULL) - break; - next[0] = '\0'; - bufpos += strlcpy(&buf[bufpos], key, sizeof(buf) - bufpos-1); - bufpos++; - key = &next[1]; - } - } - } - - /* add keys from database */ - list_for_each_entry(name_loop, &udev->env_list, node) { - bufpos += strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); - bufpos++; - } - if (bufpos > sizeof(buf)) - bufpos = sizeof(buf); - - count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); - if (count < 0) - err = -1; - - return err; -} - -static void exec_list(const char *action, const char *env) -{ - struct name_entry *loop_device; - struct name_entry *tmp_device; - - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (delay_device(loop_device->name)) - continue; - if (sock >= 0) - pass_to_socket(loop_device->name, action, env); - else - trigger_uevent(loop_device->name, action); - list_del(&loop_device->node); - free(loop_device); - } - - /* trigger remaining delayed devices */ - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (sock >= 0) - pass_to_socket(loop_device->name, action, env); - else - trigger_uevent(loop_device->name, action); - list_del(&loop_device->node); - free(loop_device); - } -} - -static int subsystem_filtered(const char *subsystem) -{ - struct name_entry *loop_name; - - /* skip devices matching the listed subsystems */ - list_for_each_entry(loop_name, &filter_subsystem_nomatch_list, node) - if (fnmatch(loop_name->name, subsystem, 0) == 0) - return 1; - - /* skip devices not matching the listed subsystems */ - if (!list_empty(&filter_subsystem_match_list)) { - list_for_each_entry(loop_name, &filter_subsystem_match_list, node) - if (fnmatch(loop_name->name, subsystem, 0) == 0) - return 0; - return 1; - } - - return 0; -} - -static int attr_match(const char *path, const char *attr_value) -{ - char attr[NAME_SIZE]; - char file[PATH_SIZE]; - char *match_value; - - strlcpy(attr, attr_value, sizeof(attr)); - - /* separate attr and match value */ - match_value = strchr(attr, '='); - if (match_value != NULL) { - match_value[0] = '\0'; - match_value = &match_value[1]; - } - - strlcpy(file, path, sizeof(file)); - strlcat(file, "/", sizeof(file)); - strlcat(file, attr, sizeof(file)); - - if (match_value != NULL) { - /* match file content */ - char value[NAME_SIZE]; - int fd; - ssize_t size; - - fd = open(file, O_RDONLY); - if (fd < 0) - return 0; - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - return 0; - value[size] = '\0'; - remove_trailing_chars(value, '\n'); - - /* match if attribute value matches */ - if (fnmatch(match_value, value, 0) == 0) - return 1; - } else { - /* match if attribute exists */ - struct stat statbuf; - - if (stat(file, &statbuf) == 0) - return 1; - } - return 0; -} - -static int attr_filtered(const char *path) -{ - struct name_entry *loop_name; - - /* skip devices matching the listed sysfs attributes */ - list_for_each_entry(loop_name, &filter_attr_nomatch_list, node) - if (attr_match(path, loop_name->name)) - return 1; - - /* skip devices not matching the listed sysfs attributes */ - if (!list_empty(&filter_attr_match_list)) { - list_for_each_entry(loop_name, &filter_attr_match_list, node) - if (attr_match(path, loop_name->name)) - return 0; - return 1; - } - return 0; -} - -enum scan_type { - SCAN_DEVICES, - SCAN_SUBSYSTEM, -}; - -static void scan_subsystem(const char *subsys, enum scan_type scan) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - const char *subdir; - - if (scan == SCAN_DEVICES) - subdir = "/devices"; - else if (scan == SCAN_SUBSYSTEM) - subdir = "/drivers"; - else - return; - - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/", sizeof(base)); - strlcat(base, subsys, sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - if (scan == SCAN_DEVICES) - if (subsystem_filtered(dent->d_name)) - continue; - - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); - - if (scan == SCAN_SUBSYSTEM) { - if (attr_filtered(dirname)) - continue; - if (!subsystem_filtered("subsystem")) - device_list_insert(dirname); - if (subsystem_filtered("drivers")) - continue; - } - - strlcat(dirname, subdir, sizeof(dirname)); - - /* look for devices/drivers */ - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - strlcpy(dirname2, dirname, sizeof(dirname2)); - strlcat(dirname2, "/", sizeof(dirname2)); - strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - if (attr_filtered(dirname2)) - continue; - device_list_insert(dirname2); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void scan_block(void) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - if (subsystem_filtered("block")) - return; - - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/block", sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); - if (attr_filtered(dirname)) - continue; - if (device_list_insert(dirname) != 0) - continue; - - /* look for partitions */ - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - if (!strcmp(dent2->d_name,"device")) - continue; - - strlcpy(dirname2, dirname, sizeof(dirname2)); - strlcat(dirname2, "/", sizeof(dirname2)); - strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - if (attr_filtered(dirname2)) - continue; - device_list_insert(dirname2); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void scan_class(void) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/class", sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - if (subsystem_filtered(dent->d_name)) - continue; - - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - if (!strcmp(dent2->d_name, "device")) - continue; - - strlcpy(dirname2, dirname, sizeof(dirname2)); - strlcat(dirname2, "/", sizeof(dirname2)); - strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - if (attr_filtered(dirname2)) - continue; - device_list_insert(dirname2); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void scan_failed(void) -{ - char base[PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - strlcpy(base, udev_root, sizeof(base)); - strlcat(base, "/.udev/failed", sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char device[PATH_SIZE]; - size_t start; - - if (dent->d_name[0] == '.') - continue; - - start = strlcpy(device, sysfs_path, sizeof(device)); - if(start >= sizeof(device)) - start = sizeof(device) - 1; - strlcat(device, dent->d_name, sizeof(device)); - path_decode(&device[start]); - device_list_insert(device); - } - closedir(dir); - } -} - -int udevtrigger(int argc, char *argv[]) -{ - int failed = 0; - const char *sockpath = NULL; - int option; - const char *action = "add"; - const char *env = NULL; - static const struct option options[] = { - { "verbose", 0, NULL, 'v' }, - { "dry-run", 0, NULL, 'n' }, - { "retry-failed", 0, NULL, 'F' }, - { "socket", 1, NULL, 'o' }, - { "help", 0, NULL, 'h' }, - { "action", 1, NULL, 'c' }, - { "subsystem-match", 1, NULL, 's' }, - { "subsystem-nomatch", 1, NULL, 'S' }, - { "attr-match", 1, NULL, 'a' }, - { "attr-nomatch", 1, NULL, 'A' }, - { "env", 1, NULL, 'e' }, - {} - }; - - logging_init("udevtrigger"); - udev_config_init(); - dbg("version %s\n", VERSION); - sysfs_init(); - - while (1) { - option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'v': - verbose = 1; - break; - case 'n': - dry_run = 1; - break; - case 'F': - failed = 1; - break; - case 'o': - sockpath = optarg; - break; - case 'c': - action = optarg; - break; - case 'e': - if (strchr(optarg, '=') != NULL) - env = optarg; - break; - case 's': - name_list_add(&filter_subsystem_match_list, optarg, 0); - break; - case 'S': - name_list_add(&filter_subsystem_nomatch_list, optarg, 0); - break; - case 'a': - name_list_add(&filter_attr_match_list, optarg, 0); - break; - case 'A': - name_list_add(&filter_attr_nomatch_list, optarg, 0); - break; - case 'h': - printf("Usage: udevadm trigger OPTIONS\n" - " --verbose print the list of devices while running\n" - " --dry-run do not actually trigger the events\n" - " --retry-failed trigger only the events which have been\n" - " marked as failed during a previous run\n" - " --socket= pass events to socket instead of triggering kernel events\n" - " --env== pass an additional key (works only with --socket=)\n" - " --subsystem-match= trigger devices from a matching subystem\n" - " --subsystem-nomatch= exclude devices from a matching subystem\n" - " --attr-match=]> trigger devices with a matching sysfs\n" - " attribute\n" - " --attr-nomatch=]> exclude devices with a matching sysfs\n" - " attribute\n" - " --help print this text\n" - "\n"); - goto exit; - default: - goto exit; - } - } - - if (sockpath != NULL) { - struct stat stats; - - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - if (sockpath[0] == '@') { - /* abstract namespace socket requested */ - strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { - /* existing socket file */ - strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); - saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); - } else { - /* no socket file, assume abstract namespace socket */ - strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } - } else if (env != NULL) { - fprintf(stderr, "error: --env= only valid with --socket= option\n"); - goto exit; - } - - if (failed) { - scan_failed(); - exec_list(action, env); - } else { - char base[PATH_SIZE]; - struct stat statbuf; - - /* if we have /sys/subsystem, forget all the old stuff */ - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/subsystem", sizeof(base)); - if (stat(base, &statbuf) == 0) { - scan_subsystem("subsystem", SCAN_SUBSYSTEM); - exec_list(action, env); - scan_subsystem("subsystem", SCAN_DEVICES); - exec_list(action, env); - } else { - scan_subsystem("bus", SCAN_SUBSYSTEM); - exec_list(action, env); - scan_subsystem("bus", SCAN_DEVICES); - scan_class(); - - /* scan "block" if it isn't a "class" */ - strlcpy(base, sysfs_path, sizeof(base)); - strlcat(base, "/class/block", sizeof(base)); - if (stat(base, &statbuf) != 0) - scan_block(); - exec_list(action, env); - } - } - -exit: - name_list_cleanup(&filter_subsystem_match_list); - name_list_cleanup(&filter_subsystem_nomatch_list); - name_list_cleanup(&filter_attr_match_list); - name_list_cleanup(&filter_attr_nomatch_list); - - if (sock >= 0) - close(sock); - sysfs_cleanup(); - logging_close(); - return 0; -} -- cgit v1.2.3-54-g00ecf From 32bf83996b1f7d7df83f99e6bf063685146ffe06 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 3 Sep 2008 23:38:32 +0200 Subject: udevadm: rename internal functions to udevadm_* --- udev/udev.h | 14 +++++++------- udev/udevadm-control.c | 2 +- udev/udevadm-info.c | 2 +- udev/udevadm-monitor.c | 2 +- udev/udevadm-settle.c | 2 +- udev/udevadm-test.c | 2 +- udev/udevadm-trigger.c | 2 +- udev/udevadm.c | 12 ++++++------ 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/udev/udev.h b/udev/udev.h index da86365056..6005cd2a06 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -167,12 +167,12 @@ extern void file_unmap(void *buf, size_t bufsize); extern int unlink_secure(const char *filename); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); -/* udev commands */ -extern int udevmonitor(int argc, char *argv[]); -extern int udevinfo(int argc, char *argv[]); -extern int udevcontrol(int argc, char *argv[]); -extern int udevtrigger(int argc, char *argv[]); -extern int udevsettle(int argc, char *argv[]); -extern int udevtest(int argc, char *argv[]); +/* udevadm commands */ +extern int udevadm_monitor(int argc, char *argv[]); +extern int udevadm_info(int argc, char *argv[]); +extern int udevadm_control(int argc, char *argv[]); +extern int udevadm_trigger(int argc, char *argv[]); +extern int udevadm_settle(int argc, char *argv[]); +extern int udevadm_test(int argc, char *argv[]); #endif diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 5f1952543c..68548fd1fa 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -148,7 +148,7 @@ int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count) return 0; } -int udevcontrol(int argc, char *argv[]) +int udevadm_control(int argc, char *argv[]) { struct udev_ctrl *uctrl; const char *env; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 6501b57d1a..1f47b89952 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -234,7 +234,7 @@ static int stat_device(const char *name, int export, const char *prefix) return 0; } -int udevinfo(int argc, char *argv[]) +int udevadm_info(int argc, char *argv[]) { int option; struct udevice *udev = NULL; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 3b65bcae9b..a45f165cfe 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -123,7 +123,7 @@ static const char *search_key(const char *searchkey, const char *buf, size_t buf return NULL; } -int udevmonitor(int argc, char *argv[]) +int udevadm_monitor(int argc, char *argv[]) { struct sigaction act; int option; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 11277f5a43..0cb9ece472 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -67,7 +67,7 @@ static void print_queue(const char *dir) printf("\n\n"); } -int udevsettle(int argc, char *argv[]) +int udevadm_settle(int argc, char *argv[]) { char queuename[PATH_SIZE]; char filename[PATH_SIZE]; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 63603aad97..291f7e934f 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -71,7 +71,7 @@ out: return rc; } -int udevtest(int argc, char *argv[]) +int udevadm_test(int argc, char *argv[]) { int force = 0; const char *action = "add"; diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 4a8f62ab5c..322040582e 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -562,7 +562,7 @@ static void scan_failed(void) } } -int udevtrigger(int argc, char *argv[]) +int udevadm_trigger(int argc, char *argv[]) { int failed = 0; const char *sockpath = NULL; diff --git a/udev/udevadm.c b/udev/udevadm.c index 863bc467f0..aa0befed3b 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -76,32 +76,32 @@ static int help(int argc, char *argv[]) static const struct command cmds[] = { { .name = "info", - .cmd = udevinfo, + .cmd = udevadm_info, .help = "query sysfs or the udev database", }, { .name = "trigger", - .cmd = udevtrigger, + .cmd = udevadm_trigger, .help = "request events from the kernel", }, { .name = "settle", - .cmd = udevsettle, "", + .cmd = udevadm_settle, "", .help = "wait for the event queue to finish", }, { .name = "control", - .cmd = udevcontrol, + .cmd = udevadm_control, .help = "control the udev daemon", }, { .name = "monitor", - .cmd = udevmonitor, + .cmd = udevadm_monitor, .help = "listen to kernel and udev events", }, { .name = "test", - .cmd = udevtest, + .cmd = udevadm_test, .help = "simulation run", .debug = 1, }, -- cgit v1.2.3-54-g00ecf From 8a3c06af21bbbe21d2517247ade2f0f9ae6ef432 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 3 Sep 2008 23:48:44 +0200 Subject: udevadm: split out control functions --- udev/Makefile.am | 1 + udev/udev-control.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++++ udev/udev.h | 12 +++++ udev/udevadm-control.c | 112 ----------------------------------------- 4 files changed, 146 insertions(+), 112 deletions(-) create mode 100644 udev/udev-control.c diff --git a/udev/Makefile.am b/udev/Makefile.am index d123c0b3fd..450c9489b4 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -54,6 +54,7 @@ udevd_LDADD = \ udevadm_SOURCES = \ $(common_files) \ + udev-control.c \ udevadm.c \ udevadm-info.c \ udevadm-control.c \ diff --git a/udev/udev-control.c b/udev/udev-control.c new file mode 100644 index 0000000000..4e339ff483 --- /dev/null +++ b/udev/udev-control.c @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2005-2008 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udevd.h" + +struct udev_ctrl { + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; +}; + +struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path) +{ + struct udev_ctrl *uctrl; + + uctrl = malloc(sizeof(struct udev_ctrl)); + if (uctrl == NULL) + return NULL; + memset(uctrl, 0x00, sizeof(struct udev_ctrl)); + + uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (uctrl->sock < 0) { + err("error getting socket: %s\n", strerror(errno)); + free(uctrl); + return NULL; + } + + uctrl->saddr.sun_family = AF_LOCAL; + strcpy(uctrl->saddr.sun_path, socket_path); + uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); + /* translate leading '@' to abstract namespace */ + if (uctrl->saddr.sun_path[0] == '@') + uctrl->saddr.sun_path[0] = '\0'; + return uctrl; +} + +void udev_ctrl_unref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return; + close(uctrl->sock); +} + +static int ctrl_send(struct udev_ctrl *uctrl, enum udevd_ctrl_msg_type type, int intval, const char *buf) +{ + struct udevd_ctrl_msg ctrl_msg; + int err; + + memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); + strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); + ctrl_msg.type = type; + + if (buf != NULL) + strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); + else + ctrl_msg.intval = intval; + + err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err == -1) { + err("error sending message: %s\n", strerror(errno)); + } + return err; +} + +int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority) +{ + ctrl_send(uctrl, UDEVD_CTRL_SET_LOG_LEVEL, priority, NULL); + return 0; +} + +int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEVD_CTRL_STOP_EXEC_QUEUE, 0, NULL); + return 0; +} + +int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEVD_CTRL_START_EXEC_QUEUE, 0, NULL); + return 0; +} + +int udev_ctrl_reload_rules(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEVD_CTRL_RELOAD_RULES, 0, NULL); + return 0; +} + +int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key) +{ + ctrl_send(uctrl, UDEVD_CTRL_ENV, 0, optarg); + return 0; +} + +int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count) +{ + ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS, count, NULL); + return 0; +} + +int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count) +{ + ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, count, NULL); + return 0; +} diff --git a/udev/udev.h b/udev/udev.h index 6005cd2a06..00f2fd8282 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -175,4 +175,16 @@ extern int udevadm_trigger(int argc, char *argv[]); extern int udevadm_settle(int argc, char *argv[]); extern int udevadm_test(int argc, char *argv[]); +/* udev_ctrl - daemon runtime setup */ +struct udev_ctrl; +extern struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path); +extern void udev_ctrl_unref(struct udev_ctrl *uctrl); +extern int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority); +extern int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl); +extern int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl); +extern int udev_ctrl_reload_rules(struct udev_ctrl *uctrl); +extern int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key); +extern int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count); +extern int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count); + #endif diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 68548fd1fa..de4b658d5b 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -36,118 +36,6 @@ static int udev_log = 0; -struct udev_ctrl; -extern struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path); -extern void udev_ctrl_unref(struct udev_ctrl *uctrl); -extern int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority); -extern int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl); -extern int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl); -extern int udev_ctrl_reload_rules(struct udev_ctrl *uctrl); -extern int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key); -extern int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count); -extern int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count); - -struct udev_ctrl { - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; -}; - -struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path) -{ - struct udev_ctrl *uctrl; - - uctrl = malloc(sizeof(struct udev_ctrl)); - if (uctrl == NULL) - return NULL; - memset(uctrl, 0x00, sizeof(struct udev_ctrl)); - - uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (uctrl->sock < 0) { - err("error getting socket: %s\n", strerror(errno)); - free(uctrl); - return NULL; - } - - uctrl->saddr.sun_family = AF_LOCAL; - strcpy(uctrl->saddr.sun_path, socket_path); - uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); - /* translate leading '@' to abstract namespace */ - if (uctrl->saddr.sun_path[0] == '@') - uctrl->saddr.sun_path[0] = '\0'; - return uctrl; -} - -void udev_ctrl_unref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return; - close(uctrl->sock); -} - -static int ctrl_send(struct udev_ctrl *uctrl, enum udevd_ctrl_msg_type type, int intval, const char *buf) -{ - struct udevd_ctrl_msg ctrl_msg; - int err; - - memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); - strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); - ctrl_msg.type = type; - - if (buf != NULL) - strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); - else - ctrl_msg.intval = intval; - - err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err == -1) { - err("error sending message: %s\n", strerror(errno)); - } - return err; -} - -int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority) -{ - ctrl_send(uctrl, UDEVD_CTRL_SET_LOG_LEVEL, priority, NULL); - return 0; -} - -int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl) -{ - ctrl_send(uctrl, UDEVD_CTRL_STOP_EXEC_QUEUE, 0, NULL); - return 0; -} - -int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl) -{ - ctrl_send(uctrl, UDEVD_CTRL_START_EXEC_QUEUE, 0, NULL); - return 0; -} - -int udev_ctrl_reload_rules(struct udev_ctrl *uctrl) -{ - ctrl_send(uctrl, UDEVD_CTRL_RELOAD_RULES, 0, NULL); - return 0; -} - -int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key) -{ - ctrl_send(uctrl, UDEVD_CTRL_ENV, 0, optarg); - return 0; -} - -int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count) -{ - ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS, count, NULL); - return 0; -} - -int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count) -{ - ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, count, NULL); - return 0; -} - int udevadm_control(int argc, char *argv[]) { struct udev_ctrl *uctrl; -- cgit v1.2.3-54-g00ecf From 60865f33a1fee5bddc8add3963f44691996d2ceb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Sep 2008 10:34:48 +0200 Subject: udevadm: move init from commands to udevadm --- udev/udevadm-info.c | 6 ------ udev/udevadm-settle.c | 5 ----- udev/udevadm-test.c | 3 --- udev/udevadm-trigger.c | 5 ----- udev/udevadm.c | 6 ++++++ 5 files changed, 6 insertions(+), 19 deletions(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 1f47b89952..fdf53d2ab5 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -279,10 +279,6 @@ int udevadm_info(int argc, char *argv[]) struct name_entry *name_loop; int rc = 0; - logging_init("udevinfo"); - udev_config_init(); - sysfs_init(); - while (1) { option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); if (option == -1) @@ -501,7 +497,5 @@ int udevadm_info(int argc, char *argv[]) exit: udev_device_cleanup(udev); - sysfs_cleanup(); - logging_close(); return rc; } diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 0cb9ece472..3a886469ad 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -87,10 +87,7 @@ int udevadm_settle(int argc, char *argv[]) int rc = 1; int seconds; - logging_init("udevsettle"); - udev_config_init(); dbg("version %s\n", VERSION); - sysfs_init(); while (1) { option = getopt_long(argc, argv, "t:h", options, NULL); @@ -172,7 +169,5 @@ int udevadm_settle(int argc, char *argv[]) } exit: - sysfs_cleanup(); - logging_close(); return rc; } diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 291f7e934f..d06249c6c1 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -92,7 +92,6 @@ int udevadm_test(int argc, char *argv[]) }; info("version %s\n", VERSION); - udev_config_init(); if (udev_log_priority < LOG_INFO) { char priority[32]; @@ -143,7 +142,6 @@ int udevadm_test(int argc, char *argv[]) "some values may be different, or not available at a simulation run.\n" "\n"); - sysfs_init(); udev_rules_init(&rules, 0); /* remove /sys if given */ @@ -202,6 +200,5 @@ int udevadm_test(int argc, char *argv[]) exit: udev_rules_cleanup(&rules); - sysfs_cleanup(); return rc; } diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 322040582e..04d8f79ba1 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -584,10 +584,7 @@ int udevadm_trigger(int argc, char *argv[]) {} }; - logging_init("udevtrigger"); - udev_config_init(); dbg("version %s\n", VERSION); - sysfs_init(); while (1) { option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL); @@ -710,7 +707,5 @@ exit: if (sock >= 0) close(sock); - sysfs_cleanup(); - logging_close(); return 0; } diff --git a/udev/udevadm.c b/udev/udevadm.c index aa0befed3b..047365d973 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -125,6 +125,10 @@ int main(int argc, char *argv[]) const char *pos; int rc; + logging_init("udevadm"); + udev_config_init(); + sysfs_init(); + /* find command */ if (command != NULL) for (i = 0; cmds[i].cmd != NULL; i++) { @@ -169,5 +173,7 @@ int main(int argc, char *argv[]) fprintf(stderr, "unknown command, try help\n\n"); rc = 2; out: + sysfs_cleanup(); + logging_close(); return rc; } -- cgit v1.2.3-54-g00ecf From cf8ec631a23eae532541bfeeccce20f0d978404d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Sep 2008 15:22:19 +0200 Subject: autogen.sh: add debug --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 4532e870bc..b6db9f919c 100755 --- a/autogen.sh +++ b/autogen.sh @@ -42,7 +42,7 @@ echo " automake: $(automake --version | head -1)" automake --add-missing if test -z "$@"; then - args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux" + args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux --enable-debug" args="$args --with-libdir-name=$(basename $(gcc -print-multi-os-directory))" export CFLAGS="-g -Wall \ -Wmissing-declarations -Wmissing-prototypes \ -- cgit v1.2.3-54-g00ecf From 7d563a17f3967890331daf08d43f2f005418139b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Sep 2008 15:45:31 +0200 Subject: use libudev code, unify logging, pass udev context around everywhere --- extras/ata_id/Makefile.am | 6 +- extras/ata_id/ata_id.c | 41 +-- extras/cdrom_id/Makefile.am | 6 +- extras/cdrom_id/cdrom_id.c | 187 +++++----- extras/edd_id/Makefile.am | 6 +- extras/edd_id/edd_id.c | 59 ++- extras/floppy/Makefile.am | 7 +- extras/floppy/create_floppy_devices.c | 47 +-- extras/fstab_import/79-fstab_import.rules | 2 +- extras/fstab_import/Makefile.am | 6 +- extras/fstab_import/fstab_import.c | 91 +++-- extras/scsi_id/Makefile.am | 6 +- extras/scsi_id/scsi_id.c | 96 +++-- extras/scsi_id/scsi_id.h | 4 +- extras/scsi_id/scsi_serial.c | 191 +++++----- extras/usb_id/Makefile.am | 5 +- extras/usb_id/usb_id.c | 91 ++--- extras/volume_id/Makefile.am | 6 +- extras/volume_id/vol_id.c | 44 +-- udev/Makefile.am | 10 +- udev/lib/Makefile.am | 1 - udev/lib/exported_symbols | 2 + udev/lib/libudev-device.c | 24 +- udev/lib/libudev-enumerate.c | 8 +- udev/lib/libudev-monitor.c | 18 +- udev/lib/libudev-private.h | 28 +- udev/lib/libudev.c | 216 +++++++++-- udev/lib/libudev.h | 4 + udev/logging.h | 75 ---- udev/test-udev.c | 75 ++-- udev/udev-control.c | 8 +- udev/udev.h | 109 +++--- udev/udev_config.c | 200 ---------- udev/udev_db.c | 144 ++++---- udev/udev_device.c | 46 +-- udev/udev_device_event.c | 144 ++++---- udev/udev_node.c | 233 ++++++------ udev/udev_rules.c | 594 +++++++++++++++--------------- udev/udev_rules.h | 3 +- udev/udev_rules_parse.c | 181 ++++----- udev/udev_selinux.c | 50 +-- udev/udev_selinux.h | 20 +- udev/udev_sysfs.c | 106 +++--- udev/udev_utils.c | 38 +- udev/udev_utils_file.c | 26 +- udev/udev_utils_string.c | 2 + udev/udevadm-control.c | 22 +- udev/udevadm-info.c | 150 ++++---- udev/udevadm-monitor.c | 24 +- udev/udevadm-settle.c | 30 +- udev/udevadm-test.c | 67 ++-- udev/udevadm-trigger.c | 132 +++---- udev/udevadm.c | 113 ++++-- udev/udevadm.xml | 2 +- udev/udevd.c | 314 ++++++++-------- udev/udevd.h | 17 - 56 files changed, 2005 insertions(+), 2132 deletions(-) delete mode 100644 udev/logging.h delete mode 100644 udev/udev_config.c diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index 81332dd3f6..7e7fd2b7ab 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -4,10 +4,14 @@ udevhome_PROGRAMS = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION ata_id_SOURCES = \ ata_id.c \ + ../../udev/lib/libudev.h \ + ../../udev/lib/libudev.c \ + ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 125c3f3dd7..43d9516a19 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -1,7 +1,7 @@ /* * ata_id - reads product/serial number from ATA drives * - * Copyright (C) 2005 Kay Sievers + * Copyright (C) 2005-2008 Kay Sievers * * 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 @@ -28,30 +28,12 @@ #include "../../udev/udev.h" -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) { - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); vsyslog(priority, format, args); - va_end(args); } -#endif static void set_str(char *to, const char *from, size_t count) { @@ -87,6 +69,7 @@ static void set_str(char *to, const char *from, size_t count) int main(int argc, char *argv[]) { + struct udev *udev; struct hd_driveid id; char model[41]; char serial[21]; @@ -101,7 +84,12 @@ int main(int argc, char *argv[]) {} }; + udev = udev_new(); + if (udev == NULL) + goto exit; + logging_init("ata_id"); + udev_set_log_fn(udev, log_fn); while (1) { int option; @@ -126,24 +114,24 @@ int main(int argc, char *argv[]) node = argv[optind]; if (node == NULL) { - err("no node specified\n"); + err(udev, "no node specified\n"); rc = 1; goto exit; } fd = open(node, O_RDONLY|O_NONBLOCK); if (fd < 0) { - err("unable to open '%s'\n", node); + err(udev, "unable to open '%s'\n", node); rc = 1; goto exit; } if (ioctl(fd, HDIO_GET_IDENTITY, &id)) { if (errno == ENOTTY) { - info("HDIO_GET_IDENTITY unsupported for '%s'\n", node); + info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); rc = 2; } else { - err("HDIO_GET_IDENTITY failed for '%s'\n", node); + err(udev, "HDIO_GET_IDENTITY failed for '%s'\n", node); rc = 3; } goto close; @@ -190,6 +178,7 @@ int main(int argc, char *argv[]) close: close(fd); exit: + udev_unref(udev); logging_close(); return rc; } diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index 88de1379cd..dfc98850e0 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -8,10 +8,14 @@ dist_udevrules_DATA = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION cdrom_id_SOURCES = \ cdrom_id.c \ + ../../udev/lib/libudev.h \ + ../../udev/lib/libudev.c \ + ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 9e27471863..dbe80ea7e3 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -46,37 +46,17 @@ static int debug; -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) { - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - - if (debug && udev_log < LOG_INFO) - udev_log = LOG_INFO; - } - - if (priority > udev_log) - return; - - va_start(args, format); if (debug) { - fprintf(stderr, "[%d] ", (int) getpid()); + fprintf(stderr, "%s: ", fn); vfprintf(stderr, format, args); - } else + } else { vsyslog(priority, format, args); - va_end(args); + } } -#endif /* device info */ static unsigned int cd_cd_rom; @@ -135,13 +115,13 @@ static unsigned long long int cd_media_session_last_offset; #define ASC(errcode) (((errcode) >> 8) & 0xFF) #define ASCQ(errcode) ((errcode) & 0xFF) -static void info_scsi_cmd_err(const char *cmd, int err) +static void info_scsi_cmd_err(struct udev *udev, char *cmd, int err) { if (err == -1) { - info("%s failed\n", cmd); + info(udev, "%s failed\n", cmd); return; } - info("%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); + info(udev, "%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); } struct scsi_cmd { @@ -153,7 +133,7 @@ struct scsi_cmd { struct sg_io_hdr sg_io; }; -static void scsi_cmd_set(struct scsi_cmd *cmd, size_t i, int arg) +static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, int arg) { if (i == 0) { memset(cmd, 0x00, sizeof(struct scsi_cmd)); @@ -172,7 +152,7 @@ static void scsi_cmd_set(struct scsi_cmd *cmd, size_t i, int arg) #define CHECK_CONDITION 0x01 -static int scsi_cmd_run(struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize) +static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize) { int ret = 0; @@ -194,13 +174,13 @@ static int scsi_cmd_run(struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t return ret; } -static int cd_capability_compat(int fd) +static int cd_capability_compat(struct udev *udev, int fd) { int capabilty; capabilty = ioctl(fd, CDROM_GET_CAPABILITY, NULL); if (capabilty < 0) { - info("CDROM_GET_CAPABILITY failed\n"); + info(udev, "CDROM_GET_CAPABILITY failed\n"); return -1; } @@ -221,30 +201,30 @@ static int cd_capability_compat(int fd) return 0; } -static int cd_inquiry(int fd) { +static int cd_inquiry(struct udev *udev, int fd) { struct scsi_cmd sc; unsigned char inq[128]; int err; - scsi_cmd_set(&sc, 0, 0x12); - scsi_cmd_set(&sc, 4, 36); - scsi_cmd_set(&sc, 5, 0); - err = scsi_cmd_run(&sc, fd, inq, 36); + scsi_cmd_set(udev, &sc, 0, 0x12); + scsi_cmd_set(udev, &sc, 4, 36); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, inq, 36); if ((err < 0)) { - info_scsi_cmd_err("INQUIRY", err); + info_scsi_cmd_err(udev, "INQUIRY", err); return -1; } if ((inq[0] & 0x1F) != 5) { - info("not an MMC unit\n"); + info(udev, "not an MMC unit\n"); return -1; } - info("INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); + info(udev, "INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); return 0; } -static int cd_profiles(int fd) +static int cd_profiles(struct udev *udev, int fd) { struct scsi_cmd sc; unsigned char header[8]; @@ -254,32 +234,32 @@ static int cd_profiles(int fd) unsigned int i; int err; - scsi_cmd_set(&sc, 0, 0x46); - scsi_cmd_set(&sc, 1, 0); - scsi_cmd_set(&sc, 8, sizeof(header)); - scsi_cmd_set(&sc, 9, 0); - err = scsi_cmd_run(&sc, fd, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 1, 0); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err < 0)) { - info_scsi_cmd_err("GET CONFIGURATION", err); + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); return -1; } len = 4 + (header[0] << 24 | header[1] << 16 | header[2] << 8 | header[3]); - info("GET CONFIGURATION: number of profiles %i\n", len); + info(udev, "GET CONFIGURATION: number of profiles %i\n", len); if (len > sizeof(profiles)) { - info("invalid number of profiles\n"); + info(udev, "invalid number of profiles\n"); return -1; } - scsi_cmd_set(&sc, 0, 0x46); - scsi_cmd_set(&sc, 1, 1); - scsi_cmd_set(&sc, 6, len >> 16); - scsi_cmd_set(&sc, 7, len >> 8); - scsi_cmd_set(&sc, 8, len); - scsi_cmd_set(&sc, 9, 0); - err = scsi_cmd_run(&sc, fd, profiles, len); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 1, 1); + scsi_cmd_set(udev, &sc, 6, len >> 16); + scsi_cmd_set(udev, &sc, 7, len >> 8); + scsi_cmd_set(udev, &sc, 8, len); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, profiles, len); if ((err < 0)) { - info_scsi_cmd_err("GET CONFIGURATION", err); + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); return -1; } @@ -288,7 +268,7 @@ static int cd_profiles(int fd) unsigned int profile = (profiles[i] << 8 | profiles[i + 1]); if (profile == 0) continue; - info("profile 0x%02x\n", profile); + info(udev, "profile 0x%02x\n", profile); switch (profile) { case 0x03: @@ -344,9 +324,9 @@ static int cd_profiles(int fd) /* current media profile */ cur_profile = header[6] << 8 | header[7]; - info("current profile 0x%02x\n", cur_profile); + info(udev, "current profile 0x%02x\n", cur_profile); if (cur_profile == 0) { - info("no current profile, assuming no media\n"); + info(udev, "no current profile, assuming no media\n"); return -1; } @@ -415,7 +395,7 @@ static int cd_profiles(int fd) return 0; } -static int cd_media_info(int fd) +static int cd_media_info(struct udev *udev, int fd) { struct scsi_cmd sc; unsigned char header[32]; @@ -427,16 +407,16 @@ static int cd_media_info(int fd) }; int err; - scsi_cmd_set(&sc, 0, 0x51); - scsi_cmd_set(&sc, 8, sizeof(header)); - scsi_cmd_set(&sc, 9, 0); - err = scsi_cmd_run(&sc, fd, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err < 0)) { - info_scsi_cmd_err("READ DISC INFORMATION", err); + info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); return -1; }; - info("disk type %02x\n", header[8]); + info(udev, "disk type %02x\n", header[8]); if ((header[2] & 3) < 4) cd_media_state = media_status[header[2] & 3]; @@ -448,7 +428,7 @@ static int cd_media_info(int fd) return 0; } -static int cd_media_toc(int fd) +static int cd_media_toc(struct udev *udev, int fd) { struct scsi_cmd sc; unsigned char header[12]; @@ -457,18 +437,18 @@ static int cd_media_toc(int fd) unsigned char *p; int err; - scsi_cmd_set(&sc, 0, 0x43); - scsi_cmd_set(&sc, 6, 1); - scsi_cmd_set(&sc, 8, sizeof(header)); - scsi_cmd_set(&sc, 9, 0); - err = scsi_cmd_run(&sc, fd, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, 1); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err < 0)) { - info_scsi_cmd_err("READ TOC", err); + info_scsi_cmd_err(udev, "READ TOC", err); return -1; } len = (header[0] << 8 | header[1]) + 2; - info("READ TOC: len: %d\n", len); + info(udev, "READ TOC: len: %d\n", len); if (len > sizeof(toc)) return -1; if (len < 2) @@ -478,14 +458,14 @@ static int cd_media_toc(int fd) if (len < 8) return 0; - scsi_cmd_set(&sc, 0, 0x43); - scsi_cmd_set(&sc, 6, header[2]); /* First Track/Session Number */ - scsi_cmd_set(&sc, 7, len >> 8); - scsi_cmd_set(&sc, 8, len); - scsi_cmd_set(&sc, 9, 0); - err = scsi_cmd_run(&sc, fd, toc, len); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ + scsi_cmd_set(udev, &sc, 7, len >> 8); + scsi_cmd_set(udev, &sc, 8, len); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, toc, len); if ((err < 0)) { - info_scsi_cmd_err("READ TOC (tracks)", err); + info_scsi_cmd_err(udev, "READ TOC (tracks)", err); return -1; } @@ -496,7 +476,7 @@ static int cd_media_toc(int fd) is_data_track = (p[1] & 0x04) != 0; block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; - info("track=%u info=0x%x(%s) start_block=%u\n", + info(udev, "track=%u info=0x%x(%s) start_block=%u\n", p[2], p[1] & 0x0f, is_data_track ? "data":"audio", block); if (is_data_track) @@ -505,23 +485,24 @@ static int cd_media_toc(int fd) cd_media_track_count_audio++; } - scsi_cmd_set(&sc, 0, 0x43); - scsi_cmd_set(&sc, 2, 1); /* Session Info */ - scsi_cmd_set(&sc, 8, 12); - scsi_cmd_set(&sc, 9, 0); - err = scsi_cmd_run(&sc, fd, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ + scsi_cmd_set(udev, &sc, 8, 12); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err < 0)) { - info_scsi_cmd_err("READ TOC (multi session)", err); + info_scsi_cmd_err(udev, "READ TOC (multi session)", err); return -1; } len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; - info("last track %u starts at block %u\n", header[4+2], len); + info(udev, "last track %u starts at block %u\n", header[4+2], len); cd_media_session_last_offset = (unsigned long long int)len * 2048; return 0; } int main(int argc, char *argv[]) { + struct udev *udev; static const struct option options[] = { { "export", 0, NULL, 'x' }, { "debug", 0, NULL, 'd' }, @@ -533,7 +514,12 @@ int main(int argc, char *argv[]) int fd = -1; int rc = 0; + udev = udev_new(); + if (udev == NULL) + goto exit; + logging_init("cdrom_id"); + udev_set_log_fn(udev, log_fn); while (1) { int option; @@ -545,6 +531,8 @@ int main(int argc, char *argv[]) switch (option) { case 'd': debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); break; case 'x': export = 1; @@ -563,7 +551,7 @@ int main(int argc, char *argv[]) node = argv[optind]; if (!node) { - err("no device\n"); + err(udev, "no device\n"); fprintf(stderr, "no device\n"); rc = 1; goto exit; @@ -571,34 +559,34 @@ int main(int argc, char *argv[]) fd = open(node, O_RDONLY | O_NONBLOCK); if (fd < 0) { - info("unable to open '%s'\n", node); + info(udev, "unable to open '%s'\n", node); rc = 1; goto exit; } - info("probing: '%s'\n", node); + info(udev, "probing: '%s'\n", node); /* same data as original cdrom_id */ - if (cd_capability_compat(fd) < 0) { + if (cd_capability_compat(udev, fd) < 0) { rc = 1; goto exit; } /* check drive */ - if (cd_inquiry(fd) < 0) { + if (cd_inquiry(udev, fd) < 0) { rc = 2; goto exit; } /* read drive and possibly current profile */ - if (cd_profiles(fd) < 0) + if (cd_profiles(udev, fd) < 0) goto print; /* get session/track info */ - if (cd_media_toc(fd) < 0) + if (cd_media_toc(udev, fd) < 0) goto print; /* get writable media state */ - if (cd_media_info(fd) < 0) + if (cd_media_info(udev, fd) < 0) goto print; print: @@ -702,6 +690,7 @@ print: exit: if (fd >= 0) close(fd); + udev_unref(udev); logging_close(); return rc; } diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index fa4f18c9fb..cc693967ca 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -8,10 +8,14 @@ dist_udevrules_DATA = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION edd_id_SOURCES = \ edd_id.c \ + ../../udev/lib/libudev.h \ + ../../udev/lib/libudev.c \ + ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 9d745c505a..b53700e756 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -25,33 +25,16 @@ #include "../../udev/udev.h" -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) { - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); vsyslog(priority, format, args); - va_end(args); } -#endif int main(int argc, char *argv[]) { + struct udev *udev; const char *node = NULL; int i; int export = 0; @@ -64,7 +47,12 @@ int main(int argc, char *argv[]) int rc = 1; char match[NAME_MAX] = ""; + udev = udev_new(); + if (udev == NULL) + goto exit; + logging_init("edd_id"); + udev_set_log_fn(udev, log_fn); for (i = 1 ; i < argc; i++) { char *arg = argv[i]; @@ -75,7 +63,7 @@ int main(int argc, char *argv[]) node = arg; } if (node == NULL) { - err("no node specified\n"); + err(udev, "no node specified\n"); fprintf(stderr, "no node specified\n"); goto exit; } @@ -83,7 +71,7 @@ int main(int argc, char *argv[]) /* check for kernel support */ dir = opendir("/sys/firmware/edd"); if (dir == NULL) { - info("no kernel EDD support\n"); + info(udev, "no kernel EDD support\n"); fprintf(stderr, "no kernel EDD support\n"); rc = 2; goto exit; @@ -91,7 +79,7 @@ int main(int argc, char *argv[]) disk_fd = open(node, O_RDONLY); if (disk_fd < 0) { - info("unable to open '%s'\n", node); + info(udev, "unable to open '%s'\n", node); fprintf(stderr, "unable to open '%s'\n", node); rc = 3; goto closedir; @@ -99,38 +87,38 @@ int main(int argc, char *argv[]) /* check for valid MBR signature */ if (lseek(disk_fd, 510, SEEK_SET) < 0) { - info("seek to MBR validity failed '%s'\n", node); + info(udev, "seek to MBR validity failed '%s'\n", node); rc = 4; goto close; } if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { - info("read MBR validity failed '%s'\n", node); + info(udev, "read MBR validity failed '%s'\n", node); rc = 5; goto close; } if (mbr_valid != 0xAA55) { fprintf(stderr, "no valid MBR signature '%s'\n", node); - info("no valid MBR signature '%s'\n", node); + info(udev, "no valid MBR signature '%s'\n", node); rc=6; goto close; } /* read EDD signature */ if (lseek(disk_fd, 440, SEEK_SET) < 0) { - info("seek to signature failed '%s'\n", node); + info(udev, "seek to signature failed '%s'\n", node); rc = 7; goto close; } if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { - info("read signature failed '%s'\n", node); + info(udev, "read signature failed '%s'\n", node); rc = 8; goto close; } /* all zero is invalid */ - info("read id 0x%08x from '%s'\n", disk_id, node); + info(udev, "read id 0x%08x from '%s'\n", disk_id, node); if (disk_id == 0) { fprintf(stderr, "no EDD signature '%s'\n", node); - info("'%s' signature is zero\n", node); + info(udev, "'%s' signature is zero\n", node); rc = 9; goto close; } @@ -150,18 +138,18 @@ int main(int argc, char *argv[]) sysfs_fd = open(file, O_RDONLY); if (sysfs_fd < 0) { - info("unable to open sysfs '%s'\n", file); + info(udev, "unable to open sysfs '%s'\n", file); continue; } size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); close(sysfs_fd); if (size <= 0) { - info("read sysfs '%s' failed\n", file); + info(udev, "read sysfs '%s' failed\n", file); continue; } sysfs_id_buf[size] = '\0'; - info("read '%s' from '%s'\n", sysfs_id_buf, file); + info(udev, "read '%s' from '%s'\n", sysfs_id_buf, file); sysfs_id = strtoul(sysfs_id_buf, NULL, 16); /* look for matching value, that appears only once */ @@ -171,7 +159,7 @@ int main(int argc, char *argv[]) strlcpy(match, dent->d_name, sizeof(match)); } else { /* error, same signature for another device */ - info("'%s' does not have a unique signature\n", node); + info(udev, "'%s' does not have a unique signature\n", node); fprintf(stderr, "'%s' does not have a unique signature\n", node); rc = 10; goto exit; @@ -192,6 +180,7 @@ close: closedir: closedir(dir); exit: + udev_unref(udev); logging_close(); return rc; } diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 4854d5245b..7879e7c2bd 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -4,11 +4,14 @@ udevhome_PROGRAMS = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION create_floppy_devices_SOURCES = \ create_floppy_devices.c \ - ../../udev/udev_config.c \ + ../../udev/lib/libudev.h \ + ../../udev/lib/libudev.c \ + ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c \ diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 3e73aa83c3..2c7d44b16d 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -41,33 +41,16 @@ static int t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 }; static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, 17, 21, 22, 30, 0 }; static int *table_sup[] = { NULL, t360, t1200, t3in+5+8, t3in+5, t3in, t3in }; -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) { - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); vsyslog(priority, format, args); - va_end(args); } -#endif int main(int argc, char **argv) { + struct udev *udev; char *dev; char *devname; char node[64]; @@ -80,6 +63,13 @@ int main(int argc, char **argv) int print_nodes = 0; int is_err = 0; + udev = udev_new(); + if (udev == NULL) + goto exit; + + logging_init("create_floppy_devices"); + udev_set_log_fn(udev, log_fn); + while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { switch (c) { case 'c': @@ -89,10 +79,10 @@ int main(int argc, char **argv) print_nodes = 1; break; case 'U': - uid = lookup_user(optarg); + uid = lookup_user(udev, optarg); break; case 'G': - gid = lookup_group(optarg); + gid = lookup_group(udev, optarg); break; case 'M': mode = strtol(optarg, NULL, 0); @@ -155,8 +145,7 @@ int main(int argc, char **argv) if (type == 0) return 0; - udev_config_init(); - selinux_init(); + selinux_init(udev); i = 0; while (table_sup[type][i]) { @@ -166,15 +155,17 @@ int main(int argc, char **argv) printf("%s b %d %d %d\n", node, mode, major, minor); if (create_nodes) { unlink(node); - selinux_setfscreatecon(node, NULL, S_IFBLK | mode); + selinux_setfscreatecon(udev, node, NULL, S_IFBLK | mode); mknod(node, S_IFBLK | mode, makedev(major,minor)); - selinux_resetfscreatecon(); + selinux_resetfscreatecon(udev); chown(node, uid, gid); chmod(node, S_IFBLK | mode); } i++; } - selinux_exit(); + selinux_exit(udev); + udev_unref(udev); +exit: return 0; } diff --git a/extras/fstab_import/79-fstab_import.rules b/extras/fstab_import/79-fstab_import.rules index ccd718c5f0..44accde482 100644 --- a/extras/fstab_import/79-fstab_import.rules +++ b/extras/fstab_import/79-fstab_import.rules @@ -1,2 +1,2 @@ -ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem|other", IMPORT="fstab_import --root=$root $name $links mapper/$env{DM_NAME}" +ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem|other", IMPORT="fstab_import $name $links mapper/$env{DM_NAME}" diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index 0ee7efb9ce..902ab1e28e 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -8,10 +8,14 @@ dist_udevrules_DATA = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION fstab_import_SOURCES = \ fstab_import.c \ + ../../udev/lib/libudev.h \ + ../../udev/lib/libudev.c \ + ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c index 2d24cfb38a..0f4685ae2a 100644 --- a/extras/fstab_import/fstab_import.c +++ b/extras/fstab_import/fstab_import.c @@ -13,6 +13,8 @@ #define _GNU_SOURCE 1 #endif +#include "config.h" + #include #include #include @@ -27,54 +29,32 @@ #include "../../udev/udev.h" static int debug; -static char root[PATH_SIZE] = "/dev"; -static char **devices; -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) { - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - - if (debug && udev_log < LOG_INFO) - udev_log = LOG_INFO; - } - - if (priority > udev_log) - return; - - va_start(args, format); if (debug) { - fprintf(stderr, "[%d] ", (int) getpid()); + fprintf(stderr, "%s: ", fn); vfprintf(stderr, format, args); - } else + } else { vsyslog(priority, format, args); - va_end(args); + } } -#endif -static int matches_device_list(const char *name) +static int matches_device_list(struct udev *udev, char **devices, const char *name) { int i; for (i = 0; devices[i] != NULL; i++) { - info("compare '%s' == '%s'\n", name, devices[i]); + info(udev, "compare '%s' == '%s'\n", name, devices[i]); if (strcmp(devices[i], name) == 0) return 1; } return 0; } -static void print_fstab_entry(struct mntent *mnt) +static void print_fstab_entry(struct udev *udev, struct mntent *mnt) { printf("FSTAB_NAME=%s\n", mnt->mnt_fsname); printf("FSTAB_DIR=%s\n", mnt->mnt_dir); @@ -86,42 +66,48 @@ static void print_fstab_entry(struct mntent *mnt) int main(int argc, char *argv[]) { + struct udev *udev; static const struct option options[] = { { "export", 0, NULL, 'x' }, - { "root", 1, NULL, 'r' }, { "debug", 0, NULL, 'd' }, { "help", 0, NULL, 'h' }, {} }; - + char **devices; FILE *fp; struct mntent *mnt; - int rc = 0; + int rc = 1; + + udev = udev_new(); + if (udev == NULL) + goto exit; logging_init("fstab_id"); + udev_set_log_fn(udev, log_fn); while (1) { int option; - option = getopt_long(argc, argv, "dr:xh", options, NULL); + option = getopt_long(argc, argv, "dxh", options, NULL); if (option == -1) break; switch (option) { - case 'r': - strlcpy(root, optarg, sizeof(root)); - break; case 'd': debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); break; case 'h': printf("Usage: fstab_id [OPTIONS] name [...]\n" " --export print environment keys\n" - " --root device node root (default /dev)\n" " --debug debug to stderr\n" " --help print this help text\n\n"); + goto exit; + case 'x': + break; default: - rc = 1; + rc = 2; goto exit; } } @@ -129,14 +115,14 @@ int main(int argc, char *argv[]) devices = &argv[optind]; if (devices[0] == NULL) { fprintf(stderr, "error: missing device(s) to match\n"); - rc = 2; + rc = 3; goto exit; } fp = setmntent ("/etc/fstab", "r"); if (fp == NULL) { fprintf(stderr, "error: opening fstab: %s\n", strerror(errno)); - rc = 2; + rc = 4; goto exit; } @@ -145,6 +131,8 @@ int main(int argc, char *argv[]) if (mnt == NULL) break; + info(udev, "found '%s'@'%s'\n", mnt->mnt_fsname, mnt->mnt_dir); + /* skip root device */ if (strcmp(mnt->mnt_dir, "/") == 0) continue; @@ -165,8 +153,9 @@ int main(int argc, char *argv[]) pos[0] = '\0'; label = str; } - if (matches_device_list(str)) { - print_fstab_entry(mnt); + if (matches_device_list(udev, devices, str)) { + print_fstab_entry(udev, mnt); + rc = 0; break; } continue; @@ -188,26 +177,28 @@ int main(int argc, char *argv[]) pos[0] = '\0'; uuid = str; } - if (matches_device_list(str)) { - print_fstab_entry(mnt); + if (matches_device_list(udev, devices, str)) { + print_fstab_entry(udev, mnt); + rc = 0; break; } continue; } /* only devices */ - if (strncmp(mnt->mnt_fsname, root, strlen(root)) != 0) + if (strncmp(mnt->mnt_fsname, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) continue; - if (matches_device_list(&mnt->mnt_fsname[strlen(root)+1])) { - print_fstab_entry(mnt); + if (matches_device_list(udev, devices, &mnt->mnt_fsname[strlen(udev_get_dev_path(udev))+1])) { + print_fstab_entry(udev, mnt); + rc = 0; break; } } - endmntent(fp); exit: + udev_unref(udev); logging_close(); return rc; } diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index 7f890b04cf..fc5c477820 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -4,7 +4,8 @@ udevhome_PROGRAMS = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION scsi_id_SOURCES = \ scsi_id.c \ @@ -12,6 +13,9 @@ scsi_id_SOURCES = \ scsi.h \ scsi_id.h \ bsg.h \ + ../../udev/lib/libudev.h \ + ../../udev/lib/libudev.c \ + ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 23bcb9468e..d692a86799 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -64,30 +64,12 @@ static char model_str[64]; static char revision_str[16]; static char type_str[16]; -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) { - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); vsyslog(priority, format, args); - va_end(args); } -#endif static void set_str(char *to, const char *from, size_t count) { @@ -215,7 +197,8 @@ static int argc_count(char *opts) * * vendor and model can end in '\n'. */ -static int get_file_options(const char *vendor, const char *model, +static int get_file_options(struct udev *udev, + const char *vendor, const char *model, int *argc, char ***newargv) { char *buffer; @@ -227,14 +210,14 @@ static int get_file_options(const char *vendor, const char *model, int c; int retval = 0; - dbg("vendor='%s'; model='%s'\n", vendor, model); + dbg(udev, "vendor='%s'; model='%s'\n", vendor, model); fd = fopen(config_file, "r"); if (fd == NULL) { - dbg("can't open %s\n", config_file); + dbg(udev, "can't open %s\n", config_file); if (errno == ENOENT) { return 1; } else { - err("can't open %s: %s\n", config_file, strerror(errno)); + err(udev, "can't open %s: %s\n", config_file, strerror(errno)); return -1; } } @@ -246,7 +229,7 @@ static int get_file_options(const char *vendor, const char *model, */ buffer = malloc(MAX_BUFFER_LEN); if (!buffer) { - err("can't allocate memory\n"); + err(udev, "can't allocate memory\n"); return -1; } @@ -260,7 +243,7 @@ static int get_file_options(const char *vendor, const char *model, break; lineno++; if (buf[strlen(buffer) - 1] != '\n') { - err("Config file line %d too long\n", lineno); + err(udev, "Config file line %d too long\n", lineno); break; } @@ -312,7 +295,7 @@ static int get_file_options(const char *vendor, const char *model, * Only allow: [vendor=foo[,model=bar]]options=stuff */ if (!options_in || (!vendor_in && model_in)) { - err("Error parsing config file line %d '%s'\n", lineno, buffer); + err(udev, "Error parsing config file line %d '%s'\n", lineno, buffer); retval = -1; break; } @@ -350,7 +333,7 @@ static int get_file_options(const char *vendor, const char *model, c = argc_count(buffer) + 2; *newargv = calloc(c, sizeof(**newargv)); if (!*newargv) { - err("can't allocate memory\n"); + err(udev, "can't allocate memory\n"); retval = -1; } else { *argc = c; @@ -375,7 +358,8 @@ static int get_file_options(const char *vendor, const char *model, return retval; } -static int set_options(int argc, char **argv, const char *short_opts, +static int set_options(struct udev *udev, + int argc, char **argv, const char *short_opts, char *maj_min_dev) { int option; @@ -392,9 +376,9 @@ static int set_options(int argc, char **argv, const char *short_opts, break; if (optarg) - dbg("option '%c' arg '%s'\n", option, optarg); + dbg(udev, "option '%c' arg '%s'\n", option, optarg); else - dbg("option '%c'\n", option); + dbg(udev, "option '%c'\n", option); switch (option) { case 'b': @@ -443,7 +427,7 @@ static int set_options(int argc, char **argv, const char *short_opts, } else if (strcmp(optarg, "pre-spc3-83") == 0) { default_page_code = PAGE_83_PRE_SPC3; } else { - err("Unknown page code '%s'\n", optarg); + err(udev, "Unknown page code '%s'\n", optarg); return -1; } break; @@ -451,7 +435,7 @@ static int set_options(int argc, char **argv, const char *short_opts, case 's': sg_version = atoi(optarg); if (sg_version < 3 || sg_version > 4) { - err("Unknown SG version '%s'\n", optarg); + err(udev, "Unknown SG version '%s'\n", optarg); return -1; } break; @@ -485,7 +469,8 @@ static int set_options(int argc, char **argv, const char *short_opts, return 0; } -static int per_dev_options(struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) +static int per_dev_options(struct udev *udev, + struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) { int retval; int newargc; @@ -495,7 +480,7 @@ static int per_dev_options(struct scsi_id_device *dev_scsi, int *good_bad, int * *good_bad = all_good; *page_code = default_page_code; - retval = get_file_options(vendor_str, model_str, &newargc, &newargv); + retval = get_file_options(udev, vendor_str, model_str, &newargc, &newargv); optind = 1; /* reset this global extern */ while (retval == 0) { @@ -504,9 +489,9 @@ static int per_dev_options(struct scsi_id_device *dev_scsi, int *good_bad, int * break; if (optarg) - dbg("option '%c' arg '%s'\n", option, optarg); + dbg(udev, "option '%c' arg '%s'\n", option, optarg); else - dbg("option '%c'\n", option); + dbg(udev, "option '%c'\n", option); switch (option) { case 'b': @@ -525,13 +510,13 @@ static int per_dev_options(struct scsi_id_device *dev_scsi, int *good_bad, int * } else if (strcmp(optarg, "pre-spc3-83") == 0) { *page_code = PAGE_83_PRE_SPC3; } else { - err("Unknown page code '%s'\n", optarg); + err(udev, "Unknown page code '%s'\n", optarg); retval = -1; } break; default: - err("Unknown or bad option '%c' (0x%x)\n", option, option); + err(udev, "Unknown or bad option '%c' (0x%x)\n", option, option); retval = -1; break; } @@ -544,13 +529,13 @@ static int per_dev_options(struct scsi_id_device *dev_scsi, int *good_bad, int * return retval; } -static int set_inq_values(struct scsi_id_device *dev_scsi, const char *path) +static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, const char *path) { int retval; dev_scsi->use_sg = sg_version; - retval = scsi_std_inquiry(dev_scsi, path); + retval = scsi_std_inquiry(udev, dev_scsi, path); if (retval) return retval; @@ -594,7 +579,7 @@ static void format_serial(char *serial) * memory etc. return 2, and return 1 for expected cases (like broken * device found) that do not print an id. */ -static int scsi_id(char *maj_min_dev) +static int scsi_id(struct udev *udev, char *maj_min_dev) { int retval; struct scsi_id_device dev_scsi; @@ -602,15 +587,16 @@ static int scsi_id(char *maj_min_dev) int page_code; char serial_short[MAX_SERIAL_LEN] = ""; - set_inq_values(&dev_scsi, maj_min_dev); + set_inq_values(udev, &dev_scsi, maj_min_dev); /* get per device (vendor + model) options from the config file */ - retval = per_dev_options(&dev_scsi, &good_dev, &page_code); + retval = per_dev_options(udev, &dev_scsi, &good_dev, &page_code); dbg("per dev options: good %d; page code 0x%x\n", good_dev, page_code); if (!good_dev) { retval = 1; - } else if (scsi_get_serial(&dev_scsi, maj_min_dev, page_code, + } else if (scsi_get_serial(udev, + &dev_scsi, maj_min_dev, page_code, serial_short, MAX_SERIAL_LEN)) { retval = 1; } else { @@ -642,25 +628,30 @@ static int scsi_id(char *maj_min_dev) int main(int argc, char **argv) { + struct udev *udev; int retval = 0; char maj_min_dev[MAX_PATH_LEN]; int newargc; char **newargv; + udev = udev_new(); + if (udev == NULL) + goto exit; + logging_init("scsi_id"); - dbg("argc is %d\n", argc); + udev_set_log_fn(udev, log_fn); /* * Get config file options. */ newargv = NULL; - retval = get_file_options(NULL, NULL, &newargc, &newargv); + retval = get_file_options(udev, NULL, NULL, &newargc, &newargv); if (retval < 0) { retval = 1; goto exit; } if (newargv && (retval == 0)) { - if (set_options(newargc, newargv, short_options, maj_min_dev) < 0) { + if (set_options(udev, newargc, newargv, short_options, maj_min_dev) < 0) { retval = 2; goto exit; } @@ -670,18 +661,19 @@ int main(int argc, char **argv) /* * Get command line options (overriding any config file settings). */ - if (set_options(argc, argv, short_options, maj_min_dev) < 0) + if (set_options(udev, argc, argv, short_options, maj_min_dev) < 0) exit(1); if (!dev_specified) { - err("no device specified\n"); + err(udev, "no device specified\n"); retval = 1; goto exit; } - retval = scsi_id(maj_min_dev); + retval = scsi_id(udev, maj_min_dev); exit: + udev_unref(udev); logging_close(); return retval; } diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 680c39d9ef..48e4a58231 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -40,8 +40,8 @@ struct scsi_id_device { int use_sg; }; -extern int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname); -extern int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, +extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); +extern int scsi_get_serial (struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname, int page_code, char *serial_short, int len); /* diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 104db3d95f..757f41d14e 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -89,7 +89,8 @@ static const char hex_str[]="0123456789abcdef"; #define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ #define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ -static int sg_err_category_new(int scsi_status, int msg_status, int +static int sg_err_category_new(struct udev *udev, + int scsi_status, int msg_status, int host_status, int driver_status, const unsigned char *sense_buffer, int sb_len) { @@ -143,22 +144,24 @@ static int sg_err_category_new(int scsi_status, int msg_status, int return SG_ERR_CAT_OTHER; } -static int sg_err_category3(struct sg_io_hdr *hp) +static int sg_err_category3(struct udev *udev, struct sg_io_hdr *hp) { - return sg_err_category_new(hp->status, hp->msg_status, + return sg_err_category_new(udev, + hp->status, hp->msg_status, hp->host_status, hp->driver_status, hp->sbp, hp->sb_len_wr); } -static int sg_err_category4(struct sg_io_v4 *hp) +static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) { - return sg_err_category_new(hp->device_status, 0, + return sg_err_category_new(udev, hp->device_status, 0, hp->transport_status, hp->driver_status, (unsigned char *)hp->response, hp->response_len); } -static int scsi_dump_sense(struct scsi_id_device *dev_scsi, +static int scsi_dump_sense(struct udev *udev, + struct scsi_id_device *dev_scsi, unsigned char *sense_buffer, int sb_len) { int s; @@ -184,10 +187,10 @@ static int scsi_dump_sense(struct scsi_id_device *dev_scsi, * we'll retry the command. */ - dbg("got check condition\n"); + dbg(udev, "got check condition\n"); if (sb_len < 1) { - info("%s: sense buffer empty\n", dev_scsi->kernel); + info(udev, "%s: sense buffer empty\n", dev_scsi->kernel); return -1; } @@ -200,7 +203,7 @@ static int scsi_dump_sense(struct scsi_id_device *dev_scsi, */ s = sense_buffer[7] + 8; if (sb_len < s) { - info("%s: sense buffer too small %d bytes, %d bytes too short\n", + info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", dev_scsi->kernel, sb_len, s - sb_len); return -1; } @@ -211,7 +214,7 @@ static int scsi_dump_sense(struct scsi_id_device *dev_scsi, /* * Possible? */ - info("%s: sense result too" " small %d bytes\n", + info(udev, "%s: sense result too" " small %d bytes\n", dev_scsi->kernel, s); return -1; } @@ -223,85 +226,88 @@ static int scsi_dump_sense(struct scsi_id_device *dev_scsi, asc = sense_buffer[2]; ascq = sense_buffer[3]; } else { - info("%s: invalid sense code 0x%x\n", + info(udev, "%s: invalid sense code 0x%x\n", dev_scsi->kernel, code); return -1; } - info("%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", + info(udev, "%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", dev_scsi->kernel, sense_key, asc, ascq); } else { if (sb_len < 4) { - info("%s: sense buffer too small %d bytes, %d bytes too short\n", + info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", dev_scsi->kernel, sb_len, 4 - sb_len); return -1; } if (sense_buffer[0] < 15) - info("%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); + info(udev, "%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); else - info("%s: sense = %2x %2x\n", + info(udev, "%s: sense = %2x %2x\n", dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); - info("%s: non-extended sense class %d code 0x%0x\n", + info(udev, "%s: non-extended sense class %d code 0x%0x\n", dev_scsi->kernel, sense_class, code); } #ifdef DUMP_SENSE for (i = 0, j = 0; (i < s) && (j < 254); i++) { - dbg("i %d, j %d\n", i, j); + dbg(udev, "i %d, j %d\n", i, j); out_buffer[j++] = hex_str[(sense_buffer[i] & 0xf0) >> 4]; out_buffer[j++] = hex_str[sense_buffer[i] & 0x0f]; out_buffer[j++] = ' '; } out_buffer[j] = '\0'; - info("%s: sense dump:\n", dev_scsi->kernel); - info("%s: %s\n", dev_scsi->kernel, out_buffer); + info(udev, "%s: sense dump:\n", dev_scsi->kernel); + info(udev, "%s: %s\n", dev_scsi->kernel, out_buffer); #endif return -1; } -static int scsi_dump(struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) +static int scsi_dump(struct udev *udev, + struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) { if (!io->status && !io->host_status && !io->msg_status && !io->driver_status) { /* * Impossible, should not be called. */ - info("%s: called with no error\n", __FUNCTION__); + info(udev, "%s: called with no error\n", __FUNCTION__); return -1; } - info("%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", + info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); if (io->status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(dev_scsi, io->sbp, io->sb_len_wr); + return scsi_dump_sense(udev, dev_scsi, io->sbp, io->sb_len_wr); else return -1; } -static int scsi_dump_v4(struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) +static int scsi_dump_v4(struct udev *udev, + struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) { if (!io->device_status && !io->transport_status && !io->driver_status) { /* * Impossible, should not be called. */ - info("%s: called with no error\n", __FUNCTION__); + info(udev, "%s: called with no error\n", __FUNCTION__); return -1; } - info("%s: sg_io failed status 0x%x 0x%x 0x%x\n", + info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x\n", dev_scsi->kernel, io->driver_status, io->transport_status, io->device_status); if (io->device_status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(dev_scsi, (unsigned char *)io->response, + return scsi_dump_sense(udev, dev_scsi, (unsigned char *)io->response, io->response_len); else return -1; } -static int scsi_inquiry(struct scsi_id_device *dev_scsi, int fd, +static int scsi_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, unsigned char evpd, unsigned char page, unsigned char *buf, unsigned int buflen) { @@ -313,12 +319,12 @@ static int scsi_inquiry(struct scsi_id_device *dev_scsi, int fd, int retry = 3; /* rather random */ if (buflen > SCSI_INQ_BUFF_LEN) { - info("buflen %d too long\n", buflen); + info(udev, "buflen %d too long\n", buflen); return -1; } resend: - dbg("%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); + dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); if (dev_scsi->use_sg == 4) { struct sg_io_v4 io_v4; @@ -356,14 +362,14 @@ resend: dev_scsi->use_sg = 3; goto resend; } - info("%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); + info(udev, "%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); goto error; } if (dev_scsi->use_sg == 4) - retval = sg_err_category4(io_buf); + retval = sg_err_category4(udev, io_buf); else - retval = sg_err_category3(io_buf); + retval = sg_err_category3(udev, io_buf); switch (retval) { case SG_ERR_CAT_NOTSUPPORTED: @@ -376,16 +382,16 @@ resend: default: if (dev_scsi->use_sg == 4) - retval = scsi_dump_v4(dev_scsi, io_buf); + retval = scsi_dump_v4(udev, dev_scsi, io_buf); else - retval = scsi_dump(dev_scsi, io_buf); + retval = scsi_dump(udev, dev_scsi, io_buf); } if (!retval) { retval = buflen; } else if (retval > 0) { if (--retry > 0) { - dbg("%s: Retrying ...\n", dev_scsi->kernel); + dbg(udev, "%s: Retrying ...\n", dev_scsi->kernel); goto resend; } retval = -1; @@ -393,29 +399,30 @@ resend: error: if (retval < 0) - info("%s: Unable to get INQUIRY vpd %d page 0x%x.\n", + info(udev, "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", dev_scsi->kernel, evpd, page); return retval; } /* Get list of supported EVPD pages */ -static int do_scsi_page0_inquiry(struct scsi_id_device *dev_scsi, int fd, +static int do_scsi_page0_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, unsigned char *buffer, unsigned int len) { int retval; memset(buffer, 0, len); - retval = scsi_inquiry(dev_scsi, fd, 1, 0x0, buffer, len); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, 0x0, buffer, len); if (retval < 0) return 1; if (buffer[1] != 0) { - info("%s: page 0 not available.\n", dev_scsi->kernel); + info(udev, "%s: page 0 not available.\n", dev_scsi->kernel); return 1; } if (buffer[3] > len) { - info("%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); + info(udev, "%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); return 1; } @@ -432,7 +439,7 @@ static int do_scsi_page0_inquiry(struct scsi_id_device *dev_scsi, int fd, * invalid. */ if (!strncmp((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) { - info("%s: invalid page0 data\n", dev_scsi->kernel); + info(udev, "%s: invalid page0 data\n", dev_scsi->kernel); return 1; } } @@ -443,7 +450,8 @@ static int do_scsi_page0_inquiry(struct scsi_id_device *dev_scsi, int fd, * The caller checks that serial is long enough to include the vendor + * model. */ -static int prepend_vendor_model(struct scsi_id_device *dev_scsi, char *serial) +static int prepend_vendor_model(struct udev *udev, + struct scsi_id_device *dev_scsi, char *serial) { int ind; @@ -459,7 +467,7 @@ static int prepend_vendor_model(struct scsi_id_device *dev_scsi, char *serial) * above, ind will never be too large. */ if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { - info("%s: expected length %d, got length %d\n", + info(udev, "%s: expected length %d, got length %d\n", dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); return 1; } @@ -470,7 +478,8 @@ static int prepend_vendor_model(struct scsi_id_device *dev_scsi, char *serial) * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill * serial number. **/ -static int check_fill_0x83_id(struct scsi_id_device *dev_scsi, +static int check_fill_0x83_id(struct udev *udev, + struct scsi_id_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values *id_search, char *serial, char *serial_short, int max_len) @@ -517,7 +526,7 @@ static int check_fill_0x83_id(struct scsi_id_device *dev_scsi, len += VENDOR_LENGTH + MODEL_LENGTH; if (max_len < len) { - info("%s: length %d too short - need %d\n", + info(udev, "%s: length %d too short - need %d\n", dev_scsi->kernel, max_len, len); return 1; } @@ -531,8 +540,8 @@ static int check_fill_0x83_id(struct scsi_id_device *dev_scsi, * included in the identifier. */ if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) - if (prepend_vendor_model(dev_scsi, &serial[1]) < 0) { - dbg("prepend failed\n"); + if (prepend_vendor_model(udev, dev_scsi, &serial[1]) < 0) { + dbg(udev, "prepend failed\n"); return 1; } @@ -561,14 +570,15 @@ static int check_fill_0x83_id(struct scsi_id_device *dev_scsi, } /* Extract the raw binary from VPD 0x83 pre-SPC devices */ -static int check_fill_0x83_prespc3(struct scsi_id_device *dev_scsi, +static int check_fill_0x83_prespc3(struct udev *udev, + struct scsi_id_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values *id_search, char *serial, char *serial_short, int max_len) { int i, j; - dbg("using pre-spc3-83 for %s\n", dev_scsi->kernel); + dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); serial[0] = hex_str[id_search->id_type]; /* serial has been memset to zero before */ j = strlen(serial); /* j = 1; */ @@ -583,7 +593,8 @@ static int check_fill_0x83_prespc3(struct scsi_id_device *dev_scsi, /* Get device identification VPD page */ -static int do_scsi_page83_inquiry(struct scsi_id_device *dev_scsi, int fd, +static int do_scsi_page83_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int len) { int retval; @@ -591,13 +602,13 @@ static int do_scsi_page83_inquiry(struct scsi_id_device *dev_scsi, int fd, unsigned char page_83[SCSI_INQ_BUFF_LEN]; memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_83, page_83, + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); if (retval < 0) return 1; if (page_83[1] != PAGE_83) { - info("%s: Invalid page 0x83\n", dev_scsi->kernel); + info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); return 1; } @@ -631,7 +642,8 @@ static int do_scsi_page83_inquiry(struct scsi_id_device *dev_scsi, int fd, */ if (page_83[6] != 0) - return check_fill_0x83_prespc3(dev_scsi, page_83, id_search_list, + return check_fill_0x83_prespc3(udev, + dev_scsi, page_83, id_search_list, serial, serial_short, len); /* @@ -645,21 +657,22 @@ static int do_scsi_page83_inquiry(struct scsi_id_device *dev_scsi, int fd, * one or a small number of descriptors. */ for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { - retval = check_fill_0x83_id(dev_scsi, &page_83[j], + retval = check_fill_0x83_id(udev, + dev_scsi, &page_83[j], &id_search_list[id_ind], serial, serial_short, len); - dbg("%s id desc %d/%d/%d\n", dev_scsi->kernel, + dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, id_search_list[id_ind].id_type, id_search_list[id_ind].naa_type, id_search_list[id_ind].code_set); if (!retval) { - dbg(" used\n"); + dbg(udev, " used\n"); return retval; } else if (retval < 0) { - dbg(" failed\n"); + dbg(udev, " failed\n"); return retval; } else { - dbg(" not used\n"); + dbg(udev, " not used\n"); } } } @@ -673,20 +686,21 @@ static int do_scsi_page83_inquiry(struct scsi_id_device *dev_scsi, int fd, * Return the hard coded error code value 2 if the page 83 reply is not * conformant to the SCSI-2 format. */ -static int do_scsi_page83_prespc3_inquiry(struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int len) +static int do_scsi_page83_prespc3_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int len) { int retval; int i, j; unsigned char page_83[SCSI_INQ_BUFF_LEN]; memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); if (retval < 0) return 1; if (page_83[1] != PAGE_83) { - info("%s: Invalid page 0x83\n", dev_scsi->kernel); + info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); return 1; } /* @@ -730,12 +744,13 @@ static int do_scsi_page83_prespc3_inquiry(struct scsi_id_device *dev_scsi, int f serial[j++] = hex_str[page_83[i] & 0x0f]; i++; } - dbg("using pre-spc3-83 for %s\n", dev_scsi->kernel); + dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); return 0; } /* Get unit serial number VPD page */ -static int do_scsi_page80_inquiry(struct scsi_id_device *dev_scsi, int fd, +static int do_scsi_page80_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int max_len) { int retval; @@ -745,18 +760,18 @@ static int do_scsi_page80_inquiry(struct scsi_id_device *dev_scsi, int fd, unsigned char buf[SCSI_INQ_BUFF_LEN]; memset(buf, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); if (retval < 0) return retval; if (buf[1] != PAGE_80) { - info("%s: Invalid page 0x80\n", dev_scsi->kernel); + info(udev, "%s: Invalid page 0x80\n", dev_scsi->kernel); return 1; } len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; if (max_len < len) { - info("%s: length %d too short - need %d\n", + info(udev, "%s: length %d too short - need %d\n", dev_scsi->kernel, max_len, len); return 1; } @@ -765,7 +780,7 @@ static int do_scsi_page80_inquiry(struct scsi_id_device *dev_scsi, int fd, * specific type where we prepend '0' + vendor + model. */ serial[0] = 'S'; - ser_ind = prepend_vendor_model(dev_scsi, &serial[1]); + ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]); if (ser_ind < 0) return 1; len = buf[3]; @@ -776,23 +791,24 @@ static int do_scsi_page80_inquiry(struct scsi_id_device *dev_scsi, int fd, return 0; } -int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) +int scsi_std_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, const char *devname) { int fd; unsigned char buf[SCSI_INQ_BUFF_LEN]; struct stat statbuf; int err = 0; - dbg("opening %s\n", devname); + dbg(udev, "opening %s\n", devname); fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd < 0) { - info("scsi_id: cannot open %s: %s\n", + info(udev, "scsi_id: cannot open %s: %s\n", devname, strerror(errno)); return 1; } if (fstat(fd, &statbuf) < 0) { - info("scsi_id: cannot stat %s: %s\n", + info(udev, "scsi_id: cannot stat %s: %s\n", devname, strerror(errno)); err = 2; goto out; @@ -801,7 +817,7 @@ int scsi_std_inquiry(struct scsi_id_device *dev_scsi, const char *devname) minor(statbuf.st_rdev)); memset(buf, 0, SCSI_INQ_BUFF_LEN); - err = scsi_inquiry(dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); + err = scsi_inquiry(udev, dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); if (err < 0) goto out; @@ -819,8 +835,9 @@ out: return err; } -int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, - int page_code, char *serial_short, int len) +int scsi_get_serial(struct udev *udev, + struct scsi_id_device *dev_scsi, const char *devname, + int page_code, char *serial_short, int len) { unsigned char page0[SCSI_INQ_BUFF_LEN]; int fd = -1; @@ -829,12 +846,12 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, int retval; memset(dev_scsi->serial, 0, len); - dbg("opening %s\n", devname); + dbg(udev, "opening %s\n", devname); while (--cnt) { fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd >= 0) break; - info("%s: cannot open %s: %s\n", dev_scsi->kernel, devname, strerror(errno)); + info(udev, "%s: cannot open %s: %s\n", dev_scsi->kernel, devname, strerror(errno)); if (errno != EBUSY) break; usleep(500000 + (rand() % 100000) ); @@ -843,7 +860,7 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, return 1; if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(dev_scsi, fd, dev_scsi->serial, serial_short, len)) { + if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -851,7 +868,7 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, goto completed; } } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(dev_scsi, fd, dev_scsi->serial, serial_short, len)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -859,7 +876,7 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, goto completed; } } else if (page_code == PAGE_83_PRE_SPC3) { - retval = do_scsi_page83_prespc3_inquiry(dev_scsi, fd, dev_scsi->serial, serial_short, len); + retval = do_scsi_page83_prespc3_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len); if (retval) { /* * Fallback to servicing a SPC-2/3 compliant page 83 @@ -867,7 +884,7 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, * conform to pre-SPC3 expectations. */ if (retval == 2) { - if (do_scsi_page83_inquiry(dev_scsi, fd, dev_scsi->serial, serial_short, len)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len)) { retval = 1; goto completed; } else { @@ -884,7 +901,7 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, goto completed; } } else if (page_code != 0x00) { - info("%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); + info(udev, "%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); return 1; } @@ -892,7 +909,7 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, * Get page 0, the page of the pages. By default, try from best to * worst of supported pages: 0x83 then 0x80. */ - if (do_scsi_page0_inquiry(dev_scsi, fd, page0, SCSI_INQ_BUFF_LEN)) { + if (do_scsi_page0_inquiry(udev, dev_scsi, fd, page0, SCSI_INQ_BUFF_LEN)) { /* * Don't try anything else. Black list if a specific page * should be used for this vendor+model, or maybe have an @@ -902,11 +919,11 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, goto completed; } - dbg("%s: Checking page0\n", dev_scsi->kernel); + dbg(udev, "%s: Checking page0\n", dev_scsi->kernel); for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) - if (!do_scsi_page83_inquiry(dev_scsi, fd, + if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len)) { /* * Success @@ -917,7 +934,7 @@ int scsi_get_serial (struct scsi_id_device *dev_scsi, const char *devname, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_80) - if (!do_scsi_page80_inquiry(dev_scsi, fd, + if (!do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len)) { /* * Success diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index 0de004a228..9d7e7724ec 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -4,10 +4,13 @@ udevhome_PROGRAMS = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION usb_id_SOURCES = \ usb_id.c \ + ../../udev/lib/libudev.h \ + ../../udev/lib/libudev.c \ ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 92492c8665..fb4c28ac3e 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -28,30 +28,12 @@ #define MAX_SERIAL_LEN 256 #define BLKGETSIZE64 _IOR(0x12,114,size_t) -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) { - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); vsyslog(priority, format, args); - va_end(args); } -#endif static char vendor_str[64]; static char model_str[64]; @@ -219,7 +201,7 @@ static void set_scsi_type(char *to, const char *from, size_t len) * 6.) If the device supplies a serial number, this number * is concatenated with the identification with an underscore '_'. */ -static int usb_id(const char *devpath) +static int usb_id(struct udev *udev, const char *devpath) { struct sysfs_device *dev; struct sysfs_device *dev_interface; @@ -231,38 +213,38 @@ static int usb_id(const char *devpath) dbg("devpath %s\n", devpath); /* get all usb specific information: dev_interface, if_class, dev_usb */ - dev = sysfs_device_get(devpath); + dev = sysfs_device_get(udev, devpath); if (dev == NULL) { - err("unable to access '%s'\n", devpath); + err(udev, "unable to access '%s'\n", devpath); return 1; } /* usb interface directory */ - dev_interface = sysfs_device_get_parent_with_subsystem(dev, "usb"); + dev_interface = sysfs_device_get_parent_with_subsystem(udev, dev, "usb"); if (dev_interface == NULL) { - info("unable to access usb_interface device of '%s'\n", devpath); + info(udev, "unable to access usb_interface device of '%s'\n", devpath); return 1; } - if_class = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceClass"); + if_class = sysfs_attr_get_value(udev, dev_interface->devpath, "bInterfaceClass"); if (!if_class) { - info("%s: cannot get bInterfaceClass attribute\n", dev_interface->kernel); + info(udev, "%s: cannot get bInterfaceClass attribute\n", dev_interface->kernel); return 1; } if_class_num = strtoul(if_class, NULL, 16); if (if_class_num == 8) { - if_subclass = sysfs_attr_get_value(dev_interface->devpath, "bInterfaceSubClass"); + if_subclass = sysfs_attr_get_value(udev, dev_interface->devpath, "bInterfaceSubClass"); if (if_subclass != NULL) protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); } else set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1); - info("%s: if_class %d protocol %d\n", dev_interface->devpath, if_class_num, protocol); + info(udev, "%s: if_class %d protocol %d\n", dev_interface->devpath, if_class_num, protocol); /* usb device directory */ - dev_usb = sysfs_device_get_parent_with_subsystem(dev_interface, "usb"); + dev_usb = sysfs_device_get_parent_with_subsystem(udev, dev_interface, "usb"); if (!dev_usb) { - info("unable to find parent 'usb' device of '%s'\n", devpath); + info(udev, "unable to find parent 'usb' device of '%s'\n", devpath); return 1; } @@ -273,41 +255,41 @@ static int usb_id(const char *devpath) int host, bus, target, lun; /* get scsi device */ - dev_scsi = sysfs_device_get_parent_with_subsystem(dev, "scsi"); + dev_scsi = sysfs_device_get_parent_with_subsystem(udev, dev, "scsi"); if (dev_scsi == NULL) { - info("unable to find parent 'scsi' device of '%s'\n", devpath); + info(udev, "unable to find parent 'scsi' device of '%s'\n", devpath); goto fallback; } if (sscanf(dev_scsi->kernel, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { - info("invalid scsi device '%s'\n", dev_scsi->kernel); + info(udev, "invalid scsi device '%s'\n", dev_scsi->kernel); goto fallback; } /* Generic SPC-2 device */ - scsi_vendor = sysfs_attr_get_value(dev_scsi->devpath, "vendor"); + scsi_vendor = sysfs_attr_get_value(udev, dev_scsi->devpath, "vendor"); if (!scsi_vendor) { - info("%s: cannot get SCSI vendor attribute\n", dev_scsi->kernel); + info(udev, "%s: cannot get SCSI vendor attribute\n", dev_scsi->kernel); goto fallback; } set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); - scsi_model = sysfs_attr_get_value(dev_scsi->devpath, "model"); + scsi_model = sysfs_attr_get_value(udev, dev_scsi->devpath, "model"); if (!scsi_model) { - info("%s: cannot get SCSI model attribute\n", dev_scsi->kernel); + info(udev, "%s: cannot get SCSI model attribute\n", dev_scsi->kernel); goto fallback; } set_str(model_str, scsi_model, sizeof(model_str)-1); - scsi_type = sysfs_attr_get_value(dev_scsi->devpath, "type"); + scsi_type = sysfs_attr_get_value(udev, dev_scsi->devpath, "type"); if (!scsi_type) { - info("%s: cannot get SCSI type attribute\n", dev_scsi->kernel); + info(udev, "%s: cannot get SCSI type attribute\n", dev_scsi->kernel); goto fallback; } set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); - scsi_rev = sysfs_attr_get_value(dev_scsi->devpath, "rev"); + scsi_rev = sysfs_attr_get_value(udev, dev_scsi->devpath, "rev"); if (!scsi_rev) { - info("%s: cannot get SCSI revision attribute\n", dev_scsi->kernel); + info(udev, "%s: cannot get SCSI revision attribute\n", dev_scsi->kernel); goto fallback; } set_str(revision_str, scsi_rev, sizeof(revision_str)-1); @@ -325,13 +307,13 @@ fallback: const char *usb_vendor = NULL; if (!use_num_info) - usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "manufacturer"); + usb_vendor = sysfs_attr_get_value(udev, dev_usb->devpath, "manufacturer"); if (!usb_vendor) - usb_vendor = sysfs_attr_get_value(dev_usb->devpath, "idVendor"); + usb_vendor = sysfs_attr_get_value(udev, dev_usb->devpath, "idVendor"); if (!usb_vendor) { - info("No USB vendor information available\n"); + info(udev, "No USB vendor information available\n"); return 1; } set_str(vendor_str, usb_vendor, sizeof(vendor_str)-1); @@ -341,10 +323,10 @@ fallback: const char *usb_model = NULL; if (!use_num_info) - usb_model = sysfs_attr_get_value(dev_usb->devpath, "product"); + usb_model = sysfs_attr_get_value(udev, dev_usb->devpath, "product"); if (!usb_model) - usb_model = sysfs_attr_get_value(dev_usb->devpath, "idProduct"); + usb_model = sysfs_attr_get_value(udev, dev_usb->devpath, "idProduct"); if (!usb_model) { dbg("No USB model information available\n"); @@ -356,7 +338,7 @@ fallback: if (revision_str[0] == '\0') { const char *usb_rev; - usb_rev = sysfs_attr_get_value(dev_usb->devpath, "bcdDevice"); + usb_rev = sysfs_attr_get_value(udev, dev_usb->devpath, "bcdDevice"); if (usb_rev) set_str(revision_str, usb_rev, sizeof(revision_str)-1); } @@ -364,7 +346,7 @@ fallback: if (serial_str[0] == '\0') { const char *usb_serial; - usb_serial = sysfs_attr_get_value(dev_usb->devpath, "serial"); + usb_serial = sysfs_attr_get_value(udev, dev_usb->devpath, "serial"); if (usb_serial) set_str(serial_str, usb_serial, sizeof(serial_str)-1); } @@ -373,6 +355,7 @@ fallback: int main(int argc, char **argv) { + struct udev *udev; int retval = 0; const char *env; char devpath[MAX_PATH_LEN]; @@ -385,7 +368,12 @@ int main(int argc, char **argv) {} }; + udev = udev_new(); + if (udev == NULL) + goto exit; + logging_init("usb_id"); + udev_set_log_fn(udev, log_fn); sysfs_init(); while (1) { @@ -430,7 +418,7 @@ int main(int argc, char **argv) strlcpy(devpath, argv[optind], sizeof(devpath)); } - retval = usb_id(devpath); + retval = usb_id(udev, devpath); if (retval == 0) { char serial[256]; @@ -463,6 +451,7 @@ int main(int argc, char **argv) } exit: + udev_unref(udev); sysfs_cleanup(); logging_close(); return retval; diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index bc1b262f27..fe9bef7b88 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -7,10 +7,14 @@ udevhome_PROGRAMS = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION vol_id_SOURCES = \ vol_id.c \ + ../../udev/lib/libudev.h \ + ../../udev/lib/libudev.c \ + ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index b3f810fc9d..dcfb0bb92f 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -39,43 +39,20 @@ #define BLKGETSIZE64 _IOR(0x12,114,size_t) -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) { - va_list args; - static int udev_log = -1; - - if (udev_log == -1) { - const char *value; - - value = getenv("UDEV_LOG"); - if (value) - udev_log = log_priority(value); - else - udev_log = LOG_ERR; - } - - if (priority > udev_log) - return; - - va_start(args, format); vsyslog(priority, format, args); - va_end(args); } -#endif static void vid_log(int priority, const char *file, int line, const char *format, ...) { -#ifdef USE_LOG - char log_str[1024]; va_list args; va_start(args, format); - vsnprintf(log_str, sizeof(log_str), format, args); - log_str[sizeof(log_str)-1] = '\0'; - log_message(priority, "%s:%i %s", file, line, log_str); + log_fn(NULL, priority, file, line, NULL, format, args); va_end(args); -#endif return; } @@ -126,6 +103,7 @@ static int all_probers(volume_id_probe_fn_t probe_fn, int main(int argc, char *argv[]) { + struct udev *udev; static const struct option options[] = { { "label", 0, NULL, 'l' }, { "label-raw", 0, NULL, 'L' }, @@ -161,7 +139,11 @@ int main(int argc, char *argv[]) int retval; int rc = 0; + udev = udev_new(); + if (udev == NULL) + goto exit; logging_init("vol_id"); + udev_set_log_fn(udev, log_fn); /* hook in our debug into libvolume_id */ volume_id_log_fn = vid_log; @@ -219,7 +201,7 @@ int main(int argc, char *argv[]) node = argv[optind]; if (!node) { - err("no device\n"); + err(udev, "no device\n"); fprintf(stderr, "no device\n"); rc = 1; goto exit; @@ -240,7 +222,7 @@ int main(int argc, char *argv[]) if (ioctl(fd, BLKGETSIZE64, &size) != 0) size = 0; - dbg("BLKGETSIZE64=%llu\n", (unsigned long long)size); + dbg(udev, "BLKGETSIZE64=%llu\n", (unsigned long long)size); /* try to drop all privileges before reading disk content */ if (getuid() == 0) { @@ -251,7 +233,7 @@ int main(int argc, char *argv[]) if (setgroups(0, NULL) != 0 || setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) - info("unable to drop privileges: %s\n\n", strerror(errno)); + info(udev, "unable to drop privileges: %s\n\n", strerror(errno)); } } @@ -325,7 +307,7 @@ int main(int argc, char *argv[]) exit: if (vid != NULL) volume_id_close(vid); - + udev_unref(udev); logging_close(); return rc; } diff --git a/udev/Makefile.am b/udev/Makefile.am index 450c9489b4..4a30bf9e31 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -10,7 +10,8 @@ noinst_PROGRAMS = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION common_ldadd = @@ -21,7 +22,6 @@ common_files = \ udev_rules.h \ udev_selinux.h \ udev_sysdeps.h \ - udev_config.c \ udev_db.c \ udev_device.c \ udev_device_event.c \ @@ -32,7 +32,11 @@ common_files = \ udev_sysfs.c \ udev_utils.c \ udev_utils_file.c \ - udev_utils_string.c + udev_utils_string.c \ + lib/libudev.h \ + lib/libudev-private.h \ + lib/libudev.c \ + lib/libudev-utils.c if USE_SELINUX diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index f1f5fb74b1..b7dd373d5e 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -33,7 +33,6 @@ libudev_la_SOURCES =\ ../udev_utils_file.c \ ../udev_sysfs.c \ ../udev_device.c \ - ../udev_config.c \ ../udev_db.c \ ../udev_sysdeps.c diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 4db23b2251..66275f4f9c 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -3,6 +3,8 @@ udev_new udev_ref udev_unref udev_set_log_fn +udev_get_log_priority +udev_set_log_priority udev_get_sys_path udev_get_dev_path udev_device_new_from_devpath diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 629cadbc47..43ed2f3dbf 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -58,7 +58,7 @@ struct udev_device *device_init(struct udev *udev) udev_device->udev = udev; INIT_LIST_HEAD(&udev_device->link_list); INIT_LIST_HEAD(&udev_device->env_list); - log_info(udev_device->udev, "udev_device: %p created\n", udev_device); + info(udev_device->udev, "udev_device: %p created\n", udev_device); return udev_device; } @@ -101,7 +101,7 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * if (udev_device == NULL) return NULL; - udevice = udev_device_init(); + udevice = udev_device_init(udev); if (udevice == NULL) { free(udev_device); return NULL; @@ -109,13 +109,13 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * /* resolve possible symlink to real path */ strlcpy(path, devpath, sizeof(path)); - sysfs_resolve_link(path, sizeof(path)); + sysfs_resolve_link(udev, path, sizeof(path)); device_set_devpath(udev_device, devpath); - log_info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); + info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); err = udev_db_get_device(udevice, path); if (err >= 0) - log_info(udev, "device %p filled with udev database data\n", udev_device); + info(udev, "device %p filled with udev database data\n", udev_device); if (udevice->name[0] != '\0') asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev), udevice->name); @@ -126,11 +126,11 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * strlcpy(name, udev_get_dev_path(udev), sizeof(name)); strlcat(name, "/", sizeof(name)); strlcat(name, name_loop->name, sizeof(name)); - name_list_add(&udev_device->link_list, name, 0); + name_list_add(udev, &udev_device->link_list, name, 0); } list_for_each_entry(name_loop, &udevice->env_list, node) - name_list_add(&udev_device->env_list, name_loop->name, 0); + name_list_add(udev_device->udev, &udev_device->env_list, name_loop->name, 0); udev_device_cleanup(udevice); return udev_device; @@ -185,9 +185,9 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->syspath); free(udev_device->devname); free(udev_device->subsystem); - name_list_cleanup(&udev_device->link_list); - name_list_cleanup(&udev_device->env_list); - log_info(udev_device->udev, "udev_device: %p released\n", udev_device); + name_list_cleanup(udev_device->udev, &udev_device->link_list); + name_list_cleanup(udev_device->udev, &udev_device->env_list); + info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } @@ -359,14 +359,14 @@ int device_set_devname(struct udev_device *udev_device, const char *devname) int device_add_devlink(struct udev_device *udev_device, const char *devlink) { - if (name_list_add(&udev_device->link_list, devlink, 0) == NULL) + if (name_list_add(udev_device->udev, &udev_device->link_list, devlink, 0) == NULL) return -ENOMEM; return 0; } int device_add_property(struct udev_device *udev_device, const char *property) { - if (name_list_add(&udev_device->env_list, property, 0) == NULL) + if (name_list_add(udev_device->udev, &udev_device->env_list, property, 0) == NULL) return -ENOMEM; return 0; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index e3198665fc..6aa04d8f9b 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -58,8 +58,8 @@ static int devices_scan_subsystem(struct udev *udev, strlcpy(devpath, &path[len], sizeof(devpath)); strlcat(devpath, "/", sizeof(devpath)); strlcat(devpath, dent->d_name, sizeof(devpath)); - sysfs_resolve_link(devpath, sizeof(devpath)); - name_list_add(device_list, devpath, 1); + sysfs_resolve_link(udev, devpath, sizeof(devpath)); + name_list_add(udev, device_list, devpath, 1); } closedir(dir); return 0; @@ -101,7 +101,7 @@ static int devices_delay(struct udev *udev, const char *devpath) for (i = 0; delay_device_list[i] != NULL; i++) { if (strstr(devpath, delay_device_list[i]) != NULL) { - log_info(udev, "delaying: %s\n", devpath); + info(udev, "delaying: %s\n", devpath); return 1; } } @@ -158,7 +158,7 @@ int udev_devices_enumerate(struct udev *udev, const char *subsystem, INIT_LIST_HEAD(&device_list); /* if we have /sys/subsystem/, forget all the old stuff */ - strlcpy(base, sysfs_path, sizeof(base)); + strlcpy(base, udev_get_sys_path(udev), sizeof(base)); strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { devices_scan_subsystems(udev, "/subsystem", subsystem, "/devices", &device_list); diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 92617e8888..09845576d9 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -86,13 +86,13 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char udev_monitor->socket = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udev_monitor->socket == -1) { - log_err(udev, "error getting socket: %s\n", strerror(errno)); + err(udev, "error getting socket: %s\n", strerror(errno)); free(udev_monitor); return NULL; } if (bind(udev_monitor->socket, (struct sockaddr *) &saddr, addrlen) < 0) { - log_err(udev, "bind failed: %s\n", strerror(errno)); + err(udev, "bind failed: %s\n", strerror(errno)); close(udev_monitor->socket); free(udev_monitor); return NULL; @@ -100,7 +100,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char /* enable receiving of the sender credentials */ setsockopt(udev_monitor->socket, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - log_info(udev_monitor->udev, "udev_monitor: %p created\n", udev_monitor); + info(udev_monitor->udev, "udev_monitor: %p created\n", udev_monitor); return udev_monitor; } @@ -138,7 +138,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) if (udev_monitor->refcount > 0) return; close(udev_monitor->socket); - log_info(udev_monitor->udev, "udev_monitor: %p released\n", udev_monitor); + info(udev_monitor->udev, "udev_monitor: %p released\n", udev_monitor); free(udev_monitor); } @@ -212,32 +212,32 @@ struct udev_device *udev_monitor_get_device(struct udev_monitor *udev_monitor) if (recvmsg(udev_monitor->socket, &smsg, 0) < 0) { if (errno != EINTR) - log_info(udev_monitor->udev, "unable to receive message"); + info(udev_monitor->udev, "unable to receive message"); return NULL; } cmsg = CMSG_FIRSTHDR(&smsg); cred = (struct ucred *)CMSG_DATA (cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - log_info(udev_monitor->udev, "no sender credentials received, message ignored"); + info(udev_monitor->udev, "no sender credentials received, message ignored"); return NULL; } if (cred->uid != 0) { - log_info(udev_monitor->udev, "sender uid=%d, message ignored", cred->uid); + info(udev_monitor->udev, "sender uid=%d, message ignored", cred->uid); return NULL; } /* skip header */ bufpos = strlen(buf) + 1; if (bufpos < sizeof("a@/d") || bufpos >= sizeof(buf)) { - log_info(udev_monitor->udev, "invalid message length"); + info(udev_monitor->udev, "invalid message length"); return NULL; } /* check message header */ if (strstr(buf, "@/") == NULL) { - log_info(udev_monitor->udev, "unrecognized message header"); + info(udev_monitor->udev, "unrecognized message header"); return NULL; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index ffdf571513..ef26ec7e11 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -20,31 +20,39 @@ #ifndef _LIBUDEV_PRIVATE_H_ #define _LIBUDEV_PRIVATE_H_ +#include "config.h" + +#include #include "libudev.h" #include "../udev.h" #ifdef USE_LOG -#define log_dbg(udev, arg...) \ +#ifdef USE_DEBUG +#define dbg(udev, arg...) \ udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) +#else +#define dbg(format, arg...) do { } while (0) +#endif /* USE_DEBUG */ -#define log_info(udev, arg...) \ +#define info(udev, arg...) \ udev_log(udev, LOG_INFO, __FILE__, __LINE__, __FUNCTION__, ## arg) -#define log_err(udev, arg...) \ +#define err(udev, arg...) \ udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) +#else +#define dbg(format, arg...) do { } while (0) +#define info(format, arg...) do { } while (0) +#define err(format, arg...) do { } while (0) +#endif +/* libudev */ void udev_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, ...) __attribute__ ((format(printf, 6, 7))); -#else -#define log_dbg(format, arg...) do { } while (0) -#define log_info(format, arg...) do { } while (0) -#define log_err(format, arg...) do { } while (0) -#endif - -/* libudev */ extern struct udev_device *device_init(struct udev *udev); +extern const char *udev_get_rules_path(struct udev *udev); +extern int udev_get_run(struct udev *udev); /* libudev-device */ extern int device_set_devpath(struct udev_device *udev_device, const char *devpath); diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index a8a8a5ac3a..5a00f44de9 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -26,8 +26,7 @@ #include #include #include -#include -#include +#include #include "libudev.h" #include "libudev-private.h" @@ -38,6 +37,11 @@ struct udev { void (*log_fn)(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args); + char *sys_path; + char *dev_path; + char *rules_path; + int log_priority; + int run:1; }; void udev_log(struct udev *udev, @@ -46,6 +50,9 @@ void udev_log(struct udev *udev, { va_list args; + if (priority > udev->log_priority) + return; + va_start(args, format); udev->log_fn(udev, priority, file, line, fn, format, args); va_end(args); @@ -55,32 +62,9 @@ static void log_stderr(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) { - static int log = -1; - - if (log == -1) { - if (getenv("LIBUDEV_DEBUG") != NULL) - log = 1; - else - log = 0; - } - - if (log == 1) { - fprintf(stderr, "libudev: %s: ", fn); - vfprintf(stderr, format, args); - } -} - -/* glue to udev logging, needed until udev logging code is "fixed" */ -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - va_start(args, format); - log_stderr(NULL, priority, NULL, 0, "", format, args); - va_end(args); + fprintf(stderr, "libudev: %s: ", fn); + vfprintf(stderr, format, args); } -#endif /** * udev_new: @@ -95,17 +79,159 @@ void log_message(int priority, const char *format, ...) struct udev *udev_new(void) { struct udev *udev; + const char *env; + char *config_file; + FILE *f; udev = malloc(sizeof(struct udev)); if (udev == NULL) return NULL; memset(udev, 0x00, (sizeof(struct udev))); + + sysfs_init(); + + /* defaults */ + config_file = NULL; udev->refcount = 1; udev->log_fn = log_stderr; - udev_config_init(); - sysfs_init(); - log_info(udev, "context %p created\n", udev); + udev->log_priority = LOG_ERR; + udev->run = 1; + udev->dev_path = strdup(UDEV_PREFIX "/dev"); + udev->sys_path = strdup("/sys"); + config_file = strdup(SYSCONFDIR "/udev/udev.conf"); + + if (udev->dev_path == NULL || udev->sys_path == NULL) + goto err; + + /* settings by environment and config file */ + env = getenv("SYSFS_PATH"); + if (env != NULL) { + free(udev->sys_path); + udev->sys_path = strdup(env); + remove_trailing_chars(udev->sys_path, '/'); + } + + env = getenv("UDEV_RUN"); + if (env != NULL && !string_is_true(env)) + udev->run = 0; + + env = getenv("UDEV_CONFIG_FILE"); + if (env != NULL) { + free(config_file); + config_file = strdup(env); + remove_trailing_chars(config_file, '/'); + } + if (config_file == NULL) + goto err; + f = fopen(config_file, "r"); + if (f != NULL) { + char line[LINE_SIZE]; + int line_nr = 0; + + while (fgets(line, sizeof(line), f)) { + size_t len; + char *key; + char *val; + + line_nr++; + + /* find key */ + key = line; + while (isspace(key[0])) + key++; + + /* comment or empty line */ + if (key[0] == '#' || key[0] == '\0') + continue; + + /* split key/value */ + val = strchr(key, '='); + if (val == NULL) { + err(udev, "missing = in '%s'[%i], skip line\n", config_file, line_nr); + continue; + } + val[0] = '\0'; + val++; + + /* find value */ + while (isspace(val[0])) + val++; + + /* terminate key */ + len = strlen(key); + if (len == 0) + continue; + while (isspace(key[len-1])) + len--; + key[len] = '\0'; + + /* terminate value */ + len = strlen(val); + if (len == 0) + continue; + while (isspace(val[len-1])) + len--; + val[len] = '\0'; + + if (len == 0) + continue; + + /* unquote */ + if (val[0] == '"' || val[0] == '\'') { + if (val[len-1] != val[0]) { + err(udev, "inconsistent quoting in '%s'[%i], skip line\n", config_file, line_nr); + continue; + } + val[len-1] = '\0'; + val++; + } + + if (strcasecmp(key, "udev_log") == 0) { + udev->log_priority = log_priority(val); + continue; + } + if (strcasecmp(key, "udev_root") == 0) { + free(udev->dev_path); + udev->dev_path = strdup(val); + remove_trailing_chars(udev->dev_path, '/'); + continue; + } + if (strcasecmp(key, "udev_rules") == 0) { + free(udev->rules_path); + udev->rules_path = strdup(val); + remove_trailing_chars(udev->rules_path, '/'); + continue; + } + } + fclose(f); + } + free(config_file); + + env = getenv("UDEV_ROOT"); + if (env != NULL) { + free(udev->dev_path); + udev->dev_path = strdup(env); + remove_trailing_chars(udev->dev_path, '/'); + } + + env = getenv("UDEV_LOG"); + if (env != NULL) + udev->log_priority = log_priority(env); + + if (udev->dev_path == NULL || udev->sys_path == NULL) + goto err; + + info(udev, "context %p created\n", udev); + info(udev, "log_priority=%d\n", udev->log_priority); + info(udev, "dev_path='%s'\n", udev->dev_path); + if (udev->rules_path != NULL) + info(udev, "rules_path='%s'\n", udev->rules_path); + return udev; +err: + err(udev, "context creation failed\n"); + udev_unref(udev); + return NULL; } /** @@ -140,7 +266,9 @@ void udev_unref(struct udev *udev) if (udev->refcount > 0) return; sysfs_cleanup(); - log_info(udev, "context %p released\n", udev); + free(udev->dev_path); + free(udev->sys_path); + info(udev, "context %p released\n", udev); free(udev); } @@ -161,7 +289,27 @@ void udev_set_log_fn(struct udev *udev, const char *format, va_list args)) { udev->log_fn = log_fn; - log_info(udev, "custom logging function %p registered\n", udev); + info(udev, "custom logging function %p registered\n", udev); +} + +int udev_get_log_priority(struct udev *udev) +{ + return udev->log_priority; +} + +void udev_set_log_priority(struct udev *udev, int priority) +{ + udev->log_priority = priority; +} + +const char *udev_get_rules_path(struct udev *udev) +{ + return udev->rules_path; +} + +int udev_get_run(struct udev *udev) +{ + return udev->run; } /** @@ -178,7 +326,7 @@ const char *udev_get_sys_path(struct udev *udev) { if (udev == NULL) return NULL; - return sysfs_path; + return udev->sys_path; } /** @@ -195,5 +343,5 @@ const char *udev_get_dev_path(struct udev *udev) { if (udev == NULL) return NULL; - return udev_root; + return udev->dev_path; } diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 30753a19a7..98652c5904 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -20,6 +20,8 @@ #ifndef _LIBUDEV_H_ #define _LIBUDEV_H_ +#include + /* this will stay as long as the DeviceKit integration of udev is work in progress */ #if !defined _LIBUDEV_COMPILATION && !defined LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE #error "#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE is needed to use this experimental library version" @@ -36,6 +38,8 @@ extern void udev_set_log_fn(struct udev *udev, void (*log_fn)(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args)); +extern int udev_get_log_priority(struct udev *udev); +extern void udev_set_log_priority(struct udev *udev, int priority); extern const char *udev_get_sys_path(struct udev *udev); extern const char *udev_get_dev_path(struct udev *udev); diff --git a/udev/logging.h b/udev/logging.h deleted file mode 100644 index 6766ac3efa..0000000000 --- a/udev/logging.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * simple logging functions that can be expanded into nothing - * - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef LOGGING_H -#define LOGGING_H - -#include "config.h" - -#define err(format, arg...) do { } while (0) -#define info(format, arg...) do { } while (0) -#define dbg(format, arg...) do { } while (0) -#define logging_init(foo) do { } while (0) -#define logging_close(foo) do { } while (0) - -#ifdef USE_LOG -#include -#include -#include - -#undef err -#define err(format, arg...) \ - do { \ - log_message(LOG_ERR ,"%s: " format ,__FUNCTION__ ,## arg); \ - } while (0) - -#undef info -#define info(format, arg...) \ - do { \ - log_message(LOG_INFO ,"%s: " format ,__FUNCTION__ ,## arg); \ - } while (0) - -#ifdef DEBUG -#undef dbg -#define dbg(format, arg...) \ - do { \ - log_message(LOG_DEBUG ,"%s: " format ,__FUNCTION__ ,## arg); \ - } while (0) -#endif - -extern void log_message(int priority, const char *format, ...) - __attribute__ ((format (printf, 2, 3))); - -#undef logging_init -static inline void logging_init(const char *program_name) -{ - openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); -} - -#undef logging_close -static inline void logging_close(void) -{ - closelog(); -} - -#endif /* USE_LOG */ - -#endif diff --git a/udev/test-udev.c b/udev/test-udev.c index 07628f74fd..4e782a0d61 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -35,20 +35,6 @@ #include "udev_rules.h" #include "udev_selinux.h" -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - vsyslog(priority, format, args); - va_end(args); -} -#endif - static void asmlinkage sig_handler(int signum) { switch (signum) { @@ -62,8 +48,9 @@ static void asmlinkage sig_handler(int signum) int main(int argc, char *argv[]) { + struct udev *udev; struct sysfs_device *dev; - struct udevice *udev; + struct udevice *udevice; const char *maj, *min; struct udev_rules rules; const char *action; @@ -73,10 +60,11 @@ int main(int argc, char *argv[]) int devnull; int retval = -EINVAL; - if (argc == 2 && strcmp(argv[1], "-V") == 0) { - printf("%s\n", VERSION); - exit(0); - } + udev = udev_new(); + if (udev == NULL) + exit(1); + dbg(udev, "version %s\n", VERSION); + selinux_init(udev); /* set std fd's to /dev/null, /sbin/hotplug forks us, we don't have them at all */ devnull = open("/dev/null", O_RDWR); @@ -89,15 +77,10 @@ int main(int argc, char *argv[]) dup2(devnull, STDERR_FILENO); if (devnull > STDERR_FILENO) close(devnull); + } else { + err(udev, "open /dev/null failed: %s\n", strerror(errno)); } - logging_init("udev"); - if (devnull < 0) - err("open /dev/null failed: %s\n", strerror(errno)); - udev_config_init(); - selinux_init(); - dbg("version %s\n", VERSION); - /* set signal handlers */ memset(&act, 0x00, sizeof(act)); act.sa_handler = (void (*)(int)) sig_handler; @@ -118,61 +101,59 @@ int main(int argc, char *argv[]) subsystem = argv[1]; if (action == NULL || subsystem == NULL || devpath == NULL) { - err("action, subsystem or devpath missing\n"); + err(udev, "action, subsystem or devpath missing\n"); goto exit; } /* export log_priority , as called programs may want to do the same as udev */ - if (udev_log_priority) { + if (udev_get_log_priority(udev) > 0) { char priority[32]; - sprintf(priority, "%i", udev_log_priority); + sprintf(priority, "%i", udev_get_log_priority(udev)); setenv("UDEV_LOG", priority, 1); } sysfs_init(); - udev_rules_init(&rules, 0); + udev_rules_init(udev, &rules, 0); - dev = sysfs_device_get(devpath); + dev = sysfs_device_get(udev, devpath); if (dev == NULL) { - info("unable to open '%s'\n", devpath); + info(udev, "unable to open '%s'\n", devpath); goto fail; } - udev = udev_device_init(); - if (udev == NULL) + udevice = udev_device_init(udev); + if (udevice == NULL) goto fail; /* override built-in sysfs device */ - udev->dev = dev; - strlcpy(udev->action, action, sizeof(udev->action)); + udevice->dev = dev; + strlcpy(udevice->action, action, sizeof(udevice->action)); /* get dev_t from environment, which is needed for "remove" to work, "add" works also from sysfs */ maj = getenv("MAJOR"); min = getenv("MINOR"); if (maj != NULL && min != NULL) - udev->devt = makedev(atoi(maj), atoi(min)); + udevice->devt = makedev(atoi(maj), atoi(min)); else - udev->devt = udev_device_get_devt(udev); + udevice->devt = udev_device_get_devt(udevice); - retval = udev_device_event(&rules, udev); + retval = udev_device_event(&rules, udevice); /* rules may change/disable the timeout */ - if (udev->event_timeout >= 0) - alarm(udev->event_timeout); + if (udevice->event_timeout >= 0) + alarm(udevice->event_timeout); - if (retval == 0 && !udev->ignore_device && udev_run) - udev_rules_run(udev); + if (retval == 0 && !udevice->ignore_device && udev_get_run(udev)) + udev_rules_run(udevice); - udev_device_cleanup(udev); + udev_device_cleanup(udevice); fail: udev_rules_cleanup(&rules); sysfs_cleanup(); - selinux_exit(); + selinux_exit(udev); exit: - logging_close(); - endgrent(); if (retval != 0) return 1; return 0; diff --git a/udev/udev-control.c b/udev/udev-control.c index 4e339ff483..96e4b29be3 100644 --- a/udev/udev-control.c +++ b/udev/udev-control.c @@ -32,12 +32,13 @@ #include "udevd.h" struct udev_ctrl { + struct udev *udev; int sock; struct sockaddr_un saddr; socklen_t addrlen; }; -struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path) +struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) { struct udev_ctrl *uctrl; @@ -45,10 +46,11 @@ struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path) if (uctrl == NULL) return NULL; memset(uctrl, 0x00, sizeof(struct udev_ctrl)); + uctrl->udev = udev; uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (uctrl->sock < 0) { - err("error getting socket: %s\n", strerror(errno)); + err(udev, "error getting socket: %s\n", strerror(errno)); free(uctrl); return NULL; } @@ -85,7 +87,7 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udevd_ctrl_msg_type type, int err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); if (err == -1) { - err("error sending message: %s\n", strerror(errno)); + err(uctrl->udev, "error sending message: %s\n", strerror(errno)); } return err; } diff --git a/udev/udev.h b/udev/udev.h index 00f2fd8282..1dd55f6a23 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -20,12 +20,16 @@ #ifndef _UDEV_H_ #define _UDEV_H_ +#include "config.h" + #include #include #include "list.h" -#include "logging.h" #include "udev_sysdeps.h" +#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 1 +#include "lib/libudev.h" +#include "lib/libudev-private.h" #define COMMENT_CHARACTER '#' #define LINE_SIZE 512 @@ -59,6 +63,8 @@ struct sysfs_device { }; struct udevice { + struct udev *udev; + /* device event */ struct sysfs_device *dev; /* points to dev_local by default */ struct sysfs_device dev_local; @@ -92,48 +98,57 @@ struct udevice { int test_run; }; -/* udev_config.c */ -extern char udev_root[PATH_SIZE]; -extern char udev_config_filename[PATH_SIZE]; -extern char udev_rules_dir[PATH_SIZE]; -extern int udev_log_priority; -extern int udev_run; -extern void udev_config_init(void); +static inline void logging_init(const char *program_name) +{ + openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); +} + +static inline void logging_msg(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + vsyslog(priority, format, args); +} + +static inline void logging_close(void) +{ + closelog(); +} /* udev_device.c */ -extern struct udevice *udev_device_init(void); -extern void udev_device_cleanup(struct udevice *udev); -extern dev_t udev_device_get_devt(struct udevice *udev); +extern struct udevice *udev_device_init(struct udev *udev); +extern void udev_device_cleanup(struct udevice *udevice); +extern dev_t udev_device_get_devt(struct udevice *udevice); /* udev_device_event.c */ -extern int udev_device_event(struct udev_rules *rules, struct udevice *udev); +extern int udev_device_event(struct udev_rules *rules, struct udevice *udevice); /* udev_sysfs.c */ -extern char sysfs_path[PATH_SIZE]; extern int sysfs_init(void); extern void sysfs_cleanup(void); -extern void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, +extern void sysfs_device_set_values(struct udev *udev, + struct sysfs_device *dev, const char *devpath, const char *subsystem, const char *driver); -extern struct sysfs_device *sysfs_device_get(const char *devpath); -extern struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev); -extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem); -extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name); -extern int sysfs_resolve_link(char *path, size_t size); -extern int sysfs_lookup_devpath_by_subsys_id(char *devpath, size_t len, const char *subsystem, const char *id); +extern struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath); +extern struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_device *dev); +extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct udev *udev, struct sysfs_device *dev, const char *subsystem); +extern char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *attr_name); +extern int sysfs_resolve_link(struct udev *udev, char *path, size_t size); +extern int sysfs_lookup_devpath_by_subsys_id(struct udev *udev, char *devpath, size_t len, const char *subsystem, const char *id); /* udev_node.c */ -extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); -extern void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old); -extern int udev_node_add(struct udevice *udev); -extern int udev_node_remove(struct udevice *udev); +extern int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); +extern void udev_node_update_symlinks(struct udevice *udevice, struct udevice *udev_old); +extern int udev_node_add(struct udevice *udevice); +extern int udev_node_remove(struct udevice *udevice); /* udev_db.c */ -extern int udev_db_add_device(struct udevice *dev); -extern int udev_db_delete_device(struct udevice *dev); -extern int udev_db_rename(const char *devpath_old, const char *devpath); -extern int udev_db_get_device(struct udevice *udev, const char *devpath); -extern int udev_db_get_devices_by_name(const char *name, struct list_head *name_list); -extern int udev_db_get_all_entries(struct list_head *name_list); +extern int udev_db_add_device(struct udevice *udevice); +extern int udev_db_delete_device(struct udevice *udevice); +extern int udev_db_rename(struct udev *udev, const char *devpath_old, const char *devpath); +extern int udev_db_get_device(struct udevice *udevice, const char *devpath); +extern int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list_head *name_list); +extern int udev_db_get_all_entries(struct udev *udevconst, struct list_head *name_list); /* udev_utils.c */ struct name_entry { @@ -143,13 +158,13 @@ struct name_entry { }; extern int log_priority(const char *priority); -extern struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort); -extern struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value); -extern int name_list_key_remove(struct list_head *name_list, const char *key); -extern void name_list_cleanup(struct list_head *name_list); -extern int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix); -extern uid_t lookup_user(const char *user); -extern gid_t lookup_group(const char *group); +extern struct name_entry *name_list_add(struct udev *udev, struct list_head *name_list, const char *name, int sort); +extern struct name_entry *name_list_key_add(struct udev *udev, struct list_head *name_list, const char *key, const char *value); +extern int name_list_key_remove(struct udev *udev, struct list_head *name_list, const char *key); +extern void name_list_cleanup(struct udev *udev, struct list_head *name_list); +extern int add_matching_files(struct udev *udev, struct list_head *name_list, const char *dirname, const char *suffix); +extern uid_t lookup_user(struct udev *udev, const char *user); +extern gid_t lookup_group(struct udev *udev, const char *group); /* udev_utils_string.c */ extern int string_is_true(const char *str); @@ -160,24 +175,24 @@ extern int utf8_encoded_valid_unichar(const char *str); extern int replace_chars(char *str, const char *white); /* udev_utils_file.c */ -extern int create_path(const char *path); -extern int delete_path(const char *path); +extern int create_path(struct udev *udev, const char *path); +extern int delete_path(struct udev *udev, const char *path); +extern int unlink_secure(struct udev *udev, const char *filename); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(void *buf, size_t bufsize); -extern int unlink_secure(const char *filename); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); /* udevadm commands */ -extern int udevadm_monitor(int argc, char *argv[]); -extern int udevadm_info(int argc, char *argv[]); -extern int udevadm_control(int argc, char *argv[]); -extern int udevadm_trigger(int argc, char *argv[]); -extern int udevadm_settle(int argc, char *argv[]); -extern int udevadm_test(int argc, char *argv[]); +extern int udevadm_monitor(struct udev *udev, int argc, char *argv[]); +extern int udevadm_info(struct udev *udev, int argc, char *argv[]); +extern int udevadm_control(struct udev *udev, int argc, char *argv[]); +extern int udevadm_trigger(struct udev *udev, int argc, char *argv[]); +extern int udevadm_settle(struct udev *udev, int argc, char *argv[]); +extern int udevadm_test(struct udev *udev, int argc, char *argv[]); /* udev_ctrl - daemon runtime setup */ struct udev_ctrl; -extern struct udev_ctrl *udev_ctrl_new_from_socket(const char *socket_path); +extern struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); extern void udev_ctrl_unref(struct udev_ctrl *uctrl); extern int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority); extern int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl); diff --git a/udev/udev_config.c b/udev/udev_config.c deleted file mode 100644 index 8a1dac51d2..0000000000 --- a/udev/udev_config.c +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2005 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -/* global variables */ -char udev_root[PATH_SIZE]; -char udev_config_filename[PATH_SIZE]; -char udev_rules_dir[PATH_SIZE]; -int udev_log_priority; -int udev_run; - -static int get_key(char **line, char **key, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (!linepos) - return -1; - - /* skip whitespace */ - while (isspace(linepos[0])) - linepos++; - - /* get the key */ - *key = linepos; - while (1) { - linepos++; - if (linepos[0] == '\0') - return -1; - if (isspace(linepos[0])) - break; - if (linepos[0] == '=') - break; - } - - /* terminate key */ - linepos[0] = '\0'; - linepos++; - - /* skip whitespace */ - while (isspace(linepos[0])) - linepos++; - - /* get the value*/ - if (linepos[0] == '"') - linepos++; - else - return -1; - *value = linepos; - - temp = strchr(linepos, '"'); - if (!temp) - return -1; - temp[0] = '\0'; - - return 0; -} - -static int parse_config_file(void) -{ - char line[LINE_SIZE]; - char *bufline; - char *linepos; - char *variable; - char *value; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - int lineno; - int retval = 0; - - if (file_map(udev_config_filename, &buf, &bufsize) != 0) { - err("can't open '%s' as config file: %s\n", udev_config_filename, strerror(errno)); - return -ENODEV; - } - - /* loop through the whole file */ - lineno = 0; - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; - - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) - continue; - - /* see if this is a comment */ - if (bufline[0] == COMMENT_CHARACTER) - continue; - - if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); - continue; - } - - memcpy(line, bufline, count); - line[count] = '\0'; - - linepos = line; - retval = get_key(&linepos, &variable, &value); - if (retval != 0) { - err("error parsing %s, line %d:%d\n", udev_config_filename, lineno, (int)(linepos-line)); - continue; - } - - if (strcasecmp(variable, "udev_root") == 0) { - strlcpy(udev_root, value, sizeof(udev_root)); - remove_trailing_chars(udev_root, '/'); - continue; - } - - if (strcasecmp(variable, "udev_rules") == 0) { - strlcpy(udev_rules_dir, value, sizeof(udev_rules_dir)); - remove_trailing_chars(udev_rules_dir, '/'); - continue; - } - - if (strcasecmp(variable, "udev_log") == 0) { - udev_log_priority = log_priority(value); - continue; - } - } - - file_unmap(buf, bufsize); - return retval; -} - -void udev_config_init(void) -{ - const char *env; - - strcpy(udev_config_filename, SYSCONFDIR "/udev/udev.conf"); - strcpy(udev_root, UDEV_PREFIX "/dev"); - udev_rules_dir[0] = '\0'; - udev_log_priority = LOG_ERR; - udev_run = 1; - - /* disable RUN key execution */ - env = getenv("UDEV_RUN"); - if (env && !string_is_true(env)) - udev_run = 0; - - env = getenv("UDEV_CONFIG_FILE"); - if (env) { - strlcpy(udev_config_filename, env, sizeof(udev_config_filename)); - remove_trailing_chars(udev_config_filename, '/'); - } - - parse_config_file(); - - env = getenv("UDEV_ROOT"); - if (env) { - strlcpy(udev_root, env, sizeof(udev_root)); - remove_trailing_chars(udev_root, '/'); - } - - env = getenv("UDEV_LOG"); - if (env) - udev_log_priority = log_priority(env); - - dbg("UDEV_CONFIG_FILE='%s'\n", udev_config_filename); - dbg("udev_root='%s'\n", udev_root); - dbg("udev_rules_dir='%s'\n", udev_rules_dir); - dbg("udev_log=%d\n", udev_log_priority); -} diff --git a/udev/udev_db.c b/udev/udev_db.c index e3f0f7fd58..e89f2c2a15 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -34,19 +34,19 @@ #include "udev_selinux.h" -static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len) +static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) { size_t start; /* translate to location of db file */ - strlcpy(filename, udev_root, len); + strlcpy(filename, udev_get_dev_path(udev), len); start = strlcat(filename, "/.udev/db/", len); strlcat(filename, devpath, len); return path_encode(&filename[start], len - start); } /* reverse mapping from the device file name to the devpath */ -static int name_index(const char *devpath, const char *name, int add) +static int name_index(struct udev *udev, const char *devpath, const char *name, int add) { char device[PATH_SIZE]; char filename[PATH_SIZE * 2]; @@ -54,7 +54,7 @@ static int name_index(const char *devpath, const char *name, int add) int fd; /* directory with device name */ - strlcpy(filename, udev_root, sizeof(filename)); + strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); start = strlcat(filename, "/.udev/names/", sizeof(filename)); strlcat(filename, name, sizeof(filename)); path_encode(&filename[start], sizeof(filename) - start); @@ -65,39 +65,39 @@ static int name_index(const char *devpath, const char *name, int add) strlcat(filename, device, sizeof(filename)); if (add) { - info("creating index: '%s'\n", filename); - create_path(filename); + info(udev, "creating index: '%s'\n", filename); + create_path(udev, filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd > 0) close(fd); } else { - info("removing index: '%s'\n", filename); + info(udev, "removing index: '%s'\n", filename); unlink(filename); - delete_path(filename); + delete_path(udev, filename); } return 0; } -int udev_db_get_devices_by_name(const char *name, struct list_head *name_list) +int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list_head *name_list) { char dirname[PATH_MAX]; size_t start; DIR *dir; int rc = 0; - strlcpy(dirname, udev_root, sizeof(dirname)); + strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); start = strlcat(dirname, "/.udev/names/", sizeof(dirname)); strlcat(dirname, name, sizeof(dirname)); path_encode(&dirname[start], sizeof(dirname) - start); dir = opendir(dirname); if (dir == NULL) { - info("no index directory '%s': %s\n", dirname, strerror(errno)); + info(udev, "no index directory '%s': %s\n", dirname, strerror(errno)); rc = -1; goto out; } - info("found index directory '%s'\n", dirname); + info(udev, "found index directory '%s'\n", dirname); while (1) { struct dirent *ent; char device[PATH_SIZE]; @@ -110,7 +110,7 @@ int udev_db_get_devices_by_name(const char *name, struct list_head *name_list) strlcpy(device, ent->d_name, sizeof(device)); path_decode(device); - name_list_add(name_list, device, 0); + name_list_add(udev, name_list, device, 0); rc++; } closedir(dir); @@ -118,40 +118,40 @@ out: return rc; } -int udev_db_rename(const char *devpath_old, const char *devpath) +int udev_db_rename(struct udev *udev, const char *devpath_old, const char *devpath) { char filename[PATH_SIZE]; char filename_old[PATH_SIZE]; - devpath_to_db_path(devpath_old, filename_old, sizeof(filename_old)); - devpath_to_db_path(devpath, filename, sizeof(filename)); + devpath_to_db_path(udev, devpath_old, filename_old, sizeof(filename_old)); + devpath_to_db_path(udev, devpath, filename, sizeof(filename)); return rename(filename_old, filename); } -int udev_db_add_device(struct udevice *udev) +int udev_db_add_device(struct udevice *udevice) { char filename[PATH_SIZE]; - if (udev->test_run) + if (udevice->test_run) return 0; - devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); - create_path(filename); + devpath_to_db_path(udevice->udev, udevice->dev->devpath, filename, sizeof(filename)); + create_path(udevice->udev, filename); unlink(filename); /* * don't waste tmpfs memory pages, if we don't have any data to store * create fake db-file; store the node-name in a symlink target */ - if (list_empty(&udev->symlink_list) && list_empty(&udev->env_list) && - !udev->partitions && !udev->ignore_remove) { + if (list_empty(&udevice->symlink_list) && list_empty(&udevice->env_list) && + !udevice->partitions && !udevice->ignore_remove) { int ret; - dbg("nothing interesting to store, create symlink\n"); - selinux_setfscreatecon(filename, NULL, S_IFLNK); - ret = symlink(udev->name, filename); - selinux_resetfscreatecon(); + dbg(udevice->udev, "nothing interesting to store, create symlink\n"); + selinux_setfscreatecon(udevice->udev, filename, NULL, S_IFLNK); + ret = symlink(udevice->name, filename); + selinux_resetfscreatecon(udevice->udev); if (ret != 0) { - err("unable to create db link '%s': %s\n", filename, strerror(errno)); + err(udevice->udev, "unable to create db link '%s': %s\n", filename, strerror(errno)); return -1; } } else { @@ -160,38 +160,38 @@ int udev_db_add_device(struct udevice *udev) f = fopen(filename, "w"); if (f == NULL) { - err("unable to create db file '%s': %s\n", filename, strerror(errno)); + err(udevice->udev, "unable to create db file '%s': %s\n", filename, strerror(errno)); return -1; } - dbg("storing data for device '%s' in '%s'\n", udev->dev->devpath, filename); + dbg(udevice->udev, "storing data for device '%s' in '%s'\n", udevice->dev->devpath, filename); - fprintf(f, "N:%s\n", udev->name); - list_for_each_entry(name_loop, &udev->symlink_list, node) { + fprintf(f, "N:%s\n", udevice->name); + list_for_each_entry(name_loop, &udevice->symlink_list, node) { fprintf(f, "S:%s\n", name_loop->name); /* add symlink-name to index */ - name_index(udev->dev->devpath, name_loop->name, 1); + name_index(udevice->udev, udevice->dev->devpath, name_loop->name, 1); } - fprintf(f, "M:%u:%u\n", major(udev->devt), minor(udev->devt)); - if (udev->link_priority != 0) - fprintf(f, "L:%u\n", udev->link_priority); - if (udev->event_timeout >= 0) - fprintf(f, "T:%u\n", udev->event_timeout); - if (udev->partitions != 0) - fprintf(f, "A:%u\n", udev->partitions); - if (udev->ignore_remove) - fprintf(f, "R:%u\n", udev->ignore_remove); - list_for_each_entry(name_loop, &udev->env_list, node) + fprintf(f, "M:%u:%u\n", major(udevice->devt), minor(udevice->devt)); + if (udevice->link_priority != 0) + fprintf(f, "L:%u\n", udevice->link_priority); + if (udevice->event_timeout >= 0) + fprintf(f, "T:%u\n", udevice->event_timeout); + if (udevice->partitions != 0) + fprintf(f, "A:%u\n", udevice->partitions); + if (udevice->ignore_remove) + fprintf(f, "R:%u\n", udevice->ignore_remove); + list_for_each_entry(name_loop, &udevice->env_list, node) fprintf(f, "E:%s\n", name_loop->name); fclose(f); } /* add name to index */ - name_index(udev->dev->devpath, udev->name, 1); + name_index(udevice->udev, udevice->dev->devpath, udevice->name, 1); return 0; } -int udev_db_get_device(struct udevice *udev, const char *devpath) +int udev_db_get_device(struct udevice *udevice, const char *devpath) { struct stat stats; char filename[PATH_SIZE]; @@ -203,32 +203,32 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) size_t cur; size_t count; - sysfs_device_set_values(udev->dev, devpath, NULL, NULL); - devpath_to_db_path(devpath, filename, sizeof(filename)); + sysfs_device_set_values(udevice->udev, udevice->dev, devpath, NULL, NULL); + devpath_to_db_path(udevice->udev, devpath, filename, sizeof(filename)); if (lstat(filename, &stats) != 0) { - info("no db file to read %s: %s\n", filename, strerror(errno)); + info(udevice->udev, "no db file to read %s: %s\n", filename, strerror(errno)); return -1; } if ((stats.st_mode & S_IFMT) == S_IFLNK) { char target[NAME_SIZE]; int target_len; - info("found a symlink as db file\n"); + info(udevice->udev, "found a symlink as db file\n"); target_len = readlink(filename, target, sizeof(target)); if (target_len > 0) target[target_len] = '\0'; else { - info("error reading db link %s: %s\n", filename, strerror(errno)); + info(udevice->udev, "error reading db link %s: %s\n", filename, strerror(errno)); return -1; } - dbg("db link points to '%s'\n", target); - strlcpy(udev->name, target, sizeof(udev->name)); + dbg(udevice->udev, "db link points to '%s'\n", target); + strlcpy(udevice->name, target, sizeof(udevice->name)); return 0; } if (file_map(filename, &buf, &bufsize) != 0) { - info("error reading db file %s: %s\n", filename, strerror(errno)); + info(udevice->udev, "error reading db file %s: %s\n", filename, strerror(errno)); return -1; } @@ -245,68 +245,68 @@ int udev_db_get_device(struct udevice *udev, const char *devpath) switch(bufline[0]) { case 'N': - strlcpy(udev->name, line, sizeof(udev->name)); + strlcpy(udevice->name, line, sizeof(udevice->name)); break; case 'M': sscanf(line, "%u:%u", &maj, &min); - udev->devt = makedev(maj, min); + udevice->devt = makedev(maj, min); break; case 'S': - name_list_add(&udev->symlink_list, line, 0); + name_list_add(udevice->udev, &udevice->symlink_list, line, 0); break; case 'L': - udev->link_priority = atoi(line); + udevice->link_priority = atoi(line); break; case 'T': - udev->event_timeout = atoi(line); + udevice->event_timeout = atoi(line); break; case 'A': - udev->partitions = atoi(line); + udevice->partitions = atoi(line); break; case 'R': - udev->ignore_remove = atoi(line); + udevice->ignore_remove = atoi(line); break; case 'E': - name_list_add(&udev->env_list, line, 0); + name_list_add(udevice->udev, &udevice->env_list, line, 0); break; } } file_unmap(buf, bufsize); - if (udev->name[0] == '\0') + if (udevice->name[0] == '\0') return -1; return 0; } -int udev_db_delete_device(struct udevice *udev) +int udev_db_delete_device(struct udevice *udevice) { char filename[PATH_SIZE]; struct name_entry *name_loop; - if (udev->test_run) + if (udevice->test_run) return 0; - devpath_to_db_path(udev->dev->devpath, filename, sizeof(filename)); + devpath_to_db_path(udevice->udev, udevice->dev->devpath, filename, sizeof(filename)); unlink(filename); - name_index(udev->dev->devpath, udev->name, 0); - list_for_each_entry(name_loop, &udev->symlink_list, node) - name_index(udev->dev->devpath, name_loop->name, 0); + name_index(udevice->udev, udevice->dev->devpath, udevice->name, 0); + list_for_each_entry(name_loop, &udevice->symlink_list, node) + name_index(udevice->udev, udevice->dev->devpath, name_loop->name, 0); return 0; } -int udev_db_get_all_entries(struct list_head *name_list) +int udev_db_get_all_entries(struct udev *udev, struct list_head *name_list) { char dbpath[PATH_MAX]; DIR *dir; - strlcpy(dbpath, udev_root, sizeof(dbpath)); + strlcpy(dbpath, udev_get_dev_path(udev), sizeof(dbpath)); strlcat(dbpath, "/.udev/db", sizeof(dbpath)); dir = opendir(dbpath); if (dir == NULL) { - info("no udev_db available '%s': %s\n", dbpath, strerror(errno)); + info(udev, "no udev_db available '%s': %s\n", dbpath, strerror(errno)); return -1; } @@ -322,8 +322,8 @@ int udev_db_get_all_entries(struct list_head *name_list) strlcpy(device, ent->d_name, sizeof(device)); path_decode(device); - name_list_add(name_list, device, 1); - dbg("added '%s'\n", device); + name_list_add(udev, name_list, device, 1); + dbg(udev, "added '%s'\n", device); } closedir(dir); diff --git a/udev/udev_device.c b/udev/udev_device.c index 130c714301..5ae66743f6 100644 --- a/udev/udev_device.c +++ b/udev/udev_device.c @@ -34,48 +34,50 @@ #include "udev_rules.h" -struct udevice *udev_device_init(void) +struct udevice *udev_device_init(struct udev *udev) { - struct udevice *udev; + struct udevice *udevice; - udev = malloc(sizeof(struct udevice)); - if (udev == NULL) + udevice = malloc(sizeof(struct udevice)); + if (udevice == NULL) return NULL; - memset(udev, 0x00, sizeof(struct udevice)); + memset(udevice, 0x00, sizeof(struct udevice)); - INIT_LIST_HEAD(&udev->symlink_list); - INIT_LIST_HEAD(&udev->run_list); - INIT_LIST_HEAD(&udev->env_list); + udevice->udev = udev; + + INIT_LIST_HEAD(&udevice->symlink_list); + INIT_LIST_HEAD(&udevice->run_list); + INIT_LIST_HEAD(&udevice->env_list); /* set sysfs device to local storage, can be overridden if needed */ - udev->dev = &udev->dev_local; + udevice->dev = &udevice->dev_local; /* default node permissions */ - udev->mode = 0660; - strcpy(udev->owner, "root"); - strcpy(udev->group, "root"); + udevice->mode = 0660; + strcpy(udevice->owner, "root"); + strcpy(udevice->group, "root"); - udev->event_timeout = -1; - return udev; + udevice->event_timeout = -1; + return udevice; } -void udev_device_cleanup(struct udevice *udev) +void udev_device_cleanup(struct udevice *udevice) { - if (udev == NULL) + if (udevice == NULL) return; - name_list_cleanup(&udev->symlink_list); - name_list_cleanup(&udev->run_list); - name_list_cleanup(&udev->env_list); - free(udev); + name_list_cleanup(udevice->udev, &udevice->symlink_list); + name_list_cleanup(udevice->udev, &udevice->run_list); + name_list_cleanup(udevice->udev, &udevice->env_list); + free(udevice); } -dev_t udev_device_get_devt(struct udevice *udev) +dev_t udev_device_get_devt(struct udevice *udevice) { const char *attr; unsigned int maj, min; /* read it from sysfs */ - attr = sysfs_attr_get_value(udev->dev->devpath, "dev"); + attr = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, "dev"); if (attr != NULL) { if (sscanf(attr, "%u:%u", &maj, &min) == 2) return makedev(maj, min); diff --git a/udev/udev_device_event.c b/udev/udev_device_event.c index 8ad79644af..6b40623390 100644 --- a/udev/udev_device_event.c +++ b/udev/udev_device_event.c @@ -54,25 +54,25 @@ static void kernel_log(struct ifreq ifr) fclose(f); } -static int rename_netif(struct udevice *udev) +static int rename_netif(struct udevice *udevice) { int sk; struct ifreq ifr; int retval; - info("changing net interface name from '%s' to '%s'\n", udev->dev->kernel, udev->name); - if (udev->test_run) + info(udevice->udev, "changing net interface name from '%s' to '%s'\n", udevice->dev->kernel, udevice->name); + if (udevice->test_run) return 0; sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { - err("error opening socket: %s\n", strerror(errno)); + err(udevice->udev, "error opening socket: %s\n", strerror(errno)); return -1; } memset(&ifr, 0x00, sizeof(struct ifreq)); - strlcpy(ifr.ifr_name, udev->dev->kernel, IFNAMSIZ); - strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); + strlcpy(ifr.ifr_name, udevice->dev->kernel, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udevice->name, IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval == 0) kernel_log(ifr); @@ -81,22 +81,22 @@ static int rename_netif(struct udevice *udev) /* see if the destination interface name already exists */ if (errno != EEXIST) { - err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err(udevice->udev, "error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } /* free our own name, another process may wait for us */ - strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udevice->dev->kernel, IFNAMSIZ); strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) { - err("error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err(udevice->udev, "error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } /* wait 30 seconds for our target to become available */ strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); - strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ); + strlcpy(ifr.ifr_newname, udevice->name, IFNAMSIZ); loop = 30 * 20; while (loop--) { retval = ioctl(sk, SIOCSIFNAME, &ifr); @@ -106,11 +106,11 @@ static int rename_netif(struct udevice *udev) } if (errno != EEXIST) { - err("error changing net interface name %s to %s: %s\n", + err(udevice->udev, "error changing net interface name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); break; } - dbg("wait for netif '%s' to become free, loop=%i\n", udev->name, (30 * 20) - loop); + dbg(udevice->udev, "wait for netif '%s' to become free, loop=%i\n", udevice->name, (30 * 20) - loop); usleep(1000 * 1000 / 20); } } @@ -120,139 +120,139 @@ exit: return retval; } -int udev_device_event(struct udev_rules *rules, struct udevice *udev) +int udev_device_event(struct udev_rules *rules, struct udevice *udevice) { int retval = 0; - if (udev->devpath_old != NULL) - if (udev_db_rename(udev->devpath_old, udev->dev->devpath) == 0) - info("moved database from '%s' to '%s'\n", udev->devpath_old, udev->dev->devpath); + if (udevice->devpath_old != NULL) + if (udev_db_rename(udevice->udev, udevice->devpath_old, udevice->dev->devpath) == 0) + info(udevice->udev, "moved database from '%s' to '%s'\n", udevice->devpath_old, udevice->dev->devpath); /* add device node */ - if (major(udev->devt) != 0 && - (strcmp(udev->action, "add") == 0 || strcmp(udev->action, "change") == 0)) { - struct udevice *udev_old; + if (major(udevice->devt) != 0 && + (strcmp(udevice->action, "add") == 0 || strcmp(udevice->action, "change") == 0)) { + struct udevice *udevice_old; - dbg("device node add '%s'\n", udev->dev->devpath); + dbg(udevice->udev, "device node add '%s'\n", udevice->dev->devpath); - udev_rules_get_name(rules, udev); - if (udev->ignore_device) { - info("device event will be ignored\n"); + udev_rules_get_name(rules, udevice); + if (udevice->ignore_device) { + info(udevice->udev, "device event will be ignored\n"); goto exit; } - if (udev->name[0] == '\0') { - info("device node creation supressed\n"); + if (udevice->name[0] == '\0') { + info(udevice->udev, "device node creation supressed\n"); goto exit; } /* read current database entry; cleanup, if it is known device */ - udev_old = udev_device_init(); - if (udev_old != NULL) { - udev_old->test_run = udev->test_run; - if (udev_db_get_device(udev_old, udev->dev->devpath) == 0) { - info("device '%s' already in database, cleanup\n", udev->dev->devpath); - udev_db_delete_device(udev_old); + udevice_old = udev_device_init(udevice->udev); + if (udevice_old != NULL) { + udevice_old->test_run = udevice->test_run; + if (udev_db_get_device(udevice_old, udevice->dev->devpath) == 0) { + info(udevice->udev, "device '%s' already in database, cleanup\n", udevice->dev->devpath); + udev_db_delete_device(udevice_old); } else { - udev_device_cleanup(udev_old); - udev_old = NULL; + udev_device_cleanup(udevice_old); + udevice_old = NULL; } } /* create node */ - retval = udev_node_add(udev); + retval = udev_node_add(udevice); if (retval != 0) goto exit; /* store in database */ - udev_db_add_device(udev); + udev_db_add_device(udevice); /* create, replace, delete symlinks according to priority */ - udev_node_update_symlinks(udev, udev_old); + udev_node_update_symlinks(udevice, udevice_old); - if (udev_old != NULL) - udev_device_cleanup(udev_old); + if (udevice_old != NULL) + udev_device_cleanup(udevice_old); goto exit; } /* add netif */ - if (strcmp(udev->dev->subsystem, "net") == 0 && strcmp(udev->action, "add") == 0) { - dbg("netif add '%s'\n", udev->dev->devpath); - udev_rules_get_name(rules, udev); - if (udev->ignore_device) { - info("device event will be ignored\n"); + if (strcmp(udevice->dev->subsystem, "net") == 0 && strcmp(udevice->action, "add") == 0) { + dbg(udevice->udev, "netif add '%s'\n", udevice->dev->devpath); + udev_rules_get_name(rules, udevice); + if (udevice->ignore_device) { + info(udevice->udev, "device event will be ignored\n"); goto exit; } - if (udev->name[0] == '\0') { - info("device renaming supressed\n"); + if (udevice->name[0] == '\0') { + info(udevice->udev, "device renaming supressed\n"); goto exit; } /* look if we want to change the name of the netif */ - if (strcmp(udev->name, udev->dev->kernel) != 0) { + if (strcmp(udevice->name, udevice->dev->kernel) != 0) { char devpath[PATH_MAX]; char *pos; - retval = rename_netif(udev); + retval = rename_netif(udevice); if (retval != 0) goto exit; - info("renamed netif to '%s'\n", udev->name); + info(udevice->udev, "renamed netif to '%s'\n", udevice->name); /* export old name */ - setenv("INTERFACE_OLD", udev->dev->kernel, 1); + setenv("INTERFACE_OLD", udevice->dev->kernel, 1); /* now change the devpath, because the kernel device name has changed */ - strlcpy(devpath, udev->dev->devpath, sizeof(devpath)); + strlcpy(devpath, udevice->dev->devpath, sizeof(devpath)); pos = strrchr(devpath, '/'); if (pos != NULL) { pos[1] = '\0'; - strlcat(devpath, udev->name, sizeof(devpath)); - sysfs_device_set_values(udev->dev, devpath, NULL, NULL); - setenv("DEVPATH", udev->dev->devpath, 1); - setenv("INTERFACE", udev->name, 1); - info("changed devpath to '%s'\n", udev->dev->devpath); + strlcat(devpath, udevice->name, sizeof(devpath)); + sysfs_device_set_values(udevice->udev, udevice->dev, devpath, NULL, NULL); + setenv("DEVPATH", udevice->dev->devpath, 1); + setenv("INTERFACE", udevice->name, 1); + info(udevice->udev, "changed devpath to '%s'\n", udevice->dev->devpath); } } goto exit; } /* remove device node */ - if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) { + if (major(udevice->devt) != 0 && strcmp(udevice->action, "remove") == 0) { struct name_entry *name_loop; /* import database entry, and delete it */ - if (udev_db_get_device(udev, udev->dev->devpath) == 0) { - udev_db_delete_device(udev); + if (udev_db_get_device(udevice, udevice->dev->devpath) == 0) { + udev_db_delete_device(udevice); /* restore stored persistent data */ - list_for_each_entry(name_loop, &udev->env_list, node) + list_for_each_entry(name_loop, &udevice->env_list, node) putenv(name_loop->name); } else { - dbg("'%s' not found in database, using kernel name '%s'\n", - udev->dev->devpath, udev->dev->kernel); - strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); + dbg(udevice->udev, "'%s' not found in database, using kernel name '%s'\n", + udevice->dev->devpath, udevice->dev->kernel); + strlcpy(udevice->name, udevice->dev->kernel, sizeof(udevice->name)); } - udev_rules_get_run(rules, udev); - if (udev->ignore_device) { - info("device event will be ignored\n"); + udev_rules_get_run(rules, udevice); + if (udevice->ignore_device) { + info(udevice->udev, "device event will be ignored\n"); goto exit; } - if (udev->ignore_remove) { - info("ignore_remove for '%s'\n", udev->name); + if (udevice->ignore_remove) { + info(udevice->udev, "ignore_remove for '%s'\n", udevice->name); goto exit; } /* remove the node */ - retval = udev_node_remove(udev); + retval = udev_node_remove(udevice); /* delete or restore symlinks according to priority */ - udev_node_update_symlinks(udev, NULL); + udev_node_update_symlinks(udevice, NULL); goto exit; } /* default devices */ - udev_rules_get_run(rules, udev); - if (udev->ignore_device) - info("device event will be ignored\n"); + udev_rules_get_run(rules, udevice); + if (udevice->ignore_device) + info(udevice->udev, "device event will be ignored\n"); exit: return retval; diff --git a/udev/udev_node.c b/udev/udev_node.c index 33183c8d2a..462f1b633b 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -35,69 +35,68 @@ #define TMP_FILE_EXT ".udev-tmp" -int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) +int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) { char file_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; struct stat stats; int preserve = 0; int err = 0; - if (major(devt) != 0 && strcmp(udev->dev->subsystem, "block") == 0) + if (major(devt) != 0 && strcmp(udevice->dev->subsystem, "block") == 0) mode |= S_IFBLK; else mode |= S_IFCHR; if (lstat(file, &stats) == 0) { if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devt)) { - info("preserve file '%s', because it has correct dev_t\n", file); + info(udevice->udev, "preserve file '%s', because it has correct dev_t\n", file); preserve = 1; - selinux_setfilecon(file, udev->dev->kernel, mode); + selinux_setfilecon(udevice->udev, file, udevice->dev->kernel, mode); } else { - info("atomically replace existing file '%s'\n", file); + info(udevice->udev, "atomically replace existing file '%s'\n", file); strlcpy(file_tmp, file, sizeof(file_tmp)); strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); unlink(file_tmp); - selinux_setfscreatecon(file_tmp, udev->dev->kernel, mode); + selinux_setfscreatecon(udevice->udev, file_tmp, udevice->dev->kernel, mode); err = mknod(file_tmp, mode, devt); - selinux_resetfscreatecon(); + selinux_resetfscreatecon(udevice->udev); if (err != 0) { - err("mknod(%s, %#o, %u, %u) failed: %s\n", + err(udevice->udev, "mknod(%s, %#o, %u, %u) failed: %s\n", file_tmp, mode, major(devt), minor(devt), strerror(errno)); goto exit; } err = rename(file_tmp, file); if (err != 0) { - err("rename(%s, %s) failed: %s\n", - file_tmp, file, strerror(errno)); + err(udevice->udev, "rename(%s, %s) failed: %s\n", file_tmp, file, strerror(errno)); unlink(file_tmp); } } } else { - info("mknod(%s, %#o, (%u,%u))\n", file, mode, major(devt), minor(devt)); - selinux_setfscreatecon(file, udev->dev->kernel, mode); + info(udevice->udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devt), minor(devt)); + selinux_setfscreatecon(udevice->udev, file, udevice->dev->kernel, mode); err = mknod(file, mode, devt); - selinux_resetfscreatecon(); + selinux_resetfscreatecon(udevice->udev); if (err != 0) { - err("mknod(%s, %#o, (%u,%u) failed: %s\n", + err(udevice->udev, "mknod(%s, %#o, (%u,%u) failed: %s\n", file, mode, major(devt), minor(devt), strerror(errno)); goto exit; } } if (!preserve || stats.st_mode != mode) { - info("chmod(%s, %#o)\n", file, mode); + info(udevice->udev, "chmod(%s, %#o)\n", file, mode); err = chmod(file, mode); if (err != 0) { - err("chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); + err(udevice->udev, "chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); goto exit; } } if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { - info("chown(%s, %u, %u)\n", file, uid, gid); + info(udevice->udev, "chown(%s, %u, %u)\n", file, uid, gid); err = chown(file, uid, gid); if (err != 0) { - err("chown(%s, %u, %u) failed: %s\n", file, uid, gid, strerror(errno)); + err(udevice->udev, "chown(%s, %u, %u) failed: %s\n", file, uid, gid, strerror(errno)); goto exit; } } @@ -105,7 +104,7 @@ exit: return err; } -static int node_symlink(const char *node, const char *slink) +static int node_symlink(struct udevice *udevice, const char *node, const char *slink) { struct stat stats; char target[PATH_SIZE] = ""; @@ -133,53 +132,53 @@ static int node_symlink(const char *node, const char *slink) if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { struct stat stats2; - info("found existing node instead of symlink '%s'\n", slink); + info(udevice->udev, "found existing node instead of symlink '%s'\n", slink); if (lstat(node, &stats2) == 0) { if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && stats.st_rdev == stats2.st_rdev) { - info("replace device node '%s' with symlink to our node '%s'\n", slink, node); + info(udevice->udev, "replace device node '%s' with symlink to our node '%s'\n", slink, node); } else { - err("device node '%s' already exists, link to '%s' will not overwrite it\n", slink, node); + err(udevice->udev, "device node '%s' already exists, link to '%s' will not overwrite it\n", slink, node); goto exit; } } } else if (S_ISLNK(stats.st_mode)) { char buf[PATH_SIZE]; - info("found existing symlink '%s'\n", slink); + info(udevice->udev, "found existing symlink '%s'\n", slink); len = readlink(slink, buf, sizeof(buf)); if (len > 0) { buf[len] = '\0'; if (strcmp(target, buf) == 0) { - info("preserve already existing symlink '%s' to '%s'\n", slink, target); - selinux_setfilecon(slink, NULL, S_IFLNK); + info(udevice->udev, "preserve already existing symlink '%s' to '%s'\n", slink, target); + selinux_setfilecon(udevice->udev, slink, NULL, S_IFLNK); goto exit; } } } } else { - info("creating symlink '%s' to '%s'\n", slink, target); - selinux_setfscreatecon(slink, NULL, S_IFLNK); + info(udevice->udev, "creating symlink '%s' to '%s'\n", slink, target); + selinux_setfscreatecon(udevice->udev, slink, NULL, S_IFLNK); retval = symlink(target, slink); - selinux_resetfscreatecon(); + selinux_resetfscreatecon(udevice->udev); if (retval == 0) goto exit; } - info("atomically replace '%s'\n", slink); + info(udevice->udev, "atomically replace '%s'\n", slink); strlcpy(slink_tmp, slink, sizeof(slink_tmp)); strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); unlink(slink_tmp); - selinux_setfscreatecon(slink, NULL, S_IFLNK); + selinux_setfscreatecon(udevice->udev, slink, NULL, S_IFLNK); retval = symlink(target, slink_tmp); - selinux_resetfscreatecon(); + selinux_resetfscreatecon(udevice->udev); if (retval != 0) { - err("symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno)); + err(udevice->udev, "symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno)); goto exit; } retval = rename(slink_tmp, slink); if (retval != 0) { - err("rename(%s, %s) failed: %s\n", slink_tmp, slink, strerror(errno)); + err(udevice->udev, "rename(%s, %s) failed: %s\n", slink_tmp, slink, strerror(errno)); unlink(slink_tmp); goto exit; } @@ -187,100 +186,100 @@ exit: return retval; } -static int update_link(struct udevice *udev, const char *name) +static int update_link(struct udevice *udevice, const char *name) { LIST_HEAD(name_list); char slink[PATH_SIZE]; char node[PATH_SIZE]; - struct udevice *udev_db; + struct udevice *udevice_db; struct name_entry *device; char target[PATH_MAX] = ""; int count; int priority = 0; int rc = 0; - strlcpy(slink, udev_root, sizeof(slink)); + strlcpy(slink, udev_get_dev_path(udevice->udev), sizeof(slink)); strlcat(slink, "/", sizeof(slink)); strlcat(slink, name, sizeof(slink)); - count = udev_db_get_devices_by_name(name, &name_list); - info("found %i devices with name '%s'\n", count, name); + count = udev_db_get_devices_by_name(udevice->udev, name, &name_list); + info(udevice->udev, "found %i devices with name '%s'\n", count, name); /* if we don't have a reference, delete it */ if (count <= 0) { - info("no reference left, remove '%s'\n", name); - if (!udev->test_run) { + info(udevice->udev, "no reference left, remove '%s'\n", name); + if (!udevice->test_run) { unlink(slink); - delete_path(slink); + delete_path(udevice->udev, slink); } goto out; } /* find the device with the highest priority */ list_for_each_entry(device, &name_list, node) { - info("found '%s' for '%s'\n", device->name, name); + info(udevice->udev, "found '%s' for '%s'\n", device->name, name); /* did we find ourself? we win, if we have the same priority */ - if (strcmp(udev->dev->devpath, device->name) == 0) { - info("compare (our own) priority of '%s' %i >= %i\n", - udev->dev->devpath, udev->link_priority, priority); - if (strcmp(udev->name, name) == 0) { - info("'%s' is our device node, database inconsistent, skip link update\n", udev->name); - } else if (target[0] == '\0' || udev->link_priority >= priority) { - priority = udev->link_priority; - strlcpy(target, udev->name, sizeof(target)); + if (strcmp(udevice->dev->devpath, device->name) == 0) { + info(udevice->udev, "compare (our own) priority of '%s' %i >= %i\n", + udevice->dev->devpath, udevice->link_priority, priority); + if (strcmp(udevice->name, name) == 0) { + info(udevice->udev, "'%s' is our device node, database inconsistent, skip link update\n", udevice->name); + } else if (target[0] == '\0' || udevice->link_priority >= priority) { + priority = udevice->link_priority; + strlcpy(target, udevice->name, sizeof(target)); } continue; } /* another device, read priority from database */ - udev_db = udev_device_init(); - if (udev_db == NULL) + udevice_db = udev_device_init(udevice->udev); + if (udevice_db == NULL) continue; - if (udev_db_get_device(udev_db, device->name) == 0) { - if (strcmp(udev_db->name, name) == 0) { - info("'%s' is a device node of '%s', skip link update\n", udev_db->name, device->name); + if (udev_db_get_device(udevice_db, device->name) == 0) { + if (strcmp(udevice_db->name, name) == 0) { + info(udevice->udev, "'%s' is a device node of '%s', skip link update\n", udevice_db->name, device->name); } else { - info("compare priority of '%s' %i > %i\n", - udev_db->dev->devpath, udev_db->link_priority, priority); - if (target[0] == '\0' || udev_db->link_priority > priority) { - priority = udev_db->link_priority; - strlcpy(target, udev_db->name, sizeof(target)); + info(udevice->udev, "compare priority of '%s' %i > %i\n", + udevice_db->dev->devpath, udevice_db->link_priority, priority); + if (target[0] == '\0' || udevice_db->link_priority > priority) { + priority = udevice_db->link_priority; + strlcpy(target, udevice_db->name, sizeof(target)); } } } - udev_device_cleanup(udev_db); + udev_device_cleanup(udevice_db); } - name_list_cleanup(&name_list); + name_list_cleanup(udevice->udev, &name_list); if (target[0] == '\0') { - info("no current target for '%s' found\n", name); + info(udevice->udev, "no current target for '%s' found\n", name); rc = 1; goto out; } /* create symlink to the target with the highest priority */ - strlcpy(node, udev_root, sizeof(node)); + strlcpy(node, udev_get_dev_path(udevice->udev), sizeof(node)); strlcat(node, "/", sizeof(node)); strlcat(node, target, sizeof(node)); - info("'%s' with target '%s' has the highest priority %i, create it\n", name, target, priority); - if (!udev->test_run) { - create_path(slink); - node_symlink(node, slink); + info(udevice->udev, "'%s' with target '%s' has the highest priority %i, create it\n", name, target, priority); + if (!udevice->test_run) { + create_path(udevice->udev, slink); + node_symlink(udevice, node, slink); } out: return rc; } -void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) +void udev_node_update_symlinks(struct udevice *udevice, struct udevice *udevice_old) { struct name_entry *name_loop; char symlinks[PATH_SIZE] = ""; - list_for_each_entry(name_loop, &udev->symlink_list, node) { - info("update symlink '%s' of '%s'\n", name_loop->name, udev->dev->devpath); - update_link(udev, name_loop->name); - strlcat(symlinks, udev_root, sizeof(symlinks)); + list_for_each_entry(name_loop, &udevice->symlink_list, node) { + info(udevice->udev, "update symlink '%s' of '%s'\n", name_loop->name, udevice->dev->devpath); + update_link(udevice, name_loop->name); + strlcat(symlinks, udev_get_dev_path(udevice->udev), sizeof(symlinks)); strlcat(symlinks, "/", sizeof(symlinks)); strlcat(symlinks, name_loop->name, sizeof(symlinks)); strlcat(symlinks, " ", sizeof(symlinks)); @@ -292,15 +291,15 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) setenv("DEVLINKS", symlinks, 1); /* update possible left-over symlinks (device metadata changed) */ - if (udev_old != NULL) { + if (udevice_old != NULL) { struct name_entry *link_loop; struct name_entry *link_old_loop; int found; /* remove current symlinks from old list */ - list_for_each_entry(link_old_loop, &udev_old->symlink_list, node) { + list_for_each_entry(link_old_loop, &udevice_old->symlink_list, node) { found = 0; - list_for_each_entry(link_loop, &udev->symlink_list, node) { + list_for_each_entry(link_loop, &udevice->symlink_list, node) { if (strcmp(link_old_loop->name, link_loop->name) == 0) { found = 1; break; @@ -308,9 +307,9 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) } if (!found) { /* link does no longer belong to this device */ - info("update old symlink '%s' no longer belonging to '%s'\n", - link_old_loop->name, udev->dev->devpath); - update_link(udev, link_old_loop->name); + info(udevice->udev, "update old symlink '%s' no longer belonging to '%s'\n", + link_old_loop->name, udevice->dev->devpath); + update_link(udevice, link_old_loop->name); } } @@ -318,12 +317,12 @@ void udev_node_update_symlinks(struct udevice *udev, struct udevice *udev_old) * if the node name has changed, delete the node, * or possibly restore a symlink of another device */ - if (strcmp(udev->name, udev_old->name) != 0) - update_link(udev, udev_old->name); + if (strcmp(udevice->name, udevice_old->name) != 0) + update_link(udevice, udevice_old->name); } } -int udev_node_add(struct udevice *udev) +int udev_node_add(struct udevice *udevice) { char filename[PATH_SIZE]; uid_t uid; @@ -331,42 +330,42 @@ int udev_node_add(struct udevice *udev) int i; int retval = 0; - strlcpy(filename, udev_root, sizeof(filename)); + strlcpy(filename, udev_get_dev_path(udevice->udev), sizeof(filename)); strlcat(filename, "/", sizeof(filename)); - strlcat(filename, udev->name, sizeof(filename)); - create_path(filename); + strlcat(filename, udevice->name, sizeof(filename)); + create_path(udevice->udev, filename); - if (strcmp(udev->owner, "root") == 0) + if (strcmp(udevice->owner, "root") == 0) uid = 0; else { char *endptr; unsigned long id; - id = strtoul(udev->owner, &endptr, 10); + id = strtoul(udevice->owner, &endptr, 10); if (endptr[0] == '\0') uid = (uid_t) id; else - uid = lookup_user(udev->owner); + uid = lookup_user(udevice->udev, udevice->owner); } - if (strcmp(udev->group, "root") == 0) + if (strcmp(udevice->group, "root") == 0) gid = 0; else { char *endptr; unsigned long id; - id = strtoul(udev->group, &endptr, 10); + id = strtoul(udevice->group, &endptr, 10); if (endptr[0] == '\0') gid = (gid_t) id; else - gid = lookup_group(udev->group); + gid = lookup_group(udevice->udev, udevice->group); } - info("creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d\n", - filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid); + info(udevice->udev, "creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d\n", + filename, major(udevice->devt), minor(udevice->devt), udevice->mode, uid, gid); - if (!udev->test_run) - if (udev_node_mknod(udev, filename, udev->devt, udev->mode, uid, gid) != 0) { + if (!udevice->test_run) + if (udev_node_mknod(udevice, filename, udevice->devt, udevice->mode, uid, gid) != 0) { retval = -1; goto exit; } @@ -374,27 +373,27 @@ int udev_node_add(struct udevice *udev) setenv("DEVNAME", filename, 1); /* create all_partitions if requested */ - if (udev->partitions) { + if (udevice->partitions) { char partitionname[PATH_SIZE]; char *attr; int range; /* take the maximum registered minor range */ - attr = sysfs_attr_get_value(udev->dev->devpath, "range"); + attr = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, "range"); if (attr != NULL) { range = atoi(attr); if (range > 1) - udev->partitions = range-1; + udevice->partitions = range-1; } - info("creating device partition nodes '%s[1-%i]'\n", filename, udev->partitions); - if (!udev->test_run) { - for (i = 1; i <= udev->partitions; i++) { + info(udevice->udev, "creating device partition nodes '%s[1-%i]'\n", filename, udevice->partitions); + if (!udevice->test_run) { + for (i = 1; i <= udevice->partitions; i++) { dev_t part_devt; snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); partitionname[sizeof(partitionname)-1] = '\0'; - part_devt = makedev(major(udev->devt), minor(udev->devt) + i); - udev_node_mknod(udev, partitionname, part_devt, udev->mode, uid, gid); + part_devt = makedev(major(udevice->devt), minor(udevice->devt) + i); + udev_node_mknod(udevice, partitionname, part_devt, udevice->mode, uid, gid); } } } @@ -402,7 +401,7 @@ exit: return retval; } -int udev_node_remove(struct udevice *udev) +int udev_node_remove(struct udevice *udevice) { char filename[PATH_SIZE]; char partitionname[PATH_SIZE]; @@ -410,39 +409,39 @@ int udev_node_remove(struct udevice *udev) int retval = 0; int num; - strlcpy(filename, udev_root, sizeof(filename)); + strlcpy(filename, udev_get_dev_path(udevice->udev), sizeof(filename)); strlcat(filename, "/", sizeof(filename)); - strlcat(filename, udev->name, sizeof(filename)); + strlcat(filename, udevice->name, sizeof(filename)); if (stat(filename, &stats) != 0) { - info("device node '%s' not found\n", filename); + info(udevice->udev, "device node '%s' not found\n", filename); return 0; } - if (udev->devt && stats.st_rdev != udev->devt) { - info("device node '%s' points to a different device, skip removal\n", filename); + if (udevice->devt && stats.st_rdev != udevice->devt) { + info(udevice->udev, "device node '%s' points to a different device, skip removal\n", filename); return -1; } - info("removing device node '%s'\n", filename); - if (!udev->test_run) - retval = unlink_secure(filename); + info(udevice->udev, "removing device node '%s'\n", filename); + if (!udevice->test_run) + retval = unlink_secure(udevice->udev, filename); if (retval) return retval; setenv("DEVNAME", filename, 1); - num = udev->partitions; + num = udevice->partitions; if (num > 0) { int i; - info("removing all_partitions '%s[1-%i]'\n", filename, num); + info(udevice->udev, "removing all_partitions '%s[1-%i]'\n", filename, num); if (num > 255) return -1; for (i = 1; i <= num; i++) { snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); partitionname[sizeof(partitionname)-1] = '\0'; - if (!udev->test_run) - unlink_secure(partitionname); + if (!udevice->test_run) + unlink_secure(udevice->udev, partitionname); } } - delete_path(filename); + delete_path(udevice->udev, filename); return retval; } diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 4719cab5b8..b864599a9d 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -40,7 +40,7 @@ extern char **environ; /* extract possible {attr} and move str behind it */ -static char *get_format_attribute(char **str) +static char *get_format_attribute(struct udev *udev, char **str) { char *pos; char *attr = NULL; @@ -48,19 +48,19 @@ static char *get_format_attribute(char **str) if (*str[0] == '{') { pos = strchr(*str, '}'); if (pos == NULL) { - err("missing closing brace for format\n"); + err(udev, "missing closing brace for format\n"); return NULL; } pos[0] = '\0'; attr = *str+1; *str = pos+1; - dbg("attribute='%s', str='%s'\n", attr, *str); + dbg(udev, "attribute='%s', str='%s'\n", attr, *str); } return attr; } /* extract possible format length and move str behind it*/ -static int get_format_len(char **str) +static int get_format_len(struct udev *udev, char **str) { int num; char *tail; @@ -69,10 +69,10 @@ static int get_format_len(char **str) num = (int) strtoul(*str, &tail, 10); if (num > 0) { *str = tail; - dbg("format length=%i\n", num); + dbg(udev, "format length=%i\n", num); return num; } else { - err("format parsing error '%s'\n", *str); + err(udev, "format parsing error '%s'\n", *str); } } return -1; @@ -118,8 +118,8 @@ out: return 0; } -static int run_program(const char *command, const char *subsystem, - char *result, size_t ressize, size_t *reslen) +static int run_program(struct udev *udev, const char *command, const char *subsystem, + char *result, size_t ressize, size_t *reslen) { int status; int outpipe[2] = {-1, -1}; @@ -148,7 +148,7 @@ static int run_program(const char *command, const char *subsystem, } else { argv[i] = strsep(&pos, " "); } - dbg("arg[%i] '%s'\n", i, argv[i]); + dbg(udev, "arg[%i] '%s'\n", i, argv[i]); i++; } argv[i] = NULL; @@ -156,18 +156,18 @@ static int run_program(const char *command, const char *subsystem, argv[0] = arg; argv[1] = NULL; } - info("'%s'\n", command); + info(udev, "'%s'\n", command); /* prepare pipes from child to parent */ - if (result != NULL || udev_log_priority >= LOG_INFO) { + if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { if (pipe(outpipe) != 0) { - err("pipe failed: %s\n", strerror(errno)); + err(udev, "pipe failed: %s\n", strerror(errno)); return -1; } } - if (udev_log_priority >= LOG_INFO) { + if (udev_get_log_priority(udev) >= LOG_INFO) { if (pipe(errpipe) != 0) { - err("pipe failed: %s\n", strerror(errno)); + err(udev, "pipe failed: %s\n", strerror(errno)); return -1; } } @@ -198,7 +198,7 @@ static int run_program(const char *command, const char *subsystem, dup2(devnull, STDERR_FILENO); close(devnull); } else - err("open /dev/null failed: %s\n", strerror(errno)); + err(udev, "open /dev/null failed: %s\n", strerror(errno)); if (outpipe[WRITE_END] > 0) { dup2(outpipe[WRITE_END], STDOUT_FILENO); close(outpipe[WRITE_END]); @@ -210,14 +210,14 @@ static int run_program(const char *command, const char *subsystem, execv(argv[0], argv); if (errno == ENOENT || errno == ENOTDIR) { /* may be on a filesytem which is not mounted right now */ - info("program '%s' not found\n", argv[0]); + info(udev, "program '%s' not found\n", argv[0]); } else { /* other problems */ - err("exec of program '%s' failed\n", argv[0]); + err(udev, "exec of program '%s' failed\n", argv[0]); } _exit(1); case -1: - err("fork of '%s' failed: %s\n", argv[0], strerror(errno)); + err(udev, "fork of '%s' failed: %s\n", argv[0], strerror(errno)); return -1; default: /* read from child if requested */ @@ -260,7 +260,7 @@ static int run_program(const char *command, const char *subsystem, close(outpipe[READ_END]); outpipe[READ_END] = -1; if (count < 0) { - err("stdin read failed: %s\n", strerror(errno)); + err(udev, "stdin read failed: %s\n", strerror(errno)); retval = -1; } continue; @@ -273,14 +273,14 @@ static int run_program(const char *command, const char *subsystem, memcpy(&result[respos], inbuf, count); respos += count; } else { - err("ressize %ld too short\n", (long)ressize); + err(udev, "ressize %ld too short\n", (long)ressize); retval = -1; } } pos = inbuf; while ((line = strsep(&pos, "\n"))) if (pos || line[0] != '\0') - info("'%s' (stdout) '%s'\n", argv[0], line); + info(udev, "'%s' (stdout) '%s'\n", argv[0], line); } /* get stderr */ @@ -294,14 +294,14 @@ static int run_program(const char *command, const char *subsystem, close(errpipe[READ_END]); errpipe[READ_END] = -1; if (count < 0) - err("stderr read failed: %s\n", strerror(errno)); + err(udev, "stderr read failed: %s\n", strerror(errno)); continue; } errbuf[count] = '\0'; pos = errbuf; while ((line = strsep(&pos, "\n"))) if (pos || line[0] != '\0') - info("'%s' (stderr) '%s'\n", argv[0], line); + info(udev, "'%s' (stderr) '%s'\n", argv[0], line); } } if (outpipe[READ_END] > 0) @@ -312,18 +312,18 @@ static int run_program(const char *command, const char *subsystem, /* return the childs stdout string */ if (result) { result[respos] = '\0'; - dbg("result='%s'\n", result); + dbg(udev, "result='%s'\n", result); if (reslen) *reslen = respos; } } waitpid(pid, &status, 0); if (WIFEXITED(status)) { - info("'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); + info(udev, "'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); if (WEXITSTATUS(status) != 0) retval = -1; } else { - err("'%s' abnormal exit\n", argv[0]); + err(udev, "'%s' abnormal exit\n", argv[0]); retval = -1; } } @@ -331,7 +331,7 @@ static int run_program(const char *command, const char *subsystem, return retval; } -static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bufsize) +static int import_keys_into_env(struct udevice *udevice, const char *buf, size_t bufsize) { char line[LINE_SIZE]; const char *bufline; @@ -364,7 +364,7 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu continue; if (count >= sizeof(line)) { - err("line too long, conf line skipped %s, line %d\n", udev_config_filename, lineno); + err(udevice->udev, "line too long, skipped\n"); continue; } @@ -373,14 +373,14 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu linepos = line; if (get_key(&linepos, &variable, &value) == 0) { - dbg("import '%s=%s'\n", variable, value); + dbg(udevice->udev, "import '%s=%s'\n", variable, value); /* handle device, renamed by external tool, returning new path */ if (strcmp(variable, "DEVPATH") == 0) { - info("updating devpath from '%s' to '%s'\n", udev->dev->devpath, value); - sysfs_device_set_values(udev->dev, value, NULL, NULL); + info(udevice->udev, "updating devpath from '%s' to '%s'\n", udevice->dev->devpath, value); + sysfs_device_set_values(udevice->udev, udevice->dev, value, NULL, NULL); } else - name_list_key_add(&udev->env_list, variable, value); + name_list_key_add(udevice->udev, &udevice->env_list, variable, value); setenv(variable, value, 1); } } @@ -388,48 +388,48 @@ static int import_keys_into_env(struct udevice *udev, const char *buf, size_t bu return 0; } -static int import_file_into_env(struct udevice *udev, const char *filename) +static int import_file_into_env(struct udevice *udevice, const char *filename) { char *buf; size_t bufsize; if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s': %s\n", filename, strerror(errno)); + err(udevice->udev, "can't open '%s': %s\n", filename, strerror(errno)); return -1; } - import_keys_into_env(udev, buf, bufsize); + import_keys_into_env(udevice, buf, bufsize); file_unmap(buf, bufsize); return 0; } -static int import_program_into_env(struct udevice *udev, const char *program) +static int import_program_into_env(struct udevice *udevice, const char *program) { char result[2048]; size_t reslen; - if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen) != 0) + if (run_program(udevice->udev, program, udevice->dev->subsystem, result, sizeof(result), &reslen) != 0) return -1; - return import_keys_into_env(udev, result, reslen); + return import_keys_into_env(udevice, result, reslen); } -static int import_parent_into_env(struct udevice *udev, const char *filter) +static int import_parent_into_env(struct udevice *udevice, const char *filter) { struct sysfs_device *dev_parent; int rc = -1; - dev_parent = sysfs_device_get_parent(udev->dev); + dev_parent = sysfs_device_get_parent(udevice->udev, udevice->dev); if (dev_parent != NULL) { struct udevice *udev_parent; struct name_entry *name_loop; - dbg("found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(); + dbg(udevice->udev, "found parent '%s', get the node name\n", dev_parent->devpath); + udev_parent = udev_device_init(udevice->udev); if (udev_parent == NULL) return -1; /* import the udev_db of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { - dbg("import stored parent env '%s'\n", udev_parent->name); + dbg(udevice->udev, "import stored parent env '%s'\n", udev_parent->name); list_for_each_entry(name_loop, &udev_parent->env_list, node) { char name[NAME_SIZE]; char *pos; @@ -440,23 +440,23 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) pos[0] = '\0'; pos++; if (fnmatch(filter, name, 0) == 0) { - dbg("import key '%s'\n", name_loop->name); - name_list_add(&udev->env_list, name_loop->name, 0); + dbg(udevice->udev, "import key '%s'\n", name_loop->name); + name_list_add(udevice->udev, &udevice->env_list, name_loop->name, 0); setenv(name, pos, 1); } else - dbg("skip key '%s'\n", name_loop->name); + dbg(udevice->udev, "skip key '%s'\n", name_loop->name); } } rc = 0; } else - dbg("parent not found in database\n"); + dbg(udevice->udev, "parent not found in database\n"); udev_device_cleanup(udev_parent); } return rc; } -static int pass_env_to_socket(const char *sockpath, const char *devpath, const char *action) +static int pass_env_to_socket(struct udev *udev, const char *sockpath, const char *devpath, const char *action) { int sock; struct sockaddr_un saddr; @@ -468,7 +468,7 @@ static int pass_env_to_socket(const char *sockpath, const char *devpath, const c ssize_t count; int retval = 0; - dbg("pass environment to socket '%s'\n", sockpath); + dbg(udev, "pass environment to socket '%s'\n", sockpath); sock = socket(AF_LOCAL, SOCK_DGRAM, 0); memset(&saddr, 0x00, sizeof(struct sockaddr_un)); saddr.sun_family = AF_LOCAL; @@ -498,27 +498,27 @@ static int pass_env_to_socket(const char *sockpath, const char *devpath, const c count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); if (count < 0) retval = -1; - info("passed %zi bytes to socket '%s', \n", count, sockpath); + info(udev, "passed %zi bytes to socket '%s', \n", count, sockpath); close(sock); return retval; } -int udev_rules_run(struct udevice *udev) +int udev_rules_run(struct udevice *udevice) { struct name_entry *name_loop; int retval = 0; - dbg("executing run list\n"); - list_for_each_entry(name_loop, &udev->run_list, node) { + dbg(udevice->udev, "executing run list\n"); + list_for_each_entry(name_loop, &udevice->run_list, node) { if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) { - pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, udev->action); + pass_env_to_socket(udevice->udev, &name_loop->name[strlen("socket:")], udevice->dev->devpath, udevice->action); } else { char program[PATH_SIZE]; strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - if (run_program(program, udev->dev->subsystem, NULL, 0, NULL) != 0) + udev_rules_apply_format(udevice, program, sizeof(program)); + if (run_program(udevice->udev, program, udevice->dev->subsystem, NULL, 0, NULL) != 0) if (!name_loop->ignore_error) retval = -1; } @@ -528,7 +528,7 @@ int udev_rules_run(struct udevice *udev) } #define WAIT_LOOP_PER_SECOND 50 -static int wait_for_file(struct udevice *udev, const char *file, int timeout) +static int wait_for_file(struct udevice *udevice, const char *file, int timeout) { char filepath[PATH_SIZE]; char devicepath[PATH_SIZE] = ""; @@ -537,8 +537,8 @@ static int wait_for_file(struct udevice *udev, const char *file, int timeout) /* a relative path is a device attribute */ if (file[0] != '/') { - strlcpy(devicepath, sysfs_path, sizeof(devicepath)); - strlcat(devicepath, udev->dev->devpath, sizeof(devicepath)); + strlcpy(devicepath, udev_get_sys_path(udevice->udev), sizeof(devicepath)); + strlcat(devicepath, udevice->dev->devpath, sizeof(devicepath)); strlcpy(filepath, devicepath, sizeof(filepath)); strlcat(filepath, "/", sizeof(filepath)); @@ -546,27 +546,27 @@ static int wait_for_file(struct udevice *udev, const char *file, int timeout) file = filepath; } - dbg("will wait %i sec for '%s'\n", timeout, file); + dbg(udevice->udev, "will wait %i sec for '%s'\n", timeout, file); while (--loop) { /* lookup file */ if (stat(file, &stats) == 0) { - info("file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + info(udevice->udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } /* make sure, the device did not disappear in the meantime */ if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { - info("device disappeared while waiting for '%s'\n", file); + info(udevice->udev, "device disappeared while waiting for '%s'\n", file); return -2; } - info("wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); + info(udevice->udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - info("waiting for '%s' failed\n", file); + info(udevice->udev, "waiting for '%s' failed\n", file); return -1; } /* handle "[$SUBSYSTEM/$KERNEL]" lookup */ -static int attr_get_by_subsys_id(const char *attrstr, char *devpath, size_t len, char **attr) +static int attr_get_by_subsys_id(struct udev *udev, const char *attrstr, char *devpath, size_t len, char **attr) { char subsys[NAME_SIZE]; char *pos; @@ -592,7 +592,7 @@ static int attr_get_by_subsys_id(const char *attrstr, char *devpath, size_t len, goto out; id[0] = '\0'; id = &id[1]; - if (sysfs_lookup_devpath_by_subsys_id(devpath, len, subsys, id)) { + if (sysfs_lookup_devpath_by_subsys_id(udev, devpath, len, subsys, id)) { if (attr != NULL) { if (attrib[0] != '\0') *attr = attrib; @@ -643,7 +643,7 @@ static int attr_subst_subdir(char *attr, size_t len) return found; } -void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) +void udev_rules_apply_format(struct udevice *udevice, char *string, size_t maxsize) { char temp[PATH_SIZE]; char temp2[PATH_SIZE]; @@ -716,12 +716,12 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { type = subst->type; tail = head + strlen(subst->name)+1; - dbg("will substitute format name '%s'\n", subst->name); + dbg(udevice->udev, "will substitute format name '%s'\n", subst->name); goto found; } } head[0] = '$'; - err("unknown format variable '%s'\n", head); + err(udevice->udev, "unknown format variable '%s'\n", head); } else if (head[0] == '%') { /* substitute format char */ if (head[1] == '\0') @@ -734,71 +734,71 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize) } head[0] = '\0'; tail = head+1; - len = get_format_len(&tail); + len = get_format_len(udevice->udev, &tail); for (subst = map; subst->name; subst++) { if (tail[0] == subst->fmt) { type = subst->type; tail++; - dbg("will substitute format char '%c'\n", subst->fmt); + dbg(udevice->udev, "will substitute format char '%c'\n", subst->fmt); goto found; } } head[0] = '%'; - err("unknown format char '%c'\n", tail[0]); + err(udevice->udev, "unknown format char '%c'\n", tail[0]); } head++; } break; found: - attr = get_format_attribute(&tail); + attr = get_format_attribute(udevice->udev, &tail); strlcpy(temp, tail, sizeof(temp)); - dbg("format=%i, string='%s', tail='%s'\n", type ,string, tail); + dbg(udevice->udev, "format=%i, string='%s', tail='%s'\n", type ,string, tail); switch (type) { case SUBST_DEVPATH: - strlcat(string, udev->dev->devpath, maxsize); - dbg("substitute devpath '%s'\n", udev->dev->devpath); + strlcat(string, udevice->dev->devpath, maxsize); + dbg(udevice->udev, "substitute devpath '%s'\n", udevice->dev->devpath); break; case SUBST_KERNEL: - strlcat(string, udev->dev->kernel, maxsize); - dbg("substitute kernel name '%s'\n", udev->dev->kernel); + strlcat(string, udevice->dev->kernel, maxsize); + dbg(udevice->udev, "substitute kernel name '%s'\n", udevice->dev->kernel); break; case SUBST_KERNEL_NUMBER: - strlcat(string, udev->dev->kernel_number, maxsize); - dbg("substitute kernel number '%s'\n", udev->dev->kernel_number); + strlcat(string, udevice->dev->kernel_number, maxsize); + dbg(udevice->udev, "substitute kernel number '%s'\n", udevice->dev->kernel_number); break; case SUBST_ID: - if (udev->dev_parent != NULL) { - strlcat(string, udev->dev_parent->kernel, maxsize); - dbg("substitute id '%s'\n", udev->dev_parent->kernel); + if (udevice->dev_parent != NULL) { + strlcat(string, udevice->dev_parent->kernel, maxsize); + dbg(udevice->udev, "substitute id '%s'\n", udevice->dev_parent->kernel); } break; case SUBST_DRIVER: - if (udev->dev_parent != NULL) { - strlcat(string, udev->dev_parent->driver, maxsize); - dbg("substitute driver '%s'\n", udev->dev_parent->driver); + if (udevice->dev_parent != NULL) { + strlcat(string, udevice->dev_parent->driver, maxsize); + dbg(udevice->udev, "substitute driver '%s'\n", udevice->dev_parent->driver); } break; case SUBST_MAJOR: - sprintf(temp2, "%d", major(udev->devt)); + sprintf(temp2, "%d", major(udevice->devt)); strlcat(string, temp2, maxsize); - dbg("substitute major number '%s'\n", temp2); + dbg(udevice->udev, "substitute major number '%s'\n", temp2); break; case SUBST_MINOR: - sprintf(temp2, "%d", minor(udev->devt)); + sprintf(temp2, "%d", minor(udevice->devt)); strlcat(string, temp2, maxsize); - dbg("substitute minor number '%s'\n", temp2); + dbg(udevice->udev, "substitute minor number '%s'\n", temp2); break; case SUBST_RESULT: - if (udev->program_result[0] == '\0') + if (udevice->program_result[0] == '\0') break; /* get part part of the result string */ i = 0; if (attr != NULL) i = strtoul(attr, &rest, 10); if (i > 0) { - dbg("request part #%d of result string\n", i); - cpos = udev->program_result; + dbg(udevice->udev, "request part #%d of result string\n", i); + cpos = udevice->program_result; while (--i) { while (cpos[0] != '\0' && !isspace(cpos[0])) cpos++; @@ -806,7 +806,7 @@ found: cpos++; } if (i > 0) { - err("requested part of result string not found\n"); + err(udevice->udev, "requested part of result string not found\n"); break; } strlcpy(temp2, cpos, sizeof(temp2)); @@ -817,44 +817,44 @@ found: cpos[0] = '\0'; } strlcat(string, temp2, maxsize); - dbg("substitute part of result string '%s'\n", temp2); + dbg(udevice->udev, "substitute part of result string '%s'\n", temp2); } else { - strlcat(string, udev->program_result, maxsize); - dbg("substitute result string '%s'\n", udev->program_result); + strlcat(string, udevice->program_result, maxsize); + dbg(udevice->udev, "substitute result string '%s'\n", udevice->program_result); } break; case SUBST_ATTR: if (attr == NULL) - err("missing file parameter for attr\n"); + err(udevice->udev, "missing file parameter for attr\n"); else { char devpath[PATH_SIZE]; char *attrib; const char *value = NULL; size_t size; - if (attr_get_by_subsys_id(attr, devpath, sizeof(devpath), &attrib)) { + if (attr_get_by_subsys_id(udevice->udev, attr, devpath, sizeof(devpath), &attrib)) { if (attrib != NULL) - value = sysfs_attr_get_value(devpath, attrib); + value = sysfs_attr_get_value(udevice->udev, devpath, attrib); else break; } /* try the current device, other matches may have selected */ - if (value == NULL && udev->dev_parent != NULL && udev->dev_parent != udev->dev) - value = sysfs_attr_get_value(udev->dev_parent->devpath, attr); + if (value == NULL && udevice->dev_parent != NULL && udevice->dev_parent != udevice->dev) + value = sysfs_attr_get_value(udevice->udev, udevice->dev_parent->devpath, attr); /* look at all devices along the chain of parents */ if (value == NULL) { - struct sysfs_device *dev_parent = udev->dev; + struct sysfs_device *dev_parent = udevice->dev; do { - dbg("looking at '%s'\n", dev_parent->devpath); - value = sysfs_attr_get_value(dev_parent->devpath, attr); + dbg(udevice->udev, "looking at '%s'\n", dev_parent->devpath); + value = sysfs_attr_get_value(udevice->udev, dev_parent->devpath, attr); if (value != NULL) { strlcpy(temp2, value, sizeof(temp2)); break; } - dev_parent = sysfs_device_get_parent(dev_parent); + dev_parent = sysfs_device_get_parent(udevice->udev, dev_parent); } while (dev_parent != NULL); } @@ -869,59 +869,59 @@ found: temp2[--size] = '\0'; count = replace_chars(temp2, ALLOWED_CHARS_INPUT); if (count > 0) - info("%i character(s) replaced\n" , count); + info(udevice->udev, "%i character(s) replaced\n" , count); strlcat(string, temp2, maxsize); - dbg("substitute sysfs value '%s'\n", temp2); + dbg(udevice->udev, "substitute sysfs value '%s'\n", temp2); } break; case SUBST_PARENT: { struct sysfs_device *dev_parent; - dev_parent = sysfs_device_get_parent(udev->dev); + dev_parent = sysfs_device_get_parent(udevice->udev, udevice->dev); if (dev_parent != NULL) { struct udevice *udev_parent; - dbg("found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(); + dbg(udevice->udev, "found parent '%s', get the node name\n", dev_parent->devpath); + udev_parent = udev_device_init(udevice->udev); if (udev_parent != NULL) { /* lookup the name in the udev_db with the DEVPATH of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { strlcat(string, udev_parent->name, maxsize); - dbg("substitute parent node name'%s'\n", udev_parent->name); + dbg(udevice->udev, "substitute parent node name'%s'\n", udev_parent->name); } else - dbg("parent not found in database\n"); + dbg(udevice->udev, "parent not found in database\n"); udev_device_cleanup(udev_parent); } } } break; case SUBST_TEMP_NODE: - if (udev->tmp_node[0] == '\0' && major(udev->devt) > 0) { - dbg("create temporary device node for callout\n"); - snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u", - udev_root, major(udev->devt), minor(udev->devt)); - udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0'; - udev_node_mknod(udev, udev->tmp_node, udev->devt, 0600, 0, 0); + if (udevice->tmp_node[0] == '\0' && major(udevice->devt) > 0) { + dbg(udevice->udev, "create temporary device node for callout\n"); + snprintf(udevice->tmp_node, sizeof(udevice->tmp_node), "%s/.tmp-%u-%u", + udev_get_dev_path(udevice->udev), major(udevice->devt), minor(udevice->devt)); + udevice->tmp_node[sizeof(udevice->tmp_node)-1] = '\0'; + udev_node_mknod(udevice, udevice->tmp_node, udevice->devt, 0600, 0, 0); } - strlcat(string, udev->tmp_node, maxsize); - dbg("substitute temporary device node name '%s'\n", udev->tmp_node); + strlcat(string, udevice->tmp_node, maxsize); + dbg(udevice->udev, "substitute temporary device node name '%s'\n", udevice->tmp_node); break; case SUBST_NAME: - if (udev->name[0] == '\0') { - strlcat(string, udev->dev->kernel, maxsize); - dbg("substitute udev->kernel '%s'\n", udev->name); + if (udevice->name[0] == '\0') { + strlcat(string, udevice->dev->kernel, maxsize); + dbg(udevice->udev, "substitute udevice->kernel '%s'\n", udevice->name); } else { - strlcat(string, udev->name, maxsize); - dbg("substitute udev->name '%s'\n", udev->name); + strlcat(string, udevice->name, maxsize); + dbg(udevice->udev, "substitute udevice->name '%s'\n", udevice->name); } break; case SUBST_LINKS: - if (!list_empty(&udev->symlink_list)) { + if (!list_empty(&udevice->symlink_list)) { struct name_entry *name_loop; char symlinks[PATH_SIZE] = ""; - list_for_each_entry(name_loop, &udev->symlink_list, node) { + list_for_each_entry(name_loop, &udevice->symlink_list, node) { strlcat(symlinks, name_loop->name, sizeof(symlinks)); strlcat(symlinks, " ", sizeof(symlinks)); } @@ -930,34 +930,34 @@ found: } break; case SUBST_ROOT: - strlcat(string, udev_root, maxsize); - dbg("substitute udev_root '%s'\n", udev_root); + strlcat(string, udev_get_dev_path(udevice->udev), maxsize); + dbg(udevice->udev, "substitute udev_root '%s'\n", udev_get_dev_path(udevice->udev)); break; case SUBST_SYS: - strlcat(string, sysfs_path, maxsize); - dbg("substitute sysfs_path '%s'\n", sysfs_path); + strlcat(string, udev_get_sys_path(udevice->udev), maxsize); + dbg(udevice->udev, "substitute sys_path '%s'\n", udev_get_sys_path(udevice->udev)); break; case SUBST_ENV: if (attr == NULL) { - dbg("missing attribute\n"); + dbg(udevice->udev, "missing attribute\n"); break; } pos = getenv(attr); if (pos == NULL) { - dbg("env '%s' not available\n", attr); + dbg(udevice->udev, "env '%s' not available\n", attr); break; } - dbg("substitute env '%s=%s'\n", attr, pos); + dbg(udevice->udev, "substitute env '%s=%s'\n", attr, pos); strlcat(string, pos, maxsize); break; default: - err("unknown substitution type=%i\n", type); + err(udevice->udev, "unknown substitution type=%i\n", type); break; } /* possibly truncate to format-char specified length */ if (len >= 0 && len < (int)strlen(head)) { head[len] = '\0'; - dbg("truncate to %i chars, subtitution string becomes '%s'\n", len, head); + dbg(udevice->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head); } strlcat(string, temp, maxsize); } @@ -973,7 +973,7 @@ static char *key_pair_name(struct udev_rule *rule, struct key_pair *pair) return rule->buf + pair->key_name_off; } -static int match_key(const char *key_name, struct udev_rule *rule, struct key *key, const char *val) +static int match_key(struct udev *udev, const char *key_name, struct udev_rule *rule, struct key *key, const char *val) { char value[PATH_SIZE]; char *key_value; @@ -987,7 +987,7 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k /* look for a matching string, parts are separated by '|' */ strlcpy(value, rule->buf + key->val_off, sizeof(value)); key_value = value; - dbg("key %s value='%s'\n", key_name, key_value); + dbg(udev, "key %s value='%s'\n", key_name, key_value); while (key_value) { pos = strchr(key_value, '|'); if (pos) { @@ -995,7 +995,7 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k pos++; } - dbg("match %s '%s' <-> '%s'\n", key_name, key_value, val); + dbg(udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); match = (fnmatch(key_value, val, 0) == 0); if (match) break; @@ -1004,38 +1004,38 @@ static int match_key(const char *key_name, struct udev_rule *rule, struct key *k } if (match && (key->operation == KEY_OP_MATCH)) { - dbg("%s is true (matching value)\n", key_name); + dbg(udev, "%s is true (matching value)\n", key_name); return 0; } if (!match && (key->operation == KEY_OP_NOMATCH)) { - dbg("%s is true (non-matching value)\n", key_name); + dbg(udev, "%s is true (non-matching value)\n", key_name); return 0; } return -1; } /* match a single rule against a given device and possibly its parent devices */ -static int match_rule(struct udevice *udev, struct udev_rule *rule) +static int match_rule(struct udevice *udevice, struct udev_rule *rule) { int i; - if (match_key("ACTION", rule, &rule->action, udev->action)) + if (match_key(udevice->udev, "ACTION", rule, &rule->action, udevice->action)) goto nomatch; - if (match_key("KERNEL", rule, &rule->kernel, udev->dev->kernel)) + if (match_key(udevice->udev, "KERNEL", rule, &rule->kernel, udevice->dev->kernel)) goto nomatch; - if (match_key("SUBSYSTEM", rule, &rule->subsystem, udev->dev->subsystem)) + if (match_key(udevice->udev, "SUBSYSTEM", rule, &rule->subsystem, udevice->dev->subsystem)) goto nomatch; - if (match_key("DEVPATH", rule, &rule->devpath, udev->dev->devpath)) + if (match_key(udevice->udev, "DEVPATH", rule, &rule->devpath, udevice->dev->devpath)) goto nomatch; - if (match_key("DRIVER", rule, &rule->driver, udev->dev->driver)) + if (match_key(udevice->udev, "DRIVER", rule, &rule->driver, udevice->dev->driver)) goto nomatch; /* match NAME against a value assigned by an earlier rule */ - if (match_key("NAME", rule, &rule->name, udev->name)) + if (match_key(udevice->udev, "NAME", rule, &rule->name, udevice->name)) goto nomatch; /* match against current list of symlinks */ @@ -1044,8 +1044,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) struct name_entry *name_loop; int match = 0; - list_for_each_entry(name_loop, &udev->symlink_list, node) { - if (match_key("SYMLINK", rule, &rule->symlink_match, name_loop->name) == 0) { + list_for_each_entry(name_loop, &udevice->symlink_list, node) { + if (match_key(udevice->udev, "SYMLINK", rule, &rule->symlink_match, name_loop->name) == 0) { match = 1; break; } @@ -1064,10 +1064,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) const char *value = getenv(key_name); if (!value) { - dbg("ENV{'%s'} is not set, treat as empty\n", key_name); + dbg(udevice->udev, "ENV{'%s'} is not set, treat as empty\n", key_name); value = ""; } - if (match_key("ENV", rule, &pair->key, value)) + if (match_key(udevice->udev, "ENV", rule, &pair->key, value)) goto nomatch; } } @@ -1081,10 +1081,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) int match; strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); - udev_rules_apply_format(udev, filename, sizeof(filename)); + udev_rules_apply_format(udevice, filename, sizeof(filename)); - if (attr_get_by_subsys_id(filename, devpath, sizeof(devpath), &attr)) { - strlcpy(filename, sysfs_path, sizeof(filename)); + if (attr_get_by_subsys_id(udevice->udev, filename, devpath, sizeof(devpath), &attr)) { + strlcpy(filename, udev_get_sys_path(udevice->udev), sizeof(filename)); strlcat(filename, devpath, sizeof(filename)); if (attr != NULL) { strlcat(filename, "/", sizeof(filename)); @@ -1093,8 +1093,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) } else if (filename[0] != '/') { char tmp[PATH_SIZE]; - strlcpy(tmp, sysfs_path, sizeof(tmp)); - strlcat(tmp, udev->dev->devpath, sizeof(tmp)); + strlcpy(tmp, udev_get_sys_path(udevice->udev), sizeof(tmp)); + strlcat(tmp, udevice->dev->devpath, sizeof(tmp)); strlcat(tmp, "/", sizeof(tmp)); strlcat(tmp, filename, sizeof(tmp)); strlcpy(filename, tmp, sizeof(filename)); @@ -1103,10 +1103,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) attr_subst_subdir(filename, sizeof(filename)); match = (stat(filename, &statbuf) == 0); - info("'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + info(udevice->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); if (match && rule->test_mode_mask > 0) { match = ((statbuf.st_mode & rule->test_mode_mask) > 0); - info("'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + info(udevice->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, match ? "matches" : "does not match", rule->test_mode_mask); } @@ -1114,7 +1114,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) goto nomatch; if (!match && rule->test.operation == KEY_OP_MATCH) goto nomatch; - dbg("TEST key is true\n"); + dbg(udevice->udev, "TEST key is true\n"); } if (rule->wait_for.operation != KEY_OP_UNSET) { @@ -1122,8 +1122,8 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) int found; strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); - udev_rules_apply_format(udev, filename, sizeof(filename)); - found = (wait_for_file(udev, filename, 10) == 0); + udev_rules_apply_format(udevice, filename, sizeof(filename)); + found = (wait_for_file(udevice, filename, 10) == 0); if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) goto nomatch; } @@ -1142,14 +1142,14 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) char val[VALUE_SIZE]; size_t len; - if (attr_get_by_subsys_id(key_name, devpath, sizeof(devpath), &attrib)) { + if (attr_get_by_subsys_id(udevice->udev, key_name, devpath, sizeof(devpath), &attrib)) { if (attrib != NULL) - value = sysfs_attr_get_value(devpath, attrib); + value = sysfs_attr_get_value(udevice->udev, devpath, attrib); else goto nomatch; } if (value == NULL) - value = sysfs_attr_get_value(udev->dev->devpath, key_name); + value = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, key_name); if (value == NULL) goto nomatch; strlcpy(val, value, sizeof(val)); @@ -1160,27 +1160,27 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) len = strlen(val); while (len > 0 && isspace(val[len-1])) val[--len] = '\0'; - dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); + dbg(udevice->udev, "removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); } - if (match_key("ATTR", rule, &pair->key, val)) + if (match_key(udevice->udev, "ATTR", rule, &pair->key, val)) goto nomatch; } } /* walk up the chain of parent devices and find a match */ - udev->dev_parent = udev->dev; + udevice->dev_parent = udevice->dev; while (1) { /* check for matching kernel device name */ - if (match_key("KERNELS", rule, &rule->kernels, udev->dev_parent->kernel)) + if (match_key(udevice->udev, "KERNELS", rule, &rule->kernels, udevice->dev_parent->kernel)) goto try_parent; /* check for matching subsystem value */ - if (match_key("SUBSYSTEMS", rule, &rule->subsystems, udev->dev_parent->subsystem)) + if (match_key(udevice->udev, "SUBSYSTEMS", rule, &rule->subsystems, udevice->dev_parent->subsystem)) goto try_parent; /* check for matching driver */ - if (match_key("DRIVERS", rule, &rule->drivers, udev->dev_parent->driver)) + if (match_key(udevice->udev, "DRIVERS", rule, &rule->drivers, udevice->dev_parent->driver)) goto try_parent; /* check for matching sysfs attribute pairs */ @@ -1195,9 +1195,9 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) char val[VALUE_SIZE]; size_t len; - value = sysfs_attr_get_value(udev->dev_parent->devpath, key_name); + value = sysfs_attr_get_value(udevice->udev, udevice->dev_parent->devpath, key_name); if (value == NULL) - value = sysfs_attr_get_value(udev->dev->devpath, key_name); + value = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, key_name); if (value == NULL) goto try_parent; strlcpy(val, value, sizeof(val)); @@ -1208,10 +1208,10 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) len = strlen(val); while (len > 0 && isspace(val[len-1])) val[--len] = '\0'; - dbg("removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); + dbg(udevice->udev, "removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); } - if (match_key("ATTRS", rule, &pair->key, val)) + if (match_key(udevice->udev, "ATTRS", rule, &pair->key, val)) goto try_parent; } } @@ -1220,12 +1220,12 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule) break; try_parent: /* move to parent device */ - dbg("try parent sysfs device\n"); - udev->dev_parent = sysfs_device_get_parent(udev->dev_parent); - if (udev->dev_parent == NULL) + dbg(udevice->udev, "try parent sysfs device\n"); + udevice->dev_parent = sysfs_device_get_parent(udevice->udev, udevice->dev_parent); + if (udevice->dev_parent == NULL) goto nomatch; - dbg("looking at dev_parent->devpath='%s'\n", udev->dev_parent->devpath); - dbg("looking at dev_parent->kernel='%s'\n", udev->dev_parent->kernel); + dbg(udevice->udev, "looking at dev_parent->devpath='%s'\n", udevice->dev_parent->devpath); + dbg(udevice->udev, "looking at dev_parent->kernel='%s'\n", udevice->dev_parent->kernel); } /* execute external program */ @@ -1234,34 +1234,34 @@ try_parent: char result[PATH_SIZE]; strlcpy(program, key_val(rule, &rule->program), sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL) != 0) { - dbg("PROGRAM is false\n"); - udev->program_result[0] = '\0'; + udev_rules_apply_format(udevice, program, sizeof(program)); + if (run_program(udevice->udev, program, udevice->dev->subsystem, result, sizeof(result), NULL) != 0) { + dbg(udevice->udev, "PROGRAM is false\n"); + udevice->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) goto nomatch; } else { int count; - dbg("PROGRAM matches\n"); + dbg(udevice->udev, "PROGRAM matches\n"); remove_trailing_chars(result, '\n'); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { count = replace_chars(result, ALLOWED_CHARS_INPUT); if (count > 0) - info("%i character(s) replaced\n" , count); + info(udevice->udev, "%i character(s) replaced\n" , count); } - dbg("result is '%s'\n", result); - strlcpy(udev->program_result, result, sizeof(udev->program_result)); - dbg("PROGRAM returned successful\n"); + dbg(udevice->udev, "result is '%s'\n", result); + strlcpy(udevice->program_result, result, sizeof(udevice->program_result)); + dbg(udevice->udev, "PROGRAM returned successful\n"); if (rule->program.operation == KEY_OP_NOMATCH) goto nomatch; } - dbg("PROGRAM key is true\n"); + dbg(udevice->udev, "PROGRAM key is true\n"); } /* check for matching result of external program */ - if (match_key("RESULT", rule, &rule->result, udev->program_result)) + if (match_key(udevice->udev, "RESULT", rule, &rule->result, udevice->program_result)) goto nomatch; /* import variables returned from program or or file into environment */ @@ -1270,24 +1270,24 @@ try_parent: int rc = -1; strlcpy(import, key_val(rule, &rule->import), sizeof(import)); - udev_rules_apply_format(udev, import, sizeof(import)); - dbg("check for IMPORT import='%s'\n", import); + udev_rules_apply_format(udevice, import, sizeof(import)); + dbg(udevice->udev, "check for IMPORT import='%s'\n", import); if (rule->import_type == IMPORT_PROGRAM) { - rc = import_program_into_env(udev, import); + rc = import_program_into_env(udevice, import); } else if (rule->import_type == IMPORT_FILE) { - dbg("import file import='%s'\n", import); - rc = import_file_into_env(udev, import); + dbg(udevice->udev, "import file import='%s'\n", import); + rc = import_file_into_env(udevice, import); } else if (rule->import_type == IMPORT_PARENT) { - dbg("import parent import='%s'\n", import); - rc = import_parent_into_env(udev, import); + dbg(udevice->udev, "import parent import='%s'\n", import); + rc = import_parent_into_env(udevice, import); } if (rc != 0) { - dbg("IMPORT failed\n"); + dbg(udevice->udev, "IMPORT failed\n"); if (rule->import.operation != KEY_OP_NOMATCH) goto nomatch; } else - dbg("IMPORT '%s' imported\n", key_val(rule, &rule->import)); - dbg("IMPORT key is true\n"); + dbg(udevice->udev, "IMPORT '%s' imported\n", key_val(rule, &rule->import)); + dbg(udevice->udev, "IMPORT key is true\n"); } /* rule matches, if we have ENV assignments export it */ @@ -1301,20 +1301,20 @@ try_parent: /* make sure we don't write to the same string we possibly read from */ strlcpy(temp_value, value, sizeof(temp_value)); - udev_rules_apply_format(udev, temp_value, NAME_SIZE); + udev_rules_apply_format(udevice, temp_value, NAME_SIZE); if (temp_value[0] == '\0') { - name_list_key_remove(&udev->env_list, key_name); + name_list_key_remove(udevice->udev, &udevice->env_list, key_name); unsetenv(key_name); - info("unset ENV '%s'\n", key_name); + info(udevice->udev, "unset ENV '%s'\n", key_name); } else { struct name_entry *entry; - entry = name_list_key_add(&udev->env_list, key_name, temp_value); + entry = name_list_key_add(udevice->udev, &udevice->env_list, key_name, temp_value); if (entry == NULL) break; putenv(entry->name); - info("set ENV '%s'\n", entry->name); + info(udevice->udev, "set ENV '%s'\n", entry->name); } } } @@ -1331,9 +1331,9 @@ try_parent: char value[NAME_SIZE]; FILE *f; - if (attr_get_by_subsys_id(key_name, devpath, sizeof(devpath), &attrib)) { + if (attr_get_by_subsys_id(udevice->udev, key_name, devpath, sizeof(devpath), &attrib)) { if (attrib != NULL) { - strlcpy(attr, sysfs_path, sizeof(attr)); + strlcpy(attr, udev_get_sys_path(udevice->udev), sizeof(attr)); strlcat(attr, devpath, sizeof(attr)); strlcat(attr, "/", sizeof(attr)); strlcat(attr, attrib, sizeof(attr)); @@ -1341,8 +1341,8 @@ try_parent: } if (attr[0] == '\0') { - strlcpy(attr, sysfs_path, sizeof(attr)); - strlcat(attr, udev->dev->devpath, sizeof(attr)); + strlcpy(attr, udev_get_sys_path(udevice->udev), sizeof(attr)); + strlcat(attr, udevice->dev->devpath, sizeof(attr)); strlcat(attr, "/", sizeof(attr)); strlcat(attr, key_name, sizeof(attr)); } @@ -1350,16 +1350,16 @@ try_parent: attr_subst_subdir(attr, sizeof(attr)); strlcpy(value, key_val(rule, &pair->key), sizeof(value)); - udev_rules_apply_format(udev, value, sizeof(value)); - info("writing '%s' to sysfs file '%s'\n", value, attr); + udev_rules_apply_format(udevice, value, sizeof(value)); + info(udevice->udev, "writing '%s' to sysfs file '%s'\n", value, attr); f = fopen(attr, "w"); if (f != NULL) { - if (!udev->test_run) + if (!udevice->test_run) if (fprintf(f, "%s", value) <= 0) - err("error writing ATTR{%s}: %s\n", attr, strerror(errno)); + err(udevice->udev, "error writing ATTR{%s}: %s\n", attr, strerror(errno)); fclose(f); } else - err("error opening ATTR{%s} for writing: %s\n", attr, strerror(errno)); + err(udevice->udev, "error opening ATTR{%s} for writing: %s\n", attr, strerror(errno)); } } return 0; @@ -1368,13 +1368,13 @@ nomatch: return -1; } -int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) +int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) { struct udev_rule *rule; int name_set = 0; - dbg("udev->dev->devpath='%s'\n", udev->dev->devpath); - dbg("udev->dev->kernel='%s'\n", udev->dev->kernel); + dbg(udevice->udev, "udevice->dev->devpath='%s'\n", udevice->dev->devpath); + dbg(udevice->udev, "udevice->dev->kernel='%s'\n", udevice->dev->kernel); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -1387,64 +1387,64 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) (rule->name.operation == KEY_OP_ASSIGN || rule->name.operation == KEY_OP_ASSIGN_FINAL || rule->name.operation == KEY_OP_ADD)) { - dbg("node name already set, rule ignored\n"); + dbg(udevice->udev, "node name already set, rule ignored\n"); continue; } - dbg("process rule\n"); - if (match_rule(udev, rule) == 0) { + dbg(udevice->udev, "process rule\n"); + if (match_rule(udevice, rule) == 0) { /* apply options */ if (rule->ignore_device) { - info("rule applied, '%s' is ignored\n", udev->dev->kernel); - udev->ignore_device = 1; + info(udevice->udev, "rule applied, '%s' is ignored\n", udevice->dev->kernel); + udevice->ignore_device = 1; return 0; } if (rule->ignore_remove) { - udev->ignore_remove = 1; - dbg("remove event should be ignored\n"); + udevice->ignore_remove = 1; + dbg(udevice->udev, "remove event should be ignored\n"); } if (rule->link_priority != 0) { - udev->link_priority = rule->link_priority; - info("link_priority=%i\n", udev->link_priority); + udevice->link_priority = rule->link_priority; + info(udevice->udev, "link_priority=%i\n", udevice->link_priority); } if (rule->event_timeout >= 0) { - udev->event_timeout = rule->event_timeout; - info("event_timeout=%i\n", udev->event_timeout); + udevice->event_timeout = rule->event_timeout; + info(udevice->udev, "event_timeout=%i\n", udevice->event_timeout); } /* apply all_partitions option only at a main block device */ if (rule->partitions && - strcmp(udev->dev->subsystem, "block") == 0 && udev->dev->kernel_number[0] == '\0') { - udev->partitions = rule->partitions; - dbg("creation of partition nodes requested\n"); + strcmp(udevice->dev->subsystem, "block") == 0 && udevice->dev->kernel_number[0] == '\0') { + udevice->partitions = rule->partitions; + dbg(udevice->udev, "creation of partition nodes requested\n"); } /* apply permissions */ - if (!udev->mode_final && rule->mode.operation != KEY_OP_UNSET) { + if (!udevice->mode_final && rule->mode.operation != KEY_OP_UNSET) { if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) - udev->mode_final = 1; + udevice->mode_final = 1; char buf[20]; strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); - udev_rules_apply_format(udev, buf, sizeof(buf)); - udev->mode = strtol(buf, NULL, 8); - dbg("applied mode=%#o to '%s'\n", udev->mode, udev->dev->kernel); + udev_rules_apply_format(udevice, buf, sizeof(buf)); + udevice->mode = strtol(buf, NULL, 8); + dbg(udevice->udev, "applied mode=%#o to '%s'\n", udevice->mode, udevice->dev->kernel); } - if (!udev->owner_final && rule->owner.operation != KEY_OP_UNSET) { + if (!udevice->owner_final && rule->owner.operation != KEY_OP_UNSET) { if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) - udev->owner_final = 1; - strlcpy(udev->owner, key_val(rule, &rule->owner), sizeof(udev->owner)); - udev_rules_apply_format(udev, udev->owner, sizeof(udev->owner)); - dbg("applied owner='%s' to '%s'\n", udev->owner, udev->dev->kernel); + udevice->owner_final = 1; + strlcpy(udevice->owner, key_val(rule, &rule->owner), sizeof(udevice->owner)); + udev_rules_apply_format(udevice, udevice->owner, sizeof(udevice->owner)); + dbg(udevice->udev, "applied owner='%s' to '%s'\n", udevice->owner, udevice->dev->kernel); } - if (!udev->group_final && rule->group.operation != KEY_OP_UNSET) { + if (!udevice->group_final && rule->group.operation != KEY_OP_UNSET) { if (rule->group.operation == KEY_OP_ASSIGN_FINAL) - udev->group_final = 1; - strlcpy(udev->group, key_val(rule, &rule->group), sizeof(udev->group)); - udev_rules_apply_format(udev, udev->group, sizeof(udev->group)); - dbg("applied group='%s' to '%s'\n", udev->group, udev->dev->kernel); + udevice->group_final = 1; + strlcpy(udevice->group, key_val(rule, &rule->group), sizeof(udevice->group)); + udev_rules_apply_format(udevice, udevice->group, sizeof(udevice->group)); + dbg(udevice->udev, "applied group='%s' to '%s'\n", udevice->group, udevice->dev->kernel); } /* collect symlinks */ - if (!udev->symlink_final && + if (!udevice->symlink_final && (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL || rule->symlink.operation == KEY_OP_ADD)) { @@ -1453,38 +1453,38 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) int count; if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) - udev->symlink_final = 1; + udevice->symlink_final = 1; if (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { - info("reset symlink list\n"); - name_list_cleanup(&udev->symlink_list); + info(udevice->udev, "reset symlink list\n"); + name_list_cleanup(udevice->udev, &udevice->symlink_list); } /* allow multiple symlinks separated by spaces */ strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); - udev_rules_apply_format(udev, temp, sizeof(temp)); + udev_rules_apply_format(udevice, temp, sizeof(temp)); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { count = replace_chars(temp, ALLOWED_CHARS_FILE " "); if (count > 0) - info("%i character(s) replaced\n" , count); + info(udevice->udev, "%i character(s) replaced\n" , count); } - dbg("rule applied, added symlink(s) '%s'\n", temp); + dbg(udevice->udev, "rule applied, added symlink(s) '%s'\n", temp); pos = temp; while (isspace(pos[0])) pos++; next = strchr(pos, ' '); while (next) { next[0] = '\0'; - info("add symlink '%s'\n", pos); - name_list_add(&udev->symlink_list, pos, 0); + info(udevice->udev, "add symlink '%s'\n", pos); + name_list_add(udevice->udev, &udevice->symlink_list, pos, 0); while (isspace(next[1])) next++; pos = &next[1]; next = strchr(pos, ' '); } if (pos[0] != '\0') { - info("add symlink '%s'\n", pos); - name_list_add(&udev->symlink_list, pos, 0); + info(udevice->udev, "add symlink '%s'\n", pos); + name_list_add(udevice->udev, &udevice->symlink_list, pos, 0); } } @@ -1495,67 +1495,67 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev) int count; name_set = 1; - strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); - udev_rules_apply_format(udev, udev->name, sizeof(udev->name)); + strlcpy(udevice->name, key_val(rule, &rule->name), sizeof(udevice->name)); + udev_rules_apply_format(udevice, udevice->name, sizeof(udevice->name)); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { - count = replace_chars(udev->name, ALLOWED_CHARS_FILE); + count = replace_chars(udevice->name, ALLOWED_CHARS_FILE); if (count > 0) - info("%i character(s) replaced\n", count); + info(udevice->udev, "%i character(s) replaced\n", count); } - info("rule applied, '%s' becomes '%s'\n", udev->dev->kernel, udev->name); - if (strcmp(udev->dev->subsystem, "net") != 0) - dbg("name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i\n", - udev->name, udev->owner, udev->group, udev->mode, udev->partitions); + info(udevice->udev, "rule applied, '%s' becomes '%s'\n", udevice->dev->kernel, udevice->name); + if (strcmp(udevice->dev->subsystem, "net") != 0) + dbg(udevice->udev, "name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i\n", + udevice->name, udevice->owner, udevice->group, udevice->mode, udevice->partitions); } - if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { + if (!udevice->run_final && rule->run.operation != KEY_OP_UNSET) { struct name_entry *entry; if (rule->run.operation == KEY_OP_ASSIGN_FINAL) - udev->run_final = 1; + udevice->run_final = 1; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info("reset run list\n"); - name_list_cleanup(&udev->run_list); + info(udevice->udev, "reset run list\n"); + name_list_cleanup(udevice->udev, &udevice->run_list); } - dbg("add run '%s'\n", key_val(rule, &rule->run)); - entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); + dbg(udevice->udev, "add run '%s'\n", key_val(rule, &rule->run)); + entry = name_list_add(udevice->udev, &udevice->run_list, key_val(rule, &rule->run), 0); if (rule->run_ignore_error) entry->ignore_error = 1; } if (rule->last_rule) { - dbg("last rule to be applied\n"); + dbg(udevice->udev, "last rule to be applied\n"); break; } if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); + dbg(udevice->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); } } } if (!name_set) { - info("no node name set, will use kernel name '%s'\n", udev->dev->kernel); - strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name)); + info(udevice->udev, "no node name set, will use kernel name '%s'\n", udevice->dev->kernel); + strlcpy(udevice->name, udevice->dev->kernel, sizeof(udevice->name)); } - if (udev->tmp_node[0] != '\0') { - dbg("removing temporary device node\n"); - unlink_secure(udev->tmp_node); - udev->tmp_node[0] = '\0'; + if (udevice->tmp_node[0] != '\0') { + dbg(udevice->udev, "removing temporary device node\n"); + unlink_secure(udevice->udev, udevice->tmp_node); + udevice->tmp_node[0] = '\0'; } return 0; } -int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) +int udev_rules_get_run(struct udev_rules *rules, struct udevice *udevice) { struct udev_rule *rule; - dbg("udev->kernel='%s'\n", udev->dev->kernel); + dbg(udevice->udev, "udevice->kernel='%s'\n", udevice->dev->kernel); /* look for a matching rule to apply */ udev_rules_iter_init(rules); @@ -1564,7 +1564,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) if (rule == NULL) break; - dbg("process rule\n"); + dbg(udevice->udev, "process rule\n"); if (rule->name.operation == KEY_OP_ASSIGN || rule->name.operation == KEY_OP_ASSIGN_FINAL || rule->name.operation == KEY_OP_ADD || @@ -1573,31 +1573,31 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) rule->symlink.operation == KEY_OP_ADD || rule->mode.operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { - dbg("skip rule that names a device\n"); + dbg(udevice->udev, "skip rule that names a device\n"); continue; } - if (match_rule(udev, rule) == 0) { + if (match_rule(udevice, rule) == 0) { if (rule->ignore_device) { - info("rule applied, '%s' is ignored\n", udev->dev->kernel); - udev->ignore_device = 1; + info(udevice->udev, "rule applied, '%s' is ignored\n", udevice->dev->kernel); + udevice->ignore_device = 1; return 0; } if (rule->ignore_remove) { - udev->ignore_remove = 1; - dbg("remove event should be ignored\n"); + udevice->ignore_remove = 1; + dbg(udevice->udev, "remove event should be ignored\n"); } - if (!udev->run_final && rule->run.operation != KEY_OP_UNSET) { + if (!udevice->run_final && rule->run.operation != KEY_OP_UNSET) { struct name_entry *entry; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info("reset run list\n"); - name_list_cleanup(&udev->run_list); + info(udevice->udev, "reset run list\n"); + name_list_cleanup(udevice->udev, &udevice->run_list); } - dbg("add run '%s'\n", key_val(rule, &rule->run)); - entry = name_list_add(&udev->run_list, key_val(rule, &rule->run), 0); + dbg(udevice->udev, "add run '%s'\n", key_val(rule, &rule->run)); + entry = name_list_add(udevice->udev, &udevice->run_list, key_val(rule, &rule->run), 0); if (rule->run_ignore_error) entry->ignore_error = 1; if (rule->run.operation == KEY_OP_ASSIGN_FINAL) @@ -1605,12 +1605,12 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev) } if (rule->last_rule) { - dbg("last rule to be applied\n"); + dbg(udevice->udev, "last rule to be applied\n"); break; } if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg("moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); + dbg(udevice->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); } } diff --git a/udev/udev_rules.h b/udev/udev_rules.h index 9a41ccbdd8..4f95121f30 100644 --- a/udev/udev_rules.h +++ b/udev/udev_rules.h @@ -108,13 +108,14 @@ struct udev_rule { }; struct udev_rules { + struct udev *udev; char *buf; size_t bufsize; size_t current; int resolve_names; }; -extern int udev_rules_init(struct udev_rules *rules, int resolve_names); +extern int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names); extern void udev_rules_cleanup(struct udev_rules *rules); extern void udev_rules_iter_init(struct udev_rules *rules); diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 90b139be4b..df7b57ba54 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -35,7 +35,7 @@ void udev_rules_iter_init(struct udev_rules *rules) { - dbg("bufsize=%zi\n", rules->bufsize); + dbg(rules->udev, "bufsize=%zi\n", rules->bufsize); rules->current = 0; } @@ -46,9 +46,9 @@ struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) if (!rules) return NULL; - dbg("current=%zi\n", rules->current); + dbg(rules->udev, "current=%zi\n", rules->current); if (rules->current >= rules->bufsize) { - dbg("no more rules\n"); + dbg(rules->udev, "no more rules\n"); return NULL; } @@ -65,25 +65,25 @@ struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *la size_t start = rules->current; next: - dbg("current=%zi\n", rules->current); + dbg(rules->udev, "current=%zi\n", rules->current); if (rules->current >= rules->bufsize) { - err("LABEL='%s' not found, GOTO will be ignored\n", label); + err(rules->udev, "LABEL='%s' not found, GOTO will be ignored\n", label); rules->current = start; return NULL; } rule = (struct udev_rule *) (rules->buf + rules->current); if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { - dbg("moving forward, looking for label '%s'\n", label); + dbg(rules->udev, "moving forward, looking for label '%s'\n", label); rules->current += sizeof(struct udev_rule) + rule->bufsize; goto next; } - dbg("found label '%s'\n", label); + dbg(rules->udev, "found label '%s'\n", label); return rule; } -static int get_key(char **line, char **key, enum key_operation *operation, char **value) +static int get_key(struct udev_rules *rules, char **line, char **key, enum key_operation *operation, char **value) { char *linepos; char *temp; @@ -127,29 +127,29 @@ static int get_key(char **line, char **key, enum key_operation *operation, char if (linepos[0] == '=' && linepos[1] == '=') { *operation = KEY_OP_MATCH; linepos += 2; - dbg("operator=match\n"); + dbg(rules->udev, "operator=match\n"); } else if (linepos[0] == '!' && linepos[1] == '=') { *operation = KEY_OP_NOMATCH; linepos += 2; - dbg("operator=nomatch\n"); + dbg(rules->udev, "operator=nomatch\n"); } else if (linepos[0] == '+' && linepos[1] == '=') { *operation = KEY_OP_ADD; linepos += 2; - dbg("operator=add\n"); + dbg(rules->udev, "operator=add\n"); } else if (linepos[0] == '=') { *operation = KEY_OP_ASSIGN; linepos++; - dbg("operator=assign\n"); + dbg(rules->udev, "operator=assign\n"); } else if (linepos[0] == ':' && linepos[1] == '=') { *operation = KEY_OP_ASSIGN_FINAL; linepos += 2; - dbg("operator=assign_final\n"); + dbg(rules->udev, "operator=assign_final\n"); } else return -1; /* terminate key */ temp[0] = '\0'; - dbg("key='%s'\n", *key); + dbg(rules->udev, "key='%s'\n", *key); /* skip whitespace after operator */ while (isspace(linepos[0])) @@ -169,7 +169,7 @@ static int get_key(char **line, char **key, enum key_operation *operation, char return -1; temp[0] = '\0'; temp++; - dbg("value='%s'\n", *value); + dbg(rules->udev, "value='%s'\n", *value); /* move line to next key */ *line = temp; @@ -178,7 +178,7 @@ static int get_key(char **line, char **key, enum key_operation *operation, char } /* extract possible KEY{attr} */ -static char *get_key_attribute(char *str) +static char *get_key_attribute(struct udev_rules *rules, char *str) { char *pos; char *attr; @@ -188,11 +188,11 @@ static char *get_key_attribute(char *str) attr++; pos = strchr(attr, '}'); if (pos == NULL) { - err("missing closing brace for format\n"); + err(rules->udev, "missing closing brace for format\n"); return NULL; } pos[0] = '\0'; - dbg("attribute='%s'\n", attr); + dbg(rules->udev, "attribute='%s'\n", attr); return attr; } @@ -213,13 +213,13 @@ static int add_rule_key(struct udev_rule *rule, struct key *key, return 0; } -static int add_rule_key_pair(struct udev_rule *rule, struct key_pairs *pairs, +static int add_rule_key_pair(struct udev_rules *rules, struct udev_rule *rule, struct key_pairs *pairs, enum key_operation operation, const char *key, const char *value) { size_t key_len = strnlen(key, PATH_SIZE); if (pairs->count >= PAIRS_MAX) { - err("skip, too many keys of the same type in a single rule\n"); + err(rules->udev, "skip, too many keys of the same type in a single rule\n"); return -1; } @@ -259,14 +259,14 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena char *value; enum key_operation operation = KEY_OP_UNSET; - retval = get_key(&linepos, &key, &operation, &value); + retval = get_key(rules, &linepos, &key, &operation, &value); if (retval) break; if (strcasecmp(key, "ACTION") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid ACTION operation\n"); + err(rules->udev, "invalid ACTION operation\n"); goto invalid; } add_rule_key(rule, &rule->action, operation, value); @@ -277,7 +277,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "DEVPATH") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DEVPATH operation\n"); + err(rules->udev, "invalid DEVPATH operation\n"); goto invalid; } add_rule_key(rule, &rule->devpath, operation, value); @@ -288,7 +288,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "KERNEL") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid KERNEL operation\n"); + err(rules->udev, "invalid KERNEL operation\n"); goto invalid; } add_rule_key(rule, &rule->kernel, operation, value); @@ -299,7 +299,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "SUBSYSTEM") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid SUBSYSTEM operation\n"); + err(rules->udev, "invalid SUBSYSTEM operation\n"); goto invalid; } /* bus, class, subsystem events should all be the same */ @@ -307,7 +307,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) { if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) - err("'%s' must be specified as 'subsystem' \n" + err(rules->udev, "'%s' must be specified as 'subsystem' \n" "please fix it in %s:%u", value, filename, lineno); add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); } else @@ -319,7 +319,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "DRIVER") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DRIVER operation\n"); + err(rules->udev, "invalid DRIVER operation\n"); goto invalid; } add_rule_key(rule, &rule->driver, operation, value); @@ -328,12 +328,12 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { - attr = get_key_attribute(key + sizeof("ATTR")-1); + attr = get_key_attribute(rules, key + sizeof("ATTR")-1); if (attr == NULL) { - err("error parsing ATTR attribute\n"); + err(rules->udev, "error parsing ATTR attribute\n"); goto invalid; } - if (add_rule_key_pair(rule, &rule->attr, operation, attr, value) != 0) + if (add_rule_key_pair(rules, rule, &rule->attr, operation, attr, value) != 0) goto invalid; valid = 1; continue; @@ -343,7 +343,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strcasecmp(key, "ID") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid KERNELS operation\n"); + err(rules->udev, "invalid KERNELS operation\n"); goto invalid; } add_rule_key(rule, &rule->kernels, operation, value); @@ -355,7 +355,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strcasecmp(key, "BUS") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid SUBSYSTEMS operation\n"); + err(rules->udev, "invalid SUBSYSTEMS operation\n"); goto invalid; } add_rule_key(rule, &rule->subsystems, operation, value); @@ -366,7 +366,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "DRIVERS") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid DRIVERS operation\n"); + err(rules->udev, "invalid DRIVERS operation\n"); goto invalid; } add_rule_key(rule, &rule->drivers, operation, value); @@ -378,35 +378,35 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid ATTRS operation\n"); + err(rules->udev, "invalid ATTRS operation\n"); goto invalid; } - attr = get_key_attribute(key + sizeof("ATTRS")-1); + attr = get_key_attribute(rules, key + sizeof("ATTRS")-1); if (attr == NULL) { - err("error parsing ATTRS attribute\n"); + err(rules->udev, "error parsing ATTRS attribute\n"); goto invalid; } if (strncmp(attr, "device/", 7) == 0) - err("the 'device' link is deprecated and will be removed from a future kernel, \n" + err(rules->udev, "the 'device' link is deprecated and will be removed from a future kernel, \n" "please fix it in %s:%u", filename, lineno); else if (strstr(attr, "../") != NULL) - err("do not reference parent sysfs directories directly, that may break with a future kernel, \n" + err(rules->udev, "do not reference parent sysfs directories directly, that may break with a future kernel, \n" "please fix it in %s:%u", filename, lineno); - if (add_rule_key_pair(rule, &rule->attrs, operation, attr, value) != 0) + if (add_rule_key_pair(rules, rule, &rule->attrs, operation, attr, value) != 0) goto invalid; valid = 1; continue; } if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { - attr = get_key_attribute(key + sizeof("ENV")-1); + attr = get_key_attribute(rules, key + sizeof("ENV")-1); if (attr == NULL) { - err("error parsing ENV attribute\n"); + err(rules->udev, "error parsing ENV attribute\n"); goto invalid; } if (strncmp(attr, "PHYSDEV", 7) == 0) physdev = 1; - if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0) + if (add_rule_key_pair(rules, rule, &rule->env, operation, attr, value) != 0) goto invalid; valid = 1; continue; @@ -421,7 +421,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcasecmp(key, "RESULT") == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid RESULT operation\n"); + err(rules->udev, "invalid RESULT operation\n"); goto invalid; } add_rule_key(rule, &rule->result, operation, value); @@ -430,15 +430,15 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { - attr = get_key_attribute(key + sizeof("IMPORT")-1); + attr = get_key_attribute(rules, key + sizeof("IMPORT")-1); if (attr != NULL && strstr(attr, "program")) { - dbg("IMPORT will be executed\n"); + dbg(rules->udev, "IMPORT will be executed\n"); rule->import_type = IMPORT_PROGRAM; } else if (attr != NULL && strstr(attr, "file")) { - dbg("IMPORT will be included as file\n"); + dbg(rules->udev, "IMPORT will be included as file\n"); rule->import_type = IMPORT_FILE; } else if (attr != NULL && strstr(attr, "parent")) { - dbg("IMPORT will include the parent values\n"); + dbg(rules->udev, "IMPORT will include the parent values\n"); rule->import_type = IMPORT_PARENT; } else { /* figure it out if it is executable */ @@ -460,12 +460,12 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena pos[0] = '\0'; } - dbg("IMPORT auto mode for '%s'\n", file); + dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { - dbg("IMPORT is executable, will be executed (autotype)\n"); + dbg(rules->udev, "IMPORT is executable, will be executed (autotype)\n"); rule->import_type = IMPORT_PROGRAM; } else { - dbg("IMPORT is not executable, will be included as file (autotype)\n"); + dbg(rules->udev, "IMPORT is not executable, will be included as file (autotype)\n"); rule->import_type = IMPORT_FILE; } } @@ -477,10 +477,10 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { if (operation != KEY_OP_MATCH && operation != KEY_OP_NOMATCH) { - err("invalid TEST operation\n"); + err(rules->udev, "invalid TEST operation\n"); goto invalid; } - attr = get_key_attribute(key + sizeof("TEST")-1); + attr = get_key_attribute(rules, key + sizeof("TEST")-1); if (attr != NULL) rule->test_mode_mask = strtol(attr, NULL, 8); add_rule_key(rule, &rule->test, operation, value); @@ -489,7 +489,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { - attr = get_key_attribute(key + sizeof("RUN")-1); + attr = get_key_attribute(rules, key + sizeof("RUN")-1); if (attr != NULL) { if (strstr(attr, "ignore_error")) rule->run_ignore_error = 1; @@ -518,19 +518,19 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena } if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { - attr = get_key_attribute(key + sizeof("NAME")-1); + attr = get_key_attribute(rules, key + sizeof("NAME")-1); if (attr != NULL) { if (strstr(attr, "all_partitions") != NULL) { - dbg("creation of partition nodes requested\n"); + dbg(rules->udev, "creation of partition nodes requested\n"); rule->partitions = DEFAULT_PARTITIONS_COUNT; } if (strstr(attr, "ignore_remove") != NULL) { - dbg("remove event should be ignored\n"); + dbg(rules->udev, "remove event should be ignored\n"); rule->ignore_remove = 1; } } if (value[0] == '\0') - dbg("name empty, node creation supressed\n"); + dbg(rules->udev, "name empty, node creation supressed\n"); add_rule_key(rule, &rule->name, operation, value); continue; } @@ -552,8 +552,8 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strtoul(value, &endptr, 10); if (endptr[0] != '\0') { char owner[32]; - uid_t uid = lookup_user(value); - dbg("replacing username='%s' by id=%i\n", value, uid); + uid_t uid = lookup_user(rules->udev, value); + dbg(rules->udev, "replacing username='%s' by id=%i\n", value, uid); sprintf(owner, "%u", (unsigned int) uid); add_rule_key(rule, &rule->owner, operation, owner); continue; @@ -571,8 +571,8 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strtoul(value, &endptr, 10); if (endptr[0] != '\0') { char group[32]; - gid_t gid = lookup_group(value); - dbg("replacing groupname='%s' by id=%i\n", value, gid); + gid_t gid = lookup_group(rules->udev, value); + dbg(rules->udev, "replacing groupname='%s' by id=%i\n", value, gid); sprintf(group, "%u", (unsigned int) gid); add_rule_key(rule, &rule->group, operation, group); continue; @@ -593,26 +593,26 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena const char *pos; if (strstr(value, "last_rule") != NULL) { - dbg("last rule to be applied\n"); + dbg(rules->udev, "last rule to be applied\n"); rule->last_rule = 1; } if (strstr(value, "ignore_device") != NULL) { - dbg("device should be ignored\n"); + dbg(rules->udev, "device should be ignored\n"); rule->ignore_device = 1; } if (strstr(value, "ignore_remove") != NULL) { - dbg("remove event should be ignored\n"); + dbg(rules->udev, "remove event should be ignored\n"); rule->ignore_remove = 1; } pos = strstr(value, "link_priority="); if (pos != NULL) { rule->link_priority = atoi(&pos[strlen("link_priority=")]); - dbg("link priority=%i\n", rule->link_priority); + dbg(rules->udev, "link priority=%i\n", rule->link_priority); } pos = strstr(value, "event_timeout="); if (pos != NULL) { rule->event_timeout = atoi(&pos[strlen("event_timeout=")]); - dbg("event timout=%i\n", rule->event_timeout); + dbg(rules->udev, "event timout=%i\n", rule->event_timeout); } pos = strstr(value, "string_escape="); if (pos != NULL) { @@ -623,18 +623,18 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena rule->string_escape = ESCAPE_REPLACE; } if (strstr(value, "all_partitions") != NULL) { - dbg("creation of partition nodes requested\n"); + dbg(rules->udev, "creation of partition nodes requested\n"); rule->partitions = DEFAULT_PARTITIONS_COUNT; } valid = 1; continue; } - err("unknown key '%s' in %s:%u\n", key, filename, lineno); + err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); } if (physdev && rule->wait_for.operation == KEY_OP_UNSET) - err("PHYSDEV* values are deprecated and will be removed from a future kernel, \n" + err(rules->udev, "PHYSDEV* values are deprecated and will be removed from a future kernel, \n" "please fix it in %s:%u", filename, lineno); /* skip line if not any valid key was found */ @@ -644,23 +644,23 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena /* grow buffer and add rule */ rule_size = sizeof(struct udev_rule) + rule->bufsize; padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); - dbg("add %zi padding bytes\n", padding); + dbg(rules->udev, "add %zi padding bytes\n", padding); rule_size += padding; rule->bufsize += padding; rules->buf = realloc(rules->buf, rules->bufsize + rule_size); if (!rules->buf) { - err("realloc failed\n"); + err(rules->udev, "realloc failed\n"); goto exit; } - dbg("adding rule to offset %zi\n", rules->bufsize); + dbg(rules->udev, "adding rule to offset %zi\n", rules->bufsize); memcpy(rules->buf + rules->bufsize, rule, rule_size); rules->bufsize += rule_size; exit: return 0; invalid: - err("invalid rule '%s:%u'\n", filename, lineno); + err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); return -1; } @@ -676,10 +676,10 @@ static int parse_file(struct udev_rules *rules, const char *filename) int retval = 0; if (file_map(filename, &buf, &bufsize) != 0) { - err("can't open '%s' as rules file: %s\n", filename, strerror(errno)); + err(rules->udev, "can't open '%s' as rules file: %s\n", filename, strerror(errno)); return -1; } - info("reading '%s' as rules file\n", filename); + info(rules->udev, "reading '%s' as rules file\n", filename); /* loop through the whole file */ cur = 0; @@ -705,7 +705,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) continue; if (count >= sizeof(line)) { - err("line too long, rule skipped '%s:%u'\n", filename, lineno); + err(rules->udev, "line too long, rule skipped '%s:%u'\n", filename, lineno); continue; } @@ -718,7 +718,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) } line[j] = '\0'; - dbg("read '%s'\n", line); + dbg(rules->udev, "read '%s'\n", line); add_to_rules(rules, line, filename, lineno); } @@ -726,7 +726,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) return retval; } -int udev_rules_init(struct udev_rules *rules, int resolve_names) +int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names) { struct stat statbuf; char filename[PATH_MAX]; @@ -737,28 +737,29 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) int retval = 0; memset(rules, 0x00, sizeof(struct udev_rules)); + rules->udev = udev; rules->resolve_names = resolve_names; - if (udev_rules_dir[0] != '\0') { + if (udev_get_rules_path(udev) != NULL) { /* custom rules location for testing */ - add_matching_files(&name_list, udev_rules_dir, ".rules"); + add_matching_files(udev, &name_list, udev_get_rules_path(udev), ".rules"); } else { /* read user/custom rules */ - add_matching_files(&name_list, SYSCONFDIR "/udev/rules.d", ".rules"); + add_matching_files(udev, &name_list, SYSCONFDIR "/udev/rules.d", ".rules"); /* read dynamic/temporary rules */ - strlcpy(filename, udev_root, sizeof(filename)); + strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); strlcat(filename, "/.udev/rules.d", sizeof(filename)); if (stat(filename, &statbuf) != 0) { - create_path(filename); - selinux_setfscreatecon(filename, NULL, S_IFDIR|0755); + create_path(udev, filename); + selinux_setfscreatecon(udev, filename, NULL, S_IFDIR|0755); mkdir(filename, 0755); - selinux_resetfscreatecon(); + selinux_resetfscreatecon(udev); } - add_matching_files(&sort_list, filename, ".rules"); + add_matching_files(udev, &sort_list, filename, ".rules"); /* read default rules */ - add_matching_files(&sort_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); + add_matching_files(udev, &sort_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); /* sort all rules files by basename into list of files */ list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) { @@ -774,7 +775,7 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) continue; if (strcmp(name_base, sort_base) == 0) { - info("rule file '%s' already added, ignoring '%s'\n", + info(udev, "rule file '%s' already added, ignoring '%s'\n", name_loop->name, sort_loop->name); list_del(&sort_loop->node); free(sort_loop); @@ -796,9 +797,9 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names) if (statbuf.st_size) parse_file(rules, name_loop->name); else - dbg("empty rules file '%s'\n", name_loop->name); + dbg(udev, "empty rules file '%s'\n", name_loop->name); } else - err("could not read '%s': %s\n", name_loop->name, strerror(errno)); + err(udev, "could not read '%s': %s\n", name_loop->name, strerror(errno)); list_del(&name_loop->node); free(name_loop); } diff --git a/udev/udev_selinux.c b/udev/udev_selinux.c index 66742e1fec..2e76a7431f 100644 --- a/udev/udev_selinux.c +++ b/udev/udev_selinux.c @@ -35,18 +35,18 @@ static security_context_t prev_scontext = NULL; -static int is_selinux_running(void) +static int is_selinux_running(struct udev *udev) { static int selinux_enabled = -1; if (selinux_enabled == -1) selinux_enabled = (is_selinux_enabled() > 0); - dbg("selinux=%i\n", selinux_enabled); + dbg(udev, "selinux=%i\n", selinux_enabled); return selinux_enabled; } -static char *get_media(const char *devname, int mode) +static char *get_media(struct udev *udev, const char *devname, int mode) { FILE *fp; char procfile[PATH_MAX]; @@ -77,7 +77,7 @@ static char *get_media(const char *devname, int mode) } media = strdup(mediabuf); - info("selinux_get_media(%s)='%s'\n", devname, media); + info(udev, "selinux_get_media(%s)='%s'\n", devname, media); close_out: fclose(fp); @@ -85,15 +85,15 @@ out: return media; } -void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) +void selinux_setfilecon(struct udev *udev, const char *file, const char *devname, unsigned int mode) { - if (is_selinux_running()) { + if (is_selinux_running(udev)) { security_context_t scontext = NULL; char *media; int ret = -1; if (devname) { - media = get_media(devname, mode); + media = get_media(udev, devname, mode); if (media) { ret = matchmediacon(media, &scontext); free(media); @@ -102,26 +102,26 @@ void selinux_setfilecon(const char *file, const char *devname, unsigned int mode if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed\n", file); + err(udev, "matchpathcon(%s) failed\n", file); return; } if (lsetfilecon(file, scontext) < 0) - err("setfilecon %s failed: %s\n", file, strerror(errno)); + err(udev, "setfilecon %s failed: %s\n", file, strerror(errno)); freecon(scontext); } } -void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) +void selinux_setfscreatecon(struct udev *udev, const char *file, const char *devname, unsigned int mode) { - if (is_selinux_running()) { + if (is_selinux_running(udev)) { security_context_t scontext = NULL; char *media; int ret = -1; if (devname) { - media = get_media(devname, mode); + media = get_media(udev, devname, mode); if (media) { ret = matchmediacon(media, &scontext); free(media); @@ -130,45 +130,45 @@ void selinux_setfscreatecon(const char *file, const char *devname, unsigned int if (ret < 0) if (matchpathcon(file, mode, &scontext) < 0) { - err("matchpathcon(%s) failed\n", file); + err(udev, "matchpathcon(%s) failed\n", file); return; } if (setfscreatecon(scontext) < 0) - err("setfscreatecon %s failed: %s\n", file, strerror(errno)); + err(udev, "setfscreatecon %s failed: %s\n", file, strerror(errno)); freecon(scontext); } } -void selinux_resetfscreatecon(void) +void selinux_resetfscreatecon(struct udev *udev) { - if (is_selinux_running()) { + if (is_selinux_running(udev)) { if (setfscreatecon(prev_scontext) < 0) - err("setfscreatecon failed: %s\n", strerror(errno)); + err(udev, "setfscreatecon failed: %s\n", strerror(errno)); } } -void selinux_init(void) +void selinux_init(struct udev *udev) { /* * record the present security context, for file-creation * restoration creation purposes. */ - if (is_selinux_running()) { - if (!udev_root[0]) - err("selinux_init: udev_root not set\n"); - matchpathcon_init_prefix(NULL, udev_root); + if (is_selinux_running(udev)) { + if (!udev_get_dev_path(udev)[0]) + err(udev, "selinux_init: udev_root not set\n"); + matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); if (getfscreatecon(&prev_scontext) < 0) { - err("getfscreatecon failed\n"); + err(udev, "getfscreatecon failed\n"); prev_scontext = NULL; } } } -void selinux_exit(void) +void selinux_exit(struct udev *udev) { - if (is_selinux_running() && prev_scontext) { + if (is_selinux_running(udev) && prev_scontext) { freecon(prev_scontext); prev_scontext = NULL; } diff --git a/udev/udev_selinux.h b/udev/udev_selinux.h index fcdd9dbe5f..55bc91222a 100644 --- a/udev/udev_selinux.h +++ b/udev/udev_selinux.h @@ -19,17 +19,17 @@ #define _UDEV_SELINUX_H #ifdef USE_SELINUX -extern void selinux_setfilecon(const char *file, const char *devname, unsigned int mode); -extern void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode); -extern void selinux_resetfscreatecon(void); -extern void selinux_init(void); -extern void selinux_exit(void); +extern void selinux_setfilecon(struct udev *udev, const char *file, const char *devname, unsigned int mode); +extern void selinux_setfscreatecon(struct udev *udev, const char *file, const char *devname, unsigned int mode); +extern void selinux_resetfscreatecon(struct udev *udev); +extern void selinux_init(struct udev *udev); +extern void selinux_exit(struct udev *udev); #else -static inline void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) {} -static inline void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) {} -static inline void selinux_resetfscreatecon(void) {} -static inline void selinux_init(void) {} -static inline void selinux_exit(void) {} +static inline void selinux_setfilecon(struct udev *udev, const char *file, const char *devname, unsigned int mode) {} +static inline void selinux_setfscreatecon(struct udev *udev, const char *file, const char *devname, unsigned int mode) {} +static inline void selinux_resetfscreatecon(struct udev *udev) {} +static inline void selinux_init(struct udev *udev) {} +static inline void selinux_exit(struct udev *udev) {} #endif #endif diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c index 91f5997d0c..f0dfd7f4be 100644 --- a/udev/udev_sysfs.c +++ b/udev/udev_sysfs.c @@ -29,13 +29,12 @@ #include "udev.h" -char sysfs_path[PATH_SIZE]; - /* device cache */ static LIST_HEAD(dev_list); /* attribute value cache */ static LIST_HEAD(attr_list); + struct sysfs_attr { struct list_head node; char path[PATH_SIZE]; @@ -45,16 +44,6 @@ struct sysfs_attr { int sysfs_init(void) { - const char *env; - - env = getenv("SYSFS_PATH"); - if (env) { - strlcpy(sysfs_path, env, sizeof(sysfs_path)); - remove_trailing_chars(sysfs_path, '/'); - } else - strlcpy(sysfs_path, "/sys", sizeof(sysfs_path)); - dbg("sysfs_path='%s'\n", sysfs_path); - INIT_LIST_HEAD(&dev_list); INIT_LIST_HEAD(&attr_list); return 0; @@ -78,7 +67,8 @@ void sysfs_cleanup(void) } } -void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, +void sysfs_device_set_values(struct udev *udev, + struct sysfs_device *dev, const char *devpath, const char *subsystem, const char *driver) { char *pos; @@ -94,7 +84,7 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, if (pos == NULL) return; strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); - dbg("kernel='%s'\n", dev->kernel); + dbg(udev, "kernel='%s'\n", dev->kernel); /* some devices have '!' in their name, change that to '/' */ pos = dev->kernel; @@ -109,10 +99,10 @@ void sysfs_device_set_values(struct sysfs_device *dev, const char *devpath, while (isdigit(pos[-1])) pos--; strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); - dbg("kernel_number='%s'\n", dev->kernel_number); + dbg(udev, "kernel_number='%s'\n", dev->kernel_number); } -int sysfs_resolve_link(char *devpath, size_t size) +int sysfs_resolve_link(struct udev *udev, char *devpath, size_t size) { char link_path[PATH_SIZE]; char link_target[PATH_SIZE]; @@ -120,17 +110,17 @@ int sysfs_resolve_link(char *devpath, size_t size) int i; int back; - strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); strlcat(link_path, devpath, sizeof(link_path)); len = readlink(link_path, link_target, sizeof(link_target)); if (len <= 0) return -1; link_target[len] = '\0'; - dbg("path link '%s' points to '%s'\n", devpath, link_target); + dbg(udev, "path link '%s' points to '%s'\n", devpath, link_target); for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) ; - dbg("base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); + dbg(udev, "base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); for (i = 0; i <= back; i++) { char *pos = strrchr(devpath, '/'); @@ -138,13 +128,13 @@ int sysfs_resolve_link(char *devpath, size_t size) return -1; pos[0] = '\0'; } - dbg("after moving back '%s'\n", devpath); + dbg(udev, "after moving back '%s'\n", devpath); strlcat(devpath, "/", size); strlcat(devpath, &link_target[back * 3], size); return 0; } -struct sysfs_device *sysfs_device_get(const char *devpath) +struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) { char path[PATH_SIZE]; char devpath_real[PATH_SIZE]; @@ -166,7 +156,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strncmp(devpath, "/block/", 7) != 0) return NULL; - dbg("open '%s'\n", devpath); + dbg(udev, "open '%s'\n", devpath); strlcpy(devpath_real, devpath, sizeof(devpath_real)); remove_trailing_chars(devpath_real, '/'); if (devpath[0] == '\0' ) @@ -175,49 +165,49 @@ struct sysfs_device *sysfs_device_get(const char *devpath) /* look for device already in cache (we never put an untranslated path in the cache) */ list_for_each_entry(dev_loop, &dev_list, node) { if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'\n", dev_loop->devpath); + dbg(udev, "found in cache '%s'\n", dev_loop->devpath); return dev_loop; } } /* if we got a link, resolve it to the real device */ - strlcpy(path, sysfs_path, sizeof(path)); + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); strlcat(path, devpath_real, sizeof(path)); if (lstat(path, &statbuf) != 0) { - dbg("stat '%s' failed: %s\n", path, strerror(errno)); + dbg(udev, "stat '%s' failed: %s\n", path, strerror(errno)); return NULL; } if (S_ISLNK(statbuf.st_mode)) { - if (sysfs_resolve_link(devpath_real, sizeof(devpath_real)) != 0) + if (sysfs_resolve_link(udev, devpath_real, sizeof(devpath_real)) != 0) return NULL; /* now look for device in cache after path translation */ list_for_each_entry(dev_loop, &dev_list, node) { if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg("found in cache '%s'\n", dev_loop->devpath); + dbg(udev, "found in cache '%s'\n", dev_loop->devpath); return dev_loop; } } } /* it is a new device */ - dbg("new uncached device '%s'\n", devpath_real); + dbg(udev, "new uncached device '%s'\n", devpath_real); dev = malloc(sizeof(struct sysfs_device)); if (dev == NULL) return NULL; memset(dev, 0x00, sizeof(struct sysfs_device)); - sysfs_device_set_values(dev, devpath_real, NULL, NULL); + sysfs_device_set_values(udev, dev, devpath_real, NULL, NULL); /* get subsystem name */ - strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); strlcat(link_path, dev->devpath, sizeof(link_path)); strlcat(link_path, "/subsystem", sizeof(link_path)); len = readlink(link_path, link_target, sizeof(link_target)); if (len > 0) { /* get subsystem from "subsystem" link */ link_target[len] = '\0'; - dbg("subsystem link '%s' points to '%s'\n", link_path, link_target); + dbg(udev, "subsystem link '%s' points to '%s'\n", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); @@ -240,37 +230,37 @@ struct sysfs_device *sysfs_device_get(const char *devpath) } /* get driver name */ - strlcpy(link_path, sysfs_path, sizeof(link_path)); + strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); strlcat(link_path, dev->devpath, sizeof(link_path)); strlcat(link_path, "/driver", sizeof(link_path)); len = readlink(link_path, link_target, sizeof(link_target)); if (len > 0) { link_target[len] = '\0'; - dbg("driver link '%s' points to '%s'\n", link_path, link_target); + dbg(udev, "driver link '%s' points to '%s'\n", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); } - dbg("add to cache 'devpath=%s', subsystem='%s', driver='%s'\n", dev->devpath, dev->subsystem, dev->driver); + dbg(udev, "add to cache 'devpath=%s', subsystem='%s', driver='%s'\n", dev->devpath, dev->subsystem, dev->driver); list_add(&dev->node, &dev_list); return dev; } -struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) +struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_device *dev) { char parent_devpath[PATH_SIZE]; char *pos; - dbg("open '%s'\n", dev->devpath); + dbg(udev, "open '%s'\n", dev->devpath); /* look if we already know the parent */ if (dev->parent != NULL) return dev->parent; strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - dbg("'%s'\n", parent_devpath); + dbg(udev, "'%s'\n", parent_devpath); /* strip last element */ pos = strrchr(parent_devpath, '/'); @@ -281,12 +271,12 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) if (strncmp(parent_devpath, "/class", 6) == 0) { pos = strrchr(parent_devpath, '/'); if (pos == &parent_devpath[6] || pos == parent_devpath) { - dbg("/class top level, look for device link\n"); + dbg(udev, "/class top level, look for device link\n"); goto device_link; } } if (strcmp(parent_devpath, "/block") == 0) { - dbg("/block top level, look for device link\n"); + dbg(udev, "/block top level, look for device link\n"); goto device_link; } @@ -296,34 +286,34 @@ struct sysfs_device *sysfs_device_get_parent(struct sysfs_device *dev) return NULL; /* get parent and remember it */ - dev->parent = sysfs_device_get(parent_devpath); + dev->parent = sysfs_device_get(udev, parent_devpath); return dev->parent; device_link: strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); strlcat(parent_devpath, "/device", sizeof(parent_devpath)); - if (sysfs_resolve_link(parent_devpath, sizeof(parent_devpath)) != 0) + if (sysfs_resolve_link(udev, parent_devpath, sizeof(parent_devpath)) != 0) return NULL; /* get parent and remember it */ - dev->parent = sysfs_device_get(parent_devpath); + dev->parent = sysfs_device_get(udev, parent_devpath); return dev->parent; } -struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem) +struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct udev *udev, struct sysfs_device *dev, const char *subsystem) { struct sysfs_device *dev_parent; - dev_parent = sysfs_device_get_parent(dev); + dev_parent = sysfs_device_get_parent(udev, dev); while (dev_parent != NULL) { if (strcmp(dev_parent->subsystem, subsystem) == 0) return dev_parent; - dev_parent = sysfs_device_get_parent(dev_parent); + dev_parent = sysfs_device_get_parent(udev, dev_parent); } return NULL; } -char *sysfs_attr_get_value(const char *devpath, const char *attr_name) +char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *attr_name) { char path_full[PATH_SIZE]; const char *path; @@ -335,8 +325,8 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) ssize_t size; size_t sysfs_len; - dbg("open '%s'/'%s'\n", devpath, attr_name); - sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); + dbg(udev, "open '%s'/'%s'\n", devpath, attr_name); + sysfs_len = strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); if(sysfs_len >= sizeof(path_full)) sysfs_len = sizeof(path_full) - 1; path = &path_full[sysfs_len]; @@ -347,23 +337,23 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* look for attribute in cache */ list_for_each_entry(attr_loop, &attr_list, node) { if (strcmp(attr_loop->path, path) == 0) { - dbg("found in cache '%s'\n", attr_loop->path); + dbg(udev, "found in cache '%s'\n", attr_loop->path); return attr_loop->value; } } /* store attribute in cache (also negatives are kept in cache) */ - dbg("new uncached attribute '%s'\n", path_full); + dbg(udev, "new uncached attribute '%s'\n", path_full); attr = malloc(sizeof(struct sysfs_attr)); if (attr == NULL) return NULL; memset(attr, 0x00, sizeof(struct sysfs_attr)); strlcpy(attr->path, path, sizeof(attr->path)); - dbg("add to cache '%s'\n", path_full); + dbg(udev, "add to cache '%s'\n", path_full); list_add(&attr->node, &attr_list); if (lstat(path_full, &statbuf) != 0) { - dbg("stat '%s' failed: %s\n", path_full, strerror(errno)); + dbg(udev, "stat '%s' failed: %s\n", path_full, strerror(errno)); goto out; } @@ -378,7 +368,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) link_target[len] = '\0'; pos = strrchr(link_target, '/'); if (pos != NULL) { - dbg("cache '%s' with link value '%s'\n", path_full, value); + dbg(udev, "cache '%s' with link value '%s'\n", path_full, value); strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); attr->value = attr->value_local; } @@ -397,7 +387,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* read attribute value */ fd = open(path_full, O_RDONLY); if (fd < 0) { - dbg("attribute '%s' can not be opened\n", path_full); + dbg(udev, "attribute '%s' can not be opened\n", path_full); goto out; } size = read(fd, value, sizeof(value)); @@ -410,7 +400,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) /* got a valid value, store and return it */ value[size] = '\0'; remove_trailing_chars(value, '\n'); - dbg("cache '%s' with attribute value '%s'\n", path_full, value); + dbg(udev, "cache '%s' with attribute value '%s'\n", path_full, value); strlcpy(attr->value_local, value, sizeof(attr->value_local)); attr->value = attr->value_local; @@ -418,14 +408,14 @@ out: return attr->value; } -int sysfs_lookup_devpath_by_subsys_id(char *devpath_full, size_t len, const char *subsystem, const char *id) +int sysfs_lookup_devpath_by_subsys_id(struct udev *udev, char *devpath_full, size_t len, const char *subsystem, const char *id) { size_t sysfs_len; char path_full[PATH_SIZE]; char *path; struct stat statbuf; - sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full)); + sysfs_len = strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); path = &path_full[sysfs_len]; if (strcmp(subsystem, "subsystem") == 0) { @@ -504,7 +494,7 @@ out: return 0; found: if (S_ISLNK(statbuf.st_mode)) - sysfs_resolve_link(path, sizeof(path_full) - sysfs_len); + sysfs_resolve_link(udev, path, sizeof(path_full) - sysfs_len); strlcpy(devpath_full, path, len); return 1; } diff --git a/udev/udev_utils.c b/udev/udev_utils.c index f63a9fa1d0..1649b8cbf0 100644 --- a/udev/udev_utils.c +++ b/udev/udev_utils.c @@ -55,7 +55,7 @@ int log_priority(const char *priority) return 0; } -struct name_entry *name_list_add(struct list_head *name_list, const char *name, int sort) +struct name_entry *name_list_add(struct udev *udev, struct list_head *name_list, const char *name, int sort) { struct name_entry *name_loop; struct name_entry *name_new; @@ -63,7 +63,7 @@ struct name_entry *name_list_add(struct list_head *name_list, const char *name, /* avoid duplicate entries */ list_for_each_entry(name_loop, name_list, node) { if (strcmp(name_loop->name, name) == 0) { - dbg("'%s' is already in the list\n", name); + dbg(udev, "'%s' is already in the list\n", name); return name_loop; } } @@ -79,20 +79,20 @@ struct name_entry *name_list_add(struct list_head *name_list, const char *name, return NULL; memset(name_new, 0x00, sizeof(struct name_entry)); strlcpy(name_new->name, name, sizeof(name_new->name)); - dbg("adding '%s'\n", name_new->name); + dbg(udev, "adding '%s'\n", name_new->name); list_add_tail(&name_new->node, &name_loop->node); return name_new; } -struct name_entry *name_list_key_add(struct list_head *name_list, const char *key, const char *value) +struct name_entry *name_list_key_add(struct udev *udev, struct list_head *name_list, const char *key, const char *value) { struct name_entry *name_loop; struct name_entry *name_new; list_for_each_entry(name_loop, name_list, node) { if (strncmp(name_loop->name, key, strlen(key)) == 0) { - dbg("key already present '%s', replace it\n", name_loop->name); + dbg(udev, "key already present '%s', replace it\n", name_loop->name); snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); name_loop->name[sizeof(name_loop->name)-1] = '\0'; return name_loop; @@ -105,13 +105,13 @@ struct name_entry *name_list_key_add(struct list_head *name_list, const char *ke memset(name_new, 0x00, sizeof(struct name_entry)); snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); name_new->name[sizeof(name_new->name)-1] = '\0'; - dbg("adding '%s'\n", name_new->name); + dbg(udev, "adding '%s'\n", name_new->name); list_add_tail(&name_new->node, &name_loop->node); return name_new; } -int name_list_key_remove(struct list_head *name_list, const char *key) +int name_list_key_remove(struct udev *udev, struct list_head *name_list, const char *key) { struct name_entry *name_loop; struct name_entry *name_tmp; @@ -131,7 +131,7 @@ int name_list_key_remove(struct list_head *name_list, const char *key) return retval; } -void name_list_cleanup(struct list_head *name_list) +void name_list_cleanup(struct udev *udev, struct list_head *name_list) { struct name_entry *name_loop; struct name_entry *name_tmp; @@ -143,16 +143,16 @@ void name_list_cleanup(struct list_head *name_list) } /* calls function for every file found in specified directory */ -int add_matching_files(struct list_head *name_list, const char *dirname, const char *suffix) +int add_matching_files(struct udev *udev, struct list_head *name_list, const char *dirname, const char *suffix) { struct dirent *ent; DIR *dir; char filename[PATH_SIZE]; - dbg("open directory '%s'\n", dirname); + dbg(udev, "open directory '%s'\n", dirname); dir = opendir(dirname); if (dir == NULL) { - err("unable to open '%s': %s\n", dirname, strerror(errno)); + err(udev, "unable to open '%s': %s\n", dirname, strerror(errno)); return -1; } @@ -174,18 +174,18 @@ int add_matching_files(struct list_head *name_list, const char *dirname, const c if (strcmp(ext, suffix) != 0) continue; } - dbg("put file '%s/%s' into list\n", dirname, ent->d_name); + dbg(udev, "put file '%s/%s' into list\n", dirname, ent->d_name); snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); filename[sizeof(filename)-1] = '\0'; - name_list_add(name_list, filename, 1); + name_list_add(udev, name_list, filename, 1); } closedir(dir); return 0; } -uid_t lookup_user(const char *user) +uid_t lookup_user(struct udev *udev, const char *user) { struct passwd *pw; uid_t uid = 0; @@ -194,16 +194,16 @@ uid_t lookup_user(const char *user) pw = getpwnam(user); if (pw == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified user '%s' unknown\n", user); + err(udev, "specified user '%s' unknown\n", user); else - err("error resolving user '%s': %s\n", user, strerror(errno)); + err(udev, "error resolving user '%s': %s\n", user, strerror(errno)); } else uid = pw->pw_uid; return uid; } -extern gid_t lookup_group(const char *group) +extern gid_t lookup_group(struct udev *udev, const char *group) { struct group *gr; gid_t gid = 0; @@ -212,9 +212,9 @@ extern gid_t lookup_group(const char *group) gr = getgrnam(group); if (gr == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) - err("specified group '%s' unknown\n", group); + err(udev, "specified group '%s' unknown\n", group); else - err("error resolving group '%s': %s\n", group, strerror(errno)); + err(udev, "error resolving group '%s': %s\n", group, strerror(errno)); } else gid = gr->gr_gid; diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c index 3e73c8769e..7ccb5b4039 100644 --- a/udev/udev_utils_file.c +++ b/udev/udev_utils_file.c @@ -32,7 +32,7 @@ #include "udev.h" #include "udev_selinux.h" -int create_path(const char *path) +int create_path(struct udev *udev, const char *path) { char p[PATH_SIZE]; char *pos; @@ -48,17 +48,17 @@ int create_path(const char *path) pos--; pos[0] = '\0'; - dbg("stat '%s'\n", p); + dbg(udev, "stat '%s'\n", p); if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) return 0; - if (create_path(p) != 0) + if (create_path(udev, p) != 0) return -1; - dbg("mkdir '%s'\n", p); - selinux_setfscreatecon(p, NULL, S_IFDIR|0755); + dbg(udev, "mkdir '%s'\n", p); + selinux_setfscreatecon(udev, p, NULL, S_IFDIR|0755); ret = mkdir(p, 0755); - selinux_resetfscreatecon(); + selinux_resetfscreatecon(udev); if (ret == 0) return 0; @@ -68,7 +68,7 @@ int create_path(const char *path) return -1; } -int delete_path(const char *path) +int delete_path(struct udev *udev, const char *path) { char p[PATH_SIZE]; char *pos; @@ -94,10 +94,10 @@ int delete_path(const char *path) if (retval) { if (errno == ENOTEMPTY) return 0; - err("rmdir(%s) failed: %s\n", p, strerror(errno)); + err(udev, "rmdir(%s) failed: %s\n", p, strerror(errno)); break; } - dbg("removed '%s'\n", p); + dbg(udev, "removed '%s'\n", p); } return 0; } @@ -105,24 +105,24 @@ int delete_path(const char *path) /* Reset permissions on the device node, before unlinking it to make sure, * that permisions of possible hard links will be removed too. */ -int unlink_secure(const char *filename) +int unlink_secure(struct udev *udev, const char *filename) { int retval; retval = chown(filename, 0, 0); if (retval) - err("chown(%s, 0, 0) failed: %s\n", filename, strerror(errno)); + err(udev, "chown(%s, 0, 0) failed: %s\n", filename, strerror(errno)); retval = chmod(filename, 0000); if (retval) - err("chmod(%s, 0000) failed: %s\n", filename, strerror(errno)); + err(udev, "chmod(%s, 0000) failed: %s\n", filename, strerror(errno)); retval = unlink(filename); if (errno == ENOENT) retval = 0; if (retval) - err("unlink(%s) failed: %s\n", filename, strerror(errno)); + err(udev, "unlink(%s) failed: %s\n", filename, strerror(errno)); return retval; } diff --git a/udev/udev_utils_string.c b/udev/udev_utils_string.c index 78bfca800c..3bfe22c815 100644 --- a/udev/udev_utils_string.c +++ b/udev/udev_utils_string.c @@ -46,6 +46,8 @@ void remove_trailing_chars(char *path, char c) { size_t len; + if (path == NULL) + return; len = strlen(path); while (len > 0 && path[len-1] == c) path[--len] = '\0'; diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index de4b658d5b..6e10316fbe 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -34,12 +34,9 @@ #include "udev.h" #include "udevd.h" -static int udev_log = 0; - -int udevadm_control(int argc, char *argv[]) +int udevadm_control(struct udev *udev, int argc, char *argv[]) { struct udev_ctrl *uctrl; - const char *env; int rc = 1; /* compat values with '_' will be removed in a future release */ @@ -61,19 +58,12 @@ int udevadm_control(int argc, char *argv[]) {} }; - env = getenv("UDEV_LOG"); - if (env) - udev_log = log_priority(env); - - logging_init("udevcontrol"); - dbg("version %s\n", VERSION); - if (getuid() != 0) { fprintf(stderr, "root privileges required\n"); goto exit; } - uctrl = udev_ctrl_new_from_socket(UDEVD_CTRL_SOCK_PATH); + uctrl = udev_ctrl_new_from_socket(udev, UDEVD_CTRL_SOCK_PATH); if (uctrl == NULL) goto exit; @@ -87,7 +77,7 @@ int udevadm_control(int argc, char *argv[]) break; if (option > 255) { - info("udevadm control expects commands without underscore, " + info(udev, "udevadm control expects commands without underscore, " "this will stop working in a future release\n"); fprintf(stderr, "udevadm control expects commands without underscore, " "this will stop working in a future release\n"); @@ -140,7 +130,6 @@ int udevadm_control(int argc, char *argv[]) } udev_ctrl_set_max_childs_running(uctrl, i); break; - break; case 'h': printf("Usage: udevadm control COMMAND\n" " --log-priority= set the udev log level for the daemon\n" @@ -163,7 +152,7 @@ int udevadm_control(int argc, char *argv[]) fprintf(stderr, "udevadm control commands requires the -- format, " "this will stop working in a future release\n"); - err("udevadm control commands requires the -- format, " + err(udev, "udevadm control commands requires the -- format, " "this will stop working in a future release\n"); if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { @@ -182,11 +171,10 @@ int udevadm_control(int argc, char *argv[]) udev_ctrl_set_env(uctrl, &arg[strlen("env=")]); } else { fprintf(stderr, "unrecognized command '%s'\n", arg); - err("unrecognized command '%s'\n", arg); + err(udev, "unrecognized command '%s'\n", arg); } } exit: udev_ctrl_unref(uctrl); - logging_close(); return rc; } diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index fdf53d2ab5..b54b61e084 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -33,13 +33,13 @@ #include "udev.h" -static void print_all_attributes(const char *devpath, const char *key) +static void print_all_attributes(struct udev *udev, const char *devpath, const char *key) { char path[PATH_SIZE]; DIR *dir; struct dirent *dent; - strlcpy(path, sysfs_path, sizeof(path)); + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); strlcat(path, devpath, sizeof(path)); dir = opendir(path); @@ -67,13 +67,13 @@ static void print_all_attributes(const char *devpath, const char *key) if (S_ISLNK(statbuf.st_mode)) continue; - attr_value = sysfs_attr_get_value(devpath, dent->d_name); + attr_value = sysfs_attr_get_value(udev, devpath, dent->d_name); if (attr_value == NULL) continue; len = strlcpy(value, attr_value, sizeof(value)); if(len >= sizeof(value)) len = sizeof(value) - 1; - dbg("attr '%s'='%s'(%zi)\n", dent->d_name, value, len); + dbg(udev, "attr '%s'='%s'(%zi)\n", dent->d_name, value, len); /* remove trailing newlines */ while (len && value[len-1] == '\n') @@ -83,7 +83,7 @@ static void print_all_attributes(const char *devpath, const char *key) while (len && isprint(value[len-1])) len--; if (len) { - dbg("attribute value of '%s' non-printable, skip\n", dent->d_name); + dbg(udev, "attribute value of '%s' non-printable, skip\n", dent->d_name); continue; } @@ -93,11 +93,11 @@ static void print_all_attributes(const char *devpath, const char *key) printf("\n"); } -static int print_device_chain(const char *devpath) +static int print_device_chain(struct udev *udev, const char *devpath) { struct sysfs_device *dev; - dev = sysfs_device_get(devpath); + dev = sysfs_device_get(udev, devpath); if (dev == NULL) return -1; @@ -113,11 +113,11 @@ static int print_device_chain(const char *devpath) printf(" KERNEL==\"%s\"\n", dev->kernel); printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); printf(" DRIVER==\"%s\"\n", dev->driver); - print_all_attributes(dev->devpath, "ATTR"); + print_all_attributes(udev, dev->devpath, "ATTR"); /* walk up the chain of devices */ while (1) { - dev = sysfs_device_get_parent(dev); + dev = sysfs_device_get_parent(udev, dev); if (dev == NULL) break; printf(" looking at parent device '%s':\n", dev->devpath); @@ -125,93 +125,94 @@ static int print_device_chain(const char *devpath) printf(" SUBSYSTEMS==\"%s\"\n", dev->subsystem); printf(" DRIVERS==\"%s\"\n", dev->driver); - print_all_attributes(dev->devpath, "ATTRS"); + print_all_attributes(udev, dev->devpath, "ATTRS"); } return 0; } -static void print_record(struct udevice *udev) +static void print_record(struct udevice *udevice) { struct name_entry *name_loop; - printf("P: %s\n", udev->dev->devpath); - printf("N: %s\n", udev->name); - list_for_each_entry(name_loop, &udev->symlink_list, node) + printf("P: %s\n", udevice->dev->devpath); + printf("N: %s\n", udevice->name); + list_for_each_entry(name_loop, &udevice->symlink_list, node) printf("S: %s\n", name_loop->name); - if (udev->link_priority != 0) - printf("L: %i\n", udev->link_priority); - if (udev->partitions != 0) - printf("A:%u\n", udev->partitions); - if (udev->ignore_remove) - printf("R:%u\n", udev->ignore_remove); - list_for_each_entry(name_loop, &udev->env_list, node) + if (udevice->link_priority != 0) + printf("L: %i\n", udevice->link_priority); + if (udevice->partitions != 0) + printf("A:%u\n", udevice->partitions); + if (udevice->ignore_remove) + printf("R:%u\n", udevice->ignore_remove); + list_for_each_entry(name_loop, &udevice->env_list, node) printf("E: %s\n", name_loop->name); } -static void export_db(void) { +static void export_db(struct udev *udev) +{ LIST_HEAD(name_list); struct name_entry *name_loop; - udev_db_get_all_entries(&name_list); + udev_db_get_all_entries(udev, &name_list); list_for_each_entry(name_loop, &name_list, node) { - struct udevice *udev_db; + struct udevice *udevice_db; - udev_db = udev_device_init(); - if (udev_db == NULL) + udevice_db = udev_device_init(udev); + if (udevice_db == NULL) continue; - if (udev_db_get_device(udev_db, name_loop->name) == 0) - print_record(udev_db); + if (udev_db_get_device(udevice_db, name_loop->name) == 0) + print_record(udevice_db); printf("\n"); - udev_device_cleanup(udev_db); + udev_device_cleanup(udevice_db); } - name_list_cleanup(&name_list); + name_list_cleanup(udev, &name_list); } -static int lookup_device_by_name(struct udevice **udev, const char *name) +static int lookup_device_by_name(struct udev *udev, struct udevice **udevice, const char *name) { LIST_HEAD(name_list); int count; struct name_entry *device; int rc = -1; - count = udev_db_get_devices_by_name(name, &name_list); + count = udev_db_get_devices_by_name(udev, name, &name_list); if (count <= 0) goto out; - info("found %i devices for '%s'\n", count, name); + info(udev, "found %i devices for '%s'\n", count, name); /* select the device that seems to match */ list_for_each_entry(device, &name_list, node) { - struct udevice *udev_loop; + struct udevice *udevice_loop; char filename[PATH_SIZE]; struct stat statbuf; - udev_loop = udev_device_init(); - if (udev_loop == NULL) + udevice_loop = udev_device_init(udev); + if (udevice_loop == NULL) break; - if (udev_db_get_device(udev_loop, device->name) != 0) + if (udev_db_get_device(udevice_loop, device->name) != 0) goto next; - info("found db entry '%s'\n", device->name); + info(udev, "found db entry '%s'\n", device->name); /* make sure, we don't get a link of a different device */ - strlcpy(filename, udev_root, sizeof(filename)); + strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); strlcat(filename, "/", sizeof(filename)); strlcat(filename, name, sizeof(filename)); if (stat(filename, &statbuf) != 0) goto next; - if (major(udev_loop->devt) > 0 && udev_loop->devt != statbuf.st_rdev) { - info("skip '%s', dev_t doesn't match\n", udev_loop->name); + if (major(udevice_loop->devt) > 0 && udevice_loop->devt != statbuf.st_rdev) { + info(udev, "skip '%s', dev_t doesn't match\n", udevice_loop->name); goto next; } rc = 0; - *udev = udev_loop; + *udevice = udevice_loop; break; next: - udev_device_cleanup(udev_loop); + udev_device_cleanup(udevice_loop); } out: - name_list_cleanup(&name_list); + name_list_cleanup(udev, &name_list); return rc; } @@ -234,10 +235,9 @@ static int stat_device(const char *name, int export, const char *prefix) return 0; } -int udevadm_info(int argc, char *argv[]) +int udevadm_info(struct udev *udev, int argc, char *argv[]) { - int option; - struct udevice *udev = NULL; + struct udevice *udevice = NULL; int root = 0; int export = 0; const char *export_prefix = NULL; @@ -280,31 +280,33 @@ int udevadm_info(int argc, char *argv[]) int rc = 0; while (1) { + int option; + option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); if (option == -1) break; - dbg("option '%c'\n", option); + dbg(udev, "option '%c'\n", option); switch (option) { case 'n': /* remove /dev if given */ - if (strncmp(optarg, udev_root, strlen(udev_root)) == 0) - strlcpy(name, &optarg[strlen(udev_root)+1], sizeof(name)); + if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) == 0) + strlcpy(name, &optarg[strlen(udev_get_dev_path(udev))+1], sizeof(name)); else strlcpy(name, optarg, sizeof(name)); remove_trailing_chars(name, '/'); - dbg("name: %s\n", name); + dbg(udev, "name: %s\n", name); break; case 'p': /* remove /sys if given */ - if (strncmp(optarg, sysfs_path, strlen(sysfs_path)) == 0) - strlcpy(path, &optarg[strlen(sysfs_path)], sizeof(path)); + if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) == 0) + strlcpy(path, &optarg[strlen(udev_get_sys_path(udev))], sizeof(path)); else strlcpy(path, optarg, sizeof(path)); remove_trailing_chars(path, '/'); /* possibly resolve to real devpath */ - if (sysfs_resolve_link(path, sizeof(path)) != 0) { + if (sysfs_resolve_link(udev, path, sizeof(path)) != 0) { char temp[PATH_SIZE]; char *pos; @@ -316,13 +318,13 @@ int udevadm_info(int argc, char *argv[]) strlcpy(tail, pos, sizeof(tail)); pos[0] = '\0'; - if (sysfs_resolve_link(temp, sizeof(temp)) == 0) { + if (sysfs_resolve_link(udev, temp, sizeof(temp)) == 0) { strlcpy(path, temp, sizeof(path)); strlcat(path, tail, sizeof(path)); } } } - dbg("path: %s\n", path); + dbg(udev, "path: %s\n", path); break; case 'q': action = ACTION_QUERY; @@ -362,7 +364,7 @@ int udevadm_info(int argc, char *argv[]) action = ACTION_ATTRIBUTE_WALK; break; case 'e': - export_db(); + export_db(udev); goto exit; case 'x': export = 1; @@ -404,18 +406,18 @@ int udevadm_info(int argc, char *argv[]) case ACTION_QUERY: /* needs devpath or node/symlink name for query */ if (path[0] != '\0') { - udev = udev_device_init(); - if (udev == NULL) { + udevice = udev_device_init(udev); + if (udevice == NULL) { rc = 1; goto exit; } - if (udev_db_get_device(udev, path) != 0) { + if (udev_db_get_device(udevice, path) != 0) { fprintf(stderr, "no record for '%s' in database\n", path); rc = 3; goto exit; } } else if (name[0] != '\0') { - if (lookup_device_by_name(&udev, name) != 0) { + if (lookup_device_by_name(udev, &udevice, name) != 0) { fprintf(stderr, "node name not found\n"); rc = 4; goto exit; @@ -429,29 +431,29 @@ int udevadm_info(int argc, char *argv[]) switch(query) { case QUERY_NAME: if (root) - printf("%s/%s\n", udev_root, udev->name); + printf("%s/%s\n", udev_get_dev_path(udev), udevice->name); else - printf("%s\n", udev->name); + printf("%s\n", udevice->name); break; case QUERY_SYMLINK: - list_for_each_entry(name_loop, &udev->symlink_list, node) { - char c = name_loop->node.next != &udev->symlink_list ? ' ' : '\n'; + list_for_each_entry(name_loop, &udevice->symlink_list, node) { + char c = name_loop->node.next != &udevice->symlink_list ? ' ' : '\n'; if (root) - printf("%s/%s%c", udev_root, name_loop->name, c); + printf("%s/%s%c", udev_get_dev_path(udev), name_loop->name, c); else printf("%s%c", name_loop->name, c); } break; case QUERY_PATH: - printf("%s\n", udev->dev->devpath); + printf("%s\n", udevice->dev->devpath); goto exit; case QUERY_ENV: - list_for_each_entry(name_loop, &udev->env_list, node) + list_for_each_entry(name_loop, &udevice->env_list, node) printf("%s\n", name_loop->name); break; case QUERY_ALL: - print_record(udev); + print_record(udevice); break; default: fprintf(stderr, "unknown query type\n"); @@ -460,18 +462,18 @@ int udevadm_info(int argc, char *argv[]) break; case ACTION_ATTRIBUTE_WALK: if (path[0] != '\0') { - if (print_device_chain(path) != 0) { + if (print_device_chain(udev, path) != 0) { fprintf(stderr, "no valid sysfs device found\n"); rc = 4; goto exit; } } else if (name[0] != '\0') { - if (lookup_device_by_name(&udev, name) != 0) { + if (lookup_device_by_name(udev, &udevice, name) != 0) { fprintf(stderr, "node name not found\n"); rc = 4; goto exit; } - if (print_device_chain(udev->dev->devpath) != 0) { + if (print_device_chain(udev, udevice->dev->devpath) != 0) { fprintf(stderr, "no valid sysfs device found\n"); rc = 4; goto exit; @@ -487,7 +489,7 @@ int udevadm_info(int argc, char *argv[]) rc = 6; break; case ACTION_ROOT: - printf("%s\n", udev_root); + printf("%s\n", udev_get_dev_path(udev)); break; default: fprintf(stderr, "missing option\n"); @@ -496,6 +498,6 @@ int udevadm_info(int argc, char *argv[]) } exit: - udev_device_cleanup(udev); + udev_device_cleanup(udevice); return rc; } diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index a45f165cfe..0b9b811809 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -123,13 +123,13 @@ static const char *search_key(const char *searchkey, const char *buf, size_t buf return NULL; } -int udevadm_monitor(int argc, char *argv[]) +int udevadm_monitor(struct udev *udev, int argc, char *argv[]) { struct sigaction act; int option; int env = 0; - int kernel = 0; - int udev = 0; + int print_kernel = 0; + int print_udev = 0; fd_set readfds; int retval = 0; @@ -151,10 +151,10 @@ int udevadm_monitor(int argc, char *argv[]) env = 1; break; case 'k': - kernel = 1; + print_kernel = 1; break; case 'u': - udev = 1; + print_udev = 1; break; case 'h': printf("Usage: udevadm monitor [--environment] [--kernel] [--udev] [--help]\n" @@ -167,12 +167,12 @@ int udevadm_monitor(int argc, char *argv[]) } } - if (!kernel && !udev) { - kernel = 1; - udev =1; + if (!print_kernel && !print_udev) { + print_kernel = 1; + print_udev =1; } - if (getuid() != 0 && kernel) { + if (getuid() != 0 && print_kernel) { fprintf(stderr, "root privileges needed to subscribe to kernel events\n"); goto out; } @@ -185,14 +185,14 @@ int udevadm_monitor(int argc, char *argv[]) sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); - printf("udevmonitor will print the received events for:\n"); - if (udev) { + printf("monitor will print the received events for:\n"); + if (print_udev) { retval = init_udev_monitor_socket(); if (retval) goto out; printf("UDEV the event which udev sends out after rule processing\n"); } - if (kernel) { + if (print_kernel) { retval = init_uevent_netlink_sock(); if (retval) goto out; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 3a886469ad..c519f91cd5 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -35,12 +35,12 @@ #define DEFAULT_TIMEOUT 180 #define LOOP_PER_SECOND 20 -static void print_queue(const char *dir) +static void print_queue(struct udev *udev, const char *dir) { LIST_HEAD(files); struct name_entry *item; - if (add_matching_files(&files, dir, NULL) < 0) + if (add_matching_files(udev, &files, dir, NULL) < 0) return; printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n"); @@ -67,7 +67,7 @@ static void print_queue(const char *dir) printf("\n\n"); } -int udevadm_settle(int argc, char *argv[]) +int udevadm_settle(struct udev *udev, int argc, char *argv[]) { char queuename[PATH_SIZE]; char filename[PATH_SIZE]; @@ -87,7 +87,7 @@ int udevadm_settle(int argc, char *argv[]) int rc = 1; int seconds; - dbg("version %s\n", VERSION); + dbg(udev, "version %s\n", VERSION); while (1) { option = getopt_long(argc, argv, "t:h", options, NULL); @@ -101,7 +101,7 @@ int udevadm_settle(int argc, char *argv[]) timeout = seconds; else fprintf(stderr, "invalid timeout value\n"); - dbg("timeout=%i\n", timeout); + dbg(udev, "timeout=%i\n", timeout); break; case 'h': printf("Usage: udevadm settle [--help] [--timeout=]\n\n"); @@ -109,7 +109,7 @@ int udevadm_settle(int argc, char *argv[]) } } - strlcpy(queuename, udev_root, sizeof(queuename)); + strlcpy(queuename, udev_get_dev_path(udev), sizeof(queuename)); strlcat(queuename, "/.udev/queue", sizeof(queuename)); loop = timeout * LOOP_PER_SECOND; @@ -119,19 +119,19 @@ int udevadm_settle(int argc, char *argv[]) struct stat statbuf; if (stat(queuename, &statbuf) < 0) { - info("queue is empty\n"); + info(udev, "queue is empty\n"); break; } usleep(1000 * 1000 / LOOP_PER_SECOND); } if (loop <= 0) { - info("timeout waiting for queue\n"); - print_queue(queuename); + info(udev, "timeout waiting for queue\n"); + print_queue(udev, queuename); goto exit; } /* read current udev seqnum */ - strlcpy(filename, udev_root, sizeof(filename)); + strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); fd = open(filename, O_RDONLY); if (fd < 0) @@ -142,10 +142,10 @@ int udevadm_settle(int argc, char *argv[]) goto exit; seqnum[len] = '\0'; seq_udev = strtoull(seqnum, NULL, 10); - info("udev seqnum = %llu\n", seq_udev); + info(udev, "udev seqnum = %llu\n", seq_udev); /* read current kernel seqnum */ - strlcpy(filename, sysfs_path, sizeof(filename)); + strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); fd = open(filename, O_RDONLY); if (fd < 0) @@ -156,16 +156,16 @@ int udevadm_settle(int argc, char *argv[]) goto exit; seqnum[len] = '\0'; seq_kernel = strtoull(seqnum, NULL, 10); - info("kernel seqnum = %llu\n", seq_kernel); + info(udev, "kernel seqnum = %llu\n", seq_kernel); /* make sure all kernel events have arrived in the queue */ if (seq_udev >= seq_kernel) { - info("queue is empty and no pending events left\n"); + info(udev, "queue is empty and no pending events left\n"); rc = 0; goto exit; } usleep(1000 * 1000 / LOOP_PER_SECOND); - info("queue is empty, but events still pending\n"); + info(udev, "queue is empty, but events still pending\n"); } exit: diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index d06249c6c1..0f7d5dbe73 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -32,7 +32,7 @@ #include "udev.h" #include "udev_rules.h" -static int import_uevent_var(const char *devpath) +static int import_uevent_var(struct udev *udev, const char *devpath) { char path[PATH_SIZE]; static char value[4096]; /* must stay, used with putenv */ @@ -43,7 +43,7 @@ static int import_uevent_var(const char *devpath) int rc = -1; /* read uevent file */ - strlcpy(path, sysfs_path, sizeof(path)); + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); strlcat(path, devpath, sizeof(path)); strlcat(path, "/uevent", sizeof(path)); fd = open(path, O_RDONLY); @@ -62,7 +62,7 @@ static int import_uevent_var(const char *devpath) if (next == NULL) goto out; next[0] = '\0'; - info("import into environment: '%s'\n", key); + info(udev, "import into environment: '%s'\n", key); putenv(key); key = &next[1]; } @@ -71,13 +71,13 @@ out: return rc; } -int udevadm_test(int argc, char *argv[]) +int udevadm_test(struct udev *udev, int argc, char *argv[]) { int force = 0; const char *action = "add"; const char *subsystem = NULL; const char *devpath = NULL; - struct udevice *udev; + struct udevice *udevice; struct sysfs_device *dev; struct udev_rules rules = {}; int retval; @@ -91,12 +91,13 @@ int udevadm_test(int argc, char *argv[]) {} }; - info("version %s\n", VERSION); - if (udev_log_priority < LOG_INFO) { + info(udev, "version %s\n", VERSION); + + /* export log priority to executed programs */ + if (udev_get_log_priority(udev) > 0) { char priority[32]; - udev_log_priority = LOG_INFO; - sprintf(priority, "%i", udev_log_priority); + sprintf(priority, "%i", udev_get_log_priority(udev)); setenv("UDEV_LOG", priority, 1); } @@ -107,7 +108,7 @@ int udevadm_test(int argc, char *argv[]) if (option == -1) break; - dbg("option '%c'\n", option); + dbg(udev, "option '%c'\n", option); switch (option) { case 'a': action = optarg; @@ -142,21 +143,21 @@ int udevadm_test(int argc, char *argv[]) "some values may be different, or not available at a simulation run.\n" "\n"); - udev_rules_init(&rules, 0); + udev_rules_init(udev, &rules, 0); /* remove /sys if given */ - if (strncmp(devpath, sysfs_path, strlen(sysfs_path)) == 0) - devpath = &devpath[strlen(sysfs_path)]; + if (strncmp(devpath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) == 0) + devpath = &devpath[strlen(udev_get_sys_path(udev))]; - dev = sysfs_device_get(devpath); + dev = sysfs_device_get(udev, devpath); if (dev == NULL) { fprintf(stderr, "unable to open device '%s'\n", devpath); rc = 2; goto exit; } - udev = udev_device_init(); - if (udev == NULL) { + udevice = udev_device_init(udev); + if (udevice == NULL) { fprintf(stderr, "error initializing device\n"); rc = 3; goto exit; @@ -166,37 +167,37 @@ int udevadm_test(int argc, char *argv[]) strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); /* override built-in sysfs device */ - udev->dev = dev; - strlcpy(udev->action, action, sizeof(udev->action)); - udev->devt = udev_device_get_devt(udev); + udevice->dev = dev; + strlcpy(udevice->action, action, sizeof(udevice->action)); + udevice->devt = udev_device_get_devt(udevice); /* simulate node creation with test flag */ if (!force) - udev->test_run = 1; + udevice->test_run = 1; - setenv("DEVPATH", udev->dev->devpath, 1); - setenv("SUBSYSTEM", udev->dev->subsystem, 1); - setenv("ACTION", udev->action, 1); - import_uevent_var(udev->dev->devpath); + setenv("DEVPATH", udevice->dev->devpath, 1); + setenv("SUBSYSTEM", udevice->dev->subsystem, 1); + setenv("ACTION", udevice->action, 1); + import_uevent_var(udev, udevice->dev->devpath); - info("looking at device '%s' from subsystem '%s'\n", udev->dev->devpath, udev->dev->subsystem); - retval = udev_device_event(&rules, udev); + info(udev, "looking at device '%s' from subsystem '%s'\n", udevice->dev->devpath, udevice->dev->subsystem); + retval = udev_device_event(&rules, udevice); - if (udev->event_timeout >= 0) - info("custom event timeout: %i\n", udev->event_timeout); + if (udevice->event_timeout >= 0) + info(udev, "custom event timeout: %i\n", udevice->event_timeout); - if (retval == 0 && !udev->ignore_device && udev_run) { + if (retval == 0 && !udevice->ignore_device && udev_get_run(udev)) { struct name_entry *name_loop; - list_for_each_entry(name_loop, &udev->run_list, node) { + list_for_each_entry(name_loop, &udevice->run_list, node) { char program[PATH_SIZE]; strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udev, program, sizeof(program)); - info("run: '%s'\n", program); + udev_rules_apply_format(udevice, program, sizeof(program)); + info(udev, "run: '%s'\n", program); } } - udev_device_cleanup(udev); + udev_device_cleanup(udevice); exit: udev_rules_cleanup(&rules); diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 04d8f79ba1..1c57e0a217 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -64,13 +64,13 @@ static int delay_device(const char *devpath) return 0; } -static int device_list_insert(const char *path) +static int device_list_insert(struct udev *udev, const char *path) { char filename[PATH_SIZE]; char devpath[PATH_SIZE]; struct stat statbuf; - dbg("add '%s'\n" , path); + dbg(udev, "add '%s'\n" , path); /* we only have a device, if we have an uevent file */ strlcpy(filename, path, sizeof(filename)); @@ -80,25 +80,25 @@ static int device_list_insert(const char *path) if (!(statbuf.st_mode & S_IWUSR)) return -1; - strlcpy(devpath, &path[strlen(sysfs_path)], sizeof(devpath)); + strlcpy(devpath, &path[strlen(udev_get_sys_path(udev))], sizeof(devpath)); /* resolve possible link to real target */ if (lstat(path, &statbuf) < 0) return -1; if (S_ISLNK(statbuf.st_mode)) - if (sysfs_resolve_link(devpath, sizeof(devpath)) != 0) + if (sysfs_resolve_link(udev, devpath, sizeof(devpath)) != 0) return -1; - name_list_add(&device_list, devpath, 1); + name_list_add(udev, &device_list, devpath, 1); return 0; } -static void trigger_uevent(const char *devpath, const char *action) +static void trigger_uevent(struct udev *udev, const char *devpath, const char *action) { char filename[PATH_SIZE]; int fd; - strlcpy(filename, sysfs_path, sizeof(filename)); + strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); strlcat(filename, devpath, sizeof(filename)); strlcat(filename, "/uevent", sizeof(filename)); @@ -110,19 +110,19 @@ static void trigger_uevent(const char *devpath, const char *action) fd = open(filename, O_WRONLY); if (fd < 0) { - dbg("error on opening %s: %s\n", filename, strerror(errno)); + dbg(udev, "error on opening %s: %s\n", filename, strerror(errno)); return; } if (write(fd, action, strlen(action)) < 0) - info("error writing '%s' to '%s': %s\n", action, filename, strerror(errno)); + info(udev, "error writing '%s' to '%s': %s\n", action, filename, strerror(errno)); close(fd); } -static int pass_to_socket(const char *devpath, const char *action, const char *env) +static int pass_to_socket(struct udev *udev, const char *devpath, const char *action, const char *env) { - struct udevice *udev; + struct udevice *udevice; struct name_entry *name_loop; char buf[4096]; size_t bufpos = 0; @@ -136,10 +136,10 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e if (verbose) printf("%s\n", devpath); - udev = udev_device_init(); - if (udev == NULL) + udevice = udev_device_init(udev); + if (udevice == NULL) return -1; - udev_db_get_device(udev, devpath); + udev_db_get_device(udevice, devpath); /* add header */ bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); @@ -158,7 +158,7 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e bufpos++; /* add subsystem */ - strlcpy(path, sysfs_path, sizeof(path)); + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); strlcat(path, devpath, sizeof(path)); strlcat(path, "/subsystem", sizeof(path)); len = readlink(path, link_target, sizeof(link_target)); @@ -175,8 +175,8 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e /* add symlinks and node name */ path[0] = '\0'; - list_for_each_entry(name_loop, &udev->symlink_list, node) { - strlcat(path, udev_root, sizeof(path)); + list_for_each_entry(name_loop, &udevice->symlink_list, node) { + strlcat(path, udev_get_dev_path(udev), sizeof(path)); strlcat(path, "/", sizeof(path)); strlcat(path, name_loop->name, sizeof(path)); strlcat(path, " ", sizeof(path)); @@ -186,16 +186,16 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path); bufpos++; } - if (udev->name[0] != '\0') { - strlcpy(path, udev_root, sizeof(path)); + if (udevice->name[0] != '\0') { + strlcpy(path, udev_get_dev_path(udev), sizeof(path)); strlcat(path, "/", sizeof(path)); - strlcat(path, udev->name, sizeof(path)); + strlcat(path, udevice->name, sizeof(path)); bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path); bufpos++; } /* add keys from device "uevent" file */ - strlcpy(path, sysfs_path, sizeof(path)); + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); strlcat(path, devpath, sizeof(path)); strlcat(path, "/uevent", sizeof(path)); fd = open(path, O_RDONLY); @@ -224,7 +224,7 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e } /* add keys from database */ - list_for_each_entry(name_loop, &udev->env_list, node) { + list_for_each_entry(name_loop, &udevice->env_list, node) { bufpos += strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); bufpos++; } @@ -238,7 +238,7 @@ static int pass_to_socket(const char *devpath, const char *action, const char *e return err; } -static void exec_list(const char *action, const char *env) +static void exec_list(struct udev *udev, const char *action, const char *env) { struct name_entry *loop_device; struct name_entry *tmp_device; @@ -247,9 +247,9 @@ static void exec_list(const char *action, const char *env) if (delay_device(loop_device->name)) continue; if (sock >= 0) - pass_to_socket(loop_device->name, action, env); + pass_to_socket(udev, loop_device->name, action, env); else - trigger_uevent(loop_device->name, action); + trigger_uevent(udev, loop_device->name, action); list_del(&loop_device->node); free(loop_device); } @@ -257,9 +257,9 @@ static void exec_list(const char *action, const char *env) /* trigger remaining delayed devices */ list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { if (sock >= 0) - pass_to_socket(loop_device->name, action, env); + pass_to_socket(udev, loop_device->name, action, env); else - trigger_uevent(loop_device->name, action); + trigger_uevent(udev, loop_device->name, action); list_del(&loop_device->node); free(loop_device); } @@ -357,7 +357,7 @@ enum scan_type { SCAN_SUBSYSTEM, }; -static void scan_subsystem(const char *subsys, enum scan_type scan) +static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type scan) { char base[PATH_SIZE]; DIR *dir; @@ -371,7 +371,7 @@ static void scan_subsystem(const char *subsys, enum scan_type scan) else return; - strlcpy(base, sysfs_path, sizeof(base)); + strlcpy(base, udev_get_sys_path(udev), sizeof(base)); strlcat(base, "/", sizeof(base)); strlcat(base, subsys, sizeof(base)); @@ -397,7 +397,7 @@ static void scan_subsystem(const char *subsys, enum scan_type scan) if (attr_filtered(dirname)) continue; if (!subsystem_filtered("subsystem")) - device_list_insert(dirname); + device_list_insert(udev, dirname); if (subsystem_filtered("drivers")) continue; } @@ -418,7 +418,7 @@ static void scan_subsystem(const char *subsys, enum scan_type scan) strlcat(dirname2, dent2->d_name, sizeof(dirname2)); if (attr_filtered(dirname2)) continue; - device_list_insert(dirname2); + device_list_insert(udev, dirname2); } closedir(dir2); } @@ -427,7 +427,7 @@ static void scan_subsystem(const char *subsys, enum scan_type scan) } } -static void scan_block(void) +static void scan_block(struct udev *udev) { char base[PATH_SIZE]; DIR *dir; @@ -436,7 +436,7 @@ static void scan_block(void) if (subsystem_filtered("block")) return; - strlcpy(base, sysfs_path, sizeof(base)); + strlcpy(base, udev_get_sys_path(udev), sizeof(base)); strlcat(base, "/block", sizeof(base)); dir = opendir(base); @@ -454,7 +454,7 @@ static void scan_block(void) strlcat(dirname, dent->d_name, sizeof(dirname)); if (attr_filtered(dirname)) continue; - if (device_list_insert(dirname) != 0) + if (device_list_insert(udev, dirname) != 0) continue; /* look for partitions */ @@ -474,7 +474,7 @@ static void scan_block(void) strlcat(dirname2, dent2->d_name, sizeof(dirname2)); if (attr_filtered(dirname2)) continue; - device_list_insert(dirname2); + device_list_insert(udev, dirname2); } closedir(dir2); } @@ -483,13 +483,13 @@ static void scan_block(void) } } -static void scan_class(void) +static void scan_class(struct udev *udev) { char base[PATH_SIZE]; DIR *dir; struct dirent *dent; - strlcpy(base, sysfs_path, sizeof(base)); + strlcpy(base, udev_get_sys_path(udev), sizeof(base)); strlcat(base, "/class", sizeof(base)); dir = opendir(base); @@ -524,7 +524,7 @@ static void scan_class(void) strlcat(dirname2, dent2->d_name, sizeof(dirname2)); if (attr_filtered(dirname2)) continue; - device_list_insert(dirname2); + device_list_insert(udev, dirname2); } closedir(dir2); } @@ -533,13 +533,13 @@ static void scan_class(void) } } -static void scan_failed(void) +static void scan_failed(struct udev *udev) { char base[PATH_SIZE]; DIR *dir; struct dirent *dent; - strlcpy(base, udev_root, sizeof(base)); + strlcpy(base, udev_get_dev_path(udev), sizeof(base)); strlcat(base, "/.udev/failed", sizeof(base)); dir = opendir(base); @@ -551,18 +551,18 @@ static void scan_failed(void) if (dent->d_name[0] == '.') continue; - start = strlcpy(device, sysfs_path, sizeof(device)); + start = strlcpy(device, udev_get_sys_path(udev), sizeof(device)); if(start >= sizeof(device)) start = sizeof(device) - 1; strlcat(device, dent->d_name, sizeof(device)); path_decode(&device[start]); - device_list_insert(device); + device_list_insert(udev, device); } closedir(dir); } } -int udevadm_trigger(int argc, char *argv[]) +int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { int failed = 0; const char *sockpath = NULL; @@ -584,7 +584,7 @@ int udevadm_trigger(int argc, char *argv[]) {} }; - dbg("version %s\n", VERSION); + dbg(udev, "version %s\n", VERSION); while (1) { option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL); @@ -612,16 +612,16 @@ int udevadm_trigger(int argc, char *argv[]) env = optarg; break; case 's': - name_list_add(&filter_subsystem_match_list, optarg, 0); + name_list_add(udev, &filter_subsystem_match_list, optarg, 0); break; case 'S': - name_list_add(&filter_subsystem_nomatch_list, optarg, 0); + name_list_add(udev, &filter_subsystem_nomatch_list, optarg, 0); break; case 'a': - name_list_add(&filter_attr_match_list, optarg, 0); + name_list_add(udev, &filter_attr_match_list, optarg, 0); break; case 'A': - name_list_add(&filter_attr_nomatch_list, optarg, 0); + name_list_add(udev, &filter_attr_nomatch_list, optarg, 0); break; case 'h': printf("Usage: udevadm trigger OPTIONS\n" @@ -670,40 +670,40 @@ int udevadm_trigger(int argc, char *argv[]) } if (failed) { - scan_failed(); - exec_list(action, env); + scan_failed(udev); + exec_list(udev, action, env); } else { char base[PATH_SIZE]; struct stat statbuf; /* if we have /sys/subsystem, forget all the old stuff */ - strlcpy(base, sysfs_path, sizeof(base)); + strlcpy(base, udev_get_sys_path(udev), sizeof(base)); strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { - scan_subsystem("subsystem", SCAN_SUBSYSTEM); - exec_list(action, env); - scan_subsystem("subsystem", SCAN_DEVICES); - exec_list(action, env); + scan_subsystem(udev, "subsystem", SCAN_SUBSYSTEM); + exec_list(udev, action, env); + scan_subsystem(udev, "subsystem", SCAN_DEVICES); + exec_list(udev, action, env); } else { - scan_subsystem("bus", SCAN_SUBSYSTEM); - exec_list(action, env); - scan_subsystem("bus", SCAN_DEVICES); - scan_class(); + scan_subsystem(udev, "bus", SCAN_SUBSYSTEM); + exec_list(udev, action, env); + scan_subsystem(udev, "bus", SCAN_DEVICES); + scan_class(udev); /* scan "block" if it isn't a "class" */ - strlcpy(base, sysfs_path, sizeof(base)); + strlcpy(base, udev_get_sys_path(udev), sizeof(base)); strlcat(base, "/class/block", sizeof(base)); if (stat(base, &statbuf) != 0) - scan_block(); - exec_list(action, env); + scan_block(udev); + exec_list(udev, action, env); } } exit: - name_list_cleanup(&filter_subsystem_match_list); - name_list_cleanup(&filter_subsystem_nomatch_list); - name_list_cleanup(&filter_attr_match_list); - name_list_cleanup(&filter_attr_nomatch_list); + name_list_cleanup(udev, &filter_subsystem_match_list); + name_list_cleanup(udev, &filter_subsystem_nomatch_list); + name_list_cleanup(udev, &filter_attr_match_list); + name_list_cleanup(udev, &filter_attr_nomatch_list); if (sock >= 0) close(sock); diff --git a/udev/udevadm.c b/udev/udevadm.c index 047365d973..e4f2420546 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007 Kay Sievers + * Copyright (C) 2007-2008 Kay Sievers * * 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 @@ -30,43 +30,38 @@ static int debug; -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) { - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - if (debug) - vprintf(format, args); - else + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { vsyslog(priority, format, args); - va_end(args); + } } -#endif struct command { const char *name; - int (*cmd)(int argc, char *argv[]); + int (*cmd)(struct udev *udev, int argc, char *argv[]); const char *help; int debug; }; static const struct command cmds[]; -static int version(int argc, char *argv[]) +static int version(struct udev *udev, int argc, char *argv[]) { printf("%s\n", VERSION); return 0; } -static int help(int argc, char *argv[]) +static int help(struct udev *udev, int argc, char *argv[]) { const struct command *cmd; - printf("Usage: udevadm COMMAND [OPTIONS]\n"); + printf("Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); for (cmd = cmds; cmd->name != NULL; cmd++) printf(" %-12s %s\n", cmd->name, cmd->help); printf("\n"); @@ -118,28 +113,40 @@ static const struct command cmds[] = { {} }; +static int run_command(struct udev *udev, const struct command *cmd, int argc, char *argv[]) +{ + if (cmd->debug) { + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + } + info(udev, "calling: %s\n", cmd->name); + return cmd->cmd(udev, argc, argv); +} + int main(int argc, char *argv[]) { - const char *command = argv[1]; + struct udev *udev; + static const struct option options[] = { + { "debug", 0, NULL, 'd' }, + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + {} + }; + const char *command; int i; const char *pos; - int rc; + int rc = 1; + + udev = udev_new(); + if (udev == NULL) + goto out; logging_init("udevadm"); - udev_config_init(); + udev_set_log_fn(udev, log_fn); sysfs_init(); - /* find command */ - if (command != NULL) - for (i = 0; cmds[i].cmd != NULL; i++) { - if (strcmp(cmds[i].name, command) == 0) { - debug = cmds[i].debug; - rc = cmds[i].cmd(argc-1, &argv[1]); - goto out; - } - } - - /* try to find compat link, will be removed in a future release */ + /* see if we are a compat link, this will be removed in a future release */ command = argv[0]; pos = strrchr(command, '/'); if (pos != NULL) @@ -161,19 +168,53 @@ int main(int argc, char *argv[]) prog[len] = '\0'; fprintf(stderr, "the program '%s' called '%s', it should use 'udevadm %s ', " "this will stop working in a future release\n", prog, argv[0], command); - info("the program '%s' called '%s', it should use 'udevadm %s ', " + info(udev, "the program '%s' called '%s', it should use 'udevadm %s ', " "this will stop working in a future release\n", prog, argv[0], command); } - debug = cmds[i].debug; - rc = cmds[i].cmd(argc, argv); + rc = run_command(udev, &cmds[i], argc, argv); + goto out; + } + } + + while (1) { + int option; + + option = getopt_long(argc, argv, "+dhV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + rc = help(udev, argc, argv); + goto out; + case 'V': + rc = version(udev, argc, argv); + goto out; + default: goto out; } } + command = argv[optind]; + + if (command != NULL) + for (i = 0; cmds[i].cmd != NULL; i++) { + if (strcmp(cmds[i].name, command) == 0) { + optind++; + rc = run_command(udev, &cmds[i], argc, argv); + goto out; + } + } - fprintf(stderr, "unknown command, try help\n\n"); + fprintf(stderr, "unknown command, try udevadm help\n\n"); rc = 2; out: sysfs_cleanup(); + udev_unref(udev); logging_close(); return rc; } diff --git a/udev/udevadm.xml b/udev/udevadm.xml index de0e026e8f..2e02c305d9 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -33,7 +33,7 @@ udevadm settle options - udevadm control options instruction + udevadm control command udevadm monitor options diff --git a/udev/udevd.c b/udev/udevd.c index 68cf264369..c9ee21a29c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -50,9 +50,40 @@ #include "udevd.h" #include "udev_selinux.h" -static int debug_trace; static int debug; +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "[%d] %s: ", (int) getpid(), fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } +} + +struct udevd_uevent_msg { + struct udev *udev; + struct list_head node; + pid_t pid; + int exitstatus; + time_t queue_time; + char *action; + char *devpath; + char *subsystem; + char *driver; + dev_t devt; + unsigned long long seqnum; + char *devpath_old; + char *physdevpath; + unsigned int timeout; + char *envp[UEVENT_NUM_ENVP+1]; + char envbuf[]; +}; + +static int debug_trace; static struct udev_rules rules; static int udevd_sock = -1; static int uevent_netlink_sock = -1; @@ -67,31 +98,11 @@ static int run_exec_q; static int stop_exec_q; static int max_childs; static int max_childs_running; -static char udev_log[32]; +static char udev_log_env[32]; static LIST_HEAD(exec_list); static LIST_HEAD(running_list); - -#ifdef USE_LOG -void log_message(int priority, const char *format, ...) -{ - va_list args; - - if (priority > udev_log_priority) - return; - - va_start(args, format); - if (debug) { - printf("[%d] ", (int) getpid()); - vprintf(format, args); - } else - vsyslog(priority, format, args); - va_end(args); -} - -#endif - static void asmlinkage udev_event_sig_handler(int signum) { if (signum == SIGALRM) @@ -101,7 +112,7 @@ static void asmlinkage udev_event_sig_handler(int signum) static int udev_event_process(struct udevd_uevent_msg *msg) { struct sigaction act; - struct udevice *udev; + struct udevice *udevice; int i; int retval; @@ -126,25 +137,25 @@ static int udev_event_process(struct udevd_uevent_msg *msg) for (i = 0; msg->envp[i]; i++) putenv(msg->envp[i]); - udev = udev_device_init(); - if (udev == NULL) + udevice = udev_device_init(msg->udev); + if (udevice == NULL) return -1; - strlcpy(udev->action, msg->action, sizeof(udev->action)); - sysfs_device_set_values(udev->dev, msg->devpath, msg->subsystem, msg->driver); - udev->devpath_old = msg->devpath_old; - udev->devt = msg->devt; + strlcpy(udevice->action, msg->action, sizeof(udevice->action)); + sysfs_device_set_values(udevice->udev, udevice->dev, msg->devpath, msg->subsystem, msg->driver); + udevice->devpath_old = msg->devpath_old; + udevice->devt = msg->devt; - retval = udev_device_event(&rules, udev); + retval = udev_device_event(&rules, udevice); /* rules may change/disable the timeout */ - if (udev->event_timeout >= 0) - alarm(udev->event_timeout); + if (udevice->event_timeout >= 0) + alarm(udevice->event_timeout); /* run programs collected by RUN-key*/ - if (retval == 0 && !udev->ignore_device && udev_run) - retval = udev_rules_run(udev); + if (retval == 0 && !udevice->ignore_device && udev_get_run(msg->udev)) + retval = udev_rules_run(udevice); - udev_device_cleanup(udev); + udev_device_cleanup(udevice); return retval; } @@ -161,10 +172,10 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st size_t start; /* location of queue file */ - snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", udev_root, msg->seqnum); + snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", udev_get_dev_path(msg->udev), msg->seqnum); /* location of failed file */ - strlcpy(filename_failed, udev_root, sizeof(filename_failed)); + strlcpy(filename_failed, udev_get_dev_path(msg->udev), sizeof(filename_failed)); strlcat(filename_failed, "/", sizeof(filename_failed)); start = strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed)); strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); @@ -173,42 +184,41 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st switch (state) { case EVENT_QUEUED: unlink(filename_failed); - delete_path(filename_failed); - - create_path(filename); - selinux_setfscreatecon(filename, NULL, S_IFLNK); + delete_path(msg->udev, filename_failed); + create_path(msg->udev, filename); + selinux_setfscreatecon(msg->udev, filename, NULL, S_IFLNK); symlink(msg->devpath, filename); - selinux_resetfscreatecon(); + selinux_resetfscreatecon(msg->udev); break; case EVENT_FINISHED: if (msg->devpath_old != NULL) { /* "move" event - rename failed file to current name, do not delete failed */ char filename_failed_old[PATH_SIZE]; - strlcpy(filename_failed_old, udev_root, sizeof(filename_failed_old)); + strlcpy(filename_failed_old, udev_get_dev_path(msg->udev), sizeof(filename_failed_old)); strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); start = strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old)); strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); path_encode(&filename_failed_old[start], sizeof(filename) - start); if (rename(filename_failed_old, filename_failed) == 0) - info("renamed devpath, moved failed state of '%s' to %s'\n", + info(msg->udev, "renamed devpath, moved failed state of '%s' to %s'\n", msg->devpath_old, msg->devpath); } else { unlink(filename_failed); - delete_path(filename_failed); + delete_path(msg->udev, filename_failed); } unlink(filename); - delete_path(filename); + delete_path(msg->udev, filename); break; case EVENT_FAILED: /* move failed event to the failed directory */ - create_path(filename_failed); + create_path(msg->udev, filename_failed); rename(filename, filename_failed); /* clean up possibly empty queue directory */ - delete_path(filename); + delete_path(msg->udev, filename); break; } @@ -244,24 +254,23 @@ static void udev_event_run(struct udevd_uevent_msg *msg) close(signal_pipe[READ_END]); close(signal_pipe[WRITE_END]); logging_close(); - logging_init("udevd-event"); setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); retval = udev_event_process(msg); - info("seq %llu finished with %i\n", msg->seqnum, retval); + info(msg->udev, "seq %llu finished with %i\n", msg->seqnum, retval); logging_close(); if (retval) exit(1); exit(0); case -1: - err("fork of child failed: %s\n", strerror(errno)); + err(msg->udev, "fork of child failed: %s\n", strerror(errno)); msg_queue_delete(msg); break; default: /* get SIGCHLD in main loop */ - info("seq %llu forked, pid [%d], '%s' '%s', %ld seconds old\n", + info(msg->udev, "seq %llu forked, pid [%d], '%s' '%s', %ld seconds old\n", msg->seqnum, pid, msg->action, msg->subsystem, time(NULL) - msg->queue_time); msg->pid = pid; } @@ -275,9 +284,9 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) msg->queue_time = time(NULL); export_event_state(msg, EVENT_QUEUED); - info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); + info(msg->udev, "seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); - strlcpy(filename, udev_root, sizeof(filename)); + strlcpy(filename, udev_get_dev_path(msg->udev), sizeof(filename)); strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { @@ -484,7 +493,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check identical, parent, or child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg("%llu, device event still pending %llu (%s)\n", + dbg(msg->udev, "%llu, device event still pending %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 3; } @@ -492,7 +501,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check for our major:minor number */ if (msg->devt && loop_msg->devt == msg->devt && strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg("%llu, device event still pending %llu (%d:%d)\n", msg->seqnum, + dbg(msg->udev, "%llu, device event still pending %llu (%d:%d)\n", msg->seqnum, loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); return 4; } @@ -500,7 +509,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check physical device event (special case of parent) */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg("%llu, physical device event still pending %llu (%s)\n", + dbg(msg->udev, "%llu, physical device event still pending %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 5; } @@ -509,7 +518,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check run queue for still running events */ list_for_each_entry(loop_msg, &running_list, node) { if (limit && childs_count++ > limit) { - dbg("%llu, maximum number (%i) of childs reached\n", msg->seqnum, childs_count); + dbg(msg->udev, "%llu, maximum number (%i) of childs reached\n", msg->seqnum, childs_count); return 1; } @@ -520,7 +529,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check identical, parent, or child device event */ if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg("%llu, device event still running %llu (%s)\n", + dbg(msg->udev, "%llu, device event still running %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 3; } @@ -528,7 +537,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check for our major:minor number */ if (msg->devt && loop_msg->devt == msg->devt && strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg("%llu, device event still running %llu (%d:%d)\n", msg->seqnum, + dbg(msg->udev, "%llu, device event still running %llu (%d:%d)\n", msg->seqnum, loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); return 4; } @@ -536,7 +545,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check physical device event (special case of parent) */ if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg("%llu, physical device event still running %llu (%s)\n", + dbg(msg->udev, "%llu, physical device event still running %llu (%s)\n", msg->seqnum, loop_msg->seqnum, loop_msg->devpath); return 5; } @@ -545,7 +554,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) } /* serializes events for the identical and parent and child devices */ -static void msg_queue_manager(void) +static void msg_queue_manager(struct udev *udev) { struct udevd_uevent_msg *loop_msg; struct udevd_uevent_msg *tmp_msg; @@ -555,7 +564,7 @@ static void msg_queue_manager(void) return; running = running_processes(); - dbg("%d processes runnning on system\n", running); + dbg(udev, "%d processes runnning on system\n", running); if (running < 0) running = max_childs_running; @@ -563,16 +572,16 @@ static void msg_queue_manager(void) /* check running processes in our session and possibly throttle */ if (running >= max_childs_running) { running = running_processes_in_session(sid, max_childs_running+10); - dbg("at least %d processes running in session\n", running); + dbg(udev, "at least %d processes running in session\n", running); if (running >= max_childs_running) { - dbg("delay seq %llu, too many processes already running\n", loop_msg->seqnum); + dbg(udev, "delay seq %llu, too many processes already running\n", loop_msg->seqnum); return; } } /* serialize and wait for parent or child events */ if (devpath_busy(loop_msg, max_childs) != 0) { - dbg("delay seq %llu (%s)\n", loop_msg->seqnum, loop_msg->devpath); + dbg(udev, "delay seq %llu (%s)\n", loop_msg->seqnum, loop_msg->devpath); continue; } @@ -580,11 +589,11 @@ static void msg_queue_manager(void) list_move_tail(&loop_msg->node, &running_list); udev_event_run(loop_msg); running++; - dbg("moved seq %llu to running list\n", loop_msg->seqnum); + dbg(udev, "moved seq %llu to running list\n", loop_msg->seqnum); } } -static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size) +static struct udevd_uevent_msg *get_msg_from_envbuf(struct udev *udev, const char *buf, int buf_size) { int bufpos; int i; @@ -597,6 +606,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz if (msg == NULL) return NULL; memset(msg, 0x00, sizeof(struct udevd_uevent_msg) + buf_size); + msg->udev = udev; /* copy environment buffer and reconstruct envp */ memcpy(msg->envbuf, buf, buf_size); @@ -609,7 +619,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz keylen = strlen(key); msg->envp[i] = key; bufpos += keylen + 1; - dbg("add '%s' to msg.envp[%i]\n", msg->envp[i], i); + dbg(udev, "add '%s' to msg.envp[%i]\n", msg->envp[i], i); /* remember some keys for further processing */ if (strncmp(key, "ACTION=", 7) == 0) @@ -647,7 +657,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz msg->envp[i] = NULL; if (msg->devpath == NULL || msg->action == NULL) { - info("DEVPATH or ACTION missing, ignore message\n"); + info(udev, "DEVPATH or ACTION missing, ignore message\n"); free(msg); return NULL; } @@ -655,7 +665,7 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(const char *buf, int buf_siz } /* receive the udevd message from userspace */ -static void get_ctrl_msg(void) +static void get_ctrl_msg(struct udev *udev) { struct udevd_ctrl_msg ctrl_msg; ssize_t size; @@ -679,24 +689,24 @@ static void get_ctrl_msg(void) size = recvmsg(udevd_sock, &smsg, 0); if (size < 0) { if (errno != EINTR) - err("unable to receive user udevd message: %s\n", strerror(errno)); + err(udev, "unable to receive user udevd message: %s\n", strerror(errno)); return; } cmsg = CMSG_FIRSTHDR(&smsg); cred = (struct ucred *) CMSG_DATA(cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err("no sender credentials received, message ignored\n"); + err(udev, "no sender credentials received, message ignored\n"); return; } if (cred->uid != 0) { - err("sender uid=%i, message ignored\n", cred->uid); + err(udev, "sender uid=%i, message ignored\n", cred->uid); return; } if (strncmp(ctrl_msg.magic, UDEVD_CTRL_MAGIC, sizeof(UDEVD_CTRL_MAGIC)) != 0 ) { - err("message magic '%s' doesn't match, ignore it\n", ctrl_msg.magic); + err(udev, "message magic '%s' doesn't match, ignore it\n", ctrl_msg.magic); return; } @@ -704,52 +714,52 @@ static void get_ctrl_msg(void) case UDEVD_CTRL_ENV: pos = strchr(ctrl_msg.buf, '='); if (pos == NULL) { - err("wrong key format '%s'\n", ctrl_msg.buf); + err(udev, "wrong key format '%s'\n", ctrl_msg.buf); break; } pos[0] = '\0'; if (pos[1] == '\0') { - info("udevd message (ENV) received, unset '%s'\n", ctrl_msg.buf); + info(udev, "udevd message (ENV) received, unset '%s'\n", ctrl_msg.buf); unsetenv(ctrl_msg.buf); } else { - info("udevd message (ENV) received, set '%s=%s'\n", ctrl_msg.buf, &pos[1]); + info(udev, "udevd message (ENV) received, set '%s=%s'\n", ctrl_msg.buf, &pos[1]); setenv(ctrl_msg.buf, &pos[1], 1); } break; case UDEVD_CTRL_STOP_EXEC_QUEUE: - info("udevd message (STOP_EXEC_QUEUE) received\n"); + info(udev, "udevd message (STOP_EXEC_QUEUE) received\n"); stop_exec_q = 1; break; case UDEVD_CTRL_START_EXEC_QUEUE: - info("udevd message (START_EXEC_QUEUE) received\n"); + info(udev, "udevd message (START_EXEC_QUEUE) received\n"); stop_exec_q = 0; - msg_queue_manager(); + msg_queue_manager(udev); break; case UDEVD_CTRL_SET_LOG_LEVEL: - info("udevd message (SET_LOG_PRIORITY) received, udev_log_priority=%i\n", ctrl_msg.intval); - udev_log_priority = ctrl_msg.intval; - sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); - putenv(udev_log); + info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", ctrl_msg.intval); + udev_set_log_priority(udev, ctrl_msg.intval); + sprintf(udev_log_env, "UDEV_LOG=%i", udev_get_log_priority(udev)); + putenv(udev_log_env); break; case UDEVD_CTRL_SET_MAX_CHILDS: - info("udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i\n", ctrl_msg.intval); + info(udev, "udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i\n", ctrl_msg.intval); max_childs = ctrl_msg.intval; break; case UDEVD_CTRL_SET_MAX_CHILDS_RUNNING: - info("udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs_running=%i\n", ctrl_msg.intval); + info(udev, "udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs_running=%i\n", ctrl_msg.intval); max_childs_running = ctrl_msg.intval; break; case UDEVD_CTRL_RELOAD_RULES: - info("udevd message (RELOAD_RULES) received\n"); + info(udev, "udevd message (RELOAD_RULES) received\n"); reload_config = 1; break; default: - err("unknown control message type\n"); + err(udev, "unknown control message type\n"); } } /* receive the kernel user event message and do some sanity checks */ -static struct udevd_uevent_msg *get_netlink_msg(void) +static struct udevd_uevent_msg *get_netlink_msg(struct udev *udev) { struct udevd_uevent_msg *msg; int bufpos; @@ -760,38 +770,38 @@ static struct udevd_uevent_msg *get_netlink_msg(void) size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); if (size < 0) { if (errno != EINTR) - err("unable to receive kernel netlink message: %s\n", strerror(errno)); + err(udev, "unable to receive kernel netlink message: %s\n", strerror(errno)); return NULL; } if ((size_t)size > sizeof(buffer)-1) size = sizeof(buffer)-1; buffer[size] = '\0'; - dbg("uevent_size=%zi\n", size); + dbg(udev, "uevent_size=%zi\n", size); /* start of event payload */ bufpos = strlen(buffer)+1; - msg = get_msg_from_envbuf(&buffer[bufpos], size-bufpos); + msg = get_msg_from_envbuf(udev, &buffer[bufpos], size-bufpos); if (msg == NULL) return NULL; /* validate message */ pos = strchr(buffer, '@'); if (pos == NULL) { - err("invalid uevent '%s'\n", buffer); + err(udev, "invalid uevent '%s'\n", buffer); free(msg); return NULL; } pos[0] = '\0'; if (msg->action == NULL) { - info("no ACTION in payload found, skip event '%s'\n", buffer); + info(udev, "no ACTION in payload found, skip event '%s'\n", buffer); free(msg); return NULL; } if (strcmp(msg->action, buffer) != 0) { - err("ACTION in payload does not match uevent, skip event '%s'\n", buffer); + err(udev, "ACTION in payload does not match uevent, skip event '%s'\n", buffer); free(msg); return NULL; } @@ -826,7 +836,7 @@ static void udev_done(int pid, int exitstatus) list_for_each_entry(msg, &running_list, node) { if (msg->pid == pid) { - info("seq %llu, pid [%d] exit with %i, %ld seconds old\n", msg->seqnum, msg->pid, + info(msg->udev, "seq %llu, pid [%d] exit with %i, %ld seconds old\n", msg->seqnum, msg->pid, exitstatus, time(NULL) - msg->queue_time); msg->exitstatus = exitstatus; msg_queue_delete(msg); @@ -857,7 +867,7 @@ static void reap_sigchilds(void) } } -static int init_udevd_socket(void) +static int init_udevd_socket(struct udev *udev) { struct sockaddr_un saddr; socklen_t addrlen; @@ -874,14 +884,14 @@ static int init_udevd_socket(void) udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udevd_sock == -1) { - err("error getting socket: %s\n", strerror(errno)); + err(udev, "error getting socket: %s\n", strerror(errno)); return -1; } /* the bind takes care of ensuring only one copy running */ retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); if (retval < 0) { - err("bind failed: %s\n", strerror(errno)); + err(udev, "bind failed: %s\n", strerror(errno)); close(udevd_sock); udevd_sock = -1; return -1; @@ -893,7 +903,7 @@ static int init_udevd_socket(void) return 0; } -static int init_uevent_netlink_sock(void) +static int init_uevent_netlink_sock(struct udev *udev) { struct sockaddr_nl snl; const int buffersize = 16 * 1024 * 1024; @@ -906,7 +916,7 @@ static int init_uevent_netlink_sock(void) uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_netlink_sock == -1) { - err("error getting socket: %s\n", strerror(errno)); + err(udev, "error getting socket: %s\n", strerror(errno)); return -1; } @@ -915,7 +925,7 @@ static int init_uevent_netlink_sock(void) retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { - err("bind failed: %s\n", strerror(errno)); + err(udev, "bind failed: %s\n", strerror(errno)); close(uevent_netlink_sock); uevent_netlink_sock = -1; return -1; @@ -923,14 +933,14 @@ static int init_uevent_netlink_sock(void) return 0; } -static void export_initial_seqnum(void) +static void export_initial_seqnum(struct udev *udev) { char filename[PATH_SIZE]; int fd; char seqnum[32]; ssize_t len = 0; - strlcpy(filename, sysfs_path, sizeof(filename)); + strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); fd = open(filename, O_RDONLY); if (fd >= 0) { @@ -941,9 +951,9 @@ static void export_initial_seqnum(void) strcpy(seqnum, "0\n"); len = 3; } - strlcpy(filename, udev_root, sizeof(filename)); + strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); - create_path(filename); + create_path(udev, filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { write(fd, seqnum, len); @@ -953,13 +963,13 @@ static void export_initial_seqnum(void) int main(int argc, char *argv[]) { + struct udev *udev; int retval; int fd; struct sigaction act; fd_set readfds; const char *value; int daemonize = 0; - int option; static const struct option options[] = { { "daemon", 0, NULL, 'd' }, { "debug-trace", 0, NULL, 't' }, @@ -971,12 +981,19 @@ int main(int argc, char *argv[]) int rc = 1; int maxfd; + udev = udev_new(); + if (udev == NULL) + goto exit; + logging_init("udevd"); - udev_config_init(); - selinux_init(); - dbg("version %s\n", VERSION); + udev_set_log_fn(udev, log_fn); + + selinux_init(udev); + dbg(udev, "version %s\n", VERSION); while (1) { + int option; + option = getopt_long(argc, argv, "dDthV", options, NULL); if (option == -1) break; @@ -990,8 +1007,8 @@ int main(int argc, char *argv[]) break; case 'D': debug = 1; - if (udev_log_priority < LOG_INFO) - udev_log_priority = LOG_INFO; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); break; case 'h': printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n"); @@ -1006,7 +1023,7 @@ int main(int argc, char *argv[]) if (getuid() != 0) { fprintf(stderr, "root privileges required\n"); - err("root privileges required\n"); + err(udev, "root privileges required\n"); goto exit; } @@ -1014,7 +1031,7 @@ int main(int argc, char *argv[]) fd = open("/dev/null", O_RDWR); if (fd < 0) { fprintf(stderr, "cannot open /dev/null\n"); - err("cannot open /dev/null\n"); + err(udev, "cannot open /dev/null\n"); } if (fd > STDIN_FILENO) dup2(fd, STDIN_FILENO); @@ -1024,22 +1041,22 @@ int main(int argc, char *argv[]) dup2(fd, STDERR_FILENO); /* init sockets to receive events */ - if (init_udevd_socket() < 0) { + if (init_udevd_socket(udev) < 0) { if (errno == EADDRINUSE) { fprintf(stderr, "another udev daemon already running\n"); - err("another udev daemon already running\n"); + err(udev, "another udev daemon already running\n"); rc = 1; } else { fprintf(stderr, "error initializing udevd socket\n"); - err("error initializing udevd socket\n"); + err(udev, "error initializing udevd socket\n"); rc = 2; } goto exit; } - if (init_uevent_netlink_sock() < 0) { + if (init_uevent_netlink_sock(udev) < 0) { fprintf(stderr, "error initializing netlink socket\n"); - err("error initializing netlink socket\n"); + err(udev, "error initializing netlink socket\n"); rc = 3; goto exit; } @@ -1047,37 +1064,37 @@ int main(int argc, char *argv[]) /* setup signal handler pipe */ retval = pipe(signal_pipe); if (retval < 0) { - err("error getting pipes: %s\n", strerror(errno)); + err(udev, "error getting pipes: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); if (retval < 0) { - err("error fcntl on read pipe: %s\n", strerror(errno)); + err(udev, "error fcntl on read pipe: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { - err("error fcntl on read pipe: %s\n", strerror(errno)); + err(udev, "error fcntl on read pipe: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); if (retval < 0) { - err("error fcntl on write pipe: %s\n", strerror(errno)); + err(udev, "error fcntl on write pipe: %s\n", strerror(errno)); goto exit; } retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { - err("error fcntl on write pipe: %s\n", strerror(errno)); + err(udev, "error fcntl on write pipe: %s\n", strerror(errno)); goto exit; } /* parse the rules and keep them in memory */ sysfs_init(); - udev_rules_init(&rules, 1); + udev_rules_init(udev, &rules, 1); - export_initial_seqnum(); + export_initial_seqnum(udev); if (daemonize) { pid_t pid; @@ -1085,14 +1102,14 @@ int main(int argc, char *argv[]) pid = fork(); switch (pid) { case 0: - dbg("daemonized fork running\n"); + dbg(udev, "daemonized fork running\n"); break; case -1: - err("fork of daemon failed: %s\n", strerror(errno)); + err(udev, "fork of daemon failed: %s\n", strerror(errno)); rc = 4; goto exit; default: - dbg("child [%u] running, parent exits\n", pid); + dbg(udev, "child [%u] running, parent exits\n", pid); rc = 0; goto exit; } @@ -1113,12 +1130,12 @@ int main(int argc, char *argv[]) /* become session leader */ sid = setsid(); - dbg("our session is %d\n", sid); + dbg(udev, "our session is %d\n", sid); /* OOM_DISABLE == -17 */ fd = open("/proc/self/oom_adj", O_RDWR); if (fd < 0) - err("error disabling OOM: %s\n", strerror(errno)); + err(udev, "error disabling OOM: %s\n", strerror(errno)); else { write(fd, "-17", 3); close(fd); @@ -1145,8 +1162,8 @@ int main(int argc, char *argv[]) /* watch rules directory */ inotify_fd = inotify_init(); if (inotify_fd >= 0) { - if (udev_rules_dir[0] != '\0') { - inotify_add_watch(inotify_fd, udev_rules_dir, + if (udev_get_rules_path(udev) != NULL) { + inotify_add_watch(inotify_fd, udev_get_rules_path(udev), IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } else { char filename[PATH_MAX]; @@ -1157,15 +1174,15 @@ int main(int argc, char *argv[]) IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ - strlcpy(filename, udev_root, sizeof(filename)); + strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); strlcat(filename, "/.udev/rules.d", sizeof(filename)); inotify_add_watch(inotify_fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } } else if (errno == ENOSYS) - err("the kernel does not support inotify, udevd can't monitor rules file changes\n"); + err(udev, "the kernel does not support inotify, udevd can't monitor rules file changes\n"); else - err("inotify_init failed: %s\n", strerror(errno)); + err(udev, "inotify_init failed: %s\n", strerror(errno)); /* maximum limit of forked childs */ value = getenv("UDEVD_MAX_CHILDS"); @@ -1178,7 +1195,7 @@ int main(int argc, char *argv[]) else max_childs = UDEVD_MAX_CHILDS; } - info("initialize max_childs to %u\n", max_childs); + info(udev, "initialize max_childs to %u\n", max_childs); /* start to throttle forking if maximum number of _running_ childs is reached */ value = getenv("UDEVD_MAX_CHILDS_RUNNING"); @@ -1191,14 +1208,14 @@ int main(int argc, char *argv[]) else max_childs_running = UDEVD_MAX_CHILDS_RUNNING; } - info("initialize max_childs_running to %u\n", max_childs_running); + info(udev, "initialize max_childs_running to %u\n", max_childs_running); /* clear environment for forked event processes */ clearenv(); /* export log_priority , as called programs may want to follow that setting */ - sprintf(udev_log, "UDEV_LOG=%i", udev_log_priority); - putenv(udev_log); + sprintf(udev_log_env, "UDEV_LOG=%i", udev_get_log_priority(udev)); + putenv(udev_log_env); if (debug_trace) putenv("DEBUG=1"); @@ -1221,17 +1238,17 @@ int main(int argc, char *argv[]) fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) - err("error in select: %s\n", strerror(errno)); + err(udev, "error in select: %s\n", strerror(errno)); continue; } /* get control message */ if (FD_ISSET(udevd_sock, &readfds)) - get_ctrl_msg(); + get_ctrl_msg(udev); /* get netlink message */ if (FD_ISSET(uevent_netlink_sock, &readfds)) { - msg = get_netlink_msg(); + msg = get_netlink_msg(udev); if (msg) msg_queue_insert(msg); } @@ -1254,7 +1271,7 @@ int main(int argc, char *argv[]) reload_config = 1; buf = malloc(nbytes); if (buf == NULL) { - err("error getting buffer for inotify, disable watching\n"); + err(udev, "error getting buffer for inotify, disable watching\n"); close(inotify_fd); inotify_fd = -1; } @@ -1267,7 +1284,7 @@ int main(int argc, char *argv[]) if (reload_config) { reload_config = 0; udev_rules_cleanup(&rules); - udev_rules_init(&rules, 1); + udev_rules_init(udev, &rules, 1); } /* forked child has returned */ @@ -1279,7 +1296,7 @@ int main(int argc, char *argv[]) if (run_exec_q) { run_exec_q = 0; if (!stop_exec_q) - msg_queue_manager(); + msg_queue_manager(udev); } } rc = 0; @@ -1287,7 +1304,7 @@ int main(int argc, char *argv[]) exit: udev_rules_cleanup(&rules); sysfs_cleanup(); - selinux_exit(); + selinux_exit(udev); if (signal_pipe[READ_END] >= 0) close(signal_pipe[READ_END]); @@ -1302,6 +1319,5 @@ exit: close(uevent_netlink_sock); logging_close(); - return rc; } diff --git a/udev/udevd.h b/udev/udevd.h index a22bc96e5d..63c9951680 100644 --- a/udev/udevd.h +++ b/udev/udevd.h @@ -54,20 +54,3 @@ struct udevd_ctrl_msg { }; }; -struct udevd_uevent_msg { - struct list_head node; - pid_t pid; - int exitstatus; - time_t queue_time; - char *action; - char *devpath; - char *subsystem; - char *driver; - dev_t devt; - unsigned long long seqnum; - char *devpath_old; - char *physdevpath; - unsigned int timeout; - char *envp[UEVENT_NUM_ENVP+1]; - char envbuf[]; -}; -- cgit v1.2.3-54-g00ecf From 7643819062985d9fc6c7664072576e71d3822b10 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Sep 2008 16:23:21 +0200 Subject: volume_id: linux_raid - fix logic for volumes with size == 0 --- extras/volume_id/lib/linux_raid.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index 5d95b502e3..c40f3e3ba6 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -149,26 +149,31 @@ int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size { uint64_t sboff; - /* version 0 at the end of the device */ - sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; - if (volume_id_probe_linux_raid0(id, off + sboff, size) == 0) - return 0; - - /* version 1.0 at the end of the device */ - sboff = (size & ~(0x1000 - 1)) - 0x2000; - if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) - strcpy(id->type_version, "1.0"); + if (size > MD_RESERVED_BYTES) { + /* version 0 at the end of the device */ + sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; + if (volume_id_probe_linux_raid0(id, off + sboff, size) == 0) + return 0; + + /* version 1.0 at the end of the device */ + sboff = (size & ~(0x1000 - 1)) - 0x2000; + if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) { + strcpy(id->type_version, "1.0"); + return 0; + } + } /* version 1.1 at the start of the device */ - else if (volume_id_probe_linux_raid1(id, off, size) == 0) + if (volume_id_probe_linux_raid1(id, off, size) == 0) { strcpy(id->type_version, "1.1"); + return 0; + } /* version 1.2 at 4k offset from the start */ - else if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0) + if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0) { strcpy(id->type_version, "1.2"); + return 0; + } - else - return -1; - - return 0; + return -1; } -- cgit v1.2.3-54-g00ecf From f640b32fddfc45210361813b50c629a80d2889d2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Sep 2008 16:37:00 +0200 Subject: vol_id: add --debug option --- extras/volume_id/vol_id.c | 38 ++++++++++++++++++++++++++------------ extras/volume_id/vol_id.xml | 15 +++++++++++++++ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index dcfb0bb92f..d8302bc229 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -1,7 +1,7 @@ /* * vol_id - read filesystem label and uuid * - * Copyright (C) 2005-2006 Kay Sievers + * Copyright (C) 2005-2008 Kay Sievers * * 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 @@ -39,11 +39,18 @@ #define BLKGETSIZE64 _IOR(0x12,114,size_t) +static int debug; + static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) { - vsyslog(priority, format, args); + if (debug) { + fprintf(stderr, "%s: ", fn != NULL ? fn : file); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } } static void vid_log(int priority, const char *file, int line, const char *format, ...) @@ -113,6 +120,7 @@ int main(int argc, char *argv[]) { "skip-raid", 0, NULL, 's' }, { "probe-all", 0, NULL, 'a' }, { "offset", 2, NULL, 'o' }, + { "debug", 0, NULL, 'd' }, { "help", 0, NULL, 'h' }, {} }; @@ -151,11 +159,16 @@ int main(int argc, char *argv[]) while (1) { int option; - option = getopt_long(argc, argv, "lLutxsaoh", options, NULL); + option = getopt_long(argc, argv, "lLutxsaodh", options, NULL); if (option == -1) break; switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; case 'l': print = PRINT_LABEL; break; @@ -183,14 +196,15 @@ int main(int argc, char *argv[]) break; case 'h': printf("Usage: vol_id [options] \n" - " --export export key/value pairs\n" - " --type filesystem type\n" - " --label filesystem label\n" - " --label-raw raw label\n" - " --uuid filesystem uuid\n" - " --skip-raid don't probe for raid\n" - " --probe-all find possibly conflicting signatures\n" - " --offset skip given number of bytes of input\n" + " --export export key/value pairs\n" + " --type filesystem type\n" + " --label filesystem label\n" + " --label-raw raw label\n" + " --uuid filesystem uuid\n" + " --skip-raid don't probe for raid\n" + " --probe-all find possibly conflicting signatures\n" + " --offset= probe at the given offset\n" + " --debug print debug output to stderr\n" " --help\n\n"); goto exit; default: @@ -222,7 +236,7 @@ int main(int argc, char *argv[]) if (ioctl(fd, BLKGETSIZE64, &size) != 0) size = 0; - dbg(udev, "BLKGETSIZE64=%llu\n", (unsigned long long)size); + info(udev, "BLKGETSIZE64=%llu (%lluGB)\n", (unsigned long long)size, (unsigned long long)size >> 30); /* try to drop all privileges before reading disk content */ if (getuid() == 0) { diff --git a/extras/volume_id/vol_id.xml b/extras/volume_id/vol_id.xml index 6d0a6c6923..fcf3a31fa5 100644 --- a/extras/volume_id/vol_id.xml +++ b/extras/volume_id/vol_id.xml @@ -32,6 +32,8 @@ + + device @@ -95,6 +97,19 @@ Probe for all types and print all matches. + + + + Probing at the given offset, instead of the start of the volume. + The offset value is specified in bytes. + + + + + + Print debug output to stderr. + + -- cgit v1.2.3-54-g00ecf From e5931bb7d86226a3823bdf5f4ec01c857827d386 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Sep 2008 14:48:33 +0200 Subject: udevadm: add --version --help options to man page, hide them as commands --- extras/volume_id/vol_id.xml | 2 +- udev/udevadm.c | 8 ++++---- udev/udevadm.xml | 42 +++++++++++++++++++++++++++--------------- udev/udevd.xml | 4 ++-- 4 files changed, 34 insertions(+), 22 deletions(-) diff --git a/extras/volume_id/vol_id.xml b/extras/volume_id/vol_id.xml index fcf3a31fa5..3ab0b05c82 100644 --- a/extras/volume_id/vol_id.xml +++ b/extras/volume_id/vol_id.xml @@ -107,7 +107,7 @@ - Print debug output to stderr. + Print debug messages to stderr. diff --git a/udev/udevadm.c b/udev/udevadm.c index e4f2420546..bfa704ef21 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -63,7 +63,8 @@ static int help(struct udev *udev, int argc, char *argv[]) printf("Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); for (cmd = cmds; cmd->name != NULL; cmd++) - printf(" %-12s %s\n", cmd->name, cmd->help); + if (cmd->help != NULL) + printf(" %-12s %s\n", cmd->name, cmd->help); printf("\n"); return 0; } @@ -103,12 +104,10 @@ static const struct command cmds[] = { { .name = "version", .cmd = version, - .help = "print the version number", }, { .name = "help", .cmd = help, - .help = "print this help text", }, {} }; @@ -210,7 +209,8 @@ int main(int argc, char *argv[]) } } - fprintf(stderr, "unknown command, try udevadm help\n\n"); + fprintf(stderr, "missing or unknown command\n\n"); + help(udev, argc, argv); rc = 2; out: sysfs_cleanup(); diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 2e02c305d9..075890845b 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -24,7 +24,13 @@ - udevadm info options + udevadm + + + + + + udevadm info options udevadm trigger options @@ -41,12 +47,6 @@ udevadm test options devpath - - udevadm version - - - udevadm help - DESCRIPTION @@ -56,6 +56,26 @@ OPTIONS + + + + + Print debug messages to stderr. + + + + + + Print version number. + + + + + + Print help text. + + + udevadm info <replaceable>options</replaceable> Queries the udev database for device information @@ -351,14 +371,6 @@ - - udevadm version - Print version number. - - - udevadm help - Print help text. - AUTHOR diff --git a/udev/udevd.xml b/udev/udevd.xml index 8d22a0c14d..b5726b8b03 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -61,7 +61,7 @@ - Print log messages to stdout. + Print debug messages to stderr. @@ -71,7 +71,7 @@ - + Print help text. -- cgit v1.2.3-54-g00ecf From d59f11e1407ec6fa26e3a6f20b2d404af6978199 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Sep 2008 17:59:00 +0200 Subject: move udev_ctrl to libudev-private --- udev/Makefile.am | 5 +- udev/lib/Makefile.am | 2 + udev/lib/exported_symbols | 3 +- udev/lib/libudev-ctrl.c | 332 +++++++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev-monitor.c | 58 ++++---- udev/lib/libudev-private.h | 28 ++++ udev/lib/libudev.h | 8 +- udev/lib/test-libudev.c | 6 +- udev/udev-control.c | 135 ------------------ udev/udev.h | 18 +-- udev/udevadm-control.c | 86 ++++++++---- udev/udevadm-monitor.c | 1 - udev/udevadm-settle.c | 1 - udev/udevadm-trigger.c | 1 - udev/udevd.c | 225 ++++++++++++------------------ udev/udevd.h | 56 -------- 16 files changed, 557 insertions(+), 408 deletions(-) create mode 100644 udev/lib/libudev-ctrl.c delete mode 100644 udev/udev-control.c delete mode 100644 udev/udevd.h diff --git a/udev/Makefile.am b/udev/Makefile.am index 4a30bf9e31..6ee72d3206 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -36,7 +36,8 @@ common_files = \ lib/libudev.h \ lib/libudev-private.h \ lib/libudev.c \ - lib/libudev-utils.c + lib/libudev-utils.c \ + lib/libudev-ctrl.c if USE_SELINUX @@ -49,7 +50,6 @@ endif udevd_SOURCES = \ $(common_files) \ - udevd.h \ udevd.c udevd_LDADD = \ @@ -58,7 +58,6 @@ udevd_LDADD = \ udevadm_SOURCES = \ $(common_files) \ - udev-control.c \ udevadm.c \ udevadm-info.c \ udevadm-control.c \ diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index b7dd373d5e..630888d3d9 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -20,11 +20,13 @@ include_HEADERS =\ libudev.h libudev_la_SOURCES =\ + exported_symbools \ libudev-private.h \ libudev.c \ libudev-utils.c \ libudev-device.c \ libudev-enumerate.c \ + libudev-ctrl.c \ libudev-monitor.c \ ../list.h \ ../udev.h \ diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 66275f4f9c..fa12633377 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -19,8 +19,9 @@ udev_device_get_devlinks udev_device_get_properties udev_devices_enumerate udev_monitor_new_from_socket +udev_monitor_enable_receiving udev_monitor_ref udev_monitor_unref udev_monitor_get_udev udev_monitor_get_fd -udev_monitor_get_device +udev_monitor_receive_device diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c new file mode 100644 index 0000000000..b2af0c73ed --- /dev/null +++ b/udev/lib/libudev-ctrl.c @@ -0,0 +1,332 @@ +/* + * Copyright (C) 2005-2008 Kay Sievers + * + * 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., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "../udev.h" +#include "libudev.h" +#include "libudev-private.h" + +#define UDEV_CTRL_MAGIC "udevd-128" + +enum udev_ctrl_msg_type { + UDEV_CTRL_UNKNOWN, + UDEV_CTRL_SET_LOG_LEVEL, + UDEV_CTRL_STOP_EXEC_QUEUE, + UDEV_CTRL_START_EXEC_QUEUE, + UDEV_CTRL_RELOAD_RULES, + UDEV_CTRL_SET_ENV, + UDEV_CTRL_SET_MAX_CHILDS, + UDEV_CTRL_SET_MAX_CHILDS_RUNNING, +}; + +struct ctrl_msg { + char magic[32]; + enum udev_ctrl_msg_type type; + union { + int intval; + char buf[256]; + }; +}; + +struct udev_ctrl_msg { + int refcount; + struct udev_ctrl *uctrl; + struct ctrl_msg ctrl_msg; +}; + +struct udev_ctrl { + int refcount; + struct udev *udev; + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; +}; + +struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) +{ + struct udev_ctrl *uctrl; + + uctrl = malloc(sizeof(struct udev_ctrl)); + if (uctrl == NULL) + return NULL; + memset(uctrl, 0x00, sizeof(struct udev_ctrl)); + uctrl->refcount = 1; + uctrl->udev = udev; + + uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (uctrl->sock < 0) { + err(udev, "error getting socket: %s\n", strerror(errno)); + udev_ctrl_unref(uctrl); + return NULL; + } + + uctrl->saddr.sun_family = AF_LOCAL; + strcpy(uctrl->saddr.sun_path, socket_path); + uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); + /* translate leading '@' to abstract namespace */ + if (uctrl->saddr.sun_path[0] == '@') + uctrl->saddr.sun_path[0] = '\0'; + + return uctrl; +} + +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) +{ + int err; + const int feature_on = 1; + + err= bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err < 0) { + err(uctrl->udev, "bind failed: %s\n", strerror(errno)); + return err; + } + + /* enable receiving of the sender credentials */ + setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); + return 0; +} + +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) +{ + return uctrl->udev; +} + +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return NULL; + uctrl->refcount++; + return uctrl; +} + +void udev_ctrl_unref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return; + uctrl->refcount--; + if (uctrl->refcount > 0) + return; + if (uctrl->sock >= 0) + close(uctrl->sock); + free(uctrl); +} + +int udev_ctrl_get_fd(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return -1; + return uctrl->sock; +} + +static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf) +{ + struct ctrl_msg ctrl_msg; + int err; + + memset(&ctrl_msg, 0x00, sizeof(struct ctrl_msg)); + strcpy(ctrl_msg.magic, UDEV_CTRL_MAGIC); + ctrl_msg.type = type; + + if (buf != NULL) + strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); + else + ctrl_msg.intval = intval; + + err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err == -1) { + err(uctrl->udev, "error sending message: %s\n", strerror(errno)); + } + return err; +} + +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority) +{ + ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL); + return 0; +} + +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL); + return 0; +} + +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL); + return 0; +} + +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl) +{ + ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL); + return 0; +} + +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key) +{ + ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, optarg); + return 0; +} + +int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count) +{ + ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS, count, NULL); + return 0; +} + +int udev_ctrl_send_set_max_childs_running(struct udev_ctrl *uctrl, int count) +{ + ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS_RUNNING, count, NULL); + return 0; +} + +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) +{ + struct udev_ctrl_msg *uctrl_msg; + ssize_t size; + struct msghdr smsg; + struct cmsghdr *cmsg; + struct iovec iov; + struct ucred *cred; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + + uctrl_msg = malloc(sizeof(struct udev_ctrl_msg)); + if (uctrl_msg == NULL) + return NULL; + memset(uctrl_msg, 0x00, sizeof(struct udev_ctrl_msg)); + uctrl_msg->refcount = 1; + uctrl_msg->uctrl = uctrl; + + iov.iov_base = &uctrl_msg->ctrl_msg; + iov.iov_len = sizeof(struct udev_ctrl_msg); + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + + size = recvmsg(uctrl->sock, &smsg, 0); + if (size < 0) { + err(uctrl->udev, "unable to receive user udevd message: %s\n", strerror(errno)); + goto err; + } + cmsg = CMSG_FIRSTHDR(&smsg); + cred = (struct ucred *) CMSG_DATA(cmsg); + + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + err(uctrl->udev, "no sender credentials received, message ignored\n"); + goto err; + } + + if (cred->uid != 0) { + err(uctrl->udev, "sender uid=%i, message ignored\n", cred->uid); + goto err; + } + + if (strncmp(uctrl_msg->ctrl_msg.magic, UDEV_CTRL_MAGIC, sizeof(UDEV_CTRL_MAGIC)) != 0 ) { + err(uctrl->udev, "message magic '%s' doesn't match, ignore it\n", uctrl_msg->ctrl_msg.magic); + goto err; + } + + info(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg.type); + return uctrl_msg; +err: + udev_ctrl_msg_unref(uctrl_msg); + return NULL; +} + +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount++; + return ctrl_msg; +} + +void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return; + ctrl_msg->refcount--; + if (ctrl_msg->refcount > 0) + return; + info(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + free(ctrl_msg); +} + +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_SET_LOG_LEVEL) + return ctrl_msg->ctrl_msg.intval; + return -1; +} + +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_STOP_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_START_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_RELOAD_RULES) + return 1; + return -1; +} + +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_SET_ENV) + return ctrl_msg->ctrl_msg.buf; + return NULL; +} + +int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_SET_MAX_CHILDS) + return ctrl_msg->ctrl_msg.intval; + return -1; +} + +int udev_ctrl_get_set_max_childs_running(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_SET_MAX_CHILDS_RUNNING) + return ctrl_msg->ctrl_msg.intval; + return -1; +} diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 09845576d9..2cba7caba0 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -37,7 +37,9 @@ struct udev_monitor { struct udev *udev; int refcount; - int socket; + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; }; /** @@ -60,9 +62,6 @@ struct udev_monitor { struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) { struct udev_monitor *udev_monitor; - struct sockaddr_un saddr; - socklen_t addrlen; - const int on = 1; if (udev == NULL) return NULL; @@ -75,34 +74,38 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char udev_monitor->refcount = 1; udev_monitor->udev = udev; - memset(&saddr, 0x00, sizeof(saddr)); - saddr.sun_family = AF_LOCAL; - strcpy(saddr.sun_path, socket_path); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); + udev_monitor->saddr.sun_family = AF_LOCAL; + strcpy(udev_monitor->saddr.sun_path, socket_path); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(udev_monitor->saddr.sun_path); /* translate leading '@' to abstract namespace */ - if (saddr.sun_path[0] == '@') - saddr.sun_path[0] = '\0'; + if (udev_monitor->saddr.sun_path[0] == '@') + udev_monitor->saddr.sun_path[0] = '\0'; - udev_monitor->socket = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (udev_monitor->socket == -1) { + udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udev_monitor->sock == -1) { err(udev, "error getting socket: %s\n", strerror(errno)); free(udev_monitor); return NULL; } + return udev_monitor; +} - if (bind(udev_monitor->socket, (struct sockaddr *) &saddr, addrlen) < 0) { - err(udev, "bind failed: %s\n", strerror(errno)); - close(udev_monitor->socket); - free(udev_monitor); - return NULL; +int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) +{ + int err; + const int on = 1; + + err = bind(udev_monitor->sock, (struct sockaddr *) &udev_monitor->saddr, udev_monitor->addrlen); + if (err < 0) { + err(udev_monitor->udev, "bind failed: %s\n", strerror(errno)); + return err; } /* enable receiving of the sender credentials */ - setsockopt(udev_monitor->socket, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); info(udev_monitor->udev, "udev_monitor: %p created\n", udev_monitor); - - return udev_monitor; + return 0; } /** @@ -125,7 +128,7 @@ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) * udev_monitor_unref: * @udev_monitor: udev monitor * - * Drop a reference of a udev monitor. If the refcount reaches zero, + * Drop a reference ofa udev monitor. If the refcount reaches zero, * the bound socket will be closed, and the ressources of the monitor * will be released. * @@ -137,7 +140,8 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) udev_monitor->refcount--; if (udev_monitor->refcount > 0) return; - close(udev_monitor->socket); + if (udev_monitor->sock >= 0) + close(udev_monitor->sock); info(udev_monitor->udev, "udev_monitor: %p released\n", udev_monitor); free(udev_monitor); } @@ -169,14 +173,14 @@ int udev_monitor_get_fd(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) return -1; - return udev_monitor->socket; + return udev_monitor->sock; } /** - * udev_monitor_get_device: + * udev_monitor_receive_device: * @udev_monitor: udev monitor * - * Retrieve data from the udev monitor socket, allocate a new udev + * Receive data from the udev monitor socket, allocate a new udev * device, fill in the received data, and return the device. * * Only socket connections with uid=0 are accepted. The caller @@ -188,7 +192,7 @@ int udev_monitor_get_fd(struct udev_monitor *udev_monitor) * * Returns: a new udev device, or #NULL, in case of an error **/ -struct udev_device *udev_monitor_get_device(struct udev_monitor *udev_monitor) +struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) { struct udev_device *udev_device; struct msghdr smsg; @@ -210,7 +214,7 @@ struct udev_device *udev_monitor_get_device(struct udev_monitor *udev_monitor) smsg.msg_control = cred_msg; smsg.msg_controllen = sizeof(cred_msg); - if (recvmsg(udev_monitor->socket, &smsg, 0) < 0) { + if (recvmsg(udev_monitor->sock, &smsg, 0) < 0) { if (errno != EINTR) info(udev_monitor->udev, "unable to receive message"); return NULL; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index ef26ec7e11..b03c813c2f 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -61,6 +61,34 @@ extern int device_set_devname(struct udev_device *udev_device, const char *devna extern int device_add_devlink(struct udev_device *udev_device, const char *devlink); extern int device_add_property(struct udev_device *udev_device, const char *property); +/* udev_ctrl - daemon runtime setup */ +struct udev_ctrl; +extern struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); +extern int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); +extern struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); +extern void udev_ctrl_unref(struct udev_ctrl *uctrl); +extern struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); +extern int udev_ctrl_get_fd(struct udev_ctrl *uctrl); +extern int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority); +extern int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl); +extern int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl); +extern int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl); +extern int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key); +extern int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count); +extern int udev_ctrl_send_set_max_childs_running(struct udev_ctrl *uctrl, int count); +struct udev_ctrl_msg; +extern struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl); +extern struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl); +extern struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); +extern void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); +extern int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); +extern int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); +extern int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); +extern int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); +extern const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); +extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); +extern int udev_ctrl_get_set_max_childs_running(struct udev_ctrl_msg *ctrl_msg); + /* libudev-utils */ extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); #endif diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 98652c5904..a2a06b58e9 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -28,9 +28,6 @@ #endif struct udev; -struct udev_device; -struct udev_monitor; - extern struct udev *udev_new(void); extern struct udev *udev_ref(struct udev *udev); extern void udev_unref(struct udev *udev); @@ -43,6 +40,7 @@ extern void udev_set_log_priority(struct udev *udev, int priority); extern const char *udev_get_sys_path(struct udev *udev); extern const char *udev_get_dev_path(struct udev *udev); +struct udev_device; extern struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); @@ -65,11 +63,13 @@ extern int udev_devices_enumerate(struct udev *udev, const char *subsystem, const char *devpath, const char *subsystem, const char *name, void *data), void *data); +struct udev_monitor; extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); +extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); extern struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); extern void udev_monitor_unref(struct udev_monitor *udev_monitor); extern struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); extern int udev_monitor_get_fd(struct udev_monitor *udev_monitor); -extern struct udev_device *udev_monitor_get_device(struct udev_monitor *udev_monitor); +extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); #endif diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index d0095f15fc..835536af84 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -112,6 +112,10 @@ static int test_monitor(struct udev *udev, const char *socket_path) printf("no socket\n"); return -1; } + if (udev_monitor_enable_receiving(udev_monitor) < 0) { + printf("bind failed\n"); + return -1; + } fd = udev_monitor_get_fd(udev_monitor); FD_ZERO(&readfds); @@ -128,7 +132,7 @@ static int test_monitor(struct udev *udev, const char *socket_path) printf("select fd count: %i\n", fdcount); if (FD_ISSET(fd, &readfds)) { - device = udev_monitor_get_device(udev_monitor); + device = udev_monitor_receive_device(udev_monitor); if (device == NULL) { printf("no device from socket\n"); continue; diff --git a/udev/udev-control.c b/udev/udev-control.c deleted file mode 100644 index 96e4b29be3..0000000000 --- a/udev/udev-control.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2005-2008 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udevd.h" - -struct udev_ctrl { - struct udev *udev; - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; -}; - -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) -{ - struct udev_ctrl *uctrl; - - uctrl = malloc(sizeof(struct udev_ctrl)); - if (uctrl == NULL) - return NULL; - memset(uctrl, 0x00, sizeof(struct udev_ctrl)); - uctrl->udev = udev; - - uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (uctrl->sock < 0) { - err(udev, "error getting socket: %s\n", strerror(errno)); - free(uctrl); - return NULL; - } - - uctrl->saddr.sun_family = AF_LOCAL; - strcpy(uctrl->saddr.sun_path, socket_path); - uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); - /* translate leading '@' to abstract namespace */ - if (uctrl->saddr.sun_path[0] == '@') - uctrl->saddr.sun_path[0] = '\0'; - return uctrl; -} - -void udev_ctrl_unref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return; - close(uctrl->sock); -} - -static int ctrl_send(struct udev_ctrl *uctrl, enum udevd_ctrl_msg_type type, int intval, const char *buf) -{ - struct udevd_ctrl_msg ctrl_msg; - int err; - - memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); - strcpy(ctrl_msg.magic, UDEVD_CTRL_MAGIC); - ctrl_msg.type = type; - - if (buf != NULL) - strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); - else - ctrl_msg.intval = intval; - - err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err == -1) { - err(uctrl->udev, "error sending message: %s\n", strerror(errno)); - } - return err; -} - -int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority) -{ - ctrl_send(uctrl, UDEVD_CTRL_SET_LOG_LEVEL, priority, NULL); - return 0; -} - -int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl) -{ - ctrl_send(uctrl, UDEVD_CTRL_STOP_EXEC_QUEUE, 0, NULL); - return 0; -} - -int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl) -{ - ctrl_send(uctrl, UDEVD_CTRL_START_EXEC_QUEUE, 0, NULL); - return 0; -} - -int udev_ctrl_reload_rules(struct udev_ctrl *uctrl) -{ - ctrl_send(uctrl, UDEVD_CTRL_RELOAD_RULES, 0, NULL); - return 0; -} - -int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key) -{ - ctrl_send(uctrl, UDEVD_CTRL_ENV, 0, optarg); - return 0; -} - -int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count) -{ - ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS, count, NULL); - return 0; -} - -int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count) -{ - ctrl_send(uctrl, UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, count, NULL); - return 0; -} diff --git a/udev/udev.h b/udev/udev.h index 1dd55f6a23..122e83d876 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -44,6 +44,12 @@ #define DEFAULT_PARTITIONS_COUNT 15 #define UDEV_EVENT_TIMEOUT 180 +/* linux/include/linux/kobject.h */ +#define UEVENT_BUFFER_SIZE 2048 +#define UEVENT_NUM_ENVP 32 + +#define UDEV_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd" + #define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) /* pipes */ @@ -190,16 +196,4 @@ extern int udevadm_trigger(struct udev *udev, int argc, char *argv[]); extern int udevadm_settle(struct udev *udev, int argc, char *argv[]); extern int udevadm_test(struct udev *udev, int argc, char *argv[]); -/* udev_ctrl - daemon runtime setup */ -struct udev_ctrl; -extern struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); -extern void udev_ctrl_unref(struct udev_ctrl *uctrl); -extern int udev_ctrl_set_log_level(struct udev_ctrl *uctrl, int priority); -extern int udev_ctrl_stop_exec_queue(struct udev_ctrl *uctrl); -extern int udev_ctrl_start_exec_queue(struct udev_ctrl *uctrl); -extern int udev_ctrl_reload_rules(struct udev_ctrl *uctrl); -extern int udev_ctrl_set_env(struct udev_ctrl *uctrl, const char *key); -extern int udev_ctrl_set_max_childs(struct udev_ctrl *uctrl, int count); -extern int udev_ctrl_set_max_childs_running(struct udev_ctrl *uctrl, int count); - #endif diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 6e10316fbe..8e319be946 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -32,11 +32,23 @@ #include #include "udev.h" -#include "udevd.h" + +static void print_help(void) +{ + printf("Usage: udevadm control COMMAND\n" + " --log-priority= set the udev log level for the daemon\n" + " --stop-exec-queue keep udevd from executing events, queue only\n" + " --start-exec-queue execute events, flush queue\n" + " --reload-rules reloads the rules files\n" + " --env== set a global environment variable\n" + " --max-childs= maximum number of childs\n" + " --max-childs-running= maximum number of childs running at the same time\n" + " --help print this help text\n\n"); +} int udevadm_control(struct udev *udev, int argc, char *argv[]) { - struct udev_ctrl *uctrl; + struct udev_ctrl *uctrl = NULL; int rc = 1; /* compat values with '_' will be removed in a future release */ @@ -63,7 +75,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) goto exit; } - uctrl = udev_ctrl_new_from_socket(udev, UDEVD_CTRL_SOCK_PATH); + uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); if (uctrl == NULL) goto exit; @@ -91,26 +103,31 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) fprintf(stderr, "invalid number '%s'\n", optarg); goto exit; } - udev_ctrl_set_log_level(uctrl, log_priority(optarg)); + udev_ctrl_send_set_log_level(uctrl, log_priority(optarg)); + rc = 0; break; case 's': case 's' + 256: - udev_ctrl_stop_exec_queue(uctrl); + udev_ctrl_send_stop_exec_queue(uctrl); + rc = 0; break; case 'S': case 'S' + 256: - udev_ctrl_start_exec_queue(uctrl); + udev_ctrl_send_start_exec_queue(uctrl); + rc = 0; break; case 'R': case 'R' + 256: - udev_ctrl_reload_rules(uctrl); + udev_ctrl_send_reload_rules(uctrl); + rc = 0; break; case 'e': if (strchr(optarg, '=') == NULL) { fprintf(stderr, "expect = instead of '%s'\n", optarg); goto exit; } - udev_ctrl_set_env(uctrl, optarg); + udev_ctrl_send_set_env(uctrl, optarg); + rc = 0; break; case 'm': case 'm' + 256: @@ -119,7 +136,8 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) fprintf(stderr, "invalid number '%s'\n", optarg); goto exit; } - udev_ctrl_set_max_childs(uctrl, i); + udev_ctrl_send_set_max_childs(uctrl, i); + rc = 0; break; case 'M': case 'M' + 256: @@ -128,18 +146,12 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) fprintf(stderr, "invalid number '%s'\n", optarg); goto exit; } - udev_ctrl_set_max_childs_running(uctrl, i); + udev_ctrl_send_set_max_childs_running(uctrl, i); + rc = 0; break; case 'h': - printf("Usage: udevadm control COMMAND\n" - " --log-priority= set the udev log level for the daemon\n" - " --stop-exec-queue keep udevd from executing events, queue only\n" - " --start-exec-queue execute events, flush queue\n" - " --reload-rules reloads the rules files\n" - " --env== set a global environment variable\n" - " --max-childs= maximum number of childs\n" - " --max-childs-running= maximum number of childs running at the same time\n" - " --help print this help text\n\n"); + print_help(); + rc = 0; goto exit; default: goto exit; @@ -156,24 +168,40 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) "this will stop working in a future release\n"); if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { - udev_ctrl_set_log_level(uctrl, log_priority(&arg[strlen("log_priority=")])); + udev_ctrl_send_set_log_level(uctrl, log_priority(&arg[strlen("log_priority=")])); + rc = 0; + goto exit; } else if (!strcmp(arg, "stop_exec_queue")) { - udev_ctrl_stop_exec_queue(uctrl); + udev_ctrl_send_stop_exec_queue(uctrl); + rc = 0; + goto exit; } else if (!strcmp(arg, "start_exec_queue")) { - udev_ctrl_start_exec_queue(uctrl); + udev_ctrl_send_start_exec_queue(uctrl); + rc = 0; + goto exit; } else if (!strcmp(arg, "reload_rules")) { - udev_ctrl_reload_rules(uctrl); + udev_ctrl_send_reload_rules(uctrl); + rc = 0; + goto exit; } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { - udev_ctrl_set_max_childs(uctrl, strtoul(&arg[strlen("max_childs=")], NULL, 0)); + udev_ctrl_send_set_max_childs(uctrl, strtoul(&arg[strlen("max_childs=")], NULL, 0)); + rc = 0; + goto exit; } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { - udev_ctrl_set_max_childs_running(uctrl, strtoul(&arg[strlen("max_childs_running=")], NULL, 0)); + udev_ctrl_send_set_max_childs_running(uctrl, strtoul(&arg[strlen("max_childs_running=")], NULL, 0)); + rc = 0; + goto exit; } else if (!strncmp(arg, "env", strlen("env"))) { - udev_ctrl_set_env(uctrl, &arg[strlen("env=")]); - } else { - fprintf(stderr, "unrecognized command '%s'\n", arg); - err(udev, "unrecognized command '%s'\n", arg); + udev_ctrl_send_set_env(uctrl, &arg[strlen("env=")]); + rc = 0; + goto exit; } } + + if (rc != 0) { + fprintf(stderr, "unrecognized command\n"); + err(udev, "unrecognized command\n"); + } exit: udev_ctrl_unref(uctrl); return rc; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 0b9b811809..caaf84ffa7 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -33,7 +33,6 @@ #include #include "udev.h" -#include "udevd.h" static int uevent_netlink_sock = -1; static int udev_monitor_sock = -1; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index c519f91cd5..c6093a4311 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -30,7 +30,6 @@ #include #include "udev.h" -#include "udevd.h" #define DEFAULT_TIMEOUT 180 #define LOOP_PER_SECOND 20 diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 1c57e0a217..fc871ccdcb 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -34,7 +34,6 @@ #include #include "udev.h" -#include "udevd.h" #include "udev_rules.h" static int verbose; diff --git a/udev/udevd.c b/udev/udevd.c index c9ee21a29c..a711df53d4 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -47,9 +47,16 @@ #include "udev.h" #include "udev_rules.h" -#include "udevd.h" #include "udev_selinux.h" +#define UDEVD_PRIORITY -4 +#define UDEV_PRIORITY -2 + +/* maximum limit of forked childs */ +#define UDEVD_MAX_CHILDS 256 +/* start to throttle forking if maximum number of running childs in our session is reached */ +#define UDEVD_MAX_CHILDS_RUNNING 16 + static int debug; static void log_fn(struct udev *udev, int priority, @@ -85,7 +92,7 @@ struct udevd_uevent_msg { static int debug_trace; static struct udev_rules rules; -static int udevd_sock = -1; +static struct udev_ctrl *udev_ctrl; static int uevent_netlink_sock = -1; static int inotify_fd = -1; static pid_t sid; @@ -248,7 +255,7 @@ static void udev_event_run(struct udevd_uevent_msg *msg) case 0: /* child */ close(uevent_netlink_sock); - close(udevd_sock); + udev_ctrl_unref(udev_ctrl); if (inotify_fd >= 0) close(inotify_fd); close(signal_pipe[READ_END]); @@ -665,97 +672,76 @@ static struct udevd_uevent_msg *get_msg_from_envbuf(struct udev *udev, const cha } /* receive the udevd message from userspace */ -static void get_ctrl_msg(struct udev *udev) +static void handle_ctrl_msg(struct udev_ctrl *uctrl) { - struct udevd_ctrl_msg ctrl_msg; - ssize_t size; - struct msghdr smsg; - struct cmsghdr *cmsg; - struct iovec iov; - struct ucred *cred; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - char *pos; - - memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg)); - iov.iov_base = &ctrl_msg; - iov.iov_len = sizeof(struct udevd_ctrl_msg); - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - - size = recvmsg(udevd_sock, &smsg, 0); - if (size < 0) { - if (errno != EINTR) - err(udev, "unable to receive user udevd message: %s\n", strerror(errno)); - return; - } - cmsg = CMSG_FIRSTHDR(&smsg); - cred = (struct ucred *) CMSG_DATA(cmsg); - - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err(udev, "no sender credentials received, message ignored\n"); - return; - } + struct udev *udev = udev_ctrl_get_udev(uctrl); + struct udev_ctrl_msg *ctrl_msg; + const char *str; + int i; - if (cred->uid != 0) { - err(udev, "sender uid=%i, message ignored\n", cred->uid); + ctrl_msg = udev_ctrl_receive_msg(uctrl); + if (ctrl_msg == NULL) return; - } - if (strncmp(ctrl_msg.magic, UDEVD_CTRL_MAGIC, sizeof(UDEVD_CTRL_MAGIC)) != 0 ) { - err(udev, "message magic '%s' doesn't match, ignore it\n", ctrl_msg.magic); - return; + i = udev_ctrl_get_set_log_level(ctrl_msg); + if (i >= 0) { + info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", i); + udev_set_log_priority(udev, i); + sprintf(udev_log_env, "UDEV_LOG=%i", i); + putenv(udev_log_env); } - switch (ctrl_msg.type) { - case UDEVD_CTRL_ENV: - pos = strchr(ctrl_msg.buf, '='); - if (pos == NULL) { - err(udev, "wrong key format '%s'\n", ctrl_msg.buf); - break; - } - pos[0] = '\0'; - if (pos[1] == '\0') { - info(udev, "udevd message (ENV) received, unset '%s'\n", ctrl_msg.buf); - unsetenv(ctrl_msg.buf); - } else { - info(udev, "udevd message (ENV) received, set '%s=%s'\n", ctrl_msg.buf, &pos[1]); - setenv(ctrl_msg.buf, &pos[1], 1); - } - break; - case UDEVD_CTRL_STOP_EXEC_QUEUE: + if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) { info(udev, "udevd message (STOP_EXEC_QUEUE) received\n"); stop_exec_q = 1; - break; - case UDEVD_CTRL_START_EXEC_QUEUE: + } + + if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) { info(udev, "udevd message (START_EXEC_QUEUE) received\n"); stop_exec_q = 0; msg_queue_manager(udev); - break; - case UDEVD_CTRL_SET_LOG_LEVEL: - info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", ctrl_msg.intval); - udev_set_log_priority(udev, ctrl_msg.intval); - sprintf(udev_log_env, "UDEV_LOG=%i", udev_get_log_priority(udev)); - putenv(udev_log_env); - break; - case UDEVD_CTRL_SET_MAX_CHILDS: - info(udev, "udevd message (UDEVD_SET_MAX_CHILDS) received, max_childs=%i\n", ctrl_msg.intval); - max_childs = ctrl_msg.intval; - break; - case UDEVD_CTRL_SET_MAX_CHILDS_RUNNING: - info(udev, "udevd message (UDEVD_SET_MAX_CHILDS_RUNNING) received, max_childs_running=%i\n", ctrl_msg.intval); - max_childs_running = ctrl_msg.intval; - break; - case UDEVD_CTRL_RELOAD_RULES: + } + + if (udev_ctrl_get_reload_rules(ctrl_msg) > 0) { info(udev, "udevd message (RELOAD_RULES) received\n"); reload_config = 1; - break; - default: - err(udev, "unknown control message type\n"); } + + str = udev_ctrl_get_set_env(ctrl_msg); + if (str != NULL) { + char *key = strdup(str); + char *val; + + val = strchr(str, '='); + if (val != NULL) { + val[0] = '\0'; + val = &val[1]; + if (val[0] == '\0') { + info(udev, "udevd message (ENV) received, unset '%s'\n", key); + unsetenv(str); + } else { + info(udev, "udevd message (ENV) received, set '%s=%s'\n", key, val); + setenv(key, val, 1); + } + } else { + err(udev, "wrong key format '%s'\n", key); + } + free(key); + } + + i = udev_ctrl_get_set_max_childs(ctrl_msg); + if (i >= 0) { + info(udev, "udevd message (SET_MAX_CHILDS) received, max_childs=%i\n", i); + max_childs = i; + } + + i = udev_ctrl_get_set_max_childs_running(ctrl_msg); + if (i > 0) { + info(udev, "udevd message (SET_MAX_CHILDS_RUNNING) received, max_childs_running=%i\n", i); + max_childs_running = i; + } + + udev_ctrl_msg_unref(ctrl_msg); } /* receive the kernel user event message and do some sanity checks */ @@ -867,42 +853,6 @@ static void reap_sigchilds(void) } } -static int init_udevd_socket(struct udev *udev) -{ - struct sockaddr_un saddr; - socklen_t addrlen; - const int feature_on = 1; - int retval; - - memset(&saddr, 0x00, sizeof(saddr)); - saddr.sun_family = AF_LOCAL; - strcpy(saddr.sun_path, UDEVD_CTRL_SOCK_PATH); - addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); - /* translate leading '@' to abstract namespace */ - if (saddr.sun_path[0] == '@') - saddr.sun_path[0] = '\0'; - - udevd_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (udevd_sock == -1) { - err(udev, "error getting socket: %s\n", strerror(errno)); - return -1; - } - - /* the bind takes care of ensuring only one copy running */ - retval = bind(udevd_sock, (struct sockaddr *) &saddr, addrlen); - if (retval < 0) { - err(udev, "bind failed: %s\n", strerror(errno)); - close(udevd_sock); - udevd_sock = -1; - return -1; - } - - /* enable receiving of the sender credentials */ - setsockopt(udevd_sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); - - return 0; -} - static int init_uevent_netlink_sock(struct udev *udev) { struct sockaddr_nl snl; @@ -1040,17 +990,19 @@ int main(int argc, char *argv[]) if (write(STDERR_FILENO, 0, 0) < 0) dup2(fd, STDERR_FILENO); - /* init sockets to receive events */ - if (init_udevd_socket(udev) < 0) { - if (errno == EADDRINUSE) { - fprintf(stderr, "another udev daemon already running\n"); - err(udev, "another udev daemon already running\n"); - rc = 1; - } else { - fprintf(stderr, "error initializing udevd socket\n"); - err(udev, "error initializing udevd socket\n"); - rc = 2; - } + /* init control socket, bind() ensures, that only one udevd instance is running */ + udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); + if (udev_ctrl == NULL) { + fprintf(stderr, "error initializing control socket"); + err(udev, "error initializing udevd socket"); + rc = 1; + goto exit; + } + + if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { + fprintf(stderr, "error binding control socket, seems udevd is already running\n"); + err(udev, "error binding control socket, seems udevd is already running\n"); + rc = 1; goto exit; } @@ -1061,7 +1013,6 @@ int main(int argc, char *argv[]) goto exit; } - /* setup signal handler pipe */ retval = pipe(signal_pipe); if (retval < 0) { err(udev, "error getting pipes: %s\n", strerror(errno)); @@ -1115,10 +1066,11 @@ int main(int argc, char *argv[]) } } - /* redirect std{out,err} fd's */ - if (!debug) + /* redirect std{out,err} */ + if (!debug) { dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); + dup2(fd, STDERR_FILENO); + } if (fd > STDERR_FILENO) close(fd); @@ -1219,7 +1171,7 @@ int main(int argc, char *argv[]) if (debug_trace) putenv("DEBUG=1"); - maxfd = udevd_sock; + maxfd = udev_ctrl_get_fd(udev_ctrl); maxfd = UDEV_MAX(maxfd, uevent_netlink_sock); maxfd = UDEV_MAX(maxfd, signal_pipe[READ_END]); maxfd = UDEV_MAX(maxfd, inotify_fd); @@ -1230,7 +1182,7 @@ int main(int argc, char *argv[]) FD_ZERO(&readfds); FD_SET(signal_pipe[READ_END], &readfds); - FD_SET(udevd_sock, &readfds); + FD_SET(udev_ctrl_get_fd(udev_ctrl), &readfds); FD_SET(uevent_netlink_sock, &readfds); if (inotify_fd >= 0) FD_SET(inotify_fd, &readfds); @@ -1243,8 +1195,8 @@ int main(int argc, char *argv[]) } /* get control message */ - if (FD_ISSET(udevd_sock, &readfds)) - get_ctrl_msg(udev); + if (FD_ISSET(udev_ctrl_get_fd(udev_ctrl), &readfds)) + handle_ctrl_msg(udev_ctrl); /* get netlink message */ if (FD_ISSET(uevent_netlink_sock, &readfds)) { @@ -1311,8 +1263,7 @@ exit: if (signal_pipe[WRITE_END] >= 0) close(signal_pipe[WRITE_END]); - if (udevd_sock >= 0) - close(udevd_sock); + udev_ctrl_unref(udev_ctrl); if (inotify_fd >= 0) close(inotify_fd); if (uevent_netlink_sock >= 0) diff --git a/udev/udevd.h b/udev/udevd.h deleted file mode 100644 index 63c9951680..0000000000 --- a/udev/udevd.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2004 Ling, Xiaofeng - * Copyright (C) 2004-2006 Kay Sievers - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "list.h" - -#define UDEVD_PRIORITY -4 -#define UDEV_PRIORITY -2 - -/* maximum limit of forked childs */ -#define UDEVD_MAX_CHILDS 256 -/* start to throttle forking if maximum number of running childs in our session is reached */ -#define UDEVD_MAX_CHILDS_RUNNING 16 - -/* linux/include/linux/kobject.h */ -#define UEVENT_BUFFER_SIZE 2048 -#define UEVENT_NUM_ENVP 32 - -#define UDEVD_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd" -#define UDEVD_CTRL_MAGIC "udevd-128" - -enum udevd_ctrl_msg_type { - UDEVD_CTRL_UNKNOWN, - UDEVD_CTRL_SET_LOG_LEVEL, - UDEVD_CTRL_STOP_EXEC_QUEUE, - UDEVD_CTRL_START_EXEC_QUEUE, - UDEVD_CTRL_RELOAD_RULES, - UDEVD_CTRL_ENV, - UDEVD_CTRL_SET_MAX_CHILDS, - UDEVD_CTRL_SET_MAX_CHILDS_RUNNING, -}; - -struct udevd_ctrl_msg { - char magic[32]; - enum udevd_ctrl_msg_type type; - union { - int intval; - char buf[256]; - }; -}; - -- cgit v1.2.3-54-g00ecf From 37a123a9bccd448333fcd83abec926f195dbed9e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Sep 2008 21:50:17 +0200 Subject: udev-test.pl: set udev_log="err" --- test/udev-test.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index ebed8f72dd..a83b156d78 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -288,7 +288,7 @@ EOF desc => "import of shell-value file", subsys => "block", devpath => "/block/sda", - exp_name => "subdir/info/node" , + exp_name => "subdir/err/node" , rules => <$udev_conf" || die "unable to create config file: $udev_conf"; print CONF "udev_root=\"$udev_root\"\n"; print CONF "udev_rules=\"$PWD\"\n"; -print CONF "udev_log=\"info\"\n"; +print CONF "udev_log=\"err\"\n"; close CONF; my $test_num = 1; -- cgit v1.2.3-54-g00ecf From cb8896cd74814acc9360db3156e37233fcfbc20c Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 8 Sep 2008 21:51:30 +0200 Subject: fix name compare bug name_list_key_add() The search for an existing key e.g. FOO would match longer keys e.g. FOOBAR. Reuse the correct code from name_list_remove(). --- udev/udev_utils.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/udev/udev_utils.c b/udev/udev_utils.c index 1649b8cbf0..2df8fab1f8 100644 --- a/udev/udev_utils.c +++ b/udev/udev_utils.c @@ -89,14 +89,17 @@ struct name_entry *name_list_key_add(struct udev *udev, struct list_head *name_l { struct name_entry *name_loop; struct name_entry *name_new; + size_t keylen = strlen(key); list_for_each_entry(name_loop, name_list, node) { - if (strncmp(name_loop->name, key, strlen(key)) == 0) { - dbg(udev, "key already present '%s', replace it\n", name_loop->name); - snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); - name_loop->name[sizeof(name_loop->name)-1] = '\0'; - return name_loop; - } + if (strncmp(name_loop->name, key, keylen) != 0) + continue; + if (name_loop->name[keylen] != '=') + continue; + dbg(udev, "key already present '%s', replace it\n", name_loop->name); + snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); + name_loop->name[sizeof(name_loop->name)-1] = '\0'; + return name_loop; } name_new = malloc(sizeof(struct name_entry)); -- cgit v1.2.3-54-g00ecf From 3b738db6eb3bf9221509f3dec8044c19bb48cb48 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 8 Sep 2008 21:59:27 +0200 Subject: remove redundant string copy in udev_rules_apply_format() --- udev/udev_rules.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/udev/udev_rules.c b/udev/udev_rules.c index b864599a9d..ce1f66ecd6 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -850,10 +850,8 @@ found: do { dbg(udevice->udev, "looking at '%s'\n", dev_parent->devpath); value = sysfs_attr_get_value(udevice->udev, dev_parent->devpath, attr); - if (value != NULL) { - strlcpy(temp2, value, sizeof(temp2)); + if (value != NULL) break; - } dev_parent = sysfs_device_get_parent(udevice->udev, dev_parent); } while (dev_parent != NULL); } -- cgit v1.2.3-54-g00ecf From 2dccc8b0546d06e3d36735ad15526871642252cc Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 8 Sep 2008 22:02:07 +0200 Subject: remove redundant "remove trailing newlines" in udevadm info --- udev/udevadm-info.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index b54b61e084..c2e6cdf84f 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -75,10 +75,6 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c len = sizeof(value) - 1; dbg(udev, "attr '%s'='%s'(%zi)\n", dent->d_name, value, len); - /* remove trailing newlines */ - while (len && value[len-1] == '\n') - value[--len] = '\0'; - /* skip nonprintable attributes */ while (len && isprint(value[len-1])) len--; -- cgit v1.2.3-54-g00ecf From a035bf274477689920bcac12792b28de9d35ab6c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 00:08:42 +0200 Subject: test-udev: cleanup libudev context and overridden rules file string --- udev/lib/libudev.c | 11 ++++++++--- udev/test-udev.c | 17 +---------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 5a00f44de9..09e1bec1bf 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -91,7 +91,6 @@ struct udev *udev_new(void) sysfs_init(); /* defaults */ - config_file = NULL; udev->refcount = 1; udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; @@ -100,7 +99,9 @@ struct udev *udev_new(void) udev->sys_path = strdup("/sys"); config_file = strdup(SYSCONFDIR "/udev/udev.conf"); - if (udev->dev_path == NULL || udev->sys_path == NULL) + if (udev->dev_path == NULL || + udev->sys_path == NULL || + config_file == NULL) goto err; /* settings by environment and config file */ @@ -205,7 +206,6 @@ struct udev *udev_new(void) } fclose(f); } - free(config_file); env = getenv("UDEV_ROOT"); if (env != NULL) { @@ -223,12 +223,16 @@ struct udev *udev_new(void) info(udev, "context %p created\n", udev); info(udev, "log_priority=%d\n", udev->log_priority); + info(udev, "config_file='%s'\n", config_file); info(udev, "dev_path='%s'\n", udev->dev_path); + info(udev, "sys_path='%s'\n", udev->sys_path); if (udev->rules_path != NULL) info(udev, "rules_path='%s'\n", udev->rules_path); + free(config_file); return udev; err: + free(config_file); err(udev, "context creation failed\n"); udev_unref(udev); return NULL; @@ -268,6 +272,7 @@ void udev_unref(struct udev *udev) sysfs_cleanup(); free(udev->dev_path); free(udev->sys_path); + free(udev->rules_path); info(udev, "context %p released\n", udev); free(udev); } diff --git a/udev/test-udev.c b/udev/test-udev.c index 4e782a0d61..b05990ac07 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -66,21 +66,6 @@ int main(int argc, char *argv[]) dbg(udev, "version %s\n", VERSION); selinux_init(udev); - /* set std fd's to /dev/null, /sbin/hotplug forks us, we don't have them at all */ - devnull = open("/dev/null", O_RDWR); - if (devnull >= 0) { - if (devnull != STDIN_FILENO) - dup2(devnull, STDIN_FILENO); - if (devnull != STDOUT_FILENO) - dup2(devnull, STDOUT_FILENO); - if (devnull != STDERR_FILENO) - dup2(devnull, STDERR_FILENO); - if (devnull > STDERR_FILENO) - close(devnull); - } else { - err(udev, "open /dev/null failed: %s\n", strerror(errno)); - } - /* set signal handlers */ memset(&act, 0x00, sizeof(act)); act.sa_handler = (void (*)(int)) sig_handler; @@ -152,8 +137,8 @@ fail: udev_rules_cleanup(&rules); sysfs_cleanup(); selinux_exit(udev); - exit: + udev_unref(udev); if (retval != 0) return 1; return 0; -- cgit v1.2.3-54-g00ecf From df7ae680d88f77ff67f44a49c57dd0079b527a60 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 9 Sep 2008 00:09:49 +0200 Subject: threadsafe rules iteration Move ->current out of "struct udev_rules" and into a new "struct udev_rules_iter". Signed-off-by: Alan Jenkins --- udev/udev_rules.c | 14 ++++++++------ udev/udev_rules.h | 12 ++++++++---- udev/udev_rules_parse.c | 36 ++++++++++++++++++++---------------- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/udev/udev_rules.c b/udev/udev_rules.c index ce1f66ecd6..004a89f748 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -1368,6 +1368,7 @@ nomatch: int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) { + struct udev_rules_iter iter; struct udev_rule *rule; int name_set = 0; @@ -1375,9 +1376,9 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) dbg(udevice->udev, "udevice->dev->kernel='%s'\n", udevice->dev->kernel); /* look for a matching rule to apply */ - udev_rules_iter_init(rules); + udev_rules_iter_init(&iter, rules); while (1) { - rule = udev_rules_iter_next(rules); + rule = udev_rules_iter_next(&iter); if (rule == NULL) break; @@ -1530,7 +1531,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) if (rule->goto_label.operation != KEY_OP_UNSET) { dbg(udevice->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); + udev_rules_iter_label(&iter, key_val(rule, &rule->goto_label)); } } } @@ -1551,14 +1552,15 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) int udev_rules_get_run(struct udev_rules *rules, struct udevice *udevice) { + struct udev_rules_iter iter; struct udev_rule *rule; dbg(udevice->udev, "udevice->kernel='%s'\n", udevice->dev->kernel); /* look for a matching rule to apply */ - udev_rules_iter_init(rules); + udev_rules_iter_init(&iter, rules); while (1) { - rule = udev_rules_iter_next(rules); + rule = udev_rules_iter_next(&iter); if (rule == NULL) break; @@ -1609,7 +1611,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udevice) if (rule->goto_label.operation != KEY_OP_UNSET) { dbg(udevice->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_label(rules, key_val(rule, &rule->goto_label)); + udev_rules_iter_label(&iter, key_val(rule, &rule->goto_label)); } } } diff --git a/udev/udev_rules.h b/udev/udev_rules.h index 4f95121f30..b2e5d571ce 100644 --- a/udev/udev_rules.h +++ b/udev/udev_rules.h @@ -111,16 +111,20 @@ struct udev_rules { struct udev *udev; char *buf; size_t bufsize; - size_t current; int resolve_names; }; +struct udev_rules_iter { + struct udev_rules *rules; + size_t current; +}; + extern int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names); extern void udev_rules_cleanup(struct udev_rules *rules); -extern void udev_rules_iter_init(struct udev_rules *rules); -extern struct udev_rule *udev_rules_iter_next(struct udev_rules *rules); -extern struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label); +extern void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules); +extern struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter); +extern struct udev_rule *udev_rules_iter_label(struct udev_rules_iter *iter, const char *label); extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev); extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev); diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index df7b57ba54..81f0edb6f5 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -33,49 +33,53 @@ #include "udev_selinux.h" -void udev_rules_iter_init(struct udev_rules *rules) +void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules) { - dbg(rules->udev, "bufsize=%zi\n", rules->bufsize); - rules->current = 0; + dbg(iter->rules->udev, "bufsize=%zi\n", rules->bufsize); + iter->rules = rules; + iter->current = 0; } -struct udev_rule *udev_rules_iter_next(struct udev_rules *rules) +struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter) { + struct udev_rules *rules; struct udev_rule *rule; + rules = iter->rules; if (!rules) return NULL; - dbg(rules->udev, "current=%zi\n", rules->current); - if (rules->current >= rules->bufsize) { - dbg(rules->udev, "no more rules\n"); + dbg(iter->rules->udev, "current=%zi\n", iter->current); + if (iter->current >= rules->bufsize) { + dbg(iter->rules->udev, "no more rules\n"); return NULL; } /* get next rule */ - rule = (struct udev_rule *) (rules->buf + rules->current); - rules->current += sizeof(struct udev_rule) + rule->bufsize; + rule = (struct udev_rule *) (rules->buf + iter->current); + iter->current += sizeof(struct udev_rule) + rule->bufsize; return rule; } -struct udev_rule *udev_rules_iter_label(struct udev_rules *rules, const char *label) +struct udev_rule *udev_rules_iter_label(struct udev_rules_iter *iter, const char *label) { struct udev_rule *rule; - size_t start = rules->current; + struct udev_rules *rules = iter->rules; + size_t start = iter->current; next: - dbg(rules->udev, "current=%zi\n", rules->current); - if (rules->current >= rules->bufsize) { + dbg(iter->rules->udev, "current=%zi\n", iter->current); + if (iter->current >= rules->bufsize) { err(rules->udev, "LABEL='%s' not found, GOTO will be ignored\n", label); - rules->current = start; + iter->current = start; return NULL; } - rule = (struct udev_rule *) (rules->buf + rules->current); + rule = (struct udev_rule *) (rules->buf + iter->current); if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { dbg(rules->udev, "moving forward, looking for label '%s'\n", label); - rules->current += sizeof(struct udev_rule) + rule->bufsize; + iter->current += sizeof(struct udev_rule) + rule->bufsize; goto next; } -- cgit v1.2.3-54-g00ecf From ab7ab02556871da195263fce1419a58261179479 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 00:47:48 +0200 Subject: test-udev: remove unused var --- udev/test-udev.c | 1 - 1 file changed, 1 deletion(-) diff --git a/udev/test-udev.c b/udev/test-udev.c index b05990ac07..6c01bdbcd4 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -57,7 +57,6 @@ int main(int argc, char *argv[]) const char *devpath; const char *subsystem; struct sigaction act; - int devnull; int retval = -EINVAL; udev = udev_new(); -- cgit v1.2.3-54-g00ecf From 9d7e1b3fdd3c2bd064f33a29ea5241fdefb718ee Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 9 Sep 2008 00:48:17 +0200 Subject: fix off-by-one in pass_env_to_socket() --- udev/udev_rules.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 004a89f748..3b9631b883 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -486,10 +486,10 @@ static int pass_env_to_socket(struct udev *udev, const char *sockpath, const cha saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); } - bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); + bufpos = snprintf(buf, sizeof(buf), "%s@%s", action, devpath); bufpos++; - for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)-1); i++) { - bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos-1); + for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)); i++) { + bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos); bufpos++; } if (bufpos > sizeof(buf)) -- cgit v1.2.3-54-g00ecf From c4f5f942d7dd904e53374c10de319feb41968561 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 14:06:20 +0200 Subject: add a bunch of private device properties to udev_device --- udev/lib/exported_symbols | 3 ++ udev/lib/libudev-device.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev-monitor.c | 7 ++-- udev/lib/libudev-private.h | 9 +++++ udev/lib/libudev.h | 4 ++ 5 files changed, 112 insertions(+), 3 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index fa12633377..7b42b28f9f 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -17,6 +17,9 @@ udev_device_get_devname udev_device_get_subsystem udev_device_get_devlinks udev_device_get_properties +udev_device_get_action +udev_device_get_driver +udev_device_get_devnum udev_devices_enumerate udev_monitor_new_from_socket udev_monitor_enable_receiving diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 43ed2f3dbf..bec0d69af3 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -41,6 +41,12 @@ struct udev_device { char *subsystem; struct list_head link_list; struct list_head env_list; + char *action; + char *driver; + char *devpath_old; + char *physdevpath; + int timeout; + dev_t devnum; }; struct udev_device *device_init(struct udev *udev) @@ -333,6 +339,27 @@ int udev_device_get_properties(struct udev_device *udev_device, return count; } +const char *udev_device_get_driver(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->driver; +} + +dev_t udev_device_get_devnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return makedev(0, 0); + return udev_device->devnum; +} + +const char *udev_device_get_action(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->action; +} + int device_set_devpath(struct udev_device *udev_device, const char *devpath) { if (asprintf(&udev_device->syspath, "%s%s", udev_get_sys_path(udev_device->udev), devpath) < 0) @@ -370,3 +397,68 @@ int device_add_property(struct udev_device *udev_device, const char *property) return -ENOMEM; return 0; } + +int device_set_action(struct udev_device *udev_device, const char *action) +{ + udev_device->action = strdup(action); + if (udev_device->action == NULL) + return -ENOMEM; + return 0; +} + +int device_set_driver(struct udev_device *udev_device, const char *driver) +{ + udev_device->driver = strdup(driver); + if (udev_device->driver == NULL) + return -ENOMEM; + return 0; +} + +const char *device_get_devpath_old(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->devpath_old; +} + +int device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) +{ + udev_device->devpath_old = strdup(devpath_old); + if (udev_device->devpath_old == NULL) + return -ENOMEM; + return 0; +} + +const char *device_get_physdevpath(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->physdevpath; +} + +int device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath) +{ + udev_device->physdevpath = strdup(physdevpath); + if (udev_device->physdevpath == NULL) + return -ENOMEM; + return 0; +} + +int device_get_timeout(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return -1; + return udev_device->timeout; +} + +int device_set_timeout(struct udev_device *udev_device, int timeout) +{ + udev_device->timeout = timeout; + return 0; +} + +int device_set_devnum(struct udev_device *udev_device, dev_t devnum) +{ + udev_device->devnum = devnum; + return 0; +} diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 2cba7caba0..5f63d2d401 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -88,6 +88,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char free(udev_monitor); return NULL; } + info(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); return udev_monitor; } @@ -96,7 +97,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) int err; const int on = 1; - err = bind(udev_monitor->sock, (struct sockaddr *) &udev_monitor->saddr, udev_monitor->addrlen); + err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->saddr, udev_monitor->addrlen); if (err < 0) { err(udev_monitor->udev, "bind failed: %s\n", strerror(errno)); return err; @@ -104,7 +105,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) /* enable receiving of the sender credentials */ setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - info(udev_monitor->udev, "udev_monitor: %p created\n", udev_monitor); + info(udev_monitor->udev, "monitor %p listening\n", udev_monitor); return 0; } @@ -142,7 +143,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) return; if (udev_monitor->sock >= 0) close(udev_monitor->sock); - info(udev_monitor->udev, "udev_monitor: %p released\n", udev_monitor); + info(udev_monitor->udev, "monitor %p released\n", udev_monitor); free(udev_monitor); } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index b03c813c2f..d8bf981bb5 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -60,6 +60,15 @@ extern int device_set_subsystem(struct udev_device *udev_device, const char *sub extern int device_set_devname(struct udev_device *udev_device, const char *devname); extern int device_add_devlink(struct udev_device *udev_device, const char *devlink); extern int device_add_property(struct udev_device *udev_device, const char *property); +extern int device_set_action(struct udev_device *udev_device, const char *action); +extern int device_set_driver(struct udev_device *udev_device, const char *driver); +extern const char *device_get_devpath_old(struct udev_device *udev_device); +extern int device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); +extern const char *device_get_physdevpath(struct udev_device *udev_device); +extern int device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath); +extern int device_get_timeout(struct udev_device *udev_device); +extern int device_set_timeout(struct udev_device *udev_device, int timeout); +extern int device_set_devnum(struct udev_device *udev_device, dev_t devnum); /* udev_ctrl - daemon runtime setup */ struct udev_ctrl; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index a2a06b58e9..eafd578a55 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -21,6 +21,7 @@ #define _LIBUDEV_H_ #include +#include /* this will stay as long as the DeviceKit integration of udev is work in progress */ #if !defined _LIBUDEV_COMPILATION && !defined LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE @@ -57,6 +58,9 @@ extern int udev_device_get_properties(struct udev_device *udev_device, int (*cb)(struct udev_device *udev_device, const char *key, const char *value, void *data), void *data); +extern const char *udev_device_get_driver(struct udev_device *udev_device); +extern dev_t udev_device_get_devnum(struct udev_device *udev_device); +extern const char *udev_device_get_action(struct udev_device *udev_device); extern int udev_devices_enumerate(struct udev *udev, const char *subsystem, int (*cb)(struct udev *udev, -- cgit v1.2.3-54-g00ecf From 8a4c287d150e56a2bf57163edaee7c487896418f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 14:07:08 +0200 Subject: udevadm: monitor - use libudev for udev monitor --- udev/Makefile.am | 2 ++ udev/udevadm-monitor.c | 75 +++++++++++++++++--------------------------------- 2 files changed, 27 insertions(+), 50 deletions(-) diff --git a/udev/Makefile.am b/udev/Makefile.am index 6ee72d3206..de39249af1 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -36,6 +36,8 @@ common_files = \ lib/libudev.h \ lib/libudev-private.h \ lib/libudev.c \ + lib/libudev-device.c \ + lib/libudev-monitor.c \ lib/libudev-utils.c \ lib/libudev-ctrl.c diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index caaf84ffa7..f884337779 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -35,43 +35,12 @@ #include "udev.h" static int uevent_netlink_sock = -1; -static int udev_monitor_sock = -1; -static volatile int udev_exit; - -static int init_udev_monitor_socket(void) -{ - struct sockaddr_un saddr; - socklen_t addrlen; - int retval; - - memset(&saddr, 0x00, sizeof(saddr)); - saddr.sun_family = AF_LOCAL; - /* use abstract namespace for socket path */ - strcpy(&saddr.sun_path[1], "/org/kernel/udev/monitor"); - addrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - - udev_monitor_sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (udev_monitor_sock == -1) { - fprintf(stderr, "error getting socket: %s\n", strerror(errno)); - return -1; - } - - /* the bind takes care of ensuring only one copy running */ - retval = bind(udev_monitor_sock, (struct sockaddr *) &saddr, addrlen); - if (retval < 0) { - fprintf(stderr, "bind failed: %s\n", strerror(errno)); - close(udev_monitor_sock); - udev_monitor_sock = -1; - return -1; - } - - return 0; -} +static int udev_exit; static int init_uevent_netlink_sock(void) { struct sockaddr_nl snl; - int retval; + int err; memset(&snl, 0x00, sizeof(struct sockaddr_nl)); snl.nl_family = AF_NETLINK; @@ -84,9 +53,9 @@ static int init_uevent_netlink_sock(void) return -1; } - retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, + err = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); - if (retval < 0) { + if (err < 0) { fprintf(stderr, "bind failed: %s\n", strerror(errno)); close(uevent_netlink_sock); uevent_netlink_sock = -1; @@ -129,8 +98,9 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) int env = 0; int print_kernel = 0; int print_udev = 0; + struct udev_monitor *udev_monitor = NULL; fd_set readfds; - int retval = 0; + int rc = 0; static const struct option options[] = { { "environment", 0, NULL, 'e' }, @@ -186,15 +156,22 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) printf("monitor will print the received events for:\n"); if (print_udev) { - retval = init_udev_monitor_socket(); - if (retval) + udev_monitor = udev_monitor_new_from_socket(udev, "@/org/kernel/udev/monitor"); + if (udev_monitor == NULL) { + rc = 1; + goto out; + } + if (udev_monitor_enable_receiving(udev_monitor) < 0) { + rc = 2; goto out; + } printf("UDEV the event which udev sends out after rule processing\n"); } if (print_kernel) { - retval = init_uevent_netlink_sock(); - if (retval) + if (init_uevent_netlink_sock() < 0) { + rc = 3; goto out; + } printf("UEVENT the kernel uevent\n"); } printf("\n"); @@ -215,10 +192,11 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) FD_ZERO(&readfds); if (uevent_netlink_sock >= 0) FD_SET(uevent_netlink_sock, &readfds); - if (udev_monitor_sock >= 0) - FD_SET(udev_monitor_sock, &readfds); + if (udev_monitor != NULL) + FD_SET(udev_monitor_get_fd(udev_monitor), &readfds); - fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_sock)+1, &readfds, NULL, NULL, NULL); + fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_get_fd(udev_monitor))+1, + &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); @@ -240,8 +218,8 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) source = "UEVENT"; } - if ((udev_monitor_sock >= 0) && FD_ISSET(udev_monitor_sock, &readfds)) { - buflen = recv(udev_monitor_sock, &buf, sizeof(buf), 0); + if ((udev_monitor != NULL) && FD_ISSET(udev_monitor_get_fd(udev_monitor), &readfds)) { + buflen = recv(udev_monitor_get_fd(udev_monitor), &buf, sizeof(buf), 0); if (buflen <= 0) { fprintf(stderr, "error receiving udev message: %s\n", strerror(errno)); continue; @@ -277,12 +255,9 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) } out: + udev_monitor_unref(udev_monitor); if (uevent_netlink_sock >= 0) close(uevent_netlink_sock); - if (udev_monitor_sock >= 0) - close(udev_monitor_sock); - if (retval) - return 1; - return 0; + return rc; } -- cgit v1.2.3-54-g00ecf From 37372bbc38d8542f482d90b26c90714429584421 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 14:37:36 +0200 Subject: libudev: monitor - add event properties to udev_device --- README | 2 +- udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 14 ++++++++++++++ udev/lib/libudev-monitor.c | 19 +++++++++++++++++++ udev/lib/libudev-private.h | 1 + udev/lib/libudev.h | 1 + 6 files changed, 37 insertions(+), 1 deletion(-) diff --git a/README b/README index 2cde586ce2..a76583abab 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ Important Note: recommend to replace a distro's udev installation with the upstream version. Requirements: - - Version 2.6.18 of the Linux kernel for reliable operation of this release of + - Version 2.6.19 of the Linux kernel for reliable operation of this release of udev. The kernel may have a requirement on udev too, see Documentation/Changes in the kernel source tree for the actual dependency. diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 7b42b28f9f..620b8964a2 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -20,6 +20,7 @@ udev_device_get_properties udev_device_get_action udev_device_get_driver udev_device_get_devnum +udev_device_get_seqnum udev_devices_enumerate udev_monitor_new_from_socket udev_monitor_enable_receiving diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index bec0d69af3..fd7c962d3a 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -47,6 +47,7 @@ struct udev_device { char *physdevpath; int timeout; dev_t devnum; + long long int seqnum; }; struct udev_device *device_init(struct udev *udev) @@ -360,6 +361,13 @@ const char *udev_device_get_action(struct udev_device *udev_device) return udev_device->action; } +unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return 0; + return udev_device->seqnum; +} + int device_set_devpath(struct udev_device *udev_device, const char *devpath) { if (asprintf(&udev_device->syspath, "%s%s", udev_get_sys_path(udev_device->udev), devpath) < 0) @@ -457,6 +465,12 @@ int device_set_timeout(struct udev_device *udev_device, int timeout) return 0; } +int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) +{ + udev_device->seqnum = seqnum; + return 0; +} + int device_set_devnum(struct udev_device *udev_device, dev_t devnum) { udev_device->devnum = devnum; diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 5f63d2d401..454a646046 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -203,6 +203,8 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; char buf[4096]; size_t bufpos; + int maj = 0; + int min = 0; if (udev_monitor == NULL) return NULL; @@ -279,9 +281,26 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito } if (slink[0] != '\0') device_add_devlink(udev_device, slink); + } else if (strncmp(key, "DRIVER=", 7) == 0) { + device_set_driver(udev_device, &key[7]); + } else if (strncmp(key, "ACTION=", 7) == 0) { + device_set_action(udev_device, &key[7]); + } else if (strncmp(key, "MAJOR=", 6) == 0) { + maj = strtoull(&key[6], NULL, 10); + } else if (strncmp(key, "MINOR=", 6) == 0) { + min = strtoull(&key[6], NULL, 10); + } else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) { + device_set_devpath_old(udev_device, &key[12]); + } else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) { + device_set_physdevpath(udev_device, &key[12]); + } else if (strncmp(key, "SEQNUM=", 7) == 0) { + device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10)); + } else if (strncmp(key, "TIMEOUT=", 8) == 0) { + device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); } device_add_property(udev_device, key); } + device_set_devnum(udev_device, makedev(maj, min)); return udev_device; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index d8bf981bb5..d626fe65ee 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -69,6 +69,7 @@ extern int device_set_physdevpath(struct udev_device *udev_device, const char *p extern int device_get_timeout(struct udev_device *udev_device); extern int device_set_timeout(struct udev_device *udev_device, int timeout); extern int device_set_devnum(struct udev_device *udev_device, dev_t devnum); +extern int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); /* udev_ctrl - daemon runtime setup */ struct udev_ctrl; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index eafd578a55..58c4ea97bb 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -61,6 +61,7 @@ extern int udev_device_get_properties(struct udev_device *udev_device, extern const char *udev_device_get_driver(struct udev_device *udev_device); extern dev_t udev_device_get_devnum(struct udev_device *udev_device); extern const char *udev_device_get_action(struct udev_device *udev_device); +extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); extern int udev_devices_enumerate(struct udev *udev, const char *subsystem, int (*cb)(struct udev *udev, -- cgit v1.2.3-54-g00ecf From bd770e018301edd34c53d276872865ca13e824fa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 14:48:42 +0200 Subject: udevadm: log message if udevadm link is used --- udev/udevadm-control.c | 4 ++-- udev/udevadm.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 8e319be946..c710811ed4 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -89,10 +89,10 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) break; if (option > 255) { - info(udev, "udevadm control expects commands without underscore, " - "this will stop working in a future release\n"); fprintf(stderr, "udevadm control expects commands without underscore, " "this will stop working in a future release\n"); + err(udev, "udevadm control expects commands without underscore, " + "this will stop working in a future release\n"); } switch (option) { diff --git a/udev/udevadm.c b/udev/udevadm.c index bfa704ef21..a4bcba603f 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -167,8 +167,8 @@ int main(int argc, char *argv[]) prog[len] = '\0'; fprintf(stderr, "the program '%s' called '%s', it should use 'udevadm %s ', " "this will stop working in a future release\n", prog, argv[0], command); - info(udev, "the program '%s' called '%s', it should use 'udevadm %s ', " - "this will stop working in a future release\n", prog, argv[0], command); + err(udev, "the program '%s' called '%s', it should use 'udevadm %s ', " + "this will stop working in a future release\n", prog, argv[0], command); } rc = run_command(udev, &cmds[i], argc, argv); goto out; -- cgit v1.2.3-54-g00ecf From 3bc7c84cf07eae90aee2a0972a4441652e4d38f6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 15:14:38 +0200 Subject: udevd: remove max_childs_running logic This was needed in the old days, where all the hotplug scripts did nothing better than sleep for seconds to work around timing issues. It made sure, that w continued to fork processes, while the machine was doing nothing than sleeping, but the maximim number of childs was already reached. This is no longer needed today, we do not run many of these scripts anymore. --- udev/lib/libudev-ctrl.c | 13 ---- udev/lib/libudev-private.h | 2 - udev/udevadm-control.c | 17 ----- udev/udevadm.xml | 7 -- udev/udevd.c | 159 ++------------------------------------------- 5 files changed, 5 insertions(+), 193 deletions(-) diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index b2af0c73ed..ed42a3b231 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -201,12 +201,6 @@ int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count) return 0; } -int udev_ctrl_send_set_max_childs_running(struct udev_ctrl *uctrl, int count) -{ - ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS_RUNNING, count, NULL); - return 0; -} - struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) { struct udev_ctrl_msg *uctrl_msg; @@ -323,10 +317,3 @@ int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg) return ctrl_msg->ctrl_msg.intval; return -1; } - -int udev_ctrl_get_set_max_childs_running(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_SET_MAX_CHILDS_RUNNING) - return ctrl_msg->ctrl_msg.intval; - return -1; -} diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index d626fe65ee..53a58cc619 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -85,7 +85,6 @@ extern int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl); extern int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl); extern int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key); extern int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count); -extern int udev_ctrl_send_set_max_childs_running(struct udev_ctrl *uctrl, int count); struct udev_ctrl_msg; extern struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl); extern struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl); @@ -97,7 +96,6 @@ extern int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); extern int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); extern const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); -extern int udev_ctrl_get_set_max_childs_running(struct udev_ctrl_msg *ctrl_msg); /* libudev-utils */ extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index c710811ed4..3dc7a1b52c 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -42,7 +42,6 @@ static void print_help(void) " --reload-rules reloads the rules files\n" " --env== set a global environment variable\n" " --max-childs= maximum number of childs\n" - " --max-childs-running= maximum number of childs running at the same time\n" " --help print this help text\n\n"); } @@ -64,8 +63,6 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) { "env", 1, NULL, 'e' }, { "max-childs", 1, NULL, 'm' }, { "max_childs", 1, NULL, 'm' + 256}, - { "max-childs-running", 1, NULL, 'M' }, - { "max_childs_running", 1, NULL, 'M' + 256}, { "help", 0, NULL, 'h' }, {} }; @@ -139,16 +136,6 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) udev_ctrl_send_set_max_childs(uctrl, i); rc = 0; break; - case 'M': - case 'M' + 256: - i = strtoul(optarg, &endp, 0); - if (endp[0] != '\0' || i < 1) { - fprintf(stderr, "invalid number '%s'\n", optarg); - goto exit; - } - udev_ctrl_send_set_max_childs_running(uctrl, i); - rc = 0; - break; case 'h': print_help(); rc = 0; @@ -187,10 +174,6 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) udev_ctrl_send_set_max_childs(uctrl, strtoul(&arg[strlen("max_childs=")], NULL, 0)); rc = 0; goto exit; - } else if (!strncmp(arg, "max_childs_running=", strlen("max_childs_running="))) { - udev_ctrl_send_set_max_childs_running(uctrl, strtoul(&arg[strlen("max_childs_running=")], NULL, 0)); - rc = 0; - goto exit; } else if (!strncmp(arg, "env", strlen("env"))) { udev_ctrl_send_set_env(uctrl, &arg[strlen("env=")]); rc = 0; diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 075890845b..b86b33ac44 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -290,13 +290,6 @@ same time. - - - - Set the maximum number of events, which are allowed to run at the - same time. - - diff --git a/udev/udevd.c b/udev/udevd.c index a711df53d4..a24ca92517 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -54,8 +54,6 @@ /* maximum limit of forked childs */ #define UDEVD_MAX_CHILDS 256 -/* start to throttle forking if maximum number of running childs in our session is reached */ -#define UDEVD_MAX_CHILDS_RUNNING 16 static int debug; @@ -95,7 +93,6 @@ static struct udev_rules rules; static struct udev_ctrl *udev_ctrl; static int uevent_netlink_sock = -1; static int inotify_fd = -1; -static pid_t sid; static int signal_pipe[2] = {-1, -1}; static volatile int sigchilds_waiting; @@ -104,7 +101,6 @@ static volatile int reload_config; static int run_exec_q; static int stop_exec_q; static int max_childs; -static int max_childs_running; static char udev_log_env[32]; static LIST_HEAD(exec_list); @@ -348,114 +344,6 @@ static int mem_size_mb(void) return memsize; } -static int cpu_count(void) -{ - FILE* f; - char buf[4096]; - int count = 0; - - f = fopen("/proc/stat", "r"); - if (f == NULL) - return -1; - - while (fgets(buf, sizeof(buf), f) != NULL) { - if (strncmp(buf, "cpu", 3) == 0 && isdigit(buf[3])) - count++; - } - - fclose(f); - if (count == 0) - return -1; - return count; -} - -static int running_processes(void) -{ - FILE* f; - char buf[4096]; - int running = -1; - - f = fopen("/proc/stat", "r"); - if (f == NULL) - return -1; - - while (fgets(buf, sizeof(buf), f) != NULL) { - int value; - - if (sscanf(buf, "procs_running %u", &value) == 1) { - running = value; - break; - } - } - - fclose(f); - return running; -} - -/* return the number of process es in our session, count only until limit */ -static int running_processes_in_session(pid_t session, int limit) -{ - DIR *dir; - struct dirent *dent; - int running = 0; - - dir = opendir("/proc"); - if (!dir) - return -1; - - /* read process info from /proc */ - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - int f; - char procdir[64]; - char line[256]; - const char *pos; - char state; - pid_t ppid, pgrp, sess; - int len; - - if (!isdigit(dent->d_name[0])) - continue; - - snprintf(procdir, sizeof(procdir), "/proc/%s/stat", dent->d_name); - procdir[sizeof(procdir)-1] = '\0'; - - f = open(procdir, O_RDONLY); - if (f == -1) - continue; - - len = read(f, line, sizeof(line)-1); - close(f); - - if (len <= 0) - continue; - else - line[len] = '\0'; - - /* skip ugly program name */ - pos = strrchr(line, ')') + 2; - if (pos == NULL) - continue; - - if (sscanf(pos, "%c %d %d %d ", &state, &ppid, &pgrp, &sess) != 4) - continue; - - /* count only processes in our session */ - if (sess != session) - continue; - - /* count only running, no sleeping processes */ - if (state != 'R') - continue; - - running++; - if (limit > 0 && running >= limit) - break; - } - closedir(dir); - - return running; -} - static int compare_devpath(const char *running, const char *waiting) { int i; @@ -524,8 +412,10 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) /* check run queue for still running events */ list_for_each_entry(loop_msg, &running_list, node) { - if (limit && childs_count++ > limit) { - dbg(msg->udev, "%llu, maximum number (%i) of childs reached\n", msg->seqnum, childs_count); + childs_count++; + + if (childs_count++ >= limit) { + info(msg->udev, "%llu, maximum number (%i) of childs reached\n", msg->seqnum, childs_count); return 1; } @@ -565,27 +455,11 @@ static void msg_queue_manager(struct udev *udev) { struct udevd_uevent_msg *loop_msg; struct udevd_uevent_msg *tmp_msg; - int running; if (list_empty(&exec_list)) return; - running = running_processes(); - dbg(udev, "%d processes runnning on system\n", running); - if (running < 0) - running = max_childs_running; - list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, node) { - /* check running processes in our session and possibly throttle */ - if (running >= max_childs_running) { - running = running_processes_in_session(sid, max_childs_running+10); - dbg(udev, "at least %d processes running in session\n", running); - if (running >= max_childs_running) { - dbg(udev, "delay seq %llu, too many processes already running\n", loop_msg->seqnum); - return; - } - } - /* serialize and wait for parent or child events */ if (devpath_busy(loop_msg, max_childs) != 0) { dbg(udev, "delay seq %llu (%s)\n", loop_msg->seqnum, loop_msg->devpath); @@ -595,7 +469,6 @@ static void msg_queue_manager(struct udev *udev) /* move event to run list */ list_move_tail(&loop_msg->node, &running_list); udev_event_run(loop_msg); - running++; dbg(udev, "moved seq %llu to running list\n", loop_msg->seqnum); } } @@ -735,12 +608,6 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) max_childs = i; } - i = udev_ctrl_get_set_max_childs_running(ctrl_msg); - if (i > 0) { - info(udev, "udevd message (SET_MAX_CHILDS_RUNNING) received, max_childs_running=%i\n", i); - max_childs_running = i; - } - udev_ctrl_msg_unref(ctrl_msg); } @@ -1079,10 +946,7 @@ int main(int argc, char *argv[]) chdir("/"); umask(022); - - /* become session leader */ - sid = setsid(); - dbg(udev, "our session is %d\n", sid); + setsid(); /* OOM_DISABLE == -17 */ fd = open("/proc/self/oom_adj", O_RDWR); @@ -1149,19 +1013,6 @@ int main(int argc, char *argv[]) } info(udev, "initialize max_childs to %u\n", max_childs); - /* start to throttle forking if maximum number of _running_ childs is reached */ - value = getenv("UDEVD_MAX_CHILDS_RUNNING"); - if (value) - max_childs_running = strtoull(value, NULL, 10); - else { - int cpus = cpu_count(); - if (cpus > 0) - max_childs_running = 8 + (8 * cpus); - else - max_childs_running = UDEVD_MAX_CHILDS_RUNNING; - } - info(udev, "initialize max_childs_running to %u\n", max_childs_running); - /* clear environment for forked event processes */ clearenv(); -- cgit v1.2.3-54-g00ecf From 1c7047ea77a417f183b6b92f4f5ea3728acef79b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 17:38:10 +0200 Subject: libudev: monitor- add netlink uevent support --- udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 4 +++ udev/lib/libudev-monitor.c | 89 +++++++++++++++++++++++++++++++++------------- udev/lib/libudev.h | 1 + 4 files changed, 70 insertions(+), 25 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 620b8964a2..72a2937229 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -23,6 +23,7 @@ udev_device_get_devnum udev_device_get_seqnum udev_devices_enumerate udev_monitor_new_from_socket +udev_monitor_new_from_netlink udev_monitor_enable_receiving udev_monitor_ref udev_monitor_unref diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index fd7c962d3a..00b9440386 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -194,6 +194,10 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->subsystem); name_list_cleanup(udev_device->udev, &udev_device->link_list); name_list_cleanup(udev_device->udev, &udev_device->env_list); + free(udev_device->action); + free(udev_device->driver); + free(udev_device->devpath_old); + free(udev_device->physdevpath); info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 454a646046..3e1731e382 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "libudev.h" #include "libudev-private.h" @@ -38,7 +39,8 @@ struct udev_monitor { struct udev *udev; int refcount; int sock; - struct sockaddr_un saddr; + struct sockaddr_nl snl; + struct sockaddr_un sun; socklen_t addrlen; }; @@ -74,13 +76,13 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char udev_monitor->refcount = 1; udev_monitor->udev = udev; - udev_monitor->saddr.sun_family = AF_LOCAL; - strcpy(udev_monitor->saddr.sun_path, socket_path); - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(udev_monitor->saddr.sun_path); + udev_monitor->sun.sun_family = AF_LOCAL; + strcpy(udev_monitor->sun.sun_path, socket_path); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(udev_monitor->sun.sun_path); /* translate leading '@' to abstract namespace */ - if (udev_monitor->saddr.sun_path[0] == '@') - udev_monitor->saddr.sun_path[0] = '\0'; + if (udev_monitor->sun.sun_path[0] == '@') + udev_monitor->sun.sun_path[0] = '\0'; udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udev_monitor->sock == -1) { @@ -92,20 +94,56 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char return udev_monitor; } +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev) +{ + struct udev_monitor *udev_monitor; + + if (udev == NULL) + return NULL; + udev_monitor = malloc(sizeof(struct udev_monitor)); + if (udev_monitor == NULL) + return NULL; + memset(udev_monitor, 0x00, sizeof(struct udev_monitor)); + udev_monitor->refcount = 1; + udev_monitor->udev = udev; + + udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + if (udev_monitor->sock == -1) { + err(udev, "error getting socket: %s\n", strerror(errno)); + free(udev_monitor); + return NULL; + } + + udev_monitor->snl.nl_family = AF_NETLINK; + udev_monitor->snl.nl_pid = getpid(); + udev_monitor->snl.nl_groups = 1; + + info(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT\n", udev_monitor); + return udev_monitor; +} + int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) { int err; const int on = 1; - err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->saddr, udev_monitor->addrlen); - if (err < 0) { - err(udev_monitor->udev, "bind failed: %s\n", strerror(errno)); - return err; + if (udev_monitor->snl.nl_family != 0) { + err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); + if (err < 0) { + err(udev_monitor->udev, "bind failed: %s\n", strerror(errno)); + return err; + } + info(udev_monitor->udev, "monitor %p listening on netlink\n", udev_monitor); + } else if (udev_monitor->sun.sun_family != 0) { + err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); + if (err < 0) { + err(udev_monitor->udev, "bind failed: %s\n", strerror(errno)); + return err; + } + /* enable receiving of the sender credentials */ + setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + info(udev_monitor->udev, "monitor %p listening on socket\n", udev_monitor); } - - /* enable receiving of the sender credentials */ - setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - info(udev_monitor->udev, "monitor %p listening\n", udev_monitor); return 0; } @@ -197,9 +235,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito { struct udev_device *udev_device; struct msghdr smsg; - struct cmsghdr *cmsg; struct iovec iov; - struct ucred *cred; char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; char buf[4096]; size_t bufpos; @@ -222,17 +258,20 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito info(udev_monitor->udev, "unable to receive message"); return NULL; } - cmsg = CMSG_FIRSTHDR(&smsg); - cred = (struct ucred *)CMSG_DATA (cmsg); - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - info(udev_monitor->udev, "no sender credentials received, message ignored"); - return NULL; - } + if (udev_monitor->sun.sun_family != 0) { + struct cmsghdr *cmsg = CMSG_FIRSTHDR(&smsg); + struct ucred *cred = (struct ucred *)CMSG_DATA (cmsg); - if (cred->uid != 0) { - info(udev_monitor->udev, "sender uid=%d, message ignored", cred->uid); - return NULL; + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + info(udev_monitor->udev, "no sender credentials received, message ignored"); + return NULL; + } + + if (cred->uid != 0) { + info(udev_monitor->udev, "sender uid=%d, message ignored", cred->uid); + return NULL; + } } /* skip header */ diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 58c4ea97bb..2267c9ea97 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -70,6 +70,7 @@ extern int udev_devices_enumerate(struct udev *udev, const char *subsystem, struct udev_monitor; extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); +extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev); extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); extern struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); extern void udev_monitor_unref(struct udev_monitor *udev_monitor); -- cgit v1.2.3-54-g00ecf From 9b3a33a9ff9386b4af3229762fa7673e670b00e7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 17:41:17 +0200 Subject: udevadm: monitor - use libudev code to retrieve device data --- udev/udevadm-monitor.c | 134 ++++++++++++++----------------------------------- 1 file changed, 38 insertions(+), 96 deletions(-) diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index f884337779..29f819f439 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -34,61 +34,24 @@ #include "udev.h" -static int uevent_netlink_sock = -1; static int udev_exit; -static int init_uevent_netlink_sock(void) -{ - struct sockaddr_nl snl; - int err; - - memset(&snl, 0x00, sizeof(struct sockaddr_nl)); - snl.nl_family = AF_NETLINK; - snl.nl_pid = getpid(); - snl.nl_groups = 1; - - uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); - if (uevent_netlink_sock == -1) { - fprintf(stderr, "error getting socket: %s\n", strerror(errno)); - return -1; - } - - err = bind(uevent_netlink_sock, (struct sockaddr *) &snl, - sizeof(struct sockaddr_nl)); - if (err < 0) { - fprintf(stderr, "bind failed: %s\n", strerror(errno)); - close(uevent_netlink_sock); - uevent_netlink_sock = -1; - return -1; - } - - return 0; -} - static void asmlinkage sig_handler(int signum) { if (signum == SIGINT || signum == SIGTERM) udev_exit = 1; } -static const char *search_key(const char *searchkey, const char *buf, size_t buflen) +static int print_properties_cb(struct udev_device *udev_device, const char *key, const char *value, void *data) { - size_t bufpos = 0; - size_t searchkeylen = strlen(searchkey); - - while (bufpos < buflen) { - const char *key; - int keylen; + printf("%s=%s\n", key, value); + return 0; +} - key = &buf[bufpos]; - keylen = strlen(key); - if (keylen == 0) - break; - if ((strncmp(searchkey, key, searchkeylen) == 0) && key[searchkeylen] == '=') - return &key[searchkeylen + 1]; - bufpos += keylen + 1; - } - return NULL; +static void print_properties(struct udev_device *device) +{ + udev_device_get_properties(device, print_properties_cb, NULL); + printf("\n"); } int udevadm_monitor(struct udev *udev, int argc, char *argv[]) @@ -99,6 +62,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) int print_kernel = 0; int print_udev = 0; struct udev_monitor *udev_monitor = NULL; + struct udev_monitor *kernel_monitor = NULL; fd_set readfds; int rc = 0; @@ -168,34 +132,32 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) printf("UDEV the event which udev sends out after rule processing\n"); } if (print_kernel) { - if (init_uevent_netlink_sock() < 0) { + kernel_monitor = udev_monitor_new_from_netlink(udev); + if (kernel_monitor == NULL) { rc = 3; goto out; } + if (udev_monitor_enable_receiving(kernel_monitor) < 0) { + rc = 4; + goto out; + } printf("UEVENT the kernel uevent\n"); } printf("\n"); while (!udev_exit) { - char buf[UEVENT_BUFFER_SIZE*2]; - ssize_t buflen; - ssize_t bufpos; - ssize_t keys; int fdcount; struct timeval tv; struct timezone tz; char timestr[64]; - const char *source = NULL; - const char *devpath, *action, *subsys; - buflen = 0; FD_ZERO(&readfds); - if (uevent_netlink_sock >= 0) - FD_SET(uevent_netlink_sock, &readfds); + if (kernel_monitor != NULL) + FD_SET(udev_monitor_get_fd(kernel_monitor), &readfds); if (udev_monitor != NULL) FD_SET(udev_monitor_get_fd(udev_monitor), &readfds); - fdcount = select(UDEV_MAX(uevent_netlink_sock, udev_monitor_get_fd(udev_monitor))+1, + fdcount = select(UDEV_MAX(udev_monitor_get_fd(kernel_monitor), udev_monitor_get_fd(udev_monitor))+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) @@ -209,55 +171,35 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) } else timestr[0] = '\0'; - if ((uevent_netlink_sock >= 0) && FD_ISSET(uevent_netlink_sock, &readfds)) { - buflen = recv(uevent_netlink_sock, &buf, sizeof(buf), 0); - if (buflen <= 0) { - fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); + if ((kernel_monitor != NULL) && FD_ISSET(udev_monitor_get_fd(kernel_monitor), &readfds)) { + struct udev_device *device = udev_monitor_receive_device(kernel_monitor); + if (device == NULL) continue; - } - source = "UEVENT"; + printf("UEVENT[%s] %-8s %s (%s)\n", timestr, + udev_device_get_action(device), + udev_device_get_devpath(device), + udev_device_get_subsystem(device)); + if (env) + print_properties(device); + udev_device_unref(device); } if ((udev_monitor != NULL) && FD_ISSET(udev_monitor_get_fd(udev_monitor), &readfds)) { - buflen = recv(udev_monitor_get_fd(udev_monitor), &buf, sizeof(buf), 0); - if (buflen <= 0) { - fprintf(stderr, "error receiving udev message: %s\n", strerror(errno)); + struct udev_device *device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) continue; - } - source = "UDEV "; - } - - if (buflen == 0) - continue; - - keys = strlen(buf) + 1; /* start of payload */ - devpath = search_key("DEVPATH", &buf[keys], buflen); - action = search_key("ACTION", &buf[keys], buflen); - subsys = search_key("SUBSYSTEM", &buf[keys], buflen); - printf("%s[%s] %-8s %s (%s)\n", source, timestr, action, devpath, subsys); - - /* print environment */ - bufpos = keys; - if (env) { - while (bufpos < buflen) { - int keylen; - char *key; - - key = &buf[bufpos]; - keylen = strlen(key); - if (keylen == 0) - break; - printf("%s\n", key); - bufpos += keylen + 1; - } - printf("\n"); + printf("UDEV [%s] %-8s %s (%s)\n", timestr, + udev_device_get_action(device), + udev_device_get_devpath(device), + udev_device_get_subsystem(device)); + if (env) + print_properties(device); + udev_device_unref(device); } } out: udev_monitor_unref(udev_monitor); - if (uevent_netlink_sock >= 0) - close(uevent_netlink_sock); - + udev_monitor_unref(kernel_monitor); return rc; } -- cgit v1.2.3-54-g00ecf From 95d90c4fe0581d8b630c62e38591b3af960d131a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 18:14:54 +0200 Subject: libudev: udev_device - read "driver" value --- udev/lib/libudev-device.c | 7 +++++++ udev/lib/libudev-private.h | 1 + udev/lib/libudev-utils.c | 16 ++++++++++++++-- udev/lib/test-libudev.c | 2 ++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 00b9440386..578afe7ec2 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -346,8 +346,15 @@ int udev_device_get_properties(struct udev_device *udev_device, const char *udev_device_get_driver(struct udev_device *udev_device) { + char driver[NAME_SIZE]; + if (udev_device == NULL) return NULL; + if (udev_device->driver != NULL) + return udev_device->driver; + if (util_get_sys_driver(udev_device->udev, udev_device->devpath, driver, sizeof(driver)) < 2) + return NULL; + udev_device->driver = strdup(driver); return udev_device->driver; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 53a58cc619..bc91927bed 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -99,4 +99,5 @@ extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); /* libudev-utils */ extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); +extern ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size); #endif diff --git a/udev/lib/libudev-utils.c b/udev/lib/libudev-utils.c index 8251b64da9..82acb1a481 100644 --- a/udev/lib/libudev-utils.c +++ b/udev/lib/libudev-utils.c @@ -32,7 +32,7 @@ #include "libudev-private.h" #include "../udev.h" -ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size) +static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *devpath, char *subsystem, size_t size) { char path[PATH_SIZE]; ssize_t len; @@ -40,7 +40,8 @@ ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *sub strlcpy(path, udev_get_sys_path(udev), sizeof(path)); strlcat(path, devpath, sizeof(path)); - strlcat(path, "/subsystem", sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, slink, sizeof(path)); len = readlink(path, path, sizeof(path)); if (len < 0 || len >= (ssize_t) sizeof(path)) return -1; @@ -51,3 +52,14 @@ ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *sub pos = &pos[1]; return strlcpy(subsystem, pos, size); } + +ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size) +{ + return get_sys_link(udev, "subsystem", devpath, subsystem, size); +} + +ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size) +{ + return get_sys_link(udev, "driver", devpath, driver, size); +} + diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 835536af84..4fdef68881 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -58,6 +58,8 @@ static void print_device(struct udev_device *device) printf("devpath: '%s'\n", str); str = udev_device_get_subsystem(device); printf("subsystem: '%s'\n", str); + str = udev_device_get_driver(device); + printf("driver: '%s'\n", str); str = udev_device_get_syspath(device); printf("syspath: '%s'\n", str); str = udev_device_get_devname(device); -- cgit v1.2.3-54-g00ecf From 6b12bdb62460a0bdc08d5e020a64c18bc1672bb1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Sep 2008 22:10:33 +0200 Subject: libudev: rename enumerate function --- udev/lib/exported_symbols | 2 +- udev/lib/libudev-enumerate.c | 4 ++-- udev/lib/libudev.h | 2 +- udev/lib/test-libudev.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 72a2937229..129cb9c36f 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -21,7 +21,7 @@ udev_device_get_action udev_device_get_driver udev_device_get_devnum udev_device_get_seqnum -udev_devices_enumerate +udev_enumerate_devices udev_monitor_new_from_socket udev_monitor_new_from_netlink udev_monitor_enable_receiving diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 6aa04d8f9b..1ba4de8948 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -130,7 +130,7 @@ static int devices_call(struct udev *udev, const char *devpath, } /** - * udev_devices_enumerate: + * udev_enumerate_devices: * @udev_device: udev device * @cb: function to be called for every property found * @data: data to be passed to the function @@ -142,7 +142,7 @@ static int devices_call(struct udev *udev, const char *devpath, * * Returns: the number of properties passed to the caller, or a negative value on error **/ -int udev_devices_enumerate(struct udev *udev, const char *subsystem, +int udev_enumerate_devices(struct udev *udev, const char *subsystem, int (*cb)(struct udev *udev, const char *devpath, const char *subsystem, const char *name, void *data), void *data) diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 2267c9ea97..2fd990f92e 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -63,7 +63,7 @@ extern dev_t udev_device_get_devnum(struct udev_device *udev_device); extern const char *udev_device_get_action(struct udev_device *udev_device); extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); -extern int udev_devices_enumerate(struct udev *udev, const char *subsystem, +extern int udev_enumerate_devices(struct udev *udev, const char *subsystem, int (*cb)(struct udev *udev, const char *devpath, const char *subsystem, const char *name, void *data), void *data); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 4fdef68881..1e9469d1c5 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -98,7 +98,7 @@ static int test_enumerate(struct udev *udev, const char *subsystem) { int count; - count = udev_devices_enumerate(udev, subsystem, devices_enum_cb, NULL); + count = udev_enumerate_devices(udev, subsystem, devices_enum_cb, NULL); printf("found %i devices\n\n", count); return count; } -- cgit v1.2.3-54-g00ecf From 4f4b12c20388ff2cb158b040e3193f86cf7a3b96 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 00:46:17 +0200 Subject: libudev: add selinux --- extras/ata_id/Makefile.am | 9 +- extras/cdrom_id/Makefile.am | 6 +- extras/edd_id/Makefile.am | 6 +- extras/floppy/Makefile.am | 5 +- extras/floppy/create_floppy_devices.c | 8 +- extras/fstab_import/Makefile.am | 5 + extras/scsi_id/Makefile.am | 5 + extras/usb_id/Makefile.am | 5 + extras/volume_id/Makefile.am | 5 + udev/Makefile.am | 5 - udev/lib/Makefile.am | 5 - udev/lib/libudev.c | 83 +++++++++++++++- udev/lib/libudev.h | 3 + udev/test-udev.c | 3 - udev/udev.h | 2 +- udev/udev_db.c | 6 +- udev/udev_node.c | 21 ++-- udev/udev_rules.c | 1 - udev/udev_rules_parse.c | 5 +- udev/udev_selinux.c | 175 ---------------------------------- udev/udev_selinux.h | 35 ------- udev/udev_utils_file.c | 5 +- udev/udevd.c | 8 +- 23 files changed, 143 insertions(+), 268 deletions(-) delete mode 100644 udev/udev_selinux.c delete mode 100644 udev/udev_selinux.h diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index 7e7fd2b7ab..db5f87f8c3 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -5,7 +5,8 @@ udevhome_PROGRAMS = \ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION + -D_LIBUDEV_COMPILATION \ + -UUSE_SELINUX ata_id_SOURCES = \ ata_id.c \ @@ -16,9 +17,13 @@ ata_id_SOURCES = \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c +if USE_SELINUX +ata_id_LDADD = \ + $(SELINUX_LIBS) +endif + dist_man_MANS = \ ata_id.8 distclean-local: rm -f Makefile.in - diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index dfc98850e0..0514a2ea51 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -20,9 +20,13 @@ cdrom_id_SOURCES = \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c +if USE_SELINUX +cdrom_id_LDADD = \ + $(SELINUX_LIBS) +endif + dist_man_MANS = \ cdrom_id.8 distclean-local: rm -f Makefile.in - diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index cc693967ca..22af7e9528 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -20,9 +20,13 @@ edd_id_SOURCES = \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c +if USE_SELINUX +edd_id_LDADD = \ + $(SELINUX_LIBS) +endif + dist_man_MANS = \ edd_id.8 distclean-local: rm -f Makefile.in - diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 7879e7c2bd..a5e9c10800 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -16,10 +16,8 @@ create_floppy_devices_SOURCES = \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c \ ../../udev/udev_utils_file.c -if USE_SELINUX -create_floppy_devices_SOURCES += \ - ../../udev/udev_selinux.c +if USE_SELINUX create_floppy_devices_LDADD = \ $(SELINUX_LIBS) endif @@ -29,4 +27,3 @@ dist_man_MANS = \ distclean-local: rm -f Makefile.in - diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 2c7d44b16d..4cff958da3 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -25,7 +25,6 @@ #include #include "../../udev/udev.h" -#include "../../udev/udev_selinux.h" static char *table[] = { "", "d360", "h1200", "u360", "u720", "h360", "h720", @@ -145,8 +144,6 @@ int main(int argc, char **argv) if (type == 0) return 0; - selinux_init(udev); - i = 0; while (table_sup[type][i]) { sprintf(node, "%s%s", dev, table[table_sup[type][i]]); @@ -155,16 +152,15 @@ int main(int argc, char **argv) printf("%s b %d %d %d\n", node, mode, major, minor); if (create_nodes) { unlink(node); - selinux_setfscreatecon(udev, node, NULL, S_IFBLK | mode); + udev_selinux_setfscreatecon(udev, node, S_IFBLK | mode); mknod(node, S_IFBLK | mode, makedev(major,minor)); - selinux_resetfscreatecon(udev); + udev_selinux_resetfscreatecon(udev); chown(node, uid, gid); chmod(node, S_IFBLK | mode); } i++; } - selinux_exit(udev); udev_unref(udev); exit: return 0; diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index 902ab1e28e..c4fbdce248 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -20,6 +20,11 @@ fstab_import_SOURCES = \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c +if USE_SELINUX +fstab_import_LDADD = \ + $(SELINUX_LIBS) +endif + distclean-local: rm -f Makefile.in diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index fc5c477820..f42563f498 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -20,6 +20,11 @@ scsi_id_SOURCES = \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c +if USE_SELINUX +scsi_id_LDADD = \ + $(SELINUX_LIBS) +endif + dist_sysconf_DATA = \ scsi_id.config diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index 9d7e7724ec..aa1c4f82b6 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -16,6 +16,11 @@ usb_id_SOURCES = \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c +if USE_SELINUX +usb_id_LDADD = \ + $(SELINUX_LIBS) +endif + distclean-local: rm -f Makefile.in diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index fe9bef7b88..9fb2cba646 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -22,6 +22,11 @@ vol_id_SOURCES = \ vol_id_LDADD = \ lib/libvolume_id.la +if USE_SELINUX +vol_id_LDADD += \ + $(SELINUX_LIBS) +endif + dist_man_MANS = \ vol_id.8 diff --git a/udev/Makefile.am b/udev/Makefile.am index de39249af1..7984e5d5f9 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -20,7 +20,6 @@ common_files = \ logging.h \ udev.h \ udev_rules.h \ - udev_selinux.h \ udev_sysdeps.h \ udev_db.c \ udev_device.c \ @@ -41,11 +40,7 @@ common_files = \ lib/libudev-utils.c \ lib/libudev-ctrl.c - if USE_SELINUX -common_files += \ - udev_selinux.c - common_ldadd += \ $(SELINUX_LIBS) endif diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 630888d3d9..95dd46e92f 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -38,11 +38,6 @@ libudev_la_SOURCES =\ ../udev_db.c \ ../udev_sysdeps.c -if USE_SELINUX -libudev_la_SOURCES += \ - ../udev_selinux.c -endif - libudev_la_LDFLAGS = \ -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ -export-symbols $(top_srcdir)/udev/lib/exported_symbols diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 09e1bec1bf..4e258bd2ce 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -27,6 +27,9 @@ #include #include #include +#ifdef USE_SELINUX +#include +#endif #include "libudev.h" #include "libudev-private.h" @@ -41,6 +44,10 @@ struct udev { char *dev_path; char *rules_path; int log_priority; +#ifdef USE_SELINUX + int selinux_enabled; + security_context_t selinux_prev_scontext; +#endif int run:1; }; @@ -66,6 +73,78 @@ static void log_stderr(struct udev *udev, vfprintf(stderr, format, args); } +static void selinux_init(struct udev *udev) +{ +#ifdef USE_SELINUX + /* + * record the present security context, for file-creation + * restoration creation purposes. + */ + udev->selinux_enabled = (is_selinux_enabled() > 0); + if (udev->selinux_enabled) { + matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); + if (getfscreatecon(&udev->selinux_prev_scontext) < 0) { + err(udev, "getfscreatecon failed\n"); + udev->selinux_prev_scontext = NULL; + } + } +#endif +} + +static void selinux_exit(struct udev *udev) +{ +#ifdef USE_SELINUX + if (udev->selinux_enabled) { + freecon(udev->selinux_prev_scontext); + udev->selinux_prev_scontext = NULL; + } +#endif +} + +void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) +{ +#ifdef USE_SELINUX + if (udev->selinux_enabled) { + security_context_t scontext = NULL; + + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (lsetfilecon(file, scontext) < 0) + err(udev, "setfilecon %s failed: %s\n", file, strerror(errno)); + freecon(scontext); + } +#endif +} + +void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) +{ +#ifdef USE_SELINUX + if (udev->selinux_enabled) { + security_context_t scontext = NULL; + + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (setfscreatecon(scontext) < 0) + err(udev, "setfscreatecon %s failed: %s\n", file, strerror(errno)); + freecon(scontext); + } +#endif +} + +void udev_selinux_resetfscreatecon(struct udev *udev) +{ +#ifdef USE_SELINUX + if (udev->selinux_enabled) { + if (setfscreatecon(udev->selinux_prev_scontext) < 0) + err(udev, "setfscreatecon failed: %s\n", strerror(errno)); + } +#endif +} + /** * udev_new: * @@ -88,9 +167,8 @@ struct udev *udev_new(void) return NULL; memset(udev, 0x00, (sizeof(struct udev))); + selinux_init(udev); sysfs_init(); - - /* defaults */ udev->refcount = 1; udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; @@ -270,6 +348,7 @@ void udev_unref(struct udev *udev) if (udev->refcount > 0) return; sysfs_cleanup(); + selinux_exit(udev); free(udev->dev_path); free(udev->sys_path); free(udev->rules_path); diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 2fd990f92e..e1eed568f9 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -40,6 +40,9 @@ extern int udev_get_log_priority(struct udev *udev); extern void udev_set_log_priority(struct udev *udev, int priority); extern const char *udev_get_sys_path(struct udev *udev); extern const char *udev_get_dev_path(struct udev *udev); +extern void udev_selinux_resetfscreatecon(struct udev *udev); +extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); +extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); struct udev_device; extern struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath); diff --git a/udev/test-udev.c b/udev/test-udev.c index 6c01bdbcd4..58bc28e02a 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -33,7 +33,6 @@ #include "udev.h" #include "udev_rules.h" -#include "udev_selinux.h" static void asmlinkage sig_handler(int signum) { @@ -63,7 +62,6 @@ int main(int argc, char *argv[]) if (udev == NULL) exit(1); dbg(udev, "version %s\n", VERSION); - selinux_init(udev); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); @@ -135,7 +133,6 @@ int main(int argc, char *argv[]) fail: udev_rules_cleanup(&rules); sysfs_cleanup(); - selinux_exit(udev); exit: udev_unref(udev); if (retval != 0) diff --git a/udev/udev.h b/udev/udev.h index 122e83d876..700c8c09d8 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2006 Kay Sievers + * Copyright (C) 2003-2008 Kay Sievers * * 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 diff --git a/udev/udev_db.c b/udev/udev_db.c index e89f2c2a15..18e111ba4b 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -31,8 +31,6 @@ #include #include "udev.h" -#include "udev_selinux.h" - static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) { @@ -147,9 +145,9 @@ int udev_db_add_device(struct udevice *udevice) !udevice->partitions && !udevice->ignore_remove) { int ret; dbg(udevice->udev, "nothing interesting to store, create symlink\n"); - selinux_setfscreatecon(udevice->udev, filename, NULL, S_IFLNK); + udev_selinux_setfscreatecon(udevice->udev, filename, S_IFLNK); ret = symlink(udevice->name, filename); - selinux_resetfscreatecon(udevice->udev); + udev_selinux_resetfscreatecon(udevice->udev); if (ret != 0) { err(udevice->udev, "unable to create db link '%s': %s\n", filename, strerror(errno)); return -1; diff --git a/udev/udev_node.c b/udev/udev_node.c index 462f1b633b..079bb4e3b1 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -31,7 +31,6 @@ #include "udev.h" #include "udev_rules.h" -#include "udev_selinux.h" #define TMP_FILE_EXT ".udev-tmp" @@ -51,15 +50,15 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devt)) { info(udevice->udev, "preserve file '%s', because it has correct dev_t\n", file); preserve = 1; - selinux_setfilecon(udevice->udev, file, udevice->dev->kernel, mode); + udev_selinux_lsetfilecon(udevice->udev, file, mode); } else { info(udevice->udev, "atomically replace existing file '%s'\n", file); strlcpy(file_tmp, file, sizeof(file_tmp)); strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); unlink(file_tmp); - selinux_setfscreatecon(udevice->udev, file_tmp, udevice->dev->kernel, mode); + udev_selinux_setfscreatecon(udevice->udev, file_tmp, mode); err = mknod(file_tmp, mode, devt); - selinux_resetfscreatecon(udevice->udev); + udev_selinux_resetfscreatecon(udevice->udev); if (err != 0) { err(udevice->udev, "mknod(%s, %#o, %u, %u) failed: %s\n", file_tmp, mode, major(devt), minor(devt), strerror(errno)); @@ -73,9 +72,9 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ } } else { info(udevice->udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devt), minor(devt)); - selinux_setfscreatecon(udevice->udev, file, udevice->dev->kernel, mode); + udev_selinux_setfscreatecon(udevice->udev, file, mode); err = mknod(file, mode, devt); - selinux_resetfscreatecon(udevice->udev); + udev_selinux_resetfscreatecon(udevice->udev); if (err != 0) { err(udevice->udev, "mknod(%s, %#o, (%u,%u) failed: %s\n", file, mode, major(devt), minor(devt), strerror(errno)); @@ -151,16 +150,16 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s buf[len] = '\0'; if (strcmp(target, buf) == 0) { info(udevice->udev, "preserve already existing symlink '%s' to '%s'\n", slink, target); - selinux_setfilecon(udevice->udev, slink, NULL, S_IFLNK); + udev_selinux_lsetfilecon(udevice->udev, slink, S_IFLNK); goto exit; } } } } else { info(udevice->udev, "creating symlink '%s' to '%s'\n", slink, target); - selinux_setfscreatecon(udevice->udev, slink, NULL, S_IFLNK); + udev_selinux_setfscreatecon(udevice->udev, slink, S_IFLNK); retval = symlink(target, slink); - selinux_resetfscreatecon(udevice->udev); + udev_selinux_resetfscreatecon(udevice->udev); if (retval == 0) goto exit; } @@ -169,9 +168,9 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s strlcpy(slink_tmp, slink, sizeof(slink_tmp)); strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); unlink(slink_tmp); - selinux_setfscreatecon(udevice->udev, slink, NULL, S_IFLNK); + udev_selinux_setfscreatecon(udevice->udev, slink, S_IFLNK); retval = symlink(target, slink_tmp); - selinux_resetfscreatecon(udevice->udev); + udev_selinux_resetfscreatecon(udevice->udev); if (retval != 0) { err(udevice->udev, "symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno)); goto exit; diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 3b9631b883..6e4a6942f8 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -35,7 +35,6 @@ #include "udev.h" #include "udev_rules.h" -#include "udev_selinux.h" extern char **environ; diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 81f0edb6f5..9513ac9cf3 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -30,7 +30,6 @@ #include "udev.h" #include "udev_rules.h" -#include "udev_selinux.h" void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules) @@ -756,9 +755,9 @@ int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_nam strlcat(filename, "/.udev/rules.d", sizeof(filename)); if (stat(filename, &statbuf) != 0) { create_path(udev, filename); - selinux_setfscreatecon(udev, filename, NULL, S_IFDIR|0755); + udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); mkdir(filename, 0755); - selinux_resetfscreatecon(udev); + udev_selinux_resetfscreatecon(udev); } add_matching_files(udev, &sort_list, filename, ".rules"); diff --git a/udev/udev_selinux.c b/udev/udev_selinux.c deleted file mode 100644 index 2e76a7431f..0000000000 --- a/udev/udev_selinux.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2004 Daniel Walsh - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_selinux.h" - -static security_context_t prev_scontext = NULL; - -static int is_selinux_running(struct udev *udev) -{ - static int selinux_enabled = -1; - - if (selinux_enabled == -1) - selinux_enabled = (is_selinux_enabled() > 0); - - dbg(udev, "selinux=%i\n", selinux_enabled); - return selinux_enabled; -} - -static char *get_media(struct udev *udev, const char *devname, int mode) -{ - FILE *fp; - char procfile[PATH_MAX]; - char mediabuf[256]; - int size; - char *media = NULL; - - if (!(mode & S_IFBLK)) - return NULL; - - snprintf(procfile, PATH_MAX, "/proc/ide/%s/media", devname); - procfile[PATH_MAX-1] = '\0'; - - fp = fopen(procfile, "r"); - if (!fp) - goto out; - - if (fgets(mediabuf, sizeof(mediabuf), fp) == NULL) - goto close_out; - - size = strlen(mediabuf); - while (size-- > 0) { - if (isspace(mediabuf[size])) { - mediabuf[size] = '\0'; - } else { - break; - } - } - - media = strdup(mediabuf); - info(udev, "selinux_get_media(%s)='%s'\n", devname, media); - -close_out: - fclose(fp); -out: - return media; -} - -void selinux_setfilecon(struct udev *udev, const char *file, const char *devname, unsigned int mode) -{ - if (is_selinux_running(udev)) { - security_context_t scontext = NULL; - char *media; - int ret = -1; - - if (devname) { - media = get_media(udev, devname, mode); - if (media) { - ret = matchmediacon(media, &scontext); - free(media); - } - } - - if (ret < 0) - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - - if (lsetfilecon(file, scontext) < 0) - err(udev, "setfilecon %s failed: %s\n", file, strerror(errno)); - - freecon(scontext); - } -} - -void selinux_setfscreatecon(struct udev *udev, const char *file, const char *devname, unsigned int mode) -{ - if (is_selinux_running(udev)) { - security_context_t scontext = NULL; - char *media; - int ret = -1; - - if (devname) { - media = get_media(udev, devname, mode); - if (media) { - ret = matchmediacon(media, &scontext); - free(media); - } - } - - if (ret < 0) - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - - if (setfscreatecon(scontext) < 0) - err(udev, "setfscreatecon %s failed: %s\n", file, strerror(errno)); - - freecon(scontext); - } -} - -void selinux_resetfscreatecon(struct udev *udev) -{ - if (is_selinux_running(udev)) { - if (setfscreatecon(prev_scontext) < 0) - err(udev, "setfscreatecon failed: %s\n", strerror(errno)); - } -} - -void selinux_init(struct udev *udev) -{ - /* - * record the present security context, for file-creation - * restoration creation purposes. - */ - if (is_selinux_running(udev)) { - if (!udev_get_dev_path(udev)[0]) - err(udev, "selinux_init: udev_root not set\n"); - matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); - if (getfscreatecon(&prev_scontext) < 0) { - err(udev, "getfscreatecon failed\n"); - prev_scontext = NULL; - } - } -} - -void selinux_exit(struct udev *udev) -{ - if (is_selinux_running(udev) && prev_scontext) { - freecon(prev_scontext); - prev_scontext = NULL; - } -} diff --git a/udev/udev_selinux.h b/udev/udev_selinux.h deleted file mode 100644 index 55bc91222a..0000000000 --- a/udev/udev_selinux.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2004 Daniel Walsh - * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ -#ifndef _UDEV_SELINUX_H -#define _UDEV_SELINUX_H - -#ifdef USE_SELINUX -extern void selinux_setfilecon(struct udev *udev, const char *file, const char *devname, unsigned int mode); -extern void selinux_setfscreatecon(struct udev *udev, const char *file, const char *devname, unsigned int mode); -extern void selinux_resetfscreatecon(struct udev *udev); -extern void selinux_init(struct udev *udev); -extern void selinux_exit(struct udev *udev); -#else -static inline void selinux_setfilecon(struct udev *udev, const char *file, const char *devname, unsigned int mode) {} -static inline void selinux_setfscreatecon(struct udev *udev, const char *file, const char *devname, unsigned int mode) {} -static inline void selinux_resetfscreatecon(struct udev *udev) {} -static inline void selinux_init(struct udev *udev) {} -static inline void selinux_exit(struct udev *udev) {} -#endif - -#endif diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c index 7ccb5b4039..b8b4d10d21 100644 --- a/udev/udev_utils_file.c +++ b/udev/udev_utils_file.c @@ -30,7 +30,6 @@ #include #include "udev.h" -#include "udev_selinux.h" int create_path(struct udev *udev, const char *path) { @@ -56,9 +55,9 @@ int create_path(struct udev *udev, const char *path) return -1; dbg(udev, "mkdir '%s'\n", p); - selinux_setfscreatecon(udev, p, NULL, S_IFDIR|0755); + udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); ret = mkdir(p, 0755); - selinux_resetfscreatecon(udev); + udev_selinux_resetfscreatecon(udev); if (ret == 0) return 0; diff --git a/udev/udevd.c b/udev/udevd.c index a24ca92517..d24d8430ca 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -47,7 +47,6 @@ #include "udev.h" #include "udev_rules.h" -#include "udev_selinux.h" #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 @@ -189,9 +188,9 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st unlink(filename_failed); delete_path(msg->udev, filename_failed); create_path(msg->udev, filename); - selinux_setfscreatecon(msg->udev, filename, NULL, S_IFLNK); + udev_selinux_setfscreatecon(msg->udev, filename, S_IFLNK); symlink(msg->devpath, filename); - selinux_resetfscreatecon(msg->udev); + udev_selinux_resetfscreatecon(msg->udev); break; case EVENT_FINISHED: if (msg->devpath_old != NULL) { @@ -804,8 +803,6 @@ int main(int argc, char *argv[]) logging_init("udevd"); udev_set_log_fn(udev, log_fn); - - selinux_init(udev); dbg(udev, "version %s\n", VERSION); while (1) { @@ -1107,7 +1104,6 @@ int main(int argc, char *argv[]) exit: udev_rules_cleanup(&rules); sysfs_cleanup(); - selinux_exit(udev); if (signal_pipe[READ_END] >= 0) close(signal_pipe[READ_END]); -- cgit v1.2.3-54-g00ecf From 3fd0648c60b60de9836539ee4ae2f1c00a2c3a5e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 01:47:51 +0200 Subject: libudev: initialize selinux after logging --- udev/lib/libudev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 4e258bd2ce..6239377ece 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -81,6 +81,7 @@ static void selinux_init(struct udev *udev) * restoration creation purposes. */ udev->selinux_enabled = (is_selinux_enabled() > 0); + info(udev, "selinux=%i\n", udev->selinux_enabled); if (udev->selinux_enabled) { matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); if (getfscreatecon(&udev->selinux_prev_scontext) < 0) { @@ -166,9 +167,6 @@ struct udev *udev_new(void) if (udev == NULL) return NULL; memset(udev, 0x00, (sizeof(struct udev))); - - selinux_init(udev); - sysfs_init(); udev->refcount = 1; udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; @@ -176,7 +174,6 @@ struct udev *udev_new(void) udev->dev_path = strdup(UDEV_PREFIX "/dev"); udev->sys_path = strdup("/sys"); config_file = strdup(SYSCONFDIR "/udev/udev.conf"); - if (udev->dev_path == NULL || udev->sys_path == NULL || config_file == NULL) @@ -299,6 +296,9 @@ struct udev *udev_new(void) if (udev->dev_path == NULL || udev->sys_path == NULL) goto err; + selinux_init(udev); + sysfs_init(); + info(udev, "context %p created\n", udev); info(udev, "log_priority=%d\n", udev->log_priority); info(udev, "config_file='%s'\n", config_file); -- cgit v1.2.3-54-g00ecf From ef5c2d048c875b6307fdc0e10f6b703fcb57772e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 02:31:11 +0200 Subject: volume_id: merge util.h in libvolume_id-private.h --- configure.ac | 2 +- extras/volume_id/lib/Makefile.am | 1 - extras/volume_id/lib/libvolume_id-private.h | 78 ++++++++++++++++++++++-- extras/volume_id/lib/util.h | 92 ----------------------------- 4 files changed, 74 insertions(+), 99 deletions(-) delete mode 100644 extras/volume_id/lib/util.h diff --git a/configure.ac b/configure.ac index 0555ccbfe9..c24da97a3b 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ AC_SUBST(LIBUDEV_LT_AGE) dnl /* libvolume_id version */ VOLID_LT_CURRENT=1 -VOLID_LT_REVISION=0 +VOLID_LT_REVISION=1 VOLID_LT_AGE=0 AC_SUBST(VOLID_LT_CURRENT) AC_SUBST(VOLID_LT_REVISION) diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am index c5198aba9a..59a5ac990b 100644 --- a/extras/volume_id/lib/Makefile.am +++ b/extras/volume_id/lib/Makefile.am @@ -8,7 +8,6 @@ include_HEADERS =\ libvolume_id_la_SOURCES =\ libvolume_id-private.h \ volume_id.c \ - util.h \ util.c \ md5.h \ md5.c \ diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h index c9afaf94e7..3b5c083a88 100644 --- a/extras/volume_id/lib/libvolume_id-private.h +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -13,14 +13,71 @@ #include #include +#include +#include +#include #include "libvolume_id.h" -#define VOLUME_ID_LABEL_SIZE 64 -#define VOLUME_ID_UUID_SIZE 36 -#define VOLUME_ID_FORMAT_SIZE 32 -#define VOLUME_ID_PATH_MAX 256 -#define VOLUME_ID_PARTITIONS_MAX 256 +#define ALLOWED_CHARS "#+-.:=@_" + +#ifndef PACKED +#define PACKED __attribute__((packed)) +#endif + +#define err(format, arg...) volume_id_log_fn(LOG_ERR, __FILE__, __LINE__, format, ##arg) +#define info(format, arg...) volume_id_log_fn(LOG_INFO, __FILE__, __LINE__, format, ##arg) +#ifdef DEBUG +#define dbg(format, arg...) volume_id_log_fn(LOG_DEBUG, __FILE__, __LINE__, format, ##arg) +#else +#define dbg(format, arg...) do { } while (0) +#endif + +#if (__BYTE_ORDER == __LITTLE_ENDIAN) +#define le16_to_cpu(x) (x) +#define le32_to_cpu(x) (x) +#define le64_to_cpu(x) (x) +#define be16_to_cpu(x) bswap_16(x) +#define be32_to_cpu(x) bswap_32(x) +#define cpu_to_le16(x) (x) +#define cpu_to_le32(x) (x) +#define cpu_to_be32(x) bswap_32(x) +#elif (__BYTE_ORDER == __BIG_ENDIAN) +#define le16_to_cpu(x) bswap_16(x) +#define le32_to_cpu(x) bswap_32(x) +#define le64_to_cpu(x) bswap_64(x) +#define be16_to_cpu(x) (x) +#define be32_to_cpu(x) (x) +#define cpu_to_le16(x) bswap_16(x) +#define cpu_to_le32(x) bswap_32(x) +#define cpu_to_be32(x) (x) +#endif /* __BYTE_ORDER */ + +enum uuid_format { + UUID_STRING, + UUID_HEX_STRING, + UUID_DCE, + UUID_DOS, + UUID_64BIT_LE, + UUID_MD, + UUID_LVM, +}; + +enum endian { + LE = 0, + BE = 1 +}; + +#define VOLUME_ID_LABEL_SIZE 64 +#define VOLUME_ID_UUID_SIZE 36 +#define VOLUME_ID_FORMAT_SIZE 32 +#define VOLUME_ID_PATH_MAX 256 +#define VOLUME_ID_PARTITIONS_MAX 256 + +/* size of superblock buffer, reiserfs block is at 64k */ +#define SB_BUFFER_SIZE 0x11000 +/* size of seek buffer, FAT cluster is 32k max */ +#define SEEK_BUFFER_SIZE 0x10000 enum volume_id_usage { VOLUME_ID_UNUSED, @@ -52,6 +109,17 @@ struct volume_id { size_t seekbuf_len; }; +/* utils */ +extern int volume_id_utf8_encoded_valid_unichar(const char *str); +extern size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); +extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); +extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); +extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); +extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format); +extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); +extern void volume_id_free_buffer(struct volume_id *id); + /* filesystems */ extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size); diff --git a/extras/volume_id/lib/util.h b/extras/volume_id/lib/util.h deleted file mode 100644 index fe0b56be81..0000000000 --- a/extras/volume_id/lib/util.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005-2006 Kay Sievers - * - * 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. - */ - -#ifndef _VOLUME_ID_UTIL_ -#define _VOLUME_ID_UTIL_ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#ifdef HAVE_CONFIG_H -# include -#endif - -#include -#include -#include - -#define ALLOWED_CHARS "#+-.:=@_" - -#ifndef PACKED -#define PACKED __attribute__((packed)) -#endif - -#define err(format, arg...) volume_id_log_fn(LOG_ERR, __FILE__, __LINE__, format, ##arg) -#define info(format, arg...) volume_id_log_fn(LOG_INFO, __FILE__, __LINE__, format, ##arg) -#ifdef DEBUG -#define dbg(format, arg...) volume_id_log_fn(LOG_DEBUG, __FILE__, __LINE__, format, ##arg) -#else -#define dbg(format, arg...) do { } while (0) -#endif - -/* size of superblock buffer, reiserfs block is at 64k */ -#define SB_BUFFER_SIZE 0x11000 -/* size of seek buffer, FAT cluster is 32k max */ -#define SEEK_BUFFER_SIZE 0x10000 - -#ifdef __BYTE_ORDER -#if (__BYTE_ORDER == __LITTLE_ENDIAN) -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#define le64_to_cpu(x) (x) -#define be16_to_cpu(x) bswap_16(x) -#define be32_to_cpu(x) bswap_32(x) -#define cpu_to_le16(x) (x) -#define cpu_to_le32(x) (x) -#define cpu_to_be32(x) bswap_32(x) -#elif (__BYTE_ORDER == __BIG_ENDIAN) -#define le16_to_cpu(x) bswap_16(x) -#define le32_to_cpu(x) bswap_32(x) -#define le64_to_cpu(x) bswap_64(x) -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_le16(x) bswap_16(x) -#define cpu_to_le32(x) bswap_32(x) -#define cpu_to_be32(x) (x) -#endif -#endif /* __BYTE_ORDER */ - -enum uuid_format { - UUID_STRING, - UUID_HEX_STRING, - UUID_DCE, - UUID_DOS, - UUID_64BIT_LE, - UUID_MD, - UUID_LVM, -}; - -enum endian { - LE = 0, - BE = 1 -}; - -extern int volume_id_utf8_encoded_valid_unichar(const char *str); -extern size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); -extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); -extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); -extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); -extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); -extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format); -extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); -extern void volume_id_free_buffer(struct volume_id *id); - -#endif /* _VOLUME_ID_UTIL_ */ -- cgit v1.2.3-54-g00ecf From 55e9959b155cefc5146f7a3d1ea73e74da91f303 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 02:40:42 +0200 Subject: update file headers --- extras/ata_id/ata_id.c | 15 ++++++++++++--- extras/cdrom_id/cdrom_id.c | 21 ++++++++++----------- extras/volume_id/lib/adaptec_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/cramfs.c | 20 ++++++++++++-------- extras/volume_id/lib/ddf_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/ext.c | 20 +++++++++++--------- extras/volume_id/lib/fat.c | 20 ++++++++++++-------- extras/volume_id/lib/gfs.c | 20 ++++++++++++-------- extras/volume_id/lib/hfs.c | 22 +++++++++++++--------- extras/volume_id/lib/highpoint.c | 20 ++++++++++++-------- extras/volume_id/lib/hpfs.c | 20 ++++++++++++-------- extras/volume_id/lib/iso9660.c | 20 ++++++++++++-------- extras/volume_id/lib/isw_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/jfs.c | 20 ++++++++++++-------- extras/volume_id/lib/jmicron_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/libvolume_id-private.h | 15 ++++++++++++--- extras/volume_id/lib/libvolume_id.h | 15 ++++++++++++--- extras/volume_id/lib/linux_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/linux_swap.c | 20 ++++++++++++-------- extras/volume_id/lib/lsi_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/luks.c | 20 ++++++++++++-------- extras/volume_id/lib/lvm.c | 20 ++++++++++++-------- extras/volume_id/lib/md5.c | 18 +++++++++++++----- extras/volume_id/lib/minix.c | 20 ++++++++++++-------- extras/volume_id/lib/netware.c | 20 ++++++++++++-------- extras/volume_id/lib/ntfs.c | 20 ++++++++++++-------- extras/volume_id/lib/nvidia_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/ocfs.c | 21 ++++++++++++--------- extras/volume_id/lib/oracleasm.c | 20 ++++++++++++-------- extras/volume_id/lib/promise_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/reiserfs.c | 20 ++++++++++++-------- extras/volume_id/lib/romfs.c | 20 ++++++++++++-------- extras/volume_id/lib/silicon_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/squashfs.c | 20 ++++++++++++-------- extras/volume_id/lib/sysv.c | 20 ++++++++++++-------- extras/volume_id/lib/udf.c | 20 ++++++++++++-------- extras/volume_id/lib/ufs.c | 20 ++++++++++++-------- extras/volume_id/lib/util.c | 20 ++++++++++++-------- extras/volume_id/lib/via_raid.c | 20 ++++++++++++-------- extras/volume_id/lib/volume_id.c | 20 ++++++++++++-------- extras/volume_id/lib/vxfs.c | 20 ++++++++++++-------- extras/volume_id/lib/xfs.c | 20 ++++++++++++-------- extras/volume_id/vol_id.c | 23 +++++++++++------------ udev/lib/libudev-ctrl.c | 27 ++++++++++++++------------- udev/list.h | 5 +---- udev/test-udev.c | 25 ++++++++++++------------- udev/udev.h | 23 +++++++++++------------ udev/udev_db.c | 26 ++++++++++++-------------- udev/udev_device.c | 26 ++++++++++++-------------- udev/udev_device_event.c | 26 ++++++++++++-------------- udev/udev_node.c | 26 ++++++++++++-------------- udev/udev_rules.c | 23 +++++++++++------------ udev/udev_rules.h | 25 ++++++++++++------------- udev/udev_rules_parse.c | 25 ++++++++++++------------- udev/udev_sysdeps.c | 23 +++++++++++------------ udev/udev_sysdeps.h | 23 +++++++++++------------ udev/udev_sysfs.c | 26 ++++++++++++-------------- udev/udev_utils.c | 26 ++++++++++++-------------- udev/udev_utils_file.c | 26 ++++++++++++-------------- udev/udev_utils_string.c | 26 ++++++++++++-------------- udev/udevadm-control.c | 22 +++++++++------------- udev/udevadm-info.c | 25 ++++++++++++------------- udev/udevadm-monitor.c | 25 ++++++++++++------------- udev/udevadm-settle.c | 25 ++++++++++++------------- udev/udevadm-test.c | 25 ++++++++++++------------- udev/udevadm-trigger.c | 25 ++++++++++++------------- udev/udevadm.c | 23 +++++++++++------------ udev/udevd.c | 23 +++++++++++------------ 68 files changed, 796 insertions(+), 654 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 43d9516a19..927dbfabd7 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -3,9 +3,18 @@ * * Copyright (C) 2005-2008 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index dbe80ea7e3..627ae0dee4 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -3,19 +3,18 @@ * * Copyright (C) 2008 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. * - * 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 02139, USA. + * 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, see . */ #ifndef _GNU_SOURCE diff --git a/extras/volume_id/lib/adaptec_raid.c b/extras/volume_id/lib/adaptec_raid.c index 45a56dcfbd..a76b7321d8 100644 --- a/extras/volume_id/lib/adaptec_raid.c +++ b/extras/volume_id/lib/adaptec_raid.c @@ -3,19 +3,24 @@ * * Copyright (C) 2006 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct adaptec_meta { uint32_t b0idcode; diff --git a/extras/volume_id/lib/cramfs.c b/extras/volume_id/lib/cramfs.c index afbdf886d0..ed54dfd352 100644 --- a/extras/volume_id/lib/cramfs.c +++ b/extras/volume_id/lib/cramfs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct cramfs_super { uint8_t magic[4]; diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c index de7b7a7b63..bf24fe0168 100644 --- a/extras/volume_id/lib/ddf_raid.c +++ b/extras/volume_id/lib/ddf_raid.c @@ -3,19 +3,24 @@ * * Copyright (C) 2007 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -26,7 +31,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" /* http://www.snia.org/standards/home */ diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index 49b7c5d060..97299d60d8 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -4,21 +4,24 @@ * Copyright (C) 2004-2008 Kay Sievers * Copyright (C) 2008 Theodore Ts'o * - * The probe logic is based on libblkid from e2fsutils. + * 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, either version 2 of the License, or + * (at your option) any later version. * - * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -28,7 +31,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct ext2_super_block { uint32_t s_inodes_count; diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 759e106f68..62ff6b664f 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -4,19 +4,24 @@ * Copyright (C) 2004-2007 Kay Sievers * Copyright (C) 2007 Ryan Lortie * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -26,7 +31,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #define FAT12_MAX 0xff5 #define FAT16_MAX 0xfff5 diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c index e1293ebce7..a8b5080ec4 100644 --- a/extras/volume_id/lib/gfs.c +++ b/extras/volume_id/lib/gfs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2006 Red Hat, Inc. * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" /* Common gfs/gfs2 constants: */ #define GFS_MAGIC 0x01161970 diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index b3370460bc..dbc5f36195 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -1,21 +1,26 @@ /* * volume_id - reads filesystem label and uuid * - * Copyright (C) 2004 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #include "md5.h" struct hfs_finder_info{ diff --git a/extras/volume_id/lib/highpoint.c b/extras/volume_id/lib/highpoint.c index 23e25bcca1..7c91f5d2c5 100644 --- a/extras/volume_id/lib/highpoint.c +++ b/extras/volume_id/lib/highpoint.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct hpt37x_meta { uint8_t filler1[32]; diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c index a95e778e5e..a59ca1d99b 100644 --- a/extras/volume_id/lib/hpfs.c +++ b/extras/volume_id/lib/hpfs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct hpfs_super { diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c index 367deee4d6..913e5b8a0e 100644 --- a/extras/volume_id/lib/iso9660.c +++ b/extras/volume_id/lib/iso9660.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #define ISO_SUPERBLOCK_OFFSET 0x8000 #define ISO_SECTOR_SIZE 0x800 diff --git a/extras/volume_id/lib/isw_raid.c b/extras/volume_id/lib/isw_raid.c index f62d106f53..382e45d5db 100644 --- a/extras/volume_id/lib/isw_raid.c +++ b/extras/volume_id/lib/isw_raid.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct isw_meta { uint8_t sig[32]; diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c index d4a5f0febb..d496cf8781 100644 --- a/extras/volume_id/lib/jfs.c +++ b/extras/volume_id/lib/jfs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct jfs_super_block { uint8_t magic[4]; diff --git a/extras/volume_id/lib/jmicron_raid.c b/extras/volume_id/lib/jmicron_raid.c index 2279c4df5c..134e7aa4e1 100644 --- a/extras/volume_id/lib/jmicron_raid.c +++ b/extras/volume_id/lib/jmicron_raid.c @@ -3,19 +3,24 @@ * * Copyright (C) 2006 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct jmicron_meta { int8_t signature[2]; diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h index 3b5c083a88..2ce46502c4 100644 --- a/extras/volume_id/lib/libvolume_id-private.h +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -3,9 +3,18 @@ * * Copyright (C) 2005-2007 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _LIBVOLUME_ID_PRIVATE_H_ diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index d1a0077f0c..e830504697 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -3,9 +3,18 @@ * * Copyright (C) 2005-2008 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _LIBVOLUME_ID_H_ diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index c40f3e3ba6..f7d1af4fe7 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -26,7 +31,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct mdp0_super_block { uint32_t md_magic; diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 13a0077f60..7cf3d35396 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct swap_header_v1_2 { uint8_t bootbits[1024]; diff --git a/extras/volume_id/lib/lsi_raid.c b/extras/volume_id/lib/lsi_raid.c index 30ebe7b5e6..b4495a2c52 100644 --- a/extras/volume_id/lib/lsi_raid.c +++ b/extras/volume_id/lib/lsi_raid.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct lsi_meta { uint8_t sig[6]; diff --git a/extras/volume_id/lib/luks.c b/extras/volume_id/lib/luks.c index 4fb97e3598..1c9d412767 100644 --- a/extras/volume_id/lib/luks.c +++ b/extras/volume_id/lib/luks.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005 W. Michael Petullo * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #define SECTOR_SHIFT 9 #define SECTOR_SIZE (1 << SECTOR_SHIFT) diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c index 5dc360f65d..1d62ec9331 100644 --- a/extras/volume_id/lib/lvm.c +++ b/extras/volume_id/lib/lvm.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct lvm1_super_block { uint8_t id[2]; diff --git a/extras/volume_id/lib/md5.c b/extras/volume_id/lib/md5.c index 9c4b284644..846a94963a 100644 --- a/extras/volume_id/lib/md5.c +++ b/extras/volume_id/lib/md5.c @@ -6,13 +6,21 @@ * * Copyright (c) Cryptoapi developers. * Copyright (c) 2002 James Morris - * - * 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; either version 2 of the License, or (at your option) - * any later version. * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ + #include #include #include diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c index 41bdab2fe6..5644cca43f 100644 --- a/extras/volume_id/lib/minix.c +++ b/extras/volume_id/lib/minix.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005-2007 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #define MINIX_SUPERBLOCK_OFFSET 0x400 diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c index 249dbbf20d..e6ca5da3a3 100644 --- a/extras/volume_id/lib/netware.c +++ b/extras/volume_id/lib/netware.c @@ -3,19 +3,24 @@ * * Copyright (C) 2006 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #define NW_SUPERBLOCK_OFFSET 0x1000 diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index 3d1e05798a..8154e7685a 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" static struct ntfs_super_block { uint8_t jump[3]; diff --git a/extras/volume_id/lib/nvidia_raid.c b/extras/volume_id/lib/nvidia_raid.c index 5af3724c49..cbd0d5b059 100644 --- a/extras/volume_id/lib/nvidia_raid.c +++ b/extras/volume_id/lib/nvidia_raid.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct nvidia_meta { uint8_t vendor[8]; diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c index d56a64ae5e..b0038f4ccb 100644 --- a/extras/volume_id/lib/ocfs.c +++ b/extras/volume_id/lib/ocfs.c @@ -4,19 +4,24 @@ * Copyright (C) 2004 Andre Masella * Copyright (C) 2005 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -26,8 +31,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" - struct ocfs1_super_block_header { uint32_t minor_version; diff --git a/extras/volume_id/lib/oracleasm.c b/extras/volume_id/lib/oracleasm.c index 9ea00e20cc..069bb33ff2 100644 --- a/extras/volume_id/lib/oracleasm.c +++ b/extras/volume_id/lib/oracleasm.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct oracleasm_super_block { uint8_t tag[8]; diff --git a/extras/volume_id/lib/promise_raid.c b/extras/volume_id/lib/promise_raid.c index 09aaaf9665..d4a5b04683 100644 --- a/extras/volume_id/lib/promise_raid.c +++ b/extras/volume_id/lib/promise_raid.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct promise_meta { uint8_t sig[24]; diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c index 188607b7c1..5c48c06633 100644 --- a/extras/volume_id/lib/reiserfs.c +++ b/extras/volume_id/lib/reiserfs.c @@ -4,19 +4,24 @@ * Copyright (C) 2004 Kay Sievers * Copyright (C) 2005 Tobias Klauser * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -26,7 +31,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct reiserfs_super_block { uint32_t blocks_count; diff --git a/extras/volume_id/lib/romfs.c b/extras/volume_id/lib/romfs.c index 01fbf81b79..a49d7e2aa3 100644 --- a/extras/volume_id/lib/romfs.c +++ b/extras/volume_id/lib/romfs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct romfs_super { uint8_t magic[8]; diff --git a/extras/volume_id/lib/silicon_raid.c b/extras/volume_id/lib/silicon_raid.c index a0cda375e5..abb8a1d304 100644 --- a/extras/volume_id/lib/silicon_raid.c +++ b/extras/volume_id/lib/silicon_raid.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct silicon_meta { uint8_t unknown0[0x2E]; diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index e39e1a12ee..c4d961d31e 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2006 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #define SQUASHFS_MAGIC 0x73717368 #define SQUASHFS_MAGIC_LZMA 0x71736873 diff --git a/extras/volume_id/lib/sysv.c b/extras/volume_id/lib/sysv.c index fe8efecd9b..66262df371 100644 --- a/extras/volume_id/lib/sysv.c +++ b/extras/volume_id/lib/sysv.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #define SYSV_NICINOD 100 #define SYSV_NICFREE 50 diff --git a/extras/volume_id/lib/udf.c b/extras/volume_id/lib/udf.c index b0865b2e8d..bf0833df80 100644 --- a/extras/volume_id/lib/udf.c +++ b/extras/volume_id/lib/udf.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct volume_descriptor { struct descriptor_tag { diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c index 26c3df6d14..54cc85c43c 100644 --- a/extras/volume_id/lib/ufs.c +++ b/extras/volume_id/lib/ufs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct ufs_super_block { uint32_t fs_link; diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index e71d6208c5..0fb8937962 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005-2007 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -27,7 +32,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" /* count of characters used to encode one unicode char */ static int utf8_encoded_expected_len(const char *str) diff --git a/extras/volume_id/lib/via_raid.c b/extras/volume_id/lib/via_raid.c index 7e1ac26084..e4ddd2244c 100644 --- a/extras/volume_id/lib/via_raid.c +++ b/extras/volume_id/lib/via_raid.c @@ -6,19 +6,24 @@ * Based on information taken from dmraid: * Copyright (C) 2004-2006 Heinz Mauelshagen, Red Hat GmbH * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -28,7 +33,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct via_meta { uint16_t signature; diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index ef2b663f6c..9b7d91d11d 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -3,19 +3,24 @@ * * Copyright (C) 2005-2007 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -27,7 +32,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) diff --git a/extras/volume_id/lib/vxfs.c b/extras/volume_id/lib/vxfs.c index 5d31920113..06501af262 100644 --- a/extras/volume_id/lib/vxfs.c +++ b/extras/volume_id/lib/vxfs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" #define VXFS_SUPER_MAGIC 0xa501FCF5 diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c index 5b14f449fe..98ba6572fc 100644 --- a/extras/volume_id/lib/xfs.c +++ b/extras/volume_id/lib/xfs.c @@ -3,19 +3,24 @@ * * Copyright (C) 2004 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include #include @@ -25,7 +30,6 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" -#include "util.h" struct xfs_super_block { uint8_t magic[4]; diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index d8302bc229..4b101be929 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -3,19 +3,18 @@ * * Copyright (C) 2005-2008 Kay Sievers * - * 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 02139, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #ifndef _GNU_SOURCE diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index ed42a3b231..6d91ea4dbc 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -1,19 +1,20 @@ /* - * Copyright (C) 2005-2008 Kay Sievers + * libudev - interface to udev device information * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Copyright (C) 2008 Kay Sievers * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #include "config.h" diff --git a/udev/list.h b/udev/list.h index 8626630f6b..3266e1b124 100644 --- a/udev/list.h +++ b/udev/list.h @@ -1,8 +1,5 @@ /* - * Copied from the Linux kernel source tree, version 2.6.0-test1. - * - * Licensed under the GPL v2 as per the whole kernel source tree. - * + * Based on list.h in the Linux kernel source tree. */ #ifndef _LIST_H diff --git a/udev/test-udev.c b/udev/test-udev.c index 58bc28e02a..d33fcf566d 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -1,20 +1,19 @@ /* * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include "config.h" diff --git a/udev/udev.h b/udev/udev.h index 700c8c09d8..429b79b15f 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -2,19 +2,18 @@ * Copyright (C) 2003 Greg Kroah-Hartman * Copyright (C) 2003-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #ifndef _UDEV_H_ diff --git a/udev/udev_db.c b/udev/udev_db.c index 18e111ba4b..8596470d49 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -1,23 +1,21 @@ /* * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ - #include #include #include diff --git a/udev/udev_device.c b/udev/udev_device.c index 5ae66743f6..751b7cd91f 100644 --- a/udev/udev_device.c +++ b/udev/udev_device.c @@ -1,22 +1,20 @@ /* - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ - #include #include #include diff --git a/udev/udev_device_event.c b/udev/udev_device_event.c index 6b40623390..102ea87a48 100644 --- a/udev/udev_device_event.c +++ b/udev/udev_device_event.c @@ -1,22 +1,20 @@ /* - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ - #include #include #include diff --git a/udev/udev_node.c b/udev/udev_node.c index 079bb4e3b1..5f1b5c76cd 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -1,20 +1,18 @@ /* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 6e4a6942f8..fce73e4293 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -1,20 +1,19 @@ /* * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2006 Kay Sievers + * Copyright (C) 2003-2008 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, see . */ #include diff --git a/udev/udev_rules.h b/udev/udev_rules.h index b2e5d571ce..ac7388e8a1 100644 --- a/udev/udev_rules.h +++ b/udev/udev_rules.h @@ -1,20 +1,19 @@ /* * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #ifndef UDEV_RULES_H diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 9513ac9cf3..685260f12c 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -1,20 +1,19 @@ /* * Copyright (C) 2003,2004 Greg Kroah-Hartman - * Copyright (C) 2003-2006 Kay Sievers + * Copyright (C) 2003-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include "config.h" diff --git a/udev/udev_sysdeps.c b/udev/udev_sysdeps.c index cd7d148398..73065f7674 100644 --- a/udev/udev_sysdeps.c +++ b/udev/udev_sysdeps.c @@ -1,19 +1,18 @@ /* * Copyright (C) 2005-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include diff --git a/udev/udev_sysdeps.h b/udev/udev_sysdeps.h index d0e9bfcf2b..15387dcebd 100644 --- a/udev/udev_sysdeps.h +++ b/udev/udev_sysdeps.h @@ -3,19 +3,18 @@ * * Copyright (C) 2005-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #ifndef _UDEV_SYSDEPS_H_ diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c index f0dfd7f4be..311bc6f24e 100644 --- a/udev/udev_sysfs.c +++ b/udev/udev_sysfs.c @@ -1,22 +1,20 @@ /* - * Copyright (C) 2005-2006 Kay Sievers + * Copyright (C) 2005-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ - #include #include #include diff --git a/udev/udev_utils.c b/udev/udev_utils.c index 2df8fab1f8..2cbb4d98eb 100644 --- a/udev/udev_utils.c +++ b/udev/udev_utils.c @@ -1,22 +1,20 @@ /* - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ - #include #include #include diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c index b8b4d10d21..19b0f22ba8 100644 --- a/udev/udev_utils_file.c +++ b/udev/udev_utils_file.c @@ -1,22 +1,20 @@ /* - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ - #include #include #include diff --git a/udev/udev_utils_string.c b/udev/udev_utils_string.c index 3bfe22c815..0dea6686db 100644 --- a/udev/udev_utils_string.c +++ b/udev/udev_utils_string.c @@ -1,22 +1,20 @@ /* - * Copyright (C) 2004-2005 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ - #include #include #include diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 3dc7a1b52c..12b1e45f23 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -1,19 +1,15 @@ /* - * Copyright (C) 2005-2006 Kay Sievers + * Copyright (C) 2005-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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. */ #include "config.h" diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index c2e6cdf84f..1d18f81295 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -1,19 +1,18 @@ /* - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include "config.h" diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 29f819f439..a798a81626 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -1,19 +1,18 @@ /* - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index c6093a4311..c6c95a1ddc 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -1,19 +1,18 @@ /* - * Copyright (C) 2006 Kay Sievers + * Copyright (C) 2006-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 0f7d5dbe73..994a354960 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -1,20 +1,19 @@ /* * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index fc871ccdcb..137ab5fb4c 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -1,20 +1,19 @@ /* - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * Copyright (C) 2006 Hannes Reinecke * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include diff --git a/udev/udevadm.c b/udev/udevadm.c index a4bcba603f..6de50f4253 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -1,19 +1,18 @@ /* * Copyright (C) 2007-2008 Kay Sievers * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, either version 2 of the License, or + * (at your option) any later version. * + * 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, see . */ #include "config.h" diff --git a/udev/udevd.c b/udev/udevd.c index d24d8430ca..e88b11daa0 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1,20 +1,19 @@ /* - * Copyright (C) 2004-2006 Kay Sievers + * Copyright (C) 2004-2008 Kay Sievers * Copyright (C) 2004 Chris Friesen * - * 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 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, either version 2 of the License, or + * (at your option) any later version. * - * 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., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * 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, see . */ #include "config.h" -- cgit v1.2.3-54-g00ecf From 6bd1c78a8a3d8f26f50670925934fb39f7aff56f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 10:09:34 +0200 Subject: libudev: udev_device - add more properties --- udev/lib/libudev-device.c | 41 ++++++++++++++++++++++++++++++++++++++++- udev/lib/libudev-private.h | 6 ++++++ udev/lib/libudev.c | 2 +- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 578afe7ec2..ec0aa9ae5d 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -47,7 +47,10 @@ struct udev_device { char *physdevpath; int timeout; dev_t devnum; - long long int seqnum; + unsigned long long int seqnum; + int num_fake_partitions; + int link_priority; + int ignore_remove; }; struct udev_device *device_init(struct udev *udev) @@ -487,3 +490,39 @@ int device_set_devnum(struct udev_device *udev_device, dev_t devnum) udev_device->devnum = devnum; return 0; } + +int device_get_num_fake_partitions(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return -1; + return udev_device->num_fake_partitions; +} + +int device_set_num_fake_partitions(struct udev_device *udev_device, int num) +{ + udev_device->num_fake_partitions = num; +} + +int device_get_link_priority(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return -1; + return udev_device->link_priority; +} + +int device_set_link_priority(struct udev_device *udev_device, int prio) +{ + udev_device->link_priority = prio; +} + +int device_get_ignore_remove(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return -1; + return udev_device->ignore_remove; +} + +int device_set_ignore_remove(struct udev_device *udev_device, int ignore) +{ + udev_device->ignore_remove = ignore; +} diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index bc91927bed..9c54b01027 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -70,6 +70,12 @@ extern int device_get_timeout(struct udev_device *udev_device); extern int device_set_timeout(struct udev_device *udev_device, int timeout); extern int device_set_devnum(struct udev_device *udev_device, dev_t devnum); extern int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); +extern int device_get_num_fake_partitions(struct udev_device *udev_device); +extern int device_set_num_fake_partitions(struct udev_device *udev_device, int num); +extern int device_get_link_priority(struct udev_device *udev_device); +extern int device_set_link_priority(struct udev_device *udev_device, int prio); +extern int device_get_ignore_remove(struct udev_device *udev_device); +extern int device_set_ignore_remove(struct udev_device *udev_device, int ignore); /* udev_ctrl - daemon runtime setup */ struct udev_ctrl; diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 6239377ece..50fe0d1c89 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -48,7 +48,7 @@ struct udev { int selinux_enabled; security_context_t selinux_prev_scontext; #endif - int run:1; + int run; }; void udev_log(struct udev *udev, -- cgit v1.2.3-54-g00ecf From e88a82b5976b8066583936a2521ba3c70dd460dd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 14:17:36 +0200 Subject: libudev: do not use udev_db.c --- TODO | 7 ++- udev/lib/Makefile.am | 3 - udev/lib/libudev-device.c | 141 ++++++++++++++++++++++++++++++++++----------- udev/lib/libudev-private.h | 4 +- 4 files changed, 113 insertions(+), 42 deletions(-) diff --git a/TODO b/TODO index 1dccb901f5..6c8ef8be78 100644 --- a/TODO +++ b/TODO @@ -3,9 +3,10 @@ These things would be nice to have: o rework rules to a match-action list, instead of a rules array These things will change in future udev versions: - -These things are deprecated and scheduled for removal in a future udev version: - o DEVTYPE for disks is set by the kernel, remove it from the rules + o log warning if the kernel uses CONFIG_SYSFS_DEPRECATED*=y, + which means that /sys/class/block/ does not exist + o DEVTYPE for disks is set by the kernel, they will be removed from + the default rules o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 95dd46e92f..33d0f633ab 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -32,10 +32,7 @@ libudev_la_SOURCES =\ ../udev.h \ ../udev_utils.c \ ../udev_utils_string.c \ - ../udev_utils_file.c \ ../udev_sysfs.c \ - ../udev_device.c \ - ../udev_db.c \ ../udev_sysdeps.c libudev_la_LDFLAGS = \ diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index ec0aa9ae5d..e13146599c 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -49,10 +49,105 @@ struct udev_device { dev_t devnum; unsigned long long int seqnum; int num_fake_partitions; - int link_priority; + int devlink_priority; int ignore_remove; }; +static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) +{ + size_t start; + + /* translate to location of db file */ + strlcpy(filename, udev_get_dev_path(udev), len); + start = strlcat(filename, "/.udev/db/", len); + strlcat(filename, devpath, len); + return path_encode(&filename[start], len - start); +} + +static int device_read_db(struct udev_device *udev_device) +{ + struct stat stats; + char filename[PATH_SIZE]; + char line[PATH_SIZE]; + FILE *f; + int rc = 0; + + devpath_to_db_path(udev_device->udev, udev_device->devpath, filename, sizeof(filename)); + + if (lstat(filename, &stats) != 0) { + info(udev_device->udev, "no db file to read %s: %s\n", filename, strerror(errno)); + return -1; + } + if ((stats.st_mode & S_IFMT) == S_IFLNK) { + char target[NAME_SIZE]; + int target_len; + + info(udev_device->udev, "found a symlink as db file\n"); + target_len = readlink(filename, target, sizeof(target)); + if (target_len > 0) + target[target_len] = '\0'; + else { + info(udev_device->udev, "error reading db link %s: %s\n", filename, strerror(errno)); + return -1; + } + dbg(udev_device->udev, "db link points to '%s'\n", target); + if (asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev_device->udev), target) < 0) + return -ENOMEM; + return 0; + } + + f = fopen(filename, "r"); + if (f == NULL) { + info(udev_device->udev, "error reading db file %s: %s\n", filename, strerror(errno)); + return -1; + } + while (fgets(line, sizeof(line), f)) { + ssize_t len; + const char *val; + unsigned int maj, min; + + len = strlen(line); + if (len < 4) + break; + line[len-1] = '\0'; + val = &line[2]; + + switch(line[0]) { + case 'N': + asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev_device->udev), val); + break; + case 'M': + sscanf(val, "%u:%u", &maj, &min); + device_set_devnum(udev_device, makedev(maj, min)); + break; + case 'S': + strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); + strlcat(filename, "/", sizeof(filename)); + strlcat(filename, val, sizeof(filename)); + device_add_devlink(udev_device, filename); + break; + case 'L': + device_set_devlink_priority(udev_device, atoi(val)); + break; + case 'T': + device_set_timeout(udev_device, atoi(val)); + break; + case 'A': + device_set_num_fake_partitions(udev_device, atoi(val)); + break; + case 'R': + device_set_ignore_remove(udev_device, atoi(val)); + break; + case 'E': + device_add_property(udev_device, val); + break; + } + } + fclose(f); + + return rc; +} + struct udev_device *device_init(struct udev *udev) { struct udev_device *udev_device; @@ -91,9 +186,6 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * char path[PATH_SIZE]; struct stat statbuf; struct udev_device *udev_device; - struct udevice *udevice; - struct name_entry *name_loop; - int err; if (udev == NULL) return NULL; @@ -111,38 +203,15 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * if (udev_device == NULL) return NULL; - udevice = udev_device_init(udev); - if (udevice == NULL) { - free(udev_device); - return NULL; - } - /* resolve possible symlink to real path */ strlcpy(path, devpath, sizeof(path)); sysfs_resolve_link(udev, path, sizeof(path)); - device_set_devpath(udev_device, devpath); + device_set_devpath(udev_device, path); info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); - err = udev_db_get_device(udevice, path); - if (err >= 0) + if (device_read_db(udev_device) >= 0) info(udev, "device %p filled with udev database data\n", udev_device); - if (udevice->name[0] != '\0') - asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev), udevice->name); - - list_for_each_entry(name_loop, &udevice->symlink_list, node) { - char name[PATH_SIZE]; - - strlcpy(name, udev_get_dev_path(udev), sizeof(name)); - strlcat(name, "/", sizeof(name)); - strlcat(name, name_loop->name, sizeof(name)); - name_list_add(udev, &udev_device->link_list, name, 0); - } - - list_for_each_entry(name_loop, &udevice->env_list, node) - name_list_add(udev_device->udev, &udev_device->env_list, name_loop->name, 0); - - udev_device_cleanup(udevice); return udev_device; } @@ -501,18 +570,20 @@ int device_get_num_fake_partitions(struct udev_device *udev_device) int device_set_num_fake_partitions(struct udev_device *udev_device, int num) { udev_device->num_fake_partitions = num; + return 0; } -int device_get_link_priority(struct udev_device *udev_device) +int device_get_devlink_priority(struct udev_device *udev_device) { if (udev_device == NULL) return -1; - return udev_device->link_priority; + return udev_device->devlink_priority; } -int device_set_link_priority(struct udev_device *udev_device, int prio) +int device_set_devlink_priority(struct udev_device *udev_device, int prio) { - udev_device->link_priority = prio; + udev_device->devlink_priority = prio; + return 0; } int device_get_ignore_remove(struct udev_device *udev_device) @@ -524,5 +595,7 @@ int device_get_ignore_remove(struct udev_device *udev_device) int device_set_ignore_remove(struct udev_device *udev_device, int ignore) { - udev_device->ignore_remove = ignore; + udev_device->ignore_remove = ignore; + return 0; } + diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 9c54b01027..daa869ba42 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -72,8 +72,8 @@ extern int device_set_devnum(struct udev_device *udev_device, dev_t devnum); extern int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); extern int device_get_num_fake_partitions(struct udev_device *udev_device); extern int device_set_num_fake_partitions(struct udev_device *udev_device, int num); -extern int device_get_link_priority(struct udev_device *udev_device); -extern int device_set_link_priority(struct udev_device *udev_device, int prio); +extern int device_get_devlink_priority(struct udev_device *udev_device); +extern int device_set_devlink_priority(struct udev_device *udev_device, int prio); extern int device_get_ignore_remove(struct udev_device *udev_device); extern int device_set_ignore_remove(struct udev_device *udev_device, int ignore); -- cgit v1.2.3-54-g00ecf From b21b95d7222f32940c8e9462c361e45041c9f7d6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 14:29:07 +0200 Subject: libudev: get rid of udev_sysfs.c --- extras/ata_id/Makefile.am | 1 - extras/cdrom_id/Makefile.am | 1 - extras/edd_id/Makefile.am | 1 - extras/floppy/Makefile.am | 4 +--- extras/fstab_import/Makefile.am | 1 - extras/scsi_id/Makefile.am | 1 - extras/usb_id/Makefile.am | 2 +- extras/volume_id/Makefile.am | 1 - udev/lib/Makefile.am | 1 - udev/lib/libudev-device.c | 2 +- udev/lib/libudev-enumerate.c | 2 +- udev/lib/libudev-private.h | 1 + udev/lib/libudev-utils.c | 31 +++++++++++++++++++++++++++++++ udev/lib/libudev.c | 5 ----- 14 files changed, 36 insertions(+), 18 deletions(-) diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index db5f87f8c3..f74964875b 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -12,7 +12,6 @@ ata_id_SOURCES = \ ata_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index 0514a2ea51..9a39ee503a 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -15,7 +15,6 @@ cdrom_id_SOURCES = \ cdrom_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 22af7e9528..575de8514d 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -15,7 +15,6 @@ edd_id_SOURCES = \ edd_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index a5e9c10800..44e9b2fbc0 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -11,11 +11,9 @@ create_floppy_devices_SOURCES = \ create_floppy_devices.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ - ../../udev/udev_utils_string.c \ - ../../udev/udev_utils_file.c + ../../udev/udev_utils_string.c if USE_SELINUX create_floppy_devices_LDADD = \ diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index c4fbdce248..92be9a439b 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -15,7 +15,6 @@ fstab_import_SOURCES = \ fstab_import.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index f42563f498..ffa9bf3143 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -15,7 +15,6 @@ scsi_id_SOURCES = \ bsg.h \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index aa1c4f82b6..9eb6f16b57 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -11,8 +11,8 @@ usb_id_SOURCES = \ usb_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ + ../../udev/udev_sysfs.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index 9fb2cba646..8560763415 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -14,7 +14,6 @@ vol_id_SOURCES = \ vol_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/udev_sysfs.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 33d0f633ab..a768daa817 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -32,7 +32,6 @@ libudev_la_SOURCES =\ ../udev.h \ ../udev_utils.c \ ../udev_utils_string.c \ - ../udev_sysfs.c \ ../udev_sysdeps.c libudev_la_LDFLAGS = \ diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index e13146599c..416cae450d 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -205,7 +205,7 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * /* resolve possible symlink to real path */ strlcpy(path, devpath, sizeof(path)); - sysfs_resolve_link(udev, path, sizeof(path)); + util_resolve_sys_link(udev, path, sizeof(path)); device_set_devpath(udev_device, path); info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 1ba4de8948..f36eafaff6 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -58,7 +58,7 @@ static int devices_scan_subsystem(struct udev *udev, strlcpy(devpath, &path[len], sizeof(devpath)); strlcat(devpath, "/", sizeof(devpath)); strlcat(devpath, dent->d_name, sizeof(devpath)); - sysfs_resolve_link(udev, devpath, sizeof(devpath)); + util_resolve_sys_link(udev, devpath, sizeof(devpath)); name_list_add(udev, device_list, devpath, 1); } closedir(dir); diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index daa869ba42..1579df6d6e 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -106,4 +106,5 @@ extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); /* libudev-utils */ extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); extern ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size); +extern int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size); #endif diff --git a/udev/lib/libudev-utils.c b/udev/lib/libudev-utils.c index 82acb1a481..e5f1ed7c38 100644 --- a/udev/lib/libudev-utils.c +++ b/udev/lib/libudev-utils.c @@ -63,3 +63,34 @@ ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver return get_sys_link(udev, "driver", devpath, driver, size); } +int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size) +{ + char link_path[PATH_SIZE]; + char link_target[PATH_SIZE]; + int len; + int i; + int back; + + strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); + strlcat(link_path, devpath, sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len <= 0) + return -1; + link_target[len] = '\0'; + dbg(udev, "path link '%s' points to '%s'\n", devpath, link_target); + + for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) + ; + dbg(udev, "base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); + for (i = 0; i <= back; i++) { + char *pos = strrchr(devpath, '/'); + + if (pos == NULL) + return -1; + pos[0] = '\0'; + } + dbg(udev, "after moving back '%s'\n", devpath); + strlcat(devpath, "/", size); + strlcat(devpath, &link_target[back * 3], size); + return 0; +} diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 50fe0d1c89..3bcafcd9a6 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -295,10 +295,7 @@ struct udev *udev_new(void) if (udev->dev_path == NULL || udev->sys_path == NULL) goto err; - selinux_init(udev); - sysfs_init(); - info(udev, "context %p created\n", udev); info(udev, "log_priority=%d\n", udev->log_priority); info(udev, "config_file='%s'\n", config_file); @@ -306,7 +303,6 @@ struct udev *udev_new(void) info(udev, "sys_path='%s'\n", udev->sys_path); if (udev->rules_path != NULL) info(udev, "rules_path='%s'\n", udev->rules_path); - free(config_file); return udev; err: @@ -347,7 +343,6 @@ void udev_unref(struct udev *udev) udev->refcount--; if (udev->refcount > 0) return; - sysfs_cleanup(); selinux_exit(udev); free(udev->dev_path); free(udev->sys_path); -- cgit v1.2.3-54-g00ecf From 7a01f11afbcc0a639cc3676572a41445f7edb65d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 17:08:24 +0200 Subject: libudev: get rid of udev_utils.c --- extras/ata_id/Makefile.am | 1 + extras/cdrom_id/Makefile.am | 1 + extras/edd_id/Makefile.am | 1 + extras/floppy/Makefile.am | 1 + extras/fstab_import/Makefile.am | 1 + extras/scsi_id/Makefile.am | 1 + extras/usb_id/Makefile.am | 1 + extras/volume_id/Makefile.am | 1 + udev/lib/Makefile.am | 2 - udev/lib/libudev-device.c | 10 ++-- udev/lib/libudev-enumerate.c | 2 +- udev/lib/libudev-private.h | 7 +++ udev/lib/libudev-utils.c | 118 ++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev.c | 16 +++--- 14 files changed, 147 insertions(+), 16 deletions(-) diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index f74964875b..61c02fb9f5 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -12,6 +12,7 @@ ata_id_SOURCES = \ ata_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-utils.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index 9a39ee503a..f0916ba557 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -15,6 +15,7 @@ cdrom_id_SOURCES = \ cdrom_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-utils.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 575de8514d..d5dedda7d9 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -15,6 +15,7 @@ edd_id_SOURCES = \ edd_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-utils.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 44e9b2fbc0..de3876ee51 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -11,6 +11,7 @@ create_floppy_devices_SOURCES = \ create_floppy_devices.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-utils.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index 92be9a439b..07aadafd26 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -15,6 +15,7 @@ fstab_import_SOURCES = \ fstab_import.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-utils.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index ffa9bf3143..61813fb65c 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -15,6 +15,7 @@ scsi_id_SOURCES = \ bsg.h \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-utils.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index 9eb6f16b57..d69cfe43a1 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -11,6 +11,7 @@ usb_id_SOURCES = \ usb_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-utils.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_sysfs.c \ ../../udev/udev_utils.c \ diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index 8560763415..b4e76180ae 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -14,6 +14,7 @@ vol_id_SOURCES = \ vol_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-utils.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index a768daa817..b33addfbf7 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -30,8 +30,6 @@ libudev_la_SOURCES =\ libudev-monitor.c \ ../list.h \ ../udev.h \ - ../udev_utils.c \ - ../udev_utils_string.c \ ../udev_sysdeps.c libudev_la_LDFLAGS = \ diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 416cae450d..78b644b01d 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -61,7 +61,7 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f strlcpy(filename, udev_get_dev_path(udev), len); start = strlcat(filename, "/.udev/db/", len); strlcat(filename, devpath, len); - return path_encode(&filename[start], len - start); + return util_path_encode(&filename[start], len - start); } static int device_read_db(struct udev_device *udev_device) @@ -264,8 +264,8 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->syspath); free(udev_device->devname); free(udev_device->subsystem); - name_list_cleanup(udev_device->udev, &udev_device->link_list); - name_list_cleanup(udev_device->udev, &udev_device->env_list); + util_name_list_cleanup(udev_device->udev, &udev_device->link_list); + util_name_list_cleanup(udev_device->udev, &udev_device->env_list); free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); @@ -477,14 +477,14 @@ int device_set_devname(struct udev_device *udev_device, const char *devname) int device_add_devlink(struct udev_device *udev_device, const char *devlink) { - if (name_list_add(udev_device->udev, &udev_device->link_list, devlink, 0) == NULL) + if (util_name_list_add(udev_device->udev, &udev_device->link_list, devlink, 0) == NULL) return -ENOMEM; return 0; } int device_add_property(struct udev_device *udev_device, const char *property) { - if (name_list_add(udev_device->udev, &udev_device->env_list, property, 0) == NULL) + if (util_name_list_add(udev_device->udev, &udev_device->env_list, property, 0) == NULL) return -ENOMEM; return 0; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index f36eafaff6..72b97cebd7 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -59,7 +59,7 @@ static int devices_scan_subsystem(struct udev *udev, strlcat(devpath, "/", sizeof(devpath)); strlcat(devpath, dent->d_name, sizeof(devpath)); util_resolve_sys_link(udev, devpath, sizeof(devpath)); - name_list_add(udev, device_list, devpath, 1); + util_name_list_add(udev, device_list, devpath, 1); } closedir(dir); return 0; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 1579df6d6e..a715067ebb 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -107,4 +107,11 @@ extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); extern ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size); extern int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size); +extern struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, + const char *name, int sort); +extern void util_name_list_cleanup(struct udev *udev, struct list_head *name_list); +extern int util_log_priority(const char *priority); +extern size_t util_path_encode(char *s, size_t len); +extern size_t util_path_decode(char *s); +extern void util_remove_trailing_chars(char *path, char c); #endif diff --git a/udev/lib/libudev-utils.c b/udev/lib/libudev-utils.c index e5f1ed7c38..dfd5f3c3fb 100644 --- a/udev/lib/libudev-utils.c +++ b/udev/lib/libudev-utils.c @@ -94,3 +94,121 @@ int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size) strlcat(devpath, &link_target[back * 3], size); return 0; } + +struct util_name_entry { + struct list_head node; + char *name; + int *i; +}; + +struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, + const char *name, int sort) +{ + struct util_name_entry *name_loop; + struct util_name_entry *name_new; + + /* avoid duplicate entries */ + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) == 0) { + dbg(udev, "'%s' is already in the list\n", name); + return name_loop; + } + } + + if (sort) { + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) > 0) + break; + } + } + + name_new->name = strdup(name); + if (name_new->name == NULL) + return NULL; + dbg(udev, "adding '%s'\n", name_new->name); + list_add_tail(&name_new->node, &name_loop->node); + return name_new; +} + +void util_name_list_cleanup(struct udev *udev, struct list_head *name_list) +{ + struct util_name_entry *name_loop; + struct util_name_entry *name_tmp; + + list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { + list_del(&name_loop->node); + free(name_loop->name); + free(name_loop); + } +} + +int util_log_priority(const char *priority) +{ + char *endptr; + int prio; + + prio = strtol(priority, &endptr, 10); + if (endptr[0] == '\0') + return prio; + if (strncasecmp(priority, "err", 3) == 0) + return LOG_ERR; + if (strcasecmp(priority, "info") == 0) + return LOG_INFO; + if (strcasecmp(priority, "debug") == 0) + return LOG_DEBUG; + return 0; +} + +size_t util_path_encode(char *s, size_t len) +{ + char t[(len * 3)+1]; + size_t i, j; + + t[0] = '\0'; + for (i = 0, j = 0; s[i] != '\0'; i++) { + if (s[i] == '/') { + memcpy(&t[j], "\\x2f", 4); + j += 4; + } else if (s[i] == '\\') { + memcpy(&t[j], "\\x5c", 4); + j += 4; + } else { + t[j] = s[i]; + j++; + } + } + t[j] = '\0'; + strncpy(s, t, len); + return j; +} + +size_t util_path_decode(char *s) +{ + size_t i, j; + + for (i = 0, j = 0; s[i] != '\0'; j++) { + if (memcmp(&s[i], "\\x2f", 4) == 0) { + s[j] = '/'; + i += 4; + }else if (memcmp(&s[i], "\\x5c", 4) == 0) { + s[j] = '\\'; + i += 4; + } else { + s[j] = s[i]; + i++; + } + } + s[j] = '\0'; + return j; +} + +void util_remove_trailing_chars(char *path, char c) +{ + size_t len; + + if (path == NULL) + return; + len = strlen(path); + while (len > 0 && path[len-1] == c) + path[--len] = '\0'; +} diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 3bcafcd9a6..d1dd9e4838 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -184,18 +184,18 @@ struct udev *udev_new(void) if (env != NULL) { free(udev->sys_path); udev->sys_path = strdup(env); - remove_trailing_chars(udev->sys_path, '/'); + util_remove_trailing_chars(udev->sys_path, '/'); } env = getenv("UDEV_RUN"); - if (env != NULL && !string_is_true(env)) + if (env != NULL && strcmp(env, "0") == 0) udev->run = 0; env = getenv("UDEV_CONFIG_FILE"); if (env != NULL) { free(config_file); config_file = strdup(env); - remove_trailing_chars(config_file, '/'); + util_remove_trailing_chars(config_file, '/'); } if (config_file == NULL) goto err; @@ -263,19 +263,19 @@ struct udev *udev_new(void) } if (strcasecmp(key, "udev_log") == 0) { - udev->log_priority = log_priority(val); + udev->log_priority = util_log_priority(val); continue; } if (strcasecmp(key, "udev_root") == 0) { free(udev->dev_path); udev->dev_path = strdup(val); - remove_trailing_chars(udev->dev_path, '/'); + util_remove_trailing_chars(udev->dev_path, '/'); continue; } if (strcasecmp(key, "udev_rules") == 0) { free(udev->rules_path); udev->rules_path = strdup(val); - remove_trailing_chars(udev->rules_path, '/'); + util_remove_trailing_chars(udev->rules_path, '/'); continue; } } @@ -286,12 +286,12 @@ struct udev *udev_new(void) if (env != NULL) { free(udev->dev_path); udev->dev_path = strdup(env); - remove_trailing_chars(udev->dev_path, '/'); + util_remove_trailing_chars(udev->dev_path, '/'); } env = getenv("UDEV_LOG"); if (env != NULL) - udev->log_priority = log_priority(env); + udev->log_priority = util_log_priority(env); if (udev->dev_path == NULL || udev->sys_path == NULL) goto err; -- cgit v1.2.3-54-g00ecf From b2946df41965632c80012921a2cacbf83bc3dd80 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 17:12:33 +0200 Subject: libudev: rename libudev-utils.c libudev-util.c --- extras/ata_id/Makefile.am | 2 +- extras/cdrom_id/Makefile.am | 2 +- extras/edd_id/Makefile.am | 2 +- extras/floppy/Makefile.am | 2 +- extras/fstab_import/Makefile.am | 2 +- extras/scsi_id/Makefile.am | 2 +- extras/usb_id/Makefile.am | 2 +- extras/volume_id/Makefile.am | 2 +- udev/Makefile.am | 2 +- udev/lib/Makefile.am | 2 +- udev/lib/libudev-util.c | 214 ++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev-utils.c | 214 ---------------------------------------- 12 files changed, 224 insertions(+), 224 deletions(-) create mode 100644 udev/lib/libudev-util.c delete mode 100644 udev/lib/libudev-utils.c diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index 61c02fb9f5..bc3b7001a4 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -12,7 +12,7 @@ ata_id_SOURCES = \ ata_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-utils.c \ + ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index f0916ba557..595d710965 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -15,7 +15,7 @@ cdrom_id_SOURCES = \ cdrom_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-utils.c \ + ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index d5dedda7d9..e494c1e672 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -15,7 +15,7 @@ edd_id_SOURCES = \ edd_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-utils.c \ + ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index de3876ee51..92877a7778 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -11,7 +11,7 @@ create_floppy_devices_SOURCES = \ create_floppy_devices.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-utils.c \ + ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index 07aadafd26..7b99471fa2 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -15,7 +15,7 @@ fstab_import_SOURCES = \ fstab_import.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-utils.c \ + ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index 61813fb65c..62e14e5adb 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -15,7 +15,7 @@ scsi_id_SOURCES = \ bsg.h \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-utils.c \ + ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index d69cfe43a1..07692df3a2 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -11,7 +11,7 @@ usb_id_SOURCES = \ usb_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-utils.c \ + ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_sysfs.c \ ../../udev/udev_utils.c \ diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index b4e76180ae..75f3e984d6 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -14,7 +14,7 @@ vol_id_SOURCES = \ vol_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-utils.c \ + ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c \ ../../udev/udev_utils_string.c diff --git a/udev/Makefile.am b/udev/Makefile.am index 7984e5d5f9..47b4237efc 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -37,7 +37,7 @@ common_files = \ lib/libudev.c \ lib/libudev-device.c \ lib/libudev-monitor.c \ - lib/libudev-utils.c \ + lib/libudev-util.c \ lib/libudev-ctrl.c if USE_SELINUX diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index b33addfbf7..5d6438eb8e 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -23,7 +23,7 @@ libudev_la_SOURCES =\ exported_symbools \ libudev-private.h \ libudev.c \ - libudev-utils.c \ + libudev-util.c \ libudev-device.c \ libudev-enumerate.c \ libudev-ctrl.c \ diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c new file mode 100644 index 0000000000..dfd5f3c3fb --- /dev/null +++ b/udev/lib/libudev-util.c @@ -0,0 +1,214 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "../udev.h" + +static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *devpath, char *subsystem, size_t size) +{ + char path[PATH_SIZE]; + ssize_t len; + const char *pos; + + strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + strlcat(path, devpath, sizeof(path)); + strlcat(path, "/", sizeof(path)); + strlcat(path, slink, sizeof(path)); + len = readlink(path, path, sizeof(path)); + if (len < 0 || len >= (ssize_t) sizeof(path)) + return -1; + path[len] = '\0'; + pos = strrchr(path, '/'); + if (pos == NULL) + return -1; + pos = &pos[1]; + return strlcpy(subsystem, pos, size); +} + +ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size) +{ + return get_sys_link(udev, "subsystem", devpath, subsystem, size); +} + +ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size) +{ + return get_sys_link(udev, "driver", devpath, driver, size); +} + +int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size) +{ + char link_path[PATH_SIZE]; + char link_target[PATH_SIZE]; + int len; + int i; + int back; + + strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); + strlcat(link_path, devpath, sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len <= 0) + return -1; + link_target[len] = '\0'; + dbg(udev, "path link '%s' points to '%s'\n", devpath, link_target); + + for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) + ; + dbg(udev, "base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); + for (i = 0; i <= back; i++) { + char *pos = strrchr(devpath, '/'); + + if (pos == NULL) + return -1; + pos[0] = '\0'; + } + dbg(udev, "after moving back '%s'\n", devpath); + strlcat(devpath, "/", size); + strlcat(devpath, &link_target[back * 3], size); + return 0; +} + +struct util_name_entry { + struct list_head node; + char *name; + int *i; +}; + +struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, + const char *name, int sort) +{ + struct util_name_entry *name_loop; + struct util_name_entry *name_new; + + /* avoid duplicate entries */ + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) == 0) { + dbg(udev, "'%s' is already in the list\n", name); + return name_loop; + } + } + + if (sort) { + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) > 0) + break; + } + } + + name_new->name = strdup(name); + if (name_new->name == NULL) + return NULL; + dbg(udev, "adding '%s'\n", name_new->name); + list_add_tail(&name_new->node, &name_loop->node); + return name_new; +} + +void util_name_list_cleanup(struct udev *udev, struct list_head *name_list) +{ + struct util_name_entry *name_loop; + struct util_name_entry *name_tmp; + + list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { + list_del(&name_loop->node); + free(name_loop->name); + free(name_loop); + } +} + +int util_log_priority(const char *priority) +{ + char *endptr; + int prio; + + prio = strtol(priority, &endptr, 10); + if (endptr[0] == '\0') + return prio; + if (strncasecmp(priority, "err", 3) == 0) + return LOG_ERR; + if (strcasecmp(priority, "info") == 0) + return LOG_INFO; + if (strcasecmp(priority, "debug") == 0) + return LOG_DEBUG; + return 0; +} + +size_t util_path_encode(char *s, size_t len) +{ + char t[(len * 3)+1]; + size_t i, j; + + t[0] = '\0'; + for (i = 0, j = 0; s[i] != '\0'; i++) { + if (s[i] == '/') { + memcpy(&t[j], "\\x2f", 4); + j += 4; + } else if (s[i] == '\\') { + memcpy(&t[j], "\\x5c", 4); + j += 4; + } else { + t[j] = s[i]; + j++; + } + } + t[j] = '\0'; + strncpy(s, t, len); + return j; +} + +size_t util_path_decode(char *s) +{ + size_t i, j; + + for (i = 0, j = 0; s[i] != '\0'; j++) { + if (memcmp(&s[i], "\\x2f", 4) == 0) { + s[j] = '/'; + i += 4; + }else if (memcmp(&s[i], "\\x5c", 4) == 0) { + s[j] = '\\'; + i += 4; + } else { + s[j] = s[i]; + i++; + } + } + s[j] = '\0'; + return j; +} + +void util_remove_trailing_chars(char *path, char c) +{ + size_t len; + + if (path == NULL) + return; + len = strlen(path); + while (len > 0 && path[len-1] == c) + path[--len] = '\0'; +} diff --git a/udev/lib/libudev-utils.c b/udev/lib/libudev-utils.c deleted file mode 100644 index dfd5f3c3fb..0000000000 --- a/udev/lib/libudev-utils.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" -#include "../udev.h" - -static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *devpath, char *subsystem, size_t size) -{ - char path[PATH_SIZE]; - ssize_t len; - const char *pos; - - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, slink, sizeof(path)); - len = readlink(path, path, sizeof(path)); - if (len < 0 || len >= (ssize_t) sizeof(path)) - return -1; - path[len] = '\0'; - pos = strrchr(path, '/'); - if (pos == NULL) - return -1; - pos = &pos[1]; - return strlcpy(subsystem, pos, size); -} - -ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size) -{ - return get_sys_link(udev, "subsystem", devpath, subsystem, size); -} - -ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size) -{ - return get_sys_link(udev, "driver", devpath, driver, size); -} - -int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size) -{ - char link_path[PATH_SIZE]; - char link_target[PATH_SIZE]; - int len; - int i; - int back; - - strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - strlcat(link_path, devpath, sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len <= 0) - return -1; - link_target[len] = '\0'; - dbg(udev, "path link '%s' points to '%s'\n", devpath, link_target); - - for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) - ; - dbg(udev, "base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); - for (i = 0; i <= back; i++) { - char *pos = strrchr(devpath, '/'); - - if (pos == NULL) - return -1; - pos[0] = '\0'; - } - dbg(udev, "after moving back '%s'\n", devpath); - strlcat(devpath, "/", size); - strlcat(devpath, &link_target[back * 3], size); - return 0; -} - -struct util_name_entry { - struct list_head node; - char *name; - int *i; -}; - -struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, - const char *name, int sort) -{ - struct util_name_entry *name_loop; - struct util_name_entry *name_new; - - /* avoid duplicate entries */ - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) == 0) { - dbg(udev, "'%s' is already in the list\n", name); - return name_loop; - } - } - - if (sort) { - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) > 0) - break; - } - } - - name_new->name = strdup(name); - if (name_new->name == NULL) - return NULL; - dbg(udev, "adding '%s'\n", name_new->name); - list_add_tail(&name_new->node, &name_loop->node); - return name_new; -} - -void util_name_list_cleanup(struct udev *udev, struct list_head *name_list) -{ - struct util_name_entry *name_loop; - struct util_name_entry *name_tmp; - - list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { - list_del(&name_loop->node); - free(name_loop->name); - free(name_loop); - } -} - -int util_log_priority(const char *priority) -{ - char *endptr; - int prio; - - prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0') - return prio; - if (strncasecmp(priority, "err", 3) == 0) - return LOG_ERR; - if (strcasecmp(priority, "info") == 0) - return LOG_INFO; - if (strcasecmp(priority, "debug") == 0) - return LOG_DEBUG; - return 0; -} - -size_t util_path_encode(char *s, size_t len) -{ - char t[(len * 3)+1]; - size_t i, j; - - t[0] = '\0'; - for (i = 0, j = 0; s[i] != '\0'; i++) { - if (s[i] == '/') { - memcpy(&t[j], "\\x2f", 4); - j += 4; - } else if (s[i] == '\\') { - memcpy(&t[j], "\\x5c", 4); - j += 4; - } else { - t[j] = s[i]; - j++; - } - } - t[j] = '\0'; - strncpy(s, t, len); - return j; -} - -size_t util_path_decode(char *s) -{ - size_t i, j; - - for (i = 0, j = 0; s[i] != '\0'; j++) { - if (memcmp(&s[i], "\\x2f", 4) == 0) { - s[j] = '/'; - i += 4; - }else if (memcmp(&s[i], "\\x5c", 4) == 0) { - s[j] = '\\'; - i += 4; - } else { - s[j] = s[i]; - i++; - } - } - s[j] = '\0'; - return j; -} - -void util_remove_trailing_chars(char *path, char c) -{ - size_t len; - - if (path == NULL) - return; - len = strlen(path); - while (len > 0 && path[len-1] == c) - path[--len] = '\0'; -} -- cgit v1.2.3-54-g00ecf From 3eb46ec6ddeb31d9886ebb736d1d7b3534d2f354 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 18:00:31 +0200 Subject: libudev: do not use any udev source file --- extras/collect/collect.c | 2 +- udev/Makefile.am | 3 +- udev/lib/Makefile.am | 4 +- udev/lib/libudev-ctrl.c | 3 +- udev/lib/libudev-device.c | 40 +++--- udev/lib/libudev-enumerate.c | 41 ++++--- udev/lib/libudev-monitor.c | 1 - udev/lib/libudev-private.h | 11 +- udev/lib/libudev-util.c | 83 ++++++++++--- udev/lib/libudev.c | 3 +- udev/list.h | 286 ------------------------------------------- udev/udev.h | 2 +- udev/udev_rules.h | 1 - 13 files changed, 119 insertions(+), 361 deletions(-) delete mode 100644 udev/list.h diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 14184a5e05..8c141d2a5a 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -31,7 +31,7 @@ #include #include -#include "../../udev/list.h" +#include "../../udev/lib/list.h" #define TMPFILE UDEV_PREFIX "/dev/.udev/collect" #define BUFSIZE 16 diff --git a/udev/Makefile.am b/udev/Makefile.am index 47b4237efc..df03708421 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -16,8 +16,6 @@ AM_CPPFLAGS = \ common_ldadd = common_files = \ - list.h \ - logging.h \ udev.h \ udev_rules.h \ udev_sysdeps.h \ @@ -32,6 +30,7 @@ common_files = \ udev_utils.c \ udev_utils_file.c \ udev_utils_string.c \ + lib/list.h \ lib/libudev.h \ lib/libudev-private.h \ lib/libudev.c \ diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 5d6438eb8e..000b3f73ca 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -28,9 +28,7 @@ libudev_la_SOURCES =\ libudev-enumerate.c \ libudev-ctrl.c \ libudev-monitor.c \ - ../list.h \ - ../udev.h \ - ../udev_sysdeps.c + list.h libudev_la_LDFLAGS = \ -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index 6d91ea4dbc..e42f631571 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -29,7 +29,6 @@ #include #include -#include "../udev.h" #include "libudev.h" #include "libudev-private.h" @@ -155,7 +154,7 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int ctrl_msg.type = type; if (buf != NULL) - strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); + util_strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); else ctrl_msg.intval = intval; diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 78b644b01d..a182750e61 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -30,7 +30,6 @@ #include "libudev.h" #include "libudev-private.h" -#include "../udev.h" struct udev_device { int refcount; @@ -58,17 +57,17 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f size_t start; /* translate to location of db file */ - strlcpy(filename, udev_get_dev_path(udev), len); - start = strlcat(filename, "/.udev/db/", len); - strlcat(filename, devpath, len); + util_strlcpy(filename, udev_get_dev_path(udev), len); + start = util_strlcat(filename, "/.udev/db/", len); + util_strlcat(filename, devpath, len); return util_path_encode(&filename[start], len - start); } static int device_read_db(struct udev_device *udev_device) { struct stat stats; - char filename[PATH_SIZE]; - char line[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char line[UTIL_LINE_SIZE]; FILE *f; int rc = 0; @@ -79,7 +78,7 @@ static int device_read_db(struct udev_device *udev_device) return -1; } if ((stats.st_mode & S_IFMT) == S_IFLNK) { - char target[NAME_SIZE]; + char target[UTIL_PATH_SIZE]; int target_len; info(udev_device->udev, "found a symlink as db file\n"); @@ -121,9 +120,9 @@ static int device_read_db(struct udev_device *udev_device) device_set_devnum(udev_device, makedev(maj, min)); break; case 'S': - strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, val, sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, val, sizeof(filename)); device_add_devlink(udev_device, filename); break; case 'L': @@ -183,7 +182,7 @@ struct udev_device *device_init(struct udev *udev) **/ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath) { - char path[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; struct stat statbuf; struct udev_device *udev_device; @@ -192,8 +191,8 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * if (devpath == NULL) return NULL; - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, devpath, sizeof(path)); if (stat(path, &statbuf) != 0) return NULL; if (!S_ISDIR(statbuf.st_mode)) @@ -204,7 +203,7 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * return NULL; /* resolve possible symlink to real path */ - strlcpy(path, devpath, sizeof(path)); + util_strlcpy(path, devpath, sizeof(path)); util_resolve_sys_link(udev, path, sizeof(path)); device_set_devpath(udev_device, path); info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); @@ -333,7 +332,7 @@ const char *udev_device_get_devname(struct udev_device *udev_device) **/ const char *udev_device_get_subsystem(struct udev_device *udev_device) { - char subsystem[NAME_SIZE]; + char subsystem[UTIL_PATH_SIZE]; if (udev_device == NULL) return NULL; @@ -363,7 +362,7 @@ int udev_device_get_devlinks(struct udev_device *udev_device, int (*cb)(struct udev_device *udev_device, const char *value, void *data), void *data) { - struct name_entry *name_loop; + struct util_name_entry *name_loop; int count = 0; if (udev_device == NULL) @@ -393,17 +392,16 @@ int udev_device_get_properties(struct udev_device *udev_device, int (*cb)(struct udev_device *udev_device, const char *key, const char *value, void *data), void *data) { - struct name_entry *name_loop; + struct util_name_entry *name_loop; int count = 0; if (udev_device == NULL) return -1; list_for_each_entry(name_loop, &udev_device->env_list, node) { - char name[PATH_SIZE]; + char name[UTIL_PATH_SIZE]; char *val; - strncpy(name, name_loop->name, PATH_SIZE); - name[PATH_SIZE-1] = '\0'; + strncpy(name, name_loop->name, sizeof(name)); val = strchr(name, '='); if (val == NULL) continue; @@ -418,7 +416,7 @@ int udev_device_get_properties(struct udev_device *udev_device, const char *udev_device_get_driver(struct udev_device *udev_device) { - char driver[NAME_SIZE]; + char driver[UTIL_PATH_SIZE]; if (udev_device == NULL) return NULL; diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 72b97cebd7..9bd9101052 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -30,34 +30,33 @@ #include "libudev.h" #include "libudev-private.h" -#include "../udev.h" static int devices_scan_subsystem(struct udev *udev, const char *basedir, const char *subsystem, const char *subdir, struct list_head *device_list) { - char path[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; size_t len; - len = strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, basedir, sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, subsystem, sizeof(path)); + len = util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, basedir, sizeof(path)); + util_strlcat(path, "/", sizeof(path)); + util_strlcat(path, subsystem, sizeof(path)); if (subdir != NULL) - strlcat(path, subdir, sizeof(path)); + util_strlcat(path, subdir, sizeof(path)); dir = opendir(path); if (dir == NULL) return -1; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char devpath[PATH_SIZE]; + char devpath[UTIL_PATH_SIZE]; if (dent->d_name[0] == '.') continue; - strlcpy(devpath, &path[len], sizeof(devpath)); - strlcat(devpath, "/", sizeof(devpath)); - strlcat(devpath, dent->d_name, sizeof(devpath)); + util_strlcpy(devpath, &path[len], sizeof(devpath)); + util_strlcat(devpath, "/", sizeof(devpath)); + util_strlcat(devpath, dent->d_name, sizeof(devpath)); util_resolve_sys_link(udev, devpath, sizeof(devpath)); util_name_list_add(udev, device_list, devpath, 1); } @@ -69,15 +68,15 @@ static int devices_scan_subsystems(struct udev *udev, const char *basedir, const char *subsystem, const char *subdir, struct list_head *device_list) { - char path[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; if (subsystem != NULL) return devices_scan_subsystem(udev, basedir, subsystem, subdir, device_list); - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, basedir, sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, basedir, sizeof(path)); dir = opendir(path); if (dir == NULL) return -1; @@ -115,7 +114,7 @@ static int devices_call(struct udev *udev, const char *devpath, void *data, int *cb_rc) { - char subsystem[NAME_SIZE]; + char subsystem[UTIL_PATH_SIZE]; const char *name; name = strrchr(devpath, '/'); @@ -147,19 +146,19 @@ int udev_enumerate_devices(struct udev *udev, const char *subsystem, const char *devpath, const char *subsystem, const char *name, void *data), void *data) { - char base[PATH_SIZE]; + char base[UTIL_PATH_SIZE]; struct stat statbuf; struct list_head device_list; - struct name_entry *loop_device; - struct name_entry *tmp_device; + struct util_name_entry *loop_device; + struct util_name_entry *tmp_device; int cb_rc = 0; int count = 0; INIT_LIST_HEAD(&device_list); /* if we have /sys/subsystem/, forget all the old stuff */ - strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - strlcat(base, "/subsystem", sizeof(base)); + util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); + util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { devices_scan_subsystems(udev, "/subsystem", subsystem, "/devices", &device_list); } else { @@ -174,6 +173,7 @@ int udev_enumerate_devices(struct udev *udev, const char *subsystem, if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) count++; list_del(&loop_device->node); + free(loop_device->name); free(loop_device); } @@ -183,6 +183,7 @@ int udev_enumerate_devices(struct udev *udev, const char *subsystem, if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) count++; list_del(&loop_device->node); + free(loop_device->name); free(loop_device); } diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 3e1731e382..60f7bc29e5 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -33,7 +33,6 @@ #include "libudev.h" #include "libudev-private.h" -#include "../udev.h" struct udev_monitor { struct udev *udev; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index a715067ebb..32837e368d 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -24,7 +24,7 @@ #include #include "libudev.h" -#include "../udev.h" +#include "list.h" #ifdef USE_LOG #ifdef USE_DEBUG @@ -104,6 +104,13 @@ extern const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); /* libudev-utils */ +#define UTIL_PATH_SIZE 1024 +#define UTIL_LINE_SIZE 1024 +struct util_name_entry { + struct list_head node; + char *name; + int *i; +}; extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); extern ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size); extern int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size); @@ -114,4 +121,6 @@ extern int util_log_priority(const char *priority); extern size_t util_path_encode(char *s, size_t len); extern size_t util_path_decode(char *s); extern void util_remove_trailing_chars(char *path, char c); +extern size_t util_strlcpy(char *dst, const char *src, size_t size); +extern size_t util_strlcat(char *dst, const char *src, size_t size); #endif diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index dfd5f3c3fb..ae0adf4b88 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -30,18 +30,17 @@ #include "libudev.h" #include "libudev-private.h" -#include "../udev.h" static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *devpath, char *subsystem, size_t size) { - char path[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; ssize_t len; const char *pos; - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, slink, sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, devpath, sizeof(path)); + util_strlcat(path, "/", sizeof(path)); + util_strlcat(path, slink, sizeof(path)); len = readlink(path, path, sizeof(path)); if (len < 0 || len >= (ssize_t) sizeof(path)) return -1; @@ -50,7 +49,7 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *de if (pos == NULL) return -1; pos = &pos[1]; - return strlcpy(subsystem, pos, size); + return util_strlcpy(subsystem, pos, size); } ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size) @@ -65,14 +64,15 @@ ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size) { - char link_path[PATH_SIZE]; - char link_target[PATH_SIZE]; + char link_path[UTIL_PATH_SIZE]; + char link_target[UTIL_PATH_SIZE]; + int len; int i; int back; - strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - strlcat(link_path, devpath, sizeof(link_path)); + util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); + util_strlcat(link_path, devpath, sizeof(link_path)); len = readlink(link_path, link_target, sizeof(link_target)); if (len <= 0) return -1; @@ -90,17 +90,11 @@ int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size) pos[0] = '\0'; } dbg(udev, "after moving back '%s'\n", devpath); - strlcat(devpath, "/", size); - strlcat(devpath, &link_target[back * 3], size); + util_strlcat(devpath, "/", size); + util_strlcat(devpath, &link_target[back * 3], size); return 0; } -struct util_name_entry { - struct list_head node; - char *name; - int *i; -}; - struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, const char *name, int sort) { @@ -122,9 +116,15 @@ struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head * } } + name_new = malloc(sizeof(struct util_name_entry)); + if (name_new == NULL) + return NULL; + memset(name_new, 0x00, sizeof(struct util_name_entry)); name_new->name = strdup(name); - if (name_new->name == NULL) + if (name_new->name == NULL) { + free(name_new); return NULL; + } dbg(udev, "adding '%s'\n", name_new->name); list_add_tail(&name_new->node, &name_loop->node); return name_new; @@ -212,3 +212,46 @@ void util_remove_trailing_chars(char *path, char c) while (len > 0 && path[len-1] == c) path[--len] = '\0'; } + +size_t util_strlcpy(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + /* If size == 0 there is no space for a final null... */ + if (size) + *q = '\0'; + return bytes; +} + +size_t util_strlcat(char *dst, const char *src, size_t size) +{ + size_t bytes = 0; + char *q = dst; + const char *p = src; + char ch; + + while (bytes < size && *q) { + q++; + bytes++; + } + if (bytes == size) + return (bytes + strlen(src)); + + while ((ch = *p++)) { + if (bytes+1 < size) + *q++ = ch; + bytes++; + } + + *q = '\0'; + return bytes; +} diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index d1dd9e4838..04ad26c6fb 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -33,7 +33,6 @@ #include "libudev.h" #include "libudev-private.h" -#include "../udev.h" struct udev { int refcount; @@ -201,7 +200,7 @@ struct udev *udev_new(void) goto err; f = fopen(config_file, "r"); if (f != NULL) { - char line[LINE_SIZE]; + char line[UTIL_LINE_SIZE]; int line_nr = 0; while (fgets(line, sizeof(line), f)) { diff --git a/udev/list.h b/udev/list.h deleted file mode 100644 index 3266e1b124..0000000000 --- a/udev/list.h +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Based on list.h in the Linux kernel source tree. - */ - -#ifndef _LIST_H -#define _LIST_H - -/** - * container_of - cast a member of a structure out to the containing structure - * - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -/* - * These are non-NULL pointers that will result in page faults - * under normal circumstances, used to verify that nobody uses - * non-initialized list entries. - */ -#define LIST_POISON1 ((void *) 0x00100100) -#define LIST_POISON2 ((void *) 0x00200200) - -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_del(struct list_head * prev, struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty on entry does not return true after this, the entry is - * in an undefined state. - */ -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = LIST_POISON1; - entry->prev = LIST_POISON2; -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static inline void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_move - delete from one list and add as another's head - * @list: the entry to move - * @head: the head that will precede our entry - */ -static inline void list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - delete from one list and add as another's tail - * @list: the entry to move - * @head: the head that will follow our entry - */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static inline int list_empty(struct list_head *head) -{ - return head->next == head; -} - -static inline void __list_splice(struct list_head *list, - struct list_head *head) -{ - struct list_head *first = list->next; - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -static inline void list_splice(struct list_head *list, struct list_head *head) -{ - if (!list_empty(list)) - __list_splice(list, head); -} - -/** - * list_splice_init - join two lists and reinitialise the emptied list. - * @list: the new list to add. - * @head: the place to add it in the first list. - * - * The list at @list is reinitialised - */ -static inline void list_splice_init(struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) { - __list_splice(list, head); - INIT_LIST_HEAD(list); - } -} - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); \ - pos = pos->next) - -/** - * __list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - * - * This variant differs from list_for_each() in that it's the - * simplest possible list iteration code. - * Use this for code that knows the list to be very short (empty - * or 1 entry) most of the time. - */ -#define __list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each_prev(pos, head) \ - for (pos = (head)->prev; pos != (head); pos = pos->prev) - -/** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -/** - * list_for_each_entry - iterate over list of given type - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_reverse - iterate backwards over list of given type. - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) - -/** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -#endif /* _LIST_H */ diff --git a/udev/udev.h b/udev/udev.h index 429b79b15f..24646ece59 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -24,11 +24,11 @@ #include #include -#include "list.h" #include "udev_sysdeps.h" #define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 1 #include "lib/libudev.h" #include "lib/libudev-private.h" +#include "lib/list.h" #define COMMENT_CHARACTER '#' #define LINE_SIZE 512 diff --git a/udev/udev_rules.h b/udev/udev_rules.h index ac7388e8a1..02685e1834 100644 --- a/udev/udev_rules.h +++ b/udev/udev_rules.h @@ -20,7 +20,6 @@ #define UDEV_RULES_H #include "udev.h" -#include "list.h" #define PAIRS_MAX 5 -- cgit v1.2.3-54-g00ecf From 75250977137c26f706fc1514aca7982107859b1c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 18:24:39 +0200 Subject: extras: use libudev code --- extras/ata_id/Makefile.am | 5 +- extras/cdrom_id/Makefile.am | 5 +- extras/edd_id/Makefile.am | 5 +- extras/edd_id/edd_id.c | 2 +- extras/fstab_import/Makefile.am | 5 +- extras/fstab_import/fstab_import.c | 4 +- extras/scsi_id/Makefile.am | 5 +- extras/usb_id/Makefile.am | 1 - extras/volume_id/Makefile.am | 5 +- extras/volume_id/vol_id.c | 2 +- udev/lib/libudev-private.h | 1 + udev/lib/libudev-util.c | 177 +++++++++++++++++++++++++++++++++++++ udev/udev.h | 1 - udev/udev_utils_string.c | 2 +- 14 files changed, 189 insertions(+), 31 deletions(-) diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index bc3b7001a4..ce4a32330f 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -12,10 +12,7 @@ ata_id_SOURCES = \ ata_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-util.c \ - ../../udev/udev_sysdeps.c \ - ../../udev/udev_utils.c \ - ../../udev/udev_utils_string.c + ../../udev/lib/libudev-util.c if USE_SELINUX ata_id_LDADD = \ diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index 595d710965..d4db32b783 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -15,10 +15,7 @@ cdrom_id_SOURCES = \ cdrom_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-util.c \ - ../../udev/udev_sysdeps.c \ - ../../udev/udev_utils.c \ - ../../udev/udev_utils_string.c + ../../udev/lib/libudev-util.c if USE_SELINUX cdrom_id_LDADD = \ diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index e494c1e672..3bdbbd85b2 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -15,10 +15,7 @@ edd_id_SOURCES = \ edd_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-util.c \ - ../../udev/udev_sysdeps.c \ - ../../udev/udev_utils.c \ - ../../udev/udev_utils_string.c + ../../udev/lib/libudev-util.c if USE_SELINUX edd_id_LDADD = \ diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index b53700e756..4ba60393a0 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) if (disk_id == sysfs_id) { if (match[0] == '\0') { /* store id */ - strlcpy(match, dent->d_name, sizeof(match)); + util_strlcpy(match, dent->d_name, sizeof(match)); } else { /* error, same signature for another device */ info(udev, "'%s' does not have a unique signature\n", node); diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index 7b99471fa2..2ed383d95e 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -15,10 +15,7 @@ fstab_import_SOURCES = \ fstab_import.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-util.c \ - ../../udev/udev_sysdeps.c \ - ../../udev/udev_utils.c \ - ../../udev/udev_utils_string.c + ../../udev/lib/libudev-util.c if USE_SELINUX fstab_import_LDADD = \ diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c index 0f4685ae2a..245a72fffb 100644 --- a/extras/fstab_import/fstab_import.c +++ b/extras/fstab_import/fstab_import.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) if (label[0] == '"' || label[0] == '\'') { char *pos; - strlcpy(str, &label[1], sizeof(str)); + util_strlcpy(str, &label[1], sizeof(str)); pos = strrchr(str, label[0]); if (pos == NULL) continue; @@ -170,7 +170,7 @@ int main(int argc, char *argv[]) if (uuid[0] == '"' || uuid[0] == '\'') { char *pos; - strlcpy(str, &uuid[1], sizeof(str)); + util_strlcpy(str, &uuid[1], sizeof(str)); pos = strrchr(str, uuid[0]); if (pos == NULL) continue; diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index 62e14e5adb..b6bebb69a5 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -15,10 +15,7 @@ scsi_id_SOURCES = \ bsg.h \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-util.c \ - ../../udev/udev_sysdeps.c \ - ../../udev/udev_utils.c \ - ../../udev/udev_utils_string.c + ../../udev/lib/libudev-util.c if USE_SELINUX scsi_id_LDADD = \ diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index 07692df3a2..ba74baad42 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -24,4 +24,3 @@ endif distclean-local: rm -f Makefile.in - diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index 75f3e984d6..3e11d5c348 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -14,10 +14,7 @@ vol_id_SOURCES = \ vol_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-util.c \ - ../../udev/udev_sysdeps.c \ - ../../udev/udev_utils.c \ - ../../udev/udev_utils_string.c + ../../udev/lib/libudev-util.c vol_id_LDADD = \ lib/libvolume_id.la diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 4b101be929..79ed099803 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -275,7 +275,7 @@ int main(int argc, char *argv[]) } set_str(label_safe, label, sizeof(label_safe)); - replace_chars(label_safe, ALLOWED_CHARS_INPUT); + util_replace_chars(label_safe, ALLOWED_CHARS_INPUT); volume_id_encode_string(label, label_enc, sizeof(label_enc)); volume_id_encode_string(uuid, uuid_enc, sizeof(uuid_enc)); diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 32837e368d..1f4abc07ba 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -123,4 +123,5 @@ extern size_t util_path_decode(char *s); extern void util_remove_trailing_chars(char *path, char c); extern size_t util_strlcpy(char *dst, const char *src, size_t size); extern size_t util_strlcat(char *dst, const char *src, size_t size); +extern int util_replace_chars(char *str, const char *white); #endif diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index ae0adf4b88..7aea8c67fb 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "libudev.h" @@ -255,3 +256,179 @@ size_t util_strlcat(char *dst, const char *src, size_t size) *q = '\0'; return bytes; } + +/* count of characters used to encode one unicode char */ +static int utf8_encoded_expected_len(const char *str) +{ + unsigned char c = (unsigned char)str[0]; + + if (c < 0x80) + return 1; + if ((c & 0xe0) == 0xc0) + return 2; + if ((c & 0xf0) == 0xe0) + return 3; + if ((c & 0xf8) == 0xf0) + return 4; + if ((c & 0xfc) == 0xf8) + return 5; + if ((c & 0xfe) == 0xfc) + return 6; + return 0; +} + +/* decode one unicode char */ +static int utf8_encoded_to_unichar(const char *str) +{ + int unichar; + int len; + int i; + + len = utf8_encoded_expected_len(str); + switch (len) { + case 1: + return (int)str[0]; + case 2: + unichar = str[0] & 0x1f; + break; + case 3: + unichar = (int)str[0] & 0x0f; + break; + case 4: + unichar = (int)str[0] & 0x07; + break; + case 5: + unichar = (int)str[0] & 0x03; + break; + case 6: + unichar = (int)str[0] & 0x01; + break; + default: + return -1; + } + + for (i = 1; i < len; i++) { + if (((int)str[i] & 0xc0) != 0x80) + return -1; + unichar <<= 6; + unichar |= (int)str[i] & 0x3f; + } + + return unichar; +} + +/* expected size used to encode one unicode char */ +static int utf8_unichar_to_encoded_len(int unichar) +{ + if (unichar < 0x80) + return 1; + if (unichar < 0x800) + return 2; + if (unichar < 0x10000) + return 3; + if (unichar < 0x200000) + return 4; + if (unichar < 0x4000000) + return 5; + return 6; +} + +/* check if unicode char has a valid numeric range */ +static int utf8_unichar_valid_range(int unichar) +{ + if (unichar > 0x10ffff) + return 0; + if ((unichar & 0xfffff800) == 0xd800) + return 0; + if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) + return 0; + if ((unichar & 0xffff) == 0xffff) + return 0; + return 1; +} + +/* validate one encoded unicode char and return its length */ +static int utf8_encoded_valid_unichar(const char *str) +{ + int len; + int unichar; + int i; + + len = utf8_encoded_expected_len(str); + if (len == 0) + return -1; + + /* ascii is valid */ + if (len == 1) + return 1; + + /* check if expected encoded chars are available */ + for (i = 0; i < len; i++) + if ((str[i] & 0x80) != 0x80) + return -1; + + unichar = utf8_encoded_to_unichar(str); + + /* check if encoded length matches encoded value */ + if (utf8_unichar_to_encoded_len(unichar) != len) + return -1; + + /* check if value has valid range */ + if (!utf8_unichar_valid_range(unichar)) + return -1; + + return len; +} + +/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ +int util_replace_chars(char *str, const char *white) +{ + size_t i = 0; + int replaced = 0; + + while (str[i] != '\0') { + int len; + + /* accept whitelist */ + if (white != NULL && strchr(white, str[i]) != NULL) { + i++; + continue; + } + + /* accept plain ascii char */ + if ((str[i] >= '0' && str[i] <= '9') || + (str[i] >= 'A' && str[i] <= 'Z') || + (str[i] >= 'a' && str[i] <= 'z')) { + i++; + continue; + } + + /* accept hex encoding */ + if (str[i] == '\\' && str[i+1] == 'x') { + i += 2; + continue; + } + + /* accept valid utf8 */ + len = utf8_encoded_valid_unichar(&str[i]); + if (len > 1) { + i += len; + continue; + } + + /* if space is allowed, replace whitespace with ordinary space */ + if (isspace(str[i]) && strchr(white, ' ') != NULL) { + str[i] = ' '; + i++; + replaced++; + continue; + } + + /* everything else is replaced with '_' */ + str[i] = '_'; + i++; + replaced++; + } + + return replaced; +} diff --git a/udev/udev.h b/udev/udev.h index 24646ece59..7f5bd10a7c 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -176,7 +176,6 @@ extern int string_is_true(const char *str); extern void remove_trailing_chars(char *path, char c); extern size_t path_encode(char *s, size_t len); extern size_t path_decode(char *s); -extern int utf8_encoded_valid_unichar(const char *str); extern int replace_chars(char *str, const char *white); /* udev_utils_file.c */ diff --git a/udev/udev_utils_string.c b/udev/udev_utils_string.c index 0dea6686db..540fb5caaa 100644 --- a/udev/udev_utils_string.c +++ b/udev/udev_utils_string.c @@ -185,7 +185,7 @@ static int utf8_unichar_valid_range(int unichar) } /* validate one encoded unicode char and return its length */ -int utf8_encoded_valid_unichar(const char *str) +static int utf8_encoded_valid_unichar(const char *str) { int len; int unichar; -- cgit v1.2.3-54-g00ecf From ecc9ec579feb4b7cc86bcf7caed3cb841faf3c9e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 18:39:23 +0200 Subject: convert to libudev and delete udev_utils_string.c --- extras/floppy/Makefile.am | 3 +- extras/usb_id/Makefile.am | 3 +- udev/Makefile.am | 1 - udev/udev.h | 7 -- udev/udev_db.c | 12 +- udev/udev_node.c | 2 +- udev/udev_rules.c | 12 +- udev/udev_sysfs.c | 4 +- udev/udev_utils.c | 21 ---- udev/udev_utils_string.c | 271 ---------------------------------------------- udev/udevadm-control.c | 6 +- udev/udevadm-info.c | 4 +- udev/udevadm-trigger.c | 6 +- udev/udevd.c | 4 +- 14 files changed, 27 insertions(+), 329 deletions(-) delete mode 100644 udev/udev_utils_string.c diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 92877a7778..9c5fe50114 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -13,8 +13,7 @@ create_floppy_devices_SOURCES = \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ - ../../udev/udev_utils.c \ - ../../udev/udev_utils_string.c + ../../udev/udev_utils.c if USE_SELINUX create_floppy_devices_LDADD = \ diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index ba74baad42..eac385c3c1 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -14,8 +14,7 @@ usb_id_SOURCES = \ ../../udev/lib/libudev-util.c \ ../../udev/udev_sysdeps.c \ ../../udev/udev_sysfs.c \ - ../../udev/udev_utils.c \ - ../../udev/udev_utils_string.c + ../../udev/udev_utils.c if USE_SELINUX usb_id_LDADD = \ diff --git a/udev/Makefile.am b/udev/Makefile.am index df03708421..66edd341fd 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -29,7 +29,6 @@ common_files = \ udev_sysfs.c \ udev_utils.c \ udev_utils_file.c \ - udev_utils_string.c \ lib/list.h \ lib/libudev.h \ lib/libudev-private.h \ diff --git a/udev/udev.h b/udev/udev.h index 7f5bd10a7c..0bf06bedba 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -171,13 +171,6 @@ extern int add_matching_files(struct udev *udev, struct list_head *name_list, co extern uid_t lookup_user(struct udev *udev, const char *user); extern gid_t lookup_group(struct udev *udev, const char *group); -/* udev_utils_string.c */ -extern int string_is_true(const char *str); -extern void remove_trailing_chars(char *path, char c); -extern size_t path_encode(char *s, size_t len); -extern size_t path_decode(char *s); -extern int replace_chars(char *str, const char *white); - /* udev_utils_file.c */ extern int create_path(struct udev *udev, const char *path); extern int delete_path(struct udev *udev, const char *path); diff --git a/udev/udev_db.c b/udev/udev_db.c index 8596470d49..2c3a24939e 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -38,7 +38,7 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f strlcpy(filename, udev_get_dev_path(udev), len); start = strlcat(filename, "/.udev/db/", len); strlcat(filename, devpath, len); - return path_encode(&filename[start], len - start); + return util_path_encode(&filename[start], len - start); } /* reverse mapping from the device file name to the devpath */ @@ -53,10 +53,10 @@ static int name_index(struct udev *udev, const char *devpath, const char *name, strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); start = strlcat(filename, "/.udev/names/", sizeof(filename)); strlcat(filename, name, sizeof(filename)); - path_encode(&filename[start], sizeof(filename) - start); + util_path_encode(&filename[start], sizeof(filename) - start); /* entry with the devpath */ strlcpy(device, devpath, sizeof(device)); - path_encode(device, sizeof(device)); + util_path_encode(device, sizeof(device)); strlcat(filename, "/", sizeof(filename)); strlcat(filename, device, sizeof(filename)); @@ -84,7 +84,7 @@ int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); start = strlcat(dirname, "/.udev/names/", sizeof(dirname)); strlcat(dirname, name, sizeof(dirname)); - path_encode(&dirname[start], sizeof(dirname) - start); + util_path_encode(&dirname[start], sizeof(dirname) - start); dir = opendir(dirname); if (dir == NULL) { @@ -105,7 +105,7 @@ int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list continue; strlcpy(device, ent->d_name, sizeof(device)); - path_decode(device); + util_path_decode(device); name_list_add(udev, name_list, device, 0); rc++; } @@ -317,7 +317,7 @@ int udev_db_get_all_entries(struct udev *udev, struct list_head *name_list) continue; strlcpy(device, ent->d_name, sizeof(device)); - path_decode(device); + util_path_decode(device); name_list_add(udev, name_list, device, 1); dbg(udev, "added '%s'\n", device); } diff --git a/udev/udev_node.c b/udev/udev_node.c index 5f1b5c76cd..80c4f0a5f3 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -283,7 +283,7 @@ void udev_node_update_symlinks(struct udevice *udevice, struct udevice *udevice_ } /* export symlinks to environment */ - remove_trailing_chars(symlinks, ' '); + util_remove_trailing_chars(symlinks, ' '); if (symlinks[0] != '\0') setenv("DEVLINKS", symlinks, 1); diff --git a/udev/udev_rules.c b/udev/udev_rules.c index fce73e4293..a56ed4e176 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -863,7 +863,7 @@ found: size = sizeof(temp2)-1; while (size > 0 && isspace(temp2[size-1])) temp2[--size] = '\0'; - count = replace_chars(temp2, ALLOWED_CHARS_INPUT); + count = util_replace_chars(temp2, ALLOWED_CHARS_INPUT); if (count > 0) info(udevice->udev, "%i character(s) replaced\n" , count); strlcat(string, temp2, maxsize); @@ -921,7 +921,7 @@ found: strlcat(symlinks, name_loop->name, sizeof(symlinks)); strlcat(symlinks, " ", sizeof(symlinks)); } - remove_trailing_chars(symlinks, ' '); + util_remove_trailing_chars(symlinks, ' '); strlcat(string, symlinks, maxsize); } break; @@ -1240,10 +1240,10 @@ try_parent: int count; dbg(udevice->udev, "PROGRAM matches\n"); - remove_trailing_chars(result, '\n'); + util_remove_trailing_chars(result, '\n'); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { - count = replace_chars(result, ALLOWED_CHARS_INPUT); + count = util_replace_chars(result, ALLOWED_CHARS_INPUT); if (count > 0) info(udevice->udev, "%i character(s) replaced\n" , count); } @@ -1461,7 +1461,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) udev_rules_apply_format(udevice, temp, sizeof(temp)); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { - count = replace_chars(temp, ALLOWED_CHARS_FILE " "); + count = util_replace_chars(temp, ALLOWED_CHARS_FILE " "); if (count > 0) info(udevice->udev, "%i character(s) replaced\n" , count); } @@ -1496,7 +1496,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) udev_rules_apply_format(udevice, udevice->name, sizeof(udevice->name)); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { - count = replace_chars(udevice->name, ALLOWED_CHARS_FILE); + count = util_replace_chars(udevice->name, ALLOWED_CHARS_FILE); if (count > 0) info(udevice->udev, "%i character(s) replaced\n", count); } diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c index 311bc6f24e..6b9f9dac3a 100644 --- a/udev/udev_sysfs.c +++ b/udev/udev_sysfs.c @@ -156,7 +156,7 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) dbg(udev, "open '%s'\n", devpath); strlcpy(devpath_real, devpath, sizeof(devpath_real)); - remove_trailing_chars(devpath_real, '/'); + util_remove_trailing_chars(devpath_real, '/'); if (devpath[0] == '\0' ) return NULL; @@ -397,7 +397,7 @@ char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *a /* got a valid value, store and return it */ value[size] = '\0'; - remove_trailing_chars(value, '\n'); + util_remove_trailing_chars(value, '\n'); dbg(udev, "cache '%s' with attribute value '%s'\n", path_full, value); strlcpy(attr->value_local, value, sizeof(attr->value_local)); attr->value = attr->value_local; diff --git a/udev/udev_utils.c b/udev/udev_utils.c index 2cbb4d98eb..669e4f3419 100644 --- a/udev/udev_utils.c +++ b/udev/udev_utils.c @@ -32,27 +32,6 @@ #include "udev.h" - -int log_priority(const char *priority) -{ - char *endptr; - int prio; - - prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0') - return prio; - if (strncasecmp(priority, "err", 3) == 0) - return LOG_ERR; - if (strcasecmp(priority, "info") == 0) - return LOG_INFO; - if (strcasecmp(priority, "debug") == 0) - return LOG_DEBUG; - if (string_is_true(priority)) - return LOG_ERR; - - return 0; -} - struct name_entry *name_list_add(struct udev *udev, struct list_head *name_list, const char *name, int sort) { struct name_entry *name_loop; diff --git a/udev/udev_utils_string.c b/udev/udev_utils_string.c deleted file mode 100644 index 540fb5caaa..0000000000 --- a/udev/udev_utils_string.c +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -int string_is_true(const char *str) -{ - if (strcasecmp(str, "true") == 0) - return 1; - if (strcasecmp(str, "yes") == 0) - return 1; - if (strcasecmp(str, "1") == 0) - return 1; - return 0; -} - -void remove_trailing_chars(char *path, char c) -{ - size_t len; - - if (path == NULL) - return; - len = strlen(path); - while (len > 0 && path[len-1] == c) - path[--len] = '\0'; -} - -size_t path_encode(char *s, size_t len) -{ - char t[(len * 3)+1]; - size_t i, j; - - t[0] = '\0'; - for (i = 0, j = 0; s[i] != '\0'; i++) { - if (s[i] == '/') { - memcpy(&t[j], "\\x2f", 4); - j += 4; - } else if (s[i] == '\\') { - memcpy(&t[j], "\\x5c", 4); - j += 4; - } else { - t[j] = s[i]; - j++; - } - } - t[j] = '\0'; - strncpy(s, t, len); - return j; -} - -size_t path_decode(char *s) -{ - size_t i, j; - - for (i = 0, j = 0; s[i] != '\0'; j++) { - if (memcmp(&s[i], "\\x2f", 4) == 0) { - s[j] = '/'; - i += 4; - }else if (memcmp(&s[i], "\\x5c", 4) == 0) { - s[j] = '\\'; - i += 4; - } else { - s[j] = s[i]; - i++; - } - } - s[j] = '\0'; - return j; -} - -/* count of characters used to encode one unicode char */ -static int utf8_encoded_expected_len(const char *str) -{ - unsigned char c = (unsigned char)str[0]; - - if (c < 0x80) - return 1; - if ((c & 0xe0) == 0xc0) - return 2; - if ((c & 0xf0) == 0xe0) - return 3; - if ((c & 0xf8) == 0xf0) - return 4; - if ((c & 0xfc) == 0xf8) - return 5; - if ((c & 0xfe) == 0xfc) - return 6; - return 0; -} - -/* decode one unicode char */ -static int utf8_encoded_to_unichar(const char *str) -{ - int unichar; - int len; - int i; - - len = utf8_encoded_expected_len(str); - switch (len) { - case 1: - return (int)str[0]; - case 2: - unichar = str[0] & 0x1f; - break; - case 3: - unichar = (int)str[0] & 0x0f; - break; - case 4: - unichar = (int)str[0] & 0x07; - break; - case 5: - unichar = (int)str[0] & 0x03; - break; - case 6: - unichar = (int)str[0] & 0x01; - break; - default: - return -1; - } - - for (i = 1; i < len; i++) { - if (((int)str[i] & 0xc0) != 0x80) - return -1; - unichar <<= 6; - unichar |= (int)str[i] & 0x3f; - } - - return unichar; -} - -/* expected size used to encode one unicode char */ -static int utf8_unichar_to_encoded_len(int unichar) -{ - if (unichar < 0x80) - return 1; - if (unichar < 0x800) - return 2; - if (unichar < 0x10000) - return 3; - if (unichar < 0x200000) - return 4; - if (unichar < 0x4000000) - return 5; - return 6; -} - -/* check if unicode char has a valid numeric range */ -static int utf8_unichar_valid_range(int unichar) -{ - if (unichar > 0x10ffff) - return 0; - if ((unichar & 0xfffff800) == 0xd800) - return 0; - if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) - return 0; - if ((unichar & 0xffff) == 0xffff) - return 0; - return 1; -} - -/* validate one encoded unicode char and return its length */ -static int utf8_encoded_valid_unichar(const char *str) -{ - int len; - int unichar; - int i; - - len = utf8_encoded_expected_len(str); - if (len == 0) - return -1; - - /* ascii is valid */ - if (len == 1) - return 1; - - /* check if expected encoded chars are available */ - for (i = 0; i < len; i++) - if ((str[i] & 0x80) != 0x80) - return -1; - - unichar = utf8_encoded_to_unichar(str); - - /* check if encoded length matches encoded value */ - if (utf8_unichar_to_encoded_len(unichar) != len) - return -1; - - /* check if value has valid range */ - if (!utf8_unichar_valid_range(unichar)) - return -1; - - return len; -} - -/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ -int replace_chars(char *str, const char *white) -{ - size_t i = 0; - int replaced = 0; - - while (str[i] != '\0') { - int len; - - /* accept whitelist */ - if (white != NULL && strchr(white, str[i]) != NULL) { - i++; - continue; - } - - /* accept plain ascii char */ - if ((str[i] >= '0' && str[i] <= '9') || - (str[i] >= 'A' && str[i] <= 'Z') || - (str[i] >= 'a' && str[i] <= 'z')) { - i++; - continue; - } - - /* accept hex encoding */ - if (str[i] == '\\' && str[i+1] == 'x') { - i += 2; - continue; - } - - /* accept valid utf8 */ - len = utf8_encoded_valid_unichar(&str[i]); - if (len > 1) { - i += len; - continue; - } - - /* if space is allowed, replace whitespace with ordinary space */ - if (isspace(str[i]) && strchr(white, ' ') != NULL) { - str[i] = ' '; - i++; - replaced++; - continue; - } - - /* everything else is replaced with '_' */ - str[i] = '_'; - i++; - replaced++; - } - - return replaced; -} diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 12b1e45f23..e3a91fc9a4 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -91,12 +91,12 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) switch (option) { case 'l': case 'l' + 256: - i = log_priority(optarg); + i = util_log_priority(optarg); if (i < 0) { fprintf(stderr, "invalid number '%s'\n", optarg); goto exit; } - udev_ctrl_send_set_log_level(uctrl, log_priority(optarg)); + udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg)); rc = 0; break; case 's': @@ -151,7 +151,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) "this will stop working in a future release\n"); if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { - udev_ctrl_send_set_log_level(uctrl, log_priority(&arg[strlen("log_priority=")])); + udev_ctrl_send_set_log_level(uctrl, util_log_priority(&arg[strlen("log_priority=")])); rc = 0; goto exit; } else if (!strcmp(arg, "stop_exec_queue")) { diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 1d18f81295..402fa76e8d 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -289,7 +289,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) strlcpy(name, &optarg[strlen(udev_get_dev_path(udev))+1], sizeof(name)); else strlcpy(name, optarg, sizeof(name)); - remove_trailing_chars(name, '/'); + util_remove_trailing_chars(name, '/'); dbg(udev, "name: %s\n", name); break; case 'p': @@ -298,7 +298,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) strlcpy(path, &optarg[strlen(udev_get_sys_path(udev))], sizeof(path)); else strlcpy(path, optarg, sizeof(path)); - remove_trailing_chars(path, '/'); + util_remove_trailing_chars(path, '/'); /* possibly resolve to real devpath */ if (sysfs_resolve_link(udev, path, sizeof(path)) != 0) { diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 137ab5fb4c..6d01040e01 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -179,7 +179,7 @@ static int pass_to_socket(struct udev *udev, const char *devpath, const char *ac strlcat(path, name_loop->name, sizeof(path)); strlcat(path, " ", sizeof(path)); } - remove_trailing_chars(path, ' '); + util_remove_trailing_chars(path, ' '); if (path[0] != '\0') { bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path); bufpos++; @@ -316,7 +316,7 @@ static int attr_match(const char *path, const char *attr_value) if (size < 0) return 0; value[size] = '\0'; - remove_trailing_chars(value, '\n'); + util_remove_trailing_chars(value, '\n'); /* match if attribute value matches */ if (fnmatch(match_value, value, 0) == 0) @@ -553,7 +553,7 @@ static void scan_failed(struct udev *udev) if(start >= sizeof(device)) start = sizeof(device) - 1; strlcat(device, dent->d_name, sizeof(device)); - path_decode(&device[start]); + util_path_decode(&device[start]); device_list_insert(udev, device); } closedir(dir); diff --git a/udev/udevd.c b/udev/udevd.c index e88b11daa0..06bfbd953e 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -180,7 +180,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st strlcat(filename_failed, "/", sizeof(filename_failed)); start = strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed)); strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); - path_encode(&filename_failed[start], sizeof(filename_failed) - start); + util_path_encode(&filename_failed[start], sizeof(filename_failed) - start); switch (state) { case EVENT_QUEUED: @@ -200,7 +200,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); start = strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old)); strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); - path_encode(&filename_failed_old[start], sizeof(filename) - start); + util_path_encode(&filename_failed_old[start], sizeof(filename) - start); if (rename(filename_failed_old, filename_failed) == 0) info(msg->udev, "renamed devpath, moved failed state of '%s' to %s'\n", -- cgit v1.2.3-54-g00ecf From 31c1f537450e96f8ddd6a0fad2adaefe57996f03 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 18:59:42 +0200 Subject: get rid of udev_sysdeps.c --- extras/floppy/Makefile.am | 1 - extras/usb_id/Makefile.am | 1 - extras/usb_id/usb_id.c | 22 ++-- udev/Makefile.am | 1 - udev/lib/list.h | 286 ++++++++++++++++++++++++++++++++++++++++++++++ udev/test-udev.c | 2 +- udev/udev_db.c | 36 +++--- udev/udev_device_event.c | 28 ++--- udev/udev_node.c | 48 ++++---- udev/udev_rules.c | 160 +++++++++++++------------- udev/udev_rules_parse.c | 14 +-- udev/udev_sysdeps.c | 68 ----------- udev/udev_sysdeps.h | 8 +- udev/udev_sysfs.c | 132 ++++++++++----------- udev/udev_utils.c | 2 +- udev/udev_utils_file.c | 2 +- udev/udevadm-info.c | 36 +++--- udev/udevadm-settle.c | 12 +- udev/udevadm-test.c | 12 +- udev/udevadm-trigger.c | 124 ++++++++++---------- udev/udevd.c | 34 +++--- 21 files changed, 620 insertions(+), 409 deletions(-) create mode 100644 udev/lib/list.h delete mode 100644 udev/udev_sysdeps.c diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 9c5fe50114..59fc4e560f 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -12,7 +12,6 @@ create_floppy_devices_SOURCES = \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c \ - ../../udev/udev_sysdeps.c \ ../../udev/udev_utils.c if USE_SELINUX diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index eac385c3c1..c8d743b5f4 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -12,7 +12,6 @@ usb_id_SOURCES = \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c \ - ../../udev/udev_sysdeps.c \ ../../udev/udev_sysfs.c \ ../../udev/udev_utils.c diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index fb4c28ac3e..9938dc00ef 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -147,7 +147,7 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len break; } } - strlcpy(to, type, len); + util_strlcpy(to, type, len); return type_num; } @@ -180,7 +180,7 @@ static void set_scsi_type(char *to, const char *from, size_t len) break; } } - strlcpy(to, type, len); + util_strlcpy(to, type, len); } /* @@ -408,14 +408,14 @@ int main(int argc, char **argv) env = getenv("DEVPATH"); if (env != NULL) - strlcpy(devpath, env, sizeof(devpath)); + util_strlcpy(devpath, env, sizeof(devpath)); else { if (argv[optind] == NULL) { fprintf(stderr, "No device specified\n"); retval = 1; goto exit; } - strlcpy(devpath, argv[optind], sizeof(devpath)); + util_strlcpy(devpath, argv[optind], sizeof(devpath)); } retval = usb_id(udev, devpath); @@ -423,16 +423,16 @@ int main(int argc, char **argv) if (retval == 0) { char serial[256]; - strlcpy(serial, vendor_str, sizeof(serial)); - strlcat(serial, "_", sizeof(serial)); - strlcat(serial, model_str, sizeof(serial)); + util_strlcpy(serial, vendor_str, sizeof(serial)); + util_strlcat(serial, "_", sizeof(serial)); + util_strlcat(serial, model_str, sizeof(serial)); if (serial_str[0] != '\0') { - strlcat(serial, "_", sizeof(serial)); - strlcat(serial, serial_str, sizeof(serial)); + util_strlcat(serial, "_", sizeof(serial)); + util_strlcat(serial, serial_str, sizeof(serial)); } if (instance_str[0] != '\0') { - strlcat(serial, "-", sizeof(serial)); - strlcat(serial, instance_str, sizeof(serial)); + util_strlcat(serial, "-", sizeof(serial)); + util_strlcat(serial, instance_str, sizeof(serial)); } if (export) { diff --git a/udev/Makefile.am b/udev/Makefile.am index 66edd341fd..62739c05d9 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -25,7 +25,6 @@ common_files = \ udev_node.c \ udev_rules.c \ udev_rules_parse.c \ - udev_sysdeps.c \ udev_sysfs.c \ udev_utils.c \ udev_utils_file.c \ diff --git a/udev/lib/list.h b/udev/lib/list.h new file mode 100644 index 0000000000..3266e1b124 --- /dev/null +++ b/udev/lib/list.h @@ -0,0 +1,286 @@ +/* + * Based on list.h in the Linux kernel source tree. + */ + +#ifndef _LIST_H +#define _LIST_H + +/** + * container_of - cast a member of a structure out to the containing structure + * + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +/* + * These are non-NULL pointers that will result in page faults + * under normal circumstances, used to verify that nobody uses + * non-initialized list entries. + */ +#define LIST_POISON1 ((void *) 0x00100100) +#define LIST_POISON2 ((void *) 0x00200200) + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head * prev, struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty on entry does not return true after this, the entry is + * in an undefined state. + */ +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(struct list_head *head) +{ + return head->next == head; +} + +static inline void __list_splice(struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static inline void list_splice(struct list_head *list, struct list_head *head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); \ + pos = pos->next) + +/** + * __list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + * + * This variant differs from list_for_each() in that it's the + * simplest possible list iteration code. + * Use this for code that knows the list to be very short (empty + * or 1 entry) most of the time. + */ +#define __list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop counter. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); pos = pos->prev) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop counter. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_reverse - iterate backwards over list of given type. + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +#endif /* _LIST_H */ diff --git a/udev/test-udev.c b/udev/test-udev.c index d33fcf566d..dae7aaa634 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) /* override built-in sysfs device */ udevice->dev = dev; - strlcpy(udevice->action, action, sizeof(udevice->action)); + util_strlcpy(udevice->action, action, sizeof(udevice->action)); /* get dev_t from environment, which is needed for "remove" to work, "add" works also from sysfs */ maj = getenv("MAJOR"); diff --git a/udev/udev_db.c b/udev/udev_db.c index 2c3a24939e..763178d50c 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -35,9 +35,9 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f size_t start; /* translate to location of db file */ - strlcpy(filename, udev_get_dev_path(udev), len); - start = strlcat(filename, "/.udev/db/", len); - strlcat(filename, devpath, len); + util_strlcpy(filename, udev_get_dev_path(udev), len); + start = util_strlcat(filename, "/.udev/db/", len); + util_strlcat(filename, devpath, len); return util_path_encode(&filename[start], len - start); } @@ -50,15 +50,15 @@ static int name_index(struct udev *udev, const char *devpath, const char *name, int fd; /* directory with device name */ - strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - start = strlcat(filename, "/.udev/names/", sizeof(filename)); - strlcat(filename, name, sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + start = util_strlcat(filename, "/.udev/names/", sizeof(filename)); + util_strlcat(filename, name, sizeof(filename)); util_path_encode(&filename[start], sizeof(filename) - start); /* entry with the devpath */ - strlcpy(device, devpath, sizeof(device)); + util_strlcpy(device, devpath, sizeof(device)); util_path_encode(device, sizeof(device)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, device, sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, device, sizeof(filename)); if (add) { info(udev, "creating index: '%s'\n", filename); @@ -81,9 +81,9 @@ int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list DIR *dir; int rc = 0; - strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); - start = strlcat(dirname, "/.udev/names/", sizeof(dirname)); - strlcat(dirname, name, sizeof(dirname)); + util_strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); + start = util_strlcat(dirname, "/.udev/names/", sizeof(dirname)); + util_strlcat(dirname, name, sizeof(dirname)); util_path_encode(&dirname[start], sizeof(dirname) - start); dir = opendir(dirname); @@ -104,7 +104,7 @@ int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list if (ent->d_name[0] == '.') continue; - strlcpy(device, ent->d_name, sizeof(device)); + util_strlcpy(device, ent->d_name, sizeof(device)); util_path_decode(device); name_list_add(udev, name_list, device, 0); rc++; @@ -219,7 +219,7 @@ int udev_db_get_device(struct udevice *udevice, const char *devpath) return -1; } dbg(udevice->udev, "db link points to '%s'\n", target); - strlcpy(udevice->name, target, sizeof(udevice->name)); + util_strlcpy(udevice->name, target, sizeof(udevice->name)); return 0; } @@ -241,7 +241,7 @@ int udev_db_get_device(struct udevice *udevice, const char *devpath) switch(bufline[0]) { case 'N': - strlcpy(udevice->name, line, sizeof(udevice->name)); + util_strlcpy(udevice->name, line, sizeof(udevice->name)); break; case 'M': sscanf(line, "%u:%u", &maj, &min); @@ -298,8 +298,8 @@ int udev_db_get_all_entries(struct udev *udev, struct list_head *name_list) char dbpath[PATH_MAX]; DIR *dir; - strlcpy(dbpath, udev_get_dev_path(udev), sizeof(dbpath)); - strlcat(dbpath, "/.udev/db", sizeof(dbpath)); + util_strlcpy(dbpath, udev_get_dev_path(udev), sizeof(dbpath)); + util_strlcat(dbpath, "/.udev/db", sizeof(dbpath)); dir = opendir(dbpath); if (dir == NULL) { info(udev, "no udev_db available '%s': %s\n", dbpath, strerror(errno)); @@ -316,7 +316,7 @@ int udev_db_get_all_entries(struct udev *udev, struct list_head *name_list) if (ent->d_name[0] == '.') continue; - strlcpy(device, ent->d_name, sizeof(device)); + util_strlcpy(device, ent->d_name, sizeof(device)); util_path_decode(device); name_list_add(udev, name_list, device, 1); dbg(udev, "added '%s'\n", device); diff --git a/udev/udev_device_event.c b/udev/udev_device_event.c index 102ea87a48..aacd1d2bc1 100644 --- a/udev/udev_device_event.c +++ b/udev/udev_device_event.c @@ -31,7 +31,6 @@ #include "udev.h" #include "udev_rules.h" - static void kernel_log(struct ifreq ifr) { int klog; @@ -69,8 +68,8 @@ static int rename_netif(struct udevice *udevice) } memset(&ifr, 0x00, sizeof(struct ifreq)); - strlcpy(ifr.ifr_name, udevice->dev->kernel, IFNAMSIZ); - strlcpy(ifr.ifr_newname, udevice->name, IFNAMSIZ); + util_strlcpy(ifr.ifr_name, udevice->dev->kernel, IFNAMSIZ); + util_strlcpy(ifr.ifr_newname, udevice->name, IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval == 0) kernel_log(ifr); @@ -79,22 +78,24 @@ static int rename_netif(struct udevice *udevice) /* see if the destination interface name already exists */ if (errno != EEXIST) { - err(udevice->udev, "error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err(udevice->udev, "error changing netif name %s to %s: %s\n", + ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } /* free our own name, another process may wait for us */ - strlcpy(ifr.ifr_newname, udevice->dev->kernel, IFNAMSIZ); - strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); + util_strlcpy(ifr.ifr_newname, udevice->dev->kernel, IFNAMSIZ); + util_strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) { - err(udevice->udev, "error changing netif name %s to %s: %s\n", ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err(udevice->udev, "error changing netif name %s to %s: %s\n", + ifr.ifr_name, ifr.ifr_newname, strerror(errno)); goto exit; } /* wait 30 seconds for our target to become available */ - strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); - strlcpy(ifr.ifr_newname, udevice->name, IFNAMSIZ); + util_strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); + util_strlcpy(ifr.ifr_newname, udevice->name, IFNAMSIZ); loop = 30 * 20; while (loop--) { retval = ioctl(sk, SIOCSIFNAME, &ifr); @@ -108,7 +109,8 @@ static int rename_netif(struct udevice *udevice) ifr.ifr_name, ifr.ifr_newname, strerror(errno)); break; } - dbg(udevice->udev, "wait for netif '%s' to become free, loop=%i\n", udevice->name, (30 * 20) - loop); + dbg(udevice->udev, "wait for netif '%s' to become free, loop=%i\n", + udevice->name, (30 * 20) - loop); usleep(1000 * 1000 / 20); } } @@ -199,11 +201,11 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udevice) setenv("INTERFACE_OLD", udevice->dev->kernel, 1); /* now change the devpath, because the kernel device name has changed */ - strlcpy(devpath, udevice->dev->devpath, sizeof(devpath)); + util_strlcpy(devpath, udevice->dev->devpath, sizeof(devpath)); pos = strrchr(devpath, '/'); if (pos != NULL) { pos[1] = '\0'; - strlcat(devpath, udevice->name, sizeof(devpath)); + util_strlcat(devpath, udevice->name, sizeof(devpath)); sysfs_device_set_values(udevice->udev, udevice->dev, devpath, NULL, NULL); setenv("DEVPATH", udevice->dev->devpath, 1); setenv("INTERFACE", udevice->name, 1); @@ -226,7 +228,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udevice) } else { dbg(udevice->udev, "'%s' not found in database, using kernel name '%s'\n", udevice->dev->devpath, udevice->dev->kernel); - strlcpy(udevice->name, udevice->dev->kernel, sizeof(udevice->name)); + util_strlcpy(udevice->name, udevice->dev->kernel, sizeof(udevice->name)); } udev_rules_get_run(rules, udevice); diff --git a/udev/udev_node.c b/udev/udev_node.c index 80c4f0a5f3..0319b2f875 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -51,8 +51,8 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ udev_selinux_lsetfilecon(udevice->udev, file, mode); } else { info(udevice->udev, "atomically replace existing file '%s'\n", file); - strlcpy(file_tmp, file, sizeof(file_tmp)); - strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); + util_strlcpy(file_tmp, file, sizeof(file_tmp)); + util_strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); unlink(file_tmp); udev_selinux_setfscreatecon(udevice->udev, file_tmp, mode); err = mknod(file_tmp, mode, devt); @@ -119,10 +119,10 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s } while (slink[i] != '\0') { if (slink[i] == '/') - strlcat(target, "../", sizeof(target)); + util_strlcat(target, "../", sizeof(target)); i++; } - strlcat(target, &node[tail], sizeof(target)); + util_strlcat(target, &node[tail], sizeof(target)); /* preserve link with correct target, do not replace node of other device */ if (lstat(slink, &stats) == 0) { @@ -163,8 +163,8 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s } info(udevice->udev, "atomically replace '%s'\n", slink); - strlcpy(slink_tmp, slink, sizeof(slink_tmp)); - strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); + util_strlcpy(slink_tmp, slink, sizeof(slink_tmp)); + util_strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); unlink(slink_tmp); udev_selinux_setfscreatecon(udevice->udev, slink, S_IFLNK); retval = symlink(target, slink_tmp); @@ -195,9 +195,9 @@ static int update_link(struct udevice *udevice, const char *name) int priority = 0; int rc = 0; - strlcpy(slink, udev_get_dev_path(udevice->udev), sizeof(slink)); - strlcat(slink, "/", sizeof(slink)); - strlcat(slink, name, sizeof(slink)); + util_strlcpy(slink, udev_get_dev_path(udevice->udev), sizeof(slink)); + util_strlcat(slink, "/", sizeof(slink)); + util_strlcat(slink, name, sizeof(slink)); count = udev_db_get_devices_by_name(udevice->udev, name, &name_list); info(udevice->udev, "found %i devices with name '%s'\n", count, name); @@ -224,7 +224,7 @@ static int update_link(struct udevice *udevice, const char *name) info(udevice->udev, "'%s' is our device node, database inconsistent, skip link update\n", udevice->name); } else if (target[0] == '\0' || udevice->link_priority >= priority) { priority = udevice->link_priority; - strlcpy(target, udevice->name, sizeof(target)); + util_strlcpy(target, udevice->name, sizeof(target)); } continue; } @@ -241,7 +241,7 @@ static int update_link(struct udevice *udevice, const char *name) udevice_db->dev->devpath, udevice_db->link_priority, priority); if (target[0] == '\0' || udevice_db->link_priority > priority) { priority = udevice_db->link_priority; - strlcpy(target, udevice_db->name, sizeof(target)); + util_strlcpy(target, udevice_db->name, sizeof(target)); } } } @@ -256,9 +256,9 @@ static int update_link(struct udevice *udevice, const char *name) } /* create symlink to the target with the highest priority */ - strlcpy(node, udev_get_dev_path(udevice->udev), sizeof(node)); - strlcat(node, "/", sizeof(node)); - strlcat(node, target, sizeof(node)); + util_strlcpy(node, udev_get_dev_path(udevice->udev), sizeof(node)); + util_strlcat(node, "/", sizeof(node)); + util_strlcat(node, target, sizeof(node)); info(udevice->udev, "'%s' with target '%s' has the highest priority %i, create it\n", name, target, priority); if (!udevice->test_run) { create_path(udevice->udev, slink); @@ -276,10 +276,10 @@ void udev_node_update_symlinks(struct udevice *udevice, struct udevice *udevice_ list_for_each_entry(name_loop, &udevice->symlink_list, node) { info(udevice->udev, "update symlink '%s' of '%s'\n", name_loop->name, udevice->dev->devpath); update_link(udevice, name_loop->name); - strlcat(symlinks, udev_get_dev_path(udevice->udev), sizeof(symlinks)); - strlcat(symlinks, "/", sizeof(symlinks)); - strlcat(symlinks, name_loop->name, sizeof(symlinks)); - strlcat(symlinks, " ", sizeof(symlinks)); + util_strlcat(symlinks, udev_get_dev_path(udevice->udev), sizeof(symlinks)); + util_strlcat(symlinks, "/", sizeof(symlinks)); + util_strlcat(symlinks, name_loop->name, sizeof(symlinks)); + util_strlcat(symlinks, " ", sizeof(symlinks)); } /* export symlinks to environment */ @@ -327,9 +327,9 @@ int udev_node_add(struct udevice *udevice) int i; int retval = 0; - strlcpy(filename, udev_get_dev_path(udevice->udev), sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, udevice->name, sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(udevice->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, udevice->name, sizeof(filename)); create_path(udevice->udev, filename); if (strcmp(udevice->owner, "root") == 0) @@ -406,9 +406,9 @@ int udev_node_remove(struct udevice *udevice) int retval = 0; int num; - strlcpy(filename, udev_get_dev_path(udevice->udev), sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, udevice->name, sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(udevice->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, udevice->name, sizeof(filename)); if (stat(filename, &stats) != 0) { info(udevice->udev, "device node '%s' not found\n", filename); return 0; diff --git a/udev/udev_rules.c b/udev/udev_rules.c index a56ed4e176..72c859348e 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -131,7 +131,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy int retval = 0; /* build argv from comand */ - strlcpy(arg, command, sizeof(arg)); + util_strlcpy(arg, command, sizeof(arg)); i = 0; if (strchr(arg, ' ') != NULL) { char *pos = arg; @@ -172,8 +172,8 @@ static int run_program(struct udev *udev, const char *command, const char *subsy /* allow programs in /lib/udev called without the path */ if (strchr(argv[0], '/') == NULL) { - strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); - strlcat(program, argv[0], sizeof(program)); + util_strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); + util_strlcat(program, argv[0], sizeof(program)); argv[0] = program; } @@ -432,7 +432,7 @@ static int import_parent_into_env(struct udevice *udevice, const char *filter) char name[NAME_SIZE]; char *pos; - strlcpy(name, name_loop->name, sizeof(name)); + util_strlcpy(name, name_loop->name, sizeof(name)); pos = strchr(name, '='); if (pos) { pos[0] = '\0'; @@ -472,22 +472,22 @@ static int pass_env_to_socket(struct udev *udev, const char *sockpath, const cha saddr.sun_family = AF_LOCAL; if (sockpath[0] == '@') { /* abstract namespace socket requested */ - strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); + util_strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { /* existing socket file */ - strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); + util_strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); } else { /* no socket file, assume abstract namespace socket */ - strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); + util_strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); } bufpos = snprintf(buf, sizeof(buf), "%s@%s", action, devpath); bufpos++; for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)); i++) { - bufpos += strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos); + bufpos += util_strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos); bufpos++; } if (bufpos > sizeof(buf)) @@ -514,7 +514,7 @@ int udev_rules_run(struct udevice *udevice) } else { char program[PATH_SIZE]; - strlcpy(program, name_loop->name, sizeof(program)); + util_strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udevice, program, sizeof(program)); if (run_program(udevice->udev, program, udevice->dev->subsystem, NULL, 0, NULL) != 0) if (!name_loop->ignore_error) @@ -535,12 +535,12 @@ static int wait_for_file(struct udevice *udevice, const char *file, int timeout) /* a relative path is a device attribute */ if (file[0] != '/') { - strlcpy(devicepath, udev_get_sys_path(udevice->udev), sizeof(devicepath)); - strlcat(devicepath, udevice->dev->devpath, sizeof(devicepath)); + util_strlcpy(devicepath, udev_get_sys_path(udevice->udev), sizeof(devicepath)); + util_strlcat(devicepath, udevice->dev->devpath, sizeof(devicepath)); - strlcpy(filepath, devicepath, sizeof(filepath)); - strlcat(filepath, "/", sizeof(filepath)); - strlcat(filepath, file, sizeof(filepath)); + util_strlcpy(filepath, devicepath, sizeof(filepath)); + util_strlcat(filepath, "/", sizeof(filepath)); + util_strlcat(filepath, file, sizeof(filepath)); file = filepath; } @@ -580,7 +580,7 @@ static int attr_get_by_subsys_id(struct udev *udev, const char *attrstr, char *d goto out; attrib = &attrib[1]; - strlcpy(subsys, &attrstr[1], sizeof(subsys)); + util_strlcpy(subsys, &attrstr[1], sizeof(subsys)); pos = strchr(subsys, ']'); if (pos == NULL) goto out; @@ -614,7 +614,7 @@ static int attr_subst_subdir(char *attr, size_t len) DIR *dir; pos[1] = '\0'; - strlcpy(str, &pos[2], sizeof(str)); + util_strlcpy(str, &pos[2], sizeof(str)); dir = opendir(attr); if (dir != NULL) { struct dirent *dent; @@ -624,8 +624,8 @@ static int attr_subst_subdir(char *attr, size_t len) if (dent->d_name[0] == '.') continue; - strlcat(attr, dent->d_name, len); - strlcat(attr, str, len); + util_strlcat(attr, dent->d_name, len); + util_strlcat(attr, str, len); if (stat(attr, &stats) == 0) { found = 1; break; @@ -635,7 +635,7 @@ static int attr_subst_subdir(char *attr, size_t len) closedir(dir); } if (!found) - strlcat(attr, str, len); + util_strlcat(attr, str, len); } return found; @@ -704,8 +704,8 @@ void udev_rules_apply_format(struct udevice *udevice, char *string, size_t maxsi if (head[1] == '\0') break; if (head[1] == '$') { - strlcpy(temp, head+2, sizeof(temp)); - strlcpy(head+1, temp, maxsize); + util_strlcpy(temp, head+2, sizeof(temp)); + util_strlcpy(head+1, temp, maxsize); head++; continue; } @@ -725,8 +725,8 @@ void udev_rules_apply_format(struct udevice *udevice, char *string, size_t maxsi if (head[1] == '\0') break; if (head[1] == '%') { - strlcpy(temp, head+2, sizeof(temp)); - strlcpy(head+1, temp, maxsize); + util_strlcpy(temp, head+2, sizeof(temp)); + util_strlcpy(head+1, temp, maxsize); head++; continue; } @@ -749,42 +749,42 @@ void udev_rules_apply_format(struct udevice *udevice, char *string, size_t maxsi break; found: attr = get_format_attribute(udevice->udev, &tail); - strlcpy(temp, tail, sizeof(temp)); + util_strlcpy(temp, tail, sizeof(temp)); dbg(udevice->udev, "format=%i, string='%s', tail='%s'\n", type ,string, tail); switch (type) { case SUBST_DEVPATH: - strlcat(string, udevice->dev->devpath, maxsize); + util_strlcat(string, udevice->dev->devpath, maxsize); dbg(udevice->udev, "substitute devpath '%s'\n", udevice->dev->devpath); break; case SUBST_KERNEL: - strlcat(string, udevice->dev->kernel, maxsize); + util_strlcat(string, udevice->dev->kernel, maxsize); dbg(udevice->udev, "substitute kernel name '%s'\n", udevice->dev->kernel); break; case SUBST_KERNEL_NUMBER: - strlcat(string, udevice->dev->kernel_number, maxsize); + util_strlcat(string, udevice->dev->kernel_number, maxsize); dbg(udevice->udev, "substitute kernel number '%s'\n", udevice->dev->kernel_number); break; case SUBST_ID: if (udevice->dev_parent != NULL) { - strlcat(string, udevice->dev_parent->kernel, maxsize); + util_strlcat(string, udevice->dev_parent->kernel, maxsize); dbg(udevice->udev, "substitute id '%s'\n", udevice->dev_parent->kernel); } break; case SUBST_DRIVER: if (udevice->dev_parent != NULL) { - strlcat(string, udevice->dev_parent->driver, maxsize); + util_strlcat(string, udevice->dev_parent->driver, maxsize); dbg(udevice->udev, "substitute driver '%s'\n", udevice->dev_parent->driver); } break; case SUBST_MAJOR: sprintf(temp2, "%d", major(udevice->devt)); - strlcat(string, temp2, maxsize); + util_strlcat(string, temp2, maxsize); dbg(udevice->udev, "substitute major number '%s'\n", temp2); break; case SUBST_MINOR: sprintf(temp2, "%d", minor(udevice->devt)); - strlcat(string, temp2, maxsize); + util_strlcat(string, temp2, maxsize); dbg(udevice->udev, "substitute minor number '%s'\n", temp2); break; case SUBST_RESULT: @@ -807,17 +807,17 @@ found: err(udevice->udev, "requested part of result string not found\n"); break; } - strlcpy(temp2, cpos, sizeof(temp2)); + util_strlcpy(temp2, cpos, sizeof(temp2)); /* %{2+}c copies the whole string from the second part on */ if (rest[0] != '+') { cpos = strchr(temp2, ' '); if (cpos) cpos[0] = '\0'; } - strlcat(string, temp2, maxsize); + util_strlcat(string, temp2, maxsize); dbg(udevice->udev, "substitute part of result string '%s'\n", temp2); } else { - strlcat(string, udevice->program_result, maxsize); + util_strlcat(string, udevice->program_result, maxsize); dbg(udevice->udev, "substitute result string '%s'\n", udevice->program_result); } break; @@ -858,7 +858,7 @@ found: break; /* strip trailing whitespace, and replace unwanted characters */ - size = strlcpy(temp2, value, sizeof(temp2)); + size = util_strlcpy(temp2, value, sizeof(temp2)); if (size >= sizeof(temp2)) size = sizeof(temp2)-1; while (size > 0 && isspace(temp2[size-1])) @@ -866,7 +866,7 @@ found: count = util_replace_chars(temp2, ALLOWED_CHARS_INPUT); if (count > 0) info(udevice->udev, "%i character(s) replaced\n" , count); - strlcat(string, temp2, maxsize); + util_strlcat(string, temp2, maxsize); dbg(udevice->udev, "substitute sysfs value '%s'\n", temp2); } break; @@ -883,7 +883,7 @@ found: if (udev_parent != NULL) { /* lookup the name in the udev_db with the DEVPATH of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { - strlcat(string, udev_parent->name, maxsize); + util_strlcat(string, udev_parent->name, maxsize); dbg(udevice->udev, "substitute parent node name'%s'\n", udev_parent->name); } else dbg(udevice->udev, "parent not found in database\n"); @@ -900,15 +900,15 @@ found: udevice->tmp_node[sizeof(udevice->tmp_node)-1] = '\0'; udev_node_mknod(udevice, udevice->tmp_node, udevice->devt, 0600, 0, 0); } - strlcat(string, udevice->tmp_node, maxsize); + util_strlcat(string, udevice->tmp_node, maxsize); dbg(udevice->udev, "substitute temporary device node name '%s'\n", udevice->tmp_node); break; case SUBST_NAME: if (udevice->name[0] == '\0') { - strlcat(string, udevice->dev->kernel, maxsize); + util_strlcat(string, udevice->dev->kernel, maxsize); dbg(udevice->udev, "substitute udevice->kernel '%s'\n", udevice->name); } else { - strlcat(string, udevice->name, maxsize); + util_strlcat(string, udevice->name, maxsize); dbg(udevice->udev, "substitute udevice->name '%s'\n", udevice->name); } break; @@ -918,19 +918,19 @@ found: char symlinks[PATH_SIZE] = ""; list_for_each_entry(name_loop, &udevice->symlink_list, node) { - strlcat(symlinks, name_loop->name, sizeof(symlinks)); - strlcat(symlinks, " ", sizeof(symlinks)); + util_strlcat(symlinks, name_loop->name, sizeof(symlinks)); + util_strlcat(symlinks, " ", sizeof(symlinks)); } util_remove_trailing_chars(symlinks, ' '); - strlcat(string, symlinks, maxsize); + util_strlcat(string, symlinks, maxsize); } break; case SUBST_ROOT: - strlcat(string, udev_get_dev_path(udevice->udev), maxsize); + util_strlcat(string, udev_get_dev_path(udevice->udev), maxsize); dbg(udevice->udev, "substitute udev_root '%s'\n", udev_get_dev_path(udevice->udev)); break; case SUBST_SYS: - strlcat(string, udev_get_sys_path(udevice->udev), maxsize); + util_strlcat(string, udev_get_sys_path(udevice->udev), maxsize); dbg(udevice->udev, "substitute sys_path '%s'\n", udev_get_sys_path(udevice->udev)); break; case SUBST_ENV: @@ -944,7 +944,7 @@ found: break; } dbg(udevice->udev, "substitute env '%s=%s'\n", attr, pos); - strlcat(string, pos, maxsize); + util_strlcat(string, pos, maxsize); break; default: err(udevice->udev, "unknown substitution type=%i\n", type); @@ -955,7 +955,7 @@ found: head[len] = '\0'; dbg(udevice->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head); } - strlcat(string, temp, maxsize); + util_strlcat(string, temp, maxsize); } } @@ -981,7 +981,7 @@ static int match_key(struct udev *udev, const char *key_name, struct udev_rule * return 0; /* look for a matching string, parts are separated by '|' */ - strlcpy(value, rule->buf + key->val_off, sizeof(value)); + util_strlcpy(value, rule->buf + key->val_off, sizeof(value)); key_value = value; dbg(udev, "key %s value='%s'\n", key_name, key_value); while (key_value) { @@ -1076,24 +1076,24 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) struct stat statbuf; int match; - strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); + util_strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); udev_rules_apply_format(udevice, filename, sizeof(filename)); if (attr_get_by_subsys_id(udevice->udev, filename, devpath, sizeof(devpath), &attr)) { - strlcpy(filename, udev_get_sys_path(udevice->udev), sizeof(filename)); - strlcat(filename, devpath, sizeof(filename)); + util_strlcpy(filename, udev_get_sys_path(udevice->udev), sizeof(filename)); + util_strlcat(filename, devpath, sizeof(filename)); if (attr != NULL) { - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, attr, sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, attr, sizeof(filename)); } } else if (filename[0] != '/') { char tmp[PATH_SIZE]; - strlcpy(tmp, udev_get_sys_path(udevice->udev), sizeof(tmp)); - strlcat(tmp, udevice->dev->devpath, sizeof(tmp)); - strlcat(tmp, "/", sizeof(tmp)); - strlcat(tmp, filename, sizeof(tmp)); - strlcpy(filename, tmp, sizeof(filename)); + util_strlcpy(tmp, udev_get_sys_path(udevice->udev), sizeof(tmp)); + util_strlcat(tmp, udevice->dev->devpath, sizeof(tmp)); + util_strlcat(tmp, "/", sizeof(tmp)); + util_strlcat(tmp, filename, sizeof(tmp)); + util_strlcpy(filename, tmp, sizeof(filename)); } attr_subst_subdir(filename, sizeof(filename)); @@ -1117,7 +1117,7 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) char filename[PATH_SIZE]; int found; - strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); + util_strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); udev_rules_apply_format(udevice, filename, sizeof(filename)); found = (wait_for_file(udevice, filename, 10) == 0); if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) @@ -1148,7 +1148,7 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) value = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, key_name); if (value == NULL) goto nomatch; - strlcpy(val, value, sizeof(val)); + util_strlcpy(val, value, sizeof(val)); /* strip trailing whitespace of value, if not asked to match for it */ len = strlen(key_value); @@ -1196,7 +1196,7 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) value = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, key_name); if (value == NULL) goto try_parent; - strlcpy(val, value, sizeof(val)); + util_strlcpy(val, value, sizeof(val)); /* strip trailing whitespace of value, if not asked to match for it */ len = strlen(key_value); @@ -1229,7 +1229,7 @@ try_parent: char program[PATH_SIZE]; char result[PATH_SIZE]; - strlcpy(program, key_val(rule, &rule->program), sizeof(program)); + util_strlcpy(program, key_val(rule, &rule->program), sizeof(program)); udev_rules_apply_format(udevice, program, sizeof(program)); if (run_program(udevice->udev, program, udevice->dev->subsystem, result, sizeof(result), NULL) != 0) { dbg(udevice->udev, "PROGRAM is false\n"); @@ -1248,7 +1248,7 @@ try_parent: info(udevice->udev, "%i character(s) replaced\n" , count); } dbg(udevice->udev, "result is '%s'\n", result); - strlcpy(udevice->program_result, result, sizeof(udevice->program_result)); + util_strlcpy(udevice->program_result, result, sizeof(udevice->program_result)); dbg(udevice->udev, "PROGRAM returned successful\n"); if (rule->program.operation == KEY_OP_NOMATCH) goto nomatch; @@ -1265,7 +1265,7 @@ try_parent: char import[PATH_SIZE]; int rc = -1; - strlcpy(import, key_val(rule, &rule->import), sizeof(import)); + util_strlcpy(import, key_val(rule, &rule->import), sizeof(import)); udev_rules_apply_format(udevice, import, sizeof(import)); dbg(udevice->udev, "check for IMPORT import='%s'\n", import); if (rule->import_type == IMPORT_PROGRAM) { @@ -1296,7 +1296,7 @@ try_parent: const char *value = key_val(rule, &pair->key); /* make sure we don't write to the same string we possibly read from */ - strlcpy(temp_value, value, sizeof(temp_value)); + util_strlcpy(temp_value, value, sizeof(temp_value)); udev_rules_apply_format(udevice, temp_value, NAME_SIZE); if (temp_value[0] == '\0') { @@ -1329,23 +1329,23 @@ try_parent: if (attr_get_by_subsys_id(udevice->udev, key_name, devpath, sizeof(devpath), &attrib)) { if (attrib != NULL) { - strlcpy(attr, udev_get_sys_path(udevice->udev), sizeof(attr)); - strlcat(attr, devpath, sizeof(attr)); - strlcat(attr, "/", sizeof(attr)); - strlcat(attr, attrib, sizeof(attr)); + util_strlcpy(attr, udev_get_sys_path(udevice->udev), sizeof(attr)); + util_strlcat(attr, devpath, sizeof(attr)); + util_strlcat(attr, "/", sizeof(attr)); + util_strlcat(attr, attrib, sizeof(attr)); } } if (attr[0] == '\0') { - strlcpy(attr, udev_get_sys_path(udevice->udev), sizeof(attr)); - strlcat(attr, udevice->dev->devpath, sizeof(attr)); - strlcat(attr, "/", sizeof(attr)); - strlcat(attr, key_name, sizeof(attr)); + util_strlcpy(attr, udev_get_sys_path(udevice->udev), sizeof(attr)); + util_strlcat(attr, udevice->dev->devpath, sizeof(attr)); + util_strlcat(attr, "/", sizeof(attr)); + util_strlcat(attr, key_name, sizeof(attr)); } attr_subst_subdir(attr, sizeof(attr)); - strlcpy(value, key_val(rule, &pair->key), sizeof(value)); + util_strlcpy(value, key_val(rule, &pair->key), sizeof(value)); udev_rules_apply_format(udevice, value, sizeof(value)); info(udevice->udev, "writing '%s' to sysfs file '%s'\n", value, attr); f = fopen(attr, "w"); @@ -1420,7 +1420,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) udevice->mode_final = 1; char buf[20]; - strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); + util_strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); udev_rules_apply_format(udevice, buf, sizeof(buf)); udevice->mode = strtol(buf, NULL, 8); dbg(udevice->udev, "applied mode=%#o to '%s'\n", udevice->mode, udevice->dev->kernel); @@ -1428,14 +1428,14 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) if (!udevice->owner_final && rule->owner.operation != KEY_OP_UNSET) { if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) udevice->owner_final = 1; - strlcpy(udevice->owner, key_val(rule, &rule->owner), sizeof(udevice->owner)); + util_strlcpy(udevice->owner, key_val(rule, &rule->owner), sizeof(udevice->owner)); udev_rules_apply_format(udevice, udevice->owner, sizeof(udevice->owner)); dbg(udevice->udev, "applied owner='%s' to '%s'\n", udevice->owner, udevice->dev->kernel); } if (!udevice->group_final && rule->group.operation != KEY_OP_UNSET) { if (rule->group.operation == KEY_OP_ASSIGN_FINAL) udevice->group_final = 1; - strlcpy(udevice->group, key_val(rule, &rule->group), sizeof(udevice->group)); + util_strlcpy(udevice->group, key_val(rule, &rule->group), sizeof(udevice->group)); udev_rules_apply_format(udevice, udevice->group, sizeof(udevice->group)); dbg(udevice->udev, "applied group='%s' to '%s'\n", udevice->group, udevice->dev->kernel); } @@ -1457,7 +1457,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) name_list_cleanup(udevice->udev, &udevice->symlink_list); } /* allow multiple symlinks separated by spaces */ - strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); + util_strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); udev_rules_apply_format(udevice, temp, sizeof(temp)); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { @@ -1492,7 +1492,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) int count; name_set = 1; - strlcpy(udevice->name, key_val(rule, &rule->name), sizeof(udevice->name)); + util_strlcpy(udevice->name, key_val(rule, &rule->name), sizeof(udevice->name)); udev_rules_apply_format(udevice, udevice->name, sizeof(udevice->name)); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { @@ -1536,7 +1536,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) if (!name_set) { info(udevice->udev, "no node name set, will use kernel name '%s'\n", udevice->dev->kernel); - strlcpy(udevice->name, udevice->dev->kernel, sizeof(udevice->name)); + util_strlcpy(udevice->name, udevice->dev->kernel, sizeof(udevice->name)); } if (udevice->tmp_node[0] != '\0') { diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 685260f12c..1c5f36d491 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -209,7 +209,7 @@ static int add_rule_key(struct udev_rule *rule, struct key *key, key->operation = operation; key->val_off = rule->bufsize; - strlcpy(rule->buf + rule->bufsize, value, val_len+1); + util_strlcpy(rule->buf + rule->bufsize, value, val_len+1); rule->bufsize += val_len+1; return 0; @@ -229,7 +229,7 @@ static int add_rule_key_pair(struct udev_rules *rules, struct udev_rule *rule, s /* add the key-name of the pair */ pairs->keys[pairs->count].key_name_off = rule->bufsize; - strlcpy(rule->buf + rule->bufsize, key, key_len+1); + util_strlcpy(rule->buf + rule->bufsize, key, key_len+1); rule->bufsize += key_len+1; pairs->count++; @@ -448,15 +448,15 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena char *pos; struct stat statbuf; - strlcpy(file, value, sizeof(file)); + util_strlcpy(file, value, sizeof(file)); pos = strchr(file, ' '); if (pos) pos[0] = '\0'; /* allow programs in /lib/udev called without the path */ if (strchr(file, '/') == NULL) { - strlcpy(file, UDEV_PREFIX "/lib/udev/", sizeof(file)); - strlcat(file, value, sizeof(file)); + util_strlcpy(file, UDEV_PREFIX "/lib/udev/", sizeof(file)); + util_strlcat(file, value, sizeof(file)); pos = strchr(file, ' '); if (pos) pos[0] = '\0'; @@ -750,8 +750,8 @@ int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_nam add_matching_files(udev, &name_list, SYSCONFDIR "/udev/rules.d", ".rules"); /* read dynamic/temporary rules */ - strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - strlcat(filename, "/.udev/rules.d", sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + util_strlcat(filename, "/.udev/rules.d", sizeof(filename)); if (stat(filename, &statbuf) != 0) { create_path(udev, filename); udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); diff --git a/udev/udev_sysdeps.c b/udev/udev_sysdeps.c deleted file mode 100644 index 73065f7674..0000000000 --- a/udev/udev_sysdeps.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2005-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include - -#include "udev_sysdeps.h" - -#ifndef HAVE_STRLCPY -size_t strlcpy(char *dst, const char *src, size_t size) -{ - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while ((ch = *p++)) { - if (bytes+1 < size) - *q++ = ch; - bytes++; - } - - /* If size == 0 there is no space for a final null... */ - if (size) - *q = '\0'; - return bytes; -} - -size_t strlcat(char *dst, const char *src, size_t size) -{ - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while (bytes < size && *q) { - q++; - bytes++; - } - if (bytes == size) - return (bytes + strlen(src)); - - while ((ch = *p++)) { - if (bytes+1 < size) - *q++ = ch; - bytes++; - } - - *q = '\0'; - return bytes; -} -#endif /* HAVE_STRLCPY */ diff --git a/udev/udev_sysdeps.h b/udev/udev_sysdeps.h index 15387dcebd..eaeab86f6b 100644 --- a/udev/udev_sysdeps.h +++ b/udev/udev_sysdeps.h @@ -46,11 +46,5 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) #define IN_MOVE 0 #define IN_CLOSE_WRITE 0 -#endif - -#ifndef HAVE_STRLCPY -extern size_t strlcpy(char *dst, const char *src, size_t size); -extern size_t strlcat(char *dst, const char *src, size_t size); -#endif - +#endif /* HAVE_INOTIFY */ #endif diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c index 6b9f9dac3a..0d4a971188 100644 --- a/udev/udev_sysfs.c +++ b/udev/udev_sysfs.c @@ -71,17 +71,17 @@ void sysfs_device_set_values(struct udev *udev, { char *pos; - strlcpy(dev->devpath, devpath, sizeof(dev->devpath)); + util_strlcpy(dev->devpath, devpath, sizeof(dev->devpath)); if (subsystem != NULL) - strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); + util_strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); if (driver != NULL) - strlcpy(dev->driver, driver, sizeof(dev->driver)); + util_strlcpy(dev->driver, driver, sizeof(dev->driver)); /* set kernel name */ pos = strrchr(dev->devpath, '/'); if (pos == NULL) return; - strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); + util_strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); dbg(udev, "kernel='%s'\n", dev->kernel); /* some devices have '!' in their name, change that to '/' */ @@ -96,7 +96,7 @@ void sysfs_device_set_values(struct udev *udev, pos = &dev->kernel[strlen(dev->kernel)]; while (isdigit(pos[-1])) pos--; - strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); + util_strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); dbg(udev, "kernel_number='%s'\n", dev->kernel_number); } @@ -108,8 +108,8 @@ int sysfs_resolve_link(struct udev *udev, char *devpath, size_t size) int i; int back; - strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - strlcat(link_path, devpath, sizeof(link_path)); + util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); + util_strlcat(link_path, devpath, sizeof(link_path)); len = readlink(link_path, link_target, sizeof(link_target)); if (len <= 0) return -1; @@ -127,8 +127,8 @@ int sysfs_resolve_link(struct udev *udev, char *devpath, size_t size) pos[0] = '\0'; } dbg(udev, "after moving back '%s'\n", devpath); - strlcat(devpath, "/", size); - strlcat(devpath, &link_target[back * 3], size); + util_strlcat(devpath, "/", size); + util_strlcat(devpath, &link_target[back * 3], size); return 0; } @@ -155,7 +155,7 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) return NULL; dbg(udev, "open '%s'\n", devpath); - strlcpy(devpath_real, devpath, sizeof(devpath_real)); + util_strlcpy(devpath_real, devpath, sizeof(devpath_real)); util_remove_trailing_chars(devpath_real, '/'); if (devpath[0] == '\0' ) return NULL; @@ -169,8 +169,8 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) } /* if we got a link, resolve it to the real device */ - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath_real, sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, devpath_real, sizeof(path)); if (lstat(path, &statbuf) != 0) { dbg(udev, "stat '%s' failed: %s\n", path, strerror(errno)); return NULL; @@ -198,9 +198,9 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) sysfs_device_set_values(udev, dev, devpath_real, NULL, NULL); /* get subsystem name */ - strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - strlcat(link_path, dev->devpath, sizeof(link_path)); - strlcat(link_path, "/subsystem", sizeof(link_path)); + util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); + util_strlcat(link_path, dev->devpath, sizeof(link_path)); + util_strlcat(link_path, "/subsystem", sizeof(link_path)); len = readlink(link_path, link_target, sizeof(link_target)); if (len > 0) { /* get subsystem from "subsystem" link */ @@ -208,36 +208,36 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) dbg(udev, "subsystem link '%s' points to '%s'\n", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) - strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); + util_strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); } else if (strstr(dev->devpath, "/drivers/") != NULL) { - strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); + util_strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/module/", 8) == 0) { - strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); + util_strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/subsystem/", 11) == 0) { pos = strrchr(dev->devpath, '/'); if (pos == &dev->devpath[10]) - strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); + util_strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/class/", 7) == 0) { pos = strrchr(dev->devpath, '/'); if (pos == &dev->devpath[6]) - strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); + util_strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); } else if (strncmp(dev->devpath, "/bus/", 5) == 0) { pos = strrchr(dev->devpath, '/'); if (pos == &dev->devpath[4]) - strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); + util_strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); } /* get driver name */ - strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - strlcat(link_path, dev->devpath, sizeof(link_path)); - strlcat(link_path, "/driver", sizeof(link_path)); + util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); + util_strlcat(link_path, dev->devpath, sizeof(link_path)); + util_strlcat(link_path, "/driver", sizeof(link_path)); len = readlink(link_path, link_target, sizeof(link_target)); if (len > 0) { link_target[len] = '\0'; dbg(udev, "driver link '%s' points to '%s'\n", link_path, link_target); pos = strrchr(link_target, '/'); if (pos != NULL) - strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); + util_strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); } dbg(udev, "add to cache 'devpath=%s', subsystem='%s', driver='%s'\n", dev->devpath, dev->subsystem, dev->driver); @@ -257,7 +257,7 @@ struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_dev if (dev->parent != NULL) return dev->parent; - strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); + util_strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); dbg(udev, "'%s'\n", parent_devpath); /* strip last element */ @@ -288,8 +288,8 @@ struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_dev return dev->parent; device_link: - strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - strlcat(parent_devpath, "/device", sizeof(parent_devpath)); + util_strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); + util_strlcat(parent_devpath, "/device", sizeof(parent_devpath)); if (sysfs_resolve_link(udev, parent_devpath, sizeof(parent_devpath)) != 0) return NULL; @@ -324,13 +324,13 @@ char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *a size_t sysfs_len; dbg(udev, "open '%s'/'%s'\n", devpath, attr_name); - sysfs_len = strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); + sysfs_len = util_strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); if(sysfs_len >= sizeof(path_full)) sysfs_len = sizeof(path_full) - 1; path = &path_full[sysfs_len]; - strlcat(path_full, devpath, sizeof(path_full)); - strlcat(path_full, "/", sizeof(path_full)); - strlcat(path_full, attr_name, sizeof(path_full)); + util_strlcat(path_full, devpath, sizeof(path_full)); + util_strlcat(path_full, "/", sizeof(path_full)); + util_strlcat(path_full, attr_name, sizeof(path_full)); /* look for attribute in cache */ list_for_each_entry(attr_loop, &attr_list, node) { @@ -346,7 +346,7 @@ char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *a if (attr == NULL) return NULL; memset(attr, 0x00, sizeof(struct sysfs_attr)); - strlcpy(attr->path, path, sizeof(attr->path)); + util_strlcpy(attr->path, path, sizeof(attr->path)); dbg(udev, "add to cache '%s'\n", path_full); list_add(&attr->node, &attr_list); @@ -367,7 +367,7 @@ char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *a pos = strrchr(link_target, '/'); if (pos != NULL) { dbg(udev, "cache '%s' with link value '%s'\n", path_full, value); - strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); + util_strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); attr->value = attr->value_local; } } @@ -399,7 +399,7 @@ char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *a value[size] = '\0'; util_remove_trailing_chars(value, '\n'); dbg(udev, "cache '%s' with attribute value '%s'\n", path_full, value); - strlcpy(attr->value_local, value, sizeof(attr->value_local)); + util_strlcpy(attr->value_local, value, sizeof(attr->value_local)); attr->value = attr->value_local; out: @@ -413,30 +413,30 @@ int sysfs_lookup_devpath_by_subsys_id(struct udev *udev, char *devpath_full, siz char *path; struct stat statbuf; - sysfs_len = strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); + sysfs_len = util_strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); path = &path_full[sysfs_len]; if (strcmp(subsystem, "subsystem") == 0) { - strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); + util_strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); + util_strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; - strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); + util_strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + util_strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; goto out; - strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); + util_strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); + util_strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; } if (strcmp(subsystem, "module") == 0) { - strlcpy(path, "/module/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); + util_strlcpy(path, "/module/", sizeof(path_full) - sysfs_len); + util_strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; goto out; @@ -446,46 +446,46 @@ int sysfs_lookup_devpath_by_subsys_id(struct udev *udev, char *devpath_full, siz char subsys[NAME_SIZE]; char *driver; - strlcpy(subsys, id, sizeof(subsys)); + util_strlcpy(subsys, id, sizeof(subsys)); driver = strchr(subsys, ':'); if (driver != NULL) { driver[0] = '\0'; driver = &driver[1]; - strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); - strlcat(path, subsys, sizeof(path_full) - sysfs_len); - strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); - strlcat(path, driver, sizeof(path_full) - sysfs_len); + util_strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); + util_strlcat(path, subsys, sizeof(path_full) - sysfs_len); + util_strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); + util_strlcat(path, driver, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; - strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); - strlcat(path, subsys, sizeof(path_full) - sysfs_len); - strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); - strlcat(path, driver, sizeof(path_full) - sysfs_len); + util_strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + util_strlcat(path, subsys, sizeof(path_full) - sysfs_len); + util_strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); + util_strlcat(path, driver, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; } goto out; } - strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); - strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); + util_strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); + util_strlcat(path, subsystem, sizeof(path_full) - sysfs_len); + util_strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); + util_strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; - strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); - strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); + util_strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); + util_strlcat(path, subsystem, sizeof(path_full) - sysfs_len); + util_strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); + util_strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; - strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); - strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - strlcat(path, "/", sizeof(path_full) - sysfs_len); - strlcat(path, id, sizeof(path_full) - sysfs_len); + util_strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); + util_strlcat(path, subsystem, sizeof(path_full) - sysfs_len); + util_strlcat(path, "/", sizeof(path_full) - sysfs_len); + util_strlcat(path, id, sizeof(path_full) - sysfs_len); if (stat(path_full, &statbuf) == 0) goto found; out: @@ -493,6 +493,6 @@ out: found: if (S_ISLNK(statbuf.st_mode)) sysfs_resolve_link(udev, path, sizeof(path_full) - sysfs_len); - strlcpy(devpath_full, path, len); + util_strlcpy(devpath_full, path, len); return 1; } diff --git a/udev/udev_utils.c b/udev/udev_utils.c index 669e4f3419..c051b20abd 100644 --- a/udev/udev_utils.c +++ b/udev/udev_utils.c @@ -55,7 +55,7 @@ struct name_entry *name_list_add(struct udev *udev, struct list_head *name_list, if (name_new == NULL) return NULL; memset(name_new, 0x00, sizeof(struct name_entry)); - strlcpy(name_new->name, name, sizeof(name_new->name)); + util_strlcpy(name_new->name, name, sizeof(name_new->name)); dbg(udev, "adding '%s'\n", name_new->name); list_add_tail(&name_new->node, &name_loop->node); diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c index 19b0f22ba8..abe17eb300 100644 --- a/udev/udev_utils_file.c +++ b/udev/udev_utils_file.c @@ -36,7 +36,7 @@ int create_path(struct udev *udev, const char *path) struct stat stats; int ret; - strlcpy(p, path, sizeof(p)); + util_strlcpy(p, path, sizeof(p)); pos = strrchr(p, '/'); if (pos == p || pos == NULL) return 0; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 402fa76e8d..172d5638c6 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -38,8 +38,8 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c DIR *dir; struct dirent *dent; - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, devpath, sizeof(path)); dir = opendir(path); if (dir != NULL) { @@ -58,9 +58,9 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c if (strcmp(dent->d_name, "dev") == 0) continue; - strlcpy(filename, path, sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, dent->d_name, sizeof(filename)); + util_strlcpy(filename, path, sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, dent->d_name, sizeof(filename)); if (lstat(filename, &statbuf) != 0) continue; if (S_ISLNK(statbuf.st_mode)) @@ -69,7 +69,7 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c attr_value = sysfs_attr_get_value(udev, devpath, dent->d_name); if (attr_value == NULL) continue; - len = strlcpy(value, attr_value, sizeof(value)); + len = util_strlcpy(value, attr_value, sizeof(value)); if(len >= sizeof(value)) len = sizeof(value) - 1; dbg(udev, "attr '%s'='%s'(%zi)\n", dent->d_name, value, len); @@ -191,9 +191,9 @@ static int lookup_device_by_name(struct udev *udev, struct udevice **udevice, co info(udev, "found db entry '%s'\n", device->name); /* make sure, we don't get a link of a different device */ - strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - strlcat(filename, "/", sizeof(filename)); - strlcat(filename, name, sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, name, sizeof(filename)); if (stat(filename, &statbuf) != 0) goto next; if (major(udevice_loop->devt) > 0 && udevice_loop->devt != statbuf.st_rdev) { @@ -286,18 +286,18 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case 'n': /* remove /dev if given */ if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) == 0) - strlcpy(name, &optarg[strlen(udev_get_dev_path(udev))+1], sizeof(name)); + util_strlcpy(name, &optarg[strlen(udev_get_dev_path(udev))+1], sizeof(name)); else - strlcpy(name, optarg, sizeof(name)); + util_strlcpy(name, optarg, sizeof(name)); util_remove_trailing_chars(name, '/'); dbg(udev, "name: %s\n", name); break; case 'p': /* remove /sys if given */ if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) == 0) - strlcpy(path, &optarg[strlen(udev_get_sys_path(udev))], sizeof(path)); + util_strlcpy(path, &optarg[strlen(udev_get_sys_path(udev))], sizeof(path)); else - strlcpy(path, optarg, sizeof(path)); + util_strlcpy(path, optarg, sizeof(path)); util_remove_trailing_chars(path, '/'); /* possibly resolve to real devpath */ @@ -306,16 +306,16 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) char *pos; /* also check if the parent is a link */ - strlcpy(temp, path, sizeof(temp)); + util_strlcpy(temp, path, sizeof(temp)); pos = strrchr(temp, '/'); if (pos != 0) { char tail[PATH_SIZE]; - strlcpy(tail, pos, sizeof(tail)); + util_strlcpy(tail, pos, sizeof(tail)); pos[0] = '\0'; if (sysfs_resolve_link(udev, temp, sizeof(temp)) == 0) { - strlcpy(path, temp, sizeof(path)); - strlcat(path, tail, sizeof(path)); + util_strlcpy(path, temp, sizeof(path)); + util_strlcat(path, tail, sizeof(path)); } } } @@ -353,7 +353,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) break; case 'd': action = ACTION_DEVICE_ID_FILE; - strlcpy(name, optarg, sizeof(name)); + util_strlcpy(name, optarg, sizeof(name)); break; case 'a': action = ACTION_ATTRIBUTE_WALK; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index c6c95a1ddc..ed67bbbdfb 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -107,8 +107,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } } - strlcpy(queuename, udev_get_dev_path(udev), sizeof(queuename)); - strlcat(queuename, "/.udev/queue", sizeof(queuename)); + util_strlcpy(queuename, udev_get_dev_path(udev), sizeof(queuename)); + util_strlcat(queuename, "/.udev/queue", sizeof(queuename)); loop = timeout * LOOP_PER_SECOND; while (loop--) { @@ -129,8 +129,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } /* read current udev seqnum */ - strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); fd = open(filename, O_RDONLY); if (fd < 0) goto exit; @@ -143,8 +143,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) info(udev, "udev seqnum = %llu\n", seq_udev); /* read current kernel seqnum */ - strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); - strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); + util_strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); fd = open(filename, O_RDONLY); if (fd < 0) goto exit; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 994a354960..b6fccf34e7 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -42,9 +42,9 @@ static int import_uevent_var(struct udev *udev, const char *devpath) int rc = -1; /* read uevent file */ - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/uevent", sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, devpath, sizeof(path)); + util_strlcat(path, "/uevent", sizeof(path)); fd = open(path, O_RDONLY); if (fd < 0) goto out; @@ -163,11 +163,11 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) } if (subsystem != NULL) - strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); + util_strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); /* override built-in sysfs device */ udevice->dev = dev; - strlcpy(udevice->action, action, sizeof(udevice->action)); + util_strlcpy(udevice->action, action, sizeof(udevice->action)); udevice->devt = udev_device_get_devt(udevice); /* simulate node creation with test flag */ @@ -191,7 +191,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) list_for_each_entry(name_loop, &udevice->run_list, node) { char program[PATH_SIZE]; - strlcpy(program, name_loop->name, sizeof(program)); + util_strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udevice, program, sizeof(program)); info(udev, "run: '%s'\n", program); } diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 6d01040e01..04fb9bcbcc 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -71,14 +71,14 @@ static int device_list_insert(struct udev *udev, const char *path) dbg(udev, "add '%s'\n" , path); /* we only have a device, if we have an uevent file */ - strlcpy(filename, path, sizeof(filename)); - strlcat(filename, "/uevent", sizeof(filename)); + util_strlcpy(filename, path, sizeof(filename)); + util_strlcat(filename, "/uevent", sizeof(filename)); if (stat(filename, &statbuf) < 0) return -1; if (!(statbuf.st_mode & S_IWUSR)) return -1; - strlcpy(devpath, &path[strlen(udev_get_sys_path(udev))], sizeof(devpath)); + util_strlcpy(devpath, &path[strlen(udev_get_sys_path(udev))], sizeof(devpath)); /* resolve possible link to real target */ if (lstat(path, &statbuf) < 0) @@ -96,9 +96,9 @@ static void trigger_uevent(struct udev *udev, const char *devpath, const char *a char filename[PATH_SIZE]; int fd; - strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); - strlcat(filename, devpath, sizeof(filename)); - strlcat(filename, "/uevent", sizeof(filename)); + util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); + util_strlcat(filename, devpath, sizeof(filename)); + util_strlcat(filename, "/uevent", sizeof(filename)); if (verbose) printf("%s\n", devpath); @@ -156,9 +156,9 @@ static int pass_to_socket(struct udev *udev, const char *devpath, const char *ac bufpos++; /* add subsystem */ - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/subsystem", sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, devpath, sizeof(path)); + util_strlcat(path, "/subsystem", sizeof(path)); len = readlink(path, link_target, sizeof(link_target)); if (len > 0) { char *pos; @@ -174,10 +174,10 @@ static int pass_to_socket(struct udev *udev, const char *devpath, const char *ac /* add symlinks and node name */ path[0] = '\0'; list_for_each_entry(name_loop, &udevice->symlink_list, node) { - strlcat(path, udev_get_dev_path(udev), sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, name_loop->name, sizeof(path)); - strlcat(path, " ", sizeof(path)); + util_strlcat(path, udev_get_dev_path(udev), sizeof(path)); + util_strlcat(path, "/", sizeof(path)); + util_strlcat(path, name_loop->name, sizeof(path)); + util_strlcat(path, " ", sizeof(path)); } util_remove_trailing_chars(path, ' '); if (path[0] != '\0') { @@ -185,17 +185,17 @@ static int pass_to_socket(struct udev *udev, const char *devpath, const char *ac bufpos++; } if (udevice->name[0] != '\0') { - strlcpy(path, udev_get_dev_path(udev), sizeof(path)); - strlcat(path, "/", sizeof(path)); - strlcat(path, udevice->name, sizeof(path)); + util_strlcpy(path, udev_get_dev_path(udev), sizeof(path)); + util_strlcat(path, "/", sizeof(path)); + util_strlcat(path, udevice->name, sizeof(path)); bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path); bufpos++; } /* add keys from device "uevent" file */ - strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - strlcat(path, devpath, sizeof(path)); - strlcat(path, "/uevent", sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, devpath, sizeof(path)); + util_strlcat(path, "/uevent", sizeof(path)); fd = open(path, O_RDONLY); if (fd >= 0) { char value[4096]; @@ -214,7 +214,7 @@ static int pass_to_socket(struct udev *udev, const char *devpath, const char *ac if (next == NULL) break; next[0] = '\0'; - bufpos += strlcpy(&buf[bufpos], key, sizeof(buf) - bufpos-1); + bufpos += util_strlcpy(&buf[bufpos], key, sizeof(buf) - bufpos-1); bufpos++; key = &next[1]; } @@ -223,7 +223,7 @@ static int pass_to_socket(struct udev *udev, const char *devpath, const char *ac /* add keys from database */ list_for_each_entry(name_loop, &udevice->env_list, node) { - bufpos += strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); + bufpos += util_strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); bufpos++; } if (bufpos > sizeof(buf)) @@ -289,7 +289,7 @@ static int attr_match(const char *path, const char *attr_value) char file[PATH_SIZE]; char *match_value; - strlcpy(attr, attr_value, sizeof(attr)); + util_strlcpy(attr, attr_value, sizeof(attr)); /* separate attr and match value */ match_value = strchr(attr, '='); @@ -298,9 +298,9 @@ static int attr_match(const char *path, const char *attr_value) match_value = &match_value[1]; } - strlcpy(file, path, sizeof(file)); - strlcat(file, "/", sizeof(file)); - strlcat(file, attr, sizeof(file)); + util_strlcpy(file, path, sizeof(file)); + util_strlcat(file, "/", sizeof(file)); + util_strlcat(file, attr, sizeof(file)); if (match_value != NULL) { /* match file content */ @@ -369,9 +369,9 @@ static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type else return; - strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - strlcat(base, "/", sizeof(base)); - strlcat(base, subsys, sizeof(base)); + util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); + util_strlcat(base, "/", sizeof(base)); + util_strlcat(base, subsys, sizeof(base)); dir = opendir(base); if (dir != NULL) { @@ -387,9 +387,9 @@ static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type if (subsystem_filtered(dent->d_name)) continue; - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); + util_strlcpy(dirname, base, sizeof(dirname)); + util_strlcat(dirname, "/", sizeof(dirname)); + util_strlcat(dirname, dent->d_name, sizeof(dirname)); if (scan == SCAN_SUBSYSTEM) { if (attr_filtered(dirname)) @@ -400,7 +400,7 @@ static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type continue; } - strlcat(dirname, subdir, sizeof(dirname)); + util_strlcat(dirname, subdir, sizeof(dirname)); /* look for devices/drivers */ dir2 = opendir(dirname); @@ -411,9 +411,9 @@ static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type if (dent2->d_name[0] == '.') continue; - strlcpy(dirname2, dirname, sizeof(dirname2)); - strlcat(dirname2, "/", sizeof(dirname2)); - strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + util_strlcpy(dirname2, dirname, sizeof(dirname2)); + util_strlcat(dirname2, "/", sizeof(dirname2)); + util_strlcat(dirname2, dent2->d_name, sizeof(dirname2)); if (attr_filtered(dirname2)) continue; device_list_insert(udev, dirname2); @@ -434,8 +434,8 @@ static void scan_block(struct udev *udev) if (subsystem_filtered("block")) return; - strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - strlcat(base, "/block", sizeof(base)); + util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); + util_strlcat(base, "/block", sizeof(base)); dir = opendir(base); if (dir != NULL) { @@ -447,9 +447,9 @@ static void scan_block(struct udev *udev) if (dent->d_name[0] == '.') continue; - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); + util_strlcpy(dirname, base, sizeof(dirname)); + util_strlcat(dirname, "/", sizeof(dirname)); + util_strlcat(dirname, dent->d_name, sizeof(dirname)); if (attr_filtered(dirname)) continue; if (device_list_insert(udev, dirname) != 0) @@ -467,9 +467,9 @@ static void scan_block(struct udev *udev) if (!strcmp(dent2->d_name,"device")) continue; - strlcpy(dirname2, dirname, sizeof(dirname2)); - strlcat(dirname2, "/", sizeof(dirname2)); - strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + util_strlcpy(dirname2, dirname, sizeof(dirname2)); + util_strlcat(dirname2, "/", sizeof(dirname2)); + util_strlcat(dirname2, dent2->d_name, sizeof(dirname2)); if (attr_filtered(dirname2)) continue; device_list_insert(udev, dirname2); @@ -487,8 +487,8 @@ static void scan_class(struct udev *udev) DIR *dir; struct dirent *dent; - strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - strlcat(base, "/class", sizeof(base)); + util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); + util_strlcat(base, "/class", sizeof(base)); dir = opendir(base); if (dir != NULL) { @@ -503,9 +503,9 @@ static void scan_class(struct udev *udev) if (subsystem_filtered(dent->d_name)) continue; - strlcpy(dirname, base, sizeof(dirname)); - strlcat(dirname, "/", sizeof(dirname)); - strlcat(dirname, dent->d_name, sizeof(dirname)); + util_strlcpy(dirname, base, sizeof(dirname)); + util_strlcat(dirname, "/", sizeof(dirname)); + util_strlcat(dirname, dent->d_name, sizeof(dirname)); dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { @@ -517,9 +517,9 @@ static void scan_class(struct udev *udev) if (!strcmp(dent2->d_name, "device")) continue; - strlcpy(dirname2, dirname, sizeof(dirname2)); - strlcat(dirname2, "/", sizeof(dirname2)); - strlcat(dirname2, dent2->d_name, sizeof(dirname2)); + util_strlcpy(dirname2, dirname, sizeof(dirname2)); + util_strlcat(dirname2, "/", sizeof(dirname2)); + util_strlcat(dirname2, dent2->d_name, sizeof(dirname2)); if (attr_filtered(dirname2)) continue; device_list_insert(udev, dirname2); @@ -537,8 +537,8 @@ static void scan_failed(struct udev *udev) DIR *dir; struct dirent *dent; - strlcpy(base, udev_get_dev_path(udev), sizeof(base)); - strlcat(base, "/.udev/failed", sizeof(base)); + util_strlcpy(base, udev_get_dev_path(udev), sizeof(base)); + util_strlcat(base, "/.udev/failed", sizeof(base)); dir = opendir(base); if (dir != NULL) { @@ -549,10 +549,10 @@ static void scan_failed(struct udev *udev) if (dent->d_name[0] == '.') continue; - start = strlcpy(device, udev_get_sys_path(udev), sizeof(device)); + start = util_strlcpy(device, udev_get_sys_path(udev), sizeof(device)); if(start >= sizeof(device)) start = sizeof(device) - 1; - strlcat(device, dent->d_name, sizeof(device)); + util_strlcat(device, dent->d_name, sizeof(device)); util_path_decode(&device[start]); device_list_insert(udev, device); } @@ -651,15 +651,15 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) saddr.sun_family = AF_LOCAL; if (sockpath[0] == '@') { /* abstract namespace socket requested */ - strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); + util_strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { /* existing socket file */ - strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); + util_strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); } else { /* no socket file, assume abstract namespace socket */ - strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); + util_strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); } } else if (env != NULL) { @@ -675,8 +675,8 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) struct stat statbuf; /* if we have /sys/subsystem, forget all the old stuff */ - strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - strlcat(base, "/subsystem", sizeof(base)); + util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); + util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { scan_subsystem(udev, "subsystem", SCAN_SUBSYSTEM); exec_list(udev, action, env); @@ -689,8 +689,8 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) scan_class(udev); /* scan "block" if it isn't a "class" */ - strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - strlcat(base, "/class/block", sizeof(base)); + util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); + util_strlcat(base, "/class/block", sizeof(base)); if (stat(base, &statbuf) != 0) scan_block(udev); exec_list(udev, action, env); diff --git a/udev/udevd.c b/udev/udevd.c index 06bfbd953e..59866afdee 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -141,7 +141,7 @@ static int udev_event_process(struct udevd_uevent_msg *msg) udevice = udev_device_init(msg->udev); if (udevice == NULL) return -1; - strlcpy(udevice->action, msg->action, sizeof(udevice->action)); + util_strlcpy(udevice->action, msg->action, sizeof(udevice->action)); sysfs_device_set_values(udevice->udev, udevice->dev, msg->devpath, msg->subsystem, msg->driver); udevice->devpath_old = msg->devpath_old; udevice->devt = msg->devt; @@ -176,10 +176,10 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", udev_get_dev_path(msg->udev), msg->seqnum); /* location of failed file */ - strlcpy(filename_failed, udev_get_dev_path(msg->udev), sizeof(filename_failed)); - strlcat(filename_failed, "/", sizeof(filename_failed)); - start = strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed)); - strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); + util_strlcpy(filename_failed, udev_get_dev_path(msg->udev), sizeof(filename_failed)); + util_strlcat(filename_failed, "/", sizeof(filename_failed)); + start = util_strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed)); + util_strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); util_path_encode(&filename_failed[start], sizeof(filename_failed) - start); switch (state) { @@ -196,10 +196,10 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st /* "move" event - rename failed file to current name, do not delete failed */ char filename_failed_old[PATH_SIZE]; - strlcpy(filename_failed_old, udev_get_dev_path(msg->udev), sizeof(filename_failed_old)); - strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); - start = strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old)); - strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); + util_strlcpy(filename_failed_old, udev_get_dev_path(msg->udev), sizeof(filename_failed_old)); + util_strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); + start = util_strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old)); + util_strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); util_path_encode(&filename_failed_old[start], sizeof(filename) - start); if (rename(filename_failed_old, filename_failed) == 0) @@ -287,8 +287,8 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg) export_event_state(msg, EVENT_QUEUED); info(msg->udev, "seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); - strlcpy(filename, udev_get_dev_path(msg->udev), sizeof(filename)); - strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(msg->udev), sizeof(filename)); + util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { char str[32]; @@ -755,8 +755,8 @@ static void export_initial_seqnum(struct udev *udev) char seqnum[32]; ssize_t len = 0; - strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); - strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); + util_strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); fd = open(filename, O_RDONLY); if (fd >= 0) { len = read(fd, seqnum, sizeof(seqnum)-1); @@ -766,8 +766,8 @@ static void export_initial_seqnum(struct udev *udev) strcpy(seqnum, "0\n"); len = 3; } - strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); create_path(udev, filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { @@ -986,8 +986,8 @@ int main(int argc, char *argv[]) IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ - strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - strlcat(filename, "/.udev/rules.d", sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + util_strlcat(filename, "/.udev/rules.d", sizeof(filename)); inotify_add_watch(inotify_fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } -- cgit v1.2.3-54-g00ecf From 17fcfb5972977b6a3aedca6ad2aa8d1fbfbc761d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Sep 2008 21:50:21 +0200 Subject: use size definitions from libudev --- configure.ac | 4 --- extras/edd_id/edd_id.c | 2 +- udev/lib/libudev-device.c | 6 ++--- udev/lib/libudev-private.h | 3 ++- udev/udev.h | 33 +++++++++--------------- udev/udev_db.c | 22 ++++++++-------- udev/udev_node.c | 24 +++++++++--------- udev/udev_rules.c | 62 +++++++++++++++++++++++----------------------- udev/udev_rules_parse.c | 12 ++++----- udev/udev_sysfs.c | 62 +++++++++++----------------------------------- udev/udev_utils.c | 4 +-- udev/udev_utils_file.c | 4 +-- udev/udevadm-info.c | 20 +++++++-------- udev/udevadm-settle.c | 6 ++--- udev/udevadm-test.c | 4 +-- udev/udevadm-trigger.c | 42 +++++++++++++++---------------- udev/udevd.c | 12 ++++----- 17 files changed, 139 insertions(+), 183 deletions(-) diff --git a/configure.ac b/configure.ac index c24da97a3b..43babff124 100644 --- a/configure.ac +++ b/configure.ac @@ -31,10 +31,6 @@ AC_CHECK_LIB(c, inotify_init, [AC_DEFINE([HAVE_INOTIFY], 1, [inotify available])], [AC_MSG_WARN([inotify support disabled])]) -AC_CHECK_LIB(c, strlcpy, - [AC_DEFINE([HAVE_STRLCPY], 1, [strlcpy available])], - []) - AC_ARG_WITH(udev-prefix, AS_HELP_STRING([--with-udev-prefix=DIR], [add prefix to internal udev path names]), [], [with_udev_prefix='${exec_prefix}']) diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 4ba60393a0..d7aec1488c 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -125,7 +125,7 @@ int main(int argc, char *argv[]) /* lookup signature in sysfs to determine the name */ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char file[PATH_SIZE]; + char file[UTIL_PATH_SIZE]; char sysfs_id_buf[256]; uint32_t sysfs_id; ssize_t size; diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index a182750e61..0405e1c98a 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -332,7 +332,7 @@ const char *udev_device_get_devname(struct udev_device *udev_device) **/ const char *udev_device_get_subsystem(struct udev_device *udev_device) { - char subsystem[UTIL_PATH_SIZE]; + char subsystem[UTIL_NAME_SIZE]; if (udev_device == NULL) return NULL; @@ -398,7 +398,7 @@ int udev_device_get_properties(struct udev_device *udev_device, if (udev_device == NULL) return -1; list_for_each_entry(name_loop, &udev_device->env_list, node) { - char name[UTIL_PATH_SIZE]; + char name[UTIL_NAME_SIZE]; char *val; strncpy(name, name_loop->name, sizeof(name)); @@ -416,7 +416,7 @@ int udev_device_get_properties(struct udev_device *udev_device, const char *udev_device_get_driver(struct udev_device *udev_device) { - char driver[UTIL_PATH_SIZE]; + char driver[UTIL_NAME_SIZE]; if (udev_device == NULL) return NULL; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 1f4abc07ba..8ca441639f 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -105,7 +105,8 @@ extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); /* libudev-utils */ #define UTIL_PATH_SIZE 1024 -#define UTIL_LINE_SIZE 1024 +#define UTIL_LINE_SIZE 2048 +#define UTIL_NAME_SIZE 512 struct util_name_entry { struct list_head node; char *name; diff --git a/udev/udev.h b/udev/udev.h index 0bf06bedba..ae50213fd8 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -30,12 +30,6 @@ #include "lib/libudev-private.h" #include "lib/list.h" -#define COMMENT_CHARACTER '#' -#define LINE_SIZE 512 -#define PATH_SIZE 512 -#define NAME_SIZE 256 -#define VALUE_SIZE 128 - #define ALLOWED_CHARS "#+-.:=@_" #define ALLOWED_CHARS_FILE ALLOWED_CHARS "/" #define ALLOWED_CHARS_INPUT ALLOWED_CHARS_FILE " $%?," @@ -60,11 +54,11 @@ struct udev_rules; struct sysfs_device { struct list_head node; /* for device cache */ struct sysfs_device *parent; /* already cached parent*/ - char devpath[PATH_SIZE]; - char subsystem[NAME_SIZE]; /* $class, $bus, drivers, module */ - char kernel[NAME_SIZE]; /* device instance name */ - char kernel_number[NAME_SIZE]; - char driver[NAME_SIZE]; /* device driver name */ + char devpath[UTIL_PATH_SIZE]; + char subsystem[UTIL_NAME_SIZE]; + char kernel[UTIL_NAME_SIZE]; /* device instance name */ + char kernel_number[UTIL_NAME_SIZE]; + char driver[UTIL_NAME_SIZE]; }; struct udevice { @@ -74,16 +68,16 @@ struct udevice { struct sysfs_device *dev; /* points to dev_local by default */ struct sysfs_device dev_local; struct sysfs_device *dev_parent; /* current parent device used for matching */ - char action[NAME_SIZE]; + char action[UTIL_NAME_SIZE]; char *devpath_old; /* node */ - char name[PATH_SIZE]; + char name[UTIL_PATH_SIZE]; struct list_head symlink_list; int symlink_final; - char owner[NAME_SIZE]; + char owner[UTIL_NAME_SIZE]; int owner_final; - char group[NAME_SIZE]; + char group[UTIL_NAME_SIZE]; int group_final; mode_t mode; int mode_final; @@ -93,11 +87,11 @@ struct udevice { struct list_head run_list; int run_final; struct list_head env_list; - char tmp_node[PATH_SIZE]; + char tmp_node[UTIL_PATH_SIZE]; int partitions; int ignore_device; int ignore_remove; - char program_result[PATH_SIZE]; + char program_result[UTIL_PATH_SIZE]; int link_priority; int event_timeout; int test_run; @@ -138,7 +132,6 @@ extern struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devp extern struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_device *dev); extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct udev *udev, struct sysfs_device *dev, const char *subsystem); extern char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *attr_name); -extern int sysfs_resolve_link(struct udev *udev, char *path, size_t size); extern int sysfs_lookup_devpath_by_subsys_id(struct udev *udev, char *devpath, size_t len, const char *subsystem, const char *id); /* udev_node.c */ @@ -158,11 +151,9 @@ extern int udev_db_get_all_entries(struct udev *udevconst, struct list_head *nam /* udev_utils.c */ struct name_entry { struct list_head node; - char name[PATH_SIZE]; + char name[UTIL_PATH_SIZE]; unsigned int ignore_error:1; }; - -extern int log_priority(const char *priority); extern struct name_entry *name_list_add(struct udev *udev, struct list_head *name_list, const char *name, int sort); extern struct name_entry *name_list_key_add(struct udev *udev, struct list_head *name_list, const char *key, const char *value); extern int name_list_key_remove(struct udev *udev, struct list_head *name_list, const char *key); diff --git a/udev/udev_db.c b/udev/udev_db.c index 763178d50c..432aa6cbb8 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -44,8 +44,8 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f /* reverse mapping from the device file name to the devpath */ static int name_index(struct udev *udev, const char *devpath, const char *name, int add) { - char device[PATH_SIZE]; - char filename[PATH_SIZE * 2]; + char device[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE * 2]; size_t start; int fd; @@ -96,7 +96,7 @@ int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list info(udev, "found index directory '%s'\n", dirname); while (1) { struct dirent *ent; - char device[PATH_SIZE]; + char device[UTIL_PATH_SIZE]; ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') @@ -116,8 +116,8 @@ out: int udev_db_rename(struct udev *udev, const char *devpath_old, const char *devpath) { - char filename[PATH_SIZE]; - char filename_old[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char filename_old[UTIL_PATH_SIZE]; devpath_to_db_path(udev, devpath_old, filename_old, sizeof(filename_old)); devpath_to_db_path(udev, devpath, filename, sizeof(filename)); @@ -126,7 +126,7 @@ int udev_db_rename(struct udev *udev, const char *devpath_old, const char *devpa int udev_db_add_device(struct udevice *udevice) { - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; if (udevice->test_run) return 0; @@ -190,8 +190,8 @@ int udev_db_add_device(struct udevice *udevice) int udev_db_get_device(struct udevice *udevice, const char *devpath) { struct stat stats; - char filename[PATH_SIZE]; - char line[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char line[UTIL_PATH_SIZE]; unsigned int maj, min; char *bufline; char *buf; @@ -207,7 +207,7 @@ int udev_db_get_device(struct udevice *udevice, const char *devpath) return -1; } if ((stats.st_mode & S_IFMT) == S_IFLNK) { - char target[NAME_SIZE]; + char target[UTIL_NAME_SIZE]; int target_len; info(udevice->udev, "found a symlink as db file\n"); @@ -277,7 +277,7 @@ int udev_db_get_device(struct udevice *udevice, const char *devpath) int udev_db_delete_device(struct udevice *udevice) { - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; struct name_entry *name_loop; if (udevice->test_run) @@ -308,7 +308,7 @@ int udev_db_get_all_entries(struct udev *udev, struct list_head *name_list) while (1) { struct dirent *ent; - char device[PATH_SIZE]; + char device[UTIL_PATH_SIZE]; ent = readdir(dir); if (ent == NULL || ent->d_name[0] == '\0') diff --git a/udev/udev_node.c b/udev/udev_node.c index 0319b2f875..8971f9ff3f 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -34,7 +34,7 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) { - char file_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; + char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; struct stat stats; int preserve = 0; int err = 0; @@ -104,8 +104,8 @@ exit: static int node_symlink(struct udevice *udevice, const char *node, const char *slink) { struct stat stats; - char target[PATH_SIZE] = ""; - char slink_tmp[PATH_SIZE + sizeof(TMP_FILE_EXT)]; + char target[UTIL_PATH_SIZE] = ""; + char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; int i = 0; int tail = 0; int len; @@ -140,7 +140,7 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s } } } else if (S_ISLNK(stats.st_mode)) { - char buf[PATH_SIZE]; + char buf[UTIL_PATH_SIZE]; info(udevice->udev, "found existing symlink '%s'\n", slink); len = readlink(slink, buf, sizeof(buf)); @@ -186,11 +186,11 @@ exit: static int update_link(struct udevice *udevice, const char *name) { LIST_HEAD(name_list); - char slink[PATH_SIZE]; - char node[PATH_SIZE]; + char slink[UTIL_PATH_SIZE]; + char node[UTIL_PATH_SIZE]; struct udevice *udevice_db; struct name_entry *device; - char target[PATH_MAX] = ""; + char target[UTIL_PATH_SIZE] = ""; int count; int priority = 0; int rc = 0; @@ -271,7 +271,7 @@ out: void udev_node_update_symlinks(struct udevice *udevice, struct udevice *udevice_old) { struct name_entry *name_loop; - char symlinks[PATH_SIZE] = ""; + char symlinks[UTIL_PATH_SIZE] = ""; list_for_each_entry(name_loop, &udevice->symlink_list, node) { info(udevice->udev, "update symlink '%s' of '%s'\n", name_loop->name, udevice->dev->devpath); @@ -321,7 +321,7 @@ void udev_node_update_symlinks(struct udevice *udevice, struct udevice *udevice_ int udev_node_add(struct udevice *udevice) { - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; uid_t uid; gid_t gid; int i; @@ -371,7 +371,7 @@ int udev_node_add(struct udevice *udevice) /* create all_partitions if requested */ if (udevice->partitions) { - char partitionname[PATH_SIZE]; + char partitionname[UTIL_PATH_SIZE]; char *attr; int range; @@ -400,8 +400,8 @@ exit: int udev_node_remove(struct udevice *udevice) { - char filename[PATH_SIZE]; - char partitionname[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char partitionname[UTIL_PATH_SIZE]; struct stat stats; int retval = 0; int num; diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 72c859348e..d4dcb06801 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -123,8 +123,8 @@ static int run_program(struct udev *udev, const char *command, const char *subsy int outpipe[2] = {-1, -1}; int errpipe[2] = {-1, -1}; pid_t pid; - char arg[PATH_SIZE]; - char program[PATH_SIZE]; + char arg[UTIL_PATH_SIZE]; + char program[UTIL_PATH_SIZE]; char *argv[(sizeof(arg) / 2) + 1]; int devnull; int i; @@ -331,7 +331,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy static int import_keys_into_env(struct udevice *udevice, const char *buf, size_t bufsize) { - char line[LINE_SIZE]; + char line[UTIL_LINE_SIZE]; const char *bufline; char *linepos; char *variable; @@ -358,7 +358,7 @@ static int import_keys_into_env(struct udevice *udevice, const char *buf, size_t continue; /* see if this is a comment */ - if (bufline[0] == COMMENT_CHARACTER) + if (bufline[0] == '#') continue; if (count >= sizeof(line)) { @@ -429,7 +429,7 @@ static int import_parent_into_env(struct udevice *udevice, const char *filter) if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { dbg(udevice->udev, "import stored parent env '%s'\n", udev_parent->name); list_for_each_entry(name_loop, &udev_parent->env_list, node) { - char name[NAME_SIZE]; + char name[UTIL_NAME_SIZE]; char *pos; util_strlcpy(name, name_loop->name, sizeof(name)); @@ -512,7 +512,7 @@ int udev_rules_run(struct udevice *udevice) if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) { pass_env_to_socket(udevice->udev, &name_loop->name[strlen("socket:")], udevice->dev->devpath, udevice->action); } else { - char program[PATH_SIZE]; + char program[UTIL_PATH_SIZE]; util_strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udevice, program, sizeof(program)); @@ -528,8 +528,8 @@ int udev_rules_run(struct udevice *udevice) #define WAIT_LOOP_PER_SECOND 50 static int wait_for_file(struct udevice *udevice, const char *file, int timeout) { - char filepath[PATH_SIZE]; - char devicepath[PATH_SIZE] = ""; + char filepath[UTIL_PATH_SIZE]; + char devicepath[UTIL_PATH_SIZE] = ""; struct stat stats; int loop = timeout * WAIT_LOOP_PER_SECOND; @@ -566,7 +566,7 @@ static int wait_for_file(struct udevice *udevice, const char *file, int timeout) /* handle "[$SUBSYSTEM/$KERNEL]" lookup */ static int attr_get_by_subsys_id(struct udev *udev, const char *attrstr, char *devpath, size_t len, char **attr) { - char subsys[NAME_SIZE]; + char subsys[UTIL_NAME_SIZE]; char *pos; char *id; char *attrib; @@ -610,7 +610,7 @@ static int attr_subst_subdir(char *attr, size_t len) pos = strstr(attr, "/*/"); if (pos != NULL) { - char str[PATH_SIZE]; + char str[UTIL_PATH_SIZE]; DIR *dir; pos[1] = '\0'; @@ -643,8 +643,8 @@ static int attr_subst_subdir(char *attr, size_t len) void udev_rules_apply_format(struct udevice *udevice, char *string, size_t maxsize) { - char temp[PATH_SIZE]; - char temp2[PATH_SIZE]; + char temp[UTIL_PATH_SIZE]; + char temp2[UTIL_PATH_SIZE]; char *head, *tail, *pos, *cpos, *attr, *rest; int len; int i; @@ -825,7 +825,7 @@ found: if (attr == NULL) err(udevice->udev, "missing file parameter for attr\n"); else { - char devpath[PATH_SIZE]; + char devpath[UTIL_PATH_SIZE]; char *attrib; const char *value = NULL; size_t size; @@ -915,7 +915,7 @@ found: case SUBST_LINKS: if (!list_empty(&udevice->symlink_list)) { struct name_entry *name_loop; - char symlinks[PATH_SIZE] = ""; + char symlinks[UTIL_PATH_SIZE] = ""; list_for_each_entry(name_loop, &udevice->symlink_list, node) { util_strlcat(symlinks, name_loop->name, sizeof(symlinks)); @@ -971,7 +971,7 @@ static char *key_pair_name(struct udev_rule *rule, struct key_pair *pair) static int match_key(struct udev *udev, const char *key_name, struct udev_rule *rule, struct key *key, const char *val) { - char value[PATH_SIZE]; + char value[UTIL_PATH_SIZE]; char *key_value; char *pos; int match = 0; @@ -1070,8 +1070,8 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) if (rule->test.operation == KEY_OP_MATCH || rule->test.operation == KEY_OP_NOMATCH) { - char filename[PATH_SIZE]; - char devpath[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char devpath[UTIL_PATH_SIZE]; char *attr; struct stat statbuf; int match; @@ -1087,7 +1087,7 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) util_strlcat(filename, attr, sizeof(filename)); } } else if (filename[0] != '/') { - char tmp[PATH_SIZE]; + char tmp[UTIL_PATH_SIZE]; util_strlcpy(tmp, udev_get_sys_path(udevice->udev), sizeof(tmp)); util_strlcat(tmp, udevice->dev->devpath, sizeof(tmp)); @@ -1114,7 +1114,7 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) } if (rule->wait_for.operation != KEY_OP_UNSET) { - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; int found; util_strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); @@ -1132,10 +1132,10 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) pair->key.operation == KEY_OP_NOMATCH) { const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); - char devpath[PATH_SIZE]; + char devpath[UTIL_PATH_SIZE]; char *attrib; const char *value = NULL; - char val[VALUE_SIZE]; + char val[UTIL_NAME_SIZE]; size_t len; if (attr_get_by_subsys_id(udevice->udev, key_name, devpath, sizeof(devpath), &attrib)) { @@ -1188,7 +1188,7 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); const char *value; - char val[VALUE_SIZE]; + char val[UTIL_NAME_SIZE]; size_t len; value = sysfs_attr_get_value(udevice->udev, udevice->dev_parent->devpath, key_name); @@ -1226,8 +1226,8 @@ try_parent: /* execute external program */ if (rule->program.operation != KEY_OP_UNSET) { - char program[PATH_SIZE]; - char result[PATH_SIZE]; + char program[UTIL_PATH_SIZE]; + char result[UTIL_PATH_SIZE]; util_strlcpy(program, key_val(rule, &rule->program), sizeof(program)); udev_rules_apply_format(udevice, program, sizeof(program)); @@ -1262,7 +1262,7 @@ try_parent: /* import variables returned from program or or file into environment */ if (rule->import.operation != KEY_OP_UNSET) { - char import[PATH_SIZE]; + char import[UTIL_PATH_SIZE]; int rc = -1; util_strlcpy(import, key_val(rule, &rule->import), sizeof(import)); @@ -1291,13 +1291,13 @@ try_parent: struct key_pair *pair = &rule->env.keys[i]; if (pair->key.operation == KEY_OP_ASSIGN) { - char temp_value[NAME_SIZE]; + char temp_value[UTIL_NAME_SIZE]; const char *key_name = key_pair_name(rule, pair); const char *value = key_val(rule, &pair->key); /* make sure we don't write to the same string we possibly read from */ util_strlcpy(temp_value, value, sizeof(temp_value)); - udev_rules_apply_format(udevice, temp_value, NAME_SIZE); + udev_rules_apply_format(udevice, temp_value, sizeof(temp_value)); if (temp_value[0] == '\0') { name_list_key_remove(udevice->udev, &udevice->env_list, key_name); @@ -1321,10 +1321,10 @@ try_parent: if (pair->key.operation == KEY_OP_ASSIGN) { const char *key_name = key_pair_name(rule, pair); - char devpath[PATH_SIZE]; + char devpath[UTIL_PATH_SIZE]; char *attrib; - char attr[PATH_SIZE] = ""; - char value[NAME_SIZE]; + char attr[UTIL_PATH_SIZE] = ""; + char value[UTIL_NAME_SIZE]; FILE *f; if (attr_get_by_subsys_id(udevice->udev, key_name, devpath, sizeof(devpath), &attrib)) { @@ -1445,7 +1445,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL || rule->symlink.operation == KEY_OP_ADD)) { - char temp[PATH_SIZE]; + char temp[UTIL_PATH_SIZE]; char *pos, *next; int count; diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 1c5f36d491..a46eff98e6 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -204,7 +204,7 @@ static char *get_key_attribute(struct udev_rules *rules, char *str) static int add_rule_key(struct udev_rule *rule, struct key *key, enum key_operation operation, const char *value) { - size_t val_len = strnlen(value, PATH_SIZE); + size_t val_len = strnlen(value, UTIL_PATH_SIZE); key->operation = operation; @@ -218,7 +218,7 @@ static int add_rule_key(struct udev_rule *rule, struct key *key, static int add_rule_key_pair(struct udev_rules *rules, struct udev_rule *rule, struct key_pairs *pairs, enum key_operation operation, const char *key, const char *value) { - size_t key_len = strnlen(key, PATH_SIZE); + size_t key_len = strnlen(key, UTIL_PATH_SIZE); if (pairs->count >= PAIRS_MAX) { err(rules->udev, "skip, too many keys of the same type in a single rule\n"); @@ -239,7 +239,7 @@ static int add_rule_key_pair(struct udev_rules *rules, struct udev_rule *rule, s static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) { - char buf[sizeof(struct udev_rule) + LINE_SIZE]; + char buf[sizeof(struct udev_rule) + UTIL_LINE_SIZE]; struct udev_rule *rule; size_t rule_size; int valid; @@ -444,7 +444,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena rule->import_type = IMPORT_PARENT; } else { /* figure it out if it is executable */ - char file[PATH_SIZE]; + char file[UTIL_PATH_SIZE]; char *pos; struct stat statbuf; @@ -668,7 +668,7 @@ invalid: static int parse_file(struct udev_rules *rules, const char *filename) { - char line[LINE_SIZE]; + char line[UTIL_LINE_SIZE]; char *bufline; unsigned int lineno; char *buf; @@ -703,7 +703,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) continue; /* see if this is a comment */ - if (bufline[0] == COMMENT_CHARACTER) + if (bufline[0] == '#') continue; if (count >= sizeof(line)) { diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c index 0d4a971188..97dcd03111 100644 --- a/udev/udev_sysfs.c +++ b/udev/udev_sysfs.c @@ -35,9 +35,9 @@ static LIST_HEAD(attr_list); struct sysfs_attr { struct list_head node; - char path[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; char *value; /* points to value_local if value is cached */ - char value_local[NAME_SIZE]; + char value_local[UTIL_NAME_SIZE]; }; int sysfs_init(void) @@ -100,47 +100,15 @@ void sysfs_device_set_values(struct udev *udev, dbg(udev, "kernel_number='%s'\n", dev->kernel_number); } -int sysfs_resolve_link(struct udev *udev, char *devpath, size_t size) -{ - char link_path[PATH_SIZE]; - char link_target[PATH_SIZE]; - int len; - int i; - int back; - - util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - util_strlcat(link_path, devpath, sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len <= 0) - return -1; - link_target[len] = '\0'; - dbg(udev, "path link '%s' points to '%s'\n", devpath, link_target); - - for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) - ; - dbg(udev, "base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); - for (i = 0; i <= back; i++) { - char *pos = strrchr(devpath, '/'); - - if (pos == NULL) - return -1; - pos[0] = '\0'; - } - dbg(udev, "after moving back '%s'\n", devpath); - util_strlcat(devpath, "/", size); - util_strlcat(devpath, &link_target[back * 3], size); - return 0; -} - struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) { - char path[PATH_SIZE]; - char devpath_real[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; + char devpath_real[UTIL_PATH_SIZE]; struct sysfs_device *dev; struct sysfs_device *dev_loop; struct stat statbuf; - char link_path[PATH_SIZE]; - char link_target[PATH_SIZE]; + char link_path[UTIL_PATH_SIZE]; + char link_target[UTIL_PATH_SIZE]; int len; char *pos; @@ -176,7 +144,7 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) return NULL; } if (S_ISLNK(statbuf.st_mode)) { - if (sysfs_resolve_link(udev, devpath_real, sizeof(devpath_real)) != 0) + if (util_resolve_sys_link(udev, devpath_real, sizeof(devpath_real)) != 0) return NULL; /* now look for device in cache after path translation */ @@ -248,7 +216,7 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_device *dev) { - char parent_devpath[PATH_SIZE]; + char parent_devpath[UTIL_PATH_SIZE]; char *pos; dbg(udev, "open '%s'\n", dev->devpath); @@ -290,7 +258,7 @@ struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_dev device_link: util_strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); util_strlcat(parent_devpath, "/device", sizeof(parent_devpath)); - if (sysfs_resolve_link(udev, parent_devpath, sizeof(parent_devpath)) != 0) + if (util_resolve_sys_link(udev, parent_devpath, sizeof(parent_devpath)) != 0) return NULL; /* get parent and remember it */ @@ -313,9 +281,9 @@ struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct udev *udev, s char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *attr_name) { - char path_full[PATH_SIZE]; + char path_full[UTIL_PATH_SIZE]; const char *path; - char value[NAME_SIZE]; + char value[UTIL_NAME_SIZE]; struct sysfs_attr *attr_loop; struct sysfs_attr *attr; struct stat statbuf; @@ -357,7 +325,7 @@ char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *a if (S_ISLNK(statbuf.st_mode)) { /* links return the last element of the target path */ - char link_target[PATH_SIZE]; + char link_target[UTIL_PATH_SIZE]; int len; const char *pos; @@ -409,7 +377,7 @@ out: int sysfs_lookup_devpath_by_subsys_id(struct udev *udev, char *devpath_full, size_t len, const char *subsystem, const char *id) { size_t sysfs_len; - char path_full[PATH_SIZE]; + char path_full[UTIL_PATH_SIZE]; char *path; struct stat statbuf; @@ -443,7 +411,7 @@ int sysfs_lookup_devpath_by_subsys_id(struct udev *udev, char *devpath_full, siz } if (strcmp(subsystem, "drivers") == 0) { - char subsys[NAME_SIZE]; + char subsys[UTIL_NAME_SIZE]; char *driver; util_strlcpy(subsys, id, sizeof(subsys)); @@ -492,7 +460,7 @@ out: return 0; found: if (S_ISLNK(statbuf.st_mode)) - sysfs_resolve_link(udev, path, sizeof(path_full) - sysfs_len); + util_resolve_sys_link(udev, path, sizeof(path_full) - sysfs_len); util_strlcpy(devpath_full, path, len); return 1; } diff --git a/udev/udev_utils.c b/udev/udev_utils.c index c051b20abd..09b965ef3b 100644 --- a/udev/udev_utils.c +++ b/udev/udev_utils.c @@ -127,7 +127,7 @@ int add_matching_files(struct udev *udev, struct list_head *name_list, const cha { struct dirent *ent; DIR *dir; - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; dbg(udev, "open directory '%s'\n", dirname); dir = opendir(dirname); @@ -141,7 +141,7 @@ int add_matching_files(struct udev *udev, struct list_head *name_list, const cha if (ent == NULL || ent->d_name[0] == '\0') break; - if ((ent->d_name[0] == '.') || (ent->d_name[0] == COMMENT_CHARACTER)) + if ((ent->d_name[0] == '.') || (ent->d_name[0] == '#')) continue; /* look for file matching with specified suffix */ diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c index abe17eb300..1c7b07347b 100644 --- a/udev/udev_utils_file.c +++ b/udev/udev_utils_file.c @@ -31,7 +31,7 @@ int create_path(struct udev *udev, const char *path) { - char p[PATH_SIZE]; + char p[UTIL_PATH_SIZE]; char *pos; struct stat stats; int ret; @@ -67,7 +67,7 @@ int create_path(struct udev *udev, const char *path) int delete_path(struct udev *udev, const char *path) { - char p[PATH_SIZE]; + char p[UTIL_PATH_SIZE]; char *pos; int retval; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 172d5638c6..22f3d49d4b 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -34,7 +34,7 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const char *key) { - char path[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; @@ -45,9 +45,9 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { struct stat statbuf; - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; char *attr_value; - char value[NAME_SIZE]; + char value[UTIL_NAME_SIZE]; size_t len; if (dent->d_name[0] == '.') @@ -180,7 +180,7 @@ static int lookup_device_by_name(struct udev *udev, struct udevice **udevice, co /* select the device that seems to match */ list_for_each_entry(device, &name_list, node) { struct udevice *udevice_loop; - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; struct stat statbuf; udevice_loop = udev_device_init(udev); @@ -269,8 +269,8 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) QUERY_ALL, } query = QUERY_NONE; - char path[PATH_SIZE] = ""; - char name[PATH_SIZE] = ""; + char path[UTIL_PATH_SIZE] = ""; + char name[UTIL_PATH_SIZE] = ""; struct name_entry *name_loop; int rc = 0; @@ -301,19 +301,19 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) util_remove_trailing_chars(path, '/'); /* possibly resolve to real devpath */ - if (sysfs_resolve_link(udev, path, sizeof(path)) != 0) { - char temp[PATH_SIZE]; + if (util_resolve_sys_link(udev, path, sizeof(path)) != 0) { + char temp[UTIL_PATH_SIZE]; char *pos; /* also check if the parent is a link */ util_strlcpy(temp, path, sizeof(temp)); pos = strrchr(temp, '/'); if (pos != 0) { - char tail[PATH_SIZE]; + char tail[UTIL_PATH_SIZE]; util_strlcpy(tail, pos, sizeof(tail)); pos[0] = '\0'; - if (sysfs_resolve_link(udev, temp, sizeof(temp)) == 0) { + if (util_resolve_sys_link(udev, temp, sizeof(temp)) == 0) { util_strlcpy(path, temp, sizeof(path)); util_strlcat(path, tail, sizeof(path)); } diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index ed67bbbdfb..78ac47ff41 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -44,7 +44,7 @@ static void print_queue(struct udev *udev, const char *dir) printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n"); list_for_each_entry(item, &files, node) { - char target[NAME_SIZE]; + char target[UTIL_NAME_SIZE]; size_t len; const char *filename = strrchr(item->name, '/'); @@ -67,8 +67,8 @@ static void print_queue(struct udev *udev, const char *dir) int udevadm_settle(struct udev *udev, int argc, char *argv[]) { - char queuename[PATH_SIZE]; - char filename[PATH_SIZE]; + char queuename[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; unsigned long long seq_kernel; unsigned long long seq_udev; char seqnum[32]; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index b6fccf34e7..ba0852871a 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -33,7 +33,7 @@ static int import_uevent_var(struct udev *udev, const char *devpath) { - char path[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; static char value[4096]; /* must stay, used with putenv */ ssize_t size; int fd; @@ -189,7 +189,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) struct name_entry *name_loop; list_for_each_entry(name_loop, &udevice->run_list, node) { - char program[PATH_SIZE]; + char program[UTIL_PATH_SIZE]; util_strlcpy(program, name_loop->name, sizeof(program)); udev_rules_apply_format(udevice, program, sizeof(program)); diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 04fb9bcbcc..f0535f5eb0 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -64,8 +64,8 @@ static int delay_device(const char *devpath) static int device_list_insert(struct udev *udev, const char *path) { - char filename[PATH_SIZE]; - char devpath[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char devpath[UTIL_PATH_SIZE]; struct stat statbuf; dbg(udev, "add '%s'\n" , path); @@ -84,7 +84,7 @@ static int device_list_insert(struct udev *udev, const char *path) if (lstat(path, &statbuf) < 0) return -1; if (S_ISLNK(statbuf.st_mode)) - if (sysfs_resolve_link(udev, devpath, sizeof(devpath)) != 0) + if (util_resolve_sys_link(udev, devpath, sizeof(devpath)) != 0) return -1; name_list_add(udev, &device_list, devpath, 1); @@ -93,7 +93,7 @@ static int device_list_insert(struct udev *udev, const char *path) static void trigger_uevent(struct udev *udev, const char *devpath, const char *action) { - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; int fd; util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); @@ -125,9 +125,9 @@ static int pass_to_socket(struct udev *udev, const char *devpath, const char *ac char buf[4096]; size_t bufpos = 0; ssize_t count; - char path[PATH_SIZE]; + char path[UTIL_PATH_SIZE]; int fd; - char link_target[PATH_SIZE]; + char link_target[UTIL_PATH_SIZE]; int len; int err = 0; @@ -285,8 +285,8 @@ static int subsystem_filtered(const char *subsystem) static int attr_match(const char *path, const char *attr_value) { - char attr[NAME_SIZE]; - char file[PATH_SIZE]; + char attr[UTIL_NAME_SIZE]; + char file[UTIL_PATH_SIZE]; char *match_value; util_strlcpy(attr, attr_value, sizeof(attr)); @@ -304,7 +304,7 @@ static int attr_match(const char *path, const char *attr_value) if (match_value != NULL) { /* match file content */ - char value[NAME_SIZE]; + char value[UTIL_NAME_SIZE]; int fd; ssize_t size; @@ -357,7 +357,7 @@ enum scan_type { static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type scan) { - char base[PATH_SIZE]; + char base[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; const char *subdir; @@ -376,7 +376,7 @@ static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; + char dirname[UTIL_PATH_SIZE]; DIR *dir2; struct dirent *dent2; @@ -406,7 +406,7 @@ static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; + char dirname2[UTIL_PATH_SIZE]; if (dent2->d_name[0] == '.') continue; @@ -427,7 +427,7 @@ static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type static void scan_block(struct udev *udev) { - char base[PATH_SIZE]; + char base[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; @@ -440,7 +440,7 @@ static void scan_block(struct udev *udev) dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; + char dirname[UTIL_PATH_SIZE]; DIR *dir2; struct dirent *dent2; @@ -459,7 +459,7 @@ static void scan_block(struct udev *udev) dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; + char dirname2[UTIL_PATH_SIZE]; if (dent2->d_name[0] == '.') continue; @@ -483,7 +483,7 @@ static void scan_block(struct udev *udev) static void scan_class(struct udev *udev) { - char base[PATH_SIZE]; + char base[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; @@ -493,7 +493,7 @@ static void scan_class(struct udev *udev) dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[PATH_SIZE]; + char dirname[UTIL_PATH_SIZE]; DIR *dir2; struct dirent *dent2; @@ -509,7 +509,7 @@ static void scan_class(struct udev *udev) dir2 = opendir(dirname); if (dir2 != NULL) { for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[PATH_SIZE]; + char dirname2[UTIL_PATH_SIZE]; if (dent2->d_name[0] == '.') continue; @@ -533,7 +533,7 @@ static void scan_class(struct udev *udev) static void scan_failed(struct udev *udev) { - char base[PATH_SIZE]; + char base[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; @@ -543,7 +543,7 @@ static void scan_failed(struct udev *udev) dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char device[PATH_SIZE]; + char device[UTIL_PATH_SIZE]; size_t start; if (dent->d_name[0] == '.') @@ -671,7 +671,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) scan_failed(udev); exec_list(udev, action, env); } else { - char base[PATH_SIZE]; + char base[UTIL_PATH_SIZE]; struct stat statbuf; /* if we have /sys/subsystem, forget all the old stuff */ diff --git a/udev/udevd.c b/udev/udevd.c index 59866afdee..d64beef3a9 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -168,8 +168,8 @@ enum event_state { static void export_event_state(struct udevd_uevent_msg *msg, enum event_state state) { - char filename[PATH_SIZE]; - char filename_failed[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char filename_failed[UTIL_PATH_SIZE]; size_t start; /* location of queue file */ @@ -194,7 +194,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st case EVENT_FINISHED: if (msg->devpath_old != NULL) { /* "move" event - rename failed file to current name, do not delete failed */ - char filename_failed_old[PATH_SIZE]; + char filename_failed_old[UTIL_PATH_SIZE]; util_strlcpy(filename_failed_old, udev_get_dev_path(msg->udev), sizeof(filename_failed_old)); util_strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); @@ -279,7 +279,7 @@ static void udev_event_run(struct udevd_uevent_msg *msg) static void msg_queue_insert(struct udevd_uevent_msg *msg) { - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; int fd; msg->queue_time = time(NULL); @@ -346,7 +346,7 @@ static int compare_devpath(const char *running, const char *waiting) { int i; - for (i = 0; i < PATH_SIZE; i++) { + for (i = 0; i < UTIL_PATH_SIZE; i++) { /* identical device event found */ if (running[i] == '\0' && waiting[i] == '\0') return 1; @@ -750,7 +750,7 @@ static int init_uevent_netlink_sock(struct udev *udev) static void export_initial_seqnum(struct udev *udev) { - char filename[PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; int fd; char seqnum[32]; ssize_t len = 0; -- cgit v1.2.3-54-g00ecf From 4ad3a37f50ed3af4158cd0d0badbd146eb8e3500 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Sep 2008 17:08:12 +0200 Subject: udevadm: info - use "udev_device" --- udev/lib/Makefile.am | 1 - udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 42 ++++++++++-- udev/lib/libudev.h | 2 + udev/lib/list.h | 163 +++++++++------------------------------------- udev/lib/test-libudev.c | 18 +++++ udev/udevadm-info.c | 54 +++++++++------ 7 files changed, 124 insertions(+), 157 deletions(-) diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 000b3f73ca..4cbae2e4ca 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -20,7 +20,6 @@ include_HEADERS =\ libudev.h libudev_la_SOURCES =\ - exported_symbools \ libudev-private.h \ libudev.c \ libudev-util.c \ diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 129cb9c36f..058b79afa8 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -8,6 +8,7 @@ udev_set_log_priority udev_get_sys_path udev_get_dev_path udev_device_new_from_devpath +udev_device_new_from_parent udev_device_ref udev_device_unref udev_device_get_udev diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 0405e1c98a..f3f20cd992 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -34,8 +34,9 @@ struct udev_device { int refcount; struct udev *udev; - char *devpath; char *syspath; + const char *devpath; + const char *sysname; char *devname; char *subsystem; struct list_head link_list; @@ -193,10 +194,11 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); util_strlcat(path, devpath, sizeof(path)); - if (stat(path, &statbuf) != 0) - return NULL; - if (!S_ISDIR(statbuf.st_mode)) + util_strlcat(path, "/uevent", sizeof(path)); + if (stat(path, &statbuf) != 0) { + info(udev, "not a device :%s\n", path); return NULL; + } udev_device = device_init(udev); if (udev_device == NULL) @@ -214,6 +216,28 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * return udev_device; } +struct udev_device *udev_device_new_from_parent(struct udev_device *udev_device) +{ + struct udev_device *udev_device_parent = NULL; + char path[UTIL_PATH_SIZE]; + char *pos; + + if (udev_device == NULL) + return NULL; + + util_strlcpy(path, udev_device_get_devpath(udev_device), sizeof(path)); + while (1) { + pos = strrchr(path, '/'); + if (pos == NULL) + break; + pos[0] = '\0'; + udev_device_parent = udev_device_new_from_devpath(udev_device->udev, path); + if (udev_device_parent != NULL) + break; + } + return udev_device_parent; +} + /** * udev_device_get_udev: * @udev_device: udev device @@ -305,6 +329,13 @@ const char *udev_device_get_syspath(struct udev_device *udev_device) return udev_device->syspath; } +const char *udev_device_get_sysname(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->sysname; +} + /** * udev_device_get_devname: * @udev_device: udev device @@ -454,6 +485,9 @@ int device_set_devpath(struct udev_device *udev_device, const char *devpath) if (asprintf(&udev_device->syspath, "%s%s", udev_get_sys_path(udev_device->udev), devpath) < 0) return -ENOMEM; udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; + udev_device->sysname = strrchr(udev_device->syspath, '/'); + if (udev_device->sysname != NULL) + udev_device->sysname = &udev_device->sysname[1]; return 0; } diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index e1eed568f9..c3d0092f4e 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -46,12 +46,14 @@ extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsign struct udev_device; extern struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath); +extern struct udev_device *udev_device_new_from_parent(struct udev_device *udev_device); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); extern struct udev *udev_device_get_udev(struct udev_device *udev_device); extern const char *udev_device_get_devpath(struct udev_device *udev_device); extern const char *udev_device_get_subsystem(struct udev_device *udev_device); extern const char *udev_device_get_syspath(struct udev_device *udev_device); +extern const char *udev_device_get_sysname(struct udev_device *udev_device); extern const char *udev_device_get_devname(struct udev_device *udev_device); extern int udev_device_get_devlinks(struct udev_device *udev_device, int (*cb)(struct udev_device *udev_device, diff --git a/udev/lib/list.h b/udev/lib/list.h index 3266e1b124..c679e50ace 100644 --- a/udev/lib/list.h +++ b/udev/lib/list.h @@ -1,17 +1,20 @@ /* - * Based on list.h in the Linux kernel source tree. + * Simple doubly linked list implementation. + * + * Based on list.h in the Linux kernel source tree, licensed under + * the GNU GPL version 2. */ #ifndef _LIST_H #define _LIST_H /** - * container_of - cast a member of a structure out to the containing structure - * + * container_of: * @ptr: the pointer to the member. * @type: the type of the container struct this is embedded in. * @member: the name of the member within the struct. * + * cast a member of a structure out to the containing structure */ #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ @@ -25,16 +28,6 @@ #define LIST_POISON1 ((void *) 0x00100100) #define LIST_POISON2 ((void *) 0x00200200) -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - struct list_head { struct list_head *next, *prev; }; @@ -48,12 +41,7 @@ struct list_head { (ptr)->next = (ptr); (ptr)->prev = (ptr); \ } while (0) -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ +/* Insert a new entry between two known consecutive entries. */ static inline void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next) @@ -65,7 +53,7 @@ static inline void __list_add(struct list_head *new, } /** - * list_add - add a new entry + * list_add: * @new: new entry to be added * @head: list head to add it after * @@ -78,7 +66,7 @@ static inline void list_add(struct list_head *new, struct list_head *head) } /** - * list_add_tail - add a new entry + * list_add_tail: * @new: new entry to be added * @head: list head to add it before * @@ -93,9 +81,6 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) /* * Delete a list entry by making the prev/next entries * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! */ static inline void __list_del(struct list_head * prev, struct list_head * next) { @@ -104,8 +89,11 @@ static inline void __list_del(struct list_head * prev, struct list_head * next) } /** - * list_del - deletes entry from list. + * list_del: * @entry: the element to delete from the list. + * + * deletes entry from list. + * * Note: list_empty on entry does not return true after this, the entry is * in an undefined state. */ @@ -117,19 +105,10 @@ static inline void list_del(struct list_head *entry) } /** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static inline void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_move - delete from one list and add as another's head + * list_move * @list: the entry to move * @head: the head that will precede our entry + * delete from one list and add as another's head */ static inline void list_move(struct list_head *list, struct list_head *head) { @@ -138,9 +117,11 @@ static inline void list_move(struct list_head *list, struct list_head *head) } /** - * list_move_tail - delete from one list and add as another's tail + * list_move_tail * @list: the entry to move * @head: the head that will follow our entry + * + * delete from one list and add as another's tail */ static inline void list_move_tail(struct list_head *list, struct list_head *head) @@ -150,109 +131,34 @@ static inline void list_move_tail(struct list_head *list, } /** - * list_empty - tests whether a list is empty + * list_empty: * @head: the list to test. + * + * tests whether a list is empty */ static inline int list_empty(struct list_head *head) { return head->next == head; } -static inline void __list_splice(struct list_head *list, - struct list_head *head) -{ - struct list_head *first = list->next; - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -static inline void list_splice(struct list_head *list, struct list_head *head) -{ - if (!list_empty(list)) - __list_splice(list, head); -} - /** - * list_splice_init - join two lists and reinitialise the emptied list. - * @list: the new list to add. - * @head: the place to add it in the first list. - * - * The list at @list is reinitialised - */ -static inline void list_splice_init(struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) { - __list_splice(list, head); - INIT_LIST_HEAD(list); - } -} - -/** - * list_entry - get the struct for this entry + * list_entry: * @ptr: the &struct list_head pointer. * @type: the type of the struct this is embedded in. * @member: the name of the list_struct within the struct. + * + * get the struct for this entry */ #define list_entry(ptr, type, member) \ container_of(ptr, type, member) /** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); \ - pos = pos->next) - -/** - * __list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - * - * This variant differs from list_for_each() in that it's the - * simplest possible list iteration code. - * Use this for code that knows the list to be very short (empty - * or 1 entry) most of the time. - */ -#define __list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop counter. - * @head: the head for your list. - */ -#define list_for_each_prev(pos, head) \ - for (pos = (head)->prev; pos != (head); pos = pos->prev) - -/** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop counter. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -/** - * list_for_each_entry - iterate over list of given type + * list_for_each_entry: * @pos: the type * to use as a loop counter. * @head: the head for your list. * @member: the name of the list_struct within the struct. + * + * iterate over list of given type */ #define list_for_each_entry(pos, head, member) \ for (pos = list_entry((head)->next, typeof(*pos), member); \ @@ -260,22 +166,13 @@ static inline void list_splice_init(struct list_head *list, pos = list_entry(pos->member.next, typeof(*pos), member)) /** - * list_for_each_entry_reverse - iterate backwards over list of given type. - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) - -/** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * list_for_each_entry_safe: * @pos: the type * to use as a loop counter. * @n: another type * to use as temporary storage * @head: the head for your list. * @member: the name of the list_struct within the struct. + * + * iterate over list of given type safe against removal of list entry */ #define list_for_each_entry_safe(pos, n, head, member) \ for (pos = list_entry((head)->next, typeof(*pos), member), \ diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 1e9469d1c5..7795f5f0fb 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -86,6 +86,23 @@ static int test_device(struct udev *udev, const char *devpath) return 0; } +static int test_device_parents(struct udev *udev, const char *devpath) +{ + struct udev_device *device; + + printf("looking at device: %s\n", devpath); + device = udev_device_new_from_devpath(udev, devpath); + while (device != NULL) { + struct udev_device *device_parent; + + print_device(device); + device_parent = udev_device_new_from_parent(device); + udev_device_unref(device); + device = device_parent; + } + return 0; +} + static int devices_enum_cb(struct udev *udev, const char *devpath, const char *subsystem, const char *name, void *data) @@ -184,6 +201,7 @@ int main(int argc, char *argv[], char *envp[]) printf("dev_path: '%s'\n", str); test_device(udev, devpath); + test_device_parents(udev, devpath); test_enumerate(udev, subsystem); test_monitor(udev, socket); diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 22f3d49d4b..3be5f3154b 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -84,16 +84,18 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); } + closedir(dir); } printf("\n"); } static int print_device_chain(struct udev *udev, const char *devpath) { - struct sysfs_device *dev; + struct udev_device *device; + const char *str; - dev = sysfs_device_get(udev, devpath); - if (dev == NULL) + device = udev_device_new_from_devpath(udev, devpath); + if (device == NULL) return -1; printf("\n" @@ -104,23 +106,37 @@ static int print_device_chain(struct udev *udev, const char *devpath) "and the attributes from one single parent device.\n" "\n"); - printf(" looking at device '%s':\n", dev->devpath); - printf(" KERNEL==\"%s\"\n", dev->kernel); - printf(" SUBSYSTEM==\"%s\"\n", dev->subsystem); - printf(" DRIVER==\"%s\"\n", dev->driver); - print_all_attributes(udev, dev->devpath, "ATTR"); - - /* walk up the chain of devices */ - while (1) { - dev = sysfs_device_get_parent(udev, dev); - if (dev == NULL) + printf(" looking at device '%s':\n", udev_device_get_devpath(device)); + printf(" KERNEL==\"%s\"\n", udev_device_get_sysname(device)); + str = udev_device_get_subsystem(device); + if (str == NULL) + str = ""; + printf(" SUBSYSTEM==\"%s\"\n", str); + str = udev_device_get_driver(device); + if (str == NULL) + str = ""; + printf(" DRIVER==\"%s\"\n", str); + print_all_attributes(udev, udev_device_get_devpath(device), "ATTR"); + + while (device != NULL) { + struct udev_device *device_parent; + + device_parent = udev_device_new_from_parent(device); + udev_device_unref(device); + if (device_parent == NULL) break; - printf(" looking at parent device '%s':\n", dev->devpath); - printf(" KERNELS==\"%s\"\n", dev->kernel); - printf(" SUBSYSTEMS==\"%s\"\n", dev->subsystem); - printf(" DRIVERS==\"%s\"\n", dev->driver); - - print_all_attributes(udev, dev->devpath, "ATTRS"); + device = device_parent; + printf(" looking at parent device '%s':\n", udev_device_get_devpath(device)); + printf(" KERNELS==\"%s\"\n", udev_device_get_sysname(device)); + str = udev_device_get_subsystem(device); + if (str == NULL) + str = ""; + printf(" SUBSYSTEMS==\"%s\"\n", str); + str = udev_device_get_driver(device); + if (str == NULL) + str = ""; + printf(" DRIVERS==\"%s\"\n", str); + print_all_attributes(udev, udev_device_get_devpath(device), "ATTRS"); } return 0; -- cgit v1.2.3-54-g00ecf From 55eb845c28129baf732a6c1ce5afbc3f7cca9593 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Sep 2008 17:09:57 +0200 Subject: release 128 --- ChangeLog | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 5 ++--- configure.ac | 4 ++-- 3 files changed, 73 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64c155635f..d87f3fbc5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,72 @@ +Summary of changes from v127 to v128 +============================================ + +Alan Jenkins (8): + fix uninitialized name_list error::ignore_error + do not needlessly declare some local variables in udev_rules_parse.c as static + remove deprecated envp[] in main() + fix name compare bug name_list_key_add() + remove redundant string copy in udev_rules_apply_format() + remove redundant "remove trailing newlines" in udevadm info + threadsafe rules iteration + fix off-by-one in pass_env_to_socket() + +Kay Sievers (53): + libudev: add monitor documentation + libudev: fix --disable-log + autogen.sh: add --with-selinux + volume_id: hfs - calculate proper uuid + fix dangling pointer returned by attr_get_by_subsys_id() + udev-test.pl: add --valgrind option + libudev: libudev.pc add Libs.private + volume_id: fail on undefined __BYTE_ORDER + remove FAQ + libudev: fix monitor documentation + libudev: add udev_device_get_syspath() + udev_device_init() remove statically allocated device support + udevadm: info - fix broken --device-id-of-file= + udevadm: control - use getopt_long() + udevadm: print warning to stderr if udevadm is called by symlink + udev-test.pl: remove left-over comment from --valgrind option + udevadm: rename source files + udevadm: rename internal functions to udevadm_* + udevadm: split out control functions + udevadm: move init from commands to udevadm + autogen.sh: add debug + use libudev code, unify logging, pass udev context around everywhere + volume_id: linux_raid - fix logic for volumes with size == 0 + vol_id: add --debug option + udevadm: add --version --help options to man page, hide them as commands + move udev_ctrl to libudev-private + udev-test.pl: set udev_log="err" + test-udev: cleanup libudev context and overridden rules file string + test-udev: remove unused var + add a bunch of private device properties to udev_device + udevadm: monitor - use libudev for udev monitor + libudev: monitor - add event properties to udev_device + udevadm: log message if udevadm link is used + udevd: remove max_childs_running logic + libudev: monitor- add netlink uevent support + udevadm: monitor - use libudev code to retrieve device data + libudev: udev_device - read "driver" value + libudev: rename enumerate function + libudev: add selinux + libudev: initialize selinux after logging + volume_id: merge util.h in libvolume_id-private.h + update file headers + libudev: udev_device - add more properties + libudev: do not use udev_db.c + libudev: get rid of udev_sysfs.c + libudev: get rid of udev_utils.c + libudev: rename libudev-utils.c libudev-util.c + libudev: do not use any udev source file + extras: use libudev code + convert to libudev and delete udev_utils_string.c + get rid of udev_sysdeps.c + use size definitions from libudev + udevadm: info - use "udev_device" + + Summary of changes from v126 to v127 ============================================ diff --git a/NEWS b/NEWS index 8f7871d566..1468ec3989 100644 --- a/NEWS +++ b/NEWS @@ -6,9 +6,8 @@ The udevadm info --device-id-of-file= output has changed to use the obvious format. Possible current users should use the --export option which is not affected. -The old udev commands symlinks to udevadm are not installed since -a while, if these symlinks are used, a deprecation warning to stderr -is printed. +The old udev commands symlinks to udevadm are not installed, if +these symlinks are used, a warning is printed. udev 127 ======== diff --git a/configure.ac b/configure.ac index 43babff124..bcc3554ac8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [127], + [128], [kay.sievers@vrfy.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) @@ -11,7 +11,7 @@ AC_PROG_LIBTOOL dnl /* libudev version */ LIBUDEV_LT_CURRENT=0 -LIBUDEV_LT_REVISION=0 +LIBUDEV_LT_REVISION=1 LIBUDEV_LT_AGE=0 AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) -- cgit v1.2.3-54-g00ecf From b2d9e4f20075d355cd4fe091929bc336642aa50d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 12 Sep 2008 00:58:40 +0200 Subject: libudev: switch to "udev_device_get_parent" --- Makefile.am | 4 +-- udev/lib/exported_symbols | 2 +- udev/lib/libudev-device.c | 17 ++++++++--- udev/lib/libudev.h | 2 +- udev/lib/test-libudev.c | 78 ++++++++++++++++++++++++++++++++++++----------- udev/udevadm-info.c | 23 +++++++------- 6 files changed, 88 insertions(+), 38 deletions(-) diff --git a/Makefile.am b/Makefile.am index d4afefdf71..31c0fca183 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,6 +47,4 @@ git-release: head -1 NEWS | grep -q "udev $(VERSION)" git commit -a -m "release $(VERSION)" cat .git/refs/heads/master > .git/refs/tags/$(VERSION) - git gc - git prune - git-update-server-info + git gc --prune diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 058b79afa8..f53165d810 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -8,7 +8,7 @@ udev_set_log_priority udev_get_sys_path udev_get_dev_path udev_device_new_from_devpath -udev_device_new_from_parent +udev_device_get_parent udev_device_ref udev_device_unref udev_device_get_udev diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index f3f20cd992..f400b621b7 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -34,6 +34,7 @@ struct udev_device { int refcount; struct udev *udev; + struct udev_device *parent_device; char *syspath; const char *devpath; const char *sysname; @@ -196,7 +197,7 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * util_strlcat(path, devpath, sizeof(path)); util_strlcat(path, "/uevent", sizeof(path)); if (stat(path, &statbuf) != 0) { - info(udev, "not a device :%s\n", path); + info(udev, "not a device :%s\n", devpath); return NULL; } @@ -212,11 +213,10 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * if (device_read_db(udev_device) >= 0) info(udev, "device %p filled with udev database data\n", udev_device); - return udev_device; } -struct udev_device *udev_device_new_from_parent(struct udev_device *udev_device) +static struct udev_device *device_new_from_parent(struct udev_device *udev_device) { struct udev_device *udev_device_parent = NULL; char path[UTIL_PATH_SIZE]; @@ -228,7 +228,7 @@ struct udev_device *udev_device_new_from_parent(struct udev_device *udev_device) util_strlcpy(path, udev_device_get_devpath(udev_device), sizeof(path)); while (1) { pos = strrchr(path, '/'); - if (pos == NULL) + if (pos == path || pos == NULL) break; pos[0] = '\0'; udev_device_parent = udev_device_new_from_devpath(udev_device->udev, path); @@ -238,6 +238,13 @@ struct udev_device *udev_device_new_from_parent(struct udev_device *udev_device) return udev_device_parent; } +struct udev_device *udev_device_get_parent(struct udev_device *udev_device) +{ + if (udev_device->parent_device == NULL) + udev_device->parent_device = device_new_from_parent(udev_device); + return udev_device->parent_device; +} + /** * udev_device_get_udev: * @udev_device: udev device @@ -284,6 +291,8 @@ void udev_device_unref(struct udev_device *udev_device) udev_device->refcount--; if (udev_device->refcount > 0) return; + if (udev_device->parent_device != NULL) + udev_device_unref(udev_device->parent_device); free(udev_device->syspath); free(udev_device->devname); free(udev_device->subsystem); diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index c3d0092f4e..703364380b 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -46,7 +46,7 @@ extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsign struct udev_device; extern struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath); -extern struct udev_device *udev_device_new_from_parent(struct udev_device *udev_device); +extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); extern struct udev *udev_device_get_udev(struct udev_device *udev_device); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 7795f5f0fb..b30117627f 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include "libudev.h" @@ -89,17 +91,26 @@ static int test_device(struct udev *udev, const char *devpath) static int test_device_parents(struct udev *udev, const char *devpath) { struct udev_device *device; + struct udev_device *device_parent; printf("looking at device: %s\n", devpath); device = udev_device_new_from_devpath(udev, devpath); - while (device != NULL) { - struct udev_device *device_parent; + if (device == NULL) + return -1; + + device_parent = device; + do { + print_device(device_parent); + device_parent = udev_device_get_parent(device_parent); + } while (device_parent != NULL); + + device_parent = device; + do { + print_device(device_parent); + device_parent = udev_device_get_parent(device_parent); + } while (device_parent != NULL); + udev_device_unref(device); - print_device(device); - device_parent = udev_device_new_from_parent(device); - udev_device_unref(device); - device = device_parent; - } return 0; } @@ -172,20 +183,21 @@ static int test_monitor(struct udev *udev, const char *socket_path) int main(int argc, char *argv[], char *envp[]) { - struct udev *udev; + struct udev *udev = NULL; + static const struct option options[] = { + { "devpath", 1, NULL, 'p' }, + { "subsystem", 1, NULL, 's' }, + { "socket", 1, NULL, 'S' }, + { "debug", 0, NULL, 'd' }, + { "help", 0, NULL, 'h' }, + { "version", 0, NULL, 'V' }, + {} + }; const char *devpath = "/devices/virtual/mem/null"; const char *subsystem = NULL; const char *socket = "@/org/kernel/udev/monitor"; const char *str; - if (argv[1] != NULL) { - devpath = argv[1]; - if (argv[2] != NULL) - subsystem = argv[2]; - if (argv[3] != NULL) - socket = argv[3]; - } - udev = udev_new(); printf("context: %p\n", udev); if (udev == NULL) { @@ -195,6 +207,38 @@ int main(int argc, char *argv[], char *envp[]) udev_set_log_fn(udev, log_fn); printf("set log: %p\n", log_fn); + while (1) { + int option; + + option = getopt_long(argc, argv, "+dhV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'p': + devpath = optarg; + break; + case 's': + subsystem = optarg; + break; + case 'S': + socket = optarg; + break; + case 'd': + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + printf("--debug --devpath= --subsystem= --socket= --help\n"); + goto out; + case 'V': + printf("%s\n", VERSION); + goto out; + default: + goto out; + } + } + str = udev_get_sys_path(udev); printf("sys_path: '%s'\n", str); str = udev_get_dev_path(udev); @@ -204,7 +248,7 @@ int main(int argc, char *argv[], char *envp[]) test_device_parents(udev, devpath); test_enumerate(udev, subsystem); test_monitor(udev, socket); - +out: udev_unref(udev); return 0; } diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 3be5f3154b..6f0678e932 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -92,6 +92,7 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c static int print_device_chain(struct udev *udev, const char *devpath) { struct udev_device *device; + struct udev_device *device_parent; const char *str; device = udev_device_new_from_devpath(udev, devpath); @@ -118,27 +119,25 @@ static int print_device_chain(struct udev *udev, const char *devpath) printf(" DRIVER==\"%s\"\n", str); print_all_attributes(udev, udev_device_get_devpath(device), "ATTR"); - while (device != NULL) { - struct udev_device *device_parent; - - device_parent = udev_device_new_from_parent(device); - udev_device_unref(device); + device_parent = device; + do { + device_parent = udev_device_get_parent(device_parent); if (device_parent == NULL) break; - device = device_parent; - printf(" looking at parent device '%s':\n", udev_device_get_devpath(device)); - printf(" KERNELS==\"%s\"\n", udev_device_get_sysname(device)); - str = udev_device_get_subsystem(device); + printf(" looking at parent device '%s':\n", udev_device_get_devpath(device_parent)); + printf(" KERNELS==\"%s\"\n", udev_device_get_sysname(device_parent)); + str = udev_device_get_subsystem(device_parent); if (str == NULL) str = ""; printf(" SUBSYSTEMS==\"%s\"\n", str); - str = udev_device_get_driver(device); + str = udev_device_get_driver(device_parent); if (str == NULL) str = ""; printf(" DRIVERS==\"%s\"\n", str); - print_all_attributes(udev, udev_device_get_devpath(device), "ATTRS"); - } + print_all_attributes(udev, udev_device_get_devpath(device_parent), "ATTRS"); + } while (device_parent != NULL); + udev_device_unref(device); return 0; } -- cgit v1.2.3-54-g00ecf From 93b0f384589fce818edb9678571a30e71930d14c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 13 Sep 2008 21:09:28 +0200 Subject: libudev: udev_device - add attribute cache --- TODO | 4 + udev/Makefile.am | 1 + udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 74 +++++++++++- udev/lib/libudev-enumerate.c | 2 +- udev/lib/libudev-private.h | 4 +- udev/lib/libudev-util.c | 13 +- udev/lib/libudev.h | 1 + udev/udev.h | 1 - udev/udev_db.c | 33 ----- udev/udevadm-info.c | 280 +++++++++++++++++++++---------------------- 11 files changed, 230 insertions(+), 184 deletions(-) diff --git a/TODO b/TODO index 6c8ef8be78..763bcd1fcc 100644 --- a/TODO +++ b/TODO @@ -10,3 +10,7 @@ These things will change in future udev versions: o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names +before next release: + o handle old "device" link in get_parent (CONFIG_SYSFS_DEPRECATED*=y) + o handle "subsystem", "driver", as device + o switch libudev API to syspath instead of devpath diff --git a/udev/Makefile.am b/udev/Makefile.am index 62739c05d9..5d47baa0b3 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -34,6 +34,7 @@ common_files = \ lib/libudev.c \ lib/libudev-device.c \ lib/libudev-monitor.c \ + lib/libudev-enumerate.c \ lib/libudev-util.c \ lib/libudev-ctrl.c diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index f53165d810..aa3854d2aa 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -22,6 +22,7 @@ udev_device_get_action udev_device_get_driver udev_device_get_devnum udev_device_get_seqnum +udev_device_get_attr_value udev_enumerate_devices udev_monitor_new_from_socket udev_monitor_new_from_netlink diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index f400b621b7..cda2de7490 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "libudev.h" @@ -52,6 +53,7 @@ struct udev_device { int num_fake_partitions; int devlink_priority; int ignore_remove; + struct list_head attr_list; }; static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) @@ -164,6 +166,7 @@ struct udev_device *device_init(struct udev *udev) udev_device->udev = udev; INIT_LIST_HEAD(&udev_device->link_list); INIT_LIST_HEAD(&udev_device->env_list); + INIT_LIST_HEAD(&udev_device->attr_list); info(udev_device->udev, "udev_device: %p created\n", udev_device); return udev_device; } @@ -302,6 +305,7 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->driver); free(udev_device->devpath_old); free(udev_device->physdevpath); + util_name_list_cleanup(udev_device->udev, &udev_device->attr_list); info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } @@ -489,6 +493,72 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) return udev_device->seqnum; } +const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr) +{ + char path[UTIL_PATH_SIZE]; + char value[UTIL_NAME_SIZE]; + struct stat statbuf; + int fd; + ssize_t size; + const char *val = NULL; + + util_strlcpy(path, udev_device_get_syspath(udev_device), sizeof(path)); + util_strlcat(path, "/", sizeof(path)); + util_strlcat(path, attr, sizeof(path)); + + if (lstat(path, &statbuf) != 0) { + info(udev_device->udev, "stat '%s' failed: %s\n", path, strerror(errno)); + goto out; + } + + if (S_ISLNK(statbuf.st_mode)) { + /* links return the last element of the target path */ + char target[UTIL_NAME_SIZE]; + int len; + char *pos; + + len = readlink(path, target, sizeof(target)); + if (len > 0) { + target[len] = '\0'; + pos = strrchr(target, '/'); + if (pos != NULL) { + pos = &pos[1]; + info(udev_device->udev, "cache '%s' with link value '%s'\n", attr, pos); + val = util_name_list_add(udev_device->udev, &udev_device->attr_list, attr, pos, 0)->value; + } + } + goto out; + } + + /* skip directories */ + if (S_ISDIR(statbuf.st_mode)) + goto out; + + /* skip non-readable files */ + if ((statbuf.st_mode & S_IRUSR) == 0) + goto out; + + /* read attribute value */ + fd = open(path, O_RDONLY); + if (fd < 0) { + info(udev_device->udev, "attribute '%s' can not be opened\n", path); + goto out; + } + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + if (size == sizeof(value)) + goto out; + + /* got a valid value, store and return it */ + value[size] = '\0'; + util_remove_trailing_chars(value, '\n'); + info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); + val = util_name_list_add(udev_device->udev, &udev_device->attr_list, attr, value, 0)->value; +out: + return val; +} int device_set_devpath(struct udev_device *udev_device, const char *devpath) { if (asprintf(&udev_device->syspath, "%s%s", udev_get_sys_path(udev_device->udev), devpath) < 0) @@ -518,14 +588,14 @@ int device_set_devname(struct udev_device *udev_device, const char *devname) int device_add_devlink(struct udev_device *udev_device, const char *devlink) { - if (util_name_list_add(udev_device->udev, &udev_device->link_list, devlink, 0) == NULL) + if (util_name_list_add(udev_device->udev, &udev_device->link_list, devlink, NULL, 0) == NULL) return -ENOMEM; return 0; } int device_add_property(struct udev_device *udev_device, const char *property) { - if (util_name_list_add(udev_device->udev, &udev_device->env_list, property, 0) == NULL) + if (util_name_list_add(udev_device->udev, &udev_device->env_list, property, NULL, 0) == NULL) return -ENOMEM; return 0; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 9bd9101052..95a407652a 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -58,7 +58,7 @@ static int devices_scan_subsystem(struct udev *udev, util_strlcat(devpath, "/", sizeof(devpath)); util_strlcat(devpath, dent->d_name, sizeof(devpath)); util_resolve_sys_link(udev, devpath, sizeof(devpath)); - util_name_list_add(udev, device_list, devpath, 1); + util_name_list_add(udev, device_list, devpath, NULL, 1); } closedir(dir); return 0; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 8ca441639f..c2a3268038 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -110,13 +110,14 @@ extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); struct util_name_entry { struct list_head node; char *name; + char *value; int *i; }; extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); extern ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size); extern int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size); extern struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, - const char *name, int sort); + const char *name, const char *value, int sort); extern void util_name_list_cleanup(struct udev *udev, struct list_head *name_list); extern int util_log_priority(const char *priority); extern size_t util_path_encode(char *s, size_t len); @@ -125,4 +126,5 @@ extern void util_remove_trailing_chars(char *path, char c); extern size_t util_strlcpy(char *dst, const char *src, size_t size); extern size_t util_strlcat(char *dst, const char *src, size_t size); extern int util_replace_chars(char *str, const char *white); +extern char *util_sysattr_get_value(struct udev *udev, const char *devpath, const char *attr_name); #endif diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 7aea8c67fb..50eacdd37d 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include "libudev.h" @@ -97,7 +98,7 @@ int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size) } struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, - const char *name, int sort) + const char *name, const char *value, int sort) { struct util_name_entry *name_loop; struct util_name_entry *name_new; @@ -126,7 +127,14 @@ struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head * free(name_new); return NULL; } - dbg(udev, "adding '%s'\n", name_new->name); + if (value != NULL) { + name_new->value = strdup(value); + if (name_new->value == NULL) { + free(name_new); + return NULL; + } + } + dbg(udev, "adding '%s=%s'\n", name_new->name, name_new->value); list_add_tail(&name_new->node, &name_loop->node); return name_new; } @@ -139,6 +147,7 @@ void util_name_list_cleanup(struct udev *udev, struct list_head *name_list) list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { list_del(&name_loop->node); free(name_loop->name); + free(name_loop->value); free(name_loop); } } diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 703364380b..05f23e1705 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -67,6 +67,7 @@ extern const char *udev_device_get_driver(struct udev_device *udev_device); extern dev_t udev_device_get_devnum(struct udev_device *udev_device); extern const char *udev_device_get_action(struct udev_device *udev_device); extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); +extern const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr); extern int udev_enumerate_devices(struct udev *udev, const char *subsystem, int (*cb)(struct udev *udev, diff --git a/udev/udev.h b/udev/udev.h index ae50213fd8..55814cee0e 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -146,7 +146,6 @@ extern int udev_db_delete_device(struct udevice *udevice); extern int udev_db_rename(struct udev *udev, const char *devpath_old, const char *devpath); extern int udev_db_get_device(struct udevice *udevice, const char *devpath); extern int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list_head *name_list); -extern int udev_db_get_all_entries(struct udev *udevconst, struct list_head *name_list); /* udev_utils.c */ struct name_entry { diff --git a/udev/udev_db.c b/udev/udev_db.c index 432aa6cbb8..4f3dc606e4 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -292,36 +292,3 @@ int udev_db_delete_device(struct udevice *udevice) return 0; } - -int udev_db_get_all_entries(struct udev *udev, struct list_head *name_list) -{ - char dbpath[PATH_MAX]; - DIR *dir; - - util_strlcpy(dbpath, udev_get_dev_path(udev), sizeof(dbpath)); - util_strlcat(dbpath, "/.udev/db", sizeof(dbpath)); - dir = opendir(dbpath); - if (dir == NULL) { - info(udev, "no udev_db available '%s': %s\n", dbpath, strerror(errno)); - return -1; - } - - while (1) { - struct dirent *ent; - char device[UTIL_PATH_SIZE]; - - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - if (ent->d_name[0] == '.') - continue; - - util_strlcpy(device, ent->d_name, sizeof(device)); - util_path_decode(device); - name_list_add(udev, name_list, device, 1); - dbg(udev, "added '%s'\n", device); - } - - closedir(dir); - return 0; -} diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 6f0678e932..4a9ebcd014 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -32,22 +32,17 @@ #include "udev.h" -static void print_all_attributes(struct udev *udev, const char *devpath, const char *key) +static void print_all_attributes(struct udev_device *device, const char *key) { - char path[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, devpath, sizeof(path)); - - dir = opendir(path); + dir = opendir(udev_device_get_syspath(device)); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { struct stat statbuf; char filename[UTIL_PATH_SIZE]; - char *attr_value; - char value[UTIL_NAME_SIZE]; + const char *value; size_t len; if (dent->d_name[0] == '.') @@ -58,7 +53,7 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c if (strcmp(dent->d_name, "dev") == 0) continue; - util_strlcpy(filename, path, sizeof(filename)); + util_strlcpy(filename, udev_device_get_syspath(device), sizeof(filename)); util_strlcat(filename, "/", sizeof(filename)); util_strlcat(filename, dent->d_name, sizeof(filename)); if (lstat(filename, &statbuf) != 0) @@ -66,19 +61,17 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c if (S_ISLNK(statbuf.st_mode)) continue; - attr_value = sysfs_attr_get_value(udev, devpath, dent->d_name); - if (attr_value == NULL) + value = udev_device_get_attr_value(device, dent->d_name); + if (value == NULL) continue; - len = util_strlcpy(value, attr_value, sizeof(value)); - if(len >= sizeof(value)) - len = sizeof(value) - 1; dbg(udev, "attr '%s'='%s'(%zi)\n", dent->d_name, value, len); /* skip nonprintable attributes */ - while (len && isprint(value[len-1])) + len = strlen(value); + while (len > 0 && isprint(value[len-1])) len--; - if (len) { - dbg(udev, "attribute value of '%s' non-printable, skip\n", dent->d_name); + if (len > 0) { + dbg(info, "attribute value of '%s' non-printable, skip\n", dent->d_name); continue; } @@ -89,16 +82,11 @@ static void print_all_attributes(struct udev *udev, const char *devpath, const c printf("\n"); } -static int print_device_chain(struct udev *udev, const char *devpath) +static int print_device_chain(struct udev_device *device) { - struct udev_device *device; struct udev_device *device_parent; const char *str; - device = udev_device_new_from_devpath(udev, devpath); - if (device == NULL) - return -1; - printf("\n" "Udevinfo starts with the device specified by the devpath and then\n" "walks up the chain of parent devices. It prints for every device\n" @@ -117,7 +105,7 @@ static int print_device_chain(struct udev *udev, const char *devpath) if (str == NULL) str = ""; printf(" DRIVER==\"%s\"\n", str); - print_all_attributes(udev, udev_device_get_devpath(device), "ATTR"); + print_all_attributes(device, "ATTR"); device_parent = device; do { @@ -134,53 +122,68 @@ static int print_device_chain(struct udev *udev, const char *devpath) if (str == NULL) str = ""; printf(" DRIVERS==\"%s\"\n", str); - print_all_attributes(udev, udev_device_get_devpath(device_parent), "ATTRS"); + print_all_attributes(device_parent, "ATTRS"); } while (device_parent != NULL); - udev_device_unref(device); return 0; } -static void print_record(struct udevice *udevice) +static int print_record_devlinks_cb(struct udev_device *device, const char *value, void *data) { - struct name_entry *name_loop; - - printf("P: %s\n", udevice->dev->devpath); - printf("N: %s\n", udevice->name); - list_for_each_entry(name_loop, &udevice->symlink_list, node) - printf("S: %s\n", name_loop->name); - if (udevice->link_priority != 0) - printf("L: %i\n", udevice->link_priority); - if (udevice->partitions != 0) - printf("A:%u\n", udevice->partitions); - if (udevice->ignore_remove) - printf("R:%u\n", udevice->ignore_remove); - list_for_each_entry(name_loop, &udevice->env_list, node) - printf("E: %s\n", name_loop->name); + size_t len; + + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + printf("S: %s\n", &value[len+1]); + return 0; } -static void export_db(struct udev *udev) +static int print_record_properties_cb(struct udev_device *device, const char *key, const char *value, void *data) { - LIST_HEAD(name_list); - struct name_entry *name_loop; - - udev_db_get_all_entries(udev, &name_list); - list_for_each_entry(name_loop, &name_list, node) { - struct udevice *udevice_db; - - udevice_db = udev_device_init(udev); - if (udevice_db == NULL) - continue; - if (udev_db_get_device(udevice_db, name_loop->name) == 0) - print_record(udevice_db); - printf("\n"); - udev_device_cleanup(udevice_db); - } - name_list_cleanup(udev, &name_list); + printf("E: %s=%s\n", key, value); + return 0; } -static int lookup_device_by_name(struct udev *udev, struct udevice **udevice, const char *name) +static void print_record(struct udev_device *device) { + size_t len; + int i; + + printf("P: %s\n", udev_device_get_devpath(device)); + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + printf("N: %s\n", &udev_device_get_devname(device)[len+1]); + i = device_get_devlink_priority(device); + if (i != 0) + printf("L: %i\n", i); + i = device_get_num_fake_partitions(device); + if (i != 0) + printf("A:%u\n", i); + i = device_get_ignore_remove(device); + if (i != 0) + printf("R:%u\n", i); + udev_device_get_devlinks(device, print_record_devlinks_cb, NULL); + udev_device_get_properties(device, print_record_properties_cb, NULL); + printf("\n"); +} + +static int export_all_cb(struct udev *udev, + const char *devpath, const char *subsystem, const char *name, + void *data) +{ + struct udev_device *device; + + device = udev_device_new_from_devpath(udev, devpath); + if (device == NULL) + return 0; + if (udev_device_get_devname(device) != NULL) + print_record(device); + udev_device_unref(device); + return 0; +} + +static struct udev_device *lookup_device_by_name(struct udev *udev, const char *name) +{ +#if 0 + /* FIXME */ LIST_HEAD(name_list); int count; struct name_entry *device; @@ -224,6 +227,39 @@ next: out: name_list_cleanup(udev, &name_list); return rc; +#endif + return NULL; +} + +static int add_devlink_cb(struct udev_device *device, const char *value, void *data) +{ + char **links = data; + + if (*links == NULL) { + *links = strdup(value); + } else { + char *str; + + asprintf(&str, "%s %s", *links, value); + free(*links); + *links = str; + } + return 0; +} + +static int add_devlink_noroot_cb(struct udev_device *device, const char *value, void *data) +{ + size_t len; + + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + value = &value[len+1]; + return add_devlink_cb(device, value, data); +} + +static int print_property_cb(struct udev_device *device, const char *key, const char *value, void *data) +{ + printf("%s=%s\n", key, value); + return 0; } static int stat_device(const char *name, int export, const char *prefix) @@ -247,10 +283,14 @@ static int stat_device(const char *name, int export, const char *prefix) int udevadm_info(struct udev *udev, int argc, char *argv[]) { - struct udevice *udevice = NULL; + struct udev_device *device = NULL; int root = 0; int export = 0; const char *export_prefix = NULL; + char path[UTIL_PATH_SIZE]; + char name[UTIL_PATH_SIZE]; + char *links; + int rc = 0; static const struct option options[] = { { "name", 1, NULL, 'n' }, @@ -284,11 +324,6 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) QUERY_ALL, } query = QUERY_NONE; - char path[UTIL_PATH_SIZE] = ""; - char name[UTIL_PATH_SIZE] = ""; - struct name_entry *name_loop; - int rc = 0; - while (1) { int option; @@ -299,42 +334,32 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) dbg(udev, "option '%c'\n", option); switch (option) { case 'n': + if (device != NULL) { + fprintf(stderr, "device already specified\n"); + rc = 2; + goto exit; + } /* remove /dev if given */ if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) == 0) util_strlcpy(name, &optarg[strlen(udev_get_dev_path(udev))+1], sizeof(name)); else util_strlcpy(name, optarg, sizeof(name)); util_remove_trailing_chars(name, '/'); - dbg(udev, "name: %s\n", name); + device = lookup_device_by_name(udev, name); break; case 'p': + if (device != NULL) { + fprintf(stderr, "device already specified\n"); + rc = 2; + goto exit; + } /* remove /sys if given */ if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) == 0) util_strlcpy(path, &optarg[strlen(udev_get_sys_path(udev))], sizeof(path)); else util_strlcpy(path, optarg, sizeof(path)); util_remove_trailing_chars(path, '/'); - - /* possibly resolve to real devpath */ - if (util_resolve_sys_link(udev, path, sizeof(path)) != 0) { - char temp[UTIL_PATH_SIZE]; - char *pos; - - /* also check if the parent is a link */ - util_strlcpy(temp, path, sizeof(temp)); - pos = strrchr(temp, '/'); - if (pos != 0) { - char tail[UTIL_PATH_SIZE]; - - util_strlcpy(tail, pos, sizeof(tail)); - pos[0] = '\0'; - if (util_resolve_sys_link(udev, temp, sizeof(temp)) == 0) { - util_strlcpy(path, temp, sizeof(path)); - util_strlcat(path, tail, sizeof(path)); - } - } - } - dbg(udev, "path: %s\n", path); + device = udev_device_new_from_devpath(udev, path); break; case 'q': action = ACTION_QUERY; @@ -374,7 +399,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) action = ACTION_ATTRIBUTE_WALK; break; case 'e': - export_db(udev); + udev_enumerate_devices(udev, NULL, export_all_cb, NULL); goto exit; case 'x': export = 1; @@ -411,59 +436,42 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) } } - /* run action */ switch (action) { case ACTION_QUERY: - /* needs devpath or node/symlink name for query */ - if (path[0] != '\0') { - udevice = udev_device_init(udev); - if (udevice == NULL) { - rc = 1; - goto exit; - } - if (udev_db_get_device(udevice, path) != 0) { - fprintf(stderr, "no record for '%s' in database\n", path); - rc = 3; - goto exit; - } - } else if (name[0] != '\0') { - if (lookup_device_by_name(udev, &udevice, name) != 0) { - fprintf(stderr, "node name not found\n"); - rc = 4; - goto exit; - } - } else { - fprintf(stderr, "query needs --path or node --name specified\n"); + if (device == NULL) { + fprintf(stderr, "query needs --path= or node --name= specified\n"); rc = 4; goto exit; } switch(query) { case QUERY_NAME: - if (root) - printf("%s/%s\n", udev_get_dev_path(udev), udevice->name); - else - printf("%s\n", udevice->name); - break; - case QUERY_SYMLINK: - list_for_each_entry(name_loop, &udevice->symlink_list, node) { - char c = name_loop->node.next != &udevice->symlink_list ? ' ' : '\n'; + if (root) { + printf("%s\n", udev_device_get_devname(device)); + } else { + size_t len; - if (root) - printf("%s/%s%c", udev_get_dev_path(udev), name_loop->name, c); - else - printf("%s%c", name_loop->name, c); + len = strlen(udev_get_dev_path(udev)); + printf("%s\n", &udev_device_get_devname(device)[len+1]); } break; + case QUERY_SYMLINK: + links = NULL; + if (root) + udev_device_get_devlinks(device, add_devlink_cb, &links); + else + udev_device_get_devlinks(device, add_devlink_noroot_cb, &links); + printf("%s\n", links); + free(links); + break; case QUERY_PATH: - printf("%s\n", udevice->dev->devpath); + printf("%s\n", udev_device_get_devpath(device)); goto exit; case QUERY_ENV: - list_for_each_entry(name_loop, &udevice->env_list, node) - printf("%s\n", name_loop->name); + udev_device_get_properties(device, print_property_cb, NULL); break; case QUERY_ALL: - print_record(udevice); + print_record(device); break; default: fprintf(stderr, "unknown query type\n"); @@ -471,28 +479,12 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) } break; case ACTION_ATTRIBUTE_WALK: - if (path[0] != '\0') { - if (print_device_chain(udev, path) != 0) { - fprintf(stderr, "no valid sysfs device found\n"); - rc = 4; - goto exit; - } - } else if (name[0] != '\0') { - if (lookup_device_by_name(udev, &udevice, name) != 0) { - fprintf(stderr, "node name not found\n"); - rc = 4; - goto exit; - } - if (print_device_chain(udev, udevice->dev->devpath) != 0) { - fprintf(stderr, "no valid sysfs device found\n"); - rc = 4; - goto exit; - } - } else { + if (device == NULL) { fprintf(stderr, "attribute walk needs --path or node --name specified\n"); rc = 5; goto exit; } + print_device_chain(device); break; case ACTION_DEVICE_ID_FILE: if (stat_device(name, export, export_prefix) != 0) @@ -508,6 +500,6 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) } exit: - udev_device_cleanup(udevice); + udev_device_unref(device); return rc; } -- cgit v1.2.3-54-g00ecf From 0518da3b74a388680896747696b3644bbd3d98e5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Sep 2008 11:19:56 -0700 Subject: libudev: handle "device" link as parent, handle "class" "block" as "subsystem" --- TODO | 3 +- udev/lib/libudev-device.c | 94 +++++++++++++++++++++++++++++++++++----------- udev/lib/libudev-monitor.c | 2 +- udev/lib/libudev-private.h | 3 +- 4 files changed, 76 insertions(+), 26 deletions(-) diff --git a/TODO b/TODO index 763bcd1fcc..18f75b5f3e 100644 --- a/TODO +++ b/TODO @@ -11,6 +11,5 @@ These things will change in future udev versions: o symlink names to udevadm will no longer be resolved to old command names before next release: - o handle old "device" link in get_parent (CONFIG_SYSFS_DEPRECATED*=y) - o handle "subsystem", "driver", as device o switch libudev API to syspath instead of devpath + o udev_* prefix for private methods (ctrl_*)? diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index cda2de7490..918398b793 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -142,7 +142,7 @@ static int device_read_db(struct udev_device *udev_device) device_set_ignore_remove(udev_device, atoi(val)); break; case 'E': - device_add_property(udev_device, val); + device_add_property_from_string(udev_device, val); break; } } @@ -236,15 +236,29 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic pos[0] = '\0'; udev_device_parent = udev_device_new_from_devpath(udev_device->udev, path); if (udev_device_parent != NULL) - break; + return udev_device_parent; + } + + /* follow "device" link in deprecated sysfs /sys/class/ layout */ + if (strncmp(udev_device->devpath, "/class/", 7) == 0) { + util_strlcpy(path, udev_device->devpath, sizeof(path)); + util_strlcat(path, "/device", sizeof(path)); + if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) { + udev_device_parent = udev_device_new_from_devpath(udev_device->udev, path); + if (udev_device_parent != NULL) + return udev_device_parent; + } } - return udev_device_parent; + return NULL; } struct udev_device *udev_device_get_parent(struct udev_device *udev_device) { - if (udev_device->parent_device == NULL) - udev_device->parent_device = device_new_from_parent(udev_device); + if (udev_device->parent_device != NULL) { + info(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); + return udev_device->parent_device; + } + udev_device->parent_device = device_new_from_parent(udev_device); return udev_device->parent_device; } @@ -382,10 +396,29 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) return NULL; if (udev_device->subsystem != NULL) return udev_device->subsystem; - if (util_get_sys_subsystem(udev_device->udev, udev_device->devpath, subsystem, sizeof(subsystem)) < 2) - return NULL; - udev_device->subsystem = strdup(subsystem); - return udev_device->subsystem; + + /* read "subsytem" link */ + if (util_get_sys_subsystem(udev_device->udev, udev_device->devpath, subsystem, sizeof(subsystem)) == 0) { + udev_device->subsystem = strdup(subsystem); + return udev_device->subsystem; + } + + /* implicit names */ + if (strncmp(udev_device->devpath, "/module/", 8) == 0) { + udev_device->subsystem = strdup("module"); + return udev_device->subsystem; + } + if (strstr(udev_device->devpath, "/drivers/") != NULL) { + udev_device->subsystem = strdup("drivers"); + return udev_device->subsystem; + } + if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || + strncmp(udev_device->devpath, "/class/", 7) == 0 || + strncmp(udev_device->devpath, "/bus/", 5) == 0) { + udev_device->subsystem = strdup("subsystem"); + return udev_device->subsystem; + } + return NULL; } /** @@ -442,17 +475,8 @@ int udev_device_get_properties(struct udev_device *udev_device, if (udev_device == NULL) return -1; list_for_each_entry(name_loop, &udev_device->env_list, node) { - char name[UTIL_NAME_SIZE]; - char *val; - - strncpy(name, name_loop->name, sizeof(name)); - val = strchr(name, '='); - if (val == NULL) - continue; - val[0] = '\0'; - val = &val[1]; count++; - if (cb(udev_device, name, val, data) != 0) + if (cb(udev_device, name_loop->name, name_loop->value, data) != 0) break; } return count; @@ -495,6 +519,7 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr) { + struct util_name_entry *name_loop; char path[UTIL_PATH_SIZE]; char value[UTIL_NAME_SIZE]; struct stat statbuf; @@ -502,6 +527,14 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch ssize_t size; const char *val = NULL; + /* look for possibly already cached result */ + list_for_each_entry(name_loop, &udev_device->attr_list, node) { + if (strcmp(name_loop->name, attr) == 0) { + info(udev_device->udev, "'%s' in cache '%s'\n", attr, name_loop->value); + return name_loop->value; + } + } + util_strlcpy(path, udev_device_get_syspath(udev_device), sizeof(path)); util_strlcat(path, "/", sizeof(path)); util_strlcat(path, attr, sizeof(path)); @@ -551,7 +584,7 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch if (size == sizeof(value)) goto out; - /* got a valid value, store and return it */ + /* got a valid value, store it in cache and return it */ value[size] = '\0'; util_remove_trailing_chars(value, '\n'); info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); @@ -593,13 +626,30 @@ int device_add_devlink(struct udev_device *udev_device, const char *devlink) return 0; } -int device_add_property(struct udev_device *udev_device, const char *property) +int device_add_property(struct udev_device *udev_device, const char *key, const char *value) { - if (util_name_list_add(udev_device->udev, &udev_device->env_list, property, NULL, 0) == NULL) + if (util_name_list_add(udev_device->udev, &udev_device->env_list, key, value, 0) == NULL) return -ENOMEM; return 0; } +int device_add_property_from_string(struct udev_device *udev_device, const char *property) +{ + char name[UTIL_PATH_SIZE]; + char *val; + + strncpy(name, property, sizeof(name)); + val = strchr(name, '='); + if (val == NULL) + return -1; + val[0] = '\0'; + val = &val[1]; + if (val[0] == '\0') + val = NULL; + device_add_property(udev_device, name, val); + return 0; +} + int device_set_action(struct udev_device *udev_device, const char *action) { udev_device->action = strdup(action); diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 60f7bc29e5..8e9cf2d0eb 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -336,7 +336,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito } else if (strncmp(key, "TIMEOUT=", 8) == 0) { device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); } - device_add_property(udev_device, key); + device_add_property_from_string(udev_device, key); } device_set_devnum(udev_device, makedev(maj, min)); diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index c2a3268038..f28bd9acfc 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -59,7 +59,8 @@ extern int device_set_devpath(struct udev_device *udev_device, const char *devpa extern int device_set_subsystem(struct udev_device *udev_device, const char *subsystem); extern int device_set_devname(struct udev_device *udev_device, const char *devname); extern int device_add_devlink(struct udev_device *udev_device, const char *devlink); -extern int device_add_property(struct udev_device *udev_device, const char *property); +extern int device_add_property(struct udev_device *udev_device, const char *key, const char *value); +extern int device_add_property_from_string(struct udev_device *udev_device, const char *property); extern int device_set_action(struct udev_device *udev_device, const char *action); extern int device_set_driver(struct udev_device *udev_device, const char *driver); extern const char *device_get_devpath_old(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From 9a8047fa290f05d0b2dcf7e7dbe8539c6e3d325e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Sep 2008 12:01:35 -0700 Subject: udevadm: info - fix lookup-by-name --- udev/udevadm-info.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 4a9ebcd014..a2858e5dc9 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -182,12 +182,10 @@ static int export_all_cb(struct udev *udev, static struct udev_device *lookup_device_by_name(struct udev *udev, const char *name) { -#if 0 - /* FIXME */ + struct udev_device *udev_device = NULL; LIST_HEAD(name_list); int count; struct name_entry *device; - int rc = -1; count = udev_db_get_devices_by_name(udev, name, &name_list); if (count <= 0) @@ -195,7 +193,7 @@ static struct udev_device *lookup_device_by_name(struct udev *udev, const char * info(udev, "found %i devices for '%s'\n", count, name); - /* select the device that seems to match */ + /* select the device that matches */ list_for_each_entry(device, &name_list, node) { struct udevice *udevice_loop; char filename[UTIL_PATH_SIZE]; @@ -207,7 +205,6 @@ static struct udev_device *lookup_device_by_name(struct udev *udev, const char * if (udev_db_get_device(udevice_loop, device->name) != 0) goto next; info(udev, "found db entry '%s'\n", device->name); - /* make sure, we don't get a link of a different device */ util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); util_strlcat(filename, "/", sizeof(filename)); @@ -218,17 +215,15 @@ static struct udev_device *lookup_device_by_name(struct udev *udev, const char * info(udev, "skip '%s', dev_t doesn't match\n", udevice_loop->name); goto next; } - rc = 0; - *udevice = udevice_loop; + udev_device = udev_device_new_from_devpath(udev, udevice_loop->dev->devpath); + udev_device_cleanup(udevice_loop); break; next: udev_device_cleanup(udevice_loop); } out: name_list_cleanup(udev, &name_list); - return rc; -#endif - return NULL; + return udev_device; } static int add_devlink_cb(struct udev_device *device, const char *value, void *data) @@ -439,7 +434,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) switch (action) { case ACTION_QUERY: if (device == NULL) { - fprintf(stderr, "query needs --path= or node --name= specified\n"); + fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); rc = 4; goto exit; } @@ -480,7 +475,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) break; case ACTION_ATTRIBUTE_WALK: if (device == NULL) { - fprintf(stderr, "attribute walk needs --path or node --name specified\n"); + fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); rc = 5; goto exit; } -- cgit v1.2.3-54-g00ecf From 8753fadf2a6ecead372e71b8bf9336cf29f9c958 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Sep 2008 17:12:47 -0700 Subject: libudev: switch API from devpath to syspath --- TODO | 2 +- udev/lib/exported_symbols | 2 +- udev/lib/libudev-device.c | 59 +++++++++++++++++++++++--------------------- udev/lib/libudev-enumerate.c | 36 ++++++++++++++------------- udev/lib/libudev-monitor.c | 8 +++++- udev/lib/libudev-private.h | 9 +++---- udev/lib/libudev-util.c | 32 +++++++++++------------- udev/lib/libudev.h | 4 +-- udev/lib/test-libudev.c | 35 +++++++++++++++----------- udev/udevadm-info.c | 20 +++++++++------ 10 files changed, 112 insertions(+), 95 deletions(-) diff --git a/TODO b/TODO index 18f75b5f3e..74f6936c43 100644 --- a/TODO +++ b/TODO @@ -11,5 +11,5 @@ These things will change in future udev versions: o symlink names to udevadm will no longer be resolved to old command names before next release: - o switch libudev API to syspath instead of devpath + o replace list.h with gpl or later version o udev_* prefix for private methods (ctrl_*)? diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index aa3854d2aa..ab12ff57f1 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -7,7 +7,7 @@ udev_get_log_priority udev_set_log_priority udev_get_sys_path udev_get_dev_path -udev_device_new_from_devpath +udev_device_new_from_syspath udev_device_get_parent udev_device_ref udev_device_unref diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 918398b793..782d662549 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -56,14 +56,14 @@ struct udev_device { struct list_head attr_list; }; -static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) +static size_t syspath_to_db_path(struct udev_device *udev_device, char *filename, size_t len) { size_t start; /* translate to location of db file */ - util_strlcpy(filename, udev_get_dev_path(udev), len); + util_strlcpy(filename, udev_get_dev_path(udev_device->udev), len); start = util_strlcat(filename, "/.udev/db/", len); - util_strlcat(filename, devpath, len); + util_strlcat(filename, udev_device->devpath, len); return util_path_encode(&filename[start], len - start); } @@ -75,7 +75,7 @@ static int device_read_db(struct udev_device *udev_device) FILE *f; int rc = 0; - devpath_to_db_path(udev_device->udev, udev_device->devpath, filename, sizeof(filename)); + syspath_to_db_path(udev_device, filename, sizeof(filename)); if (lstat(filename, &stats) != 0) { info(udev_device->udev, "no db file to read %s: %s\n", filename, strerror(errno)); @@ -172,20 +172,20 @@ struct udev_device *device_init(struct udev *udev) } /** - * udev_device_new_from_devpath: + * udev_device_new_from_syspath: * @udev: udev library context - * @devpath: sys device path + * @syspath: sys device path including sys directory * - * Create new udev device, and fill in information from the sysfs - * device and the udev database entry. The devpath must not contain - * the sysfs mount path, and must contain a leading '/'. + * Create new udev device, and fill in information from the sys + * device and the udev database entry. The sypath is the absolute + * path to the device, including the sys mount point. * * The initial refcount is 1, and needs to be decremented to * release the ressources of the udev device. * * Returns: a new udev device, or #NULL, if it does not exist **/ -struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath) +struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) { char path[UTIL_PATH_SIZE]; struct stat statbuf; @@ -193,14 +193,13 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * if (udev == NULL) return NULL; - if (devpath == NULL) + if (syspath == NULL) return NULL; - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, devpath, sizeof(path)); + util_strlcpy(path, syspath, sizeof(path)); util_strlcat(path, "/uevent", sizeof(path)); if (stat(path, &statbuf) != 0) { - info(udev, "not a device :%s\n", devpath); + info(udev, "not a device :%s\n", syspath); return NULL; } @@ -209,9 +208,9 @@ struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char * return NULL; /* resolve possible symlink to real path */ - util_strlcpy(path, devpath, sizeof(path)); + util_strlcpy(path, syspath, sizeof(path)); util_resolve_sys_link(udev, path, sizeof(path)); - device_set_devpath(udev_device, path); + device_set_syspath(udev_device, path); info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); if (device_read_db(udev_device) >= 0) @@ -228,23 +227,23 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic if (udev_device == NULL) return NULL; - util_strlcpy(path, udev_device_get_devpath(udev_device), sizeof(path)); + util_strlcpy(path, udev_device->syspath, sizeof(path)); while (1) { pos = strrchr(path, '/'); if (pos == path || pos == NULL) break; pos[0] = '\0'; - udev_device_parent = udev_device_new_from_devpath(udev_device->udev, path); + udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); if (udev_device_parent != NULL) return udev_device_parent; } - /* follow "device" link in deprecated sysfs /sys/class/ layout */ + /* follow "device" link in deprecated sys /sys/class/ layout */ if (strncmp(udev_device->devpath, "/class/", 7) == 0) { - util_strlcpy(path, udev_device->devpath, sizeof(path)); + util_strlcpy(path, udev_device->syspath, sizeof(path)); util_strlcat(path, "/device", sizeof(path)); if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) { - udev_device_parent = udev_device_new_from_devpath(udev_device->udev, path); + udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); if (udev_device_parent != NULL) return udev_device_parent; } @@ -398,7 +397,7 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) return udev_device->subsystem; /* read "subsytem" link */ - if (util_get_sys_subsystem(udev_device->udev, udev_device->devpath, subsystem, sizeof(subsystem)) == 0) { + if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) == 0) { udev_device->subsystem = strdup(subsystem); return udev_device->subsystem; } @@ -490,7 +489,7 @@ const char *udev_device_get_driver(struct udev_device *udev_device) return NULL; if (udev_device->driver != NULL) return udev_device->driver; - if (util_get_sys_driver(udev_device->udev, udev_device->devpath, driver, sizeof(driver)) < 2) + if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) < 2) return NULL; udev_device->driver = strdup(driver); return udev_device->driver; @@ -592,14 +591,18 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch out: return val; } -int device_set_devpath(struct udev_device *udev_device, const char *devpath) +int device_set_syspath(struct udev_device *udev_device, const char *syspath) { - if (asprintf(&udev_device->syspath, "%s%s", udev_get_sys_path(udev_device->udev), devpath) < 0) + const char *pos; + + udev_device->syspath = strdup(syspath); + if (udev_device->syspath == NULL) return -ENOMEM; udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; - udev_device->sysname = strrchr(udev_device->syspath, '/'); - if (udev_device->sysname != NULL) - udev_device->sysname = &udev_device->sysname[1]; + pos = strrchr(udev_device->syspath, '/'); + if (pos == NULL) + return -EINVAL; + udev_device->sysname = &pos[1]; return 0; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 95a407652a..458be5861a 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -38,9 +38,8 @@ static int devices_scan_subsystem(struct udev *udev, char path[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; - size_t len; - len = util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); util_strlcat(path, basedir, sizeof(path)); util_strlcat(path, "/", sizeof(path)); util_strlcat(path, subsystem, sizeof(path)); @@ -50,15 +49,15 @@ static int devices_scan_subsystem(struct udev *udev, if (dir == NULL) return -1; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char devpath[UTIL_PATH_SIZE]; + char syspath[UTIL_PATH_SIZE]; if (dent->d_name[0] == '.') continue; - util_strlcpy(devpath, &path[len], sizeof(devpath)); - util_strlcat(devpath, "/", sizeof(devpath)); - util_strlcat(devpath, dent->d_name, sizeof(devpath)); - util_resolve_sys_link(udev, devpath, sizeof(devpath)); - util_name_list_add(udev, device_list, devpath, NULL, 1); + util_strlcpy(syspath, path, sizeof(syspath)); + util_strlcat(syspath, "/", sizeof(syspath)); + util_strlcat(syspath, dent->d_name, sizeof(syspath)); + util_resolve_sys_link(udev, syspath, sizeof(syspath)); + util_name_list_add(udev, device_list, syspath, NULL, 1); } closedir(dir); return 0; @@ -89,27 +88,30 @@ static int devices_scan_subsystems(struct udev *udev, return 0; } -static int devices_delay(struct udev *udev, const char *devpath) +static int devices_delay(struct udev *udev, const char *syspath) { static const char *delay_device_list[] = { "/block/md", "/block/dm-", NULL }; + size_t len; int i; + len = strlen(udev_get_sys_path(udev)); + for (i = 0; delay_device_list[i] != NULL; i++) { - if (strstr(devpath, delay_device_list[i]) != NULL) { - info(udev, "delaying: %s\n", devpath); + if (strstr(&syspath[len], delay_device_list[i]) != NULL) { + info(udev, "delaying: %s\n", syspath); return 1; } } return 0; } -static int devices_call(struct udev *udev, const char *devpath, +static int devices_call(struct udev *udev, const char *syspath, int (*cb)(struct udev *udev, - const char *devpath, const char *subsystem, const char *name, + const char *syspath, const char *subsystem, const char *name, void *data), void *data, int *cb_rc) @@ -117,14 +119,14 @@ static int devices_call(struct udev *udev, const char *devpath, char subsystem[UTIL_PATH_SIZE]; const char *name; - name = strrchr(devpath, '/'); + name = strrchr(syspath, '/'); if (name == NULL) return -1; name++; - if (util_get_sys_subsystem(udev, devpath, subsystem, sizeof(subsystem)) < 2) + if (util_get_sys_subsystem(udev, syspath, subsystem, sizeof(subsystem)) < 2) return -1; - *cb_rc = cb(udev, devpath, subsystem, name, data); + *cb_rc = cb(udev, syspath, subsystem, name, data); return 0; } @@ -143,7 +145,7 @@ static int devices_call(struct udev *udev, const char *devpath, **/ int udev_enumerate_devices(struct udev *udev, const char *subsystem, int (*cb)(struct udev *udev, - const char *devpath, const char *subsystem, const char *name, void *data), + const char *syspath, const char *subsystem, const char *name, void *data), void *data) { char base[UTIL_PATH_SIZE]; diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 8e9cf2d0eb..f61ddb0b53 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -302,7 +302,11 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito bufpos += keylen + 1; if (strncmp(key, "DEVPATH=", 8) == 0) { - device_set_devpath(udev_device, &key[8]); + char path[UTIL_PATH_SIZE]; + + util_strlcpy(path, udev_get_sys_path(udev_monitor->udev), sizeof(path)); + util_strlcat(path, &key[8], sizeof(path)); + device_set_syspath(udev_device, path); } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { device_set_subsystem(udev_device, &key[10]); } else if (strncmp(key, "DEVNAME=", 8) == 0) { @@ -336,6 +340,8 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito } else if (strncmp(key, "TIMEOUT=", 8) == 0) { device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); } + if (strncmp(key, "PHYSDEV", 7) == 0) + continue; device_add_property_from_string(udev_device, key); } device_set_devnum(udev_device, makedev(maj, min)); diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index f28bd9acfc..1756be5f25 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -55,7 +55,7 @@ extern const char *udev_get_rules_path(struct udev *udev); extern int udev_get_run(struct udev *udev); /* libudev-device */ -extern int device_set_devpath(struct udev_device *udev_device, const char *devpath); +extern int device_set_syspath(struct udev_device *udev_device, const char *syspath); extern int device_set_subsystem(struct udev_device *udev_device, const char *subsystem); extern int device_set_devname(struct udev_device *udev_device, const char *devname); extern int device_add_devlink(struct udev_device *udev_device, const char *devlink); @@ -114,9 +114,9 @@ struct util_name_entry { char *value; int *i; }; -extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size); -extern ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size); -extern int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size); +extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); +extern ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); +extern int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); extern struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, const char *name, const char *value, int sort); extern void util_name_list_cleanup(struct udev *udev, struct list_head *name_list); @@ -127,5 +127,4 @@ extern void util_remove_trailing_chars(char *path, char c); extern size_t util_strlcpy(char *dst, const char *src, size_t size); extern size_t util_strlcat(char *dst, const char *src, size_t size); extern int util_replace_chars(char *str, const char *white); -extern char *util_sysattr_get_value(struct udev *udev, const char *devpath, const char *attr_name); #endif diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 50eacdd37d..7053a2f825 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -33,14 +33,13 @@ #include "libudev.h" #include "libudev-private.h" -static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *devpath, char *subsystem, size_t size) +static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *subsystem, size_t size) { char path[UTIL_PATH_SIZE]; ssize_t len; const char *pos; - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, devpath, sizeof(path)); + util_strlcpy(path, syspath, sizeof(path)); util_strlcat(path, "/", sizeof(path)); util_strlcat(path, slink, sizeof(path)); len = readlink(path, path, sizeof(path)); @@ -54,46 +53,43 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *de return util_strlcpy(subsystem, pos, size); } -ssize_t util_get_sys_subsystem(struct udev *udev, const char *devpath, char *subsystem, size_t size) +ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size) { - return get_sys_link(udev, "subsystem", devpath, subsystem, size); + return get_sys_link(udev, "subsystem", syspath, subsystem, size); } -ssize_t util_get_sys_driver(struct udev *udev, const char *devpath, char *driver, size_t size) +ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size) { - return get_sys_link(udev, "driver", devpath, driver, size); + return get_sys_link(udev, "driver", syspath, driver, size); } -int util_resolve_sys_link(struct udev *udev, char *devpath, size_t size) +int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) { - char link_path[UTIL_PATH_SIZE]; char link_target[UTIL_PATH_SIZE]; int len; int i; int back; - util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - util_strlcat(link_path, devpath, sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); + len = readlink(syspath, link_target, sizeof(link_target)); if (len <= 0) return -1; link_target[len] = '\0'; - dbg(udev, "path link '%s' points to '%s'\n", devpath, link_target); + dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target); for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) ; - dbg(udev, "base '%s', tail '%s', back %i\n", devpath, &link_target[back * 3], back); + dbg(udev, "base '%s', tail '%s', back %i\n", syspath, &link_target[back * 3], back); for (i = 0; i <= back; i++) { - char *pos = strrchr(devpath, '/'); + char *pos = strrchr(syspath, '/'); if (pos == NULL) return -1; pos[0] = '\0'; } - dbg(udev, "after moving back '%s'\n", devpath); - util_strlcat(devpath, "/", size); - util_strlcat(devpath, &link_target[back * 3], size); + dbg(udev, "after moving back '%s'\n", syspath); + util_strlcat(syspath, "/", size); + util_strlcat(syspath, &link_target[back * 3], size); return 0; } diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 05f23e1705..6996b47fa3 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -45,7 +45,7 @@ extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, uns extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); struct udev_device; -extern struct udev_device *udev_device_new_from_devpath(struct udev *udev, const char *devpath); +extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); @@ -71,7 +71,7 @@ extern const char *udev_device_get_attr_value(struct udev_device *udev_device, c extern int udev_enumerate_devices(struct udev *udev, const char *subsystem, int (*cb)(struct udev *udev, - const char *devpath, const char *subsystem, const char *name, void *data), + const char *syspath, const char *subsystem, const char *name, void *data), void *data); struct udev_monitor; diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index b30117627f..4dcc80a141 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -56,14 +56,14 @@ static void print_device(struct udev_device *device) int count; printf("*** device: %p ***\n", device); + str = udev_device_get_syspath(device); + printf("syspath: '%s'\n", str); str = udev_device_get_devpath(device); printf("devpath: '%s'\n", str); str = udev_device_get_subsystem(device); printf("subsystem: '%s'\n", str); str = udev_device_get_driver(device); printf("driver: '%s'\n", str); - str = udev_device_get_syspath(device); - printf("syspath: '%s'\n", str); str = udev_device_get_devname(device); printf("devname: '%s'\n", str); count = udev_device_get_devlinks(device, print_devlinks_cb, NULL); @@ -73,12 +73,12 @@ static void print_device(struct udev_device *device) printf("\n"); } -static int test_device(struct udev *udev, const char *devpath) +static int test_device(struct udev *udev, const char *syspath) { struct udev_device *device; - printf("looking at device: %s\n", devpath); - device = udev_device_new_from_devpath(udev, devpath); + printf("looking at device: %s\n", syspath); + device = udev_device_new_from_syspath(udev, syspath); if (device == NULL) { printf("no device\n"); return -1; @@ -88,13 +88,13 @@ static int test_device(struct udev *udev, const char *devpath) return 0; } -static int test_device_parents(struct udev *udev, const char *devpath) +static int test_device_parents(struct udev *udev, const char *syspath) { struct udev_device *device; struct udev_device *device_parent; - printf("looking at device: %s\n", devpath); - device = udev_device_new_from_devpath(udev, devpath); + printf("looking at device: %s\n", syspath); + device = udev_device_new_from_syspath(udev, syspath); if (device == NULL) return -1; @@ -185,7 +185,7 @@ int main(int argc, char *argv[], char *envp[]) { struct udev *udev = NULL; static const struct option options[] = { - { "devpath", 1, NULL, 'p' }, + { "syspath", 1, NULL, 'p' }, { "subsystem", 1, NULL, 's' }, { "socket", 1, NULL, 'S' }, { "debug", 0, NULL, 'd' }, @@ -193,9 +193,10 @@ int main(int argc, char *argv[], char *envp[]) { "version", 0, NULL, 'V' }, {} }; - const char *devpath = "/devices/virtual/mem/null"; + const char *syspath = "/devices/virtual/mem/null"; const char *subsystem = NULL; const char *socket = "@/org/kernel/udev/monitor"; + char path[1024]; const char *str; udev = udev_new(); @@ -216,7 +217,7 @@ int main(int argc, char *argv[], char *envp[]) switch (option) { case 'p': - devpath = optarg; + syspath = optarg; break; case 's': subsystem = optarg; @@ -229,7 +230,7 @@ int main(int argc, char *argv[], char *envp[]) udev_set_log_priority(udev, LOG_INFO); break; case 'h': - printf("--debug --devpath= --subsystem= --socket= --help\n"); + printf("--debug --syspath= --subsystem= --socket= --help\n"); goto out; case 'V': printf("%s\n", VERSION); @@ -244,8 +245,14 @@ int main(int argc, char *argv[], char *envp[]) str = udev_get_dev_path(udev); printf("dev_path: '%s'\n", str); - test_device(udev, devpath); - test_device_parents(udev, devpath); + /* add sys path if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { + snprintf(path, sizeof(path), "%s%s", udev_get_sys_path(udev), syspath); + syspath = path; + } + + test_device(udev, syspath); + test_device_parents(udev, syspath); test_enumerate(udev, subsystem); test_monitor(udev, socket); out: diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index a2858e5dc9..9ce83aabd8 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -166,12 +166,12 @@ static void print_record(struct udev_device *device) } static int export_all_cb(struct udev *udev, - const char *devpath, const char *subsystem, const char *name, + const char *syspath, const char *subsystem, const char *name, void *data) { struct udev_device *device; - device = udev_device_new_from_devpath(udev, devpath); + device = udev_device_new_from_syspath(udev, syspath); if (device == NULL) return 0; if (udev_device_get_devname(device) != NULL) @@ -215,7 +215,9 @@ static struct udev_device *lookup_device_by_name(struct udev *udev, const char * info(udev, "skip '%s', dev_t doesn't match\n", udevice_loop->name); goto next; } - udev_device = udev_device_new_from_devpath(udev, udevice_loop->dev->devpath); + util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); + util_strlcat(filename, udevice_loop->dev->devpath, sizeof(filename)); + udev_device = udev_device_new_from_syspath(udev, filename); udev_device_cleanup(udevice_loop); break; next: @@ -348,13 +350,15 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) rc = 2; goto exit; } - /* remove /sys if given */ - if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) == 0) - util_strlcpy(path, &optarg[strlen(udev_get_sys_path(udev))], sizeof(path)); - else + /* add /sys if needed */ + if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, optarg, sizeof(path)); + } else { util_strlcpy(path, optarg, sizeof(path)); + } util_remove_trailing_chars(path, '/'); - device = udev_device_new_from_devpath(udev, path); + device = udev_device_new_from_syspath(udev, path); break; case 'q': action = ACTION_QUERY; -- cgit v1.2.3-54-g00ecf From 7b3a52f4999fa66914868f92b6ef139ba636648b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Sep 2008 18:01:15 -0700 Subject: libudev: rename ctrl_msg to ctrl_msg_wire --- TODO | 1 - udev/lib/exported_symbols | 2 +- udev/lib/libudev-ctrl.c | 44 ++++++++++++++++++++++---------------------- udev/lib/test-libudev.c | 2 ++ 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/TODO b/TODO index 74f6936c43..bbb585b002 100644 --- a/TODO +++ b/TODO @@ -12,4 +12,3 @@ These things will change in future udev versions: before next release: o replace list.h with gpl or later version - o udev_* prefix for private methods (ctrl_*)? diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index ab12ff57f1..f1c2f9d1cd 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -12,8 +12,8 @@ udev_device_get_parent udev_device_ref udev_device_unref udev_device_get_udev -udev_device_get_devpath udev_device_get_syspath +udev_device_get_devpath udev_device_get_devname udev_device_get_subsystem udev_device_get_devlinks diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index e42f631571..f7cec371b1 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -45,7 +45,7 @@ enum udev_ctrl_msg_type { UDEV_CTRL_SET_MAX_CHILDS_RUNNING, }; -struct ctrl_msg { +struct ctrl_msg_wire { char magic[32]; enum udev_ctrl_msg_type type; union { @@ -57,7 +57,7 @@ struct ctrl_msg { struct udev_ctrl_msg { int refcount; struct udev_ctrl *uctrl; - struct ctrl_msg ctrl_msg; + struct ctrl_msg_wire ctrl_msg_wire; }; struct udev_ctrl { @@ -146,19 +146,19 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl) static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf) { - struct ctrl_msg ctrl_msg; + struct ctrl_msg_wire ctrl_msg_wire; int err; - memset(&ctrl_msg, 0x00, sizeof(struct ctrl_msg)); - strcpy(ctrl_msg.magic, UDEV_CTRL_MAGIC); - ctrl_msg.type = type; + memset(&ctrl_msg_wire, 0x00, sizeof(struct ctrl_msg_wire)); + strcpy(ctrl_msg_wire.magic, UDEV_CTRL_MAGIC); + ctrl_msg_wire.type = type; if (buf != NULL) - util_strlcpy(ctrl_msg.buf, buf, sizeof(ctrl_msg.buf)); + util_strlcpy(ctrl_msg_wire.buf, buf, sizeof(ctrl_msg_wire.buf)); else - ctrl_msg.intval = intval; + ctrl_msg_wire.intval = intval; - err = sendto(uctrl->sock, &ctrl_msg, sizeof(ctrl_msg), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + err = sendto(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); if (err == -1) { err(uctrl->udev, "error sending message: %s\n", strerror(errno)); } @@ -218,7 +218,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) uctrl_msg->refcount = 1; uctrl_msg->uctrl = uctrl; - iov.iov_base = &uctrl_msg->ctrl_msg; + iov.iov_base = &uctrl_msg->ctrl_msg_wire; iov.iov_len = sizeof(struct udev_ctrl_msg); memset(&smsg, 0x00, sizeof(struct msghdr)); @@ -245,12 +245,12 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) goto err; } - if (strncmp(uctrl_msg->ctrl_msg.magic, UDEV_CTRL_MAGIC, sizeof(UDEV_CTRL_MAGIC)) != 0 ) { - err(uctrl->udev, "message magic '%s' doesn't match, ignore it\n", uctrl_msg->ctrl_msg.magic); + if (strncmp(uctrl_msg->ctrl_msg_wire.magic, UDEV_CTRL_MAGIC, sizeof(UDEV_CTRL_MAGIC)) != 0 ) { + err(uctrl->udev, "message magic '%s' doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); goto err; } - info(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg.type); + info(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); return uctrl_msg; err: udev_ctrl_msg_unref(uctrl_msg); @@ -278,42 +278,42 @@ void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_SET_LOG_LEVEL) - return ctrl_msg->ctrl_msg.intval; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) + return ctrl_msg->ctrl_msg_wire.intval; return -1; } int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_STOP_EXEC_QUEUE) + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) return 1; return -1; } int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_START_EXEC_QUEUE) + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) return 1; return -1; } int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_RELOAD_RULES) + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD_RULES) return 1; return -1; } const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_SET_ENV) - return ctrl_msg->ctrl_msg.buf; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) + return ctrl_msg->ctrl_msg_wire.buf; return NULL; } int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg.type == UDEV_CTRL_SET_MAX_CHILDS) - return ctrl_msg->ctrl_msg.intval; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_MAX_CHILDS) + return ctrl_msg->ctrl_msg_wire.intval; return -1; } diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 4dcc80a141..929fd66730 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -56,6 +56,8 @@ static void print_device(struct udev_device *device) int count; printf("*** device: %p ***\n", device); + str = udev_device_get_action(device); + printf("action: '%s'\n", str); str = udev_device_get_syspath(device); printf("syspath: '%s'\n", str); str = udev_device_get_devpath(device); -- cgit v1.2.3-54-g00ecf From c68a2936786f973ce1e249c6c33f48adc63ac709 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Sep 2008 00:40:47 -0700 Subject: vol_id: fix lib logging glue --- extras/volume_id/vol_id.c | 22 +++++++++++----------- udev/lib/exported_symbols | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 79ed099803..b47d6a4ecb 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -39,6 +39,7 @@ #define BLKGETSIZE64 _IOR(0x12,114,size_t) static int debug; +struct udev *udev_ctx; static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, @@ -57,7 +58,7 @@ static void vid_log(int priority, const char *file, int line, const char *format va_list args; va_start(args, format); - log_fn(NULL, priority, file, line, NULL, format, args); + udev_log(udev_ctx, priority, file, line, NULL, format, args); va_end(args); return; } @@ -109,7 +110,6 @@ static int all_probers(volume_id_probe_fn_t probe_fn, int main(int argc, char *argv[]) { - struct udev *udev; static const struct option options[] = { { "label", 0, NULL, 'l' }, { "label-raw", 0, NULL, 'L' }, @@ -146,11 +146,11 @@ int main(int argc, char *argv[]) int retval; int rc = 0; - udev = udev_new(); - if (udev == NULL) + udev_ctx = udev_new(); + if (udev_ctx == NULL) goto exit; logging_init("vol_id"); - udev_set_log_fn(udev, log_fn); + udev_set_log_fn(udev_ctx, log_fn); /* hook in our debug into libvolume_id */ volume_id_log_fn = vid_log; @@ -165,8 +165,8 @@ int main(int argc, char *argv[]) switch (option) { case 'd': debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); + if (udev_get_log_priority(udev_ctx) < LOG_INFO) + udev_set_log_priority(udev_ctx, LOG_INFO); break; case 'l': print = PRINT_LABEL; @@ -214,7 +214,7 @@ int main(int argc, char *argv[]) node = argv[optind]; if (!node) { - err(udev, "no device\n"); + err(udev_ctx, "no device\n"); fprintf(stderr, "no device\n"); rc = 1; goto exit; @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) if (ioctl(fd, BLKGETSIZE64, &size) != 0) size = 0; - info(udev, "BLKGETSIZE64=%llu (%lluGB)\n", (unsigned long long)size, (unsigned long long)size >> 30); + info(udev_ctx, "BLKGETSIZE64=%llu (%lluGB)\n", (unsigned long long)size, (unsigned long long)size >> 30); /* try to drop all privileges before reading disk content */ if (getuid() == 0) { @@ -246,7 +246,7 @@ int main(int argc, char *argv[]) if (setgroups(0, NULL) != 0 || setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) - info(udev, "unable to drop privileges: %s\n\n", strerror(errno)); + info(udev_ctx, "unable to drop privileges: %s\n\n", strerror(errno)); } } @@ -320,7 +320,7 @@ int main(int argc, char *argv[]) exit: if (vid != NULL) volume_id_close(vid); - udev_unref(udev); + udev_unref(udev_ctx); logging_close(); return rc; } diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index f1c2f9d1cd..2711f0b00a 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -1,7 +1,7 @@ -udev_log_fn udev_new udev_ref udev_unref +udev_log udev_set_log_fn udev_get_log_priority udev_set_log_priority -- cgit v1.2.3-54-g00ecf From 44589a0c7366c79139bbb7f96b238cb0dcc32d44 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Sep 2008 09:53:36 -0700 Subject: fix broken symlink resolving --- udev/udev_sysfs.c | 39 ++++++++++++++++++++++++++++++++++++--- udev/udevadm-trigger.c | 10 ++++------ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c index 97dcd03111..3e395a2801 100644 --- a/udev/udev_sysfs.c +++ b/udev/udev_sysfs.c @@ -40,6 +40,39 @@ struct sysfs_attr { char value_local[UTIL_NAME_SIZE]; }; +static int resolve_sys_link(struct udev *udev, char *path, size_t size) +{ + char link_path[UTIL_PATH_SIZE]; + char link_target[UTIL_PATH_SIZE]; + + int len; + int i; + int back; + + util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); + util_strlcat(link_path, path, sizeof(link_path)); + len = readlink(link_path, link_target, sizeof(link_target)); + if (len <= 0) + return -1; + link_target[len] = '\0'; + dbg(udev, "path link '%s' points to '%s'\n", path, link_target); + + for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) + ; + dbg(udev, "base '%s', tail '%s', back %i\n", path, &link_target[back * 3], back); + for (i = 0; i <= back; i++) { + char *pos = strrchr(path, '/'); + + if (pos == NULL) + return -1; + pos[0] = '\0'; + } + dbg(udev, "after moving back '%s'\n", path); + util_strlcat(path, "/", size); + util_strlcat(path, &link_target[back * 3], size); + return 0; +} + int sysfs_init(void) { INIT_LIST_HEAD(&dev_list); @@ -144,7 +177,7 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) return NULL; } if (S_ISLNK(statbuf.st_mode)) { - if (util_resolve_sys_link(udev, devpath_real, sizeof(devpath_real)) != 0) + if (resolve_sys_link(udev, devpath_real, sizeof(devpath_real)) != 0) return NULL; /* now look for device in cache after path translation */ @@ -258,7 +291,7 @@ struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_dev device_link: util_strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); util_strlcat(parent_devpath, "/device", sizeof(parent_devpath)); - if (util_resolve_sys_link(udev, parent_devpath, sizeof(parent_devpath)) != 0) + if (resolve_sys_link(udev, parent_devpath, sizeof(parent_devpath)) != 0) return NULL; /* get parent and remember it */ @@ -460,7 +493,7 @@ out: return 0; found: if (S_ISLNK(statbuf.st_mode)) - util_resolve_sys_link(udev, path, sizeof(path_full) - sysfs_len); + resolve_sys_link(udev, path, sizeof(path_full) - sysfs_len); util_strlcpy(devpath_full, path, len); return 1; } diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index f0535f5eb0..8a2c125664 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -65,7 +65,6 @@ static int delay_device(const char *devpath) static int device_list_insert(struct udev *udev, const char *path) { char filename[UTIL_PATH_SIZE]; - char devpath[UTIL_PATH_SIZE]; struct stat statbuf; dbg(udev, "add '%s'\n" , path); @@ -78,16 +77,15 @@ static int device_list_insert(struct udev *udev, const char *path) if (!(statbuf.st_mode & S_IWUSR)) return -1; - util_strlcpy(devpath, &path[strlen(udev_get_sys_path(udev))], sizeof(devpath)); - /* resolve possible link to real target */ - if (lstat(path, &statbuf) < 0) + util_strlcpy(filename, path, sizeof(filename)); + if (lstat(filename, &statbuf) < 0) return -1; if (S_ISLNK(statbuf.st_mode)) - if (util_resolve_sys_link(udev, devpath, sizeof(devpath)) != 0) + if (util_resolve_sys_link(udev, filename, sizeof(filename)) != 0) return -1; - name_list_add(udev, &device_list, devpath, 1); + name_list_add(udev, &device_list, filename, 1); return 0; } -- cgit v1.2.3-54-g00ecf From 034b37c83f3c27316a1a4666b2521949d89c5d8e Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 16 Sep 2008 10:03:42 -0700 Subject: udev-test.pl: set non-zero exitcode if tests fail --- test/udev-test.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index a83b156d78..27ff2a7ce0 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1896,3 +1896,7 @@ system("rm -rf $udev_root"); unlink($udev_rules); unlink($udev_conf); +if ($error > 0) { + exit(1); +} +exit(0); -- cgit v1.2.3-54-g00ecf From 7bcbf7ecc81be6be2a0862c9d713fe41869ecba3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Sep 2008 16:32:42 -0700 Subject: fix udevadm trigger --- udev/udevadm-trigger.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 8a2c125664..13736378df 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -47,7 +47,7 @@ static struct sockaddr_un saddr; static socklen_t saddrlen; /* devices that should run last cause of their dependencies */ -static int delay_device(const char *devpath) +static int delay_device(const char *syspath) { static const char *delay_device_list[] = { "*/md*", @@ -57,7 +57,7 @@ static int delay_device(const char *devpath) int i; for (i = 0; delay_device_list[i] != NULL; i++) - if (fnmatch(delay_device_list[i], devpath, 0) == 0) + if (fnmatch(delay_device_list[i], syspath, 0) == 0) return 1; return 0; } @@ -89,17 +89,16 @@ static int device_list_insert(struct udev *udev, const char *path) return 0; } -static void trigger_uevent(struct udev *udev, const char *devpath, const char *action) +static void trigger_uevent(struct udev *udev, const char *syspath, const char *action) { char filename[UTIL_PATH_SIZE]; int fd; - util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); - util_strlcat(filename, devpath, sizeof(filename)); + util_strlcpy(filename, syspath, sizeof(filename)); util_strlcat(filename, "/uevent", sizeof(filename)); if (verbose) - printf("%s\n", devpath); + printf("%s\n", syspath); if (dry_run) return; @@ -116,7 +115,7 @@ static void trigger_uevent(struct udev *udev, const char *devpath, const char *a close(fd); } -static int pass_to_socket(struct udev *udev, const char *devpath, const char *action, const char *env) +static int pass_to_socket(struct udev *udev, const char *syspath, const char *action, const char *env) { struct udevice *udevice; struct name_entry *name_loop; @@ -127,6 +126,7 @@ static int pass_to_socket(struct udev *udev, const char *devpath, const char *ac int fd; char link_target[UTIL_PATH_SIZE]; int len; + const char *devpath = syspath[strlen(udev_get_sys_path(udev))]; int err = 0; if (verbose) @@ -191,8 +191,7 @@ static int pass_to_socket(struct udev *udev, const char *devpath, const char *ac } /* add keys from device "uevent" file */ - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, devpath, sizeof(path)); + util_strlcpy(path, syspath, sizeof(path)); util_strlcat(path, "/uevent", sizeof(path)); fd = open(path, O_RDONLY); if (fd >= 0) { -- cgit v1.2.3-54-g00ecf From a076080bd43d55f0d4eabc9bef2bf46c9791372f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Sep 2008 23:32:43 -0700 Subject: libudev: pass udev_device in enumerate --- udev/lib/exported_symbols | 1 + udev/lib/libudev-enumerate.c | 58 ++++++++++++++++++-------------------------- udev/lib/libudev.h | 3 +-- udev/lib/test-libudev.c | 9 ++++--- udev/udevadm-info.c | 10 +------- udev/udevadm-trigger.c | 2 +- 6 files changed, 32 insertions(+), 51 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 2711f0b00a..c06148b254 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -15,6 +15,7 @@ udev_device_get_udev udev_device_get_syspath udev_device_get_devpath udev_device_get_devname +udev_device_get_sysname udev_device_get_subsystem udev_device_get_devlinks udev_device_get_properties diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 458be5861a..b8e4807c47 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -109,43 +109,17 @@ static int devices_delay(struct udev *udev, const char *syspath) return 0; } -static int devices_call(struct udev *udev, const char *syspath, - int (*cb)(struct udev *udev, - const char *syspath, const char *subsystem, const char *name, - void *data), - void *data, - int *cb_rc) -{ - char subsystem[UTIL_PATH_SIZE]; - const char *name; - - name = strrchr(syspath, '/'); - if (name == NULL) - return -1; - name++; - - if (util_get_sys_subsystem(udev, syspath, subsystem, sizeof(subsystem)) < 2) - return -1; - *cb_rc = cb(udev, syspath, subsystem, name, data); - return 0; -} - /** * udev_enumerate_devices: - * @udev_device: udev device - * @cb: function to be called for every property found + * @udev: udev library context + * @subsystem: the subsystem to enumerate + * @cb: function to be called for every device found * @data: data to be passed to the function * - * Retrieve the property key/value pairs belonging to the - * udev device. For every key/value pair, the passed function will be - * called. If the function returns 1, remaning properties will be - * ignored. - * - * Returns: the number of properties passed to the caller, or a negative value on error + * Returns: the number of devices passed to the caller, or a negative value on error **/ int udev_enumerate_devices(struct udev *udev, const char *subsystem, - int (*cb)(struct udev *udev, - const char *syspath, const char *subsystem, const char *name, void *data), + int (*cb)(struct udev_device *udev_device, void *data), void *data) { char base[UTIL_PATH_SIZE]; @@ -171,9 +145,16 @@ int udev_enumerate_devices(struct udev *udev, const char *subsystem, list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { if (devices_delay(udev, loop_device->name)) continue; - if (cb_rc == 0) - if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) + if (cb_rc == 0) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, loop_device->name); + if (device != NULL) { + cb_rc = cb(device, data); count++; + udev_device_unref(device); + } + } list_del(&loop_device->node); free(loop_device->name); free(loop_device); @@ -181,9 +162,16 @@ int udev_enumerate_devices(struct udev *udev, const char *subsystem, /* handle remaining delayed devices */ list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (cb_rc == 0) - if (devices_call(udev, loop_device->name, cb, data, &cb_rc) == 0) + if (cb_rc == 0) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, loop_device->name); + if (device != NULL) { + cb_rc = cb(device, data); count++; + udev_device_unref(device); + } + } list_del(&loop_device->node); free(loop_device->name); free(loop_device); diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 6996b47fa3..78fc137c12 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -70,8 +70,7 @@ extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_de extern const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr); extern int udev_enumerate_devices(struct udev *udev, const char *subsystem, - int (*cb)(struct udev *udev, - const char *syspath, const char *subsystem, const char *name, void *data), + int (*cb)(struct udev_device *udev_device, void *data), void *data); struct udev_monitor; diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 929fd66730..50123f6ec7 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -116,11 +116,12 @@ static int test_device_parents(struct udev *udev, const char *syspath) return 0; } -static int devices_enum_cb(struct udev *udev, - const char *devpath, const char *subsystem, const char *name, - void *data) +static int devices_enum_cb(struct udev_device *device, void *data) { - printf("device: '%s' (%s) '%s'\n", devpath, subsystem, name); + printf("device: '%s' (%s) '%s'\n", + udev_device_get_syspath(device), + udev_device_get_subsystem(device), + udev_device_get_sysname(device)); return 0; } diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 9ce83aabd8..abb424bfea 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -165,18 +165,10 @@ static void print_record(struct udev_device *device) printf("\n"); } -static int export_all_cb(struct udev *udev, - const char *syspath, const char *subsystem, const char *name, - void *data) +static int export_all_cb(struct udev_device *device, void *data) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) - return 0; if (udev_device_get_devname(device) != NULL) print_record(device); - udev_device_unref(device); return 0; } diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 13736378df..e7940ef92d 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -126,7 +126,7 @@ static int pass_to_socket(struct udev *udev, const char *syspath, const char *ac int fd; char link_target[UTIL_PATH_SIZE]; int len; - const char *devpath = syspath[strlen(udev_get_sys_path(udev))]; + const char *devpath = &syspath[strlen(udev_get_sys_path(udev))]; int err = 0; if (verbose) -- cgit v1.2.3-54-g00ecf From 279595bd1af86db92b063ac8b70c7ef51c67363c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Sep 2008 23:58:38 -0700 Subject: libudev: fix "subsystem" value --- TODO | 1 + udev/lib/libudev-device.c | 2 +- udev/lib/libudev-util.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index bbb585b002..325341864a 100644 --- a/TODO +++ b/TODO @@ -12,3 +12,4 @@ These things will change in future udev versions: before next release: o replace list.h with gpl or later version + o increase ressize buffer diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 782d662549..76ef298a34 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -397,7 +397,7 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) return udev_device->subsystem; /* read "subsytem" link */ - if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) == 0) { + if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { udev_device->subsystem = strdup(subsystem); return udev_device->subsystem; } diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 7053a2f825..6ec835e624 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -50,6 +50,7 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy if (pos == NULL) return -1; pos = &pos[1]; + info(udev, "resolved link to: '%s'\n", pos); return util_strlcpy(subsystem, pos, size); } -- cgit v1.2.3-54-g00ecf From a4354f9385fa6854360729678491da64be996f03 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Fri, 19 Sep 2008 14:53:25 +0000 Subject: scsi_id: compiler warning on 32-bit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sg_io_v4 interface passes pointers as u64s. It turns out GCC disapproves of us casting a u64 straight to a 32 bit pointer. cc1: warnings being treated as errors scsi_serial.c: In function ‘sg_err_category4’: scsi_serial.c:159: warning: cast to pointer from integer of different size scsi_serial.c: In function ‘scsi_dump_v4’: scsi_serial.c:303: warning: cast to pointer from integer of different size --- extras/scsi_id/scsi_serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 757f41d14e..20d30cf0df 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -156,7 +156,7 @@ static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) { return sg_err_category_new(udev, hp->device_status, 0, hp->transport_status, hp->driver_status, - (unsigned char *)hp->response, + (unsigned char *)(uintptr_t)hp->response, hp->response_len); } @@ -300,7 +300,7 @@ static int scsi_dump_v4(struct udev *udev, dev_scsi->kernel, io->driver_status, io->transport_status, io->device_status); if (io->device_status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(udev, dev_scsi, (unsigned char *)io->response, + return scsi_dump_sense(udev, dev_scsi, (unsigned char *)(uintptr_t)io->response, io->response_len); else return -1; -- cgit v1.2.3-54-g00ecf From 38f27948cdafd8a4b90a6b4f1f54b89891983506 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Sep 2008 23:03:49 -0700 Subject: always include config.h from Makefile --- Makefile.am.inc | 9 +++++++++ extras/ata_id/Makefile.am | 8 ++------ extras/cdrom_id/Makefile.am | 7 ++----- extras/collect/Makefile.am | 6 ++---- extras/edd_id/Makefile.am | 7 ++----- extras/floppy/Makefile.am | 7 ++----- extras/fstab_import/Makefile.am | 7 ++----- extras/fstab_import/fstab_import.c | 2 -- extras/scsi_id/Makefile.am | 7 ++----- extras/scsi_id/scsi_id.c | 2 -- extras/usb_id/Makefile.am | 7 ++----- extras/usb_id/usb_id.c | 2 -- extras/volume_id/Makefile.am | 7 ++----- udev/Makefile.am | 7 ++----- udev/lib/Makefile.am | 5 +---- udev/lib/libudev-ctrl.c | 2 -- udev/lib/libudev-device.c | 2 -- udev/lib/libudev-enumerate.c | 2 -- udev/lib/libudev-monitor.c | 2 -- udev/lib/libudev-private.h | 2 -- udev/lib/libudev-util.c | 2 -- udev/lib/libudev.c | 2 -- udev/lib/test-libudev.c | 2 -- udev/test-udev.c | 2 -- udev/udev.h | 2 -- udev/udev_rules_parse.c | 2 -- udev/udevadm-control.c | 2 -- udev/udevadm-info.c | 2 -- udev/udevadm.c | 2 -- udev/udevd.c | 2 -- 30 files changed, 30 insertions(+), 90 deletions(-) create mode 100644 Makefile.am.inc diff --git a/Makefile.am.inc b/Makefile.am.inc new file mode 100644 index 0000000000..f61706a2c9 --- /dev/null +++ b/Makefile.am.inc @@ -0,0 +1,9 @@ +AM_CPPFLAGS = \ + -include $(top_builddir)/config.h \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DUDEV_PREFIX=\""$(udev_prefix)"\" \ + -D_LIBUDEV_COMPILATION + +AM_CFLAGS = + +AM_LDFLAGS = diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index ce4a32330f..89aa02f5da 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -1,13 +1,9 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ ata_id -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION \ - -UUSE_SELINUX - ata_id_SOURCES = \ ata_id.c \ ../../udev/lib/libudev.h \ diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index d4db32b783..ec14366a23 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ cdrom_id @@ -6,11 +8,6 @@ udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ 60-cdrom_id.rules -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION - cdrom_id_SOURCES = \ cdrom_id.c \ ../../udev/lib/libudev.h \ diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am index a92f4aa9f5..60315dd84f 100644 --- a/extras/collect/Makefile.am +++ b/extras/collect/Makefile.am @@ -1,11 +1,9 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ collect -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" - distclean-local: rm -f Makefile.in diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 3bdbbd85b2..652d2c472d 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ edd_id @@ -6,11 +8,6 @@ udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ 61-persistent-storage-edd.rules -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION - edd_id_SOURCES = \ edd_id.c \ ../../udev/lib/libudev.h \ diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 59fc4e560f..a62dd20984 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -1,12 +1,9 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ create_floppy_devices -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION - create_floppy_devices_SOURCES = \ create_floppy_devices.c \ ../../udev/lib/libudev.h \ diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index 2ed383d95e..49e598e1f4 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ fstab_import @@ -6,11 +8,6 @@ udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ 79-fstab_import.rules -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION - fstab_import_SOURCES = \ fstab_import.c \ ../../udev/lib/libudev.h \ diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c index 245a72fffb..71ab5d34ee 100644 --- a/extras/fstab_import/fstab_import.c +++ b/extras/fstab_import/fstab_import.c @@ -13,8 +13,6 @@ #define _GNU_SOURCE 1 #endif -#include "config.h" - #include #include #include diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index b6bebb69a5..0b5dbf0450 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -1,12 +1,9 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ scsi_id -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION - scsi_id_SOURCES = \ scsi_id.c \ scsi_serial.c \ diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index d692a86799..bf06ed2794 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -14,8 +14,6 @@ * Free Software Foundation version 2 of the License. */ -#include "config.h" - #include #include #include diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index c8d743b5f4..89d59657fb 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -1,12 +1,9 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ usb_id -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION - usb_id_SOURCES = \ usb_id.c \ ../../udev/lib/libudev.h \ diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 9938dc00ef..f482147b68 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -11,8 +11,6 @@ * Free Software Foundation version 2 of the License. */ -#include - #include #include #include diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index 3e11d5c348..4d904d83c3 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + SUBDIRS = \ lib @@ -5,11 +7,6 @@ udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ vol_id -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION - vol_id_SOURCES = \ vol_id.c \ ../../udev/lib/libudev.h \ diff --git a/udev/Makefile.am b/udev/Makefile.am index 5d47baa0b3..323f508b2d 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + SUBDIRS = \ lib @@ -8,11 +10,6 @@ sbin_PROGRAMS = \ noinst_PROGRAMS = \ test-udev -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION - common_ldadd = common_files = \ diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 4cbae2e4ca..7329ab6c65 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -1,7 +1,4 @@ -AM_CPPFLAGS = \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION +include $(top_srcdir)/Makefile.am.inc noinst_PROGRAMS = \ test-libudev diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index f7cec371b1..7d37074fef 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -17,8 +17,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 76ef298a34..cc44c78ad7 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -17,8 +17,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index b8e4807c47..ca5e30e4a1 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -17,8 +17,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index f61ddb0b53..0dc8e10cbc 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -17,8 +17,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 1756be5f25..c8063d2d64 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -20,8 +20,6 @@ #ifndef _LIBUDEV_PRIVATE_H_ #define _LIBUDEV_PRIVATE_H_ -#include "config.h" - #include #include "libudev.h" #include "list.h" diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 6ec835e624..7eadc7f296 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -17,8 +17,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 04ad26c6fb..2d34925912 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -17,8 +17,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 50123f6ec7..39330a74c6 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -17,8 +17,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/test-udev.c b/udev/test-udev.c index dae7aaa634..4aa7999fc0 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/udev.h b/udev/udev.h index 55814cee0e..b8ae5f00a8 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -19,8 +19,6 @@ #ifndef _UDEV_H_ #define _UDEV_H_ -#include "config.h" - #include #include diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index a46eff98e6..541d651f0e 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index e3a91fc9a4..baffd0d204 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -12,8 +12,6 @@ * GNU General Public License for more details. */ -#include "config.h" - #include #include #include diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index abb424bfea..3cd889fe00 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -15,8 +15,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/udevadm.c b/udev/udevadm.c index 6de50f4253..b18114273c 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -15,8 +15,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include diff --git a/udev/udevd.c b/udev/udevd.c index d64beef3a9..e1ae7eac54 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -16,8 +16,6 @@ * along with this program. If not, see . */ -#include "config.h" - #include #include #include -- cgit v1.2.3-54-g00ecf From fb762bb928772f1923fef1e342d8ebca9bf7691f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 20 Sep 2008 00:01:20 -0700 Subject: libudev: udev_device_get_devname -> udev_device_get_devnode --- udev/lib/exported_symbols | 2 +- udev/lib/libudev-device.c | 4 ++-- udev/lib/libudev.h | 2 +- udev/lib/test-libudev.c | 2 +- udev/udevadm-info.c | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index c06148b254..5646bb59fa 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -14,7 +14,7 @@ udev_device_unref udev_device_get_udev udev_device_get_syspath udev_device_get_devpath -udev_device_get_devname +udev_device_get_devnode udev_device_get_sysname udev_device_get_subsystem udev_device_get_devlinks diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index cc44c78ad7..731230efd0 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -361,7 +361,7 @@ const char *udev_device_get_sysname(struct udev_device *udev_device) } /** - * udev_device_get_devname: + * udev_device_get_devnode: * @udev_device: udev device * * Retrieve the device node file name belonging to the udev device. @@ -369,7 +369,7 @@ const char *udev_device_get_sysname(struct udev_device *udev_device) * * Returns: the device node file name of the udev device, or #NULL if no device node exists **/ -const char *udev_device_get_devname(struct udev_device *udev_device) +const char *udev_device_get_devnode(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 78fc137c12..1970652f8f 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -54,7 +54,7 @@ extern const char *udev_device_get_devpath(struct udev_device *udev_device); extern const char *udev_device_get_subsystem(struct udev_device *udev_device); extern const char *udev_device_get_syspath(struct udev_device *udev_device); extern const char *udev_device_get_sysname(struct udev_device *udev_device); -extern const char *udev_device_get_devname(struct udev_device *udev_device); +extern const char *udev_device_get_devnode(struct udev_device *udev_device); extern int udev_device_get_devlinks(struct udev_device *udev_device, int (*cb)(struct udev_device *udev_device, const char *value, void *data), diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 39330a74c6..0a0d754b38 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -64,7 +64,7 @@ static void print_device(struct udev_device *device) printf("subsystem: '%s'\n", str); str = udev_device_get_driver(device); printf("driver: '%s'\n", str); - str = udev_device_get_devname(device); + str = udev_device_get_devnode(device); printf("devname: '%s'\n", str); count = udev_device_get_devlinks(device, print_devlinks_cb, NULL); printf("found %i links\n", count); diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 3cd889fe00..dbcaaffcdb 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -148,7 +148,7 @@ static void print_record(struct udev_device *device) printf("P: %s\n", udev_device_get_devpath(device)); len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("N: %s\n", &udev_device_get_devname(device)[len+1]); + printf("N: %s\n", &udev_device_get_devnode(device)[len+1]); i = device_get_devlink_priority(device); if (i != 0) printf("L: %i\n", i); @@ -165,7 +165,7 @@ static void print_record(struct udev_device *device) static int export_all_cb(struct udev_device *device, void *data) { - if (udev_device_get_devname(device) != NULL) + if (udev_device_get_devnode(device) != NULL) print_record(device); return 0; } @@ -436,12 +436,12 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) switch(query) { case QUERY_NAME: if (root) { - printf("%s\n", udev_device_get_devname(device)); + printf("%s\n", udev_device_get_devnode(device)); } else { size_t len; len = strlen(udev_get_dev_path(udev)); - printf("%s\n", &udev_device_get_devname(device)[len+1]); + printf("%s\n", &udev_device_get_devnode(device)[len+1]); } break; case QUERY_SYMLINK: -- cgit v1.2.3-54-g00ecf From 4c9dff47f696b1e6c89cc6e0a7ba683067927821 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 21 Sep 2008 23:28:56 -0700 Subject: libudev: add udev_device_new_from_devnum() --- udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 14 ++++++++++++++ udev/lib/libudev-util.c | 5 +++++ udev/lib/libudev.h | 1 + udev/lib/test-libudev.c | 16 ++++++++++++++++ 5 files changed, 37 insertions(+) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 5646bb59fa..8efd2914e2 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -8,6 +8,7 @@ udev_set_log_priority udev_get_sys_path udev_get_dev_path udev_device_new_from_syspath +udev_device_new_from_devnum udev_device_get_parent udev_device_ref udev_device_unref diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 731230efd0..8103c7fcc4 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -216,6 +216,20 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * return udev_device; } +struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) +{ + char path[UTIL_PATH_SIZE]; + + snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", + udev_get_sys_path(udev), + type == 'b' ? "block" : "char", + major(devnum), minor(devnum)); + if (util_resolve_sys_link(udev, path, sizeof(path)) < 0) + return NULL; + + return udev_device_new_from_syspath(udev, path); +} + static struct udev_device *device_new_from_parent(struct udev_device *udev_device) { struct udev_device *udev_device_parent = NULL; diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 7eadc7f296..aa544fea22 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -64,12 +64,17 @@ ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) { + struct stat statbuf; char link_target[UTIL_PATH_SIZE]; int len; int i; int back; + if (lstat(syspath, &statbuf) < 0) + return -1; + if (!S_ISLNK(statbuf.st_mode)) + return -1; len = readlink(syspath, link_target, sizeof(link_target)); if (len <= 0) return -1; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 1970652f8f..4d5fd93efc 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -46,6 +46,7 @@ extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsign struct udev_device; extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); +extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 0a0d754b38..8afd294a2f 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "libudev.h" @@ -114,6 +115,20 @@ static int test_device_parents(struct udev *udev, const char *syspath) return 0; } +static int test_device_devnum(struct udev *udev) +{ + dev_t devnum = makedev(1, 3); + struct udev_device *device; + + printf("looking up device: %u:%u\n", major(devnum), minor(devnum)); + device = udev_device_new_from_devnum(udev, 'c', devnum); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + return 0; +} + static int devices_enum_cb(struct udev_device *device, void *data) { printf("device: '%s' (%s) '%s'\n", @@ -253,6 +268,7 @@ int main(int argc, char *argv[], char *envp[]) } test_device(udev, syspath); + test_device_devnum(udev); test_device_parents(udev, syspath); test_enumerate(udev, subsystem); test_monitor(udev, socket); -- cgit v1.2.3-54-g00ecf From 03198b93038d3ea87d1699a1e982c235ff824275 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 24 Sep 2008 12:25:31 -0700 Subject: libudev: also import "uevent" file when reading udev database --- TODO | 16 ++++++++-------- udev/lib/libudev-device.c | 41 +++++++++++++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 12 deletions(-) diff --git a/TODO b/TODO index 325341864a..86f9daddf2 100644 --- a/TODO +++ b/TODO @@ -1,15 +1,15 @@ -These things would be nice to have: + o make udev_device_new_from_devnum() work with kernels without /sys/dev/ + o enumerate() - add buses and drivers + o increase ressize buffer + + o lazy init of selinux + o replace list.h with ccan list.h which is gpl-v2-or-later version o get all distros to agree on a default set of rules o rework rules to a match-action list, instead of a rules array - -These things will change in future udev versions: o log warning if the kernel uses CONFIG_SYSFS_DEPRECATED*=y, - which means that /sys/class/block/ does not exist + which means that /sys/class/block/ does not exist, but udev + will depend on it in a future release o DEVTYPE for disks is set by the kernel, they will be removed from the default rules o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names - -before next release: - o replace list.h with gpl or later version - o increase ressize buffer diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 8103c7fcc4..4a9c815064 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -65,6 +65,32 @@ static size_t syspath_to_db_path(struct udev_device *udev_device, char *filename return util_path_encode(&filename[start], len - start); } +static int device_read_uevent_file(struct udev_device *udev_device) +{ + char filename[UTIL_PATH_SIZE]; + FILE *f; + char line[UTIL_LINE_SIZE]; + + util_strlcpy(filename, udev_device->syspath, sizeof(filename)); + util_strlcat(filename, "/uevent", sizeof(filename)); + f = fopen(filename, "r"); + if (f == NULL) + return -1; + + while (fgets(line, sizeof(line), f)) { + char *pos; + + pos = strchr(line, '\n'); + if (pos == NULL) + continue; + pos[0] = '\0'; + device_add_property_from_string(udev_device, line); + } + + fclose(f); + return 0; +} + static int device_read_db(struct udev_device *udev_device) { struct stat stats; @@ -211,6 +237,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * device_set_syspath(udev_device, path); info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); + device_read_uevent_file(udev_device); if (device_read_db(udev_device) >= 0) info(udev, "device %p filled with udev database data\n", udev_device); return udev_device; @@ -219,11 +246,17 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) { char path[UTIL_PATH_SIZE]; + const char *type_str; + + if (type == 'b') + type_str = "block"; + else if (type == 'c') + type_str = "char"; + else + return NULL; - snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", - udev_get_sys_path(udev), - type == 'b' ? "block" : "char", - major(devnum), minor(devnum)); + snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", udev_get_sys_path(udev), + type_str, major(devnum), minor(devnum)); if (util_resolve_sys_link(udev, path, sizeof(path)) < 0) return NULL; -- cgit v1.2.3-54-g00ecf From c8e32461ccc2227da53f98ccd11bcb50d70929bd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 24 Sep 2008 21:39:29 -0700 Subject: libudev: add userdata pointer --- TODO | 2 ++ udev/lib/exported_symbols | 2 ++ udev/lib/libudev.c | 15 +++++++++++++++ udev/lib/libudev.h | 13 +++++++++++-- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 86f9daddf2..ef73fbd218 100644 --- a/TODO +++ b/TODO @@ -2,6 +2,8 @@ o enumerate() - add buses and drivers o increase ressize buffer + o add DVB variables to kernel, and drop shell script rule + o add watershed extra o lazy init of selinux o replace list.h with ccan list.h which is gpl-v2-or-later version o get all distros to agree on a default set of rules diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 8efd2914e2..6b034d4594 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -5,6 +5,8 @@ udev_log udev_set_log_fn udev_get_log_priority udev_set_log_priority +udev_get_userdata +udev_set_userdata udev_get_sys_path udev_get_dev_path udev_device_new_from_syspath diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 2d34925912..3ff6cabbb0 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -37,6 +37,7 @@ struct udev { void (*log_fn)(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args); + void *userdata; char *sys_path; char *dev_path; char *rules_path; @@ -89,6 +90,20 @@ static void selinux_init(struct udev *udev) #endif } +void *udev_get_userdata(struct udev *udev) +{ + if (udev == NULL) + return NULL; + return udev->userdata; +} + +void udev_set_userdata(struct udev *udev, void *userdata) +{ + if (udev == NULL) + return; + udev->userdata = userdata; +} + static void selinux_exit(struct udev *udev) { #ifdef USE_SELINUX diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 4d5fd93efc..e71f6b217a 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -29,6 +29,10 @@ #endif struct udev; +struct udev_device; +struct udev_monitor; + +/* library context */ extern struct udev *udev_new(void); extern struct udev *udev_ref(struct udev *udev); extern void udev_unref(struct udev *udev); @@ -40,11 +44,15 @@ extern int udev_get_log_priority(struct udev *udev); extern void udev_set_log_priority(struct udev *udev, int priority); extern const char *udev_get_sys_path(struct udev *udev); extern const char *udev_get_dev_path(struct udev *udev); +extern void *udev_get_userdata(struct udev *udev); +extern void udev_set_userdata(struct udev *udev, void *userdata); + +/* selinux glue */ extern void udev_selinux_resetfscreatecon(struct udev *udev); extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); -struct udev_device; +/* sys devices */ extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); @@ -70,11 +78,12 @@ extern const char *udev_device_get_action(struct udev_device *udev_device); extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); extern const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr); +/* sys enumeration */ extern int udev_enumerate_devices(struct udev *udev, const char *subsystem, int (*cb)(struct udev_device *udev_device, void *data), void *data); -struct udev_monitor; +/* udev and kernel device events */ extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev); extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); -- cgit v1.2.3-54-g00ecf From bf7ad0ea662e747701cc66cdd1b33d22b6836cdf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 25 Sep 2008 04:20:27 -0700 Subject: libudev: replace awkward callback list interfaces with list iterators --- TODO | 2 +- udev/Makefile.am | 3 +- udev/lib/Makefile.am | 1 + udev/lib/exported_symbols | 12 ++- udev/lib/libudev-device.c | 125 +++++++++++++------------- udev/lib/libudev-enumerate.c | 110 ++++++++++++----------- udev/lib/libudev-private.h | 12 ++- udev/lib/libudev-util.c | 55 ------------ udev/lib/libudev.h | 24 ++--- udev/lib/test-libudev.c | 70 +++++++++------ udev/udevadm-info.c | 209 ++++++++++++++++++++----------------------- udev/udevadm-monitor.c | 36 ++++---- 12 files changed, 316 insertions(+), 343 deletions(-) diff --git a/TODO b/TODO index ef73fbd218..d35da5491f 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ - o make udev_device_new_from_devnum() work with kernels without /sys/dev/ o enumerate() - add buses and drivers o increase ressize buffer + o set dev_t from "uevent" MAJOR/MINOR o add DVB variables to kernel, and drop shell script rule o add watershed extra diff --git a/udev/Makefile.am b/udev/Makefile.am index 323f508b2d..f15330b4f8 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -29,10 +29,11 @@ common_files = \ lib/libudev.h \ lib/libudev-private.h \ lib/libudev.c \ + lib/libudev-list.c \ + lib/libudev-util.c \ lib/libudev-device.c \ lib/libudev-monitor.c \ lib/libudev-enumerate.c \ - lib/libudev-util.c \ lib/libudev-ctrl.c if USE_SELINUX diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 7329ab6c65..0386465e80 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -19,6 +19,7 @@ include_HEADERS =\ libudev_la_SOURCES =\ libudev-private.h \ libudev.c \ + libudev-list.c \ libudev-util.c \ libudev-device.c \ libudev-enumerate.c \ diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 6b034d4594..e46aecbd37 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -9,6 +9,9 @@ udev_get_userdata udev_set_userdata udev_get_sys_path udev_get_dev_path +udev_list_get_next +udev_list_get_name +udev_list_get_value udev_device_new_from_syspath udev_device_new_from_devnum udev_device_get_parent @@ -20,14 +23,17 @@ udev_device_get_devpath udev_device_get_devnode udev_device_get_sysname udev_device_get_subsystem -udev_device_get_devlinks -udev_device_get_properties +udev_device_get_devlinks_list +udev_device_get_properties_list udev_device_get_action udev_device_get_driver udev_device_get_devnum udev_device_get_seqnum udev_device_get_attr_value -udev_enumerate_devices +udev_enumerate_new_from_subsystems +udev_enumerate_ref +udev_enumerate_unref +udev_enumerate_get_devices_list udev_monitor_new_from_socket udev_monitor_new_from_netlink udev_monitor_enable_receiving diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 4a9c815064..a772dbbcf8 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -40,7 +40,7 @@ struct udev_device { char *devname; char *subsystem; struct list_head link_list; - struct list_head env_list; + struct list_head properties_list; char *action; char *driver; char *devpath_old; @@ -189,7 +189,7 @@ struct udev_device *device_init(struct udev *udev) udev_device->refcount = 1; udev_device->udev = udev; INIT_LIST_HEAD(&udev_device->link_list); - INIT_LIST_HEAD(&udev_device->env_list); + INIT_LIST_HEAD(&udev_device->properties_list); INIT_LIST_HEAD(&udev_device->attr_list); info(udev_device->udev, "udev_device: %p created\n", udev_device); return udev_device; @@ -247,6 +247,9 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de { char path[UTIL_PATH_SIZE]; const char *type_str; + struct udev_enumerate *enumerate; + struct udev_list *list; + struct udev_device *device = NULL; if (type == 'b') type_str = "block"; @@ -255,12 +258,32 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de else return NULL; + /* /sys/dev/{block,char}/: links */ snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", udev_get_sys_path(udev), type_str, major(devnum), minor(devnum)); - if (util_resolve_sys_link(udev, path, sizeof(path)) < 0) - return NULL; + if (util_resolve_sys_link(udev, path, sizeof(path)) == 0) + return udev_device_new_from_syspath(udev, path); - return udev_device_new_from_syspath(udev, path); + /* search all sys devices for the major/minor */ + enumerate = udev_enumerate_new_from_subsystems(udev, NULL); + if (enumerate == NULL) + return NULL; + list = udev_enumerate_get_devices_list(enumerate); + while (list != NULL) { + struct udev_device *device_loop; + + device_loop = udev_device_new_from_syspath(udev, udev_list_get_name(list)); + if (device_loop != NULL) { + if (udev_device_get_devnum(device_loop) == devnum) { + device = device_loop; + break; + } + udev_device_unref(device_loop); + } + list = udev_list_get_next(list); + } + udev_enumerate_unref(enumerate); + return device; } static struct udev_device *device_new_from_parent(struct udev_device *udev_device) @@ -357,13 +380,13 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->syspath); free(udev_device->devname); free(udev_device->subsystem); - util_name_list_cleanup(udev_device->udev, &udev_device->link_list); - util_name_list_cleanup(udev_device->udev, &udev_device->env_list); + list_cleanup(udev_device->udev, &udev_device->link_list); + list_cleanup(udev_device->udev, &udev_device->properties_list); free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); free(udev_device->physdevpath); - util_name_list_cleanup(udev_device->udev, &udev_device->attr_list); + list_cleanup(udev_device->udev, &udev_device->attr_list); info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } @@ -466,64 +489,38 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) } /** - * udev_device_get_devlinks: + * udev_device_get_devlinks_list: * @udev_device: udev device - * @cb: function to be called for every device link found - * @data: data to be passed to the function * - * Retrieve the device links pointing to the device file of the - * udev device. For every device link, the passed function will be - * called with the device link string. - * The path is an absolute path, and starts with the device directory. - * If the function returns 1, remaning device links will be ignored. + * Retrieve the list of device links pointing to the device file of + * the udev device. The next list entry can be retrieved with + * udev_list_next(), which returns #NULL if no more entries exist. + * The devlink path can be retrieved from the list entry by + * udev_list_get_name(). The path is an absolute path, and starts with + * the device directory. * - * Returns: the number of device links passed to the caller, or a negative value on error + * Returns: the first entry of the device node link list **/ -int udev_device_get_devlinks(struct udev_device *udev_device, - int (*cb)(struct udev_device *udev_device, const char *value, void *data), - void *data) +struct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device) { - struct util_name_entry *name_loop; - int count = 0; - - if (udev_device == NULL) - return -1; - list_for_each_entry(name_loop, &udev_device->link_list, node) { - count++; - if (cb(udev_device, name_loop->name, data) != 0) - break; - } - return count; + return list_get_entry(&udev_device->link_list); } /** - * udev_device_get_properties: + * udev_device_get_properties_list: * @udev_device: udev device - * @cb: function to be called for every property found - * @data: data to be passed to the function * - * Retrieve the property key/value pairs belonging to the - * udev device. For every key/value pair, the passed function will be - * called. If the function returns 1, remaning properties will be - * ignored. + * Retrieve the list of key/value device properties of the udev + * device. The next list entry can be retrieved with udev_list_next(), + * which returns #NULL if no more entries exist. The property name + * can be retrieved from the list entry by udev_list_get_name(), + * the property value by udev_list_get_value(). * - * Returns: the number of properties passed to the caller, or a negative value on error + * Returns: the first entry of the property list **/ -int udev_device_get_properties(struct udev_device *udev_device, - int (*cb)(struct udev_device *udev_device, const char *key, const char *value, void *data), - void *data) +struct udev_list *udev_device_get_properties_list(struct udev_device *udev_device) { - struct util_name_entry *name_loop; - int count = 0; - - if (udev_device == NULL) - return -1; - list_for_each_entry(name_loop, &udev_device->env_list, node) { - count++; - if (cb(udev_device, name_loop->name, name_loop->value, data) != 0) - break; - } - return count; + return list_get_entry(&udev_device->properties_list); } const char *udev_device_get_driver(struct udev_device *udev_device) @@ -563,7 +560,7 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr) { - struct util_name_entry *name_loop; + struct udev_list *list; char path[UTIL_PATH_SIZE]; char value[UTIL_NAME_SIZE]; struct stat statbuf; @@ -572,11 +569,13 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch const char *val = NULL; /* look for possibly already cached result */ - list_for_each_entry(name_loop, &udev_device->attr_list, node) { - if (strcmp(name_loop->name, attr) == 0) { - info(udev_device->udev, "'%s' in cache '%s'\n", attr, name_loop->value); - return name_loop->value; + list = list_get_entry(&udev_device->attr_list); + while (list != NULL) { + if (strcmp(udev_list_get_name(list), attr) == 0) { + info(udev_device->udev, "got '%s' (%s) from cache\n", attr, udev_list_get_value(list)); + return udev_list_get_name(list); } + list = udev_list_get_next(list); } util_strlcpy(path, udev_device_get_syspath(udev_device), sizeof(path)); @@ -601,7 +600,8 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch if (pos != NULL) { pos = &pos[1]; info(udev_device->udev, "cache '%s' with link value '%s'\n", attr, pos); - val = util_name_list_add(udev_device->udev, &udev_device->attr_list, attr, pos, 0)->value; + list = list_insert(udev_device->udev, &udev_device->attr_list, attr, pos, 0); + val = udev_list_get_value(list); } } goto out; @@ -632,7 +632,8 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch value[size] = '\0'; util_remove_trailing_chars(value, '\n'); info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - val = util_name_list_add(udev_device->udev, &udev_device->attr_list, attr, value, 0)->value; + list = list_insert(udev_device->udev, &udev_device->attr_list, attr, value, 0); + val = udev_list_get_value(list); out: return val; } @@ -669,14 +670,14 @@ int device_set_devname(struct udev_device *udev_device, const char *devname) int device_add_devlink(struct udev_device *udev_device, const char *devlink) { - if (util_name_list_add(udev_device->udev, &udev_device->link_list, devlink, NULL, 0) == NULL) + if (list_insert(udev_device->udev, &udev_device->link_list, devlink, NULL, 0) == NULL) return -ENOMEM; return 0; } int device_add_property(struct udev_device *udev_device, const char *key, const char *value) { - if (util_name_list_add(udev_device->udev, &udev_device->env_list, key, value, 0) == NULL) + if (list_insert(udev_device->udev, &udev_device->properties_list, key, value, 0) == NULL) return -ENOMEM; return 0; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index ca5e30e4a1..80df8bd72d 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -29,6 +29,38 @@ #include "libudev.h" #include "libudev-private.h" +struct udev_enumerate { + struct udev *udev; + int refcount; + struct list_head devices_list; +}; + +struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return NULL; + udev_enumerate->refcount++; + return udev_enumerate; +} + +void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return; + udev_enumerate->refcount--; + if (udev_enumerate->refcount > 0) + return; + list_cleanup(udev_enumerate->udev, &udev_enumerate->devices_list); + free(udev_enumerate); +} + +struct udev_list *udev_enumerate_get_devices_list(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return NULL; + return list_get_entry(&udev_enumerate->devices_list); +} + static int devices_scan_subsystem(struct udev *udev, const char *basedir, const char *subsystem, const char *subdir, struct list_head *device_list) @@ -55,7 +87,7 @@ static int devices_scan_subsystem(struct udev *udev, util_strlcat(syspath, "/", sizeof(syspath)); util_strlcat(syspath, dent->d_name, sizeof(syspath)); util_resolve_sys_link(udev, syspath, sizeof(syspath)); - util_name_list_add(udev, device_list, syspath, NULL, 1); + list_insert(udev, device_list, syspath, NULL, 1); } closedir(dir); return 0; @@ -108,72 +140,46 @@ static int devices_delay(struct udev *udev, const char *syspath) } /** - * udev_enumerate_devices: + * udev_enumerate_new_from_subsystems: * @udev: udev library context * @subsystem: the subsystem to enumerate - * @cb: function to be called for every device found - * @data: data to be passed to the function * - * Returns: the number of devices passed to the caller, or a negative value on error + * Returns: an enumeration context **/ -int udev_enumerate_devices(struct udev *udev, const char *subsystem, - int (*cb)(struct udev_device *udev_device, void *data), - void *data) +struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, const char *subsystem) { + struct udev_enumerate *udev_enumerate; char base[UTIL_PATH_SIZE]; struct stat statbuf; - struct list_head device_list; - struct util_name_entry *loop_device; - struct util_name_entry *tmp_device; - int cb_rc = 0; - int count = 0; + struct udev_list *list; + + if (udev == NULL) + return NULL; - INIT_LIST_HEAD(&device_list); + udev_enumerate = malloc(sizeof(struct udev_enumerate)); + if (udev_enumerate == NULL) + return NULL; + memset(udev_enumerate, 0x00, (sizeof(struct udev_enumerate))); + udev_enumerate->refcount = 1; + udev_enumerate->udev = udev; + INIT_LIST_HEAD(&udev_enumerate->devices_list); /* if we have /sys/subsystem/, forget all the old stuff */ util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { - devices_scan_subsystems(udev, "/subsystem", subsystem, "/devices", &device_list); + devices_scan_subsystems(udev, "/subsystem", subsystem, "/devices", &udev_enumerate->devices_list); } else { - devices_scan_subsystems(udev, "/bus", subsystem, "/devices", &device_list); - devices_scan_subsystems(udev, "/class", subsystem, NULL, &device_list); - } - - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (devices_delay(udev, loop_device->name)) - continue; - if (cb_rc == 0) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, loop_device->name); - if (device != NULL) { - cb_rc = cb(device, data); - count++; - udev_device_unref(device); - } - } - list_del(&loop_device->node); - free(loop_device->name); - free(loop_device); + devices_scan_subsystems(udev, "/bus", subsystem, "/devices", &udev_enumerate->devices_list); + devices_scan_subsystems(udev, "/class", subsystem, NULL, &udev_enumerate->devices_list); } - /* handle remaining delayed devices */ - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (cb_rc == 0) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, loop_device->name); - if (device != NULL) { - cb_rc = cb(device, data); - count++; - udev_device_unref(device); - } - } - list_del(&loop_device->node); - free(loop_device->name); - free(loop_device); + /* sort delayed devices to the end of the list */ + list = list_get_entry(&udev_enumerate->devices_list); + while (list != NULL) { + if (devices_delay(udev, udev_list_get_name(list))) + list_move_to_end(list, &udev_enumerate->devices_list); + list = udev_list_get_next(list); } - - return count; + return udev_enumerate; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index c8063d2d64..c80c940b1f 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -76,7 +76,7 @@ extern int device_set_devlink_priority(struct udev_device *udev_device, int prio extern int device_get_ignore_remove(struct udev_device *udev_device); extern int device_set_ignore_remove(struct udev_device *udev_device, int ignore); -/* udev_ctrl - daemon runtime setup */ +/* libudev-ctrl - daemon runtime setup */ struct udev_ctrl; extern struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); extern int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); @@ -102,6 +102,13 @@ extern int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); extern const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); +/* libudev-list */ +extern struct udev_list *list_insert(struct udev *udev, struct list_head *name_list, + const char *name, const char *value, int sort); +extern struct udev_list *list_get_entry(struct list_head *list); +extern void list_move_to_end(struct udev_list *list_entry, struct list_head *list); +extern void list_cleanup(struct udev *udev, struct list_head *name_list); + /* libudev-utils */ #define UTIL_PATH_SIZE 1024 #define UTIL_LINE_SIZE 2048 @@ -115,9 +122,6 @@ struct util_name_entry { extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); extern ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); extern int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); -extern struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, - const char *name, const char *value, int sort); -extern void util_name_list_cleanup(struct udev *udev, struct list_head *name_list); extern int util_log_priority(const char *priority); extern size_t util_path_encode(char *s, size_t len); extern size_t util_path_decode(char *s); diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index aa544fea22..0e5bc37d43 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -97,61 +97,6 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) return 0; } -struct util_name_entry *util_name_list_add(struct udev *udev, struct list_head *name_list, - const char *name, const char *value, int sort) -{ - struct util_name_entry *name_loop; - struct util_name_entry *name_new; - - /* avoid duplicate entries */ - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) == 0) { - dbg(udev, "'%s' is already in the list\n", name); - return name_loop; - } - } - - if (sort) { - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) > 0) - break; - } - } - - name_new = malloc(sizeof(struct util_name_entry)); - if (name_new == NULL) - return NULL; - memset(name_new, 0x00, sizeof(struct util_name_entry)); - name_new->name = strdup(name); - if (name_new->name == NULL) { - free(name_new); - return NULL; - } - if (value != NULL) { - name_new->value = strdup(value); - if (name_new->value == NULL) { - free(name_new); - return NULL; - } - } - dbg(udev, "adding '%s=%s'\n", name_new->name, name_new->value); - list_add_tail(&name_new->node, &name_loop->node); - return name_new; -} - -void util_name_list_cleanup(struct udev *udev, struct list_head *name_list) -{ - struct util_name_entry *name_loop; - struct util_name_entry *name_tmp; - - list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { - list_del(&name_loop->node); - free(name_loop->name); - free(name_loop->value); - free(name_loop); - } -} - int util_log_priority(const char *priority) { char *endptr; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index e71f6b217a..014b53175b 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -29,7 +29,9 @@ #endif struct udev; +struct udev_list; struct udev_device; +struct udev_enumerate; struct udev_monitor; /* library context */ @@ -52,6 +54,11 @@ extern void udev_selinux_resetfscreatecon(struct udev *udev); extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); +/* list iteration */ +extern struct udev_list *udev_list_get_next(struct udev_list *list_entry); +extern const char *udev_list_get_name(struct udev_list *list_entry); +extern const char *udev_list_get_value(struct udev_list *list_entry); + /* sys devices */ extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); @@ -64,14 +71,8 @@ extern const char *udev_device_get_subsystem(struct udev_device *udev_device); extern const char *udev_device_get_syspath(struct udev_device *udev_device); extern const char *udev_device_get_sysname(struct udev_device *udev_device); extern const char *udev_device_get_devnode(struct udev_device *udev_device); -extern int udev_device_get_devlinks(struct udev_device *udev_device, - int (*cb)(struct udev_device *udev_device, - const char *value, void *data), - void *data); -extern int udev_device_get_properties(struct udev_device *udev_device, - int (*cb)(struct udev_device *udev_device, - const char *key, const char *value, void *data), - void *data); +extern struct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device); +extern struct udev_list *udev_device_get_properties_list(struct udev_device *udev_device); extern const char *udev_device_get_driver(struct udev_device *udev_device); extern dev_t udev_device_get_devnum(struct udev_device *udev_device); extern const char *udev_device_get_action(struct udev_device *udev_device); @@ -79,9 +80,10 @@ extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_de extern const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr); /* sys enumeration */ -extern int udev_enumerate_devices(struct udev *udev, const char *subsystem, - int (*cb)(struct udev_device *udev_device, void *data), - void *data); +extern struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, const char *subsystem); +extern struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); +extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); +extern struct udev_list *udev_enumerate_get_devices_list(struct udev_enumerate *udev_enumerate); /* udev and kernel device events */ extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 8afd294a2f..fed4350c09 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -37,22 +37,11 @@ static void log_fn(struct udev *udev, vprintf(format, args); } -static int print_devlinks_cb(struct udev_device *udev_device, const char *value, void *data) -{ - printf("link: '%s'\n", value); - return 0; -} - -static int print_properties_cb(struct udev_device *udev_device, const char *key, const char *value, void *data) -{ - printf("property: '%s=%s'\n", key, value); - return 0; -} - static void print_device(struct udev_device *device) { const char *str; int count; + struct udev_list *list; printf("*** device: %p ***\n", device); str = udev_device_get_action(device); @@ -67,10 +56,28 @@ static void print_device(struct udev_device *device) printf("driver: '%s'\n", str); str = udev_device_get_devnode(device); printf("devname: '%s'\n", str); - count = udev_device_get_devlinks(device, print_devlinks_cb, NULL); + + count = 0; + list = udev_device_get_devlinks_list(device); + while (list != NULL) { + printf("link: '%s'\n", udev_list_get_name(list)); + count++; + list = udev_list_get_next(list); + } printf("found %i links\n", count); - count = udev_device_get_properties(device, print_properties_cb, NULL); + + count = 0; + list = udev_device_get_properties_list(device); + while (list != NULL) { + printf("property: '%s=%s'\n", udev_list_get_name(list), udev_list_get_value(list)); + count++; + list = udev_list_get_next(list); + } printf("found %i properties\n", count); + + str = udev_device_get_attr_value(device, "dev"); + printf("attr{dev}: '%s'\n", str); + printf("\n"); } @@ -99,12 +106,14 @@ static int test_device_parents(struct udev *udev, const char *syspath) if (device == NULL) return -1; + printf("looking at parents\n"); device_parent = device; do { print_device(device_parent); device_parent = udev_device_get_parent(device_parent); } while (device_parent != NULL); + printf("looking at parents again\n"); device_parent = device; do { print_device(device_parent); @@ -129,20 +138,31 @@ static int test_device_devnum(struct udev *udev) return 0; } -static int devices_enum_cb(struct udev_device *device, void *data) -{ - printf("device: '%s' (%s) '%s'\n", - udev_device_get_syspath(device), - udev_device_get_subsystem(device), - udev_device_get_sysname(device)); - return 0; -} - static int test_enumerate(struct udev *udev, const char *subsystem) { - int count; + struct udev_enumerate *enumerate; + struct udev_list *list; + int count = 0; - count = udev_enumerate_devices(udev, subsystem, devices_enum_cb, NULL); + enumerate = udev_enumerate_new_from_subsystems(udev, NULL); + if (enumerate == NULL) + return -1; + list = udev_enumerate_get_devices_list(enumerate); + while (list != NULL) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, udev_list_get_name(list)); + if (device != NULL) { + printf("device: '%s' (%s) '%s'\n", + udev_device_get_syspath(device), + udev_device_get_subsystem(device), + udev_device_get_sysname(device)); + udev_device_unref(device); + count++; + } + list = udev_list_get_next(list); + } + udev_enumerate_unref(enumerate); printf("found %i devices\n\n", count); return count; } diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index dbcaaffcdb..6a0425769f 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -126,127 +126,43 @@ static int print_device_chain(struct udev_device *device) return 0; } -static int print_record_devlinks_cb(struct udev_device *device, const char *value, void *data) -{ - size_t len; - - len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("S: %s\n", &value[len+1]); - return 0; -} - -static int print_record_properties_cb(struct udev_device *device, const char *key, const char *value, void *data) -{ - printf("E: %s=%s\n", key, value); - return 0; -} - static void print_record(struct udev_device *device) { size_t len; int i; + struct udev_list *list; printf("P: %s\n", udev_device_get_devpath(device)); + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); printf("N: %s\n", &udev_device_get_devnode(device)[len+1]); + i = device_get_devlink_priority(device); if (i != 0) printf("L: %i\n", i); + i = device_get_num_fake_partitions(device); if (i != 0) printf("A:%u\n", i); + i = device_get_ignore_remove(device); if (i != 0) printf("R:%u\n", i); - udev_device_get_devlinks(device, print_record_devlinks_cb, NULL); - udev_device_get_properties(device, print_record_properties_cb, NULL); - printf("\n"); -} -static int export_all_cb(struct udev_device *device, void *data) -{ - if (udev_device_get_devnode(device) != NULL) - print_record(device); - return 0; -} - -static struct udev_device *lookup_device_by_name(struct udev *udev, const char *name) -{ - struct udev_device *udev_device = NULL; - LIST_HEAD(name_list); - int count; - struct name_entry *device; - - count = udev_db_get_devices_by_name(udev, name, &name_list); - if (count <= 0) - goto out; - - info(udev, "found %i devices for '%s'\n", count, name); - - /* select the device that matches */ - list_for_each_entry(device, &name_list, node) { - struct udevice *udevice_loop; - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; - - udevice_loop = udev_device_init(udev); - if (udevice_loop == NULL) - break; - if (udev_db_get_device(udevice_loop, device->name) != 0) - goto next; - info(udev, "found db entry '%s'\n", device->name); - /* make sure, we don't get a link of a different device */ - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, name, sizeof(filename)); - if (stat(filename, &statbuf) != 0) - goto next; - if (major(udevice_loop->devt) > 0 && udevice_loop->devt != statbuf.st_rdev) { - info(udev, "skip '%s', dev_t doesn't match\n", udevice_loop->name); - goto next; - } - util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); - util_strlcat(filename, udevice_loop->dev->devpath, sizeof(filename)); - udev_device = udev_device_new_from_syspath(udev, filename); - udev_device_cleanup(udevice_loop); - break; -next: - udev_device_cleanup(udevice_loop); + list = udev_device_get_devlinks_list(device); + while (list != NULL) { + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + printf("S: %s\n", &udev_list_get_name(list)[len+1]); + list = udev_list_get_next(list); } -out: - name_list_cleanup(udev, &name_list); - return udev_device; -} - -static int add_devlink_cb(struct udev_device *device, const char *value, void *data) -{ - char **links = data; - if (*links == NULL) { - *links = strdup(value); - } else { - char *str; - - asprintf(&str, "%s %s", *links, value); - free(*links); - *links = str; + list = udev_device_get_properties_list(device); + while (list != NULL) { + printf("E: %s=%s\n", udev_list_get_name(list), udev_list_get_value(list)); + list = udev_list_get_next(list); } - return 0; -} - -static int add_devlink_noroot_cb(struct udev_device *device, const char *value, void *data) -{ - size_t len; - - len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - value = &value[len+1]; - return add_devlink_cb(device, value, data); -} -static int print_property_cb(struct udev_device *device, const char *key, const char *value, void *data) -{ - printf("%s=%s\n", key, value); - return 0; + printf("\n"); } static int stat_device(const char *name, int export, const char *prefix) @@ -268,6 +184,30 @@ static int stat_device(const char *name, int export, const char *prefix) return 0; } +static int export_devices(struct udev *udev) +{ + struct udev_enumerate *enumerate; + struct udev_list *list; + + enumerate = udev_enumerate_new_from_subsystems(udev, NULL); + if (enumerate == NULL) + return -1; + list = udev_enumerate_get_devices_list(enumerate); + while (list != NULL) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, udev_list_get_name(list)); + if (device != NULL) { + if (udev_device_get_devnode(device) != NULL) + print_record(device); + udev_device_unref(device); + } + list = udev_list_get_next(list); + } + udev_enumerate_unref(enumerate); + return 0; +} + int udevadm_info(struct udev *udev, int argc, char *argv[]) { struct udev_device *device = NULL; @@ -276,7 +216,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) const char *export_prefix = NULL; char path[UTIL_PATH_SIZE]; char name[UTIL_PATH_SIZE]; - char *links; + struct udev_list *list; int rc = 0; static const struct option options[] = { @@ -313,6 +253,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) while (1) { int option; + struct stat statbuf; option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); if (option == -1) @@ -327,12 +268,37 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) goto exit; } /* remove /dev if given */ - if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) == 0) - util_strlcpy(name, &optarg[strlen(udev_get_dev_path(udev))+1], sizeof(name)); - else + if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) { + util_strlcpy(name, udev_get_dev_path(udev), sizeof(name)); + util_strlcat(name, "/", sizeof(name)); + util_strlcat(name, optarg, sizeof(name)); + } else { util_strlcpy(name, optarg, sizeof(name)); + } util_remove_trailing_chars(name, '/'); - device = lookup_device_by_name(udev, name); + if (stat(name, &statbuf) < 0) { + fprintf(stderr, "device node not found\n"); + rc = 2; + goto exit; + } else { + char type; + + if (S_ISBLK(statbuf.st_mode)) { + type = 'b'; + } else if (S_ISCHR(statbuf.st_mode)) { + type = 'c'; + } else { + fprintf(stderr, "device node has wrong file type\n"); + rc = 2; + goto exit; + } + device = udev_device_new_from_devnum(udev, type, statbuf.st_rdev); + if (device == NULL) { + fprintf(stderr, "device node not found\n"); + rc = 2; + goto exit; + } + } break; case 'p': if (device != NULL) { @@ -349,6 +315,11 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) } util_remove_trailing_chars(path, '/'); device = udev_device_new_from_syspath(udev, path); + if (device == NULL) { + fprintf(stderr, "device path not found\n"); + rc = 2; + goto exit; + } break; case 'q': action = ACTION_QUERY; @@ -388,7 +359,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) action = ACTION_ATTRIBUTE_WALK; break; case 'e': - udev_enumerate_devices(udev, NULL, export_all_cb, NULL); + export_devices(udev); goto exit; case 'x': export = 1; @@ -445,19 +416,31 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) } break; case QUERY_SYMLINK: - links = NULL; - if (root) - udev_device_get_devlinks(device, add_devlink_cb, &links); - else - udev_device_get_devlinks(device, add_devlink_noroot_cb, &links); - printf("%s\n", links); - free(links); + list = udev_device_get_devlinks_list(device); + while (list != NULL) { + if (root) { + printf("%s", udev_list_get_name(list)); + } else { + size_t len; + + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + printf("%s", &udev_list_get_name(list)[len+1]); + } + list = udev_list_get_next(list); + if (list != NULL) + printf(" "); + } + printf("\n"); break; case QUERY_PATH: printf("%s\n", udev_device_get_devpath(device)); goto exit; case QUERY_ENV: - udev_device_get_properties(device, print_property_cb, NULL); + list = udev_device_get_properties_list(device); + while (list != NULL) { + printf("%s=%s\n", udev_list_get_name(list), udev_list_get_value(list)); + list = udev_list_get_next(list); + } break; case QUERY_ALL: print_record(device); diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index a798a81626..26efa528af 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -41,18 +41,6 @@ static void asmlinkage sig_handler(int signum) udev_exit = 1; } -static int print_properties_cb(struct udev_device *udev_device, const char *key, const char *value, void *data) -{ - printf("%s=%s\n", key, value); - return 0; -} - -static void print_properties(struct udev_device *device) -{ - udev_device_get_properties(device, print_properties_cb, NULL); - printf("\n"); -} - int udevadm_monitor(struct udev *udev, int argc, char *argv[]) { struct sigaction act; @@ -178,8 +166,16 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) udev_device_get_action(device), udev_device_get_devpath(device), udev_device_get_subsystem(device)); - if (env) - print_properties(device); + if (env) { + struct udev_list *list; + + list = udev_device_get_properties_list(device); + while (list != NULL) { + printf("%s=%s\n", udev_list_get_name(list), udev_list_get_value(list)); + list = udev_list_get_next(list); + } + printf("\n"); + } udev_device_unref(device); } @@ -191,8 +187,16 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) udev_device_get_action(device), udev_device_get_devpath(device), udev_device_get_subsystem(device)); - if (env) - print_properties(device); + if (env) { + struct udev_list *list; + + list = udev_device_get_properties_list(device); + while (list != NULL) { + printf("%s=%s\n", udev_list_get_name(list), udev_list_get_value(list)); + list = udev_list_get_next(list); + } + printf("\n"); + } udev_device_unref(device); } } -- cgit v1.2.3-54-g00ecf From 04f5d75f0cfaf82e1bbdec5e398e95b3d6f3f16d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 25 Sep 2008 14:26:22 -0700 Subject: libudev: get devnum from uevent file --- TODO | 2 +- udev/lib/libudev-device.c | 26 +++++++++++++++----------- udev/lib/test-libudev.c | 3 +++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/TODO b/TODO index d35da5491f..17baf6351e 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ o enumerate() - add buses and drivers o increase ressize buffer - o set dev_t from "uevent" MAJOR/MINOR + o lazy loading of "uevent" and db o add DVB variables to kernel, and drop shell script rule o add watershed extra diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index a772dbbcf8..359ae443da 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -70,6 +70,8 @@ static int device_read_uevent_file(struct udev_device *udev_device) char filename[UTIL_PATH_SIZE]; FILE *f; char line[UTIL_LINE_SIZE]; + int maj = 0; + int min = 0; util_strlcpy(filename, udev_device->syspath, sizeof(filename)); util_strlcat(filename, "/uevent", sizeof(filename)); @@ -84,9 +86,17 @@ static int device_read_uevent_file(struct udev_device *udev_device) if (pos == NULL) continue; pos[0] = '\0'; + + if (strncmp(line, "MAJOR=", 6) == 0) + maj = strtoull(&line[6], NULL, 10); + else if (strncmp(line, "MINOR=", 6) == 0) + min = strtoull(&line[6], NULL, 10); + device_add_property_from_string(udev_device, line); } + udev_device->devnum = makedev(maj, min); + fclose(f); return 0; } @@ -97,7 +107,6 @@ static int device_read_db(struct udev_device *udev_device) char filename[UTIL_PATH_SIZE]; char line[UTIL_LINE_SIZE]; FILE *f; - int rc = 0; syspath_to_db_path(udev_device, filename, sizeof(filename)); @@ -131,7 +140,6 @@ static int device_read_db(struct udev_device *udev_device) while (fgets(line, sizeof(line), f)) { ssize_t len; const char *val; - unsigned int maj, min; len = strlen(line); if (len < 4) @@ -143,10 +151,6 @@ static int device_read_db(struct udev_device *udev_device) case 'N': asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev_device->udev), val); break; - case 'M': - sscanf(val, "%u:%u", &maj, &min); - device_set_devnum(udev_device, makedev(maj, min)); - break; case 'S': util_strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); util_strlcat(filename, "/", sizeof(filename)); @@ -157,7 +161,7 @@ static int device_read_db(struct udev_device *udev_device) device_set_devlink_priority(udev_device, atoi(val)); break; case 'T': - device_set_timeout(udev_device, atoi(val)); + device_set_timeout(udev_device, atoi(val)); break; case 'A': device_set_num_fake_partitions(udev_device, atoi(val)); @@ -172,7 +176,8 @@ static int device_read_db(struct udev_device *udev_device) } fclose(f); - return rc; + info(udev_device->udev, "device %p filled with udev database data\n", udev_device); + return 0; } struct udev_device *device_init(struct udev *udev) @@ -238,8 +243,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); device_read_uevent_file(udev_device); - if (device_read_db(udev_device) >= 0) - info(udev, "device %p filled with udev database data\n", udev_device); + device_read_db(udev_device); return udev_device; } @@ -264,7 +268,7 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de if (util_resolve_sys_link(udev, path, sizeof(path)) == 0) return udev_device_new_from_syspath(udev, path); - /* search all sys devices for the major/minor */ + /* fallback to search all sys devices for the major/minor */ enumerate = udev_enumerate_new_from_subsystems(udev, NULL); if (enumerate == NULL) return NULL; diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index fed4350c09..421d0511a1 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -40,6 +40,7 @@ static void log_fn(struct udev *udev, static void print_device(struct udev_device *device) { const char *str; + dev_t devnum; int count; struct udev_list *list; @@ -56,6 +57,8 @@ static void print_device(struct udev_device *device) printf("driver: '%s'\n", str); str = udev_device_get_devnode(device); printf("devname: '%s'\n", str); + devnum = udev_device_get_devnum(device); + printf("devnum: %u:%u\n", major(devnum), minor(devnum)); count = 0; list = udev_device_get_devlinks_list(device); -- cgit v1.2.3-54-g00ecf From cd42b50d866c35c7ffbab07920dc1323dd978a23 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 26 Sep 2008 19:41:50 +0200 Subject: libudev: enumerate_get_devices_list -> enumerate_get_list --- TODO | 3 ++- udev/lib/exported_symbols | 2 +- udev/lib/libudev-device.c | 7 +++---- udev/lib/libudev-enumerate.c | 2 +- udev/lib/libudev.h | 2 +- udev/lib/test-libudev.c | 2 +- udev/udevadm-info.c | 16 ++++++++-------- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index 17baf6351e..b61b752407 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,11 @@ o enumerate() - add buses and drivers o increase ressize buffer + o lazy loading of "uevent" and db + o lazy init of selinux o add DVB variables to kernel, and drop shell script rule o add watershed extra - o lazy init of selinux o replace list.h with ccan list.h which is gpl-v2-or-later version o get all distros to agree on a default set of rules o rework rules to a match-action list, instead of a rules array diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index e46aecbd37..9650ef4d98 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -33,7 +33,7 @@ udev_device_get_attr_value udev_enumerate_new_from_subsystems udev_enumerate_ref udev_enumerate_unref -udev_enumerate_get_devices_list +udev_enumerate_get_list udev_monitor_new_from_socket udev_monitor_new_from_netlink udev_monitor_enable_receiving diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 359ae443da..6c6b1d387c 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -118,7 +118,6 @@ static int device_read_db(struct udev_device *udev_device) char target[UTIL_PATH_SIZE]; int target_len; - info(udev_device->udev, "found a symlink as db file\n"); target_len = readlink(filename, target, sizeof(target)); if (target_len > 0) target[target_len] = '\0'; @@ -126,9 +125,9 @@ static int device_read_db(struct udev_device *udev_device) info(udev_device->udev, "error reading db link %s: %s\n", filename, strerror(errno)); return -1; } - dbg(udev_device->udev, "db link points to '%s'\n", target); if (asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev_device->udev), target) < 0) return -ENOMEM; + info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devname); return 0; } @@ -176,7 +175,7 @@ static int device_read_db(struct udev_device *udev_device) } fclose(f); - info(udev_device->udev, "device %p filled with udev database data\n", udev_device); + info(udev_device->udev, "device %p filled with db file data\n", udev_device); return 0; } @@ -272,7 +271,7 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de enumerate = udev_enumerate_new_from_subsystems(udev, NULL); if (enumerate == NULL) return NULL; - list = udev_enumerate_get_devices_list(enumerate); + list = udev_enumerate_get_list(enumerate); while (list != NULL) { struct udev_device *device_loop; diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 80df8bd72d..6d638670c9 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -54,7 +54,7 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) free(udev_enumerate); } -struct udev_list *udev_enumerate_get_devices_list(struct udev_enumerate *udev_enumerate) +struct udev_list *udev_enumerate_get_list(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return NULL; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 014b53175b..d2e57d4183 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -83,7 +83,7 @@ extern const char *udev_device_get_attr_value(struct udev_device *udev_device, c extern struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, const char *subsystem); extern struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); -extern struct udev_list *udev_enumerate_get_devices_list(struct udev_enumerate *udev_enumerate); +extern struct udev_list *udev_enumerate_get_list(struct udev_enumerate *udev_enumerate); /* udev and kernel device events */ extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 421d0511a1..19968a1738 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -150,7 +150,7 @@ static int test_enumerate(struct udev *udev, const char *subsystem) enumerate = udev_enumerate_new_from_subsystems(udev, NULL); if (enumerate == NULL) return -1; - list = udev_enumerate_get_devices_list(enumerate); + list = udev_enumerate_get_list(enumerate); while (list != NULL) { struct udev_device *device; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 6a0425769f..2f41b7adf7 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -192,7 +192,7 @@ static int export_devices(struct udev *udev) enumerate = udev_enumerate_new_from_subsystems(udev, NULL); if (enumerate == NULL) return -1; - list = udev_enumerate_get_devices_list(enumerate); + list = udev_enumerate_get_list(enumerate); while (list != NULL) { struct udev_device *device; @@ -375,18 +375,18 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) goto exit; case 'h': printf("Usage: udevadm info OPTIONS\n" - " --query= query database for the specified value:\n" + " --query= query device information:\n" " name name of device node\n" " symlink pointing to node\n" - " path sysfs device path\n" + " path sys device path\n" " env the device related imported environment\n" " all all values\n" - " --path= sysfs device path used for query or chain\n" - " --name= node or symlink name used for query\n" - " --root prepend to query result or print udev_root\n" - " --attribute-walk print all key matches while walking along chain\n" + " --path= sys device path used for query or attribute walk\n" + " --name= node or symlink name used for query or attribute walk\n" + " --root prepend dev directory to path names\n" + " --attribute-walk print all key matches while walking along the chain\n" " of parent devices\n" - " --device-id-of-file= print major/minor of underlying device\n" + " --device-id-of-file= print major:minor of device containing this file\n" " --export-db export the content of the udev database\n" " --help print this text\n" "\n"); -- cgit v1.2.3-54-g00ecf From 5fc523db68849a340bb73bd352048435a3178c52 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 26 Sep 2008 19:43:14 +0200 Subject: libudev: initialize selinux only when needed --- udev/lib/libudev.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 3ff6cabbb0..4fd8196bd9 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -43,6 +43,7 @@ struct udev { char *rules_path; int log_priority; #ifdef USE_SELINUX + int selinux_initialized; int selinux_enabled; security_context_t selinux_prev_scontext; #endif @@ -87,6 +88,7 @@ static void selinux_init(struct udev *udev) udev->selinux_prev_scontext = NULL; } } + udev->selinux_initialized = 1; #endif } @@ -107,6 +109,8 @@ void udev_set_userdata(struct udev *udev, void *userdata) static void selinux_exit(struct udev *udev) { #ifdef USE_SELINUX + if (!udev->selinux_initialized) + return; if (udev->selinux_enabled) { freecon(udev->selinux_prev_scontext); udev->selinux_prev_scontext = NULL; @@ -117,6 +121,8 @@ static void selinux_exit(struct udev *udev) void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) { #ifdef USE_SELINUX + if (!udev->selinux_initialized) + selinux_init(udev); if (udev->selinux_enabled) { security_context_t scontext = NULL; @@ -134,6 +140,8 @@ void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) { #ifdef USE_SELINUX + if (!udev->selinux_initialized) + selinux_init(udev); if (udev->selinux_enabled) { security_context_t scontext = NULL; @@ -151,6 +159,8 @@ void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned i void udev_selinux_resetfscreatecon(struct udev *udev) { #ifdef USE_SELINUX + if (!udev->selinux_initialized) + selinux_init(udev); if (udev->selinux_enabled) { if (setfscreatecon(udev->selinux_prev_scontext) < 0) err(udev, "setfscreatecon failed: %s\n", strerror(errno)); @@ -307,7 +317,6 @@ struct udev *udev_new(void) if (udev->dev_path == NULL || udev->sys_path == NULL) goto err; - selinux_init(udev); info(udev, "context %p created\n", udev); info(udev, "log_priority=%d\n", udev->log_priority); info(udev, "config_file='%s'\n", config_file); -- cgit v1.2.3-54-g00ecf From 9921484458e0233e1aae868bfa8cc1481aa460a8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 26 Sep 2008 19:43:32 +0200 Subject: libudev: device - read database only when needed --- TODO | 3 - udev/lib/libudev-device.c | 162 +++++++++++++++++++++++++++------------------ udev/lib/libudev-monitor.c | 3 +- udev/lib/libudev-private.h | 5 +- 4 files changed, 102 insertions(+), 71 deletions(-) diff --git a/TODO b/TODO index b61b752407..5c8cdc379c 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,6 @@ o enumerate() - add buses and drivers o increase ressize buffer - o lazy loading of "uevent" and db - o lazy init of selinux - o add DVB variables to kernel, and drop shell script rule o add watershed extra o replace list.h with ccan list.h which is gpl-v2-or-later version diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 6c6b1d387c..de4bd48e12 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -37,11 +37,12 @@ struct udev_device { char *syspath; const char *devpath; const char *sysname; - char *devname; + char *devnode; char *subsystem; - struct list_head link_list; + struct list_head devlink_list; struct list_head properties_list; char *action; + int event_timeout; char *driver; char *devpath_old; char *physdevpath; @@ -52,6 +53,7 @@ struct udev_device { int devlink_priority; int ignore_remove; struct list_head attr_list; + int info_loaded; }; static size_t syspath_to_db_path(struct udev_device *udev_device, char *filename, size_t len) @@ -65,42 +67,6 @@ static size_t syspath_to_db_path(struct udev_device *udev_device, char *filename return util_path_encode(&filename[start], len - start); } -static int device_read_uevent_file(struct udev_device *udev_device) -{ - char filename[UTIL_PATH_SIZE]; - FILE *f; - char line[UTIL_LINE_SIZE]; - int maj = 0; - int min = 0; - - util_strlcpy(filename, udev_device->syspath, sizeof(filename)); - util_strlcat(filename, "/uevent", sizeof(filename)); - f = fopen(filename, "r"); - if (f == NULL) - return -1; - - while (fgets(line, sizeof(line), f)) { - char *pos; - - pos = strchr(line, '\n'); - if (pos == NULL) - continue; - pos[0] = '\0'; - - if (strncmp(line, "MAJOR=", 6) == 0) - maj = strtoull(&line[6], NULL, 10); - else if (strncmp(line, "MINOR=", 6) == 0) - min = strtoull(&line[6], NULL, 10); - - device_add_property_from_string(udev_device, line); - } - - udev_device->devnum = makedev(maj, min); - - fclose(f); - return 0; -} - static int device_read_db(struct udev_device *udev_device) { struct stat stats; @@ -125,9 +91,9 @@ static int device_read_db(struct udev_device *udev_device) info(udev_device->udev, "error reading db link %s: %s\n", filename, strerror(errno)); return -1; } - if (asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev_device->udev), target) < 0) + if (asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), target) < 0) return -ENOMEM; - info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devname); + info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); return 0; } @@ -148,7 +114,7 @@ static int device_read_db(struct udev_device *udev_device) switch(line[0]) { case 'N': - asprintf(&udev_device->devname, "%s/%s", udev_get_dev_path(udev_device->udev), val); + asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), val); break; case 'S': util_strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); @@ -160,7 +126,7 @@ static int device_read_db(struct udev_device *udev_device) device_set_devlink_priority(udev_device, atoi(val)); break; case 'T': - device_set_timeout(udev_device, atoi(val)); + device_set_event_timeout(udev_device, atoi(val)); break; case 'A': device_set_num_fake_partitions(udev_device, atoi(val)); @@ -179,6 +145,54 @@ static int device_read_db(struct udev_device *udev_device) return 0; } +static int device_read_uevent_file(struct udev_device *udev_device) +{ + char filename[UTIL_PATH_SIZE]; + FILE *f; + char line[UTIL_LINE_SIZE]; + int maj = 0; + int min = 0; + + util_strlcpy(filename, udev_device->syspath, sizeof(filename)); + util_strlcat(filename, "/uevent", sizeof(filename)); + f = fopen(filename, "r"); + if (f == NULL) + return -1; + + while (fgets(line, sizeof(line), f)) { + char *pos; + + pos = strchr(line, '\n'); + if (pos == NULL) + continue; + pos[0] = '\0'; + + if (strncmp(line, "MAJOR=", 6) == 0) + maj = strtoull(&line[6], NULL, 10); + else if (strncmp(line, "MINOR=", 6) == 0) + min = strtoull(&line[6], NULL, 10); + + device_add_property_from_string(udev_device, line); + } + + udev_device->devnum = makedev(maj, min); + + fclose(f); + return 0; +} + +static void device_load_info(struct udev_device *device) +{ + device_read_uevent_file(device); + device_read_db(device); + device->info_loaded = 1; +} + +void device_set_info_loaded(struct udev_device *device) +{ + device->info_loaded = 1; +} + struct udev_device *device_init(struct udev *udev) { struct udev_device *udev_device; @@ -192,7 +206,7 @@ struct udev_device *device_init(struct udev *udev) memset(udev_device, 0x00, sizeof(struct udev_device)); udev_device->refcount = 1; udev_device->udev = udev; - INIT_LIST_HEAD(&udev_device->link_list); + INIT_LIST_HEAD(&udev_device->devlink_list); INIT_LIST_HEAD(&udev_device->properties_list); INIT_LIST_HEAD(&udev_device->attr_list); info(udev_device->udev, "udev_device: %p created\n", udev_device); @@ -241,8 +255,6 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * device_set_syspath(udev_device, path); info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); - device_read_uevent_file(udev_device); - device_read_db(udev_device); return udev_device; } @@ -381,9 +393,9 @@ void udev_device_unref(struct udev_device *udev_device) if (udev_device->parent_device != NULL) udev_device_unref(udev_device->parent_device); free(udev_device->syspath); - free(udev_device->devname); + free(udev_device->devnode); free(udev_device->subsystem); - list_cleanup(udev_device->udev, &udev_device->link_list); + list_cleanup(udev_device->udev, &udev_device->devlink_list); list_cleanup(udev_device->udev, &udev_device->properties_list); free(udev_device->action); free(udev_device->driver); @@ -446,7 +458,9 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; - return udev_device->devname; + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_device->devnode; } /** @@ -506,7 +520,11 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) **/ struct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device) { - return list_get_entry(&udev_device->link_list); + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) + device_load_info(udev_device); + return list_get_entry(&udev_device->devlink_list); } /** @@ -523,6 +541,10 @@ struct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device) **/ struct udev_list *udev_device_get_properties_list(struct udev_device *udev_device) { + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) + device_load_info(udev_device); return list_get_entry(&udev_device->properties_list); } @@ -544,6 +566,8 @@ dev_t udev_device_get_devnum(struct udev_device *udev_device) { if (udev_device == NULL) return makedev(0, 0); + if (!udev_device->info_loaded) + device_load_info(udev_device); return udev_device->devnum; } @@ -576,7 +600,7 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch while (list != NULL) { if (strcmp(udev_list_get_name(list), attr) == 0) { info(udev_device->udev, "got '%s' (%s) from cache\n", attr, udev_list_get_value(list)); - return udev_list_get_name(list); + return udev_list_get_value(list); } list = udev_list_get_next(list); } @@ -663,17 +687,17 @@ int device_set_subsystem(struct udev_device *udev_device, const char *subsystem) return 0; } -int device_set_devname(struct udev_device *udev_device, const char *devname) +int device_set_devnode(struct udev_device *udev_device, const char *devnode) { - udev_device->devname = strdup(devname); - if (udev_device->devname == NULL) + udev_device->devnode = strdup(devnode); + if (udev_device->devnode == NULL) return -ENOMEM; return 0; } int device_add_devlink(struct udev_device *udev_device, const char *devlink) { - if (list_insert(udev_device->udev, &udev_device->link_list, devlink, NULL, 0) == NULL) + if (list_insert(udev_device->udev, &udev_device->devlink_list, devlink, NULL, 0) == NULL) return -ENOMEM; return 0; } @@ -720,8 +744,6 @@ int device_set_driver(struct udev_device *udev_device, const char *driver) const char *device_get_devpath_old(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; return udev_device->devpath_old; } @@ -735,8 +757,6 @@ int device_set_devpath_old(struct udev_device *udev_device, const char *devpath_ const char *device_get_physdevpath(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; return udev_device->physdevpath; } @@ -750,8 +770,6 @@ int device_set_physdevpath(struct udev_device *udev_device, const char *physdevp int device_get_timeout(struct udev_device *udev_device) { - if (udev_device == NULL) - return -1; return udev_device->timeout; } @@ -760,6 +778,18 @@ int device_set_timeout(struct udev_device *udev_device, int timeout) udev_device->timeout = timeout; return 0; } +int device_get_event_timeout(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_device->event_timeout; +} + +int device_set_event_timeout(struct udev_device *udev_device, int event_timeout) +{ + udev_device->event_timeout = event_timeout; + return 0; +} int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) { @@ -775,8 +805,8 @@ int device_set_devnum(struct udev_device *udev_device, dev_t devnum) int device_get_num_fake_partitions(struct udev_device *udev_device) { - if (udev_device == NULL) - return -1; + if (!udev_device->info_loaded) + device_load_info(udev_device); return udev_device->num_fake_partitions; } @@ -788,8 +818,8 @@ int device_set_num_fake_partitions(struct udev_device *udev_device, int num) int device_get_devlink_priority(struct udev_device *udev_device) { - if (udev_device == NULL) - return -1; + if (!udev_device->info_loaded) + device_load_info(udev_device); return udev_device->devlink_priority; } @@ -801,8 +831,8 @@ int device_set_devlink_priority(struct udev_device *udev_device, int prio) int device_get_ignore_remove(struct udev_device *udev_device) { - if (udev_device == NULL) - return -1; + if (!udev_device->info_loaded) + device_load_info(udev_device); return udev_device->ignore_remove; } diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 0dc8e10cbc..8a1bdaed06 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -308,7 +308,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { device_set_subsystem(udev_device, &key[10]); } else if (strncmp(key, "DEVNAME=", 8) == 0) { - device_set_devname(udev_device, &key[8]); + device_set_devnode(udev_device, &key[8]); } else if (strncmp(key, "DEVLINKS=", 9) == 0) { char *slink = &key[9]; char *next = strchr(slink, ' '); @@ -344,5 +344,6 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito } device_set_devnum(udev_device, makedev(maj, min)); + device_set_info_loaded(udev_device); return udev_device; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index c80c940b1f..5be798317d 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -55,7 +55,7 @@ extern int udev_get_run(struct udev *udev); /* libudev-device */ extern int device_set_syspath(struct udev_device *udev_device, const char *syspath); extern int device_set_subsystem(struct udev_device *udev_device, const char *subsystem); -extern int device_set_devname(struct udev_device *udev_device, const char *devname); +extern int device_set_devnode(struct udev_device *udev_device, const char *devnode); extern int device_add_devlink(struct udev_device *udev_device, const char *devlink); extern int device_add_property(struct udev_device *udev_device, const char *key, const char *value); extern int device_add_property_from_string(struct udev_device *udev_device, const char *property); @@ -67,6 +67,8 @@ extern const char *device_get_physdevpath(struct udev_device *udev_device); extern int device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath); extern int device_get_timeout(struct udev_device *udev_device); extern int device_set_timeout(struct udev_device *udev_device, int timeout); +extern int device_get_event_timeout(struct udev_device *udev_device); +extern int device_set_event_timeout(struct udev_device *udev_device, int event_timeout); extern int device_set_devnum(struct udev_device *udev_device, dev_t devnum); extern int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); extern int device_get_num_fake_partitions(struct udev_device *udev_device); @@ -75,6 +77,7 @@ extern int device_get_devlink_priority(struct udev_device *udev_device); extern int device_set_devlink_priority(struct udev_device *udev_device, int prio); extern int device_get_ignore_remove(struct udev_device *udev_device); extern int device_set_ignore_remove(struct udev_device *udev_device, int ignore); +extern void device_set_info_loaded(struct udev_device *device); /* libudev-ctrl - daemon runtime setup */ struct udev_ctrl; -- cgit v1.2.3-54-g00ecf From e345e2670a8c17f5e1145cc554b7a7646e271032 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 26 Sep 2008 19:44:53 +0200 Subject: libudev: rework list handling --- TODO | 1 - extras/collect/collect.c | 2 +- udev/Makefile.am | 2 +- udev/lib/Makefile.am | 3 +- udev/lib/exported_symbols | 6 +- udev/lib/libudev-device.c | 42 +++++----- udev/lib/libudev-enumerate.c | 16 ++-- udev/lib/libudev-list.c | 193 +++++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev-private.h | 21 ++--- udev/lib/libudev.h | 6 +- udev/lib/list.h | 183 ---------------------------------------- udev/lib/test-libudev.c | 12 +-- udev/list.h | 183 ++++++++++++++++++++++++++++++++++++++++ udev/udev.h | 2 +- udev/udevadm-info.c | 22 ++--- udev/udevadm-monitor.c | 8 +- 16 files changed, 445 insertions(+), 257 deletions(-) create mode 100644 udev/lib/libudev-list.c delete mode 100644 udev/lib/list.h create mode 100644 udev/list.h diff --git a/TODO b/TODO index 5c8cdc379c..56899a94cf 100644 --- a/TODO +++ b/TODO @@ -3,7 +3,6 @@ o add DVB variables to kernel, and drop shell script rule o add watershed extra - o replace list.h with ccan list.h which is gpl-v2-or-later version o get all distros to agree on a default set of rules o rework rules to a match-action list, instead of a rules array o log warning if the kernel uses CONFIG_SYSFS_DEPRECATED*=y, diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 8c141d2a5a..14184a5e05 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -31,7 +31,7 @@ #include #include -#include "../../udev/lib/list.h" +#include "../../udev/list.h" #define TMPFILE UDEV_PREFIX "/dev/.udev/collect" #define BUFSIZE 16 diff --git a/udev/Makefile.am b/udev/Makefile.am index f15330b4f8..6f9acce5a9 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -25,7 +25,7 @@ common_files = \ udev_sysfs.c \ udev_utils.c \ udev_utils_file.c \ - lib/list.h \ + list.h \ lib/libudev.h \ lib/libudev-private.h \ lib/libudev.c \ diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 0386465e80..e800cf7f41 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -24,8 +24,7 @@ libudev_la_SOURCES =\ libudev-device.c \ libudev-enumerate.c \ libudev-ctrl.c \ - libudev-monitor.c \ - list.h + libudev-monitor.c libudev_la_LDFLAGS = \ -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 9650ef4d98..0203b1c1f4 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -9,9 +9,9 @@ udev_get_userdata udev_set_userdata udev_get_sys_path udev_get_dev_path -udev_list_get_next -udev_list_get_name -udev_list_get_value +udev_list_entry_get_next +udev_list_entry_get_name +udev_list_entry_get_value udev_device_new_from_syspath udev_device_new_from_devnum udev_device_get_parent diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index de4bd48e12..6da6cd93e4 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -39,8 +39,8 @@ struct udev_device { const char *sysname; char *devnode; char *subsystem; - struct list_head devlink_list; - struct list_head properties_list; + struct list_node devlink_list; + struct list_node properties_list; char *action; int event_timeout; char *driver; @@ -52,7 +52,7 @@ struct udev_device { int num_fake_partitions; int devlink_priority; int ignore_remove; - struct list_head attr_list; + struct list_node attr_list; int info_loaded; }; @@ -206,9 +206,9 @@ struct udev_device *device_init(struct udev *udev) memset(udev_device, 0x00, sizeof(struct udev_device)); udev_device->refcount = 1; udev_device->udev = udev; - INIT_LIST_HEAD(&udev_device->devlink_list); - INIT_LIST_HEAD(&udev_device->properties_list); - INIT_LIST_HEAD(&udev_device->attr_list); + list_init(&udev_device->devlink_list); + list_init(&udev_device->properties_list); + list_init(&udev_device->attr_list); info(udev_device->udev, "udev_device: %p created\n", udev_device); return udev_device; } @@ -287,7 +287,7 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de while (list != NULL) { struct udev_device *device_loop; - device_loop = udev_device_new_from_syspath(udev, udev_list_get_name(list)); + device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list)); if (device_loop != NULL) { if (udev_device_get_devnum(device_loop) == devnum) { device = device_loop; @@ -295,7 +295,7 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de } udev_device_unref(device_loop); } - list = udev_list_get_next(list); + list = udev_list_entry_get_next(list); } udev_enumerate_unref(enumerate); return device; @@ -511,9 +511,9 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) * * Retrieve the list of device links pointing to the device file of * the udev device. The next list entry can be retrieved with - * udev_list_next(), which returns #NULL if no more entries exist. + * udev_list_entry_next(), which returns #NULL if no more entries exist. * The devlink path can be retrieved from the list entry by - * udev_list_get_name(). The path is an absolute path, and starts with + * udev_list_entry_get_name(). The path is an absolute path, and starts with * the device directory. * * Returns: the first entry of the device node link list @@ -532,7 +532,7 @@ struct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device) * @udev_device: udev device * * Retrieve the list of key/value device properties of the udev - * device. The next list entry can be retrieved with udev_list_next(), + * device. The next list entry can be retrieved with udev_list_entry_next(), * which returns #NULL if no more entries exist. The property name * can be retrieved from the list entry by udev_list_get_name(), * the property value by udev_list_get_value(). @@ -598,11 +598,11 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch /* look for possibly already cached result */ list = list_get_entry(&udev_device->attr_list); while (list != NULL) { - if (strcmp(udev_list_get_name(list), attr) == 0) { - info(udev_device->udev, "got '%s' (%s) from cache\n", attr, udev_list_get_value(list)); - return udev_list_get_value(list); + if (strcmp(udev_list_entry_get_name(list), attr) == 0) { + info(udev_device->udev, "got '%s' (%s) from cache\n", attr, udev_list_entry_get_value(list)); + return udev_list_entry_get_value(list); } - list = udev_list_get_next(list); + list = udev_list_entry_get_next(list); } util_strlcpy(path, udev_device_get_syspath(udev_device), sizeof(path)); @@ -627,8 +627,8 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch if (pos != NULL) { pos = &pos[1]; info(udev_device->udev, "cache '%s' with link value '%s'\n", attr, pos); - list = list_insert(udev_device->udev, &udev_device->attr_list, attr, pos, 0); - val = udev_list_get_value(list); + list = list_insert_entry(udev_device->udev, &udev_device->attr_list, attr, pos, 0); + val = udev_list_entry_get_value(list); } } goto out; @@ -659,8 +659,8 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch value[size] = '\0'; util_remove_trailing_chars(value, '\n'); info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list = list_insert(udev_device->udev, &udev_device->attr_list, attr, value, 0); - val = udev_list_get_value(list); + list = list_insert_entry(udev_device->udev, &udev_device->attr_list, attr, value, 0); + val = udev_list_entry_get_value(list); out: return val; } @@ -697,14 +697,14 @@ int device_set_devnode(struct udev_device *udev_device, const char *devnode) int device_add_devlink(struct udev_device *udev_device, const char *devlink) { - if (list_insert(udev_device->udev, &udev_device->devlink_list, devlink, NULL, 0) == NULL) + if (list_insert_entry(udev_device->udev, &udev_device->devlink_list, devlink, NULL, 0) == NULL) return -ENOMEM; return 0; } int device_add_property(struct udev_device *udev_device, const char *key, const char *value) { - if (list_insert(udev_device->udev, &udev_device->properties_list, key, value, 0) == NULL) + if (list_insert_entry(udev_device->udev, &udev_device->properties_list, key, value, 0) == NULL) return -ENOMEM; return 0; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 6d638670c9..fc853b8d63 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -32,7 +32,7 @@ struct udev_enumerate { struct udev *udev; int refcount; - struct list_head devices_list; + struct list_node devices_list; }; struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) @@ -63,7 +63,7 @@ struct udev_list *udev_enumerate_get_list(struct udev_enumerate *udev_enumerate) static int devices_scan_subsystem(struct udev *udev, const char *basedir, const char *subsystem, const char *subdir, - struct list_head *device_list) + struct list_node *device_list) { char path[UTIL_PATH_SIZE]; DIR *dir; @@ -87,7 +87,7 @@ static int devices_scan_subsystem(struct udev *udev, util_strlcat(syspath, "/", sizeof(syspath)); util_strlcat(syspath, dent->d_name, sizeof(syspath)); util_resolve_sys_link(udev, syspath, sizeof(syspath)); - list_insert(udev, device_list, syspath, NULL, 1); + list_insert_entry(udev, device_list, syspath, NULL, 1); } closedir(dir); return 0; @@ -95,7 +95,7 @@ static int devices_scan_subsystem(struct udev *udev, static int devices_scan_subsystems(struct udev *udev, const char *basedir, const char *subsystem, const char *subdir, - struct list_head *device_list) + struct list_node *device_list) { char path[UTIL_PATH_SIZE]; DIR *dir; @@ -162,7 +162,7 @@ struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, con memset(udev_enumerate, 0x00, (sizeof(struct udev_enumerate))); udev_enumerate->refcount = 1; udev_enumerate->udev = udev; - INIT_LIST_HEAD(&udev_enumerate->devices_list); + list_init(&udev_enumerate->devices_list); /* if we have /sys/subsystem/, forget all the old stuff */ util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); @@ -177,9 +177,9 @@ struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, con /* sort delayed devices to the end of the list */ list = list_get_entry(&udev_enumerate->devices_list); while (list != NULL) { - if (devices_delay(udev, udev_list_get_name(list))) - list_move_to_end(list, &udev_enumerate->devices_list); - list = udev_list_get_next(list); + if (devices_delay(udev, udev_list_entry_get_name(list))) + list_move_entry_to_end(list, &udev_enumerate->devices_list); + list = udev_list_entry_get_next(list); } return udev_enumerate; } diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c new file mode 100644 index 0000000000..553edf69f8 --- /dev/null +++ b/udev/lib/libudev-list.c @@ -0,0 +1,193 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +struct udev_list { + struct udev *udev; + struct list_node node; + struct list_node *list; + char *name; + char *value; +}; + +static struct udev_list *node_to_entry(struct list_node *node) +{ + char *list; + + list = (char *)node; + list -= offsetof(struct udev_list, node); + return (struct udev_list *)list; +} + +void list_init(struct list_node *list) +{ + list->next = list; + list->prev = list; +} + +static int list_empty(struct list_node *list) +{ + return list->next == list; +} + +#if 0 +static void list_add(struct list_node *new, struct list_node *list) +{ + struct list_node *next = list->next; + + next->prev = new; + new->next = next; + new->prev = list; + list->next = new; +} +#endif + +static void list_add_to_end(struct list_node *new, struct list_node *list) +{ + struct list_node *prev = list->prev; + + list->prev = new; + new->next = list; + new->prev = prev; + prev->next = new; +} + +static void list_del(struct list_node *entry) +{ + struct list_node *prev = entry->prev; + struct list_node *next = entry->next; + + next->prev = prev; + prev->next = next; +} + +#define list_for_each_entry(pos, list) \ + for (pos = node_to_entry((list)->next); \ + &pos->node != (list); \ + pos = node_to_entry(pos->node.next)) + +#define list_for_each_entry_safe(pos, tmp, list) \ + for (pos = node_to_entry((list)->next), \ + tmp = node_to_entry(pos->node.next); \ + &pos->node != (list); \ + pos = tmp, tmp = node_to_entry(tmp->node.next)) + +struct udev_list *list_insert_entry(struct udev *udev, struct list_node *list, + const char *name, const char *value, int sort) +{ + struct udev_list *list_loop; + struct udev_list *list_new; + + /* avoid duplicate entries */ + list_for_each_entry(list_loop, list) { + if (strcmp(list_loop->name, name) == 0) { + dbg(udev, "'%s' is already in the list\n", name); + return list_loop; + } + } + + if (sort) { + list_for_each_entry(list_loop, list) { + if (strcmp(list_loop->name, name) > 0) + break; + } + } + + list_new = malloc(sizeof(struct udev_list)); + if (list_new == NULL) + return NULL; + memset(list_new, 0x00, sizeof(struct udev_list)); + list_new->udev = udev; + list_new->list = list; + list_new->name = strdup(name); + if (list_new->name == NULL) { + free(list_new); + return NULL; + } + if (value != NULL) { + list_new->value = strdup(value); + if (list_new->value == NULL) { + free(list_new); + return NULL; + } + } + dbg(udev, "adding '%s=%s'\n", list_new->name, list_new->value); + list_add_to_end(&list_new->node, &list_loop->node); + return list_new; +} + +void list_move_entry_to_end(struct udev_list *list_entry, struct list_node *list) +{ + list_del(&list_entry->node); + list_add_to_end(&list_entry->node, list); +} + +void list_cleanup(struct udev *udev, struct list_node *list) +{ + struct udev_list *list_loop; + struct udev_list *list_tmp; + + list_for_each_entry_safe(list_loop, list_tmp, list) { + list_del(&list_loop->node); + free(list_loop->name); + free(list_loop->value); + free(list_loop); + } +} + +struct udev_list *list_get_entry(struct list_node *list) +{ + if (list_empty(list)) + return NULL; + return node_to_entry(list->next); +} + +struct udev_list *udev_list_entry_get_next(struct udev_list *list_entry) +{ + struct list_node *next; + + next = list_entry->node.next; + /* empty list or no more emtries */ + if (next == list_entry->list) + return NULL; + return node_to_entry(next); +} + +const char *udev_list_entry_get_name(struct udev_list *list_entry) +{ + if (list_entry == NULL) + return NULL; + return list_entry->name; +} + +const char *udev_list_entry_get_value(struct udev_list *list_entry) +{ + if (list_entry == NULL) + return NULL; + return list_entry->value; +} diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 5be798317d..6abd7b7c20 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -22,7 +22,6 @@ #include #include "libudev.h" -#include "list.h" #ifdef USE_LOG #ifdef USE_DEBUG @@ -106,22 +105,20 @@ extern const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); /* libudev-list */ -extern struct udev_list *list_insert(struct udev *udev, struct list_head *name_list, - const char *name, const char *value, int sort); -extern struct udev_list *list_get_entry(struct list_head *list); -extern void list_move_to_end(struct udev_list *list_entry, struct list_head *list); -extern void list_cleanup(struct udev *udev, struct list_head *name_list); +struct list_node { + struct list_node *next, *prev; +}; +extern void list_init(struct list_node *list); +extern struct udev_list *list_insert_entry(struct udev *udev, struct list_node *name_list, + const char *name, const char *value, int sort); +extern struct udev_list *list_get_entry(struct list_node *list); +extern void list_move_entry_to_end(struct udev_list *list_entry, struct list_node *list); +extern void list_cleanup(struct udev *udev, struct list_node *name_list); /* libudev-utils */ #define UTIL_PATH_SIZE 1024 #define UTIL_LINE_SIZE 2048 #define UTIL_NAME_SIZE 512 -struct util_name_entry { - struct list_head node; - char *name; - char *value; - int *i; -}; extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); extern ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); extern int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index d2e57d4183..28a37af178 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -55,9 +55,9 @@ extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, uns extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); /* list iteration */ -extern struct udev_list *udev_list_get_next(struct udev_list *list_entry); -extern const char *udev_list_get_name(struct udev_list *list_entry); -extern const char *udev_list_get_value(struct udev_list *list_entry); +extern struct udev_list *udev_list_entry_get_next(struct udev_list *list_entry); +extern const char *udev_list_entry_get_name(struct udev_list *list_entry); +extern const char *udev_list_entry_get_value(struct udev_list *list_entry); /* sys devices */ extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); diff --git a/udev/lib/list.h b/udev/lib/list.h deleted file mode 100644 index c679e50ace..0000000000 --- a/udev/lib/list.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Simple doubly linked list implementation. - * - * Based on list.h in the Linux kernel source tree, licensed under - * the GNU GPL version 2. - */ - -#ifndef _LIST_H -#define _LIST_H - -/** - * container_of: - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - * cast a member of a structure out to the containing structure - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -/* - * These are non-NULL pointers that will result in page faults - * under normal circumstances, used to verify that nobody uses - * non-initialized list entries. - */ -#define LIST_POISON1 ((void *) 0x00100100) -#define LIST_POISON2 ((void *) 0x00200200) - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* Insert a new entry between two known consecutive entries. */ -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add: - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail: - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - */ -static inline void __list_del(struct list_head * prev, struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del: - * @entry: the element to delete from the list. - * - * deletes entry from list. - * - * Note: list_empty on entry does not return true after this, the entry is - * in an undefined state. - */ -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = LIST_POISON1; - entry->prev = LIST_POISON2; -} - -/** - * list_move - * @list: the entry to move - * @head: the head that will precede our entry - * delete from one list and add as another's head - */ -static inline void list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - * @list: the entry to move - * @head: the head that will follow our entry - * - * delete from one list and add as another's tail - */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_empty: - * @head: the list to test. - * - * tests whether a list is empty - */ -static inline int list_empty(struct list_head *head) -{ - return head->next == head; -} - -/** - * list_entry: - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * get the struct for this entry - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * list_for_each_entry: - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * iterate over list of given type - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_safe: - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * iterate over list of given type safe against removal of list entry - */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -#endif /* _LIST_H */ diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 19968a1738..f361ab12a4 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -63,18 +63,18 @@ static void print_device(struct udev_device *device) count = 0; list = udev_device_get_devlinks_list(device); while (list != NULL) { - printf("link: '%s'\n", udev_list_get_name(list)); + printf("link: '%s'\n", udev_list_entry_get_name(list)); count++; - list = udev_list_get_next(list); + list = udev_list_entry_get_next(list); } printf("found %i links\n", count); count = 0; list = udev_device_get_properties_list(device); while (list != NULL) { - printf("property: '%s=%s'\n", udev_list_get_name(list), udev_list_get_value(list)); + printf("property: '%s=%s'\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); count++; - list = udev_list_get_next(list); + list = udev_list_entry_get_next(list); } printf("found %i properties\n", count); @@ -154,7 +154,7 @@ static int test_enumerate(struct udev *udev, const char *subsystem) while (list != NULL) { struct udev_device *device; - device = udev_device_new_from_syspath(udev, udev_list_get_name(list)); + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list)); if (device != NULL) { printf("device: '%s' (%s) '%s'\n", udev_device_get_syspath(device), @@ -163,7 +163,7 @@ static int test_enumerate(struct udev *udev, const char *subsystem) udev_device_unref(device); count++; } - list = udev_list_get_next(list); + list = udev_list_entry_get_next(list); } udev_enumerate_unref(enumerate); printf("found %i devices\n\n", count); diff --git a/udev/list.h b/udev/list.h new file mode 100644 index 0000000000..c679e50ace --- /dev/null +++ b/udev/list.h @@ -0,0 +1,183 @@ +/* + * Simple doubly linked list implementation. + * + * Based on list.h in the Linux kernel source tree, licensed under + * the GNU GPL version 2. + */ + +#ifndef _LIST_H +#define _LIST_H + +/** + * container_of: + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + * cast a member of a structure out to the containing structure + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +/* + * These are non-NULL pointers that will result in page faults + * under normal circumstances, used to verify that nobody uses + * non-initialized list entries. + */ +#define LIST_POISON1 ((void *) 0x00100100) +#define LIST_POISON2 ((void *) 0x00200200) + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +#define INIT_LIST_HEAD(ptr) do { \ + (ptr)->next = (ptr); (ptr)->prev = (ptr); \ +} while (0) + +/* Insert a new entry between two known consecutive entries. */ +static inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add: + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail: + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + */ +static inline void __list_del(struct list_head * prev, struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del: + * @entry: the element to delete from the list. + * + * deletes entry from list. + * + * Note: list_empty on entry does not return true after this, the entry is + * in an undefined state. + */ +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; +} + +/** + * list_move + * @list: the entry to move + * @head: the head that will precede our entry + * delete from one list and add as another's head + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail + * @list: the entry to move + * @head: the head that will follow our entry + * + * delete from one list and add as another's tail + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_empty: + * @head: the list to test. + * + * tests whether a list is empty + */ +static inline int list_empty(struct list_head *head) +{ + return head->next == head; +} + +/** + * list_entry: + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + * + * get the struct for this entry + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each_entry: + * @pos: the type * to use as a loop counter. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * iterate over list of given type + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_safe: + * @pos: the type * to use as a loop counter. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * iterate over list of given type safe against removal of list entry + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +#endif /* _LIST_H */ diff --git a/udev/udev.h b/udev/udev.h index b8ae5f00a8..102f15d0b9 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -26,7 +26,7 @@ #define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 1 #include "lib/libudev.h" #include "lib/libudev-private.h" -#include "lib/list.h" +#include "list.h" #define ALLOWED_CHARS "#+-.:=@_" #define ALLOWED_CHARS_FILE ALLOWED_CHARS "/" diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 2f41b7adf7..f9e2bb207c 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -152,14 +152,14 @@ static void print_record(struct udev_device *device) list = udev_device_get_devlinks_list(device); while (list != NULL) { len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("S: %s\n", &udev_list_get_name(list)[len+1]); - list = udev_list_get_next(list); + printf("S: %s\n", &udev_list_entry_get_name(list)[len+1]); + list = udev_list_entry_get_next(list); } list = udev_device_get_properties_list(device); while (list != NULL) { - printf("E: %s=%s\n", udev_list_get_name(list), udev_list_get_value(list)); - list = udev_list_get_next(list); + printf("E: %s=%s\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); + list = udev_list_entry_get_next(list); } printf("\n"); @@ -196,13 +196,13 @@ static int export_devices(struct udev *udev) while (list != NULL) { struct udev_device *device; - device = udev_device_new_from_syspath(udev, udev_list_get_name(list)); + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list)); if (device != NULL) { if (udev_device_get_devnode(device) != NULL) print_record(device); udev_device_unref(device); } - list = udev_list_get_next(list); + list = udev_list_entry_get_next(list); } udev_enumerate_unref(enumerate); return 0; @@ -419,14 +419,14 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) list = udev_device_get_devlinks_list(device); while (list != NULL) { if (root) { - printf("%s", udev_list_get_name(list)); + printf("%s", udev_list_entry_get_name(list)); } else { size_t len; len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("%s", &udev_list_get_name(list)[len+1]); + printf("%s", &udev_list_entry_get_name(list)[len+1]); } - list = udev_list_get_next(list); + list = udev_list_entry_get_next(list); if (list != NULL) printf(" "); } @@ -438,8 +438,8 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case QUERY_ENV: list = udev_device_get_properties_list(device); while (list != NULL) { - printf("%s=%s\n", udev_list_get_name(list), udev_list_get_value(list)); - list = udev_list_get_next(list); + printf("%s=%s\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); + list = udev_list_entry_get_next(list); } break; case QUERY_ALL: diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 26efa528af..6cfad2d3b8 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -171,8 +171,8 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) list = udev_device_get_properties_list(device); while (list != NULL) { - printf("%s=%s\n", udev_list_get_name(list), udev_list_get_value(list)); - list = udev_list_get_next(list); + printf("%s=%s\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); + list = udev_list_entry_get_next(list); } printf("\n"); } @@ -192,8 +192,8 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) list = udev_device_get_properties_list(device); while (list != NULL) { - printf("%s=%s\n", udev_list_get_name(list), udev_list_get_value(list)); - list = udev_list_get_next(list); + printf("%s=%s\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); + list = udev_list_entry_get_next(list); } printf("\n"); } -- cgit v1.2.3-54-g00ecf From 0de33a61d741699f41f47ebdb505f518722159b2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Sep 2008 01:34:55 +0200 Subject: libudev: more list rework --- udev/lib/exported_symbols | 6 +- udev/lib/libudev-device.c | 40 +++++----- udev/lib/libudev-enumerate.c | 17 ++-- udev/lib/libudev-list.c | 182 +++++++++++++++++++++++-------------------- udev/lib/libudev-private.h | 15 +++- udev/lib/libudev.h | 37 +++++---- udev/lib/test-libudev.c | 60 ++++++++------ udev/udevadm-info.c | 47 +++++------ udev/udevadm-monitor.c | 70 ++++++++--------- 9 files changed, 249 insertions(+), 225 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 0203b1c1f4..8c5f700d46 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -23,8 +23,8 @@ udev_device_get_devpath udev_device_get_devnode udev_device_get_sysname udev_device_get_subsystem -udev_device_get_devlinks_list -udev_device_get_properties_list +udev_device_get_devlinks_list_entry +udev_device_get_properties_list_entry udev_device_get_action udev_device_get_driver udev_device_get_devnum @@ -33,7 +33,7 @@ udev_device_get_attr_value udev_enumerate_new_from_subsystems udev_enumerate_ref udev_enumerate_unref -udev_enumerate_get_list +udev_enumerate_get_list_entry udev_monitor_new_from_socket udev_monitor_new_from_netlink udev_monitor_enable_receiving diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 6da6cd93e4..b3731412b4 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -263,7 +263,7 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de char path[UTIL_PATH_SIZE]; const char *type_str; struct udev_enumerate *enumerate; - struct udev_list *list; + struct udev_list_entry *list_entry; struct udev_device *device = NULL; if (type == 'b') @@ -283,11 +283,10 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de enumerate = udev_enumerate_new_from_subsystems(udev, NULL); if (enumerate == NULL) return NULL; - list = udev_enumerate_get_list(enumerate); - while (list != NULL) { + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { struct udev_device *device_loop; - device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list)); + device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); if (device_loop != NULL) { if (udev_device_get_devnum(device_loop) == devnum) { device = device_loop; @@ -295,7 +294,6 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de } udev_device_unref(device_loop); } - list = udev_list_entry_get_next(list); } udev_enumerate_unref(enumerate); return device; @@ -506,7 +504,7 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) } /** - * udev_device_get_devlinks_list: + * udev_device_get_devlinks_list_entry: * @udev_device: udev device * * Retrieve the list of device links pointing to the device file of @@ -518,7 +516,7 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) * * Returns: the first entry of the device node link list **/ -struct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device) +struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -528,7 +526,7 @@ struct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device) } /** - * udev_device_get_properties_list: + * udev_device_get_properties_list_entry: * @udev_device: udev device * * Retrieve the list of key/value device properties of the udev @@ -539,7 +537,7 @@ struct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device) * * Returns: the first entry of the property list **/ -struct udev_list *udev_device_get_properties_list(struct udev_device *udev_device) +struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -587,7 +585,7 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr) { - struct udev_list *list; + struct udev_list_entry *list_entry; char path[UTIL_PATH_SIZE]; char value[UTIL_NAME_SIZE]; struct stat statbuf; @@ -596,13 +594,11 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch const char *val = NULL; /* look for possibly already cached result */ - list = list_get_entry(&udev_device->attr_list); - while (list != NULL) { - if (strcmp(udev_list_entry_get_name(list), attr) == 0) { - info(udev_device->udev, "got '%s' (%s) from cache\n", attr, udev_list_entry_get_value(list)); - return udev_list_entry_get_value(list); + udev_list_entry_foreach(list_entry, list_get_entry(&udev_device->attr_list)) { + if (strcmp(udev_list_entry_get_name(list_entry), attr) == 0) { + info(udev_device->udev, "got '%s' (%s) from cache\n", attr, udev_list_entry_get_value(list_entry)); + return udev_list_entry_get_value(list_entry); } - list = udev_list_entry_get_next(list); } util_strlcpy(path, udev_device_get_syspath(udev_device), sizeof(path)); @@ -627,8 +623,8 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch if (pos != NULL) { pos = &pos[1]; info(udev_device->udev, "cache '%s' with link value '%s'\n", attr, pos); - list = list_insert_entry(udev_device->udev, &udev_device->attr_list, attr, pos, 0); - val = udev_list_entry_get_value(list); + list_entry = list_entry_add(udev_device->udev, &udev_device->attr_list, attr, pos, 0, 0); + val = udev_list_entry_get_value(list_entry); } } goto out; @@ -659,8 +655,8 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch value[size] = '\0'; util_remove_trailing_chars(value, '\n'); info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list = list_insert_entry(udev_device->udev, &udev_device->attr_list, attr, value, 0); - val = udev_list_entry_get_value(list); + list_entry = list_entry_add(udev_device->udev, &udev_device->attr_list, attr, value, 0, 0); + val = udev_list_entry_get_value(list_entry); out: return val; } @@ -697,14 +693,14 @@ int device_set_devnode(struct udev_device *udev_device, const char *devnode) int device_add_devlink(struct udev_device *udev_device, const char *devlink) { - if (list_insert_entry(udev_device->udev, &udev_device->devlink_list, devlink, NULL, 0) == NULL) + if (list_entry_add(udev_device->udev, &udev_device->devlink_list, devlink, NULL, 1, 0) == NULL) return -ENOMEM; return 0; } int device_add_property(struct udev_device *udev_device, const char *key, const char *value) { - if (list_insert_entry(udev_device->udev, &udev_device->properties_list, key, value, 0) == NULL) + if (list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0) == NULL) return -ENOMEM; return 0; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index fc853b8d63..8f5c5640b2 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -54,7 +54,7 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) free(udev_enumerate); } -struct udev_list *udev_enumerate_get_list(struct udev_enumerate *udev_enumerate) +struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return NULL; @@ -87,7 +87,7 @@ static int devices_scan_subsystem(struct udev *udev, util_strlcat(syspath, "/", sizeof(syspath)); util_strlcat(syspath, dent->d_name, sizeof(syspath)); util_resolve_sys_link(udev, syspath, sizeof(syspath)); - list_insert_entry(udev, device_list, syspath, NULL, 1); + list_entry_add(udev, device_list, syspath, NULL, 1, 1); } closedir(dir); return 0; @@ -151,7 +151,7 @@ struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, con struct udev_enumerate *udev_enumerate; char base[UTIL_PATH_SIZE]; struct stat statbuf; - struct udev_list *list; + struct udev_list_entry *list_entry; if (udev == NULL) return NULL; @@ -168,18 +168,19 @@ struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, con util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { + info(udev, "searching 'subsystem/*/devices/*' dir\n"); devices_scan_subsystems(udev, "/subsystem", subsystem, "/devices", &udev_enumerate->devices_list); } else { + info(udev, "searching 'bus/*/devices/*' dir\n"); devices_scan_subsystems(udev, "/bus", subsystem, "/devices", &udev_enumerate->devices_list); + info(udev, "searching 'class/*' dir\n"); devices_scan_subsystems(udev, "/class", subsystem, NULL, &udev_enumerate->devices_list); } /* sort delayed devices to the end of the list */ - list = list_get_entry(&udev_enumerate->devices_list); - while (list != NULL) { - if (devices_delay(udev, udev_list_entry_get_name(list))) - list_move_entry_to_end(list, &udev_enumerate->devices_list); - list = udev_list_entry_get_next(list); + udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->devices_list)) { + if (devices_delay(udev, udev_list_entry_get_name(list_entry))) + list_entry_move_to_end(list_entry); } return udev_enumerate; } diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index 553edf69f8..895c665e40 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -27,7 +27,7 @@ #include "libudev.h" #include "libudev-private.h" -struct udev_list { +struct udev_list_entry { struct udev *udev; struct list_node node; struct list_node *list; @@ -35,157 +35,171 @@ struct udev_list { char *value; }; -static struct udev_list *node_to_entry(struct list_node *node) -{ - char *list; - - list = (char *)node; - list -= offsetof(struct udev_list, node); - return (struct udev_list *)list; -} - +/* list head point to itself if empty */ void list_init(struct list_node *list) { list->next = list; list->prev = list; } -static int list_empty(struct list_node *list) +static int list_is_empty(struct list_node *list) { return list->next == list; } -#if 0 -static void list_add(struct list_node *new, struct list_node *list) +static void list_node_insert_between(struct list_node *new, + struct list_node *prev, + struct list_node *next) { - struct list_node *next = list->next; - next->prev = new; new->next = next; - new->prev = list; - list->next = new; -} -#endif - -static void list_add_to_end(struct list_node *new, struct list_node *list) -{ - struct list_node *prev = list->prev; - - list->prev = new; - new->next = list; new->prev = prev; prev->next = new; } -static void list_del(struct list_node *entry) +static void list_node_remove(struct list_node *entry) { struct list_node *prev = entry->prev; struct list_node *next = entry->next; next->prev = prev; prev->next = next; + + entry->prev = NULL; + entry->next = NULL; } -#define list_for_each_entry(pos, list) \ - for (pos = node_to_entry((list)->next); \ - &pos->node != (list); \ - pos = node_to_entry(pos->node.next)) +/* return list entry which embeds this node */ +static struct udev_list_entry *list_node_to_entry(struct list_node *node) +{ + char *list; -#define list_for_each_entry_safe(pos, tmp, list) \ - for (pos = node_to_entry((list)->next), \ - tmp = node_to_entry(pos->node.next); \ - &pos->node != (list); \ - pos = tmp, tmp = node_to_entry(tmp->node.next)) + list = (char *)node; + list -= offsetof(struct udev_list_entry, node); + return (struct udev_list_entry *)list; +} + +/* insert entry into a list as the last element */ +static void list_entry_append(struct udev_list_entry *new, struct list_node *list) +{ + /* inserting before the list head make the node the last node in the list */ + list_node_insert_between(&new->node, list->prev, list); + new->list = list; +} + +/* insert entry into a list, before a given existing entry */ +static void list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) +{ + list_node_insert_between(&new->node, entry->node.prev, &entry->node); + new->list = entry->list; +} -struct udev_list *list_insert_entry(struct udev *udev, struct list_node *list, - const char *name, const char *value, int sort) +void list_entry_remove(struct udev_list_entry *entry) { - struct udev_list *list_loop; - struct udev_list *list_new; - - /* avoid duplicate entries */ - list_for_each_entry(list_loop, list) { - if (strcmp(list_loop->name, name) == 0) { - dbg(udev, "'%s' is already in the list\n", name); - return list_loop; + list_node_remove(&entry->node); + entry->list = NULL; +} + +struct udev_list_entry *list_entry_add(struct udev *udev, struct list_node *list, + const char *name, const char *value, + int unique, int sort) +{ + struct udev_list_entry *entry_loop = NULL; + struct udev_list_entry *entry_new; + + if (unique) + udev_list_entry_foreach(entry_loop, list_get_entry(list)) { + if (strcmp(entry_loop->name, name) == 0) { + info(udev, "'%s' is already in the list\n", name); + if (value != NULL) { + free(entry_loop->value); + entry_loop->value = strdup(value); + if (entry_loop->value == NULL) + return NULL; + info(udev, "'%s' value replaced with '%s'\n", name, value); + } + return entry_loop; + } } - } - if (sort) { - list_for_each_entry(list_loop, list) { - if (strcmp(list_loop->name, name) > 0) + if (sort) + udev_list_entry_foreach(entry_loop, list_get_entry(list)) { + if (strcmp(entry_loop->name, name) > 0) break; } - } - list_new = malloc(sizeof(struct udev_list)); - if (list_new == NULL) + entry_new = malloc(sizeof(struct udev_list_entry)); + if (entry_new == NULL) return NULL; - memset(list_new, 0x00, sizeof(struct udev_list)); - list_new->udev = udev; - list_new->list = list; - list_new->name = strdup(name); - if (list_new->name == NULL) { - free(list_new); + memset(entry_new, 0x00, sizeof(struct udev_list_entry)); + entry_new->udev = udev; + entry_new->name = strdup(name); + if (entry_new->name == NULL) { + free(entry_new); return NULL; } if (value != NULL) { - list_new->value = strdup(value); - if (list_new->value == NULL) { - free(list_new); + entry_new->value = strdup(value); + if (entry_new->value == NULL) { + free(entry_new->name); + free(entry_new); return NULL; } } - dbg(udev, "adding '%s=%s'\n", list_new->name, list_new->value); - list_add_to_end(&list_new->node, &list_loop->node); - return list_new; + if (entry_loop != NULL) + list_entry_insert_before(entry_new, entry_loop); + else + list_entry_append(entry_new, list); + return entry_new; } -void list_move_entry_to_end(struct udev_list *list_entry, struct list_node *list) +void list_entry_move_to_end(struct udev_list_entry *list_entry) { - list_del(&list_entry->node); - list_add_to_end(&list_entry->node, list); + list_node_remove(&list_entry->node); + list_node_insert_between(&list_entry->node, list_entry->list->prev, list_entry->list); } void list_cleanup(struct udev *udev, struct list_node *list) { - struct udev_list *list_loop; - struct udev_list *list_tmp; - - list_for_each_entry_safe(list_loop, list_tmp, list) { - list_del(&list_loop->node); - free(list_loop->name); - free(list_loop->value); - free(list_loop); + struct udev_list_entry *entry_loop; + struct udev_list_entry *entry_tmp; + + list_entry_foreach_safe(entry_loop, entry_tmp, list_get_entry(list)) { + list_entry_remove(entry_loop); + free(entry_loop->name); + free(entry_loop->value); + free(entry_loop); } } -struct udev_list *list_get_entry(struct list_node *list) +struct udev_list_entry *list_get_entry(struct list_node *list) { - if (list_empty(list)) + if (list_is_empty(list)) return NULL; - return node_to_entry(list->next); + return list_node_to_entry(list->next); } -struct udev_list *udev_list_entry_get_next(struct udev_list *list_entry) +struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) { struct list_node *next; + if (list_entry == NULL) + return NULL; next = list_entry->node.next; - /* empty list or no more emtries */ + /* empty list or no more entries */ if (next == list_entry->list) return NULL; - return node_to_entry(next); + return list_node_to_entry(next); } -const char *udev_list_entry_get_name(struct udev_list *list_entry) +const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) { if (list_entry == NULL) return NULL; return list_entry->name; } -const char *udev_list_entry_get_value(struct udev_list *list_entry) +const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) { if (list_entry == NULL) return NULL; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 6abd7b7c20..162b33aef6 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -109,11 +109,18 @@ struct list_node { struct list_node *next, *prev; }; extern void list_init(struct list_node *list); -extern struct udev_list *list_insert_entry(struct udev *udev, struct list_node *name_list, - const char *name, const char *value, int sort); -extern struct udev_list *list_get_entry(struct list_node *list); -extern void list_move_entry_to_end(struct udev_list *list_entry, struct list_node *list); extern void list_cleanup(struct udev *udev, struct list_node *name_list); +extern struct udev_list_entry *list_entry_add(struct udev *udev, struct list_node *list, + const char *name, const char *value, + int unique, int sort); +extern void list_entry_remove(struct udev_list_entry *entry); +extern struct udev_list_entry *list_get_entry(struct list_node *list); +extern void list_entry_move_to_end(struct udev_list_entry *list_entry); +#define list_entry_foreach_safe(entry, tmp, first) \ + for (entry = first, \ + tmp = udev_list_entry_get_next(entry); \ + entry != NULL; \ + entry = tmp, tmp = udev_list_entry_get_next(tmp)) /* libudev-utils */ #define UTIL_PATH_SIZE 1024 diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 28a37af178..25b5f9c02a 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -28,13 +28,8 @@ #error "#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE is needed to use this experimental library version" #endif -struct udev; -struct udev_list; -struct udev_device; -struct udev_enumerate; -struct udev_monitor; - /* library context */ +struct udev; extern struct udev *udev_new(void); extern struct udev *udev_ref(struct udev *udev); extern void udev_unref(struct udev *udev); @@ -55,11 +50,17 @@ extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, uns extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); /* list iteration */ -extern struct udev_list *udev_list_entry_get_next(struct udev_list *list_entry); -extern const char *udev_list_entry_get_name(struct udev_list *list_entry); -extern const char *udev_list_entry_get_value(struct udev_list *list_entry); +struct udev_list_entry; +extern struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); +extern const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); +extern const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); +#define udev_list_entry_foreach(entry, first) \ + for (entry = first; \ + entry != NULL; \ + entry = udev_list_entry_get_next(entry)) /* sys devices */ +struct udev_device; extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); @@ -71,21 +72,16 @@ extern const char *udev_device_get_subsystem(struct udev_device *udev_device); extern const char *udev_device_get_syspath(struct udev_device *udev_device); extern const char *udev_device_get_sysname(struct udev_device *udev_device); extern const char *udev_device_get_devnode(struct udev_device *udev_device); -extern struct udev_list *udev_device_get_devlinks_list(struct udev_device *udev_device); -extern struct udev_list *udev_device_get_properties_list(struct udev_device *udev_device); +extern struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); +extern struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); extern const char *udev_device_get_driver(struct udev_device *udev_device); extern dev_t udev_device_get_devnum(struct udev_device *udev_device); extern const char *udev_device_get_action(struct udev_device *udev_device); extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); extern const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr); -/* sys enumeration */ -extern struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, const char *subsystem); -extern struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); -extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); -extern struct udev_list *udev_enumerate_get_list(struct udev_enumerate *udev_enumerate); - /* udev and kernel device events */ +struct udev_monitor; extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev); extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); @@ -95,4 +91,11 @@ extern struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); extern int udev_monitor_get_fd(struct udev_monitor *udev_monitor); extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); +/* sys enumeration */ +struct udev_enumerate; +extern struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, const char *subsystem); +extern struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); +extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); +extern struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); + #endif diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index f361ab12a4..bff55cfcd6 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -42,44 +42,60 @@ static void print_device(struct udev_device *device) const char *str; dev_t devnum; int count; - struct udev_list *list; + struct udev_list_entry *list_entry; printf("*** device: %p ***\n", device); str = udev_device_get_action(device); - printf("action: '%s'\n", str); + if (str != NULL) + printf("action: '%s'\n", str); + str = udev_device_get_syspath(device); printf("syspath: '%s'\n", str); + str = udev_device_get_devpath(device); printf("devpath: '%s'\n", str); + str = udev_device_get_subsystem(device); - printf("subsystem: '%s'\n", str); + if (str != NULL) + printf("subsystem: '%s'\n", str); + str = udev_device_get_driver(device); - printf("driver: '%s'\n", str); + if (str != NULL) + printf("driver: '%s'\n", str); + str = udev_device_get_devnode(device); - printf("devname: '%s'\n", str); + if (str != NULL) + printf("devname: '%s'\n", str); + devnum = udev_device_get_devnum(device); - printf("devnum: %u:%u\n", major(devnum), minor(devnum)); + if (major(devnum) > 0) + printf("devnum: %u:%u\n", major(devnum), minor(devnum)); count = 0; - list = udev_device_get_devlinks_list(device); - while (list != NULL) { - printf("link: '%s'\n", udev_list_entry_get_name(list)); + list_entry = udev_device_get_devlinks_list_entry(device); + while (list_entry != NULL) { + printf("link: '%s'\n", udev_list_entry_get_name(list_entry)); count++; - list = udev_list_entry_get_next(list); + list_entry = udev_list_entry_get_next(list_entry); } - printf("found %i links\n", count); + if (count > 0) + printf("found %i links\n", count); count = 0; - list = udev_device_get_properties_list(device); - while (list != NULL) { - printf("property: '%s=%s'\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); + list_entry = udev_device_get_properties_list_entry(device); + while (list_entry != NULL) { + printf("property: '%s=%s'\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); count++; - list = udev_list_entry_get_next(list); + list_entry = udev_list_entry_get_next(list_entry); } - printf("found %i properties\n", count); + if (count > 0) + printf("found %i properties\n", count); str = udev_device_get_attr_value(device, "dev"); - printf("attr{dev}: '%s'\n", str); + if (str != NULL) + printf("attr{dev}: '%s'\n", str); printf("\n"); } @@ -144,17 +160,17 @@ static int test_device_devnum(struct udev *udev) static int test_enumerate(struct udev *udev, const char *subsystem) { struct udev_enumerate *enumerate; - struct udev_list *list; + struct udev_list_entry *list_entry; int count = 0; enumerate = udev_enumerate_new_from_subsystems(udev, NULL); if (enumerate == NULL) return -1; - list = udev_enumerate_get_list(enumerate); - while (list != NULL) { + list_entry = udev_enumerate_get_list_entry(enumerate); + while (list_entry != NULL) { struct udev_device *device; - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list)); + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); if (device != NULL) { printf("device: '%s' (%s) '%s'\n", udev_device_get_syspath(device), @@ -163,7 +179,7 @@ static int test_enumerate(struct udev *udev, const char *subsystem) udev_device_unref(device); count++; } - list = udev_list_entry_get_next(list); + list_entry = udev_list_entry_get_next(list_entry); } udev_enumerate_unref(enumerate); printf("found %i devices\n\n", count); diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index f9e2bb207c..f59c196e02 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -130,7 +130,7 @@ static void print_record(struct udev_device *device) { size_t len; int i; - struct udev_list *list; + struct udev_list_entry *list_entry; printf("P: %s\n", udev_device_get_devpath(device)); @@ -149,18 +149,15 @@ static void print_record(struct udev_device *device) if (i != 0) printf("R:%u\n", i); - list = udev_device_get_devlinks_list(device); - while (list != NULL) { + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("S: %s\n", &udev_list_entry_get_name(list)[len+1]); - list = udev_list_entry_get_next(list); + printf("S: %s\n", &udev_list_entry_get_name(list_entry)[len+1]); } - list = udev_device_get_properties_list(device); - while (list != NULL) { - printf("E: %s=%s\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); - list = udev_list_entry_get_next(list); - } + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) + printf("E: %s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); printf("\n"); } @@ -187,22 +184,20 @@ static int stat_device(const char *name, int export, const char *prefix) static int export_devices(struct udev *udev) { struct udev_enumerate *enumerate; - struct udev_list *list; + struct udev_list_entry *list_entry; enumerate = udev_enumerate_new_from_subsystems(udev, NULL); if (enumerate == NULL) return -1; - list = udev_enumerate_get_list(enumerate); - while (list != NULL) { + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { struct udev_device *device; - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list)); + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); if (device != NULL) { if (udev_device_get_devnode(device) != NULL) print_record(device); udev_device_unref(device); } - list = udev_list_entry_get_next(list); } udev_enumerate_unref(enumerate); return 0; @@ -216,7 +211,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) const char *export_prefix = NULL; char path[UTIL_PATH_SIZE]; char name[UTIL_PATH_SIZE]; - struct udev_list *list; + struct udev_list_entry *list_entry; int rc = 0; static const struct option options[] = { @@ -416,18 +411,18 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) } break; case QUERY_SYMLINK: - list = udev_device_get_devlinks_list(device); - while (list != NULL) { + list_entry = udev_device_get_devlinks_list_entry(device); + while (list_entry != NULL) { if (root) { - printf("%s", udev_list_entry_get_name(list)); + printf("%s", udev_list_entry_get_name(list_entry)); } else { size_t len; len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("%s", &udev_list_entry_get_name(list)[len+1]); + printf("%s", &udev_list_entry_get_name(list_entry)[len+1]); } - list = udev_list_entry_get_next(list); - if (list != NULL) + list_entry = udev_list_entry_get_next(list_entry); + if (list_entry != NULL) printf(" "); } printf("\n"); @@ -436,10 +431,10 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) printf("%s\n", udev_device_get_devpath(device)); goto exit; case QUERY_ENV: - list = udev_device_get_properties_list(device); - while (list != NULL) { - printf("%s=%s\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); - list = udev_list_entry_get_next(list); + list_entry = udev_device_get_properties_list_entry(device); + while (list_entry != NULL) { + printf("%s=%s\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + list_entry = udev_list_entry_get_next(list_entry); } break; case QUERY_ALL: diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 6cfad2d3b8..01126c9951 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -41,6 +41,29 @@ static void asmlinkage sig_handler(int signum) udev_exit = 1; } +static void print_device(struct udev_device *device, const char *source, int env) +{ + struct timeval tv; + struct timezone tz; + + gettimeofday(&tv, &tz); + printf("%-6s[%llu.%06u] %-8s %s (%s)\n", + source, + (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec, + udev_device_get_action(device), + udev_device_get_devpath(device), + udev_device_get_subsystem(device)); + if (env) { + struct udev_list_entry *list_entry; + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) + printf("%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + printf("\n"); + } +} + int udevadm_monitor(struct udev *udev, int argc, char *argv[]) { struct sigaction act; @@ -134,9 +157,6 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) while (!udev_exit) { int fdcount; - struct timeval tv; - struct timezone tz; - char timestr[64]; FD_ZERO(&readfds); if (kernel_monitor != NULL) @@ -152,51 +172,23 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) continue; } - if (gettimeofday(&tv, &tz) == 0) { - snprintf(timestr, sizeof(timestr), "%llu.%06u", - (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec); - } else - timestr[0] = '\0'; - if ((kernel_monitor != NULL) && FD_ISSET(udev_monitor_get_fd(kernel_monitor), &readfds)) { - struct udev_device *device = udev_monitor_receive_device(kernel_monitor); + struct udev_device *device; + + device = udev_monitor_receive_device(kernel_monitor); if (device == NULL) continue; - printf("UEVENT[%s] %-8s %s (%s)\n", timestr, - udev_device_get_action(device), - udev_device_get_devpath(device), - udev_device_get_subsystem(device)); - if (env) { - struct udev_list *list; - - list = udev_device_get_properties_list(device); - while (list != NULL) { - printf("%s=%s\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); - list = udev_list_entry_get_next(list); - } - printf("\n"); - } + print_device(device, "UEVENT", env); udev_device_unref(device); } if ((udev_monitor != NULL) && FD_ISSET(udev_monitor_get_fd(udev_monitor), &readfds)) { - struct udev_device *device = udev_monitor_receive_device(udev_monitor); + struct udev_device *device; + + device = udev_monitor_receive_device(udev_monitor); if (device == NULL) continue; - printf("UDEV [%s] %-8s %s (%s)\n", timestr, - udev_device_get_action(device), - udev_device_get_devpath(device), - udev_device_get_subsystem(device)); - if (env) { - struct udev_list *list; - - list = udev_device_get_properties_list(device); - while (list != NULL) { - printf("%s=%s\n", udev_list_entry_get_name(list), udev_list_entry_get_value(list)); - list = udev_list_entry_get_next(list); - } - printf("\n"); - } + print_device(device, "UDEV", env); udev_device_unref(device); } } -- cgit v1.2.3-54-g00ecf From b95f8a76e614004c69fcf829568c826a7e769bbe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Sep 2008 03:34:57 +0200 Subject: lubudev: accept more sys directories as devices, and parent devices --- TODO | 12 +++++-- udev/lib/libudev-device.c | 81 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 67 insertions(+), 26 deletions(-) diff --git a/TODO b/TODO index 56899a94cf..01c4125460 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,15 @@ o enumerate() - add buses and drivers - o increase ressize buffer + use enumerate for "trigger" + + o add libudev interface for /dev/.udev/queue/ state + use queue interface for "settle" + + o use libudev in udev_rules.c + get rid of udevice, store rule matching state in rule iterator + o rework rules to a match-action list, instead of a rules array o add DVB variables to kernel, and drop shell script rule o add watershed extra - o get all distros to agree on a default set of rules - o rework rules to a match-action list, instead of a rules array o log warning if the kernel uses CONFIG_SYSFS_DEPRECATED*=y, which means that /sys/class/block/ does not exist, but udev will depend on it in a future release @@ -12,3 +17,4 @@ the default rules o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names + o get distros to agree on a default set of rules diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index b3731412b4..a201fb25df 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -229,6 +229,9 @@ struct udev_device *device_init(struct udev *udev) **/ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) { + size_t len; + const char *subdir; + const char *pos; char path[UTIL_PATH_SIZE]; struct stat statbuf; struct udev_device *udev_device; @@ -238,20 +241,50 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * if (syspath == NULL) return NULL; - util_strlcpy(path, syspath, sizeof(path)); - util_strlcat(path, "/uevent", sizeof(path)); - if (stat(path, &statbuf) != 0) { - info(udev, "not a device :%s\n", syspath); + /* path starts in sys */ + len = strlen(udev_get_sys_path(udev)); + if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) { + info(udev, "not in sys :%s\n", syspath); return NULL; } - udev_device = device_init(udev); - if (udev_device == NULL) + /* path is not a root directory */ + subdir = &syspath[len+1]; + pos = strrchr(subdir, '/'); + if (pos == NULL || pos < &subdir[2]) { + info(udev, "not in subdir :%s\n", syspath); return NULL; + } /* resolve possible symlink to real path */ util_strlcpy(path, syspath, sizeof(path)); util_resolve_sys_link(udev, path, sizeof(path)); + + /* path exists in sys */ + if (strncmp(&syspath[len], "/devices/", 9) == 0 || + strncmp(&syspath[len], "/class/", 7) == 0 || + strncmp(&syspath[len], "/block/", 7) == 0) { + char file[UTIL_PATH_SIZE]; + + /* all "devices" require a "uevent" file */ + util_strlcpy(file, path, sizeof(file)); + util_strlcat(file, "/uevent", sizeof(file)); + if (stat(file, &statbuf) != 0) { + info(udev, "not a device: %s\n", syspath); + return NULL; + } + } else { + /* everything else just needs to be a directory */ + if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) { + info(udev, "directory not found: %s\n", syspath); + return NULL; + } + } + + udev_device = device_init(udev); + if (udev_device == NULL) + return NULL; + device_set_syspath(udev_device, path); info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); @@ -273,7 +306,7 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de else return NULL; - /* /sys/dev/{block,char}/: links */ + /* /sys/dev/{block,char}/: link */ snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", udev_get_sys_path(udev), type_str, major(devnum), minor(devnum)); if (util_resolve_sys_link(udev, path, sizeof(path)) == 0) @@ -303,37 +336,39 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic { struct udev_device *udev_device_parent = NULL; char path[UTIL_PATH_SIZE]; - char *pos; + const char *subdir; - if (udev_device == NULL) - return NULL; + /* follow "device" link in deprecated sys layout */ + if (strncmp(udev_device->devpath, "/class/", 7) == 0 || + strncmp(udev_device->devpath, "/block/", 7) == 0) { + util_strlcpy(path, udev_device->syspath, sizeof(path)); + util_strlcat(path, "/device", sizeof(path)); + if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) + udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); + return udev_device_parent; + } util_strlcpy(path, udev_device->syspath, sizeof(path)); + subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; while (1) { - pos = strrchr(path, '/'); - if (pos == path || pos == NULL) + char *pos; + + pos = strrchr(subdir, '/'); + if (pos == NULL || pos < &subdir[2]) break; pos[0] = '\0'; udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); if (udev_device_parent != NULL) return udev_device_parent; } - - /* follow "device" link in deprecated sys /sys/class/ layout */ - if (strncmp(udev_device->devpath, "/class/", 7) == 0) { - util_strlcpy(path, udev_device->syspath, sizeof(path)); - util_strlcat(path, "/device", sizeof(path)); - if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) { - udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); - if (udev_device_parent != NULL) - return udev_device_parent; - } - } return NULL; } struct udev_device *udev_device_get_parent(struct udev_device *udev_device) { + if (udev_device == NULL) + return NULL; + if (udev_device->parent_device != NULL) { info(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); return udev_device->parent_device; -- cgit v1.2.3-54-g00ecf From 669ed8675f7a8bc3987ad501d11f7623b70698e6 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sun, 28 Sep 2008 12:01:38 +0100 Subject: trivial cleanup in udev_rules_iter --- udev/udev_rules_parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 541d651f0e..229096c8d7 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -45,9 +45,9 @@ struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter) if (!rules) return NULL; - dbg(iter->rules->udev, "current=%zi\n", iter->current); + dbg(rules->udev, "current=%zi\n", iter->current); if (iter->current >= rules->bufsize) { - dbg(iter->rules->udev, "no more rules\n"); + dbg(rules->udev, "no more rules\n"); return NULL; } @@ -65,7 +65,7 @@ struct udev_rule *udev_rules_iter_label(struct udev_rules_iter *iter, const char size_t start = iter->current; next: - dbg(iter->rules->udev, "current=%zi\n", iter->current); + dbg(rules->udev, "current=%zi\n", iter->current); if (iter->current >= rules->bufsize) { err(rules->udev, "LABEL='%s' not found, GOTO will be ignored\n", label); iter->current = start; -- cgit v1.2.3-54-g00ecf From 41b7a00922bdb1a501cbf2e39282fe64bb94cb6d Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sun, 28 Sep 2008 12:02:44 +0100 Subject: avoid repeated scans for goto targets (udev_iter_find_label) The scans are now performed up-front at parse-time, instead of being repeated for each event at run-time. Cachegrind reports a 5% reduction in cpu cycles (excluding the time spent in-kernel). --- udev/udev_rules.c | 4 ++-- udev/udev_rules.h | 3 ++- udev/udev_rules_parse.c | 50 ++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/udev/udev_rules.c b/udev/udev_rules.c index d4dcb06801..9c37571fb0 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -1529,7 +1529,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) if (rule->goto_label.operation != KEY_OP_UNSET) { dbg(udevice->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_label(&iter, key_val(rule, &rule->goto_label)); + udev_rules_iter_goto(&iter, rule->goto_rule_off); } } } @@ -1609,7 +1609,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udevice) if (rule->goto_label.operation != KEY_OP_UNSET) { dbg(udevice->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_label(&iter, key_val(rule, &rule->goto_label)); + udev_rules_iter_goto(&iter, rule->goto_rule_off); } } } diff --git a/udev/udev_rules.h b/udev/udev_rules.h index 02685e1834..af96b8119b 100644 --- a/udev/udev_rules.h +++ b/udev/udev_rules.h @@ -84,6 +84,7 @@ struct udev_rule { struct key wait_for; struct key label; struct key goto_label; + size_t goto_rule_off; struct key name; struct key symlink; @@ -122,7 +123,7 @@ extern void udev_rules_cleanup(struct udev_rules *rules); extern void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules); extern struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter); -extern struct udev_rule *udev_rules_iter_label(struct udev_rules_iter *iter, const char *label); +extern struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off); extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev); extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev); diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 229096c8d7..5a76889c84 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -58,29 +58,40 @@ struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter) return rule; } -struct udev_rule *udev_rules_iter_label(struct udev_rules_iter *iter, const char *label) +struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off) +{ + struct udev_rules *rules = iter->rules; + struct udev_rule *rule; + + dbg(rules->udev "current=%zi\n", iter->current); + iter->current = rule_off; + rule = (struct udev_rule *) (rules->buf + iter->current); + + return rule; +} + +static size_t find_label(const struct udev_rules_iter *iter, const char *label) { struct udev_rule *rule; struct udev_rules *rules = iter->rules; - size_t start = iter->current; + size_t current = iter->current; next: - dbg(rules->udev, "current=%zi\n", iter->current); - if (iter->current >= rules->bufsize) { + dbg(rules->udev, "current=%zi\n", current); + if (current >= rules->bufsize) { err(rules->udev, "LABEL='%s' not found, GOTO will be ignored\n", label); - iter->current = start; - return NULL; + return iter->current; } - rule = (struct udev_rule *) (rules->buf + iter->current); + rule = (struct udev_rule *) (rules->buf + current); if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { dbg(rules->udev, "moving forward, looking for label '%s'\n", label); - iter->current += sizeof(struct udev_rule) + rule->bufsize; + current += sizeof(struct udev_rule) + rule->bufsize; goto next; } dbg(rules->udev, "found label '%s'\n", label); - return rule; + return current; } static int get_key(struct udev_rules *rules, char **line, char **key, enum key_operation *operation, char **value) @@ -674,6 +685,11 @@ static int parse_file(struct udev_rules *rules, const char *filename) size_t cur; size_t count; int retval = 0; + size_t start; + struct udev_rule *rule; + struct udev_rules_iter iter; + + start = rules->bufsize; if (file_map(filename, &buf, &bufsize) != 0) { err(rules->udev, "can't open '%s' as rules file: %s\n", filename, strerror(errno)); @@ -722,6 +738,22 @@ static int parse_file(struct udev_rules *rules, const char *filename) add_to_rules(rules, line, filename, lineno); } + /* Compute all goto targets within this file */ + udev_rules_iter_init(&iter, rules); + udev_rules_iter_goto(&iter, start); + while((rule = udev_rules_iter_next(&iter))) { + if (rule->goto_label.operation != KEY_OP_UNSET) { + char *goto_label = &rule->buf[rule->goto_label.val_off]; + + dbg(rules->udev, "resolving goto label '%s'", goto_label); + rule->goto_rule_off = find_label(&iter, goto_label); + if (rule->goto_rule_off == iter.current) { + err(rules->udev, "goto nonexistent label '%s' in '%s'", + goto_label, filename); + } + } + } + file_unmap(buf, bufsize); return retval; } -- cgit v1.2.3-54-g00ecf From bc8184ede9cff156709fe053e3e02ef309cb2920 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Sep 2008 17:39:31 +0200 Subject: libudev: enumerate - accept list of subsystems to scan, or skip --- TODO | 11 +++-- udev/lib/exported_symbols | 3 ++ udev/lib/libudev-device.c | 16 +++++-- udev/lib/libudev-enumerate.c | 101 ++++++++++++++++++++++++++++++++----------- udev/lib/libudev-list.c | 10 +++++ udev/lib/libudev.h | 5 ++- udev/lib/test-libudev.c | 45 ++++++++++++++----- udev/udevadm-info.c | 4 +- 8 files changed, 146 insertions(+), 49 deletions(-) diff --git a/TODO b/TODO index 01c4125460..8d7858fbef 100644 --- a/TODO +++ b/TODO @@ -1,13 +1,12 @@ - o enumerate() - add buses and drivers + o libudev enumerate + add buses and drivers + add /sys/block/ scanning crap use enumerate for "trigger" - - o add libudev interface for /dev/.udev/queue/ state + o libudev queue - interface for /dev/.udev/queue/ state use queue interface for "settle" - - o use libudev in udev_rules.c + o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator o rework rules to a match-action list, instead of a rules array - o add DVB variables to kernel, and drop shell script rule o add watershed extra o log warning if the kernel uses CONFIG_SYSFS_DEPRECATED*=y, diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 8c5f700d46..1877f32e89 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -10,6 +10,7 @@ udev_set_userdata udev_get_sys_path udev_get_dev_path udev_list_entry_get_next +udev_list_entry_get_by_name udev_list_entry_get_name udev_list_entry_get_value udev_device_new_from_syspath @@ -30,9 +31,11 @@ udev_device_get_driver udev_device_get_devnum udev_device_get_seqnum udev_device_get_attr_value +udev_enumerate_new_from_devices udev_enumerate_new_from_subsystems udev_enumerate_ref udev_enumerate_unref +udev_enumerate_get_udev udev_enumerate_get_list_entry udev_monitor_new_from_socket udev_monitor_new_from_netlink diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index a201fb25df..3437d69798 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -252,7 +252,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * subdir = &syspath[len+1]; pos = strrchr(subdir, '/'); if (pos == NULL || pos < &subdir[2]) { - info(udev, "not in subdir :%s\n", syspath); + info(udev, "not a subdir :%s\n", syspath); return NULL; } @@ -312,8 +312,11 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de if (util_resolve_sys_link(udev, path, sizeof(path)) == 0) return udev_device_new_from_syspath(udev, path); - /* fallback to search all sys devices for the major/minor */ - enumerate = udev_enumerate_new_from_subsystems(udev, NULL); + /* fallback to search sys devices for the major/minor */ + if (type == 'b') + enumerate = udev_enumerate_new_from_devices(udev, "block", NULL); + else if (type == 'c') + enumerate = udev_enumerate_new_from_devices(udev, "!block", NULL); if (enumerate == NULL) return NULL; udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { @@ -322,6 +325,13 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); if (device_loop != NULL) { if (udev_device_get_devnum(device_loop) == devnum) { + const char *subsystem; + + subsystem = udev_device_get_subsystem(device_loop); + if (type == 'b' && strcmp(subsystem, "block") != 0) + continue; + if (type == 'c' && strcmp(subsystem, "block") == 0) + continue; device = device_loop; break; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 8f5c5640b2..c7fb683c10 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -54,6 +54,13 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) free(udev_enumerate); } +struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return NULL; + return udev_enumerate->udev; +} + struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) @@ -63,7 +70,7 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude static int devices_scan_subsystem(struct udev *udev, const char *basedir, const char *subsystem, const char *subdir, - struct list_node *device_list) + struct list_node *devices_list) { char path[UTIL_PATH_SIZE]; DIR *dir; @@ -87,34 +94,44 @@ static int devices_scan_subsystem(struct udev *udev, util_strlcat(syspath, "/", sizeof(syspath)); util_strlcat(syspath, dent->d_name, sizeof(syspath)); util_resolve_sys_link(udev, syspath, sizeof(syspath)); - list_entry_add(udev, device_list, syspath, NULL, 1, 1); + list_entry_add(udev, devices_list, syspath, NULL, 1, 1); } closedir(dir); return 0; } static int devices_scan_subsystems(struct udev *udev, - const char *basedir, const char *subsystem, const char *subdir, - struct list_node *device_list) + const char *basedir, const char *subdir, + struct udev_list_entry *subsystem_include_list, + struct udev_list_entry *subsystem_exclude_list, + struct list_node *devices_list) { - char path[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - if (subsystem != NULL) - return devices_scan_subsystem(udev, basedir, subsystem, subdir, device_list); + if (subsystem_include_list != NULL) { + struct udev_list_entry *list_entry; - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, basedir, sizeof(path)); - dir = opendir(path); - if (dir == NULL) - return -1; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - if (dent->d_name[0] == '.') - continue; - devices_scan_subsystem(udev, basedir, dent->d_name, subdir, device_list); + /* if list of subsystems to scan is given, just use this list */ + udev_list_entry_foreach(list_entry, subsystem_include_list) + devices_scan_subsystem(udev, basedir, udev_list_entry_get_name(list_entry), subdir, devices_list); + } else { + char path[UTIL_PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + /* if no list of subsystems to scan is given, scan all, and possible exclude some subsystems */ + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, basedir, sizeof(path)); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + if (udev_list_entry_get_by_name(subsystem_exclude_list, dent->d_name) != NULL) + continue; + devices_scan_subsystem(udev, basedir, dent->d_name, subdir, devices_list); + } + closedir(dir); } - closedir(dir); return 0; } @@ -140,17 +157,21 @@ static int devices_delay(struct udev *udev, const char *syspath) } /** - * udev_enumerate_new_from_subsystems: + * udev_enumerate_new_from_devices: * @udev: udev library context - * @subsystem: the subsystem to enumerate + * @subsystem: the list of names of subsystems to look for devices * * Returns: an enumeration context **/ -struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, const char *subsystem) +struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const char *subsystem, ...) { struct udev_enumerate *udev_enumerate; + va_list vargs; + const char *arg; char base[UTIL_PATH_SIZE]; struct stat statbuf; + struct list_node subsystem_include_list; + struct list_node subsystem_exclude_list; struct udev_list_entry *list_entry; if (udev == NULL) @@ -164,19 +185,42 @@ struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, con udev_enumerate->udev = udev; list_init(&udev_enumerate->devices_list); + va_start(vargs, subsystem); + list_init(&subsystem_include_list); + list_init(&subsystem_exclude_list); + for (arg = subsystem; arg != NULL; arg = va_arg(vargs, const char *)) { + if (arg[0] != '!') + list_entry_add(udev, &subsystem_include_list, arg, NULL, 1, 0); + else + list_entry_add(udev, &subsystem_exclude_list, &arg[1], NULL, 1, 0); + } + va_end(vargs); + /* if we have /sys/subsystem/, forget all the old stuff */ util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { info(udev, "searching 'subsystem/*/devices/*' dir\n"); - devices_scan_subsystems(udev, "/subsystem", subsystem, "/devices", &udev_enumerate->devices_list); + devices_scan_subsystems(udev, "/subsystem", "/devices", + list_get_entry(&subsystem_include_list), + list_get_entry(&subsystem_exclude_list), + &udev_enumerate->devices_list); } else { info(udev, "searching 'bus/*/devices/*' dir\n"); - devices_scan_subsystems(udev, "/bus", subsystem, "/devices", &udev_enumerate->devices_list); + devices_scan_subsystems(udev, "/bus", "/devices", + list_get_entry(&subsystem_include_list), + list_get_entry(&subsystem_exclude_list), + &udev_enumerate->devices_list); info(udev, "searching 'class/*' dir\n"); - devices_scan_subsystems(udev, "/class", subsystem, NULL, &udev_enumerate->devices_list); + devices_scan_subsystems(udev, "/class", NULL, + list_get_entry(&subsystem_include_list), + list_get_entry(&subsystem_exclude_list), + &udev_enumerate->devices_list); } + list_cleanup(udev, &subsystem_include_list); + list_cleanup(udev, &subsystem_exclude_list); + /* sort delayed devices to the end of the list */ udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->devices_list)) { if (devices_delay(udev, udev_list_entry_get_name(list_entry))) @@ -184,3 +228,8 @@ struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, con } return udev_enumerate; } + +struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev) +{ + return NULL; +} diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index 895c665e40..00e3b7c37d 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -192,6 +192,16 @@ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_en return list_node_to_entry(next); } +struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) +{ + struct udev_list_entry *entry; + + udev_list_entry_foreach(entry, list_entry) + if (strcmp(udev_list_entry_get_name(entry), name) == 0) + return entry; + return NULL; +} + const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) { if (list_entry == NULL) diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 25b5f9c02a..29c4a47e51 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -52,6 +52,7 @@ extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsign /* list iteration */ struct udev_list_entry; extern struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); +extern struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); extern const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); extern const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); #define udev_list_entry_foreach(entry, first) \ @@ -93,8 +94,10 @@ extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev /* sys enumeration */ struct udev_enumerate; -extern struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev, const char *subsystem); +extern struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const char *subsystem, ...); +extern struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev); extern struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); +extern struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); extern struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index bff55cfcd6..0f485248e8 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -157,20 +157,16 @@ static int test_device_devnum(struct udev *udev) return 0; } -static int test_enumerate(struct udev *udev, const char *subsystem) +static int test_enumerate_print_list(struct udev_enumerate *enumerate) { - struct udev_enumerate *enumerate; struct udev_list_entry *list_entry; int count = 0; - enumerate = udev_enumerate_new_from_subsystems(udev, NULL); - if (enumerate == NULL) - return -1; - list_entry = udev_enumerate_get_list_entry(enumerate); - while (list_entry != NULL) { + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { struct udev_device *device; - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); if (device != NULL) { printf("device: '%s' (%s) '%s'\n", udev_device_get_syspath(device), @@ -179,9 +175,7 @@ static int test_enumerate(struct udev *udev, const char *subsystem) udev_device_unref(device); count++; } - list_entry = udev_list_entry_get_next(list_entry); } - udev_enumerate_unref(enumerate); printf("found %i devices\n\n", count); return count; } @@ -248,6 +242,7 @@ int main(int argc, char *argv[], char *envp[]) { "version", 0, NULL, 'V' }, {} }; + struct udev_enumerate *enumerate; const char *syspath = "/devices/virtual/mem/null"; const char *subsystem = NULL; const char *socket = "@/org/kernel/udev/monitor"; @@ -309,7 +304,35 @@ int main(int argc, char *argv[], char *envp[]) test_device(udev, syspath); test_device_devnum(udev); test_device_parents(udev, syspath); - test_enumerate(udev, subsystem); + + printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); + enumerate = udev_enumerate_new_from_devices(udev, subsystem, NULL); + if (enumerate == NULL) + return -1; + test_enumerate_print_list(enumerate); + udev_enumerate_unref(enumerate); + + printf("enumerate 'block'\n"); + enumerate = udev_enumerate_new_from_devices(udev, "block", NULL); + if (enumerate == NULL) + return -1; + test_enumerate_print_list(enumerate); + udev_enumerate_unref(enumerate); + + printf("enumerate '!block'\n"); + enumerate = udev_enumerate_new_from_devices(udev, "!block", NULL); + if (enumerate == NULL) + return -1; + test_enumerate_print_list(enumerate); + udev_enumerate_unref(enumerate); + + printf("enumerate 'pci, mem, vc'\n"); + enumerate = udev_enumerate_new_from_devices(udev, "pci", "mem", "vc", NULL); + if (enumerate == NULL) + return -1; + test_enumerate_print_list(enumerate); + udev_enumerate_unref(enumerate); + test_monitor(udev, socket); out: udev_unref(udev); diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index f59c196e02..e470ff624d 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -186,7 +186,7 @@ static int export_devices(struct udev *udev) struct udev_enumerate *enumerate; struct udev_list_entry *list_entry; - enumerate = udev_enumerate_new_from_subsystems(udev, NULL); + enumerate = udev_enumerate_new_from_devices(udev, NULL); if (enumerate == NULL) return -1; udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { @@ -301,7 +301,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) rc = 2; goto exit; } - /* add /sys if needed */ + /* add sys dir if needed */ if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); util_strlcat(path, optarg, sizeof(path)); -- cgit v1.2.3-54-g00ecf From 6f67f1dfb7f5a8e59d479fe6af01eb267fd83e24 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Sep 2008 22:18:40 +0200 Subject: libudev: enumerate "subsystem" --- TODO | 1 + udev/lib/libudev-enumerate.c | 63 ++++++++++++++++++++++++++++++++++++-------- udev/lib/test-libudev.c | 7 +++++ 3 files changed, 60 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index 8d7858fbef..b1e6f98632 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,7 @@ use enumerate for "trigger" o libudev queue - interface for /dev/.udev/queue/ state use queue interface for "settle" + o relace test/sys/ with current sysfs layout o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator o rework rules to a match-action list, instead of a rules array diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index c7fb683c10..b71ded645b 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -78,8 +78,10 @@ static int devices_scan_subsystem(struct udev *udev, util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); util_strlcat(path, basedir, sizeof(path)); - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, subsystem, sizeof(path)); + if (subsystem != NULL) { + util_strlcat(path, "/", sizeof(path)); + util_strlcat(path, subsystem, sizeof(path)); + } if (subdir != NULL) util_strlcat(path, subdir, sizeof(path)); dir = opendir(path); @@ -87,12 +89,17 @@ static int devices_scan_subsystem(struct udev *udev, return -1; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char syspath[UTIL_PATH_SIZE]; + struct stat statbuf; if (dent->d_name[0] == '.') continue; util_strlcpy(syspath, path, sizeof(syspath)); util_strlcat(syspath, "/", sizeof(syspath)); util_strlcat(syspath, dent->d_name, sizeof(syspath)); + if (stat(syspath, &statbuf) != 0) + continue; + if (!S_ISDIR(statbuf.st_mode)) + continue; util_resolve_sys_link(udev, syspath, sizeof(syspath)); list_entry_add(udev, devices_list, syspath, NULL, 1, 1); } @@ -156,6 +163,20 @@ static int devices_delay(struct udev *udev, const char *syspath) return 0; } +static struct udev_enumerate *enumerate_new(struct udev *udev) +{ + struct udev_enumerate *udev_enumerate; + + udev_enumerate = malloc(sizeof(struct udev_enumerate)); + if (udev_enumerate == NULL) + return NULL; + memset(udev_enumerate, 0x00, (sizeof(struct udev_enumerate))); + udev_enumerate->refcount = 1; + udev_enumerate->udev = udev; + list_init(&udev_enumerate->devices_list); + return udev_enumerate; +} + /** * udev_enumerate_new_from_devices: * @udev: udev library context @@ -177,13 +198,9 @@ struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const if (udev == NULL) return NULL; - udev_enumerate = malloc(sizeof(struct udev_enumerate)); + udev_enumerate = enumerate_new(udev); if (udev_enumerate == NULL) return NULL; - memset(udev_enumerate, 0x00, (sizeof(struct udev_enumerate))); - udev_enumerate->refcount = 1; - udev_enumerate->udev = udev; - list_init(&udev_enumerate->devices_list); va_start(vargs, subsystem); list_init(&subsystem_include_list); @@ -200,18 +217,18 @@ struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { - info(udev, "searching 'subsystem/*/devices/*' dir\n"); + info(udev, "searching '/subsystem/*/devices/*' dir\n"); devices_scan_subsystems(udev, "/subsystem", "/devices", list_get_entry(&subsystem_include_list), list_get_entry(&subsystem_exclude_list), &udev_enumerate->devices_list); } else { - info(udev, "searching 'bus/*/devices/*' dir\n"); + info(udev, "searching '/bus/*/devices/*' dir\n"); devices_scan_subsystems(udev, "/bus", "/devices", list_get_entry(&subsystem_include_list), list_get_entry(&subsystem_exclude_list), &udev_enumerate->devices_list); - info(udev, "searching 'class/*' dir\n"); + info(udev, "searching '/class/*' dir\n"); devices_scan_subsystems(udev, "/class", NULL, list_get_entry(&subsystem_include_list), list_get_entry(&subsystem_exclude_list), @@ -231,5 +248,29 @@ struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev) { - return NULL; + struct udev_enumerate *udev_enumerate; + char base[UTIL_PATH_SIZE]; + struct stat statbuf; + const char *subsysdir; + + if (udev == NULL) + return NULL; + + udev_enumerate = enumerate_new(udev); + if (udev_enumerate == NULL) + return NULL; + + util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); + util_strlcat(base, "/subsystem", sizeof(base)); + if (stat(base, &statbuf) == 0) + subsysdir = "/subsystem"; + else + subsysdir = "/bus"; + info(udev, "searching '%s/*' dir\n", subsysdir); + devices_scan_subsystem(udev, subsysdir, NULL, NULL, &udev_enumerate->devices_list); + info(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); + devices_scan_subsystems(udev, subsysdir, "/drivers", + NULL, NULL, + &udev_enumerate->devices_list); + return udev_enumerate; } diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 0f485248e8..8ef7a6e3bd 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -333,6 +333,13 @@ int main(int argc, char *argv[], char *envp[]) test_enumerate_print_list(enumerate); udev_enumerate_unref(enumerate); + printf("enumerate 'subsystem'\n"); + enumerate = udev_enumerate_new_from_subsystems(udev); + if (enumerate == NULL) + return -1; + test_enumerate_print_list(enumerate); + udev_enumerate_unref(enumerate); + test_monitor(udev, socket); out: udev_unref(udev); -- cgit v1.2.3-54-g00ecf From b03e89cfbaa1fdd0c32bbd54f2b450e17014b522 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Sep 2008 23:17:29 +0200 Subject: libudev: enumerate - scan /sys/block/ if needed --- TODO | 15 +++++++-------- udev/lib/libudev-enumerate.c | 33 ++++++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/TODO b/TODO index b1e6f98632..b4e0809c80 100644 --- a/TODO +++ b/TODO @@ -1,18 +1,17 @@ - o libudev enumerate - add buses and drivers - add /sys/block/ scanning crap - use enumerate for "trigger" +#129 + o use enumerate for "trigger" o libudev queue - interface for /dev/.udev/queue/ state use queue interface for "settle" - o relace test/sys/ with current sysfs layout + o relace test/sys/ with current sysfs layout and adapt test + +#130+ o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator o rework rules to a match-action list, instead of a rules array o add DVB variables to kernel, and drop shell script rule o add watershed extra - o log warning if the kernel uses CONFIG_SYSFS_DEPRECATED*=y, - which means that /sys/class/block/ does not exist, but udev - will depend on it in a future release + o log warning if /sys/block/ does, but /sys/class/block/ does not exist, + udev will depend on the non-deprecated sysfs layout in a future release o DEVTYPE for disks is set by the kernel, they will be removed from the default rules o "udevadm control" commands will only accept the -- syntax diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index b71ded645b..272b2981fe 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -89,6 +89,7 @@ static int devices_scan_subsystem(struct udev *udev, return -1; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char syspath[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; struct stat statbuf; if (dent->d_name[0] == '.') @@ -96,9 +97,9 @@ static int devices_scan_subsystem(struct udev *udev, util_strlcpy(syspath, path, sizeof(syspath)); util_strlcat(syspath, "/", sizeof(syspath)); util_strlcat(syspath, dent->d_name, sizeof(syspath)); - if (stat(syspath, &statbuf) != 0) - continue; - if (!S_ISDIR(statbuf.st_mode)) + util_strlcpy(filename, syspath, sizeof(filename)); + util_strlcat(filename, "/uevent", sizeof(filename)); + if (stat(filename, &statbuf) != 0) continue; util_resolve_sys_link(udev, syspath, sizeof(syspath)); list_entry_add(udev, devices_list, syspath, NULL, 1, 1); @@ -117,8 +118,11 @@ static int devices_scan_subsystems(struct udev *udev, struct udev_list_entry *list_entry; /* if list of subsystems to scan is given, just use this list */ - udev_list_entry_foreach(list_entry, subsystem_include_list) + udev_list_entry_foreach(list_entry, subsystem_include_list) { + if (udev_list_entry_get_by_name(subsystem_exclude_list, udev_list_entry_get_name(list_entry)) != NULL) + continue; devices_scan_subsystem(udev, basedir, udev_list_entry_get_name(list_entry), subdir, devices_list); + } } else { char path[UTIL_PATH_SIZE]; DIR *dir; @@ -213,10 +217,10 @@ struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const } va_end(vargs); - /* if we have /sys/subsystem/, forget all the old stuff */ util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { + /* we have /subsystem/, forget all the old stuff */ info(udev, "searching '/subsystem/*/devices/*' dir\n"); devices_scan_subsystems(udev, "/subsystem", "/devices", list_get_entry(&subsystem_include_list), @@ -233,6 +237,25 @@ struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const list_get_entry(&subsystem_include_list), list_get_entry(&subsystem_exclude_list), &udev_enumerate->devices_list); + /* if block isn't a class, scan /block/ */ + util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); + util_strlcat(base, "/class/block", sizeof(base)); + if (stat(base, &statbuf) != 0) { + struct udev_list_entry *include_list = list_get_entry(&subsystem_include_list); + struct udev_list_entry *exclude_list = list_get_entry(&subsystem_exclude_list); + int include_block = (include_list == NULL || udev_list_entry_get_by_name(include_list, "block") != NULL); + int exclude_block = (udev_list_entry_get_by_name(exclude_list, "block") != NULL); + + if (include_block && !exclude_block) { + info(udev, "searching '/block/*/*' dir\n"); + /* scan disks */ + devices_scan_subsystem(udev, "/block", NULL, NULL, &udev_enumerate->devices_list); + /* scan partitions */ + devices_scan_subsystems(udev, "/block", NULL, + NULL, NULL, + &udev_enumerate->devices_list); + } + } } list_cleanup(udev, &subsystem_include_list); -- cgit v1.2.3-54-g00ecf From 438d4c3cd4b89381348f84ef9f8b8937814f8362 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Sep 2008 02:00:17 +0200 Subject: libudev: enumerate - split new() and scan() --- test/udev-test.pl | 4 ++-- udev/lib/exported_symbols | 5 +++-- udev/lib/libudev-device.c | 16 ++++++++------- udev/lib/libudev-enumerate.c | 47 ++++++++++++++++++++++++-------------------- udev/lib/libudev.h | 5 +++-- udev/lib/test-libudev.c | 47 ++++++++++++++++++++++++-------------------- udev/udevadm-info.c | 11 ++++++----- 7 files changed, 75 insertions(+), 60 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 27ff2a7ce0..d7357d713d 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# udev-test +# udev test # # Provides automated testing of the udev binary. # The whole test is self contained in this file, except the matching sysfs tree. @@ -14,7 +14,7 @@ # After creation and removal the result is checked against the # expected value and the result is printed. # -# Copyright (C) 2004-2006 Kay Sievers +# Copyright (C) 2004-2008 Kay Sievers # Copyright (C) 2004 Leann Ogasawara use warnings; diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 1877f32e89..21b433e9f5 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -31,8 +31,9 @@ udev_device_get_driver udev_device_get_devnum udev_device_get_seqnum udev_device_get_attr_value -udev_enumerate_new_from_devices -udev_enumerate_new_from_subsystems +udev_enumerate_new +udev_enumerate_scan_devices +udev_enumerate_scan_subsystems udev_enumerate_ref udev_enumerate_unref udev_enumerate_get_udev diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 3437d69798..4d000292f2 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -295,7 +295,7 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de { char path[UTIL_PATH_SIZE]; const char *type_str; - struct udev_enumerate *enumerate; + struct udev_enumerate *udev_enumerate; struct udev_list_entry *list_entry; struct udev_device *device = NULL; @@ -312,14 +312,16 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de if (util_resolve_sys_link(udev, path, sizeof(path)) == 0) return udev_device_new_from_syspath(udev, path); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return NULL; + /* fallback to search sys devices for the major/minor */ if (type == 'b') - enumerate = udev_enumerate_new_from_devices(udev, "block", NULL); + udev_enumerate_scan_devices(udev_enumerate, "block", NULL); else if (type == 'c') - enumerate = udev_enumerate_new_from_devices(udev, "!block", NULL); - if (enumerate == NULL) - return NULL; - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + udev_enumerate_scan_devices(udev_enumerate, "!block", NULL); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { struct udev_device *device_loop; device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); @@ -338,7 +340,7 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de udev_device_unref(device_loop); } } - udev_enumerate_unref(enumerate); + udev_enumerate_unref(udev_enumerate); return device; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 272b2981fe..266164ae51 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -167,7 +167,13 @@ static int devices_delay(struct udev *udev, const char *syspath) return 0; } -static struct udev_enumerate *enumerate_new(struct udev *udev) +/** + * udev_enumerate_new: + * @udev: udev library context + * + * Returns: an enumeration context + **/ +struct udev_enumerate *udev_enumerate_new(struct udev *udev) { struct udev_enumerate *udev_enumerate; @@ -182,15 +188,15 @@ static struct udev_enumerate *enumerate_new(struct udev *udev) } /** - * udev_enumerate_new_from_devices: - * @udev: udev library context + * udev_enumerate_scan_devices: + * @udev_enumerate: udev enumeration context * @subsystem: the list of names of subsystems to look for devices * - * Returns: an enumeration context + * Returns: 0 on success. **/ -struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const char *subsystem, ...) +int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate, const char *subsystem, ...) { - struct udev_enumerate *udev_enumerate; + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); va_list vargs; const char *arg; char base[UTIL_PATH_SIZE]; @@ -199,12 +205,8 @@ struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const struct list_node subsystem_exclude_list; struct udev_list_entry *list_entry; - if (udev == NULL) - return NULL; - - udev_enumerate = enumerate_new(udev); if (udev_enumerate == NULL) - return NULL; + return -EINVAL; va_start(vargs, subsystem); list_init(&subsystem_include_list); @@ -247,10 +249,11 @@ struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const int exclude_block = (udev_list_entry_get_by_name(exclude_list, "block") != NULL); if (include_block && !exclude_block) { - info(udev, "searching '/block/*/*' dir\n"); + info(udev, "searching '/block/*' dir\n"); /* scan disks */ devices_scan_subsystem(udev, "/block", NULL, NULL, &udev_enumerate->devices_list); /* scan partitions */ + info(udev, "searching '/block/*/*' dir\n"); devices_scan_subsystems(udev, "/block", NULL, NULL, NULL, &udev_enumerate->devices_list); @@ -266,22 +269,24 @@ struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const if (devices_delay(udev, udev_list_entry_get_name(list_entry))) list_entry_move_to_end(list_entry); } - return udev_enumerate; + return 0; } -struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev) +/** + * udev_enumerate_scan_subsystems: + * @udev_enumerate: udev enumeration context + * + * Returns: 0 on success. + **/ +int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) { - struct udev_enumerate *udev_enumerate; + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); char base[UTIL_PATH_SIZE]; struct stat statbuf; const char *subsysdir; - if (udev == NULL) - return NULL; - - udev_enumerate = enumerate_new(udev); if (udev_enumerate == NULL) - return NULL; + return -EINVAL; util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/subsystem", sizeof(base)); @@ -295,5 +300,5 @@ struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev) devices_scan_subsystems(udev, subsysdir, "/drivers", NULL, NULL, &udev_enumerate->devices_list); - return udev_enumerate; + return 0; } diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 29c4a47e51..427fed7f61 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -94,11 +94,12 @@ extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev /* sys enumeration */ struct udev_enumerate; -extern struct udev_enumerate *udev_enumerate_new_from_devices(struct udev *udev, const char *subsystem, ...); -extern struct udev_enumerate *udev_enumerate_new_from_subsystems(struct udev *udev); +extern struct udev_enumerate *udev_enumerate_new(struct udev *udev); extern struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); extern struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); +extern int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate, const char *subsystem, ...); +extern int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); extern struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); #endif diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 8ef7a6e3bd..0f45413d50 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -242,7 +242,7 @@ int main(int argc, char *argv[], char *envp[]) { "version", 0, NULL, 'V' }, {} }; - struct udev_enumerate *enumerate; + struct udev_enumerate *udev_enumerate; const char *syspath = "/devices/virtual/mem/null"; const char *subsystem = NULL; const char *socket = "@/org/kernel/udev/monitor"; @@ -306,39 +306,44 @@ int main(int argc, char *argv[], char *envp[]) test_device_parents(udev, syspath); printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); - enumerate = udev_enumerate_new_from_devices(udev, subsystem, NULL); - if (enumerate == NULL) + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) return -1; - test_enumerate_print_list(enumerate); - udev_enumerate_unref(enumerate); + udev_enumerate_scan_devices(udev_enumerate, subsystem, NULL); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); printf("enumerate 'block'\n"); - enumerate = udev_enumerate_new_from_devices(udev, "block", NULL); - if (enumerate == NULL) + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) return -1; - test_enumerate_print_list(enumerate); - udev_enumerate_unref(enumerate); + udev_enumerate_scan_devices(udev_enumerate, "block", NULL); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); printf("enumerate '!block'\n"); - enumerate = udev_enumerate_new_from_devices(udev, "!block", NULL); - if (enumerate == NULL) + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) return -1; - test_enumerate_print_list(enumerate); - udev_enumerate_unref(enumerate); + udev_enumerate_scan_devices(udev_enumerate, "!block", NULL); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); printf("enumerate 'pci, mem, vc'\n"); - enumerate = udev_enumerate_new_from_devices(udev, "pci", "mem", "vc", NULL); - if (enumerate == NULL) + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) return -1; - test_enumerate_print_list(enumerate); - udev_enumerate_unref(enumerate); + udev_enumerate_scan_devices(udev_enumerate, "pci", "mem", "vc", NULL); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); printf("enumerate 'subsystem'\n"); - enumerate = udev_enumerate_new_from_subsystems(udev); - if (enumerate == NULL) + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) return -1; - test_enumerate_print_list(enumerate); - udev_enumerate_unref(enumerate); + udev_enumerate_scan_subsystems(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); test_monitor(udev, socket); out: diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index e470ff624d..0a774b057f 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -183,13 +183,14 @@ static int stat_device(const char *name, int export, const char *prefix) static int export_devices(struct udev *udev) { - struct udev_enumerate *enumerate; + struct udev_enumerate *udev_enumerate; struct udev_list_entry *list_entry; - enumerate = udev_enumerate_new_from_devices(udev, NULL); - if (enumerate == NULL) + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) return -1; - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + udev_enumerate_scan_devices(udev_enumerate, NULL); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { struct udev_device *device; device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); @@ -199,7 +200,7 @@ static int export_devices(struct udev *udev) udev_device_unref(device); } } - udev_enumerate_unref(enumerate); + udev_enumerate_unref(udev_enumerate); return 0; } -- cgit v1.2.3-54-g00ecf From c7fcba1bf4d0da13b66396c08c0b5f62b25d0405 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Sep 2008 04:12:44 +0200 Subject: test: replace ancient sysfs tree with recent one --- TODO | 6 +- test/sys/block/cciss!c0d0/cciss!c0d0p1/dev | 1 - test/sys/block/cciss!c0d0/cciss!c0d0p2/dev | 1 - test/sys/block/cciss!c0d0/cciss!c0d0p5/dev | 1 - test/sys/block/cciss!c0d0/dev | 1 - test/sys/block/cciss!c0d0/device | 1 - test/sys/block/loop0 | 1 + test/sys/block/loop1 | 1 + test/sys/block/loop2 | 1 + test/sys/block/loop3 | 1 + test/sys/block/loop4 | 1 + test/sys/block/loop5 | 1 + test/sys/block/loop6 | 1 + test/sys/block/loop7 | 1 + test/sys/block/md0 | 1 + test/sys/block/rd!c0d0/dev | 1 - test/sys/block/rd!c0d0/device | 1 - test/sys/block/sda | 1 + test/sys/block/sda/dev | 1 - test/sys/block/sda/device | 1 - test/sys/block/sda/queue/iosched/antic_expire | 1 - test/sys/block/sda/queue/iosched/read_batch_expire | 1 - test/sys/block/sda/queue/iosched/read_expire | 1 - .../sys/block/sda/queue/iosched/write_batch_expire | 1 - test/sys/block/sda/queue/iosched/write_expire | 1 - test/sys/block/sda/queue/nr_requests | 1 - test/sys/block/sda/range | 1 - test/sys/block/sda/sda1/dev | 1 - test/sys/block/sda/sda1/size | 1 - test/sys/block/sda/sda1/start | 1 - test/sys/block/sda/sda1/stat | 1 - test/sys/block/sda/sda1/subsystem | 1 - test/sys/block/sda/sda2/dev | 1 - test/sys/block/sda/sda2/size | 1 - test/sys/block/sda/sda2/start | 1 - test/sys/block/sda/sda2/stat | 1 - test/sys/block/sda/sda2/subsystem | 1 - test/sys/block/sda/sda3/dev | 1 - test/sys/block/sda/sda3/size | 1 - test/sys/block/sda/sda3/start | 1 - test/sys/block/sda/sda3/stat | 1 - test/sys/block/sda/sda3/subsystem | 1 - test/sys/block/sda/sda4/dev | 1 - test/sys/block/sda/sda4/size | 1 - test/sys/block/sda/sda4/start | 1 - test/sys/block/sda/sda4/stat | 1 - test/sys/block/sda/sda4/subsystem | 1 - test/sys/block/sda/size | 1 - test/sys/block/sda/stat | 1 - test/sys/block/sda/subsystem | 1 - test/sys/block/sda/test:colon+plus | 1 - test/sys/block/sdb | 1 + test/sys/block/sr0 | 1 + test/sys/bus/acpi/devices/ACPI0003:00 | 1 + test/sys/bus/acpi/devices/ACPI0007:00 | 1 + test/sys/bus/acpi/devices/ACPI0007:01 | 1 + test/sys/bus/acpi/devices/ATM1200:00 | 1 + test/sys/bus/acpi/devices/IBM0057:00 | 1 + test/sys/bus/acpi/devices/IBM0068:00 | 1 + test/sys/bus/acpi/devices/IBM0079:00 | 1 + test/sys/bus/acpi/devices/LNXPOWER:00 | 1 + test/sys/bus/acpi/devices/LNXPWRBN:00 | 1 + test/sys/bus/acpi/devices/LNXSYSTM:00 | 1 + test/sys/bus/acpi/devices/LNXTHERM:00 | 1 + test/sys/bus/acpi/devices/LNXTHERM:01 | 1 + test/sys/bus/acpi/devices/LNXTHERM:02 | 1 + test/sys/bus/acpi/devices/PNP0000:00 | 1 + test/sys/bus/acpi/devices/PNP0100:00 | 1 + test/sys/bus/acpi/devices/PNP0103:00 | 1 + test/sys/bus/acpi/devices/PNP0200:00 | 1 + test/sys/bus/acpi/devices/PNP0303:00 | 1 + test/sys/bus/acpi/devices/PNP0800:00 | 1 + test/sys/bus/acpi/devices/PNP0A08:00 | 1 + test/sys/bus/acpi/devices/PNP0B00:00 | 1 + test/sys/bus/acpi/devices/PNP0C01:00 | 1 + test/sys/bus/acpi/devices/PNP0C02:00 | 1 + test/sys/bus/acpi/devices/PNP0C04:00 | 1 + test/sys/bus/acpi/devices/PNP0C09:00 | 1 + test/sys/bus/acpi/devices/PNP0C0A:00 | 1 + test/sys/bus/acpi/devices/PNP0C0D:00 | 1 + test/sys/bus/acpi/devices/PNP0C0E:00 | 1 + test/sys/bus/acpi/devices/PNP0C0F:00 | 1 + test/sys/bus/acpi/devices/PNP0C0F:01 | 1 + test/sys/bus/acpi/devices/PNP0C0F:02 | 1 + test/sys/bus/acpi/devices/PNP0C0F:03 | 1 + test/sys/bus/acpi/devices/PNP0C0F:04 | 1 + test/sys/bus/acpi/devices/PNP0C0F:05 | 1 + test/sys/bus/acpi/devices/PNP0C0F:06 | 1 + test/sys/bus/acpi/devices/PNP0C0F:07 | 1 + test/sys/bus/acpi/devices/device:00 | 1 + test/sys/bus/acpi/devices/device:01 | 1 + test/sys/bus/acpi/devices/device:02 | 1 + test/sys/bus/acpi/devices/device:03 | 1 + test/sys/bus/acpi/devices/device:04 | 1 + test/sys/bus/acpi/devices/device:05 | 1 + test/sys/bus/acpi/devices/device:06 | 1 + test/sys/bus/acpi/devices/device:07 | 1 + test/sys/bus/acpi/devices/device:08 | 1 + test/sys/bus/acpi/devices/device:09 | 1 + test/sys/bus/acpi/devices/device:0a | 1 + test/sys/bus/acpi/devices/device:0b | 1 + test/sys/bus/acpi/devices/device:0c | 1 + test/sys/bus/acpi/devices/device:0d | 1 + test/sys/bus/acpi/devices/device:0e | 1 + test/sys/bus/acpi/devices/device:0f | 1 + test/sys/bus/acpi/devices/device:10 | 1 + test/sys/bus/acpi/devices/device:11 | 1 + test/sys/bus/acpi/devices/device:12 | 1 + test/sys/bus/acpi/devices/device:13 | 1 + test/sys/bus/acpi/devices/device:14 | 1 + test/sys/bus/acpi/devices/device:15 | 1 + test/sys/bus/acpi/devices/device:16 | 1 + test/sys/bus/acpi/devices/device:17 | 1 + test/sys/bus/acpi/devices/device:18 | 1 + test/sys/bus/acpi/devices/device:19 | 1 + test/sys/bus/acpi/devices/device:1a | 1 + test/sys/bus/acpi/devices/device:1b | 1 + test/sys/bus/acpi/devices/device:1c | 1 + test/sys/bus/acpi/devices/device:1d | 1 + test/sys/bus/acpi/devices/device:1e | 1 + test/sys/bus/acpi/devices/device:1f | 1 + test/sys/bus/acpi/devices/device:20 | 1 + test/sys/bus/acpi/devices/device:21 | 1 + test/sys/bus/acpi/devices/device:22 | 1 + test/sys/bus/acpi/devices/device:23 | 1 + test/sys/bus/acpi/devices/device:24 | 1 + test/sys/bus/acpi/devices/device:25 | 1 + test/sys/bus/acpi/drivers/ac/ACPI0003:00 | 1 + test/sys/bus/acpi/drivers/battery/PNP0C0A:00 | 1 + test/sys/bus/acpi/drivers/button/LNXPWRBN:00 | 1 + test/sys/bus/acpi/drivers/button/PNP0C0D:00 | 1 + test/sys/bus/acpi/drivers/button/PNP0C0E:00 | 1 + test/sys/bus/acpi/drivers/ec/PNP0C09:00 | 1 + test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 | 1 + test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 | 1 + test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 | 1 + test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 | 1 + test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 | 1 + test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 | 1 + test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 | 1 + test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 | 1 + test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 | 1 + test/sys/bus/acpi/drivers/power/LNXPOWER:00 | 1 + test/sys/bus/acpi/drivers/processor/ACPI0007:00 | 1 + test/sys/bus/acpi/drivers/processor/ACPI0007:01 | 1 + test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 | 1 + test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 | 1 + .../bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 | 1 + test/sys/bus/acpi/drivers_autoprobe | 1 + test/sys/bus/acpi/drivers_probe | 0 test/sys/bus/acpi/uevent | 0 test/sys/bus/pci/devices/0000:00:00.0 | 1 + test/sys/bus/pci/devices/0000:00:01.0 | 1 + test/sys/bus/pci/devices/0000:00:09.0 | 1 - test/sys/bus/pci/devices/0000:00:1b.0 | 1 + test/sys/bus/pci/devices/0000:00:1c.0 | 1 + test/sys/bus/pci/devices/0000:00:1c.1 | 1 + test/sys/bus/pci/devices/0000:00:1c.2 | 1 + test/sys/bus/pci/devices/0000:00:1c.3 | 1 + test/sys/bus/pci/devices/0000:00:1d.0 | 1 + test/sys/bus/pci/devices/0000:00:1d.1 | 1 + test/sys/bus/pci/devices/0000:00:1d.2 | 1 + test/sys/bus/pci/devices/0000:00:1d.3 | 1 + test/sys/bus/pci/devices/0000:00:1f.0 | 1 + test/sys/bus/pci/devices/0000:00:1f.1 | 1 + test/sys/bus/pci/devices/0000:00:1f.2 | 1 + test/sys/bus/pci/devices/0000:00:1f.3 | 1 + test/sys/bus/pci/devices/0000:01:00.0 | 1 + test/sys/bus/pci/devices/0000:02:00.0 | 1 + test/sys/bus/pci/devices/0000:02:05.0 | 1 - test/sys/bus/pci/devices/0000:03:00.0 | 1 + test/sys/bus/pci/devices/0000:15:00.0 | 1 + test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 | 1 + test/sys/bus/pci/drivers/HDA Intel/module | 1 + test/sys/bus/pci/drivers/agpgart-intel/module | 1 + test/sys/bus/pci/drivers/ahci/0000:00:1f.2 | 1 + test/sys/bus/pci/drivers/ahci/module | 1 + test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 | 1 - test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 | 1 + test/sys/bus/pci/drivers/e1000e/0000:02:00.0 | 1 + test/sys/bus/pci/drivers/e1000e/module | 1 + test/sys/bus/pci/drivers/ehci_hcd/module | 1 + test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 | 1 + test/sys/bus/pci/drivers/iwl3945/module | 1 + .../bus/pci/drivers/pcieport-driver/0000:00:01.0 | 1 + .../bus/pci/drivers/pcieport-driver/0000:00:1c.0 | 1 + .../bus/pci/drivers/pcieport-driver/0000:00:1c.1 | 1 + .../bus/pci/drivers/pcieport-driver/0000:00:1c.2 | 1 + .../bus/pci/drivers/pcieport-driver/0000:00:1c.3 | 1 + test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 | 1 + test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 | 1 + test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 | 1 + test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 | 1 + test/sys/bus/pci/drivers/uhci_hcd/module | 1 + .../sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 | 1 + test/sys/bus/pci/drivers/yenta_cardbus/module | 1 + test/sys/bus/pci/drivers_autoprobe | 1 + test/sys/bus/pci/drivers_probe | 0 test/sys/bus/pci/uevent | 0 .../bus/pci_express/devices/0000:00:01.0:pcie00 | 1 + .../bus/pci_express/devices/0000:00:01.0:pcie03 | 1 + .../bus/pci_express/devices/0000:00:1c.0:pcie00 | 1 + .../bus/pci_express/devices/0000:00:1c.0:pcie02 | 1 + .../bus/pci_express/devices/0000:00:1c.0:pcie03 | 1 + .../bus/pci_express/devices/0000:00:1c.1:pcie00 | 1 + .../bus/pci_express/devices/0000:00:1c.1:pcie02 | 1 + .../bus/pci_express/devices/0000:00:1c.1:pcie03 | 1 + .../bus/pci_express/devices/0000:00:1c.2:pcie00 | 1 + .../bus/pci_express/devices/0000:00:1c.2:pcie02 | 1 + .../bus/pci_express/devices/0000:00:1c.2:pcie03 | 1 + .../bus/pci_express/devices/0000:00:1c.3:pcie00 | 1 + .../bus/pci_express/devices/0000:00:1c.3:pcie02 | 1 + .../bus/pci_express/devices/0000:00:1c.3:pcie03 | 1 + test/sys/bus/pci_express/drivers_autoprobe | 1 + test/sys/bus/pci_express/drivers_probe | 0 test/sys/bus/pci_express/uevent | 0 test/sys/bus/pcmcia/drivers_autoprobe | 1 + test/sys/bus/pcmcia/drivers_probe | 0 test/sys/bus/pcmcia/uevent | 0 test/sys/bus/platform/devices/dock.0 | 1 + test/sys/bus/platform/devices/i8042 | 1 + test/sys/bus/platform/devices/microcode | 1 + test/sys/bus/platform/devices/pcspkr | 1 + test/sys/bus/platform/devices/serial8250 | 1 + test/sys/bus/platform/devices/thinkpad_acpi | 1 + test/sys/bus/platform/devices/thinkpad_hwmon | 1 + test/sys/bus/platform/devices/vesafb.0 | 1 + test/sys/bus/platform/drivers/i8042/i8042 | 1 + test/sys/bus/platform/drivers/pcspkr/module | 1 + test/sys/bus/platform/drivers/pcspkr/pcspkr | 1 + .../sys/bus/platform/drivers/serial8250/serial8250 | 1 + .../bus/platform/drivers/thinkpad_acpi/debug_level | 1 + .../drivers/thinkpad_acpi/interface_version | 1 + test/sys/bus/platform/drivers/thinkpad_acpi/module | 1 + .../platform/drivers/thinkpad_acpi/thinkpad_acpi | 1 + .../sys/bus/platform/drivers/thinkpad_acpi/version | 1 + .../platform/drivers/thinkpad_hwmon/debug_level | 1 + .../platform/drivers/thinkpad_hwmon/fan_watchdog | 1 + .../drivers/thinkpad_hwmon/interface_version | 1 + .../sys/bus/platform/drivers/thinkpad_hwmon/module | 1 + .../platform/drivers/thinkpad_hwmon/thinkpad_hwmon | 1 + .../bus/platform/drivers/thinkpad_hwmon/version | 1 + test/sys/bus/platform/drivers/vesafb/vesafb.0 | 1 + test/sys/bus/platform/drivers_autoprobe | 1 + test/sys/bus/platform/drivers_probe | 0 test/sys/bus/platform/uevent | 0 test/sys/bus/pnp/devices/00:00 | 1 + test/sys/bus/pnp/devices/00:01 | 1 + test/sys/bus/pnp/devices/00:02 | 1 + test/sys/bus/pnp/devices/00:03 | 1 + test/sys/bus/pnp/devices/00:04 | 1 + test/sys/bus/pnp/devices/00:05 | 1 + test/sys/bus/pnp/devices/00:06 | 1 + test/sys/bus/pnp/devices/00:07 | 1 + test/sys/bus/pnp/devices/00:08 | 1 + test/sys/bus/pnp/devices/00:09 | 1 + test/sys/bus/pnp/devices/00:0a | 1 + test/sys/bus/pnp/drivers/i8042 aux/00:09 | 1 + test/sys/bus/pnp/drivers/i8042 kbd/00:08 | 1 + test/sys/bus/pnp/drivers/rtc_cmos/00:07 | 1 + test/sys/bus/pnp/drivers/system/00:00 | 1 + test/sys/bus/pnp/drivers/system/00:02 | 1 + test/sys/bus/pnp/drivers_autoprobe | 1 + test/sys/bus/pnp/drivers_probe | 0 test/sys/bus/pnp/uevent | 0 test/sys/bus/scsi/devices/0:0:0:0 | 2 +- test/sys/bus/scsi/devices/4:0:0:0 | 1 + test/sys/bus/scsi/devices/6:0:0:0 | 1 + test/sys/bus/scsi/devices/host0 | 1 + test/sys/bus/scsi/devices/host1 | 1 + test/sys/bus/scsi/devices/host2 | 1 + test/sys/bus/scsi/devices/host3 | 1 + test/sys/bus/scsi/devices/host4 | 1 + test/sys/bus/scsi/devices/host5 | 1 + test/sys/bus/scsi/devices/host6 | 1 + test/sys/bus/scsi/devices/target0:0:0 | 1 + test/sys/bus/scsi/devices/target4:0:0 | 1 + test/sys/bus/scsi/devices/target6:0:0 | 1 + test/sys/bus/scsi/drivers/sd/0:0:0:0 | 2 +- test/sys/bus/scsi/drivers/sd/6:0:0:0 | 1 + test/sys/bus/scsi/drivers/sr/4:0:0:0 | 1 + test/sys/bus/scsi/drivers_autoprobe | 1 + test/sys/bus/scsi/drivers_probe | 0 test/sys/bus/scsi/uevent | 0 test/sys/bus/serio/devices/serio0 | 1 + test/sys/bus/serio/devices/serio1 | 1 + test/sys/bus/serio/drivers/atkbd/bind_mode | 1 + test/sys/bus/serio/drivers/atkbd/description | 1 + test/sys/bus/serio/drivers/atkbd/module | 1 + test/sys/bus/serio/drivers/atkbd/serio0 | 1 + test/sys/bus/serio/drivers/psmouse/bind_mode | 1 + test/sys/bus/serio/drivers/psmouse/description | 1 + test/sys/bus/serio/drivers/psmouse/module | 1 + test/sys/bus/serio/drivers/psmouse/serio1 | 1 + test/sys/bus/serio/drivers_autoprobe | 1 + test/sys/bus/serio/drivers_probe | 0 test/sys/bus/serio/uevent | 0 test/sys/bus/usb-serial/devices/ttyUSB0 | 1 - test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 | 1 - test/sys/bus/usb/devices/1-0:1.0 | 1 + test/sys/bus/usb/devices/2-0:1.0 | 1 + test/sys/bus/usb/devices/3-0:1.0 | 2 +- test/sys/bus/usb/devices/3-1 | 2 +- test/sys/bus/usb/devices/3-1:1.0 | 2 +- test/sys/bus/usb/devices/4-0:1.0 | 1 + test/sys/bus/usb/devices/4-1 | 1 + test/sys/bus/usb/devices/4-1:1.0 | 1 + test/sys/bus/usb/devices/4-1:1.1 | 1 + test/sys/bus/usb/devices/4-1:1.2 | 1 + test/sys/bus/usb/devices/4-1:1.3 | 1 + test/sys/bus/usb/devices/4-2 | 1 + test/sys/bus/usb/devices/4-2:1.0 | 1 + test/sys/bus/usb/devices/5-0:1.0 | 1 + test/sys/bus/usb/devices/5-1 | 1 + test/sys/bus/usb/devices/5-1:1.0 | 1 + test/sys/bus/usb/devices/5-1:1.1 | 1 + test/sys/bus/usb/devices/5-1:1.10 | 1 + test/sys/bus/usb/devices/5-1:1.11 | 1 + test/sys/bus/usb/devices/5-1:1.12 | 1 + test/sys/bus/usb/devices/5-1:1.13 | 1 + test/sys/bus/usb/devices/5-1:1.2 | 1 + test/sys/bus/usb/devices/5-1:1.3 | 1 + test/sys/bus/usb/devices/5-1:1.4 | 1 + test/sys/bus/usb/devices/5-1:1.5 | 1 + test/sys/bus/usb/devices/5-1:1.6 | 1 + test/sys/bus/usb/devices/5-1:1.9 | 1 + test/sys/bus/usb/devices/5-2 | 1 + test/sys/bus/usb/devices/5-2:1.0 | 1 + test/sys/bus/usb/devices/usb1 | 1 + test/sys/bus/usb/devices/usb2 | 1 + test/sys/bus/usb/devices/usb3 | 2 +- test/sys/bus/usb/devices/usb4 | 1 + test/sys/bus/usb/devices/usb5 | 1 + test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 | 1 + test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 | 1 + test/sys/bus/usb/drivers/cdc_acm/module | 1 + test/sys/bus/usb/drivers/hub/1-0:1.0 | 1 + test/sys/bus/usb/drivers/hub/2-0:1.0 | 1 + test/sys/bus/usb/drivers/hub/3-0:1.0 | 2 +- test/sys/bus/usb/drivers/hub/4-0:1.0 | 1 + test/sys/bus/usb/drivers/hub/5-0:1.0 | 1 + test/sys/bus/usb/drivers/hub/module | 1 + test/sys/bus/usb/drivers/pl2303/3-1:1.0 | 1 - test/sys/bus/usb/drivers/usb-storage/5-2:1.0 | 1 + test/sys/bus/usb/drivers/usb-storage/module | 1 + test/sys/bus/usb/drivers/usb/3-1 | 2 +- test/sys/bus/usb/drivers/usb/4-1 | 1 + test/sys/bus/usb/drivers/usb/4-2 | 1 + test/sys/bus/usb/drivers/usb/5-1 | 1 + test/sys/bus/usb/drivers/usb/5-2 | 1 + test/sys/bus/usb/drivers/usb/module | 1 + test/sys/bus/usb/drivers/usb/usb1 | 1 + test/sys/bus/usb/drivers/usb/usb2 | 1 + test/sys/bus/usb/drivers/usb/usb3 | 2 +- test/sys/bus/usb/drivers/usb/usb4 | 1 + test/sys/bus/usb/drivers/usb/usb5 | 1 + test/sys/bus/usb/drivers/usbfs/module | 1 + test/sys/bus/usb/drivers/usbhid/3-1:1.0 | 1 + test/sys/bus/usb/drivers/usbhid/module | 1 + test/sys/bus/usb/drivers_autoprobe | 1 + test/sys/bus/usb/drivers_probe | 0 test/sys/bus/usb/uevent | 0 test/sys/class/bdi/0:16 | 1 + test/sys/class/bdi/11:0 | 1 + test/sys/class/bdi/7:0 | 1 + test/sys/class/bdi/7:1 | 1 + test/sys/class/bdi/7:2 | 1 + test/sys/class/bdi/7:3 | 1 + test/sys/class/bdi/7:4 | 1 + test/sys/class/bdi/7:5 | 1 + test/sys/class/bdi/7:6 | 1 + test/sys/class/bdi/7:7 | 1 + test/sys/class/bdi/8:0 | 1 + test/sys/class/bdi/8:16 | 1 + test/sys/class/bdi/9:0 | 1 + test/sys/class/bdi/default | 1 + test/sys/class/block/loop0 | 1 + test/sys/class/block/loop1 | 1 + test/sys/class/block/loop2 | 1 + test/sys/class/block/loop3 | 1 + test/sys/class/block/loop4 | 1 + test/sys/class/block/loop5 | 1 + test/sys/class/block/loop6 | 1 + test/sys/class/block/loop7 | 1 + test/sys/class/block/md0 | 1 + test/sys/class/block/sda | 1 + test/sys/class/block/sda1 | 1 + test/sys/class/block/sda10 | 1 + test/sys/class/block/sda5 | 1 + test/sys/class/block/sda6 | 1 + test/sys/class/block/sda7 | 1 + test/sys/class/block/sda8 | 1 + test/sys/class/block/sda9 | 1 + test/sys/class/block/sdb | 1 + test/sys/class/block/sdb1 | 1 + test/sys/class/block/sr0 | 1 + test/sys/class/bsg/0:0:0:0 | 1 + test/sys/class/bsg/4:0:0:0 | 1 + test/sys/class/bsg/6:0:0:0 | 1 + test/sys/class/dmi/id | 1 + test/sys/class/firmware/timeout | 1 + test/sys/class/graphics/fb0 | 1 + test/sys/class/graphics/fbcon | 1 + test/sys/class/hwmon/hwmon0 | 1 + test/sys/class/i2c-dev/i2c-300/dev | 1 - test/sys/class/i2c-dev/i2c-300/name | 1 - test/sys/class/i2c-dev/i2c-300/subsystem | 1 - test/sys/class/i2c-dev/i2c-fake1/dev | 1 - test/sys/class/i2c-dev/i2c-fake1/name | 1 - test/sys/class/i2c-dev/i2c-fake1/subsystem | 1 - test/sys/class/i2c-dev/i2c-fake2/dev | 1 - test/sys/class/i2c-dev/i2c-fake2/name | 1 - test/sys/class/i2c-dev/i2c-fake2/subsystem | 1 - test/sys/class/ieee80211/phy0 | 1 + test/sys/class/input/event0 | 1 + test/sys/class/input/event1 | 1 + test/sys/class/input/event2 | 1 + test/sys/class/input/event3 | 1 + test/sys/class/input/event4 | 1 + test/sys/class/input/event5 | 1 + test/sys/class/input/event6 | 1 + test/sys/class/input/event7 | 1 + test/sys/class/input/input0 | 1 + test/sys/class/input/input1 | 1 + test/sys/class/input/input2 | 1 + test/sys/class/input/input3 | 1 + test/sys/class/input/input4 | 1 + test/sys/class/input/input5 | 1 + test/sys/class/input/input6 | 1 + test/sys/class/input/input7 | 1 + test/sys/class/input/mice | 1 + test/sys/class/input/mouse0 | 1 + test/sys/class/input/mouse1 | 1 + test/sys/class/leds/iwl-phy0:RX | 1 + test/sys/class/leds/iwl-phy0:TX | 1 + test/sys/class/leds/iwl-phy0:assoc | 1 + test/sys/class/leds/iwl-phy0:radio | 1 + test/sys/class/leds/tpacpi::bay_active | 1 + test/sys/class/leds/tpacpi::dock_active | 1 + test/sys/class/leds/tpacpi::dock_batt | 1 + test/sys/class/leds/tpacpi::power | 1 + test/sys/class/leds/tpacpi::standby | 1 + test/sys/class/leds/tpacpi::thinklight | 1 + test/sys/class/leds/tpacpi::unknown_led | 1 + test/sys/class/leds/tpacpi:green:batt | 1 + test/sys/class/leds/tpacpi:orange:batt | 1 + test/sys/class/mem/full | 1 + test/sys/class/mem/full/dev | 1 - test/sys/class/mem/full/subsystem | 1 - test/sys/class/mem/kmem | 1 + test/sys/class/mem/kmem/dev | 1 - test/sys/class/mem/kmem/subsystem | 1 - test/sys/class/mem/kmsg | 1 + test/sys/class/mem/kmsg/dev | 1 - test/sys/class/mem/kmsg/subsystem | 1 - test/sys/class/mem/mem | 1 + test/sys/class/mem/mem/dev | 1 - test/sys/class/mem/mem/subsystem | 1 - test/sys/class/mem/null | 1 + test/sys/class/mem/null/dev | 1 - test/sys/class/mem/null/subsystem | 1 - test/sys/class/mem/port | 1 + test/sys/class/mem/port/dev | 1 - test/sys/class/mem/port/subsystem | 1 - test/sys/class/mem/random | 1 + test/sys/class/mem/random/dev | 1 - test/sys/class/mem/random/subsystem | 1 - test/sys/class/mem/urandom | 1 + test/sys/class/mem/urandom/dev | 1 - test/sys/class/mem/urandom/subsystem | 1 - test/sys/class/mem/zero | 1 + test/sys/class/mem/zero/dev | 1 - test/sys/class/mem/zero/subsystem | 1 - test/sys/class/misc/cpu_dma_latency | 1 + test/sys/class/misc/device-mapper | 1 + test/sys/class/misc/fuse | 1 + test/sys/class/misc/hpet | 1 + test/sys/class/misc/mcelog | 1 + test/sys/class/misc/microcode | 1 + test/sys/class/misc/network_latency | 1 + test/sys/class/misc/network_throughput | 1 + test/sys/class/misc/nvram | 1 + test/sys/class/misc/psaux | 1 + test/sys/class/misc/psaux/dev | 1 - test/sys/class/misc/psaux/subsystem | 1 - test/sys/class/misc/rtc/dev | 1 - test/sys/class/misc/rtc/subsystem | 1 - test/sys/class/misc/uinput | 1 + test/sys/class/misc/uinput/dev | 1 - test/sys/class/misc/uinput/subsystem | 1 - test/sys/class/net/eth0 | 1 + test/sys/class/net/eth0/addr_len | 1 - test/sys/class/net/eth0/address | 1 - test/sys/class/net/eth0/broadcast | 1 - test/sys/class/net/eth0/features | 1 - test/sys/class/net/eth0/flags | 1 - test/sys/class/net/eth0/ifindex | 1 - test/sys/class/net/eth0/iflink | 1 - test/sys/class/net/eth0/mtu | 1 - test/sys/class/net/eth0/subsystem | 1 - test/sys/class/net/eth0/tx_queue_len | 1 - test/sys/class/net/eth0/type | 1 - test/sys/class/net/eth1/addr_len | 1 - test/sys/class/net/eth1/address | 1 - test/sys/class/net/eth1/broadcast | 1 - test/sys/class/net/eth1/features | 1 - test/sys/class/net/eth1/flags | 1 - test/sys/class/net/eth1/ifindex | 1 - test/sys/class/net/eth1/iflink | 1 - test/sys/class/net/eth1/mtu | 1 - test/sys/class/net/eth1/subsystem | 1 - test/sys/class/net/eth1/tx_queue_len | 1 - test/sys/class/net/eth1/type | 1 - test/sys/class/net/eth1/wireless/beacon | 1 - test/sys/class/net/eth1/wireless/crypt | 1 - test/sys/class/net/eth1/wireless/fragment | 1 - test/sys/class/net/eth1/wireless/level | 1 - test/sys/class/net/eth1/wireless/link | 1 - test/sys/class/net/eth1/wireless/misc | 1 - test/sys/class/net/eth1/wireless/noise | 1 - test/sys/class/net/eth1/wireless/nwid | 1 - test/sys/class/net/eth1/wireless/retries | 1 - test/sys/class/net/eth1/wireless/status | 1 - test/sys/class/net/lo | 1 + test/sys/class/net/lo/addr_len | 1 - test/sys/class/net/lo/address | 1 - test/sys/class/net/lo/broadcast | 1 - test/sys/class/net/lo/features | 1 - test/sys/class/net/lo/flags | 1 - test/sys/class/net/lo/ifindex | 1 - test/sys/class/net/lo/iflink | 1 - test/sys/class/net/lo/mtu | 1 - test/sys/class/net/lo/subsystem | 1 - test/sys/class/net/lo/tx_queue_len | 1 - test/sys/class/net/lo/type | 1 - test/sys/class/net/wlan0 | 1 + test/sys/class/net/wmaster0 | 1 + test/sys/class/pci_bus/0000:00 | 1 + test/sys/class/pci_bus/0000:01 | 1 + test/sys/class/pci_bus/0000:02 | 1 + test/sys/class/pci_bus/0000:03 | 1 + test/sys/class/pci_bus/0000:04 | 1 + test/sys/class/pci_bus/0000:0c | 1 + test/sys/class/pci_bus/0000:15 | 1 + test/sys/class/pci_bus/0000:16 | 1 + test/sys/class/pcmcia_socket/pcmcia_socket0 | 1 + test/sys/class/power_supply/AC | 1 + test/sys/class/power_supply/BAT0 | 1 + test/sys/class/rfkill/rfkill0 | 1 + test/sys/class/rtc/rtc0 | 1 + test/sys/class/scsi_device/0:0:0:0 | 1 + test/sys/class/scsi_device/4:0:0:0 | 1 + test/sys/class/scsi_device/6:0:0:0 | 1 + test/sys/class/scsi_disk/0:0:0:0 | 1 + test/sys/class/scsi_disk/6:0:0:0 | 1 + test/sys/class/scsi_generic/sg0 | 1 + test/sys/class/scsi_generic/sg1 | 1 + test/sys/class/scsi_generic/sg2 | 1 + test/sys/class/scsi_host/host0 | 1 + test/sys/class/scsi_host/host1 | 1 + test/sys/class/scsi_host/host2 | 1 + test/sys/class/scsi_host/host3 | 1 + test/sys/class/scsi_host/host4 | 1 + test/sys/class/scsi_host/host5 | 1 + test/sys/class/scsi_host/host6 | 1 + test/sys/class/sound/adsp | 1 + test/sys/class/sound/audio | 1 + test/sys/class/sound/card0 | 1 + test/sys/class/sound/controlC0 | 1 + test/sys/class/sound/dsp | 1 + test/sys/class/sound/mixer | 1 + test/sys/class/sound/pcmC0D0c | 1 + test/sys/class/sound/pcmC0D0p | 1 + test/sys/class/sound/pcmC0D1p | 1 + test/sys/class/sound/seq | 1 + test/sys/class/sound/timer | 1 + test/sys/class/thermal/cooling_device0 | 1 + test/sys/class/thermal/cooling_device1 | 1 + test/sys/class/thermal/thermal_zone0 | 1 + test/sys/class/thermal/thermal_zone1 | 1 + test/sys/class/tty/console | 1 + test/sys/class/tty/console/dev | 1 - test/sys/class/tty/console/subsystem | 1 - test/sys/class/tty/ptmx | 1 + test/sys/class/tty/ptmx/dev | 1 - test/sys/class/tty/ptmx/subsystem | 1 - test/sys/class/tty/tty | 1 + test/sys/class/tty/tty/dev | 1 - test/sys/class/tty/tty/subsystem | 1 - test/sys/class/tty/tty0 | 1 + test/sys/class/tty/tty0/dev | 1 - test/sys/class/tty/tty0/subsystem | 1 - test/sys/class/tty/tty1 | 1 + test/sys/class/tty/tty1/dev | 1 - test/sys/class/tty/tty1/subsystem | 1 - test/sys/class/tty/tty10 | 1 + test/sys/class/tty/tty10/dev | 1 - test/sys/class/tty/tty10/subsystem | 1 - test/sys/class/tty/tty11 | 1 + test/sys/class/tty/tty11/dev | 1 - test/sys/class/tty/tty11/subsystem | 1 - test/sys/class/tty/tty12 | 1 + test/sys/class/tty/tty12/dev | 1 - test/sys/class/tty/tty12/subsystem | 1 - test/sys/class/tty/tty13 | 1 + test/sys/class/tty/tty13/dev | 1 - test/sys/class/tty/tty13/subsystem | 1 - test/sys/class/tty/tty14 | 1 + test/sys/class/tty/tty14/dev | 1 - test/sys/class/tty/tty14/subsystem | 1 - test/sys/class/tty/tty15 | 1 + test/sys/class/tty/tty15/dev | 1 - test/sys/class/tty/tty15/subsystem | 1 - test/sys/class/tty/tty16 | 1 + test/sys/class/tty/tty16/dev | 1 - test/sys/class/tty/tty16/subsystem | 1 - test/sys/class/tty/tty17 | 1 + test/sys/class/tty/tty17/dev | 1 - test/sys/class/tty/tty17/subsystem | 1 - test/sys/class/tty/tty18 | 1 + test/sys/class/tty/tty18/dev | 1 - test/sys/class/tty/tty18/subsystem | 1 - test/sys/class/tty/tty19 | 1 + test/sys/class/tty/tty19/dev | 1 - test/sys/class/tty/tty19/subsystem | 1 - test/sys/class/tty/tty2 | 1 + test/sys/class/tty/tty2/dev | 1 - test/sys/class/tty/tty2/subsystem | 1 - test/sys/class/tty/tty20 | 1 + test/sys/class/tty/tty20/dev | 1 - test/sys/class/tty/tty20/subsystem | 1 - test/sys/class/tty/tty21 | 1 + test/sys/class/tty/tty21/dev | 1 - test/sys/class/tty/tty21/subsystem | 1 - test/sys/class/tty/tty22 | 1 + test/sys/class/tty/tty22/dev | 1 - test/sys/class/tty/tty22/subsystem | 1 - test/sys/class/tty/tty23 | 1 + test/sys/class/tty/tty23/dev | 1 - test/sys/class/tty/tty23/subsystem | 1 - test/sys/class/tty/tty24 | 1 + test/sys/class/tty/tty24/dev | 1 - test/sys/class/tty/tty24/subsystem | 1 - test/sys/class/tty/tty25 | 1 + test/sys/class/tty/tty25/dev | 1 - test/sys/class/tty/tty25/subsystem | 1 - test/sys/class/tty/tty26 | 1 + test/sys/class/tty/tty26/dev | 1 - test/sys/class/tty/tty26/subsystem | 1 - test/sys/class/tty/tty27 | 1 + test/sys/class/tty/tty27/dev | 1 - test/sys/class/tty/tty27/subsystem | 1 - test/sys/class/tty/tty28 | 1 + test/sys/class/tty/tty28/dev | 1 - test/sys/class/tty/tty28/subsystem | 1 - test/sys/class/tty/tty29 | 1 + test/sys/class/tty/tty29/dev | 1 - test/sys/class/tty/tty29/subsystem | 1 - test/sys/class/tty/tty3 | 1 + test/sys/class/tty/tty3/dev | 1 - test/sys/class/tty/tty3/subsystem | 1 - test/sys/class/tty/tty30 | 1 + test/sys/class/tty/tty30/dev | 1 - test/sys/class/tty/tty30/subsystem | 1 - test/sys/class/tty/tty31 | 1 + test/sys/class/tty/tty31/dev | 1 - test/sys/class/tty/tty31/subsystem | 1 - test/sys/class/tty/tty32 | 1 + test/sys/class/tty/tty32/dev | 1 - test/sys/class/tty/tty32/subsystem | 1 - test/sys/class/tty/tty33 | 1 + test/sys/class/tty/tty33/dev | 1 - test/sys/class/tty/tty33/subsystem | 1 - test/sys/class/tty/tty34 | 1 + test/sys/class/tty/tty34/dev | 1 - test/sys/class/tty/tty34/subsystem | 1 - test/sys/class/tty/tty35 | 1 + test/sys/class/tty/tty35/dev | 1 - test/sys/class/tty/tty35/subsystem | 1 - test/sys/class/tty/tty36 | 1 + test/sys/class/tty/tty36/dev | 1 - test/sys/class/tty/tty36/subsystem | 1 - test/sys/class/tty/tty37 | 1 + test/sys/class/tty/tty37/dev | 1 - test/sys/class/tty/tty37/subsystem | 1 - test/sys/class/tty/tty38 | 1 + test/sys/class/tty/tty38/dev | 1 - test/sys/class/tty/tty38/subsystem | 1 - test/sys/class/tty/tty39 | 1 + test/sys/class/tty/tty39/dev | 1 - test/sys/class/tty/tty39/subsystem | 1 - test/sys/class/tty/tty4 | 1 + test/sys/class/tty/tty4/dev | 1 - test/sys/class/tty/tty4/subsystem | 1 - test/sys/class/tty/tty40 | 1 + test/sys/class/tty/tty40/dev | 1 - test/sys/class/tty/tty40/subsystem | 1 - test/sys/class/tty/tty41 | 1 + test/sys/class/tty/tty41/dev | 1 - test/sys/class/tty/tty41/subsystem | 1 - test/sys/class/tty/tty42 | 1 + test/sys/class/tty/tty42/dev | 1 - test/sys/class/tty/tty42/subsystem | 1 - test/sys/class/tty/tty43 | 1 + test/sys/class/tty/tty43/dev | 1 - test/sys/class/tty/tty43/subsystem | 1 - test/sys/class/tty/tty44 | 1 + test/sys/class/tty/tty44/dev | 1 - test/sys/class/tty/tty44/subsystem | 1 - test/sys/class/tty/tty45 | 1 + test/sys/class/tty/tty45/dev | 1 - test/sys/class/tty/tty45/subsystem | 1 - test/sys/class/tty/tty46 | 1 + test/sys/class/tty/tty46/dev | 1 - test/sys/class/tty/tty46/subsystem | 1 - test/sys/class/tty/tty47 | 1 + test/sys/class/tty/tty47/dev | 1 - test/sys/class/tty/tty47/subsystem | 1 - test/sys/class/tty/tty48 | 1 + test/sys/class/tty/tty48/dev | 1 - test/sys/class/tty/tty48/subsystem | 1 - test/sys/class/tty/tty49 | 1 + test/sys/class/tty/tty49/dev | 1 - test/sys/class/tty/tty49/subsystem | 1 - test/sys/class/tty/tty5 | 1 + test/sys/class/tty/tty5/dev | 1 - test/sys/class/tty/tty5/subsystem | 1 - test/sys/class/tty/tty50 | 1 + test/sys/class/tty/tty50/dev | 1 - test/sys/class/tty/tty50/subsystem | 1 - test/sys/class/tty/tty51 | 1 + test/sys/class/tty/tty51/dev | 1 - test/sys/class/tty/tty51/subsystem | 1 - test/sys/class/tty/tty52 | 1 + test/sys/class/tty/tty52/dev | 1 - test/sys/class/tty/tty52/subsystem | 1 - test/sys/class/tty/tty53 | 1 + test/sys/class/tty/tty53/dev | 1 - test/sys/class/tty/tty53/subsystem | 1 - test/sys/class/tty/tty54 | 1 + test/sys/class/tty/tty54/dev | 1 - test/sys/class/tty/tty54/subsystem | 1 - test/sys/class/tty/tty55 | 1 + test/sys/class/tty/tty55/dev | 1 - test/sys/class/tty/tty55/subsystem | 1 - test/sys/class/tty/tty56 | 1 + test/sys/class/tty/tty56/dev | 1 - test/sys/class/tty/tty56/subsystem | 1 - test/sys/class/tty/tty57 | 1 + test/sys/class/tty/tty57/dev | 1 - test/sys/class/tty/tty57/subsystem | 1 - test/sys/class/tty/tty58 | 1 + test/sys/class/tty/tty58/dev | 1 - test/sys/class/tty/tty58/subsystem | 1 - test/sys/class/tty/tty59 | 1 + test/sys/class/tty/tty59/dev | 1 - test/sys/class/tty/tty59/subsystem | 1 - test/sys/class/tty/tty6 | 1 + test/sys/class/tty/tty6/dev | 1 - test/sys/class/tty/tty6/subsystem | 1 - test/sys/class/tty/tty60 | 1 + test/sys/class/tty/tty60/dev | 1 - test/sys/class/tty/tty60/subsystem | 1 - test/sys/class/tty/tty61 | 1 + test/sys/class/tty/tty61/dev | 1 - test/sys/class/tty/tty61/subsystem | 1 - test/sys/class/tty/tty62 | 1 + test/sys/class/tty/tty62/dev | 1 - test/sys/class/tty/tty62/subsystem | 1 - test/sys/class/tty/tty63 | 1 + test/sys/class/tty/tty63/dev | 1 - test/sys/class/tty/tty63/subsystem | 1 - test/sys/class/tty/tty7 | 1 + test/sys/class/tty/tty7/dev | 1 - test/sys/class/tty/tty7/subsystem | 1 - test/sys/class/tty/tty8 | 1 + test/sys/class/tty/tty8/dev | 1 - test/sys/class/tty/tty8/subsystem | 1 - test/sys/class/tty/tty9 | 1 + test/sys/class/tty/tty9/dev | 1 - test/sys/class/tty/tty9/subsystem | 1 - test/sys/class/tty/ttyACM0 | 1 + test/sys/class/tty/ttyS0 | 1 + test/sys/class/tty/ttyS0/dev | 1 - test/sys/class/tty/ttyS0/subsystem | 1 - test/sys/class/tty/ttyS1 | 1 + test/sys/class/tty/ttyS1/dev | 1 - test/sys/class/tty/ttyS1/subsystem | 1 - test/sys/class/tty/ttyS2 | 1 + test/sys/class/tty/ttyS2/dev | 1 - test/sys/class/tty/ttyS2/subsystem | 1 - test/sys/class/tty/ttyS3 | 1 + test/sys/class/tty/ttyS3/dev | 1 - test/sys/class/tty/ttyS3/subsystem | 1 - test/sys/class/tty/ttyS4/dev | 1 - test/sys/class/tty/ttyS4/subsystem | 1 - test/sys/class/tty/ttyS5/dev | 1 - test/sys/class/tty/ttyS5/subsystem | 1 - test/sys/class/tty/ttyS6/dev | 1 - test/sys/class/tty/ttyS6/subsystem | 1 - test/sys/class/tty/ttyS7/dev | 1 - test/sys/class/tty/ttyS7/subsystem | 1 - test/sys/class/tty/ttyUSB0/dev | 1 - test/sys/class/tty/ttyUSB0/device | 1 - test/sys/class/tty/ttyUSB0/subsystem | 1 - test/sys/class/usb_endpoint/usbdev1.1_ep00 | 1 + test/sys/class/usb_endpoint/usbdev1.1_ep81 | 1 + test/sys/class/usb_endpoint/usbdev2.1_ep00 | 1 + test/sys/class/usb_endpoint/usbdev2.1_ep81 | 1 + test/sys/class/usb_endpoint/usbdev3.1_ep00 | 1 + test/sys/class/usb_endpoint/usbdev3.1_ep81 | 1 + test/sys/class/usb_endpoint/usbdev3.3_ep00 | 1 + test/sys/class/usb_endpoint/usbdev3.3_ep81 | 1 + test/sys/class/usb_endpoint/usbdev4.1_ep00 | 1 + test/sys/class/usb_endpoint/usbdev4.1_ep81 | 1 + test/sys/class/usb_endpoint/usbdev4.2_ep00 | 1 + test/sys/class/usb_endpoint/usbdev4.2_ep02 | 1 + test/sys/class/usb_endpoint/usbdev4.2_ep03 | 1 + test/sys/class/usb_endpoint/usbdev4.2_ep04 | 1 + test/sys/class/usb_endpoint/usbdev4.2_ep81 | 1 + test/sys/class/usb_endpoint/usbdev4.2_ep82 | 1 + test/sys/class/usb_endpoint/usbdev4.2_ep83 | 1 + test/sys/class/usb_endpoint/usbdev4.2_ep84 | 1 + test/sys/class/usb_endpoint/usbdev4.3_ep00 | 1 + test/sys/class/usb_endpoint/usbdev4.3_ep02 | 1 + test/sys/class/usb_endpoint/usbdev4.3_ep81 | 1 + test/sys/class/usb_endpoint/usbdev4.3_ep83 | 1 + test/sys/class/usb_endpoint/usbdev5.1_ep00 | 1 + test/sys/class/usb_endpoint/usbdev5.1_ep81 | 1 + test/sys/class/usb_endpoint/usbdev5.5_ep00 | 1 + test/sys/class/usb_endpoint/usbdev5.5_ep01 | 1 + test/sys/class/usb_endpoint/usbdev5.5_ep02 | 1 + test/sys/class/usb_endpoint/usbdev5.5_ep81 | 1 + test/sys/class/usb_endpoint/usbdev5.5_ep82 | 1 + test/sys/class/usb_endpoint/usbdev5.5_ep83 | 1 + test/sys/class/usb_endpoint/usbdev5.5_ep84 | 1 + test/sys/class/usb_endpoint/usbdev5.6_ep00 | 1 + test/sys/class/usb_endpoint/usbdev5.6_ep02 | 1 + test/sys/class/usb_endpoint/usbdev5.6_ep81 | 1 + test/sys/class/usb_host/usb_host1 | 1 + test/sys/class/usb_host/usb_host2 | 1 + test/sys/class/usb_host/usb_host3 | 1 + test/sys/class/usb_host/usb_host4 | 1 + test/sys/class/usb_host/usb_host5 | 1 + test/sys/class/vc/vcs | 1 + test/sys/class/vc/vcs1 | 1 + test/sys/class/vc/vcs10 | 1 + test/sys/class/vc/vcs2 | 1 + test/sys/class/vc/vcs3 | 1 + test/sys/class/vc/vcs4 | 1 + test/sys/class/vc/vcs5 | 1 + test/sys/class/vc/vcs6 | 1 + test/sys/class/vc/vcs7 | 1 + test/sys/class/vc/vcsa | 1 + test/sys/class/vc/vcsa1 | 1 + test/sys/class/vc/vcsa10 | 1 + test/sys/class/vc/vcsa2 | 1 + test/sys/class/vc/vcsa3 | 1 + test/sys/class/vc/vcsa4 | 1 + test/sys/class/vc/vcsa5 | 1 + test/sys/class/vc/vcsa6 | 1 + test/sys/class/vc/vcsa7 | 1 + test/sys/class/vtconsole/vtcon0 | 1 + test/sys/class/vtconsole/vtcon1 | 1 + test/sys/dev/block/11:0 | 1 + test/sys/dev/block/7:0 | 1 + test/sys/dev/block/7:1 | 1 + test/sys/dev/block/7:2 | 1 + test/sys/dev/block/7:3 | 1 + test/sys/dev/block/7:4 | 1 + test/sys/dev/block/7:5 | 1 + test/sys/dev/block/7:6 | 1 + test/sys/dev/block/7:7 | 1 + test/sys/dev/block/8:0 | 1 + test/sys/dev/block/8:1 | 1 + test/sys/dev/block/8:10 | 1 + test/sys/dev/block/8:16 | 1 + test/sys/dev/block/8:17 | 1 + test/sys/dev/block/8:5 | 1 + test/sys/dev/block/8:6 | 1 + test/sys/dev/block/8:7 | 1 + test/sys/dev/block/8:8 | 1 + test/sys/dev/block/8:9 | 1 + test/sys/dev/block/9:0 | 1 + test/sys/dev/char/10:1 | 1 + test/sys/dev/char/10:144 | 1 + test/sys/dev/char/10:184 | 1 + test/sys/dev/char/10:223 | 1 + test/sys/dev/char/10:227 | 1 + test/sys/dev/char/10:228 | 1 + test/sys/dev/char/10:229 | 1 + test/sys/dev/char/10:60 | 1 + test/sys/dev/char/10:61 | 1 + test/sys/dev/char/10:62 | 1 + test/sys/dev/char/10:63 | 1 + test/sys/dev/char/116:0 | 1 + test/sys/dev/char/116:1 | 1 + test/sys/dev/char/116:16 | 1 + test/sys/dev/char/116:17 | 1 + test/sys/dev/char/116:24 | 1 + test/sys/dev/char/116:33 | 1 + test/sys/dev/char/13:32 | 1 + test/sys/dev/char/13:33 | 1 + test/sys/dev/char/13:63 | 1 + test/sys/dev/char/13:64 | 1 + test/sys/dev/char/13:65 | 1 + test/sys/dev/char/13:66 | 1 + test/sys/dev/char/13:67 | 1 + test/sys/dev/char/13:68 | 1 + test/sys/dev/char/13:69 | 1 + test/sys/dev/char/13:70 | 1 + test/sys/dev/char/13:71 | 1 + test/sys/dev/char/14:0 | 1 + test/sys/dev/char/14:12 | 1 + test/sys/dev/char/14:3 | 1 + test/sys/dev/char/14:4 | 1 + test/sys/dev/char/166:0 | 1 + test/sys/dev/char/189:0 | 1 + test/sys/dev/char/189:128 | 1 + test/sys/dev/char/189:256 | 1 + test/sys/dev/char/189:258 | 1 + test/sys/dev/char/189:384 | 1 + test/sys/dev/char/189:385 | 1 + test/sys/dev/char/189:386 | 1 + test/sys/dev/char/189:512 | 1 + test/sys/dev/char/189:516 | 1 + test/sys/dev/char/189:517 | 1 + test/sys/dev/char/1:1 | 1 + test/sys/dev/char/1:11 | 1 + test/sys/dev/char/1:2 | 1 + test/sys/dev/char/1:3 | 1 + test/sys/dev/char/1:4 | 1 + test/sys/dev/char/1:5 | 1 + test/sys/dev/char/1:7 | 1 + test/sys/dev/char/1:8 | 1 + test/sys/dev/char/1:9 | 1 + test/sys/dev/char/21:0 | 1 + test/sys/dev/char/21:1 | 1 + test/sys/dev/char/21:2 | 1 + test/sys/dev/char/252:0 | 1 + test/sys/dev/char/252:1 | 1 + test/sys/dev/char/252:10 | 1 + test/sys/dev/char/252:11 | 1 + test/sys/dev/char/252:12 | 1 + test/sys/dev/char/252:13 | 1 + test/sys/dev/char/252:14 | 1 + test/sys/dev/char/252:15 | 1 + test/sys/dev/char/252:16 | 1 + test/sys/dev/char/252:17 | 1 + test/sys/dev/char/252:18 | 1 + test/sys/dev/char/252:19 | 1 + test/sys/dev/char/252:2 | 1 + test/sys/dev/char/252:20 | 1 + test/sys/dev/char/252:21 | 1 + test/sys/dev/char/252:22 | 1 + test/sys/dev/char/252:23 | 1 + test/sys/dev/char/252:24 | 1 + test/sys/dev/char/252:25 | 1 + test/sys/dev/char/252:26 | 1 + test/sys/dev/char/252:27 | 1 + test/sys/dev/char/252:28 | 1 + test/sys/dev/char/252:29 | 1 + test/sys/dev/char/252:3 | 1 + test/sys/dev/char/252:30 | 1 + test/sys/dev/char/252:31 | 1 + test/sys/dev/char/252:32 | 1 + test/sys/dev/char/252:33 | 1 + test/sys/dev/char/252:4 | 1 + test/sys/dev/char/252:5 | 1 + test/sys/dev/char/252:6 | 1 + test/sys/dev/char/252:7 | 1 + test/sys/dev/char/252:8 | 1 + test/sys/dev/char/252:9 | 1 + test/sys/dev/char/253:0 | 1 + test/sys/dev/char/254:0 | 1 + test/sys/dev/char/254:1 | 1 + test/sys/dev/char/254:2 | 1 + test/sys/dev/char/29:0 | 1 + test/sys/dev/char/4:0 | 1 + test/sys/dev/char/4:1 | 1 + test/sys/dev/char/4:10 | 1 + test/sys/dev/char/4:11 | 1 + test/sys/dev/char/4:12 | 1 + test/sys/dev/char/4:13 | 1 + test/sys/dev/char/4:14 | 1 + test/sys/dev/char/4:15 | 1 + test/sys/dev/char/4:16 | 1 + test/sys/dev/char/4:17 | 1 + test/sys/dev/char/4:18 | 1 + test/sys/dev/char/4:19 | 1 + test/sys/dev/char/4:2 | 1 + test/sys/dev/char/4:20 | 1 + test/sys/dev/char/4:21 | 1 + test/sys/dev/char/4:22 | 1 + test/sys/dev/char/4:23 | 1 + test/sys/dev/char/4:24 | 1 + test/sys/dev/char/4:25 | 1 + test/sys/dev/char/4:26 | 1 + test/sys/dev/char/4:27 | 1 + test/sys/dev/char/4:28 | 1 + test/sys/dev/char/4:29 | 1 + test/sys/dev/char/4:3 | 1 + test/sys/dev/char/4:30 | 1 + test/sys/dev/char/4:31 | 1 + test/sys/dev/char/4:32 | 1 + test/sys/dev/char/4:33 | 1 + test/sys/dev/char/4:34 | 1 + test/sys/dev/char/4:35 | 1 + test/sys/dev/char/4:36 | 1 + test/sys/dev/char/4:37 | 1 + test/sys/dev/char/4:38 | 1 + test/sys/dev/char/4:39 | 1 + test/sys/dev/char/4:4 | 1 + test/sys/dev/char/4:40 | 1 + test/sys/dev/char/4:41 | 1 + test/sys/dev/char/4:42 | 1 + test/sys/dev/char/4:43 | 1 + test/sys/dev/char/4:44 | 1 + test/sys/dev/char/4:45 | 1 + test/sys/dev/char/4:46 | 1 + test/sys/dev/char/4:47 | 1 + test/sys/dev/char/4:48 | 1 + test/sys/dev/char/4:49 | 1 + test/sys/dev/char/4:5 | 1 + test/sys/dev/char/4:50 | 1 + test/sys/dev/char/4:51 | 1 + test/sys/dev/char/4:52 | 1 + test/sys/dev/char/4:53 | 1 + test/sys/dev/char/4:54 | 1 + test/sys/dev/char/4:55 | 1 + test/sys/dev/char/4:56 | 1 + test/sys/dev/char/4:57 | 1 + test/sys/dev/char/4:58 | 1 + test/sys/dev/char/4:59 | 1 + test/sys/dev/char/4:6 | 1 + test/sys/dev/char/4:60 | 1 + test/sys/dev/char/4:61 | 1 + test/sys/dev/char/4:62 | 1 + test/sys/dev/char/4:63 | 1 + test/sys/dev/char/4:64 | 1 + test/sys/dev/char/4:65 | 1 + test/sys/dev/char/4:66 | 1 + test/sys/dev/char/4:67 | 1 + test/sys/dev/char/4:7 | 1 + test/sys/dev/char/4:8 | 1 + test/sys/dev/char/4:9 | 1 + test/sys/dev/char/5:0 | 1 + test/sys/dev/char/5:1 | 1 + test/sys/dev/char/5:2 | 1 + test/sys/dev/char/7:0 | 1 + test/sys/dev/char/7:1 | 1 + test/sys/dev/char/7:10 | 1 + test/sys/dev/char/7:128 | 1 + test/sys/dev/char/7:129 | 1 + test/sys/dev/char/7:130 | 1 + test/sys/dev/char/7:131 | 1 + test/sys/dev/char/7:132 | 1 + test/sys/dev/char/7:133 | 1 + test/sys/dev/char/7:134 | 1 + test/sys/dev/char/7:135 | 1 + test/sys/dev/char/7:138 | 1 + test/sys/dev/char/7:2 | 1 + test/sys/dev/char/7:3 | 1 + test/sys/dev/char/7:4 | 1 + test/sys/dev/char/7:5 | 1 + test/sys/dev/char/7:6 | 1 + test/sys/dev/char/7:7 | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:00/path | 1 + .../devices/LNXSYSTM:00/ACPI0007:00/power/wakeup | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev | 1 + .../LNXSYSTM:00/ACPI0007:00/thermal_cooling | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent | 2 + test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:01/path | 1 + .../devices/LNXSYSTM:00/ACPI0007:01/power/wakeup | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev | 1 + .../LNXSYSTM:00/ACPI0007:01/thermal_cooling | 1 + test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent | 2 + test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver | 1 + test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid | 1 + .../LNXPWRBN:00/input/input3/capabilities/abs | 1 + .../LNXPWRBN:00/input/input3/capabilities/ev | 1 + .../LNXPWRBN:00/input/input3/capabilities/ff | 1 + .../LNXPWRBN:00/input/input3/capabilities/key | 1 + .../LNXPWRBN:00/input/input3/capabilities/led | 1 + .../LNXPWRBN:00/input/input3/capabilities/msc | 1 + .../LNXPWRBN:00/input/input3/capabilities/rel | 1 + .../LNXPWRBN:00/input/input3/capabilities/snd | 1 + .../LNXPWRBN:00/input/input3/capabilities/sw | 1 + .../LNXSYSTM:00/LNXPWRBN:00/input/input3/device | 1 + .../LNXPWRBN:00/input/input3/event3/dev | 1 + .../LNXPWRBN:00/input/input3/event3/device | 1 + .../LNXPWRBN:00/input/input3/event3/power/wakeup | 1 + .../LNXPWRBN:00/input/input3/event3/subsystem | 1 + .../LNXPWRBN:00/input/input3/event3/uevent | 2 + .../LNXPWRBN:00/input/input3/id/bustype | 1 + .../LNXPWRBN:00/input/input3/id/product | 1 + .../LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor | 1 + .../LNXPWRBN:00/input/input3/id/version | 1 + .../LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias | 1 + .../LNXSYSTM:00/LNXPWRBN:00/input/input3/name | 1 + .../LNXSYSTM:00/LNXPWRBN:00/input/input3/phys | 1 + .../LNXPWRBN:00/input/input3/power/wakeup | 1 + .../LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem | 1 + .../LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent | 6 + .../LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq | 1 + test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias | 1 + .../devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup | 1 + test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem | 1 + test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent | 2 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path | 1 + .../LNXTHERM:00/LNXTHERM:01/power/wakeup | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem | 1 + .../LNXTHERM:00/LNXTHERM:01/thermal_zone | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent | 2 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path | 1 + .../LNXTHERM:00/LNXTHERM:02/power/wakeup | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem | 1 + .../LNXTHERM:00/LNXTHERM:02/thermal_zone | 1 + .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent | 2 + test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid | 1 + test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias | 1 + test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path | 1 + .../devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup | 1 + test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem | 1 + test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent | 1 + .../devices/LNXSYSTM:00/device:00/IBM0079:00/hid | 1 + .../LNXSYSTM:00/device:00/IBM0079:00/modalias | 1 + .../devices/LNXSYSTM:00/device:00/IBM0079:00/path | 1 + .../LNXSYSTM:00/device:00/IBM0079:00/power/wakeup | 1 + .../LNXSYSTM:00/device:00/IBM0079:00/subsystem | 1 + .../LNXSYSTM:00/device:00/IBM0079:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/ATM1200:00/hid | 1 + .../PNP0A08:00/device:01/ATM1200:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/ATM1200:00/path | 1 + .../PNP0A08:00/device:01/ATM1200:00/physical_node | 1 + .../PNP0A08:00/device:01/ATM1200:00/power/wakeup | 1 + .../PNP0A08:00/device:01/ATM1200:00/subsystem | 1 + .../PNP0A08:00/device:01/ATM1200:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/IBM0057:00/hid | 1 + .../PNP0A08:00/device:01/IBM0057:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/IBM0057:00/path | 1 + .../PNP0A08:00/device:01/IBM0057:00/physical_node | 1 + .../PNP0A08:00/device:01/IBM0057:00/power/wakeup | 1 + .../PNP0A08:00/device:01/IBM0057:00/subsystem | 1 + .../PNP0A08:00/device:01/IBM0057:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/PNP0000:00/hid | 1 + .../PNP0A08:00/device:01/PNP0000:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0000:00/path | 1 + .../PNP0A08:00/device:01/PNP0000:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0000:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0000:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/PNP0100:00/hid | 1 + .../PNP0A08:00/device:01/PNP0100:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0100:00/path | 1 + .../PNP0A08:00/device:01/PNP0100:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0100:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0100:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/PNP0103:00/hid | 1 + .../PNP0A08:00/device:01/PNP0103:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0103:00/path | 1 + .../PNP0A08:00/device:01/PNP0103:00/physical_node | 1 + .../PNP0A08:00/device:01/PNP0103:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0103:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0103:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/PNP0200:00/hid | 1 + .../PNP0A08:00/device:01/PNP0200:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0200:00/path | 1 + .../PNP0A08:00/device:01/PNP0200:00/physical_node | 1 + .../PNP0A08:00/device:01/PNP0200:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0200:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0200:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/PNP0303:00/hid | 1 + .../PNP0A08:00/device:01/PNP0303:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0303:00/path | 1 + .../PNP0A08:00/device:01/PNP0303:00/physical_node | 1 + .../PNP0A08:00/device:01/PNP0303:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0303:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0303:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/PNP0800:00/hid | 1 + .../PNP0A08:00/device:01/PNP0800:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0800:00/path | 1 + .../PNP0A08:00/device:01/PNP0800:00/physical_node | 1 + .../PNP0A08:00/device:01/PNP0800:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0800:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0800:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/PNP0B00:00/hid | 1 + .../PNP0A08:00/device:01/PNP0B00:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0B00:00/path | 1 + .../PNP0A08:00/device:01/PNP0B00:00/physical_node | 1 + .../PNP0A08:00/device:01/PNP0B00:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0B00:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0B00:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/PNP0C02:00/hid | 1 + .../PNP0A08:00/device:01/PNP0C02:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0C02:00/path | 1 + .../PNP0A08:00/device:01/PNP0C02:00/physical_node | 1 + .../PNP0A08:00/device:01/PNP0C02:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0C02:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0C02:00/uevent | 1 + .../device:00/PNP0A08:00/device:01/PNP0C04:00/hid | 1 + .../PNP0A08:00/device:01/PNP0C04:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0C04:00/path | 1 + .../PNP0A08:00/device:01/PNP0C04:00/physical_node | 1 + .../PNP0A08:00/device:01/PNP0C04:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0C04:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0C04:00/uevent | 1 + .../device:01/PNP0C09:00/ACPI0003:00/driver | 1 + .../device:01/PNP0C09:00/ACPI0003:00/hid | 1 + .../device:01/PNP0C09:00/ACPI0003:00/modalias | 1 + .../device:01/PNP0C09:00/ACPI0003:00/path | 1 + .../device:01/PNP0C09:00/ACPI0003:00/power/wakeup | 1 + .../PNP0C09:00/ACPI0003:00/power_supply/AC/device | 1 + .../PNP0C09:00/ACPI0003:00/power_supply/AC/online | 1 + .../ACPI0003:00/power_supply/AC/power/wakeup | 1 + .../ACPI0003:00/power_supply/AC/subsystem | 1 + .../PNP0C09:00/ACPI0003:00/power_supply/AC/type | 1 + .../PNP0C09:00/ACPI0003:00/power_supply/AC/uevent | 3 + .../device:01/PNP0C09:00/ACPI0003:00/subsystem | 1 + .../device:01/PNP0C09:00/ACPI0003:00/uevent | 2 + .../device:01/PNP0C09:00/IBM0068:00/driver | 1 + .../PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid | 1 + .../device:01/PNP0C09:00/IBM0068:00/modalias | 1 + .../device:01/PNP0C09:00/IBM0068:00/path | 1 + .../device:01/PNP0C09:00/IBM0068:00/power/wakeup | 1 + .../device:01/PNP0C09:00/IBM0068:00/subsystem | 1 + .../device:01/PNP0C09:00/IBM0068:00/uevent | 2 + .../device:01/PNP0C09:00/LNXPOWER:00/driver | 1 + .../device:01/PNP0C09:00/LNXPOWER:00/hid | 1 + .../device:01/PNP0C09:00/LNXPOWER:00/modalias | 1 + .../device:01/PNP0C09:00/LNXPOWER:00/path | 1 + .../device:01/PNP0C09:00/LNXPOWER:00/power/wakeup | 1 + .../device:01/PNP0C09:00/LNXPOWER:00/subsystem | 1 + .../device:01/PNP0C09:00/LNXPOWER:00/uevent | 2 + .../device:01/PNP0C09:00/PNP0C0A:00/driver | 1 + .../PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid | 1 + .../device:01/PNP0C09:00/PNP0C0A:00/modalias | 1 + .../device:01/PNP0C09:00/PNP0C0A:00/path | 1 + .../device:01/PNP0C09:00/PNP0C0A:00/power/wakeup | 1 + .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm | 1 + .../PNP0C0A:00/power_supply/BAT0/current_now | 1 + .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device | 1 + .../PNP0C0A:00/power_supply/BAT0/energy_full | 1 + .../power_supply/BAT0/energy_full_design | 1 + .../PNP0C0A:00/power_supply/BAT0/energy_now | 1 + .../PNP0C0A:00/power_supply/BAT0/manufacturer | 1 + .../PNP0C0A:00/power_supply/BAT0/model_name | 1 + .../PNP0C0A:00/power_supply/BAT0/power/wakeup | 1 + .../PNP0C0A:00/power_supply/BAT0/present | 1 + .../PNP0C0A:00/power_supply/BAT0/serial_number | 1 + .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status | 1 + .../PNP0C0A:00/power_supply/BAT0/subsystem | 1 + .../PNP0C0A:00/power_supply/BAT0/technology | 1 + .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type | 1 + .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent | 14 + .../power_supply/BAT0/voltage_min_design | 1 + .../PNP0C0A:00/power_supply/BAT0/voltage_now | 1 + .../device:01/PNP0C09:00/PNP0C0A:00/subsystem | 1 + .../device:01/PNP0C09:00/PNP0C0A:00/uevent | 2 + .../PNP0A08:00/device:01/PNP0C09:00/driver | 1 + .../device:00/PNP0A08:00/device:01/PNP0C09:00/hid | 1 + .../PNP0A08:00/device:01/PNP0C09:00/modalias | 1 + .../device:00/PNP0A08:00/device:01/PNP0C09:00/path | 1 + .../PNP0A08:00/device:01/PNP0C09:00/power/wakeup | 1 + .../PNP0A08:00/device:01/PNP0C09:00/subsystem | 1 + .../PNP0A08:00/device:01/PNP0C09:00/uevent | 2 + .../device:00/PNP0A08:00/device:01/path | 1 + .../device:00/PNP0A08:00/device:01/physical_node | 1 + .../device:00/PNP0A08:00/device:01/power/wakeup | 1 + .../device:00/PNP0A08:00/device:01/subsystem | 1 + .../device:00/PNP0A08:00/device:01/uevent | 0 .../device:00/PNP0A08:00/device:02/device:03/path | 1 + .../PNP0A08:00/device:02/device:03/power/wakeup | 1 + .../PNP0A08:00/device:02/device:03/subsystem | 1 + .../PNP0A08:00/device:02/device:03/uevent | 0 .../device:00/PNP0A08:00/device:02/device:04/path | 1 + .../PNP0A08:00/device:02/device:04/power/wakeup | 1 + .../PNP0A08:00/device:02/device:04/subsystem | 1 + .../PNP0A08:00/device:02/device:04/uevent | 0 .../device:00/PNP0A08:00/device:02/device:05/path | 1 + .../PNP0A08:00/device:02/device:05/power/wakeup | 1 + .../PNP0A08:00/device:02/device:05/subsystem | 1 + .../PNP0A08:00/device:02/device:05/uevent | 0 .../device:00/PNP0A08:00/device:02/modalias | 1 + .../device:00/PNP0A08:00/device:02/path | 1 + .../device:00/PNP0A08:00/device:02/power/wakeup | 1 + .../device:00/PNP0A08:00/device:02/subsystem | 1 + .../device:00/PNP0A08:00/device:02/uevent | 1 + .../PNP0A08:00/device:06/device:07/device:08/path | 1 + .../device:06/device:07/device:08/power/wakeup | 1 + .../device:06/device:07/device:08/subsystem | 1 + .../device:06/device:07/device:08/uevent | 0 .../PNP0A08:00/device:06/device:07/device:09/path | 1 + .../device:06/device:07/device:09/power/wakeup | 1 + .../device:06/device:07/device:09/subsystem | 1 + .../device:06/device:07/device:09/uevent | 0 .../PNP0A08:00/device:06/device:07/device:0a/path | 1 + .../device:06/device:07/device:0a/power/wakeup | 1 + .../device:06/device:07/device:0a/subsystem | 1 + .../device:06/device:07/device:0a/uevent | 0 .../PNP0A08:00/device:06/device:07/modalias | 1 + .../device:00/PNP0A08:00/device:06/device:07/path | 1 + .../PNP0A08:00/device:06/device:07/physical_node | 1 + .../PNP0A08:00/device:06/device:07/power/wakeup | 1 + .../PNP0A08:00/device:06/device:07/subsystem | 1 + .../PNP0A08:00/device:06/device:07/uevent | 1 + .../device:00/PNP0A08:00/device:06/path | 1 + .../device:00/PNP0A08:00/device:06/physical_node | 1 + .../device:00/PNP0A08:00/device:06/power/wakeup | 1 + .../device:00/PNP0A08:00/device:06/subsystem | 1 + .../device:00/PNP0A08:00/device:06/uevent | 0 .../device:00/PNP0A08:00/device:0b/path | 1 + .../device:00/PNP0A08:00/device:0b/physical_node | 1 + .../device:00/PNP0A08:00/device:0b/power/wakeup | 1 + .../device:00/PNP0A08:00/device:0b/subsystem | 1 + .../device:00/PNP0A08:00/device:0b/uevent | 0 .../device:00/PNP0A08:00/device:0c/path | 1 + .../device:00/PNP0A08:00/device:0c/physical_node | 1 + .../device:00/PNP0A08:00/device:0c/power/wakeup | 1 + .../device:00/PNP0A08:00/device:0c/subsystem | 1 + .../device:00/PNP0A08:00/device:0c/uevent | 0 .../device:00/PNP0A08:00/device:0d/device:0e/path | 1 + .../PNP0A08:00/device:0d/device:0e/power/wakeup | 1 + .../PNP0A08:00/device:0d/device:0e/subsystem | 1 + .../PNP0A08:00/device:0d/device:0e/uevent | 0 .../device:00/PNP0A08:00/device:0d/path | 1 + .../device:00/PNP0A08:00/device:0d/physical_node | 1 + .../device:00/PNP0A08:00/device:0d/power/wakeup | 1 + .../device:00/PNP0A08:00/device:0d/subsystem | 1 + .../device:00/PNP0A08:00/device:0d/uevent | 0 .../device:00/PNP0A08:00/device:0f/device:10/path | 1 + .../PNP0A08:00/device:0f/device:10/power/wakeup | 1 + .../PNP0A08:00/device:0f/device:10/subsystem | 1 + .../PNP0A08:00/device:0f/device:10/uevent | 0 .../device:00/PNP0A08:00/device:0f/path | 1 + .../device:00/PNP0A08:00/device:0f/physical_node | 1 + .../device:00/PNP0A08:00/device:0f/power/wakeup | 1 + .../device:00/PNP0A08:00/device:0f/subsystem | 1 + .../device:00/PNP0A08:00/device:0f/uevent | 0 .../device:00/PNP0A08:00/device:11/device:12/path | 1 + .../PNP0A08:00/device:11/device:12/physical_node | 1 + .../PNP0A08:00/device:11/device:12/power/wakeup | 1 + .../PNP0A08:00/device:11/device:12/subsystem | 1 + .../PNP0A08:00/device:11/device:12/uevent | 0 .../device:00/PNP0A08:00/device:11/path | 1 + .../device:00/PNP0A08:00/device:11/physical_node | 1 + .../device:00/PNP0A08:00/device:11/power/wakeup | 1 + .../device:00/PNP0A08:00/device:11/subsystem | 1 + .../device:00/PNP0A08:00/device:11/uevent | 0 .../device:13/device:14/device:15/modalias | 1 + .../PNP0A08:00/device:13/device:14/device:15/path | 1 + .../device:13/device:14/device:15/power/wakeup | 1 + .../device:13/device:14/device:15/subsystem | 1 + .../device:13/device:14/device:15/uevent | 1 + .../device:00/PNP0A08:00/device:13/device:14/path | 1 + .../PNP0A08:00/device:13/device:14/power/wakeup | 1 + .../PNP0A08:00/device:13/device:14/subsystem | 1 + .../PNP0A08:00/device:13/device:14/uevent | 0 .../device:00/PNP0A08:00/device:13/path | 1 + .../device:00/PNP0A08:00/device:13/physical_node | 1 + .../device:00/PNP0A08:00/device:13/power/wakeup | 1 + .../device:00/PNP0A08:00/device:13/subsystem | 1 + .../device:00/PNP0A08:00/device:13/uevent | 0 .../device:00/PNP0A08:00/device:16/device:17/path | 1 + .../PNP0A08:00/device:16/device:17/power/wakeup | 1 + .../PNP0A08:00/device:16/device:17/subsystem | 1 + .../PNP0A08:00/device:16/device:17/uevent | 0 .../device:00/PNP0A08:00/device:16/path | 1 + .../device:00/PNP0A08:00/device:16/physical_node | 1 + .../device:00/PNP0A08:00/device:16/power/wakeup | 1 + .../device:00/PNP0A08:00/device:16/subsystem | 1 + .../device:00/PNP0A08:00/device:16/uevent | 0 .../device:00/PNP0A08:00/device:18/path | 1 + .../device:00/PNP0A08:00/device:18/physical_node | 1 + .../device:00/PNP0A08:00/device:18/power/wakeup | 1 + .../device:00/PNP0A08:00/device:18/subsystem | 1 + .../device:00/PNP0A08:00/device:18/uevent | 0 .../device:00/PNP0A08:00/device:19/path | 1 + .../device:00/PNP0A08:00/device:19/physical_node | 1 + .../device:00/PNP0A08:00/device:19/power/wakeup | 1 + .../device:00/PNP0A08:00/device:19/subsystem | 1 + .../device:00/PNP0A08:00/device:19/uevent | 0 .../PNP0A08:00/device:1a/device:1b/device:1c/path | 1 + .../device:1a/device:1b/device:1c/power/wakeup | 1 + .../device:1a/device:1b/device:1c/subsystem | 1 + .../device:1a/device:1b/device:1c/uevent | 0 .../device:00/PNP0A08:00/device:1a/device:1b/path | 1 + .../PNP0A08:00/device:1a/device:1b/power/wakeup | 1 + .../PNP0A08:00/device:1a/device:1b/subsystem | 1 + .../PNP0A08:00/device:1a/device:1b/uevent | 0 .../device:00/PNP0A08:00/device:1a/path | 1 + .../device:00/PNP0A08:00/device:1a/physical_node | 1 + .../device:00/PNP0A08:00/device:1a/power/wakeup | 1 + .../device:00/PNP0A08:00/device:1a/subsystem | 1 + .../device:00/PNP0A08:00/device:1a/uevent | 0 .../PNP0A08:00/device:1d/device:1e/device:1f/path | 1 + .../device:1d/device:1e/device:1f/power/wakeup | 1 + .../device:1d/device:1e/device:1f/subsystem | 1 + .../device:1d/device:1e/device:1f/uevent | 0 .../device:00/PNP0A08:00/device:1d/device:1e/path | 1 + .../PNP0A08:00/device:1d/device:1e/power/wakeup | 1 + .../PNP0A08:00/device:1d/device:1e/subsystem | 1 + .../PNP0A08:00/device:1d/device:1e/uevent | 0 .../device:00/PNP0A08:00/device:1d/path | 1 + .../device:00/PNP0A08:00/device:1d/physical_node | 1 + .../device:00/PNP0A08:00/device:1d/power/wakeup | 1 + .../device:00/PNP0A08:00/device:1d/subsystem | 1 + .../device:00/PNP0A08:00/device:1d/uevent | 0 .../device:00/PNP0A08:00/device:20/path | 1 + .../device:00/PNP0A08:00/device:20/physical_node | 1 + .../device:00/PNP0A08:00/device:20/power/wakeup | 1 + .../device:00/PNP0A08:00/device:20/subsystem | 1 + .../device:00/PNP0A08:00/device:20/uevent | 0 .../PNP0A08:00/device:21/device:22/device:23/path | 1 + .../device:21/device:22/device:23/power/wakeup | 1 + .../device:21/device:22/device:23/subsystem | 1 + .../device:21/device:22/device:23/uevent | 0 .../PNP0A08:00/device:21/device:22/device:24/path | 1 + .../device:21/device:22/device:24/power/wakeup | 1 + .../device:21/device:22/device:24/subsystem | 1 + .../device:21/device:22/device:24/uevent | 0 .../device:00/PNP0A08:00/device:21/device:22/path | 1 + .../PNP0A08:00/device:21/device:22/power/wakeup | 1 + .../PNP0A08:00/device:21/device:22/subsystem | 1 + .../PNP0A08:00/device:21/device:22/uevent | 0 .../device:00/PNP0A08:00/device:21/path | 1 + .../device:00/PNP0A08:00/device:21/physical_node | 1 + .../device:00/PNP0A08:00/device:21/power/wakeup | 1 + .../device:00/PNP0A08:00/device:21/subsystem | 1 + .../device:00/PNP0A08:00/device:21/uevent | 0 .../device:00/PNP0A08:00/device:25/path | 1 + .../device:00/PNP0A08:00/device:25/physical_node | 1 + .../device:00/PNP0A08:00/device:25/power/wakeup | 1 + .../device:00/PNP0A08:00/device:25/subsystem | 1 + .../device:00/PNP0A08:00/device:25/uevent | 0 .../LNXSYSTM:00/device:00/PNP0A08:00/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0A08:00/hid | 1 + .../LNXSYSTM:00/device:00/PNP0A08:00/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0A08:00/path | 1 + .../LNXSYSTM:00/device:00/PNP0A08:00/physical_node | 1 + .../LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0A08:00/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0A08:00/uevent | 2 + .../devices/LNXSYSTM:00/device:00/PNP0C01:00/hid | 1 + .../LNXSYSTM:00/device:00/PNP0C01:00/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C01:00/path | 1 + .../LNXSYSTM:00/device:00/PNP0C01:00/physical_node | 1 + .../LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C01:00/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C01:00/uevent | 1 + .../LNXSYSTM:00/device:00/PNP0C0D:00/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid | 1 + .../PNP0C0D:00/input/input4/capabilities/abs | 1 + .../PNP0C0D:00/input/input4/capabilities/ev | 1 + .../PNP0C0D:00/input/input4/capabilities/ff | 1 + .../PNP0C0D:00/input/input4/capabilities/key | 1 + .../PNP0C0D:00/input/input4/capabilities/led | 1 + .../PNP0C0D:00/input/input4/capabilities/msc | 1 + .../PNP0C0D:00/input/input4/capabilities/rel | 1 + .../PNP0C0D:00/input/input4/capabilities/snd | 1 + .../PNP0C0D:00/input/input4/capabilities/sw | 1 + .../device:00/PNP0C0D:00/input/input4/device | 1 + .../device:00/PNP0C0D:00/input/input4/event4/dev | 1 + .../PNP0C0D:00/input/input4/event4/device | 1 + .../PNP0C0D:00/input/input4/event4/power/wakeup | 1 + .../PNP0C0D:00/input/input4/event4/subsystem | 1 + .../PNP0C0D:00/input/input4/event4/uevent | 2 + .../device:00/PNP0C0D:00/input/input4/id/bustype | 1 + .../device:00/PNP0C0D:00/input/input4/id/product | 1 + .../device:00/PNP0C0D:00/input/input4/id/vendor | 1 + .../device:00/PNP0C0D:00/input/input4/id/version | 1 + .../device:00/PNP0C0D:00/input/input4/modalias | 1 + .../device:00/PNP0C0D:00/input/input4/name | 1 + .../device:00/PNP0C0D:00/input/input4/phys | 1 + .../device:00/PNP0C0D:00/input/input4/power/wakeup | 1 + .../device:00/PNP0C0D:00/input/input4/subsystem | 1 + .../device:00/PNP0C0D:00/input/input4/uevent | 6 + .../device:00/PNP0C0D:00/input/input4/uniq | 1 + .../LNXSYSTM:00/device:00/PNP0C0D:00/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0D:00/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0D:00/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0D:00/uevent | 2 + .../LNXSYSTM:00/device:00/PNP0C0E:00/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid | 1 + .../PNP0C0E:00/input/input5/capabilities/abs | 1 + .../PNP0C0E:00/input/input5/capabilities/ev | 1 + .../PNP0C0E:00/input/input5/capabilities/ff | 1 + .../PNP0C0E:00/input/input5/capabilities/key | 1 + .../PNP0C0E:00/input/input5/capabilities/led | 1 + .../PNP0C0E:00/input/input5/capabilities/msc | 1 + .../PNP0C0E:00/input/input5/capabilities/rel | 1 + .../PNP0C0E:00/input/input5/capabilities/snd | 1 + .../PNP0C0E:00/input/input5/capabilities/sw | 1 + .../device:00/PNP0C0E:00/input/input5/device | 1 + .../device:00/PNP0C0E:00/input/input5/event5/dev | 1 + .../PNP0C0E:00/input/input5/event5/device | 1 + .../PNP0C0E:00/input/input5/event5/power/wakeup | 1 + .../PNP0C0E:00/input/input5/event5/subsystem | 1 + .../PNP0C0E:00/input/input5/event5/uevent | 2 + .../device:00/PNP0C0E:00/input/input5/id/bustype | 1 + .../device:00/PNP0C0E:00/input/input5/id/product | 1 + .../device:00/PNP0C0E:00/input/input5/id/vendor | 1 + .../device:00/PNP0C0E:00/input/input5/id/version | 1 + .../device:00/PNP0C0E:00/input/input5/modalias | 1 + .../device:00/PNP0C0E:00/input/input5/name | 1 + .../device:00/PNP0C0E:00/input/input5/phys | 1 + .../device:00/PNP0C0E:00/input/input5/power/wakeup | 1 + .../device:00/PNP0C0E:00/input/input5/subsystem | 1 + .../device:00/PNP0C0E:00/input/input5/uevent | 6 + .../device:00/PNP0C0E:00/input/input5/uniq | 1 + .../LNXSYSTM:00/device:00/PNP0C0E:00/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0E:00/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0E:00/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0E:00/uevent | 2 + .../LNXSYSTM:00/device:00/PNP0C0F:00/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:00/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:00/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:00/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:00/uevent | 2 + .../LNXSYSTM:00/device:00/PNP0C0F:01/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:01/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:01/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:01/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:01/uevent | 2 + .../LNXSYSTM:00/device:00/PNP0C0F:02/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:02/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:02/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:02/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:02/uevent | 2 + .../LNXSYSTM:00/device:00/PNP0C0F:03/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:03/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:03/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:03/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:03/uevent | 2 + .../LNXSYSTM:00/device:00/PNP0C0F:04/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:04/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:04/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:04/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:04/uevent | 2 + .../LNXSYSTM:00/device:00/PNP0C0F:05/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:05/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:05/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:05/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:05/uevent | 2 + .../LNXSYSTM:00/device:00/PNP0C0F:06/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:06/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:06/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:06/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:06/uevent | 2 + .../LNXSYSTM:00/device:00/PNP0C0F:07/driver | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:07/modalias | 1 + .../devices/LNXSYSTM:00/device:00/PNP0C0F:07/path | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:07/subsystem | 1 + .../LNXSYSTM:00/device:00/PNP0C0F:07/uevent | 2 + test/sys/devices/LNXSYSTM:00/device:00/path | 1 + .../sys/devices/LNXSYSTM:00/device:00/power/wakeup | 1 + test/sys/devices/LNXSYSTM:00/device:00/subsystem | 1 + test/sys/devices/LNXSYSTM:00/device:00/uevent | 0 test/sys/devices/LNXSYSTM:00/hid | 1 + test/sys/devices/LNXSYSTM:00/modalias | 1 + test/sys/devices/LNXSYSTM:00/path | 1 + test/sys/devices/LNXSYSTM:00/power/wakeup | 1 + test/sys/devices/LNXSYSTM:00/subsystem | 1 + test/sys/devices/LNXSYSTM:00/uevent | 1 + .../pci0000:00/0000:00:00.0/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:00.0/class | 1 + test/sys/devices/pci0000:00/0000:00:00.0/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:00.0/device | 1 + test/sys/devices/pci0000:00/0000:00:00.0/enable | 1 + test/sys/devices/pci0000:00/0000:00:00.0/irq | 1 + .../devices/pci0000:00/0000:00:00.0/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:00.0/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:00.0/modalias | 1 + test/sys/devices/pci0000:00/0000:00:00.0/msi_bus | 0 .../devices/pci0000:00/0000:00:00.0/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:00.0/resource | 7 + test/sys/devices/pci0000:00/0000:00:00.0/subsystem | 1 + .../pci0000:00/0000:00:00.0/subsystem_device | 1 + .../pci0000:00/0000:00:00.0/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:00.0/uevent | 5 + test/sys/devices/pci0000:00/0000:00:00.0/vendor | 1 + .../0000:00:01.0/0000:00:01.0:pcie00/power/wakeup | 1 + .../0000:00:01.0/0000:00:01.0:pcie00/subsystem | 1 + .../0000:00:01.0/0000:00:01.0:pcie00/uevent | 0 .../0000:00:01.0/0000:00:01.0:pcie03/power/wakeup | 1 + .../0000:00:01.0/0000:00:01.0:pcie03/subsystem | 1 + .../0000:00:01.0/0000:00:01.0:pcie03/uevent | 0 .../0000:00:01.0/0000:01:00.0/broken_parity_status | 1 + .../pci0000:00/0000:00:01.0/0000:01:00.0/class | 1 + .../pci0000:00/0000:00:01.0/0000:01:00.0/config | Bin 0 -> 4096 bytes .../pci0000:00/0000:00:01.0/0000:01:00.0/device | 1 + .../pci0000:00/0000:00:01.0/0000:01:00.0/enable | 1 + .../0000:00:01.0/0000:01:00.0/firmware_node | 1 + .../pci0000:00/0000:00:01.0/0000:01:00.0/irq | 1 + .../0000:00:01.0/0000:01:00.0/local_cpulist | 1 + .../0000:00:01.0/0000:01:00.0/local_cpus | 1 + .../pci0000:00/0000:00:01.0/0000:01:00.0/modalias | 1 + .../pci0000:00/0000:00:01.0/0000:01:00.0/msi_bus | 0 .../0000:00:01.0/0000:01:00.0/power/wakeup | 1 + .../pci0000:00/0000:00:01.0/0000:01:00.0/resource | 7 + .../pci0000:00/0000:00:01.0/0000:01:00.0/resource0 | 0 .../0000:00:01.0/0000:01:00.0/resource0_wc | 0 .../pci0000:00/0000:00:01.0/0000:01:00.0/resource1 | 0 .../pci0000:00/0000:00:01.0/0000:01:00.0/resource2 | 0 .../pci0000:00/0000:00:01.0/0000:01:00.0/rom | 0 .../pci0000:00/0000:00:01.0/0000:01:00.0/subsystem | 1 + .../0000:00:01.0/0000:01:00.0/subsystem_device | 1 + .../0000:00:01.0/0000:01:00.0/subsystem_vendor | 1 + .../pci0000:00/0000:00:01.0/0000:01:00.0/uevent | 5 + .../pci0000:00/0000:00:01.0/0000:01:00.0/vendor | 1 + .../pci0000:00/0000:00:01.0/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:01.0/class | 1 + test/sys/devices/pci0000:00/0000:00:01.0/config | Bin 0 -> 4096 bytes test/sys/devices/pci0000:00/0000:00:01.0/device | 1 + test/sys/devices/pci0000:00/0000:00:01.0/driver | 1 + test/sys/devices/pci0000:00/0000:00:01.0/enable | 1 + .../devices/pci0000:00/0000:00:01.0/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:01.0/irq | 1 + .../devices/pci0000:00/0000:00:01.0/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:01.0/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:01.0/modalias | 1 + test/sys/devices/pci0000:00/0000:00:01.0/msi_bus | 1 + .../0000:00:01.0/pci_bus/0000:01/cpuaffinity | 1 + .../pci0000:00/0000:00:01.0/pci_bus/0000:01/device | 1 + .../0000:00:01.0/pci_bus/0000:01/power/wakeup | 1 + .../0000:00:01.0/pci_bus/0000:01/subsystem | 1 + .../pci0000:00/0000:00:01.0/pci_bus/0000:01/uevent | 0 .../devices/pci0000:00/0000:00:01.0/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:01.0/resource | 12 + test/sys/devices/pci0000:00/0000:00:01.0/subsystem | 1 + .../pci0000:00/0000:00:01.0/subsystem_device | 1 + .../pci0000:00/0000:00:01.0/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:01.0/uevent | 6 + test/sys/devices/pci0000:00/0000:00:01.0/vendor | 1 + test/sys/devices/pci0000:00/0000:00:09.0/class | 1 - test/sys/devices/pci0000:00/0000:00:09.0/device | 1 - test/sys/devices/pci0000:00/0000:00:09.0/irq | 1 - test/sys/devices/pci0000:00/0000:00:09.0/pools | 7 - .../devices/pci0000:00/0000:00:09.0/power/state | 1 - test/sys/devices/pci0000:00/0000:00:09.0/resource | 7 - test/sys/devices/pci0000:00/0000:00:09.0/subsystem | 1 - .../pci0000:00/0000:00:09.0/subsystem_device | 1 - .../pci0000:00/0000:00:09.0/subsystem_vendor | 1 - .../0000:00:09.0/usb3/3-0:1.0/bAlternateSetting | 1 - .../0000:00:09.0/usb3/3-0:1.0/bInterfaceClass | 1 - .../0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber | 1 - .../0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol | 1 - .../0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass | 1 - .../0000:00:09.0/usb3/3-0:1.0/bNumEndpoints | 1 - .../pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver | 1 - .../0000:00:09.0/usb3/3-0:1.0/iInterface | 1 - .../0000:00:09.0/usb3/3-0:1.0/power/state | 1 - .../pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem | 1 - .../usb3/3-1/3-1:1.0/bAlternateSetting | 1 - .../0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass | 1 - .../0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber | 1 - .../usb3/3-1/3-1:1.0/bInterfaceProtocol | 1 - .../usb3/3-1/3-1:1.0/bInterfaceSubClass | 1 - .../0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints | 1 - .../0000:00:09.0/usb3/3-1/3-1:1.0/driver | 1 - .../0000:00:09.0/usb3/3-1/3-1:1.0/iInterface | 1 - .../0000:00:09.0/usb3/3-1/3-1:1.0/power/state | 1 - .../0000:00:09.0/usb3/3-1/3-1:1.0/subsystem | 1 - .../0000:00:09.0/usb3/3-1/bConfigurationValue | 1 - .../pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass | 1 - .../0000:00:09.0/usb3/3-1/bDeviceProtocol | 1 - .../0000:00:09.0/usb3/3-1/bDeviceSubClass | 1 - .../pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower | 1 - .../0000:00:09.0/usb3/3-1/bNumConfigurations | 1 - .../0000:00:09.0/usb3/3-1/bNumInterfaces | 1 - .../pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice | 1 - .../pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes | 1 - .../pci0000:00/0000:00:09.0/usb3/3-1/driver | 1 - .../pci0000:00/0000:00:09.0/usb3/3-1/idProduct | 1 - .../pci0000:00/0000:00:09.0/usb3/3-1/idVendor | 1 - .../pci0000:00/0000:00:09.0/usb3/3-1/power/state | 1 - .../devices/pci0000:00/0000:00:09.0/usb3/3-1/speed | 1 - .../pci0000:00/0000:00:09.0/usb3/3-1/subsystem | 1 - .../0000:00:09.0/usb3/3-1/ttyUSB0/driver | 1 - .../0000:00:09.0/usb3/3-1/ttyUSB0/power/state | 1 - .../0000:00:09.0/usb3/3-1/ttyUSB0/subsystem | 1 - .../0000:00:09.0/usb3/bConfigurationValue | 1 - .../pci0000:00/0000:00:09.0/usb3/bDeviceClass | 1 - .../pci0000:00/0000:00:09.0/usb3/bDeviceProtocol | 1 - .../pci0000:00/0000:00:09.0/usb3/bDeviceSubClass | 1 - .../devices/pci0000:00/0000:00:09.0/usb3/bMaxPower | 1 - .../0000:00:09.0/usb3/bNumConfigurations | 1 - .../pci0000:00/0000:00:09.0/usb3/bNumInterfaces | 1 - .../devices/pci0000:00/0000:00:09.0/usb3/bcdDevice | 1 - .../pci0000:00/0000:00:09.0/usb3/bmAttributes | 1 - .../devices/pci0000:00/0000:00:09.0/usb3/driver | 1 - .../devices/pci0000:00/0000:00:09.0/usb3/idProduct | 1 - .../devices/pci0000:00/0000:00:09.0/usb3/idVendor | 1 - .../pci0000:00/0000:00:09.0/usb3/manufacturer | 1 - .../pci0000:00/0000:00:09.0/usb3/power/state | 1 - .../devices/pci0000:00/0000:00:09.0/usb3/product | 1 - .../devices/pci0000:00/0000:00:09.0/usb3/serial | 1 - .../sys/devices/pci0000:00/0000:00:09.0/usb3/speed | 1 - .../devices/pci0000:00/0000:00:09.0/usb3/subsystem | 1 - test/sys/devices/pci0000:00/0000:00:09.0/vendor | 1 - .../pci0000:00/0000:00:1b.0/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1b.0/class | 1 + test/sys/devices/pci0000:00/0000:00:1b.0/config | Bin 0 -> 4096 bytes test/sys/devices/pci0000:00/0000:00:1b.0/device | 1 + test/sys/devices/pci0000:00/0000:00:1b.0/driver | 1 + test/sys/devices/pci0000:00/0000:00:1b.0/enable | 1 + .../devices/pci0000:00/0000:00:1b.0/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1b.0/irq | 1 + .../devices/pci0000:00/0000:00:1b.0/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1b.0/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1b.0/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1b.0/msi_bus | 0 .../devices/pci0000:00/0000:00:1b.0/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1b.0/resource | 7 + test/sys/devices/pci0000:00/0000:00:1b.0/resource0 | 0 .../pci0000:00/0000:00:1b.0/sound/card0/adsp/dev | 1 + .../0000:00:1b.0/sound/card0/adsp/device | 1 + .../0000:00:1b.0/sound/card0/adsp/power/wakeup | 1 + .../0000:00:1b.0/sound/card0/adsp/subsystem | 1 + .../0000:00:1b.0/sound/card0/adsp/uevent | 2 + .../pci0000:00/0000:00:1b.0/sound/card0/audio/dev | 1 + .../0000:00:1b.0/sound/card0/audio/device | 1 + .../0000:00:1b.0/sound/card0/audio/power/wakeup | 1 + .../0000:00:1b.0/sound/card0/audio/subsystem | 1 + .../0000:00:1b.0/sound/card0/audio/uevent | 2 + .../0000:00:1b.0/sound/card0/controlC0/dev | 1 + .../0000:00:1b.0/sound/card0/controlC0/device | 1 + .../sound/card0/controlC0/power/wakeup | 1 + .../0000:00:1b.0/sound/card0/controlC0/subsystem | 1 + .../0000:00:1b.0/sound/card0/controlC0/uevent | 2 + .../pci0000:00/0000:00:1b.0/sound/card0/device | 1 + .../pci0000:00/0000:00:1b.0/sound/card0/dsp/dev | 1 + .../pci0000:00/0000:00:1b.0/sound/card0/dsp/device | 1 + .../0000:00:1b.0/sound/card0/dsp/power/wakeup | 1 + .../0000:00:1b.0/sound/card0/dsp/subsystem | 1 + .../pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent | 2 + .../pci0000:00/0000:00:1b.0/sound/card0/mixer/dev | 1 + .../0000:00:1b.0/sound/card0/mixer/device | 1 + .../0000:00:1b.0/sound/card0/mixer/power/wakeup | 1 + .../0000:00:1b.0/sound/card0/mixer/subsystem | 1 + .../0000:00:1b.0/sound/card0/mixer/uevent | 2 + .../0000:00:1b.0/sound/card0/pcmC0D0c/dev | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0c/device | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0c/subsystem | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0c/uevent | 2 + .../0000:00:1b.0/sound/card0/pcmC0D0p/dev | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0p/device | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0p/subsystem | 1 + .../0000:00:1b.0/sound/card0/pcmC0D0p/uevent | 2 + .../0000:00:1b.0/sound/card0/pcmC0D1p/dev | 1 + .../0000:00:1b.0/sound/card0/pcmC0D1p/device | 1 + .../0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class | 1 + .../0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup | 1 + .../0000:00:1b.0/sound/card0/pcmC0D1p/subsystem | 1 + .../0000:00:1b.0/sound/card0/pcmC0D1p/uevent | 2 + .../0000:00:1b.0/sound/card0/power/wakeup | 1 + .../pci0000:00/0000:00:1b.0/sound/card0/subsystem | 1 + .../pci0000:00/0000:00:1b.0/sound/card0/uevent | 0 test/sys/devices/pci0000:00/0000:00:1b.0/subsystem | 1 + .../pci0000:00/0000:00:1b.0/subsystem_device | 1 + .../pci0000:00/0000:00:1b.0/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1b.0/uevent | 6 + test/sys/devices/pci0000:00/0000:00:1b.0/vendor | 1 + .../0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup | 1 + .../0000:00:1c.0/0000:00:1c.0:pcie00/subsystem | 1 + .../0000:00:1c.0/0000:00:1c.0:pcie00/uevent | 0 .../0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup | 1 + .../0000:00:1c.0/0000:00:1c.0:pcie02/subsystem | 1 + .../0000:00:1c.0/0000:00:1c.0:pcie02/uevent | 0 .../0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup | 1 + .../0000:00:1c.0/0000:00:1c.0:pcie03/subsystem | 1 + .../0000:00:1c.0/0000:00:1c.0:pcie03/uevent | 0 .../0000:00:1c.0/0000:02:00.0/broken_parity_status | 1 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/class | 1 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/config | Bin 0 -> 4096 bytes .../pci0000:00/0000:00:1c.0/0000:02:00.0/device | 1 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/driver | 1 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/enable | 1 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/irq | 1 + .../0000:00:1c.0/0000:02:00.0/local_cpulist | 1 + .../0000:00:1c.0/0000:02:00.0/local_cpus | 1 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/modalias | 1 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/msi_bus | 0 .../0000:00:1c.0/0000:02:00.0/net/eth0/addr_len | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/address | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/broadcast | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/carrier | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/dev_id | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/device | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/dormant | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/features | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/flags | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/ifindex | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/iflink | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/link_mode | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/mtu | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/operstate | 1 + .../0000:02:00.0/net/eth0/power/wakeup | 1 + .../0000:02:00.0/net/eth0/statistics/collisions | 1 + .../0000:02:00.0/net/eth0/statistics/multicast | 1 + .../0000:02:00.0/net/eth0/statistics/rx_bytes | 1 + .../0000:02:00.0/net/eth0/statistics/rx_compressed | 1 + .../0000:02:00.0/net/eth0/statistics/rx_crc_errors | 1 + .../0000:02:00.0/net/eth0/statistics/rx_dropped | 1 + .../0000:02:00.0/net/eth0/statistics/rx_errors | 1 + .../net/eth0/statistics/rx_fifo_errors | 1 + .../net/eth0/statistics/rx_frame_errors | 1 + .../net/eth0/statistics/rx_length_errors | 1 + .../net/eth0/statistics/rx_missed_errors | 1 + .../net/eth0/statistics/rx_over_errors | 1 + .../0000:02:00.0/net/eth0/statistics/rx_packets | 1 + .../net/eth0/statistics/tx_aborted_errors | 1 + .../0000:02:00.0/net/eth0/statistics/tx_bytes | 1 + .../net/eth0/statistics/tx_carrier_errors | 1 + .../0000:02:00.0/net/eth0/statistics/tx_compressed | 1 + .../0000:02:00.0/net/eth0/statistics/tx_dropped | 1 + .../0000:02:00.0/net/eth0/statistics/tx_errors | 1 + .../net/eth0/statistics/tx_fifo_errors | 1 + .../net/eth0/statistics/tx_heartbeat_errors | 1 + .../0000:02:00.0/net/eth0/statistics/tx_packets | 1 + .../net/eth0/statistics/tx_window_errors | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/subsystem | 1 + .../0000:02:00.0/net/eth0/tx_queue_len | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/type | 1 + .../0000:00:1c.0/0000:02:00.0/net/eth0/uevent | 2 + .../0000:00:1c.0/0000:02:00.0/power/wakeup | 1 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/resource | 7 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/resource0 | 0 .../pci0000:00/0000:00:1c.0/0000:02:00.0/resource2 | 0 .../pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem | 1 + .../0000:00:1c.0/0000:02:00.0/subsystem_device | 1 + .../0000:00:1c.0/0000:02:00.0/subsystem_vendor | 1 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/uevent | 6 + .../pci0000:00/0000:00:1c.0/0000:02:00.0/vendor | 1 + .../pci0000:00/0000:00:1c.0/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1c.0/class | 1 + test/sys/devices/pci0000:00/0000:00:1c.0/config | Bin 0 -> 4096 bytes test/sys/devices/pci0000:00/0000:00:1c.0/device | 1 + test/sys/devices/pci0000:00/0000:00:1c.0/driver | 1 + test/sys/devices/pci0000:00/0000:00:1c.0/enable | 1 + .../devices/pci0000:00/0000:00:1c.0/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1c.0/irq | 1 + .../devices/pci0000:00/0000:00:1c.0/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1c.0/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1c.0/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus | 1 + .../0000:00:1c.0/pci_bus/0000:02/cpuaffinity | 1 + .../pci0000:00/0000:00:1c.0/pci_bus/0000:02/device | 1 + .../0000:00:1c.0/pci_bus/0000:02/power/wakeup | 1 + .../0000:00:1c.0/pci_bus/0000:02/subsystem | 1 + .../pci0000:00/0000:00:1c.0/pci_bus/0000:02/uevent | 0 .../devices/pci0000:00/0000:00:1c.0/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1c.0/resource | 12 + test/sys/devices/pci0000:00/0000:00:1c.0/subsystem | 1 + .../pci0000:00/0000:00:1c.0/subsystem_device | 1 + .../pci0000:00/0000:00:1c.0/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1c.0/uevent | 6 + test/sys/devices/pci0000:00/0000:00:1c.0/vendor | 1 + .../0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup | 1 + .../0000:00:1c.1/0000:00:1c.1:pcie00/subsystem | 1 + .../0000:00:1c.1/0000:00:1c.1:pcie00/uevent | 0 .../0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup | 1 + .../0000:00:1c.1/0000:00:1c.1:pcie02/subsystem | 1 + .../0000:00:1c.1/0000:00:1c.1:pcie02/uevent | 0 .../0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup | 1 + .../0000:00:1c.1/0000:00:1c.1:pcie03/subsystem | 1 + .../0000:00:1c.1/0000:00:1c.1:pcie03/uevent | 0 .../pci0000:00/0000:00:1c.1/0000:03:00.0/antenna | 1 + .../0000:00:1c.1/0000:03:00.0/broken_parity_status | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/channels | 0 .../pci0000:00/0000:00:1c.1/0000:03:00.0/class | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/config | Bin 0 -> 4096 bytes .../pci0000:00/0000:00:1c.1/0000:03:00.0/device | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/driver | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/enable | 1 + .../0000:00:1c.1/0000:03:00.0/filter_flags | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/flags | 1 + .../0000:03:00.0/ieee80211/phy0/device | 1 + .../0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index | 1 + .../0000:03:00.0/ieee80211/phy0/macaddress | 1 + .../0000:03:00.0/ieee80211/phy0/power/wakeup | 1 + .../0000:03:00.0/ieee80211/phy0/subsystem | 1 + .../0000:03:00.0/ieee80211/phy0/uevent | 0 .../pci0000:00/0000:00:1c.1/0000:03:00.0/irq | 1 + .../0000:03:00.0/leds/iwl-phy0:RX/brightness | Bin 0 -> 3 bytes .../0000:03:00.0/leds/iwl-phy0:RX/device | 1 + .../0000:03:00.0/leds/iwl-phy0:RX/power/wakeup | 1 + .../0000:03:00.0/leds/iwl-phy0:RX/subsystem | 1 + .../0000:03:00.0/leds/iwl-phy0:RX/trigger | 1 + .../0000:03:00.0/leds/iwl-phy0:RX/uevent | 0 .../0000:03:00.0/leds/iwl-phy0:TX/brightness | Bin 0 -> 3 bytes .../0000:03:00.0/leds/iwl-phy0:TX/device | 1 + .../0000:03:00.0/leds/iwl-phy0:TX/power/wakeup | 1 + .../0000:03:00.0/leds/iwl-phy0:TX/subsystem | 1 + .../0000:03:00.0/leds/iwl-phy0:TX/trigger | 1 + .../0000:03:00.0/leds/iwl-phy0:TX/uevent | 0 .../0000:03:00.0/leds/iwl-phy0:assoc/brightness | Bin 0 -> 5 bytes .../0000:03:00.0/leds/iwl-phy0:assoc/device | 1 + .../0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup | 1 + .../0000:03:00.0/leds/iwl-phy0:assoc/subsystem | 1 + .../0000:03:00.0/leds/iwl-phy0:assoc/trigger | 1 + .../0000:03:00.0/leds/iwl-phy0:assoc/uevent | 0 .../0000:03:00.0/leds/iwl-phy0:radio/brightness | Bin 0 -> 5 bytes .../0000:03:00.0/leds/iwl-phy0:radio/device | 1 + .../0000:03:00.0/leds/iwl-phy0:radio/power/wakeup | 1 + .../0000:03:00.0/leds/iwl-phy0:radio/subsystem | 1 + .../0000:03:00.0/leds/iwl-phy0:radio/trigger | 1 + .../0000:03:00.0/leds/iwl-phy0:radio/uevent | 0 .../0000:00:1c.1/0000:03:00.0/local_cpulist | 1 + .../0000:00:1c.1/0000:03:00.0/local_cpus | 1 + .../0000:00:1c.1/0000:03:00.0/measurement | 0 .../pci0000:00/0000:00:1c.1/0000:03:00.0/modalias | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/msi_bus | 0 .../0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/address | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/carrier | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/device | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/dormant | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/features | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/flags | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/iflink | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/mtu | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/operstate | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 | 1 + .../0000:03:00.0/net/wlan0/power/wakeup | 1 + .../0000:03:00.0/net/wlan0/statistics/collisions | 1 + .../0000:03:00.0/net/wlan0/statistics/multicast | 1 + .../0000:03:00.0/net/wlan0/statistics/rx_bytes | 1 + .../net/wlan0/statistics/rx_compressed | 1 + .../net/wlan0/statistics/rx_crc_errors | 1 + .../0000:03:00.0/net/wlan0/statistics/rx_dropped | 1 + .../0000:03:00.0/net/wlan0/statistics/rx_errors | 1 + .../net/wlan0/statistics/rx_fifo_errors | 1 + .../net/wlan0/statistics/rx_frame_errors | 1 + .../net/wlan0/statistics/rx_length_errors | 1 + .../net/wlan0/statistics/rx_missed_errors | 1 + .../net/wlan0/statistics/rx_over_errors | 1 + .../0000:03:00.0/net/wlan0/statistics/rx_packets | 1 + .../net/wlan0/statistics/tx_aborted_errors | 1 + .../0000:03:00.0/net/wlan0/statistics/tx_bytes | 1 + .../net/wlan0/statistics/tx_carrier_errors | 1 + .../net/wlan0/statistics/tx_compressed | 1 + .../0000:03:00.0/net/wlan0/statistics/tx_dropped | 1 + .../0000:03:00.0/net/wlan0/statistics/tx_errors | 1 + .../net/wlan0/statistics/tx_fifo_errors | 1 + .../net/wlan0/statistics/tx_heartbeat_errors | 1 + .../0000:03:00.0/net/wlan0/statistics/tx_packets | 1 + .../net/wlan0/statistics/tx_window_errors | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem | 1 + .../0000:03:00.0/net/wlan0/tx_queue_len | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/type | 1 + .../0000:00:1c.1/0000:03:00.0/net/wlan0/uevent | 2 + .../0000:03:00.0/net/wlan0/wireless/beacon | 1 + .../0000:03:00.0/net/wlan0/wireless/crypt | 1 + .../0000:03:00.0/net/wlan0/wireless/fragment | 1 + .../0000:03:00.0/net/wlan0/wireless/level | 1 + .../0000:03:00.0/net/wlan0/wireless/link | 1 + .../0000:03:00.0/net/wlan0/wireless/misc | 1 + .../0000:03:00.0/net/wlan0/wireless/noise | 1 + .../0000:03:00.0/net/wlan0/wireless/nwid | 1 + .../0000:03:00.0/net/wlan0/wireless/retries | 1 + .../0000:03:00.0/net/wlan0/wireless/status | 1 + .../0000:03:00.0/net/wmaster0/addr_len | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/address | 1 + .../0000:03:00.0/net/wmaster0/broadcast | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/device | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant | 1 + .../0000:03:00.0/net/wmaster0/features | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/flags | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink | 1 + .../0000:03:00.0/net/wmaster0/link_mode | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu | 1 + .../0000:03:00.0/net/wmaster0/operstate | 1 + .../0000:03:00.0/net/wmaster0/phy80211 | 1 + .../0000:03:00.0/net/wmaster0/power/wakeup | 1 + .../net/wmaster0/statistics/collisions | 1 + .../0000:03:00.0/net/wmaster0/statistics/multicast | 1 + .../0000:03:00.0/net/wmaster0/statistics/rx_bytes | 1 + .../net/wmaster0/statistics/rx_compressed | 1 + .../net/wmaster0/statistics/rx_crc_errors | 1 + .../net/wmaster0/statistics/rx_dropped | 1 + .../0000:03:00.0/net/wmaster0/statistics/rx_errors | 1 + .../net/wmaster0/statistics/rx_fifo_errors | 1 + .../net/wmaster0/statistics/rx_frame_errors | 1 + .../net/wmaster0/statistics/rx_length_errors | 1 + .../net/wmaster0/statistics/rx_missed_errors | 1 + .../net/wmaster0/statistics/rx_over_errors | 1 + .../net/wmaster0/statistics/rx_packets | 1 + .../net/wmaster0/statistics/tx_aborted_errors | 1 + .../0000:03:00.0/net/wmaster0/statistics/tx_bytes | 1 + .../net/wmaster0/statistics/tx_carrier_errors | 1 + .../net/wmaster0/statistics/tx_compressed | 1 + .../net/wmaster0/statistics/tx_dropped | 1 + .../0000:03:00.0/net/wmaster0/statistics/tx_errors | 1 + .../net/wmaster0/statistics/tx_fifo_errors | 1 + .../net/wmaster0/statistics/tx_heartbeat_errors | 1 + .../net/wmaster0/statistics/tx_packets | 1 + .../net/wmaster0/statistics/tx_window_errors | 1 + .../0000:03:00.0/net/wmaster0/subsystem | 1 + .../0000:03:00.0/net/wmaster0/tx_queue_len | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/type | 1 + .../0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent | 2 + .../0000:00:1c.1/0000:03:00.0/power/wakeup | 1 + .../0000:00:1c.1/0000:03:00.0/power_level | Bin 0 -> 12 bytes .../pci0000:00/0000:00:1c.1/0000:03:00.0/resource | 7 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/resource0 | 0 .../0000:00:1c.1/0000:03:00.0/retry_rate | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window | 15 + .../0000:00:1c.1/0000:03:00.0/statistics | 15 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/status | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem | 1 + .../0000:00:1c.1/0000:03:00.0/subsystem_device | 1 + .../0000:00:1c.1/0000:03:00.0/subsystem_vendor | 1 + .../0000:00:1c.1/0000:03:00.0/temperature | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power | 1 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/uevent | 6 + .../pci0000:00/0000:00:1c.1/0000:03:00.0/vendor | 1 + .../pci0000:00/0000:00:1c.1/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1c.1/class | 1 + test/sys/devices/pci0000:00/0000:00:1c.1/config | Bin 0 -> 4096 bytes test/sys/devices/pci0000:00/0000:00:1c.1/device | 1 + test/sys/devices/pci0000:00/0000:00:1c.1/driver | 1 + test/sys/devices/pci0000:00/0000:00:1c.1/enable | 1 + .../devices/pci0000:00/0000:00:1c.1/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1c.1/irq | 1 + .../devices/pci0000:00/0000:00:1c.1/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1c.1/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1c.1/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus | 1 + .../0000:00:1c.1/pci_bus/0000:03/cpuaffinity | 1 + .../pci0000:00/0000:00:1c.1/pci_bus/0000:03/device | 1 + .../0000:00:1c.1/pci_bus/0000:03/power/wakeup | 1 + .../0000:00:1c.1/pci_bus/0000:03/subsystem | 1 + .../pci0000:00/0000:00:1c.1/pci_bus/0000:03/uevent | 0 .../devices/pci0000:00/0000:00:1c.1/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1c.1/resource | 12 + test/sys/devices/pci0000:00/0000:00:1c.1/subsystem | 1 + .../pci0000:00/0000:00:1c.1/subsystem_device | 1 + .../pci0000:00/0000:00:1c.1/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1c.1/uevent | 6 + test/sys/devices/pci0000:00/0000:00:1c.1/vendor | 1 + .../0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup | 1 + .../0000:00:1c.2/0000:00:1c.2:pcie00/subsystem | 1 + .../0000:00:1c.2/0000:00:1c.2:pcie00/uevent | 0 .../0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup | 1 + .../0000:00:1c.2/0000:00:1c.2:pcie02/subsystem | 1 + .../0000:00:1c.2/0000:00:1c.2:pcie02/uevent | 0 .../0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup | 1 + .../0000:00:1c.2/0000:00:1c.2:pcie03/subsystem | 1 + .../0000:00:1c.2/0000:00:1c.2:pcie03/uevent | 0 .../pci0000:00/0000:00:1c.2/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1c.2/class | 1 + test/sys/devices/pci0000:00/0000:00:1c.2/config | Bin 0 -> 4096 bytes test/sys/devices/pci0000:00/0000:00:1c.2/device | 1 + test/sys/devices/pci0000:00/0000:00:1c.2/driver | 1 + test/sys/devices/pci0000:00/0000:00:1c.2/enable | 1 + .../devices/pci0000:00/0000:00:1c.2/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1c.2/irq | 1 + .../devices/pci0000:00/0000:00:1c.2/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1c.2/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1c.2/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus | 1 + .../0000:00:1c.2/pci_bus/0000:04/cpuaffinity | 1 + .../pci0000:00/0000:00:1c.2/pci_bus/0000:04/device | 1 + .../0000:00:1c.2/pci_bus/0000:04/power/wakeup | 1 + .../0000:00:1c.2/pci_bus/0000:04/subsystem | 1 + .../pci0000:00/0000:00:1c.2/pci_bus/0000:04/uevent | 0 .../devices/pci0000:00/0000:00:1c.2/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1c.2/resource | 12 + test/sys/devices/pci0000:00/0000:00:1c.2/subsystem | 1 + .../pci0000:00/0000:00:1c.2/subsystem_device | 1 + .../pci0000:00/0000:00:1c.2/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1c.2/uevent | 6 + test/sys/devices/pci0000:00/0000:00:1c.2/vendor | 1 + .../0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup | 1 + .../0000:00:1c.3/0000:00:1c.3:pcie00/subsystem | 1 + .../0000:00:1c.3/0000:00:1c.3:pcie00/uevent | 0 .../0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup | 1 + .../0000:00:1c.3/0000:00:1c.3:pcie02/subsystem | 1 + .../0000:00:1c.3/0000:00:1c.3:pcie02/uevent | 0 .../0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup | 1 + .../0000:00:1c.3/0000:00:1c.3:pcie03/subsystem | 1 + .../0000:00:1c.3/0000:00:1c.3:pcie03/uevent | 0 .../pci0000:00/0000:00:1c.3/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1c.3/class | 1 + test/sys/devices/pci0000:00/0000:00:1c.3/config | Bin 0 -> 4096 bytes test/sys/devices/pci0000:00/0000:00:1c.3/device | 1 + test/sys/devices/pci0000:00/0000:00:1c.3/driver | 1 + test/sys/devices/pci0000:00/0000:00:1c.3/enable | 1 + .../devices/pci0000:00/0000:00:1c.3/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1c.3/irq | 1 + .../devices/pci0000:00/0000:00:1c.3/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1c.3/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1c.3/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus | 1 + .../0000:00:1c.3/pci_bus/0000:0c/cpuaffinity | 1 + .../pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device | 1 + .../0000:00:1c.3/pci_bus/0000:0c/power/wakeup | 1 + .../0000:00:1c.3/pci_bus/0000:0c/subsystem | 1 + .../pci0000:00/0000:00:1c.3/pci_bus/0000:0c/uevent | 0 .../devices/pci0000:00/0000:00:1c.3/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1c.3/resource | 12 + test/sys/devices/pci0000:00/0000:00:1c.3/subsystem | 1 + .../pci0000:00/0000:00:1c.3/subsystem_device | 1 + .../pci0000:00/0000:00:1c.3/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1c.3/uevent | 6 + test/sys/devices/pci0000:00/0000:00:1c.3/vendor | 1 + .../pci0000:00/0000:00:1d.0/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1d.0/class | 1 + test/sys/devices/pci0000:00/0000:00:1d.0/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1d.0/device | 1 + test/sys/devices/pci0000:00/0000:00:1d.0/driver | 1 + test/sys/devices/pci0000:00/0000:00:1d.0/enable | 1 + .../devices/pci0000:00/0000:00:1d.0/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1d.0/irq | 1 + .../devices/pci0000:00/0000:00:1d.0/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1d.0/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1d.0/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1d.0/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.0/pools | 7 + .../devices/pci0000:00/0000:00:1d.0/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1d.0/resource | 7 + test/sys/devices/pci0000:00/0000:00:1d.0/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1d.0/subsystem | 1 + .../pci0000:00/0000:00:1d.0/subsystem_device | 1 + .../pci0000:00/0000:00:1d.0/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1d.0/uevent | 6 + .../0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting | 1 + .../0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass | 1 + .../0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber | 1 + .../0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol | 1 + .../0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver | 1 + .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 | 1 + .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias | 1 + .../0000:00:1d.0/usb1/1-0:1.0/power/wakeup | 1 + .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem | 1 + .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent | 6 + .../usb_endpoint/usbdev1.1_ep81/bEndpointAddress | 1 + .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval | 1 + .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength | 1 + .../usb_endpoint/usbdev1.1_ep81/bmAttributes | 1 + .../usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev | 1 + .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/device | 1 + .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction | 1 + .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval | 1 + .../usb_endpoint/usbdev1.1_ep81/power/wakeup | 1 + .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem | 1 + .../usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type | 1 + .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent | 2 + .../usb_endpoint/usbdev1.1_ep81/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.0/usb1/authorized | 1 + .../0000:00:1d.0/usb1/authorized_default | 1 + .../0000:00:1d.0/usb1/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.0/usb1/bDeviceClass | 1 + .../pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol | 1 + .../pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass | 1 + .../pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower | 1 + .../0000:00:1d.0/usb1/bNumConfigurations | 1 + .../pci0000:00/0000:00:1d.0/usb1/bNumInterfaces | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice | 1 + .../pci0000:00/0000:00:1d.0/usb1/bmAttributes | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/busnum | 1 + .../pci0000:00/0000:00:1d.0/usb1/configuration | 0 .../pci0000:00/0000:00:1d.0/usb1/descriptors | Bin 0 -> 43 bytes test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/devnum | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/driver | 1 + .../sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/idProduct | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/idVendor | 1 + .../pci0000:00/0000:00:1d.0/usb1/manufacturer | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/maxchild | 1 + .../0000:00:1d.0/usb1/power/active_duration | 1 + .../pci0000:00/0000:00:1d.0/usb1/power/autosuspend | 1 + .../0000:00:1d.0/usb1/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.0/usb1/power/level | 1 + .../pci0000:00/0000:00:1d.0/usb1/power/wakeup | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/product | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/quirks | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/serial | 1 + .../sys/devices/pci0000:00/0000:00:1d.0/usb1/speed | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/subsystem | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/uevent | 8 + .../devices/pci0000:00/0000:00:1d.0/usb1/urbnum | 1 + .../usb_endpoint/usbdev1.1_ep00/bEndpointAddress | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/bInterval | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/bLength | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/dev | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/device | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/direction | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/interval | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/subsystem | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/type | 1 + .../usb1/usb_endpoint/usbdev1.1_ep00/uevent | 2 + .../usb_endpoint/usbdev1.1_ep00/wMaxPacketSize | 1 + .../devices/pci0000:00/0000:00:1d.0/usb1/version | 1 + .../0000:00:1d.0/usb_host/usb_host1/device | 1 + .../0000:00:1d.0/usb_host/usb_host1/power/wakeup | 1 + .../0000:00:1d.0/usb_host/usb_host1/subsystem | 1 + .../0000:00:1d.0/usb_host/usb_host1/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.0/vendor | 1 + .../pci0000:00/0000:00:1d.1/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1d.1/class | 1 + test/sys/devices/pci0000:00/0000:00:1d.1/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1d.1/device | 1 + test/sys/devices/pci0000:00/0000:00:1d.1/driver | 1 + test/sys/devices/pci0000:00/0000:00:1d.1/enable | 1 + .../devices/pci0000:00/0000:00:1d.1/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1d.1/irq | 1 + .../devices/pci0000:00/0000:00:1d.1/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1d.1/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1d.1/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1d.1/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.1/pools | 7 + .../devices/pci0000:00/0000:00:1d.1/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1d.1/resource | 7 + test/sys/devices/pci0000:00/0000:00:1d.1/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1d.1/subsystem | 1 + .../pci0000:00/0000:00:1d.1/subsystem_device | 1 + .../pci0000:00/0000:00:1d.1/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1d.1/uevent | 6 + .../0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting | 1 + .../0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass | 1 + .../0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber | 1 + .../0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol | 1 + .../0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver | 1 + .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 | 1 + .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias | 1 + .../0000:00:1d.1/usb2/2-0:1.0/power/wakeup | 1 + .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem | 1 + .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent | 6 + .../usb_endpoint/usbdev2.1_ep81/bEndpointAddress | 1 + .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval | 1 + .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength | 1 + .../usb_endpoint/usbdev2.1_ep81/bmAttributes | 1 + .../usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev | 1 + .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/device | 1 + .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction | 1 + .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval | 1 + .../usb_endpoint/usbdev2.1_ep81/power/wakeup | 1 + .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem | 1 + .../usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type | 1 + .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent | 2 + .../usb_endpoint/usbdev2.1_ep81/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.1/usb2/authorized | 1 + .../0000:00:1d.1/usb2/authorized_default | 1 + .../0000:00:1d.1/usb2/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.1/usb2/bDeviceClass | 1 + .../pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol | 1 + .../pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass | 1 + .../pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower | 1 + .../0000:00:1d.1/usb2/bNumConfigurations | 1 + .../pci0000:00/0000:00:1d.1/usb2/bNumInterfaces | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice | 1 + .../pci0000:00/0000:00:1d.1/usb2/bmAttributes | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/busnum | 1 + .../pci0000:00/0000:00:1d.1/usb2/configuration | 0 .../pci0000:00/0000:00:1d.1/usb2/descriptors | Bin 0 -> 43 bytes test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/devnum | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/driver | 1 + .../sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/idProduct | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/idVendor | 1 + .../pci0000:00/0000:00:1d.1/usb2/manufacturer | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/maxchild | 1 + .../0000:00:1d.1/usb2/power/active_duration | 1 + .../pci0000:00/0000:00:1d.1/usb2/power/autosuspend | 1 + .../0000:00:1d.1/usb2/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.1/usb2/power/level | 1 + .../pci0000:00/0000:00:1d.1/usb2/power/wakeup | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/product | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/quirks | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/serial | 1 + .../sys/devices/pci0000:00/0000:00:1d.1/usb2/speed | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/subsystem | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/uevent | 8 + .../devices/pci0000:00/0000:00:1d.1/usb2/urbnum | 1 + .../usb_endpoint/usbdev2.1_ep00/bEndpointAddress | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/bInterval | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/bLength | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/dev | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/device | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/direction | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/interval | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/subsystem | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/type | 1 + .../usb2/usb_endpoint/usbdev2.1_ep00/uevent | 2 + .../usb_endpoint/usbdev2.1_ep00/wMaxPacketSize | 1 + .../devices/pci0000:00/0000:00:1d.1/usb2/version | 1 + .../0000:00:1d.1/usb_host/usb_host2/device | 1 + .../0000:00:1d.1/usb_host/usb_host2/power/wakeup | 1 + .../0000:00:1d.1/usb_host/usb_host2/subsystem | 1 + .../0000:00:1d.1/usb_host/usb_host2/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.1/vendor | 1 + .../pci0000:00/0000:00:1d.2/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1d.2/class | 1 + test/sys/devices/pci0000:00/0000:00:1d.2/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1d.2/device | 1 + test/sys/devices/pci0000:00/0000:00:1d.2/driver | 1 + test/sys/devices/pci0000:00/0000:00:1d.2/enable | 1 + .../devices/pci0000:00/0000:00:1d.2/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1d.2/irq | 1 + .../devices/pci0000:00/0000:00:1d.2/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1d.2/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1d.2/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1d.2/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.2/pools | 7 + .../devices/pci0000:00/0000:00:1d.2/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1d.2/resource | 7 + test/sys/devices/pci0000:00/0000:00:1d.2/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1d.2/subsystem | 1 + .../pci0000:00/0000:00:1d.2/subsystem_device | 1 + .../pci0000:00/0000:00:1d.2/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1d.2/uevent | 6 + .../0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting | 1 + .../0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass | 1 + .../0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber | 1 + .../0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol | 1 + .../0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias | 1 + .../0000:00:1d.2/usb3/3-0:1.0/power/wakeup | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent | 6 + .../usb_endpoint/usbdev3.1_ep81/bEndpointAddress | 1 + .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval | 1 + .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength | 1 + .../usb_endpoint/usbdev3.1_ep81/bmAttributes | 1 + .../usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev | 1 + .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/device | 1 + .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction | 1 + .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval | 1 + .../usb_endpoint/usbdev3.1_ep81/power/wakeup | 1 + .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem | 1 + .../usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type | 1 + .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent | 2 + .../usb_endpoint/usbdev3.1_ep81/wMaxPacketSize | 1 + .../usb3/3-1/3-1:1.0/bAlternateSetting | 1 + .../0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass | 1 + .../0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber | 1 + .../usb3/3-1/3-1:1.0/bInterfaceProtocol | 1 + .../usb3/3-1/3-1:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints | 1 + .../0000:00:1d.2/usb3/3-1/3-1:1.0/driver | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 | 1 + .../usb3/3-1/3-1:1.0/input/input7/capabilities/abs | 1 + .../usb3/3-1/3-1:1.0/input/input7/capabilities/ev | 1 + .../usb3/3-1/3-1:1.0/input/input7/capabilities/ff | 1 + .../usb3/3-1/3-1:1.0/input/input7/capabilities/key | 1 + .../usb3/3-1/3-1:1.0/input/input7/capabilities/led | 1 + .../usb3/3-1/3-1:1.0/input/input7/capabilities/msc | 1 + .../usb3/3-1/3-1:1.0/input/input7/capabilities/rel | 1 + .../usb3/3-1/3-1:1.0/input/input7/capabilities/snd | 1 + .../usb3/3-1/3-1:1.0/input/input7/capabilities/sw | 1 + .../usb3/3-1/3-1:1.0/input/input7/device | 1 + .../usb3/3-1/3-1:1.0/input/input7/event7/dev | 1 + .../usb3/3-1/3-1:1.0/input/input7/event7/device | 1 + .../3-1/3-1:1.0/input/input7/event7/power/wakeup | 1 + .../usb3/3-1/3-1:1.0/input/input7/event7/subsystem | 1 + .../usb3/3-1/3-1:1.0/input/input7/event7/uevent | 2 + .../usb3/3-1/3-1:1.0/input/input7/id/bustype | 1 + .../usb3/3-1/3-1:1.0/input/input7/id/product | 1 + .../usb3/3-1/3-1:1.0/input/input7/id/vendor | 1 + .../usb3/3-1/3-1:1.0/input/input7/id/version | 1 + .../usb3/3-1/3-1:1.0/input/input7/modalias | 1 + .../usb3/3-1/3-1:1.0/input/input7/mouse1/dev | 1 + .../usb3/3-1/3-1:1.0/input/input7/mouse1/device | 1 + .../3-1/3-1:1.0/input/input7/mouse1/power/wakeup | 1 + .../usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem | 1 + .../usb3/3-1/3-1:1.0/input/input7/mouse1/uevent | 2 + .../usb3/3-1/3-1:1.0/input/input7/name | 1 + .../usb3/3-1/3-1:1.0/input/input7/phys | 1 + .../usb3/3-1/3-1:1.0/input/input7/power/wakeup | 1 + .../usb3/3-1/3-1:1.0/input/input7/subsystem | 1 + .../usb3/3-1/3-1:1.0/input/input7/uevent | 9 + .../usb3/3-1/3-1:1.0/input/input7/uniq | 1 + .../0000:00:1d.2/usb3/3-1/3-1:1.0/modalias | 1 + .../0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup | 1 + .../0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem | 1 + .../0000:00:1d.2/usb3/3-1/3-1:1.0/uevent | 6 + .../usb_endpoint/usbdev3.3_ep81/bEndpointAddress | 1 + .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval | 1 + .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength | 1 + .../usb_endpoint/usbdev3.3_ep81/bmAttributes | 1 + .../3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev | 1 + .../3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device | 1 + .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction | 1 + .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval | 1 + .../usb_endpoint/usbdev3.3_ep81/power/wakeup | 1 + .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem | 1 + .../3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type | 1 + .../3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent | 2 + .../usb_endpoint/usbdev3.3_ep81/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/authorized | 1 + .../0000:00:1d.2/usb3/3-1/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass | 1 + .../0000:00:1d.2/usb3/3-1/bDeviceProtocol | 1 + .../0000:00:1d.2/usb3/3-1/bDeviceSubClass | 1 + .../0000:00:1d.2/usb3/3-1/bMaxPacketSize0 | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower | 1 + .../0000:00:1d.2/usb3/3-1/bNumConfigurations | 1 + .../0000:00:1d.2/usb3/3-1/bNumInterfaces | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/busnum | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/configuration | 0 .../pci0000:00/0000:00:1d.2/usb3/3-1/descriptors | Bin 0 -> 52 bytes .../devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/devnum | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/driver | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/idProduct | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/idVendor | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/maxchild | 1 + .../0000:00:1d.2/usb3/3-1/power/active_duration | 1 + .../0000:00:1d.2/usb3/3-1/power/autosuspend | 1 + .../0000:00:1d.2/usb3/3-1/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/power/level | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/power/persist | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/product | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/quirks | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/subsystem | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/uevent | 8 + .../pci0000:00/0000:00:1d.2/usb3/3-1/urbnum | 1 + .../usb_endpoint/usbdev3.3_ep00/bEndpointAddress | 1 + .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval | 1 + .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength | 1 + .../3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes | 1 + .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev | 1 + .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/device | 1 + .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction | 1 + .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval | 1 + .../3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup | 1 + .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem | 1 + .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/type | 1 + .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent | 2 + .../3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.2/usb3/3-1/version | 1 + .../pci0000:00/0000:00:1d.2/usb3/authorized | 1 + .../0000:00:1d.2/usb3/authorized_default | 1 + .../0000:00:1d.2/usb3/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.2/usb3/bDeviceClass | 1 + .../pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol | 1 + .../pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass | 1 + .../pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower | 1 + .../0000:00:1d.2/usb3/bNumConfigurations | 1 + .../pci0000:00/0000:00:1d.2/usb3/bNumInterfaces | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice | 1 + .../pci0000:00/0000:00:1d.2/usb3/bmAttributes | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/busnum | 1 + .../pci0000:00/0000:00:1d.2/usb3/configuration | 0 .../pci0000:00/0000:00:1d.2/usb3/descriptors | Bin 0 -> 43 bytes test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/devnum | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/driver | 1 + .../sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/idProduct | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/idVendor | 1 + .../pci0000:00/0000:00:1d.2/usb3/manufacturer | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/maxchild | 1 + .../0000:00:1d.2/usb3/power/active_duration | 1 + .../pci0000:00/0000:00:1d.2/usb3/power/autosuspend | 1 + .../0000:00:1d.2/usb3/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.2/usb3/power/level | 1 + .../pci0000:00/0000:00:1d.2/usb3/power/wakeup | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/product | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/quirks | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/serial | 1 + .../sys/devices/pci0000:00/0000:00:1d.2/usb3/speed | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/subsystem | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/uevent | 8 + .../devices/pci0000:00/0000:00:1d.2/usb3/urbnum | 1 + .../usb_endpoint/usbdev3.1_ep00/bEndpointAddress | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/bInterval | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/bLength | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/dev | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/device | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/direction | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/interval | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/subsystem | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/type | 1 + .../usb3/usb_endpoint/usbdev3.1_ep00/uevent | 2 + .../usb_endpoint/usbdev3.1_ep00/wMaxPacketSize | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/version | 1 + .../0000:00:1d.2/usb_host/usb_host3/device | 1 + .../0000:00:1d.2/usb_host/usb_host3/power/wakeup | 1 + .../0000:00:1d.2/usb_host/usb_host3/subsystem | 1 + .../0000:00:1d.2/usb_host/usb_host3/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.2/vendor | 1 + .../pci0000:00/0000:00:1d.3/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1d.3/class | 1 + test/sys/devices/pci0000:00/0000:00:1d.3/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1d.3/device | 1 + test/sys/devices/pci0000:00/0000:00:1d.3/driver | 1 + test/sys/devices/pci0000:00/0000:00:1d.3/enable | 1 + .../devices/pci0000:00/0000:00:1d.3/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1d.3/irq | 1 + .../devices/pci0000:00/0000:00:1d.3/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1d.3/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1d.3/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1d.3/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.3/pools | 7 + .../devices/pci0000:00/0000:00:1d.3/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1d.3/resource | 7 + test/sys/devices/pci0000:00/0000:00:1d.3/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1d.3/subsystem | 1 + .../pci0000:00/0000:00:1d.3/subsystem_device | 1 + .../pci0000:00/0000:00:1d.3/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1d.3/uevent | 6 + .../0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting | 1 + .../0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass | 1 + .../0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber | 1 + .../0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol | 1 + .../0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias | 1 + .../0000:00:1d.3/usb4/4-0:1.0/power/wakeup | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent | 6 + .../usb_endpoint/usbdev4.1_ep81/bEndpointAddress | 1 + .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval | 1 + .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength | 1 + .../usb_endpoint/usbdev4.1_ep81/bmAttributes | 1 + .../usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev | 1 + .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/device | 1 + .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction | 1 + .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval | 1 + .../usb_endpoint/usbdev4.1_ep81/power/wakeup | 1 + .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem | 1 + .../usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type | 1 + .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent | 2 + .../usb_endpoint/usbdev4.1_ep81/wMaxPacketSize | 1 + .../usb4/4-1/4-1:1.0/bAlternateSetting | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber | 1 + .../usb4/4-1/4-1:1.0/bInterfaceProtocol | 1 + .../usb4/4-1/4-1:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.0/modalias | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.0/uevent | 5 + .../usb_endpoint/usbdev4.2_ep02/bEndpointAddress | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength | 1 + .../usb_endpoint/usbdev4.2_ep02/bmAttributes | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval | 1 + .../usb_endpoint/usbdev4.2_ep02/power/wakeup | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent | 2 + .../usb_endpoint/usbdev4.2_ep02/wMaxPacketSize | 1 + .../usb_endpoint/usbdev4.2_ep81/bEndpointAddress | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength | 1 + .../usb_endpoint/usbdev4.2_ep81/bmAttributes | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval | 1 + .../usb_endpoint/usbdev4.2_ep81/power/wakeup | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent | 2 + .../usb_endpoint/usbdev4.2_ep81/wMaxPacketSize | 1 + .../usb_endpoint/usbdev4.2_ep82/bEndpointAddress | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength | 1 + .../usb_endpoint/usbdev4.2_ep82/bmAttributes | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval | 1 + .../usb_endpoint/usbdev4.2_ep82/power/wakeup | 1 + .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type | 1 + .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent | 2 + .../usb_endpoint/usbdev4.2_ep82/wMaxPacketSize | 1 + .../usb4/4-1/4-1:1.1/bAlternateSetting | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber | 1 + .../usb4/4-1/4-1:1.1/bInterfaceProtocol | 1 + .../usb4/4-1/4-1:1.1/bInterfaceSubClass | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.1/modalias | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.1/uevent | 5 + .../usb_endpoint/usbdev4.2_ep03/bEndpointAddress | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength | 1 + .../usb_endpoint/usbdev4.2_ep03/bmAttributes | 1 + .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev | 1 + .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval | 1 + .../usb_endpoint/usbdev4.2_ep03/power/wakeup | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem | 1 + .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type | 1 + .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent | 2 + .../usb_endpoint/usbdev4.2_ep03/wMaxPacketSize | 1 + .../usb_endpoint/usbdev4.2_ep83/bEndpointAddress | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength | 1 + .../usb_endpoint/usbdev4.2_ep83/bmAttributes | 1 + .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev | 1 + .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval | 1 + .../usb_endpoint/usbdev4.2_ep83/power/wakeup | 1 + .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem | 1 + .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type | 1 + .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent | 2 + .../usb_endpoint/usbdev4.2_ep83/wMaxPacketSize | 1 + .../usb4/4-1/4-1:1.2/bAlternateSetting | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber | 1 + .../usb4/4-1/4-1:1.2/bInterfaceProtocol | 1 + .../usb4/4-1/4-1:1.2/bInterfaceSubClass | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.2/modalias | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.2/uevent | 5 + .../usb_endpoint/usbdev4.2_ep04/bEndpointAddress | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength | 1 + .../usb_endpoint/usbdev4.2_ep04/bmAttributes | 1 + .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev | 1 + .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval | 1 + .../usb_endpoint/usbdev4.2_ep04/power/wakeup | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem | 1 + .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type | 1 + .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent | 2 + .../usb_endpoint/usbdev4.2_ep04/wMaxPacketSize | 1 + .../usb_endpoint/usbdev4.2_ep84/bEndpointAddress | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength | 1 + .../usb_endpoint/usbdev4.2_ep84/bmAttributes | 1 + .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev | 1 + .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval | 1 + .../usb_endpoint/usbdev4.2_ep84/power/wakeup | 1 + .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem | 1 + .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type | 1 + .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent | 2 + .../usb_endpoint/usbdev4.2_ep84/wMaxPacketSize | 1 + .../usb4/4-1/4-1:1.3/bAlternateSetting | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber | 1 + .../usb4/4-1/4-1:1.3/bInterfaceProtocol | 1 + .../usb4/4-1/4-1:1.3/bInterfaceSubClass | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.3/modalias | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem | 1 + .../0000:00:1d.3/usb4/4-1/4-1:1.3/uevent | 5 + .../pci0000:00/0000:00:1d.3/usb4/4-1/authorized | 1 + .../0000:00:1d.3/usb4/4-1/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass | 1 + .../0000:00:1d.3/usb4/4-1/bDeviceProtocol | 1 + .../0000:00:1d.3/usb4/4-1/bDeviceSubClass | 1 + .../0000:00:1d.3/usb4/4-1/bMaxPacketSize0 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower | 1 + .../0000:00:1d.3/usb4/4-1/bNumConfigurations | 1 + .../0000:00:1d.3/usb4/4-1/bNumInterfaces | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/busnum | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/configuration | 0 .../pci0000:00/0000:00:1d.3/usb4/4-1/descriptors | Bin 0 -> 234 bytes .../devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/devnum | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/driver | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/idProduct | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/idVendor | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/maxchild | 1 + .../0000:00:1d.3/usb4/4-1/power/active_duration | 1 + .../0000:00:1d.3/usb4/4-1/power/autosuspend | 1 + .../0000:00:1d.3/usb4/4-1/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/power/level | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/power/persist | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/product | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/quirks | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/subsystem | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/uevent | 8 + .../pci0000:00/0000:00:1d.3/usb4/4-1/urbnum | 1 + .../usb_endpoint/usbdev4.2_ep00/bEndpointAddress | 1 + .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval | 1 + .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength | 1 + .../4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes | 1 + .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev | 1 + .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/device | 1 + .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction | 1 + .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval | 1 + .../4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup | 1 + .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem | 1 + .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/type | 1 + .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent | 2 + .../4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-1/version | 1 + .../usb4/4-2/4-2:1.0/bAlternateSetting | 1 + .../0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass | 1 + .../0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber | 1 + .../usb4/4-2/4-2:1.0/bInterfaceProtocol | 1 + .../usb4/4-2/4-2:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 | 1 + .../0000:00:1d.3/usb4/4-2/4-2:1.0/modalias | 1 + .../0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup | 1 + .../0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem | 1 + .../0000:00:1d.3/usb4/4-2/4-2:1.0/uevent | 5 + .../usb_endpoint/usbdev4.3_ep02/bEndpointAddress | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength | 1 + .../usb_endpoint/usbdev4.3_ep02/bmAttributes | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval | 1 + .../usb_endpoint/usbdev4.3_ep02/power/wakeup | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent | 2 + .../usb_endpoint/usbdev4.3_ep02/wMaxPacketSize | 1 + .../usb_endpoint/usbdev4.3_ep81/bEndpointAddress | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength | 1 + .../usb_endpoint/usbdev4.3_ep81/bmAttributes | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval | 1 + .../usb_endpoint/usbdev4.3_ep81/power/wakeup | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent | 2 + .../usb_endpoint/usbdev4.3_ep81/wMaxPacketSize | 1 + .../usb_endpoint/usbdev4.3_ep83/bEndpointAddress | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength | 1 + .../usb_endpoint/usbdev4.3_ep83/bmAttributes | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval | 1 + .../usb_endpoint/usbdev4.3_ep83/power/wakeup | 1 + .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type | 1 + .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent | 2 + .../usb_endpoint/usbdev4.3_ep83/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/authorized | 1 + .../0000:00:1d.3/usb4/4-2/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass | 1 + .../0000:00:1d.3/usb4/4-2/bDeviceProtocol | 1 + .../0000:00:1d.3/usb4/4-2/bDeviceSubClass | 1 + .../0000:00:1d.3/usb4/4-2/bMaxPacketSize0 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower | 1 + .../0000:00:1d.3/usb4/4-2/bNumConfigurations | 1 + .../0000:00:1d.3/usb4/4-2/bNumInterfaces | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/busnum | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/configuration | 0 .../pci0000:00/0000:00:1d.3/usb4/4-2/descriptors | Bin 0 -> 57 bytes .../devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/devnum | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/driver | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/idProduct | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/idVendor | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/maxchild | 1 + .../0000:00:1d.3/usb4/4-2/power/active_duration | 1 + .../0000:00:1d.3/usb4/4-2/power/autosuspend | 1 + .../0000:00:1d.3/usb4/4-2/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/power/level | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/power/persist | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/product | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/quirks | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/subsystem | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/uevent | 8 + .../pci0000:00/0000:00:1d.3/usb4/4-2/urbnum | 1 + .../usb_endpoint/usbdev4.3_ep00/bEndpointAddress | 1 + .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval | 1 + .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength | 1 + .../4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes | 1 + .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev | 1 + .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/device | 1 + .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction | 1 + .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval | 1 + .../4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup | 1 + .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem | 1 + .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/type | 1 + .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent | 2 + .../4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.3/usb4/4-2/version | 1 + .../pci0000:00/0000:00:1d.3/usb4/authorized | 1 + .../0000:00:1d.3/usb4/authorized_default | 1 + .../0000:00:1d.3/usb4/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.3/usb4/bDeviceClass | 1 + .../pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol | 1 + .../pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass | 1 + .../pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower | 1 + .../0000:00:1d.3/usb4/bNumConfigurations | 1 + .../pci0000:00/0000:00:1d.3/usb4/bNumInterfaces | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice | 1 + .../pci0000:00/0000:00:1d.3/usb4/bmAttributes | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/busnum | 1 + .../pci0000:00/0000:00:1d.3/usb4/configuration | 0 .../pci0000:00/0000:00:1d.3/usb4/descriptors | Bin 0 -> 43 bytes test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/devnum | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/driver | 1 + .../sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/idProduct | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/idVendor | 1 + .../pci0000:00/0000:00:1d.3/usb4/manufacturer | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/maxchild | 1 + .../0000:00:1d.3/usb4/power/active_duration | 1 + .../pci0000:00/0000:00:1d.3/usb4/power/autosuspend | 1 + .../0000:00:1d.3/usb4/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.3/usb4/power/level | 1 + .../pci0000:00/0000:00:1d.3/usb4/power/wakeup | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/product | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/quirks | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/serial | 1 + .../sys/devices/pci0000:00/0000:00:1d.3/usb4/speed | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/subsystem | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/uevent | 8 + .../devices/pci0000:00/0000:00:1d.3/usb4/urbnum | 1 + .../usb_endpoint/usbdev4.1_ep00/bEndpointAddress | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/bInterval | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/bLength | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/dev | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/device | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/direction | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/interval | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/subsystem | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/type | 1 + .../usb4/usb_endpoint/usbdev4.1_ep00/uevent | 2 + .../usb_endpoint/usbdev4.1_ep00/wMaxPacketSize | 1 + .../devices/pci0000:00/0000:00:1d.3/usb4/version | 1 + .../0000:00:1d.3/usb_host/usb_host4/device | 1 + .../0000:00:1d.3/usb_host/usb_host4/power/wakeup | 1 + .../0000:00:1d.3/usb_host/usb_host4/subsystem | 1 + .../0000:00:1d.3/usb_host/usb_host4/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.3/vendor | 1 + .../pci0000:00/0000:00:1e.0/0000:02:05.0/class | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/device | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/driver | 1 - .../host0/target0:0:0/0:0:0:0/device_blocked | 1 - .../0000:02:05.0/host0/target0:0:0/0:0:0:0/driver | 1 - .../0000:02:05.0/host0/target0:0:0/0:0:0:0/model | 1 - .../0000:02:05.0/host0/target0:0:0/0:0:0:0/online | 1 - .../host0/target0:0:0/0:0:0:0/queue_depth | 1 - .../0000:02:05.0/host0/target0:0:0/0:0:0:0/rev | 1 - .../host0/target0:0:0/0:0:0:0/scsi_level | 1 - .../host0/target0:0:0/0:0:0:0/subsystem | 1 - .../0000:02:05.0/host0/target0:0:0/0:0:0:0/type | 1 - .../0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor | 1 - .../host0/target0:0:0/0:0:0:0/whitespace_test | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/irq | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/resource | 7 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem | 1 - .../0000:00:1e.0/0000:02:05.0/subsystem_device | 1 - .../0000:00:1e.0/0000:02:05.0/subsystem_vendor | 1 - .../pci0000:00/0000:00:1e.0/0000:02:05.0/vendor | 1 - .../0000:00:1e.0/0000:15:00.0/broken_parity_status | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/class | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/config | Bin 0 -> 256 bytes .../pci0000:00/0000:00:1e.0/0000:15:00.0/device | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/driver | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/enable | 1 + .../0000:00:1e.0/0000:15:00.0/firmware_node | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/irq | 1 + .../0000:00:1e.0/0000:15:00.0/local_cpulist | 1 + .../0000:00:1e.0/0000:15:00.0/local_cpus | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/modalias | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus | 1 + .../0000:15:00.0/pci_bus/0000:16/cpuaffinity | 1 + .../0000:15:00.0/pci_bus/0000:16/device | 1 + .../0000:15:00.0/pci_bus/0000:16/power/wakeup | 1 + .../0000:15:00.0/pci_bus/0000:16/subsystem | 1 + .../0000:15:00.0/pci_bus/0000:16/uevent | 0 .../pcmcia_socket0/available_resources_io | 6 + .../pcmcia_socket0/available_resources_mem | 5 + .../pcmcia_socket0/available_resources_setup_done | 1 + .../pcmcia_socket/pcmcia_socket0/card_irq_mask | 1 + .../pcmcia_socket/pcmcia_socket0/card_pm_state | 1 + .../pcmcia_socket/pcmcia_socket0/card_type | 0 .../pcmcia_socket/pcmcia_socket0/card_vcc | 0 .../pcmcia_socket/pcmcia_socket0/card_voltage | 0 .../pcmcia_socket/pcmcia_socket0/card_vpp | 0 .../0000:15:00.0/pcmcia_socket/pcmcia_socket0/cis | 0 .../pcmcia_socket/pcmcia_socket0/device | 1 + .../pcmcia_socket/pcmcia_socket0/power/wakeup | 1 + .../pcmcia_socket/pcmcia_socket0/subsystem | 1 + .../pcmcia_socket/pcmcia_socket0/uevent | 1 + .../0000:00:1e.0/0000:15:00.0/power/wakeup | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/resource | 12 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/resource0 | 0 .../pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem | 1 + .../0000:00:1e.0/0000:15:00.0/subsystem_device | 1 + .../0000:00:1e.0/0000:15:00.0/subsystem_vendor | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/uevent | 6 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/vendor | 1 + .../0000:00:1e.0/0000:15:00.0/yenta_registers | 11 + .../pci0000:00/0000:00:1e.0/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/class | 2 +- test/sys/devices/pci0000:00/0000:00:1e.0/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1e.0/device | 2 +- test/sys/devices/pci0000:00/0000:00:1e.0/enable | 1 + .../devices/pci0000:00/0000:00:1e.0/firmware_node | 1 + .../devices/pci0000:00/0000:00:1e.0/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1e.0/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus | 1 + .../0000:00:1e.0/pci_bus/0000:15/cpuaffinity | 1 + .../pci0000:00/0000:00:1e.0/pci_bus/0000:15/device | 1 + .../0000:00:1e.0/pci_bus/0000:15/power/wakeup | 1 + .../0000:00:1e.0/pci_bus/0000:15/subsystem | 1 + .../pci0000:00/0000:00:1e.0/pci_bus/0000:15/uevent | 0 .../devices/pci0000:00/0000:00:1e.0/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1e.0/resource | 6 +- test/sys/devices/pci0000:00/0000:00:1e.0/uevent | 5 + .../pci0000:00/0000:00:1f.0/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1f.0/class | 1 + test/sys/devices/pci0000:00/0000:00:1f.0/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1f.0/device | 1 + test/sys/devices/pci0000:00/0000:00:1f.0/enable | 1 + .../devices/pci0000:00/0000:00:1f.0/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1f.0/irq | 1 + .../devices/pci0000:00/0000:00:1f.0/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1f.0/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1f.0/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1f.0/msi_bus | 0 .../devices/pci0000:00/0000:00:1f.0/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1f.0/resource | 7 + test/sys/devices/pci0000:00/0000:00:1f.0/subsystem | 1 + .../pci0000:00/0000:00:1f.0/subsystem_device | 1 + .../pci0000:00/0000:00:1f.0/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1f.0/uevent | 5 + test/sys/devices/pci0000:00/0000:00:1f.0/vendor | 1 + .../pci0000:00/0000:00:1f.1/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1f.1/class | 1 + test/sys/devices/pci0000:00/0000:00:1f.1/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1f.1/device | 1 + test/sys/devices/pci0000:00/0000:00:1f.1/driver | 1 + test/sys/devices/pci0000:00/0000:00:1f.1/enable | 1 + .../devices/pci0000:00/0000:00:1f.1/firmware_node | 1 + .../pci0000:00/0000:00:1f.1/host4/power/wakeup | 1 + .../0000:00:1f.1/host4/scsi_host/host4/active_mode | 1 + .../0000:00:1f.1/host4/scsi_host/host4/can_queue | 1 + .../0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun | 1 + .../0000:00:1f.1/host4/scsi_host/host4/device | 1 + .../0000:00:1f.1/host4/scsi_host/host4/host_busy | 1 + .../host4/scsi_host/host4/power/wakeup | 1 + .../0000:00:1f.1/host4/scsi_host/host4/proc_name | 1 + .../host4/scsi_host/host4/prot_capabilities | 1 + .../host4/scsi_host/host4/prot_guard_type | 1 + .../host4/scsi_host/host4/sg_tablesize | 1 + .../0000:00:1f.1/host4/scsi_host/host4/state | 1 + .../0000:00:1f.1/host4/scsi_host/host4/subsystem | 1 + .../host4/scsi_host/host4/supported_mode | 1 + .../0000:00:1f.1/host4/scsi_host/host4/uevent | 0 .../host4/scsi_host/host4/unchecked_isa_dma | 1 + .../0000:00:1f.1/host4/scsi_host/host4/unique_id | 1 + .../pci0000:00/0000:00:1f.1/host4/subsystem | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/bdi | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/capability | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/dev | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/device | 1 + .../target4:0:0/4:0:0:0/block/sr0/make-it-fail | 1 + .../target4:0:0/4:0:0:0/block/sr0/power/wakeup | 1 + .../4:0:0:0/block/sr0/queue/hw_sector_size | 1 + .../4:0:0:0/block/sr0/queue/iosched/back_seek_max | 1 + .../block/sr0/queue/iosched/back_seek_penalty | 1 + .../block/sr0/queue/iosched/fifo_expire_async | 1 + .../block/sr0/queue/iosched/fifo_expire_sync | 1 + .../4:0:0:0/block/sr0/queue/iosched/quantum | 1 + .../4:0:0:0/block/sr0/queue/iosched/slice_async | 1 + .../4:0:0:0/block/sr0/queue/iosched/slice_async_rq | 1 + .../4:0:0:0/block/sr0/queue/iosched/slice_idle | 1 + .../4:0:0:0/block/sr0/queue/iosched/slice_sync | 1 + .../4:0:0:0/block/sr0/queue/max_hw_sectors_kb | 1 + .../4:0:0:0/block/sr0/queue/max_sectors_kb | 1 + .../target4:0:0/4:0:0:0/block/sr0/queue/nomerges | 1 + .../4:0:0:0/block/sr0/queue/nr_requests | 1 + .../4:0:0:0/block/sr0/queue/read_ahead_kb | 1 + .../target4:0:0/4:0:0:0/block/sr0/queue/scheduler | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/range | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/removable | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/ro | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/size | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/stat | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/subsystem | 1 + .../host4/target4:0:0/4:0:0:0/block/sr0/uevent | 3 + .../host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev | 1 + .../host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device | 1 + .../target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup | 1 + .../target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem | 1 + .../host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent | 2 + .../host4/target4:0:0/4:0:0:0/device_blocked | 1 + .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver | 1 + .../host4/target4:0:0/4:0:0:0/evt_media_change | 1 + .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic | 1 + .../host4/target4:0:0/4:0:0:0/iocounterbits | 1 + .../host4/target4:0:0/4:0:0:0/iodone_cnt | 1 + .../host4/target4:0:0/4:0:0:0/ioerr_cnt | 1 + .../host4/target4:0:0/4:0:0:0/iorequest_cnt | 1 + .../host4/target4:0:0/4:0:0:0/modalias | 1 + .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/model | 1 + .../host4/target4:0:0/4:0:0:0/power/wakeup | 1 + .../host4/target4:0:0/4:0:0:0/queue_depth | 1 + .../host4/target4:0:0/4:0:0:0/queue_type | 1 + .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev | 1 + .../target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device | 1 + .../4:0:0:0/scsi_device/4:0:0:0/power/wakeup | 1 + .../4:0:0:0/scsi_device/4:0:0:0/subsystem | 1 + .../target4:0:0/4:0:0:0/scsi_device/4:0:0:0/uevent | 0 .../host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev | 1 + .../target4:0:0/4:0:0:0/scsi_generic/sg1/device | 1 + .../4:0:0:0/scsi_generic/sg1/power/wakeup | 1 + .../target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem | 1 + .../target4:0:0/4:0:0:0/scsi_generic/sg1/uevent | 2 + .../host4/target4:0:0/4:0:0:0/scsi_level | 1 + .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/state | 1 + .../host4/target4:0:0/4:0:0:0/subsystem | 1 + .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout | 1 + .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/type | 1 + .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent | 3 + .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor | 1 + .../0000:00:1f.1/host4/target4:0:0/power/wakeup | 1 + .../0000:00:1f.1/host4/target4:0:0/subsystem | 1 + .../0000:00:1f.1/host4/target4:0:0/uevent | 1 + .../devices/pci0000:00/0000:00:1f.1/host4/uevent | 1 + .../pci0000:00/0000:00:1f.1/host5/power/wakeup | 1 + .../0000:00:1f.1/host5/scsi_host/host5/active_mode | 1 + .../0000:00:1f.1/host5/scsi_host/host5/can_queue | 1 + .../0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun | 1 + .../0000:00:1f.1/host5/scsi_host/host5/device | 1 + .../0000:00:1f.1/host5/scsi_host/host5/host_busy | 1 + .../host5/scsi_host/host5/power/wakeup | 1 + .../0000:00:1f.1/host5/scsi_host/host5/proc_name | 1 + .../host5/scsi_host/host5/prot_capabilities | 1 + .../host5/scsi_host/host5/prot_guard_type | 1 + .../host5/scsi_host/host5/sg_tablesize | 1 + .../0000:00:1f.1/host5/scsi_host/host5/state | 1 + .../0000:00:1f.1/host5/scsi_host/host5/subsystem | 1 + .../host5/scsi_host/host5/supported_mode | 1 + .../0000:00:1f.1/host5/scsi_host/host5/uevent | 0 .../host5/scsi_host/host5/unchecked_isa_dma | 1 + .../0000:00:1f.1/host5/scsi_host/host5/unique_id | 1 + .../pci0000:00/0000:00:1f.1/host5/subsystem | 1 + .../devices/pci0000:00/0000:00:1f.1/host5/uevent | 1 + test/sys/devices/pci0000:00/0000:00:1f.1/irq | 1 + .../devices/pci0000:00/0000:00:1f.1/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1f.1/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1f.1/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1f.1/msi_bus | 0 .../devices/pci0000:00/0000:00:1f.1/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1f.1/resource | 7 + test/sys/devices/pci0000:00/0000:00:1f.1/resource0 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/resource1 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/resource2 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/resource3 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/subsystem | 1 + .../pci0000:00/0000:00:1f.1/subsystem_device | 1 + .../pci0000:00/0000:00:1f.1/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1f.1/uevent | 6 + test/sys/devices/pci0000:00/0000:00:1f.1/vendor | 1 + .../pci0000:00/0000:00:1f.2/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1f.2/class | 1 + test/sys/devices/pci0000:00/0000:00:1f.2/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1f.2/device | 1 + test/sys/devices/pci0000:00/0000:00:1f.2/driver | 1 + test/sys/devices/pci0000:00/0000:00:1f.2/enable | 1 + .../devices/pci0000:00/0000:00:1f.2/firmware_node | 1 + .../pci0000:00/0000:00:1f.2/host0/power/wakeup | 1 + .../0000:00:1f.2/host0/scsi_host/host0/active_mode | 1 + .../0000:00:1f.2/host0/scsi_host/host0/can_queue | 1 + .../0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun | 1 + .../0000:00:1f.2/host0/scsi_host/host0/device | 1 + .../0000:00:1f.2/host0/scsi_host/host0/em_message | 0 .../host0/scsi_host/host0/em_message_type | 1 + .../0000:00:1f.2/host0/scsi_host/host0/host_busy | 1 + .../scsi_host/host0/link_power_management_policy | 1 + .../host0/scsi_host/host0/power/wakeup | 1 + .../0000:00:1f.2/host0/scsi_host/host0/proc_name | 1 + .../host0/scsi_host/host0/prot_capabilities | 1 + .../host0/scsi_host/host0/prot_guard_type | 1 + .../host0/scsi_host/host0/sg_tablesize | 1 + .../0000:00:1f.2/host0/scsi_host/host0/state | 1 + .../0000:00:1f.2/host0/scsi_host/host0/subsystem | 1 + .../host0/scsi_host/host0/supported_mode | 1 + .../0000:00:1f.2/host0/scsi_host/host0/uevent | 0 .../host0/scsi_host/host0/unchecked_isa_dma | 1 + .../0000:00:1f.2/host0/scsi_host/host0/unique_id | 1 + .../pci0000:00/0000:00:1f.2/host0/subsystem | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/bdi | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/capability | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/dev | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/device | 1 + .../target0:0:0/0:0:0:0/block/sda/make-it-fail | 1 + .../target0:0:0/0:0:0:0/block/sda/power/wakeup | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/queue/bsg | 1 + .../0:0:0:0/block/sda/queue/hw_sector_size | 1 + .../0:0:0:0/block/sda/queue/iosched/back_seek_max | 1 + .../block/sda/queue/iosched/back_seek_penalty | 1 + .../block/sda/queue/iosched/fifo_expire_async | 1 + .../block/sda/queue/iosched/fifo_expire_sync | 1 + .../0:0:0:0/block/sda/queue/iosched/quantum | 1 + .../0:0:0:0/block/sda/queue/iosched/slice_async | 1 + .../0:0:0:0/block/sda/queue/iosched/slice_async_rq | 1 + .../0:0:0:0/block/sda/queue/iosched/slice_idle | 1 + .../0:0:0:0/block/sda/queue/iosched/slice_sync | 1 + .../0:0:0:0/block/sda/queue/max_hw_sectors_kb | 1 + .../0:0:0:0/block/sda/queue/max_sectors_kb | 1 + .../target0:0:0/0:0:0:0/block/sda/queue/nomerges | 1 + .../0:0:0:0/block/sda/queue/nr_requests | 1 + .../0:0:0:0/block/sda/queue/read_ahead_kb | 1 + .../target0:0:0/0:0:0:0/block/sda/queue/scheduler | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/range | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/removable | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/ro | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda1/dev | 1 + .../0:0:0:0/block/sda/sda1/make-it-fail | 1 + .../0:0:0:0/block/sda/sda1/power/wakeup | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda1/size | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda1/start | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda1/stat | 1 + .../target0:0:0/0:0:0:0/block/sda/sda1/subsystem | 1 + .../target0:0:0/0:0:0:0/block/sda/sda1/uevent | 3 + .../host0/target0:0:0/0:0:0:0/block/sda/sda10/dev | 1 + .../0:0:0:0/block/sda/sda10/make-it-fail | 1 + .../0:0:0:0/block/sda/sda10/power/wakeup | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda10/size | 1 + .../target0:0:0/0:0:0:0/block/sda/sda10/start | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda10/stat | 1 + .../target0:0:0/0:0:0:0/block/sda/sda10/subsystem | 1 + .../target0:0:0/0:0:0:0/block/sda/sda10/uevent | 3 + .../host0/target0:0:0/0:0:0:0/block/sda/sda5/dev | 1 + .../0:0:0:0/block/sda/sda5/make-it-fail | 1 + .../0:0:0:0/block/sda/sda5/power/wakeup | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda5/size | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda5/start | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda5/stat | 1 + .../target0:0:0/0:0:0:0/block/sda/sda5/subsystem | 1 + .../target0:0:0/0:0:0:0/block/sda/sda5/uevent | 3 + .../host0/target0:0:0/0:0:0:0/block/sda/sda6/dev | 1 + .../0:0:0:0/block/sda/sda6/make-it-fail | 1 + .../0:0:0:0/block/sda/sda6/power/wakeup | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda6/size | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda6/start | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda6/stat | 1 + .../target0:0:0/0:0:0:0/block/sda/sda6/subsystem | 1 + .../target0:0:0/0:0:0:0/block/sda/sda6/uevent | 3 + .../host0/target0:0:0/0:0:0:0/block/sda/sda7/dev | 1 + .../0:0:0:0/block/sda/sda7/make-it-fail | 1 + .../0:0:0:0/block/sda/sda7/power/wakeup | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda7/size | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda7/start | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda7/stat | 1 + .../target0:0:0/0:0:0:0/block/sda/sda7/subsystem | 1 + .../target0:0:0/0:0:0:0/block/sda/sda7/uevent | 3 + .../host0/target0:0:0/0:0:0:0/block/sda/sda8/dev | 1 + .../0:0:0:0/block/sda/sda8/make-it-fail | 1 + .../0:0:0:0/block/sda/sda8/power/wakeup | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda8/size | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda8/start | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda8/stat | 1 + .../target0:0:0/0:0:0:0/block/sda/sda8/subsystem | 1 + .../target0:0:0/0:0:0:0/block/sda/sda8/uevent | 3 + .../host0/target0:0:0/0:0:0:0/block/sda/sda9/dev | 1 + .../target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 | 1 + .../0:0:0:0/block/sda/sda9/make-it-fail | 1 + .../0:0:0:0/block/sda/sda9/power/wakeup | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda9/size | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda9/start | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/sda9/stat | 1 + .../target0:0:0/0:0:0:0/block/sda/sda9/subsystem | 1 + .../target0:0:0/0:0:0:0/block/sda/sda9/uevent | 3 + .../host0/target0:0:0/0:0:0:0/block/sda/size | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/stat | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/subsystem | 1 + .../target0:0:0/0:0:0:0/block/sda/test:colon+plus | 1 + .../host0/target0:0:0/0:0:0:0/block/sda/uevent | 3 + .../host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev | 1 + .../host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device | 1 + .../target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup | 1 + .../target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem | 1 + .../host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent | 2 + .../host0/target0:0:0/0:0:0:0/device_blocked | 1 + .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver | 1 + .../host0/target0:0:0/0:0:0:0/evt_media_change | 1 + .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic | 1 + .../host0/target0:0:0/0:0:0:0/iocounterbits | 1 + .../host0/target0:0:0/0:0:0:0/iodone_cnt | 1 + .../host0/target0:0:0/0:0:0:0/ioerr_cnt | 1 + .../host0/target0:0:0/0:0:0:0/iorequest_cnt | 1 + .../host0/target0:0:0/0:0:0:0/modalias | 1 + .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/model | 1 + .../host0/target0:0:0/0:0:0:0/power/wakeup | 1 + .../host0/target0:0:0/0:0:0:0/queue_depth | 1 + .../host0/target0:0:0/0:0:0:0/queue_type | 1 + .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev | 1 + .../target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device | 1 + .../0:0:0:0/scsi_device/0:0:0:0/power/wakeup | 1 + .../0:0:0:0/scsi_device/0:0:0:0/subsystem | 1 + .../target0:0:0/0:0:0:0/scsi_device/0:0:0:0/uevent | 0 .../target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA | 1 + .../0:0:0:0/scsi_disk/0:0:0:0/allow_restart | 1 + .../0:0:0:0/scsi_disk/0:0:0:0/app_tag_own | 1 + .../0:0:0:0/scsi_disk/0:0:0:0/cache_type | 1 + .../target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device | 1 + .../0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop | 1 + .../0:0:0:0/scsi_disk/0:0:0:0/power/wakeup | 1 + .../0:0:0:0/scsi_disk/0:0:0:0/protection_type | 1 + .../0:0:0:0/scsi_disk/0:0:0:0/subsystem | 1 + .../target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/uevent | 0 .../host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev | 1 + .../target0:0:0/0:0:0:0/scsi_generic/sg0/device | 1 + .../0:0:0:0/scsi_generic/sg0/power/wakeup | 1 + .../target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem | 1 + .../target0:0:0/0:0:0:0/scsi_generic/sg0/uevent | 2 + .../host0/target0:0:0/0:0:0:0/scsi_level | 1 + .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/state | 1 + .../host0/target0:0:0/0:0:0:0/subsystem | 1 + .../host0/target0:0:0/0:0:0:0/sw_activity | 0 .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout | 1 + .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/type | 1 + .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent | 3 + .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor | 1 + .../host0/target0:0:0/0:0:0:0/whitespace_test | 1 + .../0000:00:1f.2/host0/target0:0:0/power/wakeup | 1 + .../0000:00:1f.2/host0/target0:0:0/subsystem | 1 + .../0000:00:1f.2/host0/target0:0:0/uevent | 1 + .../devices/pci0000:00/0000:00:1f.2/host0/uevent | 1 + .../pci0000:00/0000:00:1f.2/host1/power/wakeup | 1 + .../0000:00:1f.2/host1/scsi_host/host1/active_mode | 1 + .../0000:00:1f.2/host1/scsi_host/host1/can_queue | 1 + .../0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun | 1 + .../0000:00:1f.2/host1/scsi_host/host1/device | 1 + .../0000:00:1f.2/host1/scsi_host/host1/em_message | 0 .../host1/scsi_host/host1/em_message_type | 1 + .../0000:00:1f.2/host1/scsi_host/host1/host_busy | 1 + .../scsi_host/host1/link_power_management_policy | 1 + .../host1/scsi_host/host1/power/wakeup | 1 + .../0000:00:1f.2/host1/scsi_host/host1/proc_name | 1 + .../host1/scsi_host/host1/prot_capabilities | 1 + .../host1/scsi_host/host1/prot_guard_type | 1 + .../host1/scsi_host/host1/sg_tablesize | 1 + .../0000:00:1f.2/host1/scsi_host/host1/state | 1 + .../0000:00:1f.2/host1/scsi_host/host1/subsystem | 1 + .../host1/scsi_host/host1/supported_mode | 1 + .../0000:00:1f.2/host1/scsi_host/host1/uevent | 0 .../host1/scsi_host/host1/unchecked_isa_dma | 1 + .../0000:00:1f.2/host1/scsi_host/host1/unique_id | 1 + .../pci0000:00/0000:00:1f.2/host1/subsystem | 1 + .../devices/pci0000:00/0000:00:1f.2/host1/uevent | 1 + .../pci0000:00/0000:00:1f.2/host2/power/wakeup | 1 + .../0000:00:1f.2/host2/scsi_host/host2/active_mode | 1 + .../0000:00:1f.2/host2/scsi_host/host2/can_queue | 1 + .../0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun | 1 + .../0000:00:1f.2/host2/scsi_host/host2/device | 1 + .../0000:00:1f.2/host2/scsi_host/host2/em_message | 0 .../host2/scsi_host/host2/em_message_type | 1 + .../0000:00:1f.2/host2/scsi_host/host2/host_busy | 1 + .../scsi_host/host2/link_power_management_policy | 1 + .../host2/scsi_host/host2/power/wakeup | 1 + .../0000:00:1f.2/host2/scsi_host/host2/proc_name | 1 + .../host2/scsi_host/host2/prot_capabilities | 1 + .../host2/scsi_host/host2/prot_guard_type | 1 + .../host2/scsi_host/host2/sg_tablesize | 1 + .../0000:00:1f.2/host2/scsi_host/host2/state | 1 + .../0000:00:1f.2/host2/scsi_host/host2/subsystem | 1 + .../host2/scsi_host/host2/supported_mode | 1 + .../0000:00:1f.2/host2/scsi_host/host2/uevent | 0 .../host2/scsi_host/host2/unchecked_isa_dma | 1 + .../0000:00:1f.2/host2/scsi_host/host2/unique_id | 1 + .../pci0000:00/0000:00:1f.2/host2/subsystem | 1 + .../devices/pci0000:00/0000:00:1f.2/host2/uevent | 1 + .../pci0000:00/0000:00:1f.2/host3/power/wakeup | 1 + .../0000:00:1f.2/host3/scsi_host/host3/active_mode | 1 + .../0000:00:1f.2/host3/scsi_host/host3/can_queue | 1 + .../0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun | 1 + .../0000:00:1f.2/host3/scsi_host/host3/device | 1 + .../0000:00:1f.2/host3/scsi_host/host3/em_message | 0 .../host3/scsi_host/host3/em_message_type | 1 + .../0000:00:1f.2/host3/scsi_host/host3/host_busy | 1 + .../scsi_host/host3/link_power_management_policy | 1 + .../host3/scsi_host/host3/power/wakeup | 1 + .../0000:00:1f.2/host3/scsi_host/host3/proc_name | 1 + .../host3/scsi_host/host3/prot_capabilities | 1 + .../host3/scsi_host/host3/prot_guard_type | 1 + .../host3/scsi_host/host3/sg_tablesize | 1 + .../0000:00:1f.2/host3/scsi_host/host3/state | 1 + .../0000:00:1f.2/host3/scsi_host/host3/subsystem | 1 + .../host3/scsi_host/host3/supported_mode | 1 + .../0000:00:1f.2/host3/scsi_host/host3/uevent | 0 .../host3/scsi_host/host3/unchecked_isa_dma | 1 + .../0000:00:1f.2/host3/scsi_host/host3/unique_id | 1 + .../pci0000:00/0000:00:1f.2/host3/subsystem | 1 + .../devices/pci0000:00/0000:00:1f.2/host3/uevent | 1 + test/sys/devices/pci0000:00/0000:00:1f.2/irq | 1 + .../devices/pci0000:00/0000:00:1f.2/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1f.2/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1f.2/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1f.2/msi_bus | 0 .../devices/pci0000:00/0000:00:1f.2/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1f.2/resource | 7 + test/sys/devices/pci0000:00/0000:00:1f.2/resource0 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource1 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource2 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource3 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource5 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/subsystem | 1 + .../pci0000:00/0000:00:1f.2/subsystem_device | 1 + .../pci0000:00/0000:00:1f.2/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1f.2/uevent | 6 + test/sys/devices/pci0000:00/0000:00:1f.2/vendor | 1 + .../pci0000:00/0000:00:1f.3/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1f.3/class | 1 + test/sys/devices/pci0000:00/0000:00:1f.3/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1f.3/device | 1 + test/sys/devices/pci0000:00/0000:00:1f.3/enable | 1 + .../devices/pci0000:00/0000:00:1f.3/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1f.3/irq | 1 + .../devices/pci0000:00/0000:00:1f.3/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1f.3/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1f.3/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1f.3/msi_bus | 0 .../devices/pci0000:00/0000:00:1f.3/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1f.3/resource | 7 + test/sys/devices/pci0000:00/0000:00:1f.3/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1f.3/subsystem | 1 + .../pci0000:00/0000:00:1f.3/subsystem_device | 1 + .../pci0000:00/0000:00:1f.3/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1f.3/uevent | 5 + test/sys/devices/pci0000:00/0000:00:1f.3/vendor | 1 + test/sys/devices/pci0000:00/firmware_node | 1 + .../devices/pci0000:00/pci_bus/0000:00/cpuaffinity | 1 + test/sys/devices/pci0000:00/pci_bus/0000:00/device | 1 + .../pci0000:00/pci_bus/0000:00/power/wakeup | 1 + .../devices/pci0000:00/pci_bus/0000:00/subsystem | 1 + test/sys/devices/pci0000:00/pci_bus/0000:00/uevent | 0 test/sys/devices/pci0000:00/power/wakeup | 1 + test/sys/devices/pci0000:00/uevent | 0 test/sys/devices/platform/dock.0/docked | 1 + test/sys/devices/platform/dock.0/flags | 1 + test/sys/devices/platform/dock.0/modalias | 1 + test/sys/devices/platform/dock.0/power/wakeup | 1 + test/sys/devices/platform/dock.0/subsystem | 1 + test/sys/devices/platform/dock.0/uevent | 1 + test/sys/devices/platform/dock.0/uid | 1 + test/sys/devices/platform/i8042/driver | 1 + test/sys/devices/platform/i8042/modalias | 1 + test/sys/devices/platform/i8042/power/wakeup | 1 + test/sys/devices/platform/i8042/serio0/bind_mode | 1 + test/sys/devices/platform/i8042/serio0/description | 1 + test/sys/devices/platform/i8042/serio0/driver | 1 + test/sys/devices/platform/i8042/serio0/err_count | 1 + test/sys/devices/platform/i8042/serio0/extra | 1 + test/sys/devices/platform/i8042/serio0/id/extra | 1 + test/sys/devices/platform/i8042/serio0/id/id | 1 + test/sys/devices/platform/i8042/serio0/id/proto | 1 + test/sys/devices/platform/i8042/serio0/id/type | 1 + .../i8042/serio0/input/input0/capabilities/abs | 1 + .../i8042/serio0/input/input0/capabilities/ev | 1 + .../i8042/serio0/input/input0/capabilities/ff | 1 + .../i8042/serio0/input/input0/capabilities/key | 1 + .../i8042/serio0/input/input0/capabilities/led | 1 + .../i8042/serio0/input/input0/capabilities/msc | 1 + .../i8042/serio0/input/input0/capabilities/rel | 1 + .../i8042/serio0/input/input0/capabilities/snd | 1 + .../i8042/serio0/input/input0/capabilities/sw | 1 + .../platform/i8042/serio0/input/input0/device | 1 + .../platform/i8042/serio0/input/input0/event0/dev | 1 + .../i8042/serio0/input/input0/event0/device | 1 + .../i8042/serio0/input/input0/event0/power/wakeup | 1 + .../i8042/serio0/input/input0/event0/subsystem | 1 + .../i8042/serio0/input/input0/event0/uevent | 2 + .../platform/i8042/serio0/input/input0/id/bustype | 1 + .../platform/i8042/serio0/input/input0/id/product | 1 + .../platform/i8042/serio0/input/input0/id/vendor | 1 + .../platform/i8042/serio0/input/input0/id/version | 1 + .../platform/i8042/serio0/input/input0/modalias | 1 + .../platform/i8042/serio0/input/input0/name | 1 + .../platform/i8042/serio0/input/input0/phys | 1 + .../i8042/serio0/input/input0/power/wakeup | 1 + .../platform/i8042/serio0/input/input0/subsystem | 1 + .../platform/i8042/serio0/input/input0/uevent | 8 + .../platform/i8042/serio0/input/input0/uniq | 1 + test/sys/devices/platform/i8042/serio0/modalias | 1 + .../sys/devices/platform/i8042/serio0/power/wakeup | 1 + test/sys/devices/platform/i8042/serio0/scroll | 1 + test/sys/devices/platform/i8042/serio0/set | 1 + test/sys/devices/platform/i8042/serio0/softraw | 1 + test/sys/devices/platform/i8042/serio0/softrepeat | 1 + test/sys/devices/platform/i8042/serio0/subsystem | 1 + test/sys/devices/platform/i8042/serio0/uevent | 6 + test/sys/devices/platform/i8042/serio1/bind_mode | 1 + test/sys/devices/platform/i8042/serio1/description | 1 + test/sys/devices/platform/i8042/serio1/draghys | 1 + test/sys/devices/platform/i8042/serio1/driver | 1 + test/sys/devices/platform/i8042/serio1/ext_dev | 1 + test/sys/devices/platform/i8042/serio1/id/extra | 1 + test/sys/devices/platform/i8042/serio1/id/id | 1 + test/sys/devices/platform/i8042/serio1/id/proto | 1 + test/sys/devices/platform/i8042/serio1/id/type | 1 + test/sys/devices/platform/i8042/serio1/inertia | 1 + .../i8042/serio1/input/input1/capabilities/abs | 1 + .../i8042/serio1/input/input1/capabilities/ev | 1 + .../i8042/serio1/input/input1/capabilities/ff | 1 + .../i8042/serio1/input/input1/capabilities/key | 1 + .../i8042/serio1/input/input1/capabilities/led | 1 + .../i8042/serio1/input/input1/capabilities/msc | 1 + .../i8042/serio1/input/input1/capabilities/rel | 1 + .../i8042/serio1/input/input1/capabilities/snd | 1 + .../i8042/serio1/input/input1/capabilities/sw | 1 + .../platform/i8042/serio1/input/input1/device | 1 + .../platform/i8042/serio1/input/input1/event1/dev | 1 + .../i8042/serio1/input/input1/event1/device | 1 + .../i8042/serio1/input/input1/event1/power/wakeup | 1 + .../i8042/serio1/input/input1/event1/subsystem | 1 + .../i8042/serio1/input/input1/event1/uevent | 2 + .../platform/i8042/serio1/input/input1/id/bustype | 1 + .../platform/i8042/serio1/input/input1/id/product | 1 + .../platform/i8042/serio1/input/input1/id/vendor | 1 + .../platform/i8042/serio1/input/input1/id/version | 1 + .../platform/i8042/serio1/input/input1/modalias | 1 + .../platform/i8042/serio1/input/input1/mouse0/dev | 1 + .../i8042/serio1/input/input1/mouse0/device | 1 + .../i8042/serio1/input/input1/mouse0/power/wakeup | 1 + .../i8042/serio1/input/input1/mouse0/subsystem | 1 + .../i8042/serio1/input/input1/mouse0/uevent | 2 + .../platform/i8042/serio1/input/input1/name | 1 + .../platform/i8042/serio1/input/input1/phys | 1 + .../i8042/serio1/input/input1/power/wakeup | 1 + .../platform/i8042/serio1/input/input1/subsystem | 1 + .../platform/i8042/serio1/input/input1/uevent | 7 + .../platform/i8042/serio1/input/input1/uniq | 1 + test/sys/devices/platform/i8042/serio1/jenks | 1 + test/sys/devices/platform/i8042/serio1/mindrag | 1 + test/sys/devices/platform/i8042/serio1/modalias | 1 + .../sys/devices/platform/i8042/serio1/power/wakeup | 1 + .../devices/platform/i8042/serio1/press_to_select | 1 + test/sys/devices/platform/i8042/serio1/protocol | 1 + test/sys/devices/platform/i8042/serio1/rate | 1 + test/sys/devices/platform/i8042/serio1/reach | 1 + test/sys/devices/platform/i8042/serio1/resetafter | 1 + test/sys/devices/platform/i8042/serio1/resolution | 1 + test/sys/devices/platform/i8042/serio1/resync_time | 1 + test/sys/devices/platform/i8042/serio1/sensitivity | 1 + test/sys/devices/platform/i8042/serio1/skipback | 1 + test/sys/devices/platform/i8042/serio1/speed | 1 + test/sys/devices/platform/i8042/serio1/subsystem | 1 + test/sys/devices/platform/i8042/serio1/thresh | 1 + test/sys/devices/platform/i8042/serio1/uevent | 6 + test/sys/devices/platform/i8042/serio1/upthresh | 1 + test/sys/devices/platform/i8042/serio1/ztime | 1 + test/sys/devices/platform/i8042/subsystem | 1 + test/sys/devices/platform/i8042/uevent | 2 + test/sys/devices/platform/microcode/modalias | 1 + test/sys/devices/platform/microcode/power/wakeup | 1 + test/sys/devices/platform/microcode/subsystem | 1 + test/sys/devices/platform/microcode/uevent | 1 + test/sys/devices/platform/pcspkr/driver | 1 + .../platform/pcspkr/input/input2/capabilities/abs | 1 + .../platform/pcspkr/input/input2/capabilities/ev | 1 + .../platform/pcspkr/input/input2/capabilities/ff | 1 + .../platform/pcspkr/input/input2/capabilities/key | 1 + .../platform/pcspkr/input/input2/capabilities/led | 1 + .../platform/pcspkr/input/input2/capabilities/msc | 1 + .../platform/pcspkr/input/input2/capabilities/rel | 1 + .../platform/pcspkr/input/input2/capabilities/snd | 1 + .../platform/pcspkr/input/input2/capabilities/sw | 1 + .../devices/platform/pcspkr/input/input2/device | 1 + .../platform/pcspkr/input/input2/event2/dev | 1 + .../platform/pcspkr/input/input2/event2/device | 1 + .../pcspkr/input/input2/event2/power/wakeup | 1 + .../platform/pcspkr/input/input2/event2/subsystem | 1 + .../platform/pcspkr/input/input2/event2/uevent | 2 + .../platform/pcspkr/input/input2/id/bustype | 1 + .../platform/pcspkr/input/input2/id/product | 1 + .../devices/platform/pcspkr/input/input2/id/vendor | 1 + .../platform/pcspkr/input/input2/id/version | 1 + .../devices/platform/pcspkr/input/input2/modalias | 1 + test/sys/devices/platform/pcspkr/input/input2/name | 1 + test/sys/devices/platform/pcspkr/input/input2/phys | 1 + .../platform/pcspkr/input/input2/power/wakeup | 1 + .../devices/platform/pcspkr/input/input2/subsystem | 1 + .../devices/platform/pcspkr/input/input2/uevent | 6 + test/sys/devices/platform/pcspkr/input/input2/uniq | 1 + test/sys/devices/platform/pcspkr/modalias | 1 + test/sys/devices/platform/pcspkr/power/wakeup | 1 + test/sys/devices/platform/pcspkr/subsystem | 1 + test/sys/devices/platform/pcspkr/uevent | 2 + test/sys/devices/platform/power/wakeup | 1 + test/sys/devices/platform/serial8250/driver | 1 + test/sys/devices/platform/serial8250/modalias | 1 + test/sys/devices/platform/serial8250/power/wakeup | 1 + test/sys/devices/platform/serial8250/subsystem | 1 + test/sys/devices/platform/serial8250/tty/ttyS0/dev | 1 + .../devices/platform/serial8250/tty/ttyS0/device | 1 + .../platform/serial8250/tty/ttyS0/power/wakeup | 1 + .../platform/serial8250/tty/ttyS0/subsystem | 1 + .../devices/platform/serial8250/tty/ttyS0/uevent | 2 + test/sys/devices/platform/serial8250/tty/ttyS1/dev | 1 + .../devices/platform/serial8250/tty/ttyS1/device | 1 + .../platform/serial8250/tty/ttyS1/power/wakeup | 1 + .../platform/serial8250/tty/ttyS1/subsystem | 1 + .../devices/platform/serial8250/tty/ttyS1/uevent | 2 + test/sys/devices/platform/serial8250/tty/ttyS2/dev | 1 + .../devices/platform/serial8250/tty/ttyS2/device | 1 + .../platform/serial8250/tty/ttyS2/power/wakeup | 1 + .../platform/serial8250/tty/ttyS2/subsystem | 1 + .../devices/platform/serial8250/tty/ttyS2/uevent | 2 + test/sys/devices/platform/serial8250/tty/ttyS3/dev | 1 + .../devices/platform/serial8250/tty/ttyS3/device | 1 + .../platform/serial8250/tty/ttyS3/power/wakeup | 1 + .../platform/serial8250/tty/ttyS3/subsystem | 1 + .../devices/platform/serial8250/tty/ttyS3/uevent | 2 + test/sys/devices/platform/serial8250/uevent | 2 + .../platform/thinkpad_acpi/bluetooth_enable | 1 + test/sys/devices/platform/thinkpad_acpi/driver | 1 + .../devices/platform/thinkpad_acpi/hotkey_all_mask | 1 + .../platform/thinkpad_acpi/hotkey_bios_enabled | 1 + .../platform/thinkpad_acpi/hotkey_bios_mask | 1 + .../devices/platform/thinkpad_acpi/hotkey_enable | 1 + .../sys/devices/platform/thinkpad_acpi/hotkey_mask | 1 + .../platform/thinkpad_acpi/hotkey_poll_freq | 1 + .../devices/platform/thinkpad_acpi/hotkey_radio_sw | 1 + .../platform/thinkpad_acpi/hotkey_recommended_mask | 1 + .../platform/thinkpad_acpi/hotkey_report_mode | 1 + .../platform/thinkpad_acpi/hotkey_source_mask | 1 + .../leds/tpacpi::bay_active/brightness | Bin 0 -> 3 bytes .../thinkpad_acpi/leds/tpacpi::bay_active/device | 1 + .../leds/tpacpi::bay_active/power/wakeup | 1 + .../leds/tpacpi::bay_active/subsystem | 1 + .../thinkpad_acpi/leds/tpacpi::bay_active/trigger | 1 + .../thinkpad_acpi/leds/tpacpi::bay_active/uevent | 0 .../leds/tpacpi::dock_active/brightness | Bin 0 -> 3 bytes .../thinkpad_acpi/leds/tpacpi::dock_active/device | 1 + .../leds/tpacpi::dock_active/power/wakeup | 1 + .../leds/tpacpi::dock_active/subsystem | 1 + .../thinkpad_acpi/leds/tpacpi::dock_active/trigger | 1 + .../thinkpad_acpi/leds/tpacpi::dock_active/uevent | 0 .../leds/tpacpi::dock_batt/brightness | Bin 0 -> 3 bytes .../thinkpad_acpi/leds/tpacpi::dock_batt/device | 1 + .../leds/tpacpi::dock_batt/power/wakeup | 1 + .../thinkpad_acpi/leds/tpacpi::dock_batt/subsystem | 1 + .../thinkpad_acpi/leds/tpacpi::dock_batt/trigger | 1 + .../thinkpad_acpi/leds/tpacpi::dock_batt/uevent | 0 .../thinkpad_acpi/leds/tpacpi::power/brightness | Bin 0 -> 3 bytes .../thinkpad_acpi/leds/tpacpi::power/device | 1 + .../thinkpad_acpi/leds/tpacpi::power/power/wakeup | 1 + .../thinkpad_acpi/leds/tpacpi::power/subsystem | 1 + .../thinkpad_acpi/leds/tpacpi::power/trigger | 1 + .../thinkpad_acpi/leds/tpacpi::power/uevent | 0 .../thinkpad_acpi/leds/tpacpi::standby/brightness | Bin 0 -> 3 bytes .../thinkpad_acpi/leds/tpacpi::standby/device | 1 + .../leds/tpacpi::standby/power/wakeup | 1 + .../thinkpad_acpi/leds/tpacpi::standby/subsystem | 1 + .../thinkpad_acpi/leds/tpacpi::standby/trigger | 1 + .../thinkpad_acpi/leds/tpacpi::standby/uevent | 0 .../leds/tpacpi::thinklight/brightness | Bin 0 -> 5 bytes .../thinkpad_acpi/leds/tpacpi::thinklight/device | 1 + .../leds/tpacpi::thinklight/power/wakeup | 1 + .../leds/tpacpi::thinklight/subsystem | 1 + .../thinkpad_acpi/leds/tpacpi::thinklight/trigger | 1 + .../thinkpad_acpi/leds/tpacpi::thinklight/uevent | 0 .../leds/tpacpi::unknown_led/brightness | Bin 0 -> 3 bytes .../thinkpad_acpi/leds/tpacpi::unknown_led/device | 1 + .../leds/tpacpi::unknown_led/power/wakeup | 1 + .../leds/tpacpi::unknown_led/subsystem | 1 + .../thinkpad_acpi/leds/tpacpi::unknown_led/trigger | 1 + .../thinkpad_acpi/leds/tpacpi::unknown_led/uevent | 0 .../leds/tpacpi:green:batt/brightness | Bin 0 -> 3 bytes .../thinkpad_acpi/leds/tpacpi:green:batt/device | 1 + .../leds/tpacpi:green:batt/power/wakeup | 1 + .../thinkpad_acpi/leds/tpacpi:green:batt/subsystem | 1 + .../thinkpad_acpi/leds/tpacpi:green:batt/trigger | 1 + .../thinkpad_acpi/leds/tpacpi:green:batt/uevent | 0 .../leds/tpacpi:orange:batt/brightness | Bin 0 -> 3 bytes .../thinkpad_acpi/leds/tpacpi:orange:batt/device | 1 + .../leds/tpacpi:orange:batt/power/wakeup | 1 + .../leds/tpacpi:orange:batt/subsystem | 1 + .../thinkpad_acpi/leds/tpacpi:orange:batt/trigger | 1 + .../thinkpad_acpi/leds/tpacpi:orange:batt/uevent | 0 test/sys/devices/platform/thinkpad_acpi/modalias | 1 + .../devices/platform/thinkpad_acpi/power/wakeup | 1 + .../platform/thinkpad_acpi/rfkill/rfkill0/claim | 1 + .../platform/thinkpad_acpi/rfkill/rfkill0/device | 1 + .../platform/thinkpad_acpi/rfkill/rfkill0/name | 1 + .../thinkpad_acpi/rfkill/rfkill0/power/wakeup | 1 + .../platform/thinkpad_acpi/rfkill/rfkill0/state | 1 + .../thinkpad_acpi/rfkill/rfkill0/subsystem | 1 + .../platform/thinkpad_acpi/rfkill/rfkill0/type | 1 + .../platform/thinkpad_acpi/rfkill/rfkill0/uevent | 3 + test/sys/devices/platform/thinkpad_acpi/subsystem | 1 + test/sys/devices/platform/thinkpad_acpi/uevent | 2 + .../thinkpad_acpi/wakeup_hotunplug_complete | 1 + .../devices/platform/thinkpad_acpi/wakeup_reason | 1 + test/sys/devices/platform/thinkpad_hwmon/driver | 1 + .../sys/devices/platform/thinkpad_hwmon/fan1_input | 1 + .../platform/thinkpad_hwmon/hwmon/hwmon0/device | 1 + .../thinkpad_hwmon/hwmon/hwmon0/power/wakeup | 1 + .../platform/thinkpad_hwmon/hwmon/hwmon0/subsystem | 1 + .../platform/thinkpad_hwmon/hwmon/hwmon0/uevent | 0 test/sys/devices/platform/thinkpad_hwmon/modalias | 1 + test/sys/devices/platform/thinkpad_hwmon/name | 1 + .../devices/platform/thinkpad_hwmon/power/wakeup | 1 + test/sys/devices/platform/thinkpad_hwmon/pwm1 | 1 + .../devices/platform/thinkpad_hwmon/pwm1_enable | 1 + test/sys/devices/platform/thinkpad_hwmon/subsystem | 1 + .../devices/platform/thinkpad_hwmon/temp10_input | 1 + .../devices/platform/thinkpad_hwmon/temp11_input | 1 + .../devices/platform/thinkpad_hwmon/temp12_input | 0 .../devices/platform/thinkpad_hwmon/temp13_input | 0 .../devices/platform/thinkpad_hwmon/temp14_input | 0 .../devices/platform/thinkpad_hwmon/temp15_input | 0 .../devices/platform/thinkpad_hwmon/temp16_input | 0 .../devices/platform/thinkpad_hwmon/temp1_input | 1 + .../devices/platform/thinkpad_hwmon/temp2_input | 1 + .../devices/platform/thinkpad_hwmon/temp3_input | 1 + .../devices/platform/thinkpad_hwmon/temp4_input | 1 + .../devices/platform/thinkpad_hwmon/temp5_input | 1 + .../devices/platform/thinkpad_hwmon/temp6_input | 0 .../devices/platform/thinkpad_hwmon/temp7_input | 1 + .../devices/platform/thinkpad_hwmon/temp8_input | 0 .../devices/platform/thinkpad_hwmon/temp9_input | 1 + test/sys/devices/platform/thinkpad_hwmon/uevent | 2 + test/sys/devices/platform/uevent | 0 test/sys/devices/platform/vesafb.0/driver | 1 + .../platform/vesafb.0/graphics/fb0/bits_per_pixel | 1 + .../devices/platform/vesafb.0/graphics/fb0/blank | 0 .../devices/platform/vesafb.0/graphics/fb0/console | 0 .../devices/platform/vesafb.0/graphics/fb0/cursor | 0 .../sys/devices/platform/vesafb.0/graphics/fb0/dev | 1 + .../devices/platform/vesafb.0/graphics/fb0/device | 1 + .../devices/platform/vesafb.0/graphics/fb0/mode | 0 .../devices/platform/vesafb.0/graphics/fb0/modes | 1 + .../devices/platform/vesafb.0/graphics/fb0/name | 1 + .../sys/devices/platform/vesafb.0/graphics/fb0/pan | 1 + .../platform/vesafb.0/graphics/fb0/power/wakeup | 1 + .../devices/platform/vesafb.0/graphics/fb0/rotate | 1 + .../devices/platform/vesafb.0/graphics/fb0/state | 1 + .../devices/platform/vesafb.0/graphics/fb0/stride | 1 + .../platform/vesafb.0/graphics/fb0/subsystem | 1 + .../devices/platform/vesafb.0/graphics/fb0/uevent | 2 + .../platform/vesafb.0/graphics/fb0/virtual_size | 1 + test/sys/devices/platform/vesafb.0/modalias | 1 + test/sys/devices/platform/vesafb.0/power/wakeup | 1 + test/sys/devices/platform/vesafb.0/subsystem | 1 + test/sys/devices/platform/vesafb.0/uevent | 2 + test/sys/devices/pnp0/00:00/driver | 1 + test/sys/devices/pnp0/00:00/firmware_node | 1 + test/sys/devices/pnp0/00:00/id | 1 + test/sys/devices/pnp0/00:00/options | 0 test/sys/devices/pnp0/00:00/power/wakeup | 1 + test/sys/devices/pnp0/00:00/resources | 18 + test/sys/devices/pnp0/00:00/subsystem | 1 + test/sys/devices/pnp0/00:00/uevent | 1 + test/sys/devices/pnp0/00:01/id | 2 + test/sys/devices/pnp0/00:01/options | 0 test/sys/devices/pnp0/00:01/power/wakeup | 1 + test/sys/devices/pnp0/00:01/resources | 2 + test/sys/devices/pnp0/00:01/subsystem | 1 + test/sys/devices/pnp0/00:01/uevent | 0 test/sys/devices/pnp0/00:02/driver | 1 + test/sys/devices/pnp0/00:02/firmware_node | 1 + test/sys/devices/pnp0/00:02/id | 1 + test/sys/devices/pnp0/00:02/options | 0 test/sys/devices/pnp0/00:02/power/wakeup | 1 + test/sys/devices/pnp0/00:02/resources | 30 + test/sys/devices/pnp0/00:02/subsystem | 1 + test/sys/devices/pnp0/00:02/uevent | 1 + test/sys/devices/pnp0/00:03/firmware_node | 1 + test/sys/devices/pnp0/00:03/id | 1 + test/sys/devices/pnp0/00:03/options | 0 test/sys/devices/pnp0/00:03/power/wakeup | 1 + test/sys/devices/pnp0/00:03/resources | 2 + test/sys/devices/pnp0/00:03/subsystem | 1 + test/sys/devices/pnp0/00:03/uevent | 0 test/sys/devices/pnp0/00:04/firmware_node | 1 + test/sys/devices/pnp0/00:04/id | 1 + test/sys/devices/pnp0/00:04/options | 0 test/sys/devices/pnp0/00:04/power/wakeup | 1 + test/sys/devices/pnp0/00:04/resources | 5 + test/sys/devices/pnp0/00:04/subsystem | 1 + test/sys/devices/pnp0/00:04/uevent | 0 test/sys/devices/pnp0/00:05/firmware_node | 1 + test/sys/devices/pnp0/00:05/id | 1 + test/sys/devices/pnp0/00:05/options | 0 test/sys/devices/pnp0/00:05/power/wakeup | 1 + test/sys/devices/pnp0/00:05/resources | 2 + test/sys/devices/pnp0/00:05/subsystem | 1 + test/sys/devices/pnp0/00:05/uevent | 0 test/sys/devices/pnp0/00:06/firmware_node | 1 + test/sys/devices/pnp0/00:06/id | 1 + test/sys/devices/pnp0/00:06/options | 0 test/sys/devices/pnp0/00:06/power/wakeup | 1 + test/sys/devices/pnp0/00:06/resources | 3 + test/sys/devices/pnp0/00:06/subsystem | 1 + test/sys/devices/pnp0/00:06/uevent | 0 test/sys/devices/pnp0/00:07/driver | 1 + test/sys/devices/pnp0/00:07/firmware_node | 1 + test/sys/devices/pnp0/00:07/id | 1 + test/sys/devices/pnp0/00:07/nvram | Bin 0 -> 114 bytes test/sys/devices/pnp0/00:07/options | 0 test/sys/devices/pnp0/00:07/power/wakeup | 1 + test/sys/devices/pnp0/00:07/resources | 3 + test/sys/devices/pnp0/00:07/rtc/rtc0/date | 1 + test/sys/devices/pnp0/00:07/rtc/rtc0/dev | 1 + test/sys/devices/pnp0/00:07/rtc/rtc0/device | 1 + test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq | 1 + test/sys/devices/pnp0/00:07/rtc/rtc0/name | 1 + test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup | 1 + test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch | 1 + test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem | 1 + test/sys/devices/pnp0/00:07/rtc/rtc0/time | 1 + test/sys/devices/pnp0/00:07/rtc/rtc0/uevent | 2 + test/sys/devices/pnp0/00:07/rtc/rtc0/wakealarm | 0 test/sys/devices/pnp0/00:07/subsystem | 1 + test/sys/devices/pnp0/00:07/uevent | 1 + test/sys/devices/pnp0/00:08/driver | 1 + test/sys/devices/pnp0/00:08/firmware_node | 1 + test/sys/devices/pnp0/00:08/id | 1 + test/sys/devices/pnp0/00:08/options | 0 test/sys/devices/pnp0/00:08/power/wakeup | 1 + test/sys/devices/pnp0/00:08/resources | 4 + test/sys/devices/pnp0/00:08/subsystem | 1 + test/sys/devices/pnp0/00:08/uevent | 1 + test/sys/devices/pnp0/00:09/driver | 1 + test/sys/devices/pnp0/00:09/firmware_node | 1 + test/sys/devices/pnp0/00:09/id | 2 + test/sys/devices/pnp0/00:09/options | 0 test/sys/devices/pnp0/00:09/power/wakeup | 1 + test/sys/devices/pnp0/00:09/resources | 2 + test/sys/devices/pnp0/00:09/subsystem | 1 + test/sys/devices/pnp0/00:09/uevent | 1 + test/sys/devices/pnp0/00:0a/firmware_node | 1 + test/sys/devices/pnp0/00:0a/id | 2 + test/sys/devices/pnp0/00:0a/options | 0 test/sys/devices/pnp0/00:0a/power/wakeup | 1 + test/sys/devices/pnp0/00:0a/resources | 2 + test/sys/devices/pnp0/00:0a/subsystem | 1 + test/sys/devices/pnp0/00:0a/uevent | 0 test/sys/devices/pnp0/power/wakeup | 1 + test/sys/devices/pnp0/uevent | 0 .../clocksource/clocksource0/available_clocksource | 1 + .../clocksource/clocksource0/current_clocksource | 1 + .../cpu/cpu0/cache/index0/coherency_line_size | 1 + .../sys/devices/system/cpu/cpu0/cache/index0/level | 1 + .../system/cpu/cpu0/cache/index0/number_of_sets | 1 + .../cpu/cpu0/cache/index0/physical_line_partition | 1 + .../system/cpu/cpu0/cache/index0/shared_cpu_list | 1 + .../system/cpu/cpu0/cache/index0/shared_cpu_map | 1 + test/sys/devices/system/cpu/cpu0/cache/index0/size | 1 + test/sys/devices/system/cpu/cpu0/cache/index0/type | 1 + .../cpu/cpu0/cache/index0/ways_of_associativity | 1 + .../cpu/cpu0/cache/index1/coherency_line_size | 1 + .../sys/devices/system/cpu/cpu0/cache/index1/level | 1 + .../system/cpu/cpu0/cache/index1/number_of_sets | 1 + .../cpu/cpu0/cache/index1/physical_line_partition | 1 + .../system/cpu/cpu0/cache/index1/shared_cpu_list | 1 + .../system/cpu/cpu0/cache/index1/shared_cpu_map | 1 + test/sys/devices/system/cpu/cpu0/cache/index1/size | 1 + test/sys/devices/system/cpu/cpu0/cache/index1/type | 1 + .../cpu/cpu0/cache/index1/ways_of_associativity | 1 + .../cpu/cpu0/cache/index2/coherency_line_size | 1 + .../sys/devices/system/cpu/cpu0/cache/index2/level | 1 + .../system/cpu/cpu0/cache/index2/number_of_sets | 1 + .../cpu/cpu0/cache/index2/physical_line_partition | 1 + .../system/cpu/cpu0/cache/index2/shared_cpu_list | 1 + .../system/cpu/cpu0/cache/index2/shared_cpu_map | 1 + test/sys/devices/system/cpu/cpu0/cache/index2/size | 1 + test/sys/devices/system/cpu/cpu0/cache/index2/type | 1 + .../cpu/cpu0/cache/index2/ways_of_associativity | 1 + .../devices/system/cpu/cpu0/cpufreq/affected_cpus | 1 + .../system/cpu/cpu0/cpufreq/cpuinfo_cur_freq | 1 + .../system/cpu/cpu0/cpufreq/cpuinfo_max_freq | 1 + .../system/cpu/cpu0/cpufreq/cpuinfo_min_freq | 1 + .../cpu/cpu0/cpufreq/ondemand/ignore_nice_load | 1 + .../cpu/cpu0/cpufreq/ondemand/powersave_bias | 1 + .../system/cpu/cpu0/cpufreq/ondemand/sampling_rate | 1 + .../cpu/cpu0/cpufreq/ondemand/sampling_rate_max | 1 + .../cpu/cpu0/cpufreq/ondemand/sampling_rate_min | 1 + .../system/cpu/cpu0/cpufreq/ondemand/up_threshold | 1 + .../devices/system/cpu/cpu0/cpufreq/related_cpus | 1 + .../cpu/cpu0/cpufreq/scaling_available_frequencies | 1 + .../cpu/cpu0/cpufreq/scaling_available_governors | 1 + .../system/cpu/cpu0/cpufreq/scaling_cur_freq | 1 + .../devices/system/cpu/cpu0/cpufreq/scaling_driver | 1 + .../system/cpu/cpu0/cpufreq/scaling_governor | 1 + .../system/cpu/cpu0/cpufreq/scaling_max_freq | 1 + .../system/cpu/cpu0/cpufreq/scaling_min_freq | 1 + .../system/cpu/cpu0/cpufreq/scaling_setspeed | 1 + .../system/cpu/cpu0/cpufreq/stats/time_in_state | 5 + .../system/cpu/cpu0/cpufreq/stats/total_trans | 1 + .../devices/system/cpu/cpu0/cpuidle/state0/desc | 1 + .../devices/system/cpu/cpu0/cpuidle/state0/latency | 1 + .../devices/system/cpu/cpu0/cpuidle/state0/name | 1 + .../devices/system/cpu/cpu0/cpuidle/state0/power | 1 + .../devices/system/cpu/cpu0/cpuidle/state0/time | 1 + .../devices/system/cpu/cpu0/cpuidle/state0/usage | 1 + .../devices/system/cpu/cpu0/cpuidle/state1/desc | 1 + .../devices/system/cpu/cpu0/cpuidle/state1/latency | 1 + .../devices/system/cpu/cpu0/cpuidle/state1/name | 1 + .../devices/system/cpu/cpu0/cpuidle/state1/power | 1 + .../devices/system/cpu/cpu0/cpuidle/state1/time | 1 + .../devices/system/cpu/cpu0/cpuidle/state1/usage | 1 + .../devices/system/cpu/cpu0/cpuidle/state2/desc | 1 + .../devices/system/cpu/cpu0/cpuidle/state2/latency | 1 + .../devices/system/cpu/cpu0/cpuidle/state2/name | 1 + .../devices/system/cpu/cpu0/cpuidle/state2/power | 1 + .../devices/system/cpu/cpu0/cpuidle/state2/time | 1 + .../devices/system/cpu/cpu0/cpuidle/state2/usage | 1 + .../devices/system/cpu/cpu0/cpuidle/state3/desc | 1 + .../devices/system/cpu/cpu0/cpuidle/state3/latency | 1 + .../devices/system/cpu/cpu0/cpuidle/state3/name | 1 + .../devices/system/cpu/cpu0/cpuidle/state3/power | 1 + .../devices/system/cpu/cpu0/cpuidle/state3/time | 1 + .../devices/system/cpu/cpu0/cpuidle/state3/usage | 1 + test/sys/devices/system/cpu/cpu0/crash_notes | 1 + .../system/cpu/cpu0/microcode/processor_flags | 1 + test/sys/devices/system/cpu/cpu0/microcode/version | 1 + .../devices/system/cpu/cpu0/thermal_throttle/count | 1 + test/sys/devices/system/cpu/cpu0/topology/core_id | 1 + .../devices/system/cpu/cpu0/topology/core_siblings | 1 + .../system/cpu/cpu0/topology/core_siblings_list | 1 + .../system/cpu/cpu0/topology/physical_package_id | 1 + .../system/cpu/cpu0/topology/thread_siblings | 1 + .../system/cpu/cpu0/topology/thread_siblings_list | 1 + .../cpu/cpu1/cache/index0/coherency_line_size | 1 + .../sys/devices/system/cpu/cpu1/cache/index0/level | 1 + .../system/cpu/cpu1/cache/index0/number_of_sets | 1 + .../cpu/cpu1/cache/index0/physical_line_partition | 1 + .../system/cpu/cpu1/cache/index0/shared_cpu_list | 1 + .../system/cpu/cpu1/cache/index0/shared_cpu_map | 1 + test/sys/devices/system/cpu/cpu1/cache/index0/size | 1 + test/sys/devices/system/cpu/cpu1/cache/index0/type | 1 + .../cpu/cpu1/cache/index0/ways_of_associativity | 1 + .../cpu/cpu1/cache/index1/coherency_line_size | 1 + .../sys/devices/system/cpu/cpu1/cache/index1/level | 1 + .../system/cpu/cpu1/cache/index1/number_of_sets | 1 + .../cpu/cpu1/cache/index1/physical_line_partition | 1 + .../system/cpu/cpu1/cache/index1/shared_cpu_list | 1 + .../system/cpu/cpu1/cache/index1/shared_cpu_map | 1 + test/sys/devices/system/cpu/cpu1/cache/index1/size | 1 + test/sys/devices/system/cpu/cpu1/cache/index1/type | 1 + .../cpu/cpu1/cache/index1/ways_of_associativity | 1 + .../cpu/cpu1/cache/index2/coherency_line_size | 1 + .../sys/devices/system/cpu/cpu1/cache/index2/level | 1 + .../system/cpu/cpu1/cache/index2/number_of_sets | 1 + .../cpu/cpu1/cache/index2/physical_line_partition | 1 + .../system/cpu/cpu1/cache/index2/shared_cpu_list | 1 + .../system/cpu/cpu1/cache/index2/shared_cpu_map | 1 + test/sys/devices/system/cpu/cpu1/cache/index2/size | 1 + test/sys/devices/system/cpu/cpu1/cache/index2/type | 1 + .../cpu/cpu1/cache/index2/ways_of_associativity | 1 + test/sys/devices/system/cpu/cpu1/cpufreq | 1 + .../devices/system/cpu/cpu1/cpuidle/state0/desc | 1 + .../devices/system/cpu/cpu1/cpuidle/state0/latency | 1 + .../devices/system/cpu/cpu1/cpuidle/state0/name | 1 + .../devices/system/cpu/cpu1/cpuidle/state0/power | 1 + .../devices/system/cpu/cpu1/cpuidle/state0/time | 1 + .../devices/system/cpu/cpu1/cpuidle/state0/usage | 1 + .../devices/system/cpu/cpu1/cpuidle/state1/desc | 1 + .../devices/system/cpu/cpu1/cpuidle/state1/latency | 1 + .../devices/system/cpu/cpu1/cpuidle/state1/name | 1 + .../devices/system/cpu/cpu1/cpuidle/state1/power | 1 + .../devices/system/cpu/cpu1/cpuidle/state1/time | 1 + .../devices/system/cpu/cpu1/cpuidle/state1/usage | 1 + .../devices/system/cpu/cpu1/cpuidle/state2/desc | 1 + .../devices/system/cpu/cpu1/cpuidle/state2/latency | 1 + .../devices/system/cpu/cpu1/cpuidle/state2/name | 1 + .../devices/system/cpu/cpu1/cpuidle/state2/power | 1 + .../devices/system/cpu/cpu1/cpuidle/state2/time | 1 + .../devices/system/cpu/cpu1/cpuidle/state2/usage | 1 + .../devices/system/cpu/cpu1/cpuidle/state3/desc | 1 + .../devices/system/cpu/cpu1/cpuidle/state3/latency | 1 + .../devices/system/cpu/cpu1/cpuidle/state3/name | 1 + .../devices/system/cpu/cpu1/cpuidle/state3/power | 1 + .../devices/system/cpu/cpu1/cpuidle/state3/time | 1 + .../devices/system/cpu/cpu1/cpuidle/state3/usage | 1 + test/sys/devices/system/cpu/cpu1/crash_notes | 1 + .../system/cpu/cpu1/microcode/processor_flags | 1 + test/sys/devices/system/cpu/cpu1/microcode/version | 1 + test/sys/devices/system/cpu/cpu1/online | 1 + .../devices/system/cpu/cpu1/thermal_throttle/count | 1 + test/sys/devices/system/cpu/cpu1/topology/core_id | 1 + .../devices/system/cpu/cpu1/topology/core_siblings | 1 + .../system/cpu/cpu1/topology/core_siblings_list | 1 + .../system/cpu/cpu1/topology/physical_package_id | 1 + .../system/cpu/cpu1/topology/thread_siblings | 1 + .../system/cpu/cpu1/topology/thread_siblings_list | 1 + test/sys/devices/system/cpu/cpuidle/current_driver | 1 + .../devices/system/cpu/cpuidle/current_governor_ro | 1 + test/sys/devices/system/cpu/online | 1 + test/sys/devices/system/cpu/possible | 1 + test/sys/devices/system/cpu/present | 1 + test/sys/devices/system/cpu/sched_mc_power_savings | 1 + .../system/machinecheck/machinecheck0/bank0ctl | 1 + .../system/machinecheck/machinecheck0/bank1ctl | 1 + .../system/machinecheck/machinecheck0/bank2ctl | 1 + .../system/machinecheck/machinecheck0/bank3ctl | 1 + .../system/machinecheck/machinecheck0/bank4ctl | 1 + .../system/machinecheck/machinecheck0/bank5ctl | 1 + .../machinecheck/machinecheck0/check_interval | 1 + .../system/machinecheck/machinecheck0/tolerant | 1 + .../system/machinecheck/machinecheck0/trigger | 1 + .../system/machinecheck/machinecheck1/bank0ctl | 1 + .../system/machinecheck/machinecheck1/bank1ctl | 1 + .../system/machinecheck/machinecheck1/bank2ctl | 1 + .../system/machinecheck/machinecheck1/bank3ctl | 1 + .../system/machinecheck/machinecheck1/bank4ctl | 1 + .../system/machinecheck/machinecheck1/bank5ctl | 1 + .../machinecheck/machinecheck1/check_interval | 1 + .../system/machinecheck/machinecheck1/tolerant | 1 + .../system/machinecheck/machinecheck1/trigger | 1 + test/sys/devices/virtual/bdi/0:16/max_ratio | 1 + test/sys/devices/virtual/bdi/0:16/min_ratio | 1 + test/sys/devices/virtual/bdi/0:16/power/wakeup | 1 + test/sys/devices/virtual/bdi/0:16/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/0:16/subsystem | 1 + test/sys/devices/virtual/bdi/0:16/uevent | 0 test/sys/devices/virtual/bdi/11:0/max_ratio | 1 + test/sys/devices/virtual/bdi/11:0/min_ratio | 1 + test/sys/devices/virtual/bdi/11:0/power/wakeup | 1 + test/sys/devices/virtual/bdi/11:0/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/11:0/subsystem | 1 + test/sys/devices/virtual/bdi/11:0/uevent | 0 test/sys/devices/virtual/bdi/7:0/max_ratio | 1 + test/sys/devices/virtual/bdi/7:0/min_ratio | 1 + test/sys/devices/virtual/bdi/7:0/power/wakeup | 1 + test/sys/devices/virtual/bdi/7:0/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/7:0/subsystem | 1 + test/sys/devices/virtual/bdi/7:0/uevent | 0 test/sys/devices/virtual/bdi/7:1/max_ratio | 1 + test/sys/devices/virtual/bdi/7:1/min_ratio | 1 + test/sys/devices/virtual/bdi/7:1/power/wakeup | 1 + test/sys/devices/virtual/bdi/7:1/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/7:1/subsystem | 1 + test/sys/devices/virtual/bdi/7:1/uevent | 0 test/sys/devices/virtual/bdi/7:2/max_ratio | 1 + test/sys/devices/virtual/bdi/7:2/min_ratio | 1 + test/sys/devices/virtual/bdi/7:2/power/wakeup | 1 + test/sys/devices/virtual/bdi/7:2/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/7:2/subsystem | 1 + test/sys/devices/virtual/bdi/7:2/uevent | 0 test/sys/devices/virtual/bdi/7:3/max_ratio | 1 + test/sys/devices/virtual/bdi/7:3/min_ratio | 1 + test/sys/devices/virtual/bdi/7:3/power/wakeup | 1 + test/sys/devices/virtual/bdi/7:3/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/7:3/subsystem | 1 + test/sys/devices/virtual/bdi/7:3/uevent | 0 test/sys/devices/virtual/bdi/7:4/max_ratio | 1 + test/sys/devices/virtual/bdi/7:4/min_ratio | 1 + test/sys/devices/virtual/bdi/7:4/power/wakeup | 1 + test/sys/devices/virtual/bdi/7:4/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/7:4/subsystem | 1 + test/sys/devices/virtual/bdi/7:4/uevent | 0 test/sys/devices/virtual/bdi/7:5/max_ratio | 1 + test/sys/devices/virtual/bdi/7:5/min_ratio | 1 + test/sys/devices/virtual/bdi/7:5/power/wakeup | 1 + test/sys/devices/virtual/bdi/7:5/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/7:5/subsystem | 1 + test/sys/devices/virtual/bdi/7:5/uevent | 0 test/sys/devices/virtual/bdi/7:6/max_ratio | 1 + test/sys/devices/virtual/bdi/7:6/min_ratio | 1 + test/sys/devices/virtual/bdi/7:6/power/wakeup | 1 + test/sys/devices/virtual/bdi/7:6/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/7:6/subsystem | 1 + test/sys/devices/virtual/bdi/7:6/uevent | 0 test/sys/devices/virtual/bdi/7:7/max_ratio | 1 + test/sys/devices/virtual/bdi/7:7/min_ratio | 1 + test/sys/devices/virtual/bdi/7:7/power/wakeup | 1 + test/sys/devices/virtual/bdi/7:7/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/7:7/subsystem | 1 + test/sys/devices/virtual/bdi/7:7/uevent | 0 test/sys/devices/virtual/bdi/8:0/max_ratio | 1 + test/sys/devices/virtual/bdi/8:0/min_ratio | 1 + test/sys/devices/virtual/bdi/8:0/power/wakeup | 1 + test/sys/devices/virtual/bdi/8:0/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/8:0/subsystem | 1 + test/sys/devices/virtual/bdi/8:0/uevent | 0 test/sys/devices/virtual/bdi/8:16/max_ratio | 1 + test/sys/devices/virtual/bdi/8:16/min_ratio | 1 + test/sys/devices/virtual/bdi/8:16/power/wakeup | 1 + test/sys/devices/virtual/bdi/8:16/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/8:16/subsystem | 1 + test/sys/devices/virtual/bdi/8:16/uevent | 0 test/sys/devices/virtual/bdi/9:0/max_ratio | 1 + test/sys/devices/virtual/bdi/9:0/min_ratio | 1 + test/sys/devices/virtual/bdi/9:0/power/wakeup | 1 + test/sys/devices/virtual/bdi/9:0/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/9:0/subsystem | 1 + test/sys/devices/virtual/bdi/9:0/uevent | 0 test/sys/devices/virtual/bdi/default/max_ratio | 1 + test/sys/devices/virtual/bdi/default/min_ratio | 1 + test/sys/devices/virtual/bdi/default/power/wakeup | 1 + test/sys/devices/virtual/bdi/default/read_ahead_kb | 1 + test/sys/devices/virtual/bdi/default/subsystem | 1 + test/sys/devices/virtual/bdi/default/uevent | 0 .../virtual/block/fake!blockdev0/capability | 1 + test/sys/devices/virtual/block/fake!blockdev0/dev | 1 + .../sys/devices/virtual/block/fake!blockdev0/range | 1 + .../devices/virtual/block/fake!blockdev0/removable | 1 + test/sys/devices/virtual/block/fake!blockdev0/ro | 1 + test/sys/devices/virtual/block/fake!blockdev0/size | 1 + test/sys/devices/virtual/block/fake!blockdev0/stat | 1 + .../devices/virtual/block/fake!blockdev0/subsystem | 1 + .../devices/virtual/block/fake!blockdev0/uevent | 3 + test/sys/devices/virtual/block/loop0/bdi | 1 + test/sys/devices/virtual/block/loop0/capability | 1 + test/sys/devices/virtual/block/loop0/dev | 1 + test/sys/devices/virtual/block/loop0/make-it-fail | 1 + test/sys/devices/virtual/block/loop0/power/wakeup | 1 + test/sys/devices/virtual/block/loop0/range | 1 + test/sys/devices/virtual/block/loop0/removable | 1 + test/sys/devices/virtual/block/loop0/ro | 1 + test/sys/devices/virtual/block/loop0/size | 1 + test/sys/devices/virtual/block/loop0/stat | 1 + test/sys/devices/virtual/block/loop0/subsystem | 1 + test/sys/devices/virtual/block/loop0/uevent | 3 + test/sys/devices/virtual/block/loop1/bdi | 1 + test/sys/devices/virtual/block/loop1/capability | 1 + test/sys/devices/virtual/block/loop1/dev | 1 + test/sys/devices/virtual/block/loop1/make-it-fail | 1 + test/sys/devices/virtual/block/loop1/power/wakeup | 1 + test/sys/devices/virtual/block/loop1/range | 1 + test/sys/devices/virtual/block/loop1/removable | 1 + test/sys/devices/virtual/block/loop1/ro | 1 + test/sys/devices/virtual/block/loop1/size | 1 + test/sys/devices/virtual/block/loop1/stat | 1 + test/sys/devices/virtual/block/loop1/subsystem | 1 + test/sys/devices/virtual/block/loop1/uevent | 3 + test/sys/devices/virtual/block/loop2/bdi | 1 + test/sys/devices/virtual/block/loop2/capability | 1 + test/sys/devices/virtual/block/loop2/dev | 1 + test/sys/devices/virtual/block/loop2/make-it-fail | 1 + test/sys/devices/virtual/block/loop2/power/wakeup | 1 + test/sys/devices/virtual/block/loop2/range | 1 + test/sys/devices/virtual/block/loop2/removable | 1 + test/sys/devices/virtual/block/loop2/ro | 1 + test/sys/devices/virtual/block/loop2/size | 1 + test/sys/devices/virtual/block/loop2/stat | 1 + test/sys/devices/virtual/block/loop2/subsystem | 1 + test/sys/devices/virtual/block/loop2/uevent | 3 + test/sys/devices/virtual/block/loop3/bdi | 1 + test/sys/devices/virtual/block/loop3/capability | 1 + test/sys/devices/virtual/block/loop3/dev | 1 + test/sys/devices/virtual/block/loop3/make-it-fail | 1 + test/sys/devices/virtual/block/loop3/power/wakeup | 1 + test/sys/devices/virtual/block/loop3/range | 1 + test/sys/devices/virtual/block/loop3/removable | 1 + test/sys/devices/virtual/block/loop3/ro | 1 + test/sys/devices/virtual/block/loop3/size | 1 + test/sys/devices/virtual/block/loop3/stat | 1 + test/sys/devices/virtual/block/loop3/subsystem | 1 + test/sys/devices/virtual/block/loop3/uevent | 3 + test/sys/devices/virtual/block/loop4/bdi | 1 + test/sys/devices/virtual/block/loop4/capability | 1 + test/sys/devices/virtual/block/loop4/dev | 1 + test/sys/devices/virtual/block/loop4/make-it-fail | 1 + test/sys/devices/virtual/block/loop4/power/wakeup | 1 + test/sys/devices/virtual/block/loop4/range | 1 + test/sys/devices/virtual/block/loop4/removable | 1 + test/sys/devices/virtual/block/loop4/ro | 1 + test/sys/devices/virtual/block/loop4/size | 1 + test/sys/devices/virtual/block/loop4/stat | 1 + test/sys/devices/virtual/block/loop4/subsystem | 1 + test/sys/devices/virtual/block/loop4/uevent | 3 + test/sys/devices/virtual/block/loop5/bdi | 1 + test/sys/devices/virtual/block/loop5/capability | 1 + test/sys/devices/virtual/block/loop5/dev | 1 + test/sys/devices/virtual/block/loop5/make-it-fail | 1 + test/sys/devices/virtual/block/loop5/power/wakeup | 1 + test/sys/devices/virtual/block/loop5/range | 1 + test/sys/devices/virtual/block/loop5/removable | 1 + test/sys/devices/virtual/block/loop5/ro | 1 + test/sys/devices/virtual/block/loop5/size | 1 + test/sys/devices/virtual/block/loop5/stat | 1 + test/sys/devices/virtual/block/loop5/subsystem | 1 + test/sys/devices/virtual/block/loop5/uevent | 3 + test/sys/devices/virtual/block/loop6/bdi | 1 + test/sys/devices/virtual/block/loop6/capability | 1 + test/sys/devices/virtual/block/loop6/dev | 1 + test/sys/devices/virtual/block/loop6/make-it-fail | 1 + test/sys/devices/virtual/block/loop6/power/wakeup | 1 + test/sys/devices/virtual/block/loop6/range | 1 + test/sys/devices/virtual/block/loop6/removable | 1 + test/sys/devices/virtual/block/loop6/ro | 1 + test/sys/devices/virtual/block/loop6/size | 1 + test/sys/devices/virtual/block/loop6/stat | 1 + test/sys/devices/virtual/block/loop6/subsystem | 1 + test/sys/devices/virtual/block/loop6/uevent | 3 + test/sys/devices/virtual/block/loop7/bdi | 1 + test/sys/devices/virtual/block/loop7/capability | 1 + test/sys/devices/virtual/block/loop7/dev | 1 + test/sys/devices/virtual/block/loop7/make-it-fail | 1 + test/sys/devices/virtual/block/loop7/power/wakeup | 1 + test/sys/devices/virtual/block/loop7/range | 1 + test/sys/devices/virtual/block/loop7/removable | 1 + test/sys/devices/virtual/block/loop7/ro | 1 + test/sys/devices/virtual/block/loop7/size | 1 + test/sys/devices/virtual/block/loop7/stat | 1 + test/sys/devices/virtual/block/loop7/subsystem | 1 + test/sys/devices/virtual/block/loop7/uevent | 3 + test/sys/devices/virtual/block/md0/bdi | 1 + test/sys/devices/virtual/block/md0/capability | 1 + test/sys/devices/virtual/block/md0/dev | 1 + test/sys/devices/virtual/block/md0/make-it-fail | 1 + test/sys/devices/virtual/block/md0/md/array_state | 1 + test/sys/devices/virtual/block/md0/md/chunk_size | 1 + .../devices/virtual/block/md0/md/component_size | 1 + test/sys/devices/virtual/block/md0/md/degraded | 1 + .../devices/virtual/block/md0/md/dev-sda9/block | 1 + .../devices/virtual/block/md0/md/dev-sda9/errors | 1 + .../devices/virtual/block/md0/md/dev-sda9/offset | 1 + .../sys/devices/virtual/block/md0/md/dev-sda9/size | 1 + .../sys/devices/virtual/block/md0/md/dev-sda9/slot | 1 + .../devices/virtual/block/md0/md/dev-sda9/state | 1 + test/sys/devices/virtual/block/md0/md/layout | 1 + test/sys/devices/virtual/block/md0/md/level | 1 + .../devices/virtual/block/md0/md/metadata_version | 1 + test/sys/devices/virtual/block/md0/md/mismatch_cnt | 1 + test/sys/devices/virtual/block/md0/md/raid_disks | 1 + test/sys/devices/virtual/block/md0/md/rd1 | 1 + .../devices/virtual/block/md0/md/reshape_position | 1 + test/sys/devices/virtual/block/md0/md/resync_start | 1 + .../devices/virtual/block/md0/md/safe_mode_delay | 1 + test/sys/devices/virtual/block/md0/md/suspend_hi | 1 + test/sys/devices/virtual/block/md0/md/suspend_lo | 1 + test/sys/devices/virtual/block/md0/md/sync_action | 1 + .../devices/virtual/block/md0/md/sync_completed | 1 + .../virtual/block/md0/md/sync_force_parallel | 1 + test/sys/devices/virtual/block/md0/md/sync_max | 1 + test/sys/devices/virtual/block/md0/md/sync_min | 1 + test/sys/devices/virtual/block/md0/md/sync_speed | 1 + .../devices/virtual/block/md0/md/sync_speed_max | 1 + .../devices/virtual/block/md0/md/sync_speed_min | 1 + test/sys/devices/virtual/block/md0/power/wakeup | 1 + test/sys/devices/virtual/block/md0/range | 1 + test/sys/devices/virtual/block/md0/removable | 1 + test/sys/devices/virtual/block/md0/ro | 1 + test/sys/devices/virtual/block/md0/size | 1 + test/sys/devices/virtual/block/md0/slaves/sda9 | 1 + test/sys/devices/virtual/block/md0/stat | 1 + test/sys/devices/virtual/block/md0/subsystem | 1 + test/sys/devices/virtual/block/md0/uevent | 3 + test/sys/devices/virtual/dmi/id/bios_date | 1 + test/sys/devices/virtual/dmi/id/bios_vendor | 1 + test/sys/devices/virtual/dmi/id/bios_version | 1 + test/sys/devices/virtual/dmi/id/board_asset_tag | 1 + test/sys/devices/virtual/dmi/id/board_name | 1 + test/sys/devices/virtual/dmi/id/board_serial | 1 + test/sys/devices/virtual/dmi/id/board_vendor | 1 + test/sys/devices/virtual/dmi/id/board_version | 1 + test/sys/devices/virtual/dmi/id/chassis_asset_tag | 1 + test/sys/devices/virtual/dmi/id/chassis_serial | 1 + test/sys/devices/virtual/dmi/id/chassis_type | 1 + test/sys/devices/virtual/dmi/id/chassis_vendor | 1 + test/sys/devices/virtual/dmi/id/chassis_version | 1 + test/sys/devices/virtual/dmi/id/modalias | 1 + test/sys/devices/virtual/dmi/id/power/wakeup | 1 + test/sys/devices/virtual/dmi/id/product_name | 1 + test/sys/devices/virtual/dmi/id/product_serial | 1 + test/sys/devices/virtual/dmi/id/product_uuid | 1 + test/sys/devices/virtual/dmi/id/product_version | 1 + test/sys/devices/virtual/dmi/id/subsystem | 1 + test/sys/devices/virtual/dmi/id/sys_vendor | 1 + test/sys/devices/virtual/dmi/id/uevent | 1 + .../devices/virtual/graphics/fbcon/cursor_blink | 1 + .../devices/virtual/graphics/fbcon/power/wakeup | 1 + test/sys/devices/virtual/graphics/fbcon/rotate | 1 + test/sys/devices/virtual/graphics/fbcon/subsystem | 1 + test/sys/devices/virtual/graphics/fbcon/uevent | 0 .../devices/virtual/input/input6/capabilities/abs | 1 + .../devices/virtual/input/input6/capabilities/ev | 1 + .../devices/virtual/input/input6/capabilities/ff | 1 + .../devices/virtual/input/input6/capabilities/key | 1 + .../devices/virtual/input/input6/capabilities/led | 1 + .../devices/virtual/input/input6/capabilities/msc | 1 + .../devices/virtual/input/input6/capabilities/rel | 1 + .../devices/virtual/input/input6/capabilities/snd | 1 + .../devices/virtual/input/input6/capabilities/sw | 1 + test/sys/devices/virtual/input/input6/event6/dev | 1 + .../sys/devices/virtual/input/input6/event6/device | 1 + .../virtual/input/input6/event6/power/wakeup | 1 + .../devices/virtual/input/input6/event6/subsystem | 1 + .../sys/devices/virtual/input/input6/event6/uevent | 2 + test/sys/devices/virtual/input/input6/id/bustype | 1 + test/sys/devices/virtual/input/input6/id/product | 1 + test/sys/devices/virtual/input/input6/id/vendor | 1 + test/sys/devices/virtual/input/input6/id/version | 1 + test/sys/devices/virtual/input/input6/modalias | 1 + test/sys/devices/virtual/input/input6/name | 1 + test/sys/devices/virtual/input/input6/phys | 1 + test/sys/devices/virtual/input/input6/power/wakeup | 1 + test/sys/devices/virtual/input/input6/subsystem | 1 + test/sys/devices/virtual/input/input6/uevent | 8 + test/sys/devices/virtual/input/input6/uniq | 1 + test/sys/devices/virtual/input/mice/dev | 1 + test/sys/devices/virtual/input/mice/power/wakeup | 1 + test/sys/devices/virtual/input/mice/subsystem | 1 + test/sys/devices/virtual/input/mice/uevent | 2 + test/sys/devices/virtual/mem/full/dev | 1 + test/sys/devices/virtual/mem/full/power/wakeup | 1 + test/sys/devices/virtual/mem/full/subsystem | 1 + test/sys/devices/virtual/mem/full/uevent | 2 + test/sys/devices/virtual/mem/kmem/dev | 1 + test/sys/devices/virtual/mem/kmem/power/wakeup | 1 + test/sys/devices/virtual/mem/kmem/subsystem | 1 + test/sys/devices/virtual/mem/kmem/uevent | 2 + test/sys/devices/virtual/mem/kmsg/dev | 1 + test/sys/devices/virtual/mem/kmsg/power/wakeup | 1 + test/sys/devices/virtual/mem/kmsg/subsystem | 1 + test/sys/devices/virtual/mem/kmsg/uevent | 2 + test/sys/devices/virtual/mem/mem/dev | 1 + test/sys/devices/virtual/mem/mem/power/wakeup | 1 + test/sys/devices/virtual/mem/mem/subsystem | 1 + test/sys/devices/virtual/mem/mem/uevent | 2 + test/sys/devices/virtual/mem/null/dev | 1 + test/sys/devices/virtual/mem/null/power/wakeup | 1 + test/sys/devices/virtual/mem/null/subsystem | 1 + test/sys/devices/virtual/mem/null/uevent | 2 + test/sys/devices/virtual/mem/port/dev | 1 + test/sys/devices/virtual/mem/port/power/wakeup | 1 + test/sys/devices/virtual/mem/port/subsystem | 1 + test/sys/devices/virtual/mem/port/uevent | 2 + test/sys/devices/virtual/mem/random/dev | 1 + test/sys/devices/virtual/mem/random/power/wakeup | 1 + test/sys/devices/virtual/mem/random/subsystem | 1 + test/sys/devices/virtual/mem/random/uevent | 2 + test/sys/devices/virtual/mem/urandom/dev | 1 + test/sys/devices/virtual/mem/urandom/power/wakeup | 1 + test/sys/devices/virtual/mem/urandom/subsystem | 1 + test/sys/devices/virtual/mem/urandom/uevent | 2 + test/sys/devices/virtual/mem/zero/dev | 1 + test/sys/devices/virtual/mem/zero/power/wakeup | 1 + test/sys/devices/virtual/mem/zero/subsystem | 1 + test/sys/devices/virtual/mem/zero/uevent | 2 + test/sys/devices/virtual/misc/cpu_dma_latency/dev | 1 + .../virtual/misc/cpu_dma_latency/power/wakeup | 1 + .../devices/virtual/misc/cpu_dma_latency/subsystem | 1 + .../devices/virtual/misc/cpu_dma_latency/uevent | 2 + test/sys/devices/virtual/misc/device-mapper/dev | 1 + .../virtual/misc/device-mapper/power/wakeup | 1 + .../devices/virtual/misc/device-mapper/subsystem | 1 + test/sys/devices/virtual/misc/device-mapper/uevent | 2 + test/sys/devices/virtual/misc/fuse/dev | 1 + test/sys/devices/virtual/misc/fuse/power/wakeup | 1 + test/sys/devices/virtual/misc/fuse/subsystem | 1 + test/sys/devices/virtual/misc/fuse/uevent | 2 + test/sys/devices/virtual/misc/hpet/dev | 1 + test/sys/devices/virtual/misc/hpet/power/wakeup | 1 + test/sys/devices/virtual/misc/hpet/subsystem | 1 + test/sys/devices/virtual/misc/hpet/uevent | 2 + test/sys/devices/virtual/misc/mcelog/dev | 1 + test/sys/devices/virtual/misc/mcelog/power/wakeup | 1 + test/sys/devices/virtual/misc/mcelog/subsystem | 1 + test/sys/devices/virtual/misc/mcelog/uevent | 2 + test/sys/devices/virtual/misc/microcode/dev | 1 + .../devices/virtual/misc/microcode/power/wakeup | 1 + test/sys/devices/virtual/misc/microcode/subsystem | 1 + test/sys/devices/virtual/misc/microcode/uevent | 2 + test/sys/devices/virtual/misc/misc-fake1/dev | 1 + .../devices/virtual/misc/misc-fake1/power/wakeup | 1 + test/sys/devices/virtual/misc/misc-fake1/subsystem | 1 + test/sys/devices/virtual/misc/misc-fake1/uevent | 2 + test/sys/devices/virtual/misc/misc-fake89999/dev | 1 + .../virtual/misc/misc-fake89999/power/wakeup | 1 + .../devices/virtual/misc/misc-fake89999/subsystem | 1 + .../sys/devices/virtual/misc/misc-fake89999/uevent | 2 + test/sys/devices/virtual/misc/network_latency/dev | 1 + .../virtual/misc/network_latency/power/wakeup | 1 + .../devices/virtual/misc/network_latency/subsystem | 1 + .../devices/virtual/misc/network_latency/uevent | 2 + .../devices/virtual/misc/network_throughput/dev | 1 + .../virtual/misc/network_throughput/power/wakeup | 1 + .../virtual/misc/network_throughput/subsystem | 1 + .../devices/virtual/misc/network_throughput/uevent | 2 + test/sys/devices/virtual/misc/nvram/dev | 1 + test/sys/devices/virtual/misc/nvram/power/wakeup | 1 + test/sys/devices/virtual/misc/nvram/subsystem | 1 + test/sys/devices/virtual/misc/nvram/uevent | 2 + test/sys/devices/virtual/misc/psaux/dev | 1 + test/sys/devices/virtual/misc/psaux/power/wakeup | 1 + test/sys/devices/virtual/misc/psaux/subsystem | 1 + test/sys/devices/virtual/misc/psaux/uevent | 2 + test/sys/devices/virtual/misc/uinput/dev | 1 + test/sys/devices/virtual/misc/uinput/power/wakeup | 1 + test/sys/devices/virtual/misc/uinput/subsystem | 1 + test/sys/devices/virtual/misc/uinput/uevent | 2 + test/sys/devices/virtual/net/lo/addr_len | 1 + test/sys/devices/virtual/net/lo/address | 1 + test/sys/devices/virtual/net/lo/broadcast | 1 + test/sys/devices/virtual/net/lo/carrier | 1 + test/sys/devices/virtual/net/lo/dev_id | 1 + test/sys/devices/virtual/net/lo/dormant | 1 + test/sys/devices/virtual/net/lo/features | 1 + test/sys/devices/virtual/net/lo/flags | 1 + test/sys/devices/virtual/net/lo/ifindex | 1 + test/sys/devices/virtual/net/lo/iflink | 1 + test/sys/devices/virtual/net/lo/link_mode | 1 + test/sys/devices/virtual/net/lo/mtu | 1 + test/sys/devices/virtual/net/lo/operstate | 1 + test/sys/devices/virtual/net/lo/power/wakeup | 1 + .../devices/virtual/net/lo/statistics/collisions | 1 + .../devices/virtual/net/lo/statistics/multicast | 1 + .../sys/devices/virtual/net/lo/statistics/rx_bytes | 1 + .../virtual/net/lo/statistics/rx_compressed | 1 + .../virtual/net/lo/statistics/rx_crc_errors | 1 + .../devices/virtual/net/lo/statistics/rx_dropped | 1 + .../devices/virtual/net/lo/statistics/rx_errors | 1 + .../virtual/net/lo/statistics/rx_fifo_errors | 1 + .../virtual/net/lo/statistics/rx_frame_errors | 1 + .../virtual/net/lo/statistics/rx_length_errors | 1 + .../virtual/net/lo/statistics/rx_missed_errors | 1 + .../virtual/net/lo/statistics/rx_over_errors | 1 + .../devices/virtual/net/lo/statistics/rx_packets | 1 + .../virtual/net/lo/statistics/tx_aborted_errors | 1 + .../sys/devices/virtual/net/lo/statistics/tx_bytes | 1 + .../virtual/net/lo/statistics/tx_carrier_errors | 1 + .../virtual/net/lo/statistics/tx_compressed | 1 + .../devices/virtual/net/lo/statistics/tx_dropped | 1 + .../devices/virtual/net/lo/statistics/tx_errors | 1 + .../virtual/net/lo/statistics/tx_fifo_errors | 1 + .../virtual/net/lo/statistics/tx_heartbeat_errors | 1 + .../devices/virtual/net/lo/statistics/tx_packets | 1 + .../virtual/net/lo/statistics/tx_window_errors | 1 + test/sys/devices/virtual/net/lo/subsystem | 1 + test/sys/devices/virtual/net/lo/tx_queue_len | 1 + test/sys/devices/virtual/net/lo/type | 1 + test/sys/devices/virtual/net/lo/uevent | 2 + test/sys/devices/virtual/sound/seq/dev | 1 + test/sys/devices/virtual/sound/seq/power/wakeup | 1 + test/sys/devices/virtual/sound/seq/subsystem | 1 + test/sys/devices/virtual/sound/seq/uevent | 2 + test/sys/devices/virtual/sound/timer/dev | 1 + test/sys/devices/virtual/sound/timer/power/wakeup | 1 + test/sys/devices/virtual/sound/timer/subsystem | 1 + test/sys/devices/virtual/sound/timer/uevent | 2 + .../virtual/thermal/cooling_device0/cur_state | 1 + .../devices/virtual/thermal/cooling_device0/device | 1 + .../virtual/thermal/cooling_device0/max_state | 1 + .../virtual/thermal/cooling_device0/power/wakeup | 1 + .../virtual/thermal/cooling_device0/subsystem | 1 + .../devices/virtual/thermal/cooling_device0/type | 1 + .../devices/virtual/thermal/cooling_device0/uevent | 0 .../virtual/thermal/cooling_device1/cur_state | 1 + .../devices/virtual/thermal/cooling_device1/device | 1 + .../virtual/thermal/cooling_device1/max_state | 1 + .../virtual/thermal/cooling_device1/power/wakeup | 1 + .../virtual/thermal/cooling_device1/subsystem | 1 + .../devices/virtual/thermal/cooling_device1/type | 1 + .../devices/virtual/thermal/cooling_device1/uevent | 0 .../devices/virtual/thermal/thermal_zone0/device | 1 + .../sys/devices/virtual/thermal/thermal_zone0/mode | 1 + .../virtual/thermal/thermal_zone0/power/wakeup | 1 + .../virtual/thermal/thermal_zone0/subsystem | 1 + .../sys/devices/virtual/thermal/thermal_zone0/temp | 1 + .../thermal/thermal_zone0/trip_point_0_temp | 1 + .../thermal/thermal_zone0/trip_point_0_type | 1 + .../sys/devices/virtual/thermal/thermal_zone0/type | 1 + .../devices/virtual/thermal/thermal_zone0/uevent | 0 .../devices/virtual/thermal/thermal_zone1/cdev0 | 1 + .../virtual/thermal/thermal_zone1/cdev0_trip_point | 1 + .../devices/virtual/thermal/thermal_zone1/cdev1 | 1 + .../virtual/thermal/thermal_zone1/cdev1_trip_point | 1 + .../devices/virtual/thermal/thermal_zone1/device | 1 + .../sys/devices/virtual/thermal/thermal_zone1/mode | 1 + .../virtual/thermal/thermal_zone1/power/wakeup | 1 + .../virtual/thermal/thermal_zone1/subsystem | 1 + .../sys/devices/virtual/thermal/thermal_zone1/temp | 1 + .../thermal/thermal_zone1/trip_point_0_temp | 1 + .../thermal/thermal_zone1/trip_point_0_type | 1 + .../thermal/thermal_zone1/trip_point_1_temp | 1 + .../thermal/thermal_zone1/trip_point_1_type | 1 + .../sys/devices/virtual/thermal/thermal_zone1/type | 1 + .../devices/virtual/thermal/thermal_zone1/uevent | 0 test/sys/devices/virtual/tty/console/dev | 1 + test/sys/devices/virtual/tty/console/power/wakeup | 1 + test/sys/devices/virtual/tty/console/subsystem | 1 + test/sys/devices/virtual/tty/console/uevent | 2 + test/sys/devices/virtual/tty/ptmx/dev | 1 + test/sys/devices/virtual/tty/ptmx/power/wakeup | 1 + test/sys/devices/virtual/tty/ptmx/subsystem | 1 + test/sys/devices/virtual/tty/ptmx/uevent | 2 + test/sys/devices/virtual/tty/tty/dev | 1 + test/sys/devices/virtual/tty/tty/power/wakeup | 1 + test/sys/devices/virtual/tty/tty/subsystem | 1 + test/sys/devices/virtual/tty/tty/uevent | 2 + test/sys/devices/virtual/tty/tty0/dev | 1 + test/sys/devices/virtual/tty/tty0/power/wakeup | 1 + test/sys/devices/virtual/tty/tty0/subsystem | 1 + test/sys/devices/virtual/tty/tty0/uevent | 2 + test/sys/devices/virtual/tty/tty1/dev | 1 + test/sys/devices/virtual/tty/tty1/power/wakeup | 1 + test/sys/devices/virtual/tty/tty1/subsystem | 1 + test/sys/devices/virtual/tty/tty1/uevent | 2 + test/sys/devices/virtual/tty/tty10/dev | 1 + test/sys/devices/virtual/tty/tty10/power/wakeup | 1 + test/sys/devices/virtual/tty/tty10/subsystem | 1 + test/sys/devices/virtual/tty/tty10/uevent | 2 + test/sys/devices/virtual/tty/tty11/dev | 1 + test/sys/devices/virtual/tty/tty11/power/wakeup | 1 + test/sys/devices/virtual/tty/tty11/subsystem | 1 + test/sys/devices/virtual/tty/tty11/uevent | 2 + test/sys/devices/virtual/tty/tty12/dev | 1 + test/sys/devices/virtual/tty/tty12/power/wakeup | 1 + test/sys/devices/virtual/tty/tty12/subsystem | 1 + test/sys/devices/virtual/tty/tty12/uevent | 2 + test/sys/devices/virtual/tty/tty13/dev | 1 + test/sys/devices/virtual/tty/tty13/power/wakeup | 1 + test/sys/devices/virtual/tty/tty13/subsystem | 1 + test/sys/devices/virtual/tty/tty13/uevent | 2 + test/sys/devices/virtual/tty/tty14/dev | 1 + test/sys/devices/virtual/tty/tty14/power/wakeup | 1 + test/sys/devices/virtual/tty/tty14/subsystem | 1 + test/sys/devices/virtual/tty/tty14/uevent | 2 + test/sys/devices/virtual/tty/tty15/dev | 1 + test/sys/devices/virtual/tty/tty15/power/wakeup | 1 + test/sys/devices/virtual/tty/tty15/subsystem | 1 + test/sys/devices/virtual/tty/tty15/uevent | 2 + test/sys/devices/virtual/tty/tty16/dev | 1 + test/sys/devices/virtual/tty/tty16/power/wakeup | 1 + test/sys/devices/virtual/tty/tty16/subsystem | 1 + test/sys/devices/virtual/tty/tty16/uevent | 2 + test/sys/devices/virtual/tty/tty17/dev | 1 + test/sys/devices/virtual/tty/tty17/power/wakeup | 1 + test/sys/devices/virtual/tty/tty17/subsystem | 1 + test/sys/devices/virtual/tty/tty17/uevent | 2 + test/sys/devices/virtual/tty/tty18/dev | 1 + test/sys/devices/virtual/tty/tty18/power/wakeup | 1 + test/sys/devices/virtual/tty/tty18/subsystem | 1 + test/sys/devices/virtual/tty/tty18/uevent | 2 + test/sys/devices/virtual/tty/tty19/dev | 1 + test/sys/devices/virtual/tty/tty19/power/wakeup | 1 + test/sys/devices/virtual/tty/tty19/subsystem | 1 + test/sys/devices/virtual/tty/tty19/uevent | 2 + test/sys/devices/virtual/tty/tty2/dev | 1 + test/sys/devices/virtual/tty/tty2/power/wakeup | 1 + test/sys/devices/virtual/tty/tty2/subsystem | 1 + test/sys/devices/virtual/tty/tty2/uevent | 2 + test/sys/devices/virtual/tty/tty20/dev | 1 + test/sys/devices/virtual/tty/tty20/power/wakeup | 1 + test/sys/devices/virtual/tty/tty20/subsystem | 1 + test/sys/devices/virtual/tty/tty20/uevent | 2 + test/sys/devices/virtual/tty/tty21/dev | 1 + test/sys/devices/virtual/tty/tty21/power/wakeup | 1 + test/sys/devices/virtual/tty/tty21/subsystem | 1 + test/sys/devices/virtual/tty/tty21/uevent | 2 + test/sys/devices/virtual/tty/tty22/dev | 1 + test/sys/devices/virtual/tty/tty22/power/wakeup | 1 + test/sys/devices/virtual/tty/tty22/subsystem | 1 + test/sys/devices/virtual/tty/tty22/uevent | 2 + test/sys/devices/virtual/tty/tty23/dev | 1 + test/sys/devices/virtual/tty/tty23/power/wakeup | 1 + test/sys/devices/virtual/tty/tty23/subsystem | 1 + test/sys/devices/virtual/tty/tty23/uevent | 2 + test/sys/devices/virtual/tty/tty24/dev | 1 + test/sys/devices/virtual/tty/tty24/power/wakeup | 1 + test/sys/devices/virtual/tty/tty24/subsystem | 1 + test/sys/devices/virtual/tty/tty24/uevent | 2 + test/sys/devices/virtual/tty/tty25/dev | 1 + test/sys/devices/virtual/tty/tty25/power/wakeup | 1 + test/sys/devices/virtual/tty/tty25/subsystem | 1 + test/sys/devices/virtual/tty/tty25/uevent | 2 + test/sys/devices/virtual/tty/tty26/dev | 1 + test/sys/devices/virtual/tty/tty26/power/wakeup | 1 + test/sys/devices/virtual/tty/tty26/subsystem | 1 + test/sys/devices/virtual/tty/tty26/uevent | 2 + test/sys/devices/virtual/tty/tty27/dev | 1 + test/sys/devices/virtual/tty/tty27/power/wakeup | 1 + test/sys/devices/virtual/tty/tty27/subsystem | 1 + test/sys/devices/virtual/tty/tty27/uevent | 2 + test/sys/devices/virtual/tty/tty28/dev | 1 + test/sys/devices/virtual/tty/tty28/power/wakeup | 1 + test/sys/devices/virtual/tty/tty28/subsystem | 1 + test/sys/devices/virtual/tty/tty28/uevent | 2 + test/sys/devices/virtual/tty/tty29/dev | 1 + test/sys/devices/virtual/tty/tty29/power/wakeup | 1 + test/sys/devices/virtual/tty/tty29/subsystem | 1 + test/sys/devices/virtual/tty/tty29/uevent | 2 + test/sys/devices/virtual/tty/tty3/dev | 1 + test/sys/devices/virtual/tty/tty3/power/wakeup | 1 + test/sys/devices/virtual/tty/tty3/subsystem | 1 + test/sys/devices/virtual/tty/tty3/uevent | 2 + test/sys/devices/virtual/tty/tty30/dev | 1 + test/sys/devices/virtual/tty/tty30/power/wakeup | 1 + test/sys/devices/virtual/tty/tty30/subsystem | 1 + test/sys/devices/virtual/tty/tty30/uevent | 2 + test/sys/devices/virtual/tty/tty31/dev | 1 + test/sys/devices/virtual/tty/tty31/power/wakeup | 1 + test/sys/devices/virtual/tty/tty31/subsystem | 1 + test/sys/devices/virtual/tty/tty31/uevent | 2 + test/sys/devices/virtual/tty/tty32/dev | 1 + test/sys/devices/virtual/tty/tty32/power/wakeup | 1 + test/sys/devices/virtual/tty/tty32/subsystem | 1 + test/sys/devices/virtual/tty/tty32/uevent | 2 + test/sys/devices/virtual/tty/tty33/dev | 1 + test/sys/devices/virtual/tty/tty33/power/wakeup | 1 + test/sys/devices/virtual/tty/tty33/subsystem | 1 + test/sys/devices/virtual/tty/tty33/uevent | 2 + test/sys/devices/virtual/tty/tty34/dev | 1 + test/sys/devices/virtual/tty/tty34/power/wakeup | 1 + test/sys/devices/virtual/tty/tty34/subsystem | 1 + test/sys/devices/virtual/tty/tty34/uevent | 2 + test/sys/devices/virtual/tty/tty35/dev | 1 + test/sys/devices/virtual/tty/tty35/power/wakeup | 1 + test/sys/devices/virtual/tty/tty35/subsystem | 1 + test/sys/devices/virtual/tty/tty35/uevent | 2 + test/sys/devices/virtual/tty/tty36/dev | 1 + test/sys/devices/virtual/tty/tty36/power/wakeup | 1 + test/sys/devices/virtual/tty/tty36/subsystem | 1 + test/sys/devices/virtual/tty/tty36/uevent | 2 + test/sys/devices/virtual/tty/tty37/dev | 1 + test/sys/devices/virtual/tty/tty37/power/wakeup | 1 + test/sys/devices/virtual/tty/tty37/subsystem | 1 + test/sys/devices/virtual/tty/tty37/uevent | 2 + test/sys/devices/virtual/tty/tty38/dev | 1 + test/sys/devices/virtual/tty/tty38/power/wakeup | 1 + test/sys/devices/virtual/tty/tty38/subsystem | 1 + test/sys/devices/virtual/tty/tty38/uevent | 2 + test/sys/devices/virtual/tty/tty39/dev | 1 + test/sys/devices/virtual/tty/tty39/power/wakeup | 1 + test/sys/devices/virtual/tty/tty39/subsystem | 1 + test/sys/devices/virtual/tty/tty39/uevent | 2 + test/sys/devices/virtual/tty/tty4/dev | 1 + test/sys/devices/virtual/tty/tty4/power/wakeup | 1 + test/sys/devices/virtual/tty/tty4/subsystem | 1 + test/sys/devices/virtual/tty/tty4/uevent | 2 + test/sys/devices/virtual/tty/tty40/dev | 1 + test/sys/devices/virtual/tty/tty40/power/wakeup | 1 + test/sys/devices/virtual/tty/tty40/subsystem | 1 + test/sys/devices/virtual/tty/tty40/uevent | 2 + test/sys/devices/virtual/tty/tty41/dev | 1 + test/sys/devices/virtual/tty/tty41/power/wakeup | 1 + test/sys/devices/virtual/tty/tty41/subsystem | 1 + test/sys/devices/virtual/tty/tty41/uevent | 2 + test/sys/devices/virtual/tty/tty42/dev | 1 + test/sys/devices/virtual/tty/tty42/power/wakeup | 1 + test/sys/devices/virtual/tty/tty42/subsystem | 1 + test/sys/devices/virtual/tty/tty42/uevent | 2 + test/sys/devices/virtual/tty/tty43/dev | 1 + test/sys/devices/virtual/tty/tty43/power/wakeup | 1 + test/sys/devices/virtual/tty/tty43/subsystem | 1 + test/sys/devices/virtual/tty/tty43/uevent | 2 + test/sys/devices/virtual/tty/tty44/dev | 1 + test/sys/devices/virtual/tty/tty44/power/wakeup | 1 + test/sys/devices/virtual/tty/tty44/subsystem | 1 + test/sys/devices/virtual/tty/tty44/uevent | 2 + test/sys/devices/virtual/tty/tty45/dev | 1 + test/sys/devices/virtual/tty/tty45/power/wakeup | 1 + test/sys/devices/virtual/tty/tty45/subsystem | 1 + test/sys/devices/virtual/tty/tty45/uevent | 2 + test/sys/devices/virtual/tty/tty46/dev | 1 + test/sys/devices/virtual/tty/tty46/power/wakeup | 1 + test/sys/devices/virtual/tty/tty46/subsystem | 1 + test/sys/devices/virtual/tty/tty46/uevent | 2 + test/sys/devices/virtual/tty/tty47/dev | 1 + test/sys/devices/virtual/tty/tty47/power/wakeup | 1 + test/sys/devices/virtual/tty/tty47/subsystem | 1 + test/sys/devices/virtual/tty/tty47/uevent | 2 + test/sys/devices/virtual/tty/tty48/dev | 1 + test/sys/devices/virtual/tty/tty48/power/wakeup | 1 + test/sys/devices/virtual/tty/tty48/subsystem | 1 + test/sys/devices/virtual/tty/tty48/uevent | 2 + test/sys/devices/virtual/tty/tty49/dev | 1 + test/sys/devices/virtual/tty/tty49/power/wakeup | 1 + test/sys/devices/virtual/tty/tty49/subsystem | 1 + test/sys/devices/virtual/tty/tty49/uevent | 2 + test/sys/devices/virtual/tty/tty5/dev | 1 + test/sys/devices/virtual/tty/tty5/power/wakeup | 1 + test/sys/devices/virtual/tty/tty5/subsystem | 1 + test/sys/devices/virtual/tty/tty5/uevent | 2 + test/sys/devices/virtual/tty/tty50/dev | 1 + test/sys/devices/virtual/tty/tty50/power/wakeup | 1 + test/sys/devices/virtual/tty/tty50/subsystem | 1 + test/sys/devices/virtual/tty/tty50/uevent | 2 + test/sys/devices/virtual/tty/tty51/dev | 1 + test/sys/devices/virtual/tty/tty51/power/wakeup | 1 + test/sys/devices/virtual/tty/tty51/subsystem | 1 + test/sys/devices/virtual/tty/tty51/uevent | 2 + test/sys/devices/virtual/tty/tty52/dev | 1 + test/sys/devices/virtual/tty/tty52/power/wakeup | 1 + test/sys/devices/virtual/tty/tty52/subsystem | 1 + test/sys/devices/virtual/tty/tty52/uevent | 2 + test/sys/devices/virtual/tty/tty53/dev | 1 + test/sys/devices/virtual/tty/tty53/power/wakeup | 1 + test/sys/devices/virtual/tty/tty53/subsystem | 1 + test/sys/devices/virtual/tty/tty53/uevent | 2 + test/sys/devices/virtual/tty/tty54/dev | 1 + test/sys/devices/virtual/tty/tty54/power/wakeup | 1 + test/sys/devices/virtual/tty/tty54/subsystem | 1 + test/sys/devices/virtual/tty/tty54/uevent | 2 + test/sys/devices/virtual/tty/tty55/dev | 1 + test/sys/devices/virtual/tty/tty55/power/wakeup | 1 + test/sys/devices/virtual/tty/tty55/subsystem | 1 + test/sys/devices/virtual/tty/tty55/uevent | 2 + test/sys/devices/virtual/tty/tty56/dev | 1 + test/sys/devices/virtual/tty/tty56/power/wakeup | 1 + test/sys/devices/virtual/tty/tty56/subsystem | 1 + test/sys/devices/virtual/tty/tty56/uevent | 2 + test/sys/devices/virtual/tty/tty57/dev | 1 + test/sys/devices/virtual/tty/tty57/power/wakeup | 1 + test/sys/devices/virtual/tty/tty57/subsystem | 1 + test/sys/devices/virtual/tty/tty57/uevent | 2 + test/sys/devices/virtual/tty/tty58/dev | 1 + test/sys/devices/virtual/tty/tty58/power/wakeup | 1 + test/sys/devices/virtual/tty/tty58/subsystem | 1 + test/sys/devices/virtual/tty/tty58/uevent | 2 + test/sys/devices/virtual/tty/tty59/dev | 1 + test/sys/devices/virtual/tty/tty59/power/wakeup | 1 + test/sys/devices/virtual/tty/tty59/subsystem | 1 + test/sys/devices/virtual/tty/tty59/uevent | 2 + test/sys/devices/virtual/tty/tty6/dev | 1 + test/sys/devices/virtual/tty/tty6/power/wakeup | 1 + test/sys/devices/virtual/tty/tty6/subsystem | 1 + test/sys/devices/virtual/tty/tty6/uevent | 2 + test/sys/devices/virtual/tty/tty60/dev | 1 + test/sys/devices/virtual/tty/tty60/power/wakeup | 1 + test/sys/devices/virtual/tty/tty60/subsystem | 1 + test/sys/devices/virtual/tty/tty60/uevent | 2 + test/sys/devices/virtual/tty/tty61/dev | 1 + test/sys/devices/virtual/tty/tty61/power/wakeup | 1 + test/sys/devices/virtual/tty/tty61/subsystem | 1 + test/sys/devices/virtual/tty/tty61/uevent | 2 + test/sys/devices/virtual/tty/tty62/dev | 1 + test/sys/devices/virtual/tty/tty62/power/wakeup | 1 + test/sys/devices/virtual/tty/tty62/subsystem | 1 + test/sys/devices/virtual/tty/tty62/uevent | 2 + test/sys/devices/virtual/tty/tty63/dev | 1 + test/sys/devices/virtual/tty/tty63/power/wakeup | 1 + test/sys/devices/virtual/tty/tty63/subsystem | 1 + test/sys/devices/virtual/tty/tty63/uevent | 2 + test/sys/devices/virtual/tty/tty7/dev | 1 + test/sys/devices/virtual/tty/tty7/power/wakeup | 1 + test/sys/devices/virtual/tty/tty7/subsystem | 1 + test/sys/devices/virtual/tty/tty7/uevent | 2 + test/sys/devices/virtual/tty/tty8/dev | 1 + test/sys/devices/virtual/tty/tty8/power/wakeup | 1 + test/sys/devices/virtual/tty/tty8/subsystem | 1 + test/sys/devices/virtual/tty/tty8/uevent | 2 + test/sys/devices/virtual/tty/tty9/dev | 1 + test/sys/devices/virtual/tty/tty9/power/wakeup | 1 + test/sys/devices/virtual/tty/tty9/subsystem | 1 + test/sys/devices/virtual/tty/tty9/uevent | 2 + test/sys/devices/virtual/vc/vcs/dev | 1 + test/sys/devices/virtual/vc/vcs/power/wakeup | 1 + test/sys/devices/virtual/vc/vcs/subsystem | 1 + test/sys/devices/virtual/vc/vcs/uevent | 2 + test/sys/devices/virtual/vc/vcs1/dev | 1 + test/sys/devices/virtual/vc/vcs1/power/wakeup | 1 + test/sys/devices/virtual/vc/vcs1/subsystem | 1 + test/sys/devices/virtual/vc/vcs1/uevent | 2 + test/sys/devices/virtual/vc/vcs10/dev | 1 + test/sys/devices/virtual/vc/vcs10/power/wakeup | 1 + test/sys/devices/virtual/vc/vcs10/subsystem | 1 + test/sys/devices/virtual/vc/vcs10/uevent | 2 + test/sys/devices/virtual/vc/vcs2/dev | 1 + test/sys/devices/virtual/vc/vcs2/power/wakeup | 1 + test/sys/devices/virtual/vc/vcs2/subsystem | 1 + test/sys/devices/virtual/vc/vcs2/uevent | 2 + test/sys/devices/virtual/vc/vcs3/dev | 1 + test/sys/devices/virtual/vc/vcs3/power/wakeup | 1 + test/sys/devices/virtual/vc/vcs3/subsystem | 1 + test/sys/devices/virtual/vc/vcs3/uevent | 2 + test/sys/devices/virtual/vc/vcs4/dev | 1 + test/sys/devices/virtual/vc/vcs4/power/wakeup | 1 + test/sys/devices/virtual/vc/vcs4/subsystem | 1 + test/sys/devices/virtual/vc/vcs4/uevent | 2 + test/sys/devices/virtual/vc/vcs5/dev | 1 + test/sys/devices/virtual/vc/vcs5/power/wakeup | 1 + test/sys/devices/virtual/vc/vcs5/subsystem | 1 + test/sys/devices/virtual/vc/vcs5/uevent | 2 + test/sys/devices/virtual/vc/vcs6/dev | 1 + test/sys/devices/virtual/vc/vcs6/power/wakeup | 1 + test/sys/devices/virtual/vc/vcs6/subsystem | 1 + test/sys/devices/virtual/vc/vcs6/uevent | 2 + test/sys/devices/virtual/vc/vcs7/dev | 1 + test/sys/devices/virtual/vc/vcs7/power/wakeup | 1 + test/sys/devices/virtual/vc/vcs7/subsystem | 1 + test/sys/devices/virtual/vc/vcs7/uevent | 2 + test/sys/devices/virtual/vc/vcsa/dev | 1 + test/sys/devices/virtual/vc/vcsa/power/wakeup | 1 + test/sys/devices/virtual/vc/vcsa/subsystem | 1 + test/sys/devices/virtual/vc/vcsa/uevent | 2 + test/sys/devices/virtual/vc/vcsa1/dev | 1 + test/sys/devices/virtual/vc/vcsa1/power/wakeup | 1 + test/sys/devices/virtual/vc/vcsa1/subsystem | 1 + test/sys/devices/virtual/vc/vcsa1/uevent | 2 + test/sys/devices/virtual/vc/vcsa10/dev | 1 + test/sys/devices/virtual/vc/vcsa10/power/wakeup | 1 + test/sys/devices/virtual/vc/vcsa10/subsystem | 1 + test/sys/devices/virtual/vc/vcsa10/uevent | 2 + test/sys/devices/virtual/vc/vcsa2/dev | 1 + test/sys/devices/virtual/vc/vcsa2/power/wakeup | 1 + test/sys/devices/virtual/vc/vcsa2/subsystem | 1 + test/sys/devices/virtual/vc/vcsa2/uevent | 2 + test/sys/devices/virtual/vc/vcsa3/dev | 1 + test/sys/devices/virtual/vc/vcsa3/power/wakeup | 1 + test/sys/devices/virtual/vc/vcsa3/subsystem | 1 + test/sys/devices/virtual/vc/vcsa3/uevent | 2 + test/sys/devices/virtual/vc/vcsa4/dev | 1 + test/sys/devices/virtual/vc/vcsa4/power/wakeup | 1 + test/sys/devices/virtual/vc/vcsa4/subsystem | 1 + test/sys/devices/virtual/vc/vcsa4/uevent | 2 + test/sys/devices/virtual/vc/vcsa5/dev | 1 + test/sys/devices/virtual/vc/vcsa5/power/wakeup | 1 + test/sys/devices/virtual/vc/vcsa5/subsystem | 1 + test/sys/devices/virtual/vc/vcsa5/uevent | 2 + test/sys/devices/virtual/vc/vcsa6/dev | 1 + test/sys/devices/virtual/vc/vcsa6/power/wakeup | 1 + test/sys/devices/virtual/vc/vcsa6/subsystem | 1 + test/sys/devices/virtual/vc/vcsa6/uevent | 2 + test/sys/devices/virtual/vc/vcsa7/dev | 1 + test/sys/devices/virtual/vc/vcsa7/power/wakeup | 1 + test/sys/devices/virtual/vc/vcsa7/subsystem | 1 + test/sys/devices/virtual/vc/vcsa7/uevent | 2 + test/sys/devices/virtual/vtconsole/vtcon0/bind | 1 + test/sys/devices/virtual/vtconsole/vtcon0/name | 1 + .../devices/virtual/vtconsole/vtcon0/power/wakeup | 1 + .../sys/devices/virtual/vtconsole/vtcon0/subsystem | 1 + test/sys/devices/virtual/vtconsole/vtcon0/uevent | 0 test/sys/devices/virtual/vtconsole/vtcon1/bind | 1 + test/sys/devices/virtual/vtconsole/vtcon1/name | 1 + .../devices/virtual/vtconsole/vtcon1/power/wakeup | 1 + .../sys/devices/virtual/vtconsole/vtcon1/subsystem | 1 + test/sys/devices/virtual/vtconsole/vtcon1/uevent | 0 test/sys/firmware/acpi/interrupts/error | 1 + test/sys/firmware/acpi/interrupts/ff_gbl_lock | 1 + test/sys/firmware/acpi/interrupts/ff_pmtimer | 1 + test/sys/firmware/acpi/interrupts/ff_pwr_btn | 1 + test/sys/firmware/acpi/interrupts/ff_rt_clk | 1 + test/sys/firmware/acpi/interrupts/ff_slp_btn | 1 + test/sys/firmware/acpi/interrupts/gpe00 | 1 + test/sys/firmware/acpi/interrupts/gpe01 | 1 + test/sys/firmware/acpi/interrupts/gpe02 | 1 + test/sys/firmware/acpi/interrupts/gpe03 | 1 + test/sys/firmware/acpi/interrupts/gpe04 | 1 + test/sys/firmware/acpi/interrupts/gpe05 | 1 + test/sys/firmware/acpi/interrupts/gpe06 | 1 + test/sys/firmware/acpi/interrupts/gpe07 | 1 + test/sys/firmware/acpi/interrupts/gpe08 | 1 + test/sys/firmware/acpi/interrupts/gpe09 | 1 + test/sys/firmware/acpi/interrupts/gpe0A | 1 + test/sys/firmware/acpi/interrupts/gpe0B | 1 + test/sys/firmware/acpi/interrupts/gpe0C | 1 + test/sys/firmware/acpi/interrupts/gpe0D | 1 + test/sys/firmware/acpi/interrupts/gpe0E | 1 + test/sys/firmware/acpi/interrupts/gpe0F | 1 + test/sys/firmware/acpi/interrupts/gpe10 | 1 + test/sys/firmware/acpi/interrupts/gpe11 | 1 + test/sys/firmware/acpi/interrupts/gpe12 | 1 + test/sys/firmware/acpi/interrupts/gpe13 | 1 + test/sys/firmware/acpi/interrupts/gpe14 | 1 + test/sys/firmware/acpi/interrupts/gpe15 | 1 + test/sys/firmware/acpi/interrupts/gpe16 | 1 + test/sys/firmware/acpi/interrupts/gpe17 | 1 + test/sys/firmware/acpi/interrupts/gpe18 | 1 + test/sys/firmware/acpi/interrupts/gpe19 | 1 + test/sys/firmware/acpi/interrupts/gpe1A | 1 + test/sys/firmware/acpi/interrupts/gpe1B | 1 + test/sys/firmware/acpi/interrupts/gpe1C | 1 + test/sys/firmware/acpi/interrupts/gpe1D | 1 + test/sys/firmware/acpi/interrupts/gpe1E | 1 + test/sys/firmware/acpi/interrupts/gpe1F | 1 + test/sys/firmware/acpi/interrupts/gpe_all | 1 + test/sys/firmware/acpi/interrupts/sci | 1 + test/sys/firmware/acpi/tables/APIC | Bin 0 -> 104 bytes test/sys/firmware/acpi/tables/BOOT | Bin 0 -> 40 bytes test/sys/firmware/acpi/tables/DSDT | Bin 0 -> 53812 bytes test/sys/firmware/acpi/tables/ECDT | Bin 0 -> 82 bytes test/sys/firmware/acpi/tables/FACP | Bin 0 -> 244 bytes test/sys/firmware/acpi/tables/FACS | Bin 0 -> 64 bytes test/sys/firmware/acpi/tables/HPET | Bin 0 -> 56 bytes test/sys/firmware/acpi/tables/MCFG | Bin 0 -> 60 bytes test/sys/firmware/acpi/tables/SLIC | Bin 0 -> 374 bytes test/sys/firmware/acpi/tables/SSDT1 | Bin 0 -> 426 bytes test/sys/firmware/acpi/tables/SSDT2 | Bin 0 -> 607 bytes test/sys/firmware/acpi/tables/SSDT3 | Bin 0 -> 166 bytes test/sys/firmware/acpi/tables/SSDT4 | Bin 0 -> 1271 bytes test/sys/firmware/acpi/tables/SSDT5 | Bin 0 -> 472 bytes test/sys/firmware/acpi/tables/TCPA | Bin 0 -> 50 bytes .../sys/firmware/edd/int13_dev80/default_cylinders | 1 + test/sys/firmware/edd/int13_dev80/default_heads | 1 + .../edd/int13_dev80/default_sectors_per_track | 1 + test/sys/firmware/edd/int13_dev80/extensions | 2 + test/sys/firmware/edd/int13_dev80/host_bus | 1 + test/sys/firmware/edd/int13_dev80/info_flags | 1 + test/sys/firmware/edd/int13_dev80/interface | 1 + .../firmware/edd/int13_dev80/legacy_max_cylinder | 1 + test/sys/firmware/edd/int13_dev80/legacy_max_head | 1 + .../edd/int13_dev80/legacy_sectors_per_track | 1 + test/sys/firmware/edd/int13_dev80/mbr_signature | 1 + test/sys/firmware/edd/int13_dev80/pci_dev | 1 + test/sys/firmware/edd/int13_dev80/raw_data | Bin 0 -> 74 bytes test/sys/firmware/edd/int13_dev80/sectors | 1 + test/sys/firmware/edd/int13_dev80/version | 1 + test/sys/firmware/memmap/0/end | 1 + test/sys/firmware/memmap/0/start | 1 + test/sys/firmware/memmap/0/type | 1 + test/sys/firmware/memmap/1/end | 1 + test/sys/firmware/memmap/1/start | 1 + test/sys/firmware/memmap/1/type | 1 + test/sys/firmware/memmap/10/end | 1 + test/sys/firmware/memmap/10/start | 1 + test/sys/firmware/memmap/10/type | 1 + test/sys/firmware/memmap/11/end | 1 + test/sys/firmware/memmap/11/start | 1 + test/sys/firmware/memmap/11/type | 1 + test/sys/firmware/memmap/12/end | 1 + test/sys/firmware/memmap/12/start | 1 + test/sys/firmware/memmap/12/type | 1 + test/sys/firmware/memmap/13/end | 1 + test/sys/firmware/memmap/13/start | 1 + test/sys/firmware/memmap/13/type | 1 + test/sys/firmware/memmap/2/end | 1 + test/sys/firmware/memmap/2/start | 1 + test/sys/firmware/memmap/2/type | 1 + test/sys/firmware/memmap/3/end | 1 + test/sys/firmware/memmap/3/start | 1 + test/sys/firmware/memmap/3/type | 1 + test/sys/firmware/memmap/4/end | 1 + test/sys/firmware/memmap/4/start | 1 + test/sys/firmware/memmap/4/type | 1 + test/sys/firmware/memmap/5/end | 1 + test/sys/firmware/memmap/5/start | 1 + test/sys/firmware/memmap/5/type | 1 + test/sys/firmware/memmap/6/end | 1 + test/sys/firmware/memmap/6/start | 1 + test/sys/firmware/memmap/6/type | 1 + test/sys/firmware/memmap/7/end | 1 + test/sys/firmware/memmap/7/start | 1 + test/sys/firmware/memmap/7/type | 1 + test/sys/firmware/memmap/8/end | 1 + test/sys/firmware/memmap/8/start | 1 + test/sys/firmware/memmap/8/type | 1 + test/sys/firmware/memmap/9/end | 1 + test/sys/firmware/memmap/9/start | 1 + test/sys/firmware/memmap/9/type | 1 + test/sys/fs/fuse/connections/16/abort | 0 test/sys/fs/fuse/connections/16/waiting | 1 + test/sys/kernel/debug/bdi/0:16/stats | 5 + test/sys/kernel/debug/bdi/11:0/stats | 5 + test/sys/kernel/debug/bdi/7:0/stats | 5 + test/sys/kernel/debug/bdi/7:1/stats | 5 + test/sys/kernel/debug/bdi/7:2/stats | 5 + test/sys/kernel/debug/bdi/7:3/stats | 5 + test/sys/kernel/debug/bdi/7:4/stats | 5 + test/sys/kernel/debug/bdi/7:5/stats | 5 + test/sys/kernel/debug/bdi/7:6/stats | 5 + test/sys/kernel/debug/bdi/7:7/stats | 5 + test/sys/kernel/debug/bdi/8:0/stats | 5 + test/sys/kernel/debug/bdi/8:16/stats | 5 + test/sys/kernel/debug/bdi/9:0/stats | 5 + test/sys/kernel/debug/bdi/default/stats | 5 + test/sys/kernel/debug/x86/pat_memtype_list | 0 test/sys/kernel/kexec_crash_loaded | 1 + test/sys/kernel/kexec_loaded | 1 + test/sys/kernel/notes | Bin 0 -> 36 bytes test/sys/kernel/slab/Acpi-Namespace/aliases | 1 + test/sys/kernel/slab/Acpi-Namespace/align | 1 + test/sys/kernel/slab/Acpi-Namespace/alloc_calls | 1 + test/sys/kernel/slab/Acpi-Namespace/cache_dma | 1 + test/sys/kernel/slab/Acpi-Namespace/cpu_slabs | 1 + test/sys/kernel/slab/Acpi-Namespace/ctor | 0 test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu | 1 + test/sys/kernel/slab/Acpi-Namespace/free_calls | 1 + test/sys/kernel/slab/Acpi-Namespace/hwcache_align | 1 + test/sys/kernel/slab/Acpi-Namespace/object_size | 1 + test/sys/kernel/slab/Acpi-Namespace/objects | 1 + .../sys/kernel/slab/Acpi-Namespace/objects_partial | 1 + test/sys/kernel/slab/Acpi-Namespace/objs_per_slab | 1 + test/sys/kernel/slab/Acpi-Namespace/order | 1 + test/sys/kernel/slab/Acpi-Namespace/partial | 1 + test/sys/kernel/slab/Acpi-Namespace/poison | 1 + .../sys/kernel/slab/Acpi-Namespace/reclaim_account | 1 + test/sys/kernel/slab/Acpi-Namespace/red_zone | 1 + test/sys/kernel/slab/Acpi-Namespace/sanity_checks | 1 + test/sys/kernel/slab/Acpi-Namespace/shrink | 0 test/sys/kernel/slab/Acpi-Namespace/slab_size | 1 + test/sys/kernel/slab/Acpi-Namespace/slabs | 1 + test/sys/kernel/slab/Acpi-Namespace/store_user | 1 + test/sys/kernel/slab/Acpi-Namespace/total_objects | 1 + test/sys/kernel/slab/Acpi-Namespace/trace | 1 + test/sys/kernel/slab/Acpi-Namespace/validate | 0 test/sys/kernel/slab/Acpi-Operand/aliases | 1 + test/sys/kernel/slab/Acpi-Operand/align | 1 + test/sys/kernel/slab/Acpi-Operand/alloc_calls | 1 + test/sys/kernel/slab/Acpi-Operand/cache_dma | 1 + test/sys/kernel/slab/Acpi-Operand/cpu_slabs | 1 + test/sys/kernel/slab/Acpi-Operand/ctor | 0 test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu | 1 + test/sys/kernel/slab/Acpi-Operand/free_calls | 2 + test/sys/kernel/slab/Acpi-Operand/hwcache_align | 1 + test/sys/kernel/slab/Acpi-Operand/object_size | 1 + test/sys/kernel/slab/Acpi-Operand/objects | 1 + test/sys/kernel/slab/Acpi-Operand/objects_partial | 1 + test/sys/kernel/slab/Acpi-Operand/objs_per_slab | 1 + test/sys/kernel/slab/Acpi-Operand/order | 1 + test/sys/kernel/slab/Acpi-Operand/partial | 1 + test/sys/kernel/slab/Acpi-Operand/poison | 1 + test/sys/kernel/slab/Acpi-Operand/reclaim_account | 1 + test/sys/kernel/slab/Acpi-Operand/red_zone | 1 + test/sys/kernel/slab/Acpi-Operand/sanity_checks | 1 + test/sys/kernel/slab/Acpi-Operand/shrink | 0 test/sys/kernel/slab/Acpi-Operand/slab_size | 1 + test/sys/kernel/slab/Acpi-Operand/slabs | 1 + test/sys/kernel/slab/Acpi-Operand/store_user | 1 + test/sys/kernel/slab/Acpi-Operand/total_objects | 1 + test/sys/kernel/slab/Acpi-Operand/trace | 1 + test/sys/kernel/slab/Acpi-Operand/validate | 0 test/sys/kernel/slab/Acpi-Parse/aliases | 1 + test/sys/kernel/slab/Acpi-Parse/align | 1 + test/sys/kernel/slab/Acpi-Parse/alloc_calls | 1 + test/sys/kernel/slab/Acpi-Parse/cache_dma | 1 + test/sys/kernel/slab/Acpi-Parse/cpu_slabs | 1 + test/sys/kernel/slab/Acpi-Parse/ctor | 0 test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu | 1 + test/sys/kernel/slab/Acpi-Parse/free_calls | 1 + test/sys/kernel/slab/Acpi-Parse/hwcache_align | 1 + test/sys/kernel/slab/Acpi-Parse/object_size | 1 + test/sys/kernel/slab/Acpi-Parse/objects | 1 + test/sys/kernel/slab/Acpi-Parse/objects_partial | 1 + test/sys/kernel/slab/Acpi-Parse/objs_per_slab | 1 + test/sys/kernel/slab/Acpi-Parse/order | 1 + test/sys/kernel/slab/Acpi-Parse/partial | 1 + test/sys/kernel/slab/Acpi-Parse/poison | 1 + test/sys/kernel/slab/Acpi-Parse/reclaim_account | 1 + test/sys/kernel/slab/Acpi-Parse/red_zone | 1 + test/sys/kernel/slab/Acpi-Parse/sanity_checks | 1 + test/sys/kernel/slab/Acpi-Parse/shrink | 0 test/sys/kernel/slab/Acpi-Parse/slab_size | 1 + test/sys/kernel/slab/Acpi-Parse/slabs | 1 + test/sys/kernel/slab/Acpi-Parse/store_user | 1 + test/sys/kernel/slab/Acpi-Parse/total_objects | 1 + test/sys/kernel/slab/Acpi-Parse/trace | 1 + test/sys/kernel/slab/Acpi-Parse/validate | 0 test/sys/kernel/slab/Acpi-ParseExt/aliases | 1 + test/sys/kernel/slab/Acpi-ParseExt/align | 1 + test/sys/kernel/slab/Acpi-ParseExt/alloc_calls | 1 + test/sys/kernel/slab/Acpi-ParseExt/cache_dma | 1 + test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs | 1 + test/sys/kernel/slab/Acpi-ParseExt/ctor | 0 test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu | 1 + test/sys/kernel/slab/Acpi-ParseExt/free_calls | 1 + test/sys/kernel/slab/Acpi-ParseExt/hwcache_align | 1 + test/sys/kernel/slab/Acpi-ParseExt/object_size | 1 + test/sys/kernel/slab/Acpi-ParseExt/objects | 1 + test/sys/kernel/slab/Acpi-ParseExt/objects_partial | 1 + test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab | 1 + test/sys/kernel/slab/Acpi-ParseExt/order | 1 + test/sys/kernel/slab/Acpi-ParseExt/partial | 1 + test/sys/kernel/slab/Acpi-ParseExt/poison | 1 + test/sys/kernel/slab/Acpi-ParseExt/reclaim_account | 1 + test/sys/kernel/slab/Acpi-ParseExt/red_zone | 1 + test/sys/kernel/slab/Acpi-ParseExt/sanity_checks | 1 + test/sys/kernel/slab/Acpi-ParseExt/shrink | 0 test/sys/kernel/slab/Acpi-ParseExt/slab_size | 1 + test/sys/kernel/slab/Acpi-ParseExt/slabs | 1 + test/sys/kernel/slab/Acpi-ParseExt/store_user | 1 + test/sys/kernel/slab/Acpi-ParseExt/total_objects | 1 + test/sys/kernel/slab/Acpi-ParseExt/trace | 1 + test/sys/kernel/slab/Acpi-ParseExt/validate | 0 test/sys/kernel/slab/Acpi-State/aliases | 1 + test/sys/kernel/slab/Acpi-State/align | 1 + test/sys/kernel/slab/Acpi-State/alloc_calls | 1 + test/sys/kernel/slab/Acpi-State/cache_dma | 1 + test/sys/kernel/slab/Acpi-State/cpu_slabs | 1 + test/sys/kernel/slab/Acpi-State/ctor | 0 test/sys/kernel/slab/Acpi-State/destroy_by_rcu | 1 + test/sys/kernel/slab/Acpi-State/free_calls | 1 + test/sys/kernel/slab/Acpi-State/hwcache_align | 1 + test/sys/kernel/slab/Acpi-State/object_size | 1 + test/sys/kernel/slab/Acpi-State/objects | 1 + test/sys/kernel/slab/Acpi-State/objects_partial | 1 + test/sys/kernel/slab/Acpi-State/objs_per_slab | 1 + test/sys/kernel/slab/Acpi-State/order | 1 + test/sys/kernel/slab/Acpi-State/partial | 1 + test/sys/kernel/slab/Acpi-State/poison | 1 + test/sys/kernel/slab/Acpi-State/reclaim_account | 1 + test/sys/kernel/slab/Acpi-State/red_zone | 1 + test/sys/kernel/slab/Acpi-State/sanity_checks | 1 + test/sys/kernel/slab/Acpi-State/shrink | 0 test/sys/kernel/slab/Acpi-State/slab_size | 1 + test/sys/kernel/slab/Acpi-State/slabs | 1 + test/sys/kernel/slab/Acpi-State/store_user | 1 + test/sys/kernel/slab/Acpi-State/total_objects | 1 + test/sys/kernel/slab/Acpi-State/trace | 1 + test/sys/kernel/slab/Acpi-State/validate | 0 test/sys/kernel/slab/RAW/aliases | 1 + test/sys/kernel/slab/RAW/align | 1 + test/sys/kernel/slab/RAW/alloc_calls | 1 + test/sys/kernel/slab/RAW/cache_dma | 1 + test/sys/kernel/slab/RAW/cpu_slabs | 1 + test/sys/kernel/slab/RAW/ctor | 0 test/sys/kernel/slab/RAW/destroy_by_rcu | 1 + test/sys/kernel/slab/RAW/free_calls | 1 + test/sys/kernel/slab/RAW/hwcache_align | 1 + test/sys/kernel/slab/RAW/object_size | 1 + test/sys/kernel/slab/RAW/objects | 1 + test/sys/kernel/slab/RAW/objects_partial | 1 + test/sys/kernel/slab/RAW/objs_per_slab | 1 + test/sys/kernel/slab/RAW/order | 1 + test/sys/kernel/slab/RAW/partial | 1 + test/sys/kernel/slab/RAW/poison | 1 + test/sys/kernel/slab/RAW/reclaim_account | 1 + test/sys/kernel/slab/RAW/red_zone | 1 + test/sys/kernel/slab/RAW/sanity_checks | 1 + test/sys/kernel/slab/RAW/shrink | 0 test/sys/kernel/slab/RAW/slab_size | 1 + test/sys/kernel/slab/RAW/slabs | 1 + test/sys/kernel/slab/RAW/store_user | 1 + test/sys/kernel/slab/RAW/total_objects | 1 + test/sys/kernel/slab/RAW/trace | 1 + test/sys/kernel/slab/RAW/validate | 0 test/sys/kernel/slab/RAWv6/aliases | 1 + test/sys/kernel/slab/RAWv6/align | 1 + test/sys/kernel/slab/RAWv6/alloc_calls | 1 + test/sys/kernel/slab/RAWv6/cache_dma | 1 + test/sys/kernel/slab/RAWv6/cpu_slabs | 1 + test/sys/kernel/slab/RAWv6/ctor | 0 test/sys/kernel/slab/RAWv6/destroy_by_rcu | 1 + test/sys/kernel/slab/RAWv6/free_calls | 1 + test/sys/kernel/slab/RAWv6/hwcache_align | 1 + test/sys/kernel/slab/RAWv6/object_size | 1 + test/sys/kernel/slab/RAWv6/objects | 1 + test/sys/kernel/slab/RAWv6/objects_partial | 1 + test/sys/kernel/slab/RAWv6/objs_per_slab | 1 + test/sys/kernel/slab/RAWv6/order | 1 + test/sys/kernel/slab/RAWv6/partial | 1 + test/sys/kernel/slab/RAWv6/poison | 1 + test/sys/kernel/slab/RAWv6/reclaim_account | 1 + test/sys/kernel/slab/RAWv6/red_zone | 1 + test/sys/kernel/slab/RAWv6/sanity_checks | 1 + test/sys/kernel/slab/RAWv6/shrink | 0 test/sys/kernel/slab/RAWv6/slab_size | 1 + test/sys/kernel/slab/RAWv6/slabs | 1 + test/sys/kernel/slab/RAWv6/store_user | 1 + test/sys/kernel/slab/RAWv6/total_objects | 1 + test/sys/kernel/slab/RAWv6/trace | 1 + test/sys/kernel/slab/RAWv6/validate | 0 test/sys/kernel/slab/TCP/aliases | 1 + test/sys/kernel/slab/TCP/align | 1 + test/sys/kernel/slab/TCP/alloc_calls | 1 + test/sys/kernel/slab/TCP/cache_dma | 1 + test/sys/kernel/slab/TCP/cpu_slabs | 1 + test/sys/kernel/slab/TCP/ctor | 0 test/sys/kernel/slab/TCP/destroy_by_rcu | 1 + test/sys/kernel/slab/TCP/free_calls | 1 + test/sys/kernel/slab/TCP/hwcache_align | 1 + test/sys/kernel/slab/TCP/object_size | 1 + test/sys/kernel/slab/TCP/objects | 1 + test/sys/kernel/slab/TCP/objects_partial | 1 + test/sys/kernel/slab/TCP/objs_per_slab | 1 + test/sys/kernel/slab/TCP/order | 1 + test/sys/kernel/slab/TCP/partial | 1 + test/sys/kernel/slab/TCP/poison | 1 + test/sys/kernel/slab/TCP/reclaim_account | 1 + test/sys/kernel/slab/TCP/red_zone | 1 + test/sys/kernel/slab/TCP/sanity_checks | 1 + test/sys/kernel/slab/TCP/shrink | 0 test/sys/kernel/slab/TCP/slab_size | 1 + test/sys/kernel/slab/TCP/slabs | 1 + test/sys/kernel/slab/TCP/store_user | 1 + test/sys/kernel/slab/TCP/total_objects | 1 + test/sys/kernel/slab/TCP/trace | 1 + test/sys/kernel/slab/TCP/validate | 0 test/sys/kernel/slab/TCPv6/aliases | 1 + test/sys/kernel/slab/TCPv6/align | 1 + test/sys/kernel/slab/TCPv6/alloc_calls | 1 + test/sys/kernel/slab/TCPv6/cache_dma | 1 + test/sys/kernel/slab/TCPv6/cpu_slabs | 1 + test/sys/kernel/slab/TCPv6/ctor | 0 test/sys/kernel/slab/TCPv6/destroy_by_rcu | 1 + test/sys/kernel/slab/TCPv6/free_calls | 1 + test/sys/kernel/slab/TCPv6/hwcache_align | 1 + test/sys/kernel/slab/TCPv6/object_size | 1 + test/sys/kernel/slab/TCPv6/objects | 1 + test/sys/kernel/slab/TCPv6/objects_partial | 1 + test/sys/kernel/slab/TCPv6/objs_per_slab | 1 + test/sys/kernel/slab/TCPv6/order | 1 + test/sys/kernel/slab/TCPv6/partial | 1 + test/sys/kernel/slab/TCPv6/poison | 1 + test/sys/kernel/slab/TCPv6/reclaim_account | 1 + test/sys/kernel/slab/TCPv6/red_zone | 1 + test/sys/kernel/slab/TCPv6/sanity_checks | 1 + test/sys/kernel/slab/TCPv6/shrink | 0 test/sys/kernel/slab/TCPv6/slab_size | 1 + test/sys/kernel/slab/TCPv6/slabs | 1 + test/sys/kernel/slab/TCPv6/store_user | 1 + test/sys/kernel/slab/TCPv6/total_objects | 1 + test/sys/kernel/slab/TCPv6/trace | 1 + test/sys/kernel/slab/TCPv6/validate | 0 test/sys/kernel/slab/UDP-Lite/aliases | 1 + test/sys/kernel/slab/UDP-Lite/align | 1 + test/sys/kernel/slab/UDP-Lite/alloc_calls | 1 + test/sys/kernel/slab/UDP-Lite/cache_dma | 1 + test/sys/kernel/slab/UDP-Lite/cpu_slabs | 1 + test/sys/kernel/slab/UDP-Lite/ctor | 0 test/sys/kernel/slab/UDP-Lite/destroy_by_rcu | 1 + test/sys/kernel/slab/UDP-Lite/free_calls | 1 + test/sys/kernel/slab/UDP-Lite/hwcache_align | 1 + test/sys/kernel/slab/UDP-Lite/object_size | 1 + test/sys/kernel/slab/UDP-Lite/objects | 1 + test/sys/kernel/slab/UDP-Lite/objects_partial | 1 + test/sys/kernel/slab/UDP-Lite/objs_per_slab | 1 + test/sys/kernel/slab/UDP-Lite/order | 1 + test/sys/kernel/slab/UDP-Lite/partial | 1 + test/sys/kernel/slab/UDP-Lite/poison | 1 + test/sys/kernel/slab/UDP-Lite/reclaim_account | 1 + test/sys/kernel/slab/UDP-Lite/red_zone | 1 + test/sys/kernel/slab/UDP-Lite/sanity_checks | 1 + test/sys/kernel/slab/UDP-Lite/shrink | 0 test/sys/kernel/slab/UDP-Lite/slab_size | 1 + test/sys/kernel/slab/UDP-Lite/slabs | 1 + test/sys/kernel/slab/UDP-Lite/store_user | 1 + test/sys/kernel/slab/UDP-Lite/total_objects | 1 + test/sys/kernel/slab/UDP-Lite/trace | 1 + test/sys/kernel/slab/UDP-Lite/validate | 0 test/sys/kernel/slab/UDP/aliases | 1 + test/sys/kernel/slab/UDP/align | 1 + test/sys/kernel/slab/UDP/alloc_calls | 1 + test/sys/kernel/slab/UDP/cache_dma | 1 + test/sys/kernel/slab/UDP/cpu_slabs | 1 + test/sys/kernel/slab/UDP/ctor | 0 test/sys/kernel/slab/UDP/destroy_by_rcu | 1 + test/sys/kernel/slab/UDP/free_calls | 2 + test/sys/kernel/slab/UDP/hwcache_align | 1 + test/sys/kernel/slab/UDP/object_size | 1 + test/sys/kernel/slab/UDP/objects | 1 + test/sys/kernel/slab/UDP/objects_partial | 1 + test/sys/kernel/slab/UDP/objs_per_slab | 1 + test/sys/kernel/slab/UDP/order | 1 + test/sys/kernel/slab/UDP/partial | 1 + test/sys/kernel/slab/UDP/poison | 1 + test/sys/kernel/slab/UDP/reclaim_account | 1 + test/sys/kernel/slab/UDP/red_zone | 1 + test/sys/kernel/slab/UDP/sanity_checks | 1 + test/sys/kernel/slab/UDP/shrink | 0 test/sys/kernel/slab/UDP/slab_size | 1 + test/sys/kernel/slab/UDP/slabs | 1 + test/sys/kernel/slab/UDP/store_user | 1 + test/sys/kernel/slab/UDP/total_objects | 1 + test/sys/kernel/slab/UDP/trace | 1 + test/sys/kernel/slab/UDP/validate | 0 test/sys/kernel/slab/UDPLITEv6/aliases | 1 + test/sys/kernel/slab/UDPLITEv6/align | 1 + test/sys/kernel/slab/UDPLITEv6/alloc_calls | 1 + test/sys/kernel/slab/UDPLITEv6/cache_dma | 1 + test/sys/kernel/slab/UDPLITEv6/cpu_slabs | 1 + test/sys/kernel/slab/UDPLITEv6/ctor | 0 test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu | 1 + test/sys/kernel/slab/UDPLITEv6/free_calls | 1 + test/sys/kernel/slab/UDPLITEv6/hwcache_align | 1 + test/sys/kernel/slab/UDPLITEv6/object_size | 1 + test/sys/kernel/slab/UDPLITEv6/objects | 1 + test/sys/kernel/slab/UDPLITEv6/objects_partial | 1 + test/sys/kernel/slab/UDPLITEv6/objs_per_slab | 1 + test/sys/kernel/slab/UDPLITEv6/order | 1 + test/sys/kernel/slab/UDPLITEv6/partial | 1 + test/sys/kernel/slab/UDPLITEv6/poison | 1 + test/sys/kernel/slab/UDPLITEv6/reclaim_account | 1 + test/sys/kernel/slab/UDPLITEv6/red_zone | 1 + test/sys/kernel/slab/UDPLITEv6/sanity_checks | 1 + test/sys/kernel/slab/UDPLITEv6/shrink | 0 test/sys/kernel/slab/UDPLITEv6/slab_size | 1 + test/sys/kernel/slab/UDPLITEv6/slabs | 1 + test/sys/kernel/slab/UDPLITEv6/store_user | 1 + test/sys/kernel/slab/UDPLITEv6/total_objects | 1 + test/sys/kernel/slab/UDPLITEv6/trace | 1 + test/sys/kernel/slab/UDPLITEv6/validate | 0 test/sys/kernel/slab/UDPv6/aliases | 1 + test/sys/kernel/slab/UDPv6/align | 1 + test/sys/kernel/slab/UDPv6/alloc_calls | 1 + test/sys/kernel/slab/UDPv6/cache_dma | 1 + test/sys/kernel/slab/UDPv6/cpu_slabs | 1 + test/sys/kernel/slab/UDPv6/ctor | 0 test/sys/kernel/slab/UDPv6/destroy_by_rcu | 1 + test/sys/kernel/slab/UDPv6/free_calls | 1 + test/sys/kernel/slab/UDPv6/hwcache_align | 1 + test/sys/kernel/slab/UDPv6/object_size | 1 + test/sys/kernel/slab/UDPv6/objects | 1 + test/sys/kernel/slab/UDPv6/objects_partial | 1 + test/sys/kernel/slab/UDPv6/objs_per_slab | 1 + test/sys/kernel/slab/UDPv6/order | 1 + test/sys/kernel/slab/UDPv6/partial | 1 + test/sys/kernel/slab/UDPv6/poison | 1 + test/sys/kernel/slab/UDPv6/reclaim_account | 1 + test/sys/kernel/slab/UDPv6/red_zone | 1 + test/sys/kernel/slab/UDPv6/sanity_checks | 1 + test/sys/kernel/slab/UDPv6/shrink | 0 test/sys/kernel/slab/UDPv6/slab_size | 1 + test/sys/kernel/slab/UDPv6/slabs | 1 + test/sys/kernel/slab/UDPv6/store_user | 1 + test/sys/kernel/slab/UDPv6/total_objects | 1 + test/sys/kernel/slab/UDPv6/trace | 1 + test/sys/kernel/slab/UDPv6/validate | 0 test/sys/kernel/slab/UNIX/aliases | 1 + test/sys/kernel/slab/UNIX/align | 1 + test/sys/kernel/slab/UNIX/alloc_calls | 1 + test/sys/kernel/slab/UNIX/cache_dma | 1 + test/sys/kernel/slab/UNIX/cpu_slabs | 1 + test/sys/kernel/slab/UNIX/ctor | 0 test/sys/kernel/slab/UNIX/destroy_by_rcu | 1 + test/sys/kernel/slab/UNIX/free_calls | 2 + test/sys/kernel/slab/UNIX/hwcache_align | 1 + test/sys/kernel/slab/UNIX/object_size | 1 + test/sys/kernel/slab/UNIX/objects | 1 + test/sys/kernel/slab/UNIX/objects_partial | 1 + test/sys/kernel/slab/UNIX/objs_per_slab | 1 + test/sys/kernel/slab/UNIX/order | 1 + test/sys/kernel/slab/UNIX/partial | 1 + test/sys/kernel/slab/UNIX/poison | 1 + test/sys/kernel/slab/UNIX/reclaim_account | 1 + test/sys/kernel/slab/UNIX/red_zone | 1 + test/sys/kernel/slab/UNIX/sanity_checks | 1 + test/sys/kernel/slab/UNIX/shrink | 0 test/sys/kernel/slab/UNIX/slab_size | 1 + test/sys/kernel/slab/UNIX/slabs | 1 + test/sys/kernel/slab/UNIX/store_user | 1 + test/sys/kernel/slab/UNIX/total_objects | 1 + test/sys/kernel/slab/UNIX/trace | 1 + test/sys/kernel/slab/UNIX/validate | 0 test/sys/kernel/slab/anon_vma/aliases | 1 + test/sys/kernel/slab/anon_vma/align | 1 + test/sys/kernel/slab/anon_vma/alloc_calls | 1 + test/sys/kernel/slab/anon_vma/cache_dma | 1 + test/sys/kernel/slab/anon_vma/cpu_slabs | 1 + test/sys/kernel/slab/anon_vma/ctor | 1 + test/sys/kernel/slab/anon_vma/destroy_by_rcu | 1 + test/sys/kernel/slab/anon_vma/free_calls | 2 + test/sys/kernel/slab/anon_vma/hwcache_align | 1 + test/sys/kernel/slab/anon_vma/object_size | 1 + test/sys/kernel/slab/anon_vma/objects | 1 + test/sys/kernel/slab/anon_vma/objects_partial | 1 + test/sys/kernel/slab/anon_vma/objs_per_slab | 1 + test/sys/kernel/slab/anon_vma/order | 1 + test/sys/kernel/slab/anon_vma/partial | 1 + test/sys/kernel/slab/anon_vma/poison | 1 + test/sys/kernel/slab/anon_vma/reclaim_account | 1 + test/sys/kernel/slab/anon_vma/red_zone | 1 + test/sys/kernel/slab/anon_vma/sanity_checks | 1 + test/sys/kernel/slab/anon_vma/shrink | 0 test/sys/kernel/slab/anon_vma/slab_size | 1 + test/sys/kernel/slab/anon_vma/slabs | 1 + test/sys/kernel/slab/anon_vma/store_user | 1 + test/sys/kernel/slab/anon_vma/total_objects | 1 + test/sys/kernel/slab/anon_vma/trace | 1 + test/sys/kernel/slab/anon_vma/validate | 0 test/sys/kernel/slab/arp_cache/aliases | 1 + test/sys/kernel/slab/arp_cache/align | 1 + test/sys/kernel/slab/arp_cache/alloc_calls | 1 + test/sys/kernel/slab/arp_cache/cache_dma | 1 + test/sys/kernel/slab/arp_cache/cpu_slabs | 1 + test/sys/kernel/slab/arp_cache/ctor | 0 test/sys/kernel/slab/arp_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/arp_cache/free_calls | 1 + test/sys/kernel/slab/arp_cache/hwcache_align | 1 + test/sys/kernel/slab/arp_cache/object_size | 1 + test/sys/kernel/slab/arp_cache/objects | 1 + test/sys/kernel/slab/arp_cache/objects_partial | 1 + test/sys/kernel/slab/arp_cache/objs_per_slab | 1 + test/sys/kernel/slab/arp_cache/order | 1 + test/sys/kernel/slab/arp_cache/partial | 1 + test/sys/kernel/slab/arp_cache/poison | 1 + test/sys/kernel/slab/arp_cache/reclaim_account | 1 + test/sys/kernel/slab/arp_cache/red_zone | 1 + test/sys/kernel/slab/arp_cache/sanity_checks | 1 + test/sys/kernel/slab/arp_cache/shrink | 0 test/sys/kernel/slab/arp_cache/slab_size | 1 + test/sys/kernel/slab/arp_cache/slabs | 1 + test/sys/kernel/slab/arp_cache/store_user | 1 + test/sys/kernel/slab/arp_cache/total_objects | 1 + test/sys/kernel/slab/arp_cache/trace | 1 + test/sys/kernel/slab/arp_cache/validate | 0 test/sys/kernel/slab/bdev_cache/aliases | 1 + test/sys/kernel/slab/bdev_cache/align | 1 + test/sys/kernel/slab/bdev_cache/alloc_calls | 1 + test/sys/kernel/slab/bdev_cache/cache_dma | 1 + test/sys/kernel/slab/bdev_cache/cpu_slabs | 1 + test/sys/kernel/slab/bdev_cache/ctor | 1 + test/sys/kernel/slab/bdev_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/bdev_cache/free_calls | 2 + test/sys/kernel/slab/bdev_cache/hwcache_align | 1 + test/sys/kernel/slab/bdev_cache/object_size | 1 + test/sys/kernel/slab/bdev_cache/objects | 1 + test/sys/kernel/slab/bdev_cache/objects_partial | 1 + test/sys/kernel/slab/bdev_cache/objs_per_slab | 1 + test/sys/kernel/slab/bdev_cache/order | 1 + test/sys/kernel/slab/bdev_cache/partial | 1 + test/sys/kernel/slab/bdev_cache/poison | 1 + test/sys/kernel/slab/bdev_cache/reclaim_account | 1 + test/sys/kernel/slab/bdev_cache/red_zone | 1 + test/sys/kernel/slab/bdev_cache/sanity_checks | 1 + test/sys/kernel/slab/bdev_cache/shrink | 0 test/sys/kernel/slab/bdev_cache/slab_size | 1 + test/sys/kernel/slab/bdev_cache/slabs | 1 + test/sys/kernel/slab/bdev_cache/store_user | 1 + test/sys/kernel/slab/bdev_cache/total_objects | 1 + test/sys/kernel/slab/bdev_cache/trace | 1 + test/sys/kernel/slab/bdev_cache/validate | 0 test/sys/kernel/slab/bio/aliases | 1 + test/sys/kernel/slab/bio/align | 1 + test/sys/kernel/slab/bio/alloc_calls | 1 + test/sys/kernel/slab/bio/cache_dma | 1 + test/sys/kernel/slab/bio/cpu_slabs | 1 + test/sys/kernel/slab/bio/ctor | 0 test/sys/kernel/slab/bio/destroy_by_rcu | 1 + test/sys/kernel/slab/bio/free_calls | 1 + test/sys/kernel/slab/bio/hwcache_align | 1 + test/sys/kernel/slab/bio/object_size | 1 + test/sys/kernel/slab/bio/objects | 1 + test/sys/kernel/slab/bio/objects_partial | 1 + test/sys/kernel/slab/bio/objs_per_slab | 1 + test/sys/kernel/slab/bio/order | 1 + test/sys/kernel/slab/bio/partial | 1 + test/sys/kernel/slab/bio/poison | 1 + test/sys/kernel/slab/bio/reclaim_account | 1 + test/sys/kernel/slab/bio/red_zone | 1 + test/sys/kernel/slab/bio/sanity_checks | 1 + test/sys/kernel/slab/bio/shrink | 0 test/sys/kernel/slab/bio/slab_size | 1 + test/sys/kernel/slab/bio/slabs | 1 + test/sys/kernel/slab/bio/store_user | 1 + test/sys/kernel/slab/bio/total_objects | 1 + test/sys/kernel/slab/bio/trace | 1 + test/sys/kernel/slab/bio/validate | 0 test/sys/kernel/slab/biovec-1/aliases | 1 + test/sys/kernel/slab/biovec-1/align | 1 + test/sys/kernel/slab/biovec-1/alloc_calls | 1 + test/sys/kernel/slab/biovec-1/cache_dma | 1 + test/sys/kernel/slab/biovec-1/cpu_slabs | 1 + test/sys/kernel/slab/biovec-1/ctor | 0 test/sys/kernel/slab/biovec-1/destroy_by_rcu | 1 + test/sys/kernel/slab/biovec-1/free_calls | 1 + test/sys/kernel/slab/biovec-1/hwcache_align | 1 + test/sys/kernel/slab/biovec-1/object_size | 1 + test/sys/kernel/slab/biovec-1/objects | 1 + test/sys/kernel/slab/biovec-1/objects_partial | 1 + test/sys/kernel/slab/biovec-1/objs_per_slab | 1 + test/sys/kernel/slab/biovec-1/order | 1 + test/sys/kernel/slab/biovec-1/partial | 1 + test/sys/kernel/slab/biovec-1/poison | 1 + test/sys/kernel/slab/biovec-1/reclaim_account | 1 + test/sys/kernel/slab/biovec-1/red_zone | 1 + test/sys/kernel/slab/biovec-1/sanity_checks | 1 + test/sys/kernel/slab/biovec-1/shrink | 0 test/sys/kernel/slab/biovec-1/slab_size | 1 + test/sys/kernel/slab/biovec-1/slabs | 1 + test/sys/kernel/slab/biovec-1/store_user | 1 + test/sys/kernel/slab/biovec-1/total_objects | 1 + test/sys/kernel/slab/biovec-1/trace | 1 + test/sys/kernel/slab/biovec-1/validate | 0 test/sys/kernel/slab/biovec-128/aliases | 1 + test/sys/kernel/slab/biovec-128/align | 1 + test/sys/kernel/slab/biovec-128/alloc_calls | 1 + test/sys/kernel/slab/biovec-128/cache_dma | 1 + test/sys/kernel/slab/biovec-128/cpu_slabs | 1 + test/sys/kernel/slab/biovec-128/ctor | 0 test/sys/kernel/slab/biovec-128/destroy_by_rcu | 1 + test/sys/kernel/slab/biovec-128/free_calls | 1 + test/sys/kernel/slab/biovec-128/hwcache_align | 1 + test/sys/kernel/slab/biovec-128/object_size | 1 + test/sys/kernel/slab/biovec-128/objects | 1 + test/sys/kernel/slab/biovec-128/objects_partial | 1 + test/sys/kernel/slab/biovec-128/objs_per_slab | 1 + test/sys/kernel/slab/biovec-128/order | 1 + test/sys/kernel/slab/biovec-128/partial | 1 + test/sys/kernel/slab/biovec-128/poison | 1 + test/sys/kernel/slab/biovec-128/reclaim_account | 1 + test/sys/kernel/slab/biovec-128/red_zone | 1 + test/sys/kernel/slab/biovec-128/sanity_checks | 1 + test/sys/kernel/slab/biovec-128/shrink | 0 test/sys/kernel/slab/biovec-128/slab_size | 1 + test/sys/kernel/slab/biovec-128/slabs | 1 + test/sys/kernel/slab/biovec-128/store_user | 1 + test/sys/kernel/slab/biovec-128/total_objects | 1 + test/sys/kernel/slab/biovec-128/trace | 1 + test/sys/kernel/slab/biovec-128/validate | 0 test/sys/kernel/slab/biovec-16/aliases | 1 + test/sys/kernel/slab/biovec-16/align | 1 + test/sys/kernel/slab/biovec-16/alloc_calls | 1 + test/sys/kernel/slab/biovec-16/cache_dma | 1 + test/sys/kernel/slab/biovec-16/cpu_slabs | 1 + test/sys/kernel/slab/biovec-16/ctor | 0 test/sys/kernel/slab/biovec-16/destroy_by_rcu | 1 + test/sys/kernel/slab/biovec-16/free_calls | 1 + test/sys/kernel/slab/biovec-16/hwcache_align | 1 + test/sys/kernel/slab/biovec-16/object_size | 1 + test/sys/kernel/slab/biovec-16/objects | 1 + test/sys/kernel/slab/biovec-16/objects_partial | 1 + test/sys/kernel/slab/biovec-16/objs_per_slab | 1 + test/sys/kernel/slab/biovec-16/order | 1 + test/sys/kernel/slab/biovec-16/partial | 1 + test/sys/kernel/slab/biovec-16/poison | 1 + test/sys/kernel/slab/biovec-16/reclaim_account | 1 + test/sys/kernel/slab/biovec-16/red_zone | 1 + test/sys/kernel/slab/biovec-16/sanity_checks | 1 + test/sys/kernel/slab/biovec-16/shrink | 0 test/sys/kernel/slab/biovec-16/slab_size | 1 + test/sys/kernel/slab/biovec-16/slabs | 1 + test/sys/kernel/slab/biovec-16/store_user | 1 + test/sys/kernel/slab/biovec-16/total_objects | 1 + test/sys/kernel/slab/biovec-16/trace | 1 + test/sys/kernel/slab/biovec-16/validate | 0 test/sys/kernel/slab/biovec-256/aliases | 1 + test/sys/kernel/slab/biovec-256/align | 1 + test/sys/kernel/slab/biovec-256/alloc_calls | 1 + test/sys/kernel/slab/biovec-256/cache_dma | 1 + test/sys/kernel/slab/biovec-256/cpu_slabs | 1 + test/sys/kernel/slab/biovec-256/ctor | 0 test/sys/kernel/slab/biovec-256/destroy_by_rcu | 1 + test/sys/kernel/slab/biovec-256/free_calls | 1 + test/sys/kernel/slab/biovec-256/hwcache_align | 1 + test/sys/kernel/slab/biovec-256/object_size | 1 + test/sys/kernel/slab/biovec-256/objects | 1 + test/sys/kernel/slab/biovec-256/objects_partial | 1 + test/sys/kernel/slab/biovec-256/objs_per_slab | 1 + test/sys/kernel/slab/biovec-256/order | 1 + test/sys/kernel/slab/biovec-256/partial | 1 + test/sys/kernel/slab/biovec-256/poison | 1 + test/sys/kernel/slab/biovec-256/reclaim_account | 1 + test/sys/kernel/slab/biovec-256/red_zone | 1 + test/sys/kernel/slab/biovec-256/sanity_checks | 1 + test/sys/kernel/slab/biovec-256/shrink | 0 test/sys/kernel/slab/biovec-256/slab_size | 1 + test/sys/kernel/slab/biovec-256/slabs | 1 + test/sys/kernel/slab/biovec-256/store_user | 1 + test/sys/kernel/slab/biovec-256/total_objects | 1 + test/sys/kernel/slab/biovec-256/trace | 1 + test/sys/kernel/slab/biovec-256/validate | 0 test/sys/kernel/slab/biovec-4/aliases | 1 + test/sys/kernel/slab/biovec-4/align | 1 + test/sys/kernel/slab/biovec-4/alloc_calls | 1 + test/sys/kernel/slab/biovec-4/cache_dma | 1 + test/sys/kernel/slab/biovec-4/cpu_slabs | 1 + test/sys/kernel/slab/biovec-4/ctor | 0 test/sys/kernel/slab/biovec-4/destroy_by_rcu | 1 + test/sys/kernel/slab/biovec-4/free_calls | 1 + test/sys/kernel/slab/biovec-4/hwcache_align | 1 + test/sys/kernel/slab/biovec-4/object_size | 1 + test/sys/kernel/slab/biovec-4/objects | 1 + test/sys/kernel/slab/biovec-4/objects_partial | 1 + test/sys/kernel/slab/biovec-4/objs_per_slab | 1 + test/sys/kernel/slab/biovec-4/order | 1 + test/sys/kernel/slab/biovec-4/partial | 1 + test/sys/kernel/slab/biovec-4/poison | 1 + test/sys/kernel/slab/biovec-4/reclaim_account | 1 + test/sys/kernel/slab/biovec-4/red_zone | 1 + test/sys/kernel/slab/biovec-4/sanity_checks | 1 + test/sys/kernel/slab/biovec-4/shrink | 0 test/sys/kernel/slab/biovec-4/slab_size | 1 + test/sys/kernel/slab/biovec-4/slabs | 1 + test/sys/kernel/slab/biovec-4/store_user | 1 + test/sys/kernel/slab/biovec-4/total_objects | 1 + test/sys/kernel/slab/biovec-4/trace | 1 + test/sys/kernel/slab/biovec-4/validate | 0 test/sys/kernel/slab/biovec-64/aliases | 1 + test/sys/kernel/slab/biovec-64/align | 1 + test/sys/kernel/slab/biovec-64/alloc_calls | 1 + test/sys/kernel/slab/biovec-64/cache_dma | 1 + test/sys/kernel/slab/biovec-64/cpu_slabs | 1 + test/sys/kernel/slab/biovec-64/ctor | 0 test/sys/kernel/slab/biovec-64/destroy_by_rcu | 1 + test/sys/kernel/slab/biovec-64/free_calls | 1 + test/sys/kernel/slab/biovec-64/hwcache_align | 1 + test/sys/kernel/slab/biovec-64/object_size | 1 + test/sys/kernel/slab/biovec-64/objects | 1 + test/sys/kernel/slab/biovec-64/objects_partial | 1 + test/sys/kernel/slab/biovec-64/objs_per_slab | 1 + test/sys/kernel/slab/biovec-64/order | 1 + test/sys/kernel/slab/biovec-64/partial | 1 + test/sys/kernel/slab/biovec-64/poison | 1 + test/sys/kernel/slab/biovec-64/reclaim_account | 1 + test/sys/kernel/slab/biovec-64/red_zone | 1 + test/sys/kernel/slab/biovec-64/sanity_checks | 1 + test/sys/kernel/slab/biovec-64/shrink | 0 test/sys/kernel/slab/biovec-64/slab_size | 1 + test/sys/kernel/slab/biovec-64/slabs | 1 + test/sys/kernel/slab/biovec-64/store_user | 1 + test/sys/kernel/slab/biovec-64/total_objects | 1 + test/sys/kernel/slab/biovec-64/trace | 1 + test/sys/kernel/slab/biovec-64/validate | 0 test/sys/kernel/slab/blkdev_ioc/aliases | 1 + test/sys/kernel/slab/blkdev_ioc/align | 1 + test/sys/kernel/slab/blkdev_ioc/alloc_calls | 1 + test/sys/kernel/slab/blkdev_ioc/cache_dma | 1 + test/sys/kernel/slab/blkdev_ioc/cpu_slabs | 1 + test/sys/kernel/slab/blkdev_ioc/ctor | 0 test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu | 1 + test/sys/kernel/slab/blkdev_ioc/free_calls | 2 + test/sys/kernel/slab/blkdev_ioc/hwcache_align | 1 + test/sys/kernel/slab/blkdev_ioc/object_size | 1 + test/sys/kernel/slab/blkdev_ioc/objects | 1 + test/sys/kernel/slab/blkdev_ioc/objects_partial | 1 + test/sys/kernel/slab/blkdev_ioc/objs_per_slab | 1 + test/sys/kernel/slab/blkdev_ioc/order | 1 + test/sys/kernel/slab/blkdev_ioc/partial | 1 + test/sys/kernel/slab/blkdev_ioc/poison | 1 + test/sys/kernel/slab/blkdev_ioc/reclaim_account | 1 + test/sys/kernel/slab/blkdev_ioc/red_zone | 1 + test/sys/kernel/slab/blkdev_ioc/sanity_checks | 1 + test/sys/kernel/slab/blkdev_ioc/shrink | 0 test/sys/kernel/slab/blkdev_ioc/slab_size | 1 + test/sys/kernel/slab/blkdev_ioc/slabs | 1 + test/sys/kernel/slab/blkdev_ioc/store_user | 1 + test/sys/kernel/slab/blkdev_ioc/total_objects | 1 + test/sys/kernel/slab/blkdev_ioc/trace | 1 + test/sys/kernel/slab/blkdev_ioc/validate | 0 test/sys/kernel/slab/blkdev_queue/aliases | 1 + test/sys/kernel/slab/blkdev_queue/align | 1 + test/sys/kernel/slab/blkdev_queue/alloc_calls | 1 + test/sys/kernel/slab/blkdev_queue/cache_dma | 1 + test/sys/kernel/slab/blkdev_queue/cpu_slabs | 1 + test/sys/kernel/slab/blkdev_queue/ctor | 0 test/sys/kernel/slab/blkdev_queue/destroy_by_rcu | 1 + test/sys/kernel/slab/blkdev_queue/free_calls | 1 + test/sys/kernel/slab/blkdev_queue/hwcache_align | 1 + test/sys/kernel/slab/blkdev_queue/object_size | 1 + test/sys/kernel/slab/blkdev_queue/objects | 1 + test/sys/kernel/slab/blkdev_queue/objects_partial | 1 + test/sys/kernel/slab/blkdev_queue/objs_per_slab | 1 + test/sys/kernel/slab/blkdev_queue/order | 1 + test/sys/kernel/slab/blkdev_queue/partial | 1 + test/sys/kernel/slab/blkdev_queue/poison | 1 + test/sys/kernel/slab/blkdev_queue/reclaim_account | 1 + test/sys/kernel/slab/blkdev_queue/red_zone | 1 + test/sys/kernel/slab/blkdev_queue/sanity_checks | 1 + test/sys/kernel/slab/blkdev_queue/shrink | 0 test/sys/kernel/slab/blkdev_queue/slab_size | 1 + test/sys/kernel/slab/blkdev_queue/slabs | 1 + test/sys/kernel/slab/blkdev_queue/store_user | 1 + test/sys/kernel/slab/blkdev_queue/total_objects | 1 + test/sys/kernel/slab/blkdev_queue/trace | 1 + test/sys/kernel/slab/blkdev_queue/validate | 0 test/sys/kernel/slab/blkdev_requests/aliases | 1 + test/sys/kernel/slab/blkdev_requests/align | 1 + test/sys/kernel/slab/blkdev_requests/alloc_calls | 1 + test/sys/kernel/slab/blkdev_requests/cache_dma | 1 + test/sys/kernel/slab/blkdev_requests/cpu_slabs | 1 + test/sys/kernel/slab/blkdev_requests/ctor | 0 .../sys/kernel/slab/blkdev_requests/destroy_by_rcu | 1 + test/sys/kernel/slab/blkdev_requests/free_calls | 2 + test/sys/kernel/slab/blkdev_requests/hwcache_align | 1 + test/sys/kernel/slab/blkdev_requests/object_size | 1 + test/sys/kernel/slab/blkdev_requests/objects | 1 + .../kernel/slab/blkdev_requests/objects_partial | 1 + test/sys/kernel/slab/blkdev_requests/objs_per_slab | 1 + test/sys/kernel/slab/blkdev_requests/order | 1 + test/sys/kernel/slab/blkdev_requests/partial | 1 + test/sys/kernel/slab/blkdev_requests/poison | 1 + .../kernel/slab/blkdev_requests/reclaim_account | 1 + test/sys/kernel/slab/blkdev_requests/red_zone | 1 + test/sys/kernel/slab/blkdev_requests/sanity_checks | 1 + test/sys/kernel/slab/blkdev_requests/shrink | 0 test/sys/kernel/slab/blkdev_requests/slab_size | 1 + test/sys/kernel/slab/blkdev_requests/slabs | 1 + test/sys/kernel/slab/blkdev_requests/store_user | 1 + test/sys/kernel/slab/blkdev_requests/total_objects | 1 + test/sys/kernel/slab/blkdev_requests/trace | 1 + test/sys/kernel/slab/blkdev_requests/validate | 0 test/sys/kernel/slab/bsg_cmd/aliases | 1 + test/sys/kernel/slab/bsg_cmd/align | 1 + test/sys/kernel/slab/bsg_cmd/alloc_calls | 1 + test/sys/kernel/slab/bsg_cmd/cache_dma | 1 + test/sys/kernel/slab/bsg_cmd/cpu_slabs | 1 + test/sys/kernel/slab/bsg_cmd/ctor | 0 test/sys/kernel/slab/bsg_cmd/destroy_by_rcu | 1 + test/sys/kernel/slab/bsg_cmd/free_calls | 1 + test/sys/kernel/slab/bsg_cmd/hwcache_align | 1 + test/sys/kernel/slab/bsg_cmd/object_size | 1 + test/sys/kernel/slab/bsg_cmd/objects | 1 + test/sys/kernel/slab/bsg_cmd/objects_partial | 1 + test/sys/kernel/slab/bsg_cmd/objs_per_slab | 1 + test/sys/kernel/slab/bsg_cmd/order | 1 + test/sys/kernel/slab/bsg_cmd/partial | 1 + test/sys/kernel/slab/bsg_cmd/poison | 1 + test/sys/kernel/slab/bsg_cmd/reclaim_account | 1 + test/sys/kernel/slab/bsg_cmd/red_zone | 1 + test/sys/kernel/slab/bsg_cmd/sanity_checks | 1 + test/sys/kernel/slab/bsg_cmd/shrink | 0 test/sys/kernel/slab/bsg_cmd/slab_size | 1 + test/sys/kernel/slab/bsg_cmd/slabs | 1 + test/sys/kernel/slab/bsg_cmd/store_user | 1 + test/sys/kernel/slab/bsg_cmd/total_objects | 1 + test/sys/kernel/slab/bsg_cmd/trace | 1 + test/sys/kernel/slab/bsg_cmd/validate | 0 test/sys/kernel/slab/buffer_head/aliases | 1 + test/sys/kernel/slab/buffer_head/align | 1 + test/sys/kernel/slab/buffer_head/alloc_calls | 1 + test/sys/kernel/slab/buffer_head/cache_dma | 1 + test/sys/kernel/slab/buffer_head/cpu_slabs | 1 + test/sys/kernel/slab/buffer_head/ctor | 1 + test/sys/kernel/slab/buffer_head/destroy_by_rcu | 1 + test/sys/kernel/slab/buffer_head/free_calls | 2 + test/sys/kernel/slab/buffer_head/hwcache_align | 1 + test/sys/kernel/slab/buffer_head/object_size | 1 + test/sys/kernel/slab/buffer_head/objects | 1 + test/sys/kernel/slab/buffer_head/objects_partial | 1 + test/sys/kernel/slab/buffer_head/objs_per_slab | 1 + test/sys/kernel/slab/buffer_head/order | 1 + test/sys/kernel/slab/buffer_head/partial | 1 + test/sys/kernel/slab/buffer_head/poison | 1 + test/sys/kernel/slab/buffer_head/reclaim_account | 1 + test/sys/kernel/slab/buffer_head/red_zone | 1 + test/sys/kernel/slab/buffer_head/sanity_checks | 1 + test/sys/kernel/slab/buffer_head/shrink | 0 test/sys/kernel/slab/buffer_head/slab_size | 1 + test/sys/kernel/slab/buffer_head/slabs | 1 + test/sys/kernel/slab/buffer_head/store_user | 1 + test/sys/kernel/slab/buffer_head/total_objects | 1 + test/sys/kernel/slab/buffer_head/trace | 1 + test/sys/kernel/slab/buffer_head/validate | 0 test/sys/kernel/slab/cfq_io_context/aliases | 1 + test/sys/kernel/slab/cfq_io_context/align | 1 + test/sys/kernel/slab/cfq_io_context/alloc_calls | 1 + test/sys/kernel/slab/cfq_io_context/cache_dma | 1 + test/sys/kernel/slab/cfq_io_context/cpu_slabs | 1 + test/sys/kernel/slab/cfq_io_context/ctor | 0 test/sys/kernel/slab/cfq_io_context/destroy_by_rcu | 1 + test/sys/kernel/slab/cfq_io_context/free_calls | 2 + test/sys/kernel/slab/cfq_io_context/hwcache_align | 1 + test/sys/kernel/slab/cfq_io_context/object_size | 1 + test/sys/kernel/slab/cfq_io_context/objects | 1 + .../sys/kernel/slab/cfq_io_context/objects_partial | 1 + test/sys/kernel/slab/cfq_io_context/objs_per_slab | 1 + test/sys/kernel/slab/cfq_io_context/order | 1 + test/sys/kernel/slab/cfq_io_context/partial | 1 + test/sys/kernel/slab/cfq_io_context/poison | 1 + .../sys/kernel/slab/cfq_io_context/reclaim_account | 1 + test/sys/kernel/slab/cfq_io_context/red_zone | 1 + test/sys/kernel/slab/cfq_io_context/sanity_checks | 1 + test/sys/kernel/slab/cfq_io_context/shrink | 0 test/sys/kernel/slab/cfq_io_context/slab_size | 1 + test/sys/kernel/slab/cfq_io_context/slabs | 1 + test/sys/kernel/slab/cfq_io_context/store_user | 1 + test/sys/kernel/slab/cfq_io_context/total_objects | 1 + test/sys/kernel/slab/cfq_io_context/trace | 1 + test/sys/kernel/slab/cfq_io_context/validate | 0 test/sys/kernel/slab/cfq_queue/aliases | 1 + test/sys/kernel/slab/cfq_queue/align | 1 + test/sys/kernel/slab/cfq_queue/alloc_calls | 1 + test/sys/kernel/slab/cfq_queue/cache_dma | 1 + test/sys/kernel/slab/cfq_queue/cpu_slabs | 1 + test/sys/kernel/slab/cfq_queue/ctor | 0 test/sys/kernel/slab/cfq_queue/destroy_by_rcu | 1 + test/sys/kernel/slab/cfq_queue/free_calls | 2 + test/sys/kernel/slab/cfq_queue/hwcache_align | 1 + test/sys/kernel/slab/cfq_queue/object_size | 1 + test/sys/kernel/slab/cfq_queue/objects | 1 + test/sys/kernel/slab/cfq_queue/objects_partial | 1 + test/sys/kernel/slab/cfq_queue/objs_per_slab | 1 + test/sys/kernel/slab/cfq_queue/order | 1 + test/sys/kernel/slab/cfq_queue/partial | 1 + test/sys/kernel/slab/cfq_queue/poison | 1 + test/sys/kernel/slab/cfq_queue/reclaim_account | 1 + test/sys/kernel/slab/cfq_queue/red_zone | 1 + test/sys/kernel/slab/cfq_queue/sanity_checks | 1 + test/sys/kernel/slab/cfq_queue/shrink | 0 test/sys/kernel/slab/cfq_queue/slab_size | 1 + test/sys/kernel/slab/cfq_queue/slabs | 1 + test/sys/kernel/slab/cfq_queue/store_user | 1 + test/sys/kernel/slab/cfq_queue/total_objects | 1 + test/sys/kernel/slab/cfq_queue/trace | 1 + test/sys/kernel/slab/cfq_queue/validate | 0 test/sys/kernel/slab/dentry/aliases | 1 + test/sys/kernel/slab/dentry/align | 1 + test/sys/kernel/slab/dentry/alloc_calls | 1 + test/sys/kernel/slab/dentry/cache_dma | 1 + test/sys/kernel/slab/dentry/cpu_slabs | 1 + test/sys/kernel/slab/dentry/ctor | 0 test/sys/kernel/slab/dentry/destroy_by_rcu | 1 + test/sys/kernel/slab/dentry/free_calls | 3 + test/sys/kernel/slab/dentry/hwcache_align | 1 + test/sys/kernel/slab/dentry/object_size | 1 + test/sys/kernel/slab/dentry/objects | 1 + test/sys/kernel/slab/dentry/objects_partial | 1 + test/sys/kernel/slab/dentry/objs_per_slab | 1 + test/sys/kernel/slab/dentry/order | 1 + test/sys/kernel/slab/dentry/partial | 1 + test/sys/kernel/slab/dentry/poison | 1 + test/sys/kernel/slab/dentry/reclaim_account | 1 + test/sys/kernel/slab/dentry/red_zone | 1 + test/sys/kernel/slab/dentry/sanity_checks | 1 + test/sys/kernel/slab/dentry/shrink | 0 test/sys/kernel/slab/dentry/slab_size | 1 + test/sys/kernel/slab/dentry/slabs | 1 + test/sys/kernel/slab/dentry/store_user | 1 + test/sys/kernel/slab/dentry/total_objects | 1 + test/sys/kernel/slab/dentry/trace | 1 + test/sys/kernel/slab/dentry/validate | 0 test/sys/kernel/slab/dm_io/aliases | 1 + test/sys/kernel/slab/dm_io/align | 1 + test/sys/kernel/slab/dm_io/alloc_calls | 1 + test/sys/kernel/slab/dm_io/cache_dma | 1 + test/sys/kernel/slab/dm_io/cpu_slabs | 1 + test/sys/kernel/slab/dm_io/ctor | 0 test/sys/kernel/slab/dm_io/destroy_by_rcu | 1 + test/sys/kernel/slab/dm_io/free_calls | 1 + test/sys/kernel/slab/dm_io/hwcache_align | 1 + test/sys/kernel/slab/dm_io/object_size | 1 + test/sys/kernel/slab/dm_io/objects | 1 + test/sys/kernel/slab/dm_io/objects_partial | 1 + test/sys/kernel/slab/dm_io/objs_per_slab | 1 + test/sys/kernel/slab/dm_io/order | 1 + test/sys/kernel/slab/dm_io/partial | 1 + test/sys/kernel/slab/dm_io/poison | 1 + test/sys/kernel/slab/dm_io/reclaim_account | 1 + test/sys/kernel/slab/dm_io/red_zone | 1 + test/sys/kernel/slab/dm_io/sanity_checks | 1 + test/sys/kernel/slab/dm_io/shrink | 0 test/sys/kernel/slab/dm_io/slab_size | 1 + test/sys/kernel/slab/dm_io/slabs | 1 + test/sys/kernel/slab/dm_io/store_user | 1 + test/sys/kernel/slab/dm_io/total_objects | 1 + test/sys/kernel/slab/dm_io/trace | 1 + test/sys/kernel/slab/dm_io/validate | 0 test/sys/kernel/slab/dm_target_io/aliases | 1 + test/sys/kernel/slab/dm_target_io/align | 1 + test/sys/kernel/slab/dm_target_io/alloc_calls | 1 + test/sys/kernel/slab/dm_target_io/cache_dma | 1 + test/sys/kernel/slab/dm_target_io/cpu_slabs | 1 + test/sys/kernel/slab/dm_target_io/ctor | 0 test/sys/kernel/slab/dm_target_io/destroy_by_rcu | 1 + test/sys/kernel/slab/dm_target_io/free_calls | 1 + test/sys/kernel/slab/dm_target_io/hwcache_align | 1 + test/sys/kernel/slab/dm_target_io/object_size | 1 + test/sys/kernel/slab/dm_target_io/objects | 1 + test/sys/kernel/slab/dm_target_io/objects_partial | 1 + test/sys/kernel/slab/dm_target_io/objs_per_slab | 1 + test/sys/kernel/slab/dm_target_io/order | 1 + test/sys/kernel/slab/dm_target_io/partial | 1 + test/sys/kernel/slab/dm_target_io/poison | 1 + test/sys/kernel/slab/dm_target_io/reclaim_account | 1 + test/sys/kernel/slab/dm_target_io/red_zone | 1 + test/sys/kernel/slab/dm_target_io/sanity_checks | 1 + test/sys/kernel/slab/dm_target_io/shrink | 0 test/sys/kernel/slab/dm_target_io/slab_size | 1 + test/sys/kernel/slab/dm_target_io/slabs | 1 + test/sys/kernel/slab/dm_target_io/store_user | 1 + test/sys/kernel/slab/dm_target_io/total_objects | 1 + test/sys/kernel/slab/dm_target_io/trace | 1 + test/sys/kernel/slab/dm_target_io/validate | 0 test/sys/kernel/slab/dnotify_cache/aliases | 1 + test/sys/kernel/slab/dnotify_cache/align | 1 + test/sys/kernel/slab/dnotify_cache/alloc_calls | 1 + test/sys/kernel/slab/dnotify_cache/cache_dma | 1 + test/sys/kernel/slab/dnotify_cache/cpu_slabs | 1 + test/sys/kernel/slab/dnotify_cache/ctor | 0 test/sys/kernel/slab/dnotify_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/dnotify_cache/free_calls | 1 + test/sys/kernel/slab/dnotify_cache/hwcache_align | 1 + test/sys/kernel/slab/dnotify_cache/object_size | 1 + test/sys/kernel/slab/dnotify_cache/objects | 1 + test/sys/kernel/slab/dnotify_cache/objects_partial | 1 + test/sys/kernel/slab/dnotify_cache/objs_per_slab | 1 + test/sys/kernel/slab/dnotify_cache/order | 1 + test/sys/kernel/slab/dnotify_cache/partial | 1 + test/sys/kernel/slab/dnotify_cache/poison | 1 + test/sys/kernel/slab/dnotify_cache/reclaim_account | 1 + test/sys/kernel/slab/dnotify_cache/red_zone | 1 + test/sys/kernel/slab/dnotify_cache/sanity_checks | 1 + test/sys/kernel/slab/dnotify_cache/shrink | 0 test/sys/kernel/slab/dnotify_cache/slab_size | 1 + test/sys/kernel/slab/dnotify_cache/slabs | 1 + test/sys/kernel/slab/dnotify_cache/store_user | 1 + test/sys/kernel/slab/dnotify_cache/total_objects | 1 + test/sys/kernel/slab/dnotify_cache/trace | 1 + test/sys/kernel/slab/dnotify_cache/validate | 0 test/sys/kernel/slab/eventpoll_epi/aliases | 1 + test/sys/kernel/slab/eventpoll_epi/align | 1 + test/sys/kernel/slab/eventpoll_epi/alloc_calls | 1 + test/sys/kernel/slab/eventpoll_epi/cache_dma | 1 + test/sys/kernel/slab/eventpoll_epi/cpu_slabs | 1 + test/sys/kernel/slab/eventpoll_epi/ctor | 0 test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu | 1 + test/sys/kernel/slab/eventpoll_epi/free_calls | 2 + test/sys/kernel/slab/eventpoll_epi/hwcache_align | 1 + test/sys/kernel/slab/eventpoll_epi/object_size | 1 + test/sys/kernel/slab/eventpoll_epi/objects | 1 + test/sys/kernel/slab/eventpoll_epi/objects_partial | 1 + test/sys/kernel/slab/eventpoll_epi/objs_per_slab | 1 + test/sys/kernel/slab/eventpoll_epi/order | 1 + test/sys/kernel/slab/eventpoll_epi/partial | 1 + test/sys/kernel/slab/eventpoll_epi/poison | 1 + test/sys/kernel/slab/eventpoll_epi/reclaim_account | 1 + test/sys/kernel/slab/eventpoll_epi/red_zone | 1 + test/sys/kernel/slab/eventpoll_epi/sanity_checks | 1 + test/sys/kernel/slab/eventpoll_epi/shrink | 0 test/sys/kernel/slab/eventpoll_epi/slab_size | 1 + test/sys/kernel/slab/eventpoll_epi/slabs | 1 + test/sys/kernel/slab/eventpoll_epi/store_user | 1 + test/sys/kernel/slab/eventpoll_epi/total_objects | 1 + test/sys/kernel/slab/eventpoll_epi/trace | 1 + test/sys/kernel/slab/eventpoll_epi/validate | 0 test/sys/kernel/slab/eventpoll_pwq/aliases | 1 + test/sys/kernel/slab/eventpoll_pwq/align | 1 + test/sys/kernel/slab/eventpoll_pwq/alloc_calls | 1 + test/sys/kernel/slab/eventpoll_pwq/cache_dma | 1 + test/sys/kernel/slab/eventpoll_pwq/cpu_slabs | 1 + test/sys/kernel/slab/eventpoll_pwq/ctor | 0 test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu | 1 + test/sys/kernel/slab/eventpoll_pwq/free_calls | 2 + test/sys/kernel/slab/eventpoll_pwq/hwcache_align | 1 + test/sys/kernel/slab/eventpoll_pwq/object_size | 1 + test/sys/kernel/slab/eventpoll_pwq/objects | 1 + test/sys/kernel/slab/eventpoll_pwq/objects_partial | 1 + test/sys/kernel/slab/eventpoll_pwq/objs_per_slab | 1 + test/sys/kernel/slab/eventpoll_pwq/order | 1 + test/sys/kernel/slab/eventpoll_pwq/partial | 1 + test/sys/kernel/slab/eventpoll_pwq/poison | 1 + test/sys/kernel/slab/eventpoll_pwq/reclaim_account | 1 + test/sys/kernel/slab/eventpoll_pwq/red_zone | 1 + test/sys/kernel/slab/eventpoll_pwq/sanity_checks | 1 + test/sys/kernel/slab/eventpoll_pwq/shrink | 0 test/sys/kernel/slab/eventpoll_pwq/slab_size | 1 + test/sys/kernel/slab/eventpoll_pwq/slabs | 1 + test/sys/kernel/slab/eventpoll_pwq/store_user | 1 + test/sys/kernel/slab/eventpoll_pwq/total_objects | 1 + test/sys/kernel/slab/eventpoll_pwq/trace | 1 + test/sys/kernel/slab/eventpoll_pwq/validate | 0 test/sys/kernel/slab/ext2_inode_cache/aliases | 1 + test/sys/kernel/slab/ext2_inode_cache/align | 1 + test/sys/kernel/slab/ext2_inode_cache/alloc_calls | 1 + test/sys/kernel/slab/ext2_inode_cache/cache_dma | 1 + test/sys/kernel/slab/ext2_inode_cache/cpu_slabs | 1 + test/sys/kernel/slab/ext2_inode_cache/ctor | 1 + .../kernel/slab/ext2_inode_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/ext2_inode_cache/free_calls | 1 + .../sys/kernel/slab/ext2_inode_cache/hwcache_align | 1 + test/sys/kernel/slab/ext2_inode_cache/object_size | 1 + test/sys/kernel/slab/ext2_inode_cache/objects | 1 + .../kernel/slab/ext2_inode_cache/objects_partial | 1 + .../sys/kernel/slab/ext2_inode_cache/objs_per_slab | 1 + test/sys/kernel/slab/ext2_inode_cache/order | 1 + test/sys/kernel/slab/ext2_inode_cache/partial | 1 + test/sys/kernel/slab/ext2_inode_cache/poison | 1 + .../kernel/slab/ext2_inode_cache/reclaim_account | 1 + test/sys/kernel/slab/ext2_inode_cache/red_zone | 1 + .../sys/kernel/slab/ext2_inode_cache/sanity_checks | 1 + test/sys/kernel/slab/ext2_inode_cache/shrink | 0 test/sys/kernel/slab/ext2_inode_cache/slab_size | 1 + test/sys/kernel/slab/ext2_inode_cache/slabs | 1 + test/sys/kernel/slab/ext2_inode_cache/store_user | 1 + .../sys/kernel/slab/ext2_inode_cache/total_objects | 1 + test/sys/kernel/slab/ext2_inode_cache/trace | 1 + test/sys/kernel/slab/ext2_inode_cache/validate | 0 test/sys/kernel/slab/ext3_inode_cache/aliases | 1 + test/sys/kernel/slab/ext3_inode_cache/align | 1 + test/sys/kernel/slab/ext3_inode_cache/alloc_calls | 1 + test/sys/kernel/slab/ext3_inode_cache/cache_dma | 1 + test/sys/kernel/slab/ext3_inode_cache/cpu_slabs | 1 + test/sys/kernel/slab/ext3_inode_cache/ctor | 1 + .../kernel/slab/ext3_inode_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/ext3_inode_cache/free_calls | 2 + .../sys/kernel/slab/ext3_inode_cache/hwcache_align | 1 + test/sys/kernel/slab/ext3_inode_cache/object_size | 1 + test/sys/kernel/slab/ext3_inode_cache/objects | 1 + .../kernel/slab/ext3_inode_cache/objects_partial | 1 + .../sys/kernel/slab/ext3_inode_cache/objs_per_slab | 1 + test/sys/kernel/slab/ext3_inode_cache/order | 1 + test/sys/kernel/slab/ext3_inode_cache/partial | 1 + test/sys/kernel/slab/ext3_inode_cache/poison | 1 + .../kernel/slab/ext3_inode_cache/reclaim_account | 1 + test/sys/kernel/slab/ext3_inode_cache/red_zone | 1 + .../sys/kernel/slab/ext3_inode_cache/sanity_checks | 1 + test/sys/kernel/slab/ext3_inode_cache/shrink | 0 test/sys/kernel/slab/ext3_inode_cache/slab_size | 1 + test/sys/kernel/slab/ext3_inode_cache/slabs | 1 + test/sys/kernel/slab/ext3_inode_cache/store_user | 1 + .../sys/kernel/slab/ext3_inode_cache/total_objects | 1 + test/sys/kernel/slab/ext3_inode_cache/trace | 1 + test/sys/kernel/slab/ext3_inode_cache/validate | 0 test/sys/kernel/slab/ext3_xattr/aliases | 1 + test/sys/kernel/slab/ext3_xattr/align | 1 + test/sys/kernel/slab/ext3_xattr/alloc_calls | 1 + test/sys/kernel/slab/ext3_xattr/cache_dma | 1 + test/sys/kernel/slab/ext3_xattr/cpu_slabs | 1 + test/sys/kernel/slab/ext3_xattr/ctor | 0 test/sys/kernel/slab/ext3_xattr/destroy_by_rcu | 1 + test/sys/kernel/slab/ext3_xattr/free_calls | 1 + test/sys/kernel/slab/ext3_xattr/hwcache_align | 1 + test/sys/kernel/slab/ext3_xattr/object_size | 1 + test/sys/kernel/slab/ext3_xattr/objects | 1 + test/sys/kernel/slab/ext3_xattr/objects_partial | 1 + test/sys/kernel/slab/ext3_xattr/objs_per_slab | 1 + test/sys/kernel/slab/ext3_xattr/order | 1 + test/sys/kernel/slab/ext3_xattr/partial | 1 + test/sys/kernel/slab/ext3_xattr/poison | 1 + test/sys/kernel/slab/ext3_xattr/reclaim_account | 1 + test/sys/kernel/slab/ext3_xattr/red_zone | 1 + test/sys/kernel/slab/ext3_xattr/sanity_checks | 1 + test/sys/kernel/slab/ext3_xattr/shrink | 0 test/sys/kernel/slab/ext3_xattr/slab_size | 1 + test/sys/kernel/slab/ext3_xattr/slabs | 1 + test/sys/kernel/slab/ext3_xattr/store_user | 1 + test/sys/kernel/slab/ext3_xattr/total_objects | 1 + test/sys/kernel/slab/ext3_xattr/trace | 1 + test/sys/kernel/slab/ext3_xattr/validate | 0 test/sys/kernel/slab/fasync_cache/aliases | 1 + test/sys/kernel/slab/fasync_cache/align | 1 + test/sys/kernel/slab/fasync_cache/alloc_calls | 1 + test/sys/kernel/slab/fasync_cache/cache_dma | 1 + test/sys/kernel/slab/fasync_cache/cpu_slabs | 1 + test/sys/kernel/slab/fasync_cache/ctor | 0 test/sys/kernel/slab/fasync_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/fasync_cache/free_calls | 1 + test/sys/kernel/slab/fasync_cache/hwcache_align | 1 + test/sys/kernel/slab/fasync_cache/object_size | 1 + test/sys/kernel/slab/fasync_cache/objects | 1 + test/sys/kernel/slab/fasync_cache/objects_partial | 1 + test/sys/kernel/slab/fasync_cache/objs_per_slab | 1 + test/sys/kernel/slab/fasync_cache/order | 1 + test/sys/kernel/slab/fasync_cache/partial | 1 + test/sys/kernel/slab/fasync_cache/poison | 1 + test/sys/kernel/slab/fasync_cache/reclaim_account | 1 + test/sys/kernel/slab/fasync_cache/red_zone | 1 + test/sys/kernel/slab/fasync_cache/sanity_checks | 1 + test/sys/kernel/slab/fasync_cache/shrink | 0 test/sys/kernel/slab/fasync_cache/slab_size | 1 + test/sys/kernel/slab/fasync_cache/slabs | 1 + test/sys/kernel/slab/fasync_cache/store_user | 1 + test/sys/kernel/slab/fasync_cache/total_objects | 1 + test/sys/kernel/slab/fasync_cache/trace | 1 + test/sys/kernel/slab/fasync_cache/validate | 0 test/sys/kernel/slab/fat_cache/aliases | 1 + test/sys/kernel/slab/fat_cache/align | 1 + test/sys/kernel/slab/fat_cache/alloc_calls | 1 + test/sys/kernel/slab/fat_cache/cache_dma | 1 + test/sys/kernel/slab/fat_cache/cpu_slabs | 1 + test/sys/kernel/slab/fat_cache/ctor | 1 + test/sys/kernel/slab/fat_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/fat_cache/free_calls | 1 + test/sys/kernel/slab/fat_cache/hwcache_align | 1 + test/sys/kernel/slab/fat_cache/object_size | 1 + test/sys/kernel/slab/fat_cache/objects | 1 + test/sys/kernel/slab/fat_cache/objects_partial | 1 + test/sys/kernel/slab/fat_cache/objs_per_slab | 1 + test/sys/kernel/slab/fat_cache/order | 1 + test/sys/kernel/slab/fat_cache/partial | 1 + test/sys/kernel/slab/fat_cache/poison | 1 + test/sys/kernel/slab/fat_cache/reclaim_account | 1 + test/sys/kernel/slab/fat_cache/red_zone | 1 + test/sys/kernel/slab/fat_cache/sanity_checks | 1 + test/sys/kernel/slab/fat_cache/shrink | 0 test/sys/kernel/slab/fat_cache/slab_size | 1 + test/sys/kernel/slab/fat_cache/slabs | 1 + test/sys/kernel/slab/fat_cache/store_user | 1 + test/sys/kernel/slab/fat_cache/total_objects | 1 + test/sys/kernel/slab/fat_cache/trace | 1 + test/sys/kernel/slab/fat_cache/validate | 0 test/sys/kernel/slab/fat_inode_cache/aliases | 1 + test/sys/kernel/slab/fat_inode_cache/align | 1 + test/sys/kernel/slab/fat_inode_cache/alloc_calls | 1 + test/sys/kernel/slab/fat_inode_cache/cache_dma | 1 + test/sys/kernel/slab/fat_inode_cache/cpu_slabs | 1 + test/sys/kernel/slab/fat_inode_cache/ctor | 1 + .../sys/kernel/slab/fat_inode_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/fat_inode_cache/free_calls | 1 + test/sys/kernel/slab/fat_inode_cache/hwcache_align | 1 + test/sys/kernel/slab/fat_inode_cache/object_size | 1 + test/sys/kernel/slab/fat_inode_cache/objects | 1 + .../kernel/slab/fat_inode_cache/objects_partial | 1 + test/sys/kernel/slab/fat_inode_cache/objs_per_slab | 1 + test/sys/kernel/slab/fat_inode_cache/order | 1 + test/sys/kernel/slab/fat_inode_cache/partial | 1 + test/sys/kernel/slab/fat_inode_cache/poison | 1 + .../kernel/slab/fat_inode_cache/reclaim_account | 1 + test/sys/kernel/slab/fat_inode_cache/red_zone | 1 + test/sys/kernel/slab/fat_inode_cache/sanity_checks | 1 + test/sys/kernel/slab/fat_inode_cache/shrink | 0 test/sys/kernel/slab/fat_inode_cache/slab_size | 1 + test/sys/kernel/slab/fat_inode_cache/slabs | 1 + test/sys/kernel/slab/fat_inode_cache/store_user | 1 + test/sys/kernel/slab/fat_inode_cache/total_objects | 1 + test/sys/kernel/slab/fat_inode_cache/trace | 1 + test/sys/kernel/slab/fat_inode_cache/validate | 0 test/sys/kernel/slab/fib6_nodes/aliases | 1 + test/sys/kernel/slab/fib6_nodes/align | 1 + test/sys/kernel/slab/fib6_nodes/alloc_calls | 3 + test/sys/kernel/slab/fib6_nodes/cache_dma | 1 + test/sys/kernel/slab/fib6_nodes/cpu_slabs | 1 + test/sys/kernel/slab/fib6_nodes/ctor | 0 test/sys/kernel/slab/fib6_nodes/destroy_by_rcu | 1 + test/sys/kernel/slab/fib6_nodes/free_calls | 1 + test/sys/kernel/slab/fib6_nodes/hwcache_align | 1 + test/sys/kernel/slab/fib6_nodes/object_size | 1 + test/sys/kernel/slab/fib6_nodes/objects | 1 + test/sys/kernel/slab/fib6_nodes/objects_partial | 1 + test/sys/kernel/slab/fib6_nodes/objs_per_slab | 1 + test/sys/kernel/slab/fib6_nodes/order | 1 + test/sys/kernel/slab/fib6_nodes/partial | 1 + test/sys/kernel/slab/fib6_nodes/poison | 1 + test/sys/kernel/slab/fib6_nodes/reclaim_account | 1 + test/sys/kernel/slab/fib6_nodes/red_zone | 1 + test/sys/kernel/slab/fib6_nodes/sanity_checks | 1 + test/sys/kernel/slab/fib6_nodes/shrink | 0 test/sys/kernel/slab/fib6_nodes/slab_size | 1 + test/sys/kernel/slab/fib6_nodes/slabs | 1 + test/sys/kernel/slab/fib6_nodes/store_user | 1 + test/sys/kernel/slab/fib6_nodes/total_objects | 1 + test/sys/kernel/slab/fib6_nodes/trace | 1 + test/sys/kernel/slab/fib6_nodes/validate | 0 test/sys/kernel/slab/file_lock_cache/aliases | 1 + test/sys/kernel/slab/file_lock_cache/align | 1 + test/sys/kernel/slab/file_lock_cache/alloc_calls | 2 + test/sys/kernel/slab/file_lock_cache/cache_dma | 1 + test/sys/kernel/slab/file_lock_cache/cpu_slabs | 1 + test/sys/kernel/slab/file_lock_cache/ctor | 1 + .../sys/kernel/slab/file_lock_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/file_lock_cache/free_calls | 1 + test/sys/kernel/slab/file_lock_cache/hwcache_align | 1 + test/sys/kernel/slab/file_lock_cache/object_size | 1 + test/sys/kernel/slab/file_lock_cache/objects | 1 + .../kernel/slab/file_lock_cache/objects_partial | 1 + test/sys/kernel/slab/file_lock_cache/objs_per_slab | 1 + test/sys/kernel/slab/file_lock_cache/order | 1 + test/sys/kernel/slab/file_lock_cache/partial | 1 + test/sys/kernel/slab/file_lock_cache/poison | 1 + .../kernel/slab/file_lock_cache/reclaim_account | 1 + test/sys/kernel/slab/file_lock_cache/red_zone | 1 + test/sys/kernel/slab/file_lock_cache/sanity_checks | 1 + test/sys/kernel/slab/file_lock_cache/shrink | 0 test/sys/kernel/slab/file_lock_cache/slab_size | 1 + test/sys/kernel/slab/file_lock_cache/slabs | 1 + test/sys/kernel/slab/file_lock_cache/store_user | 1 + test/sys/kernel/slab/file_lock_cache/total_objects | 1 + test/sys/kernel/slab/file_lock_cache/trace | 1 + test/sys/kernel/slab/file_lock_cache/validate | 0 test/sys/kernel/slab/files_cache/aliases | 1 + test/sys/kernel/slab/files_cache/align | 1 + test/sys/kernel/slab/files_cache/alloc_calls | 1 + test/sys/kernel/slab/files_cache/cache_dma | 1 + test/sys/kernel/slab/files_cache/cpu_slabs | 1 + test/sys/kernel/slab/files_cache/ctor | 0 test/sys/kernel/slab/files_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/files_cache/free_calls | 3 + test/sys/kernel/slab/files_cache/hwcache_align | 1 + test/sys/kernel/slab/files_cache/object_size | 1 + test/sys/kernel/slab/files_cache/objects | 1 + test/sys/kernel/slab/files_cache/objects_partial | 1 + test/sys/kernel/slab/files_cache/objs_per_slab | 1 + test/sys/kernel/slab/files_cache/order | 1 + test/sys/kernel/slab/files_cache/partial | 1 + test/sys/kernel/slab/files_cache/poison | 1 + test/sys/kernel/slab/files_cache/reclaim_account | 1 + test/sys/kernel/slab/files_cache/red_zone | 1 + test/sys/kernel/slab/files_cache/sanity_checks | 1 + test/sys/kernel/slab/files_cache/shrink | 0 test/sys/kernel/slab/files_cache/slab_size | 1 + test/sys/kernel/slab/files_cache/slabs | 1 + test/sys/kernel/slab/files_cache/store_user | 1 + test/sys/kernel/slab/files_cache/total_objects | 1 + test/sys/kernel/slab/files_cache/trace | 1 + test/sys/kernel/slab/files_cache/validate | 0 test/sys/kernel/slab/filp/aliases | 1 + test/sys/kernel/slab/filp/align | 1 + test/sys/kernel/slab/filp/alloc_calls | 1 + test/sys/kernel/slab/filp/cache_dma | 1 + test/sys/kernel/slab/filp/cpu_slabs | 1 + test/sys/kernel/slab/filp/ctor | 0 test/sys/kernel/slab/filp/destroy_by_rcu | 1 + test/sys/kernel/slab/filp/free_calls | 2 + test/sys/kernel/slab/filp/hwcache_align | 1 + test/sys/kernel/slab/filp/object_size | 1 + test/sys/kernel/slab/filp/objects | 1 + test/sys/kernel/slab/filp/objects_partial | 1 + test/sys/kernel/slab/filp/objs_per_slab | 1 + test/sys/kernel/slab/filp/order | 1 + test/sys/kernel/slab/filp/partial | 1 + test/sys/kernel/slab/filp/poison | 1 + test/sys/kernel/slab/filp/reclaim_account | 1 + test/sys/kernel/slab/filp/red_zone | 1 + test/sys/kernel/slab/filp/sanity_checks | 1 + test/sys/kernel/slab/filp/shrink | 0 test/sys/kernel/slab/filp/slab_size | 1 + test/sys/kernel/slab/filp/slabs | 1 + test/sys/kernel/slab/filp/store_user | 1 + test/sys/kernel/slab/filp/total_objects | 1 + test/sys/kernel/slab/filp/trace | 1 + test/sys/kernel/slab/filp/validate | 0 test/sys/kernel/slab/flow_cache/aliases | 1 + test/sys/kernel/slab/flow_cache/align | 1 + test/sys/kernel/slab/flow_cache/alloc_calls | 1 + test/sys/kernel/slab/flow_cache/cache_dma | 1 + test/sys/kernel/slab/flow_cache/cpu_slabs | 1 + test/sys/kernel/slab/flow_cache/ctor | 0 test/sys/kernel/slab/flow_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/flow_cache/free_calls | 1 + test/sys/kernel/slab/flow_cache/hwcache_align | 1 + test/sys/kernel/slab/flow_cache/object_size | 1 + test/sys/kernel/slab/flow_cache/objects | 1 + test/sys/kernel/slab/flow_cache/objects_partial | 1 + test/sys/kernel/slab/flow_cache/objs_per_slab | 1 + test/sys/kernel/slab/flow_cache/order | 1 + test/sys/kernel/slab/flow_cache/partial | 1 + test/sys/kernel/slab/flow_cache/poison | 1 + test/sys/kernel/slab/flow_cache/reclaim_account | 1 + test/sys/kernel/slab/flow_cache/red_zone | 1 + test/sys/kernel/slab/flow_cache/sanity_checks | 1 + test/sys/kernel/slab/flow_cache/shrink | 0 test/sys/kernel/slab/flow_cache/slab_size | 1 + test/sys/kernel/slab/flow_cache/slabs | 1 + test/sys/kernel/slab/flow_cache/store_user | 1 + test/sys/kernel/slab/flow_cache/total_objects | 1 + test/sys/kernel/slab/flow_cache/trace | 1 + test/sys/kernel/slab/flow_cache/validate | 0 test/sys/kernel/slab/fs_cache/aliases | 1 + test/sys/kernel/slab/fs_cache/align | 1 + test/sys/kernel/slab/fs_cache/alloc_calls | 1 + test/sys/kernel/slab/fs_cache/cache_dma | 1 + test/sys/kernel/slab/fs_cache/cpu_slabs | 1 + test/sys/kernel/slab/fs_cache/ctor | 0 test/sys/kernel/slab/fs_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/fs_cache/free_calls | 2 + test/sys/kernel/slab/fs_cache/hwcache_align | 1 + test/sys/kernel/slab/fs_cache/object_size | 1 + test/sys/kernel/slab/fs_cache/objects | 1 + test/sys/kernel/slab/fs_cache/objects_partial | 1 + test/sys/kernel/slab/fs_cache/objs_per_slab | 1 + test/sys/kernel/slab/fs_cache/order | 1 + test/sys/kernel/slab/fs_cache/partial | 1 + test/sys/kernel/slab/fs_cache/poison | 1 + test/sys/kernel/slab/fs_cache/reclaim_account | 1 + test/sys/kernel/slab/fs_cache/red_zone | 1 + test/sys/kernel/slab/fs_cache/sanity_checks | 1 + test/sys/kernel/slab/fs_cache/shrink | 0 test/sys/kernel/slab/fs_cache/slab_size | 1 + test/sys/kernel/slab/fs_cache/slabs | 1 + test/sys/kernel/slab/fs_cache/store_user | 1 + test/sys/kernel/slab/fs_cache/total_objects | 1 + test/sys/kernel/slab/fs_cache/trace | 1 + test/sys/kernel/slab/fs_cache/validate | 0 test/sys/kernel/slab/fuse_inode/aliases | 1 + test/sys/kernel/slab/fuse_inode/align | 1 + test/sys/kernel/slab/fuse_inode/alloc_calls | 1 + test/sys/kernel/slab/fuse_inode/cache_dma | 1 + test/sys/kernel/slab/fuse_inode/cpu_slabs | 1 + test/sys/kernel/slab/fuse_inode/ctor | 1 + test/sys/kernel/slab/fuse_inode/destroy_by_rcu | 1 + test/sys/kernel/slab/fuse_inode/free_calls | 1 + test/sys/kernel/slab/fuse_inode/hwcache_align | 1 + test/sys/kernel/slab/fuse_inode/object_size | 1 + test/sys/kernel/slab/fuse_inode/objects | 1 + test/sys/kernel/slab/fuse_inode/objects_partial | 1 + test/sys/kernel/slab/fuse_inode/objs_per_slab | 1 + test/sys/kernel/slab/fuse_inode/order | 1 + test/sys/kernel/slab/fuse_inode/partial | 1 + test/sys/kernel/slab/fuse_inode/poison | 1 + test/sys/kernel/slab/fuse_inode/reclaim_account | 1 + test/sys/kernel/slab/fuse_inode/red_zone | 1 + test/sys/kernel/slab/fuse_inode/sanity_checks | 1 + test/sys/kernel/slab/fuse_inode/shrink | 0 test/sys/kernel/slab/fuse_inode/slab_size | 1 + test/sys/kernel/slab/fuse_inode/slabs | 1 + test/sys/kernel/slab/fuse_inode/store_user | 1 + test/sys/kernel/slab/fuse_inode/total_objects | 1 + test/sys/kernel/slab/fuse_inode/trace | 1 + test/sys/kernel/slab/fuse_inode/validate | 0 test/sys/kernel/slab/fuse_request/aliases | 1 + test/sys/kernel/slab/fuse_request/align | 1 + test/sys/kernel/slab/fuse_request/alloc_calls | 1 + test/sys/kernel/slab/fuse_request/cache_dma | 1 + test/sys/kernel/slab/fuse_request/cpu_slabs | 1 + test/sys/kernel/slab/fuse_request/ctor | 0 test/sys/kernel/slab/fuse_request/destroy_by_rcu | 1 + test/sys/kernel/slab/fuse_request/free_calls | 1 + test/sys/kernel/slab/fuse_request/hwcache_align | 1 + test/sys/kernel/slab/fuse_request/object_size | 1 + test/sys/kernel/slab/fuse_request/objects | 1 + test/sys/kernel/slab/fuse_request/objects_partial | 1 + test/sys/kernel/slab/fuse_request/objs_per_slab | 1 + test/sys/kernel/slab/fuse_request/order | 1 + test/sys/kernel/slab/fuse_request/partial | 1 + test/sys/kernel/slab/fuse_request/poison | 1 + test/sys/kernel/slab/fuse_request/reclaim_account | 1 + test/sys/kernel/slab/fuse_request/red_zone | 1 + test/sys/kernel/slab/fuse_request/sanity_checks | 1 + test/sys/kernel/slab/fuse_request/shrink | 0 test/sys/kernel/slab/fuse_request/slab_size | 1 + test/sys/kernel/slab/fuse_request/slabs | 1 + test/sys/kernel/slab/fuse_request/store_user | 1 + test/sys/kernel/slab/fuse_request/total_objects | 1 + test/sys/kernel/slab/fuse_request/trace | 1 + test/sys/kernel/slab/fuse_request/validate | 0 test/sys/kernel/slab/idr_layer_cache/aliases | 1 + test/sys/kernel/slab/idr_layer_cache/align | 1 + test/sys/kernel/slab/idr_layer_cache/alloc_calls | 1 + test/sys/kernel/slab/idr_layer_cache/cache_dma | 1 + test/sys/kernel/slab/idr_layer_cache/cpu_slabs | 1 + test/sys/kernel/slab/idr_layer_cache/ctor | 1 + .../sys/kernel/slab/idr_layer_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/idr_layer_cache/free_calls | 5 + test/sys/kernel/slab/idr_layer_cache/hwcache_align | 1 + test/sys/kernel/slab/idr_layer_cache/object_size | 1 + test/sys/kernel/slab/idr_layer_cache/objects | 1 + .../kernel/slab/idr_layer_cache/objects_partial | 1 + test/sys/kernel/slab/idr_layer_cache/objs_per_slab | 1 + test/sys/kernel/slab/idr_layer_cache/order | 1 + test/sys/kernel/slab/idr_layer_cache/partial | 1 + test/sys/kernel/slab/idr_layer_cache/poison | 1 + .../kernel/slab/idr_layer_cache/reclaim_account | 1 + test/sys/kernel/slab/idr_layer_cache/red_zone | 1 + test/sys/kernel/slab/idr_layer_cache/sanity_checks | 1 + test/sys/kernel/slab/idr_layer_cache/shrink | 0 test/sys/kernel/slab/idr_layer_cache/slab_size | 1 + test/sys/kernel/slab/idr_layer_cache/slabs | 1 + test/sys/kernel/slab/idr_layer_cache/store_user | 1 + test/sys/kernel/slab/idr_layer_cache/total_objects | 1 + test/sys/kernel/slab/idr_layer_cache/trace | 1 + test/sys/kernel/slab/idr_layer_cache/validate | 0 test/sys/kernel/slab/inet_peer_cache/aliases | 1 + test/sys/kernel/slab/inet_peer_cache/align | 1 + test/sys/kernel/slab/inet_peer_cache/alloc_calls | 1 + test/sys/kernel/slab/inet_peer_cache/cache_dma | 1 + test/sys/kernel/slab/inet_peer_cache/cpu_slabs | 1 + test/sys/kernel/slab/inet_peer_cache/ctor | 0 .../sys/kernel/slab/inet_peer_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/inet_peer_cache/free_calls | 1 + test/sys/kernel/slab/inet_peer_cache/hwcache_align | 1 + test/sys/kernel/slab/inet_peer_cache/object_size | 1 + test/sys/kernel/slab/inet_peer_cache/objects | 1 + .../kernel/slab/inet_peer_cache/objects_partial | 1 + test/sys/kernel/slab/inet_peer_cache/objs_per_slab | 1 + test/sys/kernel/slab/inet_peer_cache/order | 1 + test/sys/kernel/slab/inet_peer_cache/partial | 1 + test/sys/kernel/slab/inet_peer_cache/poison | 1 + .../kernel/slab/inet_peer_cache/reclaim_account | 1 + test/sys/kernel/slab/inet_peer_cache/red_zone | 1 + test/sys/kernel/slab/inet_peer_cache/sanity_checks | 1 + test/sys/kernel/slab/inet_peer_cache/shrink | 0 test/sys/kernel/slab/inet_peer_cache/slab_size | 1 + test/sys/kernel/slab/inet_peer_cache/slabs | 1 + test/sys/kernel/slab/inet_peer_cache/store_user | 1 + test/sys/kernel/slab/inet_peer_cache/total_objects | 1 + test/sys/kernel/slab/inet_peer_cache/trace | 1 + test/sys/kernel/slab/inet_peer_cache/validate | 0 test/sys/kernel/slab/inode_cache/aliases | 1 + test/sys/kernel/slab/inode_cache/align | 1 + test/sys/kernel/slab/inode_cache/alloc_calls | 1 + test/sys/kernel/slab/inode_cache/cache_dma | 1 + test/sys/kernel/slab/inode_cache/cpu_slabs | 1 + test/sys/kernel/slab/inode_cache/ctor | 1 + test/sys/kernel/slab/inode_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/inode_cache/free_calls | 2 + test/sys/kernel/slab/inode_cache/hwcache_align | 1 + test/sys/kernel/slab/inode_cache/object_size | 1 + test/sys/kernel/slab/inode_cache/objects | 1 + test/sys/kernel/slab/inode_cache/objects_partial | 1 + test/sys/kernel/slab/inode_cache/objs_per_slab | 1 + test/sys/kernel/slab/inode_cache/order | 1 + test/sys/kernel/slab/inode_cache/partial | 1 + test/sys/kernel/slab/inode_cache/poison | 1 + test/sys/kernel/slab/inode_cache/reclaim_account | 1 + test/sys/kernel/slab/inode_cache/red_zone | 1 + test/sys/kernel/slab/inode_cache/sanity_checks | 1 + test/sys/kernel/slab/inode_cache/shrink | 0 test/sys/kernel/slab/inode_cache/slab_size | 1 + test/sys/kernel/slab/inode_cache/slabs | 1 + test/sys/kernel/slab/inode_cache/store_user | 1 + test/sys/kernel/slab/inode_cache/total_objects | 1 + test/sys/kernel/slab/inode_cache/trace | 1 + test/sys/kernel/slab/inode_cache/validate | 0 test/sys/kernel/slab/inotify_event_cache/aliases | 1 + test/sys/kernel/slab/inotify_event_cache/align | 1 + .../kernel/slab/inotify_event_cache/alloc_calls | 1 + test/sys/kernel/slab/inotify_event_cache/cache_dma | 1 + test/sys/kernel/slab/inotify_event_cache/cpu_slabs | 1 + test/sys/kernel/slab/inotify_event_cache/ctor | 0 .../kernel/slab/inotify_event_cache/destroy_by_rcu | 1 + .../sys/kernel/slab/inotify_event_cache/free_calls | 1 + .../kernel/slab/inotify_event_cache/hwcache_align | 1 + .../kernel/slab/inotify_event_cache/object_size | 1 + test/sys/kernel/slab/inotify_event_cache/objects | 1 + .../slab/inotify_event_cache/objects_partial | 1 + .../kernel/slab/inotify_event_cache/objs_per_slab | 1 + test/sys/kernel/slab/inotify_event_cache/order | 1 + test/sys/kernel/slab/inotify_event_cache/partial | 1 + test/sys/kernel/slab/inotify_event_cache/poison | 1 + .../slab/inotify_event_cache/reclaim_account | 1 + test/sys/kernel/slab/inotify_event_cache/red_zone | 1 + .../kernel/slab/inotify_event_cache/sanity_checks | 1 + test/sys/kernel/slab/inotify_event_cache/shrink | 0 test/sys/kernel/slab/inotify_event_cache/slab_size | 1 + test/sys/kernel/slab/inotify_event_cache/slabs | 1 + .../sys/kernel/slab/inotify_event_cache/store_user | 1 + .../kernel/slab/inotify_event_cache/total_objects | 1 + test/sys/kernel/slab/inotify_event_cache/trace | 1 + test/sys/kernel/slab/inotify_event_cache/validate | 0 test/sys/kernel/slab/inotify_watch_cache/aliases | 1 + test/sys/kernel/slab/inotify_watch_cache/align | 1 + .../kernel/slab/inotify_watch_cache/alloc_calls | 1 + test/sys/kernel/slab/inotify_watch_cache/cache_dma | 1 + test/sys/kernel/slab/inotify_watch_cache/cpu_slabs | 1 + test/sys/kernel/slab/inotify_watch_cache/ctor | 0 .../kernel/slab/inotify_watch_cache/destroy_by_rcu | 1 + .../sys/kernel/slab/inotify_watch_cache/free_calls | 2 + .../kernel/slab/inotify_watch_cache/hwcache_align | 1 + .../kernel/slab/inotify_watch_cache/object_size | 1 + test/sys/kernel/slab/inotify_watch_cache/objects | 1 + .../slab/inotify_watch_cache/objects_partial | 1 + .../kernel/slab/inotify_watch_cache/objs_per_slab | 1 + test/sys/kernel/slab/inotify_watch_cache/order | 1 + test/sys/kernel/slab/inotify_watch_cache/partial | 1 + test/sys/kernel/slab/inotify_watch_cache/poison | 1 + .../slab/inotify_watch_cache/reclaim_account | 1 + test/sys/kernel/slab/inotify_watch_cache/red_zone | 1 + .../kernel/slab/inotify_watch_cache/sanity_checks | 1 + test/sys/kernel/slab/inotify_watch_cache/shrink | 0 test/sys/kernel/slab/inotify_watch_cache/slab_size | 1 + test/sys/kernel/slab/inotify_watch_cache/slabs | 1 + .../sys/kernel/slab/inotify_watch_cache/store_user | 1 + .../kernel/slab/inotify_watch_cache/total_objects | 1 + test/sys/kernel/slab/inotify_watch_cache/trace | 1 + test/sys/kernel/slab/inotify_watch_cache/validate | 0 test/sys/kernel/slab/ip6_dst_cache/aliases | 1 + test/sys/kernel/slab/ip6_dst_cache/align | 1 + test/sys/kernel/slab/ip6_dst_cache/alloc_calls | 1 + test/sys/kernel/slab/ip6_dst_cache/cache_dma | 1 + test/sys/kernel/slab/ip6_dst_cache/cpu_slabs | 1 + test/sys/kernel/slab/ip6_dst_cache/ctor | 0 test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/ip6_dst_cache/free_calls | 1 + test/sys/kernel/slab/ip6_dst_cache/hwcache_align | 1 + test/sys/kernel/slab/ip6_dst_cache/object_size | 1 + test/sys/kernel/slab/ip6_dst_cache/objects | 1 + test/sys/kernel/slab/ip6_dst_cache/objects_partial | 1 + test/sys/kernel/slab/ip6_dst_cache/objs_per_slab | 1 + test/sys/kernel/slab/ip6_dst_cache/order | 1 + test/sys/kernel/slab/ip6_dst_cache/partial | 1 + test/sys/kernel/slab/ip6_dst_cache/poison | 1 + test/sys/kernel/slab/ip6_dst_cache/reclaim_account | 1 + test/sys/kernel/slab/ip6_dst_cache/red_zone | 1 + test/sys/kernel/slab/ip6_dst_cache/sanity_checks | 1 + test/sys/kernel/slab/ip6_dst_cache/shrink | 0 test/sys/kernel/slab/ip6_dst_cache/slab_size | 1 + test/sys/kernel/slab/ip6_dst_cache/slabs | 1 + test/sys/kernel/slab/ip6_dst_cache/store_user | 1 + test/sys/kernel/slab/ip6_dst_cache/total_objects | 1 + test/sys/kernel/slab/ip6_dst_cache/trace | 1 + test/sys/kernel/slab/ip6_dst_cache/validate | 0 test/sys/kernel/slab/ip_dst_cache/aliases | 1 + test/sys/kernel/slab/ip_dst_cache/align | 1 + test/sys/kernel/slab/ip_dst_cache/alloc_calls | 1 + test/sys/kernel/slab/ip_dst_cache/cache_dma | 1 + test/sys/kernel/slab/ip_dst_cache/cpu_slabs | 1 + test/sys/kernel/slab/ip_dst_cache/ctor | 0 test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/ip_dst_cache/free_calls | 2 + test/sys/kernel/slab/ip_dst_cache/hwcache_align | 1 + test/sys/kernel/slab/ip_dst_cache/object_size | 1 + test/sys/kernel/slab/ip_dst_cache/objects | 1 + test/sys/kernel/slab/ip_dst_cache/objects_partial | 1 + test/sys/kernel/slab/ip_dst_cache/objs_per_slab | 1 + test/sys/kernel/slab/ip_dst_cache/order | 1 + test/sys/kernel/slab/ip_dst_cache/partial | 1 + test/sys/kernel/slab/ip_dst_cache/poison | 1 + test/sys/kernel/slab/ip_dst_cache/reclaim_account | 1 + test/sys/kernel/slab/ip_dst_cache/red_zone | 1 + test/sys/kernel/slab/ip_dst_cache/sanity_checks | 1 + test/sys/kernel/slab/ip_dst_cache/shrink | 0 test/sys/kernel/slab/ip_dst_cache/slab_size | 1 + test/sys/kernel/slab/ip_dst_cache/slabs | 1 + test/sys/kernel/slab/ip_dst_cache/store_user | 1 + test/sys/kernel/slab/ip_dst_cache/total_objects | 1 + test/sys/kernel/slab/ip_dst_cache/trace | 1 + test/sys/kernel/slab/ip_dst_cache/validate | 0 test/sys/kernel/slab/ip_fib_alias/aliases | 1 + test/sys/kernel/slab/ip_fib_alias/align | 1 + test/sys/kernel/slab/ip_fib_alias/alloc_calls | 1 + test/sys/kernel/slab/ip_fib_alias/cache_dma | 1 + test/sys/kernel/slab/ip_fib_alias/cpu_slabs | 1 + test/sys/kernel/slab/ip_fib_alias/ctor | 0 test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu | 1 + test/sys/kernel/slab/ip_fib_alias/free_calls | 1 + test/sys/kernel/slab/ip_fib_alias/hwcache_align | 1 + test/sys/kernel/slab/ip_fib_alias/object_size | 1 + test/sys/kernel/slab/ip_fib_alias/objects | 1 + test/sys/kernel/slab/ip_fib_alias/objects_partial | 1 + test/sys/kernel/slab/ip_fib_alias/objs_per_slab | 1 + test/sys/kernel/slab/ip_fib_alias/order | 1 + test/sys/kernel/slab/ip_fib_alias/partial | 1 + test/sys/kernel/slab/ip_fib_alias/poison | 1 + test/sys/kernel/slab/ip_fib_alias/reclaim_account | 1 + test/sys/kernel/slab/ip_fib_alias/red_zone | 1 + test/sys/kernel/slab/ip_fib_alias/sanity_checks | 1 + test/sys/kernel/slab/ip_fib_alias/shrink | 0 test/sys/kernel/slab/ip_fib_alias/slab_size | 1 + test/sys/kernel/slab/ip_fib_alias/slabs | 1 + test/sys/kernel/slab/ip_fib_alias/store_user | 1 + test/sys/kernel/slab/ip_fib_alias/total_objects | 1 + test/sys/kernel/slab/ip_fib_alias/trace | 1 + test/sys/kernel/slab/ip_fib_alias/validate | 0 test/sys/kernel/slab/ip_fib_hash/aliases | 1 + test/sys/kernel/slab/ip_fib_hash/align | 1 + test/sys/kernel/slab/ip_fib_hash/alloc_calls | 1 + test/sys/kernel/slab/ip_fib_hash/cache_dma | 1 + test/sys/kernel/slab/ip_fib_hash/cpu_slabs | 1 + test/sys/kernel/slab/ip_fib_hash/ctor | 0 test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu | 1 + test/sys/kernel/slab/ip_fib_hash/free_calls | 2 + test/sys/kernel/slab/ip_fib_hash/hwcache_align | 1 + test/sys/kernel/slab/ip_fib_hash/object_size | 1 + test/sys/kernel/slab/ip_fib_hash/objects | 1 + test/sys/kernel/slab/ip_fib_hash/objects_partial | 1 + test/sys/kernel/slab/ip_fib_hash/objs_per_slab | 1 + test/sys/kernel/slab/ip_fib_hash/order | 1 + test/sys/kernel/slab/ip_fib_hash/partial | 1 + test/sys/kernel/slab/ip_fib_hash/poison | 1 + test/sys/kernel/slab/ip_fib_hash/reclaim_account | 1 + test/sys/kernel/slab/ip_fib_hash/red_zone | 1 + test/sys/kernel/slab/ip_fib_hash/sanity_checks | 1 + test/sys/kernel/slab/ip_fib_hash/shrink | 0 test/sys/kernel/slab/ip_fib_hash/slab_size | 1 + test/sys/kernel/slab/ip_fib_hash/slabs | 1 + test/sys/kernel/slab/ip_fib_hash/store_user | 1 + test/sys/kernel/slab/ip_fib_hash/total_objects | 1 + test/sys/kernel/slab/ip_fib_hash/trace | 1 + test/sys/kernel/slab/ip_fib_hash/validate | 0 test/sys/kernel/slab/journal_handle/aliases | 1 + test/sys/kernel/slab/journal_handle/align | 1 + test/sys/kernel/slab/journal_handle/alloc_calls | 1 + test/sys/kernel/slab/journal_handle/cache_dma | 1 + test/sys/kernel/slab/journal_handle/cpu_slabs | 1 + test/sys/kernel/slab/journal_handle/ctor | 0 test/sys/kernel/slab/journal_handle/destroy_by_rcu | 1 + test/sys/kernel/slab/journal_handle/free_calls | 1 + test/sys/kernel/slab/journal_handle/hwcache_align | 1 + test/sys/kernel/slab/journal_handle/object_size | 1 + test/sys/kernel/slab/journal_handle/objects | 1 + .../sys/kernel/slab/journal_handle/objects_partial | 1 + test/sys/kernel/slab/journal_handle/objs_per_slab | 1 + test/sys/kernel/slab/journal_handle/order | 1 + test/sys/kernel/slab/journal_handle/partial | 1 + test/sys/kernel/slab/journal_handle/poison | 1 + .../sys/kernel/slab/journal_handle/reclaim_account | 1 + test/sys/kernel/slab/journal_handle/red_zone | 1 + test/sys/kernel/slab/journal_handle/sanity_checks | 1 + test/sys/kernel/slab/journal_handle/shrink | 0 test/sys/kernel/slab/journal_handle/slab_size | 1 + test/sys/kernel/slab/journal_handle/slabs | 1 + test/sys/kernel/slab/journal_handle/store_user | 1 + test/sys/kernel/slab/journal_handle/total_objects | 1 + test/sys/kernel/slab/journal_handle/trace | 1 + test/sys/kernel/slab/journal_handle/validate | 0 test/sys/kernel/slab/journal_head/aliases | 1 + test/sys/kernel/slab/journal_head/align | 1 + test/sys/kernel/slab/journal_head/alloc_calls | 1 + test/sys/kernel/slab/journal_head/cache_dma | 1 + test/sys/kernel/slab/journal_head/cpu_slabs | 1 + test/sys/kernel/slab/journal_head/ctor | 0 test/sys/kernel/slab/journal_head/destroy_by_rcu | 1 + test/sys/kernel/slab/journal_head/free_calls | 2 + test/sys/kernel/slab/journal_head/hwcache_align | 1 + test/sys/kernel/slab/journal_head/object_size | 1 + test/sys/kernel/slab/journal_head/objects | 1 + test/sys/kernel/slab/journal_head/objects_partial | 1 + test/sys/kernel/slab/journal_head/objs_per_slab | 1 + test/sys/kernel/slab/journal_head/order | 1 + test/sys/kernel/slab/journal_head/partial | 1 + test/sys/kernel/slab/journal_head/poison | 1 + test/sys/kernel/slab/journal_head/reclaim_account | 1 + test/sys/kernel/slab/journal_head/red_zone | 1 + test/sys/kernel/slab/journal_head/sanity_checks | 1 + test/sys/kernel/slab/journal_head/shrink | 0 test/sys/kernel/slab/journal_head/slab_size | 1 + test/sys/kernel/slab/journal_head/slabs | 1 + test/sys/kernel/slab/journal_head/store_user | 1 + test/sys/kernel/slab/journal_head/total_objects | 1 + test/sys/kernel/slab/journal_head/trace | 1 + test/sys/kernel/slab/journal_head/validate | 0 test/sys/kernel/slab/kcopyd_job/aliases | 1 + test/sys/kernel/slab/kcopyd_job/align | 1 + test/sys/kernel/slab/kcopyd_job/alloc_calls | 1 + test/sys/kernel/slab/kcopyd_job/cache_dma | 1 + test/sys/kernel/slab/kcopyd_job/cpu_slabs | 1 + test/sys/kernel/slab/kcopyd_job/ctor | 0 test/sys/kernel/slab/kcopyd_job/destroy_by_rcu | 1 + test/sys/kernel/slab/kcopyd_job/free_calls | 1 + test/sys/kernel/slab/kcopyd_job/hwcache_align | 1 + test/sys/kernel/slab/kcopyd_job/object_size | 1 + test/sys/kernel/slab/kcopyd_job/objects | 1 + test/sys/kernel/slab/kcopyd_job/objects_partial | 1 + test/sys/kernel/slab/kcopyd_job/objs_per_slab | 1 + test/sys/kernel/slab/kcopyd_job/order | 1 + test/sys/kernel/slab/kcopyd_job/partial | 1 + test/sys/kernel/slab/kcopyd_job/poison | 1 + test/sys/kernel/slab/kcopyd_job/reclaim_account | 1 + test/sys/kernel/slab/kcopyd_job/red_zone | 1 + test/sys/kernel/slab/kcopyd_job/sanity_checks | 1 + test/sys/kernel/slab/kcopyd_job/shrink | 0 test/sys/kernel/slab/kcopyd_job/slab_size | 1 + test/sys/kernel/slab/kcopyd_job/slabs | 1 + test/sys/kernel/slab/kcopyd_job/store_user | 1 + test/sys/kernel/slab/kcopyd_job/total_objects | 1 + test/sys/kernel/slab/kcopyd_job/trace | 1 + test/sys/kernel/slab/kcopyd_job/validate | 0 test/sys/kernel/slab/key_jar/aliases | 1 + test/sys/kernel/slab/key_jar/align | 1 + test/sys/kernel/slab/key_jar/alloc_calls | 1 + test/sys/kernel/slab/key_jar/cache_dma | 1 + test/sys/kernel/slab/key_jar/cpu_slabs | 1 + test/sys/kernel/slab/key_jar/ctor | 0 test/sys/kernel/slab/key_jar/destroy_by_rcu | 1 + test/sys/kernel/slab/key_jar/free_calls | 1 + test/sys/kernel/slab/key_jar/hwcache_align | 1 + test/sys/kernel/slab/key_jar/object_size | 1 + test/sys/kernel/slab/key_jar/objects | 1 + test/sys/kernel/slab/key_jar/objects_partial | 1 + test/sys/kernel/slab/key_jar/objs_per_slab | 1 + test/sys/kernel/slab/key_jar/order | 1 + test/sys/kernel/slab/key_jar/partial | 1 + test/sys/kernel/slab/key_jar/poison | 1 + test/sys/kernel/slab/key_jar/reclaim_account | 1 + test/sys/kernel/slab/key_jar/red_zone | 1 + test/sys/kernel/slab/key_jar/sanity_checks | 1 + test/sys/kernel/slab/key_jar/shrink | 0 test/sys/kernel/slab/key_jar/slab_size | 1 + test/sys/kernel/slab/key_jar/slabs | 1 + test/sys/kernel/slab/key_jar/store_user | 1 + test/sys/kernel/slab/key_jar/total_objects | 1 + test/sys/kernel/slab/key_jar/trace | 1 + test/sys/kernel/slab/key_jar/validate | 0 test/sys/kernel/slab/kiocb/aliases | 1 + test/sys/kernel/slab/kiocb/align | 1 + test/sys/kernel/slab/kiocb/alloc_calls | 1 + test/sys/kernel/slab/kiocb/cache_dma | 1 + test/sys/kernel/slab/kiocb/cpu_slabs | 1 + test/sys/kernel/slab/kiocb/ctor | 0 test/sys/kernel/slab/kiocb/destroy_by_rcu | 1 + test/sys/kernel/slab/kiocb/free_calls | 1 + test/sys/kernel/slab/kiocb/hwcache_align | 1 + test/sys/kernel/slab/kiocb/object_size | 1 + test/sys/kernel/slab/kiocb/objects | 1 + test/sys/kernel/slab/kiocb/objects_partial | 1 + test/sys/kernel/slab/kiocb/objs_per_slab | 1 + test/sys/kernel/slab/kiocb/order | 1 + test/sys/kernel/slab/kiocb/partial | 1 + test/sys/kernel/slab/kiocb/poison | 1 + test/sys/kernel/slab/kiocb/reclaim_account | 1 + test/sys/kernel/slab/kiocb/red_zone | 1 + test/sys/kernel/slab/kiocb/sanity_checks | 1 + test/sys/kernel/slab/kiocb/shrink | 0 test/sys/kernel/slab/kiocb/slab_size | 1 + test/sys/kernel/slab/kiocb/slabs | 1 + test/sys/kernel/slab/kiocb/store_user | 1 + test/sys/kernel/slab/kiocb/total_objects | 1 + test/sys/kernel/slab/kiocb/trace | 1 + test/sys/kernel/slab/kiocb/validate | 0 test/sys/kernel/slab/kioctx/aliases | 1 + test/sys/kernel/slab/kioctx/align | 1 + test/sys/kernel/slab/kioctx/alloc_calls | 1 + test/sys/kernel/slab/kioctx/cache_dma | 1 + test/sys/kernel/slab/kioctx/cpu_slabs | 1 + test/sys/kernel/slab/kioctx/ctor | 0 test/sys/kernel/slab/kioctx/destroy_by_rcu | 1 + test/sys/kernel/slab/kioctx/free_calls | 1 + test/sys/kernel/slab/kioctx/hwcache_align | 1 + test/sys/kernel/slab/kioctx/object_size | 1 + test/sys/kernel/slab/kioctx/objects | 1 + test/sys/kernel/slab/kioctx/objects_partial | 1 + test/sys/kernel/slab/kioctx/objs_per_slab | 1 + test/sys/kernel/slab/kioctx/order | 1 + test/sys/kernel/slab/kioctx/partial | 1 + test/sys/kernel/slab/kioctx/poison | 1 + test/sys/kernel/slab/kioctx/reclaim_account | 1 + test/sys/kernel/slab/kioctx/red_zone | 1 + test/sys/kernel/slab/kioctx/sanity_checks | 1 + test/sys/kernel/slab/kioctx/shrink | 0 test/sys/kernel/slab/kioctx/slab_size | 1 + test/sys/kernel/slab/kioctx/slabs | 1 + test/sys/kernel/slab/kioctx/store_user | 1 + test/sys/kernel/slab/kioctx/total_objects | 1 + test/sys/kernel/slab/kioctx/trace | 1 + test/sys/kernel/slab/kioctx/validate | 0 test/sys/kernel/slab/kmalloc-1024/aliases | 1 + test/sys/kernel/slab/kmalloc-1024/align | 1 + test/sys/kernel/slab/kmalloc-1024/alloc_calls | 51 ++ test/sys/kernel/slab/kmalloc-1024/cache_dma | 1 + test/sys/kernel/slab/kmalloc-1024/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-1024/ctor | 0 test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-1024/free_calls | 10 + test/sys/kernel/slab/kmalloc-1024/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-1024/object_size | 1 + test/sys/kernel/slab/kmalloc-1024/objects | 1 + test/sys/kernel/slab/kmalloc-1024/objects_partial | 1 + test/sys/kernel/slab/kmalloc-1024/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-1024/order | 1 + test/sys/kernel/slab/kmalloc-1024/partial | 1 + test/sys/kernel/slab/kmalloc-1024/poison | 1 + test/sys/kernel/slab/kmalloc-1024/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-1024/red_zone | 1 + test/sys/kernel/slab/kmalloc-1024/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-1024/shrink | 0 test/sys/kernel/slab/kmalloc-1024/slab_size | 1 + test/sys/kernel/slab/kmalloc-1024/slabs | 1 + test/sys/kernel/slab/kmalloc-1024/store_user | 1 + test/sys/kernel/slab/kmalloc-1024/total_objects | 1 + test/sys/kernel/slab/kmalloc-1024/trace | 1 + test/sys/kernel/slab/kmalloc-1024/validate | 0 test/sys/kernel/slab/kmalloc-128/aliases | 1 + test/sys/kernel/slab/kmalloc-128/align | 1 + test/sys/kernel/slab/kmalloc-128/alloc_calls | 36 ++ test/sys/kernel/slab/kmalloc-128/cache_dma | 1 + test/sys/kernel/slab/kmalloc-128/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-128/ctor | 0 test/sys/kernel/slab/kmalloc-128/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-128/free_calls | 14 + test/sys/kernel/slab/kmalloc-128/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-128/object_size | 1 + test/sys/kernel/slab/kmalloc-128/objects | 1 + test/sys/kernel/slab/kmalloc-128/objects_partial | 1 + test/sys/kernel/slab/kmalloc-128/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-128/order | 1 + test/sys/kernel/slab/kmalloc-128/partial | 1 + test/sys/kernel/slab/kmalloc-128/poison | 1 + test/sys/kernel/slab/kmalloc-128/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-128/red_zone | 1 + test/sys/kernel/slab/kmalloc-128/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-128/shrink | 0 test/sys/kernel/slab/kmalloc-128/slab_size | 1 + test/sys/kernel/slab/kmalloc-128/slabs | 1 + test/sys/kernel/slab/kmalloc-128/store_user | 1 + test/sys/kernel/slab/kmalloc-128/total_objects | 1 + test/sys/kernel/slab/kmalloc-128/trace | 1 + test/sys/kernel/slab/kmalloc-128/validate | 0 test/sys/kernel/slab/kmalloc-16/aliases | 1 + test/sys/kernel/slab/kmalloc-16/align | 1 + test/sys/kernel/slab/kmalloc-16/alloc_calls | 41 ++ test/sys/kernel/slab/kmalloc-16/cache_dma | 1 + test/sys/kernel/slab/kmalloc-16/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-16/ctor | 0 test/sys/kernel/slab/kmalloc-16/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-16/free_calls | 26 + test/sys/kernel/slab/kmalloc-16/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-16/object_size | 1 + test/sys/kernel/slab/kmalloc-16/objects | 1 + test/sys/kernel/slab/kmalloc-16/objects_partial | 1 + test/sys/kernel/slab/kmalloc-16/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-16/order | 1 + test/sys/kernel/slab/kmalloc-16/partial | 1 + test/sys/kernel/slab/kmalloc-16/poison | 1 + test/sys/kernel/slab/kmalloc-16/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-16/red_zone | 1 + test/sys/kernel/slab/kmalloc-16/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-16/shrink | 0 test/sys/kernel/slab/kmalloc-16/slab_size | 1 + test/sys/kernel/slab/kmalloc-16/slabs | 1 + test/sys/kernel/slab/kmalloc-16/store_user | 1 + test/sys/kernel/slab/kmalloc-16/total_objects | 1 + test/sys/kernel/slab/kmalloc-16/trace | 1 + test/sys/kernel/slab/kmalloc-16/validate | 0 test/sys/kernel/slab/kmalloc-192/aliases | 1 + test/sys/kernel/slab/kmalloc-192/align | 1 + test/sys/kernel/slab/kmalloc-192/alloc_calls | 33 ++ test/sys/kernel/slab/kmalloc-192/cache_dma | 1 + test/sys/kernel/slab/kmalloc-192/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-192/ctor | 0 test/sys/kernel/slab/kmalloc-192/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-192/free_calls | 15 + test/sys/kernel/slab/kmalloc-192/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-192/object_size | 1 + test/sys/kernel/slab/kmalloc-192/objects | 1 + test/sys/kernel/slab/kmalloc-192/objects_partial | 1 + test/sys/kernel/slab/kmalloc-192/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-192/order | 1 + test/sys/kernel/slab/kmalloc-192/partial | 1 + test/sys/kernel/slab/kmalloc-192/poison | 1 + test/sys/kernel/slab/kmalloc-192/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-192/red_zone | 1 + test/sys/kernel/slab/kmalloc-192/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-192/shrink | 0 test/sys/kernel/slab/kmalloc-192/slab_size | 1 + test/sys/kernel/slab/kmalloc-192/slabs | 1 + test/sys/kernel/slab/kmalloc-192/store_user | 1 + test/sys/kernel/slab/kmalloc-192/total_objects | 1 + test/sys/kernel/slab/kmalloc-192/trace | 1 + test/sys/kernel/slab/kmalloc-192/validate | 0 test/sys/kernel/slab/kmalloc-2048/aliases | 1 + test/sys/kernel/slab/kmalloc-2048/align | 1 + test/sys/kernel/slab/kmalloc-2048/alloc_calls | 40 ++ test/sys/kernel/slab/kmalloc-2048/cache_dma | 1 + test/sys/kernel/slab/kmalloc-2048/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-2048/ctor | 0 test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-2048/free_calls | 15 + test/sys/kernel/slab/kmalloc-2048/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-2048/object_size | 1 + test/sys/kernel/slab/kmalloc-2048/objects | 1 + test/sys/kernel/slab/kmalloc-2048/objects_partial | 1 + test/sys/kernel/slab/kmalloc-2048/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-2048/order | 1 + test/sys/kernel/slab/kmalloc-2048/partial | 1 + test/sys/kernel/slab/kmalloc-2048/poison | 1 + test/sys/kernel/slab/kmalloc-2048/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-2048/red_zone | 1 + test/sys/kernel/slab/kmalloc-2048/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-2048/shrink | 0 test/sys/kernel/slab/kmalloc-2048/slab_size | 1 + test/sys/kernel/slab/kmalloc-2048/slabs | 1 + test/sys/kernel/slab/kmalloc-2048/store_user | 1 + test/sys/kernel/slab/kmalloc-2048/total_objects | 1 + test/sys/kernel/slab/kmalloc-2048/trace | 1 + test/sys/kernel/slab/kmalloc-2048/validate | 0 test/sys/kernel/slab/kmalloc-256/aliases | 1 + test/sys/kernel/slab/kmalloc-256/align | 1 + test/sys/kernel/slab/kmalloc-256/alloc_calls | 27 + test/sys/kernel/slab/kmalloc-256/cache_dma | 1 + test/sys/kernel/slab/kmalloc-256/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-256/ctor | 0 test/sys/kernel/slab/kmalloc-256/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-256/free_calls | 13 + test/sys/kernel/slab/kmalloc-256/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-256/object_size | 1 + test/sys/kernel/slab/kmalloc-256/objects | 1 + test/sys/kernel/slab/kmalloc-256/objects_partial | 1 + test/sys/kernel/slab/kmalloc-256/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-256/order | 1 + test/sys/kernel/slab/kmalloc-256/partial | 1 + test/sys/kernel/slab/kmalloc-256/poison | 1 + test/sys/kernel/slab/kmalloc-256/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-256/red_zone | 1 + test/sys/kernel/slab/kmalloc-256/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-256/shrink | 0 test/sys/kernel/slab/kmalloc-256/slab_size | 1 + test/sys/kernel/slab/kmalloc-256/slabs | 1 + test/sys/kernel/slab/kmalloc-256/store_user | 1 + test/sys/kernel/slab/kmalloc-256/total_objects | 1 + test/sys/kernel/slab/kmalloc-256/trace | 1 + test/sys/kernel/slab/kmalloc-256/validate | 0 test/sys/kernel/slab/kmalloc-32/aliases | 1 + test/sys/kernel/slab/kmalloc-32/align | 1 + test/sys/kernel/slab/kmalloc-32/alloc_calls | 51 ++ test/sys/kernel/slab/kmalloc-32/cache_dma | 1 + test/sys/kernel/slab/kmalloc-32/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-32/ctor | 0 test/sys/kernel/slab/kmalloc-32/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-32/free_calls | 23 + test/sys/kernel/slab/kmalloc-32/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-32/object_size | 1 + test/sys/kernel/slab/kmalloc-32/objects | 1 + test/sys/kernel/slab/kmalloc-32/objects_partial | 1 + test/sys/kernel/slab/kmalloc-32/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-32/order | 1 + test/sys/kernel/slab/kmalloc-32/partial | 1 + test/sys/kernel/slab/kmalloc-32/poison | 1 + test/sys/kernel/slab/kmalloc-32/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-32/red_zone | 1 + test/sys/kernel/slab/kmalloc-32/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-32/shrink | 0 test/sys/kernel/slab/kmalloc-32/slab_size | 1 + test/sys/kernel/slab/kmalloc-32/slabs | 1 + test/sys/kernel/slab/kmalloc-32/store_user | 1 + test/sys/kernel/slab/kmalloc-32/total_objects | 1 + test/sys/kernel/slab/kmalloc-32/trace | 1 + test/sys/kernel/slab/kmalloc-32/validate | 0 test/sys/kernel/slab/kmalloc-4096/aliases | 1 + test/sys/kernel/slab/kmalloc-4096/align | 1 + test/sys/kernel/slab/kmalloc-4096/alloc_calls | 23 + test/sys/kernel/slab/kmalloc-4096/cache_dma | 1 + test/sys/kernel/slab/kmalloc-4096/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-4096/ctor | 0 test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-4096/free_calls | 7 + test/sys/kernel/slab/kmalloc-4096/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-4096/object_size | 1 + test/sys/kernel/slab/kmalloc-4096/objects | 1 + test/sys/kernel/slab/kmalloc-4096/objects_partial | 1 + test/sys/kernel/slab/kmalloc-4096/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-4096/order | 1 + test/sys/kernel/slab/kmalloc-4096/partial | 1 + test/sys/kernel/slab/kmalloc-4096/poison | 1 + test/sys/kernel/slab/kmalloc-4096/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-4096/red_zone | 1 + test/sys/kernel/slab/kmalloc-4096/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-4096/shrink | 0 test/sys/kernel/slab/kmalloc-4096/slab_size | 1 + test/sys/kernel/slab/kmalloc-4096/slabs | 1 + test/sys/kernel/slab/kmalloc-4096/store_user | 1 + test/sys/kernel/slab/kmalloc-4096/total_objects | 1 + test/sys/kernel/slab/kmalloc-4096/trace | 1 + test/sys/kernel/slab/kmalloc-4096/validate | 0 test/sys/kernel/slab/kmalloc-512/aliases | 1 + test/sys/kernel/slab/kmalloc-512/align | 1 + test/sys/kernel/slab/kmalloc-512/alloc_calls | 54 ++ test/sys/kernel/slab/kmalloc-512/cache_dma | 1 + test/sys/kernel/slab/kmalloc-512/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-512/ctor | 0 test/sys/kernel/slab/kmalloc-512/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-512/free_calls | 10 + test/sys/kernel/slab/kmalloc-512/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-512/object_size | 1 + test/sys/kernel/slab/kmalloc-512/objects | 1 + test/sys/kernel/slab/kmalloc-512/objects_partial | 1 + test/sys/kernel/slab/kmalloc-512/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-512/order | 1 + test/sys/kernel/slab/kmalloc-512/partial | 1 + test/sys/kernel/slab/kmalloc-512/poison | 1 + test/sys/kernel/slab/kmalloc-512/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-512/red_zone | 1 + test/sys/kernel/slab/kmalloc-512/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-512/shrink | 0 test/sys/kernel/slab/kmalloc-512/slab_size | 1 + test/sys/kernel/slab/kmalloc-512/slabs | 1 + test/sys/kernel/slab/kmalloc-512/store_user | 1 + test/sys/kernel/slab/kmalloc-512/total_objects | 1 + test/sys/kernel/slab/kmalloc-512/trace | 1 + test/sys/kernel/slab/kmalloc-512/validate | 0 test/sys/kernel/slab/kmalloc-64/aliases | 1 + test/sys/kernel/slab/kmalloc-64/align | 1 + test/sys/kernel/slab/kmalloc-64/alloc_calls | 54 ++ test/sys/kernel/slab/kmalloc-64/cache_dma | 1 + test/sys/kernel/slab/kmalloc-64/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-64/ctor | 0 test/sys/kernel/slab/kmalloc-64/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-64/free_calls | 47 ++ test/sys/kernel/slab/kmalloc-64/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-64/object_size | 1 + test/sys/kernel/slab/kmalloc-64/objects | 1 + test/sys/kernel/slab/kmalloc-64/objects_partial | 1 + test/sys/kernel/slab/kmalloc-64/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-64/order | 1 + test/sys/kernel/slab/kmalloc-64/partial | 1 + test/sys/kernel/slab/kmalloc-64/poison | 1 + test/sys/kernel/slab/kmalloc-64/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-64/red_zone | 1 + test/sys/kernel/slab/kmalloc-64/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-64/shrink | 0 test/sys/kernel/slab/kmalloc-64/slab_size | 1 + test/sys/kernel/slab/kmalloc-64/slabs | 1 + test/sys/kernel/slab/kmalloc-64/store_user | 1 + test/sys/kernel/slab/kmalloc-64/total_objects | 1 + test/sys/kernel/slab/kmalloc-64/trace | 1 + test/sys/kernel/slab/kmalloc-64/validate | 0 test/sys/kernel/slab/kmalloc-8/aliases | 1 + test/sys/kernel/slab/kmalloc-8/align | 1 + test/sys/kernel/slab/kmalloc-8/alloc_calls | 32 ++ test/sys/kernel/slab/kmalloc-8/cache_dma | 1 + test/sys/kernel/slab/kmalloc-8/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-8/ctor | 0 test/sys/kernel/slab/kmalloc-8/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-8/free_calls | 23 + test/sys/kernel/slab/kmalloc-8/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-8/object_size | 1 + test/sys/kernel/slab/kmalloc-8/objects | 1 + test/sys/kernel/slab/kmalloc-8/objects_partial | 1 + test/sys/kernel/slab/kmalloc-8/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-8/order | 1 + test/sys/kernel/slab/kmalloc-8/partial | 1 + test/sys/kernel/slab/kmalloc-8/poison | 1 + test/sys/kernel/slab/kmalloc-8/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-8/red_zone | 1 + test/sys/kernel/slab/kmalloc-8/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-8/shrink | 0 test/sys/kernel/slab/kmalloc-8/slab_size | 1 + test/sys/kernel/slab/kmalloc-8/slabs | 1 + test/sys/kernel/slab/kmalloc-8/store_user | 1 + test/sys/kernel/slab/kmalloc-8/total_objects | 1 + test/sys/kernel/slab/kmalloc-8/trace | 1 + test/sys/kernel/slab/kmalloc-8/validate | 0 test/sys/kernel/slab/kmalloc-96/aliases | 1 + test/sys/kernel/slab/kmalloc-96/align | 1 + test/sys/kernel/slab/kmalloc-96/alloc_calls | 39 ++ test/sys/kernel/slab/kmalloc-96/cache_dma | 1 + test/sys/kernel/slab/kmalloc-96/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc-96/ctor | 0 test/sys/kernel/slab/kmalloc-96/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc-96/free_calls | 18 + test/sys/kernel/slab/kmalloc-96/hwcache_align | 1 + test/sys/kernel/slab/kmalloc-96/object_size | 1 + test/sys/kernel/slab/kmalloc-96/objects | 1 + test/sys/kernel/slab/kmalloc-96/objects_partial | 1 + test/sys/kernel/slab/kmalloc-96/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc-96/order | 1 + test/sys/kernel/slab/kmalloc-96/partial | 1 + test/sys/kernel/slab/kmalloc-96/poison | 1 + test/sys/kernel/slab/kmalloc-96/reclaim_account | 1 + test/sys/kernel/slab/kmalloc-96/red_zone | 1 + test/sys/kernel/slab/kmalloc-96/sanity_checks | 1 + test/sys/kernel/slab/kmalloc-96/shrink | 0 test/sys/kernel/slab/kmalloc-96/slab_size | 1 + test/sys/kernel/slab/kmalloc-96/slabs | 1 + test/sys/kernel/slab/kmalloc-96/store_user | 1 + test/sys/kernel/slab/kmalloc-96/total_objects | 1 + test/sys/kernel/slab/kmalloc-96/trace | 1 + test/sys/kernel/slab/kmalloc-96/validate | 0 test/sys/kernel/slab/kmalloc_dma-512/aliases | 1 + test/sys/kernel/slab/kmalloc_dma-512/align | 1 + test/sys/kernel/slab/kmalloc_dma-512/alloc_calls | 1 + test/sys/kernel/slab/kmalloc_dma-512/cache_dma | 1 + test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs | 1 + test/sys/kernel/slab/kmalloc_dma-512/ctor | 0 .../sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu | 1 + test/sys/kernel/slab/kmalloc_dma-512/free_calls | 1 + test/sys/kernel/slab/kmalloc_dma-512/hwcache_align | 1 + test/sys/kernel/slab/kmalloc_dma-512/object_size | 1 + test/sys/kernel/slab/kmalloc_dma-512/objects | 1 + .../kernel/slab/kmalloc_dma-512/objects_partial | 1 + test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab | 1 + test/sys/kernel/slab/kmalloc_dma-512/order | 1 + test/sys/kernel/slab/kmalloc_dma-512/partial | 1 + test/sys/kernel/slab/kmalloc_dma-512/poison | 1 + .../kernel/slab/kmalloc_dma-512/reclaim_account | 1 + test/sys/kernel/slab/kmalloc_dma-512/red_zone | 1 + test/sys/kernel/slab/kmalloc_dma-512/sanity_checks | 1 + test/sys/kernel/slab/kmalloc_dma-512/shrink | 0 test/sys/kernel/slab/kmalloc_dma-512/slab_size | 1 + test/sys/kernel/slab/kmalloc_dma-512/slabs | 1 + test/sys/kernel/slab/kmalloc_dma-512/store_user | 1 + test/sys/kernel/slab/kmalloc_dma-512/total_objects | 1 + test/sys/kernel/slab/kmalloc_dma-512/trace | 1 + test/sys/kernel/slab/kmalloc_dma-512/validate | 0 test/sys/kernel/slab/mm_struct/aliases | 1 + test/sys/kernel/slab/mm_struct/align | 1 + test/sys/kernel/slab/mm_struct/alloc_calls | 2 + test/sys/kernel/slab/mm_struct/cache_dma | 1 + test/sys/kernel/slab/mm_struct/cpu_slabs | 1 + test/sys/kernel/slab/mm_struct/ctor | 0 test/sys/kernel/slab/mm_struct/destroy_by_rcu | 1 + test/sys/kernel/slab/mm_struct/free_calls | 2 + test/sys/kernel/slab/mm_struct/hwcache_align | 1 + test/sys/kernel/slab/mm_struct/object_size | 1 + test/sys/kernel/slab/mm_struct/objects | 1 + test/sys/kernel/slab/mm_struct/objects_partial | 1 + test/sys/kernel/slab/mm_struct/objs_per_slab | 1 + test/sys/kernel/slab/mm_struct/order | 1 + test/sys/kernel/slab/mm_struct/partial | 1 + test/sys/kernel/slab/mm_struct/poison | 1 + test/sys/kernel/slab/mm_struct/reclaim_account | 1 + test/sys/kernel/slab/mm_struct/red_zone | 1 + test/sys/kernel/slab/mm_struct/sanity_checks | 1 + test/sys/kernel/slab/mm_struct/shrink | 0 test/sys/kernel/slab/mm_struct/slab_size | 1 + test/sys/kernel/slab/mm_struct/slabs | 1 + test/sys/kernel/slab/mm_struct/store_user | 1 + test/sys/kernel/slab/mm_struct/total_objects | 1 + test/sys/kernel/slab/mm_struct/trace | 1 + test/sys/kernel/slab/mm_struct/validate | 0 test/sys/kernel/slab/mnt_cache/aliases | 1 + test/sys/kernel/slab/mnt_cache/align | 1 + test/sys/kernel/slab/mnt_cache/alloc_calls | 1 + test/sys/kernel/slab/mnt_cache/cache_dma | 1 + test/sys/kernel/slab/mnt_cache/cpu_slabs | 1 + test/sys/kernel/slab/mnt_cache/ctor | 0 test/sys/kernel/slab/mnt_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/mnt_cache/free_calls | 1 + test/sys/kernel/slab/mnt_cache/hwcache_align | 1 + test/sys/kernel/slab/mnt_cache/object_size | 1 + test/sys/kernel/slab/mnt_cache/objects | 1 + test/sys/kernel/slab/mnt_cache/objects_partial | 1 + test/sys/kernel/slab/mnt_cache/objs_per_slab | 1 + test/sys/kernel/slab/mnt_cache/order | 1 + test/sys/kernel/slab/mnt_cache/partial | 1 + test/sys/kernel/slab/mnt_cache/poison | 1 + test/sys/kernel/slab/mnt_cache/reclaim_account | 1 + test/sys/kernel/slab/mnt_cache/red_zone | 1 + test/sys/kernel/slab/mnt_cache/sanity_checks | 1 + test/sys/kernel/slab/mnt_cache/shrink | 0 test/sys/kernel/slab/mnt_cache/slab_size | 1 + test/sys/kernel/slab/mnt_cache/slabs | 1 + test/sys/kernel/slab/mnt_cache/store_user | 1 + test/sys/kernel/slab/mnt_cache/total_objects | 1 + test/sys/kernel/slab/mnt_cache/trace | 1 + test/sys/kernel/slab/mnt_cache/validate | 0 test/sys/kernel/slab/mqueue_inode_cache/aliases | 1 + test/sys/kernel/slab/mqueue_inode_cache/align | 1 + .../sys/kernel/slab/mqueue_inode_cache/alloc_calls | 1 + test/sys/kernel/slab/mqueue_inode_cache/cache_dma | 1 + test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs | 1 + test/sys/kernel/slab/mqueue_inode_cache/ctor | 1 + .../kernel/slab/mqueue_inode_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/mqueue_inode_cache/free_calls | 1 + .../kernel/slab/mqueue_inode_cache/hwcache_align | 1 + .../sys/kernel/slab/mqueue_inode_cache/object_size | 1 + test/sys/kernel/slab/mqueue_inode_cache/objects | 1 + .../kernel/slab/mqueue_inode_cache/objects_partial | 1 + .../kernel/slab/mqueue_inode_cache/objs_per_slab | 1 + test/sys/kernel/slab/mqueue_inode_cache/order | 1 + test/sys/kernel/slab/mqueue_inode_cache/partial | 1 + test/sys/kernel/slab/mqueue_inode_cache/poison | 1 + .../kernel/slab/mqueue_inode_cache/reclaim_account | 1 + test/sys/kernel/slab/mqueue_inode_cache/red_zone | 1 + .../kernel/slab/mqueue_inode_cache/sanity_checks | 1 + test/sys/kernel/slab/mqueue_inode_cache/shrink | 0 test/sys/kernel/slab/mqueue_inode_cache/slab_size | 1 + test/sys/kernel/slab/mqueue_inode_cache/slabs | 1 + test/sys/kernel/slab/mqueue_inode_cache/store_user | 1 + .../kernel/slab/mqueue_inode_cache/total_objects | 1 + test/sys/kernel/slab/mqueue_inode_cache/trace | 1 + test/sys/kernel/slab/mqueue_inode_cache/validate | 0 test/sys/kernel/slab/names_cache/aliases | 1 + test/sys/kernel/slab/names_cache/align | 1 + test/sys/kernel/slab/names_cache/alloc_calls | 1 + test/sys/kernel/slab/names_cache/cache_dma | 1 + test/sys/kernel/slab/names_cache/cpu_slabs | 1 + test/sys/kernel/slab/names_cache/ctor | 0 test/sys/kernel/slab/names_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/names_cache/free_calls | 1 + test/sys/kernel/slab/names_cache/hwcache_align | 1 + test/sys/kernel/slab/names_cache/object_size | 1 + test/sys/kernel/slab/names_cache/objects | 1 + test/sys/kernel/slab/names_cache/objects_partial | 1 + test/sys/kernel/slab/names_cache/objs_per_slab | 1 + test/sys/kernel/slab/names_cache/order | 1 + test/sys/kernel/slab/names_cache/partial | 1 + test/sys/kernel/slab/names_cache/poison | 1 + test/sys/kernel/slab/names_cache/reclaim_account | 1 + test/sys/kernel/slab/names_cache/red_zone | 1 + test/sys/kernel/slab/names_cache/sanity_checks | 1 + test/sys/kernel/slab/names_cache/shrink | 0 test/sys/kernel/slab/names_cache/slab_size | 1 + test/sys/kernel/slab/names_cache/slabs | 1 + test/sys/kernel/slab/names_cache/store_user | 1 + test/sys/kernel/slab/names_cache/total_objects | 1 + test/sys/kernel/slab/names_cache/trace | 1 + test/sys/kernel/slab/names_cache/validate | 0 test/sys/kernel/slab/ndisc_cache/aliases | 1 + test/sys/kernel/slab/ndisc_cache/align | 1 + test/sys/kernel/slab/ndisc_cache/alloc_calls | 1 + test/sys/kernel/slab/ndisc_cache/cache_dma | 1 + test/sys/kernel/slab/ndisc_cache/cpu_slabs | 1 + test/sys/kernel/slab/ndisc_cache/ctor | 0 test/sys/kernel/slab/ndisc_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/ndisc_cache/free_calls | 1 + test/sys/kernel/slab/ndisc_cache/hwcache_align | 1 + test/sys/kernel/slab/ndisc_cache/object_size | 1 + test/sys/kernel/slab/ndisc_cache/objects | 1 + test/sys/kernel/slab/ndisc_cache/objects_partial | 1 + test/sys/kernel/slab/ndisc_cache/objs_per_slab | 1 + test/sys/kernel/slab/ndisc_cache/order | 1 + test/sys/kernel/slab/ndisc_cache/partial | 1 + test/sys/kernel/slab/ndisc_cache/poison | 1 + test/sys/kernel/slab/ndisc_cache/reclaim_account | 1 + test/sys/kernel/slab/ndisc_cache/red_zone | 1 + test/sys/kernel/slab/ndisc_cache/sanity_checks | 1 + test/sys/kernel/slab/ndisc_cache/shrink | 0 test/sys/kernel/slab/ndisc_cache/slab_size | 1 + test/sys/kernel/slab/ndisc_cache/slabs | 1 + test/sys/kernel/slab/ndisc_cache/store_user | 1 + test/sys/kernel/slab/ndisc_cache/total_objects | 1 + test/sys/kernel/slab/ndisc_cache/trace | 1 + test/sys/kernel/slab/ndisc_cache/validate | 0 test/sys/kernel/slab/nsproxy/aliases | 1 + test/sys/kernel/slab/nsproxy/align | 1 + test/sys/kernel/slab/nsproxy/alloc_calls | 1 + test/sys/kernel/slab/nsproxy/cache_dma | 1 + test/sys/kernel/slab/nsproxy/cpu_slabs | 1 + test/sys/kernel/slab/nsproxy/ctor | 0 test/sys/kernel/slab/nsproxy/destroy_by_rcu | 1 + test/sys/kernel/slab/nsproxy/free_calls | 1 + test/sys/kernel/slab/nsproxy/hwcache_align | 1 + test/sys/kernel/slab/nsproxy/object_size | 1 + test/sys/kernel/slab/nsproxy/objects | 1 + test/sys/kernel/slab/nsproxy/objects_partial | 1 + test/sys/kernel/slab/nsproxy/objs_per_slab | 1 + test/sys/kernel/slab/nsproxy/order | 1 + test/sys/kernel/slab/nsproxy/partial | 1 + test/sys/kernel/slab/nsproxy/poison | 1 + test/sys/kernel/slab/nsproxy/reclaim_account | 1 + test/sys/kernel/slab/nsproxy/red_zone | 1 + test/sys/kernel/slab/nsproxy/sanity_checks | 1 + test/sys/kernel/slab/nsproxy/shrink | 0 test/sys/kernel/slab/nsproxy/slab_size | 1 + test/sys/kernel/slab/nsproxy/slabs | 1 + test/sys/kernel/slab/nsproxy/store_user | 1 + test/sys/kernel/slab/nsproxy/total_objects | 1 + test/sys/kernel/slab/nsproxy/trace | 1 + test/sys/kernel/slab/nsproxy/validate | 0 test/sys/kernel/slab/pid/aliases | 1 + test/sys/kernel/slab/pid/align | 1 + test/sys/kernel/slab/pid/alloc_calls | 1 + test/sys/kernel/slab/pid/cache_dma | 1 + test/sys/kernel/slab/pid/cpu_slabs | 1 + test/sys/kernel/slab/pid/ctor | 0 test/sys/kernel/slab/pid/destroy_by_rcu | 1 + test/sys/kernel/slab/pid/free_calls | 2 + test/sys/kernel/slab/pid/hwcache_align | 1 + test/sys/kernel/slab/pid/object_size | 1 + test/sys/kernel/slab/pid/objects | 1 + test/sys/kernel/slab/pid/objects_partial | 1 + test/sys/kernel/slab/pid/objs_per_slab | 1 + test/sys/kernel/slab/pid/order | 1 + test/sys/kernel/slab/pid/partial | 1 + test/sys/kernel/slab/pid/poison | 1 + test/sys/kernel/slab/pid/reclaim_account | 1 + test/sys/kernel/slab/pid/red_zone | 1 + test/sys/kernel/slab/pid/sanity_checks | 1 + test/sys/kernel/slab/pid/shrink | 0 test/sys/kernel/slab/pid/slab_size | 1 + test/sys/kernel/slab/pid/slabs | 1 + test/sys/kernel/slab/pid/store_user | 1 + test/sys/kernel/slab/pid/total_objects | 1 + test/sys/kernel/slab/pid/trace | 1 + test/sys/kernel/slab/pid/validate | 0 test/sys/kernel/slab/posix_timers_cache/aliases | 1 + test/sys/kernel/slab/posix_timers_cache/align | 1 + .../sys/kernel/slab/posix_timers_cache/alloc_calls | 1 + test/sys/kernel/slab/posix_timers_cache/cache_dma | 1 + test/sys/kernel/slab/posix_timers_cache/cpu_slabs | 1 + test/sys/kernel/slab/posix_timers_cache/ctor | 0 .../kernel/slab/posix_timers_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/posix_timers_cache/free_calls | 1 + .../kernel/slab/posix_timers_cache/hwcache_align | 1 + .../sys/kernel/slab/posix_timers_cache/object_size | 1 + test/sys/kernel/slab/posix_timers_cache/objects | 1 + .../kernel/slab/posix_timers_cache/objects_partial | 1 + .../kernel/slab/posix_timers_cache/objs_per_slab | 1 + test/sys/kernel/slab/posix_timers_cache/order | 1 + test/sys/kernel/slab/posix_timers_cache/partial | 1 + test/sys/kernel/slab/posix_timers_cache/poison | 1 + .../kernel/slab/posix_timers_cache/reclaim_account | 1 + test/sys/kernel/slab/posix_timers_cache/red_zone | 1 + .../kernel/slab/posix_timers_cache/sanity_checks | 1 + test/sys/kernel/slab/posix_timers_cache/shrink | 0 test/sys/kernel/slab/posix_timers_cache/slab_size | 1 + test/sys/kernel/slab/posix_timers_cache/slabs | 1 + test/sys/kernel/slab/posix_timers_cache/store_user | 1 + .../kernel/slab/posix_timers_cache/total_objects | 1 + test/sys/kernel/slab/posix_timers_cache/trace | 1 + test/sys/kernel/slab/posix_timers_cache/validate | 0 test/sys/kernel/slab/proc_inode_cache/aliases | 1 + test/sys/kernel/slab/proc_inode_cache/align | 1 + test/sys/kernel/slab/proc_inode_cache/alloc_calls | 1 + test/sys/kernel/slab/proc_inode_cache/cache_dma | 1 + test/sys/kernel/slab/proc_inode_cache/cpu_slabs | 1 + test/sys/kernel/slab/proc_inode_cache/ctor | 1 + .../kernel/slab/proc_inode_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/proc_inode_cache/free_calls | 2 + .../sys/kernel/slab/proc_inode_cache/hwcache_align | 1 + test/sys/kernel/slab/proc_inode_cache/object_size | 1 + test/sys/kernel/slab/proc_inode_cache/objects | 1 + .../kernel/slab/proc_inode_cache/objects_partial | 1 + .../sys/kernel/slab/proc_inode_cache/objs_per_slab | 1 + test/sys/kernel/slab/proc_inode_cache/order | 1 + test/sys/kernel/slab/proc_inode_cache/partial | 1 + test/sys/kernel/slab/proc_inode_cache/poison | 1 + .../kernel/slab/proc_inode_cache/reclaim_account | 1 + test/sys/kernel/slab/proc_inode_cache/red_zone | 1 + .../sys/kernel/slab/proc_inode_cache/sanity_checks | 1 + test/sys/kernel/slab/proc_inode_cache/shrink | 0 test/sys/kernel/slab/proc_inode_cache/slab_size | 1 + test/sys/kernel/slab/proc_inode_cache/slabs | 1 + test/sys/kernel/slab/proc_inode_cache/store_user | 1 + .../sys/kernel/slab/proc_inode_cache/total_objects | 1 + test/sys/kernel/slab/proc_inode_cache/trace | 1 + test/sys/kernel/slab/proc_inode_cache/validate | 0 test/sys/kernel/slab/radix_tree_node/aliases | 1 + test/sys/kernel/slab/radix_tree_node/align | 1 + test/sys/kernel/slab/radix_tree_node/alloc_calls | 1 + test/sys/kernel/slab/radix_tree_node/cache_dma | 1 + test/sys/kernel/slab/radix_tree_node/cpu_slabs | 1 + test/sys/kernel/slab/radix_tree_node/ctor | 1 + .../sys/kernel/slab/radix_tree_node/destroy_by_rcu | 1 + test/sys/kernel/slab/radix_tree_node/free_calls | 2 + test/sys/kernel/slab/radix_tree_node/hwcache_align | 1 + test/sys/kernel/slab/radix_tree_node/object_size | 1 + test/sys/kernel/slab/radix_tree_node/objects | 1 + .../kernel/slab/radix_tree_node/objects_partial | 1 + test/sys/kernel/slab/radix_tree_node/objs_per_slab | 1 + test/sys/kernel/slab/radix_tree_node/order | 1 + test/sys/kernel/slab/radix_tree_node/partial | 1 + test/sys/kernel/slab/radix_tree_node/poison | 1 + .../kernel/slab/radix_tree_node/reclaim_account | 1 + test/sys/kernel/slab/radix_tree_node/red_zone | 1 + test/sys/kernel/slab/radix_tree_node/sanity_checks | 1 + test/sys/kernel/slab/radix_tree_node/shrink | 0 test/sys/kernel/slab/radix_tree_node/slab_size | 1 + test/sys/kernel/slab/radix_tree_node/slabs | 1 + test/sys/kernel/slab/radix_tree_node/store_user | 1 + test/sys/kernel/slab/radix_tree_node/total_objects | 1 + test/sys/kernel/slab/radix_tree_node/trace | 1 + test/sys/kernel/slab/radix_tree_node/validate | 0 test/sys/kernel/slab/request_sock_TCP/aliases | 1 + test/sys/kernel/slab/request_sock_TCP/align | 1 + test/sys/kernel/slab/request_sock_TCP/alloc_calls | 1 + test/sys/kernel/slab/request_sock_TCP/cache_dma | 1 + test/sys/kernel/slab/request_sock_TCP/cpu_slabs | 1 + test/sys/kernel/slab/request_sock_TCP/ctor | 0 .../kernel/slab/request_sock_TCP/destroy_by_rcu | 1 + test/sys/kernel/slab/request_sock_TCP/free_calls | 1 + .../sys/kernel/slab/request_sock_TCP/hwcache_align | 1 + test/sys/kernel/slab/request_sock_TCP/object_size | 1 + test/sys/kernel/slab/request_sock_TCP/objects | 1 + .../kernel/slab/request_sock_TCP/objects_partial | 1 + .../sys/kernel/slab/request_sock_TCP/objs_per_slab | 1 + test/sys/kernel/slab/request_sock_TCP/order | 1 + test/sys/kernel/slab/request_sock_TCP/partial | 1 + test/sys/kernel/slab/request_sock_TCP/poison | 1 + .../kernel/slab/request_sock_TCP/reclaim_account | 1 + test/sys/kernel/slab/request_sock_TCP/red_zone | 1 + .../sys/kernel/slab/request_sock_TCP/sanity_checks | 1 + test/sys/kernel/slab/request_sock_TCP/shrink | 0 test/sys/kernel/slab/request_sock_TCP/slab_size | 1 + test/sys/kernel/slab/request_sock_TCP/slabs | 1 + test/sys/kernel/slab/request_sock_TCP/store_user | 1 + .../sys/kernel/slab/request_sock_TCP/total_objects | 1 + test/sys/kernel/slab/request_sock_TCP/trace | 1 + test/sys/kernel/slab/request_sock_TCP/validate | 0 test/sys/kernel/slab/request_sock_TCPv6/aliases | 1 + test/sys/kernel/slab/request_sock_TCPv6/align | 1 + .../sys/kernel/slab/request_sock_TCPv6/alloc_calls | 1 + test/sys/kernel/slab/request_sock_TCPv6/cache_dma | 1 + test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs | 1 + test/sys/kernel/slab/request_sock_TCPv6/ctor | 0 .../kernel/slab/request_sock_TCPv6/destroy_by_rcu | 1 + test/sys/kernel/slab/request_sock_TCPv6/free_calls | 1 + .../kernel/slab/request_sock_TCPv6/hwcache_align | 1 + .../sys/kernel/slab/request_sock_TCPv6/object_size | 1 + test/sys/kernel/slab/request_sock_TCPv6/objects | 1 + .../kernel/slab/request_sock_TCPv6/objects_partial | 1 + .../kernel/slab/request_sock_TCPv6/objs_per_slab | 1 + test/sys/kernel/slab/request_sock_TCPv6/order | 1 + test/sys/kernel/slab/request_sock_TCPv6/partial | 1 + test/sys/kernel/slab/request_sock_TCPv6/poison | 1 + .../kernel/slab/request_sock_TCPv6/reclaim_account | 1 + test/sys/kernel/slab/request_sock_TCPv6/red_zone | 1 + .../kernel/slab/request_sock_TCPv6/sanity_checks | 1 + test/sys/kernel/slab/request_sock_TCPv6/shrink | 0 test/sys/kernel/slab/request_sock_TCPv6/slab_size | 1 + test/sys/kernel/slab/request_sock_TCPv6/slabs | 1 + test/sys/kernel/slab/request_sock_TCPv6/store_user | 1 + .../kernel/slab/request_sock_TCPv6/total_objects | 1 + test/sys/kernel/slab/request_sock_TCPv6/trace | 1 + test/sys/kernel/slab/request_sock_TCPv6/validate | 0 test/sys/kernel/slab/revoke_record/aliases | 1 + test/sys/kernel/slab/revoke_record/align | 1 + test/sys/kernel/slab/revoke_record/alloc_calls | 1 + test/sys/kernel/slab/revoke_record/cache_dma | 1 + test/sys/kernel/slab/revoke_record/cpu_slabs | 1 + test/sys/kernel/slab/revoke_record/ctor | 0 test/sys/kernel/slab/revoke_record/destroy_by_rcu | 1 + test/sys/kernel/slab/revoke_record/free_calls | 1 + test/sys/kernel/slab/revoke_record/hwcache_align | 1 + test/sys/kernel/slab/revoke_record/object_size | 1 + test/sys/kernel/slab/revoke_record/objects | 1 + test/sys/kernel/slab/revoke_record/objects_partial | 1 + test/sys/kernel/slab/revoke_record/objs_per_slab | 1 + test/sys/kernel/slab/revoke_record/order | 1 + test/sys/kernel/slab/revoke_record/partial | 1 + test/sys/kernel/slab/revoke_record/poison | 1 + test/sys/kernel/slab/revoke_record/reclaim_account | 1 + test/sys/kernel/slab/revoke_record/red_zone | 1 + test/sys/kernel/slab/revoke_record/sanity_checks | 1 + test/sys/kernel/slab/revoke_record/shrink | 0 test/sys/kernel/slab/revoke_record/slab_size | 1 + test/sys/kernel/slab/revoke_record/slabs | 1 + test/sys/kernel/slab/revoke_record/store_user | 1 + test/sys/kernel/slab/revoke_record/total_objects | 1 + test/sys/kernel/slab/revoke_record/trace | 1 + test/sys/kernel/slab/revoke_record/validate | 0 test/sys/kernel/slab/revoke_table/aliases | 1 + test/sys/kernel/slab/revoke_table/align | 1 + test/sys/kernel/slab/revoke_table/alloc_calls | 1 + test/sys/kernel/slab/revoke_table/cache_dma | 1 + test/sys/kernel/slab/revoke_table/cpu_slabs | 1 + test/sys/kernel/slab/revoke_table/ctor | 0 test/sys/kernel/slab/revoke_table/destroy_by_rcu | 1 + test/sys/kernel/slab/revoke_table/free_calls | 1 + test/sys/kernel/slab/revoke_table/hwcache_align | 1 + test/sys/kernel/slab/revoke_table/object_size | 1 + test/sys/kernel/slab/revoke_table/objects | 1 + test/sys/kernel/slab/revoke_table/objects_partial | 1 + test/sys/kernel/slab/revoke_table/objs_per_slab | 1 + test/sys/kernel/slab/revoke_table/order | 1 + test/sys/kernel/slab/revoke_table/partial | 1 + test/sys/kernel/slab/revoke_table/poison | 1 + test/sys/kernel/slab/revoke_table/reclaim_account | 1 + test/sys/kernel/slab/revoke_table/red_zone | 1 + test/sys/kernel/slab/revoke_table/sanity_checks | 1 + test/sys/kernel/slab/revoke_table/shrink | 0 test/sys/kernel/slab/revoke_table/slab_size | 1 + test/sys/kernel/slab/revoke_table/slabs | 1 + test/sys/kernel/slab/revoke_table/store_user | 1 + test/sys/kernel/slab/revoke_table/total_objects | 1 + test/sys/kernel/slab/revoke_table/trace | 1 + test/sys/kernel/slab/revoke_table/validate | 0 test/sys/kernel/slab/scsi_cmd_cache/aliases | 1 + test/sys/kernel/slab/scsi_cmd_cache/align | 1 + test/sys/kernel/slab/scsi_cmd_cache/alloc_calls | 1 + test/sys/kernel/slab/scsi_cmd_cache/cache_dma | 1 + test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs | 1 + test/sys/kernel/slab/scsi_cmd_cache/ctor | 0 test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/scsi_cmd_cache/free_calls | 2 + test/sys/kernel/slab/scsi_cmd_cache/hwcache_align | 1 + test/sys/kernel/slab/scsi_cmd_cache/object_size | 1 + test/sys/kernel/slab/scsi_cmd_cache/objects | 1 + .../sys/kernel/slab/scsi_cmd_cache/objects_partial | 1 + test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab | 1 + test/sys/kernel/slab/scsi_cmd_cache/order | 1 + test/sys/kernel/slab/scsi_cmd_cache/partial | 1 + test/sys/kernel/slab/scsi_cmd_cache/poison | 1 + .../sys/kernel/slab/scsi_cmd_cache/reclaim_account | 1 + test/sys/kernel/slab/scsi_cmd_cache/red_zone | 1 + test/sys/kernel/slab/scsi_cmd_cache/sanity_checks | 1 + test/sys/kernel/slab/scsi_cmd_cache/shrink | 0 test/sys/kernel/slab/scsi_cmd_cache/slab_size | 1 + test/sys/kernel/slab/scsi_cmd_cache/slabs | 1 + test/sys/kernel/slab/scsi_cmd_cache/store_user | 1 + test/sys/kernel/slab/scsi_cmd_cache/total_objects | 1 + test/sys/kernel/slab/scsi_cmd_cache/trace | 1 + test/sys/kernel/slab/scsi_cmd_cache/validate | 0 test/sys/kernel/slab/scsi_data_buffer/aliases | 1 + test/sys/kernel/slab/scsi_data_buffer/align | 1 + test/sys/kernel/slab/scsi_data_buffer/alloc_calls | 1 + test/sys/kernel/slab/scsi_data_buffer/cache_dma | 1 + test/sys/kernel/slab/scsi_data_buffer/cpu_slabs | 1 + test/sys/kernel/slab/scsi_data_buffer/ctor | 0 .../kernel/slab/scsi_data_buffer/destroy_by_rcu | 1 + test/sys/kernel/slab/scsi_data_buffer/free_calls | 1 + .../sys/kernel/slab/scsi_data_buffer/hwcache_align | 1 + test/sys/kernel/slab/scsi_data_buffer/object_size | 1 + test/sys/kernel/slab/scsi_data_buffer/objects | 1 + .../kernel/slab/scsi_data_buffer/objects_partial | 1 + .../sys/kernel/slab/scsi_data_buffer/objs_per_slab | 1 + test/sys/kernel/slab/scsi_data_buffer/order | 1 + test/sys/kernel/slab/scsi_data_buffer/partial | 1 + test/sys/kernel/slab/scsi_data_buffer/poison | 1 + .../kernel/slab/scsi_data_buffer/reclaim_account | 1 + test/sys/kernel/slab/scsi_data_buffer/red_zone | 1 + .../sys/kernel/slab/scsi_data_buffer/sanity_checks | 1 + test/sys/kernel/slab/scsi_data_buffer/shrink | 0 test/sys/kernel/slab/scsi_data_buffer/slab_size | 1 + test/sys/kernel/slab/scsi_data_buffer/slabs | 1 + test/sys/kernel/slab/scsi_data_buffer/store_user | 1 + .../sys/kernel/slab/scsi_data_buffer/total_objects | 1 + test/sys/kernel/slab/scsi_data_buffer/trace | 1 + test/sys/kernel/slab/scsi_data_buffer/validate | 0 test/sys/kernel/slab/scsi_io_context/aliases | 1 + test/sys/kernel/slab/scsi_io_context/align | 1 + test/sys/kernel/slab/scsi_io_context/alloc_calls | 1 + test/sys/kernel/slab/scsi_io_context/cache_dma | 1 + test/sys/kernel/slab/scsi_io_context/cpu_slabs | 1 + test/sys/kernel/slab/scsi_io_context/ctor | 0 .../sys/kernel/slab/scsi_io_context/destroy_by_rcu | 1 + test/sys/kernel/slab/scsi_io_context/free_calls | 1 + test/sys/kernel/slab/scsi_io_context/hwcache_align | 1 + test/sys/kernel/slab/scsi_io_context/object_size | 1 + test/sys/kernel/slab/scsi_io_context/objects | 1 + .../kernel/slab/scsi_io_context/objects_partial | 1 + test/sys/kernel/slab/scsi_io_context/objs_per_slab | 1 + test/sys/kernel/slab/scsi_io_context/order | 1 + test/sys/kernel/slab/scsi_io_context/partial | 1 + test/sys/kernel/slab/scsi_io_context/poison | 1 + .../kernel/slab/scsi_io_context/reclaim_account | 1 + test/sys/kernel/slab/scsi_io_context/red_zone | 1 + test/sys/kernel/slab/scsi_io_context/sanity_checks | 1 + test/sys/kernel/slab/scsi_io_context/shrink | 0 test/sys/kernel/slab/scsi_io_context/slab_size | 1 + test/sys/kernel/slab/scsi_io_context/slabs | 1 + test/sys/kernel/slab/scsi_io_context/store_user | 1 + test/sys/kernel/slab/scsi_io_context/total_objects | 1 + test/sys/kernel/slab/scsi_io_context/trace | 1 + test/sys/kernel/slab/scsi_io_context/validate | 0 test/sys/kernel/slab/scsi_sense_cache/aliases | 1 + test/sys/kernel/slab/scsi_sense_cache/align | 1 + test/sys/kernel/slab/scsi_sense_cache/alloc_calls | 1 + test/sys/kernel/slab/scsi_sense_cache/cache_dma | 1 + test/sys/kernel/slab/scsi_sense_cache/cpu_slabs | 1 + test/sys/kernel/slab/scsi_sense_cache/ctor | 0 .../kernel/slab/scsi_sense_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/scsi_sense_cache/free_calls | 2 + .../sys/kernel/slab/scsi_sense_cache/hwcache_align | 1 + test/sys/kernel/slab/scsi_sense_cache/object_size | 1 + test/sys/kernel/slab/scsi_sense_cache/objects | 1 + .../kernel/slab/scsi_sense_cache/objects_partial | 1 + .../sys/kernel/slab/scsi_sense_cache/objs_per_slab | 1 + test/sys/kernel/slab/scsi_sense_cache/order | 1 + test/sys/kernel/slab/scsi_sense_cache/partial | 1 + test/sys/kernel/slab/scsi_sense_cache/poison | 1 + .../kernel/slab/scsi_sense_cache/reclaim_account | 1 + test/sys/kernel/slab/scsi_sense_cache/red_zone | 1 + .../sys/kernel/slab/scsi_sense_cache/sanity_checks | 1 + test/sys/kernel/slab/scsi_sense_cache/shrink | 0 test/sys/kernel/slab/scsi_sense_cache/slab_size | 1 + test/sys/kernel/slab/scsi_sense_cache/slabs | 1 + test/sys/kernel/slab/scsi_sense_cache/store_user | 1 + .../sys/kernel/slab/scsi_sense_cache/total_objects | 1 + test/sys/kernel/slab/scsi_sense_cache/trace | 1 + test/sys/kernel/slab/scsi_sense_cache/validate | 0 test/sys/kernel/slab/secpath_cache/aliases | 1 + test/sys/kernel/slab/secpath_cache/align | 1 + test/sys/kernel/slab/secpath_cache/alloc_calls | 1 + test/sys/kernel/slab/secpath_cache/cache_dma | 1 + test/sys/kernel/slab/secpath_cache/cpu_slabs | 1 + test/sys/kernel/slab/secpath_cache/ctor | 0 test/sys/kernel/slab/secpath_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/secpath_cache/free_calls | 1 + test/sys/kernel/slab/secpath_cache/hwcache_align | 1 + test/sys/kernel/slab/secpath_cache/object_size | 1 + test/sys/kernel/slab/secpath_cache/objects | 1 + test/sys/kernel/slab/secpath_cache/objects_partial | 1 + test/sys/kernel/slab/secpath_cache/objs_per_slab | 1 + test/sys/kernel/slab/secpath_cache/order | 1 + test/sys/kernel/slab/secpath_cache/partial | 1 + test/sys/kernel/slab/secpath_cache/poison | 1 + test/sys/kernel/slab/secpath_cache/reclaim_account | 1 + test/sys/kernel/slab/secpath_cache/red_zone | 1 + test/sys/kernel/slab/secpath_cache/sanity_checks | 1 + test/sys/kernel/slab/secpath_cache/shrink | 0 test/sys/kernel/slab/secpath_cache/slab_size | 1 + test/sys/kernel/slab/secpath_cache/slabs | 1 + test/sys/kernel/slab/secpath_cache/store_user | 1 + test/sys/kernel/slab/secpath_cache/total_objects | 1 + test/sys/kernel/slab/secpath_cache/trace | 1 + test/sys/kernel/slab/secpath_cache/validate | 0 test/sys/kernel/slab/sgpool-128/aliases | 1 + test/sys/kernel/slab/sgpool-128/align | 1 + test/sys/kernel/slab/sgpool-128/alloc_calls | 1 + test/sys/kernel/slab/sgpool-128/cache_dma | 1 + test/sys/kernel/slab/sgpool-128/cpu_slabs | 1 + test/sys/kernel/slab/sgpool-128/ctor | 0 test/sys/kernel/slab/sgpool-128/destroy_by_rcu | 1 + test/sys/kernel/slab/sgpool-128/free_calls | 1 + test/sys/kernel/slab/sgpool-128/hwcache_align | 1 + test/sys/kernel/slab/sgpool-128/object_size | 1 + test/sys/kernel/slab/sgpool-128/objects | 1 + test/sys/kernel/slab/sgpool-128/objects_partial | 1 + test/sys/kernel/slab/sgpool-128/objs_per_slab | 1 + test/sys/kernel/slab/sgpool-128/order | 1 + test/sys/kernel/slab/sgpool-128/partial | 1 + test/sys/kernel/slab/sgpool-128/poison | 1 + test/sys/kernel/slab/sgpool-128/reclaim_account | 1 + test/sys/kernel/slab/sgpool-128/red_zone | 1 + test/sys/kernel/slab/sgpool-128/sanity_checks | 1 + test/sys/kernel/slab/sgpool-128/shrink | 0 test/sys/kernel/slab/sgpool-128/slab_size | 1 + test/sys/kernel/slab/sgpool-128/slabs | 1 + test/sys/kernel/slab/sgpool-128/store_user | 1 + test/sys/kernel/slab/sgpool-128/total_objects | 1 + test/sys/kernel/slab/sgpool-128/trace | 1 + test/sys/kernel/slab/sgpool-128/validate | 0 test/sys/kernel/slab/sgpool-16/aliases | 1 + test/sys/kernel/slab/sgpool-16/align | 1 + test/sys/kernel/slab/sgpool-16/alloc_calls | 1 + test/sys/kernel/slab/sgpool-16/cache_dma | 1 + test/sys/kernel/slab/sgpool-16/cpu_slabs | 1 + test/sys/kernel/slab/sgpool-16/ctor | 0 test/sys/kernel/slab/sgpool-16/destroy_by_rcu | 1 + test/sys/kernel/slab/sgpool-16/free_calls | 1 + test/sys/kernel/slab/sgpool-16/hwcache_align | 1 + test/sys/kernel/slab/sgpool-16/object_size | 1 + test/sys/kernel/slab/sgpool-16/objects | 1 + test/sys/kernel/slab/sgpool-16/objects_partial | 1 + test/sys/kernel/slab/sgpool-16/objs_per_slab | 1 + test/sys/kernel/slab/sgpool-16/order | 1 + test/sys/kernel/slab/sgpool-16/partial | 1 + test/sys/kernel/slab/sgpool-16/poison | 1 + test/sys/kernel/slab/sgpool-16/reclaim_account | 1 + test/sys/kernel/slab/sgpool-16/red_zone | 1 + test/sys/kernel/slab/sgpool-16/sanity_checks | 1 + test/sys/kernel/slab/sgpool-16/shrink | 0 test/sys/kernel/slab/sgpool-16/slab_size | 1 + test/sys/kernel/slab/sgpool-16/slabs | 1 + test/sys/kernel/slab/sgpool-16/store_user | 1 + test/sys/kernel/slab/sgpool-16/total_objects | 1 + test/sys/kernel/slab/sgpool-16/trace | 1 + test/sys/kernel/slab/sgpool-16/validate | 0 test/sys/kernel/slab/sgpool-32/aliases | 1 + test/sys/kernel/slab/sgpool-32/align | 1 + test/sys/kernel/slab/sgpool-32/alloc_calls | 1 + test/sys/kernel/slab/sgpool-32/cache_dma | 1 + test/sys/kernel/slab/sgpool-32/cpu_slabs | 1 + test/sys/kernel/slab/sgpool-32/ctor | 0 test/sys/kernel/slab/sgpool-32/destroy_by_rcu | 1 + test/sys/kernel/slab/sgpool-32/free_calls | 1 + test/sys/kernel/slab/sgpool-32/hwcache_align | 1 + test/sys/kernel/slab/sgpool-32/object_size | 1 + test/sys/kernel/slab/sgpool-32/objects | 1 + test/sys/kernel/slab/sgpool-32/objects_partial | 1 + test/sys/kernel/slab/sgpool-32/objs_per_slab | 1 + test/sys/kernel/slab/sgpool-32/order | 1 + test/sys/kernel/slab/sgpool-32/partial | 1 + test/sys/kernel/slab/sgpool-32/poison | 1 + test/sys/kernel/slab/sgpool-32/reclaim_account | 1 + test/sys/kernel/slab/sgpool-32/red_zone | 1 + test/sys/kernel/slab/sgpool-32/sanity_checks | 1 + test/sys/kernel/slab/sgpool-32/shrink | 0 test/sys/kernel/slab/sgpool-32/slab_size | 1 + test/sys/kernel/slab/sgpool-32/slabs | 1 + test/sys/kernel/slab/sgpool-32/store_user | 1 + test/sys/kernel/slab/sgpool-32/total_objects | 1 + test/sys/kernel/slab/sgpool-32/trace | 1 + test/sys/kernel/slab/sgpool-32/validate | 0 test/sys/kernel/slab/sgpool-64/aliases | 1 + test/sys/kernel/slab/sgpool-64/align | 1 + test/sys/kernel/slab/sgpool-64/alloc_calls | 1 + test/sys/kernel/slab/sgpool-64/cache_dma | 1 + test/sys/kernel/slab/sgpool-64/cpu_slabs | 1 + test/sys/kernel/slab/sgpool-64/ctor | 0 test/sys/kernel/slab/sgpool-64/destroy_by_rcu | 1 + test/sys/kernel/slab/sgpool-64/free_calls | 1 + test/sys/kernel/slab/sgpool-64/hwcache_align | 1 + test/sys/kernel/slab/sgpool-64/object_size | 1 + test/sys/kernel/slab/sgpool-64/objects | 1 + test/sys/kernel/slab/sgpool-64/objects_partial | 1 + test/sys/kernel/slab/sgpool-64/objs_per_slab | 1 + test/sys/kernel/slab/sgpool-64/order | 1 + test/sys/kernel/slab/sgpool-64/partial | 1 + test/sys/kernel/slab/sgpool-64/poison | 1 + test/sys/kernel/slab/sgpool-64/reclaim_account | 1 + test/sys/kernel/slab/sgpool-64/red_zone | 1 + test/sys/kernel/slab/sgpool-64/sanity_checks | 1 + test/sys/kernel/slab/sgpool-64/shrink | 0 test/sys/kernel/slab/sgpool-64/slab_size | 1 + test/sys/kernel/slab/sgpool-64/slabs | 1 + test/sys/kernel/slab/sgpool-64/store_user | 1 + test/sys/kernel/slab/sgpool-64/total_objects | 1 + test/sys/kernel/slab/sgpool-64/trace | 1 + test/sys/kernel/slab/sgpool-64/validate | 0 test/sys/kernel/slab/sgpool-8/aliases | 1 + test/sys/kernel/slab/sgpool-8/align | 1 + test/sys/kernel/slab/sgpool-8/alloc_calls | 1 + test/sys/kernel/slab/sgpool-8/cache_dma | 1 + test/sys/kernel/slab/sgpool-8/cpu_slabs | 1 + test/sys/kernel/slab/sgpool-8/ctor | 0 test/sys/kernel/slab/sgpool-8/destroy_by_rcu | 1 + test/sys/kernel/slab/sgpool-8/free_calls | 1 + test/sys/kernel/slab/sgpool-8/hwcache_align | 1 + test/sys/kernel/slab/sgpool-8/object_size | 1 + test/sys/kernel/slab/sgpool-8/objects | 1 + test/sys/kernel/slab/sgpool-8/objects_partial | 1 + test/sys/kernel/slab/sgpool-8/objs_per_slab | 1 + test/sys/kernel/slab/sgpool-8/order | 1 + test/sys/kernel/slab/sgpool-8/partial | 1 + test/sys/kernel/slab/sgpool-8/poison | 1 + test/sys/kernel/slab/sgpool-8/reclaim_account | 1 + test/sys/kernel/slab/sgpool-8/red_zone | 1 + test/sys/kernel/slab/sgpool-8/sanity_checks | 1 + test/sys/kernel/slab/sgpool-8/shrink | 0 test/sys/kernel/slab/sgpool-8/slab_size | 1 + test/sys/kernel/slab/sgpool-8/slabs | 1 + test/sys/kernel/slab/sgpool-8/store_user | 1 + test/sys/kernel/slab/sgpool-8/total_objects | 1 + test/sys/kernel/slab/sgpool-8/trace | 1 + test/sys/kernel/slab/sgpool-8/validate | 0 test/sys/kernel/slab/shmem_inode_cache/aliases | 1 + test/sys/kernel/slab/shmem_inode_cache/align | 1 + test/sys/kernel/slab/shmem_inode_cache/alloc_calls | 1 + test/sys/kernel/slab/shmem_inode_cache/cache_dma | 1 + test/sys/kernel/slab/shmem_inode_cache/cpu_slabs | 1 + test/sys/kernel/slab/shmem_inode_cache/ctor | 1 + .../kernel/slab/shmem_inode_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/shmem_inode_cache/free_calls | 2 + .../kernel/slab/shmem_inode_cache/hwcache_align | 1 + test/sys/kernel/slab/shmem_inode_cache/object_size | 1 + test/sys/kernel/slab/shmem_inode_cache/objects | 1 + .../kernel/slab/shmem_inode_cache/objects_partial | 1 + .../kernel/slab/shmem_inode_cache/objs_per_slab | 1 + test/sys/kernel/slab/shmem_inode_cache/order | 1 + test/sys/kernel/slab/shmem_inode_cache/partial | 1 + test/sys/kernel/slab/shmem_inode_cache/poison | 1 + .../kernel/slab/shmem_inode_cache/reclaim_account | 1 + test/sys/kernel/slab/shmem_inode_cache/red_zone | 1 + .../kernel/slab/shmem_inode_cache/sanity_checks | 1 + test/sys/kernel/slab/shmem_inode_cache/shrink | 0 test/sys/kernel/slab/shmem_inode_cache/slab_size | 1 + test/sys/kernel/slab/shmem_inode_cache/slabs | 1 + test/sys/kernel/slab/shmem_inode_cache/store_user | 1 + .../kernel/slab/shmem_inode_cache/total_objects | 1 + test/sys/kernel/slab/shmem_inode_cache/trace | 1 + test/sys/kernel/slab/shmem_inode_cache/validate | 0 test/sys/kernel/slab/sighand_cache/aliases | 1 + test/sys/kernel/slab/sighand_cache/align | 1 + test/sys/kernel/slab/sighand_cache/alloc_calls | 2 + test/sys/kernel/slab/sighand_cache/cache_dma | 1 + test/sys/kernel/slab/sighand_cache/cpu_slabs | 1 + test/sys/kernel/slab/sighand_cache/ctor | 1 + test/sys/kernel/slab/sighand_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/sighand_cache/free_calls | 2 + test/sys/kernel/slab/sighand_cache/hwcache_align | 1 + test/sys/kernel/slab/sighand_cache/object_size | 1 + test/sys/kernel/slab/sighand_cache/objects | 1 + test/sys/kernel/slab/sighand_cache/objects_partial | 1 + test/sys/kernel/slab/sighand_cache/objs_per_slab | 1 + test/sys/kernel/slab/sighand_cache/order | 1 + test/sys/kernel/slab/sighand_cache/partial | 1 + test/sys/kernel/slab/sighand_cache/poison | 1 + test/sys/kernel/slab/sighand_cache/reclaim_account | 1 + test/sys/kernel/slab/sighand_cache/red_zone | 1 + test/sys/kernel/slab/sighand_cache/sanity_checks | 1 + test/sys/kernel/slab/sighand_cache/shrink | 0 test/sys/kernel/slab/sighand_cache/slab_size | 1 + test/sys/kernel/slab/sighand_cache/slabs | 1 + test/sys/kernel/slab/sighand_cache/store_user | 1 + test/sys/kernel/slab/sighand_cache/total_objects | 1 + test/sys/kernel/slab/sighand_cache/trace | 1 + test/sys/kernel/slab/sighand_cache/validate | 0 test/sys/kernel/slab/signal_cache/aliases | 1 + test/sys/kernel/slab/signal_cache/align | 1 + test/sys/kernel/slab/signal_cache/alloc_calls | 1 + test/sys/kernel/slab/signal_cache/cache_dma | 1 + test/sys/kernel/slab/signal_cache/cpu_slabs | 1 + test/sys/kernel/slab/signal_cache/ctor | 0 test/sys/kernel/slab/signal_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/signal_cache/free_calls | 2 + test/sys/kernel/slab/signal_cache/hwcache_align | 1 + test/sys/kernel/slab/signal_cache/object_size | 1 + test/sys/kernel/slab/signal_cache/objects | 1 + test/sys/kernel/slab/signal_cache/objects_partial | 1 + test/sys/kernel/slab/signal_cache/objs_per_slab | 1 + test/sys/kernel/slab/signal_cache/order | 1 + test/sys/kernel/slab/signal_cache/partial | 1 + test/sys/kernel/slab/signal_cache/poison | 1 + test/sys/kernel/slab/signal_cache/reclaim_account | 1 + test/sys/kernel/slab/signal_cache/red_zone | 1 + test/sys/kernel/slab/signal_cache/sanity_checks | 1 + test/sys/kernel/slab/signal_cache/shrink | 0 test/sys/kernel/slab/signal_cache/slab_size | 1 + test/sys/kernel/slab/signal_cache/slabs | 1 + test/sys/kernel/slab/signal_cache/store_user | 1 + test/sys/kernel/slab/signal_cache/total_objects | 1 + test/sys/kernel/slab/signal_cache/trace | 1 + test/sys/kernel/slab/signal_cache/validate | 0 test/sys/kernel/slab/sigqueue/aliases | 1 + test/sys/kernel/slab/sigqueue/align | 1 + test/sys/kernel/slab/sigqueue/alloc_calls | 1 + test/sys/kernel/slab/sigqueue/cache_dma | 1 + test/sys/kernel/slab/sigqueue/cpu_slabs | 1 + test/sys/kernel/slab/sigqueue/ctor | 0 test/sys/kernel/slab/sigqueue/destroy_by_rcu | 1 + test/sys/kernel/slab/sigqueue/free_calls | 1 + test/sys/kernel/slab/sigqueue/hwcache_align | 1 + test/sys/kernel/slab/sigqueue/object_size | 1 + test/sys/kernel/slab/sigqueue/objects | 1 + test/sys/kernel/slab/sigqueue/objects_partial | 1 + test/sys/kernel/slab/sigqueue/objs_per_slab | 1 + test/sys/kernel/slab/sigqueue/order | 1 + test/sys/kernel/slab/sigqueue/partial | 1 + test/sys/kernel/slab/sigqueue/poison | 1 + test/sys/kernel/slab/sigqueue/reclaim_account | 1 + test/sys/kernel/slab/sigqueue/red_zone | 1 + test/sys/kernel/slab/sigqueue/sanity_checks | 1 + test/sys/kernel/slab/sigqueue/shrink | 0 test/sys/kernel/slab/sigqueue/slab_size | 1 + test/sys/kernel/slab/sigqueue/slabs | 1 + test/sys/kernel/slab/sigqueue/store_user | 1 + test/sys/kernel/slab/sigqueue/total_objects | 1 + test/sys/kernel/slab/sigqueue/trace | 1 + test/sys/kernel/slab/sigqueue/validate | 0 test/sys/kernel/slab/skbuff_fclone_cache/aliases | 1 + test/sys/kernel/slab/skbuff_fclone_cache/align | 1 + .../kernel/slab/skbuff_fclone_cache/alloc_calls | 1 + test/sys/kernel/slab/skbuff_fclone_cache/cache_dma | 1 + test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs | 1 + test/sys/kernel/slab/skbuff_fclone_cache/ctor | 0 .../kernel/slab/skbuff_fclone_cache/destroy_by_rcu | 1 + .../sys/kernel/slab/skbuff_fclone_cache/free_calls | 1 + .../kernel/slab/skbuff_fclone_cache/hwcache_align | 1 + .../kernel/slab/skbuff_fclone_cache/object_size | 1 + test/sys/kernel/slab/skbuff_fclone_cache/objects | 1 + .../slab/skbuff_fclone_cache/objects_partial | 1 + .../kernel/slab/skbuff_fclone_cache/objs_per_slab | 1 + test/sys/kernel/slab/skbuff_fclone_cache/order | 1 + test/sys/kernel/slab/skbuff_fclone_cache/partial | 1 + test/sys/kernel/slab/skbuff_fclone_cache/poison | 1 + .../slab/skbuff_fclone_cache/reclaim_account | 1 + test/sys/kernel/slab/skbuff_fclone_cache/red_zone | 1 + .../kernel/slab/skbuff_fclone_cache/sanity_checks | 1 + test/sys/kernel/slab/skbuff_fclone_cache/shrink | 0 test/sys/kernel/slab/skbuff_fclone_cache/slab_size | 1 + test/sys/kernel/slab/skbuff_fclone_cache/slabs | 1 + .../sys/kernel/slab/skbuff_fclone_cache/store_user | 1 + .../kernel/slab/skbuff_fclone_cache/total_objects | 1 + test/sys/kernel/slab/skbuff_fclone_cache/trace | 1 + test/sys/kernel/slab/skbuff_fclone_cache/validate | 0 test/sys/kernel/slab/skbuff_head_cache/aliases | 1 + test/sys/kernel/slab/skbuff_head_cache/align | 1 + test/sys/kernel/slab/skbuff_head_cache/alloc_calls | 1 + test/sys/kernel/slab/skbuff_head_cache/cache_dma | 1 + test/sys/kernel/slab/skbuff_head_cache/cpu_slabs | 1 + test/sys/kernel/slab/skbuff_head_cache/ctor | 0 .../kernel/slab/skbuff_head_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/skbuff_head_cache/free_calls | 2 + .../kernel/slab/skbuff_head_cache/hwcache_align | 1 + test/sys/kernel/slab/skbuff_head_cache/object_size | 1 + test/sys/kernel/slab/skbuff_head_cache/objects | 1 + .../kernel/slab/skbuff_head_cache/objects_partial | 1 + .../kernel/slab/skbuff_head_cache/objs_per_slab | 1 + test/sys/kernel/slab/skbuff_head_cache/order | 1 + test/sys/kernel/slab/skbuff_head_cache/partial | 1 + test/sys/kernel/slab/skbuff_head_cache/poison | 1 + .../kernel/slab/skbuff_head_cache/reclaim_account | 1 + test/sys/kernel/slab/skbuff_head_cache/red_zone | 1 + .../kernel/slab/skbuff_head_cache/sanity_checks | 1 + test/sys/kernel/slab/skbuff_head_cache/shrink | 0 test/sys/kernel/slab/skbuff_head_cache/slab_size | 1 + test/sys/kernel/slab/skbuff_head_cache/slabs | 1 + test/sys/kernel/slab/skbuff_head_cache/store_user | 1 + .../kernel/slab/skbuff_head_cache/total_objects | 1 + test/sys/kernel/slab/skbuff_head_cache/trace | 1 + test/sys/kernel/slab/skbuff_head_cache/validate | 0 test/sys/kernel/slab/sock_inode_cache/aliases | 1 + test/sys/kernel/slab/sock_inode_cache/align | 1 + test/sys/kernel/slab/sock_inode_cache/alloc_calls | 1 + test/sys/kernel/slab/sock_inode_cache/cache_dma | 1 + test/sys/kernel/slab/sock_inode_cache/cpu_slabs | 1 + test/sys/kernel/slab/sock_inode_cache/ctor | 1 + .../kernel/slab/sock_inode_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/sock_inode_cache/free_calls | 2 + .../sys/kernel/slab/sock_inode_cache/hwcache_align | 1 + test/sys/kernel/slab/sock_inode_cache/object_size | 1 + test/sys/kernel/slab/sock_inode_cache/objects | 1 + .../kernel/slab/sock_inode_cache/objects_partial | 1 + .../sys/kernel/slab/sock_inode_cache/objs_per_slab | 1 + test/sys/kernel/slab/sock_inode_cache/order | 1 + test/sys/kernel/slab/sock_inode_cache/partial | 1 + test/sys/kernel/slab/sock_inode_cache/poison | 1 + .../kernel/slab/sock_inode_cache/reclaim_account | 1 + test/sys/kernel/slab/sock_inode_cache/red_zone | 1 + .../sys/kernel/slab/sock_inode_cache/sanity_checks | 1 + test/sys/kernel/slab/sock_inode_cache/shrink | 0 test/sys/kernel/slab/sock_inode_cache/slab_size | 1 + test/sys/kernel/slab/sock_inode_cache/slabs | 1 + test/sys/kernel/slab/sock_inode_cache/store_user | 1 + .../sys/kernel/slab/sock_inode_cache/total_objects | 1 + test/sys/kernel/slab/sock_inode_cache/trace | 1 + test/sys/kernel/slab/sock_inode_cache/validate | 0 test/sys/kernel/slab/sysfs_dir_cache/aliases | 1 + test/sys/kernel/slab/sysfs_dir_cache/align | 1 + test/sys/kernel/slab/sysfs_dir_cache/alloc_calls | 1 + test/sys/kernel/slab/sysfs_dir_cache/cache_dma | 1 + test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs | 1 + test/sys/kernel/slab/sysfs_dir_cache/ctor | 0 .../sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/sysfs_dir_cache/free_calls | 2 + test/sys/kernel/slab/sysfs_dir_cache/hwcache_align | 1 + test/sys/kernel/slab/sysfs_dir_cache/object_size | 1 + test/sys/kernel/slab/sysfs_dir_cache/objects | 1 + .../kernel/slab/sysfs_dir_cache/objects_partial | 1 + test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab | 1 + test/sys/kernel/slab/sysfs_dir_cache/order | 1 + test/sys/kernel/slab/sysfs_dir_cache/partial | 1 + test/sys/kernel/slab/sysfs_dir_cache/poison | 1 + .../kernel/slab/sysfs_dir_cache/reclaim_account | 1 + test/sys/kernel/slab/sysfs_dir_cache/red_zone | 1 + test/sys/kernel/slab/sysfs_dir_cache/sanity_checks | 1 + test/sys/kernel/slab/sysfs_dir_cache/shrink | 0 test/sys/kernel/slab/sysfs_dir_cache/slab_size | 1 + test/sys/kernel/slab/sysfs_dir_cache/slabs | 1 + test/sys/kernel/slab/sysfs_dir_cache/store_user | 1 + test/sys/kernel/slab/sysfs_dir_cache/total_objects | 1 + test/sys/kernel/slab/sysfs_dir_cache/trace | 1 + test/sys/kernel/slab/sysfs_dir_cache/validate | 0 test/sys/kernel/slab/task_struct/aliases | 1 + test/sys/kernel/slab/task_struct/align | 1 + test/sys/kernel/slab/task_struct/alloc_calls | 1 + test/sys/kernel/slab/task_struct/cache_dma | 1 + test/sys/kernel/slab/task_struct/cpu_slabs | 1 + test/sys/kernel/slab/task_struct/ctor | 0 test/sys/kernel/slab/task_struct/destroy_by_rcu | 1 + test/sys/kernel/slab/task_struct/free_calls | 2 + test/sys/kernel/slab/task_struct/hwcache_align | 1 + test/sys/kernel/slab/task_struct/object_size | 1 + test/sys/kernel/slab/task_struct/objects | 1 + test/sys/kernel/slab/task_struct/objects_partial | 1 + test/sys/kernel/slab/task_struct/objs_per_slab | 1 + test/sys/kernel/slab/task_struct/order | 1 + test/sys/kernel/slab/task_struct/partial | 1 + test/sys/kernel/slab/task_struct/poison | 1 + test/sys/kernel/slab/task_struct/reclaim_account | 1 + test/sys/kernel/slab/task_struct/red_zone | 1 + test/sys/kernel/slab/task_struct/sanity_checks | 1 + test/sys/kernel/slab/task_struct/shrink | 0 test/sys/kernel/slab/task_struct/slab_size | 1 + test/sys/kernel/slab/task_struct/slabs | 1 + test/sys/kernel/slab/task_struct/store_user | 1 + test/sys/kernel/slab/task_struct/total_objects | 1 + test/sys/kernel/slab/task_struct/trace | 1 + test/sys/kernel/slab/task_struct/validate | 0 test/sys/kernel/slab/task_xstate/aliases | 1 + test/sys/kernel/slab/task_xstate/align | 1 + test/sys/kernel/slab/task_xstate/alloc_calls | 2 + test/sys/kernel/slab/task_xstate/cache_dma | 1 + test/sys/kernel/slab/task_xstate/cpu_slabs | 1 + test/sys/kernel/slab/task_xstate/ctor | 0 test/sys/kernel/slab/task_xstate/destroy_by_rcu | 1 + test/sys/kernel/slab/task_xstate/free_calls | 2 + test/sys/kernel/slab/task_xstate/hwcache_align | 1 + test/sys/kernel/slab/task_xstate/object_size | 1 + test/sys/kernel/slab/task_xstate/objects | 1 + test/sys/kernel/slab/task_xstate/objects_partial | 1 + test/sys/kernel/slab/task_xstate/objs_per_slab | 1 + test/sys/kernel/slab/task_xstate/order | 1 + test/sys/kernel/slab/task_xstate/partial | 1 + test/sys/kernel/slab/task_xstate/poison | 1 + test/sys/kernel/slab/task_xstate/reclaim_account | 1 + test/sys/kernel/slab/task_xstate/red_zone | 1 + test/sys/kernel/slab/task_xstate/sanity_checks | 1 + test/sys/kernel/slab/task_xstate/shrink | 0 test/sys/kernel/slab/task_xstate/slab_size | 1 + test/sys/kernel/slab/task_xstate/slabs | 1 + test/sys/kernel/slab/task_xstate/store_user | 1 + test/sys/kernel/slab/task_xstate/total_objects | 1 + test/sys/kernel/slab/task_xstate/trace | 1 + test/sys/kernel/slab/task_xstate/validate | 0 test/sys/kernel/slab/tcp_bind_bucket/aliases | 1 + test/sys/kernel/slab/tcp_bind_bucket/align | 1 + test/sys/kernel/slab/tcp_bind_bucket/alloc_calls | 1 + test/sys/kernel/slab/tcp_bind_bucket/cache_dma | 1 + test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs | 1 + test/sys/kernel/slab/tcp_bind_bucket/ctor | 0 .../sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu | 1 + test/sys/kernel/slab/tcp_bind_bucket/free_calls | 2 + test/sys/kernel/slab/tcp_bind_bucket/hwcache_align | 1 + test/sys/kernel/slab/tcp_bind_bucket/object_size | 1 + test/sys/kernel/slab/tcp_bind_bucket/objects | 1 + .../kernel/slab/tcp_bind_bucket/objects_partial | 1 + test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab | 1 + test/sys/kernel/slab/tcp_bind_bucket/order | 1 + test/sys/kernel/slab/tcp_bind_bucket/partial | 1 + test/sys/kernel/slab/tcp_bind_bucket/poison | 1 + .../kernel/slab/tcp_bind_bucket/reclaim_account | 1 + test/sys/kernel/slab/tcp_bind_bucket/red_zone | 1 + test/sys/kernel/slab/tcp_bind_bucket/sanity_checks | 1 + test/sys/kernel/slab/tcp_bind_bucket/shrink | 0 test/sys/kernel/slab/tcp_bind_bucket/slab_size | 1 + test/sys/kernel/slab/tcp_bind_bucket/slabs | 1 + test/sys/kernel/slab/tcp_bind_bucket/store_user | 1 + test/sys/kernel/slab/tcp_bind_bucket/total_objects | 1 + test/sys/kernel/slab/tcp_bind_bucket/trace | 1 + test/sys/kernel/slab/tcp_bind_bucket/validate | 0 test/sys/kernel/slab/tw_sock_TCP/aliases | 1 + test/sys/kernel/slab/tw_sock_TCP/align | 1 + test/sys/kernel/slab/tw_sock_TCP/alloc_calls | 1 + test/sys/kernel/slab/tw_sock_TCP/cache_dma | 1 + test/sys/kernel/slab/tw_sock_TCP/cpu_slabs | 1 + test/sys/kernel/slab/tw_sock_TCP/ctor | 0 test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu | 1 + test/sys/kernel/slab/tw_sock_TCP/free_calls | 1 + test/sys/kernel/slab/tw_sock_TCP/hwcache_align | 1 + test/sys/kernel/slab/tw_sock_TCP/object_size | 1 + test/sys/kernel/slab/tw_sock_TCP/objects | 1 + test/sys/kernel/slab/tw_sock_TCP/objects_partial | 1 + test/sys/kernel/slab/tw_sock_TCP/objs_per_slab | 1 + test/sys/kernel/slab/tw_sock_TCP/order | 1 + test/sys/kernel/slab/tw_sock_TCP/partial | 1 + test/sys/kernel/slab/tw_sock_TCP/poison | 1 + test/sys/kernel/slab/tw_sock_TCP/reclaim_account | 1 + test/sys/kernel/slab/tw_sock_TCP/red_zone | 1 + test/sys/kernel/slab/tw_sock_TCP/sanity_checks | 1 + test/sys/kernel/slab/tw_sock_TCP/shrink | 0 test/sys/kernel/slab/tw_sock_TCP/slab_size | 1 + test/sys/kernel/slab/tw_sock_TCP/slabs | 1 + test/sys/kernel/slab/tw_sock_TCP/store_user | 1 + test/sys/kernel/slab/tw_sock_TCP/total_objects | 1 + test/sys/kernel/slab/tw_sock_TCP/trace | 1 + test/sys/kernel/slab/tw_sock_TCP/validate | 0 test/sys/kernel/slab/tw_sock_TCPv6/aliases | 1 + test/sys/kernel/slab/tw_sock_TCPv6/align | 1 + test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls | 1 + test/sys/kernel/slab/tw_sock_TCPv6/cache_dma | 1 + test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs | 1 + test/sys/kernel/slab/tw_sock_TCPv6/ctor | 0 test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu | 1 + test/sys/kernel/slab/tw_sock_TCPv6/free_calls | 1 + test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align | 1 + test/sys/kernel/slab/tw_sock_TCPv6/object_size | 1 + test/sys/kernel/slab/tw_sock_TCPv6/objects | 1 + test/sys/kernel/slab/tw_sock_TCPv6/objects_partial | 1 + test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab | 1 + test/sys/kernel/slab/tw_sock_TCPv6/order | 1 + test/sys/kernel/slab/tw_sock_TCPv6/partial | 1 + test/sys/kernel/slab/tw_sock_TCPv6/poison | 1 + test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account | 1 + test/sys/kernel/slab/tw_sock_TCPv6/red_zone | 1 + test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks | 1 + test/sys/kernel/slab/tw_sock_TCPv6/shrink | 0 test/sys/kernel/slab/tw_sock_TCPv6/slab_size | 1 + test/sys/kernel/slab/tw_sock_TCPv6/slabs | 1 + test/sys/kernel/slab/tw_sock_TCPv6/store_user | 1 + test/sys/kernel/slab/tw_sock_TCPv6/total_objects | 1 + test/sys/kernel/slab/tw_sock_TCPv6/trace | 1 + test/sys/kernel/slab/tw_sock_TCPv6/validate | 0 test/sys/kernel/slab/uhci_urb_priv/aliases | 1 + test/sys/kernel/slab/uhci_urb_priv/align | 1 + test/sys/kernel/slab/uhci_urb_priv/alloc_calls | 1 + test/sys/kernel/slab/uhci_urb_priv/cache_dma | 1 + test/sys/kernel/slab/uhci_urb_priv/cpu_slabs | 1 + test/sys/kernel/slab/uhci_urb_priv/ctor | 0 test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu | 1 + test/sys/kernel/slab/uhci_urb_priv/free_calls | 1 + test/sys/kernel/slab/uhci_urb_priv/hwcache_align | 1 + test/sys/kernel/slab/uhci_urb_priv/object_size | 1 + test/sys/kernel/slab/uhci_urb_priv/objects | 1 + test/sys/kernel/slab/uhci_urb_priv/objects_partial | 1 + test/sys/kernel/slab/uhci_urb_priv/objs_per_slab | 1 + test/sys/kernel/slab/uhci_urb_priv/order | 1 + test/sys/kernel/slab/uhci_urb_priv/partial | 1 + test/sys/kernel/slab/uhci_urb_priv/poison | 1 + test/sys/kernel/slab/uhci_urb_priv/reclaim_account | 1 + test/sys/kernel/slab/uhci_urb_priv/red_zone | 1 + test/sys/kernel/slab/uhci_urb_priv/sanity_checks | 1 + test/sys/kernel/slab/uhci_urb_priv/shrink | 0 test/sys/kernel/slab/uhci_urb_priv/slab_size | 1 + test/sys/kernel/slab/uhci_urb_priv/slabs | 1 + test/sys/kernel/slab/uhci_urb_priv/store_user | 1 + test/sys/kernel/slab/uhci_urb_priv/total_objects | 1 + test/sys/kernel/slab/uhci_urb_priv/trace | 1 + test/sys/kernel/slab/uhci_urb_priv/validate | 0 test/sys/kernel/slab/uid_cache/aliases | 1 + test/sys/kernel/slab/uid_cache/align | 1 + test/sys/kernel/slab/uid_cache/alloc_calls | 1 + test/sys/kernel/slab/uid_cache/cache_dma | 1 + test/sys/kernel/slab/uid_cache/cpu_slabs | 1 + test/sys/kernel/slab/uid_cache/ctor | 0 test/sys/kernel/slab/uid_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/uid_cache/free_calls | 2 + test/sys/kernel/slab/uid_cache/hwcache_align | 1 + test/sys/kernel/slab/uid_cache/object_size | 1 + test/sys/kernel/slab/uid_cache/objects | 1 + test/sys/kernel/slab/uid_cache/objects_partial | 1 + test/sys/kernel/slab/uid_cache/objs_per_slab | 1 + test/sys/kernel/slab/uid_cache/order | 1 + test/sys/kernel/slab/uid_cache/partial | 1 + test/sys/kernel/slab/uid_cache/poison | 1 + test/sys/kernel/slab/uid_cache/reclaim_account | 1 + test/sys/kernel/slab/uid_cache/red_zone | 1 + test/sys/kernel/slab/uid_cache/sanity_checks | 1 + test/sys/kernel/slab/uid_cache/shrink | 0 test/sys/kernel/slab/uid_cache/slab_size | 1 + test/sys/kernel/slab/uid_cache/slabs | 1 + test/sys/kernel/slab/uid_cache/store_user | 1 + test/sys/kernel/slab/uid_cache/total_objects | 1 + test/sys/kernel/slab/uid_cache/trace | 1 + test/sys/kernel/slab/uid_cache/validate | 0 test/sys/kernel/slab/vm_area_struct/aliases | 1 + test/sys/kernel/slab/vm_area_struct/align | 1 + test/sys/kernel/slab/vm_area_struct/alloc_calls | 7 + test/sys/kernel/slab/vm_area_struct/cache_dma | 1 + test/sys/kernel/slab/vm_area_struct/cpu_slabs | 1 + test/sys/kernel/slab/vm_area_struct/ctor | 0 test/sys/kernel/slab/vm_area_struct/destroy_by_rcu | 1 + test/sys/kernel/slab/vm_area_struct/free_calls | 3 + test/sys/kernel/slab/vm_area_struct/hwcache_align | 1 + test/sys/kernel/slab/vm_area_struct/object_size | 1 + test/sys/kernel/slab/vm_area_struct/objects | 1 + .../sys/kernel/slab/vm_area_struct/objects_partial | 1 + test/sys/kernel/slab/vm_area_struct/objs_per_slab | 1 + test/sys/kernel/slab/vm_area_struct/order | 1 + test/sys/kernel/slab/vm_area_struct/partial | 1 + test/sys/kernel/slab/vm_area_struct/poison | 1 + .../sys/kernel/slab/vm_area_struct/reclaim_account | 1 + test/sys/kernel/slab/vm_area_struct/red_zone | 1 + test/sys/kernel/slab/vm_area_struct/sanity_checks | 1 + test/sys/kernel/slab/vm_area_struct/shrink | 0 test/sys/kernel/slab/vm_area_struct/slab_size | 1 + test/sys/kernel/slab/vm_area_struct/slabs | 1 + test/sys/kernel/slab/vm_area_struct/store_user | 1 + test/sys/kernel/slab/vm_area_struct/total_objects | 1 + test/sys/kernel/slab/vm_area_struct/trace | 1 + test/sys/kernel/slab/vm_area_struct/validate | 0 test/sys/kernel/slab/xfrm_dst_cache/aliases | 1 + test/sys/kernel/slab/xfrm_dst_cache/align | 1 + test/sys/kernel/slab/xfrm_dst_cache/alloc_calls | 1 + test/sys/kernel/slab/xfrm_dst_cache/cache_dma | 1 + test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs | 1 + test/sys/kernel/slab/xfrm_dst_cache/ctor | 0 test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu | 1 + test/sys/kernel/slab/xfrm_dst_cache/free_calls | 1 + test/sys/kernel/slab/xfrm_dst_cache/hwcache_align | 1 + test/sys/kernel/slab/xfrm_dst_cache/object_size | 1 + test/sys/kernel/slab/xfrm_dst_cache/objects | 1 + .../sys/kernel/slab/xfrm_dst_cache/objects_partial | 1 + test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab | 1 + test/sys/kernel/slab/xfrm_dst_cache/order | 1 + test/sys/kernel/slab/xfrm_dst_cache/partial | 1 + test/sys/kernel/slab/xfrm_dst_cache/poison | 1 + .../sys/kernel/slab/xfrm_dst_cache/reclaim_account | 1 + test/sys/kernel/slab/xfrm_dst_cache/red_zone | 1 + test/sys/kernel/slab/xfrm_dst_cache/sanity_checks | 1 + test/sys/kernel/slab/xfrm_dst_cache/shrink | 0 test/sys/kernel/slab/xfrm_dst_cache/slab_size | 1 + test/sys/kernel/slab/xfrm_dst_cache/slabs | 1 + test/sys/kernel/slab/xfrm_dst_cache/store_user | 1 + test/sys/kernel/slab/xfrm_dst_cache/total_objects | 1 + test/sys/kernel/slab/xfrm_dst_cache/trace | 1 + test/sys/kernel/slab/xfrm_dst_cache/validate | 0 test/sys/kernel/uevent_helper | 1 + test/sys/kernel/uevent_seqnum | 1 + test/sys/kernel/uids/0/cpu_share | 1 + test/sys/kernel/uids/100/cpu_share | 1 + test/sys/kernel/uids/103/cpu_share | 1 + test/sys/kernel/uids/105/cpu_share | 1 + test/sys/kernel/uids/2702/cpu_share | 1 + test/sys/kernel/uids/51/cpu_share | 1 + test/sys/kernel/vmcoreinfo | 1 + test/sys/module/8250/parameters/nr_uarts | 1 + test/sys/module/8250/parameters/share_irqs | 1 + test/sys/module/ac/initstate | 1 + test/sys/module/ac/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/ac/refcnt | 1 + test/sys/module/ac/sections/.bss | 1 + test/sys/module/ac/sections/.data | 1 + test/sys/module/ac/sections/.exit.text | 1 + .../module/ac/sections/.gnu.linkonce.this_module | 1 + test/sys/module/ac/sections/.init.text | 1 + test/sys/module/ac/sections/.note.gnu.build-id | 1 + test/sys/module/ac/sections/.rodata | 1 + test/sys/module/ac/sections/.rodata.str1.1 | 1 + test/sys/module/ac/sections/.strtab | 1 + test/sys/module/ac/sections/.symtab | 1 + test/sys/module/ac/sections/.text | 1 + test/sys/module/ac/srcversion | 1 + test/sys/module/acpi/parameters/acpica_version | 1 + test/sys/module/acpi_cpufreq/initstate | 1 + .../module/acpi_cpufreq/notes/.note.gnu.build-id | Bin 0 -> 36 bytes .../acpi_cpufreq/parameters/acpi_pstate_strict | 1 + test/sys/module/acpi_cpufreq/refcnt | 1 + test/sys/module/acpi_cpufreq/sections/.bss | 1 + test/sys/module/acpi_cpufreq/sections/.data | 1 + test/sys/module/acpi_cpufreq/sections/.exit.text | 1 + .../sections/.gnu.linkonce.this_module | 1 + test/sys/module/acpi_cpufreq/sections/.init.text | 1 + .../acpi_cpufreq/sections/.note.gnu.build-id | 1 + test/sys/module/acpi_cpufreq/sections/.rodata | 1 + .../module/acpi_cpufreq/sections/.rodata.str1.1 | 1 + test/sys/module/acpi_cpufreq/sections/.smp_locks | 1 + test/sys/module/acpi_cpufreq/sections/.strtab | 1 + test/sys/module/acpi_cpufreq/sections/.symtab | 1 + test/sys/module/acpi_cpufreq/sections/.text | 1 + test/sys/module/acpi_cpufreq/sections/__param | 1 + test/sys/module/acpi_cpufreq/srcversion | 1 + test/sys/module/aes_generic/holders/aes_x86_64 | 1 + test/sys/module/aes_generic/initstate | 1 + .../module/aes_generic/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/aes_generic/refcnt | 1 + test/sys/module/aes_generic/sections/.bss | 1 + test/sys/module/aes_generic/sections/.data | 1 + test/sys/module/aes_generic/sections/.exit.text | 1 + .../aes_generic/sections/.gnu.linkonce.this_module | 1 + test/sys/module/aes_generic/sections/.init.data | 1 + test/sys/module/aes_generic/sections/.init.text | 1 + .../module/aes_generic/sections/.note.gnu.build-id | 1 + test/sys/module/aes_generic/sections/.strtab | 1 + test/sys/module/aes_generic/sections/.symtab | 1 + test/sys/module/aes_generic/sections/.text | 1 + test/sys/module/aes_generic/sections/__kcrctab_gpl | 1 + test/sys/module/aes_generic/sections/__ksymtab_gpl | 1 + .../module/aes_generic/sections/__ksymtab_strings | 1 + test/sys/module/aes_generic/srcversion | 1 + test/sys/module/aes_x86_64/initstate | 1 + .../sys/module/aes_x86_64/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/aes_x86_64/refcnt | 1 + test/sys/module/aes_x86_64/sections/.bss | 1 + test/sys/module/aes_x86_64/sections/.data | 1 + test/sys/module/aes_x86_64/sections/.exit.text | 1 + .../aes_x86_64/sections/.gnu.linkonce.this_module | 1 + test/sys/module/aes_x86_64/sections/.init.text | 1 + .../module/aes_x86_64/sections/.note.gnu.build-id | 1 + test/sys/module/aes_x86_64/sections/.strtab | 1 + test/sys/module/aes_x86_64/sections/.symtab | 1 + test/sys/module/aes_x86_64/sections/.text | 1 + test/sys/module/aes_x86_64/srcversion | 1 + test/sys/module/ahci/drivers/pci:ahci | 1 + test/sys/module/ahci/parameters/ahci_em_messages | 1 + test/sys/module/ahci/parameters/marvell_enable | 1 + test/sys/module/ahci/parameters/skip_host_reset | 1 + test/sys/module/arc4/initstate | 1 + test/sys/module/arc4/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/arc4/refcnt | 1 + test/sys/module/arc4/sections/.bss | 1 + test/sys/module/arc4/sections/.data | 1 + test/sys/module/arc4/sections/.exit.text | 1 + .../module/arc4/sections/.gnu.linkonce.this_module | 1 + test/sys/module/arc4/sections/.init.text | 1 + test/sys/module/arc4/sections/.note.gnu.build-id | 1 + test/sys/module/arc4/sections/.strtab | 1 + test/sys/module/arc4/sections/.symtab | 1 + test/sys/module/arc4/sections/.text | 1 + test/sys/module/arc4/srcversion | 1 + test/sys/module/atkbd/drivers/serio:atkbd | 1 + test/sys/module/backlight/holders/thinkpad_acpi | 1 + test/sys/module/backlight/initstate | 1 + test/sys/module/backlight/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/backlight/refcnt | 1 + test/sys/module/backlight/sections/.bss | 1 + test/sys/module/backlight/sections/.data | 1 + test/sys/module/backlight/sections/.exit.text | 1 + .../backlight/sections/.gnu.linkonce.this_module | 1 + test/sys/module/backlight/sections/.init.text | 1 + .../module/backlight/sections/.note.gnu.build-id | 1 + test/sys/module/backlight/sections/.rodata.str1.1 | 1 + test/sys/module/backlight/sections/.strtab | 1 + test/sys/module/backlight/sections/.symtab | 1 + test/sys/module/backlight/sections/.text | 1 + test/sys/module/backlight/sections/__kcrctab | 1 + test/sys/module/backlight/sections/__ksymtab | 1 + .../module/backlight/sections/__ksymtab_strings | 1 + test/sys/module/backlight/srcversion | 1 + test/sys/module/battery/initstate | 1 + test/sys/module/battery/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/battery/parameters/cache_time | 1 + test/sys/module/battery/refcnt | 1 + test/sys/module/battery/sections/.bss | 1 + test/sys/module/battery/sections/.data | 1 + test/sys/module/battery/sections/.exit.text | 1 + .../battery/sections/.gnu.linkonce.this_module | 1 + test/sys/module/battery/sections/.init.text | 1 + .../sys/module/battery/sections/.note.gnu.build-id | 1 + test/sys/module/battery/sections/.rodata | 1 + test/sys/module/battery/sections/.rodata.str1.1 | 1 + test/sys/module/battery/sections/.strtab | 1 + test/sys/module/battery/sections/.symtab | 1 + test/sys/module/battery/sections/.text | 1 + test/sys/module/battery/sections/__param | 1 + test/sys/module/battery/srcversion | 1 + test/sys/module/button/initstate | 1 + test/sys/module/button/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/button/refcnt | 1 + test/sys/module/button/sections/.bss | 1 + test/sys/module/button/sections/.data | 1 + test/sys/module/button/sections/.exit.text | 1 + .../button/sections/.gnu.linkonce.this_module | 1 + test/sys/module/button/sections/.init.text | 1 + test/sys/module/button/sections/.note.gnu.build-id | 1 + test/sys/module/button/sections/.rodata | 1 + test/sys/module/button/sections/.rodata.str1.1 | 1 + test/sys/module/button/sections/.smp_locks | 1 + test/sys/module/button/sections/.strtab | 1 + test/sys/module/button/sections/.symtab | 1 + test/sys/module/button/sections/.text | 1 + test/sys/module/button/srcversion | 1 + test/sys/module/cdc_acm/drivers/usb:cdc_acm | 1 + test/sys/module/cdc_acm/initstate | 1 + test/sys/module/cdc_acm/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/cdc_acm/refcnt | 1 + test/sys/module/cdc_acm/sections/.bss | 1 + test/sys/module/cdc_acm/sections/.data | 1 + test/sys/module/cdc_acm/sections/.exit.text | 1 + .../cdc_acm/sections/.gnu.linkonce.this_module | 1 + test/sys/module/cdc_acm/sections/.init.text | 1 + .../sys/module/cdc_acm/sections/.note.gnu.build-id | 1 + test/sys/module/cdc_acm/sections/.rodata | 1 + test/sys/module/cdc_acm/sections/.rodata.str1.1 | 1 + test/sys/module/cdc_acm/sections/.smp_locks | 1 + test/sys/module/cdc_acm/sections/.strtab | 1 + test/sys/module/cdc_acm/sections/.symtab | 1 + test/sys/module/cdc_acm/sections/.text | 1 + test/sys/module/cdc_acm/srcversion | 1 + test/sys/module/cdrom/holders/sr_mod | 1 + test/sys/module/cdrom/initstate | 1 + test/sys/module/cdrom/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/cdrom/refcnt | 1 + test/sys/module/cdrom/sections/.bss | 1 + test/sys/module/cdrom/sections/.data | 1 + test/sys/module/cdrom/sections/.exit.text | 1 + .../cdrom/sections/.gnu.linkonce.this_module | 1 + test/sys/module/cdrom/sections/.init.text | 1 + test/sys/module/cdrom/sections/.note.gnu.build-id | 1 + test/sys/module/cdrom/sections/.rodata | 1 + test/sys/module/cdrom/sections/.rodata.str1.1 | 1 + test/sys/module/cdrom/sections/.strtab | 1 + test/sys/module/cdrom/sections/.symtab | 1 + test/sys/module/cdrom/sections/.text | 1 + test/sys/module/cdrom/sections/__kcrctab | 1 + test/sys/module/cdrom/sections/__ksymtab | 1 + test/sys/module/cdrom/sections/__ksymtab_strings | 1 + test/sys/module/cdrom/sections/__param | 1 + test/sys/module/cdrom/srcversion | 1 + test/sys/module/cfg80211/holders/iwl3945 | 1 + test/sys/module/cfg80211/holders/mac80211 | 1 + test/sys/module/cfg80211/initstate | 1 + test/sys/module/cfg80211/notes/.note.gnu.build-id | Bin 0 -> 36 bytes .../module/cfg80211/parameters/ieee80211_regdom | 1 + test/sys/module/cfg80211/refcnt | 1 + test/sys/module/cfg80211/sections/.bss | 1 + test/sys/module/cfg80211/sections/.data | 1 + .../sys/module/cfg80211/sections/.data.read_mostly | 1 + .../cfg80211/sections/.gnu.linkonce.this_module | 1 + .../module/cfg80211/sections/.note.gnu.build-id | 1 + test/sys/module/cfg80211/sections/.rodata | 1 + test/sys/module/cfg80211/sections/.rodata.str1.1 | 1 + test/sys/module/cfg80211/sections/.smp_locks | 1 + test/sys/module/cfg80211/sections/.strtab | 1 + test/sys/module/cfg80211/sections/.symtab | 1 + test/sys/module/cfg80211/sections/.text | 1 + test/sys/module/cfg80211/sections/__bug_table | 1 + test/sys/module/cfg80211/sections/__kcrctab | 1 + test/sys/module/cfg80211/sections/__ksymtab | 1 + .../sys/module/cfg80211/sections/__ksymtab_strings | 1 + test/sys/module/cfg80211/sections/__param | 1 + test/sys/module/cfg80211/srcversion | 1 + test/sys/module/crypto_blkcipher/holders/ecb | 1 + test/sys/module/crypto_blkcipher/initstate | 1 + .../crypto_blkcipher/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/crypto_blkcipher/refcnt | 1 + test/sys/module/crypto_blkcipher/sections/.bss | 1 + test/sys/module/crypto_blkcipher/sections/.data | 1 + .../module/crypto_blkcipher/sections/.exit.text | 1 + .../sections/.gnu.linkonce.this_module | 1 + .../module/crypto_blkcipher/sections/.init.text | 1 + .../crypto_blkcipher/sections/.note.gnu.build-id | 1 + test/sys/module/crypto_blkcipher/sections/.rodata | 1 + .../crypto_blkcipher/sections/.rodata.str1.1 | 1 + .../module/crypto_blkcipher/sections/.smp_locks | 1 + test/sys/module/crypto_blkcipher/sections/.strtab | 1 + test/sys/module/crypto_blkcipher/sections/.symtab | 1 + test/sys/module/crypto_blkcipher/sections/.text | 1 + .../module/crypto_blkcipher/sections/__bug_table | 1 + .../module/crypto_blkcipher/sections/__kcrctab_gpl | 1 + .../module/crypto_blkcipher/sections/__ksymtab_gpl | 1 + .../crypto_blkcipher/sections/__ksymtab_strings | 1 + test/sys/module/crypto_blkcipher/srcversion | 1 + test/sys/module/dm_mod/initstate | 1 + test/sys/module/dm_mod/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/dm_mod/refcnt | 1 + test/sys/module/dm_mod/sections/.bss | 1 + test/sys/module/dm_mod/sections/.data | 1 + test/sys/module/dm_mod/sections/.exit.text | 1 + .../dm_mod/sections/.gnu.linkonce.this_module | 1 + test/sys/module/dm_mod/sections/.init.data | 1 + test/sys/module/dm_mod/sections/.init.text | 1 + test/sys/module/dm_mod/sections/.note.gnu.build-id | 1 + test/sys/module/dm_mod/sections/.rodata | 1 + test/sys/module/dm_mod/sections/.rodata.str1.1 | 1 + test/sys/module/dm_mod/sections/.smp_locks | 1 + test/sys/module/dm_mod/sections/.strtab | 1 + test/sys/module/dm_mod/sections/.symtab | 1 + test/sys/module/dm_mod/sections/.text | 1 + test/sys/module/dm_mod/sections/__bug_table | 1 + test/sys/module/dm_mod/sections/__kcrctab | 1 + test/sys/module/dm_mod/sections/__kcrctab_gpl | 1 + test/sys/module/dm_mod/sections/__ksymtab | 1 + test/sys/module/dm_mod/sections/__ksymtab_gpl | 1 + test/sys/module/dm_mod/sections/__ksymtab_strings | 1 + test/sys/module/dm_mod/sections/__param | 1 + test/sys/module/dm_mod/srcversion | 1 + test/sys/module/dock/parameters/immediate_undock | 1 + test/sys/module/e1000e/drivers/pci:e1000e | 1 + test/sys/module/e1000e/initstate | 1 + test/sys/module/e1000e/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/e1000e/parameters/copybreak | 1 + test/sys/module/e1000e/refcnt | 1 + test/sys/module/e1000e/sections/.bss | 1 + test/sys/module/e1000e/sections/.data | 1 + test/sys/module/e1000e/sections/.devexit.text | 1 + test/sys/module/e1000e/sections/.devinit.data | 1 + test/sys/module/e1000e/sections/.devinit.text | 1 + test/sys/module/e1000e/sections/.exit.text | 1 + .../e1000e/sections/.gnu.linkonce.this_module | 1 + test/sys/module/e1000e/sections/.init.text | 1 + test/sys/module/e1000e/sections/.note.gnu.build-id | 1 + test/sys/module/e1000e/sections/.rodata | 1 + test/sys/module/e1000e/sections/.rodata.str1.1 | 1 + test/sys/module/e1000e/sections/.smp_locks | 1 + test/sys/module/e1000e/sections/.strtab | 1 + test/sys/module/e1000e/sections/.symtab | 1 + test/sys/module/e1000e/sections/.text | 1 + test/sys/module/e1000e/sections/__bug_table | 1 + test/sys/module/e1000e/sections/__param | 1 + test/sys/module/e1000e/srcversion | 1 + test/sys/module/e1000e/version | 1 + test/sys/module/ecb/initstate | 1 + test/sys/module/ecb/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/ecb/refcnt | 1 + test/sys/module/ecb/sections/.bss | 1 + test/sys/module/ecb/sections/.data | 1 + test/sys/module/ecb/sections/.exit.text | 1 + .../module/ecb/sections/.gnu.linkonce.this_module | 1 + test/sys/module/ecb/sections/.init.text | 1 + test/sys/module/ecb/sections/.note.gnu.build-id | 1 + test/sys/module/ecb/sections/.rodata.str1.1 | 1 + test/sys/module/ecb/sections/.strtab | 1 + test/sys/module/ecb/sections/.symtab | 1 + test/sys/module/ecb/sections/.text | 1 + test/sys/module/ecb/srcversion | 1 + test/sys/module/edd/initstate | 1 + test/sys/module/edd/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/edd/refcnt | 1 + test/sys/module/edd/sections/.bss | 1 + test/sys/module/edd/sections/.data | 1 + test/sys/module/edd/sections/.exit.text | 1 + .../module/edd/sections/.gnu.linkonce.this_module | 1 + test/sys/module/edd/sections/.init.text | 1 + test/sys/module/edd/sections/.note.gnu.build-id | 1 + test/sys/module/edd/sections/.rodata | 1 + test/sys/module/edd/sections/.rodata.str1.1 | 1 + test/sys/module/edd/sections/.strtab | 1 + test/sys/module/edd/sections/.symtab | 1 + test/sys/module/edd/sections/.text | 1 + test/sys/module/edd/srcversion | 1 + test/sys/module/edd/version | 1 + test/sys/module/ehci_hcd/drivers/pci:ehci_hcd | 1 + test/sys/module/ehci_hcd/initstate | 1 + test/sys/module/ehci_hcd/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/ehci_hcd/parameters/ignore_oc | 1 + .../sys/module/ehci_hcd/parameters/log2_irq_thresh | 1 + test/sys/module/ehci_hcd/parameters/park | 1 + test/sys/module/ehci_hcd/refcnt | 1 + test/sys/module/ehci_hcd/sections/.bss | 1 + test/sys/module/ehci_hcd/sections/.data | 1 + test/sys/module/ehci_hcd/sections/.exit.text | 1 + .../ehci_hcd/sections/.gnu.linkonce.this_module | 1 + test/sys/module/ehci_hcd/sections/.init.text | 1 + .../module/ehci_hcd/sections/.note.gnu.build-id | 1 + test/sys/module/ehci_hcd/sections/.rodata | 1 + test/sys/module/ehci_hcd/sections/.rodata.str1.1 | 1 + test/sys/module/ehci_hcd/sections/.smp_locks | 1 + test/sys/module/ehci_hcd/sections/.strtab | 1 + test/sys/module/ehci_hcd/sections/.symtab | 1 + test/sys/module/ehci_hcd/sections/.text | 1 + test/sys/module/ehci_hcd/sections/__bug_table | 1 + test/sys/module/ehci_hcd/sections/__param | 1 + test/sys/module/ehci_hcd/srcversion | 1 + test/sys/module/evdev/initstate | 1 + test/sys/module/evdev/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/evdev/refcnt | 1 + test/sys/module/evdev/sections/.bss | 1 + test/sys/module/evdev/sections/.data | 1 + test/sys/module/evdev/sections/.exit.text | 1 + .../evdev/sections/.gnu.linkonce.this_module | 1 + test/sys/module/evdev/sections/.init.text | 1 + test/sys/module/evdev/sections/.note.gnu.build-id | 1 + test/sys/module/evdev/sections/.rodata | 1 + test/sys/module/evdev/sections/.rodata.str1.1 | 1 + test/sys/module/evdev/sections/.strtab | 1 + test/sys/module/evdev/sections/.symtab | 1 + test/sys/module/evdev/sections/.text | 1 + test/sys/module/evdev/srcversion | 1 + test/sys/module/fuse/initstate | 1 + test/sys/module/fuse/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/fuse/refcnt | 1 + test/sys/module/fuse/sections/.bss | 1 + test/sys/module/fuse/sections/.data | 1 + test/sys/module/fuse/sections/.exit.text | 1 + .../module/fuse/sections/.gnu.linkonce.this_module | 1 + test/sys/module/fuse/sections/.init.text | 1 + test/sys/module/fuse/sections/.note.gnu.build-id | 1 + test/sys/module/fuse/sections/.rodata | 1 + test/sys/module/fuse/sections/.rodata.str1.1 | 1 + test/sys/module/fuse/sections/.smp_locks | 1 + test/sys/module/fuse/sections/.strtab | 1 + test/sys/module/fuse/sections/.symtab | 1 + test/sys/module/fuse/sections/.text | 1 + test/sys/module/fuse/sections/__bug_table | 1 + test/sys/module/fuse/srcversion | 1 + test/sys/module/hid/parameters/pb_fnmode | 1 + test/sys/module/hwmon/holders/thinkpad_acpi | 1 + test/sys/module/hwmon/initstate | 1 + test/sys/module/hwmon/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/hwmon/refcnt | 1 + test/sys/module/hwmon/sections/.bss | 1 + test/sys/module/hwmon/sections/.data | 1 + test/sys/module/hwmon/sections/.exit.text | 1 + .../hwmon/sections/.gnu.linkonce.this_module | 1 + test/sys/module/hwmon/sections/.init.text | 1 + test/sys/module/hwmon/sections/.note.gnu.build-id | 1 + test/sys/module/hwmon/sections/.rodata.str1.1 | 1 + test/sys/module/hwmon/sections/.strtab | 1 + test/sys/module/hwmon/sections/.symtab | 1 + test/sys/module/hwmon/sections/.text | 1 + test/sys/module/hwmon/sections/__kcrctab_gpl | 1 + test/sys/module/hwmon/sections/__ksymtab_gpl | 1 + test/sys/module/hwmon/sections/__ksymtab_strings | 1 + test/sys/module/hwmon/srcversion | 1 + test/sys/module/i8042/parameters/debug | 1 + test/sys/module/i8042/parameters/panicblink | 1 + .../sys/module/intel_agp/drivers/pci:agpgart-intel | 1 + test/sys/module/intel_agp/initstate | 1 + test/sys/module/intel_agp/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/intel_agp/refcnt | 1 + test/sys/module/intel_agp/sections/.bss | 1 + test/sys/module/intel_agp/sections/.data | 1 + test/sys/module/intel_agp/sections/.devexit.text | 1 + test/sys/module/intel_agp/sections/.devinit.text | 1 + test/sys/module/intel_agp/sections/.exit.text | 1 + .../intel_agp/sections/.gnu.linkonce.this_module | 1 + test/sys/module/intel_agp/sections/.init.text | 1 + .../module/intel_agp/sections/.note.gnu.build-id | 1 + test/sys/module/intel_agp/sections/.rodata | 1 + test/sys/module/intel_agp/sections/.rodata.str1.1 | 1 + test/sys/module/intel_agp/sections/.smp_locks | 1 + test/sys/module/intel_agp/sections/.strtab | 1 + test/sys/module/intel_agp/sections/.symtab | 1 + test/sys/module/intel_agp/sections/.text | 1 + test/sys/module/intel_agp/srcversion | 1 + test/sys/module/ipv6/initstate | 1 + test/sys/module/ipv6/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/ipv6/refcnt | 1 + test/sys/module/ipv6/sections/.bss | 1 + test/sys/module/ipv6/sections/.data | 1 + test/sys/module/ipv6/sections/.data.read_mostly | 1 + test/sys/module/ipv6/sections/.exit.text | 1 + .../module/ipv6/sections/.gnu.linkonce.this_module | 1 + test/sys/module/ipv6/sections/.init.data | 1 + test/sys/module/ipv6/sections/.init.text | 1 + test/sys/module/ipv6/sections/.note.gnu.build-id | 1 + test/sys/module/ipv6/sections/.ref.text | 1 + test/sys/module/ipv6/sections/.rodata | 1 + test/sys/module/ipv6/sections/.rodata.str1.1 | 1 + test/sys/module/ipv6/sections/.smp_locks | 1 + test/sys/module/ipv6/sections/.strtab | 1 + test/sys/module/ipv6/sections/.symtab | 1 + test/sys/module/ipv6/sections/.text | 1 + test/sys/module/ipv6/sections/__bug_table | 1 + test/sys/module/ipv6/sections/__kcrctab | 1 + test/sys/module/ipv6/sections/__kcrctab_gpl | 1 + test/sys/module/ipv6/sections/__ksymtab | 1 + test/sys/module/ipv6/sections/__ksymtab_gpl | 1 + test/sys/module/ipv6/sections/__ksymtab_strings | 1 + test/sys/module/ipv6/srcversion | 1 + test/sys/module/iwl3945/drivers/pci:iwl3945 | 1 + test/sys/module/iwl3945/initstate | 1 + test/sys/module/iwl3945/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/iwl3945/parameters/antenna | 1 + test/sys/module/iwl3945/parameters/debug | 1 + test/sys/module/iwl3945/parameters/disable | 1 + test/sys/module/iwl3945/parameters/disable_hw_scan | 1 + test/sys/module/iwl3945/parameters/hwcrypto | 1 + test/sys/module/iwl3945/parameters/qos_enable | 1 + test/sys/module/iwl3945/parameters/queues_num | 1 + test/sys/module/iwl3945/refcnt | 1 + test/sys/module/iwl3945/sections/.bss | 1 + test/sys/module/iwl3945/sections/.data | 1 + test/sys/module/iwl3945/sections/.devexit.text | 1 + test/sys/module/iwl3945/sections/.exit.text | 1 + .../iwl3945/sections/.gnu.linkonce.this_module | 1 + test/sys/module/iwl3945/sections/.init.text | 1 + .../sys/module/iwl3945/sections/.note.gnu.build-id | 1 + test/sys/module/iwl3945/sections/.rodata | 1 + test/sys/module/iwl3945/sections/.rodata.str1.1 | 1 + test/sys/module/iwl3945/sections/.smp_locks | 1 + test/sys/module/iwl3945/sections/.strtab | 1 + test/sys/module/iwl3945/sections/.symtab | 1 + test/sys/module/iwl3945/sections/.text | 1 + test/sys/module/iwl3945/sections/__bug_table | 1 + test/sys/module/iwl3945/sections/__param | 1 + test/sys/module/iwl3945/srcversion | 1 + test/sys/module/iwl3945/version | 1 + test/sys/module/keyboard/parameters/brl_nbchords | 1 + test/sys/module/keyboard/parameters/brl_timeout | 1 + test/sys/module/led_class/holders/iwl3945 | 1 + test/sys/module/led_class/holders/thinkpad_acpi | 1 + test/sys/module/led_class/initstate | 1 + test/sys/module/led_class/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/led_class/refcnt | 1 + test/sys/module/led_class/sections/.bss | 1 + test/sys/module/led_class/sections/.data | 1 + test/sys/module/led_class/sections/.exit.text | 1 + .../led_class/sections/.gnu.linkonce.this_module | 1 + test/sys/module/led_class/sections/.init.text | 1 + .../module/led_class/sections/.note.gnu.build-id | 1 + test/sys/module/led_class/sections/.rodata.str1.1 | 1 + test/sys/module/led_class/sections/.strtab | 1 + test/sys/module/led_class/sections/.symtab | 1 + test/sys/module/led_class/sections/.text | 1 + test/sys/module/led_class/sections/__kcrctab_gpl | 1 + test/sys/module/led_class/sections/__ksymtab_gpl | 1 + .../module/led_class/sections/__ksymtab_strings | 1 + test/sys/module/led_class/srcversion | 1 + test/sys/module/libata/parameters/acpi_gtf_filter | 1 + test/sys/module/libata/parameters/allow_tpm | 1 + .../sys/module/libata/parameters/ata_probe_timeout | 1 + test/sys/module/libata/parameters/atapi_dmadir | 1 + test/sys/module/libata/parameters/atapi_enabled | 1 + test/sys/module/libata/parameters/atapi_passthru16 | 1 + test/sys/module/libata/parameters/dma | 1 + test/sys/module/libata/parameters/fua | 1 + test/sys/module/libata/parameters/ignore_hpa | 1 + test/sys/module/libata/parameters/noacpi | 1 + test/sys/module/lockdep/parameters/lock_stat | 1 + test/sys/module/loop/initstate | 1 + test/sys/module/loop/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/loop/refcnt | 1 + test/sys/module/loop/sections/.bss | 1 + test/sys/module/loop/sections/.data | 1 + test/sys/module/loop/sections/.exit.text | 1 + .../module/loop/sections/.gnu.linkonce.this_module | 1 + test/sys/module/loop/sections/.init.text | 1 + test/sys/module/loop/sections/.note.gnu.build-id | 1 + test/sys/module/loop/sections/.rodata | 1 + test/sys/module/loop/sections/.rodata.str1.1 | 1 + test/sys/module/loop/sections/.strtab | 1 + test/sys/module/loop/sections/.symtab | 1 + test/sys/module/loop/sections/.text | 1 + test/sys/module/loop/sections/__bug_table | 1 + test/sys/module/loop/sections/__kcrctab | 1 + test/sys/module/loop/sections/__ksymtab | 1 + test/sys/module/loop/sections/__ksymtab_strings | 1 + test/sys/module/loop/sections/__param | 1 + test/sys/module/loop/srcversion | 1 + test/sys/module/mac80211/holders/iwl3945 | 1 + test/sys/module/mac80211/initstate | 1 + test/sys/module/mac80211/notes/.note.gnu.build-id | Bin 0 -> 36 bytes .../mac80211/parameters/ieee80211_default_rc_algo | 1 + test/sys/module/mac80211/refcnt | 1 + test/sys/module/mac80211/sections/.bss | 1 + test/sys/module/mac80211/sections/.data | 1 + test/sys/module/mac80211/sections/.exit.text | 1 + .../mac80211/sections/.gnu.linkonce.this_module | 1 + test/sys/module/mac80211/sections/.init.text | 1 + .../module/mac80211/sections/.note.gnu.build-id | 1 + test/sys/module/mac80211/sections/.rodata | 1 + test/sys/module/mac80211/sections/.rodata.str1.1 | 1 + test/sys/module/mac80211/sections/.smp_locks | 1 + test/sys/module/mac80211/sections/.strtab | 1 + test/sys/module/mac80211/sections/.symtab | 1 + test/sys/module/mac80211/sections/.text | 1 + test/sys/module/mac80211/sections/__bug_table | 1 + test/sys/module/mac80211/sections/__kcrctab | 1 + test/sys/module/mac80211/sections/__kcrctab_gpl | 1 + test/sys/module/mac80211/sections/__ksymtab | 1 + test/sys/module/mac80211/sections/__ksymtab_gpl | 1 + .../sys/module/mac80211/sections/__ksymtab_strings | 1 + test/sys/module/mac80211/sections/__param | 1 + test/sys/module/mac80211/srcversion | 1 + test/sys/module/md_mod/holders/raid1 | 1 + test/sys/module/md_mod/initstate | 1 + test/sys/module/md_mod/notes/.note.gnu.build-id | Bin 0 -> 36 bytes .../module/md_mod/parameters/start_dirty_degraded | 1 + test/sys/module/md_mod/parameters/start_ro | 1 + test/sys/module/md_mod/refcnt | 1 + test/sys/module/md_mod/sections/.bss | 1 + test/sys/module/md_mod/sections/.data | 1 + test/sys/module/md_mod/sections/.exit.text | 1 + .../md_mod/sections/.gnu.linkonce.this_module | 1 + test/sys/module/md_mod/sections/.init.text | 1 + test/sys/module/md_mod/sections/.note.gnu.build-id | 1 + test/sys/module/md_mod/sections/.rodata | 1 + test/sys/module/md_mod/sections/.rodata.str1.1 | 1 + test/sys/module/md_mod/sections/.smp_locks | 1 + test/sys/module/md_mod/sections/.strtab | 1 + test/sys/module/md_mod/sections/.symtab | 1 + test/sys/module/md_mod/sections/.text | 1 + test/sys/module/md_mod/sections/__bug_table | 1 + test/sys/module/md_mod/sections/__kcrctab | 1 + test/sys/module/md_mod/sections/__kcrctab_gpl | 1 + test/sys/module/md_mod/sections/__ksymtab | 1 + test/sys/module/md_mod/sections/__ksymtab_gpl | 1 + test/sys/module/md_mod/sections/__ksymtab_strings | 1 + test/sys/module/md_mod/sections/__param | 1 + test/sys/module/md_mod/srcversion | 1 + test/sys/module/microcode/initstate | 1 + test/sys/module/microcode/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/microcode/refcnt | 1 + test/sys/module/microcode/sections/.bss | 1 + test/sys/module/microcode/sections/.cpuinit.text | 1 + test/sys/module/microcode/sections/.data | 1 + test/sys/module/microcode/sections/.exit.text | 1 + .../microcode/sections/.gnu.linkonce.this_module | 1 + test/sys/module/microcode/sections/.init.text | 1 + .../module/microcode/sections/.note.gnu.build-id | 1 + test/sys/module/microcode/sections/.ref.data | 1 + test/sys/module/microcode/sections/.rodata | 1 + test/sys/module/microcode/sections/.rodata.str1.1 | 1 + test/sys/module/microcode/sections/.strtab | 1 + test/sys/module/microcode/sections/.symtab | 1 + test/sys/module/microcode/sections/.text | 1 + test/sys/module/microcode/sections/__bug_table | 1 + test/sys/module/microcode/srcversion | 1 + test/sys/module/mousedev/parameters/tap_time | 1 + test/sys/module/mousedev/parameters/xres | 1 + test/sys/module/mousedev/parameters/yres | 1 + test/sys/module/nvram/holders/thinkpad_acpi | 1 + test/sys/module/nvram/initstate | 1 + test/sys/module/nvram/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/nvram/refcnt | 1 + test/sys/module/nvram/sections/.bss | 1 + test/sys/module/nvram/sections/.data | 1 + test/sys/module/nvram/sections/.exit.text | 1 + .../nvram/sections/.gnu.linkonce.this_module | 1 + test/sys/module/nvram/sections/.init.text | 1 + test/sys/module/nvram/sections/.note.gnu.build-id | 1 + test/sys/module/nvram/sections/.rodata | 1 + test/sys/module/nvram/sections/.rodata.str1.1 | 1 + test/sys/module/nvram/sections/.strtab | 1 + test/sys/module/nvram/sections/.symtab | 1 + test/sys/module/nvram/sections/.text | 1 + test/sys/module/nvram/sections/__kcrctab | 1 + test/sys/module/nvram/sections/__ksymtab | 1 + test/sys/module/nvram/sections/__ksymtab_strings | 1 + test/sys/module/nvram/srcversion | 1 + test/sys/module/oprofile/parameters/timer | 1 + test/sys/module/pcie_aspm/parameters/policy | 1 + test/sys/module/pcmcia/initstate | 1 + test/sys/module/pcmcia/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/pcmcia/parameters/io_speed | 1 + test/sys/module/pcmcia/refcnt | 1 + test/sys/module/pcmcia/sections/.bss | 1 + test/sys/module/pcmcia/sections/.data | 1 + test/sys/module/pcmcia/sections/.devinit.text | 1 + test/sys/module/pcmcia/sections/.exit.text | 1 + .../pcmcia/sections/.gnu.linkonce.this_module | 1 + test/sys/module/pcmcia/sections/.init.text | 1 + test/sys/module/pcmcia/sections/.note.gnu.build-id | 1 + test/sys/module/pcmcia/sections/.ref.data | 1 + test/sys/module/pcmcia/sections/.rodata | 1 + test/sys/module/pcmcia/sections/.rodata.str1.1 | 1 + test/sys/module/pcmcia/sections/.strtab | 1 + test/sys/module/pcmcia/sections/.symtab | 1 + test/sys/module/pcmcia/sections/.text | 1 + test/sys/module/pcmcia/sections/__kcrctab | 1 + test/sys/module/pcmcia/sections/__ksymtab | 1 + test/sys/module/pcmcia/sections/__ksymtab_strings | 1 + test/sys/module/pcmcia/sections/__param | 1 + test/sys/module/pcmcia/srcversion | 1 + test/sys/module/pcmcia_core/holders/pcmcia | 1 + test/sys/module/pcmcia_core/holders/rsrc_nonstatic | 1 + test/sys/module/pcmcia_core/holders/yenta_socket | 1 + test/sys/module/pcmcia_core/initstate | 1 + .../module/pcmcia_core/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/pcmcia_core/parameters/cis_speed | 1 + test/sys/module/pcmcia_core/parameters/cis_width | 1 + test/sys/module/pcmcia_core/parameters/reset_time | 1 + .../sys/module/pcmcia_core/parameters/resume_delay | 1 + test/sys/module/pcmcia_core/parameters/setup_delay | 1 + .../module/pcmcia_core/parameters/shutdown_delay | 1 + .../module/pcmcia_core/parameters/unreset_check | 1 + .../module/pcmcia_core/parameters/unreset_delay | 1 + .../module/pcmcia_core/parameters/unreset_limit | 1 + test/sys/module/pcmcia_core/parameters/vcc_settle | 1 + test/sys/module/pcmcia_core/refcnt | 1 + test/sys/module/pcmcia_core/sections/.bss | 1 + test/sys/module/pcmcia_core/sections/.data | 1 + test/sys/module/pcmcia_core/sections/.exit.text | 1 + .../pcmcia_core/sections/.gnu.linkonce.this_module | 1 + test/sys/module/pcmcia_core/sections/.init.text | 1 + .../module/pcmcia_core/sections/.note.gnu.build-id | 1 + test/sys/module/pcmcia_core/sections/.ref.text | 1 + test/sys/module/pcmcia_core/sections/.rodata | 1 + .../sys/module/pcmcia_core/sections/.rodata.str1.1 | 1 + test/sys/module/pcmcia_core/sections/.strtab | 1 + test/sys/module/pcmcia_core/sections/.symtab | 1 + test/sys/module/pcmcia_core/sections/.text | 1 + test/sys/module/pcmcia_core/sections/__kcrctab | 1 + test/sys/module/pcmcia_core/sections/__ksymtab | 1 + .../module/pcmcia_core/sections/__ksymtab_strings | 1 + test/sys/module/pcmcia_core/sections/__param | 1 + test/sys/module/pcmcia_core/srcversion | 1 + test/sys/module/pcspkr/drivers/platform:pcspkr | 1 + test/sys/module/pcspkr/initstate | 1 + test/sys/module/pcspkr/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/pcspkr/refcnt | 1 + test/sys/module/pcspkr/sections/.bss | 1 + test/sys/module/pcspkr/sections/.data | 1 + test/sys/module/pcspkr/sections/.devexit.text | 1 + test/sys/module/pcspkr/sections/.devinit.text | 1 + test/sys/module/pcspkr/sections/.exit.text | 1 + .../pcspkr/sections/.gnu.linkonce.this_module | 1 + test/sys/module/pcspkr/sections/.init.text | 1 + test/sys/module/pcspkr/sections/.note.gnu.build-id | 1 + test/sys/module/pcspkr/sections/.rodata.str1.1 | 1 + test/sys/module/pcspkr/sections/.strtab | 1 + test/sys/module/pcspkr/sections/.symtab | 1 + test/sys/module/pcspkr/sections/.text | 1 + test/sys/module/pcspkr/srcversion | 1 + test/sys/module/printk/parameters/time | 1 + test/sys/module/processor/holders/acpi_cpufreq | 1 + test/sys/module/processor/holders/thermal | 1 + test/sys/module/processor/initstate | 1 + test/sys/module/processor/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/processor/parameters/ignore_ppc | 1 + .../sys/module/processor/parameters/latency_factor | 1 + test/sys/module/processor/refcnt | 1 + test/sys/module/processor/sections/.bss | 1 + test/sys/module/processor/sections/.cpuinit.data | 1 + test/sys/module/processor/sections/.cpuinit.text | 1 + test/sys/module/processor/sections/.data | 1 + .../module/processor/sections/.data.read_mostly | 1 + test/sys/module/processor/sections/.exit.text | 1 + test/sys/module/processor/sections/.fixup | 1 + .../processor/sections/.gnu.linkonce.this_module | 1 + test/sys/module/processor/sections/.init.text | 1 + .../module/processor/sections/.note.gnu.build-id | 1 + test/sys/module/processor/sections/.ref.text | 1 + test/sys/module/processor/sections/.rodata | 1 + test/sys/module/processor/sections/.rodata.str1.1 | 1 + test/sys/module/processor/sections/.smp_locks | 1 + test/sys/module/processor/sections/.strtab | 1 + test/sys/module/processor/sections/.symtab | 1 + test/sys/module/processor/sections/.text | 1 + test/sys/module/processor/sections/__bug_table | 1 + test/sys/module/processor/sections/__ex_table | 1 + test/sys/module/processor/sections/__kcrctab | 1 + test/sys/module/processor/sections/__ksymtab | 1 + .../module/processor/sections/__ksymtab_strings | 1 + test/sys/module/processor/sections/__param | 1 + test/sys/module/processor/srcversion | 1 + test/sys/module/psmouse/drivers/serio:psmouse | 1 + test/sys/module/psmouse/parameters/proto | 2 + test/sys/module/psmouse/parameters/rate | 1 + test/sys/module/psmouse/parameters/resetafter | 1 + test/sys/module/psmouse/parameters/resolution | 1 + test/sys/module/psmouse/parameters/resync_time | 1 + test/sys/module/psmouse/parameters/smartscroll | 1 + test/sys/module/raid1/initstate | 1 + test/sys/module/raid1/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/raid1/refcnt | 1 + test/sys/module/raid1/sections/.bss | 1 + test/sys/module/raid1/sections/.data | 1 + .../raid1/sections/.gnu.linkonce.this_module | 1 + test/sys/module/raid1/sections/.init.text | 1 + test/sys/module/raid1/sections/.note.gnu.build-id | 1 + test/sys/module/raid1/sections/.rodata.str1.1 | 1 + test/sys/module/raid1/sections/.smp_locks | 1 + test/sys/module/raid1/sections/.strtab | 1 + test/sys/module/raid1/sections/.symtab | 1 + test/sys/module/raid1/sections/.text | 1 + test/sys/module/raid1/sections/__bug_table | 1 + test/sys/module/raid1/srcversion | 1 + test/sys/module/rfkill/holders/thinkpad_acpi | 1 + test/sys/module/rfkill/initstate | 1 + test/sys/module/rfkill/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/rfkill/parameters/default_state | 1 + test/sys/module/rfkill/refcnt | 1 + test/sys/module/rfkill/sections/.bss | 1 + test/sys/module/rfkill/sections/.data | 1 + test/sys/module/rfkill/sections/.exit.text | 1 + .../rfkill/sections/.gnu.linkonce.this_module | 1 + test/sys/module/rfkill/sections/.init.text | 1 + test/sys/module/rfkill/sections/.note.gnu.build-id | 1 + test/sys/module/rfkill/sections/.rodata | 1 + test/sys/module/rfkill/sections/.rodata.str1.1 | 1 + test/sys/module/rfkill/sections/.smp_locks | 1 + test/sys/module/rfkill/sections/.strtab | 1 + test/sys/module/rfkill/sections/.symtab | 1 + test/sys/module/rfkill/sections/.text | 1 + test/sys/module/rfkill/sections/__bug_table | 1 + test/sys/module/rfkill/sections/__kcrctab | 1 + test/sys/module/rfkill/sections/__kcrctab_gpl | 1 + test/sys/module/rfkill/sections/__ksymtab | 1 + test/sys/module/rfkill/sections/__ksymtab_gpl | 1 + test/sys/module/rfkill/sections/__ksymtab_strings | 1 + test/sys/module/rfkill/sections/__param | 1 + test/sys/module/rfkill/srcversion | 1 + test/sys/module/rfkill/version | 1 + .../sys/module/rsrc_nonstatic/holders/yenta_socket | 1 + test/sys/module/rsrc_nonstatic/initstate | 1 + .../module/rsrc_nonstatic/notes/.note.gnu.build-id | Bin 0 -> 36 bytes .../sys/module/rsrc_nonstatic/parameters/probe_mem | 1 + test/sys/module/rsrc_nonstatic/refcnt | 1 + test/sys/module/rsrc_nonstatic/sections/.bss | 1 + test/sys/module/rsrc_nonstatic/sections/.data | 1 + .../module/rsrc_nonstatic/sections/.devexit.text | 1 + .../module/rsrc_nonstatic/sections/.devinit.text | 1 + test/sys/module/rsrc_nonstatic/sections/.exit.text | 1 + .../sections/.gnu.linkonce.this_module | 1 + test/sys/module/rsrc_nonstatic/sections/.init.text | 1 + .../rsrc_nonstatic/sections/.note.gnu.build-id | 1 + test/sys/module/rsrc_nonstatic/sections/.ref.data | 1 + test/sys/module/rsrc_nonstatic/sections/.rodata | 1 + .../module/rsrc_nonstatic/sections/.rodata.str1.1 | 1 + test/sys/module/rsrc_nonstatic/sections/.strtab | 1 + test/sys/module/rsrc_nonstatic/sections/.symtab | 1 + test/sys/module/rsrc_nonstatic/sections/.text | 1 + test/sys/module/rsrc_nonstatic/sections/__kcrctab | 1 + test/sys/module/rsrc_nonstatic/sections/__ksymtab | 1 + .../rsrc_nonstatic/sections/__ksymtab_strings | 1 + test/sys/module/rsrc_nonstatic/sections/__param | 1 + test/sys/module/rsrc_nonstatic/srcversion | 1 + test/sys/module/rtc_cmos/initstate | 1 + test/sys/module/rtc_cmos/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/rtc_cmos/refcnt | 1 + test/sys/module/rtc_cmos/sections/.bss | 1 + test/sys/module/rtc_cmos/sections/.data | 1 + test/sys/module/rtc_cmos/sections/.devinit.text | 1 + test/sys/module/rtc_cmos/sections/.exit.text | 1 + .../rtc_cmos/sections/.gnu.linkonce.this_module | 1 + test/sys/module/rtc_cmos/sections/.init.text | 1 + .../module/rtc_cmos/sections/.note.gnu.build-id | 1 + test/sys/module/rtc_cmos/sections/.rodata | 1 + test/sys/module/rtc_cmos/sections/.rodata.str1.1 | 1 + test/sys/module/rtc_cmos/sections/.strtab | 1 + test/sys/module/rtc_cmos/sections/.symtab | 1 + test/sys/module/rtc_cmos/sections/.text | 1 + test/sys/module/rtc_cmos/srcversion | 1 + test/sys/module/rtc_core/holders/rtc_cmos | 1 + test/sys/module/rtc_core/initstate | 1 + test/sys/module/rtc_core/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/rtc_core/refcnt | 1 + test/sys/module/rtc_core/sections/.bss | 1 + test/sys/module/rtc_core/sections/.data | 1 + test/sys/module/rtc_core/sections/.exit.text | 1 + .../rtc_core/sections/.gnu.linkonce.this_module | 1 + test/sys/module/rtc_core/sections/.init.text | 1 + .../module/rtc_core/sections/.note.gnu.build-id | 1 + test/sys/module/rtc_core/sections/.rodata | 1 + test/sys/module/rtc_core/sections/.rodata.str1.1 | 1 + test/sys/module/rtc_core/sections/.smp_locks | 1 + test/sys/module/rtc_core/sections/.strtab | 1 + test/sys/module/rtc_core/sections/.symtab | 1 + test/sys/module/rtc_core/sections/.text | 1 + test/sys/module/rtc_core/sections/__kcrctab_gpl | 1 + test/sys/module/rtc_core/sections/__ksymtab_gpl | 1 + .../sys/module/rtc_core/sections/__ksymtab_strings | 1 + test/sys/module/rtc_core/srcversion | 1 + test/sys/module/rtc_lib/holders/rtc_core | 1 + test/sys/module/rtc_lib/initstate | 1 + test/sys/module/rtc_lib/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/rtc_lib/refcnt | 1 + test/sys/module/rtc_lib/sections/.bss | 1 + test/sys/module/rtc_lib/sections/.data | 1 + .../rtc_lib/sections/.gnu.linkonce.this_module | 1 + .../sys/module/rtc_lib/sections/.note.gnu.build-id | 1 + test/sys/module/rtc_lib/sections/.rodata | 1 + test/sys/module/rtc_lib/sections/.strtab | 1 + test/sys/module/rtc_lib/sections/.symtab | 1 + test/sys/module/rtc_lib/sections/.text | 1 + test/sys/module/rtc_lib/sections/__kcrctab | 1 + test/sys/module/rtc_lib/sections/__ksymtab | 1 + test/sys/module/rtc_lib/sections/__ksymtab_strings | 1 + test/sys/module/rtc_lib/srcversion | 1 + .../module/scsi_mod/parameters/default_dev_flags | 1 + test/sys/module/scsi_mod/parameters/inq_timeout | 1 + test/sys/module/scsi_mod/parameters/max_luns | 1 + .../sys/module/scsi_mod/parameters/max_report_luns | 1 + test/sys/module/scsi_mod/parameters/scan | 1 + .../module/scsi_mod/parameters/scsi_logging_level | 1 + test/sys/module/sg/initstate | 1 + test/sys/module/sg/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/sg/parameters/allow_dio | 1 + test/sys/module/sg/parameters/def_reserved_size | 1 + test/sys/module/sg/parameters/scatter_elem_sz | 1 + test/sys/module/sg/refcnt | 1 + test/sys/module/sg/sections/.bss | 1 + test/sys/module/sg/sections/.data | 1 + test/sys/module/sg/sections/.exit.text | 1 + test/sys/module/sg/sections/.fixup | 1 + .../module/sg/sections/.gnu.linkonce.this_module | 1 + test/sys/module/sg/sections/.init.text | 1 + test/sys/module/sg/sections/.note.gnu.build-id | 1 + test/sys/module/sg/sections/.rodata | 1 + test/sys/module/sg/sections/.rodata.str1.1 | 1 + test/sys/module/sg/sections/.smp_locks | 1 + test/sys/module/sg/sections/.strtab | 1 + test/sys/module/sg/sections/.symtab | 1 + test/sys/module/sg/sections/.text | 1 + test/sys/module/sg/sections/__bug_table | 1 + test/sys/module/sg/sections/__ex_table | 1 + test/sys/module/sg/sections/__param | 1 + test/sys/module/sg/srcversion | 1 + test/sys/module/sg/version | 1 + test/sys/module/snd/holders/snd_hda_intel | 1 + test/sys/module/snd/holders/snd_mixer_oss | 1 + test/sys/module/snd/holders/snd_pcm | 1 + test/sys/module/snd/holders/snd_pcm_oss | 1 + test/sys/module/snd/holders/snd_seq | 1 + test/sys/module/snd/holders/snd_seq_device | 1 + test/sys/module/snd/holders/snd_timer | 1 + test/sys/module/snd/initstate | 1 + test/sys/module/snd/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/snd/parameters/cards_limit | 1 + test/sys/module/snd/parameters/major | 1 + test/sys/module/snd/parameters/slots | 1 + test/sys/module/snd/refcnt | 1 + test/sys/module/snd/sections/.bss | 1 + test/sys/module/snd/sections/.data | 1 + test/sys/module/snd/sections/.exit.text | 1 + .../module/snd/sections/.gnu.linkonce.this_module | 1 + test/sys/module/snd/sections/.init.text | 1 + test/sys/module/snd/sections/.note.gnu.build-id | 1 + test/sys/module/snd/sections/.rodata | 1 + test/sys/module/snd/sections/.rodata.str1.1 | 1 + test/sys/module/snd/sections/.strtab | 1 + test/sys/module/snd/sections/.symtab | 1 + test/sys/module/snd/sections/.text | 1 + test/sys/module/snd/sections/__kcrctab | 1 + test/sys/module/snd/sections/__ksymtab | 1 + test/sys/module/snd/sections/__ksymtab_strings | 1 + test/sys/module/snd/sections/__param | 1 + test/sys/module/snd/srcversion | 1 + .../sys/module/snd_hda_intel/drivers/pci:HDA Intel | 1 + test/sys/module/snd_hda_intel/initstate | 1 + .../module/snd_hda_intel/notes/.note.gnu.build-id | Bin 0 -> 36 bytes .../module/snd_hda_intel/parameters/bdl_pos_adj | 1 + test/sys/module/snd_hda_intel/parameters/enable | 1 + .../sys/module/snd_hda_intel/parameters/enable_msi | 1 + test/sys/module/snd_hda_intel/parameters/id | 1 + test/sys/module/snd_hda_intel/parameters/index | 1 + test/sys/module/snd_hda_intel/parameters/model | 1 + .../module/snd_hda_intel/parameters/position_fix | 1 + .../sys/module/snd_hda_intel/parameters/probe_mask | 1 + .../sys/module/snd_hda_intel/parameters/single_cmd | 1 + test/sys/module/snd_hda_intel/refcnt | 1 + test/sys/module/snd_hda_intel/sections/.bss | 1 + test/sys/module/snd_hda_intel/sections/.data | 1 + .../module/snd_hda_intel/sections/.devexit.text | 1 + .../module/snd_hda_intel/sections/.devinit.data | 1 + .../module/snd_hda_intel/sections/.devinit.text | 1 + test/sys/module/snd_hda_intel/sections/.exit.text | 1 + .../sections/.gnu.linkonce.this_module | 1 + test/sys/module/snd_hda_intel/sections/.init.text | 1 + .../snd_hda_intel/sections/.note.gnu.build-id | 1 + test/sys/module/snd_hda_intel/sections/.rodata | 1 + .../module/snd_hda_intel/sections/.rodata.str1.1 | 1 + test/sys/module/snd_hda_intel/sections/.strtab | 1 + test/sys/module/snd_hda_intel/sections/.symtab | 1 + test/sys/module/snd_hda_intel/sections/.text | 1 + test/sys/module/snd_hda_intel/sections/__param | 1 + test/sys/module/snd_hda_intel/srcversion | 1 + test/sys/module/snd_mixer_oss/holders/snd_pcm_oss | 1 + test/sys/module/snd_mixer_oss/initstate | 1 + .../module/snd_mixer_oss/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/snd_mixer_oss/refcnt | 1 + test/sys/module/snd_mixer_oss/sections/.bss | 1 + test/sys/module/snd_mixer_oss/sections/.data | 1 + test/sys/module/snd_mixer_oss/sections/.exit.text | 1 + .../sections/.gnu.linkonce.this_module | 1 + test/sys/module/snd_mixer_oss/sections/.init.text | 1 + .../snd_mixer_oss/sections/.note.gnu.build-id | 1 + test/sys/module/snd_mixer_oss/sections/.rodata | 1 + .../module/snd_mixer_oss/sections/.rodata.str1.1 | 1 + test/sys/module/snd_mixer_oss/sections/.strtab | 1 + test/sys/module/snd_mixer_oss/sections/.symtab | 1 + test/sys/module/snd_mixer_oss/sections/.text | 1 + test/sys/module/snd_mixer_oss/sections/__kcrctab | 1 + test/sys/module/snd_mixer_oss/sections/__ksymtab | 1 + .../snd_mixer_oss/sections/__ksymtab_strings | 1 + test/sys/module/snd_mixer_oss/srcversion | 1 + .../module/snd_page_alloc/holders/snd_hda_intel | 1 + test/sys/module/snd_page_alloc/holders/snd_pcm | 1 + test/sys/module/snd_page_alloc/initstate | 1 + .../module/snd_page_alloc/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/snd_page_alloc/refcnt | 1 + test/sys/module/snd_page_alloc/sections/.bss | 1 + test/sys/module/snd_page_alloc/sections/.data | 1 + test/sys/module/snd_page_alloc/sections/.exit.text | 1 + .../sections/.gnu.linkonce.this_module | 1 + test/sys/module/snd_page_alloc/sections/.init.text | 1 + .../snd_page_alloc/sections/.note.gnu.build-id | 1 + test/sys/module/snd_page_alloc/sections/.rodata | 1 + .../module/snd_page_alloc/sections/.rodata.str1.1 | 1 + test/sys/module/snd_page_alloc/sections/.strtab | 1 + test/sys/module/snd_page_alloc/sections/.symtab | 1 + test/sys/module/snd_page_alloc/sections/.text | 1 + test/sys/module/snd_page_alloc/sections/__kcrctab | 1 + test/sys/module/snd_page_alloc/sections/__ksymtab | 1 + .../snd_page_alloc/sections/__ksymtab_strings | 1 + test/sys/module/snd_page_alloc/srcversion | 1 + test/sys/module/snd_pcm/holders/snd_hda_intel | 1 + test/sys/module/snd_pcm/holders/snd_pcm_oss | 1 + test/sys/module/snd_pcm/initstate | 1 + test/sys/module/snd_pcm/notes/.note.gnu.build-id | Bin 0 -> 36 bytes .../module/snd_pcm/parameters/maximum_substreams | 1 + test/sys/module/snd_pcm/parameters/preallocate_dma | 1 + test/sys/module/snd_pcm/refcnt | 1 + test/sys/module/snd_pcm/sections/.bss | 1 + test/sys/module/snd_pcm/sections/.data | 1 + test/sys/module/snd_pcm/sections/.exit.text | 1 + test/sys/module/snd_pcm/sections/.fixup | 1 + .../snd_pcm/sections/.gnu.linkonce.this_module | 1 + test/sys/module/snd_pcm/sections/.init.text | 1 + .../sys/module/snd_pcm/sections/.note.gnu.build-id | 1 + test/sys/module/snd_pcm/sections/.rodata | 1 + test/sys/module/snd_pcm/sections/.rodata.str1.1 | 1 + test/sys/module/snd_pcm/sections/.smp_locks | 1 + test/sys/module/snd_pcm/sections/.strtab | 1 + test/sys/module/snd_pcm/sections/.symtab | 1 + test/sys/module/snd_pcm/sections/.text | 1 + test/sys/module/snd_pcm/sections/__ex_table | 1 + test/sys/module/snd_pcm/sections/__kcrctab | 1 + test/sys/module/snd_pcm/sections/__ksymtab | 1 + test/sys/module/snd_pcm/sections/__ksymtab_strings | 1 + test/sys/module/snd_pcm/sections/__param | 1 + test/sys/module/snd_pcm/srcversion | 1 + test/sys/module/snd_pcm_oss/initstate | 1 + .../module/snd_pcm_oss/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/snd_pcm_oss/parameters/adsp_map | 1 + test/sys/module/snd_pcm_oss/parameters/dsp_map | 1 + .../module/snd_pcm_oss/parameters/nonblock_open | 1 + test/sys/module/snd_pcm_oss/refcnt | 1 + test/sys/module/snd_pcm_oss/sections/.bss | 1 + test/sys/module/snd_pcm_oss/sections/.data | 1 + test/sys/module/snd_pcm_oss/sections/.exit.text | 1 + .../snd_pcm_oss/sections/.gnu.linkonce.this_module | 1 + test/sys/module/snd_pcm_oss/sections/.init.text | 1 + .../module/snd_pcm_oss/sections/.note.gnu.build-id | 1 + test/sys/module/snd_pcm_oss/sections/.rodata | 1 + .../sys/module/snd_pcm_oss/sections/.rodata.str1.1 | 1 + test/sys/module/snd_pcm_oss/sections/.strtab | 1 + test/sys/module/snd_pcm_oss/sections/.symtab | 1 + test/sys/module/snd_pcm_oss/sections/.text | 1 + test/sys/module/snd_pcm_oss/sections/__param | 1 + test/sys/module/snd_pcm_oss/srcversion | 1 + test/sys/module/snd_seq/initstate | 1 + test/sys/module/snd_seq/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/snd_seq/parameters/seq_client_load | 1 + .../snd_seq/parameters/seq_default_timer_card | 1 + .../snd_seq/parameters/seq_default_timer_class | 1 + .../snd_seq/parameters/seq_default_timer_device | 1 + .../parameters/seq_default_timer_resolution | 1 + .../snd_seq/parameters/seq_default_timer_sclass | 1 + .../snd_seq/parameters/seq_default_timer_subdevice | 1 + test/sys/module/snd_seq/refcnt | 1 + test/sys/module/snd_seq/sections/.bss | 1 + test/sys/module/snd_seq/sections/.data | 1 + test/sys/module/snd_seq/sections/.exit.text | 1 + .../snd_seq/sections/.gnu.linkonce.this_module | 1 + test/sys/module/snd_seq/sections/.init.text | 1 + .../sys/module/snd_seq/sections/.note.gnu.build-id | 1 + test/sys/module/snd_seq/sections/.rodata | 1 + test/sys/module/snd_seq/sections/.rodata.str1.1 | 1 + test/sys/module/snd_seq/sections/.smp_locks | 1 + test/sys/module/snd_seq/sections/.strtab | 1 + test/sys/module/snd_seq/sections/.symtab | 1 + test/sys/module/snd_seq/sections/.text | 1 + test/sys/module/snd_seq/sections/__kcrctab | 1 + test/sys/module/snd_seq/sections/__ksymtab | 1 + test/sys/module/snd_seq/sections/__ksymtab_strings | 1 + test/sys/module/snd_seq/sections/__param | 1 + test/sys/module/snd_seq/srcversion | 1 + test/sys/module/snd_seq_device/holders/snd_seq | 1 + test/sys/module/snd_seq_device/initstate | 1 + .../module/snd_seq_device/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/snd_seq_device/refcnt | 1 + test/sys/module/snd_seq_device/sections/.bss | 1 + test/sys/module/snd_seq_device/sections/.data | 1 + test/sys/module/snd_seq_device/sections/.exit.text | 1 + .../sections/.gnu.linkonce.this_module | 1 + test/sys/module/snd_seq_device/sections/.init.text | 1 + .../snd_seq_device/sections/.note.gnu.build-id | 1 + .../module/snd_seq_device/sections/.rodata.str1.1 | 1 + test/sys/module/snd_seq_device/sections/.strtab | 1 + test/sys/module/snd_seq_device/sections/.symtab | 1 + test/sys/module/snd_seq_device/sections/.text | 1 + test/sys/module/snd_seq_device/sections/__kcrctab | 1 + test/sys/module/snd_seq_device/sections/__ksymtab | 1 + .../snd_seq_device/sections/__ksymtab_strings | 1 + test/sys/module/snd_seq_device/srcversion | 1 + test/sys/module/snd_timer/holders/snd_pcm | 1 + test/sys/module/snd_timer/holders/snd_seq | 1 + test/sys/module/snd_timer/initstate | 1 + test/sys/module/snd_timer/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/snd_timer/parameters/timer_limit | 1 + .../snd_timer/parameters/timer_tstamp_monotonic | 1 + test/sys/module/snd_timer/refcnt | 1 + test/sys/module/snd_timer/sections/.bss | 1 + test/sys/module/snd_timer/sections/.data | 1 + test/sys/module/snd_timer/sections/.exit.text | 1 + .../snd_timer/sections/.gnu.linkonce.this_module | 1 + test/sys/module/snd_timer/sections/.init.text | 1 + .../module/snd_timer/sections/.note.gnu.build-id | 1 + test/sys/module/snd_timer/sections/.rodata | 1 + test/sys/module/snd_timer/sections/.rodata.str1.1 | 1 + test/sys/module/snd_timer/sections/.smp_locks | 1 + test/sys/module/snd_timer/sections/.strtab | 1 + test/sys/module/snd_timer/sections/.symtab | 1 + test/sys/module/snd_timer/sections/.text | 1 + test/sys/module/snd_timer/sections/__bug_table | 1 + test/sys/module/snd_timer/sections/__kcrctab | 1 + test/sys/module/snd_timer/sections/__ksymtab | 1 + .../module/snd_timer/sections/__ksymtab_strings | 1 + test/sys/module/snd_timer/sections/__param | 1 + test/sys/module/snd_timer/srcversion | 1 + test/sys/module/soundcore/holders/snd | 1 + test/sys/module/soundcore/initstate | 1 + test/sys/module/soundcore/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/soundcore/refcnt | 1 + test/sys/module/soundcore/sections/.bss | 1 + test/sys/module/soundcore/sections/.data | 1 + test/sys/module/soundcore/sections/.exit.text | 1 + .../soundcore/sections/.gnu.linkonce.this_module | 1 + test/sys/module/soundcore/sections/.init.text | 1 + .../module/soundcore/sections/.note.gnu.build-id | 1 + test/sys/module/soundcore/sections/.rodata | 1 + test/sys/module/soundcore/sections/.rodata.str1.1 | 1 + test/sys/module/soundcore/sections/.strtab | 1 + test/sys/module/soundcore/sections/.symtab | 1 + test/sys/module/soundcore/sections/.text | 1 + test/sys/module/soundcore/sections/__kcrctab | 1 + test/sys/module/soundcore/sections/__ksymtab | 1 + .../module/soundcore/sections/__ksymtab_strings | 1 + test/sys/module/soundcore/srcversion | 1 + test/sys/module/spurious/parameters/irqfixup | 1 + test/sys/module/spurious/parameters/noirqdebug | 1 + test/sys/module/sr_mod/initstate | 1 + test/sys/module/sr_mod/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/sr_mod/parameters/xa_test | 1 + test/sys/module/sr_mod/refcnt | 1 + test/sys/module/sr_mod/sections/.bss | 1 + test/sys/module/sr_mod/sections/.data | 1 + test/sys/module/sr_mod/sections/.exit.text | 1 + .../sr_mod/sections/.gnu.linkonce.this_module | 1 + test/sys/module/sr_mod/sections/.init.text | 1 + test/sys/module/sr_mod/sections/.note.gnu.build-id | 1 + test/sys/module/sr_mod/sections/.rodata | 1 + test/sys/module/sr_mod/sections/.rodata.str1.1 | 1 + test/sys/module/sr_mod/sections/.smp_locks | 1 + test/sys/module/sr_mod/sections/.strtab | 1 + test/sys/module/sr_mod/sections/.symtab | 1 + test/sys/module/sr_mod/sections/.text | 1 + test/sys/module/sr_mod/sections/__param | 1 + test/sys/module/sr_mod/srcversion | 1 + test/sys/module/tcp_cubic/parameters/beta | 1 + test/sys/module/tcp_cubic/parameters/bic_scale | 1 + .../module/tcp_cubic/parameters/fast_convergence | 1 + .../module/tcp_cubic/parameters/initial_ssthresh | 1 + .../module/tcp_cubic/parameters/tcp_friendliness | 1 + test/sys/module/thermal/initstate | 1 + test/sys/module/thermal/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/thermal/parameters/act | 1 + test/sys/module/thermal/parameters/crt | 1 + test/sys/module/thermal/parameters/psv | 1 + test/sys/module/thermal/parameters/tzp | 1 + test/sys/module/thermal/refcnt | 1 + test/sys/module/thermal/sections/.bss | 1 + test/sys/module/thermal/sections/.data | 1 + test/sys/module/thermal/sections/.exit.text | 1 + .../thermal/sections/.gnu.linkonce.this_module | 1 + test/sys/module/thermal/sections/.init.data | 1 + test/sys/module/thermal/sections/.init.text | 1 + .../sys/module/thermal/sections/.note.gnu.build-id | 1 + test/sys/module/thermal/sections/.rodata | 1 + test/sys/module/thermal/sections/.rodata.str1.1 | 1 + test/sys/module/thermal/sections/.strtab | 1 + test/sys/module/thermal/sections/.symtab | 1 + test/sys/module/thermal/sections/.text | 1 + test/sys/module/thermal/sections/__param | 1 + test/sys/module/thermal/srcversion | 1 + .../thinkpad_acpi/drivers/platform:thinkpad_acpi | 1 + .../thinkpad_acpi/drivers/platform:thinkpad_hwmon | 1 + test/sys/module/thinkpad_acpi/initstate | 1 + .../module/thinkpad_acpi/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/thinkpad_acpi/refcnt | 1 + test/sys/module/thinkpad_acpi/sections/.bss | 1 + test/sys/module/thinkpad_acpi/sections/.data | 1 + .../sections/.gnu.linkonce.this_module | 1 + test/sys/module/thinkpad_acpi/sections/.init.data | 1 + test/sys/module/thinkpad_acpi/sections/.init.text | 1 + .../thinkpad_acpi/sections/.note.gnu.build-id | 1 + test/sys/module/thinkpad_acpi/sections/.rodata | 1 + .../module/thinkpad_acpi/sections/.rodata.str1.1 | 1 + test/sys/module/thinkpad_acpi/sections/.smp_locks | 1 + test/sys/module/thinkpad_acpi/sections/.strtab | 1 + test/sys/module/thinkpad_acpi/sections/.symtab | 1 + test/sys/module/thinkpad_acpi/sections/.text | 1 + test/sys/module/thinkpad_acpi/sections/__bug_table | 1 + test/sys/module/thinkpad_acpi/sections/__param | 1 + test/sys/module/thinkpad_acpi/srcversion | 1 + test/sys/module/thinkpad_acpi/version | 1 + test/sys/module/uhci_hcd/drivers/pci:uhci_hcd | 1 + test/sys/module/uhci_hcd/initstate | 1 + test/sys/module/uhci_hcd/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/uhci_hcd/parameters/ignore_oc | 1 + test/sys/module/uhci_hcd/refcnt | 1 + test/sys/module/uhci_hcd/sections/.bss | 1 + test/sys/module/uhci_hcd/sections/.data | 1 + test/sys/module/uhci_hcd/sections/.exit.text | 1 + .../uhci_hcd/sections/.gnu.linkonce.this_module | 1 + test/sys/module/uhci_hcd/sections/.init.text | 1 + .../module/uhci_hcd/sections/.note.gnu.build-id | 1 + test/sys/module/uhci_hcd/sections/.rodata | 1 + test/sys/module/uhci_hcd/sections/.rodata.str1.1 | 1 + test/sys/module/uhci_hcd/sections/.smp_locks | 1 + test/sys/module/uhci_hcd/sections/.strtab | 1 + test/sys/module/uhci_hcd/sections/.symtab | 1 + test/sys/module/uhci_hcd/sections/.text | 1 + test/sys/module/uhci_hcd/sections/__param | 1 + test/sys/module/uhci_hcd/srcversion | 1 + test/sys/module/uinput/initstate | 1 + test/sys/module/uinput/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/uinput/refcnt | 1 + test/sys/module/uinput/sections/.bss | 1 + test/sys/module/uinput/sections/.data | 1 + test/sys/module/uinput/sections/.exit.text | 1 + .../uinput/sections/.gnu.linkonce.this_module | 1 + test/sys/module/uinput/sections/.init.text | 1 + test/sys/module/uinput/sections/.note.gnu.build-id | 1 + test/sys/module/uinput/sections/.rodata | 1 + test/sys/module/uinput/sections/.rodata.str1.1 | 1 + test/sys/module/uinput/sections/.smp_locks | 1 + test/sys/module/uinput/sections/.strtab | 1 + test/sys/module/uinput/sections/.symtab | 1 + test/sys/module/uinput/sections/.text | 1 + test/sys/module/uinput/srcversion | 1 + test/sys/module/uinput/version | 1 + .../sys/module/usb_storage/drivers/usb:usb-storage | 1 + test/sys/module/usb_storage/initstate | 1 + .../module/usb_storage/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/usb_storage/parameters/delay_use | 1 + .../module/usb_storage/parameters/swi_tru_install | 1 + test/sys/module/usb_storage/refcnt | 1 + test/sys/module/usb_storage/sections/.bss | 1 + test/sys/module/usb_storage/sections/.data | 1 + test/sys/module/usb_storage/sections/.exit.text | 1 + .../usb_storage/sections/.gnu.linkonce.this_module | 1 + test/sys/module/usb_storage/sections/.init.text | 1 + .../module/usb_storage/sections/.note.gnu.build-id | 1 + test/sys/module/usb_storage/sections/.rodata | 1 + .../sys/module/usb_storage/sections/.rodata.str1.1 | 1 + test/sys/module/usb_storage/sections/.smp_locks | 1 + test/sys/module/usb_storage/sections/.strtab | 1 + test/sys/module/usb_storage/sections/.symtab | 1 + test/sys/module/usb_storage/sections/.text | 1 + test/sys/module/usb_storage/sections/__param | 1 + test/sys/module/usb_storage/srcversion | 1 + test/sys/module/usbcore/drivers/usb:hub | 1 + test/sys/module/usbcore/drivers/usb:usb | 1 + test/sys/module/usbcore/drivers/usb:usbfs | 1 + test/sys/module/usbcore/holders/cdc_acm | 1 + test/sys/module/usbcore/holders/ehci_hcd | 1 + test/sys/module/usbcore/holders/uhci_hcd | 1 + test/sys/module/usbcore/holders/usb_storage | 1 + test/sys/module/usbcore/holders/usbhid | 1 + test/sys/module/usbcore/initstate | 1 + test/sys/module/usbcore/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/usbcore/parameters/autosuspend | 1 + test/sys/module/usbcore/parameters/blinkenlights | 1 + test/sys/module/usbcore/parameters/nousb | 1 + .../sys/module/usbcore/parameters/old_scheme_first | 1 + test/sys/module/usbcore/parameters/usbfs_snoop | 1 + .../sys/module/usbcore/parameters/use_both_schemes | 1 + test/sys/module/usbcore/refcnt | 1 + test/sys/module/usbcore/sections/.bss | 1 + test/sys/module/usbcore/sections/.data | 1 + test/sys/module/usbcore/sections/.exit.text | 1 + test/sys/module/usbcore/sections/.fixup | 1 + .../usbcore/sections/.gnu.linkonce.this_module | 1 + test/sys/module/usbcore/sections/.init.text | 1 + .../sys/module/usbcore/sections/.note.gnu.build-id | 1 + test/sys/module/usbcore/sections/.rodata | 1 + test/sys/module/usbcore/sections/.rodata.str1.1 | 1 + test/sys/module/usbcore/sections/.smp_locks | 1 + test/sys/module/usbcore/sections/.strtab | 1 + test/sys/module/usbcore/sections/.symtab | 1 + test/sys/module/usbcore/sections/.text | 1 + test/sys/module/usbcore/sections/__bug_table | 1 + test/sys/module/usbcore/sections/__ex_table | 1 + test/sys/module/usbcore/sections/__kcrctab_gpl | 1 + test/sys/module/usbcore/sections/__ksymtab_gpl | 1 + test/sys/module/usbcore/sections/__ksymtab_strings | 1 + test/sys/module/usbcore/sections/__param | 1 + test/sys/module/usbcore/srcversion | 1 + test/sys/module/usbhid/drivers/usb:usbhid | 1 + test/sys/module/usbhid/initstate | 1 + test/sys/module/usbhid/notes/.note.gnu.build-id | Bin 0 -> 36 bytes test/sys/module/usbhid/parameters/mousepoll | 1 + test/sys/module/usbhid/parameters/quirks | 1 + test/sys/module/usbhid/parameters/rdesc_quirks | 1 + test/sys/module/usbhid/refcnt | 1 + test/sys/module/usbhid/sections/.bss | 1 + test/sys/module/usbhid/sections/.data | 1 + test/sys/module/usbhid/sections/.exit.text | 1 + .../usbhid/sections/.gnu.linkonce.this_module | 1 + test/sys/module/usbhid/sections/.init.text | 1 + test/sys/module/usbhid/sections/.note.gnu.build-id | 1 + test/sys/module/usbhid/sections/.rodata | 1 + test/sys/module/usbhid/sections/.rodata.str1.1 | 1 + test/sys/module/usbhid/sections/.smp_locks | 1 + test/sys/module/usbhid/sections/.strtab | 1 + test/sys/module/usbhid/sections/.symtab | 1 + test/sys/module/usbhid/sections/.text | 1 + test/sys/module/usbhid/sections/__kcrctab_gpl | 1 + test/sys/module/usbhid/sections/__ksymtab_gpl | 1 + test/sys/module/usbhid/sections/__ksymtab_strings | 1 + test/sys/module/usbhid/sections/__param | 1 + test/sys/module/usbhid/srcversion | 1 + test/sys/module/vt/parameters/default_blu | 1 + test/sys/module/vt/parameters/default_grn | 1 + test/sys/module/vt/parameters/default_red | 1 + test/sys/module/vt/parameters/default_utf8 | 1 + test/sys/module/vt/parameters/italic | 1 + test/sys/module/vt/parameters/underline | 1 + .../module/yenta_socket/drivers/pci:yenta_cardbus | 1 + test/sys/module/yenta_socket/initstate | 1 + .../module/yenta_socket/notes/.note.gnu.build-id | Bin 0 -> 36 bytes .../module/yenta_socket/parameters/disable_clkrun | 1 + test/sys/module/yenta_socket/parameters/isa_probe | 1 + .../module/yenta_socket/parameters/pwr_irqs_off | 1 + test/sys/module/yenta_socket/refcnt | 1 + test/sys/module/yenta_socket/sections/.bss | 1 + test/sys/module/yenta_socket/sections/.data | 1 + .../sys/module/yenta_socket/sections/.devinit.text | 1 + test/sys/module/yenta_socket/sections/.exit.text | 1 + .../sections/.gnu.linkonce.this_module | 1 + test/sys/module/yenta_socket/sections/.init.text | 1 + .../yenta_socket/sections/.note.gnu.build-id | 1 + test/sys/module/yenta_socket/sections/.rodata | 1 + .../module/yenta_socket/sections/.rodata.str1.1 | 1 + test/sys/module/yenta_socket/sections/.strtab | 1 + test/sys/module/yenta_socket/sections/.symtab | 1 + test/sys/module/yenta_socket/sections/.text | 1 + test/sys/module/yenta_socket/sections/__bug_table | 1 + test/sys/module/yenta_socket/sections/__param | 1 + test/sys/module/yenta_socket/srcversion | 1 + test/sys/power/state | 1 + test/udev-test.pl | 619 ++++++++++----------- 9376 files changed, 10214 insertions(+), 716 deletions(-) delete mode 100644 test/sys/block/cciss!c0d0/cciss!c0d0p1/dev delete mode 100644 test/sys/block/cciss!c0d0/cciss!c0d0p2/dev delete mode 100644 test/sys/block/cciss!c0d0/cciss!c0d0p5/dev delete mode 100644 test/sys/block/cciss!c0d0/dev delete mode 120000 test/sys/block/cciss!c0d0/device create mode 120000 test/sys/block/loop0 create mode 120000 test/sys/block/loop1 create mode 120000 test/sys/block/loop2 create mode 120000 test/sys/block/loop3 create mode 120000 test/sys/block/loop4 create mode 120000 test/sys/block/loop5 create mode 120000 test/sys/block/loop6 create mode 120000 test/sys/block/loop7 create mode 120000 test/sys/block/md0 delete mode 100644 test/sys/block/rd!c0d0/dev delete mode 120000 test/sys/block/rd!c0d0/device create mode 120000 test/sys/block/sda delete mode 100644 test/sys/block/sda/dev delete mode 120000 test/sys/block/sda/device delete mode 100644 test/sys/block/sda/queue/iosched/antic_expire delete mode 100644 test/sys/block/sda/queue/iosched/read_batch_expire delete mode 100644 test/sys/block/sda/queue/iosched/read_expire delete mode 100644 test/sys/block/sda/queue/iosched/write_batch_expire delete mode 100644 test/sys/block/sda/queue/iosched/write_expire delete mode 100644 test/sys/block/sda/queue/nr_requests delete mode 100644 test/sys/block/sda/range delete mode 100644 test/sys/block/sda/sda1/dev delete mode 100644 test/sys/block/sda/sda1/size delete mode 100644 test/sys/block/sda/sda1/start delete mode 100644 test/sys/block/sda/sda1/stat delete mode 120000 test/sys/block/sda/sda1/subsystem delete mode 100644 test/sys/block/sda/sda2/dev delete mode 100644 test/sys/block/sda/sda2/size delete mode 100644 test/sys/block/sda/sda2/start delete mode 100644 test/sys/block/sda/sda2/stat delete mode 120000 test/sys/block/sda/sda2/subsystem delete mode 100644 test/sys/block/sda/sda3/dev delete mode 100644 test/sys/block/sda/sda3/size delete mode 100644 test/sys/block/sda/sda3/start delete mode 100644 test/sys/block/sda/sda3/stat delete mode 120000 test/sys/block/sda/sda3/subsystem delete mode 100644 test/sys/block/sda/sda4/dev delete mode 100644 test/sys/block/sda/sda4/size delete mode 100644 test/sys/block/sda/sda4/start delete mode 100644 test/sys/block/sda/sda4/stat delete mode 120000 test/sys/block/sda/sda4/subsystem delete mode 100644 test/sys/block/sda/size delete mode 100644 test/sys/block/sda/stat delete mode 120000 test/sys/block/sda/subsystem delete mode 100644 test/sys/block/sda/test:colon+plus create mode 120000 test/sys/block/sdb create mode 120000 test/sys/block/sr0 create mode 120000 test/sys/bus/acpi/devices/ACPI0003:00 create mode 120000 test/sys/bus/acpi/devices/ACPI0007:00 create mode 120000 test/sys/bus/acpi/devices/ACPI0007:01 create mode 120000 test/sys/bus/acpi/devices/ATM1200:00 create mode 120000 test/sys/bus/acpi/devices/IBM0057:00 create mode 120000 test/sys/bus/acpi/devices/IBM0068:00 create mode 120000 test/sys/bus/acpi/devices/IBM0079:00 create mode 120000 test/sys/bus/acpi/devices/LNXPOWER:00 create mode 120000 test/sys/bus/acpi/devices/LNXPWRBN:00 create mode 120000 test/sys/bus/acpi/devices/LNXSYSTM:00 create mode 120000 test/sys/bus/acpi/devices/LNXTHERM:00 create mode 120000 test/sys/bus/acpi/devices/LNXTHERM:01 create mode 120000 test/sys/bus/acpi/devices/LNXTHERM:02 create mode 120000 test/sys/bus/acpi/devices/PNP0000:00 create mode 120000 test/sys/bus/acpi/devices/PNP0100:00 create mode 120000 test/sys/bus/acpi/devices/PNP0103:00 create mode 120000 test/sys/bus/acpi/devices/PNP0200:00 create mode 120000 test/sys/bus/acpi/devices/PNP0303:00 create mode 120000 test/sys/bus/acpi/devices/PNP0800:00 create mode 120000 test/sys/bus/acpi/devices/PNP0A08:00 create mode 120000 test/sys/bus/acpi/devices/PNP0B00:00 create mode 120000 test/sys/bus/acpi/devices/PNP0C01:00 create mode 120000 test/sys/bus/acpi/devices/PNP0C02:00 create mode 120000 test/sys/bus/acpi/devices/PNP0C04:00 create mode 120000 test/sys/bus/acpi/devices/PNP0C09:00 create mode 120000 test/sys/bus/acpi/devices/PNP0C0A:00 create mode 120000 test/sys/bus/acpi/devices/PNP0C0D:00 create mode 120000 test/sys/bus/acpi/devices/PNP0C0E:00 create mode 120000 test/sys/bus/acpi/devices/PNP0C0F:00 create mode 120000 test/sys/bus/acpi/devices/PNP0C0F:01 create mode 120000 test/sys/bus/acpi/devices/PNP0C0F:02 create mode 120000 test/sys/bus/acpi/devices/PNP0C0F:03 create mode 120000 test/sys/bus/acpi/devices/PNP0C0F:04 create mode 120000 test/sys/bus/acpi/devices/PNP0C0F:05 create mode 120000 test/sys/bus/acpi/devices/PNP0C0F:06 create mode 120000 test/sys/bus/acpi/devices/PNP0C0F:07 create mode 120000 test/sys/bus/acpi/devices/device:00 create mode 120000 test/sys/bus/acpi/devices/device:01 create mode 120000 test/sys/bus/acpi/devices/device:02 create mode 120000 test/sys/bus/acpi/devices/device:03 create mode 120000 test/sys/bus/acpi/devices/device:04 create mode 120000 test/sys/bus/acpi/devices/device:05 create mode 120000 test/sys/bus/acpi/devices/device:06 create mode 120000 test/sys/bus/acpi/devices/device:07 create mode 120000 test/sys/bus/acpi/devices/device:08 create mode 120000 test/sys/bus/acpi/devices/device:09 create mode 120000 test/sys/bus/acpi/devices/device:0a create mode 120000 test/sys/bus/acpi/devices/device:0b create mode 120000 test/sys/bus/acpi/devices/device:0c create mode 120000 test/sys/bus/acpi/devices/device:0d create mode 120000 test/sys/bus/acpi/devices/device:0e create mode 120000 test/sys/bus/acpi/devices/device:0f create mode 120000 test/sys/bus/acpi/devices/device:10 create mode 120000 test/sys/bus/acpi/devices/device:11 create mode 120000 test/sys/bus/acpi/devices/device:12 create mode 120000 test/sys/bus/acpi/devices/device:13 create mode 120000 test/sys/bus/acpi/devices/device:14 create mode 120000 test/sys/bus/acpi/devices/device:15 create mode 120000 test/sys/bus/acpi/devices/device:16 create mode 120000 test/sys/bus/acpi/devices/device:17 create mode 120000 test/sys/bus/acpi/devices/device:18 create mode 120000 test/sys/bus/acpi/devices/device:19 create mode 120000 test/sys/bus/acpi/devices/device:1a create mode 120000 test/sys/bus/acpi/devices/device:1b create mode 120000 test/sys/bus/acpi/devices/device:1c create mode 120000 test/sys/bus/acpi/devices/device:1d create mode 120000 test/sys/bus/acpi/devices/device:1e create mode 120000 test/sys/bus/acpi/devices/device:1f create mode 120000 test/sys/bus/acpi/devices/device:20 create mode 120000 test/sys/bus/acpi/devices/device:21 create mode 120000 test/sys/bus/acpi/devices/device:22 create mode 120000 test/sys/bus/acpi/devices/device:23 create mode 120000 test/sys/bus/acpi/devices/device:24 create mode 120000 test/sys/bus/acpi/devices/device:25 create mode 120000 test/sys/bus/acpi/drivers/ac/ACPI0003:00 create mode 120000 test/sys/bus/acpi/drivers/battery/PNP0C0A:00 create mode 120000 test/sys/bus/acpi/drivers/button/LNXPWRBN:00 create mode 120000 test/sys/bus/acpi/drivers/button/PNP0C0D:00 create mode 120000 test/sys/bus/acpi/drivers/button/PNP0C0E:00 create mode 120000 test/sys/bus/acpi/drivers/ec/PNP0C09:00 create mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 create mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 create mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 create mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 create mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 create mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 create mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 create mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 create mode 120000 test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 create mode 120000 test/sys/bus/acpi/drivers/power/LNXPOWER:00 create mode 120000 test/sys/bus/acpi/drivers/processor/ACPI0007:00 create mode 120000 test/sys/bus/acpi/drivers/processor/ACPI0007:01 create mode 120000 test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 create mode 120000 test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 create mode 120000 test/sys/bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 create mode 100644 test/sys/bus/acpi/drivers_autoprobe create mode 100644 test/sys/bus/acpi/drivers_probe create mode 100644 test/sys/bus/acpi/uevent create mode 120000 test/sys/bus/pci/devices/0000:00:00.0 create mode 120000 test/sys/bus/pci/devices/0000:00:01.0 delete mode 120000 test/sys/bus/pci/devices/0000:00:09.0 create mode 120000 test/sys/bus/pci/devices/0000:00:1b.0 create mode 120000 test/sys/bus/pci/devices/0000:00:1c.0 create mode 120000 test/sys/bus/pci/devices/0000:00:1c.1 create mode 120000 test/sys/bus/pci/devices/0000:00:1c.2 create mode 120000 test/sys/bus/pci/devices/0000:00:1c.3 create mode 120000 test/sys/bus/pci/devices/0000:00:1d.0 create mode 120000 test/sys/bus/pci/devices/0000:00:1d.1 create mode 120000 test/sys/bus/pci/devices/0000:00:1d.2 create mode 120000 test/sys/bus/pci/devices/0000:00:1d.3 create mode 120000 test/sys/bus/pci/devices/0000:00:1f.0 create mode 120000 test/sys/bus/pci/devices/0000:00:1f.1 create mode 120000 test/sys/bus/pci/devices/0000:00:1f.2 create mode 120000 test/sys/bus/pci/devices/0000:00:1f.3 create mode 120000 test/sys/bus/pci/devices/0000:01:00.0 create mode 120000 test/sys/bus/pci/devices/0000:02:00.0 delete mode 120000 test/sys/bus/pci/devices/0000:02:05.0 create mode 120000 test/sys/bus/pci/devices/0000:03:00.0 create mode 120000 test/sys/bus/pci/devices/0000:15:00.0 create mode 120000 test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 create mode 120000 test/sys/bus/pci/drivers/HDA Intel/module create mode 120000 test/sys/bus/pci/drivers/agpgart-intel/module create mode 120000 test/sys/bus/pci/drivers/ahci/0000:00:1f.2 create mode 120000 test/sys/bus/pci/drivers/ahci/module delete mode 120000 test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 create mode 120000 test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 create mode 120000 test/sys/bus/pci/drivers/e1000e/0000:02:00.0 create mode 120000 test/sys/bus/pci/drivers/e1000e/module create mode 120000 test/sys/bus/pci/drivers/ehci_hcd/module create mode 120000 test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 create mode 120000 test/sys/bus/pci/drivers/iwl3945/module create mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:01.0 create mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.0 create mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.1 create mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.2 create mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.3 create mode 120000 test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 create mode 120000 test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 create mode 120000 test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 create mode 120000 test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 create mode 120000 test/sys/bus/pci/drivers/uhci_hcd/module create mode 120000 test/sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 create mode 120000 test/sys/bus/pci/drivers/yenta_cardbus/module create mode 100644 test/sys/bus/pci/drivers_autoprobe create mode 100644 test/sys/bus/pci/drivers_probe create mode 100644 test/sys/bus/pci/uevent create mode 120000 test/sys/bus/pci_express/devices/0000:00:01.0:pcie00 create mode 120000 test/sys/bus/pci_express/devices/0000:00:01.0:pcie03 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.0:pcie00 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.0:pcie02 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.0:pcie03 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.1:pcie00 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.1:pcie02 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.1:pcie03 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.2:pcie00 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.2:pcie02 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.2:pcie03 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.3:pcie00 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.3:pcie02 create mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.3:pcie03 create mode 100644 test/sys/bus/pci_express/drivers_autoprobe create mode 100644 test/sys/bus/pci_express/drivers_probe create mode 100644 test/sys/bus/pci_express/uevent create mode 100644 test/sys/bus/pcmcia/drivers_autoprobe create mode 100644 test/sys/bus/pcmcia/drivers_probe create mode 100644 test/sys/bus/pcmcia/uevent create mode 120000 test/sys/bus/platform/devices/dock.0 create mode 120000 test/sys/bus/platform/devices/i8042 create mode 120000 test/sys/bus/platform/devices/microcode create mode 120000 test/sys/bus/platform/devices/pcspkr create mode 120000 test/sys/bus/platform/devices/serial8250 create mode 120000 test/sys/bus/platform/devices/thinkpad_acpi create mode 120000 test/sys/bus/platform/devices/thinkpad_hwmon create mode 120000 test/sys/bus/platform/devices/vesafb.0 create mode 120000 test/sys/bus/platform/drivers/i8042/i8042 create mode 120000 test/sys/bus/platform/drivers/pcspkr/module create mode 120000 test/sys/bus/platform/drivers/pcspkr/pcspkr create mode 120000 test/sys/bus/platform/drivers/serial8250/serial8250 create mode 100644 test/sys/bus/platform/drivers/thinkpad_acpi/debug_level create mode 100644 test/sys/bus/platform/drivers/thinkpad_acpi/interface_version create mode 120000 test/sys/bus/platform/drivers/thinkpad_acpi/module create mode 120000 test/sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi create mode 100644 test/sys/bus/platform/drivers/thinkpad_acpi/version create mode 100644 test/sys/bus/platform/drivers/thinkpad_hwmon/debug_level create mode 100644 test/sys/bus/platform/drivers/thinkpad_hwmon/fan_watchdog create mode 100644 test/sys/bus/platform/drivers/thinkpad_hwmon/interface_version create mode 120000 test/sys/bus/platform/drivers/thinkpad_hwmon/module create mode 120000 test/sys/bus/platform/drivers/thinkpad_hwmon/thinkpad_hwmon create mode 100644 test/sys/bus/platform/drivers/thinkpad_hwmon/version create mode 120000 test/sys/bus/platform/drivers/vesafb/vesafb.0 create mode 100644 test/sys/bus/platform/drivers_autoprobe create mode 100644 test/sys/bus/platform/drivers_probe create mode 100644 test/sys/bus/platform/uevent create mode 120000 test/sys/bus/pnp/devices/00:00 create mode 120000 test/sys/bus/pnp/devices/00:01 create mode 120000 test/sys/bus/pnp/devices/00:02 create mode 120000 test/sys/bus/pnp/devices/00:03 create mode 120000 test/sys/bus/pnp/devices/00:04 create mode 120000 test/sys/bus/pnp/devices/00:05 create mode 120000 test/sys/bus/pnp/devices/00:06 create mode 120000 test/sys/bus/pnp/devices/00:07 create mode 120000 test/sys/bus/pnp/devices/00:08 create mode 120000 test/sys/bus/pnp/devices/00:09 create mode 120000 test/sys/bus/pnp/devices/00:0a create mode 120000 test/sys/bus/pnp/drivers/i8042 aux/00:09 create mode 120000 test/sys/bus/pnp/drivers/i8042 kbd/00:08 create mode 120000 test/sys/bus/pnp/drivers/rtc_cmos/00:07 create mode 120000 test/sys/bus/pnp/drivers/system/00:00 create mode 120000 test/sys/bus/pnp/drivers/system/00:02 create mode 100644 test/sys/bus/pnp/drivers_autoprobe create mode 100644 test/sys/bus/pnp/drivers_probe create mode 100644 test/sys/bus/pnp/uevent create mode 120000 test/sys/bus/scsi/devices/4:0:0:0 create mode 120000 test/sys/bus/scsi/devices/6:0:0:0 create mode 120000 test/sys/bus/scsi/devices/host0 create mode 120000 test/sys/bus/scsi/devices/host1 create mode 120000 test/sys/bus/scsi/devices/host2 create mode 120000 test/sys/bus/scsi/devices/host3 create mode 120000 test/sys/bus/scsi/devices/host4 create mode 120000 test/sys/bus/scsi/devices/host5 create mode 120000 test/sys/bus/scsi/devices/host6 create mode 120000 test/sys/bus/scsi/devices/target0:0:0 create mode 120000 test/sys/bus/scsi/devices/target4:0:0 create mode 120000 test/sys/bus/scsi/devices/target6:0:0 create mode 120000 test/sys/bus/scsi/drivers/sd/6:0:0:0 create mode 120000 test/sys/bus/scsi/drivers/sr/4:0:0:0 create mode 100644 test/sys/bus/scsi/drivers_autoprobe create mode 100644 test/sys/bus/scsi/drivers_probe create mode 100644 test/sys/bus/scsi/uevent create mode 120000 test/sys/bus/serio/devices/serio0 create mode 120000 test/sys/bus/serio/devices/serio1 create mode 100644 test/sys/bus/serio/drivers/atkbd/bind_mode create mode 100644 test/sys/bus/serio/drivers/atkbd/description create mode 120000 test/sys/bus/serio/drivers/atkbd/module create mode 120000 test/sys/bus/serio/drivers/atkbd/serio0 create mode 100644 test/sys/bus/serio/drivers/psmouse/bind_mode create mode 100644 test/sys/bus/serio/drivers/psmouse/description create mode 120000 test/sys/bus/serio/drivers/psmouse/module create mode 120000 test/sys/bus/serio/drivers/psmouse/serio1 create mode 100644 test/sys/bus/serio/drivers_autoprobe create mode 100644 test/sys/bus/serio/drivers_probe create mode 100644 test/sys/bus/serio/uevent delete mode 120000 test/sys/bus/usb-serial/devices/ttyUSB0 delete mode 120000 test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 create mode 120000 test/sys/bus/usb/devices/1-0:1.0 create mode 120000 test/sys/bus/usb/devices/2-0:1.0 create mode 120000 test/sys/bus/usb/devices/4-0:1.0 create mode 120000 test/sys/bus/usb/devices/4-1 create mode 120000 test/sys/bus/usb/devices/4-1:1.0 create mode 120000 test/sys/bus/usb/devices/4-1:1.1 create mode 120000 test/sys/bus/usb/devices/4-1:1.2 create mode 120000 test/sys/bus/usb/devices/4-1:1.3 create mode 120000 test/sys/bus/usb/devices/4-2 create mode 120000 test/sys/bus/usb/devices/4-2:1.0 create mode 120000 test/sys/bus/usb/devices/5-0:1.0 create mode 120000 test/sys/bus/usb/devices/5-1 create mode 120000 test/sys/bus/usb/devices/5-1:1.0 create mode 120000 test/sys/bus/usb/devices/5-1:1.1 create mode 120000 test/sys/bus/usb/devices/5-1:1.10 create mode 120000 test/sys/bus/usb/devices/5-1:1.11 create mode 120000 test/sys/bus/usb/devices/5-1:1.12 create mode 120000 test/sys/bus/usb/devices/5-1:1.13 create mode 120000 test/sys/bus/usb/devices/5-1:1.2 create mode 120000 test/sys/bus/usb/devices/5-1:1.3 create mode 120000 test/sys/bus/usb/devices/5-1:1.4 create mode 120000 test/sys/bus/usb/devices/5-1:1.5 create mode 120000 test/sys/bus/usb/devices/5-1:1.6 create mode 120000 test/sys/bus/usb/devices/5-1:1.9 create mode 120000 test/sys/bus/usb/devices/5-2 create mode 120000 test/sys/bus/usb/devices/5-2:1.0 create mode 120000 test/sys/bus/usb/devices/usb1 create mode 120000 test/sys/bus/usb/devices/usb2 create mode 120000 test/sys/bus/usb/devices/usb4 create mode 120000 test/sys/bus/usb/devices/usb5 create mode 120000 test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 create mode 120000 test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 create mode 120000 test/sys/bus/usb/drivers/cdc_acm/module create mode 120000 test/sys/bus/usb/drivers/hub/1-0:1.0 create mode 120000 test/sys/bus/usb/drivers/hub/2-0:1.0 create mode 120000 test/sys/bus/usb/drivers/hub/4-0:1.0 create mode 120000 test/sys/bus/usb/drivers/hub/5-0:1.0 create mode 120000 test/sys/bus/usb/drivers/hub/module delete mode 120000 test/sys/bus/usb/drivers/pl2303/3-1:1.0 create mode 120000 test/sys/bus/usb/drivers/usb-storage/5-2:1.0 create mode 120000 test/sys/bus/usb/drivers/usb-storage/module create mode 120000 test/sys/bus/usb/drivers/usb/4-1 create mode 120000 test/sys/bus/usb/drivers/usb/4-2 create mode 120000 test/sys/bus/usb/drivers/usb/5-1 create mode 120000 test/sys/bus/usb/drivers/usb/5-2 create mode 120000 test/sys/bus/usb/drivers/usb/module create mode 120000 test/sys/bus/usb/drivers/usb/usb1 create mode 120000 test/sys/bus/usb/drivers/usb/usb2 create mode 120000 test/sys/bus/usb/drivers/usb/usb4 create mode 120000 test/sys/bus/usb/drivers/usb/usb5 create mode 120000 test/sys/bus/usb/drivers/usbfs/module create mode 120000 test/sys/bus/usb/drivers/usbhid/3-1:1.0 create mode 120000 test/sys/bus/usb/drivers/usbhid/module create mode 100644 test/sys/bus/usb/drivers_autoprobe create mode 100644 test/sys/bus/usb/drivers_probe create mode 100644 test/sys/bus/usb/uevent create mode 120000 test/sys/class/bdi/0:16 create mode 120000 test/sys/class/bdi/11:0 create mode 120000 test/sys/class/bdi/7:0 create mode 120000 test/sys/class/bdi/7:1 create mode 120000 test/sys/class/bdi/7:2 create mode 120000 test/sys/class/bdi/7:3 create mode 120000 test/sys/class/bdi/7:4 create mode 120000 test/sys/class/bdi/7:5 create mode 120000 test/sys/class/bdi/7:6 create mode 120000 test/sys/class/bdi/7:7 create mode 120000 test/sys/class/bdi/8:0 create mode 120000 test/sys/class/bdi/8:16 create mode 120000 test/sys/class/bdi/9:0 create mode 120000 test/sys/class/bdi/default create mode 120000 test/sys/class/block/loop0 create mode 120000 test/sys/class/block/loop1 create mode 120000 test/sys/class/block/loop2 create mode 120000 test/sys/class/block/loop3 create mode 120000 test/sys/class/block/loop4 create mode 120000 test/sys/class/block/loop5 create mode 120000 test/sys/class/block/loop6 create mode 120000 test/sys/class/block/loop7 create mode 120000 test/sys/class/block/md0 create mode 120000 test/sys/class/block/sda create mode 120000 test/sys/class/block/sda1 create mode 120000 test/sys/class/block/sda10 create mode 120000 test/sys/class/block/sda5 create mode 120000 test/sys/class/block/sda6 create mode 120000 test/sys/class/block/sda7 create mode 120000 test/sys/class/block/sda8 create mode 120000 test/sys/class/block/sda9 create mode 120000 test/sys/class/block/sdb create mode 120000 test/sys/class/block/sdb1 create mode 120000 test/sys/class/block/sr0 create mode 120000 test/sys/class/bsg/0:0:0:0 create mode 120000 test/sys/class/bsg/4:0:0:0 create mode 120000 test/sys/class/bsg/6:0:0:0 create mode 120000 test/sys/class/dmi/id create mode 100644 test/sys/class/firmware/timeout create mode 120000 test/sys/class/graphics/fb0 create mode 120000 test/sys/class/graphics/fbcon create mode 120000 test/sys/class/hwmon/hwmon0 delete mode 100644 test/sys/class/i2c-dev/i2c-300/dev delete mode 100644 test/sys/class/i2c-dev/i2c-300/name delete mode 120000 test/sys/class/i2c-dev/i2c-300/subsystem delete mode 100644 test/sys/class/i2c-dev/i2c-fake1/dev delete mode 100644 test/sys/class/i2c-dev/i2c-fake1/name delete mode 120000 test/sys/class/i2c-dev/i2c-fake1/subsystem delete mode 100644 test/sys/class/i2c-dev/i2c-fake2/dev delete mode 100644 test/sys/class/i2c-dev/i2c-fake2/name delete mode 120000 test/sys/class/i2c-dev/i2c-fake2/subsystem create mode 120000 test/sys/class/ieee80211/phy0 create mode 120000 test/sys/class/input/event0 create mode 120000 test/sys/class/input/event1 create mode 120000 test/sys/class/input/event2 create mode 120000 test/sys/class/input/event3 create mode 120000 test/sys/class/input/event4 create mode 120000 test/sys/class/input/event5 create mode 120000 test/sys/class/input/event6 create mode 120000 test/sys/class/input/event7 create mode 120000 test/sys/class/input/input0 create mode 120000 test/sys/class/input/input1 create mode 120000 test/sys/class/input/input2 create mode 120000 test/sys/class/input/input3 create mode 120000 test/sys/class/input/input4 create mode 120000 test/sys/class/input/input5 create mode 120000 test/sys/class/input/input6 create mode 120000 test/sys/class/input/input7 create mode 120000 test/sys/class/input/mice create mode 120000 test/sys/class/input/mouse0 create mode 120000 test/sys/class/input/mouse1 create mode 120000 test/sys/class/leds/iwl-phy0:RX create mode 120000 test/sys/class/leds/iwl-phy0:TX create mode 120000 test/sys/class/leds/iwl-phy0:assoc create mode 120000 test/sys/class/leds/iwl-phy0:radio create mode 120000 test/sys/class/leds/tpacpi::bay_active create mode 120000 test/sys/class/leds/tpacpi::dock_active create mode 120000 test/sys/class/leds/tpacpi::dock_batt create mode 120000 test/sys/class/leds/tpacpi::power create mode 120000 test/sys/class/leds/tpacpi::standby create mode 120000 test/sys/class/leds/tpacpi::thinklight create mode 120000 test/sys/class/leds/tpacpi::unknown_led create mode 120000 test/sys/class/leds/tpacpi:green:batt create mode 120000 test/sys/class/leds/tpacpi:orange:batt create mode 120000 test/sys/class/mem/full delete mode 100644 test/sys/class/mem/full/dev delete mode 120000 test/sys/class/mem/full/subsystem create mode 120000 test/sys/class/mem/kmem delete mode 100644 test/sys/class/mem/kmem/dev delete mode 120000 test/sys/class/mem/kmem/subsystem create mode 120000 test/sys/class/mem/kmsg delete mode 100644 test/sys/class/mem/kmsg/dev delete mode 120000 test/sys/class/mem/kmsg/subsystem create mode 120000 test/sys/class/mem/mem delete mode 100644 test/sys/class/mem/mem/dev delete mode 120000 test/sys/class/mem/mem/subsystem create mode 120000 test/sys/class/mem/null delete mode 100644 test/sys/class/mem/null/dev delete mode 120000 test/sys/class/mem/null/subsystem create mode 120000 test/sys/class/mem/port delete mode 100644 test/sys/class/mem/port/dev delete mode 120000 test/sys/class/mem/port/subsystem create mode 120000 test/sys/class/mem/random delete mode 100644 test/sys/class/mem/random/dev delete mode 120000 test/sys/class/mem/random/subsystem create mode 120000 test/sys/class/mem/urandom delete mode 100644 test/sys/class/mem/urandom/dev delete mode 120000 test/sys/class/mem/urandom/subsystem create mode 120000 test/sys/class/mem/zero delete mode 100644 test/sys/class/mem/zero/dev delete mode 120000 test/sys/class/mem/zero/subsystem create mode 120000 test/sys/class/misc/cpu_dma_latency create mode 120000 test/sys/class/misc/device-mapper create mode 120000 test/sys/class/misc/fuse create mode 120000 test/sys/class/misc/hpet create mode 120000 test/sys/class/misc/mcelog create mode 120000 test/sys/class/misc/microcode create mode 120000 test/sys/class/misc/network_latency create mode 120000 test/sys/class/misc/network_throughput create mode 120000 test/sys/class/misc/nvram create mode 120000 test/sys/class/misc/psaux delete mode 100644 test/sys/class/misc/psaux/dev delete mode 120000 test/sys/class/misc/psaux/subsystem delete mode 100644 test/sys/class/misc/rtc/dev delete mode 120000 test/sys/class/misc/rtc/subsystem create mode 120000 test/sys/class/misc/uinput delete mode 100644 test/sys/class/misc/uinput/dev delete mode 120000 test/sys/class/misc/uinput/subsystem create mode 120000 test/sys/class/net/eth0 delete mode 100644 test/sys/class/net/eth0/addr_len delete mode 100644 test/sys/class/net/eth0/address delete mode 100644 test/sys/class/net/eth0/broadcast delete mode 100644 test/sys/class/net/eth0/features delete mode 100644 test/sys/class/net/eth0/flags delete mode 100644 test/sys/class/net/eth0/ifindex delete mode 100644 test/sys/class/net/eth0/iflink delete mode 100644 test/sys/class/net/eth0/mtu delete mode 120000 test/sys/class/net/eth0/subsystem delete mode 100644 test/sys/class/net/eth0/tx_queue_len delete mode 100644 test/sys/class/net/eth0/type delete mode 100644 test/sys/class/net/eth1/addr_len delete mode 100644 test/sys/class/net/eth1/address delete mode 100644 test/sys/class/net/eth1/broadcast delete mode 100644 test/sys/class/net/eth1/features delete mode 100644 test/sys/class/net/eth1/flags delete mode 100644 test/sys/class/net/eth1/ifindex delete mode 100644 test/sys/class/net/eth1/iflink delete mode 100644 test/sys/class/net/eth1/mtu delete mode 120000 test/sys/class/net/eth1/subsystem delete mode 100644 test/sys/class/net/eth1/tx_queue_len delete mode 100644 test/sys/class/net/eth1/type delete mode 100644 test/sys/class/net/eth1/wireless/beacon delete mode 100644 test/sys/class/net/eth1/wireless/crypt delete mode 100644 test/sys/class/net/eth1/wireless/fragment delete mode 100644 test/sys/class/net/eth1/wireless/level delete mode 100644 test/sys/class/net/eth1/wireless/link delete mode 100644 test/sys/class/net/eth1/wireless/misc delete mode 100644 test/sys/class/net/eth1/wireless/noise delete mode 100644 test/sys/class/net/eth1/wireless/nwid delete mode 100644 test/sys/class/net/eth1/wireless/retries delete mode 100644 test/sys/class/net/eth1/wireless/status create mode 120000 test/sys/class/net/lo delete mode 100644 test/sys/class/net/lo/addr_len delete mode 100644 test/sys/class/net/lo/address delete mode 100644 test/sys/class/net/lo/broadcast delete mode 100644 test/sys/class/net/lo/features delete mode 100644 test/sys/class/net/lo/flags delete mode 100644 test/sys/class/net/lo/ifindex delete mode 100644 test/sys/class/net/lo/iflink delete mode 100644 test/sys/class/net/lo/mtu delete mode 120000 test/sys/class/net/lo/subsystem delete mode 100644 test/sys/class/net/lo/tx_queue_len delete mode 100644 test/sys/class/net/lo/type create mode 120000 test/sys/class/net/wlan0 create mode 120000 test/sys/class/net/wmaster0 create mode 120000 test/sys/class/pci_bus/0000:00 create mode 120000 test/sys/class/pci_bus/0000:01 create mode 120000 test/sys/class/pci_bus/0000:02 create mode 120000 test/sys/class/pci_bus/0000:03 create mode 120000 test/sys/class/pci_bus/0000:04 create mode 120000 test/sys/class/pci_bus/0000:0c create mode 120000 test/sys/class/pci_bus/0000:15 create mode 120000 test/sys/class/pci_bus/0000:16 create mode 120000 test/sys/class/pcmcia_socket/pcmcia_socket0 create mode 120000 test/sys/class/power_supply/AC create mode 120000 test/sys/class/power_supply/BAT0 create mode 120000 test/sys/class/rfkill/rfkill0 create mode 120000 test/sys/class/rtc/rtc0 create mode 120000 test/sys/class/scsi_device/0:0:0:0 create mode 120000 test/sys/class/scsi_device/4:0:0:0 create mode 120000 test/sys/class/scsi_device/6:0:0:0 create mode 120000 test/sys/class/scsi_disk/0:0:0:0 create mode 120000 test/sys/class/scsi_disk/6:0:0:0 create mode 120000 test/sys/class/scsi_generic/sg0 create mode 120000 test/sys/class/scsi_generic/sg1 create mode 120000 test/sys/class/scsi_generic/sg2 create mode 120000 test/sys/class/scsi_host/host0 create mode 120000 test/sys/class/scsi_host/host1 create mode 120000 test/sys/class/scsi_host/host2 create mode 120000 test/sys/class/scsi_host/host3 create mode 120000 test/sys/class/scsi_host/host4 create mode 120000 test/sys/class/scsi_host/host5 create mode 120000 test/sys/class/scsi_host/host6 create mode 120000 test/sys/class/sound/adsp create mode 120000 test/sys/class/sound/audio create mode 120000 test/sys/class/sound/card0 create mode 120000 test/sys/class/sound/controlC0 create mode 120000 test/sys/class/sound/dsp create mode 120000 test/sys/class/sound/mixer create mode 120000 test/sys/class/sound/pcmC0D0c create mode 120000 test/sys/class/sound/pcmC0D0p create mode 120000 test/sys/class/sound/pcmC0D1p create mode 120000 test/sys/class/sound/seq create mode 120000 test/sys/class/sound/timer create mode 120000 test/sys/class/thermal/cooling_device0 create mode 120000 test/sys/class/thermal/cooling_device1 create mode 120000 test/sys/class/thermal/thermal_zone0 create mode 120000 test/sys/class/thermal/thermal_zone1 create mode 120000 test/sys/class/tty/console delete mode 100644 test/sys/class/tty/console/dev delete mode 120000 test/sys/class/tty/console/subsystem create mode 120000 test/sys/class/tty/ptmx delete mode 100644 test/sys/class/tty/ptmx/dev delete mode 120000 test/sys/class/tty/ptmx/subsystem create mode 120000 test/sys/class/tty/tty delete mode 100644 test/sys/class/tty/tty/dev delete mode 120000 test/sys/class/tty/tty/subsystem create mode 120000 test/sys/class/tty/tty0 delete mode 100644 test/sys/class/tty/tty0/dev delete mode 120000 test/sys/class/tty/tty0/subsystem create mode 120000 test/sys/class/tty/tty1 delete mode 100644 test/sys/class/tty/tty1/dev delete mode 120000 test/sys/class/tty/tty1/subsystem create mode 120000 test/sys/class/tty/tty10 delete mode 100644 test/sys/class/tty/tty10/dev delete mode 120000 test/sys/class/tty/tty10/subsystem create mode 120000 test/sys/class/tty/tty11 delete mode 100644 test/sys/class/tty/tty11/dev delete mode 120000 test/sys/class/tty/tty11/subsystem create mode 120000 test/sys/class/tty/tty12 delete mode 100644 test/sys/class/tty/tty12/dev delete mode 120000 test/sys/class/tty/tty12/subsystem create mode 120000 test/sys/class/tty/tty13 delete mode 100644 test/sys/class/tty/tty13/dev delete mode 120000 test/sys/class/tty/tty13/subsystem create mode 120000 test/sys/class/tty/tty14 delete mode 100644 test/sys/class/tty/tty14/dev delete mode 120000 test/sys/class/tty/tty14/subsystem create mode 120000 test/sys/class/tty/tty15 delete mode 100644 test/sys/class/tty/tty15/dev delete mode 120000 test/sys/class/tty/tty15/subsystem create mode 120000 test/sys/class/tty/tty16 delete mode 100644 test/sys/class/tty/tty16/dev delete mode 120000 test/sys/class/tty/tty16/subsystem create mode 120000 test/sys/class/tty/tty17 delete mode 100644 test/sys/class/tty/tty17/dev delete mode 120000 test/sys/class/tty/tty17/subsystem create mode 120000 test/sys/class/tty/tty18 delete mode 100644 test/sys/class/tty/tty18/dev delete mode 120000 test/sys/class/tty/tty18/subsystem create mode 120000 test/sys/class/tty/tty19 delete mode 100644 test/sys/class/tty/tty19/dev delete mode 120000 test/sys/class/tty/tty19/subsystem create mode 120000 test/sys/class/tty/tty2 delete mode 100644 test/sys/class/tty/tty2/dev delete mode 120000 test/sys/class/tty/tty2/subsystem create mode 120000 test/sys/class/tty/tty20 delete mode 100644 test/sys/class/tty/tty20/dev delete mode 120000 test/sys/class/tty/tty20/subsystem create mode 120000 test/sys/class/tty/tty21 delete mode 100644 test/sys/class/tty/tty21/dev delete mode 120000 test/sys/class/tty/tty21/subsystem create mode 120000 test/sys/class/tty/tty22 delete mode 100644 test/sys/class/tty/tty22/dev delete mode 120000 test/sys/class/tty/tty22/subsystem create mode 120000 test/sys/class/tty/tty23 delete mode 100644 test/sys/class/tty/tty23/dev delete mode 120000 test/sys/class/tty/tty23/subsystem create mode 120000 test/sys/class/tty/tty24 delete mode 100644 test/sys/class/tty/tty24/dev delete mode 120000 test/sys/class/tty/tty24/subsystem create mode 120000 test/sys/class/tty/tty25 delete mode 100644 test/sys/class/tty/tty25/dev delete mode 120000 test/sys/class/tty/tty25/subsystem create mode 120000 test/sys/class/tty/tty26 delete mode 100644 test/sys/class/tty/tty26/dev delete mode 120000 test/sys/class/tty/tty26/subsystem create mode 120000 test/sys/class/tty/tty27 delete mode 100644 test/sys/class/tty/tty27/dev delete mode 120000 test/sys/class/tty/tty27/subsystem create mode 120000 test/sys/class/tty/tty28 delete mode 100644 test/sys/class/tty/tty28/dev delete mode 120000 test/sys/class/tty/tty28/subsystem create mode 120000 test/sys/class/tty/tty29 delete mode 100644 test/sys/class/tty/tty29/dev delete mode 120000 test/sys/class/tty/tty29/subsystem create mode 120000 test/sys/class/tty/tty3 delete mode 100644 test/sys/class/tty/tty3/dev delete mode 120000 test/sys/class/tty/tty3/subsystem create mode 120000 test/sys/class/tty/tty30 delete mode 100644 test/sys/class/tty/tty30/dev delete mode 120000 test/sys/class/tty/tty30/subsystem create mode 120000 test/sys/class/tty/tty31 delete mode 100644 test/sys/class/tty/tty31/dev delete mode 120000 test/sys/class/tty/tty31/subsystem create mode 120000 test/sys/class/tty/tty32 delete mode 100644 test/sys/class/tty/tty32/dev delete mode 120000 test/sys/class/tty/tty32/subsystem create mode 120000 test/sys/class/tty/tty33 delete mode 100644 test/sys/class/tty/tty33/dev delete mode 120000 test/sys/class/tty/tty33/subsystem create mode 120000 test/sys/class/tty/tty34 delete mode 100644 test/sys/class/tty/tty34/dev delete mode 120000 test/sys/class/tty/tty34/subsystem create mode 120000 test/sys/class/tty/tty35 delete mode 100644 test/sys/class/tty/tty35/dev delete mode 120000 test/sys/class/tty/tty35/subsystem create mode 120000 test/sys/class/tty/tty36 delete mode 100644 test/sys/class/tty/tty36/dev delete mode 120000 test/sys/class/tty/tty36/subsystem create mode 120000 test/sys/class/tty/tty37 delete mode 100644 test/sys/class/tty/tty37/dev delete mode 120000 test/sys/class/tty/tty37/subsystem create mode 120000 test/sys/class/tty/tty38 delete mode 100644 test/sys/class/tty/tty38/dev delete mode 120000 test/sys/class/tty/tty38/subsystem create mode 120000 test/sys/class/tty/tty39 delete mode 100644 test/sys/class/tty/tty39/dev delete mode 120000 test/sys/class/tty/tty39/subsystem create mode 120000 test/sys/class/tty/tty4 delete mode 100644 test/sys/class/tty/tty4/dev delete mode 120000 test/sys/class/tty/tty4/subsystem create mode 120000 test/sys/class/tty/tty40 delete mode 100644 test/sys/class/tty/tty40/dev delete mode 120000 test/sys/class/tty/tty40/subsystem create mode 120000 test/sys/class/tty/tty41 delete mode 100644 test/sys/class/tty/tty41/dev delete mode 120000 test/sys/class/tty/tty41/subsystem create mode 120000 test/sys/class/tty/tty42 delete mode 100644 test/sys/class/tty/tty42/dev delete mode 120000 test/sys/class/tty/tty42/subsystem create mode 120000 test/sys/class/tty/tty43 delete mode 100644 test/sys/class/tty/tty43/dev delete mode 120000 test/sys/class/tty/tty43/subsystem create mode 120000 test/sys/class/tty/tty44 delete mode 100644 test/sys/class/tty/tty44/dev delete mode 120000 test/sys/class/tty/tty44/subsystem create mode 120000 test/sys/class/tty/tty45 delete mode 100644 test/sys/class/tty/tty45/dev delete mode 120000 test/sys/class/tty/tty45/subsystem create mode 120000 test/sys/class/tty/tty46 delete mode 100644 test/sys/class/tty/tty46/dev delete mode 120000 test/sys/class/tty/tty46/subsystem create mode 120000 test/sys/class/tty/tty47 delete mode 100644 test/sys/class/tty/tty47/dev delete mode 120000 test/sys/class/tty/tty47/subsystem create mode 120000 test/sys/class/tty/tty48 delete mode 100644 test/sys/class/tty/tty48/dev delete mode 120000 test/sys/class/tty/tty48/subsystem create mode 120000 test/sys/class/tty/tty49 delete mode 100644 test/sys/class/tty/tty49/dev delete mode 120000 test/sys/class/tty/tty49/subsystem create mode 120000 test/sys/class/tty/tty5 delete mode 100644 test/sys/class/tty/tty5/dev delete mode 120000 test/sys/class/tty/tty5/subsystem create mode 120000 test/sys/class/tty/tty50 delete mode 100644 test/sys/class/tty/tty50/dev delete mode 120000 test/sys/class/tty/tty50/subsystem create mode 120000 test/sys/class/tty/tty51 delete mode 100644 test/sys/class/tty/tty51/dev delete mode 120000 test/sys/class/tty/tty51/subsystem create mode 120000 test/sys/class/tty/tty52 delete mode 100644 test/sys/class/tty/tty52/dev delete mode 120000 test/sys/class/tty/tty52/subsystem create mode 120000 test/sys/class/tty/tty53 delete mode 100644 test/sys/class/tty/tty53/dev delete mode 120000 test/sys/class/tty/tty53/subsystem create mode 120000 test/sys/class/tty/tty54 delete mode 100644 test/sys/class/tty/tty54/dev delete mode 120000 test/sys/class/tty/tty54/subsystem create mode 120000 test/sys/class/tty/tty55 delete mode 100644 test/sys/class/tty/tty55/dev delete mode 120000 test/sys/class/tty/tty55/subsystem create mode 120000 test/sys/class/tty/tty56 delete mode 100644 test/sys/class/tty/tty56/dev delete mode 120000 test/sys/class/tty/tty56/subsystem create mode 120000 test/sys/class/tty/tty57 delete mode 100644 test/sys/class/tty/tty57/dev delete mode 120000 test/sys/class/tty/tty57/subsystem create mode 120000 test/sys/class/tty/tty58 delete mode 100644 test/sys/class/tty/tty58/dev delete mode 120000 test/sys/class/tty/tty58/subsystem create mode 120000 test/sys/class/tty/tty59 delete mode 100644 test/sys/class/tty/tty59/dev delete mode 120000 test/sys/class/tty/tty59/subsystem create mode 120000 test/sys/class/tty/tty6 delete mode 100644 test/sys/class/tty/tty6/dev delete mode 120000 test/sys/class/tty/tty6/subsystem create mode 120000 test/sys/class/tty/tty60 delete mode 100644 test/sys/class/tty/tty60/dev delete mode 120000 test/sys/class/tty/tty60/subsystem create mode 120000 test/sys/class/tty/tty61 delete mode 100644 test/sys/class/tty/tty61/dev delete mode 120000 test/sys/class/tty/tty61/subsystem create mode 120000 test/sys/class/tty/tty62 delete mode 100644 test/sys/class/tty/tty62/dev delete mode 120000 test/sys/class/tty/tty62/subsystem create mode 120000 test/sys/class/tty/tty63 delete mode 100644 test/sys/class/tty/tty63/dev delete mode 120000 test/sys/class/tty/tty63/subsystem create mode 120000 test/sys/class/tty/tty7 delete mode 100644 test/sys/class/tty/tty7/dev delete mode 120000 test/sys/class/tty/tty7/subsystem create mode 120000 test/sys/class/tty/tty8 delete mode 100644 test/sys/class/tty/tty8/dev delete mode 120000 test/sys/class/tty/tty8/subsystem create mode 120000 test/sys/class/tty/tty9 delete mode 100644 test/sys/class/tty/tty9/dev delete mode 120000 test/sys/class/tty/tty9/subsystem create mode 120000 test/sys/class/tty/ttyACM0 create mode 120000 test/sys/class/tty/ttyS0 delete mode 100644 test/sys/class/tty/ttyS0/dev delete mode 120000 test/sys/class/tty/ttyS0/subsystem create mode 120000 test/sys/class/tty/ttyS1 delete mode 100644 test/sys/class/tty/ttyS1/dev delete mode 120000 test/sys/class/tty/ttyS1/subsystem create mode 120000 test/sys/class/tty/ttyS2 delete mode 100644 test/sys/class/tty/ttyS2/dev delete mode 120000 test/sys/class/tty/ttyS2/subsystem create mode 120000 test/sys/class/tty/ttyS3 delete mode 100644 test/sys/class/tty/ttyS3/dev delete mode 120000 test/sys/class/tty/ttyS3/subsystem delete mode 100644 test/sys/class/tty/ttyS4/dev delete mode 120000 test/sys/class/tty/ttyS4/subsystem delete mode 100644 test/sys/class/tty/ttyS5/dev delete mode 120000 test/sys/class/tty/ttyS5/subsystem delete mode 100644 test/sys/class/tty/ttyS6/dev delete mode 120000 test/sys/class/tty/ttyS6/subsystem delete mode 100644 test/sys/class/tty/ttyS7/dev delete mode 120000 test/sys/class/tty/ttyS7/subsystem delete mode 100644 test/sys/class/tty/ttyUSB0/dev delete mode 120000 test/sys/class/tty/ttyUSB0/device delete mode 120000 test/sys/class/tty/ttyUSB0/subsystem create mode 120000 test/sys/class/usb_endpoint/usbdev1.1_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev1.1_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev2.1_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev2.1_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev3.1_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev3.1_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev3.3_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev3.3_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev4.1_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev4.1_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep02 create mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep03 create mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep04 create mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep82 create mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep83 create mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep84 create mode 120000 test/sys/class/usb_endpoint/usbdev4.3_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev4.3_ep02 create mode 120000 test/sys/class/usb_endpoint/usbdev4.3_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev4.3_ep83 create mode 120000 test/sys/class/usb_endpoint/usbdev5.1_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev5.1_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep01 create mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep02 create mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep82 create mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep83 create mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep84 create mode 120000 test/sys/class/usb_endpoint/usbdev5.6_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev5.6_ep02 create mode 120000 test/sys/class/usb_endpoint/usbdev5.6_ep81 create mode 120000 test/sys/class/usb_host/usb_host1 create mode 120000 test/sys/class/usb_host/usb_host2 create mode 120000 test/sys/class/usb_host/usb_host3 create mode 120000 test/sys/class/usb_host/usb_host4 create mode 120000 test/sys/class/usb_host/usb_host5 create mode 120000 test/sys/class/vc/vcs create mode 120000 test/sys/class/vc/vcs1 create mode 120000 test/sys/class/vc/vcs10 create mode 120000 test/sys/class/vc/vcs2 create mode 120000 test/sys/class/vc/vcs3 create mode 120000 test/sys/class/vc/vcs4 create mode 120000 test/sys/class/vc/vcs5 create mode 120000 test/sys/class/vc/vcs6 create mode 120000 test/sys/class/vc/vcs7 create mode 120000 test/sys/class/vc/vcsa create mode 120000 test/sys/class/vc/vcsa1 create mode 120000 test/sys/class/vc/vcsa10 create mode 120000 test/sys/class/vc/vcsa2 create mode 120000 test/sys/class/vc/vcsa3 create mode 120000 test/sys/class/vc/vcsa4 create mode 120000 test/sys/class/vc/vcsa5 create mode 120000 test/sys/class/vc/vcsa6 create mode 120000 test/sys/class/vc/vcsa7 create mode 120000 test/sys/class/vtconsole/vtcon0 create mode 120000 test/sys/class/vtconsole/vtcon1 create mode 120000 test/sys/dev/block/11:0 create mode 120000 test/sys/dev/block/7:0 create mode 120000 test/sys/dev/block/7:1 create mode 120000 test/sys/dev/block/7:2 create mode 120000 test/sys/dev/block/7:3 create mode 120000 test/sys/dev/block/7:4 create mode 120000 test/sys/dev/block/7:5 create mode 120000 test/sys/dev/block/7:6 create mode 120000 test/sys/dev/block/7:7 create mode 120000 test/sys/dev/block/8:0 create mode 120000 test/sys/dev/block/8:1 create mode 120000 test/sys/dev/block/8:10 create mode 120000 test/sys/dev/block/8:16 create mode 120000 test/sys/dev/block/8:17 create mode 120000 test/sys/dev/block/8:5 create mode 120000 test/sys/dev/block/8:6 create mode 120000 test/sys/dev/block/8:7 create mode 120000 test/sys/dev/block/8:8 create mode 120000 test/sys/dev/block/8:9 create mode 120000 test/sys/dev/block/9:0 create mode 120000 test/sys/dev/char/10:1 create mode 120000 test/sys/dev/char/10:144 create mode 120000 test/sys/dev/char/10:184 create mode 120000 test/sys/dev/char/10:223 create mode 120000 test/sys/dev/char/10:227 create mode 120000 test/sys/dev/char/10:228 create mode 120000 test/sys/dev/char/10:229 create mode 120000 test/sys/dev/char/10:60 create mode 120000 test/sys/dev/char/10:61 create mode 120000 test/sys/dev/char/10:62 create mode 120000 test/sys/dev/char/10:63 create mode 120000 test/sys/dev/char/116:0 create mode 120000 test/sys/dev/char/116:1 create mode 120000 test/sys/dev/char/116:16 create mode 120000 test/sys/dev/char/116:17 create mode 120000 test/sys/dev/char/116:24 create mode 120000 test/sys/dev/char/116:33 create mode 120000 test/sys/dev/char/13:32 create mode 120000 test/sys/dev/char/13:33 create mode 120000 test/sys/dev/char/13:63 create mode 120000 test/sys/dev/char/13:64 create mode 120000 test/sys/dev/char/13:65 create mode 120000 test/sys/dev/char/13:66 create mode 120000 test/sys/dev/char/13:67 create mode 120000 test/sys/dev/char/13:68 create mode 120000 test/sys/dev/char/13:69 create mode 120000 test/sys/dev/char/13:70 create mode 120000 test/sys/dev/char/13:71 create mode 120000 test/sys/dev/char/14:0 create mode 120000 test/sys/dev/char/14:12 create mode 120000 test/sys/dev/char/14:3 create mode 120000 test/sys/dev/char/14:4 create mode 120000 test/sys/dev/char/166:0 create mode 120000 test/sys/dev/char/189:0 create mode 120000 test/sys/dev/char/189:128 create mode 120000 test/sys/dev/char/189:256 create mode 120000 test/sys/dev/char/189:258 create mode 120000 test/sys/dev/char/189:384 create mode 120000 test/sys/dev/char/189:385 create mode 120000 test/sys/dev/char/189:386 create mode 120000 test/sys/dev/char/189:512 create mode 120000 test/sys/dev/char/189:516 create mode 120000 test/sys/dev/char/189:517 create mode 120000 test/sys/dev/char/1:1 create mode 120000 test/sys/dev/char/1:11 create mode 120000 test/sys/dev/char/1:2 create mode 120000 test/sys/dev/char/1:3 create mode 120000 test/sys/dev/char/1:4 create mode 120000 test/sys/dev/char/1:5 create mode 120000 test/sys/dev/char/1:7 create mode 120000 test/sys/dev/char/1:8 create mode 120000 test/sys/dev/char/1:9 create mode 120000 test/sys/dev/char/21:0 create mode 120000 test/sys/dev/char/21:1 create mode 120000 test/sys/dev/char/21:2 create mode 120000 test/sys/dev/char/252:0 create mode 120000 test/sys/dev/char/252:1 create mode 120000 test/sys/dev/char/252:10 create mode 120000 test/sys/dev/char/252:11 create mode 120000 test/sys/dev/char/252:12 create mode 120000 test/sys/dev/char/252:13 create mode 120000 test/sys/dev/char/252:14 create mode 120000 test/sys/dev/char/252:15 create mode 120000 test/sys/dev/char/252:16 create mode 120000 test/sys/dev/char/252:17 create mode 120000 test/sys/dev/char/252:18 create mode 120000 test/sys/dev/char/252:19 create mode 120000 test/sys/dev/char/252:2 create mode 120000 test/sys/dev/char/252:20 create mode 120000 test/sys/dev/char/252:21 create mode 120000 test/sys/dev/char/252:22 create mode 120000 test/sys/dev/char/252:23 create mode 120000 test/sys/dev/char/252:24 create mode 120000 test/sys/dev/char/252:25 create mode 120000 test/sys/dev/char/252:26 create mode 120000 test/sys/dev/char/252:27 create mode 120000 test/sys/dev/char/252:28 create mode 120000 test/sys/dev/char/252:29 create mode 120000 test/sys/dev/char/252:3 create mode 120000 test/sys/dev/char/252:30 create mode 120000 test/sys/dev/char/252:31 create mode 120000 test/sys/dev/char/252:32 create mode 120000 test/sys/dev/char/252:33 create mode 120000 test/sys/dev/char/252:4 create mode 120000 test/sys/dev/char/252:5 create mode 120000 test/sys/dev/char/252:6 create mode 120000 test/sys/dev/char/252:7 create mode 120000 test/sys/dev/char/252:8 create mode 120000 test/sys/dev/char/252:9 create mode 120000 test/sys/dev/char/253:0 create mode 120000 test/sys/dev/char/254:0 create mode 120000 test/sys/dev/char/254:1 create mode 120000 test/sys/dev/char/254:2 create mode 120000 test/sys/dev/char/29:0 create mode 120000 test/sys/dev/char/4:0 create mode 120000 test/sys/dev/char/4:1 create mode 120000 test/sys/dev/char/4:10 create mode 120000 test/sys/dev/char/4:11 create mode 120000 test/sys/dev/char/4:12 create mode 120000 test/sys/dev/char/4:13 create mode 120000 test/sys/dev/char/4:14 create mode 120000 test/sys/dev/char/4:15 create mode 120000 test/sys/dev/char/4:16 create mode 120000 test/sys/dev/char/4:17 create mode 120000 test/sys/dev/char/4:18 create mode 120000 test/sys/dev/char/4:19 create mode 120000 test/sys/dev/char/4:2 create mode 120000 test/sys/dev/char/4:20 create mode 120000 test/sys/dev/char/4:21 create mode 120000 test/sys/dev/char/4:22 create mode 120000 test/sys/dev/char/4:23 create mode 120000 test/sys/dev/char/4:24 create mode 120000 test/sys/dev/char/4:25 create mode 120000 test/sys/dev/char/4:26 create mode 120000 test/sys/dev/char/4:27 create mode 120000 test/sys/dev/char/4:28 create mode 120000 test/sys/dev/char/4:29 create mode 120000 test/sys/dev/char/4:3 create mode 120000 test/sys/dev/char/4:30 create mode 120000 test/sys/dev/char/4:31 create mode 120000 test/sys/dev/char/4:32 create mode 120000 test/sys/dev/char/4:33 create mode 120000 test/sys/dev/char/4:34 create mode 120000 test/sys/dev/char/4:35 create mode 120000 test/sys/dev/char/4:36 create mode 120000 test/sys/dev/char/4:37 create mode 120000 test/sys/dev/char/4:38 create mode 120000 test/sys/dev/char/4:39 create mode 120000 test/sys/dev/char/4:4 create mode 120000 test/sys/dev/char/4:40 create mode 120000 test/sys/dev/char/4:41 create mode 120000 test/sys/dev/char/4:42 create mode 120000 test/sys/dev/char/4:43 create mode 120000 test/sys/dev/char/4:44 create mode 120000 test/sys/dev/char/4:45 create mode 120000 test/sys/dev/char/4:46 create mode 120000 test/sys/dev/char/4:47 create mode 120000 test/sys/dev/char/4:48 create mode 120000 test/sys/dev/char/4:49 create mode 120000 test/sys/dev/char/4:5 create mode 120000 test/sys/dev/char/4:50 create mode 120000 test/sys/dev/char/4:51 create mode 120000 test/sys/dev/char/4:52 create mode 120000 test/sys/dev/char/4:53 create mode 120000 test/sys/dev/char/4:54 create mode 120000 test/sys/dev/char/4:55 create mode 120000 test/sys/dev/char/4:56 create mode 120000 test/sys/dev/char/4:57 create mode 120000 test/sys/dev/char/4:58 create mode 120000 test/sys/dev/char/4:59 create mode 120000 test/sys/dev/char/4:6 create mode 120000 test/sys/dev/char/4:60 create mode 120000 test/sys/dev/char/4:61 create mode 120000 test/sys/dev/char/4:62 create mode 120000 test/sys/dev/char/4:63 create mode 120000 test/sys/dev/char/4:64 create mode 120000 test/sys/dev/char/4:65 create mode 120000 test/sys/dev/char/4:66 create mode 120000 test/sys/dev/char/4:67 create mode 120000 test/sys/dev/char/4:7 create mode 120000 test/sys/dev/char/4:8 create mode 120000 test/sys/dev/char/4:9 create mode 120000 test/sys/dev/char/5:0 create mode 120000 test/sys/dev/char/5:1 create mode 120000 test/sys/dev/char/5:2 create mode 120000 test/sys/dev/char/7:0 create mode 120000 test/sys/dev/char/7:1 create mode 120000 test/sys/dev/char/7:10 create mode 120000 test/sys/dev/char/7:128 create mode 120000 test/sys/dev/char/7:129 create mode 120000 test/sys/dev/char/7:130 create mode 120000 test/sys/dev/char/7:131 create mode 120000 test/sys/dev/char/7:132 create mode 120000 test/sys/dev/char/7:133 create mode 120000 test/sys/dev/char/7:134 create mode 120000 test/sys/dev/char/7:135 create mode 120000 test/sys/dev/char/7:138 create mode 120000 test/sys/dev/char/7:2 create mode 120000 test/sys/dev/char/7:3 create mode 120000 test/sys/dev/char/7:4 create mode 120000 test/sys/dev/char/7:5 create mode 120000 test/sys/dev/char/7:6 create mode 120000 test/sys/dev/char/7:7 create mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem create mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev create mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:00/thermal_cooling create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/path create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem create mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev create mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:01/thermal_cooling create mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/abs create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ev create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ff create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/key create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/led create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/msc create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/rel create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/snd create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/sw create mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/device create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/dev create mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/device create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/bustype create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/product create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/version create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/name create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/phys create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem create mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/thermal_zone create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem create mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/thermal_zone create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/device create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/type create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power/wakeup create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full_design create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/manufacturer create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/model_name create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/wakeup create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/present create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/serial_number create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/technology create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/path create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/physical_node create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/abs create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ev create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ff create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/key create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/led create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/msc create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/rel create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/snd create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/sw create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/device create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/dev create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/device create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/bustype create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/product create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/vendor create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/version create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/name create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/phys create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uniq create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/abs create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ev create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ff create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/key create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/led create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/msc create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/rel create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/snd create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/sw create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/device create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/dev create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/device create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/bustype create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/product create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/vendor create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/version create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/name create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/phys create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uniq create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/uevent create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/driver create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/device:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/device:00/uevent create mode 100644 test/sys/devices/LNXSYSTM:00/hid create mode 100644 test/sys/devices/LNXSYSTM:00/modalias create mode 100644 test/sys/devices/LNXSYSTM:00/path create mode 100644 test/sys/devices/LNXSYSTM:00/power/wakeup create mode 120000 test/sys/devices/LNXSYSTM:00/subsystem create mode 100644 test/sys/devices/LNXSYSTM:00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/enable create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/resource create mode 120000 test/sys/devices/pci0000:00/0000:00:00.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0 create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0_wc create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource1 create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource2 create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom create mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/device create mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/cpuaffinity create mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/device create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/resource create mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/pools delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/power/state delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/iInterface delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/power/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/iInterface delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/power/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/power/state delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/power/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/bmAttributes delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/power/state delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/serial delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/usb3/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:09.0/usb3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:09.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/resource0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/uevent create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/uevent create mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/enable create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/addr_len create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/address create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/broadcast create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/carrier create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dev_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dormant create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/features create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/flags create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/ifindex create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/iflink create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/link_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/mtu create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/operstate create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/collisions create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/multicast create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_bytes create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_compressed create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_crc_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_dropped create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_fifo_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_frame_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_length_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_missed_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_over_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_packets create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_aborted_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_bytes create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_carrier_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_compressed create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_dropped create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_fifo_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_heartbeat_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_packets create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_window_errors create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/tx_queue_len create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource2 create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/cpuaffinity create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/resource create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/antenna create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/channels create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/enable create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/filter_flags create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/flags create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/macaddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/brightness create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/trigger create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/brightness create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/trigger create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/brightness create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/trigger create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/brightness create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/trigger create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/measurement create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/address create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/carrier create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dormant create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/features create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/flags create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/iflink create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/mtu create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/operstate create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/collisions create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/multicast create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_compressed create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_crc_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_dropped create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_fifo_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_frame_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_length_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_missed_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_over_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_aborted_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_carrier_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_compressed create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_dropped create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_fifo_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_heartbeat_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_window_errors create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/tx_queue_len create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/beacon create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/crypt create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/fragment create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/misc create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/nwid create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/retries create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/status create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/addr_len create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/address create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/broadcast create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/features create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/flags create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/link_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/operstate create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/phy80211 create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/collisions create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/multicast create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_bytes create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_compressed create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_crc_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_dropped create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_fifo_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_frame_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_length_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_missed_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_over_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_packets create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_aborted_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_bytes create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_carrier_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_compressed create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_dropped create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_fifo_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_heartbeat_errors create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_packets create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_window_errors create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/tx_queue_len create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power_level create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/retry_rate create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/status create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/cpuaffinity create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/resource create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/cpuaffinity create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/resource create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/cpuaffinity create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/resource create mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/pools create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/resource4 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized_default create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/serial create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/version create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/pools create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/resource4 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized_default create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/serial create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/version create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/pools create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/resource4 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/abs create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ff create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/key create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/led create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/msc create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/rel create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/snd create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/sw create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/bustype create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/version create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/name create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/phys create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uniq create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/persist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/version create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized_default create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/serial create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/version create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/pools create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/resource4 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/persist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/version create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/persist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/version create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized_default create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/serial create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/version create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/device_blocked delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/model delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/online delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/queue_depth delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/rev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/scsi_level delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/whitespace_test delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/cpuaffinity create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_io create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_mem create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_setup_done create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_irq_mask create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_pm_state create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vcc create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_voltage create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vpp create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/cis create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource0 create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/yenta_registers create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/cpuaffinity create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.0/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/resource create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/active_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/can_queue create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/host_busy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/proc_name create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_capabilities create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_guard_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/sg_tablesize create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/supported_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unchecked_isa_dma create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unique_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/subsystem create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/bdi create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/capability create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/hw_sector_size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_max create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_penalty create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_async create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_sync create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/quantum create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async_rq create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_idle create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_sync create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_hw_sectors_kb create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_sectors_kb create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nomerges create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nr_requests create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/read_ahead_kb create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/scheduler create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/range create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/removable create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/ro create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/device_blocked create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/evt_media_change create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iocounterbits create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/ioerr_cnt create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/model create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_depth create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_level create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/active_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/can_queue create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/host_busy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/proc_name create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_capabilities create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_guard_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/sg_tablesize create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/supported_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unchecked_isa_dma create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unique_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host5/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource1 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource2 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource3 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource4 create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/active_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/can_queue create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/host_busy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/proc_name create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_capabilities create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_guard_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/sg_tablesize create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/supported_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unchecked_isa_dma create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unique_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/subsystem create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/bdi create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/capability create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/bsg create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/hw_sector_size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_max create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_penalty create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_async create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_sync create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/quantum create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async_rq create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_idle create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_sync create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_hw_sectors_kb create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_sectors_kb create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nomerges create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nr_requests create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/read_ahead_kb create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/scheduler create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/range create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/removable create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/ro create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/start create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/start create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/start create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/start create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/start create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/start create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/start create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test:colon+plus create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/device_blocked create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/evt_media_change create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iocounterbits create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/model create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_depth create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/allow_restart create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/app_tag_own create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/cache_type create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/protection_type create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_level create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/sw_activity create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/whitespace_test create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/active_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/can_queue create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/host_busy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/link_power_management_policy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/proc_name create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_capabilities create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_guard_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/sg_tablesize create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/supported_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unchecked_isa_dma create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unique_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/active_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/can_queue create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/host_busy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/link_power_management_policy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/proc_name create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_capabilities create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_guard_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/sg_tablesize create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/supported_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unchecked_isa_dma create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unique_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/active_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/can_queue create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/host_busy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/link_power_management_policy create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/proc_name create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_capabilities create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_guard_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/sg_tablesize create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/supported_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unchecked_isa_dma create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unique_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host3/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource1 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource2 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource3 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource4 create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource5 create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.3/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/resource4 create mode 120000 test/sys/devices/pci0000:00/0000:00:1f.3/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/vendor create mode 120000 test/sys/devices/pci0000:00/firmware_node create mode 100644 test/sys/devices/pci0000:00/pci_bus/0000:00/cpuaffinity create mode 120000 test/sys/devices/pci0000:00/pci_bus/0000:00/device create mode 100644 test/sys/devices/pci0000:00/pci_bus/0000:00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/pci_bus/0000:00/subsystem create mode 100644 test/sys/devices/pci0000:00/pci_bus/0000:00/uevent create mode 100644 test/sys/devices/pci0000:00/power/wakeup create mode 100644 test/sys/devices/pci0000:00/uevent create mode 100644 test/sys/devices/platform/dock.0/docked create mode 100644 test/sys/devices/platform/dock.0/flags create mode 100644 test/sys/devices/platform/dock.0/modalias create mode 100644 test/sys/devices/platform/dock.0/power/wakeup create mode 120000 test/sys/devices/platform/dock.0/subsystem create mode 100644 test/sys/devices/platform/dock.0/uevent create mode 100644 test/sys/devices/platform/dock.0/uid create mode 120000 test/sys/devices/platform/i8042/driver create mode 100644 test/sys/devices/platform/i8042/modalias create mode 100644 test/sys/devices/platform/i8042/power/wakeup create mode 100644 test/sys/devices/platform/i8042/serio0/bind_mode create mode 100644 test/sys/devices/platform/i8042/serio0/description create mode 120000 test/sys/devices/platform/i8042/serio0/driver create mode 100644 test/sys/devices/platform/i8042/serio0/err_count create mode 100644 test/sys/devices/platform/i8042/serio0/extra create mode 100644 test/sys/devices/platform/i8042/serio0/id/extra create mode 100644 test/sys/devices/platform/i8042/serio0/id/id create mode 100644 test/sys/devices/platform/i8042/serio0/id/proto create mode 100644 test/sys/devices/platform/i8042/serio0/id/type create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/abs create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ev create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ff create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/key create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/led create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/msc create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/rel create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/snd create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/sw create mode 120000 test/sys/devices/platform/i8042/serio0/input/input0/device create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/event0/dev create mode 120000 test/sys/devices/platform/i8042/serio0/input/input0/event0/device create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/event0/power/wakeup create mode 120000 test/sys/devices/platform/i8042/serio0/input/input0/event0/subsystem create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/event0/uevent create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/id/bustype create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/id/product create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/id/vendor create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/id/version create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/modalias create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/name create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/phys create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/power/wakeup create mode 120000 test/sys/devices/platform/i8042/serio0/input/input0/subsystem create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/uevent create mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/uniq create mode 100644 test/sys/devices/platform/i8042/serio0/modalias create mode 100644 test/sys/devices/platform/i8042/serio0/power/wakeup create mode 100644 test/sys/devices/platform/i8042/serio0/scroll create mode 100644 test/sys/devices/platform/i8042/serio0/set create mode 100644 test/sys/devices/platform/i8042/serio0/softraw create mode 100644 test/sys/devices/platform/i8042/serio0/softrepeat create mode 120000 test/sys/devices/platform/i8042/serio0/subsystem create mode 100644 test/sys/devices/platform/i8042/serio0/uevent create mode 100644 test/sys/devices/platform/i8042/serio1/bind_mode create mode 100644 test/sys/devices/platform/i8042/serio1/description create mode 100644 test/sys/devices/platform/i8042/serio1/draghys create mode 120000 test/sys/devices/platform/i8042/serio1/driver create mode 100644 test/sys/devices/platform/i8042/serio1/ext_dev create mode 100644 test/sys/devices/platform/i8042/serio1/id/extra create mode 100644 test/sys/devices/platform/i8042/serio1/id/id create mode 100644 test/sys/devices/platform/i8042/serio1/id/proto create mode 100644 test/sys/devices/platform/i8042/serio1/id/type create mode 100644 test/sys/devices/platform/i8042/serio1/inertia create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/abs create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ev create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ff create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/key create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/led create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/msc create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/rel create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/snd create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/sw create mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/device create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/event1/dev create mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/event1/device create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/event1/power/wakeup create mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/event1/subsystem create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/event1/uevent create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/id/bustype create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/id/product create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/id/vendor create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/id/version create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/modalias create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/dev create mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/device create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/power/wakeup create mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/subsystem create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/uevent create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/name create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/phys create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/power/wakeup create mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/subsystem create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/uevent create mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/uniq create mode 100644 test/sys/devices/platform/i8042/serio1/jenks create mode 100644 test/sys/devices/platform/i8042/serio1/mindrag create mode 100644 test/sys/devices/platform/i8042/serio1/modalias create mode 100644 test/sys/devices/platform/i8042/serio1/power/wakeup create mode 100644 test/sys/devices/platform/i8042/serio1/press_to_select create mode 100644 test/sys/devices/platform/i8042/serio1/protocol create mode 100644 test/sys/devices/platform/i8042/serio1/rate create mode 100644 test/sys/devices/platform/i8042/serio1/reach create mode 100644 test/sys/devices/platform/i8042/serio1/resetafter create mode 100644 test/sys/devices/platform/i8042/serio1/resolution create mode 100644 test/sys/devices/platform/i8042/serio1/resync_time create mode 100644 test/sys/devices/platform/i8042/serio1/sensitivity create mode 100644 test/sys/devices/platform/i8042/serio1/skipback create mode 100644 test/sys/devices/platform/i8042/serio1/speed create mode 120000 test/sys/devices/platform/i8042/serio1/subsystem create mode 100644 test/sys/devices/platform/i8042/serio1/thresh create mode 100644 test/sys/devices/platform/i8042/serio1/uevent create mode 100644 test/sys/devices/platform/i8042/serio1/upthresh create mode 100644 test/sys/devices/platform/i8042/serio1/ztime create mode 120000 test/sys/devices/platform/i8042/subsystem create mode 100644 test/sys/devices/platform/i8042/uevent create mode 100644 test/sys/devices/platform/microcode/modalias create mode 100644 test/sys/devices/platform/microcode/power/wakeup create mode 120000 test/sys/devices/platform/microcode/subsystem create mode 100644 test/sys/devices/platform/microcode/uevent create mode 120000 test/sys/devices/platform/pcspkr/driver create mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/abs create mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/ev create mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/ff create mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/key create mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/led create mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/msc create mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/rel create mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/snd create mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/sw create mode 120000 test/sys/devices/platform/pcspkr/input/input2/device create mode 100644 test/sys/devices/platform/pcspkr/input/input2/event2/dev create mode 120000 test/sys/devices/platform/pcspkr/input/input2/event2/device create mode 100644 test/sys/devices/platform/pcspkr/input/input2/event2/power/wakeup create mode 120000 test/sys/devices/platform/pcspkr/input/input2/event2/subsystem create mode 100644 test/sys/devices/platform/pcspkr/input/input2/event2/uevent create mode 100644 test/sys/devices/platform/pcspkr/input/input2/id/bustype create mode 100644 test/sys/devices/platform/pcspkr/input/input2/id/product create mode 100644 test/sys/devices/platform/pcspkr/input/input2/id/vendor create mode 100644 test/sys/devices/platform/pcspkr/input/input2/id/version create mode 100644 test/sys/devices/platform/pcspkr/input/input2/modalias create mode 100644 test/sys/devices/platform/pcspkr/input/input2/name create mode 100644 test/sys/devices/platform/pcspkr/input/input2/phys create mode 100644 test/sys/devices/platform/pcspkr/input/input2/power/wakeup create mode 120000 test/sys/devices/platform/pcspkr/input/input2/subsystem create mode 100644 test/sys/devices/platform/pcspkr/input/input2/uevent create mode 100644 test/sys/devices/platform/pcspkr/input/input2/uniq create mode 100644 test/sys/devices/platform/pcspkr/modalias create mode 100644 test/sys/devices/platform/pcspkr/power/wakeup create mode 120000 test/sys/devices/platform/pcspkr/subsystem create mode 100644 test/sys/devices/platform/pcspkr/uevent create mode 100644 test/sys/devices/platform/power/wakeup create mode 120000 test/sys/devices/platform/serial8250/driver create mode 100644 test/sys/devices/platform/serial8250/modalias create mode 100644 test/sys/devices/platform/serial8250/power/wakeup create mode 120000 test/sys/devices/platform/serial8250/subsystem create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS0/dev create mode 120000 test/sys/devices/platform/serial8250/tty/ttyS0/device create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS0/power/wakeup create mode 120000 test/sys/devices/platform/serial8250/tty/ttyS0/subsystem create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS0/uevent create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS1/dev create mode 120000 test/sys/devices/platform/serial8250/tty/ttyS1/device create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS1/power/wakeup create mode 120000 test/sys/devices/platform/serial8250/tty/ttyS1/subsystem create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS1/uevent create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS2/dev create mode 120000 test/sys/devices/platform/serial8250/tty/ttyS2/device create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS2/power/wakeup create mode 120000 test/sys/devices/platform/serial8250/tty/ttyS2/subsystem create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS2/uevent create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS3/dev create mode 120000 test/sys/devices/platform/serial8250/tty/ttyS3/device create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS3/power/wakeup create mode 120000 test/sys/devices/platform/serial8250/tty/ttyS3/subsystem create mode 100644 test/sys/devices/platform/serial8250/tty/ttyS3/uevent create mode 100644 test/sys/devices/platform/serial8250/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/bluetooth_enable create mode 120000 test/sys/devices/platform/thinkpad_acpi/driver create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_all_mask create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_bios_enabled create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_bios_mask create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_enable create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_mask create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_poll_freq create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_radio_sw create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_recommended_mask create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_report_mode create mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_source_mask create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/brightness create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/trigger create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/brightness create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/trigger create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/brightness create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/trigger create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/trigger create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/brightness create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/trigger create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/trigger create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/brightness create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/trigger create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/brightness create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/trigger create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/brightness create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/trigger create mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/modalias create mode 100644 test/sys/devices/platform/thinkpad_acpi/power/wakeup create mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/claim create mode 120000 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/device create mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/name create mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/power/wakeup create mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state create mode 120000 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/type create mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/uevent create mode 120000 test/sys/devices/platform/thinkpad_acpi/subsystem create mode 100644 test/sys/devices/platform/thinkpad_acpi/uevent create mode 100644 test/sys/devices/platform/thinkpad_acpi/wakeup_hotunplug_complete create mode 100644 test/sys/devices/platform/thinkpad_acpi/wakeup_reason create mode 120000 test/sys/devices/platform/thinkpad_hwmon/driver create mode 100644 test/sys/devices/platform/thinkpad_hwmon/fan1_input create mode 120000 test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/device create mode 100644 test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/power/wakeup create mode 120000 test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/subsystem create mode 100644 test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/uevent create mode 100644 test/sys/devices/platform/thinkpad_hwmon/modalias create mode 100644 test/sys/devices/platform/thinkpad_hwmon/name create mode 100644 test/sys/devices/platform/thinkpad_hwmon/power/wakeup create mode 100644 test/sys/devices/platform/thinkpad_hwmon/pwm1 create mode 100644 test/sys/devices/platform/thinkpad_hwmon/pwm1_enable create mode 120000 test/sys/devices/platform/thinkpad_hwmon/subsystem create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp10_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp11_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp12_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp13_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp14_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp15_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp16_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp1_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp2_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp3_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp4_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp5_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp6_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp7_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp8_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp9_input create mode 100644 test/sys/devices/platform/thinkpad_hwmon/uevent create mode 100644 test/sys/devices/platform/uevent create mode 120000 test/sys/devices/platform/vesafb.0/driver create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/bits_per_pixel create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/blank create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/console create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/cursor create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/dev create mode 120000 test/sys/devices/platform/vesafb.0/graphics/fb0/device create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/mode create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/modes create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/name create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/pan create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/power/wakeup create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/rotate create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/state create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/stride create mode 120000 test/sys/devices/platform/vesafb.0/graphics/fb0/subsystem create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/uevent create mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/virtual_size create mode 100644 test/sys/devices/platform/vesafb.0/modalias create mode 100644 test/sys/devices/platform/vesafb.0/power/wakeup create mode 120000 test/sys/devices/platform/vesafb.0/subsystem create mode 100644 test/sys/devices/platform/vesafb.0/uevent create mode 120000 test/sys/devices/pnp0/00:00/driver create mode 120000 test/sys/devices/pnp0/00:00/firmware_node create mode 100644 test/sys/devices/pnp0/00:00/id create mode 100644 test/sys/devices/pnp0/00:00/options create mode 100644 test/sys/devices/pnp0/00:00/power/wakeup create mode 100644 test/sys/devices/pnp0/00:00/resources create mode 120000 test/sys/devices/pnp0/00:00/subsystem create mode 100644 test/sys/devices/pnp0/00:00/uevent create mode 100644 test/sys/devices/pnp0/00:01/id create mode 100644 test/sys/devices/pnp0/00:01/options create mode 100644 test/sys/devices/pnp0/00:01/power/wakeup create mode 100644 test/sys/devices/pnp0/00:01/resources create mode 120000 test/sys/devices/pnp0/00:01/subsystem create mode 100644 test/sys/devices/pnp0/00:01/uevent create mode 120000 test/sys/devices/pnp0/00:02/driver create mode 120000 test/sys/devices/pnp0/00:02/firmware_node create mode 100644 test/sys/devices/pnp0/00:02/id create mode 100644 test/sys/devices/pnp0/00:02/options create mode 100644 test/sys/devices/pnp0/00:02/power/wakeup create mode 100644 test/sys/devices/pnp0/00:02/resources create mode 120000 test/sys/devices/pnp0/00:02/subsystem create mode 100644 test/sys/devices/pnp0/00:02/uevent create mode 120000 test/sys/devices/pnp0/00:03/firmware_node create mode 100644 test/sys/devices/pnp0/00:03/id create mode 100644 test/sys/devices/pnp0/00:03/options create mode 100644 test/sys/devices/pnp0/00:03/power/wakeup create mode 100644 test/sys/devices/pnp0/00:03/resources create mode 120000 test/sys/devices/pnp0/00:03/subsystem create mode 100644 test/sys/devices/pnp0/00:03/uevent create mode 120000 test/sys/devices/pnp0/00:04/firmware_node create mode 100644 test/sys/devices/pnp0/00:04/id create mode 100644 test/sys/devices/pnp0/00:04/options create mode 100644 test/sys/devices/pnp0/00:04/power/wakeup create mode 100644 test/sys/devices/pnp0/00:04/resources create mode 120000 test/sys/devices/pnp0/00:04/subsystem create mode 100644 test/sys/devices/pnp0/00:04/uevent create mode 120000 test/sys/devices/pnp0/00:05/firmware_node create mode 100644 test/sys/devices/pnp0/00:05/id create mode 100644 test/sys/devices/pnp0/00:05/options create mode 100644 test/sys/devices/pnp0/00:05/power/wakeup create mode 100644 test/sys/devices/pnp0/00:05/resources create mode 120000 test/sys/devices/pnp0/00:05/subsystem create mode 100644 test/sys/devices/pnp0/00:05/uevent create mode 120000 test/sys/devices/pnp0/00:06/firmware_node create mode 100644 test/sys/devices/pnp0/00:06/id create mode 100644 test/sys/devices/pnp0/00:06/options create mode 100644 test/sys/devices/pnp0/00:06/power/wakeup create mode 100644 test/sys/devices/pnp0/00:06/resources create mode 120000 test/sys/devices/pnp0/00:06/subsystem create mode 100644 test/sys/devices/pnp0/00:06/uevent create mode 120000 test/sys/devices/pnp0/00:07/driver create mode 120000 test/sys/devices/pnp0/00:07/firmware_node create mode 100644 test/sys/devices/pnp0/00:07/id create mode 100644 test/sys/devices/pnp0/00:07/nvram create mode 100644 test/sys/devices/pnp0/00:07/options create mode 100644 test/sys/devices/pnp0/00:07/power/wakeup create mode 100644 test/sys/devices/pnp0/00:07/resources create mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/date create mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/dev create mode 120000 test/sys/devices/pnp0/00:07/rtc/rtc0/device create mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq create mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/name create mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup create mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch create mode 120000 test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem create mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/time create mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/uevent create mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/wakealarm create mode 120000 test/sys/devices/pnp0/00:07/subsystem create mode 100644 test/sys/devices/pnp0/00:07/uevent create mode 120000 test/sys/devices/pnp0/00:08/driver create mode 120000 test/sys/devices/pnp0/00:08/firmware_node create mode 100644 test/sys/devices/pnp0/00:08/id create mode 100644 test/sys/devices/pnp0/00:08/options create mode 100644 test/sys/devices/pnp0/00:08/power/wakeup create mode 100644 test/sys/devices/pnp0/00:08/resources create mode 120000 test/sys/devices/pnp0/00:08/subsystem create mode 100644 test/sys/devices/pnp0/00:08/uevent create mode 120000 test/sys/devices/pnp0/00:09/driver create mode 120000 test/sys/devices/pnp0/00:09/firmware_node create mode 100644 test/sys/devices/pnp0/00:09/id create mode 100644 test/sys/devices/pnp0/00:09/options create mode 100644 test/sys/devices/pnp0/00:09/power/wakeup create mode 100644 test/sys/devices/pnp0/00:09/resources create mode 120000 test/sys/devices/pnp0/00:09/subsystem create mode 100644 test/sys/devices/pnp0/00:09/uevent create mode 120000 test/sys/devices/pnp0/00:0a/firmware_node create mode 100644 test/sys/devices/pnp0/00:0a/id create mode 100644 test/sys/devices/pnp0/00:0a/options create mode 100644 test/sys/devices/pnp0/00:0a/power/wakeup create mode 100644 test/sys/devices/pnp0/00:0a/resources create mode 120000 test/sys/devices/pnp0/00:0a/subsystem create mode 100644 test/sys/devices/pnp0/00:0a/uevent create mode 100644 test/sys/devices/pnp0/power/wakeup create mode 100644 test/sys/devices/pnp0/uevent create mode 100644 test/sys/devices/system/clocksource/clocksource0/available_clocksource create mode 100644 test/sys/devices/system/clocksource/clocksource0/current_clocksource create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/level create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/number_of_sets create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/physical_line_partition create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/size create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/type create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/ways_of_associativity create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/level create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/number_of_sets create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/physical_line_partition create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/size create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/type create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/ways_of_associativity create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/level create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/number_of_sets create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/physical_line_partition create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/size create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/type create mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/ways_of_associativity create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_min create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/related_cpus create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state create mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/latency create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/name create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/power create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/time create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/usage create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/desc create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/latency create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/name create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/power create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/time create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/desc create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/latency create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/name create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/power create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/time create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/name create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/power create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/time create mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage create mode 100644 test/sys/devices/system/cpu/cpu0/crash_notes create mode 100644 test/sys/devices/system/cpu/cpu0/microcode/processor_flags create mode 100644 test/sys/devices/system/cpu/cpu0/microcode/version create mode 100644 test/sys/devices/system/cpu/cpu0/thermal_throttle/count create mode 100644 test/sys/devices/system/cpu/cpu0/topology/core_id create mode 100644 test/sys/devices/system/cpu/cpu0/topology/core_siblings create mode 100644 test/sys/devices/system/cpu/cpu0/topology/core_siblings_list create mode 100644 test/sys/devices/system/cpu/cpu0/topology/physical_package_id create mode 100644 test/sys/devices/system/cpu/cpu0/topology/thread_siblings create mode 100644 test/sys/devices/system/cpu/cpu0/topology/thread_siblings_list create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/coherency_line_size create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/level create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/number_of_sets create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/physical_line_partition create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/size create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/type create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/ways_of_associativity create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/coherency_line_size create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/level create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/number_of_sets create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/physical_line_partition create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/size create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/type create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/ways_of_associativity create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/coherency_line_size create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/level create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/number_of_sets create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/physical_line_partition create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/size create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/type create mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/ways_of_associativity create mode 120000 test/sys/devices/system/cpu/cpu1/cpufreq create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/latency create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/name create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/power create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/time create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/usage create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/desc create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/latency create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/name create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/power create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/time create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/desc create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/latency create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/name create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/power create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/time create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/name create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/power create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/time create mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage create mode 100644 test/sys/devices/system/cpu/cpu1/crash_notes create mode 100644 test/sys/devices/system/cpu/cpu1/microcode/processor_flags create mode 100644 test/sys/devices/system/cpu/cpu1/microcode/version create mode 100644 test/sys/devices/system/cpu/cpu1/online create mode 100644 test/sys/devices/system/cpu/cpu1/thermal_throttle/count create mode 100644 test/sys/devices/system/cpu/cpu1/topology/core_id create mode 100644 test/sys/devices/system/cpu/cpu1/topology/core_siblings create mode 100644 test/sys/devices/system/cpu/cpu1/topology/core_siblings_list create mode 100644 test/sys/devices/system/cpu/cpu1/topology/physical_package_id create mode 100644 test/sys/devices/system/cpu/cpu1/topology/thread_siblings create mode 100644 test/sys/devices/system/cpu/cpu1/topology/thread_siblings_list create mode 100644 test/sys/devices/system/cpu/cpuidle/current_driver create mode 100644 test/sys/devices/system/cpu/cpuidle/current_governor_ro create mode 100644 test/sys/devices/system/cpu/online create mode 100644 test/sys/devices/system/cpu/possible create mode 100644 test/sys/devices/system/cpu/present create mode 100644 test/sys/devices/system/cpu/sched_mc_power_savings create mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank0ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank1ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank2ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank3ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank4ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank5ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck0/check_interval create mode 100644 test/sys/devices/system/machinecheck/machinecheck0/tolerant create mode 100644 test/sys/devices/system/machinecheck/machinecheck0/trigger create mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank0ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank1ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank2ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank3ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank4ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank5ctl create mode 100644 test/sys/devices/system/machinecheck/machinecheck1/check_interval create mode 100644 test/sys/devices/system/machinecheck/machinecheck1/tolerant create mode 100644 test/sys/devices/system/machinecheck/machinecheck1/trigger create mode 100644 test/sys/devices/virtual/bdi/0:16/max_ratio create mode 100644 test/sys/devices/virtual/bdi/0:16/min_ratio create mode 100644 test/sys/devices/virtual/bdi/0:16/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/0:16/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/0:16/subsystem create mode 100644 test/sys/devices/virtual/bdi/0:16/uevent create mode 100644 test/sys/devices/virtual/bdi/11:0/max_ratio create mode 100644 test/sys/devices/virtual/bdi/11:0/min_ratio create mode 100644 test/sys/devices/virtual/bdi/11:0/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/11:0/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/11:0/subsystem create mode 100644 test/sys/devices/virtual/bdi/11:0/uevent create mode 100644 test/sys/devices/virtual/bdi/7:0/max_ratio create mode 100644 test/sys/devices/virtual/bdi/7:0/min_ratio create mode 100644 test/sys/devices/virtual/bdi/7:0/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/7:0/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/7:0/subsystem create mode 100644 test/sys/devices/virtual/bdi/7:0/uevent create mode 100644 test/sys/devices/virtual/bdi/7:1/max_ratio create mode 100644 test/sys/devices/virtual/bdi/7:1/min_ratio create mode 100644 test/sys/devices/virtual/bdi/7:1/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/7:1/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/7:1/subsystem create mode 100644 test/sys/devices/virtual/bdi/7:1/uevent create mode 100644 test/sys/devices/virtual/bdi/7:2/max_ratio create mode 100644 test/sys/devices/virtual/bdi/7:2/min_ratio create mode 100644 test/sys/devices/virtual/bdi/7:2/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/7:2/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/7:2/subsystem create mode 100644 test/sys/devices/virtual/bdi/7:2/uevent create mode 100644 test/sys/devices/virtual/bdi/7:3/max_ratio create mode 100644 test/sys/devices/virtual/bdi/7:3/min_ratio create mode 100644 test/sys/devices/virtual/bdi/7:3/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/7:3/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/7:3/subsystem create mode 100644 test/sys/devices/virtual/bdi/7:3/uevent create mode 100644 test/sys/devices/virtual/bdi/7:4/max_ratio create mode 100644 test/sys/devices/virtual/bdi/7:4/min_ratio create mode 100644 test/sys/devices/virtual/bdi/7:4/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/7:4/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/7:4/subsystem create mode 100644 test/sys/devices/virtual/bdi/7:4/uevent create mode 100644 test/sys/devices/virtual/bdi/7:5/max_ratio create mode 100644 test/sys/devices/virtual/bdi/7:5/min_ratio create mode 100644 test/sys/devices/virtual/bdi/7:5/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/7:5/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/7:5/subsystem create mode 100644 test/sys/devices/virtual/bdi/7:5/uevent create mode 100644 test/sys/devices/virtual/bdi/7:6/max_ratio create mode 100644 test/sys/devices/virtual/bdi/7:6/min_ratio create mode 100644 test/sys/devices/virtual/bdi/7:6/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/7:6/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/7:6/subsystem create mode 100644 test/sys/devices/virtual/bdi/7:6/uevent create mode 100644 test/sys/devices/virtual/bdi/7:7/max_ratio create mode 100644 test/sys/devices/virtual/bdi/7:7/min_ratio create mode 100644 test/sys/devices/virtual/bdi/7:7/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/7:7/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/7:7/subsystem create mode 100644 test/sys/devices/virtual/bdi/7:7/uevent create mode 100644 test/sys/devices/virtual/bdi/8:0/max_ratio create mode 100644 test/sys/devices/virtual/bdi/8:0/min_ratio create mode 100644 test/sys/devices/virtual/bdi/8:0/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/8:0/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/8:0/subsystem create mode 100644 test/sys/devices/virtual/bdi/8:0/uevent create mode 100644 test/sys/devices/virtual/bdi/8:16/max_ratio create mode 100644 test/sys/devices/virtual/bdi/8:16/min_ratio create mode 100644 test/sys/devices/virtual/bdi/8:16/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/8:16/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/8:16/subsystem create mode 100644 test/sys/devices/virtual/bdi/8:16/uevent create mode 100644 test/sys/devices/virtual/bdi/9:0/max_ratio create mode 100644 test/sys/devices/virtual/bdi/9:0/min_ratio create mode 100644 test/sys/devices/virtual/bdi/9:0/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/9:0/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/9:0/subsystem create mode 100644 test/sys/devices/virtual/bdi/9:0/uevent create mode 100644 test/sys/devices/virtual/bdi/default/max_ratio create mode 100644 test/sys/devices/virtual/bdi/default/min_ratio create mode 100644 test/sys/devices/virtual/bdi/default/power/wakeup create mode 100644 test/sys/devices/virtual/bdi/default/read_ahead_kb create mode 120000 test/sys/devices/virtual/bdi/default/subsystem create mode 100644 test/sys/devices/virtual/bdi/default/uevent create mode 100644 test/sys/devices/virtual/block/fake!blockdev0/capability create mode 100644 test/sys/devices/virtual/block/fake!blockdev0/dev create mode 100644 test/sys/devices/virtual/block/fake!blockdev0/range create mode 100644 test/sys/devices/virtual/block/fake!blockdev0/removable create mode 100644 test/sys/devices/virtual/block/fake!blockdev0/ro create mode 100644 test/sys/devices/virtual/block/fake!blockdev0/size create mode 100644 test/sys/devices/virtual/block/fake!blockdev0/stat create mode 120000 test/sys/devices/virtual/block/fake!blockdev0/subsystem create mode 100644 test/sys/devices/virtual/block/fake!blockdev0/uevent create mode 120000 test/sys/devices/virtual/block/loop0/bdi create mode 100644 test/sys/devices/virtual/block/loop0/capability create mode 100644 test/sys/devices/virtual/block/loop0/dev create mode 100644 test/sys/devices/virtual/block/loop0/make-it-fail create mode 100644 test/sys/devices/virtual/block/loop0/power/wakeup create mode 100644 test/sys/devices/virtual/block/loop0/range create mode 100644 test/sys/devices/virtual/block/loop0/removable create mode 100644 test/sys/devices/virtual/block/loop0/ro create mode 100644 test/sys/devices/virtual/block/loop0/size create mode 100644 test/sys/devices/virtual/block/loop0/stat create mode 120000 test/sys/devices/virtual/block/loop0/subsystem create mode 100644 test/sys/devices/virtual/block/loop0/uevent create mode 120000 test/sys/devices/virtual/block/loop1/bdi create mode 100644 test/sys/devices/virtual/block/loop1/capability create mode 100644 test/sys/devices/virtual/block/loop1/dev create mode 100644 test/sys/devices/virtual/block/loop1/make-it-fail create mode 100644 test/sys/devices/virtual/block/loop1/power/wakeup create mode 100644 test/sys/devices/virtual/block/loop1/range create mode 100644 test/sys/devices/virtual/block/loop1/removable create mode 100644 test/sys/devices/virtual/block/loop1/ro create mode 100644 test/sys/devices/virtual/block/loop1/size create mode 100644 test/sys/devices/virtual/block/loop1/stat create mode 120000 test/sys/devices/virtual/block/loop1/subsystem create mode 100644 test/sys/devices/virtual/block/loop1/uevent create mode 120000 test/sys/devices/virtual/block/loop2/bdi create mode 100644 test/sys/devices/virtual/block/loop2/capability create mode 100644 test/sys/devices/virtual/block/loop2/dev create mode 100644 test/sys/devices/virtual/block/loop2/make-it-fail create mode 100644 test/sys/devices/virtual/block/loop2/power/wakeup create mode 100644 test/sys/devices/virtual/block/loop2/range create mode 100644 test/sys/devices/virtual/block/loop2/removable create mode 100644 test/sys/devices/virtual/block/loop2/ro create mode 100644 test/sys/devices/virtual/block/loop2/size create mode 100644 test/sys/devices/virtual/block/loop2/stat create mode 120000 test/sys/devices/virtual/block/loop2/subsystem create mode 100644 test/sys/devices/virtual/block/loop2/uevent create mode 120000 test/sys/devices/virtual/block/loop3/bdi create mode 100644 test/sys/devices/virtual/block/loop3/capability create mode 100644 test/sys/devices/virtual/block/loop3/dev create mode 100644 test/sys/devices/virtual/block/loop3/make-it-fail create mode 100644 test/sys/devices/virtual/block/loop3/power/wakeup create mode 100644 test/sys/devices/virtual/block/loop3/range create mode 100644 test/sys/devices/virtual/block/loop3/removable create mode 100644 test/sys/devices/virtual/block/loop3/ro create mode 100644 test/sys/devices/virtual/block/loop3/size create mode 100644 test/sys/devices/virtual/block/loop3/stat create mode 120000 test/sys/devices/virtual/block/loop3/subsystem create mode 100644 test/sys/devices/virtual/block/loop3/uevent create mode 120000 test/sys/devices/virtual/block/loop4/bdi create mode 100644 test/sys/devices/virtual/block/loop4/capability create mode 100644 test/sys/devices/virtual/block/loop4/dev create mode 100644 test/sys/devices/virtual/block/loop4/make-it-fail create mode 100644 test/sys/devices/virtual/block/loop4/power/wakeup create mode 100644 test/sys/devices/virtual/block/loop4/range create mode 100644 test/sys/devices/virtual/block/loop4/removable create mode 100644 test/sys/devices/virtual/block/loop4/ro create mode 100644 test/sys/devices/virtual/block/loop4/size create mode 100644 test/sys/devices/virtual/block/loop4/stat create mode 120000 test/sys/devices/virtual/block/loop4/subsystem create mode 100644 test/sys/devices/virtual/block/loop4/uevent create mode 120000 test/sys/devices/virtual/block/loop5/bdi create mode 100644 test/sys/devices/virtual/block/loop5/capability create mode 100644 test/sys/devices/virtual/block/loop5/dev create mode 100644 test/sys/devices/virtual/block/loop5/make-it-fail create mode 100644 test/sys/devices/virtual/block/loop5/power/wakeup create mode 100644 test/sys/devices/virtual/block/loop5/range create mode 100644 test/sys/devices/virtual/block/loop5/removable create mode 100644 test/sys/devices/virtual/block/loop5/ro create mode 100644 test/sys/devices/virtual/block/loop5/size create mode 100644 test/sys/devices/virtual/block/loop5/stat create mode 120000 test/sys/devices/virtual/block/loop5/subsystem create mode 100644 test/sys/devices/virtual/block/loop5/uevent create mode 120000 test/sys/devices/virtual/block/loop6/bdi create mode 100644 test/sys/devices/virtual/block/loop6/capability create mode 100644 test/sys/devices/virtual/block/loop6/dev create mode 100644 test/sys/devices/virtual/block/loop6/make-it-fail create mode 100644 test/sys/devices/virtual/block/loop6/power/wakeup create mode 100644 test/sys/devices/virtual/block/loop6/range create mode 100644 test/sys/devices/virtual/block/loop6/removable create mode 100644 test/sys/devices/virtual/block/loop6/ro create mode 100644 test/sys/devices/virtual/block/loop6/size create mode 100644 test/sys/devices/virtual/block/loop6/stat create mode 120000 test/sys/devices/virtual/block/loop6/subsystem create mode 100644 test/sys/devices/virtual/block/loop6/uevent create mode 120000 test/sys/devices/virtual/block/loop7/bdi create mode 100644 test/sys/devices/virtual/block/loop7/capability create mode 100644 test/sys/devices/virtual/block/loop7/dev create mode 100644 test/sys/devices/virtual/block/loop7/make-it-fail create mode 100644 test/sys/devices/virtual/block/loop7/power/wakeup create mode 100644 test/sys/devices/virtual/block/loop7/range create mode 100644 test/sys/devices/virtual/block/loop7/removable create mode 100644 test/sys/devices/virtual/block/loop7/ro create mode 100644 test/sys/devices/virtual/block/loop7/size create mode 100644 test/sys/devices/virtual/block/loop7/stat create mode 120000 test/sys/devices/virtual/block/loop7/subsystem create mode 100644 test/sys/devices/virtual/block/loop7/uevent create mode 120000 test/sys/devices/virtual/block/md0/bdi create mode 100644 test/sys/devices/virtual/block/md0/capability create mode 100644 test/sys/devices/virtual/block/md0/dev create mode 100644 test/sys/devices/virtual/block/md0/make-it-fail create mode 100644 test/sys/devices/virtual/block/md0/md/array_state create mode 100644 test/sys/devices/virtual/block/md0/md/chunk_size create mode 100644 test/sys/devices/virtual/block/md0/md/component_size create mode 100644 test/sys/devices/virtual/block/md0/md/degraded create mode 120000 test/sys/devices/virtual/block/md0/md/dev-sda9/block create mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/errors create mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/offset create mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/size create mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/slot create mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/state create mode 100644 test/sys/devices/virtual/block/md0/md/layout create mode 100644 test/sys/devices/virtual/block/md0/md/level create mode 100644 test/sys/devices/virtual/block/md0/md/metadata_version create mode 100644 test/sys/devices/virtual/block/md0/md/mismatch_cnt create mode 100644 test/sys/devices/virtual/block/md0/md/raid_disks create mode 120000 test/sys/devices/virtual/block/md0/md/rd1 create mode 100644 test/sys/devices/virtual/block/md0/md/reshape_position create mode 100644 test/sys/devices/virtual/block/md0/md/resync_start create mode 100644 test/sys/devices/virtual/block/md0/md/safe_mode_delay create mode 100644 test/sys/devices/virtual/block/md0/md/suspend_hi create mode 100644 test/sys/devices/virtual/block/md0/md/suspend_lo create mode 100644 test/sys/devices/virtual/block/md0/md/sync_action create mode 100644 test/sys/devices/virtual/block/md0/md/sync_completed create mode 100644 test/sys/devices/virtual/block/md0/md/sync_force_parallel create mode 100644 test/sys/devices/virtual/block/md0/md/sync_max create mode 100644 test/sys/devices/virtual/block/md0/md/sync_min create mode 100644 test/sys/devices/virtual/block/md0/md/sync_speed create mode 100644 test/sys/devices/virtual/block/md0/md/sync_speed_max create mode 100644 test/sys/devices/virtual/block/md0/md/sync_speed_min create mode 100644 test/sys/devices/virtual/block/md0/power/wakeup create mode 100644 test/sys/devices/virtual/block/md0/range create mode 100644 test/sys/devices/virtual/block/md0/removable create mode 100644 test/sys/devices/virtual/block/md0/ro create mode 100644 test/sys/devices/virtual/block/md0/size create mode 120000 test/sys/devices/virtual/block/md0/slaves/sda9 create mode 100644 test/sys/devices/virtual/block/md0/stat create mode 120000 test/sys/devices/virtual/block/md0/subsystem create mode 100644 test/sys/devices/virtual/block/md0/uevent create mode 100644 test/sys/devices/virtual/dmi/id/bios_date create mode 100644 test/sys/devices/virtual/dmi/id/bios_vendor create mode 100644 test/sys/devices/virtual/dmi/id/bios_version create mode 100644 test/sys/devices/virtual/dmi/id/board_asset_tag create mode 100644 test/sys/devices/virtual/dmi/id/board_name create mode 100644 test/sys/devices/virtual/dmi/id/board_serial create mode 100644 test/sys/devices/virtual/dmi/id/board_vendor create mode 100644 test/sys/devices/virtual/dmi/id/board_version create mode 100644 test/sys/devices/virtual/dmi/id/chassis_asset_tag create mode 100644 test/sys/devices/virtual/dmi/id/chassis_serial create mode 100644 test/sys/devices/virtual/dmi/id/chassis_type create mode 100644 test/sys/devices/virtual/dmi/id/chassis_vendor create mode 100644 test/sys/devices/virtual/dmi/id/chassis_version create mode 100644 test/sys/devices/virtual/dmi/id/modalias create mode 100644 test/sys/devices/virtual/dmi/id/power/wakeup create mode 100644 test/sys/devices/virtual/dmi/id/product_name create mode 100644 test/sys/devices/virtual/dmi/id/product_serial create mode 100644 test/sys/devices/virtual/dmi/id/product_uuid create mode 100644 test/sys/devices/virtual/dmi/id/product_version create mode 120000 test/sys/devices/virtual/dmi/id/subsystem create mode 100644 test/sys/devices/virtual/dmi/id/sys_vendor create mode 100644 test/sys/devices/virtual/dmi/id/uevent create mode 100644 test/sys/devices/virtual/graphics/fbcon/cursor_blink create mode 100644 test/sys/devices/virtual/graphics/fbcon/power/wakeup create mode 100644 test/sys/devices/virtual/graphics/fbcon/rotate create mode 120000 test/sys/devices/virtual/graphics/fbcon/subsystem create mode 100644 test/sys/devices/virtual/graphics/fbcon/uevent create mode 100644 test/sys/devices/virtual/input/input6/capabilities/abs create mode 100644 test/sys/devices/virtual/input/input6/capabilities/ev create mode 100644 test/sys/devices/virtual/input/input6/capabilities/ff create mode 100644 test/sys/devices/virtual/input/input6/capabilities/key create mode 100644 test/sys/devices/virtual/input/input6/capabilities/led create mode 100644 test/sys/devices/virtual/input/input6/capabilities/msc create mode 100644 test/sys/devices/virtual/input/input6/capabilities/rel create mode 100644 test/sys/devices/virtual/input/input6/capabilities/snd create mode 100644 test/sys/devices/virtual/input/input6/capabilities/sw create mode 100644 test/sys/devices/virtual/input/input6/event6/dev create mode 120000 test/sys/devices/virtual/input/input6/event6/device create mode 100644 test/sys/devices/virtual/input/input6/event6/power/wakeup create mode 120000 test/sys/devices/virtual/input/input6/event6/subsystem create mode 100644 test/sys/devices/virtual/input/input6/event6/uevent create mode 100644 test/sys/devices/virtual/input/input6/id/bustype create mode 100644 test/sys/devices/virtual/input/input6/id/product create mode 100644 test/sys/devices/virtual/input/input6/id/vendor create mode 100644 test/sys/devices/virtual/input/input6/id/version create mode 100644 test/sys/devices/virtual/input/input6/modalias create mode 100644 test/sys/devices/virtual/input/input6/name create mode 100644 test/sys/devices/virtual/input/input6/phys create mode 100644 test/sys/devices/virtual/input/input6/power/wakeup create mode 120000 test/sys/devices/virtual/input/input6/subsystem create mode 100644 test/sys/devices/virtual/input/input6/uevent create mode 100644 test/sys/devices/virtual/input/input6/uniq create mode 100644 test/sys/devices/virtual/input/mice/dev create mode 100644 test/sys/devices/virtual/input/mice/power/wakeup create mode 120000 test/sys/devices/virtual/input/mice/subsystem create mode 100644 test/sys/devices/virtual/input/mice/uevent create mode 100644 test/sys/devices/virtual/mem/full/dev create mode 100644 test/sys/devices/virtual/mem/full/power/wakeup create mode 120000 test/sys/devices/virtual/mem/full/subsystem create mode 100644 test/sys/devices/virtual/mem/full/uevent create mode 100644 test/sys/devices/virtual/mem/kmem/dev create mode 100644 test/sys/devices/virtual/mem/kmem/power/wakeup create mode 120000 test/sys/devices/virtual/mem/kmem/subsystem create mode 100644 test/sys/devices/virtual/mem/kmem/uevent create mode 100644 test/sys/devices/virtual/mem/kmsg/dev create mode 100644 test/sys/devices/virtual/mem/kmsg/power/wakeup create mode 120000 test/sys/devices/virtual/mem/kmsg/subsystem create mode 100644 test/sys/devices/virtual/mem/kmsg/uevent create mode 100644 test/sys/devices/virtual/mem/mem/dev create mode 100644 test/sys/devices/virtual/mem/mem/power/wakeup create mode 120000 test/sys/devices/virtual/mem/mem/subsystem create mode 100644 test/sys/devices/virtual/mem/mem/uevent create mode 100644 test/sys/devices/virtual/mem/null/dev create mode 100644 test/sys/devices/virtual/mem/null/power/wakeup create mode 120000 test/sys/devices/virtual/mem/null/subsystem create mode 100644 test/sys/devices/virtual/mem/null/uevent create mode 100644 test/sys/devices/virtual/mem/port/dev create mode 100644 test/sys/devices/virtual/mem/port/power/wakeup create mode 120000 test/sys/devices/virtual/mem/port/subsystem create mode 100644 test/sys/devices/virtual/mem/port/uevent create mode 100644 test/sys/devices/virtual/mem/random/dev create mode 100644 test/sys/devices/virtual/mem/random/power/wakeup create mode 120000 test/sys/devices/virtual/mem/random/subsystem create mode 100644 test/sys/devices/virtual/mem/random/uevent create mode 100644 test/sys/devices/virtual/mem/urandom/dev create mode 100644 test/sys/devices/virtual/mem/urandom/power/wakeup create mode 120000 test/sys/devices/virtual/mem/urandom/subsystem create mode 100644 test/sys/devices/virtual/mem/urandom/uevent create mode 100644 test/sys/devices/virtual/mem/zero/dev create mode 100644 test/sys/devices/virtual/mem/zero/power/wakeup create mode 120000 test/sys/devices/virtual/mem/zero/subsystem create mode 100644 test/sys/devices/virtual/mem/zero/uevent create mode 100644 test/sys/devices/virtual/misc/cpu_dma_latency/dev create mode 100644 test/sys/devices/virtual/misc/cpu_dma_latency/power/wakeup create mode 120000 test/sys/devices/virtual/misc/cpu_dma_latency/subsystem create mode 100644 test/sys/devices/virtual/misc/cpu_dma_latency/uevent create mode 100644 test/sys/devices/virtual/misc/device-mapper/dev create mode 100644 test/sys/devices/virtual/misc/device-mapper/power/wakeup create mode 120000 test/sys/devices/virtual/misc/device-mapper/subsystem create mode 100644 test/sys/devices/virtual/misc/device-mapper/uevent create mode 100644 test/sys/devices/virtual/misc/fuse/dev create mode 100644 test/sys/devices/virtual/misc/fuse/power/wakeup create mode 120000 test/sys/devices/virtual/misc/fuse/subsystem create mode 100644 test/sys/devices/virtual/misc/fuse/uevent create mode 100644 test/sys/devices/virtual/misc/hpet/dev create mode 100644 test/sys/devices/virtual/misc/hpet/power/wakeup create mode 120000 test/sys/devices/virtual/misc/hpet/subsystem create mode 100644 test/sys/devices/virtual/misc/hpet/uevent create mode 100644 test/sys/devices/virtual/misc/mcelog/dev create mode 100644 test/sys/devices/virtual/misc/mcelog/power/wakeup create mode 120000 test/sys/devices/virtual/misc/mcelog/subsystem create mode 100644 test/sys/devices/virtual/misc/mcelog/uevent create mode 100644 test/sys/devices/virtual/misc/microcode/dev create mode 100644 test/sys/devices/virtual/misc/microcode/power/wakeup create mode 120000 test/sys/devices/virtual/misc/microcode/subsystem create mode 100644 test/sys/devices/virtual/misc/microcode/uevent create mode 100644 test/sys/devices/virtual/misc/misc-fake1/dev create mode 100644 test/sys/devices/virtual/misc/misc-fake1/power/wakeup create mode 120000 test/sys/devices/virtual/misc/misc-fake1/subsystem create mode 100644 test/sys/devices/virtual/misc/misc-fake1/uevent create mode 100644 test/sys/devices/virtual/misc/misc-fake89999/dev create mode 100644 test/sys/devices/virtual/misc/misc-fake89999/power/wakeup create mode 120000 test/sys/devices/virtual/misc/misc-fake89999/subsystem create mode 100644 test/sys/devices/virtual/misc/misc-fake89999/uevent create mode 100644 test/sys/devices/virtual/misc/network_latency/dev create mode 100644 test/sys/devices/virtual/misc/network_latency/power/wakeup create mode 120000 test/sys/devices/virtual/misc/network_latency/subsystem create mode 100644 test/sys/devices/virtual/misc/network_latency/uevent create mode 100644 test/sys/devices/virtual/misc/network_throughput/dev create mode 100644 test/sys/devices/virtual/misc/network_throughput/power/wakeup create mode 120000 test/sys/devices/virtual/misc/network_throughput/subsystem create mode 100644 test/sys/devices/virtual/misc/network_throughput/uevent create mode 100644 test/sys/devices/virtual/misc/nvram/dev create mode 100644 test/sys/devices/virtual/misc/nvram/power/wakeup create mode 120000 test/sys/devices/virtual/misc/nvram/subsystem create mode 100644 test/sys/devices/virtual/misc/nvram/uevent create mode 100644 test/sys/devices/virtual/misc/psaux/dev create mode 100644 test/sys/devices/virtual/misc/psaux/power/wakeup create mode 120000 test/sys/devices/virtual/misc/psaux/subsystem create mode 100644 test/sys/devices/virtual/misc/psaux/uevent create mode 100644 test/sys/devices/virtual/misc/uinput/dev create mode 100644 test/sys/devices/virtual/misc/uinput/power/wakeup create mode 120000 test/sys/devices/virtual/misc/uinput/subsystem create mode 100644 test/sys/devices/virtual/misc/uinput/uevent create mode 100644 test/sys/devices/virtual/net/lo/addr_len create mode 100644 test/sys/devices/virtual/net/lo/address create mode 100644 test/sys/devices/virtual/net/lo/broadcast create mode 100644 test/sys/devices/virtual/net/lo/carrier create mode 100644 test/sys/devices/virtual/net/lo/dev_id create mode 100644 test/sys/devices/virtual/net/lo/dormant create mode 100644 test/sys/devices/virtual/net/lo/features create mode 100644 test/sys/devices/virtual/net/lo/flags create mode 100644 test/sys/devices/virtual/net/lo/ifindex create mode 100644 test/sys/devices/virtual/net/lo/iflink create mode 100644 test/sys/devices/virtual/net/lo/link_mode create mode 100644 test/sys/devices/virtual/net/lo/mtu create mode 100644 test/sys/devices/virtual/net/lo/operstate create mode 100644 test/sys/devices/virtual/net/lo/power/wakeup create mode 100644 test/sys/devices/virtual/net/lo/statistics/collisions create mode 100644 test/sys/devices/virtual/net/lo/statistics/multicast create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_bytes create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_compressed create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_crc_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_dropped create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_fifo_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_frame_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_length_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_missed_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_over_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_packets create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_aborted_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_bytes create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_carrier_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_compressed create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_dropped create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_fifo_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_heartbeat_errors create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_packets create mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_window_errors create mode 120000 test/sys/devices/virtual/net/lo/subsystem create mode 100644 test/sys/devices/virtual/net/lo/tx_queue_len create mode 100644 test/sys/devices/virtual/net/lo/type create mode 100644 test/sys/devices/virtual/net/lo/uevent create mode 100644 test/sys/devices/virtual/sound/seq/dev create mode 100644 test/sys/devices/virtual/sound/seq/power/wakeup create mode 120000 test/sys/devices/virtual/sound/seq/subsystem create mode 100644 test/sys/devices/virtual/sound/seq/uevent create mode 100644 test/sys/devices/virtual/sound/timer/dev create mode 100644 test/sys/devices/virtual/sound/timer/power/wakeup create mode 120000 test/sys/devices/virtual/sound/timer/subsystem create mode 100644 test/sys/devices/virtual/sound/timer/uevent create mode 100644 test/sys/devices/virtual/thermal/cooling_device0/cur_state create mode 120000 test/sys/devices/virtual/thermal/cooling_device0/device create mode 100644 test/sys/devices/virtual/thermal/cooling_device0/max_state create mode 100644 test/sys/devices/virtual/thermal/cooling_device0/power/wakeup create mode 120000 test/sys/devices/virtual/thermal/cooling_device0/subsystem create mode 100644 test/sys/devices/virtual/thermal/cooling_device0/type create mode 100644 test/sys/devices/virtual/thermal/cooling_device0/uevent create mode 100644 test/sys/devices/virtual/thermal/cooling_device1/cur_state create mode 120000 test/sys/devices/virtual/thermal/cooling_device1/device create mode 100644 test/sys/devices/virtual/thermal/cooling_device1/max_state create mode 100644 test/sys/devices/virtual/thermal/cooling_device1/power/wakeup create mode 120000 test/sys/devices/virtual/thermal/cooling_device1/subsystem create mode 100644 test/sys/devices/virtual/thermal/cooling_device1/type create mode 100644 test/sys/devices/virtual/thermal/cooling_device1/uevent create mode 120000 test/sys/devices/virtual/thermal/thermal_zone0/device create mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/mode create mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/power/wakeup create mode 120000 test/sys/devices/virtual/thermal/thermal_zone0/subsystem create mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/temp create mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp create mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_type create mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/type create mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/uevent create mode 120000 test/sys/devices/virtual/thermal/thermal_zone1/cdev0 create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/cdev0_trip_point create mode 120000 test/sys/devices/virtual/thermal/thermal_zone1/cdev1 create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/cdev1_trip_point create mode 120000 test/sys/devices/virtual/thermal/thermal_zone1/device create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/mode create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/power/wakeup create mode 120000 test/sys/devices/virtual/thermal/thermal_zone1/subsystem create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/temp create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_type create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_temp create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_type create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/type create mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/uevent create mode 100644 test/sys/devices/virtual/tty/console/dev create mode 100644 test/sys/devices/virtual/tty/console/power/wakeup create mode 120000 test/sys/devices/virtual/tty/console/subsystem create mode 100644 test/sys/devices/virtual/tty/console/uevent create mode 100644 test/sys/devices/virtual/tty/ptmx/dev create mode 100644 test/sys/devices/virtual/tty/ptmx/power/wakeup create mode 120000 test/sys/devices/virtual/tty/ptmx/subsystem create mode 100644 test/sys/devices/virtual/tty/ptmx/uevent create mode 100644 test/sys/devices/virtual/tty/tty/dev create mode 100644 test/sys/devices/virtual/tty/tty/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty/subsystem create mode 100644 test/sys/devices/virtual/tty/tty/uevent create mode 100644 test/sys/devices/virtual/tty/tty0/dev create mode 100644 test/sys/devices/virtual/tty/tty0/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty0/subsystem create mode 100644 test/sys/devices/virtual/tty/tty0/uevent create mode 100644 test/sys/devices/virtual/tty/tty1/dev create mode 100644 test/sys/devices/virtual/tty/tty1/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty1/subsystem create mode 100644 test/sys/devices/virtual/tty/tty1/uevent create mode 100644 test/sys/devices/virtual/tty/tty10/dev create mode 100644 test/sys/devices/virtual/tty/tty10/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty10/subsystem create mode 100644 test/sys/devices/virtual/tty/tty10/uevent create mode 100644 test/sys/devices/virtual/tty/tty11/dev create mode 100644 test/sys/devices/virtual/tty/tty11/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty11/subsystem create mode 100644 test/sys/devices/virtual/tty/tty11/uevent create mode 100644 test/sys/devices/virtual/tty/tty12/dev create mode 100644 test/sys/devices/virtual/tty/tty12/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty12/subsystem create mode 100644 test/sys/devices/virtual/tty/tty12/uevent create mode 100644 test/sys/devices/virtual/tty/tty13/dev create mode 100644 test/sys/devices/virtual/tty/tty13/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty13/subsystem create mode 100644 test/sys/devices/virtual/tty/tty13/uevent create mode 100644 test/sys/devices/virtual/tty/tty14/dev create mode 100644 test/sys/devices/virtual/tty/tty14/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty14/subsystem create mode 100644 test/sys/devices/virtual/tty/tty14/uevent create mode 100644 test/sys/devices/virtual/tty/tty15/dev create mode 100644 test/sys/devices/virtual/tty/tty15/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty15/subsystem create mode 100644 test/sys/devices/virtual/tty/tty15/uevent create mode 100644 test/sys/devices/virtual/tty/tty16/dev create mode 100644 test/sys/devices/virtual/tty/tty16/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty16/subsystem create mode 100644 test/sys/devices/virtual/tty/tty16/uevent create mode 100644 test/sys/devices/virtual/tty/tty17/dev create mode 100644 test/sys/devices/virtual/tty/tty17/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty17/subsystem create mode 100644 test/sys/devices/virtual/tty/tty17/uevent create mode 100644 test/sys/devices/virtual/tty/tty18/dev create mode 100644 test/sys/devices/virtual/tty/tty18/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty18/subsystem create mode 100644 test/sys/devices/virtual/tty/tty18/uevent create mode 100644 test/sys/devices/virtual/tty/tty19/dev create mode 100644 test/sys/devices/virtual/tty/tty19/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty19/subsystem create mode 100644 test/sys/devices/virtual/tty/tty19/uevent create mode 100644 test/sys/devices/virtual/tty/tty2/dev create mode 100644 test/sys/devices/virtual/tty/tty2/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty2/subsystem create mode 100644 test/sys/devices/virtual/tty/tty2/uevent create mode 100644 test/sys/devices/virtual/tty/tty20/dev create mode 100644 test/sys/devices/virtual/tty/tty20/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty20/subsystem create mode 100644 test/sys/devices/virtual/tty/tty20/uevent create mode 100644 test/sys/devices/virtual/tty/tty21/dev create mode 100644 test/sys/devices/virtual/tty/tty21/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty21/subsystem create mode 100644 test/sys/devices/virtual/tty/tty21/uevent create mode 100644 test/sys/devices/virtual/tty/tty22/dev create mode 100644 test/sys/devices/virtual/tty/tty22/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty22/subsystem create mode 100644 test/sys/devices/virtual/tty/tty22/uevent create mode 100644 test/sys/devices/virtual/tty/tty23/dev create mode 100644 test/sys/devices/virtual/tty/tty23/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty23/subsystem create mode 100644 test/sys/devices/virtual/tty/tty23/uevent create mode 100644 test/sys/devices/virtual/tty/tty24/dev create mode 100644 test/sys/devices/virtual/tty/tty24/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty24/subsystem create mode 100644 test/sys/devices/virtual/tty/tty24/uevent create mode 100644 test/sys/devices/virtual/tty/tty25/dev create mode 100644 test/sys/devices/virtual/tty/tty25/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty25/subsystem create mode 100644 test/sys/devices/virtual/tty/tty25/uevent create mode 100644 test/sys/devices/virtual/tty/tty26/dev create mode 100644 test/sys/devices/virtual/tty/tty26/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty26/subsystem create mode 100644 test/sys/devices/virtual/tty/tty26/uevent create mode 100644 test/sys/devices/virtual/tty/tty27/dev create mode 100644 test/sys/devices/virtual/tty/tty27/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty27/subsystem create mode 100644 test/sys/devices/virtual/tty/tty27/uevent create mode 100644 test/sys/devices/virtual/tty/tty28/dev create mode 100644 test/sys/devices/virtual/tty/tty28/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty28/subsystem create mode 100644 test/sys/devices/virtual/tty/tty28/uevent create mode 100644 test/sys/devices/virtual/tty/tty29/dev create mode 100644 test/sys/devices/virtual/tty/tty29/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty29/subsystem create mode 100644 test/sys/devices/virtual/tty/tty29/uevent create mode 100644 test/sys/devices/virtual/tty/tty3/dev create mode 100644 test/sys/devices/virtual/tty/tty3/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty3/subsystem create mode 100644 test/sys/devices/virtual/tty/tty3/uevent create mode 100644 test/sys/devices/virtual/tty/tty30/dev create mode 100644 test/sys/devices/virtual/tty/tty30/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty30/subsystem create mode 100644 test/sys/devices/virtual/tty/tty30/uevent create mode 100644 test/sys/devices/virtual/tty/tty31/dev create mode 100644 test/sys/devices/virtual/tty/tty31/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty31/subsystem create mode 100644 test/sys/devices/virtual/tty/tty31/uevent create mode 100644 test/sys/devices/virtual/tty/tty32/dev create mode 100644 test/sys/devices/virtual/tty/tty32/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty32/subsystem create mode 100644 test/sys/devices/virtual/tty/tty32/uevent create mode 100644 test/sys/devices/virtual/tty/tty33/dev create mode 100644 test/sys/devices/virtual/tty/tty33/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty33/subsystem create mode 100644 test/sys/devices/virtual/tty/tty33/uevent create mode 100644 test/sys/devices/virtual/tty/tty34/dev create mode 100644 test/sys/devices/virtual/tty/tty34/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty34/subsystem create mode 100644 test/sys/devices/virtual/tty/tty34/uevent create mode 100644 test/sys/devices/virtual/tty/tty35/dev create mode 100644 test/sys/devices/virtual/tty/tty35/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty35/subsystem create mode 100644 test/sys/devices/virtual/tty/tty35/uevent create mode 100644 test/sys/devices/virtual/tty/tty36/dev create mode 100644 test/sys/devices/virtual/tty/tty36/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty36/subsystem create mode 100644 test/sys/devices/virtual/tty/tty36/uevent create mode 100644 test/sys/devices/virtual/tty/tty37/dev create mode 100644 test/sys/devices/virtual/tty/tty37/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty37/subsystem create mode 100644 test/sys/devices/virtual/tty/tty37/uevent create mode 100644 test/sys/devices/virtual/tty/tty38/dev create mode 100644 test/sys/devices/virtual/tty/tty38/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty38/subsystem create mode 100644 test/sys/devices/virtual/tty/tty38/uevent create mode 100644 test/sys/devices/virtual/tty/tty39/dev create mode 100644 test/sys/devices/virtual/tty/tty39/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty39/subsystem create mode 100644 test/sys/devices/virtual/tty/tty39/uevent create mode 100644 test/sys/devices/virtual/tty/tty4/dev create mode 100644 test/sys/devices/virtual/tty/tty4/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty4/subsystem create mode 100644 test/sys/devices/virtual/tty/tty4/uevent create mode 100644 test/sys/devices/virtual/tty/tty40/dev create mode 100644 test/sys/devices/virtual/tty/tty40/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty40/subsystem create mode 100644 test/sys/devices/virtual/tty/tty40/uevent create mode 100644 test/sys/devices/virtual/tty/tty41/dev create mode 100644 test/sys/devices/virtual/tty/tty41/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty41/subsystem create mode 100644 test/sys/devices/virtual/tty/tty41/uevent create mode 100644 test/sys/devices/virtual/tty/tty42/dev create mode 100644 test/sys/devices/virtual/tty/tty42/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty42/subsystem create mode 100644 test/sys/devices/virtual/tty/tty42/uevent create mode 100644 test/sys/devices/virtual/tty/tty43/dev create mode 100644 test/sys/devices/virtual/tty/tty43/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty43/subsystem create mode 100644 test/sys/devices/virtual/tty/tty43/uevent create mode 100644 test/sys/devices/virtual/tty/tty44/dev create mode 100644 test/sys/devices/virtual/tty/tty44/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty44/subsystem create mode 100644 test/sys/devices/virtual/tty/tty44/uevent create mode 100644 test/sys/devices/virtual/tty/tty45/dev create mode 100644 test/sys/devices/virtual/tty/tty45/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty45/subsystem create mode 100644 test/sys/devices/virtual/tty/tty45/uevent create mode 100644 test/sys/devices/virtual/tty/tty46/dev create mode 100644 test/sys/devices/virtual/tty/tty46/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty46/subsystem create mode 100644 test/sys/devices/virtual/tty/tty46/uevent create mode 100644 test/sys/devices/virtual/tty/tty47/dev create mode 100644 test/sys/devices/virtual/tty/tty47/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty47/subsystem create mode 100644 test/sys/devices/virtual/tty/tty47/uevent create mode 100644 test/sys/devices/virtual/tty/tty48/dev create mode 100644 test/sys/devices/virtual/tty/tty48/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty48/subsystem create mode 100644 test/sys/devices/virtual/tty/tty48/uevent create mode 100644 test/sys/devices/virtual/tty/tty49/dev create mode 100644 test/sys/devices/virtual/tty/tty49/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty49/subsystem create mode 100644 test/sys/devices/virtual/tty/tty49/uevent create mode 100644 test/sys/devices/virtual/tty/tty5/dev create mode 100644 test/sys/devices/virtual/tty/tty5/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty5/subsystem create mode 100644 test/sys/devices/virtual/tty/tty5/uevent create mode 100644 test/sys/devices/virtual/tty/tty50/dev create mode 100644 test/sys/devices/virtual/tty/tty50/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty50/subsystem create mode 100644 test/sys/devices/virtual/tty/tty50/uevent create mode 100644 test/sys/devices/virtual/tty/tty51/dev create mode 100644 test/sys/devices/virtual/tty/tty51/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty51/subsystem create mode 100644 test/sys/devices/virtual/tty/tty51/uevent create mode 100644 test/sys/devices/virtual/tty/tty52/dev create mode 100644 test/sys/devices/virtual/tty/tty52/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty52/subsystem create mode 100644 test/sys/devices/virtual/tty/tty52/uevent create mode 100644 test/sys/devices/virtual/tty/tty53/dev create mode 100644 test/sys/devices/virtual/tty/tty53/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty53/subsystem create mode 100644 test/sys/devices/virtual/tty/tty53/uevent create mode 100644 test/sys/devices/virtual/tty/tty54/dev create mode 100644 test/sys/devices/virtual/tty/tty54/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty54/subsystem create mode 100644 test/sys/devices/virtual/tty/tty54/uevent create mode 100644 test/sys/devices/virtual/tty/tty55/dev create mode 100644 test/sys/devices/virtual/tty/tty55/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty55/subsystem create mode 100644 test/sys/devices/virtual/tty/tty55/uevent create mode 100644 test/sys/devices/virtual/tty/tty56/dev create mode 100644 test/sys/devices/virtual/tty/tty56/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty56/subsystem create mode 100644 test/sys/devices/virtual/tty/tty56/uevent create mode 100644 test/sys/devices/virtual/tty/tty57/dev create mode 100644 test/sys/devices/virtual/tty/tty57/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty57/subsystem create mode 100644 test/sys/devices/virtual/tty/tty57/uevent create mode 100644 test/sys/devices/virtual/tty/tty58/dev create mode 100644 test/sys/devices/virtual/tty/tty58/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty58/subsystem create mode 100644 test/sys/devices/virtual/tty/tty58/uevent create mode 100644 test/sys/devices/virtual/tty/tty59/dev create mode 100644 test/sys/devices/virtual/tty/tty59/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty59/subsystem create mode 100644 test/sys/devices/virtual/tty/tty59/uevent create mode 100644 test/sys/devices/virtual/tty/tty6/dev create mode 100644 test/sys/devices/virtual/tty/tty6/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty6/subsystem create mode 100644 test/sys/devices/virtual/tty/tty6/uevent create mode 100644 test/sys/devices/virtual/tty/tty60/dev create mode 100644 test/sys/devices/virtual/tty/tty60/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty60/subsystem create mode 100644 test/sys/devices/virtual/tty/tty60/uevent create mode 100644 test/sys/devices/virtual/tty/tty61/dev create mode 100644 test/sys/devices/virtual/tty/tty61/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty61/subsystem create mode 100644 test/sys/devices/virtual/tty/tty61/uevent create mode 100644 test/sys/devices/virtual/tty/tty62/dev create mode 100644 test/sys/devices/virtual/tty/tty62/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty62/subsystem create mode 100644 test/sys/devices/virtual/tty/tty62/uevent create mode 100644 test/sys/devices/virtual/tty/tty63/dev create mode 100644 test/sys/devices/virtual/tty/tty63/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty63/subsystem create mode 100644 test/sys/devices/virtual/tty/tty63/uevent create mode 100644 test/sys/devices/virtual/tty/tty7/dev create mode 100644 test/sys/devices/virtual/tty/tty7/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty7/subsystem create mode 100644 test/sys/devices/virtual/tty/tty7/uevent create mode 100644 test/sys/devices/virtual/tty/tty8/dev create mode 100644 test/sys/devices/virtual/tty/tty8/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty8/subsystem create mode 100644 test/sys/devices/virtual/tty/tty8/uevent create mode 100644 test/sys/devices/virtual/tty/tty9/dev create mode 100644 test/sys/devices/virtual/tty/tty9/power/wakeup create mode 120000 test/sys/devices/virtual/tty/tty9/subsystem create mode 100644 test/sys/devices/virtual/tty/tty9/uevent create mode 100644 test/sys/devices/virtual/vc/vcs/dev create mode 100644 test/sys/devices/virtual/vc/vcs/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcs/subsystem create mode 100644 test/sys/devices/virtual/vc/vcs/uevent create mode 100644 test/sys/devices/virtual/vc/vcs1/dev create mode 100644 test/sys/devices/virtual/vc/vcs1/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcs1/subsystem create mode 100644 test/sys/devices/virtual/vc/vcs1/uevent create mode 100644 test/sys/devices/virtual/vc/vcs10/dev create mode 100644 test/sys/devices/virtual/vc/vcs10/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcs10/subsystem create mode 100644 test/sys/devices/virtual/vc/vcs10/uevent create mode 100644 test/sys/devices/virtual/vc/vcs2/dev create mode 100644 test/sys/devices/virtual/vc/vcs2/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcs2/subsystem create mode 100644 test/sys/devices/virtual/vc/vcs2/uevent create mode 100644 test/sys/devices/virtual/vc/vcs3/dev create mode 100644 test/sys/devices/virtual/vc/vcs3/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcs3/subsystem create mode 100644 test/sys/devices/virtual/vc/vcs3/uevent create mode 100644 test/sys/devices/virtual/vc/vcs4/dev create mode 100644 test/sys/devices/virtual/vc/vcs4/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcs4/subsystem create mode 100644 test/sys/devices/virtual/vc/vcs4/uevent create mode 100644 test/sys/devices/virtual/vc/vcs5/dev create mode 100644 test/sys/devices/virtual/vc/vcs5/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcs5/subsystem create mode 100644 test/sys/devices/virtual/vc/vcs5/uevent create mode 100644 test/sys/devices/virtual/vc/vcs6/dev create mode 100644 test/sys/devices/virtual/vc/vcs6/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcs6/subsystem create mode 100644 test/sys/devices/virtual/vc/vcs6/uevent create mode 100644 test/sys/devices/virtual/vc/vcs7/dev create mode 100644 test/sys/devices/virtual/vc/vcs7/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcs7/subsystem create mode 100644 test/sys/devices/virtual/vc/vcs7/uevent create mode 100644 test/sys/devices/virtual/vc/vcsa/dev create mode 100644 test/sys/devices/virtual/vc/vcsa/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcsa/subsystem create mode 100644 test/sys/devices/virtual/vc/vcsa/uevent create mode 100644 test/sys/devices/virtual/vc/vcsa1/dev create mode 100644 test/sys/devices/virtual/vc/vcsa1/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcsa1/subsystem create mode 100644 test/sys/devices/virtual/vc/vcsa1/uevent create mode 100644 test/sys/devices/virtual/vc/vcsa10/dev create mode 100644 test/sys/devices/virtual/vc/vcsa10/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcsa10/subsystem create mode 100644 test/sys/devices/virtual/vc/vcsa10/uevent create mode 100644 test/sys/devices/virtual/vc/vcsa2/dev create mode 100644 test/sys/devices/virtual/vc/vcsa2/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcsa2/subsystem create mode 100644 test/sys/devices/virtual/vc/vcsa2/uevent create mode 100644 test/sys/devices/virtual/vc/vcsa3/dev create mode 100644 test/sys/devices/virtual/vc/vcsa3/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcsa3/subsystem create mode 100644 test/sys/devices/virtual/vc/vcsa3/uevent create mode 100644 test/sys/devices/virtual/vc/vcsa4/dev create mode 100644 test/sys/devices/virtual/vc/vcsa4/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcsa4/subsystem create mode 100644 test/sys/devices/virtual/vc/vcsa4/uevent create mode 100644 test/sys/devices/virtual/vc/vcsa5/dev create mode 100644 test/sys/devices/virtual/vc/vcsa5/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcsa5/subsystem create mode 100644 test/sys/devices/virtual/vc/vcsa5/uevent create mode 100644 test/sys/devices/virtual/vc/vcsa6/dev create mode 100644 test/sys/devices/virtual/vc/vcsa6/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcsa6/subsystem create mode 100644 test/sys/devices/virtual/vc/vcsa6/uevent create mode 100644 test/sys/devices/virtual/vc/vcsa7/dev create mode 100644 test/sys/devices/virtual/vc/vcsa7/power/wakeup create mode 120000 test/sys/devices/virtual/vc/vcsa7/subsystem create mode 100644 test/sys/devices/virtual/vc/vcsa7/uevent create mode 100644 test/sys/devices/virtual/vtconsole/vtcon0/bind create mode 100644 test/sys/devices/virtual/vtconsole/vtcon0/name create mode 100644 test/sys/devices/virtual/vtconsole/vtcon0/power/wakeup create mode 120000 test/sys/devices/virtual/vtconsole/vtcon0/subsystem create mode 100644 test/sys/devices/virtual/vtconsole/vtcon0/uevent create mode 100644 test/sys/devices/virtual/vtconsole/vtcon1/bind create mode 100644 test/sys/devices/virtual/vtconsole/vtcon1/name create mode 100644 test/sys/devices/virtual/vtconsole/vtcon1/power/wakeup create mode 120000 test/sys/devices/virtual/vtconsole/vtcon1/subsystem create mode 100644 test/sys/devices/virtual/vtconsole/vtcon1/uevent create mode 100644 test/sys/firmware/acpi/interrupts/error create mode 100644 test/sys/firmware/acpi/interrupts/ff_gbl_lock create mode 100644 test/sys/firmware/acpi/interrupts/ff_pmtimer create mode 100644 test/sys/firmware/acpi/interrupts/ff_pwr_btn create mode 100644 test/sys/firmware/acpi/interrupts/ff_rt_clk create mode 100644 test/sys/firmware/acpi/interrupts/ff_slp_btn create mode 100644 test/sys/firmware/acpi/interrupts/gpe00 create mode 100644 test/sys/firmware/acpi/interrupts/gpe01 create mode 100644 test/sys/firmware/acpi/interrupts/gpe02 create mode 100644 test/sys/firmware/acpi/interrupts/gpe03 create mode 100644 test/sys/firmware/acpi/interrupts/gpe04 create mode 100644 test/sys/firmware/acpi/interrupts/gpe05 create mode 100644 test/sys/firmware/acpi/interrupts/gpe06 create mode 100644 test/sys/firmware/acpi/interrupts/gpe07 create mode 100644 test/sys/firmware/acpi/interrupts/gpe08 create mode 100644 test/sys/firmware/acpi/interrupts/gpe09 create mode 100644 test/sys/firmware/acpi/interrupts/gpe0A create mode 100644 test/sys/firmware/acpi/interrupts/gpe0B create mode 100644 test/sys/firmware/acpi/interrupts/gpe0C create mode 100644 test/sys/firmware/acpi/interrupts/gpe0D create mode 100644 test/sys/firmware/acpi/interrupts/gpe0E create mode 100644 test/sys/firmware/acpi/interrupts/gpe0F create mode 100644 test/sys/firmware/acpi/interrupts/gpe10 create mode 100644 test/sys/firmware/acpi/interrupts/gpe11 create mode 100644 test/sys/firmware/acpi/interrupts/gpe12 create mode 100644 test/sys/firmware/acpi/interrupts/gpe13 create mode 100644 test/sys/firmware/acpi/interrupts/gpe14 create mode 100644 test/sys/firmware/acpi/interrupts/gpe15 create mode 100644 test/sys/firmware/acpi/interrupts/gpe16 create mode 100644 test/sys/firmware/acpi/interrupts/gpe17 create mode 100644 test/sys/firmware/acpi/interrupts/gpe18 create mode 100644 test/sys/firmware/acpi/interrupts/gpe19 create mode 100644 test/sys/firmware/acpi/interrupts/gpe1A create mode 100644 test/sys/firmware/acpi/interrupts/gpe1B create mode 100644 test/sys/firmware/acpi/interrupts/gpe1C create mode 100644 test/sys/firmware/acpi/interrupts/gpe1D create mode 100644 test/sys/firmware/acpi/interrupts/gpe1E create mode 100644 test/sys/firmware/acpi/interrupts/gpe1F create mode 100644 test/sys/firmware/acpi/interrupts/gpe_all create mode 100644 test/sys/firmware/acpi/interrupts/sci create mode 100644 test/sys/firmware/acpi/tables/APIC create mode 100644 test/sys/firmware/acpi/tables/BOOT create mode 100644 test/sys/firmware/acpi/tables/DSDT create mode 100644 test/sys/firmware/acpi/tables/ECDT create mode 100644 test/sys/firmware/acpi/tables/FACP create mode 100644 test/sys/firmware/acpi/tables/FACS create mode 100644 test/sys/firmware/acpi/tables/HPET create mode 100644 test/sys/firmware/acpi/tables/MCFG create mode 100644 test/sys/firmware/acpi/tables/SLIC create mode 100644 test/sys/firmware/acpi/tables/SSDT1 create mode 100644 test/sys/firmware/acpi/tables/SSDT2 create mode 100644 test/sys/firmware/acpi/tables/SSDT3 create mode 100644 test/sys/firmware/acpi/tables/SSDT4 create mode 100644 test/sys/firmware/acpi/tables/SSDT5 create mode 100644 test/sys/firmware/acpi/tables/TCPA create mode 100644 test/sys/firmware/edd/int13_dev80/default_cylinders create mode 100644 test/sys/firmware/edd/int13_dev80/default_heads create mode 100644 test/sys/firmware/edd/int13_dev80/default_sectors_per_track create mode 100644 test/sys/firmware/edd/int13_dev80/extensions create mode 100644 test/sys/firmware/edd/int13_dev80/host_bus create mode 100644 test/sys/firmware/edd/int13_dev80/info_flags create mode 100644 test/sys/firmware/edd/int13_dev80/interface create mode 100644 test/sys/firmware/edd/int13_dev80/legacy_max_cylinder create mode 100644 test/sys/firmware/edd/int13_dev80/legacy_max_head create mode 100644 test/sys/firmware/edd/int13_dev80/legacy_sectors_per_track create mode 100644 test/sys/firmware/edd/int13_dev80/mbr_signature create mode 120000 test/sys/firmware/edd/int13_dev80/pci_dev create mode 100644 test/sys/firmware/edd/int13_dev80/raw_data create mode 100644 test/sys/firmware/edd/int13_dev80/sectors create mode 100644 test/sys/firmware/edd/int13_dev80/version create mode 100644 test/sys/firmware/memmap/0/end create mode 100644 test/sys/firmware/memmap/0/start create mode 100644 test/sys/firmware/memmap/0/type create mode 100644 test/sys/firmware/memmap/1/end create mode 100644 test/sys/firmware/memmap/1/start create mode 100644 test/sys/firmware/memmap/1/type create mode 100644 test/sys/firmware/memmap/10/end create mode 100644 test/sys/firmware/memmap/10/start create mode 100644 test/sys/firmware/memmap/10/type create mode 100644 test/sys/firmware/memmap/11/end create mode 100644 test/sys/firmware/memmap/11/start create mode 100644 test/sys/firmware/memmap/11/type create mode 100644 test/sys/firmware/memmap/12/end create mode 100644 test/sys/firmware/memmap/12/start create mode 100644 test/sys/firmware/memmap/12/type create mode 100644 test/sys/firmware/memmap/13/end create mode 100644 test/sys/firmware/memmap/13/start create mode 100644 test/sys/firmware/memmap/13/type create mode 100644 test/sys/firmware/memmap/2/end create mode 100644 test/sys/firmware/memmap/2/start create mode 100644 test/sys/firmware/memmap/2/type create mode 100644 test/sys/firmware/memmap/3/end create mode 100644 test/sys/firmware/memmap/3/start create mode 100644 test/sys/firmware/memmap/3/type create mode 100644 test/sys/firmware/memmap/4/end create mode 100644 test/sys/firmware/memmap/4/start create mode 100644 test/sys/firmware/memmap/4/type create mode 100644 test/sys/firmware/memmap/5/end create mode 100644 test/sys/firmware/memmap/5/start create mode 100644 test/sys/firmware/memmap/5/type create mode 100644 test/sys/firmware/memmap/6/end create mode 100644 test/sys/firmware/memmap/6/start create mode 100644 test/sys/firmware/memmap/6/type create mode 100644 test/sys/firmware/memmap/7/end create mode 100644 test/sys/firmware/memmap/7/start create mode 100644 test/sys/firmware/memmap/7/type create mode 100644 test/sys/firmware/memmap/8/end create mode 100644 test/sys/firmware/memmap/8/start create mode 100644 test/sys/firmware/memmap/8/type create mode 100644 test/sys/firmware/memmap/9/end create mode 100644 test/sys/firmware/memmap/9/start create mode 100644 test/sys/firmware/memmap/9/type create mode 100644 test/sys/fs/fuse/connections/16/abort create mode 100644 test/sys/fs/fuse/connections/16/waiting create mode 100644 test/sys/kernel/debug/bdi/0:16/stats create mode 100644 test/sys/kernel/debug/bdi/11:0/stats create mode 100644 test/sys/kernel/debug/bdi/7:0/stats create mode 100644 test/sys/kernel/debug/bdi/7:1/stats create mode 100644 test/sys/kernel/debug/bdi/7:2/stats create mode 100644 test/sys/kernel/debug/bdi/7:3/stats create mode 100644 test/sys/kernel/debug/bdi/7:4/stats create mode 100644 test/sys/kernel/debug/bdi/7:5/stats create mode 100644 test/sys/kernel/debug/bdi/7:6/stats create mode 100644 test/sys/kernel/debug/bdi/7:7/stats create mode 100644 test/sys/kernel/debug/bdi/8:0/stats create mode 100644 test/sys/kernel/debug/bdi/8:16/stats create mode 100644 test/sys/kernel/debug/bdi/9:0/stats create mode 100644 test/sys/kernel/debug/bdi/default/stats create mode 100644 test/sys/kernel/debug/x86/pat_memtype_list create mode 100644 test/sys/kernel/kexec_crash_loaded create mode 100644 test/sys/kernel/kexec_loaded create mode 100644 test/sys/kernel/notes create mode 100644 test/sys/kernel/slab/Acpi-Namespace/aliases create mode 100644 test/sys/kernel/slab/Acpi-Namespace/align create mode 100644 test/sys/kernel/slab/Acpi-Namespace/alloc_calls create mode 100644 test/sys/kernel/slab/Acpi-Namespace/cache_dma create mode 100644 test/sys/kernel/slab/Acpi-Namespace/cpu_slabs create mode 100644 test/sys/kernel/slab/Acpi-Namespace/ctor create mode 100644 test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu create mode 100644 test/sys/kernel/slab/Acpi-Namespace/free_calls create mode 100644 test/sys/kernel/slab/Acpi-Namespace/hwcache_align create mode 100644 test/sys/kernel/slab/Acpi-Namespace/object_size create mode 100644 test/sys/kernel/slab/Acpi-Namespace/objects create mode 100644 test/sys/kernel/slab/Acpi-Namespace/objects_partial create mode 100644 test/sys/kernel/slab/Acpi-Namespace/objs_per_slab create mode 100644 test/sys/kernel/slab/Acpi-Namespace/order create mode 100644 test/sys/kernel/slab/Acpi-Namespace/partial create mode 100644 test/sys/kernel/slab/Acpi-Namespace/poison create mode 100644 test/sys/kernel/slab/Acpi-Namespace/reclaim_account create mode 100644 test/sys/kernel/slab/Acpi-Namespace/red_zone create mode 100644 test/sys/kernel/slab/Acpi-Namespace/sanity_checks create mode 100644 test/sys/kernel/slab/Acpi-Namespace/shrink create mode 100644 test/sys/kernel/slab/Acpi-Namespace/slab_size create mode 100644 test/sys/kernel/slab/Acpi-Namespace/slabs create mode 100644 test/sys/kernel/slab/Acpi-Namespace/store_user create mode 100644 test/sys/kernel/slab/Acpi-Namespace/total_objects create mode 100644 test/sys/kernel/slab/Acpi-Namespace/trace create mode 100644 test/sys/kernel/slab/Acpi-Namespace/validate create mode 100644 test/sys/kernel/slab/Acpi-Operand/aliases create mode 100644 test/sys/kernel/slab/Acpi-Operand/align create mode 100644 test/sys/kernel/slab/Acpi-Operand/alloc_calls create mode 100644 test/sys/kernel/slab/Acpi-Operand/cache_dma create mode 100644 test/sys/kernel/slab/Acpi-Operand/cpu_slabs create mode 100644 test/sys/kernel/slab/Acpi-Operand/ctor create mode 100644 test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu create mode 100644 test/sys/kernel/slab/Acpi-Operand/free_calls create mode 100644 test/sys/kernel/slab/Acpi-Operand/hwcache_align create mode 100644 test/sys/kernel/slab/Acpi-Operand/object_size create mode 100644 test/sys/kernel/slab/Acpi-Operand/objects create mode 100644 test/sys/kernel/slab/Acpi-Operand/objects_partial create mode 100644 test/sys/kernel/slab/Acpi-Operand/objs_per_slab create mode 100644 test/sys/kernel/slab/Acpi-Operand/order create mode 100644 test/sys/kernel/slab/Acpi-Operand/partial create mode 100644 test/sys/kernel/slab/Acpi-Operand/poison create mode 100644 test/sys/kernel/slab/Acpi-Operand/reclaim_account create mode 100644 test/sys/kernel/slab/Acpi-Operand/red_zone create mode 100644 test/sys/kernel/slab/Acpi-Operand/sanity_checks create mode 100644 test/sys/kernel/slab/Acpi-Operand/shrink create mode 100644 test/sys/kernel/slab/Acpi-Operand/slab_size create mode 100644 test/sys/kernel/slab/Acpi-Operand/slabs create mode 100644 test/sys/kernel/slab/Acpi-Operand/store_user create mode 100644 test/sys/kernel/slab/Acpi-Operand/total_objects create mode 100644 test/sys/kernel/slab/Acpi-Operand/trace create mode 100644 test/sys/kernel/slab/Acpi-Operand/validate create mode 100644 test/sys/kernel/slab/Acpi-Parse/aliases create mode 100644 test/sys/kernel/slab/Acpi-Parse/align create mode 100644 test/sys/kernel/slab/Acpi-Parse/alloc_calls create mode 100644 test/sys/kernel/slab/Acpi-Parse/cache_dma create mode 100644 test/sys/kernel/slab/Acpi-Parse/cpu_slabs create mode 100644 test/sys/kernel/slab/Acpi-Parse/ctor create mode 100644 test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu create mode 100644 test/sys/kernel/slab/Acpi-Parse/free_calls create mode 100644 test/sys/kernel/slab/Acpi-Parse/hwcache_align create mode 100644 test/sys/kernel/slab/Acpi-Parse/object_size create mode 100644 test/sys/kernel/slab/Acpi-Parse/objects create mode 100644 test/sys/kernel/slab/Acpi-Parse/objects_partial create mode 100644 test/sys/kernel/slab/Acpi-Parse/objs_per_slab create mode 100644 test/sys/kernel/slab/Acpi-Parse/order create mode 100644 test/sys/kernel/slab/Acpi-Parse/partial create mode 100644 test/sys/kernel/slab/Acpi-Parse/poison create mode 100644 test/sys/kernel/slab/Acpi-Parse/reclaim_account create mode 100644 test/sys/kernel/slab/Acpi-Parse/red_zone create mode 100644 test/sys/kernel/slab/Acpi-Parse/sanity_checks create mode 100644 test/sys/kernel/slab/Acpi-Parse/shrink create mode 100644 test/sys/kernel/slab/Acpi-Parse/slab_size create mode 100644 test/sys/kernel/slab/Acpi-Parse/slabs create mode 100644 test/sys/kernel/slab/Acpi-Parse/store_user create mode 100644 test/sys/kernel/slab/Acpi-Parse/total_objects create mode 100644 test/sys/kernel/slab/Acpi-Parse/trace create mode 100644 test/sys/kernel/slab/Acpi-Parse/validate create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/aliases create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/align create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/alloc_calls create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/cache_dma create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/ctor create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/free_calls create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/hwcache_align create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/object_size create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/objects create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/objects_partial create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/order create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/partial create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/poison create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/reclaim_account create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/red_zone create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/sanity_checks create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/shrink create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/slab_size create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/slabs create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/store_user create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/total_objects create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/trace create mode 100644 test/sys/kernel/slab/Acpi-ParseExt/validate create mode 100644 test/sys/kernel/slab/Acpi-State/aliases create mode 100644 test/sys/kernel/slab/Acpi-State/align create mode 100644 test/sys/kernel/slab/Acpi-State/alloc_calls create mode 100644 test/sys/kernel/slab/Acpi-State/cache_dma create mode 100644 test/sys/kernel/slab/Acpi-State/cpu_slabs create mode 100644 test/sys/kernel/slab/Acpi-State/ctor create mode 100644 test/sys/kernel/slab/Acpi-State/destroy_by_rcu create mode 100644 test/sys/kernel/slab/Acpi-State/free_calls create mode 100644 test/sys/kernel/slab/Acpi-State/hwcache_align create mode 100644 test/sys/kernel/slab/Acpi-State/object_size create mode 100644 test/sys/kernel/slab/Acpi-State/objects create mode 100644 test/sys/kernel/slab/Acpi-State/objects_partial create mode 100644 test/sys/kernel/slab/Acpi-State/objs_per_slab create mode 100644 test/sys/kernel/slab/Acpi-State/order create mode 100644 test/sys/kernel/slab/Acpi-State/partial create mode 100644 test/sys/kernel/slab/Acpi-State/poison create mode 100644 test/sys/kernel/slab/Acpi-State/reclaim_account create mode 100644 test/sys/kernel/slab/Acpi-State/red_zone create mode 100644 test/sys/kernel/slab/Acpi-State/sanity_checks create mode 100644 test/sys/kernel/slab/Acpi-State/shrink create mode 100644 test/sys/kernel/slab/Acpi-State/slab_size create mode 100644 test/sys/kernel/slab/Acpi-State/slabs create mode 100644 test/sys/kernel/slab/Acpi-State/store_user create mode 100644 test/sys/kernel/slab/Acpi-State/total_objects create mode 100644 test/sys/kernel/slab/Acpi-State/trace create mode 100644 test/sys/kernel/slab/Acpi-State/validate create mode 100644 test/sys/kernel/slab/RAW/aliases create mode 100644 test/sys/kernel/slab/RAW/align create mode 100644 test/sys/kernel/slab/RAW/alloc_calls create mode 100644 test/sys/kernel/slab/RAW/cache_dma create mode 100644 test/sys/kernel/slab/RAW/cpu_slabs create mode 100644 test/sys/kernel/slab/RAW/ctor create mode 100644 test/sys/kernel/slab/RAW/destroy_by_rcu create mode 100644 test/sys/kernel/slab/RAW/free_calls create mode 100644 test/sys/kernel/slab/RAW/hwcache_align create mode 100644 test/sys/kernel/slab/RAW/object_size create mode 100644 test/sys/kernel/slab/RAW/objects create mode 100644 test/sys/kernel/slab/RAW/objects_partial create mode 100644 test/sys/kernel/slab/RAW/objs_per_slab create mode 100644 test/sys/kernel/slab/RAW/order create mode 100644 test/sys/kernel/slab/RAW/partial create mode 100644 test/sys/kernel/slab/RAW/poison create mode 100644 test/sys/kernel/slab/RAW/reclaim_account create mode 100644 test/sys/kernel/slab/RAW/red_zone create mode 100644 test/sys/kernel/slab/RAW/sanity_checks create mode 100644 test/sys/kernel/slab/RAW/shrink create mode 100644 test/sys/kernel/slab/RAW/slab_size create mode 100644 test/sys/kernel/slab/RAW/slabs create mode 100644 test/sys/kernel/slab/RAW/store_user create mode 100644 test/sys/kernel/slab/RAW/total_objects create mode 100644 test/sys/kernel/slab/RAW/trace create mode 100644 test/sys/kernel/slab/RAW/validate create mode 100644 test/sys/kernel/slab/RAWv6/aliases create mode 100644 test/sys/kernel/slab/RAWv6/align create mode 100644 test/sys/kernel/slab/RAWv6/alloc_calls create mode 100644 test/sys/kernel/slab/RAWv6/cache_dma create mode 100644 test/sys/kernel/slab/RAWv6/cpu_slabs create mode 100644 test/sys/kernel/slab/RAWv6/ctor create mode 100644 test/sys/kernel/slab/RAWv6/destroy_by_rcu create mode 100644 test/sys/kernel/slab/RAWv6/free_calls create mode 100644 test/sys/kernel/slab/RAWv6/hwcache_align create mode 100644 test/sys/kernel/slab/RAWv6/object_size create mode 100644 test/sys/kernel/slab/RAWv6/objects create mode 100644 test/sys/kernel/slab/RAWv6/objects_partial create mode 100644 test/sys/kernel/slab/RAWv6/objs_per_slab create mode 100644 test/sys/kernel/slab/RAWv6/order create mode 100644 test/sys/kernel/slab/RAWv6/partial create mode 100644 test/sys/kernel/slab/RAWv6/poison create mode 100644 test/sys/kernel/slab/RAWv6/reclaim_account create mode 100644 test/sys/kernel/slab/RAWv6/red_zone create mode 100644 test/sys/kernel/slab/RAWv6/sanity_checks create mode 100644 test/sys/kernel/slab/RAWv6/shrink create mode 100644 test/sys/kernel/slab/RAWv6/slab_size create mode 100644 test/sys/kernel/slab/RAWv6/slabs create mode 100644 test/sys/kernel/slab/RAWv6/store_user create mode 100644 test/sys/kernel/slab/RAWv6/total_objects create mode 100644 test/sys/kernel/slab/RAWv6/trace create mode 100644 test/sys/kernel/slab/RAWv6/validate create mode 100644 test/sys/kernel/slab/TCP/aliases create mode 100644 test/sys/kernel/slab/TCP/align create mode 100644 test/sys/kernel/slab/TCP/alloc_calls create mode 100644 test/sys/kernel/slab/TCP/cache_dma create mode 100644 test/sys/kernel/slab/TCP/cpu_slabs create mode 100644 test/sys/kernel/slab/TCP/ctor create mode 100644 test/sys/kernel/slab/TCP/destroy_by_rcu create mode 100644 test/sys/kernel/slab/TCP/free_calls create mode 100644 test/sys/kernel/slab/TCP/hwcache_align create mode 100644 test/sys/kernel/slab/TCP/object_size create mode 100644 test/sys/kernel/slab/TCP/objects create mode 100644 test/sys/kernel/slab/TCP/objects_partial create mode 100644 test/sys/kernel/slab/TCP/objs_per_slab create mode 100644 test/sys/kernel/slab/TCP/order create mode 100644 test/sys/kernel/slab/TCP/partial create mode 100644 test/sys/kernel/slab/TCP/poison create mode 100644 test/sys/kernel/slab/TCP/reclaim_account create mode 100644 test/sys/kernel/slab/TCP/red_zone create mode 100644 test/sys/kernel/slab/TCP/sanity_checks create mode 100644 test/sys/kernel/slab/TCP/shrink create mode 100644 test/sys/kernel/slab/TCP/slab_size create mode 100644 test/sys/kernel/slab/TCP/slabs create mode 100644 test/sys/kernel/slab/TCP/store_user create mode 100644 test/sys/kernel/slab/TCP/total_objects create mode 100644 test/sys/kernel/slab/TCP/trace create mode 100644 test/sys/kernel/slab/TCP/validate create mode 100644 test/sys/kernel/slab/TCPv6/aliases create mode 100644 test/sys/kernel/slab/TCPv6/align create mode 100644 test/sys/kernel/slab/TCPv6/alloc_calls create mode 100644 test/sys/kernel/slab/TCPv6/cache_dma create mode 100644 test/sys/kernel/slab/TCPv6/cpu_slabs create mode 100644 test/sys/kernel/slab/TCPv6/ctor create mode 100644 test/sys/kernel/slab/TCPv6/destroy_by_rcu create mode 100644 test/sys/kernel/slab/TCPv6/free_calls create mode 100644 test/sys/kernel/slab/TCPv6/hwcache_align create mode 100644 test/sys/kernel/slab/TCPv6/object_size create mode 100644 test/sys/kernel/slab/TCPv6/objects create mode 100644 test/sys/kernel/slab/TCPv6/objects_partial create mode 100644 test/sys/kernel/slab/TCPv6/objs_per_slab create mode 100644 test/sys/kernel/slab/TCPv6/order create mode 100644 test/sys/kernel/slab/TCPv6/partial create mode 100644 test/sys/kernel/slab/TCPv6/poison create mode 100644 test/sys/kernel/slab/TCPv6/reclaim_account create mode 100644 test/sys/kernel/slab/TCPv6/red_zone create mode 100644 test/sys/kernel/slab/TCPv6/sanity_checks create mode 100644 test/sys/kernel/slab/TCPv6/shrink create mode 100644 test/sys/kernel/slab/TCPv6/slab_size create mode 100644 test/sys/kernel/slab/TCPv6/slabs create mode 100644 test/sys/kernel/slab/TCPv6/store_user create mode 100644 test/sys/kernel/slab/TCPv6/total_objects create mode 100644 test/sys/kernel/slab/TCPv6/trace create mode 100644 test/sys/kernel/slab/TCPv6/validate create mode 100644 test/sys/kernel/slab/UDP-Lite/aliases create mode 100644 test/sys/kernel/slab/UDP-Lite/align create mode 100644 test/sys/kernel/slab/UDP-Lite/alloc_calls create mode 100644 test/sys/kernel/slab/UDP-Lite/cache_dma create mode 100644 test/sys/kernel/slab/UDP-Lite/cpu_slabs create mode 100644 test/sys/kernel/slab/UDP-Lite/ctor create mode 100644 test/sys/kernel/slab/UDP-Lite/destroy_by_rcu create mode 100644 test/sys/kernel/slab/UDP-Lite/free_calls create mode 100644 test/sys/kernel/slab/UDP-Lite/hwcache_align create mode 100644 test/sys/kernel/slab/UDP-Lite/object_size create mode 100644 test/sys/kernel/slab/UDP-Lite/objects create mode 100644 test/sys/kernel/slab/UDP-Lite/objects_partial create mode 100644 test/sys/kernel/slab/UDP-Lite/objs_per_slab create mode 100644 test/sys/kernel/slab/UDP-Lite/order create mode 100644 test/sys/kernel/slab/UDP-Lite/partial create mode 100644 test/sys/kernel/slab/UDP-Lite/poison create mode 100644 test/sys/kernel/slab/UDP-Lite/reclaim_account create mode 100644 test/sys/kernel/slab/UDP-Lite/red_zone create mode 100644 test/sys/kernel/slab/UDP-Lite/sanity_checks create mode 100644 test/sys/kernel/slab/UDP-Lite/shrink create mode 100644 test/sys/kernel/slab/UDP-Lite/slab_size create mode 100644 test/sys/kernel/slab/UDP-Lite/slabs create mode 100644 test/sys/kernel/slab/UDP-Lite/store_user create mode 100644 test/sys/kernel/slab/UDP-Lite/total_objects create mode 100644 test/sys/kernel/slab/UDP-Lite/trace create mode 100644 test/sys/kernel/slab/UDP-Lite/validate create mode 100644 test/sys/kernel/slab/UDP/aliases create mode 100644 test/sys/kernel/slab/UDP/align create mode 100644 test/sys/kernel/slab/UDP/alloc_calls create mode 100644 test/sys/kernel/slab/UDP/cache_dma create mode 100644 test/sys/kernel/slab/UDP/cpu_slabs create mode 100644 test/sys/kernel/slab/UDP/ctor create mode 100644 test/sys/kernel/slab/UDP/destroy_by_rcu create mode 100644 test/sys/kernel/slab/UDP/free_calls create mode 100644 test/sys/kernel/slab/UDP/hwcache_align create mode 100644 test/sys/kernel/slab/UDP/object_size create mode 100644 test/sys/kernel/slab/UDP/objects create mode 100644 test/sys/kernel/slab/UDP/objects_partial create mode 100644 test/sys/kernel/slab/UDP/objs_per_slab create mode 100644 test/sys/kernel/slab/UDP/order create mode 100644 test/sys/kernel/slab/UDP/partial create mode 100644 test/sys/kernel/slab/UDP/poison create mode 100644 test/sys/kernel/slab/UDP/reclaim_account create mode 100644 test/sys/kernel/slab/UDP/red_zone create mode 100644 test/sys/kernel/slab/UDP/sanity_checks create mode 100644 test/sys/kernel/slab/UDP/shrink create mode 100644 test/sys/kernel/slab/UDP/slab_size create mode 100644 test/sys/kernel/slab/UDP/slabs create mode 100644 test/sys/kernel/slab/UDP/store_user create mode 100644 test/sys/kernel/slab/UDP/total_objects create mode 100644 test/sys/kernel/slab/UDP/trace create mode 100644 test/sys/kernel/slab/UDP/validate create mode 100644 test/sys/kernel/slab/UDPLITEv6/aliases create mode 100644 test/sys/kernel/slab/UDPLITEv6/align create mode 100644 test/sys/kernel/slab/UDPLITEv6/alloc_calls create mode 100644 test/sys/kernel/slab/UDPLITEv6/cache_dma create mode 100644 test/sys/kernel/slab/UDPLITEv6/cpu_slabs create mode 100644 test/sys/kernel/slab/UDPLITEv6/ctor create mode 100644 test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu create mode 100644 test/sys/kernel/slab/UDPLITEv6/free_calls create mode 100644 test/sys/kernel/slab/UDPLITEv6/hwcache_align create mode 100644 test/sys/kernel/slab/UDPLITEv6/object_size create mode 100644 test/sys/kernel/slab/UDPLITEv6/objects create mode 100644 test/sys/kernel/slab/UDPLITEv6/objects_partial create mode 100644 test/sys/kernel/slab/UDPLITEv6/objs_per_slab create mode 100644 test/sys/kernel/slab/UDPLITEv6/order create mode 100644 test/sys/kernel/slab/UDPLITEv6/partial create mode 100644 test/sys/kernel/slab/UDPLITEv6/poison create mode 100644 test/sys/kernel/slab/UDPLITEv6/reclaim_account create mode 100644 test/sys/kernel/slab/UDPLITEv6/red_zone create mode 100644 test/sys/kernel/slab/UDPLITEv6/sanity_checks create mode 100644 test/sys/kernel/slab/UDPLITEv6/shrink create mode 100644 test/sys/kernel/slab/UDPLITEv6/slab_size create mode 100644 test/sys/kernel/slab/UDPLITEv6/slabs create mode 100644 test/sys/kernel/slab/UDPLITEv6/store_user create mode 100644 test/sys/kernel/slab/UDPLITEv6/total_objects create mode 100644 test/sys/kernel/slab/UDPLITEv6/trace create mode 100644 test/sys/kernel/slab/UDPLITEv6/validate create mode 100644 test/sys/kernel/slab/UDPv6/aliases create mode 100644 test/sys/kernel/slab/UDPv6/align create mode 100644 test/sys/kernel/slab/UDPv6/alloc_calls create mode 100644 test/sys/kernel/slab/UDPv6/cache_dma create mode 100644 test/sys/kernel/slab/UDPv6/cpu_slabs create mode 100644 test/sys/kernel/slab/UDPv6/ctor create mode 100644 test/sys/kernel/slab/UDPv6/destroy_by_rcu create mode 100644 test/sys/kernel/slab/UDPv6/free_calls create mode 100644 test/sys/kernel/slab/UDPv6/hwcache_align create mode 100644 test/sys/kernel/slab/UDPv6/object_size create mode 100644 test/sys/kernel/slab/UDPv6/objects create mode 100644 test/sys/kernel/slab/UDPv6/objects_partial create mode 100644 test/sys/kernel/slab/UDPv6/objs_per_slab create mode 100644 test/sys/kernel/slab/UDPv6/order create mode 100644 test/sys/kernel/slab/UDPv6/partial create mode 100644 test/sys/kernel/slab/UDPv6/poison create mode 100644 test/sys/kernel/slab/UDPv6/reclaim_account create mode 100644 test/sys/kernel/slab/UDPv6/red_zone create mode 100644 test/sys/kernel/slab/UDPv6/sanity_checks create mode 100644 test/sys/kernel/slab/UDPv6/shrink create mode 100644 test/sys/kernel/slab/UDPv6/slab_size create mode 100644 test/sys/kernel/slab/UDPv6/slabs create mode 100644 test/sys/kernel/slab/UDPv6/store_user create mode 100644 test/sys/kernel/slab/UDPv6/total_objects create mode 100644 test/sys/kernel/slab/UDPv6/trace create mode 100644 test/sys/kernel/slab/UDPv6/validate create mode 100644 test/sys/kernel/slab/UNIX/aliases create mode 100644 test/sys/kernel/slab/UNIX/align create mode 100644 test/sys/kernel/slab/UNIX/alloc_calls create mode 100644 test/sys/kernel/slab/UNIX/cache_dma create mode 100644 test/sys/kernel/slab/UNIX/cpu_slabs create mode 100644 test/sys/kernel/slab/UNIX/ctor create mode 100644 test/sys/kernel/slab/UNIX/destroy_by_rcu create mode 100644 test/sys/kernel/slab/UNIX/free_calls create mode 100644 test/sys/kernel/slab/UNIX/hwcache_align create mode 100644 test/sys/kernel/slab/UNIX/object_size create mode 100644 test/sys/kernel/slab/UNIX/objects create mode 100644 test/sys/kernel/slab/UNIX/objects_partial create mode 100644 test/sys/kernel/slab/UNIX/objs_per_slab create mode 100644 test/sys/kernel/slab/UNIX/order create mode 100644 test/sys/kernel/slab/UNIX/partial create mode 100644 test/sys/kernel/slab/UNIX/poison create mode 100644 test/sys/kernel/slab/UNIX/reclaim_account create mode 100644 test/sys/kernel/slab/UNIX/red_zone create mode 100644 test/sys/kernel/slab/UNIX/sanity_checks create mode 100644 test/sys/kernel/slab/UNIX/shrink create mode 100644 test/sys/kernel/slab/UNIX/slab_size create mode 100644 test/sys/kernel/slab/UNIX/slabs create mode 100644 test/sys/kernel/slab/UNIX/store_user create mode 100644 test/sys/kernel/slab/UNIX/total_objects create mode 100644 test/sys/kernel/slab/UNIX/trace create mode 100644 test/sys/kernel/slab/UNIX/validate create mode 100644 test/sys/kernel/slab/anon_vma/aliases create mode 100644 test/sys/kernel/slab/anon_vma/align create mode 100644 test/sys/kernel/slab/anon_vma/alloc_calls create mode 100644 test/sys/kernel/slab/anon_vma/cache_dma create mode 100644 test/sys/kernel/slab/anon_vma/cpu_slabs create mode 100644 test/sys/kernel/slab/anon_vma/ctor create mode 100644 test/sys/kernel/slab/anon_vma/destroy_by_rcu create mode 100644 test/sys/kernel/slab/anon_vma/free_calls create mode 100644 test/sys/kernel/slab/anon_vma/hwcache_align create mode 100644 test/sys/kernel/slab/anon_vma/object_size create mode 100644 test/sys/kernel/slab/anon_vma/objects create mode 100644 test/sys/kernel/slab/anon_vma/objects_partial create mode 100644 test/sys/kernel/slab/anon_vma/objs_per_slab create mode 100644 test/sys/kernel/slab/anon_vma/order create mode 100644 test/sys/kernel/slab/anon_vma/partial create mode 100644 test/sys/kernel/slab/anon_vma/poison create mode 100644 test/sys/kernel/slab/anon_vma/reclaim_account create mode 100644 test/sys/kernel/slab/anon_vma/red_zone create mode 100644 test/sys/kernel/slab/anon_vma/sanity_checks create mode 100644 test/sys/kernel/slab/anon_vma/shrink create mode 100644 test/sys/kernel/slab/anon_vma/slab_size create mode 100644 test/sys/kernel/slab/anon_vma/slabs create mode 100644 test/sys/kernel/slab/anon_vma/store_user create mode 100644 test/sys/kernel/slab/anon_vma/total_objects create mode 100644 test/sys/kernel/slab/anon_vma/trace create mode 100644 test/sys/kernel/slab/anon_vma/validate create mode 100644 test/sys/kernel/slab/arp_cache/aliases create mode 100644 test/sys/kernel/slab/arp_cache/align create mode 100644 test/sys/kernel/slab/arp_cache/alloc_calls create mode 100644 test/sys/kernel/slab/arp_cache/cache_dma create mode 100644 test/sys/kernel/slab/arp_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/arp_cache/ctor create mode 100644 test/sys/kernel/slab/arp_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/arp_cache/free_calls create mode 100644 test/sys/kernel/slab/arp_cache/hwcache_align create mode 100644 test/sys/kernel/slab/arp_cache/object_size create mode 100644 test/sys/kernel/slab/arp_cache/objects create mode 100644 test/sys/kernel/slab/arp_cache/objects_partial create mode 100644 test/sys/kernel/slab/arp_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/arp_cache/order create mode 100644 test/sys/kernel/slab/arp_cache/partial create mode 100644 test/sys/kernel/slab/arp_cache/poison create mode 100644 test/sys/kernel/slab/arp_cache/reclaim_account create mode 100644 test/sys/kernel/slab/arp_cache/red_zone create mode 100644 test/sys/kernel/slab/arp_cache/sanity_checks create mode 100644 test/sys/kernel/slab/arp_cache/shrink create mode 100644 test/sys/kernel/slab/arp_cache/slab_size create mode 100644 test/sys/kernel/slab/arp_cache/slabs create mode 100644 test/sys/kernel/slab/arp_cache/store_user create mode 100644 test/sys/kernel/slab/arp_cache/total_objects create mode 100644 test/sys/kernel/slab/arp_cache/trace create mode 100644 test/sys/kernel/slab/arp_cache/validate create mode 100644 test/sys/kernel/slab/bdev_cache/aliases create mode 100644 test/sys/kernel/slab/bdev_cache/align create mode 100644 test/sys/kernel/slab/bdev_cache/alloc_calls create mode 100644 test/sys/kernel/slab/bdev_cache/cache_dma create mode 100644 test/sys/kernel/slab/bdev_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/bdev_cache/ctor create mode 100644 test/sys/kernel/slab/bdev_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/bdev_cache/free_calls create mode 100644 test/sys/kernel/slab/bdev_cache/hwcache_align create mode 100644 test/sys/kernel/slab/bdev_cache/object_size create mode 100644 test/sys/kernel/slab/bdev_cache/objects create mode 100644 test/sys/kernel/slab/bdev_cache/objects_partial create mode 100644 test/sys/kernel/slab/bdev_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/bdev_cache/order create mode 100644 test/sys/kernel/slab/bdev_cache/partial create mode 100644 test/sys/kernel/slab/bdev_cache/poison create mode 100644 test/sys/kernel/slab/bdev_cache/reclaim_account create mode 100644 test/sys/kernel/slab/bdev_cache/red_zone create mode 100644 test/sys/kernel/slab/bdev_cache/sanity_checks create mode 100644 test/sys/kernel/slab/bdev_cache/shrink create mode 100644 test/sys/kernel/slab/bdev_cache/slab_size create mode 100644 test/sys/kernel/slab/bdev_cache/slabs create mode 100644 test/sys/kernel/slab/bdev_cache/store_user create mode 100644 test/sys/kernel/slab/bdev_cache/total_objects create mode 100644 test/sys/kernel/slab/bdev_cache/trace create mode 100644 test/sys/kernel/slab/bdev_cache/validate create mode 100644 test/sys/kernel/slab/bio/aliases create mode 100644 test/sys/kernel/slab/bio/align create mode 100644 test/sys/kernel/slab/bio/alloc_calls create mode 100644 test/sys/kernel/slab/bio/cache_dma create mode 100644 test/sys/kernel/slab/bio/cpu_slabs create mode 100644 test/sys/kernel/slab/bio/ctor create mode 100644 test/sys/kernel/slab/bio/destroy_by_rcu create mode 100644 test/sys/kernel/slab/bio/free_calls create mode 100644 test/sys/kernel/slab/bio/hwcache_align create mode 100644 test/sys/kernel/slab/bio/object_size create mode 100644 test/sys/kernel/slab/bio/objects create mode 100644 test/sys/kernel/slab/bio/objects_partial create mode 100644 test/sys/kernel/slab/bio/objs_per_slab create mode 100644 test/sys/kernel/slab/bio/order create mode 100644 test/sys/kernel/slab/bio/partial create mode 100644 test/sys/kernel/slab/bio/poison create mode 100644 test/sys/kernel/slab/bio/reclaim_account create mode 100644 test/sys/kernel/slab/bio/red_zone create mode 100644 test/sys/kernel/slab/bio/sanity_checks create mode 100644 test/sys/kernel/slab/bio/shrink create mode 100644 test/sys/kernel/slab/bio/slab_size create mode 100644 test/sys/kernel/slab/bio/slabs create mode 100644 test/sys/kernel/slab/bio/store_user create mode 100644 test/sys/kernel/slab/bio/total_objects create mode 100644 test/sys/kernel/slab/bio/trace create mode 100644 test/sys/kernel/slab/bio/validate create mode 100644 test/sys/kernel/slab/biovec-1/aliases create mode 100644 test/sys/kernel/slab/biovec-1/align create mode 100644 test/sys/kernel/slab/biovec-1/alloc_calls create mode 100644 test/sys/kernel/slab/biovec-1/cache_dma create mode 100644 test/sys/kernel/slab/biovec-1/cpu_slabs create mode 100644 test/sys/kernel/slab/biovec-1/ctor create mode 100644 test/sys/kernel/slab/biovec-1/destroy_by_rcu create mode 100644 test/sys/kernel/slab/biovec-1/free_calls create mode 100644 test/sys/kernel/slab/biovec-1/hwcache_align create mode 100644 test/sys/kernel/slab/biovec-1/object_size create mode 100644 test/sys/kernel/slab/biovec-1/objects create mode 100644 test/sys/kernel/slab/biovec-1/objects_partial create mode 100644 test/sys/kernel/slab/biovec-1/objs_per_slab create mode 100644 test/sys/kernel/slab/biovec-1/order create mode 100644 test/sys/kernel/slab/biovec-1/partial create mode 100644 test/sys/kernel/slab/biovec-1/poison create mode 100644 test/sys/kernel/slab/biovec-1/reclaim_account create mode 100644 test/sys/kernel/slab/biovec-1/red_zone create mode 100644 test/sys/kernel/slab/biovec-1/sanity_checks create mode 100644 test/sys/kernel/slab/biovec-1/shrink create mode 100644 test/sys/kernel/slab/biovec-1/slab_size create mode 100644 test/sys/kernel/slab/biovec-1/slabs create mode 100644 test/sys/kernel/slab/biovec-1/store_user create mode 100644 test/sys/kernel/slab/biovec-1/total_objects create mode 100644 test/sys/kernel/slab/biovec-1/trace create mode 100644 test/sys/kernel/slab/biovec-1/validate create mode 100644 test/sys/kernel/slab/biovec-128/aliases create mode 100644 test/sys/kernel/slab/biovec-128/align create mode 100644 test/sys/kernel/slab/biovec-128/alloc_calls create mode 100644 test/sys/kernel/slab/biovec-128/cache_dma create mode 100644 test/sys/kernel/slab/biovec-128/cpu_slabs create mode 100644 test/sys/kernel/slab/biovec-128/ctor create mode 100644 test/sys/kernel/slab/biovec-128/destroy_by_rcu create mode 100644 test/sys/kernel/slab/biovec-128/free_calls create mode 100644 test/sys/kernel/slab/biovec-128/hwcache_align create mode 100644 test/sys/kernel/slab/biovec-128/object_size create mode 100644 test/sys/kernel/slab/biovec-128/objects create mode 100644 test/sys/kernel/slab/biovec-128/objects_partial create mode 100644 test/sys/kernel/slab/biovec-128/objs_per_slab create mode 100644 test/sys/kernel/slab/biovec-128/order create mode 100644 test/sys/kernel/slab/biovec-128/partial create mode 100644 test/sys/kernel/slab/biovec-128/poison create mode 100644 test/sys/kernel/slab/biovec-128/reclaim_account create mode 100644 test/sys/kernel/slab/biovec-128/red_zone create mode 100644 test/sys/kernel/slab/biovec-128/sanity_checks create mode 100644 test/sys/kernel/slab/biovec-128/shrink create mode 100644 test/sys/kernel/slab/biovec-128/slab_size create mode 100644 test/sys/kernel/slab/biovec-128/slabs create mode 100644 test/sys/kernel/slab/biovec-128/store_user create mode 100644 test/sys/kernel/slab/biovec-128/total_objects create mode 100644 test/sys/kernel/slab/biovec-128/trace create mode 100644 test/sys/kernel/slab/biovec-128/validate create mode 100644 test/sys/kernel/slab/biovec-16/aliases create mode 100644 test/sys/kernel/slab/biovec-16/align create mode 100644 test/sys/kernel/slab/biovec-16/alloc_calls create mode 100644 test/sys/kernel/slab/biovec-16/cache_dma create mode 100644 test/sys/kernel/slab/biovec-16/cpu_slabs create mode 100644 test/sys/kernel/slab/biovec-16/ctor create mode 100644 test/sys/kernel/slab/biovec-16/destroy_by_rcu create mode 100644 test/sys/kernel/slab/biovec-16/free_calls create mode 100644 test/sys/kernel/slab/biovec-16/hwcache_align create mode 100644 test/sys/kernel/slab/biovec-16/object_size create mode 100644 test/sys/kernel/slab/biovec-16/objects create mode 100644 test/sys/kernel/slab/biovec-16/objects_partial create mode 100644 test/sys/kernel/slab/biovec-16/objs_per_slab create mode 100644 test/sys/kernel/slab/biovec-16/order create mode 100644 test/sys/kernel/slab/biovec-16/partial create mode 100644 test/sys/kernel/slab/biovec-16/poison create mode 100644 test/sys/kernel/slab/biovec-16/reclaim_account create mode 100644 test/sys/kernel/slab/biovec-16/red_zone create mode 100644 test/sys/kernel/slab/biovec-16/sanity_checks create mode 100644 test/sys/kernel/slab/biovec-16/shrink create mode 100644 test/sys/kernel/slab/biovec-16/slab_size create mode 100644 test/sys/kernel/slab/biovec-16/slabs create mode 100644 test/sys/kernel/slab/biovec-16/store_user create mode 100644 test/sys/kernel/slab/biovec-16/total_objects create mode 100644 test/sys/kernel/slab/biovec-16/trace create mode 100644 test/sys/kernel/slab/biovec-16/validate create mode 100644 test/sys/kernel/slab/biovec-256/aliases create mode 100644 test/sys/kernel/slab/biovec-256/align create mode 100644 test/sys/kernel/slab/biovec-256/alloc_calls create mode 100644 test/sys/kernel/slab/biovec-256/cache_dma create mode 100644 test/sys/kernel/slab/biovec-256/cpu_slabs create mode 100644 test/sys/kernel/slab/biovec-256/ctor create mode 100644 test/sys/kernel/slab/biovec-256/destroy_by_rcu create mode 100644 test/sys/kernel/slab/biovec-256/free_calls create mode 100644 test/sys/kernel/slab/biovec-256/hwcache_align create mode 100644 test/sys/kernel/slab/biovec-256/object_size create mode 100644 test/sys/kernel/slab/biovec-256/objects create mode 100644 test/sys/kernel/slab/biovec-256/objects_partial create mode 100644 test/sys/kernel/slab/biovec-256/objs_per_slab create mode 100644 test/sys/kernel/slab/biovec-256/order create mode 100644 test/sys/kernel/slab/biovec-256/partial create mode 100644 test/sys/kernel/slab/biovec-256/poison create mode 100644 test/sys/kernel/slab/biovec-256/reclaim_account create mode 100644 test/sys/kernel/slab/biovec-256/red_zone create mode 100644 test/sys/kernel/slab/biovec-256/sanity_checks create mode 100644 test/sys/kernel/slab/biovec-256/shrink create mode 100644 test/sys/kernel/slab/biovec-256/slab_size create mode 100644 test/sys/kernel/slab/biovec-256/slabs create mode 100644 test/sys/kernel/slab/biovec-256/store_user create mode 100644 test/sys/kernel/slab/biovec-256/total_objects create mode 100644 test/sys/kernel/slab/biovec-256/trace create mode 100644 test/sys/kernel/slab/biovec-256/validate create mode 100644 test/sys/kernel/slab/biovec-4/aliases create mode 100644 test/sys/kernel/slab/biovec-4/align create mode 100644 test/sys/kernel/slab/biovec-4/alloc_calls create mode 100644 test/sys/kernel/slab/biovec-4/cache_dma create mode 100644 test/sys/kernel/slab/biovec-4/cpu_slabs create mode 100644 test/sys/kernel/slab/biovec-4/ctor create mode 100644 test/sys/kernel/slab/biovec-4/destroy_by_rcu create mode 100644 test/sys/kernel/slab/biovec-4/free_calls create mode 100644 test/sys/kernel/slab/biovec-4/hwcache_align create mode 100644 test/sys/kernel/slab/biovec-4/object_size create mode 100644 test/sys/kernel/slab/biovec-4/objects create mode 100644 test/sys/kernel/slab/biovec-4/objects_partial create mode 100644 test/sys/kernel/slab/biovec-4/objs_per_slab create mode 100644 test/sys/kernel/slab/biovec-4/order create mode 100644 test/sys/kernel/slab/biovec-4/partial create mode 100644 test/sys/kernel/slab/biovec-4/poison create mode 100644 test/sys/kernel/slab/biovec-4/reclaim_account create mode 100644 test/sys/kernel/slab/biovec-4/red_zone create mode 100644 test/sys/kernel/slab/biovec-4/sanity_checks create mode 100644 test/sys/kernel/slab/biovec-4/shrink create mode 100644 test/sys/kernel/slab/biovec-4/slab_size create mode 100644 test/sys/kernel/slab/biovec-4/slabs create mode 100644 test/sys/kernel/slab/biovec-4/store_user create mode 100644 test/sys/kernel/slab/biovec-4/total_objects create mode 100644 test/sys/kernel/slab/biovec-4/trace create mode 100644 test/sys/kernel/slab/biovec-4/validate create mode 100644 test/sys/kernel/slab/biovec-64/aliases create mode 100644 test/sys/kernel/slab/biovec-64/align create mode 100644 test/sys/kernel/slab/biovec-64/alloc_calls create mode 100644 test/sys/kernel/slab/biovec-64/cache_dma create mode 100644 test/sys/kernel/slab/biovec-64/cpu_slabs create mode 100644 test/sys/kernel/slab/biovec-64/ctor create mode 100644 test/sys/kernel/slab/biovec-64/destroy_by_rcu create mode 100644 test/sys/kernel/slab/biovec-64/free_calls create mode 100644 test/sys/kernel/slab/biovec-64/hwcache_align create mode 100644 test/sys/kernel/slab/biovec-64/object_size create mode 100644 test/sys/kernel/slab/biovec-64/objects create mode 100644 test/sys/kernel/slab/biovec-64/objects_partial create mode 100644 test/sys/kernel/slab/biovec-64/objs_per_slab create mode 100644 test/sys/kernel/slab/biovec-64/order create mode 100644 test/sys/kernel/slab/biovec-64/partial create mode 100644 test/sys/kernel/slab/biovec-64/poison create mode 100644 test/sys/kernel/slab/biovec-64/reclaim_account create mode 100644 test/sys/kernel/slab/biovec-64/red_zone create mode 100644 test/sys/kernel/slab/biovec-64/sanity_checks create mode 100644 test/sys/kernel/slab/biovec-64/shrink create mode 100644 test/sys/kernel/slab/biovec-64/slab_size create mode 100644 test/sys/kernel/slab/biovec-64/slabs create mode 100644 test/sys/kernel/slab/biovec-64/store_user create mode 100644 test/sys/kernel/slab/biovec-64/total_objects create mode 100644 test/sys/kernel/slab/biovec-64/trace create mode 100644 test/sys/kernel/slab/biovec-64/validate create mode 100644 test/sys/kernel/slab/blkdev_ioc/aliases create mode 100644 test/sys/kernel/slab/blkdev_ioc/align create mode 100644 test/sys/kernel/slab/blkdev_ioc/alloc_calls create mode 100644 test/sys/kernel/slab/blkdev_ioc/cache_dma create mode 100644 test/sys/kernel/slab/blkdev_ioc/cpu_slabs create mode 100644 test/sys/kernel/slab/blkdev_ioc/ctor create mode 100644 test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu create mode 100644 test/sys/kernel/slab/blkdev_ioc/free_calls create mode 100644 test/sys/kernel/slab/blkdev_ioc/hwcache_align create mode 100644 test/sys/kernel/slab/blkdev_ioc/object_size create mode 100644 test/sys/kernel/slab/blkdev_ioc/objects create mode 100644 test/sys/kernel/slab/blkdev_ioc/objects_partial create mode 100644 test/sys/kernel/slab/blkdev_ioc/objs_per_slab create mode 100644 test/sys/kernel/slab/blkdev_ioc/order create mode 100644 test/sys/kernel/slab/blkdev_ioc/partial create mode 100644 test/sys/kernel/slab/blkdev_ioc/poison create mode 100644 test/sys/kernel/slab/blkdev_ioc/reclaim_account create mode 100644 test/sys/kernel/slab/blkdev_ioc/red_zone create mode 100644 test/sys/kernel/slab/blkdev_ioc/sanity_checks create mode 100644 test/sys/kernel/slab/blkdev_ioc/shrink create mode 100644 test/sys/kernel/slab/blkdev_ioc/slab_size create mode 100644 test/sys/kernel/slab/blkdev_ioc/slabs create mode 100644 test/sys/kernel/slab/blkdev_ioc/store_user create mode 100644 test/sys/kernel/slab/blkdev_ioc/total_objects create mode 100644 test/sys/kernel/slab/blkdev_ioc/trace create mode 100644 test/sys/kernel/slab/blkdev_ioc/validate create mode 100644 test/sys/kernel/slab/blkdev_queue/aliases create mode 100644 test/sys/kernel/slab/blkdev_queue/align create mode 100644 test/sys/kernel/slab/blkdev_queue/alloc_calls create mode 100644 test/sys/kernel/slab/blkdev_queue/cache_dma create mode 100644 test/sys/kernel/slab/blkdev_queue/cpu_slabs create mode 100644 test/sys/kernel/slab/blkdev_queue/ctor create mode 100644 test/sys/kernel/slab/blkdev_queue/destroy_by_rcu create mode 100644 test/sys/kernel/slab/blkdev_queue/free_calls create mode 100644 test/sys/kernel/slab/blkdev_queue/hwcache_align create mode 100644 test/sys/kernel/slab/blkdev_queue/object_size create mode 100644 test/sys/kernel/slab/blkdev_queue/objects create mode 100644 test/sys/kernel/slab/blkdev_queue/objects_partial create mode 100644 test/sys/kernel/slab/blkdev_queue/objs_per_slab create mode 100644 test/sys/kernel/slab/blkdev_queue/order create mode 100644 test/sys/kernel/slab/blkdev_queue/partial create mode 100644 test/sys/kernel/slab/blkdev_queue/poison create mode 100644 test/sys/kernel/slab/blkdev_queue/reclaim_account create mode 100644 test/sys/kernel/slab/blkdev_queue/red_zone create mode 100644 test/sys/kernel/slab/blkdev_queue/sanity_checks create mode 100644 test/sys/kernel/slab/blkdev_queue/shrink create mode 100644 test/sys/kernel/slab/blkdev_queue/slab_size create mode 100644 test/sys/kernel/slab/blkdev_queue/slabs create mode 100644 test/sys/kernel/slab/blkdev_queue/store_user create mode 100644 test/sys/kernel/slab/blkdev_queue/total_objects create mode 100644 test/sys/kernel/slab/blkdev_queue/trace create mode 100644 test/sys/kernel/slab/blkdev_queue/validate create mode 100644 test/sys/kernel/slab/blkdev_requests/aliases create mode 100644 test/sys/kernel/slab/blkdev_requests/align create mode 100644 test/sys/kernel/slab/blkdev_requests/alloc_calls create mode 100644 test/sys/kernel/slab/blkdev_requests/cache_dma create mode 100644 test/sys/kernel/slab/blkdev_requests/cpu_slabs create mode 100644 test/sys/kernel/slab/blkdev_requests/ctor create mode 100644 test/sys/kernel/slab/blkdev_requests/destroy_by_rcu create mode 100644 test/sys/kernel/slab/blkdev_requests/free_calls create mode 100644 test/sys/kernel/slab/blkdev_requests/hwcache_align create mode 100644 test/sys/kernel/slab/blkdev_requests/object_size create mode 100644 test/sys/kernel/slab/blkdev_requests/objects create mode 100644 test/sys/kernel/slab/blkdev_requests/objects_partial create mode 100644 test/sys/kernel/slab/blkdev_requests/objs_per_slab create mode 100644 test/sys/kernel/slab/blkdev_requests/order create mode 100644 test/sys/kernel/slab/blkdev_requests/partial create mode 100644 test/sys/kernel/slab/blkdev_requests/poison create mode 100644 test/sys/kernel/slab/blkdev_requests/reclaim_account create mode 100644 test/sys/kernel/slab/blkdev_requests/red_zone create mode 100644 test/sys/kernel/slab/blkdev_requests/sanity_checks create mode 100644 test/sys/kernel/slab/blkdev_requests/shrink create mode 100644 test/sys/kernel/slab/blkdev_requests/slab_size create mode 100644 test/sys/kernel/slab/blkdev_requests/slabs create mode 100644 test/sys/kernel/slab/blkdev_requests/store_user create mode 100644 test/sys/kernel/slab/blkdev_requests/total_objects create mode 100644 test/sys/kernel/slab/blkdev_requests/trace create mode 100644 test/sys/kernel/slab/blkdev_requests/validate create mode 100644 test/sys/kernel/slab/bsg_cmd/aliases create mode 100644 test/sys/kernel/slab/bsg_cmd/align create mode 100644 test/sys/kernel/slab/bsg_cmd/alloc_calls create mode 100644 test/sys/kernel/slab/bsg_cmd/cache_dma create mode 100644 test/sys/kernel/slab/bsg_cmd/cpu_slabs create mode 100644 test/sys/kernel/slab/bsg_cmd/ctor create mode 100644 test/sys/kernel/slab/bsg_cmd/destroy_by_rcu create mode 100644 test/sys/kernel/slab/bsg_cmd/free_calls create mode 100644 test/sys/kernel/slab/bsg_cmd/hwcache_align create mode 100644 test/sys/kernel/slab/bsg_cmd/object_size create mode 100644 test/sys/kernel/slab/bsg_cmd/objects create mode 100644 test/sys/kernel/slab/bsg_cmd/objects_partial create mode 100644 test/sys/kernel/slab/bsg_cmd/objs_per_slab create mode 100644 test/sys/kernel/slab/bsg_cmd/order create mode 100644 test/sys/kernel/slab/bsg_cmd/partial create mode 100644 test/sys/kernel/slab/bsg_cmd/poison create mode 100644 test/sys/kernel/slab/bsg_cmd/reclaim_account create mode 100644 test/sys/kernel/slab/bsg_cmd/red_zone create mode 100644 test/sys/kernel/slab/bsg_cmd/sanity_checks create mode 100644 test/sys/kernel/slab/bsg_cmd/shrink create mode 100644 test/sys/kernel/slab/bsg_cmd/slab_size create mode 100644 test/sys/kernel/slab/bsg_cmd/slabs create mode 100644 test/sys/kernel/slab/bsg_cmd/store_user create mode 100644 test/sys/kernel/slab/bsg_cmd/total_objects create mode 100644 test/sys/kernel/slab/bsg_cmd/trace create mode 100644 test/sys/kernel/slab/bsg_cmd/validate create mode 100644 test/sys/kernel/slab/buffer_head/aliases create mode 100644 test/sys/kernel/slab/buffer_head/align create mode 100644 test/sys/kernel/slab/buffer_head/alloc_calls create mode 100644 test/sys/kernel/slab/buffer_head/cache_dma create mode 100644 test/sys/kernel/slab/buffer_head/cpu_slabs create mode 100644 test/sys/kernel/slab/buffer_head/ctor create mode 100644 test/sys/kernel/slab/buffer_head/destroy_by_rcu create mode 100644 test/sys/kernel/slab/buffer_head/free_calls create mode 100644 test/sys/kernel/slab/buffer_head/hwcache_align create mode 100644 test/sys/kernel/slab/buffer_head/object_size create mode 100644 test/sys/kernel/slab/buffer_head/objects create mode 100644 test/sys/kernel/slab/buffer_head/objects_partial create mode 100644 test/sys/kernel/slab/buffer_head/objs_per_slab create mode 100644 test/sys/kernel/slab/buffer_head/order create mode 100644 test/sys/kernel/slab/buffer_head/partial create mode 100644 test/sys/kernel/slab/buffer_head/poison create mode 100644 test/sys/kernel/slab/buffer_head/reclaim_account create mode 100644 test/sys/kernel/slab/buffer_head/red_zone create mode 100644 test/sys/kernel/slab/buffer_head/sanity_checks create mode 100644 test/sys/kernel/slab/buffer_head/shrink create mode 100644 test/sys/kernel/slab/buffer_head/slab_size create mode 100644 test/sys/kernel/slab/buffer_head/slabs create mode 100644 test/sys/kernel/slab/buffer_head/store_user create mode 100644 test/sys/kernel/slab/buffer_head/total_objects create mode 100644 test/sys/kernel/slab/buffer_head/trace create mode 100644 test/sys/kernel/slab/buffer_head/validate create mode 100644 test/sys/kernel/slab/cfq_io_context/aliases create mode 100644 test/sys/kernel/slab/cfq_io_context/align create mode 100644 test/sys/kernel/slab/cfq_io_context/alloc_calls create mode 100644 test/sys/kernel/slab/cfq_io_context/cache_dma create mode 100644 test/sys/kernel/slab/cfq_io_context/cpu_slabs create mode 100644 test/sys/kernel/slab/cfq_io_context/ctor create mode 100644 test/sys/kernel/slab/cfq_io_context/destroy_by_rcu create mode 100644 test/sys/kernel/slab/cfq_io_context/free_calls create mode 100644 test/sys/kernel/slab/cfq_io_context/hwcache_align create mode 100644 test/sys/kernel/slab/cfq_io_context/object_size create mode 100644 test/sys/kernel/slab/cfq_io_context/objects create mode 100644 test/sys/kernel/slab/cfq_io_context/objects_partial create mode 100644 test/sys/kernel/slab/cfq_io_context/objs_per_slab create mode 100644 test/sys/kernel/slab/cfq_io_context/order create mode 100644 test/sys/kernel/slab/cfq_io_context/partial create mode 100644 test/sys/kernel/slab/cfq_io_context/poison create mode 100644 test/sys/kernel/slab/cfq_io_context/reclaim_account create mode 100644 test/sys/kernel/slab/cfq_io_context/red_zone create mode 100644 test/sys/kernel/slab/cfq_io_context/sanity_checks create mode 100644 test/sys/kernel/slab/cfq_io_context/shrink create mode 100644 test/sys/kernel/slab/cfq_io_context/slab_size create mode 100644 test/sys/kernel/slab/cfq_io_context/slabs create mode 100644 test/sys/kernel/slab/cfq_io_context/store_user create mode 100644 test/sys/kernel/slab/cfq_io_context/total_objects create mode 100644 test/sys/kernel/slab/cfq_io_context/trace create mode 100644 test/sys/kernel/slab/cfq_io_context/validate create mode 100644 test/sys/kernel/slab/cfq_queue/aliases create mode 100644 test/sys/kernel/slab/cfq_queue/align create mode 100644 test/sys/kernel/slab/cfq_queue/alloc_calls create mode 100644 test/sys/kernel/slab/cfq_queue/cache_dma create mode 100644 test/sys/kernel/slab/cfq_queue/cpu_slabs create mode 100644 test/sys/kernel/slab/cfq_queue/ctor create mode 100644 test/sys/kernel/slab/cfq_queue/destroy_by_rcu create mode 100644 test/sys/kernel/slab/cfq_queue/free_calls create mode 100644 test/sys/kernel/slab/cfq_queue/hwcache_align create mode 100644 test/sys/kernel/slab/cfq_queue/object_size create mode 100644 test/sys/kernel/slab/cfq_queue/objects create mode 100644 test/sys/kernel/slab/cfq_queue/objects_partial create mode 100644 test/sys/kernel/slab/cfq_queue/objs_per_slab create mode 100644 test/sys/kernel/slab/cfq_queue/order create mode 100644 test/sys/kernel/slab/cfq_queue/partial create mode 100644 test/sys/kernel/slab/cfq_queue/poison create mode 100644 test/sys/kernel/slab/cfq_queue/reclaim_account create mode 100644 test/sys/kernel/slab/cfq_queue/red_zone create mode 100644 test/sys/kernel/slab/cfq_queue/sanity_checks create mode 100644 test/sys/kernel/slab/cfq_queue/shrink create mode 100644 test/sys/kernel/slab/cfq_queue/slab_size create mode 100644 test/sys/kernel/slab/cfq_queue/slabs create mode 100644 test/sys/kernel/slab/cfq_queue/store_user create mode 100644 test/sys/kernel/slab/cfq_queue/total_objects create mode 100644 test/sys/kernel/slab/cfq_queue/trace create mode 100644 test/sys/kernel/slab/cfq_queue/validate create mode 100644 test/sys/kernel/slab/dentry/aliases create mode 100644 test/sys/kernel/slab/dentry/align create mode 100644 test/sys/kernel/slab/dentry/alloc_calls create mode 100644 test/sys/kernel/slab/dentry/cache_dma create mode 100644 test/sys/kernel/slab/dentry/cpu_slabs create mode 100644 test/sys/kernel/slab/dentry/ctor create mode 100644 test/sys/kernel/slab/dentry/destroy_by_rcu create mode 100644 test/sys/kernel/slab/dentry/free_calls create mode 100644 test/sys/kernel/slab/dentry/hwcache_align create mode 100644 test/sys/kernel/slab/dentry/object_size create mode 100644 test/sys/kernel/slab/dentry/objects create mode 100644 test/sys/kernel/slab/dentry/objects_partial create mode 100644 test/sys/kernel/slab/dentry/objs_per_slab create mode 100644 test/sys/kernel/slab/dentry/order create mode 100644 test/sys/kernel/slab/dentry/partial create mode 100644 test/sys/kernel/slab/dentry/poison create mode 100644 test/sys/kernel/slab/dentry/reclaim_account create mode 100644 test/sys/kernel/slab/dentry/red_zone create mode 100644 test/sys/kernel/slab/dentry/sanity_checks create mode 100644 test/sys/kernel/slab/dentry/shrink create mode 100644 test/sys/kernel/slab/dentry/slab_size create mode 100644 test/sys/kernel/slab/dentry/slabs create mode 100644 test/sys/kernel/slab/dentry/store_user create mode 100644 test/sys/kernel/slab/dentry/total_objects create mode 100644 test/sys/kernel/slab/dentry/trace create mode 100644 test/sys/kernel/slab/dentry/validate create mode 100644 test/sys/kernel/slab/dm_io/aliases create mode 100644 test/sys/kernel/slab/dm_io/align create mode 100644 test/sys/kernel/slab/dm_io/alloc_calls create mode 100644 test/sys/kernel/slab/dm_io/cache_dma create mode 100644 test/sys/kernel/slab/dm_io/cpu_slabs create mode 100644 test/sys/kernel/slab/dm_io/ctor create mode 100644 test/sys/kernel/slab/dm_io/destroy_by_rcu create mode 100644 test/sys/kernel/slab/dm_io/free_calls create mode 100644 test/sys/kernel/slab/dm_io/hwcache_align create mode 100644 test/sys/kernel/slab/dm_io/object_size create mode 100644 test/sys/kernel/slab/dm_io/objects create mode 100644 test/sys/kernel/slab/dm_io/objects_partial create mode 100644 test/sys/kernel/slab/dm_io/objs_per_slab create mode 100644 test/sys/kernel/slab/dm_io/order create mode 100644 test/sys/kernel/slab/dm_io/partial create mode 100644 test/sys/kernel/slab/dm_io/poison create mode 100644 test/sys/kernel/slab/dm_io/reclaim_account create mode 100644 test/sys/kernel/slab/dm_io/red_zone create mode 100644 test/sys/kernel/slab/dm_io/sanity_checks create mode 100644 test/sys/kernel/slab/dm_io/shrink create mode 100644 test/sys/kernel/slab/dm_io/slab_size create mode 100644 test/sys/kernel/slab/dm_io/slabs create mode 100644 test/sys/kernel/slab/dm_io/store_user create mode 100644 test/sys/kernel/slab/dm_io/total_objects create mode 100644 test/sys/kernel/slab/dm_io/trace create mode 100644 test/sys/kernel/slab/dm_io/validate create mode 100644 test/sys/kernel/slab/dm_target_io/aliases create mode 100644 test/sys/kernel/slab/dm_target_io/align create mode 100644 test/sys/kernel/slab/dm_target_io/alloc_calls create mode 100644 test/sys/kernel/slab/dm_target_io/cache_dma create mode 100644 test/sys/kernel/slab/dm_target_io/cpu_slabs create mode 100644 test/sys/kernel/slab/dm_target_io/ctor create mode 100644 test/sys/kernel/slab/dm_target_io/destroy_by_rcu create mode 100644 test/sys/kernel/slab/dm_target_io/free_calls create mode 100644 test/sys/kernel/slab/dm_target_io/hwcache_align create mode 100644 test/sys/kernel/slab/dm_target_io/object_size create mode 100644 test/sys/kernel/slab/dm_target_io/objects create mode 100644 test/sys/kernel/slab/dm_target_io/objects_partial create mode 100644 test/sys/kernel/slab/dm_target_io/objs_per_slab create mode 100644 test/sys/kernel/slab/dm_target_io/order create mode 100644 test/sys/kernel/slab/dm_target_io/partial create mode 100644 test/sys/kernel/slab/dm_target_io/poison create mode 100644 test/sys/kernel/slab/dm_target_io/reclaim_account create mode 100644 test/sys/kernel/slab/dm_target_io/red_zone create mode 100644 test/sys/kernel/slab/dm_target_io/sanity_checks create mode 100644 test/sys/kernel/slab/dm_target_io/shrink create mode 100644 test/sys/kernel/slab/dm_target_io/slab_size create mode 100644 test/sys/kernel/slab/dm_target_io/slabs create mode 100644 test/sys/kernel/slab/dm_target_io/store_user create mode 100644 test/sys/kernel/slab/dm_target_io/total_objects create mode 100644 test/sys/kernel/slab/dm_target_io/trace create mode 100644 test/sys/kernel/slab/dm_target_io/validate create mode 100644 test/sys/kernel/slab/dnotify_cache/aliases create mode 100644 test/sys/kernel/slab/dnotify_cache/align create mode 100644 test/sys/kernel/slab/dnotify_cache/alloc_calls create mode 100644 test/sys/kernel/slab/dnotify_cache/cache_dma create mode 100644 test/sys/kernel/slab/dnotify_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/dnotify_cache/ctor create mode 100644 test/sys/kernel/slab/dnotify_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/dnotify_cache/free_calls create mode 100644 test/sys/kernel/slab/dnotify_cache/hwcache_align create mode 100644 test/sys/kernel/slab/dnotify_cache/object_size create mode 100644 test/sys/kernel/slab/dnotify_cache/objects create mode 100644 test/sys/kernel/slab/dnotify_cache/objects_partial create mode 100644 test/sys/kernel/slab/dnotify_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/dnotify_cache/order create mode 100644 test/sys/kernel/slab/dnotify_cache/partial create mode 100644 test/sys/kernel/slab/dnotify_cache/poison create mode 100644 test/sys/kernel/slab/dnotify_cache/reclaim_account create mode 100644 test/sys/kernel/slab/dnotify_cache/red_zone create mode 100644 test/sys/kernel/slab/dnotify_cache/sanity_checks create mode 100644 test/sys/kernel/slab/dnotify_cache/shrink create mode 100644 test/sys/kernel/slab/dnotify_cache/slab_size create mode 100644 test/sys/kernel/slab/dnotify_cache/slabs create mode 100644 test/sys/kernel/slab/dnotify_cache/store_user create mode 100644 test/sys/kernel/slab/dnotify_cache/total_objects create mode 100644 test/sys/kernel/slab/dnotify_cache/trace create mode 100644 test/sys/kernel/slab/dnotify_cache/validate create mode 100644 test/sys/kernel/slab/eventpoll_epi/aliases create mode 100644 test/sys/kernel/slab/eventpoll_epi/align create mode 100644 test/sys/kernel/slab/eventpoll_epi/alloc_calls create mode 100644 test/sys/kernel/slab/eventpoll_epi/cache_dma create mode 100644 test/sys/kernel/slab/eventpoll_epi/cpu_slabs create mode 100644 test/sys/kernel/slab/eventpoll_epi/ctor create mode 100644 test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu create mode 100644 test/sys/kernel/slab/eventpoll_epi/free_calls create mode 100644 test/sys/kernel/slab/eventpoll_epi/hwcache_align create mode 100644 test/sys/kernel/slab/eventpoll_epi/object_size create mode 100644 test/sys/kernel/slab/eventpoll_epi/objects create mode 100644 test/sys/kernel/slab/eventpoll_epi/objects_partial create mode 100644 test/sys/kernel/slab/eventpoll_epi/objs_per_slab create mode 100644 test/sys/kernel/slab/eventpoll_epi/order create mode 100644 test/sys/kernel/slab/eventpoll_epi/partial create mode 100644 test/sys/kernel/slab/eventpoll_epi/poison create mode 100644 test/sys/kernel/slab/eventpoll_epi/reclaim_account create mode 100644 test/sys/kernel/slab/eventpoll_epi/red_zone create mode 100644 test/sys/kernel/slab/eventpoll_epi/sanity_checks create mode 100644 test/sys/kernel/slab/eventpoll_epi/shrink create mode 100644 test/sys/kernel/slab/eventpoll_epi/slab_size create mode 100644 test/sys/kernel/slab/eventpoll_epi/slabs create mode 100644 test/sys/kernel/slab/eventpoll_epi/store_user create mode 100644 test/sys/kernel/slab/eventpoll_epi/total_objects create mode 100644 test/sys/kernel/slab/eventpoll_epi/trace create mode 100644 test/sys/kernel/slab/eventpoll_epi/validate create mode 100644 test/sys/kernel/slab/eventpoll_pwq/aliases create mode 100644 test/sys/kernel/slab/eventpoll_pwq/align create mode 100644 test/sys/kernel/slab/eventpoll_pwq/alloc_calls create mode 100644 test/sys/kernel/slab/eventpoll_pwq/cache_dma create mode 100644 test/sys/kernel/slab/eventpoll_pwq/cpu_slabs create mode 100644 test/sys/kernel/slab/eventpoll_pwq/ctor create mode 100644 test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu create mode 100644 test/sys/kernel/slab/eventpoll_pwq/free_calls create mode 100644 test/sys/kernel/slab/eventpoll_pwq/hwcache_align create mode 100644 test/sys/kernel/slab/eventpoll_pwq/object_size create mode 100644 test/sys/kernel/slab/eventpoll_pwq/objects create mode 100644 test/sys/kernel/slab/eventpoll_pwq/objects_partial create mode 100644 test/sys/kernel/slab/eventpoll_pwq/objs_per_slab create mode 100644 test/sys/kernel/slab/eventpoll_pwq/order create mode 100644 test/sys/kernel/slab/eventpoll_pwq/partial create mode 100644 test/sys/kernel/slab/eventpoll_pwq/poison create mode 100644 test/sys/kernel/slab/eventpoll_pwq/reclaim_account create mode 100644 test/sys/kernel/slab/eventpoll_pwq/red_zone create mode 100644 test/sys/kernel/slab/eventpoll_pwq/sanity_checks create mode 100644 test/sys/kernel/slab/eventpoll_pwq/shrink create mode 100644 test/sys/kernel/slab/eventpoll_pwq/slab_size create mode 100644 test/sys/kernel/slab/eventpoll_pwq/slabs create mode 100644 test/sys/kernel/slab/eventpoll_pwq/store_user create mode 100644 test/sys/kernel/slab/eventpoll_pwq/total_objects create mode 100644 test/sys/kernel/slab/eventpoll_pwq/trace create mode 100644 test/sys/kernel/slab/eventpoll_pwq/validate create mode 100644 test/sys/kernel/slab/ext2_inode_cache/aliases create mode 100644 test/sys/kernel/slab/ext2_inode_cache/align create mode 100644 test/sys/kernel/slab/ext2_inode_cache/alloc_calls create mode 100644 test/sys/kernel/slab/ext2_inode_cache/cache_dma create mode 100644 test/sys/kernel/slab/ext2_inode_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/ext2_inode_cache/ctor create mode 100644 test/sys/kernel/slab/ext2_inode_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/ext2_inode_cache/free_calls create mode 100644 test/sys/kernel/slab/ext2_inode_cache/hwcache_align create mode 100644 test/sys/kernel/slab/ext2_inode_cache/object_size create mode 100644 test/sys/kernel/slab/ext2_inode_cache/objects create mode 100644 test/sys/kernel/slab/ext2_inode_cache/objects_partial create mode 100644 test/sys/kernel/slab/ext2_inode_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/ext2_inode_cache/order create mode 100644 test/sys/kernel/slab/ext2_inode_cache/partial create mode 100644 test/sys/kernel/slab/ext2_inode_cache/poison create mode 100644 test/sys/kernel/slab/ext2_inode_cache/reclaim_account create mode 100644 test/sys/kernel/slab/ext2_inode_cache/red_zone create mode 100644 test/sys/kernel/slab/ext2_inode_cache/sanity_checks create mode 100644 test/sys/kernel/slab/ext2_inode_cache/shrink create mode 100644 test/sys/kernel/slab/ext2_inode_cache/slab_size create mode 100644 test/sys/kernel/slab/ext2_inode_cache/slabs create mode 100644 test/sys/kernel/slab/ext2_inode_cache/store_user create mode 100644 test/sys/kernel/slab/ext2_inode_cache/total_objects create mode 100644 test/sys/kernel/slab/ext2_inode_cache/trace create mode 100644 test/sys/kernel/slab/ext2_inode_cache/validate create mode 100644 test/sys/kernel/slab/ext3_inode_cache/aliases create mode 100644 test/sys/kernel/slab/ext3_inode_cache/align create mode 100644 test/sys/kernel/slab/ext3_inode_cache/alloc_calls create mode 100644 test/sys/kernel/slab/ext3_inode_cache/cache_dma create mode 100644 test/sys/kernel/slab/ext3_inode_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/ext3_inode_cache/ctor create mode 100644 test/sys/kernel/slab/ext3_inode_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/ext3_inode_cache/free_calls create mode 100644 test/sys/kernel/slab/ext3_inode_cache/hwcache_align create mode 100644 test/sys/kernel/slab/ext3_inode_cache/object_size create mode 100644 test/sys/kernel/slab/ext3_inode_cache/objects create mode 100644 test/sys/kernel/slab/ext3_inode_cache/objects_partial create mode 100644 test/sys/kernel/slab/ext3_inode_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/ext3_inode_cache/order create mode 100644 test/sys/kernel/slab/ext3_inode_cache/partial create mode 100644 test/sys/kernel/slab/ext3_inode_cache/poison create mode 100644 test/sys/kernel/slab/ext3_inode_cache/reclaim_account create mode 100644 test/sys/kernel/slab/ext3_inode_cache/red_zone create mode 100644 test/sys/kernel/slab/ext3_inode_cache/sanity_checks create mode 100644 test/sys/kernel/slab/ext3_inode_cache/shrink create mode 100644 test/sys/kernel/slab/ext3_inode_cache/slab_size create mode 100644 test/sys/kernel/slab/ext3_inode_cache/slabs create mode 100644 test/sys/kernel/slab/ext3_inode_cache/store_user create mode 100644 test/sys/kernel/slab/ext3_inode_cache/total_objects create mode 100644 test/sys/kernel/slab/ext3_inode_cache/trace create mode 100644 test/sys/kernel/slab/ext3_inode_cache/validate create mode 100644 test/sys/kernel/slab/ext3_xattr/aliases create mode 100644 test/sys/kernel/slab/ext3_xattr/align create mode 100644 test/sys/kernel/slab/ext3_xattr/alloc_calls create mode 100644 test/sys/kernel/slab/ext3_xattr/cache_dma create mode 100644 test/sys/kernel/slab/ext3_xattr/cpu_slabs create mode 100644 test/sys/kernel/slab/ext3_xattr/ctor create mode 100644 test/sys/kernel/slab/ext3_xattr/destroy_by_rcu create mode 100644 test/sys/kernel/slab/ext3_xattr/free_calls create mode 100644 test/sys/kernel/slab/ext3_xattr/hwcache_align create mode 100644 test/sys/kernel/slab/ext3_xattr/object_size create mode 100644 test/sys/kernel/slab/ext3_xattr/objects create mode 100644 test/sys/kernel/slab/ext3_xattr/objects_partial create mode 100644 test/sys/kernel/slab/ext3_xattr/objs_per_slab create mode 100644 test/sys/kernel/slab/ext3_xattr/order create mode 100644 test/sys/kernel/slab/ext3_xattr/partial create mode 100644 test/sys/kernel/slab/ext3_xattr/poison create mode 100644 test/sys/kernel/slab/ext3_xattr/reclaim_account create mode 100644 test/sys/kernel/slab/ext3_xattr/red_zone create mode 100644 test/sys/kernel/slab/ext3_xattr/sanity_checks create mode 100644 test/sys/kernel/slab/ext3_xattr/shrink create mode 100644 test/sys/kernel/slab/ext3_xattr/slab_size create mode 100644 test/sys/kernel/slab/ext3_xattr/slabs create mode 100644 test/sys/kernel/slab/ext3_xattr/store_user create mode 100644 test/sys/kernel/slab/ext3_xattr/total_objects create mode 100644 test/sys/kernel/slab/ext3_xattr/trace create mode 100644 test/sys/kernel/slab/ext3_xattr/validate create mode 100644 test/sys/kernel/slab/fasync_cache/aliases create mode 100644 test/sys/kernel/slab/fasync_cache/align create mode 100644 test/sys/kernel/slab/fasync_cache/alloc_calls create mode 100644 test/sys/kernel/slab/fasync_cache/cache_dma create mode 100644 test/sys/kernel/slab/fasync_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/fasync_cache/ctor create mode 100644 test/sys/kernel/slab/fasync_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/fasync_cache/free_calls create mode 100644 test/sys/kernel/slab/fasync_cache/hwcache_align create mode 100644 test/sys/kernel/slab/fasync_cache/object_size create mode 100644 test/sys/kernel/slab/fasync_cache/objects create mode 100644 test/sys/kernel/slab/fasync_cache/objects_partial create mode 100644 test/sys/kernel/slab/fasync_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/fasync_cache/order create mode 100644 test/sys/kernel/slab/fasync_cache/partial create mode 100644 test/sys/kernel/slab/fasync_cache/poison create mode 100644 test/sys/kernel/slab/fasync_cache/reclaim_account create mode 100644 test/sys/kernel/slab/fasync_cache/red_zone create mode 100644 test/sys/kernel/slab/fasync_cache/sanity_checks create mode 100644 test/sys/kernel/slab/fasync_cache/shrink create mode 100644 test/sys/kernel/slab/fasync_cache/slab_size create mode 100644 test/sys/kernel/slab/fasync_cache/slabs create mode 100644 test/sys/kernel/slab/fasync_cache/store_user create mode 100644 test/sys/kernel/slab/fasync_cache/total_objects create mode 100644 test/sys/kernel/slab/fasync_cache/trace create mode 100644 test/sys/kernel/slab/fasync_cache/validate create mode 100644 test/sys/kernel/slab/fat_cache/aliases create mode 100644 test/sys/kernel/slab/fat_cache/align create mode 100644 test/sys/kernel/slab/fat_cache/alloc_calls create mode 100644 test/sys/kernel/slab/fat_cache/cache_dma create mode 100644 test/sys/kernel/slab/fat_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/fat_cache/ctor create mode 100644 test/sys/kernel/slab/fat_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/fat_cache/free_calls create mode 100644 test/sys/kernel/slab/fat_cache/hwcache_align create mode 100644 test/sys/kernel/slab/fat_cache/object_size create mode 100644 test/sys/kernel/slab/fat_cache/objects create mode 100644 test/sys/kernel/slab/fat_cache/objects_partial create mode 100644 test/sys/kernel/slab/fat_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/fat_cache/order create mode 100644 test/sys/kernel/slab/fat_cache/partial create mode 100644 test/sys/kernel/slab/fat_cache/poison create mode 100644 test/sys/kernel/slab/fat_cache/reclaim_account create mode 100644 test/sys/kernel/slab/fat_cache/red_zone create mode 100644 test/sys/kernel/slab/fat_cache/sanity_checks create mode 100644 test/sys/kernel/slab/fat_cache/shrink create mode 100644 test/sys/kernel/slab/fat_cache/slab_size create mode 100644 test/sys/kernel/slab/fat_cache/slabs create mode 100644 test/sys/kernel/slab/fat_cache/store_user create mode 100644 test/sys/kernel/slab/fat_cache/total_objects create mode 100644 test/sys/kernel/slab/fat_cache/trace create mode 100644 test/sys/kernel/slab/fat_cache/validate create mode 100644 test/sys/kernel/slab/fat_inode_cache/aliases create mode 100644 test/sys/kernel/slab/fat_inode_cache/align create mode 100644 test/sys/kernel/slab/fat_inode_cache/alloc_calls create mode 100644 test/sys/kernel/slab/fat_inode_cache/cache_dma create mode 100644 test/sys/kernel/slab/fat_inode_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/fat_inode_cache/ctor create mode 100644 test/sys/kernel/slab/fat_inode_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/fat_inode_cache/free_calls create mode 100644 test/sys/kernel/slab/fat_inode_cache/hwcache_align create mode 100644 test/sys/kernel/slab/fat_inode_cache/object_size create mode 100644 test/sys/kernel/slab/fat_inode_cache/objects create mode 100644 test/sys/kernel/slab/fat_inode_cache/objects_partial create mode 100644 test/sys/kernel/slab/fat_inode_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/fat_inode_cache/order create mode 100644 test/sys/kernel/slab/fat_inode_cache/partial create mode 100644 test/sys/kernel/slab/fat_inode_cache/poison create mode 100644 test/sys/kernel/slab/fat_inode_cache/reclaim_account create mode 100644 test/sys/kernel/slab/fat_inode_cache/red_zone create mode 100644 test/sys/kernel/slab/fat_inode_cache/sanity_checks create mode 100644 test/sys/kernel/slab/fat_inode_cache/shrink create mode 100644 test/sys/kernel/slab/fat_inode_cache/slab_size create mode 100644 test/sys/kernel/slab/fat_inode_cache/slabs create mode 100644 test/sys/kernel/slab/fat_inode_cache/store_user create mode 100644 test/sys/kernel/slab/fat_inode_cache/total_objects create mode 100644 test/sys/kernel/slab/fat_inode_cache/trace create mode 100644 test/sys/kernel/slab/fat_inode_cache/validate create mode 100644 test/sys/kernel/slab/fib6_nodes/aliases create mode 100644 test/sys/kernel/slab/fib6_nodes/align create mode 100644 test/sys/kernel/slab/fib6_nodes/alloc_calls create mode 100644 test/sys/kernel/slab/fib6_nodes/cache_dma create mode 100644 test/sys/kernel/slab/fib6_nodes/cpu_slabs create mode 100644 test/sys/kernel/slab/fib6_nodes/ctor create mode 100644 test/sys/kernel/slab/fib6_nodes/destroy_by_rcu create mode 100644 test/sys/kernel/slab/fib6_nodes/free_calls create mode 100644 test/sys/kernel/slab/fib6_nodes/hwcache_align create mode 100644 test/sys/kernel/slab/fib6_nodes/object_size create mode 100644 test/sys/kernel/slab/fib6_nodes/objects create mode 100644 test/sys/kernel/slab/fib6_nodes/objects_partial create mode 100644 test/sys/kernel/slab/fib6_nodes/objs_per_slab create mode 100644 test/sys/kernel/slab/fib6_nodes/order create mode 100644 test/sys/kernel/slab/fib6_nodes/partial create mode 100644 test/sys/kernel/slab/fib6_nodes/poison create mode 100644 test/sys/kernel/slab/fib6_nodes/reclaim_account create mode 100644 test/sys/kernel/slab/fib6_nodes/red_zone create mode 100644 test/sys/kernel/slab/fib6_nodes/sanity_checks create mode 100644 test/sys/kernel/slab/fib6_nodes/shrink create mode 100644 test/sys/kernel/slab/fib6_nodes/slab_size create mode 100644 test/sys/kernel/slab/fib6_nodes/slabs create mode 100644 test/sys/kernel/slab/fib6_nodes/store_user create mode 100644 test/sys/kernel/slab/fib6_nodes/total_objects create mode 100644 test/sys/kernel/slab/fib6_nodes/trace create mode 100644 test/sys/kernel/slab/fib6_nodes/validate create mode 100644 test/sys/kernel/slab/file_lock_cache/aliases create mode 100644 test/sys/kernel/slab/file_lock_cache/align create mode 100644 test/sys/kernel/slab/file_lock_cache/alloc_calls create mode 100644 test/sys/kernel/slab/file_lock_cache/cache_dma create mode 100644 test/sys/kernel/slab/file_lock_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/file_lock_cache/ctor create mode 100644 test/sys/kernel/slab/file_lock_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/file_lock_cache/free_calls create mode 100644 test/sys/kernel/slab/file_lock_cache/hwcache_align create mode 100644 test/sys/kernel/slab/file_lock_cache/object_size create mode 100644 test/sys/kernel/slab/file_lock_cache/objects create mode 100644 test/sys/kernel/slab/file_lock_cache/objects_partial create mode 100644 test/sys/kernel/slab/file_lock_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/file_lock_cache/order create mode 100644 test/sys/kernel/slab/file_lock_cache/partial create mode 100644 test/sys/kernel/slab/file_lock_cache/poison create mode 100644 test/sys/kernel/slab/file_lock_cache/reclaim_account create mode 100644 test/sys/kernel/slab/file_lock_cache/red_zone create mode 100644 test/sys/kernel/slab/file_lock_cache/sanity_checks create mode 100644 test/sys/kernel/slab/file_lock_cache/shrink create mode 100644 test/sys/kernel/slab/file_lock_cache/slab_size create mode 100644 test/sys/kernel/slab/file_lock_cache/slabs create mode 100644 test/sys/kernel/slab/file_lock_cache/store_user create mode 100644 test/sys/kernel/slab/file_lock_cache/total_objects create mode 100644 test/sys/kernel/slab/file_lock_cache/trace create mode 100644 test/sys/kernel/slab/file_lock_cache/validate create mode 100644 test/sys/kernel/slab/files_cache/aliases create mode 100644 test/sys/kernel/slab/files_cache/align create mode 100644 test/sys/kernel/slab/files_cache/alloc_calls create mode 100644 test/sys/kernel/slab/files_cache/cache_dma create mode 100644 test/sys/kernel/slab/files_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/files_cache/ctor create mode 100644 test/sys/kernel/slab/files_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/files_cache/free_calls create mode 100644 test/sys/kernel/slab/files_cache/hwcache_align create mode 100644 test/sys/kernel/slab/files_cache/object_size create mode 100644 test/sys/kernel/slab/files_cache/objects create mode 100644 test/sys/kernel/slab/files_cache/objects_partial create mode 100644 test/sys/kernel/slab/files_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/files_cache/order create mode 100644 test/sys/kernel/slab/files_cache/partial create mode 100644 test/sys/kernel/slab/files_cache/poison create mode 100644 test/sys/kernel/slab/files_cache/reclaim_account create mode 100644 test/sys/kernel/slab/files_cache/red_zone create mode 100644 test/sys/kernel/slab/files_cache/sanity_checks create mode 100644 test/sys/kernel/slab/files_cache/shrink create mode 100644 test/sys/kernel/slab/files_cache/slab_size create mode 100644 test/sys/kernel/slab/files_cache/slabs create mode 100644 test/sys/kernel/slab/files_cache/store_user create mode 100644 test/sys/kernel/slab/files_cache/total_objects create mode 100644 test/sys/kernel/slab/files_cache/trace create mode 100644 test/sys/kernel/slab/files_cache/validate create mode 100644 test/sys/kernel/slab/filp/aliases create mode 100644 test/sys/kernel/slab/filp/align create mode 100644 test/sys/kernel/slab/filp/alloc_calls create mode 100644 test/sys/kernel/slab/filp/cache_dma create mode 100644 test/sys/kernel/slab/filp/cpu_slabs create mode 100644 test/sys/kernel/slab/filp/ctor create mode 100644 test/sys/kernel/slab/filp/destroy_by_rcu create mode 100644 test/sys/kernel/slab/filp/free_calls create mode 100644 test/sys/kernel/slab/filp/hwcache_align create mode 100644 test/sys/kernel/slab/filp/object_size create mode 100644 test/sys/kernel/slab/filp/objects create mode 100644 test/sys/kernel/slab/filp/objects_partial create mode 100644 test/sys/kernel/slab/filp/objs_per_slab create mode 100644 test/sys/kernel/slab/filp/order create mode 100644 test/sys/kernel/slab/filp/partial create mode 100644 test/sys/kernel/slab/filp/poison create mode 100644 test/sys/kernel/slab/filp/reclaim_account create mode 100644 test/sys/kernel/slab/filp/red_zone create mode 100644 test/sys/kernel/slab/filp/sanity_checks create mode 100644 test/sys/kernel/slab/filp/shrink create mode 100644 test/sys/kernel/slab/filp/slab_size create mode 100644 test/sys/kernel/slab/filp/slabs create mode 100644 test/sys/kernel/slab/filp/store_user create mode 100644 test/sys/kernel/slab/filp/total_objects create mode 100644 test/sys/kernel/slab/filp/trace create mode 100644 test/sys/kernel/slab/filp/validate create mode 100644 test/sys/kernel/slab/flow_cache/aliases create mode 100644 test/sys/kernel/slab/flow_cache/align create mode 100644 test/sys/kernel/slab/flow_cache/alloc_calls create mode 100644 test/sys/kernel/slab/flow_cache/cache_dma create mode 100644 test/sys/kernel/slab/flow_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/flow_cache/ctor create mode 100644 test/sys/kernel/slab/flow_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/flow_cache/free_calls create mode 100644 test/sys/kernel/slab/flow_cache/hwcache_align create mode 100644 test/sys/kernel/slab/flow_cache/object_size create mode 100644 test/sys/kernel/slab/flow_cache/objects create mode 100644 test/sys/kernel/slab/flow_cache/objects_partial create mode 100644 test/sys/kernel/slab/flow_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/flow_cache/order create mode 100644 test/sys/kernel/slab/flow_cache/partial create mode 100644 test/sys/kernel/slab/flow_cache/poison create mode 100644 test/sys/kernel/slab/flow_cache/reclaim_account create mode 100644 test/sys/kernel/slab/flow_cache/red_zone create mode 100644 test/sys/kernel/slab/flow_cache/sanity_checks create mode 100644 test/sys/kernel/slab/flow_cache/shrink create mode 100644 test/sys/kernel/slab/flow_cache/slab_size create mode 100644 test/sys/kernel/slab/flow_cache/slabs create mode 100644 test/sys/kernel/slab/flow_cache/store_user create mode 100644 test/sys/kernel/slab/flow_cache/total_objects create mode 100644 test/sys/kernel/slab/flow_cache/trace create mode 100644 test/sys/kernel/slab/flow_cache/validate create mode 100644 test/sys/kernel/slab/fs_cache/aliases create mode 100644 test/sys/kernel/slab/fs_cache/align create mode 100644 test/sys/kernel/slab/fs_cache/alloc_calls create mode 100644 test/sys/kernel/slab/fs_cache/cache_dma create mode 100644 test/sys/kernel/slab/fs_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/fs_cache/ctor create mode 100644 test/sys/kernel/slab/fs_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/fs_cache/free_calls create mode 100644 test/sys/kernel/slab/fs_cache/hwcache_align create mode 100644 test/sys/kernel/slab/fs_cache/object_size create mode 100644 test/sys/kernel/slab/fs_cache/objects create mode 100644 test/sys/kernel/slab/fs_cache/objects_partial create mode 100644 test/sys/kernel/slab/fs_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/fs_cache/order create mode 100644 test/sys/kernel/slab/fs_cache/partial create mode 100644 test/sys/kernel/slab/fs_cache/poison create mode 100644 test/sys/kernel/slab/fs_cache/reclaim_account create mode 100644 test/sys/kernel/slab/fs_cache/red_zone create mode 100644 test/sys/kernel/slab/fs_cache/sanity_checks create mode 100644 test/sys/kernel/slab/fs_cache/shrink create mode 100644 test/sys/kernel/slab/fs_cache/slab_size create mode 100644 test/sys/kernel/slab/fs_cache/slabs create mode 100644 test/sys/kernel/slab/fs_cache/store_user create mode 100644 test/sys/kernel/slab/fs_cache/total_objects create mode 100644 test/sys/kernel/slab/fs_cache/trace create mode 100644 test/sys/kernel/slab/fs_cache/validate create mode 100644 test/sys/kernel/slab/fuse_inode/aliases create mode 100644 test/sys/kernel/slab/fuse_inode/align create mode 100644 test/sys/kernel/slab/fuse_inode/alloc_calls create mode 100644 test/sys/kernel/slab/fuse_inode/cache_dma create mode 100644 test/sys/kernel/slab/fuse_inode/cpu_slabs create mode 100644 test/sys/kernel/slab/fuse_inode/ctor create mode 100644 test/sys/kernel/slab/fuse_inode/destroy_by_rcu create mode 100644 test/sys/kernel/slab/fuse_inode/free_calls create mode 100644 test/sys/kernel/slab/fuse_inode/hwcache_align create mode 100644 test/sys/kernel/slab/fuse_inode/object_size create mode 100644 test/sys/kernel/slab/fuse_inode/objects create mode 100644 test/sys/kernel/slab/fuse_inode/objects_partial create mode 100644 test/sys/kernel/slab/fuse_inode/objs_per_slab create mode 100644 test/sys/kernel/slab/fuse_inode/order create mode 100644 test/sys/kernel/slab/fuse_inode/partial create mode 100644 test/sys/kernel/slab/fuse_inode/poison create mode 100644 test/sys/kernel/slab/fuse_inode/reclaim_account create mode 100644 test/sys/kernel/slab/fuse_inode/red_zone create mode 100644 test/sys/kernel/slab/fuse_inode/sanity_checks create mode 100644 test/sys/kernel/slab/fuse_inode/shrink create mode 100644 test/sys/kernel/slab/fuse_inode/slab_size create mode 100644 test/sys/kernel/slab/fuse_inode/slabs create mode 100644 test/sys/kernel/slab/fuse_inode/store_user create mode 100644 test/sys/kernel/slab/fuse_inode/total_objects create mode 100644 test/sys/kernel/slab/fuse_inode/trace create mode 100644 test/sys/kernel/slab/fuse_inode/validate create mode 100644 test/sys/kernel/slab/fuse_request/aliases create mode 100644 test/sys/kernel/slab/fuse_request/align create mode 100644 test/sys/kernel/slab/fuse_request/alloc_calls create mode 100644 test/sys/kernel/slab/fuse_request/cache_dma create mode 100644 test/sys/kernel/slab/fuse_request/cpu_slabs create mode 100644 test/sys/kernel/slab/fuse_request/ctor create mode 100644 test/sys/kernel/slab/fuse_request/destroy_by_rcu create mode 100644 test/sys/kernel/slab/fuse_request/free_calls create mode 100644 test/sys/kernel/slab/fuse_request/hwcache_align create mode 100644 test/sys/kernel/slab/fuse_request/object_size create mode 100644 test/sys/kernel/slab/fuse_request/objects create mode 100644 test/sys/kernel/slab/fuse_request/objects_partial create mode 100644 test/sys/kernel/slab/fuse_request/objs_per_slab create mode 100644 test/sys/kernel/slab/fuse_request/order create mode 100644 test/sys/kernel/slab/fuse_request/partial create mode 100644 test/sys/kernel/slab/fuse_request/poison create mode 100644 test/sys/kernel/slab/fuse_request/reclaim_account create mode 100644 test/sys/kernel/slab/fuse_request/red_zone create mode 100644 test/sys/kernel/slab/fuse_request/sanity_checks create mode 100644 test/sys/kernel/slab/fuse_request/shrink create mode 100644 test/sys/kernel/slab/fuse_request/slab_size create mode 100644 test/sys/kernel/slab/fuse_request/slabs create mode 100644 test/sys/kernel/slab/fuse_request/store_user create mode 100644 test/sys/kernel/slab/fuse_request/total_objects create mode 100644 test/sys/kernel/slab/fuse_request/trace create mode 100644 test/sys/kernel/slab/fuse_request/validate create mode 100644 test/sys/kernel/slab/idr_layer_cache/aliases create mode 100644 test/sys/kernel/slab/idr_layer_cache/align create mode 100644 test/sys/kernel/slab/idr_layer_cache/alloc_calls create mode 100644 test/sys/kernel/slab/idr_layer_cache/cache_dma create mode 100644 test/sys/kernel/slab/idr_layer_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/idr_layer_cache/ctor create mode 100644 test/sys/kernel/slab/idr_layer_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/idr_layer_cache/free_calls create mode 100644 test/sys/kernel/slab/idr_layer_cache/hwcache_align create mode 100644 test/sys/kernel/slab/idr_layer_cache/object_size create mode 100644 test/sys/kernel/slab/idr_layer_cache/objects create mode 100644 test/sys/kernel/slab/idr_layer_cache/objects_partial create mode 100644 test/sys/kernel/slab/idr_layer_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/idr_layer_cache/order create mode 100644 test/sys/kernel/slab/idr_layer_cache/partial create mode 100644 test/sys/kernel/slab/idr_layer_cache/poison create mode 100644 test/sys/kernel/slab/idr_layer_cache/reclaim_account create mode 100644 test/sys/kernel/slab/idr_layer_cache/red_zone create mode 100644 test/sys/kernel/slab/idr_layer_cache/sanity_checks create mode 100644 test/sys/kernel/slab/idr_layer_cache/shrink create mode 100644 test/sys/kernel/slab/idr_layer_cache/slab_size create mode 100644 test/sys/kernel/slab/idr_layer_cache/slabs create mode 100644 test/sys/kernel/slab/idr_layer_cache/store_user create mode 100644 test/sys/kernel/slab/idr_layer_cache/total_objects create mode 100644 test/sys/kernel/slab/idr_layer_cache/trace create mode 100644 test/sys/kernel/slab/idr_layer_cache/validate create mode 100644 test/sys/kernel/slab/inet_peer_cache/aliases create mode 100644 test/sys/kernel/slab/inet_peer_cache/align create mode 100644 test/sys/kernel/slab/inet_peer_cache/alloc_calls create mode 100644 test/sys/kernel/slab/inet_peer_cache/cache_dma create mode 100644 test/sys/kernel/slab/inet_peer_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/inet_peer_cache/ctor create mode 100644 test/sys/kernel/slab/inet_peer_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/inet_peer_cache/free_calls create mode 100644 test/sys/kernel/slab/inet_peer_cache/hwcache_align create mode 100644 test/sys/kernel/slab/inet_peer_cache/object_size create mode 100644 test/sys/kernel/slab/inet_peer_cache/objects create mode 100644 test/sys/kernel/slab/inet_peer_cache/objects_partial create mode 100644 test/sys/kernel/slab/inet_peer_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/inet_peer_cache/order create mode 100644 test/sys/kernel/slab/inet_peer_cache/partial create mode 100644 test/sys/kernel/slab/inet_peer_cache/poison create mode 100644 test/sys/kernel/slab/inet_peer_cache/reclaim_account create mode 100644 test/sys/kernel/slab/inet_peer_cache/red_zone create mode 100644 test/sys/kernel/slab/inet_peer_cache/sanity_checks create mode 100644 test/sys/kernel/slab/inet_peer_cache/shrink create mode 100644 test/sys/kernel/slab/inet_peer_cache/slab_size create mode 100644 test/sys/kernel/slab/inet_peer_cache/slabs create mode 100644 test/sys/kernel/slab/inet_peer_cache/store_user create mode 100644 test/sys/kernel/slab/inet_peer_cache/total_objects create mode 100644 test/sys/kernel/slab/inet_peer_cache/trace create mode 100644 test/sys/kernel/slab/inet_peer_cache/validate create mode 100644 test/sys/kernel/slab/inode_cache/aliases create mode 100644 test/sys/kernel/slab/inode_cache/align create mode 100644 test/sys/kernel/slab/inode_cache/alloc_calls create mode 100644 test/sys/kernel/slab/inode_cache/cache_dma create mode 100644 test/sys/kernel/slab/inode_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/inode_cache/ctor create mode 100644 test/sys/kernel/slab/inode_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/inode_cache/free_calls create mode 100644 test/sys/kernel/slab/inode_cache/hwcache_align create mode 100644 test/sys/kernel/slab/inode_cache/object_size create mode 100644 test/sys/kernel/slab/inode_cache/objects create mode 100644 test/sys/kernel/slab/inode_cache/objects_partial create mode 100644 test/sys/kernel/slab/inode_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/inode_cache/order create mode 100644 test/sys/kernel/slab/inode_cache/partial create mode 100644 test/sys/kernel/slab/inode_cache/poison create mode 100644 test/sys/kernel/slab/inode_cache/reclaim_account create mode 100644 test/sys/kernel/slab/inode_cache/red_zone create mode 100644 test/sys/kernel/slab/inode_cache/sanity_checks create mode 100644 test/sys/kernel/slab/inode_cache/shrink create mode 100644 test/sys/kernel/slab/inode_cache/slab_size create mode 100644 test/sys/kernel/slab/inode_cache/slabs create mode 100644 test/sys/kernel/slab/inode_cache/store_user create mode 100644 test/sys/kernel/slab/inode_cache/total_objects create mode 100644 test/sys/kernel/slab/inode_cache/trace create mode 100644 test/sys/kernel/slab/inode_cache/validate create mode 100644 test/sys/kernel/slab/inotify_event_cache/aliases create mode 100644 test/sys/kernel/slab/inotify_event_cache/align create mode 100644 test/sys/kernel/slab/inotify_event_cache/alloc_calls create mode 100644 test/sys/kernel/slab/inotify_event_cache/cache_dma create mode 100644 test/sys/kernel/slab/inotify_event_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/inotify_event_cache/ctor create mode 100644 test/sys/kernel/slab/inotify_event_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/inotify_event_cache/free_calls create mode 100644 test/sys/kernel/slab/inotify_event_cache/hwcache_align create mode 100644 test/sys/kernel/slab/inotify_event_cache/object_size create mode 100644 test/sys/kernel/slab/inotify_event_cache/objects create mode 100644 test/sys/kernel/slab/inotify_event_cache/objects_partial create mode 100644 test/sys/kernel/slab/inotify_event_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/inotify_event_cache/order create mode 100644 test/sys/kernel/slab/inotify_event_cache/partial create mode 100644 test/sys/kernel/slab/inotify_event_cache/poison create mode 100644 test/sys/kernel/slab/inotify_event_cache/reclaim_account create mode 100644 test/sys/kernel/slab/inotify_event_cache/red_zone create mode 100644 test/sys/kernel/slab/inotify_event_cache/sanity_checks create mode 100644 test/sys/kernel/slab/inotify_event_cache/shrink create mode 100644 test/sys/kernel/slab/inotify_event_cache/slab_size create mode 100644 test/sys/kernel/slab/inotify_event_cache/slabs create mode 100644 test/sys/kernel/slab/inotify_event_cache/store_user create mode 100644 test/sys/kernel/slab/inotify_event_cache/total_objects create mode 100644 test/sys/kernel/slab/inotify_event_cache/trace create mode 100644 test/sys/kernel/slab/inotify_event_cache/validate create mode 100644 test/sys/kernel/slab/inotify_watch_cache/aliases create mode 100644 test/sys/kernel/slab/inotify_watch_cache/align create mode 100644 test/sys/kernel/slab/inotify_watch_cache/alloc_calls create mode 100644 test/sys/kernel/slab/inotify_watch_cache/cache_dma create mode 100644 test/sys/kernel/slab/inotify_watch_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/inotify_watch_cache/ctor create mode 100644 test/sys/kernel/slab/inotify_watch_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/inotify_watch_cache/free_calls create mode 100644 test/sys/kernel/slab/inotify_watch_cache/hwcache_align create mode 100644 test/sys/kernel/slab/inotify_watch_cache/object_size create mode 100644 test/sys/kernel/slab/inotify_watch_cache/objects create mode 100644 test/sys/kernel/slab/inotify_watch_cache/objects_partial create mode 100644 test/sys/kernel/slab/inotify_watch_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/inotify_watch_cache/order create mode 100644 test/sys/kernel/slab/inotify_watch_cache/partial create mode 100644 test/sys/kernel/slab/inotify_watch_cache/poison create mode 100644 test/sys/kernel/slab/inotify_watch_cache/reclaim_account create mode 100644 test/sys/kernel/slab/inotify_watch_cache/red_zone create mode 100644 test/sys/kernel/slab/inotify_watch_cache/sanity_checks create mode 100644 test/sys/kernel/slab/inotify_watch_cache/shrink create mode 100644 test/sys/kernel/slab/inotify_watch_cache/slab_size create mode 100644 test/sys/kernel/slab/inotify_watch_cache/slabs create mode 100644 test/sys/kernel/slab/inotify_watch_cache/store_user create mode 100644 test/sys/kernel/slab/inotify_watch_cache/total_objects create mode 100644 test/sys/kernel/slab/inotify_watch_cache/trace create mode 100644 test/sys/kernel/slab/inotify_watch_cache/validate create mode 100644 test/sys/kernel/slab/ip6_dst_cache/aliases create mode 100644 test/sys/kernel/slab/ip6_dst_cache/align create mode 100644 test/sys/kernel/slab/ip6_dst_cache/alloc_calls create mode 100644 test/sys/kernel/slab/ip6_dst_cache/cache_dma create mode 100644 test/sys/kernel/slab/ip6_dst_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/ip6_dst_cache/ctor create mode 100644 test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/ip6_dst_cache/free_calls create mode 100644 test/sys/kernel/slab/ip6_dst_cache/hwcache_align create mode 100644 test/sys/kernel/slab/ip6_dst_cache/object_size create mode 100644 test/sys/kernel/slab/ip6_dst_cache/objects create mode 100644 test/sys/kernel/slab/ip6_dst_cache/objects_partial create mode 100644 test/sys/kernel/slab/ip6_dst_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/ip6_dst_cache/order create mode 100644 test/sys/kernel/slab/ip6_dst_cache/partial create mode 100644 test/sys/kernel/slab/ip6_dst_cache/poison create mode 100644 test/sys/kernel/slab/ip6_dst_cache/reclaim_account create mode 100644 test/sys/kernel/slab/ip6_dst_cache/red_zone create mode 100644 test/sys/kernel/slab/ip6_dst_cache/sanity_checks create mode 100644 test/sys/kernel/slab/ip6_dst_cache/shrink create mode 100644 test/sys/kernel/slab/ip6_dst_cache/slab_size create mode 100644 test/sys/kernel/slab/ip6_dst_cache/slabs create mode 100644 test/sys/kernel/slab/ip6_dst_cache/store_user create mode 100644 test/sys/kernel/slab/ip6_dst_cache/total_objects create mode 100644 test/sys/kernel/slab/ip6_dst_cache/trace create mode 100644 test/sys/kernel/slab/ip6_dst_cache/validate create mode 100644 test/sys/kernel/slab/ip_dst_cache/aliases create mode 100644 test/sys/kernel/slab/ip_dst_cache/align create mode 100644 test/sys/kernel/slab/ip_dst_cache/alloc_calls create mode 100644 test/sys/kernel/slab/ip_dst_cache/cache_dma create mode 100644 test/sys/kernel/slab/ip_dst_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/ip_dst_cache/ctor create mode 100644 test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/ip_dst_cache/free_calls create mode 100644 test/sys/kernel/slab/ip_dst_cache/hwcache_align create mode 100644 test/sys/kernel/slab/ip_dst_cache/object_size create mode 100644 test/sys/kernel/slab/ip_dst_cache/objects create mode 100644 test/sys/kernel/slab/ip_dst_cache/objects_partial create mode 100644 test/sys/kernel/slab/ip_dst_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/ip_dst_cache/order create mode 100644 test/sys/kernel/slab/ip_dst_cache/partial create mode 100644 test/sys/kernel/slab/ip_dst_cache/poison create mode 100644 test/sys/kernel/slab/ip_dst_cache/reclaim_account create mode 100644 test/sys/kernel/slab/ip_dst_cache/red_zone create mode 100644 test/sys/kernel/slab/ip_dst_cache/sanity_checks create mode 100644 test/sys/kernel/slab/ip_dst_cache/shrink create mode 100644 test/sys/kernel/slab/ip_dst_cache/slab_size create mode 100644 test/sys/kernel/slab/ip_dst_cache/slabs create mode 100644 test/sys/kernel/slab/ip_dst_cache/store_user create mode 100644 test/sys/kernel/slab/ip_dst_cache/total_objects create mode 100644 test/sys/kernel/slab/ip_dst_cache/trace create mode 100644 test/sys/kernel/slab/ip_dst_cache/validate create mode 100644 test/sys/kernel/slab/ip_fib_alias/aliases create mode 100644 test/sys/kernel/slab/ip_fib_alias/align create mode 100644 test/sys/kernel/slab/ip_fib_alias/alloc_calls create mode 100644 test/sys/kernel/slab/ip_fib_alias/cache_dma create mode 100644 test/sys/kernel/slab/ip_fib_alias/cpu_slabs create mode 100644 test/sys/kernel/slab/ip_fib_alias/ctor create mode 100644 test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu create mode 100644 test/sys/kernel/slab/ip_fib_alias/free_calls create mode 100644 test/sys/kernel/slab/ip_fib_alias/hwcache_align create mode 100644 test/sys/kernel/slab/ip_fib_alias/object_size create mode 100644 test/sys/kernel/slab/ip_fib_alias/objects create mode 100644 test/sys/kernel/slab/ip_fib_alias/objects_partial create mode 100644 test/sys/kernel/slab/ip_fib_alias/objs_per_slab create mode 100644 test/sys/kernel/slab/ip_fib_alias/order create mode 100644 test/sys/kernel/slab/ip_fib_alias/partial create mode 100644 test/sys/kernel/slab/ip_fib_alias/poison create mode 100644 test/sys/kernel/slab/ip_fib_alias/reclaim_account create mode 100644 test/sys/kernel/slab/ip_fib_alias/red_zone create mode 100644 test/sys/kernel/slab/ip_fib_alias/sanity_checks create mode 100644 test/sys/kernel/slab/ip_fib_alias/shrink create mode 100644 test/sys/kernel/slab/ip_fib_alias/slab_size create mode 100644 test/sys/kernel/slab/ip_fib_alias/slabs create mode 100644 test/sys/kernel/slab/ip_fib_alias/store_user create mode 100644 test/sys/kernel/slab/ip_fib_alias/total_objects create mode 100644 test/sys/kernel/slab/ip_fib_alias/trace create mode 100644 test/sys/kernel/slab/ip_fib_alias/validate create mode 100644 test/sys/kernel/slab/ip_fib_hash/aliases create mode 100644 test/sys/kernel/slab/ip_fib_hash/align create mode 100644 test/sys/kernel/slab/ip_fib_hash/alloc_calls create mode 100644 test/sys/kernel/slab/ip_fib_hash/cache_dma create mode 100644 test/sys/kernel/slab/ip_fib_hash/cpu_slabs create mode 100644 test/sys/kernel/slab/ip_fib_hash/ctor create mode 100644 test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu create mode 100644 test/sys/kernel/slab/ip_fib_hash/free_calls create mode 100644 test/sys/kernel/slab/ip_fib_hash/hwcache_align create mode 100644 test/sys/kernel/slab/ip_fib_hash/object_size create mode 100644 test/sys/kernel/slab/ip_fib_hash/objects create mode 100644 test/sys/kernel/slab/ip_fib_hash/objects_partial create mode 100644 test/sys/kernel/slab/ip_fib_hash/objs_per_slab create mode 100644 test/sys/kernel/slab/ip_fib_hash/order create mode 100644 test/sys/kernel/slab/ip_fib_hash/partial create mode 100644 test/sys/kernel/slab/ip_fib_hash/poison create mode 100644 test/sys/kernel/slab/ip_fib_hash/reclaim_account create mode 100644 test/sys/kernel/slab/ip_fib_hash/red_zone create mode 100644 test/sys/kernel/slab/ip_fib_hash/sanity_checks create mode 100644 test/sys/kernel/slab/ip_fib_hash/shrink create mode 100644 test/sys/kernel/slab/ip_fib_hash/slab_size create mode 100644 test/sys/kernel/slab/ip_fib_hash/slabs create mode 100644 test/sys/kernel/slab/ip_fib_hash/store_user create mode 100644 test/sys/kernel/slab/ip_fib_hash/total_objects create mode 100644 test/sys/kernel/slab/ip_fib_hash/trace create mode 100644 test/sys/kernel/slab/ip_fib_hash/validate create mode 100644 test/sys/kernel/slab/journal_handle/aliases create mode 100644 test/sys/kernel/slab/journal_handle/align create mode 100644 test/sys/kernel/slab/journal_handle/alloc_calls create mode 100644 test/sys/kernel/slab/journal_handle/cache_dma create mode 100644 test/sys/kernel/slab/journal_handle/cpu_slabs create mode 100644 test/sys/kernel/slab/journal_handle/ctor create mode 100644 test/sys/kernel/slab/journal_handle/destroy_by_rcu create mode 100644 test/sys/kernel/slab/journal_handle/free_calls create mode 100644 test/sys/kernel/slab/journal_handle/hwcache_align create mode 100644 test/sys/kernel/slab/journal_handle/object_size create mode 100644 test/sys/kernel/slab/journal_handle/objects create mode 100644 test/sys/kernel/slab/journal_handle/objects_partial create mode 100644 test/sys/kernel/slab/journal_handle/objs_per_slab create mode 100644 test/sys/kernel/slab/journal_handle/order create mode 100644 test/sys/kernel/slab/journal_handle/partial create mode 100644 test/sys/kernel/slab/journal_handle/poison create mode 100644 test/sys/kernel/slab/journal_handle/reclaim_account create mode 100644 test/sys/kernel/slab/journal_handle/red_zone create mode 100644 test/sys/kernel/slab/journal_handle/sanity_checks create mode 100644 test/sys/kernel/slab/journal_handle/shrink create mode 100644 test/sys/kernel/slab/journal_handle/slab_size create mode 100644 test/sys/kernel/slab/journal_handle/slabs create mode 100644 test/sys/kernel/slab/journal_handle/store_user create mode 100644 test/sys/kernel/slab/journal_handle/total_objects create mode 100644 test/sys/kernel/slab/journal_handle/trace create mode 100644 test/sys/kernel/slab/journal_handle/validate create mode 100644 test/sys/kernel/slab/journal_head/aliases create mode 100644 test/sys/kernel/slab/journal_head/align create mode 100644 test/sys/kernel/slab/journal_head/alloc_calls create mode 100644 test/sys/kernel/slab/journal_head/cache_dma create mode 100644 test/sys/kernel/slab/journal_head/cpu_slabs create mode 100644 test/sys/kernel/slab/journal_head/ctor create mode 100644 test/sys/kernel/slab/journal_head/destroy_by_rcu create mode 100644 test/sys/kernel/slab/journal_head/free_calls create mode 100644 test/sys/kernel/slab/journal_head/hwcache_align create mode 100644 test/sys/kernel/slab/journal_head/object_size create mode 100644 test/sys/kernel/slab/journal_head/objects create mode 100644 test/sys/kernel/slab/journal_head/objects_partial create mode 100644 test/sys/kernel/slab/journal_head/objs_per_slab create mode 100644 test/sys/kernel/slab/journal_head/order create mode 100644 test/sys/kernel/slab/journal_head/partial create mode 100644 test/sys/kernel/slab/journal_head/poison create mode 100644 test/sys/kernel/slab/journal_head/reclaim_account create mode 100644 test/sys/kernel/slab/journal_head/red_zone create mode 100644 test/sys/kernel/slab/journal_head/sanity_checks create mode 100644 test/sys/kernel/slab/journal_head/shrink create mode 100644 test/sys/kernel/slab/journal_head/slab_size create mode 100644 test/sys/kernel/slab/journal_head/slabs create mode 100644 test/sys/kernel/slab/journal_head/store_user create mode 100644 test/sys/kernel/slab/journal_head/total_objects create mode 100644 test/sys/kernel/slab/journal_head/trace create mode 100644 test/sys/kernel/slab/journal_head/validate create mode 100644 test/sys/kernel/slab/kcopyd_job/aliases create mode 100644 test/sys/kernel/slab/kcopyd_job/align create mode 100644 test/sys/kernel/slab/kcopyd_job/alloc_calls create mode 100644 test/sys/kernel/slab/kcopyd_job/cache_dma create mode 100644 test/sys/kernel/slab/kcopyd_job/cpu_slabs create mode 100644 test/sys/kernel/slab/kcopyd_job/ctor create mode 100644 test/sys/kernel/slab/kcopyd_job/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kcopyd_job/free_calls create mode 100644 test/sys/kernel/slab/kcopyd_job/hwcache_align create mode 100644 test/sys/kernel/slab/kcopyd_job/object_size create mode 100644 test/sys/kernel/slab/kcopyd_job/objects create mode 100644 test/sys/kernel/slab/kcopyd_job/objects_partial create mode 100644 test/sys/kernel/slab/kcopyd_job/objs_per_slab create mode 100644 test/sys/kernel/slab/kcopyd_job/order create mode 100644 test/sys/kernel/slab/kcopyd_job/partial create mode 100644 test/sys/kernel/slab/kcopyd_job/poison create mode 100644 test/sys/kernel/slab/kcopyd_job/reclaim_account create mode 100644 test/sys/kernel/slab/kcopyd_job/red_zone create mode 100644 test/sys/kernel/slab/kcopyd_job/sanity_checks create mode 100644 test/sys/kernel/slab/kcopyd_job/shrink create mode 100644 test/sys/kernel/slab/kcopyd_job/slab_size create mode 100644 test/sys/kernel/slab/kcopyd_job/slabs create mode 100644 test/sys/kernel/slab/kcopyd_job/store_user create mode 100644 test/sys/kernel/slab/kcopyd_job/total_objects create mode 100644 test/sys/kernel/slab/kcopyd_job/trace create mode 100644 test/sys/kernel/slab/kcopyd_job/validate create mode 100644 test/sys/kernel/slab/key_jar/aliases create mode 100644 test/sys/kernel/slab/key_jar/align create mode 100644 test/sys/kernel/slab/key_jar/alloc_calls create mode 100644 test/sys/kernel/slab/key_jar/cache_dma create mode 100644 test/sys/kernel/slab/key_jar/cpu_slabs create mode 100644 test/sys/kernel/slab/key_jar/ctor create mode 100644 test/sys/kernel/slab/key_jar/destroy_by_rcu create mode 100644 test/sys/kernel/slab/key_jar/free_calls create mode 100644 test/sys/kernel/slab/key_jar/hwcache_align create mode 100644 test/sys/kernel/slab/key_jar/object_size create mode 100644 test/sys/kernel/slab/key_jar/objects create mode 100644 test/sys/kernel/slab/key_jar/objects_partial create mode 100644 test/sys/kernel/slab/key_jar/objs_per_slab create mode 100644 test/sys/kernel/slab/key_jar/order create mode 100644 test/sys/kernel/slab/key_jar/partial create mode 100644 test/sys/kernel/slab/key_jar/poison create mode 100644 test/sys/kernel/slab/key_jar/reclaim_account create mode 100644 test/sys/kernel/slab/key_jar/red_zone create mode 100644 test/sys/kernel/slab/key_jar/sanity_checks create mode 100644 test/sys/kernel/slab/key_jar/shrink create mode 100644 test/sys/kernel/slab/key_jar/slab_size create mode 100644 test/sys/kernel/slab/key_jar/slabs create mode 100644 test/sys/kernel/slab/key_jar/store_user create mode 100644 test/sys/kernel/slab/key_jar/total_objects create mode 100644 test/sys/kernel/slab/key_jar/trace create mode 100644 test/sys/kernel/slab/key_jar/validate create mode 100644 test/sys/kernel/slab/kiocb/aliases create mode 100644 test/sys/kernel/slab/kiocb/align create mode 100644 test/sys/kernel/slab/kiocb/alloc_calls create mode 100644 test/sys/kernel/slab/kiocb/cache_dma create mode 100644 test/sys/kernel/slab/kiocb/cpu_slabs create mode 100644 test/sys/kernel/slab/kiocb/ctor create mode 100644 test/sys/kernel/slab/kiocb/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kiocb/free_calls create mode 100644 test/sys/kernel/slab/kiocb/hwcache_align create mode 100644 test/sys/kernel/slab/kiocb/object_size create mode 100644 test/sys/kernel/slab/kiocb/objects create mode 100644 test/sys/kernel/slab/kiocb/objects_partial create mode 100644 test/sys/kernel/slab/kiocb/objs_per_slab create mode 100644 test/sys/kernel/slab/kiocb/order create mode 100644 test/sys/kernel/slab/kiocb/partial create mode 100644 test/sys/kernel/slab/kiocb/poison create mode 100644 test/sys/kernel/slab/kiocb/reclaim_account create mode 100644 test/sys/kernel/slab/kiocb/red_zone create mode 100644 test/sys/kernel/slab/kiocb/sanity_checks create mode 100644 test/sys/kernel/slab/kiocb/shrink create mode 100644 test/sys/kernel/slab/kiocb/slab_size create mode 100644 test/sys/kernel/slab/kiocb/slabs create mode 100644 test/sys/kernel/slab/kiocb/store_user create mode 100644 test/sys/kernel/slab/kiocb/total_objects create mode 100644 test/sys/kernel/slab/kiocb/trace create mode 100644 test/sys/kernel/slab/kiocb/validate create mode 100644 test/sys/kernel/slab/kioctx/aliases create mode 100644 test/sys/kernel/slab/kioctx/align create mode 100644 test/sys/kernel/slab/kioctx/alloc_calls create mode 100644 test/sys/kernel/slab/kioctx/cache_dma create mode 100644 test/sys/kernel/slab/kioctx/cpu_slabs create mode 100644 test/sys/kernel/slab/kioctx/ctor create mode 100644 test/sys/kernel/slab/kioctx/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kioctx/free_calls create mode 100644 test/sys/kernel/slab/kioctx/hwcache_align create mode 100644 test/sys/kernel/slab/kioctx/object_size create mode 100644 test/sys/kernel/slab/kioctx/objects create mode 100644 test/sys/kernel/slab/kioctx/objects_partial create mode 100644 test/sys/kernel/slab/kioctx/objs_per_slab create mode 100644 test/sys/kernel/slab/kioctx/order create mode 100644 test/sys/kernel/slab/kioctx/partial create mode 100644 test/sys/kernel/slab/kioctx/poison create mode 100644 test/sys/kernel/slab/kioctx/reclaim_account create mode 100644 test/sys/kernel/slab/kioctx/red_zone create mode 100644 test/sys/kernel/slab/kioctx/sanity_checks create mode 100644 test/sys/kernel/slab/kioctx/shrink create mode 100644 test/sys/kernel/slab/kioctx/slab_size create mode 100644 test/sys/kernel/slab/kioctx/slabs create mode 100644 test/sys/kernel/slab/kioctx/store_user create mode 100644 test/sys/kernel/slab/kioctx/total_objects create mode 100644 test/sys/kernel/slab/kioctx/trace create mode 100644 test/sys/kernel/slab/kioctx/validate create mode 100644 test/sys/kernel/slab/kmalloc-1024/aliases create mode 100644 test/sys/kernel/slab/kmalloc-1024/align create mode 100644 test/sys/kernel/slab/kmalloc-1024/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-1024/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-1024/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-1024/ctor create mode 100644 test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-1024/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-1024/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-1024/object_size create mode 100644 test/sys/kernel/slab/kmalloc-1024/objects create mode 100644 test/sys/kernel/slab/kmalloc-1024/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-1024/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-1024/order create mode 100644 test/sys/kernel/slab/kmalloc-1024/partial create mode 100644 test/sys/kernel/slab/kmalloc-1024/poison create mode 100644 test/sys/kernel/slab/kmalloc-1024/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-1024/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-1024/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-1024/shrink create mode 100644 test/sys/kernel/slab/kmalloc-1024/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-1024/slabs create mode 100644 test/sys/kernel/slab/kmalloc-1024/store_user create mode 100644 test/sys/kernel/slab/kmalloc-1024/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-1024/trace create mode 100644 test/sys/kernel/slab/kmalloc-1024/validate create mode 100644 test/sys/kernel/slab/kmalloc-128/aliases create mode 100644 test/sys/kernel/slab/kmalloc-128/align create mode 100644 test/sys/kernel/slab/kmalloc-128/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-128/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-128/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-128/ctor create mode 100644 test/sys/kernel/slab/kmalloc-128/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-128/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-128/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-128/object_size create mode 100644 test/sys/kernel/slab/kmalloc-128/objects create mode 100644 test/sys/kernel/slab/kmalloc-128/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-128/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-128/order create mode 100644 test/sys/kernel/slab/kmalloc-128/partial create mode 100644 test/sys/kernel/slab/kmalloc-128/poison create mode 100644 test/sys/kernel/slab/kmalloc-128/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-128/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-128/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-128/shrink create mode 100644 test/sys/kernel/slab/kmalloc-128/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-128/slabs create mode 100644 test/sys/kernel/slab/kmalloc-128/store_user create mode 100644 test/sys/kernel/slab/kmalloc-128/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-128/trace create mode 100644 test/sys/kernel/slab/kmalloc-128/validate create mode 100644 test/sys/kernel/slab/kmalloc-16/aliases create mode 100644 test/sys/kernel/slab/kmalloc-16/align create mode 100644 test/sys/kernel/slab/kmalloc-16/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-16/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-16/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-16/ctor create mode 100644 test/sys/kernel/slab/kmalloc-16/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-16/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-16/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-16/object_size create mode 100644 test/sys/kernel/slab/kmalloc-16/objects create mode 100644 test/sys/kernel/slab/kmalloc-16/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-16/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-16/order create mode 100644 test/sys/kernel/slab/kmalloc-16/partial create mode 100644 test/sys/kernel/slab/kmalloc-16/poison create mode 100644 test/sys/kernel/slab/kmalloc-16/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-16/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-16/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-16/shrink create mode 100644 test/sys/kernel/slab/kmalloc-16/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-16/slabs create mode 100644 test/sys/kernel/slab/kmalloc-16/store_user create mode 100644 test/sys/kernel/slab/kmalloc-16/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-16/trace create mode 100644 test/sys/kernel/slab/kmalloc-16/validate create mode 100644 test/sys/kernel/slab/kmalloc-192/aliases create mode 100644 test/sys/kernel/slab/kmalloc-192/align create mode 100644 test/sys/kernel/slab/kmalloc-192/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-192/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-192/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-192/ctor create mode 100644 test/sys/kernel/slab/kmalloc-192/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-192/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-192/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-192/object_size create mode 100644 test/sys/kernel/slab/kmalloc-192/objects create mode 100644 test/sys/kernel/slab/kmalloc-192/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-192/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-192/order create mode 100644 test/sys/kernel/slab/kmalloc-192/partial create mode 100644 test/sys/kernel/slab/kmalloc-192/poison create mode 100644 test/sys/kernel/slab/kmalloc-192/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-192/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-192/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-192/shrink create mode 100644 test/sys/kernel/slab/kmalloc-192/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-192/slabs create mode 100644 test/sys/kernel/slab/kmalloc-192/store_user create mode 100644 test/sys/kernel/slab/kmalloc-192/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-192/trace create mode 100644 test/sys/kernel/slab/kmalloc-192/validate create mode 100644 test/sys/kernel/slab/kmalloc-2048/aliases create mode 100644 test/sys/kernel/slab/kmalloc-2048/align create mode 100644 test/sys/kernel/slab/kmalloc-2048/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-2048/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-2048/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-2048/ctor create mode 100644 test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-2048/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-2048/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-2048/object_size create mode 100644 test/sys/kernel/slab/kmalloc-2048/objects create mode 100644 test/sys/kernel/slab/kmalloc-2048/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-2048/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-2048/order create mode 100644 test/sys/kernel/slab/kmalloc-2048/partial create mode 100644 test/sys/kernel/slab/kmalloc-2048/poison create mode 100644 test/sys/kernel/slab/kmalloc-2048/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-2048/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-2048/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-2048/shrink create mode 100644 test/sys/kernel/slab/kmalloc-2048/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-2048/slabs create mode 100644 test/sys/kernel/slab/kmalloc-2048/store_user create mode 100644 test/sys/kernel/slab/kmalloc-2048/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-2048/trace create mode 100644 test/sys/kernel/slab/kmalloc-2048/validate create mode 100644 test/sys/kernel/slab/kmalloc-256/aliases create mode 100644 test/sys/kernel/slab/kmalloc-256/align create mode 100644 test/sys/kernel/slab/kmalloc-256/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-256/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-256/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-256/ctor create mode 100644 test/sys/kernel/slab/kmalloc-256/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-256/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-256/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-256/object_size create mode 100644 test/sys/kernel/slab/kmalloc-256/objects create mode 100644 test/sys/kernel/slab/kmalloc-256/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-256/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-256/order create mode 100644 test/sys/kernel/slab/kmalloc-256/partial create mode 100644 test/sys/kernel/slab/kmalloc-256/poison create mode 100644 test/sys/kernel/slab/kmalloc-256/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-256/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-256/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-256/shrink create mode 100644 test/sys/kernel/slab/kmalloc-256/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-256/slabs create mode 100644 test/sys/kernel/slab/kmalloc-256/store_user create mode 100644 test/sys/kernel/slab/kmalloc-256/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-256/trace create mode 100644 test/sys/kernel/slab/kmalloc-256/validate create mode 100644 test/sys/kernel/slab/kmalloc-32/aliases create mode 100644 test/sys/kernel/slab/kmalloc-32/align create mode 100644 test/sys/kernel/slab/kmalloc-32/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-32/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-32/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-32/ctor create mode 100644 test/sys/kernel/slab/kmalloc-32/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-32/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-32/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-32/object_size create mode 100644 test/sys/kernel/slab/kmalloc-32/objects create mode 100644 test/sys/kernel/slab/kmalloc-32/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-32/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-32/order create mode 100644 test/sys/kernel/slab/kmalloc-32/partial create mode 100644 test/sys/kernel/slab/kmalloc-32/poison create mode 100644 test/sys/kernel/slab/kmalloc-32/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-32/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-32/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-32/shrink create mode 100644 test/sys/kernel/slab/kmalloc-32/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-32/slabs create mode 100644 test/sys/kernel/slab/kmalloc-32/store_user create mode 100644 test/sys/kernel/slab/kmalloc-32/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-32/trace create mode 100644 test/sys/kernel/slab/kmalloc-32/validate create mode 100644 test/sys/kernel/slab/kmalloc-4096/aliases create mode 100644 test/sys/kernel/slab/kmalloc-4096/align create mode 100644 test/sys/kernel/slab/kmalloc-4096/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-4096/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-4096/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-4096/ctor create mode 100644 test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-4096/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-4096/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-4096/object_size create mode 100644 test/sys/kernel/slab/kmalloc-4096/objects create mode 100644 test/sys/kernel/slab/kmalloc-4096/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-4096/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-4096/order create mode 100644 test/sys/kernel/slab/kmalloc-4096/partial create mode 100644 test/sys/kernel/slab/kmalloc-4096/poison create mode 100644 test/sys/kernel/slab/kmalloc-4096/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-4096/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-4096/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-4096/shrink create mode 100644 test/sys/kernel/slab/kmalloc-4096/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-4096/slabs create mode 100644 test/sys/kernel/slab/kmalloc-4096/store_user create mode 100644 test/sys/kernel/slab/kmalloc-4096/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-4096/trace create mode 100644 test/sys/kernel/slab/kmalloc-4096/validate create mode 100644 test/sys/kernel/slab/kmalloc-512/aliases create mode 100644 test/sys/kernel/slab/kmalloc-512/align create mode 100644 test/sys/kernel/slab/kmalloc-512/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-512/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-512/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-512/ctor create mode 100644 test/sys/kernel/slab/kmalloc-512/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-512/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-512/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-512/object_size create mode 100644 test/sys/kernel/slab/kmalloc-512/objects create mode 100644 test/sys/kernel/slab/kmalloc-512/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-512/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-512/order create mode 100644 test/sys/kernel/slab/kmalloc-512/partial create mode 100644 test/sys/kernel/slab/kmalloc-512/poison create mode 100644 test/sys/kernel/slab/kmalloc-512/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-512/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-512/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-512/shrink create mode 100644 test/sys/kernel/slab/kmalloc-512/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-512/slabs create mode 100644 test/sys/kernel/slab/kmalloc-512/store_user create mode 100644 test/sys/kernel/slab/kmalloc-512/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-512/trace create mode 100644 test/sys/kernel/slab/kmalloc-512/validate create mode 100644 test/sys/kernel/slab/kmalloc-64/aliases create mode 100644 test/sys/kernel/slab/kmalloc-64/align create mode 100644 test/sys/kernel/slab/kmalloc-64/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-64/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-64/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-64/ctor create mode 100644 test/sys/kernel/slab/kmalloc-64/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-64/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-64/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-64/object_size create mode 100644 test/sys/kernel/slab/kmalloc-64/objects create mode 100644 test/sys/kernel/slab/kmalloc-64/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-64/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-64/order create mode 100644 test/sys/kernel/slab/kmalloc-64/partial create mode 100644 test/sys/kernel/slab/kmalloc-64/poison create mode 100644 test/sys/kernel/slab/kmalloc-64/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-64/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-64/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-64/shrink create mode 100644 test/sys/kernel/slab/kmalloc-64/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-64/slabs create mode 100644 test/sys/kernel/slab/kmalloc-64/store_user create mode 100644 test/sys/kernel/slab/kmalloc-64/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-64/trace create mode 100644 test/sys/kernel/slab/kmalloc-64/validate create mode 100644 test/sys/kernel/slab/kmalloc-8/aliases create mode 100644 test/sys/kernel/slab/kmalloc-8/align create mode 100644 test/sys/kernel/slab/kmalloc-8/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-8/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-8/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-8/ctor create mode 100644 test/sys/kernel/slab/kmalloc-8/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-8/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-8/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-8/object_size create mode 100644 test/sys/kernel/slab/kmalloc-8/objects create mode 100644 test/sys/kernel/slab/kmalloc-8/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-8/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-8/order create mode 100644 test/sys/kernel/slab/kmalloc-8/partial create mode 100644 test/sys/kernel/slab/kmalloc-8/poison create mode 100644 test/sys/kernel/slab/kmalloc-8/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-8/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-8/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-8/shrink create mode 100644 test/sys/kernel/slab/kmalloc-8/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-8/slabs create mode 100644 test/sys/kernel/slab/kmalloc-8/store_user create mode 100644 test/sys/kernel/slab/kmalloc-8/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-8/trace create mode 100644 test/sys/kernel/slab/kmalloc-8/validate create mode 100644 test/sys/kernel/slab/kmalloc-96/aliases create mode 100644 test/sys/kernel/slab/kmalloc-96/align create mode 100644 test/sys/kernel/slab/kmalloc-96/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc-96/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc-96/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc-96/ctor create mode 100644 test/sys/kernel/slab/kmalloc-96/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc-96/free_calls create mode 100644 test/sys/kernel/slab/kmalloc-96/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc-96/object_size create mode 100644 test/sys/kernel/slab/kmalloc-96/objects create mode 100644 test/sys/kernel/slab/kmalloc-96/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc-96/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc-96/order create mode 100644 test/sys/kernel/slab/kmalloc-96/partial create mode 100644 test/sys/kernel/slab/kmalloc-96/poison create mode 100644 test/sys/kernel/slab/kmalloc-96/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc-96/red_zone create mode 100644 test/sys/kernel/slab/kmalloc-96/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc-96/shrink create mode 100644 test/sys/kernel/slab/kmalloc-96/slab_size create mode 100644 test/sys/kernel/slab/kmalloc-96/slabs create mode 100644 test/sys/kernel/slab/kmalloc-96/store_user create mode 100644 test/sys/kernel/slab/kmalloc-96/total_objects create mode 100644 test/sys/kernel/slab/kmalloc-96/trace create mode 100644 test/sys/kernel/slab/kmalloc-96/validate create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/aliases create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/align create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/alloc_calls create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/cache_dma create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/ctor create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/free_calls create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/hwcache_align create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/object_size create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/objects create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/objects_partial create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/order create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/partial create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/poison create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/reclaim_account create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/red_zone create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/sanity_checks create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/shrink create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/slab_size create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/slabs create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/store_user create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/total_objects create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/trace create mode 100644 test/sys/kernel/slab/kmalloc_dma-512/validate create mode 100644 test/sys/kernel/slab/mm_struct/aliases create mode 100644 test/sys/kernel/slab/mm_struct/align create mode 100644 test/sys/kernel/slab/mm_struct/alloc_calls create mode 100644 test/sys/kernel/slab/mm_struct/cache_dma create mode 100644 test/sys/kernel/slab/mm_struct/cpu_slabs create mode 100644 test/sys/kernel/slab/mm_struct/ctor create mode 100644 test/sys/kernel/slab/mm_struct/destroy_by_rcu create mode 100644 test/sys/kernel/slab/mm_struct/free_calls create mode 100644 test/sys/kernel/slab/mm_struct/hwcache_align create mode 100644 test/sys/kernel/slab/mm_struct/object_size create mode 100644 test/sys/kernel/slab/mm_struct/objects create mode 100644 test/sys/kernel/slab/mm_struct/objects_partial create mode 100644 test/sys/kernel/slab/mm_struct/objs_per_slab create mode 100644 test/sys/kernel/slab/mm_struct/order create mode 100644 test/sys/kernel/slab/mm_struct/partial create mode 100644 test/sys/kernel/slab/mm_struct/poison create mode 100644 test/sys/kernel/slab/mm_struct/reclaim_account create mode 100644 test/sys/kernel/slab/mm_struct/red_zone create mode 100644 test/sys/kernel/slab/mm_struct/sanity_checks create mode 100644 test/sys/kernel/slab/mm_struct/shrink create mode 100644 test/sys/kernel/slab/mm_struct/slab_size create mode 100644 test/sys/kernel/slab/mm_struct/slabs create mode 100644 test/sys/kernel/slab/mm_struct/store_user create mode 100644 test/sys/kernel/slab/mm_struct/total_objects create mode 100644 test/sys/kernel/slab/mm_struct/trace create mode 100644 test/sys/kernel/slab/mm_struct/validate create mode 100644 test/sys/kernel/slab/mnt_cache/aliases create mode 100644 test/sys/kernel/slab/mnt_cache/align create mode 100644 test/sys/kernel/slab/mnt_cache/alloc_calls create mode 100644 test/sys/kernel/slab/mnt_cache/cache_dma create mode 100644 test/sys/kernel/slab/mnt_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/mnt_cache/ctor create mode 100644 test/sys/kernel/slab/mnt_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/mnt_cache/free_calls create mode 100644 test/sys/kernel/slab/mnt_cache/hwcache_align create mode 100644 test/sys/kernel/slab/mnt_cache/object_size create mode 100644 test/sys/kernel/slab/mnt_cache/objects create mode 100644 test/sys/kernel/slab/mnt_cache/objects_partial create mode 100644 test/sys/kernel/slab/mnt_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/mnt_cache/order create mode 100644 test/sys/kernel/slab/mnt_cache/partial create mode 100644 test/sys/kernel/slab/mnt_cache/poison create mode 100644 test/sys/kernel/slab/mnt_cache/reclaim_account create mode 100644 test/sys/kernel/slab/mnt_cache/red_zone create mode 100644 test/sys/kernel/slab/mnt_cache/sanity_checks create mode 100644 test/sys/kernel/slab/mnt_cache/shrink create mode 100644 test/sys/kernel/slab/mnt_cache/slab_size create mode 100644 test/sys/kernel/slab/mnt_cache/slabs create mode 100644 test/sys/kernel/slab/mnt_cache/store_user create mode 100644 test/sys/kernel/slab/mnt_cache/total_objects create mode 100644 test/sys/kernel/slab/mnt_cache/trace create mode 100644 test/sys/kernel/slab/mnt_cache/validate create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/aliases create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/align create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/alloc_calls create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/cache_dma create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/ctor create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/free_calls create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/hwcache_align create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/object_size create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/objects create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/objects_partial create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/order create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/partial create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/poison create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/reclaim_account create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/red_zone create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/sanity_checks create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/shrink create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/slab_size create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/slabs create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/store_user create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/total_objects create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/trace create mode 100644 test/sys/kernel/slab/mqueue_inode_cache/validate create mode 100644 test/sys/kernel/slab/names_cache/aliases create mode 100644 test/sys/kernel/slab/names_cache/align create mode 100644 test/sys/kernel/slab/names_cache/alloc_calls create mode 100644 test/sys/kernel/slab/names_cache/cache_dma create mode 100644 test/sys/kernel/slab/names_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/names_cache/ctor create mode 100644 test/sys/kernel/slab/names_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/names_cache/free_calls create mode 100644 test/sys/kernel/slab/names_cache/hwcache_align create mode 100644 test/sys/kernel/slab/names_cache/object_size create mode 100644 test/sys/kernel/slab/names_cache/objects create mode 100644 test/sys/kernel/slab/names_cache/objects_partial create mode 100644 test/sys/kernel/slab/names_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/names_cache/order create mode 100644 test/sys/kernel/slab/names_cache/partial create mode 100644 test/sys/kernel/slab/names_cache/poison create mode 100644 test/sys/kernel/slab/names_cache/reclaim_account create mode 100644 test/sys/kernel/slab/names_cache/red_zone create mode 100644 test/sys/kernel/slab/names_cache/sanity_checks create mode 100644 test/sys/kernel/slab/names_cache/shrink create mode 100644 test/sys/kernel/slab/names_cache/slab_size create mode 100644 test/sys/kernel/slab/names_cache/slabs create mode 100644 test/sys/kernel/slab/names_cache/store_user create mode 100644 test/sys/kernel/slab/names_cache/total_objects create mode 100644 test/sys/kernel/slab/names_cache/trace create mode 100644 test/sys/kernel/slab/names_cache/validate create mode 100644 test/sys/kernel/slab/ndisc_cache/aliases create mode 100644 test/sys/kernel/slab/ndisc_cache/align create mode 100644 test/sys/kernel/slab/ndisc_cache/alloc_calls create mode 100644 test/sys/kernel/slab/ndisc_cache/cache_dma create mode 100644 test/sys/kernel/slab/ndisc_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/ndisc_cache/ctor create mode 100644 test/sys/kernel/slab/ndisc_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/ndisc_cache/free_calls create mode 100644 test/sys/kernel/slab/ndisc_cache/hwcache_align create mode 100644 test/sys/kernel/slab/ndisc_cache/object_size create mode 100644 test/sys/kernel/slab/ndisc_cache/objects create mode 100644 test/sys/kernel/slab/ndisc_cache/objects_partial create mode 100644 test/sys/kernel/slab/ndisc_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/ndisc_cache/order create mode 100644 test/sys/kernel/slab/ndisc_cache/partial create mode 100644 test/sys/kernel/slab/ndisc_cache/poison create mode 100644 test/sys/kernel/slab/ndisc_cache/reclaim_account create mode 100644 test/sys/kernel/slab/ndisc_cache/red_zone create mode 100644 test/sys/kernel/slab/ndisc_cache/sanity_checks create mode 100644 test/sys/kernel/slab/ndisc_cache/shrink create mode 100644 test/sys/kernel/slab/ndisc_cache/slab_size create mode 100644 test/sys/kernel/slab/ndisc_cache/slabs create mode 100644 test/sys/kernel/slab/ndisc_cache/store_user create mode 100644 test/sys/kernel/slab/ndisc_cache/total_objects create mode 100644 test/sys/kernel/slab/ndisc_cache/trace create mode 100644 test/sys/kernel/slab/ndisc_cache/validate create mode 100644 test/sys/kernel/slab/nsproxy/aliases create mode 100644 test/sys/kernel/slab/nsproxy/align create mode 100644 test/sys/kernel/slab/nsproxy/alloc_calls create mode 100644 test/sys/kernel/slab/nsproxy/cache_dma create mode 100644 test/sys/kernel/slab/nsproxy/cpu_slabs create mode 100644 test/sys/kernel/slab/nsproxy/ctor create mode 100644 test/sys/kernel/slab/nsproxy/destroy_by_rcu create mode 100644 test/sys/kernel/slab/nsproxy/free_calls create mode 100644 test/sys/kernel/slab/nsproxy/hwcache_align create mode 100644 test/sys/kernel/slab/nsproxy/object_size create mode 100644 test/sys/kernel/slab/nsproxy/objects create mode 100644 test/sys/kernel/slab/nsproxy/objects_partial create mode 100644 test/sys/kernel/slab/nsproxy/objs_per_slab create mode 100644 test/sys/kernel/slab/nsproxy/order create mode 100644 test/sys/kernel/slab/nsproxy/partial create mode 100644 test/sys/kernel/slab/nsproxy/poison create mode 100644 test/sys/kernel/slab/nsproxy/reclaim_account create mode 100644 test/sys/kernel/slab/nsproxy/red_zone create mode 100644 test/sys/kernel/slab/nsproxy/sanity_checks create mode 100644 test/sys/kernel/slab/nsproxy/shrink create mode 100644 test/sys/kernel/slab/nsproxy/slab_size create mode 100644 test/sys/kernel/slab/nsproxy/slabs create mode 100644 test/sys/kernel/slab/nsproxy/store_user create mode 100644 test/sys/kernel/slab/nsproxy/total_objects create mode 100644 test/sys/kernel/slab/nsproxy/trace create mode 100644 test/sys/kernel/slab/nsproxy/validate create mode 100644 test/sys/kernel/slab/pid/aliases create mode 100644 test/sys/kernel/slab/pid/align create mode 100644 test/sys/kernel/slab/pid/alloc_calls create mode 100644 test/sys/kernel/slab/pid/cache_dma create mode 100644 test/sys/kernel/slab/pid/cpu_slabs create mode 100644 test/sys/kernel/slab/pid/ctor create mode 100644 test/sys/kernel/slab/pid/destroy_by_rcu create mode 100644 test/sys/kernel/slab/pid/free_calls create mode 100644 test/sys/kernel/slab/pid/hwcache_align create mode 100644 test/sys/kernel/slab/pid/object_size create mode 100644 test/sys/kernel/slab/pid/objects create mode 100644 test/sys/kernel/slab/pid/objects_partial create mode 100644 test/sys/kernel/slab/pid/objs_per_slab create mode 100644 test/sys/kernel/slab/pid/order create mode 100644 test/sys/kernel/slab/pid/partial create mode 100644 test/sys/kernel/slab/pid/poison create mode 100644 test/sys/kernel/slab/pid/reclaim_account create mode 100644 test/sys/kernel/slab/pid/red_zone create mode 100644 test/sys/kernel/slab/pid/sanity_checks create mode 100644 test/sys/kernel/slab/pid/shrink create mode 100644 test/sys/kernel/slab/pid/slab_size create mode 100644 test/sys/kernel/slab/pid/slabs create mode 100644 test/sys/kernel/slab/pid/store_user create mode 100644 test/sys/kernel/slab/pid/total_objects create mode 100644 test/sys/kernel/slab/pid/trace create mode 100644 test/sys/kernel/slab/pid/validate create mode 100644 test/sys/kernel/slab/posix_timers_cache/aliases create mode 100644 test/sys/kernel/slab/posix_timers_cache/align create mode 100644 test/sys/kernel/slab/posix_timers_cache/alloc_calls create mode 100644 test/sys/kernel/slab/posix_timers_cache/cache_dma create mode 100644 test/sys/kernel/slab/posix_timers_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/posix_timers_cache/ctor create mode 100644 test/sys/kernel/slab/posix_timers_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/posix_timers_cache/free_calls create mode 100644 test/sys/kernel/slab/posix_timers_cache/hwcache_align create mode 100644 test/sys/kernel/slab/posix_timers_cache/object_size create mode 100644 test/sys/kernel/slab/posix_timers_cache/objects create mode 100644 test/sys/kernel/slab/posix_timers_cache/objects_partial create mode 100644 test/sys/kernel/slab/posix_timers_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/posix_timers_cache/order create mode 100644 test/sys/kernel/slab/posix_timers_cache/partial create mode 100644 test/sys/kernel/slab/posix_timers_cache/poison create mode 100644 test/sys/kernel/slab/posix_timers_cache/reclaim_account create mode 100644 test/sys/kernel/slab/posix_timers_cache/red_zone create mode 100644 test/sys/kernel/slab/posix_timers_cache/sanity_checks create mode 100644 test/sys/kernel/slab/posix_timers_cache/shrink create mode 100644 test/sys/kernel/slab/posix_timers_cache/slab_size create mode 100644 test/sys/kernel/slab/posix_timers_cache/slabs create mode 100644 test/sys/kernel/slab/posix_timers_cache/store_user create mode 100644 test/sys/kernel/slab/posix_timers_cache/total_objects create mode 100644 test/sys/kernel/slab/posix_timers_cache/trace create mode 100644 test/sys/kernel/slab/posix_timers_cache/validate create mode 100644 test/sys/kernel/slab/proc_inode_cache/aliases create mode 100644 test/sys/kernel/slab/proc_inode_cache/align create mode 100644 test/sys/kernel/slab/proc_inode_cache/alloc_calls create mode 100644 test/sys/kernel/slab/proc_inode_cache/cache_dma create mode 100644 test/sys/kernel/slab/proc_inode_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/proc_inode_cache/ctor create mode 100644 test/sys/kernel/slab/proc_inode_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/proc_inode_cache/free_calls create mode 100644 test/sys/kernel/slab/proc_inode_cache/hwcache_align create mode 100644 test/sys/kernel/slab/proc_inode_cache/object_size create mode 100644 test/sys/kernel/slab/proc_inode_cache/objects create mode 100644 test/sys/kernel/slab/proc_inode_cache/objects_partial create mode 100644 test/sys/kernel/slab/proc_inode_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/proc_inode_cache/order create mode 100644 test/sys/kernel/slab/proc_inode_cache/partial create mode 100644 test/sys/kernel/slab/proc_inode_cache/poison create mode 100644 test/sys/kernel/slab/proc_inode_cache/reclaim_account create mode 100644 test/sys/kernel/slab/proc_inode_cache/red_zone create mode 100644 test/sys/kernel/slab/proc_inode_cache/sanity_checks create mode 100644 test/sys/kernel/slab/proc_inode_cache/shrink create mode 100644 test/sys/kernel/slab/proc_inode_cache/slab_size create mode 100644 test/sys/kernel/slab/proc_inode_cache/slabs create mode 100644 test/sys/kernel/slab/proc_inode_cache/store_user create mode 100644 test/sys/kernel/slab/proc_inode_cache/total_objects create mode 100644 test/sys/kernel/slab/proc_inode_cache/trace create mode 100644 test/sys/kernel/slab/proc_inode_cache/validate create mode 100644 test/sys/kernel/slab/radix_tree_node/aliases create mode 100644 test/sys/kernel/slab/radix_tree_node/align create mode 100644 test/sys/kernel/slab/radix_tree_node/alloc_calls create mode 100644 test/sys/kernel/slab/radix_tree_node/cache_dma create mode 100644 test/sys/kernel/slab/radix_tree_node/cpu_slabs create mode 100644 test/sys/kernel/slab/radix_tree_node/ctor create mode 100644 test/sys/kernel/slab/radix_tree_node/destroy_by_rcu create mode 100644 test/sys/kernel/slab/radix_tree_node/free_calls create mode 100644 test/sys/kernel/slab/radix_tree_node/hwcache_align create mode 100644 test/sys/kernel/slab/radix_tree_node/object_size create mode 100644 test/sys/kernel/slab/radix_tree_node/objects create mode 100644 test/sys/kernel/slab/radix_tree_node/objects_partial create mode 100644 test/sys/kernel/slab/radix_tree_node/objs_per_slab create mode 100644 test/sys/kernel/slab/radix_tree_node/order create mode 100644 test/sys/kernel/slab/radix_tree_node/partial create mode 100644 test/sys/kernel/slab/radix_tree_node/poison create mode 100644 test/sys/kernel/slab/radix_tree_node/reclaim_account create mode 100644 test/sys/kernel/slab/radix_tree_node/red_zone create mode 100644 test/sys/kernel/slab/radix_tree_node/sanity_checks create mode 100644 test/sys/kernel/slab/radix_tree_node/shrink create mode 100644 test/sys/kernel/slab/radix_tree_node/slab_size create mode 100644 test/sys/kernel/slab/radix_tree_node/slabs create mode 100644 test/sys/kernel/slab/radix_tree_node/store_user create mode 100644 test/sys/kernel/slab/radix_tree_node/total_objects create mode 100644 test/sys/kernel/slab/radix_tree_node/trace create mode 100644 test/sys/kernel/slab/radix_tree_node/validate create mode 100644 test/sys/kernel/slab/request_sock_TCP/aliases create mode 100644 test/sys/kernel/slab/request_sock_TCP/align create mode 100644 test/sys/kernel/slab/request_sock_TCP/alloc_calls create mode 100644 test/sys/kernel/slab/request_sock_TCP/cache_dma create mode 100644 test/sys/kernel/slab/request_sock_TCP/cpu_slabs create mode 100644 test/sys/kernel/slab/request_sock_TCP/ctor create mode 100644 test/sys/kernel/slab/request_sock_TCP/destroy_by_rcu create mode 100644 test/sys/kernel/slab/request_sock_TCP/free_calls create mode 100644 test/sys/kernel/slab/request_sock_TCP/hwcache_align create mode 100644 test/sys/kernel/slab/request_sock_TCP/object_size create mode 100644 test/sys/kernel/slab/request_sock_TCP/objects create mode 100644 test/sys/kernel/slab/request_sock_TCP/objects_partial create mode 100644 test/sys/kernel/slab/request_sock_TCP/objs_per_slab create mode 100644 test/sys/kernel/slab/request_sock_TCP/order create mode 100644 test/sys/kernel/slab/request_sock_TCP/partial create mode 100644 test/sys/kernel/slab/request_sock_TCP/poison create mode 100644 test/sys/kernel/slab/request_sock_TCP/reclaim_account create mode 100644 test/sys/kernel/slab/request_sock_TCP/red_zone create mode 100644 test/sys/kernel/slab/request_sock_TCP/sanity_checks create mode 100644 test/sys/kernel/slab/request_sock_TCP/shrink create mode 100644 test/sys/kernel/slab/request_sock_TCP/slab_size create mode 100644 test/sys/kernel/slab/request_sock_TCP/slabs create mode 100644 test/sys/kernel/slab/request_sock_TCP/store_user create mode 100644 test/sys/kernel/slab/request_sock_TCP/total_objects create mode 100644 test/sys/kernel/slab/request_sock_TCP/trace create mode 100644 test/sys/kernel/slab/request_sock_TCP/validate create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/aliases create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/align create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/alloc_calls create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/cache_dma create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/ctor create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/destroy_by_rcu create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/free_calls create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/hwcache_align create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/object_size create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/objects create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/objects_partial create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/objs_per_slab create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/order create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/partial create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/poison create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/reclaim_account create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/red_zone create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/sanity_checks create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/shrink create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/slab_size create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/slabs create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/store_user create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/total_objects create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/trace create mode 100644 test/sys/kernel/slab/request_sock_TCPv6/validate create mode 100644 test/sys/kernel/slab/revoke_record/aliases create mode 100644 test/sys/kernel/slab/revoke_record/align create mode 100644 test/sys/kernel/slab/revoke_record/alloc_calls create mode 100644 test/sys/kernel/slab/revoke_record/cache_dma create mode 100644 test/sys/kernel/slab/revoke_record/cpu_slabs create mode 100644 test/sys/kernel/slab/revoke_record/ctor create mode 100644 test/sys/kernel/slab/revoke_record/destroy_by_rcu create mode 100644 test/sys/kernel/slab/revoke_record/free_calls create mode 100644 test/sys/kernel/slab/revoke_record/hwcache_align create mode 100644 test/sys/kernel/slab/revoke_record/object_size create mode 100644 test/sys/kernel/slab/revoke_record/objects create mode 100644 test/sys/kernel/slab/revoke_record/objects_partial create mode 100644 test/sys/kernel/slab/revoke_record/objs_per_slab create mode 100644 test/sys/kernel/slab/revoke_record/order create mode 100644 test/sys/kernel/slab/revoke_record/partial create mode 100644 test/sys/kernel/slab/revoke_record/poison create mode 100644 test/sys/kernel/slab/revoke_record/reclaim_account create mode 100644 test/sys/kernel/slab/revoke_record/red_zone create mode 100644 test/sys/kernel/slab/revoke_record/sanity_checks create mode 100644 test/sys/kernel/slab/revoke_record/shrink create mode 100644 test/sys/kernel/slab/revoke_record/slab_size create mode 100644 test/sys/kernel/slab/revoke_record/slabs create mode 100644 test/sys/kernel/slab/revoke_record/store_user create mode 100644 test/sys/kernel/slab/revoke_record/total_objects create mode 100644 test/sys/kernel/slab/revoke_record/trace create mode 100644 test/sys/kernel/slab/revoke_record/validate create mode 100644 test/sys/kernel/slab/revoke_table/aliases create mode 100644 test/sys/kernel/slab/revoke_table/align create mode 100644 test/sys/kernel/slab/revoke_table/alloc_calls create mode 100644 test/sys/kernel/slab/revoke_table/cache_dma create mode 100644 test/sys/kernel/slab/revoke_table/cpu_slabs create mode 100644 test/sys/kernel/slab/revoke_table/ctor create mode 100644 test/sys/kernel/slab/revoke_table/destroy_by_rcu create mode 100644 test/sys/kernel/slab/revoke_table/free_calls create mode 100644 test/sys/kernel/slab/revoke_table/hwcache_align create mode 100644 test/sys/kernel/slab/revoke_table/object_size create mode 100644 test/sys/kernel/slab/revoke_table/objects create mode 100644 test/sys/kernel/slab/revoke_table/objects_partial create mode 100644 test/sys/kernel/slab/revoke_table/objs_per_slab create mode 100644 test/sys/kernel/slab/revoke_table/order create mode 100644 test/sys/kernel/slab/revoke_table/partial create mode 100644 test/sys/kernel/slab/revoke_table/poison create mode 100644 test/sys/kernel/slab/revoke_table/reclaim_account create mode 100644 test/sys/kernel/slab/revoke_table/red_zone create mode 100644 test/sys/kernel/slab/revoke_table/sanity_checks create mode 100644 test/sys/kernel/slab/revoke_table/shrink create mode 100644 test/sys/kernel/slab/revoke_table/slab_size create mode 100644 test/sys/kernel/slab/revoke_table/slabs create mode 100644 test/sys/kernel/slab/revoke_table/store_user create mode 100644 test/sys/kernel/slab/revoke_table/total_objects create mode 100644 test/sys/kernel/slab/revoke_table/trace create mode 100644 test/sys/kernel/slab/revoke_table/validate create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/aliases create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/align create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/alloc_calls create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/cache_dma create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/ctor create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/free_calls create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/hwcache_align create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/object_size create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/objects create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/objects_partial create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/order create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/partial create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/poison create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/reclaim_account create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/red_zone create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/sanity_checks create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/shrink create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/slab_size create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/slabs create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/store_user create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/total_objects create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/trace create mode 100644 test/sys/kernel/slab/scsi_cmd_cache/validate create mode 100644 test/sys/kernel/slab/scsi_data_buffer/aliases create mode 100644 test/sys/kernel/slab/scsi_data_buffer/align create mode 100644 test/sys/kernel/slab/scsi_data_buffer/alloc_calls create mode 100644 test/sys/kernel/slab/scsi_data_buffer/cache_dma create mode 100644 test/sys/kernel/slab/scsi_data_buffer/cpu_slabs create mode 100644 test/sys/kernel/slab/scsi_data_buffer/ctor create mode 100644 test/sys/kernel/slab/scsi_data_buffer/destroy_by_rcu create mode 100644 test/sys/kernel/slab/scsi_data_buffer/free_calls create mode 100644 test/sys/kernel/slab/scsi_data_buffer/hwcache_align create mode 100644 test/sys/kernel/slab/scsi_data_buffer/object_size create mode 100644 test/sys/kernel/slab/scsi_data_buffer/objects create mode 100644 test/sys/kernel/slab/scsi_data_buffer/objects_partial create mode 100644 test/sys/kernel/slab/scsi_data_buffer/objs_per_slab create mode 100644 test/sys/kernel/slab/scsi_data_buffer/order create mode 100644 test/sys/kernel/slab/scsi_data_buffer/partial create mode 100644 test/sys/kernel/slab/scsi_data_buffer/poison create mode 100644 test/sys/kernel/slab/scsi_data_buffer/reclaim_account create mode 100644 test/sys/kernel/slab/scsi_data_buffer/red_zone create mode 100644 test/sys/kernel/slab/scsi_data_buffer/sanity_checks create mode 100644 test/sys/kernel/slab/scsi_data_buffer/shrink create mode 100644 test/sys/kernel/slab/scsi_data_buffer/slab_size create mode 100644 test/sys/kernel/slab/scsi_data_buffer/slabs create mode 100644 test/sys/kernel/slab/scsi_data_buffer/store_user create mode 100644 test/sys/kernel/slab/scsi_data_buffer/total_objects create mode 100644 test/sys/kernel/slab/scsi_data_buffer/trace create mode 100644 test/sys/kernel/slab/scsi_data_buffer/validate create mode 100644 test/sys/kernel/slab/scsi_io_context/aliases create mode 100644 test/sys/kernel/slab/scsi_io_context/align create mode 100644 test/sys/kernel/slab/scsi_io_context/alloc_calls create mode 100644 test/sys/kernel/slab/scsi_io_context/cache_dma create mode 100644 test/sys/kernel/slab/scsi_io_context/cpu_slabs create mode 100644 test/sys/kernel/slab/scsi_io_context/ctor create mode 100644 test/sys/kernel/slab/scsi_io_context/destroy_by_rcu create mode 100644 test/sys/kernel/slab/scsi_io_context/free_calls create mode 100644 test/sys/kernel/slab/scsi_io_context/hwcache_align create mode 100644 test/sys/kernel/slab/scsi_io_context/object_size create mode 100644 test/sys/kernel/slab/scsi_io_context/objects create mode 100644 test/sys/kernel/slab/scsi_io_context/objects_partial create mode 100644 test/sys/kernel/slab/scsi_io_context/objs_per_slab create mode 100644 test/sys/kernel/slab/scsi_io_context/order create mode 100644 test/sys/kernel/slab/scsi_io_context/partial create mode 100644 test/sys/kernel/slab/scsi_io_context/poison create mode 100644 test/sys/kernel/slab/scsi_io_context/reclaim_account create mode 100644 test/sys/kernel/slab/scsi_io_context/red_zone create mode 100644 test/sys/kernel/slab/scsi_io_context/sanity_checks create mode 100644 test/sys/kernel/slab/scsi_io_context/shrink create mode 100644 test/sys/kernel/slab/scsi_io_context/slab_size create mode 100644 test/sys/kernel/slab/scsi_io_context/slabs create mode 100644 test/sys/kernel/slab/scsi_io_context/store_user create mode 100644 test/sys/kernel/slab/scsi_io_context/total_objects create mode 100644 test/sys/kernel/slab/scsi_io_context/trace create mode 100644 test/sys/kernel/slab/scsi_io_context/validate create mode 100644 test/sys/kernel/slab/scsi_sense_cache/aliases create mode 100644 test/sys/kernel/slab/scsi_sense_cache/align create mode 100644 test/sys/kernel/slab/scsi_sense_cache/alloc_calls create mode 100644 test/sys/kernel/slab/scsi_sense_cache/cache_dma create mode 100644 test/sys/kernel/slab/scsi_sense_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/scsi_sense_cache/ctor create mode 100644 test/sys/kernel/slab/scsi_sense_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/scsi_sense_cache/free_calls create mode 100644 test/sys/kernel/slab/scsi_sense_cache/hwcache_align create mode 100644 test/sys/kernel/slab/scsi_sense_cache/object_size create mode 100644 test/sys/kernel/slab/scsi_sense_cache/objects create mode 100644 test/sys/kernel/slab/scsi_sense_cache/objects_partial create mode 100644 test/sys/kernel/slab/scsi_sense_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/scsi_sense_cache/order create mode 100644 test/sys/kernel/slab/scsi_sense_cache/partial create mode 100644 test/sys/kernel/slab/scsi_sense_cache/poison create mode 100644 test/sys/kernel/slab/scsi_sense_cache/reclaim_account create mode 100644 test/sys/kernel/slab/scsi_sense_cache/red_zone create mode 100644 test/sys/kernel/slab/scsi_sense_cache/sanity_checks create mode 100644 test/sys/kernel/slab/scsi_sense_cache/shrink create mode 100644 test/sys/kernel/slab/scsi_sense_cache/slab_size create mode 100644 test/sys/kernel/slab/scsi_sense_cache/slabs create mode 100644 test/sys/kernel/slab/scsi_sense_cache/store_user create mode 100644 test/sys/kernel/slab/scsi_sense_cache/total_objects create mode 100644 test/sys/kernel/slab/scsi_sense_cache/trace create mode 100644 test/sys/kernel/slab/scsi_sense_cache/validate create mode 100644 test/sys/kernel/slab/secpath_cache/aliases create mode 100644 test/sys/kernel/slab/secpath_cache/align create mode 100644 test/sys/kernel/slab/secpath_cache/alloc_calls create mode 100644 test/sys/kernel/slab/secpath_cache/cache_dma create mode 100644 test/sys/kernel/slab/secpath_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/secpath_cache/ctor create mode 100644 test/sys/kernel/slab/secpath_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/secpath_cache/free_calls create mode 100644 test/sys/kernel/slab/secpath_cache/hwcache_align create mode 100644 test/sys/kernel/slab/secpath_cache/object_size create mode 100644 test/sys/kernel/slab/secpath_cache/objects create mode 100644 test/sys/kernel/slab/secpath_cache/objects_partial create mode 100644 test/sys/kernel/slab/secpath_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/secpath_cache/order create mode 100644 test/sys/kernel/slab/secpath_cache/partial create mode 100644 test/sys/kernel/slab/secpath_cache/poison create mode 100644 test/sys/kernel/slab/secpath_cache/reclaim_account create mode 100644 test/sys/kernel/slab/secpath_cache/red_zone create mode 100644 test/sys/kernel/slab/secpath_cache/sanity_checks create mode 100644 test/sys/kernel/slab/secpath_cache/shrink create mode 100644 test/sys/kernel/slab/secpath_cache/slab_size create mode 100644 test/sys/kernel/slab/secpath_cache/slabs create mode 100644 test/sys/kernel/slab/secpath_cache/store_user create mode 100644 test/sys/kernel/slab/secpath_cache/total_objects create mode 100644 test/sys/kernel/slab/secpath_cache/trace create mode 100644 test/sys/kernel/slab/secpath_cache/validate create mode 100644 test/sys/kernel/slab/sgpool-128/aliases create mode 100644 test/sys/kernel/slab/sgpool-128/align create mode 100644 test/sys/kernel/slab/sgpool-128/alloc_calls create mode 100644 test/sys/kernel/slab/sgpool-128/cache_dma create mode 100644 test/sys/kernel/slab/sgpool-128/cpu_slabs create mode 100644 test/sys/kernel/slab/sgpool-128/ctor create mode 100644 test/sys/kernel/slab/sgpool-128/destroy_by_rcu create mode 100644 test/sys/kernel/slab/sgpool-128/free_calls create mode 100644 test/sys/kernel/slab/sgpool-128/hwcache_align create mode 100644 test/sys/kernel/slab/sgpool-128/object_size create mode 100644 test/sys/kernel/slab/sgpool-128/objects create mode 100644 test/sys/kernel/slab/sgpool-128/objects_partial create mode 100644 test/sys/kernel/slab/sgpool-128/objs_per_slab create mode 100644 test/sys/kernel/slab/sgpool-128/order create mode 100644 test/sys/kernel/slab/sgpool-128/partial create mode 100644 test/sys/kernel/slab/sgpool-128/poison create mode 100644 test/sys/kernel/slab/sgpool-128/reclaim_account create mode 100644 test/sys/kernel/slab/sgpool-128/red_zone create mode 100644 test/sys/kernel/slab/sgpool-128/sanity_checks create mode 100644 test/sys/kernel/slab/sgpool-128/shrink create mode 100644 test/sys/kernel/slab/sgpool-128/slab_size create mode 100644 test/sys/kernel/slab/sgpool-128/slabs create mode 100644 test/sys/kernel/slab/sgpool-128/store_user create mode 100644 test/sys/kernel/slab/sgpool-128/total_objects create mode 100644 test/sys/kernel/slab/sgpool-128/trace create mode 100644 test/sys/kernel/slab/sgpool-128/validate create mode 100644 test/sys/kernel/slab/sgpool-16/aliases create mode 100644 test/sys/kernel/slab/sgpool-16/align create mode 100644 test/sys/kernel/slab/sgpool-16/alloc_calls create mode 100644 test/sys/kernel/slab/sgpool-16/cache_dma create mode 100644 test/sys/kernel/slab/sgpool-16/cpu_slabs create mode 100644 test/sys/kernel/slab/sgpool-16/ctor create mode 100644 test/sys/kernel/slab/sgpool-16/destroy_by_rcu create mode 100644 test/sys/kernel/slab/sgpool-16/free_calls create mode 100644 test/sys/kernel/slab/sgpool-16/hwcache_align create mode 100644 test/sys/kernel/slab/sgpool-16/object_size create mode 100644 test/sys/kernel/slab/sgpool-16/objects create mode 100644 test/sys/kernel/slab/sgpool-16/objects_partial create mode 100644 test/sys/kernel/slab/sgpool-16/objs_per_slab create mode 100644 test/sys/kernel/slab/sgpool-16/order create mode 100644 test/sys/kernel/slab/sgpool-16/partial create mode 100644 test/sys/kernel/slab/sgpool-16/poison create mode 100644 test/sys/kernel/slab/sgpool-16/reclaim_account create mode 100644 test/sys/kernel/slab/sgpool-16/red_zone create mode 100644 test/sys/kernel/slab/sgpool-16/sanity_checks create mode 100644 test/sys/kernel/slab/sgpool-16/shrink create mode 100644 test/sys/kernel/slab/sgpool-16/slab_size create mode 100644 test/sys/kernel/slab/sgpool-16/slabs create mode 100644 test/sys/kernel/slab/sgpool-16/store_user create mode 100644 test/sys/kernel/slab/sgpool-16/total_objects create mode 100644 test/sys/kernel/slab/sgpool-16/trace create mode 100644 test/sys/kernel/slab/sgpool-16/validate create mode 100644 test/sys/kernel/slab/sgpool-32/aliases create mode 100644 test/sys/kernel/slab/sgpool-32/align create mode 100644 test/sys/kernel/slab/sgpool-32/alloc_calls create mode 100644 test/sys/kernel/slab/sgpool-32/cache_dma create mode 100644 test/sys/kernel/slab/sgpool-32/cpu_slabs create mode 100644 test/sys/kernel/slab/sgpool-32/ctor create mode 100644 test/sys/kernel/slab/sgpool-32/destroy_by_rcu create mode 100644 test/sys/kernel/slab/sgpool-32/free_calls create mode 100644 test/sys/kernel/slab/sgpool-32/hwcache_align create mode 100644 test/sys/kernel/slab/sgpool-32/object_size create mode 100644 test/sys/kernel/slab/sgpool-32/objects create mode 100644 test/sys/kernel/slab/sgpool-32/objects_partial create mode 100644 test/sys/kernel/slab/sgpool-32/objs_per_slab create mode 100644 test/sys/kernel/slab/sgpool-32/order create mode 100644 test/sys/kernel/slab/sgpool-32/partial create mode 100644 test/sys/kernel/slab/sgpool-32/poison create mode 100644 test/sys/kernel/slab/sgpool-32/reclaim_account create mode 100644 test/sys/kernel/slab/sgpool-32/red_zone create mode 100644 test/sys/kernel/slab/sgpool-32/sanity_checks create mode 100644 test/sys/kernel/slab/sgpool-32/shrink create mode 100644 test/sys/kernel/slab/sgpool-32/slab_size create mode 100644 test/sys/kernel/slab/sgpool-32/slabs create mode 100644 test/sys/kernel/slab/sgpool-32/store_user create mode 100644 test/sys/kernel/slab/sgpool-32/total_objects create mode 100644 test/sys/kernel/slab/sgpool-32/trace create mode 100644 test/sys/kernel/slab/sgpool-32/validate create mode 100644 test/sys/kernel/slab/sgpool-64/aliases create mode 100644 test/sys/kernel/slab/sgpool-64/align create mode 100644 test/sys/kernel/slab/sgpool-64/alloc_calls create mode 100644 test/sys/kernel/slab/sgpool-64/cache_dma create mode 100644 test/sys/kernel/slab/sgpool-64/cpu_slabs create mode 100644 test/sys/kernel/slab/sgpool-64/ctor create mode 100644 test/sys/kernel/slab/sgpool-64/destroy_by_rcu create mode 100644 test/sys/kernel/slab/sgpool-64/free_calls create mode 100644 test/sys/kernel/slab/sgpool-64/hwcache_align create mode 100644 test/sys/kernel/slab/sgpool-64/object_size create mode 100644 test/sys/kernel/slab/sgpool-64/objects create mode 100644 test/sys/kernel/slab/sgpool-64/objects_partial create mode 100644 test/sys/kernel/slab/sgpool-64/objs_per_slab create mode 100644 test/sys/kernel/slab/sgpool-64/order create mode 100644 test/sys/kernel/slab/sgpool-64/partial create mode 100644 test/sys/kernel/slab/sgpool-64/poison create mode 100644 test/sys/kernel/slab/sgpool-64/reclaim_account create mode 100644 test/sys/kernel/slab/sgpool-64/red_zone create mode 100644 test/sys/kernel/slab/sgpool-64/sanity_checks create mode 100644 test/sys/kernel/slab/sgpool-64/shrink create mode 100644 test/sys/kernel/slab/sgpool-64/slab_size create mode 100644 test/sys/kernel/slab/sgpool-64/slabs create mode 100644 test/sys/kernel/slab/sgpool-64/store_user create mode 100644 test/sys/kernel/slab/sgpool-64/total_objects create mode 100644 test/sys/kernel/slab/sgpool-64/trace create mode 100644 test/sys/kernel/slab/sgpool-64/validate create mode 100644 test/sys/kernel/slab/sgpool-8/aliases create mode 100644 test/sys/kernel/slab/sgpool-8/align create mode 100644 test/sys/kernel/slab/sgpool-8/alloc_calls create mode 100644 test/sys/kernel/slab/sgpool-8/cache_dma create mode 100644 test/sys/kernel/slab/sgpool-8/cpu_slabs create mode 100644 test/sys/kernel/slab/sgpool-8/ctor create mode 100644 test/sys/kernel/slab/sgpool-8/destroy_by_rcu create mode 100644 test/sys/kernel/slab/sgpool-8/free_calls create mode 100644 test/sys/kernel/slab/sgpool-8/hwcache_align create mode 100644 test/sys/kernel/slab/sgpool-8/object_size create mode 100644 test/sys/kernel/slab/sgpool-8/objects create mode 100644 test/sys/kernel/slab/sgpool-8/objects_partial create mode 100644 test/sys/kernel/slab/sgpool-8/objs_per_slab create mode 100644 test/sys/kernel/slab/sgpool-8/order create mode 100644 test/sys/kernel/slab/sgpool-8/partial create mode 100644 test/sys/kernel/slab/sgpool-8/poison create mode 100644 test/sys/kernel/slab/sgpool-8/reclaim_account create mode 100644 test/sys/kernel/slab/sgpool-8/red_zone create mode 100644 test/sys/kernel/slab/sgpool-8/sanity_checks create mode 100644 test/sys/kernel/slab/sgpool-8/shrink create mode 100644 test/sys/kernel/slab/sgpool-8/slab_size create mode 100644 test/sys/kernel/slab/sgpool-8/slabs create mode 100644 test/sys/kernel/slab/sgpool-8/store_user create mode 100644 test/sys/kernel/slab/sgpool-8/total_objects create mode 100644 test/sys/kernel/slab/sgpool-8/trace create mode 100644 test/sys/kernel/slab/sgpool-8/validate create mode 100644 test/sys/kernel/slab/shmem_inode_cache/aliases create mode 100644 test/sys/kernel/slab/shmem_inode_cache/align create mode 100644 test/sys/kernel/slab/shmem_inode_cache/alloc_calls create mode 100644 test/sys/kernel/slab/shmem_inode_cache/cache_dma create mode 100644 test/sys/kernel/slab/shmem_inode_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/shmem_inode_cache/ctor create mode 100644 test/sys/kernel/slab/shmem_inode_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/shmem_inode_cache/free_calls create mode 100644 test/sys/kernel/slab/shmem_inode_cache/hwcache_align create mode 100644 test/sys/kernel/slab/shmem_inode_cache/object_size create mode 100644 test/sys/kernel/slab/shmem_inode_cache/objects create mode 100644 test/sys/kernel/slab/shmem_inode_cache/objects_partial create mode 100644 test/sys/kernel/slab/shmem_inode_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/shmem_inode_cache/order create mode 100644 test/sys/kernel/slab/shmem_inode_cache/partial create mode 100644 test/sys/kernel/slab/shmem_inode_cache/poison create mode 100644 test/sys/kernel/slab/shmem_inode_cache/reclaim_account create mode 100644 test/sys/kernel/slab/shmem_inode_cache/red_zone create mode 100644 test/sys/kernel/slab/shmem_inode_cache/sanity_checks create mode 100644 test/sys/kernel/slab/shmem_inode_cache/shrink create mode 100644 test/sys/kernel/slab/shmem_inode_cache/slab_size create mode 100644 test/sys/kernel/slab/shmem_inode_cache/slabs create mode 100644 test/sys/kernel/slab/shmem_inode_cache/store_user create mode 100644 test/sys/kernel/slab/shmem_inode_cache/total_objects create mode 100644 test/sys/kernel/slab/shmem_inode_cache/trace create mode 100644 test/sys/kernel/slab/shmem_inode_cache/validate create mode 100644 test/sys/kernel/slab/sighand_cache/aliases create mode 100644 test/sys/kernel/slab/sighand_cache/align create mode 100644 test/sys/kernel/slab/sighand_cache/alloc_calls create mode 100644 test/sys/kernel/slab/sighand_cache/cache_dma create mode 100644 test/sys/kernel/slab/sighand_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/sighand_cache/ctor create mode 100644 test/sys/kernel/slab/sighand_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/sighand_cache/free_calls create mode 100644 test/sys/kernel/slab/sighand_cache/hwcache_align create mode 100644 test/sys/kernel/slab/sighand_cache/object_size create mode 100644 test/sys/kernel/slab/sighand_cache/objects create mode 100644 test/sys/kernel/slab/sighand_cache/objects_partial create mode 100644 test/sys/kernel/slab/sighand_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/sighand_cache/order create mode 100644 test/sys/kernel/slab/sighand_cache/partial create mode 100644 test/sys/kernel/slab/sighand_cache/poison create mode 100644 test/sys/kernel/slab/sighand_cache/reclaim_account create mode 100644 test/sys/kernel/slab/sighand_cache/red_zone create mode 100644 test/sys/kernel/slab/sighand_cache/sanity_checks create mode 100644 test/sys/kernel/slab/sighand_cache/shrink create mode 100644 test/sys/kernel/slab/sighand_cache/slab_size create mode 100644 test/sys/kernel/slab/sighand_cache/slabs create mode 100644 test/sys/kernel/slab/sighand_cache/store_user create mode 100644 test/sys/kernel/slab/sighand_cache/total_objects create mode 100644 test/sys/kernel/slab/sighand_cache/trace create mode 100644 test/sys/kernel/slab/sighand_cache/validate create mode 100644 test/sys/kernel/slab/signal_cache/aliases create mode 100644 test/sys/kernel/slab/signal_cache/align create mode 100644 test/sys/kernel/slab/signal_cache/alloc_calls create mode 100644 test/sys/kernel/slab/signal_cache/cache_dma create mode 100644 test/sys/kernel/slab/signal_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/signal_cache/ctor create mode 100644 test/sys/kernel/slab/signal_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/signal_cache/free_calls create mode 100644 test/sys/kernel/slab/signal_cache/hwcache_align create mode 100644 test/sys/kernel/slab/signal_cache/object_size create mode 100644 test/sys/kernel/slab/signal_cache/objects create mode 100644 test/sys/kernel/slab/signal_cache/objects_partial create mode 100644 test/sys/kernel/slab/signal_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/signal_cache/order create mode 100644 test/sys/kernel/slab/signal_cache/partial create mode 100644 test/sys/kernel/slab/signal_cache/poison create mode 100644 test/sys/kernel/slab/signal_cache/reclaim_account create mode 100644 test/sys/kernel/slab/signal_cache/red_zone create mode 100644 test/sys/kernel/slab/signal_cache/sanity_checks create mode 100644 test/sys/kernel/slab/signal_cache/shrink create mode 100644 test/sys/kernel/slab/signal_cache/slab_size create mode 100644 test/sys/kernel/slab/signal_cache/slabs create mode 100644 test/sys/kernel/slab/signal_cache/store_user create mode 100644 test/sys/kernel/slab/signal_cache/total_objects create mode 100644 test/sys/kernel/slab/signal_cache/trace create mode 100644 test/sys/kernel/slab/signal_cache/validate create mode 100644 test/sys/kernel/slab/sigqueue/aliases create mode 100644 test/sys/kernel/slab/sigqueue/align create mode 100644 test/sys/kernel/slab/sigqueue/alloc_calls create mode 100644 test/sys/kernel/slab/sigqueue/cache_dma create mode 100644 test/sys/kernel/slab/sigqueue/cpu_slabs create mode 100644 test/sys/kernel/slab/sigqueue/ctor create mode 100644 test/sys/kernel/slab/sigqueue/destroy_by_rcu create mode 100644 test/sys/kernel/slab/sigqueue/free_calls create mode 100644 test/sys/kernel/slab/sigqueue/hwcache_align create mode 100644 test/sys/kernel/slab/sigqueue/object_size create mode 100644 test/sys/kernel/slab/sigqueue/objects create mode 100644 test/sys/kernel/slab/sigqueue/objects_partial create mode 100644 test/sys/kernel/slab/sigqueue/objs_per_slab create mode 100644 test/sys/kernel/slab/sigqueue/order create mode 100644 test/sys/kernel/slab/sigqueue/partial create mode 100644 test/sys/kernel/slab/sigqueue/poison create mode 100644 test/sys/kernel/slab/sigqueue/reclaim_account create mode 100644 test/sys/kernel/slab/sigqueue/red_zone create mode 100644 test/sys/kernel/slab/sigqueue/sanity_checks create mode 100644 test/sys/kernel/slab/sigqueue/shrink create mode 100644 test/sys/kernel/slab/sigqueue/slab_size create mode 100644 test/sys/kernel/slab/sigqueue/slabs create mode 100644 test/sys/kernel/slab/sigqueue/store_user create mode 100644 test/sys/kernel/slab/sigqueue/total_objects create mode 100644 test/sys/kernel/slab/sigqueue/trace create mode 100644 test/sys/kernel/slab/sigqueue/validate create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/aliases create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/align create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/alloc_calls create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/cache_dma create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/ctor create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/free_calls create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/hwcache_align create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/object_size create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/objects create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/objects_partial create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/order create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/partial create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/poison create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/reclaim_account create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/red_zone create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/sanity_checks create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/shrink create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/slab_size create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/slabs create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/store_user create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/total_objects create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/trace create mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/validate create mode 100644 test/sys/kernel/slab/skbuff_head_cache/aliases create mode 100644 test/sys/kernel/slab/skbuff_head_cache/align create mode 100644 test/sys/kernel/slab/skbuff_head_cache/alloc_calls create mode 100644 test/sys/kernel/slab/skbuff_head_cache/cache_dma create mode 100644 test/sys/kernel/slab/skbuff_head_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/skbuff_head_cache/ctor create mode 100644 test/sys/kernel/slab/skbuff_head_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/skbuff_head_cache/free_calls create mode 100644 test/sys/kernel/slab/skbuff_head_cache/hwcache_align create mode 100644 test/sys/kernel/slab/skbuff_head_cache/object_size create mode 100644 test/sys/kernel/slab/skbuff_head_cache/objects create mode 100644 test/sys/kernel/slab/skbuff_head_cache/objects_partial create mode 100644 test/sys/kernel/slab/skbuff_head_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/skbuff_head_cache/order create mode 100644 test/sys/kernel/slab/skbuff_head_cache/partial create mode 100644 test/sys/kernel/slab/skbuff_head_cache/poison create mode 100644 test/sys/kernel/slab/skbuff_head_cache/reclaim_account create mode 100644 test/sys/kernel/slab/skbuff_head_cache/red_zone create mode 100644 test/sys/kernel/slab/skbuff_head_cache/sanity_checks create mode 100644 test/sys/kernel/slab/skbuff_head_cache/shrink create mode 100644 test/sys/kernel/slab/skbuff_head_cache/slab_size create mode 100644 test/sys/kernel/slab/skbuff_head_cache/slabs create mode 100644 test/sys/kernel/slab/skbuff_head_cache/store_user create mode 100644 test/sys/kernel/slab/skbuff_head_cache/total_objects create mode 100644 test/sys/kernel/slab/skbuff_head_cache/trace create mode 100644 test/sys/kernel/slab/skbuff_head_cache/validate create mode 100644 test/sys/kernel/slab/sock_inode_cache/aliases create mode 100644 test/sys/kernel/slab/sock_inode_cache/align create mode 100644 test/sys/kernel/slab/sock_inode_cache/alloc_calls create mode 100644 test/sys/kernel/slab/sock_inode_cache/cache_dma create mode 100644 test/sys/kernel/slab/sock_inode_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/sock_inode_cache/ctor create mode 100644 test/sys/kernel/slab/sock_inode_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/sock_inode_cache/free_calls create mode 100644 test/sys/kernel/slab/sock_inode_cache/hwcache_align create mode 100644 test/sys/kernel/slab/sock_inode_cache/object_size create mode 100644 test/sys/kernel/slab/sock_inode_cache/objects create mode 100644 test/sys/kernel/slab/sock_inode_cache/objects_partial create mode 100644 test/sys/kernel/slab/sock_inode_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/sock_inode_cache/order create mode 100644 test/sys/kernel/slab/sock_inode_cache/partial create mode 100644 test/sys/kernel/slab/sock_inode_cache/poison create mode 100644 test/sys/kernel/slab/sock_inode_cache/reclaim_account create mode 100644 test/sys/kernel/slab/sock_inode_cache/red_zone create mode 100644 test/sys/kernel/slab/sock_inode_cache/sanity_checks create mode 100644 test/sys/kernel/slab/sock_inode_cache/shrink create mode 100644 test/sys/kernel/slab/sock_inode_cache/slab_size create mode 100644 test/sys/kernel/slab/sock_inode_cache/slabs create mode 100644 test/sys/kernel/slab/sock_inode_cache/store_user create mode 100644 test/sys/kernel/slab/sock_inode_cache/total_objects create mode 100644 test/sys/kernel/slab/sock_inode_cache/trace create mode 100644 test/sys/kernel/slab/sock_inode_cache/validate create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/aliases create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/align create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/alloc_calls create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/cache_dma create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/ctor create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/free_calls create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/hwcache_align create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/object_size create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/objects create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/objects_partial create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/order create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/partial create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/poison create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/reclaim_account create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/red_zone create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/sanity_checks create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/shrink create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/slab_size create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/slabs create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/store_user create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/total_objects create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/trace create mode 100644 test/sys/kernel/slab/sysfs_dir_cache/validate create mode 100644 test/sys/kernel/slab/task_struct/aliases create mode 100644 test/sys/kernel/slab/task_struct/align create mode 100644 test/sys/kernel/slab/task_struct/alloc_calls create mode 100644 test/sys/kernel/slab/task_struct/cache_dma create mode 100644 test/sys/kernel/slab/task_struct/cpu_slabs create mode 100644 test/sys/kernel/slab/task_struct/ctor create mode 100644 test/sys/kernel/slab/task_struct/destroy_by_rcu create mode 100644 test/sys/kernel/slab/task_struct/free_calls create mode 100644 test/sys/kernel/slab/task_struct/hwcache_align create mode 100644 test/sys/kernel/slab/task_struct/object_size create mode 100644 test/sys/kernel/slab/task_struct/objects create mode 100644 test/sys/kernel/slab/task_struct/objects_partial create mode 100644 test/sys/kernel/slab/task_struct/objs_per_slab create mode 100644 test/sys/kernel/slab/task_struct/order create mode 100644 test/sys/kernel/slab/task_struct/partial create mode 100644 test/sys/kernel/slab/task_struct/poison create mode 100644 test/sys/kernel/slab/task_struct/reclaim_account create mode 100644 test/sys/kernel/slab/task_struct/red_zone create mode 100644 test/sys/kernel/slab/task_struct/sanity_checks create mode 100644 test/sys/kernel/slab/task_struct/shrink create mode 100644 test/sys/kernel/slab/task_struct/slab_size create mode 100644 test/sys/kernel/slab/task_struct/slabs create mode 100644 test/sys/kernel/slab/task_struct/store_user create mode 100644 test/sys/kernel/slab/task_struct/total_objects create mode 100644 test/sys/kernel/slab/task_struct/trace create mode 100644 test/sys/kernel/slab/task_struct/validate create mode 100644 test/sys/kernel/slab/task_xstate/aliases create mode 100644 test/sys/kernel/slab/task_xstate/align create mode 100644 test/sys/kernel/slab/task_xstate/alloc_calls create mode 100644 test/sys/kernel/slab/task_xstate/cache_dma create mode 100644 test/sys/kernel/slab/task_xstate/cpu_slabs create mode 100644 test/sys/kernel/slab/task_xstate/ctor create mode 100644 test/sys/kernel/slab/task_xstate/destroy_by_rcu create mode 100644 test/sys/kernel/slab/task_xstate/free_calls create mode 100644 test/sys/kernel/slab/task_xstate/hwcache_align create mode 100644 test/sys/kernel/slab/task_xstate/object_size create mode 100644 test/sys/kernel/slab/task_xstate/objects create mode 100644 test/sys/kernel/slab/task_xstate/objects_partial create mode 100644 test/sys/kernel/slab/task_xstate/objs_per_slab create mode 100644 test/sys/kernel/slab/task_xstate/order create mode 100644 test/sys/kernel/slab/task_xstate/partial create mode 100644 test/sys/kernel/slab/task_xstate/poison create mode 100644 test/sys/kernel/slab/task_xstate/reclaim_account create mode 100644 test/sys/kernel/slab/task_xstate/red_zone create mode 100644 test/sys/kernel/slab/task_xstate/sanity_checks create mode 100644 test/sys/kernel/slab/task_xstate/shrink create mode 100644 test/sys/kernel/slab/task_xstate/slab_size create mode 100644 test/sys/kernel/slab/task_xstate/slabs create mode 100644 test/sys/kernel/slab/task_xstate/store_user create mode 100644 test/sys/kernel/slab/task_xstate/total_objects create mode 100644 test/sys/kernel/slab/task_xstate/trace create mode 100644 test/sys/kernel/slab/task_xstate/validate create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/aliases create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/align create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/alloc_calls create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/cache_dma create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/ctor create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/free_calls create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/hwcache_align create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/object_size create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/objects create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/objects_partial create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/order create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/partial create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/poison create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/reclaim_account create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/red_zone create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/sanity_checks create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/shrink create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/slab_size create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/slabs create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/store_user create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/total_objects create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/trace create mode 100644 test/sys/kernel/slab/tcp_bind_bucket/validate create mode 100644 test/sys/kernel/slab/tw_sock_TCP/aliases create mode 100644 test/sys/kernel/slab/tw_sock_TCP/align create mode 100644 test/sys/kernel/slab/tw_sock_TCP/alloc_calls create mode 100644 test/sys/kernel/slab/tw_sock_TCP/cache_dma create mode 100644 test/sys/kernel/slab/tw_sock_TCP/cpu_slabs create mode 100644 test/sys/kernel/slab/tw_sock_TCP/ctor create mode 100644 test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu create mode 100644 test/sys/kernel/slab/tw_sock_TCP/free_calls create mode 100644 test/sys/kernel/slab/tw_sock_TCP/hwcache_align create mode 100644 test/sys/kernel/slab/tw_sock_TCP/object_size create mode 100644 test/sys/kernel/slab/tw_sock_TCP/objects create mode 100644 test/sys/kernel/slab/tw_sock_TCP/objects_partial create mode 100644 test/sys/kernel/slab/tw_sock_TCP/objs_per_slab create mode 100644 test/sys/kernel/slab/tw_sock_TCP/order create mode 100644 test/sys/kernel/slab/tw_sock_TCP/partial create mode 100644 test/sys/kernel/slab/tw_sock_TCP/poison create mode 100644 test/sys/kernel/slab/tw_sock_TCP/reclaim_account create mode 100644 test/sys/kernel/slab/tw_sock_TCP/red_zone create mode 100644 test/sys/kernel/slab/tw_sock_TCP/sanity_checks create mode 100644 test/sys/kernel/slab/tw_sock_TCP/shrink create mode 100644 test/sys/kernel/slab/tw_sock_TCP/slab_size create mode 100644 test/sys/kernel/slab/tw_sock_TCP/slabs create mode 100644 test/sys/kernel/slab/tw_sock_TCP/store_user create mode 100644 test/sys/kernel/slab/tw_sock_TCP/total_objects create mode 100644 test/sys/kernel/slab/tw_sock_TCP/trace create mode 100644 test/sys/kernel/slab/tw_sock_TCP/validate create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/aliases create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/align create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/cache_dma create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/ctor create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/free_calls create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/object_size create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/objects create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/objects_partial create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/order create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/partial create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/poison create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/red_zone create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/shrink create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/slab_size create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/slabs create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/store_user create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/total_objects create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/trace create mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/validate create mode 100644 test/sys/kernel/slab/uhci_urb_priv/aliases create mode 100644 test/sys/kernel/slab/uhci_urb_priv/align create mode 100644 test/sys/kernel/slab/uhci_urb_priv/alloc_calls create mode 100644 test/sys/kernel/slab/uhci_urb_priv/cache_dma create mode 100644 test/sys/kernel/slab/uhci_urb_priv/cpu_slabs create mode 100644 test/sys/kernel/slab/uhci_urb_priv/ctor create mode 100644 test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu create mode 100644 test/sys/kernel/slab/uhci_urb_priv/free_calls create mode 100644 test/sys/kernel/slab/uhci_urb_priv/hwcache_align create mode 100644 test/sys/kernel/slab/uhci_urb_priv/object_size create mode 100644 test/sys/kernel/slab/uhci_urb_priv/objects create mode 100644 test/sys/kernel/slab/uhci_urb_priv/objects_partial create mode 100644 test/sys/kernel/slab/uhci_urb_priv/objs_per_slab create mode 100644 test/sys/kernel/slab/uhci_urb_priv/order create mode 100644 test/sys/kernel/slab/uhci_urb_priv/partial create mode 100644 test/sys/kernel/slab/uhci_urb_priv/poison create mode 100644 test/sys/kernel/slab/uhci_urb_priv/reclaim_account create mode 100644 test/sys/kernel/slab/uhci_urb_priv/red_zone create mode 100644 test/sys/kernel/slab/uhci_urb_priv/sanity_checks create mode 100644 test/sys/kernel/slab/uhci_urb_priv/shrink create mode 100644 test/sys/kernel/slab/uhci_urb_priv/slab_size create mode 100644 test/sys/kernel/slab/uhci_urb_priv/slabs create mode 100644 test/sys/kernel/slab/uhci_urb_priv/store_user create mode 100644 test/sys/kernel/slab/uhci_urb_priv/total_objects create mode 100644 test/sys/kernel/slab/uhci_urb_priv/trace create mode 100644 test/sys/kernel/slab/uhci_urb_priv/validate create mode 100644 test/sys/kernel/slab/uid_cache/aliases create mode 100644 test/sys/kernel/slab/uid_cache/align create mode 100644 test/sys/kernel/slab/uid_cache/alloc_calls create mode 100644 test/sys/kernel/slab/uid_cache/cache_dma create mode 100644 test/sys/kernel/slab/uid_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/uid_cache/ctor create mode 100644 test/sys/kernel/slab/uid_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/uid_cache/free_calls create mode 100644 test/sys/kernel/slab/uid_cache/hwcache_align create mode 100644 test/sys/kernel/slab/uid_cache/object_size create mode 100644 test/sys/kernel/slab/uid_cache/objects create mode 100644 test/sys/kernel/slab/uid_cache/objects_partial create mode 100644 test/sys/kernel/slab/uid_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/uid_cache/order create mode 100644 test/sys/kernel/slab/uid_cache/partial create mode 100644 test/sys/kernel/slab/uid_cache/poison create mode 100644 test/sys/kernel/slab/uid_cache/reclaim_account create mode 100644 test/sys/kernel/slab/uid_cache/red_zone create mode 100644 test/sys/kernel/slab/uid_cache/sanity_checks create mode 100644 test/sys/kernel/slab/uid_cache/shrink create mode 100644 test/sys/kernel/slab/uid_cache/slab_size create mode 100644 test/sys/kernel/slab/uid_cache/slabs create mode 100644 test/sys/kernel/slab/uid_cache/store_user create mode 100644 test/sys/kernel/slab/uid_cache/total_objects create mode 100644 test/sys/kernel/slab/uid_cache/trace create mode 100644 test/sys/kernel/slab/uid_cache/validate create mode 100644 test/sys/kernel/slab/vm_area_struct/aliases create mode 100644 test/sys/kernel/slab/vm_area_struct/align create mode 100644 test/sys/kernel/slab/vm_area_struct/alloc_calls create mode 100644 test/sys/kernel/slab/vm_area_struct/cache_dma create mode 100644 test/sys/kernel/slab/vm_area_struct/cpu_slabs create mode 100644 test/sys/kernel/slab/vm_area_struct/ctor create mode 100644 test/sys/kernel/slab/vm_area_struct/destroy_by_rcu create mode 100644 test/sys/kernel/slab/vm_area_struct/free_calls create mode 100644 test/sys/kernel/slab/vm_area_struct/hwcache_align create mode 100644 test/sys/kernel/slab/vm_area_struct/object_size create mode 100644 test/sys/kernel/slab/vm_area_struct/objects create mode 100644 test/sys/kernel/slab/vm_area_struct/objects_partial create mode 100644 test/sys/kernel/slab/vm_area_struct/objs_per_slab create mode 100644 test/sys/kernel/slab/vm_area_struct/order create mode 100644 test/sys/kernel/slab/vm_area_struct/partial create mode 100644 test/sys/kernel/slab/vm_area_struct/poison create mode 100644 test/sys/kernel/slab/vm_area_struct/reclaim_account create mode 100644 test/sys/kernel/slab/vm_area_struct/red_zone create mode 100644 test/sys/kernel/slab/vm_area_struct/sanity_checks create mode 100644 test/sys/kernel/slab/vm_area_struct/shrink create mode 100644 test/sys/kernel/slab/vm_area_struct/slab_size create mode 100644 test/sys/kernel/slab/vm_area_struct/slabs create mode 100644 test/sys/kernel/slab/vm_area_struct/store_user create mode 100644 test/sys/kernel/slab/vm_area_struct/total_objects create mode 100644 test/sys/kernel/slab/vm_area_struct/trace create mode 100644 test/sys/kernel/slab/vm_area_struct/validate create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/aliases create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/align create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/alloc_calls create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/cache_dma create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/ctor create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/free_calls create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/hwcache_align create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/object_size create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/objects create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/objects_partial create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/order create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/partial create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/poison create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/reclaim_account create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/red_zone create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/sanity_checks create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/shrink create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/slab_size create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/slabs create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/store_user create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/total_objects create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/trace create mode 100644 test/sys/kernel/slab/xfrm_dst_cache/validate create mode 100644 test/sys/kernel/uevent_helper create mode 100644 test/sys/kernel/uevent_seqnum create mode 100644 test/sys/kernel/uids/0/cpu_share create mode 100644 test/sys/kernel/uids/100/cpu_share create mode 100644 test/sys/kernel/uids/103/cpu_share create mode 100644 test/sys/kernel/uids/105/cpu_share create mode 100644 test/sys/kernel/uids/2702/cpu_share create mode 100644 test/sys/kernel/uids/51/cpu_share create mode 100644 test/sys/kernel/vmcoreinfo create mode 100644 test/sys/module/8250/parameters/nr_uarts create mode 100644 test/sys/module/8250/parameters/share_irqs create mode 100644 test/sys/module/ac/initstate create mode 100644 test/sys/module/ac/notes/.note.gnu.build-id create mode 100644 test/sys/module/ac/refcnt create mode 100644 test/sys/module/ac/sections/.bss create mode 100644 test/sys/module/ac/sections/.data create mode 100644 test/sys/module/ac/sections/.exit.text create mode 100644 test/sys/module/ac/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/ac/sections/.init.text create mode 100644 test/sys/module/ac/sections/.note.gnu.build-id create mode 100644 test/sys/module/ac/sections/.rodata create mode 100644 test/sys/module/ac/sections/.rodata.str1.1 create mode 100644 test/sys/module/ac/sections/.strtab create mode 100644 test/sys/module/ac/sections/.symtab create mode 100644 test/sys/module/ac/sections/.text create mode 100644 test/sys/module/ac/srcversion create mode 100644 test/sys/module/acpi/parameters/acpica_version create mode 100644 test/sys/module/acpi_cpufreq/initstate create mode 100644 test/sys/module/acpi_cpufreq/notes/.note.gnu.build-id create mode 100644 test/sys/module/acpi_cpufreq/parameters/acpi_pstate_strict create mode 100644 test/sys/module/acpi_cpufreq/refcnt create mode 100644 test/sys/module/acpi_cpufreq/sections/.bss create mode 100644 test/sys/module/acpi_cpufreq/sections/.data create mode 100644 test/sys/module/acpi_cpufreq/sections/.exit.text create mode 100644 test/sys/module/acpi_cpufreq/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/acpi_cpufreq/sections/.init.text create mode 100644 test/sys/module/acpi_cpufreq/sections/.note.gnu.build-id create mode 100644 test/sys/module/acpi_cpufreq/sections/.rodata create mode 100644 test/sys/module/acpi_cpufreq/sections/.rodata.str1.1 create mode 100644 test/sys/module/acpi_cpufreq/sections/.smp_locks create mode 100644 test/sys/module/acpi_cpufreq/sections/.strtab create mode 100644 test/sys/module/acpi_cpufreq/sections/.symtab create mode 100644 test/sys/module/acpi_cpufreq/sections/.text create mode 100644 test/sys/module/acpi_cpufreq/sections/__param create mode 100644 test/sys/module/acpi_cpufreq/srcversion create mode 120000 test/sys/module/aes_generic/holders/aes_x86_64 create mode 100644 test/sys/module/aes_generic/initstate create mode 100644 test/sys/module/aes_generic/notes/.note.gnu.build-id create mode 100644 test/sys/module/aes_generic/refcnt create mode 100644 test/sys/module/aes_generic/sections/.bss create mode 100644 test/sys/module/aes_generic/sections/.data create mode 100644 test/sys/module/aes_generic/sections/.exit.text create mode 100644 test/sys/module/aes_generic/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/aes_generic/sections/.init.data create mode 100644 test/sys/module/aes_generic/sections/.init.text create mode 100644 test/sys/module/aes_generic/sections/.note.gnu.build-id create mode 100644 test/sys/module/aes_generic/sections/.strtab create mode 100644 test/sys/module/aes_generic/sections/.symtab create mode 100644 test/sys/module/aes_generic/sections/.text create mode 100644 test/sys/module/aes_generic/sections/__kcrctab_gpl create mode 100644 test/sys/module/aes_generic/sections/__ksymtab_gpl create mode 100644 test/sys/module/aes_generic/sections/__ksymtab_strings create mode 100644 test/sys/module/aes_generic/srcversion create mode 100644 test/sys/module/aes_x86_64/initstate create mode 100644 test/sys/module/aes_x86_64/notes/.note.gnu.build-id create mode 100644 test/sys/module/aes_x86_64/refcnt create mode 100644 test/sys/module/aes_x86_64/sections/.bss create mode 100644 test/sys/module/aes_x86_64/sections/.data create mode 100644 test/sys/module/aes_x86_64/sections/.exit.text create mode 100644 test/sys/module/aes_x86_64/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/aes_x86_64/sections/.init.text create mode 100644 test/sys/module/aes_x86_64/sections/.note.gnu.build-id create mode 100644 test/sys/module/aes_x86_64/sections/.strtab create mode 100644 test/sys/module/aes_x86_64/sections/.symtab create mode 100644 test/sys/module/aes_x86_64/sections/.text create mode 100644 test/sys/module/aes_x86_64/srcversion create mode 120000 test/sys/module/ahci/drivers/pci:ahci create mode 100644 test/sys/module/ahci/parameters/ahci_em_messages create mode 100644 test/sys/module/ahci/parameters/marvell_enable create mode 100644 test/sys/module/ahci/parameters/skip_host_reset create mode 100644 test/sys/module/arc4/initstate create mode 100644 test/sys/module/arc4/notes/.note.gnu.build-id create mode 100644 test/sys/module/arc4/refcnt create mode 100644 test/sys/module/arc4/sections/.bss create mode 100644 test/sys/module/arc4/sections/.data create mode 100644 test/sys/module/arc4/sections/.exit.text create mode 100644 test/sys/module/arc4/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/arc4/sections/.init.text create mode 100644 test/sys/module/arc4/sections/.note.gnu.build-id create mode 100644 test/sys/module/arc4/sections/.strtab create mode 100644 test/sys/module/arc4/sections/.symtab create mode 100644 test/sys/module/arc4/sections/.text create mode 100644 test/sys/module/arc4/srcversion create mode 120000 test/sys/module/atkbd/drivers/serio:atkbd create mode 120000 test/sys/module/backlight/holders/thinkpad_acpi create mode 100644 test/sys/module/backlight/initstate create mode 100644 test/sys/module/backlight/notes/.note.gnu.build-id create mode 100644 test/sys/module/backlight/refcnt create mode 100644 test/sys/module/backlight/sections/.bss create mode 100644 test/sys/module/backlight/sections/.data create mode 100644 test/sys/module/backlight/sections/.exit.text create mode 100644 test/sys/module/backlight/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/backlight/sections/.init.text create mode 100644 test/sys/module/backlight/sections/.note.gnu.build-id create mode 100644 test/sys/module/backlight/sections/.rodata.str1.1 create mode 100644 test/sys/module/backlight/sections/.strtab create mode 100644 test/sys/module/backlight/sections/.symtab create mode 100644 test/sys/module/backlight/sections/.text create mode 100644 test/sys/module/backlight/sections/__kcrctab create mode 100644 test/sys/module/backlight/sections/__ksymtab create mode 100644 test/sys/module/backlight/sections/__ksymtab_strings create mode 100644 test/sys/module/backlight/srcversion create mode 100644 test/sys/module/battery/initstate create mode 100644 test/sys/module/battery/notes/.note.gnu.build-id create mode 100644 test/sys/module/battery/parameters/cache_time create mode 100644 test/sys/module/battery/refcnt create mode 100644 test/sys/module/battery/sections/.bss create mode 100644 test/sys/module/battery/sections/.data create mode 100644 test/sys/module/battery/sections/.exit.text create mode 100644 test/sys/module/battery/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/battery/sections/.init.text create mode 100644 test/sys/module/battery/sections/.note.gnu.build-id create mode 100644 test/sys/module/battery/sections/.rodata create mode 100644 test/sys/module/battery/sections/.rodata.str1.1 create mode 100644 test/sys/module/battery/sections/.strtab create mode 100644 test/sys/module/battery/sections/.symtab create mode 100644 test/sys/module/battery/sections/.text create mode 100644 test/sys/module/battery/sections/__param create mode 100644 test/sys/module/battery/srcversion create mode 100644 test/sys/module/button/initstate create mode 100644 test/sys/module/button/notes/.note.gnu.build-id create mode 100644 test/sys/module/button/refcnt create mode 100644 test/sys/module/button/sections/.bss create mode 100644 test/sys/module/button/sections/.data create mode 100644 test/sys/module/button/sections/.exit.text create mode 100644 test/sys/module/button/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/button/sections/.init.text create mode 100644 test/sys/module/button/sections/.note.gnu.build-id create mode 100644 test/sys/module/button/sections/.rodata create mode 100644 test/sys/module/button/sections/.rodata.str1.1 create mode 100644 test/sys/module/button/sections/.smp_locks create mode 100644 test/sys/module/button/sections/.strtab create mode 100644 test/sys/module/button/sections/.symtab create mode 100644 test/sys/module/button/sections/.text create mode 100644 test/sys/module/button/srcversion create mode 120000 test/sys/module/cdc_acm/drivers/usb:cdc_acm create mode 100644 test/sys/module/cdc_acm/initstate create mode 100644 test/sys/module/cdc_acm/notes/.note.gnu.build-id create mode 100644 test/sys/module/cdc_acm/refcnt create mode 100644 test/sys/module/cdc_acm/sections/.bss create mode 100644 test/sys/module/cdc_acm/sections/.data create mode 100644 test/sys/module/cdc_acm/sections/.exit.text create mode 100644 test/sys/module/cdc_acm/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/cdc_acm/sections/.init.text create mode 100644 test/sys/module/cdc_acm/sections/.note.gnu.build-id create mode 100644 test/sys/module/cdc_acm/sections/.rodata create mode 100644 test/sys/module/cdc_acm/sections/.rodata.str1.1 create mode 100644 test/sys/module/cdc_acm/sections/.smp_locks create mode 100644 test/sys/module/cdc_acm/sections/.strtab create mode 100644 test/sys/module/cdc_acm/sections/.symtab create mode 100644 test/sys/module/cdc_acm/sections/.text create mode 100644 test/sys/module/cdc_acm/srcversion create mode 120000 test/sys/module/cdrom/holders/sr_mod create mode 100644 test/sys/module/cdrom/initstate create mode 100644 test/sys/module/cdrom/notes/.note.gnu.build-id create mode 100644 test/sys/module/cdrom/refcnt create mode 100644 test/sys/module/cdrom/sections/.bss create mode 100644 test/sys/module/cdrom/sections/.data create mode 100644 test/sys/module/cdrom/sections/.exit.text create mode 100644 test/sys/module/cdrom/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/cdrom/sections/.init.text create mode 100644 test/sys/module/cdrom/sections/.note.gnu.build-id create mode 100644 test/sys/module/cdrom/sections/.rodata create mode 100644 test/sys/module/cdrom/sections/.rodata.str1.1 create mode 100644 test/sys/module/cdrom/sections/.strtab create mode 100644 test/sys/module/cdrom/sections/.symtab create mode 100644 test/sys/module/cdrom/sections/.text create mode 100644 test/sys/module/cdrom/sections/__kcrctab create mode 100644 test/sys/module/cdrom/sections/__ksymtab create mode 100644 test/sys/module/cdrom/sections/__ksymtab_strings create mode 100644 test/sys/module/cdrom/sections/__param create mode 100644 test/sys/module/cdrom/srcversion create mode 120000 test/sys/module/cfg80211/holders/iwl3945 create mode 120000 test/sys/module/cfg80211/holders/mac80211 create mode 100644 test/sys/module/cfg80211/initstate create mode 100644 test/sys/module/cfg80211/notes/.note.gnu.build-id create mode 100644 test/sys/module/cfg80211/parameters/ieee80211_regdom create mode 100644 test/sys/module/cfg80211/refcnt create mode 100644 test/sys/module/cfg80211/sections/.bss create mode 100644 test/sys/module/cfg80211/sections/.data create mode 100644 test/sys/module/cfg80211/sections/.data.read_mostly create mode 100644 test/sys/module/cfg80211/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/cfg80211/sections/.note.gnu.build-id create mode 100644 test/sys/module/cfg80211/sections/.rodata create mode 100644 test/sys/module/cfg80211/sections/.rodata.str1.1 create mode 100644 test/sys/module/cfg80211/sections/.smp_locks create mode 100644 test/sys/module/cfg80211/sections/.strtab create mode 100644 test/sys/module/cfg80211/sections/.symtab create mode 100644 test/sys/module/cfg80211/sections/.text create mode 100644 test/sys/module/cfg80211/sections/__bug_table create mode 100644 test/sys/module/cfg80211/sections/__kcrctab create mode 100644 test/sys/module/cfg80211/sections/__ksymtab create mode 100644 test/sys/module/cfg80211/sections/__ksymtab_strings create mode 100644 test/sys/module/cfg80211/sections/__param create mode 100644 test/sys/module/cfg80211/srcversion create mode 120000 test/sys/module/crypto_blkcipher/holders/ecb create mode 100644 test/sys/module/crypto_blkcipher/initstate create mode 100644 test/sys/module/crypto_blkcipher/notes/.note.gnu.build-id create mode 100644 test/sys/module/crypto_blkcipher/refcnt create mode 100644 test/sys/module/crypto_blkcipher/sections/.bss create mode 100644 test/sys/module/crypto_blkcipher/sections/.data create mode 100644 test/sys/module/crypto_blkcipher/sections/.exit.text create mode 100644 test/sys/module/crypto_blkcipher/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/crypto_blkcipher/sections/.init.text create mode 100644 test/sys/module/crypto_blkcipher/sections/.note.gnu.build-id create mode 100644 test/sys/module/crypto_blkcipher/sections/.rodata create mode 100644 test/sys/module/crypto_blkcipher/sections/.rodata.str1.1 create mode 100644 test/sys/module/crypto_blkcipher/sections/.smp_locks create mode 100644 test/sys/module/crypto_blkcipher/sections/.strtab create mode 100644 test/sys/module/crypto_blkcipher/sections/.symtab create mode 100644 test/sys/module/crypto_blkcipher/sections/.text create mode 100644 test/sys/module/crypto_blkcipher/sections/__bug_table create mode 100644 test/sys/module/crypto_blkcipher/sections/__kcrctab_gpl create mode 100644 test/sys/module/crypto_blkcipher/sections/__ksymtab_gpl create mode 100644 test/sys/module/crypto_blkcipher/sections/__ksymtab_strings create mode 100644 test/sys/module/crypto_blkcipher/srcversion create mode 100644 test/sys/module/dm_mod/initstate create mode 100644 test/sys/module/dm_mod/notes/.note.gnu.build-id create mode 100644 test/sys/module/dm_mod/refcnt create mode 100644 test/sys/module/dm_mod/sections/.bss create mode 100644 test/sys/module/dm_mod/sections/.data create mode 100644 test/sys/module/dm_mod/sections/.exit.text create mode 100644 test/sys/module/dm_mod/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/dm_mod/sections/.init.data create mode 100644 test/sys/module/dm_mod/sections/.init.text create mode 100644 test/sys/module/dm_mod/sections/.note.gnu.build-id create mode 100644 test/sys/module/dm_mod/sections/.rodata create mode 100644 test/sys/module/dm_mod/sections/.rodata.str1.1 create mode 100644 test/sys/module/dm_mod/sections/.smp_locks create mode 100644 test/sys/module/dm_mod/sections/.strtab create mode 100644 test/sys/module/dm_mod/sections/.symtab create mode 100644 test/sys/module/dm_mod/sections/.text create mode 100644 test/sys/module/dm_mod/sections/__bug_table create mode 100644 test/sys/module/dm_mod/sections/__kcrctab create mode 100644 test/sys/module/dm_mod/sections/__kcrctab_gpl create mode 100644 test/sys/module/dm_mod/sections/__ksymtab create mode 100644 test/sys/module/dm_mod/sections/__ksymtab_gpl create mode 100644 test/sys/module/dm_mod/sections/__ksymtab_strings create mode 100644 test/sys/module/dm_mod/sections/__param create mode 100644 test/sys/module/dm_mod/srcversion create mode 100644 test/sys/module/dock/parameters/immediate_undock create mode 120000 test/sys/module/e1000e/drivers/pci:e1000e create mode 100644 test/sys/module/e1000e/initstate create mode 100644 test/sys/module/e1000e/notes/.note.gnu.build-id create mode 100644 test/sys/module/e1000e/parameters/copybreak create mode 100644 test/sys/module/e1000e/refcnt create mode 100644 test/sys/module/e1000e/sections/.bss create mode 100644 test/sys/module/e1000e/sections/.data create mode 100644 test/sys/module/e1000e/sections/.devexit.text create mode 100644 test/sys/module/e1000e/sections/.devinit.data create mode 100644 test/sys/module/e1000e/sections/.devinit.text create mode 100644 test/sys/module/e1000e/sections/.exit.text create mode 100644 test/sys/module/e1000e/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/e1000e/sections/.init.text create mode 100644 test/sys/module/e1000e/sections/.note.gnu.build-id create mode 100644 test/sys/module/e1000e/sections/.rodata create mode 100644 test/sys/module/e1000e/sections/.rodata.str1.1 create mode 100644 test/sys/module/e1000e/sections/.smp_locks create mode 100644 test/sys/module/e1000e/sections/.strtab create mode 100644 test/sys/module/e1000e/sections/.symtab create mode 100644 test/sys/module/e1000e/sections/.text create mode 100644 test/sys/module/e1000e/sections/__bug_table create mode 100644 test/sys/module/e1000e/sections/__param create mode 100644 test/sys/module/e1000e/srcversion create mode 100644 test/sys/module/e1000e/version create mode 100644 test/sys/module/ecb/initstate create mode 100644 test/sys/module/ecb/notes/.note.gnu.build-id create mode 100644 test/sys/module/ecb/refcnt create mode 100644 test/sys/module/ecb/sections/.bss create mode 100644 test/sys/module/ecb/sections/.data create mode 100644 test/sys/module/ecb/sections/.exit.text create mode 100644 test/sys/module/ecb/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/ecb/sections/.init.text create mode 100644 test/sys/module/ecb/sections/.note.gnu.build-id create mode 100644 test/sys/module/ecb/sections/.rodata.str1.1 create mode 100644 test/sys/module/ecb/sections/.strtab create mode 100644 test/sys/module/ecb/sections/.symtab create mode 100644 test/sys/module/ecb/sections/.text create mode 100644 test/sys/module/ecb/srcversion create mode 100644 test/sys/module/edd/initstate create mode 100644 test/sys/module/edd/notes/.note.gnu.build-id create mode 100644 test/sys/module/edd/refcnt create mode 100644 test/sys/module/edd/sections/.bss create mode 100644 test/sys/module/edd/sections/.data create mode 100644 test/sys/module/edd/sections/.exit.text create mode 100644 test/sys/module/edd/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/edd/sections/.init.text create mode 100644 test/sys/module/edd/sections/.note.gnu.build-id create mode 100644 test/sys/module/edd/sections/.rodata create mode 100644 test/sys/module/edd/sections/.rodata.str1.1 create mode 100644 test/sys/module/edd/sections/.strtab create mode 100644 test/sys/module/edd/sections/.symtab create mode 100644 test/sys/module/edd/sections/.text create mode 100644 test/sys/module/edd/srcversion create mode 100644 test/sys/module/edd/version create mode 120000 test/sys/module/ehci_hcd/drivers/pci:ehci_hcd create mode 100644 test/sys/module/ehci_hcd/initstate create mode 100644 test/sys/module/ehci_hcd/notes/.note.gnu.build-id create mode 100644 test/sys/module/ehci_hcd/parameters/ignore_oc create mode 100644 test/sys/module/ehci_hcd/parameters/log2_irq_thresh create mode 100644 test/sys/module/ehci_hcd/parameters/park create mode 100644 test/sys/module/ehci_hcd/refcnt create mode 100644 test/sys/module/ehci_hcd/sections/.bss create mode 100644 test/sys/module/ehci_hcd/sections/.data create mode 100644 test/sys/module/ehci_hcd/sections/.exit.text create mode 100644 test/sys/module/ehci_hcd/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/ehci_hcd/sections/.init.text create mode 100644 test/sys/module/ehci_hcd/sections/.note.gnu.build-id create mode 100644 test/sys/module/ehci_hcd/sections/.rodata create mode 100644 test/sys/module/ehci_hcd/sections/.rodata.str1.1 create mode 100644 test/sys/module/ehci_hcd/sections/.smp_locks create mode 100644 test/sys/module/ehci_hcd/sections/.strtab create mode 100644 test/sys/module/ehci_hcd/sections/.symtab create mode 100644 test/sys/module/ehci_hcd/sections/.text create mode 100644 test/sys/module/ehci_hcd/sections/__bug_table create mode 100644 test/sys/module/ehci_hcd/sections/__param create mode 100644 test/sys/module/ehci_hcd/srcversion create mode 100644 test/sys/module/evdev/initstate create mode 100644 test/sys/module/evdev/notes/.note.gnu.build-id create mode 100644 test/sys/module/evdev/refcnt create mode 100644 test/sys/module/evdev/sections/.bss create mode 100644 test/sys/module/evdev/sections/.data create mode 100644 test/sys/module/evdev/sections/.exit.text create mode 100644 test/sys/module/evdev/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/evdev/sections/.init.text create mode 100644 test/sys/module/evdev/sections/.note.gnu.build-id create mode 100644 test/sys/module/evdev/sections/.rodata create mode 100644 test/sys/module/evdev/sections/.rodata.str1.1 create mode 100644 test/sys/module/evdev/sections/.strtab create mode 100644 test/sys/module/evdev/sections/.symtab create mode 100644 test/sys/module/evdev/sections/.text create mode 100644 test/sys/module/evdev/srcversion create mode 100644 test/sys/module/fuse/initstate create mode 100644 test/sys/module/fuse/notes/.note.gnu.build-id create mode 100644 test/sys/module/fuse/refcnt create mode 100644 test/sys/module/fuse/sections/.bss create mode 100644 test/sys/module/fuse/sections/.data create mode 100644 test/sys/module/fuse/sections/.exit.text create mode 100644 test/sys/module/fuse/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/fuse/sections/.init.text create mode 100644 test/sys/module/fuse/sections/.note.gnu.build-id create mode 100644 test/sys/module/fuse/sections/.rodata create mode 100644 test/sys/module/fuse/sections/.rodata.str1.1 create mode 100644 test/sys/module/fuse/sections/.smp_locks create mode 100644 test/sys/module/fuse/sections/.strtab create mode 100644 test/sys/module/fuse/sections/.symtab create mode 100644 test/sys/module/fuse/sections/.text create mode 100644 test/sys/module/fuse/sections/__bug_table create mode 100644 test/sys/module/fuse/srcversion create mode 100644 test/sys/module/hid/parameters/pb_fnmode create mode 120000 test/sys/module/hwmon/holders/thinkpad_acpi create mode 100644 test/sys/module/hwmon/initstate create mode 100644 test/sys/module/hwmon/notes/.note.gnu.build-id create mode 100644 test/sys/module/hwmon/refcnt create mode 100644 test/sys/module/hwmon/sections/.bss create mode 100644 test/sys/module/hwmon/sections/.data create mode 100644 test/sys/module/hwmon/sections/.exit.text create mode 100644 test/sys/module/hwmon/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/hwmon/sections/.init.text create mode 100644 test/sys/module/hwmon/sections/.note.gnu.build-id create mode 100644 test/sys/module/hwmon/sections/.rodata.str1.1 create mode 100644 test/sys/module/hwmon/sections/.strtab create mode 100644 test/sys/module/hwmon/sections/.symtab create mode 100644 test/sys/module/hwmon/sections/.text create mode 100644 test/sys/module/hwmon/sections/__kcrctab_gpl create mode 100644 test/sys/module/hwmon/sections/__ksymtab_gpl create mode 100644 test/sys/module/hwmon/sections/__ksymtab_strings create mode 100644 test/sys/module/hwmon/srcversion create mode 100644 test/sys/module/i8042/parameters/debug create mode 100644 test/sys/module/i8042/parameters/panicblink create mode 120000 test/sys/module/intel_agp/drivers/pci:agpgart-intel create mode 100644 test/sys/module/intel_agp/initstate create mode 100644 test/sys/module/intel_agp/notes/.note.gnu.build-id create mode 100644 test/sys/module/intel_agp/refcnt create mode 100644 test/sys/module/intel_agp/sections/.bss create mode 100644 test/sys/module/intel_agp/sections/.data create mode 100644 test/sys/module/intel_agp/sections/.devexit.text create mode 100644 test/sys/module/intel_agp/sections/.devinit.text create mode 100644 test/sys/module/intel_agp/sections/.exit.text create mode 100644 test/sys/module/intel_agp/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/intel_agp/sections/.init.text create mode 100644 test/sys/module/intel_agp/sections/.note.gnu.build-id create mode 100644 test/sys/module/intel_agp/sections/.rodata create mode 100644 test/sys/module/intel_agp/sections/.rodata.str1.1 create mode 100644 test/sys/module/intel_agp/sections/.smp_locks create mode 100644 test/sys/module/intel_agp/sections/.strtab create mode 100644 test/sys/module/intel_agp/sections/.symtab create mode 100644 test/sys/module/intel_agp/sections/.text create mode 100644 test/sys/module/intel_agp/srcversion create mode 100644 test/sys/module/ipv6/initstate create mode 100644 test/sys/module/ipv6/notes/.note.gnu.build-id create mode 100644 test/sys/module/ipv6/refcnt create mode 100644 test/sys/module/ipv6/sections/.bss create mode 100644 test/sys/module/ipv6/sections/.data create mode 100644 test/sys/module/ipv6/sections/.data.read_mostly create mode 100644 test/sys/module/ipv6/sections/.exit.text create mode 100644 test/sys/module/ipv6/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/ipv6/sections/.init.data create mode 100644 test/sys/module/ipv6/sections/.init.text create mode 100644 test/sys/module/ipv6/sections/.note.gnu.build-id create mode 100644 test/sys/module/ipv6/sections/.ref.text create mode 100644 test/sys/module/ipv6/sections/.rodata create mode 100644 test/sys/module/ipv6/sections/.rodata.str1.1 create mode 100644 test/sys/module/ipv6/sections/.smp_locks create mode 100644 test/sys/module/ipv6/sections/.strtab create mode 100644 test/sys/module/ipv6/sections/.symtab create mode 100644 test/sys/module/ipv6/sections/.text create mode 100644 test/sys/module/ipv6/sections/__bug_table create mode 100644 test/sys/module/ipv6/sections/__kcrctab create mode 100644 test/sys/module/ipv6/sections/__kcrctab_gpl create mode 100644 test/sys/module/ipv6/sections/__ksymtab create mode 100644 test/sys/module/ipv6/sections/__ksymtab_gpl create mode 100644 test/sys/module/ipv6/sections/__ksymtab_strings create mode 100644 test/sys/module/ipv6/srcversion create mode 120000 test/sys/module/iwl3945/drivers/pci:iwl3945 create mode 100644 test/sys/module/iwl3945/initstate create mode 100644 test/sys/module/iwl3945/notes/.note.gnu.build-id create mode 100644 test/sys/module/iwl3945/parameters/antenna create mode 100644 test/sys/module/iwl3945/parameters/debug create mode 100644 test/sys/module/iwl3945/parameters/disable create mode 100644 test/sys/module/iwl3945/parameters/disable_hw_scan create mode 100644 test/sys/module/iwl3945/parameters/hwcrypto create mode 100644 test/sys/module/iwl3945/parameters/qos_enable create mode 100644 test/sys/module/iwl3945/parameters/queues_num create mode 100644 test/sys/module/iwl3945/refcnt create mode 100644 test/sys/module/iwl3945/sections/.bss create mode 100644 test/sys/module/iwl3945/sections/.data create mode 100644 test/sys/module/iwl3945/sections/.devexit.text create mode 100644 test/sys/module/iwl3945/sections/.exit.text create mode 100644 test/sys/module/iwl3945/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/iwl3945/sections/.init.text create mode 100644 test/sys/module/iwl3945/sections/.note.gnu.build-id create mode 100644 test/sys/module/iwl3945/sections/.rodata create mode 100644 test/sys/module/iwl3945/sections/.rodata.str1.1 create mode 100644 test/sys/module/iwl3945/sections/.smp_locks create mode 100644 test/sys/module/iwl3945/sections/.strtab create mode 100644 test/sys/module/iwl3945/sections/.symtab create mode 100644 test/sys/module/iwl3945/sections/.text create mode 100644 test/sys/module/iwl3945/sections/__bug_table create mode 100644 test/sys/module/iwl3945/sections/__param create mode 100644 test/sys/module/iwl3945/srcversion create mode 100644 test/sys/module/iwl3945/version create mode 100644 test/sys/module/keyboard/parameters/brl_nbchords create mode 100644 test/sys/module/keyboard/parameters/brl_timeout create mode 120000 test/sys/module/led_class/holders/iwl3945 create mode 120000 test/sys/module/led_class/holders/thinkpad_acpi create mode 100644 test/sys/module/led_class/initstate create mode 100644 test/sys/module/led_class/notes/.note.gnu.build-id create mode 100644 test/sys/module/led_class/refcnt create mode 100644 test/sys/module/led_class/sections/.bss create mode 100644 test/sys/module/led_class/sections/.data create mode 100644 test/sys/module/led_class/sections/.exit.text create mode 100644 test/sys/module/led_class/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/led_class/sections/.init.text create mode 100644 test/sys/module/led_class/sections/.note.gnu.build-id create mode 100644 test/sys/module/led_class/sections/.rodata.str1.1 create mode 100644 test/sys/module/led_class/sections/.strtab create mode 100644 test/sys/module/led_class/sections/.symtab create mode 100644 test/sys/module/led_class/sections/.text create mode 100644 test/sys/module/led_class/sections/__kcrctab_gpl create mode 100644 test/sys/module/led_class/sections/__ksymtab_gpl create mode 100644 test/sys/module/led_class/sections/__ksymtab_strings create mode 100644 test/sys/module/led_class/srcversion create mode 100644 test/sys/module/libata/parameters/acpi_gtf_filter create mode 100644 test/sys/module/libata/parameters/allow_tpm create mode 100644 test/sys/module/libata/parameters/ata_probe_timeout create mode 100644 test/sys/module/libata/parameters/atapi_dmadir create mode 100644 test/sys/module/libata/parameters/atapi_enabled create mode 100644 test/sys/module/libata/parameters/atapi_passthru16 create mode 100644 test/sys/module/libata/parameters/dma create mode 100644 test/sys/module/libata/parameters/fua create mode 100644 test/sys/module/libata/parameters/ignore_hpa create mode 100644 test/sys/module/libata/parameters/noacpi create mode 100644 test/sys/module/lockdep/parameters/lock_stat create mode 100644 test/sys/module/loop/initstate create mode 100644 test/sys/module/loop/notes/.note.gnu.build-id create mode 100644 test/sys/module/loop/refcnt create mode 100644 test/sys/module/loop/sections/.bss create mode 100644 test/sys/module/loop/sections/.data create mode 100644 test/sys/module/loop/sections/.exit.text create mode 100644 test/sys/module/loop/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/loop/sections/.init.text create mode 100644 test/sys/module/loop/sections/.note.gnu.build-id create mode 100644 test/sys/module/loop/sections/.rodata create mode 100644 test/sys/module/loop/sections/.rodata.str1.1 create mode 100644 test/sys/module/loop/sections/.strtab create mode 100644 test/sys/module/loop/sections/.symtab create mode 100644 test/sys/module/loop/sections/.text create mode 100644 test/sys/module/loop/sections/__bug_table create mode 100644 test/sys/module/loop/sections/__kcrctab create mode 100644 test/sys/module/loop/sections/__ksymtab create mode 100644 test/sys/module/loop/sections/__ksymtab_strings create mode 100644 test/sys/module/loop/sections/__param create mode 100644 test/sys/module/loop/srcversion create mode 120000 test/sys/module/mac80211/holders/iwl3945 create mode 100644 test/sys/module/mac80211/initstate create mode 100644 test/sys/module/mac80211/notes/.note.gnu.build-id create mode 100644 test/sys/module/mac80211/parameters/ieee80211_default_rc_algo create mode 100644 test/sys/module/mac80211/refcnt create mode 100644 test/sys/module/mac80211/sections/.bss create mode 100644 test/sys/module/mac80211/sections/.data create mode 100644 test/sys/module/mac80211/sections/.exit.text create mode 100644 test/sys/module/mac80211/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/mac80211/sections/.init.text create mode 100644 test/sys/module/mac80211/sections/.note.gnu.build-id create mode 100644 test/sys/module/mac80211/sections/.rodata create mode 100644 test/sys/module/mac80211/sections/.rodata.str1.1 create mode 100644 test/sys/module/mac80211/sections/.smp_locks create mode 100644 test/sys/module/mac80211/sections/.strtab create mode 100644 test/sys/module/mac80211/sections/.symtab create mode 100644 test/sys/module/mac80211/sections/.text create mode 100644 test/sys/module/mac80211/sections/__bug_table create mode 100644 test/sys/module/mac80211/sections/__kcrctab create mode 100644 test/sys/module/mac80211/sections/__kcrctab_gpl create mode 100644 test/sys/module/mac80211/sections/__ksymtab create mode 100644 test/sys/module/mac80211/sections/__ksymtab_gpl create mode 100644 test/sys/module/mac80211/sections/__ksymtab_strings create mode 100644 test/sys/module/mac80211/sections/__param create mode 100644 test/sys/module/mac80211/srcversion create mode 120000 test/sys/module/md_mod/holders/raid1 create mode 100644 test/sys/module/md_mod/initstate create mode 100644 test/sys/module/md_mod/notes/.note.gnu.build-id create mode 100644 test/sys/module/md_mod/parameters/start_dirty_degraded create mode 100644 test/sys/module/md_mod/parameters/start_ro create mode 100644 test/sys/module/md_mod/refcnt create mode 100644 test/sys/module/md_mod/sections/.bss create mode 100644 test/sys/module/md_mod/sections/.data create mode 100644 test/sys/module/md_mod/sections/.exit.text create mode 100644 test/sys/module/md_mod/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/md_mod/sections/.init.text create mode 100644 test/sys/module/md_mod/sections/.note.gnu.build-id create mode 100644 test/sys/module/md_mod/sections/.rodata create mode 100644 test/sys/module/md_mod/sections/.rodata.str1.1 create mode 100644 test/sys/module/md_mod/sections/.smp_locks create mode 100644 test/sys/module/md_mod/sections/.strtab create mode 100644 test/sys/module/md_mod/sections/.symtab create mode 100644 test/sys/module/md_mod/sections/.text create mode 100644 test/sys/module/md_mod/sections/__bug_table create mode 100644 test/sys/module/md_mod/sections/__kcrctab create mode 100644 test/sys/module/md_mod/sections/__kcrctab_gpl create mode 100644 test/sys/module/md_mod/sections/__ksymtab create mode 100644 test/sys/module/md_mod/sections/__ksymtab_gpl create mode 100644 test/sys/module/md_mod/sections/__ksymtab_strings create mode 100644 test/sys/module/md_mod/sections/__param create mode 100644 test/sys/module/md_mod/srcversion create mode 100644 test/sys/module/microcode/initstate create mode 100644 test/sys/module/microcode/notes/.note.gnu.build-id create mode 100644 test/sys/module/microcode/refcnt create mode 100644 test/sys/module/microcode/sections/.bss create mode 100644 test/sys/module/microcode/sections/.cpuinit.text create mode 100644 test/sys/module/microcode/sections/.data create mode 100644 test/sys/module/microcode/sections/.exit.text create mode 100644 test/sys/module/microcode/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/microcode/sections/.init.text create mode 100644 test/sys/module/microcode/sections/.note.gnu.build-id create mode 100644 test/sys/module/microcode/sections/.ref.data create mode 100644 test/sys/module/microcode/sections/.rodata create mode 100644 test/sys/module/microcode/sections/.rodata.str1.1 create mode 100644 test/sys/module/microcode/sections/.strtab create mode 100644 test/sys/module/microcode/sections/.symtab create mode 100644 test/sys/module/microcode/sections/.text create mode 100644 test/sys/module/microcode/sections/__bug_table create mode 100644 test/sys/module/microcode/srcversion create mode 100644 test/sys/module/mousedev/parameters/tap_time create mode 100644 test/sys/module/mousedev/parameters/xres create mode 100644 test/sys/module/mousedev/parameters/yres create mode 120000 test/sys/module/nvram/holders/thinkpad_acpi create mode 100644 test/sys/module/nvram/initstate create mode 100644 test/sys/module/nvram/notes/.note.gnu.build-id create mode 100644 test/sys/module/nvram/refcnt create mode 100644 test/sys/module/nvram/sections/.bss create mode 100644 test/sys/module/nvram/sections/.data create mode 100644 test/sys/module/nvram/sections/.exit.text create mode 100644 test/sys/module/nvram/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/nvram/sections/.init.text create mode 100644 test/sys/module/nvram/sections/.note.gnu.build-id create mode 100644 test/sys/module/nvram/sections/.rodata create mode 100644 test/sys/module/nvram/sections/.rodata.str1.1 create mode 100644 test/sys/module/nvram/sections/.strtab create mode 100644 test/sys/module/nvram/sections/.symtab create mode 100644 test/sys/module/nvram/sections/.text create mode 100644 test/sys/module/nvram/sections/__kcrctab create mode 100644 test/sys/module/nvram/sections/__ksymtab create mode 100644 test/sys/module/nvram/sections/__ksymtab_strings create mode 100644 test/sys/module/nvram/srcversion create mode 100644 test/sys/module/oprofile/parameters/timer create mode 100644 test/sys/module/pcie_aspm/parameters/policy create mode 100644 test/sys/module/pcmcia/initstate create mode 100644 test/sys/module/pcmcia/notes/.note.gnu.build-id create mode 100644 test/sys/module/pcmcia/parameters/io_speed create mode 100644 test/sys/module/pcmcia/refcnt create mode 100644 test/sys/module/pcmcia/sections/.bss create mode 100644 test/sys/module/pcmcia/sections/.data create mode 100644 test/sys/module/pcmcia/sections/.devinit.text create mode 100644 test/sys/module/pcmcia/sections/.exit.text create mode 100644 test/sys/module/pcmcia/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/pcmcia/sections/.init.text create mode 100644 test/sys/module/pcmcia/sections/.note.gnu.build-id create mode 100644 test/sys/module/pcmcia/sections/.ref.data create mode 100644 test/sys/module/pcmcia/sections/.rodata create mode 100644 test/sys/module/pcmcia/sections/.rodata.str1.1 create mode 100644 test/sys/module/pcmcia/sections/.strtab create mode 100644 test/sys/module/pcmcia/sections/.symtab create mode 100644 test/sys/module/pcmcia/sections/.text create mode 100644 test/sys/module/pcmcia/sections/__kcrctab create mode 100644 test/sys/module/pcmcia/sections/__ksymtab create mode 100644 test/sys/module/pcmcia/sections/__ksymtab_strings create mode 100644 test/sys/module/pcmcia/sections/__param create mode 100644 test/sys/module/pcmcia/srcversion create mode 120000 test/sys/module/pcmcia_core/holders/pcmcia create mode 120000 test/sys/module/pcmcia_core/holders/rsrc_nonstatic create mode 120000 test/sys/module/pcmcia_core/holders/yenta_socket create mode 100644 test/sys/module/pcmcia_core/initstate create mode 100644 test/sys/module/pcmcia_core/notes/.note.gnu.build-id create mode 100644 test/sys/module/pcmcia_core/parameters/cis_speed create mode 100644 test/sys/module/pcmcia_core/parameters/cis_width create mode 100644 test/sys/module/pcmcia_core/parameters/reset_time create mode 100644 test/sys/module/pcmcia_core/parameters/resume_delay create mode 100644 test/sys/module/pcmcia_core/parameters/setup_delay create mode 100644 test/sys/module/pcmcia_core/parameters/shutdown_delay create mode 100644 test/sys/module/pcmcia_core/parameters/unreset_check create mode 100644 test/sys/module/pcmcia_core/parameters/unreset_delay create mode 100644 test/sys/module/pcmcia_core/parameters/unreset_limit create mode 100644 test/sys/module/pcmcia_core/parameters/vcc_settle create mode 100644 test/sys/module/pcmcia_core/refcnt create mode 100644 test/sys/module/pcmcia_core/sections/.bss create mode 100644 test/sys/module/pcmcia_core/sections/.data create mode 100644 test/sys/module/pcmcia_core/sections/.exit.text create mode 100644 test/sys/module/pcmcia_core/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/pcmcia_core/sections/.init.text create mode 100644 test/sys/module/pcmcia_core/sections/.note.gnu.build-id create mode 100644 test/sys/module/pcmcia_core/sections/.ref.text create mode 100644 test/sys/module/pcmcia_core/sections/.rodata create mode 100644 test/sys/module/pcmcia_core/sections/.rodata.str1.1 create mode 100644 test/sys/module/pcmcia_core/sections/.strtab create mode 100644 test/sys/module/pcmcia_core/sections/.symtab create mode 100644 test/sys/module/pcmcia_core/sections/.text create mode 100644 test/sys/module/pcmcia_core/sections/__kcrctab create mode 100644 test/sys/module/pcmcia_core/sections/__ksymtab create mode 100644 test/sys/module/pcmcia_core/sections/__ksymtab_strings create mode 100644 test/sys/module/pcmcia_core/sections/__param create mode 100644 test/sys/module/pcmcia_core/srcversion create mode 120000 test/sys/module/pcspkr/drivers/platform:pcspkr create mode 100644 test/sys/module/pcspkr/initstate create mode 100644 test/sys/module/pcspkr/notes/.note.gnu.build-id create mode 100644 test/sys/module/pcspkr/refcnt create mode 100644 test/sys/module/pcspkr/sections/.bss create mode 100644 test/sys/module/pcspkr/sections/.data create mode 100644 test/sys/module/pcspkr/sections/.devexit.text create mode 100644 test/sys/module/pcspkr/sections/.devinit.text create mode 100644 test/sys/module/pcspkr/sections/.exit.text create mode 100644 test/sys/module/pcspkr/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/pcspkr/sections/.init.text create mode 100644 test/sys/module/pcspkr/sections/.note.gnu.build-id create mode 100644 test/sys/module/pcspkr/sections/.rodata.str1.1 create mode 100644 test/sys/module/pcspkr/sections/.strtab create mode 100644 test/sys/module/pcspkr/sections/.symtab create mode 100644 test/sys/module/pcspkr/sections/.text create mode 100644 test/sys/module/pcspkr/srcversion create mode 100644 test/sys/module/printk/parameters/time create mode 120000 test/sys/module/processor/holders/acpi_cpufreq create mode 120000 test/sys/module/processor/holders/thermal create mode 100644 test/sys/module/processor/initstate create mode 100644 test/sys/module/processor/notes/.note.gnu.build-id create mode 100644 test/sys/module/processor/parameters/ignore_ppc create mode 100644 test/sys/module/processor/parameters/latency_factor create mode 100644 test/sys/module/processor/refcnt create mode 100644 test/sys/module/processor/sections/.bss create mode 100644 test/sys/module/processor/sections/.cpuinit.data create mode 100644 test/sys/module/processor/sections/.cpuinit.text create mode 100644 test/sys/module/processor/sections/.data create mode 100644 test/sys/module/processor/sections/.data.read_mostly create mode 100644 test/sys/module/processor/sections/.exit.text create mode 100644 test/sys/module/processor/sections/.fixup create mode 100644 test/sys/module/processor/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/processor/sections/.init.text create mode 100644 test/sys/module/processor/sections/.note.gnu.build-id create mode 100644 test/sys/module/processor/sections/.ref.text create mode 100644 test/sys/module/processor/sections/.rodata create mode 100644 test/sys/module/processor/sections/.rodata.str1.1 create mode 100644 test/sys/module/processor/sections/.smp_locks create mode 100644 test/sys/module/processor/sections/.strtab create mode 100644 test/sys/module/processor/sections/.symtab create mode 100644 test/sys/module/processor/sections/.text create mode 100644 test/sys/module/processor/sections/__bug_table create mode 100644 test/sys/module/processor/sections/__ex_table create mode 100644 test/sys/module/processor/sections/__kcrctab create mode 100644 test/sys/module/processor/sections/__ksymtab create mode 100644 test/sys/module/processor/sections/__ksymtab_strings create mode 100644 test/sys/module/processor/sections/__param create mode 100644 test/sys/module/processor/srcversion create mode 120000 test/sys/module/psmouse/drivers/serio:psmouse create mode 100644 test/sys/module/psmouse/parameters/proto create mode 100644 test/sys/module/psmouse/parameters/rate create mode 100644 test/sys/module/psmouse/parameters/resetafter create mode 100644 test/sys/module/psmouse/parameters/resolution create mode 100644 test/sys/module/psmouse/parameters/resync_time create mode 100644 test/sys/module/psmouse/parameters/smartscroll create mode 100644 test/sys/module/raid1/initstate create mode 100644 test/sys/module/raid1/notes/.note.gnu.build-id create mode 100644 test/sys/module/raid1/refcnt create mode 100644 test/sys/module/raid1/sections/.bss create mode 100644 test/sys/module/raid1/sections/.data create mode 100644 test/sys/module/raid1/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/raid1/sections/.init.text create mode 100644 test/sys/module/raid1/sections/.note.gnu.build-id create mode 100644 test/sys/module/raid1/sections/.rodata.str1.1 create mode 100644 test/sys/module/raid1/sections/.smp_locks create mode 100644 test/sys/module/raid1/sections/.strtab create mode 100644 test/sys/module/raid1/sections/.symtab create mode 100644 test/sys/module/raid1/sections/.text create mode 100644 test/sys/module/raid1/sections/__bug_table create mode 100644 test/sys/module/raid1/srcversion create mode 120000 test/sys/module/rfkill/holders/thinkpad_acpi create mode 100644 test/sys/module/rfkill/initstate create mode 100644 test/sys/module/rfkill/notes/.note.gnu.build-id create mode 100644 test/sys/module/rfkill/parameters/default_state create mode 100644 test/sys/module/rfkill/refcnt create mode 100644 test/sys/module/rfkill/sections/.bss create mode 100644 test/sys/module/rfkill/sections/.data create mode 100644 test/sys/module/rfkill/sections/.exit.text create mode 100644 test/sys/module/rfkill/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/rfkill/sections/.init.text create mode 100644 test/sys/module/rfkill/sections/.note.gnu.build-id create mode 100644 test/sys/module/rfkill/sections/.rodata create mode 100644 test/sys/module/rfkill/sections/.rodata.str1.1 create mode 100644 test/sys/module/rfkill/sections/.smp_locks create mode 100644 test/sys/module/rfkill/sections/.strtab create mode 100644 test/sys/module/rfkill/sections/.symtab create mode 100644 test/sys/module/rfkill/sections/.text create mode 100644 test/sys/module/rfkill/sections/__bug_table create mode 100644 test/sys/module/rfkill/sections/__kcrctab create mode 100644 test/sys/module/rfkill/sections/__kcrctab_gpl create mode 100644 test/sys/module/rfkill/sections/__ksymtab create mode 100644 test/sys/module/rfkill/sections/__ksymtab_gpl create mode 100644 test/sys/module/rfkill/sections/__ksymtab_strings create mode 100644 test/sys/module/rfkill/sections/__param create mode 100644 test/sys/module/rfkill/srcversion create mode 100644 test/sys/module/rfkill/version create mode 120000 test/sys/module/rsrc_nonstatic/holders/yenta_socket create mode 100644 test/sys/module/rsrc_nonstatic/initstate create mode 100644 test/sys/module/rsrc_nonstatic/notes/.note.gnu.build-id create mode 100644 test/sys/module/rsrc_nonstatic/parameters/probe_mem create mode 100644 test/sys/module/rsrc_nonstatic/refcnt create mode 100644 test/sys/module/rsrc_nonstatic/sections/.bss create mode 100644 test/sys/module/rsrc_nonstatic/sections/.data create mode 100644 test/sys/module/rsrc_nonstatic/sections/.devexit.text create mode 100644 test/sys/module/rsrc_nonstatic/sections/.devinit.text create mode 100644 test/sys/module/rsrc_nonstatic/sections/.exit.text create mode 100644 test/sys/module/rsrc_nonstatic/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/rsrc_nonstatic/sections/.init.text create mode 100644 test/sys/module/rsrc_nonstatic/sections/.note.gnu.build-id create mode 100644 test/sys/module/rsrc_nonstatic/sections/.ref.data create mode 100644 test/sys/module/rsrc_nonstatic/sections/.rodata create mode 100644 test/sys/module/rsrc_nonstatic/sections/.rodata.str1.1 create mode 100644 test/sys/module/rsrc_nonstatic/sections/.strtab create mode 100644 test/sys/module/rsrc_nonstatic/sections/.symtab create mode 100644 test/sys/module/rsrc_nonstatic/sections/.text create mode 100644 test/sys/module/rsrc_nonstatic/sections/__kcrctab create mode 100644 test/sys/module/rsrc_nonstatic/sections/__ksymtab create mode 100644 test/sys/module/rsrc_nonstatic/sections/__ksymtab_strings create mode 100644 test/sys/module/rsrc_nonstatic/sections/__param create mode 100644 test/sys/module/rsrc_nonstatic/srcversion create mode 100644 test/sys/module/rtc_cmos/initstate create mode 100644 test/sys/module/rtc_cmos/notes/.note.gnu.build-id create mode 100644 test/sys/module/rtc_cmos/refcnt create mode 100644 test/sys/module/rtc_cmos/sections/.bss create mode 100644 test/sys/module/rtc_cmos/sections/.data create mode 100644 test/sys/module/rtc_cmos/sections/.devinit.text create mode 100644 test/sys/module/rtc_cmos/sections/.exit.text create mode 100644 test/sys/module/rtc_cmos/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/rtc_cmos/sections/.init.text create mode 100644 test/sys/module/rtc_cmos/sections/.note.gnu.build-id create mode 100644 test/sys/module/rtc_cmos/sections/.rodata create mode 100644 test/sys/module/rtc_cmos/sections/.rodata.str1.1 create mode 100644 test/sys/module/rtc_cmos/sections/.strtab create mode 100644 test/sys/module/rtc_cmos/sections/.symtab create mode 100644 test/sys/module/rtc_cmos/sections/.text create mode 100644 test/sys/module/rtc_cmos/srcversion create mode 120000 test/sys/module/rtc_core/holders/rtc_cmos create mode 100644 test/sys/module/rtc_core/initstate create mode 100644 test/sys/module/rtc_core/notes/.note.gnu.build-id create mode 100644 test/sys/module/rtc_core/refcnt create mode 100644 test/sys/module/rtc_core/sections/.bss create mode 100644 test/sys/module/rtc_core/sections/.data create mode 100644 test/sys/module/rtc_core/sections/.exit.text create mode 100644 test/sys/module/rtc_core/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/rtc_core/sections/.init.text create mode 100644 test/sys/module/rtc_core/sections/.note.gnu.build-id create mode 100644 test/sys/module/rtc_core/sections/.rodata create mode 100644 test/sys/module/rtc_core/sections/.rodata.str1.1 create mode 100644 test/sys/module/rtc_core/sections/.smp_locks create mode 100644 test/sys/module/rtc_core/sections/.strtab create mode 100644 test/sys/module/rtc_core/sections/.symtab create mode 100644 test/sys/module/rtc_core/sections/.text create mode 100644 test/sys/module/rtc_core/sections/__kcrctab_gpl create mode 100644 test/sys/module/rtc_core/sections/__ksymtab_gpl create mode 100644 test/sys/module/rtc_core/sections/__ksymtab_strings create mode 100644 test/sys/module/rtc_core/srcversion create mode 120000 test/sys/module/rtc_lib/holders/rtc_core create mode 100644 test/sys/module/rtc_lib/initstate create mode 100644 test/sys/module/rtc_lib/notes/.note.gnu.build-id create mode 100644 test/sys/module/rtc_lib/refcnt create mode 100644 test/sys/module/rtc_lib/sections/.bss create mode 100644 test/sys/module/rtc_lib/sections/.data create mode 100644 test/sys/module/rtc_lib/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/rtc_lib/sections/.note.gnu.build-id create mode 100644 test/sys/module/rtc_lib/sections/.rodata create mode 100644 test/sys/module/rtc_lib/sections/.strtab create mode 100644 test/sys/module/rtc_lib/sections/.symtab create mode 100644 test/sys/module/rtc_lib/sections/.text create mode 100644 test/sys/module/rtc_lib/sections/__kcrctab create mode 100644 test/sys/module/rtc_lib/sections/__ksymtab create mode 100644 test/sys/module/rtc_lib/sections/__ksymtab_strings create mode 100644 test/sys/module/rtc_lib/srcversion create mode 100644 test/sys/module/scsi_mod/parameters/default_dev_flags create mode 100644 test/sys/module/scsi_mod/parameters/inq_timeout create mode 100644 test/sys/module/scsi_mod/parameters/max_luns create mode 100644 test/sys/module/scsi_mod/parameters/max_report_luns create mode 100644 test/sys/module/scsi_mod/parameters/scan create mode 100644 test/sys/module/scsi_mod/parameters/scsi_logging_level create mode 100644 test/sys/module/sg/initstate create mode 100644 test/sys/module/sg/notes/.note.gnu.build-id create mode 100644 test/sys/module/sg/parameters/allow_dio create mode 100644 test/sys/module/sg/parameters/def_reserved_size create mode 100644 test/sys/module/sg/parameters/scatter_elem_sz create mode 100644 test/sys/module/sg/refcnt create mode 100644 test/sys/module/sg/sections/.bss create mode 100644 test/sys/module/sg/sections/.data create mode 100644 test/sys/module/sg/sections/.exit.text create mode 100644 test/sys/module/sg/sections/.fixup create mode 100644 test/sys/module/sg/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/sg/sections/.init.text create mode 100644 test/sys/module/sg/sections/.note.gnu.build-id create mode 100644 test/sys/module/sg/sections/.rodata create mode 100644 test/sys/module/sg/sections/.rodata.str1.1 create mode 100644 test/sys/module/sg/sections/.smp_locks create mode 100644 test/sys/module/sg/sections/.strtab create mode 100644 test/sys/module/sg/sections/.symtab create mode 100644 test/sys/module/sg/sections/.text create mode 100644 test/sys/module/sg/sections/__bug_table create mode 100644 test/sys/module/sg/sections/__ex_table create mode 100644 test/sys/module/sg/sections/__param create mode 100644 test/sys/module/sg/srcversion create mode 100644 test/sys/module/sg/version create mode 120000 test/sys/module/snd/holders/snd_hda_intel create mode 120000 test/sys/module/snd/holders/snd_mixer_oss create mode 120000 test/sys/module/snd/holders/snd_pcm create mode 120000 test/sys/module/snd/holders/snd_pcm_oss create mode 120000 test/sys/module/snd/holders/snd_seq create mode 120000 test/sys/module/snd/holders/snd_seq_device create mode 120000 test/sys/module/snd/holders/snd_timer create mode 100644 test/sys/module/snd/initstate create mode 100644 test/sys/module/snd/notes/.note.gnu.build-id create mode 100644 test/sys/module/snd/parameters/cards_limit create mode 100644 test/sys/module/snd/parameters/major create mode 100644 test/sys/module/snd/parameters/slots create mode 100644 test/sys/module/snd/refcnt create mode 100644 test/sys/module/snd/sections/.bss create mode 100644 test/sys/module/snd/sections/.data create mode 100644 test/sys/module/snd/sections/.exit.text create mode 100644 test/sys/module/snd/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/snd/sections/.init.text create mode 100644 test/sys/module/snd/sections/.note.gnu.build-id create mode 100644 test/sys/module/snd/sections/.rodata create mode 100644 test/sys/module/snd/sections/.rodata.str1.1 create mode 100644 test/sys/module/snd/sections/.strtab create mode 100644 test/sys/module/snd/sections/.symtab create mode 100644 test/sys/module/snd/sections/.text create mode 100644 test/sys/module/snd/sections/__kcrctab create mode 100644 test/sys/module/snd/sections/__ksymtab create mode 100644 test/sys/module/snd/sections/__ksymtab_strings create mode 100644 test/sys/module/snd/sections/__param create mode 100644 test/sys/module/snd/srcversion create mode 120000 test/sys/module/snd_hda_intel/drivers/pci:HDA Intel create mode 100644 test/sys/module/snd_hda_intel/initstate create mode 100644 test/sys/module/snd_hda_intel/notes/.note.gnu.build-id create mode 100644 test/sys/module/snd_hda_intel/parameters/bdl_pos_adj create mode 100644 test/sys/module/snd_hda_intel/parameters/enable create mode 100644 test/sys/module/snd_hda_intel/parameters/enable_msi create mode 100644 test/sys/module/snd_hda_intel/parameters/id create mode 100644 test/sys/module/snd_hda_intel/parameters/index create mode 100644 test/sys/module/snd_hda_intel/parameters/model create mode 100644 test/sys/module/snd_hda_intel/parameters/position_fix create mode 100644 test/sys/module/snd_hda_intel/parameters/probe_mask create mode 100644 test/sys/module/snd_hda_intel/parameters/single_cmd create mode 100644 test/sys/module/snd_hda_intel/refcnt create mode 100644 test/sys/module/snd_hda_intel/sections/.bss create mode 100644 test/sys/module/snd_hda_intel/sections/.data create mode 100644 test/sys/module/snd_hda_intel/sections/.devexit.text create mode 100644 test/sys/module/snd_hda_intel/sections/.devinit.data create mode 100644 test/sys/module/snd_hda_intel/sections/.devinit.text create mode 100644 test/sys/module/snd_hda_intel/sections/.exit.text create mode 100644 test/sys/module/snd_hda_intel/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/snd_hda_intel/sections/.init.text create mode 100644 test/sys/module/snd_hda_intel/sections/.note.gnu.build-id create mode 100644 test/sys/module/snd_hda_intel/sections/.rodata create mode 100644 test/sys/module/snd_hda_intel/sections/.rodata.str1.1 create mode 100644 test/sys/module/snd_hda_intel/sections/.strtab create mode 100644 test/sys/module/snd_hda_intel/sections/.symtab create mode 100644 test/sys/module/snd_hda_intel/sections/.text create mode 100644 test/sys/module/snd_hda_intel/sections/__param create mode 100644 test/sys/module/snd_hda_intel/srcversion create mode 120000 test/sys/module/snd_mixer_oss/holders/snd_pcm_oss create mode 100644 test/sys/module/snd_mixer_oss/initstate create mode 100644 test/sys/module/snd_mixer_oss/notes/.note.gnu.build-id create mode 100644 test/sys/module/snd_mixer_oss/refcnt create mode 100644 test/sys/module/snd_mixer_oss/sections/.bss create mode 100644 test/sys/module/snd_mixer_oss/sections/.data create mode 100644 test/sys/module/snd_mixer_oss/sections/.exit.text create mode 100644 test/sys/module/snd_mixer_oss/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/snd_mixer_oss/sections/.init.text create mode 100644 test/sys/module/snd_mixer_oss/sections/.note.gnu.build-id create mode 100644 test/sys/module/snd_mixer_oss/sections/.rodata create mode 100644 test/sys/module/snd_mixer_oss/sections/.rodata.str1.1 create mode 100644 test/sys/module/snd_mixer_oss/sections/.strtab create mode 100644 test/sys/module/snd_mixer_oss/sections/.symtab create mode 100644 test/sys/module/snd_mixer_oss/sections/.text create mode 100644 test/sys/module/snd_mixer_oss/sections/__kcrctab create mode 100644 test/sys/module/snd_mixer_oss/sections/__ksymtab create mode 100644 test/sys/module/snd_mixer_oss/sections/__ksymtab_strings create mode 100644 test/sys/module/snd_mixer_oss/srcversion create mode 120000 test/sys/module/snd_page_alloc/holders/snd_hda_intel create mode 120000 test/sys/module/snd_page_alloc/holders/snd_pcm create mode 100644 test/sys/module/snd_page_alloc/initstate create mode 100644 test/sys/module/snd_page_alloc/notes/.note.gnu.build-id create mode 100644 test/sys/module/snd_page_alloc/refcnt create mode 100644 test/sys/module/snd_page_alloc/sections/.bss create mode 100644 test/sys/module/snd_page_alloc/sections/.data create mode 100644 test/sys/module/snd_page_alloc/sections/.exit.text create mode 100644 test/sys/module/snd_page_alloc/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/snd_page_alloc/sections/.init.text create mode 100644 test/sys/module/snd_page_alloc/sections/.note.gnu.build-id create mode 100644 test/sys/module/snd_page_alloc/sections/.rodata create mode 100644 test/sys/module/snd_page_alloc/sections/.rodata.str1.1 create mode 100644 test/sys/module/snd_page_alloc/sections/.strtab create mode 100644 test/sys/module/snd_page_alloc/sections/.symtab create mode 100644 test/sys/module/snd_page_alloc/sections/.text create mode 100644 test/sys/module/snd_page_alloc/sections/__kcrctab create mode 100644 test/sys/module/snd_page_alloc/sections/__ksymtab create mode 100644 test/sys/module/snd_page_alloc/sections/__ksymtab_strings create mode 100644 test/sys/module/snd_page_alloc/srcversion create mode 120000 test/sys/module/snd_pcm/holders/snd_hda_intel create mode 120000 test/sys/module/snd_pcm/holders/snd_pcm_oss create mode 100644 test/sys/module/snd_pcm/initstate create mode 100644 test/sys/module/snd_pcm/notes/.note.gnu.build-id create mode 100644 test/sys/module/snd_pcm/parameters/maximum_substreams create mode 100644 test/sys/module/snd_pcm/parameters/preallocate_dma create mode 100644 test/sys/module/snd_pcm/refcnt create mode 100644 test/sys/module/snd_pcm/sections/.bss create mode 100644 test/sys/module/snd_pcm/sections/.data create mode 100644 test/sys/module/snd_pcm/sections/.exit.text create mode 100644 test/sys/module/snd_pcm/sections/.fixup create mode 100644 test/sys/module/snd_pcm/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/snd_pcm/sections/.init.text create mode 100644 test/sys/module/snd_pcm/sections/.note.gnu.build-id create mode 100644 test/sys/module/snd_pcm/sections/.rodata create mode 100644 test/sys/module/snd_pcm/sections/.rodata.str1.1 create mode 100644 test/sys/module/snd_pcm/sections/.smp_locks create mode 100644 test/sys/module/snd_pcm/sections/.strtab create mode 100644 test/sys/module/snd_pcm/sections/.symtab create mode 100644 test/sys/module/snd_pcm/sections/.text create mode 100644 test/sys/module/snd_pcm/sections/__ex_table create mode 100644 test/sys/module/snd_pcm/sections/__kcrctab create mode 100644 test/sys/module/snd_pcm/sections/__ksymtab create mode 100644 test/sys/module/snd_pcm/sections/__ksymtab_strings create mode 100644 test/sys/module/snd_pcm/sections/__param create mode 100644 test/sys/module/snd_pcm/srcversion create mode 100644 test/sys/module/snd_pcm_oss/initstate create mode 100644 test/sys/module/snd_pcm_oss/notes/.note.gnu.build-id create mode 100644 test/sys/module/snd_pcm_oss/parameters/adsp_map create mode 100644 test/sys/module/snd_pcm_oss/parameters/dsp_map create mode 100644 test/sys/module/snd_pcm_oss/parameters/nonblock_open create mode 100644 test/sys/module/snd_pcm_oss/refcnt create mode 100644 test/sys/module/snd_pcm_oss/sections/.bss create mode 100644 test/sys/module/snd_pcm_oss/sections/.data create mode 100644 test/sys/module/snd_pcm_oss/sections/.exit.text create mode 100644 test/sys/module/snd_pcm_oss/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/snd_pcm_oss/sections/.init.text create mode 100644 test/sys/module/snd_pcm_oss/sections/.note.gnu.build-id create mode 100644 test/sys/module/snd_pcm_oss/sections/.rodata create mode 100644 test/sys/module/snd_pcm_oss/sections/.rodata.str1.1 create mode 100644 test/sys/module/snd_pcm_oss/sections/.strtab create mode 100644 test/sys/module/snd_pcm_oss/sections/.symtab create mode 100644 test/sys/module/snd_pcm_oss/sections/.text create mode 100644 test/sys/module/snd_pcm_oss/sections/__param create mode 100644 test/sys/module/snd_pcm_oss/srcversion create mode 100644 test/sys/module/snd_seq/initstate create mode 100644 test/sys/module/snd_seq/notes/.note.gnu.build-id create mode 100644 test/sys/module/snd_seq/parameters/seq_client_load create mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_card create mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_class create mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_device create mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_resolution create mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_sclass create mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_subdevice create mode 100644 test/sys/module/snd_seq/refcnt create mode 100644 test/sys/module/snd_seq/sections/.bss create mode 100644 test/sys/module/snd_seq/sections/.data create mode 100644 test/sys/module/snd_seq/sections/.exit.text create mode 100644 test/sys/module/snd_seq/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/snd_seq/sections/.init.text create mode 100644 test/sys/module/snd_seq/sections/.note.gnu.build-id create mode 100644 test/sys/module/snd_seq/sections/.rodata create mode 100644 test/sys/module/snd_seq/sections/.rodata.str1.1 create mode 100644 test/sys/module/snd_seq/sections/.smp_locks create mode 100644 test/sys/module/snd_seq/sections/.strtab create mode 100644 test/sys/module/snd_seq/sections/.symtab create mode 100644 test/sys/module/snd_seq/sections/.text create mode 100644 test/sys/module/snd_seq/sections/__kcrctab create mode 100644 test/sys/module/snd_seq/sections/__ksymtab create mode 100644 test/sys/module/snd_seq/sections/__ksymtab_strings create mode 100644 test/sys/module/snd_seq/sections/__param create mode 100644 test/sys/module/snd_seq/srcversion create mode 120000 test/sys/module/snd_seq_device/holders/snd_seq create mode 100644 test/sys/module/snd_seq_device/initstate create mode 100644 test/sys/module/snd_seq_device/notes/.note.gnu.build-id create mode 100644 test/sys/module/snd_seq_device/refcnt create mode 100644 test/sys/module/snd_seq_device/sections/.bss create mode 100644 test/sys/module/snd_seq_device/sections/.data create mode 100644 test/sys/module/snd_seq_device/sections/.exit.text create mode 100644 test/sys/module/snd_seq_device/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/snd_seq_device/sections/.init.text create mode 100644 test/sys/module/snd_seq_device/sections/.note.gnu.build-id create mode 100644 test/sys/module/snd_seq_device/sections/.rodata.str1.1 create mode 100644 test/sys/module/snd_seq_device/sections/.strtab create mode 100644 test/sys/module/snd_seq_device/sections/.symtab create mode 100644 test/sys/module/snd_seq_device/sections/.text create mode 100644 test/sys/module/snd_seq_device/sections/__kcrctab create mode 100644 test/sys/module/snd_seq_device/sections/__ksymtab create mode 100644 test/sys/module/snd_seq_device/sections/__ksymtab_strings create mode 100644 test/sys/module/snd_seq_device/srcversion create mode 120000 test/sys/module/snd_timer/holders/snd_pcm create mode 120000 test/sys/module/snd_timer/holders/snd_seq create mode 100644 test/sys/module/snd_timer/initstate create mode 100644 test/sys/module/snd_timer/notes/.note.gnu.build-id create mode 100644 test/sys/module/snd_timer/parameters/timer_limit create mode 100644 test/sys/module/snd_timer/parameters/timer_tstamp_monotonic create mode 100644 test/sys/module/snd_timer/refcnt create mode 100644 test/sys/module/snd_timer/sections/.bss create mode 100644 test/sys/module/snd_timer/sections/.data create mode 100644 test/sys/module/snd_timer/sections/.exit.text create mode 100644 test/sys/module/snd_timer/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/snd_timer/sections/.init.text create mode 100644 test/sys/module/snd_timer/sections/.note.gnu.build-id create mode 100644 test/sys/module/snd_timer/sections/.rodata create mode 100644 test/sys/module/snd_timer/sections/.rodata.str1.1 create mode 100644 test/sys/module/snd_timer/sections/.smp_locks create mode 100644 test/sys/module/snd_timer/sections/.strtab create mode 100644 test/sys/module/snd_timer/sections/.symtab create mode 100644 test/sys/module/snd_timer/sections/.text create mode 100644 test/sys/module/snd_timer/sections/__bug_table create mode 100644 test/sys/module/snd_timer/sections/__kcrctab create mode 100644 test/sys/module/snd_timer/sections/__ksymtab create mode 100644 test/sys/module/snd_timer/sections/__ksymtab_strings create mode 100644 test/sys/module/snd_timer/sections/__param create mode 100644 test/sys/module/snd_timer/srcversion create mode 120000 test/sys/module/soundcore/holders/snd create mode 100644 test/sys/module/soundcore/initstate create mode 100644 test/sys/module/soundcore/notes/.note.gnu.build-id create mode 100644 test/sys/module/soundcore/refcnt create mode 100644 test/sys/module/soundcore/sections/.bss create mode 100644 test/sys/module/soundcore/sections/.data create mode 100644 test/sys/module/soundcore/sections/.exit.text create mode 100644 test/sys/module/soundcore/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/soundcore/sections/.init.text create mode 100644 test/sys/module/soundcore/sections/.note.gnu.build-id create mode 100644 test/sys/module/soundcore/sections/.rodata create mode 100644 test/sys/module/soundcore/sections/.rodata.str1.1 create mode 100644 test/sys/module/soundcore/sections/.strtab create mode 100644 test/sys/module/soundcore/sections/.symtab create mode 100644 test/sys/module/soundcore/sections/.text create mode 100644 test/sys/module/soundcore/sections/__kcrctab create mode 100644 test/sys/module/soundcore/sections/__ksymtab create mode 100644 test/sys/module/soundcore/sections/__ksymtab_strings create mode 100644 test/sys/module/soundcore/srcversion create mode 100644 test/sys/module/spurious/parameters/irqfixup create mode 100644 test/sys/module/spurious/parameters/noirqdebug create mode 100644 test/sys/module/sr_mod/initstate create mode 100644 test/sys/module/sr_mod/notes/.note.gnu.build-id create mode 100644 test/sys/module/sr_mod/parameters/xa_test create mode 100644 test/sys/module/sr_mod/refcnt create mode 100644 test/sys/module/sr_mod/sections/.bss create mode 100644 test/sys/module/sr_mod/sections/.data create mode 100644 test/sys/module/sr_mod/sections/.exit.text create mode 100644 test/sys/module/sr_mod/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/sr_mod/sections/.init.text create mode 100644 test/sys/module/sr_mod/sections/.note.gnu.build-id create mode 100644 test/sys/module/sr_mod/sections/.rodata create mode 100644 test/sys/module/sr_mod/sections/.rodata.str1.1 create mode 100644 test/sys/module/sr_mod/sections/.smp_locks create mode 100644 test/sys/module/sr_mod/sections/.strtab create mode 100644 test/sys/module/sr_mod/sections/.symtab create mode 100644 test/sys/module/sr_mod/sections/.text create mode 100644 test/sys/module/sr_mod/sections/__param create mode 100644 test/sys/module/sr_mod/srcversion create mode 100644 test/sys/module/tcp_cubic/parameters/beta create mode 100644 test/sys/module/tcp_cubic/parameters/bic_scale create mode 100644 test/sys/module/tcp_cubic/parameters/fast_convergence create mode 100644 test/sys/module/tcp_cubic/parameters/initial_ssthresh create mode 100644 test/sys/module/tcp_cubic/parameters/tcp_friendliness create mode 100644 test/sys/module/thermal/initstate create mode 100644 test/sys/module/thermal/notes/.note.gnu.build-id create mode 100644 test/sys/module/thermal/parameters/act create mode 100644 test/sys/module/thermal/parameters/crt create mode 100644 test/sys/module/thermal/parameters/psv create mode 100644 test/sys/module/thermal/parameters/tzp create mode 100644 test/sys/module/thermal/refcnt create mode 100644 test/sys/module/thermal/sections/.bss create mode 100644 test/sys/module/thermal/sections/.data create mode 100644 test/sys/module/thermal/sections/.exit.text create mode 100644 test/sys/module/thermal/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/thermal/sections/.init.data create mode 100644 test/sys/module/thermal/sections/.init.text create mode 100644 test/sys/module/thermal/sections/.note.gnu.build-id create mode 100644 test/sys/module/thermal/sections/.rodata create mode 100644 test/sys/module/thermal/sections/.rodata.str1.1 create mode 100644 test/sys/module/thermal/sections/.strtab create mode 100644 test/sys/module/thermal/sections/.symtab create mode 100644 test/sys/module/thermal/sections/.text create mode 100644 test/sys/module/thermal/sections/__param create mode 100644 test/sys/module/thermal/srcversion create mode 120000 test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_acpi create mode 120000 test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_hwmon create mode 100644 test/sys/module/thinkpad_acpi/initstate create mode 100644 test/sys/module/thinkpad_acpi/notes/.note.gnu.build-id create mode 100644 test/sys/module/thinkpad_acpi/refcnt create mode 100644 test/sys/module/thinkpad_acpi/sections/.bss create mode 100644 test/sys/module/thinkpad_acpi/sections/.data create mode 100644 test/sys/module/thinkpad_acpi/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/thinkpad_acpi/sections/.init.data create mode 100644 test/sys/module/thinkpad_acpi/sections/.init.text create mode 100644 test/sys/module/thinkpad_acpi/sections/.note.gnu.build-id create mode 100644 test/sys/module/thinkpad_acpi/sections/.rodata create mode 100644 test/sys/module/thinkpad_acpi/sections/.rodata.str1.1 create mode 100644 test/sys/module/thinkpad_acpi/sections/.smp_locks create mode 100644 test/sys/module/thinkpad_acpi/sections/.strtab create mode 100644 test/sys/module/thinkpad_acpi/sections/.symtab create mode 100644 test/sys/module/thinkpad_acpi/sections/.text create mode 100644 test/sys/module/thinkpad_acpi/sections/__bug_table create mode 100644 test/sys/module/thinkpad_acpi/sections/__param create mode 100644 test/sys/module/thinkpad_acpi/srcversion create mode 100644 test/sys/module/thinkpad_acpi/version create mode 120000 test/sys/module/uhci_hcd/drivers/pci:uhci_hcd create mode 100644 test/sys/module/uhci_hcd/initstate create mode 100644 test/sys/module/uhci_hcd/notes/.note.gnu.build-id create mode 100644 test/sys/module/uhci_hcd/parameters/ignore_oc create mode 100644 test/sys/module/uhci_hcd/refcnt create mode 100644 test/sys/module/uhci_hcd/sections/.bss create mode 100644 test/sys/module/uhci_hcd/sections/.data create mode 100644 test/sys/module/uhci_hcd/sections/.exit.text create mode 100644 test/sys/module/uhci_hcd/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/uhci_hcd/sections/.init.text create mode 100644 test/sys/module/uhci_hcd/sections/.note.gnu.build-id create mode 100644 test/sys/module/uhci_hcd/sections/.rodata create mode 100644 test/sys/module/uhci_hcd/sections/.rodata.str1.1 create mode 100644 test/sys/module/uhci_hcd/sections/.smp_locks create mode 100644 test/sys/module/uhci_hcd/sections/.strtab create mode 100644 test/sys/module/uhci_hcd/sections/.symtab create mode 100644 test/sys/module/uhci_hcd/sections/.text create mode 100644 test/sys/module/uhci_hcd/sections/__param create mode 100644 test/sys/module/uhci_hcd/srcversion create mode 100644 test/sys/module/uinput/initstate create mode 100644 test/sys/module/uinput/notes/.note.gnu.build-id create mode 100644 test/sys/module/uinput/refcnt create mode 100644 test/sys/module/uinput/sections/.bss create mode 100644 test/sys/module/uinput/sections/.data create mode 100644 test/sys/module/uinput/sections/.exit.text create mode 100644 test/sys/module/uinput/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/uinput/sections/.init.text create mode 100644 test/sys/module/uinput/sections/.note.gnu.build-id create mode 100644 test/sys/module/uinput/sections/.rodata create mode 100644 test/sys/module/uinput/sections/.rodata.str1.1 create mode 100644 test/sys/module/uinput/sections/.smp_locks create mode 100644 test/sys/module/uinput/sections/.strtab create mode 100644 test/sys/module/uinput/sections/.symtab create mode 100644 test/sys/module/uinput/sections/.text create mode 100644 test/sys/module/uinput/srcversion create mode 100644 test/sys/module/uinput/version create mode 120000 test/sys/module/usb_storage/drivers/usb:usb-storage create mode 100644 test/sys/module/usb_storage/initstate create mode 100644 test/sys/module/usb_storage/notes/.note.gnu.build-id create mode 100644 test/sys/module/usb_storage/parameters/delay_use create mode 100644 test/sys/module/usb_storage/parameters/swi_tru_install create mode 100644 test/sys/module/usb_storage/refcnt create mode 100644 test/sys/module/usb_storage/sections/.bss create mode 100644 test/sys/module/usb_storage/sections/.data create mode 100644 test/sys/module/usb_storage/sections/.exit.text create mode 100644 test/sys/module/usb_storage/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/usb_storage/sections/.init.text create mode 100644 test/sys/module/usb_storage/sections/.note.gnu.build-id create mode 100644 test/sys/module/usb_storage/sections/.rodata create mode 100644 test/sys/module/usb_storage/sections/.rodata.str1.1 create mode 100644 test/sys/module/usb_storage/sections/.smp_locks create mode 100644 test/sys/module/usb_storage/sections/.strtab create mode 100644 test/sys/module/usb_storage/sections/.symtab create mode 100644 test/sys/module/usb_storage/sections/.text create mode 100644 test/sys/module/usb_storage/sections/__param create mode 100644 test/sys/module/usb_storage/srcversion create mode 120000 test/sys/module/usbcore/drivers/usb:hub create mode 120000 test/sys/module/usbcore/drivers/usb:usb create mode 120000 test/sys/module/usbcore/drivers/usb:usbfs create mode 120000 test/sys/module/usbcore/holders/cdc_acm create mode 120000 test/sys/module/usbcore/holders/ehci_hcd create mode 120000 test/sys/module/usbcore/holders/uhci_hcd create mode 120000 test/sys/module/usbcore/holders/usb_storage create mode 120000 test/sys/module/usbcore/holders/usbhid create mode 100644 test/sys/module/usbcore/initstate create mode 100644 test/sys/module/usbcore/notes/.note.gnu.build-id create mode 100644 test/sys/module/usbcore/parameters/autosuspend create mode 100644 test/sys/module/usbcore/parameters/blinkenlights create mode 100644 test/sys/module/usbcore/parameters/nousb create mode 100644 test/sys/module/usbcore/parameters/old_scheme_first create mode 100644 test/sys/module/usbcore/parameters/usbfs_snoop create mode 100644 test/sys/module/usbcore/parameters/use_both_schemes create mode 100644 test/sys/module/usbcore/refcnt create mode 100644 test/sys/module/usbcore/sections/.bss create mode 100644 test/sys/module/usbcore/sections/.data create mode 100644 test/sys/module/usbcore/sections/.exit.text create mode 100644 test/sys/module/usbcore/sections/.fixup create mode 100644 test/sys/module/usbcore/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/usbcore/sections/.init.text create mode 100644 test/sys/module/usbcore/sections/.note.gnu.build-id create mode 100644 test/sys/module/usbcore/sections/.rodata create mode 100644 test/sys/module/usbcore/sections/.rodata.str1.1 create mode 100644 test/sys/module/usbcore/sections/.smp_locks create mode 100644 test/sys/module/usbcore/sections/.strtab create mode 100644 test/sys/module/usbcore/sections/.symtab create mode 100644 test/sys/module/usbcore/sections/.text create mode 100644 test/sys/module/usbcore/sections/__bug_table create mode 100644 test/sys/module/usbcore/sections/__ex_table create mode 100644 test/sys/module/usbcore/sections/__kcrctab_gpl create mode 100644 test/sys/module/usbcore/sections/__ksymtab_gpl create mode 100644 test/sys/module/usbcore/sections/__ksymtab_strings create mode 100644 test/sys/module/usbcore/sections/__param create mode 100644 test/sys/module/usbcore/srcversion create mode 120000 test/sys/module/usbhid/drivers/usb:usbhid create mode 100644 test/sys/module/usbhid/initstate create mode 100644 test/sys/module/usbhid/notes/.note.gnu.build-id create mode 100644 test/sys/module/usbhid/parameters/mousepoll create mode 100644 test/sys/module/usbhid/parameters/quirks create mode 100644 test/sys/module/usbhid/parameters/rdesc_quirks create mode 100644 test/sys/module/usbhid/refcnt create mode 100644 test/sys/module/usbhid/sections/.bss create mode 100644 test/sys/module/usbhid/sections/.data create mode 100644 test/sys/module/usbhid/sections/.exit.text create mode 100644 test/sys/module/usbhid/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/usbhid/sections/.init.text create mode 100644 test/sys/module/usbhid/sections/.note.gnu.build-id create mode 100644 test/sys/module/usbhid/sections/.rodata create mode 100644 test/sys/module/usbhid/sections/.rodata.str1.1 create mode 100644 test/sys/module/usbhid/sections/.smp_locks create mode 100644 test/sys/module/usbhid/sections/.strtab create mode 100644 test/sys/module/usbhid/sections/.symtab create mode 100644 test/sys/module/usbhid/sections/.text create mode 100644 test/sys/module/usbhid/sections/__kcrctab_gpl create mode 100644 test/sys/module/usbhid/sections/__ksymtab_gpl create mode 100644 test/sys/module/usbhid/sections/__ksymtab_strings create mode 100644 test/sys/module/usbhid/sections/__param create mode 100644 test/sys/module/usbhid/srcversion create mode 100644 test/sys/module/vt/parameters/default_blu create mode 100644 test/sys/module/vt/parameters/default_grn create mode 100644 test/sys/module/vt/parameters/default_red create mode 100644 test/sys/module/vt/parameters/default_utf8 create mode 100644 test/sys/module/vt/parameters/italic create mode 100644 test/sys/module/vt/parameters/underline create mode 120000 test/sys/module/yenta_socket/drivers/pci:yenta_cardbus create mode 100644 test/sys/module/yenta_socket/initstate create mode 100644 test/sys/module/yenta_socket/notes/.note.gnu.build-id create mode 100644 test/sys/module/yenta_socket/parameters/disable_clkrun create mode 100644 test/sys/module/yenta_socket/parameters/isa_probe create mode 100644 test/sys/module/yenta_socket/parameters/pwr_irqs_off create mode 100644 test/sys/module/yenta_socket/refcnt create mode 100644 test/sys/module/yenta_socket/sections/.bss create mode 100644 test/sys/module/yenta_socket/sections/.data create mode 100644 test/sys/module/yenta_socket/sections/.devinit.text create mode 100644 test/sys/module/yenta_socket/sections/.exit.text create mode 100644 test/sys/module/yenta_socket/sections/.gnu.linkonce.this_module create mode 100644 test/sys/module/yenta_socket/sections/.init.text create mode 100644 test/sys/module/yenta_socket/sections/.note.gnu.build-id create mode 100644 test/sys/module/yenta_socket/sections/.rodata create mode 100644 test/sys/module/yenta_socket/sections/.rodata.str1.1 create mode 100644 test/sys/module/yenta_socket/sections/.strtab create mode 100644 test/sys/module/yenta_socket/sections/.symtab create mode 100644 test/sys/module/yenta_socket/sections/.text create mode 100644 test/sys/module/yenta_socket/sections/__bug_table create mode 100644 test/sys/module/yenta_socket/sections/__param create mode 100644 test/sys/module/yenta_socket/srcversion create mode 100644 test/sys/power/state diff --git a/TODO b/TODO index b4e0809c80..2cbb7cc1c7 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,8 @@ -#129 o use enumerate for "trigger" - o libudev queue - interface for /dev/.udev/queue/ state + o add libudev queue - interface for /dev/.udev/queue/ state use queue interface for "settle" - o relace test/sys/ with current sysfs layout and adapt test +#129 -#130+ o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator o rework rules to a match-action list, instead of a rules array diff --git a/test/sys/block/cciss!c0d0/cciss!c0d0p1/dev b/test/sys/block/cciss!c0d0/cciss!c0d0p1/dev deleted file mode 100644 index 92c4b9b088..0000000000 --- a/test/sys/block/cciss!c0d0/cciss!c0d0p1/dev +++ /dev/null @@ -1 +0,0 @@ -8:1 diff --git a/test/sys/block/cciss!c0d0/cciss!c0d0p2/dev b/test/sys/block/cciss!c0d0/cciss!c0d0p2/dev deleted file mode 100644 index 9799a2674a..0000000000 --- a/test/sys/block/cciss!c0d0/cciss!c0d0p2/dev +++ /dev/null @@ -1 +0,0 @@ -8:2 diff --git a/test/sys/block/cciss!c0d0/cciss!c0d0p5/dev b/test/sys/block/cciss!c0d0/cciss!c0d0p5/dev deleted file mode 100644 index b3d5042192..0000000000 --- a/test/sys/block/cciss!c0d0/cciss!c0d0p5/dev +++ /dev/null @@ -1 +0,0 @@ -8:5 diff --git a/test/sys/block/cciss!c0d0/dev b/test/sys/block/cciss!c0d0/dev deleted file mode 100644 index fae0a50572..0000000000 --- a/test/sys/block/cciss!c0d0/dev +++ /dev/null @@ -1 +0,0 @@ -8:0 diff --git a/test/sys/block/cciss!c0d0/device b/test/sys/block/cciss!c0d0/device deleted file mode 120000 index 485bf09f61..0000000000 --- a/test/sys/block/cciss!c0d0/device +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/loop0 b/test/sys/block/loop0 new file mode 120000 index 0000000000..caf270b78b --- /dev/null +++ b/test/sys/block/loop0 @@ -0,0 +1 @@ +../devices/virtual/block/loop0 \ No newline at end of file diff --git a/test/sys/block/loop1 b/test/sys/block/loop1 new file mode 120000 index 0000000000..ad28556992 --- /dev/null +++ b/test/sys/block/loop1 @@ -0,0 +1 @@ +../devices/virtual/block/loop1 \ No newline at end of file diff --git a/test/sys/block/loop2 b/test/sys/block/loop2 new file mode 120000 index 0000000000..cd6da29c2f --- /dev/null +++ b/test/sys/block/loop2 @@ -0,0 +1 @@ +../devices/virtual/block/loop2 \ No newline at end of file diff --git a/test/sys/block/loop3 b/test/sys/block/loop3 new file mode 120000 index 0000000000..69a4794dbb --- /dev/null +++ b/test/sys/block/loop3 @@ -0,0 +1 @@ +../devices/virtual/block/loop3 \ No newline at end of file diff --git a/test/sys/block/loop4 b/test/sys/block/loop4 new file mode 120000 index 0000000000..8244471b16 --- /dev/null +++ b/test/sys/block/loop4 @@ -0,0 +1 @@ +../devices/virtual/block/loop4 \ No newline at end of file diff --git a/test/sys/block/loop5 b/test/sys/block/loop5 new file mode 120000 index 0000000000..9b436c9d67 --- /dev/null +++ b/test/sys/block/loop5 @@ -0,0 +1 @@ +../devices/virtual/block/loop5 \ No newline at end of file diff --git a/test/sys/block/loop6 b/test/sys/block/loop6 new file mode 120000 index 0000000000..b968dfdabb --- /dev/null +++ b/test/sys/block/loop6 @@ -0,0 +1 @@ +../devices/virtual/block/loop6 \ No newline at end of file diff --git a/test/sys/block/loop7 b/test/sys/block/loop7 new file mode 120000 index 0000000000..947b66f25c --- /dev/null +++ b/test/sys/block/loop7 @@ -0,0 +1 @@ +../devices/virtual/block/loop7 \ No newline at end of file diff --git a/test/sys/block/md0 b/test/sys/block/md0 new file mode 120000 index 0000000000..2a12b5d3fa --- /dev/null +++ b/test/sys/block/md0 @@ -0,0 +1 @@ +../devices/virtual/block/md0 \ No newline at end of file diff --git a/test/sys/block/rd!c0d0/dev b/test/sys/block/rd!c0d0/dev deleted file mode 100644 index fae0a50572..0000000000 --- a/test/sys/block/rd!c0d0/dev +++ /dev/null @@ -1 +0,0 @@ -8:0 diff --git a/test/sys/block/rd!c0d0/device b/test/sys/block/rd!c0d0/device deleted file mode 120000 index 485bf09f61..0000000000 --- a/test/sys/block/rd!c0d0/device +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/sda b/test/sys/block/sda new file mode 120000 index 0000000000..623767d6b6 --- /dev/null +++ b/test/sys/block/sda @@ -0,0 +1 @@ +../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda \ No newline at end of file diff --git a/test/sys/block/sda/dev b/test/sys/block/sda/dev deleted file mode 100644 index fae0a50572..0000000000 --- a/test/sys/block/sda/dev +++ /dev/null @@ -1 +0,0 @@ -8:0 diff --git a/test/sys/block/sda/device b/test/sys/block/sda/device deleted file mode 120000 index 485bf09f61..0000000000 --- a/test/sys/block/sda/device +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/block/sda/queue/iosched/antic_expire b/test/sys/block/sda/queue/iosched/antic_expire deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/block/sda/queue/iosched/antic_expire +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/block/sda/queue/iosched/read_batch_expire b/test/sys/block/sda/queue/iosched/read_batch_expire deleted file mode 100644 index 08839f6bb2..0000000000 --- a/test/sys/block/sda/queue/iosched/read_batch_expire +++ /dev/null @@ -1 +0,0 @@ -200 diff --git a/test/sys/block/sda/queue/iosched/read_expire b/test/sys/block/sda/queue/iosched/read_expire deleted file mode 100644 index e373ee695f..0000000000 --- a/test/sys/block/sda/queue/iosched/read_expire +++ /dev/null @@ -1 +0,0 @@ -50 diff --git a/test/sys/block/sda/queue/iosched/write_batch_expire b/test/sys/block/sda/queue/iosched/write_batch_expire deleted file mode 100644 index e373ee695f..0000000000 --- a/test/sys/block/sda/queue/iosched/write_batch_expire +++ /dev/null @@ -1 +0,0 @@ -50 diff --git a/test/sys/block/sda/queue/iosched/write_expire b/test/sys/block/sda/queue/iosched/write_expire deleted file mode 100644 index 08839f6bb2..0000000000 --- a/test/sys/block/sda/queue/iosched/write_expire +++ /dev/null @@ -1 +0,0 @@ -200 diff --git a/test/sys/block/sda/queue/nr_requests b/test/sys/block/sda/queue/nr_requests deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/block/sda/queue/nr_requests +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/block/sda/range b/test/sys/block/sda/range deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/block/sda/range +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/block/sda/sda1/dev b/test/sys/block/sda/sda1/dev deleted file mode 100644 index 92c4b9b088..0000000000 --- a/test/sys/block/sda/sda1/dev +++ /dev/null @@ -1 +0,0 @@ -8:1 diff --git a/test/sys/block/sda/sda1/size b/test/sys/block/sda/sda1/size deleted file mode 100644 index f00a59241e..0000000000 --- a/test/sys/block/sda/sda1/size +++ /dev/null @@ -1 +0,0 @@ -1060227 diff --git a/test/sys/block/sda/sda1/start b/test/sys/block/sda/sda1/start deleted file mode 100644 index 4b9026d8e2..0000000000 --- a/test/sys/block/sda/sda1/start +++ /dev/null @@ -1 +0,0 @@ -63 diff --git a/test/sys/block/sda/sda1/stat b/test/sys/block/sda/sda1/stat deleted file mode 100644 index 199ce7330b..0000000000 --- a/test/sys/block/sda/sda1/stat +++ /dev/null @@ -1 +0,0 @@ - 50 400 103 824 diff --git a/test/sys/block/sda/sda1/subsystem b/test/sys/block/sda/sda1/subsystem deleted file mode 120000 index bc3873f9ee..0000000000 --- a/test/sys/block/sda/sda1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../block \ No newline at end of file diff --git a/test/sys/block/sda/sda2/dev b/test/sys/block/sda/sda2/dev deleted file mode 100644 index 9799a2674a..0000000000 --- a/test/sys/block/sda/sda2/dev +++ /dev/null @@ -1 +0,0 @@ -8:2 diff --git a/test/sys/block/sda/sda2/size b/test/sys/block/sda/sda2/size deleted file mode 100644 index 80483ab968..0000000000 --- a/test/sys/block/sda/sda2/size +++ /dev/null @@ -1 +0,0 @@ -112455 diff --git a/test/sys/block/sda/sda2/start b/test/sys/block/sda/sda2/start deleted file mode 100644 index 3a4bf076fc..0000000000 --- a/test/sys/block/sda/sda2/start +++ /dev/null @@ -1 +0,0 @@ -1060290 diff --git a/test/sys/block/sda/sda2/stat b/test/sys/block/sda/sda2/stat deleted file mode 100644 index c06b749cd1..0000000000 --- a/test/sys/block/sda/sda2/stat +++ /dev/null @@ -1 +0,0 @@ - 342 500 15 30 diff --git a/test/sys/block/sda/sda2/subsystem b/test/sys/block/sda/sda2/subsystem deleted file mode 120000 index bc3873f9ee..0000000000 --- a/test/sys/block/sda/sda2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../block \ No newline at end of file diff --git a/test/sys/block/sda/sda3/dev b/test/sys/block/sda/sda3/dev deleted file mode 100644 index 44ccff41b0..0000000000 --- a/test/sys/block/sda/sda3/dev +++ /dev/null @@ -1 +0,0 @@ -8:3 diff --git a/test/sys/block/sda/sda3/size b/test/sys/block/sda/sda3/size deleted file mode 100644 index 1373b38f8d..0000000000 --- a/test/sys/block/sda/sda3/size +++ /dev/null @@ -1 +0,0 @@ -20482875 diff --git a/test/sys/block/sda/sda3/start b/test/sys/block/sda/sda3/start deleted file mode 100644 index cab5c33336..0000000000 --- a/test/sys/block/sda/sda3/start +++ /dev/null @@ -1 +0,0 @@ -1172745 diff --git a/test/sys/block/sda/sda3/stat b/test/sys/block/sda/sda3/stat deleted file mode 100644 index 82fb1463a1..0000000000 --- a/test/sys/block/sda/sda3/stat +++ /dev/null @@ -1 +0,0 @@ - 415052 6872874 669740 5357920 diff --git a/test/sys/block/sda/sda3/subsystem b/test/sys/block/sda/sda3/subsystem deleted file mode 120000 index bc3873f9ee..0000000000 --- a/test/sys/block/sda/sda3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../block \ No newline at end of file diff --git a/test/sys/block/sda/sda4/dev b/test/sys/block/sda/sda4/dev deleted file mode 100644 index aab3fc56e1..0000000000 --- a/test/sys/block/sda/sda4/dev +++ /dev/null @@ -1 +0,0 @@ -8:4 diff --git a/test/sys/block/sda/sda4/size b/test/sys/block/sda/sda4/size deleted file mode 100644 index 062619c44b..0000000000 --- a/test/sys/block/sda/sda4/size +++ /dev/null @@ -1 +0,0 @@ -49432005 diff --git a/test/sys/block/sda/sda4/start b/test/sys/block/sda/sda4/start deleted file mode 100644 index b65020c801..0000000000 --- a/test/sys/block/sda/sda4/start +++ /dev/null @@ -1 +0,0 @@ -21655620 diff --git a/test/sys/block/sda/sda4/stat b/test/sys/block/sda/sda4/stat deleted file mode 100644 index 3e7b7ad75c..0000000000 --- a/test/sys/block/sda/sda4/stat +++ /dev/null @@ -1 +0,0 @@ - 642730 9095506 275223 2201728 diff --git a/test/sys/block/sda/sda4/subsystem b/test/sys/block/sda/sda4/subsystem deleted file mode 120000 index bc3873f9ee..0000000000 --- a/test/sys/block/sda/sda4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../block \ No newline at end of file diff --git a/test/sys/block/sda/size b/test/sys/block/sda/size deleted file mode 100644 index 88da032f61..0000000000 --- a/test/sys/block/sda/size +++ /dev/null @@ -1 +0,0 @@ -71096640 diff --git a/test/sys/block/sda/stat b/test/sys/block/sda/stat deleted file mode 100644 index b93c7d4ac4..0000000000 --- a/test/sys/block/sda/stat +++ /dev/null @@ -1 +0,0 @@ - 1043906 19157 16008400 4313104 317001 625161 7560502 48785829 0 3846686 53153390 diff --git a/test/sys/block/sda/subsystem b/test/sys/block/sda/subsystem deleted file mode 120000 index f33eb2721f..0000000000 --- a/test/sys/block/sda/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../block \ No newline at end of file diff --git a/test/sys/block/sda/test:colon+plus b/test/sys/block/sda/test:colon+plus deleted file mode 100644 index 0fed9a5d60..0000000000 --- a/test/sys/block/sda/test:colon+plus +++ /dev/null @@ -1 +0,0 @@ -colon diff --git a/test/sys/block/sdb b/test/sys/block/sdb new file mode 120000 index 0000000000..8b7c0c4713 --- /dev/null +++ b/test/sys/block/sdb @@ -0,0 +1 @@ +../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb \ No newline at end of file diff --git a/test/sys/block/sr0 b/test/sys/block/sr0 new file mode 120000 index 0000000000..c61fe209d6 --- /dev/null +++ b/test/sys/block/sr0 @@ -0,0 +1 @@ +../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/ACPI0003:00 b/test/sys/bus/acpi/devices/ACPI0003:00 new file mode 120000 index 0000000000..655d3c2b80 --- /dev/null +++ b/test/sys/bus/acpi/devices/ACPI0003:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/ACPI0007:00 b/test/sys/bus/acpi/devices/ACPI0007:00 new file mode 120000 index 0000000000..81838c937a --- /dev/null +++ b/test/sys/bus/acpi/devices/ACPI0007:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/ACPI0007:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/ACPI0007:01 b/test/sys/bus/acpi/devices/ACPI0007:01 new file mode 120000 index 0000000000..898e064922 --- /dev/null +++ b/test/sys/bus/acpi/devices/ACPI0007:01 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/ACPI0007:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/ATM1200:00 b/test/sys/bus/acpi/devices/ATM1200:00 new file mode 120000 index 0000000000..32ea54ccc9 --- /dev/null +++ b/test/sys/bus/acpi/devices/ATM1200:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/IBM0057:00 b/test/sys/bus/acpi/devices/IBM0057:00 new file mode 120000 index 0000000000..2160bb1b20 --- /dev/null +++ b/test/sys/bus/acpi/devices/IBM0057:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/IBM0068:00 b/test/sys/bus/acpi/devices/IBM0068:00 new file mode 120000 index 0000000000..8cc3fb2a56 --- /dev/null +++ b/test/sys/bus/acpi/devices/IBM0068:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/IBM0079:00 b/test/sys/bus/acpi/devices/IBM0079:00 new file mode 120000 index 0000000000..37a83b4286 --- /dev/null +++ b/test/sys/bus/acpi/devices/IBM0079:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/IBM0079:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXPOWER:00 b/test/sys/bus/acpi/devices/LNXPOWER:00 new file mode 120000 index 0000000000..bc1e9ec5fd --- /dev/null +++ b/test/sys/bus/acpi/devices/LNXPOWER:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXPWRBN:00 b/test/sys/bus/acpi/devices/LNXPWRBN:00 new file mode 120000 index 0000000000..3d630ea18b --- /dev/null +++ b/test/sys/bus/acpi/devices/LNXPWRBN:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/LNXPWRBN:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXSYSTM:00 b/test/sys/bus/acpi/devices/LNXSYSTM:00 new file mode 120000 index 0000000000..c72f26c090 --- /dev/null +++ b/test/sys/bus/acpi/devices/LNXSYSTM:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXTHERM:00 b/test/sys/bus/acpi/devices/LNXTHERM:00 new file mode 120000 index 0000000000..0d88be41d3 --- /dev/null +++ b/test/sys/bus/acpi/devices/LNXTHERM:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/LNXTHERM:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXTHERM:01 b/test/sys/bus/acpi/devices/LNXTHERM:01 new file mode 120000 index 0000000000..bb2431d1f3 --- /dev/null +++ b/test/sys/bus/acpi/devices/LNXTHERM:01 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXTHERM:02 b/test/sys/bus/acpi/devices/LNXTHERM:02 new file mode 120000 index 0000000000..8b5c6c91df --- /dev/null +++ b/test/sys/bus/acpi/devices/LNXTHERM:02 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0000:00 b/test/sys/bus/acpi/devices/PNP0000:00 new file mode 120000 index 0000000000..c67279b47b --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0000:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0100:00 b/test/sys/bus/acpi/devices/PNP0100:00 new file mode 120000 index 0000000000..87b7a787cd --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0100:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0103:00 b/test/sys/bus/acpi/devices/PNP0103:00 new file mode 120000 index 0000000000..ff1c0e5cf0 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0103:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0200:00 b/test/sys/bus/acpi/devices/PNP0200:00 new file mode 120000 index 0000000000..81809075f1 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0200:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0303:00 b/test/sys/bus/acpi/devices/PNP0303:00 new file mode 120000 index 0000000000..cd99abcc2c --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0303:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0800:00 b/test/sys/bus/acpi/devices/PNP0800:00 new file mode 120000 index 0000000000..f0ffdfa1db --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0800:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0A08:00 b/test/sys/bus/acpi/devices/PNP0A08:00 new file mode 120000 index 0000000000..99592aef58 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0A08:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0B00:00 b/test/sys/bus/acpi/devices/PNP0B00:00 new file mode 120000 index 0000000000..6cb2d7c575 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0B00:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C01:00 b/test/sys/bus/acpi/devices/PNP0C01:00 new file mode 120000 index 0000000000..197577a13f --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C01:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C01:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C02:00 b/test/sys/bus/acpi/devices/PNP0C02:00 new file mode 120000 index 0000000000..077939468e --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C02:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C04:00 b/test/sys/bus/acpi/devices/PNP0C04:00 new file mode 120000 index 0000000000..75c2e30b70 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C04:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C09:00 b/test/sys/bus/acpi/devices/PNP0C09:00 new file mode 120000 index 0000000000..0d813f6351 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C09:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0A:00 b/test/sys/bus/acpi/devices/PNP0C0A:00 new file mode 120000 index 0000000000..8f050d9a62 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0A:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0D:00 b/test/sys/bus/acpi/devices/PNP0C0D:00 new file mode 120000 index 0000000000..4aa9bb0093 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0D:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0D:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0E:00 b/test/sys/bus/acpi/devices/PNP0C0E:00 new file mode 120000 index 0000000000..9124fb2f19 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0E:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0E:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:00 b/test/sys/bus/acpi/devices/PNP0C0F:00 new file mode 120000 index 0000000000..3fafe1361f --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0F:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0F:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:01 b/test/sys/bus/acpi/devices/PNP0C0F:01 new file mode 120000 index 0000000000..1c40af1325 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0F:01 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0F:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:02 b/test/sys/bus/acpi/devices/PNP0C0F:02 new file mode 120000 index 0000000000..09320cf8cf --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0F:02 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0F:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:03 b/test/sys/bus/acpi/devices/PNP0C0F:03 new file mode 120000 index 0000000000..0c2fbb5115 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0F:03 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0F:03 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:04 b/test/sys/bus/acpi/devices/PNP0C0F:04 new file mode 120000 index 0000000000..6119670a38 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0F:04 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0F:04 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:05 b/test/sys/bus/acpi/devices/PNP0C0F:05 new file mode 120000 index 0000000000..50fd3653b7 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0F:05 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0F:05 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:06 b/test/sys/bus/acpi/devices/PNP0C0F:06 new file mode 120000 index 0000000000..ffc5553f15 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0F:06 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0F:06 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:07 b/test/sys/bus/acpi/devices/PNP0C0F:07 new file mode 120000 index 0000000000..3f1ea32333 --- /dev/null +++ b/test/sys/bus/acpi/devices/PNP0C0F:07 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0C0F:07 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:00 b/test/sys/bus/acpi/devices/device:00 new file mode 120000 index 0000000000..4e97101d3d --- /dev/null +++ b/test/sys/bus/acpi/devices/device:00 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:01 b/test/sys/bus/acpi/devices/device:01 new file mode 120000 index 0000000000..dc2eff75ab --- /dev/null +++ b/test/sys/bus/acpi/devices/device:01 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:02 b/test/sys/bus/acpi/devices/device:02 new file mode 120000 index 0000000000..7a96002f9f --- /dev/null +++ b/test/sys/bus/acpi/devices/device:02 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:03 b/test/sys/bus/acpi/devices/device:03 new file mode 120000 index 0000000000..78b1f241b2 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:03 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:04 b/test/sys/bus/acpi/devices/device:04 new file mode 120000 index 0000000000..9e843d76fd --- /dev/null +++ b/test/sys/bus/acpi/devices/device:04 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:05 b/test/sys/bus/acpi/devices/device:05 new file mode 120000 index 0000000000..a4f6682167 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:05 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:06 b/test/sys/bus/acpi/devices/device:06 new file mode 120000 index 0000000000..ed5e6b1f99 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:06 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:07 b/test/sys/bus/acpi/devices/device:07 new file mode 120000 index 0000000000..f69fa70fb2 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:07 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:08 b/test/sys/bus/acpi/devices/device:08 new file mode 120000 index 0000000000..ed31186527 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:08 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:09 b/test/sys/bus/acpi/devices/device:09 new file mode 120000 index 0000000000..194fcaaf12 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:09 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0a b/test/sys/bus/acpi/devices/device:0a new file mode 120000 index 0000000000..9e9aad8d1d --- /dev/null +++ b/test/sys/bus/acpi/devices/device:0a @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0b b/test/sys/bus/acpi/devices/device:0b new file mode 120000 index 0000000000..9f16cff1ef --- /dev/null +++ b/test/sys/bus/acpi/devices/device:0b @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0c b/test/sys/bus/acpi/devices/device:0c new file mode 120000 index 0000000000..a57d0300db --- /dev/null +++ b/test/sys/bus/acpi/devices/device:0c @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0d b/test/sys/bus/acpi/devices/device:0d new file mode 120000 index 0000000000..34f57dc91c --- /dev/null +++ b/test/sys/bus/acpi/devices/device:0d @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0e b/test/sys/bus/acpi/devices/device:0e new file mode 120000 index 0000000000..1c1326f6d7 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:0e @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0f b/test/sys/bus/acpi/devices/device:0f new file mode 120000 index 0000000000..2426961458 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:0f @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:10 b/test/sys/bus/acpi/devices/device:10 new file mode 120000 index 0000000000..5339f6708e --- /dev/null +++ b/test/sys/bus/acpi/devices/device:10 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:11 b/test/sys/bus/acpi/devices/device:11 new file mode 120000 index 0000000000..dbb93de0f7 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:11 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:12 b/test/sys/bus/acpi/devices/device:12 new file mode 120000 index 0000000000..d715768d07 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:12 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:13 b/test/sys/bus/acpi/devices/device:13 new file mode 120000 index 0000000000..bb3033f5cc --- /dev/null +++ b/test/sys/bus/acpi/devices/device:13 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:14 b/test/sys/bus/acpi/devices/device:14 new file mode 120000 index 0000000000..813cac7cb7 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:14 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:15 b/test/sys/bus/acpi/devices/device:15 new file mode 120000 index 0000000000..75f3012ade --- /dev/null +++ b/test/sys/bus/acpi/devices/device:15 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:16 b/test/sys/bus/acpi/devices/device:16 new file mode 120000 index 0000000000..c03c72704f --- /dev/null +++ b/test/sys/bus/acpi/devices/device:16 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:17 b/test/sys/bus/acpi/devices/device:17 new file mode 120000 index 0000000000..7de3b0e648 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:17 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:18 b/test/sys/bus/acpi/devices/device:18 new file mode 120000 index 0000000000..1ce92876f5 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:18 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:19 b/test/sys/bus/acpi/devices/device:19 new file mode 120000 index 0000000000..1180346499 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:19 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1a b/test/sys/bus/acpi/devices/device:1a new file mode 120000 index 0000000000..618f261610 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:1a @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1b b/test/sys/bus/acpi/devices/device:1b new file mode 120000 index 0000000000..9f5c9e2ed8 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:1b @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1c b/test/sys/bus/acpi/devices/device:1c new file mode 120000 index 0000000000..25c0b84323 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:1c @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1d b/test/sys/bus/acpi/devices/device:1d new file mode 120000 index 0000000000..19fb701973 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:1d @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1e b/test/sys/bus/acpi/devices/device:1e new file mode 120000 index 0000000000..05d6d3d017 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:1e @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1f b/test/sys/bus/acpi/devices/device:1f new file mode 120000 index 0000000000..e68bcc3f0a --- /dev/null +++ b/test/sys/bus/acpi/devices/device:1f @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:20 b/test/sys/bus/acpi/devices/device:20 new file mode 120000 index 0000000000..26bfff520a --- /dev/null +++ b/test/sys/bus/acpi/devices/device:20 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:21 b/test/sys/bus/acpi/devices/device:21 new file mode 120000 index 0000000000..f9d5c37d3c --- /dev/null +++ b/test/sys/bus/acpi/devices/device:21 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:22 b/test/sys/bus/acpi/devices/device:22 new file mode 120000 index 0000000000..15947672e9 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:22 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:23 b/test/sys/bus/acpi/devices/device:23 new file mode 120000 index 0000000000..8a81978ad8 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:23 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:24 b/test/sys/bus/acpi/devices/device:24 new file mode 120000 index 0000000000..718669b245 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:24 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:25 b/test/sys/bus/acpi/devices/device:25 new file mode 120000 index 0000000000..1055658761 --- /dev/null +++ b/test/sys/bus/acpi/devices/device:25 @@ -0,0 +1 @@ +../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/ac/ACPI0003:00 b/test/sys/bus/acpi/drivers/ac/ACPI0003:00 new file mode 120000 index 0000000000..bb4955228d --- /dev/null +++ b/test/sys/bus/acpi/drivers/ac/ACPI0003:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/battery/PNP0C0A:00 b/test/sys/bus/acpi/drivers/battery/PNP0C0A:00 new file mode 120000 index 0000000000..7f7754c48c --- /dev/null +++ b/test/sys/bus/acpi/drivers/battery/PNP0C0A:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/button/LNXPWRBN:00 b/test/sys/bus/acpi/drivers/button/LNXPWRBN:00 new file mode 120000 index 0000000000..94bfa02ebb --- /dev/null +++ b/test/sys/bus/acpi/drivers/button/LNXPWRBN:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/LNXPWRBN:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/button/PNP0C0D:00 b/test/sys/bus/acpi/drivers/button/PNP0C0D:00 new file mode 120000 index 0000000000..8488f42871 --- /dev/null +++ b/test/sys/bus/acpi/drivers/button/PNP0C0D:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0D:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/button/PNP0C0E:00 b/test/sys/bus/acpi/drivers/button/PNP0C0E:00 new file mode 120000 index 0000000000..2324f7314d --- /dev/null +++ b/test/sys/bus/acpi/drivers/button/PNP0C0E:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0E:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/ec/PNP0C09:00 b/test/sys/bus/acpi/drivers/ec/PNP0C09:00 new file mode 120000 index 0000000000..bb79fa762a --- /dev/null +++ b/test/sys/bus/acpi/drivers/ec/PNP0C09:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 new file mode 120000 index 0000000000..1d774fb92c --- /dev/null +++ b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 new file mode 120000 index 0000000000..248ca41a00 --- /dev/null +++ b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 new file mode 120000 index 0000000000..a96a10bf11 --- /dev/null +++ b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 new file mode 120000 index 0000000000..e0a724bbb0 --- /dev/null +++ b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:03 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 new file mode 120000 index 0000000000..8c9b8e2e8b --- /dev/null +++ b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:04 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 new file mode 120000 index 0000000000..f5ec92970e --- /dev/null +++ b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:05 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 new file mode 120000 index 0000000000..e8e6ce971a --- /dev/null +++ b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:06 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 new file mode 120000 index 0000000000..0a2a79c177 --- /dev/null +++ b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:07 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 b/test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 new file mode 120000 index 0000000000..b0535ab690 --- /dev/null +++ b/test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/power/LNXPOWER:00 b/test/sys/bus/acpi/drivers/power/LNXPOWER:00 new file mode 120000 index 0000000000..f0eb1b9da1 --- /dev/null +++ b/test/sys/bus/acpi/drivers/power/LNXPOWER:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/processor/ACPI0007:00 b/test/sys/bus/acpi/drivers/processor/ACPI0007:00 new file mode 120000 index 0000000000..fe29ff7547 --- /dev/null +++ b/test/sys/bus/acpi/drivers/processor/ACPI0007:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/ACPI0007:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/processor/ACPI0007:01 b/test/sys/bus/acpi/drivers/processor/ACPI0007:01 new file mode 120000 index 0000000000..38d000407a --- /dev/null +++ b/test/sys/bus/acpi/drivers/processor/ACPI0007:01 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/ACPI0007:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 b/test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 new file mode 120000 index 0000000000..bbedbc8312 --- /dev/null +++ b/test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 b/test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 new file mode 120000 index 0000000000..ca295600e1 --- /dev/null +++ b/test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 b/test/sys/bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 new file mode 120000 index 0000000000..1d4b168b38 --- /dev/null +++ b/test/sys/bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 @@ -0,0 +1 @@ +../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers_autoprobe b/test/sys/bus/acpi/drivers_autoprobe new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/bus/acpi/drivers_autoprobe @@ -0,0 +1 @@ +1 diff --git a/test/sys/bus/acpi/drivers_probe b/test/sys/bus/acpi/drivers_probe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/acpi/uevent b/test/sys/bus/acpi/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/pci/devices/0000:00:00.0 b/test/sys/bus/pci/devices/0000:00:00.0 new file mode 120000 index 0000000000..e61686a507 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:00.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:01.0 b/test/sys/bus/pci/devices/0000:00:01.0 new file mode 120000 index 0000000000..2d40bc9782 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:01.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:01.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:09.0 b/test/sys/bus/pci/devices/0000:00:09.0 deleted file mode 120000 index 1c776568bd..0000000000 --- a/test/sys/bus/pci/devices/0000:00:09.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1b.0 b/test/sys/bus/pci/devices/0000:00:1b.0 new file mode 120000 index 0000000000..b1f192d9a7 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1b.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1b.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1c.0 b/test/sys/bus/pci/devices/0000:00:1c.0 new file mode 120000 index 0000000000..4bf4f01884 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1c.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1c.1 b/test/sys/bus/pci/devices/0000:00:1c.1 new file mode 120000 index 0000000000..7d501ef205 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1c.1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.1 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1c.2 b/test/sys/bus/pci/devices/0000:00:1c.2 new file mode 120000 index 0000000000..43a55a338d --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1c.2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.2 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1c.3 b/test/sys/bus/pci/devices/0000:00:1c.3 new file mode 120000 index 0000000000..342b8b5889 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1c.3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.3 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1d.0 b/test/sys/bus/pci/devices/0000:00:1d.0 new file mode 120000 index 0000000000..b883309173 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1d.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1d.1 b/test/sys/bus/pci/devices/0000:00:1d.1 new file mode 120000 index 0000000000..c9058b7776 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1d.1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.1 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1d.2 b/test/sys/bus/pci/devices/0000:00:1d.2 new file mode 120000 index 0000000000..c94140da28 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1d.2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.2 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1d.3 b/test/sys/bus/pci/devices/0000:00:1d.3 new file mode 120000 index 0000000000..75b0de6506 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1d.3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1f.0 b/test/sys/bus/pci/devices/0000:00:1f.0 new file mode 120000 index 0000000000..11b66db1e3 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1f.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1f.1 b/test/sys/bus/pci/devices/0000:00:1f.1 new file mode 120000 index 0000000000..005f9fdf7d --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1f.1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.1 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1f.2 b/test/sys/bus/pci/devices/0000:00:1f.2 new file mode 120000 index 0000000000..cb9f3ca449 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1f.2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.2 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1f.3 b/test/sys/bus/pci/devices/0000:00:1f.3 new file mode 120000 index 0000000000..c1efad804e --- /dev/null +++ b/test/sys/bus/pci/devices/0000:00:1f.3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.3 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:01:00.0 b/test/sys/bus/pci/devices/0000:01:00.0 new file mode 120000 index 0000000000..db204c1ff1 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:01:00.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:01.0/0000:01:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:02:00.0 b/test/sys/bus/pci/devices/0000:02:00.0 new file mode 120000 index 0000000000..24aa5ee776 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:02:00.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.0/0000:02:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:02:05.0 b/test/sys/bus/pci/devices/0000:02:05.0 deleted file mode 120000 index 630d35bf61..0000000000 --- a/test/sys/bus/pci/devices/0000:02:05.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:03:00.0 b/test/sys/bus/pci/devices/0000:03:00.0 new file mode 120000 index 0000000000..3770ce19b9 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:03:00.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:15:00.0 b/test/sys/bus/pci/devices/0000:15:00.0 new file mode 120000 index 0000000000..5cbde66843 --- /dev/null +++ b/test/sys/bus/pci/devices/0000:15:00.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1e.0/0000:15:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 b/test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 new file mode 120000 index 0000000000..e7529cd08b --- /dev/null +++ b/test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1b.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/HDA Intel/module b/test/sys/bus/pci/drivers/HDA Intel/module new file mode 120000 index 0000000000..86642bc49e --- /dev/null +++ b/test/sys/bus/pci/drivers/HDA Intel/module @@ -0,0 +1 @@ +../../../../module/snd_hda_intel \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/agpgart-intel/module b/test/sys/bus/pci/drivers/agpgart-intel/module new file mode 120000 index 0000000000..7fa1e07806 --- /dev/null +++ b/test/sys/bus/pci/drivers/agpgart-intel/module @@ -0,0 +1 @@ +../../../../module/intel_agp \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/ahci/0000:00:1f.2 b/test/sys/bus/pci/drivers/ahci/0000:00:1f.2 new file mode 120000 index 0000000000..4d9f1df625 --- /dev/null +++ b/test/sys/bus/pci/drivers/ahci/0000:00:1f.2 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1f.2 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/ahci/module b/test/sys/bus/pci/drivers/ahci/module new file mode 120000 index 0000000000..ca9b8364a5 --- /dev/null +++ b/test/sys/bus/pci/drivers/ahci/module @@ -0,0 +1 @@ +../../../../module/ahci \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 b/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 deleted file mode 120000 index bd644e0e9d..0000000000 --- a/test/sys/bus/pci/drivers/aic7xxx/0000:02:05.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 b/test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 new file mode 120000 index 0000000000..db282150b8 --- /dev/null +++ b/test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1f.1 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/e1000e/0000:02:00.0 b/test/sys/bus/pci/drivers/e1000e/0000:02:00.0 new file mode 120000 index 0000000000..5f111870cb --- /dev/null +++ b/test/sys/bus/pci/drivers/e1000e/0000:02:00.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1c.0/0000:02:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/e1000e/module b/test/sys/bus/pci/drivers/e1000e/module new file mode 120000 index 0000000000..6b33aca904 --- /dev/null +++ b/test/sys/bus/pci/drivers/e1000e/module @@ -0,0 +1 @@ +../../../../module/e1000e \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/ehci_hcd/module b/test/sys/bus/pci/drivers/ehci_hcd/module new file mode 120000 index 0000000000..83e35c1f0f --- /dev/null +++ b/test/sys/bus/pci/drivers/ehci_hcd/module @@ -0,0 +1 @@ +../../../../module/ehci_hcd \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 b/test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 new file mode 120000 index 0000000000..72d8419279 --- /dev/null +++ b/test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/iwl3945/module b/test/sys/bus/pci/drivers/iwl3945/module new file mode 120000 index 0000000000..6688601419 --- /dev/null +++ b/test/sys/bus/pci/drivers/iwl3945/module @@ -0,0 +1 @@ +../../../../module/iwl3945 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:01.0 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:01.0 new file mode 120000 index 0000000000..8b79fc7c87 --- /dev/null +++ b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:01.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:01.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.0 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.0 new file mode 120000 index 0000000000..a703b2272a --- /dev/null +++ b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1c.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.1 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.1 new file mode 120000 index 0000000000..47e7f793da --- /dev/null +++ b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1c.1 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.2 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.2 new file mode 120000 index 0000000000..93e3907d51 --- /dev/null +++ b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.2 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1c.2 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.3 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.3 new file mode 120000 index 0000000000..865098bd43 --- /dev/null +++ b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.3 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1c.3 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 new file mode 120000 index 0000000000..824ea3dc92 --- /dev/null +++ b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 new file mode 120000 index 0000000000..051d270749 --- /dev/null +++ b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.1 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 new file mode 120000 index 0000000000..92476e3c24 --- /dev/null +++ b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.2 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 new file mode 120000 index 0000000000..d8bb384d34 --- /dev/null +++ b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.3 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/module b/test/sys/bus/pci/drivers/uhci_hcd/module new file mode 120000 index 0000000000..4247875342 --- /dev/null +++ b/test/sys/bus/pci/drivers/uhci_hcd/module @@ -0,0 +1 @@ +../../../../module/uhci_hcd \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 b/test/sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 new file mode 120000 index 0000000000..7cc48e0eba --- /dev/null +++ b/test/sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1e.0/0000:15:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/yenta_cardbus/module b/test/sys/bus/pci/drivers/yenta_cardbus/module new file mode 120000 index 0000000000..7a24f4085f --- /dev/null +++ b/test/sys/bus/pci/drivers/yenta_cardbus/module @@ -0,0 +1 @@ +../../../../module/yenta_socket \ No newline at end of file diff --git a/test/sys/bus/pci/drivers_autoprobe b/test/sys/bus/pci/drivers_autoprobe new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/bus/pci/drivers_autoprobe @@ -0,0 +1 @@ +1 diff --git a/test/sys/bus/pci/drivers_probe b/test/sys/bus/pci/drivers_probe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/pci/uevent b/test/sys/bus/pci/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/pci_express/devices/0000:00:01.0:pcie00 b/test/sys/bus/pci_express/devices/0000:00:01.0:pcie00 new file mode 120000 index 0000000000..945332b73a --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:01.0:pcie00 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:01.0:pcie03 b/test/sys/bus/pci_express/devices/0000:00:01.0:pcie03 new file mode 120000 index 0000000000..3ebf398e1e --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:01.0:pcie03 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie00 b/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie00 new file mode 120000 index 0000000000..4777498937 --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie00 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie02 b/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie02 new file mode 120000 index 0000000000..8f59adaaab --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie02 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie03 b/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie03 new file mode 120000 index 0000000000..4266e50530 --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie03 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie00 b/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie00 new file mode 120000 index 0000000000..7123598c22 --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie00 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie02 b/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie02 new file mode 120000 index 0000000000..4bbde954cd --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie02 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie03 b/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie03 new file mode 120000 index 0000000000..d3fc20fe81 --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie03 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie00 b/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie00 new file mode 120000 index 0000000000..05b3c4df71 --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie00 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie02 b/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie02 new file mode 120000 index 0000000000..f235cf5eae --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie02 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie03 b/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie03 new file mode 120000 index 0000000000..a1787ad63a --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie03 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie00 b/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie00 new file mode 120000 index 0000000000..a9b5b8739c --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie00 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie02 b/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie02 new file mode 120000 index 0000000000..a1901b3841 --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie02 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie03 b/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie03 new file mode 120000 index 0000000000..8d8c037879 --- /dev/null +++ b/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie03 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/drivers_autoprobe b/test/sys/bus/pci_express/drivers_autoprobe new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/bus/pci_express/drivers_autoprobe @@ -0,0 +1 @@ +1 diff --git a/test/sys/bus/pci_express/drivers_probe b/test/sys/bus/pci_express/drivers_probe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/pci_express/uevent b/test/sys/bus/pci_express/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/pcmcia/drivers_autoprobe b/test/sys/bus/pcmcia/drivers_autoprobe new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/bus/pcmcia/drivers_autoprobe @@ -0,0 +1 @@ +1 diff --git a/test/sys/bus/pcmcia/drivers_probe b/test/sys/bus/pcmcia/drivers_probe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/pcmcia/uevent b/test/sys/bus/pcmcia/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/platform/devices/dock.0 b/test/sys/bus/platform/devices/dock.0 new file mode 120000 index 0000000000..ba96de30eb --- /dev/null +++ b/test/sys/bus/platform/devices/dock.0 @@ -0,0 +1 @@ +../../../devices/platform/dock.0 \ No newline at end of file diff --git a/test/sys/bus/platform/devices/i8042 b/test/sys/bus/platform/devices/i8042 new file mode 120000 index 0000000000..4fee324a4d --- /dev/null +++ b/test/sys/bus/platform/devices/i8042 @@ -0,0 +1 @@ +../../../devices/platform/i8042 \ No newline at end of file diff --git a/test/sys/bus/platform/devices/microcode b/test/sys/bus/platform/devices/microcode new file mode 120000 index 0000000000..e50f32c632 --- /dev/null +++ b/test/sys/bus/platform/devices/microcode @@ -0,0 +1 @@ +../../../devices/platform/microcode \ No newline at end of file diff --git a/test/sys/bus/platform/devices/pcspkr b/test/sys/bus/platform/devices/pcspkr new file mode 120000 index 0000000000..079eeb0347 --- /dev/null +++ b/test/sys/bus/platform/devices/pcspkr @@ -0,0 +1 @@ +../../../devices/platform/pcspkr \ No newline at end of file diff --git a/test/sys/bus/platform/devices/serial8250 b/test/sys/bus/platform/devices/serial8250 new file mode 120000 index 0000000000..5594bc91f6 --- /dev/null +++ b/test/sys/bus/platform/devices/serial8250 @@ -0,0 +1 @@ +../../../devices/platform/serial8250 \ No newline at end of file diff --git a/test/sys/bus/platform/devices/thinkpad_acpi b/test/sys/bus/platform/devices/thinkpad_acpi new file mode 120000 index 0000000000..8011e89c2c --- /dev/null +++ b/test/sys/bus/platform/devices/thinkpad_acpi @@ -0,0 +1 @@ +../../../devices/platform/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/bus/platform/devices/thinkpad_hwmon b/test/sys/bus/platform/devices/thinkpad_hwmon new file mode 120000 index 0000000000..3dd92bd52c --- /dev/null +++ b/test/sys/bus/platform/devices/thinkpad_hwmon @@ -0,0 +1 @@ +../../../devices/platform/thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/bus/platform/devices/vesafb.0 b/test/sys/bus/platform/devices/vesafb.0 new file mode 120000 index 0000000000..ef6c547a1f --- /dev/null +++ b/test/sys/bus/platform/devices/vesafb.0 @@ -0,0 +1 @@ +../../../devices/platform/vesafb.0 \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/i8042/i8042 b/test/sys/bus/platform/drivers/i8042/i8042 new file mode 120000 index 0000000000..7c99115f6f --- /dev/null +++ b/test/sys/bus/platform/drivers/i8042/i8042 @@ -0,0 +1 @@ +../../../../devices/platform/i8042 \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/pcspkr/module b/test/sys/bus/platform/drivers/pcspkr/module new file mode 120000 index 0000000000..8649c737fb --- /dev/null +++ b/test/sys/bus/platform/drivers/pcspkr/module @@ -0,0 +1 @@ +../../../../module/pcspkr \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/pcspkr/pcspkr b/test/sys/bus/platform/drivers/pcspkr/pcspkr new file mode 120000 index 0000000000..925b9c6238 --- /dev/null +++ b/test/sys/bus/platform/drivers/pcspkr/pcspkr @@ -0,0 +1 @@ +../../../../devices/platform/pcspkr \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/serial8250/serial8250 b/test/sys/bus/platform/drivers/serial8250/serial8250 new file mode 120000 index 0000000000..5676a20b4c --- /dev/null +++ b/test/sys/bus/platform/drivers/serial8250/serial8250 @@ -0,0 +1 @@ +../../../../devices/platform/serial8250 \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/debug_level b/test/sys/bus/platform/drivers/thinkpad_acpi/debug_level new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_acpi/debug_level @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/interface_version b/test/sys/bus/platform/drivers/thinkpad_acpi/interface_version new file mode 100644 index 0000000000..8b33f3d20a --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_acpi/interface_version @@ -0,0 +1 @@ +0x00020200 diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/module b/test/sys/bus/platform/drivers/thinkpad_acpi/module new file mode 120000 index 0000000000..f95fa91132 --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_acpi/module @@ -0,0 +1 @@ +../../../../module/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi b/test/sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi new file mode 120000 index 0000000000..3f34d607bf --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi @@ -0,0 +1 @@ +../../../../devices/platform/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/version b/test/sys/bus/platform/drivers/thinkpad_acpi/version new file mode 100644 index 0000000000..6c2f139f6e --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_acpi/version @@ -0,0 +1 @@ +ThinkPad ACPI Extras v0.21 diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/debug_level b/test/sys/bus/platform/drivers/thinkpad_hwmon/debug_level new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_hwmon/debug_level @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/fan_watchdog b/test/sys/bus/platform/drivers/thinkpad_hwmon/fan_watchdog new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_hwmon/fan_watchdog @@ -0,0 +1 @@ +0 diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/interface_version b/test/sys/bus/platform/drivers/thinkpad_hwmon/interface_version new file mode 100644 index 0000000000..8b33f3d20a --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_hwmon/interface_version @@ -0,0 +1 @@ +0x00020200 diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/module b/test/sys/bus/platform/drivers/thinkpad_hwmon/module new file mode 120000 index 0000000000..f95fa91132 --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_hwmon/module @@ -0,0 +1 @@ +../../../../module/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/thinkpad_hwmon b/test/sys/bus/platform/drivers/thinkpad_hwmon/thinkpad_hwmon new file mode 120000 index 0000000000..3ca5d914ea --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_hwmon/thinkpad_hwmon @@ -0,0 +1 @@ +../../../../devices/platform/thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/version b/test/sys/bus/platform/drivers/thinkpad_hwmon/version new file mode 100644 index 0000000000..6c2f139f6e --- /dev/null +++ b/test/sys/bus/platform/drivers/thinkpad_hwmon/version @@ -0,0 +1 @@ +ThinkPad ACPI Extras v0.21 diff --git a/test/sys/bus/platform/drivers/vesafb/vesafb.0 b/test/sys/bus/platform/drivers/vesafb/vesafb.0 new file mode 120000 index 0000000000..13a9757d51 --- /dev/null +++ b/test/sys/bus/platform/drivers/vesafb/vesafb.0 @@ -0,0 +1 @@ +../../../../devices/platform/vesafb.0 \ No newline at end of file diff --git a/test/sys/bus/platform/drivers_autoprobe b/test/sys/bus/platform/drivers_autoprobe new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/bus/platform/drivers_autoprobe @@ -0,0 +1 @@ +1 diff --git a/test/sys/bus/platform/drivers_probe b/test/sys/bus/platform/drivers_probe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/platform/uevent b/test/sys/bus/platform/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/pnp/devices/00:00 b/test/sys/bus/pnp/devices/00:00 new file mode 120000 index 0000000000..88949d8171 --- /dev/null +++ b/test/sys/bus/pnp/devices/00:00 @@ -0,0 +1 @@ +../../../devices/pnp0/00:00 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:01 b/test/sys/bus/pnp/devices/00:01 new file mode 120000 index 0000000000..20683ec26f --- /dev/null +++ b/test/sys/bus/pnp/devices/00:01 @@ -0,0 +1 @@ +../../../devices/pnp0/00:01 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:02 b/test/sys/bus/pnp/devices/00:02 new file mode 120000 index 0000000000..74708dbb0e --- /dev/null +++ b/test/sys/bus/pnp/devices/00:02 @@ -0,0 +1 @@ +../../../devices/pnp0/00:02 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:03 b/test/sys/bus/pnp/devices/00:03 new file mode 120000 index 0000000000..3fd5bed66f --- /dev/null +++ b/test/sys/bus/pnp/devices/00:03 @@ -0,0 +1 @@ +../../../devices/pnp0/00:03 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:04 b/test/sys/bus/pnp/devices/00:04 new file mode 120000 index 0000000000..4721b90121 --- /dev/null +++ b/test/sys/bus/pnp/devices/00:04 @@ -0,0 +1 @@ +../../../devices/pnp0/00:04 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:05 b/test/sys/bus/pnp/devices/00:05 new file mode 120000 index 0000000000..5fe11eac2f --- /dev/null +++ b/test/sys/bus/pnp/devices/00:05 @@ -0,0 +1 @@ +../../../devices/pnp0/00:05 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:06 b/test/sys/bus/pnp/devices/00:06 new file mode 120000 index 0000000000..7ab8959018 --- /dev/null +++ b/test/sys/bus/pnp/devices/00:06 @@ -0,0 +1 @@ +../../../devices/pnp0/00:06 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:07 b/test/sys/bus/pnp/devices/00:07 new file mode 120000 index 0000000000..e8c3f4adfe --- /dev/null +++ b/test/sys/bus/pnp/devices/00:07 @@ -0,0 +1 @@ +../../../devices/pnp0/00:07 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:08 b/test/sys/bus/pnp/devices/00:08 new file mode 120000 index 0000000000..0e99de9576 --- /dev/null +++ b/test/sys/bus/pnp/devices/00:08 @@ -0,0 +1 @@ +../../../devices/pnp0/00:08 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:09 b/test/sys/bus/pnp/devices/00:09 new file mode 120000 index 0000000000..5ecf7dd1f5 --- /dev/null +++ b/test/sys/bus/pnp/devices/00:09 @@ -0,0 +1 @@ +../../../devices/pnp0/00:09 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:0a b/test/sys/bus/pnp/devices/00:0a new file mode 120000 index 0000000000..1413e4e6f1 --- /dev/null +++ b/test/sys/bus/pnp/devices/00:0a @@ -0,0 +1 @@ +../../../devices/pnp0/00:0a \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/i8042 aux/00:09 b/test/sys/bus/pnp/drivers/i8042 aux/00:09 new file mode 120000 index 0000000000..813b86fef7 --- /dev/null +++ b/test/sys/bus/pnp/drivers/i8042 aux/00:09 @@ -0,0 +1 @@ +../../../../devices/pnp0/00:09 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/i8042 kbd/00:08 b/test/sys/bus/pnp/drivers/i8042 kbd/00:08 new file mode 120000 index 0000000000..2de3b7687c --- /dev/null +++ b/test/sys/bus/pnp/drivers/i8042 kbd/00:08 @@ -0,0 +1 @@ +../../../../devices/pnp0/00:08 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/rtc_cmos/00:07 b/test/sys/bus/pnp/drivers/rtc_cmos/00:07 new file mode 120000 index 0000000000..a38b961a92 --- /dev/null +++ b/test/sys/bus/pnp/drivers/rtc_cmos/00:07 @@ -0,0 +1 @@ +../../../../devices/pnp0/00:07 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/system/00:00 b/test/sys/bus/pnp/drivers/system/00:00 new file mode 120000 index 0000000000..dce9928428 --- /dev/null +++ b/test/sys/bus/pnp/drivers/system/00:00 @@ -0,0 +1 @@ +../../../../devices/pnp0/00:00 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/system/00:02 b/test/sys/bus/pnp/drivers/system/00:02 new file mode 120000 index 0000000000..2cf747c575 --- /dev/null +++ b/test/sys/bus/pnp/drivers/system/00:02 @@ -0,0 +1 @@ +../../../../devices/pnp0/00:02 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers_autoprobe b/test/sys/bus/pnp/drivers_autoprobe new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/bus/pnp/drivers_autoprobe @@ -0,0 +1 @@ +1 diff --git a/test/sys/bus/pnp/drivers_probe b/test/sys/bus/pnp/drivers_probe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/pnp/uevent b/test/sys/bus/pnp/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/scsi/devices/0:0:0:0 b/test/sys/bus/scsi/devices/0:0:0:0 index 6d8555dce1..f6a756b526 120000 --- a/test/sys/bus/scsi/devices/0:0:0:0 +++ b/test/sys/bus/scsi/devices/0:0:0:0 @@ -1 +1 @@ -../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file +../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/4:0:0:0 b/test/sys/bus/scsi/devices/4:0:0:0 new file mode 120000 index 0000000000..ae0b657fec --- /dev/null +++ b/test/sys/bus/scsi/devices/4:0:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/6:0:0:0 b/test/sys/bus/scsi/devices/6:0:0:0 new file mode 120000 index 0000000000..b3bc5a3de7 --- /dev/null +++ b/test/sys/bus/scsi/devices/6:0:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host0 b/test/sys/bus/scsi/devices/host0 new file mode 120000 index 0000000000..7e2e99d988 --- /dev/null +++ b/test/sys/bus/scsi/devices/host0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.2/host0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host1 b/test/sys/bus/scsi/devices/host1 new file mode 120000 index 0000000000..e612bbf10b --- /dev/null +++ b/test/sys/bus/scsi/devices/host1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.2/host1 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host2 b/test/sys/bus/scsi/devices/host2 new file mode 120000 index 0000000000..41f9a48737 --- /dev/null +++ b/test/sys/bus/scsi/devices/host2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.2/host2 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host3 b/test/sys/bus/scsi/devices/host3 new file mode 120000 index 0000000000..97243474e9 --- /dev/null +++ b/test/sys/bus/scsi/devices/host3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.2/host3 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host4 b/test/sys/bus/scsi/devices/host4 new file mode 120000 index 0000000000..7d38a6f412 --- /dev/null +++ b/test/sys/bus/scsi/devices/host4 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.1/host4 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host5 b/test/sys/bus/scsi/devices/host5 new file mode 120000 index 0000000000..436466adbc --- /dev/null +++ b/test/sys/bus/scsi/devices/host5 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.1/host5 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host6 b/test/sys/bus/scsi/devices/host6 new file mode 120000 index 0000000000..4115c7ebf0 --- /dev/null +++ b/test/sys/bus/scsi/devices/host6 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/target0:0:0 b/test/sys/bus/scsi/devices/target0:0:0 new file mode 120000 index 0000000000..91ff550d7a --- /dev/null +++ b/test/sys/bus/scsi/devices/target0:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/target4:0:0 b/test/sys/bus/scsi/devices/target4:0:0 new file mode 120000 index 0000000000..de9abe2a0f --- /dev/null +++ b/test/sys/bus/scsi/devices/target4:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/target6:0:0 b/test/sys/bus/scsi/devices/target6:0:0 new file mode 120000 index 0000000000..1a704c0e2e --- /dev/null +++ b/test/sys/bus/scsi/devices/target6:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/0:0:0:0 b/test/sys/bus/scsi/drivers/sd/0:0:0:0 index 97ae02167d..6a5b5a1a15 120000 --- a/test/sys/bus/scsi/drivers/sd/0:0:0:0 +++ b/test/sys/bus/scsi/drivers/sd/0:0:0:0 @@ -1 +1 @@ -../../../../devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0 \ No newline at end of file +../../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/6:0:0:0 b/test/sys/bus/scsi/drivers/sd/6:0:0:0 new file mode 120000 index 0000000000..dd6ac100f6 --- /dev/null +++ b/test/sys/bus/scsi/drivers/sd/6:0:0:0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sr/4:0:0:0 b/test/sys/bus/scsi/drivers/sr/4:0:0:0 new file mode 120000 index 0000000000..2ceb4f67e3 --- /dev/null +++ b/test/sys/bus/scsi/drivers/sr/4:0:0:0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers_autoprobe b/test/sys/bus/scsi/drivers_autoprobe new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/bus/scsi/drivers_autoprobe @@ -0,0 +1 @@ +1 diff --git a/test/sys/bus/scsi/drivers_probe b/test/sys/bus/scsi/drivers_probe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/scsi/uevent b/test/sys/bus/scsi/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/serio/devices/serio0 b/test/sys/bus/serio/devices/serio0 new file mode 120000 index 0000000000..9cea974c79 --- /dev/null +++ b/test/sys/bus/serio/devices/serio0 @@ -0,0 +1 @@ +../../../devices/platform/i8042/serio0 \ No newline at end of file diff --git a/test/sys/bus/serio/devices/serio1 b/test/sys/bus/serio/devices/serio1 new file mode 120000 index 0000000000..d6538384c0 --- /dev/null +++ b/test/sys/bus/serio/devices/serio1 @@ -0,0 +1 @@ +../../../devices/platform/i8042/serio1 \ No newline at end of file diff --git a/test/sys/bus/serio/drivers/atkbd/bind_mode b/test/sys/bus/serio/drivers/atkbd/bind_mode new file mode 100644 index 0000000000..865faf10cb --- /dev/null +++ b/test/sys/bus/serio/drivers/atkbd/bind_mode @@ -0,0 +1 @@ +auto diff --git a/test/sys/bus/serio/drivers/atkbd/description b/test/sys/bus/serio/drivers/atkbd/description new file mode 100644 index 0000000000..15ba15d8c2 --- /dev/null +++ b/test/sys/bus/serio/drivers/atkbd/description @@ -0,0 +1 @@ +AT and PS/2 keyboard driver diff --git a/test/sys/bus/serio/drivers/atkbd/module b/test/sys/bus/serio/drivers/atkbd/module new file mode 120000 index 0000000000..358061bdce --- /dev/null +++ b/test/sys/bus/serio/drivers/atkbd/module @@ -0,0 +1 @@ +../../../../module/atkbd \ No newline at end of file diff --git a/test/sys/bus/serio/drivers/atkbd/serio0 b/test/sys/bus/serio/drivers/atkbd/serio0 new file mode 120000 index 0000000000..bca0d4a0ad --- /dev/null +++ b/test/sys/bus/serio/drivers/atkbd/serio0 @@ -0,0 +1 @@ +../../../../devices/platform/i8042/serio0 \ No newline at end of file diff --git a/test/sys/bus/serio/drivers/psmouse/bind_mode b/test/sys/bus/serio/drivers/psmouse/bind_mode new file mode 100644 index 0000000000..865faf10cb --- /dev/null +++ b/test/sys/bus/serio/drivers/psmouse/bind_mode @@ -0,0 +1 @@ +auto diff --git a/test/sys/bus/serio/drivers/psmouse/description b/test/sys/bus/serio/drivers/psmouse/description new file mode 100644 index 0000000000..ed4368fb01 --- /dev/null +++ b/test/sys/bus/serio/drivers/psmouse/description @@ -0,0 +1 @@ +PS/2 mouse driver diff --git a/test/sys/bus/serio/drivers/psmouse/module b/test/sys/bus/serio/drivers/psmouse/module new file mode 120000 index 0000000000..d2a4e172b0 --- /dev/null +++ b/test/sys/bus/serio/drivers/psmouse/module @@ -0,0 +1 @@ +../../../../module/psmouse \ No newline at end of file diff --git a/test/sys/bus/serio/drivers/psmouse/serio1 b/test/sys/bus/serio/drivers/psmouse/serio1 new file mode 120000 index 0000000000..b6cf321d27 --- /dev/null +++ b/test/sys/bus/serio/drivers/psmouse/serio1 @@ -0,0 +1 @@ +../../../../devices/platform/i8042/serio1 \ No newline at end of file diff --git a/test/sys/bus/serio/drivers_autoprobe b/test/sys/bus/serio/drivers_autoprobe new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/bus/serio/drivers_autoprobe @@ -0,0 +1 @@ +1 diff --git a/test/sys/bus/serio/drivers_probe b/test/sys/bus/serio/drivers_probe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/serio/uevent b/test/sys/bus/serio/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/usb-serial/devices/ttyUSB0 b/test/sys/bus/usb-serial/devices/ttyUSB0 deleted file mode 120000 index b7733a68e0..0000000000 --- a/test/sys/bus/usb-serial/devices/ttyUSB0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 b/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 deleted file mode 120000 index 177f109e48..0000000000 --- a/test/sys/bus/usb-serial/drivers/PL-2303/ttyUSB0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/1-0:1.0 b/test/sys/bus/usb/devices/1-0:1.0 new file mode 120000 index 0000000000..accc4df554 --- /dev/null +++ b/test/sys/bus/usb/devices/1-0:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/2-0:1.0 b/test/sys/bus/usb/devices/2-0:1.0 new file mode 120000 index 0000000000..c9569dacc9 --- /dev/null +++ b/test/sys/bus/usb/devices/2-0:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-0:1.0 b/test/sys/bus/usb/devices/3-0:1.0 index 9137978832..97b545f5c0 120000 --- a/test/sys/bus/usb/devices/3-0:1.0 +++ b/test/sys/bus/usb/devices/3-0:1.0 @@ -1 +1 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file +../../../devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1 b/test/sys/bus/usb/devices/3-1 index e47b4d58c4..d387bcd81f 120000 --- a/test/sys/bus/usb/devices/3-1 +++ b/test/sys/bus/usb/devices/3-1 @@ -1 +1 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file +../../../devices/pci0000:00/0000:00:1d.2/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1:1.0 b/test/sys/bus/usb/devices/3-1:1.0 index f519185eb3..446d9ce45a 120000 --- a/test/sys/bus/usb/devices/3-1:1.0 +++ b/test/sys/bus/usb/devices/3-1:1.0 @@ -1 +1 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file +../../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-0:1.0 b/test/sys/bus/usb/devices/4-0:1.0 new file mode 120000 index 0000000000..1b44614ae1 --- /dev/null +++ b/test/sys/bus/usb/devices/4-0:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1 b/test/sys/bus/usb/devices/4-1 new file mode 120000 index 0000000000..164351ec36 --- /dev/null +++ b/test/sys/bus/usb/devices/4-1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1:1.0 b/test/sys/bus/usb/devices/4-1:1.0 new file mode 120000 index 0000000000..154e43cc22 --- /dev/null +++ b/test/sys/bus/usb/devices/4-1:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1:1.1 b/test/sys/bus/usb/devices/4-1:1.1 new file mode 120000 index 0000000000..50d0764b22 --- /dev/null +++ b/test/sys/bus/usb/devices/4-1:1.1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1:1.2 b/test/sys/bus/usb/devices/4-1:1.2 new file mode 120000 index 0000000000..e8694cf789 --- /dev/null +++ b/test/sys/bus/usb/devices/4-1:1.2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1:1.3 b/test/sys/bus/usb/devices/4-1:1.3 new file mode 120000 index 0000000000..25795b6dc0 --- /dev/null +++ b/test/sys/bus/usb/devices/4-1:1.3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-2 b/test/sys/bus/usb/devices/4-2 new file mode 120000 index 0000000000..9fa9e07faa --- /dev/null +++ b/test/sys/bus/usb/devices/4-2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3/usb4/4-2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-2:1.0 b/test/sys/bus/usb/devices/4-2:1.0 new file mode 120000 index 0000000000..1b0c1a9ebc --- /dev/null +++ b/test/sys/bus/usb/devices/4-2:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-0:1.0 b/test/sys/bus/usb/devices/5-0:1.0 new file mode 120000 index 0000000000..de3fbb26f5 --- /dev/null +++ b/test/sys/bus/usb/devices/5-0:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1 b/test/sys/bus/usb/devices/5-1 new file mode 120000 index 0000000000..69e88ccf21 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.0 b/test/sys/bus/usb/devices/5-1:1.0 new file mode 120000 index 0000000000..f0ea70d8a4 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.1 b/test/sys/bus/usb/devices/5-1:1.1 new file mode 120000 index 0000000000..5a7ccb933f --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.10 b/test/sys/bus/usb/devices/5-1:1.10 new file mode 120000 index 0000000000..e8e2f715c3 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.10 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.10 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.11 b/test/sys/bus/usb/devices/5-1:1.11 new file mode 120000 index 0000000000..fc5402263d --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.11 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.11 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.12 b/test/sys/bus/usb/devices/5-1:1.12 new file mode 120000 index 0000000000..555b791199 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.12 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.12 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.13 b/test/sys/bus/usb/devices/5-1:1.13 new file mode 120000 index 0000000000..e0488ffea1 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.13 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.13 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.2 b/test/sys/bus/usb/devices/5-1:1.2 new file mode 120000 index 0000000000..1b28b28dc2 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.3 b/test/sys/bus/usb/devices/5-1:1.3 new file mode 120000 index 0000000000..a6d60ab1d8 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.4 b/test/sys/bus/usb/devices/5-1:1.4 new file mode 120000 index 0000000000..c6b7132dc9 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.4 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.4 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.5 b/test/sys/bus/usb/devices/5-1:1.5 new file mode 120000 index 0000000000..a45f5e2f48 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.5 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.5 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.6 b/test/sys/bus/usb/devices/5-1:1.6 new file mode 120000 index 0000000000..e2c8d55a23 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.6 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.6 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.9 b/test/sys/bus/usb/devices/5-1:1.9 new file mode 120000 index 0000000000..81351bff78 --- /dev/null +++ b/test/sys/bus/usb/devices/5-1:1.9 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.9 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2 b/test/sys/bus/usb/devices/5-2 new file mode 120000 index 0000000000..9425fc82b1 --- /dev/null +++ b/test/sys/bus/usb/devices/5-2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.0 b/test/sys/bus/usb/devices/5-2:1.0 new file mode 120000 index 0000000000..a2b7214a0e --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb1 b/test/sys/bus/usb/devices/usb1 new file mode 120000 index 0000000000..febdf43da9 --- /dev/null +++ b/test/sys/bus/usb/devices/usb1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.0/usb1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb2 b/test/sys/bus/usb/devices/usb2 new file mode 120000 index 0000000000..a016fbd3f5 --- /dev/null +++ b/test/sys/bus/usb/devices/usb2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.1/usb2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb3 b/test/sys/bus/usb/devices/usb3 index fb1919e7c9..83afcc385d 120000 --- a/test/sys/bus/usb/devices/usb3 +++ b/test/sys/bus/usb/devices/usb3 @@ -1 +1 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file +../../../devices/pci0000:00/0000:00:1d.2/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb4 b/test/sys/bus/usb/devices/usb4 new file mode 120000 index 0000000000..a144d15318 --- /dev/null +++ b/test/sys/bus/usb/devices/usb4 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.3/usb4 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb5 b/test/sys/bus/usb/devices/usb5 new file mode 120000 index 0000000000..f147fe5e2f --- /dev/null +++ b/test/sys/bus/usb/devices/usb5 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 b/test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 new file mode 120000 index 0000000000..68d13ef99f --- /dev/null +++ b/test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 b/test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 new file mode 120000 index 0000000000..d7448b75f2 --- /dev/null +++ b/test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/module b/test/sys/bus/usb/drivers/cdc_acm/module new file mode 120000 index 0000000000..95ffe94c2c --- /dev/null +++ b/test/sys/bus/usb/drivers/cdc_acm/module @@ -0,0 +1 @@ +../../../../module/cdc_acm \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/1-0:1.0 b/test/sys/bus/usb/drivers/hub/1-0:1.0 new file mode 120000 index 0000000000..5c0e29abba --- /dev/null +++ b/test/sys/bus/usb/drivers/hub/1-0:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/2-0:1.0 b/test/sys/bus/usb/drivers/hub/2-0:1.0 new file mode 120000 index 0000000000..34d75f3d41 --- /dev/null +++ b/test/sys/bus/usb/drivers/hub/2-0:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/3-0:1.0 b/test/sys/bus/usb/drivers/hub/3-0:1.0 index 2bc160c20c..7869f4257d 120000 --- a/test/sys/bus/usb/drivers/hub/3-0:1.0 +++ b/test/sys/bus/usb/drivers/hub/3-0:1.0 @@ -1 +1 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0 \ No newline at end of file +../../../../devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/4-0:1.0 b/test/sys/bus/usb/drivers/hub/4-0:1.0 new file mode 120000 index 0000000000..c5f7fd15a8 --- /dev/null +++ b/test/sys/bus/usb/drivers/hub/4-0:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/5-0:1.0 b/test/sys/bus/usb/drivers/hub/5-0:1.0 new file mode 120000 index 0000000000..77b3decca5 --- /dev/null +++ b/test/sys/bus/usb/drivers/hub/5-0:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/module b/test/sys/bus/usb/drivers/hub/module new file mode 120000 index 0000000000..d5a2f0734e --- /dev/null +++ b/test/sys/bus/usb/drivers/hub/module @@ -0,0 +1 @@ +../../../../module/usbcore \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/pl2303/3-1:1.0 b/test/sys/bus/usb/drivers/pl2303/3-1:1.0 deleted file mode 120000 index 49d32d5abd..0000000000 --- a/test/sys/bus/usb/drivers/pl2303/3-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb-storage/5-2:1.0 b/test/sys/bus/usb/drivers/usb-storage/5-2:1.0 new file mode 120000 index 0000000000..f41d924d48 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb-storage/5-2:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb-storage/module b/test/sys/bus/usb/drivers/usb-storage/module new file mode 120000 index 0000000000..01f59943d5 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb-storage/module @@ -0,0 +1 @@ +../../../../module/usb_storage \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/3-1 b/test/sys/bus/usb/drivers/usb/3-1 index 03c76193e9..421ad85757 120000 --- a/test/sys/bus/usb/drivers/usb/3-1 +++ b/test/sys/bus/usb/drivers/usb/3-1 @@ -1 +1 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3/3-1 \ No newline at end of file +../../../../devices/pci0000:00/0000:00:1d.2/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/4-1 b/test/sys/bus/usb/drivers/usb/4-1 new file mode 120000 index 0000000000..8b427f8e43 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/4-1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/4-2 b/test/sys/bus/usb/drivers/usb/4-2 new file mode 120000 index 0000000000..552bf837f4 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/4-2 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.3/usb4/4-2 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/5-1 b/test/sys/bus/usb/drivers/usb/5-1 new file mode 120000 index 0000000000..0ee91d5361 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/5-1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/5-2 b/test/sys/bus/usb/drivers/usb/5-2 new file mode 120000 index 0000000000..330c5cdba2 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/5-2 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/module b/test/sys/bus/usb/drivers/usb/module new file mode 120000 index 0000000000..d5a2f0734e --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/module @@ -0,0 +1 @@ +../../../../module/usbcore \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb1 b/test/sys/bus/usb/drivers/usb/usb1 new file mode 120000 index 0000000000..27deaa5572 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/usb1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.0/usb1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb2 b/test/sys/bus/usb/drivers/usb/usb2 new file mode 120000 index 0000000000..2cc69486b0 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/usb2 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.1/usb2 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb3 b/test/sys/bus/usb/drivers/usb/usb3 index 61dc52a613..6217ac2038 120000 --- a/test/sys/bus/usb/drivers/usb/usb3 +++ b/test/sys/bus/usb/drivers/usb/usb3 @@ -1 +1 @@ -../../../../devices/pci0000:00/0000:00:09.0/usb3 \ No newline at end of file +../../../../devices/pci0000:00/0000:00:1d.2/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb4 b/test/sys/bus/usb/drivers/usb/usb4 new file mode 120000 index 0000000000..55886bf07d --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/usb4 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.3/usb4 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb5 b/test/sys/bus/usb/drivers/usb/usb5 new file mode 120000 index 0000000000..c3d8216a47 --- /dev/null +++ b/test/sys/bus/usb/drivers/usb/usb5 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usbfs/module b/test/sys/bus/usb/drivers/usbfs/module new file mode 120000 index 0000000000..d5a2f0734e --- /dev/null +++ b/test/sys/bus/usb/drivers/usbfs/module @@ -0,0 +1 @@ +../../../../module/usbcore \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usbhid/3-1:1.0 b/test/sys/bus/usb/drivers/usbhid/3-1:1.0 new file mode 120000 index 0000000000..620e5846d8 --- /dev/null +++ b/test/sys/bus/usb/drivers/usbhid/3-1:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usbhid/module b/test/sys/bus/usb/drivers/usbhid/module new file mode 120000 index 0000000000..6afe48340c --- /dev/null +++ b/test/sys/bus/usb/drivers/usbhid/module @@ -0,0 +1 @@ +../../../../module/usbhid \ No newline at end of file diff --git a/test/sys/bus/usb/drivers_autoprobe b/test/sys/bus/usb/drivers_autoprobe new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/bus/usb/drivers_autoprobe @@ -0,0 +1 @@ +1 diff --git a/test/sys/bus/usb/drivers_probe b/test/sys/bus/usb/drivers_probe new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/bus/usb/uevent b/test/sys/bus/usb/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/class/bdi/0:16 b/test/sys/class/bdi/0:16 new file mode 120000 index 0000000000..b3da1ea4a4 --- /dev/null +++ b/test/sys/class/bdi/0:16 @@ -0,0 +1 @@ +../../devices/virtual/bdi/0:16 \ No newline at end of file diff --git a/test/sys/class/bdi/11:0 b/test/sys/class/bdi/11:0 new file mode 120000 index 0000000000..51f50263c5 --- /dev/null +++ b/test/sys/class/bdi/11:0 @@ -0,0 +1 @@ +../../devices/virtual/bdi/11:0 \ No newline at end of file diff --git a/test/sys/class/bdi/7:0 b/test/sys/class/bdi/7:0 new file mode 120000 index 0000000000..d9cb5b7f8d --- /dev/null +++ b/test/sys/class/bdi/7:0 @@ -0,0 +1 @@ +../../devices/virtual/bdi/7:0 \ No newline at end of file diff --git a/test/sys/class/bdi/7:1 b/test/sys/class/bdi/7:1 new file mode 120000 index 0000000000..2f9a127483 --- /dev/null +++ b/test/sys/class/bdi/7:1 @@ -0,0 +1 @@ +../../devices/virtual/bdi/7:1 \ No newline at end of file diff --git a/test/sys/class/bdi/7:2 b/test/sys/class/bdi/7:2 new file mode 120000 index 0000000000..d311db60ee --- /dev/null +++ b/test/sys/class/bdi/7:2 @@ -0,0 +1 @@ +../../devices/virtual/bdi/7:2 \ No newline at end of file diff --git a/test/sys/class/bdi/7:3 b/test/sys/class/bdi/7:3 new file mode 120000 index 0000000000..a0b3d465c6 --- /dev/null +++ b/test/sys/class/bdi/7:3 @@ -0,0 +1 @@ +../../devices/virtual/bdi/7:3 \ No newline at end of file diff --git a/test/sys/class/bdi/7:4 b/test/sys/class/bdi/7:4 new file mode 120000 index 0000000000..7f69348297 --- /dev/null +++ b/test/sys/class/bdi/7:4 @@ -0,0 +1 @@ +../../devices/virtual/bdi/7:4 \ No newline at end of file diff --git a/test/sys/class/bdi/7:5 b/test/sys/class/bdi/7:5 new file mode 120000 index 0000000000..47fe1f649a --- /dev/null +++ b/test/sys/class/bdi/7:5 @@ -0,0 +1 @@ +../../devices/virtual/bdi/7:5 \ No newline at end of file diff --git a/test/sys/class/bdi/7:6 b/test/sys/class/bdi/7:6 new file mode 120000 index 0000000000..4e71e037da --- /dev/null +++ b/test/sys/class/bdi/7:6 @@ -0,0 +1 @@ +../../devices/virtual/bdi/7:6 \ No newline at end of file diff --git a/test/sys/class/bdi/7:7 b/test/sys/class/bdi/7:7 new file mode 120000 index 0000000000..dae22b2f33 --- /dev/null +++ b/test/sys/class/bdi/7:7 @@ -0,0 +1 @@ +../../devices/virtual/bdi/7:7 \ No newline at end of file diff --git a/test/sys/class/bdi/8:0 b/test/sys/class/bdi/8:0 new file mode 120000 index 0000000000..afb0584c55 --- /dev/null +++ b/test/sys/class/bdi/8:0 @@ -0,0 +1 @@ +../../devices/virtual/bdi/8:0 \ No newline at end of file diff --git a/test/sys/class/bdi/8:16 b/test/sys/class/bdi/8:16 new file mode 120000 index 0000000000..41f616c9db --- /dev/null +++ b/test/sys/class/bdi/8:16 @@ -0,0 +1 @@ +../../devices/virtual/bdi/8:16 \ No newline at end of file diff --git a/test/sys/class/bdi/9:0 b/test/sys/class/bdi/9:0 new file mode 120000 index 0000000000..996f542c17 --- /dev/null +++ b/test/sys/class/bdi/9:0 @@ -0,0 +1 @@ +../../devices/virtual/bdi/9:0 \ No newline at end of file diff --git a/test/sys/class/bdi/default b/test/sys/class/bdi/default new file mode 120000 index 0000000000..3bf98bde0d --- /dev/null +++ b/test/sys/class/bdi/default @@ -0,0 +1 @@ +../../devices/virtual/bdi/default \ No newline at end of file diff --git a/test/sys/class/block/loop0 b/test/sys/class/block/loop0 new file mode 120000 index 0000000000..86a5878d7d --- /dev/null +++ b/test/sys/class/block/loop0 @@ -0,0 +1 @@ +../../devices/virtual/block/loop0 \ No newline at end of file diff --git a/test/sys/class/block/loop1 b/test/sys/class/block/loop1 new file mode 120000 index 0000000000..97476753e1 --- /dev/null +++ b/test/sys/class/block/loop1 @@ -0,0 +1 @@ +../../devices/virtual/block/loop1 \ No newline at end of file diff --git a/test/sys/class/block/loop2 b/test/sys/class/block/loop2 new file mode 120000 index 0000000000..5fc0d7dd11 --- /dev/null +++ b/test/sys/class/block/loop2 @@ -0,0 +1 @@ +../../devices/virtual/block/loop2 \ No newline at end of file diff --git a/test/sys/class/block/loop3 b/test/sys/class/block/loop3 new file mode 120000 index 0000000000..a6d7b89dea --- /dev/null +++ b/test/sys/class/block/loop3 @@ -0,0 +1 @@ +../../devices/virtual/block/loop3 \ No newline at end of file diff --git a/test/sys/class/block/loop4 b/test/sys/class/block/loop4 new file mode 120000 index 0000000000..71386cbfd8 --- /dev/null +++ b/test/sys/class/block/loop4 @@ -0,0 +1 @@ +../../devices/virtual/block/loop4 \ No newline at end of file diff --git a/test/sys/class/block/loop5 b/test/sys/class/block/loop5 new file mode 120000 index 0000000000..af83a27367 --- /dev/null +++ b/test/sys/class/block/loop5 @@ -0,0 +1 @@ +../../devices/virtual/block/loop5 \ No newline at end of file diff --git a/test/sys/class/block/loop6 b/test/sys/class/block/loop6 new file mode 120000 index 0000000000..efdbd9532a --- /dev/null +++ b/test/sys/class/block/loop6 @@ -0,0 +1 @@ +../../devices/virtual/block/loop6 \ No newline at end of file diff --git a/test/sys/class/block/loop7 b/test/sys/class/block/loop7 new file mode 120000 index 0000000000..7a6d7e4aac --- /dev/null +++ b/test/sys/class/block/loop7 @@ -0,0 +1 @@ +../../devices/virtual/block/loop7 \ No newline at end of file diff --git a/test/sys/class/block/md0 b/test/sys/class/block/md0 new file mode 120000 index 0000000000..2072a2f60f --- /dev/null +++ b/test/sys/class/block/md0 @@ -0,0 +1 @@ +../../devices/virtual/block/md0 \ No newline at end of file diff --git a/test/sys/class/block/sda b/test/sys/class/block/sda new file mode 120000 index 0000000000..7ecaff1132 --- /dev/null +++ b/test/sys/class/block/sda @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda \ No newline at end of file diff --git a/test/sys/class/block/sda1 b/test/sys/class/block/sda1 new file mode 120000 index 0000000000..18dc11fc29 --- /dev/null +++ b/test/sys/class/block/sda1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1 \ No newline at end of file diff --git a/test/sys/class/block/sda10 b/test/sys/class/block/sda10 new file mode 120000 index 0000000000..d64a8257ae --- /dev/null +++ b/test/sys/class/block/sda10 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10 \ No newline at end of file diff --git a/test/sys/class/block/sda5 b/test/sys/class/block/sda5 new file mode 120000 index 0000000000..d7bd5661cf --- /dev/null +++ b/test/sys/class/block/sda5 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5 \ No newline at end of file diff --git a/test/sys/class/block/sda6 b/test/sys/class/block/sda6 new file mode 120000 index 0000000000..2b13ee8459 --- /dev/null +++ b/test/sys/class/block/sda6 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6 \ No newline at end of file diff --git a/test/sys/class/block/sda7 b/test/sys/class/block/sda7 new file mode 120000 index 0000000000..d8b862667f --- /dev/null +++ b/test/sys/class/block/sda7 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7 \ No newline at end of file diff --git a/test/sys/class/block/sda8 b/test/sys/class/block/sda8 new file mode 120000 index 0000000000..34923aae6d --- /dev/null +++ b/test/sys/class/block/sda8 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8 \ No newline at end of file diff --git a/test/sys/class/block/sda9 b/test/sys/class/block/sda9 new file mode 120000 index 0000000000..4b108b2336 --- /dev/null +++ b/test/sys/class/block/sda9 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9 \ No newline at end of file diff --git a/test/sys/class/block/sdb b/test/sys/class/block/sdb new file mode 120000 index 0000000000..96ff40b869 --- /dev/null +++ b/test/sys/class/block/sdb @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb \ No newline at end of file diff --git a/test/sys/class/block/sdb1 b/test/sys/class/block/sdb1 new file mode 120000 index 0000000000..712deabcd0 --- /dev/null +++ b/test/sys/class/block/sdb1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb/sdb1 \ No newline at end of file diff --git a/test/sys/class/block/sr0 b/test/sys/class/block/sr0 new file mode 120000 index 0000000000..4d1c248a3c --- /dev/null +++ b/test/sys/class/block/sr0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0 \ No newline at end of file diff --git a/test/sys/class/bsg/0:0:0:0 b/test/sys/class/bsg/0:0:0:0 new file mode 120000 index 0000000000..00f1c6aef9 --- /dev/null +++ b/test/sys/class/bsg/0:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 \ No newline at end of file diff --git a/test/sys/class/bsg/4:0:0:0 b/test/sys/class/bsg/4:0:0:0 new file mode 120000 index 0000000000..805fed84d2 --- /dev/null +++ b/test/sys/class/bsg/4:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0 \ No newline at end of file diff --git a/test/sys/class/bsg/6:0:0:0 b/test/sys/class/bsg/6:0:0:0 new file mode 120000 index 0000000000..df25adc4fe --- /dev/null +++ b/test/sys/class/bsg/6:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/bsg/6:0:0:0 \ No newline at end of file diff --git a/test/sys/class/dmi/id b/test/sys/class/dmi/id new file mode 120000 index 0000000000..939f06e07c --- /dev/null +++ b/test/sys/class/dmi/id @@ -0,0 +1 @@ +../../devices/virtual/dmi/id \ No newline at end of file diff --git a/test/sys/class/firmware/timeout b/test/sys/class/firmware/timeout new file mode 100644 index 0000000000..abdfb053e4 --- /dev/null +++ b/test/sys/class/firmware/timeout @@ -0,0 +1 @@ +60 diff --git a/test/sys/class/graphics/fb0 b/test/sys/class/graphics/fb0 new file mode 120000 index 0000000000..1944247bd4 --- /dev/null +++ b/test/sys/class/graphics/fb0 @@ -0,0 +1 @@ +../../devices/platform/vesafb.0/graphics/fb0 \ No newline at end of file diff --git a/test/sys/class/graphics/fbcon b/test/sys/class/graphics/fbcon new file mode 120000 index 0000000000..3a85c3bebf --- /dev/null +++ b/test/sys/class/graphics/fbcon @@ -0,0 +1 @@ +../../devices/virtual/graphics/fbcon \ No newline at end of file diff --git a/test/sys/class/hwmon/hwmon0 b/test/sys/class/hwmon/hwmon0 new file mode 120000 index 0000000000..035cf38190 --- /dev/null +++ b/test/sys/class/hwmon/hwmon0 @@ -0,0 +1 @@ +../../devices/platform/thinkpad_hwmon/hwmon/hwmon0 \ No newline at end of file diff --git a/test/sys/class/i2c-dev/i2c-300/dev b/test/sys/class/i2c-dev/i2c-300/dev deleted file mode 100644 index e1ffb89f95..0000000000 --- a/test/sys/class/i2c-dev/i2c-300/dev +++ /dev/null @@ -1 +0,0 @@ -89:300 diff --git a/test/sys/class/i2c-dev/i2c-300/name b/test/sys/class/i2c-dev/i2c-300/name deleted file mode 100644 index 9357009701..0000000000 --- a/test/sys/class/i2c-dev/i2c-300/name +++ /dev/null @@ -1 +0,0 @@ -foo dev diff --git a/test/sys/class/i2c-dev/i2c-300/subsystem b/test/sys/class/i2c-dev/i2c-300/subsystem deleted file mode 120000 index 5545800cc7..0000000000 --- a/test/sys/class/i2c-dev/i2c-300/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../i2c-dev \ No newline at end of file diff --git a/test/sys/class/i2c-dev/i2c-fake1/dev b/test/sys/class/i2c-dev/i2c-fake1/dev deleted file mode 100644 index ab453138aa..0000000000 --- a/test/sys/class/i2c-dev/i2c-fake1/dev +++ /dev/null @@ -1 +0,0 @@ -4095:1 diff --git a/test/sys/class/i2c-dev/i2c-fake1/name b/test/sys/class/i2c-dev/i2c-fake1/name deleted file mode 100644 index ced44c39d4..0000000000 --- a/test/sys/class/i2c-dev/i2c-fake1/name +++ /dev/null @@ -1 +0,0 @@ -fake1 dev diff --git a/test/sys/class/i2c-dev/i2c-fake1/subsystem b/test/sys/class/i2c-dev/i2c-fake1/subsystem deleted file mode 120000 index 5545800cc7..0000000000 --- a/test/sys/class/i2c-dev/i2c-fake1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../i2c-dev \ No newline at end of file diff --git a/test/sys/class/i2c-dev/i2c-fake2/dev b/test/sys/class/i2c-dev/i2c-fake2/dev deleted file mode 100644 index d2425b701a..0000000000 --- a/test/sys/class/i2c-dev/i2c-fake2/dev +++ /dev/null @@ -1 +0,0 @@ -4094:89999 diff --git a/test/sys/class/i2c-dev/i2c-fake2/name b/test/sys/class/i2c-dev/i2c-fake2/name deleted file mode 100644 index b69deec2bf..0000000000 --- a/test/sys/class/i2c-dev/i2c-fake2/name +++ /dev/null @@ -1 +0,0 @@ -fake2 dev diff --git a/test/sys/class/i2c-dev/i2c-fake2/subsystem b/test/sys/class/i2c-dev/i2c-fake2/subsystem deleted file mode 120000 index 5545800cc7..0000000000 --- a/test/sys/class/i2c-dev/i2c-fake2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../i2c-dev \ No newline at end of file diff --git a/test/sys/class/ieee80211/phy0 b/test/sys/class/ieee80211/phy0 new file mode 120000 index 0000000000..0b6cc2d6f6 --- /dev/null +++ b/test/sys/class/ieee80211/phy0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0 \ No newline at end of file diff --git a/test/sys/class/input/event0 b/test/sys/class/input/event0 new file mode 120000 index 0000000000..d2d695f0b7 --- /dev/null +++ b/test/sys/class/input/event0 @@ -0,0 +1 @@ +../../devices/platform/i8042/serio0/input/input0/event0 \ No newline at end of file diff --git a/test/sys/class/input/event1 b/test/sys/class/input/event1 new file mode 120000 index 0000000000..a4dcf8e11d --- /dev/null +++ b/test/sys/class/input/event1 @@ -0,0 +1 @@ +../../devices/platform/i8042/serio1/input/input1/event1 \ No newline at end of file diff --git a/test/sys/class/input/event2 b/test/sys/class/input/event2 new file mode 120000 index 0000000000..5faad280d9 --- /dev/null +++ b/test/sys/class/input/event2 @@ -0,0 +1 @@ +../../devices/platform/pcspkr/input/input2/event2 \ No newline at end of file diff --git a/test/sys/class/input/event3 b/test/sys/class/input/event3 new file mode 120000 index 0000000000..65fdd24cfd --- /dev/null +++ b/test/sys/class/input/event3 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3 \ No newline at end of file diff --git a/test/sys/class/input/event4 b/test/sys/class/input/event4 new file mode 120000 index 0000000000..3bd330ffb8 --- /dev/null +++ b/test/sys/class/input/event4 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4 \ No newline at end of file diff --git a/test/sys/class/input/event5 b/test/sys/class/input/event5 new file mode 120000 index 0000000000..d60c233c11 --- /dev/null +++ b/test/sys/class/input/event5 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5 \ No newline at end of file diff --git a/test/sys/class/input/event6 b/test/sys/class/input/event6 new file mode 120000 index 0000000000..581626ed43 --- /dev/null +++ b/test/sys/class/input/event6 @@ -0,0 +1 @@ +../../devices/virtual/input/input6/event6 \ No newline at end of file diff --git a/test/sys/class/input/event7 b/test/sys/class/input/event7 new file mode 120000 index 0000000000..d253ce1cdf --- /dev/null +++ b/test/sys/class/input/event7 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7 \ No newline at end of file diff --git a/test/sys/class/input/input0 b/test/sys/class/input/input0 new file mode 120000 index 0000000000..681d162216 --- /dev/null +++ b/test/sys/class/input/input0 @@ -0,0 +1 @@ +../../devices/platform/i8042/serio0/input/input0 \ No newline at end of file diff --git a/test/sys/class/input/input1 b/test/sys/class/input/input1 new file mode 120000 index 0000000000..e7300b62a3 --- /dev/null +++ b/test/sys/class/input/input1 @@ -0,0 +1 @@ +../../devices/platform/i8042/serio1/input/input1 \ No newline at end of file diff --git a/test/sys/class/input/input2 b/test/sys/class/input/input2 new file mode 120000 index 0000000000..78641a6c94 --- /dev/null +++ b/test/sys/class/input/input2 @@ -0,0 +1 @@ +../../devices/platform/pcspkr/input/input2 \ No newline at end of file diff --git a/test/sys/class/input/input3 b/test/sys/class/input/input3 new file mode 120000 index 0000000000..2eaa003db1 --- /dev/null +++ b/test/sys/class/input/input3 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/LNXPWRBN:00/input/input3 \ No newline at end of file diff --git a/test/sys/class/input/input4 b/test/sys/class/input/input4 new file mode 120000 index 0000000000..7d0a5a3208 --- /dev/null +++ b/test/sys/class/input/input4 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4 \ No newline at end of file diff --git a/test/sys/class/input/input5 b/test/sys/class/input/input5 new file mode 120000 index 0000000000..815d79445b --- /dev/null +++ b/test/sys/class/input/input5 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5 \ No newline at end of file diff --git a/test/sys/class/input/input6 b/test/sys/class/input/input6 new file mode 120000 index 0000000000..df5cd72332 --- /dev/null +++ b/test/sys/class/input/input6 @@ -0,0 +1 @@ +../../devices/virtual/input/input6 \ No newline at end of file diff --git a/test/sys/class/input/input7 b/test/sys/class/input/input7 new file mode 120000 index 0000000000..9fb9b2af6f --- /dev/null +++ b/test/sys/class/input/input7 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7 \ No newline at end of file diff --git a/test/sys/class/input/mice b/test/sys/class/input/mice new file mode 120000 index 0000000000..17e795b481 --- /dev/null +++ b/test/sys/class/input/mice @@ -0,0 +1 @@ +../../devices/virtual/input/mice \ No newline at end of file diff --git a/test/sys/class/input/mouse0 b/test/sys/class/input/mouse0 new file mode 120000 index 0000000000..58db4cc7fa --- /dev/null +++ b/test/sys/class/input/mouse0 @@ -0,0 +1 @@ +../../devices/platform/i8042/serio1/input/input1/mouse0 \ No newline at end of file diff --git a/test/sys/class/input/mouse1 b/test/sys/class/input/mouse1 new file mode 120000 index 0000000000..5b46213a42 --- /dev/null +++ b/test/sys/class/input/mouse1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1 \ No newline at end of file diff --git a/test/sys/class/leds/iwl-phy0:RX b/test/sys/class/leds/iwl-phy0:RX new file mode 120000 index 0000000000..3e852657ea --- /dev/null +++ b/test/sys/class/leds/iwl-phy0:RX @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX \ No newline at end of file diff --git a/test/sys/class/leds/iwl-phy0:TX b/test/sys/class/leds/iwl-phy0:TX new file mode 120000 index 0000000000..23bba069e8 --- /dev/null +++ b/test/sys/class/leds/iwl-phy0:TX @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX \ No newline at end of file diff --git a/test/sys/class/leds/iwl-phy0:assoc b/test/sys/class/leds/iwl-phy0:assoc new file mode 120000 index 0000000000..c41f12aafc --- /dev/null +++ b/test/sys/class/leds/iwl-phy0:assoc @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc \ No newline at end of file diff --git a/test/sys/class/leds/iwl-phy0:radio b/test/sys/class/leds/iwl-phy0:radio new file mode 120000 index 0000000000..7a62fa159f --- /dev/null +++ b/test/sys/class/leds/iwl-phy0:radio @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::bay_active b/test/sys/class/leds/tpacpi::bay_active new file mode 120000 index 0000000000..4553847f29 --- /dev/null +++ b/test/sys/class/leds/tpacpi::bay_active @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/leds/tpacpi::bay_active \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::dock_active b/test/sys/class/leds/tpacpi::dock_active new file mode 120000 index 0000000000..51d1bf9360 --- /dev/null +++ b/test/sys/class/leds/tpacpi::dock_active @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/leds/tpacpi::dock_active \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::dock_batt b/test/sys/class/leds/tpacpi::dock_batt new file mode 120000 index 0000000000..ae8a31fae0 --- /dev/null +++ b/test/sys/class/leds/tpacpi::dock_batt @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::power b/test/sys/class/leds/tpacpi::power new file mode 120000 index 0000000000..9214cffbc9 --- /dev/null +++ b/test/sys/class/leds/tpacpi::power @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/leds/tpacpi::power \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::standby b/test/sys/class/leds/tpacpi::standby new file mode 120000 index 0000000000..98c4779ae9 --- /dev/null +++ b/test/sys/class/leds/tpacpi::standby @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/leds/tpacpi::standby \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::thinklight b/test/sys/class/leds/tpacpi::thinklight new file mode 120000 index 0000000000..64c7da5986 --- /dev/null +++ b/test/sys/class/leds/tpacpi::thinklight @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/leds/tpacpi::thinklight \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::unknown_led b/test/sys/class/leds/tpacpi::unknown_led new file mode 120000 index 0000000000..e1088e9f8e --- /dev/null +++ b/test/sys/class/leds/tpacpi::unknown_led @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi:green:batt b/test/sys/class/leds/tpacpi:green:batt new file mode 120000 index 0000000000..0c69835c94 --- /dev/null +++ b/test/sys/class/leds/tpacpi:green:batt @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/leds/tpacpi:green:batt \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi:orange:batt b/test/sys/class/leds/tpacpi:orange:batt new file mode 120000 index 0000000000..3a29c366e0 --- /dev/null +++ b/test/sys/class/leds/tpacpi:orange:batt @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt \ No newline at end of file diff --git a/test/sys/class/mem/full b/test/sys/class/mem/full new file mode 120000 index 0000000000..3305ef6885 --- /dev/null +++ b/test/sys/class/mem/full @@ -0,0 +1 @@ +../../devices/virtual/mem/full \ No newline at end of file diff --git a/test/sys/class/mem/full/dev b/test/sys/class/mem/full/dev deleted file mode 100644 index 4dc588f930..0000000000 --- a/test/sys/class/mem/full/dev +++ /dev/null @@ -1 +0,0 @@ -1:7 diff --git a/test/sys/class/mem/full/subsystem b/test/sys/class/mem/full/subsystem deleted file mode 120000 index 142e1f4ba7..0000000000 --- a/test/sys/class/mem/full/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../mem \ No newline at end of file diff --git a/test/sys/class/mem/kmem b/test/sys/class/mem/kmem new file mode 120000 index 0000000000..fd2e57d601 --- /dev/null +++ b/test/sys/class/mem/kmem @@ -0,0 +1 @@ +../../devices/virtual/mem/kmem \ No newline at end of file diff --git a/test/sys/class/mem/kmem/dev b/test/sys/class/mem/kmem/dev deleted file mode 100644 index c7bc405e0f..0000000000 --- a/test/sys/class/mem/kmem/dev +++ /dev/null @@ -1 +0,0 @@ -1:2 diff --git a/test/sys/class/mem/kmem/subsystem b/test/sys/class/mem/kmem/subsystem deleted file mode 120000 index 142e1f4ba7..0000000000 --- a/test/sys/class/mem/kmem/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../mem \ No newline at end of file diff --git a/test/sys/class/mem/kmsg b/test/sys/class/mem/kmsg new file mode 120000 index 0000000000..cd44206462 --- /dev/null +++ b/test/sys/class/mem/kmsg @@ -0,0 +1 @@ +../../devices/virtual/mem/kmsg \ No newline at end of file diff --git a/test/sys/class/mem/kmsg/dev b/test/sys/class/mem/kmsg/dev deleted file mode 100644 index 59effa12a9..0000000000 --- a/test/sys/class/mem/kmsg/dev +++ /dev/null @@ -1 +0,0 @@ -1:11 diff --git a/test/sys/class/mem/kmsg/subsystem b/test/sys/class/mem/kmsg/subsystem deleted file mode 120000 index 142e1f4ba7..0000000000 --- a/test/sys/class/mem/kmsg/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../mem \ No newline at end of file diff --git a/test/sys/class/mem/mem b/test/sys/class/mem/mem new file mode 120000 index 0000000000..4971e087b4 --- /dev/null +++ b/test/sys/class/mem/mem @@ -0,0 +1 @@ +../../devices/virtual/mem/mem \ No newline at end of file diff --git a/test/sys/class/mem/mem/dev b/test/sys/class/mem/mem/dev deleted file mode 100644 index a72b75e75e..0000000000 --- a/test/sys/class/mem/mem/dev +++ /dev/null @@ -1 +0,0 @@ -1:1 diff --git a/test/sys/class/mem/mem/subsystem b/test/sys/class/mem/mem/subsystem deleted file mode 120000 index 142e1f4ba7..0000000000 --- a/test/sys/class/mem/mem/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../mem \ No newline at end of file diff --git a/test/sys/class/mem/null b/test/sys/class/mem/null new file mode 120000 index 0000000000..8fe50f9623 --- /dev/null +++ b/test/sys/class/mem/null @@ -0,0 +1 @@ +../../devices/virtual/mem/null \ No newline at end of file diff --git a/test/sys/class/mem/null/dev b/test/sys/class/mem/null/dev deleted file mode 100644 index d9812edfef..0000000000 --- a/test/sys/class/mem/null/dev +++ /dev/null @@ -1 +0,0 @@ -1:3 diff --git a/test/sys/class/mem/null/subsystem b/test/sys/class/mem/null/subsystem deleted file mode 120000 index 142e1f4ba7..0000000000 --- a/test/sys/class/mem/null/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../mem \ No newline at end of file diff --git a/test/sys/class/mem/port b/test/sys/class/mem/port new file mode 120000 index 0000000000..0f635f5945 --- /dev/null +++ b/test/sys/class/mem/port @@ -0,0 +1 @@ +../../devices/virtual/mem/port \ No newline at end of file diff --git a/test/sys/class/mem/port/dev b/test/sys/class/mem/port/dev deleted file mode 100644 index ab11afd2ec..0000000000 --- a/test/sys/class/mem/port/dev +++ /dev/null @@ -1 +0,0 @@ -1:4 diff --git a/test/sys/class/mem/port/subsystem b/test/sys/class/mem/port/subsystem deleted file mode 120000 index 142e1f4ba7..0000000000 --- a/test/sys/class/mem/port/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../mem \ No newline at end of file diff --git a/test/sys/class/mem/random b/test/sys/class/mem/random new file mode 120000 index 0000000000..b751f35293 --- /dev/null +++ b/test/sys/class/mem/random @@ -0,0 +1 @@ +../../devices/virtual/mem/random \ No newline at end of file diff --git a/test/sys/class/mem/random/dev b/test/sys/class/mem/random/dev deleted file mode 100644 index 2b7b905849..0000000000 --- a/test/sys/class/mem/random/dev +++ /dev/null @@ -1 +0,0 @@ -1:8 diff --git a/test/sys/class/mem/random/subsystem b/test/sys/class/mem/random/subsystem deleted file mode 120000 index 142e1f4ba7..0000000000 --- a/test/sys/class/mem/random/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../mem \ No newline at end of file diff --git a/test/sys/class/mem/urandom b/test/sys/class/mem/urandom new file mode 120000 index 0000000000..c69f1e2c68 --- /dev/null +++ b/test/sys/class/mem/urandom @@ -0,0 +1 @@ +../../devices/virtual/mem/urandom \ No newline at end of file diff --git a/test/sys/class/mem/urandom/dev b/test/sys/class/mem/urandom/dev deleted file mode 100644 index 0695af03c5..0000000000 --- a/test/sys/class/mem/urandom/dev +++ /dev/null @@ -1 +0,0 @@ -1:9 diff --git a/test/sys/class/mem/urandom/subsystem b/test/sys/class/mem/urandom/subsystem deleted file mode 120000 index 142e1f4ba7..0000000000 --- a/test/sys/class/mem/urandom/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../mem \ No newline at end of file diff --git a/test/sys/class/mem/zero b/test/sys/class/mem/zero new file mode 120000 index 0000000000..fea0d4d472 --- /dev/null +++ b/test/sys/class/mem/zero @@ -0,0 +1 @@ +../../devices/virtual/mem/zero \ No newline at end of file diff --git a/test/sys/class/mem/zero/dev b/test/sys/class/mem/zero/dev deleted file mode 100644 index 0acbea55a4..0000000000 --- a/test/sys/class/mem/zero/dev +++ /dev/null @@ -1 +0,0 @@ -1:5 diff --git a/test/sys/class/mem/zero/subsystem b/test/sys/class/mem/zero/subsystem deleted file mode 120000 index 142e1f4ba7..0000000000 --- a/test/sys/class/mem/zero/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../mem \ No newline at end of file diff --git a/test/sys/class/misc/cpu_dma_latency b/test/sys/class/misc/cpu_dma_latency new file mode 120000 index 0000000000..9236586351 --- /dev/null +++ b/test/sys/class/misc/cpu_dma_latency @@ -0,0 +1 @@ +../../devices/virtual/misc/cpu_dma_latency \ No newline at end of file diff --git a/test/sys/class/misc/device-mapper b/test/sys/class/misc/device-mapper new file mode 120000 index 0000000000..be736a2d8e --- /dev/null +++ b/test/sys/class/misc/device-mapper @@ -0,0 +1 @@ +../../devices/virtual/misc/device-mapper \ No newline at end of file diff --git a/test/sys/class/misc/fuse b/test/sys/class/misc/fuse new file mode 120000 index 0000000000..293b69bfe8 --- /dev/null +++ b/test/sys/class/misc/fuse @@ -0,0 +1 @@ +../../devices/virtual/misc/fuse \ No newline at end of file diff --git a/test/sys/class/misc/hpet b/test/sys/class/misc/hpet new file mode 120000 index 0000000000..9a8a753964 --- /dev/null +++ b/test/sys/class/misc/hpet @@ -0,0 +1 @@ +../../devices/virtual/misc/hpet \ No newline at end of file diff --git a/test/sys/class/misc/mcelog b/test/sys/class/misc/mcelog new file mode 120000 index 0000000000..b89f6666f5 --- /dev/null +++ b/test/sys/class/misc/mcelog @@ -0,0 +1 @@ +../../devices/virtual/misc/mcelog \ No newline at end of file diff --git a/test/sys/class/misc/microcode b/test/sys/class/misc/microcode new file mode 120000 index 0000000000..d5989199d8 --- /dev/null +++ b/test/sys/class/misc/microcode @@ -0,0 +1 @@ +../../devices/virtual/misc/microcode \ No newline at end of file diff --git a/test/sys/class/misc/network_latency b/test/sys/class/misc/network_latency new file mode 120000 index 0000000000..13bd46af83 --- /dev/null +++ b/test/sys/class/misc/network_latency @@ -0,0 +1 @@ +../../devices/virtual/misc/network_latency \ No newline at end of file diff --git a/test/sys/class/misc/network_throughput b/test/sys/class/misc/network_throughput new file mode 120000 index 0000000000..3804785676 --- /dev/null +++ b/test/sys/class/misc/network_throughput @@ -0,0 +1 @@ +../../devices/virtual/misc/network_throughput \ No newline at end of file diff --git a/test/sys/class/misc/nvram b/test/sys/class/misc/nvram new file mode 120000 index 0000000000..e819d9348c --- /dev/null +++ b/test/sys/class/misc/nvram @@ -0,0 +1 @@ +../../devices/virtual/misc/nvram \ No newline at end of file diff --git a/test/sys/class/misc/psaux b/test/sys/class/misc/psaux new file mode 120000 index 0000000000..740b359d77 --- /dev/null +++ b/test/sys/class/misc/psaux @@ -0,0 +1 @@ +../../devices/virtual/misc/psaux \ No newline at end of file diff --git a/test/sys/class/misc/psaux/dev b/test/sys/class/misc/psaux/dev deleted file mode 100644 index 48ace1eca2..0000000000 --- a/test/sys/class/misc/psaux/dev +++ /dev/null @@ -1 +0,0 @@ -10:1 diff --git a/test/sys/class/misc/psaux/subsystem b/test/sys/class/misc/psaux/subsystem deleted file mode 120000 index 2825552c9b..0000000000 --- a/test/sys/class/misc/psaux/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../misc \ No newline at end of file diff --git a/test/sys/class/misc/rtc/dev b/test/sys/class/misc/rtc/dev deleted file mode 100644 index 64e028a296..0000000000 --- a/test/sys/class/misc/rtc/dev +++ /dev/null @@ -1 +0,0 @@ -10:135 diff --git a/test/sys/class/misc/rtc/subsystem b/test/sys/class/misc/rtc/subsystem deleted file mode 120000 index 2825552c9b..0000000000 --- a/test/sys/class/misc/rtc/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../misc \ No newline at end of file diff --git a/test/sys/class/misc/uinput b/test/sys/class/misc/uinput new file mode 120000 index 0000000000..565db3ee51 --- /dev/null +++ b/test/sys/class/misc/uinput @@ -0,0 +1 @@ +../../devices/virtual/misc/uinput \ No newline at end of file diff --git a/test/sys/class/misc/uinput/dev b/test/sys/class/misc/uinput/dev deleted file mode 100644 index a47be0d551..0000000000 --- a/test/sys/class/misc/uinput/dev +++ /dev/null @@ -1 +0,0 @@ -10:223 diff --git a/test/sys/class/misc/uinput/subsystem b/test/sys/class/misc/uinput/subsystem deleted file mode 120000 index 2825552c9b..0000000000 --- a/test/sys/class/misc/uinput/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../misc \ No newline at end of file diff --git a/test/sys/class/net/eth0 b/test/sys/class/net/eth0 new file mode 120000 index 0000000000..c1ba21c554 --- /dev/null +++ b/test/sys/class/net/eth0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0 \ No newline at end of file diff --git a/test/sys/class/net/eth0/addr_len b/test/sys/class/net/eth0/addr_len deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/class/net/eth0/addr_len +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/class/net/eth0/address b/test/sys/class/net/eth0/address deleted file mode 100644 index 4e0cdd519d..0000000000 --- a/test/sys/class/net/eth0/address +++ /dev/null @@ -1 +0,0 @@ -00:e0:00:fb:04:e1 diff --git a/test/sys/class/net/eth0/broadcast b/test/sys/class/net/eth0/broadcast deleted file mode 100644 index d516b03245..0000000000 --- a/test/sys/class/net/eth0/broadcast +++ /dev/null @@ -1 +0,0 @@ -ff:ff:ff:ff:ff:ff diff --git a/test/sys/class/net/eth0/features b/test/sys/class/net/eth0/features deleted file mode 100644 index bf73d73743..0000000000 --- a/test/sys/class/net/eth0/features +++ /dev/null @@ -1 +0,0 @@ -0x29 diff --git a/test/sys/class/net/eth0/flags b/test/sys/class/net/eth0/flags deleted file mode 100644 index 4af9ab2807..0000000000 --- a/test/sys/class/net/eth0/flags +++ /dev/null @@ -1 +0,0 @@ -0x1023 diff --git a/test/sys/class/net/eth0/ifindex b/test/sys/class/net/eth0/ifindex deleted file mode 100644 index ec635144f6..0000000000 --- a/test/sys/class/net/eth0/ifindex +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test/sys/class/net/eth0/iflink b/test/sys/class/net/eth0/iflink deleted file mode 100644 index ec635144f6..0000000000 --- a/test/sys/class/net/eth0/iflink +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test/sys/class/net/eth0/mtu b/test/sys/class/net/eth0/mtu deleted file mode 100644 index 3d86ec6498..0000000000 --- a/test/sys/class/net/eth0/mtu +++ /dev/null @@ -1 +0,0 @@ -1500 diff --git a/test/sys/class/net/eth0/subsystem b/test/sys/class/net/eth0/subsystem deleted file mode 120000 index f138bf38f8..0000000000 --- a/test/sys/class/net/eth0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../net \ No newline at end of file diff --git a/test/sys/class/net/eth0/tx_queue_len b/test/sys/class/net/eth0/tx_queue_len deleted file mode 100644 index 83b33d238d..0000000000 --- a/test/sys/class/net/eth0/tx_queue_len +++ /dev/null @@ -1 +0,0 @@ -1000 diff --git a/test/sys/class/net/eth0/type b/test/sys/class/net/eth0/type deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/class/net/eth0/type +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/class/net/eth1/addr_len b/test/sys/class/net/eth1/addr_len deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/class/net/eth1/addr_len +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/class/net/eth1/address b/test/sys/class/net/eth1/address deleted file mode 100644 index 7325095c16..0000000000 --- a/test/sys/class/net/eth1/address +++ /dev/null @@ -1 +0,0 @@ -00:e0:00:8d:9f:25 diff --git a/test/sys/class/net/eth1/broadcast b/test/sys/class/net/eth1/broadcast deleted file mode 100644 index d516b03245..0000000000 --- a/test/sys/class/net/eth1/broadcast +++ /dev/null @@ -1 +0,0 @@ -ff:ff:ff:ff:ff:ff diff --git a/test/sys/class/net/eth1/features b/test/sys/class/net/eth1/features deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/class/net/eth1/features +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/class/net/eth1/flags b/test/sys/class/net/eth1/flags deleted file mode 100644 index 7f97d854fc..0000000000 --- a/test/sys/class/net/eth1/flags +++ /dev/null @@ -1 +0,0 @@ -0x1002 diff --git a/test/sys/class/net/eth1/ifindex b/test/sys/class/net/eth1/ifindex deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/class/net/eth1/ifindex +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/class/net/eth1/iflink b/test/sys/class/net/eth1/iflink deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/class/net/eth1/iflink +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/class/net/eth1/mtu b/test/sys/class/net/eth1/mtu deleted file mode 100644 index 3d86ec6498..0000000000 --- a/test/sys/class/net/eth1/mtu +++ /dev/null @@ -1 +0,0 @@ -1500 diff --git a/test/sys/class/net/eth1/subsystem b/test/sys/class/net/eth1/subsystem deleted file mode 120000 index f138bf38f8..0000000000 --- a/test/sys/class/net/eth1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../net \ No newline at end of file diff --git a/test/sys/class/net/eth1/tx_queue_len b/test/sys/class/net/eth1/tx_queue_len deleted file mode 100644 index 83b33d238d..0000000000 --- a/test/sys/class/net/eth1/tx_queue_len +++ /dev/null @@ -1 +0,0 @@ -1000 diff --git a/test/sys/class/net/eth1/type b/test/sys/class/net/eth1/type deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/class/net/eth1/type +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/class/net/eth1/wireless/beacon b/test/sys/class/net/eth1/wireless/beacon deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/class/net/eth1/wireless/beacon +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/class/net/eth1/wireless/crypt b/test/sys/class/net/eth1/wireless/crypt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/class/net/eth1/wireless/crypt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/class/net/eth1/wireless/fragment b/test/sys/class/net/eth1/wireless/fragment deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/class/net/eth1/wireless/fragment +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/class/net/eth1/wireless/level b/test/sys/class/net/eth1/wireless/level deleted file mode 100644 index e702a30b33..0000000000 --- a/test/sys/class/net/eth1/wireless/level +++ /dev/null @@ -1 +0,0 @@ -188 diff --git a/test/sys/class/net/eth1/wireless/link b/test/sys/class/net/eth1/wireless/link deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/class/net/eth1/wireless/link +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/class/net/eth1/wireless/misc b/test/sys/class/net/eth1/wireless/misc deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/class/net/eth1/wireless/misc +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/class/net/eth1/wireless/noise b/test/sys/class/net/eth1/wireless/noise deleted file mode 100644 index 405e2afe8e..0000000000 --- a/test/sys/class/net/eth1/wireless/noise +++ /dev/null @@ -1 +0,0 @@ -134 diff --git a/test/sys/class/net/eth1/wireless/nwid b/test/sys/class/net/eth1/wireless/nwid deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/class/net/eth1/wireless/nwid +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/class/net/eth1/wireless/retries b/test/sys/class/net/eth1/wireless/retries deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/class/net/eth1/wireless/retries +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/class/net/eth1/wireless/status b/test/sys/class/net/eth1/wireless/status deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/class/net/eth1/wireless/status +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/class/net/lo b/test/sys/class/net/lo new file mode 120000 index 0000000000..c40cc08ac2 --- /dev/null +++ b/test/sys/class/net/lo @@ -0,0 +1 @@ +../../devices/virtual/net/lo \ No newline at end of file diff --git a/test/sys/class/net/lo/addr_len b/test/sys/class/net/lo/addr_len deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/class/net/lo/addr_len +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/class/net/lo/address b/test/sys/class/net/lo/address deleted file mode 100644 index 34e09d077c..0000000000 --- a/test/sys/class/net/lo/address +++ /dev/null @@ -1 +0,0 @@ -00:00:00:00:00:00 diff --git a/test/sys/class/net/lo/broadcast b/test/sys/class/net/lo/broadcast deleted file mode 100644 index 34e09d077c..0000000000 --- a/test/sys/class/net/lo/broadcast +++ /dev/null @@ -1 +0,0 @@ -00:00:00:00:00:00 diff --git a/test/sys/class/net/lo/features b/test/sys/class/net/lo/features deleted file mode 100644 index e8768d26fc..0000000000 --- a/test/sys/class/net/lo/features +++ /dev/null @@ -1 +0,0 @@ -0x65 diff --git a/test/sys/class/net/lo/flags b/test/sys/class/net/lo/flags deleted file mode 100644 index 4bc4da19ae..0000000000 --- a/test/sys/class/net/lo/flags +++ /dev/null @@ -1 +0,0 @@ -0x9 diff --git a/test/sys/class/net/lo/ifindex b/test/sys/class/net/lo/ifindex deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/class/net/lo/ifindex +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/class/net/lo/iflink b/test/sys/class/net/lo/iflink deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/class/net/lo/iflink +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/class/net/lo/mtu b/test/sys/class/net/lo/mtu deleted file mode 100644 index e20e16cfe8..0000000000 --- a/test/sys/class/net/lo/mtu +++ /dev/null @@ -1 +0,0 @@ -16436 diff --git a/test/sys/class/net/lo/subsystem b/test/sys/class/net/lo/subsystem deleted file mode 120000 index f138bf38f8..0000000000 --- a/test/sys/class/net/lo/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../net \ No newline at end of file diff --git a/test/sys/class/net/lo/tx_queue_len b/test/sys/class/net/lo/tx_queue_len deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/class/net/lo/tx_queue_len +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/class/net/lo/type b/test/sys/class/net/lo/type deleted file mode 100644 index 6d629c4a23..0000000000 --- a/test/sys/class/net/lo/type +++ /dev/null @@ -1 +0,0 @@ -772 diff --git a/test/sys/class/net/wlan0 b/test/sys/class/net/wlan0 new file mode 120000 index 0000000000..c4c4a83f57 --- /dev/null +++ b/test/sys/class/net/wlan0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0 \ No newline at end of file diff --git a/test/sys/class/net/wmaster0 b/test/sys/class/net/wmaster0 new file mode 120000 index 0000000000..3e0bec365e --- /dev/null +++ b/test/sys/class/net/wmaster0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:00 b/test/sys/class/pci_bus/0000:00 new file mode 120000 index 0000000000..6682dbbd1f --- /dev/null +++ b/test/sys/class/pci_bus/0000:00 @@ -0,0 +1 @@ +../../devices/pci0000:00/pci_bus/0000:00 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:01 b/test/sys/class/pci_bus/0000:01 new file mode 120000 index 0000000000..58140954bb --- /dev/null +++ b/test/sys/class/pci_bus/0000:01 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:01.0/pci_bus/0000:01 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:02 b/test/sys/class/pci_bus/0000:02 new file mode 120000 index 0000000000..56a18e1cff --- /dev/null +++ b/test/sys/class/pci_bus/0000:02 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:03 b/test/sys/class/pci_bus/0000:03 new file mode 120000 index 0000000000..fe9c6f68c5 --- /dev/null +++ b/test/sys/class/pci_bus/0000:03 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:04 b/test/sys/class/pci_bus/0000:04 new file mode 120000 index 0000000000..7b5aa93c47 --- /dev/null +++ b/test/sys/class/pci_bus/0000:04 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:0c b/test/sys/class/pci_bus/0000:0c new file mode 120000 index 0000000000..cc1031e67d --- /dev/null +++ b/test/sys/class/pci_bus/0000:0c @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:15 b/test/sys/class/pci_bus/0000:15 new file mode 120000 index 0000000000..cd1d3322b7 --- /dev/null +++ b/test/sys/class/pci_bus/0000:15 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:16 b/test/sys/class/pci_bus/0000:16 new file mode 120000 index 0000000000..c32e0c7a83 --- /dev/null +++ b/test/sys/class/pci_bus/0000:16 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16 \ No newline at end of file diff --git a/test/sys/class/pcmcia_socket/pcmcia_socket0 b/test/sys/class/pcmcia_socket/pcmcia_socket0 new file mode 120000 index 0000000000..ecb6225dbc --- /dev/null +++ b/test/sys/class/pcmcia_socket/pcmcia_socket0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0 \ No newline at end of file diff --git a/test/sys/class/power_supply/AC b/test/sys/class/power_supply/AC new file mode 120000 index 0000000000..a42c2072ba --- /dev/null +++ b/test/sys/class/power_supply/AC @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC \ No newline at end of file diff --git a/test/sys/class/power_supply/BAT0 b/test/sys/class/power_supply/BAT0 new file mode 120000 index 0000000000..3858474d5c --- /dev/null +++ b/test/sys/class/power_supply/BAT0 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 \ No newline at end of file diff --git a/test/sys/class/rfkill/rfkill0 b/test/sys/class/rfkill/rfkill0 new file mode 120000 index 0000000000..912a4e0a68 --- /dev/null +++ b/test/sys/class/rfkill/rfkill0 @@ -0,0 +1 @@ +../../devices/platform/thinkpad_acpi/rfkill/rfkill0 \ No newline at end of file diff --git a/test/sys/class/rtc/rtc0 b/test/sys/class/rtc/rtc0 new file mode 120000 index 0000000000..b7116fb0aa --- /dev/null +++ b/test/sys/class/rtc/rtc0 @@ -0,0 +1 @@ +../../devices/pnp0/00:07/rtc/rtc0 \ No newline at end of file diff --git a/test/sys/class/scsi_device/0:0:0:0 b/test/sys/class/scsi_device/0:0:0:0 new file mode 120000 index 0000000000..bfa2c195ac --- /dev/null +++ b/test/sys/class/scsi_device/0:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_device/4:0:0:0 b/test/sys/class/scsi_device/4:0:0:0 new file mode 120000 index 0000000000..8de428ae89 --- /dev/null +++ b/test/sys/class/scsi_device/4:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_device/6:0:0:0 b/test/sys/class/scsi_device/6:0:0:0 new file mode 120000 index 0000000000..a28103d133 --- /dev/null +++ b/test/sys/class/scsi_device/6:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/scsi_device/6:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_disk/0:0:0:0 b/test/sys/class/scsi_disk/0:0:0:0 new file mode 120000 index 0000000000..904526c6ee --- /dev/null +++ b/test/sys/class/scsi_disk/0:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_disk/6:0:0:0 b/test/sys/class/scsi_disk/6:0:0:0 new file mode 120000 index 0000000000..520214d150 --- /dev/null +++ b/test/sys/class/scsi_disk/6:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/scsi_disk/6:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_generic/sg0 b/test/sys/class/scsi_generic/sg0 new file mode 120000 index 0000000000..93d1199d1d --- /dev/null +++ b/test/sys/class/scsi_generic/sg0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 \ No newline at end of file diff --git a/test/sys/class/scsi_generic/sg1 b/test/sys/class/scsi_generic/sg1 new file mode 120000 index 0000000000..768d2dc122 --- /dev/null +++ b/test/sys/class/scsi_generic/sg1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1 \ No newline at end of file diff --git a/test/sys/class/scsi_generic/sg2 b/test/sys/class/scsi_generic/sg2 new file mode 120000 index 0000000000..21cdcefce1 --- /dev/null +++ b/test/sys/class/scsi_generic/sg2 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/scsi_generic/sg2 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host0 b/test/sys/class/scsi_host/host0 new file mode 120000 index 0000000000..2b32179c87 --- /dev/null +++ b/test/sys/class/scsi_host/host0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host1 b/test/sys/class/scsi_host/host1 new file mode 120000 index 0000000000..2ea45e4583 --- /dev/null +++ b/test/sys/class/scsi_host/host1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host2 b/test/sys/class/scsi_host/host2 new file mode 120000 index 0000000000..728d191704 --- /dev/null +++ b/test/sys/class/scsi_host/host2 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host3 b/test/sys/class/scsi_host/host3 new file mode 120000 index 0000000000..76de2907dd --- /dev/null +++ b/test/sys/class/scsi_host/host3 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host4 b/test/sys/class/scsi_host/host4 new file mode 120000 index 0000000000..0d3a7503e3 --- /dev/null +++ b/test/sys/class/scsi_host/host4 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host5 b/test/sys/class/scsi_host/host5 new file mode 120000 index 0000000000..5ff01499aa --- /dev/null +++ b/test/sys/class/scsi_host/host5 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host6 b/test/sys/class/scsi_host/host6 new file mode 120000 index 0000000000..7b9e28c4c9 --- /dev/null +++ b/test/sys/class/scsi_host/host6 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/scsi_host/host6 \ No newline at end of file diff --git a/test/sys/class/sound/adsp b/test/sys/class/sound/adsp new file mode 120000 index 0000000000..1c2d43b53c --- /dev/null +++ b/test/sys/class/sound/adsp @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/adsp \ No newline at end of file diff --git a/test/sys/class/sound/audio b/test/sys/class/sound/audio new file mode 120000 index 0000000000..1fa8f211b8 --- /dev/null +++ b/test/sys/class/sound/audio @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/audio \ No newline at end of file diff --git a/test/sys/class/sound/card0 b/test/sys/class/sound/card0 new file mode 120000 index 0000000000..b70239b7be --- /dev/null +++ b/test/sys/class/sound/card0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0 \ No newline at end of file diff --git a/test/sys/class/sound/controlC0 b/test/sys/class/sound/controlC0 new file mode 120000 index 0000000000..72acd4aa77 --- /dev/null +++ b/test/sys/class/sound/controlC0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0 \ No newline at end of file diff --git a/test/sys/class/sound/dsp b/test/sys/class/sound/dsp new file mode 120000 index 0000000000..91f29fcdfb --- /dev/null +++ b/test/sys/class/sound/dsp @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/dsp \ No newline at end of file diff --git a/test/sys/class/sound/mixer b/test/sys/class/sound/mixer new file mode 120000 index 0000000000..d1099becaf --- /dev/null +++ b/test/sys/class/sound/mixer @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/mixer \ No newline at end of file diff --git a/test/sys/class/sound/pcmC0D0c b/test/sys/class/sound/pcmC0D0c new file mode 120000 index 0000000000..af82f9219b --- /dev/null +++ b/test/sys/class/sound/pcmC0D0c @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c \ No newline at end of file diff --git a/test/sys/class/sound/pcmC0D0p b/test/sys/class/sound/pcmC0D0p new file mode 120000 index 0000000000..ac9e13aaf7 --- /dev/null +++ b/test/sys/class/sound/pcmC0D0p @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p \ No newline at end of file diff --git a/test/sys/class/sound/pcmC0D1p b/test/sys/class/sound/pcmC0D1p new file mode 120000 index 0000000000..d8efba4918 --- /dev/null +++ b/test/sys/class/sound/pcmC0D1p @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p \ No newline at end of file diff --git a/test/sys/class/sound/seq b/test/sys/class/sound/seq new file mode 120000 index 0000000000..322a82bfa0 --- /dev/null +++ b/test/sys/class/sound/seq @@ -0,0 +1 @@ +../../devices/virtual/sound/seq \ No newline at end of file diff --git a/test/sys/class/sound/timer b/test/sys/class/sound/timer new file mode 120000 index 0000000000..1ce5c875c2 --- /dev/null +++ b/test/sys/class/sound/timer @@ -0,0 +1 @@ +../../devices/virtual/sound/timer \ No newline at end of file diff --git a/test/sys/class/thermal/cooling_device0 b/test/sys/class/thermal/cooling_device0 new file mode 120000 index 0000000000..ea93d4309f --- /dev/null +++ b/test/sys/class/thermal/cooling_device0 @@ -0,0 +1 @@ +../../devices/virtual/thermal/cooling_device0 \ No newline at end of file diff --git a/test/sys/class/thermal/cooling_device1 b/test/sys/class/thermal/cooling_device1 new file mode 120000 index 0000000000..0e8e30cb05 --- /dev/null +++ b/test/sys/class/thermal/cooling_device1 @@ -0,0 +1 @@ +../../devices/virtual/thermal/cooling_device1 \ No newline at end of file diff --git a/test/sys/class/thermal/thermal_zone0 b/test/sys/class/thermal/thermal_zone0 new file mode 120000 index 0000000000..e26359c431 --- /dev/null +++ b/test/sys/class/thermal/thermal_zone0 @@ -0,0 +1 @@ +../../devices/virtual/thermal/thermal_zone0 \ No newline at end of file diff --git a/test/sys/class/thermal/thermal_zone1 b/test/sys/class/thermal/thermal_zone1 new file mode 120000 index 0000000000..6e49270d04 --- /dev/null +++ b/test/sys/class/thermal/thermal_zone1 @@ -0,0 +1 @@ +../../devices/virtual/thermal/thermal_zone1 \ No newline at end of file diff --git a/test/sys/class/tty/console b/test/sys/class/tty/console new file mode 120000 index 0000000000..2483dd2791 --- /dev/null +++ b/test/sys/class/tty/console @@ -0,0 +1 @@ +../../devices/virtual/tty/console \ No newline at end of file diff --git a/test/sys/class/tty/console/dev b/test/sys/class/tty/console/dev deleted file mode 100644 index 99eb99cd27..0000000000 --- a/test/sys/class/tty/console/dev +++ /dev/null @@ -1 +0,0 @@ -5:1 diff --git a/test/sys/class/tty/console/subsystem b/test/sys/class/tty/console/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/console/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ptmx b/test/sys/class/tty/ptmx new file mode 120000 index 0000000000..9c489ead9f --- /dev/null +++ b/test/sys/class/tty/ptmx @@ -0,0 +1 @@ +../../devices/virtual/tty/ptmx \ No newline at end of file diff --git a/test/sys/class/tty/ptmx/dev b/test/sys/class/tty/ptmx/dev deleted file mode 100644 index b1df63ebd3..0000000000 --- a/test/sys/class/tty/ptmx/dev +++ /dev/null @@ -1 +0,0 @@ -5:2 diff --git a/test/sys/class/tty/ptmx/subsystem b/test/sys/class/tty/ptmx/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ptmx/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty b/test/sys/class/tty/tty new file mode 120000 index 0000000000..e67d736497 --- /dev/null +++ b/test/sys/class/tty/tty @@ -0,0 +1 @@ +../../devices/virtual/tty/tty \ No newline at end of file diff --git a/test/sys/class/tty/tty/dev b/test/sys/class/tty/tty/dev deleted file mode 100644 index 97f5a222f0..0000000000 --- a/test/sys/class/tty/tty/dev +++ /dev/null @@ -1 +0,0 @@ -5:0 diff --git a/test/sys/class/tty/tty/subsystem b/test/sys/class/tty/tty/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty0 b/test/sys/class/tty/tty0 new file mode 120000 index 0000000000..1ebbbc882a --- /dev/null +++ b/test/sys/class/tty/tty0 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty0 \ No newline at end of file diff --git a/test/sys/class/tty/tty0/dev b/test/sys/class/tty/tty0/dev deleted file mode 100644 index 192d8b739c..0000000000 --- a/test/sys/class/tty/tty0/dev +++ /dev/null @@ -1 +0,0 @@ -4:0 diff --git a/test/sys/class/tty/tty0/subsystem b/test/sys/class/tty/tty0/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty1 b/test/sys/class/tty/tty1 new file mode 120000 index 0000000000..e0418dabc9 --- /dev/null +++ b/test/sys/class/tty/tty1 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty1 \ No newline at end of file diff --git a/test/sys/class/tty/tty1/dev b/test/sys/class/tty/tty1/dev deleted file mode 100644 index 71275a262f..0000000000 --- a/test/sys/class/tty/tty1/dev +++ /dev/null @@ -1 +0,0 @@ -4:1 diff --git a/test/sys/class/tty/tty1/subsystem b/test/sys/class/tty/tty1/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty10 b/test/sys/class/tty/tty10 new file mode 120000 index 0000000000..319d31f915 --- /dev/null +++ b/test/sys/class/tty/tty10 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty10 \ No newline at end of file diff --git a/test/sys/class/tty/tty10/dev b/test/sys/class/tty/tty10/dev deleted file mode 100644 index eb477d040f..0000000000 --- a/test/sys/class/tty/tty10/dev +++ /dev/null @@ -1 +0,0 @@ -4:10 diff --git a/test/sys/class/tty/tty10/subsystem b/test/sys/class/tty/tty10/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty10/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty11 b/test/sys/class/tty/tty11 new file mode 120000 index 0000000000..9c76e05207 --- /dev/null +++ b/test/sys/class/tty/tty11 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty11 \ No newline at end of file diff --git a/test/sys/class/tty/tty11/dev b/test/sys/class/tty/tty11/dev deleted file mode 100644 index 685b194273..0000000000 --- a/test/sys/class/tty/tty11/dev +++ /dev/null @@ -1 +0,0 @@ -4:11 diff --git a/test/sys/class/tty/tty11/subsystem b/test/sys/class/tty/tty11/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty11/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty12 b/test/sys/class/tty/tty12 new file mode 120000 index 0000000000..abac0f831a --- /dev/null +++ b/test/sys/class/tty/tty12 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty12 \ No newline at end of file diff --git a/test/sys/class/tty/tty12/dev b/test/sys/class/tty/tty12/dev deleted file mode 100644 index 47b68a96a5..0000000000 --- a/test/sys/class/tty/tty12/dev +++ /dev/null @@ -1 +0,0 @@ -4:12 diff --git a/test/sys/class/tty/tty12/subsystem b/test/sys/class/tty/tty12/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty12/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty13 b/test/sys/class/tty/tty13 new file mode 120000 index 0000000000..c3812100e0 --- /dev/null +++ b/test/sys/class/tty/tty13 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty13 \ No newline at end of file diff --git a/test/sys/class/tty/tty13/dev b/test/sys/class/tty/tty13/dev deleted file mode 100644 index 86e31456d2..0000000000 --- a/test/sys/class/tty/tty13/dev +++ /dev/null @@ -1 +0,0 @@ -4:13 diff --git a/test/sys/class/tty/tty13/subsystem b/test/sys/class/tty/tty13/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty13/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty14 b/test/sys/class/tty/tty14 new file mode 120000 index 0000000000..63bd3a6764 --- /dev/null +++ b/test/sys/class/tty/tty14 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty14 \ No newline at end of file diff --git a/test/sys/class/tty/tty14/dev b/test/sys/class/tty/tty14/dev deleted file mode 100644 index 9fa8103ff8..0000000000 --- a/test/sys/class/tty/tty14/dev +++ /dev/null @@ -1 +0,0 @@ -4:14 diff --git a/test/sys/class/tty/tty14/subsystem b/test/sys/class/tty/tty14/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty14/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty15 b/test/sys/class/tty/tty15 new file mode 120000 index 0000000000..e2c5914874 --- /dev/null +++ b/test/sys/class/tty/tty15 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty15 \ No newline at end of file diff --git a/test/sys/class/tty/tty15/dev b/test/sys/class/tty/tty15/dev deleted file mode 100644 index 3f601b851f..0000000000 --- a/test/sys/class/tty/tty15/dev +++ /dev/null @@ -1 +0,0 @@ -4:15 diff --git a/test/sys/class/tty/tty15/subsystem b/test/sys/class/tty/tty15/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty15/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty16 b/test/sys/class/tty/tty16 new file mode 120000 index 0000000000..d8846a866d --- /dev/null +++ b/test/sys/class/tty/tty16 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty16 \ No newline at end of file diff --git a/test/sys/class/tty/tty16/dev b/test/sys/class/tty/tty16/dev deleted file mode 100644 index 0310e8064a..0000000000 --- a/test/sys/class/tty/tty16/dev +++ /dev/null @@ -1 +0,0 @@ -4:16 diff --git a/test/sys/class/tty/tty16/subsystem b/test/sys/class/tty/tty16/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty16/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty17 b/test/sys/class/tty/tty17 new file mode 120000 index 0000000000..a488b19305 --- /dev/null +++ b/test/sys/class/tty/tty17 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty17 \ No newline at end of file diff --git a/test/sys/class/tty/tty17/dev b/test/sys/class/tty/tty17/dev deleted file mode 100644 index 19360464d0..0000000000 --- a/test/sys/class/tty/tty17/dev +++ /dev/null @@ -1 +0,0 @@ -4:17 diff --git a/test/sys/class/tty/tty17/subsystem b/test/sys/class/tty/tty17/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty17/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty18 b/test/sys/class/tty/tty18 new file mode 120000 index 0000000000..933880a8c7 --- /dev/null +++ b/test/sys/class/tty/tty18 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty18 \ No newline at end of file diff --git a/test/sys/class/tty/tty18/dev b/test/sys/class/tty/tty18/dev deleted file mode 100644 index 8710c48f12..0000000000 --- a/test/sys/class/tty/tty18/dev +++ /dev/null @@ -1 +0,0 @@ -4:18 diff --git a/test/sys/class/tty/tty18/subsystem b/test/sys/class/tty/tty18/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty18/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty19 b/test/sys/class/tty/tty19 new file mode 120000 index 0000000000..398ff33d7a --- /dev/null +++ b/test/sys/class/tty/tty19 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty19 \ No newline at end of file diff --git a/test/sys/class/tty/tty19/dev b/test/sys/class/tty/tty19/dev deleted file mode 100644 index 5fac93ed2f..0000000000 --- a/test/sys/class/tty/tty19/dev +++ /dev/null @@ -1 +0,0 @@ -4:19 diff --git a/test/sys/class/tty/tty19/subsystem b/test/sys/class/tty/tty19/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty19/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty2 b/test/sys/class/tty/tty2 new file mode 120000 index 0000000000..15b216c9f4 --- /dev/null +++ b/test/sys/class/tty/tty2 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty2 \ No newline at end of file diff --git a/test/sys/class/tty/tty2/dev b/test/sys/class/tty/tty2/dev deleted file mode 100644 index ac0836d7ca..0000000000 --- a/test/sys/class/tty/tty2/dev +++ /dev/null @@ -1 +0,0 @@ -4:2 diff --git a/test/sys/class/tty/tty2/subsystem b/test/sys/class/tty/tty2/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty20 b/test/sys/class/tty/tty20 new file mode 120000 index 0000000000..bacbb6a5cc --- /dev/null +++ b/test/sys/class/tty/tty20 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty20 \ No newline at end of file diff --git a/test/sys/class/tty/tty20/dev b/test/sys/class/tty/tty20/dev deleted file mode 100644 index 3db4a84c87..0000000000 --- a/test/sys/class/tty/tty20/dev +++ /dev/null @@ -1 +0,0 @@ -4:20 diff --git a/test/sys/class/tty/tty20/subsystem b/test/sys/class/tty/tty20/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty20/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty21 b/test/sys/class/tty/tty21 new file mode 120000 index 0000000000..73f9c8c982 --- /dev/null +++ b/test/sys/class/tty/tty21 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty21 \ No newline at end of file diff --git a/test/sys/class/tty/tty21/dev b/test/sys/class/tty/tty21/dev deleted file mode 100644 index f86a02508c..0000000000 --- a/test/sys/class/tty/tty21/dev +++ /dev/null @@ -1 +0,0 @@ -4:21 diff --git a/test/sys/class/tty/tty21/subsystem b/test/sys/class/tty/tty21/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty21/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty22 b/test/sys/class/tty/tty22 new file mode 120000 index 0000000000..a2a0d8ca63 --- /dev/null +++ b/test/sys/class/tty/tty22 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty22 \ No newline at end of file diff --git a/test/sys/class/tty/tty22/dev b/test/sys/class/tty/tty22/dev deleted file mode 100644 index b27a240d1a..0000000000 --- a/test/sys/class/tty/tty22/dev +++ /dev/null @@ -1 +0,0 @@ -4:22 diff --git a/test/sys/class/tty/tty22/subsystem b/test/sys/class/tty/tty22/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty22/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty23 b/test/sys/class/tty/tty23 new file mode 120000 index 0000000000..8daebf5f43 --- /dev/null +++ b/test/sys/class/tty/tty23 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty23 \ No newline at end of file diff --git a/test/sys/class/tty/tty23/dev b/test/sys/class/tty/tty23/dev deleted file mode 100644 index 9359bfa71d..0000000000 --- a/test/sys/class/tty/tty23/dev +++ /dev/null @@ -1 +0,0 @@ -4:23 diff --git a/test/sys/class/tty/tty23/subsystem b/test/sys/class/tty/tty23/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty23/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty24 b/test/sys/class/tty/tty24 new file mode 120000 index 0000000000..67a64368f8 --- /dev/null +++ b/test/sys/class/tty/tty24 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty24 \ No newline at end of file diff --git a/test/sys/class/tty/tty24/dev b/test/sys/class/tty/tty24/dev deleted file mode 100644 index 9cd85c8a81..0000000000 --- a/test/sys/class/tty/tty24/dev +++ /dev/null @@ -1 +0,0 @@ -4:24 diff --git a/test/sys/class/tty/tty24/subsystem b/test/sys/class/tty/tty24/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty24/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty25 b/test/sys/class/tty/tty25 new file mode 120000 index 0000000000..4f8d0795d2 --- /dev/null +++ b/test/sys/class/tty/tty25 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty25 \ No newline at end of file diff --git a/test/sys/class/tty/tty25/dev b/test/sys/class/tty/tty25/dev deleted file mode 100644 index f9d8c9c059..0000000000 --- a/test/sys/class/tty/tty25/dev +++ /dev/null @@ -1 +0,0 @@ -4:25 diff --git a/test/sys/class/tty/tty25/subsystem b/test/sys/class/tty/tty25/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty25/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty26 b/test/sys/class/tty/tty26 new file mode 120000 index 0000000000..2f65d8be1d --- /dev/null +++ b/test/sys/class/tty/tty26 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty26 \ No newline at end of file diff --git a/test/sys/class/tty/tty26/dev b/test/sys/class/tty/tty26/dev deleted file mode 100644 index 210b637b97..0000000000 --- a/test/sys/class/tty/tty26/dev +++ /dev/null @@ -1 +0,0 @@ -4:26 diff --git a/test/sys/class/tty/tty26/subsystem b/test/sys/class/tty/tty26/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty26/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty27 b/test/sys/class/tty/tty27 new file mode 120000 index 0000000000..0d1a42b943 --- /dev/null +++ b/test/sys/class/tty/tty27 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty27 \ No newline at end of file diff --git a/test/sys/class/tty/tty27/dev b/test/sys/class/tty/tty27/dev deleted file mode 100644 index de59b627a5..0000000000 --- a/test/sys/class/tty/tty27/dev +++ /dev/null @@ -1 +0,0 @@ -4:27 diff --git a/test/sys/class/tty/tty27/subsystem b/test/sys/class/tty/tty27/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty27/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty28 b/test/sys/class/tty/tty28 new file mode 120000 index 0000000000..1419911bde --- /dev/null +++ b/test/sys/class/tty/tty28 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty28 \ No newline at end of file diff --git a/test/sys/class/tty/tty28/dev b/test/sys/class/tty/tty28/dev deleted file mode 100644 index 023871c676..0000000000 --- a/test/sys/class/tty/tty28/dev +++ /dev/null @@ -1 +0,0 @@ -4:28 diff --git a/test/sys/class/tty/tty28/subsystem b/test/sys/class/tty/tty28/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty28/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty29 b/test/sys/class/tty/tty29 new file mode 120000 index 0000000000..2d15900bf2 --- /dev/null +++ b/test/sys/class/tty/tty29 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty29 \ No newline at end of file diff --git a/test/sys/class/tty/tty29/dev b/test/sys/class/tty/tty29/dev deleted file mode 100644 index 2edd7c58af..0000000000 --- a/test/sys/class/tty/tty29/dev +++ /dev/null @@ -1 +0,0 @@ -4:29 diff --git a/test/sys/class/tty/tty29/subsystem b/test/sys/class/tty/tty29/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty29/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty3 b/test/sys/class/tty/tty3 new file mode 120000 index 0000000000..7764e1c747 --- /dev/null +++ b/test/sys/class/tty/tty3 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty3 \ No newline at end of file diff --git a/test/sys/class/tty/tty3/dev b/test/sys/class/tty/tty3/dev deleted file mode 100644 index c8142884a4..0000000000 --- a/test/sys/class/tty/tty3/dev +++ /dev/null @@ -1 +0,0 @@ -4:3 diff --git a/test/sys/class/tty/tty3/subsystem b/test/sys/class/tty/tty3/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty30 b/test/sys/class/tty/tty30 new file mode 120000 index 0000000000..d8bb78d95e --- /dev/null +++ b/test/sys/class/tty/tty30 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty30 \ No newline at end of file diff --git a/test/sys/class/tty/tty30/dev b/test/sys/class/tty/tty30/dev deleted file mode 100644 index 63f0e669b8..0000000000 --- a/test/sys/class/tty/tty30/dev +++ /dev/null @@ -1 +0,0 @@ -4:30 diff --git a/test/sys/class/tty/tty30/subsystem b/test/sys/class/tty/tty30/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty30/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty31 b/test/sys/class/tty/tty31 new file mode 120000 index 0000000000..4f5a23296a --- /dev/null +++ b/test/sys/class/tty/tty31 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty31 \ No newline at end of file diff --git a/test/sys/class/tty/tty31/dev b/test/sys/class/tty/tty31/dev deleted file mode 100644 index 77a50eeff5..0000000000 --- a/test/sys/class/tty/tty31/dev +++ /dev/null @@ -1 +0,0 @@ -4:31 diff --git a/test/sys/class/tty/tty31/subsystem b/test/sys/class/tty/tty31/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty31/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty32 b/test/sys/class/tty/tty32 new file mode 120000 index 0000000000..5d1dc6fe32 --- /dev/null +++ b/test/sys/class/tty/tty32 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty32 \ No newline at end of file diff --git a/test/sys/class/tty/tty32/dev b/test/sys/class/tty/tty32/dev deleted file mode 100644 index ae38a8dcd7..0000000000 --- a/test/sys/class/tty/tty32/dev +++ /dev/null @@ -1 +0,0 @@ -4:32 diff --git a/test/sys/class/tty/tty32/subsystem b/test/sys/class/tty/tty32/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty32/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty33 b/test/sys/class/tty/tty33 new file mode 120000 index 0000000000..95bb3af2f0 --- /dev/null +++ b/test/sys/class/tty/tty33 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty33 \ No newline at end of file diff --git a/test/sys/class/tty/tty33/dev b/test/sys/class/tty/tty33/dev deleted file mode 100644 index 9307b44cd0..0000000000 --- a/test/sys/class/tty/tty33/dev +++ /dev/null @@ -1 +0,0 @@ -4:33 diff --git a/test/sys/class/tty/tty33/subsystem b/test/sys/class/tty/tty33/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty33/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty34 b/test/sys/class/tty/tty34 new file mode 120000 index 0000000000..9212f5c8ac --- /dev/null +++ b/test/sys/class/tty/tty34 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty34 \ No newline at end of file diff --git a/test/sys/class/tty/tty34/dev b/test/sys/class/tty/tty34/dev deleted file mode 100644 index be00cbe67c..0000000000 --- a/test/sys/class/tty/tty34/dev +++ /dev/null @@ -1 +0,0 @@ -4:34 diff --git a/test/sys/class/tty/tty34/subsystem b/test/sys/class/tty/tty34/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty34/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty35 b/test/sys/class/tty/tty35 new file mode 120000 index 0000000000..7a3ebc2945 --- /dev/null +++ b/test/sys/class/tty/tty35 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty35 \ No newline at end of file diff --git a/test/sys/class/tty/tty35/dev b/test/sys/class/tty/tty35/dev deleted file mode 100644 index 4e5e85cb70..0000000000 --- a/test/sys/class/tty/tty35/dev +++ /dev/null @@ -1 +0,0 @@ -4:35 diff --git a/test/sys/class/tty/tty35/subsystem b/test/sys/class/tty/tty35/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty35/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty36 b/test/sys/class/tty/tty36 new file mode 120000 index 0000000000..96a7b1a62e --- /dev/null +++ b/test/sys/class/tty/tty36 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty36 \ No newline at end of file diff --git a/test/sys/class/tty/tty36/dev b/test/sys/class/tty/tty36/dev deleted file mode 100644 index 4e5407ef59..0000000000 --- a/test/sys/class/tty/tty36/dev +++ /dev/null @@ -1 +0,0 @@ -4:36 diff --git a/test/sys/class/tty/tty36/subsystem b/test/sys/class/tty/tty36/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty36/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty37 b/test/sys/class/tty/tty37 new file mode 120000 index 0000000000..520543a8c2 --- /dev/null +++ b/test/sys/class/tty/tty37 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty37 \ No newline at end of file diff --git a/test/sys/class/tty/tty37/dev b/test/sys/class/tty/tty37/dev deleted file mode 100644 index 765acf2d2c..0000000000 --- a/test/sys/class/tty/tty37/dev +++ /dev/null @@ -1 +0,0 @@ -4:37 diff --git a/test/sys/class/tty/tty37/subsystem b/test/sys/class/tty/tty37/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty37/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty38 b/test/sys/class/tty/tty38 new file mode 120000 index 0000000000..6ad284dfdc --- /dev/null +++ b/test/sys/class/tty/tty38 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty38 \ No newline at end of file diff --git a/test/sys/class/tty/tty38/dev b/test/sys/class/tty/tty38/dev deleted file mode 100644 index 1532b15793..0000000000 --- a/test/sys/class/tty/tty38/dev +++ /dev/null @@ -1 +0,0 @@ -4:38 diff --git a/test/sys/class/tty/tty38/subsystem b/test/sys/class/tty/tty38/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty38/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty39 b/test/sys/class/tty/tty39 new file mode 120000 index 0000000000..d001bab9ee --- /dev/null +++ b/test/sys/class/tty/tty39 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty39 \ No newline at end of file diff --git a/test/sys/class/tty/tty39/dev b/test/sys/class/tty/tty39/dev deleted file mode 100644 index fac383d3df..0000000000 --- a/test/sys/class/tty/tty39/dev +++ /dev/null @@ -1 +0,0 @@ -4:39 diff --git a/test/sys/class/tty/tty39/subsystem b/test/sys/class/tty/tty39/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty39/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty4 b/test/sys/class/tty/tty4 new file mode 120000 index 0000000000..784bf4d728 --- /dev/null +++ b/test/sys/class/tty/tty4 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty4 \ No newline at end of file diff --git a/test/sys/class/tty/tty4/dev b/test/sys/class/tty/tty4/dev deleted file mode 100644 index 7f407b5d25..0000000000 --- a/test/sys/class/tty/tty4/dev +++ /dev/null @@ -1 +0,0 @@ -4:4 diff --git a/test/sys/class/tty/tty4/subsystem b/test/sys/class/tty/tty4/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty40 b/test/sys/class/tty/tty40 new file mode 120000 index 0000000000..dc6ea499d3 --- /dev/null +++ b/test/sys/class/tty/tty40 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty40 \ No newline at end of file diff --git a/test/sys/class/tty/tty40/dev b/test/sys/class/tty/tty40/dev deleted file mode 100644 index d7246138ac..0000000000 --- a/test/sys/class/tty/tty40/dev +++ /dev/null @@ -1 +0,0 @@ -4:40 diff --git a/test/sys/class/tty/tty40/subsystem b/test/sys/class/tty/tty40/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty40/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty41 b/test/sys/class/tty/tty41 new file mode 120000 index 0000000000..8a8f597f36 --- /dev/null +++ b/test/sys/class/tty/tty41 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty41 \ No newline at end of file diff --git a/test/sys/class/tty/tty41/dev b/test/sys/class/tty/tty41/dev deleted file mode 100644 index 0d974303d5..0000000000 --- a/test/sys/class/tty/tty41/dev +++ /dev/null @@ -1 +0,0 @@ -4:41 diff --git a/test/sys/class/tty/tty41/subsystem b/test/sys/class/tty/tty41/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty41/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty42 b/test/sys/class/tty/tty42 new file mode 120000 index 0000000000..397f4316e3 --- /dev/null +++ b/test/sys/class/tty/tty42 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty42 \ No newline at end of file diff --git a/test/sys/class/tty/tty42/dev b/test/sys/class/tty/tty42/dev deleted file mode 100644 index 4019d23bfa..0000000000 --- a/test/sys/class/tty/tty42/dev +++ /dev/null @@ -1 +0,0 @@ -4:42 diff --git a/test/sys/class/tty/tty42/subsystem b/test/sys/class/tty/tty42/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty42/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty43 b/test/sys/class/tty/tty43 new file mode 120000 index 0000000000..77f93885e1 --- /dev/null +++ b/test/sys/class/tty/tty43 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty43 \ No newline at end of file diff --git a/test/sys/class/tty/tty43/dev b/test/sys/class/tty/tty43/dev deleted file mode 100644 index 4b6c086540..0000000000 --- a/test/sys/class/tty/tty43/dev +++ /dev/null @@ -1 +0,0 @@ -4:43 diff --git a/test/sys/class/tty/tty43/subsystem b/test/sys/class/tty/tty43/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty43/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty44 b/test/sys/class/tty/tty44 new file mode 120000 index 0000000000..9b9077d9f0 --- /dev/null +++ b/test/sys/class/tty/tty44 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty44 \ No newline at end of file diff --git a/test/sys/class/tty/tty44/dev b/test/sys/class/tty/tty44/dev deleted file mode 100644 index 9c2357463f..0000000000 --- a/test/sys/class/tty/tty44/dev +++ /dev/null @@ -1 +0,0 @@ -4:44 diff --git a/test/sys/class/tty/tty44/subsystem b/test/sys/class/tty/tty44/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty44/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty45 b/test/sys/class/tty/tty45 new file mode 120000 index 0000000000..794cf19308 --- /dev/null +++ b/test/sys/class/tty/tty45 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty45 \ No newline at end of file diff --git a/test/sys/class/tty/tty45/dev b/test/sys/class/tty/tty45/dev deleted file mode 100644 index 23437be177..0000000000 --- a/test/sys/class/tty/tty45/dev +++ /dev/null @@ -1 +0,0 @@ -4:45 diff --git a/test/sys/class/tty/tty45/subsystem b/test/sys/class/tty/tty45/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty45/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty46 b/test/sys/class/tty/tty46 new file mode 120000 index 0000000000..200c809887 --- /dev/null +++ b/test/sys/class/tty/tty46 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty46 \ No newline at end of file diff --git a/test/sys/class/tty/tty46/dev b/test/sys/class/tty/tty46/dev deleted file mode 100644 index 816feaf47d..0000000000 --- a/test/sys/class/tty/tty46/dev +++ /dev/null @@ -1 +0,0 @@ -4:46 diff --git a/test/sys/class/tty/tty46/subsystem b/test/sys/class/tty/tty46/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty46/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty47 b/test/sys/class/tty/tty47 new file mode 120000 index 0000000000..9c3d9156d9 --- /dev/null +++ b/test/sys/class/tty/tty47 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty47 \ No newline at end of file diff --git a/test/sys/class/tty/tty47/dev b/test/sys/class/tty/tty47/dev deleted file mode 100644 index d2534e707d..0000000000 --- a/test/sys/class/tty/tty47/dev +++ /dev/null @@ -1 +0,0 @@ -4:47 diff --git a/test/sys/class/tty/tty47/subsystem b/test/sys/class/tty/tty47/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty47/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty48 b/test/sys/class/tty/tty48 new file mode 120000 index 0000000000..9b9a4cda68 --- /dev/null +++ b/test/sys/class/tty/tty48 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty48 \ No newline at end of file diff --git a/test/sys/class/tty/tty48/dev b/test/sys/class/tty/tty48/dev deleted file mode 100644 index 4003c709df..0000000000 --- a/test/sys/class/tty/tty48/dev +++ /dev/null @@ -1 +0,0 @@ -4:48 diff --git a/test/sys/class/tty/tty48/subsystem b/test/sys/class/tty/tty48/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty48/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty49 b/test/sys/class/tty/tty49 new file mode 120000 index 0000000000..304113d078 --- /dev/null +++ b/test/sys/class/tty/tty49 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty49 \ No newline at end of file diff --git a/test/sys/class/tty/tty49/dev b/test/sys/class/tty/tty49/dev deleted file mode 100644 index 64dc806057..0000000000 --- a/test/sys/class/tty/tty49/dev +++ /dev/null @@ -1 +0,0 @@ -4:49 diff --git a/test/sys/class/tty/tty49/subsystem b/test/sys/class/tty/tty49/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty49/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty5 b/test/sys/class/tty/tty5 new file mode 120000 index 0000000000..88eaad31a4 --- /dev/null +++ b/test/sys/class/tty/tty5 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty5 \ No newline at end of file diff --git a/test/sys/class/tty/tty5/dev b/test/sys/class/tty/tty5/dev deleted file mode 100644 index 1553222302..0000000000 --- a/test/sys/class/tty/tty5/dev +++ /dev/null @@ -1 +0,0 @@ -4:5 diff --git a/test/sys/class/tty/tty5/subsystem b/test/sys/class/tty/tty5/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty50 b/test/sys/class/tty/tty50 new file mode 120000 index 0000000000..980e47e84d --- /dev/null +++ b/test/sys/class/tty/tty50 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty50 \ No newline at end of file diff --git a/test/sys/class/tty/tty50/dev b/test/sys/class/tty/tty50/dev deleted file mode 100644 index 71e681bc39..0000000000 --- a/test/sys/class/tty/tty50/dev +++ /dev/null @@ -1 +0,0 @@ -4:50 diff --git a/test/sys/class/tty/tty50/subsystem b/test/sys/class/tty/tty50/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty50/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty51 b/test/sys/class/tty/tty51 new file mode 120000 index 0000000000..996785ba60 --- /dev/null +++ b/test/sys/class/tty/tty51 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty51 \ No newline at end of file diff --git a/test/sys/class/tty/tty51/dev b/test/sys/class/tty/tty51/dev deleted file mode 100644 index 1f8c4b6976..0000000000 --- a/test/sys/class/tty/tty51/dev +++ /dev/null @@ -1 +0,0 @@ -4:51 diff --git a/test/sys/class/tty/tty51/subsystem b/test/sys/class/tty/tty51/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty51/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty52 b/test/sys/class/tty/tty52 new file mode 120000 index 0000000000..da16c4fa0f --- /dev/null +++ b/test/sys/class/tty/tty52 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty52 \ No newline at end of file diff --git a/test/sys/class/tty/tty52/dev b/test/sys/class/tty/tty52/dev deleted file mode 100644 index 344e8c93f9..0000000000 --- a/test/sys/class/tty/tty52/dev +++ /dev/null @@ -1 +0,0 @@ -4:52 diff --git a/test/sys/class/tty/tty52/subsystem b/test/sys/class/tty/tty52/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty52/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty53 b/test/sys/class/tty/tty53 new file mode 120000 index 0000000000..2f9b5fc00d --- /dev/null +++ b/test/sys/class/tty/tty53 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty53 \ No newline at end of file diff --git a/test/sys/class/tty/tty53/dev b/test/sys/class/tty/tty53/dev deleted file mode 100644 index c4b80fb134..0000000000 --- a/test/sys/class/tty/tty53/dev +++ /dev/null @@ -1 +0,0 @@ -4:53 diff --git a/test/sys/class/tty/tty53/subsystem b/test/sys/class/tty/tty53/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty53/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty54 b/test/sys/class/tty/tty54 new file mode 120000 index 0000000000..066ee67726 --- /dev/null +++ b/test/sys/class/tty/tty54 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty54 \ No newline at end of file diff --git a/test/sys/class/tty/tty54/dev b/test/sys/class/tty/tty54/dev deleted file mode 100644 index ba56c5e44c..0000000000 --- a/test/sys/class/tty/tty54/dev +++ /dev/null @@ -1 +0,0 @@ -4:54 diff --git a/test/sys/class/tty/tty54/subsystem b/test/sys/class/tty/tty54/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty54/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty55 b/test/sys/class/tty/tty55 new file mode 120000 index 0000000000..36b5ab23ea --- /dev/null +++ b/test/sys/class/tty/tty55 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty55 \ No newline at end of file diff --git a/test/sys/class/tty/tty55/dev b/test/sys/class/tty/tty55/dev deleted file mode 100644 index 540bf11253..0000000000 --- a/test/sys/class/tty/tty55/dev +++ /dev/null @@ -1 +0,0 @@ -4:55 diff --git a/test/sys/class/tty/tty55/subsystem b/test/sys/class/tty/tty55/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty55/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty56 b/test/sys/class/tty/tty56 new file mode 120000 index 0000000000..9d59eb5509 --- /dev/null +++ b/test/sys/class/tty/tty56 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty56 \ No newline at end of file diff --git a/test/sys/class/tty/tty56/dev b/test/sys/class/tty/tty56/dev deleted file mode 100644 index ee03fba97d..0000000000 --- a/test/sys/class/tty/tty56/dev +++ /dev/null @@ -1 +0,0 @@ -4:56 diff --git a/test/sys/class/tty/tty56/subsystem b/test/sys/class/tty/tty56/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty56/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty57 b/test/sys/class/tty/tty57 new file mode 120000 index 0000000000..faad99a937 --- /dev/null +++ b/test/sys/class/tty/tty57 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty57 \ No newline at end of file diff --git a/test/sys/class/tty/tty57/dev b/test/sys/class/tty/tty57/dev deleted file mode 100644 index 664d8ec646..0000000000 --- a/test/sys/class/tty/tty57/dev +++ /dev/null @@ -1 +0,0 @@ -4:57 diff --git a/test/sys/class/tty/tty57/subsystem b/test/sys/class/tty/tty57/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty57/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty58 b/test/sys/class/tty/tty58 new file mode 120000 index 0000000000..c8600121f7 --- /dev/null +++ b/test/sys/class/tty/tty58 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty58 \ No newline at end of file diff --git a/test/sys/class/tty/tty58/dev b/test/sys/class/tty/tty58/dev deleted file mode 100644 index ffc6c0b62c..0000000000 --- a/test/sys/class/tty/tty58/dev +++ /dev/null @@ -1 +0,0 @@ -4:58 diff --git a/test/sys/class/tty/tty58/subsystem b/test/sys/class/tty/tty58/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty58/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty59 b/test/sys/class/tty/tty59 new file mode 120000 index 0000000000..703f555529 --- /dev/null +++ b/test/sys/class/tty/tty59 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty59 \ No newline at end of file diff --git a/test/sys/class/tty/tty59/dev b/test/sys/class/tty/tty59/dev deleted file mode 100644 index c48309e7f0..0000000000 --- a/test/sys/class/tty/tty59/dev +++ /dev/null @@ -1 +0,0 @@ -4:59 diff --git a/test/sys/class/tty/tty59/subsystem b/test/sys/class/tty/tty59/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty59/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty6 b/test/sys/class/tty/tty6 new file mode 120000 index 0000000000..efc1d693e2 --- /dev/null +++ b/test/sys/class/tty/tty6 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty6 \ No newline at end of file diff --git a/test/sys/class/tty/tty6/dev b/test/sys/class/tty/tty6/dev deleted file mode 100644 index cd94e0d09d..0000000000 --- a/test/sys/class/tty/tty6/dev +++ /dev/null @@ -1 +0,0 @@ -4:6 diff --git a/test/sys/class/tty/tty6/subsystem b/test/sys/class/tty/tty6/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty60 b/test/sys/class/tty/tty60 new file mode 120000 index 0000000000..3f7263f9ff --- /dev/null +++ b/test/sys/class/tty/tty60 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty60 \ No newline at end of file diff --git a/test/sys/class/tty/tty60/dev b/test/sys/class/tty/tty60/dev deleted file mode 100644 index 37d25eab02..0000000000 --- a/test/sys/class/tty/tty60/dev +++ /dev/null @@ -1 +0,0 @@ -4:60 diff --git a/test/sys/class/tty/tty60/subsystem b/test/sys/class/tty/tty60/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty60/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty61 b/test/sys/class/tty/tty61 new file mode 120000 index 0000000000..cee51b9cdb --- /dev/null +++ b/test/sys/class/tty/tty61 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty61 \ No newline at end of file diff --git a/test/sys/class/tty/tty61/dev b/test/sys/class/tty/tty61/dev deleted file mode 100644 index 599df60bfd..0000000000 --- a/test/sys/class/tty/tty61/dev +++ /dev/null @@ -1 +0,0 @@ -4:61 diff --git a/test/sys/class/tty/tty61/subsystem b/test/sys/class/tty/tty61/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty61/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty62 b/test/sys/class/tty/tty62 new file mode 120000 index 0000000000..c951635197 --- /dev/null +++ b/test/sys/class/tty/tty62 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty62 \ No newline at end of file diff --git a/test/sys/class/tty/tty62/dev b/test/sys/class/tty/tty62/dev deleted file mode 100644 index 49fc9a0af5..0000000000 --- a/test/sys/class/tty/tty62/dev +++ /dev/null @@ -1 +0,0 @@ -4:62 diff --git a/test/sys/class/tty/tty62/subsystem b/test/sys/class/tty/tty62/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty62/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty63 b/test/sys/class/tty/tty63 new file mode 120000 index 0000000000..055770a378 --- /dev/null +++ b/test/sys/class/tty/tty63 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty63 \ No newline at end of file diff --git a/test/sys/class/tty/tty63/dev b/test/sys/class/tty/tty63/dev deleted file mode 100644 index d11e9d2a82..0000000000 --- a/test/sys/class/tty/tty63/dev +++ /dev/null @@ -1 +0,0 @@ -4:63 diff --git a/test/sys/class/tty/tty63/subsystem b/test/sys/class/tty/tty63/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty63/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty7 b/test/sys/class/tty/tty7 new file mode 120000 index 0000000000..0e04f76811 --- /dev/null +++ b/test/sys/class/tty/tty7 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty7 \ No newline at end of file diff --git a/test/sys/class/tty/tty7/dev b/test/sys/class/tty/tty7/dev deleted file mode 100644 index 9410476660..0000000000 --- a/test/sys/class/tty/tty7/dev +++ /dev/null @@ -1 +0,0 @@ -4:7 diff --git a/test/sys/class/tty/tty7/subsystem b/test/sys/class/tty/tty7/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty8 b/test/sys/class/tty/tty8 new file mode 120000 index 0000000000..1289573e26 --- /dev/null +++ b/test/sys/class/tty/tty8 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty8 \ No newline at end of file diff --git a/test/sys/class/tty/tty8/dev b/test/sys/class/tty/tty8/dev deleted file mode 100644 index a79f74ba39..0000000000 --- a/test/sys/class/tty/tty8/dev +++ /dev/null @@ -1 +0,0 @@ -4:8 diff --git a/test/sys/class/tty/tty8/subsystem b/test/sys/class/tty/tty8/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty8/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/tty9 b/test/sys/class/tty/tty9 new file mode 120000 index 0000000000..e4a707b9f4 --- /dev/null +++ b/test/sys/class/tty/tty9 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty9 \ No newline at end of file diff --git a/test/sys/class/tty/tty9/dev b/test/sys/class/tty/tty9/dev deleted file mode 100644 index 62ada4bbe9..0000000000 --- a/test/sys/class/tty/tty9/dev +++ /dev/null @@ -1 +0,0 @@ -4:9 diff --git a/test/sys/class/tty/tty9/subsystem b/test/sys/class/tty/tty9/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/tty9/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyACM0 b/test/sys/class/tty/ttyACM0 new file mode 120000 index 0000000000..40df13c0cf --- /dev/null +++ b/test/sys/class/tty/ttyACM0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0 \ No newline at end of file diff --git a/test/sys/class/tty/ttyS0 b/test/sys/class/tty/ttyS0 new file mode 120000 index 0000000000..860756e70e --- /dev/null +++ b/test/sys/class/tty/ttyS0 @@ -0,0 +1 @@ +../../devices/platform/serial8250/tty/ttyS0 \ No newline at end of file diff --git a/test/sys/class/tty/ttyS0/dev b/test/sys/class/tty/ttyS0/dev deleted file mode 100644 index 9f6b667886..0000000000 --- a/test/sys/class/tty/ttyS0/dev +++ /dev/null @@ -1 +0,0 @@ -4:64 diff --git a/test/sys/class/tty/ttyS0/subsystem b/test/sys/class/tty/ttyS0/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ttyS0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS1 b/test/sys/class/tty/ttyS1 new file mode 120000 index 0000000000..a4e521e3ba --- /dev/null +++ b/test/sys/class/tty/ttyS1 @@ -0,0 +1 @@ +../../devices/platform/serial8250/tty/ttyS1 \ No newline at end of file diff --git a/test/sys/class/tty/ttyS1/dev b/test/sys/class/tty/ttyS1/dev deleted file mode 100644 index db3f8ecdcd..0000000000 --- a/test/sys/class/tty/ttyS1/dev +++ /dev/null @@ -1 +0,0 @@ -4:65 diff --git a/test/sys/class/tty/ttyS1/subsystem b/test/sys/class/tty/ttyS1/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ttyS1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS2 b/test/sys/class/tty/ttyS2 new file mode 120000 index 0000000000..a0170b5335 --- /dev/null +++ b/test/sys/class/tty/ttyS2 @@ -0,0 +1 @@ +../../devices/platform/serial8250/tty/ttyS2 \ No newline at end of file diff --git a/test/sys/class/tty/ttyS2/dev b/test/sys/class/tty/ttyS2/dev deleted file mode 100644 index cef5d02fd9..0000000000 --- a/test/sys/class/tty/ttyS2/dev +++ /dev/null @@ -1 +0,0 @@ -4:66 diff --git a/test/sys/class/tty/ttyS2/subsystem b/test/sys/class/tty/ttyS2/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ttyS2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS3 b/test/sys/class/tty/ttyS3 new file mode 120000 index 0000000000..15ae8b290e --- /dev/null +++ b/test/sys/class/tty/ttyS3 @@ -0,0 +1 @@ +../../devices/platform/serial8250/tty/ttyS3 \ No newline at end of file diff --git a/test/sys/class/tty/ttyS3/dev b/test/sys/class/tty/ttyS3/dev deleted file mode 100644 index 3077006e7a..0000000000 --- a/test/sys/class/tty/ttyS3/dev +++ /dev/null @@ -1 +0,0 @@ -4:67 diff --git a/test/sys/class/tty/ttyS3/subsystem b/test/sys/class/tty/ttyS3/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ttyS3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS4/dev b/test/sys/class/tty/ttyS4/dev deleted file mode 100644 index 26cd2d8c86..0000000000 --- a/test/sys/class/tty/ttyS4/dev +++ /dev/null @@ -1 +0,0 @@ -4:68 diff --git a/test/sys/class/tty/ttyS4/subsystem b/test/sys/class/tty/ttyS4/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ttyS4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS5/dev b/test/sys/class/tty/ttyS5/dev deleted file mode 100644 index 189b73bb6e..0000000000 --- a/test/sys/class/tty/ttyS5/dev +++ /dev/null @@ -1 +0,0 @@ -4:69 diff --git a/test/sys/class/tty/ttyS5/subsystem b/test/sys/class/tty/ttyS5/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ttyS5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS6/dev b/test/sys/class/tty/ttyS6/dev deleted file mode 100644 index f40a113a2a..0000000000 --- a/test/sys/class/tty/ttyS6/dev +++ /dev/null @@ -1 +0,0 @@ -4:70 diff --git a/test/sys/class/tty/ttyS6/subsystem b/test/sys/class/tty/ttyS6/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ttyS6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyS7/dev b/test/sys/class/tty/ttyS7/dev deleted file mode 100644 index ec1b8ff559..0000000000 --- a/test/sys/class/tty/ttyS7/dev +++ /dev/null @@ -1 +0,0 @@ -4:71 diff --git a/test/sys/class/tty/ttyS7/subsystem b/test/sys/class/tty/ttyS7/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ttyS7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/tty/ttyUSB0/dev b/test/sys/class/tty/ttyUSB0/dev deleted file mode 100644 index 5c0bba8170..0000000000 --- a/test/sys/class/tty/ttyUSB0/dev +++ /dev/null @@ -1 +0,0 @@ -188:0 diff --git a/test/sys/class/tty/ttyUSB0/device b/test/sys/class/tty/ttyUSB0/device deleted file mode 120000 index b7733a68e0..0000000000 --- a/test/sys/class/tty/ttyUSB0/device +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0 \ No newline at end of file diff --git a/test/sys/class/tty/ttyUSB0/subsystem b/test/sys/class/tty/ttyUSB0/subsystem deleted file mode 120000 index 31a1be456d..0000000000 --- a/test/sys/class/tty/ttyUSB0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../tty \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev1.1_ep00 b/test/sys/class/usb_endpoint/usbdev1.1_ep00 new file mode 120000 index 0000000000..d7bfbd0c6a --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev1.1_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev1.1_ep81 b/test/sys/class/usb_endpoint/usbdev1.1_ep81 new file mode 120000 index 0000000000..bd2c39312b --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev1.1_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev2.1_ep00 b/test/sys/class/usb_endpoint/usbdev2.1_ep00 new file mode 120000 index 0000000000..47d9d584d5 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev2.1_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev2.1_ep81 b/test/sys/class/usb_endpoint/usbdev2.1_ep81 new file mode 120000 index 0000000000..d83045b65f --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev2.1_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.1_ep00 b/test/sys/class/usb_endpoint/usbdev3.1_ep00 new file mode 120000 index 0000000000..eb3e0285f7 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev3.1_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.1_ep81 b/test/sys/class/usb_endpoint/usbdev3.1_ep81 new file mode 120000 index 0000000000..31df8a686d --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev3.1_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.3_ep00 b/test/sys/class/usb_endpoint/usbdev3.3_ep00 new file mode 120000 index 0000000000..caa389c41a --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev3.3_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.3_ep81 b/test/sys/class/usb_endpoint/usbdev3.3_ep81 new file mode 120000 index 0000000000..c79938362e --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev3.3_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.1_ep00 b/test/sys/class/usb_endpoint/usbdev4.1_ep00 new file mode 120000 index 0000000000..d8722976a0 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.1_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.1_ep81 b/test/sys/class/usb_endpoint/usbdev4.1_ep81 new file mode 120000 index 0000000000..b93a8b8714 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.1_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep00 b/test/sys/class/usb_endpoint/usbdev4.2_ep00 new file mode 120000 index 0000000000..b55c0ca993 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.2_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep02 b/test/sys/class/usb_endpoint/usbdev4.2_ep02 new file mode 120000 index 0000000000..4252382cb5 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.2_ep02 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep03 b/test/sys/class/usb_endpoint/usbdev4.2_ep03 new file mode 120000 index 0000000000..2c9c471c58 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.2_ep03 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep04 b/test/sys/class/usb_endpoint/usbdev4.2_ep04 new file mode 120000 index 0000000000..7a90390108 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.2_ep04 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep81 b/test/sys/class/usb_endpoint/usbdev4.2_ep81 new file mode 120000 index 0000000000..6513618361 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.2_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep82 b/test/sys/class/usb_endpoint/usbdev4.2_ep82 new file mode 120000 index 0000000000..6978069f5a --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.2_ep82 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep83 b/test/sys/class/usb_endpoint/usbdev4.2_ep83 new file mode 120000 index 0000000000..f65bab5870 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.2_ep83 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep84 b/test/sys/class/usb_endpoint/usbdev4.2_ep84 new file mode 120000 index 0000000000..8c21bd0b99 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.2_ep84 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.3_ep00 b/test/sys/class/usb_endpoint/usbdev4.3_ep00 new file mode 120000 index 0000000000..f94fad7264 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.3_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.3_ep02 b/test/sys/class/usb_endpoint/usbdev4.3_ep02 new file mode 120000 index 0000000000..ed97352880 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.3_ep02 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.3_ep81 b/test/sys/class/usb_endpoint/usbdev4.3_ep81 new file mode 120000 index 0000000000..2af437dc67 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.3_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.3_ep83 b/test/sys/class/usb_endpoint/usbdev4.3_ep83 new file mode 120000 index 0000000000..7b5d1c3e1f --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev4.3_ep83 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.1_ep00 b/test/sys/class/usb_endpoint/usbdev5.1_ep00 new file mode 120000 index 0000000000..c4f7637252 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.1_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.1_ep81 b/test/sys/class/usb_endpoint/usbdev5.1_ep81 new file mode 120000 index 0000000000..7ca8e5a1fd --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.1_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep00 b/test/sys/class/usb_endpoint/usbdev5.5_ep00 new file mode 120000 index 0000000000..d3df107049 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.5_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.5_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep01 b/test/sys/class/usb_endpoint/usbdev5.5_ep01 new file mode 120000 index 0000000000..8457e4578b --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.5_ep01 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1/usb_endpoint/usbdev5.5_ep01 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep02 b/test/sys/class/usb_endpoint/usbdev5.5_ep02 new file mode 120000 index 0000000000..492e719a39 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.5_ep02 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3/usb_endpoint/usbdev5.5_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep81 b/test/sys/class/usb_endpoint/usbdev5.5_ep81 new file mode 120000 index 0000000000..84ba82fe1d --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.5_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.5_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep82 b/test/sys/class/usb_endpoint/usbdev5.5_ep82 new file mode 120000 index 0000000000..f23cbb6b2d --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.5_ep82 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1/usb_endpoint/usbdev5.5_ep82 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep83 b/test/sys/class/usb_endpoint/usbdev5.5_ep83 new file mode 120000 index 0000000000..4492b5c3df --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.5_ep83 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.2/usb_endpoint/usbdev5.5_ep83 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep84 b/test/sys/class/usb_endpoint/usbdev5.5_ep84 new file mode 120000 index 0000000000..fce1b65c4c --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.5_ep84 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3/usb_endpoint/usbdev5.5_ep84 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.6_ep00 b/test/sys/class/usb_endpoint/usbdev5.6_ep00 new file mode 120000 index 0000000000..a5f5ee509a --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.6_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.6_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.6_ep02 b/test/sys/class/usb_endpoint/usbdev5.6_ep02 new file mode 120000 index 0000000000..c8c5af20fb --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.6_ep02 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.6_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.6_ep81 b/test/sys/class/usb_endpoint/usbdev5.6_ep81 new file mode 120000 index 0000000000..82bb2de67d --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.6_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.6_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host1 b/test/sys/class/usb_host/usb_host1 new file mode 120000 index 0000000000..7d48824d91 --- /dev/null +++ b/test/sys/class/usb_host/usb_host1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host2 b/test/sys/class/usb_host/usb_host2 new file mode 120000 index 0000000000..841817def2 --- /dev/null +++ b/test/sys/class/usb_host/usb_host2 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host3 b/test/sys/class/usb_host/usb_host3 new file mode 120000 index 0000000000..3258cdf796 --- /dev/null +++ b/test/sys/class/usb_host/usb_host3 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host4 b/test/sys/class/usb_host/usb_host4 new file mode 120000 index 0000000000..c67658538e --- /dev/null +++ b/test/sys/class/usb_host/usb_host4 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host5 b/test/sys/class/usb_host/usb_host5 new file mode 120000 index 0000000000..c2ed47c2cc --- /dev/null +++ b/test/sys/class/usb_host/usb_host5 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5 \ No newline at end of file diff --git a/test/sys/class/vc/vcs b/test/sys/class/vc/vcs new file mode 120000 index 0000000000..b642424830 --- /dev/null +++ b/test/sys/class/vc/vcs @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs \ No newline at end of file diff --git a/test/sys/class/vc/vcs1 b/test/sys/class/vc/vcs1 new file mode 120000 index 0000000000..5855850e22 --- /dev/null +++ b/test/sys/class/vc/vcs1 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs1 \ No newline at end of file diff --git a/test/sys/class/vc/vcs10 b/test/sys/class/vc/vcs10 new file mode 120000 index 0000000000..dab30ff21f --- /dev/null +++ b/test/sys/class/vc/vcs10 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs10 \ No newline at end of file diff --git a/test/sys/class/vc/vcs2 b/test/sys/class/vc/vcs2 new file mode 120000 index 0000000000..3f257365e1 --- /dev/null +++ b/test/sys/class/vc/vcs2 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs2 \ No newline at end of file diff --git a/test/sys/class/vc/vcs3 b/test/sys/class/vc/vcs3 new file mode 120000 index 0000000000..c7190a927a --- /dev/null +++ b/test/sys/class/vc/vcs3 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs3 \ No newline at end of file diff --git a/test/sys/class/vc/vcs4 b/test/sys/class/vc/vcs4 new file mode 120000 index 0000000000..2cbf17f636 --- /dev/null +++ b/test/sys/class/vc/vcs4 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs4 \ No newline at end of file diff --git a/test/sys/class/vc/vcs5 b/test/sys/class/vc/vcs5 new file mode 120000 index 0000000000..0493a1b39b --- /dev/null +++ b/test/sys/class/vc/vcs5 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs5 \ No newline at end of file diff --git a/test/sys/class/vc/vcs6 b/test/sys/class/vc/vcs6 new file mode 120000 index 0000000000..aa0eb575d6 --- /dev/null +++ b/test/sys/class/vc/vcs6 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs6 \ No newline at end of file diff --git a/test/sys/class/vc/vcs7 b/test/sys/class/vc/vcs7 new file mode 120000 index 0000000000..a6bd54ca4c --- /dev/null +++ b/test/sys/class/vc/vcs7 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs7 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa b/test/sys/class/vc/vcsa new file mode 120000 index 0000000000..b7b448a413 --- /dev/null +++ b/test/sys/class/vc/vcsa @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa \ No newline at end of file diff --git a/test/sys/class/vc/vcsa1 b/test/sys/class/vc/vcsa1 new file mode 120000 index 0000000000..ee2129054b --- /dev/null +++ b/test/sys/class/vc/vcsa1 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa1 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa10 b/test/sys/class/vc/vcsa10 new file mode 120000 index 0000000000..24f19fa165 --- /dev/null +++ b/test/sys/class/vc/vcsa10 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa10 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa2 b/test/sys/class/vc/vcsa2 new file mode 120000 index 0000000000..32135b67b3 --- /dev/null +++ b/test/sys/class/vc/vcsa2 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa2 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa3 b/test/sys/class/vc/vcsa3 new file mode 120000 index 0000000000..808a1372af --- /dev/null +++ b/test/sys/class/vc/vcsa3 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa3 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa4 b/test/sys/class/vc/vcsa4 new file mode 120000 index 0000000000..094974435e --- /dev/null +++ b/test/sys/class/vc/vcsa4 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa4 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa5 b/test/sys/class/vc/vcsa5 new file mode 120000 index 0000000000..028b0a82ea --- /dev/null +++ b/test/sys/class/vc/vcsa5 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa5 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa6 b/test/sys/class/vc/vcsa6 new file mode 120000 index 0000000000..9206bb2635 --- /dev/null +++ b/test/sys/class/vc/vcsa6 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa6 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa7 b/test/sys/class/vc/vcsa7 new file mode 120000 index 0000000000..546fe2044b --- /dev/null +++ b/test/sys/class/vc/vcsa7 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa7 \ No newline at end of file diff --git a/test/sys/class/vtconsole/vtcon0 b/test/sys/class/vtconsole/vtcon0 new file mode 120000 index 0000000000..a6cd626112 --- /dev/null +++ b/test/sys/class/vtconsole/vtcon0 @@ -0,0 +1 @@ +../../devices/virtual/vtconsole/vtcon0 \ No newline at end of file diff --git a/test/sys/class/vtconsole/vtcon1 b/test/sys/class/vtconsole/vtcon1 new file mode 120000 index 0000000000..23c2dd8de6 --- /dev/null +++ b/test/sys/class/vtconsole/vtcon1 @@ -0,0 +1 @@ +../../devices/virtual/vtconsole/vtcon1 \ No newline at end of file diff --git a/test/sys/dev/block/11:0 b/test/sys/dev/block/11:0 new file mode 120000 index 0000000000..4d1c248a3c --- /dev/null +++ b/test/sys/dev/block/11:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0 \ No newline at end of file diff --git a/test/sys/dev/block/7:0 b/test/sys/dev/block/7:0 new file mode 120000 index 0000000000..86a5878d7d --- /dev/null +++ b/test/sys/dev/block/7:0 @@ -0,0 +1 @@ +../../devices/virtual/block/loop0 \ No newline at end of file diff --git a/test/sys/dev/block/7:1 b/test/sys/dev/block/7:1 new file mode 120000 index 0000000000..97476753e1 --- /dev/null +++ b/test/sys/dev/block/7:1 @@ -0,0 +1 @@ +../../devices/virtual/block/loop1 \ No newline at end of file diff --git a/test/sys/dev/block/7:2 b/test/sys/dev/block/7:2 new file mode 120000 index 0000000000..5fc0d7dd11 --- /dev/null +++ b/test/sys/dev/block/7:2 @@ -0,0 +1 @@ +../../devices/virtual/block/loop2 \ No newline at end of file diff --git a/test/sys/dev/block/7:3 b/test/sys/dev/block/7:3 new file mode 120000 index 0000000000..a6d7b89dea --- /dev/null +++ b/test/sys/dev/block/7:3 @@ -0,0 +1 @@ +../../devices/virtual/block/loop3 \ No newline at end of file diff --git a/test/sys/dev/block/7:4 b/test/sys/dev/block/7:4 new file mode 120000 index 0000000000..71386cbfd8 --- /dev/null +++ b/test/sys/dev/block/7:4 @@ -0,0 +1 @@ +../../devices/virtual/block/loop4 \ No newline at end of file diff --git a/test/sys/dev/block/7:5 b/test/sys/dev/block/7:5 new file mode 120000 index 0000000000..af83a27367 --- /dev/null +++ b/test/sys/dev/block/7:5 @@ -0,0 +1 @@ +../../devices/virtual/block/loop5 \ No newline at end of file diff --git a/test/sys/dev/block/7:6 b/test/sys/dev/block/7:6 new file mode 120000 index 0000000000..efdbd9532a --- /dev/null +++ b/test/sys/dev/block/7:6 @@ -0,0 +1 @@ +../../devices/virtual/block/loop6 \ No newline at end of file diff --git a/test/sys/dev/block/7:7 b/test/sys/dev/block/7:7 new file mode 120000 index 0000000000..7a6d7e4aac --- /dev/null +++ b/test/sys/dev/block/7:7 @@ -0,0 +1 @@ +../../devices/virtual/block/loop7 \ No newline at end of file diff --git a/test/sys/dev/block/8:0 b/test/sys/dev/block/8:0 new file mode 120000 index 0000000000..7ecaff1132 --- /dev/null +++ b/test/sys/dev/block/8:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda \ No newline at end of file diff --git a/test/sys/dev/block/8:1 b/test/sys/dev/block/8:1 new file mode 120000 index 0000000000..18dc11fc29 --- /dev/null +++ b/test/sys/dev/block/8:1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1 \ No newline at end of file diff --git a/test/sys/dev/block/8:10 b/test/sys/dev/block/8:10 new file mode 120000 index 0000000000..d64a8257ae --- /dev/null +++ b/test/sys/dev/block/8:10 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10 \ No newline at end of file diff --git a/test/sys/dev/block/8:16 b/test/sys/dev/block/8:16 new file mode 120000 index 0000000000..96ff40b869 --- /dev/null +++ b/test/sys/dev/block/8:16 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb \ No newline at end of file diff --git a/test/sys/dev/block/8:17 b/test/sys/dev/block/8:17 new file mode 120000 index 0000000000..712deabcd0 --- /dev/null +++ b/test/sys/dev/block/8:17 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb/sdb1 \ No newline at end of file diff --git a/test/sys/dev/block/8:5 b/test/sys/dev/block/8:5 new file mode 120000 index 0000000000..d7bd5661cf --- /dev/null +++ b/test/sys/dev/block/8:5 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5 \ No newline at end of file diff --git a/test/sys/dev/block/8:6 b/test/sys/dev/block/8:6 new file mode 120000 index 0000000000..2b13ee8459 --- /dev/null +++ b/test/sys/dev/block/8:6 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6 \ No newline at end of file diff --git a/test/sys/dev/block/8:7 b/test/sys/dev/block/8:7 new file mode 120000 index 0000000000..d8b862667f --- /dev/null +++ b/test/sys/dev/block/8:7 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7 \ No newline at end of file diff --git a/test/sys/dev/block/8:8 b/test/sys/dev/block/8:8 new file mode 120000 index 0000000000..34923aae6d --- /dev/null +++ b/test/sys/dev/block/8:8 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8 \ No newline at end of file diff --git a/test/sys/dev/block/8:9 b/test/sys/dev/block/8:9 new file mode 120000 index 0000000000..4b108b2336 --- /dev/null +++ b/test/sys/dev/block/8:9 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9 \ No newline at end of file diff --git a/test/sys/dev/block/9:0 b/test/sys/dev/block/9:0 new file mode 120000 index 0000000000..2072a2f60f --- /dev/null +++ b/test/sys/dev/block/9:0 @@ -0,0 +1 @@ +../../devices/virtual/block/md0 \ No newline at end of file diff --git a/test/sys/dev/char/10:1 b/test/sys/dev/char/10:1 new file mode 120000 index 0000000000..740b359d77 --- /dev/null +++ b/test/sys/dev/char/10:1 @@ -0,0 +1 @@ +../../devices/virtual/misc/psaux \ No newline at end of file diff --git a/test/sys/dev/char/10:144 b/test/sys/dev/char/10:144 new file mode 120000 index 0000000000..e819d9348c --- /dev/null +++ b/test/sys/dev/char/10:144 @@ -0,0 +1 @@ +../../devices/virtual/misc/nvram \ No newline at end of file diff --git a/test/sys/dev/char/10:184 b/test/sys/dev/char/10:184 new file mode 120000 index 0000000000..d5989199d8 --- /dev/null +++ b/test/sys/dev/char/10:184 @@ -0,0 +1 @@ +../../devices/virtual/misc/microcode \ No newline at end of file diff --git a/test/sys/dev/char/10:223 b/test/sys/dev/char/10:223 new file mode 120000 index 0000000000..565db3ee51 --- /dev/null +++ b/test/sys/dev/char/10:223 @@ -0,0 +1 @@ +../../devices/virtual/misc/uinput \ No newline at end of file diff --git a/test/sys/dev/char/10:227 b/test/sys/dev/char/10:227 new file mode 120000 index 0000000000..b89f6666f5 --- /dev/null +++ b/test/sys/dev/char/10:227 @@ -0,0 +1 @@ +../../devices/virtual/misc/mcelog \ No newline at end of file diff --git a/test/sys/dev/char/10:228 b/test/sys/dev/char/10:228 new file mode 120000 index 0000000000..9a8a753964 --- /dev/null +++ b/test/sys/dev/char/10:228 @@ -0,0 +1 @@ +../../devices/virtual/misc/hpet \ No newline at end of file diff --git a/test/sys/dev/char/10:229 b/test/sys/dev/char/10:229 new file mode 120000 index 0000000000..293b69bfe8 --- /dev/null +++ b/test/sys/dev/char/10:229 @@ -0,0 +1 @@ +../../devices/virtual/misc/fuse \ No newline at end of file diff --git a/test/sys/dev/char/10:60 b/test/sys/dev/char/10:60 new file mode 120000 index 0000000000..be736a2d8e --- /dev/null +++ b/test/sys/dev/char/10:60 @@ -0,0 +1 @@ +../../devices/virtual/misc/device-mapper \ No newline at end of file diff --git a/test/sys/dev/char/10:61 b/test/sys/dev/char/10:61 new file mode 120000 index 0000000000..3804785676 --- /dev/null +++ b/test/sys/dev/char/10:61 @@ -0,0 +1 @@ +../../devices/virtual/misc/network_throughput \ No newline at end of file diff --git a/test/sys/dev/char/10:62 b/test/sys/dev/char/10:62 new file mode 120000 index 0000000000..13bd46af83 --- /dev/null +++ b/test/sys/dev/char/10:62 @@ -0,0 +1 @@ +../../devices/virtual/misc/network_latency \ No newline at end of file diff --git a/test/sys/dev/char/10:63 b/test/sys/dev/char/10:63 new file mode 120000 index 0000000000..9236586351 --- /dev/null +++ b/test/sys/dev/char/10:63 @@ -0,0 +1 @@ +../../devices/virtual/misc/cpu_dma_latency \ No newline at end of file diff --git a/test/sys/dev/char/116:0 b/test/sys/dev/char/116:0 new file mode 120000 index 0000000000..72acd4aa77 --- /dev/null +++ b/test/sys/dev/char/116:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0 \ No newline at end of file diff --git a/test/sys/dev/char/116:1 b/test/sys/dev/char/116:1 new file mode 120000 index 0000000000..322a82bfa0 --- /dev/null +++ b/test/sys/dev/char/116:1 @@ -0,0 +1 @@ +../../devices/virtual/sound/seq \ No newline at end of file diff --git a/test/sys/dev/char/116:16 b/test/sys/dev/char/116:16 new file mode 120000 index 0000000000..ac9e13aaf7 --- /dev/null +++ b/test/sys/dev/char/116:16 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p \ No newline at end of file diff --git a/test/sys/dev/char/116:17 b/test/sys/dev/char/116:17 new file mode 120000 index 0000000000..d8efba4918 --- /dev/null +++ b/test/sys/dev/char/116:17 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p \ No newline at end of file diff --git a/test/sys/dev/char/116:24 b/test/sys/dev/char/116:24 new file mode 120000 index 0000000000..af82f9219b --- /dev/null +++ b/test/sys/dev/char/116:24 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c \ No newline at end of file diff --git a/test/sys/dev/char/116:33 b/test/sys/dev/char/116:33 new file mode 120000 index 0000000000..1ce5c875c2 --- /dev/null +++ b/test/sys/dev/char/116:33 @@ -0,0 +1 @@ +../../devices/virtual/sound/timer \ No newline at end of file diff --git a/test/sys/dev/char/13:32 b/test/sys/dev/char/13:32 new file mode 120000 index 0000000000..58db4cc7fa --- /dev/null +++ b/test/sys/dev/char/13:32 @@ -0,0 +1 @@ +../../devices/platform/i8042/serio1/input/input1/mouse0 \ No newline at end of file diff --git a/test/sys/dev/char/13:33 b/test/sys/dev/char/13:33 new file mode 120000 index 0000000000..5b46213a42 --- /dev/null +++ b/test/sys/dev/char/13:33 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1 \ No newline at end of file diff --git a/test/sys/dev/char/13:63 b/test/sys/dev/char/13:63 new file mode 120000 index 0000000000..17e795b481 --- /dev/null +++ b/test/sys/dev/char/13:63 @@ -0,0 +1 @@ +../../devices/virtual/input/mice \ No newline at end of file diff --git a/test/sys/dev/char/13:64 b/test/sys/dev/char/13:64 new file mode 120000 index 0000000000..d2d695f0b7 --- /dev/null +++ b/test/sys/dev/char/13:64 @@ -0,0 +1 @@ +../../devices/platform/i8042/serio0/input/input0/event0 \ No newline at end of file diff --git a/test/sys/dev/char/13:65 b/test/sys/dev/char/13:65 new file mode 120000 index 0000000000..a4dcf8e11d --- /dev/null +++ b/test/sys/dev/char/13:65 @@ -0,0 +1 @@ +../../devices/platform/i8042/serio1/input/input1/event1 \ No newline at end of file diff --git a/test/sys/dev/char/13:66 b/test/sys/dev/char/13:66 new file mode 120000 index 0000000000..5faad280d9 --- /dev/null +++ b/test/sys/dev/char/13:66 @@ -0,0 +1 @@ +../../devices/platform/pcspkr/input/input2/event2 \ No newline at end of file diff --git a/test/sys/dev/char/13:67 b/test/sys/dev/char/13:67 new file mode 120000 index 0000000000..65fdd24cfd --- /dev/null +++ b/test/sys/dev/char/13:67 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3 \ No newline at end of file diff --git a/test/sys/dev/char/13:68 b/test/sys/dev/char/13:68 new file mode 120000 index 0000000000..3bd330ffb8 --- /dev/null +++ b/test/sys/dev/char/13:68 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4 \ No newline at end of file diff --git a/test/sys/dev/char/13:69 b/test/sys/dev/char/13:69 new file mode 120000 index 0000000000..d60c233c11 --- /dev/null +++ b/test/sys/dev/char/13:69 @@ -0,0 +1 @@ +../../devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5 \ No newline at end of file diff --git a/test/sys/dev/char/13:70 b/test/sys/dev/char/13:70 new file mode 120000 index 0000000000..581626ed43 --- /dev/null +++ b/test/sys/dev/char/13:70 @@ -0,0 +1 @@ +../../devices/virtual/input/input6/event6 \ No newline at end of file diff --git a/test/sys/dev/char/13:71 b/test/sys/dev/char/13:71 new file mode 120000 index 0000000000..d253ce1cdf --- /dev/null +++ b/test/sys/dev/char/13:71 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7 \ No newline at end of file diff --git a/test/sys/dev/char/14:0 b/test/sys/dev/char/14:0 new file mode 120000 index 0000000000..d1099becaf --- /dev/null +++ b/test/sys/dev/char/14:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/mixer \ No newline at end of file diff --git a/test/sys/dev/char/14:12 b/test/sys/dev/char/14:12 new file mode 120000 index 0000000000..1c2d43b53c --- /dev/null +++ b/test/sys/dev/char/14:12 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/adsp \ No newline at end of file diff --git a/test/sys/dev/char/14:3 b/test/sys/dev/char/14:3 new file mode 120000 index 0000000000..91f29fcdfb --- /dev/null +++ b/test/sys/dev/char/14:3 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/dsp \ No newline at end of file diff --git a/test/sys/dev/char/14:4 b/test/sys/dev/char/14:4 new file mode 120000 index 0000000000..1fa8f211b8 --- /dev/null +++ b/test/sys/dev/char/14:4 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1b.0/sound/card0/audio \ No newline at end of file diff --git a/test/sys/dev/char/166:0 b/test/sys/dev/char/166:0 new file mode 120000 index 0000000000..40df13c0cf --- /dev/null +++ b/test/sys/dev/char/166:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0 \ No newline at end of file diff --git a/test/sys/dev/char/189:0 b/test/sys/dev/char/189:0 new file mode 120000 index 0000000000..a4ab699dd2 --- /dev/null +++ b/test/sys/dev/char/189:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.0/usb1 \ No newline at end of file diff --git a/test/sys/dev/char/189:128 b/test/sys/dev/char/189:128 new file mode 120000 index 0000000000..0a7dff8529 --- /dev/null +++ b/test/sys/dev/char/189:128 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.1/usb2 \ No newline at end of file diff --git a/test/sys/dev/char/189:256 b/test/sys/dev/char/189:256 new file mode 120000 index 0000000000..d1c346f1d1 --- /dev/null +++ b/test/sys/dev/char/189:256 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3 \ No newline at end of file diff --git a/test/sys/dev/char/189:258 b/test/sys/dev/char/189:258 new file mode 120000 index 0000000000..8e33ef34ac --- /dev/null +++ b/test/sys/dev/char/189:258 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:384 b/test/sys/dev/char/189:384 new file mode 120000 index 0000000000..d4def11289 --- /dev/null +++ b/test/sys/dev/char/189:384 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4 \ No newline at end of file diff --git a/test/sys/dev/char/189:385 b/test/sys/dev/char/189:385 new file mode 120000 index 0000000000..9bf3f86dc9 --- /dev/null +++ b/test/sys/dev/char/189:385 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:386 b/test/sys/dev/char/189:386 new file mode 120000 index 0000000000..972ff17fad --- /dev/null +++ b/test/sys/dev/char/189:386 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-2 \ No newline at end of file diff --git a/test/sys/dev/char/189:512 b/test/sys/dev/char/189:512 new file mode 120000 index 0000000000..7ef4821176 --- /dev/null +++ b/test/sys/dev/char/189:512 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5 \ No newline at end of file diff --git a/test/sys/dev/char/189:516 b/test/sys/dev/char/189:516 new file mode 120000 index 0000000000..26d5b39dd4 --- /dev/null +++ b/test/sys/dev/char/189:516 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:517 b/test/sys/dev/char/189:517 new file mode 120000 index 0000000000..619c2a79a6 --- /dev/null +++ b/test/sys/dev/char/189:517 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2 \ No newline at end of file diff --git a/test/sys/dev/char/1:1 b/test/sys/dev/char/1:1 new file mode 120000 index 0000000000..4971e087b4 --- /dev/null +++ b/test/sys/dev/char/1:1 @@ -0,0 +1 @@ +../../devices/virtual/mem/mem \ No newline at end of file diff --git a/test/sys/dev/char/1:11 b/test/sys/dev/char/1:11 new file mode 120000 index 0000000000..cd44206462 --- /dev/null +++ b/test/sys/dev/char/1:11 @@ -0,0 +1 @@ +../../devices/virtual/mem/kmsg \ No newline at end of file diff --git a/test/sys/dev/char/1:2 b/test/sys/dev/char/1:2 new file mode 120000 index 0000000000..fd2e57d601 --- /dev/null +++ b/test/sys/dev/char/1:2 @@ -0,0 +1 @@ +../../devices/virtual/mem/kmem \ No newline at end of file diff --git a/test/sys/dev/char/1:3 b/test/sys/dev/char/1:3 new file mode 120000 index 0000000000..8fe50f9623 --- /dev/null +++ b/test/sys/dev/char/1:3 @@ -0,0 +1 @@ +../../devices/virtual/mem/null \ No newline at end of file diff --git a/test/sys/dev/char/1:4 b/test/sys/dev/char/1:4 new file mode 120000 index 0000000000..0f635f5945 --- /dev/null +++ b/test/sys/dev/char/1:4 @@ -0,0 +1 @@ +../../devices/virtual/mem/port \ No newline at end of file diff --git a/test/sys/dev/char/1:5 b/test/sys/dev/char/1:5 new file mode 120000 index 0000000000..fea0d4d472 --- /dev/null +++ b/test/sys/dev/char/1:5 @@ -0,0 +1 @@ +../../devices/virtual/mem/zero \ No newline at end of file diff --git a/test/sys/dev/char/1:7 b/test/sys/dev/char/1:7 new file mode 120000 index 0000000000..3305ef6885 --- /dev/null +++ b/test/sys/dev/char/1:7 @@ -0,0 +1 @@ +../../devices/virtual/mem/full \ No newline at end of file diff --git a/test/sys/dev/char/1:8 b/test/sys/dev/char/1:8 new file mode 120000 index 0000000000..b751f35293 --- /dev/null +++ b/test/sys/dev/char/1:8 @@ -0,0 +1 @@ +../../devices/virtual/mem/random \ No newline at end of file diff --git a/test/sys/dev/char/1:9 b/test/sys/dev/char/1:9 new file mode 120000 index 0000000000..c69f1e2c68 --- /dev/null +++ b/test/sys/dev/char/1:9 @@ -0,0 +1 @@ +../../devices/virtual/mem/urandom \ No newline at end of file diff --git a/test/sys/dev/char/21:0 b/test/sys/dev/char/21:0 new file mode 120000 index 0000000000..93d1199d1d --- /dev/null +++ b/test/sys/dev/char/21:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 \ No newline at end of file diff --git a/test/sys/dev/char/21:1 b/test/sys/dev/char/21:1 new file mode 120000 index 0000000000..768d2dc122 --- /dev/null +++ b/test/sys/dev/char/21:1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1 \ No newline at end of file diff --git a/test/sys/dev/char/21:2 b/test/sys/dev/char/21:2 new file mode 120000 index 0000000000..21cdcefce1 --- /dev/null +++ b/test/sys/dev/char/21:2 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/scsi_generic/sg2 \ No newline at end of file diff --git a/test/sys/dev/char/252:0 b/test/sys/dev/char/252:0 new file mode 120000 index 0000000000..bd2c39312b --- /dev/null +++ b/test/sys/dev/char/252:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:1 b/test/sys/dev/char/252:1 new file mode 120000 index 0000000000..d7bfbd0c6a --- /dev/null +++ b/test/sys/dev/char/252:1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:10 b/test/sys/dev/char/252:10 new file mode 120000 index 0000000000..c79938362e --- /dev/null +++ b/test/sys/dev/char/252:10 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:11 b/test/sys/dev/char/252:11 new file mode 120000 index 0000000000..caa389c41a --- /dev/null +++ b/test/sys/dev/char/252:11 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:12 b/test/sys/dev/char/252:12 new file mode 120000 index 0000000000..6513618361 --- /dev/null +++ b/test/sys/dev/char/252:12 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:13 b/test/sys/dev/char/252:13 new file mode 120000 index 0000000000..6978069f5a --- /dev/null +++ b/test/sys/dev/char/252:13 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82 \ No newline at end of file diff --git a/test/sys/dev/char/252:14 b/test/sys/dev/char/252:14 new file mode 120000 index 0000000000..4252382cb5 --- /dev/null +++ b/test/sys/dev/char/252:14 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:15 b/test/sys/dev/char/252:15 new file mode 120000 index 0000000000..f65bab5870 --- /dev/null +++ b/test/sys/dev/char/252:15 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83 \ No newline at end of file diff --git a/test/sys/dev/char/252:16 b/test/sys/dev/char/252:16 new file mode 120000 index 0000000000..2c9c471c58 --- /dev/null +++ b/test/sys/dev/char/252:16 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03 \ No newline at end of file diff --git a/test/sys/dev/char/252:17 b/test/sys/dev/char/252:17 new file mode 120000 index 0000000000..8c21bd0b99 --- /dev/null +++ b/test/sys/dev/char/252:17 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84 \ No newline at end of file diff --git a/test/sys/dev/char/252:18 b/test/sys/dev/char/252:18 new file mode 120000 index 0000000000..7a90390108 --- /dev/null +++ b/test/sys/dev/char/252:18 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04 \ No newline at end of file diff --git a/test/sys/dev/char/252:19 b/test/sys/dev/char/252:19 new file mode 120000 index 0000000000..b55c0ca993 --- /dev/null +++ b/test/sys/dev/char/252:19 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:2 b/test/sys/dev/char/252:2 new file mode 120000 index 0000000000..d83045b65f --- /dev/null +++ b/test/sys/dev/char/252:2 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:20 b/test/sys/dev/char/252:20 new file mode 120000 index 0000000000..2af437dc67 --- /dev/null +++ b/test/sys/dev/char/252:20 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:21 b/test/sys/dev/char/252:21 new file mode 120000 index 0000000000..ed97352880 --- /dev/null +++ b/test/sys/dev/char/252:21 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:22 b/test/sys/dev/char/252:22 new file mode 120000 index 0000000000..7b5d1c3e1f --- /dev/null +++ b/test/sys/dev/char/252:22 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83 \ No newline at end of file diff --git a/test/sys/dev/char/252:23 b/test/sys/dev/char/252:23 new file mode 120000 index 0000000000..f94fad7264 --- /dev/null +++ b/test/sys/dev/char/252:23 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:24 b/test/sys/dev/char/252:24 new file mode 120000 index 0000000000..84ba82fe1d --- /dev/null +++ b/test/sys/dev/char/252:24 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.5_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:25 b/test/sys/dev/char/252:25 new file mode 120000 index 0000000000..f23cbb6b2d --- /dev/null +++ b/test/sys/dev/char/252:25 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1/usb_endpoint/usbdev5.5_ep82 \ No newline at end of file diff --git a/test/sys/dev/char/252:26 b/test/sys/dev/char/252:26 new file mode 120000 index 0000000000..8457e4578b --- /dev/null +++ b/test/sys/dev/char/252:26 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1/usb_endpoint/usbdev5.5_ep01 \ No newline at end of file diff --git a/test/sys/dev/char/252:27 b/test/sys/dev/char/252:27 new file mode 120000 index 0000000000..4492b5c3df --- /dev/null +++ b/test/sys/dev/char/252:27 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.2/usb_endpoint/usbdev5.5_ep83 \ No newline at end of file diff --git a/test/sys/dev/char/252:28 b/test/sys/dev/char/252:28 new file mode 120000 index 0000000000..fce1b65c4c --- /dev/null +++ b/test/sys/dev/char/252:28 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3/usb_endpoint/usbdev5.5_ep84 \ No newline at end of file diff --git a/test/sys/dev/char/252:29 b/test/sys/dev/char/252:29 new file mode 120000 index 0000000000..492e719a39 --- /dev/null +++ b/test/sys/dev/char/252:29 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3/usb_endpoint/usbdev5.5_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:3 b/test/sys/dev/char/252:3 new file mode 120000 index 0000000000..47d9d584d5 --- /dev/null +++ b/test/sys/dev/char/252:3 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:30 b/test/sys/dev/char/252:30 new file mode 120000 index 0000000000..d3df107049 --- /dev/null +++ b/test/sys/dev/char/252:30 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.5_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:31 b/test/sys/dev/char/252:31 new file mode 120000 index 0000000000..82bb2de67d --- /dev/null +++ b/test/sys/dev/char/252:31 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.6_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:32 b/test/sys/dev/char/252:32 new file mode 120000 index 0000000000..c8c5af20fb --- /dev/null +++ b/test/sys/dev/char/252:32 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.6_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:33 b/test/sys/dev/char/252:33 new file mode 120000 index 0000000000..a5f5ee509a --- /dev/null +++ b/test/sys/dev/char/252:33 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.6_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:4 b/test/sys/dev/char/252:4 new file mode 120000 index 0000000000..31df8a686d --- /dev/null +++ b/test/sys/dev/char/252:4 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:5 b/test/sys/dev/char/252:5 new file mode 120000 index 0000000000..eb3e0285f7 --- /dev/null +++ b/test/sys/dev/char/252:5 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:6 b/test/sys/dev/char/252:6 new file mode 120000 index 0000000000..b93a8b8714 --- /dev/null +++ b/test/sys/dev/char/252:6 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:7 b/test/sys/dev/char/252:7 new file mode 120000 index 0000000000..d8722976a0 --- /dev/null +++ b/test/sys/dev/char/252:7 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:8 b/test/sys/dev/char/252:8 new file mode 120000 index 0000000000..7ca8e5a1fd --- /dev/null +++ b/test/sys/dev/char/252:8 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:9 b/test/sys/dev/char/252:9 new file mode 120000 index 0000000000..c4f7637252 --- /dev/null +++ b/test/sys/dev/char/252:9 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/253:0 b/test/sys/dev/char/253:0 new file mode 120000 index 0000000000..b7116fb0aa --- /dev/null +++ b/test/sys/dev/char/253:0 @@ -0,0 +1 @@ +../../devices/pnp0/00:07/rtc/rtc0 \ No newline at end of file diff --git a/test/sys/dev/char/254:0 b/test/sys/dev/char/254:0 new file mode 120000 index 0000000000..00f1c6aef9 --- /dev/null +++ b/test/sys/dev/char/254:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 \ No newline at end of file diff --git a/test/sys/dev/char/254:1 b/test/sys/dev/char/254:1 new file mode 120000 index 0000000000..805fed84d2 --- /dev/null +++ b/test/sys/dev/char/254:1 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0 \ No newline at end of file diff --git a/test/sys/dev/char/254:2 b/test/sys/dev/char/254:2 new file mode 120000 index 0000000000..df25adc4fe --- /dev/null +++ b/test/sys/dev/char/254:2 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/bsg/6:0:0:0 \ No newline at end of file diff --git a/test/sys/dev/char/29:0 b/test/sys/dev/char/29:0 new file mode 120000 index 0000000000..1944247bd4 --- /dev/null +++ b/test/sys/dev/char/29:0 @@ -0,0 +1 @@ +../../devices/platform/vesafb.0/graphics/fb0 \ No newline at end of file diff --git a/test/sys/dev/char/4:0 b/test/sys/dev/char/4:0 new file mode 120000 index 0000000000..1ebbbc882a --- /dev/null +++ b/test/sys/dev/char/4:0 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty0 \ No newline at end of file diff --git a/test/sys/dev/char/4:1 b/test/sys/dev/char/4:1 new file mode 120000 index 0000000000..e0418dabc9 --- /dev/null +++ b/test/sys/dev/char/4:1 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty1 \ No newline at end of file diff --git a/test/sys/dev/char/4:10 b/test/sys/dev/char/4:10 new file mode 120000 index 0000000000..319d31f915 --- /dev/null +++ b/test/sys/dev/char/4:10 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty10 \ No newline at end of file diff --git a/test/sys/dev/char/4:11 b/test/sys/dev/char/4:11 new file mode 120000 index 0000000000..9c76e05207 --- /dev/null +++ b/test/sys/dev/char/4:11 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty11 \ No newline at end of file diff --git a/test/sys/dev/char/4:12 b/test/sys/dev/char/4:12 new file mode 120000 index 0000000000..abac0f831a --- /dev/null +++ b/test/sys/dev/char/4:12 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty12 \ No newline at end of file diff --git a/test/sys/dev/char/4:13 b/test/sys/dev/char/4:13 new file mode 120000 index 0000000000..c3812100e0 --- /dev/null +++ b/test/sys/dev/char/4:13 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty13 \ No newline at end of file diff --git a/test/sys/dev/char/4:14 b/test/sys/dev/char/4:14 new file mode 120000 index 0000000000..63bd3a6764 --- /dev/null +++ b/test/sys/dev/char/4:14 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty14 \ No newline at end of file diff --git a/test/sys/dev/char/4:15 b/test/sys/dev/char/4:15 new file mode 120000 index 0000000000..e2c5914874 --- /dev/null +++ b/test/sys/dev/char/4:15 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty15 \ No newline at end of file diff --git a/test/sys/dev/char/4:16 b/test/sys/dev/char/4:16 new file mode 120000 index 0000000000..d8846a866d --- /dev/null +++ b/test/sys/dev/char/4:16 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty16 \ No newline at end of file diff --git a/test/sys/dev/char/4:17 b/test/sys/dev/char/4:17 new file mode 120000 index 0000000000..a488b19305 --- /dev/null +++ b/test/sys/dev/char/4:17 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty17 \ No newline at end of file diff --git a/test/sys/dev/char/4:18 b/test/sys/dev/char/4:18 new file mode 120000 index 0000000000..933880a8c7 --- /dev/null +++ b/test/sys/dev/char/4:18 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty18 \ No newline at end of file diff --git a/test/sys/dev/char/4:19 b/test/sys/dev/char/4:19 new file mode 120000 index 0000000000..398ff33d7a --- /dev/null +++ b/test/sys/dev/char/4:19 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty19 \ No newline at end of file diff --git a/test/sys/dev/char/4:2 b/test/sys/dev/char/4:2 new file mode 120000 index 0000000000..15b216c9f4 --- /dev/null +++ b/test/sys/dev/char/4:2 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty2 \ No newline at end of file diff --git a/test/sys/dev/char/4:20 b/test/sys/dev/char/4:20 new file mode 120000 index 0000000000..bacbb6a5cc --- /dev/null +++ b/test/sys/dev/char/4:20 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty20 \ No newline at end of file diff --git a/test/sys/dev/char/4:21 b/test/sys/dev/char/4:21 new file mode 120000 index 0000000000..73f9c8c982 --- /dev/null +++ b/test/sys/dev/char/4:21 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty21 \ No newline at end of file diff --git a/test/sys/dev/char/4:22 b/test/sys/dev/char/4:22 new file mode 120000 index 0000000000..a2a0d8ca63 --- /dev/null +++ b/test/sys/dev/char/4:22 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty22 \ No newline at end of file diff --git a/test/sys/dev/char/4:23 b/test/sys/dev/char/4:23 new file mode 120000 index 0000000000..8daebf5f43 --- /dev/null +++ b/test/sys/dev/char/4:23 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty23 \ No newline at end of file diff --git a/test/sys/dev/char/4:24 b/test/sys/dev/char/4:24 new file mode 120000 index 0000000000..67a64368f8 --- /dev/null +++ b/test/sys/dev/char/4:24 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty24 \ No newline at end of file diff --git a/test/sys/dev/char/4:25 b/test/sys/dev/char/4:25 new file mode 120000 index 0000000000..4f8d0795d2 --- /dev/null +++ b/test/sys/dev/char/4:25 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty25 \ No newline at end of file diff --git a/test/sys/dev/char/4:26 b/test/sys/dev/char/4:26 new file mode 120000 index 0000000000..2f65d8be1d --- /dev/null +++ b/test/sys/dev/char/4:26 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty26 \ No newline at end of file diff --git a/test/sys/dev/char/4:27 b/test/sys/dev/char/4:27 new file mode 120000 index 0000000000..0d1a42b943 --- /dev/null +++ b/test/sys/dev/char/4:27 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty27 \ No newline at end of file diff --git a/test/sys/dev/char/4:28 b/test/sys/dev/char/4:28 new file mode 120000 index 0000000000..1419911bde --- /dev/null +++ b/test/sys/dev/char/4:28 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty28 \ No newline at end of file diff --git a/test/sys/dev/char/4:29 b/test/sys/dev/char/4:29 new file mode 120000 index 0000000000..2d15900bf2 --- /dev/null +++ b/test/sys/dev/char/4:29 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty29 \ No newline at end of file diff --git a/test/sys/dev/char/4:3 b/test/sys/dev/char/4:3 new file mode 120000 index 0000000000..7764e1c747 --- /dev/null +++ b/test/sys/dev/char/4:3 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty3 \ No newline at end of file diff --git a/test/sys/dev/char/4:30 b/test/sys/dev/char/4:30 new file mode 120000 index 0000000000..d8bb78d95e --- /dev/null +++ b/test/sys/dev/char/4:30 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty30 \ No newline at end of file diff --git a/test/sys/dev/char/4:31 b/test/sys/dev/char/4:31 new file mode 120000 index 0000000000..4f5a23296a --- /dev/null +++ b/test/sys/dev/char/4:31 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty31 \ No newline at end of file diff --git a/test/sys/dev/char/4:32 b/test/sys/dev/char/4:32 new file mode 120000 index 0000000000..5d1dc6fe32 --- /dev/null +++ b/test/sys/dev/char/4:32 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty32 \ No newline at end of file diff --git a/test/sys/dev/char/4:33 b/test/sys/dev/char/4:33 new file mode 120000 index 0000000000..95bb3af2f0 --- /dev/null +++ b/test/sys/dev/char/4:33 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty33 \ No newline at end of file diff --git a/test/sys/dev/char/4:34 b/test/sys/dev/char/4:34 new file mode 120000 index 0000000000..9212f5c8ac --- /dev/null +++ b/test/sys/dev/char/4:34 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty34 \ No newline at end of file diff --git a/test/sys/dev/char/4:35 b/test/sys/dev/char/4:35 new file mode 120000 index 0000000000..7a3ebc2945 --- /dev/null +++ b/test/sys/dev/char/4:35 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty35 \ No newline at end of file diff --git a/test/sys/dev/char/4:36 b/test/sys/dev/char/4:36 new file mode 120000 index 0000000000..96a7b1a62e --- /dev/null +++ b/test/sys/dev/char/4:36 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty36 \ No newline at end of file diff --git a/test/sys/dev/char/4:37 b/test/sys/dev/char/4:37 new file mode 120000 index 0000000000..520543a8c2 --- /dev/null +++ b/test/sys/dev/char/4:37 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty37 \ No newline at end of file diff --git a/test/sys/dev/char/4:38 b/test/sys/dev/char/4:38 new file mode 120000 index 0000000000..6ad284dfdc --- /dev/null +++ b/test/sys/dev/char/4:38 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty38 \ No newline at end of file diff --git a/test/sys/dev/char/4:39 b/test/sys/dev/char/4:39 new file mode 120000 index 0000000000..d001bab9ee --- /dev/null +++ b/test/sys/dev/char/4:39 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty39 \ No newline at end of file diff --git a/test/sys/dev/char/4:4 b/test/sys/dev/char/4:4 new file mode 120000 index 0000000000..784bf4d728 --- /dev/null +++ b/test/sys/dev/char/4:4 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty4 \ No newline at end of file diff --git a/test/sys/dev/char/4:40 b/test/sys/dev/char/4:40 new file mode 120000 index 0000000000..dc6ea499d3 --- /dev/null +++ b/test/sys/dev/char/4:40 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty40 \ No newline at end of file diff --git a/test/sys/dev/char/4:41 b/test/sys/dev/char/4:41 new file mode 120000 index 0000000000..8a8f597f36 --- /dev/null +++ b/test/sys/dev/char/4:41 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty41 \ No newline at end of file diff --git a/test/sys/dev/char/4:42 b/test/sys/dev/char/4:42 new file mode 120000 index 0000000000..397f4316e3 --- /dev/null +++ b/test/sys/dev/char/4:42 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty42 \ No newline at end of file diff --git a/test/sys/dev/char/4:43 b/test/sys/dev/char/4:43 new file mode 120000 index 0000000000..77f93885e1 --- /dev/null +++ b/test/sys/dev/char/4:43 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty43 \ No newline at end of file diff --git a/test/sys/dev/char/4:44 b/test/sys/dev/char/4:44 new file mode 120000 index 0000000000..9b9077d9f0 --- /dev/null +++ b/test/sys/dev/char/4:44 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty44 \ No newline at end of file diff --git a/test/sys/dev/char/4:45 b/test/sys/dev/char/4:45 new file mode 120000 index 0000000000..794cf19308 --- /dev/null +++ b/test/sys/dev/char/4:45 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty45 \ No newline at end of file diff --git a/test/sys/dev/char/4:46 b/test/sys/dev/char/4:46 new file mode 120000 index 0000000000..200c809887 --- /dev/null +++ b/test/sys/dev/char/4:46 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty46 \ No newline at end of file diff --git a/test/sys/dev/char/4:47 b/test/sys/dev/char/4:47 new file mode 120000 index 0000000000..9c3d9156d9 --- /dev/null +++ b/test/sys/dev/char/4:47 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty47 \ No newline at end of file diff --git a/test/sys/dev/char/4:48 b/test/sys/dev/char/4:48 new file mode 120000 index 0000000000..9b9a4cda68 --- /dev/null +++ b/test/sys/dev/char/4:48 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty48 \ No newline at end of file diff --git a/test/sys/dev/char/4:49 b/test/sys/dev/char/4:49 new file mode 120000 index 0000000000..304113d078 --- /dev/null +++ b/test/sys/dev/char/4:49 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty49 \ No newline at end of file diff --git a/test/sys/dev/char/4:5 b/test/sys/dev/char/4:5 new file mode 120000 index 0000000000..88eaad31a4 --- /dev/null +++ b/test/sys/dev/char/4:5 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty5 \ No newline at end of file diff --git a/test/sys/dev/char/4:50 b/test/sys/dev/char/4:50 new file mode 120000 index 0000000000..980e47e84d --- /dev/null +++ b/test/sys/dev/char/4:50 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty50 \ No newline at end of file diff --git a/test/sys/dev/char/4:51 b/test/sys/dev/char/4:51 new file mode 120000 index 0000000000..996785ba60 --- /dev/null +++ b/test/sys/dev/char/4:51 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty51 \ No newline at end of file diff --git a/test/sys/dev/char/4:52 b/test/sys/dev/char/4:52 new file mode 120000 index 0000000000..da16c4fa0f --- /dev/null +++ b/test/sys/dev/char/4:52 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty52 \ No newline at end of file diff --git a/test/sys/dev/char/4:53 b/test/sys/dev/char/4:53 new file mode 120000 index 0000000000..2f9b5fc00d --- /dev/null +++ b/test/sys/dev/char/4:53 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty53 \ No newline at end of file diff --git a/test/sys/dev/char/4:54 b/test/sys/dev/char/4:54 new file mode 120000 index 0000000000..066ee67726 --- /dev/null +++ b/test/sys/dev/char/4:54 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty54 \ No newline at end of file diff --git a/test/sys/dev/char/4:55 b/test/sys/dev/char/4:55 new file mode 120000 index 0000000000..36b5ab23ea --- /dev/null +++ b/test/sys/dev/char/4:55 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty55 \ No newline at end of file diff --git a/test/sys/dev/char/4:56 b/test/sys/dev/char/4:56 new file mode 120000 index 0000000000..9d59eb5509 --- /dev/null +++ b/test/sys/dev/char/4:56 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty56 \ No newline at end of file diff --git a/test/sys/dev/char/4:57 b/test/sys/dev/char/4:57 new file mode 120000 index 0000000000..faad99a937 --- /dev/null +++ b/test/sys/dev/char/4:57 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty57 \ No newline at end of file diff --git a/test/sys/dev/char/4:58 b/test/sys/dev/char/4:58 new file mode 120000 index 0000000000..c8600121f7 --- /dev/null +++ b/test/sys/dev/char/4:58 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty58 \ No newline at end of file diff --git a/test/sys/dev/char/4:59 b/test/sys/dev/char/4:59 new file mode 120000 index 0000000000..703f555529 --- /dev/null +++ b/test/sys/dev/char/4:59 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty59 \ No newline at end of file diff --git a/test/sys/dev/char/4:6 b/test/sys/dev/char/4:6 new file mode 120000 index 0000000000..efc1d693e2 --- /dev/null +++ b/test/sys/dev/char/4:6 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty6 \ No newline at end of file diff --git a/test/sys/dev/char/4:60 b/test/sys/dev/char/4:60 new file mode 120000 index 0000000000..3f7263f9ff --- /dev/null +++ b/test/sys/dev/char/4:60 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty60 \ No newline at end of file diff --git a/test/sys/dev/char/4:61 b/test/sys/dev/char/4:61 new file mode 120000 index 0000000000..cee51b9cdb --- /dev/null +++ b/test/sys/dev/char/4:61 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty61 \ No newline at end of file diff --git a/test/sys/dev/char/4:62 b/test/sys/dev/char/4:62 new file mode 120000 index 0000000000..c951635197 --- /dev/null +++ b/test/sys/dev/char/4:62 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty62 \ No newline at end of file diff --git a/test/sys/dev/char/4:63 b/test/sys/dev/char/4:63 new file mode 120000 index 0000000000..055770a378 --- /dev/null +++ b/test/sys/dev/char/4:63 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty63 \ No newline at end of file diff --git a/test/sys/dev/char/4:64 b/test/sys/dev/char/4:64 new file mode 120000 index 0000000000..860756e70e --- /dev/null +++ b/test/sys/dev/char/4:64 @@ -0,0 +1 @@ +../../devices/platform/serial8250/tty/ttyS0 \ No newline at end of file diff --git a/test/sys/dev/char/4:65 b/test/sys/dev/char/4:65 new file mode 120000 index 0000000000..a4e521e3ba --- /dev/null +++ b/test/sys/dev/char/4:65 @@ -0,0 +1 @@ +../../devices/platform/serial8250/tty/ttyS1 \ No newline at end of file diff --git a/test/sys/dev/char/4:66 b/test/sys/dev/char/4:66 new file mode 120000 index 0000000000..a0170b5335 --- /dev/null +++ b/test/sys/dev/char/4:66 @@ -0,0 +1 @@ +../../devices/platform/serial8250/tty/ttyS2 \ No newline at end of file diff --git a/test/sys/dev/char/4:67 b/test/sys/dev/char/4:67 new file mode 120000 index 0000000000..15ae8b290e --- /dev/null +++ b/test/sys/dev/char/4:67 @@ -0,0 +1 @@ +../../devices/platform/serial8250/tty/ttyS3 \ No newline at end of file diff --git a/test/sys/dev/char/4:7 b/test/sys/dev/char/4:7 new file mode 120000 index 0000000000..0e04f76811 --- /dev/null +++ b/test/sys/dev/char/4:7 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty7 \ No newline at end of file diff --git a/test/sys/dev/char/4:8 b/test/sys/dev/char/4:8 new file mode 120000 index 0000000000..1289573e26 --- /dev/null +++ b/test/sys/dev/char/4:8 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty8 \ No newline at end of file diff --git a/test/sys/dev/char/4:9 b/test/sys/dev/char/4:9 new file mode 120000 index 0000000000..e4a707b9f4 --- /dev/null +++ b/test/sys/dev/char/4:9 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty9 \ No newline at end of file diff --git a/test/sys/dev/char/5:0 b/test/sys/dev/char/5:0 new file mode 120000 index 0000000000..e67d736497 --- /dev/null +++ b/test/sys/dev/char/5:0 @@ -0,0 +1 @@ +../../devices/virtual/tty/tty \ No newline at end of file diff --git a/test/sys/dev/char/5:1 b/test/sys/dev/char/5:1 new file mode 120000 index 0000000000..2483dd2791 --- /dev/null +++ b/test/sys/dev/char/5:1 @@ -0,0 +1 @@ +../../devices/virtual/tty/console \ No newline at end of file diff --git a/test/sys/dev/char/5:2 b/test/sys/dev/char/5:2 new file mode 120000 index 0000000000..9c489ead9f --- /dev/null +++ b/test/sys/dev/char/5:2 @@ -0,0 +1 @@ +../../devices/virtual/tty/ptmx \ No newline at end of file diff --git a/test/sys/dev/char/7:0 b/test/sys/dev/char/7:0 new file mode 120000 index 0000000000..b642424830 --- /dev/null +++ b/test/sys/dev/char/7:0 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs \ No newline at end of file diff --git a/test/sys/dev/char/7:1 b/test/sys/dev/char/7:1 new file mode 120000 index 0000000000..5855850e22 --- /dev/null +++ b/test/sys/dev/char/7:1 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs1 \ No newline at end of file diff --git a/test/sys/dev/char/7:10 b/test/sys/dev/char/7:10 new file mode 120000 index 0000000000..dab30ff21f --- /dev/null +++ b/test/sys/dev/char/7:10 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs10 \ No newline at end of file diff --git a/test/sys/dev/char/7:128 b/test/sys/dev/char/7:128 new file mode 120000 index 0000000000..b7b448a413 --- /dev/null +++ b/test/sys/dev/char/7:128 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa \ No newline at end of file diff --git a/test/sys/dev/char/7:129 b/test/sys/dev/char/7:129 new file mode 120000 index 0000000000..ee2129054b --- /dev/null +++ b/test/sys/dev/char/7:129 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa1 \ No newline at end of file diff --git a/test/sys/dev/char/7:130 b/test/sys/dev/char/7:130 new file mode 120000 index 0000000000..32135b67b3 --- /dev/null +++ b/test/sys/dev/char/7:130 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa2 \ No newline at end of file diff --git a/test/sys/dev/char/7:131 b/test/sys/dev/char/7:131 new file mode 120000 index 0000000000..808a1372af --- /dev/null +++ b/test/sys/dev/char/7:131 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa3 \ No newline at end of file diff --git a/test/sys/dev/char/7:132 b/test/sys/dev/char/7:132 new file mode 120000 index 0000000000..094974435e --- /dev/null +++ b/test/sys/dev/char/7:132 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa4 \ No newline at end of file diff --git a/test/sys/dev/char/7:133 b/test/sys/dev/char/7:133 new file mode 120000 index 0000000000..028b0a82ea --- /dev/null +++ b/test/sys/dev/char/7:133 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa5 \ No newline at end of file diff --git a/test/sys/dev/char/7:134 b/test/sys/dev/char/7:134 new file mode 120000 index 0000000000..9206bb2635 --- /dev/null +++ b/test/sys/dev/char/7:134 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa6 \ No newline at end of file diff --git a/test/sys/dev/char/7:135 b/test/sys/dev/char/7:135 new file mode 120000 index 0000000000..546fe2044b --- /dev/null +++ b/test/sys/dev/char/7:135 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa7 \ No newline at end of file diff --git a/test/sys/dev/char/7:138 b/test/sys/dev/char/7:138 new file mode 120000 index 0000000000..24f19fa165 --- /dev/null +++ b/test/sys/dev/char/7:138 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcsa10 \ No newline at end of file diff --git a/test/sys/dev/char/7:2 b/test/sys/dev/char/7:2 new file mode 120000 index 0000000000..3f257365e1 --- /dev/null +++ b/test/sys/dev/char/7:2 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs2 \ No newline at end of file diff --git a/test/sys/dev/char/7:3 b/test/sys/dev/char/7:3 new file mode 120000 index 0000000000..c7190a927a --- /dev/null +++ b/test/sys/dev/char/7:3 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs3 \ No newline at end of file diff --git a/test/sys/dev/char/7:4 b/test/sys/dev/char/7:4 new file mode 120000 index 0000000000..2cbf17f636 --- /dev/null +++ b/test/sys/dev/char/7:4 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs4 \ No newline at end of file diff --git a/test/sys/dev/char/7:5 b/test/sys/dev/char/7:5 new file mode 120000 index 0000000000..0493a1b39b --- /dev/null +++ b/test/sys/dev/char/7:5 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs5 \ No newline at end of file diff --git a/test/sys/dev/char/7:6 b/test/sys/dev/char/7:6 new file mode 120000 index 0000000000..aa0eb575d6 --- /dev/null +++ b/test/sys/dev/char/7:6 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs6 \ No newline at end of file diff --git a/test/sys/dev/char/7:7 b/test/sys/dev/char/7:7 new file mode 120000 index 0000000000..a6bd54ca4c --- /dev/null +++ b/test/sys/dev/char/7:7 @@ -0,0 +1 @@ +../../devices/virtual/vc/vcs7 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver new file mode 120000 index 0000000000..c0755b7a7f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver @@ -0,0 +1 @@ +../../../bus/acpi/drivers/processor \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid new file mode 100644 index 0000000000..3cdddd7137 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid @@ -0,0 +1 @@ +ACPI0007 diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias new file mode 100644 index 0000000000..4590bb1f2c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias @@ -0,0 +1 @@ +acpi:ACPI0007: diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/path b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/path new file mode 100644 index 0000000000..db9f8f67a1 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/path @@ -0,0 +1 @@ +\_PR_.CPU0 diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem new file mode 120000 index 0000000000..a9dfb93327 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem @@ -0,0 +1 @@ +../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev new file mode 120000 index 0000000000..9da2c4682d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev @@ -0,0 +1 @@ +../../system/cpu/cpu0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/thermal_cooling b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/thermal_cooling new file mode 120000 index 0000000000..3366be01eb --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/thermal_cooling @@ -0,0 +1 @@ +../../virtual/thermal/cooling_device0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent new file mode 100644 index 0000000000..b7df82a63c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent @@ -0,0 +1,2 @@ +DRIVER=processor +MODALIAS=acpi:ACPI0007: diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver new file mode 120000 index 0000000000..c0755b7a7f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver @@ -0,0 +1 @@ +../../../bus/acpi/drivers/processor \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid new file mode 100644 index 0000000000..3cdddd7137 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid @@ -0,0 +1 @@ +ACPI0007 diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias new file mode 100644 index 0000000000..4590bb1f2c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias @@ -0,0 +1 @@ +acpi:ACPI0007: diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/path b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/path new file mode 100644 index 0000000000..56405af1dc --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/path @@ -0,0 +1 @@ +\_PR_.CPU1 diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/power/wakeup b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem new file mode 120000 index 0000000000..a9dfb93327 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem @@ -0,0 +1 @@ +../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev new file mode 120000 index 0000000000..6927d39b0d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev @@ -0,0 +1 @@ +../../system/cpu/cpu1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/thermal_cooling b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/thermal_cooling new file mode 120000 index 0000000000..a036a04b64 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/thermal_cooling @@ -0,0 +1 @@ +../../virtual/thermal/cooling_device1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent new file mode 100644 index 0000000000..b7df82a63c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent @@ -0,0 +1,2 @@ +DRIVER=processor +MODALIAS=acpi:ACPI0007: diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver new file mode 120000 index 0000000000..e880a0df02 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver @@ -0,0 +1 @@ +../../../bus/acpi/drivers/button \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid new file mode 100644 index 0000000000..a4bd0e963a --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid @@ -0,0 +1 @@ +LNXPWRBN diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/abs b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/abs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/abs @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ev b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ev new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ev @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ff b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ff new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ff @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/key b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/key new file mode 100644 index 0000000000..a384a9b7f8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/key @@ -0,0 +1 @@ +10000000000000 0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/led b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/led new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/led @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/msc b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/msc new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/msc @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/rel b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/rel new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/rel @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/snd b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/snd new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/snd @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/sw b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/sw new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/sw @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/device b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/device new file mode 120000 index 0000000000..b000b23fde --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/device @@ -0,0 +1 @@ +../../../LNXPWRBN:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/dev b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/dev new file mode 100644 index 0000000000..91eb0ccdb9 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/dev @@ -0,0 +1 @@ +13:67 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/device b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/device new file mode 120000 index 0000000000..7f61e05e64 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/device @@ -0,0 +1 @@ +../../input3 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/subsystem b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/subsystem new file mode 120000 index 0000000000..a181f4f9d1 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/subsystem @@ -0,0 +1 @@ +../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/uevent b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/uevent new file mode 100644 index 0000000000..9124bc53e1 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=67 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/bustype b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/bustype new file mode 100644 index 0000000000..f1993fb3a7 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/bustype @@ -0,0 +1 @@ +0019 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/product b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/product new file mode 100644 index 0000000000..5fca1fda0b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/product @@ -0,0 +1 @@ +0002 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/version b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/version new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/version @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias new file mode 100644 index 0000000000..2248a2516e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias @@ -0,0 +1 @@ +input:b0019v0000p0002e0000-e0,1,k74,ramlsfw diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/name b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/name new file mode 100644 index 0000000000..228ff268c1 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/name @@ -0,0 +1 @@ +Power Button (FF) diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/phys b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/phys new file mode 100644 index 0000000000..88a1fe2d56 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/phys @@ -0,0 +1 @@ +LNXPWRBN/button/input0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem new file mode 120000 index 0000000000..bd2a91fcf2 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem @@ -0,0 +1 @@ +../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent new file mode 100644 index 0000000000..4ee3cf653c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent @@ -0,0 +1,6 @@ +PRODUCT=19/0/2/0 +NAME="Power Button (FF)" +PHYS="LNXPWRBN/button/input0" +EV==3 +KEY==10000000000000 0 +MODALIAS=input:b0019v0000p0002e0000-e0,1,k74,ramlsfw diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias new file mode 100644 index 0000000000..f25ac9bed2 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias @@ -0,0 +1 @@ +acpi:LNXPWRBN: diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem new file mode 120000 index 0000000000..a9dfb93327 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem @@ -0,0 +1 @@ +../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent new file mode 100644 index 0000000000..1e7a4fb734 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent @@ -0,0 +1,2 @@ +DRIVER=button +MODALIAS=acpi:LNXPWRBN: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver new file mode 120000 index 0000000000..9373eb378c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/thermal \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid new file mode 100644 index 0000000000..af4799663d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid @@ -0,0 +1 @@ +LNXTHERM diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias new file mode 100644 index 0000000000..b1054f9d27 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias @@ -0,0 +1 @@ +acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path new file mode 100644 index 0000000000..4dd3ade433 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path @@ -0,0 +1 @@ +\_TZ_.THM0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/thermal_zone b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/thermal_zone new file mode 120000 index 0000000000..694521091e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/thermal_zone @@ -0,0 +1 @@ +../../../virtual/thermal/thermal_zone0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent new file mode 100644 index 0000000000..1d557a95a4 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent @@ -0,0 +1,2 @@ +DRIVER=thermal +MODALIAS=acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver new file mode 120000 index 0000000000..9373eb378c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/thermal \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid new file mode 100644 index 0000000000..af4799663d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid @@ -0,0 +1 @@ +LNXTHERM diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias new file mode 100644 index 0000000000..b1054f9d27 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias @@ -0,0 +1 @@ +acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path new file mode 100644 index 0000000000..a1a565ddea --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path @@ -0,0 +1 @@ +\_TZ_.THM1 diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/thermal_zone b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/thermal_zone new file mode 120000 index 0000000000..8e148453d4 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/thermal_zone @@ -0,0 +1 @@ +../../../virtual/thermal/thermal_zone1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent new file mode 100644 index 0000000000..1d557a95a4 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent @@ -0,0 +1,2 @@ +DRIVER=thermal +MODALIAS=acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid new file mode 100644 index 0000000000..af4799663d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid @@ -0,0 +1 @@ +LNXTHERM diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias new file mode 100644 index 0000000000..b1054f9d27 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias @@ -0,0 +1 @@ +acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path new file mode 100644 index 0000000000..060f460fad --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path @@ -0,0 +1 @@ +\_TZ_ diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem new file mode 120000 index 0000000000..a9dfb93327 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem @@ -0,0 +1 @@ +../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent new file mode 100644 index 0000000000..236b226e58 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/hid new file mode 100644 index 0000000000..23daf0c824 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/hid @@ -0,0 +1 @@ +IBM0079 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/modalias new file mode 100644 index 0000000000..ec2476bf45 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/modalias @@ -0,0 +1 @@ +acpi:IBM0079:PNP0C15:LNXDOCK: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/path b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/path new file mode 100644 index 0000000000..c69dd9d7ad --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/path @@ -0,0 +1 @@ +\_SB_.GDCK diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/uevent new file mode 100644 index 0000000000..630e64a790 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:IBM0079:PNP0C15:LNXDOCK: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/hid new file mode 100644 index 0000000000..a48d4426eb --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/hid @@ -0,0 +1 @@ +ATM1200 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/modalias new file mode 100644 index 0000000000..7239e1ac92 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/modalias @@ -0,0 +1 @@ +acpi:ATM1200:PNP0C31: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/path new file mode 100644 index 0000000000..10ff73954c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.TPM_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/physical_node new file mode 120000 index 0000000000..d73f8da534 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/physical_node @@ -0,0 +1 @@ +../../../../../pnp0/00:0a \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/uevent new file mode 100644 index 0000000000..1e2b3ec26e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:ATM1200:PNP0C31: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/hid new file mode 100644 index 0000000000..475abcdc61 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/hid @@ -0,0 +1 @@ +IBM0057 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/modalias new file mode 100644 index 0000000000..37b29a8cb5 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/modalias @@ -0,0 +1 @@ +acpi:IBM0057:PNP0F13: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/path new file mode 100644 index 0000000000..4ddbc184d2 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.MOU_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/physical_node new file mode 120000 index 0000000000..3cc02b97f8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/physical_node @@ -0,0 +1 @@ +../../../../../pnp0/00:09 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/uevent new file mode 100644 index 0000000000..d62d0fe275 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:IBM0057:PNP0F13: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/hid new file mode 100644 index 0000000000..b1fd8f62a2 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/hid @@ -0,0 +1 @@ +PNP0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/modalias new file mode 100644 index 0000000000..dbd39e483c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/modalias @@ -0,0 +1 @@ +acpi:PNP0000: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/path new file mode 100644 index 0000000000..726cdc1f11 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.PIC_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/uevent new file mode 100644 index 0000000000..22a696e74f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0000: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/hid new file mode 100644 index 0000000000..b593381c48 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/hid @@ -0,0 +1 @@ +PNP0100 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/modalias new file mode 100644 index 0000000000..2e970b6c12 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/modalias @@ -0,0 +1 @@ +acpi:PNP0100: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/path new file mode 100644 index 0000000000..ecefa7c0c7 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.TIMR diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/uevent new file mode 100644 index 0000000000..af0dd875d8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0100: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/hid new file mode 100644 index 0000000000..01bdd099b8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/hid @@ -0,0 +1 @@ +PNP0103 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/modalias new file mode 100644 index 0000000000..30023a86ef --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/modalias @@ -0,0 +1 @@ +acpi:PNP0103: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/path new file mode 100644 index 0000000000..53dda49910 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.HPET diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/physical_node new file mode 120000 index 0000000000..e06816ccc9 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/physical_node @@ -0,0 +1 @@ +../../../../../pnp0/00:03 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/uevent new file mode 100644 index 0000000000..bb8024626e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0103: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/hid new file mode 100644 index 0000000000..d14c5bc3ff --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/hid @@ -0,0 +1 @@ +PNP0200 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/modalias new file mode 100644 index 0000000000..e3c5fdeca6 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/modalias @@ -0,0 +1 @@ +acpi:PNP0200: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/path new file mode 100644 index 0000000000..92cf969aca --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.DMAC diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/physical_node new file mode 120000 index 0000000000..afe28a0d8f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/physical_node @@ -0,0 +1 @@ +../../../../../pnp0/00:04 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/uevent new file mode 100644 index 0000000000..3e20ab0ce7 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0200: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/hid new file mode 100644 index 0000000000..958febdd9e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/hid @@ -0,0 +1 @@ +PNP0303 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/modalias new file mode 100644 index 0000000000..585fdca68a --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/modalias @@ -0,0 +1 @@ +acpi:PNP0303: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/path new file mode 100644 index 0000000000..9936957ed5 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.KBD_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/physical_node new file mode 120000 index 0000000000..88eaf70b6c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/physical_node @@ -0,0 +1 @@ +../../../../../pnp0/00:08 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/uevent new file mode 100644 index 0000000000..fbd39d8f1d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0303: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/hid new file mode 100644 index 0000000000..aec7221dee --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/hid @@ -0,0 +1 @@ +PNP0800 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/modalias new file mode 100644 index 0000000000..721f7c31b8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/modalias @@ -0,0 +1 @@ +acpi:PNP0800: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/path new file mode 100644 index 0000000000..905bc37db3 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.SPKR diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/physical_node new file mode 120000 index 0000000000..eecd61da6d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/physical_node @@ -0,0 +1 @@ +../../../../../pnp0/00:05 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/uevent new file mode 100644 index 0000000000..7495b1b8a6 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0800: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/hid new file mode 100644 index 0000000000..9d03dbb448 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/hid @@ -0,0 +1 @@ +PNP0B00 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/modalias new file mode 100644 index 0000000000..9d135ac1e3 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/modalias @@ -0,0 +1 @@ +acpi:PNP0B00: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/path new file mode 100644 index 0000000000..75b7df3aff --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.RTC_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/physical_node new file mode 120000 index 0000000000..7456f7876f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/physical_node @@ -0,0 +1 @@ +../../../../../pnp0/00:07 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/uevent new file mode 100644 index 0000000000..54fcb6ad2d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0B00: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/hid new file mode 100644 index 0000000000..7b80763afa --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/hid @@ -0,0 +1 @@ +PNP0C02 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/modalias new file mode 100644 index 0000000000..e27f28d41f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/modalias @@ -0,0 +1 @@ +acpi:PNP0C02: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/path new file mode 100644 index 0000000000..7e94a0fd3c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.SIO_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/physical_node new file mode 120000 index 0000000000..999270e913 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/physical_node @@ -0,0 +1 @@ +../../../../../pnp0/00:02 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/uevent new file mode 100644 index 0000000000..b6f43bbf82 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0C02: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/hid new file mode 100644 index 0000000000..f7526732dc --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/hid @@ -0,0 +1 @@ +PNP0C04 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/modalias new file mode 100644 index 0000000000..5787b19ab4 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/modalias @@ -0,0 +1 @@ +acpi:PNP0C04: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/path new file mode 100644 index 0000000000..da352ec579 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.FPU_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/physical_node new file mode 120000 index 0000000000..6680a64796 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/physical_node @@ -0,0 +1 @@ +../../../../../pnp0/00:06 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/uevent new file mode 100644 index 0000000000..18c9c5efdc --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0C04: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/driver new file mode 120000 index 0000000000..50a6634c95 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/driver @@ -0,0 +1 @@ +../../../../../../../bus/acpi/drivers/ac \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/hid new file mode 100644 index 0000000000..ea0d5fb834 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/hid @@ -0,0 +1 @@ +ACPI0003 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/modalias new file mode 100644 index 0000000000..cb2b78fc33 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/modalias @@ -0,0 +1 @@ +acpi:ACPI0003: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/path new file mode 100644 index 0000000000..7f99e03071 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.EC__.AC__ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/device new file mode 120000 index 0000000000..f617994654 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/device @@ -0,0 +1 @@ +../../../ACPI0003:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/subsystem new file mode 120000 index 0000000000..eeac787e94 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/power_supply \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/type b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/type new file mode 100644 index 0000000000..9aaee2dade --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/type @@ -0,0 +1 @@ +Mains diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent new file mode 100644 index 0000000000..01c433c818 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent @@ -0,0 +1,3 @@ +POWER_SUPPLY_NAME=AC +POWER_SUPPLY_TYPE=Mains +POWER_SUPPLY_ONLINE=1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/uevent new file mode 100644 index 0000000000..708c891771 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/uevent @@ -0,0 +1,2 @@ +DRIVER=ac +MODALIAS=acpi:ACPI0003: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/driver new file mode 120000 index 0000000000..28523cef0e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/driver @@ -0,0 +1 @@ +../../../../../../../bus/acpi/drivers/thinkpad_hotkey \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid new file mode 100644 index 0000000000..d09f0e2a78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid @@ -0,0 +1 @@ +IBM0068 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/modalias new file mode 100644 index 0000000000..78a97b9783 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/modalias @@ -0,0 +1 @@ +acpi:IBM0068: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/path new file mode 100644 index 0000000000..5e6871ba41 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.EC__.HKEY diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/uevent new file mode 100644 index 0000000000..a847bf581b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/uevent @@ -0,0 +1,2 @@ +DRIVER=thinkpad_hotkey +MODALIAS=acpi:IBM0068: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/driver new file mode 120000 index 0000000000..9ee99277ef --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/driver @@ -0,0 +1 @@ +../../../../../../../bus/acpi/drivers/power \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/hid new file mode 100644 index 0000000000..2658e7b466 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/hid @@ -0,0 +1 @@ +LNXPOWER diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/modalias new file mode 100644 index 0000000000..1acba2a31b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/modalias @@ -0,0 +1 @@ +acpi:LNXPOWER: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/path new file mode 100644 index 0000000000..52bc528e90 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.EC__.PUBS diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/uevent new file mode 100644 index 0000000000..cab9b4d4f0 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/uevent @@ -0,0 +1,2 @@ +DRIVER=power +MODALIAS=acpi:LNXPOWER: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/driver new file mode 120000 index 0000000000..eae38ea111 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/driver @@ -0,0 +1 @@ +../../../../../../../bus/acpi/drivers/battery \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid new file mode 100644 index 0000000000..f0e9b61652 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid @@ -0,0 +1 @@ +PNP0C0A diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/modalias new file mode 100644 index 0000000000..6fd005c690 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/modalias @@ -0,0 +1 @@ +acpi:PNP0C0A: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/path new file mode 100644 index 0000000000..03547d8e84 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.EC__.BAT0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm new file mode 100644 index 0000000000..260a626e56 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm @@ -0,0 +1 @@ +3075000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device new file mode 120000 index 0000000000..1a192d8d1c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device @@ -0,0 +1 @@ +../../../PNP0C0A:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full new file mode 100644 index 0000000000..0bf389e5f2 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full @@ -0,0 +1 @@ +61510000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full_design b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full_design new file mode 100644 index 0000000000..65b7a8515f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full_design @@ -0,0 +1 @@ +84240000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now new file mode 100644 index 0000000000..8db8b6298e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now @@ -0,0 +1 @@ +59160000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/manufacturer b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/manufacturer new file mode 100644 index 0000000000..c4857dfb86 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/manufacturer @@ -0,0 +1 @@ +SANYO diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/model_name b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/model_name new file mode 100644 index 0000000000..05082d6a8b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/model_name @@ -0,0 +1 @@ +42T5245 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/present b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/present new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/present @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/serial_number b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/serial_number new file mode 100644 index 0000000000..5642b4cccb --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/serial_number @@ -0,0 +1 @@ + 6463 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status new file mode 100644 index 0000000000..f1a797a6b1 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status @@ -0,0 +1 @@ +Full diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/subsystem new file mode 120000 index 0000000000..eeac787e94 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/power_supply \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/technology b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/technology new file mode 100644 index 0000000000..2c679ca734 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/technology @@ -0,0 +1 @@ +Li-ion diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type new file mode 100644 index 0000000000..6784dd35ce --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type @@ -0,0 +1 @@ +Battery diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent new file mode 100644 index 0000000000..48bbf4ae00 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent @@ -0,0 +1,14 @@ +POWER_SUPPLY_NAME=BAT0 +POWER_SUPPLY_TYPE=Battery +POWER_SUPPLY_STATUS=Full +POWER_SUPPLY_PRESENT=1 +POWER_SUPPLY_TECHNOLOGY=Li-ion +POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000 +POWER_SUPPLY_VOLTAGE_NOW=12415000 +POWER_SUPPLY_CURRENT_NOW=0 +POWER_SUPPLY_ENERGY_FULL_DESIGN=84240000 +POWER_SUPPLY_ENERGY_FULL=61510000 +POWER_SUPPLY_ENERGY_NOW=59160000 +POWER_SUPPLY_MODEL_NAME=42T5245 +POWER_SUPPLY_MANUFACTURER=SANYO +POWER_SUPPLY_SERIAL_NUMBER= 6463 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design new file mode 100644 index 0000000000..2636081d72 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design @@ -0,0 +1 @@ +10800000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now new file mode 100644 index 0000000000..e096ad1389 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now @@ -0,0 +1 @@ +12415000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/uevent new file mode 100644 index 0000000000..1afe034bbb --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/uevent @@ -0,0 +1,2 @@ +DRIVER=battery +MODALIAS=acpi:PNP0C0A: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/driver new file mode 120000 index 0000000000..78583b7456 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/driver @@ -0,0 +1 @@ +../../../../../../bus/acpi/drivers/ec \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/hid new file mode 100644 index 0000000000..f45606d178 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/hid @@ -0,0 +1 @@ +PNP0C09 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/modalias new file mode 100644 index 0000000000..a6dcf49544 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/modalias @@ -0,0 +1 @@ +acpi:PNP0C09: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/path new file mode 100644 index 0000000000..1c15db71f4 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_.EC__ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/uevent new file mode 100644 index 0000000000..39d3180ba8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/uevent @@ -0,0 +1,2 @@ +DRIVER=ec +MODALIAS=acpi:PNP0C09: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/path new file mode 100644 index 0000000000..70e3d1ad5d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/path @@ -0,0 +1 @@ +\_SB_.PCI0.LPC_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/physical_node new file mode 120000 index 0000000000..4cab8f6315 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1f.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/path new file mode 100644 index 0000000000..761a72d9d7 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/path @@ -0,0 +1 @@ +\_SB_.PCI0.VID_.LCD0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/path new file mode 100644 index 0000000000..7ff768b0d7 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/path @@ -0,0 +1 @@ +\_SB_.PCI0.VID_.CRT0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/path new file mode 100644 index 0000000000..293a381df9 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/path @@ -0,0 +1 @@ +\_SB_.PCI0.VID_.DVI0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/modalias new file mode 100644 index 0000000000..42d369f887 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/modalias @@ -0,0 +1 @@ +acpi:LNXVIDEO: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/path new file mode 100644 index 0000000000..dd962244c7 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/path @@ -0,0 +1 @@ +\_SB_.PCI0.VID_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/uevent new file mode 100644 index 0000000000..e08505ab58 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:LNXVIDEO: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/path new file mode 100644 index 0000000000..7338d716b6 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/path @@ -0,0 +1 @@ +\_SB_.PCI0.AGP_.VID_.LCD0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/path new file mode 100644 index 0000000000..840af2b9e6 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/path @@ -0,0 +1 @@ +\_SB_.PCI0.AGP_.VID_.CRT0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/path new file mode 100644 index 0000000000..1480e899ce --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/path @@ -0,0 +1 @@ +\_SB_.PCI0.AGP_.VID_.DVI0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/modalias new file mode 100644 index 0000000000..42d369f887 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/modalias @@ -0,0 +1 @@ +acpi:LNXVIDEO: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/path new file mode 100644 index 0000000000..c60f80c93f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/path @@ -0,0 +1 @@ +\_SB_.PCI0.AGP_.VID_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/physical_node new file mode 120000 index 0000000000..b9be7aabc3 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/physical_node @@ -0,0 +1 @@ +../../../../../pci0000:00/0000:00:01.0/0000:01:00.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/uevent new file mode 100644 index 0000000000..e08505ab58 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:LNXVIDEO: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/path new file mode 100644 index 0000000000..8a923d8adf --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/path @@ -0,0 +1 @@ +\_SB_.PCI0.AGP_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/physical_node new file mode 120000 index 0000000000..c248b7891d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:01.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/path new file mode 100644 index 0000000000..cf015c0e43 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/path @@ -0,0 +1 @@ +\_SB_.PCI0.EXP0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/physical_node new file mode 120000 index 0000000000..1c817658c8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1c.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/path new file mode 100644 index 0000000000..ad9adfaf0d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/path @@ -0,0 +1 @@ +\_SB_.PCI0.EXP1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/physical_node new file mode 120000 index 0000000000..f2ef6c4a86 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1c.1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/path new file mode 100644 index 0000000000..59515bd8fd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/path @@ -0,0 +1 @@ +\_SB_.PCI0.EXP2.EXUP diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/path new file mode 100644 index 0000000000..5d82614aa2 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/path @@ -0,0 +1 @@ +\_SB_.PCI0.EXP2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/physical_node new file mode 120000 index 0000000000..f35791f384 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1c.2 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/path new file mode 100644 index 0000000000..4eb0f292a4 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/path @@ -0,0 +1 @@ +\_SB_.PCI0.EXP3.EXPD diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/path new file mode 100644 index 0000000000..59ad546003 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/path @@ -0,0 +1 @@ +\_SB_.PCI0.EXP3 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/physical_node new file mode 120000 index 0000000000..c0ce681297 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1c.3 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/path new file mode 100644 index 0000000000..50539e182b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/path @@ -0,0 +1 @@ +\_SB_.PCI0.PCI1.CDBS diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/physical_node new file mode 120000 index 0000000000..e3e6c28729 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/physical_node @@ -0,0 +1 @@ +../../../../../pci0000:00/0000:00:1e.0/0000:15:00.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/path new file mode 100644 index 0000000000..3726f6d993 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/path @@ -0,0 +1 @@ +\_SB_.PCI0.PCI1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/physical_node new file mode 120000 index 0000000000..68b01daac3 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/modalias new file mode 100644 index 0000000000..d9da66f2b8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/modalias @@ -0,0 +1 @@ +acpi:LNXIOBAY: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/path new file mode 100644 index 0000000000..f8542f371b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/path @@ -0,0 +1 @@ +\_SB_.PCI0.IDE0.PRIM.MSTR diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/uevent new file mode 100644 index 0000000000..ce4f42475e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:LNXIOBAY: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/path new file mode 100644 index 0000000000..e693cfc4ae --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/path @@ -0,0 +1 @@ +\_SB_.PCI0.IDE0.PRIM diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/path new file mode 100644 index 0000000000..8c85a31d95 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/path @@ -0,0 +1 @@ +\_SB_.PCI0.IDE0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/physical_node new file mode 120000 index 0000000000..49439891e4 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1f.1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/path new file mode 100644 index 0000000000..332145062a --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/path @@ -0,0 +1 @@ +\_SB_.PCI0.SATA.PRT0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/path new file mode 100644 index 0000000000..7946fbc055 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/path @@ -0,0 +1 @@ +\_SB_.PCI0.SATA diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/physical_node new file mode 120000 index 0000000000..d44ac47d2c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1f.2 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/path new file mode 100644 index 0000000000..00cb0e0601 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/path @@ -0,0 +1 @@ +\_SB_.PCI0.SMBU diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/physical_node new file mode 120000 index 0000000000..8373e13586 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1f.3 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/path new file mode 100644 index 0000000000..90feac0ec2 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/physical_node new file mode 120000 index 0000000000..ae9769e4d6 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1d.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/path new file mode 100644 index 0000000000..8ac5af3142 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB1.URTH.UPEX diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/path new file mode 100644 index 0000000000..09b16a3ced --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB1.URTH diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/path new file mode 100644 index 0000000000..23e35fcfa0 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/physical_node new file mode 120000 index 0000000000..a6b409fe0b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1d.1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/path new file mode 100644 index 0000000000..d5ea43571b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB2.URTH.UPDK diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/path new file mode 100644 index 0000000000..d493814ae8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB2.URTH diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/path new file mode 100644 index 0000000000..1c2b00f9d4 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/physical_node new file mode 120000 index 0000000000..14f4165f79 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1d.2 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/path new file mode 100644 index 0000000000..a39841e12c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB3 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/physical_node new file mode 120000 index 0000000000..1e17c8f55e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1d.3 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/path new file mode 100644 index 0000000000..489a6c8625 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB7.URTH.UPDK diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/path new file mode 100644 index 0000000000..ddceca5d30 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB7.URTH.UPEX diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/subsystem new file mode 120000 index 0000000000..328069c6bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/path new file mode 100644 index 0000000000..9eb337be25 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB7.URTH diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/subsystem new file mode 120000 index 0000000000..1429387650 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/subsystem @@ -0,0 +1 @@ +../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/path new file mode 100644 index 0000000000..530247ff61 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/path @@ -0,0 +1 @@ +\_SB_.PCI0.USB7 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/physical_node new file mode 120000 index 0000000000..8525c168e3 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1d.7 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/path new file mode 100644 index 0000000000..ee6276f7bf --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/path @@ -0,0 +1 @@ +\_SB_.PCI0.HDEF diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/physical_node new file mode 120000 index 0000000000..02dd7ad3c8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/physical_node @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1b.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/subsystem new file mode 120000 index 0000000000..2319c1fc78 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/subsystem @@ -0,0 +1 @@ +../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/driver new file mode 120000 index 0000000000..8085013227 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/pci_root \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/hid new file mode 100644 index 0000000000..636eed19b3 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/hid @@ -0,0 +1 @@ +PNP0A08 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/modalias new file mode 100644 index 0000000000..b90e645703 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/modalias @@ -0,0 +1 @@ +acpi:PNP0A08:PNP0A03: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/path new file mode 100644 index 0000000000..313edcd0cd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/path @@ -0,0 +1 @@ +\_SB_.PCI0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/physical_node new file mode 120000 index 0000000000..1b094a25e9 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/physical_node @@ -0,0 +1 @@ +../../../pci0000:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/uevent new file mode 100644 index 0000000000..af09b45dd3 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/uevent @@ -0,0 +1,2 @@ +DRIVER=pci_root +MODALIAS=acpi:PNP0A08:PNP0A03: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/hid new file mode 100644 index 0000000000..5c42a4262b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/hid @@ -0,0 +1 @@ +PNP0C01 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/modalias new file mode 100644 index 0000000000..b7aa586f30 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/modalias @@ -0,0 +1 @@ +acpi:PNP0C01: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/path new file mode 100644 index 0000000000..56eb1dc44f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/path @@ -0,0 +1 @@ +\_SB_.MEM_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/physical_node new file mode 120000 index 0000000000..142a45a2ab --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/physical_node @@ -0,0 +1 @@ +../../../pnp0/00:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/uevent new file mode 100644 index 0000000000..aebbbf8555 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:PNP0C01: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/driver new file mode 120000 index 0000000000..fe3d26376a --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/button \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid new file mode 100644 index 0000000000..f9f5922e90 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid @@ -0,0 +1 @@ +PNP0C0D diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/abs b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/abs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/abs @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ev b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ev new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ev @@ -0,0 +1 @@ +21 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ff b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ff new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ff @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/key b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/key new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/key @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/led b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/led new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/led @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/msc b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/msc new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/msc @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/rel b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/rel new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/rel @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/snd b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/snd new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/snd @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/sw b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/sw new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/sw @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/device new file mode 120000 index 0000000000..29849b0b2a --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/device @@ -0,0 +1 @@ +../../../PNP0C0D:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/dev b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/dev new file mode 100644 index 0000000000..b0fa894fcf --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/dev @@ -0,0 +1 @@ +13:68 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/device new file mode 120000 index 0000000000..3206827665 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/device @@ -0,0 +1 @@ +../../input4 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/subsystem new file mode 120000 index 0000000000..adf0173c53 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/subsystem @@ -0,0 +1 @@ +../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/uevent new file mode 100644 index 0000000000..713fa5b0fa --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=68 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/bustype b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/bustype new file mode 100644 index 0000000000..f1993fb3a7 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/bustype @@ -0,0 +1 @@ +0019 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/product b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/product new file mode 100644 index 0000000000..edd6487e02 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/product @@ -0,0 +1 @@ +0005 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/vendor b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/vendor new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/vendor @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/version b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/version new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/version @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/modalias new file mode 100644 index 0000000000..fb7de7b5c8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/modalias @@ -0,0 +1 @@ +input:b0019v0000p0005e0000-e0,5,kramlsfw0, diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/name b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/name new file mode 100644 index 0000000000..a9975a6a4c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/name @@ -0,0 +1 @@ +Lid Switch diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/phys b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/phys new file mode 100644 index 0000000000..a1e12fb554 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/phys @@ -0,0 +1 @@ +PNP0C0D/button/input0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/subsystem new file mode 120000 index 0000000000..a181f4f9d1 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/subsystem @@ -0,0 +1 @@ +../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uevent new file mode 100644 index 0000000000..f55398e539 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uevent @@ -0,0 +1,6 @@ +PRODUCT=19/0/5/0 +NAME="Lid Switch" +PHYS="PNP0C0D/button/input0" +EV==21 +SW==1 +MODALIAS=input:b0019v0000p0005e0000-e0,5,kramlsfw0, diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uniq b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uniq new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uniq @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/modalias new file mode 100644 index 0000000000..ba899cbcf1 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/modalias @@ -0,0 +1 @@ +acpi:PNP0C0D: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/path new file mode 100644 index 0000000000..edf97b8cde --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/path @@ -0,0 +1 @@ +\_SB_.LID_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/uevent new file mode 100644 index 0000000000..f58d0e9862 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/uevent @@ -0,0 +1,2 @@ +DRIVER=button +MODALIAS=acpi:PNP0C0D: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/driver new file mode 120000 index 0000000000..fe3d26376a --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/button \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid new file mode 100644 index 0000000000..166a5212d6 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid @@ -0,0 +1 @@ +PNP0C0E diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/abs b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/abs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/abs @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ev b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ev new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ev @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ff b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ff new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ff @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/key b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/key new file mode 100644 index 0000000000..46f68a575d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/key @@ -0,0 +1 @@ +4000 0 0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/led b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/led new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/led @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/msc b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/msc new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/msc @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/rel b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/rel new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/rel @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/snd b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/snd new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/snd @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/sw b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/sw new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/sw @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/device new file mode 120000 index 0000000000..8720cc2f93 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/device @@ -0,0 +1 @@ +../../../PNP0C0E:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/dev b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/dev new file mode 100644 index 0000000000..00b51205ed --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/dev @@ -0,0 +1 @@ +13:69 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/device new file mode 120000 index 0000000000..eb7862e025 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/device @@ -0,0 +1 @@ +../../input5 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/subsystem new file mode 120000 index 0000000000..adf0173c53 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/subsystem @@ -0,0 +1 @@ +../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/uevent new file mode 100644 index 0000000000..f2a4e86587 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=69 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/bustype b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/bustype new file mode 100644 index 0000000000..f1993fb3a7 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/bustype @@ -0,0 +1 @@ +0019 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/product b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/product new file mode 100644 index 0000000000..1ce74b6b00 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/product @@ -0,0 +1 @@ +0003 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/vendor b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/vendor new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/vendor @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/version b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/version new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/version @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/modalias new file mode 100644 index 0000000000..437a395c00 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/modalias @@ -0,0 +1 @@ +input:b0019v0000p0003e0000-e0,1,k8E,ramlsfw diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/name b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/name new file mode 100644 index 0000000000..b933ba313a --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/name @@ -0,0 +1 @@ +Sleep Button (CM) diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/phys b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/phys new file mode 100644 index 0000000000..165a87f297 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/phys @@ -0,0 +1 @@ +PNP0C0E/button/input0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/subsystem new file mode 120000 index 0000000000..a181f4f9d1 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/subsystem @@ -0,0 +1 @@ +../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uevent new file mode 100644 index 0000000000..e9b639e1bd --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uevent @@ -0,0 +1,6 @@ +PRODUCT=19/0/3/0 +NAME="Sleep Button (CM)" +PHYS="PNP0C0E/button/input0" +EV==3 +KEY==4000 0 0 +MODALIAS=input:b0019v0000p0003e0000-e0,1,k8E,ramlsfw diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uniq b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uniq new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uniq @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/modalias new file mode 100644 index 0000000000..5439a79133 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/modalias @@ -0,0 +1 @@ +acpi:PNP0C0E: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/path new file mode 100644 index 0000000000..cb65018f8e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/path @@ -0,0 +1 @@ +\_SB_.SLPB diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/uevent new file mode 100644 index 0000000000..06585c64c5 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/uevent @@ -0,0 +1,2 @@ +DRIVER=button +MODALIAS=acpi:PNP0C0E: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/driver new file mode 120000 index 0000000000..1b3a6d6570 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid new file mode 100644 index 0000000000..a00f9f7005 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid @@ -0,0 +1 @@ +PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/modalias new file mode 100644 index 0000000000..26ff254b50 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/modalias @@ -0,0 +1 @@ +acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/path new file mode 100644 index 0000000000..9f95ffde70 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/path @@ -0,0 +1 @@ +\_SB_.LNKA diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/uevent new file mode 100644 index 0000000000..8820dec22c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/uevent @@ -0,0 +1,2 @@ +DRIVER=pci_link +MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/driver new file mode 120000 index 0000000000..1b3a6d6570 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid new file mode 100644 index 0000000000..a00f9f7005 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid @@ -0,0 +1 @@ +PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/modalias new file mode 100644 index 0000000000..26ff254b50 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/modalias @@ -0,0 +1 @@ +acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/path new file mode 100644 index 0000000000..1d3fe83056 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/path @@ -0,0 +1 @@ +\_SB_.LNKB diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/uevent new file mode 100644 index 0000000000..8820dec22c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/uevent @@ -0,0 +1,2 @@ +DRIVER=pci_link +MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/driver new file mode 120000 index 0000000000..1b3a6d6570 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid new file mode 100644 index 0000000000..a00f9f7005 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid @@ -0,0 +1 @@ +PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/modalias new file mode 100644 index 0000000000..26ff254b50 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/modalias @@ -0,0 +1 @@ +acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/path new file mode 100644 index 0000000000..790ff3a5ee --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/path @@ -0,0 +1 @@ +\_SB_.LNKC diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/uevent new file mode 100644 index 0000000000..8820dec22c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/uevent @@ -0,0 +1,2 @@ +DRIVER=pci_link +MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/driver new file mode 120000 index 0000000000..1b3a6d6570 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid new file mode 100644 index 0000000000..a00f9f7005 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid @@ -0,0 +1 @@ +PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/modalias new file mode 100644 index 0000000000..26ff254b50 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/modalias @@ -0,0 +1 @@ +acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/path new file mode 100644 index 0000000000..236204ddc8 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/path @@ -0,0 +1 @@ +\_SB_.LNKD diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/uevent new file mode 100644 index 0000000000..8820dec22c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/uevent @@ -0,0 +1,2 @@ +DRIVER=pci_link +MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/driver new file mode 120000 index 0000000000..1b3a6d6570 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid new file mode 100644 index 0000000000..a00f9f7005 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid @@ -0,0 +1 @@ +PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/modalias new file mode 100644 index 0000000000..26ff254b50 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/modalias @@ -0,0 +1 @@ +acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/path new file mode 100644 index 0000000000..4c4d0d83ef --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/path @@ -0,0 +1 @@ +\_SB_.LNKE diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/uevent new file mode 100644 index 0000000000..8820dec22c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/uevent @@ -0,0 +1,2 @@ +DRIVER=pci_link +MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/driver new file mode 120000 index 0000000000..1b3a6d6570 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid new file mode 100644 index 0000000000..a00f9f7005 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid @@ -0,0 +1 @@ +PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/modalias new file mode 100644 index 0000000000..26ff254b50 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/modalias @@ -0,0 +1 @@ +acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/path new file mode 100644 index 0000000000..c3a3967f4a --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/path @@ -0,0 +1 @@ +\_SB_.LNKF diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/uevent new file mode 100644 index 0000000000..8820dec22c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/uevent @@ -0,0 +1,2 @@ +DRIVER=pci_link +MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/driver new file mode 120000 index 0000000000..1b3a6d6570 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid new file mode 100644 index 0000000000..a00f9f7005 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid @@ -0,0 +1 @@ +PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/modalias new file mode 100644 index 0000000000..26ff254b50 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/modalias @@ -0,0 +1 @@ +acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/path new file mode 100644 index 0000000000..5d8b3c3609 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/path @@ -0,0 +1 @@ +\_SB_.LNKG diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/uevent new file mode 100644 index 0000000000..8820dec22c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/uevent @@ -0,0 +1,2 @@ +DRIVER=pci_link +MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/driver new file mode 120000 index 0000000000..1b3a6d6570 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/driver @@ -0,0 +1 @@ +../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid new file mode 100644 index 0000000000..a00f9f7005 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid @@ -0,0 +1 @@ +PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/modalias new file mode 100644 index 0000000000..26ff254b50 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/modalias @@ -0,0 +1 @@ +acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/path new file mode 100644 index 0000000000..70eac1404b --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/path @@ -0,0 +1 @@ +\_SB_.LNKH diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/subsystem new file mode 120000 index 0000000000..8ec129451f --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/subsystem @@ -0,0 +1 @@ +../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/uevent new file mode 100644 index 0000000000..8820dec22c --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/uevent @@ -0,0 +1,2 @@ +DRIVER=pci_link +MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/path b/test/sys/devices/LNXSYSTM:00/device:00/path new file mode 100644 index 0000000000..f914d16ee9 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/path @@ -0,0 +1 @@ +\_SB_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/device:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/subsystem new file mode 120000 index 0000000000..a9dfb93327 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/device:00/subsystem @@ -0,0 +1 @@ +../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/LNXSYSTM:00/hid b/test/sys/devices/LNXSYSTM:00/hid new file mode 100644 index 0000000000..fda0cf0719 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/hid @@ -0,0 +1 @@ +LNXSYSTM diff --git a/test/sys/devices/LNXSYSTM:00/modalias b/test/sys/devices/LNXSYSTM:00/modalias new file mode 100644 index 0000000000..2d63ad6e4e --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/modalias @@ -0,0 +1 @@ +acpi:LNXSYSTM: diff --git a/test/sys/devices/LNXSYSTM:00/path b/test/sys/devices/LNXSYSTM:00/path new file mode 100644 index 0000000000..57ddad2aec --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/path @@ -0,0 +1 @@ +\ diff --git a/test/sys/devices/LNXSYSTM:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/LNXSYSTM:00/subsystem b/test/sys/devices/LNXSYSTM:00/subsystem new file mode 120000 index 0000000000..849bcf8601 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/subsystem @@ -0,0 +1 @@ +../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/uevent b/test/sys/devices/LNXSYSTM:00/uevent new file mode 100644 index 0000000000..67d9632712 --- /dev/null +++ b/test/sys/devices/LNXSYSTM:00/uevent @@ -0,0 +1 @@ +MODALIAS=acpi:LNXSYSTM: diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:00.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/class b/test/sys/devices/pci0000:00/0000:00:00.0/class new file mode 100644 index 0000000000..fc636cd5b1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/class @@ -0,0 +1 @@ +0x060000 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/config b/test/sys/devices/pci0000:00/0000:00:00.0/config new file mode 100644 index 0000000000..971699c343 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:00.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/device b/test/sys/devices/pci0000:00/0000:00:00.0/device new file mode 100644 index 0000000000..0b573abbac --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/device @@ -0,0 +1 @@ +0x27a0 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/enable b/test/sys/devices/pci0000:00/0000:00:00.0/enable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/enable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/irq b/test/sys/devices/pci0000:00/0000:00:00.0/irq new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/irq @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:00.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:00.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:00.0/modalias new file mode 100644 index 0000000000..0682834866 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/modalias @@ -0,0 +1 @@ +pci:v00008086d000027A0sv000017AAsd00002015bc06sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:00.0/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:00.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/resource b/test/sys/devices/pci0000:00/0000:00:00.0/resource new file mode 100644 index 0000000000..2d8766d6a3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/resource @@ -0,0 +1,7 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:00.0/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_device new file mode 100644 index 0000000000..4762874631 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_device @@ -0,0 +1 @@ +0x2015 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:00.0/uevent new file mode 100644 index 0000000000..067e9d055f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/uevent @@ -0,0 +1,5 @@ +PCI_CLASS=60000 +PCI_ID=8086:27A0 +PCI_SUBSYS_ID=17AA:2015 +PCI_SLOT_NAME=0000:00:00.0 +MODALIAS=pci:v00008086d000027A0sv000017AAsd00002015bc06sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:00.0/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:00.0/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/class b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/class new file mode 100644 index 0000000000..c5f02e331c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/class @@ -0,0 +1 @@ +0x030000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/config b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/config new file mode 100644 index 0000000000..fd5c966343 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/device b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/device new file mode 100644 index 0000000000..91130e3409 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/device @@ -0,0 +1 @@ +0x71d4 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/enable b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/enable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/enable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/firmware_node new file mode 120000 index 0000000000..e9679446a9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/firmware_node @@ -0,0 +1 @@ +../../../LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/irq b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/irq new file mode 100644 index 0000000000..b4de394767 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/irq @@ -0,0 +1 @@ +11 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/modalias new file mode 100644 index 0000000000..8ee72c88ae --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/modalias @@ -0,0 +1 @@ +pci:v00001002d000071D4sv000017AAsd000020A4bc03sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource new file mode 100644 index 0000000000..c58a0ad747 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource @@ -0,0 +1,7 @@ +0x00000000d0000000 0x00000000dfffffff 0x0000000000021208 +0x0000000000002000 0x00000000000020ff 0x0000000000020101 +0x00000000ee100000 0x00000000ee10ffff 0x0000000000020200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x00000000ee120000 0x00000000ee13ffff 0x0000000000027202 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0 b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0_wc b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0_wc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource1 b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource2 b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem new file mode 120000 index 0000000000..d6210992bb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem @@ -0,0 +1 @@ +../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_device new file mode 100644 index 0000000000..7d855fa37b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_device @@ -0,0 +1 @@ +0x20a4 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/uevent new file mode 100644 index 0000000000..3e8cb35af4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/uevent @@ -0,0 +1,5 @@ +PCI_CLASS=30000 +PCI_ID=1002:71D4 +PCI_SUBSYS_ID=17AA:20A4 +PCI_SLOT_NAME=0000:01:00.0 +MODALIAS=pci:v00001002d000071D4sv000017AAsd000020A4bc03sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/vendor new file mode 100644 index 0000000000..7f97d854fc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/vendor @@ -0,0 +1 @@ +0x1002 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:01.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/class b/test/sys/devices/pci0000:00/0000:00:01.0/class new file mode 100644 index 0000000000..8b40e6a7b7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/class @@ -0,0 +1 @@ +0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/config b/test/sys/devices/pci0000:00/0000:00:01.0/config new file mode 100644 index 0000000000..238d261e39 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:01.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/device b/test/sys/devices/pci0000:00/0000:00:01.0/device new file mode 100644 index 0000000000..10f865d779 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/device @@ -0,0 +1 @@ +0x27a1 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/driver b/test/sys/devices/pci0000:00/0000:00:01.0/driver new file mode 120000 index 0000000000..b30b691e0c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/enable b/test/sys/devices/pci0000:00/0000:00:01.0/enable new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/enable @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:01.0/firmware_node new file mode 120000 index 0000000000..d17adf10f9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:06 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/irq b/test/sys/devices/pci0000:00/0000:00:01.0/irq new file mode 100644 index 0000000000..c0556fb20f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/irq @@ -0,0 +1 @@ +511 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:01.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:01.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/modalias b/test/sys/devices/pci0000:00/0000:00:01.0/modalias new file mode 100644 index 0000000000..61e49dd13c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/modalias @@ -0,0 +1 @@ +pci:v00008086d000027A1sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:01.0/msi_bus new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/msi_bus @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/cpuaffinity new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/cpuaffinity @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/device b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/device new file mode 120000 index 0000000000..538f478101 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/device @@ -0,0 +1 @@ +../../../0000:00:01.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/subsystem new file mode 120000 index 0000000000..1d26d30581 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/subsystem @@ -0,0 +1 @@ +../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/resource b/test/sys/devices/pci0000:00/0000:00:01.0/resource new file mode 100644 index 0000000000..5a19d3a09c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/resource @@ -0,0 +1,12 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000002000 0x0000000000002fff 0x0000000000000100 +0x00000000ee100000 0x00000000ee1fffff 0x0000000000000200 +0x00000000d0000000 0x00000000dfffffff 0x0000000000001201 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_device new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_device @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_vendor new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_vendor @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/uevent new file mode 100644 index 0000000000..f2616c08c3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/uevent @@ -0,0 +1,6 @@ +DRIVER=pcieport-driver +PCI_CLASS=60400 +PCI_ID=8086:27A1 +PCI_SUBSYS_ID=0000:0000 +PCI_SLOT_NAME=0000:00:01.0 +MODALIAS=pci:v00008086d000027A1sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/vendor b/test/sys/devices/pci0000:00/0000:00:01.0/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:01.0/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/class b/test/sys/devices/pci0000:00/0000:00:09.0/class deleted file mode 100644 index a9a8817576..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/class +++ /dev/null @@ -1 +0,0 @@ -0x0c0310 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/device b/test/sys/devices/pci0000:00/0000:00:09.0/device deleted file mode 100644 index 90e151e254..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/device +++ /dev/null @@ -1 +0,0 @@ -0x0035 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/irq b/test/sys/devices/pci0000:00/0000:00:09.0/irq deleted file mode 100644 index ec635144f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/irq +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/pools b/test/sys/devices/pci0000:00/0000:00:09.0/pools deleted file mode 100644 index 7da8ce818d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/pools +++ /dev/null @@ -1,7 +0,0 @@ -poolinfo - 0.1 -ohci_ed 1 64 64 1 -ohci_td 1 64 64 1 -buffer-2048 0 0 2048 0 -buffer-512 0 0 512 0 -buffer-128 0 0 128 0 -buffer-32 1 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/power/state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/power/state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/resource b/test/sys/devices/pci0000:00/0000:00:09.0/resource deleted file mode 100644 index e7c459f811..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x0000000017100000 0x0000000017100fff 0x0000000000000200 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_device deleted file mode 100644 index db5e9bccd0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x11a3 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_vendor deleted file mode 100644 index 3dc3deeb2b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x10cf diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bNumEndpoints deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver deleted file mode 120000 index 5cf493442c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/iInterface b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/iInterface deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/iInterface +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/power/state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/power/state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-0:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/driver deleted file mode 120000 index 27eb850ee4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb/drivers/pl2303 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/iInterface b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/iInterface deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/iInterface +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/power/state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/power/state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/3-1:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower deleted file mode 100644 index d579c4bb6d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bMaxPower +++ /dev/null @@ -1 +0,0 @@ - 50mA diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice deleted file mode 100644 index 635047563b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0001 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes deleted file mode 100644 index 0042f6c56d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -a0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/driver deleted file mode 120000 index 092d2282f3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idProduct b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idProduct deleted file mode 100644 index 9142bb40c2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idProduct +++ /dev/null @@ -1 +0,0 @@ -2008 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idVendor b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idVendor deleted file mode 100644 index 6ffae177b7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/idVendor +++ /dev/null @@ -1 +0,0 @@ -0557 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/power/state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/power/state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/speed b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/speed deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/speed +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver deleted file mode 120000 index 9ff2c81f52..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb-serial/drivers/PL-2303 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/power/state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/power/state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/subsystem deleted file mode 120000 index dd0c04b01d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/3-1/ttyUSB0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb-serial \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bMaxPower b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bMaxPower deleted file mode 100644 index ca2ea0dab5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bMaxPower +++ /dev/null @@ -1 +0,0 @@ - 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bcdDevice b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bcdDevice deleted file mode 100644 index ff5c1613f9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0206 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bmAttributes b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bmAttributes deleted file mode 100644 index 425151f3a4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -40 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/driver b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/driver deleted file mode 120000 index 0b3eba3d91..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idProduct b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idProduct deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idProduct +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idVendor b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idVendor deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/idVendor +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/manufacturer b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/manufacturer deleted file mode 100644 index 7ea94cede0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Linux 2.6.0-test9-bk16 ohci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/power/state b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/power/state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/power/state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/product b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/product deleted file mode 100644 index a1c773affb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/product +++ /dev/null @@ -1 +0,0 @@ -OHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/serial b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/serial deleted file mode 100644 index 1b7fda31c4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/serial +++ /dev/null @@ -1 +0,0 @@ -0000:00:09.0 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/speed b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/speed deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/speed +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/subsystem b/test/sys/devices/pci0000:00/0000:00:09.0/usb3/subsystem deleted file mode 120000 index 77682faf80..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/usb3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:09.0/vendor b/test/sys/devices/pci0000:00/0000:00:09.0/vendor deleted file mode 100644 index fcfa779f23..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:09.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x1033 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1b.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/class b/test/sys/devices/pci0000:00/0000:00:1b.0/class new file mode 100644 index 0000000000..3c2627acb0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/class @@ -0,0 +1 @@ +0x040300 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/config b/test/sys/devices/pci0000:00/0000:00:1b.0/config new file mode 100644 index 0000000000..1eef27b506 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1b.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/device b/test/sys/devices/pci0000:00/0000:00:1b.0/device new file mode 100644 index 0000000000..9025bfeec0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/device @@ -0,0 +1 @@ +0x27d8 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/driver b/test/sys/devices/pci0000:00/0000:00:1b.0/driver new file mode 120000 index 0000000000..5e8e0d3965 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/HDA Intel \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/enable b/test/sys/devices/pci0000:00/0000:00:1b.0/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1b.0/firmware_node new file mode 120000 index 0000000000..eadb0cff46 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:25 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/irq b/test/sys/devices/pci0000:00/0000:00:1b.0/irq new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/irq @@ -0,0 +1 @@ +17 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/modalias b/test/sys/devices/pci0000:00/0000:00:1b.0/modalias new file mode 100644 index 0000000000..91d145cd1e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/modalias @@ -0,0 +1 @@ +pci:v00008086d000027D8sv000017AAsd00002010bc04sc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1b.0/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/resource b/test/sys/devices/pci0000:00/0000:00:1b.0/resource new file mode 100644 index 0000000000..a9b7ff4d10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/resource @@ -0,0 +1,7 @@ +0x00000000ee400000 0x00000000ee403fff 0x0000000000020204 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/resource0 b/test/sys/devices/pci0000:00/0000:00:1b.0/resource0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/dev new file mode 100644 index 0000000000..78881128c5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/dev @@ -0,0 +1 @@ +14:12 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/device new file mode 120000 index 0000000000..ea6bff6f6f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/device @@ -0,0 +1 @@ +../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/subsystem new file mode 120000 index 0000000000..1fc6fc816b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/subsystem @@ -0,0 +1 @@ +../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/uevent new file mode 100644 index 0000000000..89e2bf79bd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/uevent @@ -0,0 +1,2 @@ +MAJOR=14 +MINOR=12 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/dev new file mode 100644 index 0000000000..17abe70697 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/dev @@ -0,0 +1 @@ +14:4 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/device new file mode 120000 index 0000000000..ea6bff6f6f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/device @@ -0,0 +1 @@ +../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/subsystem new file mode 120000 index 0000000000..1fc6fc816b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/subsystem @@ -0,0 +1 @@ +../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/uevent new file mode 100644 index 0000000000..23e5010b03 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/uevent @@ -0,0 +1,2 @@ +MAJOR=14 +MINOR=4 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/dev new file mode 100644 index 0000000000..0113082e4c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/dev @@ -0,0 +1 @@ +116:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/device new file mode 120000 index 0000000000..ea6bff6f6f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/device @@ -0,0 +1 @@ +../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/subsystem new file mode 120000 index 0000000000..1fc6fc816b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/subsystem @@ -0,0 +1 @@ +../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/uevent new file mode 100644 index 0000000000..d2f63999d2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/uevent @@ -0,0 +1,2 @@ +MAJOR=116 +MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/device new file mode 120000 index 0000000000..1cef4e5894 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/device @@ -0,0 +1 @@ +../../../0000:00:1b.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/dev new file mode 100644 index 0000000000..c2063c2f70 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/dev @@ -0,0 +1 @@ +14:3 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/device new file mode 120000 index 0000000000..ea6bff6f6f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/device @@ -0,0 +1 @@ +../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/subsystem new file mode 120000 index 0000000000..1fc6fc816b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/subsystem @@ -0,0 +1 @@ +../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent new file mode 100644 index 0000000000..34ffea3b16 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent @@ -0,0 +1,2 @@ +MAJOR=14 +MINOR=3 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/dev new file mode 100644 index 0000000000..32f50eb60a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/dev @@ -0,0 +1 @@ +14:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/device new file mode 120000 index 0000000000..ea6bff6f6f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/device @@ -0,0 +1 @@ +../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/subsystem new file mode 120000 index 0000000000..1fc6fc816b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/subsystem @@ -0,0 +1 @@ +../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/uevent new file mode 100644 index 0000000000..1d6618a675 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/uevent @@ -0,0 +1,2 @@ +MAJOR=14 +MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/dev new file mode 100644 index 0000000000..81ad956b04 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/dev @@ -0,0 +1 @@ +116:24 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/device new file mode 120000 index 0000000000..ea6bff6f6f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/device @@ -0,0 +1 @@ +../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class new file mode 100644 index 0000000000..6ab389274c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class @@ -0,0 +1 @@ +generic diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/subsystem new file mode 120000 index 0000000000..1fc6fc816b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/subsystem @@ -0,0 +1 @@ +../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/uevent new file mode 100644 index 0000000000..2185936b2a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/uevent @@ -0,0 +1,2 @@ +MAJOR=116 +MINOR=24 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/dev new file mode 100644 index 0000000000..ecbfb9c12e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/dev @@ -0,0 +1 @@ +116:16 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/device new file mode 120000 index 0000000000..ea6bff6f6f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/device @@ -0,0 +1 @@ +../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class new file mode 100644 index 0000000000..6ab389274c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class @@ -0,0 +1 @@ +generic diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/subsystem new file mode 120000 index 0000000000..1fc6fc816b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/subsystem @@ -0,0 +1 @@ +../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/uevent new file mode 100644 index 0000000000..5dcc942c02 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/uevent @@ -0,0 +1,2 @@ +MAJOR=116 +MINOR=16 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/dev new file mode 100644 index 0000000000..546caa3cf9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/dev @@ -0,0 +1 @@ +116:17 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/device new file mode 120000 index 0000000000..ea6bff6f6f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/device @@ -0,0 +1 @@ +../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class new file mode 100644 index 0000000000..6ab389274c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class @@ -0,0 +1 @@ +generic diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/subsystem new file mode 120000 index 0000000000..1fc6fc816b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/subsystem @@ -0,0 +1 @@ +../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/uevent new file mode 100644 index 0000000000..54775d251c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/uevent @@ -0,0 +1,2 @@ +MAJOR=116 +MINOR=17 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/subsystem new file mode 120000 index 0000000000..5159c1f494 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/subsystem @@ -0,0 +1 @@ +../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_device new file mode 100644 index 0000000000..50e277c1bf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_device @@ -0,0 +1 @@ +0x2010 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/uevent new file mode 100644 index 0000000000..4c0291ed5e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/uevent @@ -0,0 +1,6 @@ +DRIVER=HDA Intel +PCI_CLASS=40300 +PCI_ID=8086:27D8 +PCI_SUBSYS_ID=17AA:2010 +PCI_SLOT_NAME=0000:00:1b.0 +MODALIAS=pci:v00008086d000027D8sv000017AAsd00002010bc04sc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/vendor b/test/sys/devices/pci0000:00/0000:00:1b.0/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1b.0/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/class b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/class new file mode 100644 index 0000000000..2f9c1dada8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/class @@ -0,0 +1 @@ +0x020000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/config b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/config new file mode 100644 index 0000000000..171b3f9cf5 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/device b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/device new file mode 100644 index 0000000000..67c31bd657 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/device @@ -0,0 +1 @@ +0x109a diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/driver b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/driver new file mode 120000 index 0000000000..2b53f77214 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/driver @@ -0,0 +1 @@ +../../../../bus/pci/drivers/e1000e \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/enable b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/irq b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/irq new file mode 100644 index 0000000000..f573e999ac --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/irq @@ -0,0 +1 @@ +505 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/modalias new file mode 100644 index 0000000000..30a5e00f88 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/modalias @@ -0,0 +1 @@ +pci:v00008086d0000109Asv000017AAsd00002001bc02sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/addr_len b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/addr_len new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/addr_len @@ -0,0 +1 @@ +6 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/address b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/address new file mode 100644 index 0000000000..1f26c2166a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/address @@ -0,0 +1 @@ +00:16:41:e2:8d:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/broadcast b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/broadcast new file mode 100644 index 0000000000..d516b03245 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/broadcast @@ -0,0 +1 @@ +ff:ff:ff:ff:ff:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/carrier b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/carrier new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/carrier @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dev_id b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dev_id new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dev_id @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/device b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/device new file mode 120000 index 0000000000..ffee7993af --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/device @@ -0,0 +1 @@ +../../../0000:02:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dormant b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dormant new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dormant @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/features b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/features new file mode 100644 index 0000000000..be03677532 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/features @@ -0,0 +1 @@ +0x111ba9 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/flags b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/flags new file mode 100644 index 0000000000..8198c040f7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/flags @@ -0,0 +1 @@ +0x1003 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/ifindex b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/ifindex new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/ifindex @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/iflink b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/iflink new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/iflink @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/link_mode b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/link_mode new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/link_mode @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/mtu b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/mtu new file mode 100644 index 0000000000..3d86ec6498 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/mtu @@ -0,0 +1 @@ +1500 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/operstate b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/operstate new file mode 100644 index 0000000000..eb0e90439e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/operstate @@ -0,0 +1 @@ +down diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/collisions b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/collisions new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/collisions @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/multicast b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/multicast new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/multicast @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_bytes new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_bytes @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_compressed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_compressed @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_crc_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_crc_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_crc_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_dropped new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_dropped @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_fifo_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_fifo_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_frame_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_frame_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_frame_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_length_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_length_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_length_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_missed_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_missed_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_missed_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_over_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_over_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_over_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_packets b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_packets new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_packets @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_aborted_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_aborted_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_aborted_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_bytes new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_bytes @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_carrier_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_carrier_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_carrier_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_compressed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_compressed @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_dropped new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_dropped @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_fifo_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_fifo_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_heartbeat_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_heartbeat_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_heartbeat_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_packets b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_packets new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_packets @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_window_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_window_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_window_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/subsystem new file mode 120000 index 0000000000..b9058136e4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/subsystem @@ -0,0 +1 @@ +../../../../../../class/net \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/tx_queue_len b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/tx_queue_len new file mode 100644 index 0000000000..83b33d238d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/tx_queue_len @@ -0,0 +1 @@ +1000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/type b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/type new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/type @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/uevent new file mode 100644 index 0000000000..f819639c91 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/uevent @@ -0,0 +1,2 @@ +INTERFACE=eth0 +IFINDEX=2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource new file mode 100644 index 0000000000..1ae54bc336 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource @@ -0,0 +1,7 @@ +0x00000000ee000000 0x00000000ee01ffff 0x0000000000020200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000003000 0x000000000000301f 0x0000000000020101 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource0 b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource2 b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem new file mode 120000 index 0000000000..d6210992bb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem @@ -0,0 +1 @@ +../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_device new file mode 100644 index 0000000000..2c5221be24 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_device @@ -0,0 +1 @@ +0x2001 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/uevent new file mode 100644 index 0000000000..7698cc6193 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/uevent @@ -0,0 +1,6 @@ +DRIVER=e1000e +PCI_CLASS=20000 +PCI_ID=8086:109A +PCI_SUBSYS_ID=17AA:2001 +PCI_SLOT_NAME=0000:02:00.0 +MODALIAS=pci:v00008086d0000109Asv000017AAsd00002001bc02sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/class b/test/sys/devices/pci0000:00/0000:00:1c.0/class new file mode 100644 index 0000000000..8b40e6a7b7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/class @@ -0,0 +1 @@ +0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/config b/test/sys/devices/pci0000:00/0000:00:1c.0/config new file mode 100644 index 0000000000..b0221f2a2f Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/device b/test/sys/devices/pci0000:00/0000:00:1c.0/device new file mode 100644 index 0000000000..4f6c1fb911 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/device @@ -0,0 +1 @@ +0x27d0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/driver b/test/sys/devices/pci0000:00/0000:00:1c.0/driver new file mode 120000 index 0000000000..b30b691e0c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/enable b/test/sys/devices/pci0000:00/0000:00:1c.0/enable new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/enable @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1c.0/firmware_node new file mode 120000 index 0000000000..8542a81a99 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:0b \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/irq b/test/sys/devices/pci0000:00/0000:00:1c.0/irq new file mode 100644 index 0000000000..2bc4cd64b8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/irq @@ -0,0 +1 @@ +510 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/modalias b/test/sys/devices/pci0000:00/0000:00:1c.0/modalias new file mode 100644 index 0000000000..4433f5b340 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/modalias @@ -0,0 +1 @@ +pci:v00008086d000027D0sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/cpuaffinity new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/cpuaffinity @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/device b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/device new file mode 120000 index 0000000000..3148dbbb01 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/device @@ -0,0 +1 @@ +../../../0000:00:1c.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/subsystem new file mode 120000 index 0000000000..1d26d30581 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/subsystem @@ -0,0 +1 @@ +../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/resource b/test/sys/devices/pci0000:00/0000:00:1c.0/resource new file mode 100644 index 0000000000..60c3557063 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/resource @@ -0,0 +1,12 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000003000 0x0000000000003fff 0x0000000000000100 +0x00000000ee000000 0x00000000ee0fffff 0x0000000000000200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_device new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_device @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_vendor new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_vendor @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/uevent new file mode 100644 index 0000000000..0b6e3b5cc2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/uevent @@ -0,0 +1,6 @@ +DRIVER=pcieport-driver +PCI_CLASS=60400 +PCI_ID=8086:27D0 +PCI_SUBSYS_ID=0000:0000 +PCI_SLOT_NAME=0000:00:1c.0 +MODALIAS=pci:v00008086d000027D0sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/vendor b/test/sys/devices/pci0000:00/0000:00:1c.0/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.0/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/antenna b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/antenna new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/antenna @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/channels b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/channels new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/class b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/class new file mode 100644 index 0000000000..52e8d0c98d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/class @@ -0,0 +1 @@ +0x028000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/config b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/config new file mode 100644 index 0000000000..27de3fdc36 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/device new file mode 100644 index 0000000000..fc9475debf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/device @@ -0,0 +1 @@ +0x4227 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/driver b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/driver new file mode 120000 index 0000000000..c01b848be9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/driver @@ -0,0 +1 @@ +../../../../bus/pci/drivers/iwl3945 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/enable b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/filter_flags b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/filter_flags new file mode 100644 index 0000000000..4d3011b503 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/filter_flags @@ -0,0 +1 @@ +0x0024 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/flags b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/flags new file mode 100644 index 0000000000..47c2bd8f43 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/flags @@ -0,0 +1 @@ +0x8015 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/device new file mode 120000 index 0000000000..a9ab757999 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/device @@ -0,0 +1 @@ +../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/macaddress b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/macaddress new file mode 100644 index 0000000000..c3b402d820 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/macaddress @@ -0,0 +1 @@ +00:19:d2:75:ae:d1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/subsystem new file mode 120000 index 0000000000..a124df1449 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/subsystem @@ -0,0 +1 @@ +../../../../../../class/ieee80211 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/irq b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/irq new file mode 100644 index 0000000000..3091e8eea2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/irq @@ -0,0 +1 @@ +504 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/brightness b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/brightness differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/device new file mode 120000 index 0000000000..a9ab757999 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/device @@ -0,0 +1 @@ +../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/subsystem new file mode 120000 index 0000000000..eaca89c4c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/subsystem @@ -0,0 +1 @@ +../../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/trigger b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/trigger new file mode 100644 index 0000000000..347fc33e63 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/trigger @@ -0,0 +1 @@ +none AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 [phy0rx] phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/brightness b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/brightness differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/device new file mode 120000 index 0000000000..a9ab757999 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/device @@ -0,0 +1 @@ +../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/subsystem new file mode 120000 index 0000000000..eaca89c4c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/subsystem @@ -0,0 +1 @@ +../../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/trigger b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/trigger new file mode 100644 index 0000000000..36ae426791 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/trigger @@ -0,0 +1 @@ +none AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx [phy0tx] phy0assoc phy0radio diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/brightness b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/brightness new file mode 100644 index 0000000000..8364fdecfc Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/brightness differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/device new file mode 120000 index 0000000000..a9ab757999 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/device @@ -0,0 +1 @@ +../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/subsystem new file mode 120000 index 0000000000..eaca89c4c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/subsystem @@ -0,0 +1 @@ +../../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/trigger b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/trigger new file mode 100644 index 0000000000..c1d0a0ed64 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/trigger @@ -0,0 +1 @@ +none AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx [phy0assoc] phy0radio diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/brightness b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/brightness new file mode 100644 index 0000000000..8364fdecfc Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/brightness differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/device new file mode 120000 index 0000000000..a9ab757999 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/device @@ -0,0 +1 @@ +../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/subsystem new file mode 120000 index 0000000000..eaca89c4c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/subsystem @@ -0,0 +1 @@ +../../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/trigger b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/trigger new file mode 100644 index 0000000000..53846e2627 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/trigger @@ -0,0 +1 @@ +none AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc [phy0radio] diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/measurement b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/measurement new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/modalias new file mode 100644 index 0000000000..6a633532bf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/modalias @@ -0,0 +1 @@ +pci:v00008086d00004227sv00008086sd00001011bc02sc80i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len @@ -0,0 +1 @@ +6 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/address b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/address new file mode 100644 index 0000000000..20ffb99c00 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/address @@ -0,0 +1 @@ +00:19:d2:75:ae:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast new file mode 100644 index 0000000000..d516b03245 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast @@ -0,0 +1 @@ +ff:ff:ff:ff:ff:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/carrier b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/carrier new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/carrier @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/device new file mode 120000 index 0000000000..a9ab757999 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/device @@ -0,0 +1 @@ +../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dormant b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dormant new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dormant @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/features b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/features new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/features @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/flags b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/flags new file mode 100644 index 0000000000..8198c040f7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/flags @@ -0,0 +1 @@ +0x1003 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/iflink b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/iflink new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/iflink @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/mtu b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/mtu new file mode 100644 index 0000000000..3d86ec6498 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/mtu @@ -0,0 +1 @@ +1500 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/operstate b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/operstate new file mode 100644 index 0000000000..e31ee94e17 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/operstate @@ -0,0 +1 @@ +up diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 new file mode 120000 index 0000000000..4796453191 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 @@ -0,0 +1 @@ +../../ieee80211/phy0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/collisions b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/collisions new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/collisions @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/multicast b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/multicast new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/multicast @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes new file mode 100644 index 0000000000..8d99027062 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes @@ -0,0 +1 @@ +62672 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_compressed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_compressed @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_crc_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_crc_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_crc_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_dropped new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_dropped @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_fifo_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_fifo_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_frame_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_frame_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_frame_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_length_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_length_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_length_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_missed_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_missed_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_missed_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_over_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_over_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_over_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets new file mode 100644 index 0000000000..6529ff889b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets @@ -0,0 +1 @@ +98 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_aborted_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_aborted_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_aborted_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes new file mode 100644 index 0000000000..fa120e0ffe --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes @@ -0,0 +1 @@ +18848 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_carrier_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_carrier_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_carrier_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_compressed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_compressed @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_dropped new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_dropped @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_fifo_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_fifo_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_heartbeat_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_heartbeat_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_heartbeat_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets new file mode 100644 index 0000000000..fba7ed526e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets @@ -0,0 +1 @@ +143 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_window_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_window_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_window_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem new file mode 120000 index 0000000000..b9058136e4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem @@ -0,0 +1 @@ +../../../../../../class/net \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/tx_queue_len b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/tx_queue_len new file mode 100644 index 0000000000..83b33d238d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/tx_queue_len @@ -0,0 +1 @@ +1000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/type b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/type new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/type @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/uevent new file mode 100644 index 0000000000..3e19b5de47 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/uevent @@ -0,0 +1,2 @@ +INTERFACE=wlan0 +IFINDEX=4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/beacon b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/beacon new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/beacon @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/crypt b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/crypt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/crypt @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/fragment b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/fragment new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/fragment @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level new file mode 100644 index 0000000000..c4597e5375 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level @@ -0,0 +1 @@ +173 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link new file mode 100644 index 0000000000..920a139664 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link @@ -0,0 +1 @@ +43 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/misc b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/misc new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/misc @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise new file mode 100644 index 0000000000..dc37bbdb81 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise @@ -0,0 +1 @@ +184 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/nwid b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/nwid new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/nwid @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/retries b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/retries new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/retries @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/status b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/status new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/status @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/addr_len b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/addr_len new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/addr_len @@ -0,0 +1 @@ +6 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/address b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/address new file mode 100644 index 0000000000..20ffb99c00 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/address @@ -0,0 +1 @@ +00:19:d2:75:ae:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/broadcast b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/broadcast new file mode 100644 index 0000000000..d516b03245 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/broadcast @@ -0,0 +1 @@ +ff:ff:ff:ff:ff:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/device new file mode 120000 index 0000000000..a9ab757999 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/device @@ -0,0 +1 @@ +../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/features b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/features new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/features @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/flags b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/flags new file mode 100644 index 0000000000..8198c040f7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/flags @@ -0,0 +1 @@ +0x1003 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/link_mode b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/link_mode new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/link_mode @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu new file mode 100644 index 0000000000..3d86ec6498 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu @@ -0,0 +1 @@ +1500 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/operstate b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/operstate new file mode 100644 index 0000000000..3546645658 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/operstate @@ -0,0 +1 @@ +unknown diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/phy80211 b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/phy80211 new file mode 120000 index 0000000000..4796453191 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/phy80211 @@ -0,0 +1 @@ +../../ieee80211/phy0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/collisions b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/collisions new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/collisions @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/multicast b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/multicast new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/multicast @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_bytes new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_bytes @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_compressed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_compressed @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_crc_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_crc_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_crc_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_dropped new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_dropped @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_fifo_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_fifo_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_frame_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_frame_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_frame_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_length_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_length_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_length_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_missed_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_missed_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_missed_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_over_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_over_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_over_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_packets new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_packets @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_aborted_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_aborted_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_aborted_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_bytes new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_bytes @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_carrier_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_carrier_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_carrier_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_compressed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_compressed @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_dropped new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_dropped @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_fifo_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_fifo_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_heartbeat_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_heartbeat_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_heartbeat_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_packets new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_packets @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_window_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_window_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_window_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/subsystem new file mode 120000 index 0000000000..b9058136e4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/subsystem @@ -0,0 +1 @@ +../../../../../../class/net \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/tx_queue_len b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/tx_queue_len new file mode 100644 index 0000000000..83b33d238d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/tx_queue_len @@ -0,0 +1 @@ +1000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/type b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/type new file mode 100644 index 0000000000..8bce69f505 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/type @@ -0,0 +1 @@ +801 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent new file mode 100644 index 0000000000..23a068bf7b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent @@ -0,0 +1,2 @@ +INTERFACE=wmaster0 +IFINDEX=3 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power_level b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power_level new file mode 100644 index 0000000000..067791e80f Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power_level differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource new file mode 100644 index 0000000000..9f377a76e9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource @@ -0,0 +1,7 @@ +0x00000000edf00000 0x00000000edf00fff 0x0000000000020200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource0 b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/retry_rate b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/retry_rate new file mode 100644 index 0000000000..56a6051ca2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/retry_rate @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window new file mode 100644 index 0000000000..c0b67c42b3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window @@ -0,0 +1,15 @@ + 54Mbs: 00000000000000000000000000000000000000000000000000000000000001 1195ms + 48Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 36Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 24Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 18Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 12Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 11Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 9Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 6Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 5Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 2Mbs: 00000000000000000000000000000000000000000000000000000000000000 + 1Mbs: 00000000000000000000000000000000000000000000000000000000000000 + +Average rate is 54.00Mbs over last 1195ms +100% success (1 good packets over 1 tries) diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics new file mode 100644 index 0000000000..ba932ad5b6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics @@ -0,0 +1,15 @@ +02 00 01 00 e7 07 00 00 25 04 00 00 da 02 00 00 ........%....... +a6 00 00 00 00 00 00 00 00 00 00 00 aa 00 00 00 ................ +c2 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +00 00 00 00 00 00 00 00 26 00 00 00 00 00 00 00 ........&....... +a7 11 00 00 fe 0d 00 00 30 08 00 00 92 00 00 00 ........0....... +00 00 00 00 00 00 00 00 3c 05 00 00 a9 03 00 00 ........<....... +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +00 00 00 00 3d 00 00 00 00 00 00 00 00 00 00 00 ....=........... +00 00 00 00 eb 00 00 00 82 01 00 00 00 00 00 00 ................ +95 01 00 00 06 00 00 00 00 00 00 00 00 00 00 00 ................ +16 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ +00 00 00 00 6a ff ff ff 00 00 00 00 00 00 00 00 ....j........... +00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +00 00 00 00 01 00 00 00 1d 8c 70 00 44 a1 a8 05 ..........p.D... +15 00 00 00 31 00 00 00 16 02 00 00 8c 00 00 00 ....1........... diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/status b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/status new file mode 100644 index 0000000000..9aa3c58dd0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/status @@ -0,0 +1 @@ +0x000002e4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem new file mode 120000 index 0000000000..d6210992bb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem @@ -0,0 +1 @@ +../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_device new file mode 100644 index 0000000000..027a57369a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_device @@ -0,0 +1 @@ +0x1011 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature new file mode 100644 index 0000000000..67ac0090b3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature @@ -0,0 +1 @@ +-150 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/uevent new file mode 100644 index 0000000000..3b5ab70143 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/uevent @@ -0,0 +1,6 @@ +DRIVER=iwl3945 +PCI_CLASS=28000 +PCI_ID=8086:4227 +PCI_SUBSYS_ID=8086:1011 +PCI_SLOT_NAME=0000:03:00.0 +MODALIAS=pci:v00008086d00004227sv00008086sd00001011bc02sc80i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.1/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/class b/test/sys/devices/pci0000:00/0000:00:1c.1/class new file mode 100644 index 0000000000..8b40e6a7b7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/class @@ -0,0 +1 @@ +0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/config b/test/sys/devices/pci0000:00/0000:00:1c.1/config new file mode 100644 index 0000000000..c7ccc82f6c Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.1/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/device b/test/sys/devices/pci0000:00/0000:00:1c.1/device new file mode 100644 index 0000000000..31a89f4aac --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/device @@ -0,0 +1 @@ +0x27d2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/driver b/test/sys/devices/pci0000:00/0000:00:1c.1/driver new file mode 120000 index 0000000000..b30b691e0c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/enable b/test/sys/devices/pci0000:00/0000:00:1c.1/enable new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/enable @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/firmware_node b/test/sys/devices/pci0000:00/0000:00:1c.1/firmware_node new file mode 120000 index 0000000000..2166c3933d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:0c \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/irq b/test/sys/devices/pci0000:00/0000:00:1c.1/irq new file mode 100644 index 0000000000..77afe238f2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/irq @@ -0,0 +1 @@ +509 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/modalias b/test/sys/devices/pci0000:00/0000:00:1c.1/modalias new file mode 100644 index 0000000000..709bec5825 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/modalias @@ -0,0 +1 @@ +pci:v00008086d000027D2sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/cpuaffinity new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/cpuaffinity @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/device b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/device new file mode 120000 index 0000000000..63c77b404e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/device @@ -0,0 +1 @@ +../../../0000:00:1c.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/subsystem new file mode 120000 index 0000000000..1d26d30581 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/subsystem @@ -0,0 +1 @@ +../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/resource b/test/sys/devices/pci0000:00/0000:00:1c.1/resource new file mode 100644 index 0000000000..da3f0b15b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/resource @@ -0,0 +1,12 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000004000 0x0000000000005fff 0x0000000000000100 +0x00000000ec000000 0x00000000edffffff 0x0000000000000200 +0x00000000e4000000 0x00000000e40fffff 0x0000000000001201 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_device new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_device @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_vendor new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_vendor @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/uevent new file mode 100644 index 0000000000..1146b4efcc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/uevent @@ -0,0 +1,6 @@ +DRIVER=pcieport-driver +PCI_CLASS=60400 +PCI_ID=8086:27D2 +PCI_SUBSYS_ID=0000:0000 +PCI_SLOT_NAME=0000:00:1c.1 +MODALIAS=pci:v00008086d000027D2sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/vendor b/test/sys/devices/pci0000:00/0000:00:1c.1/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.2/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/class b/test/sys/devices/pci0000:00/0000:00:1c.2/class new file mode 100644 index 0000000000..8b40e6a7b7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/class @@ -0,0 +1 @@ +0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/config b/test/sys/devices/pci0000:00/0000:00:1c.2/config new file mode 100644 index 0000000000..3ef4d02b0e Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.2/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/device b/test/sys/devices/pci0000:00/0000:00:1c.2/device new file mode 100644 index 0000000000..05e3bd983c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/device @@ -0,0 +1 @@ +0x27d4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/driver b/test/sys/devices/pci0000:00/0000:00:1c.2/driver new file mode 120000 index 0000000000..b30b691e0c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/enable b/test/sys/devices/pci0000:00/0000:00:1c.2/enable new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/enable @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/firmware_node b/test/sys/devices/pci0000:00/0000:00:1c.2/firmware_node new file mode 120000 index 0000000000..c20611ecef --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:0d \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/irq b/test/sys/devices/pci0000:00/0000:00:1c.2/irq new file mode 100644 index 0000000000..1eccde1106 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/irq @@ -0,0 +1 @@ +508 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/modalias b/test/sys/devices/pci0000:00/0000:00:1c.2/modalias new file mode 100644 index 0000000000..ce84663a01 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/modalias @@ -0,0 +1 @@ +pci:v00008086d000027D4sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/cpuaffinity new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/cpuaffinity @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/device b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/device new file mode 120000 index 0000000000..4009572037 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/device @@ -0,0 +1 @@ +../../../0000:00:1c.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/subsystem new file mode 120000 index 0000000000..1d26d30581 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/subsystem @@ -0,0 +1 @@ +../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/resource b/test/sys/devices/pci0000:00/0000:00:1c.2/resource new file mode 100644 index 0000000000..e7480e66c9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/resource @@ -0,0 +1,12 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000006000 0x0000000000007fff 0x0000000000000100 +0x00000000e8000000 0x00000000e9ffffff 0x0000000000000200 +0x00000000e4100000 0x00000000e41fffff 0x0000000000001201 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_device new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_device @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_vendor new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_vendor @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/uevent new file mode 100644 index 0000000000..3e9124e423 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/uevent @@ -0,0 +1,6 @@ +DRIVER=pcieport-driver +PCI_CLASS=60400 +PCI_ID=8086:27D4 +PCI_SUBSYS_ID=0000:0000 +PCI_SLOT_NAME=0000:00:1c.2 +MODALIAS=pci:v00008086d000027D4sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/vendor b/test/sys/devices/pci0000:00/0000:00:1c.2/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.2/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/subsystem new file mode 120000 index 0000000000..60163d477b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/subsystem @@ -0,0 +1 @@ +../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.3/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/class b/test/sys/devices/pci0000:00/0000:00:1c.3/class new file mode 100644 index 0000000000..8b40e6a7b7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/class @@ -0,0 +1 @@ +0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/config b/test/sys/devices/pci0000:00/0000:00:1c.3/config new file mode 100644 index 0000000000..21a16d3c02 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1c.3/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/device b/test/sys/devices/pci0000:00/0000:00:1c.3/device new file mode 100644 index 0000000000..77699e3094 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/device @@ -0,0 +1 @@ +0x27d6 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/driver b/test/sys/devices/pci0000:00/0000:00:1c.3/driver new file mode 120000 index 0000000000..b30b691e0c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/enable b/test/sys/devices/pci0000:00/0000:00:1c.3/enable new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/enable @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/firmware_node b/test/sys/devices/pci0000:00/0000:00:1c.3/firmware_node new file mode 120000 index 0000000000..5252d6b90f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:0f \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/irq b/test/sys/devices/pci0000:00/0000:00:1c.3/irq new file mode 100644 index 0000000000..055b6671a5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/irq @@ -0,0 +1 @@ +507 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/modalias b/test/sys/devices/pci0000:00/0000:00:1c.3/modalias new file mode 100644 index 0000000000..e0f4ef6c00 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/modalias @@ -0,0 +1 @@ +pci:v00008086d000027D6sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/cpuaffinity new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/cpuaffinity @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device new file mode 120000 index 0000000000..ef57e893c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device @@ -0,0 +1 @@ +../../../0000:00:1c.3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/subsystem new file mode 120000 index 0000000000..1d26d30581 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/subsystem @@ -0,0 +1 @@ +../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/resource b/test/sys/devices/pci0000:00/0000:00:1c.3/resource new file mode 100644 index 0000000000..cc54a66782 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/resource @@ -0,0 +1,12 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000008000 0x0000000000009fff 0x0000000000000100 +0x00000000ea000000 0x00000000ebffffff 0x0000000000000200 +0x00000000e4200000 0x00000000e42fffff 0x0000000000001201 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_device new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_device @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_vendor new file mode 100644 index 0000000000..aa01954cc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_vendor @@ -0,0 +1 @@ +0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/uevent new file mode 100644 index 0000000000..1478a5df5e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/uevent @@ -0,0 +1,6 @@ +DRIVER=pcieport-driver +PCI_CLASS=60400 +PCI_ID=8086:27D6 +PCI_SUBSYS_ID=0000:0000 +PCI_SLOT_NAME=0000:00:1c.3 +MODALIAS=pci:v00008086d000027D6sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/vendor b/test/sys/devices/pci0000:00/0000:00:1c.3/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1c.3/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/class b/test/sys/devices/pci0000:00/0000:00:1d.0/class new file mode 100644 index 0000000000..233dcce516 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/class @@ -0,0 +1 @@ +0x0c0300 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/config b/test/sys/devices/pci0000:00/0000:00:1d.0/config new file mode 100644 index 0000000000..0b41a78483 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/device b/test/sys/devices/pci0000:00/0000:00:1d.0/device new file mode 100644 index 0000000000..80d993702f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/device @@ -0,0 +1 @@ +0x27c8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.0/driver new file mode 120000 index 0000000000..ed69e37601 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/enable b/test/sys/devices/pci0000:00/0000:00:1d.0/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.0/firmware_node new file mode 120000 index 0000000000..50216bb7f4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:19 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/irq b/test/sys/devices/pci0000:00/0000:00:1d.0/irq new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/irq @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.0/modalias new file mode 100644 index 0000000000..30a46dde13 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/modalias @@ -0,0 +1 @@ +pci:v00008086d000027C8sv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.0/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/pools b/test/sys/devices/pci0000:00/0000:00:1d.0/pools new file mode 100644 index 0000000000..6f8c27bbc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/pools @@ -0,0 +1,7 @@ +poolinfo - 0.1 +uhci_qh 11 32 128 1 +uhci_td 1 64 64 1 +buffer-2048 0 0 2048 0 +buffer-512 0 0 512 0 +buffer-128 0 0 128 0 +buffer-32 1 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/resource b/test/sys/devices/pci0000:00/0000:00:1d.0/resource new file mode 100644 index 0000000000..30e43da8a7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/resource @@ -0,0 +1,7 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000001800 0x000000000000181f 0x0000000000020101 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/resource4 b/test/sys/devices/pci0000:00/0000:00:1d.0/resource4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_device new file mode 100644 index 0000000000..dcce13f2d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_device @@ -0,0 +1 @@ +0x200a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/uevent new file mode 100644 index 0000000000..0a55a0c851 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/uevent @@ -0,0 +1,6 @@ +DRIVER=uhci_hcd +PCI_CLASS=C0300 +PCI_ID=8086:27C8 +PCI_SUBSYS_ID=17AA:200A +PCI_SLOT_NAME=0000:00:1d.0 +MODALIAS=pci:v00008086d000027C8sv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver new file mode 120000 index 0000000000..5cf493442c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 new file mode 120000 index 0000000000..1c42b874b8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev1.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias new file mode 100644 index 0000000000..a27a9fdc71 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias @@ -0,0 +1 @@ +usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent new file mode 100644 index 0000000000..ffd136d9e1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent @@ -0,0 +1,6 @@ +DEVTYPE=usb_interface +DRIVER=hub +PRODUCT=1d6b/1/206 +TYPE=9/0/0 +INTERFACE=9/0/0 +MODALIAS=usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev new file mode 100644 index 0000000000..eeb4a2eb64 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev @@ -0,0 +1 @@ +252:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/device new file mode 120000 index 0000000000..f276392cf7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/device @@ -0,0 +1 @@ +../../../1-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval new file mode 100644 index 0000000000..fcb4fa4875 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval @@ -0,0 +1 @@ +255ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent new file mode 100644 index 0000000000..b1c40b2b20 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/wMaxPacketSize new file mode 100644 index 0000000000..5fca1fda0b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized_default new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized_default @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower new file mode 100644 index 0000000000..ca2ea0dab5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower @@ -0,0 +1 @@ + 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice new file mode 100644 index 0000000000..ff5c1613f9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice @@ -0,0 +1 @@ +0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bmAttributes new file mode 100644 index 0000000000..4fe4106b50 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bmAttributes @@ -0,0 +1 @@ +e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/busnum b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/busnum new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/busnum @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/configuration b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/configuration new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/descriptors new file mode 100644 index 0000000000..bc75b5136f Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev new file mode 100644 index 0000000000..1641758778 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev @@ -0,0 +1 @@ +189:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/devnum b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/devnum new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/devnum @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/driver b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/driver new file mode 120000 index 0000000000..0b3eba3d91 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/driver @@ -0,0 +1 @@ +../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 new file mode 120000 index 0000000000..7053b52021 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev1.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idProduct new file mode 100644 index 0000000000..635047563b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idProduct @@ -0,0 +1 @@ +0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idVendor new file mode 100644 index 0000000000..d247637ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idVendor @@ -0,0 +1 @@ +1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/manufacturer new file mode 100644 index 0000000000..4d6c1e12b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/manufacturer @@ -0,0 +1 @@ +Linux 2.6.27-rc7-00106-g6ef190c-dirty uhci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/maxchild new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/maxchild @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/active_duration new file mode 100644 index 0000000000..4aabc755bc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/active_duration @@ -0,0 +1 @@ +2532 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration new file mode 100644 index 0000000000..0d748f08e7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration @@ -0,0 +1 @@ +113810 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/level b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/level new file mode 100644 index 0000000000..865faf10cb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/level @@ -0,0 +1 @@ +auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/wakeup new file mode 100644 index 0000000000..86981e69f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/wakeup @@ -0,0 +1 @@ +enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/product b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/product new file mode 100644 index 0000000000..9677780a85 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/product @@ -0,0 +1 @@ +UHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/quirks b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/serial b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/serial new file mode 100644 index 0000000000..3fed6956d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/serial @@ -0,0 +1 @@ +0000:00:1d.0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/speed b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/speed new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/speed @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/subsystem new file mode 120000 index 0000000000..77682faf80 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/subsystem @@ -0,0 +1 @@ +../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/uevent new file mode 100644 index 0000000000..08586f0f4d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=0 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=1d6b/1/206 +TYPE=9/0/0 +BUSNUM=001 +DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/urbnum new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/urbnum @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/dev new file mode 100644 index 0000000000..461fbe7bb8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/dev @@ -0,0 +1 @@ +252:1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/device new file mode 120000 index 0000000000..ec3aabbdda --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/device @@ -0,0 +1 @@ +../../../usb1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/subsystem new file mode 120000 index 0000000000..4f40f16eba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/uevent new file mode 100644 index 0000000000..c5a4fd1202 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/version b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/version new file mode 100644 index 0000000000..d4dcb24258 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/version @@ -0,0 +1 @@ + 1.10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/device b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/device new file mode 120000 index 0000000000..f06be5ab3d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/device @@ -0,0 +1 @@ +../../../0000:00:1d.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/subsystem new file mode 120000 index 0000000000..72a11573f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/subsystem @@ -0,0 +1 @@ +../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/vendor b/test/sys/devices/pci0000:00/0000:00:1d.0/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.1/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/class b/test/sys/devices/pci0000:00/0000:00:1d.1/class new file mode 100644 index 0000000000..233dcce516 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/class @@ -0,0 +1 @@ +0x0c0300 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/config b/test/sys/devices/pci0000:00/0000:00:1d.1/config new file mode 100644 index 0000000000..f5dc52e043 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.1/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/device b/test/sys/devices/pci0000:00/0000:00:1d.1/device new file mode 100644 index 0000000000..e72bab0b81 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/device @@ -0,0 +1 @@ +0x27c9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/driver b/test/sys/devices/pci0000:00/0000:00:1d.1/driver new file mode 120000 index 0000000000..ed69e37601 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/enable b/test/sys/devices/pci0000:00/0000:00:1d.1/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.1/firmware_node new file mode 120000 index 0000000000..2ad3429d38 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:1a \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/irq b/test/sys/devices/pci0000:00/0000:00:1d.1/irq new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/irq @@ -0,0 +1 @@ +17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/modalias b/test/sys/devices/pci0000:00/0000:00:1d.1/modalias new file mode 100644 index 0000000000..d96dba36b2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/modalias @@ -0,0 +1 @@ +pci:v00008086d000027C9sv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.1/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/pools b/test/sys/devices/pci0000:00/0000:00:1d.1/pools new file mode 100644 index 0000000000..6f8c27bbc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/pools @@ -0,0 +1,7 @@ +poolinfo - 0.1 +uhci_qh 11 32 128 1 +uhci_td 1 64 64 1 +buffer-2048 0 0 2048 0 +buffer-512 0 0 512 0 +buffer-128 0 0 128 0 +buffer-32 1 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/resource b/test/sys/devices/pci0000:00/0000:00:1d.1/resource new file mode 100644 index 0000000000..7386ec0a04 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/resource @@ -0,0 +1,7 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000001820 0x000000000000183f 0x0000000000020101 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/resource4 b/test/sys/devices/pci0000:00/0000:00:1d.1/resource4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_device new file mode 100644 index 0000000000..dcce13f2d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_device @@ -0,0 +1 @@ +0x200a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/uevent new file mode 100644 index 0000000000..bb331518c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/uevent @@ -0,0 +1,6 @@ +DRIVER=uhci_hcd +PCI_CLASS=C0300 +PCI_ID=8086:27C9 +PCI_SUBSYS_ID=17AA:200A +PCI_SLOT_NAME=0000:00:1d.1 +MODALIAS=pci:v00008086d000027C9sv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver new file mode 120000 index 0000000000..5cf493442c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 new file mode 120000 index 0000000000..ca095e9f4a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev2.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias new file mode 100644 index 0000000000..a27a9fdc71 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias @@ -0,0 +1 @@ +usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent new file mode 100644 index 0000000000..ffd136d9e1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent @@ -0,0 +1,6 @@ +DEVTYPE=usb_interface +DRIVER=hub +PRODUCT=1d6b/1/206 +TYPE=9/0/0 +INTERFACE=9/0/0 +MODALIAS=usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev new file mode 100644 index 0000000000..674a2b6609 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev @@ -0,0 +1 @@ +252:2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/device new file mode 120000 index 0000000000..5a93828298 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/device @@ -0,0 +1 @@ +../../../2-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval new file mode 100644 index 0000000000..fcb4fa4875 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval @@ -0,0 +1 @@ +255ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent new file mode 100644 index 0000000000..9ada5a539c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/wMaxPacketSize new file mode 100644 index 0000000000..5fca1fda0b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized_default new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized_default @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower new file mode 100644 index 0000000000..ca2ea0dab5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower @@ -0,0 +1 @@ + 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice new file mode 100644 index 0000000000..ff5c1613f9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice @@ -0,0 +1 @@ +0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bmAttributes new file mode 100644 index 0000000000..4fe4106b50 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bmAttributes @@ -0,0 +1 @@ +e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/busnum b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/busnum new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/busnum @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/configuration b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/configuration new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/descriptors new file mode 100644 index 0000000000..bc75b5136f Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev new file mode 100644 index 0000000000..c6d526cc24 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev @@ -0,0 +1 @@ +189:128 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/devnum b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/devnum new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/devnum @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/driver b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/driver new file mode 120000 index 0000000000..0b3eba3d91 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/driver @@ -0,0 +1 @@ +../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 new file mode 120000 index 0000000000..dd434a788f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev2.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idProduct new file mode 100644 index 0000000000..635047563b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idProduct @@ -0,0 +1 @@ +0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idVendor new file mode 100644 index 0000000000..d247637ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idVendor @@ -0,0 +1 @@ +1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/manufacturer new file mode 100644 index 0000000000..4d6c1e12b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/manufacturer @@ -0,0 +1 @@ +Linux 2.6.27-rc7-00106-g6ef190c-dirty uhci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/maxchild new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/maxchild @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/active_duration new file mode 100644 index 0000000000..6a0b84b987 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/active_duration @@ -0,0 +1 @@ +2363 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration new file mode 100644 index 0000000000..f2750242a2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration @@ -0,0 +1 @@ +113687 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/level b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/level new file mode 100644 index 0000000000..865faf10cb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/level @@ -0,0 +1 @@ +auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/wakeup new file mode 100644 index 0000000000..86981e69f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/wakeup @@ -0,0 +1 @@ +enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/product b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/product new file mode 100644 index 0000000000..9677780a85 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/product @@ -0,0 +1 @@ +UHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/quirks b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/serial b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/serial new file mode 100644 index 0000000000..c95bfb0d3e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/serial @@ -0,0 +1 @@ +0000:00:1d.1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/speed b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/speed new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/speed @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/subsystem new file mode 120000 index 0000000000..77682faf80 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/subsystem @@ -0,0 +1 @@ +../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/uevent new file mode 100644 index 0000000000..a48590e6e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=128 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=1d6b/1/206 +TYPE=9/0/0 +BUSNUM=002 +DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/urbnum new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/urbnum @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/dev new file mode 100644 index 0000000000..cae42f5657 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/dev @@ -0,0 +1 @@ +252:3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/device new file mode 120000 index 0000000000..bc415c5bd3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/device @@ -0,0 +1 @@ +../../../usb2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/subsystem new file mode 120000 index 0000000000..4f40f16eba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/uevent new file mode 100644 index 0000000000..598a310fc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/version b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/version new file mode 100644 index 0000000000..d4dcb24258 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/version @@ -0,0 +1 @@ + 1.10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/device b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/device new file mode 120000 index 0000000000..f82d15303e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/device @@ -0,0 +1 @@ +../../../0000:00:1d.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/subsystem new file mode 120000 index 0000000000..72a11573f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/subsystem @@ -0,0 +1 @@ +../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/vendor b/test/sys/devices/pci0000:00/0000:00:1d.1/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.2/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/class b/test/sys/devices/pci0000:00/0000:00:1d.2/class new file mode 100644 index 0000000000..233dcce516 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/class @@ -0,0 +1 @@ +0x0c0300 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/config b/test/sys/devices/pci0000:00/0000:00:1d.2/config new file mode 100644 index 0000000000..47731a6c30 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.2/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/device b/test/sys/devices/pci0000:00/0000:00:1d.2/device new file mode 100644 index 0000000000..8b7c28a8dc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/device @@ -0,0 +1 @@ +0x27ca diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/driver new file mode 120000 index 0000000000..ed69e37601 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/enable b/test/sys/devices/pci0000:00/0000:00:1d.2/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.2/firmware_node new file mode 120000 index 0000000000..76eb9479c5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:1d \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/irq b/test/sys/devices/pci0000:00/0000:00:1d.2/irq new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/irq @@ -0,0 +1 @@ +18 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/modalias new file mode 100644 index 0000000000..0540045650 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/modalias @@ -0,0 +1 @@ +pci:v00008086d000027CAsv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.2/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/pools b/test/sys/devices/pci0000:00/0000:00:1d.2/pools new file mode 100644 index 0000000000..3fae9312c4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/pools @@ -0,0 +1,7 @@ +poolinfo - 0.1 +uhci_qh 13 32 128 1 +uhci_td 4 64 64 1 +buffer-2048 0 0 2048 0 +buffer-512 0 0 512 0 +buffer-128 3 32 128 1 +buffer-32 2 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/resource b/test/sys/devices/pci0000:00/0000:00:1d.2/resource new file mode 100644 index 0000000000..1e785fe677 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/resource @@ -0,0 +1,7 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000001840 0x000000000000185f 0x0000000000020101 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/resource4 b/test/sys/devices/pci0000:00/0000:00:1d.2/resource4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_device new file mode 100644 index 0000000000..dcce13f2d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_device @@ -0,0 +1 @@ +0x200a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/uevent new file mode 100644 index 0000000000..4390e929fc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/uevent @@ -0,0 +1,6 @@ +DRIVER=uhci_hcd +PCI_CLASS=C0300 +PCI_ID=8086:27CA +PCI_SUBSYS_ID=17AA:200A +PCI_SLOT_NAME=0000:00:1d.2 +MODALIAS=pci:v00008086d000027CAsv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver new file mode 120000 index 0000000000..5cf493442c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 new file mode 120000 index 0000000000..b3d2f00653 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev3.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias new file mode 100644 index 0000000000..a27a9fdc71 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias @@ -0,0 +1 @@ +usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent new file mode 100644 index 0000000000..ffd136d9e1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent @@ -0,0 +1,6 @@ +DEVTYPE=usb_interface +DRIVER=hub +PRODUCT=1d6b/1/206 +TYPE=9/0/0 +INTERFACE=9/0/0 +MODALIAS=usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev new file mode 100644 index 0000000000..2914c02271 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev @@ -0,0 +1 @@ +252:4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/device new file mode 120000 index 0000000000..03ac22c21d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/device @@ -0,0 +1 @@ +../../../3-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval new file mode 100644 index 0000000000..fcb4fa4875 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval @@ -0,0 +1 @@ +255ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent new file mode 100644 index 0000000000..33f313772c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/wMaxPacketSize new file mode 100644 index 0000000000..5fca1fda0b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/driver new file mode 120000 index 0000000000..a28197f174 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/driver @@ -0,0 +1 @@ +../../../../../../bus/usb/drivers/usbhid \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 new file mode 120000 index 0000000000..a12d9200a3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev3.3_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/abs b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/abs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/abs @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ev new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ev @@ -0,0 +1 @@ +17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ff b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ff new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ff @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/key b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/key new file mode 100644 index 0000000000..844d194187 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/key @@ -0,0 +1 @@ +70000 0 0 0 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/led b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/led new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/led @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/msc b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/msc new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/msc @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/rel b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/rel new file mode 100644 index 0000000000..a9c8fe8292 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/rel @@ -0,0 +1 @@ +103 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/snd b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/snd new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/snd @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/sw b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/sw new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/sw @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/device new file mode 120000 index 0000000000..459da56856 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/device @@ -0,0 +1 @@ +../../../3-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/dev new file mode 100644 index 0000000000..95aa46e144 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/dev @@ -0,0 +1 @@ +13:71 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/device new file mode 120000 index 0000000000..675e93ac15 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/device @@ -0,0 +1 @@ +../../input7 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/subsystem new file mode 120000 index 0000000000..4fae54fac9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/uevent new file mode 100644 index 0000000000..4e0079927a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=71 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/bustype b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/bustype new file mode 100644 index 0000000000..1ce74b6b00 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/bustype @@ -0,0 +1 @@ +0003 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/product b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/product new file mode 100644 index 0000000000..c7b1c6ebbd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/product @@ -0,0 +1 @@ +c03e diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/vendor b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/vendor new file mode 100644 index 0000000000..cb40fac378 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/vendor @@ -0,0 +1 @@ +046d diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/version b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/version new file mode 100644 index 0000000000..2450c58538 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/version @@ -0,0 +1 @@ +0110 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/modalias new file mode 100644 index 0000000000..2f189939cb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/modalias @@ -0,0 +1 @@ +input:b0003v046DpC03Ee0110-e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/dev new file mode 100644 index 0000000000..24a842e3cf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/dev @@ -0,0 +1 @@ +13:33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/device new file mode 120000 index 0000000000..675e93ac15 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/device @@ -0,0 +1 @@ +../../input7 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem new file mode 120000 index 0000000000..4fae54fac9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/uevent new file mode 100644 index 0000000000..83b19e0d53 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/name b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/name new file mode 100644 index 0000000000..6eb4e9675f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/name @@ -0,0 +1 @@ +Logitech USB-PS/2 Optical Mouse diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/phys b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/phys new file mode 100644 index 0000000000..501849bcf7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/phys @@ -0,0 +1 @@ +usb-0000:00:1d.2-1/input0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/subsystem new file mode 120000 index 0000000000..ed8b4fa1e4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uevent new file mode 100644 index 0000000000..c7d04d0191 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uevent @@ -0,0 +1,9 @@ +PRODUCT=3/46d/c03e/110 +NAME="Logitech USB-PS/2 Optical Mouse" +PHYS="usb-0000:00:1d.2-1/input0" +UNIQ="" +EV==17 +KEY==70000 0 0 0 0 +REL==103 +MSC==10 +MODALIAS=input:b0003v046DpC03Ee0110-e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uniq b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uniq new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uniq @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/modalias new file mode 100644 index 0000000000..94c6e52b4f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/modalias @@ -0,0 +1 @@ +usb:v046DpC03Ed2000dc00dsc00dp00ic03isc01ip02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/uevent new file mode 100644 index 0000000000..fb47686b5f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/uevent @@ -0,0 +1,6 @@ +DEVTYPE=usb_interface +DRIVER=usbhid +PRODUCT=46d/c03e/2000 +TYPE=0/0/0 +INTERFACE=3/1/2 +MODALIAS=usb:v046DpC03Ed2000dc00dsc00dp00ic03isc01ip02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval new file mode 100644 index 0000000000..eb6e8821f1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval @@ -0,0 +1 @@ +0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev new file mode 100644 index 0000000000..d12c5095f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev @@ -0,0 +1 @@ +252:10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device new file mode 120000 index 0000000000..459da56856 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device @@ -0,0 +1 @@ +../../../3-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval new file mode 100644 index 0000000000..f5ef4471e1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval @@ -0,0 +1 @@ +10ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent new file mode 100644 index 0000000000..3ff3a28c56 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/wMaxPacketSize new file mode 100644 index 0000000000..e224381915 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/authorized b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPacketSize0 new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPacketSize0 @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower new file mode 100644 index 0000000000..a87e477349 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower @@ -0,0 +1 @@ + 98mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice new file mode 100644 index 0000000000..8bd1af11bf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice @@ -0,0 +1 @@ +2000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes new file mode 100644 index 0000000000..0042f6c56d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes @@ -0,0 +1 @@ +a0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/busnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/busnum new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/busnum @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/configuration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/configuration new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/descriptors new file mode 100644 index 0000000000..82204b0849 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev new file mode 100644 index 0000000000..5ebdb1da47 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev @@ -0,0 +1 @@ +189:258 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/driver new file mode 120000 index 0000000000..092d2282f3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 new file mode 120000 index 0000000000..ec7e7c1084 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev3.3_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idProduct new file mode 100644 index 0000000000..c7b1c6ebbd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idProduct @@ -0,0 +1 @@ +c03e diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idVendor new file mode 100644 index 0000000000..cb40fac378 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idVendor @@ -0,0 +1 @@ +046d diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer new file mode 100644 index 0000000000..2a8f966756 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer @@ -0,0 +1 @@ +Logitech diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/maxchild new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/maxchild @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration new file mode 100644 index 0000000000..10f7138744 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration @@ -0,0 +1 @@ +112372 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration new file mode 100644 index 0000000000..10f7138744 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration @@ -0,0 +1 @@ +112372 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/level b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/level new file mode 100644 index 0000000000..b3d86404ab --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/level @@ -0,0 +1 @@ +on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/persist new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/persist @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup new file mode 100644 index 0000000000..86981e69f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup @@ -0,0 +1 @@ +enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/product b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/product new file mode 100644 index 0000000000..87ccc5cc7a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/product @@ -0,0 +1 @@ +USB-PS/2 Optical Mouse diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/quirks b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed new file mode 100644 index 0000000000..c239c60cba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed @@ -0,0 +1 @@ +1.5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent new file mode 100644 index 0000000000..c23b73767e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=258 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=46d/c03e/2000 +TYPE=0/0/0 +BUSNUM=003 +DEVNUM=003 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum @@ -0,0 +1 @@ +13 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev new file mode 100644 index 0000000000..e9646862ed --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev @@ -0,0 +1 @@ +252:11 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/device new file mode 120000 index 0000000000..b2ea03bcd6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/device @@ -0,0 +1 @@ +../../../3-1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent new file mode 100644 index 0000000000..7dde40c6e6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=11 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize new file mode 100644 index 0000000000..be15c71fd2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0008 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/version b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/version new file mode 100644 index 0000000000..602f25e1f4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/version @@ -0,0 +1 @@ + 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized_default new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized_default @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower new file mode 100644 index 0000000000..ca2ea0dab5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower @@ -0,0 +1 @@ + 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice new file mode 100644 index 0000000000..ff5c1613f9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice @@ -0,0 +1 @@ +0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bmAttributes new file mode 100644 index 0000000000..4fe4106b50 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bmAttributes @@ -0,0 +1 @@ +e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/busnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/busnum new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/busnum @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/configuration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/configuration new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/descriptors new file mode 100644 index 0000000000..bc75b5136f Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev new file mode 100644 index 0000000000..a16713ed24 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev @@ -0,0 +1 @@ +189:256 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/devnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/devnum new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/devnum @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/driver new file mode 120000 index 0000000000..0b3eba3d91 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/driver @@ -0,0 +1 @@ +../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 new file mode 120000 index 0000000000..017d4dfa59 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev3.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idProduct new file mode 100644 index 0000000000..635047563b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idProduct @@ -0,0 +1 @@ +0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idVendor new file mode 100644 index 0000000000..d247637ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idVendor @@ -0,0 +1 @@ +1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/manufacturer new file mode 100644 index 0000000000..4d6c1e12b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/manufacturer @@ -0,0 +1 @@ +Linux 2.6.27-rc7-00106-g6ef190c-dirty uhci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/maxchild new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/maxchild @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration new file mode 100644 index 0000000000..e973dc6dd9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration @@ -0,0 +1 @@ +113584 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration new file mode 100644 index 0000000000..e973dc6dd9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration @@ -0,0 +1 @@ +113584 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/level b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/level new file mode 100644 index 0000000000..865faf10cb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/level @@ -0,0 +1 @@ +auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/wakeup new file mode 100644 index 0000000000..86981e69f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/wakeup @@ -0,0 +1 @@ +enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/product b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/product new file mode 100644 index 0000000000..9677780a85 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/product @@ -0,0 +1 @@ +UHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/quirks b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/serial b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/serial new file mode 100644 index 0000000000..a01e935c74 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/serial @@ -0,0 +1 @@ +0000:00:1d.2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/speed b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/speed new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/speed @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/subsystem new file mode 120000 index 0000000000..77682faf80 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/subsystem @@ -0,0 +1 @@ +../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/uevent new file mode 100644 index 0000000000..e3fdc17d41 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=256 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=1d6b/1/206 +TYPE=9/0/0 +BUSNUM=003 +DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum new file mode 100644 index 0000000000..21e72e8ac3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum @@ -0,0 +1 @@ +48 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/dev new file mode 100644 index 0000000000..bf7752aa37 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/dev @@ -0,0 +1 @@ +252:5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/device new file mode 120000 index 0000000000..a6dd0c44b7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/device @@ -0,0 +1 @@ +../../../usb3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/subsystem new file mode 120000 index 0000000000..4f40f16eba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/uevent new file mode 100644 index 0000000000..9d301ac5d2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/version b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/version new file mode 100644 index 0000000000..d4dcb24258 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/version @@ -0,0 +1 @@ + 1.10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/device new file mode 120000 index 0000000000..b7eb8a384a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/device @@ -0,0 +1 @@ +../../../0000:00:1d.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/subsystem new file mode 120000 index 0000000000..72a11573f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/subsystem @@ -0,0 +1 @@ +../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/vendor b/test/sys/devices/pci0000:00/0000:00:1d.2/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.3/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/class b/test/sys/devices/pci0000:00/0000:00:1d.3/class new file mode 100644 index 0000000000..233dcce516 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/class @@ -0,0 +1 @@ +0x0c0300 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/config b/test/sys/devices/pci0000:00/0000:00:1d.3/config new file mode 100644 index 0000000000..1312a0a522 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.3/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/device b/test/sys/devices/pci0000:00/0000:00:1d.3/device new file mode 100644 index 0000000000..4a09851bab --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/device @@ -0,0 +1 @@ +0x27cb diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/driver new file mode 120000 index 0000000000..ed69e37601 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/enable b/test/sys/devices/pci0000:00/0000:00:1d.3/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.3/firmware_node new file mode 120000 index 0000000000..cc9eecc0b4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:20 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/irq b/test/sys/devices/pci0000:00/0000:00:1d.3/irq new file mode 100644 index 0000000000..d6b24041cf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/irq @@ -0,0 +1 @@ +19 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/modalias new file mode 100644 index 0000000000..6160ef48d9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/modalias @@ -0,0 +1 @@ +pci:v00008086d000027CBsv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.3/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/pools b/test/sys/devices/pci0000:00/0000:00:1d.3/pools new file mode 100644 index 0000000000..e62f9cbdf3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/pools @@ -0,0 +1,7 @@ +poolinfo - 0.1 +uhci_qh 13 32 128 1 +uhci_td 3 64 64 1 +buffer-2048 0 0 2048 0 +buffer-512 0 0 512 0 +buffer-128 0 0 128 0 +buffer-32 1 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/resource b/test/sys/devices/pci0000:00/0000:00:1d.3/resource new file mode 100644 index 0000000000..7a2726f3da --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/resource @@ -0,0 +1,7 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000001860 0x000000000000187f 0x0000000000020101 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/resource4 b/test/sys/devices/pci0000:00/0000:00:1d.3/resource4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_device new file mode 100644 index 0000000000..dcce13f2d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_device @@ -0,0 +1 @@ +0x200a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/uevent new file mode 100644 index 0000000000..52447e7b39 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/uevent @@ -0,0 +1,6 @@ +DRIVER=uhci_hcd +PCI_CLASS=C0300 +PCI_ID=8086:27CB +PCI_SUBSYS_ID=17AA:200A +PCI_SLOT_NAME=0000:00:1d.3 +MODALIAS=pci:v00008086d000027CBsv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver new file mode 120000 index 0000000000..5cf493442c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 new file mode 120000 index 0000000000..a904869fe1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias new file mode 100644 index 0000000000..a27a9fdc71 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias @@ -0,0 +1 @@ +usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent new file mode 100644 index 0000000000..ffd136d9e1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent @@ -0,0 +1,6 @@ +DEVTYPE=usb_interface +DRIVER=hub +PRODUCT=1d6b/1/206 +TYPE=9/0/0 +INTERFACE=9/0/0 +MODALIAS=usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev new file mode 100644 index 0000000000..f1b39606ef --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev @@ -0,0 +1 @@ +252:6 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/device new file mode 120000 index 0000000000..1d2aa23960 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/device @@ -0,0 +1 @@ +../../../4-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval new file mode 100644 index 0000000000..fcb4fa4875 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval @@ -0,0 +1 @@ +255ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent new file mode 100644 index 0000000000..68b352b4f2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=6 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/wMaxPacketSize new file mode 100644 index 0000000000..5fca1fda0b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass new file mode 100644 index 0000000000..4fe4106b50 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass @@ -0,0 +1 @@ +e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 new file mode 120000 index 0000000000..90cfdfb9c0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.2_ep02 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 new file mode 120000 index 0000000000..060171be3e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.2_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 new file mode 120000 index 0000000000..44fc98ae14 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.2_ep82 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/modalias new file mode 100644 index 0000000000..822555251f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/modalias @@ -0,0 +1 @@ +usb:v0A5Cp2110d0100dcE0dsc01dp01icE0isc01ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/uevent new file mode 100644 index 0000000000..4e34a977ba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=a5c/2110/100 +TYPE=224/1/1 +INTERFACE=224/1/1 +MODALIAS=usb:v0A5Cp2110d0100dcE0dsc01dp01icE0isc01ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bEndpointAddress new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bEndpointAddress @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev new file mode 100644 index 0000000000..bdcbeab347 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev @@ -0,0 +1 @@ +252:14 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device new file mode 120000 index 0000000000..4e6c223359 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device @@ -0,0 +1 @@ +../../../4-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction new file mode 100644 index 0000000000..1fcb1529f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction @@ -0,0 +1 @@ +out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent new file mode 100644 index 0000000000..04412f8dd2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=14 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev new file mode 100644 index 0000000000..f500d09323 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev @@ -0,0 +1 @@ +252:12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device new file mode 120000 index 0000000000..4e6c223359 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device @@ -0,0 +1 @@ +../../../4-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval new file mode 100644 index 0000000000..2280f71329 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval @@ -0,0 +1 @@ +1ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent new file mode 100644 index 0000000000..f3c1616a84 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/wMaxPacketSize new file mode 100644 index 0000000000..66375d5000 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0010 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bEndpointAddress new file mode 100644 index 0000000000..dde92ddc1a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bEndpointAddress @@ -0,0 +1 @@ +82 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev new file mode 100644 index 0000000000..d4e9a09b8a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev @@ -0,0 +1 @@ +252:13 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device new file mode 120000 index 0000000000..4e6c223359 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device @@ -0,0 +1 @@ +../../../4-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent new file mode 100644 index 0000000000..5e324ec077 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=13 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass new file mode 100644 index 0000000000..4fe4106b50 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass @@ -0,0 +1 @@ +e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceProtocol new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceProtocol @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceSubClass new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceSubClass @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 new file mode 120000 index 0000000000..c24d9704cc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.2_ep03 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 new file mode 120000 index 0000000000..0fa6c5ace1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.2_ep83 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/modalias new file mode 100644 index 0000000000..822555251f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/modalias @@ -0,0 +1 @@ +usb:v0A5Cp2110d0100dcE0dsc01dp01icE0isc01ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/uevent new file mode 100644 index 0000000000..4e34a977ba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=a5c/2110/100 +TYPE=224/1/1 +INTERFACE=224/1/1 +MODALIAS=usb:v0A5Cp2110d0100dcE0dsc01dp01icE0isc01ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bEndpointAddress new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bEndpointAddress @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bmAttributes new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bmAttributes @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev new file mode 100644 index 0000000000..a2baf86e19 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev @@ -0,0 +1 @@ +252:16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device new file mode 120000 index 0000000000..9412af3e6c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device @@ -0,0 +1 @@ +../../../4-1:1.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction new file mode 100644 index 0000000000..1fcb1529f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction @@ -0,0 +1 @@ +out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval new file mode 100644 index 0000000000..2280f71329 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval @@ -0,0 +1 @@ +1ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type new file mode 100644 index 0000000000..1ac1521640 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type @@ -0,0 +1 @@ +Isoc diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent new file mode 100644 index 0000000000..60fb5b7b2f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/wMaxPacketSize new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/wMaxPacketSize @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bEndpointAddress new file mode 100644 index 0000000000..76a8b2b703 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bEndpointAddress @@ -0,0 +1 @@ +83 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bmAttributes new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bmAttributes @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev new file mode 100644 index 0000000000..525a9fe407 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev @@ -0,0 +1 @@ +252:15 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device new file mode 120000 index 0000000000..9412af3e6c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device @@ -0,0 +1 @@ +../../../4-1:1.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval new file mode 100644 index 0000000000..2280f71329 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval @@ -0,0 +1 @@ +1ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type new file mode 100644 index 0000000000..1ac1521640 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type @@ -0,0 +1 @@ +Isoc diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent new file mode 100644 index 0000000000..b030034051 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=15 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/wMaxPacketSize new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/wMaxPacketSize @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceProtocol new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceProtocol @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceSubClass new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceSubClass @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 new file mode 120000 index 0000000000..e4a6309a18 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.2_ep04 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 new file mode 120000 index 0000000000..e1dc4a4010 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.2_ep84 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/modalias new file mode 100644 index 0000000000..430f2aac8f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/modalias @@ -0,0 +1 @@ +usb:v0A5Cp2110d0100dcE0dsc01dp01icFFiscFFipFF diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/uevent new file mode 100644 index 0000000000..6a006a9ac6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=a5c/2110/100 +TYPE=224/1/1 +INTERFACE=255/255/255 +MODALIAS=usb:v0A5Cp2110d0100dcE0dsc01dp01icFFiscFFipFF diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bEndpointAddress new file mode 100644 index 0000000000..64969239d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bEndpointAddress @@ -0,0 +1 @@ +04 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev new file mode 100644 index 0000000000..106878c9a4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev @@ -0,0 +1 @@ +252:18 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device new file mode 120000 index 0000000000..5426d76110 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device @@ -0,0 +1 @@ +../../../4-1:1.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction new file mode 100644 index 0000000000..1fcb1529f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction @@ -0,0 +1 @@ +out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent new file mode 100644 index 0000000000..22e8ee4de1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=18 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/wMaxPacketSize new file mode 100644 index 0000000000..0bfe0202ed --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/wMaxPacketSize @@ -0,0 +1 @@ +0020 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bEndpointAddress new file mode 100644 index 0000000000..871727de1f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bEndpointAddress @@ -0,0 +1 @@ +84 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev new file mode 100644 index 0000000000..2d7484226d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev @@ -0,0 +1 @@ +252:17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device new file mode 120000 index 0000000000..5426d76110 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device @@ -0,0 +1 @@ +../../../4-1:1.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent new file mode 100644 index 0000000000..1b9c38e51c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/wMaxPacketSize new file mode 100644 index 0000000000..0bfe0202ed --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/wMaxPacketSize @@ -0,0 +1 @@ +0020 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass new file mode 100644 index 0000000000..d6ddcd5065 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass @@ -0,0 +1 @@ +fe diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceSubClass new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceSubClass @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/modalias new file mode 100644 index 0000000000..bfa5015a37 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/modalias @@ -0,0 +1 @@ +usb:v0A5Cp2110d0100dcE0dsc01dp01icFEisc01ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/uevent new file mode 100644 index 0000000000..4bf4782582 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=a5c/2110/100 +TYPE=224/1/1 +INTERFACE=254/1/0 +MODALIAS=usb:v0A5Cp2110d0100dcE0dsc01dp01icFEisc01ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/authorized b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass new file mode 100644 index 0000000000..4fe4106b50 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass @@ -0,0 +1 @@ +e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceProtocol new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceProtocol @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceSubClass new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceSubClass @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPacketSize0 new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPacketSize0 @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower new file mode 100644 index 0000000000..ca2ea0dab5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower @@ -0,0 +1 @@ + 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumInterfaces new file mode 100644 index 0000000000..4429917f30 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumInterfaces @@ -0,0 +1 @@ + 4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice new file mode 100644 index 0000000000..e199843fc5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice @@ -0,0 +1 @@ +0100 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes new file mode 100644 index 0000000000..4fe4106b50 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes @@ -0,0 +1 @@ +e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/busnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/busnum new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/busnum @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/configuration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/configuration new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/descriptors new file mode 100644 index 0000000000..e3acb3958b Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev new file mode 100644 index 0000000000..1d0e3c7085 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev @@ -0,0 +1 @@ +189:385 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/devnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/devnum new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/devnum @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/driver new file mode 120000 index 0000000000..092d2282f3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 new file mode 120000 index 0000000000..9901da9a04 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.2_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idProduct new file mode 100644 index 0000000000..281e3d9981 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idProduct @@ -0,0 +1 @@ +2110 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idVendor new file mode 100644 index 0000000000..4a60677656 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idVendor @@ -0,0 +1 @@ +0a5c diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer new file mode 100644 index 0000000000..2fa5dd2a8c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer @@ -0,0 +1 @@ +Broadcom Corp diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/maxchild new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/maxchild @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration new file mode 100644 index 0000000000..9537691a51 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration @@ -0,0 +1 @@ +112053 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration new file mode 100644 index 0000000000..9537691a51 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration @@ -0,0 +1 @@ +112053 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/level b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/level new file mode 100644 index 0000000000..b3d86404ab --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/level @@ -0,0 +1 @@ +on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/persist new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/persist @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup new file mode 100644 index 0000000000..86981e69f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup @@ -0,0 +1 @@ +enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/product b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/product new file mode 100644 index 0000000000..0ce5be71ba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/product @@ -0,0 +1 @@ +BCM2045B diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/quirks b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/uevent new file mode 100644 index 0000000000..1b9c8bea34 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=385 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=a5c/2110/100 +TYPE=224/1/1 +BUSNUM=004 +DEVNUM=002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/urbnum new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/urbnum @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev new file mode 100644 index 0000000000..af7fe00234 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev @@ -0,0 +1 @@ +252:19 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/device new file mode 120000 index 0000000000..8134880373 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/device @@ -0,0 +1 @@ +../../../4-1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent new file mode 100644 index 0000000000..4e2c7e84ed --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=19 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/version b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/version new file mode 100644 index 0000000000..602f25e1f4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/version @@ -0,0 +1 @@ + 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 new file mode 120000 index 0000000000..f75e6a2118 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.3_ep02 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 new file mode 120000 index 0000000000..6df694755d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.3_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 new file mode 120000 index 0000000000..d32e1eede3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.3_ep83 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/modalias new file mode 100644 index 0000000000..dbcbdda812 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/modalias @@ -0,0 +1 @@ +usb:v0483p2016d0001dc00dsc00dp00icFFisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/uevent new file mode 100644 index 0000000000..9dcf599894 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=483/2016/1 +TYPE=0/0/0 +INTERFACE=255/0/0 +MODALIAS=usb:v0483p2016d0001dc00dsc00dp00icFFisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bEndpointAddress new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bEndpointAddress @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev new file mode 100644 index 0000000000..9845e54b6a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev @@ -0,0 +1 @@ +252:21 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device new file mode 120000 index 0000000000..033ddb420b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device @@ -0,0 +1 @@ +../../../4-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction new file mode 100644 index 0000000000..1fcb1529f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction @@ -0,0 +1 @@ +out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent new file mode 100644 index 0000000000..834fe58a57 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=21 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev new file mode 100644 index 0000000000..85618872ba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev @@ -0,0 +1 @@ +252:20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device new file mode 120000 index 0000000000..033ddb420b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device @@ -0,0 +1 @@ +../../../4-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent new file mode 100644 index 0000000000..cbe1fcb996 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bEndpointAddress new file mode 100644 index 0000000000..76a8b2b703 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bEndpointAddress @@ -0,0 +1 @@ +83 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval @@ -0,0 +1 @@ +14 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev new file mode 100644 index 0000000000..a2c5eecc73 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev @@ -0,0 +1 @@ +252:22 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device new file mode 120000 index 0000000000..033ddb420b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device @@ -0,0 +1 @@ +../../../4-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval new file mode 100644 index 0000000000..164c349ec6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval @@ -0,0 +1 @@ +20ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent new file mode 100644 index 0000000000..5e23395efb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=22 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/wMaxPacketSize new file mode 100644 index 0000000000..e224381915 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/wMaxPacketSize @@ -0,0 +1 @@ +0004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/authorized b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPacketSize0 new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPacketSize0 @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower new file mode 100644 index 0000000000..a3369c7120 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower @@ -0,0 +1 @@ +100mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice new file mode 100644 index 0000000000..635047563b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice @@ -0,0 +1 @@ +0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes new file mode 100644 index 0000000000..0042f6c56d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes @@ -0,0 +1 @@ +a0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/busnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/busnum new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/busnum @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/configuration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/configuration new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/descriptors new file mode 100644 index 0000000000..f7eeffd8e9 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev new file mode 100644 index 0000000000..2b44fb9531 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev @@ -0,0 +1 @@ +189:386 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/devnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/devnum new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/devnum @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/driver new file mode 120000 index 0000000000..092d2282f3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 new file mode 120000 index 0000000000..5944a8358f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.3_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idProduct new file mode 100644 index 0000000000..6f6d045ba5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idProduct @@ -0,0 +1 @@ +2016 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idVendor new file mode 100644 index 0000000000..a5aba47ba4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idVendor @@ -0,0 +1 @@ +0483 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer new file mode 100644 index 0000000000..4513b02f04 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer @@ -0,0 +1 @@ +STMicroelectronics diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/maxchild new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/maxchild @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration new file mode 100644 index 0000000000..a98bdef93f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration @@ -0,0 +1 @@ +111754 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration new file mode 100644 index 0000000000..a98bdef93f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration @@ -0,0 +1 @@ +111754 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/level b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/level new file mode 100644 index 0000000000..b3d86404ab --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/level @@ -0,0 +1 @@ +on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/persist new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/persist @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup new file mode 100644 index 0000000000..86981e69f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup @@ -0,0 +1 @@ +enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/product b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/product new file mode 100644 index 0000000000..e6a3064b63 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/product @@ -0,0 +1 @@ +Biometric Coprocessor diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/quirks b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/uevent new file mode 100644 index 0000000000..0c9f0b83fe --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=386 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=483/2016/1 +TYPE=0/0/0 +BUSNUM=004 +DEVNUM=003 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/urbnum new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/urbnum @@ -0,0 +1 @@ +9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev new file mode 100644 index 0000000000..155ecf8f22 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev @@ -0,0 +1 @@ +252:23 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/device new file mode 120000 index 0000000000..8fe9e1c7ab --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/device @@ -0,0 +1 @@ +../../../4-2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent new file mode 100644 index 0000000000..bd5d7c8474 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=23 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize new file mode 100644 index 0000000000..be15c71fd2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0008 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/version b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/version new file mode 100644 index 0000000000..9fce849a25 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/version @@ -0,0 +1 @@ + 1.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized_default new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized_default @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower new file mode 100644 index 0000000000..ca2ea0dab5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower @@ -0,0 +1 @@ + 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice new file mode 100644 index 0000000000..ff5c1613f9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice @@ -0,0 +1 @@ +0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bmAttributes new file mode 100644 index 0000000000..4fe4106b50 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bmAttributes @@ -0,0 +1 @@ +e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/busnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/busnum new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/busnum @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/configuration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/configuration new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/descriptors new file mode 100644 index 0000000000..bc75b5136f Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev new file mode 100644 index 0000000000..f57dc503b8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev @@ -0,0 +1 @@ +189:384 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/devnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/devnum new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/devnum @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/driver new file mode 120000 index 0000000000..0b3eba3d91 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/driver @@ -0,0 +1 @@ +../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 new file mode 120000 index 0000000000..2ed7a69d09 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev4.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idProduct new file mode 100644 index 0000000000..635047563b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idProduct @@ -0,0 +1 @@ +0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idVendor new file mode 100644 index 0000000000..d247637ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idVendor @@ -0,0 +1 @@ +1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/manufacturer new file mode 100644 index 0000000000..4d6c1e12b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/manufacturer @@ -0,0 +1 @@ +Linux 2.6.27-rc7-00106-g6ef190c-dirty uhci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/maxchild new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/maxchild @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration new file mode 100644 index 0000000000..10f1be6b55 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration @@ -0,0 +1 @@ +113439 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration new file mode 100644 index 0000000000..10f1be6b55 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration @@ -0,0 +1 @@ +113439 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/level b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/level new file mode 100644 index 0000000000..865faf10cb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/level @@ -0,0 +1 @@ +auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/wakeup new file mode 100644 index 0000000000..86981e69f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/wakeup @@ -0,0 +1 @@ +enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/product b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/product new file mode 100644 index 0000000000..9677780a85 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/product @@ -0,0 +1 @@ +UHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/quirks b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/serial b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/serial new file mode 100644 index 0000000000..a37bb88ca7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/serial @@ -0,0 +1 @@ +0000:00:1d.3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/speed b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/speed new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/speed @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/subsystem new file mode 120000 index 0000000000..77682faf80 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/subsystem @@ -0,0 +1 @@ +../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/uevent new file mode 100644 index 0000000000..65141c1f08 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=384 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=1d6b/1/206 +TYPE=9/0/0 +BUSNUM=004 +DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/urbnum new file mode 100644 index 0000000000..a8fa06e1be --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/urbnum @@ -0,0 +1 @@ +62 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/dev new file mode 100644 index 0000000000..697e2170aa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/dev @@ -0,0 +1 @@ +252:7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/device new file mode 120000 index 0000000000..8a501f195f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/device @@ -0,0 +1 @@ +../../../usb4 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/subsystem new file mode 120000 index 0000000000..4f40f16eba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/uevent new file mode 100644 index 0000000000..7dcc2a045b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/version b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/version new file mode 100644 index 0000000000..d4dcb24258 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/version @@ -0,0 +1 @@ + 1.10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/device new file mode 120000 index 0000000000..d7a7d7674c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/device @@ -0,0 +1 @@ +../../../0000:00:1d.3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/subsystem new file mode 120000 index 0000000000..72a11573f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/subsystem @@ -0,0 +1 @@ +../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/vendor b/test/sys/devices/pci0000:00/0000:00:1d.3/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/class b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/class deleted file mode 100644 index 145a550829..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/class +++ /dev/null @@ -1 +0,0 @@ -0x010000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/device deleted file mode 100644 index c271a13ff6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/device +++ /dev/null @@ -1 +0,0 @@ -0x008f diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/driver b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/driver deleted file mode 120000 index f6536ff545..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci/drivers/aic7xxx \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/device_blocked deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/device_blocked +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/driver b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/driver deleted file mode 120000 index 5fbbc0f385..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/scsi/drivers/sd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/model deleted file mode 100644 index 392039b199..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/model +++ /dev/null @@ -1 +0,0 @@ -ST336605LW !# diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/online b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/online deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/online +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/queue_depth deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/queue_depth +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/rev deleted file mode 100644 index 65dd514497..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/rev +++ /dev/null @@ -1 +0,0 @@ -B245 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/scsi_level deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/scsi_level +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/subsystem deleted file mode 120000 index 2edcea4660..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor deleted file mode 100644 index d87b2a5c0b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/vendor +++ /dev/null @@ -1 +0,0 @@ -IBM-ESXS diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/whitespace_test b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/whitespace_test deleted file mode 100644 index e3d48f0fe0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/host0/target0:0:0/0:0:0:0/whitespace_test +++ /dev/null @@ -1 +0,0 @@ -WHITE SPACE diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/irq b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/irq deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/irq +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/resource b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/resource deleted file mode 100644 index 2a3d654b9a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x0000000000007400 0x00000000000074ff 0x0000000000000101 -0x0000000080a11000 0x0000000080a11fff 0x0000000000000204 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000080a40000 0x0000000080a5ffff 0x0000000000007200 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem deleted file mode 120000 index d6210992bb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_device deleted file mode 100644 index 8419b39dd6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x0205 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_vendor deleted file mode 100644 index 7369ccd585..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x1014 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/vendor deleted file mode 100644 index a5d57044c8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:02:05.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x9005 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/class b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/class new file mode 100644 index 0000000000..6096f61aaf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/class @@ -0,0 +1 @@ +0x060700 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config new file mode 100644 index 0000000000..be3404f83f Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/device new file mode 100644 index 0000000000..a06a6ac093 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/device @@ -0,0 +1 @@ +0xac56 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/driver b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/driver new file mode 120000 index 0000000000..9c9a8b7a35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/driver @@ -0,0 +1 @@ +../../../../bus/pci/drivers/yenta_cardbus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/enable b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/enable new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/enable @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/firmware_node new file mode 120000 index 0000000000..01ec1668be --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/firmware_node @@ -0,0 +1 @@ +../../../LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/irq b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/irq new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/irq @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/modalias new file mode 100644 index 0000000000..4052d948c8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/modalias @@ -0,0 +1 @@ +pci:v0000104Cd0000AC56sv000017AAsd00002012bc06sc07i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/cpuaffinity new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/cpuaffinity @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/device new file mode 120000 index 0000000000..6a46f1e54e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/device @@ -0,0 +1 @@ +../../../0000:15:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/subsystem new file mode 120000 index 0000000000..deea66be17 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/subsystem @@ -0,0 +1 @@ +../../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_io b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_io new file mode 100644 index 0000000000..b1c976ec33 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_io @@ -0,0 +1,6 @@ +0x00000100 - 0x000003af +0x000003e0 - 0x000004ff +0x00000820 - 0x000008ff +0x00000a00 - 0x00000aff +0x00000c00 - 0x00000cf7 +0x0000a000 - 0x0000dfff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_mem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_mem new file mode 100644 index 0000000000..2f519cc453 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_mem @@ -0,0 +1,5 @@ +0x000c0000 - 0x000fffff +0x60000000 - 0x60ffffff +0xa0000000 - 0xa0ffffff +0xe0000000 - 0xe3ffffff +0xe4300000 - 0xe7ffffff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_setup_done b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_setup_done new file mode 100644 index 0000000000..7cfab5b05d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_setup_done @@ -0,0 +1 @@ +yes diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_irq_mask b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_irq_mask new file mode 100644 index 0000000000..d2ce0ecb99 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_irq_mask @@ -0,0 +1 @@ +0x0cf8 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_pm_state b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_pm_state new file mode 100644 index 0000000000..b3d86404ab --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_pm_state @@ -0,0 +1 @@ +on diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_type b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_type new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vcc b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vcc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_voltage b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_voltage new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vpp b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vpp new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/cis b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/cis new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/device new file mode 120000 index 0000000000..6a46f1e54e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/device @@ -0,0 +1 @@ +../../../0000:15:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/subsystem new file mode 120000 index 0000000000..c09baf13e4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/subsystem @@ -0,0 +1 @@ +../../../../../../class/pcmcia_socket \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/uevent new file mode 100644 index 0000000000..636f168941 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/uevent @@ -0,0 +1 @@ +SOCKET_NO=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource new file mode 100644 index 0000000000..6ce957e317 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource @@ -0,0 +1,12 @@ +0x00000000e4300000 0x00000000e4300fff 0x0000000000020200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x000000000000a000 0x000000000000a0ff 0x0000000000020100 +0x000000000000a400 0x000000000000a4ff 0x0000000000020100 +0x00000000e0000000 0x00000000e3ffffff 0x0000000000021200 +0x0000000088000000 0x000000008bffffff 0x0000000000020200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource0 b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem new file mode 120000 index 0000000000..d6210992bb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem @@ -0,0 +1 @@ +../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_device new file mode 100644 index 0000000000..5a95ea2bb8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_device @@ -0,0 +1 @@ +0x2012 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/uevent new file mode 100644 index 0000000000..7c77bd7d77 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/uevent @@ -0,0 +1,6 @@ +DRIVER=yenta_cardbus +PCI_CLASS=60700 +PCI_ID=104C:AC56 +PCI_SUBSYS_ID=17AA:2012 +PCI_SLOT_NAME=0000:15:00.0 +MODALIAS=pci:v0000104Cd0000AC56sv000017AAsd00002012bc06sc07i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/vendor new file mode 100644 index 0000000000..b6b18b2ea4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/vendor @@ -0,0 +1 @@ +0x104c diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/yenta_registers b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/yenta_registers new file mode 100644 index 0000000000..e3eb56c08d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/yenta_registers @@ -0,0 +1,11 @@ +CB registers: +00: 00000000 00000006 30000087 00000000 +10: 00000400 00000000 00000000 00000000 +20: 00000000 + +ExCA registers: +00: 84 01 00 50 00 08 00 00 - 00 00 01 00 00 00 01 00 +10: 00 00 00 00 00 00 c0 00 - 00 00 00 00 00 00 00 00 +20: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 +30: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 +40: 00 00 00 00 00 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1e.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/class b/test/sys/devices/pci0000:00/0000:00:1e.0/class index 8b40e6a7b7..725935d078 100644 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/class +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/class @@ -1 +1 @@ -0x060400 +0x060401 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/config b/test/sys/devices/pci0000:00/0000:00:1e.0/config new file mode 100644 index 0000000000..412c109356 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1e.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/device b/test/sys/devices/pci0000:00/0000:00:1e.0/device index 9fe3927fbb..9f43cba31e 100644 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/device +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/device @@ -1 +1 @@ -0x244e +0x2448 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/enable b/test/sys/devices/pci0000:00/0000:00:1e.0/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1e.0/firmware_node new file mode 120000 index 0000000000..9c1a17f9b2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:11 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/modalias b/test/sys/devices/pci0000:00/0000:00:1e.0/modalias new file mode 100644 index 0000000000..b294153163 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/modalias @@ -0,0 +1 @@ +pci:v00008086d00002448sv00000000sd00000000bc06sc04i01 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/cpuaffinity new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/cpuaffinity @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/device b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/device new file mode 120000 index 0000000000..a97370a78a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/device @@ -0,0 +1 @@ +../../../0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/subsystem new file mode 120000 index 0000000000..1d26d30581 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/subsystem @@ -0,0 +1 @@ +../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/resource b/test/sys/devices/pci0000:00/0000:00:1e.0/resource index f8f56abf32..1c1359fc60 100644 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/resource +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/resource @@ -5,8 +5,8 @@ 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x000000000000a000 0x000000000000dfff 0x0000000000000100 +0x00000000e4300000 0x00000000e7ffffff 0x0000000000000200 +0x00000000e0000000 0x00000000e3ffffff 0x0000000000001201 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/uevent new file mode 100644 index 0000000000..c028e2616f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1e.0/uevent @@ -0,0 +1,5 @@ +PCI_CLASS=60401 +PCI_ID=8086:2448 +PCI_SUBSYS_ID=0000:0000 +PCI_SLOT_NAME=0000:00:1e.0 +MODALIAS=pci:v00008086d00002448sv00000000sd00000000bc06sc04i01 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1f.0/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/class b/test/sys/devices/pci0000:00/0000:00:1f.0/class new file mode 100644 index 0000000000..bc758a7b5e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/class @@ -0,0 +1 @@ +0x060100 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/config b/test/sys/devices/pci0000:00/0000:00:1f.0/config new file mode 100644 index 0000000000..725c494770 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1f.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/device b/test/sys/devices/pci0000:00/0000:00:1f.0/device new file mode 100644 index 0000000000..b31957e282 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/device @@ -0,0 +1 @@ +0x27b9 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/enable b/test/sys/devices/pci0000:00/0000:00:1f.0/enable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/enable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1f.0/firmware_node new file mode 120000 index 0000000000..fb3bddbb26 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/irq b/test/sys/devices/pci0000:00/0000:00:1f.0/irq new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/irq @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/modalias b/test/sys/devices/pci0000:00/0000:00:1f.0/modalias new file mode 100644 index 0000000000..8f0301c211 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/modalias @@ -0,0 +1 @@ +pci:v00008086d000027B9sv000017AAsd00002009bc06sc01i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1f.0/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/resource b/test/sys/devices/pci0000:00/0000:00:1f.0/resource new file mode 100644 index 0000000000..2d8766d6a3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/resource @@ -0,0 +1,7 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_device new file mode 100644 index 0000000000..8cee5396f3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_device @@ -0,0 +1 @@ +0x2009 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.0/uevent new file mode 100644 index 0000000000..3ca5d6a5aa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/uevent @@ -0,0 +1,5 @@ +PCI_CLASS=60100 +PCI_ID=8086:27B9 +PCI_SUBSYS_ID=17AA:2009 +PCI_SLOT_NAME=0000:00:1f.0 +MODALIAS=pci:v00008086d000027B9sv000017AAsd00002009bc06sc01i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/vendor b/test/sys/devices/pci0000:00/0000:00:1f.0/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.0/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1f.1/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/class b/test/sys/devices/pci0000:00/0000:00:1f.1/class new file mode 100644 index 0000000000..d2ded34f93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/class @@ -0,0 +1 @@ +0x01018a diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/config b/test/sys/devices/pci0000:00/0000:00:1f.1/config new file mode 100644 index 0000000000..7856da2674 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1f.1/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/device b/test/sys/devices/pci0000:00/0000:00:1f.1/device new file mode 100644 index 0000000000..1e54094661 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/device @@ -0,0 +1 @@ +0x27df diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/driver b/test/sys/devices/pci0000:00/0000:00:1f.1/driver new file mode 120000 index 0000000000..f2901b951a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/ata_piix \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/enable b/test/sys/devices/pci0000:00/0000:00:1f.1/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/firmware_node b/test/sys/devices/pci0000:00/0000:00:1f.1/firmware_node new file mode 120000 index 0000000000..ebc9a22514 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:13 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/active_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/active_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/can_queue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/can_queue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/device new file mode 120000 index 0000000000..59e9abe1c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/device @@ -0,0 +1 @@ +../../../host4 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/host_busy new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/host_busy @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/proc_name new file mode 100644 index 0000000000..eaf803c1a1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/proc_name @@ -0,0 +1 @@ +ata_piix diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_capabilities new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_capabilities @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_guard_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_guard_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/sg_tablesize new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/sg_tablesize @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/state b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/subsystem new file mode 120000 index 0000000000..b369d53598 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/subsystem @@ -0,0 +1 @@ +../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/supported_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/supported_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unchecked_isa_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unchecked_isa_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unique_id new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unique_id @@ -0,0 +1 @@ +5 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/subsystem new file mode 120000 index 0000000000..c4acf92b7f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/subsystem @@ -0,0 +1 @@ +../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/bdi b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/bdi new file mode 120000 index 0000000000..0a96e7f45f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/bdi @@ -0,0 +1 @@ +../../../../../../../virtual/bdi/11:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/capability b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/capability new file mode 100644 index 0000000000..d6b24041cf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/capability @@ -0,0 +1 @@ +19 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/dev b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/dev new file mode 100644 index 0000000000..3d33f0f4ad --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/dev @@ -0,0 +1 @@ +11:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/device new file mode 120000 index 0000000000..32d31073aa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/device @@ -0,0 +1 @@ +../../../4:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/hw_sector_size b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/hw_sector_size new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/hw_sector_size @@ -0,0 +1 @@ +512 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_max b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_max new file mode 100644 index 0000000000..08558e471c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_max @@ -0,0 +1 @@ +16384 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_penalty b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_penalty new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_penalty @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_async b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_async new file mode 100644 index 0000000000..cb1a40df0f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_async @@ -0,0 +1 @@ +250 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_sync b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_sync new file mode 100644 index 0000000000..d136d6a714 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_sync @@ -0,0 +1 @@ +125 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/quantum b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/quantum new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/quantum @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async @@ -0,0 +1 @@ +40 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async_rq b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async_rq new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async_rq @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_idle b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_idle new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_idle @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_sync b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_sync new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_sync @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_hw_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_hw_sectors_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_hw_sectors_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_sectors_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_sectors_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nomerges b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nomerges new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nomerges @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nr_requests b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nr_requests new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nr_requests @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/read_ahead_kb b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/read_ahead_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/read_ahead_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/scheduler b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/scheduler new file mode 100644 index 0000000000..8b357d87cf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/scheduler @@ -0,0 +1 @@ +noop anticipatory deadline [cfq] diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/range b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/removable b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/removable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/removable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/ro b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/size b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/size new file mode 100644 index 0000000000..8078c2a5cd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/size @@ -0,0 +1 @@ +2097151 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/stat b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/subsystem new file mode 120000 index 0000000000..33c70a3d49 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/uevent new file mode 100644 index 0000000000..59eb810607 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/uevent @@ -0,0 +1,3 @@ +MAJOR=11 +MINOR=0 +DEVTYPE=disk diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev new file mode 100644 index 0000000000..69195c0b96 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev @@ -0,0 +1 @@ +254:1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device new file mode 120000 index 0000000000..32d31073aa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device @@ -0,0 +1 @@ +../../../4:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem new file mode 120000 index 0000000000..e2aa920b92 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/bsg \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent new file mode 100644 index 0000000000..02142464db --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent @@ -0,0 +1,2 @@ +MAJOR=254 +MINOR=1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/device_blocked new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/device_blocked @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver new file mode 120000 index 0000000000..fe479f5836 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver @@ -0,0 +1 @@ +../../../../../../bus/scsi/drivers/sr \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/evt_media_change b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/evt_media_change new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/evt_media_change @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic new file mode 120000 index 0000000000..41bc82db60 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic @@ -0,0 +1 @@ +scsi_generic/sg1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iocounterbits b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iocounterbits new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iocounterbits @@ -0,0 +1 @@ +32 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt new file mode 100644 index 0000000000..e439a9acba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt @@ -0,0 +1 @@ +0x71 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/ioerr_cnt b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/ioerr_cnt new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/ioerr_cnt @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt new file mode 100644 index 0000000000..ab0b052336 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt @@ -0,0 +1 @@ +0x1a1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/modalias b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/modalias new file mode 100644 index 0000000000..b584a10dd0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/modalias @@ -0,0 +1 @@ +scsi:t-0x05 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/model new file mode 100644 index 0000000000..23bd1b72f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/model @@ -0,0 +1 @@ +DVD-RAM UJ-842 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_depth new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_depth @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_type b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_type new file mode 100644 index 0000000000..621e94f0ec --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_type @@ -0,0 +1 @@ +none diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev new file mode 100644 index 0000000000..f6ba21e6cf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev @@ -0,0 +1 @@ +RB01 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device new file mode 120000 index 0000000000..32d31073aa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device @@ -0,0 +1 @@ +../../../4:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/subsystem new file mode 120000 index 0000000000..caa8462699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/scsi_device \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev new file mode 100644 index 0000000000..bd84814a63 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev @@ -0,0 +1 @@ +21:1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/device new file mode 120000 index 0000000000..32d31073aa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/device @@ -0,0 +1 @@ +../../../4:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem new file mode 120000 index 0000000000..248211f592 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/scsi_generic \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/uevent new file mode 100644 index 0000000000..d154bb40a1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/uevent @@ -0,0 +1,2 @@ +MAJOR=21 +MINOR=1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_level new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_level @@ -0,0 +1 @@ +6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/state b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/subsystem new file mode 120000 index 0000000000..0093fc1762 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/type new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/type @@ -0,0 +1 @@ +5 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent new file mode 100644 index 0000000000..3782602bb0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent @@ -0,0 +1,3 @@ +DEVTYPE=scsi_device +DRIVER=sr +MODALIAS=scsi:t-0x05 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor new file mode 100644 index 0000000000..0d22c779a2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor @@ -0,0 +1 @@ +MATSHITA diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/subsystem new file mode 120000 index 0000000000..117235d664 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/subsystem @@ -0,0 +1 @@ +../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/uevent new file mode 100644 index 0000000000..ce02d8524b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_target diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/uevent new file mode 100644 index 0000000000..934f648e8c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/active_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/active_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/can_queue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/can_queue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/device new file mode 120000 index 0000000000..6916fb5952 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/device @@ -0,0 +1 @@ +../../../host5 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/host_busy new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/host_busy @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/proc_name new file mode 100644 index 0000000000..eaf803c1a1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/proc_name @@ -0,0 +1 @@ +ata_piix diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_capabilities new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_capabilities @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_guard_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_guard_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/sg_tablesize new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/sg_tablesize @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/state b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/subsystem new file mode 120000 index 0000000000..b369d53598 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/subsystem @@ -0,0 +1 @@ +../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/supported_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/supported_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unchecked_isa_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unchecked_isa_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unique_id new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unique_id @@ -0,0 +1 @@ +6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/subsystem new file mode 120000 index 0000000000..c4acf92b7f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/subsystem @@ -0,0 +1 @@ +../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/uevent new file mode 100644 index 0000000000..934f648e8c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/irq b/test/sys/devices/pci0000:00/0000:00:1f.1/irq new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/irq @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpus b/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/modalias b/test/sys/devices/pci0000:00/0000:00:1f.1/modalias new file mode 100644 index 0000000000..7d40b86a94 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/modalias @@ -0,0 +1 @@ +pci:v00008086d000027DFsv000017AAsd0000200Cbc01sc01i8a diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/msi_bus b/test/sys/devices/pci0000:00/0000:00:1f.1/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource b/test/sys/devices/pci0000:00/0000:00:1f.1/resource new file mode 100644 index 0000000000..51946efb9e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/resource @@ -0,0 +1,7 @@ +0x00000000000001f0 0x00000000000001f7 0x0000000000000110 +0x00000000000003f6 0x00000000000003f6 0x0000000000000110 +0x0000000000000170 0x0000000000000177 0x0000000000000110 +0x0000000000000376 0x0000000000000376 0x0000000000000110 +0x0000000000001880 0x000000000000188f 0x0000000000020101 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource0 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource1 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource2 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource3 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource3 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource4 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_device new file mode 100644 index 0000000000..2402878ff1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_device @@ -0,0 +1 @@ +0x200c diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/uevent new file mode 100644 index 0000000000..af637407ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/uevent @@ -0,0 +1,6 @@ +DRIVER=ata_piix +PCI_CLASS=1018A +PCI_ID=8086:27DF +PCI_SUBSYS_ID=17AA:200C +PCI_SLOT_NAME=0000:00:1f.1 +MODALIAS=pci:v00008086d000027DFsv000017AAsd0000200Cbc01sc01i8a diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/vendor b/test/sys/devices/pci0000:00/0000:00:1f.1/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1f.2/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/class b/test/sys/devices/pci0000:00/0000:00:1f.2/class new file mode 100644 index 0000000000..83229b2e3e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/class @@ -0,0 +1 @@ +0x010601 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/config b/test/sys/devices/pci0000:00/0000:00:1f.2/config new file mode 100644 index 0000000000..6e2794dc8c Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1f.2/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/device b/test/sys/devices/pci0000:00/0000:00:1f.2/device new file mode 100644 index 0000000000..3e2c9cc80b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/device @@ -0,0 +1 @@ +0x27c5 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/driver b/test/sys/devices/pci0000:00/0000:00:1f.2/driver new file mode 120000 index 0000000000..e08571dcb2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/ahci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/enable b/test/sys/devices/pci0000:00/0000:00:1f.2/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/firmware_node b/test/sys/devices/pci0000:00/0000:00:1f.2/firmware_node new file mode 120000 index 0000000000..9ee381b89e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:16 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/active_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/active_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/can_queue new file mode 100644 index 0000000000..e85087affd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/can_queue @@ -0,0 +1 @@ +31 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/device new file mode 120000 index 0000000000..50ea9d7d91 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/device @@ -0,0 +1 @@ +../../../host0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/host_busy new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/host_busy @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy new file mode 100644 index 0000000000..7fa451caf2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy @@ -0,0 +1 @@ +max_performance diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/proc_name new file mode 100644 index 0000000000..bde306049d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/proc_name @@ -0,0 +1 @@ +ahci diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_capabilities new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_capabilities @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_guard_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_guard_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/sg_tablesize new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/sg_tablesize @@ -0,0 +1 @@ +168 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/subsystem new file mode 120000 index 0000000000..b369d53598 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/subsystem @@ -0,0 +1 @@ +../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/supported_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/supported_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unchecked_isa_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unchecked_isa_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unique_id new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unique_id @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/subsystem new file mode 120000 index 0000000000..c4acf92b7f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/subsystem @@ -0,0 +1 @@ +../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/bdi b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/bdi new file mode 120000 index 0000000000..6737c794cc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/bdi @@ -0,0 +1 @@ +../../../../../../../virtual/bdi/8:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/capability b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/capability new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/capability @@ -0,0 +1 @@ +12 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/dev new file mode 100644 index 0000000000..fae0a50572 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/dev @@ -0,0 +1 @@ +8:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/device new file mode 120000 index 0000000000..79ba80254b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/device @@ -0,0 +1 @@ +../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/bsg b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/bsg new file mode 120000 index 0000000000..973a440fb2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/bsg @@ -0,0 +1 @@ +../../../bsg/0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/hw_sector_size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/hw_sector_size new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/hw_sector_size @@ -0,0 +1 @@ +512 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_max b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_max new file mode 100644 index 0000000000..08558e471c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_max @@ -0,0 +1 @@ +16384 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_penalty b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_penalty new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_penalty @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_async b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_async new file mode 100644 index 0000000000..cb1a40df0f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_async @@ -0,0 +1 @@ +250 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_sync b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_sync new file mode 100644 index 0000000000..d136d6a714 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_sync @@ -0,0 +1 @@ +125 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/quantum b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/quantum new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/quantum @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async @@ -0,0 +1 @@ +40 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async_rq b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async_rq new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async_rq @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_idle b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_idle new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_idle @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_sync b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_sync new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_sync @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_hw_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_hw_sectors_kb new file mode 100644 index 0000000000..10130bb020 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_hw_sectors_kb @@ -0,0 +1 @@ +32767 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_sectors_kb new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_sectors_kb @@ -0,0 +1 @@ +512 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nomerges b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nomerges new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nomerges @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nr_requests b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nr_requests new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nr_requests @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/read_ahead_kb b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/read_ahead_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/read_ahead_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/scheduler b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/scheduler new file mode 100644 index 0000000000..8b357d87cf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/scheduler @@ -0,0 +1 @@ +noop anticipatory deadline [cfq] diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/range b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/range new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/range @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/removable b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/ro b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/dev new file mode 100644 index 0000000000..92c4b9b088 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/dev @@ -0,0 +1 @@ +8:1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/size new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/size @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/start new file mode 100644 index 0000000000..4b9026d8e2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/start @@ -0,0 +1 @@ +63 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/stat new file mode 100644 index 0000000000..0f17c6b4b8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/stat @@ -0,0 +1 @@ + 2 0 4 36 0 0 0 0 0 36 36 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/subsystem new file mode 120000 index 0000000000..813accd22c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent new file mode 100644 index 0000000000..d3e19784f7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=1 +DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/dev new file mode 100644 index 0000000000..e7cbbe3a6d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/dev @@ -0,0 +1 @@ +8:10 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/size new file mode 100644 index 0000000000..33e366515f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/size @@ -0,0 +1 @@ +4546332 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/start new file mode 100644 index 0000000000..748059172f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/start @@ -0,0 +1 @@ +190820133 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/stat new file mode 100644 index 0000000000..3deac173ed --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/stat @@ -0,0 +1 @@ + 42 43 384 417 0 0 0 0 0 286 417 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/subsystem new file mode 120000 index 0000000000..813accd22c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/uevent new file mode 100644 index 0000000000..0fa408dc51 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=10 +DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/dev new file mode 100644 index 0000000000..b3d5042192 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/dev @@ -0,0 +1 @@ +8:5 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/size new file mode 100644 index 0000000000..73bd1fe947 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/size @@ -0,0 +1 @@ +62926479 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/start new file mode 100644 index 0000000000..0a3e7b0422 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/start @@ -0,0 +1 @@ +126 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat new file mode 100644 index 0000000000..22ca482cdf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat @@ -0,0 +1 @@ + 8524 4084 430394 149238 599 1279 15024 117893 0 44736 267127 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/subsystem new file mode 120000 index 0000000000..813accd22c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent new file mode 100644 index 0000000000..8a871ced03 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=5 +DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/dev new file mode 100644 index 0000000000..c1a2f319ee --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/dev @@ -0,0 +1 @@ +8:6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/size new file mode 100644 index 0000000000..42ca54d94d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/size @@ -0,0 +1 @@ +41945652 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/start new file mode 100644 index 0000000000..fdac9735a9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/start @@ -0,0 +1 @@ +62926668 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat new file mode 100644 index 0000000000..1785f8c452 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat @@ -0,0 +1 @@ + 387 21 3102 2398 1 0 8 0 0 2339 2398 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/subsystem new file mode 120000 index 0000000000..813accd22c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/uevent new file mode 100644 index 0000000000..e08f4c0982 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=6 +DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/dev new file mode 100644 index 0000000000..e8f00a5462 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/dev @@ -0,0 +1 @@ +8:7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/size new file mode 100644 index 0000000000..5424df4263 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/size @@ -0,0 +1 @@ +19534977 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/start new file mode 100644 index 0000000000..d8099b00ac --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/start @@ -0,0 +1 @@ +104872383 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/stat new file mode 100644 index 0000000000..ea68657675 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/stat @@ -0,0 +1 @@ + 35 263 298 419 0 0 0 0 0 298 419 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/subsystem new file mode 120000 index 0000000000..813accd22c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/uevent new file mode 100644 index 0000000000..308c3941be --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=7 +DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/dev new file mode 100644 index 0000000000..e9530d7b36 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/dev @@ -0,0 +1 @@ +8:8 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/size new file mode 100644 index 0000000000..5424df4263 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/size @@ -0,0 +1 @@ +19534977 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/start new file mode 100644 index 0000000000..e8e80b605d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/start @@ -0,0 +1 @@ +124407423 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/stat new file mode 100644 index 0000000000..c69e9c06ce --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/stat @@ -0,0 +1 @@ + 34 264 298 498 0 0 0 0 0 368 498 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/subsystem new file mode 120000 index 0000000000..813accd22c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/uevent new file mode 100644 index 0000000000..f23daf504f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=8 +DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/dev new file mode 100644 index 0000000000..acf0ba30b9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/dev @@ -0,0 +1 @@ +8:9 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 new file mode 120000 index 0000000000..f69190bd80 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 @@ -0,0 +1 @@ +../../../../../../../../../virtual/block/md0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/size new file mode 100644 index 0000000000..e9c908dcb4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/size @@ -0,0 +1 @@ +46877607 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/start new file mode 100644 index 0000000000..443fe70bd0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/start @@ -0,0 +1 @@ +143942463 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/stat new file mode 100644 index 0000000000..65e26a19dd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/stat @@ -0,0 +1 @@ + 70 322 896 800 3 0 40 240 0 945 1039 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/subsystem new file mode 120000 index 0000000000..813accd22c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/uevent new file mode 100644 index 0000000000..9bea60637b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=9 +DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/size new file mode 100644 index 0000000000..967b32b605 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/size @@ -0,0 +1 @@ +195371568 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat new file mode 100644 index 0000000000..0fbc84d5d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat @@ -0,0 +1 @@ + 9115 5020 435728 153995 603 1279 15072 118133 0 47352 272124 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/subsystem new file mode 120000 index 0000000000..33c70a3d49 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test:colon+plus b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test:colon+plus new file mode 100644 index 0000000000..0fed9a5d60 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test:colon+plus @@ -0,0 +1 @@ +colon diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent new file mode 100644 index 0000000000..c3945d4e0a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=0 +DEVTYPE=disk diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev new file mode 100644 index 0000000000..7a902749a2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev @@ -0,0 +1 @@ +254:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device new file mode 120000 index 0000000000..79ba80254b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device @@ -0,0 +1 @@ +../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem new file mode 120000 index 0000000000..e2aa920b92 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/bsg \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent new file mode 100644 index 0000000000..79ff461eda --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent @@ -0,0 +1,2 @@ +MAJOR=254 +MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/device_blocked new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/device_blocked @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver new file mode 120000 index 0000000000..2ea53129c0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver @@ -0,0 +1 @@ +../../../../../../bus/scsi/drivers/sd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/evt_media_change b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/evt_media_change new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/evt_media_change @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic new file mode 120000 index 0000000000..4bf718c25a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic @@ -0,0 +1 @@ +scsi_generic/sg0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iocounterbits b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iocounterbits new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iocounterbits @@ -0,0 +1 @@ +32 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt new file mode 100644 index 0000000000..d724420fc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt @@ -0,0 +1 @@ +0x2617 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt new file mode 100644 index 0000000000..87c20ee33d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt @@ -0,0 +1 @@ +0x2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt new file mode 100644 index 0000000000..d724420fc8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt @@ -0,0 +1 @@ +0x2617 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/modalias b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/modalias new file mode 100644 index 0000000000..cbde94ebdb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/modalias @@ -0,0 +1 @@ +scsi:t-0x00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/model new file mode 100644 index 0000000000..1147c9f13e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/model @@ -0,0 +1 @@ +ST910021AS diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_depth new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_depth @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_type new file mode 100644 index 0000000000..621e94f0ec --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_type @@ -0,0 +1 @@ +none diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev new file mode 100644 index 0000000000..4c88fe11eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev @@ -0,0 +1 @@ +4.06 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device new file mode 120000 index 0000000000..79ba80254b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device @@ -0,0 +1 @@ +../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/subsystem new file mode 120000 index 0000000000..caa8462699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/scsi_device \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/allow_restart b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/allow_restart new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/allow_restart @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/app_tag_own b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/app_tag_own new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/app_tag_own @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/cache_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/cache_type new file mode 100644 index 0000000000..5e6bcb066b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/cache_type @@ -0,0 +1 @@ +write back diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device new file mode 120000 index 0000000000..79ba80254b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device @@ -0,0 +1 @@ +../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/protection_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/protection_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/protection_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/subsystem new file mode 120000 index 0000000000..c02ce9f005 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/scsi_disk \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev new file mode 100644 index 0000000000..992e92097e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev @@ -0,0 +1 @@ +21:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/device new file mode 120000 index 0000000000..79ba80254b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/device @@ -0,0 +1 @@ +../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem new file mode 120000 index 0000000000..248211f592 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/scsi_generic \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/uevent new file mode 100644 index 0000000000..8bfb5920b3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/uevent @@ -0,0 +1,2 @@ +MAJOR=21 +MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_level new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_level @@ -0,0 +1 @@ +6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/subsystem new file mode 120000 index 0000000000..0093fc1762 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/sw_activity b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/sw_activity new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout new file mode 100644 index 0000000000..abdfb053e4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout @@ -0,0 +1 @@ +60 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent new file mode 100644 index 0000000000..85c5088edf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent @@ -0,0 +1,3 @@ +DEVTYPE=scsi_device +DRIVER=sd +MODALIAS=scsi:t-0x00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor new file mode 100644 index 0000000000..fdc812418a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor @@ -0,0 +1 @@ +ATA diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/whitespace_test b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/whitespace_test new file mode 100644 index 0000000000..e3d48f0fe0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/whitespace_test @@ -0,0 +1 @@ +WHITE SPACE diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/subsystem new file mode 120000 index 0000000000..117235d664 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/uevent new file mode 100644 index 0000000000..ce02d8524b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_target diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/uevent new file mode 100644 index 0000000000..934f648e8c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/active_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/active_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/can_queue new file mode 100644 index 0000000000..e85087affd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/can_queue @@ -0,0 +1 @@ +31 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/device new file mode 120000 index 0000000000..20f114d36a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/device @@ -0,0 +1 @@ +../../../host1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/host_busy new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/host_busy @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/link_power_management_policy b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/link_power_management_policy new file mode 100644 index 0000000000..7fa451caf2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/link_power_management_policy @@ -0,0 +1 @@ +max_performance diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/proc_name new file mode 100644 index 0000000000..bde306049d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/proc_name @@ -0,0 +1 @@ +ahci diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_capabilities new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_capabilities @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_guard_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_guard_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/sg_tablesize new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/sg_tablesize @@ -0,0 +1 @@ +168 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/subsystem new file mode 120000 index 0000000000..b369d53598 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/subsystem @@ -0,0 +1 @@ +../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/supported_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/supported_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unchecked_isa_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unchecked_isa_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unique_id new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unique_id @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/subsystem new file mode 120000 index 0000000000..c4acf92b7f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/subsystem @@ -0,0 +1 @@ +../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/uevent new file mode 100644 index 0000000000..934f648e8c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/active_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/active_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/can_queue new file mode 100644 index 0000000000..e85087affd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/can_queue @@ -0,0 +1 @@ +31 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/device new file mode 120000 index 0000000000..c616df189a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/device @@ -0,0 +1 @@ +../../../host2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/host_busy new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/host_busy @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/link_power_management_policy b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/link_power_management_policy new file mode 100644 index 0000000000..7fa451caf2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/link_power_management_policy @@ -0,0 +1 @@ +max_performance diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/proc_name new file mode 100644 index 0000000000..bde306049d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/proc_name @@ -0,0 +1 @@ +ahci diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_capabilities new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_capabilities @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_guard_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_guard_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/sg_tablesize new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/sg_tablesize @@ -0,0 +1 @@ +168 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/subsystem new file mode 120000 index 0000000000..b369d53598 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/subsystem @@ -0,0 +1 @@ +../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/supported_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/supported_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unchecked_isa_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unchecked_isa_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unique_id new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unique_id @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/subsystem new file mode 120000 index 0000000000..c4acf92b7f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/subsystem @@ -0,0 +1 @@ +../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/uevent new file mode 100644 index 0000000000..934f648e8c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/active_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/active_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/can_queue new file mode 100644 index 0000000000..e85087affd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/can_queue @@ -0,0 +1 @@ +31 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/device new file mode 120000 index 0000000000..027c07ff96 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/device @@ -0,0 +1 @@ +../../../host3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/host_busy new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/host_busy @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/link_power_management_policy b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/link_power_management_policy new file mode 100644 index 0000000000..7fa451caf2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/link_power_management_policy @@ -0,0 +1 @@ +max_performance diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/proc_name new file mode 100644 index 0000000000..bde306049d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/proc_name @@ -0,0 +1 @@ +ahci diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_capabilities new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_capabilities @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_guard_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_guard_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/sg_tablesize new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/sg_tablesize @@ -0,0 +1 @@ +168 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/subsystem new file mode 120000 index 0000000000..b369d53598 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/subsystem @@ -0,0 +1 @@ +../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/supported_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/supported_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unchecked_isa_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unchecked_isa_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unique_id new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unique_id @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/subsystem new file mode 120000 index 0000000000..c4acf92b7f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/subsystem @@ -0,0 +1 @@ +../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/uevent new file mode 100644 index 0000000000..934f648e8c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/irq b/test/sys/devices/pci0000:00/0000:00:1f.2/irq new file mode 100644 index 0000000000..80e3e6eab6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/irq @@ -0,0 +1 @@ +506 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpus b/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/modalias b/test/sys/devices/pci0000:00/0000:00:1f.2/modalias new file mode 100644 index 0000000000..3769235882 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/modalias @@ -0,0 +1 @@ +pci:v00008086d000027C5sv000017AAsd0000200Dbc01sc06i01 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/msi_bus b/test/sys/devices/pci0000:00/0000:00:1f.2/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource b/test/sys/devices/pci0000:00/0000:00:1f.2/resource new file mode 100644 index 0000000000..1c4b743cb4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/resource @@ -0,0 +1,7 @@ +0x00000000000018c8 0x00000000000018cf 0x0000000000020101 +0x00000000000018ac 0x00000000000018af 0x0000000000020101 +0x00000000000018c0 0x00000000000018c7 0x0000000000020101 +0x00000000000018a8 0x00000000000018ab 0x0000000000020101 +0x00000000000018b0 0x00000000000018bf 0x0000000000020101 +0x00000000ee404400 0x00000000ee4047ff 0x0000000000020200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource0 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource1 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource1 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource2 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource2 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource3 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource3 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource4 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource5 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource5 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_device new file mode 100644 index 0000000000..d1a710ea02 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_device @@ -0,0 +1 @@ +0x200d diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/uevent new file mode 100644 index 0000000000..328e9dd1f3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/uevent @@ -0,0 +1,6 @@ +DRIVER=ahci +PCI_CLASS=10601 +PCI_ID=8086:27C5 +PCI_SUBSYS_ID=17AA:200D +PCI_SLOT_NAME=0000:00:1f.2 +MODALIAS=pci:v00008086d000027C5sv000017AAsd0000200Dbc01sc06i01 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/vendor b/test/sys/devices/pci0000:00/0000:00:1f.2/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1f.3/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/class b/test/sys/devices/pci0000:00/0000:00:1f.3/class new file mode 100644 index 0000000000..4c9fbc3630 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/class @@ -0,0 +1 @@ +0x0c0500 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/config b/test/sys/devices/pci0000:00/0000:00:1f.3/config new file mode 100644 index 0000000000..11498afd39 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1f.3/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/device b/test/sys/devices/pci0000:00/0000:00:1f.3/device new file mode 100644 index 0000000000..7993325705 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/device @@ -0,0 +1 @@ +0x27da diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/enable b/test/sys/devices/pci0000:00/0000:00:1f.3/enable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/enable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/firmware_node b/test/sys/devices/pci0000:00/0000:00:1f.3/firmware_node new file mode 120000 index 0000000000..29587b0613 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:18 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/irq b/test/sys/devices/pci0000:00/0000:00:1f.3/irq new file mode 100644 index 0000000000..b4de394767 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/irq @@ -0,0 +1 @@ +11 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpus b/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/modalias b/test/sys/devices/pci0000:00/0000:00:1f.3/modalias new file mode 100644 index 0000000000..4dae4f8822 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/modalias @@ -0,0 +1 @@ +pci:v00008086d000027DAsv000017AAsd0000200Fbc0Csc05i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/msi_bus b/test/sys/devices/pci0000:00/0000:00:1f.3/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/resource b/test/sys/devices/pci0000:00/0000:00:1f.3/resource new file mode 100644 index 0000000000..abe447f282 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/resource @@ -0,0 +1,7 @@ +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x00000000000018e0 0x00000000000018ff 0x0000000000020101 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/resource4 b/test/sys/devices/pci0000:00/0000:00:1f.3/resource4 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_device new file mode 100644 index 0000000000..fdb60b6c65 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_device @@ -0,0 +1 @@ +0x200f diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/uevent b/test/sys/devices/pci0000:00/0000:00:1f.3/uevent new file mode 100644 index 0000000000..018d6a9a40 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/uevent @@ -0,0 +1,5 @@ +PCI_CLASS=C0500 +PCI_ID=8086:27DA +PCI_SUBSYS_ID=17AA:200F +PCI_SLOT_NAME=0000:00:1f.3 +MODALIAS=pci:v00008086d000027DAsv000017AAsd0000200Fbc0Csc05i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/vendor b/test/sys/devices/pci0000:00/0000:00:1f.3/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1f.3/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/firmware_node b/test/sys/devices/pci0000:00/firmware_node new file mode 120000 index 0000000000..d3a6b704b4 --- /dev/null +++ b/test/sys/devices/pci0000:00/firmware_node @@ -0,0 +1 @@ +../LNXSYSTM:00/device:00/PNP0A08:00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/cpuaffinity b/test/sys/devices/pci0000:00/pci_bus/0000:00/cpuaffinity new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/pci_bus/0000:00/cpuaffinity @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/device b/test/sys/devices/pci0000:00/pci_bus/0000:00/device new file mode 120000 index 0000000000..1b094a25e9 --- /dev/null +++ b/test/sys/devices/pci0000:00/pci_bus/0000:00/device @@ -0,0 +1 @@ +../../../pci0000:00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/power/wakeup b/test/sys/devices/pci0000:00/pci_bus/0000:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/pci_bus/0000:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/subsystem b/test/sys/devices/pci0000:00/pci_bus/0000:00/subsystem new file mode 120000 index 0000000000..e41a3cae86 --- /dev/null +++ b/test/sys/devices/pci0000:00/pci_bus/0000:00/subsystem @@ -0,0 +1 @@ +../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/uevent b/test/sys/devices/pci0000:00/pci_bus/0000:00/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/power/wakeup b/test/sys/devices/pci0000:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/uevent b/test/sys/devices/pci0000:00/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/dock.0/docked b/test/sys/devices/platform/dock.0/docked new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/dock.0/docked @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/dock.0/flags b/test/sys/devices/platform/dock.0/flags new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/dock.0/flags @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/dock.0/modalias b/test/sys/devices/platform/dock.0/modalias new file mode 100644 index 0000000000..a591f3fed0 --- /dev/null +++ b/test/sys/devices/platform/dock.0/modalias @@ -0,0 +1 @@ +platform:dock diff --git a/test/sys/devices/platform/dock.0/power/wakeup b/test/sys/devices/platform/dock.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/dock.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/dock.0/subsystem b/test/sys/devices/platform/dock.0/subsystem new file mode 120000 index 0000000000..deb3a3fbdd --- /dev/null +++ b/test/sys/devices/platform/dock.0/subsystem @@ -0,0 +1 @@ +../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/dock.0/uevent b/test/sys/devices/platform/dock.0/uevent new file mode 100644 index 0000000000..ba0fe39c25 --- /dev/null +++ b/test/sys/devices/platform/dock.0/uevent @@ -0,0 +1 @@ +MODALIAS=platform:dock diff --git a/test/sys/devices/platform/dock.0/uid b/test/sys/devices/platform/dock.0/uid new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/dock.0/uid @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/driver b/test/sys/devices/platform/i8042/driver new file mode 120000 index 0000000000..4afb21678f --- /dev/null +++ b/test/sys/devices/platform/i8042/driver @@ -0,0 +1 @@ +../../../bus/platform/drivers/i8042 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/modalias b/test/sys/devices/platform/i8042/modalias new file mode 100644 index 0000000000..c28b0df3d2 --- /dev/null +++ b/test/sys/devices/platform/i8042/modalias @@ -0,0 +1 @@ +platform:i8042 diff --git a/test/sys/devices/platform/i8042/power/wakeup b/test/sys/devices/platform/i8042/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio0/bind_mode b/test/sys/devices/platform/i8042/serio0/bind_mode new file mode 100644 index 0000000000..865faf10cb --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/bind_mode @@ -0,0 +1 @@ +auto diff --git a/test/sys/devices/platform/i8042/serio0/description b/test/sys/devices/platform/i8042/serio0/description new file mode 100644 index 0000000000..12ea600444 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/description @@ -0,0 +1 @@ +i8042 KBD port diff --git a/test/sys/devices/platform/i8042/serio0/driver b/test/sys/devices/platform/i8042/serio0/driver new file mode 120000 index 0000000000..09cf3fed6c --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/driver @@ -0,0 +1 @@ +../../../../bus/serio/drivers/atkbd \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/err_count b/test/sys/devices/platform/i8042/serio0/err_count new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/err_count @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio0/extra b/test/sys/devices/platform/i8042/serio0/extra new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/extra @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio0/id/extra b/test/sys/devices/platform/i8042/serio0/id/extra new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/id/extra @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/platform/i8042/serio0/id/id b/test/sys/devices/platform/i8042/serio0/id/id new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/id/id @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/platform/i8042/serio0/id/proto b/test/sys/devices/platform/i8042/serio0/id/proto new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/id/proto @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/platform/i8042/serio0/id/type b/test/sys/devices/platform/i8042/serio0/id/type new file mode 100644 index 0000000000..cd672a533b --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/id/type @@ -0,0 +1 @@ +06 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/abs b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/abs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/abs @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ev b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ev new file mode 100644 index 0000000000..a1fc5336aa --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ev @@ -0,0 +1 @@ +120013 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ff b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ff new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ff @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/key b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/key new file mode 100644 index 0000000000..8ac71fcd8e --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/key @@ -0,0 +1 @@ +402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/led b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/led new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/led @@ -0,0 +1 @@ +7 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/msc b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/msc new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/msc @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/rel b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/rel new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/rel @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/snd b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/snd new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/snd @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/sw b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/sw new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/sw @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/device b/test/sys/devices/platform/i8042/serio0/input/input0/device new file mode 120000 index 0000000000..a67cb96f47 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/device @@ -0,0 +1 @@ +../../../serio0 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/dev b/test/sys/devices/platform/i8042/serio0/input/input0/event0/dev new file mode 100644 index 0000000000..5f9cbbd304 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/event0/dev @@ -0,0 +1 @@ +13:64 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/device b/test/sys/devices/platform/i8042/serio0/input/input0/event0/device new file mode 120000 index 0000000000..1b1db35805 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/event0/device @@ -0,0 +1 @@ +../../input0 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/power/wakeup b/test/sys/devices/platform/i8042/serio0/input/input0/event0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/event0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/subsystem b/test/sys/devices/platform/i8042/serio0/input/input0/event0/subsystem new file mode 120000 index 0000000000..adf0173c53 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/event0/subsystem @@ -0,0 +1 @@ +../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/uevent b/test/sys/devices/platform/i8042/serio0/input/input0/event0/uevent new file mode 100644 index 0000000000..e53b86e19e --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/event0/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=64 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/id/bustype b/test/sys/devices/platform/i8042/serio0/input/input0/id/bustype new file mode 100644 index 0000000000..af68ed919d --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/id/bustype @@ -0,0 +1 @@ +0011 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/id/product b/test/sys/devices/platform/i8042/serio0/input/input0/id/product new file mode 100644 index 0000000000..635047563b --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/id/product @@ -0,0 +1 @@ +0001 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/id/vendor b/test/sys/devices/platform/i8042/serio0/input/input0/id/vendor new file mode 100644 index 0000000000..635047563b --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/id/vendor @@ -0,0 +1 @@ +0001 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/id/version b/test/sys/devices/platform/i8042/serio0/input/input0/id/version new file mode 100644 index 0000000000..47173e2bcd --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/id/version @@ -0,0 +1 @@ +ab54 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/modalias b/test/sys/devices/platform/i8042/serio0/input/input0/modalias new file mode 100644 index 0000000000..568c156db6 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/modalias @@ -0,0 +1 @@ +input:b0011v0001p0001eAB54-e0,1,4,11,14,k71,72,73,74,75,76,77,79,7A,7B,7C,7D,7E,7F,80,8C,8E,8F,9B,9C,9D,9E,9F,A3,A4,A5,A6,AC,AD,B7,B8,B9,D9,E2,ram4,l0,1,2,sfw diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/name b/test/sys/devices/platform/i8042/serio0/input/input0/name new file mode 100644 index 0000000000..21187cff1b --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/name @@ -0,0 +1 @@ +AT Translated Set 2 keyboard diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/phys b/test/sys/devices/platform/i8042/serio0/input/input0/phys new file mode 100644 index 0000000000..b20cdbf077 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/phys @@ -0,0 +1 @@ +isa0060/serio0/input0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/power/wakeup b/test/sys/devices/platform/i8042/serio0/input/input0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/subsystem b/test/sys/devices/platform/i8042/serio0/input/input0/subsystem new file mode 120000 index 0000000000..a181f4f9d1 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/subsystem @@ -0,0 +1 @@ +../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/uevent b/test/sys/devices/platform/i8042/serio0/input/input0/uevent new file mode 100644 index 0000000000..0b1c5aa622 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/uevent @@ -0,0 +1,8 @@ +PRODUCT=11/1/1/ab54 +NAME="AT Translated Set 2 keyboard" +PHYS="isa0060/serio0/input0" +EV==120013 +KEY==402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe +MSC==10 +LED==7 +MODALIAS=input:b0011v0001p0001eAB54-e0,1,4,11,14,k71,72,73,74,75,76,77,79,7A,7B,7C,7D,7E,7F,80,8C,8E,8F,9B,9C,9D,9E,9F,A3,A4,A5,A6,AC,AD,B7,B8,B9,D9,E2,ram4,l0,1,2,sfw diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/uniq b/test/sys/devices/platform/i8042/serio0/input/input0/uniq new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/input/input0/uniq @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio0/modalias b/test/sys/devices/platform/i8042/serio0/modalias new file mode 100644 index 0000000000..91a98bc6d1 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/modalias @@ -0,0 +1 @@ +serio:ty06pr00id00ex00 diff --git a/test/sys/devices/platform/i8042/serio0/power/wakeup b/test/sys/devices/platform/i8042/serio0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio0/scroll b/test/sys/devices/platform/i8042/serio0/scroll new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/scroll @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio0/set b/test/sys/devices/platform/i8042/serio0/set new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/set @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/platform/i8042/serio0/softraw b/test/sys/devices/platform/i8042/serio0/softraw new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/softraw @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/platform/i8042/serio0/softrepeat b/test/sys/devices/platform/i8042/serio0/softrepeat new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/softrepeat @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio0/subsystem b/test/sys/devices/platform/i8042/serio0/subsystem new file mode 120000 index 0000000000..cba8f97706 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/subsystem @@ -0,0 +1 @@ +../../../../bus/serio \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/uevent b/test/sys/devices/platform/i8042/serio0/uevent new file mode 100644 index 0000000000..0c1c0bd13a --- /dev/null +++ b/test/sys/devices/platform/i8042/serio0/uevent @@ -0,0 +1,6 @@ +DRIVER=atkbd +SERIO_TYPE=06 +SERIO_PROTO=00 +SERIO_ID=00 +SERIO_EXTRA=00 +MODALIAS=serio:ty06pr00id00ex00 diff --git a/test/sys/devices/platform/i8042/serio1/bind_mode b/test/sys/devices/platform/i8042/serio1/bind_mode new file mode 100644 index 0000000000..865faf10cb --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/bind_mode @@ -0,0 +1 @@ +auto diff --git a/test/sys/devices/platform/i8042/serio1/description b/test/sys/devices/platform/i8042/serio1/description new file mode 100644 index 0000000000..52d76352d8 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/description @@ -0,0 +1 @@ +i8042 AUX port diff --git a/test/sys/devices/platform/i8042/serio1/draghys b/test/sys/devices/platform/i8042/serio1/draghys new file mode 100644 index 0000000000..ace9d03621 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/draghys @@ -0,0 +1 @@ +255 diff --git a/test/sys/devices/platform/i8042/serio1/driver b/test/sys/devices/platform/i8042/serio1/driver new file mode 120000 index 0000000000..fed3e77dee --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/driver @@ -0,0 +1 @@ +../../../../bus/serio/drivers/psmouse \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/ext_dev b/test/sys/devices/platform/i8042/serio1/ext_dev new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/ext_dev @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/platform/i8042/serio1/id/extra b/test/sys/devices/platform/i8042/serio1/id/extra new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/id/extra @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/platform/i8042/serio1/id/id b/test/sys/devices/platform/i8042/serio1/id/id new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/id/id @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/platform/i8042/serio1/id/proto b/test/sys/devices/platform/i8042/serio1/id/proto new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/id/proto @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/platform/i8042/serio1/id/type b/test/sys/devices/platform/i8042/serio1/id/type new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/id/type @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/platform/i8042/serio1/inertia b/test/sys/devices/platform/i8042/serio1/inertia new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/inertia @@ -0,0 +1 @@ +6 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/abs b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/abs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/abs @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ev b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ev new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ev @@ -0,0 +1 @@ +7 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ff b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ff new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ff @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/key b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/key new file mode 100644 index 0000000000..844d194187 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/key @@ -0,0 +1 @@ +70000 0 0 0 0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/led b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/led new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/led @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/msc b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/msc new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/msc @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/rel b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/rel new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/rel @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/snd b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/snd new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/snd @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/sw b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/sw new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/sw @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/device b/test/sys/devices/platform/i8042/serio1/input/input1/device new file mode 120000 index 0000000000..ce36cfb05c --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/device @@ -0,0 +1 @@ +../../../serio1 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/dev b/test/sys/devices/platform/i8042/serio1/input/input1/event1/dev new file mode 100644 index 0000000000..09ab49186c --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/event1/dev @@ -0,0 +1 @@ +13:65 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/device b/test/sys/devices/platform/i8042/serio1/input/input1/event1/device new file mode 120000 index 0000000000..37ba281756 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/event1/device @@ -0,0 +1 @@ +../../input1 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/power/wakeup b/test/sys/devices/platform/i8042/serio1/input/input1/event1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/event1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/subsystem b/test/sys/devices/platform/i8042/serio1/input/input1/event1/subsystem new file mode 120000 index 0000000000..adf0173c53 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/event1/subsystem @@ -0,0 +1 @@ +../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/uevent b/test/sys/devices/platform/i8042/serio1/input/input1/event1/uevent new file mode 100644 index 0000000000..07a5840c3e --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/event1/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=65 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/id/bustype b/test/sys/devices/platform/i8042/serio1/input/input1/id/bustype new file mode 100644 index 0000000000..af68ed919d --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/id/bustype @@ -0,0 +1 @@ +0011 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/id/product b/test/sys/devices/platform/i8042/serio1/input/input1/id/product new file mode 100644 index 0000000000..7182ba593d --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/id/product @@ -0,0 +1 @@ +000a diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/id/vendor b/test/sys/devices/platform/i8042/serio1/input/input1/id/vendor new file mode 100644 index 0000000000..5fca1fda0b --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/id/vendor @@ -0,0 +1 @@ +0002 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/id/version b/test/sys/devices/platform/i8042/serio1/input/input1/id/version new file mode 100644 index 0000000000..739d79706d --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/id/version @@ -0,0 +1 @@ +0000 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/modalias b/test/sys/devices/platform/i8042/serio1/input/input1/modalias new file mode 100644 index 0000000000..b962fcbfa8 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/modalias @@ -0,0 +1 @@ +input:b0011v0002p000Ae0000-e0,1,2,k110,111,112,r0,1,amlsfw diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/dev b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/dev new file mode 100644 index 0000000000..9fd5b64561 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/dev @@ -0,0 +1 @@ +13:32 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/device b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/device new file mode 120000 index 0000000000..37ba281756 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/device @@ -0,0 +1 @@ +../../input1 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/power/wakeup b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/subsystem b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/subsystem new file mode 120000 index 0000000000..adf0173c53 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/subsystem @@ -0,0 +1 @@ +../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/uevent b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/uevent new file mode 100644 index 0000000000..ac16de1c56 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=32 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/name b/test/sys/devices/platform/i8042/serio1/input/input1/name new file mode 100644 index 0000000000..c571620617 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/name @@ -0,0 +1 @@ +TPPS/2 IBM TrackPoint diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/phys b/test/sys/devices/platform/i8042/serio1/input/input1/phys new file mode 100644 index 0000000000..1e40530d5d --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/phys @@ -0,0 +1 @@ +isa0060/serio1/input0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/power/wakeup b/test/sys/devices/platform/i8042/serio1/input/input1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/subsystem b/test/sys/devices/platform/i8042/serio1/input/input1/subsystem new file mode 120000 index 0000000000..a181f4f9d1 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/subsystem @@ -0,0 +1 @@ +../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/uevent b/test/sys/devices/platform/i8042/serio1/input/input1/uevent new file mode 100644 index 0000000000..bbe9314bb1 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/uevent @@ -0,0 +1,7 @@ +PRODUCT=11/2/a/0 +NAME="TPPS/2 IBM TrackPoint" +PHYS="isa0060/serio1/input0" +EV==7 +KEY==70000 0 0 0 0 +REL==3 +MODALIAS=input:b0011v0002p000Ae0000-e0,1,2,k110,111,112,r0,1,amlsfw diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/uniq b/test/sys/devices/platform/i8042/serio1/input/input1/uniq new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/input/input1/uniq @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio1/jenks b/test/sys/devices/platform/i8042/serio1/jenks new file mode 100644 index 0000000000..c8b255fc8e --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/jenks @@ -0,0 +1 @@ +135 diff --git a/test/sys/devices/platform/i8042/serio1/mindrag b/test/sys/devices/platform/i8042/serio1/mindrag new file mode 100644 index 0000000000..209e3ef4b6 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/mindrag @@ -0,0 +1 @@ +20 diff --git a/test/sys/devices/platform/i8042/serio1/modalias b/test/sys/devices/platform/i8042/serio1/modalias new file mode 100644 index 0000000000..2c6c3b4b93 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/modalias @@ -0,0 +1 @@ +serio:ty01pr00id00ex00 diff --git a/test/sys/devices/platform/i8042/serio1/power/wakeup b/test/sys/devices/platform/i8042/serio1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/i8042/serio1/press_to_select b/test/sys/devices/platform/i8042/serio1/press_to_select new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/press_to_select @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio1/protocol b/test/sys/devices/platform/i8042/serio1/protocol new file mode 100644 index 0000000000..87c11d491c --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/protocol @@ -0,0 +1 @@ +TPPS/2 diff --git a/test/sys/devices/platform/i8042/serio1/rate b/test/sys/devices/platform/i8042/serio1/rate new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/rate @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/platform/i8042/serio1/reach b/test/sys/devices/platform/i8042/serio1/reach new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/reach @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/platform/i8042/serio1/resetafter b/test/sys/devices/platform/i8042/serio1/resetafter new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/resetafter @@ -0,0 +1 @@ +5 diff --git a/test/sys/devices/platform/i8042/serio1/resolution b/test/sys/devices/platform/i8042/serio1/resolution new file mode 100644 index 0000000000..08839f6bb2 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/resolution @@ -0,0 +1 @@ +200 diff --git a/test/sys/devices/platform/i8042/serio1/resync_time b/test/sys/devices/platform/i8042/serio1/resync_time new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/resync_time @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio1/sensitivity b/test/sys/devices/platform/i8042/serio1/sensitivity new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/sensitivity @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/platform/i8042/serio1/skipback b/test/sys/devices/platform/i8042/serio1/skipback new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/skipback @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/i8042/serio1/speed b/test/sys/devices/platform/i8042/serio1/speed new file mode 100644 index 0000000000..c17e934b51 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/speed @@ -0,0 +1 @@ +97 diff --git a/test/sys/devices/platform/i8042/serio1/subsystem b/test/sys/devices/platform/i8042/serio1/subsystem new file mode 120000 index 0000000000..cba8f97706 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/subsystem @@ -0,0 +1 @@ +../../../../bus/serio \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/thresh b/test/sys/devices/platform/i8042/serio1/thresh new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/thresh @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/platform/i8042/serio1/uevent b/test/sys/devices/platform/i8042/serio1/uevent new file mode 100644 index 0000000000..36b5a6a578 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/uevent @@ -0,0 +1,6 @@ +DRIVER=psmouse +SERIO_TYPE=01 +SERIO_PROTO=00 +SERIO_ID=00 +SERIO_EXTRA=00 +MODALIAS=serio:ty01pr00id00ex00 diff --git a/test/sys/devices/platform/i8042/serio1/upthresh b/test/sys/devices/platform/i8042/serio1/upthresh new file mode 100644 index 0000000000..ace9d03621 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/upthresh @@ -0,0 +1 @@ +255 diff --git a/test/sys/devices/platform/i8042/serio1/ztime b/test/sys/devices/platform/i8042/serio1/ztime new file mode 100644 index 0000000000..e522732c77 --- /dev/null +++ b/test/sys/devices/platform/i8042/serio1/ztime @@ -0,0 +1 @@ +38 diff --git a/test/sys/devices/platform/i8042/subsystem b/test/sys/devices/platform/i8042/subsystem new file mode 120000 index 0000000000..deb3a3fbdd --- /dev/null +++ b/test/sys/devices/platform/i8042/subsystem @@ -0,0 +1 @@ +../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/uevent b/test/sys/devices/platform/i8042/uevent new file mode 100644 index 0000000000..d66517d1d8 --- /dev/null +++ b/test/sys/devices/platform/i8042/uevent @@ -0,0 +1,2 @@ +DRIVER=i8042 +MODALIAS=platform:i8042 diff --git a/test/sys/devices/platform/microcode/modalias b/test/sys/devices/platform/microcode/modalias new file mode 100644 index 0000000000..85dd39961e --- /dev/null +++ b/test/sys/devices/platform/microcode/modalias @@ -0,0 +1 @@ +platform:microcode diff --git a/test/sys/devices/platform/microcode/power/wakeup b/test/sys/devices/platform/microcode/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/microcode/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/microcode/subsystem b/test/sys/devices/platform/microcode/subsystem new file mode 120000 index 0000000000..deb3a3fbdd --- /dev/null +++ b/test/sys/devices/platform/microcode/subsystem @@ -0,0 +1 @@ +../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/microcode/uevent b/test/sys/devices/platform/microcode/uevent new file mode 100644 index 0000000000..8ee65c8412 --- /dev/null +++ b/test/sys/devices/platform/microcode/uevent @@ -0,0 +1 @@ +MODALIAS=platform:microcode diff --git a/test/sys/devices/platform/pcspkr/driver b/test/sys/devices/platform/pcspkr/driver new file mode 120000 index 0000000000..44af544108 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/driver @@ -0,0 +1 @@ +../../../bus/platform/drivers/pcspkr \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/abs b/test/sys/devices/platform/pcspkr/input/input2/capabilities/abs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/capabilities/abs @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/ev b/test/sys/devices/platform/pcspkr/input/input2/capabilities/ev new file mode 100644 index 0000000000..acd6c0ecb9 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/capabilities/ev @@ -0,0 +1 @@ +40001 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/ff b/test/sys/devices/platform/pcspkr/input/input2/capabilities/ff new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/capabilities/ff @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/key b/test/sys/devices/platform/pcspkr/input/input2/capabilities/key new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/capabilities/key @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/led b/test/sys/devices/platform/pcspkr/input/input2/capabilities/led new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/capabilities/led @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/msc b/test/sys/devices/platform/pcspkr/input/input2/capabilities/msc new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/capabilities/msc @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/rel b/test/sys/devices/platform/pcspkr/input/input2/capabilities/rel new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/capabilities/rel @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/snd b/test/sys/devices/platform/pcspkr/input/input2/capabilities/snd new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/capabilities/snd @@ -0,0 +1 @@ +6 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/sw b/test/sys/devices/platform/pcspkr/input/input2/capabilities/sw new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/capabilities/sw @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/device b/test/sys/devices/platform/pcspkr/input/input2/device new file mode 120000 index 0000000000..da50b6db55 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/device @@ -0,0 +1 @@ +../../../pcspkr \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/dev b/test/sys/devices/platform/pcspkr/input/input2/event2/dev new file mode 100644 index 0000000000..a72362ad0a --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/event2/dev @@ -0,0 +1 @@ +13:66 diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/device b/test/sys/devices/platform/pcspkr/input/input2/event2/device new file mode 120000 index 0000000000..174b819910 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/event2/device @@ -0,0 +1 @@ +../../input2 \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/power/wakeup b/test/sys/devices/platform/pcspkr/input/input2/event2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/event2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/subsystem b/test/sys/devices/platform/pcspkr/input/input2/event2/subsystem new file mode 120000 index 0000000000..a181f4f9d1 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/event2/subsystem @@ -0,0 +1 @@ +../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/uevent b/test/sys/devices/platform/pcspkr/input/input2/event2/uevent new file mode 100644 index 0000000000..7bf99838b9 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/event2/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=66 diff --git a/test/sys/devices/platform/pcspkr/input/input2/id/bustype b/test/sys/devices/platform/pcspkr/input/input2/id/bustype new file mode 100644 index 0000000000..66375d5000 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/id/bustype @@ -0,0 +1 @@ +0010 diff --git a/test/sys/devices/platform/pcspkr/input/input2/id/product b/test/sys/devices/platform/pcspkr/input/input2/id/product new file mode 100644 index 0000000000..635047563b --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/id/product @@ -0,0 +1 @@ +0001 diff --git a/test/sys/devices/platform/pcspkr/input/input2/id/vendor b/test/sys/devices/platform/pcspkr/input/input2/id/vendor new file mode 100644 index 0000000000..fc50928281 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/id/vendor @@ -0,0 +1 @@ +001f diff --git a/test/sys/devices/platform/pcspkr/input/input2/id/version b/test/sys/devices/platform/pcspkr/input/input2/id/version new file mode 100644 index 0000000000..e199843fc5 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/id/version @@ -0,0 +1 @@ +0100 diff --git a/test/sys/devices/platform/pcspkr/input/input2/modalias b/test/sys/devices/platform/pcspkr/input/input2/modalias new file mode 100644 index 0000000000..14cc19ee12 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/modalias @@ -0,0 +1 @@ +input:b0010v001Fp0001e0100-e0,12,kramls1,2,fw diff --git a/test/sys/devices/platform/pcspkr/input/input2/name b/test/sys/devices/platform/pcspkr/input/input2/name new file mode 100644 index 0000000000..6c731d3902 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/name @@ -0,0 +1 @@ +PC Speaker diff --git a/test/sys/devices/platform/pcspkr/input/input2/phys b/test/sys/devices/platform/pcspkr/input/input2/phys new file mode 100644 index 0000000000..798e7ffd0e --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/phys @@ -0,0 +1 @@ +isa0061/input0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/power/wakeup b/test/sys/devices/platform/pcspkr/input/input2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/pcspkr/input/input2/subsystem b/test/sys/devices/platform/pcspkr/input/input2/subsystem new file mode 120000 index 0000000000..bd2a91fcf2 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/subsystem @@ -0,0 +1 @@ +../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/uevent b/test/sys/devices/platform/pcspkr/input/input2/uevent new file mode 100644 index 0000000000..1d9916ca72 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/uevent @@ -0,0 +1,6 @@ +PRODUCT=10/1f/1/100 +NAME="PC Speaker" +PHYS="isa0061/input0" +EV==40001 +SND==6 +MODALIAS=input:b0010v001Fp0001e0100-e0,12,kramls1,2,fw diff --git a/test/sys/devices/platform/pcspkr/input/input2/uniq b/test/sys/devices/platform/pcspkr/input/input2/uniq new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/input/input2/uniq @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/pcspkr/modalias b/test/sys/devices/platform/pcspkr/modalias new file mode 100644 index 0000000000..c42b3b35bb --- /dev/null +++ b/test/sys/devices/platform/pcspkr/modalias @@ -0,0 +1 @@ +platform:pcspkr diff --git a/test/sys/devices/platform/pcspkr/power/wakeup b/test/sys/devices/platform/pcspkr/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/pcspkr/subsystem b/test/sys/devices/platform/pcspkr/subsystem new file mode 120000 index 0000000000..deb3a3fbdd --- /dev/null +++ b/test/sys/devices/platform/pcspkr/subsystem @@ -0,0 +1 @@ +../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/uevent b/test/sys/devices/platform/pcspkr/uevent new file mode 100644 index 0000000000..b570adefa2 --- /dev/null +++ b/test/sys/devices/platform/pcspkr/uevent @@ -0,0 +1,2 @@ +DRIVER=pcspkr +MODALIAS=platform:pcspkr diff --git a/test/sys/devices/platform/power/wakeup b/test/sys/devices/platform/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/serial8250/driver b/test/sys/devices/platform/serial8250/driver new file mode 120000 index 0000000000..0bb0a3f502 --- /dev/null +++ b/test/sys/devices/platform/serial8250/driver @@ -0,0 +1 @@ +../../../bus/platform/drivers/serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/modalias b/test/sys/devices/platform/serial8250/modalias new file mode 100644 index 0000000000..d8875a5672 --- /dev/null +++ b/test/sys/devices/platform/serial8250/modalias @@ -0,0 +1 @@ +platform:serial8250 diff --git a/test/sys/devices/platform/serial8250/power/wakeup b/test/sys/devices/platform/serial8250/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/serial8250/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/serial8250/subsystem b/test/sys/devices/platform/serial8250/subsystem new file mode 120000 index 0000000000..deb3a3fbdd --- /dev/null +++ b/test/sys/devices/platform/serial8250/subsystem @@ -0,0 +1 @@ +../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/dev b/test/sys/devices/platform/serial8250/tty/ttyS0/dev new file mode 100644 index 0000000000..9f6b667886 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS0/dev @@ -0,0 +1 @@ +4:64 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/device b/test/sys/devices/platform/serial8250/tty/ttyS0/device new file mode 120000 index 0000000000..aeed1b12f5 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS0/device @@ -0,0 +1 @@ +../../../serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/power/wakeup b/test/sys/devices/platform/serial8250/tty/ttyS0/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS0/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/subsystem b/test/sys/devices/platform/serial8250/tty/ttyS0/subsystem new file mode 120000 index 0000000000..2c914ca516 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS0/subsystem @@ -0,0 +1 @@ +../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/uevent b/test/sys/devices/platform/serial8250/tty/ttyS0/uevent new file mode 100644 index 0000000000..defc92d919 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS0/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=64 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/dev b/test/sys/devices/platform/serial8250/tty/ttyS1/dev new file mode 100644 index 0000000000..db3f8ecdcd --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS1/dev @@ -0,0 +1 @@ +4:65 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/device b/test/sys/devices/platform/serial8250/tty/ttyS1/device new file mode 120000 index 0000000000..aeed1b12f5 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS1/device @@ -0,0 +1 @@ +../../../serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/power/wakeup b/test/sys/devices/platform/serial8250/tty/ttyS1/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS1/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/subsystem b/test/sys/devices/platform/serial8250/tty/ttyS1/subsystem new file mode 120000 index 0000000000..2c914ca516 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS1/subsystem @@ -0,0 +1 @@ +../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/uevent b/test/sys/devices/platform/serial8250/tty/ttyS1/uevent new file mode 100644 index 0000000000..8a073e38da --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS1/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=65 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/dev b/test/sys/devices/platform/serial8250/tty/ttyS2/dev new file mode 100644 index 0000000000..cef5d02fd9 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS2/dev @@ -0,0 +1 @@ +4:66 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/device b/test/sys/devices/platform/serial8250/tty/ttyS2/device new file mode 120000 index 0000000000..aeed1b12f5 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS2/device @@ -0,0 +1 @@ +../../../serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/power/wakeup b/test/sys/devices/platform/serial8250/tty/ttyS2/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS2/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/subsystem b/test/sys/devices/platform/serial8250/tty/ttyS2/subsystem new file mode 120000 index 0000000000..2c914ca516 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS2/subsystem @@ -0,0 +1 @@ +../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/uevent b/test/sys/devices/platform/serial8250/tty/ttyS2/uevent new file mode 100644 index 0000000000..f3202231b5 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS2/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=66 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/dev b/test/sys/devices/platform/serial8250/tty/ttyS3/dev new file mode 100644 index 0000000000..3077006e7a --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS3/dev @@ -0,0 +1 @@ +4:67 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/device b/test/sys/devices/platform/serial8250/tty/ttyS3/device new file mode 120000 index 0000000000..aeed1b12f5 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS3/device @@ -0,0 +1 @@ +../../../serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/power/wakeup b/test/sys/devices/platform/serial8250/tty/ttyS3/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS3/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/subsystem b/test/sys/devices/platform/serial8250/tty/ttyS3/subsystem new file mode 120000 index 0000000000..2c914ca516 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS3/subsystem @@ -0,0 +1 @@ +../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/uevent b/test/sys/devices/platform/serial8250/tty/ttyS3/uevent new file mode 100644 index 0000000000..bc5fa8f157 --- /dev/null +++ b/test/sys/devices/platform/serial8250/tty/ttyS3/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=67 diff --git a/test/sys/devices/platform/serial8250/uevent b/test/sys/devices/platform/serial8250/uevent new file mode 100644 index 0000000000..00b8c5f66d --- /dev/null +++ b/test/sys/devices/platform/serial8250/uevent @@ -0,0 +1,2 @@ +DRIVER=serial8250 +MODALIAS=platform:serial8250 diff --git a/test/sys/devices/platform/thinkpad_acpi/bluetooth_enable b/test/sys/devices/platform/thinkpad_acpi/bluetooth_enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/bluetooth_enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/platform/thinkpad_acpi/driver b/test/sys/devices/platform/thinkpad_acpi/driver new file mode 120000 index 0000000000..388b2236b0 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/driver @@ -0,0 +1 @@ +../../../bus/platform/drivers/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_all_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_all_mask new file mode 100644 index 0000000000..74f4cb244f --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_all_mask @@ -0,0 +1 @@ +0x00ffffff diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_enabled b/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_enabled new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_enabled @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_mask new file mode 100644 index 0000000000..b5c557ab01 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_mask @@ -0,0 +1 @@ +0x0000080c diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_enable b/test/sys/devices/platform/thinkpad_acpi/hotkey_enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_mask new file mode 100644 index 0000000000..74f4cb244f --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_mask @@ -0,0 +1 @@ +0x00ffffff diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_poll_freq b/test/sys/devices/platform/thinkpad_acpi/hotkey_poll_freq new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_poll_freq @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_radio_sw b/test/sys/devices/platform/thinkpad_acpi/hotkey_radio_sw new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_radio_sw @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_recommended_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_recommended_mask new file mode 100644 index 0000000000..7e5947ab27 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_recommended_mask @@ -0,0 +1 @@ +0x008c7fff diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_report_mode b/test/sys/devices/platform/thinkpad_acpi/hotkey_report_mode new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_report_mode @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_source_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_source_mask new file mode 100644 index 0000000000..e79e876aae --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/hotkey_source_mask @@ -0,0 +1 @@ +0x00000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/brightness differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/subsystem new file mode 120000 index 0000000000..46e2484aa6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/subsystem @@ -0,0 +1 @@ +../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/trigger new file mode 100644 index 0000000000..d29a9f783c --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/trigger @@ -0,0 +1 @@ +[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/brightness differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/subsystem new file mode 120000 index 0000000000..46e2484aa6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/subsystem @@ -0,0 +1 @@ +../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/trigger new file mode 100644 index 0000000000..d29a9f783c --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/trigger @@ -0,0 +1 @@ +[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/brightness differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/subsystem new file mode 120000 index 0000000000..46e2484aa6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/subsystem @@ -0,0 +1 @@ +../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/trigger new file mode 100644 index 0000000000..d29a9f783c --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/trigger @@ -0,0 +1 @@ +[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/subsystem new file mode 120000 index 0000000000..46e2484aa6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/subsystem @@ -0,0 +1 @@ +../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/trigger new file mode 100644 index 0000000000..d29a9f783c --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/trigger @@ -0,0 +1 @@ +[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/brightness differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/subsystem new file mode 120000 index 0000000000..46e2484aa6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/subsystem @@ -0,0 +1 @@ +../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/trigger new file mode 100644 index 0000000000..d29a9f783c --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/trigger @@ -0,0 +1 @@ +[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness new file mode 100644 index 0000000000..8364fdecfc Binary files /dev/null and b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/subsystem new file mode 120000 index 0000000000..46e2484aa6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/subsystem @@ -0,0 +1 @@ +../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/trigger new file mode 100644 index 0000000000..d29a9f783c --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/trigger @@ -0,0 +1 @@ +[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/brightness differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/subsystem new file mode 120000 index 0000000000..46e2484aa6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/subsystem @@ -0,0 +1 @@ +../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/trigger new file mode 100644 index 0000000000..d29a9f783c --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/trigger @@ -0,0 +1 @@ +[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/brightness differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/subsystem new file mode 120000 index 0000000000..46e2484aa6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/subsystem @@ -0,0 +1 @@ +../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/trigger new file mode 100644 index 0000000000..d29a9f783c --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/trigger @@ -0,0 +1 @@ +[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/brightness new file mode 100644 index 0000000000..c1da2e294b Binary files /dev/null and b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/brightness differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/subsystem new file mode 120000 index 0000000000..46e2484aa6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/subsystem @@ -0,0 +1 @@ +../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/trigger new file mode 100644 index 0000000000..d29a9f783c --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/trigger @@ -0,0 +1 @@ +[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_acpi/modalias b/test/sys/devices/platform/thinkpad_acpi/modalias new file mode 100644 index 0000000000..6a50447be6 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/modalias @@ -0,0 +1 @@ +platform:thinkpad_acpi diff --git a/test/sys/devices/platform/thinkpad_acpi/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/claim b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/claim new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/claim @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/device b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/device new file mode 120000 index 0000000000..bd6c926505 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/device @@ -0,0 +1 @@ +../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/name b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/name new file mode 100644 index 0000000000..28b8511147 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/name @@ -0,0 +1 @@ +tpacpi_bluetooth_sw diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/subsystem b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/subsystem new file mode 120000 index 0000000000..5a34d65f45 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/subsystem @@ -0,0 +1 @@ +../../../../../class/rfkill \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/type b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/type new file mode 100644 index 0000000000..89e437991e --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/type @@ -0,0 +1 @@ +bluetooth diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/uevent b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/uevent new file mode 100644 index 0000000000..1a870a5240 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/uevent @@ -0,0 +1,3 @@ +RFKILL_NAME=tpacpi_bluetooth_sw +RFKILL_TYPE=bluetooth +RFKILL_STATE=1 diff --git a/test/sys/devices/platform/thinkpad_acpi/subsystem b/test/sys/devices/platform/thinkpad_acpi/subsystem new file mode 120000 index 0000000000..deb3a3fbdd --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/subsystem @@ -0,0 +1 @@ +../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/uevent b/test/sys/devices/platform/thinkpad_acpi/uevent new file mode 100644 index 0000000000..1aa572cc2a --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/uevent @@ -0,0 +1,2 @@ +DRIVER=thinkpad_acpi +MODALIAS=platform:thinkpad_acpi diff --git a/test/sys/devices/platform/thinkpad_acpi/wakeup_hotunplug_complete b/test/sys/devices/platform/thinkpad_acpi/wakeup_hotunplug_complete new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/wakeup_hotunplug_complete @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/thinkpad_acpi/wakeup_reason b/test/sys/devices/platform/thinkpad_acpi/wakeup_reason new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_acpi/wakeup_reason @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/thinkpad_hwmon/driver b/test/sys/devices/platform/thinkpad_hwmon/driver new file mode 120000 index 0000000000..b34f0fde53 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/driver @@ -0,0 +1 @@ +../../../bus/platform/drivers/thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_hwmon/fan1_input b/test/sys/devices/platform/thinkpad_hwmon/fan1_input new file mode 100644 index 0000000000..f35c48ca69 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/fan1_input @@ -0,0 +1 @@ +3373 diff --git a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/device b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/device new file mode 120000 index 0000000000..152dbac4e0 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/device @@ -0,0 +1 @@ +../../../thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/power/wakeup b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/subsystem b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/subsystem new file mode 120000 index 0000000000..c02ab68b5d --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/subsystem @@ -0,0 +1 @@ +../../../../../class/hwmon \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/uevent b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/modalias b/test/sys/devices/platform/thinkpad_hwmon/modalias new file mode 100644 index 0000000000..9208eea4e0 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/modalias @@ -0,0 +1 @@ +platform:thinkpad_hwmon diff --git a/test/sys/devices/platform/thinkpad_hwmon/name b/test/sys/devices/platform/thinkpad_hwmon/name new file mode 100644 index 0000000000..d282e4fa6f --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/name @@ -0,0 +1 @@ +thinkpad diff --git a/test/sys/devices/platform/thinkpad_hwmon/power/wakeup b/test/sys/devices/platform/thinkpad_hwmon/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/thinkpad_hwmon/pwm1 b/test/sys/devices/platform/thinkpad_hwmon/pwm1 new file mode 100644 index 0000000000..ace9d03621 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/pwm1 @@ -0,0 +1 @@ +255 diff --git a/test/sys/devices/platform/thinkpad_hwmon/pwm1_enable b/test/sys/devices/platform/thinkpad_hwmon/pwm1_enable new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/pwm1_enable @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/subsystem b/test/sys/devices/platform/thinkpad_hwmon/subsystem new file mode 120000 index 0000000000..deb3a3fbdd --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/subsystem @@ -0,0 +1 @@ +../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp10_input b/test/sys/devices/platform/thinkpad_hwmon/temp10_input new file mode 100644 index 0000000000..ccfc37a15d --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/temp10_input @@ -0,0 +1 @@ +50000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp11_input b/test/sys/devices/platform/thinkpad_hwmon/temp11_input new file mode 100644 index 0000000000..afdd418402 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/temp11_input @@ -0,0 +1 @@ +49000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp12_input b/test/sys/devices/platform/thinkpad_hwmon/temp12_input new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp13_input b/test/sys/devices/platform/thinkpad_hwmon/temp13_input new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp14_input b/test/sys/devices/platform/thinkpad_hwmon/temp14_input new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp15_input b/test/sys/devices/platform/thinkpad_hwmon/temp15_input new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp16_input b/test/sys/devices/platform/thinkpad_hwmon/temp16_input new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp1_input b/test/sys/devices/platform/thinkpad_hwmon/temp1_input new file mode 100644 index 0000000000..627c5c7951 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/temp1_input @@ -0,0 +1 @@ +54000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp2_input b/test/sys/devices/platform/thinkpad_hwmon/temp2_input new file mode 100644 index 0000000000..87e00fe2f9 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/temp2_input @@ -0,0 +1 @@ +38000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp3_input b/test/sys/devices/platform/thinkpad_hwmon/temp3_input new file mode 100644 index 0000000000..3404898810 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/temp3_input @@ -0,0 +1 @@ +36000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp4_input b/test/sys/devices/platform/thinkpad_hwmon/temp4_input new file mode 100644 index 0000000000..86541638c0 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/temp4_input @@ -0,0 +1 @@ +68000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp5_input b/test/sys/devices/platform/thinkpad_hwmon/temp5_input new file mode 100644 index 0000000000..a4c83d08c5 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/temp5_input @@ -0,0 +1 @@ +32000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp6_input b/test/sys/devices/platform/thinkpad_hwmon/temp6_input new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp7_input b/test/sys/devices/platform/thinkpad_hwmon/temp7_input new file mode 100644 index 0000000000..3a05c8b3ee --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/temp7_input @@ -0,0 +1 @@ +30000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp8_input b/test/sys/devices/platform/thinkpad_hwmon/temp8_input new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp9_input b/test/sys/devices/platform/thinkpad_hwmon/temp9_input new file mode 100644 index 0000000000..87e00fe2f9 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/temp9_input @@ -0,0 +1 @@ +38000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/uevent b/test/sys/devices/platform/thinkpad_hwmon/uevent new file mode 100644 index 0000000000..a155fce352 --- /dev/null +++ b/test/sys/devices/platform/thinkpad_hwmon/uevent @@ -0,0 +1,2 @@ +DRIVER=thinkpad_hwmon +MODALIAS=platform:thinkpad_hwmon diff --git a/test/sys/devices/platform/uevent b/test/sys/devices/platform/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/vesafb.0/driver b/test/sys/devices/platform/vesafb.0/driver new file mode 120000 index 0000000000..99735db79f --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/driver @@ -0,0 +1 @@ +../../../bus/platform/drivers/vesafb \ No newline at end of file diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/bits_per_pixel b/test/sys/devices/platform/vesafb.0/graphics/fb0/bits_per_pixel new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/bits_per_pixel @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/blank b/test/sys/devices/platform/vesafb.0/graphics/fb0/blank new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/console b/test/sys/devices/platform/vesafb.0/graphics/fb0/console new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/cursor b/test/sys/devices/platform/vesafb.0/graphics/fb0/cursor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/dev b/test/sys/devices/platform/vesafb.0/graphics/fb0/dev new file mode 100644 index 0000000000..e6032bec01 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/dev @@ -0,0 +1 @@ +29:0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/device b/test/sys/devices/platform/vesafb.0/graphics/fb0/device new file mode 120000 index 0000000000..ac00bf6034 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/device @@ -0,0 +1 @@ +../../../vesafb.0 \ No newline at end of file diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/mode b/test/sys/devices/platform/vesafb.0/graphics/fb0/mode new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/modes b/test/sys/devices/platform/vesafb.0/graphics/fb0/modes new file mode 100644 index 0000000000..9a8863a213 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/modes @@ -0,0 +1 @@ +U:800x600p-75 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/name b/test/sys/devices/platform/vesafb.0/graphics/fb0/name new file mode 100644 index 0000000000..b1f2d26618 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/name @@ -0,0 +1 @@ +VESA VGA diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/pan b/test/sys/devices/platform/vesafb.0/graphics/fb0/pan new file mode 100644 index 0000000000..15794e0070 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/pan @@ -0,0 +1 @@ +0,0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/power/wakeup b/test/sys/devices/platform/vesafb.0/graphics/fb0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/rotate b/test/sys/devices/platform/vesafb.0/graphics/fb0/rotate new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/rotate @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/state b/test/sys/devices/platform/vesafb.0/graphics/fb0/state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/stride b/test/sys/devices/platform/vesafb.0/graphics/fb0/stride new file mode 100644 index 0000000000..b67470f1dc --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/stride @@ -0,0 +1 @@ +1600 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/subsystem b/test/sys/devices/platform/vesafb.0/graphics/fb0/subsystem new file mode 120000 index 0000000000..4272ecbd5f --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/subsystem @@ -0,0 +1 @@ +../../../../../class/graphics \ No newline at end of file diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/uevent b/test/sys/devices/platform/vesafb.0/graphics/fb0/uevent new file mode 100644 index 0000000000..92a188018b --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/uevent @@ -0,0 +1,2 @@ +MAJOR=29 +MINOR=0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/virtual_size b/test/sys/devices/platform/vesafb.0/graphics/fb0/virtual_size new file mode 100644 index 0000000000..80d581f413 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/graphics/fb0/virtual_size @@ -0,0 +1 @@ +800,600 diff --git a/test/sys/devices/platform/vesafb.0/modalias b/test/sys/devices/platform/vesafb.0/modalias new file mode 100644 index 0000000000..a09e0f64e2 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/modalias @@ -0,0 +1 @@ +platform:vesafb diff --git a/test/sys/devices/platform/vesafb.0/power/wakeup b/test/sys/devices/platform/vesafb.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/platform/vesafb.0/subsystem b/test/sys/devices/platform/vesafb.0/subsystem new file mode 120000 index 0000000000..deb3a3fbdd --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/subsystem @@ -0,0 +1 @@ +../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/vesafb.0/uevent b/test/sys/devices/platform/vesafb.0/uevent new file mode 100644 index 0000000000..dabaf7ddb3 --- /dev/null +++ b/test/sys/devices/platform/vesafb.0/uevent @@ -0,0 +1,2 @@ +DRIVER=vesafb +MODALIAS=platform:vesafb diff --git a/test/sys/devices/pnp0/00:00/driver b/test/sys/devices/pnp0/00:00/driver new file mode 120000 index 0000000000..49809519dd --- /dev/null +++ b/test/sys/devices/pnp0/00:00/driver @@ -0,0 +1 @@ +../../../bus/pnp/drivers/system \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:00/firmware_node b/test/sys/devices/pnp0/00:00/firmware_node new file mode 120000 index 0000000000..2d4d4b4535 --- /dev/null +++ b/test/sys/devices/pnp0/00:00/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0C01:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:00/id b/test/sys/devices/pnp0/00:00/id new file mode 100644 index 0000000000..8a67a657c5 --- /dev/null +++ b/test/sys/devices/pnp0/00:00/id @@ -0,0 +1 @@ +PNP0c01 diff --git a/test/sys/devices/pnp0/00:00/options b/test/sys/devices/pnp0/00:00/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:00/power/wakeup b/test/sys/devices/pnp0/00:00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:00/resources b/test/sys/devices/pnp0/00:00/resources new file mode 100644 index 0000000000..e776f37bcd --- /dev/null +++ b/test/sys/devices/pnp0/00:00/resources @@ -0,0 +1,18 @@ +state = active +mem 0x0-0x9ffff +mem 0xc0000-0xc3fff +mem 0xc4000-0xc7fff +mem 0xc8000-0xcbfff +mem 0xcc000-0xcffff +mem disabled +mem disabled +mem disabled +mem 0xdc000-0xdffff +mem 0xe0000-0xe3fff +mem 0xe4000-0xe7fff +mem 0xe8000-0xebfff +mem 0xec000-0xeffff +mem 0xf0000-0xfffff +mem 0x100000-0x7fffffff +mem 0xfec00000-0xfed3ffff +mem 0xfed41000-0xffffffff diff --git a/test/sys/devices/pnp0/00:00/subsystem b/test/sys/devices/pnp0/00:00/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:00/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:00/uevent b/test/sys/devices/pnp0/00:00/uevent new file mode 100644 index 0000000000..5f289cdaa8 --- /dev/null +++ b/test/sys/devices/pnp0/00:00/uevent @@ -0,0 +1 @@ +DRIVER=system diff --git a/test/sys/devices/pnp0/00:01/id b/test/sys/devices/pnp0/00:01/id new file mode 100644 index 0000000000..ea60bfdf5f --- /dev/null +++ b/test/sys/devices/pnp0/00:01/id @@ -0,0 +1,2 @@ +PNP0a08 +PNP0a03 diff --git a/test/sys/devices/pnp0/00:01/options b/test/sys/devices/pnp0/00:01/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:01/power/wakeup b/test/sys/devices/pnp0/00:01/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:01/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:01/resources b/test/sys/devices/pnp0/00:01/resources new file mode 100644 index 0000000000..f70025a192 --- /dev/null +++ b/test/sys/devices/pnp0/00:01/resources @@ -0,0 +1,2 @@ +state = active +io 0xcf8-0xcff diff --git a/test/sys/devices/pnp0/00:01/subsystem b/test/sys/devices/pnp0/00:01/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:01/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:01/uevent b/test/sys/devices/pnp0/00:01/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:02/driver b/test/sys/devices/pnp0/00:02/driver new file mode 120000 index 0000000000..49809519dd --- /dev/null +++ b/test/sys/devices/pnp0/00:02/driver @@ -0,0 +1 @@ +../../../bus/pnp/drivers/system \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:02/firmware_node b/test/sys/devices/pnp0/00:02/firmware_node new file mode 120000 index 0000000000..7bf7dd260b --- /dev/null +++ b/test/sys/devices/pnp0/00:02/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:02/id b/test/sys/devices/pnp0/00:02/id new file mode 100644 index 0000000000..c6dcd897da --- /dev/null +++ b/test/sys/devices/pnp0/00:02/id @@ -0,0 +1 @@ +PNP0c02 diff --git a/test/sys/devices/pnp0/00:02/options b/test/sys/devices/pnp0/00:02/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:02/power/wakeup b/test/sys/devices/pnp0/00:02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:02/resources b/test/sys/devices/pnp0/00:02/resources new file mode 100644 index 0000000000..0ea5e8e82b --- /dev/null +++ b/test/sys/devices/pnp0/00:02/resources @@ -0,0 +1,30 @@ +state = active +io 0x10-0x1f +io 0x90-0x9f +io 0x24-0x25 +io 0x28-0x29 +io 0x2c-0x2d +io 0x30-0x31 +io 0x34-0x35 +io 0x38-0x39 +io 0x3c-0x3d +io 0xa4-0xa5 +io 0xa8-0xa9 +io 0xac-0xad +io 0xb0-0xb5 +io 0xb8-0xb9 +io 0xbc-0xbd +io 0x50-0x53 +io 0x72-0x77 +io 0x164e-0x164f +io 0x2e-0x2f +io 0x1000-0x107f +io 0x1180-0x11bf +io 0x800-0x80f +io 0x15e0-0x15ef +io 0x1600-0x165f +mem 0xf0000000-0xf3ffffff +mem 0xfed1c000-0xfed1ffff +mem 0xfed14000-0xfed17fff +mem 0xfed18000-0xfed18fff +mem 0xfed19000-0xfed19fff diff --git a/test/sys/devices/pnp0/00:02/subsystem b/test/sys/devices/pnp0/00:02/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:02/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:02/uevent b/test/sys/devices/pnp0/00:02/uevent new file mode 100644 index 0000000000..5f289cdaa8 --- /dev/null +++ b/test/sys/devices/pnp0/00:02/uevent @@ -0,0 +1 @@ +DRIVER=system diff --git a/test/sys/devices/pnp0/00:03/firmware_node b/test/sys/devices/pnp0/00:03/firmware_node new file mode 120000 index 0000000000..f1383eda0f --- /dev/null +++ b/test/sys/devices/pnp0/00:03/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:03/id b/test/sys/devices/pnp0/00:03/id new file mode 100644 index 0000000000..01bdd099b8 --- /dev/null +++ b/test/sys/devices/pnp0/00:03/id @@ -0,0 +1 @@ +PNP0103 diff --git a/test/sys/devices/pnp0/00:03/options b/test/sys/devices/pnp0/00:03/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:03/power/wakeup b/test/sys/devices/pnp0/00:03/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:03/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:03/resources b/test/sys/devices/pnp0/00:03/resources new file mode 100644 index 0000000000..04faff5084 --- /dev/null +++ b/test/sys/devices/pnp0/00:03/resources @@ -0,0 +1,2 @@ +state = active +mem 0xfed00000-0xfed003ff diff --git a/test/sys/devices/pnp0/00:03/subsystem b/test/sys/devices/pnp0/00:03/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:03/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:03/uevent b/test/sys/devices/pnp0/00:03/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:04/firmware_node b/test/sys/devices/pnp0/00:04/firmware_node new file mode 120000 index 0000000000..dfcdf1c3b5 --- /dev/null +++ b/test/sys/devices/pnp0/00:04/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:04/id b/test/sys/devices/pnp0/00:04/id new file mode 100644 index 0000000000..d14c5bc3ff --- /dev/null +++ b/test/sys/devices/pnp0/00:04/id @@ -0,0 +1 @@ +PNP0200 diff --git a/test/sys/devices/pnp0/00:04/options b/test/sys/devices/pnp0/00:04/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:04/power/wakeup b/test/sys/devices/pnp0/00:04/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:04/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:04/resources b/test/sys/devices/pnp0/00:04/resources new file mode 100644 index 0000000000..8d6e436d77 --- /dev/null +++ b/test/sys/devices/pnp0/00:04/resources @@ -0,0 +1,5 @@ +state = active +io 0x0-0xf +io 0x80-0x8f +io 0xc0-0xdf +dma 4 diff --git a/test/sys/devices/pnp0/00:04/subsystem b/test/sys/devices/pnp0/00:04/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:04/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:04/uevent b/test/sys/devices/pnp0/00:04/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:05/firmware_node b/test/sys/devices/pnp0/00:05/firmware_node new file mode 120000 index 0000000000..17eea0d63a --- /dev/null +++ b/test/sys/devices/pnp0/00:05/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:05/id b/test/sys/devices/pnp0/00:05/id new file mode 100644 index 0000000000..aec7221dee --- /dev/null +++ b/test/sys/devices/pnp0/00:05/id @@ -0,0 +1 @@ +PNP0800 diff --git a/test/sys/devices/pnp0/00:05/options b/test/sys/devices/pnp0/00:05/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:05/power/wakeup b/test/sys/devices/pnp0/00:05/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:05/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:05/resources b/test/sys/devices/pnp0/00:05/resources new file mode 100644 index 0000000000..068ca9b670 --- /dev/null +++ b/test/sys/devices/pnp0/00:05/resources @@ -0,0 +1,2 @@ +state = active +io 0x61-0x61 diff --git a/test/sys/devices/pnp0/00:05/subsystem b/test/sys/devices/pnp0/00:05/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:05/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:05/uevent b/test/sys/devices/pnp0/00:05/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:06/firmware_node b/test/sys/devices/pnp0/00:06/firmware_node new file mode 120000 index 0000000000..99a333d2b4 --- /dev/null +++ b/test/sys/devices/pnp0/00:06/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:06/id b/test/sys/devices/pnp0/00:06/id new file mode 100644 index 0000000000..808147da40 --- /dev/null +++ b/test/sys/devices/pnp0/00:06/id @@ -0,0 +1 @@ +PNP0c04 diff --git a/test/sys/devices/pnp0/00:06/options b/test/sys/devices/pnp0/00:06/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:06/power/wakeup b/test/sys/devices/pnp0/00:06/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:06/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:06/resources b/test/sys/devices/pnp0/00:06/resources new file mode 100644 index 0000000000..da2ff4ba78 --- /dev/null +++ b/test/sys/devices/pnp0/00:06/resources @@ -0,0 +1,3 @@ +state = active +io 0xf0-0xf0 +irq 13 diff --git a/test/sys/devices/pnp0/00:06/subsystem b/test/sys/devices/pnp0/00:06/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:06/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:06/uevent b/test/sys/devices/pnp0/00:06/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:07/driver b/test/sys/devices/pnp0/00:07/driver new file mode 120000 index 0000000000..6a8764e224 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/driver @@ -0,0 +1 @@ +../../../bus/pnp/drivers/rtc_cmos \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/firmware_node b/test/sys/devices/pnp0/00:07/firmware_node new file mode 120000 index 0000000000..4154e9a091 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/id b/test/sys/devices/pnp0/00:07/id new file mode 100644 index 0000000000..13b00bc481 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/id @@ -0,0 +1 @@ +PNP0b00 diff --git a/test/sys/devices/pnp0/00:07/nvram b/test/sys/devices/pnp0/00:07/nvram new file mode 100644 index 0000000000..0c4c788d9d Binary files /dev/null and b/test/sys/devices/pnp0/00:07/nvram differ diff --git a/test/sys/devices/pnp0/00:07/options b/test/sys/devices/pnp0/00:07/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:07/power/wakeup b/test/sys/devices/pnp0/00:07/power/wakeup new file mode 100644 index 0000000000..86981e69f6 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/power/wakeup @@ -0,0 +1 @@ +enabled diff --git a/test/sys/devices/pnp0/00:07/resources b/test/sys/devices/pnp0/00:07/resources new file mode 100644 index 0000000000..c697323bf4 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/resources @@ -0,0 +1,3 @@ +state = active +io 0x70-0x71 +irq 8 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/date b/test/sys/devices/pnp0/00:07/rtc/rtc0/date new file mode 100644 index 0000000000..5315755e05 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/date @@ -0,0 +1 @@ +2008-09-29 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/dev b/test/sys/devices/pnp0/00:07/rtc/rtc0/dev new file mode 100644 index 0000000000..0cad52aef5 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/dev @@ -0,0 +1 @@ +253:0 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/device b/test/sys/devices/pnp0/00:07/rtc/rtc0/device new file mode 120000 index 0000000000..617545acf7 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/device @@ -0,0 +1 @@ +../../../00:07 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq b/test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/name b/test/sys/devices/pnp0/00:07/rtc/rtc0/name new file mode 100644 index 0000000000..89830d2bdb --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/name @@ -0,0 +1 @@ +rtc_cmos diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup b/test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch b/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch new file mode 100644 index 0000000000..cd35b7f2d4 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch @@ -0,0 +1 @@ +1222647192 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem b/test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem new file mode 120000 index 0000000000..00b31dd527 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem @@ -0,0 +1 @@ +../../../../../class/rtc \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/time b/test/sys/devices/pnp0/00:07/rtc/rtc0/time new file mode 100644 index 0000000000..c60aa6133d --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/time @@ -0,0 +1 @@ +00:13:12 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/uevent b/test/sys/devices/pnp0/00:07/rtc/rtc0/uevent new file mode 100644 index 0000000000..b04cc3e1d0 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/uevent @@ -0,0 +1,2 @@ +MAJOR=253 +MINOR=0 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/wakealarm b/test/sys/devices/pnp0/00:07/rtc/rtc0/wakealarm new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:07/subsystem b/test/sys/devices/pnp0/00:07/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:07/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/uevent b/test/sys/devices/pnp0/00:07/uevent new file mode 100644 index 0000000000..cb584c04e3 --- /dev/null +++ b/test/sys/devices/pnp0/00:07/uevent @@ -0,0 +1 @@ +DRIVER=rtc_cmos diff --git a/test/sys/devices/pnp0/00:08/driver b/test/sys/devices/pnp0/00:08/driver new file mode 120000 index 0000000000..51bc226008 --- /dev/null +++ b/test/sys/devices/pnp0/00:08/driver @@ -0,0 +1 @@ +../../../bus/pnp/drivers/i8042 kbd \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:08/firmware_node b/test/sys/devices/pnp0/00:08/firmware_node new file mode 120000 index 0000000000..b38ee5b14b --- /dev/null +++ b/test/sys/devices/pnp0/00:08/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:08/id b/test/sys/devices/pnp0/00:08/id new file mode 100644 index 0000000000..958febdd9e --- /dev/null +++ b/test/sys/devices/pnp0/00:08/id @@ -0,0 +1 @@ +PNP0303 diff --git a/test/sys/devices/pnp0/00:08/options b/test/sys/devices/pnp0/00:08/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:08/power/wakeup b/test/sys/devices/pnp0/00:08/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:08/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:08/resources b/test/sys/devices/pnp0/00:08/resources new file mode 100644 index 0000000000..ee3406e25d --- /dev/null +++ b/test/sys/devices/pnp0/00:08/resources @@ -0,0 +1,4 @@ +state = active +io 0x60-0x60 +io 0x64-0x64 +irq 1 diff --git a/test/sys/devices/pnp0/00:08/subsystem b/test/sys/devices/pnp0/00:08/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:08/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:08/uevent b/test/sys/devices/pnp0/00:08/uevent new file mode 100644 index 0000000000..5cde1e92e9 --- /dev/null +++ b/test/sys/devices/pnp0/00:08/uevent @@ -0,0 +1 @@ +DRIVER=i8042 kbd diff --git a/test/sys/devices/pnp0/00:09/driver b/test/sys/devices/pnp0/00:09/driver new file mode 120000 index 0000000000..d34888c126 --- /dev/null +++ b/test/sys/devices/pnp0/00:09/driver @@ -0,0 +1 @@ +../../../bus/pnp/drivers/i8042 aux \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:09/firmware_node b/test/sys/devices/pnp0/00:09/firmware_node new file mode 120000 index 0000000000..05b19685a6 --- /dev/null +++ b/test/sys/devices/pnp0/00:09/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:09/id b/test/sys/devices/pnp0/00:09/id new file mode 100644 index 0000000000..68c3528574 --- /dev/null +++ b/test/sys/devices/pnp0/00:09/id @@ -0,0 +1,2 @@ +IBM0057 +PNP0f13 diff --git a/test/sys/devices/pnp0/00:09/options b/test/sys/devices/pnp0/00:09/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:09/power/wakeup b/test/sys/devices/pnp0/00:09/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:09/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:09/resources b/test/sys/devices/pnp0/00:09/resources new file mode 100644 index 0000000000..76ceb09fcf --- /dev/null +++ b/test/sys/devices/pnp0/00:09/resources @@ -0,0 +1,2 @@ +state = active +irq 12 diff --git a/test/sys/devices/pnp0/00:09/subsystem b/test/sys/devices/pnp0/00:09/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:09/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:09/uevent b/test/sys/devices/pnp0/00:09/uevent new file mode 100644 index 0000000000..da1cb5a961 --- /dev/null +++ b/test/sys/devices/pnp0/00:09/uevent @@ -0,0 +1 @@ +DRIVER=i8042 aux diff --git a/test/sys/devices/pnp0/00:0a/firmware_node b/test/sys/devices/pnp0/00:0a/firmware_node new file mode 120000 index 0000000000..4eaafe596c --- /dev/null +++ b/test/sys/devices/pnp0/00:0a/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:0a/id b/test/sys/devices/pnp0/00:0a/id new file mode 100644 index 0000000000..710874173e --- /dev/null +++ b/test/sys/devices/pnp0/00:0a/id @@ -0,0 +1,2 @@ +ATM1200 +PNP0c31 diff --git a/test/sys/devices/pnp0/00:0a/options b/test/sys/devices/pnp0/00:0a/options new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/00:0a/power/wakeup b/test/sys/devices/pnp0/00:0a/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/00:0a/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/00:0a/resources b/test/sys/devices/pnp0/00:0a/resources new file mode 100644 index 0000000000..eb1cddfd47 --- /dev/null +++ b/test/sys/devices/pnp0/00:0a/resources @@ -0,0 +1,2 @@ +state = active +mem 0xfed40000-0xfed40fff diff --git a/test/sys/devices/pnp0/00:0a/subsystem b/test/sys/devices/pnp0/00:0a/subsystem new file mode 120000 index 0000000000..eca01f4dff --- /dev/null +++ b/test/sys/devices/pnp0/00:0a/subsystem @@ -0,0 +1 @@ +../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:0a/uevent b/test/sys/devices/pnp0/00:0a/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pnp0/power/wakeup b/test/sys/devices/pnp0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pnp0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pnp0/uevent b/test/sys/devices/pnp0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/system/clocksource/clocksource0/available_clocksource b/test/sys/devices/system/clocksource/clocksource0/available_clocksource new file mode 100644 index 0000000000..dbfc0c4897 --- /dev/null +++ b/test/sys/devices/system/clocksource/clocksource0/available_clocksource @@ -0,0 +1 @@ +hpet acpi_pm jiffies tsc diff --git a/test/sys/devices/system/clocksource/clocksource0/current_clocksource b/test/sys/devices/system/clocksource/clocksource0/current_clocksource new file mode 100644 index 0000000000..5ad7d8fabe --- /dev/null +++ b/test/sys/devices/system/clocksource/clocksource0/current_clocksource @@ -0,0 +1 @@ +hpet diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size b/test/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/level b/test/sys/devices/system/cpu/cpu0/cache/index0/level new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index0/level @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/number_of_sets b/test/sys/devices/system/cpu/cpu0/cache/index0/number_of_sets new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index0/number_of_sets @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/physical_line_partition b/test/sys/devices/system/cpu/cpu0/cache/index0/physical_line_partition new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index0/physical_line_partition @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list b/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map b/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/size b/test/sys/devices/system/cpu/cpu0/cache/index0/size new file mode 100644 index 0000000000..56b868b2a3 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index0/size @@ -0,0 +1 @@ +32K diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/type b/test/sys/devices/system/cpu/cpu0/cache/index0/type new file mode 100644 index 0000000000..0b7088ec63 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index0/type @@ -0,0 +1 @@ +Data diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/ways_of_associativity b/test/sys/devices/system/cpu/cpu0/cache/index0/ways_of_associativity new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index0/ways_of_associativity @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size b/test/sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/level b/test/sys/devices/system/cpu/cpu0/cache/index1/level new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index1/level @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/number_of_sets b/test/sys/devices/system/cpu/cpu0/cache/index1/number_of_sets new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index1/number_of_sets @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/physical_line_partition b/test/sys/devices/system/cpu/cpu0/cache/index1/physical_line_partition new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index1/physical_line_partition @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list b/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map b/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/size b/test/sys/devices/system/cpu/cpu0/cache/index1/size new file mode 100644 index 0000000000..56b868b2a3 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index1/size @@ -0,0 +1 @@ +32K diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/type b/test/sys/devices/system/cpu/cpu0/cache/index1/type new file mode 100644 index 0000000000..9a53cbfa32 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index1/type @@ -0,0 +1 @@ +Instruction diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/ways_of_associativity b/test/sys/devices/system/cpu/cpu0/cache/index1/ways_of_associativity new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index1/ways_of_associativity @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size b/test/sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/level b/test/sys/devices/system/cpu/cpu0/cache/index2/level new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index2/level @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/number_of_sets b/test/sys/devices/system/cpu/cpu0/cache/index2/number_of_sets new file mode 100644 index 0000000000..801c306ed3 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index2/number_of_sets @@ -0,0 +1 @@ +4096 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/physical_line_partition b/test/sys/devices/system/cpu/cpu0/cache/index2/physical_line_partition new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index2/physical_line_partition @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list b/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list new file mode 100644 index 0000000000..8b0fab869c --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list @@ -0,0 +1 @@ +0-1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map b/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/size b/test/sys/devices/system/cpu/cpu0/cache/index2/size new file mode 100644 index 0000000000..6399ecd3bd --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index2/size @@ -0,0 +1 @@ +4096K diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/type b/test/sys/devices/system/cpu/cpu0/cache/index2/type new file mode 100644 index 0000000000..e4fd9dccda --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index2/type @@ -0,0 +1 @@ +Unified diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/ways_of_associativity b/test/sys/devices/system/cpu/cpu0/cache/index2/ways_of_associativity new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cache/index2/ways_of_associativity @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus b/test/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus new file mode 100644 index 0000000000..6e8183b72e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus @@ -0,0 +1 @@ +0 1 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq new file mode 100644 index 0000000000..749fce669d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq @@ -0,0 +1 @@ +1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq new file mode 100644 index 0000000000..d69c7579dd --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq @@ -0,0 +1 @@ +2333000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq new file mode 100644 index 0000000000..749fce669d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq @@ -0,0 +1 @@ +1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate new file mode 100644 index 0000000000..b92677edb9 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate @@ -0,0 +1 @@ +20000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max new file mode 100644 index 0000000000..825319e1c5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max @@ -0,0 +1 @@ +10000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_min b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_min new file mode 100644 index 0000000000..5caff40c4a --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_min @@ -0,0 +1 @@ +10000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold new file mode 100644 index 0000000000..e85087affd --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold @@ -0,0 +1 @@ +31 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/related_cpus b/test/sys/devices/system/cpu/cpu0/cpufreq/related_cpus new file mode 100644 index 0000000000..6e8183b72e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/related_cpus @@ -0,0 +1 @@ +0 1 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies new file mode 100644 index 0000000000..05f8e24a95 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies @@ -0,0 +1 @@ +2333000 2000000 1667000 1333000 1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors new file mode 100644 index 0000000000..78d5ebe295 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors @@ -0,0 +1 @@ +ondemand performance diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq new file mode 100644 index 0000000000..749fce669d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq @@ -0,0 +1 @@ +1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver new file mode 100644 index 0000000000..840e47772f --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver @@ -0,0 +1 @@ +acpi-cpufreq diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor new file mode 100644 index 0000000000..7c0425c393 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor @@ -0,0 +1 @@ +ondemand diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq new file mode 100644 index 0000000000..d69c7579dd --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq @@ -0,0 +1 @@ +2333000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq new file mode 100644 index 0000000000..749fce669d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq @@ -0,0 +1 @@ +1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed new file mode 100644 index 0000000000..2bc16b6d12 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed @@ -0,0 +1 @@ + diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state new file mode 100644 index 0000000000..a071e77313 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state @@ -0,0 +1,5 @@ +2333000 2159 +2000000 24 +1667000 80 +1333000 123 +1000000 8026 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans new file mode 100644 index 0000000000..05c8b2c097 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans @@ -0,0 +1 @@ +717 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc new file mode 100644 index 0000000000..72642e9d4a --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc @@ -0,0 +1 @@ +CPUIDLE CORE POLL IDLE diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/latency b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/latency new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/latency @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name new file mode 100644 index 0000000000..9c4156dfea --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name @@ -0,0 +1 @@ +C0 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/power b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/power new file mode 100644 index 0000000000..4f6ff861c9 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/power @@ -0,0 +1 @@ +4294967295 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/time new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/time @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/usage new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/usage @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/desc new file mode 100644 index 0000000000..a96b77dc9c --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/desc @@ -0,0 +1 @@ +ACPI FFH INTEL MWAIT 0x0 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/latency b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/latency new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/latency @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/name b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/name new file mode 100644 index 0000000000..e2cf5e7905 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/name @@ -0,0 +1 @@ +C1 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/power b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/power new file mode 100644 index 0000000000..83b33d238d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/power @@ -0,0 +1 @@ +1000 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time new file mode 100644 index 0000000000..4fba33e90d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time @@ -0,0 +1 @@ +1037 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage @@ -0,0 +1 @@ +14 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/desc new file mode 100644 index 0000000000..a37c1e636b --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/desc @@ -0,0 +1 @@ +ACPI FFH INTEL MWAIT 0x10 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/latency b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/latency new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/latency @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/name b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/name new file mode 100644 index 0000000000..c4b2d41eaa --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/name @@ -0,0 +1 @@ +C2 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/power b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/power new file mode 100644 index 0000000000..1b79f38e25 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/power @@ -0,0 +1 @@ +500 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time new file mode 100644 index 0000000000..f373507a89 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time @@ -0,0 +1 @@ +119555 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage new file mode 100644 index 0000000000..0435b54f97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage @@ -0,0 +1 @@ +5614 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc new file mode 100644 index 0000000000..e8414e9410 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc @@ -0,0 +1 @@ +ACPI FFH INTEL MWAIT 0x20 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency @@ -0,0 +1 @@ +17 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/name b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/name new file mode 100644 index 0000000000..b1954f8204 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/name @@ -0,0 +1 @@ +C3 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power new file mode 100644 index 0000000000..cb1a40df0f --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power @@ -0,0 +1 @@ +250 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time new file mode 100644 index 0000000000..562b3ecf0d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time @@ -0,0 +1 @@ +92046130 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage new file mode 100644 index 0000000000..d16e9e1d99 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage @@ -0,0 +1 @@ +33517 diff --git a/test/sys/devices/system/cpu/cpu0/crash_notes b/test/sys/devices/system/cpu/cpu0/crash_notes new file mode 100644 index 0000000000..33ad4f3599 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/crash_notes @@ -0,0 +1 @@ +7fb20920 diff --git a/test/sys/devices/system/cpu/cpu0/microcode/processor_flags b/test/sys/devices/system/cpu/cpu0/microcode/processor_flags new file mode 100644 index 0000000000..a1b07c7533 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/microcode/processor_flags @@ -0,0 +1 @@ +0x20 diff --git a/test/sys/devices/system/cpu/cpu0/microcode/version b/test/sys/devices/system/cpu/cpu0/microcode/version new file mode 100644 index 0000000000..bfd49ddc8d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/microcode/version @@ -0,0 +1 @@ +0xc7 diff --git a/test/sys/devices/system/cpu/cpu0/thermal_throttle/count b/test/sys/devices/system/cpu/cpu0/thermal_throttle/count new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/thermal_throttle/count @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu0/topology/core_id b/test/sys/devices/system/cpu/cpu0/topology/core_id new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/topology/core_id @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu0/topology/core_siblings b/test/sys/devices/system/cpu/cpu0/topology/core_siblings new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/topology/core_siblings @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/system/cpu/cpu0/topology/core_siblings_list b/test/sys/devices/system/cpu/cpu0/topology/core_siblings_list new file mode 100644 index 0000000000..8b0fab869c --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/topology/core_siblings_list @@ -0,0 +1 @@ +0-1 diff --git a/test/sys/devices/system/cpu/cpu0/topology/physical_package_id b/test/sys/devices/system/cpu/cpu0/topology/physical_package_id new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu0/topology/thread_siblings b/test/sys/devices/system/cpu/cpu0/topology/thread_siblings new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/topology/thread_siblings @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/system/cpu/cpu0/topology/thread_siblings_list b/test/sys/devices/system/cpu/cpu0/topology/thread_siblings_list new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu0/topology/thread_siblings_list @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/coherency_line_size b/test/sys/devices/system/cpu/cpu1/cache/index0/coherency_line_size new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index0/coherency_line_size @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/level b/test/sys/devices/system/cpu/cpu1/cache/index0/level new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index0/level @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/number_of_sets b/test/sys/devices/system/cpu/cpu1/cache/index0/number_of_sets new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index0/number_of_sets @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/physical_line_partition b/test/sys/devices/system/cpu/cpu1/cache/index0/physical_line_partition new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index0/physical_line_partition @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list b/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map b/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/size b/test/sys/devices/system/cpu/cpu1/cache/index0/size new file mode 100644 index 0000000000..56b868b2a3 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index0/size @@ -0,0 +1 @@ +32K diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/type b/test/sys/devices/system/cpu/cpu1/cache/index0/type new file mode 100644 index 0000000000..0b7088ec63 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index0/type @@ -0,0 +1 @@ +Data diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/ways_of_associativity b/test/sys/devices/system/cpu/cpu1/cache/index0/ways_of_associativity new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index0/ways_of_associativity @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/coherency_line_size b/test/sys/devices/system/cpu/cpu1/cache/index1/coherency_line_size new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index1/coherency_line_size @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/level b/test/sys/devices/system/cpu/cpu1/cache/index1/level new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index1/level @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/number_of_sets b/test/sys/devices/system/cpu/cpu1/cache/index1/number_of_sets new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index1/number_of_sets @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/physical_line_partition b/test/sys/devices/system/cpu/cpu1/cache/index1/physical_line_partition new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index1/physical_line_partition @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list b/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map b/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/size b/test/sys/devices/system/cpu/cpu1/cache/index1/size new file mode 100644 index 0000000000..56b868b2a3 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index1/size @@ -0,0 +1 @@ +32K diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/type b/test/sys/devices/system/cpu/cpu1/cache/index1/type new file mode 100644 index 0000000000..9a53cbfa32 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index1/type @@ -0,0 +1 @@ +Instruction diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/ways_of_associativity b/test/sys/devices/system/cpu/cpu1/cache/index1/ways_of_associativity new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index1/ways_of_associativity @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/coherency_line_size b/test/sys/devices/system/cpu/cpu1/cache/index2/coherency_line_size new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index2/coherency_line_size @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/level b/test/sys/devices/system/cpu/cpu1/cache/index2/level new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index2/level @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/number_of_sets b/test/sys/devices/system/cpu/cpu1/cache/index2/number_of_sets new file mode 100644 index 0000000000..801c306ed3 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index2/number_of_sets @@ -0,0 +1 @@ +4096 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/physical_line_partition b/test/sys/devices/system/cpu/cpu1/cache/index2/physical_line_partition new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index2/physical_line_partition @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list b/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list new file mode 100644 index 0000000000..8b0fab869c --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list @@ -0,0 +1 @@ +0-1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map b/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/size b/test/sys/devices/system/cpu/cpu1/cache/index2/size new file mode 100644 index 0000000000..6399ecd3bd --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index2/size @@ -0,0 +1 @@ +4096K diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/type b/test/sys/devices/system/cpu/cpu1/cache/index2/type new file mode 100644 index 0000000000..e4fd9dccda --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index2/type @@ -0,0 +1 @@ +Unified diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/ways_of_associativity b/test/sys/devices/system/cpu/cpu1/cache/index2/ways_of_associativity new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cache/index2/ways_of_associativity @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/system/cpu/cpu1/cpufreq b/test/sys/devices/system/cpu/cpu1/cpufreq new file mode 120000 index 0000000000..3af6695473 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpufreq @@ -0,0 +1 @@ +../cpu0/cpufreq \ No newline at end of file diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc new file mode 100644 index 0000000000..72642e9d4a --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc @@ -0,0 +1 @@ +CPUIDLE CORE POLL IDLE diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/latency b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/latency new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/latency @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name new file mode 100644 index 0000000000..9c4156dfea --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name @@ -0,0 +1 @@ +C0 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/power b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/power new file mode 100644 index 0000000000..4f6ff861c9 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/power @@ -0,0 +1 @@ +4294967295 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/time new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/time @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/usage new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/usage @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/desc new file mode 100644 index 0000000000..a96b77dc9c --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/desc @@ -0,0 +1 @@ +ACPI FFH INTEL MWAIT 0x0 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/latency b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/latency new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/latency @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/name b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/name new file mode 100644 index 0000000000..e2cf5e7905 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/name @@ -0,0 +1 @@ +C1 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/power b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/power new file mode 100644 index 0000000000..83b33d238d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/power @@ -0,0 +1 @@ +1000 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time new file mode 100644 index 0000000000..1415bc5737 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time @@ -0,0 +1 @@ +2408 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage @@ -0,0 +1 @@ +24 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/desc new file mode 100644 index 0000000000..a37c1e636b --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/desc @@ -0,0 +1 @@ +ACPI FFH INTEL MWAIT 0x10 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/latency b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/latency new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/latency @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/name b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/name new file mode 100644 index 0000000000..c4b2d41eaa --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/name @@ -0,0 +1 @@ +C2 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/power b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/power new file mode 100644 index 0000000000..1b79f38e25 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/power @@ -0,0 +1 @@ +500 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time new file mode 100644 index 0000000000..4d735b4468 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time @@ -0,0 +1 @@ +55212 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage new file mode 100644 index 0000000000..c5efbfab64 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage @@ -0,0 +1 @@ +2821 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc new file mode 100644 index 0000000000..e8414e9410 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc @@ -0,0 +1 @@ +ACPI FFH INTEL MWAIT 0x20 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency @@ -0,0 +1 @@ +17 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/name b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/name new file mode 100644 index 0000000000..b1954f8204 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/name @@ -0,0 +1 @@ +C3 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power new file mode 100644 index 0000000000..cb1a40df0f --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power @@ -0,0 +1 @@ +250 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time new file mode 100644 index 0000000000..8d5fd64499 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time @@ -0,0 +1 @@ +102214756 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage new file mode 100644 index 0000000000..4ca3828ca7 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage @@ -0,0 +1 @@ +43312 diff --git a/test/sys/devices/system/cpu/cpu1/crash_notes b/test/sys/devices/system/cpu/cpu1/crash_notes new file mode 100644 index 0000000000..80d7b8d1fd --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/crash_notes @@ -0,0 +1 @@ +7fb20b68 diff --git a/test/sys/devices/system/cpu/cpu1/microcode/processor_flags b/test/sys/devices/system/cpu/cpu1/microcode/processor_flags new file mode 100644 index 0000000000..a1b07c7533 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/microcode/processor_flags @@ -0,0 +1 @@ +0x20 diff --git a/test/sys/devices/system/cpu/cpu1/microcode/version b/test/sys/devices/system/cpu/cpu1/microcode/version new file mode 100644 index 0000000000..bfd49ddc8d --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/microcode/version @@ -0,0 +1 @@ +0xc7 diff --git a/test/sys/devices/system/cpu/cpu1/online b/test/sys/devices/system/cpu/cpu1/online new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/online @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/thermal_throttle/count b/test/sys/devices/system/cpu/cpu1/thermal_throttle/count new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/thermal_throttle/count @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu1/topology/core_id b/test/sys/devices/system/cpu/cpu1/topology/core_id new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/topology/core_id @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpu1/topology/core_siblings b/test/sys/devices/system/cpu/cpu1/topology/core_siblings new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/topology/core_siblings @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/system/cpu/cpu1/topology/core_siblings_list b/test/sys/devices/system/cpu/cpu1/topology/core_siblings_list new file mode 100644 index 0000000000..8b0fab869c --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/topology/core_siblings_list @@ -0,0 +1 @@ +0-1 diff --git a/test/sys/devices/system/cpu/cpu1/topology/physical_package_id b/test/sys/devices/system/cpu/cpu1/topology/physical_package_id new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/topology/physical_package_id @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/cpu/cpu1/topology/thread_siblings b/test/sys/devices/system/cpu/cpu1/topology/thread_siblings new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/topology/thread_siblings @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/system/cpu/cpu1/topology/thread_siblings_list b/test/sys/devices/system/cpu/cpu1/topology/thread_siblings_list new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/cpu/cpu1/topology/thread_siblings_list @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/cpu/cpuidle/current_driver b/test/sys/devices/system/cpu/cpuidle/current_driver new file mode 100644 index 0000000000..57d5dd37cd --- /dev/null +++ b/test/sys/devices/system/cpu/cpuidle/current_driver @@ -0,0 +1 @@ +acpi_idle diff --git a/test/sys/devices/system/cpu/cpuidle/current_governor_ro b/test/sys/devices/system/cpu/cpuidle/current_governor_ro new file mode 100644 index 0000000000..c35a724b3f --- /dev/null +++ b/test/sys/devices/system/cpu/cpuidle/current_governor_ro @@ -0,0 +1 @@ +menu diff --git a/test/sys/devices/system/cpu/online b/test/sys/devices/system/cpu/online new file mode 100644 index 0000000000..8b0fab869c --- /dev/null +++ b/test/sys/devices/system/cpu/online @@ -0,0 +1 @@ +0-1 diff --git a/test/sys/devices/system/cpu/possible b/test/sys/devices/system/cpu/possible new file mode 100644 index 0000000000..8b0fab869c --- /dev/null +++ b/test/sys/devices/system/cpu/possible @@ -0,0 +1 @@ +0-1 diff --git a/test/sys/devices/system/cpu/present b/test/sys/devices/system/cpu/present new file mode 100644 index 0000000000..8b0fab869c --- /dev/null +++ b/test/sys/devices/system/cpu/present @@ -0,0 +1 @@ +0-1 diff --git a/test/sys/devices/system/cpu/sched_mc_power_savings b/test/sys/devices/system/cpu/sched_mc_power_savings new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/system/cpu/sched_mc_power_savings @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank0ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank0ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck0/bank0ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank1ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank1ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck0/bank1ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank2ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank2ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck0/bank2ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank3ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank3ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck0/bank3ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank4ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank4ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck0/bank4ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank5ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank5ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck0/bank5ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/check_interval b/test/sys/devices/system/machinecheck/machinecheck0/check_interval new file mode 100644 index 0000000000..3af45c94a2 --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck0/check_interval @@ -0,0 +1 @@ +12c diff --git a/test/sys/devices/system/machinecheck/machinecheck0/tolerant b/test/sys/devices/system/machinecheck/machinecheck0/tolerant new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck0/tolerant @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/machinecheck/machinecheck0/trigger b/test/sys/devices/system/machinecheck/machinecheck0/trigger new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck0/trigger @@ -0,0 +1 @@ + diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank0ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank0ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck1/bank0ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank1ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank1ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck1/bank1ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank2ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank2ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck1/bank2ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank3ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank3ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck1/bank3ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank4ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank4ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck1/bank4ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank5ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank5ctl new file mode 100644 index 0000000000..36521686ac --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck1/bank5ctl @@ -0,0 +1 @@ +ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/check_interval b/test/sys/devices/system/machinecheck/machinecheck1/check_interval new file mode 100644 index 0000000000..3af45c94a2 --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck1/check_interval @@ -0,0 +1 @@ +12c diff --git a/test/sys/devices/system/machinecheck/machinecheck1/tolerant b/test/sys/devices/system/machinecheck/machinecheck1/tolerant new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck1/tolerant @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/system/machinecheck/machinecheck1/trigger b/test/sys/devices/system/machinecheck/machinecheck1/trigger new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/system/machinecheck/machinecheck1/trigger @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/0:16/max_ratio b/test/sys/devices/virtual/bdi/0:16/max_ratio new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/bdi/0:16/max_ratio @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/bdi/0:16/min_ratio b/test/sys/devices/virtual/bdi/0:16/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/0:16/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/0:16/power/wakeup b/test/sys/devices/virtual/bdi/0:16/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/0:16/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/0:16/read_ahead_kb b/test/sys/devices/virtual/bdi/0:16/read_ahead_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/virtual/bdi/0:16/read_ahead_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/virtual/bdi/0:16/subsystem b/test/sys/devices/virtual/bdi/0:16/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/0:16/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/0:16/uevent b/test/sys/devices/virtual/bdi/0:16/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/11:0/max_ratio b/test/sys/devices/virtual/bdi/11:0/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/11:0/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/11:0/min_ratio b/test/sys/devices/virtual/bdi/11:0/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/11:0/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/11:0/power/wakeup b/test/sys/devices/virtual/bdi/11:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/11:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/11:0/read_ahead_kb b/test/sys/devices/virtual/bdi/11:0/read_ahead_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/virtual/bdi/11:0/read_ahead_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/virtual/bdi/11:0/subsystem b/test/sys/devices/virtual/bdi/11:0/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/11:0/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/11:0/uevent b/test/sys/devices/virtual/bdi/11:0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/7:0/max_ratio b/test/sys/devices/virtual/bdi/7:0/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:0/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/7:0/min_ratio b/test/sys/devices/virtual/bdi/7:0/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:0/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:0/power/wakeup b/test/sys/devices/virtual/bdi/7:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/7:0/read_ahead_kb b/test/sys/devices/virtual/bdi/7:0/read_ahead_kb new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:0/read_ahead_kb @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:0/subsystem b/test/sys/devices/virtual/bdi/7:0/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:0/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:0/uevent b/test/sys/devices/virtual/bdi/7:0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/7:1/max_ratio b/test/sys/devices/virtual/bdi/7:1/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:1/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/7:1/min_ratio b/test/sys/devices/virtual/bdi/7:1/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:1/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:1/power/wakeup b/test/sys/devices/virtual/bdi/7:1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/7:1/read_ahead_kb b/test/sys/devices/virtual/bdi/7:1/read_ahead_kb new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:1/read_ahead_kb @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:1/subsystem b/test/sys/devices/virtual/bdi/7:1/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:1/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:1/uevent b/test/sys/devices/virtual/bdi/7:1/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/7:2/max_ratio b/test/sys/devices/virtual/bdi/7:2/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:2/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/7:2/min_ratio b/test/sys/devices/virtual/bdi/7:2/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:2/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:2/power/wakeup b/test/sys/devices/virtual/bdi/7:2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/7:2/read_ahead_kb b/test/sys/devices/virtual/bdi/7:2/read_ahead_kb new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:2/read_ahead_kb @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:2/subsystem b/test/sys/devices/virtual/bdi/7:2/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:2/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:2/uevent b/test/sys/devices/virtual/bdi/7:2/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/7:3/max_ratio b/test/sys/devices/virtual/bdi/7:3/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:3/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/7:3/min_ratio b/test/sys/devices/virtual/bdi/7:3/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:3/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:3/power/wakeup b/test/sys/devices/virtual/bdi/7:3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/7:3/read_ahead_kb b/test/sys/devices/virtual/bdi/7:3/read_ahead_kb new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:3/read_ahead_kb @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:3/subsystem b/test/sys/devices/virtual/bdi/7:3/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:3/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:3/uevent b/test/sys/devices/virtual/bdi/7:3/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/7:4/max_ratio b/test/sys/devices/virtual/bdi/7:4/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:4/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/7:4/min_ratio b/test/sys/devices/virtual/bdi/7:4/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:4/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:4/power/wakeup b/test/sys/devices/virtual/bdi/7:4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/7:4/read_ahead_kb b/test/sys/devices/virtual/bdi/7:4/read_ahead_kb new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:4/read_ahead_kb @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:4/subsystem b/test/sys/devices/virtual/bdi/7:4/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:4/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:4/uevent b/test/sys/devices/virtual/bdi/7:4/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/7:5/max_ratio b/test/sys/devices/virtual/bdi/7:5/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:5/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/7:5/min_ratio b/test/sys/devices/virtual/bdi/7:5/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:5/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:5/power/wakeup b/test/sys/devices/virtual/bdi/7:5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/7:5/read_ahead_kb b/test/sys/devices/virtual/bdi/7:5/read_ahead_kb new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:5/read_ahead_kb @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:5/subsystem b/test/sys/devices/virtual/bdi/7:5/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:5/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:5/uevent b/test/sys/devices/virtual/bdi/7:5/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/7:6/max_ratio b/test/sys/devices/virtual/bdi/7:6/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:6/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/7:6/min_ratio b/test/sys/devices/virtual/bdi/7:6/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:6/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:6/power/wakeup b/test/sys/devices/virtual/bdi/7:6/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:6/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/7:6/read_ahead_kb b/test/sys/devices/virtual/bdi/7:6/read_ahead_kb new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:6/read_ahead_kb @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:6/subsystem b/test/sys/devices/virtual/bdi/7:6/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:6/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:6/uevent b/test/sys/devices/virtual/bdi/7:6/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/7:7/max_ratio b/test/sys/devices/virtual/bdi/7:7/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:7/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/7:7/min_ratio b/test/sys/devices/virtual/bdi/7:7/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:7/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:7/power/wakeup b/test/sys/devices/virtual/bdi/7:7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/7:7/read_ahead_kb b/test/sys/devices/virtual/bdi/7:7/read_ahead_kb new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:7/read_ahead_kb @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/7:7/subsystem b/test/sys/devices/virtual/bdi/7:7/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/7:7/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:7/uevent b/test/sys/devices/virtual/bdi/7:7/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/8:0/max_ratio b/test/sys/devices/virtual/bdi/8:0/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:0/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/8:0/min_ratio b/test/sys/devices/virtual/bdi/8:0/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:0/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/8:0/power/wakeup b/test/sys/devices/virtual/bdi/8:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/8:0/read_ahead_kb b/test/sys/devices/virtual/bdi/8:0/read_ahead_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:0/read_ahead_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/virtual/bdi/8:0/subsystem b/test/sys/devices/virtual/bdi/8:0/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:0/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/8:0/uevent b/test/sys/devices/virtual/bdi/8:0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/8:16/max_ratio b/test/sys/devices/virtual/bdi/8:16/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:16/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/8:16/min_ratio b/test/sys/devices/virtual/bdi/8:16/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:16/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/8:16/power/wakeup b/test/sys/devices/virtual/bdi/8:16/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:16/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/8:16/read_ahead_kb b/test/sys/devices/virtual/bdi/8:16/read_ahead_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:16/read_ahead_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/virtual/bdi/8:16/subsystem b/test/sys/devices/virtual/bdi/8:16/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/8:16/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/8:16/uevent b/test/sys/devices/virtual/bdi/8:16/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/9:0/max_ratio b/test/sys/devices/virtual/bdi/9:0/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/9:0/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/9:0/min_ratio b/test/sys/devices/virtual/bdi/9:0/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/9:0/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/9:0/power/wakeup b/test/sys/devices/virtual/bdi/9:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/9:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/9:0/read_ahead_kb b/test/sys/devices/virtual/bdi/9:0/read_ahead_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/virtual/bdi/9:0/read_ahead_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/virtual/bdi/9:0/subsystem b/test/sys/devices/virtual/bdi/9:0/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/9:0/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/9:0/uevent b/test/sys/devices/virtual/bdi/9:0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/bdi/default/max_ratio b/test/sys/devices/virtual/bdi/default/max_ratio new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/virtual/bdi/default/max_ratio @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/virtual/bdi/default/min_ratio b/test/sys/devices/virtual/bdi/default/min_ratio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/bdi/default/min_ratio @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/bdi/default/power/wakeup b/test/sys/devices/virtual/bdi/default/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/bdi/default/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/bdi/default/read_ahead_kb b/test/sys/devices/virtual/bdi/default/read_ahead_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/virtual/bdi/default/read_ahead_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/virtual/bdi/default/subsystem b/test/sys/devices/virtual/bdi/default/subsystem new file mode 120000 index 0000000000..01f5e19517 --- /dev/null +++ b/test/sys/devices/virtual/bdi/default/subsystem @@ -0,0 +1 @@ +../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/default/uevent b/test/sys/devices/virtual/bdi/default/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/capability b/test/sys/devices/virtual/block/fake!blockdev0/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/fake!blockdev0/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/dev b/test/sys/devices/virtual/block/fake!blockdev0/dev new file mode 100644 index 0000000000..2ad787a87a --- /dev/null +++ b/test/sys/devices/virtual/block/fake!blockdev0/dev @@ -0,0 +1 @@ +711:0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/range b/test/sys/devices/virtual/block/fake!blockdev0/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/fake!blockdev0/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/removable b/test/sys/devices/virtual/block/fake!blockdev0/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/fake!blockdev0/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/ro b/test/sys/devices/virtual/block/fake!blockdev0/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/fake!blockdev0/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/size b/test/sys/devices/virtual/block/fake!blockdev0/size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/fake!blockdev0/size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/stat b/test/sys/devices/virtual/block/fake!blockdev0/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/virtual/block/fake!blockdev0/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/subsystem b/test/sys/devices/virtual/block/fake!blockdev0/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/fake!blockdev0/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/fake!blockdev0/uevent b/test/sys/devices/virtual/block/fake!blockdev0/uevent new file mode 100644 index 0000000000..70997d361b --- /dev/null +++ b/test/sys/devices/virtual/block/fake!blockdev0/uevent @@ -0,0 +1,3 @@ +MAJOR=7 +MINOR=0 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop0/bdi b/test/sys/devices/virtual/block/loop0/bdi new file mode 120000 index 0000000000..18ceac07e2 --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/bdi @@ -0,0 +1 @@ +../../bdi/7:0 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop0/capability b/test/sys/devices/virtual/block/loop0/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/loop0/dev b/test/sys/devices/virtual/block/loop0/dev new file mode 100644 index 0000000000..63cbc465cd --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/dev @@ -0,0 +1 @@ +7:0 diff --git a/test/sys/devices/virtual/block/loop0/make-it-fail b/test/sys/devices/virtual/block/loop0/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop0/power/wakeup b/test/sys/devices/virtual/block/loop0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/block/loop0/range b/test/sys/devices/virtual/block/loop0/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/loop0/removable b/test/sys/devices/virtual/block/loop0/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop0/ro b/test/sys/devices/virtual/block/loop0/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop0/size b/test/sys/devices/virtual/block/loop0/size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop0/stat b/test/sys/devices/virtual/block/loop0/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop0/subsystem b/test/sys/devices/virtual/block/loop0/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop0/uevent b/test/sys/devices/virtual/block/loop0/uevent new file mode 100644 index 0000000000..70997d361b --- /dev/null +++ b/test/sys/devices/virtual/block/loop0/uevent @@ -0,0 +1,3 @@ +MAJOR=7 +MINOR=0 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop1/bdi b/test/sys/devices/virtual/block/loop1/bdi new file mode 120000 index 0000000000..c909eb9ec2 --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/bdi @@ -0,0 +1 @@ +../../bdi/7:1 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop1/capability b/test/sys/devices/virtual/block/loop1/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/loop1/dev b/test/sys/devices/virtual/block/loop1/dev new file mode 100644 index 0000000000..084aafd011 --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/dev @@ -0,0 +1 @@ +7:1 diff --git a/test/sys/devices/virtual/block/loop1/make-it-fail b/test/sys/devices/virtual/block/loop1/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop1/power/wakeup b/test/sys/devices/virtual/block/loop1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/block/loop1/range b/test/sys/devices/virtual/block/loop1/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/loop1/removable b/test/sys/devices/virtual/block/loop1/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop1/ro b/test/sys/devices/virtual/block/loop1/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop1/size b/test/sys/devices/virtual/block/loop1/size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop1/stat b/test/sys/devices/virtual/block/loop1/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop1/subsystem b/test/sys/devices/virtual/block/loop1/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop1/uevent b/test/sys/devices/virtual/block/loop1/uevent new file mode 100644 index 0000000000..735db02c53 --- /dev/null +++ b/test/sys/devices/virtual/block/loop1/uevent @@ -0,0 +1,3 @@ +MAJOR=7 +MINOR=1 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop2/bdi b/test/sys/devices/virtual/block/loop2/bdi new file mode 120000 index 0000000000..5ab426c8de --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/bdi @@ -0,0 +1 @@ +../../bdi/7:2 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop2/capability b/test/sys/devices/virtual/block/loop2/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/loop2/dev b/test/sys/devices/virtual/block/loop2/dev new file mode 100644 index 0000000000..665a343e7d --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/dev @@ -0,0 +1 @@ +7:2 diff --git a/test/sys/devices/virtual/block/loop2/make-it-fail b/test/sys/devices/virtual/block/loop2/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop2/power/wakeup b/test/sys/devices/virtual/block/loop2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/block/loop2/range b/test/sys/devices/virtual/block/loop2/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/loop2/removable b/test/sys/devices/virtual/block/loop2/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop2/ro b/test/sys/devices/virtual/block/loop2/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop2/size b/test/sys/devices/virtual/block/loop2/size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop2/stat b/test/sys/devices/virtual/block/loop2/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop2/subsystem b/test/sys/devices/virtual/block/loop2/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop2/uevent b/test/sys/devices/virtual/block/loop2/uevent new file mode 100644 index 0000000000..6d170d368a --- /dev/null +++ b/test/sys/devices/virtual/block/loop2/uevent @@ -0,0 +1,3 @@ +MAJOR=7 +MINOR=2 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop3/bdi b/test/sys/devices/virtual/block/loop3/bdi new file mode 120000 index 0000000000..756b9c2cf5 --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/bdi @@ -0,0 +1 @@ +../../bdi/7:3 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop3/capability b/test/sys/devices/virtual/block/loop3/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/loop3/dev b/test/sys/devices/virtual/block/loop3/dev new file mode 100644 index 0000000000..62f686140a --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/dev @@ -0,0 +1 @@ +7:3 diff --git a/test/sys/devices/virtual/block/loop3/make-it-fail b/test/sys/devices/virtual/block/loop3/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop3/power/wakeup b/test/sys/devices/virtual/block/loop3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/block/loop3/range b/test/sys/devices/virtual/block/loop3/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/loop3/removable b/test/sys/devices/virtual/block/loop3/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop3/ro b/test/sys/devices/virtual/block/loop3/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop3/size b/test/sys/devices/virtual/block/loop3/size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop3/stat b/test/sys/devices/virtual/block/loop3/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop3/subsystem b/test/sys/devices/virtual/block/loop3/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop3/uevent b/test/sys/devices/virtual/block/loop3/uevent new file mode 100644 index 0000000000..e6bbabc43d --- /dev/null +++ b/test/sys/devices/virtual/block/loop3/uevent @@ -0,0 +1,3 @@ +MAJOR=7 +MINOR=3 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop4/bdi b/test/sys/devices/virtual/block/loop4/bdi new file mode 120000 index 0000000000..48969485be --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/bdi @@ -0,0 +1 @@ +../../bdi/7:4 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop4/capability b/test/sys/devices/virtual/block/loop4/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/loop4/dev b/test/sys/devices/virtual/block/loop4/dev new file mode 100644 index 0000000000..684e7ade03 --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/dev @@ -0,0 +1 @@ +7:4 diff --git a/test/sys/devices/virtual/block/loop4/make-it-fail b/test/sys/devices/virtual/block/loop4/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop4/power/wakeup b/test/sys/devices/virtual/block/loop4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/block/loop4/range b/test/sys/devices/virtual/block/loop4/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/loop4/removable b/test/sys/devices/virtual/block/loop4/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop4/ro b/test/sys/devices/virtual/block/loop4/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop4/size b/test/sys/devices/virtual/block/loop4/size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop4/stat b/test/sys/devices/virtual/block/loop4/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop4/subsystem b/test/sys/devices/virtual/block/loop4/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop4/uevent b/test/sys/devices/virtual/block/loop4/uevent new file mode 100644 index 0000000000..dd9b914b9c --- /dev/null +++ b/test/sys/devices/virtual/block/loop4/uevent @@ -0,0 +1,3 @@ +MAJOR=7 +MINOR=4 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop5/bdi b/test/sys/devices/virtual/block/loop5/bdi new file mode 120000 index 0000000000..28a54a9841 --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/bdi @@ -0,0 +1 @@ +../../bdi/7:5 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop5/capability b/test/sys/devices/virtual/block/loop5/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/loop5/dev b/test/sys/devices/virtual/block/loop5/dev new file mode 100644 index 0000000000..9028bbffdb --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/dev @@ -0,0 +1 @@ +7:5 diff --git a/test/sys/devices/virtual/block/loop5/make-it-fail b/test/sys/devices/virtual/block/loop5/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop5/power/wakeup b/test/sys/devices/virtual/block/loop5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/block/loop5/range b/test/sys/devices/virtual/block/loop5/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/loop5/removable b/test/sys/devices/virtual/block/loop5/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop5/ro b/test/sys/devices/virtual/block/loop5/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop5/size b/test/sys/devices/virtual/block/loop5/size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop5/stat b/test/sys/devices/virtual/block/loop5/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop5/subsystem b/test/sys/devices/virtual/block/loop5/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop5/uevent b/test/sys/devices/virtual/block/loop5/uevent new file mode 100644 index 0000000000..83a31c4f74 --- /dev/null +++ b/test/sys/devices/virtual/block/loop5/uevent @@ -0,0 +1,3 @@ +MAJOR=7 +MINOR=5 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop6/bdi b/test/sys/devices/virtual/block/loop6/bdi new file mode 120000 index 0000000000..bf36ddae30 --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/bdi @@ -0,0 +1 @@ +../../bdi/7:6 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop6/capability b/test/sys/devices/virtual/block/loop6/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/loop6/dev b/test/sys/devices/virtual/block/loop6/dev new file mode 100644 index 0000000000..fc5d660a44 --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/dev @@ -0,0 +1 @@ +7:6 diff --git a/test/sys/devices/virtual/block/loop6/make-it-fail b/test/sys/devices/virtual/block/loop6/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop6/power/wakeup b/test/sys/devices/virtual/block/loop6/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/block/loop6/range b/test/sys/devices/virtual/block/loop6/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/loop6/removable b/test/sys/devices/virtual/block/loop6/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop6/ro b/test/sys/devices/virtual/block/loop6/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop6/size b/test/sys/devices/virtual/block/loop6/size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop6/stat b/test/sys/devices/virtual/block/loop6/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop6/subsystem b/test/sys/devices/virtual/block/loop6/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop6/uevent b/test/sys/devices/virtual/block/loop6/uevent new file mode 100644 index 0000000000..f4428d9334 --- /dev/null +++ b/test/sys/devices/virtual/block/loop6/uevent @@ -0,0 +1,3 @@ +MAJOR=7 +MINOR=6 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop7/bdi b/test/sys/devices/virtual/block/loop7/bdi new file mode 120000 index 0000000000..b8918dde28 --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/bdi @@ -0,0 +1 @@ +../../bdi/7:7 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop7/capability b/test/sys/devices/virtual/block/loop7/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/loop7/dev b/test/sys/devices/virtual/block/loop7/dev new file mode 100644 index 0000000000..5d4edd3ce1 --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/dev @@ -0,0 +1 @@ +7:7 diff --git a/test/sys/devices/virtual/block/loop7/make-it-fail b/test/sys/devices/virtual/block/loop7/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop7/power/wakeup b/test/sys/devices/virtual/block/loop7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/block/loop7/range b/test/sys/devices/virtual/block/loop7/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/loop7/removable b/test/sys/devices/virtual/block/loop7/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop7/ro b/test/sys/devices/virtual/block/loop7/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop7/size b/test/sys/devices/virtual/block/loop7/size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/loop7/stat b/test/sys/devices/virtual/block/loop7/stat new file mode 100644 index 0000000000..ddf0f2a1f7 --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/stat @@ -0,0 +1 @@ + 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop7/subsystem b/test/sys/devices/virtual/block/loop7/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop7/uevent b/test/sys/devices/virtual/block/loop7/uevent new file mode 100644 index 0000000000..7209ef3d6b --- /dev/null +++ b/test/sys/devices/virtual/block/loop7/uevent @@ -0,0 +1,3 @@ +MAJOR=7 +MINOR=7 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/md0/bdi b/test/sys/devices/virtual/block/md0/bdi new file mode 120000 index 0000000000..e4fd778bea --- /dev/null +++ b/test/sys/devices/virtual/block/md0/bdi @@ -0,0 +1 @@ +../../bdi/9:0 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/capability b/test/sys/devices/virtual/block/md0/capability new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/block/md0/capability @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/block/md0/dev b/test/sys/devices/virtual/block/md0/dev new file mode 100644 index 0000000000..3dd777e840 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/dev @@ -0,0 +1 @@ +9:0 diff --git a/test/sys/devices/virtual/block/md0/make-it-fail b/test/sys/devices/virtual/block/md0/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/array_state b/test/sys/devices/virtual/block/md0/md/array_state new file mode 100644 index 0000000000..8312630207 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/array_state @@ -0,0 +1 @@ +clean diff --git a/test/sys/devices/virtual/block/md0/md/chunk_size b/test/sys/devices/virtual/block/md0/md/chunk_size new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/chunk_size @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/component_size b/test/sys/devices/virtual/block/md0/md/component_size new file mode 100644 index 0000000000..cad9317825 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/component_size @@ -0,0 +1 @@ +9767424 diff --git a/test/sys/devices/virtual/block/md0/md/degraded b/test/sys/devices/virtual/block/md0/md/degraded new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/degraded @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/block b/test/sys/devices/virtual/block/md0/md/dev-sda9/block new file mode 120000 index 0000000000..c633a674f2 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/dev-sda9/block @@ -0,0 +1 @@ +../../../../../pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/errors b/test/sys/devices/virtual/block/md0/md/dev-sda9/errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/dev-sda9/errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/offset b/test/sys/devices/virtual/block/md0/md/dev-sda9/offset new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/dev-sda9/offset @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/size b/test/sys/devices/virtual/block/md0/md/dev-sda9/size new file mode 100644 index 0000000000..80892c8881 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/dev-sda9/size @@ -0,0 +1 @@ +23438720 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/slot b/test/sys/devices/virtual/block/md0/md/dev-sda9/slot new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/dev-sda9/slot @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/state b/test/sys/devices/virtual/block/md0/md/dev-sda9/state new file mode 100644 index 0000000000..964991008d --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/dev-sda9/state @@ -0,0 +1 @@ +in_sync diff --git a/test/sys/devices/virtual/block/md0/md/layout b/test/sys/devices/virtual/block/md0/md/layout new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/layout @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/level b/test/sys/devices/virtual/block/md0/md/level new file mode 100644 index 0000000000..341b806e6c --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/level @@ -0,0 +1 @@ +raid1 diff --git a/test/sys/devices/virtual/block/md0/md/metadata_version b/test/sys/devices/virtual/block/md0/md/metadata_version new file mode 100644 index 0000000000..2c4a1a017f --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/metadata_version @@ -0,0 +1 @@ +0.90 diff --git a/test/sys/devices/virtual/block/md0/md/mismatch_cnt b/test/sys/devices/virtual/block/md0/md/mismatch_cnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/mismatch_cnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/raid_disks b/test/sys/devices/virtual/block/md0/md/raid_disks new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/raid_disks @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/virtual/block/md0/md/rd1 b/test/sys/devices/virtual/block/md0/md/rd1 new file mode 120000 index 0000000000..f414d06453 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/rd1 @@ -0,0 +1 @@ +dev-sda9 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/md/reshape_position b/test/sys/devices/virtual/block/md0/md/reshape_position new file mode 100644 index 0000000000..621e94f0ec --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/reshape_position @@ -0,0 +1 @@ +none diff --git a/test/sys/devices/virtual/block/md0/md/resync_start b/test/sys/devices/virtual/block/md0/md/resync_start new file mode 100644 index 0000000000..93221a2954 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/resync_start @@ -0,0 +1 @@ +18446744073709551615 diff --git a/test/sys/devices/virtual/block/md0/md/safe_mode_delay b/test/sys/devices/virtual/block/md0/md/safe_mode_delay new file mode 100644 index 0000000000..4faa381f80 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/safe_mode_delay @@ -0,0 +1 @@ +0.201 diff --git a/test/sys/devices/virtual/block/md0/md/suspend_hi b/test/sys/devices/virtual/block/md0/md/suspend_hi new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/suspend_hi @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/suspend_lo b/test/sys/devices/virtual/block/md0/md/suspend_lo new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/suspend_lo @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/sync_action b/test/sys/devices/virtual/block/md0/md/sync_action new file mode 100644 index 0000000000..5a5e41c8f4 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/sync_action @@ -0,0 +1 @@ +idle diff --git a/test/sys/devices/virtual/block/md0/md/sync_completed b/test/sys/devices/virtual/block/md0/md/sync_completed new file mode 100644 index 0000000000..cd2858796d --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/sync_completed @@ -0,0 +1 @@ +0 / 19534848 diff --git a/test/sys/devices/virtual/block/md0/md/sync_force_parallel b/test/sys/devices/virtual/block/md0/md/sync_force_parallel new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/sync_force_parallel @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/sync_max b/test/sys/devices/virtual/block/md0/md/sync_max new file mode 100644 index 0000000000..355295a05a --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/sync_max @@ -0,0 +1 @@ +max diff --git a/test/sys/devices/virtual/block/md0/md/sync_min b/test/sys/devices/virtual/block/md0/md/sync_min new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/sync_min @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/sync_speed b/test/sys/devices/virtual/block/md0/md/sync_speed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/sync_speed @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/md/sync_speed_max b/test/sys/devices/virtual/block/md0/md/sync_speed_max new file mode 100644 index 0000000000..ba1ff86e53 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/sync_speed_max @@ -0,0 +1 @@ +200000 (system) diff --git a/test/sys/devices/virtual/block/md0/md/sync_speed_min b/test/sys/devices/virtual/block/md0/md/sync_speed_min new file mode 100644 index 0000000000..406019d218 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/md/sync_speed_min @@ -0,0 +1 @@ +1000 (system) diff --git a/test/sys/devices/virtual/block/md0/power/wakeup b/test/sys/devices/virtual/block/md0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/block/md0/range b/test/sys/devices/virtual/block/md0/range new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/block/md0/range @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/block/md0/removable b/test/sys/devices/virtual/block/md0/removable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/removable @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/ro b/test/sys/devices/virtual/block/md0/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/block/md0/size b/test/sys/devices/virtual/block/md0/size new file mode 100644 index 0000000000..f50f9f358c --- /dev/null +++ b/test/sys/devices/virtual/block/md0/size @@ -0,0 +1 @@ +19534848 diff --git a/test/sys/devices/virtual/block/md0/slaves/sda9 b/test/sys/devices/virtual/block/md0/slaves/sda9 new file mode 120000 index 0000000000..ccc05e002b --- /dev/null +++ b/test/sys/devices/virtual/block/md0/slaves/sda9 @@ -0,0 +1 @@ +../../../../pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/stat b/test/sys/devices/virtual/block/md0/stat new file mode 100644 index 0000000000..4510288568 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/stat @@ -0,0 +1 @@ + 60 0 480 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/md0/subsystem b/test/sys/devices/virtual/block/md0/subsystem new file mode 120000 index 0000000000..b257cfc23c --- /dev/null +++ b/test/sys/devices/virtual/block/md0/subsystem @@ -0,0 +1 @@ +../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/uevent b/test/sys/devices/virtual/block/md0/uevent new file mode 100644 index 0000000000..bed44e5181 --- /dev/null +++ b/test/sys/devices/virtual/block/md0/uevent @@ -0,0 +1,3 @@ +MAJOR=9 +MINOR=0 +DEVTYPE=disk diff --git a/test/sys/devices/virtual/dmi/id/bios_date b/test/sys/devices/virtual/dmi/id/bios_date new file mode 100644 index 0000000000..b68141e827 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/bios_date @@ -0,0 +1 @@ +09/19/2007 diff --git a/test/sys/devices/virtual/dmi/id/bios_vendor b/test/sys/devices/virtual/dmi/id/bios_vendor new file mode 100644 index 0000000000..84dae9baf6 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/bios_vendor @@ -0,0 +1 @@ +LENOVO diff --git a/test/sys/devices/virtual/dmi/id/bios_version b/test/sys/devices/virtual/dmi/id/bios_version new file mode 100644 index 0000000000..110327614e --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/bios_version @@ -0,0 +1 @@ +7IET31WW (1.12 ) diff --git a/test/sys/devices/virtual/dmi/id/board_asset_tag b/test/sys/devices/virtual/dmi/id/board_asset_tag new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/board_asset_tag @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/dmi/id/board_name b/test/sys/devices/virtual/dmi/id/board_name new file mode 100644 index 0000000000..7b899b9e32 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/board_name @@ -0,0 +1 @@ +8741C4G diff --git a/test/sys/devices/virtual/dmi/id/board_serial b/test/sys/devices/virtual/dmi/id/board_serial new file mode 100644 index 0000000000..887d672e48 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/board_serial @@ -0,0 +1 @@ +VF0UV72C10X diff --git a/test/sys/devices/virtual/dmi/id/board_vendor b/test/sys/devices/virtual/dmi/id/board_vendor new file mode 100644 index 0000000000..84dae9baf6 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/board_vendor @@ -0,0 +1 @@ +LENOVO diff --git a/test/sys/devices/virtual/dmi/id/board_version b/test/sys/devices/virtual/dmi/id/board_version new file mode 100644 index 0000000000..6d46bf7e2c --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/board_version @@ -0,0 +1 @@ +Not Available diff --git a/test/sys/devices/virtual/dmi/id/chassis_asset_tag b/test/sys/devices/virtual/dmi/id/chassis_asset_tag new file mode 100644 index 0000000000..227547603f --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/chassis_asset_tag @@ -0,0 +1 @@ +No Asset Information diff --git a/test/sys/devices/virtual/dmi/id/chassis_serial b/test/sys/devices/virtual/dmi/id/chassis_serial new file mode 100644 index 0000000000..6d46bf7e2c --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/chassis_serial @@ -0,0 +1 @@ +Not Available diff --git a/test/sys/devices/virtual/dmi/id/chassis_type b/test/sys/devices/virtual/dmi/id/chassis_type new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/chassis_type @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/dmi/id/chassis_vendor b/test/sys/devices/virtual/dmi/id/chassis_vendor new file mode 100644 index 0000000000..84dae9baf6 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/chassis_vendor @@ -0,0 +1 @@ +LENOVO diff --git a/test/sys/devices/virtual/dmi/id/chassis_version b/test/sys/devices/virtual/dmi/id/chassis_version new file mode 100644 index 0000000000..6d46bf7e2c --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/chassis_version @@ -0,0 +1 @@ +Not Available diff --git a/test/sys/devices/virtual/dmi/id/modalias b/test/sys/devices/virtual/dmi/id/modalias new file mode 100644 index 0000000000..4f22922d4a --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/modalias @@ -0,0 +1 @@ +dmi:bvnLENOVO:bvr7IET31WW(1.12):bd09/19/2007:svnLENOVO:pn8741C4G:pvrThinkPadT60p:rvnLENOVO:rn8741C4G:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable: diff --git a/test/sys/devices/virtual/dmi/id/power/wakeup b/test/sys/devices/virtual/dmi/id/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/dmi/id/product_name b/test/sys/devices/virtual/dmi/id/product_name new file mode 100644 index 0000000000..7b899b9e32 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/product_name @@ -0,0 +1 @@ +8741C4G diff --git a/test/sys/devices/virtual/dmi/id/product_serial b/test/sys/devices/virtual/dmi/id/product_serial new file mode 100644 index 0000000000..ebf0c607cd --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/product_serial @@ -0,0 +1 @@ +L3AK195 diff --git a/test/sys/devices/virtual/dmi/id/product_uuid b/test/sys/devices/virtual/dmi/id/product_uuid new file mode 100644 index 0000000000..4f53ec4329 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/product_uuid @@ -0,0 +1 @@ +82161681-492E-11CB-BCCA-A7FDE26F414B diff --git a/test/sys/devices/virtual/dmi/id/product_version b/test/sys/devices/virtual/dmi/id/product_version new file mode 100644 index 0000000000..6e0471f033 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/product_version @@ -0,0 +1 @@ +ThinkPad T60p diff --git a/test/sys/devices/virtual/dmi/id/subsystem b/test/sys/devices/virtual/dmi/id/subsystem new file mode 120000 index 0000000000..98086270cf --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/subsystem @@ -0,0 +1 @@ +../../../../class/dmi \ No newline at end of file diff --git a/test/sys/devices/virtual/dmi/id/sys_vendor b/test/sys/devices/virtual/dmi/id/sys_vendor new file mode 100644 index 0000000000..84dae9baf6 --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/sys_vendor @@ -0,0 +1 @@ +LENOVO diff --git a/test/sys/devices/virtual/dmi/id/uevent b/test/sys/devices/virtual/dmi/id/uevent new file mode 100644 index 0000000000..d1455ca29e --- /dev/null +++ b/test/sys/devices/virtual/dmi/id/uevent @@ -0,0 +1 @@ +MODALIAS=dmi:bvnLENOVO:bvr7IET31WW(1.12):bd09/19/2007:svnLENOVO:pn8741C4G:pvrThinkPadT60p:rvnLENOVO:rn8741C4G:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable: diff --git a/test/sys/devices/virtual/graphics/fbcon/cursor_blink b/test/sys/devices/virtual/graphics/fbcon/cursor_blink new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/graphics/fbcon/cursor_blink @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/graphics/fbcon/power/wakeup b/test/sys/devices/virtual/graphics/fbcon/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/graphics/fbcon/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/graphics/fbcon/rotate b/test/sys/devices/virtual/graphics/fbcon/rotate new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/graphics/fbcon/rotate @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/graphics/fbcon/subsystem b/test/sys/devices/virtual/graphics/fbcon/subsystem new file mode 120000 index 0000000000..2bb3d7c891 --- /dev/null +++ b/test/sys/devices/virtual/graphics/fbcon/subsystem @@ -0,0 +1 @@ +../../../../class/graphics \ No newline at end of file diff --git a/test/sys/devices/virtual/graphics/fbcon/uevent b/test/sys/devices/virtual/graphics/fbcon/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/input/input6/capabilities/abs b/test/sys/devices/virtual/input/input6/capabilities/abs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/capabilities/abs @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/ev b/test/sys/devices/virtual/input/input6/capabilities/ev new file mode 100644 index 0000000000..bb95160cb6 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/capabilities/ev @@ -0,0 +1 @@ +33 diff --git a/test/sys/devices/virtual/input/input6/capabilities/ff b/test/sys/devices/virtual/input/input6/capabilities/ff new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/capabilities/ff @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/key b/test/sys/devices/virtual/input/input6/capabilities/key new file mode 100644 index 0000000000..2dd8e658dd --- /dev/null +++ b/test/sys/devices/virtual/input/input6/capabilities/key @@ -0,0 +1 @@ +18840000 2 10010000000000 0 1101b00002005 1004000 e000000000000 0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/led b/test/sys/devices/virtual/input/input6/capabilities/led new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/capabilities/led @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/msc b/test/sys/devices/virtual/input/input6/capabilities/msc new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/input/input6/capabilities/msc @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/input/input6/capabilities/rel b/test/sys/devices/virtual/input/input6/capabilities/rel new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/capabilities/rel @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/snd b/test/sys/devices/virtual/input/input6/capabilities/snd new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/capabilities/snd @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/sw b/test/sys/devices/virtual/input/input6/capabilities/sw new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/virtual/input/input6/capabilities/sw @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/virtual/input/input6/event6/dev b/test/sys/devices/virtual/input/input6/event6/dev new file mode 100644 index 0000000000..86cdae4868 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/event6/dev @@ -0,0 +1 @@ +13:70 diff --git a/test/sys/devices/virtual/input/input6/event6/device b/test/sys/devices/virtual/input/input6/event6/device new file mode 120000 index 0000000000..b2c87d8fd5 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/event6/device @@ -0,0 +1 @@ +../../input6 \ No newline at end of file diff --git a/test/sys/devices/virtual/input/input6/event6/power/wakeup b/test/sys/devices/virtual/input/input6/event6/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/event6/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/input/input6/event6/subsystem b/test/sys/devices/virtual/input/input6/event6/subsystem new file mode 120000 index 0000000000..bd2a91fcf2 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/event6/subsystem @@ -0,0 +1 @@ +../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/virtual/input/input6/event6/uevent b/test/sys/devices/virtual/input/input6/event6/uevent new file mode 100644 index 0000000000..38cfaedb0f --- /dev/null +++ b/test/sys/devices/virtual/input/input6/event6/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=70 diff --git a/test/sys/devices/virtual/input/input6/id/bustype b/test/sys/devices/virtual/input/input6/id/bustype new file mode 100644 index 0000000000..f1993fb3a7 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/id/bustype @@ -0,0 +1 @@ +0019 diff --git a/test/sys/devices/virtual/input/input6/id/product b/test/sys/devices/virtual/input/input6/id/product new file mode 100644 index 0000000000..d7998ca503 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/id/product @@ -0,0 +1 @@ +5054 diff --git a/test/sys/devices/virtual/input/input6/id/vendor b/test/sys/devices/virtual/input/input6/id/vendor new file mode 100644 index 0000000000..1e2f734e4f --- /dev/null +++ b/test/sys/devices/virtual/input/input6/id/vendor @@ -0,0 +1 @@ +17aa diff --git a/test/sys/devices/virtual/input/input6/id/version b/test/sys/devices/virtual/input/input6/id/version new file mode 100644 index 0000000000..cb15afe743 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/id/version @@ -0,0 +1 @@ +4101 diff --git a/test/sys/devices/virtual/input/input6/modalias b/test/sys/devices/virtual/input/input6/modalias new file mode 100644 index 0000000000..5c0877dd8b --- /dev/null +++ b/test/sys/devices/virtual/input/input6/modalias @@ -0,0 +1 @@ +input:b0019v17AAp5054e4101-e0,1,4,5,k71,72,73,8E,98,C0,C2,CD,E0,E1,E3,E4,EC,F0,168,174,181,1D2,1D7,1DB,1DC,ram4,lsfw3, diff --git a/test/sys/devices/virtual/input/input6/name b/test/sys/devices/virtual/input/input6/name new file mode 100644 index 0000000000..41ab1abca8 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/name @@ -0,0 +1 @@ +ThinkPad Extra Buttons diff --git a/test/sys/devices/virtual/input/input6/phys b/test/sys/devices/virtual/input/input6/phys new file mode 100644 index 0000000000..a3c6d04da4 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/phys @@ -0,0 +1 @@ +thinkpad_acpi/input0 diff --git a/test/sys/devices/virtual/input/input6/power/wakeup b/test/sys/devices/virtual/input/input6/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/input/input6/subsystem b/test/sys/devices/virtual/input/input6/subsystem new file mode 120000 index 0000000000..2a4af36646 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/subsystem @@ -0,0 +1 @@ +../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/virtual/input/input6/uevent b/test/sys/devices/virtual/input/input6/uevent new file mode 100644 index 0000000000..34ae721d6e --- /dev/null +++ b/test/sys/devices/virtual/input/input6/uevent @@ -0,0 +1,8 @@ +PRODUCT=19/17aa/5054/4101 +NAME="ThinkPad Extra Buttons" +PHYS="thinkpad_acpi/input0" +EV==33 +KEY==18840000 2 10010000000000 0 1101b00002005 1004000 e000000000000 0 +MSC==10 +SW==8 +MODALIAS=input:b0019v17AAp5054e4101-e0,1,4,5,k71,72,73,8E,98,C0,C2,CD,E0,E1,E3,E4,EC,F0,168,174,181,1D2,1D7,1DB,1DC,ram4,lsfw3, diff --git a/test/sys/devices/virtual/input/input6/uniq b/test/sys/devices/virtual/input/input6/uniq new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/input/input6/uniq @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/input/mice/dev b/test/sys/devices/virtual/input/mice/dev new file mode 100644 index 0000000000..d9b0b90407 --- /dev/null +++ b/test/sys/devices/virtual/input/mice/dev @@ -0,0 +1 @@ +13:63 diff --git a/test/sys/devices/virtual/input/mice/power/wakeup b/test/sys/devices/virtual/input/mice/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/input/mice/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/input/mice/subsystem b/test/sys/devices/virtual/input/mice/subsystem new file mode 120000 index 0000000000..2a4af36646 --- /dev/null +++ b/test/sys/devices/virtual/input/mice/subsystem @@ -0,0 +1 @@ +../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/virtual/input/mice/uevent b/test/sys/devices/virtual/input/mice/uevent new file mode 100644 index 0000000000..5a754f68a0 --- /dev/null +++ b/test/sys/devices/virtual/input/mice/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=63 diff --git a/test/sys/devices/virtual/mem/full/dev b/test/sys/devices/virtual/mem/full/dev new file mode 100644 index 0000000000..4dc588f930 --- /dev/null +++ b/test/sys/devices/virtual/mem/full/dev @@ -0,0 +1 @@ +1:7 diff --git a/test/sys/devices/virtual/mem/full/power/wakeup b/test/sys/devices/virtual/mem/full/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/mem/full/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/mem/full/subsystem b/test/sys/devices/virtual/mem/full/subsystem new file mode 120000 index 0000000000..3ac1f53f89 --- /dev/null +++ b/test/sys/devices/virtual/mem/full/subsystem @@ -0,0 +1 @@ +../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/full/uevent b/test/sys/devices/virtual/mem/full/uevent new file mode 100644 index 0000000000..0f608f0f79 --- /dev/null +++ b/test/sys/devices/virtual/mem/full/uevent @@ -0,0 +1,2 @@ +MAJOR=1 +MINOR=7 diff --git a/test/sys/devices/virtual/mem/kmem/dev b/test/sys/devices/virtual/mem/kmem/dev new file mode 100644 index 0000000000..c7bc405e0f --- /dev/null +++ b/test/sys/devices/virtual/mem/kmem/dev @@ -0,0 +1 @@ +1:2 diff --git a/test/sys/devices/virtual/mem/kmem/power/wakeup b/test/sys/devices/virtual/mem/kmem/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/mem/kmem/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/mem/kmem/subsystem b/test/sys/devices/virtual/mem/kmem/subsystem new file mode 120000 index 0000000000..3ac1f53f89 --- /dev/null +++ b/test/sys/devices/virtual/mem/kmem/subsystem @@ -0,0 +1 @@ +../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/kmem/uevent b/test/sys/devices/virtual/mem/kmem/uevent new file mode 100644 index 0000000000..90ea9b4d77 --- /dev/null +++ b/test/sys/devices/virtual/mem/kmem/uevent @@ -0,0 +1,2 @@ +MAJOR=1 +MINOR=2 diff --git a/test/sys/devices/virtual/mem/kmsg/dev b/test/sys/devices/virtual/mem/kmsg/dev new file mode 100644 index 0000000000..59effa12a9 --- /dev/null +++ b/test/sys/devices/virtual/mem/kmsg/dev @@ -0,0 +1 @@ +1:11 diff --git a/test/sys/devices/virtual/mem/kmsg/power/wakeup b/test/sys/devices/virtual/mem/kmsg/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/mem/kmsg/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/mem/kmsg/subsystem b/test/sys/devices/virtual/mem/kmsg/subsystem new file mode 120000 index 0000000000..3ac1f53f89 --- /dev/null +++ b/test/sys/devices/virtual/mem/kmsg/subsystem @@ -0,0 +1 @@ +../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/kmsg/uevent b/test/sys/devices/virtual/mem/kmsg/uevent new file mode 100644 index 0000000000..f9386d0564 --- /dev/null +++ b/test/sys/devices/virtual/mem/kmsg/uevent @@ -0,0 +1,2 @@ +MAJOR=1 +MINOR=11 diff --git a/test/sys/devices/virtual/mem/mem/dev b/test/sys/devices/virtual/mem/mem/dev new file mode 100644 index 0000000000..a72b75e75e --- /dev/null +++ b/test/sys/devices/virtual/mem/mem/dev @@ -0,0 +1 @@ +1:1 diff --git a/test/sys/devices/virtual/mem/mem/power/wakeup b/test/sys/devices/virtual/mem/mem/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/mem/mem/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/mem/mem/subsystem b/test/sys/devices/virtual/mem/mem/subsystem new file mode 120000 index 0000000000..3ac1f53f89 --- /dev/null +++ b/test/sys/devices/virtual/mem/mem/subsystem @@ -0,0 +1 @@ +../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/mem/uevent b/test/sys/devices/virtual/mem/mem/uevent new file mode 100644 index 0000000000..c755b90645 --- /dev/null +++ b/test/sys/devices/virtual/mem/mem/uevent @@ -0,0 +1,2 @@ +MAJOR=1 +MINOR=1 diff --git a/test/sys/devices/virtual/mem/null/dev b/test/sys/devices/virtual/mem/null/dev new file mode 100644 index 0000000000..d9812edfef --- /dev/null +++ b/test/sys/devices/virtual/mem/null/dev @@ -0,0 +1 @@ +1:3 diff --git a/test/sys/devices/virtual/mem/null/power/wakeup b/test/sys/devices/virtual/mem/null/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/mem/null/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/mem/null/subsystem b/test/sys/devices/virtual/mem/null/subsystem new file mode 120000 index 0000000000..3ac1f53f89 --- /dev/null +++ b/test/sys/devices/virtual/mem/null/subsystem @@ -0,0 +1 @@ +../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/null/uevent b/test/sys/devices/virtual/mem/null/uevent new file mode 100644 index 0000000000..a26957d9fe --- /dev/null +++ b/test/sys/devices/virtual/mem/null/uevent @@ -0,0 +1,2 @@ +MAJOR=1 +MINOR=3 diff --git a/test/sys/devices/virtual/mem/port/dev b/test/sys/devices/virtual/mem/port/dev new file mode 100644 index 0000000000..ab11afd2ec --- /dev/null +++ b/test/sys/devices/virtual/mem/port/dev @@ -0,0 +1 @@ +1:4 diff --git a/test/sys/devices/virtual/mem/port/power/wakeup b/test/sys/devices/virtual/mem/port/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/mem/port/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/mem/port/subsystem b/test/sys/devices/virtual/mem/port/subsystem new file mode 120000 index 0000000000..3ac1f53f89 --- /dev/null +++ b/test/sys/devices/virtual/mem/port/subsystem @@ -0,0 +1 @@ +../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/port/uevent b/test/sys/devices/virtual/mem/port/uevent new file mode 100644 index 0000000000..a3655e8547 --- /dev/null +++ b/test/sys/devices/virtual/mem/port/uevent @@ -0,0 +1,2 @@ +MAJOR=1 +MINOR=4 diff --git a/test/sys/devices/virtual/mem/random/dev b/test/sys/devices/virtual/mem/random/dev new file mode 100644 index 0000000000..2b7b905849 --- /dev/null +++ b/test/sys/devices/virtual/mem/random/dev @@ -0,0 +1 @@ +1:8 diff --git a/test/sys/devices/virtual/mem/random/power/wakeup b/test/sys/devices/virtual/mem/random/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/mem/random/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/mem/random/subsystem b/test/sys/devices/virtual/mem/random/subsystem new file mode 120000 index 0000000000..3ac1f53f89 --- /dev/null +++ b/test/sys/devices/virtual/mem/random/subsystem @@ -0,0 +1 @@ +../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/random/uevent b/test/sys/devices/virtual/mem/random/uevent new file mode 100644 index 0000000000..c63f2f3794 --- /dev/null +++ b/test/sys/devices/virtual/mem/random/uevent @@ -0,0 +1,2 @@ +MAJOR=1 +MINOR=8 diff --git a/test/sys/devices/virtual/mem/urandom/dev b/test/sys/devices/virtual/mem/urandom/dev new file mode 100644 index 0000000000..0695af03c5 --- /dev/null +++ b/test/sys/devices/virtual/mem/urandom/dev @@ -0,0 +1 @@ +1:9 diff --git a/test/sys/devices/virtual/mem/urandom/power/wakeup b/test/sys/devices/virtual/mem/urandom/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/mem/urandom/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/mem/urandom/subsystem b/test/sys/devices/virtual/mem/urandom/subsystem new file mode 120000 index 0000000000..3ac1f53f89 --- /dev/null +++ b/test/sys/devices/virtual/mem/urandom/subsystem @@ -0,0 +1 @@ +../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/urandom/uevent b/test/sys/devices/virtual/mem/urandom/uevent new file mode 100644 index 0000000000..fb5b500e9d --- /dev/null +++ b/test/sys/devices/virtual/mem/urandom/uevent @@ -0,0 +1,2 @@ +MAJOR=1 +MINOR=9 diff --git a/test/sys/devices/virtual/mem/zero/dev b/test/sys/devices/virtual/mem/zero/dev new file mode 100644 index 0000000000..0acbea55a4 --- /dev/null +++ b/test/sys/devices/virtual/mem/zero/dev @@ -0,0 +1 @@ +1:5 diff --git a/test/sys/devices/virtual/mem/zero/power/wakeup b/test/sys/devices/virtual/mem/zero/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/mem/zero/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/mem/zero/subsystem b/test/sys/devices/virtual/mem/zero/subsystem new file mode 120000 index 0000000000..3ac1f53f89 --- /dev/null +++ b/test/sys/devices/virtual/mem/zero/subsystem @@ -0,0 +1 @@ +../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/zero/uevent b/test/sys/devices/virtual/mem/zero/uevent new file mode 100644 index 0000000000..868763b207 --- /dev/null +++ b/test/sys/devices/virtual/mem/zero/uevent @@ -0,0 +1,2 @@ +MAJOR=1 +MINOR=5 diff --git a/test/sys/devices/virtual/misc/cpu_dma_latency/dev b/test/sys/devices/virtual/misc/cpu_dma_latency/dev new file mode 100644 index 0000000000..28837209ce --- /dev/null +++ b/test/sys/devices/virtual/misc/cpu_dma_latency/dev @@ -0,0 +1 @@ +10:63 diff --git a/test/sys/devices/virtual/misc/cpu_dma_latency/power/wakeup b/test/sys/devices/virtual/misc/cpu_dma_latency/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/cpu_dma_latency/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/cpu_dma_latency/subsystem b/test/sys/devices/virtual/misc/cpu_dma_latency/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/cpu_dma_latency/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/cpu_dma_latency/uevent b/test/sys/devices/virtual/misc/cpu_dma_latency/uevent new file mode 100644 index 0000000000..4bdadb6f50 --- /dev/null +++ b/test/sys/devices/virtual/misc/cpu_dma_latency/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=63 diff --git a/test/sys/devices/virtual/misc/device-mapper/dev b/test/sys/devices/virtual/misc/device-mapper/dev new file mode 100644 index 0000000000..0ec44eadb5 --- /dev/null +++ b/test/sys/devices/virtual/misc/device-mapper/dev @@ -0,0 +1 @@ +10:60 diff --git a/test/sys/devices/virtual/misc/device-mapper/power/wakeup b/test/sys/devices/virtual/misc/device-mapper/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/device-mapper/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/device-mapper/subsystem b/test/sys/devices/virtual/misc/device-mapper/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/device-mapper/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/device-mapper/uevent b/test/sys/devices/virtual/misc/device-mapper/uevent new file mode 100644 index 0000000000..8ed41d736f --- /dev/null +++ b/test/sys/devices/virtual/misc/device-mapper/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=60 diff --git a/test/sys/devices/virtual/misc/fuse/dev b/test/sys/devices/virtual/misc/fuse/dev new file mode 100644 index 0000000000..79f0a7cccf --- /dev/null +++ b/test/sys/devices/virtual/misc/fuse/dev @@ -0,0 +1 @@ +10:229 diff --git a/test/sys/devices/virtual/misc/fuse/power/wakeup b/test/sys/devices/virtual/misc/fuse/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/fuse/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/fuse/subsystem b/test/sys/devices/virtual/misc/fuse/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/fuse/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/fuse/uevent b/test/sys/devices/virtual/misc/fuse/uevent new file mode 100644 index 0000000000..68746cf6f2 --- /dev/null +++ b/test/sys/devices/virtual/misc/fuse/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=229 diff --git a/test/sys/devices/virtual/misc/hpet/dev b/test/sys/devices/virtual/misc/hpet/dev new file mode 100644 index 0000000000..daa7cef902 --- /dev/null +++ b/test/sys/devices/virtual/misc/hpet/dev @@ -0,0 +1 @@ +10:228 diff --git a/test/sys/devices/virtual/misc/hpet/power/wakeup b/test/sys/devices/virtual/misc/hpet/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/hpet/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/hpet/subsystem b/test/sys/devices/virtual/misc/hpet/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/hpet/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/hpet/uevent b/test/sys/devices/virtual/misc/hpet/uevent new file mode 100644 index 0000000000..f5d709e4b2 --- /dev/null +++ b/test/sys/devices/virtual/misc/hpet/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=228 diff --git a/test/sys/devices/virtual/misc/mcelog/dev b/test/sys/devices/virtual/misc/mcelog/dev new file mode 100644 index 0000000000..103ebda577 --- /dev/null +++ b/test/sys/devices/virtual/misc/mcelog/dev @@ -0,0 +1 @@ +10:227 diff --git a/test/sys/devices/virtual/misc/mcelog/power/wakeup b/test/sys/devices/virtual/misc/mcelog/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/mcelog/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/mcelog/subsystem b/test/sys/devices/virtual/misc/mcelog/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/mcelog/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/mcelog/uevent b/test/sys/devices/virtual/misc/mcelog/uevent new file mode 100644 index 0000000000..572ef2a6b2 --- /dev/null +++ b/test/sys/devices/virtual/misc/mcelog/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=227 diff --git a/test/sys/devices/virtual/misc/microcode/dev b/test/sys/devices/virtual/misc/microcode/dev new file mode 100644 index 0000000000..ece87cd3f8 --- /dev/null +++ b/test/sys/devices/virtual/misc/microcode/dev @@ -0,0 +1 @@ +10:184 diff --git a/test/sys/devices/virtual/misc/microcode/power/wakeup b/test/sys/devices/virtual/misc/microcode/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/microcode/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/microcode/subsystem b/test/sys/devices/virtual/misc/microcode/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/microcode/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/microcode/uevent b/test/sys/devices/virtual/misc/microcode/uevent new file mode 100644 index 0000000000..6ef0dc9892 --- /dev/null +++ b/test/sys/devices/virtual/misc/microcode/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=184 diff --git a/test/sys/devices/virtual/misc/misc-fake1/dev b/test/sys/devices/virtual/misc/misc-fake1/dev new file mode 100644 index 0000000000..ab453138aa --- /dev/null +++ b/test/sys/devices/virtual/misc/misc-fake1/dev @@ -0,0 +1 @@ +4095:1 diff --git a/test/sys/devices/virtual/misc/misc-fake1/power/wakeup b/test/sys/devices/virtual/misc/misc-fake1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/misc-fake1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/misc-fake1/subsystem b/test/sys/devices/virtual/misc/misc-fake1/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/misc-fake1/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/misc-fake1/uevent b/test/sys/devices/virtual/misc/misc-fake1/uevent new file mode 100644 index 0000000000..79caac10ef --- /dev/null +++ b/test/sys/devices/virtual/misc/misc-fake1/uevent @@ -0,0 +1,2 @@ +MAJOR=4095 +MINOR=1 diff --git a/test/sys/devices/virtual/misc/misc-fake89999/dev b/test/sys/devices/virtual/misc/misc-fake89999/dev new file mode 100644 index 0000000000..a3793f5e66 --- /dev/null +++ b/test/sys/devices/virtual/misc/misc-fake89999/dev @@ -0,0 +1 @@ +4095:89999 diff --git a/test/sys/devices/virtual/misc/misc-fake89999/power/wakeup b/test/sys/devices/virtual/misc/misc-fake89999/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/misc-fake89999/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/misc-fake89999/subsystem b/test/sys/devices/virtual/misc/misc-fake89999/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/misc-fake89999/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/misc-fake89999/uevent b/test/sys/devices/virtual/misc/misc-fake89999/uevent new file mode 100644 index 0000000000..10915df871 --- /dev/null +++ b/test/sys/devices/virtual/misc/misc-fake89999/uevent @@ -0,0 +1,2 @@ +MAJOR=4095 +MINOR=89999 diff --git a/test/sys/devices/virtual/misc/network_latency/dev b/test/sys/devices/virtual/misc/network_latency/dev new file mode 100644 index 0000000000..e0d47a5fd0 --- /dev/null +++ b/test/sys/devices/virtual/misc/network_latency/dev @@ -0,0 +1 @@ +10:62 diff --git a/test/sys/devices/virtual/misc/network_latency/power/wakeup b/test/sys/devices/virtual/misc/network_latency/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/network_latency/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/network_latency/subsystem b/test/sys/devices/virtual/misc/network_latency/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/network_latency/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/network_latency/uevent b/test/sys/devices/virtual/misc/network_latency/uevent new file mode 100644 index 0000000000..418594295c --- /dev/null +++ b/test/sys/devices/virtual/misc/network_latency/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=62 diff --git a/test/sys/devices/virtual/misc/network_throughput/dev b/test/sys/devices/virtual/misc/network_throughput/dev new file mode 100644 index 0000000000..e201e40e50 --- /dev/null +++ b/test/sys/devices/virtual/misc/network_throughput/dev @@ -0,0 +1 @@ +10:61 diff --git a/test/sys/devices/virtual/misc/network_throughput/power/wakeup b/test/sys/devices/virtual/misc/network_throughput/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/network_throughput/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/network_throughput/subsystem b/test/sys/devices/virtual/misc/network_throughput/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/network_throughput/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/network_throughput/uevent b/test/sys/devices/virtual/misc/network_throughput/uevent new file mode 100644 index 0000000000..6749edd437 --- /dev/null +++ b/test/sys/devices/virtual/misc/network_throughput/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=61 diff --git a/test/sys/devices/virtual/misc/nvram/dev b/test/sys/devices/virtual/misc/nvram/dev new file mode 100644 index 0000000000..e147110645 --- /dev/null +++ b/test/sys/devices/virtual/misc/nvram/dev @@ -0,0 +1 @@ +10:144 diff --git a/test/sys/devices/virtual/misc/nvram/power/wakeup b/test/sys/devices/virtual/misc/nvram/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/nvram/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/nvram/subsystem b/test/sys/devices/virtual/misc/nvram/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/nvram/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/nvram/uevent b/test/sys/devices/virtual/misc/nvram/uevent new file mode 100644 index 0000000000..28a0aa22b8 --- /dev/null +++ b/test/sys/devices/virtual/misc/nvram/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=144 diff --git a/test/sys/devices/virtual/misc/psaux/dev b/test/sys/devices/virtual/misc/psaux/dev new file mode 100644 index 0000000000..48ace1eca2 --- /dev/null +++ b/test/sys/devices/virtual/misc/psaux/dev @@ -0,0 +1 @@ +10:1 diff --git a/test/sys/devices/virtual/misc/psaux/power/wakeup b/test/sys/devices/virtual/misc/psaux/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/psaux/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/psaux/subsystem b/test/sys/devices/virtual/misc/psaux/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/psaux/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/psaux/uevent b/test/sys/devices/virtual/misc/psaux/uevent new file mode 100644 index 0000000000..c4ee0650db --- /dev/null +++ b/test/sys/devices/virtual/misc/psaux/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=1 diff --git a/test/sys/devices/virtual/misc/uinput/dev b/test/sys/devices/virtual/misc/uinput/dev new file mode 100644 index 0000000000..a47be0d551 --- /dev/null +++ b/test/sys/devices/virtual/misc/uinput/dev @@ -0,0 +1 @@ +10:223 diff --git a/test/sys/devices/virtual/misc/uinput/power/wakeup b/test/sys/devices/virtual/misc/uinput/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/misc/uinput/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/misc/uinput/subsystem b/test/sys/devices/virtual/misc/uinput/subsystem new file mode 120000 index 0000000000..168949151e --- /dev/null +++ b/test/sys/devices/virtual/misc/uinput/subsystem @@ -0,0 +1 @@ +../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/uinput/uevent b/test/sys/devices/virtual/misc/uinput/uevent new file mode 100644 index 0000000000..4dd780577d --- /dev/null +++ b/test/sys/devices/virtual/misc/uinput/uevent @@ -0,0 +1,2 @@ +MAJOR=10 +MINOR=223 diff --git a/test/sys/devices/virtual/net/lo/addr_len b/test/sys/devices/virtual/net/lo/addr_len new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/addr_len @@ -0,0 +1 @@ +6 diff --git a/test/sys/devices/virtual/net/lo/address b/test/sys/devices/virtual/net/lo/address new file mode 100644 index 0000000000..34e09d077c --- /dev/null +++ b/test/sys/devices/virtual/net/lo/address @@ -0,0 +1 @@ +00:00:00:00:00:00 diff --git a/test/sys/devices/virtual/net/lo/broadcast b/test/sys/devices/virtual/net/lo/broadcast new file mode 100644 index 0000000000..34e09d077c --- /dev/null +++ b/test/sys/devices/virtual/net/lo/broadcast @@ -0,0 +1 @@ +00:00:00:00:00:00 diff --git a/test/sys/devices/virtual/net/lo/carrier b/test/sys/devices/virtual/net/lo/carrier new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/net/lo/carrier @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/net/lo/dev_id b/test/sys/devices/virtual/net/lo/dev_id new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/dev_id @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/virtual/net/lo/dormant b/test/sys/devices/virtual/net/lo/dormant new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/dormant @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/features b/test/sys/devices/virtual/net/lo/features new file mode 100644 index 0000000000..dd1bd2f4c0 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/features @@ -0,0 +1 @@ +0x13865 diff --git a/test/sys/devices/virtual/net/lo/flags b/test/sys/devices/virtual/net/lo/flags new file mode 100644 index 0000000000..4bc4da19ae --- /dev/null +++ b/test/sys/devices/virtual/net/lo/flags @@ -0,0 +1 @@ +0x9 diff --git a/test/sys/devices/virtual/net/lo/ifindex b/test/sys/devices/virtual/net/lo/ifindex new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/net/lo/ifindex @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/net/lo/iflink b/test/sys/devices/virtual/net/lo/iflink new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/net/lo/iflink @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/net/lo/link_mode b/test/sys/devices/virtual/net/lo/link_mode new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/link_mode @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/mtu b/test/sys/devices/virtual/net/lo/mtu new file mode 100644 index 0000000000..e20e16cfe8 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/mtu @@ -0,0 +1 @@ +16436 diff --git a/test/sys/devices/virtual/net/lo/operstate b/test/sys/devices/virtual/net/lo/operstate new file mode 100644 index 0000000000..3546645658 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/operstate @@ -0,0 +1 @@ +unknown diff --git a/test/sys/devices/virtual/net/lo/power/wakeup b/test/sys/devices/virtual/net/lo/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/net/lo/statistics/collisions b/test/sys/devices/virtual/net/lo/statistics/collisions new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/collisions @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/multicast b/test/sys/devices/virtual/net/lo/statistics/multicast new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/multicast @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_bytes b/test/sys/devices/virtual/net/lo/statistics/rx_bytes new file mode 100644 index 0000000000..058db39b75 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_bytes @@ -0,0 +1 @@ +3380 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_compressed b/test/sys/devices/virtual/net/lo/statistics/rx_compressed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_compressed @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_crc_errors b/test/sys/devices/virtual/net/lo/statistics/rx_crc_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_crc_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_dropped b/test/sys/devices/virtual/net/lo/statistics/rx_dropped new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_dropped @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_errors b/test/sys/devices/virtual/net/lo/statistics/rx_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_fifo_errors b/test/sys/devices/virtual/net/lo/statistics/rx_fifo_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_fifo_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_frame_errors b/test/sys/devices/virtual/net/lo/statistics/rx_frame_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_frame_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_length_errors b/test/sys/devices/virtual/net/lo/statistics/rx_length_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_length_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_missed_errors b/test/sys/devices/virtual/net/lo/statistics/rx_missed_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_missed_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_over_errors b/test/sys/devices/virtual/net/lo/statistics/rx_over_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_over_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_packets b/test/sys/devices/virtual/net/lo/statistics/rx_packets new file mode 100644 index 0000000000..9e5feb5256 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/rx_packets @@ -0,0 +1 @@ +46 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_aborted_errors b/test/sys/devices/virtual/net/lo/statistics/tx_aborted_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_aborted_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_bytes b/test/sys/devices/virtual/net/lo/statistics/tx_bytes new file mode 100644 index 0000000000..058db39b75 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_bytes @@ -0,0 +1 @@ +3380 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_carrier_errors b/test/sys/devices/virtual/net/lo/statistics/tx_carrier_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_carrier_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_compressed b/test/sys/devices/virtual/net/lo/statistics/tx_compressed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_compressed @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_dropped b/test/sys/devices/virtual/net/lo/statistics/tx_dropped new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_dropped @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_errors b/test/sys/devices/virtual/net/lo/statistics/tx_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_fifo_errors b/test/sys/devices/virtual/net/lo/statistics/tx_fifo_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_fifo_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_heartbeat_errors b/test/sys/devices/virtual/net/lo/statistics/tx_heartbeat_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_heartbeat_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_packets b/test/sys/devices/virtual/net/lo/statistics/tx_packets new file mode 100644 index 0000000000..9e5feb5256 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_packets @@ -0,0 +1 @@ +46 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_window_errors b/test/sys/devices/virtual/net/lo/statistics/tx_window_errors new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/statistics/tx_window_errors @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/subsystem b/test/sys/devices/virtual/net/lo/subsystem new file mode 120000 index 0000000000..508114fb7f --- /dev/null +++ b/test/sys/devices/virtual/net/lo/subsystem @@ -0,0 +1 @@ +../../../../class/net \ No newline at end of file diff --git a/test/sys/devices/virtual/net/lo/tx_queue_len b/test/sys/devices/virtual/net/lo/tx_queue_len new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/tx_queue_len @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/net/lo/type b/test/sys/devices/virtual/net/lo/type new file mode 100644 index 0000000000..6d629c4a23 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/type @@ -0,0 +1 @@ +772 diff --git a/test/sys/devices/virtual/net/lo/uevent b/test/sys/devices/virtual/net/lo/uevent new file mode 100644 index 0000000000..58110228a7 --- /dev/null +++ b/test/sys/devices/virtual/net/lo/uevent @@ -0,0 +1,2 @@ +INTERFACE=lo +IFINDEX=1 diff --git a/test/sys/devices/virtual/sound/seq/dev b/test/sys/devices/virtual/sound/seq/dev new file mode 100644 index 0000000000..1a0d1fd1f2 --- /dev/null +++ b/test/sys/devices/virtual/sound/seq/dev @@ -0,0 +1 @@ +116:1 diff --git a/test/sys/devices/virtual/sound/seq/power/wakeup b/test/sys/devices/virtual/sound/seq/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/sound/seq/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/sound/seq/subsystem b/test/sys/devices/virtual/sound/seq/subsystem new file mode 120000 index 0000000000..19f824e8c4 --- /dev/null +++ b/test/sys/devices/virtual/sound/seq/subsystem @@ -0,0 +1 @@ +../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/virtual/sound/seq/uevent b/test/sys/devices/virtual/sound/seq/uevent new file mode 100644 index 0000000000..25e7c9dee1 --- /dev/null +++ b/test/sys/devices/virtual/sound/seq/uevent @@ -0,0 +1,2 @@ +MAJOR=116 +MINOR=1 diff --git a/test/sys/devices/virtual/sound/timer/dev b/test/sys/devices/virtual/sound/timer/dev new file mode 100644 index 0000000000..2929a66732 --- /dev/null +++ b/test/sys/devices/virtual/sound/timer/dev @@ -0,0 +1 @@ +116:33 diff --git a/test/sys/devices/virtual/sound/timer/power/wakeup b/test/sys/devices/virtual/sound/timer/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/sound/timer/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/sound/timer/subsystem b/test/sys/devices/virtual/sound/timer/subsystem new file mode 120000 index 0000000000..19f824e8c4 --- /dev/null +++ b/test/sys/devices/virtual/sound/timer/subsystem @@ -0,0 +1 @@ +../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/virtual/sound/timer/uevent b/test/sys/devices/virtual/sound/timer/uevent new file mode 100644 index 0000000000..fc65cb6c5c --- /dev/null +++ b/test/sys/devices/virtual/sound/timer/uevent @@ -0,0 +1,2 @@ +MAJOR=116 +MINOR=33 diff --git a/test/sys/devices/virtual/thermal/cooling_device0/cur_state b/test/sys/devices/virtual/thermal/cooling_device0/cur_state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device0/cur_state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/thermal/cooling_device0/device b/test/sys/devices/virtual/thermal/cooling_device0/device new file mode 120000 index 0000000000..782af8da65 --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device0/device @@ -0,0 +1 @@ +../../../LNXSYSTM:00/ACPI0007:00 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/cooling_device0/max_state b/test/sys/devices/virtual/thermal/cooling_device0/max_state new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device0/max_state @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/thermal/cooling_device0/power/wakeup b/test/sys/devices/virtual/thermal/cooling_device0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/thermal/cooling_device0/subsystem b/test/sys/devices/virtual/thermal/cooling_device0/subsystem new file mode 120000 index 0000000000..511bf4b518 --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device0/subsystem @@ -0,0 +1 @@ +../../../../class/thermal \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/cooling_device0/type b/test/sys/devices/virtual/thermal/cooling_device0/type new file mode 100644 index 0000000000..eb921429ef --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device0/type @@ -0,0 +1 @@ +Processor diff --git a/test/sys/devices/virtual/thermal/cooling_device0/uevent b/test/sys/devices/virtual/thermal/cooling_device0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/thermal/cooling_device1/cur_state b/test/sys/devices/virtual/thermal/cooling_device1/cur_state new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device1/cur_state @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/thermal/cooling_device1/device b/test/sys/devices/virtual/thermal/cooling_device1/device new file mode 120000 index 0000000000..d1ea213f83 --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device1/device @@ -0,0 +1 @@ +../../../LNXSYSTM:00/ACPI0007:01 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/cooling_device1/max_state b/test/sys/devices/virtual/thermal/cooling_device1/max_state new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device1/max_state @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/virtual/thermal/cooling_device1/power/wakeup b/test/sys/devices/virtual/thermal/cooling_device1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/thermal/cooling_device1/subsystem b/test/sys/devices/virtual/thermal/cooling_device1/subsystem new file mode 120000 index 0000000000..511bf4b518 --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device1/subsystem @@ -0,0 +1 @@ +../../../../class/thermal \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/cooling_device1/type b/test/sys/devices/virtual/thermal/cooling_device1/type new file mode 100644 index 0000000000..eb921429ef --- /dev/null +++ b/test/sys/devices/virtual/thermal/cooling_device1/type @@ -0,0 +1 @@ +Processor diff --git a/test/sys/devices/virtual/thermal/cooling_device1/uevent b/test/sys/devices/virtual/thermal/cooling_device1/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/device b/test/sys/devices/virtual/thermal/thermal_zone0/device new file mode 120000 index 0000000000..0370bc60ad --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone0/device @@ -0,0 +1 @@ +../../../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/mode b/test/sys/devices/virtual/thermal/thermal_zone0/mode new file mode 100644 index 0000000000..533e957ce2 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone0/mode @@ -0,0 +1 @@ +kernel diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/power/wakeup b/test/sys/devices/virtual/thermal/thermal_zone0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/subsystem b/test/sys/devices/virtual/thermal/thermal_zone0/subsystem new file mode 120000 index 0000000000..511bf4b518 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone0/subsystem @@ -0,0 +1 @@ +../../../../class/thermal \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/temp b/test/sys/devices/virtual/thermal/thermal_zone0/temp new file mode 100644 index 0000000000..7f13265fee --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone0/temp @@ -0,0 +1 @@ +53000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp b/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp new file mode 100644 index 0000000000..e854d41596 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp @@ -0,0 +1 @@ +127000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_type b/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_type new file mode 100644 index 0000000000..886e5fa6f8 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_type @@ -0,0 +1 @@ +critical diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/type b/test/sys/devices/virtual/thermal/thermal_zone0/type new file mode 100644 index 0000000000..a29f406ca9 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone0/type @@ -0,0 +1 @@ +acpitz diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/uevent b/test/sys/devices/virtual/thermal/thermal_zone0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/cdev0 b/test/sys/devices/virtual/thermal/thermal_zone1/cdev0 new file mode 120000 index 0000000000..511cd963f8 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/cdev0 @@ -0,0 +1 @@ +../cooling_device1 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/cdev0_trip_point b/test/sys/devices/virtual/thermal/thermal_zone1/cdev0_trip_point new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/cdev0_trip_point @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/cdev1 b/test/sys/devices/virtual/thermal/thermal_zone1/cdev1 new file mode 120000 index 0000000000..576329385e --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/cdev1 @@ -0,0 +1 @@ +../cooling_device0 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/cdev1_trip_point b/test/sys/devices/virtual/thermal/thermal_zone1/cdev1_trip_point new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/cdev1_trip_point @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/device b/test/sys/devices/virtual/thermal/thermal_zone1/device new file mode 120000 index 0000000000..2bc4755205 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/device @@ -0,0 +1 @@ +../../../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/mode b/test/sys/devices/virtual/thermal/thermal_zone1/mode new file mode 100644 index 0000000000..533e957ce2 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/mode @@ -0,0 +1 @@ +kernel diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/power/wakeup b/test/sys/devices/virtual/thermal/thermal_zone1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/subsystem b/test/sys/devices/virtual/thermal/thermal_zone1/subsystem new file mode 120000 index 0000000000..511bf4b518 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/subsystem @@ -0,0 +1 @@ +../../../../class/thermal \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/temp b/test/sys/devices/virtual/thermal/thermal_zone1/temp new file mode 100644 index 0000000000..3d17ae0bfd --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/temp @@ -0,0 +1 @@ +56000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp new file mode 100644 index 0000000000..f7393e847d --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp @@ -0,0 +1 @@ +100000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_type b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_type new file mode 100644 index 0000000000..886e5fa6f8 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_type @@ -0,0 +1 @@ +critical diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_temp b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_temp new file mode 100644 index 0000000000..6e7b04525a --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_temp @@ -0,0 +1 @@ +95500 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_type b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_type new file mode 100644 index 0000000000..321b98e05d --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_type @@ -0,0 +1 @@ +passive diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/type b/test/sys/devices/virtual/thermal/thermal_zone1/type new file mode 100644 index 0000000000..a29f406ca9 --- /dev/null +++ b/test/sys/devices/virtual/thermal/thermal_zone1/type @@ -0,0 +1 @@ +acpitz diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/uevent b/test/sys/devices/virtual/thermal/thermal_zone1/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/tty/console/dev b/test/sys/devices/virtual/tty/console/dev new file mode 100644 index 0000000000..99eb99cd27 --- /dev/null +++ b/test/sys/devices/virtual/tty/console/dev @@ -0,0 +1 @@ +5:1 diff --git a/test/sys/devices/virtual/tty/console/power/wakeup b/test/sys/devices/virtual/tty/console/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/console/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/console/subsystem b/test/sys/devices/virtual/tty/console/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/console/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/console/uevent b/test/sys/devices/virtual/tty/console/uevent new file mode 100644 index 0000000000..0eaf8b9eb0 --- /dev/null +++ b/test/sys/devices/virtual/tty/console/uevent @@ -0,0 +1,2 @@ +MAJOR=5 +MINOR=1 diff --git a/test/sys/devices/virtual/tty/ptmx/dev b/test/sys/devices/virtual/tty/ptmx/dev new file mode 100644 index 0000000000..b1df63ebd3 --- /dev/null +++ b/test/sys/devices/virtual/tty/ptmx/dev @@ -0,0 +1 @@ +5:2 diff --git a/test/sys/devices/virtual/tty/ptmx/power/wakeup b/test/sys/devices/virtual/tty/ptmx/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/ptmx/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/ptmx/subsystem b/test/sys/devices/virtual/tty/ptmx/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/ptmx/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/ptmx/uevent b/test/sys/devices/virtual/tty/ptmx/uevent new file mode 100644 index 0000000000..9002cdd00a --- /dev/null +++ b/test/sys/devices/virtual/tty/ptmx/uevent @@ -0,0 +1,2 @@ +MAJOR=5 +MINOR=2 diff --git a/test/sys/devices/virtual/tty/tty/dev b/test/sys/devices/virtual/tty/tty/dev new file mode 100644 index 0000000000..97f5a222f0 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty/dev @@ -0,0 +1 @@ +5:0 diff --git a/test/sys/devices/virtual/tty/tty/power/wakeup b/test/sys/devices/virtual/tty/tty/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty/subsystem b/test/sys/devices/virtual/tty/tty/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty/uevent b/test/sys/devices/virtual/tty/tty/uevent new file mode 100644 index 0000000000..5526a77b78 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty/uevent @@ -0,0 +1,2 @@ +MAJOR=5 +MINOR=0 diff --git a/test/sys/devices/virtual/tty/tty0/dev b/test/sys/devices/virtual/tty/tty0/dev new file mode 100644 index 0000000000..192d8b739c --- /dev/null +++ b/test/sys/devices/virtual/tty/tty0/dev @@ -0,0 +1 @@ +4:0 diff --git a/test/sys/devices/virtual/tty/tty0/power/wakeup b/test/sys/devices/virtual/tty/tty0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty0/subsystem b/test/sys/devices/virtual/tty/tty0/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty0/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty0/uevent b/test/sys/devices/virtual/tty/tty0/uevent new file mode 100644 index 0000000000..11692def2c --- /dev/null +++ b/test/sys/devices/virtual/tty/tty0/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=0 diff --git a/test/sys/devices/virtual/tty/tty1/dev b/test/sys/devices/virtual/tty/tty1/dev new file mode 100644 index 0000000000..71275a262f --- /dev/null +++ b/test/sys/devices/virtual/tty/tty1/dev @@ -0,0 +1 @@ +4:1 diff --git a/test/sys/devices/virtual/tty/tty1/power/wakeup b/test/sys/devices/virtual/tty/tty1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty1/subsystem b/test/sys/devices/virtual/tty/tty1/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty1/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty1/uevent b/test/sys/devices/virtual/tty/tty1/uevent new file mode 100644 index 0000000000..3a2de38445 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty1/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=1 diff --git a/test/sys/devices/virtual/tty/tty10/dev b/test/sys/devices/virtual/tty/tty10/dev new file mode 100644 index 0000000000..eb477d040f --- /dev/null +++ b/test/sys/devices/virtual/tty/tty10/dev @@ -0,0 +1 @@ +4:10 diff --git a/test/sys/devices/virtual/tty/tty10/power/wakeup b/test/sys/devices/virtual/tty/tty10/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty10/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty10/subsystem b/test/sys/devices/virtual/tty/tty10/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty10/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty10/uevent b/test/sys/devices/virtual/tty/tty10/uevent new file mode 100644 index 0000000000..0c29d5afd6 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty10/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=10 diff --git a/test/sys/devices/virtual/tty/tty11/dev b/test/sys/devices/virtual/tty/tty11/dev new file mode 100644 index 0000000000..685b194273 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty11/dev @@ -0,0 +1 @@ +4:11 diff --git a/test/sys/devices/virtual/tty/tty11/power/wakeup b/test/sys/devices/virtual/tty/tty11/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty11/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty11/subsystem b/test/sys/devices/virtual/tty/tty11/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty11/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty11/uevent b/test/sys/devices/virtual/tty/tty11/uevent new file mode 100644 index 0000000000..dbc9d32554 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty11/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=11 diff --git a/test/sys/devices/virtual/tty/tty12/dev b/test/sys/devices/virtual/tty/tty12/dev new file mode 100644 index 0000000000..47b68a96a5 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty12/dev @@ -0,0 +1 @@ +4:12 diff --git a/test/sys/devices/virtual/tty/tty12/power/wakeup b/test/sys/devices/virtual/tty/tty12/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty12/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty12/subsystem b/test/sys/devices/virtual/tty/tty12/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty12/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty12/uevent b/test/sys/devices/virtual/tty/tty12/uevent new file mode 100644 index 0000000000..6da3cd31cc --- /dev/null +++ b/test/sys/devices/virtual/tty/tty12/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=12 diff --git a/test/sys/devices/virtual/tty/tty13/dev b/test/sys/devices/virtual/tty/tty13/dev new file mode 100644 index 0000000000..86e31456d2 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty13/dev @@ -0,0 +1 @@ +4:13 diff --git a/test/sys/devices/virtual/tty/tty13/power/wakeup b/test/sys/devices/virtual/tty/tty13/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty13/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty13/subsystem b/test/sys/devices/virtual/tty/tty13/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty13/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty13/uevent b/test/sys/devices/virtual/tty/tty13/uevent new file mode 100644 index 0000000000..3a8adc0a90 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty13/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=13 diff --git a/test/sys/devices/virtual/tty/tty14/dev b/test/sys/devices/virtual/tty/tty14/dev new file mode 100644 index 0000000000..9fa8103ff8 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty14/dev @@ -0,0 +1 @@ +4:14 diff --git a/test/sys/devices/virtual/tty/tty14/power/wakeup b/test/sys/devices/virtual/tty/tty14/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty14/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty14/subsystem b/test/sys/devices/virtual/tty/tty14/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty14/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty14/uevent b/test/sys/devices/virtual/tty/tty14/uevent new file mode 100644 index 0000000000..722fa4af3d --- /dev/null +++ b/test/sys/devices/virtual/tty/tty14/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=14 diff --git a/test/sys/devices/virtual/tty/tty15/dev b/test/sys/devices/virtual/tty/tty15/dev new file mode 100644 index 0000000000..3f601b851f --- /dev/null +++ b/test/sys/devices/virtual/tty/tty15/dev @@ -0,0 +1 @@ +4:15 diff --git a/test/sys/devices/virtual/tty/tty15/power/wakeup b/test/sys/devices/virtual/tty/tty15/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty15/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty15/subsystem b/test/sys/devices/virtual/tty/tty15/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty15/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty15/uevent b/test/sys/devices/virtual/tty/tty15/uevent new file mode 100644 index 0000000000..f570be0c70 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty15/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=15 diff --git a/test/sys/devices/virtual/tty/tty16/dev b/test/sys/devices/virtual/tty/tty16/dev new file mode 100644 index 0000000000..0310e8064a --- /dev/null +++ b/test/sys/devices/virtual/tty/tty16/dev @@ -0,0 +1 @@ +4:16 diff --git a/test/sys/devices/virtual/tty/tty16/power/wakeup b/test/sys/devices/virtual/tty/tty16/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty16/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty16/subsystem b/test/sys/devices/virtual/tty/tty16/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty16/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty16/uevent b/test/sys/devices/virtual/tty/tty16/uevent new file mode 100644 index 0000000000..469ec57ad4 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty16/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=16 diff --git a/test/sys/devices/virtual/tty/tty17/dev b/test/sys/devices/virtual/tty/tty17/dev new file mode 100644 index 0000000000..19360464d0 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty17/dev @@ -0,0 +1 @@ +4:17 diff --git a/test/sys/devices/virtual/tty/tty17/power/wakeup b/test/sys/devices/virtual/tty/tty17/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty17/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty17/subsystem b/test/sys/devices/virtual/tty/tty17/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty17/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty17/uevent b/test/sys/devices/virtual/tty/tty17/uevent new file mode 100644 index 0000000000..7e3d979e13 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty17/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=17 diff --git a/test/sys/devices/virtual/tty/tty18/dev b/test/sys/devices/virtual/tty/tty18/dev new file mode 100644 index 0000000000..8710c48f12 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty18/dev @@ -0,0 +1 @@ +4:18 diff --git a/test/sys/devices/virtual/tty/tty18/power/wakeup b/test/sys/devices/virtual/tty/tty18/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty18/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty18/subsystem b/test/sys/devices/virtual/tty/tty18/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty18/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty18/uevent b/test/sys/devices/virtual/tty/tty18/uevent new file mode 100644 index 0000000000..9001e97ccf --- /dev/null +++ b/test/sys/devices/virtual/tty/tty18/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=18 diff --git a/test/sys/devices/virtual/tty/tty19/dev b/test/sys/devices/virtual/tty/tty19/dev new file mode 100644 index 0000000000..5fac93ed2f --- /dev/null +++ b/test/sys/devices/virtual/tty/tty19/dev @@ -0,0 +1 @@ +4:19 diff --git a/test/sys/devices/virtual/tty/tty19/power/wakeup b/test/sys/devices/virtual/tty/tty19/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty19/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty19/subsystem b/test/sys/devices/virtual/tty/tty19/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty19/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty19/uevent b/test/sys/devices/virtual/tty/tty19/uevent new file mode 100644 index 0000000000..7a7dd2dc75 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty19/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=19 diff --git a/test/sys/devices/virtual/tty/tty2/dev b/test/sys/devices/virtual/tty/tty2/dev new file mode 100644 index 0000000000..ac0836d7ca --- /dev/null +++ b/test/sys/devices/virtual/tty/tty2/dev @@ -0,0 +1 @@ +4:2 diff --git a/test/sys/devices/virtual/tty/tty2/power/wakeup b/test/sys/devices/virtual/tty/tty2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty2/subsystem b/test/sys/devices/virtual/tty/tty2/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty2/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty2/uevent b/test/sys/devices/virtual/tty/tty2/uevent new file mode 100644 index 0000000000..08d1b80de4 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty2/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=2 diff --git a/test/sys/devices/virtual/tty/tty20/dev b/test/sys/devices/virtual/tty/tty20/dev new file mode 100644 index 0000000000..3db4a84c87 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty20/dev @@ -0,0 +1 @@ +4:20 diff --git a/test/sys/devices/virtual/tty/tty20/power/wakeup b/test/sys/devices/virtual/tty/tty20/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty20/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty20/subsystem b/test/sys/devices/virtual/tty/tty20/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty20/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty20/uevent b/test/sys/devices/virtual/tty/tty20/uevent new file mode 100644 index 0000000000..e32651b73c --- /dev/null +++ b/test/sys/devices/virtual/tty/tty20/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=20 diff --git a/test/sys/devices/virtual/tty/tty21/dev b/test/sys/devices/virtual/tty/tty21/dev new file mode 100644 index 0000000000..f86a02508c --- /dev/null +++ b/test/sys/devices/virtual/tty/tty21/dev @@ -0,0 +1 @@ +4:21 diff --git a/test/sys/devices/virtual/tty/tty21/power/wakeup b/test/sys/devices/virtual/tty/tty21/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty21/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty21/subsystem b/test/sys/devices/virtual/tty/tty21/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty21/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty21/uevent b/test/sys/devices/virtual/tty/tty21/uevent new file mode 100644 index 0000000000..836852c354 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty21/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=21 diff --git a/test/sys/devices/virtual/tty/tty22/dev b/test/sys/devices/virtual/tty/tty22/dev new file mode 100644 index 0000000000..b27a240d1a --- /dev/null +++ b/test/sys/devices/virtual/tty/tty22/dev @@ -0,0 +1 @@ +4:22 diff --git a/test/sys/devices/virtual/tty/tty22/power/wakeup b/test/sys/devices/virtual/tty/tty22/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty22/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty22/subsystem b/test/sys/devices/virtual/tty/tty22/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty22/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty22/uevent b/test/sys/devices/virtual/tty/tty22/uevent new file mode 100644 index 0000000000..649c903592 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty22/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=22 diff --git a/test/sys/devices/virtual/tty/tty23/dev b/test/sys/devices/virtual/tty/tty23/dev new file mode 100644 index 0000000000..9359bfa71d --- /dev/null +++ b/test/sys/devices/virtual/tty/tty23/dev @@ -0,0 +1 @@ +4:23 diff --git a/test/sys/devices/virtual/tty/tty23/power/wakeup b/test/sys/devices/virtual/tty/tty23/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty23/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty23/subsystem b/test/sys/devices/virtual/tty/tty23/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty23/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty23/uevent b/test/sys/devices/virtual/tty/tty23/uevent new file mode 100644 index 0000000000..73d66798ab --- /dev/null +++ b/test/sys/devices/virtual/tty/tty23/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=23 diff --git a/test/sys/devices/virtual/tty/tty24/dev b/test/sys/devices/virtual/tty/tty24/dev new file mode 100644 index 0000000000..9cd85c8a81 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty24/dev @@ -0,0 +1 @@ +4:24 diff --git a/test/sys/devices/virtual/tty/tty24/power/wakeup b/test/sys/devices/virtual/tty/tty24/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty24/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty24/subsystem b/test/sys/devices/virtual/tty/tty24/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty24/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty24/uevent b/test/sys/devices/virtual/tty/tty24/uevent new file mode 100644 index 0000000000..31396c49b5 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty24/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=24 diff --git a/test/sys/devices/virtual/tty/tty25/dev b/test/sys/devices/virtual/tty/tty25/dev new file mode 100644 index 0000000000..f9d8c9c059 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty25/dev @@ -0,0 +1 @@ +4:25 diff --git a/test/sys/devices/virtual/tty/tty25/power/wakeup b/test/sys/devices/virtual/tty/tty25/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty25/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty25/subsystem b/test/sys/devices/virtual/tty/tty25/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty25/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty25/uevent b/test/sys/devices/virtual/tty/tty25/uevent new file mode 100644 index 0000000000..db34acbde3 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty25/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=25 diff --git a/test/sys/devices/virtual/tty/tty26/dev b/test/sys/devices/virtual/tty/tty26/dev new file mode 100644 index 0000000000..210b637b97 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty26/dev @@ -0,0 +1 @@ +4:26 diff --git a/test/sys/devices/virtual/tty/tty26/power/wakeup b/test/sys/devices/virtual/tty/tty26/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty26/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty26/subsystem b/test/sys/devices/virtual/tty/tty26/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty26/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty26/uevent b/test/sys/devices/virtual/tty/tty26/uevent new file mode 100644 index 0000000000..5f47d0ebf9 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty26/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=26 diff --git a/test/sys/devices/virtual/tty/tty27/dev b/test/sys/devices/virtual/tty/tty27/dev new file mode 100644 index 0000000000..de59b627a5 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty27/dev @@ -0,0 +1 @@ +4:27 diff --git a/test/sys/devices/virtual/tty/tty27/power/wakeup b/test/sys/devices/virtual/tty/tty27/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty27/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty27/subsystem b/test/sys/devices/virtual/tty/tty27/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty27/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty27/uevent b/test/sys/devices/virtual/tty/tty27/uevent new file mode 100644 index 0000000000..e0062ad951 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty27/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=27 diff --git a/test/sys/devices/virtual/tty/tty28/dev b/test/sys/devices/virtual/tty/tty28/dev new file mode 100644 index 0000000000..023871c676 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty28/dev @@ -0,0 +1 @@ +4:28 diff --git a/test/sys/devices/virtual/tty/tty28/power/wakeup b/test/sys/devices/virtual/tty/tty28/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty28/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty28/subsystem b/test/sys/devices/virtual/tty/tty28/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty28/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty28/uevent b/test/sys/devices/virtual/tty/tty28/uevent new file mode 100644 index 0000000000..6d8b15f412 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty28/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=28 diff --git a/test/sys/devices/virtual/tty/tty29/dev b/test/sys/devices/virtual/tty/tty29/dev new file mode 100644 index 0000000000..2edd7c58af --- /dev/null +++ b/test/sys/devices/virtual/tty/tty29/dev @@ -0,0 +1 @@ +4:29 diff --git a/test/sys/devices/virtual/tty/tty29/power/wakeup b/test/sys/devices/virtual/tty/tty29/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty29/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty29/subsystem b/test/sys/devices/virtual/tty/tty29/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty29/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty29/uevent b/test/sys/devices/virtual/tty/tty29/uevent new file mode 100644 index 0000000000..8da0dd3458 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty29/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=29 diff --git a/test/sys/devices/virtual/tty/tty3/dev b/test/sys/devices/virtual/tty/tty3/dev new file mode 100644 index 0000000000..c8142884a4 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty3/dev @@ -0,0 +1 @@ +4:3 diff --git a/test/sys/devices/virtual/tty/tty3/power/wakeup b/test/sys/devices/virtual/tty/tty3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty3/subsystem b/test/sys/devices/virtual/tty/tty3/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty3/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty3/uevent b/test/sys/devices/virtual/tty/tty3/uevent new file mode 100644 index 0000000000..e8bc1486d7 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty3/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=3 diff --git a/test/sys/devices/virtual/tty/tty30/dev b/test/sys/devices/virtual/tty/tty30/dev new file mode 100644 index 0000000000..63f0e669b8 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty30/dev @@ -0,0 +1 @@ +4:30 diff --git a/test/sys/devices/virtual/tty/tty30/power/wakeup b/test/sys/devices/virtual/tty/tty30/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty30/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty30/subsystem b/test/sys/devices/virtual/tty/tty30/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty30/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty30/uevent b/test/sys/devices/virtual/tty/tty30/uevent new file mode 100644 index 0000000000..8131cc03e0 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty30/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=30 diff --git a/test/sys/devices/virtual/tty/tty31/dev b/test/sys/devices/virtual/tty/tty31/dev new file mode 100644 index 0000000000..77a50eeff5 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty31/dev @@ -0,0 +1 @@ +4:31 diff --git a/test/sys/devices/virtual/tty/tty31/power/wakeup b/test/sys/devices/virtual/tty/tty31/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty31/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty31/subsystem b/test/sys/devices/virtual/tty/tty31/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty31/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty31/uevent b/test/sys/devices/virtual/tty/tty31/uevent new file mode 100644 index 0000000000..9f31a6cd0a --- /dev/null +++ b/test/sys/devices/virtual/tty/tty31/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=31 diff --git a/test/sys/devices/virtual/tty/tty32/dev b/test/sys/devices/virtual/tty/tty32/dev new file mode 100644 index 0000000000..ae38a8dcd7 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty32/dev @@ -0,0 +1 @@ +4:32 diff --git a/test/sys/devices/virtual/tty/tty32/power/wakeup b/test/sys/devices/virtual/tty/tty32/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty32/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty32/subsystem b/test/sys/devices/virtual/tty/tty32/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty32/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty32/uevent b/test/sys/devices/virtual/tty/tty32/uevent new file mode 100644 index 0000000000..954f7a034b --- /dev/null +++ b/test/sys/devices/virtual/tty/tty32/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=32 diff --git a/test/sys/devices/virtual/tty/tty33/dev b/test/sys/devices/virtual/tty/tty33/dev new file mode 100644 index 0000000000..9307b44cd0 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty33/dev @@ -0,0 +1 @@ +4:33 diff --git a/test/sys/devices/virtual/tty/tty33/power/wakeup b/test/sys/devices/virtual/tty/tty33/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty33/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty33/subsystem b/test/sys/devices/virtual/tty/tty33/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty33/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty33/uevent b/test/sys/devices/virtual/tty/tty33/uevent new file mode 100644 index 0000000000..70a8268494 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty33/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=33 diff --git a/test/sys/devices/virtual/tty/tty34/dev b/test/sys/devices/virtual/tty/tty34/dev new file mode 100644 index 0000000000..be00cbe67c --- /dev/null +++ b/test/sys/devices/virtual/tty/tty34/dev @@ -0,0 +1 @@ +4:34 diff --git a/test/sys/devices/virtual/tty/tty34/power/wakeup b/test/sys/devices/virtual/tty/tty34/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty34/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty34/subsystem b/test/sys/devices/virtual/tty/tty34/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty34/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty34/uevent b/test/sys/devices/virtual/tty/tty34/uevent new file mode 100644 index 0000000000..a15e8abd22 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty34/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=34 diff --git a/test/sys/devices/virtual/tty/tty35/dev b/test/sys/devices/virtual/tty/tty35/dev new file mode 100644 index 0000000000..4e5e85cb70 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty35/dev @@ -0,0 +1 @@ +4:35 diff --git a/test/sys/devices/virtual/tty/tty35/power/wakeup b/test/sys/devices/virtual/tty/tty35/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty35/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty35/subsystem b/test/sys/devices/virtual/tty/tty35/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty35/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty35/uevent b/test/sys/devices/virtual/tty/tty35/uevent new file mode 100644 index 0000000000..9d18da0a08 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty35/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=35 diff --git a/test/sys/devices/virtual/tty/tty36/dev b/test/sys/devices/virtual/tty/tty36/dev new file mode 100644 index 0000000000..4e5407ef59 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty36/dev @@ -0,0 +1 @@ +4:36 diff --git a/test/sys/devices/virtual/tty/tty36/power/wakeup b/test/sys/devices/virtual/tty/tty36/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty36/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty36/subsystem b/test/sys/devices/virtual/tty/tty36/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty36/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty36/uevent b/test/sys/devices/virtual/tty/tty36/uevent new file mode 100644 index 0000000000..12b0fdc0af --- /dev/null +++ b/test/sys/devices/virtual/tty/tty36/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=36 diff --git a/test/sys/devices/virtual/tty/tty37/dev b/test/sys/devices/virtual/tty/tty37/dev new file mode 100644 index 0000000000..765acf2d2c --- /dev/null +++ b/test/sys/devices/virtual/tty/tty37/dev @@ -0,0 +1 @@ +4:37 diff --git a/test/sys/devices/virtual/tty/tty37/power/wakeup b/test/sys/devices/virtual/tty/tty37/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty37/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty37/subsystem b/test/sys/devices/virtual/tty/tty37/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty37/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty37/uevent b/test/sys/devices/virtual/tty/tty37/uevent new file mode 100644 index 0000000000..46766f60f1 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty37/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=37 diff --git a/test/sys/devices/virtual/tty/tty38/dev b/test/sys/devices/virtual/tty/tty38/dev new file mode 100644 index 0000000000..1532b15793 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty38/dev @@ -0,0 +1 @@ +4:38 diff --git a/test/sys/devices/virtual/tty/tty38/power/wakeup b/test/sys/devices/virtual/tty/tty38/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty38/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty38/subsystem b/test/sys/devices/virtual/tty/tty38/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty38/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty38/uevent b/test/sys/devices/virtual/tty/tty38/uevent new file mode 100644 index 0000000000..385022c777 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty38/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=38 diff --git a/test/sys/devices/virtual/tty/tty39/dev b/test/sys/devices/virtual/tty/tty39/dev new file mode 100644 index 0000000000..fac383d3df --- /dev/null +++ b/test/sys/devices/virtual/tty/tty39/dev @@ -0,0 +1 @@ +4:39 diff --git a/test/sys/devices/virtual/tty/tty39/power/wakeup b/test/sys/devices/virtual/tty/tty39/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty39/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty39/subsystem b/test/sys/devices/virtual/tty/tty39/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty39/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty39/uevent b/test/sys/devices/virtual/tty/tty39/uevent new file mode 100644 index 0000000000..d96a89c4cd --- /dev/null +++ b/test/sys/devices/virtual/tty/tty39/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=39 diff --git a/test/sys/devices/virtual/tty/tty4/dev b/test/sys/devices/virtual/tty/tty4/dev new file mode 100644 index 0000000000..7f407b5d25 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty4/dev @@ -0,0 +1 @@ +4:4 diff --git a/test/sys/devices/virtual/tty/tty4/power/wakeup b/test/sys/devices/virtual/tty/tty4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty4/subsystem b/test/sys/devices/virtual/tty/tty4/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty4/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty4/uevent b/test/sys/devices/virtual/tty/tty4/uevent new file mode 100644 index 0000000000..150ecd0369 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty4/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=4 diff --git a/test/sys/devices/virtual/tty/tty40/dev b/test/sys/devices/virtual/tty/tty40/dev new file mode 100644 index 0000000000..d7246138ac --- /dev/null +++ b/test/sys/devices/virtual/tty/tty40/dev @@ -0,0 +1 @@ +4:40 diff --git a/test/sys/devices/virtual/tty/tty40/power/wakeup b/test/sys/devices/virtual/tty/tty40/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty40/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty40/subsystem b/test/sys/devices/virtual/tty/tty40/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty40/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty40/uevent b/test/sys/devices/virtual/tty/tty40/uevent new file mode 100644 index 0000000000..1527f923c4 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty40/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=40 diff --git a/test/sys/devices/virtual/tty/tty41/dev b/test/sys/devices/virtual/tty/tty41/dev new file mode 100644 index 0000000000..0d974303d5 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty41/dev @@ -0,0 +1 @@ +4:41 diff --git a/test/sys/devices/virtual/tty/tty41/power/wakeup b/test/sys/devices/virtual/tty/tty41/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty41/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty41/subsystem b/test/sys/devices/virtual/tty/tty41/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty41/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty41/uevent b/test/sys/devices/virtual/tty/tty41/uevent new file mode 100644 index 0000000000..8e3df11fed --- /dev/null +++ b/test/sys/devices/virtual/tty/tty41/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=41 diff --git a/test/sys/devices/virtual/tty/tty42/dev b/test/sys/devices/virtual/tty/tty42/dev new file mode 100644 index 0000000000..4019d23bfa --- /dev/null +++ b/test/sys/devices/virtual/tty/tty42/dev @@ -0,0 +1 @@ +4:42 diff --git a/test/sys/devices/virtual/tty/tty42/power/wakeup b/test/sys/devices/virtual/tty/tty42/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty42/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty42/subsystem b/test/sys/devices/virtual/tty/tty42/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty42/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty42/uevent b/test/sys/devices/virtual/tty/tty42/uevent new file mode 100644 index 0000000000..c4ad0ae5ec --- /dev/null +++ b/test/sys/devices/virtual/tty/tty42/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=42 diff --git a/test/sys/devices/virtual/tty/tty43/dev b/test/sys/devices/virtual/tty/tty43/dev new file mode 100644 index 0000000000..4b6c086540 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty43/dev @@ -0,0 +1 @@ +4:43 diff --git a/test/sys/devices/virtual/tty/tty43/power/wakeup b/test/sys/devices/virtual/tty/tty43/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty43/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty43/subsystem b/test/sys/devices/virtual/tty/tty43/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty43/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty43/uevent b/test/sys/devices/virtual/tty/tty43/uevent new file mode 100644 index 0000000000..d64b5a090b --- /dev/null +++ b/test/sys/devices/virtual/tty/tty43/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=43 diff --git a/test/sys/devices/virtual/tty/tty44/dev b/test/sys/devices/virtual/tty/tty44/dev new file mode 100644 index 0000000000..9c2357463f --- /dev/null +++ b/test/sys/devices/virtual/tty/tty44/dev @@ -0,0 +1 @@ +4:44 diff --git a/test/sys/devices/virtual/tty/tty44/power/wakeup b/test/sys/devices/virtual/tty/tty44/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty44/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty44/subsystem b/test/sys/devices/virtual/tty/tty44/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty44/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty44/uevent b/test/sys/devices/virtual/tty/tty44/uevent new file mode 100644 index 0000000000..3c9416a93d --- /dev/null +++ b/test/sys/devices/virtual/tty/tty44/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=44 diff --git a/test/sys/devices/virtual/tty/tty45/dev b/test/sys/devices/virtual/tty/tty45/dev new file mode 100644 index 0000000000..23437be177 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty45/dev @@ -0,0 +1 @@ +4:45 diff --git a/test/sys/devices/virtual/tty/tty45/power/wakeup b/test/sys/devices/virtual/tty/tty45/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty45/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty45/subsystem b/test/sys/devices/virtual/tty/tty45/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty45/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty45/uevent b/test/sys/devices/virtual/tty/tty45/uevent new file mode 100644 index 0000000000..39c83be491 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty45/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=45 diff --git a/test/sys/devices/virtual/tty/tty46/dev b/test/sys/devices/virtual/tty/tty46/dev new file mode 100644 index 0000000000..816feaf47d --- /dev/null +++ b/test/sys/devices/virtual/tty/tty46/dev @@ -0,0 +1 @@ +4:46 diff --git a/test/sys/devices/virtual/tty/tty46/power/wakeup b/test/sys/devices/virtual/tty/tty46/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty46/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty46/subsystem b/test/sys/devices/virtual/tty/tty46/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty46/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty46/uevent b/test/sys/devices/virtual/tty/tty46/uevent new file mode 100644 index 0000000000..9b9b311c3c --- /dev/null +++ b/test/sys/devices/virtual/tty/tty46/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=46 diff --git a/test/sys/devices/virtual/tty/tty47/dev b/test/sys/devices/virtual/tty/tty47/dev new file mode 100644 index 0000000000..d2534e707d --- /dev/null +++ b/test/sys/devices/virtual/tty/tty47/dev @@ -0,0 +1 @@ +4:47 diff --git a/test/sys/devices/virtual/tty/tty47/power/wakeup b/test/sys/devices/virtual/tty/tty47/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty47/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty47/subsystem b/test/sys/devices/virtual/tty/tty47/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty47/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty47/uevent b/test/sys/devices/virtual/tty/tty47/uevent new file mode 100644 index 0000000000..ad6f1bb57d --- /dev/null +++ b/test/sys/devices/virtual/tty/tty47/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=47 diff --git a/test/sys/devices/virtual/tty/tty48/dev b/test/sys/devices/virtual/tty/tty48/dev new file mode 100644 index 0000000000..4003c709df --- /dev/null +++ b/test/sys/devices/virtual/tty/tty48/dev @@ -0,0 +1 @@ +4:48 diff --git a/test/sys/devices/virtual/tty/tty48/power/wakeup b/test/sys/devices/virtual/tty/tty48/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty48/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty48/subsystem b/test/sys/devices/virtual/tty/tty48/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty48/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty48/uevent b/test/sys/devices/virtual/tty/tty48/uevent new file mode 100644 index 0000000000..5a0ca32bed --- /dev/null +++ b/test/sys/devices/virtual/tty/tty48/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=48 diff --git a/test/sys/devices/virtual/tty/tty49/dev b/test/sys/devices/virtual/tty/tty49/dev new file mode 100644 index 0000000000..64dc806057 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty49/dev @@ -0,0 +1 @@ +4:49 diff --git a/test/sys/devices/virtual/tty/tty49/power/wakeup b/test/sys/devices/virtual/tty/tty49/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty49/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty49/subsystem b/test/sys/devices/virtual/tty/tty49/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty49/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty49/uevent b/test/sys/devices/virtual/tty/tty49/uevent new file mode 100644 index 0000000000..fd4db4cc3b --- /dev/null +++ b/test/sys/devices/virtual/tty/tty49/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=49 diff --git a/test/sys/devices/virtual/tty/tty5/dev b/test/sys/devices/virtual/tty/tty5/dev new file mode 100644 index 0000000000..1553222302 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty5/dev @@ -0,0 +1 @@ +4:5 diff --git a/test/sys/devices/virtual/tty/tty5/power/wakeup b/test/sys/devices/virtual/tty/tty5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty5/subsystem b/test/sys/devices/virtual/tty/tty5/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty5/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty5/uevent b/test/sys/devices/virtual/tty/tty5/uevent new file mode 100644 index 0000000000..0bed287e73 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty5/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=5 diff --git a/test/sys/devices/virtual/tty/tty50/dev b/test/sys/devices/virtual/tty/tty50/dev new file mode 100644 index 0000000000..71e681bc39 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty50/dev @@ -0,0 +1 @@ +4:50 diff --git a/test/sys/devices/virtual/tty/tty50/power/wakeup b/test/sys/devices/virtual/tty/tty50/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty50/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty50/subsystem b/test/sys/devices/virtual/tty/tty50/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty50/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty50/uevent b/test/sys/devices/virtual/tty/tty50/uevent new file mode 100644 index 0000000000..1d8161d40f --- /dev/null +++ b/test/sys/devices/virtual/tty/tty50/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=50 diff --git a/test/sys/devices/virtual/tty/tty51/dev b/test/sys/devices/virtual/tty/tty51/dev new file mode 100644 index 0000000000..1f8c4b6976 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty51/dev @@ -0,0 +1 @@ +4:51 diff --git a/test/sys/devices/virtual/tty/tty51/power/wakeup b/test/sys/devices/virtual/tty/tty51/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty51/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty51/subsystem b/test/sys/devices/virtual/tty/tty51/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty51/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty51/uevent b/test/sys/devices/virtual/tty/tty51/uevent new file mode 100644 index 0000000000..ca119adabb --- /dev/null +++ b/test/sys/devices/virtual/tty/tty51/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=51 diff --git a/test/sys/devices/virtual/tty/tty52/dev b/test/sys/devices/virtual/tty/tty52/dev new file mode 100644 index 0000000000..344e8c93f9 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty52/dev @@ -0,0 +1 @@ +4:52 diff --git a/test/sys/devices/virtual/tty/tty52/power/wakeup b/test/sys/devices/virtual/tty/tty52/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty52/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty52/subsystem b/test/sys/devices/virtual/tty/tty52/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty52/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty52/uevent b/test/sys/devices/virtual/tty/tty52/uevent new file mode 100644 index 0000000000..193dad2077 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty52/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=52 diff --git a/test/sys/devices/virtual/tty/tty53/dev b/test/sys/devices/virtual/tty/tty53/dev new file mode 100644 index 0000000000..c4b80fb134 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty53/dev @@ -0,0 +1 @@ +4:53 diff --git a/test/sys/devices/virtual/tty/tty53/power/wakeup b/test/sys/devices/virtual/tty/tty53/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty53/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty53/subsystem b/test/sys/devices/virtual/tty/tty53/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty53/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty53/uevent b/test/sys/devices/virtual/tty/tty53/uevent new file mode 100644 index 0000000000..4501e57d32 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty53/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=53 diff --git a/test/sys/devices/virtual/tty/tty54/dev b/test/sys/devices/virtual/tty/tty54/dev new file mode 100644 index 0000000000..ba56c5e44c --- /dev/null +++ b/test/sys/devices/virtual/tty/tty54/dev @@ -0,0 +1 @@ +4:54 diff --git a/test/sys/devices/virtual/tty/tty54/power/wakeup b/test/sys/devices/virtual/tty/tty54/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty54/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty54/subsystem b/test/sys/devices/virtual/tty/tty54/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty54/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty54/uevent b/test/sys/devices/virtual/tty/tty54/uevent new file mode 100644 index 0000000000..d6db7eb38a --- /dev/null +++ b/test/sys/devices/virtual/tty/tty54/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=54 diff --git a/test/sys/devices/virtual/tty/tty55/dev b/test/sys/devices/virtual/tty/tty55/dev new file mode 100644 index 0000000000..540bf11253 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty55/dev @@ -0,0 +1 @@ +4:55 diff --git a/test/sys/devices/virtual/tty/tty55/power/wakeup b/test/sys/devices/virtual/tty/tty55/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty55/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty55/subsystem b/test/sys/devices/virtual/tty/tty55/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty55/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty55/uevent b/test/sys/devices/virtual/tty/tty55/uevent new file mode 100644 index 0000000000..f718194915 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty55/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=55 diff --git a/test/sys/devices/virtual/tty/tty56/dev b/test/sys/devices/virtual/tty/tty56/dev new file mode 100644 index 0000000000..ee03fba97d --- /dev/null +++ b/test/sys/devices/virtual/tty/tty56/dev @@ -0,0 +1 @@ +4:56 diff --git a/test/sys/devices/virtual/tty/tty56/power/wakeup b/test/sys/devices/virtual/tty/tty56/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty56/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty56/subsystem b/test/sys/devices/virtual/tty/tty56/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty56/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty56/uevent b/test/sys/devices/virtual/tty/tty56/uevent new file mode 100644 index 0000000000..d083a45055 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty56/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=56 diff --git a/test/sys/devices/virtual/tty/tty57/dev b/test/sys/devices/virtual/tty/tty57/dev new file mode 100644 index 0000000000..664d8ec646 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty57/dev @@ -0,0 +1 @@ +4:57 diff --git a/test/sys/devices/virtual/tty/tty57/power/wakeup b/test/sys/devices/virtual/tty/tty57/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty57/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty57/subsystem b/test/sys/devices/virtual/tty/tty57/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty57/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty57/uevent b/test/sys/devices/virtual/tty/tty57/uevent new file mode 100644 index 0000000000..044ab1fa24 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty57/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=57 diff --git a/test/sys/devices/virtual/tty/tty58/dev b/test/sys/devices/virtual/tty/tty58/dev new file mode 100644 index 0000000000..ffc6c0b62c --- /dev/null +++ b/test/sys/devices/virtual/tty/tty58/dev @@ -0,0 +1 @@ +4:58 diff --git a/test/sys/devices/virtual/tty/tty58/power/wakeup b/test/sys/devices/virtual/tty/tty58/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty58/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty58/subsystem b/test/sys/devices/virtual/tty/tty58/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty58/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty58/uevent b/test/sys/devices/virtual/tty/tty58/uevent new file mode 100644 index 0000000000..56b9272548 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty58/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=58 diff --git a/test/sys/devices/virtual/tty/tty59/dev b/test/sys/devices/virtual/tty/tty59/dev new file mode 100644 index 0000000000..c48309e7f0 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty59/dev @@ -0,0 +1 @@ +4:59 diff --git a/test/sys/devices/virtual/tty/tty59/power/wakeup b/test/sys/devices/virtual/tty/tty59/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty59/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty59/subsystem b/test/sys/devices/virtual/tty/tty59/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty59/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty59/uevent b/test/sys/devices/virtual/tty/tty59/uevent new file mode 100644 index 0000000000..19542335c9 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty59/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=59 diff --git a/test/sys/devices/virtual/tty/tty6/dev b/test/sys/devices/virtual/tty/tty6/dev new file mode 100644 index 0000000000..cd94e0d09d --- /dev/null +++ b/test/sys/devices/virtual/tty/tty6/dev @@ -0,0 +1 @@ +4:6 diff --git a/test/sys/devices/virtual/tty/tty6/power/wakeup b/test/sys/devices/virtual/tty/tty6/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty6/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty6/subsystem b/test/sys/devices/virtual/tty/tty6/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty6/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty6/uevent b/test/sys/devices/virtual/tty/tty6/uevent new file mode 100644 index 0000000000..59dd7fb038 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty6/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=6 diff --git a/test/sys/devices/virtual/tty/tty60/dev b/test/sys/devices/virtual/tty/tty60/dev new file mode 100644 index 0000000000..37d25eab02 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty60/dev @@ -0,0 +1 @@ +4:60 diff --git a/test/sys/devices/virtual/tty/tty60/power/wakeup b/test/sys/devices/virtual/tty/tty60/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty60/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty60/subsystem b/test/sys/devices/virtual/tty/tty60/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty60/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty60/uevent b/test/sys/devices/virtual/tty/tty60/uevent new file mode 100644 index 0000000000..b2e6f63034 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty60/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=60 diff --git a/test/sys/devices/virtual/tty/tty61/dev b/test/sys/devices/virtual/tty/tty61/dev new file mode 100644 index 0000000000..599df60bfd --- /dev/null +++ b/test/sys/devices/virtual/tty/tty61/dev @@ -0,0 +1 @@ +4:61 diff --git a/test/sys/devices/virtual/tty/tty61/power/wakeup b/test/sys/devices/virtual/tty/tty61/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty61/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty61/subsystem b/test/sys/devices/virtual/tty/tty61/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty61/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty61/uevent b/test/sys/devices/virtual/tty/tty61/uevent new file mode 100644 index 0000000000..a589537746 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty61/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=61 diff --git a/test/sys/devices/virtual/tty/tty62/dev b/test/sys/devices/virtual/tty/tty62/dev new file mode 100644 index 0000000000..49fc9a0af5 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty62/dev @@ -0,0 +1 @@ +4:62 diff --git a/test/sys/devices/virtual/tty/tty62/power/wakeup b/test/sys/devices/virtual/tty/tty62/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty62/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty62/subsystem b/test/sys/devices/virtual/tty/tty62/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty62/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty62/uevent b/test/sys/devices/virtual/tty/tty62/uevent new file mode 100644 index 0000000000..b80482faed --- /dev/null +++ b/test/sys/devices/virtual/tty/tty62/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=62 diff --git a/test/sys/devices/virtual/tty/tty63/dev b/test/sys/devices/virtual/tty/tty63/dev new file mode 100644 index 0000000000..d11e9d2a82 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty63/dev @@ -0,0 +1 @@ +4:63 diff --git a/test/sys/devices/virtual/tty/tty63/power/wakeup b/test/sys/devices/virtual/tty/tty63/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty63/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty63/subsystem b/test/sys/devices/virtual/tty/tty63/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty63/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty63/uevent b/test/sys/devices/virtual/tty/tty63/uevent new file mode 100644 index 0000000000..870a3031fa --- /dev/null +++ b/test/sys/devices/virtual/tty/tty63/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=63 diff --git a/test/sys/devices/virtual/tty/tty7/dev b/test/sys/devices/virtual/tty/tty7/dev new file mode 100644 index 0000000000..9410476660 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty7/dev @@ -0,0 +1 @@ +4:7 diff --git a/test/sys/devices/virtual/tty/tty7/power/wakeup b/test/sys/devices/virtual/tty/tty7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty7/subsystem b/test/sys/devices/virtual/tty/tty7/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty7/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty7/uevent b/test/sys/devices/virtual/tty/tty7/uevent new file mode 100644 index 0000000000..7354738777 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty7/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=7 diff --git a/test/sys/devices/virtual/tty/tty8/dev b/test/sys/devices/virtual/tty/tty8/dev new file mode 100644 index 0000000000..a79f74ba39 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty8/dev @@ -0,0 +1 @@ +4:8 diff --git a/test/sys/devices/virtual/tty/tty8/power/wakeup b/test/sys/devices/virtual/tty/tty8/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty8/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty8/subsystem b/test/sys/devices/virtual/tty/tty8/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty8/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty8/uevent b/test/sys/devices/virtual/tty/tty8/uevent new file mode 100644 index 0000000000..62911804c1 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty8/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=8 diff --git a/test/sys/devices/virtual/tty/tty9/dev b/test/sys/devices/virtual/tty/tty9/dev new file mode 100644 index 0000000000..62ada4bbe9 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty9/dev @@ -0,0 +1 @@ +4:9 diff --git a/test/sys/devices/virtual/tty/tty9/power/wakeup b/test/sys/devices/virtual/tty/tty9/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty9/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/tty/tty9/subsystem b/test/sys/devices/virtual/tty/tty9/subsystem new file mode 120000 index 0000000000..870c6a7986 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty9/subsystem @@ -0,0 +1 @@ +../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty9/uevent b/test/sys/devices/virtual/tty/tty9/uevent new file mode 100644 index 0000000000..5e959d0629 --- /dev/null +++ b/test/sys/devices/virtual/tty/tty9/uevent @@ -0,0 +1,2 @@ +MAJOR=4 +MINOR=9 diff --git a/test/sys/devices/virtual/vc/vcs/dev b/test/sys/devices/virtual/vc/vcs/dev new file mode 100644 index 0000000000..63cbc465cd --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs/dev @@ -0,0 +1 @@ +7:0 diff --git a/test/sys/devices/virtual/vc/vcs/power/wakeup b/test/sys/devices/virtual/vc/vcs/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcs/subsystem b/test/sys/devices/virtual/vc/vcs/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs/uevent b/test/sys/devices/virtual/vc/vcs/uevent new file mode 100644 index 0000000000..34a8790bf8 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=0 diff --git a/test/sys/devices/virtual/vc/vcs1/dev b/test/sys/devices/virtual/vc/vcs1/dev new file mode 100644 index 0000000000..084aafd011 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs1/dev @@ -0,0 +1 @@ +7:1 diff --git a/test/sys/devices/virtual/vc/vcs1/power/wakeup b/test/sys/devices/virtual/vc/vcs1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcs1/subsystem b/test/sys/devices/virtual/vc/vcs1/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs1/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs1/uevent b/test/sys/devices/virtual/vc/vcs1/uevent new file mode 100644 index 0000000000..9dd9e85495 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs1/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=1 diff --git a/test/sys/devices/virtual/vc/vcs10/dev b/test/sys/devices/virtual/vc/vcs10/dev new file mode 100644 index 0000000000..b6bd8172d1 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs10/dev @@ -0,0 +1 @@ +7:10 diff --git a/test/sys/devices/virtual/vc/vcs10/power/wakeup b/test/sys/devices/virtual/vc/vcs10/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs10/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcs10/subsystem b/test/sys/devices/virtual/vc/vcs10/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs10/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs10/uevent b/test/sys/devices/virtual/vc/vcs10/uevent new file mode 100644 index 0000000000..1a76c71d05 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs10/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=10 diff --git a/test/sys/devices/virtual/vc/vcs2/dev b/test/sys/devices/virtual/vc/vcs2/dev new file mode 100644 index 0000000000..665a343e7d --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs2/dev @@ -0,0 +1 @@ +7:2 diff --git a/test/sys/devices/virtual/vc/vcs2/power/wakeup b/test/sys/devices/virtual/vc/vcs2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcs2/subsystem b/test/sys/devices/virtual/vc/vcs2/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs2/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs2/uevent b/test/sys/devices/virtual/vc/vcs2/uevent new file mode 100644 index 0000000000..d7089e1974 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs2/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=2 diff --git a/test/sys/devices/virtual/vc/vcs3/dev b/test/sys/devices/virtual/vc/vcs3/dev new file mode 100644 index 0000000000..62f686140a --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs3/dev @@ -0,0 +1 @@ +7:3 diff --git a/test/sys/devices/virtual/vc/vcs3/power/wakeup b/test/sys/devices/virtual/vc/vcs3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcs3/subsystem b/test/sys/devices/virtual/vc/vcs3/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs3/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs3/uevent b/test/sys/devices/virtual/vc/vcs3/uevent new file mode 100644 index 0000000000..3d0dcff819 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs3/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=3 diff --git a/test/sys/devices/virtual/vc/vcs4/dev b/test/sys/devices/virtual/vc/vcs4/dev new file mode 100644 index 0000000000..684e7ade03 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs4/dev @@ -0,0 +1 @@ +7:4 diff --git a/test/sys/devices/virtual/vc/vcs4/power/wakeup b/test/sys/devices/virtual/vc/vcs4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcs4/subsystem b/test/sys/devices/virtual/vc/vcs4/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs4/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs4/uevent b/test/sys/devices/virtual/vc/vcs4/uevent new file mode 100644 index 0000000000..51fca4943f --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs4/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=4 diff --git a/test/sys/devices/virtual/vc/vcs5/dev b/test/sys/devices/virtual/vc/vcs5/dev new file mode 100644 index 0000000000..9028bbffdb --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs5/dev @@ -0,0 +1 @@ +7:5 diff --git a/test/sys/devices/virtual/vc/vcs5/power/wakeup b/test/sys/devices/virtual/vc/vcs5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcs5/subsystem b/test/sys/devices/virtual/vc/vcs5/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs5/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs5/uevent b/test/sys/devices/virtual/vc/vcs5/uevent new file mode 100644 index 0000000000..16f8908955 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs5/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=5 diff --git a/test/sys/devices/virtual/vc/vcs6/dev b/test/sys/devices/virtual/vc/vcs6/dev new file mode 100644 index 0000000000..fc5d660a44 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs6/dev @@ -0,0 +1 @@ +7:6 diff --git a/test/sys/devices/virtual/vc/vcs6/power/wakeup b/test/sys/devices/virtual/vc/vcs6/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs6/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcs6/subsystem b/test/sys/devices/virtual/vc/vcs6/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs6/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs6/uevent b/test/sys/devices/virtual/vc/vcs6/uevent new file mode 100644 index 0000000000..d5b6875958 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs6/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=6 diff --git a/test/sys/devices/virtual/vc/vcs7/dev b/test/sys/devices/virtual/vc/vcs7/dev new file mode 100644 index 0000000000..5d4edd3ce1 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs7/dev @@ -0,0 +1 @@ +7:7 diff --git a/test/sys/devices/virtual/vc/vcs7/power/wakeup b/test/sys/devices/virtual/vc/vcs7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcs7/subsystem b/test/sys/devices/virtual/vc/vcs7/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs7/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs7/uevent b/test/sys/devices/virtual/vc/vcs7/uevent new file mode 100644 index 0000000000..f150fec021 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcs7/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=7 diff --git a/test/sys/devices/virtual/vc/vcsa/dev b/test/sys/devices/virtual/vc/vcsa/dev new file mode 100644 index 0000000000..780668ac31 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa/dev @@ -0,0 +1 @@ +7:128 diff --git a/test/sys/devices/virtual/vc/vcsa/power/wakeup b/test/sys/devices/virtual/vc/vcsa/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcsa/subsystem b/test/sys/devices/virtual/vc/vcsa/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa/uevent b/test/sys/devices/virtual/vc/vcsa/uevent new file mode 100644 index 0000000000..b98170132e --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=128 diff --git a/test/sys/devices/virtual/vc/vcsa1/dev b/test/sys/devices/virtual/vc/vcsa1/dev new file mode 100644 index 0000000000..d52dc18c71 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa1/dev @@ -0,0 +1 @@ +7:129 diff --git a/test/sys/devices/virtual/vc/vcsa1/power/wakeup b/test/sys/devices/virtual/vc/vcsa1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcsa1/subsystem b/test/sys/devices/virtual/vc/vcsa1/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa1/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa1/uevent b/test/sys/devices/virtual/vc/vcsa1/uevent new file mode 100644 index 0000000000..2a1995b5f6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa1/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=129 diff --git a/test/sys/devices/virtual/vc/vcsa10/dev b/test/sys/devices/virtual/vc/vcsa10/dev new file mode 100644 index 0000000000..9a6941953e --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa10/dev @@ -0,0 +1 @@ +7:138 diff --git a/test/sys/devices/virtual/vc/vcsa10/power/wakeup b/test/sys/devices/virtual/vc/vcsa10/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa10/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcsa10/subsystem b/test/sys/devices/virtual/vc/vcsa10/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa10/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa10/uevent b/test/sys/devices/virtual/vc/vcsa10/uevent new file mode 100644 index 0000000000..5cd65a25d8 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa10/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=138 diff --git a/test/sys/devices/virtual/vc/vcsa2/dev b/test/sys/devices/virtual/vc/vcsa2/dev new file mode 100644 index 0000000000..77035b45c7 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa2/dev @@ -0,0 +1 @@ +7:130 diff --git a/test/sys/devices/virtual/vc/vcsa2/power/wakeup b/test/sys/devices/virtual/vc/vcsa2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcsa2/subsystem b/test/sys/devices/virtual/vc/vcsa2/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa2/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa2/uevent b/test/sys/devices/virtual/vc/vcsa2/uevent new file mode 100644 index 0000000000..38a6f878db --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa2/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=130 diff --git a/test/sys/devices/virtual/vc/vcsa3/dev b/test/sys/devices/virtual/vc/vcsa3/dev new file mode 100644 index 0000000000..ed36a09609 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa3/dev @@ -0,0 +1 @@ +7:131 diff --git a/test/sys/devices/virtual/vc/vcsa3/power/wakeup b/test/sys/devices/virtual/vc/vcsa3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcsa3/subsystem b/test/sys/devices/virtual/vc/vcsa3/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa3/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa3/uevent b/test/sys/devices/virtual/vc/vcsa3/uevent new file mode 100644 index 0000000000..9664556a81 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa3/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=131 diff --git a/test/sys/devices/virtual/vc/vcsa4/dev b/test/sys/devices/virtual/vc/vcsa4/dev new file mode 100644 index 0000000000..d522190032 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa4/dev @@ -0,0 +1 @@ +7:132 diff --git a/test/sys/devices/virtual/vc/vcsa4/power/wakeup b/test/sys/devices/virtual/vc/vcsa4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcsa4/subsystem b/test/sys/devices/virtual/vc/vcsa4/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa4/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa4/uevent b/test/sys/devices/virtual/vc/vcsa4/uevent new file mode 100644 index 0000000000..7f11f5dded --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa4/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=132 diff --git a/test/sys/devices/virtual/vc/vcsa5/dev b/test/sys/devices/virtual/vc/vcsa5/dev new file mode 100644 index 0000000000..6e362b4ce2 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa5/dev @@ -0,0 +1 @@ +7:133 diff --git a/test/sys/devices/virtual/vc/vcsa5/power/wakeup b/test/sys/devices/virtual/vc/vcsa5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcsa5/subsystem b/test/sys/devices/virtual/vc/vcsa5/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa5/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa5/uevent b/test/sys/devices/virtual/vc/vcsa5/uevent new file mode 100644 index 0000000000..aabd0163a8 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa5/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=133 diff --git a/test/sys/devices/virtual/vc/vcsa6/dev b/test/sys/devices/virtual/vc/vcsa6/dev new file mode 100644 index 0000000000..fd31ac3ce4 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa6/dev @@ -0,0 +1 @@ +7:134 diff --git a/test/sys/devices/virtual/vc/vcsa6/power/wakeup b/test/sys/devices/virtual/vc/vcsa6/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa6/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcsa6/subsystem b/test/sys/devices/virtual/vc/vcsa6/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa6/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa6/uevent b/test/sys/devices/virtual/vc/vcsa6/uevent new file mode 100644 index 0000000000..fb62516d67 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa6/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=134 diff --git a/test/sys/devices/virtual/vc/vcsa7/dev b/test/sys/devices/virtual/vc/vcsa7/dev new file mode 100644 index 0000000000..1ba6ffbb24 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa7/dev @@ -0,0 +1 @@ +7:135 diff --git a/test/sys/devices/virtual/vc/vcsa7/power/wakeup b/test/sys/devices/virtual/vc/vcsa7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vc/vcsa7/subsystem b/test/sys/devices/virtual/vc/vcsa7/subsystem new file mode 120000 index 0000000000..6a4bc6b0b6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa7/subsystem @@ -0,0 +1 @@ +../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa7/uevent b/test/sys/devices/virtual/vc/vcsa7/uevent new file mode 100644 index 0000000000..34d1003db6 --- /dev/null +++ b/test/sys/devices/virtual/vc/vcsa7/uevent @@ -0,0 +1,2 @@ +MAJOR=7 +MINOR=135 diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/bind b/test/sys/devices/virtual/vtconsole/vtcon0/bind new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/virtual/vtconsole/vtcon0/bind @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/name b/test/sys/devices/virtual/vtconsole/vtcon0/name new file mode 100644 index 0000000000..ff01778438 --- /dev/null +++ b/test/sys/devices/virtual/vtconsole/vtcon0/name @@ -0,0 +1 @@ +(S) dummy device diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/power/wakeup b/test/sys/devices/virtual/vtconsole/vtcon0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vtconsole/vtcon0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/subsystem b/test/sys/devices/virtual/vtconsole/vtcon0/subsystem new file mode 120000 index 0000000000..c43603a273 --- /dev/null +++ b/test/sys/devices/virtual/vtconsole/vtcon0/subsystem @@ -0,0 +1 @@ +../../../../class/vtconsole \ No newline at end of file diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/uevent b/test/sys/devices/virtual/vtconsole/vtcon0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/bind b/test/sys/devices/virtual/vtconsole/vtcon1/bind new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/virtual/vtconsole/vtcon1/bind @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/name b/test/sys/devices/virtual/vtconsole/vtcon1/name new file mode 100644 index 0000000000..a93a47836e --- /dev/null +++ b/test/sys/devices/virtual/vtconsole/vtcon1/name @@ -0,0 +1 @@ +(M) frame buffer device diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/power/wakeup b/test/sys/devices/virtual/vtconsole/vtcon1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/virtual/vtconsole/vtcon1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/subsystem b/test/sys/devices/virtual/vtconsole/vtcon1/subsystem new file mode 120000 index 0000000000..c43603a273 --- /dev/null +++ b/test/sys/devices/virtual/vtconsole/vtcon1/subsystem @@ -0,0 +1 @@ +../../../../class/vtconsole \ No newline at end of file diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/uevent b/test/sys/devices/virtual/vtconsole/vtcon1/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/firmware/acpi/interrupts/error b/test/sys/firmware/acpi/interrupts/error new file mode 100644 index 0000000000..1acf61e2c3 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/error @@ -0,0 +1 @@ + 0 diff --git a/test/sys/firmware/acpi/interrupts/ff_gbl_lock b/test/sys/firmware/acpi/interrupts/ff_gbl_lock new file mode 100644 index 0000000000..c352d5552e --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/ff_gbl_lock @@ -0,0 +1 @@ + 0 enable diff --git a/test/sys/firmware/acpi/interrupts/ff_pmtimer b/test/sys/firmware/acpi/interrupts/ff_pmtimer new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/ff_pmtimer @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/ff_pwr_btn b/test/sys/firmware/acpi/interrupts/ff_pwr_btn new file mode 100644 index 0000000000..c352d5552e --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/ff_pwr_btn @@ -0,0 +1 @@ + 0 enable diff --git a/test/sys/firmware/acpi/interrupts/ff_rt_clk b/test/sys/firmware/acpi/interrupts/ff_rt_clk new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/ff_rt_clk @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/ff_slp_btn b/test/sys/firmware/acpi/interrupts/ff_slp_btn new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/ff_slp_btn @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe00 b/test/sys/firmware/acpi/interrupts/gpe00 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe00 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe01 b/test/sys/firmware/acpi/interrupts/gpe01 new file mode 100644 index 0000000000..a335a10c19 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe01 @@ -0,0 +1 @@ + 1 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe02 b/test/sys/firmware/acpi/interrupts/gpe02 new file mode 100644 index 0000000000..c352d5552e --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe02 @@ -0,0 +1 @@ + 0 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe03 b/test/sys/firmware/acpi/interrupts/gpe03 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe03 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe04 b/test/sys/firmware/acpi/interrupts/gpe04 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe04 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe05 b/test/sys/firmware/acpi/interrupts/gpe05 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe05 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe06 b/test/sys/firmware/acpi/interrupts/gpe06 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe06 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe07 b/test/sys/firmware/acpi/interrupts/gpe07 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe07 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe08 b/test/sys/firmware/acpi/interrupts/gpe08 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe08 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe09 b/test/sys/firmware/acpi/interrupts/gpe09 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe09 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0A b/test/sys/firmware/acpi/interrupts/gpe0A new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe0A @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0B b/test/sys/firmware/acpi/interrupts/gpe0B new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe0B @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0C b/test/sys/firmware/acpi/interrupts/gpe0C new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe0C @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0D b/test/sys/firmware/acpi/interrupts/gpe0D new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe0D @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0E b/test/sys/firmware/acpi/interrupts/gpe0E new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe0E @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0F b/test/sys/firmware/acpi/interrupts/gpe0F new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe0F @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe10 b/test/sys/firmware/acpi/interrupts/gpe10 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe10 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe11 b/test/sys/firmware/acpi/interrupts/gpe11 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe11 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe12 b/test/sys/firmware/acpi/interrupts/gpe12 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe12 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe13 b/test/sys/firmware/acpi/interrupts/gpe13 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe13 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe14 b/test/sys/firmware/acpi/interrupts/gpe14 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe14 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe15 b/test/sys/firmware/acpi/interrupts/gpe15 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe15 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe16 b/test/sys/firmware/acpi/interrupts/gpe16 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe16 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe17 b/test/sys/firmware/acpi/interrupts/gpe17 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe17 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe18 b/test/sys/firmware/acpi/interrupts/gpe18 new file mode 100644 index 0000000000..c352d5552e --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe18 @@ -0,0 +1 @@ + 0 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe19 b/test/sys/firmware/acpi/interrupts/gpe19 new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe19 @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1A b/test/sys/firmware/acpi/interrupts/gpe1A new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe1A @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1B b/test/sys/firmware/acpi/interrupts/gpe1B new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe1B @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1C b/test/sys/firmware/acpi/interrupts/gpe1C new file mode 100644 index 0000000000..bfa154d3f3 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe1C @@ -0,0 +1 @@ + 883 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe1D b/test/sys/firmware/acpi/interrupts/gpe1D new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe1D @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1E b/test/sys/firmware/acpi/interrupts/gpe1E new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe1E @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1F b/test/sys/firmware/acpi/interrupts/gpe1F new file mode 100644 index 0000000000..f71740f689 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe1F @@ -0,0 +1 @@ + 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe_all b/test/sys/firmware/acpi/interrupts/gpe_all new file mode 100644 index 0000000000..e54d39d521 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/gpe_all @@ -0,0 +1 @@ + 884 diff --git a/test/sys/firmware/acpi/interrupts/sci b/test/sys/firmware/acpi/interrupts/sci new file mode 100644 index 0000000000..e54d39d521 --- /dev/null +++ b/test/sys/firmware/acpi/interrupts/sci @@ -0,0 +1 @@ + 884 diff --git a/test/sys/firmware/acpi/tables/APIC b/test/sys/firmware/acpi/tables/APIC new file mode 100644 index 0000000000..e5b4b6053d Binary files /dev/null and b/test/sys/firmware/acpi/tables/APIC differ diff --git a/test/sys/firmware/acpi/tables/BOOT b/test/sys/firmware/acpi/tables/BOOT new file mode 100644 index 0000000000..8f294f6cee Binary files /dev/null and b/test/sys/firmware/acpi/tables/BOOT differ diff --git a/test/sys/firmware/acpi/tables/DSDT b/test/sys/firmware/acpi/tables/DSDT new file mode 100644 index 0000000000..c380b3e41c Binary files /dev/null and b/test/sys/firmware/acpi/tables/DSDT differ diff --git a/test/sys/firmware/acpi/tables/ECDT b/test/sys/firmware/acpi/tables/ECDT new file mode 100644 index 0000000000..edf4f8549f Binary files /dev/null and b/test/sys/firmware/acpi/tables/ECDT differ diff --git a/test/sys/firmware/acpi/tables/FACP b/test/sys/firmware/acpi/tables/FACP new file mode 100644 index 0000000000..f64347e783 Binary files /dev/null and b/test/sys/firmware/acpi/tables/FACP differ diff --git a/test/sys/firmware/acpi/tables/FACS b/test/sys/firmware/acpi/tables/FACS new file mode 100644 index 0000000000..09155e37fe Binary files /dev/null and b/test/sys/firmware/acpi/tables/FACS differ diff --git a/test/sys/firmware/acpi/tables/HPET b/test/sys/firmware/acpi/tables/HPET new file mode 100644 index 0000000000..4857c3ad8f Binary files /dev/null and b/test/sys/firmware/acpi/tables/HPET differ diff --git a/test/sys/firmware/acpi/tables/MCFG b/test/sys/firmware/acpi/tables/MCFG new file mode 100644 index 0000000000..9b2c4d5652 Binary files /dev/null and b/test/sys/firmware/acpi/tables/MCFG differ diff --git a/test/sys/firmware/acpi/tables/SLIC b/test/sys/firmware/acpi/tables/SLIC new file mode 100644 index 0000000000..c2e22ef127 Binary files /dev/null and b/test/sys/firmware/acpi/tables/SLIC differ diff --git a/test/sys/firmware/acpi/tables/SSDT1 b/test/sys/firmware/acpi/tables/SSDT1 new file mode 100644 index 0000000000..d9c4b950f7 Binary files /dev/null and b/test/sys/firmware/acpi/tables/SSDT1 differ diff --git a/test/sys/firmware/acpi/tables/SSDT2 b/test/sys/firmware/acpi/tables/SSDT2 new file mode 100644 index 0000000000..c85a6ea2c5 Binary files /dev/null and b/test/sys/firmware/acpi/tables/SSDT2 differ diff --git a/test/sys/firmware/acpi/tables/SSDT3 b/test/sys/firmware/acpi/tables/SSDT3 new file mode 100644 index 0000000000..6dc6f825d4 Binary files /dev/null and b/test/sys/firmware/acpi/tables/SSDT3 differ diff --git a/test/sys/firmware/acpi/tables/SSDT4 b/test/sys/firmware/acpi/tables/SSDT4 new file mode 100644 index 0000000000..d9587a4fb7 Binary files /dev/null and b/test/sys/firmware/acpi/tables/SSDT4 differ diff --git a/test/sys/firmware/acpi/tables/SSDT5 b/test/sys/firmware/acpi/tables/SSDT5 new file mode 100644 index 0000000000..efd58bb46d Binary files /dev/null and b/test/sys/firmware/acpi/tables/SSDT5 differ diff --git a/test/sys/firmware/acpi/tables/TCPA b/test/sys/firmware/acpi/tables/TCPA new file mode 100644 index 0000000000..d3013a31bb Binary files /dev/null and b/test/sys/firmware/acpi/tables/TCPA differ diff --git a/test/sys/firmware/edd/int13_dev80/default_cylinders b/test/sys/firmware/edd/int13_dev80/default_cylinders new file mode 100644 index 0000000000..cb521a2fb3 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/default_cylinders @@ -0,0 +1 @@ +16383 diff --git a/test/sys/firmware/edd/int13_dev80/default_heads b/test/sys/firmware/edd/int13_dev80/default_heads new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/default_heads @@ -0,0 +1 @@ +16 diff --git a/test/sys/firmware/edd/int13_dev80/default_sectors_per_track b/test/sys/firmware/edd/int13_dev80/default_sectors_per_track new file mode 100644 index 0000000000..4b9026d8e2 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/default_sectors_per_track @@ -0,0 +1 @@ +63 diff --git a/test/sys/firmware/edd/int13_dev80/extensions b/test/sys/firmware/edd/int13_dev80/extensions new file mode 100644 index 0000000000..3229770709 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/extensions @@ -0,0 +1,2 @@ +Fixed disk access +Enhanced Disk Drive support diff --git a/test/sys/firmware/edd/int13_dev80/host_bus b/test/sys/firmware/edd/int13_dev80/host_bus new file mode 100644 index 0000000000..03c9d72858 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/host_bus @@ -0,0 +1 @@ +PCI 00:1f.2 channel: 1 diff --git a/test/sys/firmware/edd/int13_dev80/info_flags b/test/sys/firmware/edd/int13_dev80/info_flags new file mode 100644 index 0000000000..e9b93025c1 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/info_flags @@ -0,0 +1 @@ +DMA boundary error transparent diff --git a/test/sys/firmware/edd/int13_dev80/interface b/test/sys/firmware/edd/int13_dev80/interface new file mode 100644 index 0000000000..f476fd0659 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/interface @@ -0,0 +1 @@ +ATA device: 0 diff --git a/test/sys/firmware/edd/int13_dev80/legacy_max_cylinder b/test/sys/firmware/edd/int13_dev80/legacy_max_cylinder new file mode 100644 index 0000000000..c7781419a3 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/legacy_max_cylinder @@ -0,0 +1 @@ +1022 diff --git a/test/sys/firmware/edd/int13_dev80/legacy_max_head b/test/sys/firmware/edd/int13_dev80/legacy_max_head new file mode 100644 index 0000000000..b4249c475b --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/legacy_max_head @@ -0,0 +1 @@ +239 diff --git a/test/sys/firmware/edd/int13_dev80/legacy_sectors_per_track b/test/sys/firmware/edd/int13_dev80/legacy_sectors_per_track new file mode 100644 index 0000000000..4b9026d8e2 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/legacy_sectors_per_track @@ -0,0 +1 @@ +63 diff --git a/test/sys/firmware/edd/int13_dev80/mbr_signature b/test/sys/firmware/edd/int13_dev80/mbr_signature new file mode 100644 index 0000000000..fd4966ce3a --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/mbr_signature @@ -0,0 +1 @@ +0x00087b5f diff --git a/test/sys/firmware/edd/int13_dev80/pci_dev b/test/sys/firmware/edd/int13_dev80/pci_dev new file mode 120000 index 0000000000..cb9f3ca449 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/pci_dev @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1f.2 \ No newline at end of file diff --git a/test/sys/firmware/edd/int13_dev80/raw_data b/test/sys/firmware/edd/int13_dev80/raw_data new file mode 100644 index 0000000000..78ecca3487 Binary files /dev/null and b/test/sys/firmware/edd/int13_dev80/raw_data differ diff --git a/test/sys/firmware/edd/int13_dev80/sectors b/test/sys/firmware/edd/int13_dev80/sectors new file mode 100644 index 0000000000..967b32b605 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/sectors @@ -0,0 +1 @@ +195371568 diff --git a/test/sys/firmware/edd/int13_dev80/version b/test/sys/firmware/edd/int13_dev80/version new file mode 100644 index 0000000000..5a0dc65a29 --- /dev/null +++ b/test/sys/firmware/edd/int13_dev80/version @@ -0,0 +1 @@ +0x30 diff --git a/test/sys/firmware/memmap/0/end b/test/sys/firmware/memmap/0/end new file mode 100644 index 0000000000..13ddd545ab --- /dev/null +++ b/test/sys/firmware/memmap/0/end @@ -0,0 +1 @@ +0x9efff diff --git a/test/sys/firmware/memmap/0/start b/test/sys/firmware/memmap/0/start new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/firmware/memmap/0/start @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/firmware/memmap/0/type b/test/sys/firmware/memmap/0/type new file mode 100644 index 0000000000..e9d695712c --- /dev/null +++ b/test/sys/firmware/memmap/0/type @@ -0,0 +1 @@ +System RAM diff --git a/test/sys/firmware/memmap/1/end b/test/sys/firmware/memmap/1/end new file mode 100644 index 0000000000..b68cf02550 --- /dev/null +++ b/test/sys/firmware/memmap/1/end @@ -0,0 +1 @@ +0x9ffff diff --git a/test/sys/firmware/memmap/1/start b/test/sys/firmware/memmap/1/start new file mode 100644 index 0000000000..9176a6235d --- /dev/null +++ b/test/sys/firmware/memmap/1/start @@ -0,0 +1 @@ +0x9f000 diff --git a/test/sys/firmware/memmap/1/type b/test/sys/firmware/memmap/1/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/1/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/firmware/memmap/10/end b/test/sys/firmware/memmap/10/end new file mode 100644 index 0000000000..abc04b14b5 --- /dev/null +++ b/test/sys/firmware/memmap/10/end @@ -0,0 +1 @@ +0xfed19fff diff --git a/test/sys/firmware/memmap/10/start b/test/sys/firmware/memmap/10/start new file mode 100644 index 0000000000..70ad16771c --- /dev/null +++ b/test/sys/firmware/memmap/10/start @@ -0,0 +1 @@ +0xfed14000 diff --git a/test/sys/firmware/memmap/10/type b/test/sys/firmware/memmap/10/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/10/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/firmware/memmap/11/end b/test/sys/firmware/memmap/11/end new file mode 100644 index 0000000000..8bd04cbbad --- /dev/null +++ b/test/sys/firmware/memmap/11/end @@ -0,0 +1 @@ +0xfed8ffff diff --git a/test/sys/firmware/memmap/11/start b/test/sys/firmware/memmap/11/start new file mode 100644 index 0000000000..538a4d1d55 --- /dev/null +++ b/test/sys/firmware/memmap/11/start @@ -0,0 +1 @@ +0xfed1c000 diff --git a/test/sys/firmware/memmap/11/type b/test/sys/firmware/memmap/11/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/11/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/firmware/memmap/12/end b/test/sys/firmware/memmap/12/end new file mode 100644 index 0000000000..617cccfb8b --- /dev/null +++ b/test/sys/firmware/memmap/12/end @@ -0,0 +1 @@ +0xfee00fff diff --git a/test/sys/firmware/memmap/12/start b/test/sys/firmware/memmap/12/start new file mode 100644 index 0000000000..c6c4677ee5 --- /dev/null +++ b/test/sys/firmware/memmap/12/start @@ -0,0 +1 @@ +0xfee00000 diff --git a/test/sys/firmware/memmap/12/type b/test/sys/firmware/memmap/12/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/12/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/firmware/memmap/13/end b/test/sys/firmware/memmap/13/end new file mode 100644 index 0000000000..adefea55b5 --- /dev/null +++ b/test/sys/firmware/memmap/13/end @@ -0,0 +1 @@ +0xffffffff diff --git a/test/sys/firmware/memmap/13/start b/test/sys/firmware/memmap/13/start new file mode 100644 index 0000000000..3a12bbc151 --- /dev/null +++ b/test/sys/firmware/memmap/13/start @@ -0,0 +1 @@ +0xff800000 diff --git a/test/sys/firmware/memmap/13/type b/test/sys/firmware/memmap/13/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/13/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/firmware/memmap/2/end b/test/sys/firmware/memmap/2/end new file mode 100644 index 0000000000..0db57c80aa --- /dev/null +++ b/test/sys/firmware/memmap/2/end @@ -0,0 +1 @@ +0xfffff diff --git a/test/sys/firmware/memmap/2/start b/test/sys/firmware/memmap/2/start new file mode 100644 index 0000000000..cc594eb8b6 --- /dev/null +++ b/test/sys/firmware/memmap/2/start @@ -0,0 +1 @@ +0xdc000 diff --git a/test/sys/firmware/memmap/2/type b/test/sys/firmware/memmap/2/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/2/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/firmware/memmap/3/end b/test/sys/firmware/memmap/3/end new file mode 100644 index 0000000000..588e544dc0 --- /dev/null +++ b/test/sys/firmware/memmap/3/end @@ -0,0 +1 @@ +0x7fecffff diff --git a/test/sys/firmware/memmap/3/start b/test/sys/firmware/memmap/3/start new file mode 100644 index 0000000000..22dd9361aa --- /dev/null +++ b/test/sys/firmware/memmap/3/start @@ -0,0 +1 @@ +0x100000 diff --git a/test/sys/firmware/memmap/3/type b/test/sys/firmware/memmap/3/type new file mode 100644 index 0000000000..e9d695712c --- /dev/null +++ b/test/sys/firmware/memmap/3/type @@ -0,0 +1 @@ +System RAM diff --git a/test/sys/firmware/memmap/4/end b/test/sys/firmware/memmap/4/end new file mode 100644 index 0000000000..d2cc696799 --- /dev/null +++ b/test/sys/firmware/memmap/4/end @@ -0,0 +1 @@ +0x7fedefff diff --git a/test/sys/firmware/memmap/4/start b/test/sys/firmware/memmap/4/start new file mode 100644 index 0000000000..d5573a6898 --- /dev/null +++ b/test/sys/firmware/memmap/4/start @@ -0,0 +1 @@ +0x7fed0000 diff --git a/test/sys/firmware/memmap/4/type b/test/sys/firmware/memmap/4/type new file mode 100644 index 0000000000..7bb0fe5f44 --- /dev/null +++ b/test/sys/firmware/memmap/4/type @@ -0,0 +1 @@ +ACPI Tables diff --git a/test/sys/firmware/memmap/5/end b/test/sys/firmware/memmap/5/end new file mode 100644 index 0000000000..c909944edf --- /dev/null +++ b/test/sys/firmware/memmap/5/end @@ -0,0 +1 @@ +0x7fefffff diff --git a/test/sys/firmware/memmap/5/start b/test/sys/firmware/memmap/5/start new file mode 100644 index 0000000000..2ad0b0e0ce --- /dev/null +++ b/test/sys/firmware/memmap/5/start @@ -0,0 +1 @@ +0x7fedf000 diff --git a/test/sys/firmware/memmap/5/type b/test/sys/firmware/memmap/5/type new file mode 100644 index 0000000000..1c3449031a --- /dev/null +++ b/test/sys/firmware/memmap/5/type @@ -0,0 +1 @@ +ACPI Non-volatile Storage diff --git a/test/sys/firmware/memmap/6/end b/test/sys/firmware/memmap/6/end new file mode 100644 index 0000000000..4910c67e83 --- /dev/null +++ b/test/sys/firmware/memmap/6/end @@ -0,0 +1 @@ +0x7fffffff diff --git a/test/sys/firmware/memmap/6/start b/test/sys/firmware/memmap/6/start new file mode 100644 index 0000000000..16b9a9bba9 --- /dev/null +++ b/test/sys/firmware/memmap/6/start @@ -0,0 +1 @@ +0x7ff00000 diff --git a/test/sys/firmware/memmap/6/type b/test/sys/firmware/memmap/6/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/6/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/firmware/memmap/7/end b/test/sys/firmware/memmap/7/end new file mode 100644 index 0000000000..c039514719 --- /dev/null +++ b/test/sys/firmware/memmap/7/end @@ -0,0 +1 @@ +0xf3ffffff diff --git a/test/sys/firmware/memmap/7/start b/test/sys/firmware/memmap/7/start new file mode 100644 index 0000000000..554667a99e --- /dev/null +++ b/test/sys/firmware/memmap/7/start @@ -0,0 +1 @@ +0xf0000000 diff --git a/test/sys/firmware/memmap/7/type b/test/sys/firmware/memmap/7/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/7/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/firmware/memmap/8/end b/test/sys/firmware/memmap/8/end new file mode 100644 index 0000000000..526bcba100 --- /dev/null +++ b/test/sys/firmware/memmap/8/end @@ -0,0 +1 @@ +0xfec0ffff diff --git a/test/sys/firmware/memmap/8/start b/test/sys/firmware/memmap/8/start new file mode 100644 index 0000000000..7a9cc31e9e --- /dev/null +++ b/test/sys/firmware/memmap/8/start @@ -0,0 +1 @@ +0xfec00000 diff --git a/test/sys/firmware/memmap/8/type b/test/sys/firmware/memmap/8/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/8/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/firmware/memmap/9/end b/test/sys/firmware/memmap/9/end new file mode 100644 index 0000000000..1e17e98a47 --- /dev/null +++ b/test/sys/firmware/memmap/9/end @@ -0,0 +1 @@ +0xfed003ff diff --git a/test/sys/firmware/memmap/9/start b/test/sys/firmware/memmap/9/start new file mode 100644 index 0000000000..febf41c046 --- /dev/null +++ b/test/sys/firmware/memmap/9/start @@ -0,0 +1 @@ +0xfed00000 diff --git a/test/sys/firmware/memmap/9/type b/test/sys/firmware/memmap/9/type new file mode 100644 index 0000000000..123f60c77e --- /dev/null +++ b/test/sys/firmware/memmap/9/type @@ -0,0 +1 @@ +reserved diff --git a/test/sys/fs/fuse/connections/16/abort b/test/sys/fs/fuse/connections/16/abort new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/fs/fuse/connections/16/waiting b/test/sys/fs/fuse/connections/16/waiting new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/fs/fuse/connections/16/waiting @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/debug/bdi/0:16/stats b/test/sys/kernel/debug/bdi/0:16/stats new file mode 100644 index 0000000000..c43411b49b --- /dev/null +++ b/test/sys/kernel/debug/bdi/0:16/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193284 kB +BackgroundThresh: 96640 kB diff --git a/test/sys/kernel/debug/bdi/11:0/stats b/test/sys/kernel/debug/bdi/11:0/stats new file mode 100644 index 0000000000..5eff4a0704 --- /dev/null +++ b/test/sys/kernel/debug/bdi/11:0/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193292 kB +BackgroundThresh: 96644 kB diff --git a/test/sys/kernel/debug/bdi/7:0/stats b/test/sys/kernel/debug/bdi/7:0/stats new file mode 100644 index 0000000000..9f29e3dd92 --- /dev/null +++ b/test/sys/kernel/debug/bdi/7:0/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193296 kB +BackgroundThresh: 96648 kB diff --git a/test/sys/kernel/debug/bdi/7:1/stats b/test/sys/kernel/debug/bdi/7:1/stats new file mode 100644 index 0000000000..9f29e3dd92 --- /dev/null +++ b/test/sys/kernel/debug/bdi/7:1/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193296 kB +BackgroundThresh: 96648 kB diff --git a/test/sys/kernel/debug/bdi/7:2/stats b/test/sys/kernel/debug/bdi/7:2/stats new file mode 100644 index 0000000000..c43411b49b --- /dev/null +++ b/test/sys/kernel/debug/bdi/7:2/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193284 kB +BackgroundThresh: 96640 kB diff --git a/test/sys/kernel/debug/bdi/7:3/stats b/test/sys/kernel/debug/bdi/7:3/stats new file mode 100644 index 0000000000..c43411b49b --- /dev/null +++ b/test/sys/kernel/debug/bdi/7:3/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193284 kB +BackgroundThresh: 96640 kB diff --git a/test/sys/kernel/debug/bdi/7:4/stats b/test/sys/kernel/debug/bdi/7:4/stats new file mode 100644 index 0000000000..c43411b49b --- /dev/null +++ b/test/sys/kernel/debug/bdi/7:4/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193284 kB +BackgroundThresh: 96640 kB diff --git a/test/sys/kernel/debug/bdi/7:5/stats b/test/sys/kernel/debug/bdi/7:5/stats new file mode 100644 index 0000000000..c43411b49b --- /dev/null +++ b/test/sys/kernel/debug/bdi/7:5/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193284 kB +BackgroundThresh: 96640 kB diff --git a/test/sys/kernel/debug/bdi/7:6/stats b/test/sys/kernel/debug/bdi/7:6/stats new file mode 100644 index 0000000000..c43411b49b --- /dev/null +++ b/test/sys/kernel/debug/bdi/7:6/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193284 kB +BackgroundThresh: 96640 kB diff --git a/test/sys/kernel/debug/bdi/7:7/stats b/test/sys/kernel/debug/bdi/7:7/stats new file mode 100644 index 0000000000..c43411b49b --- /dev/null +++ b/test/sys/kernel/debug/bdi/7:7/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193284 kB +BackgroundThresh: 96640 kB diff --git a/test/sys/kernel/debug/bdi/8:0/stats b/test/sys/kernel/debug/bdi/8:0/stats new file mode 100644 index 0000000000..72b9f30e50 --- /dev/null +++ b/test/sys/kernel/debug/bdi/8:0/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 14080 kB +BdiDirtyThresh: 2328 kB +DirtyThresh: 193292 kB +BackgroundThresh: 96644 kB diff --git a/test/sys/kernel/debug/bdi/8:16/stats b/test/sys/kernel/debug/bdi/8:16/stats new file mode 100644 index 0000000000..c43411b49b --- /dev/null +++ b/test/sys/kernel/debug/bdi/8:16/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193284 kB +BackgroundThresh: 96640 kB diff --git a/test/sys/kernel/debug/bdi/9:0/stats b/test/sys/kernel/debug/bdi/9:0/stats new file mode 100644 index 0000000000..e475ac8269 --- /dev/null +++ b/test/sys/kernel/debug/bdi/9:0/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193280 kB +BackgroundThresh: 96640 kB diff --git a/test/sys/kernel/debug/bdi/default/stats b/test/sys/kernel/debug/bdi/default/stats new file mode 100644 index 0000000000..5eff4a0704 --- /dev/null +++ b/test/sys/kernel/debug/bdi/default/stats @@ -0,0 +1,5 @@ +BdiWriteback: 0 kB +BdiReclaimable: 0 kB +BdiDirtyThresh: 0 kB +DirtyThresh: 193292 kB +BackgroundThresh: 96644 kB diff --git a/test/sys/kernel/debug/x86/pat_memtype_list b/test/sys/kernel/debug/x86/pat_memtype_list new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/kexec_crash_loaded b/test/sys/kernel/kexec_crash_loaded new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/kexec_crash_loaded @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/kexec_loaded b/test/sys/kernel/kexec_loaded new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/kexec_loaded @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/notes b/test/sys/kernel/notes new file mode 100644 index 0000000000..7b82063519 Binary files /dev/null and b/test/sys/kernel/notes differ diff --git a/test/sys/kernel/slab/Acpi-Namespace/aliases b/test/sys/kernel/slab/Acpi-Namespace/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/align b/test/sys/kernel/slab/Acpi-Namespace/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/alloc_calls b/test/sys/kernel/slab/Acpi-Namespace/alloc_calls new file mode 100644 index 0000000000..0e2ffc5ae4 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/alloc_calls @@ -0,0 +1 @@ + 1709 acpi_ns_create_node+0x34/0x45 age=116006/120316/120398 pid=0-330 cpus=0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/cache_dma b/test/sys/kernel/slab/Acpi-Namespace/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/cpu_slabs b/test/sys/kernel/slab/Acpi-Namespace/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/ctor b/test/sys/kernel/slab/Acpi-Namespace/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu b/test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/free_calls b/test/sys/kernel/slab/Acpi-Namespace/free_calls new file mode 100644 index 0000000000..e7f6a1869a --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/free_calls @@ -0,0 +1 @@ + 1709 age=4294787694 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/hwcache_align b/test/sys/kernel/slab/Acpi-Namespace/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/object_size b/test/sys/kernel/slab/Acpi-Namespace/object_size new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/object_size @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/Acpi-Namespace/objects b/test/sys/kernel/slab/Acpi-Namespace/objects new file mode 100644 index 0000000000..741f5d6795 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/objects @@ -0,0 +1 @@ +1738 diff --git a/test/sys/kernel/slab/Acpi-Namespace/objects_partial b/test/sys/kernel/slab/Acpi-Namespace/objects_partial new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/objects_partial @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/Acpi-Namespace/objs_per_slab b/test/sys/kernel/slab/Acpi-Namespace/objs_per_slab new file mode 100644 index 0000000000..a2720097dc --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/objs_per_slab @@ -0,0 +1 @@ +39 diff --git a/test/sys/kernel/slab/Acpi-Namespace/order b/test/sys/kernel/slab/Acpi-Namespace/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/partial b/test/sys/kernel/slab/Acpi-Namespace/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Namespace/poison b/test/sys/kernel/slab/Acpi-Namespace/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Namespace/reclaim_account b/test/sys/kernel/slab/Acpi-Namespace/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/red_zone b/test/sys/kernel/slab/Acpi-Namespace/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Namespace/sanity_checks b/test/sys/kernel/slab/Acpi-Namespace/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Namespace/shrink b/test/sys/kernel/slab/Acpi-Namespace/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-Namespace/slab_size b/test/sys/kernel/slab/Acpi-Namespace/slab_size new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/slab_size @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/Acpi-Namespace/slabs b/test/sys/kernel/slab/Acpi-Namespace/slabs new file mode 100644 index 0000000000..ea90ee3198 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/slabs @@ -0,0 +1 @@ +45 diff --git a/test/sys/kernel/slab/Acpi-Namespace/store_user b/test/sys/kernel/slab/Acpi-Namespace/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Namespace/total_objects b/test/sys/kernel/slab/Acpi-Namespace/total_objects new file mode 100644 index 0000000000..2358ac3b44 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/total_objects @@ -0,0 +1 @@ +1755 diff --git a/test/sys/kernel/slab/Acpi-Namespace/trace b/test/sys/kernel/slab/Acpi-Namespace/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Namespace/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/validate b/test/sys/kernel/slab/Acpi-Namespace/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-Operand/aliases b/test/sys/kernel/slab/Acpi-Operand/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Operand/align b/test/sys/kernel/slab/Acpi-Operand/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Operand/alloc_calls b/test/sys/kernel/slab/Acpi-Operand/alloc_calls new file mode 100644 index 0000000000..4d77b37000 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/alloc_calls @@ -0,0 +1 @@ + 2637 acpi_ut_allocate_object_desc_dbg+0x39/0x75 age=1821/119915/120374 pid=0-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/Acpi-Operand/cache_dma b/test/sys/kernel/slab/Acpi-Operand/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Operand/cpu_slabs b/test/sys/kernel/slab/Acpi-Operand/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Operand/ctor b/test/sys/kernel/slab/Acpi-Operand/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu b/test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Operand/free_calls b/test/sys/kernel/slab/Acpi-Operand/free_calls new file mode 100644 index 0000000000..48ef19c663 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/free_calls @@ -0,0 +1,2 @@ + 2265 age=4294787671 pid=0 cpus=0 + 372 acpi_os_release_object+0x9/0xd age=1822/117810/120363 pid=0-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/Acpi-Operand/hwcache_align b/test/sys/kernel/slab/Acpi-Operand/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Operand/object_size b/test/sys/kernel/slab/Acpi-Operand/object_size new file mode 100644 index 0000000000..ea70ce0134 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/object_size @@ -0,0 +1 @@ +72 diff --git a/test/sys/kernel/slab/Acpi-Operand/objects b/test/sys/kernel/slab/Acpi-Operand/objects new file mode 100644 index 0000000000..71150e8800 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/objects @@ -0,0 +1 @@ +2661 diff --git a/test/sys/kernel/slab/Acpi-Operand/objects_partial b/test/sys/kernel/slab/Acpi-Operand/objects_partial new file mode 100644 index 0000000000..538165229c --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/objects_partial @@ -0,0 +1 @@ +197 diff --git a/test/sys/kernel/slab/Acpi-Operand/objs_per_slab b/test/sys/kernel/slab/Acpi-Operand/objs_per_slab new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/objs_per_slab @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/Acpi-Operand/order b/test/sys/kernel/slab/Acpi-Operand/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Operand/partial b/test/sys/kernel/slab/Acpi-Operand/partial new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/partial @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/Acpi-Operand/poison b/test/sys/kernel/slab/Acpi-Operand/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Operand/reclaim_account b/test/sys/kernel/slab/Acpi-Operand/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Operand/red_zone b/test/sys/kernel/slab/Acpi-Operand/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Operand/sanity_checks b/test/sys/kernel/slab/Acpi-Operand/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Operand/shrink b/test/sys/kernel/slab/Acpi-Operand/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-Operand/slab_size b/test/sys/kernel/slab/Acpi-Operand/slab_size new file mode 100644 index 0000000000..a29644e57e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/slab_size @@ -0,0 +1 @@ +144 diff --git a/test/sys/kernel/slab/Acpi-Operand/slabs b/test/sys/kernel/slab/Acpi-Operand/slabs new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/slabs @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/Acpi-Operand/store_user b/test/sys/kernel/slab/Acpi-Operand/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Operand/total_objects b/test/sys/kernel/slab/Acpi-Operand/total_objects new file mode 100644 index 0000000000..9e46834fcb --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/total_objects @@ -0,0 +1 @@ +2688 diff --git a/test/sys/kernel/slab/Acpi-Operand/trace b/test/sys/kernel/slab/Acpi-Operand/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Operand/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Operand/validate b/test/sys/kernel/slab/Acpi-Operand/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-Parse/aliases b/test/sys/kernel/slab/Acpi-Parse/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/align b/test/sys/kernel/slab/Acpi-Parse/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/alloc_calls b/test/sys/kernel/slab/Acpi-Parse/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/Acpi-Parse/cache_dma b/test/sys/kernel/slab/Acpi-Parse/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/cpu_slabs b/test/sys/kernel/slab/Acpi-Parse/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/ctor b/test/sys/kernel/slab/Acpi-Parse/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu b/test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/free_calls b/test/sys/kernel/slab/Acpi-Parse/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/Acpi-Parse/hwcache_align b/test/sys/kernel/slab/Acpi-Parse/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/object_size b/test/sys/kernel/slab/Acpi-Parse/object_size new file mode 100644 index 0000000000..21e72e8ac3 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/object_size @@ -0,0 +1 @@ +48 diff --git a/test/sys/kernel/slab/Acpi-Parse/objects b/test/sys/kernel/slab/Acpi-Parse/objects new file mode 100644 index 0000000000..38b10c1b2b --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/objects @@ -0,0 +1 @@ +68 diff --git a/test/sys/kernel/slab/Acpi-Parse/objects_partial b/test/sys/kernel/slab/Acpi-Parse/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/objs_per_slab b/test/sys/kernel/slab/Acpi-Parse/objs_per_slab new file mode 100644 index 0000000000..a787364590 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/objs_per_slab @@ -0,0 +1 @@ +34 diff --git a/test/sys/kernel/slab/Acpi-Parse/order b/test/sys/kernel/slab/Acpi-Parse/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/partial b/test/sys/kernel/slab/Acpi-Parse/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/poison b/test/sys/kernel/slab/Acpi-Parse/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Parse/reclaim_account b/test/sys/kernel/slab/Acpi-Parse/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/red_zone b/test/sys/kernel/slab/Acpi-Parse/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Parse/sanity_checks b/test/sys/kernel/slab/Acpi-Parse/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Parse/shrink b/test/sys/kernel/slab/Acpi-Parse/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-Parse/slab_size b/test/sys/kernel/slab/Acpi-Parse/slab_size new file mode 100644 index 0000000000..52bd8e43af --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/slab_size @@ -0,0 +1 @@ +120 diff --git a/test/sys/kernel/slab/Acpi-Parse/slabs b/test/sys/kernel/slab/Acpi-Parse/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/Acpi-Parse/store_user b/test/sys/kernel/slab/Acpi-Parse/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-Parse/total_objects b/test/sys/kernel/slab/Acpi-Parse/total_objects new file mode 100644 index 0000000000..38b10c1b2b --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/total_objects @@ -0,0 +1 @@ +68 diff --git a/test/sys/kernel/slab/Acpi-Parse/trace b/test/sys/kernel/slab/Acpi-Parse/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-Parse/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-Parse/validate b/test/sys/kernel/slab/Acpi-Parse/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/aliases b/test/sys/kernel/slab/Acpi-ParseExt/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/align b/test/sys/kernel/slab/Acpi-ParseExt/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/alloc_calls b/test/sys/kernel/slab/Acpi-ParseExt/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/Acpi-ParseExt/cache_dma b/test/sys/kernel/slab/Acpi-ParseExt/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs b/test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/ctor b/test/sys/kernel/slab/Acpi-ParseExt/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu b/test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/free_calls b/test/sys/kernel/slab/Acpi-ParseExt/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/Acpi-ParseExt/hwcache_align b/test/sys/kernel/slab/Acpi-ParseExt/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/object_size b/test/sys/kernel/slab/Acpi-ParseExt/object_size new file mode 100644 index 0000000000..ea70ce0134 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/object_size @@ -0,0 +1 @@ +72 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/objects b/test/sys/kernel/slab/Acpi-ParseExt/objects new file mode 100644 index 0000000000..f6b91e0e1f --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/objects @@ -0,0 +1 @@ +56 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/objects_partial b/test/sys/kernel/slab/Acpi-ParseExt/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab b/test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/order b/test/sys/kernel/slab/Acpi-ParseExt/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/partial b/test/sys/kernel/slab/Acpi-ParseExt/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/poison b/test/sys/kernel/slab/Acpi-ParseExt/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/reclaim_account b/test/sys/kernel/slab/Acpi-ParseExt/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/red_zone b/test/sys/kernel/slab/Acpi-ParseExt/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/sanity_checks b/test/sys/kernel/slab/Acpi-ParseExt/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/shrink b/test/sys/kernel/slab/Acpi-ParseExt/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/slab_size b/test/sys/kernel/slab/Acpi-ParseExt/slab_size new file mode 100644 index 0000000000..a29644e57e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/slab_size @@ -0,0 +1 @@ +144 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/slabs b/test/sys/kernel/slab/Acpi-ParseExt/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/store_user b/test/sys/kernel/slab/Acpi-ParseExt/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/total_objects b/test/sys/kernel/slab/Acpi-ParseExt/total_objects new file mode 100644 index 0000000000..f6b91e0e1f --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/total_objects @@ -0,0 +1 @@ +56 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/trace b/test/sys/kernel/slab/Acpi-ParseExt/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-ParseExt/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/validate b/test/sys/kernel/slab/Acpi-ParseExt/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-State/aliases b/test/sys/kernel/slab/Acpi-State/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/align b/test/sys/kernel/slab/Acpi-State/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/alloc_calls b/test/sys/kernel/slab/Acpi-State/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/Acpi-State/cache_dma b/test/sys/kernel/slab/Acpi-State/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/cpu_slabs b/test/sys/kernel/slab/Acpi-State/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/ctor b/test/sys/kernel/slab/Acpi-State/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-State/destroy_by_rcu b/test/sys/kernel/slab/Acpi-State/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/free_calls b/test/sys/kernel/slab/Acpi-State/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/Acpi-State/hwcache_align b/test/sys/kernel/slab/Acpi-State/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/object_size b/test/sys/kernel/slab/Acpi-State/object_size new file mode 100644 index 0000000000..d15a2cc44e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/object_size @@ -0,0 +1 @@ +80 diff --git a/test/sys/kernel/slab/Acpi-State/objects b/test/sys/kernel/slab/Acpi-State/objects new file mode 100644 index 0000000000..0691f67b20 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/objects @@ -0,0 +1 @@ +52 diff --git a/test/sys/kernel/slab/Acpi-State/objects_partial b/test/sys/kernel/slab/Acpi-State/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/objs_per_slab b/test/sys/kernel/slab/Acpi-State/objs_per_slab new file mode 100644 index 0000000000..6f4247a625 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/objs_per_slab @@ -0,0 +1 @@ +26 diff --git a/test/sys/kernel/slab/Acpi-State/order b/test/sys/kernel/slab/Acpi-State/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/partial b/test/sys/kernel/slab/Acpi-State/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/poison b/test/sys/kernel/slab/Acpi-State/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-State/reclaim_account b/test/sys/kernel/slab/Acpi-State/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/red_zone b/test/sys/kernel/slab/Acpi-State/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-State/sanity_checks b/test/sys/kernel/slab/Acpi-State/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-State/shrink b/test/sys/kernel/slab/Acpi-State/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/Acpi-State/slab_size b/test/sys/kernel/slab/Acpi-State/slab_size new file mode 100644 index 0000000000..492dff089a --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/slab_size @@ -0,0 +1 @@ +152 diff --git a/test/sys/kernel/slab/Acpi-State/slabs b/test/sys/kernel/slab/Acpi-State/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/Acpi-State/store_user b/test/sys/kernel/slab/Acpi-State/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/Acpi-State/total_objects b/test/sys/kernel/slab/Acpi-State/total_objects new file mode 100644 index 0000000000..0691f67b20 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/total_objects @@ -0,0 +1 @@ +52 diff --git a/test/sys/kernel/slab/Acpi-State/trace b/test/sys/kernel/slab/Acpi-State/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/Acpi-State/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/Acpi-State/validate b/test/sys/kernel/slab/Acpi-State/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/RAW/aliases b/test/sys/kernel/slab/RAW/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAW/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAW/align b/test/sys/kernel/slab/RAW/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAW/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAW/alloc_calls b/test/sys/kernel/slab/RAW/alloc_calls new file mode 100644 index 0000000000..3e9e980f66 --- /dev/null +++ b/test/sys/kernel/slab/RAW/alloc_calls @@ -0,0 +1 @@ + 3 sk_prot_alloc+0x1e/0xb0 age=119924/119927/119933 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/RAW/cache_dma b/test/sys/kernel/slab/RAW/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAW/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAW/cpu_slabs b/test/sys/kernel/slab/RAW/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAW/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAW/ctor b/test/sys/kernel/slab/RAW/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/RAW/destroy_by_rcu b/test/sys/kernel/slab/RAW/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAW/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAW/free_calls b/test/sys/kernel/slab/RAW/free_calls new file mode 100644 index 0000000000..387adf109e --- /dev/null +++ b/test/sys/kernel/slab/RAW/free_calls @@ -0,0 +1 @@ + 3 age=4294787507 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/RAW/hwcache_align b/test/sys/kernel/slab/RAW/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAW/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAW/object_size b/test/sys/kernel/slab/RAW/object_size new file mode 100644 index 0000000000..42d797944e --- /dev/null +++ b/test/sys/kernel/slab/RAW/object_size @@ -0,0 +1 @@ +1208 diff --git a/test/sys/kernel/slab/RAW/objects b/test/sys/kernel/slab/RAW/objects new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/RAW/objects @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/RAW/objects_partial b/test/sys/kernel/slab/RAW/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAW/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAW/objs_per_slab b/test/sys/kernel/slab/RAW/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/RAW/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/RAW/order b/test/sys/kernel/slab/RAW/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/RAW/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/RAW/partial b/test/sys/kernel/slab/RAW/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAW/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAW/poison b/test/sys/kernel/slab/RAW/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAW/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAW/reclaim_account b/test/sys/kernel/slab/RAW/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAW/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAW/red_zone b/test/sys/kernel/slab/RAW/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAW/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAW/sanity_checks b/test/sys/kernel/slab/RAW/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAW/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAW/shrink b/test/sys/kernel/slab/RAW/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/RAW/slab_size b/test/sys/kernel/slab/RAW/slab_size new file mode 100644 index 0000000000..003638ac6a --- /dev/null +++ b/test/sys/kernel/slab/RAW/slab_size @@ -0,0 +1 @@ +1280 diff --git a/test/sys/kernel/slab/RAW/slabs b/test/sys/kernel/slab/RAW/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAW/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAW/store_user b/test/sys/kernel/slab/RAW/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAW/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAW/total_objects b/test/sys/kernel/slab/RAW/total_objects new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/RAW/total_objects @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/RAW/trace b/test/sys/kernel/slab/RAW/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAW/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAW/validate b/test/sys/kernel/slab/RAW/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/RAWv6/aliases b/test/sys/kernel/slab/RAWv6/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAWv6/align b/test/sys/kernel/slab/RAWv6/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAWv6/alloc_calls b/test/sys/kernel/slab/RAWv6/alloc_calls new file mode 100644 index 0000000000..c1c43b575a --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/alloc_calls @@ -0,0 +1 @@ + 5 sk_prot_alloc+0x1e/0xb0 age=100873/100880/100883 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/RAWv6/cache_dma b/test/sys/kernel/slab/RAWv6/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAWv6/cpu_slabs b/test/sys/kernel/slab/RAWv6/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAWv6/ctor b/test/sys/kernel/slab/RAWv6/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/RAWv6/destroy_by_rcu b/test/sys/kernel/slab/RAWv6/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAWv6/free_calls b/test/sys/kernel/slab/RAWv6/free_calls new file mode 100644 index 0000000000..eb3a49d9e9 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/free_calls @@ -0,0 +1 @@ + 5 age=4294788100 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/RAWv6/hwcache_align b/test/sys/kernel/slab/RAWv6/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAWv6/object_size b/test/sys/kernel/slab/RAWv6/object_size new file mode 100644 index 0000000000..10570a3409 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/object_size @@ -0,0 +1 @@ +1376 diff --git a/test/sys/kernel/slab/RAWv6/objects b/test/sys/kernel/slab/RAWv6/objects new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/objects @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/RAWv6/objects_partial b/test/sys/kernel/slab/RAWv6/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAWv6/objs_per_slab b/test/sys/kernel/slab/RAWv6/objs_per_slab new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/objs_per_slab @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/RAWv6/order b/test/sys/kernel/slab/RAWv6/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/RAWv6/partial b/test/sys/kernel/slab/RAWv6/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAWv6/poison b/test/sys/kernel/slab/RAWv6/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAWv6/reclaim_account b/test/sys/kernel/slab/RAWv6/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAWv6/red_zone b/test/sys/kernel/slab/RAWv6/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAWv6/sanity_checks b/test/sys/kernel/slab/RAWv6/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAWv6/shrink b/test/sys/kernel/slab/RAWv6/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/RAWv6/slab_size b/test/sys/kernel/slab/RAWv6/slab_size new file mode 100644 index 0000000000..bfc0bcc570 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/slab_size @@ -0,0 +1 @@ +1472 diff --git a/test/sys/kernel/slab/RAWv6/slabs b/test/sys/kernel/slab/RAWv6/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAWv6/store_user b/test/sys/kernel/slab/RAWv6/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/RAWv6/total_objects b/test/sys/kernel/slab/RAWv6/total_objects new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/total_objects @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/RAWv6/trace b/test/sys/kernel/slab/RAWv6/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/RAWv6/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/RAWv6/validate b/test/sys/kernel/slab/RAWv6/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/TCP/aliases b/test/sys/kernel/slab/TCP/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCP/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCP/align b/test/sys/kernel/slab/TCP/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCP/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCP/alloc_calls b/test/sys/kernel/slab/TCP/alloc_calls new file mode 100644 index 0000000000..7d9c450e8e --- /dev/null +++ b/test/sys/kernel/slab/TCP/alloc_calls @@ -0,0 +1 @@ + 2 sk_prot_alloc+0x1e/0xb0 age=94735/95856/96977 pid=1690-1920 cpus=0 diff --git a/test/sys/kernel/slab/TCP/cache_dma b/test/sys/kernel/slab/TCP/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCP/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCP/cpu_slabs b/test/sys/kernel/slab/TCP/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCP/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCP/ctor b/test/sys/kernel/slab/TCP/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/TCP/destroy_by_rcu b/test/sys/kernel/slab/TCP/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCP/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCP/free_calls b/test/sys/kernel/slab/TCP/free_calls new file mode 100644 index 0000000000..85fe8af23a --- /dev/null +++ b/test/sys/kernel/slab/TCP/free_calls @@ -0,0 +1 @@ + 2 sk_free+0x80/0x100 age=96193/96808/97424 pid=1667-1762 cpus=0 diff --git a/test/sys/kernel/slab/TCP/hwcache_align b/test/sys/kernel/slab/TCP/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCP/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCP/object_size b/test/sys/kernel/slab/TCP/object_size new file mode 100644 index 0000000000..fca0e8a08c --- /dev/null +++ b/test/sys/kernel/slab/TCP/object_size @@ -0,0 +1 @@ +2200 diff --git a/test/sys/kernel/slab/TCP/objects b/test/sys/kernel/slab/TCP/objects new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/TCP/objects @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/TCP/objects_partial b/test/sys/kernel/slab/TCP/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCP/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCP/objs_per_slab b/test/sys/kernel/slab/TCP/objs_per_slab new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/TCP/objs_per_slab @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/TCP/order b/test/sys/kernel/slab/TCP/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/TCP/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/TCP/partial b/test/sys/kernel/slab/TCP/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCP/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCP/poison b/test/sys/kernel/slab/TCP/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCP/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCP/reclaim_account b/test/sys/kernel/slab/TCP/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCP/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCP/red_zone b/test/sys/kernel/slab/TCP/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCP/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCP/sanity_checks b/test/sys/kernel/slab/TCP/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCP/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCP/shrink b/test/sys/kernel/slab/TCP/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/TCP/slab_size b/test/sys/kernel/slab/TCP/slab_size new file mode 100644 index 0000000000..c801f0a47c --- /dev/null +++ b/test/sys/kernel/slab/TCP/slab_size @@ -0,0 +1 @@ +2304 diff --git a/test/sys/kernel/slab/TCP/slabs b/test/sys/kernel/slab/TCP/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/TCP/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/TCP/store_user b/test/sys/kernel/slab/TCP/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCP/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCP/total_objects b/test/sys/kernel/slab/TCP/total_objects new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/TCP/total_objects @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/TCP/trace b/test/sys/kernel/slab/TCP/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCP/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCP/validate b/test/sys/kernel/slab/TCP/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/TCPv6/aliases b/test/sys/kernel/slab/TCPv6/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCPv6/align b/test/sys/kernel/slab/TCPv6/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCPv6/alloc_calls b/test/sys/kernel/slab/TCPv6/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/TCPv6/cache_dma b/test/sys/kernel/slab/TCPv6/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCPv6/cpu_slabs b/test/sys/kernel/slab/TCPv6/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCPv6/ctor b/test/sys/kernel/slab/TCPv6/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/TCPv6/destroy_by_rcu b/test/sys/kernel/slab/TCPv6/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCPv6/free_calls b/test/sys/kernel/slab/TCPv6/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/TCPv6/hwcache_align b/test/sys/kernel/slab/TCPv6/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCPv6/object_size b/test/sys/kernel/slab/TCPv6/object_size new file mode 100644 index 0000000000..d61563f929 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/object_size @@ -0,0 +1 @@ +2336 diff --git a/test/sys/kernel/slab/TCPv6/objects b/test/sys/kernel/slab/TCPv6/objects new file mode 100644 index 0000000000..6f4247a625 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/objects @@ -0,0 +1 @@ +26 diff --git a/test/sys/kernel/slab/TCPv6/objects_partial b/test/sys/kernel/slab/TCPv6/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCPv6/objs_per_slab b/test/sys/kernel/slab/TCPv6/objs_per_slab new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/objs_per_slab @@ -0,0 +1 @@ +13 diff --git a/test/sys/kernel/slab/TCPv6/order b/test/sys/kernel/slab/TCPv6/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/TCPv6/partial b/test/sys/kernel/slab/TCPv6/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCPv6/poison b/test/sys/kernel/slab/TCPv6/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCPv6/reclaim_account b/test/sys/kernel/slab/TCPv6/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCPv6/red_zone b/test/sys/kernel/slab/TCPv6/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCPv6/sanity_checks b/test/sys/kernel/slab/TCPv6/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCPv6/shrink b/test/sys/kernel/slab/TCPv6/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/TCPv6/slab_size b/test/sys/kernel/slab/TCPv6/slab_size new file mode 100644 index 0000000000..e576ab3169 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/slab_size @@ -0,0 +1 @@ +2432 diff --git a/test/sys/kernel/slab/TCPv6/slabs b/test/sys/kernel/slab/TCPv6/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/TCPv6/store_user b/test/sys/kernel/slab/TCPv6/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/TCPv6/total_objects b/test/sys/kernel/slab/TCPv6/total_objects new file mode 100644 index 0000000000..6f4247a625 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/total_objects @@ -0,0 +1 @@ +26 diff --git a/test/sys/kernel/slab/TCPv6/trace b/test/sys/kernel/slab/TCPv6/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/TCPv6/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/TCPv6/validate b/test/sys/kernel/slab/TCPv6/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDP-Lite/aliases b/test/sys/kernel/slab/UDP-Lite/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/align b/test/sys/kernel/slab/UDP-Lite/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/alloc_calls b/test/sys/kernel/slab/UDP-Lite/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/UDP-Lite/cache_dma b/test/sys/kernel/slab/UDP-Lite/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/cpu_slabs b/test/sys/kernel/slab/UDP-Lite/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/ctor b/test/sys/kernel/slab/UDP-Lite/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDP-Lite/destroy_by_rcu b/test/sys/kernel/slab/UDP-Lite/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/free_calls b/test/sys/kernel/slab/UDP-Lite/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/UDP-Lite/hwcache_align b/test/sys/kernel/slab/UDP-Lite/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP-Lite/object_size b/test/sys/kernel/slab/UDP-Lite/object_size new file mode 100644 index 0000000000..9ee8e02295 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/object_size @@ -0,0 +1 @@ +1232 diff --git a/test/sys/kernel/slab/UDP-Lite/objects b/test/sys/kernel/slab/UDP-Lite/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/objects_partial b/test/sys/kernel/slab/UDP-Lite/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/objs_per_slab b/test/sys/kernel/slab/UDP-Lite/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/UDP-Lite/order b/test/sys/kernel/slab/UDP-Lite/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/UDP-Lite/partial b/test/sys/kernel/slab/UDP-Lite/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/poison b/test/sys/kernel/slab/UDP-Lite/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP-Lite/reclaim_account b/test/sys/kernel/slab/UDP-Lite/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/red_zone b/test/sys/kernel/slab/UDP-Lite/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP-Lite/sanity_checks b/test/sys/kernel/slab/UDP-Lite/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP-Lite/shrink b/test/sys/kernel/slab/UDP-Lite/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDP-Lite/slab_size b/test/sys/kernel/slab/UDP-Lite/slab_size new file mode 100644 index 0000000000..3f3c936679 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/slab_size @@ -0,0 +1 @@ +1344 diff --git a/test/sys/kernel/slab/UDP-Lite/slabs b/test/sys/kernel/slab/UDP-Lite/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/store_user b/test/sys/kernel/slab/UDP-Lite/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP-Lite/total_objects b/test/sys/kernel/slab/UDP-Lite/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/trace b/test/sys/kernel/slab/UDP-Lite/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP-Lite/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP-Lite/validate b/test/sys/kernel/slab/UDP-Lite/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDP/aliases b/test/sys/kernel/slab/UDP/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP/align b/test/sys/kernel/slab/UDP/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP/alloc_calls b/test/sys/kernel/slab/UDP/alloc_calls new file mode 100644 index 0000000000..8850f7b92a --- /dev/null +++ b/test/sys/kernel/slab/UDP/alloc_calls @@ -0,0 +1 @@ + 5 sk_prot_alloc+0x1e/0xb0 age=68483/90027/96209 pid=1545-2586 cpus=0-1 diff --git a/test/sys/kernel/slab/UDP/cache_dma b/test/sys/kernel/slab/UDP/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP/cpu_slabs b/test/sys/kernel/slab/UDP/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP/ctor b/test/sys/kernel/slab/UDP/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDP/destroy_by_rcu b/test/sys/kernel/slab/UDP/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP/free_calls b/test/sys/kernel/slab/UDP/free_calls new file mode 100644 index 0000000000..99f6e5a1ac --- /dev/null +++ b/test/sys/kernel/slab/UDP/free_calls @@ -0,0 +1,2 @@ + 1 age=4294787511 pid=0 cpus=0 + 4 sk_free+0x80/0x100 age=68483/91236/105213 pid=1371-2586 cpus=0-1 diff --git a/test/sys/kernel/slab/UDP/hwcache_align b/test/sys/kernel/slab/UDP/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP/object_size b/test/sys/kernel/slab/UDP/object_size new file mode 100644 index 0000000000..9ee8e02295 --- /dev/null +++ b/test/sys/kernel/slab/UDP/object_size @@ -0,0 +1 @@ +1232 diff --git a/test/sys/kernel/slab/UDP/objects b/test/sys/kernel/slab/UDP/objects new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/UDP/objects @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/UDP/objects_partial b/test/sys/kernel/slab/UDP/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP/objs_per_slab b/test/sys/kernel/slab/UDP/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/UDP/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/UDP/order b/test/sys/kernel/slab/UDP/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/UDP/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/UDP/partial b/test/sys/kernel/slab/UDP/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP/poison b/test/sys/kernel/slab/UDP/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP/reclaim_account b/test/sys/kernel/slab/UDP/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP/red_zone b/test/sys/kernel/slab/UDP/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP/sanity_checks b/test/sys/kernel/slab/UDP/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP/shrink b/test/sys/kernel/slab/UDP/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDP/slab_size b/test/sys/kernel/slab/UDP/slab_size new file mode 100644 index 0000000000..3f3c936679 --- /dev/null +++ b/test/sys/kernel/slab/UDP/slab_size @@ -0,0 +1 @@ +1344 diff --git a/test/sys/kernel/slab/UDP/slabs b/test/sys/kernel/slab/UDP/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/UDP/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/UDP/store_user b/test/sys/kernel/slab/UDP/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDP/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDP/total_objects b/test/sys/kernel/slab/UDP/total_objects new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/UDP/total_objects @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/UDP/trace b/test/sys/kernel/slab/UDP/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDP/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDP/validate b/test/sys/kernel/slab/UDP/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDPLITEv6/aliases b/test/sys/kernel/slab/UDPLITEv6/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/align b/test/sys/kernel/slab/UDPLITEv6/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/alloc_calls b/test/sys/kernel/slab/UDPLITEv6/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/UDPLITEv6/cache_dma b/test/sys/kernel/slab/UDPLITEv6/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/cpu_slabs b/test/sys/kernel/slab/UDPLITEv6/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/ctor b/test/sys/kernel/slab/UDPLITEv6/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu b/test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/free_calls b/test/sys/kernel/slab/UDPLITEv6/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/UDPLITEv6/hwcache_align b/test/sys/kernel/slab/UDPLITEv6/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPLITEv6/object_size b/test/sys/kernel/slab/UDPLITEv6/object_size new file mode 100644 index 0000000000..8a055dcf59 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/object_size @@ -0,0 +1 @@ +1368 diff --git a/test/sys/kernel/slab/UDPLITEv6/objects b/test/sys/kernel/slab/UDPLITEv6/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/objects_partial b/test/sys/kernel/slab/UDPLITEv6/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/objs_per_slab b/test/sys/kernel/slab/UDPLITEv6/objs_per_slab new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/objs_per_slab @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/UDPLITEv6/order b/test/sys/kernel/slab/UDPLITEv6/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/UDPLITEv6/partial b/test/sys/kernel/slab/UDPLITEv6/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/poison b/test/sys/kernel/slab/UDPLITEv6/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPLITEv6/reclaim_account b/test/sys/kernel/slab/UDPLITEv6/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/red_zone b/test/sys/kernel/slab/UDPLITEv6/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPLITEv6/sanity_checks b/test/sys/kernel/slab/UDPLITEv6/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPLITEv6/shrink b/test/sys/kernel/slab/UDPLITEv6/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDPLITEv6/slab_size b/test/sys/kernel/slab/UDPLITEv6/slab_size new file mode 100644 index 0000000000..bfc0bcc570 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/slab_size @@ -0,0 +1 @@ +1472 diff --git a/test/sys/kernel/slab/UDPLITEv6/slabs b/test/sys/kernel/slab/UDPLITEv6/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/store_user b/test/sys/kernel/slab/UDPLITEv6/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPLITEv6/total_objects b/test/sys/kernel/slab/UDPLITEv6/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/trace b/test/sys/kernel/slab/UDPLITEv6/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPLITEv6/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPLITEv6/validate b/test/sys/kernel/slab/UDPLITEv6/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDPv6/aliases b/test/sys/kernel/slab/UDPv6/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPv6/align b/test/sys/kernel/slab/UDPv6/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPv6/alloc_calls b/test/sys/kernel/slab/UDPv6/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/UDPv6/cache_dma b/test/sys/kernel/slab/UDPv6/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPv6/cpu_slabs b/test/sys/kernel/slab/UDPv6/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPv6/ctor b/test/sys/kernel/slab/UDPv6/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDPv6/destroy_by_rcu b/test/sys/kernel/slab/UDPv6/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPv6/free_calls b/test/sys/kernel/slab/UDPv6/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/UDPv6/hwcache_align b/test/sys/kernel/slab/UDPv6/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPv6/object_size b/test/sys/kernel/slab/UDPv6/object_size new file mode 100644 index 0000000000..8a055dcf59 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/object_size @@ -0,0 +1 @@ +1368 diff --git a/test/sys/kernel/slab/UDPv6/objects b/test/sys/kernel/slab/UDPv6/objects new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/objects @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/UDPv6/objects_partial b/test/sys/kernel/slab/UDPv6/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPv6/objs_per_slab b/test/sys/kernel/slab/UDPv6/objs_per_slab new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/objs_per_slab @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/UDPv6/order b/test/sys/kernel/slab/UDPv6/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/UDPv6/partial b/test/sys/kernel/slab/UDPv6/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPv6/poison b/test/sys/kernel/slab/UDPv6/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPv6/reclaim_account b/test/sys/kernel/slab/UDPv6/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPv6/red_zone b/test/sys/kernel/slab/UDPv6/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPv6/sanity_checks b/test/sys/kernel/slab/UDPv6/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPv6/shrink b/test/sys/kernel/slab/UDPv6/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UDPv6/slab_size b/test/sys/kernel/slab/UDPv6/slab_size new file mode 100644 index 0000000000..bfc0bcc570 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/slab_size @@ -0,0 +1 @@ +1472 diff --git a/test/sys/kernel/slab/UDPv6/slabs b/test/sys/kernel/slab/UDPv6/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPv6/store_user b/test/sys/kernel/slab/UDPv6/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UDPv6/total_objects b/test/sys/kernel/slab/UDPv6/total_objects new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/total_objects @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/UDPv6/trace b/test/sys/kernel/slab/UDPv6/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UDPv6/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UDPv6/validate b/test/sys/kernel/slab/UDPv6/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UNIX/aliases b/test/sys/kernel/slab/UNIX/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UNIX/align b/test/sys/kernel/slab/UNIX/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UNIX/alloc_calls b/test/sys/kernel/slab/UNIX/alloc_calls new file mode 100644 index 0000000000..8d75da09f8 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/alloc_calls @@ -0,0 +1 @@ + 453 sk_prot_alloc+0x1e/0xb0 age=15147/84431/117158 pid=71-2852 cpus=0-1 diff --git a/test/sys/kernel/slab/UNIX/cache_dma b/test/sys/kernel/slab/UNIX/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UNIX/cpu_slabs b/test/sys/kernel/slab/UNIX/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UNIX/ctor b/test/sys/kernel/slab/UNIX/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UNIX/destroy_by_rcu b/test/sys/kernel/slab/UNIX/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UNIX/free_calls b/test/sys/kernel/slab/UNIX/free_calls new file mode 100644 index 0000000000..c551f22661 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/free_calls @@ -0,0 +1,2 @@ + 238 age=4294787435 pid=0 cpus=0 + 215 sk_free+0x80/0x100 age=37696/82342/116702 pid=76-2812 cpus=0-1 diff --git a/test/sys/kernel/slab/UNIX/hwcache_align b/test/sys/kernel/slab/UNIX/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UNIX/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UNIX/object_size b/test/sys/kernel/slab/UNIX/object_size new file mode 100644 index 0000000000..10570a3409 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/object_size @@ -0,0 +1 @@ +1376 diff --git a/test/sys/kernel/slab/UNIX/objects b/test/sys/kernel/slab/UNIX/objects new file mode 100644 index 0000000000..e5a0177c9c --- /dev/null +++ b/test/sys/kernel/slab/UNIX/objects @@ -0,0 +1 @@ +488 diff --git a/test/sys/kernel/slab/UNIX/objects_partial b/test/sys/kernel/slab/UNIX/objects_partial new file mode 100644 index 0000000000..7296f257eb --- /dev/null +++ b/test/sys/kernel/slab/UNIX/objects_partial @@ -0,0 +1 @@ +136 diff --git a/test/sys/kernel/slab/UNIX/objs_per_slab b/test/sys/kernel/slab/UNIX/objs_per_slab new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/UNIX/objs_per_slab @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/UNIX/order b/test/sys/kernel/slab/UNIX/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/UNIX/partial b/test/sys/kernel/slab/UNIX/partial new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/partial @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/UNIX/poison b/test/sys/kernel/slab/UNIX/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UNIX/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UNIX/reclaim_account b/test/sys/kernel/slab/UNIX/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UNIX/red_zone b/test/sys/kernel/slab/UNIX/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UNIX/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UNIX/sanity_checks b/test/sys/kernel/slab/UNIX/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UNIX/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UNIX/shrink b/test/sys/kernel/slab/UNIX/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/UNIX/slab_size b/test/sys/kernel/slab/UNIX/slab_size new file mode 100644 index 0000000000..bfc0bcc570 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/slab_size @@ -0,0 +1 @@ +1472 diff --git a/test/sys/kernel/slab/UNIX/slabs b/test/sys/kernel/slab/UNIX/slabs new file mode 100644 index 0000000000..409940768f --- /dev/null +++ b/test/sys/kernel/slab/UNIX/slabs @@ -0,0 +1 @@ +23 diff --git a/test/sys/kernel/slab/UNIX/store_user b/test/sys/kernel/slab/UNIX/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/UNIX/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/UNIX/total_objects b/test/sys/kernel/slab/UNIX/total_objects new file mode 100644 index 0000000000..80e3e6eab6 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/total_objects @@ -0,0 +1 @@ +506 diff --git a/test/sys/kernel/slab/UNIX/trace b/test/sys/kernel/slab/UNIX/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/UNIX/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/UNIX/validate b/test/sys/kernel/slab/UNIX/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/anon_vma/aliases b/test/sys/kernel/slab/anon_vma/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/anon_vma/align b/test/sys/kernel/slab/anon_vma/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/anon_vma/alloc_calls b/test/sys/kernel/slab/anon_vma/alloc_calls new file mode 100644 index 0000000000..4c7fc9859a --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/alloc_calls @@ -0,0 +1 @@ + 3239 anon_vma_prepare+0xe0/0x100 age=3762/81736/118721 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/anon_vma/cache_dma b/test/sys/kernel/slab/anon_vma/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/anon_vma/cpu_slabs b/test/sys/kernel/slab/anon_vma/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/anon_vma/ctor b/test/sys/kernel/slab/anon_vma/ctor new file mode 100644 index 0000000000..13aeabc977 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/ctor @@ -0,0 +1 @@ +anon_vma_ctor+0x0/0x40 diff --git a/test/sys/kernel/slab/anon_vma/destroy_by_rcu b/test/sys/kernel/slab/anon_vma/destroy_by_rcu new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/destroy_by_rcu @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/anon_vma/free_calls b/test/sys/kernel/slab/anon_vma/free_calls new file mode 100644 index 0000000000..635e6921ab --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/free_calls @@ -0,0 +1,2 @@ + 1611 age=4294787816 pid=0 cpus=0 + 1628 anon_vma_unlink+0x5f/0x70 age=4763/81283/117672 pid=56-2889 cpus=0-1 diff --git a/test/sys/kernel/slab/anon_vma/hwcache_align b/test/sys/kernel/slab/anon_vma/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/anon_vma/object_size b/test/sys/kernel/slab/anon_vma/object_size new file mode 100644 index 0000000000..ea70ce0134 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/object_size @@ -0,0 +1 @@ +72 diff --git a/test/sys/kernel/slab/anon_vma/objects b/test/sys/kernel/slab/anon_vma/objects new file mode 100644 index 0000000000..362875e42d --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/objects @@ -0,0 +1 @@ +3248 diff --git a/test/sys/kernel/slab/anon_vma/objects_partial b/test/sys/kernel/slab/anon_vma/objects_partial new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/objects_partial @@ -0,0 +1 @@ +168 diff --git a/test/sys/kernel/slab/anon_vma/objs_per_slab b/test/sys/kernel/slab/anon_vma/objs_per_slab new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/objs_per_slab @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/anon_vma/order b/test/sys/kernel/slab/anon_vma/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/anon_vma/partial b/test/sys/kernel/slab/anon_vma/partial new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/partial @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/anon_vma/poison b/test/sys/kernel/slab/anon_vma/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/anon_vma/reclaim_account b/test/sys/kernel/slab/anon_vma/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/anon_vma/red_zone b/test/sys/kernel/slab/anon_vma/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/anon_vma/sanity_checks b/test/sys/kernel/slab/anon_vma/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/anon_vma/shrink b/test/sys/kernel/slab/anon_vma/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/anon_vma/slab_size b/test/sys/kernel/slab/anon_vma/slab_size new file mode 100644 index 0000000000..a29644e57e --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/slab_size @@ -0,0 +1 @@ +144 diff --git a/test/sys/kernel/slab/anon_vma/slabs b/test/sys/kernel/slab/anon_vma/slabs new file mode 100644 index 0000000000..5bc6609e3d --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/slabs @@ -0,0 +1 @@ +117 diff --git a/test/sys/kernel/slab/anon_vma/store_user b/test/sys/kernel/slab/anon_vma/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/anon_vma/total_objects b/test/sys/kernel/slab/anon_vma/total_objects new file mode 100644 index 0000000000..56e3ff90a5 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/total_objects @@ -0,0 +1 @@ +3276 diff --git a/test/sys/kernel/slab/anon_vma/trace b/test/sys/kernel/slab/anon_vma/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/anon_vma/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/anon_vma/validate b/test/sys/kernel/slab/anon_vma/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/arp_cache/aliases b/test/sys/kernel/slab/arp_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/arp_cache/align b/test/sys/kernel/slab/arp_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/arp_cache/alloc_calls b/test/sys/kernel/slab/arp_cache/alloc_calls new file mode 100644 index 0000000000..4b1f9e5ee9 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/alloc_calls @@ -0,0 +1 @@ + 3 neigh_create+0x8b/0x530 age=64592/65244/65620 pid=0-2618 cpus=0-1 diff --git a/test/sys/kernel/slab/arp_cache/cache_dma b/test/sys/kernel/slab/arp_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/arp_cache/cpu_slabs b/test/sys/kernel/slab/arp_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/arp_cache/ctor b/test/sys/kernel/slab/arp_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/arp_cache/destroy_by_rcu b/test/sys/kernel/slab/arp_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/arp_cache/free_calls b/test/sys/kernel/slab/arp_cache/free_calls new file mode 100644 index 0000000000..1a2ab65ce2 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/free_calls @@ -0,0 +1 @@ + 3 age=4294787502 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/arp_cache/hwcache_align b/test/sys/kernel/slab/arp_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/arp_cache/object_size b/test/sys/kernel/slab/arp_cache/object_size new file mode 100644 index 0000000000..71627d7107 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/object_size @@ -0,0 +1 @@ +348 diff --git a/test/sys/kernel/slab/arp_cache/objects b/test/sys/kernel/slab/arp_cache/objects new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/objects @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/arp_cache/objects_partial b/test/sys/kernel/slab/arp_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/arp_cache/objs_per_slab b/test/sys/kernel/slab/arp_cache/objs_per_slab new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/objs_per_slab @@ -0,0 +1 @@ +18 diff --git a/test/sys/kernel/slab/arp_cache/order b/test/sys/kernel/slab/arp_cache/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/arp_cache/partial b/test/sys/kernel/slab/arp_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/arp_cache/poison b/test/sys/kernel/slab/arp_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/arp_cache/reclaim_account b/test/sys/kernel/slab/arp_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/arp_cache/red_zone b/test/sys/kernel/slab/arp_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/arp_cache/sanity_checks b/test/sys/kernel/slab/arp_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/arp_cache/shrink b/test/sys/kernel/slab/arp_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/arp_cache/slab_size b/test/sys/kernel/slab/arp_cache/slab_size new file mode 100644 index 0000000000..5379c470da --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/slab_size @@ -0,0 +1 @@ +448 diff --git a/test/sys/kernel/slab/arp_cache/slabs b/test/sys/kernel/slab/arp_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/arp_cache/store_user b/test/sys/kernel/slab/arp_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/arp_cache/total_objects b/test/sys/kernel/slab/arp_cache/total_objects new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/total_objects @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/arp_cache/trace b/test/sys/kernel/slab/arp_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/arp_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/arp_cache/validate b/test/sys/kernel/slab/arp_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/bdev_cache/aliases b/test/sys/kernel/slab/bdev_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bdev_cache/align b/test/sys/kernel/slab/bdev_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bdev_cache/alloc_calls b/test/sys/kernel/slab/bdev_cache/alloc_calls new file mode 100644 index 0000000000..d99323fdae --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/alloc_calls @@ -0,0 +1 @@ + 13 bdev_alloc_inode+0x15/0x30 age=38164/101169/120416 pid=0-2801 cpus=0-1 diff --git a/test/sys/kernel/slab/bdev_cache/cache_dma b/test/sys/kernel/slab/bdev_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bdev_cache/cpu_slabs b/test/sys/kernel/slab/bdev_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bdev_cache/ctor b/test/sys/kernel/slab/bdev_cache/ctor new file mode 100644 index 0000000000..3e8fad602c --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x100 diff --git a/test/sys/kernel/slab/bdev_cache/destroy_by_rcu b/test/sys/kernel/slab/bdev_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bdev_cache/free_calls b/test/sys/kernel/slab/bdev_cache/free_calls new file mode 100644 index 0000000000..e009ee8282 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/free_calls @@ -0,0 +1,2 @@ + 9 age=4294787712 pid=0 cpus=0 + 4 bdev_destroy_inode+0x1f/0x30 age=38235/76874/115478 pid=488-2778 cpus=0-1 diff --git a/test/sys/kernel/slab/bdev_cache/hwcache_align b/test/sys/kernel/slab/bdev_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bdev_cache/object_size b/test/sys/kernel/slab/bdev_cache/object_size new file mode 100644 index 0000000000..19a5f54fa2 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/object_size @@ -0,0 +1 @@ +1432 diff --git a/test/sys/kernel/slab/bdev_cache/objects b/test/sys/kernel/slab/bdev_cache/objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/bdev_cache/objects_partial b/test/sys/kernel/slab/bdev_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bdev_cache/objs_per_slab b/test/sys/kernel/slab/bdev_cache/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/bdev_cache/order b/test/sys/kernel/slab/bdev_cache/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/bdev_cache/partial b/test/sys/kernel/slab/bdev_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bdev_cache/poison b/test/sys/kernel/slab/bdev_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bdev_cache/reclaim_account b/test/sys/kernel/slab/bdev_cache/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bdev_cache/red_zone b/test/sys/kernel/slab/bdev_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bdev_cache/sanity_checks b/test/sys/kernel/slab/bdev_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bdev_cache/shrink b/test/sys/kernel/slab/bdev_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/bdev_cache/slab_size b/test/sys/kernel/slab/bdev_cache/slab_size new file mode 100644 index 0000000000..fa94e88e60 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/slab_size @@ -0,0 +1 @@ +1536 diff --git a/test/sys/kernel/slab/bdev_cache/slabs b/test/sys/kernel/slab/bdev_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/bdev_cache/store_user b/test/sys/kernel/slab/bdev_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bdev_cache/total_objects b/test/sys/kernel/slab/bdev_cache/total_objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/total_objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/bdev_cache/trace b/test/sys/kernel/slab/bdev_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bdev_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bdev_cache/validate b/test/sys/kernel/slab/bdev_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/bio/aliases b/test/sys/kernel/slab/bio/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bio/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bio/align b/test/sys/kernel/slab/bio/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/bio/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/bio/alloc_calls b/test/sys/kernel/slab/bio/alloc_calls new file mode 100644 index 0000000000..98c23d1d72 --- /dev/null +++ b/test/sys/kernel/slab/bio/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=120199/120199/120199 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/bio/cache_dma b/test/sys/kernel/slab/bio/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bio/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bio/cpu_slabs b/test/sys/kernel/slab/bio/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bio/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bio/ctor b/test/sys/kernel/slab/bio/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/bio/destroy_by_rcu b/test/sys/kernel/slab/bio/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bio/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bio/free_calls b/test/sys/kernel/slab/bio/free_calls new file mode 100644 index 0000000000..7d3d7f54c9 --- /dev/null +++ b/test/sys/kernel/slab/bio/free_calls @@ -0,0 +1 @@ + 2 age=4294787634 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/bio/hwcache_align b/test/sys/kernel/slab/bio/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bio/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bio/object_size b/test/sys/kernel/slab/bio/object_size new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/bio/object_size @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/bio/objects b/test/sys/kernel/slab/bio/objects new file mode 100644 index 0000000000..c739b42c4d --- /dev/null +++ b/test/sys/kernel/slab/bio/objects @@ -0,0 +1 @@ +44 diff --git a/test/sys/kernel/slab/bio/objects_partial b/test/sys/kernel/slab/bio/objects_partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/bio/objects_partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/bio/objs_per_slab b/test/sys/kernel/slab/bio/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/bio/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/bio/order b/test/sys/kernel/slab/bio/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bio/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bio/partial b/test/sys/kernel/slab/bio/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bio/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bio/poison b/test/sys/kernel/slab/bio/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bio/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bio/reclaim_account b/test/sys/kernel/slab/bio/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bio/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bio/red_zone b/test/sys/kernel/slab/bio/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bio/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bio/sanity_checks b/test/sys/kernel/slab/bio/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bio/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bio/shrink b/test/sys/kernel/slab/bio/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/bio/slab_size b/test/sys/kernel/slab/bio/slab_size new file mode 100644 index 0000000000..86a0307199 --- /dev/null +++ b/test/sys/kernel/slab/bio/slab_size @@ -0,0 +1 @@ +192 diff --git a/test/sys/kernel/slab/bio/slabs b/test/sys/kernel/slab/bio/slabs new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/bio/slabs @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/bio/store_user b/test/sys/kernel/slab/bio/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bio/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bio/total_objects b/test/sys/kernel/slab/bio/total_objects new file mode 100644 index 0000000000..4b9026d8e2 --- /dev/null +++ b/test/sys/kernel/slab/bio/total_objects @@ -0,0 +1 @@ +63 diff --git a/test/sys/kernel/slab/bio/trace b/test/sys/kernel/slab/bio/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bio/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bio/validate b/test/sys/kernel/slab/bio/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-1/aliases b/test/sys/kernel/slab/biovec-1/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-1/align b/test/sys/kernel/slab/biovec-1/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-1/alloc_calls b/test/sys/kernel/slab/biovec-1/alloc_calls new file mode 100644 index 0000000000..b8519742fb --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=120196/120196/120196 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-1/cache_dma b/test/sys/kernel/slab/biovec-1/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-1/cpu_slabs b/test/sys/kernel/slab/biovec-1/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-1/ctor b/test/sys/kernel/slab/biovec-1/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-1/destroy_by_rcu b/test/sys/kernel/slab/biovec-1/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-1/free_calls b/test/sys/kernel/slab/biovec-1/free_calls new file mode 100644 index 0000000000..cec96edabc --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/free_calls @@ -0,0 +1 @@ + 2 age=4294787630 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-1/hwcache_align b/test/sys/kernel/slab/biovec-1/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-1/object_size b/test/sys/kernel/slab/biovec-1/object_size new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/object_size @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/biovec-1/objects b/test/sys/kernel/slab/biovec-1/objects new file mode 100644 index 0000000000..8cf5c1a22a --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/objects @@ -0,0 +1 @@ +86 diff --git a/test/sys/kernel/slab/biovec-1/objects_partial b/test/sys/kernel/slab/biovec-1/objects_partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/objects_partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/biovec-1/objs_per_slab b/test/sys/kernel/slab/biovec-1/objs_per_slab new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/objs_per_slab @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/biovec-1/order b/test/sys/kernel/slab/biovec-1/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-1/partial b/test/sys/kernel/slab/biovec-1/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-1/poison b/test/sys/kernel/slab/biovec-1/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-1/reclaim_account b/test/sys/kernel/slab/biovec-1/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-1/red_zone b/test/sys/kernel/slab/biovec-1/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-1/sanity_checks b/test/sys/kernel/slab/biovec-1/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-1/shrink b/test/sys/kernel/slab/biovec-1/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-1/slab_size b/test/sys/kernel/slab/biovec-1/slab_size new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/slab_size @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/biovec-1/slabs b/test/sys/kernel/slab/biovec-1/slabs new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/slabs @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/biovec-1/store_user b/test/sys/kernel/slab/biovec-1/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-1/total_objects b/test/sys/kernel/slab/biovec-1/total_objects new file mode 100644 index 0000000000..0a3e7b0422 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/total_objects @@ -0,0 +1 @@ +126 diff --git a/test/sys/kernel/slab/biovec-1/trace b/test/sys/kernel/slab/biovec-1/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-1/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-1/validate b/test/sys/kernel/slab/biovec-1/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-128/aliases b/test/sys/kernel/slab/biovec-128/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-128/align b/test/sys/kernel/slab/biovec-128/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-128/alloc_calls b/test/sys/kernel/slab/biovec-128/alloc_calls new file mode 100644 index 0000000000..2be2f63444 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=120168/120168/120168 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-128/cache_dma b/test/sys/kernel/slab/biovec-128/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-128/cpu_slabs b/test/sys/kernel/slab/biovec-128/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-128/ctor b/test/sys/kernel/slab/biovec-128/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-128/destroy_by_rcu b/test/sys/kernel/slab/biovec-128/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-128/free_calls b/test/sys/kernel/slab/biovec-128/free_calls new file mode 100644 index 0000000000..9537ec617a --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/free_calls @@ -0,0 +1 @@ + 2 age=4294787603 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-128/hwcache_align b/test/sys/kernel/slab/biovec-128/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-128/object_size b/test/sys/kernel/slab/biovec-128/object_size new file mode 100644 index 0000000000..c873496a22 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/object_size @@ -0,0 +1 @@ +2048 diff --git a/test/sys/kernel/slab/biovec-128/objects b/test/sys/kernel/slab/biovec-128/objects new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/objects @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/biovec-128/objects_partial b/test/sys/kernel/slab/biovec-128/objects_partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/objects_partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/biovec-128/objs_per_slab b/test/sys/kernel/slab/biovec-128/objs_per_slab new file mode 100644 index 0000000000..60d3b2f4a4 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/objs_per_slab @@ -0,0 +1 @@ +15 diff --git a/test/sys/kernel/slab/biovec-128/order b/test/sys/kernel/slab/biovec-128/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/biovec-128/partial b/test/sys/kernel/slab/biovec-128/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-128/poison b/test/sys/kernel/slab/biovec-128/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-128/reclaim_account b/test/sys/kernel/slab/biovec-128/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-128/red_zone b/test/sys/kernel/slab/biovec-128/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-128/sanity_checks b/test/sys/kernel/slab/biovec-128/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-128/shrink b/test/sys/kernel/slab/biovec-128/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-128/slab_size b/test/sys/kernel/slab/biovec-128/slab_size new file mode 100644 index 0000000000..f52b3ac70f --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/slab_size @@ -0,0 +1 @@ +2176 diff --git a/test/sys/kernel/slab/biovec-128/slabs b/test/sys/kernel/slab/biovec-128/slabs new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/slabs @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/biovec-128/store_user b/test/sys/kernel/slab/biovec-128/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-128/total_objects b/test/sys/kernel/slab/biovec-128/total_objects new file mode 100644 index 0000000000..ea90ee3198 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/total_objects @@ -0,0 +1 @@ +45 diff --git a/test/sys/kernel/slab/biovec-128/trace b/test/sys/kernel/slab/biovec-128/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-128/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-128/validate b/test/sys/kernel/slab/biovec-128/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-16/aliases b/test/sys/kernel/slab/biovec-16/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-16/align b/test/sys/kernel/slab/biovec-16/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-16/alloc_calls b/test/sys/kernel/slab/biovec-16/alloc_calls new file mode 100644 index 0000000000..cd69dde296 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=120188/120188/120188 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-16/cache_dma b/test/sys/kernel/slab/biovec-16/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-16/cpu_slabs b/test/sys/kernel/slab/biovec-16/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-16/ctor b/test/sys/kernel/slab/biovec-16/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-16/destroy_by_rcu b/test/sys/kernel/slab/biovec-16/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-16/free_calls b/test/sys/kernel/slab/biovec-16/free_calls new file mode 100644 index 0000000000..3329178637 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/free_calls @@ -0,0 +1 @@ + 2 age=4294787622 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-16/hwcache_align b/test/sys/kernel/slab/biovec-16/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-16/object_size b/test/sys/kernel/slab/biovec-16/object_size new file mode 100644 index 0000000000..9183bf03fc --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/object_size @@ -0,0 +1 @@ +256 diff --git a/test/sys/kernel/slab/biovec-16/objects b/test/sys/kernel/slab/biovec-16/objects new file mode 100644 index 0000000000..c739b42c4d --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/objects @@ -0,0 +1 @@ +44 diff --git a/test/sys/kernel/slab/biovec-16/objects_partial b/test/sys/kernel/slab/biovec-16/objects_partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/objects_partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/biovec-16/objs_per_slab b/test/sys/kernel/slab/biovec-16/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/biovec-16/order b/test/sys/kernel/slab/biovec-16/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-16/partial b/test/sys/kernel/slab/biovec-16/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-16/poison b/test/sys/kernel/slab/biovec-16/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-16/reclaim_account b/test/sys/kernel/slab/biovec-16/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-16/red_zone b/test/sys/kernel/slab/biovec-16/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-16/sanity_checks b/test/sys/kernel/slab/biovec-16/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-16/shrink b/test/sys/kernel/slab/biovec-16/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-16/slab_size b/test/sys/kernel/slab/biovec-16/slab_size new file mode 100644 index 0000000000..e45b99e958 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/slab_size @@ -0,0 +1 @@ +384 diff --git a/test/sys/kernel/slab/biovec-16/slabs b/test/sys/kernel/slab/biovec-16/slabs new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/slabs @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/biovec-16/store_user b/test/sys/kernel/slab/biovec-16/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-16/total_objects b/test/sys/kernel/slab/biovec-16/total_objects new file mode 100644 index 0000000000..4b9026d8e2 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/total_objects @@ -0,0 +1 @@ +63 diff --git a/test/sys/kernel/slab/biovec-16/trace b/test/sys/kernel/slab/biovec-16/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-16/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-16/validate b/test/sys/kernel/slab/biovec-16/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-256/aliases b/test/sys/kernel/slab/biovec-256/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-256/align b/test/sys/kernel/slab/biovec-256/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-256/alloc_calls b/test/sys/kernel/slab/biovec-256/alloc_calls new file mode 100644 index 0000000000..aada639e03 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=120164/120164/120164 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-256/cache_dma b/test/sys/kernel/slab/biovec-256/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-256/cpu_slabs b/test/sys/kernel/slab/biovec-256/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-256/ctor b/test/sys/kernel/slab/biovec-256/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-256/destroy_by_rcu b/test/sys/kernel/slab/biovec-256/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-256/free_calls b/test/sys/kernel/slab/biovec-256/free_calls new file mode 100644 index 0000000000..13e29ba3bc --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/free_calls @@ -0,0 +1 @@ + 2 age=4294787599 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-256/hwcache_align b/test/sys/kernel/slab/biovec-256/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-256/object_size b/test/sys/kernel/slab/biovec-256/object_size new file mode 100644 index 0000000000..801c306ed3 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/object_size @@ -0,0 +1 @@ +4096 diff --git a/test/sys/kernel/slab/biovec-256/objects b/test/sys/kernel/slab/biovec-256/objects new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/objects @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/biovec-256/objects_partial b/test/sys/kernel/slab/biovec-256/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-256/objs_per_slab b/test/sys/kernel/slab/biovec-256/objs_per_slab new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/objs_per_slab @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/biovec-256/order b/test/sys/kernel/slab/biovec-256/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/biovec-256/partial b/test/sys/kernel/slab/biovec-256/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-256/poison b/test/sys/kernel/slab/biovec-256/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-256/reclaim_account b/test/sys/kernel/slab/biovec-256/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-256/red_zone b/test/sys/kernel/slab/biovec-256/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-256/sanity_checks b/test/sys/kernel/slab/biovec-256/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-256/shrink b/test/sys/kernel/slab/biovec-256/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-256/slab_size b/test/sys/kernel/slab/biovec-256/slab_size new file mode 100644 index 0000000000..7137ddbe18 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/slab_size @@ -0,0 +1 @@ +4224 diff --git a/test/sys/kernel/slab/biovec-256/slabs b/test/sys/kernel/slab/biovec-256/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-256/store_user b/test/sys/kernel/slab/biovec-256/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-256/total_objects b/test/sys/kernel/slab/biovec-256/total_objects new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/total_objects @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/biovec-256/trace b/test/sys/kernel/slab/biovec-256/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-256/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-256/validate b/test/sys/kernel/slab/biovec-256/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-4/aliases b/test/sys/kernel/slab/biovec-4/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/align b/test/sys/kernel/slab/biovec-4/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/alloc_calls b/test/sys/kernel/slab/biovec-4/alloc_calls new file mode 100644 index 0000000000..6b32bf3154 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=120192/120192/120192 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-4/cache_dma b/test/sys/kernel/slab/biovec-4/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/cpu_slabs b/test/sys/kernel/slab/biovec-4/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/ctor b/test/sys/kernel/slab/biovec-4/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-4/destroy_by_rcu b/test/sys/kernel/slab/biovec-4/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/free_calls b/test/sys/kernel/slab/biovec-4/free_calls new file mode 100644 index 0000000000..41c58178d0 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/free_calls @@ -0,0 +1 @@ + 2 age=4294787626 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-4/hwcache_align b/test/sys/kernel/slab/biovec-4/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-4/object_size b/test/sys/kernel/slab/biovec-4/object_size new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/object_size @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/biovec-4/objects b/test/sys/kernel/slab/biovec-4/objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/biovec-4/objects_partial b/test/sys/kernel/slab/biovec-4/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/objs_per_slab b/test/sys/kernel/slab/biovec-4/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/biovec-4/order b/test/sys/kernel/slab/biovec-4/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/partial b/test/sys/kernel/slab/biovec-4/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/poison b/test/sys/kernel/slab/biovec-4/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-4/reclaim_account b/test/sys/kernel/slab/biovec-4/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/red_zone b/test/sys/kernel/slab/biovec-4/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-4/sanity_checks b/test/sys/kernel/slab/biovec-4/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-4/shrink b/test/sys/kernel/slab/biovec-4/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-4/slab_size b/test/sys/kernel/slab/biovec-4/slab_size new file mode 100644 index 0000000000..86a0307199 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/slab_size @@ -0,0 +1 @@ +192 diff --git a/test/sys/kernel/slab/biovec-4/slabs b/test/sys/kernel/slab/biovec-4/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/biovec-4/store_user b/test/sys/kernel/slab/biovec-4/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-4/total_objects b/test/sys/kernel/slab/biovec-4/total_objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/total_objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/biovec-4/trace b/test/sys/kernel/slab/biovec-4/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-4/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-4/validate b/test/sys/kernel/slab/biovec-4/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-64/aliases b/test/sys/kernel/slab/biovec-64/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-64/align b/test/sys/kernel/slab/biovec-64/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-64/alloc_calls b/test/sys/kernel/slab/biovec-64/alloc_calls new file mode 100644 index 0000000000..9eb050d4bc --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=120172/120172/120172 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-64/cache_dma b/test/sys/kernel/slab/biovec-64/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-64/cpu_slabs b/test/sys/kernel/slab/biovec-64/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-64/ctor b/test/sys/kernel/slab/biovec-64/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-64/destroy_by_rcu b/test/sys/kernel/slab/biovec-64/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-64/free_calls b/test/sys/kernel/slab/biovec-64/free_calls new file mode 100644 index 0000000000..e0ab3d9755 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/free_calls @@ -0,0 +1 @@ + 2 age=4294787606 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-64/hwcache_align b/test/sys/kernel/slab/biovec-64/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-64/object_size b/test/sys/kernel/slab/biovec-64/object_size new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/object_size @@ -0,0 +1 @@ +1024 diff --git a/test/sys/kernel/slab/biovec-64/objects b/test/sys/kernel/slab/biovec-64/objects new file mode 100644 index 0000000000..64bb6b746d --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/objects @@ -0,0 +1 @@ +30 diff --git a/test/sys/kernel/slab/biovec-64/objects_partial b/test/sys/kernel/slab/biovec-64/objects_partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/objects_partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/biovec-64/objs_per_slab b/test/sys/kernel/slab/biovec-64/objs_per_slab new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/objs_per_slab @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/biovec-64/order b/test/sys/kernel/slab/biovec-64/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/biovec-64/partial b/test/sys/kernel/slab/biovec-64/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-64/poison b/test/sys/kernel/slab/biovec-64/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-64/reclaim_account b/test/sys/kernel/slab/biovec-64/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-64/red_zone b/test/sys/kernel/slab/biovec-64/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-64/sanity_checks b/test/sys/kernel/slab/biovec-64/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-64/shrink b/test/sys/kernel/slab/biovec-64/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/biovec-64/slab_size b/test/sys/kernel/slab/biovec-64/slab_size new file mode 100644 index 0000000000..d98057a110 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/slab_size @@ -0,0 +1 @@ +1152 diff --git a/test/sys/kernel/slab/biovec-64/slabs b/test/sys/kernel/slab/biovec-64/slabs new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/slabs @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/biovec-64/store_user b/test/sys/kernel/slab/biovec-64/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/biovec-64/total_objects b/test/sys/kernel/slab/biovec-64/total_objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/total_objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/biovec-64/trace b/test/sys/kernel/slab/biovec-64/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/biovec-64/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/biovec-64/validate b/test/sys/kernel/slab/biovec-64/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/blkdev_ioc/aliases b/test/sys/kernel/slab/blkdev_ioc/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/align b/test/sys/kernel/slab/blkdev_ioc/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/alloc_calls b/test/sys/kernel/slab/blkdev_ioc/alloc_calls new file mode 100644 index 0000000000..fd6a0c2e61 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/alloc_calls @@ -0,0 +1 @@ + 66 alloc_io_context+0x19/0xa0 age=3529/84981/119567 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_ioc/cache_dma b/test/sys/kernel/slab/blkdev_ioc/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/cpu_slabs b/test/sys/kernel/slab/blkdev_ioc/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/ctor b/test/sys/kernel/slab/blkdev_ioc/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu b/test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/free_calls b/test/sys/kernel/slab/blkdev_ioc/free_calls new file mode 100644 index 0000000000..56b9462cdd --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/free_calls @@ -0,0 +1,2 @@ + 11 age=4294787584 pid=0 cpus=0 + 55 put_io_context+0xb2/0xd0 age=35750/89716/115298 pid=145-2828 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_ioc/hwcache_align b/test/sys/kernel/slab/blkdev_ioc/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/object_size b/test/sys/kernel/slab/blkdev_ioc/object_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/object_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/blkdev_ioc/objects b/test/sys/kernel/slab/blkdev_ioc/objects new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/objects @@ -0,0 +1 @@ +100 diff --git a/test/sys/kernel/slab/blkdev_ioc/objects_partial b/test/sys/kernel/slab/blkdev_ioc/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/objs_per_slab b/test/sys/kernel/slab/blkdev_ioc/objs_per_slab new file mode 100644 index 0000000000..209e3ef4b6 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/objs_per_slab @@ -0,0 +1 @@ +20 diff --git a/test/sys/kernel/slab/blkdev_ioc/order b/test/sys/kernel/slab/blkdev_ioc/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/partial b/test/sys/kernel/slab/blkdev_ioc/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/poison b/test/sys/kernel/slab/blkdev_ioc/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_ioc/reclaim_account b/test/sys/kernel/slab/blkdev_ioc/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/red_zone b/test/sys/kernel/slab/blkdev_ioc/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_ioc/sanity_checks b/test/sys/kernel/slab/blkdev_ioc/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_ioc/shrink b/test/sys/kernel/slab/blkdev_ioc/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/blkdev_ioc/slab_size b/test/sys/kernel/slab/blkdev_ioc/slab_size new file mode 100644 index 0000000000..08839f6bb2 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/slab_size @@ -0,0 +1 @@ +200 diff --git a/test/sys/kernel/slab/blkdev_ioc/slabs b/test/sys/kernel/slab/blkdev_ioc/slabs new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/slabs @@ -0,0 +1 @@ +5 diff --git a/test/sys/kernel/slab/blkdev_ioc/store_user b/test/sys/kernel/slab/blkdev_ioc/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_ioc/total_objects b/test/sys/kernel/slab/blkdev_ioc/total_objects new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/total_objects @@ -0,0 +1 @@ +100 diff --git a/test/sys/kernel/slab/blkdev_ioc/trace b/test/sys/kernel/slab/blkdev_ioc/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_ioc/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_ioc/validate b/test/sys/kernel/slab/blkdev_ioc/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/blkdev_queue/aliases b/test/sys/kernel/slab/blkdev_queue/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/align b/test/sys/kernel/slab/blkdev_queue/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/alloc_calls b/test/sys/kernel/slab/blkdev_queue/alloc_calls new file mode 100644 index 0000000000..a1863f08a1 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/alloc_calls @@ -0,0 +1 @@ + 12 blk_alloc_queue_node+0x1c/0xc0 age=38243/105536/119559 pid=1-2761 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_queue/cache_dma b/test/sys/kernel/slab/blkdev_queue/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/cpu_slabs b/test/sys/kernel/slab/blkdev_queue/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/ctor b/test/sys/kernel/slab/blkdev_queue/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/blkdev_queue/destroy_by_rcu b/test/sys/kernel/slab/blkdev_queue/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/free_calls b/test/sys/kernel/slab/blkdev_queue/free_calls new file mode 100644 index 0000000000..69f7a12c6c --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/free_calls @@ -0,0 +1 @@ + 12 age=4294787576 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/blkdev_queue/hwcache_align b/test/sys/kernel/slab/blkdev_queue/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/object_size b/test/sys/kernel/slab/blkdev_queue/object_size new file mode 100644 index 0000000000..e5db7ea053 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/object_size @@ -0,0 +1 @@ +2424 diff --git a/test/sys/kernel/slab/blkdev_queue/objects b/test/sys/kernel/slab/blkdev_queue/objects new file mode 100644 index 0000000000..6f4247a625 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/objects @@ -0,0 +1 @@ +26 diff --git a/test/sys/kernel/slab/blkdev_queue/objects_partial b/test/sys/kernel/slab/blkdev_queue/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/objs_per_slab b/test/sys/kernel/slab/blkdev_queue/objs_per_slab new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/objs_per_slab @@ -0,0 +1 @@ +13 diff --git a/test/sys/kernel/slab/blkdev_queue/order b/test/sys/kernel/slab/blkdev_queue/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/blkdev_queue/partial b/test/sys/kernel/slab/blkdev_queue/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/poison b/test/sys/kernel/slab/blkdev_queue/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_queue/reclaim_account b/test/sys/kernel/slab/blkdev_queue/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/red_zone b/test/sys/kernel/slab/blkdev_queue/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_queue/sanity_checks b/test/sys/kernel/slab/blkdev_queue/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_queue/shrink b/test/sys/kernel/slab/blkdev_queue/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/blkdev_queue/slab_size b/test/sys/kernel/slab/blkdev_queue/slab_size new file mode 100644 index 0000000000..7f5add1bcb --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/slab_size @@ -0,0 +1 @@ +2496 diff --git a/test/sys/kernel/slab/blkdev_queue/slabs b/test/sys/kernel/slab/blkdev_queue/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/blkdev_queue/store_user b/test/sys/kernel/slab/blkdev_queue/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_queue/total_objects b/test/sys/kernel/slab/blkdev_queue/total_objects new file mode 100644 index 0000000000..6f4247a625 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/total_objects @@ -0,0 +1 @@ +26 diff --git a/test/sys/kernel/slab/blkdev_queue/trace b/test/sys/kernel/slab/blkdev_queue/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_queue/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_queue/validate b/test/sys/kernel/slab/blkdev_queue/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/blkdev_requests/aliases b/test/sys/kernel/slab/blkdev_requests/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_requests/align b/test/sys/kernel/slab/blkdev_requests/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_requests/alloc_calls b/test/sys/kernel/slab/blkdev_requests/alloc_calls new file mode 100644 index 0000000000..e38a3f481b --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/alloc_calls @@ -0,0 +1 @@ + 12 mempool_alloc_slab+0x11/0x20 age=38247/92347/119563 pid=1-2761 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_requests/cache_dma b/test/sys/kernel/slab/blkdev_requests/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_requests/cpu_slabs b/test/sys/kernel/slab/blkdev_requests/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_requests/ctor b/test/sys/kernel/slab/blkdev_requests/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/blkdev_requests/destroy_by_rcu b/test/sys/kernel/slab/blkdev_requests/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_requests/free_calls b/test/sys/kernel/slab/blkdev_requests/free_calls new file mode 100644 index 0000000000..e729e88963 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/free_calls @@ -0,0 +1,2 @@ + 7 age=4294787580 pid=0 cpus=0 + 5 mempool_free_slab+0x12/0x20 age=38847/55558/119449 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/blkdev_requests/hwcache_align b/test/sys/kernel/slab/blkdev_requests/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_requests/object_size b/test/sys/kernel/slab/blkdev_requests/object_size new file mode 100644 index 0000000000..873b744bc5 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/object_size @@ -0,0 +1 @@ +304 diff --git a/test/sys/kernel/slab/blkdev_requests/objects b/test/sys/kernel/slab/blkdev_requests/objects new file mode 100644 index 0000000000..9e5feb5256 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/objects @@ -0,0 +1 @@ +46 diff --git a/test/sys/kernel/slab/blkdev_requests/objects_partial b/test/sys/kernel/slab/blkdev_requests/objects_partial new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/objects_partial @@ -0,0 +1 @@ +4 diff --git a/test/sys/kernel/slab/blkdev_requests/objs_per_slab b/test/sys/kernel/slab/blkdev_requests/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/blkdev_requests/order b/test/sys/kernel/slab/blkdev_requests/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_requests/partial b/test/sys/kernel/slab/blkdev_requests/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_requests/poison b/test/sys/kernel/slab/blkdev_requests/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_requests/reclaim_account b/test/sys/kernel/slab/blkdev_requests/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_requests/red_zone b/test/sys/kernel/slab/blkdev_requests/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_requests/sanity_checks b/test/sys/kernel/slab/blkdev_requests/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_requests/shrink b/test/sys/kernel/slab/blkdev_requests/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/blkdev_requests/slab_size b/test/sys/kernel/slab/blkdev_requests/slab_size new file mode 100644 index 0000000000..100000a678 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/slab_size @@ -0,0 +1 @@ +376 diff --git a/test/sys/kernel/slab/blkdev_requests/slabs b/test/sys/kernel/slab/blkdev_requests/slabs new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/slabs @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/blkdev_requests/store_user b/test/sys/kernel/slab/blkdev_requests/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/blkdev_requests/total_objects b/test/sys/kernel/slab/blkdev_requests/total_objects new file mode 100644 index 0000000000..4b9026d8e2 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/total_objects @@ -0,0 +1 @@ +63 diff --git a/test/sys/kernel/slab/blkdev_requests/trace b/test/sys/kernel/slab/blkdev_requests/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/blkdev_requests/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/blkdev_requests/validate b/test/sys/kernel/slab/blkdev_requests/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/bsg_cmd/aliases b/test/sys/kernel/slab/bsg_cmd/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/align b/test/sys/kernel/slab/bsg_cmd/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/alloc_calls b/test/sys/kernel/slab/bsg_cmd/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/bsg_cmd/cache_dma b/test/sys/kernel/slab/bsg_cmd/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/cpu_slabs b/test/sys/kernel/slab/bsg_cmd/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/ctor b/test/sys/kernel/slab/bsg_cmd/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/bsg_cmd/destroy_by_rcu b/test/sys/kernel/slab/bsg_cmd/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/free_calls b/test/sys/kernel/slab/bsg_cmd/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/bsg_cmd/hwcache_align b/test/sys/kernel/slab/bsg_cmd/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/object_size b/test/sys/kernel/slab/bsg_cmd/object_size new file mode 100644 index 0000000000..a1e0432c9a --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/object_size @@ -0,0 +1 @@ +312 diff --git a/test/sys/kernel/slab/bsg_cmd/objects b/test/sys/kernel/slab/bsg_cmd/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/objects_partial b/test/sys/kernel/slab/bsg_cmd/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/objs_per_slab b/test/sys/kernel/slab/bsg_cmd/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/bsg_cmd/order b/test/sys/kernel/slab/bsg_cmd/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bsg_cmd/partial b/test/sys/kernel/slab/bsg_cmd/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/poison b/test/sys/kernel/slab/bsg_cmd/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bsg_cmd/reclaim_account b/test/sys/kernel/slab/bsg_cmd/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/red_zone b/test/sys/kernel/slab/bsg_cmd/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bsg_cmd/sanity_checks b/test/sys/kernel/slab/bsg_cmd/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bsg_cmd/shrink b/test/sys/kernel/slab/bsg_cmd/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/bsg_cmd/slab_size b/test/sys/kernel/slab/bsg_cmd/slab_size new file mode 100644 index 0000000000..e45b99e958 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/slab_size @@ -0,0 +1 @@ +384 diff --git a/test/sys/kernel/slab/bsg_cmd/slabs b/test/sys/kernel/slab/bsg_cmd/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/store_user b/test/sys/kernel/slab/bsg_cmd/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/bsg_cmd/total_objects b/test/sys/kernel/slab/bsg_cmd/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/trace b/test/sys/kernel/slab/bsg_cmd/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/bsg_cmd/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/bsg_cmd/validate b/test/sys/kernel/slab/bsg_cmd/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/buffer_head/aliases b/test/sys/kernel/slab/buffer_head/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/align b/test/sys/kernel/slab/buffer_head/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/alloc_calls b/test/sys/kernel/slab/buffer_head/alloc_calls new file mode 100644 index 0000000000..72f9f686e4 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/alloc_calls @@ -0,0 +1 @@ + 11804 alloc_buffer_head+0x19/0x50 age=1/36440/118734 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/buffer_head/cache_dma b/test/sys/kernel/slab/buffer_head/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/cpu_slabs b/test/sys/kernel/slab/buffer_head/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/ctor b/test/sys/kernel/slab/buffer_head/ctor new file mode 100644 index 0000000000..efb838b249 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/ctor @@ -0,0 +1 @@ +init_buffer_head+0x0/0x20 diff --git a/test/sys/kernel/slab/buffer_head/destroy_by_rcu b/test/sys/kernel/slab/buffer_head/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/free_calls b/test/sys/kernel/slab/buffer_head/free_calls new file mode 100644 index 0000000000..70d1893509 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/free_calls @@ -0,0 +1,2 @@ + 11007 age=4294787773 pid=0 cpus=0 + 798 free_buffer_head+0x20/0x40 age=6772/82539/119636 pid=1-2881 cpus=0-1 diff --git a/test/sys/kernel/slab/buffer_head/hwcache_align b/test/sys/kernel/slab/buffer_head/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/object_size b/test/sys/kernel/slab/buffer_head/object_size new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/object_size @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/buffer_head/objects b/test/sys/kernel/slab/buffer_head/objects new file mode 100644 index 0000000000..9e47d400f2 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/objects @@ -0,0 +1 @@ +11799 diff --git a/test/sys/kernel/slab/buffer_head/objects_partial b/test/sys/kernel/slab/buffer_head/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/objs_per_slab b/test/sys/kernel/slab/buffer_head/objs_per_slab new file mode 100644 index 0000000000..409940768f --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/objs_per_slab @@ -0,0 +1 @@ +23 diff --git a/test/sys/kernel/slab/buffer_head/order b/test/sys/kernel/slab/buffer_head/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/partial b/test/sys/kernel/slab/buffer_head/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/poison b/test/sys/kernel/slab/buffer_head/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/buffer_head/reclaim_account b/test/sys/kernel/slab/buffer_head/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/buffer_head/red_zone b/test/sys/kernel/slab/buffer_head/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/buffer_head/sanity_checks b/test/sys/kernel/slab/buffer_head/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/buffer_head/shrink b/test/sys/kernel/slab/buffer_head/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/buffer_head/slab_size b/test/sys/kernel/slab/buffer_head/slab_size new file mode 100644 index 0000000000..1057e9a273 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/slab_size @@ -0,0 +1 @@ +176 diff --git a/test/sys/kernel/slab/buffer_head/slabs b/test/sys/kernel/slab/buffer_head/slabs new file mode 100644 index 0000000000..31cf34b8d0 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/slabs @@ -0,0 +1 @@ +513 diff --git a/test/sys/kernel/slab/buffer_head/store_user b/test/sys/kernel/slab/buffer_head/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/buffer_head/total_objects b/test/sys/kernel/slab/buffer_head/total_objects new file mode 100644 index 0000000000..9e47d400f2 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/total_objects @@ -0,0 +1 @@ +11799 diff --git a/test/sys/kernel/slab/buffer_head/trace b/test/sys/kernel/slab/buffer_head/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/buffer_head/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/buffer_head/validate b/test/sys/kernel/slab/buffer_head/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/cfq_io_context/aliases b/test/sys/kernel/slab/cfq_io_context/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_io_context/align b/test/sys/kernel/slab/cfq_io_context/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/cfq_io_context/alloc_calls b/test/sys/kernel/slab/cfq_io_context/alloc_calls new file mode 100644 index 0000000000..c556949e6e --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/alloc_calls @@ -0,0 +1 @@ + 68 cfq_set_request+0x13d/0x390 age=3957/85983/119995 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_io_context/cache_dma b/test/sys/kernel/slab/cfq_io_context/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_io_context/cpu_slabs b/test/sys/kernel/slab/cfq_io_context/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_io_context/ctor b/test/sys/kernel/slab/cfq_io_context/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/cfq_io_context/destroy_by_rcu b/test/sys/kernel/slab/cfq_io_context/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_io_context/free_calls b/test/sys/kernel/slab/cfq_io_context/free_calls new file mode 100644 index 0000000000..36ef1dc75d --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/free_calls @@ -0,0 +1,2 @@ + 12 age=4294788012 pid=0 cpus=0 + 56 cfq_cic_free_rcu+0x21/0xc0 age=21849/89053/116437 pid=0-2655 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_io_context/hwcache_align b/test/sys/kernel/slab/cfq_io_context/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_io_context/object_size b/test/sys/kernel/slab/cfq_io_context/object_size new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/object_size @@ -0,0 +1 @@ +168 diff --git a/test/sys/kernel/slab/cfq_io_context/objects b/test/sys/kernel/slab/cfq_io_context/objects new file mode 100644 index 0000000000..76a8b2b703 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/objects @@ -0,0 +1 @@ +83 diff --git a/test/sys/kernel/slab/cfq_io_context/objects_partial b/test/sys/kernel/slab/cfq_io_context/objects_partial new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/objects_partial @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/cfq_io_context/objs_per_slab b/test/sys/kernel/slab/cfq_io_context/objs_per_slab new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/objs_per_slab @@ -0,0 +1 @@ +17 diff --git a/test/sys/kernel/slab/cfq_io_context/order b/test/sys/kernel/slab/cfq_io_context/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_io_context/partial b/test/sys/kernel/slab/cfq_io_context/partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/cfq_io_context/poison b/test/sys/kernel/slab/cfq_io_context/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/cfq_io_context/reclaim_account b/test/sys/kernel/slab/cfq_io_context/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_io_context/red_zone b/test/sys/kernel/slab/cfq_io_context/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/cfq_io_context/sanity_checks b/test/sys/kernel/slab/cfq_io_context/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/cfq_io_context/shrink b/test/sys/kernel/slab/cfq_io_context/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/cfq_io_context/slab_size b/test/sys/kernel/slab/cfq_io_context/slab_size new file mode 100644 index 0000000000..eb08bc0b0b --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/slab_size @@ -0,0 +1 @@ +240 diff --git a/test/sys/kernel/slab/cfq_io_context/slabs b/test/sys/kernel/slab/cfq_io_context/slabs new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/slabs @@ -0,0 +1 @@ +5 diff --git a/test/sys/kernel/slab/cfq_io_context/store_user b/test/sys/kernel/slab/cfq_io_context/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/cfq_io_context/total_objects b/test/sys/kernel/slab/cfq_io_context/total_objects new file mode 100644 index 0000000000..a862eb8444 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/total_objects @@ -0,0 +1 @@ +85 diff --git a/test/sys/kernel/slab/cfq_io_context/trace b/test/sys/kernel/slab/cfq_io_context/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_io_context/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_io_context/validate b/test/sys/kernel/slab/cfq_io_context/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/cfq_queue/aliases b/test/sys/kernel/slab/cfq_queue/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_queue/align b/test/sys/kernel/slab/cfq_queue/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/cfq_queue/alloc_calls b/test/sys/kernel/slab/cfq_queue/alloc_calls new file mode 100644 index 0000000000..c408c2bca0 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/alloc_calls @@ -0,0 +1 @@ + 67 cfq_get_queue+0xc6/0x220 age=3952/87492/119990 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_queue/cache_dma b/test/sys/kernel/slab/cfq_queue/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_queue/cpu_slabs b/test/sys/kernel/slab/cfq_queue/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_queue/ctor b/test/sys/kernel/slab/cfq_queue/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/cfq_queue/destroy_by_rcu b/test/sys/kernel/slab/cfq_queue/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_queue/free_calls b/test/sys/kernel/slab/cfq_queue/free_calls new file mode 100644 index 0000000000..b16e79de8d --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/free_calls @@ -0,0 +1,2 @@ + 13 age=4294788008 pid=0 cpus=0 + 54 cfq_put_queue+0x6f/0xe0 age=36174/91332/115659 pid=163-2828 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_queue/hwcache_align b/test/sys/kernel/slab/cfq_queue/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_queue/object_size b/test/sys/kernel/slab/cfq_queue/object_size new file mode 100644 index 0000000000..7296f257eb --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/object_size @@ -0,0 +1 @@ +136 diff --git a/test/sys/kernel/slab/cfq_queue/objects b/test/sys/kernel/slab/cfq_queue/objects new file mode 100644 index 0000000000..49541f7210 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/objects @@ -0,0 +1 @@ +94 diff --git a/test/sys/kernel/slab/cfq_queue/objects_partial b/test/sys/kernel/slab/cfq_queue/objects_partial new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/objects_partial @@ -0,0 +1 @@ +18 diff --git a/test/sys/kernel/slab/cfq_queue/objs_per_slab b/test/sys/kernel/slab/cfq_queue/objs_per_slab new file mode 100644 index 0000000000..d6b24041cf --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/objs_per_slab @@ -0,0 +1 @@ +19 diff --git a/test/sys/kernel/slab/cfq_queue/order b/test/sys/kernel/slab/cfq_queue/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_queue/partial b/test/sys/kernel/slab/cfq_queue/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/cfq_queue/poison b/test/sys/kernel/slab/cfq_queue/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/cfq_queue/reclaim_account b/test/sys/kernel/slab/cfq_queue/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_queue/red_zone b/test/sys/kernel/slab/cfq_queue/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/cfq_queue/sanity_checks b/test/sys/kernel/slab/cfq_queue/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/cfq_queue/shrink b/test/sys/kernel/slab/cfq_queue/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/cfq_queue/slab_size b/test/sys/kernel/slab/cfq_queue/slab_size new file mode 100644 index 0000000000..7d645f5893 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/slab_size @@ -0,0 +1 @@ +208 diff --git a/test/sys/kernel/slab/cfq_queue/slabs b/test/sys/kernel/slab/cfq_queue/slabs new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/slabs @@ -0,0 +1 @@ +5 diff --git a/test/sys/kernel/slab/cfq_queue/store_user b/test/sys/kernel/slab/cfq_queue/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/cfq_queue/total_objects b/test/sys/kernel/slab/cfq_queue/total_objects new file mode 100644 index 0000000000..5595fa46c0 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/total_objects @@ -0,0 +1 @@ +95 diff --git a/test/sys/kernel/slab/cfq_queue/trace b/test/sys/kernel/slab/cfq_queue/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/cfq_queue/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/cfq_queue/validate b/test/sys/kernel/slab/cfq_queue/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dentry/aliases b/test/sys/kernel/slab/dentry/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dentry/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dentry/align b/test/sys/kernel/slab/dentry/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/dentry/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/dentry/alloc_calls b/test/sys/kernel/slab/dentry/alloc_calls new file mode 100644 index 0000000000..9555047092 --- /dev/null +++ b/test/sys/kernel/slab/dentry/alloc_calls @@ -0,0 +1 @@ + 27782 d_alloc+0x22/0x1f0 age=0/48123/120447 pid=0-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/dentry/cache_dma b/test/sys/kernel/slab/dentry/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dentry/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dentry/cpu_slabs b/test/sys/kernel/slab/dentry/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dentry/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dentry/ctor b/test/sys/kernel/slab/dentry/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dentry/destroy_by_rcu b/test/sys/kernel/slab/dentry/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dentry/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dentry/free_calls b/test/sys/kernel/slab/dentry/free_calls new file mode 100644 index 0000000000..3a05c4f2b5 --- /dev/null +++ b/test/sys/kernel/slab/dentry/free_calls @@ -0,0 +1,3 @@ + 23030 age=4294787749 pid=0 cpus=0 + 1432 d_free+0x6c/0x80 age=340/83348/117516 pid=1-2890 cpus=0-1 + 3322 d_callback+0x31/0x40 age=3531/95345/120163 pid=0-2878 cpus=0-1 diff --git a/test/sys/kernel/slab/dentry/hwcache_align b/test/sys/kernel/slab/dentry/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dentry/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dentry/object_size b/test/sys/kernel/slab/dentry/object_size new file mode 100644 index 0000000000..9183bf03fc --- /dev/null +++ b/test/sys/kernel/slab/dentry/object_size @@ -0,0 +1 @@ +256 diff --git a/test/sys/kernel/slab/dentry/objects b/test/sys/kernel/slab/dentry/objects new file mode 100644 index 0000000000..c272137739 --- /dev/null +++ b/test/sys/kernel/slab/dentry/objects @@ -0,0 +1 @@ +27756 diff --git a/test/sys/kernel/slab/dentry/objects_partial b/test/sys/kernel/slab/dentry/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dentry/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dentry/objs_per_slab b/test/sys/kernel/slab/dentry/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/dentry/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/dentry/order b/test/sys/kernel/slab/dentry/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dentry/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dentry/partial b/test/sys/kernel/slab/dentry/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dentry/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dentry/poison b/test/sys/kernel/slab/dentry/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dentry/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dentry/reclaim_account b/test/sys/kernel/slab/dentry/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dentry/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dentry/red_zone b/test/sys/kernel/slab/dentry/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dentry/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dentry/sanity_checks b/test/sys/kernel/slab/dentry/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dentry/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dentry/shrink b/test/sys/kernel/slab/dentry/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dentry/slab_size b/test/sys/kernel/slab/dentry/slab_size new file mode 100644 index 0000000000..86619979c3 --- /dev/null +++ b/test/sys/kernel/slab/dentry/slab_size @@ -0,0 +1 @@ +328 diff --git a/test/sys/kernel/slab/dentry/slabs b/test/sys/kernel/slab/dentry/slabs new file mode 100644 index 0000000000..2612554b2d --- /dev/null +++ b/test/sys/kernel/slab/dentry/slabs @@ -0,0 +1 @@ +2313 diff --git a/test/sys/kernel/slab/dentry/store_user b/test/sys/kernel/slab/dentry/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dentry/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dentry/total_objects b/test/sys/kernel/slab/dentry/total_objects new file mode 100644 index 0000000000..c272137739 --- /dev/null +++ b/test/sys/kernel/slab/dentry/total_objects @@ -0,0 +1 @@ +27756 diff --git a/test/sys/kernel/slab/dentry/trace b/test/sys/kernel/slab/dentry/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dentry/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dentry/validate b/test/sys/kernel/slab/dentry/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dm_io/aliases b/test/sys/kernel/slab/dm_io/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/align b/test/sys/kernel/slab/dm_io/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/dm_io/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/dm_io/alloc_calls b/test/sys/kernel/slab/dm_io/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/dm_io/cache_dma b/test/sys/kernel/slab/dm_io/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/cpu_slabs b/test/sys/kernel/slab/dm_io/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/ctor b/test/sys/kernel/slab/dm_io/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dm_io/destroy_by_rcu b/test/sys/kernel/slab/dm_io/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/free_calls b/test/sys/kernel/slab/dm_io/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/dm_io/hwcache_align b/test/sys/kernel/slab/dm_io/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/object_size b/test/sys/kernel/slab/dm_io/object_size new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/dm_io/object_size @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/dm_io/objects b/test/sys/kernel/slab/dm_io/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/objects_partial b/test/sys/kernel/slab/dm_io/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/objs_per_slab b/test/sys/kernel/slab/dm_io/objs_per_slab new file mode 100644 index 0000000000..a2720097dc --- /dev/null +++ b/test/sys/kernel/slab/dm_io/objs_per_slab @@ -0,0 +1 @@ +39 diff --git a/test/sys/kernel/slab/dm_io/order b/test/sys/kernel/slab/dm_io/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/partial b/test/sys/kernel/slab/dm_io/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/poison b/test/sys/kernel/slab/dm_io/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dm_io/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dm_io/reclaim_account b/test/sys/kernel/slab/dm_io/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/red_zone b/test/sys/kernel/slab/dm_io/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dm_io/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dm_io/sanity_checks b/test/sys/kernel/slab/dm_io/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dm_io/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dm_io/shrink b/test/sys/kernel/slab/dm_io/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dm_io/slab_size b/test/sys/kernel/slab/dm_io/slab_size new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/slab_size @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/dm_io/slabs b/test/sys/kernel/slab/dm_io/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/store_user b/test/sys/kernel/slab/dm_io/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dm_io/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dm_io/total_objects b/test/sys/kernel/slab/dm_io/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/trace b/test/sys/kernel/slab/dm_io/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_io/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_io/validate b/test/sys/kernel/slab/dm_io/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dm_target_io/aliases b/test/sys/kernel/slab/dm_target_io/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/align b/test/sys/kernel/slab/dm_target_io/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/dm_target_io/alloc_calls b/test/sys/kernel/slab/dm_target_io/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/dm_target_io/cache_dma b/test/sys/kernel/slab/dm_target_io/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/cpu_slabs b/test/sys/kernel/slab/dm_target_io/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/ctor b/test/sys/kernel/slab/dm_target_io/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dm_target_io/destroy_by_rcu b/test/sys/kernel/slab/dm_target_io/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/free_calls b/test/sys/kernel/slab/dm_target_io/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/dm_target_io/hwcache_align b/test/sys/kernel/slab/dm_target_io/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/object_size b/test/sys/kernel/slab/dm_target_io/object_size new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/object_size @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/dm_target_io/objects b/test/sys/kernel/slab/dm_target_io/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/objects_partial b/test/sys/kernel/slab/dm_target_io/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/objs_per_slab b/test/sys/kernel/slab/dm_target_io/objs_per_slab new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/objs_per_slab @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/dm_target_io/order b/test/sys/kernel/slab/dm_target_io/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/partial b/test/sys/kernel/slab/dm_target_io/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/poison b/test/sys/kernel/slab/dm_target_io/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dm_target_io/reclaim_account b/test/sys/kernel/slab/dm_target_io/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/red_zone b/test/sys/kernel/slab/dm_target_io/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dm_target_io/sanity_checks b/test/sys/kernel/slab/dm_target_io/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dm_target_io/shrink b/test/sys/kernel/slab/dm_target_io/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dm_target_io/slab_size b/test/sys/kernel/slab/dm_target_io/slab_size new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/slab_size @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/dm_target_io/slabs b/test/sys/kernel/slab/dm_target_io/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/store_user b/test/sys/kernel/slab/dm_target_io/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dm_target_io/total_objects b/test/sys/kernel/slab/dm_target_io/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/trace b/test/sys/kernel/slab/dm_target_io/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dm_target_io/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dm_target_io/validate b/test/sys/kernel/slab/dm_target_io/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dnotify_cache/aliases b/test/sys/kernel/slab/dnotify_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/align b/test/sys/kernel/slab/dnotify_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/alloc_calls b/test/sys/kernel/slab/dnotify_cache/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/dnotify_cache/cache_dma b/test/sys/kernel/slab/dnotify_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/cpu_slabs b/test/sys/kernel/slab/dnotify_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/ctor b/test/sys/kernel/slab/dnotify_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dnotify_cache/destroy_by_rcu b/test/sys/kernel/slab/dnotify_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/free_calls b/test/sys/kernel/slab/dnotify_cache/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/dnotify_cache/hwcache_align b/test/sys/kernel/slab/dnotify_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/object_size b/test/sys/kernel/slab/dnotify_cache/object_size new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/object_size @@ -0,0 +1 @@ +40 diff --git a/test/sys/kernel/slab/dnotify_cache/objects b/test/sys/kernel/slab/dnotify_cache/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/objects_partial b/test/sys/kernel/slab/dnotify_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/objs_per_slab b/test/sys/kernel/slab/dnotify_cache/objs_per_slab new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/objs_per_slab @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/dnotify_cache/order b/test/sys/kernel/slab/dnotify_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/partial b/test/sys/kernel/slab/dnotify_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/poison b/test/sys/kernel/slab/dnotify_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dnotify_cache/reclaim_account b/test/sys/kernel/slab/dnotify_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/red_zone b/test/sys/kernel/slab/dnotify_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dnotify_cache/sanity_checks b/test/sys/kernel/slab/dnotify_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dnotify_cache/shrink b/test/sys/kernel/slab/dnotify_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/dnotify_cache/slab_size b/test/sys/kernel/slab/dnotify_cache/slab_size new file mode 100644 index 0000000000..194b81caae --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/slab_size @@ -0,0 +1 @@ +112 diff --git a/test/sys/kernel/slab/dnotify_cache/slabs b/test/sys/kernel/slab/dnotify_cache/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/store_user b/test/sys/kernel/slab/dnotify_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/dnotify_cache/total_objects b/test/sys/kernel/slab/dnotify_cache/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/trace b/test/sys/kernel/slab/dnotify_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/dnotify_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/dnotify_cache/validate b/test/sys/kernel/slab/dnotify_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/eventpoll_epi/aliases b/test/sys/kernel/slab/eventpoll_epi/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/align b/test/sys/kernel/slab/eventpoll_epi/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/alloc_calls b/test/sys/kernel/slab/eventpoll_epi/alloc_calls new file mode 100644 index 0000000000..7dc027ad3b --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/alloc_calls @@ -0,0 +1 @@ + 66 sys_epoll_ctl+0x1a4/0x4d0 age=80361/96569/96986 pid=1690-1920 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_epi/cache_dma b/test/sys/kernel/slab/eventpoll_epi/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/cpu_slabs b/test/sys/kernel/slab/eventpoll_epi/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/ctor b/test/sys/kernel/slab/eventpoll_epi/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu b/test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/free_calls b/test/sys/kernel/slab/eventpoll_epi/free_calls new file mode 100644 index 0000000000..853e487f27 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/free_calls @@ -0,0 +1,2 @@ + 63 age=4294787533 pid=0 cpus=0 + 3 ep_remove+0xae/0xc0 age=80363/91441/96980 pid=1690-2073 cpus=0 diff --git a/test/sys/kernel/slab/eventpoll_epi/hwcache_align b/test/sys/kernel/slab/eventpoll_epi/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/eventpoll_epi/object_size b/test/sys/kernel/slab/eventpoll_epi/object_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/object_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/eventpoll_epi/objects b/test/sys/kernel/slab/eventpoll_epi/objects new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/objects @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/eventpoll_epi/objects_partial b/test/sys/kernel/slab/eventpoll_epi/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/objs_per_slab b/test/sys/kernel/slab/eventpoll_epi/objs_per_slab new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/objs_per_slab @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/eventpoll_epi/order b/test/sys/kernel/slab/eventpoll_epi/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/partial b/test/sys/kernel/slab/eventpoll_epi/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/poison b/test/sys/kernel/slab/eventpoll_epi/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/eventpoll_epi/reclaim_account b/test/sys/kernel/slab/eventpoll_epi/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/red_zone b/test/sys/kernel/slab/eventpoll_epi/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/eventpoll_epi/sanity_checks b/test/sys/kernel/slab/eventpoll_epi/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/eventpoll_epi/shrink b/test/sys/kernel/slab/eventpoll_epi/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/eventpoll_epi/slab_size b/test/sys/kernel/slab/eventpoll_epi/slab_size new file mode 100644 index 0000000000..9183bf03fc --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/slab_size @@ -0,0 +1 @@ +256 diff --git a/test/sys/kernel/slab/eventpoll_epi/slabs b/test/sys/kernel/slab/eventpoll_epi/slabs new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/slabs @@ -0,0 +1 @@ +6 diff --git a/test/sys/kernel/slab/eventpoll_epi/store_user b/test/sys/kernel/slab/eventpoll_epi/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/eventpoll_epi/total_objects b/test/sys/kernel/slab/eventpoll_epi/total_objects new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/total_objects @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/eventpoll_epi/trace b/test/sys/kernel/slab/eventpoll_epi/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_epi/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_epi/validate b/test/sys/kernel/slab/eventpoll_epi/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/eventpoll_pwq/aliases b/test/sys/kernel/slab/eventpoll_pwq/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/align b/test/sys/kernel/slab/eventpoll_pwq/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/alloc_calls b/test/sys/kernel/slab/eventpoll_pwq/alloc_calls new file mode 100644 index 0000000000..e276977cef --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/alloc_calls @@ -0,0 +1 @@ + 66 ep_ptable_queue_proc+0x35/0xa0 age=80357/96565/96982 pid=1690-1920 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/cache_dma b/test/sys/kernel/slab/eventpoll_pwq/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/cpu_slabs b/test/sys/kernel/slab/eventpoll_pwq/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/ctor b/test/sys/kernel/slab/eventpoll_pwq/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu b/test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/free_calls b/test/sys/kernel/slab/eventpoll_pwq/free_calls new file mode 100644 index 0000000000..7fa89ca7eb --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/free_calls @@ -0,0 +1,2 @@ + 63 age=4294787529 pid=0 cpus=0 + 3 ep_unregister_pollwait+0x61/0x80 age=80359/91437/96976 pid=1690-2073 cpus=0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/hwcache_align b/test/sys/kernel/slab/eventpoll_pwq/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/object_size b/test/sys/kernel/slab/eventpoll_pwq/object_size new file mode 100644 index 0000000000..ea70ce0134 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/object_size @@ -0,0 +1 @@ +72 diff --git a/test/sys/kernel/slab/eventpoll_pwq/objects b/test/sys/kernel/slab/eventpoll_pwq/objects new file mode 100644 index 0000000000..194b81caae --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/objects @@ -0,0 +1 @@ +112 diff --git a/test/sys/kernel/slab/eventpoll_pwq/objects_partial b/test/sys/kernel/slab/eventpoll_pwq/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/objs_per_slab b/test/sys/kernel/slab/eventpoll_pwq/objs_per_slab new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/objs_per_slab @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/eventpoll_pwq/order b/test/sys/kernel/slab/eventpoll_pwq/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/partial b/test/sys/kernel/slab/eventpoll_pwq/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/poison b/test/sys/kernel/slab/eventpoll_pwq/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/reclaim_account b/test/sys/kernel/slab/eventpoll_pwq/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/red_zone b/test/sys/kernel/slab/eventpoll_pwq/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/sanity_checks b/test/sys/kernel/slab/eventpoll_pwq/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/shrink b/test/sys/kernel/slab/eventpoll_pwq/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/eventpoll_pwq/slab_size b/test/sys/kernel/slab/eventpoll_pwq/slab_size new file mode 100644 index 0000000000..a29644e57e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/slab_size @@ -0,0 +1 @@ +144 diff --git a/test/sys/kernel/slab/eventpoll_pwq/slabs b/test/sys/kernel/slab/eventpoll_pwq/slabs new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/slabs @@ -0,0 +1 @@ +4 diff --git a/test/sys/kernel/slab/eventpoll_pwq/store_user b/test/sys/kernel/slab/eventpoll_pwq/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/total_objects b/test/sys/kernel/slab/eventpoll_pwq/total_objects new file mode 100644 index 0000000000..194b81caae --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/total_objects @@ -0,0 +1 @@ +112 diff --git a/test/sys/kernel/slab/eventpoll_pwq/trace b/test/sys/kernel/slab/eventpoll_pwq/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/eventpoll_pwq/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/validate b/test/sys/kernel/slab/eventpoll_pwq/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ext2_inode_cache/aliases b/test/sys/kernel/slab/ext2_inode_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/align b/test/sys/kernel/slab/ext2_inode_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/alloc_calls b/test/sys/kernel/slab/ext2_inode_cache/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/ext2_inode_cache/cache_dma b/test/sys/kernel/slab/ext2_inode_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/cpu_slabs b/test/sys/kernel/slab/ext2_inode_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/ctor b/test/sys/kernel/slab/ext2_inode_cache/ctor new file mode 100644 index 0000000000..102ae87d64 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x60 diff --git a/test/sys/kernel/slab/ext2_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/ext2_inode_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/free_calls b/test/sys/kernel/slab/ext2_inode_cache/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/ext2_inode_cache/hwcache_align b/test/sys/kernel/slab/ext2_inode_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/object_size b/test/sys/kernel/slab/ext2_inode_cache/object_size new file mode 100644 index 0000000000..6ee29474b0 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/object_size @@ -0,0 +1 @@ +1384 diff --git a/test/sys/kernel/slab/ext2_inode_cache/objects b/test/sys/kernel/slab/ext2_inode_cache/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/objects_partial b/test/sys/kernel/slab/ext2_inode_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/objs_per_slab b/test/sys/kernel/slab/ext2_inode_cache/objs_per_slab new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/objs_per_slab @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/ext2_inode_cache/order b/test/sys/kernel/slab/ext2_inode_cache/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/ext2_inode_cache/partial b/test/sys/kernel/slab/ext2_inode_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/poison b/test/sys/kernel/slab/ext2_inode_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/reclaim_account b/test/sys/kernel/slab/ext2_inode_cache/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/red_zone b/test/sys/kernel/slab/ext2_inode_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/sanity_checks b/test/sys/kernel/slab/ext2_inode_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/shrink b/test/sys/kernel/slab/ext2_inode_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ext2_inode_cache/slab_size b/test/sys/kernel/slab/ext2_inode_cache/slab_size new file mode 100644 index 0000000000..471d5488d7 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/slab_size @@ -0,0 +1 @@ +1456 diff --git a/test/sys/kernel/slab/ext2_inode_cache/slabs b/test/sys/kernel/slab/ext2_inode_cache/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/store_user b/test/sys/kernel/slab/ext2_inode_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/total_objects b/test/sys/kernel/slab/ext2_inode_cache/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/trace b/test/sys/kernel/slab/ext2_inode_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext2_inode_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/validate b/test/sys/kernel/slab/ext2_inode_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ext3_inode_cache/aliases b/test/sys/kernel/slab/ext3_inode_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/align b/test/sys/kernel/slab/ext3_inode_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/alloc_calls b/test/sys/kernel/slab/ext3_inode_cache/alloc_calls new file mode 100644 index 0000000000..7ea0125e5a --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/alloc_calls @@ -0,0 +1 @@ + 14652 ext3_alloc_inode+0x15/0x60 age=0/35893/118909 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/cache_dma b/test/sys/kernel/slab/ext3_inode_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/cpu_slabs b/test/sys/kernel/slab/ext3_inode_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/ctor b/test/sys/kernel/slab/ext3_inode_cache/ctor new file mode 100644 index 0000000000..de01745ee3 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x70 diff --git a/test/sys/kernel/slab/ext3_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/ext3_inode_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/free_calls b/test/sys/kernel/slab/ext3_inode_cache/free_calls new file mode 100644 index 0000000000..f288e54d66 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/free_calls @@ -0,0 +1,2 @@ + 14467 age=4294787949 pid=0 cpus=0 + 186 ext3_destroy_inode+0x2f/0x90 age=12685/73602/112381 pid=879-2881 cpus=0-1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/hwcache_align b/test/sys/kernel/slab/ext3_inode_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/object_size b/test/sys/kernel/slab/ext3_inode_cache/object_size new file mode 100644 index 0000000000..bfc0bcc570 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/object_size @@ -0,0 +1 @@ +1472 diff --git a/test/sys/kernel/slab/ext3_inode_cache/objects b/test/sys/kernel/slab/ext3_inode_cache/objects new file mode 100644 index 0000000000..632ca0b2c1 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/objects @@ -0,0 +1 @@ +14658 diff --git a/test/sys/kernel/slab/ext3_inode_cache/objects_partial b/test/sys/kernel/slab/ext3_inode_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/objs_per_slab b/test/sys/kernel/slab/ext3_inode_cache/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/ext3_inode_cache/order b/test/sys/kernel/slab/ext3_inode_cache/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/ext3_inode_cache/partial b/test/sys/kernel/slab/ext3_inode_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/poison b/test/sys/kernel/slab/ext3_inode_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/reclaim_account b/test/sys/kernel/slab/ext3_inode_cache/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/red_zone b/test/sys/kernel/slab/ext3_inode_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/sanity_checks b/test/sys/kernel/slab/ext3_inode_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/shrink b/test/sys/kernel/slab/ext3_inode_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ext3_inode_cache/slab_size b/test/sys/kernel/slab/ext3_inode_cache/slab_size new file mode 100644 index 0000000000..df9d39688a --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/slab_size @@ -0,0 +1 @@ +1544 diff --git a/test/sys/kernel/slab/ext3_inode_cache/slabs b/test/sys/kernel/slab/ext3_inode_cache/slabs new file mode 100644 index 0000000000..679fa6b429 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/slabs @@ -0,0 +1 @@ +698 diff --git a/test/sys/kernel/slab/ext3_inode_cache/store_user b/test/sys/kernel/slab/ext3_inode_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/total_objects b/test/sys/kernel/slab/ext3_inode_cache/total_objects new file mode 100644 index 0000000000..632ca0b2c1 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/total_objects @@ -0,0 +1 @@ +14658 diff --git a/test/sys/kernel/slab/ext3_inode_cache/trace b/test/sys/kernel/slab/ext3_inode_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_inode_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/validate b/test/sys/kernel/slab/ext3_inode_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ext3_xattr/aliases b/test/sys/kernel/slab/ext3_xattr/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/align b/test/sys/kernel/slab/ext3_xattr/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/alloc_calls b/test/sys/kernel/slab/ext3_xattr/alloc_calls new file mode 100644 index 0000000000..3bb52320b7 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/alloc_calls @@ -0,0 +1 @@ + 3 mb_cache_entry_alloc+0x15/0x50 age=21933/47533/60338 pid=2676-2692 cpus=0 diff --git a/test/sys/kernel/slab/ext3_xattr/cache_dma b/test/sys/kernel/slab/ext3_xattr/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/cpu_slabs b/test/sys/kernel/slab/ext3_xattr/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/ctor b/test/sys/kernel/slab/ext3_xattr/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ext3_xattr/destroy_by_rcu b/test/sys/kernel/slab/ext3_xattr/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/free_calls b/test/sys/kernel/slab/ext3_xattr/free_calls new file mode 100644 index 0000000000..be6334007a --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/free_calls @@ -0,0 +1 @@ + 3 age=4294787942 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ext3_xattr/hwcache_align b/test/sys/kernel/slab/ext3_xattr/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/object_size b/test/sys/kernel/slab/ext3_xattr/object_size new file mode 100644 index 0000000000..d22307c427 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/object_size @@ -0,0 +1 @@ +88 diff --git a/test/sys/kernel/slab/ext3_xattr/objects b/test/sys/kernel/slab/ext3_xattr/objects new file mode 100644 index 0000000000..7273c0fa8c --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/objects @@ -0,0 +1 @@ +25 diff --git a/test/sys/kernel/slab/ext3_xattr/objects_partial b/test/sys/kernel/slab/ext3_xattr/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/objs_per_slab b/test/sys/kernel/slab/ext3_xattr/objs_per_slab new file mode 100644 index 0000000000..7273c0fa8c --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/objs_per_slab @@ -0,0 +1 @@ +25 diff --git a/test/sys/kernel/slab/ext3_xattr/order b/test/sys/kernel/slab/ext3_xattr/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/partial b/test/sys/kernel/slab/ext3_xattr/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/poison b/test/sys/kernel/slab/ext3_xattr/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_xattr/reclaim_account b/test/sys/kernel/slab/ext3_xattr/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_xattr/red_zone b/test/sys/kernel/slab/ext3_xattr/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_xattr/sanity_checks b/test/sys/kernel/slab/ext3_xattr/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_xattr/shrink b/test/sys/kernel/slab/ext3_xattr/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ext3_xattr/slab_size b/test/sys/kernel/slab/ext3_xattr/slab_size new file mode 100644 index 0000000000..a76256037d --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/slab_size @@ -0,0 +1 @@ +160 diff --git a/test/sys/kernel/slab/ext3_xattr/slabs b/test/sys/kernel/slab/ext3_xattr/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_xattr/store_user b/test/sys/kernel/slab/ext3_xattr/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ext3_xattr/total_objects b/test/sys/kernel/slab/ext3_xattr/total_objects new file mode 100644 index 0000000000..7273c0fa8c --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/total_objects @@ -0,0 +1 @@ +25 diff --git a/test/sys/kernel/slab/ext3_xattr/trace b/test/sys/kernel/slab/ext3_xattr/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ext3_xattr/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ext3_xattr/validate b/test/sys/kernel/slab/ext3_xattr/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fasync_cache/aliases b/test/sys/kernel/slab/fasync_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/align b/test/sys/kernel/slab/fasync_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/alloc_calls b/test/sys/kernel/slab/fasync_cache/alloc_calls new file mode 100644 index 0000000000..68aea47fcc --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/alloc_calls @@ -0,0 +1 @@ + 1 fasync_helper+0x115/0x130 age=94529 pid=1738 cpus=0 diff --git a/test/sys/kernel/slab/fasync_cache/cache_dma b/test/sys/kernel/slab/fasync_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/cpu_slabs b/test/sys/kernel/slab/fasync_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/ctor b/test/sys/kernel/slab/fasync_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fasync_cache/destroy_by_rcu b/test/sys/kernel/slab/fasync_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/free_calls b/test/sys/kernel/slab/fasync_cache/free_calls new file mode 100644 index 0000000000..e23a1793aa --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/free_calls @@ -0,0 +1 @@ + 1 age=4294787918 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fasync_cache/hwcache_align b/test/sys/kernel/slab/fasync_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/object_size b/test/sys/kernel/slab/fasync_cache/object_size new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/object_size @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/fasync_cache/objects b/test/sys/kernel/slab/fasync_cache/objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/fasync_cache/objects_partial b/test/sys/kernel/slab/fasync_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/objs_per_slab b/test/sys/kernel/slab/fasync_cache/objs_per_slab new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/objs_per_slab @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/fasync_cache/order b/test/sys/kernel/slab/fasync_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/partial b/test/sys/kernel/slab/fasync_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/poison b/test/sys/kernel/slab/fasync_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fasync_cache/reclaim_account b/test/sys/kernel/slab/fasync_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/red_zone b/test/sys/kernel/slab/fasync_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fasync_cache/sanity_checks b/test/sys/kernel/slab/fasync_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fasync_cache/shrink b/test/sys/kernel/slab/fasync_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fasync_cache/slab_size b/test/sys/kernel/slab/fasync_cache/slab_size new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/slab_size @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/fasync_cache/slabs b/test/sys/kernel/slab/fasync_cache/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fasync_cache/store_user b/test/sys/kernel/slab/fasync_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fasync_cache/total_objects b/test/sys/kernel/slab/fasync_cache/total_objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/total_objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/fasync_cache/trace b/test/sys/kernel/slab/fasync_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fasync_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fasync_cache/validate b/test/sys/kernel/slab/fasync_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fat_cache/aliases b/test/sys/kernel/slab/fat_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/align b/test/sys/kernel/slab/fat_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/alloc_calls b/test/sys/kernel/slab/fat_cache/alloc_calls new file mode 100644 index 0000000000..bd236f66e4 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/alloc_calls @@ -0,0 +1 @@ + 14 fat_cache_add+0x11f/0x1c0 age=37390/37407/37435 pid=2818 cpus=0-1 diff --git a/test/sys/kernel/slab/fat_cache/cache_dma b/test/sys/kernel/slab/fat_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/cpu_slabs b/test/sys/kernel/slab/fat_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/ctor b/test/sys/kernel/slab/fat_cache/ctor new file mode 100644 index 0000000000..2940046f62 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/fat_cache/destroy_by_rcu b/test/sys/kernel/slab/fat_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/free_calls b/test/sys/kernel/slab/fat_cache/free_calls new file mode 100644 index 0000000000..95ba3634ba --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/free_calls @@ -0,0 +1 @@ + 14 age=4294787992 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fat_cache/hwcache_align b/test/sys/kernel/slab/fat_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/object_size b/test/sys/kernel/slab/fat_cache/object_size new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/object_size @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/fat_cache/objects b/test/sys/kernel/slab/fat_cache/objects new file mode 100644 index 0000000000..8e14edce9c --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/objects @@ -0,0 +1 @@ +78 diff --git a/test/sys/kernel/slab/fat_cache/objects_partial b/test/sys/kernel/slab/fat_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/objs_per_slab b/test/sys/kernel/slab/fat_cache/objs_per_slab new file mode 100644 index 0000000000..a2720097dc --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/objs_per_slab @@ -0,0 +1 @@ +39 diff --git a/test/sys/kernel/slab/fat_cache/order b/test/sys/kernel/slab/fat_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/partial b/test/sys/kernel/slab/fat_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/poison b/test/sys/kernel/slab/fat_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_cache/reclaim_account b/test/sys/kernel/slab/fat_cache/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_cache/red_zone b/test/sys/kernel/slab/fat_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_cache/sanity_checks b/test/sys/kernel/slab/fat_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_cache/shrink b/test/sys/kernel/slab/fat_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fat_cache/slab_size b/test/sys/kernel/slab/fat_cache/slab_size new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/slab_size @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/fat_cache/slabs b/test/sys/kernel/slab/fat_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/fat_cache/store_user b/test/sys/kernel/slab/fat_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_cache/total_objects b/test/sys/kernel/slab/fat_cache/total_objects new file mode 100644 index 0000000000..8e14edce9c --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/total_objects @@ -0,0 +1 @@ +78 diff --git a/test/sys/kernel/slab/fat_cache/trace b/test/sys/kernel/slab/fat_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_cache/validate b/test/sys/kernel/slab/fat_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fat_inode_cache/aliases b/test/sys/kernel/slab/fat_inode_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_inode_cache/align b/test/sys/kernel/slab/fat_inode_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_inode_cache/alloc_calls b/test/sys/kernel/slab/fat_inode_cache/alloc_calls new file mode 100644 index 0000000000..60c698416f --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/alloc_calls @@ -0,0 +1 @@ + 76 fat_alloc_inode+0x15/0x30 age=37336/37386/38290 pid=2817-2820 cpus=0-1 diff --git a/test/sys/kernel/slab/fat_inode_cache/cache_dma b/test/sys/kernel/slab/fat_inode_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_inode_cache/cpu_slabs b/test/sys/kernel/slab/fat_inode_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_inode_cache/ctor b/test/sys/kernel/slab/fat_inode_cache/ctor new file mode 100644 index 0000000000..102ae87d64 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x60 diff --git a/test/sys/kernel/slab/fat_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/fat_inode_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_inode_cache/free_calls b/test/sys/kernel/slab/fat_inode_cache/free_calls new file mode 100644 index 0000000000..f39bf09bb3 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/free_calls @@ -0,0 +1 @@ + 76 age=4294787996 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fat_inode_cache/hwcache_align b/test/sys/kernel/slab/fat_inode_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_inode_cache/object_size b/test/sys/kernel/slab/fat_inode_cache/object_size new file mode 100644 index 0000000000..59a3ec59b5 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/object_size @@ -0,0 +1 @@ +1200 diff --git a/test/sys/kernel/slab/fat_inode_cache/objects b/test/sys/kernel/slab/fat_inode_cache/objects new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/objects @@ -0,0 +1 @@ +100 diff --git a/test/sys/kernel/slab/fat_inode_cache/objects_partial b/test/sys/kernel/slab/fat_inode_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_inode_cache/objs_per_slab b/test/sys/kernel/slab/fat_inode_cache/objs_per_slab new file mode 100644 index 0000000000..7273c0fa8c --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/objs_per_slab @@ -0,0 +1 @@ +25 diff --git a/test/sys/kernel/slab/fat_inode_cache/order b/test/sys/kernel/slab/fat_inode_cache/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/fat_inode_cache/partial b/test/sys/kernel/slab/fat_inode_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_inode_cache/poison b/test/sys/kernel/slab/fat_inode_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_inode_cache/reclaim_account b/test/sys/kernel/slab/fat_inode_cache/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_inode_cache/red_zone b/test/sys/kernel/slab/fat_inode_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_inode_cache/sanity_checks b/test/sys/kernel/slab/fat_inode_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_inode_cache/shrink b/test/sys/kernel/slab/fat_inode_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fat_inode_cache/slab_size b/test/sys/kernel/slab/fat_inode_cache/slab_size new file mode 100644 index 0000000000..88a90959dc --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/slab_size @@ -0,0 +1 @@ +1272 diff --git a/test/sys/kernel/slab/fat_inode_cache/slabs b/test/sys/kernel/slab/fat_inode_cache/slabs new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/slabs @@ -0,0 +1 @@ +4 diff --git a/test/sys/kernel/slab/fat_inode_cache/store_user b/test/sys/kernel/slab/fat_inode_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fat_inode_cache/total_objects b/test/sys/kernel/slab/fat_inode_cache/total_objects new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/total_objects @@ -0,0 +1 @@ +100 diff --git a/test/sys/kernel/slab/fat_inode_cache/trace b/test/sys/kernel/slab/fat_inode_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fat_inode_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fat_inode_cache/validate b/test/sys/kernel/slab/fat_inode_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fib6_nodes/aliases b/test/sys/kernel/slab/fib6_nodes/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/align b/test/sys/kernel/slab/fib6_nodes/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/alloc_calls b/test/sys/kernel/slab/fib6_nodes/alloc_calls new file mode 100644 index 0000000000..6665fa2671 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/alloc_calls @@ -0,0 +1,3 @@ + 3 fib6_add+0x112/0x6a0 [ipv6] age=69122/80098/100888 pid=8-2080 cpus=0-1 + 1 fib6_add+0x2a2/0x6a0 [ipv6] age=70286 pid=8 cpus=1 + 1 fib6_add+0x2b6/0x6a0 [ipv6] age=70286 pid=8 cpus=1 diff --git a/test/sys/kernel/slab/fib6_nodes/cache_dma b/test/sys/kernel/slab/fib6_nodes/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/cpu_slabs b/test/sys/kernel/slab/fib6_nodes/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/ctor b/test/sys/kernel/slab/fib6_nodes/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fib6_nodes/destroy_by_rcu b/test/sys/kernel/slab/fib6_nodes/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/free_calls b/test/sys/kernel/slab/fib6_nodes/free_calls new file mode 100644 index 0000000000..ce124b48d3 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/free_calls @@ -0,0 +1 @@ + 5 age=4294788112 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fib6_nodes/hwcache_align b/test/sys/kernel/slab/fib6_nodes/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fib6_nodes/object_size b/test/sys/kernel/slab/fib6_nodes/object_size new file mode 100644 index 0000000000..21e72e8ac3 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/object_size @@ -0,0 +1 @@ +48 diff --git a/test/sys/kernel/slab/fib6_nodes/objects b/test/sys/kernel/slab/fib6_nodes/objects new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/objects @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/fib6_nodes/objects_partial b/test/sys/kernel/slab/fib6_nodes/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/objs_per_slab b/test/sys/kernel/slab/fib6_nodes/objs_per_slab new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/objs_per_slab @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/fib6_nodes/order b/test/sys/kernel/slab/fib6_nodes/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/partial b/test/sys/kernel/slab/fib6_nodes/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/poison b/test/sys/kernel/slab/fib6_nodes/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fib6_nodes/reclaim_account b/test/sys/kernel/slab/fib6_nodes/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/red_zone b/test/sys/kernel/slab/fib6_nodes/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fib6_nodes/sanity_checks b/test/sys/kernel/slab/fib6_nodes/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fib6_nodes/shrink b/test/sys/kernel/slab/fib6_nodes/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fib6_nodes/slab_size b/test/sys/kernel/slab/fib6_nodes/slab_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/slab_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/fib6_nodes/slabs b/test/sys/kernel/slab/fib6_nodes/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/fib6_nodes/store_user b/test/sys/kernel/slab/fib6_nodes/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fib6_nodes/total_objects b/test/sys/kernel/slab/fib6_nodes/total_objects new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/total_objects @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/fib6_nodes/trace b/test/sys/kernel/slab/fib6_nodes/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fib6_nodes/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fib6_nodes/validate b/test/sys/kernel/slab/fib6_nodes/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/file_lock_cache/aliases b/test/sys/kernel/slab/file_lock_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/align b/test/sys/kernel/slab/file_lock_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/alloc_calls b/test/sys/kernel/slab/file_lock_cache/alloc_calls new file mode 100644 index 0000000000..787e2a8a99 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/alloc_calls @@ -0,0 +1,2 @@ + 3 flock_lock_file_wait+0x2d6/0x2f0 age=15289/69387/97148 pid=1690-2851 cpus=0-1 + 1 __posix_lock_file+0x3f/0x560 age=90270 pid=2262 cpus=0 diff --git a/test/sys/kernel/slab/file_lock_cache/cache_dma b/test/sys/kernel/slab/file_lock_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/cpu_slabs b/test/sys/kernel/slab/file_lock_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/ctor b/test/sys/kernel/slab/file_lock_cache/ctor new file mode 100644 index 0000000000..2940046f62 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/file_lock_cache/destroy_by_rcu b/test/sys/kernel/slab/file_lock_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/free_calls b/test/sys/kernel/slab/file_lock_cache/free_calls new file mode 100644 index 0000000000..7b6f2a5efe --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/free_calls @@ -0,0 +1 @@ + 4 locks_free_lock+0x3e/0x60 age=15289/75889/100500 pid=1549-2851 cpus=0-1 diff --git a/test/sys/kernel/slab/file_lock_cache/hwcache_align b/test/sys/kernel/slab/file_lock_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/object_size b/test/sys/kernel/slab/file_lock_cache/object_size new file mode 100644 index 0000000000..20c90807cc --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/object_size @@ -0,0 +1 @@ +224 diff --git a/test/sys/kernel/slab/file_lock_cache/objects b/test/sys/kernel/slab/file_lock_cache/objects new file mode 100644 index 0000000000..6f4247a625 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/objects @@ -0,0 +1 @@ +26 diff --git a/test/sys/kernel/slab/file_lock_cache/objects_partial b/test/sys/kernel/slab/file_lock_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/objs_per_slab b/test/sys/kernel/slab/file_lock_cache/objs_per_slab new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/objs_per_slab @@ -0,0 +1 @@ +13 diff --git a/test/sys/kernel/slab/file_lock_cache/order b/test/sys/kernel/slab/file_lock_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/partial b/test/sys/kernel/slab/file_lock_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/poison b/test/sys/kernel/slab/file_lock_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/file_lock_cache/reclaim_account b/test/sys/kernel/slab/file_lock_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/red_zone b/test/sys/kernel/slab/file_lock_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/file_lock_cache/sanity_checks b/test/sys/kernel/slab/file_lock_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/file_lock_cache/shrink b/test/sys/kernel/slab/file_lock_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/file_lock_cache/slab_size b/test/sys/kernel/slab/file_lock_cache/slab_size new file mode 100644 index 0000000000..9530e04878 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/slab_size @@ -0,0 +1 @@ +296 diff --git a/test/sys/kernel/slab/file_lock_cache/slabs b/test/sys/kernel/slab/file_lock_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/file_lock_cache/store_user b/test/sys/kernel/slab/file_lock_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/file_lock_cache/total_objects b/test/sys/kernel/slab/file_lock_cache/total_objects new file mode 100644 index 0000000000..6f4247a625 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/total_objects @@ -0,0 +1 @@ +26 diff --git a/test/sys/kernel/slab/file_lock_cache/trace b/test/sys/kernel/slab/file_lock_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/file_lock_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/file_lock_cache/validate b/test/sys/kernel/slab/file_lock_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/files_cache/aliases b/test/sys/kernel/slab/files_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/files_cache/align b/test/sys/kernel/slab/files_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/files_cache/alloc_calls b/test/sys/kernel/slab/files_cache/alloc_calls new file mode 100644 index 0000000000..8da996c4fd --- /dev/null +++ b/test/sys/kernel/slab/files_cache/alloc_calls @@ -0,0 +1 @@ + 79 dup_fd+0x2e/0x420 age=3745/87832/120449 pid=0-2850 cpus=0-1 diff --git a/test/sys/kernel/slab/files_cache/cache_dma b/test/sys/kernel/slab/files_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/files_cache/cpu_slabs b/test/sys/kernel/slab/files_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/files_cache/ctor b/test/sys/kernel/slab/files_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/files_cache/destroy_by_rcu b/test/sys/kernel/slab/files_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/files_cache/free_calls b/test/sys/kernel/slab/files_cache/free_calls new file mode 100644 index 0000000000..b75ef82fce --- /dev/null +++ b/test/sys/kernel/slab/files_cache/free_calls @@ -0,0 +1,3 @@ + 9 age=4294787794 pid=0 cpus=0 + 30 put_files_struct+0xb4/0xe0 age=4740/84854/107543 pid=1258-2886 cpus=0-1 + 40 free_fdtable_rcu+0xa0/0xb0 age=38300/92095/116687 pid=0-2584 cpus=0-1 diff --git a/test/sys/kernel/slab/files_cache/hwcache_align b/test/sys/kernel/slab/files_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/files_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/files_cache/object_size b/test/sys/kernel/slab/files_cache/object_size new file mode 100644 index 0000000000..dc763b654e --- /dev/null +++ b/test/sys/kernel/slab/files_cache/object_size @@ -0,0 +1 @@ +768 diff --git a/test/sys/kernel/slab/files_cache/objects b/test/sys/kernel/slab/files_cache/objects new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/objects @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/files_cache/objects_partial b/test/sys/kernel/slab/files_cache/objects_partial new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/files_cache/objects_partial @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/files_cache/objs_per_slab b/test/sys/kernel/slab/files_cache/objs_per_slab new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/objs_per_slab @@ -0,0 +1 @@ +18 diff --git a/test/sys/kernel/slab/files_cache/order b/test/sys/kernel/slab/files_cache/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/files_cache/partial b/test/sys/kernel/slab/files_cache/partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/files_cache/poison b/test/sys/kernel/slab/files_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/files_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/files_cache/reclaim_account b/test/sys/kernel/slab/files_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/files_cache/red_zone b/test/sys/kernel/slab/files_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/files_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/files_cache/sanity_checks b/test/sys/kernel/slab/files_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/files_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/files_cache/shrink b/test/sys/kernel/slab/files_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/files_cache/slab_size b/test/sys/kernel/slab/files_cache/slab_size new file mode 100644 index 0000000000..4564b1f0a0 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/slab_size @@ -0,0 +1 @@ +896 diff --git a/test/sys/kernel/slab/files_cache/slabs b/test/sys/kernel/slab/files_cache/slabs new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/slabs @@ -0,0 +1 @@ +6 diff --git a/test/sys/kernel/slab/files_cache/store_user b/test/sys/kernel/slab/files_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/files_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/files_cache/total_objects b/test/sys/kernel/slab/files_cache/total_objects new file mode 100644 index 0000000000..3b20426c05 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/total_objects @@ -0,0 +1 @@ +108 diff --git a/test/sys/kernel/slab/files_cache/trace b/test/sys/kernel/slab/files_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/files_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/files_cache/validate b/test/sys/kernel/slab/files_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/filp/aliases b/test/sys/kernel/slab/filp/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/filp/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/filp/align b/test/sys/kernel/slab/filp/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/filp/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/filp/alloc_calls b/test/sys/kernel/slab/filp/alloc_calls new file mode 100644 index 0000000000..11e73b8665 --- /dev/null +++ b/test/sys/kernel/slab/filp/alloc_calls @@ -0,0 +1 @@ + 4088 get_empty_filp+0x44/0x1a0 age=0/79776/118687 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/filp/cache_dma b/test/sys/kernel/slab/filp/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/filp/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/filp/cpu_slabs b/test/sys/kernel/slab/filp/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/filp/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/filp/ctor b/test/sys/kernel/slab/filp/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/filp/destroy_by_rcu b/test/sys/kernel/slab/filp/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/filp/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/filp/free_calls b/test/sys/kernel/slab/filp/free_calls new file mode 100644 index 0000000000..abbe2671c9 --- /dev/null +++ b/test/sys/kernel/slab/filp/free_calls @@ -0,0 +1,2 @@ + 879 age=4294787759 pid=0 cpus=0 + 3211 file_free_rcu+0x16/0x20 age=3/79862/117622 pid=0-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/filp/hwcache_align b/test/sys/kernel/slab/filp/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/filp/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/filp/object_size b/test/sys/kernel/slab/filp/object_size new file mode 100644 index 0000000000..ea80947336 --- /dev/null +++ b/test/sys/kernel/slab/filp/object_size @@ -0,0 +1 @@ +288 diff --git a/test/sys/kernel/slab/filp/objects b/test/sys/kernel/slab/filp/objects new file mode 100644 index 0000000000..0c2cf3996c --- /dev/null +++ b/test/sys/kernel/slab/filp/objects @@ -0,0 +1 @@ +4082 diff --git a/test/sys/kernel/slab/filp/objects_partial b/test/sys/kernel/slab/filp/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/filp/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/filp/objs_per_slab b/test/sys/kernel/slab/filp/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/filp/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/filp/order b/test/sys/kernel/slab/filp/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/filp/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/filp/partial b/test/sys/kernel/slab/filp/partial new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/test/sys/kernel/slab/filp/partial @@ -0,0 +1 @@ +9 diff --git a/test/sys/kernel/slab/filp/poison b/test/sys/kernel/slab/filp/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/filp/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/filp/reclaim_account b/test/sys/kernel/slab/filp/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/filp/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/filp/red_zone b/test/sys/kernel/slab/filp/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/filp/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/filp/sanity_checks b/test/sys/kernel/slab/filp/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/filp/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/filp/shrink b/test/sys/kernel/slab/filp/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/filp/slab_size b/test/sys/kernel/slab/filp/slab_size new file mode 100644 index 0000000000..e45b99e958 --- /dev/null +++ b/test/sys/kernel/slab/filp/slab_size @@ -0,0 +1 @@ +384 diff --git a/test/sys/kernel/slab/filp/slabs b/test/sys/kernel/slab/filp/slabs new file mode 100644 index 0000000000..6bb2f98fb0 --- /dev/null +++ b/test/sys/kernel/slab/filp/slabs @@ -0,0 +1 @@ +195 diff --git a/test/sys/kernel/slab/filp/store_user b/test/sys/kernel/slab/filp/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/filp/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/filp/total_objects b/test/sys/kernel/slab/filp/total_objects new file mode 100644 index 0000000000..50b0f79069 --- /dev/null +++ b/test/sys/kernel/slab/filp/total_objects @@ -0,0 +1 @@ +4095 diff --git a/test/sys/kernel/slab/filp/trace b/test/sys/kernel/slab/filp/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/filp/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/filp/validate b/test/sys/kernel/slab/filp/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/flow_cache/aliases b/test/sys/kernel/slab/flow_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/align b/test/sys/kernel/slab/flow_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/alloc_calls b/test/sys/kernel/slab/flow_cache/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/flow_cache/cache_dma b/test/sys/kernel/slab/flow_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/cpu_slabs b/test/sys/kernel/slab/flow_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/ctor b/test/sys/kernel/slab/flow_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/flow_cache/destroy_by_rcu b/test/sys/kernel/slab/flow_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/free_calls b/test/sys/kernel/slab/flow_cache/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/flow_cache/hwcache_align b/test/sys/kernel/slab/flow_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/object_size b/test/sys/kernel/slab/flow_cache/object_size new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/object_size @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/flow_cache/objects b/test/sys/kernel/slab/flow_cache/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/objects_partial b/test/sys/kernel/slab/flow_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/objs_per_slab b/test/sys/kernel/slab/flow_cache/objs_per_slab new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/objs_per_slab @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/flow_cache/order b/test/sys/kernel/slab/flow_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/partial b/test/sys/kernel/slab/flow_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/poison b/test/sys/kernel/slab/flow_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/flow_cache/reclaim_account b/test/sys/kernel/slab/flow_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/red_zone b/test/sys/kernel/slab/flow_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/flow_cache/sanity_checks b/test/sys/kernel/slab/flow_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/flow_cache/shrink b/test/sys/kernel/slab/flow_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/flow_cache/slab_size b/test/sys/kernel/slab/flow_cache/slab_size new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/slab_size @@ -0,0 +1 @@ +168 diff --git a/test/sys/kernel/slab/flow_cache/slabs b/test/sys/kernel/slab/flow_cache/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/store_user b/test/sys/kernel/slab/flow_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/flow_cache/total_objects b/test/sys/kernel/slab/flow_cache/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/trace b/test/sys/kernel/slab/flow_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/flow_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/flow_cache/validate b/test/sys/kernel/slab/flow_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fs_cache/aliases b/test/sys/kernel/slab/fs_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fs_cache/align b/test/sys/kernel/slab/fs_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fs_cache/alloc_calls b/test/sys/kernel/slab/fs_cache/alloc_calls new file mode 100644 index 0000000000..9979546e79 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/alloc_calls @@ -0,0 +1 @@ + 78 __copy_fs_struct+0x28/0xc0 age=3741/87410/120433 pid=1-2850 cpus=0-1 diff --git a/test/sys/kernel/slab/fs_cache/cache_dma b/test/sys/kernel/slab/fs_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fs_cache/cpu_slabs b/test/sys/kernel/slab/fs_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fs_cache/ctor b/test/sys/kernel/slab/fs_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fs_cache/destroy_by_rcu b/test/sys/kernel/slab/fs_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fs_cache/free_calls b/test/sys/kernel/slab/fs_cache/free_calls new file mode 100644 index 0000000000..c6ec051c58 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/free_calls @@ -0,0 +1,2 @@ + 7 age=4294787790 pid=0 cpus=0 + 71 put_fs_struct+0x37/0x40 age=4736/89295/115882 pid=145-2886 cpus=0-1 diff --git a/test/sys/kernel/slab/fs_cache/hwcache_align b/test/sys/kernel/slab/fs_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fs_cache/object_size b/test/sys/kernel/slab/fs_cache/object_size new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/object_size @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/fs_cache/objects b/test/sys/kernel/slab/fs_cache/objects new file mode 100644 index 0000000000..a9c8fe8292 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/objects @@ -0,0 +1 @@ +103 diff --git a/test/sys/kernel/slab/fs_cache/objects_partial b/test/sys/kernel/slab/fs_cache/objects_partial new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/objects_partial @@ -0,0 +1 @@ +40 diff --git a/test/sys/kernel/slab/fs_cache/objs_per_slab b/test/sys/kernel/slab/fs_cache/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/fs_cache/order b/test/sys/kernel/slab/fs_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fs_cache/partial b/test/sys/kernel/slab/fs_cache/partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/fs_cache/poison b/test/sys/kernel/slab/fs_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fs_cache/reclaim_account b/test/sys/kernel/slab/fs_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fs_cache/red_zone b/test/sys/kernel/slab/fs_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fs_cache/sanity_checks b/test/sys/kernel/slab/fs_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fs_cache/shrink b/test/sys/kernel/slab/fs_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fs_cache/slab_size b/test/sys/kernel/slab/fs_cache/slab_size new file mode 100644 index 0000000000..86a0307199 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/slab_size @@ -0,0 +1 @@ +192 diff --git a/test/sys/kernel/slab/fs_cache/slabs b/test/sys/kernel/slab/fs_cache/slabs new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/slabs @@ -0,0 +1 @@ +5 diff --git a/test/sys/kernel/slab/fs_cache/store_user b/test/sys/kernel/slab/fs_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fs_cache/total_objects b/test/sys/kernel/slab/fs_cache/total_objects new file mode 100644 index 0000000000..f96ac06721 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/total_objects @@ -0,0 +1 @@ +105 diff --git a/test/sys/kernel/slab/fs_cache/trace b/test/sys/kernel/slab/fs_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fs_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fs_cache/validate b/test/sys/kernel/slab/fs_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fuse_inode/aliases b/test/sys/kernel/slab/fuse_inode/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_inode/align b/test/sys/kernel/slab/fuse_inode/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_inode/alloc_calls b/test/sys/kernel/slab/fuse_inode/alloc_calls new file mode 100644 index 0000000000..b1aeceecc4 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/alloc_calls @@ -0,0 +1 @@ + 1 fuse_alloc_inode+0x1a/0xe0 [fuse] age=76451 pid=2476 cpus=0 diff --git a/test/sys/kernel/slab/fuse_inode/cache_dma b/test/sys/kernel/slab/fuse_inode/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_inode/cpu_slabs b/test/sys/kernel/slab/fuse_inode/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_inode/ctor b/test/sys/kernel/slab/fuse_inode/ctor new file mode 100644 index 0000000000..74a5d262d7 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/ctor @@ -0,0 +1 @@ +fuse_inode_init_once+0x0/0x10 [fuse] diff --git a/test/sys/kernel/slab/fuse_inode/destroy_by_rcu b/test/sys/kernel/slab/fuse_inode/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_inode/free_calls b/test/sys/kernel/slab/fuse_inode/free_calls new file mode 100644 index 0000000000..261790e975 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/free_calls @@ -0,0 +1 @@ + 1 age=4294788049 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fuse_inode/hwcache_align b/test/sys/kernel/slab/fuse_inode/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_inode/object_size b/test/sys/kernel/slab/fuse_inode/object_size new file mode 100644 index 0000000000..600fe59b5a --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/object_size @@ -0,0 +1 @@ +1248 diff --git a/test/sys/kernel/slab/fuse_inode/objects b/test/sys/kernel/slab/fuse_inode/objects new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/objects @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/fuse_inode/objects_partial b/test/sys/kernel/slab/fuse_inode/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_inode/objs_per_slab b/test/sys/kernel/slab/fuse_inode/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/fuse_inode/order b/test/sys/kernel/slab/fuse_inode/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/fuse_inode/partial b/test/sys/kernel/slab/fuse_inode/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_inode/poison b/test/sys/kernel/slab/fuse_inode/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_inode/reclaim_account b/test/sys/kernel/slab/fuse_inode/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_inode/red_zone b/test/sys/kernel/slab/fuse_inode/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_inode/sanity_checks b/test/sys/kernel/slab/fuse_inode/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_inode/shrink b/test/sys/kernel/slab/fuse_inode/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fuse_inode/slab_size b/test/sys/kernel/slab/fuse_inode/slab_size new file mode 100644 index 0000000000..3f3c936679 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/slab_size @@ -0,0 +1 @@ +1344 diff --git a/test/sys/kernel/slab/fuse_inode/slabs b/test/sys/kernel/slab/fuse_inode/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_inode/store_user b/test/sys/kernel/slab/fuse_inode/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_inode/total_objects b/test/sys/kernel/slab/fuse_inode/total_objects new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/total_objects @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/fuse_inode/trace b/test/sys/kernel/slab/fuse_inode/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_inode/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_inode/validate b/test/sys/kernel/slab/fuse_inode/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fuse_request/aliases b/test/sys/kernel/slab/fuse_request/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/align b/test/sys/kernel/slab/fuse_request/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/alloc_calls b/test/sys/kernel/slab/fuse_request/alloc_calls new file mode 100644 index 0000000000..83c53d796d --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/alloc_calls @@ -0,0 +1 @@ + 1 fuse_request_alloc+0x1a/0x40 [fuse] age=76455 pid=2476 cpus=0 diff --git a/test/sys/kernel/slab/fuse_request/cache_dma b/test/sys/kernel/slab/fuse_request/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/cpu_slabs b/test/sys/kernel/slab/fuse_request/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/ctor b/test/sys/kernel/slab/fuse_request/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fuse_request/destroy_by_rcu b/test/sys/kernel/slab/fuse_request/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/free_calls b/test/sys/kernel/slab/fuse_request/free_calls new file mode 100644 index 0000000000..45a24e1524 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/free_calls @@ -0,0 +1 @@ + 1 age=4294788053 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fuse_request/hwcache_align b/test/sys/kernel/slab/fuse_request/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/object_size b/test/sys/kernel/slab/fuse_request/object_size new file mode 100644 index 0000000000..39adda3c66 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/object_size @@ -0,0 +1 @@ +656 diff --git a/test/sys/kernel/slab/fuse_request/objects b/test/sys/kernel/slab/fuse_request/objects new file mode 100644 index 0000000000..c739b42c4d --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/objects @@ -0,0 +1 @@ +44 diff --git a/test/sys/kernel/slab/fuse_request/objects_partial b/test/sys/kernel/slab/fuse_request/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/objs_per_slab b/test/sys/kernel/slab/fuse_request/objs_per_slab new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/objs_per_slab @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/fuse_request/order b/test/sys/kernel/slab/fuse_request/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/fuse_request/partial b/test/sys/kernel/slab/fuse_request/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/poison b/test/sys/kernel/slab/fuse_request/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_request/reclaim_account b/test/sys/kernel/slab/fuse_request/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/red_zone b/test/sys/kernel/slab/fuse_request/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_request/sanity_checks b/test/sys/kernel/slab/fuse_request/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_request/shrink b/test/sys/kernel/slab/fuse_request/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/fuse_request/slab_size b/test/sys/kernel/slab/fuse_request/slab_size new file mode 100644 index 0000000000..f4815f7c10 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/slab_size @@ -0,0 +1 @@ +728 diff --git a/test/sys/kernel/slab/fuse_request/slabs b/test/sys/kernel/slab/fuse_request/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/fuse_request/store_user b/test/sys/kernel/slab/fuse_request/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/fuse_request/total_objects b/test/sys/kernel/slab/fuse_request/total_objects new file mode 100644 index 0000000000..c739b42c4d --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/total_objects @@ -0,0 +1 @@ +44 diff --git a/test/sys/kernel/slab/fuse_request/trace b/test/sys/kernel/slab/fuse_request/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/fuse_request/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/fuse_request/validate b/test/sys/kernel/slab/fuse_request/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/idr_layer_cache/aliases b/test/sys/kernel/slab/idr_layer_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/align b/test/sys/kernel/slab/idr_layer_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/alloc_calls b/test/sys/kernel/slab/idr_layer_cache/alloc_calls new file mode 100644 index 0000000000..35df60d608 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/alloc_calls @@ -0,0 +1 @@ + 432 idr_pre_get+0x5d/0x80 age=15211/96145/120531 pid=0-2851 cpus=0-1 diff --git a/test/sys/kernel/slab/idr_layer_cache/cache_dma b/test/sys/kernel/slab/idr_layer_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/cpu_slabs b/test/sys/kernel/slab/idr_layer_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/ctor b/test/sys/kernel/slab/idr_layer_cache/ctor new file mode 100644 index 0000000000..643dfd948c --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/ctor @@ -0,0 +1 @@ +idr_cache_ctor+0x0/0x10 diff --git a/test/sys/kernel/slab/idr_layer_cache/destroy_by_rcu b/test/sys/kernel/slab/idr_layer_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/free_calls b/test/sys/kernel/slab/idr_layer_cache/free_calls new file mode 100644 index 0000000000..17f1cfcc39 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/free_calls @@ -0,0 +1,5 @@ + 316 age=4294787827 pid=0 cpus=0 + 11 idr_destroy+0x2f/0x40 age=56002/56002/56002 pid=2406 cpus=1 + 5 idr_layer_rcu_free+0x17/0x20 age=55996/93526/117680 pid=0-1155 cpus=0-1 + 97 ida_get_new_above+0x141/0x210 age=38489/111897/120531 pid=0-2761 cpus=0-1 + 3 idr_remove+0x187/0x200 age=34268/47337/70659 pid=1738-2821 cpus=0-1 diff --git a/test/sys/kernel/slab/idr_layer_cache/hwcache_align b/test/sys/kernel/slab/idr_layer_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/object_size b/test/sys/kernel/slab/idr_layer_cache/object_size new file mode 100644 index 0000000000..4970e693e1 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/object_size @@ -0,0 +1 @@ +544 diff --git a/test/sys/kernel/slab/idr_layer_cache/objects b/test/sys/kernel/slab/idr_layer_cache/objects new file mode 100644 index 0000000000..18e1dd6bc4 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/objects @@ -0,0 +1 @@ +442 diff --git a/test/sys/kernel/slab/idr_layer_cache/objects_partial b/test/sys/kernel/slab/idr_layer_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/objs_per_slab b/test/sys/kernel/slab/idr_layer_cache/objs_per_slab new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/objs_per_slab @@ -0,0 +1 @@ +13 diff --git a/test/sys/kernel/slab/idr_layer_cache/order b/test/sys/kernel/slab/idr_layer_cache/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/idr_layer_cache/partial b/test/sys/kernel/slab/idr_layer_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/poison b/test/sys/kernel/slab/idr_layer_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/idr_layer_cache/reclaim_account b/test/sys/kernel/slab/idr_layer_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/red_zone b/test/sys/kernel/slab/idr_layer_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/idr_layer_cache/sanity_checks b/test/sys/kernel/slab/idr_layer_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/idr_layer_cache/shrink b/test/sys/kernel/slab/idr_layer_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/idr_layer_cache/slab_size b/test/sys/kernel/slab/idr_layer_cache/slab_size new file mode 100644 index 0000000000..ac62e9337c --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/slab_size @@ -0,0 +1 @@ +616 diff --git a/test/sys/kernel/slab/idr_layer_cache/slabs b/test/sys/kernel/slab/idr_layer_cache/slabs new file mode 100644 index 0000000000..a787364590 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/slabs @@ -0,0 +1 @@ +34 diff --git a/test/sys/kernel/slab/idr_layer_cache/store_user b/test/sys/kernel/slab/idr_layer_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/idr_layer_cache/total_objects b/test/sys/kernel/slab/idr_layer_cache/total_objects new file mode 100644 index 0000000000..18e1dd6bc4 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/total_objects @@ -0,0 +1 @@ +442 diff --git a/test/sys/kernel/slab/idr_layer_cache/trace b/test/sys/kernel/slab/idr_layer_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/idr_layer_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/idr_layer_cache/validate b/test/sys/kernel/slab/idr_layer_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inet_peer_cache/aliases b/test/sys/kernel/slab/inet_peer_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/align b/test/sys/kernel/slab/inet_peer_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/alloc_calls b/test/sys/kernel/slab/inet_peer_cache/alloc_calls new file mode 100644 index 0000000000..5748ad29ae --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/alloc_calls @@ -0,0 +1 @@ + 1 inet_getpeer+0xc6/0x210 age=73923 pid=2080 cpus=0 diff --git a/test/sys/kernel/slab/inet_peer_cache/cache_dma b/test/sys/kernel/slab/inet_peer_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/cpu_slabs b/test/sys/kernel/slab/inet_peer_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/ctor b/test/sys/kernel/slab/inet_peer_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inet_peer_cache/destroy_by_rcu b/test/sys/kernel/slab/inet_peer_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/free_calls b/test/sys/kernel/slab/inet_peer_cache/free_calls new file mode 100644 index 0000000000..e18757dfda --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/free_calls @@ -0,0 +1 @@ + 1 age=4294787453 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/inet_peer_cache/hwcache_align b/test/sys/kernel/slab/inet_peer_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inet_peer_cache/object_size b/test/sys/kernel/slab/inet_peer_cache/object_size new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/object_size @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/inet_peer_cache/objects b/test/sys/kernel/slab/inet_peer_cache/objects new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/objects @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/inet_peer_cache/objects_partial b/test/sys/kernel/slab/inet_peer_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/objs_per_slab b/test/sys/kernel/slab/inet_peer_cache/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/inet_peer_cache/order b/test/sys/kernel/slab/inet_peer_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/partial b/test/sys/kernel/slab/inet_peer_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/poison b/test/sys/kernel/slab/inet_peer_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inet_peer_cache/reclaim_account b/test/sys/kernel/slab/inet_peer_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/red_zone b/test/sys/kernel/slab/inet_peer_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inet_peer_cache/sanity_checks b/test/sys/kernel/slab/inet_peer_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inet_peer_cache/shrink b/test/sys/kernel/slab/inet_peer_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inet_peer_cache/slab_size b/test/sys/kernel/slab/inet_peer_cache/slab_size new file mode 100644 index 0000000000..86a0307199 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/slab_size @@ -0,0 +1 @@ +192 diff --git a/test/sys/kernel/slab/inet_peer_cache/slabs b/test/sys/kernel/slab/inet_peer_cache/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inet_peer_cache/store_user b/test/sys/kernel/slab/inet_peer_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inet_peer_cache/total_objects b/test/sys/kernel/slab/inet_peer_cache/total_objects new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/total_objects @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/inet_peer_cache/trace b/test/sys/kernel/slab/inet_peer_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inet_peer_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/validate b/test/sys/kernel/slab/inet_peer_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inode_cache/aliases b/test/sys/kernel/slab/inode_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inode_cache/align b/test/sys/kernel/slab/inode_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inode_cache/alloc_calls b/test/sys/kernel/slab/inode_cache/alloc_calls new file mode 100644 index 0000000000..d985362431 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/alloc_calls @@ -0,0 +1 @@ + 8256 alloc_inode+0x251/0x280 age=0/37926/120431 pid=0-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/inode_cache/cache_dma b/test/sys/kernel/slab/inode_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inode_cache/cpu_slabs b/test/sys/kernel/slab/inode_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inode_cache/ctor b/test/sys/kernel/slab/inode_cache/ctor new file mode 100644 index 0000000000..2940046f62 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/inode_cache/destroy_by_rcu b/test/sys/kernel/slab/inode_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inode_cache/free_calls b/test/sys/kernel/slab/inode_cache/free_calls new file mode 100644 index 0000000000..bf0243bed2 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/free_calls @@ -0,0 +1,2 @@ + 7965 age=4294787729 pid=0 cpus=0 + 292 destroy_inode+0x4f/0x60 age=3679/89855/118054 pid=8-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/inode_cache/hwcache_align b/test/sys/kernel/slab/inode_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inode_cache/object_size b/test/sys/kernel/slab/inode_cache/object_size new file mode 100644 index 0000000000..e255a85551 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/object_size @@ -0,0 +1 @@ +1072 diff --git a/test/sys/kernel/slab/inode_cache/objects b/test/sys/kernel/slab/inode_cache/objects new file mode 100644 index 0000000000..d1a359890a --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/objects @@ -0,0 +1 @@ +8260 diff --git a/test/sys/kernel/slab/inode_cache/objects_partial b/test/sys/kernel/slab/inode_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inode_cache/objs_per_slab b/test/sys/kernel/slab/inode_cache/objs_per_slab new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/objs_per_slab @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/inode_cache/order b/test/sys/kernel/slab/inode_cache/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/inode_cache/partial b/test/sys/kernel/slab/inode_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inode_cache/poison b/test/sys/kernel/slab/inode_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inode_cache/reclaim_account b/test/sys/kernel/slab/inode_cache/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inode_cache/red_zone b/test/sys/kernel/slab/inode_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inode_cache/sanity_checks b/test/sys/kernel/slab/inode_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inode_cache/shrink b/test/sys/kernel/slab/inode_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inode_cache/slab_size b/test/sys/kernel/slab/inode_cache/slab_size new file mode 100644 index 0000000000..fdab865fb7 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/slab_size @@ -0,0 +1 @@ +1144 diff --git a/test/sys/kernel/slab/inode_cache/slabs b/test/sys/kernel/slab/inode_cache/slabs new file mode 100644 index 0000000000..9706647749 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/slabs @@ -0,0 +1 @@ +590 diff --git a/test/sys/kernel/slab/inode_cache/store_user b/test/sys/kernel/slab/inode_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inode_cache/total_objects b/test/sys/kernel/slab/inode_cache/total_objects new file mode 100644 index 0000000000..d1a359890a --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/total_objects @@ -0,0 +1 @@ +8260 diff --git a/test/sys/kernel/slab/inode_cache/trace b/test/sys/kernel/slab/inode_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inode_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inode_cache/validate b/test/sys/kernel/slab/inode_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inotify_event_cache/aliases b/test/sys/kernel/slab/inotify_event_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/align b/test/sys/kernel/slab/inotify_event_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/alloc_calls b/test/sys/kernel/slab/inotify_event_cache/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/inotify_event_cache/cache_dma b/test/sys/kernel/slab/inotify_event_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/cpu_slabs b/test/sys/kernel/slab/inotify_event_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/ctor b/test/sys/kernel/slab/inotify_event_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inotify_event_cache/destroy_by_rcu b/test/sys/kernel/slab/inotify_event_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/free_calls b/test/sys/kernel/slab/inotify_event_cache/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/inotify_event_cache/hwcache_align b/test/sys/kernel/slab/inotify_event_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/object_size b/test/sys/kernel/slab/inotify_event_cache/object_size new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/object_size @@ -0,0 +1 @@ +40 diff --git a/test/sys/kernel/slab/inotify_event_cache/objects b/test/sys/kernel/slab/inotify_event_cache/objects new file mode 100644 index 0000000000..ea70ce0134 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/objects @@ -0,0 +1 @@ +72 diff --git a/test/sys/kernel/slab/inotify_event_cache/objects_partial b/test/sys/kernel/slab/inotify_event_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/objs_per_slab b/test/sys/kernel/slab/inotify_event_cache/objs_per_slab new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/objs_per_slab @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/inotify_event_cache/order b/test/sys/kernel/slab/inotify_event_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/partial b/test/sys/kernel/slab/inotify_event_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/poison b/test/sys/kernel/slab/inotify_event_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inotify_event_cache/reclaim_account b/test/sys/kernel/slab/inotify_event_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/red_zone b/test/sys/kernel/slab/inotify_event_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inotify_event_cache/sanity_checks b/test/sys/kernel/slab/inotify_event_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inotify_event_cache/shrink b/test/sys/kernel/slab/inotify_event_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inotify_event_cache/slab_size b/test/sys/kernel/slab/inotify_event_cache/slab_size new file mode 100644 index 0000000000..194b81caae --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/slab_size @@ -0,0 +1 @@ +112 diff --git a/test/sys/kernel/slab/inotify_event_cache/slabs b/test/sys/kernel/slab/inotify_event_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/inotify_event_cache/store_user b/test/sys/kernel/slab/inotify_event_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inotify_event_cache/total_objects b/test/sys/kernel/slab/inotify_event_cache/total_objects new file mode 100644 index 0000000000..ea70ce0134 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/total_objects @@ -0,0 +1 @@ +72 diff --git a/test/sys/kernel/slab/inotify_event_cache/trace b/test/sys/kernel/slab/inotify_event_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_event_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_event_cache/validate b/test/sys/kernel/slab/inotify_event_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inotify_watch_cache/aliases b/test/sys/kernel/slab/inotify_watch_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/align b/test/sys/kernel/slab/inotify_watch_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/alloc_calls b/test/sys/kernel/slab/inotify_watch_cache/alloc_calls new file mode 100644 index 0000000000..e99148ee3c --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/alloc_calls @@ -0,0 +1 @@ + 130 sys_inotify_add_watch+0x15e/0x1d0 age=15313/96318/117218 pid=72-2851 cpus=0-1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/cache_dma b/test/sys/kernel/slab/inotify_watch_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/cpu_slabs b/test/sys/kernel/slab/inotify_watch_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/ctor b/test/sys/kernel/slab/inotify_watch_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inotify_watch_cache/destroy_by_rcu b/test/sys/kernel/slab/inotify_watch_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/free_calls b/test/sys/kernel/slab/inotify_watch_cache/free_calls new file mode 100644 index 0000000000..1310fb3766 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/free_calls @@ -0,0 +1,2 @@ + 124 age=4294787929 pid=0 cpus=0 + 6 free_inotify_user_watch+0x60/0x70 age=34362/48918/75284 pid=2374-2821 cpus=0-1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/hwcache_align b/test/sys/kernel/slab/inotify_watch_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/object_size b/test/sys/kernel/slab/inotify_watch_cache/object_size new file mode 100644 index 0000000000..ea70ce0134 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/object_size @@ -0,0 +1 @@ +72 diff --git a/test/sys/kernel/slab/inotify_watch_cache/objects b/test/sys/kernel/slab/inotify_watch_cache/objects new file mode 100644 index 0000000000..4e9bdff0c6 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/objects @@ -0,0 +1 @@ +164 diff --git a/test/sys/kernel/slab/inotify_watch_cache/objects_partial b/test/sys/kernel/slab/inotify_watch_cache/objects_partial new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/objects_partial @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/inotify_watch_cache/objs_per_slab b/test/sys/kernel/slab/inotify_watch_cache/objs_per_slab new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/objs_per_slab @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/inotify_watch_cache/order b/test/sys/kernel/slab/inotify_watch_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/partial b/test/sys/kernel/slab/inotify_watch_cache/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/poison b/test/sys/kernel/slab/inotify_watch_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/reclaim_account b/test/sys/kernel/slab/inotify_watch_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/red_zone b/test/sys/kernel/slab/inotify_watch_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/sanity_checks b/test/sys/kernel/slab/inotify_watch_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/shrink b/test/sys/kernel/slab/inotify_watch_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/inotify_watch_cache/slab_size b/test/sys/kernel/slab/inotify_watch_cache/slab_size new file mode 100644 index 0000000000..a29644e57e --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/slab_size @@ -0,0 +1 @@ +144 diff --git a/test/sys/kernel/slab/inotify_watch_cache/slabs b/test/sys/kernel/slab/inotify_watch_cache/slabs new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/slabs @@ -0,0 +1 @@ +6 diff --git a/test/sys/kernel/slab/inotify_watch_cache/store_user b/test/sys/kernel/slab/inotify_watch_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/total_objects b/test/sys/kernel/slab/inotify_watch_cache/total_objects new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/total_objects @@ -0,0 +1 @@ +168 diff --git a/test/sys/kernel/slab/inotify_watch_cache/trace b/test/sys/kernel/slab/inotify_watch_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/inotify_watch_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/validate b/test/sys/kernel/slab/inotify_watch_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip6_dst_cache/aliases b/test/sys/kernel/slab/ip6_dst_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/align b/test/sys/kernel/slab/ip6_dst_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/alloc_calls b/test/sys/kernel/slab/ip6_dst_cache/alloc_calls new file mode 100644 index 0000000000..09eb6d1fc4 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/alloc_calls @@ -0,0 +1 @@ + 4 dst_alloc+0x2b/0x90 age=70282/77932/100884 pid=8-1549 cpus=0-1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/cache_dma b/test/sys/kernel/slab/ip6_dst_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/cpu_slabs b/test/sys/kernel/slab/ip6_dst_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/ctor b/test/sys/kernel/slab/ip6_dst_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu b/test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/free_calls b/test/sys/kernel/slab/ip6_dst_cache/free_calls new file mode 100644 index 0000000000..c5718c6db5 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/free_calls @@ -0,0 +1 @@ + 4 age=4294788108 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/hwcache_align b/test/sys/kernel/slab/ip6_dst_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/object_size b/test/sys/kernel/slab/ip6_dst_cache/object_size new file mode 100644 index 0000000000..873b744bc5 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/object_size @@ -0,0 +1 @@ +304 diff --git a/test/sys/kernel/slab/ip6_dst_cache/objects b/test/sys/kernel/slab/ip6_dst_cache/objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/ip6_dst_cache/objects_partial b/test/sys/kernel/slab/ip6_dst_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/objs_per_slab b/test/sys/kernel/slab/ip6_dst_cache/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/ip6_dst_cache/order b/test/sys/kernel/slab/ip6_dst_cache/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/partial b/test/sys/kernel/slab/ip6_dst_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/poison b/test/sys/kernel/slab/ip6_dst_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/reclaim_account b/test/sys/kernel/slab/ip6_dst_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/red_zone b/test/sys/kernel/slab/ip6_dst_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/sanity_checks b/test/sys/kernel/slab/ip6_dst_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/shrink b/test/sys/kernel/slab/ip6_dst_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip6_dst_cache/slab_size b/test/sys/kernel/slab/ip6_dst_cache/slab_size new file mode 100644 index 0000000000..e45b99e958 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/slab_size @@ -0,0 +1 @@ +384 diff --git a/test/sys/kernel/slab/ip6_dst_cache/slabs b/test/sys/kernel/slab/ip6_dst_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/ip6_dst_cache/store_user b/test/sys/kernel/slab/ip6_dst_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/total_objects b/test/sys/kernel/slab/ip6_dst_cache/total_objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/total_objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/ip6_dst_cache/trace b/test/sys/kernel/slab/ip6_dst_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip6_dst_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/validate b/test/sys/kernel/slab/ip6_dst_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip_dst_cache/aliases b/test/sys/kernel/slab/ip_dst_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_dst_cache/align b/test/sys/kernel/slab/ip_dst_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_dst_cache/alloc_calls b/test/sys/kernel/slab/ip_dst_cache/alloc_calls new file mode 100644 index 0000000000..e53d4d1c3d --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/alloc_calls @@ -0,0 +1 @@ + 13 dst_alloc+0x2b/0x90 age=14168/47270/65602 pid=0-2881 cpus=0-1 diff --git a/test/sys/kernel/slab/ip_dst_cache/cache_dma b/test/sys/kernel/slab/ip_dst_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_dst_cache/cpu_slabs b/test/sys/kernel/slab/ip_dst_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_dst_cache/ctor b/test/sys/kernel/slab/ip_dst_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu b/test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_dst_cache/free_calls b/test/sys/kernel/slab/ip_dst_cache/free_calls new file mode 100644 index 0000000000..76dbcf0ebf --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/free_calls @@ -0,0 +1,2 @@ + 8 age=4294787484 pid=0 cpus=0 + 5 dst_destroy+0x73/0x110 age=65601/68844/69656 pid=0 cpus=1 diff --git a/test/sys/kernel/slab/ip_dst_cache/hwcache_align b/test/sys/kernel/slab/ip_dst_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_dst_cache/object_size b/test/sys/kernel/slab/ip_dst_cache/object_size new file mode 100644 index 0000000000..a1e0432c9a --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/object_size @@ -0,0 +1 @@ +312 diff --git a/test/sys/kernel/slab/ip_dst_cache/objects b/test/sys/kernel/slab/ip_dst_cache/objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/ip_dst_cache/objects_partial b/test/sys/kernel/slab/ip_dst_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_dst_cache/objs_per_slab b/test/sys/kernel/slab/ip_dst_cache/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/ip_dst_cache/order b/test/sys/kernel/slab/ip_dst_cache/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_dst_cache/partial b/test/sys/kernel/slab/ip_dst_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_dst_cache/poison b/test/sys/kernel/slab/ip_dst_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_dst_cache/reclaim_account b/test/sys/kernel/slab/ip_dst_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_dst_cache/red_zone b/test/sys/kernel/slab/ip_dst_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_dst_cache/sanity_checks b/test/sys/kernel/slab/ip_dst_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_dst_cache/shrink b/test/sys/kernel/slab/ip_dst_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip_dst_cache/slab_size b/test/sys/kernel/slab/ip_dst_cache/slab_size new file mode 100644 index 0000000000..e45b99e958 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/slab_size @@ -0,0 +1 @@ +384 diff --git a/test/sys/kernel/slab/ip_dst_cache/slabs b/test/sys/kernel/slab/ip_dst_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/ip_dst_cache/store_user b/test/sys/kernel/slab/ip_dst_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_dst_cache/total_objects b/test/sys/kernel/slab/ip_dst_cache/total_objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/total_objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/ip_dst_cache/trace b/test/sys/kernel/slab/ip_dst_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_dst_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_dst_cache/validate b/test/sys/kernel/slab/ip_dst_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip_fib_alias/aliases b/test/sys/kernel/slab/ip_fib_alias/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/align b/test/sys/kernel/slab/ip_fib_alias/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/alloc_calls b/test/sys/kernel/slab/ip_fib_alias/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/ip_fib_alias/cache_dma b/test/sys/kernel/slab/ip_fib_alias/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/cpu_slabs b/test/sys/kernel/slab/ip_fib_alias/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/ctor b/test/sys/kernel/slab/ip_fib_alias/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu b/test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/free_calls b/test/sys/kernel/slab/ip_fib_alias/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/ip_fib_alias/hwcache_align b/test/sys/kernel/slab/ip_fib_alias/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/object_size b/test/sys/kernel/slab/ip_fib_alias/object_size new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/object_size @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/ip_fib_alias/objects b/test/sys/kernel/slab/ip_fib_alias/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/objects_partial b/test/sys/kernel/slab/ip_fib_alias/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/objs_per_slab b/test/sys/kernel/slab/ip_fib_alias/objs_per_slab new file mode 100644 index 0000000000..a2720097dc --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/objs_per_slab @@ -0,0 +1 @@ +39 diff --git a/test/sys/kernel/slab/ip_fib_alias/order b/test/sys/kernel/slab/ip_fib_alias/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/partial b/test/sys/kernel/slab/ip_fib_alias/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/poison b/test/sys/kernel/slab/ip_fib_alias/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_fib_alias/reclaim_account b/test/sys/kernel/slab/ip_fib_alias/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/red_zone b/test/sys/kernel/slab/ip_fib_alias/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_fib_alias/sanity_checks b/test/sys/kernel/slab/ip_fib_alias/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_fib_alias/shrink b/test/sys/kernel/slab/ip_fib_alias/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip_fib_alias/slab_size b/test/sys/kernel/slab/ip_fib_alias/slab_size new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/slab_size @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/ip_fib_alias/slabs b/test/sys/kernel/slab/ip_fib_alias/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/store_user b/test/sys/kernel/slab/ip_fib_alias/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_fib_alias/total_objects b/test/sys/kernel/slab/ip_fib_alias/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/trace b/test/sys/kernel/slab/ip_fib_alias/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_alias/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_alias/validate b/test/sys/kernel/slab/ip_fib_alias/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip_fib_hash/aliases b/test/sys/kernel/slab/ip_fib_hash/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/align b/test/sys/kernel/slab/ip_fib_hash/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/alloc_calls b/test/sys/kernel/slab/ip_fib_hash/alloc_calls new file mode 100644 index 0000000000..52c20147bb --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/alloc_calls @@ -0,0 +1 @@ + 11 fn_hash_insert+0x5a6/0x800 age=64575/88591/107942 pid=1197-1541 cpus=0-1 diff --git a/test/sys/kernel/slab/ip_fib_hash/cache_dma b/test/sys/kernel/slab/ip_fib_hash/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/cpu_slabs b/test/sys/kernel/slab/ip_fib_hash/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/ctor b/test/sys/kernel/slab/ip_fib_hash/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu b/test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/free_calls b/test/sys/kernel/slab/ip_fib_hash/free_calls new file mode 100644 index 0000000000..451205ccc3 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/free_calls @@ -0,0 +1,2 @@ + 7 age=4294787468 pid=0 cpus=0 + 4 fn_hash_delete+0x22c/0x290 age=107945/107945/107945 pid=1195 cpus=1 diff --git a/test/sys/kernel/slab/ip_fib_hash/hwcache_align b/test/sys/kernel/slab/ip_fib_hash/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/object_size b/test/sys/kernel/slab/ip_fib_hash/object_size new file mode 100644 index 0000000000..ea70ce0134 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/object_size @@ -0,0 +1 @@ +72 diff --git a/test/sys/kernel/slab/ip_fib_hash/objects b/test/sys/kernel/slab/ip_fib_hash/objects new file mode 100644 index 0000000000..f6b91e0e1f --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/objects @@ -0,0 +1 @@ +56 diff --git a/test/sys/kernel/slab/ip_fib_hash/objects_partial b/test/sys/kernel/slab/ip_fib_hash/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/objs_per_slab b/test/sys/kernel/slab/ip_fib_hash/objs_per_slab new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/objs_per_slab @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/ip_fib_hash/order b/test/sys/kernel/slab/ip_fib_hash/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/partial b/test/sys/kernel/slab/ip_fib_hash/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/poison b/test/sys/kernel/slab/ip_fib_hash/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_fib_hash/reclaim_account b/test/sys/kernel/slab/ip_fib_hash/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/red_zone b/test/sys/kernel/slab/ip_fib_hash/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_fib_hash/sanity_checks b/test/sys/kernel/slab/ip_fib_hash/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_fib_hash/shrink b/test/sys/kernel/slab/ip_fib_hash/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ip_fib_hash/slab_size b/test/sys/kernel/slab/ip_fib_hash/slab_size new file mode 100644 index 0000000000..a29644e57e --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/slab_size @@ -0,0 +1 @@ +144 diff --git a/test/sys/kernel/slab/ip_fib_hash/slabs b/test/sys/kernel/slab/ip_fib_hash/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/ip_fib_hash/store_user b/test/sys/kernel/slab/ip_fib_hash/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ip_fib_hash/total_objects b/test/sys/kernel/slab/ip_fib_hash/total_objects new file mode 100644 index 0000000000..f6b91e0e1f --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/total_objects @@ -0,0 +1 @@ +56 diff --git a/test/sys/kernel/slab/ip_fib_hash/trace b/test/sys/kernel/slab/ip_fib_hash/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ip_fib_hash/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ip_fib_hash/validate b/test/sys/kernel/slab/ip_fib_hash/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/journal_handle/aliases b/test/sys/kernel/slab/journal_handle/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/align b/test/sys/kernel/slab/journal_handle/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/alloc_calls b/test/sys/kernel/slab/journal_handle/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/journal_handle/cache_dma b/test/sys/kernel/slab/journal_handle/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/cpu_slabs b/test/sys/kernel/slab/journal_handle/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/ctor b/test/sys/kernel/slab/journal_handle/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/journal_handle/destroy_by_rcu b/test/sys/kernel/slab/journal_handle/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/free_calls b/test/sys/kernel/slab/journal_handle/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/journal_handle/hwcache_align b/test/sys/kernel/slab/journal_handle/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/object_size b/test/sys/kernel/slab/journal_handle/object_size new file mode 100644 index 0000000000..f6b91e0e1f --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/object_size @@ -0,0 +1 @@ +56 diff --git a/test/sys/kernel/slab/journal_handle/objects b/test/sys/kernel/slab/journal_handle/objects new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/objects @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/journal_handle/objects_partial b/test/sys/kernel/slab/journal_handle/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/objs_per_slab b/test/sys/kernel/slab/journal_handle/objs_per_slab new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/objs_per_slab @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/journal_handle/order b/test/sys/kernel/slab/journal_handle/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/partial b/test/sys/kernel/slab/journal_handle/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/poison b/test/sys/kernel/slab/journal_handle/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_handle/reclaim_account b/test/sys/kernel/slab/journal_handle/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_handle/red_zone b/test/sys/kernel/slab/journal_handle/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_handle/sanity_checks b/test/sys/kernel/slab/journal_handle/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_handle/shrink b/test/sys/kernel/slab/journal_handle/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/journal_handle/slab_size b/test/sys/kernel/slab/journal_handle/slab_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/slab_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/journal_handle/slabs b/test/sys/kernel/slab/journal_handle/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/journal_handle/store_user b/test/sys/kernel/slab/journal_handle/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_handle/total_objects b/test/sys/kernel/slab/journal_handle/total_objects new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/total_objects @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/journal_handle/trace b/test/sys/kernel/slab/journal_handle/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_handle/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_handle/validate b/test/sys/kernel/slab/journal_handle/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/journal_head/aliases b/test/sys/kernel/slab/journal_head/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/align b/test/sys/kernel/slab/journal_head/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/alloc_calls b/test/sys/kernel/slab/journal_head/alloc_calls new file mode 100644 index 0000000000..fa5e243906 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/alloc_calls @@ -0,0 +1 @@ + 7780 journal_add_journal_head+0x9f/0x1b0 age=1/1624/112408 pid=878-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/journal_head/cache_dma b/test/sys/kernel/slab/journal_head/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/cpu_slabs b/test/sys/kernel/slab/journal_head/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/ctor b/test/sys/kernel/slab/journal_head/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/journal_head/destroy_by_rcu b/test/sys/kernel/slab/journal_head/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/free_calls b/test/sys/kernel/slab/journal_head/free_calls new file mode 100644 index 0000000000..ca9861a037 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/free_calls @@ -0,0 +1,2 @@ + 7679 age=4294787975 pid=0 cpus=0 + 102 __journal_remove_journal_head+0xcb/0x160 age=669/27324/77100 pid=32-2881 cpus=0-1 diff --git a/test/sys/kernel/slab/journal_head/hwcache_align b/test/sys/kernel/slab/journal_head/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/object_size b/test/sys/kernel/slab/journal_head/object_size new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/journal_head/object_size @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/journal_head/objects b/test/sys/kernel/slab/journal_head/objects new file mode 100644 index 0000000000..70e17279ef --- /dev/null +++ b/test/sys/kernel/slab/journal_head/objects @@ -0,0 +1 @@ +7800 diff --git a/test/sys/kernel/slab/journal_head/objects_partial b/test/sys/kernel/slab/journal_head/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/objs_per_slab b/test/sys/kernel/slab/journal_head/objs_per_slab new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/objs_per_slab @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/journal_head/order b/test/sys/kernel/slab/journal_head/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/partial b/test/sys/kernel/slab/journal_head/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/poison b/test/sys/kernel/slab/journal_head/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_head/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_head/reclaim_account b/test/sys/kernel/slab/journal_head/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_head/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_head/red_zone b/test/sys/kernel/slab/journal_head/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_head/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_head/sanity_checks b/test/sys/kernel/slab/journal_head/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_head/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_head/shrink b/test/sys/kernel/slab/journal_head/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/journal_head/slab_size b/test/sys/kernel/slab/journal_head/slab_size new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/slab_size @@ -0,0 +1 @@ +168 diff --git a/test/sys/kernel/slab/journal_head/slabs b/test/sys/kernel/slab/journal_head/slabs new file mode 100644 index 0000000000..6ac793b42c --- /dev/null +++ b/test/sys/kernel/slab/journal_head/slabs @@ -0,0 +1 @@ +325 diff --git a/test/sys/kernel/slab/journal_head/store_user b/test/sys/kernel/slab/journal_head/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/journal_head/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/journal_head/total_objects b/test/sys/kernel/slab/journal_head/total_objects new file mode 100644 index 0000000000..70e17279ef --- /dev/null +++ b/test/sys/kernel/slab/journal_head/total_objects @@ -0,0 +1 @@ +7800 diff --git a/test/sys/kernel/slab/journal_head/trace b/test/sys/kernel/slab/journal_head/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/journal_head/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/journal_head/validate b/test/sys/kernel/slab/journal_head/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kcopyd_job/aliases b/test/sys/kernel/slab/kcopyd_job/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/align b/test/sys/kernel/slab/kcopyd_job/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kcopyd_job/alloc_calls b/test/sys/kernel/slab/kcopyd_job/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/kcopyd_job/cache_dma b/test/sys/kernel/slab/kcopyd_job/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/cpu_slabs b/test/sys/kernel/slab/kcopyd_job/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/ctor b/test/sys/kernel/slab/kcopyd_job/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kcopyd_job/destroy_by_rcu b/test/sys/kernel/slab/kcopyd_job/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/free_calls b/test/sys/kernel/slab/kcopyd_job/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/kcopyd_job/hwcache_align b/test/sys/kernel/slab/kcopyd_job/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/object_size b/test/sys/kernel/slab/kcopyd_job/object_size new file mode 100644 index 0000000000..68cfb10d1c --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/object_size @@ -0,0 +1 @@ +472 diff --git a/test/sys/kernel/slab/kcopyd_job/objects b/test/sys/kernel/slab/kcopyd_job/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/objects_partial b/test/sys/kernel/slab/kcopyd_job/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/objs_per_slab b/test/sys/kernel/slab/kcopyd_job/objs_per_slab new file mode 100644 index 0000000000..60d3b2f4a4 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/objs_per_slab @@ -0,0 +1 @@ +15 diff --git a/test/sys/kernel/slab/kcopyd_job/order b/test/sys/kernel/slab/kcopyd_job/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kcopyd_job/partial b/test/sys/kernel/slab/kcopyd_job/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/poison b/test/sys/kernel/slab/kcopyd_job/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kcopyd_job/reclaim_account b/test/sys/kernel/slab/kcopyd_job/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/red_zone b/test/sys/kernel/slab/kcopyd_job/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kcopyd_job/sanity_checks b/test/sys/kernel/slab/kcopyd_job/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kcopyd_job/shrink b/test/sys/kernel/slab/kcopyd_job/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kcopyd_job/slab_size b/test/sys/kernel/slab/kcopyd_job/slab_size new file mode 100644 index 0000000000..4970e693e1 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/slab_size @@ -0,0 +1 @@ +544 diff --git a/test/sys/kernel/slab/kcopyd_job/slabs b/test/sys/kernel/slab/kcopyd_job/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/store_user b/test/sys/kernel/slab/kcopyd_job/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kcopyd_job/total_objects b/test/sys/kernel/slab/kcopyd_job/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/trace b/test/sys/kernel/slab/kcopyd_job/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kcopyd_job/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kcopyd_job/validate b/test/sys/kernel/slab/kcopyd_job/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/key_jar/aliases b/test/sys/kernel/slab/key_jar/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/align b/test/sys/kernel/slab/key_jar/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/alloc_calls b/test/sys/kernel/slab/key_jar/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/key_jar/cache_dma b/test/sys/kernel/slab/key_jar/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/cpu_slabs b/test/sys/kernel/slab/key_jar/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/ctor b/test/sys/kernel/slab/key_jar/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/key_jar/destroy_by_rcu b/test/sys/kernel/slab/key_jar/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/free_calls b/test/sys/kernel/slab/key_jar/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/key_jar/hwcache_align b/test/sys/kernel/slab/key_jar/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/key_jar/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/key_jar/object_size b/test/sys/kernel/slab/key_jar/object_size new file mode 100644 index 0000000000..7c022aedd2 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/object_size @@ -0,0 +1 @@ +232 diff --git a/test/sys/kernel/slab/key_jar/objects b/test/sys/kernel/slab/key_jar/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/objects_partial b/test/sys/kernel/slab/key_jar/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/objs_per_slab b/test/sys/kernel/slab/key_jar/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/key_jar/order b/test/sys/kernel/slab/key_jar/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/partial b/test/sys/kernel/slab/key_jar/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/poison b/test/sys/kernel/slab/key_jar/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/key_jar/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/key_jar/reclaim_account b/test/sys/kernel/slab/key_jar/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/red_zone b/test/sys/kernel/slab/key_jar/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/key_jar/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/key_jar/sanity_checks b/test/sys/kernel/slab/key_jar/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/key_jar/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/key_jar/shrink b/test/sys/kernel/slab/key_jar/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/key_jar/slab_size b/test/sys/kernel/slab/key_jar/slab_size new file mode 100644 index 0000000000..18eed1357e --- /dev/null +++ b/test/sys/kernel/slab/key_jar/slab_size @@ -0,0 +1 @@ +320 diff --git a/test/sys/kernel/slab/key_jar/slabs b/test/sys/kernel/slab/key_jar/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/store_user b/test/sys/kernel/slab/key_jar/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/key_jar/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/key_jar/total_objects b/test/sys/kernel/slab/key_jar/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/trace b/test/sys/kernel/slab/key_jar/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/key_jar/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/key_jar/validate b/test/sys/kernel/slab/key_jar/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kiocb/aliases b/test/sys/kernel/slab/kiocb/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/align b/test/sys/kernel/slab/kiocb/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kiocb/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kiocb/alloc_calls b/test/sys/kernel/slab/kiocb/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/kiocb/cache_dma b/test/sys/kernel/slab/kiocb/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/cpu_slabs b/test/sys/kernel/slab/kiocb/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/ctor b/test/sys/kernel/slab/kiocb/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kiocb/destroy_by_rcu b/test/sys/kernel/slab/kiocb/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/free_calls b/test/sys/kernel/slab/kiocb/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/kiocb/hwcache_align b/test/sys/kernel/slab/kiocb/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kiocb/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kiocb/object_size b/test/sys/kernel/slab/kiocb/object_size new file mode 100644 index 0000000000..eb08bc0b0b --- /dev/null +++ b/test/sys/kernel/slab/kiocb/object_size @@ -0,0 +1 @@ +240 diff --git a/test/sys/kernel/slab/kiocb/objects b/test/sys/kernel/slab/kiocb/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/objects_partial b/test/sys/kernel/slab/kiocb/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/objs_per_slab b/test/sys/kernel/slab/kiocb/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/kiocb/order b/test/sys/kernel/slab/kiocb/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/partial b/test/sys/kernel/slab/kiocb/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/poison b/test/sys/kernel/slab/kiocb/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kiocb/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kiocb/reclaim_account b/test/sys/kernel/slab/kiocb/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/red_zone b/test/sys/kernel/slab/kiocb/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kiocb/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kiocb/sanity_checks b/test/sys/kernel/slab/kiocb/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kiocb/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kiocb/shrink b/test/sys/kernel/slab/kiocb/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kiocb/slab_size b/test/sys/kernel/slab/kiocb/slab_size new file mode 100644 index 0000000000..18eed1357e --- /dev/null +++ b/test/sys/kernel/slab/kiocb/slab_size @@ -0,0 +1 @@ +320 diff --git a/test/sys/kernel/slab/kiocb/slabs b/test/sys/kernel/slab/kiocb/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/store_user b/test/sys/kernel/slab/kiocb/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kiocb/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kiocb/total_objects b/test/sys/kernel/slab/kiocb/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/trace b/test/sys/kernel/slab/kiocb/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kiocb/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kiocb/validate b/test/sys/kernel/slab/kiocb/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kioctx/aliases b/test/sys/kernel/slab/kioctx/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/align b/test/sys/kernel/slab/kioctx/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kioctx/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kioctx/alloc_calls b/test/sys/kernel/slab/kioctx/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/kioctx/cache_dma b/test/sys/kernel/slab/kioctx/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/cpu_slabs b/test/sys/kernel/slab/kioctx/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/ctor b/test/sys/kernel/slab/kioctx/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kioctx/destroy_by_rcu b/test/sys/kernel/slab/kioctx/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/free_calls b/test/sys/kernel/slab/kioctx/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/kioctx/hwcache_align b/test/sys/kernel/slab/kioctx/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kioctx/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kioctx/object_size b/test/sys/kernel/slab/kioctx/object_size new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/kernel/slab/kioctx/object_size @@ -0,0 +1 @@ +512 diff --git a/test/sys/kernel/slab/kioctx/objects b/test/sys/kernel/slab/kioctx/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/objects_partial b/test/sys/kernel/slab/kioctx/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/objs_per_slab b/test/sys/kernel/slab/kioctx/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/kioctx/order b/test/sys/kernel/slab/kioctx/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kioctx/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kioctx/partial b/test/sys/kernel/slab/kioctx/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/poison b/test/sys/kernel/slab/kioctx/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kioctx/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kioctx/reclaim_account b/test/sys/kernel/slab/kioctx/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/red_zone b/test/sys/kernel/slab/kioctx/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kioctx/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kioctx/sanity_checks b/test/sys/kernel/slab/kioctx/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kioctx/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kioctx/shrink b/test/sys/kernel/slab/kioctx/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kioctx/slab_size b/test/sys/kernel/slab/kioctx/slab_size new file mode 100644 index 0000000000..fe4d93ae13 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/slab_size @@ -0,0 +1 @@ +640 diff --git a/test/sys/kernel/slab/kioctx/slabs b/test/sys/kernel/slab/kioctx/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/store_user b/test/sys/kernel/slab/kioctx/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kioctx/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kioctx/total_objects b/test/sys/kernel/slab/kioctx/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/trace b/test/sys/kernel/slab/kioctx/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kioctx/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kioctx/validate b/test/sys/kernel/slab/kioctx/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-1024/aliases b/test/sys/kernel/slab/kmalloc-1024/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-1024/align b/test/sys/kernel/slab/kmalloc-1024/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-1024/alloc_calls b/test/sys/kernel/slab/kmalloc-1024/alloc_calls new file mode 100644 index 0000000000..862cfe5772 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/alloc_calls @@ -0,0 +1,51 @@ + 23 __register_sysctl_paths+0x56/0x340 age=100613/109478/120266 pid=1-1549 cpus=0-1 + 5 param_sysfs_setup+0x87/0x140 age=96047/112423/120406 pid=1-1805 cpus=0-1 + 5 load_module+0x18d5/0x1b30 age=68904/105783/116261 pid=208-2578 cpus=0 + 2 __vmalloc_area_node+0xfb/0x140 age=100667/107844/115021 pid=107-1549 cpus=0 + 4 __percpu_alloc_mask+0xbc/0x140 age=120257/120257/120257 pid=1 cpus=0 + 114 alloc_pipe_info+0x25/0x60 age=15551/82744/117562 pid=1-2851 cpus=0-1 + 2 alloc_fdtable+0x81/0x160 age=97286/97286/97287 pid=1690 cpus=0 + 1 mb_cache_create+0xb6/0x1f0 age=120247 pid=1 cpus=1 + 1 mb_cache_create+0x11e/0x1f0 age=120247 pid=1 cpus=1 + 8 add_partition+0x45/0x250 age=38488/109550/119703 pid=1-2761 cpus=0 + 2 __crypto_alloc_tfm+0x43/0x1b0 age=68903/68903/68903 pid=1545 cpus=0 + 1 pci_create_bus+0x82/0x240 age=120328 pid=1 cpus=0 + 14 pcie_port_device_register+0x254/0x4a0 age=120243/120243/120245 pid=1 cpus=1 + 1 acpi_ev_create_gpe_block+0x10b/0x3bf age=120400 pid=1 cpus=0 + 1 acpi_tb_resize_root_table_list+0x66/0xdb age=116228 pid=330 cpus=0 + 1 tty_buffer_request_room+0x136/0x190 age=71250 pid=2262 cpus=0 + 1 tty_register_driver+0x1b3/0x2a0 age=49578 pid=2711 cpus=1 + 10 tty_write+0x160/0x280 age=62772/90642/118156 pid=34-2612 cpus=0-1 + 2 set_inverse_trans_unicode+0xce/0xf0 age=95511/107876/120242 pid=1-1898 cpus=1 + 1 uart_register_driver+0x31/0x1c0 age=120207 pid=1 cpus=1 + 166 device_create_vargs+0x8c/0x100 age=38482/112879/120408 pid=1-2761 cpus=0-1 + 8 platform_device_alloc+0x37/0x90 age=107669/117282/120408 pid=1-1285 cpus=0-1 + 3 scsi_alloc_target+0x63/0x2e0 age=38506/92606/119822 pid=1-2761 cpus=0-1 + 2 sd_probe+0x86/0x430 age=38501/79159/119818 pid=1-2761 cpus=0-1 + 1 ahci_port_start+0x34/0xe0 age=120205 pid=1 cpus=1 + 1 psmouse_connect+0x5b/0x2c0 age=119395 pid=17 cpus=1 + 2 thermal_cooling_device_register+0x7f/0x290 age=116140/116164/116189 pid=330 cpus=0-1 + 1 hid_add_field+0xcc/0x3a0 age=112759 pid=803 cpus=0 + 4 sock_alloc_send_skb+0x1cd/0x200 age=85272/89763/91423 pid=1738 cpus=0-1 + 3 __rtnl_register+0x79/0x90 age=100616/113763/120409 pid=1-1549 cpus=0 + 6 qdisc_alloc+0x34/0xd0 age=96540/96576/96754 pid=1541 cpus=0 + 1 dmi_id_init+0x2a4/0x30c age=120407 pid=1 cpus=0 + 5 hub_probe+0xdd/0x820 [usbcore] age=114496/114989/115342 pid=143-147 cpus=0-1 + 5 usb_create_hcd+0x39/0x150 [usbcore] age=114568/115023/115389 pid=143-147 cpus=0 + 26 usb_set_configuration+0x441/0x5f0 [usbcore] age=43635/76676/115354 pid=143-419 cpus=0-1 + 10 usb_get_configuration+0x92/0x1480 [usbcore] age=43637/100791/115362 pid=143-419 cpus=0-1 + 34 usb_create_ep_files+0x51/0x350 [usbcore] age=43632/94424/115229 pid=143-419 cpus=0-1 + 1 acpi_battery_add+0x29/0x1d3 [battery] age=116127 pid=396 cpus=0 + 1 snd_card_new+0x38/0x370 [snd] age=114633 pid=107 cpus=0 + 1 sta_info_alloc+0x3c/0x1d0 [mac80211] age=70020 pid=742 cpus=0 + 2 snd_pcm_new+0x47/0x130 [snd_pcm] age=114606/114606/114606 pid=107 cpus=1 + 1 rs_alloc_sta+0x25/0x120 [iwl3945] age=70020 pid=742 cpus=0 + 1 get_alloc_hash+0x9b/0x140 [snd_hda_intel] age=113605 pid=786 cpus=0 + 1 azx_probe+0xb3/0xc20 [snd_hda_intel] age=114626 pid=107 cpus=0 + 1 azx_probe+0x4a9/0xc20 [snd_hda_intel] age=114619 pid=107 cpus=0 + 1 snd_hda_codec_new+0x3e/0x559 [snd_hda_intel] age=114609 pid=107 cpus=1 + 1 md_probe+0xa1/0x360 [md_mod] age=110680 pid=916 cpus=0 + 8 loop_alloc+0x28/0x140 [loop] age=110136/110136/110136 pid=951 cpus=0 + 4 ipv6_add_dev+0x69/0x330 [ipv6] age=100613/100614/100616 pid=1549 cpus=0 + 1 ipv6_route_sysctl_init+0x22/0xb0 [ipv6] age=100612 pid=1549 cpus=0 + 2 snd_seq_create_port+0x35/0x180 [snd_seq] age=96046/96046/96046 pid=1805 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-1024/cache_dma b/test/sys/kernel/slab/kmalloc-1024/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-1024/cpu_slabs b/test/sys/kernel/slab/kmalloc-1024/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-1024/ctor b/test/sys/kernel/slab/kmalloc-1024/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-1024/free_calls b/test/sys/kernel/slab/kmalloc-1024/free_calls new file mode 100644 index 0000000000..b456b99143 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/free_calls @@ -0,0 +1,10 @@ + 220 age=4294787840 pid=0 cpus=0 + 1 __vunmap+0xe9/0x120 age=100634 pid=1549 cpus=0 + 65 __free_pipe_info+0x5c/0x70 age=16787/95741/118165 pid=34-2846 cpus=0-1 + 19 acpi_ds_delete_walk_state+0xc9/0xcd age=96311/116725/120497 pid=0-1772 cpus=0-1 + 1 acpi_tb_resize_root_table_list+0xbf/0xdb age=116229 pid=330 cpus=0 + 2 release_one_tty+0xc7/0x190 age=92973/101877/110781 pid=55-1253 cpus=0-1 + 1 vt_ioctl+0x273/0x1c30 age=97095 pid=1703 cpus=0 + 14 device_create_release+0x9/0x10 age=92892/95125/97095 pid=1703-2139 cpus=0-1 + 1 fw_dev_release+0x20/0x30 age=96645 pid=1541 cpus=0 + 179 skb_release_data+0x85/0xd0 age=16789/86800/120408 pid=0-2737 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-1024/hwcache_align b/test/sys/kernel/slab/kmalloc-1024/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-1024/object_size b/test/sys/kernel/slab/kmalloc-1024/object_size new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/object_size @@ -0,0 +1 @@ +1024 diff --git a/test/sys/kernel/slab/kmalloc-1024/objects b/test/sys/kernel/slab/kmalloc-1024/objects new file mode 100644 index 0000000000..2d8c4cdf72 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/objects @@ -0,0 +1 @@ +534 diff --git a/test/sys/kernel/slab/kmalloc-1024/objects_partial b/test/sys/kernel/slab/kmalloc-1024/objects_partial new file mode 100644 index 0000000000..3ad5abd03a --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/objects_partial @@ -0,0 +1 @@ +99 diff --git a/test/sys/kernel/slab/kmalloc-1024/objs_per_slab b/test/sys/kernel/slab/kmalloc-1024/objs_per_slab new file mode 100644 index 0000000000..f04c001f3f --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/objs_per_slab @@ -0,0 +1 @@ +29 diff --git a/test/sys/kernel/slab/kmalloc-1024/order b/test/sys/kernel/slab/kmalloc-1024/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/kmalloc-1024/partial b/test/sys/kernel/slab/kmalloc-1024/partial new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/partial @@ -0,0 +1 @@ +4 diff --git a/test/sys/kernel/slab/kmalloc-1024/poison b/test/sys/kernel/slab/kmalloc-1024/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-1024/reclaim_account b/test/sys/kernel/slab/kmalloc-1024/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-1024/red_zone b/test/sys/kernel/slab/kmalloc-1024/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-1024/sanity_checks b/test/sys/kernel/slab/kmalloc-1024/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-1024/shrink b/test/sys/kernel/slab/kmalloc-1024/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-1024/slab_size b/test/sys/kernel/slab/kmalloc-1024/slab_size new file mode 100644 index 0000000000..ba851d8439 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/slab_size @@ -0,0 +1 @@ +1096 diff --git a/test/sys/kernel/slab/kmalloc-1024/slabs b/test/sys/kernel/slab/kmalloc-1024/slabs new file mode 100644 index 0000000000..d6b24041cf --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/slabs @@ -0,0 +1 @@ +19 diff --git a/test/sys/kernel/slab/kmalloc-1024/store_user b/test/sys/kernel/slab/kmalloc-1024/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-1024/total_objects b/test/sys/kernel/slab/kmalloc-1024/total_objects new file mode 100644 index 0000000000..0eedeef9da --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/total_objects @@ -0,0 +1 @@ +551 diff --git a/test/sys/kernel/slab/kmalloc-1024/trace b/test/sys/kernel/slab/kmalloc-1024/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-1024/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-1024/validate b/test/sys/kernel/slab/kmalloc-1024/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-128/aliases b/test/sys/kernel/slab/kmalloc-128/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-128/align b/test/sys/kernel/slab/kmalloc-128/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-128/alloc_calls b/test/sys/kernel/slab/kmalloc-128/alloc_calls new file mode 100644 index 0000000000..c64f53b8f6 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/alloc_calls @@ -0,0 +1,36 @@ + 17 param_sysfs_setup+0x87/0x140 age=106893/117027/120430 pid=1-1358 cpus=0-1 + 1 mempool_create_node+0x4b/0xf0 age=119516 pid=1 cpus=0 + 4 __vmalloc_area_node+0xfb/0x140 age=43540/90099/110841 pid=900-2754 cpus=0 + 2 shmem_fill_super+0x38/0x200 age=118075/119177/120279 pid=1-46 cpus=0-1 + 56 __percpu_alloc_mask+0xbc/0x140 age=38507/106559/120290 pid=1-2761 cpus=0-1 + 11 cdev_alloc+0x1a/0x50 age=38507/111069/120429 pid=1-2761 cpus=0-1 + 110 d_alloc+0x19d/0x1f0 age=38218/95106/116556 pid=401-2802 cpus=0-1 + 2 bm_register_write+0x63/0x630 age=94544/94544/94544 pid=2054 cpus=1 + 2 alloc_disk_node+0x6c/0x120 age=38525/79183/119842 pid=1-2761 cpus=0-1 + 20 ida_pre_get+0x86/0x90 age=38525/112635/120567 pid=0-2761 cpus=0-1 + 5 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120396/120405/120409 pid=1 cpus=0 + 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120412/120412/120412 pid=1 cpus=0 + 1 acpi_ev_create_gpe_block+0xb2/0x3bf age=120424 pid=1 cpus=0 + 4 acpi_add_single_object+0x5d8/0xd3c age=120353/120360/120364 pid=1 cpus=0 + 41 con_insert_unipair+0xd6/0x110 age=95535/110011/120266 pid=1-1898 cpus=1 + 2 thermal_zone_bind_cooling_device+0xde/0x2a0 age=115319/115319/115319 pid=329 cpus=0 + 4 led_trigger_register_simple+0x2b/0x80 age=116106/116150/116284 pid=392-396 cpus=0 + 1 sock_kmalloc+0x5c/0x70 age=68835 pid=2586 cpus=0 + 3 alloc_netdev_mq+0x6c/0x180 age=114103/117022/120305 pid=1-126 cpus=0-1 + 2 neigh_table_init_no_netlink+0xd2/0x250 age=100645/110467/120290 pid=1-1549 cpus=0 + 8 neigh_parms_alloc+0x5d/0x110 age=100637/108467/120290 pid=1-1549 cpus=0-1 + 4 fz_hash_alloc+0x4a/0x60 age=65984/97741/108353 pid=1185-1541 cpus=0-1 + 1 get_local_pda+0x39/0x9b age=120506 pid=1 cpus=0 + 1 mnt_init+0xf9/0x202 age=120567 pid=0 cpus=0 + 1 net_ns_init+0x49/0x16d age=120433 pid=1 cpus=0 + 3 sg_add+0x8c/0x400 [sg] age=38507/90683/116775 pid=169-2761 cpus=0 + 3 usb_get_configuration+0x5f2/0x1480 [usbcore] age=49744/49744/49744 pid=419 cpus=0 + 15 usb_get_configuration+0x1388/0x1480 [usbcore] age=43661/78952/113203 pid=419 cpus=0 + 1 0xffffffffa0065117 age=115268 pid=107 cpus=1 + 1 ieee80211_led_init+0x1b/0x230 [mac80211] age=114103 pid=126 cpus=1 + 1 ieee80211_led_init+0x83/0x230 [mac80211] age=114103 pid=126 cpus=1 + 1 ieee80211_led_init+0xeb/0x230 [mac80211] age=114102 pid=126 cpus=1 + 1 ieee80211_led_init+0x153/0x230 [mac80211] age=114102 pid=126 cpus=1 + 1 snd_hda_codec_new+0x1ec/0x559 [snd_hda_intel] age=114633 pid=107 cpus=1 + 1 md_register_thread+0x35/0xd0 [md_mod] age=110579 pid=916 cpus=0 + 1 fib6_net_init+0x7e/0x130 [ipv6] age=100640 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-128/cache_dma b/test/sys/kernel/slab/kmalloc-128/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-128/cpu_slabs b/test/sys/kernel/slab/kmalloc-128/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-128/ctor b/test/sys/kernel/slab/kmalloc-128/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-128/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-128/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-128/free_calls b/test/sys/kernel/slab/kmalloc-128/free_calls new file mode 100644 index 0000000000..f21aabec05 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/free_calls @@ -0,0 +1,14 @@ + 216 age=4294787863 pid=0 cpus=0 + 3 call_usermodehelper_freeinfo+0x27/0x30 age=100636/108439/114103 pid=745-1532 cpus=0 + 2 __vunmap+0xe9/0x120 age=115971/116373/116775 pid=105-169 cpus=0 + 25 d_callback+0x22/0x40 age=38470/99254/115952 pid=0-2778 cpus=0-1 + 50 load_elf_binary+0xaf/0x1e20 age=38383/102338/118076 pid=46-2792 cpus=0-1 + 2 free_rb_tree_fname+0x5c/0xb0 age=71751/89529/107307 pid=1274-2262 cpus=0 + 2 free_bitmap+0x29/0x80 age=108544/109515/110486 pid=55 cpus=0-1 + 1 acpi_evaluate_reference+0x100/0x117 age=115320 pid=329 cpus=0 + 6 acpi_get_object_info+0x1b6/0x1d4 age=120227/120332/120364 pid=1 cpus=0-1 + 4 do_acpi_find_child+0x48/0x51 age=119700/120149/120341 pid=1 cpus=0-1 + 20 con_release_unimap+0x4d/0xc0 age=95439/95449/95505 pid=1913-1944 cpus=0-1 + 1 unpack_to_rootfs+0x105/0xa39 age=120281 pid=1 cpus=0 + 1 acpi_processor_get_throttling_info+0x15e/0x58c [processor] age=116174 pid=330 cpus=0 + 1 acpi_battery_get_state+0xe5/0xf6 [battery] age=46035 pid=1371 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-128/hwcache_align b/test/sys/kernel/slab/kmalloc-128/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-128/object_size b/test/sys/kernel/slab/kmalloc-128/object_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/object_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/kmalloc-128/objects b/test/sys/kernel/slab/kmalloc-128/objects new file mode 100644 index 0000000000..bc23f8ef56 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/objects @@ -0,0 +1 @@ +354 diff --git a/test/sys/kernel/slab/kmalloc-128/objects_partial b/test/sys/kernel/slab/kmalloc-128/objects_partial new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/objects_partial @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/kmalloc-128/objs_per_slab b/test/sys/kernel/slab/kmalloc-128/objs_per_slab new file mode 100644 index 0000000000..209e3ef4b6 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/objs_per_slab @@ -0,0 +1 @@ +20 diff --git a/test/sys/kernel/slab/kmalloc-128/order b/test/sys/kernel/slab/kmalloc-128/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-128/partial b/test/sys/kernel/slab/kmalloc-128/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-128/poison b/test/sys/kernel/slab/kmalloc-128/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-128/reclaim_account b/test/sys/kernel/slab/kmalloc-128/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-128/red_zone b/test/sys/kernel/slab/kmalloc-128/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-128/sanity_checks b/test/sys/kernel/slab/kmalloc-128/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-128/shrink b/test/sys/kernel/slab/kmalloc-128/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-128/slab_size b/test/sys/kernel/slab/kmalloc-128/slab_size new file mode 100644 index 0000000000..08839f6bb2 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/slab_size @@ -0,0 +1 @@ +200 diff --git a/test/sys/kernel/slab/kmalloc-128/slabs b/test/sys/kernel/slab/kmalloc-128/slabs new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/slabs @@ -0,0 +1 @@ +18 diff --git a/test/sys/kernel/slab/kmalloc-128/store_user b/test/sys/kernel/slab/kmalloc-128/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-128/total_objects b/test/sys/kernel/slab/kmalloc-128/total_objects new file mode 100644 index 0000000000..2921a1584c --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/total_objects @@ -0,0 +1 @@ +360 diff --git a/test/sys/kernel/slab/kmalloc-128/trace b/test/sys/kernel/slab/kmalloc-128/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-128/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-128/validate b/test/sys/kernel/slab/kmalloc-128/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-16/aliases b/test/sys/kernel/slab/kmalloc-16/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-16/align b/test/sys/kernel/slab/kmalloc-16/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-16/alloc_calls b/test/sys/kernel/slab/kmalloc-16/alloc_calls new file mode 100644 index 0000000000..122e2bb017 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/alloc_calls @@ -0,0 +1,41 @@ + 2 arch_acpi_processor_init_pdc+0x71/0x180 age=116222/116253/116284 pid=330 cpus=0 + 2 arch_acpi_processor_init_pdc+0xab/0x180 age=116222/116253/116284 pid=330 cpus=0 + 5 sched_create_group+0x40/0x220 age=92325/99809/107336 pid=1333-2177 cpus=0-1 + 5 sched_create_group+0x62/0x220 age=92325/99809/107336 pid=1333-2177 cpus=0-1 + 2 setup_modinfo_version+0x19/0x30 age=115115/115919/116723 pid=122-126 cpus=0-1 + 365 load_module+0x1ac4/0x1b30 age=43566/109983/116805 pid=105-2754 cpus=0-1 + 13 mempool_create_node+0x4b/0xf0 age=120344/120414/120459 pid=1 cpus=0 + 1 krealloc+0x1e/0x60 age=116287 pid=330 cpus=0 + 4 __vmalloc_area_node+0xfb/0x140 age=115186/115605/116318 pid=126-392 cpus=0 + 7 alloc_vfsmnt+0x97/0x180 age=38189/101712/120338 pid=1-2817 cpus=0-1 + 2 proc_symlink+0x4d/0xb0 age=120597/120597/120597 pid=0 cpus=0 + 1275 sysfs_new_dirent+0x10c/0x120 age=38535/111937/120464 pid=1-2761 cpus=0-1 + 2 ext3_fill_super+0x691/0x1a20 age=110156/114506/118856 pid=1-962 cpus=0 + 406 kvasprintf+0x55/0x90 age=38537/112458/120597 pid=0-2761 cpus=0-1 + 1 bit_cursor+0x223/0x6a0 age=96655 pid=7 cpus=0 + 12 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120429/120431/120439 pid=1 cpus=0 + 14 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120430/120440/120446 pid=1 cpus=0 + 2 acpi_ut_copy_simple_object+0x8f/0x11c age=116142/116150/116159 pid=396 cpus=0 + 5 acpi_irq_stats_init+0x1bd/0x268 age=120454/120454/120454 pid=1 cpus=0 + 14 pnp_add_id+0x1e/0xe0 age=120346/120348/120351 pid=1 cpus=0 + 9 reserve_range+0x39/0x130 age=120335/120335/120335 pid=1 cpus=0 + 1 trackpoint_detect+0x94/0x190 age=119217 pid=17 cpus=0 + 2 proto_register+0xf2/0x260 age=100684/110506/120329 pid=1-1549 cpus=0 + 2 neigh_sysctl_register+0x1cd/0x330 age=100668/107460/114253 pid=126-1549 cpus=0-1 + 1 nl_pid_hash_rehash+0x180/0x1a0 age=101542 pid=1533 cpus=0 + 1 genl_register_family+0x1b6/0x1e0 age=120338 pid=1 cpus=0 + 1 __devinet_sysctl_register+0xb8/0x120 age=114253 pid=126 cpus=1 + 1 pci_acpi_scan_root+0x3f/0x230 age=120382 pid=1 cpus=0 + 1 acpi_parse_mcfg+0x61/0x140 age=120461 pid=1 cpus=0 + 1 pci_mmcfg_arch_init+0x26/0x129 age=120461 pid=1 cpus=0 + 1 icmp_sk_init+0x32/0x13f age=120311 pid=1 cpus=0 + 5 hub_probe+0x26b/0x820 [usbcore] age=114550/115043/115396 pid=143-147 cpus=0-1 + 12 usb_cache_string+0x65/0xa0 [usbcore] age=43690/92354/115416 pid=143-419 cpus=0-1 + 1 usb_create_ep_files+0x283/0x350 [usbcore] age=115283 pid=143 cpus=0 + 1 0xffffffffa006595f age=100676 pid=1549 cpus=0 + 13 snd_info_create_entry+0x30/0xa0 [snd] age=96049/113228/114660 pid=107-1813 cpus=0-1 + 1 snd_oss_info_register+0x40/0xc0 [snd] age=115298 pid=107 cpus=1 + 1 async_chainiv_givencrypt+0xf9/0x110 [crypto_blkcipher] age=115055 pid=215 cpus=0 + 1 eseqiv_alloc+0x6d/0x80 [crypto_blkcipher] age=115055 pid=215 cpus=0 + 1 run+0xa9/0x500 [raid1] age=110609 pid=916 cpus=0 + 1 __addrconf_sysctl_register+0xcd/0x140 [ipv6] age=100668 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-16/cache_dma b/test/sys/kernel/slab/kmalloc-16/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-16/cpu_slabs b/test/sys/kernel/slab/kmalloc-16/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-16/ctor b/test/sys/kernel/slab/kmalloc-16/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-16/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-16/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-16/free_calls b/test/sys/kernel/slab/kmalloc-16/free_calls new file mode 100644 index 0000000000..e77e0a940e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/free_calls @@ -0,0 +1,26 @@ + 1954 age=4294787894 pid=0 cpus=0 + 2 free_sched_group+0x62/0x80 age=115594/115880/116166 pid=0-72 cpus=0-1 + 3 free_sched_group+0x6b/0x80 age=38403/90054/116166 pid=0-72 cpus=0-1 + 3 free_sect_attrs+0x2e/0x50 age=115540/115540/115540 pid=383 cpus=0 + 3 __vunmap+0xe9/0x120 age=114135/115104/115637 pid=181-754 cpus=0 + 4 vfs_rename+0x301/0x450 age=65000/85542/107518 pid=1325-2461 cpus=0 + 8 bio_free_map_data+0x14/0x30 age=38547/60160/119849 pid=0-6 cpus=0-1 + 9 bio_free_map_data+0x1d/0x30 age=38547/82320/119864 pid=0-558 cpus=0-1 + 34 remove_kevent+0x44/0x60 age=60437/70720/94557 pid=1547-2544 cpus=0-1 + 40 release_sysfs_dirent+0x8c/0xd0 age=92939/101608/120263 pid=1-2141 cpus=0-1 + 7 kobject_release+0xe1/0x140 age=96699/106448/114376 pid=419-1541 cpus=0-1 + 69 kobject_uevent_env+0x11a/0x470 age=49635/115467/120464 pid=1-2711 cpus=0-1 + 2 bit_cursor+0x23b/0x6a0 age=96656/108469/120282 pid=1-7 cpus=0-1 + 1 acpi_ds_create_operand+0x12c/0x209 age=120352 pid=1 cpus=0 + 2 acpi_ns_get_node+0x92/0xa1 age=114952/114989/115027 pid=215 cpus=0-1 + 8 acpi_ut_delete_internal_obj+0x15f/0x16f age=106924/115073/116266 pid=330-1358 cpus=0 + 16 acpi_ut_delete_internal_object_list+0x28/0x2f age=114954/119420/120405 pid=1-396 cpus=0 + 2 reserve_range+0x11d/0x130 age=120336/120336/120336 pid=1 cpus=0 + 3 release_firmware+0x57/0x70 age=96699/104006/107667 pid=1285-1541 cpus=0-1 + 8 module_add_driver+0x66/0xd0 age=114023/116361/119751 pid=1-181 cpus=0-1 + 1 power_supply_uevent+0x1a0/0x210 age=116132 pid=7 cpus=0 + 2 get_modalias+0xd4/0x120 age=96320/108391/120462 pid=1-1772 cpus=0 + 1 nl_pid_hash_rehash+0x18e/0x1a0 age=96922 pid=1708 cpus=0 + 2 fib_hash_free+0x35/0x40 age=108384/108384/108384 pid=1185 cpus=0 + 2 wireless_send_event+0x172/0x330 age=70090/83339/96588 pid=1545 cpus=0-1 + 11 usb_get_configuration+0x42d/0x1480 [usbcore] age=43692/102097/115417 pid=143-419 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-16/hwcache_align b/test/sys/kernel/slab/kmalloc-16/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-16/object_size b/test/sys/kernel/slab/kmalloc-16/object_size new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/object_size @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/kmalloc-16/objects b/test/sys/kernel/slab/kmalloc-16/objects new file mode 100644 index 0000000000..9dd9fcb909 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/objects @@ -0,0 +1 @@ +2268 diff --git a/test/sys/kernel/slab/kmalloc-16/objects_partial b/test/sys/kernel/slab/kmalloc-16/objects_partial new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/objects_partial @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/kmalloc-16/objs_per_slab b/test/sys/kernel/slab/kmalloc-16/objs_per_slab new file mode 100644 index 0000000000..9e5feb5256 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/objs_per_slab @@ -0,0 +1 @@ +46 diff --git a/test/sys/kernel/slab/kmalloc-16/order b/test/sys/kernel/slab/kmalloc-16/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-16/partial b/test/sys/kernel/slab/kmalloc-16/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-16/poison b/test/sys/kernel/slab/kmalloc-16/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-16/reclaim_account b/test/sys/kernel/slab/kmalloc-16/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-16/red_zone b/test/sys/kernel/slab/kmalloc-16/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-16/sanity_checks b/test/sys/kernel/slab/kmalloc-16/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-16/shrink b/test/sys/kernel/slab/kmalloc-16/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-16/slab_size b/test/sys/kernel/slab/kmalloc-16/slab_size new file mode 100644 index 0000000000..d22307c427 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/slab_size @@ -0,0 +1 @@ +88 diff --git a/test/sys/kernel/slab/kmalloc-16/slabs b/test/sys/kernel/slab/kmalloc-16/slabs new file mode 100644 index 0000000000..e373ee695f --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/slabs @@ -0,0 +1 @@ +50 diff --git a/test/sys/kernel/slab/kmalloc-16/store_user b/test/sys/kernel/slab/kmalloc-16/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-16/total_objects b/test/sys/kernel/slab/kmalloc-16/total_objects new file mode 100644 index 0000000000..0c80f59274 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/total_objects @@ -0,0 +1 @@ +2300 diff --git a/test/sys/kernel/slab/kmalloc-16/trace b/test/sys/kernel/slab/kmalloc-16/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-16/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-16/validate b/test/sys/kernel/slab/kmalloc-16/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-192/aliases b/test/sys/kernel/slab/kmalloc-192/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-192/align b/test/sys/kernel/slab/kmalloc-192/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-192/alloc_calls b/test/sys/kernel/slab/kmalloc-192/alloc_calls new file mode 100644 index 0000000000..08a0c926a1 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/alloc_calls @@ -0,0 +1,33 @@ + 10 sched_create_group+0x91/0x220 age=92334/99818/107345 pid=1333-2177 cpus=0-1 + 10 sched_create_group+0xae/0x220 age=92334/99818/107345 pid=1333-2177 cpus=0-1 + 11 groups_alloc+0x41/0xe0 age=15622/81960/107345 pid=1333-2851 cpus=0-1 + 9 param_sysfs_setup+0x87/0x140 age=43575/109232/120469 pid=1-2754 cpus=0-1 + 18 mempool_create_node+0x2e/0xf0 age=38569/115205/120468 pid=1-2761 cpus=0-1 + 4 __vmalloc_area_node+0xfb/0x140 age=110863/114137/115429 pid=107-901 cpus=0 + 30 __percpu_alloc_mask+0xbc/0x140 age=110873/118282/120473 pid=1-900 cpus=0-1 + 4 d_alloc+0x19d/0x1f0 age=37329/82388/97408 pid=1706-2818 cpus=0-1 + 1 bm_register_write+0x63/0x630 age=94583 pid=2054 cpus=1 + 1 sysfs_open_file+0xd6/0x230 age=0 pid=2890 cpus=0 + 15 ipc_rcu_alloc+0x4a/0x70 age=14665/70537/89120 pid=2177-2621 cpus=0-1 + 28 kset_create_and_add+0x35/0xa0 age=96472/118784/120473 pid=1-1766 cpus=0-1 + 1 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120452 pid=1 cpus=0 + 3 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120449/120449/120450 pid=1 cpus=0 + 1 acpi_power_add+0x4a/0x1d6 age=120363 pid=1 cpus=0 + 2 ata_host_alloc+0x4f/0xf0 age=119753/120011/120269 pid=1 cpus=0-1 + 8 cpuidle_add_state_sysfs+0xc3/0x140 age=116210/116234/116258 pid=330 cpus=0-1 + 1 hid_parse_report+0x43/0x2c0 age=112822 pid=803 cpus=0 + 2 hid_add_field+0x18a/0x3a0 age=112822/112822/112822 pid=803 cpus=0 + 6 fib_create_info+0x61/0x970 age=65009/87020/108376 pid=1197-1541 cpus=0-1 + 1 unix_sysctl_register+0x2a/0x80 age=120320 pid=1 cpus=0 + 1 rtnetlink_init+0x38/0x113 age=120472 pid=1 cpus=0 + 1 inet_diag_init+0x15/0x6b age=119471 pid=1 cpus=0 + 41 usb_alloc_urb+0x19/0x50 [usbcore] age=43573/60551/115393 pid=143-2754 cpus=0-1 + 1 usb_get_configuration+0x5f2/0x1480 [usbcore] age=49783 pid=419 cpus=0 + 2 usb_get_configuration+0x1388/0x1480 [usbcore] age=112867/113054/113242 pid=419 cpus=0 + 1 sr_probe+0x76/0x540 [sr_mod] age=116327 pid=163 cpus=0 + 18 snd_ctl_new+0x28/0x90 [snd] age=114647/114647/114647 pid=107 cpus=1 + 1 iwl3945_pci_probe+0xd3f/0x1020 [iwl3945] age=114269 pid=126 cpus=1 + 1 blkcipher_walk_next+0x29c/0x390 [crypto_blkcipher] age=115035 pid=215 cpus=1 + 3 dm_register_target+0x1f/0xf0 [dm_mod] age=110873/110873/110874 pid=900 cpus=0 + 1 ipv6_icmp_sysctl_init+0x22/0x40 [ipv6] age=100675 pid=1549 cpus=0 + 1 snd_seq_pool_new+0x1b/0x80 [snd_seq] age=96109 pid=1805 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-192/cache_dma b/test/sys/kernel/slab/kmalloc-192/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-192/cpu_slabs b/test/sys/kernel/slab/kmalloc-192/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-192/ctor b/test/sys/kernel/slab/kmalloc-192/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-192/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-192/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-192/free_calls b/test/sys/kernel/slab/kmalloc-192/free_calls new file mode 100644 index 0000000000..0ddc2715ba --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/free_calls @@ -0,0 +1,15 @@ + 175 age=4294787903 pid=0 cpus=0 + 4 free_sched_group+0x3b/0x80 age=98418/108735/115603 pid=0-1614 cpus=0-1 + 2 free_sched_group+0x50/0x80 age=98418/104439/110461 pid=0-1614 cpus=0 + 1 do_exit+0x713/0x960 age=73642 pid=2558 cpus=1 + 4 groups_free+0x56/0x60 age=60445/91673/110467 pid=0-1690 cpus=0 + 1 __vunmap+0xe9/0x120 age=96710 pid=1748 cpus=1 + 1 do_readv_writev+0xe4/0x1e0 age=71664 pid=2262 cpus=0 + 4 getxattr+0x8c/0x140 age=1/71510/98419 pid=1610-2890 cpus=0-1 + 24 sysfs_release+0x7c/0xa0 age=16075/92506/116933 pid=220-2765 cpus=0-1 + 1 ipc_immediate_free+0x9/0x10 age=70732 pid=2568 cpus=0 + 1 acpi_pci_irq_add_prt+0x30b/0x324 age=120384 pid=1 cpus=0 + 4 free_fib_info+0x34/0x60 age=108377/108382/108393 pid=1185-1197 cpus=0-1 + 14 urb_destroy+0x23/0x30 [usbcore] age=37330/98920/115394 pid=143-2760 cpus=0-1 + 1 0xffffffffa006521f age=96110 pid=1805 cpus=0 + 1 acpi_processor_get_throttling_info+0x50f/0x58c [processor] age=116261 pid=330 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-192/hwcache_align b/test/sys/kernel/slab/kmalloc-192/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-192/object_size b/test/sys/kernel/slab/kmalloc-192/object_size new file mode 100644 index 0000000000..86a0307199 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/object_size @@ -0,0 +1 @@ +192 diff --git a/test/sys/kernel/slab/kmalloc-192/objects b/test/sys/kernel/slab/kmalloc-192/objects new file mode 100644 index 0000000000..2197544d04 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/objects @@ -0,0 +1 @@ +252 diff --git a/test/sys/kernel/slab/kmalloc-192/objects_partial b/test/sys/kernel/slab/kmalloc-192/objects_partial new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/objects_partial @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/kmalloc-192/objs_per_slab b/test/sys/kernel/slab/kmalloc-192/objs_per_slab new file mode 100644 index 0000000000..60d3b2f4a4 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/objs_per_slab @@ -0,0 +1 @@ +15 diff --git a/test/sys/kernel/slab/kmalloc-192/order b/test/sys/kernel/slab/kmalloc-192/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-192/partial b/test/sys/kernel/slab/kmalloc-192/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-192/poison b/test/sys/kernel/slab/kmalloc-192/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-192/reclaim_account b/test/sys/kernel/slab/kmalloc-192/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-192/red_zone b/test/sys/kernel/slab/kmalloc-192/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-192/sanity_checks b/test/sys/kernel/slab/kmalloc-192/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-192/shrink b/test/sys/kernel/slab/kmalloc-192/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-192/slab_size b/test/sys/kernel/slab/kmalloc-192/slab_size new file mode 100644 index 0000000000..10b0c0dbc8 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/slab_size @@ -0,0 +1 @@ +264 diff --git a/test/sys/kernel/slab/kmalloc-192/slabs b/test/sys/kernel/slab/kmalloc-192/slabs new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/slabs @@ -0,0 +1 @@ +17 diff --git a/test/sys/kernel/slab/kmalloc-192/store_user b/test/sys/kernel/slab/kmalloc-192/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-192/total_objects b/test/sys/kernel/slab/kmalloc-192/total_objects new file mode 100644 index 0000000000..ace9d03621 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/total_objects @@ -0,0 +1 @@ +255 diff --git a/test/sys/kernel/slab/kmalloc-192/trace b/test/sys/kernel/slab/kmalloc-192/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-192/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-192/validate b/test/sys/kernel/slab/kmalloc-192/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-2048/aliases b/test/sys/kernel/slab/kmalloc-2048/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-2048/align b/test/sys/kernel/slab/kmalloc-2048/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-2048/alloc_calls b/test/sys/kernel/slab/kmalloc-2048/alloc_calls new file mode 100644 index 0000000000..9127c14af4 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/alloc_calls @@ -0,0 +1,40 @@ + 53 load_module+0x18d5/0x1b30 age=43508/109019/116747 pid=105-2754 cpus=0-1 + 1 mempool_create_node+0x4b/0xf0 age=110551 pid=916 cpus=0 + 20 sget+0xc4/0x460 age=38130/110987/120539 pid=0-2817 cpus=0-1 + 13 alloc_fdtable+0x81/0x160 age=3786/78813/97733 pid=1532-2676 cpus=0-1 + 2 journal_init_common+0x1a/0x130 age=110094/114444/118794 pid=1-962 cpus=0 + 15 alloc_disk_node+0x1b/0x120 age=38479/102551/119814 pid=1-2761 cpus=0-1 + 1 pci_create_bus+0x3a/0x240 age=120324 pid=1 cpus=0 + 21 alloc_pci_dev+0x1a/0x40 age=120320/120322/120324 pid=1 cpus=0 + 1 framebuffer_alloc+0x3a/0x80 age=120239 pid=1 cpus=1 + 74 acpi_add_single_object+0x4e/0xd3c age=120325/120338/120354 pid=1 cpus=0 + 1 acpi_irq_stats_init+0xcb/0x268 age=120396 pid=1 cpus=0 + 11 pnp_alloc_dev+0x35/0x120 age=120288/120291/120293 pid=1 cpus=0 + 10 init_dev+0x12e/0x6f0 age=66746/94761/118634 pid=33-2593 cpus=0-1 + 2 init_dev+0x2aa/0x6f0 age=66746/85779/104812 pid=1258-2593 cpus=0 + 1 tty_register_driver+0x1b3/0x2a0 age=120208 pid=1 cpus=1 + 2 kobj_map_init+0x22/0xa0 age=120401/120470/120539 pid=0-1 cpus=0 + 3 mousedev_create+0x36/0x2d0 age=112741/117036/119449 pid=1-803 cpus=0 + 1 atkbd_connect+0x33/0x290 age=119442 pid=17 cpus=1 + 2 thermal_zone_device_register+0x6f/0x310 age=115292/115309/115327 pid=329 cpus=0-1 + 15 sk_prot_alloc+0x83/0xb0 age=68810/108007/120405 pid=1-2586 cpus=0-1 + 1 reqsk_queue_alloc+0x112/0x120 age=97288 pid=1690 cpus=0 + 255 __netdev_alloc_skb+0x1f/0x40 age=96802/96803/96805 pid=1541 cpus=0 + 10 neigh_sysctl_register+0x8d/0x330 age=100609/108839/120262 pid=1-1549 cpus=0-1 + 6 __devinet_sysctl_register+0x74/0x120 age=114075/117599/120262 pid=1-126 cpus=0-1 + 7 pci_add_new_bus+0x25/0x160 age=120320/120320/120322 pid=1 cpus=0 + 1 i8042_create_aux_port+0x36/0x10f age=119461 pid=1 cpus=0 + 1 i8042_probe+0x190/0x68d age=119461 pid=1 cpus=0 + 1 netdev_init+0x32/0xc2 age=120284 pid=1 cpus=0 + 1 netdev_init+0x66/0xc2 age=120284 pid=1 cpus=0 + 1 fib_net_init+0x21/0x14c age=120262 pid=1 cpus=0 + 10 usb_alloc_dev+0x36/0x2c0 [usbcore] age=43849/100909/115370 pid=143-419 cpus=0-1 + 2 acpi_thermal_add+0x36/0x4bb [thermal] age=115294/115311/115329 pid=329 cpus=0-1 + 5 evdev_open+0xaf/0x1e0 [evdev] age=104879/105429/105728 pid=1443 cpus=0-1 + 8 evdev_connect+0x54/0x1f0 [evdev] age=112736/115034/115504 pid=187-803 cpus=0-1 + 1 rtc_device_register+0xa4/0x260 [rtc_core] age=115209 pid=208 cpus=0 + 1 iwl3945_bg_request_scan+0x5d3/0x660 [iwl3945] age=96529 pid=733 cpus=0 + 1 iwl3945_pci_probe+0xd26/0x1020 [iwl3945] age=114202 pid=126 cpus=1 + 1 patch_ad1981+0x1b/0x1d0 [snd_hda_intel] age=114603 pid=107 cpus=1 + 1 rfkill_allocate+0x24/0xc0 [rfkill] age=114903 pid=215 cpus=0 + 1 fuse_fill_super+0x26d/0x6d0 [fuse] age=76238 pid=2476 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-2048/cache_dma b/test/sys/kernel/slab/kmalloc-2048/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-2048/cpu_slabs b/test/sys/kernel/slab/kmalloc-2048/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-2048/ctor b/test/sys/kernel/slab/kmalloc-2048/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-2048/free_calls b/test/sys/kernel/slab/kmalloc-2048/free_calls new file mode 100644 index 0000000000..45fb4506e6 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/free_calls @@ -0,0 +1,15 @@ + 426 age=4294787836 pid=0 cpus=0 + 1 __vunmap+0xe9/0x120 age=115015 pid=107 cpus=1 + 75 free_fdtable_rcu+0x71/0xb0 age=46779/105708/118057 pid=0-2139 cpus=0-1 + 2 show_stat+0x50e/0x530 age=4018/52316/100615 pid=1258-1868 cpus=0-1 + 4 acpi_add_single_object+0xc9a/0xd3c age=120326/120333/120341 pid=1 cpus=0 + 20 release_one_tty+0x145/0x190 age=92888/101277/110777 pid=55-2136 cpus=0-1 + 1 atkbd_connect+0x1ae/0x290 age=119425 pid=17 cpus=0 + 7 sk_free+0xcd/0x100 age=96516/98179/101484 pid=1533-1763 cpus=0-1 + 19 skb_release_data+0x85/0xd0 age=38212/80908/120252 pid=0-2812 cpus=0-1 + 4 __scm_destroy+0x41/0x50 age=66746/75662/92916 pid=2135-2593 cpus=0 + 1 huft_build+0x163/0x63e age=120254 pid=1 cpus=0 + 1 inflate_fixed+0x17c/0x193 age=120254 pid=1 cpus=0 + 1 acpi_processor_get_throttling_info+0x2e4/0x58c [processor] age=116146 pid=330 cpus=0 + 1 acpi_thermal_add+0x457/0x4bb [thermal] age=115330 pid=329 cpus=1 + 1 snd_ctl_ioctl+0x2cf/0x960 [snd] age=113601 pid=786 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-2048/hwcache_align b/test/sys/kernel/slab/kmalloc-2048/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-2048/object_size b/test/sys/kernel/slab/kmalloc-2048/object_size new file mode 100644 index 0000000000..c873496a22 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/object_size @@ -0,0 +1 @@ +2048 diff --git a/test/sys/kernel/slab/kmalloc-2048/objects b/test/sys/kernel/slab/kmalloc-2048/objects new file mode 100644 index 0000000000..33f752bd74 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/objects @@ -0,0 +1 @@ +583 diff --git a/test/sys/kernel/slab/kmalloc-2048/objects_partial b/test/sys/kernel/slab/kmalloc-2048/objects_partial new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/objects_partial @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/kmalloc-2048/objs_per_slab b/test/sys/kernel/slab/kmalloc-2048/objs_per_slab new file mode 100644 index 0000000000..60d3b2f4a4 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/objs_per_slab @@ -0,0 +1 @@ +15 diff --git a/test/sys/kernel/slab/kmalloc-2048/order b/test/sys/kernel/slab/kmalloc-2048/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/kmalloc-2048/partial b/test/sys/kernel/slab/kmalloc-2048/partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/kmalloc-2048/poison b/test/sys/kernel/slab/kmalloc-2048/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-2048/reclaim_account b/test/sys/kernel/slab/kmalloc-2048/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-2048/red_zone b/test/sys/kernel/slab/kmalloc-2048/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-2048/sanity_checks b/test/sys/kernel/slab/kmalloc-2048/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-2048/shrink b/test/sys/kernel/slab/kmalloc-2048/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-2048/slab_size b/test/sys/kernel/slab/kmalloc-2048/slab_size new file mode 100644 index 0000000000..cf41a14a88 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/slab_size @@ -0,0 +1 @@ +2120 diff --git a/test/sys/kernel/slab/kmalloc-2048/slabs b/test/sys/kernel/slab/kmalloc-2048/slabs new file mode 100644 index 0000000000..a2720097dc --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/slabs @@ -0,0 +1 @@ +39 diff --git a/test/sys/kernel/slab/kmalloc-2048/store_user b/test/sys/kernel/slab/kmalloc-2048/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-2048/total_objects b/test/sys/kernel/slab/kmalloc-2048/total_objects new file mode 100644 index 0000000000..6b0823e754 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/total_objects @@ -0,0 +1 @@ +585 diff --git a/test/sys/kernel/slab/kmalloc-2048/trace b/test/sys/kernel/slab/kmalloc-2048/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-2048/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-2048/validate b/test/sys/kernel/slab/kmalloc-2048/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-256/aliases b/test/sys/kernel/slab/kmalloc-256/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-256/align b/test/sys/kernel/slab/kmalloc-256/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-256/alloc_calls b/test/sys/kernel/slab/kmalloc-256/alloc_calls new file mode 100644 index 0000000000..27ca74cbcc --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/alloc_calls @@ -0,0 +1,27 @@ + 2 mempool_kmalloc+0x11/0x20 age=120415/120415/120415 pid=1 cpus=0 + 2 __vmalloc_area_node+0xfb/0x140 age=115072/115875/116679 pid=122-126 cpus=0-1 + 32 dma_pool_create+0x90/0x1e0 age=114561/114992/115392 pid=143-147 cpus=0-1 + 28 __percpu_alloc_mask+0xbc/0x140 age=100623/106237/120267 pid=1-1549 cpus=0 + 2 seq_open+0x84/0xa0 age=96267/101416/106566 pid=1371-1738 cpus=0 + 21 inotify_init+0x1b/0x90 age=15233/86291/120265 pid=1-2851 cpus=0-1 + 1 mounts_open_common+0x11e/0x210 age=106331 pid=1371 cpus=0 + 347 __proc_create+0xa5/0x150 age=95801/116341/120553 pid=0-1813 cpus=0-1 + 7 start_this_handle+0x3f5/0x410 age=3715/21705/38514 pid=21-2890 cpus=0-1 + 3 elevator_alloc+0x1b/0xc0 age=38516/92616/119832 pid=1-2761 cpus=0-1 + 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120400/120401/120402 pid=1 cpus=0 + 1 find_dock+0x414/0x426 age=120418 pid=1 cpus=0 + 6 con_insert_unipair+0x96/0x110 age=95521/107886/120252 pid=1-1898 cpus=1 + 6 neigh_resolve_output+0x226/0x2e0 age=64934/69393/79713 pid=0-2401 cpus=0-1 + 1 genl_register_family+0x1b6/0x1e0 age=115501 pid=126 cpus=0 + 5 ip_mc_inc_group+0x6b/0x280 age=65969/92834/108339 pid=1185-1849 cpus=0-1 + 2 cache_add_dev+0x17b/0x546 age=120266/120266/120267 pid=1 cpus=0-1 + 10 audit_register_class+0x1e/0xa1 age=120266/120266/120266 pid=1 cpus=1 + 1 proc_net_ns_init+0x1b/0x81 age=120553 pid=0 cpus=0 + 3 snd_malloc_sgbuf_pages+0xfa/0x1f0 [snd_page_alloc] age=114616/114616/114616 pid=107 cpus=1 + 1 usb_get_configuration+0x18f/0x1480 [usbcore] age=113196 pid=419 cpus=0 + 1 acpi_ac_add+0x3a/0x1b1 [ac] age=116271 pid=392 cpus=0 + 1 acpi_processor_register_performance+0x2a0/0x3a6 [processor] age=106878 pid=1358 cpus=0 + 3 snd_ctl_open+0x8e/0x180 [snd] age=73513/77666/79760 pid=2400-2425 cpus=0 + 8 ieee80211_rx_bss_add+0x4e/0x140 [mac80211] age=95280/95944/96466 pid=0-1951 cpus=0 + 2 ipv6_add_addr+0x199/0x3c0 [ipv6] age=70023/85324/100625 pid=8-1549 cpus=0-1 + 5 ipv6_dev_mc_inc+0x141/0x3f0 [ipv6] age=70023/94503/100625 pid=8-1549 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-256/cache_dma b/test/sys/kernel/slab/kmalloc-256/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-256/cpu_slabs b/test/sys/kernel/slab/kmalloc-256/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-256/ctor b/test/sys/kernel/slab/kmalloc-256/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-256/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-256/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-256/free_calls b/test/sys/kernel/slab/kmalloc-256/free_calls new file mode 100644 index 0000000000..72b3b6924c --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/free_calls @@ -0,0 +1,13 @@ + 391 age=4294787849 pid=0 cpus=0 + 1 __vunmap+0xe9/0x120 age=115364 pid=107 cpus=1 + 34 do_execve+0x2b1/0x2d0 age=15569/97615/117574 pid=71-2851 cpus=0-1 + 52 seq_release+0x20/0x30 age=3957/100772/116688 pid=105-2851 cpus=0-1 + 1 inotify_destroy+0xcd/0xe0 age=56024 pid=2406 cpus=1 + 3 free_proc_entry+0x73/0x90 age=96765/110129/119478 pid=1-1541 cpus=0 + 10 __journal_drop_transaction+0xe6/0x170 age=12587/77011/106614 pid=32 cpus=0-1 + 1 acpi_pci_irq_add_prt+0xc2/0x324 age=120331 pid=1 cpus=0 + 2 acpi_pci_bind+0x26b/0x28d age=120330/120331/120332 pid=1 cpus=0 + 1 wireless_send_event+0x172/0x330 age=70024 pid=742 cpus=1 + 3 usb_string+0x17c/0x1e0 [usbcore] age=114853/115100/115372 pid=143 cpus=0 + 3 snd_ctl_release+0xf9/0x130 [snd] age=73513/77666/79760 pid=2400-2425 cpus=0 + 1 ieee80211_set_associated+0x421/0x520 [mac80211] age=70024 pid=742 cpus=1 diff --git a/test/sys/kernel/slab/kmalloc-256/hwcache_align b/test/sys/kernel/slab/kmalloc-256/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-256/object_size b/test/sys/kernel/slab/kmalloc-256/object_size new file mode 100644 index 0000000000..9183bf03fc --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/object_size @@ -0,0 +1 @@ +256 diff --git a/test/sys/kernel/slab/kmalloc-256/objects b/test/sys/kernel/slab/kmalloc-256/objects new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/objects @@ -0,0 +1 @@ +512 diff --git a/test/sys/kernel/slab/kmalloc-256/objects_partial b/test/sys/kernel/slab/kmalloc-256/objects_partial new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/objects_partial @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/kmalloc-256/objs_per_slab b/test/sys/kernel/slab/kmalloc-256/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/kmalloc-256/order b/test/sys/kernel/slab/kmalloc-256/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-256/partial b/test/sys/kernel/slab/kmalloc-256/partial new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/partial @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/kmalloc-256/poison b/test/sys/kernel/slab/kmalloc-256/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-256/reclaim_account b/test/sys/kernel/slab/kmalloc-256/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-256/red_zone b/test/sys/kernel/slab/kmalloc-256/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-256/sanity_checks b/test/sys/kernel/slab/kmalloc-256/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-256/shrink b/test/sys/kernel/slab/kmalloc-256/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-256/slab_size b/test/sys/kernel/slab/kmalloc-256/slab_size new file mode 100644 index 0000000000..86619979c3 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/slab_size @@ -0,0 +1 @@ +328 diff --git a/test/sys/kernel/slab/kmalloc-256/slabs b/test/sys/kernel/slab/kmalloc-256/slabs new file mode 100644 index 0000000000..920a139664 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/slabs @@ -0,0 +1 @@ +43 diff --git a/test/sys/kernel/slab/kmalloc-256/store_user b/test/sys/kernel/slab/kmalloc-256/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-256/total_objects b/test/sys/kernel/slab/kmalloc-256/total_objects new file mode 100644 index 0000000000..1c599d4ff3 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/total_objects @@ -0,0 +1 @@ +516 diff --git a/test/sys/kernel/slab/kmalloc-256/trace b/test/sys/kernel/slab/kmalloc-256/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-256/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-256/validate b/test/sys/kernel/slab/kmalloc-256/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-32/aliases b/test/sys/kernel/slab/kmalloc-32/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-32/align b/test/sys/kernel/slab/kmalloc-32/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-32/alloc_calls b/test/sys/kernel/slab/kmalloc-32/alloc_calls new file mode 100644 index 0000000000..bd0d696c39 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/alloc_calls @@ -0,0 +1,51 @@ + 1 mtrr_file_add+0xb0/0xe0 age=95993 pid=1738 cpus=0 + 2 arch_acpi_processor_init_pdc+0x8e/0x180 age=116209/116240/116271 pid=330 cpus=0 + 1 pm_qos_add_requirement+0x34/0xe0 age=116562 pid=122 cpus=1 + 59 setup_modinfo_srcversion+0x19/0x30 age=43557/108917/116798 pid=105-2754 cpus=0-1 + 42 load_module+0x1455/0x1b30 age=43557/106794/116314 pid=107-2754 cpus=0-1 + 151 load_module+0x1ac4/0x1b30 age=43553/109353/116792 pid=105-2754 cpus=0-1 + 3 mempool_create_node+0x4b/0xf0 age=38547/92647/119863 pid=1-2761 cpus=0-1 + 1 strndup_user+0x6d/0xc0 age=115407 pid=107 cpus=0 + 16 __vmalloc_area_node+0xfb/0x140 age=68946/106782/116568 pid=107-2578 cpus=0-1 + 1 do_kern_mount+0xca/0x110 age=76282 pid=2476 cpus=0 + 1 alloc_vfsmnt+0x97/0x180 age=76283 pid=2476 cpus=0 + 1 single_open+0x3c/0xb0 age=96298 pid=1738 cpus=0 + 66 sysfs_new_dirent+0x10c/0x120 age=100672/118408/120297 pid=1-1549 cpus=0-1 + 30 do_shmat+0x169/0x410 age=14643/70515/89098 pid=1738-2621 cpus=0-1 + 21 register_blkdev+0x60/0x150 age=110177/118235/120247 pid=1-951 cpus=0-1 + 39 kvasprintf+0x55/0x90 age=100672/118530/120296 pid=1-1549 cpus=0-1 + 7 pci_save_state+0x1a4/0x250 age=114119/118888/120285 pid=1-126 cpus=0-1 + 2 pcim_enable_device+0x86/0xb0 age=119737/119992/120247 pid=1 cpus=0-1 + 15 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120414/120420/120429 pid=1 cpus=0 + 18 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=116237/119726/120431 pid=1-330 cpus=0 + 1 acpi_install_gpe_handler+0xa7/0x13a age=120441 pid=1 cpus=0 + 1 acpi_ev_create_gpe_block+0x282/0x3bf age=120441 pid=1 cpus=0 + 1 acpi_pci_bind_root+0x8d/0x13e age=120365 pid=1 cpus=0 + 18 acpi_pci_bind+0x85/0x28d age=120361/120361/120364 pid=1 cpus=0 + 15 rand_initialize_disk+0x1d/0x30 age=38524/102596/119859 pid=1-2761 cpus=0-1 + 1 ata_host_start+0xcb/0x1e0 age=120246 pid=1 cpus=1 + 1 hidinput_connect+0x2372/0x24e0 age=112800 pid=803 cpus=0 + 1 sock_kmalloc+0x5c/0x70 age=66000 pid=1849 cpus=1 + 2 proto_register+0x7c/0x260 age=100673/110494/120316 pid=1-1549 cpus=0 + 2 neigh_hash_alloc+0x42/0x50 age=65899/67894/69890 pid=0-1849 cpus=1 + 1 nl_pid_hash_rehash+0x180/0x1a0 age=96908 pid=1708 cpus=0 + 28 unix_bind+0xd8/0x3a0 age=96940/97659/107306 pid=1336-1738 cpus=0-1 + 3 ipc_init_proc_interface+0x2e/0x7c age=120287/120287/120287 pid=1 cpus=1 + 13 usb_cache_string+0x65/0xa0 [usbcore] age=49739/89474/115403 pid=143-419 cpus=0-1 + 6 usb_get_configuration+0x18f/0x1480 [usbcore] age=43678/103143/115403 pid=143-419 cpus=0-1 + 2 _snd_ctl_register_ioctl+0x2b/0x80 [snd] age=115157/115157/115157 pid=107 cpus=0 + 2 snd_oss_info_register+0x40/0xc0 [snd] age=95832/95934/96037 pid=1813 cpus=0 + 6 adjust_io+0xeb/0x120 [rsrc_nonstatic] age=113592/113664/114024 pid=352-800 cpus=0 + 5 adjust_memory+0xe5/0x1a0 [rsrc_nonstatic] age=113592/113760/114017 pid=352-800 cpus=0 + 1 ieee80211_sta_set_extra_ie+0x7d/0xe0 [mac80211] age=70079 pid=1545 cpus=0 + 2 ieee80211_rx_bss_info+0x4df/0xa20 [mac80211] age=70652/83265/95879 pid=0 cpus=0 + 2 ieee80211_rx_bss_info+0x568/0xa20 [mac80211] age=10049/52680/95311 pid=742-1951 cpus=0 + 2 ieee80211_rx_bss_info+0x5f7/0xa20 [mac80211] age=10049/53191/96334 pid=742-1772 cpus=0 + 1 rate_control_alloc+0x32/0x110 [mac80211] age=114239 pid=126 cpus=1 + 2 ieee80211_rate_control_register+0x72/0xf0 [mac80211] age=115062/115117/115172 pid=126 cpus=0-1 + 2 azx_probe+0x9a4/0xc20 [snd_hda_intel] age=114647/114647/114647 pid=107 cpus=1 + 1 async_chainiv_givencrypt+0x71/0x110 [crypto_blkcipher] age=115042 pid=215 cpus=0 + 1 run+0x66/0x500 [raid1] age=110596 pid=916 cpus=0 + 1 acpi_cpufreq_cpu_init+0x4d/0x45c [acpi_cpufreq] age=106909 pid=1358 cpus=0 + 1 fib6_net_init+0x39/0x130 [ipv6] age=100657 pid=1549 cpus=0 + 1 storage_probe+0x14e/0x760 [usb_storage] age=43551 pid=2754 cpus=1 diff --git a/test/sys/kernel/slab/kmalloc-32/cache_dma b/test/sys/kernel/slab/kmalloc-32/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-32/cpu_slabs b/test/sys/kernel/slab/kmalloc-32/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-32/ctor b/test/sys/kernel/slab/kmalloc-32/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-32/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-32/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-32/free_calls b/test/sys/kernel/slab/kmalloc-32/free_calls new file mode 100644 index 0000000000..2e12485b4a --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/free_calls @@ -0,0 +1,23 @@ + 410 age=4294787880 pid=0 cpus=0 + 4 __vunmap+0xe9/0x120 age=106910/113014/115304 pid=215-1358 cpus=0-1 + 1 vfs_rename+0x301/0x450 age=15253 pid=2851 cpus=0 + 6 do_sys_poll+0x32b/0x450 age=64982/70855/73793 pid=1333 cpus=0-1 + 1 seq_release_private+0x2d/0x60 age=92859 pid=2141 cpus=0 + 6 single_release+0x2e/0x40 age=44059/90095/107370 pid=1258-1868 cpus=0-1 + 1 setxattr+0xa6/0x130 age=96072 pid=1816 cpus=0 + 6 bio_free_map_data+0x25/0x30 age=38546/65872/116479 pid=0-318 cpus=0 + 7 remove_kevent+0x44/0x60 age=67905/71045/87094 pid=2271-2423 cpus=0-1 + 56 load_elf_binary+0xa72/0x1e20 age=16833/100749/117066 pid=102-2849 cpus=0-1 + 1 generic_acl_set+0x15e/0x1a0 age=96072 pid=1816 cpus=0 + 68 kobject_uevent_env+0x11a/0x470 age=38526/110314/120446 pid=1-2761 cpus=0-1 + 2 pci_get_subsys+0x74/0xa0 age=116209/116240/116271 pid=330 cpus=0 + 7 acpi_evaluate_integer+0xbf/0xd1 age=115144/116942/120369 pid=1-341 cpus=0 + 2 acpi_ds_create_operand+0x12c/0x209 age=115326/117848/120370 pid=1-329 cpus=0 + 3 acpi_ns_get_node+0x92/0xa1 age=114928/116769/120441 pid=1-215 cpus=0-1 + 5 acpi_ut_delete_internal_obj+0x15f/0x16f age=106909/114359/116252 pid=330-1358 cpus=0 + 3 acpi_pci_bind+0x277/0x28d age=120362/120362/120364 pid=1 cpus=0 + 1 get_modalias+0xd4/0x120 age=96306 pid=1772 cpus=0 + 1 pci_bus_assign_resources+0xfe/0x4d0 age=120317 pid=1 cpus=0 + 9 usb_get_device_descriptor+0x9b/0xa0 [usbcore] age=43678/99455/115403 pid=143-419 cpus=0-1 + 1 ieee80211_rx_bss_info+0x552/0xa20 [mac80211] age=10049 pid=742 cpus=0 + 2 ieee80211_rx_bss_info+0x5e1/0xa20 [mac80211] age=10049/53191/96334 pid=742-1772 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-32/hwcache_align b/test/sys/kernel/slab/kmalloc-32/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-32/object_size b/test/sys/kernel/slab/kmalloc-32/object_size new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/object_size @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/kmalloc-32/objects b/test/sys/kernel/slab/kmalloc-32/objects new file mode 100644 index 0000000000..8da60bbdfd --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/objects @@ -0,0 +1 @@ +613 diff --git a/test/sys/kernel/slab/kmalloc-32/objects_partial b/test/sys/kernel/slab/kmalloc-32/objects_partial new file mode 100644 index 0000000000..fe4afb0df8 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/objects_partial @@ -0,0 +1 @@ +106 diff --git a/test/sys/kernel/slab/kmalloc-32/objs_per_slab b/test/sys/kernel/slab/kmalloc-32/objs_per_slab new file mode 100644 index 0000000000..a2720097dc --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/objs_per_slab @@ -0,0 +1 @@ +39 diff --git a/test/sys/kernel/slab/kmalloc-32/order b/test/sys/kernel/slab/kmalloc-32/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-32/partial b/test/sys/kernel/slab/kmalloc-32/partial new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/partial @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/kmalloc-32/poison b/test/sys/kernel/slab/kmalloc-32/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-32/reclaim_account b/test/sys/kernel/slab/kmalloc-32/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-32/red_zone b/test/sys/kernel/slab/kmalloc-32/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-32/sanity_checks b/test/sys/kernel/slab/kmalloc-32/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-32/shrink b/test/sys/kernel/slab/kmalloc-32/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-32/slab_size b/test/sys/kernel/slab/kmalloc-32/slab_size new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/slab_size @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/kmalloc-32/slabs b/test/sys/kernel/slab/kmalloc-32/slabs new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/slabs @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/kmalloc-32/store_user b/test/sys/kernel/slab/kmalloc-32/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-32/total_objects b/test/sys/kernel/slab/kmalloc-32/total_objects new file mode 100644 index 0000000000..d27f552128 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/total_objects @@ -0,0 +1 @@ +624 diff --git a/test/sys/kernel/slab/kmalloc-32/trace b/test/sys/kernel/slab/kmalloc-32/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-32/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-32/validate b/test/sys/kernel/slab/kmalloc-32/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-4096/aliases b/test/sys/kernel/slab/kmalloc-4096/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-4096/align b/test/sys/kernel/slab/kmalloc-4096/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-4096/alloc_calls b/test/sys/kernel/slab/kmalloc-4096/alloc_calls new file mode 100644 index 0000000000..0593a5cb43 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/alloc_calls @@ -0,0 +1,23 @@ + 1 load_module+0x18d5/0x1b30 age=116223 pid=330 cpus=0 + 1 __vmalloc_area_node+0xfb/0x140 age=112490 pid=867 cpus=0 + 24 __percpu_alloc_mask+0xbc/0x140 age=100605/103881/120249 pid=1-1549 cpus=0 + 1 seq_read+0x2f0/0x360 age=105770 pid=1371 cpus=0 + 2 ext3_fill_super+0x68/0x1a20 age=110106/114494/118882 pid=1-962 cpus=0 + 4 journal_init_revoke_table+0x4d/0xb0 age=110090/114440/118790 pid=1-962 cpus=0 + 2 journal_init_inode+0x8d/0x130 age=110090/114440/118790 pid=1-962 cpus=0 + 1 fat_fill_super+0x40/0xdd0 age=38126 pid=2817 cpus=1 + 7 scsi_host_alloc+0x35/0x360 age=43504/109092/120197 pid=1-2754 cpus=0-1 + 3 scsi_alloc_sdev+0x6a/0x270 age=38498/92598/119814 pid=1-2761 cpus=0-1 + 8 input_allocate_device+0x1a/0xb0 age=112751/116073/119438 pid=17-803 cpus=0-1 + 1 reqsk_queue_alloc+0x112/0x120 age=95042 pid=1920 cpus=0 + 3 alloc_netdev_mq+0x4f/0x180 age=114071/116178/120273 pid=1-126 cpus=0-1 + 1 pidmap_init+0x15/0x4e age=120535 pid=0 cpus=0 + 1 netlink_proto_init+0x47/0x16b age=120401 pid=1 cpus=0 + 2 acpi_processor_add+0x25/0x6d [processor] age=116160/116191/116222 pid=330 cpus=0 + 1 yenta_probe+0x38/0x6cd [yenta_socket] age=114273 pid=352 cpus=0 + 292 iwl3945_rx_allocate+0xd5/0x160 [iwl3945] age=1410/7094/12982 pid=733 cpus=0 + 1 skcipher_geniv_alloc+0x304/0x3f0 [crypto_blkcipher] age=114879 pid=215 cpus=1 + 2 bitmap_get_counter+0x153/0x220 [md_mod] age=110534/110536/110538 pid=916 cpus=0 + 1 bitmap_create+0x2bc/0xad0 [md_mod] age=110538 pid=916 cpus=0 + 6 __addrconf_sysctl_register+0x7b/0x140 [ipv6] age=100605/100606/100608 pid=1549 cpus=0 + 1 acm_probe+0x34c/0xa50 [cdc_acm] age=49570 pid=2711 cpus=1 diff --git a/test/sys/kernel/slab/kmalloc-4096/cache_dma b/test/sys/kernel/slab/kmalloc-4096/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-4096/cpu_slabs b/test/sys/kernel/slab/kmalloc-4096/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-4096/ctor b/test/sys/kernel/slab/kmalloc-4096/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-4096/free_calls b/test/sys/kernel/slab/kmalloc-4096/free_calls new file mode 100644 index 0000000000..2284bcc619 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/free_calls @@ -0,0 +1,7 @@ + 200 age=4294787831 pid=0 cpus=0 + 7 seq_release+0x18/0x30 age=8616/76360/115289 pid=107-2815 cpus=0-1 + 1 cryptomgr_probe+0x81/0xf0 age=114071 pid=745 cpus=0 + 30 kobject_uevent_env+0x122/0x470 age=43504/111192/120401 pid=1-2754 cpus=0-1 + 1 show_uevent+0xee/0x110 age=1412 pid=2890 cpus=0 + 1 input_dev_release+0x23/0x40 age=119420 pid=17 cpus=0 + 126 skb_release_data+0x85/0xd0 age=1410/8633/95042 pid=0-2890 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-4096/hwcache_align b/test/sys/kernel/slab/kmalloc-4096/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-4096/object_size b/test/sys/kernel/slab/kmalloc-4096/object_size new file mode 100644 index 0000000000..801c306ed3 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/object_size @@ -0,0 +1 @@ +4096 diff --git a/test/sys/kernel/slab/kmalloc-4096/objects b/test/sys/kernel/slab/kmalloc-4096/objects new file mode 100644 index 0000000000..67bf40fe17 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/objects @@ -0,0 +1 @@ +371 diff --git a/test/sys/kernel/slab/kmalloc-4096/objects_partial b/test/sys/kernel/slab/kmalloc-4096/objects_partial new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/objects_partial @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/kmalloc-4096/objs_per_slab b/test/sys/kernel/slab/kmalloc-4096/objs_per_slab new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/objs_per_slab @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/kmalloc-4096/order b/test/sys/kernel/slab/kmalloc-4096/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/kmalloc-4096/partial b/test/sys/kernel/slab/kmalloc-4096/partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/kmalloc-4096/poison b/test/sys/kernel/slab/kmalloc-4096/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-4096/reclaim_account b/test/sys/kernel/slab/kmalloc-4096/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-4096/red_zone b/test/sys/kernel/slab/kmalloc-4096/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-4096/sanity_checks b/test/sys/kernel/slab/kmalloc-4096/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-4096/shrink b/test/sys/kernel/slab/kmalloc-4096/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-4096/slab_size b/test/sys/kernel/slab/kmalloc-4096/slab_size new file mode 100644 index 0000000000..eaa5ead980 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/slab_size @@ -0,0 +1 @@ +4168 diff --git a/test/sys/kernel/slab/kmalloc-4096/slabs b/test/sys/kernel/slab/kmalloc-4096/slabs new file mode 100644 index 0000000000..fb1e7bc869 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/slabs @@ -0,0 +1 @@ +54 diff --git a/test/sys/kernel/slab/kmalloc-4096/store_user b/test/sys/kernel/slab/kmalloc-4096/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-4096/total_objects b/test/sys/kernel/slab/kmalloc-4096/total_objects new file mode 100644 index 0000000000..61ab674d69 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/total_objects @@ -0,0 +1 @@ +378 diff --git a/test/sys/kernel/slab/kmalloc-4096/trace b/test/sys/kernel/slab/kmalloc-4096/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-4096/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-4096/validate b/test/sys/kernel/slab/kmalloc-4096/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-512/aliases b/test/sys/kernel/slab/kmalloc-512/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-512/align b/test/sys/kernel/slab/kmalloc-512/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-512/alloc_calls b/test/sys/kernel/slab/kmalloc-512/alloc_calls new file mode 100644 index 0000000000..c42c806be8 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/alloc_calls @@ -0,0 +1,54 @@ + 14 __register_sysctl_paths+0x56/0x340 age=100617/113006/120280 pid=1-1549 cpus=0 + 14 param_sysfs_setup+0x87/0x140 age=95801/116155/120411 pid=1-1813 cpus=0-1 + 59 module_add_modinfo_attrs+0x25/0xf0 age=43517/108876/116756 pid=105-2754 cpus=0-1 + 2 __vmalloc_area_node+0xfb/0x140 age=115142/115788/116434 pid=126-144 cpus=0 + 1 dma_kmalloc_cache+0xca/0x150 age=116268 pid=163 cpus=0 + 107 kmem_cache_create+0x4e/0x2e0 age=100622/118194/120548 pid=0-1549 cpus=0-1 + 2 __percpu_alloc_mask+0xbc/0x140 age=120260/120260/120260 pid=1 cpus=1 + 19 sys_inotify_init1+0xaa/0x220 age=15228/82710/117133 pid=72-2851 cpus=0-1 + 4 sys_epoll_create1+0x41/0x100 age=95473/96627/97297 pid=1690-1920 cpus=0-1 + 2 __crypto_alloc_tfm+0x43/0x1b0 age=114084/114084/114084 pid=126 cpus=1 + 1 crypto_alloc_instance+0x2b/0xe0 age=114084 pid=745 cpus=0 + 3 elevator_alloc+0x67/0xc0 age=38511/92611/119827 pid=1-2761 cpus=0-1 + 3 cfq_init_queue+0x1b/0x120 age=38511/92611/119827 pid=1-2761 cpus=0-1 + 1 fb_alloc_cmap+0x66/0x150 age=120248 pid=1 cpus=1 + 1 fb_alloc_cmap+0x81/0x150 age=120248 pid=1 cpus=1 + 1 fb_alloc_cmap+0x9c/0x150 age=120248 pid=1 cpus=1 + 1 fbcon_startup+0xd6/0x2f0 age=120247 pid=1 cpus=1 + 1 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120388 pid=1 cpus=0 + 1 make_acpi_ec+0x1a/0xcb age=120405 pid=1 cpus=0 + 1 acpi_irq_stats_init+0x83/0x268 age=120405 pid=1 cpus=0 + 1 acpi_irq_stats_init+0xa7/0x268 age=120405 pid=1 cpus=0 + 5 alloc_tty_driver+0x1c/0x40 age=49583/106087/120217 pid=1-2711 cpus=1 + 2 vt_ioctl+0x1874/0x1c30 age=97105/97105/97105 pid=1703 cpus=0 + 8 set_inverse_transl+0xa0/0xb0 age=95516/107881/120247 pid=1-1898 cpus=1 + 2 con_clear_unimap+0x2a/0xd0 age=95516/107881/120247 pid=1-1898 cpus=1 + 7 vc_allocate+0x99/0x1b0 age=97055/99240/108733 pid=1135-1729 cpus=0-1 + 1 hpet_alloc+0x6b/0x3c0 age=120290 pid=1 cpus=0 + 4 uart_open+0x36c/0x4b0 age=109337/109406/109612 pid=1059-1073 cpus=0-1 + 43 bus_add_driver+0x4f/0x280 age=43517/114334/120333 pid=1-2754 cpus=0-1 + 9 bus_register+0x35/0x290 age=113926/119187/120415 pid=1-770 cpus=0-1 + 30 __class_register+0x28/0x1e0 age=115015/118591/120414 pid=1-352 cpus=0-1 + 1 mousedev_open+0xc8/0x1d0 age=94761 pid=1738 cpus=0 + 1 cpufreq_add_dev+0x8f/0x5c0 age=106873 pid=1358 cpus=0 + 4 sock_alloc_send_skb+0x1cd/0x200 age=71255/83196/91238 pid=1738 cpus=0-1 + 1 alloc_netdev_mq+0x6c/0x180 age=114204 pid=126 cpus=1 + 4 inetdev_init+0x28/0x190 age=114084/116276/120271 pid=1-126 cpus=0-1 + 2 fib_hash_table+0x1c/0x80 age=120271/120271/120271 pid=1 cpus=0 + 1 ioapic_init_sysfs+0x74/0xcf age=120261 pid=1 cpus=1 + 3 snd_malloc_sgbuf_pages+0xbe/0x1f0 [snd_page_alloc] age=114611/114611/114611 pid=107 cpus=1 + 1 usb_get_configuration+0x18f/0x1480 [usbcore] age=49725 pid=419 cpus=0 + 1 usb_get_configuration+0x5f2/0x1480 [usbcore] age=113184 pid=419 cpus=0 + 2 acpi_processor_get_throttling_info+0x21f/0x58c [processor] age=116154/116178/116202 pid=330 cpus=0 + 48 snd_info_create_entry+0x1b/0xa0 [snd] age=95796/111649/115359 pid=107-1813 cpus=0-1 + 4 snd_timer_new+0x40/0x190 [snd_timer] age=114589/114754/115249 pid=107 cpus=1 + 2 ieee80211_key_alloc+0x37/0xe0 [mac80211] age=68908/68959/69011 pid=1545 cpus=0 + 3 snd_pcm_new_stream+0x161/0x520 [snd_pcm] age=114611/114611/114611 pid=107 cpus=1 + 1 snd_hda_bus_new+0x31/0xf4 [snd_hda_intel] age=114614 pid=107 cpus=1 + 1 crypto_blkcipher_type+0x54/0xffffffffffffff8e [crypto_blkcipher] age=114942 pid=215 cpus=0 + 1 md_import_device+0x32/0x290 [md_mod] age=110602 pid=916 cpus=0 + 1 bitmap_create+0x5e/0xad0 [md_mod] age=110558 pid=916 cpus=0 + 1 run+0x42/0x500 [raid1] age=110560 pid=916 cpus=0 + 1 ip6_route_net_init+0x4d/0xd0 [ipv6] age=100622 pid=1549 cpus=0 + 1 ipv6_sysctl_net_init+0x34/0xd0 [ipv6] age=100617 pid=1549 cpus=0 + 1 seq_create_client1+0x24/0x180 [snd_seq] age=96051 pid=1805 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-512/cache_dma b/test/sys/kernel/slab/kmalloc-512/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-512/cpu_slabs b/test/sys/kernel/slab/kmalloc-512/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-512/ctor b/test/sys/kernel/slab/kmalloc-512/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-512/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-512/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-512/free_calls b/test/sys/kernel/slab/kmalloc-512/free_calls new file mode 100644 index 0000000000..fb63668d03 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/free_calls @@ -0,0 +1,10 @@ + 163 age=4294787844 pid=0 cpus=0 + 4 __vunmap+0xe9/0x120 age=115006/115810/116670 pid=122-215 cpus=0 + 1 kmem_cache_shrink+0x5d/0x1b0 age=120363 pid=1 cpus=0 + 34 load_elf_binary+0xa7e/0x1e20 age=15243/103227/117708 pid=62-2878 cpus=0-1 + 20 load_elf_binary+0xc37/0x1e20 age=15243/106540/116862 pid=197-2878 cpus=0-1 + 1 crypto_larval_destroy+0x2b/0x40 age=114084 pid=126 cpus=1 + 210 skb_release_data+0x85/0xd0 age=38729/109272/120414 pid=0-2743 cpus=0-1 + 1 acpi_processor_get_power_info+0x2eb/0x569 [processor] age=116152 pid=330 cpus=1 + 1 skcipher_geniv_alloc+0xea/0x3f0 [crypto_blkcipher] age=114969 pid=215 cpus=0 + 1 snd_mixer_oss_build_input+0x402/0x5c0 [snd_mixer_oss] age=96000 pid=1813 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-512/hwcache_align b/test/sys/kernel/slab/kmalloc-512/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-512/object_size b/test/sys/kernel/slab/kmalloc-512/object_size new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/object_size @@ -0,0 +1 @@ +512 diff --git a/test/sys/kernel/slab/kmalloc-512/objects b/test/sys/kernel/slab/kmalloc-512/objects new file mode 100644 index 0000000000..658bd780ab --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/objects @@ -0,0 +1 @@ +459 diff --git a/test/sys/kernel/slab/kmalloc-512/objects_partial b/test/sys/kernel/slab/kmalloc-512/objects_partial new file mode 100644 index 0000000000..5595fa46c0 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/objects_partial @@ -0,0 +1 @@ +95 diff --git a/test/sys/kernel/slab/kmalloc-512/objs_per_slab b/test/sys/kernel/slab/kmalloc-512/objs_per_slab new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/objs_per_slab @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/kmalloc-512/order b/test/sys/kernel/slab/kmalloc-512/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-512/partial b/test/sys/kernel/slab/kmalloc-512/partial new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/partial @@ -0,0 +1 @@ +10 diff --git a/test/sys/kernel/slab/kmalloc-512/poison b/test/sys/kernel/slab/kmalloc-512/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-512/reclaim_account b/test/sys/kernel/slab/kmalloc-512/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-512/red_zone b/test/sys/kernel/slab/kmalloc-512/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-512/sanity_checks b/test/sys/kernel/slab/kmalloc-512/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-512/shrink b/test/sys/kernel/slab/kmalloc-512/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-512/slab_size b/test/sys/kernel/slab/kmalloc-512/slab_size new file mode 100644 index 0000000000..af368af278 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/slab_size @@ -0,0 +1 @@ +584 diff --git a/test/sys/kernel/slab/kmalloc-512/slabs b/test/sys/kernel/slab/kmalloc-512/slabs new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/slabs @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/kmalloc-512/store_user b/test/sys/kernel/slab/kmalloc-512/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-512/total_objects b/test/sys/kernel/slab/kmalloc-512/total_objects new file mode 100644 index 0000000000..3091e8eea2 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/total_objects @@ -0,0 +1 @@ +504 diff --git a/test/sys/kernel/slab/kmalloc-512/trace b/test/sys/kernel/slab/kmalloc-512/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-512/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-512/validate b/test/sys/kernel/slab/kmalloc-512/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-64/aliases b/test/sys/kernel/slab/kmalloc-64/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/align b/test/sys/kernel/slab/kmalloc-64/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-64/alloc_calls b/test/sys/kernel/slab/kmalloc-64/alloc_calls new file mode 100644 index 0000000000..a4ed25bfb1 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/alloc_calls @@ -0,0 +1,54 @@ + 30 alternatives_smp_module_add+0x81/0x160 age=43548/108890/120578 pid=0-2754 cpus=0-1 + 39 __request_region+0x39/0x120 age=114304/118766/120442 pid=1-352 cpus=0-1 + 1 audit_log_start+0x353/0x3f0 age=120290 pid=1 cpus=1 + 16 request_irq+0x9a/0xf0 age=96772/114498/120435 pid=1-1541 cpus=0-1 + 3 devm_request_irq+0x4b/0xc0 age=119725/119896/120240 pid=1 cpus=0-1 + 1 strndup_user+0x6d/0xc0 age=115038 pid=215 cpus=0 + 95 __get_vm_area_node+0x9b/0x220 age=43551/112044/120578 pid=0-2754 cpus=0-1 + 17 __vmalloc_area_node+0xfb/0x140 age=49618/106962/116792 pid=105-2711 cpus=0-1 + 1 add_swap_extent+0x57/0xc0 age=112532 pid=867 cpus=0 + 33 dma_pool_alloc+0x6d/0x200 age=49613/81264/115397 pid=143-2711 cpus=0-1 + 40 alloc_kmem_cache_cpu+0x81/0x90 age=100652/108515/120280 pid=1-1549 cpus=0-1 + 164 __percpu_alloc_mask+0x52/0x140 age=38518/109529/120578 pid=0-2761 cpus=0-1 + 184 __percpu_alloc_mask+0xbc/0x140 age=38541/109884/120578 pid=0-2761 cpus=0-1 + 1 do_sys_poll+0xdb/0x450 age=569 pid=1333 cpus=0 + 582 d_alloc+0x19d/0x1f0 age=37270/93183/116955 pid=72-2818 cpus=0-1 + 15 alloc_fdtable+0x57/0x160 age=3825/81315/97772 pid=1532-2676 cpus=0-1 + 15 alloc_fdtable+0xb4/0x160 age=3825/81315/97772 pid=1532-2676 cpus=0-1 + 1 bioset_create+0x21/0xc0 age=120440 pid=1 cpus=0 + 1 bd_claim_by_disk+0x6f/0x270 age=110624 pid=916 cpus=0 + 14 posix_acl_alloc+0x1b/0x30 age=92649/92660/92673 pid=2175 cpus=0 + 5 proc_reg_open+0x3f/0x170 age=96292/101761/107248 pid=1327-1738 cpus=0 + 5268 ext3_init_block_alloc_info+0x22/0x80 age=1/2342/110222 pid=1-2890 cpus=0-1 + 4 ext3_readdir+0x617/0x650 age=92557/92572/92607 pid=1370 cpus=0 + 8 ext3_htree_store_dirent+0x37/0x130 age=92557/92565/92592 pid=1370 cpus=0 + 277 kobject_create+0x1a/0x40 age=38517/108164/120578 pid=0-2761 cpus=0-1 + 1 pci_create_sysfs_dev_files+0x23e/0x3b0 age=119430 pid=1 cpus=0 + 11 acpi_os_validate_address+0x3d/0xa3 age=120407/120420/120425 pid=1 cpus=0 + 120 acpi_ds_build_internal_package_obj+0xaf/0x1df age=116231/120069/120429 pid=1-330 cpus=0 + 6 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120413/120418/120427 pid=1 cpus=0 + 1 acpi_ev_system_memory_region_setup+0x68/0x8f age=120407 pid=1 cpus=0 + 3 acpi_add_single_object+0x596/0xd3c age=120371/120373/120375 pid=1 cpus=0 + 3 acpi_add_single_object+0x5d8/0xd3c age=120379/120381/120383 pid=1 cpus=0 + 27 acpi_add_single_object+0x9f7/0xd3c age=120364/120381/120393 pid=1 cpus=0 + 55 acpi_ec_add_query_handler+0x31/0x91 age=120363/120363/120363 pid=1 cpus=0 + 1 find_dock+0x2c9/0x426 age=120443 pid=1 cpus=0 + 6 find_dock_devices+0x5e/0x92 age=120443/120443/120443 pid=1 cpus=0 + 8 acpi_pci_link_add+0x32/0x1db age=120336/120337/120339 pid=1 cpus=0 + 39 acpi_pci_irq_add_prt+0x181/0x324 age=120355/120356/120358 pid=1 cpus=0 + 14 init_dev+0x3c8/0x6f0 age=66785/98982/118673 pid=33-2593 cpus=0-1 + 14 init_dev+0x437/0x6f0 age=66785/98982/118673 pid=33-2593 cpus=0-1 + 2 init_dev+0x5b2/0x6f0 age=66785/85818/104851 pid=1258-2593 cpus=0 + 2 init_dev+0x637/0x6f0 age=66785/85818/104851 pid=1258-2593 cpus=0 + 2 kobj_map_init+0x36/0xa0 age=120440/120509/120578 pid=0-1 cpus=0 + 38 kobj_map+0x79/0x1a0 age=38518/110104/120440 pid=1-2761 cpus=0-1 + 3 dmam_alloc_coherent+0x3f/0xa0 age=119725/119896/120240 pid=1 cpus=0-1 + 1 scsi_probe_and_add_lun+0x65e/0xd80 age=38540 pid=2761 cpus=0 + 170 scsi_dev_info_list_add+0x3d/0x120 age=120324/120324/120324 pid=1 cpus=0 + 1 ahci_init_one+0x137/0xcb0 age=120241 pid=1 cpus=1 + 1 cpufreq_stat_notifier_policy+0xa1/0x2e0 age=106903 pid=1358 cpus=0 + 1 cpufreq_stat_notifier_policy+0x17e/0x2e0 age=106903 pid=1358 cpus=0 + 1 hid_parse_report+0xa9/0x2c0 age=112794 pid=803 cpus=0 + 10 __dev_addr_add+0x69/0xe0 age=65994/85989/100649 pid=8-1849 cpus=0-1 + 1 genl_register_family+0x1b6/0x1e0 age=120323 pid=1 cpus=0 + 2 fib_hash_alloc+0x45/0x50 age=65995/65995/65995 pid=1541 cpus=1 diff --git a/test/sys/kernel/slab/kmalloc-64/cache_dma b/test/sys/kernel/slab/kmalloc-64/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/cpu_slabs b/test/sys/kernel/slab/kmalloc-64/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/ctor b/test/sys/kernel/slab/kmalloc-64/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-64/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-64/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/free_calls b/test/sys/kernel/slab/kmalloc-64/free_calls new file mode 100644 index 0000000000..e2172e5098 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/free_calls @@ -0,0 +1,47 @@ + 6338 age=4294787875 pid=0 cpus=0 + 1 iounmap+0xc2/0x100 age=120406 pid=1 cpus=0 + 1 memtype_get_idx+0x75/0xc0 age=472 pid=2890 cpus=0 + 2 __release_region+0xc6/0xd0 age=120243/120243/120243 pid=1 cpus=1 + 3 __request_region+0x86/0x120 age=120317/120317/120317 pid=1 cpus=0 + 1 generic_smp_call_function_single_interrupt+0xce/0xe0 age=95988 pid=0 cpus=1 + 53 __stop_machine+0x216/0x220 age=43548/108141/116788 pid=105-2754 cpus=0-1 + 2 free_irq+0xef/0x190 age=96791/108147/119504 pid=1-1541 cpus=0 + 32 __vunmap+0xcd/0x120 age=49614/106753/116787 pid=105-2711 cpus=0-1 + 8 __vunmap+0xe9/0x120 age=68946/104551/116557 pid=107-2578 cpus=0-1 + 13 do_sys_poll+0x32b/0x450 age=570/48723/75247 pid=1333-2262 cpus=0-1 + 179 d_callback+0x22/0x40 age=38389/106212/116948 pid=0-2156 cpus=0-1 + 105 free_fdtable_rcu+0x7a/0xb0 age=4819/96235/116860 pid=0-2888 cpus=0-1 + 98 free_fdtable_rcu+0x82/0xb0 age=4819/94663/117639 pid=0-2888 cpus=0-1 + 34 proc_reg_release+0x96/0x120 age=4054/104513/116556 pid=126-2586 cpus=0-1 + 15 proc_reg_open+0x138/0x170 age=60405/85433/108413 pid=1184-2676 cpus=0-1 + 521 free_rb_tree_fname+0x5c/0xb0 age=13382/89664/116891 pid=102-2881 cpus=0-1 + 61 ext3_htree_free_dir_info+0x19/0x20 age=13382/92904/116891 pid=102-2881 cpus=0-1 + 10 ext3_clear_inode+0xa5/0xb0 age=15264/59665/94793 pid=1253-2851 cpus=0-1 + 1 dynamic_kobj_release+0x2c/0x40 age=96680 pid=1541 cpus=0 + 67 kobject_uevent_env+0x11a/0x470 age=43545/108372/120444 pid=1-2754 cpus=0-1 + 15 acpi_ds_call_control_method+0xfe/0x180 age=2031/67925/120337 pid=1-2890 cpus=0 + 1 acpi_ev_execute_reg_method+0x129/0x13a age=120435 pid=1 cpus=0 + 1 acpi_ev_asynch_execute_gpe_method+0xcc/0x119 age=120394 pid=12 cpus=1 + 34 acpi_evaluate_object+0x1ea/0x1fc age=2026/78898/120444 pid=1-2890 cpus=0-1 + 4 acpi_get_object_info+0x1c4/0x1d4 age=120365/120377/120384 pid=1 cpus=0 + 1 acpi_walk_resources+0xa4/0xbd age=120244 pid=1 cpus=1 + 41 acpi_ut_evaluate_object+0x18d/0x19b age=119712/120350/120408 pid=1 cpus=0-1 + 4 acpi_ut_delete_internal_obj+0x15f/0x16f age=106905/113901/116233 pid=330-1358 cpus=0 + 7 acpi_bus_get_ejd+0x73/0x80 age=120444/120444/120444 pid=1 cpus=0 + 11 pnp_show_options+0x459/0x600 age=876/900/917 pid=2890 cpus=0 + 11 pnp_show_current_resources+0x16f/0x180 age=876/900/917 pid=2890 cpus=0 + 17 release_one_tty+0x53/0x190 age=93008/102081/110816 pid=55-2106 cpus=0-1 + 23 release_one_tty+0x60/0x190 age=92918/99197/110816 pid=55-2141 cpus=0-1 + 6 release_one_tty+0x167/0x190 age=92918/93713/95283 pid=1967-2141 cpus=0 + 4 devres_remove_group+0x9e/0xe0 age=119515/119802/120242 pid=1 cpus=0-1 + 1 ata_acpi_on_devcfg+0x385/0x6a0 age=119895 pid=25 cpus=0 + 3 serio_free_event+0x1d/0x30 age=118952/119301/119488 pid=17 cpus=0-1 + 5 input_register_device+0x17c/0x230 age=112781/115789/119472 pid=17-803 cpus=0-1 + 1 ip_cork_release+0x1f/0x50 age=74343 pid=2536 cpus=1 + 13 huft_free+0x1e/0x2f age=120293/120293/120293 pid=1 cpus=0 + 5 hub_port_init+0x522/0x740 [usbcore] age=43787/86949/114764 pid=419 cpus=0 + 1 usb_release_interface_cache+0x2c/0x60 [usbcore] age=114357 pid=419 cpus=0 + 1 usb_release_interface_cache+0x47/0x60 [usbcore] age=114357 pid=419 cpus=0 + 1 __param_str_act+0x16c/0xfffffffffffffb13 [thermal] age=115602 pid=383 cpus=0 + 4 snd_card_file_remove+0x73/0x130 [snd] age=73539/86679/113640 pid=786-2425 cpus=0 + 1 hid_probe+0x222/0xf30 [usbhid] age=112795 pid=803 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-64/hwcache_align b/test/sys/kernel/slab/kmalloc-64/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/object_size b/test/sys/kernel/slab/kmalloc-64/object_size new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/object_size @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/kmalloc-64/objects b/test/sys/kernel/slab/kmalloc-64/objects new file mode 100644 index 0000000000..4faba4413e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/objects @@ -0,0 +1 @@ +7770 diff --git a/test/sys/kernel/slab/kmalloc-64/objects_partial b/test/sys/kernel/slab/kmalloc-64/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/objs_per_slab b/test/sys/kernel/slab/kmalloc-64/objs_per_slab new file mode 100644 index 0000000000..64bb6b746d --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/objs_per_slab @@ -0,0 +1 @@ +30 diff --git a/test/sys/kernel/slab/kmalloc-64/order b/test/sys/kernel/slab/kmalloc-64/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/partial b/test/sys/kernel/slab/kmalloc-64/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/poison b/test/sys/kernel/slab/kmalloc-64/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-64/reclaim_account b/test/sys/kernel/slab/kmalloc-64/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/red_zone b/test/sys/kernel/slab/kmalloc-64/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-64/sanity_checks b/test/sys/kernel/slab/kmalloc-64/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-64/shrink b/test/sys/kernel/slab/kmalloc-64/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-64/slab_size b/test/sys/kernel/slab/kmalloc-64/slab_size new file mode 100644 index 0000000000..7296f257eb --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/slab_size @@ -0,0 +1 @@ +136 diff --git a/test/sys/kernel/slab/kmalloc-64/slabs b/test/sys/kernel/slab/kmalloc-64/slabs new file mode 100644 index 0000000000..98ecf5813e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/slabs @@ -0,0 +1 @@ +259 diff --git a/test/sys/kernel/slab/kmalloc-64/store_user b/test/sys/kernel/slab/kmalloc-64/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-64/total_objects b/test/sys/kernel/slab/kmalloc-64/total_objects new file mode 100644 index 0000000000..4faba4413e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/total_objects @@ -0,0 +1 @@ +7770 diff --git a/test/sys/kernel/slab/kmalloc-64/trace b/test/sys/kernel/slab/kmalloc-64/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-64/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-64/validate b/test/sys/kernel/slab/kmalloc-64/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-8/aliases b/test/sys/kernel/slab/kmalloc-8/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/align b/test/sys/kernel/slab/kmalloc-8/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-8/alloc_calls b/test/sys/kernel/slab/kmalloc-8/alloc_calls new file mode 100644 index 0000000000..cad464e273 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/alloc_calls @@ -0,0 +1,32 @@ + 1 cache_k8_northbridges+0x5f/0x130 age=120344 pid=1 cpus=0 + 1 pm_qos_add_requirement+0x51/0xe0 age=116580 pid=122 cpus=1 + 5 setup_modinfo_version+0x19/0x30 age=96471/111249/116816 pid=169-1766 cpus=0-1 + 379 load_module+0x1ac4/0x1b30 age=43571/109336/116810 pid=105-2754 cpus=0-1 + 57 strndup_user+0x6d/0xc0 age=43575/108714/116816 pid=105-2754 cpus=0-1 + 4 krealloc+0x1e/0x60 age=95750/102720/117621 pid=71-1849 cpus=0-1 + 5 __vmalloc_area_node+0xfb/0x140 age=114139/114930/115644 pid=181-754 cpus=0-1 + 17 alloc_vfsmnt+0x97/0x180 age=94582/117623/120602 pid=0-2064 cpus=0-1 + 1 proc_symlink+0x4d/0xb0 age=114643 pid=107 cpus=1 + 1954 sysfs_new_dirent+0x10c/0x120 age=38540/109788/120602 pid=0-2761 cpus=0-1 + 690 kvasprintf+0x55/0x90 age=38540/111445/120602 pid=0-2761 cpus=0-1 + 1 proc_bus_pci_open+0x1d/0x50 age=96318 pid=1738 cpus=0 + 5 pcie_port_device_register+0x25/0x4a0 age=120302/120303/120304 pid=1 cpus=1 + 19 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120441/120450/120452 pid=1 cpus=0 + 9 acpi_ev_pci_config_region_setup+0x162/0x270 age=119736/120334/120427 pid=1-12 cpus=0-1 + 2 acpi_ut_copy_simple_object+0x8f/0x11c age=116158/116166/116174 pid=396 cpus=0 + 35 acpi_irq_stats_init+0x1bd/0x268 age=120459/120459/120459 pid=1 cpus=0 + 8 neigh_sysctl_register+0x1cd/0x330 age=100672/109261/120325 pid=1-1549 cpus=0-1 + 7 netlink_kernel_create+0xab/0x1a0 age=119467/120248/120468 pid=1 cpus=0-1 + 5 __devinet_sysctl_register+0xb8/0x120 age=114138/118342/120325 pid=1-126 cpus=0-1 + 1 fz_hash_alloc+0x4a/0x60 age=65005 pid=1541 cpus=0 + 1 init_vdso_vars+0x4c/0x24a age=120315 pid=1 cpus=1 + 30 netlink_proto_init+0xf1/0x16b age=120468/120468/120468 pid=1 cpus=0 + 5 hub_probe+0x20b/0x820 [usbcore] age=114555/115048/115401 pid=143-147 cpus=0-1 + 3 usb_cache_string+0x65/0xa0 [usbcore] age=43695/47750/49778 pid=419 cpus=0 + 10 usb_get_configuration+0xbd/0x1480 [usbcore] age=43696/100850/115421 pid=143-419 cpus=0-1 + 35 snd_info_create_entry+0x30/0xa0 [snd] age=95850/111135/115413 pid=107-1813 cpus=0-1 + 1 async_chainiv_givencrypt_first+0x56/0x80 [crypto_blkcipher] age=115060 pid=215 cpus=0 + 1 md_seq_open+0x2d/0x90 [md_mod] age=106615 pid=1371 cpus=0 + 1 bitmap_create+0x3aa/0xad0 [md_mod] age=110605 pid=916 cpus=0 + 5 __addrconf_sysctl_register+0xcd/0x140 [ipv6] age=100672/100673/100675 pid=1549 cpus=0 + 1 fib6_net_init+0x5d/0x130 [ipv6] age=100675 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-8/cache_dma b/test/sys/kernel/slab/kmalloc-8/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/cpu_slabs b/test/sys/kernel/slab/kmalloc-8/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/ctor b/test/sys/kernel/slab/kmalloc-8/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-8/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-8/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/free_calls b/test/sys/kernel/slab/kmalloc-8/free_calls new file mode 100644 index 0000000000..ee3781e77b --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/free_calls @@ -0,0 +1,23 @@ + 2776 age=4294787898 pid=0 cpus=0 + 1 partition_sched_domains+0x285/0x300 age=74677 pid=2526 cpus=1 + 3 free_sect_attrs+0x2e/0x50 age=115544/115544/115544 pid=383 cpus=0 + 6 load_module+0x73f/0x1b30 age=115322/115787/116481 pid=143-332 cpus=0-1 + 1 free_module+0xb9/0xf0 age=115544 pid=383 cpus=0 + 1 krealloc+0x3a/0x60 age=116292 pid=330 cpus=0 + 45 __vunmap+0xe9/0x120 age=49634/110047/116797 pid=105-2711 cpus=0-1 + 1 vfs_rename+0x301/0x450 age=107654 pid=72 cpus=1 + 167 release_sysfs_dirent+0x8c/0xd0 age=92943/100063/120267 pid=1-2141 cpus=0-1 + 39 kobject_release+0xe1/0x140 age=92943/97943/118742 pid=1-2141 cpus=0-1 + 1 match_number+0x95/0xb0 age=76301 pid=2476 cpus=0 + 2 proc_bus_pci_release+0x18/0x30 age=96319/96483/96647 pid=1738 cpus=0 + 47 acpi_ds_create_operand+0x12c/0x209 age=46079/115801/120458 pid=1-1442 cpus=0-1 + 128 acpi_ns_get_node+0x92/0xa1 age=106927/119841/120467 pid=1-1358 cpus=0-1 + 2 acpi_ut_delete_internal_obj+0x15f/0x16f age=116147/116208/116270 pid=330-396 cpus=0 + 2 module_add_driver+0x66/0xd0 age=116467/116470/116474 pid=144 cpus=0 + 3 get_modalias+0xd4/0x120 age=96324/111312/120466 pid=1-1772 cpus=0-1 + 1 fib_hash_free+0x35/0x40 age=108388 pid=1185 cpus=0 + 3 sg_clean+0x3e/0x80 [usbcore] age=38548/38556/38564 pid=2760 cpus=0 + 56 usb_control_msg+0xef/0x110 [usbcore] age=43693/95647/115421 pid=143-2711 cpus=0-1 + 8 usb_set_configuration+0x338/0x5f0 [usbcore] age=43693/105671/115413 pid=143-419 cpus=0-1 + 1 usb_destroy_configuration+0x78/0x140 [usbcore] age=114380 pid=419 cpus=0 + 5 sr_media_change+0xeb/0x2a0 [sr_mod] age=66074/94513/115441 pid=558-1456 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-8/hwcache_align b/test/sys/kernel/slab/kmalloc-8/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/object_size b/test/sys/kernel/slab/kmalloc-8/object_size new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/object_size @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-8/objects b/test/sys/kernel/slab/kmalloc-8/objects new file mode 100644 index 0000000000..ff121853a0 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/objects @@ -0,0 +1 @@ +3366 diff --git a/test/sys/kernel/slab/kmalloc-8/objects_partial b/test/sys/kernel/slab/kmalloc-8/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/objs_per_slab b/test/sys/kernel/slab/kmalloc-8/objs_per_slab new file mode 100644 index 0000000000..82cced27d7 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/objs_per_slab @@ -0,0 +1 @@ +51 diff --git a/test/sys/kernel/slab/kmalloc-8/order b/test/sys/kernel/slab/kmalloc-8/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/partial b/test/sys/kernel/slab/kmalloc-8/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/poison b/test/sys/kernel/slab/kmalloc-8/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-8/reclaim_account b/test/sys/kernel/slab/kmalloc-8/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/red_zone b/test/sys/kernel/slab/kmalloc-8/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-8/sanity_checks b/test/sys/kernel/slab/kmalloc-8/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-8/shrink b/test/sys/kernel/slab/kmalloc-8/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-8/slab_size b/test/sys/kernel/slab/kmalloc-8/slab_size new file mode 100644 index 0000000000..d15a2cc44e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/slab_size @@ -0,0 +1 @@ +80 diff --git a/test/sys/kernel/slab/kmalloc-8/slabs b/test/sys/kernel/slab/kmalloc-8/slabs new file mode 100644 index 0000000000..69a893aa31 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/slabs @@ -0,0 +1 @@ +66 diff --git a/test/sys/kernel/slab/kmalloc-8/store_user b/test/sys/kernel/slab/kmalloc-8/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-8/total_objects b/test/sys/kernel/slab/kmalloc-8/total_objects new file mode 100644 index 0000000000..ff121853a0 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/total_objects @@ -0,0 +1 @@ +3366 diff --git a/test/sys/kernel/slab/kmalloc-8/trace b/test/sys/kernel/slab/kmalloc-8/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-8/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-8/validate b/test/sys/kernel/slab/kmalloc-8/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-96/aliases b/test/sys/kernel/slab/kmalloc-96/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-96/align b/test/sys/kernel/slab/kmalloc-96/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc-96/alloc_calls b/test/sys/kernel/slab/kmalloc-96/alloc_calls new file mode 100644 index 0000000000..f35cb951b8 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/alloc_calls @@ -0,0 +1,39 @@ + 5 sched_create_group+0x1f/0x220 age=92345/99829/107356 pid=1333-2177 cpus=0-1 + 10 __register_sysctl_paths+0x56/0x340 age=110862/119010/120363 pid=1-901 cpus=0-1 + 15 __create_workqueue_key+0x31/0x290 age=110884/118293/120484 pid=1-900 cpus=0-1 + 59 load_module+0x19c0/0x1b30 age=43586/108944/116825 pid=105-2754 cpus=0-1 + 5 __vmalloc_area_node+0xfb/0x140 age=95875/111994/116701 pid=147-1813 cpus=0 + 22 __register_chrdev_region+0x2d/0x1a0 age=49652/115744/120479 pid=1-2711 cpus=0-1 + 1 do_sys_poll+0xdb/0x450 age=413 pid=2262 cpus=0 + 98 d_alloc+0x19d/0x1f0 age=38371/102053/116795 pid=317-2795 cpus=0-1 + 8 sys_eventfd2+0x51/0xb0 age=79808/79852/79896 pid=2400 cpus=0 + 1 mb_cache_create+0x62/0x1f0 age=120321 pid=1 cpus=1 + 9 sysfs_setattr+0x19a/0x1f0 age=38525/82617/117752 pid=63-2777 cpus=0-1 + 1 sysfs_open_file+0x1c5/0x230 age=0 pid=2890 cpus=0 + 17 copy_semundo+0x71/0xc0 age=15625/78538/106738 pid=1370-2851 cpus=0-1 + 2 __crypto_alloc_tfm+0x43/0x1b0 age=114153/114153/114153 pid=126 cpus=1 + 2 pcim_iomap_table+0x45/0x60 age=119764/120022/120280 pid=1 cpus=0-1 + 26 pci_create_attr+0x3d/0x140 age=119469/119469/119470 pid=1 cpus=0 + 8 pci_enable_msi+0xb1/0x2b0 age=96811/114438/120319 pid=1-1541 cpus=0-1 + 1 fb_add_videomode+0x89/0xf0 age=120316 pid=1 cpus=1 + 1 soft_cursor+0x92/0x220 age=120316 pid=1 cpus=1 + 20 acpi_os_create_semaphore+0x36/0xaa age=120444/120593/120617 pid=0-1 cpus=0 + 6 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120456/120460/120468 pid=1 cpus=0 + 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120461/120461/120462 pid=1 cpus=0 + 1 acpi_ev_create_gpe_block+0x5f/0x3bf age=120474 pid=1 cpus=0 + 62 pnp_new_resource+0x25/0x60 age=120366/120369/120370 pid=1 cpus=0 + 1 tty_register_driver+0x1b3/0x2a0 age=120281 pid=1 cpus=1 + 5 kbd_connect+0x4e/0xe0 age=114827/116218/119510 pid=17-341 cpus=0-1 + 17 __class_create+0x3d/0xa0 age=115091/118212/120483 pid=1-215 cpus=0-1 + 2 scsi_probe_and_add_lun+0x65e/0xd80 age=119559/119727/119896 pid=1 cpus=0-1 + 3 inet_rtm_newaddr+0xdb/0x220 age=66035/94264/108387 pid=1197-1541 cpus=0-1 + 2 cache_add_dev+0x7c/0x546 age=120330/120330/120331 pid=1 cpus=0 + 22 kernel_param_sysfs_setup+0x2f/0xc9 age=120480/120480/120480 pid=1 cpus=0 + 15 acpi_system_init+0x12e/0x260 age=120373/120373/120374 pid=1 cpus=0 + 1 pci_mmcfg_insert_resources+0x5d/0x123 age=119469 pid=1 cpus=0 + 1 0xffffffffa0065104 age=96483 pid=1766 cpus=0 + 1 bitmap_create+0x373/0xad0 [md_mod] age=110620 pid=916 cpus=0 + 256 r1bio_pool_alloc+0x2f/0x60 [raid1] age=110629/110629/110629 pid=916 cpus=0 + 8 ip6addrlbl_add+0x75/0x330 [ipv6] age=100690/100690/100690 pid=1549 cpus=0 + 1 ip6_route_net_init+0x22/0xd0 [ipv6] age=100691 pid=1549 cpus=0 + 6 snd_mixer_oss_build_input+0x431/0x5c0 [snd_mixer_oss] age=96069/96069/96070 pid=1813 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-96/cache_dma b/test/sys/kernel/slab/kmalloc-96/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-96/cpu_slabs b/test/sys/kernel/slab/kmalloc-96/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-96/ctor b/test/sys/kernel/slab/kmalloc-96/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-96/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-96/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-96/free_calls b/test/sys/kernel/slab/kmalloc-96/free_calls new file mode 100644 index 0000000000..1288604771 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/free_calls @@ -0,0 +1,18 @@ + 509 age=4294787914 pid=0 cpus=0 + 1 free_notes_attrs+0x4b/0x50 age=115561 pid=383 cpus=0 + 1 audit_send_list+0x88/0xa0 age=101562 pid=1538 cpus=1 + 6 __vunmap+0xe9/0x120 age=49653/103486/115566 pid=126-2711 cpus=0-1 + 1 do_sys_poll+0x32b/0x450 age=414 pid=2262 cpus=0 + 33 d_callback+0x22/0x40 age=43664/99035/116126 pid=0-2740 cpus=0-1 + 19 sysfs_release+0x63/0xa0 age=16087/92594/117036 pid=165-2773 cpus=0-1 + 1 release_sysfs_dirent+0x22/0xd0 age=107674 pid=1309 cpus=1 + 113 free_rb_tree_fname+0x5c/0xb0 age=14719/98996/116930 pid=163-2649 cpus=0-1 + 5 kobject_uevent_env+0x11a/0x470 age=115179/117228/119771 pid=1-392 cpus=0-1 + 1 msi_free_irqs+0xad/0x110 age=96830 pid=1541 cpus=0 + 1 acpi_os_execute_deferred+0x34/0x39 age=120433 pid=13 cpus=1 + 1 acpi_walk_resources+0xa4/0xbd age=120370 pid=1 cpus=0 + 1 acpi_pci_irq_add_prt+0x30b/0x324 age=120397 pid=1 cpus=0 + 7 scsi_execute_req+0x9f/0xf0 age=38544/91446/119897 pid=1-2761 cpus=0-1 + 9 netlink_destroy_callback+0x21/0x30 age=66036/88090/108388 pid=1197-2527 cpus=0-1 + 12 huft_free+0x1e/0x2f age=120332/120332/120332 pid=1 cpus=0 + 2 r1bio_pool_free+0x9/0x10 [raid1] age=104903/104906/104909 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-96/hwcache_align b/test/sys/kernel/slab/kmalloc-96/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-96/object_size b/test/sys/kernel/slab/kmalloc-96/object_size new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/object_size @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/kmalloc-96/objects b/test/sys/kernel/slab/kmalloc-96/objects new file mode 100644 index 0000000000..9beea1f9dc --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/objects @@ -0,0 +1 @@ +750 diff --git a/test/sys/kernel/slab/kmalloc-96/objects_partial b/test/sys/kernel/slab/kmalloc-96/objects_partial new file mode 100644 index 0000000000..257e563266 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/objects_partial @@ -0,0 +1 @@ +102 diff --git a/test/sys/kernel/slab/kmalloc-96/objs_per_slab b/test/sys/kernel/slab/kmalloc-96/objs_per_slab new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/objs_per_slab @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/kmalloc-96/order b/test/sys/kernel/slab/kmalloc-96/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-96/partial b/test/sys/kernel/slab/kmalloc-96/partial new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/partial @@ -0,0 +1 @@ +5 diff --git a/test/sys/kernel/slab/kmalloc-96/poison b/test/sys/kernel/slab/kmalloc-96/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-96/reclaim_account b/test/sys/kernel/slab/kmalloc-96/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-96/red_zone b/test/sys/kernel/slab/kmalloc-96/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-96/sanity_checks b/test/sys/kernel/slab/kmalloc-96/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-96/shrink b/test/sys/kernel/slab/kmalloc-96/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc-96/slab_size b/test/sys/kernel/slab/kmalloc-96/slab_size new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/slab_size @@ -0,0 +1 @@ +168 diff --git a/test/sys/kernel/slab/kmalloc-96/slabs b/test/sys/kernel/slab/kmalloc-96/slabs new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/slabs @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/kmalloc-96/store_user b/test/sys/kernel/slab/kmalloc-96/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc-96/total_objects b/test/sys/kernel/slab/kmalloc-96/total_objects new file mode 100644 index 0000000000..dc763b654e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/total_objects @@ -0,0 +1 @@ +768 diff --git a/test/sys/kernel/slab/kmalloc-96/trace b/test/sys/kernel/slab/kmalloc-96/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc-96/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc-96/validate b/test/sys/kernel/slab/kmalloc-96/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/aliases b/test/sys/kernel/slab/kmalloc_dma-512/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/align b/test/sys/kernel/slab/kmalloc_dma-512/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/alloc_calls b/test/sys/kernel/slab/kmalloc_dma-512/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/kmalloc_dma-512/cache_dma b/test/sys/kernel/slab/kmalloc_dma-512/cache_dma new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/cache_dma @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs b/test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/ctor b/test/sys/kernel/slab/kmalloc_dma-512/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu b/test/sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/free_calls b/test/sys/kernel/slab/kmalloc_dma-512/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/kmalloc_dma-512/hwcache_align b/test/sys/kernel/slab/kmalloc_dma-512/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/object_size b/test/sys/kernel/slab/kmalloc_dma-512/object_size new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/object_size @@ -0,0 +1 @@ +512 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/objects b/test/sys/kernel/slab/kmalloc_dma-512/objects new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/objects @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/objects_partial b/test/sys/kernel/slab/kmalloc_dma-512/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab b/test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/order b/test/sys/kernel/slab/kmalloc_dma-512/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/partial b/test/sys/kernel/slab/kmalloc_dma-512/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/poison b/test/sys/kernel/slab/kmalloc_dma-512/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/reclaim_account b/test/sys/kernel/slab/kmalloc_dma-512/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/red_zone b/test/sys/kernel/slab/kmalloc_dma-512/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/sanity_checks b/test/sys/kernel/slab/kmalloc_dma-512/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/shrink b/test/sys/kernel/slab/kmalloc_dma-512/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/slab_size b/test/sys/kernel/slab/kmalloc_dma-512/slab_size new file mode 100644 index 0000000000..af368af278 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/slab_size @@ -0,0 +1 @@ +584 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/slabs b/test/sys/kernel/slab/kmalloc_dma-512/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/store_user b/test/sys/kernel/slab/kmalloc_dma-512/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/total_objects b/test/sys/kernel/slab/kmalloc_dma-512/total_objects new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/total_objects @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/trace b/test/sys/kernel/slab/kmalloc_dma-512/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/kmalloc_dma-512/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/validate b/test/sys/kernel/slab/kmalloc_dma-512/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/mm_struct/aliases b/test/sys/kernel/slab/mm_struct/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mm_struct/align b/test/sys/kernel/slab/mm_struct/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mm_struct/alloc_calls b/test/sys/kernel/slab/mm_struct/alloc_calls new file mode 100644 index 0000000000..0d8234c4c3 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/alloc_calls @@ -0,0 +1,2 @@ + 51 mm_alloc+0x15/0x50 age=3728/82894/118687 pid=1-2890 cpus=0-1 + 27 dup_mm+0x61/0x390 age=76175/95614/117075 pid=71-2467 cpus=0-1 diff --git a/test/sys/kernel/slab/mm_struct/cache_dma b/test/sys/kernel/slab/mm_struct/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mm_struct/cpu_slabs b/test/sys/kernel/slab/mm_struct/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mm_struct/ctor b/test/sys/kernel/slab/mm_struct/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/mm_struct/destroy_by_rcu b/test/sys/kernel/slab/mm_struct/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mm_struct/free_calls b/test/sys/kernel/slab/mm_struct/free_calls new file mode 100644 index 0000000000..487419e053 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/free_calls @@ -0,0 +1,2 @@ + 6 age=4294787778 pid=0 cpus=0 + 72 __mmdrop+0x47/0x60 age=4725/88360/117544 pid=1-2846 cpus=0-1 diff --git a/test/sys/kernel/slab/mm_struct/hwcache_align b/test/sys/kernel/slab/mm_struct/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mm_struct/object_size b/test/sys/kernel/slab/mm_struct/object_size new file mode 100644 index 0000000000..fdab865fb7 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/object_size @@ -0,0 +1 @@ +1144 diff --git a/test/sys/kernel/slab/mm_struct/objects b/test/sys/kernel/slab/mm_struct/objects new file mode 100644 index 0000000000..49541f7210 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/objects @@ -0,0 +1 @@ +94 diff --git a/test/sys/kernel/slab/mm_struct/objects_partial b/test/sys/kernel/slab/mm_struct/objects_partial new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/objects_partial @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/mm_struct/objs_per_slab b/test/sys/kernel/slab/mm_struct/objs_per_slab new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/objs_per_slab @@ -0,0 +1 @@ +13 diff --git a/test/sys/kernel/slab/mm_struct/order b/test/sys/kernel/slab/mm_struct/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/mm_struct/partial b/test/sys/kernel/slab/mm_struct/partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/mm_struct/poison b/test/sys/kernel/slab/mm_struct/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mm_struct/reclaim_account b/test/sys/kernel/slab/mm_struct/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mm_struct/red_zone b/test/sys/kernel/slab/mm_struct/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mm_struct/sanity_checks b/test/sys/kernel/slab/mm_struct/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mm_struct/shrink b/test/sys/kernel/slab/mm_struct/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/mm_struct/slab_size b/test/sys/kernel/slab/mm_struct/slab_size new file mode 100644 index 0000000000..cc7bb991e4 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/slab_size @@ -0,0 +1 @@ +1216 diff --git a/test/sys/kernel/slab/mm_struct/slabs b/test/sys/kernel/slab/mm_struct/slabs new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/slabs @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/mm_struct/store_user b/test/sys/kernel/slab/mm_struct/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mm_struct/total_objects b/test/sys/kernel/slab/mm_struct/total_objects new file mode 100644 index 0000000000..b16e5f75e3 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/total_objects @@ -0,0 +1 @@ +104 diff --git a/test/sys/kernel/slab/mm_struct/trace b/test/sys/kernel/slab/mm_struct/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mm_struct/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mm_struct/validate b/test/sys/kernel/slab/mm_struct/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/mnt_cache/aliases b/test/sys/kernel/slab/mnt_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/align b/test/sys/kernel/slab/mnt_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/alloc_calls b/test/sys/kernel/slab/mnt_cache/alloc_calls new file mode 100644 index 0000000000..8075bf520c --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/alloc_calls @@ -0,0 +1 @@ + 25 alloc_vfsmnt+0x1f/0x180 age=38020/111342/120428 pid=0-2817 cpus=0-1 diff --git a/test/sys/kernel/slab/mnt_cache/cache_dma b/test/sys/kernel/slab/mnt_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/cpu_slabs b/test/sys/kernel/slab/mnt_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/ctor b/test/sys/kernel/slab/mnt_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/mnt_cache/destroy_by_rcu b/test/sys/kernel/slab/mnt_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/free_calls b/test/sys/kernel/slab/mnt_cache/free_calls new file mode 100644 index 0000000000..49cb0c7965 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/free_calls @@ -0,0 +1 @@ + 25 age=4294787724 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/mnt_cache/hwcache_align b/test/sys/kernel/slab/mnt_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mnt_cache/object_size b/test/sys/kernel/slab/mnt_cache/object_size new file mode 100644 index 0000000000..20c90807cc --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/object_size @@ -0,0 +1 @@ +224 diff --git a/test/sys/kernel/slab/mnt_cache/objects b/test/sys/kernel/slab/mnt_cache/objects new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/objects @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/mnt_cache/objects_partial b/test/sys/kernel/slab/mnt_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/objs_per_slab b/test/sys/kernel/slab/mnt_cache/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/mnt_cache/order b/test/sys/kernel/slab/mnt_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/partial b/test/sys/kernel/slab/mnt_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/poison b/test/sys/kernel/slab/mnt_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mnt_cache/reclaim_account b/test/sys/kernel/slab/mnt_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/red_zone b/test/sys/kernel/slab/mnt_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mnt_cache/sanity_checks b/test/sys/kernel/slab/mnt_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mnt_cache/shrink b/test/sys/kernel/slab/mnt_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/mnt_cache/slab_size b/test/sys/kernel/slab/mnt_cache/slab_size new file mode 100644 index 0000000000..18eed1357e --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/slab_size @@ -0,0 +1 @@ +320 diff --git a/test/sys/kernel/slab/mnt_cache/slabs b/test/sys/kernel/slab/mnt_cache/slabs new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/slabs @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/mnt_cache/store_user b/test/sys/kernel/slab/mnt_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mnt_cache/total_objects b/test/sys/kernel/slab/mnt_cache/total_objects new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/total_objects @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/mnt_cache/trace b/test/sys/kernel/slab/mnt_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mnt_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mnt_cache/validate b/test/sys/kernel/slab/mnt_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/aliases b/test/sys/kernel/slab/mqueue_inode_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/align b/test/sys/kernel/slab/mqueue_inode_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls b/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls new file mode 100644 index 0000000000..fefece7950 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls @@ -0,0 +1 @@ + 1 mqueue_alloc_inode+0x15/0x30 age=120406 pid=1 cpus=1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/cache_dma b/test/sys/kernel/slab/mqueue_inode_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs b/test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/ctor b/test/sys/kernel/slab/mqueue_inode_cache/ctor new file mode 100644 index 0000000000..2940046f62 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/mqueue_inode_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/free_calls b/test/sys/kernel/slab/mqueue_inode_cache/free_calls new file mode 100644 index 0000000000..3ab537380b --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/free_calls @@ -0,0 +1 @@ + 1 age=4294788000 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/hwcache_align b/test/sys/kernel/slab/mqueue_inode_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/object_size b/test/sys/kernel/slab/mqueue_inode_cache/object_size new file mode 100644 index 0000000000..471d5488d7 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/object_size @@ -0,0 +1 @@ +1456 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/objects b/test/sys/kernel/slab/mqueue_inode_cache/objects new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/objects @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/objects_partial b/test/sys/kernel/slab/mqueue_inode_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/objs_per_slab b/test/sys/kernel/slab/mqueue_inode_cache/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/order b/test/sys/kernel/slab/mqueue_inode_cache/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/partial b/test/sys/kernel/slab/mqueue_inode_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/poison b/test/sys/kernel/slab/mqueue_inode_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/reclaim_account b/test/sys/kernel/slab/mqueue_inode_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/red_zone b/test/sys/kernel/slab/mqueue_inode_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/sanity_checks b/test/sys/kernel/slab/mqueue_inode_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/shrink b/test/sys/kernel/slab/mqueue_inode_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/slab_size b/test/sys/kernel/slab/mqueue_inode_cache/slab_size new file mode 100644 index 0000000000..fa94e88e60 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/slab_size @@ -0,0 +1 @@ +1536 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/slabs b/test/sys/kernel/slab/mqueue_inode_cache/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/store_user b/test/sys/kernel/slab/mqueue_inode_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/total_objects b/test/sys/kernel/slab/mqueue_inode_cache/total_objects new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/total_objects @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/trace b/test/sys/kernel/slab/mqueue_inode_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/mqueue_inode_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/validate b/test/sys/kernel/slab/mqueue_inode_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/names_cache/aliases b/test/sys/kernel/slab/names_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/names_cache/align b/test/sys/kernel/slab/names_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/names_cache/alloc_calls b/test/sys/kernel/slab/names_cache/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/names_cache/cache_dma b/test/sys/kernel/slab/names_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/names_cache/cpu_slabs b/test/sys/kernel/slab/names_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/names_cache/ctor b/test/sys/kernel/slab/names_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/names_cache/destroy_by_rcu b/test/sys/kernel/slab/names_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/names_cache/free_calls b/test/sys/kernel/slab/names_cache/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/names_cache/hwcache_align b/test/sys/kernel/slab/names_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/names_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/names_cache/object_size b/test/sys/kernel/slab/names_cache/object_size new file mode 100644 index 0000000000..801c306ed3 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/object_size @@ -0,0 +1 @@ +4096 diff --git a/test/sys/kernel/slab/names_cache/objects b/test/sys/kernel/slab/names_cache/objects new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/objects @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/names_cache/objects_partial b/test/sys/kernel/slab/names_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/names_cache/objs_per_slab b/test/sys/kernel/slab/names_cache/objs_per_slab new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/objs_per_slab @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/names_cache/order b/test/sys/kernel/slab/names_cache/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/names_cache/partial b/test/sys/kernel/slab/names_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/names_cache/poison b/test/sys/kernel/slab/names_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/names_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/names_cache/reclaim_account b/test/sys/kernel/slab/names_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/names_cache/red_zone b/test/sys/kernel/slab/names_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/names_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/names_cache/sanity_checks b/test/sys/kernel/slab/names_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/names_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/names_cache/shrink b/test/sys/kernel/slab/names_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/names_cache/slab_size b/test/sys/kernel/slab/names_cache/slab_size new file mode 100644 index 0000000000..7137ddbe18 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/slab_size @@ -0,0 +1 @@ +4224 diff --git a/test/sys/kernel/slab/names_cache/slabs b/test/sys/kernel/slab/names_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/names_cache/store_user b/test/sys/kernel/slab/names_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/names_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/names_cache/total_objects b/test/sys/kernel/slab/names_cache/total_objects new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/total_objects @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/names_cache/trace b/test/sys/kernel/slab/names_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/names_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/names_cache/validate b/test/sys/kernel/slab/names_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ndisc_cache/aliases b/test/sys/kernel/slab/ndisc_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ndisc_cache/align b/test/sys/kernel/slab/ndisc_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ndisc_cache/alloc_calls b/test/sys/kernel/slab/ndisc_cache/alloc_calls new file mode 100644 index 0000000000..bc05daac2d --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/alloc_calls @@ -0,0 +1 @@ + 3 neigh_create+0x8b/0x530 age=70114/80423/100880 pid=0-1549 cpus=0-1 diff --git a/test/sys/kernel/slab/ndisc_cache/cache_dma b/test/sys/kernel/slab/ndisc_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ndisc_cache/cpu_slabs b/test/sys/kernel/slab/ndisc_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ndisc_cache/ctor b/test/sys/kernel/slab/ndisc_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ndisc_cache/destroy_by_rcu b/test/sys/kernel/slab/ndisc_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ndisc_cache/free_calls b/test/sys/kernel/slab/ndisc_cache/free_calls new file mode 100644 index 0000000000..75cf00f53d --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/free_calls @@ -0,0 +1 @@ + 3 age=4294788104 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ndisc_cache/hwcache_align b/test/sys/kernel/slab/ndisc_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ndisc_cache/object_size b/test/sys/kernel/slab/ndisc_cache/object_size new file mode 100644 index 0000000000..2921a1584c --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/object_size @@ -0,0 +1 @@ +360 diff --git a/test/sys/kernel/slab/ndisc_cache/objects b/test/sys/kernel/slab/ndisc_cache/objects new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/objects @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/ndisc_cache/objects_partial b/test/sys/kernel/slab/ndisc_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ndisc_cache/objs_per_slab b/test/sys/kernel/slab/ndisc_cache/objs_per_slab new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/objs_per_slab @@ -0,0 +1 @@ +18 diff --git a/test/sys/kernel/slab/ndisc_cache/order b/test/sys/kernel/slab/ndisc_cache/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ndisc_cache/partial b/test/sys/kernel/slab/ndisc_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ndisc_cache/poison b/test/sys/kernel/slab/ndisc_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ndisc_cache/reclaim_account b/test/sys/kernel/slab/ndisc_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ndisc_cache/red_zone b/test/sys/kernel/slab/ndisc_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ndisc_cache/sanity_checks b/test/sys/kernel/slab/ndisc_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ndisc_cache/shrink b/test/sys/kernel/slab/ndisc_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/ndisc_cache/slab_size b/test/sys/kernel/slab/ndisc_cache/slab_size new file mode 100644 index 0000000000..5379c470da --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/slab_size @@ -0,0 +1 @@ +448 diff --git a/test/sys/kernel/slab/ndisc_cache/slabs b/test/sys/kernel/slab/ndisc_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/ndisc_cache/store_user b/test/sys/kernel/slab/ndisc_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/ndisc_cache/total_objects b/test/sys/kernel/slab/ndisc_cache/total_objects new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/total_objects @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/ndisc_cache/trace b/test/sys/kernel/slab/ndisc_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/ndisc_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/ndisc_cache/validate b/test/sys/kernel/slab/ndisc_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/nsproxy/aliases b/test/sys/kernel/slab/nsproxy/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/align b/test/sys/kernel/slab/nsproxy/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/nsproxy/alloc_calls b/test/sys/kernel/slab/nsproxy/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/nsproxy/cache_dma b/test/sys/kernel/slab/nsproxy/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/cpu_slabs b/test/sys/kernel/slab/nsproxy/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/ctor b/test/sys/kernel/slab/nsproxy/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/nsproxy/destroy_by_rcu b/test/sys/kernel/slab/nsproxy/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/free_calls b/test/sys/kernel/slab/nsproxy/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/nsproxy/hwcache_align b/test/sys/kernel/slab/nsproxy/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/object_size b/test/sys/kernel/slab/nsproxy/object_size new file mode 100644 index 0000000000..f6b91e0e1f --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/object_size @@ -0,0 +1 @@ +56 diff --git a/test/sys/kernel/slab/nsproxy/objects b/test/sys/kernel/slab/nsproxy/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/objects_partial b/test/sys/kernel/slab/nsproxy/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/objs_per_slab b/test/sys/kernel/slab/nsproxy/objs_per_slab new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/objs_per_slab @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/nsproxy/order b/test/sys/kernel/slab/nsproxy/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/partial b/test/sys/kernel/slab/nsproxy/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/poison b/test/sys/kernel/slab/nsproxy/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/nsproxy/reclaim_account b/test/sys/kernel/slab/nsproxy/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/red_zone b/test/sys/kernel/slab/nsproxy/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/nsproxy/sanity_checks b/test/sys/kernel/slab/nsproxy/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/nsproxy/shrink b/test/sys/kernel/slab/nsproxy/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/nsproxy/slab_size b/test/sys/kernel/slab/nsproxy/slab_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/slab_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/nsproxy/slabs b/test/sys/kernel/slab/nsproxy/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/store_user b/test/sys/kernel/slab/nsproxy/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/nsproxy/total_objects b/test/sys/kernel/slab/nsproxy/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/trace b/test/sys/kernel/slab/nsproxy/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/nsproxy/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/nsproxy/validate b/test/sys/kernel/slab/nsproxy/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/pid/aliases b/test/sys/kernel/slab/pid/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/pid/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/pid/align b/test/sys/kernel/slab/pid/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/pid/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/pid/alloc_calls b/test/sys/kernel/slab/pid/alloc_calls new file mode 100644 index 0000000000..56fe74815f --- /dev/null +++ b/test/sys/kernel/slab/pid/alloc_calls @@ -0,0 +1 @@ + 206 alloc_pid+0x26/0x430 age=3771/98420/120475 pid=0-2851 cpus=0-1 diff --git a/test/sys/kernel/slab/pid/cache_dma b/test/sys/kernel/slab/pid/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/pid/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/pid/cpu_slabs b/test/sys/kernel/slab/pid/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/pid/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/pid/ctor b/test/sys/kernel/slab/pid/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/pid/destroy_by_rcu b/test/sys/kernel/slab/pid/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/pid/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/pid/free_calls b/test/sys/kernel/slab/pid/free_calls new file mode 100644 index 0000000000..0c6b050f85 --- /dev/null +++ b/test/sys/kernel/slab/pid/free_calls @@ -0,0 +1,2 @@ + 69 age=4294787821 pid=0 cpus=0 + 137 put_pid+0x36/0x40 age=4763/95449/117585 pid=0-2759 cpus=0-1 diff --git a/test/sys/kernel/slab/pid/hwcache_align b/test/sys/kernel/slab/pid/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/pid/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/pid/object_size b/test/sys/kernel/slab/pid/object_size new file mode 100644 index 0000000000..d15a2cc44e --- /dev/null +++ b/test/sys/kernel/slab/pid/object_size @@ -0,0 +1 @@ +80 diff --git a/test/sys/kernel/slab/pid/objects b/test/sys/kernel/slab/pid/objects new file mode 100644 index 0000000000..997def452a --- /dev/null +++ b/test/sys/kernel/slab/pid/objects @@ -0,0 +1 @@ +237 diff --git a/test/sys/kernel/slab/pid/objects_partial b/test/sys/kernel/slab/pid/objects_partial new file mode 100644 index 0000000000..94361d49fd --- /dev/null +++ b/test/sys/kernel/slab/pid/objects_partial @@ -0,0 +1 @@ +132 diff --git a/test/sys/kernel/slab/pid/objs_per_slab b/test/sys/kernel/slab/pid/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/pid/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/pid/order b/test/sys/kernel/slab/pid/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/pid/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/pid/partial b/test/sys/kernel/slab/pid/partial new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/pid/partial @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/pid/poison b/test/sys/kernel/slab/pid/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/pid/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/pid/reclaim_account b/test/sys/kernel/slab/pid/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/pid/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/pid/red_zone b/test/sys/kernel/slab/pid/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/pid/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/pid/sanity_checks b/test/sys/kernel/slab/pid/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/pid/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/pid/shrink b/test/sys/kernel/slab/pid/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/pid/slab_size b/test/sys/kernel/slab/pid/slab_size new file mode 100644 index 0000000000..86a0307199 --- /dev/null +++ b/test/sys/kernel/slab/pid/slab_size @@ -0,0 +1 @@ +192 diff --git a/test/sys/kernel/slab/pid/slabs b/test/sys/kernel/slab/pid/slabs new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/pid/slabs @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/pid/store_user b/test/sys/kernel/slab/pid/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/pid/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/pid/total_objects b/test/sys/kernel/slab/pid/total_objects new file mode 100644 index 0000000000..2197544d04 --- /dev/null +++ b/test/sys/kernel/slab/pid/total_objects @@ -0,0 +1 @@ +252 diff --git a/test/sys/kernel/slab/pid/trace b/test/sys/kernel/slab/pid/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/pid/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/pid/validate b/test/sys/kernel/slab/pid/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/posix_timers_cache/aliases b/test/sys/kernel/slab/posix_timers_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/align b/test/sys/kernel/slab/posix_timers_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/alloc_calls b/test/sys/kernel/slab/posix_timers_cache/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/posix_timers_cache/cache_dma b/test/sys/kernel/slab/posix_timers_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/cpu_slabs b/test/sys/kernel/slab/posix_timers_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/ctor b/test/sys/kernel/slab/posix_timers_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/posix_timers_cache/destroy_by_rcu b/test/sys/kernel/slab/posix_timers_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/free_calls b/test/sys/kernel/slab/posix_timers_cache/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/posix_timers_cache/hwcache_align b/test/sys/kernel/slab/posix_timers_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/object_size b/test/sys/kernel/slab/posix_timers_cache/object_size new file mode 100644 index 0000000000..5d0b6c4108 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/object_size @@ -0,0 +1 @@ +248 diff --git a/test/sys/kernel/slab/posix_timers_cache/objects b/test/sys/kernel/slab/posix_timers_cache/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/objects_partial b/test/sys/kernel/slab/posix_timers_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/objs_per_slab b/test/sys/kernel/slab/posix_timers_cache/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/posix_timers_cache/order b/test/sys/kernel/slab/posix_timers_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/partial b/test/sys/kernel/slab/posix_timers_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/poison b/test/sys/kernel/slab/posix_timers_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/posix_timers_cache/reclaim_account b/test/sys/kernel/slab/posix_timers_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/red_zone b/test/sys/kernel/slab/posix_timers_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/posix_timers_cache/sanity_checks b/test/sys/kernel/slab/posix_timers_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/posix_timers_cache/shrink b/test/sys/kernel/slab/posix_timers_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/posix_timers_cache/slab_size b/test/sys/kernel/slab/posix_timers_cache/slab_size new file mode 100644 index 0000000000..18eed1357e --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/slab_size @@ -0,0 +1 @@ +320 diff --git a/test/sys/kernel/slab/posix_timers_cache/slabs b/test/sys/kernel/slab/posix_timers_cache/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/store_user b/test/sys/kernel/slab/posix_timers_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/posix_timers_cache/total_objects b/test/sys/kernel/slab/posix_timers_cache/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/trace b/test/sys/kernel/slab/posix_timers_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/posix_timers_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/posix_timers_cache/validate b/test/sys/kernel/slab/posix_timers_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/proc_inode_cache/aliases b/test/sys/kernel/slab/proc_inode_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/proc_inode_cache/align b/test/sys/kernel/slab/proc_inode_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/proc_inode_cache/alloc_calls b/test/sys/kernel/slab/proc_inode_cache/alloc_calls new file mode 100644 index 0000000000..94ba0de0b0 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/alloc_calls @@ -0,0 +1 @@ + 1494 proc_alloc_inode+0x1b/0x90 age=37936/91169/120402 pid=0-2796 cpus=0-1 diff --git a/test/sys/kernel/slab/proc_inode_cache/cache_dma b/test/sys/kernel/slab/proc_inode_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/proc_inode_cache/cpu_slabs b/test/sys/kernel/slab/proc_inode_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/proc_inode_cache/ctor b/test/sys/kernel/slab/proc_inode_cache/ctor new file mode 100644 index 0000000000..2940046f62 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/proc_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/proc_inode_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/proc_inode_cache/free_calls b/test/sys/kernel/slab/proc_inode_cache/free_calls new file mode 100644 index 0000000000..70bd8966be --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/free_calls @@ -0,0 +1,2 @@ + 1034 age=4294787699 pid=0 cpus=0 + 460 proc_destroy_inode+0x14/0x20 age=37964/91937/113464 pid=1-2812 cpus=0-1 diff --git a/test/sys/kernel/slab/proc_inode_cache/hwcache_align b/test/sys/kernel/slab/proc_inode_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/proc_inode_cache/object_size b/test/sys/kernel/slab/proc_inode_cache/object_size new file mode 100644 index 0000000000..b1e1a0c008 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/object_size @@ -0,0 +1 @@ +1120 diff --git a/test/sys/kernel/slab/proc_inode_cache/objects b/test/sys/kernel/slab/proc_inode_cache/objects new file mode 100644 index 0000000000..aa006a022d --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/objects @@ -0,0 +1 @@ +1519 diff --git a/test/sys/kernel/slab/proc_inode_cache/objects_partial b/test/sys/kernel/slab/proc_inode_cache/objects_partial new file mode 100644 index 0000000000..81b5c5d06c --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/objects_partial @@ -0,0 +1 @@ +37 diff --git a/test/sys/kernel/slab/proc_inode_cache/objs_per_slab b/test/sys/kernel/slab/proc_inode_cache/objs_per_slab new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/objs_per_slab @@ -0,0 +1 @@ +13 diff --git a/test/sys/kernel/slab/proc_inode_cache/order b/test/sys/kernel/slab/proc_inode_cache/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/proc_inode_cache/partial b/test/sys/kernel/slab/proc_inode_cache/partial new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/partial @@ -0,0 +1 @@ +4 diff --git a/test/sys/kernel/slab/proc_inode_cache/poison b/test/sys/kernel/slab/proc_inode_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/proc_inode_cache/reclaim_account b/test/sys/kernel/slab/proc_inode_cache/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/proc_inode_cache/red_zone b/test/sys/kernel/slab/proc_inode_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/proc_inode_cache/sanity_checks b/test/sys/kernel/slab/proc_inode_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/proc_inode_cache/shrink b/test/sys/kernel/slab/proc_inode_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/proc_inode_cache/slab_size b/test/sys/kernel/slab/proc_inode_cache/slab_size new file mode 100644 index 0000000000..8cdd21dbcb --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/slab_size @@ -0,0 +1 @@ +1192 diff --git a/test/sys/kernel/slab/proc_inode_cache/slabs b/test/sys/kernel/slab/proc_inode_cache/slabs new file mode 100644 index 0000000000..415196e47f --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/slabs @@ -0,0 +1 @@ +118 diff --git a/test/sys/kernel/slab/proc_inode_cache/store_user b/test/sys/kernel/slab/proc_inode_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/proc_inode_cache/total_objects b/test/sys/kernel/slab/proc_inode_cache/total_objects new file mode 100644 index 0000000000..effd6e7865 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/total_objects @@ -0,0 +1 @@ +1534 diff --git a/test/sys/kernel/slab/proc_inode_cache/trace b/test/sys/kernel/slab/proc_inode_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/proc_inode_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/proc_inode_cache/validate b/test/sys/kernel/slab/proc_inode_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/radix_tree_node/aliases b/test/sys/kernel/slab/radix_tree_node/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/radix_tree_node/align b/test/sys/kernel/slab/radix_tree_node/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/radix_tree_node/alloc_calls b/test/sys/kernel/slab/radix_tree_node/alloc_calls new file mode 100644 index 0000000000..e52bebe5ca --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/alloc_calls @@ -0,0 +1 @@ + 4597 radix_tree_preload+0x3b/0xb0 age=84/84258/119689 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/radix_tree_node/cache_dma b/test/sys/kernel/slab/radix_tree_node/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/radix_tree_node/cpu_slabs b/test/sys/kernel/slab/radix_tree_node/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/radix_tree_node/ctor b/test/sys/kernel/slab/radix_tree_node/ctor new file mode 100644 index 0000000000..0f30d5980c --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/ctor @@ -0,0 +1 @@ +radix_tree_node_ctor+0x0/0x10 diff --git a/test/sys/kernel/slab/radix_tree_node/destroy_by_rcu b/test/sys/kernel/slab/radix_tree_node/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/radix_tree_node/free_calls b/test/sys/kernel/slab/radix_tree_node/free_calls new file mode 100644 index 0000000000..92eb0cc935 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/free_calls @@ -0,0 +1,2 @@ + 2963 age=4294787708 pid=0 cpus=0 + 1634 radix_tree_node_rcu_free+0x41/0x50 age=12501/91637/119552 pid=0-2851 cpus=0-1 diff --git a/test/sys/kernel/slab/radix_tree_node/hwcache_align b/test/sys/kernel/slab/radix_tree_node/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/radix_tree_node/object_size b/test/sys/kernel/slab/radix_tree_node/object_size new file mode 100644 index 0000000000..f5e47edc5f --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/object_size @@ -0,0 +1 @@ +552 diff --git a/test/sys/kernel/slab/radix_tree_node/objects b/test/sys/kernel/slab/radix_tree_node/objects new file mode 100644 index 0000000000..3cf40c6880 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/objects @@ -0,0 +1 @@ +4602 diff --git a/test/sys/kernel/slab/radix_tree_node/objects_partial b/test/sys/kernel/slab/radix_tree_node/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/radix_tree_node/objs_per_slab b/test/sys/kernel/slab/radix_tree_node/objs_per_slab new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/objs_per_slab @@ -0,0 +1 @@ +13 diff --git a/test/sys/kernel/slab/radix_tree_node/order b/test/sys/kernel/slab/radix_tree_node/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/radix_tree_node/partial b/test/sys/kernel/slab/radix_tree_node/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/radix_tree_node/poison b/test/sys/kernel/slab/radix_tree_node/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/radix_tree_node/reclaim_account b/test/sys/kernel/slab/radix_tree_node/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/radix_tree_node/red_zone b/test/sys/kernel/slab/radix_tree_node/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/radix_tree_node/sanity_checks b/test/sys/kernel/slab/radix_tree_node/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/radix_tree_node/shrink b/test/sys/kernel/slab/radix_tree_node/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/radix_tree_node/slab_size b/test/sys/kernel/slab/radix_tree_node/slab_size new file mode 100644 index 0000000000..d27f552128 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/slab_size @@ -0,0 +1 @@ +624 diff --git a/test/sys/kernel/slab/radix_tree_node/slabs b/test/sys/kernel/slab/radix_tree_node/slabs new file mode 100644 index 0000000000..bc23f8ef56 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/slabs @@ -0,0 +1 @@ +354 diff --git a/test/sys/kernel/slab/radix_tree_node/store_user b/test/sys/kernel/slab/radix_tree_node/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/radix_tree_node/total_objects b/test/sys/kernel/slab/radix_tree_node/total_objects new file mode 100644 index 0000000000..3cf40c6880 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/total_objects @@ -0,0 +1 @@ +4602 diff --git a/test/sys/kernel/slab/radix_tree_node/trace b/test/sys/kernel/slab/radix_tree_node/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/radix_tree_node/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/radix_tree_node/validate b/test/sys/kernel/slab/radix_tree_node/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/request_sock_TCP/aliases b/test/sys/kernel/slab/request_sock_TCP/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/align b/test/sys/kernel/slab/request_sock_TCP/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/alloc_calls b/test/sys/kernel/slab/request_sock_TCP/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/request_sock_TCP/cache_dma b/test/sys/kernel/slab/request_sock_TCP/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/cpu_slabs b/test/sys/kernel/slab/request_sock_TCP/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/ctor b/test/sys/kernel/slab/request_sock_TCP/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/request_sock_TCP/destroy_by_rcu b/test/sys/kernel/slab/request_sock_TCP/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/free_calls b/test/sys/kernel/slab/request_sock_TCP/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/request_sock_TCP/hwcache_align b/test/sys/kernel/slab/request_sock_TCP/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCP/object_size b/test/sys/kernel/slab/request_sock_TCP/object_size new file mode 100644 index 0000000000..d22307c427 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/object_size @@ -0,0 +1 @@ +88 diff --git a/test/sys/kernel/slab/request_sock_TCP/objects b/test/sys/kernel/slab/request_sock_TCP/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/objects_partial b/test/sys/kernel/slab/request_sock_TCP/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/objs_per_slab b/test/sys/kernel/slab/request_sock_TCP/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/request_sock_TCP/order b/test/sys/kernel/slab/request_sock_TCP/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/partial b/test/sys/kernel/slab/request_sock_TCP/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/poison b/test/sys/kernel/slab/request_sock_TCP/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCP/reclaim_account b/test/sys/kernel/slab/request_sock_TCP/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/red_zone b/test/sys/kernel/slab/request_sock_TCP/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCP/sanity_checks b/test/sys/kernel/slab/request_sock_TCP/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCP/shrink b/test/sys/kernel/slab/request_sock_TCP/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/request_sock_TCP/slab_size b/test/sys/kernel/slab/request_sock_TCP/slab_size new file mode 100644 index 0000000000..86a0307199 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/slab_size @@ -0,0 +1 @@ +192 diff --git a/test/sys/kernel/slab/request_sock_TCP/slabs b/test/sys/kernel/slab/request_sock_TCP/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/store_user b/test/sys/kernel/slab/request_sock_TCP/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCP/total_objects b/test/sys/kernel/slab/request_sock_TCP/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/trace b/test/sys/kernel/slab/request_sock_TCP/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCP/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCP/validate b/test/sys/kernel/slab/request_sock_TCP/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/aliases b/test/sys/kernel/slab/request_sock_TCPv6/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/align b/test/sys/kernel/slab/request_sock_TCPv6/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/alloc_calls b/test/sys/kernel/slab/request_sock_TCPv6/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/request_sock_TCPv6/cache_dma b/test/sys/kernel/slab/request_sock_TCPv6/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs b/test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/ctor b/test/sys/kernel/slab/request_sock_TCPv6/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/destroy_by_rcu b/test/sys/kernel/slab/request_sock_TCPv6/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/free_calls b/test/sys/kernel/slab/request_sock_TCPv6/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/request_sock_TCPv6/hwcache_align b/test/sys/kernel/slab/request_sock_TCPv6/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/object_size b/test/sys/kernel/slab/request_sock_TCPv6/object_size new file mode 100644 index 0000000000..7296f257eb --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/object_size @@ -0,0 +1 @@ +136 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/objects b/test/sys/kernel/slab/request_sock_TCPv6/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/objects_partial b/test/sys/kernel/slab/request_sock_TCPv6/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/objs_per_slab b/test/sys/kernel/slab/request_sock_TCPv6/objs_per_slab new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/objs_per_slab @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/order b/test/sys/kernel/slab/request_sock_TCPv6/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/partial b/test/sys/kernel/slab/request_sock_TCPv6/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/poison b/test/sys/kernel/slab/request_sock_TCPv6/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/reclaim_account b/test/sys/kernel/slab/request_sock_TCPv6/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/red_zone b/test/sys/kernel/slab/request_sock_TCPv6/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/sanity_checks b/test/sys/kernel/slab/request_sock_TCPv6/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/shrink b/test/sys/kernel/slab/request_sock_TCPv6/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/slab_size b/test/sys/kernel/slab/request_sock_TCPv6/slab_size new file mode 100644 index 0000000000..9183bf03fc --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/slab_size @@ -0,0 +1 @@ +256 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/slabs b/test/sys/kernel/slab/request_sock_TCPv6/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/store_user b/test/sys/kernel/slab/request_sock_TCPv6/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/total_objects b/test/sys/kernel/slab/request_sock_TCPv6/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/trace b/test/sys/kernel/slab/request_sock_TCPv6/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/request_sock_TCPv6/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/validate b/test/sys/kernel/slab/request_sock_TCPv6/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/revoke_record/aliases b/test/sys/kernel/slab/revoke_record/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_record/align b/test/sys/kernel/slab/revoke_record/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_record/alloc_calls b/test/sys/kernel/slab/revoke_record/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/revoke_record/cache_dma b/test/sys/kernel/slab/revoke_record/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_record/cpu_slabs b/test/sys/kernel/slab/revoke_record/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_record/ctor b/test/sys/kernel/slab/revoke_record/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/revoke_record/destroy_by_rcu b/test/sys/kernel/slab/revoke_record/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_record/free_calls b/test/sys/kernel/slab/revoke_record/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/revoke_record/hwcache_align b/test/sys/kernel/slab/revoke_record/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_record/object_size b/test/sys/kernel/slab/revoke_record/object_size new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/object_size @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/revoke_record/objects b/test/sys/kernel/slab/revoke_record/objects new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/objects @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/revoke_record/objects_partial b/test/sys/kernel/slab/revoke_record/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_record/objs_per_slab b/test/sys/kernel/slab/revoke_record/objs_per_slab new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/objs_per_slab @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/revoke_record/order b/test/sys/kernel/slab/revoke_record/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_record/partial b/test/sys/kernel/slab/revoke_record/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_record/poison b/test/sys/kernel/slab/revoke_record/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_record/reclaim_account b/test/sys/kernel/slab/revoke_record/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_record/red_zone b/test/sys/kernel/slab/revoke_record/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_record/sanity_checks b/test/sys/kernel/slab/revoke_record/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_record/shrink b/test/sys/kernel/slab/revoke_record/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/revoke_record/slab_size b/test/sys/kernel/slab/revoke_record/slab_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/slab_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/revoke_record/slabs b/test/sys/kernel/slab/revoke_record/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/revoke_record/store_user b/test/sys/kernel/slab/revoke_record/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_record/total_objects b/test/sys/kernel/slab/revoke_record/total_objects new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/total_objects @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/revoke_record/trace b/test/sys/kernel/slab/revoke_record/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_record/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_record/validate b/test/sys/kernel/slab/revoke_record/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/revoke_table/aliases b/test/sys/kernel/slab/revoke_table/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/align b/test/sys/kernel/slab/revoke_table/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/alloc_calls b/test/sys/kernel/slab/revoke_table/alloc_calls new file mode 100644 index 0000000000..6ca0565e0a --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/alloc_calls @@ -0,0 +1 @@ + 4 journal_init_revoke_table+0x1b/0xb0 age=110219/114569/118919 pid=1-962 cpus=0 diff --git a/test/sys/kernel/slab/revoke_table/cache_dma b/test/sys/kernel/slab/revoke_table/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/cpu_slabs b/test/sys/kernel/slab/revoke_table/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/ctor b/test/sys/kernel/slab/revoke_table/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/revoke_table/destroy_by_rcu b/test/sys/kernel/slab/revoke_table/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/free_calls b/test/sys/kernel/slab/revoke_table/free_calls new file mode 100644 index 0000000000..1cda46c3ae --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/free_calls @@ -0,0 +1 @@ + 4 age=4294787960 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/revoke_table/hwcache_align b/test/sys/kernel/slab/revoke_table/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/object_size b/test/sys/kernel/slab/revoke_table/object_size new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/object_size @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/revoke_table/objects b/test/sys/kernel/slab/revoke_table/objects new file mode 100644 index 0000000000..9e5feb5256 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/objects @@ -0,0 +1 @@ +46 diff --git a/test/sys/kernel/slab/revoke_table/objects_partial b/test/sys/kernel/slab/revoke_table/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/objs_per_slab b/test/sys/kernel/slab/revoke_table/objs_per_slab new file mode 100644 index 0000000000..9e5feb5256 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/objs_per_slab @@ -0,0 +1 @@ +46 diff --git a/test/sys/kernel/slab/revoke_table/order b/test/sys/kernel/slab/revoke_table/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/partial b/test/sys/kernel/slab/revoke_table/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/poison b/test/sys/kernel/slab/revoke_table/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_table/reclaim_account b/test/sys/kernel/slab/revoke_table/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_table/red_zone b/test/sys/kernel/slab/revoke_table/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_table/sanity_checks b/test/sys/kernel/slab/revoke_table/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_table/shrink b/test/sys/kernel/slab/revoke_table/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/revoke_table/slab_size b/test/sys/kernel/slab/revoke_table/slab_size new file mode 100644 index 0000000000..d22307c427 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/slab_size @@ -0,0 +1 @@ +88 diff --git a/test/sys/kernel/slab/revoke_table/slabs b/test/sys/kernel/slab/revoke_table/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_table/store_user b/test/sys/kernel/slab/revoke_table/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/revoke_table/total_objects b/test/sys/kernel/slab/revoke_table/total_objects new file mode 100644 index 0000000000..9e5feb5256 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/total_objects @@ -0,0 +1 @@ +46 diff --git a/test/sys/kernel/slab/revoke_table/trace b/test/sys/kernel/slab/revoke_table/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/revoke_table/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/revoke_table/validate b/test/sys/kernel/slab/revoke_table/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/aliases b/test/sys/kernel/slab/scsi_cmd_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/align b/test/sys/kernel/slab/scsi_cmd_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls b/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls new file mode 100644 index 0000000000..cdba976f03 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls @@ -0,0 +1 @@ + 7 scsi_pool_alloc_command+0x25/0x80 age=43687/109275/120382 pid=1-2754 cpus=0-1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/cache_dma b/test/sys/kernel/slab/scsi_cmd_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs b/test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/ctor b/test/sys/kernel/slab/scsi_cmd_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu b/test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/free_calls b/test/sys/kernel/slab/scsi_cmd_cache/free_calls new file mode 100644 index 0000000000..53abe0278f --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/free_calls @@ -0,0 +1,2 @@ + 5 age=4294788016 pid=0 cpus=0 + 2 scsi_pool_free_command+0x4c/0x60 age=48186/84035/119885 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/hwcache_align b/test/sys/kernel/slab/scsi_cmd_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/object_size b/test/sys/kernel/slab/scsi_cmd_cache/object_size new file mode 100644 index 0000000000..18eed1357e --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/object_size @@ -0,0 +1 @@ +320 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/objects b/test/sys/kernel/slab/scsi_cmd_cache/objects new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/objects @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/objects_partial b/test/sys/kernel/slab/scsi_cmd_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab b/test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab @@ -0,0 +1 @@ +18 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/order b/test/sys/kernel/slab/scsi_cmd_cache/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/partial b/test/sys/kernel/slab/scsi_cmd_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/poison b/test/sys/kernel/slab/scsi_cmd_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/reclaim_account b/test/sys/kernel/slab/scsi_cmd_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/red_zone b/test/sys/kernel/slab/scsi_cmd_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/sanity_checks b/test/sys/kernel/slab/scsi_cmd_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/shrink b/test/sys/kernel/slab/scsi_cmd_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/slab_size b/test/sys/kernel/slab/scsi_cmd_cache/slab_size new file mode 100644 index 0000000000..5379c470da --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/slab_size @@ -0,0 +1 @@ +448 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/slabs b/test/sys/kernel/slab/scsi_cmd_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/store_user b/test/sys/kernel/slab/scsi_cmd_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/total_objects b/test/sys/kernel/slab/scsi_cmd_cache/total_objects new file mode 100644 index 0000000000..7facc89938 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/total_objects @@ -0,0 +1 @@ +36 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/trace b/test/sys/kernel/slab/scsi_cmd_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_cmd_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/validate b/test/sys/kernel/slab/scsi_cmd_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_data_buffer/aliases b/test/sys/kernel/slab/scsi_data_buffer/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/align b/test/sys/kernel/slab/scsi_data_buffer/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/alloc_calls b/test/sys/kernel/slab/scsi_data_buffer/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/scsi_data_buffer/cache_dma b/test/sys/kernel/slab/scsi_data_buffer/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/cpu_slabs b/test/sys/kernel/slab/scsi_data_buffer/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/ctor b/test/sys/kernel/slab/scsi_data_buffer/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_data_buffer/destroy_by_rcu b/test/sys/kernel/slab/scsi_data_buffer/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/free_calls b/test/sys/kernel/slab/scsi_data_buffer/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/scsi_data_buffer/hwcache_align b/test/sys/kernel/slab/scsi_data_buffer/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/object_size b/test/sys/kernel/slab/scsi_data_buffer/object_size new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/object_size @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/scsi_data_buffer/objects b/test/sys/kernel/slab/scsi_data_buffer/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/objects_partial b/test/sys/kernel/slab/scsi_data_buffer/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/objs_per_slab b/test/sys/kernel/slab/scsi_data_buffer/objs_per_slab new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/objs_per_slab @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/scsi_data_buffer/order b/test/sys/kernel/slab/scsi_data_buffer/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/partial b/test/sys/kernel/slab/scsi_data_buffer/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/poison b/test/sys/kernel/slab/scsi_data_buffer/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_data_buffer/reclaim_account b/test/sys/kernel/slab/scsi_data_buffer/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/red_zone b/test/sys/kernel/slab/scsi_data_buffer/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_data_buffer/sanity_checks b/test/sys/kernel/slab/scsi_data_buffer/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_data_buffer/shrink b/test/sys/kernel/slab/scsi_data_buffer/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_data_buffer/slab_size b/test/sys/kernel/slab/scsi_data_buffer/slab_size new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/slab_size @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/scsi_data_buffer/slabs b/test/sys/kernel/slab/scsi_data_buffer/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/store_user b/test/sys/kernel/slab/scsi_data_buffer/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_data_buffer/total_objects b/test/sys/kernel/slab/scsi_data_buffer/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/trace b/test/sys/kernel/slab/scsi_data_buffer/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_data_buffer/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/validate b/test/sys/kernel/slab/scsi_data_buffer/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_io_context/aliases b/test/sys/kernel/slab/scsi_io_context/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/align b/test/sys/kernel/slab/scsi_io_context/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/alloc_calls b/test/sys/kernel/slab/scsi_io_context/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/scsi_io_context/cache_dma b/test/sys/kernel/slab/scsi_io_context/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/cpu_slabs b/test/sys/kernel/slab/scsi_io_context/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/ctor b/test/sys/kernel/slab/scsi_io_context/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_io_context/destroy_by_rcu b/test/sys/kernel/slab/scsi_io_context/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/free_calls b/test/sys/kernel/slab/scsi_io_context/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/scsi_io_context/hwcache_align b/test/sys/kernel/slab/scsi_io_context/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/object_size b/test/sys/kernel/slab/scsi_io_context/object_size new file mode 100644 index 0000000000..194b81caae --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/object_size @@ -0,0 +1 @@ +112 diff --git a/test/sys/kernel/slab/scsi_io_context/objects b/test/sys/kernel/slab/scsi_io_context/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/objects_partial b/test/sys/kernel/slab/scsi_io_context/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/objs_per_slab b/test/sys/kernel/slab/scsi_io_context/objs_per_slab new file mode 100644 index 0000000000..2bd5a0a98a --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/objs_per_slab @@ -0,0 +1 @@ +22 diff --git a/test/sys/kernel/slab/scsi_io_context/order b/test/sys/kernel/slab/scsi_io_context/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/partial b/test/sys/kernel/slab/scsi_io_context/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/poison b/test/sys/kernel/slab/scsi_io_context/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_io_context/reclaim_account b/test/sys/kernel/slab/scsi_io_context/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/red_zone b/test/sys/kernel/slab/scsi_io_context/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_io_context/sanity_checks b/test/sys/kernel/slab/scsi_io_context/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_io_context/shrink b/test/sys/kernel/slab/scsi_io_context/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_io_context/slab_size b/test/sys/kernel/slab/scsi_io_context/slab_size new file mode 100644 index 0000000000..dc37bbdb81 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/slab_size @@ -0,0 +1 @@ +184 diff --git a/test/sys/kernel/slab/scsi_io_context/slabs b/test/sys/kernel/slab/scsi_io_context/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/store_user b/test/sys/kernel/slab/scsi_io_context/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_io_context/total_objects b/test/sys/kernel/slab/scsi_io_context/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/trace b/test/sys/kernel/slab/scsi_io_context/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_io_context/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_io_context/validate b/test/sys/kernel/slab/scsi_io_context/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_sense_cache/aliases b/test/sys/kernel/slab/scsi_sense_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/align b/test/sys/kernel/slab/scsi_sense_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/alloc_calls b/test/sys/kernel/slab/scsi_sense_cache/alloc_calls new file mode 100644 index 0000000000..d6d238840c --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/alloc_calls @@ -0,0 +1 @@ + 7 scsi_pool_alloc_command+0x4a/0x80 age=43690/109278/120385 pid=1-2754 cpus=0-1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/cache_dma b/test/sys/kernel/slab/scsi_sense_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/cpu_slabs b/test/sys/kernel/slab/scsi_sense_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/ctor b/test/sys/kernel/slab/scsi_sense_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_sense_cache/destroy_by_rcu b/test/sys/kernel/slab/scsi_sense_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/free_calls b/test/sys/kernel/slab/scsi_sense_cache/free_calls new file mode 100644 index 0000000000..bee684817a --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/free_calls @@ -0,0 +1,2 @@ + 5 age=4294788020 pid=0 cpus=0 + 2 scsi_pool_free_command+0x40/0x60 age=48190/84039/119889 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/hwcache_align b/test/sys/kernel/slab/scsi_sense_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/object_size b/test/sys/kernel/slab/scsi_sense_cache/object_size new file mode 100644 index 0000000000..f906e1845d --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/object_size @@ -0,0 +1 @@ +96 diff --git a/test/sys/kernel/slab/scsi_sense_cache/objects b/test/sys/kernel/slab/scsi_sense_cache/objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/scsi_sense_cache/objects_partial b/test/sys/kernel/slab/scsi_sense_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/objs_per_slab b/test/sys/kernel/slab/scsi_sense_cache/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/scsi_sense_cache/order b/test/sys/kernel/slab/scsi_sense_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/partial b/test/sys/kernel/slab/scsi_sense_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/poison b/test/sys/kernel/slab/scsi_sense_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/reclaim_account b/test/sys/kernel/slab/scsi_sense_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/red_zone b/test/sys/kernel/slab/scsi_sense_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/sanity_checks b/test/sys/kernel/slab/scsi_sense_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/shrink b/test/sys/kernel/slab/scsi_sense_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/scsi_sense_cache/slab_size b/test/sys/kernel/slab/scsi_sense_cache/slab_size new file mode 100644 index 0000000000..86a0307199 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/slab_size @@ -0,0 +1 @@ +192 diff --git a/test/sys/kernel/slab/scsi_sense_cache/slabs b/test/sys/kernel/slab/scsi_sense_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/scsi_sense_cache/store_user b/test/sys/kernel/slab/scsi_sense_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/total_objects b/test/sys/kernel/slab/scsi_sense_cache/total_objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/total_objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/scsi_sense_cache/trace b/test/sys/kernel/slab/scsi_sense_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/scsi_sense_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/validate b/test/sys/kernel/slab/scsi_sense_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/secpath_cache/aliases b/test/sys/kernel/slab/secpath_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/align b/test/sys/kernel/slab/secpath_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/alloc_calls b/test/sys/kernel/slab/secpath_cache/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/secpath_cache/cache_dma b/test/sys/kernel/slab/secpath_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/cpu_slabs b/test/sys/kernel/slab/secpath_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/ctor b/test/sys/kernel/slab/secpath_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/secpath_cache/destroy_by_rcu b/test/sys/kernel/slab/secpath_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/free_calls b/test/sys/kernel/slab/secpath_cache/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/secpath_cache/hwcache_align b/test/sys/kernel/slab/secpath_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/secpath_cache/object_size b/test/sys/kernel/slab/secpath_cache/object_size new file mode 100644 index 0000000000..f6b91e0e1f --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/object_size @@ -0,0 +1 @@ +56 diff --git a/test/sys/kernel/slab/secpath_cache/objects b/test/sys/kernel/slab/secpath_cache/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/objects_partial b/test/sys/kernel/slab/secpath_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/objs_per_slab b/test/sys/kernel/slab/secpath_cache/objs_per_slab new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/objs_per_slab @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/secpath_cache/order b/test/sys/kernel/slab/secpath_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/partial b/test/sys/kernel/slab/secpath_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/poison b/test/sys/kernel/slab/secpath_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/secpath_cache/reclaim_account b/test/sys/kernel/slab/secpath_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/red_zone b/test/sys/kernel/slab/secpath_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/secpath_cache/sanity_checks b/test/sys/kernel/slab/secpath_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/secpath_cache/shrink b/test/sys/kernel/slab/secpath_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/secpath_cache/slab_size b/test/sys/kernel/slab/secpath_cache/slab_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/slab_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/secpath_cache/slabs b/test/sys/kernel/slab/secpath_cache/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/store_user b/test/sys/kernel/slab/secpath_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/secpath_cache/total_objects b/test/sys/kernel/slab/secpath_cache/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/trace b/test/sys/kernel/slab/secpath_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/secpath_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/secpath_cache/validate b/test/sys/kernel/slab/secpath_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-128/aliases b/test/sys/kernel/slab/sgpool-128/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-128/align b/test/sys/kernel/slab/sgpool-128/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-128/alloc_calls b/test/sys/kernel/slab/sgpool-128/alloc_calls new file mode 100644 index 0000000000..c0d9ac65f3 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=119989/119989/119989 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-128/cache_dma b/test/sys/kernel/slab/sgpool-128/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-128/cpu_slabs b/test/sys/kernel/slab/sgpool-128/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-128/ctor b/test/sys/kernel/slab/sgpool-128/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-128/destroy_by_rcu b/test/sys/kernel/slab/sgpool-128/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-128/free_calls b/test/sys/kernel/slab/sgpool-128/free_calls new file mode 100644 index 0000000000..5f601dae33 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/free_calls @@ -0,0 +1 @@ + 2 age=4294787538 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-128/hwcache_align b/test/sys/kernel/slab/sgpool-128/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-128/object_size b/test/sys/kernel/slab/sgpool-128/object_size new file mode 100644 index 0000000000..801c306ed3 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/object_size @@ -0,0 +1 @@ +4096 diff --git a/test/sys/kernel/slab/sgpool-128/objects b/test/sys/kernel/slab/sgpool-128/objects new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/objects @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/sgpool-128/objects_partial b/test/sys/kernel/slab/sgpool-128/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-128/objs_per_slab b/test/sys/kernel/slab/sgpool-128/objs_per_slab new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/objs_per_slab @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/sgpool-128/order b/test/sys/kernel/slab/sgpool-128/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/sgpool-128/partial b/test/sys/kernel/slab/sgpool-128/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-128/poison b/test/sys/kernel/slab/sgpool-128/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-128/reclaim_account b/test/sys/kernel/slab/sgpool-128/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-128/red_zone b/test/sys/kernel/slab/sgpool-128/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-128/sanity_checks b/test/sys/kernel/slab/sgpool-128/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-128/shrink b/test/sys/kernel/slab/sgpool-128/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-128/slab_size b/test/sys/kernel/slab/sgpool-128/slab_size new file mode 100644 index 0000000000..7137ddbe18 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/slab_size @@ -0,0 +1 @@ +4224 diff --git a/test/sys/kernel/slab/sgpool-128/slabs b/test/sys/kernel/slab/sgpool-128/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-128/store_user b/test/sys/kernel/slab/sgpool-128/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-128/total_objects b/test/sys/kernel/slab/sgpool-128/total_objects new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/total_objects @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/sgpool-128/trace b/test/sys/kernel/slab/sgpool-128/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-128/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-128/validate b/test/sys/kernel/slab/sgpool-128/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-16/aliases b/test/sys/kernel/slab/sgpool-16/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-16/align b/test/sys/kernel/slab/sgpool-16/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-16/alloc_calls b/test/sys/kernel/slab/sgpool-16/alloc_calls new file mode 100644 index 0000000000..ae43727ae6 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=120001/120001/120001 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-16/cache_dma b/test/sys/kernel/slab/sgpool-16/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-16/cpu_slabs b/test/sys/kernel/slab/sgpool-16/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-16/ctor b/test/sys/kernel/slab/sgpool-16/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-16/destroy_by_rcu b/test/sys/kernel/slab/sgpool-16/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-16/free_calls b/test/sys/kernel/slab/sgpool-16/free_calls new file mode 100644 index 0000000000..21b956a4db --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/free_calls @@ -0,0 +1 @@ + 2 age=4294787550 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-16/hwcache_align b/test/sys/kernel/slab/sgpool-16/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-16/object_size b/test/sys/kernel/slab/sgpool-16/object_size new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/object_size @@ -0,0 +1 @@ +512 diff --git a/test/sys/kernel/slab/sgpool-16/objects b/test/sys/kernel/slab/sgpool-16/objects new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/objects @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/sgpool-16/objects_partial b/test/sys/kernel/slab/sgpool-16/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-16/objs_per_slab b/test/sys/kernel/slab/sgpool-16/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/sgpool-16/order b/test/sys/kernel/slab/sgpool-16/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-16/partial b/test/sys/kernel/slab/sgpool-16/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-16/poison b/test/sys/kernel/slab/sgpool-16/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-16/reclaim_account b/test/sys/kernel/slab/sgpool-16/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-16/red_zone b/test/sys/kernel/slab/sgpool-16/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-16/sanity_checks b/test/sys/kernel/slab/sgpool-16/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-16/shrink b/test/sys/kernel/slab/sgpool-16/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-16/slab_size b/test/sys/kernel/slab/sgpool-16/slab_size new file mode 100644 index 0000000000..fe4d93ae13 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/slab_size @@ -0,0 +1 @@ +640 diff --git a/test/sys/kernel/slab/sgpool-16/slabs b/test/sys/kernel/slab/sgpool-16/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/sgpool-16/store_user b/test/sys/kernel/slab/sgpool-16/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-16/total_objects b/test/sys/kernel/slab/sgpool-16/total_objects new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/total_objects @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/sgpool-16/trace b/test/sys/kernel/slab/sgpool-16/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-16/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-16/validate b/test/sys/kernel/slab/sgpool-16/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-32/aliases b/test/sys/kernel/slab/sgpool-32/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-32/align b/test/sys/kernel/slab/sgpool-32/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-32/alloc_calls b/test/sys/kernel/slab/sgpool-32/alloc_calls new file mode 100644 index 0000000000..e8052fd765 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=119996/119996/119996 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-32/cache_dma b/test/sys/kernel/slab/sgpool-32/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-32/cpu_slabs b/test/sys/kernel/slab/sgpool-32/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-32/ctor b/test/sys/kernel/slab/sgpool-32/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-32/destroy_by_rcu b/test/sys/kernel/slab/sgpool-32/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-32/free_calls b/test/sys/kernel/slab/sgpool-32/free_calls new file mode 100644 index 0000000000..f46df64aeb --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/free_calls @@ -0,0 +1 @@ + 2 age=4294787546 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-32/hwcache_align b/test/sys/kernel/slab/sgpool-32/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-32/object_size b/test/sys/kernel/slab/sgpool-32/object_size new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/object_size @@ -0,0 +1 @@ +1024 diff --git a/test/sys/kernel/slab/sgpool-32/objects b/test/sys/kernel/slab/sgpool-32/objects new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/objects @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/sgpool-32/objects_partial b/test/sys/kernel/slab/sgpool-32/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-32/objs_per_slab b/test/sys/kernel/slab/sgpool-32/objs_per_slab new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/objs_per_slab @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/sgpool-32/order b/test/sys/kernel/slab/sgpool-32/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/sgpool-32/partial b/test/sys/kernel/slab/sgpool-32/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-32/poison b/test/sys/kernel/slab/sgpool-32/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-32/reclaim_account b/test/sys/kernel/slab/sgpool-32/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-32/red_zone b/test/sys/kernel/slab/sgpool-32/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-32/sanity_checks b/test/sys/kernel/slab/sgpool-32/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-32/shrink b/test/sys/kernel/slab/sgpool-32/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-32/slab_size b/test/sys/kernel/slab/sgpool-32/slab_size new file mode 100644 index 0000000000..d98057a110 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/slab_size @@ -0,0 +1 @@ +1152 diff --git a/test/sys/kernel/slab/sgpool-32/slabs b/test/sys/kernel/slab/sgpool-32/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/sgpool-32/store_user b/test/sys/kernel/slab/sgpool-32/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-32/total_objects b/test/sys/kernel/slab/sgpool-32/total_objects new file mode 100644 index 0000000000..9902f17848 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/total_objects @@ -0,0 +1 @@ +28 diff --git a/test/sys/kernel/slab/sgpool-32/trace b/test/sys/kernel/slab/sgpool-32/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-32/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-32/validate b/test/sys/kernel/slab/sgpool-32/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-64/aliases b/test/sys/kernel/slab/sgpool-64/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-64/align b/test/sys/kernel/slab/sgpool-64/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-64/alloc_calls b/test/sys/kernel/slab/sgpool-64/alloc_calls new file mode 100644 index 0000000000..ff5b09f88d --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=119993/119993/119993 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-64/cache_dma b/test/sys/kernel/slab/sgpool-64/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-64/cpu_slabs b/test/sys/kernel/slab/sgpool-64/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-64/ctor b/test/sys/kernel/slab/sgpool-64/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-64/destroy_by_rcu b/test/sys/kernel/slab/sgpool-64/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-64/free_calls b/test/sys/kernel/slab/sgpool-64/free_calls new file mode 100644 index 0000000000..5a9c7452c6 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/free_calls @@ -0,0 +1 @@ + 2 age=4294787542 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-64/hwcache_align b/test/sys/kernel/slab/sgpool-64/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-64/object_size b/test/sys/kernel/slab/sgpool-64/object_size new file mode 100644 index 0000000000..c873496a22 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/object_size @@ -0,0 +1 @@ +2048 diff --git a/test/sys/kernel/slab/sgpool-64/objects b/test/sys/kernel/slab/sgpool-64/objects new file mode 100644 index 0000000000..64bb6b746d --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/objects @@ -0,0 +1 @@ +30 diff --git a/test/sys/kernel/slab/sgpool-64/objects_partial b/test/sys/kernel/slab/sgpool-64/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-64/objs_per_slab b/test/sys/kernel/slab/sgpool-64/objs_per_slab new file mode 100644 index 0000000000..60d3b2f4a4 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/objs_per_slab @@ -0,0 +1 @@ +15 diff --git a/test/sys/kernel/slab/sgpool-64/order b/test/sys/kernel/slab/sgpool-64/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/sgpool-64/partial b/test/sys/kernel/slab/sgpool-64/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-64/poison b/test/sys/kernel/slab/sgpool-64/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-64/reclaim_account b/test/sys/kernel/slab/sgpool-64/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-64/red_zone b/test/sys/kernel/slab/sgpool-64/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-64/sanity_checks b/test/sys/kernel/slab/sgpool-64/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-64/shrink b/test/sys/kernel/slab/sgpool-64/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-64/slab_size b/test/sys/kernel/slab/sgpool-64/slab_size new file mode 100644 index 0000000000..f52b3ac70f --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/slab_size @@ -0,0 +1 @@ +2176 diff --git a/test/sys/kernel/slab/sgpool-64/slabs b/test/sys/kernel/slab/sgpool-64/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/sgpool-64/store_user b/test/sys/kernel/slab/sgpool-64/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-64/total_objects b/test/sys/kernel/slab/sgpool-64/total_objects new file mode 100644 index 0000000000..64bb6b746d --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/total_objects @@ -0,0 +1 @@ +30 diff --git a/test/sys/kernel/slab/sgpool-64/trace b/test/sys/kernel/slab/sgpool-64/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-64/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-64/validate b/test/sys/kernel/slab/sgpool-64/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-8/aliases b/test/sys/kernel/slab/sgpool-8/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-8/align b/test/sys/kernel/slab/sgpool-8/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-8/alloc_calls b/test/sys/kernel/slab/sgpool-8/alloc_calls new file mode 100644 index 0000000000..26fc37cdfc --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/alloc_calls @@ -0,0 +1 @@ + 2 mempool_alloc_slab+0x11/0x20 age=120005/120005/120005 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-8/cache_dma b/test/sys/kernel/slab/sgpool-8/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-8/cpu_slabs b/test/sys/kernel/slab/sgpool-8/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-8/ctor b/test/sys/kernel/slab/sgpool-8/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-8/destroy_by_rcu b/test/sys/kernel/slab/sgpool-8/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-8/free_calls b/test/sys/kernel/slab/sgpool-8/free_calls new file mode 100644 index 0000000000..2b610a7b29 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/free_calls @@ -0,0 +1 @@ + 2 age=4294787554 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-8/hwcache_align b/test/sys/kernel/slab/sgpool-8/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-8/object_size b/test/sys/kernel/slab/sgpool-8/object_size new file mode 100644 index 0000000000..9183bf03fc --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/object_size @@ -0,0 +1 @@ +256 diff --git a/test/sys/kernel/slab/sgpool-8/objects b/test/sys/kernel/slab/sgpool-8/objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/sgpool-8/objects_partial b/test/sys/kernel/slab/sgpool-8/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-8/objs_per_slab b/test/sys/kernel/slab/sgpool-8/objs_per_slab new file mode 100644 index 0000000000..aabe6ec390 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/objs_per_slab @@ -0,0 +1 @@ +21 diff --git a/test/sys/kernel/slab/sgpool-8/order b/test/sys/kernel/slab/sgpool-8/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-8/partial b/test/sys/kernel/slab/sgpool-8/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-8/poison b/test/sys/kernel/slab/sgpool-8/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-8/reclaim_account b/test/sys/kernel/slab/sgpool-8/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-8/red_zone b/test/sys/kernel/slab/sgpool-8/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-8/sanity_checks b/test/sys/kernel/slab/sgpool-8/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-8/shrink b/test/sys/kernel/slab/sgpool-8/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sgpool-8/slab_size b/test/sys/kernel/slab/sgpool-8/slab_size new file mode 100644 index 0000000000..e45b99e958 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/slab_size @@ -0,0 +1 @@ +384 diff --git a/test/sys/kernel/slab/sgpool-8/slabs b/test/sys/kernel/slab/sgpool-8/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/sgpool-8/store_user b/test/sys/kernel/slab/sgpool-8/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sgpool-8/total_objects b/test/sys/kernel/slab/sgpool-8/total_objects new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/total_objects @@ -0,0 +1 @@ +42 diff --git a/test/sys/kernel/slab/sgpool-8/trace b/test/sys/kernel/slab/sgpool-8/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sgpool-8/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sgpool-8/validate b/test/sys/kernel/slab/sgpool-8/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/shmem_inode_cache/aliases b/test/sys/kernel/slab/shmem_inode_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/align b/test/sys/kernel/slab/shmem_inode_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/alloc_calls b/test/sys/kernel/slab/shmem_inode_cache/alloc_calls new file mode 100644 index 0000000000..70c6630dc8 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/alloc_calls @@ -0,0 +1 @@ + 1144 shmem_alloc_inode+0x15/0x30 age=14176/107762/119829 pid=1-2802 cpus=0-1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/cache_dma b/test/sys/kernel/slab/shmem_inode_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/cpu_slabs b/test/sys/kernel/slab/shmem_inode_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/ctor b/test/sys/kernel/slab/shmem_inode_cache/ctor new file mode 100644 index 0000000000..54aeafc423 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x40 diff --git a/test/sys/kernel/slab/shmem_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/shmem_inode_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/free_calls b/test/sys/kernel/slab/shmem_inode_cache/free_calls new file mode 100644 index 0000000000..31b5ec86ba --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/free_calls @@ -0,0 +1,2 @@ + 774 age=4294787413 pid=0 cpus=0 + 370 shmem_destroy_inode+0x24/0x30 age=37765/101539/116543 pid=72-2802 cpus=0-1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/hwcache_align b/test/sys/kernel/slab/shmem_inode_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/object_size b/test/sys/kernel/slab/shmem_inode_cache/object_size new file mode 100644 index 0000000000..a38c571765 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/object_size @@ -0,0 +1 @@ +1328 diff --git a/test/sys/kernel/slab/shmem_inode_cache/objects b/test/sys/kernel/slab/shmem_inode_cache/objects new file mode 100644 index 0000000000..765f5bf7fa --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/objects @@ -0,0 +1 @@ +1150 diff --git a/test/sys/kernel/slab/shmem_inode_cache/objects_partial b/test/sys/kernel/slab/shmem_inode_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/objs_per_slab b/test/sys/kernel/slab/shmem_inode_cache/objs_per_slab new file mode 100644 index 0000000000..409940768f --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/objs_per_slab @@ -0,0 +1 @@ +23 diff --git a/test/sys/kernel/slab/shmem_inode_cache/order b/test/sys/kernel/slab/shmem_inode_cache/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/shmem_inode_cache/partial b/test/sys/kernel/slab/shmem_inode_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/poison b/test/sys/kernel/slab/shmem_inode_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/reclaim_account b/test/sys/kernel/slab/shmem_inode_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/red_zone b/test/sys/kernel/slab/shmem_inode_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/sanity_checks b/test/sys/kernel/slab/shmem_inode_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/shrink b/test/sys/kernel/slab/shmem_inode_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/shmem_inode_cache/slab_size b/test/sys/kernel/slab/shmem_inode_cache/slab_size new file mode 100644 index 0000000000..50989ffea1 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/slab_size @@ -0,0 +1 @@ +1400 diff --git a/test/sys/kernel/slab/shmem_inode_cache/slabs b/test/sys/kernel/slab/shmem_inode_cache/slabs new file mode 100644 index 0000000000..e373ee695f --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/slabs @@ -0,0 +1 @@ +50 diff --git a/test/sys/kernel/slab/shmem_inode_cache/store_user b/test/sys/kernel/slab/shmem_inode_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/total_objects b/test/sys/kernel/slab/shmem_inode_cache/total_objects new file mode 100644 index 0000000000..765f5bf7fa --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/total_objects @@ -0,0 +1 @@ +1150 diff --git a/test/sys/kernel/slab/shmem_inode_cache/trace b/test/sys/kernel/slab/shmem_inode_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/shmem_inode_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/validate b/test/sys/kernel/slab/shmem_inode_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sighand_cache/aliases b/test/sys/kernel/slab/sighand_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sighand_cache/align b/test/sys/kernel/slab/sighand_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sighand_cache/alloc_calls b/test/sys/kernel/slab/sighand_cache/alloc_calls new file mode 100644 index 0000000000..b015b782a2 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/alloc_calls @@ -0,0 +1,2 @@ + 122 copy_process+0x82a/0x1220 age=3754/97369/120458 pid=0-2850 cpus=0-1 + 1 flush_old_exec+0x4e1/0x8a0 age=118709 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sighand_cache/cache_dma b/test/sys/kernel/slab/sighand_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sighand_cache/cpu_slabs b/test/sys/kernel/slab/sighand_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sighand_cache/ctor b/test/sys/kernel/slab/sighand_cache/ctor new file mode 100644 index 0000000000..27bc087a5c --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/ctor @@ -0,0 +1 @@ +sighand_ctor+0x0/0x40 diff --git a/test/sys/kernel/slab/sighand_cache/destroy_by_rcu b/test/sys/kernel/slab/sighand_cache/destroy_by_rcu new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/destroy_by_rcu @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sighand_cache/free_calls b/test/sys/kernel/slab/sighand_cache/free_calls new file mode 100644 index 0000000000..dc73485a27 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/free_calls @@ -0,0 +1,2 @@ + 47 age=4294787803 pid=0 cpus=0 + 76 __cleanup_sighand+0x27/0x30 age=4749/90635/116387 pid=1-2886 cpus=0-1 diff --git a/test/sys/kernel/slab/sighand_cache/hwcache_align b/test/sys/kernel/slab/sighand_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sighand_cache/object_size b/test/sys/kernel/slab/sighand_cache/object_size new file mode 100644 index 0000000000..523688b618 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/object_size @@ -0,0 +1 @@ +2184 diff --git a/test/sys/kernel/slab/sighand_cache/objects b/test/sys/kernel/slab/sighand_cache/objects new file mode 100644 index 0000000000..065fd3e79c --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/objects @@ -0,0 +1 @@ +137 diff --git a/test/sys/kernel/slab/sighand_cache/objects_partial b/test/sys/kernel/slab/sighand_cache/objects_partial new file mode 100644 index 0000000000..7273c0fa8c --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/objects_partial @@ -0,0 +1 @@ +25 diff --git a/test/sys/kernel/slab/sighand_cache/objs_per_slab b/test/sys/kernel/slab/sighand_cache/objs_per_slab new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/objs_per_slab @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/sighand_cache/order b/test/sys/kernel/slab/sighand_cache/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/sighand_cache/partial b/test/sys/kernel/slab/sighand_cache/partial new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/partial @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/sighand_cache/poison b/test/sys/kernel/slab/sighand_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sighand_cache/reclaim_account b/test/sys/kernel/slab/sighand_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sighand_cache/red_zone b/test/sys/kernel/slab/sighand_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sighand_cache/sanity_checks b/test/sys/kernel/slab/sighand_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sighand_cache/shrink b/test/sys/kernel/slab/sighand_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sighand_cache/slab_size b/test/sys/kernel/slab/sighand_cache/slab_size new file mode 100644 index 0000000000..c801f0a47c --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/slab_size @@ -0,0 +1 @@ +2304 diff --git a/test/sys/kernel/slab/sighand_cache/slabs b/test/sys/kernel/slab/sighand_cache/slabs new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/slabs @@ -0,0 +1 @@ +10 diff --git a/test/sys/kernel/slab/sighand_cache/store_user b/test/sys/kernel/slab/sighand_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sighand_cache/total_objects b/test/sys/kernel/slab/sighand_cache/total_objects new file mode 100644 index 0000000000..dee261df40 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/total_objects @@ -0,0 +1 @@ +140 diff --git a/test/sys/kernel/slab/sighand_cache/trace b/test/sys/kernel/slab/sighand_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sighand_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sighand_cache/validate b/test/sys/kernel/slab/sighand_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/signal_cache/aliases b/test/sys/kernel/slab/signal_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/signal_cache/align b/test/sys/kernel/slab/signal_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/signal_cache/alloc_calls b/test/sys/kernel/slab/signal_cache/alloc_calls new file mode 100644 index 0000000000..6bbb2d8332 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/alloc_calls @@ -0,0 +1 @@ + 123 copy_process+0x93c/0x1220 age=3749/97552/120453 pid=0-2850 cpus=0-1 diff --git a/test/sys/kernel/slab/signal_cache/cache_dma b/test/sys/kernel/slab/signal_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/signal_cache/cpu_slabs b/test/sys/kernel/slab/signal_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/signal_cache/ctor b/test/sys/kernel/slab/signal_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/signal_cache/destroy_by_rcu b/test/sys/kernel/slab/signal_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/signal_cache/free_calls b/test/sys/kernel/slab/signal_cache/free_calls new file mode 100644 index 0000000000..d79c251344 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/free_calls @@ -0,0 +1,2 @@ + 42 age=4294787798 pid=0 cpus=0 + 81 __cleanup_signal+0x20/0x30 age=4744/91183/116382 pid=1-2886 cpus=0-1 diff --git a/test/sys/kernel/slab/signal_cache/hwcache_align b/test/sys/kernel/slab/signal_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/signal_cache/object_size b/test/sys/kernel/slab/signal_cache/object_size new file mode 100644 index 0000000000..4564b1f0a0 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/object_size @@ -0,0 +1 @@ +896 diff --git a/test/sys/kernel/slab/signal_cache/objects b/test/sys/kernel/slab/signal_cache/objects new file mode 100644 index 0000000000..b4f334f265 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/objects @@ -0,0 +1 @@ +141 diff --git a/test/sys/kernel/slab/signal_cache/objects_partial b/test/sys/kernel/slab/signal_cache/objects_partial new file mode 100644 index 0000000000..ea90ee3198 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/objects_partial @@ -0,0 +1 @@ +45 diff --git a/test/sys/kernel/slab/signal_cache/objs_per_slab b/test/sys/kernel/slab/signal_cache/objs_per_slab new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/objs_per_slab @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/signal_cache/order b/test/sys/kernel/slab/signal_cache/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/signal_cache/partial b/test/sys/kernel/slab/signal_cache/partial new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/partial @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/signal_cache/poison b/test/sys/kernel/slab/signal_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/signal_cache/reclaim_account b/test/sys/kernel/slab/signal_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/signal_cache/red_zone b/test/sys/kernel/slab/signal_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/signal_cache/sanity_checks b/test/sys/kernel/slab/signal_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/signal_cache/shrink b/test/sys/kernel/slab/signal_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/signal_cache/slab_size b/test/sys/kernel/slab/signal_cache/slab_size new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/slab_size @@ -0,0 +1 @@ +1024 diff --git a/test/sys/kernel/slab/signal_cache/slabs b/test/sys/kernel/slab/signal_cache/slabs new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/slabs @@ -0,0 +1 @@ +9 diff --git a/test/sys/kernel/slab/signal_cache/store_user b/test/sys/kernel/slab/signal_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/signal_cache/total_objects b/test/sys/kernel/slab/signal_cache/total_objects new file mode 100644 index 0000000000..a29644e57e --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/total_objects @@ -0,0 +1 @@ +144 diff --git a/test/sys/kernel/slab/signal_cache/trace b/test/sys/kernel/slab/signal_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/signal_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/signal_cache/validate b/test/sys/kernel/slab/signal_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sigqueue/aliases b/test/sys/kernel/slab/sigqueue/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/align b/test/sys/kernel/slab/sigqueue/align new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/align @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/sigqueue/alloc_calls b/test/sys/kernel/slab/sigqueue/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/sigqueue/cache_dma b/test/sys/kernel/slab/sigqueue/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/cpu_slabs b/test/sys/kernel/slab/sigqueue/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/ctor b/test/sys/kernel/slab/sigqueue/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sigqueue/destroy_by_rcu b/test/sys/kernel/slab/sigqueue/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/free_calls b/test/sys/kernel/slab/sigqueue/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/sigqueue/hwcache_align b/test/sys/kernel/slab/sigqueue/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/object_size b/test/sys/kernel/slab/sigqueue/object_size new file mode 100644 index 0000000000..a76256037d --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/object_size @@ -0,0 +1 @@ +160 diff --git a/test/sys/kernel/slab/sigqueue/objects b/test/sys/kernel/slab/sigqueue/objects new file mode 100644 index 0000000000..a787364590 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/objects @@ -0,0 +1 @@ +34 diff --git a/test/sys/kernel/slab/sigqueue/objects_partial b/test/sys/kernel/slab/sigqueue/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/objs_per_slab b/test/sys/kernel/slab/sigqueue/objs_per_slab new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/objs_per_slab @@ -0,0 +1 @@ +17 diff --git a/test/sys/kernel/slab/sigqueue/order b/test/sys/kernel/slab/sigqueue/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/partial b/test/sys/kernel/slab/sigqueue/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/poison b/test/sys/kernel/slab/sigqueue/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sigqueue/reclaim_account b/test/sys/kernel/slab/sigqueue/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/red_zone b/test/sys/kernel/slab/sigqueue/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sigqueue/sanity_checks b/test/sys/kernel/slab/sigqueue/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sigqueue/shrink b/test/sys/kernel/slab/sigqueue/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sigqueue/slab_size b/test/sys/kernel/slab/sigqueue/slab_size new file mode 100644 index 0000000000..7c022aedd2 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/slab_size @@ -0,0 +1 @@ +232 diff --git a/test/sys/kernel/slab/sigqueue/slabs b/test/sys/kernel/slab/sigqueue/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/sigqueue/store_user b/test/sys/kernel/slab/sigqueue/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sigqueue/total_objects b/test/sys/kernel/slab/sigqueue/total_objects new file mode 100644 index 0000000000..a787364590 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/total_objects @@ -0,0 +1 @@ +34 diff --git a/test/sys/kernel/slab/sigqueue/trace b/test/sys/kernel/slab/sigqueue/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sigqueue/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sigqueue/validate b/test/sys/kernel/slab/sigqueue/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/aliases b/test/sys/kernel/slab/skbuff_fclone_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/align b/test/sys/kernel/slab/skbuff_fclone_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/alloc_calls b/test/sys/kernel/slab/skbuff_fclone_cache/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/cache_dma b/test/sys/kernel/slab/skbuff_fclone_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs b/test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/ctor b/test/sys/kernel/slab/skbuff_fclone_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/destroy_by_rcu b/test/sys/kernel/slab/skbuff_fclone_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/free_calls b/test/sys/kernel/slab/skbuff_fclone_cache/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/hwcache_align b/test/sys/kernel/slab/skbuff_fclone_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/object_size b/test/sys/kernel/slab/skbuff_fclone_cache/object_size new file mode 100644 index 0000000000..816d01be5c --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/object_size @@ -0,0 +1 @@ +420 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/objects b/test/sys/kernel/slab/skbuff_fclone_cache/objects new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/objects @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/objects_partial b/test/sys/kernel/slab/skbuff_fclone_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/objs_per_slab b/test/sys/kernel/slab/skbuff_fclone_cache/objs_per_slab new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/objs_per_slab @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/order b/test/sys/kernel/slab/skbuff_fclone_cache/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/partial b/test/sys/kernel/slab/skbuff_fclone_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/poison b/test/sys/kernel/slab/skbuff_fclone_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/reclaim_account b/test/sys/kernel/slab/skbuff_fclone_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/red_zone b/test/sys/kernel/slab/skbuff_fclone_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/sanity_checks b/test/sys/kernel/slab/skbuff_fclone_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/shrink b/test/sys/kernel/slab/skbuff_fclone_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/slab_size b/test/sys/kernel/slab/skbuff_fclone_cache/slab_size new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/slab_size @@ -0,0 +1 @@ +512 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/slabs b/test/sys/kernel/slab/skbuff_fclone_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/store_user b/test/sys/kernel/slab/skbuff_fclone_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/total_objects b/test/sys/kernel/slab/skbuff_fclone_cache/total_objects new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/total_objects @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/trace b/test/sys/kernel/slab/skbuff_fclone_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_fclone_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/validate b/test/sys/kernel/slab/skbuff_fclone_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/skbuff_head_cache/aliases b/test/sys/kernel/slab/skbuff_head_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/align b/test/sys/kernel/slab/skbuff_head_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/alloc_calls b/test/sys/kernel/slab/skbuff_head_cache/alloc_calls new file mode 100644 index 0000000000..fa28337fd8 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/alloc_calls @@ -0,0 +1 @@ + 559 __alloc_skb+0x44/0x150 age=1225/49012/96616 pid=733-1738 cpus=0-1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/cache_dma b/test/sys/kernel/slab/skbuff_head_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/cpu_slabs b/test/sys/kernel/slab/skbuff_head_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/ctor b/test/sys/kernel/slab/skbuff_head_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/skbuff_head_cache/destroy_by_rcu b/test/sys/kernel/slab/skbuff_head_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/free_calls b/test/sys/kernel/slab/skbuff_head_cache/free_calls new file mode 100644 index 0000000000..1fae517f62 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/free_calls @@ -0,0 +1,2 @@ + 295 age=4294787646 pid=0 cpus=0 + 264 __kfree_skb+0x3a/0xa0 age=1225/12909/96887 pid=0-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/hwcache_align b/test/sys/kernel/slab/skbuff_head_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/object_size b/test/sys/kernel/slab/skbuff_head_cache/object_size new file mode 100644 index 0000000000..7d645f5893 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/object_size @@ -0,0 +1 @@ +208 diff --git a/test/sys/kernel/slab/skbuff_head_cache/objects b/test/sys/kernel/slab/skbuff_head_cache/objects new file mode 100644 index 0000000000..6aedc8e1c9 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/objects @@ -0,0 +1 @@ +571 diff --git a/test/sys/kernel/slab/skbuff_head_cache/objects_partial b/test/sys/kernel/slab/skbuff_head_cache/objects_partial new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/objects_partial @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/skbuff_head_cache/objs_per_slab b/test/sys/kernel/slab/skbuff_head_cache/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/skbuff_head_cache/order b/test/sys/kernel/slab/skbuff_head_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/partial b/test/sys/kernel/slab/skbuff_head_cache/partial new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/partial @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/poison b/test/sys/kernel/slab/skbuff_head_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/reclaim_account b/test/sys/kernel/slab/skbuff_head_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/red_zone b/test/sys/kernel/slab/skbuff_head_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/sanity_checks b/test/sys/kernel/slab/skbuff_head_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/shrink b/test/sys/kernel/slab/skbuff_head_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/skbuff_head_cache/slab_size b/test/sys/kernel/slab/skbuff_head_cache/slab_size new file mode 100644 index 0000000000..18eed1357e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/slab_size @@ -0,0 +1 @@ +320 diff --git a/test/sys/kernel/slab/skbuff_head_cache/slabs b/test/sys/kernel/slab/skbuff_head_cache/slabs new file mode 100644 index 0000000000..21e72e8ac3 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/slabs @@ -0,0 +1 @@ +48 diff --git a/test/sys/kernel/slab/skbuff_head_cache/store_user b/test/sys/kernel/slab/skbuff_head_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/total_objects b/test/sys/kernel/slab/skbuff_head_cache/total_objects new file mode 100644 index 0000000000..bb7a7c1b1a --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/total_objects @@ -0,0 +1 @@ +576 diff --git a/test/sys/kernel/slab/skbuff_head_cache/trace b/test/sys/kernel/slab/skbuff_head_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/skbuff_head_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/validate b/test/sys/kernel/slab/skbuff_head_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sock_inode_cache/aliases b/test/sys/kernel/slab/sock_inode_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sock_inode_cache/align b/test/sys/kernel/slab/sock_inode_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sock_inode_cache/alloc_calls b/test/sys/kernel/slab/sock_inode_cache/alloc_calls new file mode 100644 index 0000000000..24a49d50fa --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/alloc_calls @@ -0,0 +1 @@ + 484 sock_alloc_inode+0x1a/0x70 age=15349/85888/120207 pid=1-2852 cpus=0-1 diff --git a/test/sys/kernel/slab/sock_inode_cache/cache_dma b/test/sys/kernel/slab/sock_inode_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sock_inode_cache/cpu_slabs b/test/sys/kernel/slab/sock_inode_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sock_inode_cache/ctor b/test/sys/kernel/slab/sock_inode_cache/ctor new file mode 100644 index 0000000000..2940046f62 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/ctor @@ -0,0 +1 @@ +init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/sock_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/sock_inode_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sock_inode_cache/free_calls b/test/sys/kernel/slab/sock_inode_cache/free_calls new file mode 100644 index 0000000000..26c4acdd4a --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/free_calls @@ -0,0 +1,2 @@ + 282 age=4294787638 pid=0 cpus=0 + 202 sock_destroy_inode+0x14/0x20 age=15358/84084/116905 pid=76-2851 cpus=0-1 diff --git a/test/sys/kernel/slab/sock_inode_cache/hwcache_align b/test/sys/kernel/slab/sock_inode_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sock_inode_cache/object_size b/test/sys/kernel/slab/sock_inode_cache/object_size new file mode 100644 index 0000000000..8cdd21dbcb --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/object_size @@ -0,0 +1 @@ +1192 diff --git a/test/sys/kernel/slab/sock_inode_cache/objects b/test/sys/kernel/slab/sock_inode_cache/objects new file mode 100644 index 0000000000..a712e76400 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/objects @@ -0,0 +1 @@ +503 diff --git a/test/sys/kernel/slab/sock_inode_cache/objects_partial b/test/sys/kernel/slab/sock_inode_cache/objects_partial new file mode 100644 index 0000000000..04f9fe4606 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/objects_partial @@ -0,0 +1 @@ +59 diff --git a/test/sys/kernel/slab/sock_inode_cache/objs_per_slab b/test/sys/kernel/slab/sock_inode_cache/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/sock_inode_cache/order b/test/sys/kernel/slab/sock_inode_cache/order new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/order @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/sock_inode_cache/partial b/test/sys/kernel/slab/sock_inode_cache/partial new file mode 100644 index 0000000000..1e8b314962 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/partial @@ -0,0 +1 @@ +6 diff --git a/test/sys/kernel/slab/sock_inode_cache/poison b/test/sys/kernel/slab/sock_inode_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sock_inode_cache/reclaim_account b/test/sys/kernel/slab/sock_inode_cache/reclaim_account new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/reclaim_account @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sock_inode_cache/red_zone b/test/sys/kernel/slab/sock_inode_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sock_inode_cache/sanity_checks b/test/sys/kernel/slab/sock_inode_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sock_inode_cache/shrink b/test/sys/kernel/slab/sock_inode_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sock_inode_cache/slab_size b/test/sys/kernel/slab/sock_inode_cache/slab_size new file mode 100644 index 0000000000..003638ac6a --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/slab_size @@ -0,0 +1 @@ +1280 diff --git a/test/sys/kernel/slab/sock_inode_cache/slabs b/test/sys/kernel/slab/sock_inode_cache/slabs new file mode 100644 index 0000000000..920a139664 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/slabs @@ -0,0 +1 @@ +43 diff --git a/test/sys/kernel/slab/sock_inode_cache/store_user b/test/sys/kernel/slab/sock_inode_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sock_inode_cache/total_objects b/test/sys/kernel/slab/sock_inode_cache/total_objects new file mode 100644 index 0000000000..1c599d4ff3 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/total_objects @@ -0,0 +1 @@ +516 diff --git a/test/sys/kernel/slab/sock_inode_cache/trace b/test/sys/kernel/slab/sock_inode_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sock_inode_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sock_inode_cache/validate b/test/sys/kernel/slab/sock_inode_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/aliases b/test/sys/kernel/slab/sysfs_dir_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/align b/test/sys/kernel/slab/sysfs_dir_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls b/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls new file mode 100644 index 0000000000..0a02b9f946 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls @@ -0,0 +1 @@ + 11488 sysfs_new_dirent+0x38/0x120 age=38358/111947/120420 pid=0-2761 cpus=0-1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/cache_dma b/test/sys/kernel/slab/sysfs_dir_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs b/test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/ctor b/test/sys/kernel/slab/sysfs_dir_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu b/test/sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/free_calls b/test/sys/kernel/slab/sysfs_dir_cache/free_calls new file mode 100644 index 0000000000..a810de246b --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/free_calls @@ -0,0 +1,2 @@ + 11205 age=4294787719 pid=0 cpus=0 + 283 release_sysfs_dirent+0x5c/0xd0 age=92764/102566/120088 pid=1-2141 cpus=0-1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/hwcache_align b/test/sys/kernel/slab/sysfs_dir_cache/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/object_size b/test/sys/kernel/slab/sysfs_dir_cache/object_size new file mode 100644 index 0000000000..d15a2cc44e --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/object_size @@ -0,0 +1 @@ +80 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/objects b/test/sys/kernel/slab/sysfs_dir_cache/objects new file mode 100644 index 0000000000..7b8df03e20 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/objects @@ -0,0 +1 @@ +11518 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/objects_partial b/test/sys/kernel/slab/sysfs_dir_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab b/test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab new file mode 100644 index 0000000000..6f4247a625 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab @@ -0,0 +1 @@ +26 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/order b/test/sys/kernel/slab/sysfs_dir_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/partial b/test/sys/kernel/slab/sysfs_dir_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/poison b/test/sys/kernel/slab/sysfs_dir_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/reclaim_account b/test/sys/kernel/slab/sysfs_dir_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/red_zone b/test/sys/kernel/slab/sysfs_dir_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/sanity_checks b/test/sys/kernel/slab/sysfs_dir_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/shrink b/test/sys/kernel/slab/sysfs_dir_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/slab_size b/test/sys/kernel/slab/sysfs_dir_cache/slab_size new file mode 100644 index 0000000000..492dff089a --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/slab_size @@ -0,0 +1 @@ +152 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/slabs b/test/sys/kernel/slab/sysfs_dir_cache/slabs new file mode 100644 index 0000000000..6a13cf62b5 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/slabs @@ -0,0 +1 @@ +443 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/store_user b/test/sys/kernel/slab/sysfs_dir_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/total_objects b/test/sys/kernel/slab/sysfs_dir_cache/total_objects new file mode 100644 index 0000000000..7b8df03e20 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/total_objects @@ -0,0 +1 @@ +11518 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/trace b/test/sys/kernel/slab/sysfs_dir_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/sysfs_dir_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/validate b/test/sys/kernel/slab/sysfs_dir_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/task_struct/aliases b/test/sys/kernel/slab/task_struct/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_struct/align b/test/sys/kernel/slab/task_struct/align new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/align @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/task_struct/alloc_calls b/test/sys/kernel/slab/task_struct/alloc_calls new file mode 100644 index 0000000000..7f78027132 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/alloc_calls @@ -0,0 +1 @@ + 202 copy_process+0xa4/0x1220 age=3762/98500/120466 pid=0-2851 cpus=0-1 diff --git a/test/sys/kernel/slab/task_struct/cache_dma b/test/sys/kernel/slab/task_struct/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_struct/cpu_slabs b/test/sys/kernel/slab/task_struct/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_struct/ctor b/test/sys/kernel/slab/task_struct/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/task_struct/destroy_by_rcu b/test/sys/kernel/slab/task_struct/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_struct/free_calls b/test/sys/kernel/slab/task_struct/free_calls new file mode 100644 index 0000000000..58551b31c4 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/free_calls @@ -0,0 +1,2 @@ + 93 age=4294787811 pid=0 cpus=0 + 109 free_task+0x30/0x40 age=4753/91164/117575 pid=0-2740 cpus=0-1 diff --git a/test/sys/kernel/slab/task_struct/hwcache_align b/test/sys/kernel/slab/task_struct/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_struct/object_size b/test/sys/kernel/slab/task_struct/object_size new file mode 100644 index 0000000000..2ac9252254 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/object_size @@ -0,0 +1 @@ +4320 diff --git a/test/sys/kernel/slab/task_struct/objects b/test/sys/kernel/slab/task_struct/objects new file mode 100644 index 0000000000..7d645f5893 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/objects @@ -0,0 +1 @@ +208 diff --git a/test/sys/kernel/slab/task_struct/objects_partial b/test/sys/kernel/slab/task_struct/objects_partial new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/objects_partial @@ -0,0 +1 @@ +40 diff --git a/test/sys/kernel/slab/task_struct/objs_per_slab b/test/sys/kernel/slab/task_struct/objs_per_slab new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/objs_per_slab @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/task_struct/order b/test/sys/kernel/slab/task_struct/order new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/order @@ -0,0 +1 @@ +3 diff --git a/test/sys/kernel/slab/task_struct/partial b/test/sys/kernel/slab/task_struct/partial new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/partial @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/task_struct/poison b/test/sys/kernel/slab/task_struct/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/task_struct/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/task_struct/reclaim_account b/test/sys/kernel/slab/task_struct/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_struct/red_zone b/test/sys/kernel/slab/task_struct/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/task_struct/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/task_struct/sanity_checks b/test/sys/kernel/slab/task_struct/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/task_struct/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/task_struct/shrink b/test/sys/kernel/slab/task_struct/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/task_struct/slab_size b/test/sys/kernel/slab/task_struct/slab_size new file mode 100644 index 0000000000..f993a70588 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/slab_size @@ -0,0 +1 @@ +4400 diff --git a/test/sys/kernel/slab/task_struct/slabs b/test/sys/kernel/slab/task_struct/slabs new file mode 100644 index 0000000000..e85087affd --- /dev/null +++ b/test/sys/kernel/slab/task_struct/slabs @@ -0,0 +1 @@ +31 diff --git a/test/sys/kernel/slab/task_struct/store_user b/test/sys/kernel/slab/task_struct/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/task_struct/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/task_struct/total_objects b/test/sys/kernel/slab/task_struct/total_objects new file mode 100644 index 0000000000..0ddd619ce3 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/total_objects @@ -0,0 +1 @@ +217 diff --git a/test/sys/kernel/slab/task_struct/trace b/test/sys/kernel/slab/task_struct/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_struct/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_struct/validate b/test/sys/kernel/slab/task_struct/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/task_xstate/aliases b/test/sys/kernel/slab/task_xstate/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_xstate/align b/test/sys/kernel/slab/task_xstate/align new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/align @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/task_xstate/alloc_calls b/test/sys/kernel/slab/task_xstate/alloc_calls new file mode 100644 index 0000000000..5f5d5061f4 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/alloc_calls @@ -0,0 +1,2 @@ + 99 arch_dup_task_struct+0x51/0xa0 age=15519/98749/117104 pid=71-2851 cpus=0-1 + 50 init_fpu+0xef/0x110 age=3752/83856/118695 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/task_xstate/cache_dma b/test/sys/kernel/slab/task_xstate/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_xstate/cpu_slabs b/test/sys/kernel/slab/task_xstate/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_xstate/ctor b/test/sys/kernel/slab/task_xstate/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/task_xstate/destroy_by_rcu b/test/sys/kernel/slab/task_xstate/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_xstate/free_calls b/test/sys/kernel/slab/task_xstate/free_calls new file mode 100644 index 0000000000..1cdf455da3 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/free_calls @@ -0,0 +1,2 @@ + 54 age=4294787807 pid=0 cpus=0 + 95 free_thread_xstate+0x24/0x40 age=4751/90953/115648 pid=0-2851 cpus=0-1 diff --git a/test/sys/kernel/slab/task_xstate/hwcache_align b/test/sys/kernel/slab/task_xstate/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_xstate/object_size b/test/sys/kernel/slab/task_xstate/object_size new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/object_size @@ -0,0 +1 @@ +512 diff --git a/test/sys/kernel/slab/task_xstate/objects b/test/sys/kernel/slab/task_xstate/objects new file mode 100644 index 0000000000..4e9bdff0c6 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/objects @@ -0,0 +1 @@ +164 diff --git a/test/sys/kernel/slab/task_xstate/objects_partial b/test/sys/kernel/slab/task_xstate/objects_partial new file mode 100644 index 0000000000..d69c74c8b9 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/objects_partial @@ -0,0 +1 @@ +73 diff --git a/test/sys/kernel/slab/task_xstate/objs_per_slab b/test/sys/kernel/slab/task_xstate/objs_per_slab new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/objs_per_slab @@ -0,0 +1 @@ +13 diff --git a/test/sys/kernel/slab/task_xstate/order b/test/sys/kernel/slab/task_xstate/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/task_xstate/partial b/test/sys/kernel/slab/task_xstate/partial new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/partial @@ -0,0 +1 @@ +7 diff --git a/test/sys/kernel/slab/task_xstate/poison b/test/sys/kernel/slab/task_xstate/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/task_xstate/reclaim_account b/test/sys/kernel/slab/task_xstate/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_xstate/red_zone b/test/sys/kernel/slab/task_xstate/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/task_xstate/sanity_checks b/test/sys/kernel/slab/task_xstate/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/task_xstate/shrink b/test/sys/kernel/slab/task_xstate/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/task_xstate/slab_size b/test/sys/kernel/slab/task_xstate/slab_size new file mode 100644 index 0000000000..7cbee132c8 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/slab_size @@ -0,0 +1 @@ +592 diff --git a/test/sys/kernel/slab/task_xstate/slabs b/test/sys/kernel/slab/task_xstate/slabs new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/slabs @@ -0,0 +1 @@ +14 diff --git a/test/sys/kernel/slab/task_xstate/store_user b/test/sys/kernel/slab/task_xstate/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/task_xstate/total_objects b/test/sys/kernel/slab/task_xstate/total_objects new file mode 100644 index 0000000000..960e7a870f --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/total_objects @@ -0,0 +1 @@ +182 diff --git a/test/sys/kernel/slab/task_xstate/trace b/test/sys/kernel/slab/task_xstate/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/task_xstate/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/task_xstate/validate b/test/sys/kernel/slab/task_xstate/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/aliases b/test/sys/kernel/slab/tcp_bind_bucket/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/align b/test/sys/kernel/slab/tcp_bind_bucket/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls b/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls new file mode 100644 index 0000000000..1e31ec302b --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls @@ -0,0 +1 @@ + 6 inet_bind_bucket_create+0x27/0x80 age=13273/41067/96896 pid=1690-2881 cpus=0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/cache_dma b/test/sys/kernel/slab/tcp_bind_bucket/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs b/test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/ctor b/test/sys/kernel/slab/tcp_bind_bucket/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu b/test/sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/free_calls b/test/sys/kernel/slab/tcp_bind_bucket/free_calls new file mode 100644 index 0000000000..6d66bbee69 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/free_calls @@ -0,0 +1,2 @@ + 1 age=4294787443 pid=0 cpus=0 + 5 inet_bind_bucket_destroy+0x29/0x30 age=33343/49250/96585 pid=0-1707 cpus=0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/hwcache_align b/test/sys/kernel/slab/tcp_bind_bucket/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/object_size b/test/sys/kernel/slab/tcp_bind_bucket/object_size new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/object_size @@ -0,0 +1 @@ +40 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/objects b/test/sys/kernel/slab/tcp_bind_bucket/objects new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/objects @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/objects_partial b/test/sys/kernel/slab/tcp_bind_bucket/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab b/test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/order b/test/sys/kernel/slab/tcp_bind_bucket/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/partial b/test/sys/kernel/slab/tcp_bind_bucket/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/poison b/test/sys/kernel/slab/tcp_bind_bucket/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/reclaim_account b/test/sys/kernel/slab/tcp_bind_bucket/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/red_zone b/test/sys/kernel/slab/tcp_bind_bucket/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/sanity_checks b/test/sys/kernel/slab/tcp_bind_bucket/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/shrink b/test/sys/kernel/slab/tcp_bind_bucket/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/slab_size b/test/sys/kernel/slab/tcp_bind_bucket/slab_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/slab_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/slabs b/test/sys/kernel/slab/tcp_bind_bucket/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/store_user b/test/sys/kernel/slab/tcp_bind_bucket/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/total_objects b/test/sys/kernel/slab/tcp_bind_bucket/total_objects new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/total_objects @@ -0,0 +1 @@ +64 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/trace b/test/sys/kernel/slab/tcp_bind_bucket/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tcp_bind_bucket/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/validate b/test/sys/kernel/slab/tcp_bind_bucket/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/tw_sock_TCP/aliases b/test/sys/kernel/slab/tw_sock_TCP/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/align b/test/sys/kernel/slab/tw_sock_TCP/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/alloc_calls b/test/sys/kernel/slab/tw_sock_TCP/alloc_calls new file mode 100644 index 0000000000..013bd3d3a7 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/alloc_calls @@ -0,0 +1 @@ + 4 inet_twsk_alloc+0x2e/0x110 age=13136/13559/14074 pid=0-18 cpus=0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/cache_dma b/test/sys/kernel/slab/tw_sock_TCP/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/cpu_slabs b/test/sys/kernel/slab/tw_sock_TCP/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/ctor b/test/sys/kernel/slab/tw_sock_TCP/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu b/test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/free_calls b/test/sys/kernel/slab/tw_sock_TCP/free_calls new file mode 100644 index 0000000000..33082a4d64 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/free_calls @@ -0,0 +1 @@ + 4 age=4294787516 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/hwcache_align b/test/sys/kernel/slab/tw_sock_TCP/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/object_size b/test/sys/kernel/slab/tw_sock_TCP/object_size new file mode 100644 index 0000000000..7296f257eb --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/object_size @@ -0,0 +1 @@ +136 diff --git a/test/sys/kernel/slab/tw_sock_TCP/objects b/test/sys/kernel/slab/tw_sock_TCP/objects new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/objects @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/tw_sock_TCP/objects_partial b/test/sys/kernel/slab/tw_sock_TCP/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/objs_per_slab b/test/sys/kernel/slab/tw_sock_TCP/objs_per_slab new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/objs_per_slab @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/tw_sock_TCP/order b/test/sys/kernel/slab/tw_sock_TCP/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/partial b/test/sys/kernel/slab/tw_sock_TCP/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/poison b/test/sys/kernel/slab/tw_sock_TCP/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/reclaim_account b/test/sys/kernel/slab/tw_sock_TCP/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/red_zone b/test/sys/kernel/slab/tw_sock_TCP/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/sanity_checks b/test/sys/kernel/slab/tw_sock_TCP/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/shrink b/test/sys/kernel/slab/tw_sock_TCP/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/tw_sock_TCP/slab_size b/test/sys/kernel/slab/tw_sock_TCP/slab_size new file mode 100644 index 0000000000..9183bf03fc --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/slab_size @@ -0,0 +1 @@ +256 diff --git a/test/sys/kernel/slab/tw_sock_TCP/slabs b/test/sys/kernel/slab/tw_sock_TCP/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/store_user b/test/sys/kernel/slab/tw_sock_TCP/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/total_objects b/test/sys/kernel/slab/tw_sock_TCP/total_objects new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/total_objects @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/tw_sock_TCP/trace b/test/sys/kernel/slab/tw_sock_TCP/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCP/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/validate b/test/sys/kernel/slab/tw_sock_TCP/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/aliases b/test/sys/kernel/slab/tw_sock_TCPv6/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/align b/test/sys/kernel/slab/tw_sock_TCPv6/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls b/test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/cache_dma b/test/sys/kernel/slab/tw_sock_TCPv6/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs b/test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/ctor b/test/sys/kernel/slab/tw_sock_TCPv6/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu b/test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/free_calls b/test/sys/kernel/slab/tw_sock_TCPv6/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align b/test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/object_size b/test/sys/kernel/slab/tw_sock_TCPv6/object_size new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/object_size @@ -0,0 +1 @@ +168 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/objects b/test/sys/kernel/slab/tw_sock_TCPv6/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/objects_partial b/test/sys/kernel/slab/tw_sock_TCPv6/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab b/test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab @@ -0,0 +1 @@ +16 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/order b/test/sys/kernel/slab/tw_sock_TCPv6/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/partial b/test/sys/kernel/slab/tw_sock_TCPv6/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/poison b/test/sys/kernel/slab/tw_sock_TCPv6/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account b/test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/red_zone b/test/sys/kernel/slab/tw_sock_TCPv6/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks b/test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/shrink b/test/sys/kernel/slab/tw_sock_TCPv6/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/slab_size b/test/sys/kernel/slab/tw_sock_TCPv6/slab_size new file mode 100644 index 0000000000..9183bf03fc --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/slab_size @@ -0,0 +1 @@ +256 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/slabs b/test/sys/kernel/slab/tw_sock_TCPv6/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/store_user b/test/sys/kernel/slab/tw_sock_TCPv6/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/total_objects b/test/sys/kernel/slab/tw_sock_TCPv6/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/trace b/test/sys/kernel/slab/tw_sock_TCPv6/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/tw_sock_TCPv6/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/validate b/test/sys/kernel/slab/tw_sock_TCPv6/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/uhci_urb_priv/aliases b/test/sys/kernel/slab/uhci_urb_priv/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/align b/test/sys/kernel/slab/uhci_urb_priv/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/alloc_calls b/test/sys/kernel/slab/uhci_urb_priv/alloc_calls new file mode 100644 index 0000000000..5034241ea1 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/alloc_calls @@ -0,0 +1 @@ + 1 uhci_urb_enqueue+0xb6/0xa30 [uhci_hcd] age=94946 pid=1738 cpus=0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/cache_dma b/test/sys/kernel/slab/uhci_urb_priv/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/cpu_slabs b/test/sys/kernel/slab/uhci_urb_priv/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/ctor b/test/sys/kernel/slab/uhci_urb_priv/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu b/test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/free_calls b/test/sys/kernel/slab/uhci_urb_priv/free_calls new file mode 100644 index 0000000000..cb42e9159e --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/free_calls @@ -0,0 +1 @@ + 1 uhci_free_urb_priv+0x79/0xd0 [uhci_hcd] age=95044 pid=2029 cpus=0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/hwcache_align b/test/sys/kernel/slab/uhci_urb_priv/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/object_size b/test/sys/kernel/slab/uhci_urb_priv/object_size new file mode 100644 index 0000000000..f6b91e0e1f --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/object_size @@ -0,0 +1 @@ +56 diff --git a/test/sys/kernel/slab/uhci_urb_priv/objects b/test/sys/kernel/slab/uhci_urb_priv/objects new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/objects @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/uhci_urb_priv/objects_partial b/test/sys/kernel/slab/uhci_urb_priv/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/objs_per_slab b/test/sys/kernel/slab/uhci_urb_priv/objs_per_slab new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/objs_per_slab @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/uhci_urb_priv/order b/test/sys/kernel/slab/uhci_urb_priv/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/partial b/test/sys/kernel/slab/uhci_urb_priv/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/poison b/test/sys/kernel/slab/uhci_urb_priv/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/reclaim_account b/test/sys/kernel/slab/uhci_urb_priv/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/red_zone b/test/sys/kernel/slab/uhci_urb_priv/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/sanity_checks b/test/sys/kernel/slab/uhci_urb_priv/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/shrink b/test/sys/kernel/slab/uhci_urb_priv/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/uhci_urb_priv/slab_size b/test/sys/kernel/slab/uhci_urb_priv/slab_size new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/slab_size @@ -0,0 +1 @@ +128 diff --git a/test/sys/kernel/slab/uhci_urb_priv/slabs b/test/sys/kernel/slab/uhci_urb_priv/slabs new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/slabs @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/store_user b/test/sys/kernel/slab/uhci_urb_priv/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/total_objects b/test/sys/kernel/slab/uhci_urb_priv/total_objects new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/total_objects @@ -0,0 +1 @@ +32 diff --git a/test/sys/kernel/slab/uhci_urb_priv/trace b/test/sys/kernel/slab/uhci_urb_priv/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uhci_urb_priv/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/validate b/test/sys/kernel/slab/uhci_urb_priv/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/uid_cache/aliases b/test/sys/kernel/slab/uid_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/align b/test/sys/kernel/slab/uid_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/alloc_calls b/test/sys/kernel/slab/uid_cache/alloc_calls new file mode 100644 index 0000000000..444660abab --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/alloc_calls @@ -0,0 +1 @@ + 5 alloc_uid+0xbd/0x1e0 age=91863/99347/106874 pid=1333-2177 cpus=0-1 diff --git a/test/sys/kernel/slab/uid_cache/cache_dma b/test/sys/kernel/slab/uid_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/cpu_slabs b/test/sys/kernel/slab/uid_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/ctor b/test/sys/kernel/slab/uid_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/uid_cache/destroy_by_rcu b/test/sys/kernel/slab/uid_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/free_calls b/test/sys/kernel/slab/uid_cache/free_calls new file mode 100644 index 0000000000..0d53455c31 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/free_calls @@ -0,0 +1,2 @@ + 2 age=4294787431 pid=0 cpus=0 + 3 remove_user_sysfs_dir+0xd0/0x100 age=97952/107886/115712 pid=7 cpus=0 diff --git a/test/sys/kernel/slab/uid_cache/hwcache_align b/test/sys/kernel/slab/uid_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uid_cache/object_size b/test/sys/kernel/slab/uid_cache/object_size new file mode 100644 index 0000000000..a817176f4a --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/object_size @@ -0,0 +1 @@ +216 diff --git a/test/sys/kernel/slab/uid_cache/objects b/test/sys/kernel/slab/uid_cache/objects new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/objects @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/uid_cache/objects_partial b/test/sys/kernel/slab/uid_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/objs_per_slab b/test/sys/kernel/slab/uid_cache/objs_per_slab new file mode 100644 index 0000000000..48082f72f0 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/objs_per_slab @@ -0,0 +1 @@ +12 diff --git a/test/sys/kernel/slab/uid_cache/order b/test/sys/kernel/slab/uid_cache/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/partial b/test/sys/kernel/slab/uid_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/poison b/test/sys/kernel/slab/uid_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uid_cache/reclaim_account b/test/sys/kernel/slab/uid_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/red_zone b/test/sys/kernel/slab/uid_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uid_cache/sanity_checks b/test/sys/kernel/slab/uid_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uid_cache/shrink b/test/sys/kernel/slab/uid_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/uid_cache/slab_size b/test/sys/kernel/slab/uid_cache/slab_size new file mode 100644 index 0000000000..18eed1357e --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/slab_size @@ -0,0 +1 @@ +320 diff --git a/test/sys/kernel/slab/uid_cache/slabs b/test/sys/kernel/slab/uid_cache/slabs new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/slabs @@ -0,0 +1 @@ +2 diff --git a/test/sys/kernel/slab/uid_cache/store_user b/test/sys/kernel/slab/uid_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/uid_cache/total_objects b/test/sys/kernel/slab/uid_cache/total_objects new file mode 100644 index 0000000000..a45fd52cc5 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/total_objects @@ -0,0 +1 @@ +24 diff --git a/test/sys/kernel/slab/uid_cache/trace b/test/sys/kernel/slab/uid_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/uid_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/uid_cache/validate b/test/sys/kernel/slab/uid_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/vm_area_struct/aliases b/test/sys/kernel/slab/vm_area_struct/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/vm_area_struct/align b/test/sys/kernel/slab/vm_area_struct/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/vm_area_struct/alloc_calls b/test/sys/kernel/slab/vm_area_struct/alloc_calls new file mode 100644 index 0000000000..4e906f2b26 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/alloc_calls @@ -0,0 +1,7 @@ + 2751 dup_mm+0x194/0x390 age=76179/89364/117079 pid=71-2467 cpus=0-1 + 51 install_special_mapping+0x3d/0xe0 age=3731/82827/118675 pid=1-2890 cpus=0-1 + 4022 split_vma+0x61/0x140 age=3730/79432/106607 pid=1325-2890 cpus=0-1 + 6 copy_vma+0x125/0x1b0 age=12861/53719/94381 pid=1738-2881 cpus=0 + 53 do_brk+0x2ec/0x360 age=3729/83224/118688 pid=1-2890 cpus=0-1 + 5096 mmap_region+0x195/0x5c0 age=3727/78409/118688 pid=1-2890 cpus=0-1 + 51 bprm_mm_init+0xa0/0x1b0 age=3732/82898/118691 pid=1-2890 cpus=0-1 diff --git a/test/sys/kernel/slab/vm_area_struct/cache_dma b/test/sys/kernel/slab/vm_area_struct/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/vm_area_struct/cpu_slabs b/test/sys/kernel/slab/vm_area_struct/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/vm_area_struct/ctor b/test/sys/kernel/slab/vm_area_struct/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/vm_area_struct/destroy_by_rcu b/test/sys/kernel/slab/vm_area_struct/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/vm_area_struct/free_calls b/test/sys/kernel/slab/vm_area_struct/free_calls new file mode 100644 index 0000000000..4f2cdce000 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/free_calls @@ -0,0 +1,3 @@ + 6570 age=4294787785 pid=0 cpus=0 + 5459 remove_vma+0x53/0x70 age=3732/80460/117323 pid=71-2890 cpus=0-1 + 1 vma_adjust+0x32c/0x570 age=104801 pid=1371 cpus=0 diff --git a/test/sys/kernel/slab/vm_area_struct/hwcache_align b/test/sys/kernel/slab/vm_area_struct/hwcache_align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/hwcache_align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/vm_area_struct/object_size b/test/sys/kernel/slab/vm_area_struct/object_size new file mode 100644 index 0000000000..de8febe1c7 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/object_size @@ -0,0 +1 @@ +168 diff --git a/test/sys/kernel/slab/vm_area_struct/objects b/test/sys/kernel/slab/vm_area_struct/objects new file mode 100644 index 0000000000..c2816940f4 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/objects @@ -0,0 +1 @@ +12056 diff --git a/test/sys/kernel/slab/vm_area_struct/objects_partial b/test/sys/kernel/slab/vm_area_struct/objects_partial new file mode 100644 index 0000000000..9f54fe3133 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/objects_partial @@ -0,0 +1 @@ +122 diff --git a/test/sys/kernel/slab/vm_area_struct/objs_per_slab b/test/sys/kernel/slab/vm_area_struct/objs_per_slab new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/objs_per_slab @@ -0,0 +1 @@ +17 diff --git a/test/sys/kernel/slab/vm_area_struct/order b/test/sys/kernel/slab/vm_area_struct/order new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/order @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/vm_area_struct/partial b/test/sys/kernel/slab/vm_area_struct/partial new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/partial @@ -0,0 +1 @@ +8 diff --git a/test/sys/kernel/slab/vm_area_struct/poison b/test/sys/kernel/slab/vm_area_struct/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/vm_area_struct/reclaim_account b/test/sys/kernel/slab/vm_area_struct/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/vm_area_struct/red_zone b/test/sys/kernel/slab/vm_area_struct/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/vm_area_struct/sanity_checks b/test/sys/kernel/slab/vm_area_struct/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/vm_area_struct/shrink b/test/sys/kernel/slab/vm_area_struct/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/vm_area_struct/slab_size b/test/sys/kernel/slab/vm_area_struct/slab_size new file mode 100644 index 0000000000..eb08bc0b0b --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/slab_size @@ -0,0 +1 @@ +240 diff --git a/test/sys/kernel/slab/vm_area_struct/slabs b/test/sys/kernel/slab/vm_area_struct/slabs new file mode 100644 index 0000000000..923475f93c --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/slabs @@ -0,0 +1 @@ +710 diff --git a/test/sys/kernel/slab/vm_area_struct/store_user b/test/sys/kernel/slab/vm_area_struct/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/vm_area_struct/total_objects b/test/sys/kernel/slab/vm_area_struct/total_objects new file mode 100644 index 0000000000..45504ecd95 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/total_objects @@ -0,0 +1 @@ +12070 diff --git a/test/sys/kernel/slab/vm_area_struct/trace b/test/sys/kernel/slab/vm_area_struct/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/vm_area_struct/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/vm_area_struct/validate b/test/sys/kernel/slab/vm_area_struct/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/aliases b/test/sys/kernel/slab/xfrm_dst_cache/aliases new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/aliases @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/align b/test/sys/kernel/slab/xfrm_dst_cache/align new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/align @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/alloc_calls b/test/sys/kernel/slab/xfrm_dst_cache/alloc_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/alloc_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/xfrm_dst_cache/cache_dma b/test/sys/kernel/slab/xfrm_dst_cache/cache_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/cache_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs b/test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/ctor b/test/sys/kernel/slab/xfrm_dst_cache/ctor new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu b/test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/free_calls b/test/sys/kernel/slab/xfrm_dst_cache/free_calls new file mode 100644 index 0000000000..923bedcfa7 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/free_calls @@ -0,0 +1 @@ +No data diff --git a/test/sys/kernel/slab/xfrm_dst_cache/hwcache_align b/test/sys/kernel/slab/xfrm_dst_cache/hwcache_align new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/hwcache_align @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/object_size b/test/sys/kernel/slab/xfrm_dst_cache/object_size new file mode 100644 index 0000000000..4772052f59 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/object_size @@ -0,0 +1 @@ +344 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/objects b/test/sys/kernel/slab/xfrm_dst_cache/objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/objects_partial b/test/sys/kernel/slab/xfrm_dst_cache/objects_partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/objects_partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab b/test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab new file mode 100644 index 0000000000..3c032078a4 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab @@ -0,0 +1 @@ +18 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/order b/test/sys/kernel/slab/xfrm_dst_cache/order new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/order @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/partial b/test/sys/kernel/slab/xfrm_dst_cache/partial new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/partial @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/poison b/test/sys/kernel/slab/xfrm_dst_cache/poison new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/poison @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/reclaim_account b/test/sys/kernel/slab/xfrm_dst_cache/reclaim_account new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/reclaim_account @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/red_zone b/test/sys/kernel/slab/xfrm_dst_cache/red_zone new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/red_zone @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/sanity_checks b/test/sys/kernel/slab/xfrm_dst_cache/sanity_checks new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/sanity_checks @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/shrink b/test/sys/kernel/slab/xfrm_dst_cache/shrink new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/slab_size b/test/sys/kernel/slab/xfrm_dst_cache/slab_size new file mode 100644 index 0000000000..5379c470da --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/slab_size @@ -0,0 +1 @@ +448 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/slabs b/test/sys/kernel/slab/xfrm_dst_cache/slabs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/slabs @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/store_user b/test/sys/kernel/slab/xfrm_dst_cache/store_user new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/store_user @@ -0,0 +1 @@ +1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/total_objects b/test/sys/kernel/slab/xfrm_dst_cache/total_objects new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/total_objects @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/trace b/test/sys/kernel/slab/xfrm_dst_cache/trace new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/kernel/slab/xfrm_dst_cache/trace @@ -0,0 +1 @@ +0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/validate b/test/sys/kernel/slab/xfrm_dst_cache/validate new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/kernel/uevent_helper b/test/sys/kernel/uevent_helper new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/kernel/uevent_helper @@ -0,0 +1 @@ + diff --git a/test/sys/kernel/uevent_seqnum b/test/sys/kernel/uevent_seqnum new file mode 100644 index 0000000000..23ea218891 --- /dev/null +++ b/test/sys/kernel/uevent_seqnum @@ -0,0 +1 @@ +1247 diff --git a/test/sys/kernel/uids/0/cpu_share b/test/sys/kernel/uids/0/cpu_share new file mode 100644 index 0000000000..c873496a22 --- /dev/null +++ b/test/sys/kernel/uids/0/cpu_share @@ -0,0 +1 @@ +2048 diff --git a/test/sys/kernel/uids/100/cpu_share b/test/sys/kernel/uids/100/cpu_share new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/kernel/uids/100/cpu_share @@ -0,0 +1 @@ +1024 diff --git a/test/sys/kernel/uids/103/cpu_share b/test/sys/kernel/uids/103/cpu_share new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/kernel/uids/103/cpu_share @@ -0,0 +1 @@ +1024 diff --git a/test/sys/kernel/uids/105/cpu_share b/test/sys/kernel/uids/105/cpu_share new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/kernel/uids/105/cpu_share @@ -0,0 +1 @@ +1024 diff --git a/test/sys/kernel/uids/2702/cpu_share b/test/sys/kernel/uids/2702/cpu_share new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/kernel/uids/2702/cpu_share @@ -0,0 +1 @@ +1024 diff --git a/test/sys/kernel/uids/51/cpu_share b/test/sys/kernel/uids/51/cpu_share new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/kernel/uids/51/cpu_share @@ -0,0 +1 @@ +1024 diff --git a/test/sys/kernel/vmcoreinfo b/test/sys/kernel/vmcoreinfo new file mode 100644 index 0000000000..0fbb36a983 --- /dev/null +++ b/test/sys/kernel/vmcoreinfo @@ -0,0 +1 @@ +f15380 1000 diff --git a/test/sys/module/8250/parameters/nr_uarts b/test/sys/module/8250/parameters/nr_uarts new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/module/8250/parameters/nr_uarts @@ -0,0 +1 @@ +4 diff --git a/test/sys/module/8250/parameters/share_irqs b/test/sys/module/8250/parameters/share_irqs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/8250/parameters/share_irqs @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/ac/initstate b/test/sys/module/ac/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/ac/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/ac/notes/.note.gnu.build-id b/test/sys/module/ac/notes/.note.gnu.build-id new file mode 100644 index 0000000000..d960c5d52c Binary files /dev/null and b/test/sys/module/ac/notes/.note.gnu.build-id differ diff --git a/test/sys/module/ac/refcnt b/test/sys/module/ac/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/ac/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/ac/sections/.bss b/test/sys/module/ac/sections/.bss new file mode 100644 index 0000000000..4894d5d602 --- /dev/null +++ b/test/sys/module/ac/sections/.bss @@ -0,0 +1 @@ +0xffffffffa006e600 diff --git a/test/sys/module/ac/sections/.data b/test/sys/module/ac/sections/.data new file mode 100644 index 0000000000..c3cd6262a8 --- /dev/null +++ b/test/sys/module/ac/sections/.data @@ -0,0 +1 @@ +0xffffffffa006e0d0 diff --git a/test/sys/module/ac/sections/.exit.text b/test/sys/module/ac/sections/.exit.text new file mode 100644 index 0000000000..3ddb8670de --- /dev/null +++ b/test/sys/module/ac/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa006d43c diff --git a/test/sys/module/ac/sections/.gnu.linkonce.this_module b/test/sys/module/ac/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..b899110df5 --- /dev/null +++ b/test/sys/module/ac/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa006e240 diff --git a/test/sys/module/ac/sections/.init.text b/test/sys/module/ac/sections/.init.text new file mode 100644 index 0000000000..0cac0d19cf --- /dev/null +++ b/test/sys/module/ac/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0070000 diff --git a/test/sys/module/ac/sections/.note.gnu.build-id b/test/sys/module/ac/sections/.note.gnu.build-id new file mode 100644 index 0000000000..4795d92c12 --- /dev/null +++ b/test/sys/module/ac/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa006d45c diff --git a/test/sys/module/ac/sections/.rodata b/test/sys/module/ac/sections/.rodata new file mode 100644 index 0000000000..a62e858b73 --- /dev/null +++ b/test/sys/module/ac/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa006d480 diff --git a/test/sys/module/ac/sections/.rodata.str1.1 b/test/sys/module/ac/sections/.rodata.str1.1 new file mode 100644 index 0000000000..d6d7d076d4 --- /dev/null +++ b/test/sys/module/ac/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa006d5a0 diff --git a/test/sys/module/ac/sections/.strtab b/test/sys/module/ac/sections/.strtab new file mode 100644 index 0000000000..7a19447d60 --- /dev/null +++ b/test/sys/module/ac/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa006dd28 diff --git a/test/sys/module/ac/sections/.symtab b/test/sys/module/ac/sections/.symtab new file mode 100644 index 0000000000..9bc2c52868 --- /dev/null +++ b/test/sys/module/ac/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa006d668 diff --git a/test/sys/module/ac/sections/.text b/test/sys/module/ac/sections/.text new file mode 100644 index 0000000000..ad42de2e3a --- /dev/null +++ b/test/sys/module/ac/sections/.text @@ -0,0 +1 @@ +0xffffffffa006d000 diff --git a/test/sys/module/ac/srcversion b/test/sys/module/ac/srcversion new file mode 100644 index 0000000000..ceec6c94d7 --- /dev/null +++ b/test/sys/module/ac/srcversion @@ -0,0 +1 @@ +6E9CD20EE5BE8425A61B938 diff --git a/test/sys/module/acpi/parameters/acpica_version b/test/sys/module/acpi/parameters/acpica_version new file mode 100644 index 0000000000..b52e8b8b4a --- /dev/null +++ b/test/sys/module/acpi/parameters/acpica_version @@ -0,0 +1 @@ +20080609 diff --git a/test/sys/module/acpi_cpufreq/initstate b/test/sys/module/acpi_cpufreq/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/acpi_cpufreq/notes/.note.gnu.build-id b/test/sys/module/acpi_cpufreq/notes/.note.gnu.build-id new file mode 100644 index 0000000000..0d5793791b Binary files /dev/null and b/test/sys/module/acpi_cpufreq/notes/.note.gnu.build-id differ diff --git a/test/sys/module/acpi_cpufreq/parameters/acpi_pstate_strict b/test/sys/module/acpi_cpufreq/parameters/acpi_pstate_strict new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/parameters/acpi_pstate_strict @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/acpi_cpufreq/refcnt b/test/sys/module/acpi_cpufreq/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/acpi_cpufreq/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/acpi_cpufreq/sections/.bss b/test/sys/module/acpi_cpufreq/sections/.bss new file mode 100644 index 0000000000..e149141fb7 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0256000 diff --git a/test/sys/module/acpi_cpufreq/sections/.data b/test/sys/module/acpi_cpufreq/sections/.data new file mode 100644 index 0000000000..bef697f084 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.data @@ -0,0 +1 @@ +0xffffffffa0255bc0 diff --git a/test/sys/module/acpi_cpufreq/sections/.exit.text b/test/sys/module/acpi_cpufreq/sections/.exit.text new file mode 100644 index 0000000000..ef6e5584d1 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0254c4c diff --git a/test/sys/module/acpi_cpufreq/sections/.gnu.linkonce.this_module b/test/sys/module/acpi_cpufreq/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..23a89121cc --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0255c40 diff --git a/test/sys/module/acpi_cpufreq/sections/.init.text b/test/sys/module/acpi_cpufreq/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/acpi_cpufreq/sections/.note.gnu.build-id b/test/sys/module/acpi_cpufreq/sections/.note.gnu.build-id new file mode 100644 index 0000000000..50901d0135 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0254c6c diff --git a/test/sys/module/acpi_cpufreq/sections/.rodata b/test/sys/module/acpi_cpufreq/sections/.rodata new file mode 100644 index 0000000000..afb6803fba --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0254ca0 diff --git a/test/sys/module/acpi_cpufreq/sections/.rodata.str1.1 b/test/sys/module/acpi_cpufreq/sections/.rodata.str1.1 new file mode 100644 index 0000000000..f9cf060692 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0254d98 diff --git a/test/sys/module/acpi_cpufreq/sections/.smp_locks b/test/sys/module/acpi_cpufreq/sections/.smp_locks new file mode 100644 index 0000000000..3e3e742424 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa0254d68 diff --git a/test/sys/module/acpi_cpufreq/sections/.strtab b/test/sys/module/acpi_cpufreq/sections/.strtab new file mode 100644 index 0000000000..448145ba15 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0255620 diff --git a/test/sys/module/acpi_cpufreq/sections/.symtab b/test/sys/module/acpi_cpufreq/sections/.symtab new file mode 100644 index 0000000000..e54cf3a5bd --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0254dc8 diff --git a/test/sys/module/acpi_cpufreq/sections/.text b/test/sys/module/acpi_cpufreq/sections/.text new file mode 100644 index 0000000000..40e5733dde --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/.text @@ -0,0 +1 @@ +0xffffffffa0254000 diff --git a/test/sys/module/acpi_cpufreq/sections/__param b/test/sys/module/acpi_cpufreq/sections/__param new file mode 100644 index 0000000000..805dd85b24 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/sections/__param @@ -0,0 +1 @@ +0xffffffffa0254d70 diff --git a/test/sys/module/acpi_cpufreq/srcversion b/test/sys/module/acpi_cpufreq/srcversion new file mode 100644 index 0000000000..71683b6df0 --- /dev/null +++ b/test/sys/module/acpi_cpufreq/srcversion @@ -0,0 +1 @@ +09166B6001DCE2189668F16 diff --git a/test/sys/module/aes_generic/holders/aes_x86_64 b/test/sys/module/aes_generic/holders/aes_x86_64 new file mode 120000 index 0000000000..33ea10d47a --- /dev/null +++ b/test/sys/module/aes_generic/holders/aes_x86_64 @@ -0,0 +1 @@ +../../aes_x86_64 \ No newline at end of file diff --git a/test/sys/module/aes_generic/initstate b/test/sys/module/aes_generic/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/aes_generic/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/aes_generic/notes/.note.gnu.build-id b/test/sys/module/aes_generic/notes/.note.gnu.build-id new file mode 100644 index 0000000000..2778379fe1 Binary files /dev/null and b/test/sys/module/aes_generic/notes/.note.gnu.build-id differ diff --git a/test/sys/module/aes_generic/refcnt b/test/sys/module/aes_generic/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/aes_generic/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/aes_generic/sections/.bss b/test/sys/module/aes_generic/sections/.bss new file mode 100644 index 0000000000..210c67338f --- /dev/null +++ b/test/sys/module/aes_generic/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02cdf80 diff --git a/test/sys/module/aes_generic/sections/.data b/test/sys/module/aes_generic/sections/.data new file mode 100644 index 0000000000..5b34193753 --- /dev/null +++ b/test/sys/module/aes_generic/sections/.data @@ -0,0 +1 @@ +0xffffffffa02cda80 diff --git a/test/sys/module/aes_generic/sections/.exit.text b/test/sys/module/aes_generic/sections/.exit.text new file mode 100644 index 0000000000..7b5622e218 --- /dev/null +++ b/test/sys/module/aes_generic/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02cceb8 diff --git a/test/sys/module/aes_generic/sections/.gnu.linkonce.this_module b/test/sys/module/aes_generic/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..2bce116671 --- /dev/null +++ b/test/sys/module/aes_generic/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02cdbc0 diff --git a/test/sys/module/aes_generic/sections/.init.data b/test/sys/module/aes_generic/sections/.init.data new file mode 100644 index 0000000000..bc7aedcd0a --- /dev/null +++ b/test/sys/module/aes_generic/sections/.init.data @@ -0,0 +1 @@ +0xffffffffa0065300 diff --git a/test/sys/module/aes_generic/sections/.init.text b/test/sys/module/aes_generic/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/aes_generic/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/aes_generic/sections/.note.gnu.build-id b/test/sys/module/aes_generic/sections/.note.gnu.build-id new file mode 100644 index 0000000000..b0efd39ba7 --- /dev/null +++ b/test/sys/module/aes_generic/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02ccecc diff --git a/test/sys/module/aes_generic/sections/.strtab b/test/sys/module/aes_generic/sections/.strtab new file mode 100644 index 0000000000..0818793407 --- /dev/null +++ b/test/sys/module/aes_generic/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02cd678 diff --git a/test/sys/module/aes_generic/sections/.symtab b/test/sys/module/aes_generic/sections/.symtab new file mode 100644 index 0000000000..2e65f00f96 --- /dev/null +++ b/test/sys/module/aes_generic/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02ccfe8 diff --git a/test/sys/module/aes_generic/sections/.text b/test/sys/module/aes_generic/sections/.text new file mode 100644 index 0000000000..bef3229f8b --- /dev/null +++ b/test/sys/module/aes_generic/sections/.text @@ -0,0 +1 @@ +0xffffffffa02cb000 diff --git a/test/sys/module/aes_generic/sections/__kcrctab_gpl b/test/sys/module/aes_generic/sections/__kcrctab_gpl new file mode 100644 index 0000000000..d36d52aab2 --- /dev/null +++ b/test/sys/module/aes_generic/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa02ccf50 diff --git a/test/sys/module/aes_generic/sections/__ksymtab_gpl b/test/sys/module/aes_generic/sections/__ksymtab_gpl new file mode 100644 index 0000000000..378fefa624 --- /dev/null +++ b/test/sys/module/aes_generic/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa02ccef0 diff --git a/test/sys/module/aes_generic/sections/__ksymtab_strings b/test/sys/module/aes_generic/sections/__ksymtab_strings new file mode 100644 index 0000000000..cb9977d82d --- /dev/null +++ b/test/sys/module/aes_generic/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa02ccf80 diff --git a/test/sys/module/aes_generic/srcversion b/test/sys/module/aes_generic/srcversion new file mode 100644 index 0000000000..7570760aa8 --- /dev/null +++ b/test/sys/module/aes_generic/srcversion @@ -0,0 +1 @@ +CE7DEF557FD2F72DE36DE4A diff --git a/test/sys/module/aes_x86_64/initstate b/test/sys/module/aes_x86_64/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/aes_x86_64/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/aes_x86_64/notes/.note.gnu.build-id b/test/sys/module/aes_x86_64/notes/.note.gnu.build-id new file mode 100644 index 0000000000..3475a281f5 Binary files /dev/null and b/test/sys/module/aes_x86_64/notes/.note.gnu.build-id differ diff --git a/test/sys/module/aes_x86_64/refcnt b/test/sys/module/aes_x86_64/refcnt new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/aes_x86_64/refcnt @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/aes_x86_64/sections/.bss b/test/sys/module/aes_x86_64/sections/.bss new file mode 100644 index 0000000000..a12b9f8013 --- /dev/null +++ b/test/sys/module/aes_x86_64/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02d5200 diff --git a/test/sys/module/aes_x86_64/sections/.data b/test/sys/module/aes_x86_64/sections/.data new file mode 100644 index 0000000000..9cac01ef74 --- /dev/null +++ b/test/sys/module/aes_x86_64/sections/.data @@ -0,0 +1 @@ +0xffffffffa02d4d20 diff --git a/test/sys/module/aes_x86_64/sections/.exit.text b/test/sys/module/aes_x86_64/sections/.exit.text new file mode 100644 index 0000000000..1460f0aaaf --- /dev/null +++ b/test/sys/module/aes_x86_64/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02d471c diff --git a/test/sys/module/aes_x86_64/sections/.gnu.linkonce.this_module b/test/sys/module/aes_x86_64/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..a03eb3ff28 --- /dev/null +++ b/test/sys/module/aes_x86_64/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02d4e40 diff --git a/test/sys/module/aes_x86_64/sections/.init.text b/test/sys/module/aes_x86_64/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/aes_x86_64/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/aes_x86_64/sections/.note.gnu.build-id b/test/sys/module/aes_x86_64/sections/.note.gnu.build-id new file mode 100644 index 0000000000..0960a334ea --- /dev/null +++ b/test/sys/module/aes_x86_64/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02d4730 diff --git a/test/sys/module/aes_x86_64/sections/.strtab b/test/sys/module/aes_x86_64/sections/.strtab new file mode 100644 index 0000000000..c3ee59d4f9 --- /dev/null +++ b/test/sys/module/aes_x86_64/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02d4b60 diff --git a/test/sys/module/aes_x86_64/sections/.symtab b/test/sys/module/aes_x86_64/sections/.symtab new file mode 100644 index 0000000000..58cce3c5f5 --- /dev/null +++ b/test/sys/module/aes_x86_64/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02d4758 diff --git a/test/sys/module/aes_x86_64/sections/.text b/test/sys/module/aes_x86_64/sections/.text new file mode 100644 index 0000000000..d498e370a4 --- /dev/null +++ b/test/sys/module/aes_x86_64/sections/.text @@ -0,0 +1 @@ +0xffffffffa02d3000 diff --git a/test/sys/module/aes_x86_64/srcversion b/test/sys/module/aes_x86_64/srcversion new file mode 100644 index 0000000000..b846092a34 --- /dev/null +++ b/test/sys/module/aes_x86_64/srcversion @@ -0,0 +1 @@ +4E315E23114A08593D5D731 diff --git a/test/sys/module/ahci/drivers/pci:ahci b/test/sys/module/ahci/drivers/pci:ahci new file mode 120000 index 0000000000..e08571dcb2 --- /dev/null +++ b/test/sys/module/ahci/drivers/pci:ahci @@ -0,0 +1 @@ +../../../bus/pci/drivers/ahci \ No newline at end of file diff --git a/test/sys/module/ahci/parameters/ahci_em_messages b/test/sys/module/ahci/parameters/ahci_em_messages new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/ahci/parameters/ahci_em_messages @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/ahci/parameters/marvell_enable b/test/sys/module/ahci/parameters/marvell_enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/ahci/parameters/marvell_enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/ahci/parameters/skip_host_reset b/test/sys/module/ahci/parameters/skip_host_reset new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/ahci/parameters/skip_host_reset @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/arc4/initstate b/test/sys/module/arc4/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/arc4/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/arc4/notes/.note.gnu.build-id b/test/sys/module/arc4/notes/.note.gnu.build-id new file mode 100644 index 0000000000..a0fbbd8235 Binary files /dev/null and b/test/sys/module/arc4/notes/.note.gnu.build-id differ diff --git a/test/sys/module/arc4/refcnt b/test/sys/module/arc4/refcnt new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/arc4/refcnt @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/arc4/sections/.bss b/test/sys/module/arc4/sections/.bss new file mode 100644 index 0000000000..f1112df8d5 --- /dev/null +++ b/test/sys/module/arc4/sections/.bss @@ -0,0 +1 @@ +0xffffffffa006ba00 diff --git a/test/sys/module/arc4/sections/.data b/test/sys/module/arc4/sections/.data new file mode 100644 index 0000000000..176373ad8f --- /dev/null +++ b/test/sys/module/arc4/sections/.data @@ -0,0 +1 @@ +0xffffffffa006b520 diff --git a/test/sys/module/arc4/sections/.exit.text b/test/sys/module/arc4/sections/.exit.text new file mode 100644 index 0000000000..962e1d8e33 --- /dev/null +++ b/test/sys/module/arc4/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa006b0dc diff --git a/test/sys/module/arc4/sections/.gnu.linkonce.this_module b/test/sys/module/arc4/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..27c8402db4 --- /dev/null +++ b/test/sys/module/arc4/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa006b640 diff --git a/test/sys/module/arc4/sections/.init.text b/test/sys/module/arc4/sections/.init.text new file mode 100644 index 0000000000..0dbbf92722 --- /dev/null +++ b/test/sys/module/arc4/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa009a000 diff --git a/test/sys/module/arc4/sections/.note.gnu.build-id b/test/sys/module/arc4/sections/.note.gnu.build-id new file mode 100644 index 0000000000..c3e02a06bf --- /dev/null +++ b/test/sys/module/arc4/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa006b0f0 diff --git a/test/sys/module/arc4/sections/.strtab b/test/sys/module/arc4/sections/.strtab new file mode 100644 index 0000000000..0ed741f9c4 --- /dev/null +++ b/test/sys/module/arc4/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa006b400 diff --git a/test/sys/module/arc4/sections/.symtab b/test/sys/module/arc4/sections/.symtab new file mode 100644 index 0000000000..9340859d2a --- /dev/null +++ b/test/sys/module/arc4/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa006b118 diff --git a/test/sys/module/arc4/sections/.text b/test/sys/module/arc4/sections/.text new file mode 100644 index 0000000000..6449cb3074 --- /dev/null +++ b/test/sys/module/arc4/sections/.text @@ -0,0 +1 @@ +0xffffffffa006b000 diff --git a/test/sys/module/arc4/srcversion b/test/sys/module/arc4/srcversion new file mode 100644 index 0000000000..58ea5b69cd --- /dev/null +++ b/test/sys/module/arc4/srcversion @@ -0,0 +1 @@ +0E7B177AF22D87B5B21A577 diff --git a/test/sys/module/atkbd/drivers/serio:atkbd b/test/sys/module/atkbd/drivers/serio:atkbd new file mode 120000 index 0000000000..b4b270be19 --- /dev/null +++ b/test/sys/module/atkbd/drivers/serio:atkbd @@ -0,0 +1 @@ +../../../bus/serio/drivers/atkbd \ No newline at end of file diff --git a/test/sys/module/backlight/holders/thinkpad_acpi b/test/sys/module/backlight/holders/thinkpad_acpi new file mode 120000 index 0000000000..8d266ed087 --- /dev/null +++ b/test/sys/module/backlight/holders/thinkpad_acpi @@ -0,0 +1 @@ +../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/backlight/initstate b/test/sys/module/backlight/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/backlight/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/backlight/notes/.note.gnu.build-id b/test/sys/module/backlight/notes/.note.gnu.build-id new file mode 100644 index 0000000000..032a15ec1a Binary files /dev/null and b/test/sys/module/backlight/notes/.note.gnu.build-id differ diff --git a/test/sys/module/backlight/refcnt b/test/sys/module/backlight/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/backlight/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/backlight/sections/.bss b/test/sys/module/backlight/sections/.bss new file mode 100644 index 0000000000..b54e260f04 --- /dev/null +++ b/test/sys/module/backlight/sections/.bss @@ -0,0 +1 @@ +0xffffffffa01326c0 diff --git a/test/sys/module/backlight/sections/.data b/test/sys/module/backlight/sections/.data new file mode 100644 index 0000000000..e23c0bc285 --- /dev/null +++ b/test/sys/module/backlight/sections/.data @@ -0,0 +1 @@ +0xffffffffa0132220 diff --git a/test/sys/module/backlight/sections/.exit.text b/test/sys/module/backlight/sections/.exit.text new file mode 100644 index 0000000000..a8d8639717 --- /dev/null +++ b/test/sys/module/backlight/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa01315ec diff --git a/test/sys/module/backlight/sections/.gnu.linkonce.this_module b/test/sys/module/backlight/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..82409e97c9 --- /dev/null +++ b/test/sys/module/backlight/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0132300 diff --git a/test/sys/module/backlight/sections/.init.text b/test/sys/module/backlight/sections/.init.text new file mode 100644 index 0000000000..0cac0d19cf --- /dev/null +++ b/test/sys/module/backlight/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0070000 diff --git a/test/sys/module/backlight/sections/.note.gnu.build-id b/test/sys/module/backlight/sections/.note.gnu.build-id new file mode 100644 index 0000000000..5aad31a4e1 --- /dev/null +++ b/test/sys/module/backlight/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0131600 diff --git a/test/sys/module/backlight/sections/.rodata.str1.1 b/test/sys/module/backlight/sections/.rodata.str1.1 new file mode 100644 index 0000000000..2b14e7faca --- /dev/null +++ b/test/sys/module/backlight/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0131624 diff --git a/test/sys/module/backlight/sections/.strtab b/test/sys/module/backlight/sections/.strtab new file mode 100644 index 0000000000..de4719c16a --- /dev/null +++ b/test/sys/module/backlight/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0131de0 diff --git a/test/sys/module/backlight/sections/.symtab b/test/sys/module/backlight/sections/.symtab new file mode 100644 index 0000000000..d79be5a860 --- /dev/null +++ b/test/sys/module/backlight/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0131738 diff --git a/test/sys/module/backlight/sections/.text b/test/sys/module/backlight/sections/.text new file mode 100644 index 0000000000..10b21938c0 --- /dev/null +++ b/test/sys/module/backlight/sections/.text @@ -0,0 +1 @@ +0xffffffffa0131000 diff --git a/test/sys/module/backlight/sections/__kcrctab b/test/sys/module/backlight/sections/__kcrctab new file mode 100644 index 0000000000..96dec713e0 --- /dev/null +++ b/test/sys/module/backlight/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa01316f0 diff --git a/test/sys/module/backlight/sections/__ksymtab b/test/sys/module/backlight/sections/__ksymtab new file mode 100644 index 0000000000..73e5a2e845 --- /dev/null +++ b/test/sys/module/backlight/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa01316d0 diff --git a/test/sys/module/backlight/sections/__ksymtab_strings b/test/sys/module/backlight/sections/__ksymtab_strings new file mode 100644 index 0000000000..f2da9ef09d --- /dev/null +++ b/test/sys/module/backlight/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa0131700 diff --git a/test/sys/module/backlight/srcversion b/test/sys/module/backlight/srcversion new file mode 100644 index 0000000000..779bb0f7df --- /dev/null +++ b/test/sys/module/backlight/srcversion @@ -0,0 +1 @@ +AFD1565C65F3DA6D942CB52 diff --git a/test/sys/module/battery/initstate b/test/sys/module/battery/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/battery/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/battery/notes/.note.gnu.build-id b/test/sys/module/battery/notes/.note.gnu.build-id new file mode 100644 index 0000000000..1fd28414ed Binary files /dev/null and b/test/sys/module/battery/notes/.note.gnu.build-id differ diff --git a/test/sys/module/battery/parameters/cache_time b/test/sys/module/battery/parameters/cache_time new file mode 100644 index 0000000000..83b33d238d --- /dev/null +++ b/test/sys/module/battery/parameters/cache_time @@ -0,0 +1 @@ +1000 diff --git a/test/sys/module/battery/refcnt b/test/sys/module/battery/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/battery/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/battery/sections/.bss b/test/sys/module/battery/sections/.bss new file mode 100644 index 0000000000..c22be1650c --- /dev/null +++ b/test/sys/module/battery/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0082440 diff --git a/test/sys/module/battery/sections/.data b/test/sys/module/battery/sections/.data new file mode 100644 index 0000000000..a8eead6b54 --- /dev/null +++ b/test/sys/module/battery/sections/.data @@ -0,0 +1 @@ +0xffffffffa0081a90 diff --git a/test/sys/module/battery/sections/.exit.text b/test/sys/module/battery/sections/.exit.text new file mode 100644 index 0000000000..a7d36b6d9c --- /dev/null +++ b/test/sys/module/battery/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa008008c diff --git a/test/sys/module/battery/sections/.gnu.linkonce.this_module b/test/sys/module/battery/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..df81e13617 --- /dev/null +++ b/test/sys/module/battery/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0082080 diff --git a/test/sys/module/battery/sections/.init.text b/test/sys/module/battery/sections/.init.text new file mode 100644 index 0000000000..9da5e610a8 --- /dev/null +++ b/test/sys/module/battery/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0084000 diff --git a/test/sys/module/battery/sections/.note.gnu.build-id b/test/sys/module/battery/sections/.note.gnu.build-id new file mode 100644 index 0000000000..ec30ee8185 --- /dev/null +++ b/test/sys/module/battery/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00800ac diff --git a/test/sys/module/battery/sections/.rodata b/test/sys/module/battery/sections/.rodata new file mode 100644 index 0000000000..66560fccf8 --- /dev/null +++ b/test/sys/module/battery/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00800d0 diff --git a/test/sys/module/battery/sections/.rodata.str1.1 b/test/sys/module/battery/sections/.rodata.str1.1 new file mode 100644 index 0000000000..dfccb36c40 --- /dev/null +++ b/test/sys/module/battery/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa008025b diff --git a/test/sys/module/battery/sections/.strtab b/test/sys/module/battery/sections/.strtab new file mode 100644 index 0000000000..0023538a4a --- /dev/null +++ b/test/sys/module/battery/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0081318 diff --git a/test/sys/module/battery/sections/.symtab b/test/sys/module/battery/sections/.symtab new file mode 100644 index 0000000000..b7219c9eb3 --- /dev/null +++ b/test/sys/module/battery/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00807c0 diff --git a/test/sys/module/battery/sections/.text b/test/sys/module/battery/sections/.text new file mode 100644 index 0000000000..f0a6dc674e --- /dev/null +++ b/test/sys/module/battery/sections/.text @@ -0,0 +1 @@ +0xffffffffa007f000 diff --git a/test/sys/module/battery/sections/__param b/test/sys/module/battery/sections/__param new file mode 100644 index 0000000000..1500e41608 --- /dev/null +++ b/test/sys/module/battery/sections/__param @@ -0,0 +1 @@ +0xffffffffa0080798 diff --git a/test/sys/module/battery/srcversion b/test/sys/module/battery/srcversion new file mode 100644 index 0000000000..f5cc60a4b0 --- /dev/null +++ b/test/sys/module/battery/srcversion @@ -0,0 +1 @@ +5A2CE8D302B31A112CFB57A diff --git a/test/sys/module/button/initstate b/test/sys/module/button/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/button/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/button/notes/.note.gnu.build-id b/test/sys/module/button/notes/.note.gnu.build-id new file mode 100644 index 0000000000..893a7911fb Binary files /dev/null and b/test/sys/module/button/notes/.note.gnu.build-id differ diff --git a/test/sys/module/button/refcnt b/test/sys/module/button/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/button/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/button/sections/.bss b/test/sys/module/button/sections/.bss new file mode 100644 index 0000000000..8424cd4a24 --- /dev/null +++ b/test/sys/module/button/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00a8f40 diff --git a/test/sys/module/button/sections/.data b/test/sys/module/button/sections/.data new file mode 100644 index 0000000000..026e51ccb8 --- /dev/null +++ b/test/sys/module/button/sections/.data @@ -0,0 +1 @@ +0xffffffffa00a89e0 diff --git a/test/sys/module/button/sections/.exit.text b/test/sys/module/button/sections/.exit.text new file mode 100644 index 0000000000..8e90a5465a --- /dev/null +++ b/test/sys/module/button/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00a781c diff --git a/test/sys/module/button/sections/.gnu.linkonce.this_module b/test/sys/module/button/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..88f1098f0e --- /dev/null +++ b/test/sys/module/button/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00a8b80 diff --git a/test/sys/module/button/sections/.init.text b/test/sys/module/button/sections/.init.text new file mode 100644 index 0000000000..eac17e2865 --- /dev/null +++ b/test/sys/module/button/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa00aa000 diff --git a/test/sys/module/button/sections/.note.gnu.build-id b/test/sys/module/button/sections/.note.gnu.build-id new file mode 100644 index 0000000000..ac5978ac75 --- /dev/null +++ b/test/sys/module/button/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00a7898 diff --git a/test/sys/module/button/sections/.rodata b/test/sys/module/button/sections/.rodata new file mode 100644 index 0000000000..290e5bc668 --- /dev/null +++ b/test/sys/module/button/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00a78c0 diff --git a/test/sys/module/button/sections/.rodata.str1.1 b/test/sys/module/button/sections/.rodata.str1.1 new file mode 100644 index 0000000000..d8b6cd36b3 --- /dev/null +++ b/test/sys/module/button/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00a7b60 diff --git a/test/sys/module/button/sections/.smp_locks b/test/sys/module/button/sections/.smp_locks new file mode 100644 index 0000000000..6def877473 --- /dev/null +++ b/test/sys/module/button/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa00a7c98 diff --git a/test/sys/module/button/sections/.strtab b/test/sys/module/button/sections/.strtab new file mode 100644 index 0000000000..9295ce3506 --- /dev/null +++ b/test/sys/module/button/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00a84d8 diff --git a/test/sys/module/button/sections/.symtab b/test/sys/module/button/sections/.symtab new file mode 100644 index 0000000000..aa4d355f83 --- /dev/null +++ b/test/sys/module/button/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00a7cb0 diff --git a/test/sys/module/button/sections/.text b/test/sys/module/button/sections/.text new file mode 100644 index 0000000000..7253b5c98a --- /dev/null +++ b/test/sys/module/button/sections/.text @@ -0,0 +1 @@ +0xffffffffa00a7000 diff --git a/test/sys/module/button/srcversion b/test/sys/module/button/srcversion new file mode 100644 index 0000000000..aa59993526 --- /dev/null +++ b/test/sys/module/button/srcversion @@ -0,0 +1 @@ +2713981C971D8EC4C059338 diff --git a/test/sys/module/cdc_acm/drivers/usb:cdc_acm b/test/sys/module/cdc_acm/drivers/usb:cdc_acm new file mode 120000 index 0000000000..079f9e02bc --- /dev/null +++ b/test/sys/module/cdc_acm/drivers/usb:cdc_acm @@ -0,0 +1 @@ +../../../bus/usb/drivers/cdc_acm \ No newline at end of file diff --git a/test/sys/module/cdc_acm/initstate b/test/sys/module/cdc_acm/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/cdc_acm/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/cdc_acm/notes/.note.gnu.build-id b/test/sys/module/cdc_acm/notes/.note.gnu.build-id new file mode 100644 index 0000000000..953ba93fab Binary files /dev/null and b/test/sys/module/cdc_acm/notes/.note.gnu.build-id differ diff --git a/test/sys/module/cdc_acm/refcnt b/test/sys/module/cdc_acm/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/cdc_acm/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/cdc_acm/sections/.bss b/test/sys/module/cdc_acm/sections/.bss new file mode 100644 index 0000000000..62ae06da6e --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02db8c0 diff --git a/test/sys/module/cdc_acm/sections/.data b/test/sys/module/cdc_acm/sections/.data new file mode 100644 index 0000000000..4f5bd1f988 --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.data @@ -0,0 +1 @@ +0xffffffffa02db0e0 diff --git a/test/sys/module/cdc_acm/sections/.exit.text b/test/sys/module/cdc_acm/sections/.exit.text new file mode 100644 index 0000000000..6ac6281b53 --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02d949c diff --git a/test/sys/module/cdc_acm/sections/.gnu.linkonce.this_module b/test/sys/module/cdc_acm/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..c8bc831dff --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02db500 diff --git a/test/sys/module/cdc_acm/sections/.init.text b/test/sys/module/cdc_acm/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/cdc_acm/sections/.note.gnu.build-id b/test/sys/module/cdc_acm/sections/.note.gnu.build-id new file mode 100644 index 0000000000..ad24190ade --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02d94c8 diff --git a/test/sys/module/cdc_acm/sections/.rodata b/test/sys/module/cdc_acm/sections/.rodata new file mode 100644 index 0000000000..4fe44c791c --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa02d9500 diff --git a/test/sys/module/cdc_acm/sections/.rodata.str1.1 b/test/sys/module/cdc_acm/sections/.rodata.str1.1 new file mode 100644 index 0000000000..fce75dc67d --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa02d9698 diff --git a/test/sys/module/cdc_acm/sections/.smp_locks b/test/sys/module/cdc_acm/sections/.smp_locks new file mode 100644 index 0000000000..021aa1b318 --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa02d9660 diff --git a/test/sys/module/cdc_acm/sections/.strtab b/test/sys/module/cdc_acm/sections/.strtab new file mode 100644 index 0000000000..d80f3c8d60 --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02da838 diff --git a/test/sys/module/cdc_acm/sections/.symtab b/test/sys/module/cdc_acm/sections/.symtab new file mode 100644 index 0000000000..54ba7b4c2c --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02d9968 diff --git a/test/sys/module/cdc_acm/sections/.text b/test/sys/module/cdc_acm/sections/.text new file mode 100644 index 0000000000..41d147290c --- /dev/null +++ b/test/sys/module/cdc_acm/sections/.text @@ -0,0 +1 @@ +0xffffffffa02d7000 diff --git a/test/sys/module/cdc_acm/srcversion b/test/sys/module/cdc_acm/srcversion new file mode 100644 index 0000000000..c74f75eee5 --- /dev/null +++ b/test/sys/module/cdc_acm/srcversion @@ -0,0 +1 @@ +5DED3866AA046376E4E36DD diff --git a/test/sys/module/cdrom/holders/sr_mod b/test/sys/module/cdrom/holders/sr_mod new file mode 120000 index 0000000000..0e5f5fb1c5 --- /dev/null +++ b/test/sys/module/cdrom/holders/sr_mod @@ -0,0 +1 @@ +../../sr_mod \ No newline at end of file diff --git a/test/sys/module/cdrom/initstate b/test/sys/module/cdrom/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/cdrom/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/cdrom/notes/.note.gnu.build-id b/test/sys/module/cdrom/notes/.note.gnu.build-id new file mode 100644 index 0000000000..a828ad39d8 Binary files /dev/null and b/test/sys/module/cdrom/notes/.note.gnu.build-id differ diff --git a/test/sys/module/cdrom/refcnt b/test/sys/module/cdrom/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/cdrom/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/cdrom/sections/.bss b/test/sys/module/cdrom/sections/.bss new file mode 100644 index 0000000000..6156ae0cc9 --- /dev/null +++ b/test/sys/module/cdrom/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0032380 diff --git a/test/sys/module/cdrom/sections/.data b/test/sys/module/cdrom/sections/.data new file mode 100644 index 0000000000..709c04a1c2 --- /dev/null +++ b/test/sys/module/cdrom/sections/.data @@ -0,0 +1 @@ +0xffffffffa0031b80 diff --git a/test/sys/module/cdrom/sections/.exit.text b/test/sys/module/cdrom/sections/.exit.text new file mode 100644 index 0000000000..55fff8e055 --- /dev/null +++ b/test/sys/module/cdrom/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa002e0f8 diff --git a/test/sys/module/cdrom/sections/.gnu.linkonce.this_module b/test/sys/module/cdrom/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..68dec757e2 --- /dev/null +++ b/test/sys/module/cdrom/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0031fc0 diff --git a/test/sys/module/cdrom/sections/.init.text b/test/sys/module/cdrom/sections/.init.text new file mode 100644 index 0000000000..438d2016db --- /dev/null +++ b/test/sys/module/cdrom/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0034000 diff --git a/test/sys/module/cdrom/sections/.note.gnu.build-id b/test/sys/module/cdrom/sections/.note.gnu.build-id new file mode 100644 index 0000000000..f490a72833 --- /dev/null +++ b/test/sys/module/cdrom/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa002e120 diff --git a/test/sys/module/cdrom/sections/.rodata b/test/sys/module/cdrom/sections/.rodata new file mode 100644 index 0000000000..417b1b20fc --- /dev/null +++ b/test/sys/module/cdrom/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa002e160 diff --git a/test/sys/module/cdrom/sections/.rodata.str1.1 b/test/sys/module/cdrom/sections/.rodata.str1.1 new file mode 100644 index 0000000000..6f18a0f930 --- /dev/null +++ b/test/sys/module/cdrom/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa002f896 diff --git a/test/sys/module/cdrom/sections/.strtab b/test/sys/module/cdrom/sections/.strtab new file mode 100644 index 0000000000..5dc2e0953b --- /dev/null +++ b/test/sys/module/cdrom/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0030f60 diff --git a/test/sys/module/cdrom/sections/.symtab b/test/sys/module/cdrom/sections/.symtab new file mode 100644 index 0000000000..4000c51bab --- /dev/null +++ b/test/sys/module/cdrom/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa002fef8 diff --git a/test/sys/module/cdrom/sections/.text b/test/sys/module/cdrom/sections/.text new file mode 100644 index 0000000000..c6448a6d56 --- /dev/null +++ b/test/sys/module/cdrom/sections/.text @@ -0,0 +1 @@ +0xffffffffa0029000 diff --git a/test/sys/module/cdrom/sections/__kcrctab b/test/sys/module/cdrom/sections/__kcrctab new file mode 100644 index 0000000000..efa09615a4 --- /dev/null +++ b/test/sys/module/cdrom/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa002fcd0 diff --git a/test/sys/module/cdrom/sections/__ksymtab b/test/sys/module/cdrom/sections/__ksymtab new file mode 100644 index 0000000000..6eb7c581d9 --- /dev/null +++ b/test/sys/module/cdrom/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa002fc10 diff --git a/test/sys/module/cdrom/sections/__ksymtab_strings b/test/sys/module/cdrom/sections/__ksymtab_strings new file mode 100644 index 0000000000..07d160af8f --- /dev/null +++ b/test/sys/module/cdrom/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa002fe20 diff --git a/test/sys/module/cdrom/sections/__param b/test/sys/module/cdrom/sections/__param new file mode 100644 index 0000000000..37c68c6271 --- /dev/null +++ b/test/sys/module/cdrom/sections/__param @@ -0,0 +1 @@ +0xffffffffa002fd30 diff --git a/test/sys/module/cdrom/srcversion b/test/sys/module/cdrom/srcversion new file mode 100644 index 0000000000..8ae5382c37 --- /dev/null +++ b/test/sys/module/cdrom/srcversion @@ -0,0 +1 @@ +D868CCB0789DA27F51280A8 diff --git a/test/sys/module/cfg80211/holders/iwl3945 b/test/sys/module/cfg80211/holders/iwl3945 new file mode 120000 index 0000000000..31cc83c4cc --- /dev/null +++ b/test/sys/module/cfg80211/holders/iwl3945 @@ -0,0 +1 @@ +../../iwl3945 \ No newline at end of file diff --git a/test/sys/module/cfg80211/holders/mac80211 b/test/sys/module/cfg80211/holders/mac80211 new file mode 120000 index 0000000000..3e5eafbc30 --- /dev/null +++ b/test/sys/module/cfg80211/holders/mac80211 @@ -0,0 +1 @@ +../../mac80211 \ No newline at end of file diff --git a/test/sys/module/cfg80211/initstate b/test/sys/module/cfg80211/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/cfg80211/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/cfg80211/notes/.note.gnu.build-id b/test/sys/module/cfg80211/notes/.note.gnu.build-id new file mode 100644 index 0000000000..456d1f006d Binary files /dev/null and b/test/sys/module/cfg80211/notes/.note.gnu.build-id differ diff --git a/test/sys/module/cfg80211/parameters/ieee80211_regdom b/test/sys/module/cfg80211/parameters/ieee80211_regdom new file mode 100644 index 0000000000..f4cd62e01d --- /dev/null +++ b/test/sys/module/cfg80211/parameters/ieee80211_regdom @@ -0,0 +1 @@ +US diff --git a/test/sys/module/cfg80211/refcnt b/test/sys/module/cfg80211/refcnt new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/cfg80211/refcnt @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/cfg80211/sections/.bss b/test/sys/module/cfg80211/sections/.bss new file mode 100644 index 0000000000..656d4058a7 --- /dev/null +++ b/test/sys/module/cfg80211/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00c02c0 diff --git a/test/sys/module/cfg80211/sections/.data b/test/sys/module/cfg80211/sections/.data new file mode 100644 index 0000000000..14f4cfea17 --- /dev/null +++ b/test/sys/module/cfg80211/sections/.data @@ -0,0 +1 @@ +0xffffffffa00bf760 diff --git a/test/sys/module/cfg80211/sections/.data.read_mostly b/test/sys/module/cfg80211/sections/.data.read_mostly new file mode 100644 index 0000000000..1f20cbf46d --- /dev/null +++ b/test/sys/module/cfg80211/sections/.data.read_mostly @@ -0,0 +1 @@ +0xffffffffa00bfe60 diff --git a/test/sys/module/cfg80211/sections/.gnu.linkonce.this_module b/test/sys/module/cfg80211/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..3e3b07f0fa --- /dev/null +++ b/test/sys/module/cfg80211/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00bff00 diff --git a/test/sys/module/cfg80211/sections/.note.gnu.build-id b/test/sys/module/cfg80211/sections/.note.gnu.build-id new file mode 100644 index 0000000000..d96aee18ea --- /dev/null +++ b/test/sys/module/cfg80211/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00bce58 diff --git a/test/sys/module/cfg80211/sections/.rodata b/test/sys/module/cfg80211/sections/.rodata new file mode 100644 index 0000000000..5f1b3b0871 --- /dev/null +++ b/test/sys/module/cfg80211/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00bce80 diff --git a/test/sys/module/cfg80211/sections/.rodata.str1.1 b/test/sys/module/cfg80211/sections/.rodata.str1.1 new file mode 100644 index 0000000000..c2b36962ee --- /dev/null +++ b/test/sys/module/cfg80211/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00bd078 diff --git a/test/sys/module/cfg80211/sections/.smp_locks b/test/sys/module/cfg80211/sections/.smp_locks new file mode 100644 index 0000000000..72fa41d330 --- /dev/null +++ b/test/sys/module/cfg80211/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa00bd2a0 diff --git a/test/sys/module/cfg80211/sections/.strtab b/test/sys/module/cfg80211/sections/.strtab new file mode 100644 index 0000000000..c392f0d8c8 --- /dev/null +++ b/test/sys/module/cfg80211/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00be8c0 diff --git a/test/sys/module/cfg80211/sections/.symtab b/test/sys/module/cfg80211/sections/.symtab new file mode 100644 index 0000000000..40575ed44d --- /dev/null +++ b/test/sys/module/cfg80211/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00bd540 diff --git a/test/sys/module/cfg80211/sections/.text b/test/sys/module/cfg80211/sections/.text new file mode 100644 index 0000000000..68fd051fe0 --- /dev/null +++ b/test/sys/module/cfg80211/sections/.text @@ -0,0 +1 @@ +0xffffffffa00b9000 diff --git a/test/sys/module/cfg80211/sections/__bug_table b/test/sys/module/cfg80211/sections/__bug_table new file mode 100644 index 0000000000..a6fa3d717c --- /dev/null +++ b/test/sys/module/cfg80211/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa00bd166 diff --git a/test/sys/module/cfg80211/sections/__kcrctab b/test/sys/module/cfg80211/sections/__kcrctab new file mode 100644 index 0000000000..7aae4d6b46 --- /dev/null +++ b/test/sys/module/cfg80211/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa00bd400 diff --git a/test/sys/module/cfg80211/sections/__ksymtab b/test/sys/module/cfg80211/sections/__ksymtab new file mode 100644 index 0000000000..edbaa5bae0 --- /dev/null +++ b/test/sys/module/cfg80211/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa00bd370 diff --git a/test/sys/module/cfg80211/sections/__ksymtab_strings b/test/sys/module/cfg80211/sections/__ksymtab_strings new file mode 100644 index 0000000000..926ecb7a37 --- /dev/null +++ b/test/sys/module/cfg80211/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa00bd448 diff --git a/test/sys/module/cfg80211/sections/__param b/test/sys/module/cfg80211/sections/__param new file mode 100644 index 0000000000..05d56e648b --- /dev/null +++ b/test/sys/module/cfg80211/sections/__param @@ -0,0 +1 @@ +0xffffffffa00bd518 diff --git a/test/sys/module/cfg80211/srcversion b/test/sys/module/cfg80211/srcversion new file mode 100644 index 0000000000..54b0b7b40e --- /dev/null +++ b/test/sys/module/cfg80211/srcversion @@ -0,0 +1 @@ +C43F275505B181F0D1625BE diff --git a/test/sys/module/crypto_blkcipher/holders/ecb b/test/sys/module/crypto_blkcipher/holders/ecb new file mode 120000 index 0000000000..1ab6b733de --- /dev/null +++ b/test/sys/module/crypto_blkcipher/holders/ecb @@ -0,0 +1 @@ +../../ecb \ No newline at end of file diff --git a/test/sys/module/crypto_blkcipher/initstate b/test/sys/module/crypto_blkcipher/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/crypto_blkcipher/notes/.note.gnu.build-id b/test/sys/module/crypto_blkcipher/notes/.note.gnu.build-id new file mode 100644 index 0000000000..e1587afc28 Binary files /dev/null and b/test/sys/module/crypto_blkcipher/notes/.note.gnu.build-id differ diff --git a/test/sys/module/crypto_blkcipher/refcnt b/test/sys/module/crypto_blkcipher/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/crypto_blkcipher/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/crypto_blkcipher/sections/.bss b/test/sys/module/crypto_blkcipher/sections/.bss new file mode 100644 index 0000000000..606e762789 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.bss @@ -0,0 +1 @@ +0xffffffffa01f3ec0 diff --git a/test/sys/module/crypto_blkcipher/sections/.data b/test/sys/module/crypto_blkcipher/sections/.data new file mode 100644 index 0000000000..99f4d7d023 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.data @@ -0,0 +1 @@ +0xffffffffa01f39e0 diff --git a/test/sys/module/crypto_blkcipher/sections/.exit.text b/test/sys/module/crypto_blkcipher/sections/.exit.text new file mode 100644 index 0000000000..44111cb1b6 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa01f138c diff --git a/test/sys/module/crypto_blkcipher/sections/.gnu.linkonce.this_module b/test/sys/module/crypto_blkcipher/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..d84ce29e3b --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa01f3b00 diff --git a/test/sys/module/crypto_blkcipher/sections/.init.text b/test/sys/module/crypto_blkcipher/sections/.init.text new file mode 100644 index 0000000000..02c713a482 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0027000 diff --git a/test/sys/module/crypto_blkcipher/sections/.note.gnu.build-id b/test/sys/module/crypto_blkcipher/sections/.note.gnu.build-id new file mode 100644 index 0000000000..0e9fea03c5 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa01f13b0 diff --git a/test/sys/module/crypto_blkcipher/sections/.rodata b/test/sys/module/crypto_blkcipher/sections/.rodata new file mode 100644 index 0000000000..e8a546c3b6 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa01f13e0 diff --git a/test/sys/module/crypto_blkcipher/sections/.rodata.str1.1 b/test/sys/module/crypto_blkcipher/sections/.rodata.str1.1 new file mode 100644 index 0000000000..8884e36da2 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa01f1440 diff --git a/test/sys/module/crypto_blkcipher/sections/.smp_locks b/test/sys/module/crypto_blkcipher/sections/.smp_locks new file mode 100644 index 0000000000..7697192a16 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa01f18c0 diff --git a/test/sys/module/crypto_blkcipher/sections/.strtab b/test/sys/module/crypto_blkcipher/sections/.strtab new file mode 100644 index 0000000000..e8b4217f02 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa01f2b10 diff --git a/test/sys/module/crypto_blkcipher/sections/.symtab b/test/sys/module/crypto_blkcipher/sections/.symtab new file mode 100644 index 0000000000..21561abfe9 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa01f18f8 diff --git a/test/sys/module/crypto_blkcipher/sections/.text b/test/sys/module/crypto_blkcipher/sections/.text new file mode 100644 index 0000000000..e3a07aecb9 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/.text @@ -0,0 +1 @@ +0xffffffffa01ef000 diff --git a/test/sys/module/crypto_blkcipher/sections/__bug_table b/test/sys/module/crypto_blkcipher/sections/__bug_table new file mode 100644 index 0000000000..b8ba8010c6 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa01f185f diff --git a/test/sys/module/crypto_blkcipher/sections/__kcrctab_gpl b/test/sys/module/crypto_blkcipher/sections/__kcrctab_gpl new file mode 100644 index 0000000000..a24c10fa5a --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa01f16e0 diff --git a/test/sys/module/crypto_blkcipher/sections/__ksymtab_gpl b/test/sys/module/crypto_blkcipher/sections/__ksymtab_gpl new file mode 100644 index 0000000000..59397c545d --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa01f1610 diff --git a/test/sys/module/crypto_blkcipher/sections/__ksymtab_strings b/test/sys/module/crypto_blkcipher/sections/__ksymtab_strings new file mode 100644 index 0000000000..354b438583 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa01f1748 diff --git a/test/sys/module/crypto_blkcipher/srcversion b/test/sys/module/crypto_blkcipher/srcversion new file mode 100644 index 0000000000..1f5eef5f40 --- /dev/null +++ b/test/sys/module/crypto_blkcipher/srcversion @@ -0,0 +1 @@ +723F00BD2391209F4D65272 diff --git a/test/sys/module/dm_mod/initstate b/test/sys/module/dm_mod/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/dm_mod/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/dm_mod/notes/.note.gnu.build-id b/test/sys/module/dm_mod/notes/.note.gnu.build-id new file mode 100644 index 0000000000..31a266d122 Binary files /dev/null and b/test/sys/module/dm_mod/notes/.note.gnu.build-id differ diff --git a/test/sys/module/dm_mod/refcnt b/test/sys/module/dm_mod/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/dm_mod/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/dm_mod/sections/.bss b/test/sys/module/dm_mod/sections/.bss new file mode 100644 index 0000000000..f8203179ba --- /dev/null +++ b/test/sys/module/dm_mod/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02177c0 diff --git a/test/sys/module/dm_mod/sections/.data b/test/sys/module/dm_mod/sections/.data new file mode 100644 index 0000000000..cd3cc1ba78 --- /dev/null +++ b/test/sys/module/dm_mod/sections/.data @@ -0,0 +1 @@ +0xffffffffa0216f40 diff --git a/test/sys/module/dm_mod/sections/.exit.text b/test/sys/module/dm_mod/sections/.exit.text new file mode 100644 index 0000000000..0536d6e99f --- /dev/null +++ b/test/sys/module/dm_mod/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0210c20 diff --git a/test/sys/module/dm_mod/sections/.gnu.linkonce.this_module b/test/sys/module/dm_mod/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..1236a596e9 --- /dev/null +++ b/test/sys/module/dm_mod/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0217400 diff --git a/test/sys/module/dm_mod/sections/.init.data b/test/sys/module/dm_mod/sections/.init.data new file mode 100644 index 0000000000..0c64786a2b --- /dev/null +++ b/test/sys/module/dm_mod/sections/.init.data @@ -0,0 +1 @@ +0xffffffffa00652c0 diff --git a/test/sys/module/dm_mod/sections/.init.text b/test/sys/module/dm_mod/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/dm_mod/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/dm_mod/sections/.note.gnu.build-id b/test/sys/module/dm_mod/sections/.note.gnu.build-id new file mode 100644 index 0000000000..87b899fd00 --- /dev/null +++ b/test/sys/module/dm_mod/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0210c54 diff --git a/test/sys/module/dm_mod/sections/.rodata b/test/sys/module/dm_mod/sections/.rodata new file mode 100644 index 0000000000..7fecd91af0 --- /dev/null +++ b/test/sys/module/dm_mod/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0210c80 diff --git a/test/sys/module/dm_mod/sections/.rodata.str1.1 b/test/sys/module/dm_mod/sections/.rodata.str1.1 new file mode 100644 index 0000000000..34717dbb29 --- /dev/null +++ b/test/sys/module/dm_mod/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0211c4d diff --git a/test/sys/module/dm_mod/sections/.smp_locks b/test/sys/module/dm_mod/sections/.smp_locks new file mode 100644 index 0000000000..8f0c07cf58 --- /dev/null +++ b/test/sys/module/dm_mod/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa0210eb8 diff --git a/test/sys/module/dm_mod/sections/.strtab b/test/sys/module/dm_mod/sections/.strtab new file mode 100644 index 0000000000..31ab58e628 --- /dev/null +++ b/test/sys/module/dm_mod/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02151f0 diff --git a/test/sys/module/dm_mod/sections/.symtab b/test/sys/module/dm_mod/sections/.symtab new file mode 100644 index 0000000000..e95e4e21b8 --- /dev/null +++ b/test/sys/module/dm_mod/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02124a8 diff --git a/test/sys/module/dm_mod/sections/.text b/test/sys/module/dm_mod/sections/.text new file mode 100644 index 0000000000..dea11088ad --- /dev/null +++ b/test/sys/module/dm_mod/sections/.text @@ -0,0 +1 @@ +0xffffffffa0209000 diff --git a/test/sys/module/dm_mod/sections/__bug_table b/test/sys/module/dm_mod/sections/__bug_table new file mode 100644 index 0000000000..ac601205b1 --- /dev/null +++ b/test/sys/module/dm_mod/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa0211f54 diff --git a/test/sys/module/dm_mod/sections/__kcrctab b/test/sys/module/dm_mod/sections/__kcrctab new file mode 100644 index 0000000000..0d6a645432 --- /dev/null +++ b/test/sys/module/dm_mod/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa0212210 diff --git a/test/sys/module/dm_mod/sections/__kcrctab_gpl b/test/sys/module/dm_mod/sections/__kcrctab_gpl new file mode 100644 index 0000000000..f77ff392a6 --- /dev/null +++ b/test/sys/module/dm_mod/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa02122f0 diff --git a/test/sys/module/dm_mod/sections/__ksymtab b/test/sys/module/dm_mod/sections/__ksymtab new file mode 100644 index 0000000000..6154ce23d9 --- /dev/null +++ b/test/sys/module/dm_mod/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa02120d0 diff --git a/test/sys/module/dm_mod/sections/__ksymtab_gpl b/test/sys/module/dm_mod/sections/__ksymtab_gpl new file mode 100644 index 0000000000..32c541ebde --- /dev/null +++ b/test/sys/module/dm_mod/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa02122b0 diff --git a/test/sys/module/dm_mod/sections/__ksymtab_strings b/test/sys/module/dm_mod/sections/__ksymtab_strings new file mode 100644 index 0000000000..000191bad8 --- /dev/null +++ b/test/sys/module/dm_mod/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa0212310 diff --git a/test/sys/module/dm_mod/sections/__param b/test/sys/module/dm_mod/sections/__param new file mode 100644 index 0000000000..cf9b323e33 --- /dev/null +++ b/test/sys/module/dm_mod/sections/__param @@ -0,0 +1 @@ +0xffffffffa02120a8 diff --git a/test/sys/module/dm_mod/srcversion b/test/sys/module/dm_mod/srcversion new file mode 100644 index 0000000000..3a49ba4d5c --- /dev/null +++ b/test/sys/module/dm_mod/srcversion @@ -0,0 +1 @@ +458AEB289C7AA031FFD0011 diff --git a/test/sys/module/dock/parameters/immediate_undock b/test/sys/module/dock/parameters/immediate_undock new file mode 100644 index 0000000000..9bda8c35c2 --- /dev/null +++ b/test/sys/module/dock/parameters/immediate_undock @@ -0,0 +1 @@ +Y diff --git a/test/sys/module/e1000e/drivers/pci:e1000e b/test/sys/module/e1000e/drivers/pci:e1000e new file mode 120000 index 0000000000..c8a10dcf7b --- /dev/null +++ b/test/sys/module/e1000e/drivers/pci:e1000e @@ -0,0 +1 @@ +../../../bus/pci/drivers/e1000e \ No newline at end of file diff --git a/test/sys/module/e1000e/initstate b/test/sys/module/e1000e/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/e1000e/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/e1000e/notes/.note.gnu.build-id b/test/sys/module/e1000e/notes/.note.gnu.build-id new file mode 100644 index 0000000000..bd1123ff9c Binary files /dev/null and b/test/sys/module/e1000e/notes/.note.gnu.build-id differ diff --git a/test/sys/module/e1000e/parameters/copybreak b/test/sys/module/e1000e/parameters/copybreak new file mode 100644 index 0000000000..9183bf03fc --- /dev/null +++ b/test/sys/module/e1000e/parameters/copybreak @@ -0,0 +1 @@ +256 diff --git a/test/sys/module/e1000e/refcnt b/test/sys/module/e1000e/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/e1000e/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/e1000e/sections/.bss b/test/sys/module/e1000e/sections/.bss new file mode 100644 index 0000000000..c4e25c1ea2 --- /dev/null +++ b/test/sys/module/e1000e/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0025800 diff --git a/test/sys/module/e1000e/sections/.data b/test/sys/module/e1000e/sections/.data new file mode 100644 index 0000000000..2b3221af45 --- /dev/null +++ b/test/sys/module/e1000e/sections/.data @@ -0,0 +1 @@ +0xffffffffa00243c0 diff --git a/test/sys/module/e1000e/sections/.devexit.text b/test/sys/module/e1000e/sections/.devexit.text new file mode 100644 index 0000000000..b100326af6 --- /dev/null +++ b/test/sys/module/e1000e/sections/.devexit.text @@ -0,0 +1 @@ +0xffffffffa001c672 diff --git a/test/sys/module/e1000e/sections/.devinit.data b/test/sys/module/e1000e/sections/.devinit.data new file mode 100644 index 0000000000..002128c8cf --- /dev/null +++ b/test/sys/module/e1000e/sections/.devinit.data @@ -0,0 +1 @@ +0xffffffffa0024fe0 diff --git a/test/sys/module/e1000e/sections/.devinit.text b/test/sys/module/e1000e/sections/.devinit.text new file mode 100644 index 0000000000..5a6d2efda5 --- /dev/null +++ b/test/sys/module/e1000e/sections/.devinit.text @@ -0,0 +1 @@ +0xffffffffa001b380 diff --git a/test/sys/module/e1000e/sections/.exit.text b/test/sys/module/e1000e/sections/.exit.text new file mode 100644 index 0000000000..71d7245500 --- /dev/null +++ b/test/sys/module/e1000e/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa001c64f diff --git a/test/sys/module/e1000e/sections/.gnu.linkonce.this_module b/test/sys/module/e1000e/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..8dd3ddf340 --- /dev/null +++ b/test/sys/module/e1000e/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0025440 diff --git a/test/sys/module/e1000e/sections/.init.text b/test/sys/module/e1000e/sections/.init.text new file mode 100644 index 0000000000..02c713a482 --- /dev/null +++ b/test/sys/module/e1000e/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0027000 diff --git a/test/sys/module/e1000e/sections/.note.gnu.build-id b/test/sys/module/e1000e/sections/.note.gnu.build-id new file mode 100644 index 0000000000..85b6a4c439 --- /dev/null +++ b/test/sys/module/e1000e/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa001c750 diff --git a/test/sys/module/e1000e/sections/.rodata b/test/sys/module/e1000e/sections/.rodata new file mode 100644 index 0000000000..f4fae347c2 --- /dev/null +++ b/test/sys/module/e1000e/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa001c780 diff --git a/test/sys/module/e1000e/sections/.rodata.str1.1 b/test/sys/module/e1000e/sections/.rodata.str1.1 new file mode 100644 index 0000000000..9553f3a5ea --- /dev/null +++ b/test/sys/module/e1000e/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa001d6f0 diff --git a/test/sys/module/e1000e/sections/.smp_locks b/test/sys/module/e1000e/sections/.smp_locks new file mode 100644 index 0000000000..32e64d23f0 --- /dev/null +++ b/test/sys/module/e1000e/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa001e730 diff --git a/test/sys/module/e1000e/sections/.strtab b/test/sys/module/e1000e/sections/.strtab new file mode 100644 index 0000000000..9cac5bb7be --- /dev/null +++ b/test/sys/module/e1000e/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0021ac0 diff --git a/test/sys/module/e1000e/sections/.symtab b/test/sys/module/e1000e/sections/.symtab new file mode 100644 index 0000000000..bd6f46ab55 --- /dev/null +++ b/test/sys/module/e1000e/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa001e8b0 diff --git a/test/sys/module/e1000e/sections/.text b/test/sys/module/e1000e/sections/.text new file mode 100644 index 0000000000..bebf649c98 --- /dev/null +++ b/test/sys/module/e1000e/sections/.text @@ -0,0 +1 @@ +0xffffffffa0009000 diff --git a/test/sys/module/e1000e/sections/__bug_table b/test/sys/module/e1000e/sections/__bug_table new file mode 100644 index 0000000000..586c743633 --- /dev/null +++ b/test/sys/module/e1000e/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa001e590 diff --git a/test/sys/module/e1000e/sections/__param b/test/sys/module/e1000e/sections/__param new file mode 100644 index 0000000000..ad35b4c4d3 --- /dev/null +++ b/test/sys/module/e1000e/sections/__param @@ -0,0 +1 @@ +0xffffffffa001e5f0 diff --git a/test/sys/module/e1000e/srcversion b/test/sys/module/e1000e/srcversion new file mode 100644 index 0000000000..2d95f5520c --- /dev/null +++ b/test/sys/module/e1000e/srcversion @@ -0,0 +1 @@ +5B93BF2B618524ED19305C8 diff --git a/test/sys/module/e1000e/version b/test/sys/module/e1000e/version new file mode 100644 index 0000000000..513f3fcac8 --- /dev/null +++ b/test/sys/module/e1000e/version @@ -0,0 +1 @@ +0.3.3.3-k2 diff --git a/test/sys/module/ecb/initstate b/test/sys/module/ecb/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/ecb/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/ecb/notes/.note.gnu.build-id b/test/sys/module/ecb/notes/.note.gnu.build-id new file mode 100644 index 0000000000..7429debd49 Binary files /dev/null and b/test/sys/module/ecb/notes/.note.gnu.build-id differ diff --git a/test/sys/module/ecb/refcnt b/test/sys/module/ecb/refcnt new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/ecb/refcnt @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/ecb/sections/.bss b/test/sys/module/ecb/sections/.bss new file mode 100644 index 0000000000..3b2d28b674 --- /dev/null +++ b/test/sys/module/ecb/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0027e80 diff --git a/test/sys/module/ecb/sections/.data b/test/sys/module/ecb/sections/.data new file mode 100644 index 0000000000..fe7969627a --- /dev/null +++ b/test/sys/module/ecb/sections/.data @@ -0,0 +1 @@ +0xffffffffa0027a40 diff --git a/test/sys/module/ecb/sections/.exit.text b/test/sys/module/ecb/sections/.exit.text new file mode 100644 index 0000000000..316b24e06d --- /dev/null +++ b/test/sys/module/ecb/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0027300 diff --git a/test/sys/module/ecb/sections/.gnu.linkonce.this_module b/test/sys/module/ecb/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..ed299c2c30 --- /dev/null +++ b/test/sys/module/ecb/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0027ac0 diff --git a/test/sys/module/ecb/sections/.init.text b/test/sys/module/ecb/sections/.init.text new file mode 100644 index 0000000000..6449cb3074 --- /dev/null +++ b/test/sys/module/ecb/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa006b000 diff --git a/test/sys/module/ecb/sections/.note.gnu.build-id b/test/sys/module/ecb/sections/.note.gnu.build-id new file mode 100644 index 0000000000..b5f01876b9 --- /dev/null +++ b/test/sys/module/ecb/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0027314 diff --git a/test/sys/module/ecb/sections/.rodata.str1.1 b/test/sys/module/ecb/sections/.rodata.str1.1 new file mode 100644 index 0000000000..2d9e094f8b --- /dev/null +++ b/test/sys/module/ecb/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0027338 diff --git a/test/sys/module/ecb/sections/.strtab b/test/sys/module/ecb/sections/.strtab new file mode 100644 index 0000000000..c7890605e1 --- /dev/null +++ b/test/sys/module/ecb/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00277c0 diff --git a/test/sys/module/ecb/sections/.symtab b/test/sys/module/ecb/sections/.symtab new file mode 100644 index 0000000000..30e2c736ad --- /dev/null +++ b/test/sys/module/ecb/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0027340 diff --git a/test/sys/module/ecb/sections/.text b/test/sys/module/ecb/sections/.text new file mode 100644 index 0000000000..02c713a482 --- /dev/null +++ b/test/sys/module/ecb/sections/.text @@ -0,0 +1 @@ +0xffffffffa0027000 diff --git a/test/sys/module/ecb/srcversion b/test/sys/module/ecb/srcversion new file mode 100644 index 0000000000..4ac69f7183 --- /dev/null +++ b/test/sys/module/ecb/srcversion @@ -0,0 +1 @@ +5BBA8E5CDEA4EA8BA5ED31D diff --git a/test/sys/module/edd/initstate b/test/sys/module/edd/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/edd/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/edd/notes/.note.gnu.build-id b/test/sys/module/edd/notes/.note.gnu.build-id new file mode 100644 index 0000000000..4ddd6f256c Binary files /dev/null and b/test/sys/module/edd/notes/.note.gnu.build-id differ diff --git a/test/sys/module/edd/refcnt b/test/sys/module/edd/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/edd/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/edd/sections/.bss b/test/sys/module/edd/sections/.bss new file mode 100644 index 0000000000..0d674b34e7 --- /dev/null +++ b/test/sys/module/edd/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02a3880 diff --git a/test/sys/module/edd/sections/.data b/test/sys/module/edd/sections/.data new file mode 100644 index 0000000000..e6c3f52261 --- /dev/null +++ b/test/sys/module/edd/sections/.data @@ -0,0 +1 @@ +0xffffffffa02a3120 diff --git a/test/sys/module/edd/sections/.exit.text b/test/sys/module/edd/sections/.exit.text new file mode 100644 index 0000000000..f2e5e7b5fd --- /dev/null +++ b/test/sys/module/edd/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02a1de8 diff --git a/test/sys/module/edd/sections/.gnu.linkonce.this_module b/test/sys/module/edd/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..9323ee2030 --- /dev/null +++ b/test/sys/module/edd/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02a34c0 diff --git a/test/sys/module/edd/sections/.init.text b/test/sys/module/edd/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/edd/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/edd/sections/.note.gnu.build-id b/test/sys/module/edd/sections/.note.gnu.build-id new file mode 100644 index 0000000000..755abd10dd --- /dev/null +++ b/test/sys/module/edd/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02a1e6c diff --git a/test/sys/module/edd/sections/.rodata b/test/sys/module/edd/sections/.rodata new file mode 100644 index 0000000000..a3d3a996d8 --- /dev/null +++ b/test/sys/module/edd/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa02a1ea0 diff --git a/test/sys/module/edd/sections/.rodata.str1.1 b/test/sys/module/edd/sections/.rodata.str1.1 new file mode 100644 index 0000000000..94d0aaa103 --- /dev/null +++ b/test/sys/module/edd/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa02a1f18 diff --git a/test/sys/module/edd/sections/.strtab b/test/sys/module/edd/sections/.strtab new file mode 100644 index 0000000000..51d73a525f --- /dev/null +++ b/test/sys/module/edd/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02a2b88 diff --git a/test/sys/module/edd/sections/.symtab b/test/sys/module/edd/sections/.symtab new file mode 100644 index 0000000000..458cd75d46 --- /dev/null +++ b/test/sys/module/edd/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02a22b8 diff --git a/test/sys/module/edd/sections/.text b/test/sys/module/edd/sections/.text new file mode 100644 index 0000000000..31cf860540 --- /dev/null +++ b/test/sys/module/edd/sections/.text @@ -0,0 +1 @@ +0xffffffffa02a1000 diff --git a/test/sys/module/edd/srcversion b/test/sys/module/edd/srcversion new file mode 100644 index 0000000000..4ca2711269 --- /dev/null +++ b/test/sys/module/edd/srcversion @@ -0,0 +1 @@ +ED68C1ACC4B2D1B19C7BEA7 diff --git a/test/sys/module/edd/version b/test/sys/module/edd/version new file mode 100644 index 0000000000..8eac30c383 --- /dev/null +++ b/test/sys/module/edd/version @@ -0,0 +1 @@ +0.16 diff --git a/test/sys/module/ehci_hcd/drivers/pci:ehci_hcd b/test/sys/module/ehci_hcd/drivers/pci:ehci_hcd new file mode 120000 index 0000000000..04a01344aa --- /dev/null +++ b/test/sys/module/ehci_hcd/drivers/pci:ehci_hcd @@ -0,0 +1 @@ +../../../bus/pci/drivers/ehci_hcd \ No newline at end of file diff --git a/test/sys/module/ehci_hcd/initstate b/test/sys/module/ehci_hcd/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/ehci_hcd/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/ehci_hcd/notes/.note.gnu.build-id b/test/sys/module/ehci_hcd/notes/.note.gnu.build-id new file mode 100644 index 0000000000..f11d770ec6 Binary files /dev/null and b/test/sys/module/ehci_hcd/notes/.note.gnu.build-id differ diff --git a/test/sys/module/ehci_hcd/parameters/ignore_oc b/test/sys/module/ehci_hcd/parameters/ignore_oc new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/ehci_hcd/parameters/ignore_oc @@ -0,0 +1 @@ +N diff --git a/test/sys/module/ehci_hcd/parameters/log2_irq_thresh b/test/sys/module/ehci_hcd/parameters/log2_irq_thresh new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/ehci_hcd/parameters/log2_irq_thresh @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/ehci_hcd/parameters/park b/test/sys/module/ehci_hcd/parameters/park new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/ehci_hcd/parameters/park @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/ehci_hcd/refcnt b/test/sys/module/ehci_hcd/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/ehci_hcd/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/ehci_hcd/sections/.bss b/test/sys/module/ehci_hcd/sections/.bss new file mode 100644 index 0000000000..4b07c38fac --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00e6480 diff --git a/test/sys/module/ehci_hcd/sections/.data b/test/sys/module/ehci_hcd/sections/.data new file mode 100644 index 0000000000..ebac76e71d --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.data @@ -0,0 +1 @@ +0xffffffffa00e5f40 diff --git a/test/sys/module/ehci_hcd/sections/.exit.text b/test/sys/module/ehci_hcd/sections/.exit.text new file mode 100644 index 0000000000..9755351e16 --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00e3b98 diff --git a/test/sys/module/ehci_hcd/sections/.gnu.linkonce.this_module b/test/sys/module/ehci_hcd/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..8ed5a19de2 --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00e60c0 diff --git a/test/sys/module/ehci_hcd/sections/.init.text b/test/sys/module/ehci_hcd/sections/.init.text new file mode 100644 index 0000000000..6449cb3074 --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa006b000 diff --git a/test/sys/module/ehci_hcd/sections/.note.gnu.build-id b/test/sys/module/ehci_hcd/sections/.note.gnu.build-id new file mode 100644 index 0000000000..991f10afae --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00e3bac diff --git a/test/sys/module/ehci_hcd/sections/.rodata b/test/sys/module/ehci_hcd/sections/.rodata new file mode 100644 index 0000000000..ffa2b9efa7 --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00e3be0 diff --git a/test/sys/module/ehci_hcd/sections/.rodata.str1.1 b/test/sys/module/ehci_hcd/sections/.rodata.str1.1 new file mode 100644 index 0000000000..3f05eb7069 --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00e3dd0 diff --git a/test/sys/module/ehci_hcd/sections/.smp_locks b/test/sys/module/ehci_hcd/sections/.smp_locks new file mode 100644 index 0000000000..0cca8bdca6 --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa00e4048 diff --git a/test/sys/module/ehci_hcd/sections/.strtab b/test/sys/module/ehci_hcd/sections/.strtab new file mode 100644 index 0000000000..c91f0f5925 --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00e54a8 diff --git a/test/sys/module/ehci_hcd/sections/.symtab b/test/sys/module/ehci_hcd/sections/.symtab new file mode 100644 index 0000000000..3b33638dcf --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00e4368 diff --git a/test/sys/module/ehci_hcd/sections/.text b/test/sys/module/ehci_hcd/sections/.text new file mode 100644 index 0000000000..49479f1dc2 --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/.text @@ -0,0 +1 @@ +0xffffffffa00dd000 diff --git a/test/sys/module/ehci_hcd/sections/__bug_table b/test/sys/module/ehci_hcd/sections/__bug_table new file mode 100644 index 0000000000..e5e33c0a0f --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa00e3f22 diff --git a/test/sys/module/ehci_hcd/sections/__param b/test/sys/module/ehci_hcd/sections/__param new file mode 100644 index 0000000000..312ba31e6f --- /dev/null +++ b/test/sys/module/ehci_hcd/sections/__param @@ -0,0 +1 @@ +0xffffffffa00e42f0 diff --git a/test/sys/module/ehci_hcd/srcversion b/test/sys/module/ehci_hcd/srcversion new file mode 100644 index 0000000000..57c7a54c7e --- /dev/null +++ b/test/sys/module/ehci_hcd/srcversion @@ -0,0 +1 @@ +6EBBF13EC8AD467D8AB11A4 diff --git a/test/sys/module/evdev/initstate b/test/sys/module/evdev/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/evdev/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/evdev/notes/.note.gnu.build-id b/test/sys/module/evdev/notes/.note.gnu.build-id new file mode 100644 index 0000000000..2b9211317f Binary files /dev/null and b/test/sys/module/evdev/notes/.note.gnu.build-id differ diff --git a/test/sys/module/evdev/refcnt b/test/sys/module/evdev/refcnt new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/module/evdev/refcnt @@ -0,0 +1 @@ +5 diff --git a/test/sys/module/evdev/sections/.bss b/test/sys/module/evdev/sections/.bss new file mode 100644 index 0000000000..5266c94928 --- /dev/null +++ b/test/sys/module/evdev/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00b50c0 diff --git a/test/sys/module/evdev/sections/.data b/test/sys/module/evdev/sections/.data new file mode 100644 index 0000000000..ba09155bc9 --- /dev/null +++ b/test/sys/module/evdev/sections/.data @@ -0,0 +1 @@ +0xffffffffa00b4be0 diff --git a/test/sys/module/evdev/sections/.exit.text b/test/sys/module/evdev/sections/.exit.text new file mode 100644 index 0000000000..84eb25653d --- /dev/null +++ b/test/sys/module/evdev/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00b3724 diff --git a/test/sys/module/evdev/sections/.gnu.linkonce.this_module b/test/sys/module/evdev/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..1a737c30f8 --- /dev/null +++ b/test/sys/module/evdev/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00b4d00 diff --git a/test/sys/module/evdev/sections/.init.text b/test/sys/module/evdev/sections/.init.text new file mode 100644 index 0000000000..916fbfab4c --- /dev/null +++ b/test/sys/module/evdev/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa00b7000 diff --git a/test/sys/module/evdev/sections/.note.gnu.build-id b/test/sys/module/evdev/sections/.note.gnu.build-id new file mode 100644 index 0000000000..121d12d5f2 --- /dev/null +++ b/test/sys/module/evdev/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00b3738 diff --git a/test/sys/module/evdev/sections/.rodata b/test/sys/module/evdev/sections/.rodata new file mode 100644 index 0000000000..73b2f23ee1 --- /dev/null +++ b/test/sys/module/evdev/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00b3760 diff --git a/test/sys/module/evdev/sections/.rodata.str1.1 b/test/sys/module/evdev/sections/.rodata.str1.1 new file mode 100644 index 0000000000..2db4d5be20 --- /dev/null +++ b/test/sys/module/evdev/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00b3a38 diff --git a/test/sys/module/evdev/sections/.strtab b/test/sys/module/evdev/sections/.strtab new file mode 100644 index 0000000000..c30b6f353c --- /dev/null +++ b/test/sys/module/evdev/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00b4610 diff --git a/test/sys/module/evdev/sections/.symtab b/test/sys/module/evdev/sections/.symtab new file mode 100644 index 0000000000..6e34c8da01 --- /dev/null +++ b/test/sys/module/evdev/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00b3b60 diff --git a/test/sys/module/evdev/sections/.text b/test/sys/module/evdev/sections/.text new file mode 100644 index 0000000000..5ec64aea9b --- /dev/null +++ b/test/sys/module/evdev/sections/.text @@ -0,0 +1 @@ +0xffffffffa00b2000 diff --git a/test/sys/module/evdev/srcversion b/test/sys/module/evdev/srcversion new file mode 100644 index 0000000000..3972d06473 --- /dev/null +++ b/test/sys/module/evdev/srcversion @@ -0,0 +1 @@ +6F6934C1F95317926EA0520 diff --git a/test/sys/module/fuse/initstate b/test/sys/module/fuse/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/fuse/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/fuse/notes/.note.gnu.build-id b/test/sys/module/fuse/notes/.note.gnu.build-id new file mode 100644 index 0000000000..d2436c341d Binary files /dev/null and b/test/sys/module/fuse/notes/.note.gnu.build-id differ diff --git a/test/sys/module/fuse/refcnt b/test/sys/module/fuse/refcnt new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/module/fuse/refcnt @@ -0,0 +1 @@ +3 diff --git a/test/sys/module/fuse/sections/.bss b/test/sys/module/fuse/sections/.bss new file mode 100644 index 0000000000..8234908065 --- /dev/null +++ b/test/sys/module/fuse/sections/.bss @@ -0,0 +1 @@ +0xffffffffa024e300 diff --git a/test/sys/module/fuse/sections/.data b/test/sys/module/fuse/sections/.data new file mode 100644 index 0000000000..5b456fd81a --- /dev/null +++ b/test/sys/module/fuse/sections/.data @@ -0,0 +1 @@ +0xffffffffa024dba0 diff --git a/test/sys/module/fuse/sections/.exit.text b/test/sys/module/fuse/sections/.exit.text new file mode 100644 index 0000000000..6922614c2a --- /dev/null +++ b/test/sys/module/fuse/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02493d0 diff --git a/test/sys/module/fuse/sections/.gnu.linkonce.this_module b/test/sys/module/fuse/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..25cb7caee6 --- /dev/null +++ b/test/sys/module/fuse/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa024df40 diff --git a/test/sys/module/fuse/sections/.init.text b/test/sys/module/fuse/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/fuse/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/fuse/sections/.note.gnu.build-id b/test/sys/module/fuse/sections/.note.gnu.build-id new file mode 100644 index 0000000000..4928d8130d --- /dev/null +++ b/test/sys/module/fuse/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0249414 diff --git a/test/sys/module/fuse/sections/.rodata b/test/sys/module/fuse/sections/.rodata new file mode 100644 index 0000000000..576e78361a --- /dev/null +++ b/test/sys/module/fuse/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0249440 diff --git a/test/sys/module/fuse/sections/.rodata.str1.1 b/test/sys/module/fuse/sections/.rodata.str1.1 new file mode 100644 index 0000000000..69a1232d7d --- /dev/null +++ b/test/sys/module/fuse/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0249e50 diff --git a/test/sys/module/fuse/sections/.smp_locks b/test/sys/module/fuse/sections/.smp_locks new file mode 100644 index 0000000000..c5007c706b --- /dev/null +++ b/test/sys/module/fuse/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa0249d78 diff --git a/test/sys/module/fuse/sections/.strtab b/test/sys/module/fuse/sections/.strtab new file mode 100644 index 0000000000..5d7eac3f8b --- /dev/null +++ b/test/sys/module/fuse/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa024c4e8 diff --git a/test/sys/module/fuse/sections/.symtab b/test/sys/module/fuse/sections/.symtab new file mode 100644 index 0000000000..6945615efa --- /dev/null +++ b/test/sys/module/fuse/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa024a208 diff --git a/test/sys/module/fuse/sections/.text b/test/sys/module/fuse/sections/.text new file mode 100644 index 0000000000..d4f50d42a8 --- /dev/null +++ b/test/sys/module/fuse/sections/.text @@ -0,0 +1 @@ +0xffffffffa0240000 diff --git a/test/sys/module/fuse/sections/__bug_table b/test/sys/module/fuse/sections/__bug_table new file mode 100644 index 0000000000..e83f9548fd --- /dev/null +++ b/test/sys/module/fuse/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa024a032 diff --git a/test/sys/module/fuse/srcversion b/test/sys/module/fuse/srcversion new file mode 100644 index 0000000000..c34beeac0e --- /dev/null +++ b/test/sys/module/fuse/srcversion @@ -0,0 +1 @@ +A6C92EE44A51B1B0DC4377D diff --git a/test/sys/module/hid/parameters/pb_fnmode b/test/sys/module/hid/parameters/pb_fnmode new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/hid/parameters/pb_fnmode @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/hwmon/holders/thinkpad_acpi b/test/sys/module/hwmon/holders/thinkpad_acpi new file mode 120000 index 0000000000..8d266ed087 --- /dev/null +++ b/test/sys/module/hwmon/holders/thinkpad_acpi @@ -0,0 +1 @@ +../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/hwmon/initstate b/test/sys/module/hwmon/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/hwmon/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/hwmon/notes/.note.gnu.build-id b/test/sys/module/hwmon/notes/.note.gnu.build-id new file mode 100644 index 0000000000..a38e58b6c7 Binary files /dev/null and b/test/sys/module/hwmon/notes/.note.gnu.build-id differ diff --git a/test/sys/module/hwmon/refcnt b/test/sys/module/hwmon/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/hwmon/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/hwmon/sections/.bss b/test/sys/module/hwmon/sections/.bss new file mode 100644 index 0000000000..c0ebac7b40 --- /dev/null +++ b/test/sys/module/hwmon/sections/.bss @@ -0,0 +1 @@ +0xffffffffa007de80 diff --git a/test/sys/module/hwmon/sections/.data b/test/sys/module/hwmon/sections/.data new file mode 100644 index 0000000000..7fa5d1d8b2 --- /dev/null +++ b/test/sys/module/hwmon/sections/.data @@ -0,0 +1 @@ +0xffffffffa007da20 diff --git a/test/sys/module/hwmon/sections/.exit.text b/test/sys/module/hwmon/sections/.exit.text new file mode 100644 index 0000000000..32b81419ba --- /dev/null +++ b/test/sys/module/hwmon/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa007d138 diff --git a/test/sys/module/hwmon/sections/.gnu.linkonce.this_module b/test/sys/module/hwmon/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..d54bf92164 --- /dev/null +++ b/test/sys/module/hwmon/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa007dac0 diff --git a/test/sys/module/hwmon/sections/.init.text b/test/sys/module/hwmon/sections/.init.text new file mode 100644 index 0000000000..0dbbf92722 --- /dev/null +++ b/test/sys/module/hwmon/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa009a000 diff --git a/test/sys/module/hwmon/sections/.note.gnu.build-id b/test/sys/module/hwmon/sections/.note.gnu.build-id new file mode 100644 index 0000000000..b626f19d67 --- /dev/null +++ b/test/sys/module/hwmon/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa007d14c diff --git a/test/sys/module/hwmon/sections/.rodata.str1.1 b/test/sys/module/hwmon/sections/.rodata.str1.1 new file mode 100644 index 0000000000..17da8b622c --- /dev/null +++ b/test/sys/module/hwmon/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa007d170 diff --git a/test/sys/module/hwmon/sections/.strtab b/test/sys/module/hwmon/sections/.strtab new file mode 100644 index 0000000000..a40baccfb9 --- /dev/null +++ b/test/sys/module/hwmon/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa007d770 diff --git a/test/sys/module/hwmon/sections/.symtab b/test/sys/module/hwmon/sections/.symtab new file mode 100644 index 0000000000..727fd07e07 --- /dev/null +++ b/test/sys/module/hwmon/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa007d230 diff --git a/test/sys/module/hwmon/sections/.text b/test/sys/module/hwmon/sections/.text new file mode 100644 index 0000000000..3e03f3c0fc --- /dev/null +++ b/test/sys/module/hwmon/sections/.text @@ -0,0 +1 @@ +0xffffffffa007d000 diff --git a/test/sys/module/hwmon/sections/__kcrctab_gpl b/test/sys/module/hwmon/sections/__kcrctab_gpl new file mode 100644 index 0000000000..96d7f65879 --- /dev/null +++ b/test/sys/module/hwmon/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa007d1f0 diff --git a/test/sys/module/hwmon/sections/__ksymtab_gpl b/test/sys/module/hwmon/sections/__ksymtab_gpl new file mode 100644 index 0000000000..800d572d3e --- /dev/null +++ b/test/sys/module/hwmon/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa007d1d0 diff --git a/test/sys/module/hwmon/sections/__ksymtab_strings b/test/sys/module/hwmon/sections/__ksymtab_strings new file mode 100644 index 0000000000..856d50af2f --- /dev/null +++ b/test/sys/module/hwmon/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa007d200 diff --git a/test/sys/module/hwmon/srcversion b/test/sys/module/hwmon/srcversion new file mode 100644 index 0000000000..4b0cd9206a --- /dev/null +++ b/test/sys/module/hwmon/srcversion @@ -0,0 +1 @@ +9344A0FAA4A298DC9AEBDC8 diff --git a/test/sys/module/i8042/parameters/debug b/test/sys/module/i8042/parameters/debug new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/i8042/parameters/debug @@ -0,0 +1 @@ +N diff --git a/test/sys/module/i8042/parameters/panicblink b/test/sys/module/i8042/parameters/panicblink new file mode 100644 index 0000000000..1b79f38e25 --- /dev/null +++ b/test/sys/module/i8042/parameters/panicblink @@ -0,0 +1 @@ +500 diff --git a/test/sys/module/intel_agp/drivers/pci:agpgart-intel b/test/sys/module/intel_agp/drivers/pci:agpgart-intel new file mode 120000 index 0000000000..cbef79a6d7 --- /dev/null +++ b/test/sys/module/intel_agp/drivers/pci:agpgart-intel @@ -0,0 +1 @@ +../../../bus/pci/drivers/agpgart-intel \ No newline at end of file diff --git a/test/sys/module/intel_agp/initstate b/test/sys/module/intel_agp/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/intel_agp/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/intel_agp/notes/.note.gnu.build-id b/test/sys/module/intel_agp/notes/.note.gnu.build-id new file mode 100644 index 0000000000..6749c13ef5 Binary files /dev/null and b/test/sys/module/intel_agp/notes/.note.gnu.build-id differ diff --git a/test/sys/module/intel_agp/refcnt b/test/sys/module/intel_agp/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/intel_agp/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/intel_agp/sections/.bss b/test/sys/module/intel_agp/sections/.bss new file mode 100644 index 0000000000..dc2280e1d4 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.bss @@ -0,0 +1 @@ +0xffffffffa008da00 diff --git a/test/sys/module/intel_agp/sections/.data b/test/sys/module/intel_agp/sections/.data new file mode 100644 index 0000000000..a94eb61f73 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.data @@ -0,0 +1 @@ +0xffffffffa008cf60 diff --git a/test/sys/module/intel_agp/sections/.devexit.text b/test/sys/module/intel_agp/sections/.devexit.text new file mode 100644 index 0000000000..1d152abfab --- /dev/null +++ b/test/sys/module/intel_agp/sections/.devexit.text @@ -0,0 +1 @@ +0xffffffffa00893be diff --git a/test/sys/module/intel_agp/sections/.devinit.text b/test/sys/module/intel_agp/sections/.devinit.text new file mode 100644 index 0000000000..b0ddc821b8 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.devinit.text @@ -0,0 +1 @@ +0xffffffffa0089400 diff --git a/test/sys/module/intel_agp/sections/.exit.text b/test/sys/module/intel_agp/sections/.exit.text new file mode 100644 index 0000000000..c671ffc626 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00893ac diff --git a/test/sys/module/intel_agp/sections/.gnu.linkonce.this_module b/test/sys/module/intel_agp/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..4016aceb93 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa008d640 diff --git a/test/sys/module/intel_agp/sections/.init.text b/test/sys/module/intel_agp/sections/.init.text new file mode 100644 index 0000000000..069d70cd89 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa008f000 diff --git a/test/sys/module/intel_agp/sections/.note.gnu.build-id b/test/sys/module/intel_agp/sections/.note.gnu.build-id new file mode 100644 index 0000000000..841176ca5e --- /dev/null +++ b/test/sys/module/intel_agp/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00896b0 diff --git a/test/sys/module/intel_agp/sections/.rodata b/test/sys/module/intel_agp/sections/.rodata new file mode 100644 index 0000000000..e3c6c6ba08 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00896e0 diff --git a/test/sys/module/intel_agp/sections/.rodata.str1.1 b/test/sys/module/intel_agp/sections/.rodata.str1.1 new file mode 100644 index 0000000000..0671f686e3 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa008a9c0 diff --git a/test/sys/module/intel_agp/sections/.smp_locks b/test/sys/module/intel_agp/sections/.smp_locks new file mode 100644 index 0000000000..ac049eebe8 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa008ae38 diff --git a/test/sys/module/intel_agp/sections/.strtab b/test/sys/module/intel_agp/sections/.strtab new file mode 100644 index 0000000000..b61f96d96b --- /dev/null +++ b/test/sys/module/intel_agp/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa008c1b8 diff --git a/test/sys/module/intel_agp/sections/.symtab b/test/sys/module/intel_agp/sections/.symtab new file mode 100644 index 0000000000..2f3af25557 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa008ae50 diff --git a/test/sys/module/intel_agp/sections/.text b/test/sys/module/intel_agp/sections/.text new file mode 100644 index 0000000000..45ee43be92 --- /dev/null +++ b/test/sys/module/intel_agp/sections/.text @@ -0,0 +1 @@ +0xffffffffa0086000 diff --git a/test/sys/module/intel_agp/srcversion b/test/sys/module/intel_agp/srcversion new file mode 100644 index 0000000000..bb6ea3579b --- /dev/null +++ b/test/sys/module/intel_agp/srcversion @@ -0,0 +1 @@ +98AFACFFF6A1ADC3A6FAB67 diff --git a/test/sys/module/ipv6/initstate b/test/sys/module/ipv6/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/ipv6/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/ipv6/notes/.note.gnu.build-id b/test/sys/module/ipv6/notes/.note.gnu.build-id new file mode 100644 index 0000000000..4ce3f748dd Binary files /dev/null and b/test/sys/module/ipv6/notes/.note.gnu.build-id differ diff --git a/test/sys/module/ipv6/refcnt b/test/sys/module/ipv6/refcnt new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/module/ipv6/refcnt @@ -0,0 +1 @@ +10 diff --git a/test/sys/module/ipv6/sections/.bss b/test/sys/module/ipv6/sections/.bss new file mode 100644 index 0000000000..c4b6fde2cb --- /dev/null +++ b/test/sys/module/ipv6/sections/.bss @@ -0,0 +1 @@ +0xffffffffa029dd80 diff --git a/test/sys/module/ipv6/sections/.data b/test/sys/module/ipv6/sections/.data new file mode 100644 index 0000000000..e0c1eba38d --- /dev/null +++ b/test/sys/module/ipv6/sections/.data @@ -0,0 +1 @@ +0xffffffffa02998c0 diff --git a/test/sys/module/ipv6/sections/.data.read_mostly b/test/sys/module/ipv6/sections/.data.read_mostly new file mode 100644 index 0000000000..ab79595de9 --- /dev/null +++ b/test/sys/module/ipv6/sections/.data.read_mostly @@ -0,0 +1 @@ +0xffffffffa029cf20 diff --git a/test/sys/module/ipv6/sections/.exit.text b/test/sys/module/ipv6/sections/.exit.text new file mode 100644 index 0000000000..4670322937 --- /dev/null +++ b/test/sys/module/ipv6/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0285e40 diff --git a/test/sys/module/ipv6/sections/.gnu.linkonce.this_module b/test/sys/module/ipv6/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..d849101f52 --- /dev/null +++ b/test/sys/module/ipv6/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa029d9c0 diff --git a/test/sys/module/ipv6/sections/.init.data b/test/sys/module/ipv6/sections/.init.data new file mode 100644 index 0000000000..f94b25b538 --- /dev/null +++ b/test/sys/module/ipv6/sections/.init.data @@ -0,0 +1 @@ +0xffffffffa0065d80 diff --git a/test/sys/module/ipv6/sections/.init.text b/test/sys/module/ipv6/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/ipv6/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/ipv6/sections/.note.gnu.build-id b/test/sys/module/ipv6/sections/.note.gnu.build-id new file mode 100644 index 0000000000..3858876a3b --- /dev/null +++ b/test/sys/module/ipv6/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0286024 diff --git a/test/sys/module/ipv6/sections/.ref.text b/test/sys/module/ipv6/sections/.ref.text new file mode 100644 index 0000000000..4b859f70de --- /dev/null +++ b/test/sys/module/ipv6/sections/.ref.text @@ -0,0 +1 @@ +0xffffffffa0285f40 diff --git a/test/sys/module/ipv6/sections/.rodata b/test/sys/module/ipv6/sections/.rodata new file mode 100644 index 0000000000..45747aea98 --- /dev/null +++ b/test/sys/module/ipv6/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0286060 diff --git a/test/sys/module/ipv6/sections/.rodata.str1.1 b/test/sys/module/ipv6/sections/.rodata.str1.1 new file mode 100644 index 0000000000..c25ecc816c --- /dev/null +++ b/test/sys/module/ipv6/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa02883c0 diff --git a/test/sys/module/ipv6/sections/.smp_locks b/test/sys/module/ipv6/sections/.smp_locks new file mode 100644 index 0000000000..774f500387 --- /dev/null +++ b/test/sys/module/ipv6/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa028a240 diff --git a/test/sys/module/ipv6/sections/.strtab b/test/sys/module/ipv6/sections/.strtab new file mode 100644 index 0000000000..9cbbb6811e --- /dev/null +++ b/test/sys/module/ipv6/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02937f0 diff --git a/test/sys/module/ipv6/sections/.symtab b/test/sys/module/ipv6/sections/.symtab new file mode 100644 index 0000000000..8a7abea9b5 --- /dev/null +++ b/test/sys/module/ipv6/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa028b4c8 diff --git a/test/sys/module/ipv6/sections/.text b/test/sys/module/ipv6/sections/.text new file mode 100644 index 0000000000..69bc4b5ea5 --- /dev/null +++ b/test/sys/module/ipv6/sections/.text @@ -0,0 +1 @@ +0xffffffffa0258000 diff --git a/test/sys/module/ipv6/sections/__bug_table b/test/sys/module/ipv6/sections/__bug_table new file mode 100644 index 0000000000..653607e5b3 --- /dev/null +++ b/test/sys/module/ipv6/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa0288edd diff --git a/test/sys/module/ipv6/sections/__kcrctab b/test/sys/module/ipv6/sections/__kcrctab new file mode 100644 index 0000000000..ab936c8d19 --- /dev/null +++ b/test/sys/module/ipv6/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa028afe0 diff --git a/test/sys/module/ipv6/sections/__kcrctab_gpl b/test/sys/module/ipv6/sections/__kcrctab_gpl new file mode 100644 index 0000000000..e924548943 --- /dev/null +++ b/test/sys/module/ipv6/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa028ad10 diff --git a/test/sys/module/ipv6/sections/__ksymtab b/test/sys/module/ipv6/sections/__ksymtab new file mode 100644 index 0000000000..f3dc04a1b8 --- /dev/null +++ b/test/sys/module/ipv6/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa028ad90 diff --git a/test/sys/module/ipv6/sections/__ksymtab_gpl b/test/sys/module/ipv6/sections/__ksymtab_gpl new file mode 100644 index 0000000000..82fc89364e --- /dev/null +++ b/test/sys/module/ipv6/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa028ac10 diff --git a/test/sys/module/ipv6/sections/__ksymtab_strings b/test/sys/module/ipv6/sections/__ksymtab_strings new file mode 100644 index 0000000000..c569e8609d --- /dev/null +++ b/test/sys/module/ipv6/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa028b108 diff --git a/test/sys/module/ipv6/srcversion b/test/sys/module/ipv6/srcversion new file mode 100644 index 0000000000..d1b9b911f3 --- /dev/null +++ b/test/sys/module/ipv6/srcversion @@ -0,0 +1 @@ +184C844E7A78529619B4C9D diff --git a/test/sys/module/iwl3945/drivers/pci:iwl3945 b/test/sys/module/iwl3945/drivers/pci:iwl3945 new file mode 120000 index 0000000000..d875969343 --- /dev/null +++ b/test/sys/module/iwl3945/drivers/pci:iwl3945 @@ -0,0 +1 @@ +../../../bus/pci/drivers/iwl3945 \ No newline at end of file diff --git a/test/sys/module/iwl3945/initstate b/test/sys/module/iwl3945/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/iwl3945/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/iwl3945/notes/.note.gnu.build-id b/test/sys/module/iwl3945/notes/.note.gnu.build-id new file mode 100644 index 0000000000..5ba8fb360f Binary files /dev/null and b/test/sys/module/iwl3945/notes/.note.gnu.build-id differ diff --git a/test/sys/module/iwl3945/parameters/antenna b/test/sys/module/iwl3945/parameters/antenna new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/iwl3945/parameters/antenna @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/iwl3945/parameters/debug b/test/sys/module/iwl3945/parameters/debug new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/iwl3945/parameters/debug @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/iwl3945/parameters/disable b/test/sys/module/iwl3945/parameters/disable new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/iwl3945/parameters/disable @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/iwl3945/parameters/disable_hw_scan b/test/sys/module/iwl3945/parameters/disable_hw_scan new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/iwl3945/parameters/disable_hw_scan @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/iwl3945/parameters/hwcrypto b/test/sys/module/iwl3945/parameters/hwcrypto new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/iwl3945/parameters/hwcrypto @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/iwl3945/parameters/qos_enable b/test/sys/module/iwl3945/parameters/qos_enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/iwl3945/parameters/qos_enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/iwl3945/parameters/queues_num b/test/sys/module/iwl3945/parameters/queues_num new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/module/iwl3945/parameters/queues_num @@ -0,0 +1 @@ +8 diff --git a/test/sys/module/iwl3945/refcnt b/test/sys/module/iwl3945/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/iwl3945/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/iwl3945/sections/.bss b/test/sys/module/iwl3945/sections/.bss new file mode 100644 index 0000000000..f83abbaa1a --- /dev/null +++ b/test/sys/module/iwl3945/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0163d80 diff --git a/test/sys/module/iwl3945/sections/.data b/test/sys/module/iwl3945/sections/.data new file mode 100644 index 0000000000..fa8158b32b --- /dev/null +++ b/test/sys/module/iwl3945/sections/.data @@ -0,0 +1 @@ +0xffffffffa0162f00 diff --git a/test/sys/module/iwl3945/sections/.devexit.text b/test/sys/module/iwl3945/sections/.devexit.text new file mode 100644 index 0000000000..1b534d0daf --- /dev/null +++ b/test/sys/module/iwl3945/sections/.devexit.text @@ -0,0 +1 @@ +0xffffffffa015b044 diff --git a/test/sys/module/iwl3945/sections/.exit.text b/test/sys/module/iwl3945/sections/.exit.text new file mode 100644 index 0000000000..f86e36cc47 --- /dev/null +++ b/test/sys/module/iwl3945/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa015b2e4 diff --git a/test/sys/module/iwl3945/sections/.gnu.linkonce.this_module b/test/sys/module/iwl3945/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..7fa3eea359 --- /dev/null +++ b/test/sys/module/iwl3945/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa01639c0 diff --git a/test/sys/module/iwl3945/sections/.init.text b/test/sys/module/iwl3945/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/iwl3945/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/iwl3945/sections/.note.gnu.build-id b/test/sys/module/iwl3945/sections/.note.gnu.build-id new file mode 100644 index 0000000000..fb204740fb --- /dev/null +++ b/test/sys/module/iwl3945/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa015b2fc diff --git a/test/sys/module/iwl3945/sections/.rodata b/test/sys/module/iwl3945/sections/.rodata new file mode 100644 index 0000000000..b743f277c9 --- /dev/null +++ b/test/sys/module/iwl3945/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa015b320 diff --git a/test/sys/module/iwl3945/sections/.rodata.str1.1 b/test/sys/module/iwl3945/sections/.rodata.str1.1 new file mode 100644 index 0000000000..4c197a468a --- /dev/null +++ b/test/sys/module/iwl3945/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa015bc0c diff --git a/test/sys/module/iwl3945/sections/.smp_locks b/test/sys/module/iwl3945/sections/.smp_locks new file mode 100644 index 0000000000..5925c17427 --- /dev/null +++ b/test/sys/module/iwl3945/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa015e0e0 diff --git a/test/sys/module/iwl3945/sections/.strtab b/test/sys/module/iwl3945/sections/.strtab new file mode 100644 index 0000000000..3258a71020 --- /dev/null +++ b/test/sys/module/iwl3945/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0160f20 diff --git a/test/sys/module/iwl3945/sections/.symtab b/test/sys/module/iwl3945/sections/.symtab new file mode 100644 index 0000000000..c801241c5a --- /dev/null +++ b/test/sys/module/iwl3945/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa015e5c8 diff --git a/test/sys/module/iwl3945/sections/.text b/test/sys/module/iwl3945/sections/.text new file mode 100644 index 0000000000..0902a848df --- /dev/null +++ b/test/sys/module/iwl3945/sections/.text @@ -0,0 +1 @@ +0xffffffffa014b000 diff --git a/test/sys/module/iwl3945/sections/__bug_table b/test/sys/module/iwl3945/sections/__bug_table new file mode 100644 index 0000000000..5c5c354c62 --- /dev/null +++ b/test/sys/module/iwl3945/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa015e300 diff --git a/test/sys/module/iwl3945/sections/__param b/test/sys/module/iwl3945/sections/__param new file mode 100644 index 0000000000..0112cec232 --- /dev/null +++ b/test/sys/module/iwl3945/sections/__param @@ -0,0 +1 @@ +0xffffffffa015e4b0 diff --git a/test/sys/module/iwl3945/srcversion b/test/sys/module/iwl3945/srcversion new file mode 100644 index 0000000000..fa65dc4968 --- /dev/null +++ b/test/sys/module/iwl3945/srcversion @@ -0,0 +1 @@ +5C079549ABD48E07B20F3C7 diff --git a/test/sys/module/iwl3945/version b/test/sys/module/iwl3945/version new file mode 100644 index 0000000000..eda05bc452 --- /dev/null +++ b/test/sys/module/iwl3945/version @@ -0,0 +1 @@ +1.2.26ks diff --git a/test/sys/module/keyboard/parameters/brl_nbchords b/test/sys/module/keyboard/parameters/brl_nbchords new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/keyboard/parameters/brl_nbchords @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/keyboard/parameters/brl_timeout b/test/sys/module/keyboard/parameters/brl_timeout new file mode 100644 index 0000000000..697cb3a26d --- /dev/null +++ b/test/sys/module/keyboard/parameters/brl_timeout @@ -0,0 +1 @@ +300 diff --git a/test/sys/module/led_class/holders/iwl3945 b/test/sys/module/led_class/holders/iwl3945 new file mode 120000 index 0000000000..31cc83c4cc --- /dev/null +++ b/test/sys/module/led_class/holders/iwl3945 @@ -0,0 +1 @@ +../../iwl3945 \ No newline at end of file diff --git a/test/sys/module/led_class/holders/thinkpad_acpi b/test/sys/module/led_class/holders/thinkpad_acpi new file mode 120000 index 0000000000..8d266ed087 --- /dev/null +++ b/test/sys/module/led_class/holders/thinkpad_acpi @@ -0,0 +1 @@ +../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/led_class/initstate b/test/sys/module/led_class/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/led_class/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/led_class/notes/.note.gnu.build-id b/test/sys/module/led_class/notes/.note.gnu.build-id new file mode 100644 index 0000000000..38e15f4ad5 Binary files /dev/null and b/test/sys/module/led_class/notes/.note.gnu.build-id differ diff --git a/test/sys/module/led_class/refcnt b/test/sys/module/led_class/refcnt new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/led_class/refcnt @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/led_class/sections/.bss b/test/sys/module/led_class/sections/.bss new file mode 100644 index 0000000000..2f7d3816f0 --- /dev/null +++ b/test/sys/module/led_class/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00f3500 diff --git a/test/sys/module/led_class/sections/.data b/test/sys/module/led_class/sections/.data new file mode 100644 index 0000000000..2ddd1e3eef --- /dev/null +++ b/test/sys/module/led_class/sections/.data @@ -0,0 +1 @@ +0xffffffffa00f30c0 diff --git a/test/sys/module/led_class/sections/.exit.text b/test/sys/module/led_class/sections/.exit.text new file mode 100644 index 0000000000..03d8ca7408 --- /dev/null +++ b/test/sys/module/led_class/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00f2330 diff --git a/test/sys/module/led_class/sections/.gnu.linkonce.this_module b/test/sys/module/led_class/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..5a7036ff71 --- /dev/null +++ b/test/sys/module/led_class/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00f3140 diff --git a/test/sys/module/led_class/sections/.init.text b/test/sys/module/led_class/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/led_class/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/led_class/sections/.note.gnu.build-id b/test/sys/module/led_class/sections/.note.gnu.build-id new file mode 100644 index 0000000000..ed2c2c10b3 --- /dev/null +++ b/test/sys/module/led_class/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00f2344 diff --git a/test/sys/module/led_class/sections/.rodata.str1.1 b/test/sys/module/led_class/sections/.rodata.str1.1 new file mode 100644 index 0000000000..e5f9d5f59d --- /dev/null +++ b/test/sys/module/led_class/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00f2368 diff --git a/test/sys/module/led_class/sections/.strtab b/test/sys/module/led_class/sections/.strtab new file mode 100644 index 0000000000..7ea490f1b1 --- /dev/null +++ b/test/sys/module/led_class/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00f2bf8 diff --git a/test/sys/module/led_class/sections/.symtab b/test/sys/module/led_class/sections/.symtab new file mode 100644 index 0000000000..0cb7be4ca6 --- /dev/null +++ b/test/sys/module/led_class/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00f2478 diff --git a/test/sys/module/led_class/sections/.text b/test/sys/module/led_class/sections/.text new file mode 100644 index 0000000000..167debf340 --- /dev/null +++ b/test/sys/module/led_class/sections/.text @@ -0,0 +1 @@ +0xffffffffa00f2000 diff --git a/test/sys/module/led_class/sections/__kcrctab_gpl b/test/sys/module/led_class/sections/__kcrctab_gpl new file mode 100644 index 0000000000..8119e7f283 --- /dev/null +++ b/test/sys/module/led_class/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa00f2400 diff --git a/test/sys/module/led_class/sections/__ksymtab_gpl b/test/sys/module/led_class/sections/__ksymtab_gpl new file mode 100644 index 0000000000..dbd2e57e11 --- /dev/null +++ b/test/sys/module/led_class/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa00f23c0 diff --git a/test/sys/module/led_class/sections/__ksymtab_strings b/test/sys/module/led_class/sections/__ksymtab_strings new file mode 100644 index 0000000000..272942720a --- /dev/null +++ b/test/sys/module/led_class/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa00f2420 diff --git a/test/sys/module/led_class/srcversion b/test/sys/module/led_class/srcversion new file mode 100644 index 0000000000..41de285dc7 --- /dev/null +++ b/test/sys/module/led_class/srcversion @@ -0,0 +1 @@ +B916A50F53ABBBB19DFF203 diff --git a/test/sys/module/libata/parameters/acpi_gtf_filter b/test/sys/module/libata/parameters/acpi_gtf_filter new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/module/libata/parameters/acpi_gtf_filter @@ -0,0 +1 @@ +7 diff --git a/test/sys/module/libata/parameters/allow_tpm b/test/sys/module/libata/parameters/allow_tpm new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/libata/parameters/allow_tpm @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/libata/parameters/ata_probe_timeout b/test/sys/module/libata/parameters/ata_probe_timeout new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/libata/parameters/ata_probe_timeout @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/libata/parameters/atapi_dmadir b/test/sys/module/libata/parameters/atapi_dmadir new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/libata/parameters/atapi_dmadir @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/libata/parameters/atapi_enabled b/test/sys/module/libata/parameters/atapi_enabled new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/libata/parameters/atapi_enabled @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/libata/parameters/atapi_passthru16 b/test/sys/module/libata/parameters/atapi_passthru16 new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/libata/parameters/atapi_passthru16 @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/libata/parameters/dma b/test/sys/module/libata/parameters/dma new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/module/libata/parameters/dma @@ -0,0 +1 @@ +7 diff --git a/test/sys/module/libata/parameters/fua b/test/sys/module/libata/parameters/fua new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/libata/parameters/fua @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/libata/parameters/ignore_hpa b/test/sys/module/libata/parameters/ignore_hpa new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/libata/parameters/ignore_hpa @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/libata/parameters/noacpi b/test/sys/module/libata/parameters/noacpi new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/libata/parameters/noacpi @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/lockdep/parameters/lock_stat b/test/sys/module/lockdep/parameters/lock_stat new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/lockdep/parameters/lock_stat @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/loop/initstate b/test/sys/module/loop/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/loop/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/loop/notes/.note.gnu.build-id b/test/sys/module/loop/notes/.note.gnu.build-id new file mode 100644 index 0000000000..49e1d58097 Binary files /dev/null and b/test/sys/module/loop/notes/.note.gnu.build-id differ diff --git a/test/sys/module/loop/refcnt b/test/sys/module/loop/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/loop/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/loop/sections/.bss b/test/sys/module/loop/sections/.bss new file mode 100644 index 0000000000..083b73e1df --- /dev/null +++ b/test/sys/module/loop/sections/.bss @@ -0,0 +1 @@ +0xffffffffa023e780 diff --git a/test/sys/module/loop/sections/.data b/test/sys/module/loop/sections/.data new file mode 100644 index 0000000000..af5113091b --- /dev/null +++ b/test/sys/module/loop/sections/.data @@ -0,0 +1 @@ +0xffffffffa023e180 diff --git a/test/sys/module/loop/sections/.exit.text b/test/sys/module/loop/sections/.exit.text new file mode 100644 index 0000000000..ada33c7e63 --- /dev/null +++ b/test/sys/module/loop/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa023c72c diff --git a/test/sys/module/loop/sections/.gnu.linkonce.this_module b/test/sys/module/loop/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..6b4f79dc6b --- /dev/null +++ b/test/sys/module/loop/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa023e3c0 diff --git a/test/sys/module/loop/sections/.init.text b/test/sys/module/loop/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/loop/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/loop/sections/.note.gnu.build-id b/test/sys/module/loop/sections/.note.gnu.build-id new file mode 100644 index 0000000000..88525dc457 --- /dev/null +++ b/test/sys/module/loop/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa023c7e4 diff --git a/test/sys/module/loop/sections/.rodata b/test/sys/module/loop/sections/.rodata new file mode 100644 index 0000000000..d4b2e98c28 --- /dev/null +++ b/test/sys/module/loop/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa023c808 diff --git a/test/sys/module/loop/sections/.rodata.str1.1 b/test/sys/module/loop/sections/.rodata.str1.1 new file mode 100644 index 0000000000..6e26c0cd0c --- /dev/null +++ b/test/sys/module/loop/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa023c88a diff --git a/test/sys/module/loop/sections/.strtab b/test/sys/module/loop/sections/.strtab new file mode 100644 index 0000000000..0dfdf48cce --- /dev/null +++ b/test/sys/module/loop/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa023d960 diff --git a/test/sys/module/loop/sections/.symtab b/test/sys/module/loop/sections/.symtab new file mode 100644 index 0000000000..319270eb37 --- /dev/null +++ b/test/sys/module/loop/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa023cb20 diff --git a/test/sys/module/loop/sections/.text b/test/sys/module/loop/sections/.text new file mode 100644 index 0000000000..15b9c3b142 --- /dev/null +++ b/test/sys/module/loop/sections/.text @@ -0,0 +1 @@ +0xffffffffa023a000 diff --git a/test/sys/module/loop/sections/__bug_table b/test/sys/module/loop/sections/__bug_table new file mode 100644 index 0000000000..7527265e79 --- /dev/null +++ b/test/sys/module/loop/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa023ca1f diff --git a/test/sys/module/loop/sections/__kcrctab b/test/sys/module/loop/sections/__kcrctab new file mode 100644 index 0000000000..e30b4aaed2 --- /dev/null +++ b/test/sys/module/loop/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa023ca90 diff --git a/test/sys/module/loop/sections/__ksymtab b/test/sys/module/loop/sections/__ksymtab new file mode 100644 index 0000000000..4e5ddf35ce --- /dev/null +++ b/test/sys/module/loop/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa023ca70 diff --git a/test/sys/module/loop/sections/__ksymtab_strings b/test/sys/module/loop/sections/__ksymtab_strings new file mode 100644 index 0000000000..c7ae548fcd --- /dev/null +++ b/test/sys/module/loop/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa023caf0 diff --git a/test/sys/module/loop/sections/__param b/test/sys/module/loop/sections/__param new file mode 100644 index 0000000000..0eeb89ac48 --- /dev/null +++ b/test/sys/module/loop/sections/__param @@ -0,0 +1 @@ +0xffffffffa023caa0 diff --git a/test/sys/module/loop/srcversion b/test/sys/module/loop/srcversion new file mode 100644 index 0000000000..07627a9e2c --- /dev/null +++ b/test/sys/module/loop/srcversion @@ -0,0 +1 @@ +7595F5D46DFDB4A2D489DDD diff --git a/test/sys/module/mac80211/holders/iwl3945 b/test/sys/module/mac80211/holders/iwl3945 new file mode 120000 index 0000000000..31cc83c4cc --- /dev/null +++ b/test/sys/module/mac80211/holders/iwl3945 @@ -0,0 +1 @@ +../../iwl3945 \ No newline at end of file diff --git a/test/sys/module/mac80211/initstate b/test/sys/module/mac80211/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/mac80211/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/mac80211/notes/.note.gnu.build-id b/test/sys/module/mac80211/notes/.note.gnu.build-id new file mode 100644 index 0000000000..abdec04aed Binary files /dev/null and b/test/sys/module/mac80211/notes/.note.gnu.build-id differ diff --git a/test/sys/module/mac80211/parameters/ieee80211_default_rc_algo b/test/sys/module/mac80211/parameters/ieee80211_default_rc_algo new file mode 100644 index 0000000000..7fe681d267 --- /dev/null +++ b/test/sys/module/mac80211/parameters/ieee80211_default_rc_algo @@ -0,0 +1 @@ +pid diff --git a/test/sys/module/mac80211/refcnt b/test/sys/module/mac80211/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/mac80211/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/mac80211/sections/.bss b/test/sys/module/mac80211/sections/.bss new file mode 100644 index 0000000000..37fb900c52 --- /dev/null +++ b/test/sys/module/mac80211/sections/.bss @@ -0,0 +1 @@ +0xffffffffa012fa40 diff --git a/test/sys/module/mac80211/sections/.data b/test/sys/module/mac80211/sections/.data new file mode 100644 index 0000000000..99e1579bf4 --- /dev/null +++ b/test/sys/module/mac80211/sections/.data @@ -0,0 +1 @@ +0xffffffffa012f340 diff --git a/test/sys/module/mac80211/sections/.exit.text b/test/sys/module/mac80211/sections/.exit.text new file mode 100644 index 0000000000..5ea5e85790 --- /dev/null +++ b/test/sys/module/mac80211/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0122de4 diff --git a/test/sys/module/mac80211/sections/.gnu.linkonce.this_module b/test/sys/module/mac80211/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..01498bacc2 --- /dev/null +++ b/test/sys/module/mac80211/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa012f680 diff --git a/test/sys/module/mac80211/sections/.init.text b/test/sys/module/mac80211/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/mac80211/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/mac80211/sections/.note.gnu.build-id b/test/sys/module/mac80211/sections/.note.gnu.build-id new file mode 100644 index 0000000000..45182d7f2b --- /dev/null +++ b/test/sys/module/mac80211/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0122df4 diff --git a/test/sys/module/mac80211/sections/.rodata b/test/sys/module/mac80211/sections/.rodata new file mode 100644 index 0000000000..2fbabf002d --- /dev/null +++ b/test/sys/module/mac80211/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0122e20 diff --git a/test/sys/module/mac80211/sections/.rodata.str1.1 b/test/sys/module/mac80211/sections/.rodata.str1.1 new file mode 100644 index 0000000000..71a1c8e248 --- /dev/null +++ b/test/sys/module/mac80211/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0123c40 diff --git a/test/sys/module/mac80211/sections/.smp_locks b/test/sys/module/mac80211/sections/.smp_locks new file mode 100644 index 0000000000..45d9d8ab8a --- /dev/null +++ b/test/sys/module/mac80211/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa01270a0 diff --git a/test/sys/module/mac80211/sections/.strtab b/test/sys/module/mac80211/sections/.strtab new file mode 100644 index 0000000000..9d3adbc950 --- /dev/null +++ b/test/sys/module/mac80211/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa012b890 diff --git a/test/sys/module/mac80211/sections/.symtab b/test/sys/module/mac80211/sections/.symtab new file mode 100644 index 0000000000..954a225786 --- /dev/null +++ b/test/sys/module/mac80211/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0127a80 diff --git a/test/sys/module/mac80211/sections/.text b/test/sys/module/mac80211/sections/.text new file mode 100644 index 0000000000..a9e219d005 --- /dev/null +++ b/test/sys/module/mac80211/sections/.text @@ -0,0 +1 @@ +0xffffffffa0109000 diff --git a/test/sys/module/mac80211/sections/__bug_table b/test/sys/module/mac80211/sections/__bug_table new file mode 100644 index 0000000000..8d4014267f --- /dev/null +++ b/test/sys/module/mac80211/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa0124183 diff --git a/test/sys/module/mac80211/sections/__kcrctab b/test/sys/module/mac80211/sections/__kcrctab new file mode 100644 index 0000000000..56c148953d --- /dev/null +++ b/test/sys/module/mac80211/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa0127500 diff --git a/test/sys/module/mac80211/sections/__kcrctab_gpl b/test/sys/module/mac80211/sections/__kcrctab_gpl new file mode 100644 index 0000000000..a485275805 --- /dev/null +++ b/test/sys/module/mac80211/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa0127a70 diff --git a/test/sys/module/mac80211/sections/__ksymtab b/test/sys/module/mac80211/sections/__ksymtab new file mode 100644 index 0000000000..967c679208 --- /dev/null +++ b/test/sys/module/mac80211/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa01272a0 diff --git a/test/sys/module/mac80211/sections/__ksymtab_gpl b/test/sys/module/mac80211/sections/__ksymtab_gpl new file mode 100644 index 0000000000..e9bcf7e136 --- /dev/null +++ b/test/sys/module/mac80211/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa0127a50 diff --git a/test/sys/module/mac80211/sections/__ksymtab_strings b/test/sys/module/mac80211/sections/__ksymtab_strings new file mode 100644 index 0000000000..e79e4cece9 --- /dev/null +++ b/test/sys/module/mac80211/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa0127630 diff --git a/test/sys/module/mac80211/sections/__param b/test/sys/module/mac80211/sections/__param new file mode 100644 index 0000000000..a214f0338b --- /dev/null +++ b/test/sys/module/mac80211/sections/__param @@ -0,0 +1 @@ +0xffffffffa0127a28 diff --git a/test/sys/module/mac80211/srcversion b/test/sys/module/mac80211/srcversion new file mode 100644 index 0000000000..a983e5dc22 --- /dev/null +++ b/test/sys/module/mac80211/srcversion @@ -0,0 +1 @@ +330E8FB2F2933F478C444A4 diff --git a/test/sys/module/md_mod/holders/raid1 b/test/sys/module/md_mod/holders/raid1 new file mode 120000 index 0000000000..3d6cc7abf7 --- /dev/null +++ b/test/sys/module/md_mod/holders/raid1 @@ -0,0 +1 @@ +../../raid1 \ No newline at end of file diff --git a/test/sys/module/md_mod/initstate b/test/sys/module/md_mod/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/md_mod/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/md_mod/notes/.note.gnu.build-id b/test/sys/module/md_mod/notes/.note.gnu.build-id new file mode 100644 index 0000000000..92df782a6e Binary files /dev/null and b/test/sys/module/md_mod/notes/.note.gnu.build-id differ diff --git a/test/sys/module/md_mod/parameters/start_dirty_degraded b/test/sys/module/md_mod/parameters/start_dirty_degraded new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/md_mod/parameters/start_dirty_degraded @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/md_mod/parameters/start_ro b/test/sys/module/md_mod/parameters/start_ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/md_mod/parameters/start_ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/md_mod/refcnt b/test/sys/module/md_mod/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/md_mod/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/md_mod/sections/.bss b/test/sys/module/md_mod/sections/.bss new file mode 100644 index 0000000000..a23f3ddb24 --- /dev/null +++ b/test/sys/module/md_mod/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0230880 diff --git a/test/sys/module/md_mod/sections/.data b/test/sys/module/md_mod/sections/.data new file mode 100644 index 0000000000..d134d15393 --- /dev/null +++ b/test/sys/module/md_mod/sections/.data @@ -0,0 +1 @@ +0xffffffffa022f660 diff --git a/test/sys/module/md_mod/sections/.exit.text b/test/sys/module/md_mod/sections/.exit.text new file mode 100644 index 0000000000..6fcd5caef3 --- /dev/null +++ b/test/sys/module/md_mod/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02283a0 diff --git a/test/sys/module/md_mod/sections/.gnu.linkonce.this_module b/test/sys/module/md_mod/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..7d622d1d1f --- /dev/null +++ b/test/sys/module/md_mod/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02304c0 diff --git a/test/sys/module/md_mod/sections/.init.text b/test/sys/module/md_mod/sections/.init.text new file mode 100644 index 0000000000..0cac0d19cf --- /dev/null +++ b/test/sys/module/md_mod/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0070000 diff --git a/test/sys/module/md_mod/sections/.note.gnu.build-id b/test/sys/module/md_mod/sections/.note.gnu.build-id new file mode 100644 index 0000000000..9a73ad54b1 --- /dev/null +++ b/test/sys/module/md_mod/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02284c8 diff --git a/test/sys/module/md_mod/sections/.rodata b/test/sys/module/md_mod/sections/.rodata new file mode 100644 index 0000000000..fcfe7a5ee3 --- /dev/null +++ b/test/sys/module/md_mod/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0228500 diff --git a/test/sys/module/md_mod/sections/.rodata.str1.1 b/test/sys/module/md_mod/sections/.rodata.str1.1 new file mode 100644 index 0000000000..1fc2b5e27d --- /dev/null +++ b/test/sys/module/md_mod/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa022869e diff --git a/test/sys/module/md_mod/sections/.smp_locks b/test/sys/module/md_mod/sections/.smp_locks new file mode 100644 index 0000000000..b413436291 --- /dev/null +++ b/test/sys/module/md_mod/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa022a038 diff --git a/test/sys/module/md_mod/sections/.strtab b/test/sys/module/md_mod/sections/.strtab new file mode 100644 index 0000000000..24caadad13 --- /dev/null +++ b/test/sys/module/md_mod/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa022d7a0 diff --git a/test/sys/module/md_mod/sections/.symtab b/test/sys/module/md_mod/sections/.symtab new file mode 100644 index 0000000000..8b7e2f881a --- /dev/null +++ b/test/sys/module/md_mod/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa022a968 diff --git a/test/sys/module/md_mod/sections/.text b/test/sys/module/md_mod/sections/.text new file mode 100644 index 0000000000..19761bcaf0 --- /dev/null +++ b/test/sys/module/md_mod/sections/.text @@ -0,0 +1 @@ +0xffffffffa021a000 diff --git a/test/sys/module/md_mod/sections/__bug_table b/test/sys/module/md_mod/sections/__bug_table new file mode 100644 index 0000000000..61bbfe3885 --- /dev/null +++ b/test/sys/module/md_mod/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa022a4b8 diff --git a/test/sys/module/md_mod/sections/__kcrctab b/test/sys/module/md_mod/sections/__kcrctab new file mode 100644 index 0000000000..b1d4d56888 --- /dev/null +++ b/test/sys/module/md_mod/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa022a6b0 diff --git a/test/sys/module/md_mod/sections/__kcrctab_gpl b/test/sys/module/md_mod/sections/__kcrctab_gpl new file mode 100644 index 0000000000..1f881cc61e --- /dev/null +++ b/test/sys/module/md_mod/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa022a7d0 diff --git a/test/sys/module/md_mod/sections/__ksymtab b/test/sys/module/md_mod/sections/__ksymtab new file mode 100644 index 0000000000..696610dbdd --- /dev/null +++ b/test/sys/module/md_mod/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa022a590 diff --git a/test/sys/module/md_mod/sections/__ksymtab_gpl b/test/sys/module/md_mod/sections/__ksymtab_gpl new file mode 100644 index 0000000000..3d6580a06f --- /dev/null +++ b/test/sys/module/md_mod/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa022a790 diff --git a/test/sys/module/md_mod/sections/__ksymtab_strings b/test/sys/module/md_mod/sections/__ksymtab_strings new file mode 100644 index 0000000000..2e544c8a8f --- /dev/null +++ b/test/sys/module/md_mod/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa022a7f0 diff --git a/test/sys/module/md_mod/sections/__param b/test/sys/module/md_mod/sections/__param new file mode 100644 index 0000000000..b7dc1d7b9a --- /dev/null +++ b/test/sys/module/md_mod/sections/__param @@ -0,0 +1 @@ +0xffffffffa022a740 diff --git a/test/sys/module/md_mod/srcversion b/test/sys/module/md_mod/srcversion new file mode 100644 index 0000000000..04620cd647 --- /dev/null +++ b/test/sys/module/md_mod/srcversion @@ -0,0 +1 @@ +1DB954BE8FA97D4755DC15B diff --git a/test/sys/module/microcode/initstate b/test/sys/module/microcode/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/microcode/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/microcode/notes/.note.gnu.build-id b/test/sys/module/microcode/notes/.note.gnu.build-id new file mode 100644 index 0000000000..e5d5c653ab Binary files /dev/null and b/test/sys/module/microcode/notes/.note.gnu.build-id differ diff --git a/test/sys/module/microcode/refcnt b/test/sys/module/microcode/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/microcode/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/microcode/sections/.bss b/test/sys/module/microcode/sections/.bss new file mode 100644 index 0000000000..14def56f03 --- /dev/null +++ b/test/sys/module/microcode/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0252c40 diff --git a/test/sys/module/microcode/sections/.cpuinit.text b/test/sys/module/microcode/sections/.cpuinit.text new file mode 100644 index 0000000000..7ade90a2bd --- /dev/null +++ b/test/sys/module/microcode/sections/.cpuinit.text @@ -0,0 +1 @@ +0xffffffffa0250d90 diff --git a/test/sys/module/microcode/sections/.data b/test/sys/module/microcode/sections/.data new file mode 100644 index 0000000000..e02c194aeb --- /dev/null +++ b/test/sys/module/microcode/sections/.data @@ -0,0 +1 @@ +0xffffffffa0252600 diff --git a/test/sys/module/microcode/sections/.exit.text b/test/sys/module/microcode/sections/.exit.text new file mode 100644 index 0000000000..6a80762e87 --- /dev/null +++ b/test/sys/module/microcode/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0250ff6 diff --git a/test/sys/module/microcode/sections/.gnu.linkonce.this_module b/test/sys/module/microcode/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..8976fa7b35 --- /dev/null +++ b/test/sys/module/microcode/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0252880 diff --git a/test/sys/module/microcode/sections/.init.text b/test/sys/module/microcode/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/microcode/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/microcode/sections/.note.gnu.build-id b/test/sys/module/microcode/sections/.note.gnu.build-id new file mode 100644 index 0000000000..2869215edf --- /dev/null +++ b/test/sys/module/microcode/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0251040 diff --git a/test/sys/module/microcode/sections/.ref.data b/test/sys/module/microcode/sections/.ref.data new file mode 100644 index 0000000000..3285f61b40 --- /dev/null +++ b/test/sys/module/microcode/sections/.ref.data @@ -0,0 +1 @@ +0xffffffffa0252850 diff --git a/test/sys/module/microcode/sections/.rodata b/test/sys/module/microcode/sections/.rodata new file mode 100644 index 0000000000..faa8a335f1 --- /dev/null +++ b/test/sys/module/microcode/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0251080 diff --git a/test/sys/module/microcode/sections/.rodata.str1.1 b/test/sys/module/microcode/sections/.rodata.str1.1 new file mode 100644 index 0000000000..83c30cf102 --- /dev/null +++ b/test/sys/module/microcode/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0251218 diff --git a/test/sys/module/microcode/sections/.strtab b/test/sys/module/microcode/sections/.strtab new file mode 100644 index 0000000000..f71a7c1531 --- /dev/null +++ b/test/sys/module/microcode/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02520b8 diff --git a/test/sys/module/microcode/sections/.symtab b/test/sys/module/microcode/sections/.symtab new file mode 100644 index 0000000000..9e581706c6 --- /dev/null +++ b/test/sys/module/microcode/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0251740 diff --git a/test/sys/module/microcode/sections/.text b/test/sys/module/microcode/sections/.text new file mode 100644 index 0000000000..3ea5399437 --- /dev/null +++ b/test/sys/module/microcode/sections/.text @@ -0,0 +1 @@ +0xffffffffa0250000 diff --git a/test/sys/module/microcode/sections/__bug_table b/test/sys/module/microcode/sections/__bug_table new file mode 100644 index 0000000000..1575c1d463 --- /dev/null +++ b/test/sys/module/microcode/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa02516f7 diff --git a/test/sys/module/microcode/srcversion b/test/sys/module/microcode/srcversion new file mode 100644 index 0000000000..f33e1688ca --- /dev/null +++ b/test/sys/module/microcode/srcversion @@ -0,0 +1 @@ +FC3DA13E858B639D12F2043 diff --git a/test/sys/module/mousedev/parameters/tap_time b/test/sys/module/mousedev/parameters/tap_time new file mode 100644 index 0000000000..08839f6bb2 --- /dev/null +++ b/test/sys/module/mousedev/parameters/tap_time @@ -0,0 +1 @@ +200 diff --git a/test/sys/module/mousedev/parameters/xres b/test/sys/module/mousedev/parameters/xres new file mode 100644 index 0000000000..d7b1c440c0 --- /dev/null +++ b/test/sys/module/mousedev/parameters/xres @@ -0,0 +1 @@ +1024 diff --git a/test/sys/module/mousedev/parameters/yres b/test/sys/module/mousedev/parameters/yres new file mode 100644 index 0000000000..dc763b654e --- /dev/null +++ b/test/sys/module/mousedev/parameters/yres @@ -0,0 +1 @@ +768 diff --git a/test/sys/module/nvram/holders/thinkpad_acpi b/test/sys/module/nvram/holders/thinkpad_acpi new file mode 120000 index 0000000000..8d266ed087 --- /dev/null +++ b/test/sys/module/nvram/holders/thinkpad_acpi @@ -0,0 +1 @@ +../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/nvram/initstate b/test/sys/module/nvram/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/nvram/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/nvram/notes/.note.gnu.build-id b/test/sys/module/nvram/notes/.note.gnu.build-id new file mode 100644 index 0000000000..579bd3f634 Binary files /dev/null and b/test/sys/module/nvram/notes/.note.gnu.build-id differ diff --git a/test/sys/module/nvram/refcnt b/test/sys/module/nvram/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/nvram/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/nvram/sections/.bss b/test/sys/module/nvram/sections/.bss new file mode 100644 index 0000000000..aaf494f4f2 --- /dev/null +++ b/test/sys/module/nvram/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00ae640 diff --git a/test/sys/module/nvram/sections/.data b/test/sys/module/nvram/sections/.data new file mode 100644 index 0000000000..134ce8a3d0 --- /dev/null +++ b/test/sys/module/nvram/sections/.data @@ -0,0 +1 @@ +0xffffffffa00ae200 diff --git a/test/sys/module/nvram/sections/.exit.text b/test/sys/module/nvram/sections/.exit.text new file mode 100644 index 0000000000..ccc921bf01 --- /dev/null +++ b/test/sys/module/nvram/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00ace3c diff --git a/test/sys/module/nvram/sections/.gnu.linkonce.this_module b/test/sys/module/nvram/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..8d746ae44e --- /dev/null +++ b/test/sys/module/nvram/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00ae280 diff --git a/test/sys/module/nvram/sections/.init.text b/test/sys/module/nvram/sections/.init.text new file mode 100644 index 0000000000..6e4960413f --- /dev/null +++ b/test/sys/module/nvram/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa00b0000 diff --git a/test/sys/module/nvram/sections/.note.gnu.build-id b/test/sys/module/nvram/sections/.note.gnu.build-id new file mode 100644 index 0000000000..8a1fffd05f --- /dev/null +++ b/test/sys/module/nvram/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00ace5c diff --git a/test/sys/module/nvram/sections/.rodata b/test/sys/module/nvram/sections/.rodata new file mode 100644 index 0000000000..51a91fa9ab --- /dev/null +++ b/test/sys/module/nvram/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00ace80 diff --git a/test/sys/module/nvram/sections/.rodata.str1.1 b/test/sys/module/nvram/sections/.rodata.str1.1 new file mode 100644 index 0000000000..da32213582 --- /dev/null +++ b/test/sys/module/nvram/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00acfb8 diff --git a/test/sys/module/nvram/sections/.strtab b/test/sys/module/nvram/sections/.strtab new file mode 100644 index 0000000000..64ae3eb667 --- /dev/null +++ b/test/sys/module/nvram/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00adc38 diff --git a/test/sys/module/nvram/sections/.symtab b/test/sys/module/nvram/sections/.symtab new file mode 100644 index 0000000000..48a1ebf55a --- /dev/null +++ b/test/sys/module/nvram/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00ad338 diff --git a/test/sys/module/nvram/sections/.text b/test/sys/module/nvram/sections/.text new file mode 100644 index 0000000000..d356ab8437 --- /dev/null +++ b/test/sys/module/nvram/sections/.text @@ -0,0 +1 @@ +0xffffffffa00ac000 diff --git a/test/sys/module/nvram/sections/__kcrctab b/test/sys/module/nvram/sections/__kcrctab new file mode 100644 index 0000000000..39f7161a73 --- /dev/null +++ b/test/sys/module/nvram/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa00ad290 diff --git a/test/sys/module/nvram/sections/__ksymtab b/test/sys/module/nvram/sections/__ksymtab new file mode 100644 index 0000000000..fdb80739cc --- /dev/null +++ b/test/sys/module/nvram/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa00ad230 diff --git a/test/sys/module/nvram/sections/__ksymtab_strings b/test/sys/module/nvram/sections/__ksymtab_strings new file mode 100644 index 0000000000..ad984e1a4d --- /dev/null +++ b/test/sys/module/nvram/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa00ad2c0 diff --git a/test/sys/module/nvram/srcversion b/test/sys/module/nvram/srcversion new file mode 100644 index 0000000000..46292a3e31 --- /dev/null +++ b/test/sys/module/nvram/srcversion @@ -0,0 +1 @@ +ECD12B2949BC771BDCE8146 diff --git a/test/sys/module/oprofile/parameters/timer b/test/sys/module/oprofile/parameters/timer new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/oprofile/parameters/timer @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/pcie_aspm/parameters/policy b/test/sys/module/pcie_aspm/parameters/policy new file mode 100644 index 0000000000..f626408897 --- /dev/null +++ b/test/sys/module/pcie_aspm/parameters/policy @@ -0,0 +1 @@ +[default] performance powersave diff --git a/test/sys/module/pcmcia/initstate b/test/sys/module/pcmcia/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/pcmcia/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/pcmcia/notes/.note.gnu.build-id b/test/sys/module/pcmcia/notes/.note.gnu.build-id new file mode 100644 index 0000000000..e8a8e0e356 Binary files /dev/null and b/test/sys/module/pcmcia/notes/.note.gnu.build-id differ diff --git a/test/sys/module/pcmcia/parameters/io_speed b/test/sys/module/pcmcia/parameters/io_speed new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/pcmcia/parameters/io_speed @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/pcmcia/refcnt b/test/sys/module/pcmcia/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/pcmcia/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/pcmcia/sections/.bss b/test/sys/module/pcmcia/sections/.bss new file mode 100644 index 0000000000..4547187361 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.bss @@ -0,0 +1 @@ +0xffffffffa01fcb40 diff --git a/test/sys/module/pcmcia/sections/.data b/test/sys/module/pcmcia/sections/.data new file mode 100644 index 0000000000..2dc318f6a4 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.data @@ -0,0 +1 @@ +0xffffffffa01fc3a0 diff --git a/test/sys/module/pcmcia/sections/.devinit.text b/test/sys/module/pcmcia/sections/.devinit.text new file mode 100644 index 0000000000..6272f20204 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.devinit.text @@ -0,0 +1 @@ +0xffffffffa01f85e2 diff --git a/test/sys/module/pcmcia/sections/.exit.text b/test/sys/module/pcmcia/sections/.exit.text new file mode 100644 index 0000000000..c6055137c2 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa01f85c4 diff --git a/test/sys/module/pcmcia/sections/.gnu.linkonce.this_module b/test/sys/module/pcmcia/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..aa83886b06 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa01fc780 diff --git a/test/sys/module/pcmcia/sections/.init.text b/test/sys/module/pcmcia/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/pcmcia/sections/.note.gnu.build-id b/test/sys/module/pcmcia/sections/.note.gnu.build-id new file mode 100644 index 0000000000..f7f1d1dd53 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa01f86c8 diff --git a/test/sys/module/pcmcia/sections/.ref.data b/test/sys/module/pcmcia/sections/.ref.data new file mode 100644 index 0000000000..a87b465de6 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.ref.data @@ -0,0 +1 @@ +0xffffffffa01fc720 diff --git a/test/sys/module/pcmcia/sections/.rodata b/test/sys/module/pcmcia/sections/.rodata new file mode 100644 index 0000000000..9800ef9aae --- /dev/null +++ b/test/sys/module/pcmcia/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa01f8700 diff --git a/test/sys/module/pcmcia/sections/.rodata.str1.1 b/test/sys/module/pcmcia/sections/.rodata.str1.1 new file mode 100644 index 0000000000..201775af39 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa01f913d diff --git a/test/sys/module/pcmcia/sections/.strtab b/test/sys/module/pcmcia/sections/.strtab new file mode 100644 index 0000000000..89990d740c --- /dev/null +++ b/test/sys/module/pcmcia/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa01fb138 diff --git a/test/sys/module/pcmcia/sections/.symtab b/test/sys/module/pcmcia/sections/.symtab new file mode 100644 index 0000000000..35c9ff8333 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa01f9a28 diff --git a/test/sys/module/pcmcia/sections/.text b/test/sys/module/pcmcia/sections/.text new file mode 100644 index 0000000000..b8eb722db9 --- /dev/null +++ b/test/sys/module/pcmcia/sections/.text @@ -0,0 +1 @@ +0xffffffffa01f5000 diff --git a/test/sys/module/pcmcia/sections/__kcrctab b/test/sys/module/pcmcia/sections/__kcrctab new file mode 100644 index 0000000000..7fe3b12fb6 --- /dev/null +++ b/test/sys/module/pcmcia/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa01f9810 diff --git a/test/sys/module/pcmcia/sections/__ksymtab b/test/sys/module/pcmcia/sections/__ksymtab new file mode 100644 index 0000000000..c838f4d731 --- /dev/null +++ b/test/sys/module/pcmcia/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa01f9710 diff --git a/test/sys/module/pcmcia/sections/__ksymtab_strings b/test/sys/module/pcmcia/sections/__ksymtab_strings new file mode 100644 index 0000000000..ed7fea338e --- /dev/null +++ b/test/sys/module/pcmcia/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa01f9890 diff --git a/test/sys/module/pcmcia/sections/__param b/test/sys/module/pcmcia/sections/__param new file mode 100644 index 0000000000..a291b4999b --- /dev/null +++ b/test/sys/module/pcmcia/sections/__param @@ -0,0 +1 @@ +0xffffffffa01f9a00 diff --git a/test/sys/module/pcmcia/srcversion b/test/sys/module/pcmcia/srcversion new file mode 100644 index 0000000000..552f692585 --- /dev/null +++ b/test/sys/module/pcmcia/srcversion @@ -0,0 +1 @@ +6544CB07B8D7D79F19A4CD6 diff --git a/test/sys/module/pcmcia_core/holders/pcmcia b/test/sys/module/pcmcia_core/holders/pcmcia new file mode 120000 index 0000000000..171c77dafd --- /dev/null +++ b/test/sys/module/pcmcia_core/holders/pcmcia @@ -0,0 +1 @@ +../../pcmcia \ No newline at end of file diff --git a/test/sys/module/pcmcia_core/holders/rsrc_nonstatic b/test/sys/module/pcmcia_core/holders/rsrc_nonstatic new file mode 120000 index 0000000000..1e8aff1d30 --- /dev/null +++ b/test/sys/module/pcmcia_core/holders/rsrc_nonstatic @@ -0,0 +1 @@ +../../rsrc_nonstatic \ No newline at end of file diff --git a/test/sys/module/pcmcia_core/holders/yenta_socket b/test/sys/module/pcmcia_core/holders/yenta_socket new file mode 120000 index 0000000000..eb0b77d0b3 --- /dev/null +++ b/test/sys/module/pcmcia_core/holders/yenta_socket @@ -0,0 +1 @@ +../../yenta_socket \ No newline at end of file diff --git a/test/sys/module/pcmcia_core/initstate b/test/sys/module/pcmcia_core/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/pcmcia_core/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/pcmcia_core/notes/.note.gnu.build-id b/test/sys/module/pcmcia_core/notes/.note.gnu.build-id new file mode 100644 index 0000000000..6ec9ef0c9f Binary files /dev/null and b/test/sys/module/pcmcia_core/notes/.note.gnu.build-id differ diff --git a/test/sys/module/pcmcia_core/parameters/cis_speed b/test/sys/module/pcmcia_core/parameters/cis_speed new file mode 100644 index 0000000000..697cb3a26d --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/cis_speed @@ -0,0 +1 @@ +300 diff --git a/test/sys/module/pcmcia_core/parameters/cis_width b/test/sys/module/pcmcia_core/parameters/cis_width new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/cis_width @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/pcmcia_core/parameters/reset_time b/test/sys/module/pcmcia_core/parameters/reset_time new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/reset_time @@ -0,0 +1 @@ +10 diff --git a/test/sys/module/pcmcia_core/parameters/resume_delay b/test/sys/module/pcmcia_core/parameters/resume_delay new file mode 100644 index 0000000000..209e3ef4b6 --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/resume_delay @@ -0,0 +1 @@ +20 diff --git a/test/sys/module/pcmcia_core/parameters/setup_delay b/test/sys/module/pcmcia_core/parameters/setup_delay new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/setup_delay @@ -0,0 +1 @@ +10 diff --git a/test/sys/module/pcmcia_core/parameters/shutdown_delay b/test/sys/module/pcmcia_core/parameters/shutdown_delay new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/shutdown_delay @@ -0,0 +1 @@ +3 diff --git a/test/sys/module/pcmcia_core/parameters/unreset_check b/test/sys/module/pcmcia_core/parameters/unreset_check new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/unreset_check @@ -0,0 +1 @@ +10 diff --git a/test/sys/module/pcmcia_core/parameters/unreset_delay b/test/sys/module/pcmcia_core/parameters/unreset_delay new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/unreset_delay @@ -0,0 +1 @@ +10 diff --git a/test/sys/module/pcmcia_core/parameters/unreset_limit b/test/sys/module/pcmcia_core/parameters/unreset_limit new file mode 100644 index 0000000000..64bb6b746d --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/unreset_limit @@ -0,0 +1 @@ +30 diff --git a/test/sys/module/pcmcia_core/parameters/vcc_settle b/test/sys/module/pcmcia_core/parameters/vcc_settle new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/module/pcmcia_core/parameters/vcc_settle @@ -0,0 +1 @@ +40 diff --git a/test/sys/module/pcmcia_core/refcnt b/test/sys/module/pcmcia_core/refcnt new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/module/pcmcia_core/refcnt @@ -0,0 +1 @@ +3 diff --git a/test/sys/module/pcmcia_core/sections/.bss b/test/sys/module/pcmcia_core/sections/.bss new file mode 100644 index 0000000000..53e920a0a3 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0098f40 diff --git a/test/sys/module/pcmcia_core/sections/.data b/test/sys/module/pcmcia_core/sections/.data new file mode 100644 index 0000000000..78d13e4bb8 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.data @@ -0,0 +1 @@ +0xffffffffa0098700 diff --git a/test/sys/module/pcmcia_core/sections/.exit.text b/test/sys/module/pcmcia_core/sections/.exit.text new file mode 100644 index 0000000000..a09c6db0b2 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0093558 diff --git a/test/sys/module/pcmcia_core/sections/.gnu.linkonce.this_module b/test/sys/module/pcmcia_core/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..f95a01b342 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0098b80 diff --git a/test/sys/module/pcmcia_core/sections/.init.text b/test/sys/module/pcmcia_core/sections/.init.text new file mode 100644 index 0000000000..0dbbf92722 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa009a000 diff --git a/test/sys/module/pcmcia_core/sections/.note.gnu.build-id b/test/sys/module/pcmcia_core/sections/.note.gnu.build-id new file mode 100644 index 0000000000..f3e1dc2611 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0093668 diff --git a/test/sys/module/pcmcia_core/sections/.ref.text b/test/sys/module/pcmcia_core/sections/.ref.text new file mode 100644 index 0000000000..5f2996a214 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.ref.text @@ -0,0 +1 @@ +0xffffffffa0093580 diff --git a/test/sys/module/pcmcia_core/sections/.rodata b/test/sys/module/pcmcia_core/sections/.rodata new file mode 100644 index 0000000000..09e2f8e58d --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00936a0 diff --git a/test/sys/module/pcmcia_core/sections/.rodata.str1.1 b/test/sys/module/pcmcia_core/sections/.rodata.str1.1 new file mode 100644 index 0000000000..f13ce1ee29 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0093a88 diff --git a/test/sys/module/pcmcia_core/sections/.strtab b/test/sys/module/pcmcia_core/sections/.strtab new file mode 100644 index 0000000000..2a7dc91449 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0096898 diff --git a/test/sys/module/pcmcia_core/sections/.symtab b/test/sys/module/pcmcia_core/sections/.symtab new file mode 100644 index 0000000000..7dfe446732 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00945d0 diff --git a/test/sys/module/pcmcia_core/sections/.text b/test/sys/module/pcmcia_core/sections/.text new file mode 100644 index 0000000000..069d70cd89 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/.text @@ -0,0 +1 @@ +0xffffffffa008f000 diff --git a/test/sys/module/pcmcia_core/sections/__kcrctab b/test/sys/module/pcmcia_core/sections/__kcrctab new file mode 100644 index 0000000000..38262af623 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa0094070 diff --git a/test/sys/module/pcmcia_core/sections/__ksymtab b/test/sys/module/pcmcia_core/sections/__ksymtab new file mode 100644 index 0000000000..9c7381574e --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa0093e50 diff --git a/test/sys/module/pcmcia_core/sections/__ksymtab_strings b/test/sys/module/pcmcia_core/sections/__ksymtab_strings new file mode 100644 index 0000000000..4b1033162b --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa0094310 diff --git a/test/sys/module/pcmcia_core/sections/__param b/test/sys/module/pcmcia_core/sections/__param new file mode 100644 index 0000000000..5fa904cb38 --- /dev/null +++ b/test/sys/module/pcmcia_core/sections/__param @@ -0,0 +1 @@ +0xffffffffa0094180 diff --git a/test/sys/module/pcmcia_core/srcversion b/test/sys/module/pcmcia_core/srcversion new file mode 100644 index 0000000000..fa1b58a28e --- /dev/null +++ b/test/sys/module/pcmcia_core/srcversion @@ -0,0 +1 @@ +7C1220572DE8897E4D560EB diff --git a/test/sys/module/pcspkr/drivers/platform:pcspkr b/test/sys/module/pcspkr/drivers/platform:pcspkr new file mode 120000 index 0000000000..44af544108 --- /dev/null +++ b/test/sys/module/pcspkr/drivers/platform:pcspkr @@ -0,0 +1 @@ +../../../bus/platform/drivers/pcspkr \ No newline at end of file diff --git a/test/sys/module/pcspkr/initstate b/test/sys/module/pcspkr/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/pcspkr/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/pcspkr/notes/.note.gnu.build-id b/test/sys/module/pcspkr/notes/.note.gnu.build-id new file mode 100644 index 0000000000..941a2af177 Binary files /dev/null and b/test/sys/module/pcspkr/notes/.note.gnu.build-id differ diff --git a/test/sys/module/pcspkr/refcnt b/test/sys/module/pcspkr/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/pcspkr/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/pcspkr/sections/.bss b/test/sys/module/pcspkr/sections/.bss new file mode 100644 index 0000000000..302aa91225 --- /dev/null +++ b/test/sys/module/pcspkr/sections/.bss @@ -0,0 +1 @@ +0xffffffffa009ed80 diff --git a/test/sys/module/pcspkr/sections/.data b/test/sys/module/pcspkr/sections/.data new file mode 100644 index 0000000000..70d87fbcf7 --- /dev/null +++ b/test/sys/module/pcspkr/sections/.data @@ -0,0 +1 @@ +0xffffffffa009e900 diff --git a/test/sys/module/pcspkr/sections/.devexit.text b/test/sys/module/pcspkr/sections/.devexit.text new file mode 100644 index 0000000000..5577444aae --- /dev/null +++ b/test/sys/module/pcspkr/sections/.devexit.text @@ -0,0 +1 @@ +0xffffffffa009e16e diff --git a/test/sys/module/pcspkr/sections/.devinit.text b/test/sys/module/pcspkr/sections/.devinit.text new file mode 100644 index 0000000000..c8ab2af217 --- /dev/null +++ b/test/sys/module/pcspkr/sections/.devinit.text @@ -0,0 +1 @@ +0xffffffffa009e1ad diff --git a/test/sys/module/pcspkr/sections/.exit.text b/test/sys/module/pcspkr/sections/.exit.text new file mode 100644 index 0000000000..175dd5c9ae --- /dev/null +++ b/test/sys/module/pcspkr/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa009e15c diff --git a/test/sys/module/pcspkr/sections/.gnu.linkonce.this_module b/test/sys/module/pcspkr/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..b565dd3785 --- /dev/null +++ b/test/sys/module/pcspkr/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa009e9c0 diff --git a/test/sys/module/pcspkr/sections/.init.text b/test/sys/module/pcspkr/sections/.init.text new file mode 100644 index 0000000000..cb816d17ae --- /dev/null +++ b/test/sys/module/pcspkr/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa00a0000 diff --git a/test/sys/module/pcspkr/sections/.note.gnu.build-id b/test/sys/module/pcspkr/sections/.note.gnu.build-id new file mode 100644 index 0000000000..9e47b4a6e0 --- /dev/null +++ b/test/sys/module/pcspkr/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa009e250 diff --git a/test/sys/module/pcspkr/sections/.rodata.str1.1 b/test/sys/module/pcspkr/sections/.rodata.str1.1 new file mode 100644 index 0000000000..ddd8cf2f70 --- /dev/null +++ b/test/sys/module/pcspkr/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa009e274 diff --git a/test/sys/module/pcspkr/sections/.strtab b/test/sys/module/pcspkr/sections/.strtab new file mode 100644 index 0000000000..48fc2dc2d0 --- /dev/null +++ b/test/sys/module/pcspkr/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa009e6e8 diff --git a/test/sys/module/pcspkr/sections/.symtab b/test/sys/module/pcspkr/sections/.symtab new file mode 100644 index 0000000000..0339c92d4b --- /dev/null +++ b/test/sys/module/pcspkr/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa009e298 diff --git a/test/sys/module/pcspkr/sections/.text b/test/sys/module/pcspkr/sections/.text new file mode 100644 index 0000000000..0ed9948ecb --- /dev/null +++ b/test/sys/module/pcspkr/sections/.text @@ -0,0 +1 @@ +0xffffffffa009e000 diff --git a/test/sys/module/pcspkr/srcversion b/test/sys/module/pcspkr/srcversion new file mode 100644 index 0000000000..b2378e7e95 --- /dev/null +++ b/test/sys/module/pcspkr/srcversion @@ -0,0 +1 @@ +5757E9C81E627525BA9D165 diff --git a/test/sys/module/printk/parameters/time b/test/sys/module/printk/parameters/time new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/printk/parameters/time @@ -0,0 +1 @@ +N diff --git a/test/sys/module/processor/holders/acpi_cpufreq b/test/sys/module/processor/holders/acpi_cpufreq new file mode 120000 index 0000000000..31c49118f6 --- /dev/null +++ b/test/sys/module/processor/holders/acpi_cpufreq @@ -0,0 +1 @@ +../../acpi_cpufreq \ No newline at end of file diff --git a/test/sys/module/processor/holders/thermal b/test/sys/module/processor/holders/thermal new file mode 120000 index 0000000000..b8b0080f39 --- /dev/null +++ b/test/sys/module/processor/holders/thermal @@ -0,0 +1 @@ +../../thermal \ No newline at end of file diff --git a/test/sys/module/processor/initstate b/test/sys/module/processor/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/processor/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/processor/notes/.note.gnu.build-id b/test/sys/module/processor/notes/.note.gnu.build-id new file mode 100644 index 0000000000..0a62e14198 Binary files /dev/null and b/test/sys/module/processor/notes/.note.gnu.build-id differ diff --git a/test/sys/module/processor/parameters/ignore_ppc b/test/sys/module/processor/parameters/ignore_ppc new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/processor/parameters/ignore_ppc @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/processor/parameters/latency_factor b/test/sys/module/processor/parameters/latency_factor new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/processor/parameters/latency_factor @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/processor/refcnt b/test/sys/module/processor/refcnt new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/module/processor/refcnt @@ -0,0 +1 @@ +4 diff --git a/test/sys/module/processor/sections/.bss b/test/sys/module/processor/sections/.bss new file mode 100644 index 0000000000..05a7c56259 --- /dev/null +++ b/test/sys/module/processor/sections/.bss @@ -0,0 +1 @@ +0xffffffffa007bbc0 diff --git a/test/sys/module/processor/sections/.cpuinit.data b/test/sys/module/processor/sections/.cpuinit.data new file mode 100644 index 0000000000..ec3180d09f --- /dev/null +++ b/test/sys/module/processor/sections/.cpuinit.data @@ -0,0 +1 @@ +0xffffffffa007b040 diff --git a/test/sys/module/processor/sections/.cpuinit.text b/test/sys/module/processor/sections/.cpuinit.text new file mode 100644 index 0000000000..699392a0bc --- /dev/null +++ b/test/sys/module/processor/sections/.cpuinit.text @@ -0,0 +1 @@ +0xffffffffa0075abc diff --git a/test/sys/module/processor/sections/.data b/test/sys/module/processor/sections/.data new file mode 100644 index 0000000000..100996acbc --- /dev/null +++ b/test/sys/module/processor/sections/.data @@ -0,0 +1 @@ +0xffffffffa007ab90 diff --git a/test/sys/module/processor/sections/.data.read_mostly b/test/sys/module/processor/sections/.data.read_mostly new file mode 100644 index 0000000000..c8156db601 --- /dev/null +++ b/test/sys/module/processor/sections/.data.read_mostly @@ -0,0 +1 @@ +0xffffffffa007b7d8 diff --git a/test/sys/module/processor/sections/.exit.text b/test/sys/module/processor/sections/.exit.text new file mode 100644 index 0000000000..330855e381 --- /dev/null +++ b/test/sys/module/processor/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00763a9 diff --git a/test/sys/module/processor/sections/.fixup b/test/sys/module/processor/sections/.fixup new file mode 100644 index 0000000000..a6ab6fca10 --- /dev/null +++ b/test/sys/module/processor/sections/.fixup @@ -0,0 +1 @@ +0xffffffffa00765ad diff --git a/test/sys/module/processor/sections/.gnu.linkonce.this_module b/test/sys/module/processor/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..c57b65e96b --- /dev/null +++ b/test/sys/module/processor/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa007b800 diff --git a/test/sys/module/processor/sections/.init.text b/test/sys/module/processor/sections/.init.text new file mode 100644 index 0000000000..3e03f3c0fc --- /dev/null +++ b/test/sys/module/processor/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa007d000 diff --git a/test/sys/module/processor/sections/.note.gnu.build-id b/test/sys/module/processor/sections/.note.gnu.build-id new file mode 100644 index 0000000000..1b53386181 --- /dev/null +++ b/test/sys/module/processor/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00765c4 diff --git a/test/sys/module/processor/sections/.ref.text b/test/sys/module/processor/sections/.ref.text new file mode 100644 index 0000000000..3d7adb191e --- /dev/null +++ b/test/sys/module/processor/sections/.ref.text @@ -0,0 +1 @@ +0xffffffffa007641a diff --git a/test/sys/module/processor/sections/.rodata b/test/sys/module/processor/sections/.rodata new file mode 100644 index 0000000000..64930d5917 --- /dev/null +++ b/test/sys/module/processor/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00765f0 diff --git a/test/sys/module/processor/sections/.rodata.str1.1 b/test/sys/module/processor/sections/.rodata.str1.1 new file mode 100644 index 0000000000..2c62281acb --- /dev/null +++ b/test/sys/module/processor/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0076863 diff --git a/test/sys/module/processor/sections/.smp_locks b/test/sys/module/processor/sections/.smp_locks new file mode 100644 index 0000000000..7c54d3de3b --- /dev/null +++ b/test/sys/module/processor/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa0077788 diff --git a/test/sys/module/processor/sections/.strtab b/test/sys/module/processor/sections/.strtab new file mode 100644 index 0000000000..86061293e3 --- /dev/null +++ b/test/sys/module/processor/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0079438 diff --git a/test/sys/module/processor/sections/.symtab b/test/sys/module/processor/sections/.symtab new file mode 100644 index 0000000000..c5ab05949e --- /dev/null +++ b/test/sys/module/processor/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0077890 diff --git a/test/sys/module/processor/sections/.text b/test/sys/module/processor/sections/.text new file mode 100644 index 0000000000..a5187ffb5b --- /dev/null +++ b/test/sys/module/processor/sections/.text @@ -0,0 +1 @@ +0xffffffffa0072000 diff --git a/test/sys/module/processor/sections/__bug_table b/test/sys/module/processor/sections/__bug_table new file mode 100644 index 0000000000..e4a9b70ca7 --- /dev/null +++ b/test/sys/module/processor/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa0077621 diff --git a/test/sys/module/processor/sections/__ex_table b/test/sys/module/processor/sections/__ex_table new file mode 100644 index 0000000000..4bab5f0726 --- /dev/null +++ b/test/sys/module/processor/sections/__ex_table @@ -0,0 +1 @@ +0xffffffffa0077768 diff --git a/test/sys/module/processor/sections/__kcrctab b/test/sys/module/processor/sections/__kcrctab new file mode 100644 index 0000000000..f7d4abd806 --- /dev/null +++ b/test/sys/module/processor/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa0077690 diff --git a/test/sys/module/processor/sections/__ksymtab b/test/sys/module/processor/sections/__ksymtab new file mode 100644 index 0000000000..59d3788052 --- /dev/null +++ b/test/sys/module/processor/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa0077640 diff --git a/test/sys/module/processor/sections/__ksymtab_strings b/test/sys/module/processor/sections/__ksymtab_strings new file mode 100644 index 0000000000..c185088c08 --- /dev/null +++ b/test/sys/module/processor/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa00776b8 diff --git a/test/sys/module/processor/sections/__param b/test/sys/module/processor/sections/__param new file mode 100644 index 0000000000..d3a1e4e501 --- /dev/null +++ b/test/sys/module/processor/sections/__param @@ -0,0 +1 @@ +0xffffffffa00777f0 diff --git a/test/sys/module/processor/srcversion b/test/sys/module/processor/srcversion new file mode 100644 index 0000000000..d84fc1aa69 --- /dev/null +++ b/test/sys/module/processor/srcversion @@ -0,0 +1 @@ +8A1C302AFF80867DBAC4684 diff --git a/test/sys/module/psmouse/drivers/serio:psmouse b/test/sys/module/psmouse/drivers/serio:psmouse new file mode 120000 index 0000000000..385b8ae0f5 --- /dev/null +++ b/test/sys/module/psmouse/drivers/serio:psmouse @@ -0,0 +1 @@ +../../../bus/serio/drivers/psmouse \ No newline at end of file diff --git a/test/sys/module/psmouse/parameters/proto b/test/sys/module/psmouse/parameters/proto new file mode 100644 index 0000000000..588192d1e0 --- /dev/null +++ b/test/sys/module/psmouse/parameters/proto @@ -0,0 +1,2 @@ +auto + diff --git a/test/sys/module/psmouse/parameters/rate b/test/sys/module/psmouse/parameters/rate new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/module/psmouse/parameters/rate @@ -0,0 +1 @@ +100 diff --git a/test/sys/module/psmouse/parameters/resetafter b/test/sys/module/psmouse/parameters/resetafter new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/module/psmouse/parameters/resetafter @@ -0,0 +1 @@ +5 diff --git a/test/sys/module/psmouse/parameters/resolution b/test/sys/module/psmouse/parameters/resolution new file mode 100644 index 0000000000..08839f6bb2 --- /dev/null +++ b/test/sys/module/psmouse/parameters/resolution @@ -0,0 +1 @@ +200 diff --git a/test/sys/module/psmouse/parameters/resync_time b/test/sys/module/psmouse/parameters/resync_time new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/psmouse/parameters/resync_time @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/psmouse/parameters/smartscroll b/test/sys/module/psmouse/parameters/smartscroll new file mode 100644 index 0000000000..9bda8c35c2 --- /dev/null +++ b/test/sys/module/psmouse/parameters/smartscroll @@ -0,0 +1 @@ +Y diff --git a/test/sys/module/raid1/initstate b/test/sys/module/raid1/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/raid1/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/raid1/notes/.note.gnu.build-id b/test/sys/module/raid1/notes/.note.gnu.build-id new file mode 100644 index 0000000000..63c3265b0b Binary files /dev/null and b/test/sys/module/raid1/notes/.note.gnu.build-id differ diff --git a/test/sys/module/raid1/refcnt b/test/sys/module/raid1/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/raid1/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/raid1/sections/.bss b/test/sys/module/raid1/sections/.bss new file mode 100644 index 0000000000..f63821e1ef --- /dev/null +++ b/test/sys/module/raid1/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0238280 diff --git a/test/sys/module/raid1/sections/.data b/test/sys/module/raid1/sections/.data new file mode 100644 index 0000000000..a56ebcc5da --- /dev/null +++ b/test/sys/module/raid1/sections/.data @@ -0,0 +1 @@ +0xffffffffa0237e20 diff --git a/test/sys/module/raid1/sections/.gnu.linkonce.this_module b/test/sys/module/raid1/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..e58dfa707b --- /dev/null +++ b/test/sys/module/raid1/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0237ec0 diff --git a/test/sys/module/raid1/sections/.init.text b/test/sys/module/raid1/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/raid1/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/raid1/sections/.note.gnu.build-id b/test/sys/module/raid1/sections/.note.gnu.build-id new file mode 100644 index 0000000000..e0ee1019e2 --- /dev/null +++ b/test/sys/module/raid1/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0236414 diff --git a/test/sys/module/raid1/sections/.rodata.str1.1 b/test/sys/module/raid1/sections/.rodata.str1.1 new file mode 100644 index 0000000000..ea2a278ffa --- /dev/null +++ b/test/sys/module/raid1/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0236618 diff --git a/test/sys/module/raid1/sections/.smp_locks b/test/sys/module/raid1/sections/.smp_locks new file mode 100644 index 0000000000..17f191f28f --- /dev/null +++ b/test/sys/module/raid1/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa0236438 diff --git a/test/sys/module/raid1/sections/.strtab b/test/sys/module/raid1/sections/.strtab new file mode 100644 index 0000000000..7ca1f678ba --- /dev/null +++ b/test/sys/module/raid1/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02376f8 diff --git a/test/sys/module/raid1/sections/.symtab b/test/sys/module/raid1/sections/.symtab new file mode 100644 index 0000000000..31b99d4729 --- /dev/null +++ b/test/sys/module/raid1/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0236a08 diff --git a/test/sys/module/raid1/sections/.text b/test/sys/module/raid1/sections/.text new file mode 100644 index 0000000000..738aafb70b --- /dev/null +++ b/test/sys/module/raid1/sections/.text @@ -0,0 +1 @@ +0xffffffffa0232000 diff --git a/test/sys/module/raid1/sections/__bug_table b/test/sys/module/raid1/sections/__bug_table new file mode 100644 index 0000000000..e4b01a0bdb --- /dev/null +++ b/test/sys/module/raid1/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa02369c0 diff --git a/test/sys/module/raid1/srcversion b/test/sys/module/raid1/srcversion new file mode 100644 index 0000000000..529578f207 --- /dev/null +++ b/test/sys/module/raid1/srcversion @@ -0,0 +1 @@ +EA08FDD37C2EEFA95DE4413 diff --git a/test/sys/module/rfkill/holders/thinkpad_acpi b/test/sys/module/rfkill/holders/thinkpad_acpi new file mode 120000 index 0000000000..8d266ed087 --- /dev/null +++ b/test/sys/module/rfkill/holders/thinkpad_acpi @@ -0,0 +1 @@ +../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/rfkill/initstate b/test/sys/module/rfkill/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/rfkill/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/rfkill/notes/.note.gnu.build-id b/test/sys/module/rfkill/notes/.note.gnu.build-id new file mode 100644 index 0000000000..91e71bd9c6 Binary files /dev/null and b/test/sys/module/rfkill/notes/.note.gnu.build-id differ diff --git a/test/sys/module/rfkill/parameters/default_state b/test/sys/module/rfkill/parameters/default_state new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/rfkill/parameters/default_state @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/rfkill/refcnt b/test/sys/module/rfkill/refcnt new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/rfkill/refcnt @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/rfkill/sections/.bss b/test/sys/module/rfkill/sections/.bss new file mode 100644 index 0000000000..647475aade --- /dev/null +++ b/test/sys/module/rfkill/sections/.bss @@ -0,0 +1 @@ +0xffffffffa01dbe00 diff --git a/test/sys/module/rfkill/sections/.data b/test/sys/module/rfkill/sections/.data new file mode 100644 index 0000000000..a158c33fc2 --- /dev/null +++ b/test/sys/module/rfkill/sections/.data @@ -0,0 +1 @@ +0xffffffffa01db780 diff --git a/test/sys/module/rfkill/sections/.exit.text b/test/sys/module/rfkill/sections/.exit.text new file mode 100644 index 0000000000..ab6800ef4f --- /dev/null +++ b/test/sys/module/rfkill/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa01d9c88 diff --git a/test/sys/module/rfkill/sections/.gnu.linkonce.this_module b/test/sys/module/rfkill/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..174e6eb10a --- /dev/null +++ b/test/sys/module/rfkill/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa01dba40 diff --git a/test/sys/module/rfkill/sections/.init.text b/test/sys/module/rfkill/sections/.init.text new file mode 100644 index 0000000000..0dbbf92722 --- /dev/null +++ b/test/sys/module/rfkill/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa009a000 diff --git a/test/sys/module/rfkill/sections/.note.gnu.build-id b/test/sys/module/rfkill/sections/.note.gnu.build-id new file mode 100644 index 0000000000..72651ddb7c --- /dev/null +++ b/test/sys/module/rfkill/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa01d9cb0 diff --git a/test/sys/module/rfkill/sections/.rodata b/test/sys/module/rfkill/sections/.rodata new file mode 100644 index 0000000000..8dbcbba724 --- /dev/null +++ b/test/sys/module/rfkill/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa01d9cd8 diff --git a/test/sys/module/rfkill/sections/.rodata.str1.1 b/test/sys/module/rfkill/sections/.rodata.str1.1 new file mode 100644 index 0000000000..e5b2b05429 --- /dev/null +++ b/test/sys/module/rfkill/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa01d9d36 diff --git a/test/sys/module/rfkill/sections/.smp_locks b/test/sys/module/rfkill/sections/.smp_locks new file mode 100644 index 0000000000..9e92f5e8db --- /dev/null +++ b/test/sys/module/rfkill/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa01d9e80 diff --git a/test/sys/module/rfkill/sections/.strtab b/test/sys/module/rfkill/sections/.strtab new file mode 100644 index 0000000000..c999f4f402 --- /dev/null +++ b/test/sys/module/rfkill/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa01dae08 diff --git a/test/sys/module/rfkill/sections/.symtab b/test/sys/module/rfkill/sections/.symtab new file mode 100644 index 0000000000..1df0e25a5e --- /dev/null +++ b/test/sys/module/rfkill/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa01da088 diff --git a/test/sys/module/rfkill/sections/.text b/test/sys/module/rfkill/sections/.text new file mode 100644 index 0000000000..e2c99a7fe2 --- /dev/null +++ b/test/sys/module/rfkill/sections/.text @@ -0,0 +1 @@ +0xffffffffa01d9000 diff --git a/test/sys/module/rfkill/sections/__bug_table b/test/sys/module/rfkill/sections/__bug_table new file mode 100644 index 0000000000..93eb4e41ee --- /dev/null +++ b/test/sys/module/rfkill/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa01d9e36 diff --git a/test/sys/module/rfkill/sections/__kcrctab b/test/sys/module/rfkill/sections/__kcrctab new file mode 100644 index 0000000000..badd707fb8 --- /dev/null +++ b/test/sys/module/rfkill/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa01d9f40 diff --git a/test/sys/module/rfkill/sections/__kcrctab_gpl b/test/sys/module/rfkill/sections/__kcrctab_gpl new file mode 100644 index 0000000000..ef846baf13 --- /dev/null +++ b/test/sys/module/rfkill/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa01d9fa0 diff --git a/test/sys/module/rfkill/sections/__ksymtab b/test/sys/module/rfkill/sections/__ksymtab new file mode 100644 index 0000000000..04d68f1c0e --- /dev/null +++ b/test/sys/module/rfkill/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa01d9ee0 diff --git a/test/sys/module/rfkill/sections/__ksymtab_gpl b/test/sys/module/rfkill/sections/__ksymtab_gpl new file mode 100644 index 0000000000..747ebe2815 --- /dev/null +++ b/test/sys/module/rfkill/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa01d9f70 diff --git a/test/sys/module/rfkill/sections/__ksymtab_strings b/test/sys/module/rfkill/sections/__ksymtab_strings new file mode 100644 index 0000000000..4d694ea516 --- /dev/null +++ b/test/sys/module/rfkill/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa01d9fe0 diff --git a/test/sys/module/rfkill/sections/__param b/test/sys/module/rfkill/sections/__param new file mode 100644 index 0000000000..5013dc401f --- /dev/null +++ b/test/sys/module/rfkill/sections/__param @@ -0,0 +1 @@ +0xffffffffa01d9fb8 diff --git a/test/sys/module/rfkill/srcversion b/test/sys/module/rfkill/srcversion new file mode 100644 index 0000000000..342c0f0ee8 --- /dev/null +++ b/test/sys/module/rfkill/srcversion @@ -0,0 +1 @@ +6B4E68548C57FD365EB4E71 diff --git a/test/sys/module/rfkill/version b/test/sys/module/rfkill/version new file mode 100644 index 0000000000..d3827e75a5 --- /dev/null +++ b/test/sys/module/rfkill/version @@ -0,0 +1 @@ +1.0 diff --git a/test/sys/module/rsrc_nonstatic/holders/yenta_socket b/test/sys/module/rsrc_nonstatic/holders/yenta_socket new file mode 120000 index 0000000000..eb0b77d0b3 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/holders/yenta_socket @@ -0,0 +1 @@ +../../yenta_socket \ No newline at end of file diff --git a/test/sys/module/rsrc_nonstatic/initstate b/test/sys/module/rsrc_nonstatic/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/rsrc_nonstatic/notes/.note.gnu.build-id b/test/sys/module/rsrc_nonstatic/notes/.note.gnu.build-id new file mode 100644 index 0000000000..167d69a7bf Binary files /dev/null and b/test/sys/module/rsrc_nonstatic/notes/.note.gnu.build-id differ diff --git a/test/sys/module/rsrc_nonstatic/parameters/probe_mem b/test/sys/module/rsrc_nonstatic/parameters/probe_mem new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/parameters/probe_mem @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/rsrc_nonstatic/refcnt b/test/sys/module/rsrc_nonstatic/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/rsrc_nonstatic/sections/.bss b/test/sys/module/rsrc_nonstatic/sections/.bss new file mode 100644 index 0000000000..a1b0cddb67 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00f0dc0 diff --git a/test/sys/module/rsrc_nonstatic/sections/.data b/test/sys/module/rsrc_nonstatic/sections/.data new file mode 100644 index 0000000000..aeedb038cc --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.data @@ -0,0 +1 @@ +0xffffffffa00f0820 diff --git a/test/sys/module/rsrc_nonstatic/sections/.devexit.text b/test/sys/module/rsrc_nonstatic/sections/.devexit.text new file mode 100644 index 0000000000..192fd76b0a --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.devexit.text @@ -0,0 +1 @@ +0xffffffffa00ef636 diff --git a/test/sys/module/rsrc_nonstatic/sections/.devinit.text b/test/sys/module/rsrc_nonstatic/sections/.devinit.text new file mode 100644 index 0000000000..329e7122a5 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.devinit.text @@ -0,0 +1 @@ +0xffffffffa00ef665 diff --git a/test/sys/module/rsrc_nonstatic/sections/.exit.text b/test/sys/module/rsrc_nonstatic/sections/.exit.text new file mode 100644 index 0000000000..a8a6e04a7e --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00ef624 diff --git a/test/sys/module/rsrc_nonstatic/sections/.gnu.linkonce.this_module b/test/sys/module/rsrc_nonstatic/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..f2c70516bd --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00f0a00 diff --git a/test/sys/module/rsrc_nonstatic/sections/.init.text b/test/sys/module/rsrc_nonstatic/sections/.init.text new file mode 100644 index 0000000000..9da5e610a8 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0084000 diff --git a/test/sys/module/rsrc_nonstatic/sections/.note.gnu.build-id b/test/sys/module/rsrc_nonstatic/sections/.note.gnu.build-id new file mode 100644 index 0000000000..ab5f09eba3 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00ef69c diff --git a/test/sys/module/rsrc_nonstatic/sections/.ref.data b/test/sys/module/rsrc_nonstatic/sections/.ref.data new file mode 100644 index 0000000000..76e2ef6fed --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.ref.data @@ -0,0 +1 @@ +0xffffffffa00f09c0 diff --git a/test/sys/module/rsrc_nonstatic/sections/.rodata b/test/sys/module/rsrc_nonstatic/sections/.rodata new file mode 100644 index 0000000000..fa4be8630b --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00ef6c0 diff --git a/test/sys/module/rsrc_nonstatic/sections/.rodata.str1.1 b/test/sys/module/rsrc_nonstatic/sections/.rodata.str1.1 new file mode 100644 index 0000000000..40e84a404b --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00ef78d diff --git a/test/sys/module/rsrc_nonstatic/sections/.strtab b/test/sys/module/rsrc_nonstatic/sections/.strtab new file mode 100644 index 0000000000..c622215ae0 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00f0260 diff --git a/test/sys/module/rsrc_nonstatic/sections/.symtab b/test/sys/module/rsrc_nonstatic/sections/.symtab new file mode 100644 index 0000000000..edc4a28363 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00ef8b8 diff --git a/test/sys/module/rsrc_nonstatic/sections/.text b/test/sys/module/rsrc_nonstatic/sections/.text new file mode 100644 index 0000000000..3c63036e4e --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/.text @@ -0,0 +1 @@ +0xffffffffa00ee000 diff --git a/test/sys/module/rsrc_nonstatic/sections/__kcrctab b/test/sys/module/rsrc_nonstatic/sections/__kcrctab new file mode 100644 index 0000000000..89dfacc217 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa00ef870 diff --git a/test/sys/module/rsrc_nonstatic/sections/__ksymtab b/test/sys/module/rsrc_nonstatic/sections/__ksymtab new file mode 100644 index 0000000000..de3c665d1b --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa00ef860 diff --git a/test/sys/module/rsrc_nonstatic/sections/__ksymtab_strings b/test/sys/module/rsrc_nonstatic/sections/__ksymtab_strings new file mode 100644 index 0000000000..723bf4fc25 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa00ef8a0 diff --git a/test/sys/module/rsrc_nonstatic/sections/__param b/test/sys/module/rsrc_nonstatic/sections/__param new file mode 100644 index 0000000000..10bdfa75bb --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/sections/__param @@ -0,0 +1 @@ +0xffffffffa00ef878 diff --git a/test/sys/module/rsrc_nonstatic/srcversion b/test/sys/module/rsrc_nonstatic/srcversion new file mode 100644 index 0000000000..8992221999 --- /dev/null +++ b/test/sys/module/rsrc_nonstatic/srcversion @@ -0,0 +1 @@ +8554CBDFE6293476856E830 diff --git a/test/sys/module/rtc_cmos/initstate b/test/sys/module/rtc_cmos/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/rtc_cmos/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/rtc_cmos/notes/.note.gnu.build-id b/test/sys/module/rtc_cmos/notes/.note.gnu.build-id new file mode 100644 index 0000000000..d556f6054c Binary files /dev/null and b/test/sys/module/rtc_cmos/notes/.note.gnu.build-id differ diff --git a/test/sys/module/rtc_cmos/refcnt b/test/sys/module/rtc_cmos/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/rtc_cmos/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/rtc_cmos/sections/.bss b/test/sys/module/rtc_cmos/sections/.bss new file mode 100644 index 0000000000..4fe6d87237 --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00ffd40 diff --git a/test/sys/module/rtc_cmos/sections/.data b/test/sys/module/rtc_cmos/sections/.data new file mode 100644 index 0000000000..8c315ecfac --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.data @@ -0,0 +1 @@ +0xffffffffa00ff800 diff --git a/test/sys/module/rtc_cmos/sections/.devinit.text b/test/sys/module/rtc_cmos/sections/.devinit.text new file mode 100644 index 0000000000..32ba67ea79 --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.devinit.text @@ -0,0 +1 @@ +0xffffffffa00fe44f diff --git a/test/sys/module/rtc_cmos/sections/.exit.text b/test/sys/module/rtc_cmos/sections/.exit.text new file mode 100644 index 0000000000..7ce2bc7857 --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00fe370 diff --git a/test/sys/module/rtc_cmos/sections/.gnu.linkonce.this_module b/test/sys/module/rtc_cmos/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..5bace29d4a --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00ff980 diff --git a/test/sys/module/rtc_cmos/sections/.init.text b/test/sys/module/rtc_cmos/sections/.init.text new file mode 100644 index 0000000000..3e03f3c0fc --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa007d000 diff --git a/test/sys/module/rtc_cmos/sections/.note.gnu.build-id b/test/sys/module/rtc_cmos/sections/.note.gnu.build-id new file mode 100644 index 0000000000..d140ffdb3c --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00fe4e4 diff --git a/test/sys/module/rtc_cmos/sections/.rodata b/test/sys/module/rtc_cmos/sections/.rodata new file mode 100644 index 0000000000..919d4b7f80 --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00fe520 diff --git a/test/sys/module/rtc_cmos/sections/.rodata.str1.1 b/test/sys/module/rtc_cmos/sections/.rodata.str1.1 new file mode 100644 index 0000000000..67c238bcde --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00fe6a2 diff --git a/test/sys/module/rtc_cmos/sections/.strtab b/test/sys/module/rtc_cmos/sections/.strtab new file mode 100644 index 0000000000..d2547cf9fd --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00ff1a8 diff --git a/test/sys/module/rtc_cmos/sections/.symtab b/test/sys/module/rtc_cmos/sections/.symtab new file mode 100644 index 0000000000..8e90a58d58 --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00fe6e0 diff --git a/test/sys/module/rtc_cmos/sections/.text b/test/sys/module/rtc_cmos/sections/.text new file mode 100644 index 0000000000..53c31a2db9 --- /dev/null +++ b/test/sys/module/rtc_cmos/sections/.text @@ -0,0 +1 @@ +0xffffffffa00fd000 diff --git a/test/sys/module/rtc_cmos/srcversion b/test/sys/module/rtc_cmos/srcversion new file mode 100644 index 0000000000..5edf58b29a --- /dev/null +++ b/test/sys/module/rtc_cmos/srcversion @@ -0,0 +1 @@ +7BE4B8C2A52556D0C62CB0B diff --git a/test/sys/module/rtc_core/holders/rtc_cmos b/test/sys/module/rtc_core/holders/rtc_cmos new file mode 120000 index 0000000000..e84e2e8773 --- /dev/null +++ b/test/sys/module/rtc_core/holders/rtc_cmos @@ -0,0 +1 @@ +../../rtc_cmos \ No newline at end of file diff --git a/test/sys/module/rtc_core/initstate b/test/sys/module/rtc_core/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/rtc_core/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/rtc_core/notes/.note.gnu.build-id b/test/sys/module/rtc_core/notes/.note.gnu.build-id new file mode 100644 index 0000000000..e9115085cc Binary files /dev/null and b/test/sys/module/rtc_core/notes/.note.gnu.build-id differ diff --git a/test/sys/module/rtc_core/refcnt b/test/sys/module/rtc_core/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/rtc_core/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/rtc_core/sections/.bss b/test/sys/module/rtc_core/sections/.bss new file mode 100644 index 0000000000..294a3d3f65 --- /dev/null +++ b/test/sys/module/rtc_core/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00ecd80 diff --git a/test/sys/module/rtc_core/sections/.data b/test/sys/module/rtc_core/sections/.data new file mode 100644 index 0000000000..9ee0694526 --- /dev/null +++ b/test/sys/module/rtc_core/sections/.data @@ -0,0 +1 @@ +0xffffffffa00ec760 diff --git a/test/sys/module/rtc_core/sections/.exit.text b/test/sys/module/rtc_core/sections/.exit.text new file mode 100644 index 0000000000..85152e0072 --- /dev/null +++ b/test/sys/module/rtc_core/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00e9e60 diff --git a/test/sys/module/rtc_core/sections/.gnu.linkonce.this_module b/test/sys/module/rtc_core/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..a0046cda7d --- /dev/null +++ b/test/sys/module/rtc_core/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00ec9c0 diff --git a/test/sys/module/rtc_core/sections/.init.text b/test/sys/module/rtc_core/sections/.init.text new file mode 100644 index 0000000000..3e03f3c0fc --- /dev/null +++ b/test/sys/module/rtc_core/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa007d000 diff --git a/test/sys/module/rtc_core/sections/.note.gnu.build-id b/test/sys/module/rtc_core/sections/.note.gnu.build-id new file mode 100644 index 0000000000..9f7dfbdc5d --- /dev/null +++ b/test/sys/module/rtc_core/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00e9ea4 diff --git a/test/sys/module/rtc_core/sections/.rodata b/test/sys/module/rtc_core/sections/.rodata new file mode 100644 index 0000000000..2733f06831 --- /dev/null +++ b/test/sys/module/rtc_core/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00e9ee0 diff --git a/test/sys/module/rtc_core/sections/.rodata.str1.1 b/test/sys/module/rtc_core/sections/.rodata.str1.1 new file mode 100644 index 0000000000..e85a0918e8 --- /dev/null +++ b/test/sys/module/rtc_core/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00ea098 diff --git a/test/sys/module/rtc_core/sections/.smp_locks b/test/sys/module/rtc_core/sections/.smp_locks new file mode 100644 index 0000000000..4ceb2da43f --- /dev/null +++ b/test/sys/module/rtc_core/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa00ea5b8 diff --git a/test/sys/module/rtc_core/sections/.strtab b/test/sys/module/rtc_core/sections/.strtab new file mode 100644 index 0000000000..884919ccf9 --- /dev/null +++ b/test/sys/module/rtc_core/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00eb9c0 diff --git a/test/sys/module/rtc_core/sections/.symtab b/test/sys/module/rtc_core/sections/.symtab new file mode 100644 index 0000000000..cf70da3b3c --- /dev/null +++ b/test/sys/module/rtc_core/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00ea5e0 diff --git a/test/sys/module/rtc_core/sections/.text b/test/sys/module/rtc_core/sections/.text new file mode 100644 index 0000000000..fcc02a2cb0 --- /dev/null +++ b/test/sys/module/rtc_core/sections/.text @@ -0,0 +1 @@ +0xffffffffa00e8000 diff --git a/test/sys/module/rtc_core/sections/__kcrctab_gpl b/test/sys/module/rtc_core/sections/__kcrctab_gpl new file mode 100644 index 0000000000..8025c3c5b9 --- /dev/null +++ b/test/sys/module/rtc_core/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa00ea460 diff --git a/test/sys/module/rtc_core/sections/__ksymtab_gpl b/test/sys/module/rtc_core/sections/__ksymtab_gpl new file mode 100644 index 0000000000..c6a8ba83c4 --- /dev/null +++ b/test/sys/module/rtc_core/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa00ea380 diff --git a/test/sys/module/rtc_core/sections/__ksymtab_strings b/test/sys/module/rtc_core/sections/__ksymtab_strings new file mode 100644 index 0000000000..b05143195e --- /dev/null +++ b/test/sys/module/rtc_core/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa00ea4d0 diff --git a/test/sys/module/rtc_core/srcversion b/test/sys/module/rtc_core/srcversion new file mode 100644 index 0000000000..4f5a2b57d3 --- /dev/null +++ b/test/sys/module/rtc_core/srcversion @@ -0,0 +1 @@ +8684A14821938B7D8E50DB5 diff --git a/test/sys/module/rtc_lib/holders/rtc_core b/test/sys/module/rtc_lib/holders/rtc_core new file mode 120000 index 0000000000..5dc3e7583c --- /dev/null +++ b/test/sys/module/rtc_lib/holders/rtc_core @@ -0,0 +1 @@ +../../rtc_core \ No newline at end of file diff --git a/test/sys/module/rtc_lib/initstate b/test/sys/module/rtc_lib/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/rtc_lib/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/rtc_lib/notes/.note.gnu.build-id b/test/sys/module/rtc_lib/notes/.note.gnu.build-id new file mode 100644 index 0000000000..0e371ebe87 Binary files /dev/null and b/test/sys/module/rtc_lib/notes/.note.gnu.build-id differ diff --git a/test/sys/module/rtc_lib/refcnt b/test/sys/module/rtc_lib/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/rtc_lib/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/rtc_lib/sections/.bss b/test/sys/module/rtc_lib/sections/.bss new file mode 100644 index 0000000000..5636fe5354 --- /dev/null +++ b/test/sys/module/rtc_lib/sections/.bss @@ -0,0 +1 @@ +0xffffffffa009cf80 diff --git a/test/sys/module/rtc_lib/sections/.data b/test/sys/module/rtc_lib/sections/.data new file mode 100644 index 0000000000..039432bb30 --- /dev/null +++ b/test/sys/module/rtc_lib/sections/.data @@ -0,0 +1 @@ +0xffffffffa009cba8 diff --git a/test/sys/module/rtc_lib/sections/.gnu.linkonce.this_module b/test/sys/module/rtc_lib/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..33df9fd7d3 --- /dev/null +++ b/test/sys/module/rtc_lib/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa009cbc0 diff --git a/test/sys/module/rtc_lib/sections/.note.gnu.build-id b/test/sys/module/rtc_lib/sections/.note.gnu.build-id new file mode 100644 index 0000000000..b8d1d07cea --- /dev/null +++ b/test/sys/module/rtc_lib/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa009c31c diff --git a/test/sys/module/rtc_lib/sections/.rodata b/test/sys/module/rtc_lib/sections/.rodata new file mode 100644 index 0000000000..210c138214 --- /dev/null +++ b/test/sys/module/rtc_lib/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa009c340 diff --git a/test/sys/module/rtc_lib/sections/.strtab b/test/sys/module/rtc_lib/sections/.strtab new file mode 100644 index 0000000000..0b35af1d8d --- /dev/null +++ b/test/sys/module/rtc_lib/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa009c8f0 diff --git a/test/sys/module/rtc_lib/sections/.symtab b/test/sys/module/rtc_lib/sections/.symtab new file mode 100644 index 0000000000..18514173ba --- /dev/null +++ b/test/sys/module/rtc_lib/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa009c440 diff --git a/test/sys/module/rtc_lib/sections/.text b/test/sys/module/rtc_lib/sections/.text new file mode 100644 index 0000000000..c9f48f1e53 --- /dev/null +++ b/test/sys/module/rtc_lib/sections/.text @@ -0,0 +1 @@ +0xffffffffa009c000 diff --git a/test/sys/module/rtc_lib/sections/__kcrctab b/test/sys/module/rtc_lib/sections/__kcrctab new file mode 100644 index 0000000000..043e1e8d33 --- /dev/null +++ b/test/sys/module/rtc_lib/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa009c3d0 diff --git a/test/sys/module/rtc_lib/sections/__ksymtab b/test/sys/module/rtc_lib/sections/__ksymtab new file mode 100644 index 0000000000..fb41ab0494 --- /dev/null +++ b/test/sys/module/rtc_lib/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa009c380 diff --git a/test/sys/module/rtc_lib/sections/__ksymtab_strings b/test/sys/module/rtc_lib/sections/__ksymtab_strings new file mode 100644 index 0000000000..7809d296a2 --- /dev/null +++ b/test/sys/module/rtc_lib/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa009c3f8 diff --git a/test/sys/module/rtc_lib/srcversion b/test/sys/module/rtc_lib/srcversion new file mode 100644 index 0000000000..12c16a9a8f --- /dev/null +++ b/test/sys/module/rtc_lib/srcversion @@ -0,0 +1 @@ +7884E7FF8728D88C6BD1427 diff --git a/test/sys/module/scsi_mod/parameters/default_dev_flags b/test/sys/module/scsi_mod/parameters/default_dev_flags new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/scsi_mod/parameters/default_dev_flags @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/scsi_mod/parameters/inq_timeout b/test/sys/module/scsi_mod/parameters/inq_timeout new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/module/scsi_mod/parameters/inq_timeout @@ -0,0 +1 @@ +5 diff --git a/test/sys/module/scsi_mod/parameters/max_luns b/test/sys/module/scsi_mod/parameters/max_luns new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/module/scsi_mod/parameters/max_luns @@ -0,0 +1 @@ +512 diff --git a/test/sys/module/scsi_mod/parameters/max_report_luns b/test/sys/module/scsi_mod/parameters/max_report_luns new file mode 100644 index 0000000000..c0556fb20f --- /dev/null +++ b/test/sys/module/scsi_mod/parameters/max_report_luns @@ -0,0 +1 @@ +511 diff --git a/test/sys/module/scsi_mod/parameters/scan b/test/sys/module/scsi_mod/parameters/scan new file mode 100644 index 0000000000..def1d9c60e --- /dev/null +++ b/test/sys/module/scsi_mod/parameters/scan @@ -0,0 +1 @@ +sync diff --git a/test/sys/module/scsi_mod/parameters/scsi_logging_level b/test/sys/module/scsi_mod/parameters/scsi_logging_level new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/scsi_mod/parameters/scsi_logging_level @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/sg/initstate b/test/sys/module/sg/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/sg/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/sg/notes/.note.gnu.build-id b/test/sys/module/sg/notes/.note.gnu.build-id new file mode 100644 index 0000000000..33cc39ee9c Binary files /dev/null and b/test/sys/module/sg/notes/.note.gnu.build-id differ diff --git a/test/sys/module/sg/parameters/allow_dio b/test/sys/module/sg/parameters/allow_dio new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/sg/parameters/allow_dio @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/sg/parameters/def_reserved_size b/test/sys/module/sg/parameters/def_reserved_size new file mode 100644 index 0000000000..dce60d44b8 --- /dev/null +++ b/test/sys/module/sg/parameters/def_reserved_size @@ -0,0 +1 @@ +32768 diff --git a/test/sys/module/sg/parameters/scatter_elem_sz b/test/sys/module/sg/parameters/scatter_elem_sz new file mode 100644 index 0000000000..dce60d44b8 --- /dev/null +++ b/test/sys/module/sg/parameters/scatter_elem_sz @@ -0,0 +1 @@ +32768 diff --git a/test/sys/module/sg/refcnt b/test/sys/module/sg/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/sg/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/sg/sections/.bss b/test/sys/module/sg/sections/.bss new file mode 100644 index 0000000000..70e81445a4 --- /dev/null +++ b/test/sys/module/sg/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0007640 diff --git a/test/sys/module/sg/sections/.data b/test/sys/module/sg/sections/.data new file mode 100644 index 0000000000..18cc37535f --- /dev/null +++ b/test/sys/module/sg/sections/.data @@ -0,0 +1 @@ +0xffffffffa0007040 diff --git a/test/sys/module/sg/sections/.exit.text b/test/sys/module/sg/sections/.exit.text new file mode 100644 index 0000000000..cb589964f0 --- /dev/null +++ b/test/sys/module/sg/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00049f0 diff --git a/test/sys/module/sg/sections/.fixup b/test/sys/module/sg/sections/.fixup new file mode 100644 index 0000000000..f51d7134a9 --- /dev/null +++ b/test/sys/module/sg/sections/.fixup @@ -0,0 +1 @@ +0xffffffffa0004a33 diff --git a/test/sys/module/sg/sections/.gnu.linkonce.this_module b/test/sys/module/sg/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..c2a774833d --- /dev/null +++ b/test/sys/module/sg/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0007280 diff --git a/test/sys/module/sg/sections/.init.text b/test/sys/module/sg/sections/.init.text new file mode 100644 index 0000000000..bebf649c98 --- /dev/null +++ b/test/sys/module/sg/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0009000 diff --git a/test/sys/module/sg/sections/.note.gnu.build-id b/test/sys/module/sg/sections/.note.gnu.build-id new file mode 100644 index 0000000000..24754118f5 --- /dev/null +++ b/test/sys/module/sg/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0004afc diff --git a/test/sys/module/sg/sections/.rodata b/test/sys/module/sg/sections/.rodata new file mode 100644 index 0000000000..3efeea401d --- /dev/null +++ b/test/sys/module/sg/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0004b20 diff --git a/test/sys/module/sg/sections/.rodata.str1.1 b/test/sys/module/sg/sections/.rodata.str1.1 new file mode 100644 index 0000000000..a95725c0f4 --- /dev/null +++ b/test/sys/module/sg/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0004bc0 diff --git a/test/sys/module/sg/sections/.smp_locks b/test/sys/module/sg/sections/.smp_locks new file mode 100644 index 0000000000..fb6985841c --- /dev/null +++ b/test/sys/module/sg/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa00054d8 diff --git a/test/sys/module/sg/sections/.strtab b/test/sys/module/sg/sections/.strtab new file mode 100644 index 0000000000..0c1f8f0b78 --- /dev/null +++ b/test/sys/module/sg/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0006710 diff --git a/test/sys/module/sg/sections/.symtab b/test/sys/module/sg/sections/.symtab new file mode 100644 index 0000000000..6b98409cf0 --- /dev/null +++ b/test/sys/module/sg/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00056a8 diff --git a/test/sys/module/sg/sections/.text b/test/sys/module/sg/sections/.text new file mode 100644 index 0000000000..57cc208a8b --- /dev/null +++ b/test/sys/module/sg/sections/.text @@ -0,0 +1 @@ +0xffffffffa0000000 diff --git a/test/sys/module/sg/sections/__bug_table b/test/sys/module/sg/sections/__bug_table new file mode 100644 index 0000000000..a1ebdb1de1 --- /dev/null +++ b/test/sys/module/sg/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa00054e8 diff --git a/test/sys/module/sg/sections/__ex_table b/test/sys/module/sg/sections/__ex_table new file mode 100644 index 0000000000..43a780055c --- /dev/null +++ b/test/sys/module/sg/sections/__ex_table @@ -0,0 +1 @@ +0xffffffffa0005530 diff --git a/test/sys/module/sg/sections/__param b/test/sys/module/sg/sections/__param new file mode 100644 index 0000000000..b4ea97d654 --- /dev/null +++ b/test/sys/module/sg/sections/__param @@ -0,0 +1 @@ +0xffffffffa0005630 diff --git a/test/sys/module/sg/srcversion b/test/sys/module/sg/srcversion new file mode 100644 index 0000000000..fe620fbb2d --- /dev/null +++ b/test/sys/module/sg/srcversion @@ -0,0 +1 @@ +DC7DE342543B6D7AB46D718 diff --git a/test/sys/module/sg/version b/test/sys/module/sg/version new file mode 100644 index 0000000000..b9687cca65 --- /dev/null +++ b/test/sys/module/sg/version @@ -0,0 +1 @@ +3.5.34 diff --git a/test/sys/module/snd/holders/snd_hda_intel b/test/sys/module/snd/holders/snd_hda_intel new file mode 120000 index 0000000000..60eae0503e --- /dev/null +++ b/test/sys/module/snd/holders/snd_hda_intel @@ -0,0 +1 @@ +../../snd_hda_intel \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_mixer_oss b/test/sys/module/snd/holders/snd_mixer_oss new file mode 120000 index 0000000000..d7bdae620f --- /dev/null +++ b/test/sys/module/snd/holders/snd_mixer_oss @@ -0,0 +1 @@ +../../snd_mixer_oss \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_pcm b/test/sys/module/snd/holders/snd_pcm new file mode 120000 index 0000000000..0eaac02ed1 --- /dev/null +++ b/test/sys/module/snd/holders/snd_pcm @@ -0,0 +1 @@ +../../snd_pcm \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_pcm_oss b/test/sys/module/snd/holders/snd_pcm_oss new file mode 120000 index 0000000000..dd2f3b9915 --- /dev/null +++ b/test/sys/module/snd/holders/snd_pcm_oss @@ -0,0 +1 @@ +../../snd_pcm_oss \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_seq b/test/sys/module/snd/holders/snd_seq new file mode 120000 index 0000000000..fbac6b8360 --- /dev/null +++ b/test/sys/module/snd/holders/snd_seq @@ -0,0 +1 @@ +../../snd_seq \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_seq_device b/test/sys/module/snd/holders/snd_seq_device new file mode 120000 index 0000000000..830042ec6d --- /dev/null +++ b/test/sys/module/snd/holders/snd_seq_device @@ -0,0 +1 @@ +../../snd_seq_device \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_timer b/test/sys/module/snd/holders/snd_timer new file mode 120000 index 0000000000..988e3f661d --- /dev/null +++ b/test/sys/module/snd/holders/snd_timer @@ -0,0 +1 @@ +../../snd_timer \ No newline at end of file diff --git a/test/sys/module/snd/initstate b/test/sys/module/snd/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/snd/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/snd/notes/.note.gnu.build-id b/test/sys/module/snd/notes/.note.gnu.build-id new file mode 100644 index 0000000000..015a8df2a4 Binary files /dev/null and b/test/sys/module/snd/notes/.note.gnu.build-id differ diff --git a/test/sys/module/snd/parameters/cards_limit b/test/sys/module/snd/parameters/cards_limit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/snd/parameters/cards_limit @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/snd/parameters/major b/test/sys/module/snd/parameters/major new file mode 100644 index 0000000000..4699eb3cc9 --- /dev/null +++ b/test/sys/module/snd/parameters/major @@ -0,0 +1 @@ +116 diff --git a/test/sys/module/snd/parameters/slots b/test/sys/module/snd/parameters/slots new file mode 100644 index 0000000000..dcd518e031 --- /dev/null +++ b/test/sys/module/snd/parameters/slots @@ -0,0 +1 @@ +snd-hda-intel,,,,,,, diff --git a/test/sys/module/snd/refcnt b/test/sys/module/snd/refcnt new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/module/snd/refcnt @@ -0,0 +1 @@ +13 diff --git a/test/sys/module/snd/sections/.bss b/test/sys/module/snd/sections/.bss new file mode 100644 index 0000000000..f8ddba087d --- /dev/null +++ b/test/sys/module/snd/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00da480 diff --git a/test/sys/module/snd/sections/.data b/test/sys/module/snd/sections/.data new file mode 100644 index 0000000000..d61c05c38d --- /dev/null +++ b/test/sys/module/snd/sections/.data @@ -0,0 +1 @@ +0xffffffffa00d9be0 diff --git a/test/sys/module/snd/sections/.exit.text b/test/sys/module/snd/sections/.exit.text new file mode 100644 index 0000000000..d37277b149 --- /dev/null +++ b/test/sys/module/snd/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00d1bc4 diff --git a/test/sys/module/snd/sections/.gnu.linkonce.this_module b/test/sys/module/snd/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..3971c4e782 --- /dev/null +++ b/test/sys/module/snd/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00da0c0 diff --git a/test/sys/module/snd/sections/.init.text b/test/sys/module/snd/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/snd/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/snd/sections/.note.gnu.build-id b/test/sys/module/snd/sections/.note.gnu.build-id new file mode 100644 index 0000000000..cc765d8e67 --- /dev/null +++ b/test/sys/module/snd/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00d1c8c diff --git a/test/sys/module/snd/sections/.rodata b/test/sys/module/snd/sections/.rodata new file mode 100644 index 0000000000..58c871309d --- /dev/null +++ b/test/sys/module/snd/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00d1cc0 diff --git a/test/sys/module/snd/sections/.rodata.str1.1 b/test/sys/module/snd/sections/.rodata.str1.1 new file mode 100644 index 0000000000..cd74d97c4d --- /dev/null +++ b/test/sys/module/snd/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00d2558 diff --git a/test/sys/module/snd/sections/.strtab b/test/sys/module/snd/sections/.strtab new file mode 100644 index 0000000000..ed1d92298b --- /dev/null +++ b/test/sys/module/snd/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00d6cc8 diff --git a/test/sys/module/snd/sections/.symtab b/test/sys/module/snd/sections/.symtab new file mode 100644 index 0000000000..6b000a666e --- /dev/null +++ b/test/sys/module/snd/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00d3770 diff --git a/test/sys/module/snd/sections/.text b/test/sys/module/snd/sections/.text new file mode 100644 index 0000000000..f0a65bd3df --- /dev/null +++ b/test/sys/module/snd/sections/.text @@ -0,0 +1 @@ +0xffffffffa00ca000 diff --git a/test/sys/module/snd/sections/__kcrctab b/test/sys/module/snd/sections/__kcrctab new file mode 100644 index 0000000000..680383976e --- /dev/null +++ b/test/sys/module/snd/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa00d30a0 diff --git a/test/sys/module/snd/sections/__ksymtab b/test/sys/module/snd/sections/__ksymtab new file mode 100644 index 0000000000..7b8205b90c --- /dev/null +++ b/test/sys/module/snd/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa00d2d00 diff --git a/test/sys/module/snd/sections/__ksymtab_strings b/test/sys/module/snd/sections/__ksymtab_strings new file mode 100644 index 0000000000..4d9ab113bd --- /dev/null +++ b/test/sys/module/snd/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa00d32e8 diff --git a/test/sys/module/snd/sections/__param b/test/sys/module/snd/sections/__param new file mode 100644 index 0000000000..5a8e6a71b8 --- /dev/null +++ b/test/sys/module/snd/sections/__param @@ -0,0 +1 @@ +0xffffffffa00d3270 diff --git a/test/sys/module/snd/srcversion b/test/sys/module/snd/srcversion new file mode 100644 index 0000000000..e296f686ab --- /dev/null +++ b/test/sys/module/snd/srcversion @@ -0,0 +1 @@ +D48337942305C9A41A7CC12 diff --git a/test/sys/module/snd_hda_intel/drivers/pci:HDA Intel b/test/sys/module/snd_hda_intel/drivers/pci:HDA Intel new file mode 120000 index 0000000000..5e8e0d3965 --- /dev/null +++ b/test/sys/module/snd_hda_intel/drivers/pci:HDA Intel @@ -0,0 +1 @@ +../../../bus/pci/drivers/HDA Intel \ No newline at end of file diff --git a/test/sys/module/snd_hda_intel/initstate b/test/sys/module/snd_hda_intel/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/snd_hda_intel/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/snd_hda_intel/notes/.note.gnu.build-id b/test/sys/module/snd_hda_intel/notes/.note.gnu.build-id new file mode 100644 index 0000000000..a9a78416d3 Binary files /dev/null and b/test/sys/module/snd_hda_intel/notes/.note.gnu.build-id differ diff --git a/test/sys/module/snd_hda_intel/parameters/bdl_pos_adj b/test/sys/module/snd_hda_intel/parameters/bdl_pos_adj new file mode 100644 index 0000000000..a870a0c0b1 --- /dev/null +++ b/test/sys/module/snd_hda_intel/parameters/bdl_pos_adj @@ -0,0 +1 @@ +1,-1,-1,-1,-1,-1,-1,-1 diff --git a/test/sys/module/snd_hda_intel/parameters/enable b/test/sys/module/snd_hda_intel/parameters/enable new file mode 100644 index 0000000000..426c63aac1 --- /dev/null +++ b/test/sys/module/snd_hda_intel/parameters/enable @@ -0,0 +1 @@ +Y,Y,Y,Y,Y,Y,Y,Y diff --git a/test/sys/module/snd_hda_intel/parameters/enable_msi b/test/sys/module/snd_hda_intel/parameters/enable_msi new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/snd_hda_intel/parameters/enable_msi @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/snd_hda_intel/parameters/id b/test/sys/module/snd_hda_intel/parameters/id new file mode 100644 index 0000000000..23086d6f3d --- /dev/null +++ b/test/sys/module/snd_hda_intel/parameters/id @@ -0,0 +1 @@ +,,,,,,, diff --git a/test/sys/module/snd_hda_intel/parameters/index b/test/sys/module/snd_hda_intel/parameters/index new file mode 100644 index 0000000000..b9e59f0d64 --- /dev/null +++ b/test/sys/module/snd_hda_intel/parameters/index @@ -0,0 +1 @@ +-1,-1,-1,-1,-1,-1,-1,-1 diff --git a/test/sys/module/snd_hda_intel/parameters/model b/test/sys/module/snd_hda_intel/parameters/model new file mode 100644 index 0000000000..23086d6f3d --- /dev/null +++ b/test/sys/module/snd_hda_intel/parameters/model @@ -0,0 +1 @@ +,,,,,,, diff --git a/test/sys/module/snd_hda_intel/parameters/position_fix b/test/sys/module/snd_hda_intel/parameters/position_fix new file mode 100644 index 0000000000..b9ead4f049 --- /dev/null +++ b/test/sys/module/snd_hda_intel/parameters/position_fix @@ -0,0 +1 @@ +0,0,0,0,0,0,0,0 diff --git a/test/sys/module/snd_hda_intel/parameters/probe_mask b/test/sys/module/snd_hda_intel/parameters/probe_mask new file mode 100644 index 0000000000..a870a0c0b1 --- /dev/null +++ b/test/sys/module/snd_hda_intel/parameters/probe_mask @@ -0,0 +1 @@ +1,-1,-1,-1,-1,-1,-1,-1 diff --git a/test/sys/module/snd_hda_intel/parameters/single_cmd b/test/sys/module/snd_hda_intel/parameters/single_cmd new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/snd_hda_intel/parameters/single_cmd @@ -0,0 +1 @@ +N diff --git a/test/sys/module/snd_hda_intel/refcnt b/test/sys/module/snd_hda_intel/refcnt new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/module/snd_hda_intel/refcnt @@ -0,0 +1 @@ +3 diff --git a/test/sys/module/snd_hda_intel/sections/.bss b/test/sys/module/snd_hda_intel/sections/.bss new file mode 100644 index 0000000000..89e0252f07 --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.bss @@ -0,0 +1 @@ +0xffffffffa01d7800 diff --git a/test/sys/module/snd_hda_intel/sections/.data b/test/sys/module/snd_hda_intel/sections/.data new file mode 100644 index 0000000000..2bad8a7aac --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.data @@ -0,0 +1 @@ +0xffffffffa019bd40 diff --git a/test/sys/module/snd_hda_intel/sections/.devexit.text b/test/sys/module/snd_hda_intel/sections/.devexit.text new file mode 100644 index 0000000000..006fa6986f --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.devexit.text @@ -0,0 +1 @@ +0xffffffffa0182a6a diff --git a/test/sys/module/snd_hda_intel/sections/.devinit.data b/test/sys/module/snd_hda_intel/sections/.devinit.data new file mode 100644 index 0000000000..ed7a654471 --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.devinit.data @@ -0,0 +1 @@ +0xffffffffa01d7340 diff --git a/test/sys/module/snd_hda_intel/sections/.devinit.text b/test/sys/module/snd_hda_intel/sections/.devinit.text new file mode 100644 index 0000000000..85a94662d6 --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.devinit.text @@ -0,0 +1 @@ +0xffffffffa0182aa0 diff --git a/test/sys/module/snd_hda_intel/sections/.exit.text b/test/sys/module/snd_hda_intel/sections/.exit.text new file mode 100644 index 0000000000..31a498c1dd --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0182a58 diff --git a/test/sys/module/snd_hda_intel/sections/.gnu.linkonce.this_module b/test/sys/module/snd_hda_intel/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..9a1ddedad0 --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa01d7440 diff --git a/test/sys/module/snd_hda_intel/sections/.init.text b/test/sys/module/snd_hda_intel/sections/.init.text new file mode 100644 index 0000000000..0cac0d19cf --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0070000 diff --git a/test/sys/module/snd_hda_intel/sections/.note.gnu.build-id b/test/sys/module/snd_hda_intel/sections/.note.gnu.build-id new file mode 100644 index 0000000000..c0e048a5d8 --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0183f4c diff --git a/test/sys/module/snd_hda_intel/sections/.rodata b/test/sys/module/snd_hda_intel/sections/.rodata new file mode 100644 index 0000000000..055db77b6e --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0183f80 diff --git a/test/sys/module/snd_hda_intel/sections/.rodata.str1.1 b/test/sys/module/snd_hda_intel/sections/.rodata.str1.1 new file mode 100644 index 0000000000..183cd25a89 --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0186d8b diff --git a/test/sys/module/snd_hda_intel/sections/.strtab b/test/sys/module/snd_hda_intel/sections/.strtab new file mode 100644 index 0000000000..5e37a81bf8 --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0193910 diff --git a/test/sys/module/snd_hda_intel/sections/.symtab b/test/sys/module/snd_hda_intel/sections/.symtab new file mode 100644 index 0000000000..d41e0ecb52 --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0189f50 diff --git a/test/sys/module/snd_hda_intel/sections/.text b/test/sys/module/snd_hda_intel/sections/.text new file mode 100644 index 0000000000..1b8f754a8a --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/.text @@ -0,0 +1 @@ +0xffffffffa0165000 diff --git a/test/sys/module/snd_hda_intel/sections/__param b/test/sys/module/snd_hda_intel/sections/__param new file mode 100644 index 0000000000..f55dd5eec3 --- /dev/null +++ b/test/sys/module/snd_hda_intel/sections/__param @@ -0,0 +1 @@ +0xffffffffa0189de8 diff --git a/test/sys/module/snd_hda_intel/srcversion b/test/sys/module/snd_hda_intel/srcversion new file mode 100644 index 0000000000..0c87af8d52 --- /dev/null +++ b/test/sys/module/snd_hda_intel/srcversion @@ -0,0 +1 @@ +B76633A09F11336101E5480 diff --git a/test/sys/module/snd_mixer_oss/holders/snd_pcm_oss b/test/sys/module/snd_mixer_oss/holders/snd_pcm_oss new file mode 120000 index 0000000000..dd2f3b9915 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/holders/snd_pcm_oss @@ -0,0 +1 @@ +../../snd_pcm_oss \ No newline at end of file diff --git a/test/sys/module/snd_mixer_oss/initstate b/test/sys/module/snd_mixer_oss/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/snd_mixer_oss/notes/.note.gnu.build-id b/test/sys/module/snd_mixer_oss/notes/.note.gnu.build-id new file mode 100644 index 0000000000..b85562083b Binary files /dev/null and b/test/sys/module/snd_mixer_oss/notes/.note.gnu.build-id differ diff --git a/test/sys/module/snd_mixer_oss/refcnt b/test/sys/module/snd_mixer_oss/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/snd_mixer_oss/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/snd_mixer_oss/sections/.bss b/test/sys/module/snd_mixer_oss/sections/.bss new file mode 100644 index 0000000000..34e5d4676a --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02bd240 diff --git a/test/sys/module/snd_mixer_oss/sections/.data b/test/sys/module/snd_mixer_oss/sections/.data new file mode 100644 index 0000000000..d6c2c51545 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.data @@ -0,0 +1 @@ +0xffffffffa02bcb20 diff --git a/test/sys/module/snd_mixer_oss/sections/.exit.text b/test/sys/module/snd_mixer_oss/sections/.exit.text new file mode 100644 index 0000000000..e982fd28fa --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02bb508 diff --git a/test/sys/module/snd_mixer_oss/sections/.gnu.linkonce.this_module b/test/sys/module/snd_mixer_oss/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..d3d8ad56e4 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02bce80 diff --git a/test/sys/module/snd_mixer_oss/sections/.init.text b/test/sys/module/snd_mixer_oss/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/snd_mixer_oss/sections/.note.gnu.build-id b/test/sys/module/snd_mixer_oss/sections/.note.gnu.build-id new file mode 100644 index 0000000000..86f4f2321c --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02bb54c diff --git a/test/sys/module/snd_mixer_oss/sections/.rodata b/test/sys/module/snd_mixer_oss/sections/.rodata new file mode 100644 index 0000000000..7ca44d2bf5 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa02bb580 diff --git a/test/sys/module/snd_mixer_oss/sections/.rodata.str1.1 b/test/sys/module/snd_mixer_oss/sections/.rodata.str1.1 new file mode 100644 index 0000000000..3a6c6c0004 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa02bb760 diff --git a/test/sys/module/snd_mixer_oss/sections/.strtab b/test/sys/module/snd_mixer_oss/sections/.strtab new file mode 100644 index 0000000000..823ab6d78b --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02bc470 diff --git a/test/sys/module/snd_mixer_oss/sections/.symtab b/test/sys/module/snd_mixer_oss/sections/.symtab new file mode 100644 index 0000000000..047bfadc81 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02bba98 diff --git a/test/sys/module/snd_mixer_oss/sections/.text b/test/sys/module/snd_mixer_oss/sections/.text new file mode 100644 index 0000000000..688f9d336b --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/.text @@ -0,0 +1 @@ +0xffffffffa02b9000 diff --git a/test/sys/module/snd_mixer_oss/sections/__kcrctab b/test/sys/module/snd_mixer_oss/sections/__kcrctab new file mode 100644 index 0000000000..7a01b310a0 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa02bba70 diff --git a/test/sys/module/snd_mixer_oss/sections/__ksymtab b/test/sys/module/snd_mixer_oss/sections/__ksymtab new file mode 100644 index 0000000000..538586a5c0 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa02bba60 diff --git a/test/sys/module/snd_mixer_oss/sections/__ksymtab_strings b/test/sys/module/snd_mixer_oss/sections/__ksymtab_strings new file mode 100644 index 0000000000..47bfe39613 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa02bba78 diff --git a/test/sys/module/snd_mixer_oss/srcversion b/test/sys/module/snd_mixer_oss/srcversion new file mode 100644 index 0000000000..041fd6fa09 --- /dev/null +++ b/test/sys/module/snd_mixer_oss/srcversion @@ -0,0 +1 @@ +9D2BFE821DD0ACFA2CFF364 diff --git a/test/sys/module/snd_page_alloc/holders/snd_hda_intel b/test/sys/module/snd_page_alloc/holders/snd_hda_intel new file mode 120000 index 0000000000..60eae0503e --- /dev/null +++ b/test/sys/module/snd_page_alloc/holders/snd_hda_intel @@ -0,0 +1 @@ +../../snd_hda_intel \ No newline at end of file diff --git a/test/sys/module/snd_page_alloc/holders/snd_pcm b/test/sys/module/snd_page_alloc/holders/snd_pcm new file mode 120000 index 0000000000..0eaac02ed1 --- /dev/null +++ b/test/sys/module/snd_page_alloc/holders/snd_pcm @@ -0,0 +1 @@ +../../snd_pcm \ No newline at end of file diff --git a/test/sys/module/snd_page_alloc/initstate b/test/sys/module/snd_page_alloc/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/snd_page_alloc/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/snd_page_alloc/notes/.note.gnu.build-id b/test/sys/module/snd_page_alloc/notes/.note.gnu.build-id new file mode 100644 index 0000000000..e1b8096a51 Binary files /dev/null and b/test/sys/module/snd_page_alloc/notes/.note.gnu.build-id differ diff --git a/test/sys/module/snd_page_alloc/refcnt b/test/sys/module/snd_page_alloc/refcnt new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/snd_page_alloc/refcnt @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/snd_page_alloc/sections/.bss b/test/sys/module/snd_page_alloc/sections/.bss new file mode 100644 index 0000000000..1ede619946 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0036780 diff --git a/test/sys/module/snd_page_alloc/sections/.data b/test/sys/module/snd_page_alloc/sections/.data new file mode 100644 index 0000000000..9e25ccfa03 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.data @@ -0,0 +1 @@ +0xffffffffa0036300 diff --git a/test/sys/module/snd_page_alloc/sections/.exit.text b/test/sys/module/snd_page_alloc/sections/.exit.text new file mode 100644 index 0000000000..e6c8cefae1 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0034cc0 diff --git a/test/sys/module/snd_page_alloc/sections/.gnu.linkonce.this_module b/test/sys/module/snd_page_alloc/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..b9b31348a8 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00363c0 diff --git a/test/sys/module/snd_page_alloc/sections/.init.text b/test/sys/module/snd_page_alloc/sections/.init.text new file mode 100644 index 0000000000..18822d3d85 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0038000 diff --git a/test/sys/module/snd_page_alloc/sections/.note.gnu.build-id b/test/sys/module/snd_page_alloc/sections/.note.gnu.build-id new file mode 100644 index 0000000000..7dc3a3d99f --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0034cf8 diff --git a/test/sys/module/snd_page_alloc/sections/.rodata b/test/sys/module/snd_page_alloc/sections/.rodata new file mode 100644 index 0000000000..4e5576b471 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0034d20 diff --git a/test/sys/module/snd_page_alloc/sections/.rodata.str1.1 b/test/sys/module/snd_page_alloc/sections/.rodata.str1.1 new file mode 100644 index 0000000000..1fdcb5dc87 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0034fd5 diff --git a/test/sys/module/snd_page_alloc/sections/.strtab b/test/sys/module/snd_page_alloc/sections/.strtab new file mode 100644 index 0000000000..f4f9e49156 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0035be8 diff --git a/test/sys/module/snd_page_alloc/sections/.symtab b/test/sys/module/snd_page_alloc/sections/.symtab new file mode 100644 index 0000000000..ce21f5e780 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0035180 diff --git a/test/sys/module/snd_page_alloc/sections/.text b/test/sys/module/snd_page_alloc/sections/.text new file mode 100644 index 0000000000..438d2016db --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/.text @@ -0,0 +1 @@ +0xffffffffa0034000 diff --git a/test/sys/module/snd_page_alloc/sections/__kcrctab b/test/sys/module/snd_page_alloc/sections/__kcrctab new file mode 100644 index 0000000000..24280f2f6f --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa00350b0 diff --git a/test/sys/module/snd_page_alloc/sections/__ksymtab b/test/sys/module/snd_page_alloc/sections/__ksymtab new file mode 100644 index 0000000000..ce296cd45b --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa0035040 diff --git a/test/sys/module/snd_page_alloc/sections/__ksymtab_strings b/test/sys/module/snd_page_alloc/sections/__ksymtab_strings new file mode 100644 index 0000000000..ccb7535438 --- /dev/null +++ b/test/sys/module/snd_page_alloc/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa00350e8 diff --git a/test/sys/module/snd_page_alloc/srcversion b/test/sys/module/snd_page_alloc/srcversion new file mode 100644 index 0000000000..c3e8eda5b9 --- /dev/null +++ b/test/sys/module/snd_page_alloc/srcversion @@ -0,0 +1 @@ +D9E59C27F28D5DA2B935016 diff --git a/test/sys/module/snd_pcm/holders/snd_hda_intel b/test/sys/module/snd_pcm/holders/snd_hda_intel new file mode 120000 index 0000000000..60eae0503e --- /dev/null +++ b/test/sys/module/snd_pcm/holders/snd_hda_intel @@ -0,0 +1 @@ +../../snd_hda_intel \ No newline at end of file diff --git a/test/sys/module/snd_pcm/holders/snd_pcm_oss b/test/sys/module/snd_pcm/holders/snd_pcm_oss new file mode 120000 index 0000000000..dd2f3b9915 --- /dev/null +++ b/test/sys/module/snd_pcm/holders/snd_pcm_oss @@ -0,0 +1 @@ +../../snd_pcm_oss \ No newline at end of file diff --git a/test/sys/module/snd_pcm/initstate b/test/sys/module/snd_pcm/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/snd_pcm/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/snd_pcm/notes/.note.gnu.build-id b/test/sys/module/snd_pcm/notes/.note.gnu.build-id new file mode 100644 index 0000000000..3723d83515 Binary files /dev/null and b/test/sys/module/snd_pcm/notes/.note.gnu.build-id differ diff --git a/test/sys/module/snd_pcm/parameters/maximum_substreams b/test/sys/module/snd_pcm/parameters/maximum_substreams new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/module/snd_pcm/parameters/maximum_substreams @@ -0,0 +1 @@ +4 diff --git a/test/sys/module/snd_pcm/parameters/preallocate_dma b/test/sys/module/snd_pcm/parameters/preallocate_dma new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/snd_pcm/parameters/preallocate_dma @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/snd_pcm/refcnt b/test/sys/module/snd_pcm/refcnt new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/snd_pcm/refcnt @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/snd_pcm/sections/.bss b/test/sys/module/snd_pcm/sections/.bss new file mode 100644 index 0000000000..2faa4b2844 --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0149640 diff --git a/test/sys/module/snd_pcm/sections/.data b/test/sys/module/snd_pcm/sections/.data new file mode 100644 index 0000000000..ec00353a31 --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.data @@ -0,0 +1 @@ +0xffffffffa0148b60 diff --git a/test/sys/module/snd_pcm/sections/.exit.text b/test/sys/module/snd_pcm/sections/.exit.text new file mode 100644 index 0000000000..337356658f --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa01401d4 diff --git a/test/sys/module/snd_pcm/sections/.fixup b/test/sys/module/snd_pcm/sections/.fixup new file mode 100644 index 0000000000..9694c327fb --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.fixup @@ -0,0 +1 @@ +0xffffffffa01401fe diff --git a/test/sys/module/snd_pcm/sections/.gnu.linkonce.this_module b/test/sys/module/snd_pcm/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..c69b8754af --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0149280 diff --git a/test/sys/module/snd_pcm/sections/.init.text b/test/sys/module/snd_pcm/sections/.init.text new file mode 100644 index 0000000000..3e03f3c0fc --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa007d000 diff --git a/test/sys/module/snd_pcm/sections/.note.gnu.build-id b/test/sys/module/snd_pcm/sections/.note.gnu.build-id new file mode 100644 index 0000000000..634e55ee13 --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0140260 diff --git a/test/sys/module/snd_pcm/sections/.rodata b/test/sys/module/snd_pcm/sections/.rodata new file mode 100644 index 0000000000..0f36365e2a --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa01402a0 diff --git a/test/sys/module/snd_pcm/sections/.rodata.str1.1 b/test/sys/module/snd_pcm/sections/.rodata.str1.1 new file mode 100644 index 0000000000..107983a295 --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0140930 diff --git a/test/sys/module/snd_pcm/sections/.smp_locks b/test/sys/module/snd_pcm/sections/.smp_locks new file mode 100644 index 0000000000..79289d231b --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa0141af8 diff --git a/test/sys/module/snd_pcm/sections/.strtab b/test/sys/module/snd_pcm/sections/.strtab new file mode 100644 index 0000000000..ddf5dc1a6d --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0145428 diff --git a/test/sys/module/snd_pcm/sections/.symtab b/test/sys/module/snd_pcm/sections/.symtab new file mode 100644 index 0000000000..f8ce390292 --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0141c00 diff --git a/test/sys/module/snd_pcm/sections/.text b/test/sys/module/snd_pcm/sections/.text new file mode 100644 index 0000000000..c8d9e3c38f --- /dev/null +++ b/test/sys/module/snd_pcm/sections/.text @@ -0,0 +1 @@ +0xffffffffa0134000 diff --git a/test/sys/module/snd_pcm/sections/__ex_table b/test/sys/module/snd_pcm/sections/__ex_table new file mode 100644 index 0000000000..29b347ba8b --- /dev/null +++ b/test/sys/module/snd_pcm/sections/__ex_table @@ -0,0 +1 @@ +0xffffffffa0141b30 diff --git a/test/sys/module/snd_pcm/sections/__kcrctab b/test/sys/module/snd_pcm/sections/__kcrctab new file mode 100644 index 0000000000..533e4a32ff --- /dev/null +++ b/test/sys/module/snd_pcm/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa0141430 diff --git a/test/sys/module/snd_pcm/sections/__ksymtab b/test/sys/module/snd_pcm/sections/__ksymtab new file mode 100644 index 0000000000..7813d25bc6 --- /dev/null +++ b/test/sys/module/snd_pcm/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa01410b0 diff --git a/test/sys/module/snd_pcm/sections/__ksymtab_strings b/test/sys/module/snd_pcm/sections/__ksymtab_strings new file mode 100644 index 0000000000..c02a8896be --- /dev/null +++ b/test/sys/module/snd_pcm/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa01415f0 diff --git a/test/sys/module/snd_pcm/sections/__param b/test/sys/module/snd_pcm/sections/__param new file mode 100644 index 0000000000..6cfa8dc8cc --- /dev/null +++ b/test/sys/module/snd_pcm/sections/__param @@ -0,0 +1 @@ +0xffffffffa0141bb0 diff --git a/test/sys/module/snd_pcm/srcversion b/test/sys/module/snd_pcm/srcversion new file mode 100644 index 0000000000..bc22819ec4 --- /dev/null +++ b/test/sys/module/snd_pcm/srcversion @@ -0,0 +1 @@ +96530AD1426FF7F73757C4F diff --git a/test/sys/module/snd_pcm_oss/initstate b/test/sys/module/snd_pcm_oss/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/snd_pcm_oss/notes/.note.gnu.build-id b/test/sys/module/snd_pcm_oss/notes/.note.gnu.build-id new file mode 100644 index 0000000000..b8ee20ffd0 Binary files /dev/null and b/test/sys/module/snd_pcm_oss/notes/.note.gnu.build-id differ diff --git a/test/sys/module/snd_pcm_oss/parameters/adsp_map b/test/sys/module/snd_pcm_oss/parameters/adsp_map new file mode 100644 index 0000000000..096bfcbfbc --- /dev/null +++ b/test/sys/module/snd_pcm_oss/parameters/adsp_map @@ -0,0 +1 @@ +1,1,1,1,1,1,1,1 diff --git a/test/sys/module/snd_pcm_oss/parameters/dsp_map b/test/sys/module/snd_pcm_oss/parameters/dsp_map new file mode 100644 index 0000000000..b9ead4f049 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/parameters/dsp_map @@ -0,0 +1 @@ +0,0,0,0,0,0,0,0 diff --git a/test/sys/module/snd_pcm_oss/parameters/nonblock_open b/test/sys/module/snd_pcm_oss/parameters/nonblock_open new file mode 100644 index 0000000000..9bda8c35c2 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/parameters/nonblock_open @@ -0,0 +1 @@ +Y diff --git a/test/sys/module/snd_pcm_oss/refcnt b/test/sys/module/snd_pcm_oss/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/snd_pcm_oss/sections/.bss b/test/sys/module/snd_pcm_oss/sections/.bss new file mode 100644 index 0000000000..70a907db35 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02c9b00 diff --git a/test/sys/module/snd_pcm_oss/sections/.data b/test/sys/module/snd_pcm_oss/sections/.data new file mode 100644 index 0000000000..e64b7a8a58 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.data @@ -0,0 +1 @@ +0xffffffffa02c96c0 diff --git a/test/sys/module/snd_pcm_oss/sections/.exit.text b/test/sys/module/snd_pcm_oss/sections/.exit.text new file mode 100644 index 0000000000..de7eeb6101 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02c6e7c diff --git a/test/sys/module/snd_pcm_oss/sections/.gnu.linkonce.this_module b/test/sys/module/snd_pcm_oss/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..50cdfcc03c --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02c9740 diff --git a/test/sys/module/snd_pcm_oss/sections/.init.text b/test/sys/module/snd_pcm_oss/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/snd_pcm_oss/sections/.note.gnu.build-id b/test/sys/module/snd_pcm_oss/sections/.note.gnu.build-id new file mode 100644 index 0000000000..50b4f862b8 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02c6e94 diff --git a/test/sys/module/snd_pcm_oss/sections/.rodata b/test/sys/module/snd_pcm_oss/sections/.rodata new file mode 100644 index 0000000000..94745b4c2d --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa02c6ec0 diff --git a/test/sys/module/snd_pcm_oss/sections/.rodata.str1.1 b/test/sys/module/snd_pcm_oss/sections/.rodata.str1.1 new file mode 100644 index 0000000000..ba5ec7f246 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa02c71a8 diff --git a/test/sys/module/snd_pcm_oss/sections/.strtab b/test/sys/module/snd_pcm_oss/sections/.strtab new file mode 100644 index 0000000000..fff88f5970 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02c8818 diff --git a/test/sys/module/snd_pcm_oss/sections/.symtab b/test/sys/module/snd_pcm_oss/sections/.symtab new file mode 100644 index 0000000000..3db134c520 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02c73f0 diff --git a/test/sys/module/snd_pcm_oss/sections/.text b/test/sys/module/snd_pcm_oss/sections/.text new file mode 100644 index 0000000000..27d01fb877 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/.text @@ -0,0 +1 @@ +0xffffffffa02bf000 diff --git a/test/sys/module/snd_pcm_oss/sections/__param b/test/sys/module/snd_pcm_oss/sections/__param new file mode 100644 index 0000000000..cb3588dc0e --- /dev/null +++ b/test/sys/module/snd_pcm_oss/sections/__param @@ -0,0 +1 @@ +0xffffffffa02c7378 diff --git a/test/sys/module/snd_pcm_oss/srcversion b/test/sys/module/snd_pcm_oss/srcversion new file mode 100644 index 0000000000..09490a8462 --- /dev/null +++ b/test/sys/module/snd_pcm_oss/srcversion @@ -0,0 +1 @@ +E3D05A52B04130012283029 diff --git a/test/sys/module/snd_seq/initstate b/test/sys/module/snd_seq/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/snd_seq/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/snd_seq/notes/.note.gnu.build-id b/test/sys/module/snd_seq/notes/.note.gnu.build-id new file mode 100644 index 0000000000..725fba5068 Binary files /dev/null and b/test/sys/module/snd_seq/notes/.note.gnu.build-id differ diff --git a/test/sys/module/snd_seq/parameters/seq_client_load b/test/sys/module/snd_seq/parameters/seq_client_load new file mode 100644 index 0000000000..8ad37c1248 --- /dev/null +++ b/test/sys/module/snd_seq/parameters/seq_client_load @@ -0,0 +1 @@ +-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_card b/test/sys/module/snd_seq/parameters/seq_default_timer_card new file mode 100644 index 0000000000..3a2e3f4984 --- /dev/null +++ b/test/sys/module/snd_seq/parameters/seq_default_timer_card @@ -0,0 +1 @@ +-1 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_class b/test/sys/module/snd_seq/parameters/seq_default_timer_class new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/snd_seq/parameters/seq_default_timer_class @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_device b/test/sys/module/snd_seq/parameters/seq_default_timer_device new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/snd_seq/parameters/seq_default_timer_device @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_resolution b/test/sys/module/snd_seq/parameters/seq_default_timer_resolution new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/snd_seq/parameters/seq_default_timer_resolution @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_sclass b/test/sys/module/snd_seq/parameters/seq_default_timer_sclass new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/snd_seq/parameters/seq_default_timer_sclass @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_subdevice b/test/sys/module/snd_seq/parameters/seq_default_timer_subdevice new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/snd_seq/parameters/seq_default_timer_subdevice @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/snd_seq/refcnt b/test/sys/module/snd_seq/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/snd_seq/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/snd_seq/sections/.bss b/test/sys/module/snd_seq/sections/.bss new file mode 100644 index 0000000000..7b1ec46001 --- /dev/null +++ b/test/sys/module/snd_seq/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02b6f80 diff --git a/test/sys/module/snd_seq/sections/.data b/test/sys/module/snd_seq/sections/.data new file mode 100644 index 0000000000..bd80381a68 --- /dev/null +++ b/test/sys/module/snd_seq/sections/.data @@ -0,0 +1 @@ +0xffffffffa02b6860 diff --git a/test/sys/module/snd_seq/sections/.exit.text b/test/sys/module/snd_seq/sections/.exit.text new file mode 100644 index 0000000000..c31c6fa71e --- /dev/null +++ b/test/sys/module/snd_seq/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02b0ff0 diff --git a/test/sys/module/snd_seq/sections/.gnu.linkonce.this_module b/test/sys/module/snd_seq/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..78bc61dbcf --- /dev/null +++ b/test/sys/module/snd_seq/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02b6bc0 diff --git a/test/sys/module/snd_seq/sections/.init.text b/test/sys/module/snd_seq/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/snd_seq/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/snd_seq/sections/.note.gnu.build-id b/test/sys/module/snd_seq/sections/.note.gnu.build-id new file mode 100644 index 0000000000..f4c0efac9a --- /dev/null +++ b/test/sys/module/snd_seq/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02b10bc diff --git a/test/sys/module/snd_seq/sections/.rodata b/test/sys/module/snd_seq/sections/.rodata new file mode 100644 index 0000000000..8154a7e5f8 --- /dev/null +++ b/test/sys/module/snd_seq/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa02b10e0 diff --git a/test/sys/module/snd_seq/sections/.rodata.str1.1 b/test/sys/module/snd_seq/sections/.rodata.str1.1 new file mode 100644 index 0000000000..e7b91207af --- /dev/null +++ b/test/sys/module/snd_seq/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa02b18b6 diff --git a/test/sys/module/snd_seq/sections/.smp_locks b/test/sys/module/snd_seq/sections/.smp_locks new file mode 100644 index 0000000000..eec8a7bbe3 --- /dev/null +++ b/test/sys/module/snd_seq/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa02b1d30 diff --git a/test/sys/module/snd_seq/sections/.strtab b/test/sys/module/snd_seq/sections/.strtab new file mode 100644 index 0000000000..01d9aef3e5 --- /dev/null +++ b/test/sys/module/snd_seq/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02b4590 diff --git a/test/sys/module/snd_seq/sections/.symtab b/test/sys/module/snd_seq/sections/.symtab new file mode 100644 index 0000000000..9dba092436 --- /dev/null +++ b/test/sys/module/snd_seq/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02b1fc8 diff --git a/test/sys/module/snd_seq/sections/.text b/test/sys/module/snd_seq/sections/.text new file mode 100644 index 0000000000..c74d6571ae --- /dev/null +++ b/test/sys/module/snd_seq/sections/.text @@ -0,0 +1 @@ +0xffffffffa02a9000 diff --git a/test/sys/module/snd_seq/sections/__kcrctab b/test/sys/module/snd_seq/sections/__kcrctab new file mode 100644 index 0000000000..1ba6d1d22b --- /dev/null +++ b/test/sys/module/snd_seq/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa02b16e0 diff --git a/test/sys/module/snd_seq/sections/__ksymtab b/test/sys/module/snd_seq/sections/__ksymtab new file mode 100644 index 0000000000..fa86a08454 --- /dev/null +++ b/test/sys/module/snd_seq/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa02b1610 diff --git a/test/sys/module/snd_seq/sections/__ksymtab_strings b/test/sys/module/snd_seq/sections/__ksymtab_strings new file mode 100644 index 0000000000..2de51cda12 --- /dev/null +++ b/test/sys/module/snd_seq/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa02b1748 diff --git a/test/sys/module/snd_seq/sections/__param b/test/sys/module/snd_seq/sections/__param new file mode 100644 index 0000000000..9e3ad157a9 --- /dev/null +++ b/test/sys/module/snd_seq/sections/__param @@ -0,0 +1 @@ +0xffffffffa02b1320 diff --git a/test/sys/module/snd_seq/srcversion b/test/sys/module/snd_seq/srcversion new file mode 100644 index 0000000000..b08bc7ae4f --- /dev/null +++ b/test/sys/module/snd_seq/srcversion @@ -0,0 +1 @@ +94E19F6DBC8F63B241414FE diff --git a/test/sys/module/snd_seq_device/holders/snd_seq b/test/sys/module/snd_seq_device/holders/snd_seq new file mode 120000 index 0000000000..fbac6b8360 --- /dev/null +++ b/test/sys/module/snd_seq_device/holders/snd_seq @@ -0,0 +1 @@ +../../snd_seq \ No newline at end of file diff --git a/test/sys/module/snd_seq_device/initstate b/test/sys/module/snd_seq_device/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/snd_seq_device/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/snd_seq_device/notes/.note.gnu.build-id b/test/sys/module/snd_seq_device/notes/.note.gnu.build-id new file mode 100644 index 0000000000..3cc827704e Binary files /dev/null and b/test/sys/module/snd_seq_device/notes/.note.gnu.build-id differ diff --git a/test/sys/module/snd_seq_device/refcnt b/test/sys/module/snd_seq_device/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/snd_seq_device/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/snd_seq_device/sections/.bss b/test/sys/module/snd_seq_device/sections/.bss new file mode 100644 index 0000000000..191949a185 --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02a7280 diff --git a/test/sys/module/snd_seq_device/sections/.data b/test/sys/module/snd_seq_device/sections/.data new file mode 100644 index 0000000000..9180bc372a --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.data @@ -0,0 +1 @@ +0xffffffffa02a6de0 diff --git a/test/sys/module/snd_seq_device/sections/.exit.text b/test/sys/module/snd_seq_device/sections/.exit.text new file mode 100644 index 0000000000..97e829f3b6 --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02a5a5c diff --git a/test/sys/module/snd_seq_device/sections/.gnu.linkonce.this_module b/test/sys/module/snd_seq_device/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..d275ad9ce7 --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02a6ec0 diff --git a/test/sys/module/snd_seq_device/sections/.init.text b/test/sys/module/snd_seq_device/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/snd_seq_device/sections/.note.gnu.build-id b/test/sys/module/snd_seq_device/sections/.note.gnu.build-id new file mode 100644 index 0000000000..e9016b339f --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02a5a90 diff --git a/test/sys/module/snd_seq_device/sections/.rodata.str1.1 b/test/sys/module/snd_seq_device/sections/.rodata.str1.1 new file mode 100644 index 0000000000..d66a845d5d --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa02a5bd0 diff --git a/test/sys/module/snd_seq_device/sections/.strtab b/test/sys/module/snd_seq_device/sections/.strtab new file mode 100644 index 0000000000..fe92f872a9 --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02a66e0 diff --git a/test/sys/module/snd_seq_device/sections/.symtab b/test/sys/module/snd_seq_device/sections/.symtab new file mode 100644 index 0000000000..cf4dc9ae93 --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02a5db0 diff --git a/test/sys/module/snd_seq_device/sections/.text b/test/sys/module/snd_seq_device/sections/.text new file mode 100644 index 0000000000..f9a94beb2e --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/.text @@ -0,0 +1 @@ +0xffffffffa02a5000 diff --git a/test/sys/module/snd_seq_device/sections/__kcrctab b/test/sys/module/snd_seq_device/sections/__kcrctab new file mode 100644 index 0000000000..3d5629377b --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa02a5ce0 diff --git a/test/sys/module/snd_seq_device/sections/__ksymtab b/test/sys/module/snd_seq_device/sections/__ksymtab new file mode 100644 index 0000000000..d2c2f00a52 --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa02a5c80 diff --git a/test/sys/module/snd_seq_device/sections/__ksymtab_strings b/test/sys/module/snd_seq_device/sections/__ksymtab_strings new file mode 100644 index 0000000000..7072c5b62b --- /dev/null +++ b/test/sys/module/snd_seq_device/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa02a5d10 diff --git a/test/sys/module/snd_seq_device/srcversion b/test/sys/module/snd_seq_device/srcversion new file mode 100644 index 0000000000..785191c034 --- /dev/null +++ b/test/sys/module/snd_seq_device/srcversion @@ -0,0 +1 @@ +A166653189DAF15E3F2B588 diff --git a/test/sys/module/snd_timer/holders/snd_pcm b/test/sys/module/snd_timer/holders/snd_pcm new file mode 120000 index 0000000000..0eaac02ed1 --- /dev/null +++ b/test/sys/module/snd_timer/holders/snd_pcm @@ -0,0 +1 @@ +../../snd_pcm \ No newline at end of file diff --git a/test/sys/module/snd_timer/holders/snd_seq b/test/sys/module/snd_timer/holders/snd_seq new file mode 120000 index 0000000000..fbac6b8360 --- /dev/null +++ b/test/sys/module/snd_timer/holders/snd_seq @@ -0,0 +1 @@ +../../snd_seq \ No newline at end of file diff --git a/test/sys/module/snd_timer/initstate b/test/sys/module/snd_timer/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/snd_timer/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/snd_timer/notes/.note.gnu.build-id b/test/sys/module/snd_timer/notes/.note.gnu.build-id new file mode 100644 index 0000000000..9c99a65b21 Binary files /dev/null and b/test/sys/module/snd_timer/notes/.note.gnu.build-id differ diff --git a/test/sys/module/snd_timer/parameters/timer_limit b/test/sys/module/snd_timer/parameters/timer_limit new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/snd_timer/parameters/timer_limit @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/snd_timer/parameters/timer_tstamp_monotonic b/test/sys/module/snd_timer/parameters/timer_tstamp_monotonic new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/snd_timer/parameters/timer_tstamp_monotonic @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/snd_timer/refcnt b/test/sys/module/snd_timer/refcnt new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/snd_timer/refcnt @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/snd_timer/sections/.bss b/test/sys/module/snd_timer/sections/.bss new file mode 100644 index 0000000000..320fab13c4 --- /dev/null +++ b/test/sys/module/snd_timer/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00fb200 diff --git a/test/sys/module/snd_timer/sections/.data b/test/sys/module/snd_timer/sections/.data new file mode 100644 index 0000000000..6198eefdef --- /dev/null +++ b/test/sys/module/snd_timer/sections/.data @@ -0,0 +1 @@ +0xffffffffa00fad00 diff --git a/test/sys/module/snd_timer/sections/.exit.text b/test/sys/module/snd_timer/sections/.exit.text new file mode 100644 index 0000000000..0988161ab1 --- /dev/null +++ b/test/sys/module/snd_timer/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00f8520 diff --git a/test/sys/module/snd_timer/sections/.gnu.linkonce.this_module b/test/sys/module/snd_timer/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..56d7a09a36 --- /dev/null +++ b/test/sys/module/snd_timer/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00fae40 diff --git a/test/sys/module/snd_timer/sections/.init.text b/test/sys/module/snd_timer/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/snd_timer/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/snd_timer/sections/.note.gnu.build-id b/test/sys/module/snd_timer/sections/.note.gnu.build-id new file mode 100644 index 0000000000..c00eceb9d3 --- /dev/null +++ b/test/sys/module/snd_timer/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00f8590 diff --git a/test/sys/module/snd_timer/sections/.rodata b/test/sys/module/snd_timer/sections/.rodata new file mode 100644 index 0000000000..a59d2bef00 --- /dev/null +++ b/test/sys/module/snd_timer/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00f85c0 diff --git a/test/sys/module/snd_timer/sections/.rodata.str1.1 b/test/sys/module/snd_timer/sections/.rodata.str1.1 new file mode 100644 index 0000000000..4d967834c3 --- /dev/null +++ b/test/sys/module/snd_timer/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00f8723 diff --git a/test/sys/module/snd_timer/sections/.smp_locks b/test/sys/module/snd_timer/sections/.smp_locks new file mode 100644 index 0000000000..ceeb865500 --- /dev/null +++ b/test/sys/module/snd_timer/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa00f8908 diff --git a/test/sys/module/snd_timer/sections/.strtab b/test/sys/module/snd_timer/sections/.strtab new file mode 100644 index 0000000000..8076745d9a --- /dev/null +++ b/test/sys/module/snd_timer/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00f9e90 diff --git a/test/sys/module/snd_timer/sections/.symtab b/test/sys/module/snd_timer/sections/.symtab new file mode 100644 index 0000000000..1ee97758bf --- /dev/null +++ b/test/sys/module/snd_timer/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00f8b88 diff --git a/test/sys/module/snd_timer/sections/.text b/test/sys/module/snd_timer/sections/.text new file mode 100644 index 0000000000..3e00728a51 --- /dev/null +++ b/test/sys/module/snd_timer/sections/.text @@ -0,0 +1 @@ +0xffffffffa00f5000 diff --git a/test/sys/module/snd_timer/sections/__bug_table b/test/sys/module/snd_timer/sections/__bug_table new file mode 100644 index 0000000000..368c672d33 --- /dev/null +++ b/test/sys/module/snd_timer/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa00f888f diff --git a/test/sys/module/snd_timer/sections/__kcrctab b/test/sys/module/snd_timer/sections/__kcrctab new file mode 100644 index 0000000000..0582f6ddb0 --- /dev/null +++ b/test/sys/module/snd_timer/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa00f89e0 diff --git a/test/sys/module/snd_timer/sections/__ksymtab b/test/sys/module/snd_timer/sections/__ksymtab new file mode 100644 index 0000000000..41c75e77a1 --- /dev/null +++ b/test/sys/module/snd_timer/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa00f8910 diff --git a/test/sys/module/snd_timer/sections/__ksymtab_strings b/test/sys/module/snd_timer/sections/__ksymtab_strings new file mode 100644 index 0000000000..de74bcfefd --- /dev/null +++ b/test/sys/module/snd_timer/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa00f8a98 diff --git a/test/sys/module/snd_timer/sections/__param b/test/sys/module/snd_timer/sections/__param new file mode 100644 index 0000000000..5a7dcb4c53 --- /dev/null +++ b/test/sys/module/snd_timer/sections/__param @@ -0,0 +1 @@ +0xffffffffa00f8a48 diff --git a/test/sys/module/snd_timer/srcversion b/test/sys/module/snd_timer/srcversion new file mode 100644 index 0000000000..dd93b11c4a --- /dev/null +++ b/test/sys/module/snd_timer/srcversion @@ -0,0 +1 @@ +1F1836030C5B604CF478CFC diff --git a/test/sys/module/soundcore/holders/snd b/test/sys/module/soundcore/holders/snd new file mode 120000 index 0000000000..caa1619fc2 --- /dev/null +++ b/test/sys/module/soundcore/holders/snd @@ -0,0 +1 @@ +../../snd \ No newline at end of file diff --git a/test/sys/module/soundcore/initstate b/test/sys/module/soundcore/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/soundcore/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/soundcore/notes/.note.gnu.build-id b/test/sys/module/soundcore/notes/.note.gnu.build-id new file mode 100644 index 0000000000..490a982d90 Binary files /dev/null and b/test/sys/module/soundcore/notes/.note.gnu.build-id differ diff --git a/test/sys/module/soundcore/refcnt b/test/sys/module/soundcore/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/soundcore/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/soundcore/sections/.bss b/test/sys/module/soundcore/sections/.bss new file mode 100644 index 0000000000..b9f55a774d --- /dev/null +++ b/test/sys/module/soundcore/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00692c0 diff --git a/test/sys/module/soundcore/sections/.data b/test/sys/module/soundcore/sections/.data new file mode 100644 index 0000000000..481c93cbf2 --- /dev/null +++ b/test/sys/module/soundcore/sections/.data @@ -0,0 +1 @@ +0xffffffffa0068ec0 diff --git a/test/sys/module/soundcore/sections/.exit.text b/test/sys/module/soundcore/sections/.exit.text new file mode 100644 index 0000000000..c12a0df109 --- /dev/null +++ b/test/sys/module/soundcore/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0067850 diff --git a/test/sys/module/soundcore/sections/.gnu.linkonce.this_module b/test/sys/module/soundcore/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..33184728b5 --- /dev/null +++ b/test/sys/module/soundcore/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0068f00 diff --git a/test/sys/module/soundcore/sections/.init.text b/test/sys/module/soundcore/sections/.init.text new file mode 100644 index 0000000000..6449cb3074 --- /dev/null +++ b/test/sys/module/soundcore/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa006b000 diff --git a/test/sys/module/soundcore/sections/.note.gnu.build-id b/test/sys/module/soundcore/sections/.note.gnu.build-id new file mode 100644 index 0000000000..9211548ac0 --- /dev/null +++ b/test/sys/module/soundcore/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0067874 diff --git a/test/sys/module/soundcore/sections/.rodata b/test/sys/module/soundcore/sections/.rodata new file mode 100644 index 0000000000..91c56c2e37 --- /dev/null +++ b/test/sys/module/soundcore/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00678a0 diff --git a/test/sys/module/soundcore/sections/.rodata.str1.1 b/test/sys/module/soundcore/sections/.rodata.str1.1 new file mode 100644 index 0000000000..9acba7c958 --- /dev/null +++ b/test/sys/module/soundcore/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00679f8 diff --git a/test/sys/module/soundcore/sections/.strtab b/test/sys/module/soundcore/sections/.strtab new file mode 100644 index 0000000000..5a8f37f39f --- /dev/null +++ b/test/sys/module/soundcore/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00686d0 diff --git a/test/sys/module/soundcore/sections/.symtab b/test/sys/module/soundcore/sections/.symtab new file mode 100644 index 0000000000..64a5d6febe --- /dev/null +++ b/test/sys/module/soundcore/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0067cc8 diff --git a/test/sys/module/soundcore/sections/.text b/test/sys/module/soundcore/sections/.text new file mode 100644 index 0000000000..91f7a151f0 --- /dev/null +++ b/test/sys/module/soundcore/sections/.text @@ -0,0 +1 @@ +0xffffffffa0067000 diff --git a/test/sys/module/soundcore/sections/__kcrctab b/test/sys/module/soundcore/sections/__kcrctab new file mode 100644 index 0000000000..8fa03c387e --- /dev/null +++ b/test/sys/module/soundcore/sections/__kcrctab @@ -0,0 +1 @@ +0xffffffffa0067ba0 diff --git a/test/sys/module/soundcore/sections/__ksymtab b/test/sys/module/soundcore/sections/__ksymtab new file mode 100644 index 0000000000..e6f10f74ad --- /dev/null +++ b/test/sys/module/soundcore/sections/__ksymtab @@ -0,0 +1 @@ +0xffffffffa0067b00 diff --git a/test/sys/module/soundcore/sections/__ksymtab_strings b/test/sys/module/soundcore/sections/__ksymtab_strings new file mode 100644 index 0000000000..b13ec916cd --- /dev/null +++ b/test/sys/module/soundcore/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa0067bf0 diff --git a/test/sys/module/soundcore/srcversion b/test/sys/module/soundcore/srcversion new file mode 100644 index 0000000000..24fbc65e33 --- /dev/null +++ b/test/sys/module/soundcore/srcversion @@ -0,0 +1 @@ +E4F49ED9C4CFD1A5A923330 diff --git a/test/sys/module/spurious/parameters/irqfixup b/test/sys/module/spurious/parameters/irqfixup new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/spurious/parameters/irqfixup @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/spurious/parameters/noirqdebug b/test/sys/module/spurious/parameters/noirqdebug new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/spurious/parameters/noirqdebug @@ -0,0 +1 @@ +N diff --git a/test/sys/module/sr_mod/initstate b/test/sys/module/sr_mod/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/sr_mod/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/sr_mod/notes/.note.gnu.build-id b/test/sys/module/sr_mod/notes/.note.gnu.build-id new file mode 100644 index 0000000000..82ee21ec80 Binary files /dev/null and b/test/sys/module/sr_mod/notes/.note.gnu.build-id differ diff --git a/test/sys/module/sr_mod/parameters/xa_test b/test/sys/module/sr_mod/parameters/xa_test new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/sr_mod/parameters/xa_test @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/sr_mod/refcnt b/test/sys/module/sr_mod/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/sr_mod/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/sr_mod/sections/.bss b/test/sys/module/sr_mod/sections/.bss new file mode 100644 index 0000000000..15cfbab0cb --- /dev/null +++ b/test/sys/module/sr_mod/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00630c0 diff --git a/test/sys/module/sr_mod/sections/.data b/test/sys/module/sr_mod/sections/.data new file mode 100644 index 0000000000..f14e1e766f --- /dev/null +++ b/test/sys/module/sr_mod/sections/.data @@ -0,0 +1 @@ +0xffffffffa0062aa0 diff --git a/test/sys/module/sr_mod/sections/.exit.text b/test/sys/module/sr_mod/sections/.exit.text new file mode 100644 index 0000000000..10d338e356 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa006126c diff --git a/test/sys/module/sr_mod/sections/.gnu.linkonce.this_module b/test/sys/module/sr_mod/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..5e81537736 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0062d00 diff --git a/test/sys/module/sr_mod/sections/.init.text b/test/sys/module/sr_mod/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/sr_mod/sections/.note.gnu.build-id b/test/sys/module/sr_mod/sections/.note.gnu.build-id new file mode 100644 index 0000000000..8eb98a4e87 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0061290 diff --git a/test/sys/module/sr_mod/sections/.rodata b/test/sys/module/sr_mod/sections/.rodata new file mode 100644 index 0000000000..715fbc75d0 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00612c0 diff --git a/test/sys/module/sr_mod/sections/.rodata.str1.1 b/test/sys/module/sr_mod/sections/.rodata.str1.1 new file mode 100644 index 0000000000..112a57ea77 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0061308 diff --git a/test/sys/module/sr_mod/sections/.smp_locks b/test/sys/module/sr_mod/sections/.smp_locks new file mode 100644 index 0000000000..0dea737950 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa0061488 diff --git a/test/sys/module/sr_mod/sections/.strtab b/test/sys/module/sr_mod/sections/.strtab new file mode 100644 index 0000000000..8691bc3415 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00623f0 diff --git a/test/sys/module/sr_mod/sections/.symtab b/test/sys/module/sr_mod/sections/.symtab new file mode 100644 index 0000000000..cfc0712bb2 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0061778 diff --git a/test/sys/module/sr_mod/sections/.text b/test/sys/module/sr_mod/sections/.text new file mode 100644 index 0000000000..8293f90783 --- /dev/null +++ b/test/sys/module/sr_mod/sections/.text @@ -0,0 +1 @@ +0xffffffffa005f000 diff --git a/test/sys/module/sr_mod/sections/__param b/test/sys/module/sr_mod/sections/__param new file mode 100644 index 0000000000..9f1f49721e --- /dev/null +++ b/test/sys/module/sr_mod/sections/__param @@ -0,0 +1 @@ +0xffffffffa0061750 diff --git a/test/sys/module/sr_mod/srcversion b/test/sys/module/sr_mod/srcversion new file mode 100644 index 0000000000..4dc373d962 --- /dev/null +++ b/test/sys/module/sr_mod/srcversion @@ -0,0 +1 @@ +3484F077F1A71803F453437 diff --git a/test/sys/module/tcp_cubic/parameters/beta b/test/sys/module/tcp_cubic/parameters/beta new file mode 100644 index 0000000000..05c8b2c097 --- /dev/null +++ b/test/sys/module/tcp_cubic/parameters/beta @@ -0,0 +1 @@ +717 diff --git a/test/sys/module/tcp_cubic/parameters/bic_scale b/test/sys/module/tcp_cubic/parameters/bic_scale new file mode 100644 index 0000000000..87523dd7a0 --- /dev/null +++ b/test/sys/module/tcp_cubic/parameters/bic_scale @@ -0,0 +1 @@ +41 diff --git a/test/sys/module/tcp_cubic/parameters/fast_convergence b/test/sys/module/tcp_cubic/parameters/fast_convergence new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/tcp_cubic/parameters/fast_convergence @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/tcp_cubic/parameters/initial_ssthresh b/test/sys/module/tcp_cubic/parameters/initial_ssthresh new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/tcp_cubic/parameters/initial_ssthresh @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/tcp_cubic/parameters/tcp_friendliness b/test/sys/module/tcp_cubic/parameters/tcp_friendliness new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/tcp_cubic/parameters/tcp_friendliness @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/thermal/initstate b/test/sys/module/thermal/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/thermal/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/thermal/notes/.note.gnu.build-id b/test/sys/module/thermal/notes/.note.gnu.build-id new file mode 100644 index 0000000000..8781a52306 Binary files /dev/null and b/test/sys/module/thermal/notes/.note.gnu.build-id differ diff --git a/test/sys/module/thermal/parameters/act b/test/sys/module/thermal/parameters/act new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/thermal/parameters/act @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/thermal/parameters/crt b/test/sys/module/thermal/parameters/crt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/thermal/parameters/crt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/thermal/parameters/psv b/test/sys/module/thermal/parameters/psv new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/thermal/parameters/psv @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/thermal/parameters/tzp b/test/sys/module/thermal/parameters/tzp new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/thermal/parameters/tzp @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/thermal/refcnt b/test/sys/module/thermal/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/thermal/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/thermal/sections/.bss b/test/sys/module/thermal/sections/.bss new file mode 100644 index 0000000000..5bb3f1722c --- /dev/null +++ b/test/sys/module/thermal/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00a4bc0 diff --git a/test/sys/module/thermal/sections/.data b/test/sys/module/thermal/sections/.data new file mode 100644 index 0000000000..2bf743d6bd --- /dev/null +++ b/test/sys/module/thermal/sections/.data @@ -0,0 +1 @@ +0xffffffffa00a4640 diff --git a/test/sys/module/thermal/sections/.exit.text b/test/sys/module/thermal/sections/.exit.text new file mode 100644 index 0000000000..3dc71f41a1 --- /dev/null +++ b/test/sys/module/thermal/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00a1f14 diff --git a/test/sys/module/thermal/sections/.gnu.linkonce.this_module b/test/sys/module/thermal/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..20e0f91648 --- /dev/null +++ b/test/sys/module/thermal/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00a4800 diff --git a/test/sys/module/thermal/sections/.init.data b/test/sys/module/thermal/sections/.init.data new file mode 100644 index 0000000000..5a91c4cd3e --- /dev/null +++ b/test/sys/module/thermal/sections/.init.data @@ -0,0 +1 @@ +0xffffffffa0070090 diff --git a/test/sys/module/thermal/sections/.init.text b/test/sys/module/thermal/sections/.init.text new file mode 100644 index 0000000000..0cac0d19cf --- /dev/null +++ b/test/sys/module/thermal/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0070000 diff --git a/test/sys/module/thermal/sections/.note.gnu.build-id b/test/sys/module/thermal/sections/.note.gnu.build-id new file mode 100644 index 0000000000..3bca0c2c3f --- /dev/null +++ b/test/sys/module/thermal/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00a1f3c diff --git a/test/sys/module/thermal/sections/.rodata b/test/sys/module/thermal/sections/.rodata new file mode 100644 index 0000000000..f8bcea6e91 --- /dev/null +++ b/test/sys/module/thermal/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00a1f60 diff --git a/test/sys/module/thermal/sections/.rodata.str1.1 b/test/sys/module/thermal/sections/.rodata.str1.1 new file mode 100644 index 0000000000..34567ede65 --- /dev/null +++ b/test/sys/module/thermal/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00a242a diff --git a/test/sys/module/thermal/sections/.strtab b/test/sys/module/thermal/sections/.strtab new file mode 100644 index 0000000000..eb9fedc4f3 --- /dev/null +++ b/test/sys/module/thermal/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00a3b28 diff --git a/test/sys/module/thermal/sections/.symtab b/test/sys/module/thermal/sections/.symtab new file mode 100644 index 0000000000..e888edc2f5 --- /dev/null +++ b/test/sys/module/thermal/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00a2ac0 diff --git a/test/sys/module/thermal/sections/.text b/test/sys/module/thermal/sections/.text new file mode 100644 index 0000000000..cb816d17ae --- /dev/null +++ b/test/sys/module/thermal/sections/.text @@ -0,0 +1 @@ +0xffffffffa00a0000 diff --git a/test/sys/module/thermal/sections/__param b/test/sys/module/thermal/sections/__param new file mode 100644 index 0000000000..1971b2fd5a --- /dev/null +++ b/test/sys/module/thermal/sections/__param @@ -0,0 +1 @@ +0xffffffffa00a29d0 diff --git a/test/sys/module/thermal/srcversion b/test/sys/module/thermal/srcversion new file mode 100644 index 0000000000..e107377fe5 --- /dev/null +++ b/test/sys/module/thermal/srcversion @@ -0,0 +1 @@ +1787CE9FEB053C917D031A9 diff --git a/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_acpi b/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_acpi new file mode 120000 index 0000000000..388b2236b0 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_acpi @@ -0,0 +1 @@ +../../../bus/platform/drivers/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_hwmon b/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_hwmon new file mode 120000 index 0000000000..b34f0fde53 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_hwmon @@ -0,0 +1 @@ +../../../bus/platform/drivers/thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/module/thinkpad_acpi/initstate b/test/sys/module/thinkpad_acpi/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/thinkpad_acpi/notes/.note.gnu.build-id b/test/sys/module/thinkpad_acpi/notes/.note.gnu.build-id new file mode 100644 index 0000000000..6852bdc06b Binary files /dev/null and b/test/sys/module/thinkpad_acpi/notes/.note.gnu.build-id differ diff --git a/test/sys/module/thinkpad_acpi/refcnt b/test/sys/module/thinkpad_acpi/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/thinkpad_acpi/sections/.bss b/test/sys/module/thinkpad_acpi/sections/.bss new file mode 100644 index 0000000000..abd0fcfcd9 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.bss @@ -0,0 +1 @@ +0xffffffffa01ed600 diff --git a/test/sys/module/thinkpad_acpi/sections/.data b/test/sys/module/thinkpad_acpi/sections/.data new file mode 100644 index 0000000000..94355baa07 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.data @@ -0,0 +1 @@ +0xffffffffa01ebd60 diff --git a/test/sys/module/thinkpad_acpi/sections/.gnu.linkonce.this_module b/test/sys/module/thinkpad_acpi/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..6704076caa --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa01ed240 diff --git a/test/sys/module/thinkpad_acpi/sections/.init.data b/test/sys/module/thinkpad_acpi/sections/.init.data new file mode 100644 index 0000000000..38453a15c4 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.init.data @@ -0,0 +1 @@ +0xffffffffa01f1700 diff --git a/test/sys/module/thinkpad_acpi/sections/.init.text b/test/sys/module/thinkpad_acpi/sections/.init.text new file mode 100644 index 0000000000..e3a07aecb9 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa01ef000 diff --git a/test/sys/module/thinkpad_acpi/sections/.note.gnu.build-id b/test/sys/module/thinkpad_acpi/sections/.note.gnu.build-id new file mode 100644 index 0000000000..df21719621 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa01e3a80 diff --git a/test/sys/module/thinkpad_acpi/sections/.rodata b/test/sys/module/thinkpad_acpi/sections/.rodata new file mode 100644 index 0000000000..66e54fae11 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa01e3ac0 diff --git a/test/sys/module/thinkpad_acpi/sections/.rodata.str1.1 b/test/sys/module/thinkpad_acpi/sections/.rodata.str1.1 new file mode 100644 index 0000000000..b30eb1097a --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa01e3df0 diff --git a/test/sys/module/thinkpad_acpi/sections/.smp_locks b/test/sys/module/thinkpad_acpi/sections/.smp_locks new file mode 100644 index 0000000000..aa0f507fc7 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa01e6088 diff --git a/test/sys/module/thinkpad_acpi/sections/.strtab b/test/sys/module/thinkpad_acpi/sections/.strtab new file mode 100644 index 0000000000..e43904d3a7 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa01e98b8 diff --git a/test/sys/module/thinkpad_acpi/sections/.symtab b/test/sys/module/thinkpad_acpi/sections/.symtab new file mode 100644 index 0000000000..ad8b7caecc --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa01e6498 diff --git a/test/sys/module/thinkpad_acpi/sections/.text b/test/sys/module/thinkpad_acpi/sections/.text new file mode 100644 index 0000000000..2265c6d055 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/.text @@ -0,0 +1 @@ +0xffffffffa01dd000 diff --git a/test/sys/module/thinkpad_acpi/sections/__bug_table b/test/sys/module/thinkpad_acpi/sections/__bug_table new file mode 100644 index 0000000000..d0ab4f22c2 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa01e60e0 diff --git a/test/sys/module/thinkpad_acpi/sections/__param b/test/sys/module/thinkpad_acpi/sections/__param new file mode 100644 index 0000000000..fa147faf64 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/sections/__param @@ -0,0 +1 @@ +0xffffffffa01e61a0 diff --git a/test/sys/module/thinkpad_acpi/srcversion b/test/sys/module/thinkpad_acpi/srcversion new file mode 100644 index 0000000000..4f590ebe69 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/srcversion @@ -0,0 +1 @@ +FA276F7EFAA90BF39100654 diff --git a/test/sys/module/thinkpad_acpi/version b/test/sys/module/thinkpad_acpi/version new file mode 100644 index 0000000000..5320adc1c9 --- /dev/null +++ b/test/sys/module/thinkpad_acpi/version @@ -0,0 +1 @@ +0.21 diff --git a/test/sys/module/uhci_hcd/drivers/pci:uhci_hcd b/test/sys/module/uhci_hcd/drivers/pci:uhci_hcd new file mode 120000 index 0000000000..ed69e37601 --- /dev/null +++ b/test/sys/module/uhci_hcd/drivers/pci:uhci_hcd @@ -0,0 +1 @@ +../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/module/uhci_hcd/initstate b/test/sys/module/uhci_hcd/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/uhci_hcd/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/uhci_hcd/notes/.note.gnu.build-id b/test/sys/module/uhci_hcd/notes/.note.gnu.build-id new file mode 100644 index 0000000000..0a49c44d4f Binary files /dev/null and b/test/sys/module/uhci_hcd/notes/.note.gnu.build-id differ diff --git a/test/sys/module/uhci_hcd/parameters/ignore_oc b/test/sys/module/uhci_hcd/parameters/ignore_oc new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/uhci_hcd/parameters/ignore_oc @@ -0,0 +1 @@ +N diff --git a/test/sys/module/uhci_hcd/refcnt b/test/sys/module/uhci_hcd/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/uhci_hcd/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/uhci_hcd/sections/.bss b/test/sys/module/uhci_hcd/sections/.bss new file mode 100644 index 0000000000..897410c93c --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.bss @@ -0,0 +1 @@ +0xffffffffa00c8400 diff --git a/test/sys/module/uhci_hcd/sections/.data b/test/sys/module/uhci_hcd/sections/.data new file mode 100644 index 0000000000..6c1cccf783 --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.data @@ -0,0 +1 @@ +0xffffffffa00c7ee0 diff --git a/test/sys/module/uhci_hcd/sections/.exit.text b/test/sys/module/uhci_hcd/sections/.exit.text new file mode 100644 index 0000000000..ce49ee22ae --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa00c621c diff --git a/test/sys/module/uhci_hcd/sections/.gnu.linkonce.this_module b/test/sys/module/uhci_hcd/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..2a54735f3a --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa00c8040 diff --git a/test/sys/module/uhci_hcd/sections/.init.text b/test/sys/module/uhci_hcd/sections/.init.text new file mode 100644 index 0000000000..02c713a482 --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0027000 diff --git a/test/sys/module/uhci_hcd/sections/.note.gnu.build-id b/test/sys/module/uhci_hcd/sections/.note.gnu.build-id new file mode 100644 index 0000000000..8fc3a985e7 --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa00c6254 diff --git a/test/sys/module/uhci_hcd/sections/.rodata b/test/sys/module/uhci_hcd/sections/.rodata new file mode 100644 index 0000000000..fcaff176ff --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa00c6280 diff --git a/test/sys/module/uhci_hcd/sections/.rodata.str1.1 b/test/sys/module/uhci_hcd/sections/.rodata.str1.1 new file mode 100644 index 0000000000..46448bdf6e --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa00c67d2 diff --git a/test/sys/module/uhci_hcd/sections/.smp_locks b/test/sys/module/uhci_hcd/sections/.smp_locks new file mode 100644 index 0000000000..6cc08f06d0 --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa00c6850 diff --git a/test/sys/module/uhci_hcd/sections/.strtab b/test/sys/module/uhci_hcd/sections/.strtab new file mode 100644 index 0000000000..5ea80aa5d5 --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa00c7690 diff --git a/test/sys/module/uhci_hcd/sections/.symtab b/test/sys/module/uhci_hcd/sections/.symtab new file mode 100644 index 0000000000..75177416bd --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa00c68b0 diff --git a/test/sys/module/uhci_hcd/sections/.text b/test/sys/module/uhci_hcd/sections/.text new file mode 100644 index 0000000000..f2fd2b3e1d --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/.text @@ -0,0 +1 @@ +0xffffffffa00c2000 diff --git a/test/sys/module/uhci_hcd/sections/__param b/test/sys/module/uhci_hcd/sections/__param new file mode 100644 index 0000000000..e5aa8ba25c --- /dev/null +++ b/test/sys/module/uhci_hcd/sections/__param @@ -0,0 +1 @@ +0xffffffffa00c6888 diff --git a/test/sys/module/uhci_hcd/srcversion b/test/sys/module/uhci_hcd/srcversion new file mode 100644 index 0000000000..2d031c30be --- /dev/null +++ b/test/sys/module/uhci_hcd/srcversion @@ -0,0 +1 @@ +E3F4B6BEC99D6670259FCC9 diff --git a/test/sys/module/uinput/initstate b/test/sys/module/uinput/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/uinput/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/uinput/notes/.note.gnu.build-id b/test/sys/module/uinput/notes/.note.gnu.build-id new file mode 100644 index 0000000000..b693a3b883 Binary files /dev/null and b/test/sys/module/uinput/notes/.note.gnu.build-id differ diff --git a/test/sys/module/uinput/refcnt b/test/sys/module/uinput/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/uinput/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/uinput/sections/.bss b/test/sys/module/uinput/sections/.bss new file mode 100644 index 0000000000..dc0c52fc68 --- /dev/null +++ b/test/sys/module/uinput/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02074c0 diff --git a/test/sys/module/uinput/sections/.data b/test/sys/module/uinput/sections/.data new file mode 100644 index 0000000000..e4b09aafd9 --- /dev/null +++ b/test/sys/module/uinput/sections/.data @@ -0,0 +1 @@ +0xffffffffa02070c0 diff --git a/test/sys/module/uinput/sections/.exit.text b/test/sys/module/uinput/sections/.exit.text new file mode 100644 index 0000000000..c755d6f97b --- /dev/null +++ b/test/sys/module/uinput/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0206278 diff --git a/test/sys/module/uinput/sections/.gnu.linkonce.this_module b/test/sys/module/uinput/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..f85604d0c7 --- /dev/null +++ b/test/sys/module/uinput/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0207100 diff --git a/test/sys/module/uinput/sections/.init.text b/test/sys/module/uinput/sections/.init.text new file mode 100644 index 0000000000..0cac0d19cf --- /dev/null +++ b/test/sys/module/uinput/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0070000 diff --git a/test/sys/module/uinput/sections/.note.gnu.build-id b/test/sys/module/uinput/sections/.note.gnu.build-id new file mode 100644 index 0000000000..fbda8bdef8 --- /dev/null +++ b/test/sys/module/uinput/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa020628c diff --git a/test/sys/module/uinput/sections/.rodata b/test/sys/module/uinput/sections/.rodata new file mode 100644 index 0000000000..6723f71778 --- /dev/null +++ b/test/sys/module/uinput/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa02062c0 diff --git a/test/sys/module/uinput/sections/.rodata.str1.1 b/test/sys/module/uinput/sections/.rodata.str1.1 new file mode 100644 index 0000000000..e1f4d0013c --- /dev/null +++ b/test/sys/module/uinput/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0206398 diff --git a/test/sys/module/uinput/sections/.smp_locks b/test/sys/module/uinput/sections/.smp_locks new file mode 100644 index 0000000000..f5e97e9fa0 --- /dev/null +++ b/test/sys/module/uinput/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa0206448 diff --git a/test/sys/module/uinput/sections/.strtab b/test/sys/module/uinput/sections/.strtab new file mode 100644 index 0000000000..76793313c0 --- /dev/null +++ b/test/sys/module/uinput/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0206c88 diff --git a/test/sys/module/uinput/sections/.symtab b/test/sys/module/uinput/sections/.symtab new file mode 100644 index 0000000000..d8a9e04f13 --- /dev/null +++ b/test/sys/module/uinput/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0206490 diff --git a/test/sys/module/uinput/sections/.text b/test/sys/module/uinput/sections/.text new file mode 100644 index 0000000000..186960c329 --- /dev/null +++ b/test/sys/module/uinput/sections/.text @@ -0,0 +1 @@ +0xffffffffa0205000 diff --git a/test/sys/module/uinput/srcversion b/test/sys/module/uinput/srcversion new file mode 100644 index 0000000000..c1a7284041 --- /dev/null +++ b/test/sys/module/uinput/srcversion @@ -0,0 +1 @@ +2C3E0DB9E2496AD70174B85 diff --git a/test/sys/module/uinput/version b/test/sys/module/uinput/version new file mode 100644 index 0000000000..be58634173 --- /dev/null +++ b/test/sys/module/uinput/version @@ -0,0 +1 @@ +0.3 diff --git a/test/sys/module/usb_storage/drivers/usb:usb-storage b/test/sys/module/usb_storage/drivers/usb:usb-storage new file mode 120000 index 0000000000..529c13f715 --- /dev/null +++ b/test/sys/module/usb_storage/drivers/usb:usb-storage @@ -0,0 +1 @@ +../../../bus/usb/drivers/usb-storage \ No newline at end of file diff --git a/test/sys/module/usb_storage/initstate b/test/sys/module/usb_storage/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/usb_storage/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/usb_storage/notes/.note.gnu.build-id b/test/sys/module/usb_storage/notes/.note.gnu.build-id new file mode 100644 index 0000000000..64788b0bec Binary files /dev/null and b/test/sys/module/usb_storage/notes/.note.gnu.build-id differ diff --git a/test/sys/module/usb_storage/parameters/delay_use b/test/sys/module/usb_storage/parameters/delay_use new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/module/usb_storage/parameters/delay_use @@ -0,0 +1 @@ +5 diff --git a/test/sys/module/usb_storage/parameters/swi_tru_install b/test/sys/module/usb_storage/parameters/swi_tru_install new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/usb_storage/parameters/swi_tru_install @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/usb_storage/refcnt b/test/sys/module/usb_storage/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/usb_storage/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/usb_storage/sections/.bss b/test/sys/module/usb_storage/sections/.bss new file mode 100644 index 0000000000..c0d1e67a20 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.bss @@ -0,0 +1 @@ +0xffffffffa02e9400 diff --git a/test/sys/module/usb_storage/sections/.data b/test/sys/module/usb_storage/sections/.data new file mode 100644 index 0000000000..fcd5cadbb6 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.data @@ -0,0 +1 @@ +0xffffffffa02e5dc0 diff --git a/test/sys/module/usb_storage/sections/.exit.text b/test/sys/module/usb_storage/sections/.exit.text new file mode 100644 index 0000000000..2d8dfe5469 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa02e056c diff --git a/test/sys/module/usb_storage/sections/.gnu.linkonce.this_module b/test/sys/module/usb_storage/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..95fbd77952 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02e9040 diff --git a/test/sys/module/usb_storage/sections/.init.text b/test/sys/module/usb_storage/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/usb_storage/sections/.note.gnu.build-id b/test/sys/module/usb_storage/sections/.note.gnu.build-id new file mode 100644 index 0000000000..1e86001a88 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa02e0580 diff --git a/test/sys/module/usb_storage/sections/.rodata b/test/sys/module/usb_storage/sections/.rodata new file mode 100644 index 0000000000..3628fc397c --- /dev/null +++ b/test/sys/module/usb_storage/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa02e05b0 diff --git a/test/sys/module/usb_storage/sections/.rodata.str1.1 b/test/sys/module/usb_storage/sections/.rodata.str1.1 new file mode 100644 index 0000000000..f223a7e369 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa02e0ab1 diff --git a/test/sys/module/usb_storage/sections/.smp_locks b/test/sys/module/usb_storage/sections/.smp_locks new file mode 100644 index 0000000000..4f0afdf398 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa02e1820 diff --git a/test/sys/module/usb_storage/sections/.strtab b/test/sys/module/usb_storage/sections/.strtab new file mode 100644 index 0000000000..6064f35463 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa02e42d0 diff --git a/test/sys/module/usb_storage/sections/.symtab b/test/sys/module/usb_storage/sections/.symtab new file mode 100644 index 0000000000..55075357df --- /dev/null +++ b/test/sys/module/usb_storage/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa02e1900 diff --git a/test/sys/module/usb_storage/sections/.text b/test/sys/module/usb_storage/sections/.text new file mode 100644 index 0000000000..2a91d12ca3 --- /dev/null +++ b/test/sys/module/usb_storage/sections/.text @@ -0,0 +1 @@ +0xffffffffa02dd000 diff --git a/test/sys/module/usb_storage/sections/__param b/test/sys/module/usb_storage/sections/__param new file mode 100644 index 0000000000..a67a5a8e0b --- /dev/null +++ b/test/sys/module/usb_storage/sections/__param @@ -0,0 +1 @@ +0xffffffffa02e18b0 diff --git a/test/sys/module/usb_storage/srcversion b/test/sys/module/usb_storage/srcversion new file mode 100644 index 0000000000..0045fcb1ec --- /dev/null +++ b/test/sys/module/usb_storage/srcversion @@ -0,0 +1 @@ +D07F7C47643AB7AFB6BEF6F diff --git a/test/sys/module/usbcore/drivers/usb:hub b/test/sys/module/usbcore/drivers/usb:hub new file mode 120000 index 0000000000..610e86cda5 --- /dev/null +++ b/test/sys/module/usbcore/drivers/usb:hub @@ -0,0 +1 @@ +../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/module/usbcore/drivers/usb:usb b/test/sys/module/usbcore/drivers/usb:usb new file mode 120000 index 0000000000..5a9e5d0958 --- /dev/null +++ b/test/sys/module/usbcore/drivers/usb:usb @@ -0,0 +1 @@ +../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/module/usbcore/drivers/usb:usbfs b/test/sys/module/usbcore/drivers/usb:usbfs new file mode 120000 index 0000000000..0827b1487c --- /dev/null +++ b/test/sys/module/usbcore/drivers/usb:usbfs @@ -0,0 +1 @@ +../../../bus/usb/drivers/usbfs \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/cdc_acm b/test/sys/module/usbcore/holders/cdc_acm new file mode 120000 index 0000000000..26b62c4122 --- /dev/null +++ b/test/sys/module/usbcore/holders/cdc_acm @@ -0,0 +1 @@ +../../cdc_acm \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/ehci_hcd b/test/sys/module/usbcore/holders/ehci_hcd new file mode 120000 index 0000000000..5f0529c1bd --- /dev/null +++ b/test/sys/module/usbcore/holders/ehci_hcd @@ -0,0 +1 @@ +../../ehci_hcd \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/uhci_hcd b/test/sys/module/usbcore/holders/uhci_hcd new file mode 120000 index 0000000000..69c656f6c2 --- /dev/null +++ b/test/sys/module/usbcore/holders/uhci_hcd @@ -0,0 +1 @@ +../../uhci_hcd \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/usb_storage b/test/sys/module/usbcore/holders/usb_storage new file mode 120000 index 0000000000..21ab5abc8e --- /dev/null +++ b/test/sys/module/usbcore/holders/usb_storage @@ -0,0 +1 @@ +../../usb_storage \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/usbhid b/test/sys/module/usbcore/holders/usbhid new file mode 120000 index 0000000000..fa4793fa31 --- /dev/null +++ b/test/sys/module/usbcore/holders/usbhid @@ -0,0 +1 @@ +../../usbhid \ No newline at end of file diff --git a/test/sys/module/usbcore/initstate b/test/sys/module/usbcore/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/usbcore/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/usbcore/notes/.note.gnu.build-id b/test/sys/module/usbcore/notes/.note.gnu.build-id new file mode 100644 index 0000000000..eb27ff4ea8 Binary files /dev/null and b/test/sys/module/usbcore/notes/.note.gnu.build-id differ diff --git a/test/sys/module/usbcore/parameters/autosuspend b/test/sys/module/usbcore/parameters/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/usbcore/parameters/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/usbcore/parameters/blinkenlights b/test/sys/module/usbcore/parameters/blinkenlights new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/usbcore/parameters/blinkenlights @@ -0,0 +1 @@ +N diff --git a/test/sys/module/usbcore/parameters/nousb b/test/sys/module/usbcore/parameters/nousb new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/usbcore/parameters/nousb @@ -0,0 +1 @@ +N diff --git a/test/sys/module/usbcore/parameters/old_scheme_first b/test/sys/module/usbcore/parameters/old_scheme_first new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/usbcore/parameters/old_scheme_first @@ -0,0 +1 @@ +N diff --git a/test/sys/module/usbcore/parameters/usbfs_snoop b/test/sys/module/usbcore/parameters/usbfs_snoop new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/usbcore/parameters/usbfs_snoop @@ -0,0 +1 @@ +N diff --git a/test/sys/module/usbcore/parameters/use_both_schemes b/test/sys/module/usbcore/parameters/use_both_schemes new file mode 100644 index 0000000000..9bda8c35c2 --- /dev/null +++ b/test/sys/module/usbcore/parameters/use_both_schemes @@ -0,0 +1 @@ +Y diff --git a/test/sys/module/usbcore/refcnt b/test/sys/module/usbcore/refcnt new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/module/usbcore/refcnt @@ -0,0 +1 @@ +5 diff --git a/test/sys/module/usbcore/sections/.bss b/test/sys/module/usbcore/sections/.bss new file mode 100644 index 0000000000..7b2c0092a3 --- /dev/null +++ b/test/sys/module/usbcore/sections/.bss @@ -0,0 +1 @@ +0xffffffffa005cec0 diff --git a/test/sys/module/usbcore/sections/.data b/test/sys/module/usbcore/sections/.data new file mode 100644 index 0000000000..a7369af09d --- /dev/null +++ b/test/sys/module/usbcore/sections/.data @@ -0,0 +1 @@ +0xffffffffa005af00 diff --git a/test/sys/module/usbcore/sections/.exit.text b/test/sys/module/usbcore/sections/.exit.text new file mode 100644 index 0000000000..1a76333e54 --- /dev/null +++ b/test/sys/module/usbcore/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa004ba30 diff --git a/test/sys/module/usbcore/sections/.fixup b/test/sys/module/usbcore/sections/.fixup new file mode 100644 index 0000000000..431e7b306e --- /dev/null +++ b/test/sys/module/usbcore/sections/.fixup @@ -0,0 +1 @@ +0xffffffffa004ba87 diff --git a/test/sys/module/usbcore/sections/.gnu.linkonce.this_module b/test/sys/module/usbcore/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..5bd1255670 --- /dev/null +++ b/test/sys/module/usbcore/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa005cb00 diff --git a/test/sys/module/usbcore/sections/.init.text b/test/sys/module/usbcore/sections/.init.text new file mode 100644 index 0000000000..02c713a482 --- /dev/null +++ b/test/sys/module/usbcore/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0027000 diff --git a/test/sys/module/usbcore/sections/.note.gnu.build-id b/test/sys/module/usbcore/sections/.note.gnu.build-id new file mode 100644 index 0000000000..ac15d62109 --- /dev/null +++ b/test/sys/module/usbcore/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa004bb30 diff --git a/test/sys/module/usbcore/sections/.rodata b/test/sys/module/usbcore/sections/.rodata new file mode 100644 index 0000000000..b91dcd7811 --- /dev/null +++ b/test/sys/module/usbcore/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa004bb60 diff --git a/test/sys/module/usbcore/sections/.rodata.str1.1 b/test/sys/module/usbcore/sections/.rodata.str1.1 new file mode 100644 index 0000000000..972e9d3f61 --- /dev/null +++ b/test/sys/module/usbcore/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa004c044 diff --git a/test/sys/module/usbcore/sections/.smp_locks b/test/sys/module/usbcore/sections/.smp_locks new file mode 100644 index 0000000000..ba252c1f48 --- /dev/null +++ b/test/sys/module/usbcore/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa004f930 diff --git a/test/sys/module/usbcore/sections/.strtab b/test/sys/module/usbcore/sections/.strtab new file mode 100644 index 0000000000..f7aa4bd1a8 --- /dev/null +++ b/test/sys/module/usbcore/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0055cf8 diff --git a/test/sys/module/usbcore/sections/.symtab b/test/sys/module/usbcore/sections/.symtab new file mode 100644 index 0000000000..db962319e1 --- /dev/null +++ b/test/sys/module/usbcore/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa004fb18 diff --git a/test/sys/module/usbcore/sections/.text b/test/sys/module/usbcore/sections/.text new file mode 100644 index 0000000000..18822d3d85 --- /dev/null +++ b/test/sys/module/usbcore/sections/.text @@ -0,0 +1 @@ +0xffffffffa0038000 diff --git a/test/sys/module/usbcore/sections/__bug_table b/test/sys/module/usbcore/sections/__bug_table new file mode 100644 index 0000000000..c58f602ca9 --- /dev/null +++ b/test/sys/module/usbcore/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa004fa40 diff --git a/test/sys/module/usbcore/sections/__ex_table b/test/sys/module/usbcore/sections/__ex_table new file mode 100644 index 0000000000..13cd7abc44 --- /dev/null +++ b/test/sys/module/usbcore/sections/__ex_table @@ -0,0 +1 @@ +0xffffffffa004fa58 diff --git a/test/sys/module/usbcore/sections/__kcrctab_gpl b/test/sys/module/usbcore/sections/__kcrctab_gpl new file mode 100644 index 0000000000..ad656977f0 --- /dev/null +++ b/test/sys/module/usbcore/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa004ef70 diff --git a/test/sys/module/usbcore/sections/__ksymtab_gpl b/test/sys/module/usbcore/sections/__ksymtab_gpl new file mode 100644 index 0000000000..fda0fba578 --- /dev/null +++ b/test/sys/module/usbcore/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa004ea30 diff --git a/test/sys/module/usbcore/sections/__ksymtab_strings b/test/sys/module/usbcore/sections/__ksymtab_strings new file mode 100644 index 0000000000..a8b72eceee --- /dev/null +++ b/test/sys/module/usbcore/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa004f300 diff --git a/test/sys/module/usbcore/sections/__param b/test/sys/module/usbcore/sections/__param new file mode 100644 index 0000000000..20a20138a1 --- /dev/null +++ b/test/sys/module/usbcore/sections/__param @@ -0,0 +1 @@ +0xffffffffa004f210 diff --git a/test/sys/module/usbcore/srcversion b/test/sys/module/usbcore/srcversion new file mode 100644 index 0000000000..cbae6b2dd3 --- /dev/null +++ b/test/sys/module/usbcore/srcversion @@ -0,0 +1 @@ +4FF77EB8DAB25F4076D7357 diff --git a/test/sys/module/usbhid/drivers/usb:usbhid b/test/sys/module/usbhid/drivers/usb:usbhid new file mode 120000 index 0000000000..8c8b2c3944 --- /dev/null +++ b/test/sys/module/usbhid/drivers/usb:usbhid @@ -0,0 +1 @@ +../../../bus/usb/drivers/usbhid \ No newline at end of file diff --git a/test/sys/module/usbhid/initstate b/test/sys/module/usbhid/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/usbhid/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/usbhid/notes/.note.gnu.build-id b/test/sys/module/usbhid/notes/.note.gnu.build-id new file mode 100644 index 0000000000..dfaf096cda Binary files /dev/null and b/test/sys/module/usbhid/notes/.note.gnu.build-id differ diff --git a/test/sys/module/usbhid/parameters/mousepoll b/test/sys/module/usbhid/parameters/mousepoll new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/usbhid/parameters/mousepoll @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/usbhid/parameters/quirks b/test/sys/module/usbhid/parameters/quirks new file mode 100644 index 0000000000..f23b0f9e5f --- /dev/null +++ b/test/sys/module/usbhid/parameters/quirks @@ -0,0 +1 @@ +,,, diff --git a/test/sys/module/usbhid/parameters/rdesc_quirks b/test/sys/module/usbhid/parameters/rdesc_quirks new file mode 100644 index 0000000000..f23b0f9e5f --- /dev/null +++ b/test/sys/module/usbhid/parameters/rdesc_quirks @@ -0,0 +1 @@ +,,, diff --git a/test/sys/module/usbhid/refcnt b/test/sys/module/usbhid/refcnt new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/module/usbhid/refcnt @@ -0,0 +1 @@ +0 diff --git a/test/sys/module/usbhid/sections/.bss b/test/sys/module/usbhid/sections/.bss new file mode 100644 index 0000000000..a07f5cdf62 --- /dev/null +++ b/test/sys/module/usbhid/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0203d80 diff --git a/test/sys/module/usbhid/sections/.data b/test/sys/module/usbhid/sections/.data new file mode 100644 index 0000000000..5484c3b174 --- /dev/null +++ b/test/sys/module/usbhid/sections/.data @@ -0,0 +1 @@ +0xffffffffa02037c0 diff --git a/test/sys/module/usbhid/sections/.exit.text b/test/sys/module/usbhid/sections/.exit.text new file mode 100644 index 0000000000..5217f1176e --- /dev/null +++ b/test/sys/module/usbhid/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0200c6c diff --git a/test/sys/module/usbhid/sections/.gnu.linkonce.this_module b/test/sys/module/usbhid/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..d21c96a8a3 --- /dev/null +++ b/test/sys/module/usbhid/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa02039c0 diff --git a/test/sys/module/usbhid/sections/.init.text b/test/sys/module/usbhid/sections/.init.text new file mode 100644 index 0000000000..f34ada03b5 --- /dev/null +++ b/test/sys/module/usbhid/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0065000 diff --git a/test/sys/module/usbhid/sections/.note.gnu.build-id b/test/sys/module/usbhid/sections/.note.gnu.build-id new file mode 100644 index 0000000000..d47046fbda --- /dev/null +++ b/test/sys/module/usbhid/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0200c84 diff --git a/test/sys/module/usbhid/sections/.rodata b/test/sys/module/usbhid/sections/.rodata new file mode 100644 index 0000000000..e4d4313bb1 --- /dev/null +++ b/test/sys/module/usbhid/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0200cc0 diff --git a/test/sys/module/usbhid/sections/.rodata.str1.1 b/test/sys/module/usbhid/sections/.rodata.str1.1 new file mode 100644 index 0000000000..daafd879e1 --- /dev/null +++ b/test/sys/module/usbhid/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa02017a8 diff --git a/test/sys/module/usbhid/sections/.smp_locks b/test/sys/module/usbhid/sections/.smp_locks new file mode 100644 index 0000000000..362619b927 --- /dev/null +++ b/test/sys/module/usbhid/sections/.smp_locks @@ -0,0 +1 @@ +0xffffffffa0201700 diff --git a/test/sys/module/usbhid/sections/.strtab b/test/sys/module/usbhid/sections/.strtab new file mode 100644 index 0000000000..ffe710d197 --- /dev/null +++ b/test/sys/module/usbhid/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0202e68 diff --git a/test/sys/module/usbhid/sections/.symtab b/test/sys/module/usbhid/sections/.symtab new file mode 100644 index 0000000000..39f534b35f --- /dev/null +++ b/test/sys/module/usbhid/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0201e90 diff --git a/test/sys/module/usbhid/sections/.text b/test/sys/module/usbhid/sections/.text new file mode 100644 index 0000000000..dc020a91c8 --- /dev/null +++ b/test/sys/module/usbhid/sections/.text @@ -0,0 +1 @@ +0xffffffffa01fe000 diff --git a/test/sys/module/usbhid/sections/__kcrctab_gpl b/test/sys/module/usbhid/sections/__kcrctab_gpl new file mode 100644 index 0000000000..10a86ee016 --- /dev/null +++ b/test/sys/module/usbhid/sections/__kcrctab_gpl @@ -0,0 +1 @@ +0xffffffffa0201e70 diff --git a/test/sys/module/usbhid/sections/__ksymtab_gpl b/test/sys/module/usbhid/sections/__ksymtab_gpl new file mode 100644 index 0000000000..92a68e4803 --- /dev/null +++ b/test/sys/module/usbhid/sections/__ksymtab_gpl @@ -0,0 +1 @@ +0xffffffffa0201e60 diff --git a/test/sys/module/usbhid/sections/__ksymtab_strings b/test/sys/module/usbhid/sections/__ksymtab_strings new file mode 100644 index 0000000000..717e054e14 --- /dev/null +++ b/test/sys/module/usbhid/sections/__ksymtab_strings @@ -0,0 +1 @@ +0xffffffffa0201e78 diff --git a/test/sys/module/usbhid/sections/__param b/test/sys/module/usbhid/sections/__param new file mode 100644 index 0000000000..c6bc71c35f --- /dev/null +++ b/test/sys/module/usbhid/sections/__param @@ -0,0 +1 @@ +0xffffffffa0201de0 diff --git a/test/sys/module/usbhid/srcversion b/test/sys/module/usbhid/srcversion new file mode 100644 index 0000000000..19fd49101a --- /dev/null +++ b/test/sys/module/usbhid/srcversion @@ -0,0 +1 @@ +3D7B82FE16E5E534DE4C12B diff --git a/test/sys/module/vt/parameters/default_blu b/test/sys/module/vt/parameters/default_blu new file mode 100644 index 0000000000..71263b55b5 --- /dev/null +++ b/test/sys/module/vt/parameters/default_blu @@ -0,0 +1 @@ +0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 diff --git a/test/sys/module/vt/parameters/default_grn b/test/sys/module/vt/parameters/default_grn new file mode 100644 index 0000000000..d37237dad8 --- /dev/null +++ b/test/sys/module/vt/parameters/default_grn @@ -0,0 +1 @@ +0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255 diff --git a/test/sys/module/vt/parameters/default_red b/test/sys/module/vt/parameters/default_red new file mode 100644 index 0000000000..d53982982c --- /dev/null +++ b/test/sys/module/vt/parameters/default_red @@ -0,0 +1 @@ +0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255 diff --git a/test/sys/module/vt/parameters/default_utf8 b/test/sys/module/vt/parameters/default_utf8 new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/vt/parameters/default_utf8 @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/vt/parameters/italic b/test/sys/module/vt/parameters/italic new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/module/vt/parameters/italic @@ -0,0 +1 @@ +2 diff --git a/test/sys/module/vt/parameters/underline b/test/sys/module/vt/parameters/underline new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/module/vt/parameters/underline @@ -0,0 +1 @@ +3 diff --git a/test/sys/module/yenta_socket/drivers/pci:yenta_cardbus b/test/sys/module/yenta_socket/drivers/pci:yenta_cardbus new file mode 120000 index 0000000000..8cc0e37a53 --- /dev/null +++ b/test/sys/module/yenta_socket/drivers/pci:yenta_cardbus @@ -0,0 +1 @@ +../../../bus/pci/drivers/yenta_cardbus \ No newline at end of file diff --git a/test/sys/module/yenta_socket/initstate b/test/sys/module/yenta_socket/initstate new file mode 100644 index 0000000000..e23fe645b7 --- /dev/null +++ b/test/sys/module/yenta_socket/initstate @@ -0,0 +1 @@ +live diff --git a/test/sys/module/yenta_socket/notes/.note.gnu.build-id b/test/sys/module/yenta_socket/notes/.note.gnu.build-id new file mode 100644 index 0000000000..b7f1fa8fef Binary files /dev/null and b/test/sys/module/yenta_socket/notes/.note.gnu.build-id differ diff --git a/test/sys/module/yenta_socket/parameters/disable_clkrun b/test/sys/module/yenta_socket/parameters/disable_clkrun new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/yenta_socket/parameters/disable_clkrun @@ -0,0 +1 @@ +N diff --git a/test/sys/module/yenta_socket/parameters/isa_probe b/test/sys/module/yenta_socket/parameters/isa_probe new file mode 100644 index 0000000000..9bda8c35c2 --- /dev/null +++ b/test/sys/module/yenta_socket/parameters/isa_probe @@ -0,0 +1 @@ +Y diff --git a/test/sys/module/yenta_socket/parameters/pwr_irqs_off b/test/sys/module/yenta_socket/parameters/pwr_irqs_off new file mode 100644 index 0000000000..d52e798775 --- /dev/null +++ b/test/sys/module/yenta_socket/parameters/pwr_irqs_off @@ -0,0 +1 @@ +N diff --git a/test/sys/module/yenta_socket/refcnt b/test/sys/module/yenta_socket/refcnt new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/module/yenta_socket/refcnt @@ -0,0 +1 @@ +1 diff --git a/test/sys/module/yenta_socket/sections/.bss b/test/sys/module/yenta_socket/sections/.bss new file mode 100644 index 0000000000..4778184bfd --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.bss @@ -0,0 +1 @@ +0xffffffffa0107800 diff --git a/test/sys/module/yenta_socket/sections/.data b/test/sys/module/yenta_socket/sections/.data new file mode 100644 index 0000000000..7c066485c3 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.data @@ -0,0 +1 @@ +0xffffffffa0106ac0 diff --git a/test/sys/module/yenta_socket/sections/.devinit.text b/test/sys/module/yenta_socket/sections/.devinit.text new file mode 100644 index 0000000000..67594d9569 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.devinit.text @@ -0,0 +1 @@ +0xffffffffa0103c60 diff --git a/test/sys/module/yenta_socket/sections/.exit.text b/test/sys/module/yenta_socket/sections/.exit.text new file mode 100644 index 0000000000..98704b1032 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.exit.text @@ -0,0 +1 @@ +0xffffffffa0103c44 diff --git a/test/sys/module/yenta_socket/sections/.gnu.linkonce.this_module b/test/sys/module/yenta_socket/sections/.gnu.linkonce.this_module new file mode 100644 index 0000000000..23cd2ee6c2 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.gnu.linkonce.this_module @@ -0,0 +1 @@ +0xffffffffa0107440 diff --git a/test/sys/module/yenta_socket/sections/.init.text b/test/sys/module/yenta_socket/sections/.init.text new file mode 100644 index 0000000000..9da5e610a8 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.init.text @@ -0,0 +1 @@ +0xffffffffa0084000 diff --git a/test/sys/module/yenta_socket/sections/.note.gnu.build-id b/test/sys/module/yenta_socket/sections/.note.gnu.build-id new file mode 100644 index 0000000000..6714b3839d --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.note.gnu.build-id @@ -0,0 +1 @@ +0xffffffffa0104330 diff --git a/test/sys/module/yenta_socket/sections/.rodata b/test/sys/module/yenta_socket/sections/.rodata new file mode 100644 index 0000000000..ca2a85e3ed --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.rodata @@ -0,0 +1 @@ +0xffffffffa0104354 diff --git a/test/sys/module/yenta_socket/sections/.rodata.str1.1 b/test/sys/module/yenta_socket/sections/.rodata.str1.1 new file mode 100644 index 0000000000..dc50845825 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.rodata.str1.1 @@ -0,0 +1 @@ +0xffffffffa0104388 diff --git a/test/sys/module/yenta_socket/sections/.strtab b/test/sys/module/yenta_socket/sections/.strtab new file mode 100644 index 0000000000..704fd08f39 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.strtab @@ -0,0 +1 @@ +0xffffffffa0105e80 diff --git a/test/sys/module/yenta_socket/sections/.symtab b/test/sys/module/yenta_socket/sections/.symtab new file mode 100644 index 0000000000..79e56583e4 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.symtab @@ -0,0 +1 @@ +0xffffffffa0104b78 diff --git a/test/sys/module/yenta_socket/sections/.text b/test/sys/module/yenta_socket/sections/.text new file mode 100644 index 0000000000..e857ebdb62 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/.text @@ -0,0 +1 @@ +0xffffffffa0101000 diff --git a/test/sys/module/yenta_socket/sections/__bug_table b/test/sys/module/yenta_socket/sections/__bug_table new file mode 100644 index 0000000000..bb16e1420d --- /dev/null +++ b/test/sys/module/yenta_socket/sections/__bug_table @@ -0,0 +1 @@ +0xffffffffa0104aa6 diff --git a/test/sys/module/yenta_socket/sections/__param b/test/sys/module/yenta_socket/sections/__param new file mode 100644 index 0000000000..3e87072863 --- /dev/null +++ b/test/sys/module/yenta_socket/sections/__param @@ -0,0 +1 @@ +0xffffffffa0104ad8 diff --git a/test/sys/module/yenta_socket/srcversion b/test/sys/module/yenta_socket/srcversion new file mode 100644 index 0000000000..43d40e3ba7 --- /dev/null +++ b/test/sys/module/yenta_socket/srcversion @@ -0,0 +1 @@ +B0538CB6E6ED071E80A4575 diff --git a/test/sys/power/state b/test/sys/power/state new file mode 100644 index 0000000000..9f5c0b2a82 --- /dev/null +++ b/test/sys/power/state @@ -0,0 +1 @@ +mem diff --git a/test/udev-test.pl b/test/udev-test.pl index d7357d713d..26337cb840 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -33,157 +33,157 @@ my @tests = ( { desc => "label test of scsi disc (old key names)", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "label test of scsi disc (old key names)", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "label test of scsi disc", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "label test of scsi partition", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "label test of pattern match", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "label test of multiple sysfs files", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "label test of max sysfs files", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "catch device by *", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor/0" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem/0" , rules => < "catch device by * - take 2", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor/0" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem/0" , rules => < "catch device by ?", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor/0" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem/0" , rules => < "catch device by character class", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor/0" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem/0" , rules => < "replace kernel name", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem" , rules => < "Handle comment lines in config file (and replace kernel name)", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem" , rules => < "Handle comment lines in config file with whitespace (and replace kernel name)", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem" , rules => < "Handle whitespace only lines (and replace kernel name)", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "whitespace" , rules => < "Handle empty lines in config file (and replace kernel name)", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem" , rules => < "Handle backslashed multi lines in config file (and replace kernel name)", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem" , rules => < "preserve backslashes, if they are not for a newline", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "aaa", rules => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem" , rules => < "subdirectory handling", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "sub/direct/ory/visor" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "sub/direct/ory/modem" , rules => < "parent device name match of scsi partition", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "first_disk3" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "first_disk5" , rules => < "test substitution chars (old key names)", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "Major:8:minor:3:kernelnumber:3:id:0:0:0:0" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , rules => < "test substitution chars", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "Major:8:minor:3:kernelnumber:3:id:0:0:0:0" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , rules => < "test substitution chars (with length limit)", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "M8-m3-n3-b0:0-sIBM" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "M8-m5-n5-b0:0-xAT" , rules => < "import of shell-value file", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "subdir/err/node" , rules => < "import of shell-value returned from program", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node12345678", rules => < "sustitution of sysfs value (%s{file})", subsys => "block", - devpath => "/block/sda", - exp_name => "disk-IBM-ESXS-sda" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "disk-ATA-sda" , rules => < "program result substitution", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "special-device-3" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "special-device-5" , rules => < "program result substitution (newline removal)", subsys => "block", - devpath => "/block/sda/sda3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "newline_removed" , rules => < "program result substitution", subsys => "block", - devpath => "/block/sda/sda3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "test-0:0:0:0" , rules => < "program with escaped format char (tricky: callout returns format char!)", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "escape-3" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "escape-5" , rules => < "program with lots of arguments", subsys => "block", - devpath => "/block/sda/sda3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo9" , rules => < "program with subshell", subsys => "block", - devpath => "/block/sda/sda3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "bar9" , rules => < "program arguments combined with apostrophes", subsys => "block", - devpath => "/block/sda/sda3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo7" , rules => < "characters before the %c{N} substitution", subsys => "block", - devpath => "/block/sda/sda3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo9" , rules => < "substitute the second to last argument", subsys => "block", - devpath => "/block/sda/sda3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo8" , rules => < "test substitution by variable name", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "Major:8-minor:3-kernelnumber:3-id:0:0:0:0", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", rules => < "test substitution by variable name 2", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "Major:8-minor:3-kernelnumber:3-id:0:0:0:0", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", rules => < "test substitution by variable name 3", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "830:0:0:03" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "850:0:0:05" , rules => < "test substitution by variable name 4", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "833" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "855" , rules => < "test substitution by variable name 5", subsys => "block", - devpath => "/block/sda/sda3", - exp_name => "8330:0:0:0" , + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "8550:0:0:0" , rules => < "non matching SUBSYSTEMS for device with no parent", subsys => "tty", - devpath => "/class/tty/console", + devpath => "/devices/virtual/tty/console", exp_name => "TTY", rules => < "non matching SUBSYSTEMS", subsys => "tty", - devpath => "/class/tty/console", + devpath => "/devices/virtual/tty/console", exp_name => "TTY" , rules => < "ATTRS match", subsys => "tty", - devpath => "/class/tty/console", + devpath => "/devices/virtual/tty/console", exp_name => "foo" , rules => < "program and bus type match", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0" , rules => < "create all possible partitions", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk15" , exp_majorminor => "8:15", rules => < "sysfs parent hierarchy", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor" , + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem" , rules => < "name test with ! in the name", subsys => "block", - devpath => "/block/rd!c0d0", - exp_name => "rd/c0d0" , + devpath => "/devices/virtual/block/fake!blockdev0", + exp_name => "is/a/fake/blockdev0" , rules => < "name test with ! in the name, but no matching rule", subsys => "block", - devpath => "/block/rd!c0d0", - exp_name => "rd/c0d0" , + devpath => "/devices/virtual/block/fake!blockdev0", + exp_name => "fake/blockdev0" , rules => < "name test with ! in the name for a partition", - subsys => "block", - devpath => "/block/cciss!c0d0/cciss!c0d0p1", - exp_name => "cciss/c0d0p1" , - rules => < "KERNELS rule", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "KERNELS wildcard all", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "KERNELS wildcard partial", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "KERNELS wildcard partial 2", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "substitute attr with link target value (first match)", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "driver-is-sd", rules => < "substitute attr with link target value (currently selected device)", subsys => "block", - devpath => "/block/sda", - exp_name => "driver-is-aic7xxx", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "driver-is-ahci", rules => < "ignore ATTRS attribute whitespace", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ignored", rules => < "do not ignore ATTRS attribute whitespace", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "matched-with-space", rules => < "permissions OWNER=5000", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "5000::0660", rules => < "permissions GROUP=100", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => ":100:0660", rules => < "textual user id", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "nobody::0660", rules => < "textual group id", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => ":daemon:0660", rules => < "textual user/group id", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "root:mail:0660", rules => < "permissions MODE=0777", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "::0777", rules => < "permissions OWNER=5000 GROUP=100 MODE=0777", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "5000:100:0777", rules => < "permissions OWNER to 5000", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "ttyACM0", exp_perms => "5000::", rules => < "permissions GROUP to 100", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "ttyACM0", exp_perms => ":100:0660", rules => < "permissions MODE to 0060", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "ttyACM0", exp_perms => "::0060", rules => < "permissions OWNER, GROUP, MODE", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "ttyACM0", exp_perms => "5000:100:0777", rules => < "permissions only rule", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "ttyACM0", exp_perms => "5000:100:0777", rules => < "multiple permissions only rule", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "ttyACM0", exp_perms => "3000:4000:0777", rules => < "permissions only rule with override at NAME rule", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "ttyACM0", exp_perms => "3000:8000:0777", rules => < "major/minor number test", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_majorminor => "8:0", rules => < "big minor number test", - subsys => "i2c-dev", - devpath => "/class/i2c-dev/i2c-300", - exp_name => "node", - exp_majorminor => "89:300", - rules => < "big major number test", - subsys => "i2c-dev", - devpath => "/class/i2c-dev/i2c-fake1", + subsys => "misc", + devpath => "/devices/virtual/misc/misc-fake1", exp_name => "node", exp_majorminor => "4095:1", rules => < "big major and big minor number test", - subsys => "i2c-dev", - devpath => "/class/i2c-dev/i2c-fake2", + subsys => "misc", + devpath => "/devices/virtual/misc/misc-fake89999", exp_name => "node", - exp_majorminor => "4094:89999", + exp_majorminor => "4095:89999", rules => < "multiple symlinks with format char", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "symlink2-ttyUSB0", - exp_target => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "symlink2-ttyACM0", + exp_target => "ttyACM0", rules => < "multiple symlinks with a lot of s p a c e s", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "one", not_exp_name => " ", - exp_target => "ttyUSB0", + exp_target => "ttyACM0", rules => < "symlink creation (same directory)", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "visor0", - exp_target => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "modem0", + exp_target => "ttyACM0", rules => < "symlink creation (relative link forward)", subsys => "block", - devpath => "/block/sda/sda2", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", exp_name => "1/2/symlink" , exp_target => "a/b/node", rules => < "symlink creation (relative link back and forward)", subsys => "block", - devpath => "/block/sda/sda2", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", exp_name => "1/2/c/d/symlink" , exp_target => "../../a/b/node", rules => < "multiple symlinks", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "second-0" , - exp_target => "visor" , + exp_target => "modem" , rules => < "symlink only rule", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "symlink-only2", exp_target => "link", rules => < "symlink name '.'", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => ".", exp_target => "link", exp_add_error => "yes", @@ -917,37 +898,37 @@ EOF { desc => "symlink %n substitution", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "symlink0", - exp_target => "ttyUSB0", + exp_target => "ttyACM0", rules => < "symlink %k substitution", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "symlink-ttyUSB0", - exp_target => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "symlink-ttyACM0", + exp_target => "ttyACM0", rules => < "symlink %M:%m substitution", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "major-188:0", - exp_target => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "major-166:0", + exp_target => "ttyACM0", rules => < "symlink %b substitution", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "symlink-0:0:0:0", exp_target => "node", rules => < "symlink %c substitution", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "test", - exp_target => "ttyUSB0", + exp_target => "ttyACM0", rules => < "symlink %c{N} substitution", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "test", - exp_target => "ttyUSB0", + exp_target => "ttyACM0", rules => < "symlink %c{N+} substitution", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "this", - exp_target => "ttyUSB0", + exp_target => "ttyACM0", rules => < "symlink only rule with %c{N+}", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "test", exp_target => "link", rules => < "symlink %s{filename} substitution", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "188:0", - exp_target => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "166:0", + exp_target => "ttyACM0", rules => < "symlink %Ns{filename} substitution", subsys => "tty", - devpath => "/class/tty/ttyUSB0", - exp_name => "188", - exp_target => "ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "166", + exp_target => "ttyACM0", rules => < "program result substitution (numbered part of)", subsys => "block", - devpath => "/block/sda/sda3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link1", exp_target => "node", rules => < "program result substitution (numbered part of+)", subsys => "block", - devpath => "/block/sda/sda3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link4", exp_target => "node", rules => < "ignore rule test", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "nothing", not_exp_name => "node", exp_add_error => "yes", @@ -1049,7 +1030,7 @@ EOF { desc => "all_partitions, option-only rule", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node6", rules => < "all_partitions, option-only rule (fail on partition)", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "node6", exp_add_error => "yes", rules => < "ignore remove event test", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_rem_error => "yes", rules => < "ignore remove event test (with all partitions)", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node14", exp_rem_error => "yes", option => "clean", @@ -1091,7 +1072,7 @@ EOF { desc => "SUBSYSTEM match test", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "DRIVERS match test", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "temporary node creation test", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "devpath substitution test", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", rules => < "parent node name substitution test sequence 1/2 (keep)", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "main_device", option => "keep", rules => < "parent node name substitution test sequence 2/2 (clean)", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "main_device-part-1", option => "clean", rules => < "udev_root substitution", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "start-udev-root-end", rules => < "last_rule option", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "last", rules => < "negation KERNEL!=", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "match", rules => < "negation SUBSYSTEM!=", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "not-anything", rules => < "negation PROGRAM!= exit code", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "nonzero-program", rules => < "test for whitespace between the operator", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test (assign)", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test (assign 2 times)", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test (assign2)", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "part", rules => < "untrusted string sanitize", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "sane", rules => < "untrusted string sanitize (don't replace utf8)", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "uber", rules => < "untrusted string sanitize (replace invalid utf8)", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "replaced", rules => < "read sysfs value from device down in the chain", subsys => "block", - devpath => "/class/tty/ttyUSB0", - exp_name => "serial-0000:00:09.0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + exp_name => "serial-354172020305000", rules => < "match against empty key string", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", rules => < "check ACTION value", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", rules => < "apply NAME only once", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "link", exp_target => "ok", rules => < "test RUN key", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "testsymlink", exp_target => "ok", exp_rem_error => "yes", @@ -1355,7 +1336,7 @@ EOF { desc => "test RUN key and DEVNAME", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "testsymlink", exp_target => "ok", exp_rem_error => "yes", @@ -1368,7 +1349,7 @@ EOF { desc => "test RUN key remove", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "testsymlink2", exp_target => "ok2", rules => < "final assignment", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", exp_perms => "root:nobody:0640", rules => < "final assignment", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", exp_perms => "root:nobody:0640", rules => < "env substitution", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node-add-me", rules => < "reset list to current value", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "three", not_exp_name => "two", exp_target => "node", rules => < "test empty NAME", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "node", not_exp_name => "wrong", exp_add_error => "yes", rules => < "test empty NAME 2", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "right", rules => < "test multi matches", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "right", rules => < "test multi matches 2", subsys => "tty", - devpath => "/class/tty/ttyUSB0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", exp_name => "right", rules => < "IMPORT parent test sequence 1/2 (keep)", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "parent", option => "keep", rules => < "IMPORT parent test sequence 2/2 (keep)", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "parentenv-parent_right", option => "clean", rules => < "GOTO test", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "right", rules => < "NAME compare test", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "link", exp_target => "node", not_exp_name => "wronglink", @@ -1519,7 +1500,7 @@ EOF { desc => "NAME compare test 2", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "link2", exp_target => "sda1", not_exp_name => "link", @@ -1531,7 +1512,7 @@ EOF { desc => "invalid key operation", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "yes", rules => < "operator chars in attribute", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "yes", rules => < "overlong comment line", subsys => "block", - devpath => "/block/sda/sda1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "yes", rules => < "magic subsys/kernel lookup", subsys => "block", - devpath => "/block/sda", - exp_name => "00:e0:00:fb:04:e1", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "00:16:41:e2:8d:ff", rules => < "TEST absolute path", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "there", rules => < "TEST subsys/kernel lookup", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "yes", rules => < "TEST relative path", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "relative", rules => < "TEST wildcard substitution (find queue/nr_requests)", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "found-subdir", rules => < "TEST MODE=0000", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "0:0:0000", rules => < "TEST PROGRAM feeds MODE", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "0:0:0400", rules => < "TEST PROGRAM feeds MODE with overflow", subsys => "block", - devpath => "/block/sda", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "0:0:0400", rules => < Date: Mon, 29 Sep 2008 05:01:12 +0200 Subject: test: add missing pci directory because of .gitignore *.7 --- test/sys/block/sdb | 2 +- test/sys/bus/acpi/drivers_probe | 0 test/sys/bus/acpi/uevent | 0 test/sys/bus/pci/drivers_probe | 0 test/sys/bus/pci/uevent | 0 test/sys/bus/pci_express/drivers_probe | 0 test/sys/bus/pci_express/uevent | 0 test/sys/bus/pcmcia/drivers_probe | 0 test/sys/bus/pcmcia/uevent | 0 test/sys/bus/platform/drivers_probe | 0 test/sys/bus/platform/uevent | 0 test/sys/bus/pnp/drivers_probe | 0 test/sys/bus/pnp/uevent | 0 test/sys/bus/scsi/devices/6:0:0:0 | 1 - test/sys/bus/scsi/devices/7:0:0:0 | 1 + test/sys/bus/scsi/devices/host6 | 1 - test/sys/bus/scsi/devices/host7 | 1 + test/sys/bus/scsi/devices/target6:0:0 | 1 - test/sys/bus/scsi/devices/target7:0:0 | 1 + test/sys/bus/scsi/drivers/sd/6:0:0:0 | 1 - test/sys/bus/scsi/drivers/sd/7:0:0:0 | 1 + test/sys/bus/scsi/drivers_probe | 0 test/sys/bus/scsi/uevent | 0 test/sys/bus/serio/drivers_probe | 0 test/sys/bus/serio/uevent | 0 test/sys/bus/usb/devices/5-1:1.1 | 1 - test/sys/bus/usb/devices/5-1:1.10 | 1 - test/sys/bus/usb/devices/5-1:1.11 | 1 - test/sys/bus/usb/devices/5-1:1.12 | 1 - test/sys/bus/usb/devices/5-1:1.13 | 1 - test/sys/bus/usb/devices/5-1:1.2 | 1 - test/sys/bus/usb/devices/5-1:1.3 | 1 - test/sys/bus/usb/devices/5-1:1.4 | 1 - test/sys/bus/usb/devices/5-1:1.5 | 1 - test/sys/bus/usb/devices/5-1:1.6 | 1 - test/sys/bus/usb/devices/5-1:1.9 | 1 - test/sys/bus/usb/devices/5-2:1.1 | 1 + test/sys/bus/usb/devices/5-2:1.10 | 1 + test/sys/bus/usb/devices/5-2:1.11 | 1 + test/sys/bus/usb/devices/5-2:1.12 | 1 + test/sys/bus/usb/devices/5-2:1.13 | 1 + test/sys/bus/usb/devices/5-2:1.2 | 1 + test/sys/bus/usb/devices/5-2:1.3 | 1 + test/sys/bus/usb/devices/5-2:1.4 | 1 + test/sys/bus/usb/devices/5-2:1.5 | 1 + test/sys/bus/usb/devices/5-2:1.6 | 1 + test/sys/bus/usb/devices/5-2:1.9 | 1 + test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 | 1 - test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 | 1 - test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 | 1 + test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 | 1 + test/sys/bus/usb/drivers/usb-storage/5-1:1.0 | 1 + test/sys/bus/usb/drivers/usb-storage/5-2:1.0 | 1 - test/sys/bus/usb/drivers_probe | 0 test/sys/bus/usb/uevent | 0 test/sys/class/block/sdb | 2 +- test/sys/class/block/sdb1 | 2 +- test/sys/class/bsg/6:0:0:0 | 1 - test/sys/class/bsg/7:0:0:0 | 1 + test/sys/class/input/event7 | 2 +- test/sys/class/input/input7 | 1 - test/sys/class/input/input8 | 1 + test/sys/class/input/mouse1 | 2 +- test/sys/class/scsi_device/6:0:0:0 | 1 - test/sys/class/scsi_device/7:0:0:0 | 1 + test/sys/class/scsi_disk/6:0:0:0 | 1 - test/sys/class/scsi_disk/7:0:0:0 | 1 + test/sys/class/scsi_generic/sg2 | 2 +- test/sys/class/scsi_host/host6 | 1 - test/sys/class/scsi_host/host7 | 1 + test/sys/class/tty/ttyACM0 | 2 +- test/sys/class/usb_endpoint/usbdev3.3_ep00 | 1 - test/sys/class/usb_endpoint/usbdev3.3_ep81 | 1 - test/sys/class/usb_endpoint/usbdev3.4_ep00 | 1 + test/sys/class/usb_endpoint/usbdev3.4_ep81 | 1 + test/sys/class/usb_endpoint/usbdev5.5_ep00 | 1 - test/sys/class/usb_endpoint/usbdev5.5_ep01 | 1 - test/sys/class/usb_endpoint/usbdev5.5_ep02 | 1 - test/sys/class/usb_endpoint/usbdev5.5_ep81 | 1 - test/sys/class/usb_endpoint/usbdev5.5_ep82 | 1 - test/sys/class/usb_endpoint/usbdev5.5_ep83 | 1 - test/sys/class/usb_endpoint/usbdev5.5_ep84 | 1 - test/sys/class/usb_endpoint/usbdev5.6_ep00 | 1 - test/sys/class/usb_endpoint/usbdev5.6_ep02 | 1 - test/sys/class/usb_endpoint/usbdev5.6_ep81 | 1 - test/sys/class/usb_endpoint/usbdev5.7_ep00 | 1 + test/sys/class/usb_endpoint/usbdev5.7_ep02 | 1 + test/sys/class/usb_endpoint/usbdev5.7_ep81 | 1 + test/sys/class/usb_endpoint/usbdev5.9_ep00 | 1 + test/sys/class/usb_endpoint/usbdev5.9_ep01 | 1 + test/sys/class/usb_endpoint/usbdev5.9_ep02 | 1 + test/sys/class/usb_endpoint/usbdev5.9_ep81 | 1 + test/sys/class/usb_endpoint/usbdev5.9_ep82 | 1 + test/sys/class/usb_endpoint/usbdev5.9_ep83 | 1 + test/sys/class/usb_endpoint/usbdev5.9_ep84 | 1 + test/sys/dev/block/8:16 | 2 +- test/sys/dev/block/8:17 | 2 +- test/sys/dev/char/13:33 | 2 +- test/sys/dev/char/13:71 | 2 +- test/sys/dev/char/166:0 | 2 +- test/sys/dev/char/189:258 | 1 - test/sys/dev/char/189:259 | 1 + test/sys/dev/char/189:516 | 1 - test/sys/dev/char/189:517 | 1 - test/sys/dev/char/189:518 | 1 + test/sys/dev/char/189:520 | 1 + test/sys/dev/char/21:2 | 2 +- test/sys/dev/char/252:10 | 2 +- test/sys/dev/char/252:11 | 2 +- test/sys/dev/char/252:24 | 2 +- test/sys/dev/char/252:25 | 2 +- test/sys/dev/char/252:26 | 2 +- test/sys/dev/char/252:27 | 2 +- test/sys/dev/char/252:28 | 2 +- test/sys/dev/char/252:29 | 2 +- test/sys/dev/char/252:30 | 2 +- test/sys/dev/char/252:31 | 2 +- test/sys/dev/char/252:32 | 2 +- test/sys/dev/char/252:33 | 2 +- test/sys/dev/char/254:2 | 2 +- .../PNP0C09:00/ACPI0003:00/power_supply/AC/online | 2 +- .../PNP0C09:00/ACPI0003:00/power_supply/AC/uevent | 2 +- .../PNP0C0A:00/power_supply/BAT0/current_now | 2 +- .../PNP0C0A:00/power_supply/BAT0/energy_now | 2 +- .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status | 2 +- .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent | 8 +- .../PNP0C0A:00/power_supply/BAT0/voltage_now | 2 +- test/sys/devices/pci0000:00/0000:00:01.0/config | Bin 4096 -> 4096 bytes test/sys/devices/pci0000:00/0000:00:1c.0/config | Bin 4096 -> 4096 bytes .../0000:03:00.0/net/wlan0/statistics/rx_bytes | 2 +- .../0000:03:00.0/net/wlan0/statistics/rx_packets | 2 +- .../0000:03:00.0/net/wlan0/statistics/tx_bytes | 2 +- .../0000:03:00.0/net/wlan0/statistics/tx_packets | 2 +- .../0000:03:00.0/net/wlan0/wireless/level | 2 +- .../0000:03:00.0/net/wlan0/wireless/link | 2 +- .../0000:03:00.0/net/wlan0/wireless/noise | 2 +- .../pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window | 5 +- .../0000:00:1c.1/0000:03:00.0/statistics | 26 ++--- .../0000:00:1c.1/0000:03:00.0/temperature | 2 +- test/sys/devices/pci0000:00/0000:00:1c.1/config | Bin 4096 -> 4096 bytes .../0000:00:1d.0/usb1/power/connected_duration | 2 +- .../0000:00:1d.1/usb2/power/connected_duration | 2 +- .../pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 | 2 +- .../usb3/3-1/3-1:1.0/input/input7/capabilities/abs | 1 - .../usb3/3-1/3-1:1.0/input/input7/capabilities/ev | 1 - .../usb3/3-1/3-1:1.0/input/input7/capabilities/ff | 1 - .../usb3/3-1/3-1:1.0/input/input7/capabilities/key | 1 - .../usb3/3-1/3-1:1.0/input/input7/capabilities/led | 1 - .../usb3/3-1/3-1:1.0/input/input7/capabilities/msc | 1 - .../usb3/3-1/3-1:1.0/input/input7/capabilities/rel | 1 - .../usb3/3-1/3-1:1.0/input/input7/capabilities/snd | 1 - .../usb3/3-1/3-1:1.0/input/input7/capabilities/sw | 1 - .../usb3/3-1/3-1:1.0/input/input7/device | 1 - .../usb3/3-1/3-1:1.0/input/input7/event7/dev | 1 - .../usb3/3-1/3-1:1.0/input/input7/event7/device | 1 - .../3-1/3-1:1.0/input/input7/event7/power/wakeup | 1 - .../usb3/3-1/3-1:1.0/input/input7/event7/subsystem | 1 - .../usb3/3-1/3-1:1.0/input/input7/event7/uevent | 2 - .../usb3/3-1/3-1:1.0/input/input7/id/bustype | 1 - .../usb3/3-1/3-1:1.0/input/input7/id/product | 1 - .../usb3/3-1/3-1:1.0/input/input7/id/vendor | 1 - .../usb3/3-1/3-1:1.0/input/input7/id/version | 1 - .../usb3/3-1/3-1:1.0/input/input7/modalias | 1 - .../usb3/3-1/3-1:1.0/input/input7/mouse1/dev | 1 - .../usb3/3-1/3-1:1.0/input/input7/mouse1/device | 1 - .../3-1/3-1:1.0/input/input7/mouse1/power/wakeup | 1 - .../usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem | 1 - .../usb3/3-1/3-1:1.0/input/input7/mouse1/uevent | 2 - .../usb3/3-1/3-1:1.0/input/input7/name | 1 - .../usb3/3-1/3-1:1.0/input/input7/phys | 1 - .../usb3/3-1/3-1:1.0/input/input7/power/wakeup | 1 - .../usb3/3-1/3-1:1.0/input/input7/subsystem | 1 - .../usb3/3-1/3-1:1.0/input/input7/uevent | 9 -- .../usb3/3-1/3-1:1.0/input/input7/uniq | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/abs | 1 + .../usb3/3-1/3-1:1.0/input/input8/capabilities/ev | 1 + .../usb3/3-1/3-1:1.0/input/input8/capabilities/ff | 1 + .../usb3/3-1/3-1:1.0/input/input8/capabilities/key | 1 + .../usb3/3-1/3-1:1.0/input/input8/capabilities/led | 1 + .../usb3/3-1/3-1:1.0/input/input8/capabilities/msc | 1 + .../usb3/3-1/3-1:1.0/input/input8/capabilities/rel | 1 + .../usb3/3-1/3-1:1.0/input/input8/capabilities/snd | 1 + .../usb3/3-1/3-1:1.0/input/input8/capabilities/sw | 1 + .../usb3/3-1/3-1:1.0/input/input8/device | 1 + .../usb3/3-1/3-1:1.0/input/input8/event7/dev | 1 + .../usb3/3-1/3-1:1.0/input/input8/event7/device | 1 + .../3-1/3-1:1.0/input/input8/event7/power/wakeup | 1 + .../usb3/3-1/3-1:1.0/input/input8/event7/subsystem | 1 + .../usb3/3-1/3-1:1.0/input/input8/event7/uevent | 2 + .../usb3/3-1/3-1:1.0/input/input8/id/bustype | 1 + .../usb3/3-1/3-1:1.0/input/input8/id/product | 1 + .../usb3/3-1/3-1:1.0/input/input8/id/vendor | 1 + .../usb3/3-1/3-1:1.0/input/input8/id/version | 1 + .../usb3/3-1/3-1:1.0/input/input8/modalias | 1 + .../usb3/3-1/3-1:1.0/input/input8/mouse1/dev | 1 + .../usb3/3-1/3-1:1.0/input/input8/mouse1/device | 1 + .../3-1/3-1:1.0/input/input8/mouse1/power/wakeup | 1 + .../usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem | 1 + .../usb3/3-1/3-1:1.0/input/input8/mouse1/uevent | 2 + .../usb3/3-1/3-1:1.0/input/input8/name | 1 + .../usb3/3-1/3-1:1.0/input/input8/phys | 1 + .../usb3/3-1/3-1:1.0/input/input8/power/wakeup | 1 + .../usb3/3-1/3-1:1.0/input/input8/subsystem | 1 + .../usb3/3-1/3-1:1.0/input/input8/uevent | 9 ++ .../usb3/3-1/3-1:1.0/input/input8/uniq | 1 + .../usb_endpoint/usbdev3.3_ep81/bEndpointAddress | 1 - .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval | 1 - .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength | 1 - .../usb_endpoint/usbdev3.3_ep81/bmAttributes | 1 - .../3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev | 1 - .../3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device | 1 - .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction | 1 - .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval | 1 - .../usb_endpoint/usbdev3.3_ep81/power/wakeup | 1 - .../3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem | 1 - .../3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type | 1 - .../3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent | 2 - .../usb_endpoint/usbdev3.3_ep81/wMaxPacketSize | 1 - .../usb_endpoint/usbdev3.4_ep81/bEndpointAddress | 1 + .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval | 1 + .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength | 1 + .../usb_endpoint/usbdev3.4_ep81/bmAttributes | 1 + .../3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev | 1 + .../3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device | 1 + .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction | 1 + .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval | 1 + .../usb_endpoint/usbdev3.4_ep81/power/wakeup | 1 + .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem | 1 + .../3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type | 1 + .../3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent | 2 + .../usb_endpoint/usbdev3.4_ep81/wMaxPacketSize | 1 + .../devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev | 2 +- .../pci0000:00/0000:00:1d.2/usb3/3-1/devnum | 2 +- .../devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 | 2 +- .../0000:00:1d.2/usb3/3-1/power/active_duration | 2 +- .../0000:00:1d.2/usb3/3-1/power/connected_duration | 2 +- .../pci0000:00/0000:00:1d.2/usb3/3-1/uevent | 4 +- .../pci0000:00/0000:00:1d.2/usb3/3-1/urbnum | 2 +- .../usb_endpoint/usbdev3.3_ep00/bEndpointAddress | 1 - .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval | 1 - .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength | 1 - .../3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes | 1 - .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev | 1 - .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/device | 1 - .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction | 1 - .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval | 1 - .../3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup | 1 - .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem | 1 - .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/type | 1 - .../usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent | 2 - .../3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize | 1 - .../usb_endpoint/usbdev3.4_ep00/bEndpointAddress | 1 + .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval | 1 + .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength | 1 + .../3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes | 1 + .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev | 1 + .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/device | 1 + .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction | 1 + .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval | 1 + .../3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup | 1 + .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem | 1 + .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/type | 1 + .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent | 2 + .../3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize | 1 + .../0000:00:1d.2/usb3/power/active_duration | 2 +- .../0000:00:1d.2/usb3/power/connected_duration | 2 +- .../devices/pci0000:00/0000:00:1d.2/usb3/urbnum | 2 +- .../0000:00:1d.3/usb4/4-1/power/active_duration | 2 +- .../0000:00:1d.3/usb4/4-1/power/connected_duration | 2 +- .../0000:00:1d.3/usb4/4-2/power/active_duration | 2 +- .../0000:00:1d.3/usb4/4-2/power/connected_duration | 2 +- .../0000:00:1d.3/usb4/power/active_duration | 2 +- .../0000:00:1d.3/usb4/power/connected_duration | 2 +- .../pci0000:00/0000:00:1d.7/broken_parity_status | 1 + test/sys/devices/pci0000:00/0000:00:1d.7/class | 1 + test/sys/devices/pci0000:00/0000:00:1d.7/config | Bin 0 -> 256 bytes test/sys/devices/pci0000:00/0000:00:1d.7/device | 1 + test/sys/devices/pci0000:00/0000:00:1d.7/driver | 1 + test/sys/devices/pci0000:00/0000:00:1d.7/enable | 1 + .../devices/pci0000:00/0000:00:1d.7/firmware_node | 1 + test/sys/devices/pci0000:00/0000:00:1d.7/irq | 1 + .../devices/pci0000:00/0000:00:1d.7/local_cpulist | 1 + .../sys/devices/pci0000:00/0000:00:1d.7/local_cpus | 1 + test/sys/devices/pci0000:00/0000:00:1d.7/modalias | 1 + test/sys/devices/pci0000:00/0000:00:1d.7/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.7/pools | 9 ++ .../devices/pci0000:00/0000:00:1d.7/power/wakeup | 1 + test/sys/devices/pci0000:00/0000:00:1d.7/resource | 7 ++ test/sys/devices/pci0000:00/0000:00:1d.7/resource0 | 0 test/sys/devices/pci0000:00/0000:00:1d.7/subsystem | 1 + .../pci0000:00/0000:00:1d.7/subsystem_device | 1 + .../pci0000:00/0000:00:1d.7/subsystem_vendor | 1 + test/sys/devices/pci0000:00/0000:00:1d.7/uevent | 6 ++ .../0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber | 1 + .../0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol | 1 + .../0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias | 1 + .../0000:00:1d.7/usb5/5-0:1.0/power/wakeup | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent | 6 ++ .../usb_endpoint/usbdev5.1_ep81/bEndpointAddress | 1 + .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval | 1 + .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength | 1 + .../usb_endpoint/usbdev5.1_ep81/bmAttributes | 1 + .../usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev | 1 + .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/device | 1 + .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction | 1 + .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval | 1 + .../usb_endpoint/usbdev5.1_ep81/power/wakeup | 1 + .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem | 1 + .../usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type | 1 + .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent | 2 + .../usb_endpoint/usbdev5.1_ep81/wMaxPacketSize | 1 + .../usb5/5-1/5-1:1.0/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber | 1 + .../usb5/5-1/5-1:1.0/bInterfaceProtocol | 1 + .../usb5/5-1/5-1:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/driver | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 | 1 + .../usb5/5-1/5-1:1.0/host7/power/wakeup | 1 + .../5-1/5-1:1.0/host7/scsi_host/host7/active_mode | 1 + .../5-1/5-1:1.0/host7/scsi_host/host7/can_queue | 1 + .../5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun | 1 + .../usb5/5-1/5-1:1.0/host7/scsi_host/host7/device | 1 + .../5-1/5-1:1.0/host7/scsi_host/host7/host_busy | 1 + .../5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup | 1 + .../5-1/5-1:1.0/host7/scsi_host/host7/proc_name | 1 + .../host7/scsi_host/host7/prot_capabilities | 1 + .../5-1:1.0/host7/scsi_host/host7/prot_guard_type | 1 + .../5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize | 1 + .../usb5/5-1/5-1:1.0/host7/scsi_host/host7/state | 1 + .../5-1/5-1:1.0/host7/scsi_host/host7/subsystem | 1 + .../5-1:1.0/host7/scsi_host/host7/supported_mode | 1 + .../usb5/5-1/5-1:1.0/host7/scsi_host/host7/uevent | 0 .../host7/scsi_host/host7/unchecked_isa_dma | 1 + .../5-1/5-1:1.0/host7/scsi_host/host7/unique_id | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/bdi | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/capability | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/dev | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/device | 1 + .../target7:0:0/7:0:0:0/block/sdb/make-it-fail | 1 + .../target7:0:0/7:0:0:0/block/sdb/power/wakeup | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg | 1 + .../7:0:0:0/block/sdb/queue/hw_sector_size | 1 + .../7:0:0:0/block/sdb/queue/iosched/back_seek_max | 1 + .../block/sdb/queue/iosched/back_seek_penalty | 1 + .../block/sdb/queue/iosched/fifo_expire_async | 1 + .../block/sdb/queue/iosched/fifo_expire_sync | 1 + .../7:0:0:0/block/sdb/queue/iosched/quantum | 1 + .../7:0:0:0/block/sdb/queue/iosched/slice_async | 1 + .../7:0:0:0/block/sdb/queue/iosched/slice_async_rq | 1 + .../7:0:0:0/block/sdb/queue/iosched/slice_idle | 1 + .../7:0:0:0/block/sdb/queue/iosched/slice_sync | 1 + .../7:0:0:0/block/sdb/queue/max_hw_sectors_kb | 1 + .../7:0:0:0/block/sdb/queue/max_sectors_kb | 1 + .../target7:0:0/7:0:0:0/block/sdb/queue/nomerges | 1 + .../7:0:0:0/block/sdb/queue/nr_requests | 1 + .../7:0:0:0/block/sdb/queue/read_ahead_kb | 1 + .../target7:0:0/7:0:0:0/block/sdb/queue/scheduler | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/range | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/removable | 1 + .../5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev | 1 + .../7:0:0:0/block/sdb/sdb1/make-it-fail | 1 + .../7:0:0:0/block/sdb/sdb1/power/wakeup | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat | 1 + .../target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem | 1 + .../target7:0:0/7:0:0:0/block/sdb/sdb1/uevent | 3 + .../host7/target7:0:0/7:0:0:0/block/sdb/size | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/stat | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/subsystem | 1 + .../host7/target7:0:0/7:0:0:0/block/sdb/uevent | 3 + .../host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev | 1 + .../host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device | 1 + .../target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup | 1 + .../target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem | 1 + .../host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent | 2 + .../host7/target7:0:0/7:0:0:0/device_blocked | 1 + .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver | 1 + .../host7/target7:0:0/7:0:0:0/evt_media_change | 1 + .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic | 1 + .../host7/target7:0:0/7:0:0:0/iocounterbits | 1 + .../5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt | 1 + .../5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt | 1 + .../host7/target7:0:0/7:0:0:0/iorequest_cnt | 1 + .../5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors | 1 + .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias | 1 + .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model | 1 + .../5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup | 1 + .../5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth | 1 + .../5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type | 1 + .../usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev | 1 + .../target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device | 1 + .../7:0:0:0/scsi_device/7:0:0:0/power/wakeup | 1 + .../7:0:0:0/scsi_device/7:0:0:0/subsystem | 1 + .../target7:0:0/7:0:0:0/scsi_device/7:0:0:0/uevent | 0 .../target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA | 1 + .../7:0:0:0/scsi_disk/7:0:0:0/allow_restart | 1 + .../7:0:0:0/scsi_disk/7:0:0:0/app_tag_own | 1 + .../7:0:0:0/scsi_disk/7:0:0:0/cache_type | 1 + .../target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device | 1 + .../7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop | 1 + .../7:0:0:0/scsi_disk/7:0:0:0/power/wakeup | 1 + .../7:0:0:0/scsi_disk/7:0:0:0/protection_type | 1 + .../7:0:0:0/scsi_disk/7:0:0:0/subsystem | 1 + .../target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/uevent | 0 .../host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev | 1 + .../target7:0:0/7:0:0:0/scsi_generic/sg2/device | 1 + .../7:0:0:0/scsi_generic/sg2/power/wakeup | 1 + .../target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem | 1 + .../target7:0:0/7:0:0:0/scsi_generic/sg2/uevent | 2 + .../5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level | 1 + .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state | 1 + .../5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem | 1 + .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout | 1 + .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type | 1 + .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent | 3 + .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor | 1 + .../5-1/5-1:1.0/host7/target7:0:0/power/wakeup | 1 + .../usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem | 1 + .../usb5/5-1/5-1:1.0/host7/target7:0:0/uevent | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/modalias | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem | 1 + .../0000:00:1d.7/usb5/5-1/5-1:1.0/uevent | 6 ++ .../usb_endpoint/usbdev5.7_ep02/bEndpointAddress | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength | 1 + .../usb_endpoint/usbdev5.7_ep02/bmAttributes | 1 + .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev | 1 + .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval | 1 + .../usb_endpoint/usbdev5.7_ep02/power/wakeup | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem | 1 + .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type | 1 + .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent | 2 + .../usb_endpoint/usbdev5.7_ep02/wMaxPacketSize | 1 + .../usb_endpoint/usbdev5.7_ep81/bEndpointAddress | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength | 1 + .../usb_endpoint/usbdev5.7_ep81/bmAttributes | 1 + .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev | 1 + .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval | 1 + .../usb_endpoint/usbdev5.7_ep81/power/wakeup | 1 + .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem | 1 + .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type | 1 + .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent | 2 + .../usb_endpoint/usbdev5.7_ep81/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/authorized | 1 + .../0000:00:1d.7/usb5/5-1/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass | 1 + .../0000:00:1d.7/usb5/5-1/bDeviceProtocol | 1 + .../0000:00:1d.7/usb5/5-1/bDeviceSubClass | 1 + .../0000:00:1d.7/usb5/5-1/bMaxPacketSize0 | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower | 1 + .../0000:00:1d.7/usb5/5-1/bNumConfigurations | 1 + .../0000:00:1d.7/usb5/5-1/bNumInterfaces | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/busnum | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/configuration | 0 .../pci0000:00/0000:00:1d.7/usb5/5-1/descriptors | Bin 0 -> 50 bytes .../devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/devnum | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/driver | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/idProduct | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/idVendor | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/maxchild | 1 + .../0000:00:1d.7/usb5/5-1/power/active_duration | 1 + .../0000:00:1d.7/usb5/5-1/power/autosuspend | 1 + .../0000:00:1d.7/usb5/5-1/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/power/level | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/power/persist | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/product | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/quirks | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/subsystem | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/uevent | 8 ++ .../pci0000:00/0000:00:1d.7/usb5/5-1/urbnum | 1 + .../usb_endpoint/usbdev5.7_ep00/bEndpointAddress | 1 + .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval | 1 + .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength | 1 + .../5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes | 1 + .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev | 1 + .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/device | 1 + .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction | 1 + .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval | 1 + .../5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup | 1 + .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem | 1 + .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/type | 1 + .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent | 2 + .../5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-1/version | 1 + .../usb5/5-2/5-2:1.0/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.0/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.0/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/driver | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/interface | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev | 1 + .../usb5/5-2/5-2:1.0/tty/ttyACM0/device | 1 + .../usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup | 1 + .../usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem | 1 + .../usb5/5-2/5-2:1.0/tty/ttyACM0/uevent | 2 + .../0000:00:1d.7/usb5/5-2/5-2:1.0/uevent | 6 ++ .../usb_endpoint/usbdev5.9_ep81/bEndpointAddress | 1 + .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval | 1 + .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength | 1 + .../usb_endpoint/usbdev5.9_ep81/bmAttributes | 1 + .../5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev | 1 + .../5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device | 1 + .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction | 1 + .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval | 1 + .../usb_endpoint/usbdev5.9_ep81/power/wakeup | 1 + .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem | 1 + .../5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type | 1 + .../5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent | 2 + .../usb_endpoint/usbdev5.9_ep81/wMaxPacketSize | 1 + .../usb5/5-2/5-2:1.1/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.1/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.1/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.1/driver | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.1/interface | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.1/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.1/uevent | 6 ++ .../usb_endpoint/usbdev5.9_ep01/bEndpointAddress | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength | 1 + .../usb_endpoint/usbdev5.9_ep01/bmAttributes | 1 + .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev | 1 + .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval | 1 + .../usb_endpoint/usbdev5.9_ep01/power/wakeup | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem | 1 + .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type | 1 + .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent | 2 + .../usb_endpoint/usbdev5.9_ep01/wMaxPacketSize | 1 + .../usb_endpoint/usbdev5.9_ep82/bEndpointAddress | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength | 1 + .../usb_endpoint/usbdev5.9_ep82/bmAttributes | 1 + .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev | 1 + .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval | 1 + .../usb_endpoint/usbdev5.9_ep82/power/wakeup | 1 + .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem | 1 + .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type | 1 + .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent | 2 + .../usb_endpoint/usbdev5.9_ep82/wMaxPacketSize | 1 + .../usb5/5-2/5-2:1.10/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass | 1 + .../usb5/5-2/5-2:1.10/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.10/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.10/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.10/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.10/uevent | 5 + .../usb5/5-2/5-2:1.11/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass | 1 + .../usb5/5-2/5-2:1.11/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.11/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.11/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.11/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.11/uevent | 5 + .../usb5/5-2/5-2:1.12/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass | 1 + .../usb5/5-2/5-2:1.12/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.12/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.12/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.12/interface | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.12/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.12/uevent | 5 + .../usb5/5-2/5-2:1.13/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass | 1 + .../usb5/5-2/5-2:1.13/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.13/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.13/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.13/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.13/uevent | 5 + .../usb5/5-2/5-2:1.2/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.2/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.2/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.2/interface | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.2/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.2/uevent | 5 + .../usb_endpoint/usbdev5.9_ep83/bEndpointAddress | 1 + .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval | 1 + .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength | 1 + .../usb_endpoint/usbdev5.9_ep83/bmAttributes | 1 + .../5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev | 1 + .../5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device | 1 + .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction | 1 + .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval | 1 + .../usb_endpoint/usbdev5.9_ep83/power/wakeup | 1 + .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem | 1 + .../5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type | 1 + .../5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent | 2 + .../usb_endpoint/usbdev5.9_ep83/wMaxPacketSize | 1 + .../usb5/5-2/5-2:1.3/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.3/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.3/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.3/interface | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.3/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.3/uevent | 5 + .../usb_endpoint/usbdev5.9_ep02/bEndpointAddress | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength | 1 + .../usb_endpoint/usbdev5.9_ep02/bmAttributes | 1 + .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev | 1 + .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval | 1 + .../usb_endpoint/usbdev5.9_ep02/power/wakeup | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem | 1 + .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type | 1 + .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent | 2 + .../usb_endpoint/usbdev5.9_ep02/wMaxPacketSize | 1 + .../usb_endpoint/usbdev5.9_ep84/bEndpointAddress | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength | 1 + .../usb_endpoint/usbdev5.9_ep84/bmAttributes | 1 + .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev | 1 + .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval | 1 + .../usb_endpoint/usbdev5.9_ep84/power/wakeup | 1 + .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem | 1 + .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type | 1 + .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent | 2 + .../usb_endpoint/usbdev5.9_ep84/wMaxPacketSize | 1 + .../usb5/5-2/5-2:1.4/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.4/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.4/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.4/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.4/uevent | 5 + .../usb5/5-2/5-2:1.5/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.5/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.5/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.5/interface | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.5/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.5/uevent | 5 + .../usb5/5-2/5-2:1.6/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.6/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.6/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.6/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.6/uevent | 5 + .../usb5/5-2/5-2:1.7/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.7/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.7/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.7/interface | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.7/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.7/uevent | 5 + .../usb5/5-2/5-2:1.8/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.8/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.8/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.8/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.8/uevent | 5 + .../usb5/5-2/5-2:1.9/bAlternateSetting | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber | 1 + .../usb5/5-2/5-2:1.9/bInterfaceProtocol | 1 + .../usb5/5-2/5-2:1.9/bInterfaceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.9/modalias | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem | 1 + .../0000:00:1d.7/usb5/5-2/5-2:1.9/uevent | 5 + .../pci0000:00/0000:00:1d.7/usb5/5-2/authorized | 1 + .../0000:00:1d.7/usb5/5-2/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass | 1 + .../0000:00:1d.7/usb5/5-2/bDeviceProtocol | 1 + .../0000:00:1d.7/usb5/5-2/bDeviceSubClass | 1 + .../0000:00:1d.7/usb5/5-2/bMaxPacketSize0 | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower | 1 + .../0000:00:1d.7/usb5/5-2/bNumConfigurations | 1 + .../0000:00:1d.7/usb5/5-2/bNumInterfaces | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/busnum | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/configuration | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/descriptors | Bin 0 -> 445 bytes .../devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/devnum | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/driver | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/idProduct | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/idVendor | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/maxchild | 1 + .../0000:00:1d.7/usb5/5-2/power/active_duration | 1 + .../0000:00:1d.7/usb5/5-2/power/autosuspend | 1 + .../0000:00:1d.7/usb5/5-2/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/power/level | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/power/persist | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/product | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/quirks | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/serial | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/subsystem | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/uevent | 8 ++ .../pci0000:00/0000:00:1d.7/usb5/5-2/urbnum | 1 + .../usb_endpoint/usbdev5.9_ep00/bEndpointAddress | 1 + .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval | 1 + .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength | 1 + .../5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes | 1 + .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev | 1 + .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/device | 1 + .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction | 1 + .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval | 1 + .../5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup | 1 + .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem | 1 + .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/type | 1 + .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent | 2 + .../5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize | 1 + .../pci0000:00/0000:00:1d.7/usb5/5-2/version | 1 + .../pci0000:00/0000:00:1d.7/usb5/authorized | 1 + .../0000:00:1d.7/usb5/authorized_default | 1 + .../0000:00:1d.7/usb5/bConfigurationValue | 1 + .../pci0000:00/0000:00:1d.7/usb5/bDeviceClass | 1 + .../pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol | 1 + .../pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass | 1 + .../pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower | 1 + .../0000:00:1d.7/usb5/bNumConfigurations | 1 + .../pci0000:00/0000:00:1d.7/usb5/bNumInterfaces | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice | 1 + .../pci0000:00/0000:00:1d.7/usb5/bmAttributes | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/busnum | 1 + .../pci0000:00/0000:00:1d.7/usb5/configuration | 0 .../pci0000:00/0000:00:1d.7/usb5/descriptors | Bin 0 -> 43 bytes test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/devnum | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/driver | 1 + .../sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/idProduct | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/idVendor | 1 + .../pci0000:00/0000:00:1d.7/usb5/manufacturer | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/maxchild | 1 + .../0000:00:1d.7/usb5/power/active_duration | 1 + .../pci0000:00/0000:00:1d.7/usb5/power/autosuspend | 1 + .../0000:00:1d.7/usb5/power/connected_duration | 1 + .../pci0000:00/0000:00:1d.7/usb5/power/level | 1 + .../pci0000:00/0000:00:1d.7/usb5/power/wakeup | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/product | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/quirks | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/serial | 1 + .../sys/devices/pci0000:00/0000:00:1d.7/usb5/speed | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/subsystem | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/uevent | 8 ++ .../devices/pci0000:00/0000:00:1d.7/usb5/urbnum | 1 + .../usb_endpoint/usbdev5.1_ep00/bEndpointAddress | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/bInterval | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/bLength | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/dev | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/device | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/direction | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/interval | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/subsystem | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/type | 1 + .../usb5/usb_endpoint/usbdev5.1_ep00/uevent | 2 + .../usb_endpoint/usbdev5.1_ep00/wMaxPacketSize | 1 + .../devices/pci0000:00/0000:00:1d.7/usb5/version | 1 + .../0000:00:1d.7/usb_host/usb_host5/companion | 0 .../0000:00:1d.7/usb_host/usb_host5/device | 1 + .../0000:00:1d.7/usb_host/usb_host5/power/wakeup | 1 + .../0000:00:1d.7/usb_host/usb_host5/subsystem | 1 + .../0000:00:1d.7/usb_host/usb_host5/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.7/vendor | 1 + .../pci0000:00/0000:00:1e.0/0000:15:00.0/config | Bin 256 -> 256 bytes .../host4/target4:0:0/4:0:0:0/iodone_cnt | 2 +- .../host4/target4:0:0/4:0:0:0/iorequest_cnt | 2 +- .../scsi_host/host0/link_power_management_policy | 2 +- .../host0/target0:0:0/0:0:0:0/block/sda/sda5/stat | 2 +- .../host0/target0:0:0/0:0:0:0/block/sda/sda6/stat | 2 +- .../host0/target0:0:0/0:0:0:0/block/sda/stat | 2 +- .../host0/target0:0:0/0:0:0:0/iodone_cnt | 2 +- .../host0/target0:0:0/0:0:0:0/ioerr_cnt | 2 +- .../host0/target0:0:0/0:0:0:0/iorequest_cnt | 2 +- .../sys/devices/platform/thinkpad_hwmon/fan1_input | 2 +- .../devices/platform/thinkpad_hwmon/temp10_input | 2 +- .../devices/platform/thinkpad_hwmon/temp11_input | 2 +- .../devices/platform/thinkpad_hwmon/temp1_input | 2 +- .../devices/platform/thinkpad_hwmon/temp2_input | 2 +- .../devices/platform/thinkpad_hwmon/temp3_input | 2 +- .../devices/platform/thinkpad_hwmon/temp4_input | 2 +- .../devices/platform/thinkpad_hwmon/temp5_input | 2 +- .../devices/platform/thinkpad_hwmon/temp7_input | 2 +- .../devices/platform/thinkpad_hwmon/temp9_input | 2 +- test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch | 2 +- test/sys/devices/pnp0/00:07/rtc/rtc0/time | 2 +- .../system/cpu/cpu0/cpufreq/ondemand/up_threshold | 2 +- .../system/cpu/cpu0/cpufreq/scaling_max_freq | 2 +- .../system/cpu/cpu0/cpufreq/stats/time_in_state | 10 +- .../system/cpu/cpu0/cpufreq/stats/total_trans | 2 +- .../devices/system/cpu/cpu0/cpuidle/state0/desc | 2 +- .../devices/system/cpu/cpu0/cpuidle/state0/name | 2 +- .../devices/system/cpu/cpu0/cpuidle/state1/time | 2 +- .../devices/system/cpu/cpu0/cpuidle/state1/usage | 2 +- .../devices/system/cpu/cpu0/cpuidle/state2/time | 2 +- .../devices/system/cpu/cpu0/cpuidle/state2/usage | 2 +- .../devices/system/cpu/cpu0/cpuidle/state3/desc | 2 +- .../devices/system/cpu/cpu0/cpuidle/state3/latency | 2 +- .../devices/system/cpu/cpu0/cpuidle/state3/power | 2 +- .../devices/system/cpu/cpu0/cpuidle/state3/time | 2 +- .../devices/system/cpu/cpu0/cpuidle/state3/usage | 2 +- .../devices/system/cpu/cpu1/cpuidle/state0/desc | 2 +- .../devices/system/cpu/cpu1/cpuidle/state0/name | 2 +- .../devices/system/cpu/cpu1/cpuidle/state1/time | 2 +- .../devices/system/cpu/cpu1/cpuidle/state1/usage | 2 +- .../devices/system/cpu/cpu1/cpuidle/state2/time | 2 +- .../devices/system/cpu/cpu1/cpuidle/state2/usage | 2 +- .../devices/system/cpu/cpu1/cpuidle/state3/desc | 2 +- .../devices/system/cpu/cpu1/cpuidle/state3/latency | 2 +- .../devices/system/cpu/cpu1/cpuidle/state3/power | 2 +- .../devices/system/cpu/cpu1/cpuidle/state3/time | 2 +- .../devices/system/cpu/cpu1/cpuidle/state3/usage | 2 +- test/sys/devices/system/cpu/sched_mc_power_savings | 2 +- .../sys/devices/virtual/thermal/thermal_zone0/temp | 2 +- .../sys/devices/virtual/thermal/thermal_zone1/temp | 2 +- test/sys/firmware/acpi/interrupts/gpe02 | 2 +- test/sys/firmware/acpi/interrupts/gpe1C | 2 +- test/sys/firmware/acpi/interrupts/gpe_all | 2 +- test/sys/firmware/acpi/interrupts/sci | 2 +- test/sys/kernel/debug/bdi/0:16/stats | 4 +- test/sys/kernel/debug/bdi/11:0/stats | 4 +- test/sys/kernel/debug/bdi/7:0/stats | 4 +- test/sys/kernel/debug/bdi/7:1/stats | 4 +- test/sys/kernel/debug/bdi/7:2/stats | 4 +- test/sys/kernel/debug/bdi/7:3/stats | 4 +- test/sys/kernel/debug/bdi/7:4/stats | 4 +- test/sys/kernel/debug/bdi/7:5/stats | 4 +- test/sys/kernel/debug/bdi/7:6/stats | 4 +- test/sys/kernel/debug/bdi/7:7/stats | 4 +- test/sys/kernel/debug/bdi/8:0/stats | 8 +- test/sys/kernel/debug/bdi/8:16/stats | 4 +- test/sys/kernel/debug/bdi/9:0/stats | 4 +- test/sys/kernel/debug/bdi/default/stats | 4 +- test/sys/kernel/slab/Acpi-Namespace/alloc_calls | 2 +- test/sys/kernel/slab/Acpi-Namespace/free_calls | 2 +- test/sys/kernel/slab/Acpi-Namespace/objects | 2 +- .../sys/kernel/slab/Acpi-Namespace/objects_partial | 2 +- test/sys/kernel/slab/Acpi-Namespace/partial | 2 +- test/sys/kernel/slab/Acpi-Operand/alloc_calls | 2 +- test/sys/kernel/slab/Acpi-Operand/free_calls | 4 +- test/sys/kernel/slab/Acpi-Operand/objects | 2 +- test/sys/kernel/slab/Acpi-Operand/objects_partial | 2 +- test/sys/kernel/slab/Acpi-Operand/partial | 2 +- test/sys/kernel/slab/RAW/alloc_calls | 2 +- test/sys/kernel/slab/RAW/free_calls | 2 +- test/sys/kernel/slab/RAW/objects | 2 +- test/sys/kernel/slab/RAW/objects_partial | 2 +- test/sys/kernel/slab/RAW/partial | 2 +- test/sys/kernel/slab/RAWv6/alloc_calls | 2 +- test/sys/kernel/slab/RAWv6/free_calls | 2 +- test/sys/kernel/slab/RAWv6/objects | 2 +- test/sys/kernel/slab/RAWv6/objects_partial | 2 +- test/sys/kernel/slab/RAWv6/partial | 2 +- test/sys/kernel/slab/TCP/alloc_calls | 2 +- test/sys/kernel/slab/TCP/free_calls | 2 +- test/sys/kernel/slab/UDP/alloc_calls | 2 +- test/sys/kernel/slab/UDP/free_calls | 4 +- test/sys/kernel/slab/UNIX/alloc_calls | 2 +- test/sys/kernel/slab/UNIX/free_calls | 4 +- test/sys/kernel/slab/UNIX/objects | 2 +- test/sys/kernel/slab/UNIX/objects_partial | 2 +- test/sys/kernel/slab/UNIX/partial | 2 +- test/sys/kernel/slab/anon_vma/alloc_calls | 2 +- test/sys/kernel/slab/anon_vma/free_calls | 4 +- test/sys/kernel/slab/anon_vma/objects | 2 +- test/sys/kernel/slab/anon_vma/objects_partial | 2 +- test/sys/kernel/slab/anon_vma/partial | 2 +- test/sys/kernel/slab/anon_vma/slabs | 2 +- test/sys/kernel/slab/anon_vma/total_objects | 2 +- test/sys/kernel/slab/arp_cache/alloc_calls | 2 +- test/sys/kernel/slab/arp_cache/free_calls | 2 +- test/sys/kernel/slab/bdev_cache/alloc_calls | 2 +- test/sys/kernel/slab/bdev_cache/free_calls | 4 +- test/sys/kernel/slab/bdev_cache/objects | 2 +- test/sys/kernel/slab/bdev_cache/objects_partial | 2 +- test/sys/kernel/slab/bdev_cache/partial | 2 +- test/sys/kernel/slab/bio/alloc_calls | 2 +- test/sys/kernel/slab/bio/free_calls | 2 +- test/sys/kernel/slab/bio/objects | 2 +- test/sys/kernel/slab/bio/objects_partial | 2 +- test/sys/kernel/slab/bio/partial | 2 +- test/sys/kernel/slab/bio/slabs | 2 +- test/sys/kernel/slab/bio/total_objects | 2 +- test/sys/kernel/slab/biovec-1/alloc_calls | 2 +- test/sys/kernel/slab/biovec-1/free_calls | 2 +- test/sys/kernel/slab/biovec-128/alloc_calls | 2 +- test/sys/kernel/slab/biovec-128/free_calls | 2 +- test/sys/kernel/slab/biovec-128/objects | 2 +- test/sys/kernel/slab/biovec-128/objects_partial | 2 +- test/sys/kernel/slab/biovec-128/partial | 2 +- test/sys/kernel/slab/biovec-128/slabs | 2 +- test/sys/kernel/slab/biovec-128/total_objects | 2 +- test/sys/kernel/slab/biovec-16/alloc_calls | 2 +- test/sys/kernel/slab/biovec-16/free_calls | 2 +- test/sys/kernel/slab/biovec-256/alloc_calls | 2 +- test/sys/kernel/slab/biovec-256/free_calls | 2 +- test/sys/kernel/slab/biovec-256/objects | 2 +- test/sys/kernel/slab/biovec-256/objects_partial | 2 +- test/sys/kernel/slab/biovec-256/partial | 2 +- test/sys/kernel/slab/biovec-4/alloc_calls | 2 +- test/sys/kernel/slab/biovec-4/free_calls | 2 +- test/sys/kernel/slab/biovec-64/alloc_calls | 2 +- test/sys/kernel/slab/biovec-64/free_calls | 2 +- test/sys/kernel/slab/biovec-64/objects | 2 +- test/sys/kernel/slab/biovec-64/objects_partial | 2 +- test/sys/kernel/slab/biovec-64/partial | 2 +- test/sys/kernel/slab/biovec-64/slabs | 2 +- test/sys/kernel/slab/biovec-64/total_objects | 2 +- test/sys/kernel/slab/blkdev_ioc/alloc_calls | 2 +- test/sys/kernel/slab/blkdev_ioc/free_calls | 4 +- test/sys/kernel/slab/blkdev_ioc/objects | 2 +- test/sys/kernel/slab/blkdev_ioc/objects_partial | 2 +- test/sys/kernel/slab/blkdev_ioc/partial | 2 +- test/sys/kernel/slab/blkdev_queue/alloc_calls | 2 +- test/sys/kernel/slab/blkdev_queue/free_calls | 2 +- test/sys/kernel/slab/blkdev_queue/objects | 2 +- test/sys/kernel/slab/blkdev_queue/objects_partial | 2 +- test/sys/kernel/slab/blkdev_queue/partial | 2 +- test/sys/kernel/slab/blkdev_requests/alloc_calls | 2 +- test/sys/kernel/slab/blkdev_requests/free_calls | 4 +- test/sys/kernel/slab/blkdev_requests/objects | 2 +- .../kernel/slab/blkdev_requests/objects_partial | 2 +- test/sys/kernel/slab/blkdev_requests/partial | 2 +- test/sys/kernel/slab/blkdev_requests/slabs | 2 +- test/sys/kernel/slab/blkdev_requests/total_objects | 2 +- test/sys/kernel/slab/buffer_head/alloc_calls | 2 +- test/sys/kernel/slab/buffer_head/free_calls | 4 +- test/sys/kernel/slab/buffer_head/objects | 2 +- test/sys/kernel/slab/buffer_head/slabs | 2 +- test/sys/kernel/slab/buffer_head/total_objects | 2 +- test/sys/kernel/slab/cfq_io_context/alloc_calls | 2 +- test/sys/kernel/slab/cfq_io_context/free_calls | 4 +- test/sys/kernel/slab/cfq_io_context/objects | 2 +- .../sys/kernel/slab/cfq_io_context/objects_partial | 2 +- test/sys/kernel/slab/cfq_io_context/partial | 2 +- test/sys/kernel/slab/cfq_queue/alloc_calls | 2 +- test/sys/kernel/slab/cfq_queue/free_calls | 4 +- test/sys/kernel/slab/cfq_queue/objects | 2 +- test/sys/kernel/slab/cfq_queue/objects_partial | 2 +- test/sys/kernel/slab/cfq_queue/partial | 2 +- test/sys/kernel/slab/dentry/alloc_calls | 2 +- test/sys/kernel/slab/dentry/free_calls | 6 +- test/sys/kernel/slab/dentry/objects | 2 +- test/sys/kernel/slab/dentry/slabs | 2 +- test/sys/kernel/slab/dentry/total_objects | 2 +- test/sys/kernel/slab/eventpoll_epi/alloc_calls | 2 +- test/sys/kernel/slab/eventpoll_epi/free_calls | 4 +- test/sys/kernel/slab/eventpoll_epi/objects | 2 +- test/sys/kernel/slab/eventpoll_epi/objects_partial | 2 +- test/sys/kernel/slab/eventpoll_epi/partial | 2 +- test/sys/kernel/slab/eventpoll_pwq/alloc_calls | 2 +- test/sys/kernel/slab/eventpoll_pwq/free_calls | 4 +- test/sys/kernel/slab/eventpoll_pwq/objects | 2 +- test/sys/kernel/slab/eventpoll_pwq/objects_partial | 2 +- test/sys/kernel/slab/eventpoll_pwq/partial | 2 +- test/sys/kernel/slab/ext3_inode_cache/alloc_calls | 2 +- test/sys/kernel/slab/ext3_inode_cache/free_calls | 4 +- test/sys/kernel/slab/ext3_inode_cache/objects | 2 +- test/sys/kernel/slab/ext3_inode_cache/slabs | 2 +- .../sys/kernel/slab/ext3_inode_cache/total_objects | 2 +- test/sys/kernel/slab/ext3_xattr/alloc_calls | 2 +- test/sys/kernel/slab/ext3_xattr/free_calls | 2 +- test/sys/kernel/slab/fasync_cache/alloc_calls | 2 +- test/sys/kernel/slab/fasync_cache/free_calls | 2 +- test/sys/kernel/slab/fasync_cache/objects | 2 +- test/sys/kernel/slab/fasync_cache/objects_partial | 2 +- test/sys/kernel/slab/fasync_cache/partial | 2 +- test/sys/kernel/slab/fat_cache/alloc_calls | 2 +- test/sys/kernel/slab/fat_cache/free_calls | 2 +- test/sys/kernel/slab/fat_cache/objects | 2 +- test/sys/kernel/slab/fat_cache/slabs | 2 +- test/sys/kernel/slab/fat_cache/total_objects | 2 +- test/sys/kernel/slab/fat_inode_cache/alloc_calls | 2 +- test/sys/kernel/slab/fat_inode_cache/free_calls | 2 +- test/sys/kernel/slab/fib6_nodes/alloc_calls | 6 +- test/sys/kernel/slab/fib6_nodes/free_calls | 2 +- test/sys/kernel/slab/fib6_nodes/objects | 2 +- test/sys/kernel/slab/fib6_nodes/objects_partial | 2 +- test/sys/kernel/slab/fib6_nodes/partial | 2 +- test/sys/kernel/slab/file_lock_cache/alloc_calls | 4 +- test/sys/kernel/slab/file_lock_cache/free_calls | 2 +- test/sys/kernel/slab/files_cache/alloc_calls | 2 +- test/sys/kernel/slab/files_cache/free_calls | 6 +- test/sys/kernel/slab/files_cache/objects | 2 +- test/sys/kernel/slab/files_cache/objects_partial | 2 +- test/sys/kernel/slab/filp/alloc_calls | 2 +- test/sys/kernel/slab/filp/free_calls | 4 +- test/sys/kernel/slab/filp/objects | 2 +- test/sys/kernel/slab/filp/objects_partial | 2 +- test/sys/kernel/slab/filp/partial | 2 +- test/sys/kernel/slab/filp/slabs | 2 +- test/sys/kernel/slab/filp/total_objects | 2 +- test/sys/kernel/slab/fs_cache/alloc_calls | 2 +- test/sys/kernel/slab/fs_cache/free_calls | 4 +- test/sys/kernel/slab/fs_cache/objects | 2 +- test/sys/kernel/slab/fs_cache/objects_partial | 2 +- test/sys/kernel/slab/fs_cache/partial | 2 +- test/sys/kernel/slab/fs_cache/slabs | 2 +- test/sys/kernel/slab/fs_cache/total_objects | 2 +- test/sys/kernel/slab/fuse_inode/alloc_calls | 2 +- test/sys/kernel/slab/fuse_inode/free_calls | 2 +- test/sys/kernel/slab/fuse_inode/objects | 2 +- test/sys/kernel/slab/fuse_inode/objects_partial | 2 +- test/sys/kernel/slab/fuse_inode/partial | 2 +- test/sys/kernel/slab/fuse_request/alloc_calls | 2 +- test/sys/kernel/slab/fuse_request/free_calls | 2 +- test/sys/kernel/slab/idr_layer_cache/alloc_calls | 2 +- test/sys/kernel/slab/idr_layer_cache/free_calls | 9 +- test/sys/kernel/slab/idr_layer_cache/objects | 2 +- .../kernel/slab/idr_layer_cache/objects_partial | 2 +- test/sys/kernel/slab/idr_layer_cache/partial | 2 +- test/sys/kernel/slab/inet_peer_cache/alloc_calls | 2 +- test/sys/kernel/slab/inet_peer_cache/free_calls | 2 +- test/sys/kernel/slab/inet_peer_cache/objects | 2 +- test/sys/kernel/slab/inet_peer_cache/slabs | 2 +- test/sys/kernel/slab/inet_peer_cache/total_objects | 2 +- test/sys/kernel/slab/inode_cache/alloc_calls | 2 +- test/sys/kernel/slab/inode_cache/free_calls | 4 +- test/sys/kernel/slab/inode_cache/objects | 2 +- test/sys/kernel/slab/inode_cache/slabs | 2 +- test/sys/kernel/slab/inode_cache/total_objects | 2 +- .../kernel/slab/inotify_watch_cache/alloc_calls | 2 +- .../sys/kernel/slab/inotify_watch_cache/free_calls | 4 +- test/sys/kernel/slab/ip6_dst_cache/alloc_calls | 2 +- test/sys/kernel/slab/ip6_dst_cache/free_calls | 2 +- test/sys/kernel/slab/ip6_dst_cache/objects | 2 +- test/sys/kernel/slab/ip6_dst_cache/objects_partial | 2 +- test/sys/kernel/slab/ip6_dst_cache/partial | 2 +- test/sys/kernel/slab/ip_dst_cache/alloc_calls | 2 +- test/sys/kernel/slab/ip_dst_cache/free_calls | 3 +- test/sys/kernel/slab/ip_fib_hash/alloc_calls | 2 +- test/sys/kernel/slab/ip_fib_hash/free_calls | 4 +- test/sys/kernel/slab/ip_fib_hash/objects | 2 +- test/sys/kernel/slab/ip_fib_hash/objects_partial | 2 +- test/sys/kernel/slab/ip_fib_hash/partial | 2 +- test/sys/kernel/slab/journal_head/alloc_calls | 2 +- test/sys/kernel/slab/journal_head/free_calls | 4 +- test/sys/kernel/slab/journal_head/objects | 2 +- test/sys/kernel/slab/journal_head/slabs | 2 +- test/sys/kernel/slab/journal_head/total_objects | 2 +- test/sys/kernel/slab/kmalloc-1024/alloc_calls | 102 ++++++++++---------- test/sys/kernel/slab/kmalloc-1024/free_calls | 20 ++-- test/sys/kernel/slab/kmalloc-1024/objects | 2 +- test/sys/kernel/slab/kmalloc-1024/objects_partial | 2 +- test/sys/kernel/slab/kmalloc-1024/partial | 2 +- test/sys/kernel/slab/kmalloc-1024/slabs | 2 +- test/sys/kernel/slab/kmalloc-1024/total_objects | 2 +- test/sys/kernel/slab/kmalloc-128/alloc_calls | 72 +++++++------- test/sys/kernel/slab/kmalloc-128/free_calls | 32 ++++--- test/sys/kernel/slab/kmalloc-128/objects | 2 +- test/sys/kernel/slab/kmalloc-128/objects_partial | 2 +- test/sys/kernel/slab/kmalloc-128/partial | 2 +- test/sys/kernel/slab/kmalloc-16/alloc_calls | 82 ++++++++-------- test/sys/kernel/slab/kmalloc-16/free_calls | 52 +++++----- test/sys/kernel/slab/kmalloc-16/objects | 2 +- test/sys/kernel/slab/kmalloc-16/objects_partial | 2 +- test/sys/kernel/slab/kmalloc-16/partial | 2 +- test/sys/kernel/slab/kmalloc-16/slabs | 2 +- test/sys/kernel/slab/kmalloc-16/total_objects | 2 +- test/sys/kernel/slab/kmalloc-192/alloc_calls | 67 ++++++------- test/sys/kernel/slab/kmalloc-192/free_calls | 31 +++--- test/sys/kernel/slab/kmalloc-192/objects | 2 +- test/sys/kernel/slab/kmalloc-192/objects_partial | 2 +- test/sys/kernel/slab/kmalloc-2048/alloc_calls | 81 ++++++++-------- test/sys/kernel/slab/kmalloc-2048/free_calls | 31 +++--- test/sys/kernel/slab/kmalloc-2048/objects | 2 +- test/sys/kernel/slab/kmalloc-2048/objects_partial | 2 +- test/sys/kernel/slab/kmalloc-2048/partial | 2 +- test/sys/kernel/slab/kmalloc-2048/slabs | 2 +- test/sys/kernel/slab/kmalloc-2048/total_objects | 2 +- test/sys/kernel/slab/kmalloc-256/alloc_calls | 54 +++++------ test/sys/kernel/slab/kmalloc-256/free_calls | 25 +++-- test/sys/kernel/slab/kmalloc-256/objects | 2 +- test/sys/kernel/slab/kmalloc-256/objects_partial | 2 +- test/sys/kernel/slab/kmalloc-256/partial | 2 +- test/sys/kernel/slab/kmalloc-32/alloc_calls | 101 ++++++++++---------- test/sys/kernel/slab/kmalloc-32/free_calls | 48 +++++----- test/sys/kernel/slab/kmalloc-32/objects | 2 +- test/sys/kernel/slab/kmalloc-32/objects_partial | 2 +- test/sys/kernel/slab/kmalloc-32/partial | 2 +- test/sys/kernel/slab/kmalloc-4096/alloc_calls | 46 ++++----- test/sys/kernel/slab/kmalloc-4096/free_calls | 14 +-- test/sys/kernel/slab/kmalloc-4096/objects | 2 +- test/sys/kernel/slab/kmalloc-4096/objects_partial | 2 +- test/sys/kernel/slab/kmalloc-4096/partial | 2 +- test/sys/kernel/slab/kmalloc-4096/slabs | 2 +- test/sys/kernel/slab/kmalloc-4096/total_objects | 2 +- test/sys/kernel/slab/kmalloc-512/alloc_calls | 106 ++++++++++----------- test/sys/kernel/slab/kmalloc-512/free_calls | 20 ++-- test/sys/kernel/slab/kmalloc-512/objects | 2 +- test/sys/kernel/slab/kmalloc-512/objects_partial | 2 +- test/sys/kernel/slab/kmalloc-64/alloc_calls | 105 ++++++++++---------- test/sys/kernel/slab/kmalloc-64/free_calls | 96 ++++++++++--------- test/sys/kernel/slab/kmalloc-64/objects | 2 +- test/sys/kernel/slab/kmalloc-64/slabs | 2 +- test/sys/kernel/slab/kmalloc-64/total_objects | 2 +- test/sys/kernel/slab/kmalloc-8/alloc_calls | 64 ++++++------- test/sys/kernel/slab/kmalloc-8/free_calls | 48 +++++----- test/sys/kernel/slab/kmalloc-96/alloc_calls | 78 +++++++-------- test/sys/kernel/slab/kmalloc-96/free_calls | 36 +++---- test/sys/kernel/slab/kmalloc-96/objects | 2 +- test/sys/kernel/slab/kmalloc-96/objects_partial | 2 +- test/sys/kernel/slab/kmalloc_dma-512/objects | 2 +- test/sys/kernel/slab/kmalloc_dma-512/partial | 2 +- test/sys/kernel/slab/mm_struct/alloc_calls | 4 +- test/sys/kernel/slab/mm_struct/free_calls | 4 +- test/sys/kernel/slab/mm_struct/objects | 2 +- test/sys/kernel/slab/mm_struct/objects_partial | 2 +- test/sys/kernel/slab/mm_struct/slabs | 2 +- test/sys/kernel/slab/mm_struct/total_objects | 2 +- test/sys/kernel/slab/mnt_cache/alloc_calls | 2 +- test/sys/kernel/slab/mnt_cache/free_calls | 3 +- test/sys/kernel/slab/mnt_cache/objects | 2 +- test/sys/kernel/slab/mnt_cache/objects_partial | 2 +- test/sys/kernel/slab/mnt_cache/partial | 2 +- .../sys/kernel/slab/mqueue_inode_cache/alloc_calls | 2 +- test/sys/kernel/slab/mqueue_inode_cache/free_calls | 2 +- test/sys/kernel/slab/mqueue_inode_cache/objects | 2 +- .../kernel/slab/mqueue_inode_cache/objects_partial | 2 +- test/sys/kernel/slab/mqueue_inode_cache/partial | 2 +- test/sys/kernel/slab/ndisc_cache/alloc_calls | 2 +- test/sys/kernel/slab/ndisc_cache/free_calls | 2 +- test/sys/kernel/slab/ndisc_cache/objects | 2 +- test/sys/kernel/slab/ndisc_cache/objects_partial | 2 +- test/sys/kernel/slab/ndisc_cache/partial | 2 +- test/sys/kernel/slab/ndisc_cache/slabs | 2 +- test/sys/kernel/slab/ndisc_cache/total_objects | 2 +- test/sys/kernel/slab/pid/alloc_calls | 2 +- test/sys/kernel/slab/pid/free_calls | 4 +- test/sys/kernel/slab/pid/objects | 2 +- test/sys/kernel/slab/pid/objects_partial | 2 +- test/sys/kernel/slab/proc_inode_cache/alloc_calls | 2 +- test/sys/kernel/slab/proc_inode_cache/free_calls | 4 +- test/sys/kernel/slab/proc_inode_cache/objects | 2 +- .../kernel/slab/proc_inode_cache/objects_partial | 2 +- test/sys/kernel/slab/proc_inode_cache/partial | 2 +- test/sys/kernel/slab/proc_inode_cache/slabs | 2 +- .../sys/kernel/slab/proc_inode_cache/total_objects | 2 +- test/sys/kernel/slab/radix_tree_node/alloc_calls | 2 +- test/sys/kernel/slab/radix_tree_node/free_calls | 4 +- test/sys/kernel/slab/radix_tree_node/objects | 2 +- test/sys/kernel/slab/radix_tree_node/slabs | 2 +- test/sys/kernel/slab/radix_tree_node/total_objects | 2 +- test/sys/kernel/slab/revoke_table/alloc_calls | 2 +- test/sys/kernel/slab/revoke_table/free_calls | 2 +- test/sys/kernel/slab/revoke_table/objects | 2 +- test/sys/kernel/slab/revoke_table/objects_partial | 2 +- test/sys/kernel/slab/revoke_table/partial | 2 +- test/sys/kernel/slab/scsi_cmd_cache/alloc_calls | 2 +- test/sys/kernel/slab/scsi_cmd_cache/free_calls | 4 +- test/sys/kernel/slab/scsi_sense_cache/alloc_calls | 2 +- test/sys/kernel/slab/scsi_sense_cache/free_calls | 4 +- test/sys/kernel/slab/sgpool-128/alloc_calls | 2 +- test/sys/kernel/slab/sgpool-128/free_calls | 2 +- test/sys/kernel/slab/sgpool-128/objects | 2 +- test/sys/kernel/slab/sgpool-128/slabs | 2 +- test/sys/kernel/slab/sgpool-128/total_objects | 2 +- test/sys/kernel/slab/sgpool-16/alloc_calls | 2 +- test/sys/kernel/slab/sgpool-16/free_calls | 2 +- test/sys/kernel/slab/sgpool-32/alloc_calls | 2 +- test/sys/kernel/slab/sgpool-32/free_calls | 2 +- test/sys/kernel/slab/sgpool-64/alloc_calls | 2 +- test/sys/kernel/slab/sgpool-64/free_calls | 2 +- test/sys/kernel/slab/sgpool-8/alloc_calls | 2 +- test/sys/kernel/slab/sgpool-8/free_calls | 2 +- test/sys/kernel/slab/shmem_inode_cache/alloc_calls | 2 +- test/sys/kernel/slab/shmem_inode_cache/free_calls | 4 +- test/sys/kernel/slab/shmem_inode_cache/objects | 2 +- .../kernel/slab/shmem_inode_cache/objects_partial | 2 +- test/sys/kernel/slab/shmem_inode_cache/partial | 2 +- test/sys/kernel/slab/shmem_inode_cache/slabs | 2 +- .../kernel/slab/shmem_inode_cache/total_objects | 2 +- test/sys/kernel/slab/sighand_cache/alloc_calls | 4 +- test/sys/kernel/slab/sighand_cache/free_calls | 4 +- test/sys/kernel/slab/sighand_cache/objects | 2 +- test/sys/kernel/slab/sighand_cache/objects_partial | 2 +- test/sys/kernel/slab/sighand_cache/partial | 2 +- test/sys/kernel/slab/sighand_cache/slabs | 2 +- test/sys/kernel/slab/sighand_cache/total_objects | 2 +- test/sys/kernel/slab/signal_cache/alloc_calls | 2 +- test/sys/kernel/slab/signal_cache/free_calls | 4 +- test/sys/kernel/slab/signal_cache/objects | 2 +- test/sys/kernel/slab/signal_cache/objects_partial | 2 +- test/sys/kernel/slab/signal_cache/partial | 2 +- test/sys/kernel/slab/signal_cache/slabs | 2 +- test/sys/kernel/slab/signal_cache/total_objects | 2 +- test/sys/kernel/slab/skbuff_head_cache/alloc_calls | 2 +- test/sys/kernel/slab/skbuff_head_cache/free_calls | 4 +- test/sys/kernel/slab/skbuff_head_cache/objects | 2 +- .../kernel/slab/skbuff_head_cache/objects_partial | 2 +- test/sys/kernel/slab/skbuff_head_cache/partial | 2 +- test/sys/kernel/slab/skbuff_head_cache/slabs | 2 +- .../kernel/slab/skbuff_head_cache/total_objects | 2 +- test/sys/kernel/slab/sock_inode_cache/alloc_calls | 2 +- test/sys/kernel/slab/sock_inode_cache/free_calls | 4 +- test/sys/kernel/slab/sock_inode_cache/objects | 2 +- .../kernel/slab/sock_inode_cache/objects_partial | 2 +- test/sys/kernel/slab/sock_inode_cache/partial | 2 +- test/sys/kernel/slab/sock_inode_cache/slabs | 2 +- .../sys/kernel/slab/sock_inode_cache/total_objects | 2 +- test/sys/kernel/slab/sysfs_dir_cache/alloc_calls | 2 +- test/sys/kernel/slab/sysfs_dir_cache/free_calls | 4 +- test/sys/kernel/slab/task_struct/alloc_calls | 2 +- test/sys/kernel/slab/task_struct/free_calls | 4 +- test/sys/kernel/slab/task_struct/objects | 2 +- test/sys/kernel/slab/task_struct/objects_partial | 2 +- test/sys/kernel/slab/task_struct/partial | 2 +- test/sys/kernel/slab/task_struct/slabs | 2 +- test/sys/kernel/slab/task_struct/total_objects | 2 +- test/sys/kernel/slab/task_xstate/alloc_calls | 4 +- test/sys/kernel/slab/task_xstate/free_calls | 4 +- test/sys/kernel/slab/task_xstate/objects | 2 +- test/sys/kernel/slab/task_xstate/objects_partial | 2 +- test/sys/kernel/slab/task_xstate/partial | 2 +- test/sys/kernel/slab/task_xstate/slabs | 2 +- test/sys/kernel/slab/task_xstate/total_objects | 2 +- test/sys/kernel/slab/tcp_bind_bucket/alloc_calls | 2 +- test/sys/kernel/slab/tcp_bind_bucket/free_calls | 4 +- test/sys/kernel/slab/tcp_bind_bucket/objects | 2 +- .../kernel/slab/tcp_bind_bucket/objects_partial | 2 +- test/sys/kernel/slab/tcp_bind_bucket/partial | 2 +- test/sys/kernel/slab/tw_sock_TCP/alloc_calls | 2 +- test/sys/kernel/slab/tw_sock_TCP/free_calls | 2 +- test/sys/kernel/slab/uhci_urb_priv/alloc_calls | 2 +- test/sys/kernel/slab/uhci_urb_priv/free_calls | 2 +- test/sys/kernel/slab/uid_cache/alloc_calls | 2 +- test/sys/kernel/slab/uid_cache/free_calls | 4 +- test/sys/kernel/slab/vm_area_struct/alloc_calls | 14 +-- test/sys/kernel/slab/vm_area_struct/free_calls | 6 +- test/sys/kernel/slab/vm_area_struct/objects | 2 +- .../sys/kernel/slab/vm_area_struct/objects_partial | 2 +- test/sys/kernel/slab/vm_area_struct/partial | 2 +- test/sys/kernel/slab/vm_area_struct/slabs | 2 +- test/sys/kernel/slab/vm_area_struct/total_objects | 2 +- test/sys/kernel/uevent_seqnum | 2 +- test/udev-test.pl | 78 +++++++-------- 1326 files changed, 2154 insertions(+), 1452 deletions(-) delete mode 100644 test/sys/bus/acpi/drivers_probe delete mode 100644 test/sys/bus/acpi/uevent delete mode 100644 test/sys/bus/pci/drivers_probe delete mode 100644 test/sys/bus/pci/uevent delete mode 100644 test/sys/bus/pci_express/drivers_probe delete mode 100644 test/sys/bus/pci_express/uevent delete mode 100644 test/sys/bus/pcmcia/drivers_probe delete mode 100644 test/sys/bus/pcmcia/uevent delete mode 100644 test/sys/bus/platform/drivers_probe delete mode 100644 test/sys/bus/platform/uevent delete mode 100644 test/sys/bus/pnp/drivers_probe delete mode 100644 test/sys/bus/pnp/uevent delete mode 120000 test/sys/bus/scsi/devices/6:0:0:0 create mode 120000 test/sys/bus/scsi/devices/7:0:0:0 delete mode 120000 test/sys/bus/scsi/devices/host6 create mode 120000 test/sys/bus/scsi/devices/host7 delete mode 120000 test/sys/bus/scsi/devices/target6:0:0 create mode 120000 test/sys/bus/scsi/devices/target7:0:0 delete mode 120000 test/sys/bus/scsi/drivers/sd/6:0:0:0 create mode 120000 test/sys/bus/scsi/drivers/sd/7:0:0:0 delete mode 100644 test/sys/bus/scsi/drivers_probe delete mode 100644 test/sys/bus/scsi/uevent delete mode 100644 test/sys/bus/serio/drivers_probe delete mode 100644 test/sys/bus/serio/uevent delete mode 120000 test/sys/bus/usb/devices/5-1:1.1 delete mode 120000 test/sys/bus/usb/devices/5-1:1.10 delete mode 120000 test/sys/bus/usb/devices/5-1:1.11 delete mode 120000 test/sys/bus/usb/devices/5-1:1.12 delete mode 120000 test/sys/bus/usb/devices/5-1:1.13 delete mode 120000 test/sys/bus/usb/devices/5-1:1.2 delete mode 120000 test/sys/bus/usb/devices/5-1:1.3 delete mode 120000 test/sys/bus/usb/devices/5-1:1.4 delete mode 120000 test/sys/bus/usb/devices/5-1:1.5 delete mode 120000 test/sys/bus/usb/devices/5-1:1.6 delete mode 120000 test/sys/bus/usb/devices/5-1:1.9 create mode 120000 test/sys/bus/usb/devices/5-2:1.1 create mode 120000 test/sys/bus/usb/devices/5-2:1.10 create mode 120000 test/sys/bus/usb/devices/5-2:1.11 create mode 120000 test/sys/bus/usb/devices/5-2:1.12 create mode 120000 test/sys/bus/usb/devices/5-2:1.13 create mode 120000 test/sys/bus/usb/devices/5-2:1.2 create mode 120000 test/sys/bus/usb/devices/5-2:1.3 create mode 120000 test/sys/bus/usb/devices/5-2:1.4 create mode 120000 test/sys/bus/usb/devices/5-2:1.5 create mode 120000 test/sys/bus/usb/devices/5-2:1.6 create mode 120000 test/sys/bus/usb/devices/5-2:1.9 delete mode 120000 test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 delete mode 120000 test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 create mode 120000 test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 create mode 120000 test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 create mode 120000 test/sys/bus/usb/drivers/usb-storage/5-1:1.0 delete mode 120000 test/sys/bus/usb/drivers/usb-storage/5-2:1.0 delete mode 100644 test/sys/bus/usb/drivers_probe delete mode 100644 test/sys/bus/usb/uevent delete mode 120000 test/sys/class/bsg/6:0:0:0 create mode 120000 test/sys/class/bsg/7:0:0:0 delete mode 120000 test/sys/class/input/input7 create mode 120000 test/sys/class/input/input8 delete mode 120000 test/sys/class/scsi_device/6:0:0:0 create mode 120000 test/sys/class/scsi_device/7:0:0:0 delete mode 120000 test/sys/class/scsi_disk/6:0:0:0 create mode 120000 test/sys/class/scsi_disk/7:0:0:0 delete mode 120000 test/sys/class/scsi_host/host6 create mode 120000 test/sys/class/scsi_host/host7 delete mode 120000 test/sys/class/usb_endpoint/usbdev3.3_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev3.3_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev3.4_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev3.4_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep01 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep02 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep82 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep83 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.5_ep84 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.6_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.6_ep02 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.6_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev5.7_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev5.7_ep02 create mode 120000 test/sys/class/usb_endpoint/usbdev5.7_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep00 create mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep01 create mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep02 create mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep81 create mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep82 create mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep83 create mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep84 delete mode 120000 test/sys/dev/char/189:258 create mode 120000 test/sys/dev/char/189:259 delete mode 120000 test/sys/dev/char/189:516 delete mode 120000 test/sys/dev/char/189:517 create mode 120000 test/sys/dev/char/189:518 create mode 120000 test/sys/dev/char/189:520 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/abs delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ff delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/key delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/led delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/msc delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/rel delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/snd delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/sw delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/bustype delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/version delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/name delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/phys delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uniq create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/abs create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ff create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/key create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/led create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/msc create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/rel create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/snd create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/sw create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/bustype create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/version create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/name create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/phys create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uniq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/broken_parity_status create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/class create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/config create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/device create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/enable create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/firmware_node create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/irq create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/local_cpulist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/local_cpus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/msi_bus create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/pools create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/resource create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/resource0 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/active_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/can_queue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/host_busy create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/proc_name create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_capabilities create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_guard_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/supported_mode create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unchecked_isa_dma create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unique_id create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/bdi create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/capability create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/hw_sector_size create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_max create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_penalty create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_async create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_sync create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/quantum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async_rq create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_idle create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_sync create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_hw_sectors_kb create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_sectors_kb create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nomerges create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nr_requests create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/read_ahead_kb create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/scheduler create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/range create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/removable create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/make-it-fail create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/size create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/stat create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/device_blocked create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/evt_media_change create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iocounterbits create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iorequest_cnt create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/allow_restart create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/app_tag_own create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/cache_type create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/protection_type create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/persist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/version create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/interface create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/interface create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/interface create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/interface create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/interface create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/interface create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/interface create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bAlternateSetting create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/modalias create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/persist create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/serial create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/version create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized_default create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bConfigurationValue create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumConfigurations create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumInterfaces create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/busnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/configuration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/descriptors create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/devnum create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/driver create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idProduct create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idVendor create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/manufacturer create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/maxchild create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/active_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/autosuspend create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/connected_duration create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/level create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/wakeup create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/product create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/quirks create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/serial create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/speed create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/urbnum create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bEndpointAddress create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bInterval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bLength create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/dev create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/direction create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/interval create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/type create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/wMaxPacketSize create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/version create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/companion create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/device create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/power/wakeup create mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/subsystem create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/uevent create mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/vendor diff --git a/test/sys/block/sdb b/test/sys/block/sdb index 8b7c0c4713..9d55a61996 120000 --- a/test/sys/block/sdb +++ b/test/sys/block/sdb @@ -1 +1 @@ -../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb \ No newline at end of file +../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers_probe b/test/sys/bus/acpi/drivers_probe deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/acpi/uevent b/test/sys/bus/acpi/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/pci/drivers_probe b/test/sys/bus/pci/drivers_probe deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/pci/uevent b/test/sys/bus/pci/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/pci_express/drivers_probe b/test/sys/bus/pci_express/drivers_probe deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/pci_express/uevent b/test/sys/bus/pci_express/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/pcmcia/drivers_probe b/test/sys/bus/pcmcia/drivers_probe deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/pcmcia/uevent b/test/sys/bus/pcmcia/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/platform/drivers_probe b/test/sys/bus/platform/drivers_probe deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/platform/uevent b/test/sys/bus/platform/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/pnp/drivers_probe b/test/sys/bus/pnp/drivers_probe deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/pnp/uevent b/test/sys/bus/pnp/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/scsi/devices/6:0:0:0 b/test/sys/bus/scsi/devices/6:0:0:0 deleted file mode 120000 index b3bc5a3de7..0000000000 --- a/test/sys/bus/scsi/devices/6:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/7:0:0:0 b/test/sys/bus/scsi/devices/7:0:0:0 new file mode 120000 index 0000000000..772a4f0841 --- /dev/null +++ b/test/sys/bus/scsi/devices/7:0:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host6 b/test/sys/bus/scsi/devices/host6 deleted file mode 120000 index 4115c7ebf0..0000000000 --- a/test/sys/bus/scsi/devices/host6 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host7 b/test/sys/bus/scsi/devices/host7 new file mode 120000 index 0000000000..4de41d6158 --- /dev/null +++ b/test/sys/bus/scsi/devices/host7 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/target6:0:0 b/test/sys/bus/scsi/devices/target6:0:0 deleted file mode 120000 index 1a704c0e2e..0000000000 --- a/test/sys/bus/scsi/devices/target6:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/target7:0:0 b/test/sys/bus/scsi/devices/target7:0:0 new file mode 120000 index 0000000000..982ab348ce --- /dev/null +++ b/test/sys/bus/scsi/devices/target7:0:0 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/6:0:0:0 b/test/sys/bus/scsi/drivers/sd/6:0:0:0 deleted file mode 120000 index dd6ac100f6..0000000000 --- a/test/sys/bus/scsi/drivers/sd/6:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/7:0:0:0 b/test/sys/bus/scsi/drivers/sd/7:0:0:0 new file mode 120000 index 0000000000..025591cd47 --- /dev/null +++ b/test/sys/bus/scsi/drivers/sd/7:0:0:0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers_probe b/test/sys/bus/scsi/drivers_probe deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/scsi/uevent b/test/sys/bus/scsi/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/serio/drivers_probe b/test/sys/bus/serio/drivers_probe deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/serio/uevent b/test/sys/bus/serio/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/usb/devices/5-1:1.1 b/test/sys/bus/usb/devices/5-1:1.1 deleted file mode 120000 index 5a7ccb933f..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.10 b/test/sys/bus/usb/devices/5-1:1.10 deleted file mode 120000 index e8e2f715c3..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.10 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.10 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.11 b/test/sys/bus/usb/devices/5-1:1.11 deleted file mode 120000 index fc5402263d..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.11 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.11 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.12 b/test/sys/bus/usb/devices/5-1:1.12 deleted file mode 120000 index 555b791199..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.12 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.12 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.13 b/test/sys/bus/usb/devices/5-1:1.13 deleted file mode 120000 index e0488ffea1..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.13 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.13 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.2 b/test/sys/bus/usb/devices/5-1:1.2 deleted file mode 120000 index 1b28b28dc2..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.3 b/test/sys/bus/usb/devices/5-1:1.3 deleted file mode 120000 index a6d60ab1d8..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.4 b/test/sys/bus/usb/devices/5-1:1.4 deleted file mode 120000 index c6b7132dc9..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.4 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.4 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.5 b/test/sys/bus/usb/devices/5-1:1.5 deleted file mode 120000 index a45f5e2f48..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.5 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.5 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.6 b/test/sys/bus/usb/devices/5-1:1.6 deleted file mode 120000 index e2c8d55a23..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.6 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.6 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.9 b/test/sys/bus/usb/devices/5-1:1.9 deleted file mode 120000 index 81351bff78..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.9 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.9 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.1 b/test/sys/bus/usb/devices/5-2:1.1 new file mode 120000 index 0000000000..4507a84959 --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.1 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.10 b/test/sys/bus/usb/devices/5-2:1.10 new file mode 120000 index 0000000000..64c3c49552 --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.10 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.11 b/test/sys/bus/usb/devices/5-2:1.11 new file mode 120000 index 0000000000..7a6f8fd6a7 --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.11 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.12 b/test/sys/bus/usb/devices/5-2:1.12 new file mode 120000 index 0000000000..d8a97f48bd --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.12 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.13 b/test/sys/bus/usb/devices/5-2:1.13 new file mode 120000 index 0000000000..b7ca9e713c --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.13 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.2 b/test/sys/bus/usb/devices/5-2:1.2 new file mode 120000 index 0000000000..9b5fdba2d0 --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.2 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.3 b/test/sys/bus/usb/devices/5-2:1.3 new file mode 120000 index 0000000000..470433c456 --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.3 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.4 b/test/sys/bus/usb/devices/5-2:1.4 new file mode 120000 index 0000000000..512faa9fef --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.4 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.5 b/test/sys/bus/usb/devices/5-2:1.5 new file mode 120000 index 0000000000..4a3bf6cab8 --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.5 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.6 b/test/sys/bus/usb/devices/5-2:1.6 new file mode 120000 index 0000000000..091b27c11a --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.6 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.9 b/test/sys/bus/usb/devices/5-2:1.9 new file mode 120000 index 0000000000..66ae2e529c --- /dev/null +++ b/test/sys/bus/usb/devices/5-2:1.9 @@ -0,0 +1 @@ +../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 b/test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 deleted file mode 120000 index 68d13ef99f..0000000000 --- a/test/sys/bus/usb/drivers/cdc_acm/5-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 b/test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 deleted file mode 120000 index d7448b75f2..0000000000 --- a/test/sys/bus/usb/drivers/cdc_acm/5-1:1.1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 b/test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 new file mode 120000 index 0000000000..f41d924d48 --- /dev/null +++ b/test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 b/test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 new file mode 120000 index 0000000000..7de556c1ab --- /dev/null +++ b/test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb-storage/5-1:1.0 b/test/sys/bus/usb/drivers/usb-storage/5-1:1.0 new file mode 120000 index 0000000000..68d13ef99f --- /dev/null +++ b/test/sys/bus/usb/drivers/usb-storage/5-1:1.0 @@ -0,0 +1 @@ +../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb-storage/5-2:1.0 b/test/sys/bus/usb/drivers/usb-storage/5-2:1.0 deleted file mode 120000 index f41d924d48..0000000000 --- a/test/sys/bus/usb/drivers/usb-storage/5-2:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers_probe b/test/sys/bus/usb/drivers_probe deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/bus/usb/uevent b/test/sys/bus/usb/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/class/block/sdb b/test/sys/class/block/sdb index 96ff40b869..f588ad7926 120000 --- a/test/sys/class/block/sdb +++ b/test/sys/class/block/sdb @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb \ No newline at end of file diff --git a/test/sys/class/block/sdb1 b/test/sys/class/block/sdb1 index 712deabcd0..02be95389e 120000 --- a/test/sys/class/block/sdb1 +++ b/test/sys/class/block/sdb1 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb/sdb1 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1 \ No newline at end of file diff --git a/test/sys/class/bsg/6:0:0:0 b/test/sys/class/bsg/6:0:0:0 deleted file mode 120000 index df25adc4fe..0000000000 --- a/test/sys/class/bsg/6:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/bsg/6:0:0:0 \ No newline at end of file diff --git a/test/sys/class/bsg/7:0:0:0 b/test/sys/class/bsg/7:0:0:0 new file mode 120000 index 0000000000..7b5b2c882e --- /dev/null +++ b/test/sys/class/bsg/7:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0 \ No newline at end of file diff --git a/test/sys/class/input/event7 b/test/sys/class/input/event7 index d253ce1cdf..a09790ab02 120000 --- a/test/sys/class/input/event7 +++ b/test/sys/class/input/event7 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7 \ No newline at end of file diff --git a/test/sys/class/input/input7 b/test/sys/class/input/input7 deleted file mode 120000 index 9fb9b2af6f..0000000000 --- a/test/sys/class/input/input7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7 \ No newline at end of file diff --git a/test/sys/class/input/input8 b/test/sys/class/input/input8 new file mode 120000 index 0000000000..fe04976a38 --- /dev/null +++ b/test/sys/class/input/input8 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8 \ No newline at end of file diff --git a/test/sys/class/input/mouse1 b/test/sys/class/input/mouse1 index 5b46213a42..995db704ef 120000 --- a/test/sys/class/input/mouse1 +++ b/test/sys/class/input/mouse1 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1 \ No newline at end of file diff --git a/test/sys/class/scsi_device/6:0:0:0 b/test/sys/class/scsi_device/6:0:0:0 deleted file mode 120000 index a28103d133..0000000000 --- a/test/sys/class/scsi_device/6:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/scsi_device/6:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_device/7:0:0:0 b/test/sys/class/scsi_device/7:0:0:0 new file mode 120000 index 0000000000..f04936b31b --- /dev/null +++ b/test/sys/class/scsi_device/7:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_disk/6:0:0:0 b/test/sys/class/scsi_disk/6:0:0:0 deleted file mode 120000 index 520214d150..0000000000 --- a/test/sys/class/scsi_disk/6:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/scsi_disk/6:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_disk/7:0:0:0 b/test/sys/class/scsi_disk/7:0:0:0 new file mode 120000 index 0000000000..b4219d7bf2 --- /dev/null +++ b/test/sys/class/scsi_disk/7:0:0:0 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_generic/sg2 b/test/sys/class/scsi_generic/sg2 index 21cdcefce1..2433e998a8 120000 --- a/test/sys/class/scsi_generic/sg2 +++ b/test/sys/class/scsi_generic/sg2 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/scsi_generic/sg2 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host6 b/test/sys/class/scsi_host/host6 deleted file mode 120000 index 7b9e28c4c9..0000000000 --- a/test/sys/class/scsi_host/host6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/scsi_host/host6 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host7 b/test/sys/class/scsi_host/host7 new file mode 120000 index 0000000000..f4ec0bb3dc --- /dev/null +++ b/test/sys/class/scsi_host/host7 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7 \ No newline at end of file diff --git a/test/sys/class/tty/ttyACM0 b/test/sys/class/tty/ttyACM0 index 40df13c0cf..5aff7254d0 120000 --- a/test/sys/class/tty/ttyACM0 +++ b/test/sys/class/tty/ttyACM0 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.3_ep00 b/test/sys/class/usb_endpoint/usbdev3.3_ep00 deleted file mode 120000 index caa389c41a..0000000000 --- a/test/sys/class/usb_endpoint/usbdev3.3_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.3_ep81 b/test/sys/class/usb_endpoint/usbdev3.3_ep81 deleted file mode 120000 index c79938362e..0000000000 --- a/test/sys/class/usb_endpoint/usbdev3.3_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.4_ep00 b/test/sys/class/usb_endpoint/usbdev3.4_ep00 new file mode 120000 index 0000000000..7ca132ea67 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev3.4_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.4_ep81 b/test/sys/class/usb_endpoint/usbdev3.4_ep81 new file mode 120000 index 0000000000..f22eaef49a --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev3.4_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep00 b/test/sys/class/usb_endpoint/usbdev5.5_ep00 deleted file mode 120000 index d3df107049..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.5_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.5_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep01 b/test/sys/class/usb_endpoint/usbdev5.5_ep01 deleted file mode 120000 index 8457e4578b..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.5_ep01 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1/usb_endpoint/usbdev5.5_ep01 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep02 b/test/sys/class/usb_endpoint/usbdev5.5_ep02 deleted file mode 120000 index 492e719a39..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.5_ep02 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3/usb_endpoint/usbdev5.5_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep81 b/test/sys/class/usb_endpoint/usbdev5.5_ep81 deleted file mode 120000 index 84ba82fe1d..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.5_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.5_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep82 b/test/sys/class/usb_endpoint/usbdev5.5_ep82 deleted file mode 120000 index f23cbb6b2d..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.5_ep82 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1/usb_endpoint/usbdev5.5_ep82 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep83 b/test/sys/class/usb_endpoint/usbdev5.5_ep83 deleted file mode 120000 index 4492b5c3df..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.5_ep83 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.2/usb_endpoint/usbdev5.5_ep83 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.5_ep84 b/test/sys/class/usb_endpoint/usbdev5.5_ep84 deleted file mode 120000 index fce1b65c4c..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.5_ep84 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3/usb_endpoint/usbdev5.5_ep84 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.6_ep00 b/test/sys/class/usb_endpoint/usbdev5.6_ep00 deleted file mode 120000 index a5f5ee509a..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.6_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.6_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.6_ep02 b/test/sys/class/usb_endpoint/usbdev5.6_ep02 deleted file mode 120000 index c8c5af20fb..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.6_ep02 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.6_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.6_ep81 b/test/sys/class/usb_endpoint/usbdev5.6_ep81 deleted file mode 120000 index 82bb2de67d..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.6_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.6_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.7_ep00 b/test/sys/class/usb_endpoint/usbdev5.7_ep00 new file mode 120000 index 0000000000..ca461f6444 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.7_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.7_ep02 b/test/sys/class/usb_endpoint/usbdev5.7_ep02 new file mode 120000 index 0000000000..c01c58b147 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.7_ep02 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.7_ep81 b/test/sys/class/usb_endpoint/usbdev5.7_ep81 new file mode 120000 index 0000000000..1b4eb8d4b4 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.7_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep00 b/test/sys/class/usb_endpoint/usbdev5.9_ep00 new file mode 120000 index 0000000000..84a7886030 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.9_ep00 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep01 b/test/sys/class/usb_endpoint/usbdev5.9_ep01 new file mode 120000 index 0000000000..6ab35bd8b3 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.9_ep01 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep02 b/test/sys/class/usb_endpoint/usbdev5.9_ep02 new file mode 120000 index 0000000000..01b893ff00 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.9_ep02 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep81 b/test/sys/class/usb_endpoint/usbdev5.9_ep81 new file mode 120000 index 0000000000..971b8a16df --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.9_ep81 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep82 b/test/sys/class/usb_endpoint/usbdev5.9_ep82 new file mode 120000 index 0000000000..9061b7226c --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.9_ep82 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep83 b/test/sys/class/usb_endpoint/usbdev5.9_ep83 new file mode 120000 index 0000000000..8f626bd8f5 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.9_ep83 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep84 b/test/sys/class/usb_endpoint/usbdev5.9_ep84 new file mode 120000 index 0000000000..40e1671524 --- /dev/null +++ b/test/sys/class/usb_endpoint/usbdev5.9_ep84 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84 \ No newline at end of file diff --git a/test/sys/dev/block/8:16 b/test/sys/dev/block/8:16 index 96ff40b869..f588ad7926 120000 --- a/test/sys/dev/block/8:16 +++ b/test/sys/dev/block/8:16 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb \ No newline at end of file diff --git a/test/sys/dev/block/8:17 b/test/sys/dev/block/8:17 index 712deabcd0..02be95389e 120000 --- a/test/sys/dev/block/8:17 +++ b/test/sys/dev/block/8:17 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/block/sdb/sdb1 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1 \ No newline at end of file diff --git a/test/sys/dev/char/13:33 b/test/sys/dev/char/13:33 index 5b46213a42..995db704ef 120000 --- a/test/sys/dev/char/13:33 +++ b/test/sys/dev/char/13:33 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1 \ No newline at end of file diff --git a/test/sys/dev/char/13:71 b/test/sys/dev/char/13:71 index d253ce1cdf..a09790ab02 120000 --- a/test/sys/dev/char/13:71 +++ b/test/sys/dev/char/13:71 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7 \ No newline at end of file diff --git a/test/sys/dev/char/166:0 b/test/sys/dev/char/166:0 index 40df13c0cf..5aff7254d0 120000 --- a/test/sys/dev/char/166:0 +++ b/test/sys/dev/char/166:0 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0 \ No newline at end of file diff --git a/test/sys/dev/char/189:258 b/test/sys/dev/char/189:258 deleted file mode 120000 index 8e33ef34ac..0000000000 --- a/test/sys/dev/char/189:258 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:259 b/test/sys/dev/char/189:259 new file mode 120000 index 0000000000..8e33ef34ac --- /dev/null +++ b/test/sys/dev/char/189:259 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:516 b/test/sys/dev/char/189:516 deleted file mode 120000 index 26d5b39dd4..0000000000 --- a/test/sys/dev/char/189:516 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:517 b/test/sys/dev/char/189:517 deleted file mode 120000 index 619c2a79a6..0000000000 --- a/test/sys/dev/char/189:517 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2 \ No newline at end of file diff --git a/test/sys/dev/char/189:518 b/test/sys/dev/char/189:518 new file mode 120000 index 0000000000..26d5b39dd4 --- /dev/null +++ b/test/sys/dev/char/189:518 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:520 b/test/sys/dev/char/189:520 new file mode 120000 index 0000000000..619c2a79a6 --- /dev/null +++ b/test/sys/dev/char/189:520 @@ -0,0 +1 @@ +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2 \ No newline at end of file diff --git a/test/sys/dev/char/21:2 b/test/sys/dev/char/21:2 index 21cdcefce1..2433e998a8 120000 --- a/test/sys/dev/char/21:2 +++ b/test/sys/dev/char/21:2 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/scsi_generic/sg2 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2 \ No newline at end of file diff --git a/test/sys/dev/char/252:10 b/test/sys/dev/char/252:10 index c79938362e..1b4eb8d4b4 120000 --- a/test/sys/dev/char/252:10 +++ b/test/sys/dev/char/252:10 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:11 b/test/sys/dev/char/252:11 index caa389c41a..c01c58b147 120000 --- a/test/sys/dev/char/252:11 +++ b/test/sys/dev/char/252:11 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:24 b/test/sys/dev/char/252:24 index 84ba82fe1d..ca461f6444 120000 --- a/test/sys/dev/char/252:24 +++ b/test/sys/dev/char/252:24 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.5_ep81 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:25 b/test/sys/dev/char/252:25 index f23cbb6b2d..f22eaef49a 120000 --- a/test/sys/dev/char/252:25 +++ b/test/sys/dev/char/252:25 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1/usb_endpoint/usbdev5.5_ep82 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:26 b/test/sys/dev/char/252:26 index 8457e4578b..7ca132ea67 120000 --- a/test/sys/dev/char/252:26 +++ b/test/sys/dev/char/252:26 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.1/usb_endpoint/usbdev5.5_ep01 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:27 b/test/sys/dev/char/252:27 index 4492b5c3df..971b8a16df 120000 --- a/test/sys/dev/char/252:27 +++ b/test/sys/dev/char/252:27 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.2/usb_endpoint/usbdev5.5_ep83 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:28 b/test/sys/dev/char/252:28 index fce1b65c4c..9061b7226c 120000 --- a/test/sys/dev/char/252:28 +++ b/test/sys/dev/char/252:28 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3/usb_endpoint/usbdev5.5_ep84 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82 \ No newline at end of file diff --git a/test/sys/dev/char/252:29 b/test/sys/dev/char/252:29 index 492e719a39..6ab35bd8b3 120000 --- a/test/sys/dev/char/252:29 +++ b/test/sys/dev/char/252:29 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.3/usb_endpoint/usbdev5.5_ep02 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01 \ No newline at end of file diff --git a/test/sys/dev/char/252:30 b/test/sys/dev/char/252:30 index d3df107049..8f626bd8f5 120000 --- a/test/sys/dev/char/252:30 +++ b/test/sys/dev/char/252:30 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.5_ep00 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83 \ No newline at end of file diff --git a/test/sys/dev/char/252:31 b/test/sys/dev/char/252:31 index 82bb2de67d..40e1671524 120000 --- a/test/sys/dev/char/252:31 +++ b/test/sys/dev/char/252:31 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.6_ep81 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84 \ No newline at end of file diff --git a/test/sys/dev/char/252:32 b/test/sys/dev/char/252:32 index c8c5af20fb..01b893ff00 120000 --- a/test/sys/dev/char/252:32 +++ b/test/sys/dev/char/252:32 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.6_ep02 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:33 b/test/sys/dev/char/252:33 index a5f5ee509a..84a7886030 120000 --- a/test/sys/dev/char/252:33 +++ b/test/sys/dev/char/252:33 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.6_ep00 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/254:2 b/test/sys/dev/char/254:2 index df25adc4fe..7b5b2c882e 120000 --- a/test/sys/dev/char/254:2 +++ b/test/sys/dev/char/254:2 @@ -1 +1 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/host6/target6:0:0/6:0:0:0/bsg/6:0:0:0 \ No newline at end of file +../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online index d00491fd7e..573541ac97 100644 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online @@ -1 +1 @@ -1 +0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent index 01c433c818..71da405d1b 100644 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent @@ -1,3 +1,3 @@ POWER_SUPPLY_NAME=AC POWER_SUPPLY_TYPE=Mains -POWER_SUPPLY_ONLINE=1 +POWER_SUPPLY_ONLINE=0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now index 573541ac97..78c34944a9 100644 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now @@ -1 +1 @@ -0 +25830000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now index 8db8b6298e..a3e16aa89a 100644 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now @@ -1 +1 @@ -59160000 +59980000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status index f1a797a6b1..4674475b6e 100644 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status @@ -1 +1 @@ -Full +Discharging diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent index 48bbf4ae00..57197cd329 100644 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent @@ -1,14 +1,14 @@ POWER_SUPPLY_NAME=BAT0 POWER_SUPPLY_TYPE=Battery -POWER_SUPPLY_STATUS=Full +POWER_SUPPLY_STATUS=Discharging POWER_SUPPLY_PRESENT=1 POWER_SUPPLY_TECHNOLOGY=Li-ion POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000 -POWER_SUPPLY_VOLTAGE_NOW=12415000 -POWER_SUPPLY_CURRENT_NOW=0 +POWER_SUPPLY_VOLTAGE_NOW=12207000 +POWER_SUPPLY_CURRENT_NOW=25830000 POWER_SUPPLY_ENERGY_FULL_DESIGN=84240000 POWER_SUPPLY_ENERGY_FULL=61510000 -POWER_SUPPLY_ENERGY_NOW=59160000 +POWER_SUPPLY_ENERGY_NOW=59980000 POWER_SUPPLY_MODEL_NAME=42T5245 POWER_SUPPLY_MANUFACTURER=SANYO POWER_SUPPLY_SERIAL_NUMBER= 6463 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now index e096ad1389..d0c228f780 100644 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now +++ b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now @@ -1 +1 @@ -12415000 +12207000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/config b/test/sys/devices/pci0000:00/0000:00:01.0/config index 238d261e39..e4f57f0cdb 100644 Binary files a/test/sys/devices/pci0000:00/0000:00:01.0/config and b/test/sys/devices/pci0000:00/0000:00:01.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/config b/test/sys/devices/pci0000:00/0000:00:1c.0/config index b0221f2a2f..4e1f907b34 100644 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.0/config and b/test/sys/devices/pci0000:00/0000:00:1c.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes index 8d99027062..cecd5503f4 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes @@ -1 +1 @@ -62672 +289996 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets index 6529ff889b..cbdc9073bf 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets @@ -1 +1 @@ -98 +788 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes index fa120e0ffe..14a39c90ad 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes @@ -1 +1 @@ -18848 +530013 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets index fba7ed526e..5208b59131 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets @@ -1 +1 @@ -143 +1029 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level index c4597e5375..aa34eab5fe 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level @@ -1 +1 @@ -173 +199 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link index 920a139664..987e7ca9a7 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link @@ -1 +1 @@ -43 +77 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise index dc37bbdb81..f84d24e50a 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise @@ -1 +1 @@ -184 +178 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window index c0b67c42b3..19f86cea0f 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window @@ -1,4 +1,4 @@ - 54Mbs: 00000000000000000000000000000000000000000000000000000000000001 1195ms + 54Mbs: 00000000000000000000000000000000000000000000000000000000000000 48Mbs: 00000000000000000000000000000000000000000000000000000000000000 36Mbs: 00000000000000000000000000000000000000000000000000000000000000 24Mbs: 00000000000000000000000000000000000000000000000000000000000000 @@ -11,5 +11,4 @@ 2Mbs: 00000000000000000000000000000000000000000000000000000000000000 1Mbs: 00000000000000000000000000000000000000000000000000000000000000 -Average rate is 54.00Mbs over last 1195ms -100% success (1 good packets over 1 tries) +Average rate: 0Mbs diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics index ba932ad5b6..f8b4855266 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics @@ -1,15 +1,15 @@ -02 00 01 00 e7 07 00 00 25 04 00 00 da 02 00 00 ........%....... -a6 00 00 00 00 00 00 00 00 00 00 00 aa 00 00 00 ................ -c2 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ -00 00 00 00 00 00 00 00 26 00 00 00 00 00 00 00 ........&....... -a7 11 00 00 fe 0d 00 00 30 08 00 00 92 00 00 00 ........0....... -00 00 00 00 00 00 00 00 3c 05 00 00 a9 03 00 00 ........<....... +02 00 01 00 a4 c0 02 00 c6 27 01 00 80 16 01 00 .........'...... +e9 0c 00 00 00 00 00 00 00 00 00 00 69 05 00 00 ............i... +de 98 01 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +00 00 00 00 00 00 00 00 bd 01 00 00 00 00 00 00 ................ +fd 68 08 00 ae d3 06 00 78 65 04 00 b8 2b 00 00 .h......xe...+.. +00 00 00 00 00 00 00 00 7e 42 02 00 4f 95 01 00 ........~B..O... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ -00 00 00 00 3d 00 00 00 00 00 00 00 00 00 00 00 ....=........... -00 00 00 00 eb 00 00 00 82 01 00 00 00 00 00 00 ................ -95 01 00 00 06 00 00 00 00 00 00 00 00 00 00 00 ................ -16 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ -00 00 00 00 6a ff ff ff 00 00 00 00 00 00 00 00 ....j........... +00 00 00 00 da 01 00 00 00 00 00 00 00 00 00 00 ................ +00 00 00 00 d8 dc 00 00 59 10 01 00 00 00 00 00 ........Y....... +df 0c 00 00 16 00 00 00 00 00 00 00 00 00 00 00 ................ +88 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ................ +00 00 00 00 72 ff ff ff 00 00 00 00 00 00 00 00 ....r........... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ -00 00 00 00 01 00 00 00 1d 8c 70 00 44 a1 a8 05 ..........p.D... -15 00 00 00 31 00 00 00 16 02 00 00 8c 00 00 00 ....1........... +00 00 00 00 01 00 00 00 bb 45 98 35 1c 91 e7 f1 .........E.5.... +4c 19 00 00 c2 0c 00 00 e7 ed 00 00 1c 4c 00 00 L............L.. diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature index 67ac0090b3..92e20e6058 100644 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature +++ b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature @@ -1 +1 @@ --150 +-142 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/config b/test/sys/devices/pci0000:00/0000:00:1c.1/config index c7ccc82f6c..eab8639f6d 100644 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.1/config and b/test/sys/devices/pci0000:00/0000:00:1c.1/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration index 0d748f08e7..18dffb356f 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration @@ -1 +1 @@ -113810 +8372376 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration index f2750242a2..cd4d47e67e 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration @@ -1 +1 @@ -113687 +8372254 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 index a12d9200a3..4eef781864 120000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 @@ -1 +1 @@ -usb_endpoint/usbdev3.3_ep81 \ No newline at end of file +usb_endpoint/usbdev3.4_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/abs b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/abs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/abs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ev deleted file mode 100644 index 98d9bcb75a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ev +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ff b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ff deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/ff +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/key b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/key deleted file mode 100644 index 844d194187..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/key +++ /dev/null @@ -1 +0,0 @@ -70000 0 0 0 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/led b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/led deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/led +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/msc b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/msc deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/msc +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/rel b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/rel deleted file mode 100644 index a9c8fe8292..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/rel +++ /dev/null @@ -1 +0,0 @@ -103 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/snd b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/snd deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/snd +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/sw b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/sw deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/capabilities/sw +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/device deleted file mode 120000 index 459da56856..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/device +++ /dev/null @@ -1 +0,0 @@ -../../../3-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/dev deleted file mode 100644 index 95aa46e144..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/dev +++ /dev/null @@ -1 +0,0 @@ -13:71 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/device deleted file mode 120000 index 675e93ac15..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/device +++ /dev/null @@ -1 +0,0 @@ -../../input7 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/subsystem deleted file mode 120000 index 4fae54fac9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/uevent deleted file mode 100644 index 4e0079927a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/event7/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=71 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/bustype b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/bustype deleted file mode 100644 index 1ce74b6b00..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/bustype +++ /dev/null @@ -1 +0,0 @@ -0003 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/product b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/product deleted file mode 100644 index c7b1c6ebbd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/product +++ /dev/null @@ -1 +0,0 @@ -c03e diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/vendor b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/vendor deleted file mode 100644 index cb40fac378..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/vendor +++ /dev/null @@ -1 +0,0 @@ -046d diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/version b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/version deleted file mode 100644 index 2450c58538..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/id/version +++ /dev/null @@ -1 +0,0 @@ -0110 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/modalias deleted file mode 100644 index 2f189939cb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/modalias +++ /dev/null @@ -1 +0,0 @@ -input:b0003v046DpC03Ee0110-e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/dev deleted file mode 100644 index 24a842e3cf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/dev +++ /dev/null @@ -1 +0,0 @@ -13:33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/device deleted file mode 120000 index 675e93ac15..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/device +++ /dev/null @@ -1 +0,0 @@ -../../input7 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem deleted file mode 120000 index 4fae54fac9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/uevent deleted file mode 100644 index 83b19e0d53..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/mouse1/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/name b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/name deleted file mode 100644 index 6eb4e9675f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/name +++ /dev/null @@ -1 +0,0 @@ -Logitech USB-PS/2 Optical Mouse diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/phys b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/phys deleted file mode 100644 index 501849bcf7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/phys +++ /dev/null @@ -1 +0,0 @@ -usb-0000:00:1d.2-1/input0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/subsystem deleted file mode 120000 index ed8b4fa1e4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uevent deleted file mode 100644 index c7d04d0191..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uevent +++ /dev/null @@ -1,9 +0,0 @@ -PRODUCT=3/46d/c03e/110 -NAME="Logitech USB-PS/2 Optical Mouse" -PHYS="usb-0000:00:1d.2-1/input0" -UNIQ="" -EV==17 -KEY==70000 0 0 0 0 -REL==103 -MSC==10 -MODALIAS=input:b0003v046DpC03Ee0110-e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uniq b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uniq deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input7/uniq +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/abs b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/abs new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/abs @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ev new file mode 100644 index 0000000000..98d9bcb75a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ev @@ -0,0 +1 @@ +17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ff b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ff new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ff @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/key b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/key new file mode 100644 index 0000000000..844d194187 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/key @@ -0,0 +1 @@ +70000 0 0 0 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/led b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/led new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/led @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/msc b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/msc new file mode 100644 index 0000000000..f599e28b8a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/msc @@ -0,0 +1 @@ +10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/rel b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/rel new file mode 100644 index 0000000000..a9c8fe8292 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/rel @@ -0,0 +1 @@ +103 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/snd b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/snd new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/snd @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/sw b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/sw new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/sw @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/device new file mode 120000 index 0000000000..459da56856 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/device @@ -0,0 +1 @@ +../../../3-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/dev new file mode 100644 index 0000000000..95aa46e144 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/dev @@ -0,0 +1 @@ +13:71 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/device new file mode 120000 index 0000000000..10b936c7ac --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/device @@ -0,0 +1 @@ +../../input8 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/subsystem new file mode 120000 index 0000000000..4fae54fac9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/uevent new file mode 100644 index 0000000000..4e0079927a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=71 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/bustype b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/bustype new file mode 100644 index 0000000000..1ce74b6b00 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/bustype @@ -0,0 +1 @@ +0003 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/product b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/product new file mode 100644 index 0000000000..c7b1c6ebbd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/product @@ -0,0 +1 @@ +c03e diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/vendor b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/vendor new file mode 100644 index 0000000000..cb40fac378 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/vendor @@ -0,0 +1 @@ +046d diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/version b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/version new file mode 100644 index 0000000000..2450c58538 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/version @@ -0,0 +1 @@ +0110 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/modalias new file mode 100644 index 0000000000..2f189939cb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/modalias @@ -0,0 +1 @@ +input:b0003v046DpC03Ee0110-e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/dev new file mode 100644 index 0000000000..24a842e3cf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/dev @@ -0,0 +1 @@ +13:33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/device new file mode 120000 index 0000000000..10b936c7ac --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/device @@ -0,0 +1 @@ +../../input8 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem new file mode 120000 index 0000000000..4fae54fac9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/uevent new file mode 100644 index 0000000000..83b19e0d53 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/uevent @@ -0,0 +1,2 @@ +MAJOR=13 +MINOR=33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/name b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/name new file mode 100644 index 0000000000..6eb4e9675f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/name @@ -0,0 +1 @@ +Logitech USB-PS/2 Optical Mouse diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/phys b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/phys new file mode 100644 index 0000000000..501849bcf7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/phys @@ -0,0 +1 @@ +usb-0000:00:1d.2-1/input0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/subsystem new file mode 120000 index 0000000000..ed8b4fa1e4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uevent new file mode 100644 index 0000000000..c7d04d0191 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uevent @@ -0,0 +1,9 @@ +PRODUCT=3/46d/c03e/110 +NAME="Logitech USB-PS/2 Optical Mouse" +PHYS="usb-0000:00:1d.2-1/input0" +UNIQ="" +EV==17 +KEY==70000 0 0 0 0 +REL==103 +MSC==10 +MODALIAS=input:b0003v046DpC03Ee0110-e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uniq b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uniq new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uniq @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval deleted file mode 100644 index eb6e8821f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev deleted file mode 100644 index d12c5095f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device deleted file mode 120000 index 459da56856..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../3-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval deleted file mode 100644 index f5ef4471e1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -10ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent deleted file mode 100644 index 3ff3a28c56..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/wMaxPacketSize deleted file mode 100644 index e224381915..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.3_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval new file mode 100644 index 0000000000..eb6e8821f1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval @@ -0,0 +1 @@ +0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev new file mode 100644 index 0000000000..7ff90f594c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev @@ -0,0 +1 @@ +252:25 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device new file mode 120000 index 0000000000..459da56856 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device @@ -0,0 +1 @@ +../../../3-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval new file mode 100644 index 0000000000..f5ef4471e1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval @@ -0,0 +1 @@ +10ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent new file mode 100644 index 0000000000..f40b59cf7b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=25 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/wMaxPacketSize new file mode 100644 index 0000000000..e224381915 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev index 5ebdb1da47..5af6713c30 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev @@ -1 +1 @@ -189:258 +189:259 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum index 00750edc07..b8626c4cff 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum @@ -1 +1 @@ -3 +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 index ec7e7c1084..077d8bafc0 120000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 @@ -1 +1 @@ -usb_endpoint/usbdev3.3_ep00 \ No newline at end of file +usb_endpoint/usbdev3.4_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration index 10f7138744..42d86b1fc5 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration @@ -1 +1 @@ -112372 +51384 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration index 10f7138744..2dbd43cd84 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration @@ -1 +1 @@ -112372 +51383 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent index c23b73767e..afde682b7a 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent @@ -1,8 +1,8 @@ MAJOR=189 -MINOR=258 +MINOR=259 DEVTYPE=usb_device DRIVER=usb PRODUCT=46d/c03e/2000 TYPE=0/0/0 BUSNUM=003 -DEVNUM=003 +DEVNUM=004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum index b1bd38b62a..48082f72f0 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum @@ -1 +1 @@ -13 +12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev deleted file mode 100644 index e9646862ed..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:11 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/device deleted file mode 120000 index b2ea03bcd6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../3-1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent deleted file mode 100644 index 7dde40c6e6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=11 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize deleted file mode 100644 index be15c71fd2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.3_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0008 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev new file mode 100644 index 0000000000..13ca53a2c5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev @@ -0,0 +1 @@ +252:26 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/device new file mode 120000 index 0000000000..b2ea03bcd6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/device @@ -0,0 +1 @@ +../../../3-1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent new file mode 100644 index 0000000000..0e554b19c0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=26 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize new file mode 100644 index 0000000000..be15c71fd2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0008 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration index e973dc6dd9..220ab5a75f 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration @@ -1 +1 @@ -113584 +603809 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration index e973dc6dd9..edb008c032 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration @@ -1 +1 @@ -113584 +8372166 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum index 21e72e8ac3..38b10c1b2b 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum +++ b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum @@ -1 +1 @@ -48 +68 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration index 9537691a51..8376cc386f 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration @@ -1 +1 @@ -112053 +8370651 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration index 9537691a51..e23bd34407 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration @@ -1 +1 @@ -112053 +8370650 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration index a98bdef93f..d97138e6e2 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration @@ -1 +1 @@ -111754 +8370363 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration index a98bdef93f..3189ff86f1 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration @@ -1 +1 @@ -111754 +8370362 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration index 10f1be6b55..4876d39b40 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration @@ -1 +1 @@ -113439 +8372033 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration index 10f1be6b55..4876d39b40 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration +++ b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration @@ -1 +1 @@ -113439 +8372033 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.7/broken_parity_status new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/broken_parity_status @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/class b/test/sys/devices/pci0000:00/0000:00:1d.7/class new file mode 100644 index 0000000000..4c84acd962 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/class @@ -0,0 +1 @@ +0x0c0320 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/config b/test/sys/devices/pci0000:00/0000:00:1d.7/config new file mode 100644 index 0000000000..2dd52898e0 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.7/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/device b/test/sys/devices/pci0000:00/0000:00:1d.7/device new file mode 100644 index 0000000000..812d332d30 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/device @@ -0,0 +1 @@ +0x27cc diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/driver new file mode 120000 index 0000000000..04a01344aa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/driver @@ -0,0 +1 @@ +../../../bus/pci/drivers/ehci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/enable b/test/sys/devices/pci0000:00/0000:00:1d.7/enable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/enable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.7/firmware_node new file mode 120000 index 0000000000..f0777b2b2b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/firmware_node @@ -0,0 +1 @@ +../../LNXSYSTM:00/device:00/PNP0A08:00/device:21 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/irq b/test/sys/devices/pci0000:00/0000:00:1d.7/irq new file mode 100644 index 0000000000..d6b24041cf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/irq @@ -0,0 +1 @@ +19 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpulist new file mode 100644 index 0000000000..74fc2fb6b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpulist @@ -0,0 +1 @@ +0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpus new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpus @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/modalias new file mode 100644 index 0000000000..aa8699f429 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/modalias @@ -0,0 +1 @@ +pci:v00008086d000027CCsv000017AAsd0000200Bbc0Csc03i20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.7/msi_bus new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/pools b/test/sys/devices/pci0000:00/0000:00:1d.7/pools new file mode 100644 index 0000000000..74b7ab55d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/pools @@ -0,0 +1,9 @@ +poolinfo - 0.1 +ehci_sitd 0 0 96 0 +ehci_itd 0 0 192 0 +ehci_qh 5 25 160 1 +ehci_qtd 5 42 96 1 +buffer-2048 16 32 2048 16 +buffer-512 0 0 512 0 +buffer-128 2 32 128 1 +buffer-32 2 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/power/wakeup new file mode 100644 index 0000000000..7a68b11da8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/power/wakeup @@ -0,0 +1 @@ +disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/resource b/test/sys/devices/pci0000:00/0000:00:1d.7/resource new file mode 100644 index 0000000000..369eb0b54d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/resource @@ -0,0 +1,7 @@ +0x00000000ee404000 0x00000000ee4043ff 0x0000000000020200 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 +0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/resource0 b/test/sys/devices/pci0000:00/0000:00:1d.7/resource0 new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem new file mode 120000 index 0000000000..4b20ef9984 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem @@ -0,0 +1 @@ +../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_device new file mode 100644 index 0000000000..58a8abe675 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_device @@ -0,0 +1 @@ +0x200b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_vendor new file mode 100644 index 0000000000..49311ac3d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_vendor @@ -0,0 +1 @@ +0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/uevent new file mode 100644 index 0000000000..601e83b52c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/uevent @@ -0,0 +1,6 @@ +DRIVER=ehci_hcd +PCI_CLASS=C0320 +PCI_ID=8086:27CC +PCI_SUBSYS_ID=17AA:200B +PCI_SLOT_NAME=0000:00:1d.7 +MODALIAS=pci:v00008086d000027CCsv000017AAsd0000200Bbc0Csc03i20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver new file mode 120000 index 0000000000..5cf493442c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 new file mode 120000 index 0000000000..f40fc8a5a4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias new file mode 100644 index 0000000000..7eae526595 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias @@ -0,0 +1 @@ +usb:v1D6Bp0002d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent new file mode 100644 index 0000000000..2a8be06e21 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent @@ -0,0 +1,6 @@ +DEVTYPE=usb_interface +DRIVER=hub +PRODUCT=1d6b/2/206 +TYPE=9/0/0 +INTERFACE=9/0/0 +MODALIAS=usb:v1D6Bp0002d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval new file mode 100644 index 0000000000..8ac4b4ca54 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval @@ -0,0 +1 @@ +0c diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev new file mode 100644 index 0000000000..6c314ee8e2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev @@ -0,0 +1 @@ +252:8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/device new file mode 120000 index 0000000000..945b94e9ef --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/device @@ -0,0 +1 @@ +../../../5-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval new file mode 100644 index 0000000000..fa4bd3732b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval @@ -0,0 +1 @@ +256ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent new file mode 100644 index 0000000000..d047937b3d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/wMaxPacketSize new file mode 100644 index 0000000000..e224381915 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass new file mode 100644 index 0000000000..adb9de8ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass @@ -0,0 +1 @@ +08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..e373ee695f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +50 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..cd672a533b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +06 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/driver new file mode 120000 index 0000000000..6fabfe92d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/driver @@ -0,0 +1 @@ +../../../../../../bus/usb/drivers/usb-storage \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 new file mode 120000 index 0000000000..f2e9b56c05 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.7_ep02 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 new file mode 120000 index 0000000000..1203e0516e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.7_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/active_mode b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/active_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/active_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/can_queue b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/can_queue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/can_queue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/device new file mode 120000 index 0000000000..dbb92b165b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/device @@ -0,0 +1 @@ +../../../host7 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/host_busy b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/host_busy new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/host_busy @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/proc_name b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/proc_name new file mode 100644 index 0000000000..6b30c92459 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/proc_name @@ -0,0 +1 @@ +usb-storage diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_capabilities new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_capabilities @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_guard_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_guard_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/state b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/subsystem new file mode 120000 index 0000000000..17253776ee --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/subsystem @@ -0,0 +1 @@ +../../../../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/supported_mode b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/supported_mode new file mode 100644 index 0000000000..46cc42c0d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/supported_mode @@ -0,0 +1 @@ +Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unchecked_isa_dma new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unchecked_isa_dma @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unique_id b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unique_id new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unique_id @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem new file mode 120000 index 0000000000..2edcea4660 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem @@ -0,0 +1 @@ +../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/bdi b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/bdi new file mode 120000 index 0000000000..32e1a77343 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/bdi @@ -0,0 +1 @@ +../../../../../../../../../../virtual/bdi/8:16 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/capability b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/capability new file mode 100644 index 0000000000..b1bd38b62a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/capability @@ -0,0 +1 @@ +13 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/dev new file mode 100644 index 0000000000..112fc37ffb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/dev @@ -0,0 +1 @@ +8:16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/device new file mode 120000 index 0000000000..4784c37861 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/device @@ -0,0 +1 @@ +../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg new file mode 120000 index 0000000000..c7c07d7fb2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg @@ -0,0 +1 @@ +../../../bsg/7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/hw_sector_size b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/hw_sector_size new file mode 100644 index 0000000000..4d0e90cbcb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/hw_sector_size @@ -0,0 +1 @@ +512 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_max b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_max new file mode 100644 index 0000000000..08558e471c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_max @@ -0,0 +1 @@ +16384 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_penalty b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_penalty new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_penalty @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_async b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_async new file mode 100644 index 0000000000..cb1a40df0f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_async @@ -0,0 +1 @@ +250 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_sync b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_sync new file mode 100644 index 0000000000..d136d6a714 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_sync @@ -0,0 +1 @@ +125 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/quantum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/quantum new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/quantum @@ -0,0 +1 @@ +4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async new file mode 100644 index 0000000000..425151f3a4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async @@ -0,0 +1 @@ +40 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async_rq b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async_rq new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async_rq @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_idle b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_idle new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_idle @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_sync b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_sync new file mode 100644 index 0000000000..29d6383b52 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_sync @@ -0,0 +1 @@ +100 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_hw_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_hw_sectors_kb new file mode 100644 index 0000000000..52bd8e43af --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_hw_sectors_kb @@ -0,0 +1 @@ +120 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_sectors_kb new file mode 100644 index 0000000000..52bd8e43af --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_sectors_kb @@ -0,0 +1 @@ +120 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nomerges b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nomerges new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nomerges @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nr_requests b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nr_requests new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nr_requests @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/read_ahead_kb b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/read_ahead_kb new file mode 100644 index 0000000000..a949a93dfc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/read_ahead_kb @@ -0,0 +1 @@ +128 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/scheduler b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/scheduler new file mode 100644 index 0000000000..8b357d87cf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/scheduler @@ -0,0 +1 @@ +noop anticipatory deadline [cfq] diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/range b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/range new file mode 100644 index 0000000000..b6a7d89c68 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/range @@ -0,0 +1 @@ +16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/removable b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/removable new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/removable @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev new file mode 100644 index 0000000000..022b1f47b4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev @@ -0,0 +1 @@ +8:17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/make-it-fail new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/make-it-fail @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size new file mode 100644 index 0000000000..f712151505 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size @@ -0,0 +1 @@ +256992 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start @@ -0,0 +1 @@ +32 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat new file mode 100644 index 0000000000..316332de2e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat @@ -0,0 +1 @@ + 109 392 1903 246 0 0 0 0 0 169 246 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem new file mode 120000 index 0000000000..2b8519ddfe --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem @@ -0,0 +1 @@ +../../../../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/uevent new file mode 100644 index 0000000000..0718e30f77 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=17 +DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/size b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/size new file mode 100644 index 0000000000..2a2fc24578 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/size @@ -0,0 +1 @@ +257024 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/stat b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/stat new file mode 100644 index 0000000000..3d77827fe7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/stat @@ -0,0 +1 @@ + 117 409 2103 272 0 0 0 0 0 194 272 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/subsystem new file mode 120000 index 0000000000..ad0acddd88 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/subsystem @@ -0,0 +1 @@ +../../../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/uevent new file mode 100644 index 0000000000..ffdbcce52f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/uevent @@ -0,0 +1,3 @@ +MAJOR=8 +MINOR=16 +DEVTYPE=disk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev new file mode 100644 index 0000000000..45afae7d31 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev @@ -0,0 +1 @@ +254:2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device new file mode 120000 index 0000000000..4784c37861 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device @@ -0,0 +1 @@ +../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem new file mode 120000 index 0000000000..c5637f4f0f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../../../../class/bsg \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent new file mode 100644 index 0000000000..eb058fa9c7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent @@ -0,0 +1,2 @@ +MAJOR=254 +MINOR=2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/device_blocked new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/device_blocked @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver new file mode 120000 index 0000000000..adcb36def8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver @@ -0,0 +1 @@ +../../../../../../../../../bus/scsi/drivers/sd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/evt_media_change b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/evt_media_change new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/evt_media_change @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic new file mode 120000 index 0000000000..c18ccd1812 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic @@ -0,0 +1 @@ +scsi_generic/sg2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iocounterbits b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iocounterbits new file mode 100644 index 0000000000..f5c89552bd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iocounterbits @@ -0,0 +1 @@ +32 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt new file mode 100644 index 0000000000..4c26d37eb8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt @@ -0,0 +1 @@ +0xc3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt new file mode 100644 index 0000000000..87c20ee33d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt @@ -0,0 +1 @@ +0x2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iorequest_cnt b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iorequest_cnt new file mode 100644 index 0000000000..4c26d37eb8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iorequest_cnt @@ -0,0 +1 @@ +0xc3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors new file mode 100644 index 0000000000..eb08bc0b0b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors @@ -0,0 +1 @@ +240 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias new file mode 100644 index 0000000000..cbde94ebdb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias @@ -0,0 +1 @@ +scsi:t-0x00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model new file mode 100644 index 0000000000..92f0694a08 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model @@ -0,0 +1 @@ +USB Flash Drive diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type new file mode 100644 index 0000000000..621e94f0ec --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type @@ -0,0 +1 @@ +none diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev new file mode 100644 index 0000000000..1e376f6617 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev @@ -0,0 +1 @@ +1.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device new file mode 120000 index 0000000000..4784c37861 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device @@ -0,0 +1 @@ +../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/subsystem new file mode 120000 index 0000000000..a0b71604b8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../../../../class/scsi_device \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/allow_restart b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/allow_restart new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/allow_restart @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/app_tag_own b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/app_tag_own new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/app_tag_own @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/cache_type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/cache_type new file mode 100644 index 0000000000..e9644f31aa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/cache_type @@ -0,0 +1 @@ +write through diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device new file mode 120000 index 0000000000..4784c37861 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device @@ -0,0 +1 @@ +../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/protection_type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/protection_type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/protection_type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/subsystem new file mode 120000 index 0000000000..a67c6b367f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../../../../class/scsi_disk \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev new file mode 100644 index 0000000000..db694dd0be --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev @@ -0,0 +1 @@ +21:2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/device new file mode 120000 index 0000000000..4784c37861 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/device @@ -0,0 +1 @@ +../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem new file mode 120000 index 0000000000..a00b997ea1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem @@ -0,0 +1 @@ +../../../../../../../../../../../class/scsi_generic \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/uevent new file mode 100644 index 0000000000..a9bc7144b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/uevent @@ -0,0 +1,2 @@ +MAJOR=21 +MINOR=2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level new file mode 100644 index 0000000000..00750edc07 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level @@ -0,0 +1 @@ +3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state new file mode 100644 index 0000000000..a2ae71b338 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state @@ -0,0 +1 @@ +running diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem new file mode 120000 index 0000000000..a58dd0ae01 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout new file mode 100644 index 0000000000..abdfb053e4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout @@ -0,0 +1 @@ +60 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent new file mode 100644 index 0000000000..85c5088edf --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent @@ -0,0 +1,3 @@ +DEVTYPE=scsi_device +DRIVER=sd +MODALIAS=scsi:t-0x00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor new file mode 100644 index 0000000000..9ee005f771 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor @@ -0,0 +1 @@ +Generic diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem new file mode 120000 index 0000000000..90f0ab37d0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem @@ -0,0 +1 @@ +../../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/uevent new file mode 100644 index 0000000000..ce02d8524b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_target diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent new file mode 100644 index 0000000000..934f648e8c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent @@ -0,0 +1 @@ +DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/modalias new file mode 100644 index 0000000000..2631a9c47c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/modalias @@ -0,0 +1 @@ +usb:v1043p8012d0100dc00dsc00dp00ic08isc06ip50 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/uevent new file mode 100644 index 0000000000..c0e64b8890 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/uevent @@ -0,0 +1,6 @@ +DEVTYPE=usb_interface +DRIVER=usb-storage +PRODUCT=1043/8012/100 +TYPE=0/0/0 +INTERFACE=8/6/80 +MODALIAS=usb:v1043p8012d0100dc00dsc00dp00ic08isc06ip50 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bEndpointAddress new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bEndpointAddress @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev new file mode 100644 index 0000000000..e9646862ed --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev @@ -0,0 +1 @@ +252:11 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device new file mode 120000 index 0000000000..1e92c83aee --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device @@ -0,0 +1 @@ +../../../5-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction new file mode 100644 index 0000000000..1fcb1529f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction @@ -0,0 +1 @@ +out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent new file mode 100644 index 0000000000..7dde40c6e6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=11 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/wMaxPacketSize new file mode 100644 index 0000000000..092ce5f323 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/wMaxPacketSize @@ -0,0 +1 @@ +0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev new file mode 100644 index 0000000000..d12c5095f0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev @@ -0,0 +1 @@ +252:10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device new file mode 120000 index 0000000000..1e92c83aee --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device @@ -0,0 +1 @@ +../../../5-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent new file mode 100644 index 0000000000..3ff3a28c56 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/wMaxPacketSize new file mode 100644 index 0000000000..092ce5f323 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/authorized b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPacketSize0 new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPacketSize0 @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower new file mode 100644 index 0000000000..a3369c7120 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower @@ -0,0 +1 @@ +100mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice new file mode 100644 index 0000000000..e199843fc5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice @@ -0,0 +1 @@ +0100 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes new file mode 100644 index 0000000000..d15a2cc44e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes @@ -0,0 +1 @@ +80 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/busnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/busnum new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/busnum @@ -0,0 +1 @@ +5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/configuration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/configuration new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/descriptors new file mode 100644 index 0000000000..af16ffd0ed Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev new file mode 100644 index 0000000000..db1a2907ef --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev @@ -0,0 +1 @@ +189:518 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/devnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/devnum new file mode 100644 index 0000000000..7f8f011eb7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/devnum @@ -0,0 +1 @@ +7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/driver new file mode 120000 index 0000000000..092d2282f3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 new file mode 120000 index 0000000000..18e4e875d8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.7_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idProduct new file mode 100644 index 0000000000..f36af27d06 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idProduct @@ -0,0 +1 @@ +8012 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idVendor new file mode 100644 index 0000000000..34d9aaeb09 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idVendor @@ -0,0 +1 @@ +1043 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer new file mode 100644 index 0000000000..8470d61195 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer @@ -0,0 +1 @@ +Generic diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/maxchild new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/maxchild @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/active_duration new file mode 100644 index 0000000000..d2268f7c60 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/active_duration @@ -0,0 +1 @@ +65113 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/connected_duration new file mode 100644 index 0000000000..d2268f7c60 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/connected_duration @@ -0,0 +1 @@ +65113 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/level b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/level new file mode 100644 index 0000000000..b3d86404ab --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/level @@ -0,0 +1 @@ +on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/persist new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/persist @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/product b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/product new file mode 100644 index 0000000000..a3827c329c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/product @@ -0,0 +1 @@ +Flash Disk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/quirks b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed new file mode 100644 index 0000000000..36e082614b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed @@ -0,0 +1 @@ +480 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/uevent new file mode 100644 index 0000000000..bfbb551bc4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=518 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=1043/8012/100 +TYPE=0/0/0 +BUSNUM=005 +DEVNUM=007 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/urbnum new file mode 100644 index 0000000000..611de25367 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/urbnum @@ -0,0 +1 @@ +743 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev new file mode 100644 index 0000000000..12d19732c9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev @@ -0,0 +1 @@ +252:24 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/device new file mode 120000 index 0000000000..35e552af56 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/device @@ -0,0 +1 @@ +../../../5-1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent new file mode 100644 index 0000000000..e6445200c1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=24 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/version b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/version new file mode 100644 index 0000000000..602f25e1f4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/version @@ -0,0 +1 @@ + 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceProtocol new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceProtocol @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceSubClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceSubClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities new file mode 100644 index 0000000000..3f10ffe7a4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities @@ -0,0 +1 @@ +15 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/driver new file mode 120000 index 0000000000..cd15059f11 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/driver @@ -0,0 +1 @@ +../../../../../../bus/usb/drivers/cdc_acm \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 new file mode 120000 index 0000000000..2a8a0666e2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.9_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/interface new file mode 100644 index 0000000000..7575fe2088 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/interface @@ -0,0 +1 @@ +CDC Comms Interface diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/modalias new file mode 100644 index 0000000000..dd88185db4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic02isc02ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev new file mode 100644 index 0000000000..5b278d2839 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev @@ -0,0 +1 @@ +166:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/device new file mode 120000 index 0000000000..feb7c79cbe --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/device @@ -0,0 +1 @@ +../../../5-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem new file mode 120000 index 0000000000..5a82a28739 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent new file mode 100644 index 0000000000..2ba9f43730 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent @@ -0,0 +1,2 @@ +MAJOR=166 +MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/uevent new file mode 100644 index 0000000000..c2ff691a84 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/uevent @@ -0,0 +1,6 @@ +DEVTYPE=usb_interface +DRIVER=cdc_acm +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=2/2/1 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc02ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bEndpointAddress new file mode 100644 index 0000000000..d88e313699 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bEndpointAddress @@ -0,0 +1 @@ +81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval new file mode 100644 index 0000000000..adb9de8ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval @@ -0,0 +1 @@ +08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev new file mode 100644 index 0000000000..41133ae815 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev @@ -0,0 +1 @@ +252:27 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device new file mode 120000 index 0000000000..feb7c79cbe --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device @@ -0,0 +1 @@ +../../../5-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval new file mode 100644 index 0000000000..260640cf65 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval @@ -0,0 +1 @@ +16ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent new file mode 100644 index 0000000000..cdda16fbbc --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=27 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass new file mode 100644 index 0000000000..eb6e8821f1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass @@ -0,0 +1 @@ +0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/driver new file mode 120000 index 0000000000..cd15059f11 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/driver @@ -0,0 +1 @@ +../../../../../../bus/usb/drivers/cdc_acm \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 new file mode 120000 index 0000000000..9c29fa84ea --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.9_ep01 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 new file mode 120000 index 0000000000..3bb8550262 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.9_ep82 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/interface new file mode 100644 index 0000000000..9f4232ca19 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/interface @@ -0,0 +1 @@ +CDC Data Interface diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/modalias new file mode 100644 index 0000000000..2b00a7b41b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/uevent new file mode 100644 index 0000000000..f8c33c7987 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/uevent @@ -0,0 +1,6 @@ +DEVTYPE=usb_interface +DRIVER=cdc_acm +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=10/0/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bEndpointAddress new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bEndpointAddress @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev new file mode 100644 index 0000000000..31a8b5d781 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev @@ -0,0 +1 @@ +252:29 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device new file mode 120000 index 0000000000..d334d1acfd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device @@ -0,0 +1 @@ +../../../5-2:1.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction new file mode 100644 index 0000000000..1fcb1529f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction @@ -0,0 +1 @@ +out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval new file mode 100644 index 0000000000..300966c68e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval @@ -0,0 +1 @@ +31875us diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent new file mode 100644 index 0000000000..fe99938b47 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=29 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/wMaxPacketSize new file mode 100644 index 0000000000..092ce5f323 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/wMaxPacketSize @@ -0,0 +1 @@ +0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bEndpointAddress new file mode 100644 index 0000000000..dde92ddc1a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bEndpointAddress @@ -0,0 +1 @@ +82 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev new file mode 100644 index 0000000000..d50e7b3952 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev @@ -0,0 +1 @@ +252:28 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device new file mode 120000 index 0000000000..d334d1acfd --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device @@ -0,0 +1 @@ +../../../5-2:1.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent new file mode 100644 index 0000000000..2a92107242 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=28 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/wMaxPacketSize new file mode 100644 index 0000000000..092ce5f323 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/wMaxPacketSize @@ -0,0 +1 @@ +0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceNumber new file mode 100644 index 0000000000..eb6e8821f1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceNumber @@ -0,0 +1 @@ +0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceSubClass new file mode 100644 index 0000000000..d6ddcd5065 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceSubClass @@ -0,0 +1 @@ +fe diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/modalias new file mode 100644 index 0000000000..acd278866f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic02iscFEip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/uevent new file mode 100644 index 0000000000..e638139f28 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=2/254/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02iscFEip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass new file mode 100644 index 0000000000..eb6e8821f1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass @@ -0,0 +1 @@ +0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceNumber new file mode 100644 index 0000000000..59db2fe288 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceNumber @@ -0,0 +1 @@ +0b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/modalias new file mode 100644 index 0000000000..2b00a7b41b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/uevent new file mode 100644 index 0000000000..d70db7a9c6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=10/0/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceNumber new file mode 100644 index 0000000000..8ac4b4ca54 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceNumber @@ -0,0 +1 @@ +0c diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceSubClass new file mode 100644 index 0000000000..18fb2459b0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceSubClass @@ -0,0 +1 @@ +fd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/interface new file mode 100644 index 0000000000..d19e3dc633 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/interface @@ -0,0 +1 @@ +LCIF_Alt0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/modalias new file mode 100644 index 0000000000..dc4c407200 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic02iscFDip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/uevent new file mode 100644 index 0000000000..2e63fd3b37 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=2/253/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02iscFDip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass new file mode 100644 index 0000000000..eb6e8821f1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass @@ -0,0 +1 @@ +0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceNumber new file mode 100644 index 0000000000..655e789cd6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceNumber @@ -0,0 +1 @@ +0d diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/modalias new file mode 100644 index 0000000000..2b00a7b41b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/uevent new file mode 100644 index 0000000000..d70db7a9c6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=10/0/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceProtocol new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceProtocol @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceSubClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceSubClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 new file mode 120000 index 0000000000..89ce0147b6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.9_ep83 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/interface new file mode 100644 index 0000000000..7575fe2088 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/interface @@ -0,0 +1 @@ +CDC Comms Interface diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/modalias new file mode 100644 index 0000000000..7770117f05 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic02isc02ipFF diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/uevent new file mode 100644 index 0000000000..4324de940d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=2/2/255 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc02ipFF diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bEndpointAddress new file mode 100644 index 0000000000..76a8b2b703 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bEndpointAddress @@ -0,0 +1 @@ +83 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval new file mode 100644 index 0000000000..adb9de8ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval @@ -0,0 +1 @@ +08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bmAttributes new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bmAttributes @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev new file mode 100644 index 0000000000..ff9325acf8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev @@ -0,0 +1 @@ +252:30 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device new file mode 120000 index 0000000000..b1ba0b452c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device @@ -0,0 +1 @@ +../../../5-2:1.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval new file mode 100644 index 0000000000..260640cf65 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval @@ -0,0 +1 @@ +16ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type new file mode 100644 index 0000000000..8b4382873b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type @@ -0,0 +1 @@ +Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent new file mode 100644 index 0000000000..18fc5d3ab4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=30 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass new file mode 100644 index 0000000000..eb6e8821f1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass @@ -0,0 +1 @@ +0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber new file mode 100644 index 0000000000..75016ea362 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber @@ -0,0 +1 @@ +03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 new file mode 120000 index 0000000000..d19aadae9e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.9_ep02 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 new file mode 120000 index 0000000000..70a3176432 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.9_ep84 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/interface new file mode 100644 index 0000000000..9f4232ca19 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/interface @@ -0,0 +1 @@ +CDC Data Interface diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/modalias new file mode 100644 index 0000000000..2b00a7b41b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/uevent new file mode 100644 index 0000000000..d70db7a9c6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=10/0/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bEndpointAddress new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bEndpointAddress @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev new file mode 100644 index 0000000000..beb6386382 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev @@ -0,0 +1 @@ +252:32 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device new file mode 120000 index 0000000000..26f02bfaa1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device @@ -0,0 +1 @@ +../../../5-2:1.3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction new file mode 100644 index 0000000000..1fcb1529f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction @@ -0,0 +1 @@ +out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval new file mode 100644 index 0000000000..300966c68e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval @@ -0,0 +1 @@ +31875us diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent new file mode 100644 index 0000000000..f3c2dbb6eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=32 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/wMaxPacketSize new file mode 100644 index 0000000000..092ce5f323 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/wMaxPacketSize @@ -0,0 +1 @@ +0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bEndpointAddress new file mode 100644 index 0000000000..871727de1f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bEndpointAddress @@ -0,0 +1 @@ +84 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval new file mode 100644 index 0000000000..fcd15acf93 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval @@ -0,0 +1 @@ +ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bmAttributes new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bmAttributes @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev new file mode 100644 index 0000000000..b0d2a8ab72 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev @@ -0,0 +1 @@ +252:31 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device new file mode 120000 index 0000000000..26f02bfaa1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device @@ -0,0 +1 @@ +../../../5-2:1.3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction new file mode 100644 index 0000000000..4935e88d32 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction @@ -0,0 +1 @@ +in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem new file mode 120000 index 0000000000..e2cbff2b9d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem @@ -0,0 +1 @@ +../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type new file mode 100644 index 0000000000..0ac5fdc00b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type @@ -0,0 +1 @@ +Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent new file mode 100644 index 0000000000..2f90d508ea --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=31 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/wMaxPacketSize new file mode 100644 index 0000000000..092ce5f323 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/wMaxPacketSize @@ -0,0 +1 @@ +0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber new file mode 100644 index 0000000000..64969239d5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber @@ -0,0 +1 @@ +04 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceSubClass new file mode 100644 index 0000000000..adb9de8ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceSubClass @@ -0,0 +1 @@ +08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/modalias new file mode 100644 index 0000000000..6101e55ac2 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic02isc08ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/uevent new file mode 100644 index 0000000000..7f52898b15 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=2/8/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc08ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber new file mode 100644 index 0000000000..eeee65ec41 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber @@ -0,0 +1 @@ +05 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceSubClass new file mode 100644 index 0000000000..59db2fe288 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceSubClass @@ -0,0 +1 @@ +0b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/interface new file mode 100644 index 0000000000..2e50dbe3a3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/interface @@ -0,0 +1 @@ +SYNCML-SYNC diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/modalias new file mode 100644 index 0000000000..aa6b275f9c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic02isc0Bip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/uevent new file mode 100644 index 0000000000..dcd130df1a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=2/11/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc0Bip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass new file mode 100644 index 0000000000..eb6e8821f1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass @@ -0,0 +1 @@ +0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber new file mode 100644 index 0000000000..cd672a533b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber @@ -0,0 +1 @@ +06 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/modalias new file mode 100644 index 0000000000..2b00a7b41b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/uevent new file mode 100644 index 0000000000..d70db7a9c6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=10/0/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceSubClass new file mode 100644 index 0000000000..59db2fe288 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceSubClass @@ -0,0 +1 @@ +0b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/interface new file mode 100644 index 0000000000..887a02bdf1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/interface @@ -0,0 +1 @@ +PC Suite Services diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/modalias new file mode 100644 index 0000000000..aa6b275f9c --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic02isc0Bip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/uevent new file mode 100644 index 0000000000..dcd130df1a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=2/11/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc0Bip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass new file mode 100644 index 0000000000..eb6e8821f1 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass @@ -0,0 +1 @@ +0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber new file mode 100644 index 0000000000..adb9de8ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber @@ -0,0 +1 @@ +08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/modalias new file mode 100644 index 0000000000..2b00a7b41b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/uevent new file mode 100644 index 0000000000..d70db7a9c6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=10/0/0 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bAlternateSetting new file mode 100644 index 0000000000..2142470504 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bAlternateSetting @@ -0,0 +1 @@ + 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceProtocol new file mode 100644 index 0000000000..8a0f05e166 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceProtocol @@ -0,0 +1 @@ +01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceSubClass new file mode 100644 index 0000000000..adb9de8ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceSubClass @@ -0,0 +1 @@ +08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/modalias new file mode 100644 index 0000000000..2bdbac21ec --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/modalias @@ -0,0 +1 @@ +usb:v0421p007Bd0100dc02dsc00dp00ic02isc08ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem new file mode 120000 index 0000000000..29689de588 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem @@ -0,0 +1 @@ +../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/uevent new file mode 100644 index 0000000000..6e844be632 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/uevent @@ -0,0 +1,5 @@ +DEVTYPE=usb_interface +PRODUCT=421/7b/100 +TYPE=2/0/0 +INTERFACE=2/8/1 +MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc08ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/authorized b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass new file mode 100644 index 0000000000..9e22bcb8e3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass @@ -0,0 +1 @@ +02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPacketSize0 new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPacketSize0 @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower new file mode 100644 index 0000000000..a3369c7120 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower @@ -0,0 +1 @@ +100mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumInterfaces new file mode 100644 index 0000000000..8351c19397 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumInterfaces @@ -0,0 +1 @@ +14 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice new file mode 100644 index 0000000000..e199843fc5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice @@ -0,0 +1 @@ +0100 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes new file mode 100644 index 0000000000..caecf05cdb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes @@ -0,0 +1 @@ +c0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/busnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/busnum new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/busnum @@ -0,0 +1 @@ +5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/configuration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/configuration new file mode 100644 index 0000000000..ef898cf0f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/configuration @@ -0,0 +1 @@ +Bulk transfer method configuration diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/descriptors new file mode 100644 index 0000000000..3250eb64e0 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev new file mode 100644 index 0000000000..6c012507a7 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev @@ -0,0 +1 @@ +189:520 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/devnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/devnum new file mode 100644 index 0000000000..ec635144f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/devnum @@ -0,0 +1 @@ +9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/driver new file mode 120000 index 0000000000..092d2282f3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/driver @@ -0,0 +1 @@ +../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 new file mode 120000 index 0000000000..73771a2a71 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.9_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idProduct new file mode 100644 index 0000000000..a001e3e847 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idProduct @@ -0,0 +1 @@ +007b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idVendor new file mode 100644 index 0000000000..7520ff4088 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idVendor @@ -0,0 +1 @@ +0421 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer new file mode 100644 index 0000000000..67a1dab28f --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer @@ -0,0 +1 @@ +Nokia diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/maxchild new file mode 100644 index 0000000000..573541ac97 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/maxchild @@ -0,0 +1 @@ +0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/active_duration new file mode 100644 index 0000000000..4504f4a975 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/active_duration @@ -0,0 +1 @@ +20902 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/connected_duration new file mode 100644 index 0000000000..bd76d61330 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/connected_duration @@ -0,0 +1 @@ +20901 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/level b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/level new file mode 100644 index 0000000000..b3d86404ab --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/level @@ -0,0 +1 @@ +on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/persist new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/persist @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/product b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/product new file mode 100644 index 0000000000..382a6a8dc6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/product @@ -0,0 +1 @@ +N78 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/quirks b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/serial b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/serial new file mode 100644 index 0000000000..3f1a85e94e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/serial @@ -0,0 +1 @@ +354172020305000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed new file mode 100644 index 0000000000..36e082614b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed @@ -0,0 +1 @@ +480 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/subsystem new file mode 120000 index 0000000000..af968de921 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/subsystem @@ -0,0 +1 @@ +../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/uevent new file mode 100644 index 0000000000..9e5884a126 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=520 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=421/7b/100 +TYPE=2/0/0 +BUSNUM=005 +DEVNUM=009 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/urbnum new file mode 100644 index 0000000000..209e3ef4b6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/urbnum @@ -0,0 +1 @@ +20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev new file mode 100644 index 0000000000..7ac0f6d850 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev @@ -0,0 +1 @@ +252:33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/device new file mode 120000 index 0000000000..87adad0979 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/device @@ -0,0 +1 @@ +../../../5-2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem new file mode 120000 index 0000000000..c25f816d1d --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent new file mode 100644 index 0000000000..2e248d76c3 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/version b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/version new file mode 100644 index 0000000000..602f25e1f4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/version @@ -0,0 +1 @@ + 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized_default new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized_default @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bConfigurationValue new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bConfigurationValue @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceClass new file mode 100644 index 0000000000..86397e5c10 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceClass @@ -0,0 +1 @@ +09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 new file mode 100644 index 0000000000..900731ffd5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 @@ -0,0 +1 @@ +64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower new file mode 100644 index 0000000000..ca2ea0dab5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower @@ -0,0 +1 @@ + 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumConfigurations new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumConfigurations @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumInterfaces new file mode 100644 index 0000000000..c6cf38636b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumInterfaces @@ -0,0 +1 @@ + 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice new file mode 100644 index 0000000000..ff5c1613f9 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice @@ -0,0 +1 @@ +0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bmAttributes new file mode 100644 index 0000000000..4fe4106b50 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bmAttributes @@ -0,0 +1 @@ +e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/busnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/busnum new file mode 100644 index 0000000000..7ed6ff82de --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/busnum @@ -0,0 +1 @@ +5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/configuration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/configuration new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/descriptors new file mode 100644 index 0000000000..18f922b269 Binary files /dev/null and b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/descriptors differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev new file mode 100644 index 0000000000..3ee8435395 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev @@ -0,0 +1 @@ +189:512 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/devnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/devnum new file mode 100644 index 0000000000..d00491fd7e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/devnum @@ -0,0 +1 @@ +1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/driver new file mode 120000 index 0000000000..0b3eba3d91 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/driver @@ -0,0 +1 @@ +../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 new file mode 120000 index 0000000000..9e855fa6a8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 @@ -0,0 +1 @@ +usb_endpoint/usbdev5.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idProduct new file mode 100644 index 0000000000..5fca1fda0b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idProduct @@ -0,0 +1 @@ +0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idVendor new file mode 100644 index 0000000000..d247637ee0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idVendor @@ -0,0 +1 @@ +1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/manufacturer new file mode 100644 index 0000000000..8d50915527 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/manufacturer @@ -0,0 +1 @@ +Linux 2.6.27-rc7-00106-g6ef190c-dirty ehci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/maxchild new file mode 100644 index 0000000000..45a4fb75db --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/maxchild @@ -0,0 +1 @@ +8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/active_duration new file mode 100644 index 0000000000..6705442e12 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/active_duration @@ -0,0 +1 @@ +547102 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/autosuspend new file mode 100644 index 0000000000..0cfbf08886 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/autosuspend @@ -0,0 +1 @@ +2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/connected_duration new file mode 100644 index 0000000000..c5c8756420 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/connected_duration @@ -0,0 +1 @@ +8371932 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/level b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/level new file mode 100644 index 0000000000..865faf10cb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/level @@ -0,0 +1 @@ +auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/wakeup new file mode 100644 index 0000000000..86981e69f6 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/wakeup @@ -0,0 +1 @@ +enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/product b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/product new file mode 100644 index 0000000000..45e90b152b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/product @@ -0,0 +1 @@ +EHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/quirks b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/quirks new file mode 100644 index 0000000000..9982566dc0 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/quirks @@ -0,0 +1 @@ +0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/serial b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/serial new file mode 100644 index 0000000000..1c4cc57a63 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/serial @@ -0,0 +1 @@ +0000:00:1d.7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/speed b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/speed new file mode 100644 index 0000000000..36e082614b --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/speed @@ -0,0 +1 @@ +480 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/subsystem new file mode 120000 index 0000000000..77682faf80 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/subsystem @@ -0,0 +1 @@ +../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/uevent new file mode 100644 index 0000000000..2f55d8d1aa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/uevent @@ -0,0 +1,8 @@ +MAJOR=189 +MINOR=512 +DEVTYPE=usb_device +DRIVER=usb +PRODUCT=1d6b/2/206 +TYPE=9/0/0 +BUSNUM=005 +DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/urbnum new file mode 100644 index 0000000000..1b9cba4ae5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/urbnum @@ -0,0 +1 @@ +151 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bEndpointAddress new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bEndpointAddress @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bInterval new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bInterval @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bLength new file mode 100644 index 0000000000..2c7456e3eb --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bLength @@ -0,0 +1 @@ +07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes new file mode 100644 index 0000000000..4daddb72ff --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes @@ -0,0 +1 @@ +00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/dev new file mode 100644 index 0000000000..7d5a3cabad --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/dev @@ -0,0 +1 @@ +252:9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/device new file mode 120000 index 0000000000..b8e2d31484 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/device @@ -0,0 +1 @@ +../../../usb5 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/direction new file mode 100644 index 0000000000..49f33a8c6e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/direction @@ -0,0 +1 @@ +both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/interval new file mode 100644 index 0000000000..a6d0b37ffa --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/interval @@ -0,0 +1 @@ +0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/subsystem new file mode 120000 index 0000000000..4f40f16eba --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/subsystem @@ -0,0 +1 @@ +../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/type new file mode 100644 index 0000000000..6ba80ac5b5 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/type @@ -0,0 +1 @@ +Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/uevent new file mode 100644 index 0000000000..a3bbb7a76a --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/uevent @@ -0,0 +1,2 @@ +MAJOR=252 +MINOR=9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/wMaxPacketSize new file mode 100644 index 0000000000..b5fda7b228 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/wMaxPacketSize @@ -0,0 +1 @@ +0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/version b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/version new file mode 100644 index 0000000000..602f25e1f4 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/version @@ -0,0 +1 @@ + 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/companion b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/companion new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/device new file mode 120000 index 0000000000..05e6ef115e --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/device @@ -0,0 +1 @@ +../../../0000:00:1d.7 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/power/wakeup new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/power/wakeup @@ -0,0 +1 @@ + diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/subsystem new file mode 120000 index 0000000000..72a11573f8 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/subsystem @@ -0,0 +1 @@ +../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/uevent new file mode 100644 index 0000000000..e69de29bb2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/vendor b/test/sys/devices/pci0000:00/0000:00:1d.7/vendor new file mode 100644 index 0000000000..ce6dc4da35 --- /dev/null +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/vendor @@ -0,0 +1 @@ +0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config index be3404f83f..d428930057 100644 Binary files a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config and b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config differ diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt index e439a9acba..32763433b8 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt @@ -1 +1 @@ -0x71 +0x20b3 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt index ab0b052336..f17fa5cc95 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt +++ b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt @@ -1 +1 @@ -0x1a1 +0x82a9 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy index 7fa451caf2..8e795ce1d3 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy @@ -1 +1 @@ -max_performance +medium_power diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat index 22ca482cdf..14817cb638 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat @@ -1 +1 @@ - 8524 4084 430394 149238 599 1279 15024 117893 0 44736 267127 + 11087 4819 566626 169007 2951 4548 59992 129572 0 65249 298573 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat index 1785f8c452..0b9162b06e 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat @@ -1 +1 @@ - 387 21 3102 2398 1 0 8 0 0 2339 2398 + 1648 67 21334 22824 10801 58775 557024 2548214 0 51231 2571037 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat index 0fbc84d5d5..64703d7f45 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat @@ -1 +1 @@ - 9115 5020 435728 153995 603 1279 15072 118133 0 47352 272124 + 12939 5801 590192 194190 13755 63323 617056 2678026 0 114408 2872209 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt index d724420fc8..a334449373 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt @@ -1 +1 @@ -0x2617 +0x6877 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt index 87c20ee33d..e881767f8c 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt @@ -1 +1 @@ -0x2 +0x6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt index d724420fc8..a334449373 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt @@ -1 +1 @@ -0x2617 +0x6877 diff --git a/test/sys/devices/platform/thinkpad_hwmon/fan1_input b/test/sys/devices/platform/thinkpad_hwmon/fan1_input index f35c48ca69..6cf44d4c8c 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/fan1_input +++ b/test/sys/devices/platform/thinkpad_hwmon/fan1_input @@ -1 +1 @@ -3373 +3446 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp10_input b/test/sys/devices/platform/thinkpad_hwmon/temp10_input index ccfc37a15d..afdd418402 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/temp10_input +++ b/test/sys/devices/platform/thinkpad_hwmon/temp10_input @@ -1 +1 @@ -50000 +49000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp11_input b/test/sys/devices/platform/thinkpad_hwmon/temp11_input index afdd418402..d468d452ad 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/temp11_input +++ b/test/sys/devices/platform/thinkpad_hwmon/temp11_input @@ -1 +1 @@ -49000 +43000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp1_input b/test/sys/devices/platform/thinkpad_hwmon/temp1_input index 627c5c7951..44ecd33b16 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/temp1_input +++ b/test/sys/devices/platform/thinkpad_hwmon/temp1_input @@ -1 +1 @@ -54000 +46000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp2_input b/test/sys/devices/platform/thinkpad_hwmon/temp2_input index 87e00fe2f9..7ca5e37363 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/temp2_input +++ b/test/sys/devices/platform/thinkpad_hwmon/temp2_input @@ -1 +1 @@ -38000 +41000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp3_input b/test/sys/devices/platform/thinkpad_hwmon/temp3_input index 3404898810..c58dea0097 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/temp3_input +++ b/test/sys/devices/platform/thinkpad_hwmon/temp3_input @@ -1 +1 @@ -36000 +33000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp4_input b/test/sys/devices/platform/thinkpad_hwmon/temp4_input index 86541638c0..78647fdafd 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/temp4_input +++ b/test/sys/devices/platform/thinkpad_hwmon/temp4_input @@ -1 +1 @@ -68000 +63000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp5_input b/test/sys/devices/platform/thinkpad_hwmon/temp5_input index a4c83d08c5..25410eb726 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/temp5_input +++ b/test/sys/devices/platform/thinkpad_hwmon/temp5_input @@ -1 +1 @@ -32000 +35000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp7_input b/test/sys/devices/platform/thinkpad_hwmon/temp7_input index 3a05c8b3ee..c58dea0097 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/temp7_input +++ b/test/sys/devices/platform/thinkpad_hwmon/temp7_input @@ -1 +1 @@ -30000 +33000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp9_input b/test/sys/devices/platform/thinkpad_hwmon/temp9_input index 87e00fe2f9..25410eb726 100644 --- a/test/sys/devices/platform/thinkpad_hwmon/temp9_input +++ b/test/sys/devices/platform/thinkpad_hwmon/temp9_input @@ -1 +1 @@ -38000 +35000 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch b/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch index cd35b7f2d4..d81530dfc7 100644 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch @@ -1 +1 @@ -1222647192 +1222655451 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/time b/test/sys/devices/pnp0/00:07/rtc/rtc0/time index c60aa6133d..4b7b55dee1 100644 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/time +++ b/test/sys/devices/pnp0/00:07/rtc/rtc0/time @@ -1 +1 @@ -00:13:12 +02:30:51 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold index e85087affd..d61f00d8ca 100644 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold @@ -1 +1 @@ -31 +90 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq index d69c7579dd..749fce669d 100644 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq @@ -1 +1 @@ -2333000 +1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state index a071e77313..ea287bd1c9 100644 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state @@ -1,5 +1,5 @@ -2333000 2159 -2000000 24 -1667000 80 -1333000 123 -1000000 8026 +2333000 92206 +2000000 442 +1667000 1009 +1333000 1713 +1000000 740740 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans index 05c8b2c097..09a6148e46 100644 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans +++ b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans @@ -1 +1 @@ -717 +12627 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc index 72642e9d4a..8d12e88506 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc @@ -1 +1 @@ -CPUIDLE CORE POLL IDLE + diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name index 9c4156dfea..8d12e88506 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name @@ -1 +1 @@ -C0 + diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time index 4fba33e90d..408adce179 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time @@ -1 +1 @@ -1037 +1044 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage index 8351c19397..0cfbf08886 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage @@ -1 +1 @@ -14 +2 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time index f373507a89..bd98ddf2cd 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time @@ -1 +1 @@ -119555 +209561 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage index 0435b54f97..e4d4fcd0b3 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage @@ -1 +1 @@ -5614 +689 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc index e8414e9410..a5ce98be16 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc @@ -1 +1 @@ -ACPI FFH INTEL MWAIT 0x20 +ACPI FFH INTEL MWAIT 0x30 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency index 98d9bcb75a..e1617e842a 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency @@ -1 +1 @@ -17 +57 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power index cb1a40df0f..29d6383b52 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power @@ -1 +1 @@ -250 +100 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time index 562b3ecf0d..533478614c 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time @@ -1 +1 @@ -92046130 +116651688 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage index d16e9e1d99..74a3eba7b4 100644 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage +++ b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage @@ -1 +1 @@ -33517 +11774 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc index 72642e9d4a..8d12e88506 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc @@ -1 +1 @@ -CPUIDLE CORE POLL IDLE + diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name index 9c4156dfea..8d12e88506 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name @@ -1 +1 @@ -C0 + diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time index 1415bc5737..45a4fb75db 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time @@ -1 +1 @@ -2408 +8 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage index a45fd52cc5..d00491fd7e 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage @@ -1 +1 @@ -24 +1 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time index 4d735b4468..85ac849b08 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time @@ -1 +1 @@ -55212 +47233 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage index c5efbfab64..e6a4f00bf7 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage @@ -1 +1 @@ -2821 +271 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc index e8414e9410..a5ce98be16 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc @@ -1 +1 @@ -ACPI FFH INTEL MWAIT 0x20 +ACPI FFH INTEL MWAIT 0x30 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency index 98d9bcb75a..e1617e842a 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency @@ -1 +1 @@ -17 +57 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power index cb1a40df0f..29d6383b52 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power @@ -1 +1 @@ -250 +100 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time index 8d5fd64499..0e44adfdf4 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time @@ -1 +1 @@ -102214756 +117038054 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage index 4ca3828ca7..390213311e 100644 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage +++ b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage @@ -1 +1 @@ -43312 +10601 diff --git a/test/sys/devices/system/cpu/sched_mc_power_savings b/test/sys/devices/system/cpu/sched_mc_power_savings index 573541ac97..d00491fd7e 100644 --- a/test/sys/devices/system/cpu/sched_mc_power_savings +++ b/test/sys/devices/system/cpu/sched_mc_power_savings @@ -1 +1 @@ -0 +1 diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/temp b/test/sys/devices/virtual/thermal/thermal_zone0/temp index 7f13265fee..44ecd33b16 100644 --- a/test/sys/devices/virtual/thermal/thermal_zone0/temp +++ b/test/sys/devices/virtual/thermal/thermal_zone0/temp @@ -1 +1 @@ -53000 +46000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/temp b/test/sys/devices/virtual/thermal/thermal_zone1/temp index 3d17ae0bfd..e50754ae09 100644 --- a/test/sys/devices/virtual/thermal/thermal_zone1/temp +++ b/test/sys/devices/virtual/thermal/thermal_zone1/temp @@ -1 +1 @@ -56000 +47000 diff --git a/test/sys/firmware/acpi/interrupts/gpe02 b/test/sys/firmware/acpi/interrupts/gpe02 index c352d5552e..3b84de6c6e 100644 --- a/test/sys/firmware/acpi/interrupts/gpe02 +++ b/test/sys/firmware/acpi/interrupts/gpe02 @@ -1 +1 @@ - 0 enable + 200 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe1C b/test/sys/firmware/acpi/interrupts/gpe1C index bfa154d3f3..8cc1fbe414 100644 --- a/test/sys/firmware/acpi/interrupts/gpe1C +++ b/test/sys/firmware/acpi/interrupts/gpe1C @@ -1 +1 @@ - 883 enable + 14039 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe_all b/test/sys/firmware/acpi/interrupts/gpe_all index e54d39d521..2ba757cc72 100644 --- a/test/sys/firmware/acpi/interrupts/gpe_all +++ b/test/sys/firmware/acpi/interrupts/gpe_all @@ -1 +1 @@ - 884 + 14240 diff --git a/test/sys/firmware/acpi/interrupts/sci b/test/sys/firmware/acpi/interrupts/sci index e54d39d521..2ba757cc72 100644 --- a/test/sys/firmware/acpi/interrupts/sci +++ b/test/sys/firmware/acpi/interrupts/sci @@ -1 +1 @@ - 884 + 14240 diff --git a/test/sys/kernel/debug/bdi/0:16/stats b/test/sys/kernel/debug/bdi/0:16/stats index c43411b49b..cf9d91d60e 100644 --- a/test/sys/kernel/debug/bdi/0:16/stats +++ b/test/sys/kernel/debug/bdi/0:16/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193284 kB -BackgroundThresh: 96640 kB +DirtyThresh: 189272 kB +BackgroundThresh: 94636 kB diff --git a/test/sys/kernel/debug/bdi/11:0/stats b/test/sys/kernel/debug/bdi/11:0/stats index 5eff4a0704..a909944b30 100644 --- a/test/sys/kernel/debug/bdi/11:0/stats +++ b/test/sys/kernel/debug/bdi/11:0/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193292 kB -BackgroundThresh: 96644 kB +DirtyThresh: 189292 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:0/stats b/test/sys/kernel/debug/bdi/7:0/stats index 9f29e3dd92..a909944b30 100644 --- a/test/sys/kernel/debug/bdi/7:0/stats +++ b/test/sys/kernel/debug/bdi/7:0/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193296 kB -BackgroundThresh: 96648 kB +DirtyThresh: 189292 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:1/stats b/test/sys/kernel/debug/bdi/7:1/stats index 9f29e3dd92..6f601e0157 100644 --- a/test/sys/kernel/debug/bdi/7:1/stats +++ b/test/sys/kernel/debug/bdi/7:1/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193296 kB -BackgroundThresh: 96648 kB +DirtyThresh: 189288 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:2/stats b/test/sys/kernel/debug/bdi/7:2/stats index c43411b49b..6f601e0157 100644 --- a/test/sys/kernel/debug/bdi/7:2/stats +++ b/test/sys/kernel/debug/bdi/7:2/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193284 kB -BackgroundThresh: 96640 kB +DirtyThresh: 189288 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:3/stats b/test/sys/kernel/debug/bdi/7:3/stats index c43411b49b..6f601e0157 100644 --- a/test/sys/kernel/debug/bdi/7:3/stats +++ b/test/sys/kernel/debug/bdi/7:3/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193284 kB -BackgroundThresh: 96640 kB +DirtyThresh: 189288 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:4/stats b/test/sys/kernel/debug/bdi/7:4/stats index c43411b49b..6f601e0157 100644 --- a/test/sys/kernel/debug/bdi/7:4/stats +++ b/test/sys/kernel/debug/bdi/7:4/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193284 kB -BackgroundThresh: 96640 kB +DirtyThresh: 189288 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:5/stats b/test/sys/kernel/debug/bdi/7:5/stats index c43411b49b..6f601e0157 100644 --- a/test/sys/kernel/debug/bdi/7:5/stats +++ b/test/sys/kernel/debug/bdi/7:5/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193284 kB -BackgroundThresh: 96640 kB +DirtyThresh: 189288 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:6/stats b/test/sys/kernel/debug/bdi/7:6/stats index c43411b49b..6f601e0157 100644 --- a/test/sys/kernel/debug/bdi/7:6/stats +++ b/test/sys/kernel/debug/bdi/7:6/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193284 kB -BackgroundThresh: 96640 kB +DirtyThresh: 189288 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:7/stats b/test/sys/kernel/debug/bdi/7:7/stats index c43411b49b..6f601e0157 100644 --- a/test/sys/kernel/debug/bdi/7:7/stats +++ b/test/sys/kernel/debug/bdi/7:7/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193284 kB -BackgroundThresh: 96640 kB +DirtyThresh: 189288 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/8:0/stats b/test/sys/kernel/debug/bdi/8:0/stats index 72b9f30e50..1c5a4fc6e4 100644 --- a/test/sys/kernel/debug/bdi/8:0/stats +++ b/test/sys/kernel/debug/bdi/8:0/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB -BdiReclaimable: 14080 kB -BdiDirtyThresh: 2328 kB -DirtyThresh: 193292 kB -BackgroundThresh: 96644 kB +BdiReclaimable: 13696 kB +BdiDirtyThresh: 83368 kB +DirtyThresh: 189292 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/8:16/stats b/test/sys/kernel/debug/bdi/8:16/stats index c43411b49b..cf9d91d60e 100644 --- a/test/sys/kernel/debug/bdi/8:16/stats +++ b/test/sys/kernel/debug/bdi/8:16/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193284 kB -BackgroundThresh: 96640 kB +DirtyThresh: 189272 kB +BackgroundThresh: 94636 kB diff --git a/test/sys/kernel/debug/bdi/9:0/stats b/test/sys/kernel/debug/bdi/9:0/stats index e475ac8269..a909944b30 100644 --- a/test/sys/kernel/debug/bdi/9:0/stats +++ b/test/sys/kernel/debug/bdi/9:0/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193280 kB -BackgroundThresh: 96640 kB +DirtyThresh: 189292 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/default/stats b/test/sys/kernel/debug/bdi/default/stats index 5eff4a0704..a909944b30 100644 --- a/test/sys/kernel/debug/bdi/default/stats +++ b/test/sys/kernel/debug/bdi/default/stats @@ -1,5 +1,5 @@ BdiWriteback: 0 kB BdiReclaimable: 0 kB BdiDirtyThresh: 0 kB -DirtyThresh: 193292 kB -BackgroundThresh: 96644 kB +DirtyThresh: 189292 kB +BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/slab/Acpi-Namespace/alloc_calls b/test/sys/kernel/slab/Acpi-Namespace/alloc_calls index 0e2ffc5ae4..c6f4ed8d9e 100644 --- a/test/sys/kernel/slab/Acpi-Namespace/alloc_calls +++ b/test/sys/kernel/slab/Acpi-Namespace/alloc_calls @@ -1 +1 @@ - 1709 acpi_ns_create_node+0x34/0x45 age=116006/120316/120398 pid=0-330 cpus=0 + 1709 acpi_ns_create_node+0x34/0x45 age=8375345/8379655/8379737 pid=0-330 cpus=0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/free_calls b/test/sys/kernel/slab/Acpi-Namespace/free_calls index e7f6a1869a..c1a5ab5032 100644 --- a/test/sys/kernel/slab/Acpi-Namespace/free_calls +++ b/test/sys/kernel/slab/Acpi-Namespace/free_calls @@ -1 +1 @@ - 1709 age=4294787694 pid=0 cpus=0 + 1709 age=4303047034 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/objects b/test/sys/kernel/slab/Acpi-Namespace/objects index 741f5d6795..44b88aa386 100644 --- a/test/sys/kernel/slab/Acpi-Namespace/objects +++ b/test/sys/kernel/slab/Acpi-Namespace/objects @@ -1 +1 @@ -1738 +1709 diff --git a/test/sys/kernel/slab/Acpi-Namespace/objects_partial b/test/sys/kernel/slab/Acpi-Namespace/objects_partial index 2bd5a0a98a..f5c89552bd 100644 --- a/test/sys/kernel/slab/Acpi-Namespace/objects_partial +++ b/test/sys/kernel/slab/Acpi-Namespace/objects_partial @@ -1 +1 @@ -22 +32 diff --git a/test/sys/kernel/slab/Acpi-Namespace/partial b/test/sys/kernel/slab/Acpi-Namespace/partial index d00491fd7e..0cfbf08886 100644 --- a/test/sys/kernel/slab/Acpi-Namespace/partial +++ b/test/sys/kernel/slab/Acpi-Namespace/partial @@ -1 +1 @@ -1 +2 diff --git a/test/sys/kernel/slab/Acpi-Operand/alloc_calls b/test/sys/kernel/slab/Acpi-Operand/alloc_calls index 4d77b37000..b86ef24d54 100644 --- a/test/sys/kernel/slab/Acpi-Operand/alloc_calls +++ b/test/sys/kernel/slab/Acpi-Operand/alloc_calls @@ -1 +1 @@ - 2637 acpi_ut_allocate_object_desc_dbg+0x39/0x75 age=1821/119915/120374 pid=0-2890 cpus=0-1 + 2653 acpi_ut_allocate_object_desc_dbg+0x39/0x75 age=2625/8339457/8379700 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/Acpi-Operand/free_calls b/test/sys/kernel/slab/Acpi-Operand/free_calls index 48ef19c663..8459645dbb 100644 --- a/test/sys/kernel/slab/Acpi-Operand/free_calls +++ b/test/sys/kernel/slab/Acpi-Operand/free_calls @@ -1,2 +1,2 @@ - 2265 age=4294787671 pid=0 cpus=0 - 372 acpi_os_release_object+0x9/0xd age=1822/117810/120363 pid=0-2890 cpus=0-1 + 2267 age=4303046997 pid=0 cpus=0 + 386 acpi_os_release_object+0x9/0xd age=2626/8137233/8379689 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/Acpi-Operand/objects b/test/sys/kernel/slab/Acpi-Operand/objects index 71150e8800..4633262609 100644 --- a/test/sys/kernel/slab/Acpi-Operand/objects +++ b/test/sys/kernel/slab/Acpi-Operand/objects @@ -1 +1 @@ -2661 +2663 diff --git a/test/sys/kernel/slab/Acpi-Operand/objects_partial b/test/sys/kernel/slab/Acpi-Operand/objects_partial index 538165229c..b34c321e9c 100644 --- a/test/sys/kernel/slab/Acpi-Operand/objects_partial +++ b/test/sys/kernel/slab/Acpi-Operand/objects_partial @@ -1 +1 @@ -197 +171 diff --git a/test/sys/kernel/slab/Acpi-Operand/partial b/test/sys/kernel/slab/Acpi-Operand/partial index 45a4fb75db..7f8f011eb7 100644 --- a/test/sys/kernel/slab/Acpi-Operand/partial +++ b/test/sys/kernel/slab/Acpi-Operand/partial @@ -1 +1 @@ -8 +7 diff --git a/test/sys/kernel/slab/RAW/alloc_calls b/test/sys/kernel/slab/RAW/alloc_calls index 3e9e980f66..fd834f1a86 100644 --- a/test/sys/kernel/slab/RAW/alloc_calls +++ b/test/sys/kernel/slab/RAW/alloc_calls @@ -1 +1 @@ - 3 sk_prot_alloc+0x1e/0xb0 age=119924/119927/119933 pid=1 cpus=0 + 3 sk_prot_alloc+0x1e/0xb0 age=8379168/8379171/8379177 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/RAW/free_calls b/test/sys/kernel/slab/RAW/free_calls index 387adf109e..ce52248534 100644 --- a/test/sys/kernel/slab/RAW/free_calls +++ b/test/sys/kernel/slab/RAW/free_calls @@ -1 +1 @@ - 3 age=4294787507 pid=0 cpus=0 + 3 age=4303046751 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/RAW/objects b/test/sys/kernel/slab/RAW/objects index 48082f72f0..00750edc07 100644 --- a/test/sys/kernel/slab/RAW/objects +++ b/test/sys/kernel/slab/RAW/objects @@ -1 +1 @@ -12 +3 diff --git a/test/sys/kernel/slab/RAW/objects_partial b/test/sys/kernel/slab/RAW/objects_partial index 573541ac97..00750edc07 100644 --- a/test/sys/kernel/slab/RAW/objects_partial +++ b/test/sys/kernel/slab/RAW/objects_partial @@ -1 +1 @@ -0 +3 diff --git a/test/sys/kernel/slab/RAW/partial b/test/sys/kernel/slab/RAW/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/RAW/partial +++ b/test/sys/kernel/slab/RAW/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/RAWv6/alloc_calls b/test/sys/kernel/slab/RAWv6/alloc_calls index c1c43b575a..434e0be2cf 100644 --- a/test/sys/kernel/slab/RAWv6/alloc_calls +++ b/test/sys/kernel/slab/RAWv6/alloc_calls @@ -1 +1 @@ - 5 sk_prot_alloc+0x1e/0xb0 age=100873/100880/100883 pid=1549 cpus=0 + 5 sk_prot_alloc+0x1e/0xb0 age=8360545/8360552/8360555 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/RAWv6/free_calls b/test/sys/kernel/slab/RAWv6/free_calls index eb3a49d9e9..a25d5a189b 100644 --- a/test/sys/kernel/slab/RAWv6/free_calls +++ b/test/sys/kernel/slab/RAWv6/free_calls @@ -1 +1 @@ - 5 age=4294788100 pid=0 cpus=0 + 5 age=4303047773 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/RAWv6/objects b/test/sys/kernel/slab/RAWv6/objects index 2bd5a0a98a..7ed6ff82de 100644 --- a/test/sys/kernel/slab/RAWv6/objects +++ b/test/sys/kernel/slab/RAWv6/objects @@ -1 +1 @@ -22 +5 diff --git a/test/sys/kernel/slab/RAWv6/objects_partial b/test/sys/kernel/slab/RAWv6/objects_partial index 573541ac97..7ed6ff82de 100644 --- a/test/sys/kernel/slab/RAWv6/objects_partial +++ b/test/sys/kernel/slab/RAWv6/objects_partial @@ -1 +1 @@ -0 +5 diff --git a/test/sys/kernel/slab/RAWv6/partial b/test/sys/kernel/slab/RAWv6/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/RAWv6/partial +++ b/test/sys/kernel/slab/RAWv6/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/TCP/alloc_calls b/test/sys/kernel/slab/TCP/alloc_calls index 7d9c450e8e..7d42046b4a 100644 --- a/test/sys/kernel/slab/TCP/alloc_calls +++ b/test/sys/kernel/slab/TCP/alloc_calls @@ -1 +1 @@ - 2 sk_prot_alloc+0x1e/0xb0 age=94735/95856/96977 pid=1690-1920 cpus=0 + 3 sk_prot_alloc+0x1e/0xb0 age=926836/5879023/8356238 pid=1206-1920 cpus=0 diff --git a/test/sys/kernel/slab/TCP/free_calls b/test/sys/kernel/slab/TCP/free_calls index 85fe8af23a..ea0c7ed6af 100644 --- a/test/sys/kernel/slab/TCP/free_calls +++ b/test/sys/kernel/slab/TCP/free_calls @@ -1 +1 @@ - 2 sk_free+0x80/0x100 age=96193/96808/97424 pid=1667-1762 cpus=0 + 3 sk_free+0x80/0x100 age=932105/5881414/8356684 pid=0-1762 cpus=0 diff --git a/test/sys/kernel/slab/UDP/alloc_calls b/test/sys/kernel/slab/UDP/alloc_calls index 8850f7b92a..6adaa44484 100644 --- a/test/sys/kernel/slab/UDP/alloc_calls +++ b/test/sys/kernel/slab/UDP/alloc_calls @@ -1 +1 @@ - 5 sk_prot_alloc+0x1e/0xb0 age=68483/90027/96209 pid=1545-2586 cpus=0-1 + 5 sk_prot_alloc+0x1e/0xb0 age=8327731/8349275/8355457 pid=1545-2586 cpus=0-1 diff --git a/test/sys/kernel/slab/UDP/free_calls b/test/sys/kernel/slab/UDP/free_calls index 99f6e5a1ac..142010e3b7 100644 --- a/test/sys/kernel/slab/UDP/free_calls +++ b/test/sys/kernel/slab/UDP/free_calls @@ -1,2 +1,2 @@ - 1 age=4294787511 pid=0 cpus=0 - 4 sk_free+0x80/0x100 age=68483/91236/105213 pid=1371-2586 cpus=0-1 + 1 age=4303046759 pid=0 cpus=0 + 4 sk_free+0x80/0x100 age=8327731/8350484/8364461 pid=1371-2586 cpus=0-1 diff --git a/test/sys/kernel/slab/UNIX/alloc_calls b/test/sys/kernel/slab/UNIX/alloc_calls index 8d75da09f8..4c460087fa 100644 --- a/test/sys/kernel/slab/UNIX/alloc_calls +++ b/test/sys/kernel/slab/UNIX/alloc_calls @@ -1 +1 @@ - 453 sk_prot_alloc+0x1e/0xb0 age=15147/84431/117158 pid=71-2852 cpus=0-1 + 450 sk_prot_alloc+0x1e/0xb0 age=61033/8220474/8376385 pid=71-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/UNIX/free_calls b/test/sys/kernel/slab/UNIX/free_calls index c551f22661..1ff76ab6cc 100644 --- a/test/sys/kernel/slab/UNIX/free_calls +++ b/test/sys/kernel/slab/UNIX/free_calls @@ -1,2 +1,2 @@ - 238 age=4294787435 pid=0 cpus=0 - 215 sk_free+0x80/0x100 age=37696/82342/116702 pid=76-2812 cpus=0-1 + 235 age=4303046663 pid=0 cpus=0 + 215 sk_free+0x80/0x100 age=61050/8083366/8375930 pid=76-20292 cpus=0-1 diff --git a/test/sys/kernel/slab/UNIX/objects b/test/sys/kernel/slab/UNIX/objects index e5a0177c9c..615d0e0532 100644 --- a/test/sys/kernel/slab/UNIX/objects +++ b/test/sys/kernel/slab/UNIX/objects @@ -1 +1 @@ -488 +486 diff --git a/test/sys/kernel/slab/UNIX/objects_partial b/test/sys/kernel/slab/UNIX/objects_partial index 7296f257eb..f84d24e50a 100644 --- a/test/sys/kernel/slab/UNIX/objects_partial +++ b/test/sys/kernel/slab/UNIX/objects_partial @@ -1 +1 @@ -136 +178 diff --git a/test/sys/kernel/slab/UNIX/partial b/test/sys/kernel/slab/UNIX/partial index 7f8f011eb7..ec635144f6 100644 --- a/test/sys/kernel/slab/UNIX/partial +++ b/test/sys/kernel/slab/UNIX/partial @@ -1 +1 @@ -7 +9 diff --git a/test/sys/kernel/slab/anon_vma/alloc_calls b/test/sys/kernel/slab/anon_vma/alloc_calls index 4c7fc9859a..c376817f33 100644 --- a/test/sys/kernel/slab/anon_vma/alloc_calls +++ b/test/sys/kernel/slab/anon_vma/alloc_calls @@ -1 +1 @@ - 3239 anon_vma_prepare+0xe0/0x100 age=3762/81736/118721 pid=1-2890 cpus=0-1 + 3234 anon_vma_prepare+0xe0/0x100 age=4177/7981073/8378201 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/anon_vma/free_calls b/test/sys/kernel/slab/anon_vma/free_calls index 635e6921ab..88d9e22a1d 100644 --- a/test/sys/kernel/slab/anon_vma/free_calls +++ b/test/sys/kernel/slab/anon_vma/free_calls @@ -1,2 +1,2 @@ - 1611 age=4294787816 pid=0 cpus=0 - 1628 anon_vma_unlink+0x5f/0x70 age=4763/81283/117672 pid=56-2889 cpus=0-1 + 1575 age=4303047296 pid=0 cpus=0 + 1659 anon_vma_unlink+0x5f/0x70 age=7225/7638870/8377152 pid=56-20292 cpus=0-1 diff --git a/test/sys/kernel/slab/anon_vma/objects b/test/sys/kernel/slab/anon_vma/objects index 362875e42d..33a5f705ca 100644 --- a/test/sys/kernel/slab/anon_vma/objects +++ b/test/sys/kernel/slab/anon_vma/objects @@ -1 +1 @@ -3248 +3265 diff --git a/test/sys/kernel/slab/anon_vma/objects_partial b/test/sys/kernel/slab/anon_vma/objects_partial index de8febe1c7..725a5ba2a7 100644 --- a/test/sys/kernel/slab/anon_vma/objects_partial +++ b/test/sys/kernel/slab/anon_vma/objects_partial @@ -1 +1 @@ -168 +185 diff --git a/test/sys/kernel/slab/anon_vma/partial b/test/sys/kernel/slab/anon_vma/partial index 7f8f011eb7..45a4fb75db 100644 --- a/test/sys/kernel/slab/anon_vma/partial +++ b/test/sys/kernel/slab/anon_vma/partial @@ -1 +1 @@ -7 +8 diff --git a/test/sys/kernel/slab/anon_vma/slabs b/test/sys/kernel/slab/anon_vma/slabs index 5bc6609e3d..415196e47f 100644 --- a/test/sys/kernel/slab/anon_vma/slabs +++ b/test/sys/kernel/slab/anon_vma/slabs @@ -1 +1 @@ -117 +118 diff --git a/test/sys/kernel/slab/anon_vma/total_objects b/test/sys/kernel/slab/anon_vma/total_objects index 56e3ff90a5..4025184410 100644 --- a/test/sys/kernel/slab/anon_vma/total_objects +++ b/test/sys/kernel/slab/anon_vma/total_objects @@ -1 +1 @@ -3276 +3304 diff --git a/test/sys/kernel/slab/arp_cache/alloc_calls b/test/sys/kernel/slab/arp_cache/alloc_calls index 4b1f9e5ee9..f3c601dc6d 100644 --- a/test/sys/kernel/slab/arp_cache/alloc_calls +++ b/test/sys/kernel/slab/arp_cache/alloc_calls @@ -1 +1 @@ - 3 neigh_create+0x8b/0x530 age=64592/65244/65620 pid=0-2618 cpus=0-1 + 1 neigh_create+0x8b/0x530 age=1133499 pid=952 cpus=0 diff --git a/test/sys/kernel/slab/arp_cache/free_calls b/test/sys/kernel/slab/arp_cache/free_calls index 1a2ab65ce2..93f6bb7495 100644 --- a/test/sys/kernel/slab/arp_cache/free_calls +++ b/test/sys/kernel/slab/arp_cache/free_calls @@ -1 +1 @@ - 3 age=4294787502 pid=0 cpus=0 + 1 neigh_destroy+0x10c/0x160 age=1135741 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/bdev_cache/alloc_calls b/test/sys/kernel/slab/bdev_cache/alloc_calls index d99323fdae..c6d765d374 100644 --- a/test/sys/kernel/slab/bdev_cache/alloc_calls +++ b/test/sys/kernel/slab/bdev_cache/alloc_calls @@ -1 +1 @@ - 13 bdev_alloc_inode+0x15/0x30 age=38164/101169/120416 pid=0-2801 cpus=0-1 + 13 bdev_alloc_inode+0x15/0x30 age=61383/7093434/8379778 pid=0-13333 cpus=0 diff --git a/test/sys/kernel/slab/bdev_cache/free_calls b/test/sys/kernel/slab/bdev_cache/free_calls index e009ee8282..a6122267cc 100644 --- a/test/sys/kernel/slab/bdev_cache/free_calls +++ b/test/sys/kernel/slab/bdev_cache/free_calls @@ -1,2 +1,2 @@ - 9 age=4294787712 pid=0 cpus=0 - 4 bdev_destroy_inode+0x1f/0x30 age=38235/76874/115478 pid=488-2778 cpus=0-1 + 9 age=4303047074 pid=0 cpus=0 + 4 bdev_destroy_inode+0x1f/0x30 age=61405/4218130/8374840 pid=488-13325 cpus=0-1 diff --git a/test/sys/kernel/slab/bdev_cache/objects b/test/sys/kernel/slab/bdev_cache/objects index d81cc0710e..f5c89552bd 100644 --- a/test/sys/kernel/slab/bdev_cache/objects +++ b/test/sys/kernel/slab/bdev_cache/objects @@ -1 +1 @@ -42 +32 diff --git a/test/sys/kernel/slab/bdev_cache/objects_partial b/test/sys/kernel/slab/bdev_cache/objects_partial index 573541ac97..b4de394767 100644 --- a/test/sys/kernel/slab/bdev_cache/objects_partial +++ b/test/sys/kernel/slab/bdev_cache/objects_partial @@ -1 +1 @@ -0 +11 diff --git a/test/sys/kernel/slab/bdev_cache/partial b/test/sys/kernel/slab/bdev_cache/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/bdev_cache/partial +++ b/test/sys/kernel/slab/bdev_cache/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/bio/alloc_calls b/test/sys/kernel/slab/bio/alloc_calls index 98c23d1d72..5a0c4b0c79 100644 --- a/test/sys/kernel/slab/bio/alloc_calls +++ b/test/sys/kernel/slab/bio/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=120199/120199/120199 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379518/8379518/8379518 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/bio/free_calls b/test/sys/kernel/slab/bio/free_calls index 7d3d7f54c9..787809f431 100644 --- a/test/sys/kernel/slab/bio/free_calls +++ b/test/sys/kernel/slab/bio/free_calls @@ -1 +1 @@ - 2 age=4294787634 pid=0 cpus=0 + 2 age=4303046952 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/bio/objects b/test/sys/kernel/slab/bio/objects index c739b42c4d..d81cc0710e 100644 --- a/test/sys/kernel/slab/bio/objects +++ b/test/sys/kernel/slab/bio/objects @@ -1 +1 @@ -44 +42 diff --git a/test/sys/kernel/slab/bio/objects_partial b/test/sys/kernel/slab/bio/objects_partial index 0cfbf08886..573541ac97 100644 --- a/test/sys/kernel/slab/bio/objects_partial +++ b/test/sys/kernel/slab/bio/objects_partial @@ -1 +1 @@ -2 +0 diff --git a/test/sys/kernel/slab/bio/partial b/test/sys/kernel/slab/bio/partial index d00491fd7e..573541ac97 100644 --- a/test/sys/kernel/slab/bio/partial +++ b/test/sys/kernel/slab/bio/partial @@ -1 +1 @@ -1 +0 diff --git a/test/sys/kernel/slab/bio/slabs b/test/sys/kernel/slab/bio/slabs index 00750edc07..0cfbf08886 100644 --- a/test/sys/kernel/slab/bio/slabs +++ b/test/sys/kernel/slab/bio/slabs @@ -1 +1 @@ -3 +2 diff --git a/test/sys/kernel/slab/bio/total_objects b/test/sys/kernel/slab/bio/total_objects index 4b9026d8e2..d81cc0710e 100644 --- a/test/sys/kernel/slab/bio/total_objects +++ b/test/sys/kernel/slab/bio/total_objects @@ -1 +1 @@ -63 +42 diff --git a/test/sys/kernel/slab/biovec-1/alloc_calls b/test/sys/kernel/slab/biovec-1/alloc_calls index b8519742fb..c67ebfc174 100644 --- a/test/sys/kernel/slab/biovec-1/alloc_calls +++ b/test/sys/kernel/slab/biovec-1/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=120196/120196/120196 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379509/8379509/8379509 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-1/free_calls b/test/sys/kernel/slab/biovec-1/free_calls index cec96edabc..2f8cf495dd 100644 --- a/test/sys/kernel/slab/biovec-1/free_calls +++ b/test/sys/kernel/slab/biovec-1/free_calls @@ -1 +1 @@ - 2 age=4294787630 pid=0 cpus=0 + 2 age=4303046943 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-128/alloc_calls b/test/sys/kernel/slab/biovec-128/alloc_calls index 2be2f63444..b80db34b3b 100644 --- a/test/sys/kernel/slab/biovec-128/alloc_calls +++ b/test/sys/kernel/slab/biovec-128/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=120168/120168/120168 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379474/8379474/8379474 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-128/free_calls b/test/sys/kernel/slab/biovec-128/free_calls index 9537ec617a..29801ee6cf 100644 --- a/test/sys/kernel/slab/biovec-128/free_calls +++ b/test/sys/kernel/slab/biovec-128/free_calls @@ -1 +1 @@ - 2 age=4294787603 pid=0 cpus=0 + 2 age=4303046908 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-128/objects b/test/sys/kernel/slab/biovec-128/objects index f5c89552bd..60d3b2f4a4 100644 --- a/test/sys/kernel/slab/biovec-128/objects +++ b/test/sys/kernel/slab/biovec-128/objects @@ -1 +1 @@ -32 +15 diff --git a/test/sys/kernel/slab/biovec-128/objects_partial b/test/sys/kernel/slab/biovec-128/objects_partial index 0cfbf08886..573541ac97 100644 --- a/test/sys/kernel/slab/biovec-128/objects_partial +++ b/test/sys/kernel/slab/biovec-128/objects_partial @@ -1 +1 @@ -2 +0 diff --git a/test/sys/kernel/slab/biovec-128/partial b/test/sys/kernel/slab/biovec-128/partial index d00491fd7e..573541ac97 100644 --- a/test/sys/kernel/slab/biovec-128/partial +++ b/test/sys/kernel/slab/biovec-128/partial @@ -1 +1 @@ -1 +0 diff --git a/test/sys/kernel/slab/biovec-128/slabs b/test/sys/kernel/slab/biovec-128/slabs index 00750edc07..d00491fd7e 100644 --- a/test/sys/kernel/slab/biovec-128/slabs +++ b/test/sys/kernel/slab/biovec-128/slabs @@ -1 +1 @@ -3 +1 diff --git a/test/sys/kernel/slab/biovec-128/total_objects b/test/sys/kernel/slab/biovec-128/total_objects index ea90ee3198..60d3b2f4a4 100644 --- a/test/sys/kernel/slab/biovec-128/total_objects +++ b/test/sys/kernel/slab/biovec-128/total_objects @@ -1 +1 @@ -45 +15 diff --git a/test/sys/kernel/slab/biovec-16/alloc_calls b/test/sys/kernel/slab/biovec-16/alloc_calls index cd69dde296..7a5c142192 100644 --- a/test/sys/kernel/slab/biovec-16/alloc_calls +++ b/test/sys/kernel/slab/biovec-16/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=120188/120188/120188 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379491/8379491/8379491 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-16/free_calls b/test/sys/kernel/slab/biovec-16/free_calls index 3329178637..408a0c7ce0 100644 --- a/test/sys/kernel/slab/biovec-16/free_calls +++ b/test/sys/kernel/slab/biovec-16/free_calls @@ -1 +1 @@ - 2 age=4294787622 pid=0 cpus=0 + 2 age=4303046925 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-256/alloc_calls b/test/sys/kernel/slab/biovec-256/alloc_calls index aada639e03..58801f9c5f 100644 --- a/test/sys/kernel/slab/biovec-256/alloc_calls +++ b/test/sys/kernel/slab/biovec-256/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=120164/120164/120164 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379465/8379465/8379465 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-256/free_calls b/test/sys/kernel/slab/biovec-256/free_calls index 13e29ba3bc..8b5bee2d4c 100644 --- a/test/sys/kernel/slab/biovec-256/free_calls +++ b/test/sys/kernel/slab/biovec-256/free_calls @@ -1 +1 @@ - 2 age=4294787599 pid=0 cpus=0 + 2 age=4303046899 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-256/objects b/test/sys/kernel/slab/biovec-256/objects index 7f8f011eb7..0cfbf08886 100644 --- a/test/sys/kernel/slab/biovec-256/objects +++ b/test/sys/kernel/slab/biovec-256/objects @@ -1 +1 @@ -7 +2 diff --git a/test/sys/kernel/slab/biovec-256/objects_partial b/test/sys/kernel/slab/biovec-256/objects_partial index 573541ac97..0cfbf08886 100644 --- a/test/sys/kernel/slab/biovec-256/objects_partial +++ b/test/sys/kernel/slab/biovec-256/objects_partial @@ -1 +1 @@ -0 +2 diff --git a/test/sys/kernel/slab/biovec-256/partial b/test/sys/kernel/slab/biovec-256/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/biovec-256/partial +++ b/test/sys/kernel/slab/biovec-256/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/biovec-4/alloc_calls b/test/sys/kernel/slab/biovec-4/alloc_calls index 6b32bf3154..87cf50aabc 100644 --- a/test/sys/kernel/slab/biovec-4/alloc_calls +++ b/test/sys/kernel/slab/biovec-4/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=120192/120192/120192 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379500/8379500/8379500 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-4/free_calls b/test/sys/kernel/slab/biovec-4/free_calls index 41c58178d0..52061cea61 100644 --- a/test/sys/kernel/slab/biovec-4/free_calls +++ b/test/sys/kernel/slab/biovec-4/free_calls @@ -1 +1 @@ - 2 age=4294787626 pid=0 cpus=0 + 2 age=4303046934 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-64/alloc_calls b/test/sys/kernel/slab/biovec-64/alloc_calls index 9eb050d4bc..482478fcc2 100644 --- a/test/sys/kernel/slab/biovec-64/alloc_calls +++ b/test/sys/kernel/slab/biovec-64/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=120172/120172/120172 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379482/8379482/8379482 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-64/free_calls b/test/sys/kernel/slab/biovec-64/free_calls index e0ab3d9755..34759e4b0a 100644 --- a/test/sys/kernel/slab/biovec-64/free_calls +++ b/test/sys/kernel/slab/biovec-64/free_calls @@ -1 +1 @@ - 2 age=4294787606 pid=0 cpus=0 + 2 age=4303046917 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-64/objects b/test/sys/kernel/slab/biovec-64/objects index 64bb6b746d..9902f17848 100644 --- a/test/sys/kernel/slab/biovec-64/objects +++ b/test/sys/kernel/slab/biovec-64/objects @@ -1 +1 @@ -30 +28 diff --git a/test/sys/kernel/slab/biovec-64/objects_partial b/test/sys/kernel/slab/biovec-64/objects_partial index 0cfbf08886..573541ac97 100644 --- a/test/sys/kernel/slab/biovec-64/objects_partial +++ b/test/sys/kernel/slab/biovec-64/objects_partial @@ -1 +1 @@ -2 +0 diff --git a/test/sys/kernel/slab/biovec-64/partial b/test/sys/kernel/slab/biovec-64/partial index d00491fd7e..573541ac97 100644 --- a/test/sys/kernel/slab/biovec-64/partial +++ b/test/sys/kernel/slab/biovec-64/partial @@ -1 +1 @@ -1 +0 diff --git a/test/sys/kernel/slab/biovec-64/slabs b/test/sys/kernel/slab/biovec-64/slabs index 00750edc07..0cfbf08886 100644 --- a/test/sys/kernel/slab/biovec-64/slabs +++ b/test/sys/kernel/slab/biovec-64/slabs @@ -1 +1 @@ -3 +2 diff --git a/test/sys/kernel/slab/biovec-64/total_objects b/test/sys/kernel/slab/biovec-64/total_objects index d81cc0710e..9902f17848 100644 --- a/test/sys/kernel/slab/biovec-64/total_objects +++ b/test/sys/kernel/slab/biovec-64/total_objects @@ -1 +1 @@ -42 +28 diff --git a/test/sys/kernel/slab/blkdev_ioc/alloc_calls b/test/sys/kernel/slab/blkdev_ioc/alloc_calls index fd6a0c2e61..54887723d7 100644 --- a/test/sys/kernel/slab/blkdev_ioc/alloc_calls +++ b/test/sys/kernel/slab/blkdev_ioc/alloc_calls @@ -1 +1 @@ - 66 alloc_io_context+0x19/0xa0 age=3529/84981/119567 pid=1-2890 cpus=0-1 + 64 alloc_io_context+0x19/0xa0 age=3410/8058449/8378873 pid=1-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_ioc/free_calls b/test/sys/kernel/slab/blkdev_ioc/free_calls index 56b9462cdd..312d929f67 100644 --- a/test/sys/kernel/slab/blkdev_ioc/free_calls +++ b/test/sys/kernel/slab/blkdev_ioc/free_calls @@ -1,2 +1,2 @@ - 11 age=4294787584 pid=0 cpus=0 - 55 put_io_context+0xb2/0xd0 age=35750/89716/115298 pid=145-2828 cpus=0-1 + 9 age=4303046891 pid=0 cpus=0 + 55 put_io_context+0xb2/0xd0 age=45025/8043308/8374605 pid=145-13349 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_ioc/objects b/test/sys/kernel/slab/blkdev_ioc/objects index 29d6383b52..6529ff889b 100644 --- a/test/sys/kernel/slab/blkdev_ioc/objects +++ b/test/sys/kernel/slab/blkdev_ioc/objects @@ -1 +1 @@ -100 +98 diff --git a/test/sys/kernel/slab/blkdev_ioc/objects_partial b/test/sys/kernel/slab/blkdev_ioc/objects_partial index 573541ac97..e522732c77 100644 --- a/test/sys/kernel/slab/blkdev_ioc/objects_partial +++ b/test/sys/kernel/slab/blkdev_ioc/objects_partial @@ -1 +1 @@ -0 +38 diff --git a/test/sys/kernel/slab/blkdev_ioc/partial b/test/sys/kernel/slab/blkdev_ioc/partial index 573541ac97..0cfbf08886 100644 --- a/test/sys/kernel/slab/blkdev_ioc/partial +++ b/test/sys/kernel/slab/blkdev_ioc/partial @@ -1 +1 @@ -0 +2 diff --git a/test/sys/kernel/slab/blkdev_queue/alloc_calls b/test/sys/kernel/slab/blkdev_queue/alloc_calls index a1863f08a1..186b58b921 100644 --- a/test/sys/kernel/slab/blkdev_queue/alloc_calls +++ b/test/sys/kernel/slab/blkdev_queue/alloc_calls @@ -1 +1 @@ - 12 blk_alloc_queue_node+0x1c/0xc0 age=38243/105536/119559 pid=1-2761 cpus=0-1 + 12 blk_alloc_queue_node+0x1c/0xc0 age=61520/7678497/8378855 pid=1-13295 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_queue/free_calls b/test/sys/kernel/slab/blkdev_queue/free_calls index 69f7a12c6c..d87e667686 100644 --- a/test/sys/kernel/slab/blkdev_queue/free_calls +++ b/test/sys/kernel/slab/blkdev_queue/free_calls @@ -1 +1 @@ - 12 age=4294787576 pid=0 cpus=0 + 12 age=4303046873 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/blkdev_queue/objects b/test/sys/kernel/slab/blkdev_queue/objects index 6f4247a625..409940768f 100644 --- a/test/sys/kernel/slab/blkdev_queue/objects +++ b/test/sys/kernel/slab/blkdev_queue/objects @@ -1 +1 @@ -26 +23 diff --git a/test/sys/kernel/slab/blkdev_queue/objects_partial b/test/sys/kernel/slab/blkdev_queue/objects_partial index 573541ac97..f599e28b8a 100644 --- a/test/sys/kernel/slab/blkdev_queue/objects_partial +++ b/test/sys/kernel/slab/blkdev_queue/objects_partial @@ -1 +1 @@ -0 +10 diff --git a/test/sys/kernel/slab/blkdev_queue/partial b/test/sys/kernel/slab/blkdev_queue/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/blkdev_queue/partial +++ b/test/sys/kernel/slab/blkdev_queue/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/blkdev_requests/alloc_calls b/test/sys/kernel/slab/blkdev_requests/alloc_calls index e38a3f481b..76880926cb 100644 --- a/test/sys/kernel/slab/blkdev_requests/alloc_calls +++ b/test/sys/kernel/slab/blkdev_requests/alloc_calls @@ -1 +1 @@ - 12 mempool_alloc_slab+0x11/0x20 age=38247/92347/119563 pid=1-2761 cpus=0-1 + 12 mempool_alloc_slab+0x11/0x20 age=61529/5606309/8378864 pid=1-13295 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_requests/free_calls b/test/sys/kernel/slab/blkdev_requests/free_calls index e729e88963..9ff2f4c912 100644 --- a/test/sys/kernel/slab/blkdev_requests/free_calls +++ b/test/sys/kernel/slab/blkdev_requests/free_calls @@ -1,2 +1,2 @@ - 7 age=4294787580 pid=0 cpus=0 - 5 mempool_free_slab+0x12/0x20 age=38847/55558/119449 pid=0 cpus=0 + 7 age=4303046881 pid=0 cpus=0 + 5 mempool_free_slab+0x12/0x20 age=63050/1742015/8378750 pid=0-1456 cpus=0 diff --git a/test/sys/kernel/slab/blkdev_requests/objects b/test/sys/kernel/slab/blkdev_requests/objects index 9e5feb5256..e373ee695f 100644 --- a/test/sys/kernel/slab/blkdev_requests/objects +++ b/test/sys/kernel/slab/blkdev_requests/objects @@ -1 +1 @@ -46 +50 diff --git a/test/sys/kernel/slab/blkdev_requests/objects_partial b/test/sys/kernel/slab/blkdev_requests/objects_partial index b8626c4cff..45a4fb75db 100644 --- a/test/sys/kernel/slab/blkdev_requests/objects_partial +++ b/test/sys/kernel/slab/blkdev_requests/objects_partial @@ -1 +1 @@ -4 +8 diff --git a/test/sys/kernel/slab/blkdev_requests/partial b/test/sys/kernel/slab/blkdev_requests/partial index d00491fd7e..0cfbf08886 100644 --- a/test/sys/kernel/slab/blkdev_requests/partial +++ b/test/sys/kernel/slab/blkdev_requests/partial @@ -1 +1 @@ -1 +2 diff --git a/test/sys/kernel/slab/blkdev_requests/slabs b/test/sys/kernel/slab/blkdev_requests/slabs index 00750edc07..b8626c4cff 100644 --- a/test/sys/kernel/slab/blkdev_requests/slabs +++ b/test/sys/kernel/slab/blkdev_requests/slabs @@ -1 +1 @@ -3 +4 diff --git a/test/sys/kernel/slab/blkdev_requests/total_objects b/test/sys/kernel/slab/blkdev_requests/total_objects index 4b9026d8e2..871727de1f 100644 --- a/test/sys/kernel/slab/blkdev_requests/total_objects +++ b/test/sys/kernel/slab/blkdev_requests/total_objects @@ -1 +1 @@ -63 +84 diff --git a/test/sys/kernel/slab/buffer_head/alloc_calls b/test/sys/kernel/slab/buffer_head/alloc_calls index 72f9f686e4..36694c00fe 100644 --- a/test/sys/kernel/slab/buffer_head/alloc_calls +++ b/test/sys/kernel/slab/buffer_head/alloc_calls @@ -1 +1 @@ - 11804 alloc_buffer_head+0x19/0x50 age=1/36440/118734 pid=1-2890 cpus=0-1 + 31488 alloc_buffer_head+0x19/0x50 age=1/3079345/8378152 pid=1-32767 cpus=0-1 diff --git a/test/sys/kernel/slab/buffer_head/free_calls b/test/sys/kernel/slab/buffer_head/free_calls index 70d1893509..fc5fc3165c 100644 --- a/test/sys/kernel/slab/buffer_head/free_calls +++ b/test/sys/kernel/slab/buffer_head/free_calls @@ -1,2 +1,2 @@ - 11007 age=4294787773 pid=0 cpus=0 - 798 free_buffer_head+0x20/0x40 age=6772/82539/119636 pid=1-2881 cpus=0-1 + 14436 age=4303047199 pid=0 cpus=0 + 17053 free_buffer_head+0x20/0x40 age=1227/1928220/8379062 pid=1-32759 cpus=0-1 diff --git a/test/sys/kernel/slab/buffer_head/objects b/test/sys/kernel/slab/buffer_head/objects index 9e47d400f2..3ebec5690d 100644 --- a/test/sys/kernel/slab/buffer_head/objects +++ b/test/sys/kernel/slab/buffer_head/objects @@ -1 +1 @@ -11799 +31487 diff --git a/test/sys/kernel/slab/buffer_head/slabs b/test/sys/kernel/slab/buffer_head/slabs index 31cf34b8d0..66227acdb3 100644 --- a/test/sys/kernel/slab/buffer_head/slabs +++ b/test/sys/kernel/slab/buffer_head/slabs @@ -1 +1 @@ -513 +1369 diff --git a/test/sys/kernel/slab/buffer_head/total_objects b/test/sys/kernel/slab/buffer_head/total_objects index 9e47d400f2..3ebec5690d 100644 --- a/test/sys/kernel/slab/buffer_head/total_objects +++ b/test/sys/kernel/slab/buffer_head/total_objects @@ -1 +1 @@ -11799 +31487 diff --git a/test/sys/kernel/slab/cfq_io_context/alloc_calls b/test/sys/kernel/slab/cfq_io_context/alloc_calls index c556949e6e..ce95d893f6 100644 --- a/test/sys/kernel/slab/cfq_io_context/alloc_calls +++ b/test/sys/kernel/slab/cfq_io_context/alloc_calls @@ -1 +1 @@ - 68 cfq_set_request+0x13d/0x390 age=3957/85983/119995 pid=1-2890 cpus=0-1 + 69 cfq_set_request+0x13d/0x390 age=177/7837888/8379613 pid=1-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_io_context/free_calls b/test/sys/kernel/slab/cfq_io_context/free_calls index 36ef1dc75d..da85ebf4d0 100644 --- a/test/sys/kernel/slab/cfq_io_context/free_calls +++ b/test/sys/kernel/slab/cfq_io_context/free_calls @@ -1,2 +1,2 @@ - 12 age=4294788012 pid=0 cpus=0 - 56 cfq_cic_free_rcu+0x21/0xc0 age=21849/89053/116437 pid=0-2655 cpus=0-1 + 12 age=4303047630 pid=0 cpus=0 + 57 cfq_cic_free_rcu+0x21/0xc0 age=61842/7747595/8376055 pid=0-2535 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_io_context/objects b/test/sys/kernel/slab/cfq_io_context/objects index 76a8b2b703..871727de1f 100644 --- a/test/sys/kernel/slab/cfq_io_context/objects +++ b/test/sys/kernel/slab/cfq_io_context/objects @@ -1 +1 @@ -83 +84 diff --git a/test/sys/kernel/slab/cfq_io_context/objects_partial b/test/sys/kernel/slab/cfq_io_context/objects_partial index f5c89552bd..b6a7d89c68 100644 --- a/test/sys/kernel/slab/cfq_io_context/objects_partial +++ b/test/sys/kernel/slab/cfq_io_context/objects_partial @@ -1 +1 @@ -32 +16 diff --git a/test/sys/kernel/slab/cfq_io_context/partial b/test/sys/kernel/slab/cfq_io_context/partial index 0cfbf08886..d00491fd7e 100644 --- a/test/sys/kernel/slab/cfq_io_context/partial +++ b/test/sys/kernel/slab/cfq_io_context/partial @@ -1 +1 @@ -2 +1 diff --git a/test/sys/kernel/slab/cfq_queue/alloc_calls b/test/sys/kernel/slab/cfq_queue/alloc_calls index c408c2bca0..5a863fcad8 100644 --- a/test/sys/kernel/slab/cfq_queue/alloc_calls +++ b/test/sys/kernel/slab/cfq_queue/alloc_calls @@ -1 +1 @@ - 67 cfq_get_queue+0xc6/0x220 age=3952/87492/119990 pid=1-2890 cpus=0-1 + 67 cfq_get_queue+0xc6/0x220 age=168/7825503/8379604 pid=1-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_queue/free_calls b/test/sys/kernel/slab/cfq_queue/free_calls index b16e79de8d..d91e1bf689 100644 --- a/test/sys/kernel/slab/cfq_queue/free_calls +++ b/test/sys/kernel/slab/cfq_queue/free_calls @@ -1,2 +1,2 @@ - 13 age=4294788008 pid=0 cpus=0 - 54 cfq_put_queue+0x6f/0xe0 age=36174/91332/115659 pid=163-2828 cpus=0-1 + 11 age=4303047621 pid=0 cpus=0 + 56 cfq_put_queue+0x6f/0xe0 age=45755/7905388/8375272 pid=163-26529 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_queue/objects b/test/sys/kernel/slab/cfq_queue/objects index 49541f7210..cd5b025272 100644 --- a/test/sys/kernel/slab/cfq_queue/objects +++ b/test/sys/kernel/slab/cfq_queue/objects @@ -1 +1 @@ -94 +92 diff --git a/test/sys/kernel/slab/cfq_queue/objects_partial b/test/sys/kernel/slab/cfq_queue/objects_partial index 3c032078a4..8f92bfdd49 100644 --- a/test/sys/kernel/slab/cfq_queue/objects_partial +++ b/test/sys/kernel/slab/cfq_queue/objects_partial @@ -1 +1 @@ -18 +35 diff --git a/test/sys/kernel/slab/cfq_queue/partial b/test/sys/kernel/slab/cfq_queue/partial index d00491fd7e..0cfbf08886 100644 --- a/test/sys/kernel/slab/cfq_queue/partial +++ b/test/sys/kernel/slab/cfq_queue/partial @@ -1 +1 @@ -1 +2 diff --git a/test/sys/kernel/slab/dentry/alloc_calls b/test/sys/kernel/slab/dentry/alloc_calls index 9555047092..446f29eb77 100644 --- a/test/sys/kernel/slab/dentry/alloc_calls +++ b/test/sys/kernel/slab/dentry/alloc_calls @@ -1 +1 @@ - 27782 d_alloc+0x22/0x1f0 age=0/48123/120447 pid=0-2890 cpus=0-1 + 49656 d_alloc+0x22/0x1f0 age=0/4250434/8379825 pid=0-32757 cpus=0-1 diff --git a/test/sys/kernel/slab/dentry/free_calls b/test/sys/kernel/slab/dentry/free_calls index 3a05c4f2b5..86f293cce3 100644 --- a/test/sys/kernel/slab/dentry/free_calls +++ b/test/sys/kernel/slab/dentry/free_calls @@ -1,3 +1,3 @@ - 23030 age=4294787749 pid=0 cpus=0 - 1432 d_free+0x6c/0x80 age=340/83348/117516 pid=1-2890 cpus=0-1 - 3322 d_callback+0x31/0x40 age=3531/95345/120163 pid=0-2878 cpus=0-1 + 30093 age=4303047137 pid=0 cpus=0 + 2265 d_free+0x6c/0x80 age=519/5532797/8376904 pid=1-32728 cpus=0-1 + 17299 d_callback+0x31/0x40 age=1040/2433896/8379551 pid=0-30210 cpus=0-1 diff --git a/test/sys/kernel/slab/dentry/objects b/test/sys/kernel/slab/dentry/objects index c272137739..d4fff57d7b 100644 --- a/test/sys/kernel/slab/dentry/objects +++ b/test/sys/kernel/slab/dentry/objects @@ -1 +1 @@ -27756 +49656 diff --git a/test/sys/kernel/slab/dentry/slabs b/test/sys/kernel/slab/dentry/slabs index 2612554b2d..bcfe4e9786 100644 --- a/test/sys/kernel/slab/dentry/slabs +++ b/test/sys/kernel/slab/dentry/slabs @@ -1 +1 @@ -2313 +4138 diff --git a/test/sys/kernel/slab/dentry/total_objects b/test/sys/kernel/slab/dentry/total_objects index c272137739..d4fff57d7b 100644 --- a/test/sys/kernel/slab/dentry/total_objects +++ b/test/sys/kernel/slab/dentry/total_objects @@ -1 +1 @@ -27756 +49656 diff --git a/test/sys/kernel/slab/eventpoll_epi/alloc_calls b/test/sys/kernel/slab/eventpoll_epi/alloc_calls index 7dc027ad3b..360e487d13 100644 --- a/test/sys/kernel/slab/eventpoll_epi/alloc_calls +++ b/test/sys/kernel/slab/eventpoll_epi/alloc_calls @@ -1 +1 @@ - 66 sys_epoll_ctl+0x1a4/0x4d0 age=80361/96569/96986 pid=1690-1920 cpus=0-1 + 65 sys_epoll_ctl+0x1a4/0x4d0 age=2416443/8173337/8356255 pid=1690-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_epi/free_calls b/test/sys/kernel/slab/eventpoll_epi/free_calls index 853e487f27..dc16cafc21 100644 --- a/test/sys/kernel/slab/eventpoll_epi/free_calls +++ b/test/sys/kernel/slab/eventpoll_epi/free_calls @@ -1,2 +1,2 @@ - 63 age=4294787533 pid=0 cpus=0 - 3 ep_remove+0xae/0xc0 age=80363/91441/96980 pid=1690-2073 cpus=0 + 61 age=4303046803 pid=0 cpus=0 + 4 ep_remove+0xae/0xc0 age=2416461/6864194/8356250 pid=1690-2073 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_epi/objects b/test/sys/kernel/slab/eventpoll_epi/objects index f906e1845d..85322d0b54 100644 --- a/test/sys/kernel/slab/eventpoll_epi/objects +++ b/test/sys/kernel/slab/eventpoll_epi/objects @@ -1 +1 @@ -96 +79 diff --git a/test/sys/kernel/slab/eventpoll_epi/objects_partial b/test/sys/kernel/slab/eventpoll_epi/objects_partial index 573541ac97..60d3b2f4a4 100644 --- a/test/sys/kernel/slab/eventpoll_epi/objects_partial +++ b/test/sys/kernel/slab/eventpoll_epi/objects_partial @@ -1 +1 @@ -0 +15 diff --git a/test/sys/kernel/slab/eventpoll_epi/partial b/test/sys/kernel/slab/eventpoll_epi/partial index 573541ac97..0cfbf08886 100644 --- a/test/sys/kernel/slab/eventpoll_epi/partial +++ b/test/sys/kernel/slab/eventpoll_epi/partial @@ -1 +1 @@ -0 +2 diff --git a/test/sys/kernel/slab/eventpoll_pwq/alloc_calls b/test/sys/kernel/slab/eventpoll_pwq/alloc_calls index e276977cef..52ae541763 100644 --- a/test/sys/kernel/slab/eventpoll_pwq/alloc_calls +++ b/test/sys/kernel/slab/eventpoll_pwq/alloc_calls @@ -1 +1 @@ - 66 ep_ptable_queue_proc+0x35/0xa0 age=80357/96565/96982 pid=1690-1920 cpus=0-1 + 65 ep_ptable_queue_proc+0x35/0xa0 age=2416434/8173328/8356246 pid=1690-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/free_calls b/test/sys/kernel/slab/eventpoll_pwq/free_calls index 7fa89ca7eb..7910a455f1 100644 --- a/test/sys/kernel/slab/eventpoll_pwq/free_calls +++ b/test/sys/kernel/slab/eventpoll_pwq/free_calls @@ -1,2 +1,2 @@ - 63 age=4294787529 pid=0 cpus=0 - 3 ep_unregister_pollwait+0x61/0x80 age=80359/91437/96976 pid=1690-2073 cpus=0 + 61 age=4303046794 pid=0 cpus=0 + 4 ep_unregister_pollwait+0x61/0x80 age=2416452/6864185/8356241 pid=1690-2073 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/objects b/test/sys/kernel/slab/eventpoll_pwq/objects index 194b81caae..7fe4e495fe 100644 --- a/test/sys/kernel/slab/eventpoll_pwq/objects +++ b/test/sys/kernel/slab/eventpoll_pwq/objects @@ -1 +1 @@ -112 +91 diff --git a/test/sys/kernel/slab/eventpoll_pwq/objects_partial b/test/sys/kernel/slab/eventpoll_pwq/objects_partial index 573541ac97..7f8f011eb7 100644 --- a/test/sys/kernel/slab/eventpoll_pwq/objects_partial +++ b/test/sys/kernel/slab/eventpoll_pwq/objects_partial @@ -1 +1 @@ -0 +7 diff --git a/test/sys/kernel/slab/eventpoll_pwq/partial b/test/sys/kernel/slab/eventpoll_pwq/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/eventpoll_pwq/partial +++ b/test/sys/kernel/slab/eventpoll_pwq/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/alloc_calls b/test/sys/kernel/slab/ext3_inode_cache/alloc_calls index 7ea0125e5a..0d99c969ba 100644 --- a/test/sys/kernel/slab/ext3_inode_cache/alloc_calls +++ b/test/sys/kernel/slab/ext3_inode_cache/alloc_calls @@ -1 +1 @@ - 14652 ext3_alloc_inode+0x15/0x60 age=0/35893/118909 pid=1-2890 cpus=0-1 + 27338 ext3_alloc_inode+0x15/0x60 age=0/2288559/8378475 pid=1-27944 cpus=0-1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/free_calls b/test/sys/kernel/slab/ext3_inode_cache/free_calls index f288e54d66..28981f9042 100644 --- a/test/sys/kernel/slab/ext3_inode_cache/free_calls +++ b/test/sys/kernel/slab/ext3_inode_cache/free_calls @@ -1,2 +1,2 @@ - 14467 age=4294787949 pid=0 cpus=0 - 186 ext3_destroy_inode+0x2f/0x90 age=12685/73602/112381 pid=879-2881 cpus=0-1 + 25981 age=4303047521 pid=0 cpus=0 + 1358 ext3_destroy_inode+0x2f/0x90 age=13089/2437961/8371953 pid=542-32759 cpus=0-1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/objects b/test/sys/kernel/slab/ext3_inode_cache/objects index 632ca0b2c1..cee8ff5a64 100644 --- a/test/sys/kernel/slab/ext3_inode_cache/objects +++ b/test/sys/kernel/slab/ext3_inode_cache/objects @@ -1 +1 @@ -14658 +27342 diff --git a/test/sys/kernel/slab/ext3_inode_cache/slabs b/test/sys/kernel/slab/ext3_inode_cache/slabs index 679fa6b429..47e9cd481d 100644 --- a/test/sys/kernel/slab/ext3_inode_cache/slabs +++ b/test/sys/kernel/slab/ext3_inode_cache/slabs @@ -1 +1 @@ -698 +1302 diff --git a/test/sys/kernel/slab/ext3_inode_cache/total_objects b/test/sys/kernel/slab/ext3_inode_cache/total_objects index 632ca0b2c1..cee8ff5a64 100644 --- a/test/sys/kernel/slab/ext3_inode_cache/total_objects +++ b/test/sys/kernel/slab/ext3_inode_cache/total_objects @@ -1 +1 @@ -14658 +27342 diff --git a/test/sys/kernel/slab/ext3_xattr/alloc_calls b/test/sys/kernel/slab/ext3_xattr/alloc_calls index 3bb52320b7..cbe56c20c8 100644 --- a/test/sys/kernel/slab/ext3_xattr/alloc_calls +++ b/test/sys/kernel/slab/ext3_xattr/alloc_calls @@ -1 +1 @@ - 3 mb_cache_entry_alloc+0x15/0x50 age=21933/47533/60338 pid=2676-2692 cpus=0 + 4 mb_cache_entry_alloc+0x15/0x50 age=5766034/7671829/8319899 pid=2676-9046 cpus=0 diff --git a/test/sys/kernel/slab/ext3_xattr/free_calls b/test/sys/kernel/slab/ext3_xattr/free_calls index be6334007a..1e987092ac 100644 --- a/test/sys/kernel/slab/ext3_xattr/free_calls +++ b/test/sys/kernel/slab/ext3_xattr/free_calls @@ -1 +1 @@ - 3 age=4294787942 pid=0 cpus=0 + 4 age=4303047503 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fasync_cache/alloc_calls b/test/sys/kernel/slab/fasync_cache/alloc_calls index 68aea47fcc..ee9229866b 100644 --- a/test/sys/kernel/slab/fasync_cache/alloc_calls +++ b/test/sys/kernel/slab/fasync_cache/alloc_calls @@ -1 +1 @@ - 1 fasync_helper+0x115/0x130 age=94529 pid=1738 cpus=0 + 1 fasync_helper+0x115/0x130 age=8354059 pid=1738 cpus=0 diff --git a/test/sys/kernel/slab/fasync_cache/free_calls b/test/sys/kernel/slab/fasync_cache/free_calls index e23a1793aa..faadd37d6e 100644 --- a/test/sys/kernel/slab/fasync_cache/free_calls +++ b/test/sys/kernel/slab/fasync_cache/free_calls @@ -1 +1 @@ - 1 age=4294787918 pid=0 cpus=0 + 1 age=4303047449 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fasync_cache/objects b/test/sys/kernel/slab/fasync_cache/objects index d81cc0710e..d00491fd7e 100644 --- a/test/sys/kernel/slab/fasync_cache/objects +++ b/test/sys/kernel/slab/fasync_cache/objects @@ -1 +1 @@ -42 +1 diff --git a/test/sys/kernel/slab/fasync_cache/objects_partial b/test/sys/kernel/slab/fasync_cache/objects_partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/fasync_cache/objects_partial +++ b/test/sys/kernel/slab/fasync_cache/objects_partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/fasync_cache/partial b/test/sys/kernel/slab/fasync_cache/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/fasync_cache/partial +++ b/test/sys/kernel/slab/fasync_cache/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/fat_cache/alloc_calls b/test/sys/kernel/slab/fat_cache/alloc_calls index bd236f66e4..134b9b2ae7 100644 --- a/test/sys/kernel/slab/fat_cache/alloc_calls +++ b/test/sys/kernel/slab/fat_cache/alloc_calls @@ -1 +1 @@ - 14 fat_cache_add+0x11f/0x1c0 age=37390/37407/37435 pid=2818 cpus=0-1 + 14 fat_cache_add+0x11f/0x1c0 age=61297/61310/61330 pid=13349 cpus=0 diff --git a/test/sys/kernel/slab/fat_cache/free_calls b/test/sys/kernel/slab/fat_cache/free_calls index 95ba3634ba..77d925edb2 100644 --- a/test/sys/kernel/slab/fat_cache/free_calls +++ b/test/sys/kernel/slab/fat_cache/free_calls @@ -1 +1 @@ - 14 age=4294787992 pid=0 cpus=0 + 14 age=4303047585 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fat_cache/objects b/test/sys/kernel/slab/fat_cache/objects index 8e14edce9c..a2720097dc 100644 --- a/test/sys/kernel/slab/fat_cache/objects +++ b/test/sys/kernel/slab/fat_cache/objects @@ -1 +1 @@ -78 +39 diff --git a/test/sys/kernel/slab/fat_cache/slabs b/test/sys/kernel/slab/fat_cache/slabs index 0cfbf08886..d00491fd7e 100644 --- a/test/sys/kernel/slab/fat_cache/slabs +++ b/test/sys/kernel/slab/fat_cache/slabs @@ -1 +1 @@ -2 +1 diff --git a/test/sys/kernel/slab/fat_cache/total_objects b/test/sys/kernel/slab/fat_cache/total_objects index 8e14edce9c..a2720097dc 100644 --- a/test/sys/kernel/slab/fat_cache/total_objects +++ b/test/sys/kernel/slab/fat_cache/total_objects @@ -1 +1 @@ -78 +39 diff --git a/test/sys/kernel/slab/fat_inode_cache/alloc_calls b/test/sys/kernel/slab/fat_inode_cache/alloc_calls index 60c698416f..08bb30ff41 100644 --- a/test/sys/kernel/slab/fat_inode_cache/alloc_calls +++ b/test/sys/kernel/slab/fat_inode_cache/alloc_calls @@ -1 +1 @@ - 76 fat_alloc_inode+0x15/0x30 age=37336/37386/38290 pid=2817-2820 cpus=0-1 + 76 fat_alloc_inode+0x15/0x30 age=61228/61276/61657 pid=13348-13354 cpus=0-1 diff --git a/test/sys/kernel/slab/fat_inode_cache/free_calls b/test/sys/kernel/slab/fat_inode_cache/free_calls index f39bf09bb3..0834595c6d 100644 --- a/test/sys/kernel/slab/fat_inode_cache/free_calls +++ b/test/sys/kernel/slab/fat_inode_cache/free_calls @@ -1 +1 @@ - 76 age=4294787996 pid=0 cpus=0 + 76 age=4303047594 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fib6_nodes/alloc_calls b/test/sys/kernel/slab/fib6_nodes/alloc_calls index 6665fa2671..1755dde1eb 100644 --- a/test/sys/kernel/slab/fib6_nodes/alloc_calls +++ b/test/sys/kernel/slab/fib6_nodes/alloc_calls @@ -1,3 +1,3 @@ - 3 fib6_add+0x112/0x6a0 [ipv6] age=69122/80098/100888 pid=8-2080 cpus=0-1 - 1 fib6_add+0x2a2/0x6a0 [ipv6] age=70286 pid=8 cpus=1 - 1 fib6_add+0x2b6/0x6a0 [ipv6] age=70286 pid=8 cpus=1 + 3 fib6_add+0x112/0x6a0 [ipv6] age=8328809/8339785/8360575 pid=8-2080 cpus=0-1 + 1 fib6_add+0x2a2/0x6a0 [ipv6] age=8329973 pid=8 cpus=1 + 1 fib6_add+0x2b6/0x6a0 [ipv6] age=8329973 pid=8 cpus=1 diff --git a/test/sys/kernel/slab/fib6_nodes/free_calls b/test/sys/kernel/slab/fib6_nodes/free_calls index ce124b48d3..47334a2e52 100644 --- a/test/sys/kernel/slab/fib6_nodes/free_calls +++ b/test/sys/kernel/slab/fib6_nodes/free_calls @@ -1 +1 @@ - 5 age=4294788112 pid=0 cpus=0 + 5 age=4303047799 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fib6_nodes/objects b/test/sys/kernel/slab/fib6_nodes/objects index 900731ffd5..7ed6ff82de 100644 --- a/test/sys/kernel/slab/fib6_nodes/objects +++ b/test/sys/kernel/slab/fib6_nodes/objects @@ -1 +1 @@ -64 +5 diff --git a/test/sys/kernel/slab/fib6_nodes/objects_partial b/test/sys/kernel/slab/fib6_nodes/objects_partial index 573541ac97..7ed6ff82de 100644 --- a/test/sys/kernel/slab/fib6_nodes/objects_partial +++ b/test/sys/kernel/slab/fib6_nodes/objects_partial @@ -1 +1 @@ -0 +5 diff --git a/test/sys/kernel/slab/fib6_nodes/partial b/test/sys/kernel/slab/fib6_nodes/partial index 573541ac97..0cfbf08886 100644 --- a/test/sys/kernel/slab/fib6_nodes/partial +++ b/test/sys/kernel/slab/fib6_nodes/partial @@ -1 +1 @@ -0 +2 diff --git a/test/sys/kernel/slab/file_lock_cache/alloc_calls b/test/sys/kernel/slab/file_lock_cache/alloc_calls index 787e2a8a99..2c475b2731 100644 --- a/test/sys/kernel/slab/file_lock_cache/alloc_calls +++ b/test/sys/kernel/slab/file_lock_cache/alloc_calls @@ -1,2 +1,2 @@ - 3 flock_lock_file_wait+0x2d6/0x2f0 age=15289/69387/97148 pid=1690-2851 cpus=0-1 - 1 __posix_lock_file+0x3f/0x560 age=90270 pid=2262 cpus=0 + 2 flock_lock_file_wait+0x2d6/0x2f0 age=8355055/8355767/8356479 pid=1690-1807 cpus=0 + 1 __posix_lock_file+0x3f/0x560 age=8349601 pid=2262 cpus=0 diff --git a/test/sys/kernel/slab/file_lock_cache/free_calls b/test/sys/kernel/slab/file_lock_cache/free_calls index 7b6f2a5efe..af3a86af86 100644 --- a/test/sys/kernel/slab/file_lock_cache/free_calls +++ b/test/sys/kernel/slab/file_lock_cache/free_calls @@ -1 +1 @@ - 4 locks_free_lock+0x3e/0x60 age=15289/75889/100500 pid=1549-2851 cpus=0-1 + 3 locks_free_lock+0x3e/0x60 age=8351291/8355422/8359832 pid=1549-2189 cpus=0 diff --git a/test/sys/kernel/slab/files_cache/alloc_calls b/test/sys/kernel/slab/files_cache/alloc_calls index 8da996c4fd..91a3b86393 100644 --- a/test/sys/kernel/slab/files_cache/alloc_calls +++ b/test/sys/kernel/slab/files_cache/alloc_calls @@ -1 +1 @@ - 79 dup_fd+0x2e/0x420 age=3745/87832/120449 pid=0-2850 cpus=0-1 + 80 dup_fd+0x2e/0x420 age=4136/7769280/8379905 pid=0-12336 cpus=0-1 diff --git a/test/sys/kernel/slab/files_cache/free_calls b/test/sys/kernel/slab/files_cache/free_calls index b75ef82fce..67591246a6 100644 --- a/test/sys/kernel/slab/files_cache/free_calls +++ b/test/sys/kernel/slab/files_cache/free_calls @@ -1,3 +1,3 @@ - 9 age=4294787794 pid=0 cpus=0 - 30 put_files_struct+0xb4/0xe0 age=4740/84854/107543 pid=1258-2886 cpus=0-1 - 40 free_fdtable_rcu+0xa0/0xb0 age=38300/92095/116687 pid=0-2584 cpus=0-1 + 9 age=4303047250 pid=0 cpus=0 + 31 put_files_struct+0xb4/0xe0 age=7177/7367129/8366999 pid=1202-20292 cpus=0-1 + 40 free_fdtable_rcu+0xa0/0xb0 age=61634/7953135/8376143 pid=0-12335 cpus=0-1 diff --git a/test/sys/kernel/slab/files_cache/objects b/test/sys/kernel/slab/files_cache/objects index b16e5f75e3..398050c62c 100644 --- a/test/sys/kernel/slab/files_cache/objects +++ b/test/sys/kernel/slab/files_cache/objects @@ -1 +1 @@ -104 +101 diff --git a/test/sys/kernel/slab/files_cache/objects_partial b/test/sys/kernel/slab/files_cache/objects_partial index f5c89552bd..f04c001f3f 100644 --- a/test/sys/kernel/slab/files_cache/objects_partial +++ b/test/sys/kernel/slab/files_cache/objects_partial @@ -1 +1 @@ -32 +29 diff --git a/test/sys/kernel/slab/filp/alloc_calls b/test/sys/kernel/slab/filp/alloc_calls index 11e73b8665..859cdd53d4 100644 --- a/test/sys/kernel/slab/filp/alloc_calls +++ b/test/sys/kernel/slab/filp/alloc_calls @@ -1 +1 @@ - 4088 get_empty_filp+0x44/0x1a0 age=0/79776/118687 pid=1-2890 cpus=0-1 + 4081 get_empty_filp+0x44/0x1a0 age=0/7917861/8378089 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/filp/free_calls b/test/sys/kernel/slab/filp/free_calls index abbe2671c9..c9d339b7be 100644 --- a/test/sys/kernel/slab/filp/free_calls +++ b/test/sys/kernel/slab/filp/free_calls @@ -1,2 +1,2 @@ - 879 age=4294787759 pid=0 cpus=0 - 3211 file_free_rcu+0x16/0x20 age=3/79862/117622 pid=0-2890 cpus=0-1 + 866 age=4303047162 pid=0 cpus=0 + 3217 file_free_rcu+0x16/0x20 age=10/7799670/8377025 pid=0-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/filp/objects b/test/sys/kernel/slab/filp/objects index 0c2cf3996c..8fd7a82447 100644 --- a/test/sys/kernel/slab/filp/objects +++ b/test/sys/kernel/slab/filp/objects @@ -1 +1 @@ -4082 +4064 diff --git a/test/sys/kernel/slab/filp/objects_partial b/test/sys/kernel/slab/filp/objects_partial index 573541ac97..d4d7ff298a 100644 --- a/test/sys/kernel/slab/filp/objects_partial +++ b/test/sys/kernel/slab/filp/objects_partial @@ -1 +1 @@ -0 +685 diff --git a/test/sys/kernel/slab/filp/partial b/test/sys/kernel/slab/filp/partial index ec635144f6..bb95160cb6 100644 --- a/test/sys/kernel/slab/filp/partial +++ b/test/sys/kernel/slab/filp/partial @@ -1 +1 @@ -9 +33 diff --git a/test/sys/kernel/slab/filp/slabs b/test/sys/kernel/slab/filp/slabs index 6bb2f98fb0..ca55a6c593 100644 --- a/test/sys/kernel/slab/filp/slabs +++ b/test/sys/kernel/slab/filp/slabs @@ -1 +1 @@ -195 +198 diff --git a/test/sys/kernel/slab/filp/total_objects b/test/sys/kernel/slab/filp/total_objects index 50b0f79069..50576ba176 100644 --- a/test/sys/kernel/slab/filp/total_objects +++ b/test/sys/kernel/slab/filp/total_objects @@ -1 +1 @@ -4095 +4158 diff --git a/test/sys/kernel/slab/fs_cache/alloc_calls b/test/sys/kernel/slab/fs_cache/alloc_calls index 9979546e79..b649a58a81 100644 --- a/test/sys/kernel/slab/fs_cache/alloc_calls +++ b/test/sys/kernel/slab/fs_cache/alloc_calls @@ -1 +1 @@ - 78 __copy_fs_struct+0x28/0xc0 age=3741/87410/120433 pid=1-2850 cpus=0-1 + 79 __copy_fs_struct+0x28/0xc0 age=4126/7761540/8379883 pid=1-12336 cpus=0-1 diff --git a/test/sys/kernel/slab/fs_cache/free_calls b/test/sys/kernel/slab/fs_cache/free_calls index c6ec051c58..012510564c 100644 --- a/test/sys/kernel/slab/fs_cache/free_calls +++ b/test/sys/kernel/slab/fs_cache/free_calls @@ -1,2 +1,2 @@ - 7 age=4294787790 pid=0 cpus=0 - 71 put_fs_struct+0x37/0x40 age=4736/89295/115882 pid=145-2886 cpus=0-1 + 7 age=4303047241 pid=0 cpus=0 + 72 put_fs_struct+0x37/0x40 age=7168/7706405/8375333 pid=145-20292 cpus=0-1 diff --git a/test/sys/kernel/slab/fs_cache/objects b/test/sys/kernel/slab/fs_cache/objects index a9c8fe8292..5bc6609e3d 100644 --- a/test/sys/kernel/slab/fs_cache/objects +++ b/test/sys/kernel/slab/fs_cache/objects @@ -1 +1 @@ -103 +117 diff --git a/test/sys/kernel/slab/fs_cache/objects_partial b/test/sys/kernel/slab/fs_cache/objects_partial index 425151f3a4..78eb67cee1 100644 --- a/test/sys/kernel/slab/fs_cache/objects_partial +++ b/test/sys/kernel/slab/fs_cache/objects_partial @@ -1 +1 @@ -40 +75 diff --git a/test/sys/kernel/slab/fs_cache/partial b/test/sys/kernel/slab/fs_cache/partial index 0cfbf08886..b8626c4cff 100644 --- a/test/sys/kernel/slab/fs_cache/partial +++ b/test/sys/kernel/slab/fs_cache/partial @@ -1 +1 @@ -2 +4 diff --git a/test/sys/kernel/slab/fs_cache/slabs b/test/sys/kernel/slab/fs_cache/slabs index 7ed6ff82de..1e8b314962 100644 --- a/test/sys/kernel/slab/fs_cache/slabs +++ b/test/sys/kernel/slab/fs_cache/slabs @@ -1 +1 @@ -5 +6 diff --git a/test/sys/kernel/slab/fs_cache/total_objects b/test/sys/kernel/slab/fs_cache/total_objects index f96ac06721..0a3e7b0422 100644 --- a/test/sys/kernel/slab/fs_cache/total_objects +++ b/test/sys/kernel/slab/fs_cache/total_objects @@ -1 +1 @@ -105 +126 diff --git a/test/sys/kernel/slab/fuse_inode/alloc_calls b/test/sys/kernel/slab/fuse_inode/alloc_calls index b1aeceecc4..936ae91006 100644 --- a/test/sys/kernel/slab/fuse_inode/alloc_calls +++ b/test/sys/kernel/slab/fuse_inode/alloc_calls @@ -1 +1 @@ - 1 fuse_alloc_inode+0x1a/0xe0 [fuse] age=76451 pid=2476 cpus=0 + 1 fuse_alloc_inode+0x1a/0xe0 [fuse] age=8336111 pid=2476 cpus=0 diff --git a/test/sys/kernel/slab/fuse_inode/free_calls b/test/sys/kernel/slab/fuse_inode/free_calls index 261790e975..0d21fe5f97 100644 --- a/test/sys/kernel/slab/fuse_inode/free_calls +++ b/test/sys/kernel/slab/fuse_inode/free_calls @@ -1 +1 @@ - 1 age=4294788049 pid=0 cpus=0 + 1 age=4303047710 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fuse_inode/objects b/test/sys/kernel/slab/fuse_inode/objects index 48082f72f0..d00491fd7e 100644 --- a/test/sys/kernel/slab/fuse_inode/objects +++ b/test/sys/kernel/slab/fuse_inode/objects @@ -1 +1 @@ -12 +1 diff --git a/test/sys/kernel/slab/fuse_inode/objects_partial b/test/sys/kernel/slab/fuse_inode/objects_partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/fuse_inode/objects_partial +++ b/test/sys/kernel/slab/fuse_inode/objects_partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/fuse_inode/partial b/test/sys/kernel/slab/fuse_inode/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/fuse_inode/partial +++ b/test/sys/kernel/slab/fuse_inode/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/fuse_request/alloc_calls b/test/sys/kernel/slab/fuse_request/alloc_calls index 83c53d796d..59a0bc24ac 100644 --- a/test/sys/kernel/slab/fuse_request/alloc_calls +++ b/test/sys/kernel/slab/fuse_request/alloc_calls @@ -1 +1 @@ - 1 fuse_request_alloc+0x1a/0x40 [fuse] age=76455 pid=2476 cpus=0 + 1 fuse_request_alloc+0x1a/0x40 [fuse] age=8336120 pid=2476 cpus=0 diff --git a/test/sys/kernel/slab/fuse_request/free_calls b/test/sys/kernel/slab/fuse_request/free_calls index 45a24e1524..be2917d224 100644 --- a/test/sys/kernel/slab/fuse_request/free_calls +++ b/test/sys/kernel/slab/fuse_request/free_calls @@ -1 +1 @@ - 1 age=4294788053 pid=0 cpus=0 + 1 age=4303047718 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/idr_layer_cache/alloc_calls b/test/sys/kernel/slab/idr_layer_cache/alloc_calls index 35df60d608..51a21d5acb 100644 --- a/test/sys/kernel/slab/idr_layer_cache/alloc_calls +++ b/test/sys/kernel/slab/idr_layer_cache/alloc_calls @@ -1 +1 @@ - 432 idr_pre_get+0x5d/0x80 age=15211/96145/120531 pid=0-2851 cpus=0-1 + 406 idr_pre_get+0x5d/0x80 age=60336/8278969/8380018 pid=0-13355 cpus=0-1 diff --git a/test/sys/kernel/slab/idr_layer_cache/free_calls b/test/sys/kernel/slab/idr_layer_cache/free_calls index 17f1cfcc39..ce484d2593 100644 --- a/test/sys/kernel/slab/idr_layer_cache/free_calls +++ b/test/sys/kernel/slab/idr_layer_cache/free_calls @@ -1,5 +1,4 @@ - 316 age=4294787827 pid=0 cpus=0 - 11 idr_destroy+0x2f/0x40 age=56002/56002/56002 pid=2406 cpus=1 - 5 idr_layer_rcu_free+0x17/0x20 age=55996/93526/117680 pid=0-1155 cpus=0-1 - 97 ida_get_new_above+0x141/0x210 age=38489/111897/120531 pid=0-2761 cpus=0-1 - 3 idr_remove+0x187/0x200 age=34268/47337/70659 pid=1738-2821 cpus=0-1 + 304 age=4303047315 pid=0 cpus=0 + 3 idr_destroy+0x2f/0x40 age=104486/3178486/4715486 pid=13211-13803 cpus=0-1 + 4 idr_layer_rcu_free+0x17/0x20 age=8334501/8362397/8377168 pid=0-1155 cpus=0-1 + 95 ida_get_new_above+0x141/0x210 age=812584/8292482/8380019 pid=0-2593 cpus=0-1 diff --git a/test/sys/kernel/slab/idr_layer_cache/objects b/test/sys/kernel/slab/idr_layer_cache/objects index 18e1dd6bc4..816d01be5c 100644 --- a/test/sys/kernel/slab/idr_layer_cache/objects +++ b/test/sys/kernel/slab/idr_layer_cache/objects @@ -1 +1 @@ -442 +420 diff --git a/test/sys/kernel/slab/idr_layer_cache/objects_partial b/test/sys/kernel/slab/idr_layer_cache/objects_partial index 573541ac97..dde92ddc1a 100644 --- a/test/sys/kernel/slab/idr_layer_cache/objects_partial +++ b/test/sys/kernel/slab/idr_layer_cache/objects_partial @@ -1 +1 @@ -0 +82 diff --git a/test/sys/kernel/slab/idr_layer_cache/partial b/test/sys/kernel/slab/idr_layer_cache/partial index 573541ac97..45a4fb75db 100644 --- a/test/sys/kernel/slab/idr_layer_cache/partial +++ b/test/sys/kernel/slab/idr_layer_cache/partial @@ -1 +1 @@ -0 +8 diff --git a/test/sys/kernel/slab/inet_peer_cache/alloc_calls b/test/sys/kernel/slab/inet_peer_cache/alloc_calls index 5748ad29ae..923bedcfa7 100644 --- a/test/sys/kernel/slab/inet_peer_cache/alloc_calls +++ b/test/sys/kernel/slab/inet_peer_cache/alloc_calls @@ -1 +1 @@ - 1 inet_getpeer+0xc6/0x210 age=73923 pid=2080 cpus=0 +No data diff --git a/test/sys/kernel/slab/inet_peer_cache/free_calls b/test/sys/kernel/slab/inet_peer_cache/free_calls index e18757dfda..923bedcfa7 100644 --- a/test/sys/kernel/slab/inet_peer_cache/free_calls +++ b/test/sys/kernel/slab/inet_peer_cache/free_calls @@ -1 +1 @@ - 1 age=4294787453 pid=0 cpus=0 +No data diff --git a/test/sys/kernel/slab/inet_peer_cache/objects b/test/sys/kernel/slab/inet_peer_cache/objects index aabe6ec390..573541ac97 100644 --- a/test/sys/kernel/slab/inet_peer_cache/objects +++ b/test/sys/kernel/slab/inet_peer_cache/objects @@ -1 +1 @@ -21 +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/slabs b/test/sys/kernel/slab/inet_peer_cache/slabs index d00491fd7e..573541ac97 100644 --- a/test/sys/kernel/slab/inet_peer_cache/slabs +++ b/test/sys/kernel/slab/inet_peer_cache/slabs @@ -1 +1 @@ -1 +0 diff --git a/test/sys/kernel/slab/inet_peer_cache/total_objects b/test/sys/kernel/slab/inet_peer_cache/total_objects index aabe6ec390..573541ac97 100644 --- a/test/sys/kernel/slab/inet_peer_cache/total_objects +++ b/test/sys/kernel/slab/inet_peer_cache/total_objects @@ -1 +1 @@ -21 +0 diff --git a/test/sys/kernel/slab/inode_cache/alloc_calls b/test/sys/kernel/slab/inode_cache/alloc_calls index d985362431..fe8e5cf82f 100644 --- a/test/sys/kernel/slab/inode_cache/alloc_calls +++ b/test/sys/kernel/slab/inode_cache/alloc_calls @@ -1 +1 @@ - 8256 alloc_inode+0x251/0x280 age=0/37926/120431 pid=0-2890 cpus=0-1 + 11655 alloc_inode+0x251/0x280 age=665/7686826/8379810 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/inode_cache/free_calls b/test/sys/kernel/slab/inode_cache/free_calls index bf0243bed2..dc7e11783d 100644 --- a/test/sys/kernel/slab/inode_cache/free_calls +++ b/test/sys/kernel/slab/inode_cache/free_calls @@ -1,2 +1,2 @@ - 7965 age=4294787729 pid=0 cpus=0 - 292 destroy_inode+0x4f/0x60 age=3679/89855/118054 pid=8-2890 cpus=0-1 + 11113 age=4303047110 pid=0 cpus=0 + 542 destroy_inode+0x4f/0x60 age=1016/6891707/8377435 pid=7-15896 cpus=0-1 diff --git a/test/sys/kernel/slab/inode_cache/objects b/test/sys/kernel/slab/inode_cache/objects index d1a359890a..24d09039ee 100644 --- a/test/sys/kernel/slab/inode_cache/objects +++ b/test/sys/kernel/slab/inode_cache/objects @@ -1 +1 @@ -8260 +11676 diff --git a/test/sys/kernel/slab/inode_cache/slabs b/test/sys/kernel/slab/inode_cache/slabs index 9706647749..6006f5cafc 100644 --- a/test/sys/kernel/slab/inode_cache/slabs +++ b/test/sys/kernel/slab/inode_cache/slabs @@ -1 +1 @@ -590 +834 diff --git a/test/sys/kernel/slab/inode_cache/total_objects b/test/sys/kernel/slab/inode_cache/total_objects index d1a359890a..24d09039ee 100644 --- a/test/sys/kernel/slab/inode_cache/total_objects +++ b/test/sys/kernel/slab/inode_cache/total_objects @@ -1 +1 @@ -8260 +11676 diff --git a/test/sys/kernel/slab/inotify_watch_cache/alloc_calls b/test/sys/kernel/slab/inotify_watch_cache/alloc_calls index e99148ee3c..7ede8c24a9 100644 --- a/test/sys/kernel/slab/inotify_watch_cache/alloc_calls +++ b/test/sys/kernel/slab/inotify_watch_cache/alloc_calls @@ -1 +1 @@ - 130 sys_inotify_add_watch+0x15e/0x1d0 age=15313/96318/117218 pid=72-2851 cpus=0-1 + 126 sys_inotify_add_watch+0x15e/0x1d0 age=60497/8227702/8376765 pid=72-13355 cpus=0-1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/free_calls b/test/sys/kernel/slab/inotify_watch_cache/free_calls index 1310fb3766..cafeb9a57e 100644 --- a/test/sys/kernel/slab/inotify_watch_cache/free_calls +++ b/test/sys/kernel/slab/inotify_watch_cache/free_calls @@ -1,2 +1,2 @@ - 124 age=4294787929 pid=0 cpus=0 - 6 free_inotify_user_watch+0x60/0x70 age=34362/48918/75284 pid=2374-2821 cpus=0-1 + 122 age=4303047477 pid=0 cpus=0 + 4 free_inotify_user_watch+0x60/0x70 age=104648/4219698/8334832 pid=2423-13211 cpus=0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/alloc_calls b/test/sys/kernel/slab/ip6_dst_cache/alloc_calls index 09eb6d1fc4..f13f9f6e66 100644 --- a/test/sys/kernel/slab/ip6_dst_cache/alloc_calls +++ b/test/sys/kernel/slab/ip6_dst_cache/alloc_calls @@ -1 +1 @@ - 4 dst_alloc+0x2b/0x90 age=70282/77932/100884 pid=8-1549 cpus=0-1 + 4 dst_alloc+0x2b/0x90 age=8329964/8337614/8360566 pid=8-1549 cpus=0-1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/free_calls b/test/sys/kernel/slab/ip6_dst_cache/free_calls index c5718c6db5..0ea6a09c6c 100644 --- a/test/sys/kernel/slab/ip6_dst_cache/free_calls +++ b/test/sys/kernel/slab/ip6_dst_cache/free_calls @@ -1 +1 @@ - 4 age=4294788108 pid=0 cpus=0 + 4 age=4303047790 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/objects b/test/sys/kernel/slab/ip6_dst_cache/objects index d81cc0710e..b8626c4cff 100644 --- a/test/sys/kernel/slab/ip6_dst_cache/objects +++ b/test/sys/kernel/slab/ip6_dst_cache/objects @@ -1 +1 @@ -42 +4 diff --git a/test/sys/kernel/slab/ip6_dst_cache/objects_partial b/test/sys/kernel/slab/ip6_dst_cache/objects_partial index 573541ac97..b8626c4cff 100644 --- a/test/sys/kernel/slab/ip6_dst_cache/objects_partial +++ b/test/sys/kernel/slab/ip6_dst_cache/objects_partial @@ -1 +1 @@ -0 +4 diff --git a/test/sys/kernel/slab/ip6_dst_cache/partial b/test/sys/kernel/slab/ip6_dst_cache/partial index 573541ac97..0cfbf08886 100644 --- a/test/sys/kernel/slab/ip6_dst_cache/partial +++ b/test/sys/kernel/slab/ip6_dst_cache/partial @@ -1 +1 @@ -0 +2 diff --git a/test/sys/kernel/slab/ip_dst_cache/alloc_calls b/test/sys/kernel/slab/ip_dst_cache/alloc_calls index e53d4d1c3d..d37535401b 100644 --- a/test/sys/kernel/slab/ip_dst_cache/alloc_calls +++ b/test/sys/kernel/slab/ip_dst_cache/alloc_calls @@ -1 +1 @@ - 13 dst_alloc+0x2b/0x90 age=14168/47270/65602 pid=0-2881 cpus=0-1 + 1 dst_alloc+0x2b/0x90 age=920684 pid=1206 cpus=0 diff --git a/test/sys/kernel/slab/ip_dst_cache/free_calls b/test/sys/kernel/slab/ip_dst_cache/free_calls index 76dbcf0ebf..4b1391bc98 100644 --- a/test/sys/kernel/slab/ip_dst_cache/free_calls +++ b/test/sys/kernel/slab/ip_dst_cache/free_calls @@ -1,2 +1 @@ - 8 age=4294787484 pid=0 cpus=0 - 5 dst_destroy+0x73/0x110 age=65601/68844/69656 pid=0 cpus=1 + 1 age=4303046733 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ip_fib_hash/alloc_calls b/test/sys/kernel/slab/ip_fib_hash/alloc_calls index 52c20147bb..07e86d0cb2 100644 --- a/test/sys/kernel/slab/ip_fib_hash/alloc_calls +++ b/test/sys/kernel/slab/ip_fib_hash/alloc_calls @@ -1 +1 @@ - 11 fn_hash_insert+0x5a6/0x800 age=64575/88591/107942 pid=1197-1541 cpus=0-1 + 11 fn_hash_insert+0x5a6/0x800 age=8323831/8347847/8367198 pid=1197-1541 cpus=0-1 diff --git a/test/sys/kernel/slab/ip_fib_hash/free_calls b/test/sys/kernel/slab/ip_fib_hash/free_calls index 451205ccc3..1aa45c86ad 100644 --- a/test/sys/kernel/slab/ip_fib_hash/free_calls +++ b/test/sys/kernel/slab/ip_fib_hash/free_calls @@ -1,2 +1,2 @@ - 7 age=4294787468 pid=0 cpus=0 - 4 fn_hash_delete+0x22c/0x290 age=107945/107945/107945 pid=1195 cpus=1 + 7 age=4303046724 pid=0 cpus=0 + 4 fn_hash_delete+0x22c/0x290 age=8367201/8367201/8367201 pid=1195 cpus=1 diff --git a/test/sys/kernel/slab/ip_fib_hash/objects b/test/sys/kernel/slab/ip_fib_hash/objects index f6b91e0e1f..b4de394767 100644 --- a/test/sys/kernel/slab/ip_fib_hash/objects +++ b/test/sys/kernel/slab/ip_fib_hash/objects @@ -1 +1 @@ -56 +11 diff --git a/test/sys/kernel/slab/ip_fib_hash/objects_partial b/test/sys/kernel/slab/ip_fib_hash/objects_partial index 573541ac97..b4de394767 100644 --- a/test/sys/kernel/slab/ip_fib_hash/objects_partial +++ b/test/sys/kernel/slab/ip_fib_hash/objects_partial @@ -1 +1 @@ -0 +11 diff --git a/test/sys/kernel/slab/ip_fib_hash/partial b/test/sys/kernel/slab/ip_fib_hash/partial index 573541ac97..0cfbf08886 100644 --- a/test/sys/kernel/slab/ip_fib_hash/partial +++ b/test/sys/kernel/slab/ip_fib_hash/partial @@ -1 +1 @@ -0 +2 diff --git a/test/sys/kernel/slab/journal_head/alloc_calls b/test/sys/kernel/slab/journal_head/alloc_calls index fa5e243906..5edba871ae 100644 --- a/test/sys/kernel/slab/journal_head/alloc_calls +++ b/test/sys/kernel/slab/journal_head/alloc_calls @@ -1 +1 @@ - 7780 journal_add_journal_head+0x9f/0x1b0 age=1/1624/112408 pid=878-2890 cpus=0-1 + 7662 journal_add_journal_head+0x9f/0x1b0 age=0/2379/651354 pid=1336-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/journal_head/free_calls b/test/sys/kernel/slab/journal_head/free_calls index ca9861a037..109d7bd49e 100644 --- a/test/sys/kernel/slab/journal_head/free_calls +++ b/test/sys/kernel/slab/journal_head/free_calls @@ -1,2 +1,2 @@ - 7679 age=4294787975 pid=0 cpus=0 - 102 __journal_remove_journal_head+0xcb/0x160 age=669/27324/77100 pid=32-2881 cpus=0-1 + 7589 age=4303047557 pid=0 cpus=0 + 74 __journal_remove_journal_head+0xcb/0x160 age=1585/52253/654521 pid=32-13248 cpus=0-1 diff --git a/test/sys/kernel/slab/journal_head/objects b/test/sys/kernel/slab/journal_head/objects index 70e17279ef..28e2fde279 100644 --- a/test/sys/kernel/slab/journal_head/objects +++ b/test/sys/kernel/slab/journal_head/objects @@ -1 +1 @@ -7800 +7680 diff --git a/test/sys/kernel/slab/journal_head/slabs b/test/sys/kernel/slab/journal_head/slabs index 6ac793b42c..18eed1357e 100644 --- a/test/sys/kernel/slab/journal_head/slabs +++ b/test/sys/kernel/slab/journal_head/slabs @@ -1 +1 @@ -325 +320 diff --git a/test/sys/kernel/slab/journal_head/total_objects b/test/sys/kernel/slab/journal_head/total_objects index 70e17279ef..28e2fde279 100644 --- a/test/sys/kernel/slab/journal_head/total_objects +++ b/test/sys/kernel/slab/journal_head/total_objects @@ -1 +1 @@ -7800 +7680 diff --git a/test/sys/kernel/slab/kmalloc-1024/alloc_calls b/test/sys/kernel/slab/kmalloc-1024/alloc_calls index 862cfe5772..90a6c7793d 100644 --- a/test/sys/kernel/slab/kmalloc-1024/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-1024/alloc_calls @@ -1,51 +1,51 @@ - 23 __register_sysctl_paths+0x56/0x340 age=100613/109478/120266 pid=1-1549 cpus=0-1 - 5 param_sysfs_setup+0x87/0x140 age=96047/112423/120406 pid=1-1805 cpus=0-1 - 5 load_module+0x18d5/0x1b30 age=68904/105783/116261 pid=208-2578 cpus=0 - 2 __vmalloc_area_node+0xfb/0x140 age=100667/107844/115021 pid=107-1549 cpus=0 - 4 __percpu_alloc_mask+0xbc/0x140 age=120257/120257/120257 pid=1 cpus=0 - 114 alloc_pipe_info+0x25/0x60 age=15551/82744/117562 pid=1-2851 cpus=0-1 - 2 alloc_fdtable+0x81/0x160 age=97286/97286/97287 pid=1690 cpus=0 - 1 mb_cache_create+0xb6/0x1f0 age=120247 pid=1 cpus=1 - 1 mb_cache_create+0x11e/0x1f0 age=120247 pid=1 cpus=1 - 8 add_partition+0x45/0x250 age=38488/109550/119703 pid=1-2761 cpus=0 - 2 __crypto_alloc_tfm+0x43/0x1b0 age=68903/68903/68903 pid=1545 cpus=0 - 1 pci_create_bus+0x82/0x240 age=120328 pid=1 cpus=0 - 14 pcie_port_device_register+0x254/0x4a0 age=120243/120243/120245 pid=1 cpus=1 - 1 acpi_ev_create_gpe_block+0x10b/0x3bf age=120400 pid=1 cpus=0 - 1 acpi_tb_resize_root_table_list+0x66/0xdb age=116228 pid=330 cpus=0 - 1 tty_buffer_request_room+0x136/0x190 age=71250 pid=2262 cpus=0 - 1 tty_register_driver+0x1b3/0x2a0 age=49578 pid=2711 cpus=1 - 10 tty_write+0x160/0x280 age=62772/90642/118156 pid=34-2612 cpus=0-1 - 2 set_inverse_trans_unicode+0xce/0xf0 age=95511/107876/120242 pid=1-1898 cpus=1 - 1 uart_register_driver+0x31/0x1c0 age=120207 pid=1 cpus=1 - 166 device_create_vargs+0x8c/0x100 age=38482/112879/120408 pid=1-2761 cpus=0-1 - 8 platform_device_alloc+0x37/0x90 age=107669/117282/120408 pid=1-1285 cpus=0-1 - 3 scsi_alloc_target+0x63/0x2e0 age=38506/92606/119822 pid=1-2761 cpus=0-1 - 2 sd_probe+0x86/0x430 age=38501/79159/119818 pid=1-2761 cpus=0-1 - 1 ahci_port_start+0x34/0xe0 age=120205 pid=1 cpus=1 - 1 psmouse_connect+0x5b/0x2c0 age=119395 pid=17 cpus=1 - 2 thermal_cooling_device_register+0x7f/0x290 age=116140/116164/116189 pid=330 cpus=0-1 - 1 hid_add_field+0xcc/0x3a0 age=112759 pid=803 cpus=0 - 4 sock_alloc_send_skb+0x1cd/0x200 age=85272/89763/91423 pid=1738 cpus=0-1 - 3 __rtnl_register+0x79/0x90 age=100616/113763/120409 pid=1-1549 cpus=0 - 6 qdisc_alloc+0x34/0xd0 age=96540/96576/96754 pid=1541 cpus=0 - 1 dmi_id_init+0x2a4/0x30c age=120407 pid=1 cpus=0 - 5 hub_probe+0xdd/0x820 [usbcore] age=114496/114989/115342 pid=143-147 cpus=0-1 - 5 usb_create_hcd+0x39/0x150 [usbcore] age=114568/115023/115389 pid=143-147 cpus=0 - 26 usb_set_configuration+0x441/0x5f0 [usbcore] age=43635/76676/115354 pid=143-419 cpus=0-1 - 10 usb_get_configuration+0x92/0x1480 [usbcore] age=43637/100791/115362 pid=143-419 cpus=0-1 - 34 usb_create_ep_files+0x51/0x350 [usbcore] age=43632/94424/115229 pid=143-419 cpus=0-1 - 1 acpi_battery_add+0x29/0x1d3 [battery] age=116127 pid=396 cpus=0 - 1 snd_card_new+0x38/0x370 [snd] age=114633 pid=107 cpus=0 - 1 sta_info_alloc+0x3c/0x1d0 [mac80211] age=70020 pid=742 cpus=0 - 2 snd_pcm_new+0x47/0x130 [snd_pcm] age=114606/114606/114606 pid=107 cpus=1 - 1 rs_alloc_sta+0x25/0x120 [iwl3945] age=70020 pid=742 cpus=0 - 1 get_alloc_hash+0x9b/0x140 [snd_hda_intel] age=113605 pid=786 cpus=0 - 1 azx_probe+0xb3/0xc20 [snd_hda_intel] age=114626 pid=107 cpus=0 - 1 azx_probe+0x4a9/0xc20 [snd_hda_intel] age=114619 pid=107 cpus=0 - 1 snd_hda_codec_new+0x3e/0x559 [snd_hda_intel] age=114609 pid=107 cpus=1 - 1 md_probe+0xa1/0x360 [md_mod] age=110680 pid=916 cpus=0 - 8 loop_alloc+0x28/0x140 [loop] age=110136/110136/110136 pid=951 cpus=0 - 4 ipv6_add_dev+0x69/0x330 [ipv6] age=100613/100614/100616 pid=1549 cpus=0 - 1 ipv6_route_sysctl_init+0x22/0xb0 [ipv6] age=100612 pid=1549 cpus=0 - 2 snd_seq_create_port+0x35/0x180 [snd_seq] age=96046/96046/96046 pid=1805 cpus=0 + 23 __register_sysctl_paths+0x56/0x340 age=8360116/8368981/8379769 pid=1-1549 cpus=0-1 + 5 param_sysfs_setup+0x87/0x140 age=8355550/8371926/8379909 pid=1-1805 cpus=0-1 + 5 load_module+0x18d5/0x1b30 age=8328407/8365286/8375764 pid=208-2578 cpus=0 + 2 __vmalloc_area_node+0xfb/0x140 age=8360170/8367347/8374524 pid=107-1549 cpus=0 + 4 __percpu_alloc_mask+0xbc/0x140 age=8379760/8379760/8379760 pid=1 cpus=0 + 113 alloc_pipe_info+0x25/0x60 age=125624/8270722/8377065 pid=1-13212 cpus=0-1 + 2 alloc_fdtable+0x81/0x160 age=2417000/5386894/8356789 pid=1690 cpus=0-1 + 1 mb_cache_create+0xb6/0x1f0 age=8379750 pid=1 cpus=1 + 1 mb_cache_create+0x11e/0x1f0 age=8379750 pid=1 cpus=1 + 8 add_partition+0x45/0x250 age=61959/7339549/8379206 pid=1-13295 cpus=0 + 2 __crypto_alloc_tfm+0x43/0x1b0 age=3544684/3544684/3544684 pid=1545 cpus=0 + 1 pci_create_bus+0x82/0x240 age=8379831 pid=1 cpus=0 + 14 pcie_port_device_register+0x254/0x4a0 age=8379746/8379746/8379748 pid=1 cpus=1 + 1 acpi_ev_create_gpe_block+0x10b/0x3bf age=8379903 pid=1 cpus=0 + 1 acpi_tb_resize_root_table_list+0x66/0xdb age=8375731 pid=330 cpus=0 + 2 tty_buffer_request_room+0x136/0x190 age=8214639/8272696/8330753 pid=0-2262 cpus=0 + 1 tty_register_driver+0x1b3/0x2a0 age=8309081 pid=2711 cpus=1 + 10 tty_write+0x160/0x280 age=7214010/8238951/8377659 pid=34-2590 cpus=0-1 + 2 set_inverse_trans_unicode+0xce/0xf0 age=8355014/8367379/8379745 pid=1-1898 cpus=1 + 1 uart_register_driver+0x31/0x1c0 age=8379710 pid=1 cpus=1 + 166 device_create_vargs+0x8c/0x100 age=22658/8173620/8379911 pid=1-13295 cpus=0-1 + 8 platform_device_alloc+0x37/0x90 age=8367172/8376785/8379911 pid=1-1285 cpus=0-1 + 3 scsi_alloc_target+0x63/0x2e0 age=61990/5606770/8379325 pid=1-13295 cpus=0-1 + 2 sd_probe+0x86/0x430 age=61986/4220653/8379321 pid=1-13295 cpus=1 + 1 ahci_port_start+0x34/0xe0 age=8379708 pid=1 cpus=1 + 1 psmouse_connect+0x5b/0x2c0 age=8378898 pid=17 cpus=1 + 2 thermal_cooling_device_register+0x7f/0x290 age=8375643/8375667/8375692 pid=330 cpus=0-1 + 1 hid_add_field+0xcc/0x3a0 age=53473 pid=419 cpus=0 + 4 sock_alloc_send_skb+0x1cd/0x200 age=8344775/8349266/8350926 pid=1738 cpus=0-1 + 3 __rtnl_register+0x79/0x90 age=8360119/8373266/8379912 pid=1-1549 cpus=0 + 6 qdisc_alloc+0x34/0xd0 age=8356043/8356079/8356257 pid=1541 cpus=0 + 1 dmi_id_init+0x2a4/0x30c age=8379910 pid=1 cpus=0 + 5 hub_probe+0xdd/0x820 [usbcore] age=8373999/8374492/8374845 pid=143-147 cpus=0-1 + 5 usb_create_hcd+0x39/0x150 [usbcore] age=8374071/8374526/8374892 pid=143-147 cpus=0 + 26 usb_set_configuration+0x441/0x5f0 [usbcore] age=22663/3237429/8374857 pid=143-419 cpus=0-1 + 10 usb_get_configuration+0x92/0x1480 [usbcore] age=22667/5876069/8374865 pid=143-419 cpus=0-1 + 34 usb_create_ep_files+0x51/0x350 [usbcore] age=22579/5431762/8374732 pid=143-419 cpus=0-1 + 1 acpi_battery_add+0x29/0x1d3 [battery] age=8375630 pid=396 cpus=0 + 1 snd_card_new+0x38/0x370 [snd] age=8374136 pid=107 cpus=0 + 1 sta_info_alloc+0x3c/0x1d0 [mac80211] age=8329523 pid=742 cpus=0 + 2 snd_pcm_new+0x47/0x130 [snd_pcm] age=8374109/8374109/8374109 pid=107 cpus=1 + 1 rs_alloc_sta+0x25/0x120 [iwl3945] age=8329523 pid=742 cpus=0 + 1 get_alloc_hash+0x9b/0x140 [snd_hda_intel] age=8373108 pid=786 cpus=0 + 1 azx_probe+0xb3/0xc20 [snd_hda_intel] age=8374129 pid=107 cpus=0 + 1 azx_probe+0x4a9/0xc20 [snd_hda_intel] age=8374122 pid=107 cpus=0 + 1 snd_hda_codec_new+0x3e/0x559 [snd_hda_intel] age=8374112 pid=107 cpus=1 + 1 md_probe+0xa1/0x360 [md_mod] age=8370183 pid=916 cpus=0 + 8 loop_alloc+0x28/0x140 [loop] age=8369639/8369639/8369639 pid=951 cpus=0 + 4 ipv6_add_dev+0x69/0x330 [ipv6] age=8360116/8360117/8360119 pid=1549 cpus=0 + 1 ipv6_route_sysctl_init+0x22/0xb0 [ipv6] age=8360115 pid=1549 cpus=0 + 2 snd_seq_create_port+0x35/0x180 [snd_seq] age=8355549/8355549/8355549 pid=1805 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-1024/free_calls b/test/sys/kernel/slab/kmalloc-1024/free_calls index b456b99143..bd30112481 100644 --- a/test/sys/kernel/slab/kmalloc-1024/free_calls +++ b/test/sys/kernel/slab/kmalloc-1024/free_calls @@ -1,10 +1,10 @@ - 220 age=4294787840 pid=0 cpus=0 - 1 __vunmap+0xe9/0x120 age=100634 pid=1549 cpus=0 - 65 __free_pipe_info+0x5c/0x70 age=16787/95741/118165 pid=34-2846 cpus=0-1 - 19 acpi_ds_delete_walk_state+0xc9/0xcd age=96311/116725/120497 pid=0-1772 cpus=0-1 - 1 acpi_tb_resize_root_table_list+0xbf/0xdb age=116229 pid=330 cpus=0 - 2 release_one_tty+0xc7/0x190 age=92973/101877/110781 pid=55-1253 cpus=0-1 - 1 vt_ioctl+0x273/0x1c30 age=97095 pid=1703 cpus=0 - 14 device_create_release+0x9/0x10 age=92892/95125/97095 pid=1703-2139 cpus=0-1 - 1 fw_dev_release+0x20/0x30 age=96645 pid=1541 cpus=0 - 179 skb_release_data+0x85/0xd0 age=16789/86800/120408 pid=0-2737 cpus=0-1 + 216 age=4303047343 pid=0 cpus=0 + 1 __vunmap+0xe9/0x120 age=8360137 pid=1549 cpus=0 + 64 __free_pipe_info+0x5c/0x70 age=55301/8227248/8377668 pid=34-13363 cpus=0-1 + 19 acpi_ds_delete_walk_state+0xc9/0xcd age=8355814/8376228/8380000 pid=0-1772 cpus=0-1 + 1 acpi_tb_resize_root_table_list+0xbf/0xdb age=8375732 pid=330 cpus=0 + 2 release_one_tty+0xc7/0x190 age=8352476/8361380/8370284 pid=55-1253 cpus=0-1 + 1 vt_ioctl+0x273/0x1c30 age=8356598 pid=1703 cpus=0 + 14 device_create_release+0x9/0x10 age=8352395/8354628/8356598 pid=1703-2139 cpus=0-1 + 1 fw_dev_release+0x20/0x30 age=8356148 pid=1541 cpus=0 + 184 skb_release_data+0x85/0xd0 age=22639/7036434/8379911 pid=0-13303 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-1024/objects b/test/sys/kernel/slab/kmalloc-1024/objects index 2d8c4cdf72..4970e693e1 100644 --- a/test/sys/kernel/slab/kmalloc-1024/objects +++ b/test/sys/kernel/slab/kmalloc-1024/objects @@ -1 +1 @@ -534 +544 diff --git a/test/sys/kernel/slab/kmalloc-1024/objects_partial b/test/sys/kernel/slab/kmalloc-1024/objects_partial index 3ad5abd03a..0f11735ff8 100644 --- a/test/sys/kernel/slab/kmalloc-1024/objects_partial +++ b/test/sys/kernel/slab/kmalloc-1024/objects_partial @@ -1 +1 @@ -99 +196 diff --git a/test/sys/kernel/slab/kmalloc-1024/partial b/test/sys/kernel/slab/kmalloc-1024/partial index b8626c4cff..45a4fb75db 100644 --- a/test/sys/kernel/slab/kmalloc-1024/partial +++ b/test/sys/kernel/slab/kmalloc-1024/partial @@ -1 +1 @@ -4 +8 diff --git a/test/sys/kernel/slab/kmalloc-1024/slabs b/test/sys/kernel/slab/kmalloc-1024/slabs index d6b24041cf..209e3ef4b6 100644 --- a/test/sys/kernel/slab/kmalloc-1024/slabs +++ b/test/sys/kernel/slab/kmalloc-1024/slabs @@ -1 +1 @@ -19 +20 diff --git a/test/sys/kernel/slab/kmalloc-1024/total_objects b/test/sys/kernel/slab/kmalloc-1024/total_objects index 0eedeef9da..4eb9d0d9db 100644 --- a/test/sys/kernel/slab/kmalloc-1024/total_objects +++ b/test/sys/kernel/slab/kmalloc-1024/total_objects @@ -1 +1 @@ -551 +580 diff --git a/test/sys/kernel/slab/kmalloc-128/alloc_calls b/test/sys/kernel/slab/kmalloc-128/alloc_calls index c64f53b8f6..8a53c1107e 100644 --- a/test/sys/kernel/slab/kmalloc-128/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-128/alloc_calls @@ -1,36 +1,36 @@ - 17 param_sysfs_setup+0x87/0x140 age=106893/117027/120430 pid=1-1358 cpus=0-1 - 1 mempool_create_node+0x4b/0xf0 age=119516 pid=1 cpus=0 - 4 __vmalloc_area_node+0xfb/0x140 age=43540/90099/110841 pid=900-2754 cpus=0 - 2 shmem_fill_super+0x38/0x200 age=118075/119177/120279 pid=1-46 cpus=0-1 - 56 __percpu_alloc_mask+0xbc/0x140 age=38507/106559/120290 pid=1-2761 cpus=0-1 - 11 cdev_alloc+0x1a/0x50 age=38507/111069/120429 pid=1-2761 cpus=0-1 - 110 d_alloc+0x19d/0x1f0 age=38218/95106/116556 pid=401-2802 cpus=0-1 - 2 bm_register_write+0x63/0x630 age=94544/94544/94544 pid=2054 cpus=1 - 2 alloc_disk_node+0x6c/0x120 age=38525/79183/119842 pid=1-2761 cpus=0-1 - 20 ida_pre_get+0x86/0x90 age=38525/112635/120567 pid=0-2761 cpus=0-1 - 5 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120396/120405/120409 pid=1 cpus=0 - 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120412/120412/120412 pid=1 cpus=0 - 1 acpi_ev_create_gpe_block+0xb2/0x3bf age=120424 pid=1 cpus=0 - 4 acpi_add_single_object+0x5d8/0xd3c age=120353/120360/120364 pid=1 cpus=0 - 41 con_insert_unipair+0xd6/0x110 age=95535/110011/120266 pid=1-1898 cpus=1 - 2 thermal_zone_bind_cooling_device+0xde/0x2a0 age=115319/115319/115319 pid=329 cpus=0 - 4 led_trigger_register_simple+0x2b/0x80 age=116106/116150/116284 pid=392-396 cpus=0 - 1 sock_kmalloc+0x5c/0x70 age=68835 pid=2586 cpus=0 - 3 alloc_netdev_mq+0x6c/0x180 age=114103/117022/120305 pid=1-126 cpus=0-1 - 2 neigh_table_init_no_netlink+0xd2/0x250 age=100645/110467/120290 pid=1-1549 cpus=0 - 8 neigh_parms_alloc+0x5d/0x110 age=100637/108467/120290 pid=1-1549 cpus=0-1 - 4 fz_hash_alloc+0x4a/0x60 age=65984/97741/108353 pid=1185-1541 cpus=0-1 - 1 get_local_pda+0x39/0x9b age=120506 pid=1 cpus=0 - 1 mnt_init+0xf9/0x202 age=120567 pid=0 cpus=0 - 1 net_ns_init+0x49/0x16d age=120433 pid=1 cpus=0 - 3 sg_add+0x8c/0x400 [sg] age=38507/90683/116775 pid=169-2761 cpus=0 - 3 usb_get_configuration+0x5f2/0x1480 [usbcore] age=49744/49744/49744 pid=419 cpus=0 - 15 usb_get_configuration+0x1388/0x1480 [usbcore] age=43661/78952/113203 pid=419 cpus=0 - 1 0xffffffffa0065117 age=115268 pid=107 cpus=1 - 1 ieee80211_led_init+0x1b/0x230 [mac80211] age=114103 pid=126 cpus=1 - 1 ieee80211_led_init+0x83/0x230 [mac80211] age=114103 pid=126 cpus=1 - 1 ieee80211_led_init+0xeb/0x230 [mac80211] age=114102 pid=126 cpus=1 - 1 ieee80211_led_init+0x153/0x230 [mac80211] age=114102 pid=126 cpus=1 - 1 snd_hda_codec_new+0x1ec/0x559 [snd_hda_intel] age=114633 pid=107 cpus=1 - 1 md_register_thread+0x35/0xd0 [md_mod] age=110579 pid=916 cpus=0 - 1 fib6_net_init+0x7e/0x130 [ipv6] age=100640 pid=1549 cpus=0 + 17 param_sysfs_setup+0x87/0x140 age=8366402/8376536/8379939 pid=1-1358 cpus=0-1 + 1 mempool_create_node+0x4b/0xf0 age=8379025 pid=1 cpus=0 + 4 __vmalloc_area_node+0xfb/0x140 age=8303049/8349608/8370350 pid=900-2754 cpus=0 + 2 shmem_fill_super+0x38/0x200 age=8377584/8378686/8379788 pid=1-46 cpus=0-1 + 56 __percpu_alloc_mask+0xbc/0x140 age=61988/7483637/8379799 pid=1-13295 cpus=0-1 + 11 cdev_alloc+0x1a/0x50 age=61988/7621848/8379938 pid=1-13295 cpus=0-1 + 110 d_alloc+0x19d/0x1f0 age=22451/5346628/8376065 pid=401-13439 cpus=0-1 + 2 bm_register_write+0x63/0x630 age=8354053/8354053/8354053 pid=2054 cpus=1 + 2 alloc_disk_node+0x6c/0x120 age=62016/4220683/8379351 pid=1-13295 cpus=1 + 20 ida_pre_get+0x86/0x90 age=8298034/8372144/8380076 pid=0-2761 cpus=0-1 + 5 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379905/8379914/8379918 pid=1 cpus=0 + 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379921/8379921/8379921 pid=1 cpus=0 + 1 acpi_ev_create_gpe_block+0xb2/0x3bf age=8379933 pid=1 cpus=0 + 4 acpi_add_single_object+0x5d8/0xd3c age=8379862/8379869/8379873 pid=1 cpus=0 + 41 con_insert_unipair+0xd6/0x110 age=8355044/8369520/8379775 pid=1-1898 cpus=1 + 2 thermal_zone_bind_cooling_device+0xde/0x2a0 age=8374828/8374828/8374828 pid=329 cpus=0 + 4 led_trigger_register_simple+0x2b/0x80 age=8375615/8375659/8375793 pid=392-396 cpus=0 + 1 sock_kmalloc+0x5c/0x70 age=8328344 pid=2586 cpus=0 + 3 alloc_netdev_mq+0x6c/0x180 age=8373612/8376531/8379814 pid=1-126 cpus=0-1 + 2 neigh_table_init_no_netlink+0xd2/0x250 age=8360154/8369976/8379799 pid=1-1549 cpus=0 + 8 neigh_parms_alloc+0x5d/0x110 age=8360146/8367976/8379799 pid=1-1549 cpus=0-1 + 4 fz_hash_alloc+0x4a/0x60 age=8325493/8357250/8367862 pid=1185-1541 cpus=0-1 + 1 get_local_pda+0x39/0x9b age=8380015 pid=1 cpus=0 + 1 mnt_init+0xf9/0x202 age=8380076 pid=0 cpus=0 + 1 net_ns_init+0x49/0x16d age=8379942 pid=1 cpus=0 + 3 sg_add+0x8c/0x400 [sg] age=61988/5604850/8376284 pid=169-13295 cpus=0 + 3 usb_get_configuration+0x5f2/0x1480 [usbcore] age=22696/22696/22696 pid=419 cpus=0 + 15 usb_get_configuration+0x1388/0x1480 [usbcore] age=22696/3922325/8372712 pid=419 cpus=0 + 1 0xffffffffa0065117 age=8374777 pid=107 cpus=1 + 1 ieee80211_led_init+0x1b/0x230 [mac80211] age=8373612 pid=126 cpus=1 + 1 ieee80211_led_init+0x83/0x230 [mac80211] age=8373612 pid=126 cpus=1 + 1 ieee80211_led_init+0xeb/0x230 [mac80211] age=8373611 pid=126 cpus=1 + 1 ieee80211_led_init+0x153/0x230 [mac80211] age=8373611 pid=126 cpus=1 + 1 snd_hda_codec_new+0x1ec/0x559 [snd_hda_intel] age=8374142 pid=107 cpus=1 + 1 md_register_thread+0x35/0xd0 [md_mod] age=8370088 pid=916 cpus=0 + 1 fib6_net_init+0x7e/0x130 [ipv6] age=8360149 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-128/free_calls b/test/sys/kernel/slab/kmalloc-128/free_calls index f21aabec05..e19e8283c7 100644 --- a/test/sys/kernel/slab/kmalloc-128/free_calls +++ b/test/sys/kernel/slab/kmalloc-128/free_calls @@ -1,14 +1,18 @@ - 216 age=4294787863 pid=0 cpus=0 - 3 call_usermodehelper_freeinfo+0x27/0x30 age=100636/108439/114103 pid=745-1532 cpus=0 - 2 __vunmap+0xe9/0x120 age=115971/116373/116775 pid=105-169 cpus=0 - 25 d_callback+0x22/0x40 age=38470/99254/115952 pid=0-2778 cpus=0-1 - 50 load_elf_binary+0xaf/0x1e20 age=38383/102338/118076 pid=46-2792 cpus=0-1 - 2 free_rb_tree_fname+0x5c/0xb0 age=71751/89529/107307 pid=1274-2262 cpus=0 - 2 free_bitmap+0x29/0x80 age=108544/109515/110486 pid=55 cpus=0-1 - 1 acpi_evaluate_reference+0x100/0x117 age=115320 pid=329 cpus=0 - 6 acpi_get_object_info+0x1b6/0x1d4 age=120227/120332/120364 pid=1 cpus=0-1 - 4 do_acpi_find_child+0x48/0x51 age=119700/120149/120341 pid=1 cpus=0-1 - 20 con_release_unimap+0x4d/0xc0 age=95439/95449/95505 pid=1913-1944 cpus=0-1 - 1 unpack_to_rootfs+0x105/0xa39 age=120281 pid=1 cpus=0 - 1 acpi_processor_get_throttling_info+0x15e/0x58c [processor] age=116174 pid=330 cpus=0 - 1 acpi_battery_get_state+0xe5/0xf6 [battery] age=46035 pid=1371 cpus=0 + 197 age=4303047372 pid=0 cpus=0 + 3 call_usermodehelper_freeinfo+0x27/0x30 age=8360145/8367948/8373612 pid=745-1532 cpus=0 + 2 __vunmap+0xe9/0x120 age=8375480/8375882/8376284 pid=105-169 cpus=0 + 5 percpu_free+0x2d/0x60 age=7838031/7838092/7838171 pid=419-3347 cpus=0 + 1 cdev_dynamic_release+0x19/0x20 age=7838171 pid=419 cpus=0 + 49 d_callback+0x22/0x40 age=53327/5302082/8375461 pid=0-13314 cpus=0-1 + 51 load_elf_binary+0xaf/0x1e20 age=25315/7326461/8377585 pid=46-21952 cpus=0-1 + 1 free_rb_tree_fname+0x5c/0xb0 age=8366816 pid=1274 cpus=0 + 1 disk_release+0x2e/0x50 age=7838031 pid=3347 cpus=0 + 2 free_bitmap+0x29/0x80 age=8368053/8369024/8369995 pid=55 cpus=0-1 + 1 acpi_evaluate_reference+0x100/0x117 age=8374829 pid=329 cpus=0 + 6 acpi_get_object_info+0x1b6/0x1d4 age=8379736/8379841/8379873 pid=1 cpus=0-1 + 4 do_acpi_find_child+0x48/0x51 age=8379209/8379658/8379850 pid=1 cpus=0-1 + 1 unpack_to_rootfs+0x105/0xa39 age=8379790 pid=1 cpus=0 + 1 sg_remove+0x1ca/0x240 [sg] age=7838171 pid=419 cpus=0 + 6 usb_release_interface_cache+0x2c/0x60 [usbcore] age=7833192/7833192/7833192 pid=419 cpus=1 + 2 usb_release_interface_cache+0x47/0x60 [usbcore] age=7833192/7833192/7833192 pid=419 cpus=1 + 1 acpi_processor_get_throttling_info+0x15e/0x58c [processor] age=8375683 pid=330 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-128/objects b/test/sys/kernel/slab/kmalloc-128/objects index bc23f8ef56..fe2cd8b002 100644 --- a/test/sys/kernel/slab/kmalloc-128/objects +++ b/test/sys/kernel/slab/kmalloc-128/objects @@ -1 +1 @@ -354 +343 diff --git a/test/sys/kernel/slab/kmalloc-128/objects_partial b/test/sys/kernel/slab/kmalloc-128/objects_partial index 8351c19397..76a8b2b703 100644 --- a/test/sys/kernel/slab/kmalloc-128/objects_partial +++ b/test/sys/kernel/slab/kmalloc-128/objects_partial @@ -1 +1 @@ -14 +83 diff --git a/test/sys/kernel/slab/kmalloc-128/partial b/test/sys/kernel/slab/kmalloc-128/partial index d00491fd7e..7ed6ff82de 100644 --- a/test/sys/kernel/slab/kmalloc-128/partial +++ b/test/sys/kernel/slab/kmalloc-128/partial @@ -1 +1 @@ -1 +5 diff --git a/test/sys/kernel/slab/kmalloc-16/alloc_calls b/test/sys/kernel/slab/kmalloc-16/alloc_calls index 122e2bb017..dda95984a9 100644 --- a/test/sys/kernel/slab/kmalloc-16/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-16/alloc_calls @@ -1,41 +1,41 @@ - 2 arch_acpi_processor_init_pdc+0x71/0x180 age=116222/116253/116284 pid=330 cpus=0 - 2 arch_acpi_processor_init_pdc+0xab/0x180 age=116222/116253/116284 pid=330 cpus=0 - 5 sched_create_group+0x40/0x220 age=92325/99809/107336 pid=1333-2177 cpus=0-1 - 5 sched_create_group+0x62/0x220 age=92325/99809/107336 pid=1333-2177 cpus=0-1 - 2 setup_modinfo_version+0x19/0x30 age=115115/115919/116723 pid=122-126 cpus=0-1 - 365 load_module+0x1ac4/0x1b30 age=43566/109983/116805 pid=105-2754 cpus=0-1 - 13 mempool_create_node+0x4b/0xf0 age=120344/120414/120459 pid=1 cpus=0 - 1 krealloc+0x1e/0x60 age=116287 pid=330 cpus=0 - 4 __vmalloc_area_node+0xfb/0x140 age=115186/115605/116318 pid=126-392 cpus=0 - 7 alloc_vfsmnt+0x97/0x180 age=38189/101712/120338 pid=1-2817 cpus=0-1 - 2 proc_symlink+0x4d/0xb0 age=120597/120597/120597 pid=0 cpus=0 - 1275 sysfs_new_dirent+0x10c/0x120 age=38535/111937/120464 pid=1-2761 cpus=0-1 - 2 ext3_fill_super+0x691/0x1a20 age=110156/114506/118856 pid=1-962 cpus=0 - 406 kvasprintf+0x55/0x90 age=38537/112458/120597 pid=0-2761 cpus=0-1 - 1 bit_cursor+0x223/0x6a0 age=96655 pid=7 cpus=0 - 12 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120429/120431/120439 pid=1 cpus=0 - 14 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120430/120440/120446 pid=1 cpus=0 - 2 acpi_ut_copy_simple_object+0x8f/0x11c age=116142/116150/116159 pid=396 cpus=0 - 5 acpi_irq_stats_init+0x1bd/0x268 age=120454/120454/120454 pid=1 cpus=0 - 14 pnp_add_id+0x1e/0xe0 age=120346/120348/120351 pid=1 cpus=0 - 9 reserve_range+0x39/0x130 age=120335/120335/120335 pid=1 cpus=0 - 1 trackpoint_detect+0x94/0x190 age=119217 pid=17 cpus=0 - 2 proto_register+0xf2/0x260 age=100684/110506/120329 pid=1-1549 cpus=0 - 2 neigh_sysctl_register+0x1cd/0x330 age=100668/107460/114253 pid=126-1549 cpus=0-1 - 1 nl_pid_hash_rehash+0x180/0x1a0 age=101542 pid=1533 cpus=0 - 1 genl_register_family+0x1b6/0x1e0 age=120338 pid=1 cpus=0 - 1 __devinet_sysctl_register+0xb8/0x120 age=114253 pid=126 cpus=1 - 1 pci_acpi_scan_root+0x3f/0x230 age=120382 pid=1 cpus=0 - 1 acpi_parse_mcfg+0x61/0x140 age=120461 pid=1 cpus=0 - 1 pci_mmcfg_arch_init+0x26/0x129 age=120461 pid=1 cpus=0 - 1 icmp_sk_init+0x32/0x13f age=120311 pid=1 cpus=0 - 5 hub_probe+0x26b/0x820 [usbcore] age=114550/115043/115396 pid=143-147 cpus=0-1 - 12 usb_cache_string+0x65/0xa0 [usbcore] age=43690/92354/115416 pid=143-419 cpus=0-1 - 1 usb_create_ep_files+0x283/0x350 [usbcore] age=115283 pid=143 cpus=0 - 1 0xffffffffa006595f age=100676 pid=1549 cpus=0 - 13 snd_info_create_entry+0x30/0xa0 [snd] age=96049/113228/114660 pid=107-1813 cpus=0-1 - 1 snd_oss_info_register+0x40/0xc0 [snd] age=115298 pid=107 cpus=1 - 1 async_chainiv_givencrypt+0xf9/0x110 [crypto_blkcipher] age=115055 pid=215 cpus=0 - 1 eseqiv_alloc+0x6d/0x80 [crypto_blkcipher] age=115055 pid=215 cpus=0 - 1 run+0xa9/0x500 [raid1] age=110609 pid=916 cpus=0 - 1 __addrconf_sysctl_register+0xcd/0x140 [ipv6] age=100668 pid=1549 cpus=0 + 2 arch_acpi_processor_init_pdc+0x71/0x180 age=8375737/8375768/8375799 pid=330 cpus=0 + 2 arch_acpi_processor_init_pdc+0xab/0x180 age=8375737/8375768/8375799 pid=330 cpus=0 + 5 sched_create_group+0x40/0x220 age=8351840/8359324/8366851 pid=1333-2177 cpus=0-1 + 5 sched_create_group+0x62/0x220 age=8351840/8359324/8366851 pid=1333-2177 cpus=0-1 + 2 setup_modinfo_version+0x19/0x30 age=8374630/8375434/8376238 pid=122-126 cpus=0-1 + 365 load_module+0x1ac4/0x1b30 age=8303081/8369498/8376320 pid=105-2754 cpus=0-1 + 13 mempool_create_node+0x4b/0xf0 age=8379859/8379929/8379974 pid=1 cpus=0 + 1 krealloc+0x1e/0x60 age=8375802 pid=330 cpus=0 + 4 __vmalloc_area_node+0xfb/0x140 age=8374701/8375120/8375833 pid=126-392 cpus=0 + 7 alloc_vfsmnt+0x97/0x180 age=61473/7184623/8379853 pid=1-13348 cpus=0-1 + 2 proc_symlink+0x4d/0xb0 age=8380112/8380112/8380112 pid=0 cpus=0 + 1275 sysfs_new_dirent+0x10c/0x120 age=22645/7761348/8379979 pid=1-13295 cpus=0-1 + 2 ext3_fill_super+0x691/0x1a20 age=8369671/8374021/8378371 pid=1-962 cpus=0 + 406 kvasprintf+0x55/0x90 age=22645/7760583/8380112 pid=0-13295 cpus=0-1 + 1 bit_cursor+0x223/0x6a0 age=8356170 pid=7 cpus=0 + 12 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379944/8379946/8379954 pid=1 cpus=0 + 14 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379945/8379955/8379961 pid=1 cpus=0 + 2 acpi_ut_copy_simple_object+0x8f/0x11c age=8375657/8375665/8375674 pid=396 cpus=0 + 5 acpi_irq_stats_init+0x1bd/0x268 age=8379969/8379969/8379969 pid=1 cpus=0 + 14 pnp_add_id+0x1e/0xe0 age=8379861/8379863/8379866 pid=1 cpus=0 + 9 reserve_range+0x39/0x130 age=8379850/8379850/8379850 pid=1 cpus=0 + 1 trackpoint_detect+0x94/0x190 age=8378732 pid=17 cpus=0 + 2 proto_register+0xf2/0x260 age=8360199/8370021/8379844 pid=1-1549 cpus=0 + 2 neigh_sysctl_register+0x1cd/0x330 age=8360183/8366975/8373768 pid=126-1549 cpus=0-1 + 1 nl_pid_hash_rehash+0x180/0x1a0 age=8361057 pid=1533 cpus=0 + 1 genl_register_family+0x1b6/0x1e0 age=8379853 pid=1 cpus=0 + 1 __devinet_sysctl_register+0xb8/0x120 age=8373768 pid=126 cpus=1 + 1 pci_acpi_scan_root+0x3f/0x230 age=8379897 pid=1 cpus=0 + 1 acpi_parse_mcfg+0x61/0x140 age=8379976 pid=1 cpus=0 + 1 pci_mmcfg_arch_init+0x26/0x129 age=8379976 pid=1 cpus=0 + 1 icmp_sk_init+0x32/0x13f age=8379826 pid=1 cpus=0 + 5 hub_probe+0x26b/0x820 [usbcore] age=8374065/8374558/8374911 pid=143-147 cpus=0-1 + 12 usb_cache_string+0x65/0xa0 [usbcore] age=22646/4900582/8374931 pid=143-419 cpus=0-1 + 1 usb_create_ep_files+0x283/0x350 [usbcore] age=8374798 pid=143 cpus=0 + 1 0xffffffffa006595f age=8360191 pid=1549 cpus=0 + 13 snd_info_create_entry+0x30/0xa0 [snd] age=8355564/8372743/8374175 pid=107-1813 cpus=0-1 + 1 snd_oss_info_register+0x40/0xc0 [snd] age=8374813 pid=107 cpus=1 + 1 async_chainiv_givencrypt+0xf9/0x110 [crypto_blkcipher] age=8374570 pid=215 cpus=0 + 1 eseqiv_alloc+0x6d/0x80 [crypto_blkcipher] age=8374570 pid=215 cpus=0 + 1 run+0xa9/0x500 [raid1] age=8370124 pid=916 cpus=0 + 1 __addrconf_sysctl_register+0xcd/0x140 [ipv6] age=8360183 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-16/free_calls b/test/sys/kernel/slab/kmalloc-16/free_calls index e77e0a940e..9342318395 100644 --- a/test/sys/kernel/slab/kmalloc-16/free_calls +++ b/test/sys/kernel/slab/kmalloc-16/free_calls @@ -1,26 +1,26 @@ - 1954 age=4294787894 pid=0 cpus=0 - 2 free_sched_group+0x62/0x80 age=115594/115880/116166 pid=0-72 cpus=0-1 - 3 free_sched_group+0x6b/0x80 age=38403/90054/116166 pid=0-72 cpus=0-1 - 3 free_sect_attrs+0x2e/0x50 age=115540/115540/115540 pid=383 cpus=0 - 3 __vunmap+0xe9/0x120 age=114135/115104/115637 pid=181-754 cpus=0 - 4 vfs_rename+0x301/0x450 age=65000/85542/107518 pid=1325-2461 cpus=0 - 8 bio_free_map_data+0x14/0x30 age=38547/60160/119849 pid=0-6 cpus=0-1 - 9 bio_free_map_data+0x1d/0x30 age=38547/82320/119864 pid=0-558 cpus=0-1 - 34 remove_kevent+0x44/0x60 age=60437/70720/94557 pid=1547-2544 cpus=0-1 - 40 release_sysfs_dirent+0x8c/0xd0 age=92939/101608/120263 pid=1-2141 cpus=0-1 - 7 kobject_release+0xe1/0x140 age=96699/106448/114376 pid=419-1541 cpus=0-1 - 69 kobject_uevent_env+0x11a/0x470 age=49635/115467/120464 pid=1-2711 cpus=0-1 - 2 bit_cursor+0x23b/0x6a0 age=96656/108469/120282 pid=1-7 cpus=0-1 - 1 acpi_ds_create_operand+0x12c/0x209 age=120352 pid=1 cpus=0 - 2 acpi_ns_get_node+0x92/0xa1 age=114952/114989/115027 pid=215 cpus=0-1 - 8 acpi_ut_delete_internal_obj+0x15f/0x16f age=106924/115073/116266 pid=330-1358 cpus=0 - 16 acpi_ut_delete_internal_object_list+0x28/0x2f age=114954/119420/120405 pid=1-396 cpus=0 - 2 reserve_range+0x11d/0x130 age=120336/120336/120336 pid=1 cpus=0 - 3 release_firmware+0x57/0x70 age=96699/104006/107667 pid=1285-1541 cpus=0-1 - 8 module_add_driver+0x66/0xd0 age=114023/116361/119751 pid=1-181 cpus=0-1 - 1 power_supply_uevent+0x1a0/0x210 age=116132 pid=7 cpus=0 - 2 get_modalias+0xd4/0x120 age=96320/108391/120462 pid=1-1772 cpus=0 - 1 nl_pid_hash_rehash+0x18e/0x1a0 age=96922 pid=1708 cpus=0 - 2 fib_hash_free+0x35/0x40 age=108384/108384/108384 pid=1185 cpus=0 - 2 wireless_send_event+0x172/0x330 age=70090/83339/96588 pid=1545 cpus=0-1 - 11 usb_get_configuration+0x42d/0x1480 [usbcore] age=43692/102097/115417 pid=143-419 cpus=0-1 + 1912 age=4303047409 pid=0 cpus=0 + 2 free_sched_group+0x62/0x80 age=8375109/8375395/8375681 pid=0-72 cpus=0-1 + 2 free_sched_group+0x6b/0x80 age=8375109/8375395/8375681 pid=0-72 cpus=0-1 + 3 free_sect_attrs+0x2e/0x50 age=8375055/8375055/8375055 pid=383 cpus=0 + 3 __vunmap+0xe9/0x120 age=8373650/8374619/8375152 pid=181-754 cpus=0 + 7 vfs_rename+0x301/0x450 age=125333/5028818/8367033 pid=829-13249 cpus=0 + 10 bio_free_map_data+0x14/0x30 age=23581/2550049/8379364 pid=0-1738 cpus=0-1 + 10 bio_free_map_data+0x1d/0x30 age=53581/4218001/8379379 pid=0-558 cpus=0-1 + 60 remove_kevent+0x44/0x60 age=61364/3011504/8354072 pid=1547-2544 cpus=0-1 + 49 release_sysfs_dirent+0x8c/0xd0 age=7824392/8263442/8379778 pid=1-2141 cpus=0-1 + 9 kobject_release+0xe1/0x140 age=7833231/8247578/8373891 pid=419-1541 cpus=0-1 + 70 kobject_uevent_env+0x11a/0x470 age=409229/8261185/8379979 pid=1-12942 cpus=0-1 + 2 bit_cursor+0x23b/0x6a0 age=8356171/8367984/8379797 pid=1-7 cpus=0-1 + 1 acpi_ds_create_operand+0x12c/0x209 age=8379867 pid=1 cpus=0 + 2 acpi_ns_get_node+0x92/0xa1 age=8374467/8374504/8374542 pid=215 cpus=0-1 + 8 acpi_ut_delete_internal_obj+0x15f/0x16f age=8366439/8374588/8375781 pid=330-1358 cpus=0 + 16 acpi_ut_delete_internal_object_list+0x28/0x2f age=8374469/8378935/8379920 pid=1-396 cpus=0 + 2 reserve_range+0x11d/0x130 age=8379851/8379851/8379851 pid=1 cpus=0 + 3 release_firmware+0x57/0x70 age=8356214/8363521/8367182 pid=1285-1541 cpus=0-1 + 8 module_add_driver+0x66/0xd0 age=8373538/8375876/8379266 pid=1-181 cpus=0-1 + 1 power_supply_uevent+0x1a0/0x210 age=8375647 pid=7 cpus=0 + 2 get_modalias+0xd4/0x120 age=8355835/8367906/8379977 pid=1-1772 cpus=0 + 1 nl_pid_hash_rehash+0x18e/0x1a0 age=8356437 pid=1708 cpus=0 + 2 fib_hash_free+0x35/0x40 age=8367899/8367899/8367899 pid=1185 cpus=0 + 2 wireless_send_event+0x172/0x330 age=8329605/8342854/8356103 pid=1545 cpus=0-1 + 10 usb_get_configuration+0x42d/0x1480 [usbcore] age=22733/6708190/8374932 pid=143-419 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-16/objects b/test/sys/kernel/slab/kmalloc-16/objects index 9dd9fcb909..67f19f909d 100644 --- a/test/sys/kernel/slab/kmalloc-16/objects +++ b/test/sys/kernel/slab/kmalloc-16/objects @@ -1 +1 @@ -2268 +2254 diff --git a/test/sys/kernel/slab/kmalloc-16/objects_partial b/test/sys/kernel/slab/kmalloc-16/objects_partial index 8351c19397..573541ac97 100644 --- a/test/sys/kernel/slab/kmalloc-16/objects_partial +++ b/test/sys/kernel/slab/kmalloc-16/objects_partial @@ -1 +1 @@ -14 +0 diff --git a/test/sys/kernel/slab/kmalloc-16/partial b/test/sys/kernel/slab/kmalloc-16/partial index d00491fd7e..573541ac97 100644 --- a/test/sys/kernel/slab/kmalloc-16/partial +++ b/test/sys/kernel/slab/kmalloc-16/partial @@ -1 +1 @@ -1 +0 diff --git a/test/sys/kernel/slab/kmalloc-16/slabs b/test/sys/kernel/slab/kmalloc-16/slabs index e373ee695f..95f9650f01 100644 --- a/test/sys/kernel/slab/kmalloc-16/slabs +++ b/test/sys/kernel/slab/kmalloc-16/slabs @@ -1 +1 @@ -50 +49 diff --git a/test/sys/kernel/slab/kmalloc-16/total_objects b/test/sys/kernel/slab/kmalloc-16/total_objects index 0c80f59274..67f19f909d 100644 --- a/test/sys/kernel/slab/kmalloc-16/total_objects +++ b/test/sys/kernel/slab/kmalloc-16/total_objects @@ -1 +1 @@ -2300 +2254 diff --git a/test/sys/kernel/slab/kmalloc-192/alloc_calls b/test/sys/kernel/slab/kmalloc-192/alloc_calls index 08a0c926a1..ca9d453269 100644 --- a/test/sys/kernel/slab/kmalloc-192/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-192/alloc_calls @@ -1,33 +1,34 @@ - 10 sched_create_group+0x91/0x220 age=92334/99818/107345 pid=1333-2177 cpus=0-1 - 10 sched_create_group+0xae/0x220 age=92334/99818/107345 pid=1333-2177 cpus=0-1 - 11 groups_alloc+0x41/0xe0 age=15622/81960/107345 pid=1333-2851 cpus=0-1 - 9 param_sysfs_setup+0x87/0x140 age=43575/109232/120469 pid=1-2754 cpus=0-1 - 18 mempool_create_node+0x2e/0xf0 age=38569/115205/120468 pid=1-2761 cpus=0-1 - 4 __vmalloc_area_node+0xfb/0x140 age=110863/114137/115429 pid=107-901 cpus=0 - 30 __percpu_alloc_mask+0xbc/0x140 age=110873/118282/120473 pid=1-900 cpus=0-1 - 4 d_alloc+0x19d/0x1f0 age=37329/82388/97408 pid=1706-2818 cpus=0-1 - 1 bm_register_write+0x63/0x630 age=94583 pid=2054 cpus=1 - 1 sysfs_open_file+0xd6/0x230 age=0 pid=2890 cpus=0 - 15 ipc_rcu_alloc+0x4a/0x70 age=14665/70537/89120 pid=2177-2621 cpus=0-1 - 28 kset_create_and_add+0x35/0xa0 age=96472/118784/120473 pid=1-1766 cpus=0-1 - 1 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120452 pid=1 cpus=0 - 3 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120449/120449/120450 pid=1 cpus=0 - 1 acpi_power_add+0x4a/0x1d6 age=120363 pid=1 cpus=0 - 2 ata_host_alloc+0x4f/0xf0 age=119753/120011/120269 pid=1 cpus=0-1 - 8 cpuidle_add_state_sysfs+0xc3/0x140 age=116210/116234/116258 pid=330 cpus=0-1 - 1 hid_parse_report+0x43/0x2c0 age=112822 pid=803 cpus=0 - 2 hid_add_field+0x18a/0x3a0 age=112822/112822/112822 pid=803 cpus=0 - 6 fib_create_info+0x61/0x970 age=65009/87020/108376 pid=1197-1541 cpus=0-1 - 1 unix_sysctl_register+0x2a/0x80 age=120320 pid=1 cpus=0 - 1 rtnetlink_init+0x38/0x113 age=120472 pid=1 cpus=0 - 1 inet_diag_init+0x15/0x6b age=119471 pid=1 cpus=0 - 41 usb_alloc_urb+0x19/0x50 [usbcore] age=43573/60551/115393 pid=143-2754 cpus=0-1 - 1 usb_get_configuration+0x5f2/0x1480 [usbcore] age=49783 pid=419 cpus=0 - 2 usb_get_configuration+0x1388/0x1480 [usbcore] age=112867/113054/113242 pid=419 cpus=0 - 1 sr_probe+0x76/0x540 [sr_mod] age=116327 pid=163 cpus=0 - 18 snd_ctl_new+0x28/0x90 [snd] age=114647/114647/114647 pid=107 cpus=1 - 1 iwl3945_pci_probe+0xd3f/0x1020 [iwl3945] age=114269 pid=126 cpus=1 - 1 blkcipher_walk_next+0x29c/0x390 [crypto_blkcipher] age=115035 pid=215 cpus=1 - 3 dm_register_target+0x1f/0xf0 [dm_mod] age=110873/110873/110874 pid=900 cpus=0 - 1 ipv6_icmp_sysctl_init+0x22/0x40 [ipv6] age=100675 pid=1549 cpus=0 - 1 snd_seq_pool_new+0x1b/0x80 [snd_seq] age=96109 pid=1805 cpus=0 + 10 sched_create_group+0x91/0x220 age=8351861/8359345/8366872 pid=1333-2177 cpus=0-1 + 10 sched_create_group+0xae/0x220 age=8351861/8359345/8366872 pid=1333-2177 cpus=0-1 + 10 groups_alloc+0x41/0xe0 age=17070/6159814/8366872 pid=1333-20296 cpus=0-1 + 9 param_sysfs_setup+0x87/0x140 age=8303102/8368759/8379996 pid=1-2754 cpus=0-1 + 2 futex_lock_pi+0x776/0xb00 age=125614/1986240/3846867 pid=2411-13213 cpus=0-1 + 18 mempool_create_node+0x2e/0xf0 age=62077/7917175/8379995 pid=1-13295 cpus=0-1 + 4 __vmalloc_area_node+0xfb/0x140 age=8370390/8373664/8374956 pid=107-901 cpus=0 + 30 __percpu_alloc_mask+0xbc/0x140 age=8370400/8377809/8380000 pid=1-900 cpus=0-1 + 4 d_alloc+0x19d/0x1f0 age=61160/6282991/8356935 pid=1706-13349 cpus=0-1 + 1 bm_register_write+0x63/0x630 age=8354110 pid=2054 cpus=1 + 1 sysfs_open_file+0xd6/0x230 age=0 pid=13466 cpus=0 + 15 ipc_rcu_alloc+0x4a/0x70 age=8274192/8330064/8348647 pid=2177-2621 cpus=0-1 + 28 kset_create_and_add+0x35/0xa0 age=8355999/8378311/8380000 pid=1-1766 cpus=0-1 + 1 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379979 pid=1 cpus=0 + 3 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379976/8379976/8379977 pid=1 cpus=0 + 1 acpi_power_add+0x4a/0x1d6 age=8379890 pid=1 cpus=0 + 2 ata_host_alloc+0x4f/0xf0 age=8379280/8379538/8379796 pid=1 cpus=0-1 + 8 cpuidle_add_state_sysfs+0xc3/0x140 age=125753/125759/125766 pid=13 cpus=0-1 + 1 hid_parse_report+0x43/0x2c0 age=53560 pid=419 cpus=0 + 2 hid_add_field+0x18a/0x3a0 age=53560/53560/53560 pid=419 cpus=0 + 6 fib_create_info+0x61/0x970 age=8324536/8346547/8367903 pid=1197-1541 cpus=0-1 + 1 unix_sysctl_register+0x2a/0x80 age=8379847 pid=1 cpus=0 + 1 rtnetlink_init+0x38/0x113 age=8379999 pid=1 cpus=0 + 1 inet_diag_init+0x15/0x6b age=8378998 pid=1 cpus=0 + 41 usb_alloc_urb+0x19/0x50 [usbcore] age=22746/1043846/8374920 pid=143-419 cpus=0-1 + 1 usb_get_configuration+0x5f2/0x1480 [usbcore] age=22753 pid=419 cpus=0 + 2 usb_get_configuration+0x1388/0x1480 [usbcore] age=8372394/8372581/8372769 pid=419 cpus=0 + 1 sr_probe+0x76/0x540 [sr_mod] age=8375854 pid=163 cpus=0 + 18 snd_ctl_new+0x28/0x90 [snd] age=8374174/8374174/8374174 pid=107 cpus=1 + 1 iwl3945_pci_probe+0xd3f/0x1020 [iwl3945] age=8373796 pid=126 cpus=1 + 1 blkcipher_walk_next+0x29c/0x390 [crypto_blkcipher] age=8374562 pid=215 cpus=1 + 3 dm_register_target+0x1f/0xf0 [dm_mod] age=8370400/8370400/8370401 pid=900 cpus=0 + 1 ipv6_icmp_sysctl_init+0x22/0x40 [ipv6] age=8360202 pid=1549 cpus=0 + 1 snd_seq_pool_new+0x1b/0x80 [snd_seq] age=8355636 pid=1805 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-192/free_calls b/test/sys/kernel/slab/kmalloc-192/free_calls index 0ddc2715ba..17b51ccb6e 100644 --- a/test/sys/kernel/slab/kmalloc-192/free_calls +++ b/test/sys/kernel/slab/kmalloc-192/free_calls @@ -1,15 +1,16 @@ - 175 age=4294787903 pid=0 cpus=0 - 4 free_sched_group+0x3b/0x80 age=98418/108735/115603 pid=0-1614 cpus=0-1 - 2 free_sched_group+0x50/0x80 age=98418/104439/110461 pid=0-1614 cpus=0 - 1 do_exit+0x713/0x960 age=73642 pid=2558 cpus=1 - 4 groups_free+0x56/0x60 age=60445/91673/110467 pid=0-1690 cpus=0 - 1 __vunmap+0xe9/0x120 age=96710 pid=1748 cpus=1 - 1 do_readv_writev+0xe4/0x1e0 age=71664 pid=2262 cpus=0 - 4 getxattr+0x8c/0x140 age=1/71510/98419 pid=1610-2890 cpus=0-1 - 24 sysfs_release+0x7c/0xa0 age=16075/92506/116933 pid=220-2765 cpus=0-1 - 1 ipc_immediate_free+0x9/0x10 age=70732 pid=2568 cpus=0 - 1 acpi_pci_irq_add_prt+0x30b/0x324 age=120384 pid=1 cpus=0 - 4 free_fib_info+0x34/0x60 age=108377/108382/108393 pid=1185-1197 cpus=0-1 - 14 urb_destroy+0x23/0x30 [usbcore] age=37330/98920/115394 pid=143-2760 cpus=0-1 - 1 0xffffffffa006521f age=96110 pid=1805 cpus=0 - 1 acpi_processor_get_throttling_info+0x50f/0x58c [processor] age=116261 pid=330 cpus=0 + 149 age=4303047430 pid=0 cpus=0 + 5 free_sched_group+0x3b/0x80 age=363179/6767246/8375130 pid=0-1614 cpus=0-1 + 1 free_sched_group+0x50/0x80 age=8369988 pid=0 cpus=0 + 1 do_exit+0x713/0x960 age=8333169 pid=2558 cpus=1 + 7 groups_free+0x56/0x60 age=17071/4081875/8369994 pid=0-1690 cpus=0-1 + 1 __vunmap+0xe9/0x120 age=8356237 pid=1748 cpus=1 + 1 do_readv_writev+0xe4/0x1e0 age=8331191 pid=2262 cpus=0 + 4 getxattr+0x8c/0x140 age=0/6266155/8357946 pid=1610-13466 cpus=0-1 + 20 sysfs_release+0x7c/0xa0 age=53608/7118781/8376453 pid=226-2519 cpus=0-1 + 1 ipc_immediate_free+0x9/0x10 age=8330259 pid=2568 cpus=0 + 1 acpi_pci_irq_add_prt+0x30b/0x324 age=8379911 pid=1 cpus=0 + 6 cpuidle_remove_state_sysfs+0x4f/0x70 age=125768/1366349/3847513 pid=13 cpus=0 + 4 free_fib_info+0x34/0x60 age=8367904/8367909/8367920 pid=1185-1197 cpus=0-1 + 36 urb_destroy+0x23/0x30 [usbcore] age=22749/2596918/8374921 pid=143-13294 cpus=0-1 + 1 sg_clean+0x3e/0x80 [usbcore] age=61399 pid=13294 cpus=0 + 1 0xffffffffa006521f age=8355637 pid=1805 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-192/objects b/test/sys/kernel/slab/kmalloc-192/objects index 2197544d04..f1aaa90592 100644 --- a/test/sys/kernel/slab/kmalloc-192/objects +++ b/test/sys/kernel/slab/kmalloc-192/objects @@ -1 +1 @@ -252 +254 diff --git a/test/sys/kernel/slab/kmalloc-192/objects_partial b/test/sys/kernel/slab/kmalloc-192/objects_partial index 48082f72f0..8351c19397 100644 --- a/test/sys/kernel/slab/kmalloc-192/objects_partial +++ b/test/sys/kernel/slab/kmalloc-192/objects_partial @@ -1 +1 @@ -12 +14 diff --git a/test/sys/kernel/slab/kmalloc-2048/alloc_calls b/test/sys/kernel/slab/kmalloc-2048/alloc_calls index 9127c14af4..a315f8b04c 100644 --- a/test/sys/kernel/slab/kmalloc-2048/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-2048/alloc_calls @@ -1,40 +1,41 @@ - 53 load_module+0x18d5/0x1b30 age=43508/109019/116747 pid=105-2754 cpus=0-1 - 1 mempool_create_node+0x4b/0xf0 age=110551 pid=916 cpus=0 - 20 sget+0xc4/0x460 age=38130/110987/120539 pid=0-2817 cpus=0-1 - 13 alloc_fdtable+0x81/0x160 age=3786/78813/97733 pid=1532-2676 cpus=0-1 - 2 journal_init_common+0x1a/0x130 age=110094/114444/118794 pid=1-962 cpus=0 - 15 alloc_disk_node+0x1b/0x120 age=38479/102551/119814 pid=1-2761 cpus=0-1 - 1 pci_create_bus+0x3a/0x240 age=120324 pid=1 cpus=0 - 21 alloc_pci_dev+0x1a/0x40 age=120320/120322/120324 pid=1 cpus=0 - 1 framebuffer_alloc+0x3a/0x80 age=120239 pid=1 cpus=1 - 74 acpi_add_single_object+0x4e/0xd3c age=120325/120338/120354 pid=1 cpus=0 - 1 acpi_irq_stats_init+0xcb/0x268 age=120396 pid=1 cpus=0 - 11 pnp_alloc_dev+0x35/0x120 age=120288/120291/120293 pid=1 cpus=0 - 10 init_dev+0x12e/0x6f0 age=66746/94761/118634 pid=33-2593 cpus=0-1 - 2 init_dev+0x2aa/0x6f0 age=66746/85779/104812 pid=1258-2593 cpus=0 - 1 tty_register_driver+0x1b3/0x2a0 age=120208 pid=1 cpus=1 - 2 kobj_map_init+0x22/0xa0 age=120401/120470/120539 pid=0-1 cpus=0 - 3 mousedev_create+0x36/0x2d0 age=112741/117036/119449 pid=1-803 cpus=0 - 1 atkbd_connect+0x33/0x290 age=119442 pid=17 cpus=1 - 2 thermal_zone_device_register+0x6f/0x310 age=115292/115309/115327 pid=329 cpus=0-1 - 15 sk_prot_alloc+0x83/0xb0 age=68810/108007/120405 pid=1-2586 cpus=0-1 - 1 reqsk_queue_alloc+0x112/0x120 age=97288 pid=1690 cpus=0 - 255 __netdev_alloc_skb+0x1f/0x40 age=96802/96803/96805 pid=1541 cpus=0 - 10 neigh_sysctl_register+0x8d/0x330 age=100609/108839/120262 pid=1-1549 cpus=0-1 - 6 __devinet_sysctl_register+0x74/0x120 age=114075/117599/120262 pid=1-126 cpus=0-1 - 7 pci_add_new_bus+0x25/0x160 age=120320/120320/120322 pid=1 cpus=0 - 1 i8042_create_aux_port+0x36/0x10f age=119461 pid=1 cpus=0 - 1 i8042_probe+0x190/0x68d age=119461 pid=1 cpus=0 - 1 netdev_init+0x32/0xc2 age=120284 pid=1 cpus=0 - 1 netdev_init+0x66/0xc2 age=120284 pid=1 cpus=0 - 1 fib_net_init+0x21/0x14c age=120262 pid=1 cpus=0 - 10 usb_alloc_dev+0x36/0x2c0 [usbcore] age=43849/100909/115370 pid=143-419 cpus=0-1 - 2 acpi_thermal_add+0x36/0x4bb [thermal] age=115294/115311/115329 pid=329 cpus=0-1 - 5 evdev_open+0xaf/0x1e0 [evdev] age=104879/105429/105728 pid=1443 cpus=0-1 - 8 evdev_connect+0x54/0x1f0 [evdev] age=112736/115034/115504 pid=187-803 cpus=0-1 - 1 rtc_device_register+0xa4/0x260 [rtc_core] age=115209 pid=208 cpus=0 - 1 iwl3945_bg_request_scan+0x5d3/0x660 [iwl3945] age=96529 pid=733 cpus=0 - 1 iwl3945_pci_probe+0xd26/0x1020 [iwl3945] age=114202 pid=126 cpus=1 - 1 patch_ad1981+0x1b/0x1d0 [snd_hda_intel] age=114603 pid=107 cpus=1 - 1 rfkill_allocate+0x24/0xc0 [rfkill] age=114903 pid=215 cpus=0 - 1 fuse_fill_super+0x26d/0x6d0 [fuse] age=76238 pid=2476 cpus=0 + 53 load_module+0x18d5/0x1b30 age=8303006/8368517/8376245 pid=105-2754 cpus=0-1 + 1 mempool_create_node+0x4b/0xf0 age=8370049 pid=916 cpus=0 + 20 sget+0xc4/0x460 age=61397/7958673/8380037 pid=0-13348 cpus=0-1 + 15 alloc_fdtable+0x81/0x160 age=4219/6197046/8357231 pid=1532-12336 cpus=0-1 + 2 journal_init_common+0x1a/0x130 age=8369592/8373942/8378292 pid=1-962 cpus=0 + 15 alloc_disk_node+0x1b/0x120 age=61949/7263912/8379312 pid=1-13295 cpus=0-1 + 1 pci_create_bus+0x3a/0x240 age=8379822 pid=1 cpus=0 + 21 alloc_pci_dev+0x1a/0x40 age=8379818/8379820/8379822 pid=1 cpus=0 + 1 framebuffer_alloc+0x3a/0x80 age=8379737 pid=1 cpus=1 + 74 acpi_add_single_object+0x4e/0xd3c age=8379823/8379836/8379852 pid=1 cpus=0 + 1 acpi_irq_stats_init+0xcb/0x268 age=8379894 pid=1 cpus=0 + 11 pnp_alloc_dev+0x35/0x120 age=8379786/8379789/8379791 pid=1 cpus=0 + 11 init_dev+0x12e/0x6f0 age=7217110/8250882/8378132 pid=33-2593 cpus=0-1 + 3 init_dev+0x2aa/0x6f0 age=7217110/7969221/8364310 pid=1258-2593 cpus=0-1 + 1 tty_register_driver+0x1b3/0x2a0 age=8379706 pid=1 cpus=1 + 2 tty_write+0x160/0x280 age=913316/4463710/8014104 pid=1206-3110 cpus=0 + 2 kobj_map_init+0x22/0xa0 age=8379899/8379968/8380037 pid=0-1 cpus=0 + 3 mousedev_create+0x36/0x2d0 age=53460/5603607/8378947 pid=1-419 cpus=0 + 1 atkbd_connect+0x33/0x290 age=8378940 pid=17 cpus=1 + 2 thermal_zone_device_register+0x6f/0x310 age=8374790/8374807/8374825 pid=329 cpus=0-1 + 15 sk_prot_alloc+0x83/0xb0 age=8328308/8367505/8379903 pid=1-2586 cpus=0-1 + 1 reqsk_queue_alloc+0x112/0x120 age=8356786 pid=1690 cpus=0 + 255 __netdev_alloc_skb+0x1f/0x40 age=8356300/8356301/8356303 pid=1541 cpus=0 + 10 neigh_sysctl_register+0x8d/0x330 age=8360107/8368337/8379760 pid=1-1549 cpus=0-1 + 6 __devinet_sysctl_register+0x74/0x120 age=8373573/8377097/8379760 pid=1-126 cpus=0-1 + 7 pci_add_new_bus+0x25/0x160 age=8379818/8379818/8379820 pid=1 cpus=0 + 1 i8042_create_aux_port+0x36/0x10f age=8378959 pid=1 cpus=0 + 1 i8042_probe+0x190/0x68d age=8378959 pid=1 cpus=0 + 1 netdev_init+0x32/0xc2 age=8379782 pid=1 cpus=0 + 1 netdev_init+0x66/0xc2 age=8379782 pid=1 cpus=0 + 1 fib_net_init+0x21/0x14c age=8379760 pid=1 cpus=0 + 10 usb_alloc_dev+0x36/0x2c0 [usbcore] age=22875/5876181/8374868 pid=143-419 cpus=0-1 + 2 acpi_thermal_add+0x36/0x4bb [thermal] age=8374792/8374809/8374827 pid=329 cpus=0-1 + 5 evdev_open+0xaf/0x1e0 [evdev] age=8364377/8364927/8365226 pid=1443 cpus=0-1 + 8 evdev_connect+0x54/0x1f0 [evdev] age=53452/7334685/8375002 pid=187-419 cpus=0-1 + 1 rtc_device_register+0xa4/0x260 [rtc_core] age=8374707 pid=208 cpus=0 + 1 iwl3945_bg_request_scan+0x5d3/0x660 [iwl3945] age=8356027 pid=733 cpus=0 + 1 iwl3945_pci_probe+0xd26/0x1020 [iwl3945] age=8373700 pid=126 cpus=1 + 1 patch_ad1981+0x1b/0x1d0 [snd_hda_intel] age=8374101 pid=107 cpus=1 + 1 rfkill_allocate+0x24/0xc0 [rfkill] age=8374401 pid=215 cpus=0 + 1 fuse_fill_super+0x26d/0x6d0 [fuse] age=8335736 pid=2476 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-2048/free_calls b/test/sys/kernel/slab/kmalloc-2048/free_calls index 45fb4506e6..9a60610d29 100644 --- a/test/sys/kernel/slab/kmalloc-2048/free_calls +++ b/test/sys/kernel/slab/kmalloc-2048/free_calls @@ -1,15 +1,16 @@ - 426 age=4294787836 pid=0 cpus=0 - 1 __vunmap+0xe9/0x120 age=115015 pid=107 cpus=1 - 75 free_fdtable_rcu+0x71/0xb0 age=46779/105708/118057 pid=0-2139 cpus=0-1 - 2 show_stat+0x50e/0x530 age=4018/52316/100615 pid=1258-1868 cpus=0-1 - 4 acpi_add_single_object+0xc9a/0xd3c age=120326/120333/120341 pid=1 cpus=0 - 20 release_one_tty+0x145/0x190 age=92888/101277/110777 pid=55-2136 cpus=0-1 - 1 atkbd_connect+0x1ae/0x290 age=119425 pid=17 cpus=0 - 7 sk_free+0xcd/0x100 age=96516/98179/101484 pid=1533-1763 cpus=0-1 - 19 skb_release_data+0x85/0xd0 age=38212/80908/120252 pid=0-2812 cpus=0-1 - 4 __scm_destroy+0x41/0x50 age=66746/75662/92916 pid=2135-2593 cpus=0 - 1 huft_build+0x163/0x63e age=120254 pid=1 cpus=0 - 1 inflate_fixed+0x17c/0x193 age=120254 pid=1 cpus=0 - 1 acpi_processor_get_throttling_info+0x2e4/0x58c [processor] age=116146 pid=330 cpus=0 - 1 acpi_thermal_add+0x457/0x4bb [thermal] age=115330 pid=329 cpus=1 - 1 snd_ctl_ioctl+0x2cf/0x960 [snd] age=113601 pid=786 cpus=0 + 424 age=4303047334 pid=0 cpus=0 + 1 __vunmap+0xe9/0x120 age=8374513 pid=107 cpus=1 + 79 free_fdtable_rcu+0x71/0xb0 age=7254/7749386/8377555 pid=0-13365 cpus=0-1 + 4 show_stat+0x50e/0x530 age=23516/2125165/8360113 pid=1258-1868 cpus=0 + 4 acpi_add_single_object+0xc9a/0xd3c age=8379824/8379831/8379839 pid=1 cpus=0 + 20 release_one_tty+0x145/0x190 age=8352386/8360775/8370275 pid=55-2136 cpus=0-1 + 1 atkbd_connect+0x1ae/0x290 age=8378923 pid=17 cpus=0 + 8 sk_free+0xcd/0x100 age=656267/7395001/8360982 pid=1533-12333 cpus=0-1 + 18 skb_release_data+0x85/0xd0 age=61516/7352252/8379750 pid=1-13343 cpus=0-1 + 5 __scm_destroy+0x41/0x50 age=7217111/8111550/8352414 pid=2135-2593 cpus=0-1 + 1 huft_build+0x163/0x63e age=8379752 pid=1 cpus=0 + 1 inflate_fixed+0x17c/0x193 age=8379752 pid=1 cpus=0 + 1 usb_release_dev+0x59/0x70 [usbcore] age=53835 pid=419 cpus=0 + 1 acpi_processor_get_throttling_info+0x2e4/0x58c [processor] age=8375644 pid=330 cpus=0 + 1 acpi_thermal_add+0x457/0x4bb [thermal] age=8374828 pid=329 cpus=1 + 1 snd_ctl_ioctl+0x2cf/0x960 [snd] age=8373099 pid=786 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-2048/objects b/test/sys/kernel/slab/kmalloc-2048/objects index 33f752bd74..af368af278 100644 --- a/test/sys/kernel/slab/kmalloc-2048/objects +++ b/test/sys/kernel/slab/kmalloc-2048/objects @@ -1 +1 @@ -583 +584 diff --git a/test/sys/kernel/slab/kmalloc-2048/objects_partial b/test/sys/kernel/slab/kmalloc-2048/objects_partial index 9902f17848..04f9fe4606 100644 --- a/test/sys/kernel/slab/kmalloc-2048/objects_partial +++ b/test/sys/kernel/slab/kmalloc-2048/objects_partial @@ -1 +1 @@ -28 +59 diff --git a/test/sys/kernel/slab/kmalloc-2048/partial b/test/sys/kernel/slab/kmalloc-2048/partial index 0cfbf08886..7ed6ff82de 100644 --- a/test/sys/kernel/slab/kmalloc-2048/partial +++ b/test/sys/kernel/slab/kmalloc-2048/partial @@ -1 +1 @@ -2 +5 diff --git a/test/sys/kernel/slab/kmalloc-2048/slabs b/test/sys/kernel/slab/kmalloc-2048/slabs index a2720097dc..425151f3a4 100644 --- a/test/sys/kernel/slab/kmalloc-2048/slabs +++ b/test/sys/kernel/slab/kmalloc-2048/slabs @@ -1 +1 @@ -39 +40 diff --git a/test/sys/kernel/slab/kmalloc-2048/total_objects b/test/sys/kernel/slab/kmalloc-2048/total_objects index 6b0823e754..e9f960cf4a 100644 --- a/test/sys/kernel/slab/kmalloc-2048/total_objects +++ b/test/sys/kernel/slab/kmalloc-2048/total_objects @@ -1 +1 @@ -585 +600 diff --git a/test/sys/kernel/slab/kmalloc-256/alloc_calls b/test/sys/kernel/slab/kmalloc-256/alloc_calls index 27ca74cbcc..38a3b680e2 100644 --- a/test/sys/kernel/slab/kmalloc-256/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-256/alloc_calls @@ -1,27 +1,27 @@ - 2 mempool_kmalloc+0x11/0x20 age=120415/120415/120415 pid=1 cpus=0 - 2 __vmalloc_area_node+0xfb/0x140 age=115072/115875/116679 pid=122-126 cpus=0-1 - 32 dma_pool_create+0x90/0x1e0 age=114561/114992/115392 pid=143-147 cpus=0-1 - 28 __percpu_alloc_mask+0xbc/0x140 age=100623/106237/120267 pid=1-1549 cpus=0 - 2 seq_open+0x84/0xa0 age=96267/101416/106566 pid=1371-1738 cpus=0 - 21 inotify_init+0x1b/0x90 age=15233/86291/120265 pid=1-2851 cpus=0-1 - 1 mounts_open_common+0x11e/0x210 age=106331 pid=1371 cpus=0 - 347 __proc_create+0xa5/0x150 age=95801/116341/120553 pid=0-1813 cpus=0-1 - 7 start_this_handle+0x3f5/0x410 age=3715/21705/38514 pid=21-2890 cpus=0-1 - 3 elevator_alloc+0x1b/0xc0 age=38516/92616/119832 pid=1-2761 cpus=0-1 - 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120400/120401/120402 pid=1 cpus=0 - 1 find_dock+0x414/0x426 age=120418 pid=1 cpus=0 - 6 con_insert_unipair+0x96/0x110 age=95521/107886/120252 pid=1-1898 cpus=1 - 6 neigh_resolve_output+0x226/0x2e0 age=64934/69393/79713 pid=0-2401 cpus=0-1 - 1 genl_register_family+0x1b6/0x1e0 age=115501 pid=126 cpus=0 - 5 ip_mc_inc_group+0x6b/0x280 age=65969/92834/108339 pid=1185-1849 cpus=0-1 - 2 cache_add_dev+0x17b/0x546 age=120266/120266/120267 pid=1 cpus=0-1 - 10 audit_register_class+0x1e/0xa1 age=120266/120266/120266 pid=1 cpus=1 - 1 proc_net_ns_init+0x1b/0x81 age=120553 pid=0 cpus=0 - 3 snd_malloc_sgbuf_pages+0xfa/0x1f0 [snd_page_alloc] age=114616/114616/114616 pid=107 cpus=1 - 1 usb_get_configuration+0x18f/0x1480 [usbcore] age=113196 pid=419 cpus=0 - 1 acpi_ac_add+0x3a/0x1b1 [ac] age=116271 pid=392 cpus=0 - 1 acpi_processor_register_performance+0x2a0/0x3a6 [processor] age=106878 pid=1358 cpus=0 - 3 snd_ctl_open+0x8e/0x180 [snd] age=73513/77666/79760 pid=2400-2425 cpus=0 - 8 ieee80211_rx_bss_add+0x4e/0x140 [mac80211] age=95280/95944/96466 pid=0-1951 cpus=0 - 2 ipv6_add_addr+0x199/0x3c0 [ipv6] age=70023/85324/100625 pid=8-1549 cpus=0-1 - 5 ipv6_dev_mc_inc+0x141/0x3f0 [ipv6] age=70023/94503/100625 pid=8-1549 cpus=0-1 + 2 mempool_kmalloc+0x11/0x20 age=8379928/8379928/8379928 pid=1 cpus=0 + 2 __vmalloc_area_node+0xfb/0x140 age=8374585/8375388/8376192 pid=122-126 cpus=0-1 + 32 dma_pool_create+0x90/0x1e0 age=8374074/8374505/8374905 pid=143-147 cpus=0-1 + 28 __percpu_alloc_mask+0xbc/0x140 age=8360136/8365750/8379780 pid=1-1549 cpus=0 + 2 seq_open+0x84/0xa0 age=8355780/8360929/8366079 pid=1371-1738 cpus=0 + 19 inotify_init+0x1b/0x90 age=8333719/8353284/8379778 pid=1-2544 cpus=0-1 + 1 mounts_open_common+0x11e/0x210 age=8365844 pid=1371 cpus=0 + 347 __proc_create+0xa5/0x150 age=8355314/8375854/8380066 pid=0-1813 cpus=0-1 + 6 start_this_handle+0x3f5/0x410 age=4241/38502/142468 pid=21-13466 cpus=0-1 + 3 elevator_alloc+0x1b/0xc0 age=62010/5606790/8379345 pid=1-13295 cpus=0-1 + 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379913/8379914/8379915 pid=1 cpus=0 + 1 find_dock+0x414/0x426 age=8379931 pid=1 cpus=0 + 6 con_insert_unipair+0x96/0x110 age=8355034/8367399/8379765 pid=1-1898 cpus=1 + 2 neigh_resolve_output+0x226/0x2e0 age=1134112/4736669/8339226 pid=0-2401 cpus=0-1 + 1 genl_register_family+0x1b6/0x1e0 age=8375014 pid=126 cpus=0 + 5 ip_mc_inc_group+0x6b/0x280 age=8325482/8352347/8367852 pid=1185-1849 cpus=0-1 + 2 cache_add_dev+0x17b/0x546 age=8379779/8379779/8379780 pid=1 cpus=0-1 + 10 audit_register_class+0x1e/0xa1 age=8379779/8379779/8379779 pid=1 cpus=1 + 1 proc_net_ns_init+0x1b/0x81 age=8380066 pid=0 cpus=0 + 3 snd_malloc_sgbuf_pages+0xfa/0x1f0 [snd_page_alloc] age=8374129/8374129/8374129 pid=107 cpus=1 + 1 usb_get_configuration+0x18f/0x1480 [usbcore] age=8372709 pid=419 cpus=0 + 1 acpi_ac_add+0x3a/0x1b1 [ac] age=8375784 pid=392 cpus=0 + 1 acpi_processor_register_performance+0x2a0/0x3a6 [processor] age=8366391 pid=1358 cpus=0 + 3 snd_ctl_open+0x8e/0x180 [snd] age=8333026/8337179/8339273 pid=2400-2425 cpus=0 + 8 ieee80211_rx_bss_add+0x4e/0x140 [mac80211] age=8354793/8355457/8355979 pid=0-1951 cpus=0 + 2 ipv6_add_addr+0x199/0x3c0 [ipv6] age=8329536/8344837/8360138 pid=8-1549 cpus=0-1 + 5 ipv6_dev_mc_inc+0x141/0x3f0 [ipv6] age=8329536/8354016/8360138 pid=8-1549 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-256/free_calls b/test/sys/kernel/slab/kmalloc-256/free_calls index 72b3b6924c..f919ad9adf 100644 --- a/test/sys/kernel/slab/kmalloc-256/free_calls +++ b/test/sys/kernel/slab/kmalloc-256/free_calls @@ -1,13 +1,12 @@ - 391 age=4294787849 pid=0 cpus=0 - 1 __vunmap+0xe9/0x120 age=115364 pid=107 cpus=1 - 34 do_execve+0x2b1/0x2d0 age=15569/97615/117574 pid=71-2851 cpus=0-1 - 52 seq_release+0x20/0x30 age=3957/100772/116688 pid=105-2851 cpus=0-1 - 1 inotify_destroy+0xcd/0xe0 age=56024 pid=2406 cpus=1 - 3 free_proc_entry+0x73/0x90 age=96765/110129/119478 pid=1-1541 cpus=0 - 10 __journal_drop_transaction+0xe6/0x170 age=12587/77011/106614 pid=32 cpus=0-1 - 1 acpi_pci_irq_add_prt+0xc2/0x324 age=120331 pid=1 cpus=0 - 2 acpi_pci_bind+0x26b/0x28d age=120330/120331/120332 pid=1 cpus=0 - 1 wireless_send_event+0x172/0x330 age=70024 pid=742 cpus=1 - 3 usb_string+0x17c/0x1e0 [usbcore] age=114853/115100/115372 pid=143 cpus=0 - 3 snd_ctl_release+0xf9/0x130 [snd] age=73513/77666/79760 pid=2400-2425 cpus=0 - 1 ieee80211_set_associated+0x421/0x520 [mac80211] age=70024 pid=742 cpus=1 + 389 age=4303047363 pid=0 cpus=0 + 1 __vunmap+0xe9/0x120 age=8374878 pid=107 cpus=1 + 38 do_execve+0x2b1/0x2d0 age=7303/7294190/8377088 pid=71-13465 cpus=0-1 + 51 seq_release+0x20/0x30 age=23541/7877166/8376202 pid=105-2535 cpus=0-1 + 3 free_proc_entry+0x73/0x90 age=8356279/8369643/8378992 pid=1-1541 cpus=0 + 3 __journal_drop_transaction+0xe6/0x170 age=8360317/8363466/8366128 pid=32 cpus=0 + 1 acpi_pci_irq_add_prt+0xc2/0x324 age=8379845 pid=1 cpus=0 + 2 acpi_pci_bind+0x26b/0x28d age=8379844/8379845/8379846 pid=1 cpus=0 + 1 wireless_send_event+0x172/0x330 age=8329538 pid=742 cpus=1 + 3 usb_string+0x17c/0x1e0 [usbcore] age=8374367/8374614/8374886 pid=143 cpus=0 + 3 snd_ctl_release+0xf9/0x130 [snd] age=8333027/8337180/8339274 pid=2400-2425 cpus=0 + 1 ieee80211_set_associated+0x421/0x520 [mac80211] age=8329538 pid=742 cpus=1 diff --git a/test/sys/kernel/slab/kmalloc-256/objects b/test/sys/kernel/slab/kmalloc-256/objects index 4d0e90cbcb..3091e8eea2 100644 --- a/test/sys/kernel/slab/kmalloc-256/objects +++ b/test/sys/kernel/slab/kmalloc-256/objects @@ -1 +1 @@ -512 +504 diff --git a/test/sys/kernel/slab/kmalloc-256/objects_partial b/test/sys/kernel/slab/kmalloc-256/objects_partial index f5c89552bd..abdfb053e4 100644 --- a/test/sys/kernel/slab/kmalloc-256/objects_partial +++ b/test/sys/kernel/slab/kmalloc-256/objects_partial @@ -1 +1 @@ -32 +60 diff --git a/test/sys/kernel/slab/kmalloc-256/partial b/test/sys/kernel/slab/kmalloc-256/partial index 00750edc07..1e8b314962 100644 --- a/test/sys/kernel/slab/kmalloc-256/partial +++ b/test/sys/kernel/slab/kmalloc-256/partial @@ -1 +1 @@ -3 +6 diff --git a/test/sys/kernel/slab/kmalloc-32/alloc_calls b/test/sys/kernel/slab/kmalloc-32/alloc_calls index bd0d696c39..f924b87f08 100644 --- a/test/sys/kernel/slab/kmalloc-32/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-32/alloc_calls @@ -1,51 +1,50 @@ - 1 mtrr_file_add+0xb0/0xe0 age=95993 pid=1738 cpus=0 - 2 arch_acpi_processor_init_pdc+0x8e/0x180 age=116209/116240/116271 pid=330 cpus=0 - 1 pm_qos_add_requirement+0x34/0xe0 age=116562 pid=122 cpus=1 - 59 setup_modinfo_srcversion+0x19/0x30 age=43557/108917/116798 pid=105-2754 cpus=0-1 - 42 load_module+0x1455/0x1b30 age=43557/106794/116314 pid=107-2754 cpus=0-1 - 151 load_module+0x1ac4/0x1b30 age=43553/109353/116792 pid=105-2754 cpus=0-1 - 3 mempool_create_node+0x4b/0xf0 age=38547/92647/119863 pid=1-2761 cpus=0-1 - 1 strndup_user+0x6d/0xc0 age=115407 pid=107 cpus=0 - 16 __vmalloc_area_node+0xfb/0x140 age=68946/106782/116568 pid=107-2578 cpus=0-1 - 1 do_kern_mount+0xca/0x110 age=76282 pid=2476 cpus=0 - 1 alloc_vfsmnt+0x97/0x180 age=76283 pid=2476 cpus=0 - 1 single_open+0x3c/0xb0 age=96298 pid=1738 cpus=0 - 66 sysfs_new_dirent+0x10c/0x120 age=100672/118408/120297 pid=1-1549 cpus=0-1 - 30 do_shmat+0x169/0x410 age=14643/70515/89098 pid=1738-2621 cpus=0-1 - 21 register_blkdev+0x60/0x150 age=110177/118235/120247 pid=1-951 cpus=0-1 - 39 kvasprintf+0x55/0x90 age=100672/118530/120296 pid=1-1549 cpus=0-1 - 7 pci_save_state+0x1a4/0x250 age=114119/118888/120285 pid=1-126 cpus=0-1 - 2 pcim_enable_device+0x86/0xb0 age=119737/119992/120247 pid=1 cpus=0-1 - 15 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120414/120420/120429 pid=1 cpus=0 - 18 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=116237/119726/120431 pid=1-330 cpus=0 - 1 acpi_install_gpe_handler+0xa7/0x13a age=120441 pid=1 cpus=0 - 1 acpi_ev_create_gpe_block+0x282/0x3bf age=120441 pid=1 cpus=0 - 1 acpi_pci_bind_root+0x8d/0x13e age=120365 pid=1 cpus=0 - 18 acpi_pci_bind+0x85/0x28d age=120361/120361/120364 pid=1 cpus=0 - 15 rand_initialize_disk+0x1d/0x30 age=38524/102596/119859 pid=1-2761 cpus=0-1 - 1 ata_host_start+0xcb/0x1e0 age=120246 pid=1 cpus=1 - 1 hidinput_connect+0x2372/0x24e0 age=112800 pid=803 cpus=0 - 1 sock_kmalloc+0x5c/0x70 age=66000 pid=1849 cpus=1 - 2 proto_register+0x7c/0x260 age=100673/110494/120316 pid=1-1549 cpus=0 - 2 neigh_hash_alloc+0x42/0x50 age=65899/67894/69890 pid=0-1849 cpus=1 - 1 nl_pid_hash_rehash+0x180/0x1a0 age=96908 pid=1708 cpus=0 - 28 unix_bind+0xd8/0x3a0 age=96940/97659/107306 pid=1336-1738 cpus=0-1 - 3 ipc_init_proc_interface+0x2e/0x7c age=120287/120287/120287 pid=1 cpus=1 - 13 usb_cache_string+0x65/0xa0 [usbcore] age=49739/89474/115403 pid=143-419 cpus=0-1 - 6 usb_get_configuration+0x18f/0x1480 [usbcore] age=43678/103143/115403 pid=143-419 cpus=0-1 - 2 _snd_ctl_register_ioctl+0x2b/0x80 [snd] age=115157/115157/115157 pid=107 cpus=0 - 2 snd_oss_info_register+0x40/0xc0 [snd] age=95832/95934/96037 pid=1813 cpus=0 - 6 adjust_io+0xeb/0x120 [rsrc_nonstatic] age=113592/113664/114024 pid=352-800 cpus=0 - 5 adjust_memory+0xe5/0x1a0 [rsrc_nonstatic] age=113592/113760/114017 pid=352-800 cpus=0 - 1 ieee80211_sta_set_extra_ie+0x7d/0xe0 [mac80211] age=70079 pid=1545 cpus=0 - 2 ieee80211_rx_bss_info+0x4df/0xa20 [mac80211] age=70652/83265/95879 pid=0 cpus=0 - 2 ieee80211_rx_bss_info+0x568/0xa20 [mac80211] age=10049/52680/95311 pid=742-1951 cpus=0 - 2 ieee80211_rx_bss_info+0x5f7/0xa20 [mac80211] age=10049/53191/96334 pid=742-1772 cpus=0 - 1 rate_control_alloc+0x32/0x110 [mac80211] age=114239 pid=126 cpus=1 - 2 ieee80211_rate_control_register+0x72/0xf0 [mac80211] age=115062/115117/115172 pid=126 cpus=0-1 - 2 azx_probe+0x9a4/0xc20 [snd_hda_intel] age=114647/114647/114647 pid=107 cpus=1 - 1 async_chainiv_givencrypt+0x71/0x110 [crypto_blkcipher] age=115042 pid=215 cpus=0 - 1 run+0x66/0x500 [raid1] age=110596 pid=916 cpus=0 - 1 acpi_cpufreq_cpu_init+0x4d/0x45c [acpi_cpufreq] age=106909 pid=1358 cpus=0 - 1 fib6_net_init+0x39/0x130 [ipv6] age=100657 pid=1549 cpus=0 - 1 storage_probe+0x14e/0x760 [usb_storage] age=43551 pid=2754 cpus=1 + 1 mtrr_file_add+0xb0/0xe0 age=8355511 pid=1738 cpus=0 + 2 arch_acpi_processor_init_pdc+0x8e/0x180 age=8375727/8375758/8375789 pid=330 cpus=0 + 1 pm_qos_add_requirement+0x34/0xe0 age=8376080 pid=122 cpus=1 + 59 setup_modinfo_srcversion+0x19/0x30 age=8303075/8368435/8376316 pid=105-2754 cpus=0-1 + 42 load_module+0x1455/0x1b30 age=8303075/8366312/8375832 pid=107-2754 cpus=0-1 + 151 load_module+0x1ac4/0x1b30 age=8303071/8368871/8376310 pid=105-2754 cpus=0-1 + 3 mempool_create_node+0x4b/0xf0 age=62046/5606826/8379381 pid=1-13295 cpus=0-1 + 1 strndup_user+0x6d/0xc0 age=8374925 pid=107 cpus=0 + 16 __vmalloc_area_node+0xfb/0x140 age=8328464/8366300/8376086 pid=107-2578 cpus=0-1 + 1 do_kern_mount+0xca/0x110 age=8335800 pid=2476 cpus=0 + 1 do_sys_poll+0xdb/0x450 age=1303 pid=1333 cpus=1 + 1 alloc_vfsmnt+0x97/0x180 age=8335801 pid=2476 cpus=0 + 1 single_open+0x3c/0xb0 age=8355816 pid=1738 cpus=0 + 66 sysfs_new_dirent+0x10c/0x120 age=8360190/8377926/8379815 pid=1-1549 cpus=0-1 + 30 do_shmat+0x169/0x410 age=8274161/8330033/8348616 pid=1738-2621 cpus=0-1 + 21 register_blkdev+0x60/0x150 age=8369695/8377753/8379765 pid=1-951 cpus=0-1 + 39 kvasprintf+0x55/0x90 age=8360190/8378048/8379814 pid=1-1549 cpus=0-1 + 7 pci_save_state+0x1a4/0x250 age=8373637/8378406/8379803 pid=1-126 cpus=0-1 + 2 pcim_enable_device+0x86/0xb0 age=8379255/8379510/8379765 pid=1 cpus=0-1 + 15 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379932/8379938/8379947 pid=1 cpus=0 + 21 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=3847501/7731852/8379949 pid=1-330 cpus=0 + 1 acpi_install_gpe_handler+0xa7/0x13a age=8379959 pid=1 cpus=0 + 1 acpi_ev_create_gpe_block+0x282/0x3bf age=8379959 pid=1 cpus=0 + 1 acpi_pci_bind_root+0x8d/0x13e age=8379883 pid=1 cpus=0 + 18 acpi_pci_bind+0x85/0x28d age=8379879/8379879/8379882 pid=1 cpus=0 + 15 rand_initialize_disk+0x1d/0x30 age=62014/7263977/8379377 pid=1-13295 cpus=0-1 + 1 ata_host_start+0xcb/0x1e0 age=8379764 pid=1 cpus=1 + 1 hidinput_connect+0x2372/0x24e0 age=53529 pid=419 cpus=0 + 1 sock_kmalloc+0x5c/0x70 age=8325518 pid=1849 cpus=1 + 2 proto_register+0x7c/0x260 age=8360191/8370012/8379834 pid=1-1549 cpus=0 + 2 neigh_hash_alloc+0x42/0x50 age=8325417/8327412/8329408 pid=0-1849 cpus=1 + 1 nl_pid_hash_rehash+0x180/0x1a0 age=947530 pid=1189 cpus=0 + 28 unix_bind+0xd8/0x3a0 age=8356458/8357177/8366824 pid=1336-1738 cpus=0-1 + 3 ipc_init_proc_interface+0x2e/0x7c age=8379805/8379805/8379805 pid=1 cpus=1 + 13 usb_cache_string+0x65/0xa0 [usbcore] age=22649/4521883/8374921 pid=143-419 cpus=0-1 + 6 usb_get_configuration+0x18f/0x1480 [usbcore] age=67053/6989971/8374921 pid=143-419 cpus=0-1 + 2 _snd_ctl_register_ioctl+0x2b/0x80 [snd] age=8374675/8374675/8374675 pid=107 cpus=0 + 2 snd_oss_info_register+0x40/0xc0 [snd] age=8355350/8355452/8355555 pid=1813 cpus=0 + 6 adjust_io+0xeb/0x120 [rsrc_nonstatic] age=8373110/8373182/8373542 pid=352-800 cpus=0 + 5 adjust_memory+0xe5/0x1a0 [rsrc_nonstatic] age=8373110/8373278/8373535 pid=352-800 cpus=0 + 1 ieee80211_sta_set_extra_ie+0x7d/0xe0 [mac80211] age=8329597 pid=1545 cpus=0 + 2 ieee80211_rx_bss_info+0x4df/0xa20 [mac80211] age=8330170/8342783/8355397 pid=0 cpus=0 + 2 ieee80211_rx_bss_info+0x568/0xa20 [mac80211] age=22736/4188782/8354829 pid=742-1951 cpus=0 + 2 ieee80211_rx_bss_info+0x5f7/0xa20 [mac80211] age=22736/4189294/8355852 pid=742-1772 cpus=0 + 1 rate_control_alloc+0x32/0x110 [mac80211] age=8373757 pid=126 cpus=1 + 2 ieee80211_rate_control_register+0x72/0xf0 [mac80211] age=8374580/8374635/8374690 pid=126 cpus=0-1 + 2 azx_probe+0x9a4/0xc20 [snd_hda_intel] age=8374165/8374165/8374165 pid=107 cpus=1 + 1 async_chainiv_givencrypt+0x71/0x110 [crypto_blkcipher] age=8374560 pid=215 cpus=0 + 1 run+0x66/0x500 [raid1] age=8370114 pid=916 cpus=0 + 1 acpi_cpufreq_cpu_init+0x4d/0x45c [acpi_cpufreq] age=8366427 pid=1358 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-32/free_calls b/test/sys/kernel/slab/kmalloc-32/free_calls index 2e12485b4a..50e82729c9 100644 --- a/test/sys/kernel/slab/kmalloc-32/free_calls +++ b/test/sys/kernel/slab/kmalloc-32/free_calls @@ -1,23 +1,25 @@ - 410 age=4294787880 pid=0 cpus=0 - 4 __vunmap+0xe9/0x120 age=106910/113014/115304 pid=215-1358 cpus=0-1 - 1 vfs_rename+0x301/0x450 age=15253 pid=2851 cpus=0 - 6 do_sys_poll+0x32b/0x450 age=64982/70855/73793 pid=1333 cpus=0-1 - 1 seq_release_private+0x2d/0x60 age=92859 pid=2141 cpus=0 - 6 single_release+0x2e/0x40 age=44059/90095/107370 pid=1258-1868 cpus=0-1 - 1 setxattr+0xa6/0x130 age=96072 pid=1816 cpus=0 - 6 bio_free_map_data+0x25/0x30 age=38546/65872/116479 pid=0-318 cpus=0 - 7 remove_kevent+0x44/0x60 age=67905/71045/87094 pid=2271-2423 cpus=0-1 - 56 load_elf_binary+0xa72/0x1e20 age=16833/100749/117066 pid=102-2849 cpus=0-1 - 1 generic_acl_set+0x15e/0x1a0 age=96072 pid=1816 cpus=0 - 68 kobject_uevent_env+0x11a/0x470 age=38526/110314/120446 pid=1-2761 cpus=0-1 - 2 pci_get_subsys+0x74/0xa0 age=116209/116240/116271 pid=330 cpus=0 - 7 acpi_evaluate_integer+0xbf/0xd1 age=115144/116942/120369 pid=1-341 cpus=0 - 2 acpi_ds_create_operand+0x12c/0x209 age=115326/117848/120370 pid=1-329 cpus=0 - 3 acpi_ns_get_node+0x92/0xa1 age=114928/116769/120441 pid=1-215 cpus=0-1 - 5 acpi_ut_delete_internal_obj+0x15f/0x16f age=106909/114359/116252 pid=330-1358 cpus=0 - 3 acpi_pci_bind+0x277/0x28d age=120362/120362/120364 pid=1 cpus=0 - 1 get_modalias+0xd4/0x120 age=96306 pid=1772 cpus=0 - 1 pci_bus_assign_resources+0xfe/0x4d0 age=120317 pid=1 cpus=0 - 9 usb_get_device_descriptor+0x9b/0xa0 [usbcore] age=43678/99455/115403 pid=143-419 cpus=0-1 - 1 ieee80211_rx_bss_info+0x552/0xa20 [mac80211] age=10049 pid=742 cpus=0 - 2 ieee80211_rx_bss_info+0x5e1/0xa20 [mac80211] age=10049/53191/96334 pid=742-1772 cpus=0 + 409 age=4303047399 pid=0 cpus=0 + 4 __vunmap+0xe9/0x120 age=8366429/8372533/8374823 pid=215-1358 cpus=0-1 + 1 vfs_rename+0x301/0x450 age=8274772 pid=2851 cpus=0 + 8 do_sys_poll+0x32b/0x450 age=1304/6728883/8333312 pid=1333 cpus=0-1 + 1 seq_release_private+0x2d/0x60 age=8352378 pid=2141 cpus=0 + 5 single_release+0x2e/0x40 age=8343903/8358822/8366889 pid=1258-1806 cpus=0 + 1 setxattr+0xa6/0x130 age=8355591 pid=1816 cpus=0 + 6 bio_free_map_data+0x25/0x30 age=53571/4350975/8375998 pid=0-318 cpus=0 + 6 remove_kevent+0x44/0x60 age=7219423/7961750/8346613 pid=2271-2423 cpus=0-1 + 57 load_elf_binary+0xa72/0x1e20 age=22671/8213994/8376585 pid=102-13419 cpus=0-1 + 1 generic_acl_set+0x15e/0x1a0 age=8355591 pid=1816 cpus=0 + 67 kobject_uevent_env+0x11a/0x470 age=62016/8246870/8379965 pid=1-13295 cpus=0-1 + 2 pci_get_subsys+0x74/0xa0 age=8375728/8375759/8375790 pid=330 cpus=0 + 8 acpi_evaluate_integer+0xbf/0xd1 age=3847577/7810351/8379888 pid=1-2097 cpus=0 + 3 acpi_ds_create_operand+0x12c/0x209 age=3847578/6867437/8379889 pid=1-2097 cpus=0 + 3 acpi_ns_get_node+0x92/0xa1 age=8374447/8376288/8379960 pid=1-215 cpus=0-1 + 5 acpi_ut_delete_internal_obj+0x15f/0x16f age=8366428/8373878/8375771 pid=330-1358 cpus=0 + 3 acpi_pci_bind+0x277/0x28d age=8379881/8379881/8379883 pid=1 cpus=0 + 1 get_modalias+0xd4/0x120 age=8355825 pid=1772 cpus=0 + 2 ioctl_standard_iw_point+0x179/0x350 age=63360/84363/105367 pid=1541 cpus=0 + 1 pci_bus_assign_resources+0xfe/0x4d0 age=8379836 pid=1 cpus=0 + 1 sg_clean+0x3e/0x80 [usbcore] age=59566 pid=13294 cpus=0 + 9 usb_get_device_descriptor+0x9b/0xa0 [usbcore] age=22724/6523118/8374922 pid=143-419 cpus=0-1 + 1 ieee80211_rx_bss_info+0x552/0xa20 [mac80211] age=22737 pid=742 cpus=0 + 2 ieee80211_rx_bss_info+0x5e1/0xa20 [mac80211] age=22737/4189295/8355853 pid=742-1772 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-32/objects b/test/sys/kernel/slab/kmalloc-32/objects index 8da60bbdfd..e110e8daae 100644 --- a/test/sys/kernel/slab/kmalloc-32/objects +++ b/test/sys/kernel/slab/kmalloc-32/objects @@ -1 +1 @@ -613 +617 diff --git a/test/sys/kernel/slab/kmalloc-32/objects_partial b/test/sys/kernel/slab/kmalloc-32/objects_partial index fe4afb0df8..15c44e939b 100644 --- a/test/sys/kernel/slab/kmalloc-32/objects_partial +++ b/test/sys/kernel/slab/kmalloc-32/objects_partial @@ -1 +1 @@ -106 +149 diff --git a/test/sys/kernel/slab/kmalloc-32/partial b/test/sys/kernel/slab/kmalloc-32/partial index 00750edc07..b8626c4cff 100644 --- a/test/sys/kernel/slab/kmalloc-32/partial +++ b/test/sys/kernel/slab/kmalloc-32/partial @@ -1 +1 @@ -3 +4 diff --git a/test/sys/kernel/slab/kmalloc-4096/alloc_calls b/test/sys/kernel/slab/kmalloc-4096/alloc_calls index 0593a5cb43..cd1acb03fd 100644 --- a/test/sys/kernel/slab/kmalloc-4096/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-4096/alloc_calls @@ -1,23 +1,23 @@ - 1 load_module+0x18d5/0x1b30 age=116223 pid=330 cpus=0 - 1 __vmalloc_area_node+0xfb/0x140 age=112490 pid=867 cpus=0 - 24 __percpu_alloc_mask+0xbc/0x140 age=100605/103881/120249 pid=1-1549 cpus=0 - 1 seq_read+0x2f0/0x360 age=105770 pid=1371 cpus=0 - 2 ext3_fill_super+0x68/0x1a20 age=110106/114494/118882 pid=1-962 cpus=0 - 4 journal_init_revoke_table+0x4d/0xb0 age=110090/114440/118790 pid=1-962 cpus=0 - 2 journal_init_inode+0x8d/0x130 age=110090/114440/118790 pid=1-962 cpus=0 - 1 fat_fill_super+0x40/0xdd0 age=38126 pid=2817 cpus=1 - 7 scsi_host_alloc+0x35/0x360 age=43504/109092/120197 pid=1-2754 cpus=0-1 - 3 scsi_alloc_sdev+0x6a/0x270 age=38498/92598/119814 pid=1-2761 cpus=0-1 - 8 input_allocate_device+0x1a/0xb0 age=112751/116073/119438 pid=17-803 cpus=0-1 - 1 reqsk_queue_alloc+0x112/0x120 age=95042 pid=1920 cpus=0 - 3 alloc_netdev_mq+0x4f/0x180 age=114071/116178/120273 pid=1-126 cpus=0-1 - 1 pidmap_init+0x15/0x4e age=120535 pid=0 cpus=0 - 1 netlink_proto_init+0x47/0x16b age=120401 pid=1 cpus=0 - 2 acpi_processor_add+0x25/0x6d [processor] age=116160/116191/116222 pid=330 cpus=0 - 1 yenta_probe+0x38/0x6cd [yenta_socket] age=114273 pid=352 cpus=0 - 292 iwl3945_rx_allocate+0xd5/0x160 [iwl3945] age=1410/7094/12982 pid=733 cpus=0 - 1 skcipher_geniv_alloc+0x304/0x3f0 [crypto_blkcipher] age=114879 pid=215 cpus=1 - 2 bitmap_get_counter+0x153/0x220 [md_mod] age=110534/110536/110538 pid=916 cpus=0 - 1 bitmap_create+0x2bc/0xad0 [md_mod] age=110538 pid=916 cpus=0 - 6 __addrconf_sysctl_register+0x7b/0x140 [ipv6] age=100605/100606/100608 pid=1549 cpus=0 - 1 acm_probe+0x34c/0xa50 [cdc_acm] age=49570 pid=2711 cpus=1 + 1 load_module+0x18d5/0x1b30 age=8375716 pid=330 cpus=0 + 1 __vmalloc_area_node+0xfb/0x140 age=8371983 pid=867 cpus=0 + 24 __percpu_alloc_mask+0xbc/0x140 age=8360098/8363374/8379742 pid=1-1549 cpus=0 + 1 seq_read+0x2f0/0x360 age=8365263 pid=1371 cpus=0 + 2 ext3_fill_super+0x68/0x1a20 age=8369599/8373987/8378375 pid=1-962 cpus=0 + 4 journal_init_revoke_table+0x4d/0xb0 age=8369583/8373933/8378283 pid=1-962 cpus=0 + 2 journal_init_inode+0x8d/0x130 age=8369583/8373933/8378283 pid=1-962 cpus=0 + 1 fat_fill_super+0x40/0xdd0 age=61388 pid=13348 cpus=1 + 7 scsi_host_alloc+0x35/0x360 age=66976/7192011/8379690 pid=1-419 cpus=0-1 + 3 scsi_alloc_sdev+0x6a/0x270 age=61972/5606752/8379307 pid=1-13295 cpus=0-1 + 8 input_allocate_device+0x1a/0xb0 age=53455/7335718/8378931 pid=17-419 cpus=0-1 + 1 reqsk_queue_alloc+0x112/0x120 age=8354535 pid=1920 cpus=0 + 3 alloc_netdev_mq+0x4f/0x180 age=8373564/8375671/8379766 pid=1-126 cpus=0-1 + 1 pidmap_init+0x15/0x4e age=8380028 pid=0 cpus=0 + 1 netlink_proto_init+0x47/0x16b age=8379894 pid=1 cpus=0 + 2 acpi_processor_add+0x25/0x6d [processor] age=8375653/8375684/8375715 pid=330 cpus=0 + 1 yenta_probe+0x38/0x6cd [yenta_socket] age=8373766 pid=352 cpus=0 + 281 iwl3945_rx_allocate+0xd5/0x160 [iwl3945] age=2011/7577/13684 pid=733 cpus=0 + 1 skcipher_geniv_alloc+0x304/0x3f0 [crypto_blkcipher] age=8374372 pid=215 cpus=1 + 2 bitmap_get_counter+0x153/0x220 [md_mod] age=8370027/8370029/8370031 pid=916 cpus=0 + 1 bitmap_create+0x2bc/0xad0 [md_mod] age=8370031 pid=916 cpus=0 + 6 __addrconf_sysctl_register+0x7b/0x140 [ipv6] age=8360098/8360099/8360101 pid=1549 cpus=0 + 1 acm_probe+0x34c/0xa50 [cdc_acm] age=22641 pid=419 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-4096/free_calls b/test/sys/kernel/slab/kmalloc-4096/free_calls index 2284bcc619..a0d77b9afc 100644 --- a/test/sys/kernel/slab/kmalloc-4096/free_calls +++ b/test/sys/kernel/slab/kmalloc-4096/free_calls @@ -1,7 +1,7 @@ - 200 age=4294787831 pid=0 cpus=0 - 7 seq_release+0x18/0x30 age=8616/76360/115289 pid=107-2815 cpus=0-1 - 1 cryptomgr_probe+0x81/0xf0 age=114071 pid=745 cpus=0 - 30 kobject_uevent_env+0x122/0x470 age=43504/111192/120401 pid=1-2754 cpus=0-1 - 1 show_uevent+0xee/0x110 age=1412 pid=2890 cpus=0 - 1 input_dev_release+0x23/0x40 age=119420 pid=17 cpus=0 - 126 skb_release_data+0x85/0xd0 age=1410/8633/95042 pid=0-2890 cpus=0 + 187 age=4303047324 pid=0 cpus=0 + 5 seq_release+0x18/0x30 age=61430/6709712/8374782 pid=107-1371 cpus=0-1 + 1 cryptomgr_probe+0x81/0xf0 age=8373564 pid=745 cpus=0 + 30 kobject_uevent_env+0x122/0x470 age=22643/7542644/8379894 pid=1-1549 cpus=0-1 + 1 show_uevent+0xee/0x110 age=2013 pid=13466 cpus=0 + 1 input_dev_release+0x23/0x40 age=8378913 pid=17 cpus=0 + 130 skb_release_data+0x85/0xd0 age=2011/73374/8354535 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-4096/objects b/test/sys/kernel/slab/kmalloc-4096/objects index 67bf40fe17..526204c865 100644 --- a/test/sys/kernel/slab/kmalloc-4096/objects +++ b/test/sys/kernel/slab/kmalloc-4096/objects @@ -1 +1 @@ -371 +367 diff --git a/test/sys/kernel/slab/kmalloc-4096/objects_partial b/test/sys/kernel/slab/kmalloc-4096/objects_partial index 7f8f011eb7..98d9bcb75a 100644 --- a/test/sys/kernel/slab/kmalloc-4096/objects_partial +++ b/test/sys/kernel/slab/kmalloc-4096/objects_partial @@ -1 +1 @@ -7 +17 diff --git a/test/sys/kernel/slab/kmalloc-4096/partial b/test/sys/kernel/slab/kmalloc-4096/partial index 0cfbf08886..7ed6ff82de 100644 --- a/test/sys/kernel/slab/kmalloc-4096/partial +++ b/test/sys/kernel/slab/kmalloc-4096/partial @@ -1 +1 @@ -2 +5 diff --git a/test/sys/kernel/slab/kmalloc-4096/slabs b/test/sys/kernel/slab/kmalloc-4096/slabs index fb1e7bc869..c3f407c095 100644 --- a/test/sys/kernel/slab/kmalloc-4096/slabs +++ b/test/sys/kernel/slab/kmalloc-4096/slabs @@ -1 +1 @@ -54 +55 diff --git a/test/sys/kernel/slab/kmalloc-4096/total_objects b/test/sys/kernel/slab/kmalloc-4096/total_objects index 61ab674d69..df90c3c76c 100644 --- a/test/sys/kernel/slab/kmalloc-4096/total_objects +++ b/test/sys/kernel/slab/kmalloc-4096/total_objects @@ -1 +1 @@ -378 +385 diff --git a/test/sys/kernel/slab/kmalloc-512/alloc_calls b/test/sys/kernel/slab/kmalloc-512/alloc_calls index c42c806be8..bfbfb0327d 100644 --- a/test/sys/kernel/slab/kmalloc-512/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-512/alloc_calls @@ -1,54 +1,52 @@ - 14 __register_sysctl_paths+0x56/0x340 age=100617/113006/120280 pid=1-1549 cpus=0 - 14 param_sysfs_setup+0x87/0x140 age=95801/116155/120411 pid=1-1813 cpus=0-1 - 59 module_add_modinfo_attrs+0x25/0xf0 age=43517/108876/116756 pid=105-2754 cpus=0-1 - 2 __vmalloc_area_node+0xfb/0x140 age=115142/115788/116434 pid=126-144 cpus=0 - 1 dma_kmalloc_cache+0xca/0x150 age=116268 pid=163 cpus=0 - 107 kmem_cache_create+0x4e/0x2e0 age=100622/118194/120548 pid=0-1549 cpus=0-1 - 2 __percpu_alloc_mask+0xbc/0x140 age=120260/120260/120260 pid=1 cpus=1 - 19 sys_inotify_init1+0xaa/0x220 age=15228/82710/117133 pid=72-2851 cpus=0-1 - 4 sys_epoll_create1+0x41/0x100 age=95473/96627/97297 pid=1690-1920 cpus=0-1 - 2 __crypto_alloc_tfm+0x43/0x1b0 age=114084/114084/114084 pid=126 cpus=1 - 1 crypto_alloc_instance+0x2b/0xe0 age=114084 pid=745 cpus=0 - 3 elevator_alloc+0x67/0xc0 age=38511/92611/119827 pid=1-2761 cpus=0-1 - 3 cfq_init_queue+0x1b/0x120 age=38511/92611/119827 pid=1-2761 cpus=0-1 - 1 fb_alloc_cmap+0x66/0x150 age=120248 pid=1 cpus=1 - 1 fb_alloc_cmap+0x81/0x150 age=120248 pid=1 cpus=1 - 1 fb_alloc_cmap+0x9c/0x150 age=120248 pid=1 cpus=1 - 1 fbcon_startup+0xd6/0x2f0 age=120247 pid=1 cpus=1 - 1 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120388 pid=1 cpus=0 - 1 make_acpi_ec+0x1a/0xcb age=120405 pid=1 cpus=0 - 1 acpi_irq_stats_init+0x83/0x268 age=120405 pid=1 cpus=0 - 1 acpi_irq_stats_init+0xa7/0x268 age=120405 pid=1 cpus=0 - 5 alloc_tty_driver+0x1c/0x40 age=49583/106087/120217 pid=1-2711 cpus=1 - 2 vt_ioctl+0x1874/0x1c30 age=97105/97105/97105 pid=1703 cpus=0 - 8 set_inverse_transl+0xa0/0xb0 age=95516/107881/120247 pid=1-1898 cpus=1 - 2 con_clear_unimap+0x2a/0xd0 age=95516/107881/120247 pid=1-1898 cpus=1 - 7 vc_allocate+0x99/0x1b0 age=97055/99240/108733 pid=1135-1729 cpus=0-1 - 1 hpet_alloc+0x6b/0x3c0 age=120290 pid=1 cpus=0 - 4 uart_open+0x36c/0x4b0 age=109337/109406/109612 pid=1059-1073 cpus=0-1 - 43 bus_add_driver+0x4f/0x280 age=43517/114334/120333 pid=1-2754 cpus=0-1 - 9 bus_register+0x35/0x290 age=113926/119187/120415 pid=1-770 cpus=0-1 - 30 __class_register+0x28/0x1e0 age=115015/118591/120414 pid=1-352 cpus=0-1 - 1 mousedev_open+0xc8/0x1d0 age=94761 pid=1738 cpus=0 - 1 cpufreq_add_dev+0x8f/0x5c0 age=106873 pid=1358 cpus=0 - 4 sock_alloc_send_skb+0x1cd/0x200 age=71255/83196/91238 pid=1738 cpus=0-1 - 1 alloc_netdev_mq+0x6c/0x180 age=114204 pid=126 cpus=1 - 4 inetdev_init+0x28/0x190 age=114084/116276/120271 pid=1-126 cpus=0-1 - 2 fib_hash_table+0x1c/0x80 age=120271/120271/120271 pid=1 cpus=0 - 1 ioapic_init_sysfs+0x74/0xcf age=120261 pid=1 cpus=1 - 3 snd_malloc_sgbuf_pages+0xbe/0x1f0 [snd_page_alloc] age=114611/114611/114611 pid=107 cpus=1 - 1 usb_get_configuration+0x18f/0x1480 [usbcore] age=49725 pid=419 cpus=0 - 1 usb_get_configuration+0x5f2/0x1480 [usbcore] age=113184 pid=419 cpus=0 - 2 acpi_processor_get_throttling_info+0x21f/0x58c [processor] age=116154/116178/116202 pid=330 cpus=0 - 48 snd_info_create_entry+0x1b/0xa0 [snd] age=95796/111649/115359 pid=107-1813 cpus=0-1 - 4 snd_timer_new+0x40/0x190 [snd_timer] age=114589/114754/115249 pid=107 cpus=1 - 2 ieee80211_key_alloc+0x37/0xe0 [mac80211] age=68908/68959/69011 pid=1545 cpus=0 - 3 snd_pcm_new_stream+0x161/0x520 [snd_pcm] age=114611/114611/114611 pid=107 cpus=1 - 1 snd_hda_bus_new+0x31/0xf4 [snd_hda_intel] age=114614 pid=107 cpus=1 - 1 crypto_blkcipher_type+0x54/0xffffffffffffff8e [crypto_blkcipher] age=114942 pid=215 cpus=0 - 1 md_import_device+0x32/0x290 [md_mod] age=110602 pid=916 cpus=0 - 1 bitmap_create+0x5e/0xad0 [md_mod] age=110558 pid=916 cpus=0 - 1 run+0x42/0x500 [raid1] age=110560 pid=916 cpus=0 - 1 ip6_route_net_init+0x4d/0xd0 [ipv6] age=100622 pid=1549 cpus=0 - 1 ipv6_sysctl_net_init+0x34/0xd0 [ipv6] age=100617 pid=1549 cpus=0 - 1 seq_create_client1+0x24/0x180 [snd_seq] age=96051 pid=1805 cpus=0 + 14 __register_sysctl_paths+0x56/0x340 age=8360125/8372514/8379788 pid=1-1549 cpus=0 + 14 param_sysfs_setup+0x87/0x140 age=8355309/8375663/8379919 pid=1-1813 cpus=0-1 + 59 module_add_modinfo_attrs+0x25/0xf0 age=8303025/8368384/8376264 pid=105-2754 cpus=0-1 + 2 __vmalloc_area_node+0xfb/0x140 age=8374650/8375296/8375942 pid=126-144 cpus=0 + 1 dma_kmalloc_cache+0xca/0x150 age=8375776 pid=163 cpus=0 + 107 kmem_cache_create+0x4e/0x2e0 age=8360130/8377702/8380056 pid=0-1549 cpus=0-1 + 2 __percpu_alloc_mask+0xbc/0x140 age=8379768/8379768/8379768 pid=1 cpus=1 + 17 sys_inotify_init1+0xaa/0x220 age=8333709/8350157/8376641 pid=72-2544 cpus=0-1 + 4 sys_epoll_create1+0x41/0x100 age=2416994/6871289/8356805 pid=1690-20296 cpus=0-1 + 2 __crypto_alloc_tfm+0x43/0x1b0 age=8373592/8373592/8373592 pid=126 cpus=1 + 1 crypto_alloc_instance+0x2b/0xe0 age=8373592 pid=745 cpus=0 + 3 elevator_alloc+0x67/0xc0 age=62000/5606780/8379335 pid=1-13295 cpus=0-1 + 3 cfq_init_queue+0x1b/0x120 age=62000/5606780/8379335 pid=1-13295 cpus=0-1 + 1 fb_alloc_cmap+0x66/0x150 age=8379756 pid=1 cpus=1 + 1 fb_alloc_cmap+0x81/0x150 age=8379756 pid=1 cpus=1 + 1 fb_alloc_cmap+0x9c/0x150 age=8379756 pid=1 cpus=1 + 1 fbcon_startup+0xd6/0x2f0 age=8379755 pid=1 cpus=1 + 1 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379896 pid=1 cpus=0 + 1 make_acpi_ec+0x1a/0xcb age=8379913 pid=1 cpus=0 + 1 acpi_irq_stats_init+0x83/0x268 age=8379913 pid=1 cpus=0 + 1 acpi_irq_stats_init+0xa7/0x268 age=8379913 pid=1 cpus=0 + 5 alloc_tty_driver+0x1c/0x40 age=8309091/8365595/8379725 pid=1-2711 cpus=1 + 2 vt_ioctl+0x1874/0x1c30 age=8356613/8356613/8356613 pid=1703 cpus=0 + 8 set_inverse_transl+0xa0/0xb0 age=8355024/8367389/8379755 pid=1-1898 cpus=1 + 2 con_clear_unimap+0x2a/0xd0 age=8355024/8367389/8379755 pid=1-1898 cpus=1 + 7 vc_allocate+0x99/0x1b0 age=8356563/8358748/8368241 pid=1135-1729 cpus=0-1 + 1 hpet_alloc+0x6b/0x3c0 age=8379798 pid=1 cpus=0 + 4 uart_open+0x36c/0x4b0 age=8368845/8368914/8369120 pid=1059-1073 cpus=0-1 + 43 bus_add_driver+0x4f/0x280 age=8303025/8373842/8379841 pid=1-2754 cpus=0-1 + 9 bus_register+0x35/0x290 age=8373434/8378695/8379923 pid=1-770 cpus=0-1 + 30 __class_register+0x28/0x1e0 age=8374523/8378099/8379922 pid=1-352 cpus=0-1 + 1 mousedev_open+0xc8/0x1d0 age=8354269 pid=1738 cpus=0 + 1 cpufreq_add_dev+0x8f/0x5c0 age=8366381 pid=1358 cpus=0 + 4 sock_alloc_send_skb+0x1cd/0x200 age=8330763/8342704/8350746 pid=1738 cpus=0-1 + 1 alloc_netdev_mq+0x6c/0x180 age=8373712 pid=126 cpus=1 + 4 inetdev_init+0x28/0x190 age=8373592/8375784/8379779 pid=1-126 cpus=0-1 + 2 fib_hash_table+0x1c/0x80 age=8379779/8379779/8379779 pid=1 cpus=0 + 1 ioapic_init_sysfs+0x74/0xcf age=8379769 pid=1 cpus=1 + 3 snd_malloc_sgbuf_pages+0xbe/0x1f0 [snd_page_alloc] age=8374119/8374119/8374119 pid=107 cpus=1 + 1 usb_get_configuration+0x18f/0x1480 [usbcore] age=22677 pid=419 cpus=0 + 1 usb_get_configuration+0x5f2/0x1480 [usbcore] age=8372692 pid=419 cpus=0 + 2 acpi_processor_get_throttling_info+0x21f/0x58c [processor] age=8375662/8375686/8375710 pid=330 cpus=0 + 48 snd_info_create_entry+0x1b/0xa0 [snd] age=8355304/8371157/8374867 pid=107-1813 cpus=0-1 + 4 snd_timer_new+0x40/0x190 [snd_timer] age=8374097/8374262/8374757 pid=107 cpus=1 + 2 ieee80211_key_alloc+0x37/0xe0 [mac80211] age=3544694/3544694/3544694 pid=1545 cpus=0 + 3 snd_pcm_new_stream+0x161/0x520 [snd_pcm] age=8374119/8374119/8374119 pid=107 cpus=1 + 1 snd_hda_bus_new+0x31/0xf4 [snd_hda_intel] age=8374122 pid=107 cpus=1 + 1 crypto_blkcipher_type+0x54/0xffffffffffffff8e [crypto_blkcipher] age=8374450 pid=215 cpus=0 + 1 md_import_device+0x32/0x290 [md_mod] age=8370110 pid=916 cpus=0 + 1 bitmap_create+0x5e/0xad0 [md_mod] age=8370066 pid=916 cpus=0 + 1 run+0x42/0x500 [raid1] age=8370068 pid=916 cpus=0 + 1 ip6_route_net_init+0x4d/0xd0 [ipv6] age=8360130 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-512/free_calls b/test/sys/kernel/slab/kmalloc-512/free_calls index fb63668d03..088fbc7448 100644 --- a/test/sys/kernel/slab/kmalloc-512/free_calls +++ b/test/sys/kernel/slab/kmalloc-512/free_calls @@ -1,10 +1,10 @@ - 163 age=4294787844 pid=0 cpus=0 - 4 __vunmap+0xe9/0x120 age=115006/115810/116670 pid=122-215 cpus=0 - 1 kmem_cache_shrink+0x5d/0x1b0 age=120363 pid=1 cpus=0 - 34 load_elf_binary+0xa7e/0x1e20 age=15243/103227/117708 pid=62-2878 cpus=0-1 - 20 load_elf_binary+0xc37/0x1e20 age=15243/106540/116862 pid=197-2878 cpus=0-1 - 1 crypto_larval_destroy+0x2b/0x40 age=114084 pid=126 cpus=1 - 210 skb_release_data+0x85/0xd0 age=38729/109272/120414 pid=0-2743 cpus=0-1 - 1 acpi_processor_get_power_info+0x2eb/0x569 [processor] age=116152 pid=330 cpus=1 - 1 skcipher_geniv_alloc+0xea/0x3f0 [crypto_blkcipher] age=114969 pid=215 cpus=0 - 1 snd_mixer_oss_build_input+0x402/0x5c0 [snd_mixer_oss] age=96000 pid=1813 cpus=0 + 163 age=4303047353 pid=0 cpus=0 + 4 __vunmap+0xe9/0x120 age=8374515/8375319/8376179 pid=122-215 cpus=0 + 1 kmem_cache_shrink+0x5d/0x1b0 age=8379872 pid=1 cpus=0 + 33 load_elf_binary+0xa7e/0x1e20 age=8303117/8365402/8377217 pid=62-2754 cpus=0-1 + 19 load_elf_binary+0xc37/0x1e20 age=8355044/8370854/8376371 pid=197-1912 cpus=0-1 + 1 crypto_larval_destroy+0x2b/0x40 age=8373593 pid=126 cpus=1 + 210 skb_release_data+0x85/0xd0 age=22792/8177097/8379923 pid=1-20296 cpus=0-1 + 1 acpi_processor_get_power_info+0x2eb/0x569 [processor] age=8375661 pid=330 cpus=1 + 1 skcipher_geniv_alloc+0xea/0x3f0 [crypto_blkcipher] age=8374478 pid=215 cpus=0 + 1 snd_mixer_oss_build_input+0x402/0x5c0 [snd_mixer_oss] age=8355509 pid=1813 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-512/objects b/test/sys/kernel/slab/kmalloc-512/objects index 658bd780ab..6a13cf62b5 100644 --- a/test/sys/kernel/slab/kmalloc-512/objects +++ b/test/sys/kernel/slab/kmalloc-512/objects @@ -1 +1 @@ -459 +443 diff --git a/test/sys/kernel/slab/kmalloc-512/objects_partial b/test/sys/kernel/slab/kmalloc-512/objects_partial index 5595fa46c0..85322d0b54 100644 --- a/test/sys/kernel/slab/kmalloc-512/objects_partial +++ b/test/sys/kernel/slab/kmalloc-512/objects_partial @@ -1 +1 @@ -95 +79 diff --git a/test/sys/kernel/slab/kmalloc-64/alloc_calls b/test/sys/kernel/slab/kmalloc-64/alloc_calls index a4ed25bfb1..2dfc805081 100644 --- a/test/sys/kernel/slab/kmalloc-64/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-64/alloc_calls @@ -1,54 +1,51 @@ - 30 alternatives_smp_module_add+0x81/0x160 age=43548/108890/120578 pid=0-2754 cpus=0-1 - 39 __request_region+0x39/0x120 age=114304/118766/120442 pid=1-352 cpus=0-1 - 1 audit_log_start+0x353/0x3f0 age=120290 pid=1 cpus=1 - 16 request_irq+0x9a/0xf0 age=96772/114498/120435 pid=1-1541 cpus=0-1 - 3 devm_request_irq+0x4b/0xc0 age=119725/119896/120240 pid=1 cpus=0-1 - 1 strndup_user+0x6d/0xc0 age=115038 pid=215 cpus=0 - 95 __get_vm_area_node+0x9b/0x220 age=43551/112044/120578 pid=0-2754 cpus=0-1 - 17 __vmalloc_area_node+0xfb/0x140 age=49618/106962/116792 pid=105-2711 cpus=0-1 - 1 add_swap_extent+0x57/0xc0 age=112532 pid=867 cpus=0 - 33 dma_pool_alloc+0x6d/0x200 age=49613/81264/115397 pid=143-2711 cpus=0-1 - 40 alloc_kmem_cache_cpu+0x81/0x90 age=100652/108515/120280 pid=1-1549 cpus=0-1 - 164 __percpu_alloc_mask+0x52/0x140 age=38518/109529/120578 pid=0-2761 cpus=0-1 - 184 __percpu_alloc_mask+0xbc/0x140 age=38541/109884/120578 pid=0-2761 cpus=0-1 - 1 do_sys_poll+0xdb/0x450 age=569 pid=1333 cpus=0 - 582 d_alloc+0x19d/0x1f0 age=37270/93183/116955 pid=72-2818 cpus=0-1 - 15 alloc_fdtable+0x57/0x160 age=3825/81315/97772 pid=1532-2676 cpus=0-1 - 15 alloc_fdtable+0xb4/0x160 age=3825/81315/97772 pid=1532-2676 cpus=0-1 - 1 bioset_create+0x21/0xc0 age=120440 pid=1 cpus=0 - 1 bd_claim_by_disk+0x6f/0x270 age=110624 pid=916 cpus=0 - 14 posix_acl_alloc+0x1b/0x30 age=92649/92660/92673 pid=2175 cpus=0 - 5 proc_reg_open+0x3f/0x170 age=96292/101761/107248 pid=1327-1738 cpus=0 - 5268 ext3_init_block_alloc_info+0x22/0x80 age=1/2342/110222 pid=1-2890 cpus=0-1 - 4 ext3_readdir+0x617/0x650 age=92557/92572/92607 pid=1370 cpus=0 - 8 ext3_htree_store_dirent+0x37/0x130 age=92557/92565/92592 pid=1370 cpus=0 - 277 kobject_create+0x1a/0x40 age=38517/108164/120578 pid=0-2761 cpus=0-1 - 1 pci_create_sysfs_dev_files+0x23e/0x3b0 age=119430 pid=1 cpus=0 - 11 acpi_os_validate_address+0x3d/0xa3 age=120407/120420/120425 pid=1 cpus=0 - 120 acpi_ds_build_internal_package_obj+0xaf/0x1df age=116231/120069/120429 pid=1-330 cpus=0 - 6 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120413/120418/120427 pid=1 cpus=0 - 1 acpi_ev_system_memory_region_setup+0x68/0x8f age=120407 pid=1 cpus=0 - 3 acpi_add_single_object+0x596/0xd3c age=120371/120373/120375 pid=1 cpus=0 - 3 acpi_add_single_object+0x5d8/0xd3c age=120379/120381/120383 pid=1 cpus=0 - 27 acpi_add_single_object+0x9f7/0xd3c age=120364/120381/120393 pid=1 cpus=0 - 55 acpi_ec_add_query_handler+0x31/0x91 age=120363/120363/120363 pid=1 cpus=0 - 1 find_dock+0x2c9/0x426 age=120443 pid=1 cpus=0 - 6 find_dock_devices+0x5e/0x92 age=120443/120443/120443 pid=1 cpus=0 - 8 acpi_pci_link_add+0x32/0x1db age=120336/120337/120339 pid=1 cpus=0 - 39 acpi_pci_irq_add_prt+0x181/0x324 age=120355/120356/120358 pid=1 cpus=0 - 14 init_dev+0x3c8/0x6f0 age=66785/98982/118673 pid=33-2593 cpus=0-1 - 14 init_dev+0x437/0x6f0 age=66785/98982/118673 pid=33-2593 cpus=0-1 - 2 init_dev+0x5b2/0x6f0 age=66785/85818/104851 pid=1258-2593 cpus=0 - 2 init_dev+0x637/0x6f0 age=66785/85818/104851 pid=1258-2593 cpus=0 - 2 kobj_map_init+0x36/0xa0 age=120440/120509/120578 pid=0-1 cpus=0 - 38 kobj_map+0x79/0x1a0 age=38518/110104/120440 pid=1-2761 cpus=0-1 - 3 dmam_alloc_coherent+0x3f/0xa0 age=119725/119896/120240 pid=1 cpus=0-1 - 1 scsi_probe_and_add_lun+0x65e/0xd80 age=38540 pid=2761 cpus=0 - 170 scsi_dev_info_list_add+0x3d/0x120 age=120324/120324/120324 pid=1 cpus=0 - 1 ahci_init_one+0x137/0xcb0 age=120241 pid=1 cpus=1 - 1 cpufreq_stat_notifier_policy+0xa1/0x2e0 age=106903 pid=1358 cpus=0 - 1 cpufreq_stat_notifier_policy+0x17e/0x2e0 age=106903 pid=1358 cpus=0 - 1 hid_parse_report+0xa9/0x2c0 age=112794 pid=803 cpus=0 - 10 __dev_addr_add+0x69/0xe0 age=65994/85989/100649 pid=8-1849 cpus=0-1 - 1 genl_register_family+0x1b6/0x1e0 age=120323 pid=1 cpus=0 - 2 fib_hash_alloc+0x45/0x50 age=65995/65995/65995 pid=1541 cpus=1 + 30 alternatives_smp_module_add+0x81/0x160 age=8303055/8368397/8380085 pid=0-2754 cpus=0-1 + 39 __request_region+0x39/0x120 age=8373811/8378273/8379949 pid=1-352 cpus=0-1 + 1 audit_log_start+0x353/0x3f0 age=8379797 pid=1 cpus=1 + 16 request_irq+0x9a/0xf0 age=8356279/8374005/8379942 pid=1-1541 cpus=0-1 + 3 devm_request_irq+0x4b/0xc0 age=8379232/8379403/8379747 pid=1 cpus=0-1 + 1 strndup_user+0x6d/0xc0 age=8374545 pid=215 cpus=0 + 95 __get_vm_area_node+0x9b/0x220 age=8303058/8371551/8380085 pid=0-2754 cpus=0-1 + 17 __vmalloc_area_node+0xfb/0x140 age=8309125/8366469/8376299 pid=105-2711 cpus=0-1 + 1 add_swap_extent+0x57/0xc0 age=8372039 pid=867 cpus=0 + 33 dma_pool_alloc+0x6d/0x200 age=8309120/8340771/8374904 pid=143-2711 cpus=0-1 + 40 alloc_kmem_cache_cpu+0x81/0x90 age=8360159/8368022/8379787 pid=1-1549 cpus=0-1 + 164 __percpu_alloc_mask+0x52/0x140 age=61997/8067718/8380085 pid=0-13295 cpus=0-1 + 184 __percpu_alloc_mask+0xbc/0x140 age=62029/8100825/8380085 pid=0-13295 cpus=0-1 + 604 d_alloc+0x19d/0x1f0 age=22685/7859083/8376462 pid=72-24701 cpus=0-1 + 17 alloc_fdtable+0x57/0x160 age=4267/6101781/8357279 pid=1532-12336 cpus=0-1 + 17 alloc_fdtable+0xb4/0x160 age=4267/6101781/8357279 pid=1532-12336 cpus=0-1 + 1 bioset_create+0x21/0xc0 age=8379947 pid=1 cpus=0 + 1 bd_claim_by_disk+0x6f/0x270 age=8370131 pid=916 cpus=0 + 14 posix_acl_alloc+0x1b/0x30 age=53326/7759393/8352180 pid=2175-13390 cpus=0-1 + 5 proc_reg_open+0x3f/0x170 age=8355799/8361268/8366755 pid=1327-1738 cpus=0 + 12754 ext3_init_block_alloc_info+0x22/0x80 age=1/498494/8368528 pid=1-23373 cpus=0-1 + 4 ext3_readdir+0x617/0x650 age=8352064/8352079/8352114 pid=1370 cpus=0 + 8 ext3_htree_store_dirent+0x37/0x130 age=8352064/8352072/8352099 pid=1370 cpus=0 + 277 kobject_create+0x1a/0x40 age=22618/7771015/8380085 pid=0-13295 cpus=0-1 + 1 pci_create_sysfs_dev_files+0x23e/0x3b0 age=8378937 pid=1 cpus=0 + 11 acpi_os_validate_address+0x3d/0xa3 age=8379914/8379927/8379932 pid=1 cpus=0 + 124 acpi_ds_build_internal_package_obj+0xaf/0x1df age=3847484/8233379/8379936 pid=1-330 cpus=0 + 6 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379920/8379925/8379934 pid=1 cpus=0 + 1 acpi_ev_system_memory_region_setup+0x68/0x8f age=8379914 pid=1 cpus=0 + 3 acpi_add_single_object+0x596/0xd3c age=8379878/8379880/8379882 pid=1 cpus=0 + 3 acpi_add_single_object+0x5d8/0xd3c age=8379886/8379888/8379890 pid=1 cpus=0 + 27 acpi_add_single_object+0x9f7/0xd3c age=8379871/8379888/8379900 pid=1 cpus=0 + 55 acpi_ec_add_query_handler+0x31/0x91 age=8379870/8379870/8379870 pid=1 cpus=0 + 1 find_dock+0x2c9/0x426 age=8379950 pid=1 cpus=0 + 6 find_dock_devices+0x5e/0x92 age=8379950/8379950/8379950 pid=1 cpus=0 + 8 acpi_pci_link_add+0x32/0x1db age=8379843/8379844/8379846 pid=1 cpus=0 + 39 acpi_pci_irq_add_prt+0x181/0x324 age=8379862/8379863/8379865 pid=1 cpus=0 + 15 init_dev+0x3c8/0x6f0 age=7217158/8282400/8378180 pid=33-2593 cpus=0-1 + 15 init_dev+0x437/0x6f0 age=7217158/8282400/8378180 pid=33-2593 cpus=0-1 + 3 init_dev+0x5b2/0x6f0 age=7217158/7969269/8364358 pid=1258-2593 cpus=0-1 + 3 init_dev+0x637/0x6f0 age=7217158/7969269/8364358 pid=1258-2593 cpus=0-1 + 2 kobj_map_init+0x36/0xa0 age=8379947/8380016/8380085 pid=0-1 cpus=0 + 38 kobj_map+0x79/0x1a0 age=61997/7936136/8379947 pid=1-13295 cpus=0-1 + 3 dmam_alloc_coherent+0x3f/0xa0 age=8379232/8379403/8379747 pid=1 cpus=0-1 + 1 scsi_probe_and_add_lun+0x65e/0xd80 age=62028 pid=13295 cpus=0 + 170 scsi_dev_info_list_add+0x3d/0x120 age=8379831/8379831/8379831 pid=1 cpus=0 + 1 ahci_init_one+0x137/0xcb0 age=8379748 pid=1 cpus=1 + 1 cpufreq_stat_notifier_policy+0xa1/0x2e0 age=8366410 pid=1358 cpus=0 + 1 cpufreq_stat_notifier_policy+0x17e/0x2e0 age=8366410 pid=1358 cpus=0 + 1 hid_parse_report+0xa9/0x2c0 age=53512 pid=419 cpus=0 + 10 __dev_addr_add+0x69/0xe0 age=8325501/8345496/8360156 pid=8-1849 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-64/free_calls b/test/sys/kernel/slab/kmalloc-64/free_calls index e2172e5098..655e3c895c 100644 --- a/test/sys/kernel/slab/kmalloc-64/free_calls +++ b/test/sys/kernel/slab/kmalloc-64/free_calls @@ -1,47 +1,49 @@ - 6338 age=4294787875 pid=0 cpus=0 - 1 iounmap+0xc2/0x100 age=120406 pid=1 cpus=0 - 1 memtype_get_idx+0x75/0xc0 age=472 pid=2890 cpus=0 - 2 __release_region+0xc6/0xd0 age=120243/120243/120243 pid=1 cpus=1 - 3 __request_region+0x86/0x120 age=120317/120317/120317 pid=1 cpus=0 - 1 generic_smp_call_function_single_interrupt+0xce/0xe0 age=95988 pid=0 cpus=1 - 53 __stop_machine+0x216/0x220 age=43548/108141/116788 pid=105-2754 cpus=0-1 - 2 free_irq+0xef/0x190 age=96791/108147/119504 pid=1-1541 cpus=0 - 32 __vunmap+0xcd/0x120 age=49614/106753/116787 pid=105-2711 cpus=0-1 - 8 __vunmap+0xe9/0x120 age=68946/104551/116557 pid=107-2578 cpus=0-1 - 13 do_sys_poll+0x32b/0x450 age=570/48723/75247 pid=1333-2262 cpus=0-1 - 179 d_callback+0x22/0x40 age=38389/106212/116948 pid=0-2156 cpus=0-1 - 105 free_fdtable_rcu+0x7a/0xb0 age=4819/96235/116860 pid=0-2888 cpus=0-1 - 98 free_fdtable_rcu+0x82/0xb0 age=4819/94663/117639 pid=0-2888 cpus=0-1 - 34 proc_reg_release+0x96/0x120 age=4054/104513/116556 pid=126-2586 cpus=0-1 - 15 proc_reg_open+0x138/0x170 age=60405/85433/108413 pid=1184-2676 cpus=0-1 - 521 free_rb_tree_fname+0x5c/0xb0 age=13382/89664/116891 pid=102-2881 cpus=0-1 - 61 ext3_htree_free_dir_info+0x19/0x20 age=13382/92904/116891 pid=102-2881 cpus=0-1 - 10 ext3_clear_inode+0xa5/0xb0 age=15264/59665/94793 pid=1253-2851 cpus=0-1 - 1 dynamic_kobj_release+0x2c/0x40 age=96680 pid=1541 cpus=0 - 67 kobject_uevent_env+0x11a/0x470 age=43545/108372/120444 pid=1-2754 cpus=0-1 - 15 acpi_ds_call_control_method+0xfe/0x180 age=2031/67925/120337 pid=1-2890 cpus=0 - 1 acpi_ev_execute_reg_method+0x129/0x13a age=120435 pid=1 cpus=0 - 1 acpi_ev_asynch_execute_gpe_method+0xcc/0x119 age=120394 pid=12 cpus=1 - 34 acpi_evaluate_object+0x1ea/0x1fc age=2026/78898/120444 pid=1-2890 cpus=0-1 - 4 acpi_get_object_info+0x1c4/0x1d4 age=120365/120377/120384 pid=1 cpus=0 - 1 acpi_walk_resources+0xa4/0xbd age=120244 pid=1 cpus=1 - 41 acpi_ut_evaluate_object+0x18d/0x19b age=119712/120350/120408 pid=1 cpus=0-1 - 4 acpi_ut_delete_internal_obj+0x15f/0x16f age=106905/113901/116233 pid=330-1358 cpus=0 - 7 acpi_bus_get_ejd+0x73/0x80 age=120444/120444/120444 pid=1 cpus=0 - 11 pnp_show_options+0x459/0x600 age=876/900/917 pid=2890 cpus=0 - 11 pnp_show_current_resources+0x16f/0x180 age=876/900/917 pid=2890 cpus=0 - 17 release_one_tty+0x53/0x190 age=93008/102081/110816 pid=55-2106 cpus=0-1 - 23 release_one_tty+0x60/0x190 age=92918/99197/110816 pid=55-2141 cpus=0-1 - 6 release_one_tty+0x167/0x190 age=92918/93713/95283 pid=1967-2141 cpus=0 - 4 devres_remove_group+0x9e/0xe0 age=119515/119802/120242 pid=1 cpus=0-1 - 1 ata_acpi_on_devcfg+0x385/0x6a0 age=119895 pid=25 cpus=0 - 3 serio_free_event+0x1d/0x30 age=118952/119301/119488 pid=17 cpus=0-1 - 5 input_register_device+0x17c/0x230 age=112781/115789/119472 pid=17-803 cpus=0-1 - 1 ip_cork_release+0x1f/0x50 age=74343 pid=2536 cpus=1 - 13 huft_free+0x1e/0x2f age=120293/120293/120293 pid=1 cpus=0 - 5 hub_port_init+0x522/0x740 [usbcore] age=43787/86949/114764 pid=419 cpus=0 - 1 usb_release_interface_cache+0x2c/0x60 [usbcore] age=114357 pid=419 cpus=0 - 1 usb_release_interface_cache+0x47/0x60 [usbcore] age=114357 pid=419 cpus=0 - 1 __param_str_act+0x16c/0xfffffffffffffb13 [thermal] age=115602 pid=383 cpus=0 - 4 snd_card_file_remove+0x73/0x130 [snd] age=73539/86679/113640 pid=786-2425 cpus=0 - 1 hid_probe+0x222/0xf30 [usbhid] age=112795 pid=803 cpus=0 + 13029 age=4303047386 pid=0 cpus=0 + 1 iounmap+0xc2/0x100 age=8379917 pid=1 cpus=0 + 1 memtype_get_idx+0x75/0xc0 age=782 pid=13466 cpus=0 + 2 __release_region+0xc6/0xd0 age=8379754/8379754/8379754 pid=1 cpus=1 + 3 __request_region+0x86/0x120 age=8379828/8379828/8379828 pid=1 cpus=0 + 1 generic_smp_call_function_single_interrupt+0xce/0xe0 age=8355499 pid=0 cpus=1 + 53 __stop_machine+0x216/0x220 age=8303059/8367652/8376299 pid=105-2754 cpus=0-1 + 2 free_irq+0xef/0x190 age=8356302/8367658/8379015 pid=1-1541 cpus=0 + 28 __vunmap+0xcd/0x120 age=8309125/8366969/8376298 pid=105-2711 cpus=0-1 + 8 __vunmap+0xe9/0x120 age=8328457/8364062/8376068 pid=107-2578 cpus=0-1 + 1 percpu_free+0x2d/0x60 age=61987 pid=13295 cpus=0 + 10 do_sys_poll+0x32b/0x450 age=61481/7500944/8334758 pid=1333-2262 cpus=0-1 + 187 d_callback+0x22/0x40 age=22704/7997936/8376459 pid=0-2156 cpus=0-1 + 198 free_fdtable_rcu+0x7a/0xb0 age=1292/3883175/8376371 pid=0-13456 cpus=0-1 + 224 free_fdtable_rcu+0x82/0xb0 age=1292/3491449/8377150 pid=0-13456 cpus=0-1 + 42 proc_reg_release+0x96/0x120 age=3564/7013222/8376067 pid=126-2586 cpus=0-1 + 50 proc_reg_open+0x138/0x170 age=656297/2956669/8367924 pid=1184-12336 cpus=0-1 + 1046 free_rb_tree_fname+0x5c/0xb0 age=5905/4315279/8376402 pid=102-24701 cpus=0-1 + 79 ext3_htree_free_dir_info+0x19/0x20 age=5905/6235661/8376402 pid=102-24701 cpus=0-1 + 26 ext3_clear_inode+0xa5/0xb0 age=12954/2421572/8354304 pid=1253-8445 cpus=0-1 + 1 dynamic_kobj_release+0x2c/0x40 age=8356191 pid=1541 cpus=0 + 66 kobject_uevent_env+0x11a/0x470 age=22624/7608199/8379955 pid=1-2711 cpus=0-1 + 16 acpi_ds_call_control_method+0xfe/0x180 age=3020/4710292/8379848 pid=1-13466 cpus=0-1 + 1 acpi_ev_execute_reg_method+0x129/0x13a age=8379946 pid=1 cpus=0 + 1 acpi_ev_asynch_execute_gpe_method+0xcc/0x119 age=8379905 pid=12 cpus=1 + 33 acpi_evaluate_object+0x1ea/0x1fc age=3015/5838124/8379955 pid=1-13466 cpus=0-1 + 4 acpi_get_object_info+0x1c4/0x1d4 age=8379876/8379888/8379895 pid=1 cpus=0 + 1 acpi_walk_resources+0xa4/0xbd age=8379755 pid=1 cpus=1 + 41 acpi_ut_evaluate_object+0x18d/0x19b age=8379223/8379861/8379919 pid=1 cpus=0-1 + 4 acpi_ut_delete_internal_obj+0x15f/0x16f age=8366416/8373412/8375744 pid=330-1358 cpus=0 + 7 acpi_bus_get_ejd+0x73/0x80 age=8379955/8379955/8379955 pid=1 cpus=0 + 11 pnp_show_options+0x459/0x600 age=1578/1602/1627 pid=13466 cpus=0 + 11 pnp_show_current_resources+0x16f/0x180 age=1578/1603/1628 pid=13466 cpus=0 + 19 release_one_tty+0x53/0x190 age=804540/7566113/8370327 pid=55-2106 cpus=0-1 + 24 release_one_tty+0x60/0x190 age=804540/7729452/8370327 pid=55-2141 cpus=0-1 + 6 release_one_tty+0x167/0x190 age=8352429/8353224/8354794 pid=1967-2141 cpus=0 + 4 devres_remove_group+0x9e/0xe0 age=8379026/8379313/8379753 pid=1 cpus=0-1 + 1 ata_acpi_on_devcfg+0x385/0x6a0 age=8379406 pid=25 cpus=0 + 3 serio_free_event+0x1d/0x30 age=8378463/8378812/8378999 pid=17 cpus=0-1 + 6 input_register_device+0x17c/0x230 age=53514/6988336/8378983 pid=17-803 cpus=0-1 + 1 ip_cork_release+0x1f/0x50 age=8333854 pid=2536 cpus=1 + 1 unix_sock_destructor+0x75/0xd0 age=7217178 pid=2344 cpus=0 + 13 huft_free+0x1e/0x2f age=8379804/8379804/8379804 pid=1 cpus=0 + 6 hub_port_init+0x522/0x740 [usbcore] age=22825/4210550/8374275 pid=419 cpus=0-1 + 1 usb_release_interface_cache+0x2c/0x60 [usbcore] age=8373868 pid=419 cpus=0 + 1 usb_release_interface_cache+0x47/0x60 [usbcore] age=8373868 pid=419 cpus=0 + 1 __param_str_act+0x16c/0xfffffffffffffb13 [thermal] age=8375113 pid=383 cpus=0 + 3 snd_card_file_remove+0x73/0x130 [snd] age=8333050/8337203/8339297 pid=2400-2425 cpus=0 + 2 hid_probe+0x222/0xf30 [usbhid] age=53517/4212911/8372306 pid=419-803 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-64/objects b/test/sys/kernel/slab/kmalloc-64/objects index 4faba4413e..4fea1d9b43 100644 --- a/test/sys/kernel/slab/kmalloc-64/objects +++ b/test/sys/kernel/slab/kmalloc-64/objects @@ -1 +1 @@ -7770 +15300 diff --git a/test/sys/kernel/slab/kmalloc-64/slabs b/test/sys/kernel/slab/kmalloc-64/slabs index 98ecf5813e..2bc4cd64b8 100644 --- a/test/sys/kernel/slab/kmalloc-64/slabs +++ b/test/sys/kernel/slab/kmalloc-64/slabs @@ -1 +1 @@ -259 +510 diff --git a/test/sys/kernel/slab/kmalloc-64/total_objects b/test/sys/kernel/slab/kmalloc-64/total_objects index 4faba4413e..4fea1d9b43 100644 --- a/test/sys/kernel/slab/kmalloc-64/total_objects +++ b/test/sys/kernel/slab/kmalloc-64/total_objects @@ -1 +1 @@ -7770 +15300 diff --git a/test/sys/kernel/slab/kmalloc-8/alloc_calls b/test/sys/kernel/slab/kmalloc-8/alloc_calls index cad464e273..e9e0bf6eb3 100644 --- a/test/sys/kernel/slab/kmalloc-8/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-8/alloc_calls @@ -1,32 +1,32 @@ - 1 cache_k8_northbridges+0x5f/0x130 age=120344 pid=1 cpus=0 - 1 pm_qos_add_requirement+0x51/0xe0 age=116580 pid=122 cpus=1 - 5 setup_modinfo_version+0x19/0x30 age=96471/111249/116816 pid=169-1766 cpus=0-1 - 379 load_module+0x1ac4/0x1b30 age=43571/109336/116810 pid=105-2754 cpus=0-1 - 57 strndup_user+0x6d/0xc0 age=43575/108714/116816 pid=105-2754 cpus=0-1 - 4 krealloc+0x1e/0x60 age=95750/102720/117621 pid=71-1849 cpus=0-1 - 5 __vmalloc_area_node+0xfb/0x140 age=114139/114930/115644 pid=181-754 cpus=0-1 - 17 alloc_vfsmnt+0x97/0x180 age=94582/117623/120602 pid=0-2064 cpus=0-1 - 1 proc_symlink+0x4d/0xb0 age=114643 pid=107 cpus=1 - 1954 sysfs_new_dirent+0x10c/0x120 age=38540/109788/120602 pid=0-2761 cpus=0-1 - 690 kvasprintf+0x55/0x90 age=38540/111445/120602 pid=0-2761 cpus=0-1 - 1 proc_bus_pci_open+0x1d/0x50 age=96318 pid=1738 cpus=0 - 5 pcie_port_device_register+0x25/0x4a0 age=120302/120303/120304 pid=1 cpus=1 - 19 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120441/120450/120452 pid=1 cpus=0 - 9 acpi_ev_pci_config_region_setup+0x162/0x270 age=119736/120334/120427 pid=1-12 cpus=0-1 - 2 acpi_ut_copy_simple_object+0x8f/0x11c age=116158/116166/116174 pid=396 cpus=0 - 35 acpi_irq_stats_init+0x1bd/0x268 age=120459/120459/120459 pid=1 cpus=0 - 8 neigh_sysctl_register+0x1cd/0x330 age=100672/109261/120325 pid=1-1549 cpus=0-1 - 7 netlink_kernel_create+0xab/0x1a0 age=119467/120248/120468 pid=1 cpus=0-1 - 5 __devinet_sysctl_register+0xb8/0x120 age=114138/118342/120325 pid=1-126 cpus=0-1 - 1 fz_hash_alloc+0x4a/0x60 age=65005 pid=1541 cpus=0 - 1 init_vdso_vars+0x4c/0x24a age=120315 pid=1 cpus=1 - 30 netlink_proto_init+0xf1/0x16b age=120468/120468/120468 pid=1 cpus=0 - 5 hub_probe+0x20b/0x820 [usbcore] age=114555/115048/115401 pid=143-147 cpus=0-1 - 3 usb_cache_string+0x65/0xa0 [usbcore] age=43695/47750/49778 pid=419 cpus=0 - 10 usb_get_configuration+0xbd/0x1480 [usbcore] age=43696/100850/115421 pid=143-419 cpus=0-1 - 35 snd_info_create_entry+0x30/0xa0 [snd] age=95850/111135/115413 pid=107-1813 cpus=0-1 - 1 async_chainiv_givencrypt_first+0x56/0x80 [crypto_blkcipher] age=115060 pid=215 cpus=0 - 1 md_seq_open+0x2d/0x90 [md_mod] age=106615 pid=1371 cpus=0 - 1 bitmap_create+0x3aa/0xad0 [md_mod] age=110605 pid=916 cpus=0 - 5 __addrconf_sysctl_register+0xcd/0x140 [ipv6] age=100672/100673/100675 pid=1549 cpus=0 - 1 fib6_net_init+0x5d/0x130 [ipv6] age=100675 pid=1549 cpus=0 + 1 cache_k8_northbridges+0x5f/0x130 age=8379864 pid=1 cpus=0 + 1 pm_qos_add_requirement+0x51/0xe0 age=8376100 pid=122 cpus=1 + 5 setup_modinfo_version+0x19/0x30 age=8355991/8370769/8376336 pid=169-1766 cpus=0-1 + 379 load_module+0x1ac4/0x1b30 age=8303091/8368856/8376330 pid=105-2754 cpus=0-1 + 57 strndup_user+0x6d/0xc0 age=8303095/8368234/8376336 pid=105-2754 cpus=0-1 + 4 krealloc+0x1e/0x60 age=8355270/8362240/8377141 pid=71-1849 cpus=0-1 + 5 __vmalloc_area_node+0xfb/0x140 age=8373659/8374450/8375164 pid=181-754 cpus=0-1 + 17 alloc_vfsmnt+0x97/0x180 age=8354102/8377143/8380122 pid=0-2064 cpus=0-1 + 1 proc_symlink+0x4d/0xb0 age=8374163 pid=107 cpus=1 + 1954 sysfs_new_dirent+0x10c/0x120 age=22655/7531182/8380122 pid=0-13295 cpus=0-1 + 690 kvasprintf+0x55/0x90 age=22668/7820060/8380122 pid=0-13295 cpus=0-1 + 1 proc_bus_pci_open+0x1d/0x50 age=8355838 pid=1738 cpus=0 + 5 pcie_port_device_register+0x25/0x4a0 age=8379822/8379823/8379824 pid=1 cpus=1 + 19 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379961/8379970/8379972 pid=1 cpus=0 + 9 acpi_ev_pci_config_region_setup+0x162/0x270 age=8379256/8379854/8379947 pid=1-12 cpus=0-1 + 2 acpi_ut_copy_simple_object+0x8f/0x11c age=8375678/8375686/8375694 pid=396 cpus=0 + 35 acpi_irq_stats_init+0x1bd/0x268 age=8379979/8379979/8379979 pid=1 cpus=0 + 8 neigh_sysctl_register+0x1cd/0x330 age=8360192/8368781/8379845 pid=1-1549 cpus=0-1 + 7 netlink_kernel_create+0xab/0x1a0 age=8378987/8379768/8379988 pid=1 cpus=0-1 + 5 __devinet_sysctl_register+0xb8/0x120 age=8373658/8377862/8379845 pid=1-126 cpus=0-1 + 1 fz_hash_alloc+0x4a/0x60 age=8324525 pid=1541 cpus=0 + 1 init_vdso_vars+0x4c/0x24a age=8379835 pid=1 cpus=1 + 30 netlink_proto_init+0xf1/0x16b age=8379988/8379988/8379988 pid=1 cpus=0 + 5 hub_probe+0x20b/0x820 [usbcore] age=8374075/8374568/8374921 pid=143-147 cpus=0-1 + 3 usb_cache_string+0x65/0xa0 [usbcore] age=22742/37518/67072 pid=419 cpus=0 + 10 usb_get_configuration+0xbd/0x1480 [usbcore] age=22743/5876145/8374941 pid=143-419 cpus=0-1 + 35 snd_info_create_entry+0x30/0xa0 [snd] age=8355370/8370655/8374933 pid=107-1813 cpus=0-1 + 1 async_chainiv_givencrypt_first+0x56/0x80 [crypto_blkcipher] age=8374580 pid=215 cpus=0 + 1 md_seq_open+0x2d/0x90 [md_mod] age=8366135 pid=1371 cpus=0 + 1 bitmap_create+0x3aa/0xad0 [md_mod] age=8370125 pid=916 cpus=0 + 5 __addrconf_sysctl_register+0xcd/0x140 [ipv6] age=8360192/8360193/8360195 pid=1549 cpus=0 + 1 fib6_net_init+0x5d/0x130 [ipv6] age=8360195 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-8/free_calls b/test/sys/kernel/slab/kmalloc-8/free_calls index ee3781e77b..dcd65da84f 100644 --- a/test/sys/kernel/slab/kmalloc-8/free_calls +++ b/test/sys/kernel/slab/kmalloc-8/free_calls @@ -1,23 +1,25 @@ - 2776 age=4294787898 pid=0 cpus=0 - 1 partition_sched_domains+0x285/0x300 age=74677 pid=2526 cpus=1 - 3 free_sect_attrs+0x2e/0x50 age=115544/115544/115544 pid=383 cpus=0 - 6 load_module+0x73f/0x1b30 age=115322/115787/116481 pid=143-332 cpus=0-1 - 1 free_module+0xb9/0xf0 age=115544 pid=383 cpus=0 - 1 krealloc+0x3a/0x60 age=116292 pid=330 cpus=0 - 45 __vunmap+0xe9/0x120 age=49634/110047/116797 pid=105-2711 cpus=0-1 - 1 vfs_rename+0x301/0x450 age=107654 pid=72 cpus=1 - 167 release_sysfs_dirent+0x8c/0xd0 age=92943/100063/120267 pid=1-2141 cpus=0-1 - 39 kobject_release+0xe1/0x140 age=92943/97943/118742 pid=1-2141 cpus=0-1 - 1 match_number+0x95/0xb0 age=76301 pid=2476 cpus=0 - 2 proc_bus_pci_release+0x18/0x30 age=96319/96483/96647 pid=1738 cpus=0 - 47 acpi_ds_create_operand+0x12c/0x209 age=46079/115801/120458 pid=1-1442 cpus=0-1 - 128 acpi_ns_get_node+0x92/0xa1 age=106927/119841/120467 pid=1-1358 cpus=0-1 - 2 acpi_ut_delete_internal_obj+0x15f/0x16f age=116147/116208/116270 pid=330-396 cpus=0 - 2 module_add_driver+0x66/0xd0 age=116467/116470/116474 pid=144 cpus=0 - 3 get_modalias+0xd4/0x120 age=96324/111312/120466 pid=1-1772 cpus=0-1 - 1 fib_hash_free+0x35/0x40 age=108388 pid=1185 cpus=0 - 3 sg_clean+0x3e/0x80 [usbcore] age=38548/38556/38564 pid=2760 cpus=0 - 56 usb_control_msg+0xef/0x110 [usbcore] age=43693/95647/115421 pid=143-2711 cpus=0-1 - 8 usb_set_configuration+0x338/0x5f0 [usbcore] age=43693/105671/115413 pid=143-419 cpus=0-1 - 1 usb_destroy_configuration+0x78/0x140 [usbcore] age=114380 pid=419 cpus=0 - 5 sr_media_change+0xeb/0x2a0 [sr_mod] age=66074/94513/115441 pid=558-1456 cpus=0-1 + 2657 age=4303047420 pid=0 cpus=0 + 3 free_sect_attrs+0x2e/0x50 age=8375066/8375066/8375066 pid=383 cpus=0 + 6 load_module+0x73f/0x1b30 age=8374844/8375309/8376003 pid=143-332 cpus=0-1 + 1 free_module+0xb9/0xf0 age=8375066 pid=383 cpus=0 + 1 krealloc+0x3a/0x60 age=8375814 pid=330 cpus=0 + 41 __vunmap+0xe9/0x120 age=8355636/8372979/8376319 pid=105-1805 cpus=0-1 + 1 vfs_rename+0x301/0x450 age=8367176 pid=72 cpus=1 + 254 release_sysfs_dirent+0x8c/0xd0 age=125751/7762571/8379789 pid=1-3347 cpus=0-1 + 61 kobject_release+0xe1/0x140 age=125751/6939731/8378264 pid=1-3347 cpus=0-1 + 1 match_number+0x95/0xb0 age=8335823 pid=2476 cpus=0 + 2 proc_bus_pci_release+0x18/0x30 age=8355841/8356005/8356169 pid=1738 cpus=0 + 49 acpi_ds_create_operand+0x12c/0x209 age=125757/8029619/8379980 pid=1-1442 cpus=0-1 + 128 acpi_ns_get_node+0x92/0xa1 age=8366449/8379363/8379989 pid=1-1358 cpus=0-1 + 2 acpi_ut_delete_internal_obj+0x15f/0x16f age=8375669/8375730/8375792 pid=330-396 cpus=0 + 2 module_add_driver+0x66/0xd0 age=8375989/8375992/8375996 pid=144 cpus=0 + 2 sd_media_changed+0xca/0x210 age=7839601/7929600/8019600 pid=2796 cpus=0 + 3 get_modalias+0xd4/0x120 age=8355846/8370834/8379988 pid=1-1772 cpus=0-1 + 1 fib_hash_free+0x35/0x40 age=8367910 pid=1185 cpus=0 + 1 usb_release_dev+0x39/0x70 [usbcore] age=7833240 pid=419 cpus=1 + 2 usb_release_dev+0x45/0x70 [usbcore] age=7833240/7835719/7838199 pid=419 cpus=0-1 + 4 sg_clean+0x3e/0x80 [usbcore] age=62037/2121033/8297977 pid=2760-13294 cpus=0 + 59 usb_control_msg+0xef/0x110 [usbcore] age=22658/5520135/8374943 pid=143-419 cpus=0-1 + 7 usb_set_configuration+0x338/0x5f0 [usbcore] age=53566/5999072/8374935 pid=143-419 cpus=0-1 + 4 usb_destroy_configuration+0x78/0x140 [usbcore] age=7824401/7967435/8373902 pid=419 cpus=0-1 + 7 sr_media_change+0xeb/0x2a0 [sr_mod] age=53597/5984195/8374963 pid=558-1456 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-96/alloc_calls b/test/sys/kernel/slab/kmalloc-96/alloc_calls index f35cb951b8..ecc95e9d76 100644 --- a/test/sys/kernel/slab/kmalloc-96/alloc_calls +++ b/test/sys/kernel/slab/kmalloc-96/alloc_calls @@ -1,39 +1,39 @@ - 5 sched_create_group+0x1f/0x220 age=92345/99829/107356 pid=1333-2177 cpus=0-1 - 10 __register_sysctl_paths+0x56/0x340 age=110862/119010/120363 pid=1-901 cpus=0-1 - 15 __create_workqueue_key+0x31/0x290 age=110884/118293/120484 pid=1-900 cpus=0-1 - 59 load_module+0x19c0/0x1b30 age=43586/108944/116825 pid=105-2754 cpus=0-1 - 5 __vmalloc_area_node+0xfb/0x140 age=95875/111994/116701 pid=147-1813 cpus=0 - 22 __register_chrdev_region+0x2d/0x1a0 age=49652/115744/120479 pid=1-2711 cpus=0-1 - 1 do_sys_poll+0xdb/0x450 age=413 pid=2262 cpus=0 - 98 d_alloc+0x19d/0x1f0 age=38371/102053/116795 pid=317-2795 cpus=0-1 - 8 sys_eventfd2+0x51/0xb0 age=79808/79852/79896 pid=2400 cpus=0 - 1 mb_cache_create+0x62/0x1f0 age=120321 pid=1 cpus=1 - 9 sysfs_setattr+0x19a/0x1f0 age=38525/82617/117752 pid=63-2777 cpus=0-1 - 1 sysfs_open_file+0x1c5/0x230 age=0 pid=2890 cpus=0 - 17 copy_semundo+0x71/0xc0 age=15625/78538/106738 pid=1370-2851 cpus=0-1 - 2 __crypto_alloc_tfm+0x43/0x1b0 age=114153/114153/114153 pid=126 cpus=1 - 2 pcim_iomap_table+0x45/0x60 age=119764/120022/120280 pid=1 cpus=0-1 - 26 pci_create_attr+0x3d/0x140 age=119469/119469/119470 pid=1 cpus=0 - 8 pci_enable_msi+0xb1/0x2b0 age=96811/114438/120319 pid=1-1541 cpus=0-1 - 1 fb_add_videomode+0x89/0xf0 age=120316 pid=1 cpus=1 - 1 soft_cursor+0x92/0x220 age=120316 pid=1 cpus=1 - 20 acpi_os_create_semaphore+0x36/0xaa age=120444/120593/120617 pid=0-1 cpus=0 - 6 acpi_ds_build_internal_package_obj+0xaf/0x1df age=120456/120460/120468 pid=1 cpus=0 - 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=120461/120461/120462 pid=1 cpus=0 - 1 acpi_ev_create_gpe_block+0x5f/0x3bf age=120474 pid=1 cpus=0 - 62 pnp_new_resource+0x25/0x60 age=120366/120369/120370 pid=1 cpus=0 - 1 tty_register_driver+0x1b3/0x2a0 age=120281 pid=1 cpus=1 - 5 kbd_connect+0x4e/0xe0 age=114827/116218/119510 pid=17-341 cpus=0-1 - 17 __class_create+0x3d/0xa0 age=115091/118212/120483 pid=1-215 cpus=0-1 - 2 scsi_probe_and_add_lun+0x65e/0xd80 age=119559/119727/119896 pid=1 cpus=0-1 - 3 inet_rtm_newaddr+0xdb/0x220 age=66035/94264/108387 pid=1197-1541 cpus=0-1 - 2 cache_add_dev+0x7c/0x546 age=120330/120330/120331 pid=1 cpus=0 - 22 kernel_param_sysfs_setup+0x2f/0xc9 age=120480/120480/120480 pid=1 cpus=0 - 15 acpi_system_init+0x12e/0x260 age=120373/120373/120374 pid=1 cpus=0 - 1 pci_mmcfg_insert_resources+0x5d/0x123 age=119469 pid=1 cpus=0 - 1 0xffffffffa0065104 age=96483 pid=1766 cpus=0 - 1 bitmap_create+0x373/0xad0 [md_mod] age=110620 pid=916 cpus=0 - 256 r1bio_pool_alloc+0x2f/0x60 [raid1] age=110629/110629/110629 pid=916 cpus=0 - 8 ip6addrlbl_add+0x75/0x330 [ipv6] age=100690/100690/100690 pid=1549 cpus=0 - 1 ip6_route_net_init+0x22/0xd0 [ipv6] age=100691 pid=1549 cpus=0 - 6 snd_mixer_oss_build_input+0x431/0x5c0 [snd_mixer_oss] age=96069/96069/96070 pid=1813 cpus=0 + 5 sched_create_group+0x1f/0x220 age=8351870/8359354/8366881 pid=1333-2177 cpus=0-1 + 10 __register_sysctl_paths+0x56/0x340 age=8370387/8378535/8379888 pid=1-901 cpus=0-1 + 15 __create_workqueue_key+0x31/0x290 age=8370409/8377818/8380009 pid=1-900 cpus=0-1 + 59 load_module+0x19c0/0x1b30 age=8303111/8368469/8376350 pid=105-2754 cpus=0-1 + 5 __vmalloc_area_node+0xfb/0x140 age=8355400/8371519/8376226 pid=147-1813 cpus=0 + 22 __register_chrdev_region+0x2d/0x1a0 age=8309177/8375269/8380004 pid=1-2711 cpus=0-1 + 1 do_sys_poll+0xdb/0x450 age=9671 pid=2262 cpus=1 + 98 d_alloc+0x19d/0x1f0 age=22395/7516545/8376320 pid=317-13453 cpus=0-1 + 8 sys_eventfd2+0x51/0xb0 age=8339333/8339377/8339421 pid=2400 cpus=0 + 1 mb_cache_create+0x62/0x1f0 age=8379846 pid=1 cpus=1 + 9 sysfs_setattr+0x19a/0x1f0 age=61999/6511912/8377277 pid=63-13308 cpus=0-1 + 1 sysfs_open_file+0x1c5/0x230 age=0 pid=13466 cpus=0 + 17 copy_semundo+0x71/0xc0 age=3847042/8077586/8366263 pid=1370-2590 cpus=0-1 + 2 __crypto_alloc_tfm+0x43/0x1b0 age=8373678/8373678/8373678 pid=126 cpus=1 + 2 pcim_iomap_table+0x45/0x60 age=8379289/8379547/8379805 pid=1 cpus=0-1 + 26 pci_create_attr+0x3d/0x140 age=8378994/8378994/8378995 pid=1 cpus=0 + 8 pci_enable_msi+0xb1/0x2b0 age=8356336/8373963/8379844 pid=1-1541 cpus=0-1 + 1 fb_add_videomode+0x89/0xf0 age=8379841 pid=1 cpus=1 + 1 soft_cursor+0x92/0x220 age=8379841 pid=1 cpus=1 + 20 acpi_os_create_semaphore+0x36/0xaa age=8379969/8380118/8380142 pid=0-1 cpus=0 + 6 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379981/8379985/8379993 pid=1 cpus=0 + 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379986/8379986/8379987 pid=1 cpus=0 + 1 acpi_ev_create_gpe_block+0x5f/0x3bf age=8379999 pid=1 cpus=0 + 62 pnp_new_resource+0x25/0x60 age=8379891/8379894/8379895 pid=1 cpus=0 + 1 tty_register_driver+0x1b3/0x2a0 age=8379806 pid=1 cpus=1 + 5 kbd_connect+0x4e/0xe0 age=8374352/8375743/8379035 pid=17-341 cpus=0-1 + 17 __class_create+0x3d/0xa0 age=8374616/8377737/8380008 pid=1-215 cpus=0-1 + 2 scsi_probe_and_add_lun+0x65e/0xd80 age=8379084/8379252/8379421 pid=1 cpus=0-1 + 3 inet_rtm_newaddr+0xdb/0x220 age=8325560/8353789/8367912 pid=1197-1541 cpus=0-1 + 2 cache_add_dev+0x7c/0x546 age=8379855/8379855/8379856 pid=1 cpus=0 + 22 kernel_param_sysfs_setup+0x2f/0xc9 age=8380005/8380005/8380005 pid=1 cpus=0 + 15 acpi_system_init+0x12e/0x260 age=8379898/8379898/8379899 pid=1 cpus=0 + 1 pci_mmcfg_insert_resources+0x5d/0x123 age=8378994 pid=1 cpus=0 + 1 0xffffffffa0065104 age=8356008 pid=1766 cpus=0 + 1 bitmap_create+0x373/0xad0 [md_mod] age=8370145 pid=916 cpus=0 + 256 r1bio_pool_alloc+0x2f/0x60 [raid1] age=8370154/8370154/8370154 pid=916 cpus=0 + 8 ip6addrlbl_add+0x75/0x330 [ipv6] age=8360215/8360215/8360215 pid=1549 cpus=0 + 1 ip6_route_net_init+0x22/0xd0 [ipv6] age=8360216 pid=1549 cpus=0 + 6 snd_mixer_oss_build_input+0x431/0x5c0 [snd_mixer_oss] age=8355594/8355594/8355595 pid=1813 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-96/free_calls b/test/sys/kernel/slab/kmalloc-96/free_calls index 1288604771..5946302537 100644 --- a/test/sys/kernel/slab/kmalloc-96/free_calls +++ b/test/sys/kernel/slab/kmalloc-96/free_calls @@ -1,18 +1,18 @@ - 509 age=4294787914 pid=0 cpus=0 - 1 free_notes_attrs+0x4b/0x50 age=115561 pid=383 cpus=0 - 1 audit_send_list+0x88/0xa0 age=101562 pid=1538 cpus=1 - 6 __vunmap+0xe9/0x120 age=49653/103486/115566 pid=126-2711 cpus=0-1 - 1 do_sys_poll+0x32b/0x450 age=414 pid=2262 cpus=0 - 33 d_callback+0x22/0x40 age=43664/99035/116126 pid=0-2740 cpus=0-1 - 19 sysfs_release+0x63/0xa0 age=16087/92594/117036 pid=165-2773 cpus=0-1 - 1 release_sysfs_dirent+0x22/0xd0 age=107674 pid=1309 cpus=1 - 113 free_rb_tree_fname+0x5c/0xb0 age=14719/98996/116930 pid=163-2649 cpus=0-1 - 5 kobject_uevent_env+0x11a/0x470 age=115179/117228/119771 pid=1-392 cpus=0-1 - 1 msi_free_irqs+0xad/0x110 age=96830 pid=1541 cpus=0 - 1 acpi_os_execute_deferred+0x34/0x39 age=120433 pid=13 cpus=1 - 1 acpi_walk_resources+0xa4/0xbd age=120370 pid=1 cpus=0 - 1 acpi_pci_irq_add_prt+0x30b/0x324 age=120397 pid=1 cpus=0 - 7 scsi_execute_req+0x9f/0xf0 age=38544/91446/119897 pid=1-2761 cpus=0-1 - 9 netlink_destroy_callback+0x21/0x30 age=66036/88090/108388 pid=1197-2527 cpus=0-1 - 12 huft_free+0x1e/0x2f age=120332/120332/120332 pid=1 cpus=0 - 2 r1bio_pool_free+0x9/0x10 [raid1] age=104903/104906/104909 pid=0 cpus=0 + 507 age=4303047439 pid=0 cpus=0 + 1 free_notes_attrs+0x4b/0x50 age=8375086 pid=383 cpus=0 + 1 audit_send_list+0x88/0xa0 age=8361087 pid=1538 cpus=1 + 6 __vunmap+0xe9/0x120 age=8309178/8363011/8375091 pid=126-2711 cpus=0-1 + 1 do_sys_poll+0x32b/0x450 age=9672 pid=2262 cpus=1 + 30 d_callback+0x22/0x40 age=22587/7808930/8375651 pid=0-13433 cpus=0-1 + 20 sysfs_release+0x63/0xa0 age=22407/6699376/8376561 pid=165-13453 cpus=0-1 + 1 release_sysfs_dirent+0x22/0xd0 age=8367199 pid=1309 cpus=1 + 116 free_rb_tree_fname+0x5c/0xb0 age=53501/7931736/8376455 pid=163-13373 cpus=0-1 + 7 kobject_uevent_env+0x11a/0x470 age=67088/6542620/8379296 pid=1-419 cpus=0-1 + 1 msi_free_irqs+0xad/0x110 age=8356355 pid=1541 cpus=0 + 1 acpi_os_execute_deferred+0x34/0x39 age=8379958 pid=13 cpus=1 + 1 acpi_walk_resources+0xa4/0xbd age=8379895 pid=1 cpus=0 + 1 acpi_pci_irq_add_prt+0x30b/0x324 age=8379922 pid=1 cpus=0 + 6 scsi_execute_req+0x9f/0xf0 age=8335607/8359788/8379422 pid=1-1456 cpus=0-1 + 9 netlink_destroy_callback+0x21/0x30 age=8325561/8347615/8367913 pid=1197-2527 cpus=0-1 + 12 huft_free+0x1e/0x2f age=8379857/8379857/8379857 pid=1 cpus=0 + 2 r1bio_pool_free+0x9/0x10 [raid1] age=8364428/8364431/8364434 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-96/objects b/test/sys/kernel/slab/kmalloc-96/objects index 9beea1f9dc..611de25367 100644 --- a/test/sys/kernel/slab/kmalloc-96/objects +++ b/test/sys/kernel/slab/kmalloc-96/objects @@ -1 +1 @@ -750 +743 diff --git a/test/sys/kernel/slab/kmalloc-96/objects_partial b/test/sys/kernel/slab/kmalloc-96/objects_partial index 257e563266..5595fa46c0 100644 --- a/test/sys/kernel/slab/kmalloc-96/objects_partial +++ b/test/sys/kernel/slab/kmalloc-96/objects_partial @@ -1 +1 @@ -102 +95 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/objects b/test/sys/kernel/slab/kmalloc_dma-512/objects index 8351c19397..573541ac97 100644 --- a/test/sys/kernel/slab/kmalloc_dma-512/objects +++ b/test/sys/kernel/slab/kmalloc_dma-512/objects @@ -1 +1 @@ -14 +0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/partial b/test/sys/kernel/slab/kmalloc_dma-512/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/kmalloc_dma-512/partial +++ b/test/sys/kernel/slab/kmalloc_dma-512/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/mm_struct/alloc_calls b/test/sys/kernel/slab/mm_struct/alloc_calls index 0d8234c4c3..ae947e0053 100644 --- a/test/sys/kernel/slab/mm_struct/alloc_calls +++ b/test/sys/kernel/slab/mm_struct/alloc_calls @@ -1,2 +1,2 @@ - 51 mm_alloc+0x15/0x50 age=3728/82894/118687 pid=1-2890 cpus=0-1 - 27 dup_mm+0x61/0x390 age=76175/95614/117075 pid=71-2467 cpus=0-1 + 52 mm_alloc+0x15/0x50 age=4100/7453183/8378125 pid=1-20296 cpus=0-1 + 27 dup_mm+0x61/0x390 age=8335613/8355052/8376513 pid=71-2467 cpus=0-1 diff --git a/test/sys/kernel/slab/mm_struct/free_calls b/test/sys/kernel/slab/mm_struct/free_calls index 487419e053..c564d6f66f 100644 --- a/test/sys/kernel/slab/mm_struct/free_calls +++ b/test/sys/kernel/slab/mm_struct/free_calls @@ -1,2 +1,2 @@ - 6 age=4294787778 pid=0 cpus=0 - 72 __mmdrop+0x47/0x60 age=4725/88360/117544 pid=1-2846 cpus=0-1 + 6 age=4303047216 pid=0 cpus=0 + 73 __mmdrop+0x47/0x60 age=7143/7714522/8376982 pid=1-20295 cpus=0-1 diff --git a/test/sys/kernel/slab/mm_struct/objects b/test/sys/kernel/slab/mm_struct/objects index 49541f7210..d22307c427 100644 --- a/test/sys/kernel/slab/mm_struct/objects +++ b/test/sys/kernel/slab/mm_struct/objects @@ -1 +1 @@ -94 +88 diff --git a/test/sys/kernel/slab/mm_struct/objects_partial b/test/sys/kernel/slab/mm_struct/objects_partial index b6a7d89c68..409940768f 100644 --- a/test/sys/kernel/slab/mm_struct/objects_partial +++ b/test/sys/kernel/slab/mm_struct/objects_partial @@ -1 +1 @@ -16 +23 diff --git a/test/sys/kernel/slab/mm_struct/slabs b/test/sys/kernel/slab/mm_struct/slabs index 45a4fb75db..7f8f011eb7 100644 --- a/test/sys/kernel/slab/mm_struct/slabs +++ b/test/sys/kernel/slab/mm_struct/slabs @@ -1 +1 @@ -8 +7 diff --git a/test/sys/kernel/slab/mm_struct/total_objects b/test/sys/kernel/slab/mm_struct/total_objects index b16e5f75e3..7fe4e495fe 100644 --- a/test/sys/kernel/slab/mm_struct/total_objects +++ b/test/sys/kernel/slab/mm_struct/total_objects @@ -1 +1 @@ -104 +91 diff --git a/test/sys/kernel/slab/mnt_cache/alloc_calls b/test/sys/kernel/slab/mnt_cache/alloc_calls index 8075bf520c..28ab4b8d8b 100644 --- a/test/sys/kernel/slab/mnt_cache/alloc_calls +++ b/test/sys/kernel/slab/mnt_cache/alloc_calls @@ -1 +1 @@ - 25 alloc_vfsmnt+0x1f/0x180 age=38020/111342/120428 pid=0-2817 cpus=0-1 + 25 alloc_vfsmnt+0x1f/0x180 age=61162/8041266/8379801 pid=0-13348 cpus=0-1 diff --git a/test/sys/kernel/slab/mnt_cache/free_calls b/test/sys/kernel/slab/mnt_cache/free_calls index 49cb0c7965..9c03e4accc 100644 --- a/test/sys/kernel/slab/mnt_cache/free_calls +++ b/test/sys/kernel/slab/mnt_cache/free_calls @@ -1 +1,2 @@ - 25 age=4294787724 pid=0 cpus=0 + 24 age=4303047098 pid=0 cpus=0 + 1 free_vfsmnt+0x2c/0x40 age=7837771 pid=3347 cpus=0 diff --git a/test/sys/kernel/slab/mnt_cache/objects b/test/sys/kernel/slab/mnt_cache/objects index 7facc89938..9902f17848 100644 --- a/test/sys/kernel/slab/mnt_cache/objects +++ b/test/sys/kernel/slab/mnt_cache/objects @@ -1 +1 @@ -36 +28 diff --git a/test/sys/kernel/slab/mnt_cache/objects_partial b/test/sys/kernel/slab/mnt_cache/objects_partial index 573541ac97..b8626c4cff 100644 --- a/test/sys/kernel/slab/mnt_cache/objects_partial +++ b/test/sys/kernel/slab/mnt_cache/objects_partial @@ -1 +1 @@ -0 +4 diff --git a/test/sys/kernel/slab/mnt_cache/partial b/test/sys/kernel/slab/mnt_cache/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/mnt_cache/partial +++ b/test/sys/kernel/slab/mnt_cache/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls b/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls index fefece7950..1aeb6e1162 100644 --- a/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls +++ b/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls @@ -1 +1 @@ - 1 mqueue_alloc_inode+0x15/0x30 age=120406 pid=1 cpus=1 + 1 mqueue_alloc_inode+0x15/0x30 age=8380010 pid=1 cpus=1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/free_calls b/test/sys/kernel/slab/mqueue_inode_cache/free_calls index 3ab537380b..6139b1f64f 100644 --- a/test/sys/kernel/slab/mqueue_inode_cache/free_calls +++ b/test/sys/kernel/slab/mqueue_inode_cache/free_calls @@ -1 +1 @@ - 1 age=4294788000 pid=0 cpus=0 + 1 age=4303047603 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/objects b/test/sys/kernel/slab/mqueue_inode_cache/objects index aabe6ec390..d00491fd7e 100644 --- a/test/sys/kernel/slab/mqueue_inode_cache/objects +++ b/test/sys/kernel/slab/mqueue_inode_cache/objects @@ -1 +1 @@ -21 +1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/objects_partial b/test/sys/kernel/slab/mqueue_inode_cache/objects_partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/mqueue_inode_cache/objects_partial +++ b/test/sys/kernel/slab/mqueue_inode_cache/objects_partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/partial b/test/sys/kernel/slab/mqueue_inode_cache/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/mqueue_inode_cache/partial +++ b/test/sys/kernel/slab/mqueue_inode_cache/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/ndisc_cache/alloc_calls b/test/sys/kernel/slab/ndisc_cache/alloc_calls index bc05daac2d..7c40a6ff06 100644 --- a/test/sys/kernel/slab/ndisc_cache/alloc_calls +++ b/test/sys/kernel/slab/ndisc_cache/alloc_calls @@ -1 +1 @@ - 3 neigh_create+0x8b/0x530 age=70114/80423/100880 pid=0-1549 cpus=0-1 + 1 neigh_create+0x8b/0x530 age=8360557 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/ndisc_cache/free_calls b/test/sys/kernel/slab/ndisc_cache/free_calls index 75cf00f53d..fad673ae75 100644 --- a/test/sys/kernel/slab/ndisc_cache/free_calls +++ b/test/sys/kernel/slab/ndisc_cache/free_calls @@ -1 +1 @@ - 3 age=4294788104 pid=0 cpus=0 + 1 age=4303047782 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ndisc_cache/objects b/test/sys/kernel/slab/ndisc_cache/objects index 7facc89938..d00491fd7e 100644 --- a/test/sys/kernel/slab/ndisc_cache/objects +++ b/test/sys/kernel/slab/ndisc_cache/objects @@ -1 +1 @@ -36 +1 diff --git a/test/sys/kernel/slab/ndisc_cache/objects_partial b/test/sys/kernel/slab/ndisc_cache/objects_partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/ndisc_cache/objects_partial +++ b/test/sys/kernel/slab/ndisc_cache/objects_partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/ndisc_cache/partial b/test/sys/kernel/slab/ndisc_cache/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/ndisc_cache/partial +++ b/test/sys/kernel/slab/ndisc_cache/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/ndisc_cache/slabs b/test/sys/kernel/slab/ndisc_cache/slabs index 0cfbf08886..d00491fd7e 100644 --- a/test/sys/kernel/slab/ndisc_cache/slabs +++ b/test/sys/kernel/slab/ndisc_cache/slabs @@ -1 +1 @@ -2 +1 diff --git a/test/sys/kernel/slab/ndisc_cache/total_objects b/test/sys/kernel/slab/ndisc_cache/total_objects index 7facc89938..3c032078a4 100644 --- a/test/sys/kernel/slab/ndisc_cache/total_objects +++ b/test/sys/kernel/slab/ndisc_cache/total_objects @@ -1 +1 @@ -36 +18 diff --git a/test/sys/kernel/slab/pid/alloc_calls b/test/sys/kernel/slab/pid/alloc_calls index 56fe74815f..6f6adb1d89 100644 --- a/test/sys/kernel/slab/pid/alloc_calls +++ b/test/sys/kernel/slab/pid/alloc_calls @@ -1 +1 @@ - 206 alloc_pid+0x26/0x430 age=3771/98420/120475 pid=0-2851 cpus=0-1 + 207 alloc_pid+0x26/0x430 age=4190/8015525/8379960 pid=0-13212 cpus=0-1 diff --git a/test/sys/kernel/slab/pid/free_calls b/test/sys/kernel/slab/pid/free_calls index 0c6b050f85..804e0da179 100644 --- a/test/sys/kernel/slab/pid/free_calls +++ b/test/sys/kernel/slab/pid/free_calls @@ -1,2 +1,2 @@ - 69 age=4294787821 pid=0 cpus=0 - 137 put_pid+0x36/0x40 age=4763/95449/117585 pid=0-2759 cpus=0-1 + 69 age=4303047306 pid=0 cpus=0 + 138 put_pid+0x36/0x40 age=7228/7841898/8377070 pid=0-13258 cpus=0-1 diff --git a/test/sys/kernel/slab/pid/objects b/test/sys/kernel/slab/pid/objects index 997def452a..f1f094b1c3 100644 --- a/test/sys/kernel/slab/pid/objects +++ b/test/sys/kernel/slab/pid/objects @@ -1 +1 @@ -237 +236 diff --git a/test/sys/kernel/slab/pid/objects_partial b/test/sys/kernel/slab/pid/objects_partial index 94361d49fd..a57f6ce7bc 100644 --- a/test/sys/kernel/slab/pid/objects_partial +++ b/test/sys/kernel/slab/pid/objects_partial @@ -1 +1 @@ -132 +131 diff --git a/test/sys/kernel/slab/proc_inode_cache/alloc_calls b/test/sys/kernel/slab/proc_inode_cache/alloc_calls index 94ba0de0b0..8664b89541 100644 --- a/test/sys/kernel/slab/proc_inode_cache/alloc_calls +++ b/test/sys/kernel/slab/proc_inode_cache/alloc_calls @@ -1 +1 @@ - 1494 proc_alloc_inode+0x1b/0x90 age=37936/91169/120402 pid=0-2796 cpus=0-1 + 1627 proc_alloc_inode+0x1b/0x90 age=61424/8163415/8379746 pid=0-19241 cpus=0-1 diff --git a/test/sys/kernel/slab/proc_inode_cache/free_calls b/test/sys/kernel/slab/proc_inode_cache/free_calls index 70bd8966be..021ea1ded5 100644 --- a/test/sys/kernel/slab/proc_inode_cache/free_calls +++ b/test/sys/kernel/slab/proc_inode_cache/free_calls @@ -1,2 +1,2 @@ - 1034 age=4294787699 pid=0 cpus=0 - 460 proc_destroy_inode+0x14/0x20 age=37964/91937/113464 pid=1-2812 cpus=0-1 + 1124 age=4303047043 pid=0 cpus=0 + 503 proc_destroy_inode+0x14/0x20 age=61430/7970819/8372808 pid=1-12336 cpus=0-1 diff --git a/test/sys/kernel/slab/proc_inode_cache/objects b/test/sys/kernel/slab/proc_inode_cache/objects index aa006a022d..49e657f970 100644 --- a/test/sys/kernel/slab/proc_inode_cache/objects +++ b/test/sys/kernel/slab/proc_inode_cache/objects @@ -1 +1 @@ -1519 +1651 diff --git a/test/sys/kernel/slab/proc_inode_cache/objects_partial b/test/sys/kernel/slab/proc_inode_cache/objects_partial index 81b5c5d06c..8e14edce9c 100644 --- a/test/sys/kernel/slab/proc_inode_cache/objects_partial +++ b/test/sys/kernel/slab/proc_inode_cache/objects_partial @@ -1 +1 @@ -37 +78 diff --git a/test/sys/kernel/slab/proc_inode_cache/partial b/test/sys/kernel/slab/proc_inode_cache/partial index b8626c4cff..45a4fb75db 100644 --- a/test/sys/kernel/slab/proc_inode_cache/partial +++ b/test/sys/kernel/slab/proc_inode_cache/partial @@ -1 +1 @@ -4 +8 diff --git a/test/sys/kernel/slab/proc_inode_cache/slabs b/test/sys/kernel/slab/proc_inode_cache/slabs index 415196e47f..b0d73241ca 100644 --- a/test/sys/kernel/slab/proc_inode_cache/slabs +++ b/test/sys/kernel/slab/proc_inode_cache/slabs @@ -1 +1 @@ -118 +129 diff --git a/test/sys/kernel/slab/proc_inode_cache/total_objects b/test/sys/kernel/slab/proc_inode_cache/total_objects index effd6e7865..9b53651732 100644 --- a/test/sys/kernel/slab/proc_inode_cache/total_objects +++ b/test/sys/kernel/slab/proc_inode_cache/total_objects @@ -1 +1 @@ -1534 +1677 diff --git a/test/sys/kernel/slab/radix_tree_node/alloc_calls b/test/sys/kernel/slab/radix_tree_node/alloc_calls index e52bebe5ca..629655d477 100644 --- a/test/sys/kernel/slab/radix_tree_node/alloc_calls +++ b/test/sys/kernel/slab/radix_tree_node/alloc_calls @@ -1 +1 @@ - 4597 radix_tree_preload+0x3b/0xb0 age=84/84258/119689 pid=1-2890 cpus=0-1 + 6737 radix_tree_preload+0x3b/0xb0 age=16/6612251/8379044 pid=1-32767 cpus=0-1 diff --git a/test/sys/kernel/slab/radix_tree_node/free_calls b/test/sys/kernel/slab/radix_tree_node/free_calls index 92eb0cc935..7530dda63d 100644 --- a/test/sys/kernel/slab/radix_tree_node/free_calls +++ b/test/sys/kernel/slab/radix_tree_node/free_calls @@ -1,2 +1,2 @@ - 2963 age=4294787708 pid=0 cpus=0 - 1634 radix_tree_node_rcu_free+0x41/0x50 age=12501/91637/119552 pid=0-2851 cpus=0-1 + 4146 age=4303047064 pid=0 cpus=0 + 2591 radix_tree_node_rcu_free+0x41/0x50 age=39290/6239072/8378908 pid=0-32584 cpus=0-1 diff --git a/test/sys/kernel/slab/radix_tree_node/objects b/test/sys/kernel/slab/radix_tree_node/objects index 3cf40c6880..8320e39ba8 100644 --- a/test/sys/kernel/slab/radix_tree_node/objects +++ b/test/sys/kernel/slab/radix_tree_node/objects @@ -1 +1 @@ -4602 +6747 diff --git a/test/sys/kernel/slab/radix_tree_node/slabs b/test/sys/kernel/slab/radix_tree_node/slabs index bc23f8ef56..08f851b6ef 100644 --- a/test/sys/kernel/slab/radix_tree_node/slabs +++ b/test/sys/kernel/slab/radix_tree_node/slabs @@ -1 +1 @@ -354 +519 diff --git a/test/sys/kernel/slab/radix_tree_node/total_objects b/test/sys/kernel/slab/radix_tree_node/total_objects index 3cf40c6880..8320e39ba8 100644 --- a/test/sys/kernel/slab/radix_tree_node/total_objects +++ b/test/sys/kernel/slab/radix_tree_node/total_objects @@ -1 +1 @@ -4602 +6747 diff --git a/test/sys/kernel/slab/revoke_table/alloc_calls b/test/sys/kernel/slab/revoke_table/alloc_calls index 6ca0565e0a..ac6781e49c 100644 --- a/test/sys/kernel/slab/revoke_table/alloc_calls +++ b/test/sys/kernel/slab/revoke_table/alloc_calls @@ -1 +1 @@ - 4 journal_init_revoke_table+0x1b/0xb0 age=110219/114569/118919 pid=1-962 cpus=0 + 4 journal_init_revoke_table+0x1b/0xb0 age=8369805/8374155/8378505 pid=1-962 cpus=0 diff --git a/test/sys/kernel/slab/revoke_table/free_calls b/test/sys/kernel/slab/revoke_table/free_calls index 1cda46c3ae..7c06c7c562 100644 --- a/test/sys/kernel/slab/revoke_table/free_calls +++ b/test/sys/kernel/slab/revoke_table/free_calls @@ -1 +1 @@ - 4 age=4294787960 pid=0 cpus=0 + 4 age=4303047546 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/revoke_table/objects b/test/sys/kernel/slab/revoke_table/objects index 9e5feb5256..b8626c4cff 100644 --- a/test/sys/kernel/slab/revoke_table/objects +++ b/test/sys/kernel/slab/revoke_table/objects @@ -1 +1 @@ -46 +4 diff --git a/test/sys/kernel/slab/revoke_table/objects_partial b/test/sys/kernel/slab/revoke_table/objects_partial index 573541ac97..b8626c4cff 100644 --- a/test/sys/kernel/slab/revoke_table/objects_partial +++ b/test/sys/kernel/slab/revoke_table/objects_partial @@ -1 +1 @@ -0 +4 diff --git a/test/sys/kernel/slab/revoke_table/partial b/test/sys/kernel/slab/revoke_table/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/revoke_table/partial +++ b/test/sys/kernel/slab/revoke_table/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls b/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls index cdba976f03..ab74101284 100644 --- a/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls +++ b/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls @@ -1 +1 @@ - 7 scsi_pool_alloc_command+0x25/0x80 age=43687/109275/120382 pid=1-2754 cpus=0-1 + 7 scsi_pool_alloc_command+0x25/0x80 age=67290/7192324/8380005 pid=1-419 cpus=0-1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/free_calls b/test/sys/kernel/slab/scsi_cmd_cache/free_calls index 53abe0278f..384a427c96 100644 --- a/test/sys/kernel/slab/scsi_cmd_cache/free_calls +++ b/test/sys/kernel/slab/scsi_cmd_cache/free_calls @@ -1,2 +1,2 @@ - 5 age=4294788016 pid=0 cpus=0 - 2 scsi_pool_free_command+0x4c/0x60 age=48186/84035/119885 pid=0 cpus=0 + 5 age=4303047639 pid=0 cpus=0 + 2 scsi_pool_free_command+0x4c/0x60 age=67789/4223648/8379508 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/alloc_calls b/test/sys/kernel/slab/scsi_sense_cache/alloc_calls index d6d238840c..f29cd3372a 100644 --- a/test/sys/kernel/slab/scsi_sense_cache/alloc_calls +++ b/test/sys/kernel/slab/scsi_sense_cache/alloc_calls @@ -1 +1 @@ - 7 scsi_pool_alloc_command+0x4a/0x80 age=43690/109278/120385 pid=1-2754 cpus=0-1 + 7 scsi_pool_alloc_command+0x4a/0x80 age=67299/7192333/8380014 pid=1-419 cpus=0-1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/free_calls b/test/sys/kernel/slab/scsi_sense_cache/free_calls index bee684817a..0ef5317549 100644 --- a/test/sys/kernel/slab/scsi_sense_cache/free_calls +++ b/test/sys/kernel/slab/scsi_sense_cache/free_calls @@ -1,2 +1,2 @@ - 5 age=4294788020 pid=0 cpus=0 - 2 scsi_pool_free_command+0x40/0x60 age=48190/84039/119889 pid=0 cpus=0 + 5 age=4303047648 pid=0 cpus=0 + 2 scsi_pool_free_command+0x40/0x60 age=67798/4223657/8379517 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-128/alloc_calls b/test/sys/kernel/slab/sgpool-128/alloc_calls index c0d9ac65f3..130b119b48 100644 --- a/test/sys/kernel/slab/sgpool-128/alloc_calls +++ b/test/sys/kernel/slab/sgpool-128/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=119989/119989/119989 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379262/8379262/8379262 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-128/free_calls b/test/sys/kernel/slab/sgpool-128/free_calls index 5f601dae33..6a6763fb37 100644 --- a/test/sys/kernel/slab/sgpool-128/free_calls +++ b/test/sys/kernel/slab/sgpool-128/free_calls @@ -1 +1 @@ - 2 age=4294787538 pid=0 cpus=0 + 2 age=4303046812 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-128/objects b/test/sys/kernel/slab/sgpool-128/objects index 7f8f011eb7..8351c19397 100644 --- a/test/sys/kernel/slab/sgpool-128/objects +++ b/test/sys/kernel/slab/sgpool-128/objects @@ -1 +1 @@ -7 +14 diff --git a/test/sys/kernel/slab/sgpool-128/slabs b/test/sys/kernel/slab/sgpool-128/slabs index d00491fd7e..0cfbf08886 100644 --- a/test/sys/kernel/slab/sgpool-128/slabs +++ b/test/sys/kernel/slab/sgpool-128/slabs @@ -1 +1 @@ -1 +2 diff --git a/test/sys/kernel/slab/sgpool-128/total_objects b/test/sys/kernel/slab/sgpool-128/total_objects index 7f8f011eb7..8351c19397 100644 --- a/test/sys/kernel/slab/sgpool-128/total_objects +++ b/test/sys/kernel/slab/sgpool-128/total_objects @@ -1 +1 @@ -7 +14 diff --git a/test/sys/kernel/slab/sgpool-16/alloc_calls b/test/sys/kernel/slab/sgpool-16/alloc_calls index ae43727ae6..87929847e4 100644 --- a/test/sys/kernel/slab/sgpool-16/alloc_calls +++ b/test/sys/kernel/slab/sgpool-16/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=120001/120001/120001 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379289/8379289/8379289 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-16/free_calls b/test/sys/kernel/slab/sgpool-16/free_calls index 21b956a4db..0e890c40ff 100644 --- a/test/sys/kernel/slab/sgpool-16/free_calls +++ b/test/sys/kernel/slab/sgpool-16/free_calls @@ -1 +1 @@ - 2 age=4294787550 pid=0 cpus=0 + 2 age=4303046838 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-32/alloc_calls b/test/sys/kernel/slab/sgpool-32/alloc_calls index e8052fd765..b16cb4f40a 100644 --- a/test/sys/kernel/slab/sgpool-32/alloc_calls +++ b/test/sys/kernel/slab/sgpool-32/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=119996/119996/119996 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379280/8379280/8379280 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-32/free_calls b/test/sys/kernel/slab/sgpool-32/free_calls index f46df64aeb..ab6863fa61 100644 --- a/test/sys/kernel/slab/sgpool-32/free_calls +++ b/test/sys/kernel/slab/sgpool-32/free_calls @@ -1 +1 @@ - 2 age=4294787546 pid=0 cpus=0 + 2 age=4303046829 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-64/alloc_calls b/test/sys/kernel/slab/sgpool-64/alloc_calls index ff5b09f88d..a46bc1ed5d 100644 --- a/test/sys/kernel/slab/sgpool-64/alloc_calls +++ b/test/sys/kernel/slab/sgpool-64/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=119993/119993/119993 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379271/8379271/8379271 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-64/free_calls b/test/sys/kernel/slab/sgpool-64/free_calls index 5a9c7452c6..0403d6ef86 100644 --- a/test/sys/kernel/slab/sgpool-64/free_calls +++ b/test/sys/kernel/slab/sgpool-64/free_calls @@ -1 +1 @@ - 2 age=4294787542 pid=0 cpus=0 + 2 age=4303046820 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-8/alloc_calls b/test/sys/kernel/slab/sgpool-8/alloc_calls index 26fc37cdfc..f0e2138841 100644 --- a/test/sys/kernel/slab/sgpool-8/alloc_calls +++ b/test/sys/kernel/slab/sgpool-8/alloc_calls @@ -1 +1 @@ - 2 mempool_alloc_slab+0x11/0x20 age=120005/120005/120005 pid=1 cpus=0 + 2 mempool_alloc_slab+0x11/0x20 age=8379297/8379297/8379297 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-8/free_calls b/test/sys/kernel/slab/sgpool-8/free_calls index 2b610a7b29..585a3e3502 100644 --- a/test/sys/kernel/slab/sgpool-8/free_calls +++ b/test/sys/kernel/slab/sgpool-8/free_calls @@ -1 +1 @@ - 2 age=4294787554 pid=0 cpus=0 + 2 age=4303046847 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/alloc_calls b/test/sys/kernel/slab/shmem_inode_cache/alloc_calls index 70c6630dc8..97a94a7e91 100644 --- a/test/sys/kernel/slab/shmem_inode_cache/alloc_calls +++ b/test/sys/kernel/slab/shmem_inode_cache/alloc_calls @@ -1 +1 @@ - 1144 shmem_alloc_inode+0x15/0x30 age=14176/107762/119829 pid=1-2802 cpus=0-1 + 1144 shmem_alloc_inode+0x15/0x30 age=21584/7506265/8379043 pid=1-13453 cpus=0-1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/free_calls b/test/sys/kernel/slab/shmem_inode_cache/free_calls index 31b5ec86ba..13f4f3104d 100644 --- a/test/sys/kernel/slab/shmem_inode_cache/free_calls +++ b/test/sys/kernel/slab/shmem_inode_cache/free_calls @@ -1,2 +1,2 @@ - 774 age=4294787413 pid=0 cpus=0 - 370 shmem_destroy_inode+0x24/0x30 age=37765/101539/116543 pid=72-2802 cpus=0-1 + 741 age=4303046628 pid=0 cpus=0 + 403 shmem_destroy_inode+0x24/0x30 age=21598/7406739/8375758 pid=72-13332 cpus=0-1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/objects b/test/sys/kernel/slab/shmem_inode_cache/objects index 765f5bf7fa..34684091a9 100644 --- a/test/sys/kernel/slab/shmem_inode_cache/objects +++ b/test/sys/kernel/slab/shmem_inode_cache/objects @@ -1 +1 @@ -1150 +1169 diff --git a/test/sys/kernel/slab/shmem_inode_cache/objects_partial b/test/sys/kernel/slab/shmem_inode_cache/objects_partial index 573541ac97..d81cc0710e 100644 --- a/test/sys/kernel/slab/shmem_inode_cache/objects_partial +++ b/test/sys/kernel/slab/shmem_inode_cache/objects_partial @@ -1 +1 @@ -0 +42 diff --git a/test/sys/kernel/slab/shmem_inode_cache/partial b/test/sys/kernel/slab/shmem_inode_cache/partial index 573541ac97..0cfbf08886 100644 --- a/test/sys/kernel/slab/shmem_inode_cache/partial +++ b/test/sys/kernel/slab/shmem_inode_cache/partial @@ -1 +1 @@ -0 +2 diff --git a/test/sys/kernel/slab/shmem_inode_cache/slabs b/test/sys/kernel/slab/shmem_inode_cache/slabs index e373ee695f..82cced27d7 100644 --- a/test/sys/kernel/slab/shmem_inode_cache/slabs +++ b/test/sys/kernel/slab/shmem_inode_cache/slabs @@ -1 +1 @@ -50 +51 diff --git a/test/sys/kernel/slab/shmem_inode_cache/total_objects b/test/sys/kernel/slab/shmem_inode_cache/total_objects index 765f5bf7fa..6e64a9148e 100644 --- a/test/sys/kernel/slab/shmem_inode_cache/total_objects +++ b/test/sys/kernel/slab/shmem_inode_cache/total_objects @@ -1 +1 @@ -1150 +1173 diff --git a/test/sys/kernel/slab/sighand_cache/alloc_calls b/test/sys/kernel/slab/sighand_cache/alloc_calls index b015b782a2..67d50041cd 100644 --- a/test/sys/kernel/slab/sighand_cache/alloc_calls +++ b/test/sys/kernel/slab/sighand_cache/alloc_calls @@ -1,2 +1,2 @@ - 122 copy_process+0x82a/0x1220 age=3754/97369/120458 pid=0-2850 cpus=0-1 - 1 flush_old_exec+0x4e1/0x8a0 age=118709 pid=1 cpus=0 + 123 copy_process+0x82a/0x1220 age=4154/7846897/8379923 pid=0-12336 cpus=0-1 + 1 flush_old_exec+0x4e1/0x8a0 age=8378174 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sighand_cache/free_calls b/test/sys/kernel/slab/sighand_cache/free_calls index dc73485a27..383c981c29 100644 --- a/test/sys/kernel/slab/sighand_cache/free_calls +++ b/test/sys/kernel/slab/sighand_cache/free_calls @@ -1,2 +1,2 @@ - 47 age=4294787803 pid=0 cpus=0 - 76 __cleanup_sighand+0x27/0x30 age=4749/90635/116387 pid=1-2886 cpus=0-1 + 46 age=4303047268 pid=0 cpus=0 + 78 __cleanup_sighand+0x27/0x30 age=7195/7547046/8375852 pid=1-13288 cpus=0-1 diff --git a/test/sys/kernel/slab/sighand_cache/objects b/test/sys/kernel/slab/sighand_cache/objects index 065fd3e79c..13c09a007e 100644 --- a/test/sys/kernel/slab/sighand_cache/objects +++ b/test/sys/kernel/slab/sighand_cache/objects @@ -1 +1 @@ -137 +145 diff --git a/test/sys/kernel/slab/sighand_cache/objects_partial b/test/sys/kernel/slab/sighand_cache/objects_partial index 7273c0fa8c..b1e7d265fc 100644 --- a/test/sys/kernel/slab/sighand_cache/objects_partial +++ b/test/sys/kernel/slab/sighand_cache/objects_partial @@ -1 +1 @@ -25 +61 diff --git a/test/sys/kernel/slab/sighand_cache/partial b/test/sys/kernel/slab/sighand_cache/partial index 0cfbf08886..7ed6ff82de 100644 --- a/test/sys/kernel/slab/sighand_cache/partial +++ b/test/sys/kernel/slab/sighand_cache/partial @@ -1 +1 @@ -2 +5 diff --git a/test/sys/kernel/slab/sighand_cache/slabs b/test/sys/kernel/slab/sighand_cache/slabs index f599e28b8a..b4de394767 100644 --- a/test/sys/kernel/slab/sighand_cache/slabs +++ b/test/sys/kernel/slab/sighand_cache/slabs @@ -1 +1 @@ -10 +11 diff --git a/test/sys/kernel/slab/sighand_cache/total_objects b/test/sys/kernel/slab/sighand_cache/total_objects index dee261df40..a2ecc456eb 100644 --- a/test/sys/kernel/slab/sighand_cache/total_objects +++ b/test/sys/kernel/slab/sighand_cache/total_objects @@ -1 +1 @@ -140 +154 diff --git a/test/sys/kernel/slab/signal_cache/alloc_calls b/test/sys/kernel/slab/signal_cache/alloc_calls index 6bbb2d8332..2b46f3fcf6 100644 --- a/test/sys/kernel/slab/signal_cache/alloc_calls +++ b/test/sys/kernel/slab/signal_cache/alloc_calls @@ -1 +1 @@ - 123 copy_process+0x93c/0x1220 age=3749/97552/120453 pid=0-2850 cpus=0-1 + 124 copy_process+0x93c/0x1220 age=4145/7851187/8379914 pid=0-12336 cpus=0-1 diff --git a/test/sys/kernel/slab/signal_cache/free_calls b/test/sys/kernel/slab/signal_cache/free_calls index d79c251344..e3300fb82a 100644 --- a/test/sys/kernel/slab/signal_cache/free_calls +++ b/test/sys/kernel/slab/signal_cache/free_calls @@ -1,2 +1,2 @@ - 42 age=4294787798 pid=0 cpus=0 - 81 __cleanup_signal+0x20/0x30 age=4744/91183/116382 pid=1-2886 cpus=0-1 + 42 age=4303047259 pid=0 cpus=0 + 82 __cleanup_signal+0x20/0x30 age=7186/7586663/8375843 pid=1-13288 cpus=0-1 diff --git a/test/sys/kernel/slab/signal_cache/objects b/test/sys/kernel/slab/signal_cache/objects index b4f334f265..fa8f08cb6f 100644 --- a/test/sys/kernel/slab/signal_cache/objects +++ b/test/sys/kernel/slab/signal_cache/objects @@ -1 +1 @@ -141 +150 diff --git a/test/sys/kernel/slab/signal_cache/objects_partial b/test/sys/kernel/slab/signal_cache/objects_partial index ea90ee3198..2bbd69c2e5 100644 --- a/test/sys/kernel/slab/signal_cache/objects_partial +++ b/test/sys/kernel/slab/signal_cache/objects_partial @@ -1 +1 @@ -45 +70 diff --git a/test/sys/kernel/slab/signal_cache/partial b/test/sys/kernel/slab/signal_cache/partial index 00750edc07..7ed6ff82de 100644 --- a/test/sys/kernel/slab/signal_cache/partial +++ b/test/sys/kernel/slab/signal_cache/partial @@ -1 +1 @@ -3 +5 diff --git a/test/sys/kernel/slab/signal_cache/slabs b/test/sys/kernel/slab/signal_cache/slabs index ec635144f6..f599e28b8a 100644 --- a/test/sys/kernel/slab/signal_cache/slabs +++ b/test/sys/kernel/slab/signal_cache/slabs @@ -1 +1 @@ -9 +10 diff --git a/test/sys/kernel/slab/signal_cache/total_objects b/test/sys/kernel/slab/signal_cache/total_objects index a29644e57e..a76256037d 100644 --- a/test/sys/kernel/slab/signal_cache/total_objects +++ b/test/sys/kernel/slab/signal_cache/total_objects @@ -1 +1 @@ -144 +160 diff --git a/test/sys/kernel/slab/skbuff_head_cache/alloc_calls b/test/sys/kernel/slab/skbuff_head_cache/alloc_calls index fa28337fd8..ced571b9e9 100644 --- a/test/sys/kernel/slab/skbuff_head_cache/alloc_calls +++ b/test/sys/kernel/slab/skbuff_head_cache/alloc_calls @@ -1 +1 @@ - 559 __alloc_skb+0x44/0x150 age=1225/49012/96616 pid=733-1738 cpus=0-1 + 550 __alloc_skb+0x44/0x150 age=1665/3999351/8355948 pid=733-1738 cpus=0-1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/free_calls b/test/sys/kernel/slab/skbuff_head_cache/free_calls index 1fae517f62..6019669a16 100644 --- a/test/sys/kernel/slab/skbuff_head_cache/free_calls +++ b/test/sys/kernel/slab/skbuff_head_cache/free_calls @@ -1,2 +1,2 @@ - 295 age=4294787646 pid=0 cpus=0 - 264 __kfree_skb+0x3a/0xa0 age=1225/12909/96887 pid=0-2890 cpus=0-1 + 333 age=4303046979 pid=0 cpus=0 + 217 __kfree_skb+0x3a/0xa0 age=1666/662694/8356220 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/objects b/test/sys/kernel/slab/skbuff_head_cache/objects index 6aedc8e1c9..5629a95847 100644 --- a/test/sys/kernel/slab/skbuff_head_cache/objects +++ b/test/sys/kernel/slab/skbuff_head_cache/objects @@ -1 +1 @@ -571 +570 diff --git a/test/sys/kernel/slab/skbuff_head_cache/objects_partial b/test/sys/kernel/slab/skbuff_head_cache/objects_partial index 7f8f011eb7..3c032078a4 100644 --- a/test/sys/kernel/slab/skbuff_head_cache/objects_partial +++ b/test/sys/kernel/slab/skbuff_head_cache/objects_partial @@ -1 +1 @@ -7 +18 diff --git a/test/sys/kernel/slab/skbuff_head_cache/partial b/test/sys/kernel/slab/skbuff_head_cache/partial index d00491fd7e..00750edc07 100644 --- a/test/sys/kernel/slab/skbuff_head_cache/partial +++ b/test/sys/kernel/slab/skbuff_head_cache/partial @@ -1 +1 @@ -1 +3 diff --git a/test/sys/kernel/slab/skbuff_head_cache/slabs b/test/sys/kernel/slab/skbuff_head_cache/slabs index 21e72e8ac3..95f9650f01 100644 --- a/test/sys/kernel/slab/skbuff_head_cache/slabs +++ b/test/sys/kernel/slab/skbuff_head_cache/slabs @@ -1 +1 @@ -48 +49 diff --git a/test/sys/kernel/slab/skbuff_head_cache/total_objects b/test/sys/kernel/slab/skbuff_head_cache/total_objects index bb7a7c1b1a..9745b4bc48 100644 --- a/test/sys/kernel/slab/skbuff_head_cache/total_objects +++ b/test/sys/kernel/slab/skbuff_head_cache/total_objects @@ -1 +1 @@ -576 +588 diff --git a/test/sys/kernel/slab/sock_inode_cache/alloc_calls b/test/sys/kernel/slab/sock_inode_cache/alloc_calls index 24a49d50fa..3bedaaa4a5 100644 --- a/test/sys/kernel/slab/sock_inode_cache/alloc_calls +++ b/test/sys/kernel/slab/sock_inode_cache/alloc_calls @@ -1 +1 @@ - 484 sock_alloc_inode+0x1a/0x70 age=15349/85888/120207 pid=1-2852 cpus=0-1 + 481 sock_alloc_inode+0x1a/0x70 age=61330/8214562/8379530 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/sock_inode_cache/free_calls b/test/sys/kernel/slab/sock_inode_cache/free_calls index 26c4acdd4a..c8fa1afa71 100644 --- a/test/sys/kernel/slab/sock_inode_cache/free_calls +++ b/test/sys/kernel/slab/sock_inode_cache/free_calls @@ -1,2 +1,2 @@ - 282 age=4294787638 pid=0 cpus=0 - 202 sock_destroy_inode+0x14/0x20 age=15358/84084/116905 pid=76-2851 cpus=0-1 + 276 age=4303046961 pid=0 cpus=0 + 205 sock_destroy_inode+0x14/0x20 age=61348/8035806/8376228 pid=76-20292 cpus=0-1 diff --git a/test/sys/kernel/slab/sock_inode_cache/objects b/test/sys/kernel/slab/sock_inode_cache/objects index a712e76400..84fa17bc22 100644 --- a/test/sys/kernel/slab/sock_inode_cache/objects +++ b/test/sys/kernel/slab/sock_inode_cache/objects @@ -1 +1 @@ -503 +491 diff --git a/test/sys/kernel/slab/sock_inode_cache/objects_partial b/test/sys/kernel/slab/sock_inode_cache/objects_partial index 04f9fe4606..76a8b2b703 100644 --- a/test/sys/kernel/slab/sock_inode_cache/objects_partial +++ b/test/sys/kernel/slab/sock_inode_cache/objects_partial @@ -1 +1 @@ -59 +83 diff --git a/test/sys/kernel/slab/sock_inode_cache/partial b/test/sys/kernel/slab/sock_inode_cache/partial index 1e8b314962..45a4fb75db 100644 --- a/test/sys/kernel/slab/sock_inode_cache/partial +++ b/test/sys/kernel/slab/sock_inode_cache/partial @@ -1 +1 @@ -6 +8 diff --git a/test/sys/kernel/slab/sock_inode_cache/slabs b/test/sys/kernel/slab/sock_inode_cache/slabs index 920a139664..d81cc0710e 100644 --- a/test/sys/kernel/slab/sock_inode_cache/slabs +++ b/test/sys/kernel/slab/sock_inode_cache/slabs @@ -1 +1 @@ -43 +42 diff --git a/test/sys/kernel/slab/sock_inode_cache/total_objects b/test/sys/kernel/slab/sock_inode_cache/total_objects index 1c599d4ff3..3091e8eea2 100644 --- a/test/sys/kernel/slab/sock_inode_cache/total_objects +++ b/test/sys/kernel/slab/sock_inode_cache/total_objects @@ -1 +1 @@ -516 +504 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls b/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls index 0a02b9f946..f981f4d922 100644 --- a/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls +++ b/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls @@ -1 +1 @@ - 11488 sysfs_new_dirent+0x38/0x120 age=38358/111947/120420 pid=0-2761 cpus=0-1 + 11488 sysfs_new_dirent+0x38/0x120 age=22320/7764235/8379787 pid=0-13295 cpus=0-1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/free_calls b/test/sys/kernel/slab/sysfs_dir_cache/free_calls index a810de246b..106265d1ce 100644 --- a/test/sys/kernel/slab/sysfs_dir_cache/free_calls +++ b/test/sys/kernel/slab/sysfs_dir_cache/free_calls @@ -1,2 +1,2 @@ - 11205 age=4294787719 pid=0 cpus=0 - 283 release_sysfs_dirent+0x5c/0xd0 age=92764/102566/120088 pid=1-2141 cpus=0-1 + 11006 age=4303047087 pid=0 cpus=0 + 482 release_sysfs_dirent+0x5c/0xd0 age=61294/6319346/8379456 pid=1-2141 cpus=0-1 diff --git a/test/sys/kernel/slab/task_struct/alloc_calls b/test/sys/kernel/slab/task_struct/alloc_calls index 7f78027132..6cf8b6a510 100644 --- a/test/sys/kernel/slab/task_struct/alloc_calls +++ b/test/sys/kernel/slab/task_struct/alloc_calls @@ -1 +1 @@ - 202 copy_process+0xa4/0x1220 age=3762/98500/120466 pid=0-2851 cpus=0-1 + 203 copy_process+0xa4/0x1220 age=4172/8008848/8379941 pid=0-13212 cpus=0-1 diff --git a/test/sys/kernel/slab/task_struct/free_calls b/test/sys/kernel/slab/task_struct/free_calls index 58551b31c4..70adce49ce 100644 --- a/test/sys/kernel/slab/task_struct/free_calls +++ b/test/sys/kernel/slab/task_struct/free_calls @@ -1,2 +1,2 @@ - 93 age=4294787811 pid=0 cpus=0 - 109 free_task+0x30/0x40 age=4753/91164/117575 pid=0-2740 cpus=0-1 + 93 age=4303047286 pid=0 cpus=0 + 110 free_task+0x30/0x40 age=7208/7706854/8377050 pid=0-13258 cpus=0-1 diff --git a/test/sys/kernel/slab/task_struct/objects b/test/sys/kernel/slab/task_struct/objects index 7d645f5893..dba40afcf7 100644 --- a/test/sys/kernel/slab/task_struct/objects +++ b/test/sys/kernel/slab/task_struct/objects @@ -1 +1 @@ -208 +211 diff --git a/test/sys/kernel/slab/task_struct/objects_partial b/test/sys/kernel/slab/task_struct/objects_partial index 425151f3a4..e1617e842a 100644 --- a/test/sys/kernel/slab/task_struct/objects_partial +++ b/test/sys/kernel/slab/task_struct/objects_partial @@ -1 +1 @@ -40 +57 diff --git a/test/sys/kernel/slab/task_struct/partial b/test/sys/kernel/slab/task_struct/partial index 7f8f011eb7..f599e28b8a 100644 --- a/test/sys/kernel/slab/task_struct/partial +++ b/test/sys/kernel/slab/task_struct/partial @@ -1 +1 @@ -7 +10 diff --git a/test/sys/kernel/slab/task_struct/slabs b/test/sys/kernel/slab/task_struct/slabs index e85087affd..f5c89552bd 100644 --- a/test/sys/kernel/slab/task_struct/slabs +++ b/test/sys/kernel/slab/task_struct/slabs @@ -1 +1 @@ -31 +32 diff --git a/test/sys/kernel/slab/task_struct/total_objects b/test/sys/kernel/slab/task_struct/total_objects index 0ddd619ce3..20c90807cc 100644 --- a/test/sys/kernel/slab/task_struct/total_objects +++ b/test/sys/kernel/slab/task_struct/total_objects @@ -1 +1 @@ -217 +224 diff --git a/test/sys/kernel/slab/task_xstate/alloc_calls b/test/sys/kernel/slab/task_xstate/alloc_calls index 5f5d5061f4..bbb81f8450 100644 --- a/test/sys/kernel/slab/task_xstate/alloc_calls +++ b/test/sys/kernel/slab/task_xstate/alloc_calls @@ -1,2 +1,2 @@ - 99 arch_dup_task_struct+0x51/0xa0 age=15519/98749/117104 pid=71-2851 cpus=0-1 - 50 init_fpu+0xef/0x110 age=3752/83856/118695 pid=1-2890 cpus=0-1 + 99 arch_dup_task_struct+0x51/0xa0 age=125559/8275901/8376574 pid=71-13212 cpus=0-1 + 51 init_fpu+0xef/0x110 age=4157/7436734/8378165 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/task_xstate/free_calls b/test/sys/kernel/slab/task_xstate/free_calls index 1cdf455da3..d32655a8bb 100644 --- a/test/sys/kernel/slab/task_xstate/free_calls +++ b/test/sys/kernel/slab/task_xstate/free_calls @@ -1,2 +1,2 @@ - 54 age=4294787807 pid=0 cpus=0 - 95 free_thread_xstate+0x24/0x40 age=4751/90953/115648 pid=0-2851 cpus=0-1 + 53 age=4303047277 pid=0 cpus=0 + 97 free_thread_xstate+0x24/0x40 age=7199/7795238/8375118 pid=0-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/task_xstate/objects b/test/sys/kernel/slab/task_xstate/objects index 4e9bdff0c6..9386c220a1 100644 --- a/test/sys/kernel/slab/task_xstate/objects +++ b/test/sys/kernel/slab/task_xstate/objects @@ -1 +1 @@ -164 +161 diff --git a/test/sys/kernel/slab/task_xstate/objects_partial b/test/sys/kernel/slab/task_xstate/objects_partial index d69c74c8b9..e1617e842a 100644 --- a/test/sys/kernel/slab/task_xstate/objects_partial +++ b/test/sys/kernel/slab/task_xstate/objects_partial @@ -1 +1 @@ -73 +57 diff --git a/test/sys/kernel/slab/task_xstate/partial b/test/sys/kernel/slab/task_xstate/partial index 7f8f011eb7..7ed6ff82de 100644 --- a/test/sys/kernel/slab/task_xstate/partial +++ b/test/sys/kernel/slab/task_xstate/partial @@ -1 +1 @@ -7 +5 diff --git a/test/sys/kernel/slab/task_xstate/slabs b/test/sys/kernel/slab/task_xstate/slabs index 8351c19397..b1bd38b62a 100644 --- a/test/sys/kernel/slab/task_xstate/slabs +++ b/test/sys/kernel/slab/task_xstate/slabs @@ -1 +1 @@ -14 +13 diff --git a/test/sys/kernel/slab/task_xstate/total_objects b/test/sys/kernel/slab/task_xstate/total_objects index 960e7a870f..fb402ef6a4 100644 --- a/test/sys/kernel/slab/task_xstate/total_objects +++ b/test/sys/kernel/slab/task_xstate/total_objects @@ -1 +1 @@ -182 +169 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls b/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls index 1e31ec302b..df53b0e220 100644 --- a/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls +++ b/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls @@ -1 +1 @@ - 6 inet_bind_bucket_create+0x27/0x80 age=13273/41067/96896 pid=1690-2881 cpus=0 + 3 inet_bind_bucket_create+0x27/0x80 age=926731/5878918/8356133 pid=1206-1920 cpus=0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/free_calls b/test/sys/kernel/slab/tcp_bind_bucket/free_calls index 6d66bbee69..55e14069c5 100644 --- a/test/sys/kernel/slab/tcp_bind_bucket/free_calls +++ b/test/sys/kernel/slab/tcp_bind_bucket/free_calls @@ -1,2 +1,2 @@ - 1 age=4294787443 pid=0 cpus=0 - 5 inet_bind_bucket_destroy+0x29/0x30 age=33343/49250/96585 pid=0-1707 cpus=0 + 1 age=4303046680 pid=0 cpus=0 + 2 inet_bind_bucket_destroy+0x29/0x30 age=1107644/4731733/8355822 pid=0-1707 cpus=0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/objects b/test/sys/kernel/slab/tcp_bind_bucket/objects index 900731ffd5..a787364590 100644 --- a/test/sys/kernel/slab/tcp_bind_bucket/objects +++ b/test/sys/kernel/slab/tcp_bind_bucket/objects @@ -1 +1 @@ -64 +34 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/objects_partial b/test/sys/kernel/slab/tcp_bind_bucket/objects_partial index 573541ac97..0cfbf08886 100644 --- a/test/sys/kernel/slab/tcp_bind_bucket/objects_partial +++ b/test/sys/kernel/slab/tcp_bind_bucket/objects_partial @@ -1 +1 @@ -0 +2 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/partial b/test/sys/kernel/slab/tcp_bind_bucket/partial index 573541ac97..d00491fd7e 100644 --- a/test/sys/kernel/slab/tcp_bind_bucket/partial +++ b/test/sys/kernel/slab/tcp_bind_bucket/partial @@ -1 +1 @@ -0 +1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/alloc_calls b/test/sys/kernel/slab/tw_sock_TCP/alloc_calls index 013bd3d3a7..923bedcfa7 100644 --- a/test/sys/kernel/slab/tw_sock_TCP/alloc_calls +++ b/test/sys/kernel/slab/tw_sock_TCP/alloc_calls @@ -1 +1 @@ - 4 inet_twsk_alloc+0x2e/0x110 age=13136/13559/14074 pid=0-18 cpus=0 +No data diff --git a/test/sys/kernel/slab/tw_sock_TCP/free_calls b/test/sys/kernel/slab/tw_sock_TCP/free_calls index 33082a4d64..923bedcfa7 100644 --- a/test/sys/kernel/slab/tw_sock_TCP/free_calls +++ b/test/sys/kernel/slab/tw_sock_TCP/free_calls @@ -1 +1 @@ - 4 age=4294787516 pid=0 cpus=0 +No data diff --git a/test/sys/kernel/slab/uhci_urb_priv/alloc_calls b/test/sys/kernel/slab/uhci_urb_priv/alloc_calls index 5034241ea1..6a6a516017 100644 --- a/test/sys/kernel/slab/uhci_urb_priv/alloc_calls +++ b/test/sys/kernel/slab/uhci_urb_priv/alloc_calls @@ -1 +1 @@ - 1 uhci_urb_enqueue+0xb6/0xa30 [uhci_hcd] age=94946 pid=1738 cpus=0 + 1 uhci_urb_enqueue+0xb6/0xa30 [uhci_hcd] age=53794 pid=419 cpus=0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/free_calls b/test/sys/kernel/slab/uhci_urb_priv/free_calls index cb42e9159e..07c1ab764f 100644 --- a/test/sys/kernel/slab/uhci_urb_priv/free_calls +++ b/test/sys/kernel/slab/uhci_urb_priv/free_calls @@ -1 +1 @@ - 1 uhci_free_urb_priv+0x79/0xd0 [uhci_hcd] age=95044 pid=2029 cpus=0 + 1 uhci_free_urb_priv+0x79/0xd0 [uhci_hcd] age=53806 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/uid_cache/alloc_calls b/test/sys/kernel/slab/uid_cache/alloc_calls index 444660abab..52dc2b09a3 100644 --- a/test/sys/kernel/slab/uid_cache/alloc_calls +++ b/test/sys/kernel/slab/uid_cache/alloc_calls @@ -1 +1 @@ - 5 alloc_uid+0xbd/0x1e0 age=91863/99347/106874 pid=1333-2177 cpus=0-1 + 5 alloc_uid+0xbd/0x1e0 age=8351086/8358570/8366097 pid=1333-2177 cpus=0-1 diff --git a/test/sys/kernel/slab/uid_cache/free_calls b/test/sys/kernel/slab/uid_cache/free_calls index 0d53455c31..74ef47db60 100644 --- a/test/sys/kernel/slab/uid_cache/free_calls +++ b/test/sys/kernel/slab/uid_cache/free_calls @@ -1,2 +1,2 @@ - 2 age=4294787431 pid=0 cpus=0 - 3 remove_user_sysfs_dir+0xd0/0x100 age=97952/107886/115712 pid=7 cpus=0 + 2 age=4303046654 pid=0 cpus=0 + 3 remove_user_sysfs_dir+0xd0/0x100 age=8357175/8367109/8374935 pid=7 cpus=0 diff --git a/test/sys/kernel/slab/vm_area_struct/alloc_calls b/test/sys/kernel/slab/vm_area_struct/alloc_calls index 4e906f2b26..333d4faaab 100644 --- a/test/sys/kernel/slab/vm_area_struct/alloc_calls +++ b/test/sys/kernel/slab/vm_area_struct/alloc_calls @@ -1,7 +1,7 @@ - 2751 dup_mm+0x194/0x390 age=76179/89364/117079 pid=71-2467 cpus=0-1 - 51 install_special_mapping+0x3d/0xe0 age=3731/82827/118675 pid=1-2890 cpus=0-1 - 4022 split_vma+0x61/0x140 age=3730/79432/106607 pid=1325-2890 cpus=0-1 - 6 copy_vma+0x125/0x1b0 age=12861/53719/94381 pid=1738-2881 cpus=0 - 53 do_brk+0x2ec/0x360 age=3729/83224/118688 pid=1-2890 cpus=0-1 - 5096 mmap_region+0x195/0x5c0 age=3727/78409/118688 pid=1-2890 cpus=0-1 - 51 bprm_mm_init+0xa0/0x1b0 age=3732/82898/118691 pid=1-2890 cpus=0-1 + 2751 dup_mm+0x194/0x390 age=8335622/8348807/8376522 pid=71-2467 cpus=0-1 + 52 install_special_mapping+0x3d/0xe0 age=4109/7453125/8378118 pid=1-20296 cpus=0-1 + 4006 split_vma+0x61/0x140 age=4107/7930710/8366050 pid=1206-20296 cpus=0-1 + 3 copy_vma+0x125/0x1b0 age=8353805/8353815/8353824 pid=1738 cpus=0 + 54 do_brk+0x2ec/0x360 age=4107/7486452/8378131 pid=1-20296 cpus=0-1 + 5097 mmap_region+0x195/0x5c0 age=4105/7877577/8378131 pid=1-20296 cpus=0-1 + 52 bprm_mm_init+0xa0/0x1b0 age=4109/7453192/8378134 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/vm_area_struct/free_calls b/test/sys/kernel/slab/vm_area_struct/free_calls index 4f2cdce000..e9c6dc59f1 100644 --- a/test/sys/kernel/slab/vm_area_struct/free_calls +++ b/test/sys/kernel/slab/vm_area_struct/free_calls @@ -1,3 +1,3 @@ - 6570 age=4294787785 pid=0 cpus=0 - 5459 remove_vma+0x53/0x70 age=3732/80460/117323 pid=71-2890 cpus=0-1 - 1 vma_adjust+0x32c/0x570 age=104801 pid=1371 cpus=0 + 6424 age=4303047229 pid=0 cpus=0 + 5590 remove_vma+0x53/0x70 age=4110/7683818/8376767 pid=71-20296 cpus=0-1 + 1 vma_adjust+0x32c/0x570 age=8364245 pid=1371 cpus=0 diff --git a/test/sys/kernel/slab/vm_area_struct/objects b/test/sys/kernel/slab/vm_area_struct/objects index c2816940f4..8e868178cd 100644 --- a/test/sys/kernel/slab/vm_area_struct/objects +++ b/test/sys/kernel/slab/vm_area_struct/objects @@ -1 +1 @@ -12056 +12049 diff --git a/test/sys/kernel/slab/vm_area_struct/objects_partial b/test/sys/kernel/slab/vm_area_struct/objects_partial index 9f54fe3133..abac1ea7b7 100644 --- a/test/sys/kernel/slab/vm_area_struct/objects_partial +++ b/test/sys/kernel/slab/vm_area_struct/objects_partial @@ -1 +1 @@ -122 +47 diff --git a/test/sys/kernel/slab/vm_area_struct/partial b/test/sys/kernel/slab/vm_area_struct/partial index 45a4fb75db..7ed6ff82de 100644 --- a/test/sys/kernel/slab/vm_area_struct/partial +++ b/test/sys/kernel/slab/vm_area_struct/partial @@ -1 +1 @@ -8 +5 diff --git a/test/sys/kernel/slab/vm_area_struct/slabs b/test/sys/kernel/slab/vm_area_struct/slabs index 923475f93c..b4b6dc3489 100644 --- a/test/sys/kernel/slab/vm_area_struct/slabs +++ b/test/sys/kernel/slab/vm_area_struct/slabs @@ -1 +1 @@ -710 +711 diff --git a/test/sys/kernel/slab/vm_area_struct/total_objects b/test/sys/kernel/slab/vm_area_struct/total_objects index 45504ecd95..4442e72281 100644 --- a/test/sys/kernel/slab/vm_area_struct/total_objects +++ b/test/sys/kernel/slab/vm_area_struct/total_objects @@ -1 +1 @@ -12070 +12087 diff --git a/test/sys/kernel/uevent_seqnum b/test/sys/kernel/uevent_seqnum index 23ea218891..a11d586ce9 100644 --- a/test/sys/kernel/uevent_seqnum +++ b/test/sys/kernel/uevent_seqnum @@ -1 +1 @@ -1247 +1407 diff --git a/test/udev-test.pl b/test/udev-test.pl index 26337cb840..576173b40a 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -104,7 +104,7 @@ EOF { desc => "catch device by *", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "catch device by * - take 2", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "catch device by ?", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "catch device by character class", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "replace kernel name", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "Handle comment lines in config file (and replace kernel name)", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "Handle comment lines in config file with whitespace (and replace kernel name)", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "Handle whitespace only lines (and replace kernel name)", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "whitespace" , rules => < "Handle empty lines in config file (and replace kernel name)", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "Handle backslashed multi lines in config file (and replace kernel name)", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "preserve backslashes, if they are not for a newline", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "aaa", rules => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "subdirectory handling", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "sub/direct/ory/modem" , rules => < "sysfs parent hierarchy", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "permissions OWNER to 5000", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "5000::", rules => < "permissions GROUP to 100", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => ":100:0660", rules => < "permissions MODE to 0060", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "::0060", rules => < "permissions OWNER, GROUP, MODE", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "5000:100:0777", rules => < "permissions only rule", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "5000:100:0777", rules => < "multiple permissions only rule", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "3000:4000:0777", rules => < "permissions only rule with override at NAME rule", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "3000:8000:0777", rules => < "multiple symlinks with format char", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink2-ttyACM0", exp_target => "ttyACM0", rules => < "multiple symlinks with a lot of s p a c e s", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "one", not_exp_name => " ", exp_target => "ttyACM0", @@ -821,7 +821,7 @@ EOF { desc => "symlink creation (same directory)", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem0", exp_target => "ttyACM0", rules => < "multiple symlinks", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "second-0" , exp_target => "modem" , rules => < "symlink %n substitution", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink0", exp_target => "ttyACM0", rules => < "symlink %k substitution", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink-ttyACM0", exp_target => "ttyACM0", rules => < "symlink %M:%m substitution", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "major-166:0", exp_target => "ttyACM0", rules => < "symlink %c substitution", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", exp_target => "ttyACM0", rules => < "symlink %c{N} substitution", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", exp_target => "ttyACM0", rules => < "symlink %c{N+} substitution", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "this", exp_target => "ttyACM0", rules => < "symlink %s{filename} substitution", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "166:0", exp_target => "ttyACM0", rules => < "symlink %Ns{filename} substitution", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "166", exp_target => "ttyACM0", rules => < "read sysfs value from device down in the chain", subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "serial-354172020305000", rules => < "reset list to current value", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "three", not_exp_name => "two", exp_target => "node", @@ -1407,7 +1407,7 @@ EOF { desc => "test empty NAME", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "node", not_exp_name => "wrong", exp_add_error => "yes", @@ -1419,7 +1419,7 @@ EOF { desc => "test empty NAME 2", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "test multi matches", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "test multi matches 2", subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/tty/ttyACM0", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < Date: Mon, 29 Sep 2008 05:03:43 +0200 Subject: gitignore: move *.8 to subdirs --- .gitignore | 1 - extras/volume_id/.gitignore | 2 ++ udev/.gitignore | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 358bc4db12..7f1fbb63ee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ *~ *.o -*.[78] *.a *.lo *.la diff --git a/extras/volume_id/.gitignore b/extras/volume_id/.gitignore index 31cd6885b3..3081cde4cb 100644 --- a/extras/volume_id/.gitignore +++ b/extras/volume_id/.gitignore @@ -1 +1,3 @@ vol_id +*.8 + diff --git a/udev/.gitignore b/udev/.gitignore index 1e1ee3632f..f452b67232 100644 --- a/udev/.gitignore +++ b/udev/.gitignore @@ -1,3 +1,5 @@ udevd udevadm test-udev +*.[78] + -- cgit v1.2.3-54-g00ecf From 5c0f595d91a21b1fba2b9edd89511a072036d0e8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Sep 2008 05:18:23 +0200 Subject: test: replace last reference of "/class/*" devpath --- Makefile.am | 3 ++- test/udev-test.pl | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 31c0fca183..0963ce828e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,4 +47,5 @@ git-release: head -1 NEWS | grep -q "udev $(VERSION)" git commit -a -m "release $(VERSION)" cat .git/refs/heads/master > .git/refs/tags/$(VERSION) - git gc --prune + git gc + git prune diff --git a/test/udev-test.pl b/test/udev-test.pl index 576173b40a..df5e3fcb2a 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -610,7 +610,7 @@ EOF { desc => "permissions USER=bad GROUP=name", subsys => "tty", - devpath => "/class/tty/tty33", + devpath => "/devices/virtual/tty/tty33", exp_name => "tty33", exp_perms => "0:0:0660", rules => < "symlink node to itself", subsys => "tty", - devpath => "/class/tty/tty0", + devpath => "/devices/virtual/tty/tty0", exp_name => "link", exp_target => "link", exp_add_error => "yes", -- cgit v1.2.3-54-g00ecf From 659353f5a9a52336c41cf595d933311b8dc48937 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 29 Sep 2008 16:01:32 +0100 Subject: replace strerror() usage with threadsafe "%m" format string strerror() is not threadsafe. It uses a buffer to build messages of the form "Unknown error 387689". syslog() provides a %m format which is equivalent to strerror(errno). As a GNU extension, this is also accepted by printf and friends. At least in the current implementation, it is correctly threadsafe. Signed-off-by: Alan Jenkins --- udev/lib/libudev-ctrl.c | 8 ++++---- udev/lib/libudev-device.c | 8 ++++---- udev/lib/libudev-monitor.c | 8 ++++---- udev/lib/libudev.c | 6 +++--- udev/udev_db.c | 12 ++++++------ udev/udev_device_event.c | 14 +++++++------- udev/udev_node.c | 18 +++++++++--------- udev/udev_rules.c | 18 +++++++++--------- udev/udev_rules_parse.c | 4 ++-- udev/udev_sysfs.c | 4 ++-- udev/udev_utils.c | 6 +++--- udev/udev_utils_file.c | 8 ++++---- udev/udevadm-monitor.c | 2 +- udev/udevadm-trigger.c | 4 ++-- udev/udevd.c | 26 +++++++++++++------------- 15 files changed, 73 insertions(+), 73 deletions(-) diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index 7d37074fef..268ce2d353 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -79,7 +79,7 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (uctrl->sock < 0) { - err(udev, "error getting socket: %s\n", strerror(errno)); + err(udev, "error getting socket: %m\n"); udev_ctrl_unref(uctrl); return NULL; } @@ -101,7 +101,7 @@ int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) err= bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); if (err < 0) { - err(uctrl->udev, "bind failed: %s\n", strerror(errno)); + err(uctrl->udev, "bind failed: %m\n"); return err; } @@ -158,7 +158,7 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int err = sendto(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); if (err == -1) { - err(uctrl->udev, "error sending message: %s\n", strerror(errno)); + err(uctrl->udev, "error sending message: %m\n"); } return err; } @@ -227,7 +227,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) size = recvmsg(uctrl->sock, &smsg, 0); if (size < 0) { - err(uctrl->udev, "unable to receive user udevd message: %s\n", strerror(errno)); + err(uctrl->udev, "unable to receive user udevd message: %m\n"); goto err; } cmsg = CMSG_FIRSTHDR(&smsg); diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 4d000292f2..4cdc957093 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -77,7 +77,7 @@ static int device_read_db(struct udev_device *udev_device) syspath_to_db_path(udev_device, filename, sizeof(filename)); if (lstat(filename, &stats) != 0) { - info(udev_device->udev, "no db file to read %s: %s\n", filename, strerror(errno)); + info(udev_device->udev, "no db file to read %s: %m\n", filename); return -1; } if ((stats.st_mode & S_IFMT) == S_IFLNK) { @@ -88,7 +88,7 @@ static int device_read_db(struct udev_device *udev_device) if (target_len > 0) target[target_len] = '\0'; else { - info(udev_device->udev, "error reading db link %s: %s\n", filename, strerror(errno)); + info(udev_device->udev, "error reading db link %s: %m\n", filename); return -1; } if (asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), target) < 0) @@ -99,7 +99,7 @@ static int device_read_db(struct udev_device *udev_device) f = fopen(filename, "r"); if (f == NULL) { - info(udev_device->udev, "error reading db file %s: %s\n", filename, strerror(errno)); + info(udev_device->udev, "error reading db file %s: %m\n", filename); return -1; } while (fgets(line, sizeof(line), f)) { @@ -653,7 +653,7 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch util_strlcat(path, attr, sizeof(path)); if (lstat(path, &statbuf) != 0) { - info(udev_device->udev, "stat '%s' failed: %s\n", path, strerror(errno)); + info(udev_device->udev, "stat '%s' failed: %m\n", path); goto out; } diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 8a1bdaed06..e72b206623 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -83,7 +83,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %s\n", strerror(errno)); + err(udev, "error getting socket: %m\n"); free(udev_monitor); return NULL; } @@ -106,7 +106,7 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev) udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %s\n", strerror(errno)); + err(udev, "error getting socket: %m\n"); free(udev_monitor); return NULL; } @@ -127,14 +127,14 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) if (udev_monitor->snl.nl_family != 0) { err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); if (err < 0) { - err(udev_monitor->udev, "bind failed: %s\n", strerror(errno)); + err(udev_monitor->udev, "bind failed: %m\n"); return err; } info(udev_monitor->udev, "monitor %p listening on netlink\n", udev_monitor); } else if (udev_monitor->sun.sun_family != 0) { err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); if (err < 0) { - err(udev_monitor->udev, "bind failed: %s\n", strerror(errno)); + err(udev_monitor->udev, "bind failed: %m\n"); return err; } /* enable receiving of the sender credentials */ diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 4fd8196bd9..12220e7a78 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -131,7 +131,7 @@ void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int return; } if (lsetfilecon(file, scontext) < 0) - err(udev, "setfilecon %s failed: %s\n", file, strerror(errno)); + err(udev, "setfilecon %s failed: %m\n", file); freecon(scontext); } #endif @@ -150,7 +150,7 @@ void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned i return; } if (setfscreatecon(scontext) < 0) - err(udev, "setfscreatecon %s failed: %s\n", file, strerror(errno)); + err(udev, "setfscreatecon %s failed: %m\n", file); freecon(scontext); } #endif @@ -163,7 +163,7 @@ void udev_selinux_resetfscreatecon(struct udev *udev) selinux_init(udev); if (udev->selinux_enabled) { if (setfscreatecon(udev->selinux_prev_scontext) < 0) - err(udev, "setfscreatecon failed: %s\n", strerror(errno)); + err(udev, "setfscreatecon failed: %m\n"); } #endif } diff --git a/udev/udev_db.c b/udev/udev_db.c index 4f3dc606e4..34bdef3753 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -88,7 +88,7 @@ int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list dir = opendir(dirname); if (dir == NULL) { - info(udev, "no index directory '%s': %s\n", dirname, strerror(errno)); + info(udev, "no index directory '%s': %m\n", dirname); rc = -1; goto out; } @@ -147,7 +147,7 @@ int udev_db_add_device(struct udevice *udevice) ret = symlink(udevice->name, filename); udev_selinux_resetfscreatecon(udevice->udev); if (ret != 0) { - err(udevice->udev, "unable to create db link '%s': %s\n", filename, strerror(errno)); + err(udevice->udev, "unable to create db link '%s': %m\n", filename); return -1; } } else { @@ -156,7 +156,7 @@ int udev_db_add_device(struct udevice *udevice) f = fopen(filename, "w"); if (f == NULL) { - err(udevice->udev, "unable to create db file '%s': %s\n", filename, strerror(errno)); + err(udevice->udev, "unable to create db file '%s': %m\n", filename); return -1; } dbg(udevice->udev, "storing data for device '%s' in '%s'\n", udevice->dev->devpath, filename); @@ -203,7 +203,7 @@ int udev_db_get_device(struct udevice *udevice, const char *devpath) devpath_to_db_path(udevice->udev, devpath, filename, sizeof(filename)); if (lstat(filename, &stats) != 0) { - info(udevice->udev, "no db file to read %s: %s\n", filename, strerror(errno)); + info(udevice->udev, "no db file to read %s: %m\n", filename); return -1; } if ((stats.st_mode & S_IFMT) == S_IFLNK) { @@ -215,7 +215,7 @@ int udev_db_get_device(struct udevice *udevice, const char *devpath) if (target_len > 0) target[target_len] = '\0'; else { - info(udevice->udev, "error reading db link %s: %s\n", filename, strerror(errno)); + info(udevice->udev, "error reading db link %s: %m\n", filename); return -1; } dbg(udevice->udev, "db link points to '%s'\n", target); @@ -224,7 +224,7 @@ int udev_db_get_device(struct udevice *udevice, const char *devpath) } if (file_map(filename, &buf, &bufsize) != 0) { - info(udevice->udev, "error reading db file %s: %s\n", filename, strerror(errno)); + info(udevice->udev, "error reading db file %s: %m\n", filename); return -1; } diff --git a/udev/udev_device_event.c b/udev/udev_device_event.c index aacd1d2bc1..4408400ff8 100644 --- a/udev/udev_device_event.c +++ b/udev/udev_device_event.c @@ -63,7 +63,7 @@ static int rename_netif(struct udevice *udevice) sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { - err(udevice->udev, "error opening socket: %s\n", strerror(errno)); + err(udevice->udev, "error opening socket: %m\n"); return -1; } @@ -78,8 +78,8 @@ static int rename_netif(struct udevice *udevice) /* see if the destination interface name already exists */ if (errno != EEXIST) { - err(udevice->udev, "error changing netif name %s to %s: %s\n", - ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err(udevice->udev, "error changing netif name %s to %s: %m\n", + ifr.ifr_name, ifr.ifr_newname); goto exit; } @@ -88,8 +88,8 @@ static int rename_netif(struct udevice *udevice) util_strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); retval = ioctl(sk, SIOCSIFNAME, &ifr); if (retval != 0) { - err(udevice->udev, "error changing netif name %s to %s: %s\n", - ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err(udevice->udev, "error changing netif name %s to %s: %m\n", + ifr.ifr_name, ifr.ifr_newname); goto exit; } @@ -105,8 +105,8 @@ static int rename_netif(struct udevice *udevice) } if (errno != EEXIST) { - err(udevice->udev, "error changing net interface name %s to %s: %s\n", - ifr.ifr_name, ifr.ifr_newname, strerror(errno)); + err(udevice->udev, "error changing net interface name %s to %s: %m\n", + ifr.ifr_name, ifr.ifr_newname); break; } dbg(udevice->udev, "wait for netif '%s' to become free, loop=%i\n", diff --git a/udev/udev_node.c b/udev/udev_node.c index 8971f9ff3f..a43e5bd63f 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -58,13 +58,13 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ err = mknod(file_tmp, mode, devt); udev_selinux_resetfscreatecon(udevice->udev); if (err != 0) { - err(udevice->udev, "mknod(%s, %#o, %u, %u) failed: %s\n", - file_tmp, mode, major(devt), minor(devt), strerror(errno)); + err(udevice->udev, "mknod(%s, %#o, %u, %u) failed: %m\n", + file_tmp, mode, major(devt), minor(devt)); goto exit; } err = rename(file_tmp, file); if (err != 0) { - err(udevice->udev, "rename(%s, %s) failed: %s\n", file_tmp, file, strerror(errno)); + err(udevice->udev, "rename(%s, %s) failed: %m\n", file_tmp, file); unlink(file_tmp); } } @@ -74,8 +74,8 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ err = mknod(file, mode, devt); udev_selinux_resetfscreatecon(udevice->udev); if (err != 0) { - err(udevice->udev, "mknod(%s, %#o, (%u,%u) failed: %s\n", - file, mode, major(devt), minor(devt), strerror(errno)); + err(udevice->udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", + file, mode, major(devt), minor(devt)); goto exit; } } @@ -84,7 +84,7 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ info(udevice->udev, "chmod(%s, %#o)\n", file, mode); err = chmod(file, mode); if (err != 0) { - err(udevice->udev, "chmod(%s, %#o) failed: %s\n", file, mode, strerror(errno)); + err(udevice->udev, "chmod(%s, %#o) failed: %m\n", file, mode); goto exit; } } @@ -93,7 +93,7 @@ int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_ info(udevice->udev, "chown(%s, %u, %u)\n", file, uid, gid); err = chown(file, uid, gid); if (err != 0) { - err(udevice->udev, "chown(%s, %u, %u) failed: %s\n", file, uid, gid, strerror(errno)); + err(udevice->udev, "chown(%s, %u, %u) failed: %m\n", file, uid, gid); goto exit; } } @@ -170,12 +170,12 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s retval = symlink(target, slink_tmp); udev_selinux_resetfscreatecon(udevice->udev); if (retval != 0) { - err(udevice->udev, "symlink(%s, %s) failed: %s\n", target, slink_tmp, strerror(errno)); + err(udevice->udev, "symlink(%s, %s) failed: %m\n", target, slink_tmp); goto exit; } retval = rename(slink_tmp, slink); if (retval != 0) { - err(udevice->udev, "rename(%s, %s) failed: %s\n", slink_tmp, slink, strerror(errno)); + err(udevice->udev, "rename(%s, %s) failed: %m\n", slink_tmp, slink); unlink(slink_tmp); goto exit; } diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 9c37571fb0..9527f46e79 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -159,13 +159,13 @@ static int run_program(struct udev *udev, const char *command, const char *subsy /* prepare pipes from child to parent */ if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { if (pipe(outpipe) != 0) { - err(udev, "pipe failed: %s\n", strerror(errno)); + err(udev, "pipe failed: %m\n"); return -1; } } if (udev_get_log_priority(udev) >= LOG_INFO) { if (pipe(errpipe) != 0) { - err(udev, "pipe failed: %s\n", strerror(errno)); + err(udev, "pipe failed: %m\n"); return -1; } } @@ -196,7 +196,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy dup2(devnull, STDERR_FILENO); close(devnull); } else - err(udev, "open /dev/null failed: %s\n", strerror(errno)); + err(udev, "open /dev/null failed: %m\n"); if (outpipe[WRITE_END] > 0) { dup2(outpipe[WRITE_END], STDOUT_FILENO); close(outpipe[WRITE_END]); @@ -215,7 +215,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy } _exit(1); case -1: - err(udev, "fork of '%s' failed: %s\n", argv[0], strerror(errno)); + err(udev, "fork of '%s' failed: %m\n", argv[0]); return -1; default: /* read from child if requested */ @@ -258,7 +258,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy close(outpipe[READ_END]); outpipe[READ_END] = -1; if (count < 0) { - err(udev, "stdin read failed: %s\n", strerror(errno)); + err(udev, "stdin read failed: %m\n"); retval = -1; } continue; @@ -292,7 +292,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy close(errpipe[READ_END]); errpipe[READ_END] = -1; if (count < 0) - err(udev, "stderr read failed: %s\n", strerror(errno)); + err(udev, "stderr read failed: %m\n"); continue; } errbuf[count] = '\0'; @@ -392,7 +392,7 @@ static int import_file_into_env(struct udevice *udevice, const char *filename) size_t bufsize; if (file_map(filename, &buf, &bufsize) != 0) { - err(udevice->udev, "can't open '%s': %s\n", filename, strerror(errno)); + err(udevice->udev, "can't open '%s': %m\n", filename); return -1; } import_keys_into_env(udevice, buf, bufsize); @@ -1352,10 +1352,10 @@ try_parent: if (f != NULL) { if (!udevice->test_run) if (fprintf(f, "%s", value) <= 0) - err(udevice->udev, "error writing ATTR{%s}: %s\n", attr, strerror(errno)); + err(udevice->udev, "error writing ATTR{%s}: %m\n", attr); fclose(f); } else - err(udevice->udev, "error opening ATTR{%s} for writing: %s\n", attr, strerror(errno)); + err(udevice->udev, "error opening ATTR{%s} for writing: %m\n", attr); } } return 0; diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 5a76889c84..81ba51fe0f 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -692,7 +692,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) start = rules->bufsize; if (file_map(filename, &buf, &bufsize) != 0) { - err(rules->udev, "can't open '%s' as rules file: %s\n", filename, strerror(errno)); + err(rules->udev, "can't open '%s' as rules file: %m\n", filename); return -1; } info(rules->udev, "reading '%s' as rules file\n", filename); @@ -831,7 +831,7 @@ int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_nam else dbg(udev, "empty rules file '%s'\n", name_loop->name); } else - err(udev, "could not read '%s': %s\n", name_loop->name, strerror(errno)); + err(udev, "could not read '%s': %m\n", name_loop->name); list_del(&name_loop->node); free(name_loop); } diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c index 3e395a2801..2ea724a78f 100644 --- a/udev/udev_sysfs.c +++ b/udev/udev_sysfs.c @@ -173,7 +173,7 @@ struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); util_strlcat(path, devpath_real, sizeof(path)); if (lstat(path, &statbuf) != 0) { - dbg(udev, "stat '%s' failed: %s\n", path, strerror(errno)); + dbg(udev, "stat '%s' failed: %m\n", path); return NULL; } if (S_ISLNK(statbuf.st_mode)) { @@ -352,7 +352,7 @@ char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *a list_add(&attr->node, &attr_list); if (lstat(path_full, &statbuf) != 0) { - dbg(udev, "stat '%s' failed: %s\n", path_full, strerror(errno)); + dbg(udev, "stat '%s' failed: %m\n", path_full); goto out; } diff --git a/udev/udev_utils.c b/udev/udev_utils.c index 09b965ef3b..4623c30caf 100644 --- a/udev/udev_utils.c +++ b/udev/udev_utils.c @@ -132,7 +132,7 @@ int add_matching_files(struct udev *udev, struct list_head *name_list, const cha dbg(udev, "open directory '%s'\n", dirname); dir = opendir(dirname); if (dir == NULL) { - err(udev, "unable to open '%s': %s\n", dirname, strerror(errno)); + err(udev, "unable to open '%s': %m\n", dirname); return -1; } @@ -176,7 +176,7 @@ uid_t lookup_user(struct udev *udev, const char *user) if (errno == 0 || errno == ENOENT || errno == ESRCH) err(udev, "specified user '%s' unknown\n", user); else - err(udev, "error resolving user '%s': %s\n", user, strerror(errno)); + err(udev, "error resolving user '%s': %m\n", user); } else uid = pw->pw_uid; @@ -194,7 +194,7 @@ extern gid_t lookup_group(struct udev *udev, const char *group) if (errno == 0 || errno == ENOENT || errno == ESRCH) err(udev, "specified group '%s' unknown\n", group); else - err(udev, "error resolving group '%s': %s\n", group, strerror(errno)); + err(udev, "error resolving group '%s': %m\n", group); } else gid = gr->gr_gid; diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c index 1c7b07347b..84ff09e050 100644 --- a/udev/udev_utils_file.c +++ b/udev/udev_utils_file.c @@ -91,7 +91,7 @@ int delete_path(struct udev *udev, const char *path) if (retval) { if (errno == ENOTEMPTY) return 0; - err(udev, "rmdir(%s) failed: %s\n", p, strerror(errno)); + err(udev, "rmdir(%s) failed: %m\n", p); break; } dbg(udev, "removed '%s'\n", p); @@ -108,18 +108,18 @@ int unlink_secure(struct udev *udev, const char *filename) retval = chown(filename, 0, 0); if (retval) - err(udev, "chown(%s, 0, 0) failed: %s\n", filename, strerror(errno)); + err(udev, "chown(%s, 0, 0) failed: %m\n", filename); retval = chmod(filename, 0000); if (retval) - err(udev, "chmod(%s, 0000) failed: %s\n", filename, strerror(errno)); + err(udev, "chmod(%s, 0000) failed: %m\n", filename); retval = unlink(filename); if (errno == ENOENT) retval = 0; if (retval) - err(udev, "unlink(%s) failed: %s\n", filename, strerror(errno)); + err(udev, "unlink(%s) failed: %m\n", filename); return retval; } diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 01126c9951..d5992ceb6c 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -168,7 +168,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) - fprintf(stderr, "error receiving uevent message: %s\n", strerror(errno)); + fprintf(stderr, "error receiving uevent message: %m\n"); continue; } diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index e7940ef92d..a0f10dac68 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -105,12 +105,12 @@ static void trigger_uevent(struct udev *udev, const char *syspath, const char *a fd = open(filename, O_WRONLY); if (fd < 0) { - dbg(udev, "error on opening %s: %s\n", filename, strerror(errno)); + dbg(udev, "error on opening %s: %m\n", filename); return; } if (write(fd, action, strlen(action)) < 0) - info(udev, "error writing '%s' to '%s': %s\n", action, filename, strerror(errno)); + info(udev, "error writing '%s' to '%s': %m\n", action, filename); close(fd); } diff --git a/udev/udevd.c b/udev/udevd.c index e1ae7eac54..1f8483c301 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -264,7 +264,7 @@ static void udev_event_run(struct udevd_uevent_msg *msg) exit(1); exit(0); case -1: - err(msg->udev, "fork of child failed: %s\n", strerror(errno)); + err(msg->udev, "fork of child failed: %m\n"); msg_queue_delete(msg); break; default: @@ -619,7 +619,7 @@ static struct udevd_uevent_msg *get_netlink_msg(struct udev *udev) size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); if (size < 0) { if (errno != EINTR) - err(udev, "unable to receive kernel netlink message: %s\n", strerror(errno)); + err(udev, "unable to receive kernel netlink message: %m\n"); return NULL; } @@ -729,7 +729,7 @@ static int init_uevent_netlink_sock(struct udev *udev) uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); if (uevent_netlink_sock == -1) { - err(udev, "error getting socket: %s\n", strerror(errno)); + err(udev, "error getting socket: %m\n"); return -1; } @@ -738,7 +738,7 @@ static int init_uevent_netlink_sock(struct udev *udev) retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); if (retval < 0) { - err(udev, "bind failed: %s\n", strerror(errno)); + err(udev, "bind failed: %m\n"); close(uevent_netlink_sock); uevent_netlink_sock = -1; return -1; @@ -876,29 +876,29 @@ int main(int argc, char *argv[]) retval = pipe(signal_pipe); if (retval < 0) { - err(udev, "error getting pipes: %s\n", strerror(errno)); + err(udev, "error getting pipes: %m\n"); goto exit; } retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); if (retval < 0) { - err(udev, "error fcntl on read pipe: %s\n", strerror(errno)); + err(udev, "error fcntl on read pipe: %m\n"); goto exit; } retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { - err(udev, "error fcntl on read pipe: %s\n", strerror(errno)); + err(udev, "error fcntl on read pipe: %m\n"); goto exit; } retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); if (retval < 0) { - err(udev, "error fcntl on write pipe: %s\n", strerror(errno)); + err(udev, "error fcntl on write pipe: %m\n"); goto exit; } retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); if (retval < 0) { - err(udev, "error fcntl on write pipe: %s\n", strerror(errno)); + err(udev, "error fcntl on write pipe: %m\n"); goto exit; } @@ -917,7 +917,7 @@ int main(int argc, char *argv[]) dbg(udev, "daemonized fork running\n"); break; case -1: - err(udev, "fork of daemon failed: %s\n", strerror(errno)); + err(udev, "fork of daemon failed: %m\n"); rc = 4; goto exit; default: @@ -945,7 +945,7 @@ int main(int argc, char *argv[]) /* OOM_DISABLE == -17 */ fd = open("/proc/self/oom_adj", O_RDWR); if (fd < 0) - err(udev, "error disabling OOM: %s\n", strerror(errno)); + err(udev, "error disabling OOM: %m\n"); else { write(fd, "-17", 3); close(fd); @@ -992,7 +992,7 @@ int main(int argc, char *argv[]) } else if (errno == ENOSYS) err(udev, "the kernel does not support inotify, udevd can't monitor rules file changes\n"); else - err(udev, "inotify_init failed: %s\n", strerror(errno)); + err(udev, "inotify_init failed: %m\n"); /* maximum limit of forked childs */ value = getenv("UDEVD_MAX_CHILDS"); @@ -1035,7 +1035,7 @@ int main(int argc, char *argv[]) fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) - err(udev, "error in select: %s\n", strerror(errno)); + err(udev, "error in select: %m\n"); continue; } -- cgit v1.2.3-54-g00ecf From 120ff8a0e8666b9be84fbd1c22ceeef1b1bd0158 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 29 Sep 2008 17:37:44 +0100 Subject: fix messages (inc. debug compile failure) introduced when optimizing "goto" Signed-off-by: --- udev/udev_rules_parse.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 81ba51fe0f..b7ae06a20d 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -63,7 +63,7 @@ struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule struct udev_rules *rules = iter->rules; struct udev_rule *rule; - dbg(rules->udev "current=%zi\n", iter->current); + dbg(rules->udev, "current=%zi\n", iter->current); iter->current = rule_off; rule = (struct udev_rule *) (rules->buf + iter->current); @@ -745,10 +745,10 @@ static int parse_file(struct udev_rules *rules, const char *filename) if (rule->goto_label.operation != KEY_OP_UNSET) { char *goto_label = &rule->buf[rule->goto_label.val_off]; - dbg(rules->udev, "resolving goto label '%s'", goto_label); + dbg(rules->udev, "resolving goto label '%s'\n", goto_label); rule->goto_rule_off = find_label(&iter, goto_label); if (rule->goto_rule_off == iter.current) { - err(rules->udev, "goto nonexistent label '%s' in '%s'", + err(rules->udev, "goto nonexistent label '%s' in '%s'\n", goto_label, filename); } } -- cgit v1.2.3-54-g00ecf From 9176ac1f4e42f71df692773651898100b253774c Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Mon, 29 Sep 2008 17:50:21 +0100 Subject: allow compiler to check dbg() arguments on non-debug builds Signed-off-by: Alan Jenkins --- udev/lib/libudev-private.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 162b33aef6..8f847158b2 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -23,12 +23,17 @@ #include #include "libudev.h" +static inline void __attribute__ ((format(printf, 2, 3))) +log_null(struct udev *udev, const char *format, ...) +{ +} + #ifdef USE_LOG #ifdef USE_DEBUG #define dbg(udev, arg...) \ udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) #else -#define dbg(format, arg...) do { } while (0) +#define dbg log_null #endif /* USE_DEBUG */ #define info(udev, arg...) \ @@ -37,9 +42,9 @@ #define err(udev, arg...) \ udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) #else -#define dbg(format, arg...) do { } while (0) -#define info(format, arg...) do { } while (0) -#define err(format, arg...) do { } while (0) +#define dbg log_null +#define info log_null +#define err log_null #endif /* libudev */ -- cgit v1.2.3-54-g00ecf From 4aa0b15efbb44dbcbb0a4fa6e7bb45e70e1ec537 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Sep 2008 19:03:08 +0200 Subject: fix dbg() callers --- extras/scsi_id/scsi_id.c | 14 +++++++------- extras/usb_id/usb_id.c | 4 ++-- udev/udevadm-info.c | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index bf06ed2794..10ec98c8bf 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -256,7 +256,7 @@ static int get_file_options(struct udev *udev, if (*buf == '#') continue; - dbg("lineno %d: '%s'\n", lineno, buf); + dbg(udev, "lineno %d: '%s'\n", lineno, buf); str1 = strsep(&buf, "="); if (str1 && strcasecmp(str1, "VENDOR") == 0) { str1 = get_value(&buf); @@ -286,7 +286,7 @@ static int get_file_options(struct udev *udev, } options_in = str1; } - dbg("config file line %d:\n" + dbg(udev, "config file line %d:\n" " vendor '%s'; model '%s'; options '%s'\n", lineno, vendor_in, model_in, options_in); /* @@ -299,7 +299,7 @@ static int get_file_options(struct udev *udev, } if (vendor == NULL) { if (vendor_in == NULL) { - dbg("matched global option\n"); + dbg(udev, "matched global option\n"); break; } } else if ((vendor_in && strncmp(vendor, vendor_in, @@ -313,10 +313,10 @@ static int get_file_options(struct udev *udev, * give a partial match (that is FOO * matches FOOBAR). */ - dbg("matched vendor/model\n"); + dbg(udev, "matched vendor/model\n"); break; } else { - dbg("no match\n"); + dbg(udev, "no match\n"); } } @@ -589,7 +589,7 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) /* get per device (vendor + model) options from the config file */ retval = per_dev_options(udev, &dev_scsi, &good_dev, &page_code); - dbg("per dev options: good %d; page code 0x%x\n", good_dev, page_code); + dbg(udev, "per dev options: good %d; page code 0x%x\n", good_dev, page_code); if (!good_dev) { retval = 1; @@ -617,7 +617,7 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) format_serial(dev_scsi.serial); printf("%s\n", dev_scsi.serial); } - dbg("%s\n", dev_scsi.serial); + dbg(udev, "%s\n", dev_scsi.serial); retval = 0; } diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index f482147b68..2154552120 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -208,7 +208,7 @@ static int usb_id(struct udev *udev, const char *devpath) int if_class_num; int protocol = 0; - dbg("devpath %s\n", devpath); + dbg(udev, "devpath %s\n", devpath); /* get all usb specific information: dev_interface, if_class, dev_usb */ dev = sysfs_device_get(udev, devpath); @@ -327,7 +327,7 @@ fallback: usb_model = sysfs_attr_get_value(udev, dev_usb->devpath, "idProduct"); if (!usb_model) { - dbg("No USB model information available\n"); + dbg(udev, "No USB model information available\n"); return 1; } set_str(model_str, usb_model, sizeof(model_str)-1); diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 0a774b057f..624fb01eb4 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -32,6 +32,7 @@ static void print_all_attributes(struct udev_device *device, const char *key) { + struct udev *udev = udev_device_get_udev(device); DIR *dir; struct dirent *dent; @@ -69,7 +70,7 @@ static void print_all_attributes(struct udev_device *device, const char *key) while (len > 0 && isprint(value[len-1])) len--; if (len > 0) { - dbg(info, "attribute value of '%s' non-printable, skip\n", dent->d_name); + dbg(udev, "attribute value of '%s' non-printable, skip\n", dent->d_name); continue; } -- cgit v1.2.3-54-g00ecf From c97f839eed652c3e05eb71bc2ba5fbe40678e7b7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Sep 2008 13:42:26 +0200 Subject: libudev: enumerate - scan devices and subsystems, add subsystem and attribute filter --- udev/lib/exported_symbols | 9 +- udev/lib/libudev-device.c | 12 +- udev/lib/libudev-enumerate.c | 322 ++++++++++++++++++++++++++++--------------- udev/lib/libudev.h | 7 +- udev/lib/test-libudev.c | 14 +- udev/udevadm-info.c | 2 +- 6 files changed, 241 insertions(+), 125 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 21b433e9f5..edd3c76f3d 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -32,12 +32,17 @@ udev_device_get_devnum udev_device_get_seqnum udev_device_get_attr_value udev_enumerate_new -udev_enumerate_scan_devices -udev_enumerate_scan_subsystems udev_enumerate_ref udev_enumerate_unref udev_enumerate_get_udev udev_enumerate_get_list_entry +udev_enumerate_add_match_subsystem +udev_enumerate_add_nomatch_subsystem +udev_enumerate_add_match_attr +udev_enumerate_add_nomatch_attr +udev_enumerate_scan_devices +udev_enumerate_scan_subsystems +udev_enumerate_add_device udev_monitor_new_from_socket udev_monitor_new_from_netlink udev_monitor_enable_receiving diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 4cdc957093..f5465e9892 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -318,21 +318,19 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de /* fallback to search sys devices for the major/minor */ if (type == 'b') - udev_enumerate_scan_devices(udev_enumerate, "block", NULL); + udev_enumerate_add_match_subsystem(udev_enumerate, "block"); else if (type == 'c') - udev_enumerate_scan_devices(udev_enumerate, "!block", NULL); + udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); + udev_enumerate_scan_devices(udev_enumerate); udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { struct udev_device *device_loop; device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); if (device_loop != NULL) { if (udev_device_get_devnum(device_loop) == devnum) { - const char *subsystem; - - subsystem = udev_device_get_subsystem(device_loop); - if (type == 'b' && strcmp(subsystem, "block") != 0) + if (type == 'b' && strcmp(udev_device_get_subsystem(device_loop), "block") != 0) continue; - if (type == 'c' && strcmp(subsystem, "block") == 0) + if (type == 'c' && strcmp(udev_device_get_subsystem(device_loop), "block") == 0) continue; device = device_loop; break; diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 266164ae51..0377649cfd 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include "libudev.h" @@ -32,9 +33,37 @@ struct udev_enumerate { struct udev *udev; int refcount; + struct list_node attr_match_list; + struct list_node attr_nomatch_list; + struct list_node subsystem_match_list; + struct list_node subsystem_nomatch_list; struct list_node devices_list; }; +/** + * udev_enumerate_new: + * @udev: udev library context + * + * Returns: an enumeration context + **/ +struct udev_enumerate *udev_enumerate_new(struct udev *udev) +{ + struct udev_enumerate *udev_enumerate; + + udev_enumerate = malloc(sizeof(struct udev_enumerate)); + if (udev_enumerate == NULL) + return NULL; + memset(udev_enumerate, 0x00, (sizeof(struct udev_enumerate))); + udev_enumerate->refcount = 1; + udev_enumerate->udev = udev; + list_init(&udev_enumerate->devices_list); + list_init(&udev_enumerate->attr_match_list); + list_init(&udev_enumerate->attr_nomatch_list); + list_init(&udev_enumerate->subsystem_match_list); + list_init(&udev_enumerate->subsystem_nomatch_list); + return udev_enumerate; +} + struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) @@ -51,6 +80,10 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) if (udev_enumerate->refcount > 0) return; list_cleanup(udev_enumerate->udev, &udev_enumerate->devices_list); + list_cleanup(udev_enumerate->udev, &udev_enumerate->attr_match_list); + list_cleanup(udev_enumerate->udev, &udev_enumerate->attr_nomatch_list); + list_cleanup(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); + list_cleanup(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); free(udev_enumerate); } @@ -68,22 +101,123 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude return list_get_entry(&udev_enumerate->devices_list); } -static int devices_scan_subsystem(struct udev *udev, - const char *basedir, const char *subsystem, const char *subdir, - struct list_node *devices_list) +int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { + if (udev_enumerate == NULL) + return -EINVAL; + if (subsystem == NULL) + return 0; + if (list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->subsystem_match_list, subsystem, NULL, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + +int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (subsystem == NULL) + return 0; + if (list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->subsystem_nomatch_list, subsystem, NULL, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + +int udev_enumerate_add_match_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (attr == NULL) + return 0; + if (list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->attr_match_list, attr, value, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + +int udev_enumerate_add_nomatch_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (attr == NULL) + return 0; + if (list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->attr_nomatch_list, attr, value, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + +static int match_attr_value(struct udev *udev, const char *syspath, const char *attr, const char *match_val) +{ + struct udev_device *device; + const char *val = NULL; + int match = 0; + + device = udev_device_new_from_syspath(udev, syspath); + if (device == NULL) + return -EINVAL; + val = udev_device_get_attr_value(device, attr); + if (val == NULL) + goto exit; + if (match_val == NULL) { + match = 1; + goto exit; + } + if (fnmatch(match_val, val, 0) == 0) { + match = 1; + goto exit; + } +exit: + udev_device_unref(device); + return match; +} + +static int match_attr(struct udev_enumerate *udev_enumerate, const char *syspath) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_list_entry *list_entry; + + /* skip list */ + udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->attr_nomatch_list)) { + if (match_attr_value(udev, syspath, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return 0; + } + /* include list */ + if (list_get_entry(&udev_enumerate->attr_match_list) != NULL) { + udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->attr_match_list)) { + /* anything that does not match, will make it FALSE */ + if (!match_attr_value(udev, syspath, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return 0; + } + return 1; + } + return 1; +} + +static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir1, const char *subdir2) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); char path[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, "/", sizeof(path)); util_strlcat(path, basedir, sizeof(path)); - if (subsystem != NULL) { + if (subdir1 != NULL) { util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, subsystem, sizeof(path)); + util_strlcat(path, subdir1, sizeof(path)); + } + if (subdir2 != NULL) { + util_strlcat(path, "/", sizeof(path)); + util_strlcat(path, subdir2, sizeof(path)); } - if (subdir != NULL) - util_strlcat(path, subdir, sizeof(path)); dir = opendir(path); if (dir == NULL) return -1; @@ -102,47 +236,54 @@ static int devices_scan_subsystem(struct udev *udev, if (stat(filename, &statbuf) != 0) continue; util_resolve_sys_link(udev, syspath, sizeof(syspath)); - list_entry_add(udev, devices_list, syspath, NULL, 1, 1); + if (!match_attr(udev_enumerate, syspath)) + continue; + list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); } closedir(dir); return 0; } -static int devices_scan_subsystems(struct udev *udev, - const char *basedir, const char *subdir, - struct udev_list_entry *subsystem_include_list, - struct udev_list_entry *subsystem_exclude_list, - struct list_node *devices_list) +static int match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { - if (subsystem_include_list != NULL) { - struct udev_list_entry *list_entry; - - /* if list of subsystems to scan is given, just use this list */ - udev_list_entry_foreach(list_entry, subsystem_include_list) { - if (udev_list_entry_get_by_name(subsystem_exclude_list, udev_list_entry_get_name(list_entry)) != NULL) - continue; - devices_scan_subsystem(udev, basedir, udev_list_entry_get_name(list_entry), subdir, devices_list); - } - } else { - char path[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - /* if no list of subsystems to scan is given, scan all, and possible exclude some subsystems */ - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, basedir, sizeof(path)); - dir = opendir(path); - if (dir == NULL) - return -1; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - if (dent->d_name[0] == '.') - continue; - if (udev_list_entry_get_by_name(subsystem_exclude_list, dent->d_name) != NULL) - continue; - devices_scan_subsystem(udev, basedir, dent->d_name, subdir, devices_list); + struct udev_list_entry *list_entry; + + udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) + return 0; + } + if (list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { + udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->subsystem_match_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) + return 1; } - closedir(dir); + return 0; } + return 1; +} + +static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir, const char *match) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + + char path[UTIL_PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, "/", sizeof(path)); + util_strlcat(path, basedir, sizeof(path)); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + if (!match_subsystem(udev_enumerate, match != NULL ? match : dent->d_name)) + continue; + scan_dir_and_add_devices(udev_enumerate, basedir, dent->d_name, subdir); + } + closedir(dir); return 0; } @@ -157,7 +298,6 @@ static int devices_delay(struct udev *udev, const char *syspath) int i; len = strlen(udev_get_sys_path(udev)); - for (i = 0; delay_device_list[i] != NULL; i++) { if (strstr(&syspath[len], delay_device_list[i]) != NULL) { info(udev, "delaying: %s\n", syspath); @@ -167,103 +307,66 @@ static int devices_delay(struct udev *udev, const char *syspath) return 0; } -/** - * udev_enumerate_new: - * @udev: udev library context - * - * Returns: an enumeration context - **/ -struct udev_enumerate *udev_enumerate_new(struct udev *udev) +int udev_enumerate_add_device(struct udev_enumerate *udev_enumerate, struct udev_device *udev_device) { - struct udev_enumerate *udev_enumerate; + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_list_entry *list_entry; - udev_enumerate = malloc(sizeof(struct udev_enumerate)); if (udev_enumerate == NULL) - return NULL; - memset(udev_enumerate, 0x00, (sizeof(struct udev_enumerate))); - udev_enumerate->refcount = 1; - udev_enumerate->udev = udev; - list_init(&udev_enumerate->devices_list); - return udev_enumerate; + return -EINVAL; + if (udev_device == NULL) + return 0; + list_entry_add(udev, + &udev_enumerate->devices_list, + udev_device_get_syspath(udev_device), NULL, 1, 1); + /* sort delayed devices to the end of the list */ + udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->devices_list)) { + if (devices_delay(udev, udev_list_entry_get_name(list_entry))) + list_entry_move_to_end(list_entry); + } + return 0; } /** * udev_enumerate_scan_devices: * @udev_enumerate: udev enumeration context - * @subsystem: the list of names of subsystems to look for devices * - * Returns: 0 on success. + * Returns: a negative value on error. **/ -int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate, const char *subsystem, ...) +int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - va_list vargs; - const char *arg; char base[UTIL_PATH_SIZE]; struct stat statbuf; - struct list_node subsystem_include_list; - struct list_node subsystem_exclude_list; struct udev_list_entry *list_entry; if (udev_enumerate == NULL) return -EINVAL; - - va_start(vargs, subsystem); - list_init(&subsystem_include_list); - list_init(&subsystem_exclude_list); - for (arg = subsystem; arg != NULL; arg = va_arg(vargs, const char *)) { - if (arg[0] != '!') - list_entry_add(udev, &subsystem_include_list, arg, NULL, 1, 0); - else - list_entry_add(udev, &subsystem_exclude_list, &arg[1], NULL, 1, 0); - } - va_end(vargs); - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { /* we have /subsystem/, forget all the old stuff */ info(udev, "searching '/subsystem/*/devices/*' dir\n"); - devices_scan_subsystems(udev, "/subsystem", "/devices", - list_get_entry(&subsystem_include_list), - list_get_entry(&subsystem_exclude_list), - &udev_enumerate->devices_list); + scan_dir(udev_enumerate, "subsystem", "devices", NULL); } else { info(udev, "searching '/bus/*/devices/*' dir\n"); - devices_scan_subsystems(udev, "/bus", "/devices", - list_get_entry(&subsystem_include_list), - list_get_entry(&subsystem_exclude_list), - &udev_enumerate->devices_list); + scan_dir(udev_enumerate, "bus", "devices", NULL); info(udev, "searching '/class/*' dir\n"); - devices_scan_subsystems(udev, "/class", NULL, - list_get_entry(&subsystem_include_list), - list_get_entry(&subsystem_exclude_list), - &udev_enumerate->devices_list); + scan_dir(udev_enumerate, "class", NULL, NULL); /* if block isn't a class, scan /block/ */ util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/class/block", sizeof(base)); if (stat(base, &statbuf) != 0) { - struct udev_list_entry *include_list = list_get_entry(&subsystem_include_list); - struct udev_list_entry *exclude_list = list_get_entry(&subsystem_exclude_list); - int include_block = (include_list == NULL || udev_list_entry_get_by_name(include_list, "block") != NULL); - int exclude_block = (udev_list_entry_get_by_name(exclude_list, "block") != NULL); - - if (include_block && !exclude_block) { + if (match_subsystem(udev_enumerate, "block")) { info(udev, "searching '/block/*' dir\n"); /* scan disks */ - devices_scan_subsystem(udev, "/block", NULL, NULL, &udev_enumerate->devices_list); + scan_dir_and_add_devices(udev_enumerate, "block", NULL, NULL); /* scan partitions */ info(udev, "searching '/block/*/*' dir\n"); - devices_scan_subsystems(udev, "/block", NULL, - NULL, NULL, - &udev_enumerate->devices_list); + scan_dir(udev_enumerate, "block", NULL, "block"); } } } - - list_cleanup(udev, &subsystem_include_list); - list_cleanup(udev, &subsystem_exclude_list); - /* sort delayed devices to the end of the list */ udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->devices_list)) { if (devices_delay(udev, udev_list_entry_get_name(list_entry))) @@ -276,7 +379,7 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate, const cha * udev_enumerate_scan_subsystems: * @udev_enumerate: udev enumeration context * - * Returns: 0 on success. + * Returns: a negative value on error. **/ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) { @@ -287,18 +390,17 @@ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) if (udev_enumerate == NULL) return -EINVAL; - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) - subsysdir = "/subsystem"; + subsysdir = "subsystem"; else - subsysdir = "/bus"; - info(udev, "searching '%s/*' dir\n", subsysdir); - devices_scan_subsystem(udev, subsysdir, NULL, NULL, &udev_enumerate->devices_list); + subsysdir = "bus"; + if (match_subsystem(udev_enumerate, "subsystem")) { + info(udev, "searching '%s/*' dir\n", subsysdir); + scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); + } info(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); - devices_scan_subsystems(udev, subsysdir, "/drivers", - NULL, NULL, - &udev_enumerate->devices_list); + scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); return 0; } diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 427fed7f61..49d24f1476 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -98,7 +98,12 @@ extern struct udev_enumerate *udev_enumerate_new(struct udev *udev); extern struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); extern struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); -extern int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate, const char *subsystem, ...); +extern int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); +extern int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); +extern int udev_enumerate_add_match_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value); +extern int udev_enumerate_add_nomatch_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value); +extern int udev_enumerate_add_device(struct udev_enumerate *udev_enumerate, struct udev_device *udev_device); +extern int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); extern int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); extern struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 0f45413d50..5e9897c715 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -309,7 +309,8 @@ int main(int argc, char *argv[], char *envp[]) udev_enumerate = udev_enumerate_new(udev); if (udev_enumerate == NULL) return -1; - udev_enumerate_scan_devices(udev_enumerate, subsystem, NULL); + udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); + udev_enumerate_scan_devices(udev_enumerate); test_enumerate_print_list(udev_enumerate); udev_enumerate_unref(udev_enumerate); @@ -317,7 +318,8 @@ int main(int argc, char *argv[], char *envp[]) udev_enumerate = udev_enumerate_new(udev); if (udev_enumerate == NULL) return -1; - udev_enumerate_scan_devices(udev_enumerate, "block", NULL); + udev_enumerate_add_match_subsystem(udev_enumerate,"block"); + udev_enumerate_scan_devices(udev_enumerate); test_enumerate_print_list(udev_enumerate); udev_enumerate_unref(udev_enumerate); @@ -325,7 +327,8 @@ int main(int argc, char *argv[], char *envp[]) udev_enumerate = udev_enumerate_new(udev); if (udev_enumerate == NULL) return -1; - udev_enumerate_scan_devices(udev_enumerate, "!block", NULL); + udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); + udev_enumerate_scan_devices(udev_enumerate); test_enumerate_print_list(udev_enumerate); udev_enumerate_unref(udev_enumerate); @@ -333,7 +336,10 @@ int main(int argc, char *argv[], char *envp[]) udev_enumerate = udev_enumerate_new(udev); if (udev_enumerate == NULL) return -1; - udev_enumerate_scan_devices(udev_enumerate, "pci", "mem", "vc", NULL); + udev_enumerate_add_match_subsystem(udev_enumerate, "pci"); + udev_enumerate_add_match_subsystem(udev_enumerate, "mem"); + udev_enumerate_add_match_subsystem(udev_enumerate, "vc"); + udev_enumerate_scan_devices(udev_enumerate); test_enumerate_print_list(udev_enumerate); udev_enumerate_unref(udev_enumerate); diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 624fb01eb4..c2ff0bbea3 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -190,7 +190,7 @@ static int export_devices(struct udev *udev) udev_enumerate = udev_enumerate_new(udev); if (udev_enumerate == NULL) return -1; - udev_enumerate_scan_devices(udev_enumerate, NULL); + udev_enumerate_scan_devices(udev_enumerate); udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { struct udev_device *device; -- cgit v1.2.3-54-g00ecf From f5001d2465be849306149c902a9db5b031d10428 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Sep 2008 13:43:35 +0200 Subject: udevadm: trigger: use libudev --- NEWS | 5 + TODO | 2 +- udev/udevadm-trigger.c | 689 ++++++++----------------------------------------- udev/udevadm.xml | 27 +- 4 files changed, 118 insertions(+), 605 deletions(-) diff --git a/NEWS b/NEWS index 1468ec3989..86e78334ef 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +udev 129 +======== +More libudev work. Most of udevadm's functionality comes from libudev +now. + udev 128 ======== Bugfixes. diff --git a/TODO b/TODO index 2cbb7cc1c7..2bbfdb6607 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,6 @@ - o use enumerate for "trigger" o add libudev queue - interface for /dev/.udev/queue/ state use queue interface for "settle" + use queue interface for --type=failed #129 o use libudev device in udev_rules.c diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index a0f10dac68..67180d879e 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -1,6 +1,5 @@ /* - * Copyright (C) 2004-2008 Kay Sievers - * Copyright (C) 2006 Hannes Reinecke + * Copyright (C) 2008 Kay Sievers * * 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 @@ -33,503 +32,39 @@ #include #include "udev.h" -#include "udev_rules.h" static int verbose; static int dry_run; -LIST_HEAD(device_list); -LIST_HEAD(filter_subsystem_match_list); -LIST_HEAD(filter_subsystem_nomatch_list); -LIST_HEAD(filter_attr_match_list); -LIST_HEAD(filter_attr_nomatch_list); -static int sock = -1; -static struct sockaddr_un saddr; -static socklen_t saddrlen; -/* devices that should run last cause of their dependencies */ -static int delay_device(const char *syspath) +static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) { - static const char *delay_device_list[] = { - "*/md*", - "*/dm-*", - NULL - }; - int i; - - for (i = 0; delay_device_list[i] != NULL; i++) - if (fnmatch(delay_device_list[i], syspath, 0) == 0) - return 1; - return 0; -} - -static int device_list_insert(struct udev *udev, const char *path) -{ - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; - - dbg(udev, "add '%s'\n" , path); - - /* we only have a device, if we have an uevent file */ - util_strlcpy(filename, path, sizeof(filename)); - util_strlcat(filename, "/uevent", sizeof(filename)); - if (stat(filename, &statbuf) < 0) - return -1; - if (!(statbuf.st_mode & S_IWUSR)) - return -1; - - /* resolve possible link to real target */ - util_strlcpy(filename, path, sizeof(filename)); - if (lstat(filename, &statbuf) < 0) - return -1; - if (S_ISLNK(statbuf.st_mode)) - if (util_resolve_sys_link(udev, filename, sizeof(filename)) != 0) - return -1; - - name_list_add(udev, &device_list, filename, 1); - return 0; -} - -static void trigger_uevent(struct udev *udev, const char *syspath, const char *action) -{ - char filename[UTIL_PATH_SIZE]; - int fd; - - util_strlcpy(filename, syspath, sizeof(filename)); - util_strlcat(filename, "/uevent", sizeof(filename)); - - if (verbose) - printf("%s\n", syspath); - - if (dry_run) - return; - - fd = open(filename, O_WRONLY); - if (fd < 0) { - dbg(udev, "error on opening %s: %m\n", filename); - return; - } - - if (write(fd, action, strlen(action)) < 0) - info(udev, "error writing '%s' to '%s': %m\n", action, filename); - - close(fd); -} - -static int pass_to_socket(struct udev *udev, const char *syspath, const char *action, const char *env) -{ - struct udevice *udevice; - struct name_entry *name_loop; - char buf[4096]; - size_t bufpos = 0; - ssize_t count; - char path[UTIL_PATH_SIZE]; - int fd; - char link_target[UTIL_PATH_SIZE]; - int len; - const char *devpath = &syspath[strlen(udev_get_sys_path(udev))]; - int err = 0; - - if (verbose) - printf("%s\n", devpath); - - udevice = udev_device_init(udev); - if (udevice == NULL) - return -1; - udev_db_get_device(udevice, devpath); - - /* add header */ - bufpos = snprintf(buf, sizeof(buf)-1, "%s@%s", action, devpath); - bufpos++; - - /* add cookie */ - if (env != NULL) { - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "%s", env); - bufpos++; - } - - /* add standard keys */ - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVPATH=%s", devpath); - bufpos++; - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "ACTION=%s", action); - bufpos++; - - /* add subsystem */ - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, devpath, sizeof(path)); - util_strlcat(path, "/subsystem", sizeof(path)); - len = readlink(path, link_target, sizeof(link_target)); - if (len > 0) { - char *pos; - - link_target[len] = '\0'; - pos = strrchr(link_target, '/'); - if (pos != NULL) { - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "SUBSYSTEM=%s", &pos[1]); - bufpos++; - } - } - - /* add symlinks and node name */ - path[0] = '\0'; - list_for_each_entry(name_loop, &udevice->symlink_list, node) { - util_strlcat(path, udev_get_dev_path(udev), sizeof(path)); - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, name_loop->name, sizeof(path)); - util_strlcat(path, " ", sizeof(path)); - } - util_remove_trailing_chars(path, ' '); - if (path[0] != '\0') { - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVLINKS=%s", path); - bufpos++; - } - if (udevice->name[0] != '\0') { - util_strlcpy(path, udev_get_dev_path(udev), sizeof(path)); - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, udevice->name, sizeof(path)); - bufpos += snprintf(&buf[bufpos], sizeof(buf)-1, "DEVNAME=%s", path); - bufpos++; - } - - /* add keys from device "uevent" file */ - util_strlcpy(path, syspath, sizeof(path)); - util_strlcat(path, "/uevent", sizeof(path)); - fd = open(path, O_RDONLY); - if (fd >= 0) { - char value[4096]; - - count = read(fd, value, sizeof(value)); - close(fd); - if (count > 0) { - char *key; - - value[count] = '\0'; - key = value; - while (key[0] != '\0') { - char *next; - - next = strchr(key, '\n'); - if (next == NULL) - break; - next[0] = '\0'; - bufpos += util_strlcpy(&buf[bufpos], key, sizeof(buf) - bufpos-1); - bufpos++; - key = &next[1]; - } - } - } - - /* add keys from database */ - list_for_each_entry(name_loop, &udevice->env_list, node) { - bufpos += util_strlcpy(&buf[bufpos], name_loop->name, sizeof(buf) - bufpos-1); - bufpos++; - } - if (bufpos > sizeof(buf)) - bufpos = sizeof(buf); - - count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); - if (count < 0) - err = -1; + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_list_entry *entry; - return err; -} - -static void exec_list(struct udev *udev, const char *action, const char *env) -{ - struct name_entry *loop_device; - struct name_entry *tmp_device; - - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (delay_device(loop_device->name)) - continue; - if (sock >= 0) - pass_to_socket(udev, loop_device->name, action, env); - else - trigger_uevent(udev, loop_device->name, action); - list_del(&loop_device->node); - free(loop_device); - } - - /* trigger remaining delayed devices */ - list_for_each_entry_safe(loop_device, tmp_device, &device_list, node) { - if (sock >= 0) - pass_to_socket(udev, loop_device->name, action, env); - else - trigger_uevent(udev, loop_device->name, action); - list_del(&loop_device->node); - free(loop_device); - } -} - -static int subsystem_filtered(const char *subsystem) -{ - struct name_entry *loop_name; - - /* skip devices matching the listed subsystems */ - list_for_each_entry(loop_name, &filter_subsystem_nomatch_list, node) - if (fnmatch(loop_name->name, subsystem, 0) == 0) - return 1; - - /* skip devices not matching the listed subsystems */ - if (!list_empty(&filter_subsystem_match_list)) { - list_for_each_entry(loop_name, &filter_subsystem_match_list, node) - if (fnmatch(loop_name->name, subsystem, 0) == 0) - return 0; - return 1; - } - - return 0; -} - -static int attr_match(const char *path, const char *attr_value) -{ - char attr[UTIL_NAME_SIZE]; - char file[UTIL_PATH_SIZE]; - char *match_value; - - util_strlcpy(attr, attr_value, sizeof(attr)); - - /* separate attr and match value */ - match_value = strchr(attr, '='); - if (match_value != NULL) { - match_value[0] = '\0'; - match_value = &match_value[1]; - } - - util_strlcpy(file, path, sizeof(file)); - util_strlcat(file, "/", sizeof(file)); - util_strlcat(file, attr, sizeof(file)); - - if (match_value != NULL) { - /* match file content */ - char value[UTIL_NAME_SIZE]; + udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(udev_enumerate)) { + char filename[UTIL_PATH_SIZE]; int fd; - ssize_t size; - fd = open(file, O_RDONLY); - if (fd < 0) - return 0; - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - return 0; - value[size] = '\0'; - util_remove_trailing_chars(value, '\n'); - - /* match if attribute value matches */ - if (fnmatch(match_value, value, 0) == 0) - return 1; - } else { - /* match if attribute exists */ - struct stat statbuf; - - if (stat(file, &statbuf) == 0) - return 1; - } - return 0; -} - -static int attr_filtered(const char *path) -{ - struct name_entry *loop_name; - - /* skip devices matching the listed sysfs attributes */ - list_for_each_entry(loop_name, &filter_attr_nomatch_list, node) - if (attr_match(path, loop_name->name)) - return 1; - - /* skip devices not matching the listed sysfs attributes */ - if (!list_empty(&filter_attr_match_list)) { - list_for_each_entry(loop_name, &filter_attr_match_list, node) - if (attr_match(path, loop_name->name)) - return 0; - return 1; - } - return 0; -} - -enum scan_type { - SCAN_DEVICES, - SCAN_SUBSYSTEM, -}; - -static void scan_subsystem(struct udev *udev, const char *subsys, enum scan_type scan) -{ - char base[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - const char *subdir; - - if (scan == SCAN_DEVICES) - subdir = "/devices"; - else if (scan == SCAN_SUBSYSTEM) - subdir = "/drivers"; - else - return; - - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - util_strlcat(base, "/", sizeof(base)); - util_strlcat(base, subsys, sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[UTIL_PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - if (scan == SCAN_DEVICES) - if (subsystem_filtered(dent->d_name)) - continue; - - util_strlcpy(dirname, base, sizeof(dirname)); - util_strlcat(dirname, "/", sizeof(dirname)); - util_strlcat(dirname, dent->d_name, sizeof(dirname)); - - if (scan == SCAN_SUBSYSTEM) { - if (attr_filtered(dirname)) - continue; - if (!subsystem_filtered("subsystem")) - device_list_insert(udev, dirname); - if (subsystem_filtered("drivers")) - continue; - } - - util_strlcat(dirname, subdir, sizeof(dirname)); - - /* look for devices/drivers */ - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[UTIL_PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - util_strlcpy(dirname2, dirname, sizeof(dirname2)); - util_strlcat(dirname2, "/", sizeof(dirname2)); - util_strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - if (attr_filtered(dirname2)) - continue; - device_list_insert(udev, dirname2); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void scan_block(struct udev *udev) -{ - char base[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - if (subsystem_filtered("block")) - return; - - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - util_strlcat(base, "/block", sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[UTIL_PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - util_strlcpy(dirname, base, sizeof(dirname)); - util_strlcat(dirname, "/", sizeof(dirname)); - util_strlcat(dirname, dent->d_name, sizeof(dirname)); - if (attr_filtered(dirname)) - continue; - if (device_list_insert(udev, dirname) != 0) - continue; - - /* look for partitions */ - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[UTIL_PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - if (!strcmp(dent2->d_name,"device")) - continue; - - util_strlcpy(dirname2, dirname, sizeof(dirname2)); - util_strlcat(dirname2, "/", sizeof(dirname2)); - util_strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - if (attr_filtered(dirname2)) - continue; - device_list_insert(udev, dirname2); - } - closedir(dir2); - } - } - closedir(dir); - } -} - -static void scan_class(struct udev *udev) -{ - char base[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - util_strlcat(base, "/class", sizeof(base)); - - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char dirname[UTIL_PATH_SIZE]; - DIR *dir2; - struct dirent *dent2; - - if (dent->d_name[0] == '.') - continue; - - if (subsystem_filtered(dent->d_name)) - continue; - - util_strlcpy(dirname, base, sizeof(dirname)); - util_strlcat(dirname, "/", sizeof(dirname)); - util_strlcat(dirname, dent->d_name, sizeof(dirname)); - dir2 = opendir(dirname); - if (dir2 != NULL) { - for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) { - char dirname2[UTIL_PATH_SIZE]; - - if (dent2->d_name[0] == '.') - continue; - - if (!strcmp(dent2->d_name, "device")) - continue; - - util_strlcpy(dirname2, dirname, sizeof(dirname2)); - util_strlcat(dirname2, "/", sizeof(dirname2)); - util_strlcat(dirname2, dent2->d_name, sizeof(dirname2)); - if (attr_filtered(dirname2)) - continue; - device_list_insert(udev, dirname2); - } - closedir(dir2); - } + if (verbose) + printf("%s\n", udev_list_entry_get_name(entry)); + if (dry_run) + continue; + util_strlcpy(filename, udev_list_entry_get_name(entry), sizeof(filename)); + util_strlcat(filename, "/uevent", sizeof(filename)); + fd = open(filename, O_WRONLY); + if (fd < 0) { + dbg(udev, "error on opening %s: %m\n", filename); + continue; } - closedir(dir); + if (write(fd, action, strlen(action)) < 0) + info(udev, "error writing '%s' to '%s': %m\n", action, filename); + close(fd); } } -static void scan_failed(struct udev *udev) +static int enumerate_scan_failed(struct udev_enumerate *udev_enumerate) { + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); char base[UTIL_PATH_SIZE]; DIR *dir; struct dirent *dent; @@ -540,49 +75,63 @@ static void scan_failed(struct udev *udev) dir = opendir(base); if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char device[UTIL_PATH_SIZE]; + char syspath[UTIL_PATH_SIZE]; size_t start; + struct udev_device *device; if (dent->d_name[0] == '.') continue; - - start = util_strlcpy(device, udev_get_sys_path(udev), sizeof(device)); - if(start >= sizeof(device)) - start = sizeof(device) - 1; - util_strlcat(device, dent->d_name, sizeof(device)); - util_path_decode(&device[start]); - device_list_insert(udev, device); + start = util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); + util_strlcat(syspath, dent->d_name, sizeof(syspath)); + util_path_decode(&syspath[start]); + device = udev_device_new_from_syspath(udev, syspath); + if (device == NULL) + continue; + udev_enumerate_add_device(udev_enumerate, device); + udev_device_unref(device); } closedir(dir); } + return 0; } int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { - int failed = 0; - const char *sockpath = NULL; - int option; - const char *action = "add"; - const char *env = NULL; static const struct option options[] = { { "verbose", 0, NULL, 'v' }, { "dry-run", 0, NULL, 'n' }, + { "type", 0, NULL, 't' }, { "retry-failed", 0, NULL, 'F' }, - { "socket", 1, NULL, 'o' }, - { "help", 0, NULL, 'h' }, { "action", 1, NULL, 'c' }, { "subsystem-match", 1, NULL, 's' }, { "subsystem-nomatch", 1, NULL, 'S' }, { "attr-match", 1, NULL, 'a' }, { "attr-nomatch", 1, NULL, 'A' }, - { "env", 1, NULL, 'e' }, + { "help", 0, NULL, 'h' }, {} }; + enum { + TYPE_DEVICES, + TYPE_SUBSYSTEMS, + TYPE_FAILED, + } device_type = TYPE_DEVICES; + const char *action = "add"; + struct udev_enumerate *udev_enumerate; + int rc = 0; dbg(udev, "version %s\n", VERSION); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) { + rc = 1; + goto exit; + } while (1) { - option = getopt_long(argc, argv, "vnFo:hce::s:S:a:A:", options, NULL); + int option; + char attr[UTIL_PATH_SIZE]; + char *val; + + option = getopt_long(argc, argv, "vnFo:t:hce::s:S:a:A:", options, NULL); if (option == -1) break; @@ -593,45 +142,63 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) case 'n': dry_run = 1; break; - case 'F': - failed = 1; + case 't': + if (strcmp(optarg, "devices") == 0) { + device_type = TYPE_DEVICES; + } else if (strcmp(optarg, "subsystems") == 0) { + device_type = TYPE_SUBSYSTEMS; + } else if (strcmp(optarg, "failed") == 0) { + device_type = TYPE_FAILED; + } else { + fprintf(stderr, "unknown type --type=%s\n", optarg); + err(udev, "unknown type --type=%s\n", optarg); + rc = 2; + goto exit; + } break; - case 'o': - sockpath = optarg; + case 'F': + device_type = TYPE_FAILED; break; case 'c': action = optarg; break; - case 'e': - if (strchr(optarg, '=') != NULL) - env = optarg; - break; case 's': - name_list_add(udev, &filter_subsystem_match_list, optarg, 0); + udev_enumerate_add_match_subsystem(udev_enumerate, optarg); break; case 'S': - name_list_add(udev, &filter_subsystem_nomatch_list, optarg, 0); + udev_enumerate_add_nomatch_subsystem(udev_enumerate, optarg); break; case 'a': - name_list_add(udev, &filter_attr_match_list, optarg, 0); + util_strlcpy(attr, optarg, sizeof(attr)); + val = strchr(attr, '='); + if (val != NULL) { + val[0] = 0; + val = &val[1]; + } + udev_enumerate_add_match_attr(udev_enumerate, attr, val); break; case 'A': - name_list_add(udev, &filter_attr_nomatch_list, optarg, 0); + util_strlcpy(attr, optarg, sizeof(attr)); + val = strchr(attr, '='); + if (val != NULL) { + val[0] = 0; + val = &val[1]; + } + udev_enumerate_add_nomatch_attr(udev_enumerate, attr, val); break; case 'h': printf("Usage: udevadm trigger OPTIONS\n" " --verbose print the list of devices while running\n" " --dry-run do not actually trigger the events\n" - " --retry-failed trigger only the events which have been\n" - " marked as failed during a previous run\n" - " --socket= pass events to socket instead of triggering kernel events\n" - " --env== pass an additional key (works only with --socket=)\n" + " --type= type of events to trigger\n" + " devices sys devices\n" + " subsystems sys subsystems and drivers\n" + " failed trigger only the events which have been\n" + " marked as failed during a previous run\n" " --subsystem-match= trigger devices from a matching subystem\n" " --subsystem-nomatch= exclude devices from a matching subystem\n" - " --attr-match=]> trigger devices with a matching sysfs\n" - " attribute\n" - " --attr-nomatch=]> exclude devices with a matching sysfs\n" - " attribute\n" + " --attr-match=]> trigger devices with a matching attribute\n" + " --attr-nomatch=]> exclude devices with a matching attribute\n" " --help print this text\n" "\n"); goto exit; @@ -640,67 +207,23 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) } } - if (sockpath != NULL) { - struct stat stats; - - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - if (sockpath[0] == '@') { - /* abstract namespace socket requested */ - util_strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { - /* existing socket file */ - util_strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); - saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); - } else { - /* no socket file, assume abstract namespace socket */ - util_strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } - } else if (env != NULL) { - fprintf(stderr, "error: --env= only valid with --socket= option\n"); + switch (device_type) { + case TYPE_FAILED: + enumerate_scan_failed(udev_enumerate); + exec_list(udev_enumerate, action); + goto exit; + case TYPE_SUBSYSTEMS: + udev_enumerate_scan_subsystems(udev_enumerate); + exec_list(udev_enumerate, action); + goto exit; + case TYPE_DEVICES: + udev_enumerate_scan_devices(udev_enumerate); + exec_list(udev_enumerate, action); + goto exit; + default: goto exit; } - - if (failed) { - scan_failed(udev); - exec_list(udev, action, env); - } else { - char base[UTIL_PATH_SIZE]; - struct stat statbuf; - - /* if we have /sys/subsystem, forget all the old stuff */ - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - util_strlcat(base, "/subsystem", sizeof(base)); - if (stat(base, &statbuf) == 0) { - scan_subsystem(udev, "subsystem", SCAN_SUBSYSTEM); - exec_list(udev, action, env); - scan_subsystem(udev, "subsystem", SCAN_DEVICES); - exec_list(udev, action, env); - } else { - scan_subsystem(udev, "bus", SCAN_SUBSYSTEM); - exec_list(udev, action, env); - scan_subsystem(udev, "bus", SCAN_DEVICES); - scan_class(udev); - - /* scan "block" if it isn't a "class" */ - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - util_strlcat(base, "/class/block", sizeof(base)); - if (stat(base, &statbuf) != 0) - scan_block(udev); - exec_list(udev, action, env); - } - } - exit: - name_list_cleanup(udev, &filter_subsystem_match_list); - name_list_cleanup(udev, &filter_subsystem_nomatch_list); - name_list_cleanup(udev, &filter_attr_match_list); - name_list_cleanup(udev, &filter_attr_nomatch_list); - - if (sock >= 0) - close(sock); - return 0; + udev_enumerate_unref(udev_enumerate); + return rc; } diff --git a/udev/udevadm.xml b/udev/udevadm.xml index b86b33ac44..b7687d5dd1 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -150,7 +150,7 @@ udevadm trigger <optional>options</optional> - Request device uevents, usually used to replay events at system coldplug. + Request device events from the kernel. Usually used to replay events at system coldplug time. @@ -165,15 +165,17 @@ - + - Trigger only the events which are failed during a previous run. + Trigger a specific type of devices. Valid types are: + devices, subsystems, failed. + The default value is devices. - Type of event to be triggered. The default value is "add". + Type of event to be triggered. The default value is add. @@ -208,23 +210,6 @@ of the sysfs attribute is checked. This option can be specified multiple times. - - - - Pass the synthesized events to the specified socket, instead of triggering - a global kernel event. All available event values will be send in the same format - the kernel sends an uevent, or - sends a message. If the first character of the specified path is an @ character, - an abstract namespace socket is used, instead of an existing socket file. - - - - - - Pass an additional environemt key to the event. This works only with the - --socket option. - - -- cgit v1.2.3-54-g00ecf From d98bffa802b214452d34109967423f1d60df89af Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Sep 2008 14:47:49 +0200 Subject: fix segfault caused by wrong pointer used in dbg() --- TODO | 1 + udev/udev_rules_parse.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 2bbfdb6607..8c74f6521f 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ + o test --type=failed o add libudev queue - interface for /dev/.udev/queue/ state use queue interface for "settle" use queue interface for --type=failed diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index b7ae06a20d..5a9552ffde 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -31,7 +31,7 @@ void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules) { - dbg(iter->rules->udev, "bufsize=%zi\n", rules->bufsize); + dbg(rules->udev, "bufsize=%zi\n", rules->bufsize); iter->rules = rules; iter->current = 0; } -- cgit v1.2.3-54-g00ecf From e0083e8e69856f1b4e1e643cebb08906775cca8a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Sep 2008 16:16:29 +0200 Subject: libudev: device_init() -> device_new() --- udev/lib/libudev-device.c | 4 ++-- udev/lib/libudev-monitor.c | 2 +- udev/lib/libudev-private.h | 31 ++++++++++++------------------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index f5465e9892..893ec080a6 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -193,7 +193,7 @@ void device_set_info_loaded(struct udev_device *device) device->info_loaded = 1; } -struct udev_device *device_init(struct udev *udev) +struct udev_device *device_new(struct udev *udev) { struct udev_device *udev_device; @@ -281,7 +281,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * } } - udev_device = device_init(udev); + udev_device = device_new(udev); if (udev_device == NULL) return NULL; diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index e72b206623..751f19ae92 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -284,7 +284,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito return NULL; } - udev_device = device_init(udev_monitor->udev); + udev_device = device_new(udev_monitor->udev); if (udev_device == NULL) { return NULL; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 8f847158b2..fd7f4551e7 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -24,27 +24,20 @@ #include "libudev.h" static inline void __attribute__ ((format(printf, 2, 3))) -log_null(struct udev *udev, const char *format, ...) -{ -} +log_null(struct udev *udev, const char *format, ...) {} #ifdef USE_LOG -#ifdef USE_DEBUG -#define dbg(udev, arg...) \ - udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) +# ifdef USE_DEBUG +# define dbg(udev, arg...) udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) +# else +# define dbg log_null +# endif +# define info(udev, arg...) udev_log(udev, LOG_INFO, __FILE__, __LINE__, __FUNCTION__, ## arg) +# define err(udev, arg...) udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) #else -#define dbg log_null -#endif /* USE_DEBUG */ - -#define info(udev, arg...) \ - udev_log(udev, LOG_INFO, __FILE__, __LINE__, __FUNCTION__, ## arg) - -#define err(udev, arg...) \ - udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) -#else -#define dbg log_null -#define info log_null -#define err log_null +# define dbg log_null +# define info log_null +# define err log_null #endif /* libudev */ @@ -52,7 +45,7 @@ void udev_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, ...) __attribute__ ((format(printf, 6, 7))); -extern struct udev_device *device_init(struct udev *udev); +extern struct udev_device *device_new(struct udev *udev); extern const char *udev_get_rules_path(struct udev *udev); extern int udev_get_run(struct udev *udev); -- cgit v1.2.3-54-g00ecf From d41b956e7f31b2ad708c1cce86eae9e9ba365a6c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Sep 2008 16:25:46 +0200 Subject: udevadm: trigger fix long option --type= --- NEWS | 4 ++++ udev/udevadm-trigger.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 86e78334ef..260fb6585f 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,10 @@ udev 129 More libudev work. Most of udevadm's functionality comes from libudev now. +udevadm trigger has a new option --type, which allows to trigger events +for "devices", for "subsystems" and "failed" devices. The old option +--retry-failed" still works, but is no longer mentioned in the man page. + udev 128 ======== Bugfixes. diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 67180d879e..3cf8c7a3d6 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -100,7 +100,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) static const struct option options[] = { { "verbose", 0, NULL, 'v' }, { "dry-run", 0, NULL, 'n' }, - { "type", 0, NULL, 't' }, + { "type", 1, NULL, 't' }, { "retry-failed", 0, NULL, 'F' }, { "action", 1, NULL, 'c' }, { "subsystem-match", 1, NULL, 's' }, -- cgit v1.2.3-54-g00ecf From 64ccdf8269e1e0fbde7acbe4837c2c2f2c41659c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Oct 2008 09:34:07 +0200 Subject: libudev: add queue interface --- udev/lib/Makefile.am | 3 +- udev/lib/exported_symbols | 10 ++ udev/lib/libudev-private.h | 6 + udev/lib/libudev-queue.c | 286 +++++++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev.h | 14 ++- udev/lib/test-libudev.c | 51 +++++++- 6 files changed, 365 insertions(+), 5 deletions(-) create mode 100644 udev/lib/libudev-queue.c diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index e800cf7f41..08e7ff865b 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -24,7 +24,8 @@ libudev_la_SOURCES =\ libudev-device.c \ libudev-enumerate.c \ libudev-ctrl.c \ - libudev-monitor.c + libudev-monitor.c \ + libudev-queue.c libudev_la_LDFLAGS = \ -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index edd3c76f3d..81abb58d64 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -51,3 +51,13 @@ udev_monitor_unref udev_monitor_get_udev udev_monitor_get_fd udev_monitor_receive_device +udev_queue_new +udev_queue_ref +udev_queue_unref +udev_queue_get_udev +udev_queue_get_kernel_seqnum +udev_queue_get_udev_seqnum +udev_queue_get_queue_is_empty +udev_queue_get_seqnum_is_finished +udev_queue_get_queued_list_entry +udev_queue_get_failed_list_entry diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index fd7f4551e7..7747b344fe 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -120,6 +120,12 @@ extern void list_entry_move_to_end(struct udev_list_entry *list_entry); entry != NULL; \ entry = tmp, tmp = udev_list_entry_get_next(tmp)) +/* libudev-queue */ +extern int queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum); +extern int queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device); +extern int queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device); +extern int queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device); + /* libudev-utils */ #define UTIL_PATH_SIZE 1024 #define UTIL_LINE_SIZE 2048 diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c new file mode 100644 index 0000000000..3ca533b1e0 --- /dev/null +++ b/udev/lib/libudev-queue.c @@ -0,0 +1,286 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +struct udev_queue { + struct udev *udev; + int refcount; + unsigned long long int last_seen_udev_seqnum; + struct list_node queue_list; + struct list_node failed_list; +}; + +struct udev_queue *udev_queue_new(struct udev *udev) +{ + struct udev_queue *udev_queue; + + if (udev == NULL) + return NULL; + + udev_queue = malloc(sizeof(struct udev_queue)); + if (udev_queue == NULL) + return NULL; + memset(udev_queue, 0x00, sizeof(struct udev_queue)); + udev_queue->refcount = 1; + udev_queue->udev = udev; + list_init(&udev_queue->queue_list); + list_init(&udev_queue->failed_list); + return udev_queue; +} + +struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) +{ + if (udev_queue == NULL) + return NULL; + udev_queue->refcount++; + return udev_queue; +} + +void udev_queue_unref(struct udev_queue *udev_queue) +{ + if (udev_queue == NULL) + return; + udev_queue->refcount--; + if (udev_queue->refcount > 0) + return; + list_cleanup(udev_queue->udev, &udev_queue->queue_list); + list_cleanup(udev_queue->udev, &udev_queue->failed_list); + free(udev_queue); +} + +struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) +{ + if (udev_queue == NULL) + return NULL; + return udev_queue->udev; +} + +unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) +{ + char filename[UTIL_PATH_SIZE]; + unsigned long long int seqnum; + int fd; + char buf[32]; + ssize_t len; + + if (udev_queue == NULL) + return -EINVAL; + util_strlcpy(filename, udev_get_sys_path(udev_queue->udev), sizeof(filename)); + util_strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd < 0) + return 0; + len = read(fd, buf, sizeof(buf)); + close(fd); + if (len <= 2) + return 0; + buf[len-1] = '\0'; + seqnum = strtoull(buf, NULL, 10); + info(udev_queue->udev, "seqnum=%llu\n", seqnum); + return seqnum; +} + +unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) +{ + char filename[UTIL_PATH_SIZE]; + unsigned long long int seqnum; + int fd; + char buf[32]; + ssize_t len; + + if (udev_queue == NULL) + return -EINVAL; + util_strlcpy(filename, udev_get_dev_path(udev_queue->udev), sizeof(filename)); + util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + fd = open(filename, O_RDONLY); + if (fd < 0) + return 0; + len = read(fd, buf, sizeof(buf)); + close(fd); + if (len <= 2) + return 0; + buf[len-1] = '\0'; + seqnum = strtoull(buf, NULL, 10); + info(udev_queue->udev, "seqnum=%llu\n", seqnum); + udev_queue->last_seen_udev_seqnum = seqnum; + return seqnum; +} + +int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) +{ + char queuename[UTIL_PATH_SIZE]; + struct stat statbuf; + unsigned long long int seqnum_kernel; + + if (udev_queue == NULL) + return -EINVAL; + util_strlcpy(queuename, udev_get_dev_path(udev_queue->udev), sizeof(queuename)); + util_strlcat(queuename, "/.udev/queue", sizeof(queuename)); + if (stat(queuename, &statbuf) == 0) { + info(udev_queue->udev, "queue is not empty\n"); + return 0; + } + seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); + if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) { + info(udev_queue->udev, "queue is empty\n"); + return 1; + } + udev_queue_get_udev_seqnum(udev_queue); + if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) { + info(udev_queue->udev, "queue is empty\n"); + return 1; + } + info(udev_queue->udev, "queue is empty, but kernel events still pending [%llu]<->[%llu]\n", + seqnum_kernel, udev_queue->last_seen_udev_seqnum); + return 0; +} + +int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) +{ + char filename[UTIL_PATH_SIZE]; + struct stat statbuf; + + if (udev_queue == NULL) + return -EINVAL; + /* if we have not seen this seqnum, check if it is/was already queued */ + if (seqnum < udev_queue->last_seen_udev_seqnum) { + udev_queue_get_udev_seqnum(udev_queue); + if (seqnum < udev_queue->last_seen_udev_seqnum) + return 0; + } + snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", + udev_get_dev_path(udev_queue->udev), seqnum); + if (stat(filename, &statbuf) == 0) + return 0; + info(udev_queue->udev, "seqnum: %llu finished\n", seqnum); + return 1; +} + +struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) +{ + char path[UTIL_PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + if (udev_queue == NULL) + return NULL; + list_cleanup(udev_queue->udev, &udev_queue->queue_list); + util_strlcpy(path, udev_get_dev_path(udev_queue->udev), sizeof(path)); + util_strlcat(path, "/.udev/queue", sizeof(path)); + dir = opendir(path); + if (dir == NULL) + return NULL; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char filename[UTIL_PATH_SIZE]; + char syspath[UTIL_PATH_SIZE]; + size_t syslen; + ssize_t len; + + if (dent->d_name[0] == '.') + continue; + util_strlcpy(filename, path, sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, dent->d_name, sizeof(filename)); + + syslen = util_strlcpy(syspath, udev_get_sys_path(udev_queue->udev), sizeof(syspath)); + len = readlink(filename, &syspath[syslen], sizeof(syspath)-syslen); + if (len < 0 || len >= (ssize_t)(sizeof(syspath)-syslen)) + continue; + syspath[syslen + len] = '\0'; + info(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); + list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, dent->d_name, 0, 0); + } + closedir(dir); + return list_get_entry(&udev_queue->queue_list); +} + +struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) +{ + char path[UTIL_PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + if (udev_queue == NULL) + return NULL; + list_cleanup(udev_queue->udev, &udev_queue->failed_list); + util_strlcpy(path, udev_get_dev_path(udev_queue->udev), sizeof(path)); + util_strlcat(path, "/.udev/failed", sizeof(path)); + dir = opendir(path); + if (dir == NULL) + return NULL; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char filename[UTIL_PATH_SIZE]; + char syspath[UTIL_PATH_SIZE]; + struct stat statbuf; + size_t syslen; + ssize_t len; + + if (dent->d_name[0] == '.') + continue; + util_strlcpy(filename, path, sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, dent->d_name, sizeof(filename)); + + syslen = util_strlcpy(syspath, udev_get_sys_path(udev_queue->udev), sizeof(syspath)); + len = readlink(filename, &syspath[syslen], sizeof(syspath)-syslen); + if (len < 0 || len >= (ssize_t)(sizeof(syspath)-syslen)) + continue; + syspath[syslen + len] = '\0'; + info(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); + util_strlcpy(filename, syspath, sizeof(filename)); + util_strlcat(filename, "/uevent", sizeof(filename)); + if (stat(filename, &statbuf) != 0) + continue; + list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0, 0); + } + closedir(dir); + return list_get_entry(&udev_queue->failed_list); +} + +int queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum) +{ + return 0; +} + +extern int queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device) +{ + return 0; +} + +extern int queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device) +{ + return 0; +} + +extern int queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device) +{ + return 0; +} diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 49d24f1476..cc6939c02f 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -96,8 +96,8 @@ extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev struct udev_enumerate; extern struct udev_enumerate *udev_enumerate_new(struct udev *udev); extern struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); -extern struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); +extern struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); extern int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); extern int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); extern int udev_enumerate_add_match_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value); @@ -107,4 +107,16 @@ extern int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); extern int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); extern struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); +/* event queue */ +struct udev_queue; +extern struct udev_queue *udev_queue_new(struct udev *udev); +extern struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue); +extern void udev_queue_unref(struct udev_queue *udev_queue); +extern struct udev *udev_queue_get_udev(struct udev_queue *udev_queue); +extern unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue); +extern unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue); +extern int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); +extern int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum); +extern struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); +extern struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); #endif diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 5e9897c715..9c7acb048a 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -168,10 +169,9 @@ static int test_enumerate_print_list(struct udev_enumerate *enumerate) device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), udev_list_entry_get_name(list_entry)); if (device != NULL) { - printf("device: '%s' (%s) '%s'\n", + printf("device: '%s' (%s)\n", udev_device_get_syspath(device), - udev_device_get_subsystem(device), - udev_device_get_sysname(device)); + udev_device_get_subsystem(device)); udev_device_unref(device); count++; } @@ -230,6 +230,49 @@ static int test_monitor(struct udev *udev, const char *socket_path) return 0; } +static int test_queue(struct udev *udev) +{ + struct udev_queue *udev_queue; + unsigned long long int seqnum; + struct udev_list_entry *list_entry; + + udev_queue = udev_queue_new(udev); + if (udev_queue == NULL) + return -1; + seqnum = udev_queue_get_kernel_seqnum(udev_queue); + printf("seqnum kernel: %llu\n", seqnum); + seqnum = udev_queue_get_udev_seqnum(udev_queue); + printf("seqnum udev : %llu\n", seqnum); + + if (udev_queue_get_queue_is_empty(udev_queue)) + printf("queue is empty\n"); + printf("get queue list\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + printf("\n"); + printf("get queue list again\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + printf("\n"); + printf("get failed list\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) + printf("failed: '%s'\n", udev_list_entry_get_name(list_entry)); + printf("\n"); + + list_entry = udev_queue_get_queued_list_entry(udev_queue); + if (list_entry != NULL) { + printf("event [%llu] is queued\n", seqnum); + seqnum = strtoull(udev_list_entry_get_value(list_entry), NULL, 10); + if (udev_queue_get_seqnum_is_finished(udev_queue, seqnum)) + printf("event [%llu] is not finished\n", seqnum); + else + printf("event [%llu] is finished\n", seqnum); + } + printf("\n"); + udev_queue_unref(udev_queue); + return 0; +} + int main(int argc, char *argv[], char *envp[]) { struct udev *udev = NULL; @@ -351,6 +394,8 @@ int main(int argc, char *argv[], char *envp[]) test_enumerate_print_list(udev_enumerate); udev_enumerate_unref(udev_enumerate); + test_queue(udev); + test_monitor(udev, socket); out: udev_unref(udev); -- cgit v1.2.3-54-g00ecf From 8249e04e3e9b6054768c3cd0ef72544831672b47 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Oct 2008 09:42:03 +0200 Subject: udevadm: settle - use libudev queue --- NEWS | 2 +- TODO | 7 ++- udev/Makefile.am | 1 + udev/udevadm-settle.c | 123 ++++++++++---------------------------------------- 4 files changed, 29 insertions(+), 104 deletions(-) diff --git a/NEWS b/NEWS index 260fb6585f..e43dde8a7d 100644 --- a/NEWS +++ b/NEWS @@ -4,7 +4,7 @@ More libudev work. Most of udevadm's functionality comes from libudev now. udevadm trigger has a new option --type, which allows to trigger events -for "devices", for "subsystems" and "failed" devices. The old option +for "devices", for "subsystems", or "failed" devices. The old option --retry-failed" still works, but is no longer mentioned in the man page. udev 128 diff --git a/TODO b/TODO index 8c74f6521f..dbdadc716d 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,5 @@ - o test --type=failed - o add libudev queue - interface for /dev/.udev/queue/ state - use queue interface for "settle" - use queue interface for --type=failed + o use queue interface for --type=failed + o check "enumerate" on SYSFS_DEPRECATED #129 o use libudev device in udev_rules.c @@ -15,4 +13,5 @@ the default rules o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names + o remove "udevinfo -V" o get distros to agree on a default set of rules diff --git a/udev/Makefile.am b/udev/Makefile.am index 6f9acce5a9..b28546b51c 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -34,6 +34,7 @@ common_files = \ lib/libudev-device.c \ lib/libudev-monitor.c \ lib/libudev-enumerate.c \ + lib/libudev-queue.c \ lib/libudev-ctrl.c if USE_SELINUX diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 78ac47ff41..d066ef90ce 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -33,61 +33,24 @@ #define DEFAULT_TIMEOUT 180 #define LOOP_PER_SECOND 20 -static void print_queue(struct udev *udev, const char *dir) -{ - LIST_HEAD(files); - struct name_entry *item; - - if (add_matching_files(udev, &files, dir, NULL) < 0) - return; - - printf("\n\nAfter the udevadm settle timeout, the events queue contains:\n\n"); - - list_for_each_entry(item, &files, node) { - char target[UTIL_NAME_SIZE]; - size_t len; - const char *filename = strrchr(item->name, '/'); - - if (filename == NULL) - continue; - filename++; - if (*filename == '\0') - continue; - - len = readlink(item->name, target, sizeof(target)); - if (len < 0) - continue; - target[len] = '\0'; - - printf("%s: %s\n", filename, target); - } - - printf("\n\n"); -} - int udevadm_settle(struct udev *udev, int argc, char *argv[]) { - char queuename[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - unsigned long long seq_kernel; - unsigned long long seq_udev; - char seqnum[32]; - int fd; - ssize_t len; - int timeout = DEFAULT_TIMEOUT; - int loop; static const struct option options[] = { { "timeout", 1, NULL, 't' }, { "help", 0, NULL, 'h' }, {} }; - int option; - int rc = 1; - int seconds; + int timeout = DEFAULT_TIMEOUT; + struct udev_queue *udev_queue; + int loop; + int rc = 0; dbg(udev, "version %s\n", VERSION); while (1) { + int option; + int seconds; + option = getopt_long(argc, argv, "t:h", options, NULL); if (option == -1) break; @@ -107,65 +70,27 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } } - util_strlcpy(queuename, udev_get_dev_path(udev), sizeof(queuename)); - util_strlcat(queuename, "/.udev/queue", sizeof(queuename)); - + udev_queue = udev_queue_new(udev); + if (udev_queue == NULL) + goto exit; loop = timeout * LOOP_PER_SECOND; while (loop--) { - /* wait for events in queue to finish */ - while (loop--) { - struct stat statbuf; - - if (stat(queuename, &statbuf) < 0) { - info(udev, "queue is empty\n"); - break; - } - usleep(1000 * 1000 / LOOP_PER_SECOND); - } - if (loop <= 0) { - info(udev, "timeout waiting for queue\n"); - print_queue(udev, queuename); - goto exit; - } - - /* read current udev seqnum */ - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); - fd = open(filename, O_RDONLY); - if (fd < 0) - goto exit; - len = read(fd, seqnum, sizeof(seqnum)-1); - close(fd); - if (len <= 0) - goto exit; - seqnum[len] = '\0'; - seq_udev = strtoull(seqnum, NULL, 10); - info(udev, "udev seqnum = %llu\n", seq_udev); - - /* read current kernel seqnum */ - util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); - util_strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); - fd = open(filename, O_RDONLY); - if (fd < 0) - goto exit; - len = read(fd, seqnum, sizeof(seqnum)-1); - close(fd); - if (len <= 0) - goto exit; - seqnum[len] = '\0'; - seq_kernel = strtoull(seqnum, NULL, 10); - info(udev, "kernel seqnum = %llu\n", seq_kernel); - - /* make sure all kernel events have arrived in the queue */ - if (seq_udev >= seq_kernel) { - info(udev, "queue is empty and no pending events left\n"); - rc = 0; - goto exit; - } + if (udev_queue_get_queue_is_empty(udev_queue)) + break; usleep(1000 * 1000 / LOOP_PER_SECOND); - info(udev, "queue is empty, but events still pending\n"); } - + if (loop <= 0) { + struct udev_list_entry *list_entry; + + info(udev, "timeout waiting for udev queue\n"); + printf("\ndevadm settle timeout of %i seconds reached, the event queue contains:\n", timeout); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf(" '%s' [%s]\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + rc = 1; + } exit: + udev_queue_unref(udev_queue); return rc; } -- cgit v1.2.3-54-g00ecf From 62b9dfb62255c5b07f1356eee423aff18d6addaa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Oct 2008 10:22:47 +0200 Subject: libudev: device - handle /sys/block// --- udev/lib/libudev-device.c | 19 ++++++++++++++++++- udev/udevadm-info.c | 15 +++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 893ec080a6..a512537140 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -231,8 +231,8 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * { size_t len; const char *subdir; - const char *pos; char path[UTIL_PATH_SIZE]; + char *pos; struct stat statbuf; struct udev_device *udev_device; @@ -260,6 +260,23 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * util_strlcpy(path, syspath, sizeof(path)); util_resolve_sys_link(udev, path, sizeof(path)); + /* try to resolve the silly block layout if needed */ + if (strncmp(&path[len], "/block/", 7) == 0) { + char block[UTIL_PATH_SIZE]; + char part[UTIL_PATH_SIZE]; + + util_strlcpy(block, path, sizeof(block)); + pos = strrchr(block, '/'); + if (pos == NULL) + return NULL; + util_strlcpy(part, pos, sizeof(part)); + pos[0] = '\0'; + if (util_resolve_sys_link(udev, block, sizeof(block)) == 0) { + util_strlcpy(path, block, sizeof(path)); + util_strlcat(path, part, sizeof(path)); + } + } + /* path exists in sys */ if (strncmp(&syspath[len], "/devices/", 9) == 0 || strncmp(&syspath[len], "/class/", 7) == 0 || diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index c2ff0bbea3..4da9881dbe 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -341,7 +341,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) break; } fprintf(stderr, "unknown query type\n"); - rc = 2; + rc = 3; goto exit; case 'r': if (action == ACTION_NONE) @@ -407,9 +407,16 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) printf("%s\n", udev_device_get_devnode(device)); } else { size_t len; + const char *node; len = strlen(udev_get_dev_path(udev)); - printf("%s\n", &udev_device_get_devnode(device)[len+1]); + node = udev_device_get_devnode(device); + if (node == NULL) { + fprintf(stderr, "no device node found\n"); + rc = 5; + goto exit; + } + printf("%s\n", &udev_device_get_devnode(device)[len+1]); } break; case QUERY_SYMLINK: @@ -450,14 +457,14 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case ACTION_ATTRIBUTE_WALK: if (device == NULL) { fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); - rc = 5; + rc = 4; goto exit; } print_device_chain(device); break; case ACTION_DEVICE_ID_FILE: if (stat_device(name, export, export_prefix) != 0) - rc = 6; + rc = 1; break; case ACTION_ROOT: printf("%s\n", udev_get_dev_path(udev)); -- cgit v1.2.3-54-g00ecf From cabfd8d0b487b856a2a41b9595e310e63674b99f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Oct 2008 13:57:39 +0200 Subject: libudev: enumerate - ignore regular files while scanning --- udev/lib/libudev-enumerate.c | 20 ++++++++++++++------ udev/lib/libudev-util.c | 5 ----- udev/lib/test-libudev.c | 2 +- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 0377649cfd..7d2d592c92 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -200,7 +200,8 @@ static int match_attr(struct udev_enumerate *udev_enumerate, const char *syspath return 1; } -static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir1, const char *subdir2) +static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, + const char *basedir, const char *subdir1, const char *subdir2) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); char path[UTIL_PATH_SIZE]; @@ -231,11 +232,16 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, const util_strlcpy(syspath, path, sizeof(syspath)); util_strlcat(syspath, "/", sizeof(syspath)); util_strlcat(syspath, dent->d_name, sizeof(syspath)); + if (lstat(syspath, &statbuf) != 0) + continue; + if (S_ISREG(statbuf.st_mode)) + continue; + if (S_ISLNK(statbuf.st_mode)) + util_resolve_sys_link(udev, syspath, sizeof(syspath)); util_strlcpy(filename, syspath, sizeof(filename)); util_strlcat(filename, "/uevent", sizeof(filename)); if (stat(filename, &statbuf) != 0) continue; - util_resolve_sys_link(udev, syspath, sizeof(syspath)); if (!match_attr(udev_enumerate, syspath)) continue; list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); @@ -262,7 +268,7 @@ static int match_subsystem(struct udev_enumerate *udev_enumerate, const char *su return 1; } -static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir, const char *match) +static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir, const char *subsystem) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); @@ -279,7 +285,7 @@ static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { if (dent->d_name[0] == '.') continue; - if (!match_subsystem(udev_enumerate, match != NULL ? match : dent->d_name)) + if (!match_subsystem(udev_enumerate, subsystem != NULL ? subsystem : dent->d_name)) continue; scan_dir_and_add_devices(udev_enumerate, basedir, dent->d_name, subdir); } @@ -400,7 +406,9 @@ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) info(udev, "searching '%s/*' dir\n", subsysdir); scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); } - info(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); - scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); + if (match_subsystem(udev_enumerate, "drivers")) { + info(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); + scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); + } return 0; } diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 0e5bc37d43..55bac9a476 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -64,17 +64,12 @@ ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) { - struct stat statbuf; char link_target[UTIL_PATH_SIZE]; int len; int i; int back; - if (lstat(syspath, &statbuf) < 0) - return -1; - if (!S_ISLNK(statbuf.st_mode)) - return -1; len = readlink(syspath, link_target, sizeof(link_target)); if (len <= 0) return -1; diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 9c7acb048a..7291e8c89a 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -366,7 +366,7 @@ int main(int argc, char *argv[], char *envp[]) test_enumerate_print_list(udev_enumerate); udev_enumerate_unref(udev_enumerate); - printf("enumerate '!block'\n"); + printf("enumerate 'not block'\n"); udev_enumerate = udev_enumerate_new(udev); if (udev_enumerate == NULL) return -1; -- cgit v1.2.3-54-g00ecf From 8a1946ae0881ce6fb283ffa0b0dc289bbdb9bd80 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Oct 2008 14:41:43 +0200 Subject: udevadm: trigger --type=failed - use libudev queue --- udev/udevadm-trigger.c | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 3cf8c7a3d6..2c4954761e 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -62,35 +62,24 @@ static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) } } -static int enumerate_scan_failed(struct udev_enumerate *udev_enumerate) +static int scan_failed(struct udev_enumerate *udev_enumerate) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char base[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; + struct udev_queue *udev_queue; + struct udev_list_entry *list_entry; - util_strlcpy(base, udev_get_dev_path(udev), sizeof(base)); - util_strlcat(base, "/.udev/failed", sizeof(base)); + udev_queue = udev_queue_new(udev); + if (udev_queue == NULL) + return -1; + udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) { + struct udev_device *device; - dir = opendir(base); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char syspath[UTIL_PATH_SIZE]; - size_t start; - struct udev_device *device; - - if (dent->d_name[0] == '.') - continue; - start = util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); - util_strlcat(syspath, dent->d_name, sizeof(syspath)); - util_path_decode(&syspath[start]); - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) - continue; - udev_enumerate_add_device(udev_enumerate, device); - udev_device_unref(device); - } - closedir(dir); + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + info(udev, "add '%s'\n", udev_device_get_syspath(device)); + udev_enumerate_add_device(udev_enumerate, device); + udev_device_unref(device); } return 0; } @@ -209,7 +198,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) switch (device_type) { case TYPE_FAILED: - enumerate_scan_failed(udev_enumerate); + scan_failed(udev_enumerate); exec_list(udev_enumerate, action); goto exit; case TYPE_SUBSYSTEMS: -- cgit v1.2.3-54-g00ecf From 333b736fdc80c5c9d4623e44e2447303113c5e4c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Oct 2008 14:42:58 +0200 Subject: rules: ieee1394 - create both, by-id/scsi-* and by-id/ieee-* links --- TODO | 4 ---- rules/rules.d/60-persistent-storage.rules | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index dbdadc716d..b3254155cb 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,3 @@ - o use queue interface for --type=failed - o check "enumerate" on SYSFS_DEPRECATED -#129 - o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator o rework rules to a match-action list, instead of a rules array diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 5218b2c570..dec83cfe7e 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -31,13 +31,16 @@ KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" -KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +# firewire +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" +KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" + # libata compat (ata-* links, like old hd* devices did create) KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" -- cgit v1.2.3-54-g00ecf From 4dea370d493c6d94799e63128398ae8374b999b4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Oct 2008 18:02:39 +0200 Subject: build: include Makefile.am.inc in all Makefile.am Many thanks to Chris Spiegel for finding the still current vol_id non-large-file-access bug, because of not including config.h. --- Makefile.am | 2 ++ extras/Makefile.am | 2 ++ extras/firmware/Makefile.am | 2 ++ extras/path_id/Makefile.am | 2 ++ extras/rule_generator/Makefile.am | 2 ++ extras/volume_id/lib/Makefile.am | 2 ++ rules/Makefile.am | 2 ++ 7 files changed, 14 insertions(+) diff --git a/Makefile.am b/Makefile.am index 0963ce828e..1d87bfd1a8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + SUBDIRS = \ udev \ rules \ diff --git a/extras/Makefile.am b/extras/Makefile.am index f72e0b1f5f..30e6e95d89 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + SUBDIRS = \ ata_id \ cdrom_id \ diff --git a/extras/firmware/Makefile.am b/extras/firmware/Makefile.am index 0c69de9161..78b28f61f0 100644 --- a/extras/firmware/Makefile.am +++ b/extras/firmware/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev dist_udevhome_SCRIPTS = \ firmware.sh diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am index 966a03dfaf..b85b7473bb 100644 --- a/extras/path_id/Makefile.am +++ b/extras/path_id/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev dist_udevhome_SCRIPTS = \ path_id diff --git a/extras/rule_generator/Makefile.am b/extras/rule_generator/Makefile.am index 1f0248b215..898191281d 100644 --- a/extras/rule_generator/Makefile.am +++ b/extras/rule_generator/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + udevhomedir = $(udev_prefix)/lib/udev dist_udevhome_SCRIPTS = \ write_cd_rules \ diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am index 59a5ac990b..0b0c80ba21 100644 --- a/extras/volume_id/lib/Makefile.am +++ b/extras/volume_id/lib/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + rootlibdir = $(exec_prefix)/$(libdir_name) rootlib_LTLIBRARIES = \ libvolume_id.la diff --git a/rules/Makefile.am b/rules/Makefile.am index 22de28220a..af0933885b 100644 --- a/rules/Makefile.am +++ b/rules/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ rules.d/50-udev-default.rules \ -- cgit v1.2.3-54-g00ecf From f13e4c36c2246eba5afae482c9bb60dc8c0b719d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Oct 2008 19:00:55 +0200 Subject: udevd: print warning if CONFIG_SYSFS_DEPRECATED is used Future udev versions will depend on the current sysfs layout, which includes features which are not available in the deprecated mode. --- TODO | 3 +-- udev/udevd.c | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index b3254155cb..f960f2431b 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,9 @@ + o handle spaces in SYMLINK+=, do not create multiple links o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator o rework rules to a match-action list, instead of a rules array o add DVB variables to kernel, and drop shell script rule o add watershed extra - o log warning if /sys/block/ does, but /sys/class/block/ does not exist, - udev will depend on the non-deprecated sysfs layout in a future release o DEVTYPE for disks is set by the kernel, they will be removed from the default rules o "udevadm control" commands will only accept the -- syntax diff --git a/udev/udevd.c b/udev/udevd.c index 1f8483c301..9783fe4e7c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -953,9 +953,21 @@ int main(int argc, char *argv[]) fd = open("/dev/kmsg", O_WRONLY); if (fd > 0) { - const char *str = "<6>udevd version " VERSION " started\n"; - - write(fd, str, strlen(str)); + const char *ver_str = "<6>udev: starting version " VERSION "\n"; + char path[UTIL_PATH_SIZE]; + struct stat statbuf; + + write(fd, ver_str, strlen(ver_str)); + util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); + util_strlcat(path, "/class/mem/null", sizeof(path)); + if (lstat(path, &statbuf) == 0) { + if (S_ISDIR(statbuf.st_mode)) { + const char *depr_str = "<6>udev: deprecated sysfs layout " + "(CONFIG_SYSFS_DEPRECATED) is unsupported\n"; + + write(fd, depr_str, strlen(depr_str)); + } + } close(fd); } -- cgit v1.2.3-54-g00ecf From 714131f1f2115bb4279d079e4b56a67bedcf2e9a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Oct 2008 20:42:53 +0200 Subject: release 129 --- ChangeLog | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 10 +++++++++- configure.ac | 2 +- 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d87f3fbc5d..a7271c6636 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,64 @@ +Summary of changes from v128 to v129 +============================================ + +Alan Jenkins (7): + udev-test.pl: set non-zero exitcode if tests fail + scsi_id: compiler warning on 32-bit + trivial cleanup in udev_rules_iter + avoid repeated scans for goto targets (udev_iter_find_label) + replace strerror() usage with threadsafe "%m" format string + fix messages (inc. debug compile failure) introduced when optimizing "goto" + allow compiler to check dbg() arguments on non-debug builds + +Kay Sievers (46): + libudev: switch to "udev_device_get_parent" + libudev: udev_device - add attribute cache + libudev: handle "device" link as parent, handle "class" "block" as "subsystem" + udevadm: info - fix lookup-by-name + libudev: switch API from devpath to syspath + libudev: rename ctrl_msg to ctrl_msg_wire + vol_id: fix lib logging glue + fix broken symlink resolving + fix udevadm trigger + libudev: pass udev_device in enumerate + libudev: fix "subsystem" value + always include config.h from Makefile + libudev: udev_device_get_devname -> udev_device_get_devnode + libudev: add udev_device_new_from_devnum() + libudev: also import "uevent" file when reading udev database + libudev: add userdata pointer + libudev: replace awkward callback list interfaces with list iterators + libudev: get devnum from uevent file + libudev: enumerate_get_devices_list -> enumerate_get_list + libudev: initialize selinux only when needed + libudev: device - read database only when needed + libudev: rework list handling + libudev: more list rework + lubudev: accept more sys directories as devices, and parent devices + libudev: enumerate - accept list of subsystems to scan, or skip + libudev: enumerate "subsystem" + libudev: enumerate - scan /sys/block/ if needed + libudev: enumerate - split new() and scan() + test: replace ancient sysfs tree with recent one + test: add missing pci directory because of .gitignore *.7 + gitignore: move *.8 to subdirs + test: replace last reference of "/class/*" devpath + fix dbg() callers + libudev: enumerate - scan devices and subsystems, add subsystem and attribute filter + udevadm: trigger: use libudev + fix segfault caused by wrong pointer used in dbg() + libudev: device_init() -> device_new() + udevadm: trigger fix long option --type= + libudev: add queue interface + udevadm: settle - use libudev queue + libudev: device - handle /sys/block// + libudev: enumerate - ignore regular files while scanning + udevadm: trigger --type=failed - use libudev queue + rules: ieee1394 - create both, by-id/scsi-* and by-id/ieee-* links + build: include Makefile.am.inc in all Makefile.am + udevd: print warning if CONFIG_SYSFS_DEPRECATED is used + + Summary of changes from v127 to v128 ============================================ diff --git a/NEWS b/NEWS index e43dde8a7d..5e0519ec99 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,14 @@ udev 129 ======== -More libudev work. Most of udevadm's functionality comes from libudev +Fix recently introduced bug, which caused a compilation without large +file support, where vol_id does not recognize raid signatures at the end +of a volume. + +Firewire disks now create both, by-id/scsi-* and by-id/ieee-* links. +Seems some kernel versions prevent the creation of the ieee-* links, +so people used the scsi-* link which disappeared now. + +More libudev work. Almost all udevadm functionality comes from libudev now. udevadm trigger has a new option --type, which allows to trigger events diff --git a/configure.ac b/configure.ac index bcc3554ac8..0042a61ce0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [128], + [129], [kay.sievers@vrfy.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) -- cgit v1.2.3-54-g00ecf From d6b148cde2a8ca6dc32af2e1d95824ac3be926db Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Oct 2008 06:20:33 +0200 Subject: fix compile error with --disable-logging --- udev/lib/libudev-private.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 7747b344fe..a9ad2f86a9 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -30,14 +30,14 @@ log_null(struct udev *udev, const char *format, ...) {} # ifdef USE_DEBUG # define dbg(udev, arg...) udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) # else -# define dbg log_null +# define dbg(udev, arg...) log_null(udev, ## arg) # endif # define info(udev, arg...) udev_log(udev, LOG_INFO, __FILE__, __LINE__, __FUNCTION__, ## arg) # define err(udev, arg...) udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) #else -# define dbg log_null -# define info log_null -# define err log_null +# define dbg(udev, arg...) log_null(udev, ## arg) +# define info(udev, arg...) log_null(udev, ## arg) +# define err(udev, arg...) log_null(udev, ## arg) #endif /* libudev */ -- cgit v1.2.3-54-g00ecf From 13ddea815496b32bd0ae0a648cdc50af28d69bb1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Oct 2008 11:54:33 +0200 Subject: libudev: enumerate - add_device() -> add_syspath() --- udev/lib/exported_symbols | 2 +- udev/lib/libudev-enumerate.c | 37 +++++++++++++++++++++++++++---------- udev/lib/libudev.c | 3 +-- udev/lib/libudev.h | 2 +- udev/lib/test-libudev.c | 8 ++------ udev/udevadm-trigger.c | 12 ++---------- 6 files changed, 34 insertions(+), 30 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 81abb58d64..ffd8d66acd 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -42,7 +42,7 @@ udev_enumerate_add_match_attr udev_enumerate_add_nomatch_attr udev_enumerate_scan_devices udev_enumerate_scan_subsystems -udev_enumerate_add_device +udev_enumerate_add_syspath udev_monitor_new_from_socket udev_monitor_new_from_netlink udev_monitor_enable_receiving diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 7d2d592c92..9fb154418d 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -30,6 +30,8 @@ #include "libudev.h" #include "libudev-private.h" +static int devices_sort(struct udev_enumerate *udev_enumerate); + struct udev_enumerate { struct udev *udev; int refcount; @@ -38,6 +40,7 @@ struct udev_enumerate { struct list_node subsystem_match_list; struct list_node subsystem_nomatch_list; struct list_node devices_list; + int devices_sorted; }; /** @@ -98,6 +101,8 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude { if (udev_enumerate == NULL) return NULL; + if (!udev_enumerate->devices_sorted) + devices_sort(udev_enumerate); return list_get_entry(&udev_enumerate->devices_list); } @@ -313,23 +318,35 @@ static int devices_delay(struct udev *udev, const char *syspath) return 0; } -int udev_enumerate_add_device(struct udev_enumerate *udev_enumerate, struct udev_device *udev_device) +/* sort delayed devices to the end of the list */ +static int devices_sort(struct udev_enumerate *udev_enumerate) { - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); struct udev_list_entry *list_entry; + udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->devices_list)) { + if (devices_delay(udev_enumerate->udev, udev_list_entry_get_name(list_entry))) + list_entry_move_to_end(list_entry); + } + udev_enumerate->devices_sorted = 1; + return 0; +} + +int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_device *udev_device; + if (udev_enumerate == NULL) return -EINVAL; - if (udev_device == NULL) + if (syspath == NULL) return 0; - list_entry_add(udev, - &udev_enumerate->devices_list, + /* resolve to real syspath */ + udev_device = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (udev_device == NULL) + return -EINVAL; + list_entry_add(udev, &udev_enumerate->devices_list, udev_device_get_syspath(udev_device), NULL, 1, 1); - /* sort delayed devices to the end of the list */ - udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->devices_list)) { - if (devices_delay(udev, udev_list_entry_get_name(list_entry))) - list_entry_move_to_end(list_entry); - } + udev_device_unref(udev_device); return 0; } diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 12220e7a78..c2c5025b9e 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -377,8 +377,7 @@ void udev_unref(struct udev *udev) * @udev: udev library context * @log_fn: function to be called for logging messages * - * The built-in logging, which writes to stderr if the - * LIBUDEV_DEBUG environment variable is set, can be + * The built-in logging, which writes to stderr, it can be * overridden by a custom function, to plug log messages * into the users logging functionality. * diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index cc6939c02f..fec05d4476 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -102,7 +102,7 @@ extern int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumer extern int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); extern int udev_enumerate_add_match_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value); extern int udev_enumerate_add_nomatch_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value); -extern int udev_enumerate_add_device(struct udev_enumerate *udev_enumerate, struct udev_device *udev_device); +extern int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); extern int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); extern int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); extern struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 7291e8c89a..5d19d5dd75 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -73,23 +73,19 @@ static void print_device(struct udev_device *device) printf("devnum: %u:%u\n", major(devnum), minor(devnum)); count = 0; - list_entry = udev_device_get_devlinks_list_entry(device); - while (list_entry != NULL) { + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { printf("link: '%s'\n", udev_list_entry_get_name(list_entry)); count++; - list_entry = udev_list_entry_get_next(list_entry); } if (count > 0) printf("found %i links\n", count); count = 0; - list_entry = udev_device_get_properties_list_entry(device); - while (list_entry != NULL) { + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) { printf("property: '%s=%s'\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); count++; - list_entry = udev_list_entry_get_next(list_entry); } if (count > 0) printf("found %i properties\n", count); diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 2c4954761e..8d25f92399 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -71,16 +71,8 @@ static int scan_failed(struct udev_enumerate *udev_enumerate) udev_queue = udev_queue_new(udev); if (udev_queue == NULL) return -1; - udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - info(udev, "add '%s'\n", udev_device_get_syspath(device)); - udev_enumerate_add_device(udev_enumerate, device); - udev_device_unref(device); - } + udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) + udev_enumerate_add_syspath(udev_enumerate, udev_list_entry_get_name(list_entry)); return 0; } -- cgit v1.2.3-54-g00ecf From 842dacb76f2f98537554683d7cccec4710779a8a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Oct 2008 15:16:11 +0200 Subject: volume_id: hpfs - read label and uuid --- extras/volume_id/lib/hpfs.c | 67 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c index a59ca1d99b..80ba289773 100644 --- a/extras/volume_id/lib/hpfs.c +++ b/extras/volume_id/lib/hpfs.c @@ -31,31 +31,84 @@ #include "libvolume_id.h" #include "libvolume_id-private.h" +struct hpfs_boot_block +{ + uint8_t jmp[3]; + uint8_t oem_id[8]; + uint8_t bytes_per_sector[2]; + uint8_t sectors_per_cluster; + uint8_t n_reserved_sectors[2]; + uint8_t n_fats; + uint8_t n_rootdir_entries[2]; + uint8_t n_sectors_s[2]; + uint8_t media_byte; + uint16_t sectors_per_fat; + uint16_t sectors_per_track; + uint16_t heads_per_cyl; + uint32_t n_hidden_sectors; + uint32_t n_sectors_l; + uint8_t drive_number; + uint8_t mbz; + uint8_t sig_28h; + uint8_t vol_serno[4]; + uint8_t vol_label[11]; + uint8_t sig_hpfs[8]; + uint8_t pad[448]; + uint8_t magic[2]; +} PACKED; + struct hpfs_super { uint8_t magic[4]; + uint8_t magic1[4]; uint8_t version; } PACKED; + +struct hpfs_spare_super +{ + uint8_t magic[4]; + uint8_t magic1[4]; +} PACKED; + #define HPFS_SUPERBLOCK_OFFSET 0x2000 +#define HPFS_SUPERBLOCK_SPARE_OFFSET 0x2200 int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size) { struct hpfs_super *hs; + struct hpfs_spare_super *hss; + struct hpfs_boot_block *hbb; info("probing at offset 0x%llx\n", (unsigned long long) off); - hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x200); + hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x400); if (hs == NULL) return -1; + if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) != 0) + return -1; - if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) == 0) { - sprintf(id->type_version, "%u", hs->version); + hss = (struct hpfs_spare_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_SPARE_OFFSET, 0x200); + if (hss == NULL) + return -1; + if (memcmp(hss->magic, "\x49\x18\x91\xf9", 4) != 0) + return -1; - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hpfs"; - return 0; + sprintf(id->type_version, "%u", hs->version); + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hpfs"; + + /* if boot block looks valid, read label and uuid from there */ + hbb = (struct hpfs_boot_block *) volume_id_get_buffer(id, off, 0x200); + if (hs == NULL) + return -1; + if (memcmp(hbb->magic, "\x55\xaa", 2) == 0 && + memcmp(hbb->sig_hpfs, "HPFS", 4) == 0 && + hbb->sig_28h == 0x28) { + volume_id_set_label_raw(id, hbb->vol_label, 11); + volume_id_set_label_string(id, hbb->vol_label, 11); + volume_id_set_uuid(id, hbb->vol_serno, 0, UUID_DOS); } - return -1; + return 0; } -- cgit v1.2.3-54-g00ecf From 033e9f8cde5a7feec1334888aec69def99c945b5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Oct 2008 16:49:05 +0200 Subject: use no_argument, required_argument, optional_argument in longopts --- extras/ata_id/ata_id.c | 4 ++-- extras/cdrom_id/cdrom_id.c | 6 +++--- extras/collect/collect.c | 8 ++++---- extras/fstab_import/fstab_import.c | 6 +++--- extras/scsi_id/scsi_id.c | 22 +++++++++++----------- extras/usb_id/usb_id.c | 8 ++++---- extras/volume_id/vol_id.c | 20 ++++++++++---------- udev/lib/test-libudev.c | 12 ++++++------ udev/udevadm-control.c | 24 ++++++++++++------------ udev/udevadm-info.c | 22 +++++++++++----------- udev/udevadm-monitor.c | 8 ++++---- udev/udevadm-settle.c | 4 ++-- udev/udevadm-test.c | 8 ++++---- udev/udevadm-trigger.c | 20 ++++++++++---------- udev/udevadm.c | 6 +++--- udev/udevd.c | 10 +++++----- 16 files changed, 94 insertions(+), 94 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 927dbfabd7..a4f73b8dfd 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -88,8 +88,8 @@ int main(int argc, char *argv[]) int fd; int rc = 0; static const struct option options[] = { - { "export", 0, NULL, 'x' }, - { "help", 0, NULL, 'h' }, + { "export", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, {} }; diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 627ae0dee4..381aa70bed 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -503,9 +503,9 @@ int main(int argc, char *argv[]) { struct udev *udev; static const struct option options[] = { - { "export", 0, NULL, 'x' }, - { "debug", 0, NULL, 'd' }, - { "help", 0, NULL, 'h' }, + { "export", no_argument, NULL, 'x' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, {} }; const char *node = NULL; diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 14184a5e05..7ebe865b62 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -321,10 +321,10 @@ static void everybody(void) int main(int argc, char **argv) { static const struct option options[] = { - { "add", 0, NULL, 'a' }, - { "remove", 0, NULL, 'r' }, - { "debug", 0, NULL, 'd' }, - { "help", 0, NULL, 'h' }, + { "add", no_argument, NULL, 'a' }, + { "remove", no_argument, NULL, 'r' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, {} }; int argi; diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c index 71ab5d34ee..e793604faa 100644 --- a/extras/fstab_import/fstab_import.c +++ b/extras/fstab_import/fstab_import.c @@ -66,9 +66,9 @@ int main(int argc, char *argv[]) { struct udev *udev; static const struct option options[] = { - { "export", 0, NULL, 'x' }, - { "debug", 0, NULL, 'd' }, - { "help", 0, NULL, 'h' }, + { "export", no_argument, NULL, 'x' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, {} }; char **devices; diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 10ec98c8bf..6334af386b 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -31,17 +31,17 @@ #include "scsi_id.h" static const struct option options[] = { - { "device", 1, NULL, 'd' }, - { "config", 1, NULL, 'f' }, - { "page", 1, NULL, 'p' }, - { "blacklisted", 0, NULL, 'b' }, - { "whitelisted", 0, NULL, 'g' }, - { "replace-whitespace", 0, NULL, 'u' }, - { "sg-version", 1, NULL, 's' }, - { "verbose", 0, NULL, 'v' }, - { "version", 0, NULL, 'V' }, - { "export", 0, NULL, 'x' }, - { "help", 0, NULL, 'h' }, + { "device", required_argument, NULL, 'd' }, + { "config", required_argument, NULL, 'f' }, + { "page", required_argument, NULL, 'p' }, + { "blacklisted", no_argument, NULL, 'b' }, + { "whitelisted", no_argument, NULL, 'g' }, + { "replace-whitespace", no_argument, NULL, 'u' }, + { "sg-version", required_argument, NULL, 's' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { "export", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, {} }; diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 2154552120..f39496b07c 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -359,10 +359,10 @@ int main(int argc, char **argv) char devpath[MAX_PATH_LEN]; static int export; static const struct option options[] = { - { "usb-info", 0, NULL, 'u' }, - { "num-info", 0, NULL, 'n' }, - { "export", 0, NULL, 'x' }, - { "help", 0, NULL, 'h' }, + { "usb-info", no_argument, NULL, 'u' }, + { "num-info", no_argument, NULL, 'n' }, + { "export", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, {} }; diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index b47d6a4ecb..0137b84fbe 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -111,16 +111,16 @@ static int all_probers(volume_id_probe_fn_t probe_fn, int main(int argc, char *argv[]) { static const struct option options[] = { - { "label", 0, NULL, 'l' }, - { "label-raw", 0, NULL, 'L' }, - { "uuid", 0, NULL, 'u' }, - { "type", 0, NULL, 't' }, - { "export", 0, NULL, 'x' }, - { "skip-raid", 0, NULL, 's' }, - { "probe-all", 0, NULL, 'a' }, - { "offset", 2, NULL, 'o' }, - { "debug", 0, NULL, 'd' }, - { "help", 0, NULL, 'h' }, + { "label", no_argument, NULL, 'l' }, + { "label-raw", no_argument, NULL, 'L' }, + { "uuid", no_argument, NULL, 'u' }, + { "type", no_argument, NULL, 't' }, + { "export", no_argument, NULL, 'x' }, + { "skip-raid", no_argument, NULL, 's' }, + { "probe-all", no_argument, NULL, 'a' }, + { "offset", optional_argument, NULL, 'o' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, {} }; diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 5d19d5dd75..47fbf3b42a 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -273,12 +273,12 @@ int main(int argc, char *argv[], char *envp[]) { struct udev *udev = NULL; static const struct option options[] = { - { "syspath", 1, NULL, 'p' }, - { "subsystem", 1, NULL, 's' }, - { "socket", 1, NULL, 'S' }, - { "debug", 0, NULL, 'd' }, - { "help", 0, NULL, 'h' }, - { "version", 0, NULL, 'V' }, + { "syspath", required_argument, NULL, 'p' }, + { "subsystem", required_argument, NULL, 's' }, + { "socket", required_argument, NULL, 'S' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, {} }; struct udev_enumerate *udev_enumerate; diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index baffd0d204..50020b57d9 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -46,18 +46,18 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) /* compat values with '_' will be removed in a future release */ static const struct option options[] = { - { "log-priority", 1, NULL, 'l' }, - { "log_priority", 1, NULL, 'l' + 256 }, - { "stop-exec-queue", 0, NULL, 's' }, - { "stop_exec_queue", 0, NULL, 's' + 256 }, - { "start-exec-queue", 0, NULL, 'S' }, - { "start_exec_queue", 0, NULL, 'S' + 256}, - { "reload-rules", 0, NULL, 'R' }, - { "reload_rules", 0, NULL, 'R' + 256}, - { "env", 1, NULL, 'e' }, - { "max-childs", 1, NULL, 'm' }, - { "max_childs", 1, NULL, 'm' + 256}, - { "help", 0, NULL, 'h' }, + { "log-priority", required_argument, NULL, 'l' }, + { "log_priority", required_argument, NULL, 'l' + 256 }, + { "stop-exec-queue", no_argument, NULL, 's' }, + { "stop_exec_queue", no_argument, NULL, 's' + 256 }, + { "start-exec-queue", no_argument, NULL, 'S' }, + { "start_exec_queue", no_argument, NULL, 'S' + 256}, + { "reload-rules", no_argument, NULL, 'R' }, + { "reload_rules", no_argument, NULL, 'R' + 256}, + { "env", required_argument, NULL, 'e' }, + { "max-childs", required_argument, NULL, 'm' }, + { "max_childs", required_argument, NULL, 'm' + 256}, + { "help", no_argument, NULL, 'h' }, {} }; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 4da9881dbe..ec098abd18 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -217,17 +217,17 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) int rc = 0; static const struct option options[] = { - { "name", 1, NULL, 'n' }, - { "path", 1, NULL, 'p' }, - { "query", 1, NULL, 'q' }, - { "attribute-walk", 0, NULL, 'a' }, - { "export-db", 0, NULL, 'e' }, - { "root", 0, NULL, 'r' }, - { "device-id-of-file", 1, NULL, 'd' }, - { "export", 0, NULL, 'x' }, - { "export-prefix", 1, NULL, 'P' }, - { "version", 0, NULL, 1 }, /* -V outputs braindead format */ - { "help", 0, NULL, 'h' }, + { "name", required_argument, NULL, 'n' }, + { "path", required_argument, NULL, 'p' }, + { "query", required_argument, NULL, 'q' }, + { "attribute-walk", no_argument, NULL, 'a' }, + { "export-db", no_argument, NULL, 'e' }, + { "root", no_argument, NULL, 'r' }, + { "device-id-of-file", required_argument, NULL, 'd' }, + { "export", no_argument, NULL, 'x' }, + { "export-prefix", required_argument, NULL, 'P' }, + { "version", no_argument, NULL, 1 }, /* -V outputs braindead format */ + { "help", no_argument, NULL, 'h' }, {} }; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index d5992ceb6c..14a6edc844 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -77,10 +77,10 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) int rc = 0; static const struct option options[] = { - { "environment", 0, NULL, 'e' }, - { "kernel", 0, NULL, 'k' }, - { "udev", 0, NULL, 'u' }, - { "help", 0, NULL, 'h' }, + { "environment", no_argument, NULL, 'e' }, + { "kernel", no_argument, NULL, 'k' }, + { "udev", no_argument, NULL, 'u' }, + { "help", no_argument, NULL, 'h' }, {} }; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index d066ef90ce..5e5a080bc8 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -36,8 +36,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { - { "timeout", 1, NULL, 't' }, - { "help", 0, NULL, 'h' }, + { "timeout", required_argument, NULL, 't' }, + { "help", no_argument, NULL, 'h' }, {} }; int timeout = DEFAULT_TIMEOUT; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index ba0852871a..f4b0125d3c 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -83,10 +83,10 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) int rc = 0; static const struct option options[] = { - { "action", 1, NULL, 'a' }, - { "subsystem", 1, NULL, 's' }, - { "force", 0, NULL, 'f' }, - { "help", 0, NULL, 'h' }, + { "action", required_argument, NULL, 'a' }, + { "subsystem", required_argument, NULL, 's' }, + { "force", no_argument, NULL, 'f' }, + { "help", no_argument, NULL, 'h' }, {} }; diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 8d25f92399..eb46a2983c 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -79,16 +79,16 @@ static int scan_failed(struct udev_enumerate *udev_enumerate) int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { - { "verbose", 0, NULL, 'v' }, - { "dry-run", 0, NULL, 'n' }, - { "type", 1, NULL, 't' }, - { "retry-failed", 0, NULL, 'F' }, - { "action", 1, NULL, 'c' }, - { "subsystem-match", 1, NULL, 's' }, - { "subsystem-nomatch", 1, NULL, 'S' }, - { "attr-match", 1, NULL, 'a' }, - { "attr-nomatch", 1, NULL, 'A' }, - { "help", 0, NULL, 'h' }, + { "verbose", no_argument, NULL, 'v' }, + { "dry-run", no_argument, NULL, 'n' }, + { "type", required_argument, NULL, 't' }, + { "retry-failed", no_argument, NULL, 'F' }, + { "action", required_argument, NULL, 'c' }, + { "subsystem-match", required_argument, NULL, 's' }, + { "subsystem-nomatch", required_argument, NULL, 'S' }, + { "attr-match", required_argument, NULL, 'a' }, + { "attr-nomatch", required_argument, NULL, 'A' }, + { "help", no_argument, NULL, 'h' }, {} }; enum { diff --git a/udev/udevadm.c b/udev/udevadm.c index b18114273c..3f2c78212e 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -124,9 +124,9 @@ int main(int argc, char *argv[]) { struct udev *udev; static const struct option options[] = { - { "debug", 0, NULL, 'd' }, - { "help", 0, NULL, 'h' }, - { "version", 0, NULL, 'V' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, {} }; const char *command; diff --git a/udev/udevd.c b/udev/udevd.c index 9783fe4e7c..a821ee7d8e 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -784,11 +784,11 @@ int main(int argc, char *argv[]) const char *value; int daemonize = 0; static const struct option options[] = { - { "daemon", 0, NULL, 'd' }, - { "debug-trace", 0, NULL, 't' }, - { "debug", 0, NULL, 'D' }, - { "help", 0, NULL, 'h' }, - { "version", 0, NULL, 'V' }, + { "daemon", no_argument, NULL, 'd' }, + { "debug-trace", no_argument, NULL, 't' }, + { "debug", no_argument, NULL, 'D' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, {} }; int rc = 1; -- cgit v1.2.3-54-g00ecf From e598c5738c2dc85a3e93c3f68cd88e8eea51215b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Oct 2008 18:48:40 +0200 Subject: libudev: get rid of selinux "Hello world!" linked against libselinux parses /proc/mounts and whatever else on startup, even when the lib is not needed at all. Not funny! Get rid of that thing where it's not absolutely needed. --- Makefile.am.inc | 3 +- TODO | 2 + extras/ata_id/Makefile.am | 5 -- extras/cdrom_id/Makefile.am | 5 -- extras/edd_id/Makefile.am | 5 -- extras/floppy/Makefile.am | 3 +- extras/floppy/create_floppy_devices.c | 2 + extras/fstab_import/Makefile.am | 5 -- extras/scsi_id/Makefile.am | 5 -- extras/usb_id/Makefile.am | 5 -- extras/volume_id/Makefile.am | 5 -- udev/Makefile.am | 1 + udev/lib/libudev.c | 91 -------------------------------- udev/lib/libudev.h | 5 -- udev/test-udev.c | 2 + udev/udev.h | 7 +++ udev/udev_selinux.c | 99 +++++++++++++++++++++++++++++++++++ udev/udevadm.c | 2 + udev/udevd.c | 3 ++ 19 files changed, 122 insertions(+), 133 deletions(-) create mode 100644 udev/udev_selinux.c diff --git a/Makefile.am.inc b/Makefile.am.inc index f61706a2c9..7ecd55de78 100644 --- a/Makefile.am.inc +++ b/Makefile.am.inc @@ -6,4 +6,5 @@ AM_CPPFLAGS = \ AM_CFLAGS = -AM_LDFLAGS = +AM_LDFLAGS = \ + -Wl,--as-needed diff --git a/TODO b/TODO index f960f2431b..082bb478eb 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ + convert usb_id to libudev's udev_device + o handle spaces in SYMLINK+=, do not create multiple links o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index 89aa02f5da..34ded29ded 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -10,11 +10,6 @@ ata_id_SOURCES = \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c -if USE_SELINUX -ata_id_LDADD = \ - $(SELINUX_LIBS) -endif - dist_man_MANS = \ ata_id.8 diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index ec14366a23..f8c4bbff0a 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -14,11 +14,6 @@ cdrom_id_SOURCES = \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c -if USE_SELINUX -cdrom_id_LDADD = \ - $(SELINUX_LIBS) -endif - dist_man_MANS = \ cdrom_id.8 diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 652d2c472d..67199fd235 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -14,11 +14,6 @@ edd_id_SOURCES = \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c -if USE_SELINUX -edd_id_LDADD = \ - $(SELINUX_LIBS) -endif - dist_man_MANS = \ edd_id.8 diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index a62dd20984..337e7a325c 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -9,7 +9,8 @@ create_floppy_devices_SOURCES = \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c \ - ../../udev/udev_utils.c + ../../udev/udev_utils.c \ + ../../udev/udev_selinux.c if USE_SELINUX create_floppy_devices_LDADD = \ diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 4cff958da3..6c5b3b4800 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -68,6 +68,7 @@ int main(int argc, char **argv) logging_init("create_floppy_devices"); udev_set_log_fn(udev, log_fn); + selinux_init(udev); while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { switch (c) { @@ -161,6 +162,7 @@ int main(int argc, char **argv) i++; } + selinux_exit(udev); udev_unref(udev); exit: return 0; diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index 49e598e1f4..c1204782b5 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -14,11 +14,6 @@ fstab_import_SOURCES = \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c -if USE_SELINUX -fstab_import_LDADD = \ - $(SELINUX_LIBS) -endif - distclean-local: rm -f Makefile.in diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index 0b5dbf0450..e6798eea60 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -14,11 +14,6 @@ scsi_id_SOURCES = \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c -if USE_SELINUX -scsi_id_LDADD = \ - $(SELINUX_LIBS) -endif - dist_sysconf_DATA = \ scsi_id.config diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index 89d59657fb..24f630b1d9 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -12,10 +12,5 @@ usb_id_SOURCES = \ ../../udev/udev_sysfs.c \ ../../udev/udev_utils.c -if USE_SELINUX -usb_id_LDADD = \ - $(SELINUX_LIBS) -endif - distclean-local: rm -f Makefile.in diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index 4d904d83c3..5b68e4321d 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -16,11 +16,6 @@ vol_id_SOURCES = \ vol_id_LDADD = \ lib/libvolume_id.la -if USE_SELINUX -vol_id_LDADD += \ - $(SELINUX_LIBS) -endif - dist_man_MANS = \ vol_id.8 diff --git a/udev/Makefile.am b/udev/Makefile.am index b28546b51c..b9e2e89620 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -25,6 +25,7 @@ common_files = \ udev_sysfs.c \ udev_utils.c \ udev_utils_file.c \ + udev_selinux.c \ list.h \ lib/libudev.h \ lib/libudev-private.h \ diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index c2c5025b9e..3f7d0e547e 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -25,9 +25,6 @@ #include #include #include -#ifdef USE_SELINUX -#include -#endif #include "libudev.h" #include "libudev-private.h" @@ -42,11 +39,6 @@ struct udev { char *dev_path; char *rules_path; int log_priority; -#ifdef USE_SELINUX - int selinux_initialized; - int selinux_enabled; - security_context_t selinux_prev_scontext; -#endif int run; }; @@ -72,26 +64,6 @@ static void log_stderr(struct udev *udev, vfprintf(stderr, format, args); } -static void selinux_init(struct udev *udev) -{ -#ifdef USE_SELINUX - /* - * record the present security context, for file-creation - * restoration creation purposes. - */ - udev->selinux_enabled = (is_selinux_enabled() > 0); - info(udev, "selinux=%i\n", udev->selinux_enabled); - if (udev->selinux_enabled) { - matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); - if (getfscreatecon(&udev->selinux_prev_scontext) < 0) { - err(udev, "getfscreatecon failed\n"); - udev->selinux_prev_scontext = NULL; - } - } - udev->selinux_initialized = 1; -#endif -} - void *udev_get_userdata(struct udev *udev) { if (udev == NULL) @@ -106,68 +78,6 @@ void udev_set_userdata(struct udev *udev, void *userdata) udev->userdata = userdata; } -static void selinux_exit(struct udev *udev) -{ -#ifdef USE_SELINUX - if (!udev->selinux_initialized) - return; - if (udev->selinux_enabled) { - freecon(udev->selinux_prev_scontext); - udev->selinux_prev_scontext = NULL; - } -#endif -} - -void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) -{ -#ifdef USE_SELINUX - if (!udev->selinux_initialized) - selinux_init(udev); - if (udev->selinux_enabled) { - security_context_t scontext = NULL; - - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (lsetfilecon(file, scontext) < 0) - err(udev, "setfilecon %s failed: %m\n", file); - freecon(scontext); - } -#endif -} - -void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) -{ -#ifdef USE_SELINUX - if (!udev->selinux_initialized) - selinux_init(udev); - if (udev->selinux_enabled) { - security_context_t scontext = NULL; - - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (setfscreatecon(scontext) < 0) - err(udev, "setfscreatecon %s failed: %m\n", file); - freecon(scontext); - } -#endif -} - -void udev_selinux_resetfscreatecon(struct udev *udev) -{ -#ifdef USE_SELINUX - if (!udev->selinux_initialized) - selinux_init(udev); - if (udev->selinux_enabled) { - if (setfscreatecon(udev->selinux_prev_scontext) < 0) - err(udev, "setfscreatecon failed: %m\n"); - } -#endif -} - /** * udev_new: * @@ -364,7 +274,6 @@ void udev_unref(struct udev *udev) udev->refcount--; if (udev->refcount > 0) return; - selinux_exit(udev); free(udev->dev_path); free(udev->sys_path); free(udev->rules_path); diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index fec05d4476..448346e278 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -44,11 +44,6 @@ extern const char *udev_get_dev_path(struct udev *udev); extern void *udev_get_userdata(struct udev *udev); extern void udev_set_userdata(struct udev *udev, void *userdata); -/* selinux glue */ -extern void udev_selinux_resetfscreatecon(struct udev *udev); -extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); -extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); - /* list iteration */ struct udev_list_entry; extern struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); diff --git a/udev/test-udev.c b/udev/test-udev.c index 4aa7999fc0..508f9f1408 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -59,6 +59,7 @@ int main(int argc, char *argv[]) if (udev == NULL) exit(1); dbg(udev, "version %s\n", VERSION); + selinux_init(udev); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); @@ -131,6 +132,7 @@ fail: udev_rules_cleanup(&rules); sysfs_cleanup(); exit: + selinux_exit(udev); udev_unref(udev); if (retval != 0) return 1; diff --git a/udev/udev.h b/udev/udev.h index 102f15d0b9..b54d313bff 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -167,6 +167,13 @@ extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(void *buf, size_t bufsize); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); +/* udev_selinux */ +extern void selinux_init(struct udev *udev); +extern void selinux_exit(struct udev *udev); +extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); +extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); +extern void udev_selinux_resetfscreatecon(struct udev *udev); + /* udevadm commands */ extern int udevadm_monitor(struct udev *udev, int argc, char *argv[]); extern int udevadm_info(struct udev *udev, int argc, char *argv[]); diff --git a/udev/udev_selinux.c b/udev/udev_selinux.c new file mode 100644 index 0000000000..499f53c916 --- /dev/null +++ b/udev/udev_selinux.c @@ -0,0 +1,99 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include + +#include "udev.h" + +#ifndef USE_SELINUX +void selinux_init(struct udev *udev) {} +void selinux_exit(struct udev *udev) {} +void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} +void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} +void udev_selinux_resetfscreatecon(struct udev *udev) {} +#else +#include + +static int selinux_enabled; +security_context_t selinux_prev_scontext; + +void selinux_init(struct udev *udev) +{ + /* record the present security context */ + selinux_enabled = (is_selinux_enabled() > 0); + info(udev, "selinux=%i\n", selinux_enabled); + if (!selinux_enabled) + return; + matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); + if (getfscreatecon(&selinux_prev_scontext) < 0) { + err(udev, "getfscreatecon failed\n"); + selinux_prev_scontext = NULL; + } +} + +void selinux_exit(struct udev *udev) +{ + if (!selinux_enabled) + return; + freecon(selinux_prev_scontext); + selinux_prev_scontext = NULL; +} + +void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) +{ + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (lsetfilecon(file, scontext) < 0) + err(udev, "setfilecon %s failed: %m\n", file); + freecon(scontext); +} + +void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) +{ + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (setfscreatecon(scontext) < 0) + err(udev, "setfscreatecon %s failed: %m\n", file); + freecon(scontext); +} + +void udev_selinux_resetfscreatecon(struct udev *udev) +{ + if (!selinux_enabled) + return; + if (setfscreatecon(selinux_prev_scontext) < 0) + err(udev, "setfscreatecon failed: %m\n"); +} +#endif diff --git a/udev/udevadm.c b/udev/udevadm.c index 3f2c78212e..3671b9ee59 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -140,6 +140,7 @@ int main(int argc, char *argv[]) logging_init("udevadm"); udev_set_log_fn(udev, log_fn); + selinux_init(udev); sysfs_init(); /* see if we are a compat link, this will be removed in a future release */ @@ -211,6 +212,7 @@ int main(int argc, char *argv[]) rc = 2; out: sysfs_cleanup(); + selinux_exit(udev); udev_unref(udev); logging_close(); return rc; diff --git a/udev/udevd.c b/udev/udevd.c index a821ee7d8e..4000d37e80 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -801,6 +801,7 @@ int main(int argc, char *argv[]) logging_init("udevd"); udev_set_log_fn(udev, log_fn); dbg(udev, "version %s\n", VERSION); + selinux_init(udev); while (1) { int option; @@ -1125,6 +1126,8 @@ exit: if (uevent_netlink_sock >= 0) close(uevent_netlink_sock); + selinux_exit(udev); + udev_unref(udev); logging_close(); return rc; } -- cgit v1.2.3-54-g00ecf From 98f10a9e2ada5d72a0c39b94a5b59d9da4f28753 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Oct 2008 21:19:00 +0200 Subject: libudev: device - add get_parent_with_subsystem() --- TODO | 1 + udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 16 ++++++++++++++++ udev/lib/libudev.h | 1 + 4 files changed, 19 insertions(+) diff --git a/TODO b/TODO index 082bb478eb..ce424c4361 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ convert usb_id to libudev's udev_device + add DEVTYPE o handle spaces in SYMLINK+=, do not create multiple links o use libudev device in udev_rules.c diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index ffd8d66acd..ff7efeaf75 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -16,6 +16,7 @@ udev_list_entry_get_value udev_device_new_from_syspath udev_device_new_from_devnum udev_device_get_parent +udev_device_get_parent_with_subsystem udev_device_ref udev_device_unref udev_device_get_udev diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index a512537140..8e4360a7f4 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -404,6 +404,22 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) return udev_device->parent_device; } +struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem) +{ + struct udev_device *parent; + + parent = udev_device_get_parent(udev_device); + while (parent != NULL) { + const char *parent_subsystem; + + parent_subsystem = udev_device_get_subsystem(parent); + if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) + break; + parent = udev_device_get_parent(parent); + } + return parent; +} + /** * udev_device_get_udev: * @udev_device: udev device diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 448346e278..fabe59d7d7 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -60,6 +60,7 @@ struct udev_device; extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); +extern struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); extern struct udev *udev_device_get_udev(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From 2f1a291e2f50075e46cd55568a5ba6ba4f6a2afc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Oct 2008 21:20:18 +0200 Subject: usb_id: use libudev --- TODO | 1 - extras/usb_id/Makefile.am | 5 +- extras/usb_id/usb_id.c | 144 +++++++++++++++++++++++++--------------------- 3 files changed, 83 insertions(+), 67 deletions(-) diff --git a/TODO b/TODO index ce424c4361..ac996f4012 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ - convert usb_id to libudev's udev_device add DEVTYPE o handle spaces in SYMLINK+=, do not create multiple links diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index 24f630b1d9..c54d83e088 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -8,9 +8,10 @@ usb_id_SOURCES = \ usb_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c \ - ../../udev/udev_sysfs.c \ - ../../udev/udev_utils.c + ../../udev/lib/libudev-device.c \ + ../../udev/lib/libudev-enumerate.c distclean-local: rm -f Makefile.in diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index f39496b07c..4d5265532d 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -22,20 +22,23 @@ #include "../../udev/udev.h" -#define MAX_PATH_LEN 512 -#define MAX_SERIAL_LEN 256 -#define BLKGETSIZE64 _IOR(0x12,114,size_t) +int debug; static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) { - vsyslog(priority, format, args); + if (debug) { + fprintf(stderr, "%s: ", fn != NULL ? fn : file); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } } static char vendor_str[64]; static char model_str[64]; -static char serial_str[MAX_SERIAL_LEN]; +static char serial_str[UTIL_NAME_SIZE]; static char revision_str[64]; static char type_str[64]; static char instance_str[64]; @@ -199,95 +202,98 @@ static void set_scsi_type(char *to, const char *from, size_t len) * 6.) If the device supplies a serial number, this number * is concatenated with the identification with an underscore '_'. */ -static int usb_id(struct udev *udev, const char *devpath) +static int usb_id(struct udev_device *dev) { - struct sysfs_device *dev; - struct sysfs_device *dev_interface; - struct sysfs_device *dev_usb; + struct udev *udev = udev_device_get_udev(dev); + struct udev_device *dev_interface; + struct udev_device *dev_usb; const char *if_class, *if_subclass; int if_class_num; int protocol = 0; - dbg(udev, "devpath %s\n", devpath); - - /* get all usb specific information: dev_interface, if_class, dev_usb */ - dev = sysfs_device_get(udev, devpath); - if (dev == NULL) { - err(udev, "unable to access '%s'\n", devpath); - return 1; - } + dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); /* usb interface directory */ - dev_interface = sysfs_device_get_parent_with_subsystem(udev, dev, "usb"); + dev_interface = udev_device_get_parent_with_subsystem(dev, "usb"); if (dev_interface == NULL) { - info(udev, "unable to access usb_interface device of '%s'\n", devpath); + info(udev, "unable to access usb_interface device of '%s'\n", + udev_device_get_syspath(dev)); return 1; } - if_class = sysfs_attr_get_value(udev, dev_interface->devpath, "bInterfaceClass"); + if_class = udev_device_get_attr_value(dev_interface, "bInterfaceClass"); if (!if_class) { - info(udev, "%s: cannot get bInterfaceClass attribute\n", dev_interface->kernel); + info(udev, "%s: cannot get bInterfaceClass attribute\n", + udev_device_get_sysname(dev)); return 1; } if_class_num = strtoul(if_class, NULL, 16); if (if_class_num == 8) { - if_subclass = sysfs_attr_get_value(udev, dev_interface->devpath, "bInterfaceSubClass"); + if_subclass = udev_device_get_attr_value(dev_interface, "bInterfaceSubClass"); if (if_subclass != NULL) protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); - } else + } else { set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1); + } - info(udev, "%s: if_class %d protocol %d\n", dev_interface->devpath, if_class_num, protocol); + info(udev, "%s: if_class %d protocol %d\n", + udev_device_get_syspath(dev_interface), if_class_num, protocol); /* usb device directory */ - dev_usb = sysfs_device_get_parent_with_subsystem(udev, dev_interface, "usb"); + dev_usb = udev_device_get_parent_with_subsystem(dev_interface, "usb"); if (!dev_usb) { - info(udev, "unable to find parent 'usb' device of '%s'\n", devpath); + info(udev, "unable to find parent 'usb' device of '%s'\n", + udev_device_get_syspath(dev)); return 1; } /* mass storage */ if (protocol == 6 && !use_usb_info) { - struct sysfs_device *dev_scsi; + struct udev_device *dev_scsi; const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; int host, bus, target, lun; /* get scsi device */ - dev_scsi = sysfs_device_get_parent_with_subsystem(udev, dev, "scsi"); + dev_scsi = udev_device_get_parent_with_subsystem(dev, "scsi"); if (dev_scsi == NULL) { - info(udev, "unable to find parent 'scsi' device of '%s'\n", devpath); + info(udev, "unable to find parent 'scsi' device of '%s'\n", + udev_device_get_syspath(dev)); goto fallback; } - if (sscanf(dev_scsi->kernel, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { - info(udev, "invalid scsi device '%s'\n", dev_scsi->kernel); + if (sscanf(udev_device_get_sysname(dev_scsi), "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { + info(udev, "invalid scsi device '%s'\n", udev_device_get_sysname(dev_scsi)); goto fallback; } /* Generic SPC-2 device */ - scsi_vendor = sysfs_attr_get_value(udev, dev_scsi->devpath, "vendor"); + scsi_vendor = udev_device_get_attr_value(dev_scsi, "vendor"); if (!scsi_vendor) { - info(udev, "%s: cannot get SCSI vendor attribute\n", dev_scsi->kernel); + info(udev, "%s: cannot get SCSI vendor attribute\n", + udev_device_get_sysname(dev_scsi)); goto fallback; } set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); - scsi_model = sysfs_attr_get_value(udev, dev_scsi->devpath, "model"); + scsi_model = udev_device_get_attr_value(dev_scsi, "model"); if (!scsi_model) { - info(udev, "%s: cannot get SCSI model attribute\n", dev_scsi->kernel); + info(udev, "%s: cannot get SCSI model attribute\n", + udev_device_get_sysname(dev_scsi)); goto fallback; } set_str(model_str, scsi_model, sizeof(model_str)-1); - scsi_type = sysfs_attr_get_value(udev, dev_scsi->devpath, "type"); + scsi_type = udev_device_get_attr_value(dev_scsi, "type"); if (!scsi_type) { - info(udev, "%s: cannot get SCSI type attribute\n", dev_scsi->kernel); + info(udev, "%s: cannot get SCSI type attribute\n", + udev_device_get_sysname(dev_scsi)); goto fallback; } set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); - scsi_rev = sysfs_attr_get_value(udev, dev_scsi->devpath, "rev"); + scsi_rev = udev_device_get_attr_value(dev_scsi, "rev"); if (!scsi_rev) { - info(udev, "%s: cannot get SCSI revision attribute\n", dev_scsi->kernel); + info(udev, "%s: cannot get SCSI revision attribute\n", + udev_device_get_sysname(dev_scsi)); goto fallback; } set_str(revision_str, scsi_rev, sizeof(revision_str)-1); @@ -305,10 +311,10 @@ fallback: const char *usb_vendor = NULL; if (!use_num_info) - usb_vendor = sysfs_attr_get_value(udev, dev_usb->devpath, "manufacturer"); + usb_vendor = udev_device_get_attr_value(dev_usb, "manufacturer"); if (!usb_vendor) - usb_vendor = sysfs_attr_get_value(udev, dev_usb->devpath, "idVendor"); + usb_vendor = udev_device_get_attr_value(dev_usb, "idVendor"); if (!usb_vendor) { info(udev, "No USB vendor information available\n"); @@ -321,10 +327,10 @@ fallback: const char *usb_model = NULL; if (!use_num_info) - usb_model = sysfs_attr_get_value(udev, dev_usb->devpath, "product"); + usb_model = udev_device_get_attr_value(dev_usb, "product"); if (!usb_model) - usb_model = sysfs_attr_get_value(udev, dev_usb->devpath, "idProduct"); + usb_model = udev_device_get_attr_value(dev_usb, "idProduct"); if (!usb_model) { dbg(udev, "No USB model information available\n"); @@ -336,7 +342,7 @@ fallback: if (revision_str[0] == '\0') { const char *usb_rev; - usb_rev = sysfs_attr_get_value(udev, dev_usb->devpath, "bcdDevice"); + usb_rev = udev_device_get_attr_value(dev_usb, "bcdDevice"); if (usb_rev) set_str(revision_str, usb_rev, sizeof(revision_str)-1); } @@ -344,7 +350,7 @@ fallback: if (serial_str[0] == '\0') { const char *usb_serial; - usb_serial = sysfs_attr_get_value(udev, dev_usb->devpath, "serial"); + usb_serial = udev_device_get_attr_value(dev_usb, "serial"); if (usb_serial) set_str(serial_str, usb_serial, sizeof(serial_str)-1); } @@ -353,18 +359,20 @@ fallback: int main(int argc, char **argv) { - struct udev *udev; - int retval = 0; - const char *env; - char devpath[MAX_PATH_LEN]; - static int export; static const struct option options[] = { { "usb-info", no_argument, NULL, 'u' }, { "num-info", no_argument, NULL, 'n' }, { "export", no_argument, NULL, 'x' }, + { "debug", no_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, {} }; + struct udev *udev; + struct udev_device *dev; + char syspath[UTIL_PATH_SIZE]; + const char *devpath; + static int export; + int retval = 0; udev = udev_new(); if (udev == NULL) @@ -372,16 +380,20 @@ int main(int argc, char **argv) logging_init("usb_id"); udev_set_log_fn(udev, log_fn); - sysfs_init(); while (1) { int option; - option = getopt_long(argc, argv, "nuxh", options, NULL); + option = getopt_long(argc, argv, "dnuxh", options, NULL); if (option == -1) break; switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; case 'n': use_num_info = 1; use_usb_info = 1; @@ -404,20 +416,24 @@ int main(int argc, char **argv) } } - env = getenv("DEVPATH"); - if (env != NULL) - util_strlcpy(devpath, env, sizeof(devpath)); - else { - if (argv[optind] == NULL) { - fprintf(stderr, "No device specified\n"); - retval = 1; - goto exit; - } - util_strlcpy(devpath, argv[optind], sizeof(devpath)); + devpath = getenv("DEVPATH"); + if (devpath == NULL) + devpath = argv[optind]; + if (devpath == NULL) { + fprintf(stderr, "No device specified\n"); + retval = 1; + goto exit; } - retval = usb_id(udev, devpath); + util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); + util_strlcat(syspath, devpath, sizeof(syspath)); + dev = udev_device_new_from_syspath(udev, syspath); + if (dev == NULL) { + err(udev, "unable to access '%s'\n", devpath); + return 1; + } + retval = usb_id(dev); if (retval == 0) { char serial[256]; @@ -449,8 +465,8 @@ int main(int argc, char **argv) } exit: + udev_device_unref(dev); udev_unref(udev); - sysfs_cleanup(); logging_close(); return retval; } -- cgit v1.2.3-54-g00ecf From ee137da3897d154e0c62b03ea7ef3c3359753adc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Oct 2008 10:33:15 +0200 Subject: udevadm: info - fix --query=all for devices without a device node --- udev/lib/test-libudev.c | 2 +- udev/udevadm-info.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 47fbf3b42a..854a0a9faa 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -104,7 +104,7 @@ static int test_device(struct udev *udev, const char *syspath) printf("looking at device: %s\n", syspath); device = udev_device_new_from_syspath(udev, syspath); if (device == NULL) { - printf("no device\n"); + printf("no device found\n"); return -1; } print_device(device); diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index ec098abd18..b18f249495 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -130,13 +130,16 @@ static int print_device_chain(struct udev_device *device) static void print_record(struct udev_device *device) { size_t len; + const char *str; int i; struct udev_list_entry *list_entry; printf("P: %s\n", udev_device_get_devpath(device)); len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("N: %s\n", &udev_device_get_devnode(device)[len+1]); + str = udev_device_get_devnode(device); + if (str != NULL) + printf("N: %s\n", &str[len+1]); i = device_get_devlink_priority(device); if (i != 0) @@ -159,7 +162,6 @@ static void print_record(struct udev_device *device) printf("E: %s=%s\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - printf("\n"); } -- cgit v1.2.3-54-g00ecf From 22c89d3fd78d7ef3f231fc837a47860efcc4cc9e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Oct 2008 11:42:47 +0200 Subject: vol_id: add size= option --- NEWS | 4 ++++ configure.ac | 6 +++--- extras/volume_id/vol_id.c | 18 +++++++++++++----- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 5e0519ec99..9fc1adaedd 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 130 +======== +Bugfixes. + udev 129 ======== Fix recently introduced bug, which caused a compilation without large diff --git a/configure.ac b/configure.ac index 0042a61ce0..0e0f9875a9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [129], + [130], [kay.sievers@vrfy.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) @@ -11,7 +11,7 @@ AC_PROG_LIBTOOL dnl /* libudev version */ LIBUDEV_LT_CURRENT=0 -LIBUDEV_LT_REVISION=1 +LIBUDEV_LT_REVISION=2 LIBUDEV_LT_AGE=0 AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) @@ -19,7 +19,7 @@ AC_SUBST(LIBUDEV_LT_AGE) dnl /* libvolume_id version */ VOLID_LT_CURRENT=1 -VOLID_LT_REVISION=1 +VOLID_LT_REVISION=2 VOLID_LT_AGE=0 AC_SUBST(VOLID_LT_CURRENT) AC_SUBST(VOLID_LT_REVISION) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 0137b84fbe..19aa0bd3c2 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -117,6 +117,7 @@ int main(int argc, char *argv[]) { "type", no_argument, NULL, 't' }, { "export", no_argument, NULL, 'x' }, { "skip-raid", no_argument, NULL, 's' }, + { "size", required_argument, NULL, 'S' }, { "probe-all", no_argument, NULL, 'a' }, { "offset", optional_argument, NULL, 'o' }, { "debug", no_argument, NULL, 'd' }, @@ -136,7 +137,7 @@ int main(int argc, char *argv[]) char label_safe[256]; char label_enc[256]; char uuid_enc[256]; - uint64_t size; + uint64_t size = 0; int skip_raid = 0; int probe_all = 0; uint64_t offset = 0; @@ -158,7 +159,7 @@ int main(int argc, char *argv[]) while (1) { int option; - option = getopt_long(argc, argv, "lLutxsaodh", options, NULL); + option = getopt_long(argc, argv, "lLutxsS:aodh", options, NULL); if (option == -1) break; @@ -189,6 +190,10 @@ int main(int argc, char *argv[]) case 'a': probe_all = 1; break; + case 'S': + if (optarg[0] != '\0') + size = strtoull(optarg, NULL, 0); + break; case 'o': if (optarg[0] != '\0') offset = strtoull(optarg, NULL, 0); @@ -203,6 +208,7 @@ int main(int argc, char *argv[]) " --skip-raid don't probe for raid\n" " --probe-all find possibly conflicting signatures\n" " --offset= probe at the given offset\n" + " --size= overwrite device size\n" " --debug print debug output to stderr\n" " --help\n\n"); goto exit; @@ -233,9 +239,11 @@ int main(int argc, char *argv[]) goto exit; } - if (ioctl(fd, BLKGETSIZE64, &size) != 0) - size = 0; - info(udev_ctx, "BLKGETSIZE64=%llu (%lluGB)\n", (unsigned long long)size, (unsigned long long)size >> 30); + if (size == 0) { + if (ioctl(fd, BLKGETSIZE64, &size) != 0) + size = 0; + info(udev_ctx, "BLKGETSIZE64=%llu (%lluGB)\n", (unsigned long long)size, (unsigned long long)size >> 30); + } /* try to drop all privileges before reading disk content */ if (getuid() == 0) { -- cgit v1.2.3-54-g00ecf From 7744e869ecbfd2a508dbba46acfc2133a2f8f840 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Oct 2008 14:49:29 +0200 Subject: move selinux noops to udev.h --- TODO | 2 -- extras/floppy/Makefile.am | 5 +++-- udev/Makefile.am | 3 ++- udev/udev.h | 8 ++++++++ udev/udev_selinux.c | 11 +---------- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index ac996f4012..f960f2431b 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - add DEVTYPE - o handle spaces in SYMLINK+=, do not create multiple links o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 337e7a325c..357129e336 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -9,10 +9,11 @@ create_floppy_devices_SOURCES = \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c \ - ../../udev/udev_utils.c \ - ../../udev/udev_selinux.c + ../../udev/udev_utils.c if USE_SELINUX +create_floppy_devices_SOURCES += \ + ../../udev/udev_selinux.c create_floppy_devices_LDADD = \ $(SELINUX_LIBS) endif diff --git a/udev/Makefile.am b/udev/Makefile.am index b9e2e89620..c0df391d6f 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -25,7 +25,6 @@ common_files = \ udev_sysfs.c \ udev_utils.c \ udev_utils_file.c \ - udev_selinux.c \ list.h \ lib/libudev.h \ lib/libudev-private.h \ @@ -39,6 +38,8 @@ common_files = \ lib/libudev-ctrl.c if USE_SELINUX +common_files += \ + udev_selinux.c common_ldadd += \ $(SELINUX_LIBS) endif diff --git a/udev/udev.h b/udev/udev.h index b54d313bff..6a685e6758 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -168,11 +168,19 @@ extern void file_unmap(void *buf, size_t bufsize); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); /* udev_selinux */ +#ifndef USE_SELINUX +static inline void selinux_init(struct udev *udev) {} +static inline void selinux_exit(struct udev *udev) {} +static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} +static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} +static inline void udev_selinux_resetfscreatecon(struct udev *udev) {} +#else extern void selinux_init(struct udev *udev); extern void selinux_exit(struct udev *udev); extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); extern void udev_selinux_resetfscreatecon(struct udev *udev); +#endif /* udevadm commands */ extern int udevadm_monitor(struct udev *udev, int argc, char *argv[]); diff --git a/udev/udev_selinux.c b/udev/udev_selinux.c index 499f53c916..cf7f43496a 100644 --- a/udev/udev_selinux.c +++ b/udev/udev_selinux.c @@ -22,18 +22,10 @@ #include #include #include +#include #include "udev.h" -#ifndef USE_SELINUX -void selinux_init(struct udev *udev) {} -void selinux_exit(struct udev *udev) {} -void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} -void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} -void udev_selinux_resetfscreatecon(struct udev *udev) {} -#else -#include - static int selinux_enabled; security_context_t selinux_prev_scontext; @@ -96,4 +88,3 @@ void udev_selinux_resetfscreatecon(struct udev *udev) if (setfscreatecon(selinux_prev_scontext) < 0) err(udev, "setfscreatecon failed: %m\n"); } -#endif -- cgit v1.2.3-54-g00ecf From 3ab8ebf572cced0a63f8ba915d8494ef1784803d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Oct 2008 14:50:57 +0200 Subject: volume_id: add dbg() as noop to check for compile errors --- extras/volume_id/lib/libvolume_id-private.h | 5 ++++- udev/lib/exported_symbols | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h index 2ce46502c4..3326bf3712 100644 --- a/extras/volume_id/lib/libvolume_id-private.h +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -34,12 +34,15 @@ #define PACKED __attribute__((packed)) #endif +static inline void __attribute__ ((format(printf, 1, 2))) +log_null(const char *format, ...) {} + #define err(format, arg...) volume_id_log_fn(LOG_ERR, __FILE__, __LINE__, format, ##arg) #define info(format, arg...) volume_id_log_fn(LOG_INFO, __FILE__, __LINE__, format, ##arg) #ifdef DEBUG #define dbg(format, arg...) volume_id_log_fn(LOG_DEBUG, __FILE__, __LINE__, format, ##arg) #else -#define dbg(format, arg...) do { } while (0) +#define dbg(format, arg...) log_null(format, ##arg) #endif #if (__BYTE_ORDER == __LITTLE_ENDIAN) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index ff7efeaf75..2574d13e67 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -1,7 +1,6 @@ udev_new udev_ref udev_unref -udev_log udev_set_log_fn udev_get_log_priority udev_set_log_priority -- cgit v1.2.3-54-g00ecf From d4f687c013a18010fdc2ddf937fad064343e635a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Oct 2008 14:56:54 +0200 Subject: vol_id: fix logging glue --- extras/volume_id/vol_id.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 19aa0bd3c2..2b487d0b3c 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -57,8 +57,10 @@ static void vid_log(int priority, const char *file, int line, const char *format { va_list args; + if (priority > udev_get_log_priority(udev_ctx)) + return; va_start(args, format); - udev_log(udev_ctx, priority, file, line, NULL, format, args); + log_fn(udev_ctx, priority, file, line, NULL, format, args); va_end(args); return; } -- cgit v1.2.3-54-g00ecf From ab7430c5d8b1784c36cfe0bc2734d34bce47fef5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Oct 2008 14:58:02 +0200 Subject: vol_id: always use the safe string versions for unencoded label and uuid --- extras/volume_id/vol_id.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 2b487d0b3c..b153bc5410 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -138,7 +138,10 @@ int main(int argc, char *argv[]) struct volume_id *vid = NULL; char label_safe[256]; char label_enc[256]; + char uuid_safe[256]; char uuid_enc[256]; + char type_enc[256]; + char type_version_enc[256]; uint64_t size = 0; int skip_raid = 0; int probe_all = 0; @@ -286,20 +289,24 @@ int main(int argc, char *argv[]) set_str(label_safe, label, sizeof(label_safe)); util_replace_chars(label_safe, ALLOWED_CHARS_INPUT); - volume_id_encode_string(label, label_enc, sizeof(label_enc)); + + set_str(uuid_safe, uuid, sizeof(uuid_safe)); + util_replace_chars(uuid_safe, ALLOWED_CHARS_INPUT); volume_id_encode_string(uuid, uuid_enc, sizeof(uuid_enc)); + volume_id_encode_string(type, type_enc, sizeof(type_enc)); + volume_id_encode_string(type_version, type_version_enc, sizeof(type_version_enc)); + switch (print) { case PRINT_EXPORT: printf("ID_FS_USAGE=%s\n", usage); - printf("ID_FS_TYPE=%s\n", type); - printf("ID_FS_VERSION=%s\n", type_version); - printf("ID_FS_UUID=%s\n", uuid); + printf("ID_FS_TYPE=%s\n", type_enc); + printf("ID_FS_VERSION=%s\n", type_version_enc); + printf("ID_FS_UUID=%s\n", uuid_safe); printf("ID_FS_UUID_ENC=%s\n", uuid_enc); - printf("ID_FS_LABEL=%s\n", label); + printf("ID_FS_LABEL=%s\n", label_safe); printf("ID_FS_LABEL_ENC=%s\n", label_enc); - printf("ID_FS_LABEL_SAFE=%s\n", label_safe); break; case PRINT_TYPE: printf("%s\n", type); -- cgit v1.2.3-54-g00ecf From 59315eeae497de23bd761f95bc55226538bc49b1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Oct 2008 15:01:39 +0200 Subject: volume_id: better DDF raid detection --- extras/volume_id/lib/ddf_raid.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c index bf24fe0168..53d309b8c0 100644 --- a/extras/volume_id/lib/ddf_raid.c +++ b/extras/volume_id/lib/ddf_raid.c @@ -34,12 +34,11 @@ /* http://www.snia.org/standards/home */ -#define DDF_HEADER 0xDE11DE11 #define DDF_GUID_LENGTH 24 #define DDF_REV_LENGTH 8 struct ddf_header { - uint32_t signature; + uint8_t signature[4]; uint32_t crc; uint8_t guid[DDF_GUID_LENGTH]; uint8_t ddf_rev[DDF_REV_LENGTH]; @@ -47,23 +46,47 @@ struct ddf_header { int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) { - uint64_t ddf_off = ((size / 0x200)-1) * 0x200; + uint64_t ddf_off; const uint8_t *buf; struct ddf_header *ddf; info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); - if (size < 0x10000) + (unsigned long long)off, (unsigned long long)size); + if (size < 0x30000) return -1; + /* header at last sector */ + ddf_off = ((size / 0x200)-1) * 0x200; buf = volume_id_get_buffer(id, off + ddf_off, 0x200); if (buf == NULL) return -1; ddf = (struct ddf_header *) buf; + if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0) { + info("header (little endian) found at %llu\n", (unsigned long long)(off + ddf_off)); + goto found; + } + if (memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0) { + info("header (big endian) found at %llu\n", (unsigned long long)(off + ddf_off)); + goto found; + } - if (ddf->signature != cpu_to_be32(DDF_HEADER)) + /* adaptec non-standard header location */ + ddf_off = ((size / 0x200)-257) * 0x200; + buf = volume_id_get_buffer(id, off + ddf_off, 0x200); + if (buf == NULL) return -1; + ddf = (struct ddf_header *) buf; + if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0) { + info("header adaptec (little endian) found at %llu\n", (unsigned long long)(off + ddf_off)); + goto found; + } + if (memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0) { + info("header adaptec (big endian) found at %llu\n", (unsigned long long)(off + ddf_off)); + goto found; + } + return -1; +found: volume_id_set_uuid(id, ddf->guid, DDF_GUID_LENGTH, UUID_STRING); snprintf(id->type_version, DDF_REV_LENGTH, "%s", ddf->ddf_rev); volume_id_set_usage(id, VOLUME_ID_RAID); -- cgit v1.2.3-54-g00ecf From 99370c21521bca6e747f6be209e5c28f89de9838 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Oct 2008 17:23:12 +0200 Subject: volume_id: add btrfs --- extras/volume_id/lib/Makefile.am | 3 +- extras/volume_id/lib/btrfs.c | 93 +++++++++++++++++++++++++++++ extras/volume_id/lib/libvolume_id-private.h | 1 + extras/volume_id/lib/volume_id.c | 1 + 4 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 extras/volume_id/lib/btrfs.c diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am index 0b0c80ba21..678e44ec1c 100644 --- a/extras/volume_id/lib/Makefile.am +++ b/extras/volume_id/lib/Makefile.am @@ -47,7 +47,8 @@ libvolume_id_la_SOURCES =\ vxfs.c \ squashfs.c \ netware.c \ - oracleasm.c + oracleasm.c \ + btrfs.c libvolume_id_la_LDFLAGS = \ -version-info $(VOLID_LT_CURRENT):$(VOLID_LT_REVISION):$(VOLID_LT_AGE) \ diff --git a/extras/volume_id/lib/btrfs.c b/extras/volume_id/lib/btrfs.c new file mode 100644 index 0000000000..aae2fa616e --- /dev/null +++ b/extras/volume_id/lib/btrfs.c @@ -0,0 +1,93 @@ +/* + * volume_id - reads filesystem label and uuid + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "libvolume_id.h" +#include "libvolume_id-private.h" + +struct btrfs_super_block { + uint8_t csum[32]; + uint8_t fsid[16]; + uint64_t bytenr; + uint64_t flags; + uint8_t magic[8]; + uint64_t generation; + uint64_t root; + uint64_t chunk_root; + uint64_t log_root; + uint64_t total_bytes; + uint64_t bytes_used; + uint64_t root_dir_objectid; + uint64_t num_devices; + uint32_t sectorsize; + uint32_t nodesize; + uint32_t leafsize; + uint32_t stripesize; + uint32_t sys_chunk_array_size; + uint8_t root_level; + uint8_t chunk_root_level; + uint8_t log_root_level; + struct btrfs_dev_item { + uint64_t devid; + uint64_t total_bytes; + uint64_t bytes_used; + uint32_t io_align; + uint32_t io_width; + uint32_t sector_size; + uint64_t type; + uint32_t dev_group; + uint8_t seek_speed; + uint8_t bandwidth; + uint8_t uuid[16]; + } PACKED dev_item; + uint8_t label[256]; +} PACKED; + +int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size) +{ + const uint8_t *buf; + struct btrfs_super_block *bfs; + + info("probing at offset 0x%llx, size 0x%llx\n", + (unsigned long long)off, (unsigned long long)size); + + buf = volume_id_get_buffer(id, off + 0x4000, 0x200); + if (buf == NULL) + return -1; + bfs = (struct btrfs_super_block *)buf; + if (memcmp(bfs->magic, "_B9RfS_M", 8) != 0) + return -1; + volume_id_set_uuid(id, bfs->fsid, 0, UUID_DCE); + volume_id_set_label_raw(id, bfs->label, 256); + volume_id_set_label_string(id, bfs->label, 256); + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "btrfs"; + return 0; +} diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h index 3326bf3712..356d899209 100644 --- a/extras/volume_id/lib/libvolume_id-private.h +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -155,6 +155,7 @@ extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t extern int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size); extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size); +extern int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size); /* special formats */ extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size); diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 9b7d91d11d..c9ad02b9ae 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -83,6 +83,7 @@ static const struct prober prober_filesystem[] = { { volume_id_probe_squashfs, { "squashfs", } }, { volume_id_probe_netware, { "netware", } }, { volume_id_probe_oracleasm, { "oracleasm", } }, + { volume_id_probe_btrfs, { "btrfs", } }, }; /* the user can overwrite this log function */ -- cgit v1.2.3-54-g00ecf From 0565a00a4cfdabd325bf2e117620d5f15dd46cda Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Oct 2008 18:24:04 +0200 Subject: volume_id: use PRIu64i, PRIx64 macros --- extras/volume_id/lib/adaptec_raid.c | 3 +-- extras/volume_id/lib/btrfs.c | 3 +-- extras/volume_id/lib/cramfs.c | 2 +- extras/volume_id/lib/ddf_raid.c | 11 +++++------ extras/volume_id/lib/ext.c | 2 +- extras/volume_id/lib/fat.c | 6 +++--- extras/volume_id/lib/gfs.c | 2 +- extras/volume_id/lib/hfs.c | 4 ++-- extras/volume_id/lib/highpoint.c | 5 ++--- extras/volume_id/lib/hpfs.c | 2 +- extras/volume_id/lib/iso9660.c | 4 ++-- extras/volume_id/lib/isw_raid.c | 3 +-- extras/volume_id/lib/jfs.c | 2 +- extras/volume_id/lib/jmicron_raid.c | 3 +-- extras/volume_id/lib/libvolume_id-private.h | 3 ++- extras/volume_id/lib/linux_raid.c | 6 ++---- extras/volume_id/lib/linux_swap.c | 2 +- extras/volume_id/lib/lsi_raid.c | 3 +-- extras/volume_id/lib/lvm.c | 4 ++-- extras/volume_id/lib/minix.c | 2 +- extras/volume_id/lib/netware.c | 2 +- extras/volume_id/lib/ntfs.c | 6 +++--- extras/volume_id/lib/nvidia_raid.c | 3 +-- extras/volume_id/lib/ocfs.c | 4 ++-- extras/volume_id/lib/oracleasm.c | 2 +- extras/volume_id/lib/promise_raid.c | 3 +-- extras/volume_id/lib/reiserfs.c | 2 +- extras/volume_id/lib/romfs.c | 2 +- extras/volume_id/lib/silicon_raid.c | 3 +-- extras/volume_id/lib/squashfs.c | 2 +- extras/volume_id/lib/sysv.c | 2 +- extras/volume_id/lib/udf.c | 2 +- extras/volume_id/lib/ufs.c | 2 +- extras/volume_id/lib/util.c | 6 +++--- extras/volume_id/lib/via_raid.c | 3 +-- extras/volume_id/lib/volume_id.c | 6 ++---- extras/volume_id/lib/vxfs.c | 2 +- extras/volume_id/lib/xfs.c | 8 ++++---- extras/volume_id/vol_id.c | 3 ++- 39 files changed, 61 insertions(+), 74 deletions(-) diff --git a/extras/volume_id/lib/adaptec_raid.c b/extras/volume_id/lib/adaptec_raid.c index a76b7321d8..d20399c0ff 100644 --- a/extras/volume_id/lib/adaptec_raid.c +++ b/extras/volume_id/lib/adaptec_raid.c @@ -91,8 +91,7 @@ int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t si uint64_t meta_off; struct adaptec_meta *ad; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/btrfs.c b/extras/volume_id/lib/btrfs.c index aae2fa616e..660e6dab38 100644 --- a/extras/volume_id/lib/btrfs.c +++ b/extras/volume_id/lib/btrfs.c @@ -75,8 +75,7 @@ int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; struct btrfs_super_block *bfs; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long)off, (unsigned long long)size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); buf = volume_id_get_buffer(id, off + 0x4000, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/cramfs.c b/extras/volume_id/lib/cramfs.c index ed54dfd352..b6460da5df 100644 --- a/extras/volume_id/lib/cramfs.c +++ b/extras/volume_id/lib/cramfs.c @@ -50,7 +50,7 @@ int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size) { struct cramfs_super *cs; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); if (cs == NULL) diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c index 53d309b8c0..58bdae94a7 100644 --- a/extras/volume_id/lib/ddf_raid.c +++ b/extras/volume_id/lib/ddf_raid.c @@ -50,8 +50,7 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; struct ddf_header *ddf; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long)off, (unsigned long long)size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x30000) return -1; @@ -62,11 +61,11 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) return -1; ddf = (struct ddf_header *) buf; if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0) { - info("header (little endian) found at %llu\n", (unsigned long long)(off + ddf_off)); + info("header (little endian) found at %" PRIu64 "\n", (off + ddf_off)); goto found; } if (memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0) { - info("header (big endian) found at %llu\n", (unsigned long long)(off + ddf_off)); + info("header (big endian) found at %" PRIu64 "\n", (off + ddf_off)); goto found; } @@ -77,11 +76,11 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) return -1; ddf = (struct ddf_header *) buf; if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0) { - info("header adaptec (little endian) found at %llu\n", (unsigned long long)(off + ddf_off)); + info("header adaptec (little endian) found at %" PRIu64 "\n", (off + ddf_off)); goto found; } if (memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0) { - info("header adaptec (big endian) found at %llu\n", (unsigned long long)(off + ddf_off)); + info("header adaptec (big endian) found at %" PRIu64 "\n", (off + ddf_off)); goto found; } diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c index 97299d60d8..13ec470291 100644 --- a/extras/volume_id/lib/ext.c +++ b/extras/volume_id/lib/ext.c @@ -135,7 +135,7 @@ int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) uint32_t feature_incompat; uint32_t flags; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); if (es == NULL) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 62ff6b664f..e5a5cc1191 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -275,7 +275,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) int maxloop; size_t fnlen; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off, 0x400); if (buf == NULL) @@ -380,7 +380,7 @@ magic: /* the label may be an attribute in the root directory */ root_start = (reserved + fat_size) * sector_size; - dbg("root dir start 0x%llx\n", (unsigned long long) root_start); + dbg("root dir start 0x%" PRIx64 "\n", root_start); root_dir_entries = le16_to_cpu(vs->dir_entries); dbg("expected entries 0x%x\n", root_dir_entries); @@ -442,7 +442,7 @@ fat32: dbg("next cluster %u\n", next); next_sect_off = (next - 2) * vs->sectors_per_cluster; next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%llx\n", (unsigned long long) next_off); + dbg("cluster offset 0x%" PRIx64 "\n", next_off); /* get cluster */ buf = volume_id_get_buffer(id, off + next_off, buf_size); diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c index a8b5080ec4..25f96f668b 100644 --- a/extras/volume_id/lib/gfs.c +++ b/extras/volume_id/lib/gfs.c @@ -83,7 +83,7 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v { struct gfs2_sb *sbd; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); sbd = (struct gfs2_sb *) volume_id_get_buffer(id, off + GFS_SUPERBLOCK_OFFSET, sizeof(struct gfs2_sb)); diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c index dbc5f36195..903378b34e 100644 --- a/extras/volume_id/lib/hfs.c +++ b/extras/volume_id/lib/hfs.c @@ -188,7 +188,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t siz struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; const uint8_t *buf; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) @@ -211,7 +211,7 @@ int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t siz off += (alloc_first_block * 512) + (embed_first_block * alloc_block_size); - dbg("hfs wrapped hfs+ found at offset 0x%llx\n", (unsigned long long) off); + dbg("hfs wrapped hfs+ found at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/highpoint.c b/extras/volume_id/lib/highpoint.c index 7c91f5d2c5..33554f29a3 100644 --- a/extras/volume_id/lib/highpoint.c +++ b/extras/volume_id/lib/highpoint.c @@ -54,7 +54,7 @@ int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint6 struct hpt37x_meta *hpt; uint32_t magic; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); if (buf == NULL) @@ -78,8 +78,7 @@ int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint6 uint64_t meta_off; uint32_t magic; - dbg("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + dbg("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c index 80ba289773..ce9118d370 100644 --- a/extras/volume_id/lib/hpfs.c +++ b/extras/volume_id/lib/hpfs.c @@ -80,7 +80,7 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size) struct hpfs_spare_super *hss; struct hpfs_boot_block *hbb; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x400); if (hs == NULL) diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c index 913e5b8a0e..ea1464b066 100644 --- a/extras/volume_id/lib/iso9660.c +++ b/extras/volume_id/lib/iso9660.c @@ -64,7 +64,7 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) struct iso_volume_descriptor *is; struct high_sierra_volume_descriptor *hs; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) @@ -91,7 +91,7 @@ int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) if (is->type != ISO_VD_SUPPLEMENTARY) continue; - dbg("found SVD at offset 0x%llx\n", (unsigned long long) (off + vd_offset)); + dbg("found SVD at offset 0x%" PRIx64 "\n", (off + vd_offset)); if (memcmp(is->escape_sequences, "%/@", 3) == 0|| memcmp(is->escape_sequences, "%/C", 3) == 0|| memcmp(is->escape_sequences, "%/E", 3) == 0) { diff --git a/extras/volume_id/lib/isw_raid.c b/extras/volume_id/lib/isw_raid.c index 382e45d5db..db31249716 100644 --- a/extras/volume_id/lib/isw_raid.c +++ b/extras/volume_id/lib/isw_raid.c @@ -48,8 +48,7 @@ int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint uint64_t meta_off; struct isw_meta *isw; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c index d496cf8781..b84ded349b 100644 --- a/extras/volume_id/lib/jfs.c +++ b/extras/volume_id/lib/jfs.c @@ -50,7 +50,7 @@ int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size) { struct jfs_super_block *js; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); if (js == NULL) diff --git a/extras/volume_id/lib/jmicron_raid.c b/extras/volume_id/lib/jmicron_raid.c index 134e7aa4e1..e14862f340 100644 --- a/extras/volume_id/lib/jmicron_raid.c +++ b/extras/volume_id/lib/jmicron_raid.c @@ -44,8 +44,7 @@ int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t si uint64_t meta_off; struct jmicron_meta *jm; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h index 356d899209..14f7568fec 100644 --- a/extras/volume_id/lib/libvolume_id-private.h +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -20,9 +20,10 @@ #ifndef _LIBVOLUME_ID_PRIVATE_H_ #define _LIBVOLUME_ID_PRIVATE_H_ -#include #include #include +#include +#include #include #include diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c index f7d1af4fe7..e845570823 100644 --- a/extras/volume_id/lib/linux_raid.c +++ b/extras/volume_id/lib/linux_raid.c @@ -72,8 +72,7 @@ static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint6 uint8_t bytes[16]; } uuid; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x10000) return -1; @@ -127,8 +126,7 @@ static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint6 const uint8_t *buf; struct mdp1_super_block *mdp1; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); buf = volume_id_get_buffer(id, off, 0x800); if (buf == NULL) diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 7cf3d35396..7b24a46b2d 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -48,7 +48,7 @@ int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size unsigned int page; struct swap_header_v1_2 *sw; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); /* eek, the swap signature is at the end of the PAGE_SIZE */ for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { diff --git a/extras/volume_id/lib/lsi_raid.c b/extras/volume_id/lib/lsi_raid.c index b4495a2c52..5a6ba4c72a 100644 --- a/extras/volume_id/lib/lsi_raid.c +++ b/extras/volume_id/lib/lsi_raid.c @@ -43,8 +43,7 @@ int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t s uint64_t meta_off; struct lsi_meta *lsi; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c index 1d62ec9331..a3f409a0ee 100644 --- a/extras/volume_id/lib/lvm.c +++ b/extras/volume_id/lib/lvm.c @@ -56,7 +56,7 @@ int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; struct lvm1_super_block *lvm; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); if (buf == NULL) @@ -83,7 +83,7 @@ int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size) struct lvm2_super_block *lvm; struct lvm2_pv_header *pvhdr; - dbg("probing at offset 0x%llx\n", (unsigned long long) off); + dbg("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c index 5644cca43f..cca1585602 100644 --- a/extras/volume_id/lib/minix.c +++ b/extras/volume_id/lib/minix.c @@ -75,7 +75,7 @@ int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size) struct minix_super_block *ms; struct minix3_super_block *m3s; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c index e6ca5da3a3..58749e5f05 100644 --- a/extras/volume_id/lib/netware.c +++ b/extras/volume_id/lib/netware.c @@ -87,7 +87,7 @@ int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size) { struct netware_super_block *nw; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); nw = (struct netware_super_block *) volume_id_get_buffer(id, off + NW_SUPERBLOCK_OFFSET, 0x200); if (nw == NULL) diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index 8154e7685a..f861b4bf28 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -110,7 +110,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; const uint8_t *val; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (ns == NULL) @@ -137,8 +137,8 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) dbg("sectorsize 0x%x\n", sector_size); dbg("clustersize 0x%x\n", cluster_size); - dbg("mftcluster %llu\n", (unsigned long long) mft_cluster); - dbg("mftoffset 0x%llx\n", (unsigned long long) mft_off); + dbg("mftcluster %" PRIu64 "\n", mft_cluster); + dbg("mftoffset 0x%" PRIx64 "\n", mft_off); dbg("cluster per mft_record %i\n", ns->cluster_per_mft_record); dbg("mft record size %i\n", mft_record_size); diff --git a/extras/volume_id/lib/nvidia_raid.c b/extras/volume_id/lib/nvidia_raid.c index cbd0d5b059..2969dbe3dd 100644 --- a/extras/volume_id/lib/nvidia_raid.c +++ b/extras/volume_id/lib/nvidia_raid.c @@ -46,8 +46,7 @@ int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t siz uint64_t meta_off; struct nvidia_meta *nv; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c index b0038f4ccb..e7bf55c421 100644 --- a/extras/volume_id/lib/ocfs.c +++ b/extras/volume_id/lib/ocfs.c @@ -136,7 +136,7 @@ int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size) struct ocfs1_super_block_header *osh; struct ocfs1_super_block_label *osl; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off, 0x200); if (buf == NULL) @@ -174,7 +174,7 @@ int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size) struct ocfs2_super_block *os; size_t blksize; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); diff --git a/extras/volume_id/lib/oracleasm.c b/extras/volume_id/lib/oracleasm.c index 069bb33ff2..8e63fb1209 100644 --- a/extras/volume_id/lib/oracleasm.c +++ b/extras/volume_id/lib/oracleasm.c @@ -50,7 +50,7 @@ int volume_id_probe_oracleasm(struct volume_id *id, uint64_t off, uint64_t size) const uint8_t *buf; struct oracleasm_super_block *oracleasm; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off + ASM_SB_OFF, 0x800); if (buf == NULL) diff --git a/extras/volume_id/lib/promise_raid.c b/extras/volume_id/lib/promise_raid.c index d4a5b04683..cdc90a1a65 100644 --- a/extras/volume_id/lib/promise_raid.c +++ b/extras/volume_id/lib/promise_raid.c @@ -47,8 +47,7 @@ int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, u 63, 255, 256, 16, 399, 0 }; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x40000) return -1; diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c index 5c48c06633..cdc46912ab 100644 --- a/extras/volume_id/lib/reiserfs.c +++ b/extras/volume_id/lib/reiserfs.c @@ -65,7 +65,7 @@ int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size) struct reiser4_super_block *rs4; uint8_t *buf; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); if (buf == NULL) diff --git a/extras/volume_id/lib/romfs.c b/extras/volume_id/lib/romfs.c index a49d7e2aa3..1c9a6f2497 100644 --- a/extras/volume_id/lib/romfs.c +++ b/extras/volume_id/lib/romfs.c @@ -42,7 +42,7 @@ int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size) { struct romfs_super *rfs; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); if (rfs == NULL) diff --git a/extras/volume_id/lib/silicon_raid.c b/extras/volume_id/lib/silicon_raid.c index abb8a1d304..4289788283 100644 --- a/extras/volume_id/lib/silicon_raid.c +++ b/extras/volume_id/lib/silicon_raid.c @@ -58,8 +58,7 @@ int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint uint64_t meta_off; struct silicon_meta *sil; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c index c4d961d31e..6952e5ceca 100644 --- a/extras/volume_id/lib/squashfs.c +++ b/extras/volume_id/lib/squashfs.c @@ -50,7 +50,7 @@ int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size) { struct squashfs_super *sqs; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); sqs = (struct squashfs_super *) volume_id_get_buffer(id, off, 0x200); if (sqs == NULL) diff --git a/extras/volume_id/lib/sysv.c b/extras/volume_id/lib/sysv.c index 66262df371..586dc1d145 100644 --- a/extras/volume_id/lib/sysv.c +++ b/extras/volume_id/lib/sysv.c @@ -100,7 +100,7 @@ int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size) struct xenix_super *xs; unsigned int boff; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { vs = (struct sysv_super *) diff --git a/extras/volume_id/lib/udf.c b/extras/volume_id/lib/udf.c index bf0833df80..aed0d76b52 100644 --- a/extras/volume_id/lib/udf.c +++ b/extras/volume_id/lib/udf.c @@ -77,7 +77,7 @@ int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size) unsigned int loc; unsigned int clen; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); if (vsd == NULL) diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c index 54cc85c43c..0648b454d3 100644 --- a/extras/volume_id/lib/ufs.c +++ b/extras/volume_id/lib/ufs.c @@ -180,7 +180,7 @@ int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size) struct ufs_super_block *ufs; int offsets[] = {0, 8, 64, 256, -1}; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); for (i = 0; offsets[i] >= 0; i++) { ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 0fb8937962..671f97ee27 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -352,7 +352,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) { ssize_t buf_len; - info("get buffer off 0x%llx(%llu), len 0x%zx\n", (unsigned long long) off, (unsigned long long) off, len); + info("get buffer off 0x%" PRIx64 "(%" PRIu64 "), len 0x%zx\n", off, off, len); /* check if requested area fits in superblock buffer */ if (off + len <= SB_BUFFER_SIZE) { if (id->sbbuf == NULL) { @@ -365,7 +365,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) /* check if we need to read */ if ((off + len) > id->sbbuf_len) { - info("read sbbuf len:0x%llx\n", (unsigned long long) (off + len)); + info("read sbbuf len:0x%" PRIx64 "\n", (off + len)); if (lseek(id->fd, 0, SEEK_SET) < 0) { dbg("lseek failed (%s)\n", strerror(errno)); return NULL; @@ -401,7 +401,7 @@ uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) /* check if we need to read */ if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - info("read seekbuf off:0x%llx len:0x%zx\n", (unsigned long long) off, len); + info("read seekbuf off:0x%" PRIx64 " len:0x%zx\n", off, len); if (lseek(id->fd, off, SEEK_SET) < 0) { dbg("lseek failed (%s)\n", strerror(errno)); return NULL; diff --git a/extras/volume_id/lib/via_raid.c b/extras/volume_id/lib/via_raid.c index e4ddd2244c..9e4be5a90d 100644 --- a/extras/volume_id/lib/via_raid.c +++ b/extras/volume_id/lib/via_raid.c @@ -68,8 +68,7 @@ int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) uint64_t meta_off; struct via_meta *via; - dbg("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + dbg("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); if (size < 0x10000) return -1; diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index c9ad02b9ae..791be43515 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -367,8 +367,7 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) if (!device_is_readable(id, off)) return -1; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); for (i = 0; i < ARRAY_SIZE(prober_raid); i++) if (prober_raid[i].prober(id, off, size) == 0) @@ -401,8 +400,7 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (!device_is_readable(id, off)) return -1; - info("probing at offset 0x%llx, size 0x%llx\n", - (unsigned long long) off, (unsigned long long) size); + info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) if (prober_filesystem[i].prober(id, off, size) == 0) diff --git a/extras/volume_id/lib/vxfs.c b/extras/volume_id/lib/vxfs.c index 06501af262..da569495d2 100644 --- a/extras/volume_id/lib/vxfs.c +++ b/extras/volume_id/lib/vxfs.c @@ -42,7 +42,7 @@ int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size) { struct vxfs_super *vxs; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); if (vxs == NULL) diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c index 98ba6572fc..35ba68ed3e 100644 --- a/extras/volume_id/lib/xfs.c +++ b/extras/volume_id/lib/xfs.c @@ -32,14 +32,14 @@ #include "libvolume_id-private.h" struct xfs_super_block { - uint8_t magic[4]; + uint8_t magic[4]; uint32_t blocksize; uint64_t dblocks; uint64_t rblocks; uint32_t dummy1[2]; - uint8_t uuid[16]; + uint8_t uuid[16]; uint32_t dummy2[15]; - uint8_t fname[12]; + uint8_t fname[12]; uint32_t dummy3[2]; uint64_t icount; uint64_t ifree; @@ -50,7 +50,7 @@ int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size) { struct xfs_super_block *xs; - info("probing at offset 0x%llx\n", (unsigned long long) off); + info("probing at offset 0x%" PRIx64 "\n", off); xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); if (xs == NULL) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index b153bc5410..b4db5adcd8 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "../../udev/udev.h" @@ -247,7 +248,7 @@ int main(int argc, char *argv[]) if (size == 0) { if (ioctl(fd, BLKGETSIZE64, &size) != 0) size = 0; - info(udev_ctx, "BLKGETSIZE64=%llu (%lluGB)\n", (unsigned long long)size, (unsigned long long)size >> 30); + info(udev_ctx, "BLKGETSIZE64=%" PRIu64 " (%" PRIu64 "GB)\n", size, size >> 30); } /* try to drop all privileges before reading disk content */ -- cgit v1.2.3-54-g00ecf From 30f8f896257189d6c931cadcfb4e892cb61d04cd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 4 Oct 2008 13:52:39 +0200 Subject: udevd: clarify deprecated sysfs layout warning --- udev/udevd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 4000d37e80..ee686c6eb7 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -963,8 +963,9 @@ int main(int argc, char *argv[]) util_strlcat(path, "/class/mem/null", sizeof(path)); if (lstat(path, &statbuf) == 0) { if (S_ISDIR(statbuf.st_mode)) { - const char *depr_str = "<6>udev: deprecated sysfs layout " - "(CONFIG_SYSFS_DEPRECATED) is unsupported\n"; + const char *depr_str = "<6>udev: deprecated sysfs layout (kernel too old, " + "or CONFIG_SYSFS_DEPRECATED) is unsupported, some " + "udev features may fail\n"; write(fd, depr_str, strlen(depr_str)); } -- cgit v1.2.3-54-g00ecf From 85e73aef06d79771cee9cefb56ce830c3c2d3344 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Oct 2008 16:18:21 +0200 Subject: libudev: fix --enable-debug --- TODO | 2 +- udev/lib/libudev-private.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index f960f2431b..d5633e1c6b 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,8 @@ + o add DVB variables to kernel, and drop shell script rule o handle spaces in SYMLINK+=, do not create multiple links o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator o rework rules to a match-action list, instead of a rules array - o add DVB variables to kernel, and drop shell script rule o add watershed extra o DEVTYPE for disks is set by the kernel, they will be removed from the default rules diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index a9ad2f86a9..b74e26c97e 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -27,7 +27,7 @@ static inline void __attribute__ ((format(printf, 2, 3))) log_null(struct udev *udev, const char *format, ...) {} #ifdef USE_LOG -# ifdef USE_DEBUG +# ifdef DEBUG # define dbg(udev, arg...) udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) # else # define dbg(udev, arg...) log_null(udev, ## arg) -- cgit v1.2.3-54-g00ecf From ff6c1cb139336915dd0d0a3092bc65cecc2bc75f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Oct 2008 17:27:21 +0200 Subject: don not print error if GOTO jumps just to next rule --- udev/udev_rules_parse.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c index 5a9552ffde..c42bd08c51 100644 --- a/udev/udev_rules_parse.c +++ b/udev/udev_rules_parse.c @@ -79,8 +79,8 @@ static size_t find_label(const struct udev_rules_iter *iter, const char *label) next: dbg(rules->udev, "current=%zi\n", current); if (current >= rules->bufsize) { - err(rules->udev, "LABEL='%s' not found, GOTO will be ignored\n", label); - return iter->current; + dbg(rules->udev, "LABEL='%s' not found\n", label); + return 0; } rule = (struct udev_rule *) (rules->buf + current); @@ -747,9 +747,10 @@ static int parse_file(struct udev_rules *rules, const char *filename) dbg(rules->udev, "resolving goto label '%s'\n", goto_label); rule->goto_rule_off = find_label(&iter, goto_label); - if (rule->goto_rule_off == iter.current) { - err(rules->udev, "goto nonexistent label '%s' in '%s'\n", + if (rule->goto_rule_off == 0) { + err(rules->udev, "ignore goto to nonexistent label '%s' in '%s'\n", goto_label, filename); + rule->goto_rule_off = iter.current; } } } -- cgit v1.2.3-54-g00ecf From 3cbc96e3be8e47a1a356f497a8c8a686ae829725 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 6 Oct 2008 12:17:47 +0200 Subject: volume_id: add more vfat debugging information --- extras/volume_id/lib/fat.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index e5a5cc1191..9d26a987e0 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -311,6 +311,7 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) return -1; magic: + info("magic found\n"); /* reserverd sector count */ if (!vs->reserved) return -1; @@ -333,6 +334,7 @@ magic: if (sector_size == 0 || ((sector_size & (sector_size-1)) != 0)) return -1; + info("checks passed\n"); dbg("sector_size 0x%x\n", sector_size); dbg("sectors_per_cluster 0x%x\n", vs->sectors_per_cluster); @@ -356,7 +358,7 @@ magic: fat_size = fat32_length * vs->fats; else return -1; - dbg("fat_size 0x%x\n", fat_size); + info("fat_size 0x%x\n", fat_size); dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + (sector_size-1)) / sector_size; @@ -364,7 +366,7 @@ magic: cluster_count = sect_count - (reserved + fat_size + dir_size); cluster_count /= vs->sectors_per_cluster; - dbg("cluster_count 0x%x\n", cluster_count); + info("cluster_count 0x%x\n", cluster_count); /* must be FAT32 */ if (!fat_length && fat32_length) @@ -408,16 +410,24 @@ magic: goto found; fat32: + info("looking for FAT32\n"); /* FAT32 should have a valid signature in the fsinfo block */ fsinfo_sect = le16_to_cpu(vs->type.fat32.fsinfo_sector); buf = volume_id_get_buffer(id, off + (fsinfo_sect * sector_size), 0x200); if (buf == NULL) return -1; fsinfo = (struct fat32_fsinfo *) buf; + info("signature1: 0x%02x%02x%02x%02x\n", + fsinfo->signature1[0], fsinfo->signature1[1], + fsinfo->signature1[2], fsinfo->signature1[3]); + info("signature2: 0x%02x%02x%02x%02x\n", + fsinfo->signature2[0], fsinfo->signature2[1], + fsinfo->signature2[2], fsinfo->signature2[3]); if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0) return -1; if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0) return -1 ; + info("FAT32 signatures match\n"); vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); if (vs == NULL) -- cgit v1.2.3-54-g00ecf From fa03f6ae4b76d7f4cbf61c328ffdd0265f7476c2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 6 Oct 2008 12:18:55 +0200 Subject: libudev: libudev.pc remove selinux --- udev/lib/libudev.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/lib/libudev.pc.in b/udev/lib/libudev.pc.in index 8437827d8a..38fc052e34 100644 --- a/udev/lib/libudev.pc.in +++ b/udev/lib/libudev.pc.in @@ -7,5 +7,5 @@ Name: libudev Description: Library to access udev device information Version: @VERSION@ Libs: -L${libdir} -ludev -Libs.private: @SELINUX_LIBS@ +Libs.private: Cflags: -I${includedir} -- cgit v1.2.3-54-g00ecf From 1e75cda3454d08ff880600f86d296a23bfa1f996 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 6 Oct 2008 13:52:43 +0200 Subject: store node name and symlinks into db symlink target if they are small enough --- udev/lib/libudev-device.c | 22 +++++++++ udev/udev_db.c | 118 ++++++++++++++++++++++++++++------------------ 2 files changed, 95 insertions(+), 45 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 8e4360a7f4..2113ebd43c 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -83,6 +83,7 @@ static int device_read_db(struct udev_device *udev_device) if ((stats.st_mode & S_IFMT) == S_IFLNK) { char target[UTIL_PATH_SIZE]; int target_len; + char *next; target_len = readlink(filename, target, sizeof(target)); if (target_len > 0) @@ -91,8 +92,29 @@ static int device_read_db(struct udev_device *udev_device) info(udev_device->udev, "error reading db link %s: %m\n", filename); return -1; } + + next = strchr(target, ' '); + if (next != NULL) { + next[0] = '\0'; + next = &next[1]; + } if (asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), target) < 0) return -ENOMEM; + while (next != NULL) { + char linkname[UTIL_PATH_SIZE]; + const char *lnk; + + lnk = next; + next = strchr(next, ' '); + if (next != NULL) { + next[0] = '\0'; + next = &next[1]; + } + util_strlcpy(linkname, udev_get_dev_path(udev_device->udev), sizeof(linkname)); + util_strlcat(linkname, "/", sizeof(linkname)); + util_strlcat(linkname, next, sizeof(linkname)); + device_add_devlink(udev_device, linkname); + } info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); return 0; } diff --git a/udev/udev_db.c b/udev/udev_db.c index 34bdef3753..e03c2782a3 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -127,6 +127,10 @@ int udev_db_rename(struct udev *udev, const char *devpath_old, const char *devpa int udev_db_add_device(struct udevice *udevice) { char filename[UTIL_PATH_SIZE]; + FILE *f; + struct name_entry *name_loop; + char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ + int ret; if (udevice->test_run) return 0; @@ -135,55 +139,61 @@ int udev_db_add_device(struct udevice *udevice) create_path(udevice->udev, filename); unlink(filename); - /* - * don't waste tmpfs memory pages, if we don't have any data to store - * create fake db-file; store the node-name in a symlink target - */ - if (list_empty(&udevice->symlink_list) && list_empty(&udevice->env_list) && - !udevice->partitions && !udevice->ignore_remove) { - int ret; - dbg(udevice->udev, "nothing interesting to store, create symlink\n"); - udev_selinux_setfscreatecon(udevice->udev, filename, S_IFLNK); - ret = symlink(udevice->name, filename); - udev_selinux_resetfscreatecon(udevice->udev); - if (ret != 0) { - err(udevice->udev, "unable to create db link '%s': %m\n", filename); - return -1; + if (!list_empty(&udevice->env_list)) + goto file; + if (udevice->partitions || udevice->ignore_remove) + goto file; + /* try not to waste tmpfs memory, store values, if they fit, in a symlink target */ + util_strlcpy(target, udevice->name, sizeof(target)); + list_for_each_entry(name_loop, &udevice->symlink_list, node) { + size_t len; + + util_strlcat(target, " ", sizeof(target)); + len = util_strlcat(target, name_loop->name, sizeof(target)); + if (len >= sizeof(target)) { + info(udevice->udev, "size of links too large, create file\n"); + goto file; } - } else { - FILE *f; - struct name_entry *name_loop; - - f = fopen(filename, "w"); - if (f == NULL) { - err(udevice->udev, "unable to create db file '%s': %m\n", filename); - return -1; + } + /* add symlink names to index */ + list_for_each_entry(name_loop, &udevice->symlink_list, node) { + name_index(udevice->udev, udevice->dev->devpath, name_loop->name, 1); + } + info(udevice->udev, "create db link (%s)\n", target); + udev_selinux_setfscreatecon(udevice->udev, filename, S_IFLNK); + ret = symlink(target, filename); + udev_selinux_resetfscreatecon(udevice->udev); + if (ret == 0) + goto out; +file: + f = fopen(filename, "w"); + if (f == NULL) { + err(udevice->udev, "unable to create db file '%s': %m\n", filename); + return -1; } - dbg(udevice->udev, "storing data for device '%s' in '%s'\n", udevice->dev->devpath, filename); + info(udevice->udev, "created db file for '%s' in '%s'\n", udevice->dev->devpath, filename); - fprintf(f, "N:%s\n", udevice->name); - list_for_each_entry(name_loop, &udevice->symlink_list, node) { - fprintf(f, "S:%s\n", name_loop->name); - /* add symlink-name to index */ - name_index(udevice->udev, udevice->dev->devpath, name_loop->name, 1); - } - fprintf(f, "M:%u:%u\n", major(udevice->devt), minor(udevice->devt)); - if (udevice->link_priority != 0) - fprintf(f, "L:%u\n", udevice->link_priority); - if (udevice->event_timeout >= 0) - fprintf(f, "T:%u\n", udevice->event_timeout); - if (udevice->partitions != 0) - fprintf(f, "A:%u\n", udevice->partitions); - if (udevice->ignore_remove) - fprintf(f, "R:%u\n", udevice->ignore_remove); - list_for_each_entry(name_loop, &udevice->env_list, node) - fprintf(f, "E:%s\n", name_loop->name); - fclose(f); + fprintf(f, "N:%s\n", udevice->name); + list_for_each_entry(name_loop, &udevice->symlink_list, node) { + fprintf(f, "S:%s\n", name_loop->name); + /* add symlink names to index */ + name_index(udevice->udev, udevice->dev->devpath, name_loop->name, 1); } - + fprintf(f, "M:%u:%u\n", major(udevice->devt), minor(udevice->devt)); + if (udevice->link_priority != 0) + fprintf(f, "L:%u\n", udevice->link_priority); + if (udevice->event_timeout >= 0) + fprintf(f, "T:%u\n", udevice->event_timeout); + if (udevice->partitions != 0) + fprintf(f, "A:%u\n", udevice->partitions); + if (udevice->ignore_remove) + fprintf(f, "R:%u\n", udevice->ignore_remove); + list_for_each_entry(name_loop, &udevice->env_list, node) + fprintf(f, "E:%s\n", name_loop->name); + fclose(f); +out: /* add name to index */ name_index(udevice->udev, udevice->dev->devpath, udevice->name, 1); - return 0; } @@ -209,8 +219,9 @@ int udev_db_get_device(struct udevice *udevice, const char *devpath) if ((stats.st_mode & S_IFMT) == S_IFLNK) { char target[UTIL_NAME_SIZE]; int target_len; + char *next; - info(udevice->udev, "found a symlink as db file\n"); + info(udevice->udev, "found db symlink\n"); target_len = readlink(filename, target, sizeof(target)); if (target_len > 0) target[target_len] = '\0'; @@ -218,8 +229,25 @@ int udev_db_get_device(struct udevice *udevice, const char *devpath) info(udevice->udev, "error reading db link %s: %m\n", filename); return -1; } - dbg(udevice->udev, "db link points to '%s'\n", target); + next = strchr(target, ' '); + if (next != NULL) { + next[0] = '\0'; + next = &next[1]; + } + info(udevice->udev, "got db link node: '%s'\n", target); util_strlcpy(udevice->name, target, sizeof(udevice->name)); + while (next != NULL) { + char *lnk; + + lnk = next; + next = strchr(next, ' '); + if (next != NULL) { + next[0] = '\0'; + next = &next[1]; + } + info(udevice->udev, "got db link link: '%s'\n", lnk); + name_list_add(udevice->udev, &udevice->symlink_list, lnk, 0); + } return 0; } -- cgit v1.2.3-54-g00ecf From 6a328058e099984cdf3f4408d770787083de7c1b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 6 Oct 2008 18:17:05 +0200 Subject: volume_id: more fat debugging --- extras/volume_id/lib/fat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 9d26a987e0..95735c2d2d 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -348,9 +348,9 @@ magic: dbg("sect_count 0x%x\n", sect_count); fat_length = le16_to_cpu(vs->fat_length); - dbg("fat_length 0x%x\n", fat_length); + info("fat_length 0x%x\n", fat_length); fat32_length = le32_to_cpu(vs->type.fat32.fat32_length); - dbg("fat32_length 0x%x\n", fat32_length); + info("fat32_length 0x%x\n", fat32_length); if (fat_length) fat_size = fat_length * vs->fats; @@ -362,7 +362,7 @@ magic: dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + (sector_size-1)) / sector_size; - dbg("dir_size 0x%x\n", dir_size); + info("dir_size 0x%x\n", dir_size); cluster_count = sect_count - (reserved + fat_size + dir_size); cluster_count /= vs->sectors_per_cluster; -- cgit v1.2.3-54-g00ecf From 31441f6a4b3a776fe56e98ef939ff8825355c285 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 6 Oct 2008 18:17:27 +0200 Subject: libudev: fix typo in "multiple entries in symlink" handling --- udev/lib/libudev-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 2113ebd43c..55fcad655e 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -112,7 +112,7 @@ static int device_read_db(struct udev_device *udev_device) } util_strlcpy(linkname, udev_get_dev_path(udev_device->udev), sizeof(linkname)); util_strlcat(linkname, "/", sizeof(linkname)); - util_strlcat(linkname, next, sizeof(linkname)); + util_strlcat(linkname, lnk, sizeof(linkname)); device_add_devlink(udev_device, linkname); } info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); -- cgit v1.2.3-54-g00ecf From 4df1d70329234fa10eceb02c8ecfff48e1ca9247 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Oct 2008 00:18:55 +0200 Subject: connect /sys and /dev with /sys/dev/{block,char}/: and /dev/{block,char}/: --- rules/rules.d/50-udev-default.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 6eeb541b4d..b41718c771 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -1,5 +1,8 @@ # do not edit this file, it will be overwritten on update +SUBSYSTEM=="block", SYMLINK+="block/%M:%m" +SUBSYSTEM!="block", SYMLINK+="char/%M:%m" + KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS+="last_rule" -- cgit v1.2.3-54-g00ecf From ee173c5927649e8f2e6f42046315e84eb8e55e1b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Oct 2008 00:41:00 +0200 Subject: replace spaces in dm and md name symlinks We create multiple symlinks for dm names with spaces, which isn't what we want. --- rules/packages/64-md-raid.rules | 4 ++-- rules/suse/64-device-mapper.rules | 2 +- udev/udev_rules.c | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/rules/packages/64-md-raid.rules b/rules/packages/64-md-raid.rules index 02a321093a..0e6a939c12 100644 --- a/rules/packages/64-md-raid.rules +++ b/rules/packages/64-md-raid.rules @@ -11,9 +11,9 @@ KERNEL!="md*", GOTO="md_end" ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" IMPORT{program}="/sbin/mdadm --detail --export $tempnode" -ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}" +ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace" ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" -ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n" +ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace" ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n" IMPORT{program}="vol_id --export $tempnode" diff --git a/rules/suse/64-device-mapper.rules b/rules/suse/64-device-mapper.rules index b065aec554..e0a63eee72 100644 --- a/rules/suse/64-device-mapper.rules +++ b/rules/suse/64-device-mapper.rules @@ -8,7 +8,7 @@ ACTION!="add|change", GOTO="device_mapper_end" IMPORT{program}="/sbin/dmsetup export -j%M -m%m" ENV{DM_NAME}!="?*", GOTO="device_mapper_end" -SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}" +SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}", OPTIONS+="string_escape=replace" ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}" ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end" diff --git a/udev/udev_rules.c b/udev/udev_rules.c index 9527f46e79..d06f536d1e 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -1447,7 +1447,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) rule->symlink.operation == KEY_OP_ADD)) { char temp[UTIL_PATH_SIZE]; char *pos, *next; - int count; + int count = 0; if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) udevice->symlink_final = 1; @@ -1459,12 +1459,12 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) /* allow multiple symlinks separated by spaces */ util_strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); udev_rules_apply_format(udevice, temp, sizeof(temp)); - if (rule->string_escape == ESCAPE_UNSET || - rule->string_escape == ESCAPE_REPLACE) { + if (rule->string_escape == ESCAPE_UNSET) count = util_replace_chars(temp, ALLOWED_CHARS_FILE " "); - if (count > 0) - info(udevice->udev, "%i character(s) replaced\n" , count); - } + else if (rule->string_escape == ESCAPE_REPLACE) + count = util_replace_chars(temp, ALLOWED_CHARS_FILE); + if (count > 0) + info(udevice->udev, "%i character(s) replaced\n" , count); dbg(udevice->udev, "rule applied, added symlink(s) '%s'\n", temp); pos = temp; while (isspace(pos[0])) -- cgit v1.2.3-54-g00ecf From ec06a8dd4f198f1ef9907e6e4d46ee3d8a882e7c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Oct 2008 14:32:33 +0200 Subject: release 130 --- ChangeLog | 32 ++++++++++++++++++++++++++++++++ NEWS | 7 +++++++ TODO | 1 - 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a7271c6636..b008f90fba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +Summary of changes from v129 to v130 +============================================ + +Kay Sievers (26): + fix compile error with --disable-logging + libudev: enumerate - add_device() -> add_syspath() + volume_id: hpfs - read label and uuid + use no_argument, required_argument, optional_argument in longopts + libudev: get rid of selinux + libudev: device - add get_parent_with_subsystem() + usb_id: use libudev + udevadm: info - fix --query=all for devices without a device node + vol_id: add size= option + move selinux noops to udev.h + volume_id: add dbg() as noop to check for compile errors + vol_id: fix logging glue + vol_id: always use the safe string versions for unencoded label and uuid + volume_id: better DDF raid detection + volume_id: add btrfs + volume_id: use PRIu64i, PRIx64 macros + udevd: clarify deprecated sysfs layout warning + libudev: fix --enable-debug + don not print error if GOTO jumps just to next rule + volume_id: add more vfat debugging information + libudev: libudev.pc remove selinux + store node name and symlinks into db symlink target if they are small enough + volume_id: more fat debugging + libudev: fix typo in "multiple entries in symlink" handling + connect /sys and /dev with /sys/dev/{block,char}/: and /dev/{block,char}/: + replace spaces in dm and md name symlinks + + Summary of changes from v128 to v129 ============================================ diff --git a/NEWS b/NEWS index 9fc1adaedd..35b57a3b4e 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ udev 130 ======== Bugfixes. +Kernel devices and device nodes are connected now by reverse indizes in +/sys and /dev. A device number retrieved by a stat() or similar, the +kernel device directory can be found by looking up: + /sys/dev/{block,char}/: +and the device node of the same device by looking up: + /dev/{block,char}/: + udev 129 ======== Fix recently introduced bug, which caused a compilation without large diff --git a/TODO b/TODO index d5633e1c6b..e1ef804319 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ o add DVB variables to kernel, and drop shell script rule - o handle spaces in SYMLINK+=, do not create multiple links o use libudev device in udev_rules.c get rid of udevice, store rule matching state in rule iterator o rework rules to a match-action list, instead of a rules array -- cgit v1.2.3-54-g00ecf From 5b3ff6ba3a4009d7520920f7e529dd85d7888ccf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Oct 2008 18:10:35 +0200 Subject: remove outdated docs/README-gcov_for_udev --- docs/README-gcov_for_udev | 68 ----------------------------------------------- 1 file changed, 68 deletions(-) delete mode 100644 docs/README-gcov_for_udev diff --git a/docs/README-gcov_for_udev b/docs/README-gcov_for_udev deleted file mode 100644 index 5acb53a27c..0000000000 --- a/docs/README-gcov_for_udev +++ /dev/null @@ -1,68 +0,0 @@ -################################################ - -Using GCC's code coverage tool, gcov, with udev - -Leann Ogasawara , April 2004 - -################################################ - -For more information on using gcov please see: - -http://gcc.gnu.org/onlinedocs/gcc/Gcov.html - -With that said, here is how to get code coverage analysis for udev files. -Note that this was developed with udev version 024. - -- Make sure you've installed udev and that it is working properly. - -- Build udev with: - make gcov-all - This will compile udev with gcov support. If you look into your udev directory - and see that it has been polluted with a bunch of *.gcno, *.gcda and *.gcov files. - gcov creates and uses these files to extract the code coverage info. - -- Then execute some udev tasks. You can run some udev tests, reboot, or - do anything your little udev heart desires. Once you are satisfied, you - can now see how much udev code was covered. I personally recommend just - running test/udev-test.pl for starters. - -- To get the udev code coverage analysis: - make udev_gcov.txt - -- This creates udev_gcov.txt in the udev top level directory which holds all - the code coverage information. To see an example of the code coverage info - after executing the udev-test.pl test, please see: - - http://developer.osdl.org/ogasawara/gcov_for_udev/udev_gcov.txt - -- Also, after having executed gcov on udev (ie executing run_gcov.sh) a - *.gcov file is created for every file which contained code that was - used. Looking at the *.gcov files, one will see what lines of code - were hit, and what lines were missed. For, example if code in udev-add.c - were executed, gcov then created a file called udev-add.c.gcov. And a - portion of udev-add.c.gov might look like: - - static int get_major_minor(struct sysfs_class_device *class_dev, struct udevice *udev) - 95 { - 95 struct sysfs_attribute *attr = NULL; - - 95 attr = sysfs_get_classdev_attr(class_dev, "dev"); - 95 if (attr == NULL) - ###### goto error; - dbg("dev='%s'", attr->value); - - 95 if (sscanf(attr->value, "%u:%u", &udev->major, &udev->minor) != 2) - ###### goto error; - dbg("found major=%d, minor=%d", udev->major, udev->minor); - - 95 return 0; - error: - ###### return -1; - } - - Any line of code that is preceded by a "######" implies that the code - was never hit during execution. - -- Once you are done with using gcov for udev and want to return to your - normal use of udev, run a regular 'make clean' on your udev directory. - Then just run a regular make and make install and you are back to normal. -- cgit v1.2.3-54-g00ecf From 90d80c2efcf63c69c05e4788b993f688302b02a4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Oct 2008 20:20:34 +0200 Subject: libudev: device - add device lookup by subsystem:sysname --- udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 88 ++++++++++++++++++++++++++++++ udev/lib/libudev.h | 1 + udev/lib/test-libudev.c | 136 ++++++++++++++++++++++++++++++---------------- 4 files changed, 179 insertions(+), 47 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 2574d13e67..8e0be1ab8d 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -14,6 +14,7 @@ udev_list_entry_get_name udev_list_entry_get_value udev_device_new_from_syspath udev_device_new_from_devnum +udev_device_new_from_subsystem_sysname udev_device_get_parent udev_device_get_parent_with_subsystem udev_device_ref diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 55fcad655e..0cb992c9ea 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -381,6 +381,94 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de return device; } +struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) +{ + size_t sys_path_len; + char path_full[UTIL_PATH_SIZE]; + char *path; + struct stat statbuf; + + sys_path_len = util_strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); + path = &path_full[sys_path_len]; + + if (strcmp(subsystem, "subsystem") == 0) { + util_strlcpy(path, "/subsystem/", sizeof(path_full) - sys_path_len); + util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strlcpy(path, "/bus/", sizeof(path_full) - sys_path_len); + util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strlcpy(path, "/class/", sizeof(path_full) - sys_path_len); + util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "module") == 0) { + util_strlcpy(path, "/module/", sizeof(path_full) - sys_path_len); + util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "drivers") == 0) { + char subsys[UTIL_NAME_SIZE]; + char *driver; + + util_strlcpy(subsys, sysname, sizeof(subsys)); + driver = strchr(subsys, ':'); + if (driver != NULL) { + driver[0] = '\0'; + driver = &driver[1]; + util_strlcpy(path, "/subsystem/", sizeof(path_full) - sys_path_len); + util_strlcat(path, subsys, sizeof(path_full) - sys_path_len); + util_strlcat(path, "/drivers/", sizeof(path_full) - sys_path_len); + util_strlcat(path, driver, sizeof(path_full) - sys_path_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strlcpy(path, "/bus/", sizeof(path_full) - sys_path_len); + util_strlcat(path, subsys, sizeof(path_full) - sys_path_len); + util_strlcat(path, "/drivers/", sizeof(path_full) - sys_path_len); + util_strlcat(path, driver, sizeof(path_full) - sys_path_len); + if (stat(path_full, &statbuf) == 0) + goto found; + } + goto out; + } + + util_strlcpy(path, "/subsystem/", sizeof(path_full) - sys_path_len); + util_strlcat(path, subsystem, sizeof(path_full) - sys_path_len); + util_strlcat(path, "/devices/", sizeof(path_full) - sys_path_len); + util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strlcpy(path, "/bus/", sizeof(path_full) - sys_path_len); + util_strlcat(path, subsystem, sizeof(path_full) - sys_path_len); + util_strlcat(path, "/devices/", sizeof(path_full) - sys_path_len); + util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strlcpy(path, "/class/", sizeof(path_full) - sys_path_len); + util_strlcat(path, subsystem, sizeof(path_full) - sys_path_len); + util_strlcat(path, "/", sizeof(path_full) - sys_path_len); + util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + if (stat(path_full, &statbuf) == 0) + goto found; +out: + return NULL; +found: + return udev_device_new_from_syspath(udev, path_full); +} + static struct udev_device *device_new_from_parent(struct udev_device *udev_device) { struct udev_device *udev_device_parent = NULL; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index fabe59d7d7..3f4cccf8c3 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -59,6 +59,7 @@ extern const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) struct udev_device; extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); +extern struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); extern struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 854a0a9faa..65d84159ce 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -154,6 +154,40 @@ static int test_device_devnum(struct udev *udev) return 0; } +static int test_device_subsys_name(struct udev *udev) +{ + struct udev_device *device; + + printf("looking up device: 'block':'sda'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "block", "sda"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'subsystem':'pci'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "subsystem", "pci"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'drivers':'scsi:sd'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "drivers", "scsi:sd"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'module':'printk'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "module", "printk"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + return 0; +} + static int test_enumerate_print_list(struct udev_enumerate *enumerate) { struct udev_list_entry *list_entry; @@ -269,7 +303,59 @@ static int test_queue(struct udev *udev) return 0; } -int main(int argc, char *argv[], char *envp[]) +static int test_enumerate(struct udev *udev, const char *subsystem) +{ + struct udev_enumerate *udev_enumerate; + + printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'block'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate,"block"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'not block'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'pci, mem, vc'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, "pci"); + udev_enumerate_add_match_subsystem(udev_enumerate, "mem"); + udev_enumerate_add_match_subsystem(udev_enumerate, "vc"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'subsystem'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_subsystems(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + return 0; +} + +int main(int argc, char *argv[]) { struct udev *udev = NULL; static const struct option options[] = { @@ -281,7 +367,6 @@ int main(int argc, char *argv[], char *envp[]) { "version", no_argument, NULL, 'V' }, {} }; - struct udev_enumerate *udev_enumerate; const char *syspath = "/devices/virtual/mem/null"; const char *subsystem = NULL; const char *socket = "@/org/kernel/udev/monitor"; @@ -342,53 +427,10 @@ int main(int argc, char *argv[], char *envp[]) test_device(udev, syspath); test_device_devnum(udev); + test_device_subsys_name(udev); test_device_parents(udev, syspath); - printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'block'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate,"block"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'not block'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'pci, mem, vc'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, "pci"); - udev_enumerate_add_match_subsystem(udev_enumerate, "mem"); - udev_enumerate_add_match_subsystem(udev_enumerate, "vc"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'subsystem'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_subsystems(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); + test_enumerate(udev, subsystem); test_queue(udev); -- cgit v1.2.3-54-g00ecf From 8cd2e972e537a351f0948e7762d2d2e51ad358ef Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 9 Oct 2008 22:24:43 +0200 Subject: libudev: also prefix non-exported functions with udev_* --- udev/lib/libudev-device.c | 103 ++++++++++++++++++++++--------------------- udev/lib/libudev-enumerate.c | 70 ++++++++++++++--------------- udev/lib/libudev-list.c | 48 ++++++++++---------- udev/lib/libudev-monitor.c | 28 ++++++------ udev/lib/libudev-private.h | 88 ++++++++++++++++++------------------ udev/lib/libudev-queue.c | 40 ++++++++--------- 6 files changed, 189 insertions(+), 188 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 0cb992c9ea..62f3518839 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -39,8 +39,8 @@ struct udev_device { const char *sysname; char *devnode; char *subsystem; - struct list_node devlink_list; - struct list_node properties_list; + struct udev_list_node devlink_list; + struct udev_list_node properties_list; char *action; int event_timeout; char *driver; @@ -52,7 +52,7 @@ struct udev_device { int num_fake_partitions; int devlink_priority; int ignore_remove; - struct list_node attr_list; + struct udev_list_node attr_list; int info_loaded; }; @@ -113,7 +113,7 @@ static int device_read_db(struct udev_device *udev_device) util_strlcpy(linkname, udev_get_dev_path(udev_device->udev), sizeof(linkname)); util_strlcat(linkname, "/", sizeof(linkname)); util_strlcat(linkname, lnk, sizeof(linkname)); - device_add_devlink(udev_device, linkname); + udev_device_add_devlink(udev_device, linkname); } info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); return 0; @@ -142,22 +142,22 @@ static int device_read_db(struct udev_device *udev_device) util_strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); util_strlcat(filename, "/", sizeof(filename)); util_strlcat(filename, val, sizeof(filename)); - device_add_devlink(udev_device, filename); + udev_device_add_devlink(udev_device, filename); break; case 'L': - device_set_devlink_priority(udev_device, atoi(val)); + udev_device_set_devlink_priority(udev_device, atoi(val)); break; case 'T': - device_set_event_timeout(udev_device, atoi(val)); + udev_device_set_event_timeout(udev_device, atoi(val)); break; case 'A': - device_set_num_fake_partitions(udev_device, atoi(val)); + udev_device_set_num_fake_partitions(udev_device, atoi(val)); break; case 'R': - device_set_ignore_remove(udev_device, atoi(val)); + udev_device_set_ignore_remove(udev_device, atoi(val)); break; case 'E': - device_add_property_from_string(udev_device, val); + udev_device_add_property_from_string(udev_device, val); break; } } @@ -194,7 +194,7 @@ static int device_read_uevent_file(struct udev_device *udev_device) else if (strncmp(line, "MINOR=", 6) == 0) min = strtoull(&line[6], NULL, 10); - device_add_property_from_string(udev_device, line); + udev_device_add_property_from_string(udev_device, line); } udev_device->devnum = makedev(maj, min); @@ -210,7 +210,7 @@ static void device_load_info(struct udev_device *device) device->info_loaded = 1; } -void device_set_info_loaded(struct udev_device *device) +void udev_device_set_info_loaded(struct udev_device *device) { device->info_loaded = 1; } @@ -228,9 +228,9 @@ struct udev_device *device_new(struct udev *udev) memset(udev_device, 0x00, sizeof(struct udev_device)); udev_device->refcount = 1; udev_device->udev = udev; - list_init(&udev_device->devlink_list); - list_init(&udev_device->properties_list); - list_init(&udev_device->attr_list); + udev_list_init(&udev_device->devlink_list); + udev_list_init(&udev_device->properties_list); + udev_list_init(&udev_device->attr_list); info(udev_device->udev, "udev_device: %p created\n", udev_device); return udev_device; } @@ -324,7 +324,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * if (udev_device == NULL) return NULL; - device_set_syspath(udev_device, path); + udev_device_set_syspath(udev_device, path); info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); return udev_device; @@ -581,13 +581,13 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->syspath); free(udev_device->devnode); free(udev_device->subsystem); - list_cleanup(udev_device->udev, &udev_device->devlink_list); - list_cleanup(udev_device->udev, &udev_device->properties_list); + udev_list_cleanup(udev_device->udev, &udev_device->devlink_list); + udev_list_cleanup(udev_device->udev, &udev_device->properties_list); free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); free(udev_device->physdevpath); - list_cleanup(udev_device->udev, &udev_device->attr_list); + udev_list_cleanup(udev_device->udev, &udev_device->attr_list); info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } @@ -710,7 +710,7 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device * return NULL; if (!udev_device->info_loaded) device_load_info(udev_device); - return list_get_entry(&udev_device->devlink_list); + return udev_list_get_entry(&udev_device->devlink_list); } /** @@ -731,7 +731,7 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device return NULL; if (!udev_device->info_loaded) device_load_info(udev_device); - return list_get_entry(&udev_device->properties_list); + return udev_list_get_entry(&udev_device->properties_list); } const char *udev_device_get_driver(struct udev_device *udev_device) @@ -782,7 +782,7 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch const char *val = NULL; /* look for possibly already cached result */ - udev_list_entry_foreach(list_entry, list_get_entry(&udev_device->attr_list)) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->attr_list)) { if (strcmp(udev_list_entry_get_name(list_entry), attr) == 0) { info(udev_device->udev, "got '%s' (%s) from cache\n", attr, udev_list_entry_get_value(list_entry)); return udev_list_entry_get_value(list_entry); @@ -811,7 +811,7 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch if (pos != NULL) { pos = &pos[1]; info(udev_device->udev, "cache '%s' with link value '%s'\n", attr, pos); - list_entry = list_entry_add(udev_device->udev, &udev_device->attr_list, attr, pos, 0, 0); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->attr_list, attr, pos, 0, 0); val = udev_list_entry_get_value(list_entry); } } @@ -843,15 +843,16 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch value[size] = '\0'; util_remove_trailing_chars(value, '\n'); info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = list_entry_add(udev_device->udev, &udev_device->attr_list, attr, value, 0, 0); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->attr_list, attr, value, 0, 0); val = udev_list_entry_get_value(list_entry); out: return val; } -int device_set_syspath(struct udev_device *udev_device, const char *syspath) +int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) { const char *pos; + free(udev_device->syspath); udev_device->syspath = strdup(syspath); if (udev_device->syspath == NULL) return -ENOMEM; @@ -863,7 +864,7 @@ int device_set_syspath(struct udev_device *udev_device, const char *syspath) return 0; } -int device_set_subsystem(struct udev_device *udev_device, const char *subsystem) +int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) { udev_device->subsystem = strdup(subsystem); if (udev_device->subsystem == NULL) @@ -871,7 +872,7 @@ int device_set_subsystem(struct udev_device *udev_device, const char *subsystem) return 0; } -int device_set_devnode(struct udev_device *udev_device, const char *devnode) +int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) { udev_device->devnode = strdup(devnode); if (udev_device->devnode == NULL) @@ -879,21 +880,21 @@ int device_set_devnode(struct udev_device *udev_device, const char *devnode) return 0; } -int device_add_devlink(struct udev_device *udev_device, const char *devlink) +int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink) { - if (list_entry_add(udev_device->udev, &udev_device->devlink_list, devlink, NULL, 1, 0) == NULL) + if (udev_list_entry_add(udev_device->udev, &udev_device->devlink_list, devlink, NULL, 1, 0) == NULL) return -ENOMEM; return 0; } -int device_add_property(struct udev_device *udev_device, const char *key, const char *value) +int udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { - if (list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0) == NULL) + if (udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0) == NULL) return -ENOMEM; return 0; } -int device_add_property_from_string(struct udev_device *udev_device, const char *property) +int udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) { char name[UTIL_PATH_SIZE]; char *val; @@ -906,11 +907,11 @@ int device_add_property_from_string(struct udev_device *udev_device, const char val = &val[1]; if (val[0] == '\0') val = NULL; - device_add_property(udev_device, name, val); + udev_device_add_property(udev_device, name, val); return 0; } -int device_set_action(struct udev_device *udev_device, const char *action) +int udev_device_set_action(struct udev_device *udev_device, const char *action) { udev_device->action = strdup(action); if (udev_device->action == NULL) @@ -918,7 +919,7 @@ int device_set_action(struct udev_device *udev_device, const char *action) return 0; } -int device_set_driver(struct udev_device *udev_device, const char *driver) +int udev_device_set_driver(struct udev_device *udev_device, const char *driver) { udev_device->driver = strdup(driver); if (udev_device->driver == NULL) @@ -926,12 +927,12 @@ int device_set_driver(struct udev_device *udev_device, const char *driver) return 0; } -const char *device_get_devpath_old(struct udev_device *udev_device) +const char *udev_device_get_devpath_old(struct udev_device *udev_device) { return udev_device->devpath_old; } -int device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) +int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) { udev_device->devpath_old = strdup(devpath_old); if (udev_device->devpath_old == NULL) @@ -939,12 +940,12 @@ int device_set_devpath_old(struct udev_device *udev_device, const char *devpath_ return 0; } -const char *device_get_physdevpath(struct udev_device *udev_device) +const char *udev_device_get_physdevpath(struct udev_device *udev_device) { return udev_device->physdevpath; } -int device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath) +int udev_device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath) { udev_device->physdevpath = strdup(physdevpath); if (udev_device->physdevpath == NULL) @@ -952,75 +953,75 @@ int device_set_physdevpath(struct udev_device *udev_device, const char *physdevp return 0; } -int device_get_timeout(struct udev_device *udev_device) +int udev_device_get_timeout(struct udev_device *udev_device) { return udev_device->timeout; } -int device_set_timeout(struct udev_device *udev_device, int timeout) +int udev_device_set_timeout(struct udev_device *udev_device, int timeout) { udev_device->timeout = timeout; return 0; } -int device_get_event_timeout(struct udev_device *udev_device) +int udev_device_get_event_timeout(struct udev_device *udev_device) { if (!udev_device->info_loaded) device_load_info(udev_device); return udev_device->event_timeout; } -int device_set_event_timeout(struct udev_device *udev_device, int event_timeout) +int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout) { udev_device->event_timeout = event_timeout; return 0; } -int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) +int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) { udev_device->seqnum = seqnum; return 0; } -int device_set_devnum(struct udev_device *udev_device, dev_t devnum) +int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) { udev_device->devnum = devnum; return 0; } -int device_get_num_fake_partitions(struct udev_device *udev_device) +int udev_device_get_num_fake_partitions(struct udev_device *udev_device) { if (!udev_device->info_loaded) device_load_info(udev_device); return udev_device->num_fake_partitions; } -int device_set_num_fake_partitions(struct udev_device *udev_device, int num) +int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num) { udev_device->num_fake_partitions = num; return 0; } -int device_get_devlink_priority(struct udev_device *udev_device) +int udev_device_get_devlink_priority(struct udev_device *udev_device) { if (!udev_device->info_loaded) device_load_info(udev_device); return udev_device->devlink_priority; } -int device_set_devlink_priority(struct udev_device *udev_device, int prio) +int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) { udev_device->devlink_priority = prio; return 0; } -int device_get_ignore_remove(struct udev_device *udev_device) +int udev_device_get_ignore_remove(struct udev_device *udev_device) { if (!udev_device->info_loaded) device_load_info(udev_device); return udev_device->ignore_remove; } -int device_set_ignore_remove(struct udev_device *udev_device, int ignore) +int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore) { udev_device->ignore_remove = ignore; return 0; diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 9fb154418d..fab9c4d88d 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -35,11 +35,11 @@ static int devices_sort(struct udev_enumerate *udev_enumerate); struct udev_enumerate { struct udev *udev; int refcount; - struct list_node attr_match_list; - struct list_node attr_nomatch_list; - struct list_node subsystem_match_list; - struct list_node subsystem_nomatch_list; - struct list_node devices_list; + struct udev_list_node attr_match_list; + struct udev_list_node attr_nomatch_list; + struct udev_list_node subsystem_match_list; + struct udev_list_node subsystem_nomatch_list; + struct udev_list_node devices_list; int devices_sorted; }; @@ -59,11 +59,11 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) memset(udev_enumerate, 0x00, (sizeof(struct udev_enumerate))); udev_enumerate->refcount = 1; udev_enumerate->udev = udev; - list_init(&udev_enumerate->devices_list); - list_init(&udev_enumerate->attr_match_list); - list_init(&udev_enumerate->attr_nomatch_list); - list_init(&udev_enumerate->subsystem_match_list); - list_init(&udev_enumerate->subsystem_nomatch_list); + udev_list_init(&udev_enumerate->devices_list); + udev_list_init(&udev_enumerate->attr_match_list); + udev_list_init(&udev_enumerate->attr_nomatch_list); + udev_list_init(&udev_enumerate->subsystem_match_list); + udev_list_init(&udev_enumerate->subsystem_nomatch_list); return udev_enumerate; } @@ -82,11 +82,11 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) udev_enumerate->refcount--; if (udev_enumerate->refcount > 0) return; - list_cleanup(udev_enumerate->udev, &udev_enumerate->devices_list); - list_cleanup(udev_enumerate->udev, &udev_enumerate->attr_match_list); - list_cleanup(udev_enumerate->udev, &udev_enumerate->attr_nomatch_list); - list_cleanup(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); - list_cleanup(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); + udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->devices_list); + udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->attr_match_list); + udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->attr_nomatch_list); + udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); + udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); free(udev_enumerate); } @@ -103,7 +103,7 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude return NULL; if (!udev_enumerate->devices_sorted) devices_sort(udev_enumerate); - return list_get_entry(&udev_enumerate->devices_list); + return udev_list_get_entry(&udev_enumerate->devices_list); } int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) @@ -112,8 +112,8 @@ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, co return -EINVAL; if (subsystem == NULL) return 0; - if (list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_match_list, subsystem, NULL, 1, 0) == NULL) + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->subsystem_match_list, subsystem, NULL, 1, 0) == NULL) return -ENOMEM; return 0; } @@ -124,8 +124,8 @@ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, return -EINVAL; if (subsystem == NULL) return 0; - if (list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_nomatch_list, subsystem, NULL, 1, 0) == NULL) + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->subsystem_nomatch_list, subsystem, NULL, 1, 0) == NULL) return -ENOMEM; return 0; } @@ -136,7 +136,7 @@ int udev_enumerate_add_match_attr(struct udev_enumerate *udev_enumerate, const c return -EINVAL; if (attr == NULL) return 0; - if (list_entry_add(udev_enumerate_get_udev(udev_enumerate), + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), &udev_enumerate->attr_match_list, attr, value, 1, 0) == NULL) return -ENOMEM; return 0; @@ -148,7 +148,7 @@ int udev_enumerate_add_nomatch_attr(struct udev_enumerate *udev_enumerate, const return -EINVAL; if (attr == NULL) return 0; - if (list_entry_add(udev_enumerate_get_udev(udev_enumerate), + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), &udev_enumerate->attr_nomatch_list, attr, value, 1, 0) == NULL) return -ENOMEM; return 0; @@ -185,15 +185,15 @@ static int match_attr(struct udev_enumerate *udev_enumerate, const char *syspath struct udev_list_entry *list_entry; /* skip list */ - udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->attr_nomatch_list)) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->attr_nomatch_list)) { if (match_attr_value(udev, syspath, udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry))) return 0; } /* include list */ - if (list_get_entry(&udev_enumerate->attr_match_list) != NULL) { - udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->attr_match_list)) { + if (udev_list_get_entry(&udev_enumerate->attr_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->attr_match_list)) { /* anything that does not match, will make it FALSE */ if (!match_attr_value(udev, syspath, udev_list_entry_get_name(list_entry), @@ -249,7 +249,7 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, continue; if (!match_attr(udev_enumerate, syspath)) continue; - list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); + udev_list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); } closedir(dir); return 0; @@ -259,12 +259,12 @@ static int match_subsystem(struct udev_enumerate *udev_enumerate, const char *su { struct udev_list_entry *list_entry; - udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) return 0; } - if (list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { - udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->subsystem_match_list)) { + if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) { if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) return 1; } @@ -323,9 +323,9 @@ static int devices_sort(struct udev_enumerate *udev_enumerate) { struct udev_list_entry *list_entry; - udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->devices_list)) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->devices_list)) { if (devices_delay(udev_enumerate->udev, udev_list_entry_get_name(list_entry))) - list_entry_move_to_end(list_entry); + udev_list_entry_move_to_end(list_entry); } udev_enumerate->devices_sorted = 1; return 0; @@ -344,8 +344,8 @@ int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char udev_device = udev_device_new_from_syspath(udev_enumerate->udev, syspath); if (udev_device == NULL) return -EINVAL; - list_entry_add(udev, &udev_enumerate->devices_list, - udev_device_get_syspath(udev_device), NULL, 1, 1); + udev_list_entry_add(udev, &udev_enumerate->devices_list, + udev_device_get_syspath(udev_device), NULL, 1, 1); udev_device_unref(udev_device); return 0; } @@ -391,9 +391,9 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) } } /* sort delayed devices to the end of the list */ - udev_list_entry_foreach(list_entry, list_get_entry(&udev_enumerate->devices_list)) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->devices_list)) { if (devices_delay(udev, udev_list_entry_get_name(list_entry))) - list_entry_move_to_end(list_entry); + udev_list_entry_move_to_end(list_entry); } return 0; } diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index 00e3b7c37d..4849d46943 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -29,27 +29,27 @@ struct udev_list_entry { struct udev *udev; - struct list_node node; - struct list_node *list; + struct udev_list_node node; + struct udev_list_node *list; char *name; char *value; }; /* list head point to itself if empty */ -void list_init(struct list_node *list) +void udev_list_init(struct udev_list_node *list) { list->next = list; list->prev = list; } -static int list_is_empty(struct list_node *list) +static int list_is_empty(struct udev_list_node *list) { return list->next == list; } -static void list_node_insert_between(struct list_node *new, - struct list_node *prev, - struct list_node *next) +static void list_node_insert_between(struct udev_list_node *new, + struct udev_list_node *prev, + struct udev_list_node *next) { next->prev = new; new->next = next; @@ -57,10 +57,10 @@ static void list_node_insert_between(struct list_node *new, prev->next = new; } -static void list_node_remove(struct list_node *entry) +static void list_node_remove(struct udev_list_node *entry) { - struct list_node *prev = entry->prev; - struct list_node *next = entry->next; + struct udev_list_node *prev = entry->prev; + struct udev_list_node *next = entry->next; next->prev = prev; prev->next = next; @@ -70,7 +70,7 @@ static void list_node_remove(struct list_node *entry) } /* return list entry which embeds this node */ -static struct udev_list_entry *list_node_to_entry(struct list_node *node) +static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) { char *list; @@ -80,7 +80,7 @@ static struct udev_list_entry *list_node_to_entry(struct list_node *node) } /* insert entry into a list as the last element */ -static void list_entry_append(struct udev_list_entry *new, struct list_node *list) +static void list_entry_append(struct udev_list_entry *new, struct udev_list_node *list) { /* inserting before the list head make the node the last node in the list */ list_node_insert_between(&new->node, list->prev, list); @@ -94,21 +94,21 @@ static void list_entry_insert_before(struct udev_list_entry *new, struct udev_li new->list = entry->list; } -void list_entry_remove(struct udev_list_entry *entry) +void udev_list_entry_remove(struct udev_list_entry *entry) { list_node_remove(&entry->node); entry->list = NULL; } -struct udev_list_entry *list_entry_add(struct udev *udev, struct list_node *list, - const char *name, const char *value, - int unique, int sort) +struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, + const char *name, const char *value, + int unique, int sort) { struct udev_list_entry *entry_loop = NULL; struct udev_list_entry *entry_new; if (unique) - udev_list_entry_foreach(entry_loop, list_get_entry(list)) { + udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { if (strcmp(entry_loop->name, name) == 0) { info(udev, "'%s' is already in the list\n", name); if (value != NULL) { @@ -123,7 +123,7 @@ struct udev_list_entry *list_entry_add(struct udev *udev, struct list_node *list } if (sort) - udev_list_entry_foreach(entry_loop, list_get_entry(list)) { + udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { if (strcmp(entry_loop->name, name) > 0) break; } @@ -153,26 +153,26 @@ struct udev_list_entry *list_entry_add(struct udev *udev, struct list_node *list return entry_new; } -void list_entry_move_to_end(struct udev_list_entry *list_entry) +void udev_list_entry_move_to_end(struct udev_list_entry *list_entry) { list_node_remove(&list_entry->node); list_node_insert_between(&list_entry->node, list_entry->list->prev, list_entry->list); } -void list_cleanup(struct udev *udev, struct list_node *list) +void udev_list_cleanup(struct udev *udev, struct udev_list_node *list) { struct udev_list_entry *entry_loop; struct udev_list_entry *entry_tmp; - list_entry_foreach_safe(entry_loop, entry_tmp, list_get_entry(list)) { - list_entry_remove(entry_loop); + list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) { + udev_list_entry_remove(entry_loop); free(entry_loop->name); free(entry_loop->value); free(entry_loop); } } -struct udev_list_entry *list_get_entry(struct list_node *list) +struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) { if (list_is_empty(list)) return NULL; @@ -181,7 +181,7 @@ struct udev_list_entry *list_get_entry(struct list_node *list) struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) { - struct list_node *next; + struct udev_list_node *next; if (list_entry == NULL) return NULL; diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 751f19ae92..fc87cba4ab 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -304,46 +304,46 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito util_strlcpy(path, udev_get_sys_path(udev_monitor->udev), sizeof(path)); util_strlcat(path, &key[8], sizeof(path)); - device_set_syspath(udev_device, path); + udev_device_set_syspath(udev_device, path); } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { - device_set_subsystem(udev_device, &key[10]); + udev_device_set_subsystem(udev_device, &key[10]); } else if (strncmp(key, "DEVNAME=", 8) == 0) { - device_set_devnode(udev_device, &key[8]); + udev_device_set_devnode(udev_device, &key[8]); } else if (strncmp(key, "DEVLINKS=", 9) == 0) { char *slink = &key[9]; char *next = strchr(slink, ' '); while (next != NULL) { next[0] = '\0'; - device_add_devlink(udev_device, slink); + udev_device_add_devlink(udev_device, slink); slink = &next[1]; next = strchr(slink, ' '); } if (slink[0] != '\0') - device_add_devlink(udev_device, slink); + udev_device_add_devlink(udev_device, slink); } else if (strncmp(key, "DRIVER=", 7) == 0) { - device_set_driver(udev_device, &key[7]); + udev_device_set_driver(udev_device, &key[7]); } else if (strncmp(key, "ACTION=", 7) == 0) { - device_set_action(udev_device, &key[7]); + udev_device_set_action(udev_device, &key[7]); } else if (strncmp(key, "MAJOR=", 6) == 0) { maj = strtoull(&key[6], NULL, 10); } else if (strncmp(key, "MINOR=", 6) == 0) { min = strtoull(&key[6], NULL, 10); } else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) { - device_set_devpath_old(udev_device, &key[12]); + udev_device_set_devpath_old(udev_device, &key[12]); } else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) { - device_set_physdevpath(udev_device, &key[12]); + udev_device_set_physdevpath(udev_device, &key[12]); } else if (strncmp(key, "SEQNUM=", 7) == 0) { - device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10)); + udev_device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10)); } else if (strncmp(key, "TIMEOUT=", 8) == 0) { - device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); + udev_device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); } if (strncmp(key, "PHYSDEV", 7) == 0) continue; - device_add_property_from_string(udev_device, key); + udev_device_add_property_from_string(udev_device, key); } - device_set_devnum(udev_device, makedev(maj, min)); + udev_device_set_devnum(udev_device, makedev(maj, min)); - device_set_info_loaded(udev_device); + udev_device_set_info_loaded(udev_device); return udev_device; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index b74e26c97e..1ba0220310 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -24,20 +24,20 @@ #include "libudev.h" static inline void __attribute__ ((format(printf, 2, 3))) -log_null(struct udev *udev, const char *format, ...) {} +udev_log_null(struct udev *udev, const char *format, ...) {} #ifdef USE_LOG # ifdef DEBUG # define dbg(udev, arg...) udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) # else -# define dbg(udev, arg...) log_null(udev, ## arg) +# define dbg(udev, arg...) udev_log_null(udev, ## arg) # endif # define info(udev, arg...) udev_log(udev, LOG_INFO, __FILE__, __LINE__, __FUNCTION__, ## arg) # define err(udev, arg...) udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) #else -# define dbg(udev, arg...) log_null(udev, ## arg) -# define info(udev, arg...) log_null(udev, ## arg) -# define err(udev, arg...) log_null(udev, ## arg) +# define dbg(udev, arg...) udev_log_null(udev, ## arg) +# define info(udev, arg...) udev_log_null(udev, ## arg) +# define err(udev, arg...) udev_log_null(udev, ## arg) #endif /* libudev */ @@ -50,31 +50,31 @@ extern const char *udev_get_rules_path(struct udev *udev); extern int udev_get_run(struct udev *udev); /* libudev-device */ -extern int device_set_syspath(struct udev_device *udev_device, const char *syspath); -extern int device_set_subsystem(struct udev_device *udev_device, const char *subsystem); -extern int device_set_devnode(struct udev_device *udev_device, const char *devnode); -extern int device_add_devlink(struct udev_device *udev_device, const char *devlink); -extern int device_add_property(struct udev_device *udev_device, const char *key, const char *value); -extern int device_add_property_from_string(struct udev_device *udev_device, const char *property); -extern int device_set_action(struct udev_device *udev_device, const char *action); -extern int device_set_driver(struct udev_device *udev_device, const char *driver); -extern const char *device_get_devpath_old(struct udev_device *udev_device); -extern int device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); -extern const char *device_get_physdevpath(struct udev_device *udev_device); -extern int device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath); -extern int device_get_timeout(struct udev_device *udev_device); -extern int device_set_timeout(struct udev_device *udev_device, int timeout); -extern int device_get_event_timeout(struct udev_device *udev_device); -extern int device_set_event_timeout(struct udev_device *udev_device, int event_timeout); -extern int device_set_devnum(struct udev_device *udev_device, dev_t devnum); -extern int device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); -extern int device_get_num_fake_partitions(struct udev_device *udev_device); -extern int device_set_num_fake_partitions(struct udev_device *udev_device, int num); -extern int device_get_devlink_priority(struct udev_device *udev_device); -extern int device_set_devlink_priority(struct udev_device *udev_device, int prio); -extern int device_get_ignore_remove(struct udev_device *udev_device); -extern int device_set_ignore_remove(struct udev_device *udev_device, int ignore); -extern void device_set_info_loaded(struct udev_device *device); +extern int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); +extern int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); +extern int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); +extern int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink); +extern int udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); +extern int udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); +extern int udev_device_set_action(struct udev_device *udev_device, const char *action); +extern int udev_device_set_driver(struct udev_device *udev_device, const char *driver); +extern const char *udev_device_get_devpath_old(struct udev_device *udev_device); +extern int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); +extern const char *udev_device_get_physdevpath(struct udev_device *udev_device); +extern int udev_device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath); +extern int udev_device_get_timeout(struct udev_device *udev_device); +extern int udev_device_set_timeout(struct udev_device *udev_device, int timeout); +extern int udev_device_get_event_timeout(struct udev_device *udev_device); +extern int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout); +extern int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); +extern int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); +extern int udev_device_get_num_fake_partitions(struct udev_device *udev_device); +extern int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num); +extern int udev_device_get_devlink_priority(struct udev_device *udev_device); +extern int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); +extern int udev_device_get_ignore_remove(struct udev_device *udev_device); +extern int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore); +extern void udev_device_set_info_loaded(struct udev_device *device); /* libudev-ctrl - daemon runtime setup */ struct udev_ctrl; @@ -103,17 +103,17 @@ extern const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); /* libudev-list */ -struct list_node { - struct list_node *next, *prev; +struct udev_list_node { + struct udev_list_node *next, *prev; }; -extern void list_init(struct list_node *list); -extern void list_cleanup(struct udev *udev, struct list_node *name_list); -extern struct udev_list_entry *list_entry_add(struct udev *udev, struct list_node *list, - const char *name, const char *value, - int unique, int sort); -extern void list_entry_remove(struct udev_list_entry *entry); -extern struct udev_list_entry *list_get_entry(struct list_node *list); -extern void list_entry_move_to_end(struct udev_list_entry *list_entry); +extern void udev_list_init(struct udev_list_node *list); +extern void udev_list_cleanup(struct udev *udev, struct udev_list_node *name_list); +extern struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, + const char *name, const char *value, + int unique, int sort); +extern void udev_list_entry_remove(struct udev_list_entry *entry); +extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); +extern void udev_list_entry_move_to_end(struct udev_list_entry *list_entry); #define list_entry_foreach_safe(entry, tmp, first) \ for (entry = first, \ tmp = udev_list_entry_get_next(entry); \ @@ -121,10 +121,10 @@ extern void list_entry_move_to_end(struct udev_list_entry *list_entry); entry = tmp, tmp = udev_list_entry_get_next(tmp)) /* libudev-queue */ -extern int queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum); -extern int queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device); -extern int queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device); -extern int queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device); +extern int udev_queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum); +extern int udev_queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device); +extern int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device); +extern int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device); /* libudev-utils */ #define UTIL_PATH_SIZE 1024 diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index 3ca533b1e0..60f7209d76 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -34,8 +34,8 @@ struct udev_queue { struct udev *udev; int refcount; unsigned long long int last_seen_udev_seqnum; - struct list_node queue_list; - struct list_node failed_list; + struct udev_list_node queue_list; + struct udev_list_node failed_list; }; struct udev_queue *udev_queue_new(struct udev *udev) @@ -51,8 +51,8 @@ struct udev_queue *udev_queue_new(struct udev *udev) memset(udev_queue, 0x00, sizeof(struct udev_queue)); udev_queue->refcount = 1; udev_queue->udev = udev; - list_init(&udev_queue->queue_list); - list_init(&udev_queue->failed_list); + udev_list_init(&udev_queue->queue_list); + udev_list_init(&udev_queue->failed_list); return udev_queue; } @@ -71,8 +71,8 @@ void udev_queue_unref(struct udev_queue *udev_queue) udev_queue->refcount--; if (udev_queue->refcount > 0) return; - list_cleanup(udev_queue->udev, &udev_queue->queue_list); - list_cleanup(udev_queue->udev, &udev_queue->failed_list); + udev_list_cleanup(udev_queue->udev, &udev_queue->queue_list); + udev_list_cleanup(udev_queue->udev, &udev_queue->failed_list); free(udev_queue); } @@ -192,7 +192,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev if (udev_queue == NULL) return NULL; - list_cleanup(udev_queue->udev, &udev_queue->queue_list); + udev_list_cleanup(udev_queue->udev, &udev_queue->queue_list); util_strlcpy(path, udev_get_dev_path(udev_queue->udev), sizeof(path)); util_strlcat(path, "/.udev/queue", sizeof(path)); dir = opendir(path); @@ -216,10 +216,10 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev continue; syspath[syslen + len] = '\0'; info(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); - list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, dent->d_name, 0, 0); + udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, dent->d_name, 0, 0); } closedir(dir); - return list_get_entry(&udev_queue->queue_list); + return udev_list_get_entry(&udev_queue->queue_list); } struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) @@ -230,7 +230,7 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev if (udev_queue == NULL) return NULL; - list_cleanup(udev_queue->udev, &udev_queue->failed_list); + udev_list_cleanup(udev_queue->udev, &udev_queue->failed_list); util_strlcpy(path, udev_get_dev_path(udev_queue->udev), sizeof(path)); util_strlcat(path, "/.udev/failed", sizeof(path)); dir = opendir(path); @@ -259,28 +259,28 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev util_strlcat(filename, "/uevent", sizeof(filename)); if (stat(filename, &statbuf) != 0) continue; - list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0, 0); + udev_list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0, 0); } closedir(dir); - return list_get_entry(&udev_queue->failed_list); + return udev_list_get_entry(&udev_queue->failed_list); } -int queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum) +int udev_queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum) { - return 0; + return -1; } -extern int queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device) +extern int udev_queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device) { - return 0; + return -1; } -extern int queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device) +extern int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device) { - return 0; + return -1; } -extern int queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device) +extern int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device) { - return 0; + return -1; } -- cgit v1.2.3-54-g00ecf From 9925ab0451b307b5766b12134bdc178e4c89f297 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 9 Oct 2008 23:38:30 +0200 Subject: libudev: add udev_monitor_send_device() --- udev/lib/libudev-device.c | 1 + udev/lib/libudev-monitor.c | 46 ++++++++++++++++++++++++++++++++++++++++------ udev/lib/libudev-private.h | 3 +++ 3 files changed, 44 insertions(+), 6 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 62f3518839..c27290835a 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -913,6 +913,7 @@ int udev_device_add_property_from_string(struct udev_device *udev_device, const int udev_device_set_action(struct udev_device *udev_device, const char *action) { + udev_device_add_property(udev_device, "ACTION", action); udev_device->action = strdup(action); if (udev_device->action == NULL) return -ENOMEM; diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index fc87cba4ab..bca7ab32b5 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -61,6 +61,7 @@ struct udev_monitor { struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) { struct udev_monitor *udev_monitor; + struct stat statbuf; if (udev == NULL) return NULL; @@ -74,13 +75,20 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char udev_monitor->udev = udev; udev_monitor->sun.sun_family = AF_LOCAL; - strcpy(udev_monitor->sun.sun_path, socket_path); - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(udev_monitor->sun.sun_path); - - /* translate leading '@' to abstract namespace */ - if (udev_monitor->sun.sun_path[0] == '@') + if (udev_monitor->sun.sun_path[0] == '@') { + /* translate leading '@' to abstract namespace */ + util_strlcpy(udev_monitor->sun.sun_path, socket_path, sizeof(udev_monitor->sun.sun_path)); udev_monitor->sun.sun_path[0] = '\0'; - + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); + } else if (stat(udev_monitor->sun.sun_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { + /* existing socket file */ + util_strlcpy(udev_monitor->sun.sun_path, socket_path, sizeof(udev_monitor->sun.sun_path)); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); + } else { + /* no socket file, assume abstract namespace socket */ + util_strlcpy(&udev_monitor->sun.sun_path[1], socket_path, sizeof(udev_monitor->sun.sun_path)-1); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; + } udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (udev_monitor->sock == -1) { err(udev, "error getting socket: %m\n"); @@ -347,3 +355,29 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito udev_device_set_info_loaded(udev_device); return udev_device; } + +int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device) +{ + const char *action; + struct udev_list_entry *list_entry; + char buf[4096]; + size_t bufpos; + ssize_t count; + + action = udev_device_get_action(udev_device); + if (action == NULL) + return -EINVAL; + bufpos = snprintf(buf, sizeof(buf), "%s@%s", action, udev_device_get_devpath(udev_device)); + bufpos++; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + bufpos += util_strlcpy(&buf[bufpos], + udev_list_entry_get_name(list_entry), + sizeof(buf) - bufpos); + bufpos++; + } + count = sendto(udev_monitor->sock, + &buf, bufpos, 0, + (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); + info(udev_monitor->udev, "passed %zi bytes to monitor %p, \n", count, udev_monitor); + return count; +} diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 1ba0220310..9969b37214 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -76,6 +76,9 @@ extern int udev_device_get_ignore_remove(struct udev_device *udev_device); extern int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore); extern void udev_device_set_info_loaded(struct udev_device *device); +/* libudev-monitor - netlink/unix socket communication */ +extern int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device); + /* libudev-ctrl - daemon runtime setup */ struct udev_ctrl; extern struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); -- cgit v1.2.3-54-g00ecf From df1dcc09efb80d2fbc15790bd5237fad364408a0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 11 Oct 2008 18:40:04 +0200 Subject: libudev: list - add flag --- udev/lib/libudev-list.c | 15 +++++++++++++++ udev/lib/libudev-private.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index 4849d46943..8545835078 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -33,6 +33,7 @@ struct udev_list_entry { struct udev_list_node *list; char *name; char *value; + int flag; }; /* list head point to itself if empty */ @@ -215,3 +216,17 @@ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) return NULL; return list_entry->value; } + +extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry) +{ + if (list_entry == NULL) + return -EINVAL; + return list_entry->flag; +} + +extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag) +{ + if (list_entry == NULL) + return; + list_entry->flag = flag; +} diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 9969b37214..6e419dff6c 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -117,6 +117,8 @@ extern struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct ude extern void udev_list_entry_remove(struct udev_list_entry *entry); extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); extern void udev_list_entry_move_to_end(struct udev_list_entry *list_entry); +extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry); +extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); #define list_entry_foreach_safe(entry, tmp, first) \ for (entry = first, \ tmp = udev_list_entry_get_next(entry); \ -- cgit v1.2.3-54-g00ecf From 9a997ecf4ed97becb9c546c5fad8490bcba44181 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 11 Oct 2008 18:40:33 +0200 Subject: libudev: device - generate DEVNAME and DEVLINKS properties --- udev/lib/libudev-device.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index c27290835a..943e104bf6 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -56,14 +56,14 @@ struct udev_device { int info_loaded; }; -static size_t syspath_to_db_path(struct udev_device *udev_device, char *filename, size_t len) +static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) { size_t start; /* translate to location of db file */ - util_strlcpy(filename, udev_get_dev_path(udev_device->udev), len); + util_strlcpy(filename, udev_get_dev_path(udev), len); start = util_strlcat(filename, "/.udev/db/", len); - util_strlcat(filename, udev_device->devpath, len); + util_strlcat(filename, devpath, len); return util_path_encode(&filename[start], len - start); } @@ -74,7 +74,7 @@ static int device_read_db(struct udev_device *udev_device) char line[UTIL_LINE_SIZE]; FILE *f; - syspath_to_db_path(udev_device, filename, sizeof(filename)); + devpath_to_db_path(udev_device->udev, udev_device->devpath, filename, sizeof(filename)); if (lstat(filename, &stats) != 0) { info(udev_device->udev, "no db file to read %s: %m\n", filename); @@ -857,6 +857,7 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath if (udev_device->syspath == NULL) return -ENOMEM; udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; + udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath); pos = strrchr(udev_device->syspath, '/'); if (pos == NULL) return -EINVAL; @@ -868,7 +869,8 @@ int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsy { udev_device->subsystem = strdup(subsystem); if (udev_device->subsystem == NULL) - return -1; + return -ENOMEM; + udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); return 0; } @@ -877,13 +879,26 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode udev_device->devnode = strdup(devnode); if (udev_device->devnode == NULL) return -ENOMEM; + udev_device_add_property(udev_device, "DEVNODE", udev_device->devnode); return 0; } int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink) { + char symlinks[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + if (udev_list_entry_add(udev_device->udev, &udev_device->devlink_list, devlink, NULL, 1, 0) == NULL) return -ENOMEM; + + list_entry = udev_device_get_devlinks_list_entry(udev_device); + util_strlcpy(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { + util_strlcat(symlinks, " ", sizeof(symlinks)); + util_strlcat(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); + } + udev_device_add_property(udev_device, "DEVLINKS", symlinks); + return 0; } @@ -1027,4 +1042,3 @@ int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore) udev_device->ignore_remove = ignore; return 0; } - -- cgit v1.2.3-54-g00ecf From 2f664629829d8ed52a8bc55b31faf8ec8b65bd3c Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Fri, 10 Oct 2008 11:54:46 +0100 Subject: volume_id: support for GFS2 UUIDs --- extras/volume_id/README | 2 +- extras/volume_id/lib/gfs.c | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/README b/extras/volume_id/README index 0c5e37f969..44a9a875f3 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -40,7 +40,7 @@ minix * - - * ocfs (1, 2) * * * * vxfs * - - * nss (netware) * * * -gfs, gfs2 * * - - +gfs, gfs2 * * * - oracleasm * * - - Raid members are detected to prevent the probing for a filesystem diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c index 25f96f668b..d97730c7a4 100644 --- a/extras/volume_id/lib/gfs.c +++ b/extras/volume_id/lib/gfs.c @@ -76,9 +76,22 @@ struct gfs2_sb { char sb_lockproto[GFS_LOCKNAME_LEN]; char sb_locktable[GFS_LOCKNAME_LEN]; - /* In gfs1, quota and license dinodes followed */ + + struct gfs2_inum __pad3; /* Was quota inode in gfs1 */ + struct gfs2_inum __pad4; /* Was licence inode in gfs1 */ + uint8_t sb_uuid[16]; /* The UUID maybe 0 for backwards compat */ } PACKED; +static int uuid_non_zero(const uint8_t *p) +{ + int i; + for (i = 0; i < 16; i++) { + if (p[i] != 0) + return 1; + } + return 0; +} + static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int vers) { struct gfs2_sb *sbd; @@ -113,6 +126,8 @@ static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int v volume_id_set_label_raw(id, label, GFS_LOCKNAME_LEN); volume_id_set_label_string(id, label, GFS_LOCKNAME_LEN); } + if (vers == 2 && uuid_non_zero(sbd->sb_uuid)) + volume_id_set_uuid(id, sbd->sb_uuid, 0, UUID_DCE); strcpy(id->type_version, "1"); volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); return 0; -- cgit v1.2.3-54-g00ecf From f4700eb8a02c17972c3cef658bd8c96a725355b8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 13 Oct 2008 03:34:37 +0200 Subject: vol_id: update README --- configure.ac | 4 ++-- extras/volume_id/README | 59 +++++++++++++++++++------------------------------ 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/configure.ac b/configure.ac index 0e0f9875a9..6e98f37fba 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ AC_PROG_LIBTOOL dnl /* libudev version */ LIBUDEV_LT_CURRENT=0 -LIBUDEV_LT_REVISION=2 +LIBUDEV_LT_REVISION=3 LIBUDEV_LT_AGE=0 AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) @@ -19,7 +19,7 @@ AC_SUBST(LIBUDEV_LT_AGE) dnl /* libvolume_id version */ VOLID_LT_CURRENT=1 -VOLID_LT_REVISION=2 +VOLID_LT_REVISION=3 VOLID_LT_AGE=0 AC_SUBST(VOLID_LT_CURRENT) AC_SUBST(VOLID_LT_REVISION) diff --git a/extras/volume_id/README b/extras/volume_id/README index 44a9a875f3..9459c880f8 100644 --- a/extras/volume_id/README +++ b/extras/volume_id/README @@ -1,25 +1,31 @@ vol_id - probe filesystem and read label and uuid -This program is normally called from a udev rule, to provide udev with the -filesystem type of a volume and the label and uuid to name a device node. -vol_id opens the blockdevice node specified at the commandline. The following -commandline switches are supported to specify what vol_id should print: - --export export key/value pairs - --type filesystem type - --label filesystem label - --label-raw raw label - --uuid filesystem uuid - --skip-raid don't probe for raid - --probe-all find possibly conflicting signatures - --help +vol_id will only return with a non-zero exit code if the string asked for, +is not empty. All trailing whitespace will be removed, spaces replaced by +underscore and slashes ignored. +Unmangled values are available in the --export mode as hex-encoded strings +in *_ENC= keys. + + $ extras/volume_id/vol_id --export /dev/sda6 + ID_FS_USAGE=filesystem + ID_FS_TYPE=ext3 + ID_FS_VERSION=1.0 + ID_FS_UUID=3e999973-00c9-4917-9442-b7633bd95b9e + ID_FS_UUID_ENC=3e999973-00c9-4917-9442-b7633bd95b9e + ID_FS_LABEL=devel + ID_FS_LABEL_ENC=devel + + $ extras/volume_id/vol_id --label /dev/sda6 + devel + + $ extras/volume_id/vol_id --type /dev/sda6 + ext3 -vol_id will only return successful if the string asked for, is not -empty. All trailing whitespace will be removed, spaces replaced by underscore -and slashes ignored. fstype probe label uuid version -------------------------------------------------- linux swap * * * * +btrfs * * * - ext * * * * reiserfs jr/3.5/3.6/4 * * * * fat (12, 16, 32) * * * * @@ -33,13 +39,13 @@ ufs * - - - cramfs * * - - sysv * * - * luks * - * - -hpfs * - - - +hpfs * * - - romfs * * - - squashfs * - - - minix * - - * ocfs (1, 2) * * * * vxfs * - - * -nss (netware) * * * +nss (netware) * - * * gfs, gfs2 * * * - oracleasm * * - - @@ -58,22 +64,3 @@ silicon_raid * - - - via_raid * - - - jmicron * - - - adaptec * - - - - -To give it a try, you may call it on the commandline: - $ extras/volume_id/vol_id --export /dev/sda6 - ID_FS_USAGE=filesystem - ID_FS_TYPE=ext3 - ID_FS_VERSION=1.0 - ID_FS_UUID=3e999973-00c9-4917-9442-b7633bd95b9e - ID_FS_LABEL=devel - ID_FS_LABEL_SAFE=devel - - $ extras/volume_id/vol_id --label /dev/sda6 - devel - - $ extras/volume_id/vol_id --type /dev/sda6 - ext3 - - -Any comment/questions/concerns to me: - Kay Sievers -- cgit v1.2.3-54-g00ecf From 517814e7d07fb7a2a4f914c973a8164d4341c6c4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Oct 2008 19:53:47 +0200 Subject: libudev: handle ! in sysname, add sysnum, return allocated list_entry on add --- udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 93 +++++++++++++++++++++++++++++++--------------- udev/lib/libudev-list.c | 7 +++- udev/lib/libudev-private.h | 4 +- udev/lib/libudev.h | 1 + 5 files changed, 73 insertions(+), 33 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 8e0be1ab8d..1fe0cc30be 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -24,6 +24,7 @@ udev_device_get_syspath udev_device_get_devpath udev_device_get_devnode udev_device_get_sysname +udev_device_get_sysnum udev_device_get_subsystem udev_device_get_devlinks_list_entry udev_device_get_properties_list_entry diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 943e104bf6..2f685bd8e8 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "libudev.h" @@ -36,10 +37,11 @@ struct udev_device { struct udev_device *parent_device; char *syspath; const char *devpath; - const char *sysname; + char *sysname; + const char *sysnum; char *devnode; char *subsystem; - struct udev_list_node devlink_list; + struct udev_list_node devlinks_list; struct udev_list_node properties_list; char *action; int event_timeout; @@ -82,6 +84,7 @@ static int device_read_db(struct udev_device *udev_device) } if ((stats.st_mode & S_IFMT) == S_IFLNK) { char target[UTIL_PATH_SIZE]; + char devnode[UTIL_PATH_SIZE]; int target_len; char *next; @@ -98,10 +101,12 @@ static int device_read_db(struct udev_device *udev_device) next[0] = '\0'; next = &next[1]; } - if (asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), target) < 0) - return -ENOMEM; + util_strlcpy(devnode, udev_get_dev_path(udev_device->udev), sizeof(devnode)); + util_strlcat(devnode, "/", sizeof(devnode)); + util_strlcat(devnode, target, sizeof(devnode)); + udev_device_set_devnode(udev_device, devnode); while (next != NULL) { - char linkname[UTIL_PATH_SIZE]; + char devlink[UTIL_PATH_SIZE]; const char *lnk; lnk = next; @@ -110,10 +115,10 @@ static int device_read_db(struct udev_device *udev_device) next[0] = '\0'; next = &next[1]; } - util_strlcpy(linkname, udev_get_dev_path(udev_device->udev), sizeof(linkname)); - util_strlcat(linkname, "/", sizeof(linkname)); - util_strlcat(linkname, lnk, sizeof(linkname)); - udev_device_add_devlink(udev_device, linkname); + util_strlcpy(devlink, udev_get_dev_path(udev_device->udev), sizeof(devlink)); + util_strlcat(devlink, "/", sizeof(devlink)); + util_strlcat(devlink, lnk, sizeof(devlink)); + udev_device_add_devlink(udev_device, devlink); } info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); return 0; @@ -133,10 +138,12 @@ static int device_read_db(struct udev_device *udev_device) break; line[len-1] = '\0'; val = &line[2]; - switch(line[0]) { case 'N': - asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), val); + util_strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, val, sizeof(filename)); + udev_device_set_devnode(udev_device, filename); break; case 'S': util_strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); @@ -205,9 +212,9 @@ static int device_read_uevent_file(struct udev_device *udev_device) static void device_load_info(struct udev_device *device) { + device->info_loaded = 1; device_read_uevent_file(device); device_read_db(device); - device->info_loaded = 1; } void udev_device_set_info_loaded(struct udev_device *device) @@ -228,7 +235,7 @@ struct udev_device *device_new(struct udev *udev) memset(udev_device, 0x00, sizeof(struct udev_device)); udev_device->refcount = 1; udev_device->udev = udev; - udev_list_init(&udev_device->devlink_list); + udev_list_init(&udev_device->devlinks_list); udev_list_init(&udev_device->properties_list); udev_list_init(&udev_device->attr_list); info(udev_device->udev, "udev_device: %p created\n", udev_device); @@ -579,9 +586,10 @@ void udev_device_unref(struct udev_device *udev_device) if (udev_device->parent_device != NULL) udev_device_unref(udev_device->parent_device); free(udev_device->syspath); + free(udev_device->sysname); free(udev_device->devnode); free(udev_device->subsystem); - udev_list_cleanup(udev_device->udev, &udev_device->devlink_list); + udev_list_cleanup(udev_device->udev, &udev_device->devlinks_list); udev_list_cleanup(udev_device->udev, &udev_device->properties_list); free(udev_device->action); free(udev_device->driver); @@ -631,6 +639,13 @@ const char *udev_device_get_sysname(struct udev_device *udev_device) return udev_device->sysname; } +const char *udev_device_get_sysnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->sysnum; +} + /** * udev_device_get_devnode: * @udev_device: udev device @@ -710,7 +725,7 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device * return NULL; if (!udev_device->info_loaded) device_load_info(udev_device); - return udev_list_get_entry(&udev_device->devlink_list); + return udev_list_get_entry(&udev_device->devlinks_list); } /** @@ -781,10 +796,16 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch ssize_t size; const char *val = NULL; + if (udev_device == NULL) + return NULL; + if (attr == NULL) + return NULL; + /* look for possibly already cached result */ udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->attr_list)) { if (strcmp(udev_list_entry_get_name(list_entry), attr) == 0) { - info(udev_device->udev, "got '%s' (%s) from cache\n", attr, udev_list_entry_get_value(list_entry)); + info(udev_device->udev, "got '%s' (%s) from cache\n", + attr, udev_list_entry_get_value(list_entry)); return udev_list_entry_get_value(list_entry); } } @@ -848,9 +869,11 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch out: return val; } + int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) { const char *pos; + size_t len; free(udev_device->syspath); udev_device->syspath = strdup(syspath); @@ -858,10 +881,25 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath return -ENOMEM; udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath); + pos = strrchr(udev_device->syspath, '/'); if (pos == NULL) return -EINVAL; - udev_device->sysname = &pos[1]; + udev_device->sysname = strdup(&pos[1]); + if (udev_device->sysname == NULL) + return -ENOMEM; + + /* some devices have '!' in their name, change that to '/' */ + len = 0; + while (udev_device->sysname[len] != '\0') { + if (udev_device->sysname[len] == '!') + udev_device->sysname[len] = '/'; + len++; + } + + /* trailing number */ + while (isdigit(udev_device->sysname[--len])) + udev_device->sysnum = &udev_device->sysname[len]; return 0; } @@ -876,6 +914,7 @@ int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsy int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) { + free(udev_device->devnode); udev_device->devnode = strdup(devnode); if (udev_device->devnode == NULL) return -ENOMEM; @@ -888,9 +927,8 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink char symlinks[UTIL_PATH_SIZE]; struct udev_list_entry *list_entry; - if (udev_list_entry_add(udev_device->udev, &udev_device->devlink_list, devlink, NULL, 1, 0) == NULL) + if (udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, 1, 0) == NULL) return -ENOMEM; - list_entry = udev_device_get_devlinks_list_entry(udev_device); util_strlcpy(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { @@ -898,18 +936,15 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink util_strlcat(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); } udev_device_add_property(udev_device, "DEVLINKS", symlinks); - return 0; } -int udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) +struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { - if (udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0) == NULL) - return -ENOMEM; - return 0; + return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); } -int udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) +struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) { char name[UTIL_PATH_SIZE]; char *val; @@ -917,21 +952,21 @@ int udev_device_add_property_from_string(struct udev_device *udev_device, const strncpy(name, property, sizeof(name)); val = strchr(name, '='); if (val == NULL) - return -1; + return NULL; val[0] = '\0'; val = &val[1]; if (val[0] == '\0') val = NULL; - udev_device_add_property(udev_device, name, val); - return 0; + return udev_device_add_property(udev_device, name, val); } int udev_device_set_action(struct udev_device *udev_device, const char *action) { - udev_device_add_property(udev_device, "ACTION", action); + free(udev_device->action); udev_device->action = strdup(action); if (udev_device->action == NULL) return -ENOMEM; + udev_device_add_property(udev_device, "ACTION", action); return 0; } diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index 8545835078..25e69cb3a3 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -197,9 +197,12 @@ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list { struct udev_list_entry *entry; - udev_list_entry_foreach(entry, list_entry) - if (strcmp(udev_list_entry_get_name(entry), name) == 0) + udev_list_entry_foreach(entry, list_entry) { + if (strcmp(udev_list_entry_get_name(entry), name) == 0) { + dbg(entry->udev, "found '%s=%s'\n", entry->name, entry->value); return entry; + } + } return NULL; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 6e419dff6c..4e31d6b446 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -54,8 +54,8 @@ extern int udev_device_set_syspath(struct udev_device *udev_device, const char * extern int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); extern int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); extern int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink); -extern int udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); -extern int udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); +extern struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); +extern struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); extern int udev_device_set_action(struct udev_device *udev_device, const char *action); extern int udev_device_set_driver(struct udev_device *udev_device, const char *driver); extern const char *udev_device_get_devpath_old(struct udev_device *udev_device); diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 3f4cccf8c3..8949724844 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -69,6 +69,7 @@ extern const char *udev_device_get_devpath(struct udev_device *udev_device); extern const char *udev_device_get_subsystem(struct udev_device *udev_device); extern const char *udev_device_get_syspath(struct udev_device *udev_device); extern const char *udev_device_get_sysname(struct udev_device *udev_device); +extern const char *udev_device_get_sysnum(struct udev_device *udev_device); extern const char *udev_device_get_devnode(struct udev_device *udev_device); extern struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); extern struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From fb780a48e656e3d107e5193d3781a613eb1d068e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Oct 2008 19:55:22 +0200 Subject: delete simple-build-check.sh --- test/simple-build-check.sh | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100755 test/simple-build-check.sh diff --git a/test/simple-build-check.sh b/test/simple-build-check.sh deleted file mode 100755 index e391846de9..0000000000 --- a/test/simple-build-check.sh +++ /dev/null @@ -1,38 +0,0 @@ -#/bin/sh - -EXTRAS="\ - extras/path_id \ - extras/scsi_id \ - extras/ata_id \ - extras/volume_id \ - extras/usb_id \ - extras/cdrom_id \ - extras/edd_id \ - extras/floppy \ - extras/firmware \ - extras/collect \ - extras/rule_generator \ - extras/fstab_import" - -# with debug -make clean EXTRAS="$EXTRAS" >/dev/null -make all -j4 $MAKEOPTS DEBUG=true EXTRAS="$EXTRAS" || exit -echo -e "\n\n" - -# without any logging -make clean EXTRAS="$EXTRAS" >/dev/null -make all $MAKEOPTS USE_LOG=false EXTRAS="$EXTRAS" || exit -echo -e "\n\n" - -# install in temporary dir and show it -TEMPDIR="`pwd`/.tmp" -rm -rf $TEMPDIR -mkdir $TEMPDIR -make clean EXTRAS="$EXTRAS" >/dev/null -make all $MAKEOPTS DESTDIR="$TEMPDIR" EXTRAS="$EXTRAS" || exit -make install DESTDIR="$TEMPDIR" EXTRAS="$EXTRAS" || exit -echo -e "\nInstalled tree:" -find $TEMPDIR -rm -rf $TEMPDIR - -make clean EXTRAS="$EXTRAS" >/dev/null -- cgit v1.2.3-54-g00ecf From a1af6b040169352b5cb2e1fe0d2a518783a5ec6d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Oct 2008 19:55:57 +0200 Subject: test: move global ENV{ENV_KEY_TEST}="test" to local rule --- test/udev-test.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index df5e3fcb2a..4c6a70f1af 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1195,6 +1195,7 @@ EOF devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < 0) { - system("$udev_bin_valgrind $subsys"); + system("$udev_bin_valgrind"); } else { - system("$udev_bin $subsys"); + system("$udev_bin"); } } -- cgit v1.2.3-54-g00ecf From 81d9e22120ba5e1cd5e3859a80aa17eddeeb7f49 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Oct 2008 14:20:27 +0200 Subject: libudev: monitor - fix send_device() property copying --- udev/lib/libudev-monitor.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index bca7ab32b5..ccfcd6afc5 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -75,12 +75,12 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char udev_monitor->udev = udev; udev_monitor->sun.sun_family = AF_LOCAL; - if (udev_monitor->sun.sun_path[0] == '@') { + if (socket_path[0] == '@') { /* translate leading '@' to abstract namespace */ util_strlcpy(udev_monitor->sun.sun_path, socket_path, sizeof(udev_monitor->sun.sun_path)); udev_monitor->sun.sun_path[0] = '\0'; udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); - } else if (stat(udev_monitor->sun.sun_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { + } else if (stat(socket_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { /* existing socket file */ util_strlcpy(udev_monitor->sun.sun_path, socket_path, sizeof(udev_monitor->sun.sun_path)); udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); @@ -244,6 +244,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; char buf[4096]; size_t bufpos; + int devpath_set = 0; int maj = 0; int min = 0; @@ -313,6 +314,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito util_strlcpy(path, udev_get_sys_path(udev_monitor->udev), sizeof(path)); util_strlcat(path, &key[8], sizeof(path)); udev_device_set_syspath(udev_device, path); + devpath_set = 1; } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { udev_device_set_subsystem(udev_device, &key[10]); } else if (strncmp(key, "DEVNAME=", 8) == 0) { @@ -350,6 +352,11 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito continue; udev_device_add_property_from_string(udev_device, key); } + if (!devpath_set) { + udev_device_unref(udev_device); + return NULL; + } + udev_device_set_devnum(udev_device, makedev(maj, min)); udev_device_set_info_loaded(udev_device); @@ -370,9 +377,9 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi bufpos = snprintf(buf, sizeof(buf), "%s@%s", action, udev_device_get_devpath(udev_device)); bufpos++; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - bufpos += util_strlcpy(&buf[bufpos], - udev_list_entry_get_name(list_entry), - sizeof(buf) - bufpos); + bufpos += snprintf(&buf[bufpos], sizeof(buf) - bufpos, "%s=%s", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); bufpos++; } count = sendto(udev_monitor->sock, -- cgit v1.2.3-54-g00ecf From 979ff016ef6737c0049d298ea0f582ea5d3b7830 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Oct 2008 14:21:33 +0200 Subject: libudev: device - add get_envp() to construct envp from property list --- udev/lib/libudev-device.c | 44 +++++++++++++++++++++++++++++++++++++++++--- udev/lib/libudev-private.h | 4 ++++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 2f685bd8e8..c76be21e82 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -43,13 +43,15 @@ struct udev_device { char *subsystem; struct udev_list_node devlinks_list; struct udev_list_node properties_list; + char *envp[128]; + int envp_uptodate; + char *driver; + dev_t devnum; char *action; int event_timeout; - char *driver; char *devpath_old; char *physdevpath; int timeout; - dev_t devnum; unsigned long long int seqnum; int num_fake_partitions; int devlink_priority; @@ -238,6 +240,7 @@ struct udev_device *device_new(struct udev *udev) udev_list_init(&udev_device->devlinks_list); udev_list_init(&udev_device->properties_list); udev_list_init(&udev_device->attr_list); + udev_device->event_timeout = -1; info(udev_device->udev, "udev_device: %p created\n", udev_device); return udev_device; } @@ -578,6 +581,8 @@ struct udev_device *udev_device_ref(struct udev_device *udev_device) **/ void udev_device_unref(struct udev_device *udev_device) { + unsigned int i; + if (udev_device == NULL) return; udev_device->refcount--; @@ -596,6 +601,8 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->devpath_old); free(udev_device->physdevpath); udev_list_cleanup(udev_device->udev, &udev_device->attr_list); + for (i = 0; i < ARRAY_SIZE(udev_device->envp) && udev_device->envp[i] != NULL; i++) + free(udev_device->envp[i]); info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } @@ -728,6 +735,11 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device * return udev_list_get_entry(&udev_device->devlinks_list); } +void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) +{ + udev_list_cleanup(udev_device->udev, &udev_device->devlinks_list); +} + /** * udev_device_get_properties_list_entry: * @udev_device: udev device @@ -905,6 +917,7 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) { + free(udev_device->subsystem); udev_device->subsystem = strdup(subsystem); if (udev_device->subsystem == NULL) return -ENOMEM; @@ -918,7 +931,7 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode udev_device->devnode = strdup(devnode); if (udev_device->devnode == NULL) return -ENOMEM; - udev_device_add_property(udev_device, "DEVNODE", udev_device->devnode); + udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); return 0; } @@ -941,6 +954,7 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { + udev_device->envp_uptodate = 0; return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); } @@ -960,6 +974,29 @@ struct udev_list_entry *udev_device_add_property_from_string(struct udev_device return udev_device_add_property(udev_device, name, val); } +char **udev_device_get_properties_envp(struct udev_device *udev_device) +{ + if (!udev_device->envp_uptodate) { + unsigned int i; + struct udev_list_entry *list_entry; + + for (i = 0; i < ARRAY_SIZE(udev_device->envp) && udev_device->envp[i] != NULL; i++) + free(udev_device->envp[i]); + i = 0; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + asprintf(&udev_device->envp[i++], "%s=%s", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + if (i+1 >= ARRAY_SIZE(udev_device->envp)) + break; + } + udev_device->envp[i] = NULL; + info(udev_device->udev, "constructed envp from %u properties\n", i); + udev_device->envp_uptodate = 1; + } + return udev_device->envp; +} + int udev_device_set_action(struct udev_device *udev_device, const char *action) { free(udev_device->action); @@ -972,6 +1009,7 @@ int udev_device_set_action(struct udev_device *udev_device, const char *action) int udev_device_set_driver(struct udev_device *udev_device, const char *driver) { + free(udev_device->driver); udev_device->driver = strdup(driver); if (udev_device->driver == NULL) return -ENOMEM; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 4e31d6b446..97b0de950d 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -23,6 +23,8 @@ #include #include "libudev.h" +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + static inline void __attribute__ ((format(printf, 2, 3))) udev_log_null(struct udev *udev, const char *format, ...) {} @@ -54,8 +56,10 @@ extern int udev_device_set_syspath(struct udev_device *udev_device, const char * extern int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); extern int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); extern int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink); +extern void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); extern struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); extern struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); +extern char **udev_device_get_properties_envp(struct udev_device *udev_device); extern int udev_device_set_action(struct udev_device *udev_device, const char *action); extern int udev_device_set_driver(struct udev_device *udev_device, const char *driver); extern const char *udev_device_get_devpath_old(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From 6ebc7a4f930b14299e788da5ef89667cce005be0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Oct 2008 16:54:06 +0200 Subject: libudev: do not include ctrl in libudev.so --- udev/lib/Makefile.am | 6 ------ 1 file changed, 6 deletions(-) diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am index 08e7ff865b..7cd883302c 100644 --- a/udev/lib/Makefile.am +++ b/udev/lib/Makefile.am @@ -23,7 +23,6 @@ libudev_la_SOURCES =\ libudev-util.c \ libudev-device.c \ libudev-enumerate.c \ - libudev-ctrl.c \ libudev-monitor.c \ libudev-queue.c @@ -31,11 +30,6 @@ libudev_la_LDFLAGS = \ -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ -export-symbols $(top_srcdir)/udev/lib/exported_symbols -if USE_SELINUX -libudev_la_LIBADD = \ - -lselinux -endif - pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig pkgconfig_DATA = libudev.pc -- cgit v1.2.3-54-g00ecf From 1e61ff54f52c89c1ec0cffd595dc9b1980df2be4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Oct 2008 16:55:04 +0200 Subject: libudev: monitor - do not mangle DEVLINKS property --- udev/lib/libudev-monitor.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index ccfcd6afc5..dd8dfac323 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -320,9 +320,13 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito } else if (strncmp(key, "DEVNAME=", 8) == 0) { udev_device_set_devnode(udev_device, &key[8]); } else if (strncmp(key, "DEVLINKS=", 9) == 0) { - char *slink = &key[9]; - char *next = strchr(slink, ' '); + char devlinks[UTIL_PATH_SIZE]; + char *slink; + char *next; + util_strlcpy(devlinks, &key[9], sizeof(devlinks)); + slink = devlinks; + next = strchr(slink, ' '); while (next != NULL) { next[0] = '\0'; udev_device_add_devlink(udev_device, slink); @@ -356,9 +360,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito udev_device_unref(udev_device); return NULL; } - udev_device_set_devnum(udev_device, makedev(maj, min)); - udev_device_set_info_loaded(udev_device); return udev_device; } -- cgit v1.2.3-54-g00ecf From bd85566c16bd9ba32a44a1b2902127f459f4a63c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Oct 2008 16:56:06 +0200 Subject: libudev: update DEVLINKS property when properties are read --- udev/lib/libudev-device.c | 34 ++++++++++++++++++++++------------ udev/lib/libudev-private.h | 1 + 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index c76be21e82..5b90af68b8 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -42,6 +42,7 @@ struct udev_device { char *devnode; char *subsystem; struct udev_list_node devlinks_list; + int devlinks_uptodate; struct udev_list_node properties_list; char *envp[128]; int envp_uptodate; @@ -176,7 +177,7 @@ static int device_read_db(struct udev_device *udev_device) return 0; } -static int device_read_uevent_file(struct udev_device *udev_device) +int udev_device_read_uevent_file(struct udev_device *udev_device) { char filename[UTIL_PATH_SIZE]; FILE *f; @@ -215,7 +216,7 @@ static int device_read_uevent_file(struct udev_device *udev_device) static void device_load_info(struct udev_device *device) { device->info_loaded = 1; - device_read_uevent_file(device); + udev_device_read_uevent_file(device); device_read_db(device); } @@ -737,6 +738,7 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device * void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) { + udev_device->devlinks_uptodate = 0; udev_list_cleanup(udev_device->udev, &udev_device->devlinks_list); } @@ -758,6 +760,21 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device return NULL; if (!udev_device->info_loaded) device_load_info(udev_device); + if (!udev_device->devlinks_uptodate) { + char symlinks[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + + udev_device->devlinks_uptodate = 1; + list_entry = udev_device_get_devlinks_list_entry(udev_device); + if (list_entry != NULL) { + util_strlcpy(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { + util_strlcat(symlinks, " ", sizeof(symlinks)); + util_strlcat(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); + } + udev_device_add_property(udev_device, "DEVLINKS", symlinks); + } + } return udev_list_get_entry(&udev_device->properties_list); } @@ -929,6 +946,8 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode { free(udev_device->devnode); udev_device->devnode = strdup(devnode); + if (devnode == NULL) + return 0; if (udev_device->devnode == NULL) return -ENOMEM; udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); @@ -937,18 +956,9 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink) { - char symlinks[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - + udev_device->devlinks_uptodate = 0; if (udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, 1, 0) == NULL) return -ENOMEM; - list_entry = udev_device_get_devlinks_list_entry(udev_device); - util_strlcpy(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { - util_strlcat(symlinks, " ", sizeof(symlinks)); - util_strlcat(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); - } - udev_device_add_property(udev_device, "DEVLINKS", symlinks); return 0; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 97b0de950d..e9f2c9893b 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -60,6 +60,7 @@ extern void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); extern struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); extern struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); extern char **udev_device_get_properties_envp(struct udev_device *udev_device); +extern int udev_device_read_uevent_file(struct udev_device *udev_device); extern int udev_device_set_action(struct udev_device *udev_device, const char *action); extern int udev_device_set_driver(struct udev_device *udev_device, const char *driver); extern const char *udev_device_get_devpath_old(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From 5c5cad796682d7f481d59ca495a1efa07fa013c7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Oct 2008 18:34:14 +0200 Subject: libudev: device - lookup "subsystem" and "driver" only once --- udev/lib/libudev-device.c | 64 +++++++++++++++++++++++++---------------------- udev/lib/libudev-util.c | 4 +-- 2 files changed, 36 insertions(+), 32 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 5b90af68b8..8afd68cc76 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -41,12 +41,14 @@ struct udev_device { const char *sysnum; char *devnode; char *subsystem; + int subsystem_set; struct udev_list_node devlinks_list; int devlinks_uptodate; struct udev_list_node properties_list; char *envp[128]; int envp_uptodate; char *driver; + int driver_set; dev_t devnum; char *action; int event_timeout; @@ -687,31 +689,30 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) if (udev_device == NULL) return NULL; - if (udev_device->subsystem != NULL) - return udev_device->subsystem; - - /* read "subsytem" link */ - if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { - udev_device->subsystem = strdup(subsystem); - return udev_device->subsystem; - } - - /* implicit names */ - if (strncmp(udev_device->devpath, "/module/", 8) == 0) { - udev_device->subsystem = strdup("module"); - return udev_device->subsystem; - } - if (strstr(udev_device->devpath, "/drivers/") != NULL) { - udev_device->subsystem = strdup("drivers"); - return udev_device->subsystem; - } - if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || - strncmp(udev_device->devpath, "/class/", 7) == 0 || - strncmp(udev_device->devpath, "/bus/", 5) == 0) { - udev_device->subsystem = strdup("subsystem"); - return udev_device->subsystem; + if (!udev_device->subsystem_set) { + udev_device->subsystem_set = 1; + /* read "subsytem" link */ + if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { + udev_device_set_subsystem(udev_device, subsystem); + return udev_device->subsystem; + } + /* implicit names */ + if (strncmp(udev_device->devpath, "/module/", 8) == 0) { + udev_device_set_subsystem(udev_device, "module"); + return udev_device->subsystem; + } + if (strstr(udev_device->devpath, "/drivers/") != NULL) { + udev_device_set_subsystem(udev_device, "drivers"); + return udev_device->subsystem; + } + if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || + strncmp(udev_device->devpath, "/class/", 7) == 0 || + strncmp(udev_device->devpath, "/bus/", 5) == 0) { + udev_device_set_subsystem(udev_device, "subsystem"); + return udev_device->subsystem; + } } - return NULL; + return udev_device->subsystem; } /** @@ -784,11 +785,11 @@ const char *udev_device_get_driver(struct udev_device *udev_device) if (udev_device == NULL) return NULL; - if (udev_device->driver != NULL) - return udev_device->driver; - if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) < 2) - return NULL; - udev_device->driver = strdup(driver); + if (!udev_device->driver_set) { + udev_device->driver_set = 1; + if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) > 0) + udev_device->driver = strdup(driver); + } return udev_device->driver; } @@ -844,7 +845,8 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch util_strlcat(path, attr, sizeof(path)); if (lstat(path, &statbuf) != 0) { - info(udev_device->udev, "stat '%s' failed: %m\n", path); + info(udev_device->udev, "no attribute '%s', keep negative entry\n", path); + udev_list_entry_add(udev_device->udev, &udev_device->attr_list, attr, NULL, 0, 0); goto out; } @@ -938,6 +940,7 @@ int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsy udev_device->subsystem = strdup(subsystem); if (udev_device->subsystem == NULL) return -ENOMEM; + udev_device->subsystem_set = 1; udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); return 0; } @@ -1023,6 +1026,7 @@ int udev_device_set_driver(struct udev_device *udev_device, const char *driver) udev_device->driver = strdup(driver); if (udev_device->driver == NULL) return -ENOMEM; + udev_device->driver_set = 1; return 0; } diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 55bac9a476..0ff121d774 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -31,7 +31,7 @@ #include "libudev.h" #include "libudev-private.h" -static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *subsystem, size_t size) +static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) { char path[UTIL_PATH_SIZE]; ssize_t len; @@ -49,7 +49,7 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy return -1; pos = &pos[1]; info(udev, "resolved link to: '%s'\n", pos); - return util_strlcpy(subsystem, pos, size); + return util_strlcpy(value, pos, size); } ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size) -- cgit v1.2.3-54-g00ecf From 31f4b036ea97d87d3f094d6e5256976a25eac013 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 11:37:22 +0200 Subject: libudev: device - export properties when values are set --- udev/lib/libudev-device.c | 26 ++++++++++++++++++++------ udev/lib/libudev-monitor.c | 15 +++++++++++---- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 8afd68cc76..acab263785 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -35,6 +35,7 @@ struct udev_device { int refcount; struct udev *udev; struct udev_device *parent_device; + int parent_set; char *syspath; const char *devpath; char *sysname; @@ -518,12 +519,12 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; - - if (udev_device->parent_device != NULL) { - info(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); - return udev_device->parent_device; + if (!udev_device->parent_set) { + udev_device->parent_set = 1; + udev_device->parent_device = device_new_from_parent(udev_device); } - udev_device->parent_device = device_new_from_parent(udev_device); + if (udev_device->parent_device != NULL) + info(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); return udev_device->parent_device; } @@ -1016,7 +1017,7 @@ int udev_device_set_action(struct udev_device *udev_device, const char *action) udev_device->action = strdup(action); if (udev_device->action == NULL) return -ENOMEM; - udev_device_add_property(udev_device, "ACTION", action); + udev_device_add_property(udev_device, "ACTION", udev_device->action); return 0; } @@ -1027,6 +1028,7 @@ int udev_device_set_driver(struct udev_device *udev_device, const char *driver) if (udev_device->driver == NULL) return -ENOMEM; udev_device->driver_set = 1; + udev_device_add_property(udev_device, "DRIVER", udev_device->driver); return 0; } @@ -1040,6 +1042,7 @@ int udev_device_set_devpath_old(struct udev_device *udev_device, const char *dev udev_device->devpath_old = strdup(devpath_old); if (udev_device->devpath_old == NULL) return -ENOMEM; + udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); return 0; } @@ -1081,13 +1084,24 @@ int udev_device_set_event_timeout(struct udev_device *udev_device, int event_tim int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) { + char num[32]; + udev_device->seqnum = seqnum; + snprintf(num, sizeof(num), "%llu", seqnum); + udev_device_add_property(udev_device, "SEQNUM", num); return 0; } int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) { + char num[32]; + udev_device->devnum = devnum; + + snprintf(num, sizeof(num), "%u", major(devnum)); + udev_device_add_property(udev_device, "MAJOR", num); + snprintf(num, sizeof(num), "%u", minor(devnum)); + udev_device_add_property(udev_device, "MINOR", num); return 0; } diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index dd8dfac323..382fbfac5f 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -245,6 +245,8 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito char buf[4096]; size_t bufpos; int devpath_set = 0; + int subsystem_set = 0; + int action_set = 0; int maj = 0; int min = 0; @@ -317,6 +319,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito devpath_set = 1; } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { udev_device_set_subsystem(udev_device, &key[10]); + subsystem_set = 1; } else if (strncmp(key, "DEVNAME=", 8) == 0) { udev_device_set_devnode(udev_device, &key[8]); } else if (strncmp(key, "DEVLINKS=", 9) == 0) { @@ -339,6 +342,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito udev_device_set_driver(udev_device, &key[7]); } else if (strncmp(key, "ACTION=", 7) == 0) { udev_device_set_action(udev_device, &key[7]); + action_set = 1; } else if (strncmp(key, "MAJOR=", 6) == 0) { maj = strtoull(&key[6], NULL, 10); } else if (strncmp(key, "MINOR=", 6) == 0) { @@ -351,12 +355,15 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito udev_device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10)); } else if (strncmp(key, "TIMEOUT=", 8) == 0) { udev_device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); - } - if (strncmp(key, "PHYSDEV", 7) == 0) + } else if (strncmp(key, "PHYSDEV", 7) == 0) { + /* skip deprecated values */ continue; - udev_device_add_property_from_string(udev_device, key); + } else { + udev_device_add_property_from_string(udev_device, key); + } } - if (!devpath_set) { + if (!devpath_set || !subsystem_set || !action_set) { + info(udev_monitor->udev, "missing values, skip\n"); udev_device_unref(udev_device); return NULL; } -- cgit v1.2.3-54-g00ecf From 2c09b3b41d8feffee746eefe079619e6b7484fa8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 13:33:13 +0200 Subject: libudev: list - handle update of key with NULL value --- udev/lib/libudev-list.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index 25e69cb3a3..ac57ee4ebf 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -95,12 +95,6 @@ static void list_entry_insert_before(struct udev_list_entry *new, struct udev_li new->list = entry->list; } -void udev_list_entry_remove(struct udev_list_entry *entry) -{ - list_node_remove(&entry->node); - entry->list = NULL; -} - struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, const char *name, const char *value, int unique, int sort) @@ -112,13 +106,16 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_ udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { if (strcmp(entry_loop->name, name) == 0) { info(udev, "'%s' is already in the list\n", name); - if (value != NULL) { - free(entry_loop->value); - entry_loop->value = strdup(value); - if (entry_loop->value == NULL) - return NULL; - info(udev, "'%s' value replaced with '%s'\n", name, value); + free(entry_loop->value); + if (value == NULL) { + entry_loop->value = NULL; + info(udev, "'%s' value unset\n", name); + return entry_loop; } + entry_loop->value = strdup(value); + if (entry_loop->value == NULL) + return NULL; + info(udev, "'%s' value replaced with '%s'\n", name, value); return entry_loop; } } @@ -151,13 +148,16 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_ list_entry_insert_before(entry_new, entry_loop); else list_entry_append(entry_new, list); + info(udev, "'%s=%s' added\n", entry_new->name, entry_new->value); return entry_new; } -void udev_list_entry_move_to_end(struct udev_list_entry *list_entry) +void udev_list_entry_remove(struct udev_list_entry *entry) { - list_node_remove(&list_entry->node); - list_node_insert_between(&list_entry->node, list_entry->list->prev, list_entry->list); + list_node_remove(&entry->node); + free(entry->name); + free(entry->value); + free(entry); } void udev_list_cleanup(struct udev *udev, struct udev_list_node *list) @@ -165,12 +165,14 @@ void udev_list_cleanup(struct udev *udev, struct udev_list_node *list) struct udev_list_entry *entry_loop; struct udev_list_entry *entry_tmp; - list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) { + list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) udev_list_entry_remove(entry_loop); - free(entry_loop->name); - free(entry_loop->value); - free(entry_loop); - } +} + +void udev_list_entry_move_to_end(struct udev_list_entry *list_entry) +{ + list_node_remove(&list_entry->node); + list_node_insert_between(&list_entry->node, list_entry->list->prev, list_entry->list); } struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) -- cgit v1.2.3-54-g00ecf From 6a95b1e7d6290293061e551eac679aee9ea21611 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 13:34:11 +0200 Subject: libudev: ctrl - fix typo in set_env() --- udev/lib/libudev-ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index 268ce2d353..75356b1d5f 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -30,6 +30,7 @@ #include "libudev.h" #include "libudev-private.h" +/* last known version with this wire protocol */ #define UDEV_CTRL_MAGIC "udevd-128" enum udev_ctrl_msg_type { @@ -189,7 +190,7 @@ int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl) int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key) { - ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, optarg); + ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key); return 0; } -- cgit v1.2.3-54-g00ecf From f183b6ed766a18835d53dc1e36a4e98756ebd0b7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 13:51:29 +0200 Subject: libudev: add global property list --- extras/ata_id/Makefile.am | 1 + extras/cdrom_id/Makefile.am | 1 + extras/edd_id/Makefile.am | 1 + extras/floppy/Makefile.am | 1 + extras/fstab_import/Makefile.am | 1 + extras/scsi_id/Makefile.am | 1 + extras/volume_id/Makefile.am | 1 + udev/lib/libudev-private.h | 2 ++ udev/lib/libudev.c | 30 +++++++++++++++++++++++++++++- 9 files changed, 38 insertions(+), 1 deletion(-) diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index 34ded29ded..47ab0d6631 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -8,6 +8,7 @@ ata_id_SOURCES = \ ata_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c dist_man_MANS = \ diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index f8c4bbff0a..bb97d96dc0 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -12,6 +12,7 @@ cdrom_id_SOURCES = \ cdrom_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c dist_man_MANS = \ diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 67199fd235..28ff8aa46e 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -12,6 +12,7 @@ edd_id_SOURCES = \ edd_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c dist_man_MANS = \ diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 357129e336..0b154498d0 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -8,6 +8,7 @@ create_floppy_devices_SOURCES = \ create_floppy_devices.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c \ ../../udev/udev_utils.c diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index c1204782b5..d16c681ad1 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -12,6 +12,7 @@ fstab_import_SOURCES = \ fstab_import.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c distclean-local: diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index e6798eea60..08da1c9de5 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -12,6 +12,7 @@ scsi_id_SOURCES = \ bsg.h \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c dist_sysconf_DATA = \ diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index 5b68e4321d..c58f1a8782 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -11,6 +11,7 @@ vol_id_SOURCES = \ vol_id.c \ ../../udev/lib/libudev.h \ ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c vol_id_LDADD = \ diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index e9f2c9893b..60d995aa78 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -50,6 +50,8 @@ void udev_log(struct udev *udev, extern struct udev_device *device_new(struct udev *udev); extern const char *udev_get_rules_path(struct udev *udev); extern int udev_get_run(struct udev *udev); +extern struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); +extern struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); /* libudev-device */ extern int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 3f7d0e547e..c698be6e46 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -38,6 +38,7 @@ struct udev { char *sys_path; char *dev_path; char *rules_path; + struct udev_list_node properties_list; int log_priority; int run; }; @@ -102,6 +103,7 @@ struct udev *udev_new(void) udev->refcount = 1; udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; + udev_list_init(&udev->properties_list); udev->run = 1; udev->dev_path = strdup(UDEV_PREFIX "/dev"); udev->sys_path = strdup("/sys"); @@ -117,6 +119,7 @@ struct udev *udev_new(void) free(udev->sys_path); udev->sys_path = strdup(env); util_remove_trailing_chars(udev->sys_path, '/'); + udev_add_property(udev, "SYSFS_PATH", udev->sys_path); } env = getenv("UDEV_RUN"); @@ -219,11 +222,12 @@ struct udev *udev_new(void) free(udev->dev_path); udev->dev_path = strdup(env); util_remove_trailing_chars(udev->dev_path, '/'); + udev_add_property(udev, "UDEV_ROOT", udev->dev_path); } env = getenv("UDEV_LOG"); if (env != NULL) - udev->log_priority = util_log_priority(env); + udev_set_log_priority(udev, util_log_priority(env)); if (udev->dev_path == NULL || udev->sys_path == NULL) goto err; @@ -274,6 +278,7 @@ void udev_unref(struct udev *udev) udev->refcount--; if (udev->refcount > 0) return; + udev_list_cleanup(udev, &udev->properties_list); free(udev->dev_path); free(udev->sys_path); free(udev->rules_path); @@ -307,7 +312,11 @@ int udev_get_log_priority(struct udev *udev) void udev_set_log_priority(struct udev *udev, int priority) { + char num[32]; + udev->log_priority = priority; + snprintf(num, sizeof(num), "%u", udev->log_priority); + udev_add_property(udev, "UDEV_LOG", num); } const char *udev_get_rules_path(struct udev *udev) @@ -353,3 +362,22 @@ const char *udev_get_dev_path(struct udev *udev) return NULL; return udev->dev_path; } + +struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) +{ + if (value == NULL) { + struct udev_list_entry *list_entry; + + list_entry = udev_get_properties_list_entry(udev); + list_entry = udev_list_entry_get_by_name(list_entry, key); + if (list_entry != NULL) + udev_list_entry_remove(list_entry); + return NULL; + } + return udev_list_entry_add(udev, &udev->properties_list, key, value, 1, 0); +} + +struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) +{ + return udev_list_get_entry(&udev->properties_list); +} -- cgit v1.2.3-54-g00ecf From ebacd6ecc301cb4cdacd1a18f6514c4a839f5999 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 13:53:16 +0200 Subject: libudev: device - copy global properties, unset empty properties --- udev/lib/libudev-device.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index acab263785..daf2217765 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -231,6 +231,7 @@ void udev_device_set_info_loaded(struct udev_device *device) struct udev_device *device_new(struct udev *udev) { struct udev_device *udev_device; + struct udev_list_entry *list_entry; if (udev == NULL) return NULL; @@ -245,6 +246,11 @@ struct udev_device *device_new(struct udev *udev) udev_list_init(&udev_device->properties_list); udev_list_init(&udev_device->attr_list); udev_device->event_timeout = -1; + /* copy global properties */ + udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) + udev_device_add_property(udev_device, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); info(udev_device->udev, "udev_device: %p created\n", udev_device); return udev_device; } @@ -969,6 +975,15 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { udev_device->envp_uptodate = 0; + if (value == NULL) { + struct udev_list_entry *list_entry; + + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + if (list_entry != NULL) + udev_list_entry_remove(list_entry); + return NULL; + } return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); } -- cgit v1.2.3-54-g00ecf From d56f94d1680dfaac9f0c40541548df32bf65b6ea Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 17:10:47 +0200 Subject: volume_id: btrfs - update magic to latest disk format --- extras/volume_id/lib/btrfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/btrfs.c b/extras/volume_id/lib/btrfs.c index 660e6dab38..75a9b0a9a9 100644 --- a/extras/volume_id/lib/btrfs.c +++ b/extras/volume_id/lib/btrfs.c @@ -81,7 +81,7 @@ int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size) if (buf == NULL) return -1; bfs = (struct btrfs_super_block *)buf; - if (memcmp(bfs->magic, "_B9RfS_M", 8) != 0) + if (memcmp(bfs->magic, "_BBRfS_M", 8) != 0) return -1; volume_id_set_uuid(id, bfs->fsid, 0, UUID_DCE); volume_id_set_label_raw(id, bfs->label, 256); -- cgit v1.2.3-54-g00ecf From aa8734ffcb8a895fc8d66ff383cbcf8f4b78f562 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 17:16:58 +0200 Subject: udevd: use libudev --- udev/Makefile.am | 2 - udev/lib/libudev-device.c | 4 +- udev/lib/libudev-private.h | 1 + udev/test-udev.c | 66 ++- udev/udev.h | 126 ++---- udev/udev_db.c | 299 +++----------- udev/udev_device.c | 84 ---- udev/udev_device_event.c | 235 ++++++----- udev/udev_node.c | 469 +++++++++++++--------- udev/udev_rules.c | 978 +++++++++++++++++++++++---------------------- udev/udev_rules.h | 8 +- udev/udev_sysfs.c | 499 ----------------------- udev/udevadm-info.c | 6 +- udev/udevadm-test.c | 129 ++---- udev/udevadm.c | 2 - udev/udevd.c | 605 ++++++++++------------------ 16 files changed, 1286 insertions(+), 2227 deletions(-) delete mode 100644 udev/udev_device.c delete mode 100644 udev/udev_sysfs.c diff --git a/udev/Makefile.am b/udev/Makefile.am index c0df391d6f..ff8b275552 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -17,12 +17,10 @@ common_files = \ udev_rules.h \ udev_sysdeps.h \ udev_db.c \ - udev_device.c \ udev_device_event.c \ udev_node.c \ udev_rules.c \ udev_rules_parse.c \ - udev_sysfs.c \ udev_utils.c \ udev_utils_file.c \ list.h \ diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index daf2217765..65ba6e30d8 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -75,7 +75,7 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f return util_path_encode(&filename[start], len - start); } -static int device_read_db(struct udev_device *udev_device) +int udev_device_read_db(struct udev_device *udev_device) { struct stat stats; char filename[UTIL_PATH_SIZE]; @@ -220,7 +220,7 @@ static void device_load_info(struct udev_device *device) { device->info_loaded = 1; udev_device_read_uevent_file(device); - device_read_db(device); + udev_device_read_db(device); } void udev_device_set_info_loaded(struct udev_device *device) diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 60d995aa78..5290bc8018 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -62,6 +62,7 @@ extern void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); extern struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); extern struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); extern char **udev_device_get_properties_envp(struct udev_device *udev_device); +extern int udev_device_read_db(struct udev_device *udev_device); extern int udev_device_read_uevent_file(struct udev_device *udev_device); extern int udev_device_set_action(struct udev_device *udev_device, const char *action); extern int udev_device_set_driver(struct udev_device *udev_device, const char *driver); diff --git a/udev/test-udev.c b/udev/test-udev.c index 508f9f1408..6c327a6e08 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -45,20 +45,20 @@ static void asmlinkage sig_handler(int signum) int main(int argc, char *argv[]) { struct udev *udev; - struct sysfs_device *dev; - struct udevice *udevice; - const char *maj, *min; + struct udev_event *event; + struct udev_device *dev; struct udev_rules rules; - const char *action; + char syspath[UTIL_PATH_SIZE]; const char *devpath; + const char *action; const char *subsystem; struct sigaction act; - int retval = -EINVAL; + int err = -EINVAL; udev = udev_new(); if (udev == NULL) exit(1); - dbg(udev, "version %s\n", VERSION); + info(udev, "version %s\n", VERSION); selinux_init(udev); /* set signal handlers */ @@ -76,65 +76,45 @@ int main(int argc, char *argv[]) action = getenv("ACTION"); devpath = getenv("DEVPATH"); subsystem = getenv("SUBSYSTEM"); - /* older kernels passed the SUBSYSTEM only as argument */ - if (subsystem == NULL && argc == 2) - subsystem = argv[1]; if (action == NULL || subsystem == NULL || devpath == NULL) { err(udev, "action, subsystem or devpath missing\n"); goto exit; } - /* export log_priority , as called programs may want to do the same as udev */ - if (udev_get_log_priority(udev) > 0) { - char priority[32]; - - sprintf(priority, "%i", udev_get_log_priority(udev)); - setenv("UDEV_LOG", priority, 1); - } - - sysfs_init(); udev_rules_init(udev, &rules, 0); - dev = sysfs_device_get(udev, devpath); + util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); + util_strlcat(syspath, devpath, sizeof(syspath)); + dev = udev_device_new_from_syspath(udev, syspath); if (dev == NULL) { - info(udev, "unable to open '%s'\n", devpath); + info(udev, "unknown device '%s'\n", devpath); goto fail; } - udevice = udev_device_init(udev); - if (udevice == NULL) - goto fail; - - /* override built-in sysfs device */ - udevice->dev = dev; - util_strlcpy(udevice->action, action, sizeof(udevice->action)); - - /* get dev_t from environment, which is needed for "remove" to work, "add" works also from sysfs */ - maj = getenv("MAJOR"); - min = getenv("MINOR"); - if (maj != NULL && min != NULL) - udevice->devt = makedev(atoi(maj), atoi(min)); - else - udevice->devt = udev_device_get_devt(udevice); + /* skip reading of db, but read kernel parameters */ + udev_device_set_info_loaded(dev); + udev_device_read_uevent_file(dev); - retval = udev_device_event(&rules, udevice); + udev_device_set_action(dev, action); + event = udev_event_new(dev); + err = udev_event_run(event, &rules); /* rules may change/disable the timeout */ - if (udevice->event_timeout >= 0) - alarm(udevice->event_timeout); + if (udev_device_get_event_timeout(dev) >= 0) + alarm(udev_device_get_event_timeout(dev)); - if (retval == 0 && !udevice->ignore_device && udev_get_run(udev)) - udev_rules_run(udevice); + if (err == 0 && !event->ignore_device && udev_get_run(udev)) + udev_rules_run(event); - udev_device_cleanup(udevice); + udev_event_unref(event); + udev_device_unref(dev); fail: udev_rules_cleanup(&rules); - sysfs_cleanup(); exit: selinux_exit(udev); udev_unref(udev); - if (retval != 0) + if (err != 0) return 1; return 0; } diff --git a/udev/udev.h b/udev/udev.h index 6a685e6758..896a466762 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -23,7 +23,6 @@ #include #include "udev_sysdeps.h" -#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 1 #include "lib/libudev.h" #include "lib/libudev-private.h" #include "list.h" @@ -49,52 +48,6 @@ struct udev_rules; -struct sysfs_device { - struct list_head node; /* for device cache */ - struct sysfs_device *parent; /* already cached parent*/ - char devpath[UTIL_PATH_SIZE]; - char subsystem[UTIL_NAME_SIZE]; - char kernel[UTIL_NAME_SIZE]; /* device instance name */ - char kernel_number[UTIL_NAME_SIZE]; - char driver[UTIL_NAME_SIZE]; -}; - -struct udevice { - struct udev *udev; - - /* device event */ - struct sysfs_device *dev; /* points to dev_local by default */ - struct sysfs_device dev_local; - struct sysfs_device *dev_parent; /* current parent device used for matching */ - char action[UTIL_NAME_SIZE]; - char *devpath_old; - - /* node */ - char name[UTIL_PATH_SIZE]; - struct list_head symlink_list; - int symlink_final; - char owner[UTIL_NAME_SIZE]; - int owner_final; - char group[UTIL_NAME_SIZE]; - int group_final; - mode_t mode; - int mode_final; - dev_t devt; - - /* event processing */ - struct list_head run_list; - int run_final; - struct list_head env_list; - char tmp_node[UTIL_PATH_SIZE]; - int partitions; - int ignore_device; - int ignore_remove; - char program_result[UTIL_PATH_SIZE]; - int link_priority; - int event_timeout; - int test_run; -}; - static inline void logging_init(const char *program_name) { openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); @@ -112,40 +65,48 @@ static inline void logging_close(void) closelog(); } -/* udev_device.c */ -extern struct udevice *udev_device_init(struct udev *udev); -extern void udev_device_cleanup(struct udevice *udevice); -extern dev_t udev_device_get_devt(struct udevice *udevice); - -/* udev_device_event.c */ -extern int udev_device_event(struct udev_rules *rules, struct udevice *udevice); - -/* udev_sysfs.c */ -extern int sysfs_init(void); -extern void sysfs_cleanup(void); -extern void sysfs_device_set_values(struct udev *udev, - struct sysfs_device *dev, const char *devpath, - const char *subsystem, const char *driver); -extern struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath); -extern struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_device *dev); -extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct udev *udev, struct sysfs_device *dev, const char *subsystem); -extern char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *attr_name); -extern int sysfs_lookup_devpath_by_subsys_id(struct udev *udev, char *devpath, size_t len, const char *subsystem, const char *id); - -/* udev_node.c */ -extern int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid); -extern void udev_node_update_symlinks(struct udevice *udevice, struct udevice *udev_old); -extern int udev_node_add(struct udevice *udevice); -extern int udev_node_remove(struct udevice *udevice); - -/* udev_db.c */ -extern int udev_db_add_device(struct udevice *udevice); -extern int udev_db_delete_device(struct udevice *udevice); -extern int udev_db_rename(struct udev *udev, const char *devpath_old, const char *devpath); -extern int udev_db_get_device(struct udevice *udevice, const char *devpath); -extern int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list_head *name_list); - -/* udev_utils.c */ +/* udev-event.c */ +struct udev_event { + struct udev *udev; + struct udev_device *dev; + struct udev_device *dev_parent; + int devlink_final; + int owner_final; + int group_final; + int mode_final; + char tmp_node[UTIL_PATH_SIZE]; + char program_result[UTIL_PATH_SIZE]; + int run_final; + + char name[UTIL_PATH_SIZE]; + mode_t mode; + char owner[UTIL_NAME_SIZE]; + char group[UTIL_NAME_SIZE]; + struct udev_list_node run_list; + int ignore_device; + int test; + + struct list_head node; + pid_t pid; + int exitstatus; + time_t queue_time; +}; +extern struct udev_event *udev_event_new(struct udev_device *dev); +extern void udev_event_unref(struct udev_event *event); +extern int udev_event_run(struct udev_event *event, struct udev_rules *rules); + +/* udev-node.c */ +extern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid); +extern int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const char *group, int test); +extern int udev_node_remove(struct udev_device *dev, int test); +extern void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test); + +/* udev-device-db.c */ +extern int udev_device_update_db(struct udev_device *udev_device); +extern int udev_device_delete_db(struct udev_device *udev_device); +extern int udev_device_rename_db(struct udev_device *udev_device, const char *devpath); + +/* udev-util.c */ struct name_entry { struct list_head node; char name[UTIL_PATH_SIZE]; @@ -167,7 +128,7 @@ extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(void *buf, size_t bufsize); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); -/* udev_selinux */ +/* udev-selinux.c */ #ifndef USE_SELINUX static inline void selinux_init(struct udev *udev) {} static inline void selinux_exit(struct udev *udev) {} @@ -189,5 +150,4 @@ extern int udevadm_control(struct udev *udev, int argc, char *argv[]); extern int udevadm_trigger(struct udev *udev, int argc, char *argv[]); extern int udevadm_settle(struct udev *udev, int argc, char *argv[]); extern int udevadm_test(struct udev *udev, int argc, char *argv[]); - #endif diff --git a/udev/udev_db.c b/udev/udev_db.c index e03c2782a3..17e989310e 100644 --- a/udev/udev_db.c +++ b/udev/udev_db.c @@ -1,6 +1,5 @@ /* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2004-2008 Kay Sievers + * Copyright (C) 2008 Kay Sievers * * 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 @@ -23,10 +22,7 @@ #include #include #include -#include -#include #include -#include #include "udev.h" @@ -41,282 +37,99 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f return util_path_encode(&filename[start], len - start); } -/* reverse mapping from the device file name to the devpath */ -static int name_index(struct udev *udev, const char *devpath, const char *name, int add) -{ - char device[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE * 2]; - size_t start; - int fd; - - /* directory with device name */ - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - start = util_strlcat(filename, "/.udev/names/", sizeof(filename)); - util_strlcat(filename, name, sizeof(filename)); - util_path_encode(&filename[start], sizeof(filename) - start); - /* entry with the devpath */ - util_strlcpy(device, devpath, sizeof(device)); - util_path_encode(device, sizeof(device)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, device, sizeof(filename)); - - if (add) { - info(udev, "creating index: '%s'\n", filename); - create_path(udev, filename); - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd > 0) - close(fd); - } else { - info(udev, "removing index: '%s'\n", filename); - unlink(filename); - delete_path(udev, filename); - } - return 0; -} - -int udev_db_get_devices_by_name(struct udev *udev, const char *name, struct list_head *name_list) -{ - char dirname[PATH_MAX]; - size_t start; - DIR *dir; - int rc = 0; - - util_strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); - start = util_strlcat(dirname, "/.udev/names/", sizeof(dirname)); - util_strlcat(dirname, name, sizeof(dirname)); - util_path_encode(&dirname[start], sizeof(dirname) - start); - - dir = opendir(dirname); - if (dir == NULL) { - info(udev, "no index directory '%s': %m\n", dirname); - rc = -1; - goto out; - } - - info(udev, "found index directory '%s'\n", dirname); - while (1) { - struct dirent *ent; - char device[UTIL_PATH_SIZE]; - - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - if (ent->d_name[0] == '.') - continue; - - util_strlcpy(device, ent->d_name, sizeof(device)); - util_path_decode(device); - name_list_add(udev, name_list, device, 0); - rc++; - } - closedir(dir); -out: - return rc; -} - -int udev_db_rename(struct udev *udev, const char *devpath_old, const char *devpath) -{ - char filename[UTIL_PATH_SIZE]; - char filename_old[UTIL_PATH_SIZE]; - - devpath_to_db_path(udev, devpath_old, filename_old, sizeof(filename_old)); - devpath_to_db_path(udev, devpath, filename, sizeof(filename)); - return rename(filename_old, filename); -} - -int udev_db_add_device(struct udevice *udevice) +int udev_device_update_db(struct udev_device *udev_device) { + struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; FILE *f; - struct name_entry *name_loop; char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ + size_t devlen = strlen(udev_get_dev_path(udev))+1; + struct udev_list_entry *list_entry; int ret; - if (udevice->test_run) - return 0; - - devpath_to_db_path(udevice->udev, udevice->dev->devpath, filename, sizeof(filename)); - create_path(udevice->udev, filename); + devpath_to_db_path(udev, + udev_device_get_devpath(udev_device), + filename, sizeof(filename)); + create_path(udev, filename); unlink(filename); - if (!list_empty(&udevice->env_list)) + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) + if (udev_list_entry_get_flag(list_entry)) + goto file; + if (udev_device_get_num_fake_partitions(udev_device)) goto file; - if (udevice->partitions || udevice->ignore_remove) + if (udev_device_get_ignore_remove(udev_device)) goto file; - /* try not to waste tmpfs memory, store values, if they fit, in a symlink target */ - util_strlcpy(target, udevice->name, sizeof(target)); - list_for_each_entry(name_loop, &udevice->symlink_list, node) { + /* try not to waste tmpfs memory; store values, if they fit, in a symlink target */ + util_strlcpy(target, &udev_device_get_devnode(udev_device)[devlen], sizeof(target)); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) { size_t len; util_strlcat(target, " ", sizeof(target)); - len = util_strlcat(target, name_loop->name, sizeof(target)); + len = util_strlcat(target, &udev_list_entry_get_name(list_entry)[devlen], sizeof(target)); if (len >= sizeof(target)) { - info(udevice->udev, "size of links too large, create file\n"); + info(udev, "size of links too large, create file\n"); goto file; } } - /* add symlink names to index */ - list_for_each_entry(name_loop, &udevice->symlink_list, node) { - name_index(udevice->udev, udevice->dev->devpath, name_loop->name, 1); - } - info(udevice->udev, "create db link (%s)\n", target); - udev_selinux_setfscreatecon(udevice->udev, filename, S_IFLNK); + info(udev, "create db link (%s)\n", target); + udev_selinux_setfscreatecon(udev, filename, S_IFLNK); ret = symlink(target, filename); - udev_selinux_resetfscreatecon(udevice->udev); + udev_selinux_resetfscreatecon(udev); if (ret == 0) goto out; file: f = fopen(filename, "w"); if (f == NULL) { - err(udevice->udev, "unable to create db file '%s': %m\n", filename); + err(udev, "unable to create db file '%s': %m\n", filename); return -1; } - info(udevice->udev, "created db file for '%s' in '%s'\n", udevice->dev->devpath, filename); - - fprintf(f, "N:%s\n", udevice->name); - list_for_each_entry(name_loop, &udevice->symlink_list, node) { - fprintf(f, "S:%s\n", name_loop->name); - /* add symlink names to index */ - name_index(udevice->udev, udevice->dev->devpath, name_loop->name, 1); + info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); + + fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) + fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + if (udev_device_get_devlink_priority(udev_device) != 0) + fprintf(f, "L:%u\n", udev_device_get_devlink_priority(udev_device)); + if (udev_device_get_event_timeout(udev_device) >= 0) + fprintf(f, "T:%u\n", udev_device_get_event_timeout(udev_device)); + if (udev_device_get_num_fake_partitions(udev_device) != 0) + fprintf(f, "A:%u\n", udev_device_get_num_fake_partitions(udev_device)); + if (udev_device_get_ignore_remove(udev_device)) + fprintf(f, "R:%u\n", udev_device_get_ignore_remove(udev_device)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + if (!udev_list_entry_get_flag(list_entry)) + continue; + fprintf(f, "E:%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); } - fprintf(f, "M:%u:%u\n", major(udevice->devt), minor(udevice->devt)); - if (udevice->link_priority != 0) - fprintf(f, "L:%u\n", udevice->link_priority); - if (udevice->event_timeout >= 0) - fprintf(f, "T:%u\n", udevice->event_timeout); - if (udevice->partitions != 0) - fprintf(f, "A:%u\n", udevice->partitions); - if (udevice->ignore_remove) - fprintf(f, "R:%u\n", udevice->ignore_remove); - list_for_each_entry(name_loop, &udevice->env_list, node) - fprintf(f, "E:%s\n", name_loop->name); fclose(f); out: - /* add name to index */ - name_index(udevice->udev, udevice->dev->devpath, udevice->name, 1); return 0; } -int udev_db_get_device(struct udevice *udevice, const char *devpath) +int udev_device_delete_db(struct udev_device *udev_device) { - struct stat stats; char filename[UTIL_PATH_SIZE]; - char line[UTIL_PATH_SIZE]; - unsigned int maj, min; - char *bufline; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - - sysfs_device_set_values(udevice->udev, udevice->dev, devpath, NULL, NULL); - devpath_to_db_path(udevice->udev, devpath, filename, sizeof(filename)); - - if (lstat(filename, &stats) != 0) { - info(udevice->udev, "no db file to read %s: %m\n", filename); - return -1; - } - if ((stats.st_mode & S_IFMT) == S_IFLNK) { - char target[UTIL_NAME_SIZE]; - int target_len; - char *next; - - info(udevice->udev, "found db symlink\n"); - target_len = readlink(filename, target, sizeof(target)); - if (target_len > 0) - target[target_len] = '\0'; - else { - info(udevice->udev, "error reading db link %s: %m\n", filename); - return -1; - } - next = strchr(target, ' '); - if (next != NULL) { - next[0] = '\0'; - next = &next[1]; - } - info(udevice->udev, "got db link node: '%s'\n", target); - util_strlcpy(udevice->name, target, sizeof(udevice->name)); - while (next != NULL) { - char *lnk; - - lnk = next; - next = strchr(next, ' '); - if (next != NULL) { - next[0] = '\0'; - next = &next[1]; - } - info(udevice->udev, "got db link link: '%s'\n", lnk); - name_list_add(udevice->udev, &udevice->symlink_list, lnk, 0); - } - return 0; - } - - if (file_map(filename, &buf, &bufsize) != 0) { - info(udevice->udev, "error reading db file %s: %m\n", filename); - return -1; - } - - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - - if (count > sizeof(line)) - count = sizeof(line); - memcpy(line, &bufline[2], count-2); - line[count-2] = '\0'; - - switch(bufline[0]) { - case 'N': - util_strlcpy(udevice->name, line, sizeof(udevice->name)); - break; - case 'M': - sscanf(line, "%u:%u", &maj, &min); - udevice->devt = makedev(maj, min); - break; - case 'S': - name_list_add(udevice->udev, &udevice->symlink_list, line, 0); - break; - case 'L': - udevice->link_priority = atoi(line); - break; - case 'T': - udevice->event_timeout = atoi(line); - break; - case 'A': - udevice->partitions = atoi(line); - break; - case 'R': - udevice->ignore_remove = atoi(line); - break; - case 'E': - name_list_add(udevice->udev, &udevice->env_list, line, 0); - break; - } - } - file_unmap(buf, bufsize); - - if (udevice->name[0] == '\0') - return -1; + devpath_to_db_path(udev_device_get_udev(udev_device), + udev_device_get_devpath(udev_device), + filename, sizeof(filename)); + unlink(filename); return 0; } -int udev_db_delete_device(struct udevice *udevice) +int udev_device_rename_db(struct udev_device *udev_device, const char *devpath_old) { + char filename_old[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE]; - struct name_entry *name_loop; - - if (udevice->test_run) - return 0; - - devpath_to_db_path(udevice->udev, udevice->dev->devpath, filename, sizeof(filename)); - unlink(filename); - name_index(udevice->udev, udevice->dev->devpath, udevice->name, 0); - list_for_each_entry(name_loop, &udevice->symlink_list, node) - name_index(udevice->udev, udevice->dev->devpath, name_loop->name, 0); - - return 0; + devpath_to_db_path(udev_device_get_udev(udev_device), + devpath_old, + filename_old, sizeof(filename_old)); + devpath_to_db_path(udev_device_get_udev(udev_device), + udev_device_get_devpath(udev_device), + filename, sizeof(filename)); + return rename(filename_old, filename); } diff --git a/udev/udev_device.c b/udev/udev_device.c deleted file mode 100644 index 751b7cd91f..0000000000 --- a/udev/udev_device.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" - - -struct udevice *udev_device_init(struct udev *udev) -{ - struct udevice *udevice; - - udevice = malloc(sizeof(struct udevice)); - if (udevice == NULL) - return NULL; - memset(udevice, 0x00, sizeof(struct udevice)); - - udevice->udev = udev; - - INIT_LIST_HEAD(&udevice->symlink_list); - INIT_LIST_HEAD(&udevice->run_list); - INIT_LIST_HEAD(&udevice->env_list); - - /* set sysfs device to local storage, can be overridden if needed */ - udevice->dev = &udevice->dev_local; - - /* default node permissions */ - udevice->mode = 0660; - strcpy(udevice->owner, "root"); - strcpy(udevice->group, "root"); - - udevice->event_timeout = -1; - return udevice; -} - -void udev_device_cleanup(struct udevice *udevice) -{ - if (udevice == NULL) - return; - name_list_cleanup(udevice->udev, &udevice->symlink_list); - name_list_cleanup(udevice->udev, &udevice->run_list); - name_list_cleanup(udevice->udev, &udevice->env_list); - free(udevice); -} - -dev_t udev_device_get_devt(struct udevice *udevice) -{ - const char *attr; - unsigned int maj, min; - - /* read it from sysfs */ - attr = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, "dev"); - if (attr != NULL) { - if (sscanf(attr, "%u:%u", &maj, &min) == 2) - return makedev(maj, min); - } - return makedev(0, 0); -} diff --git a/udev/udev_device_event.c b/udev/udev_device_event.c index 4408400ff8..e5d716085a 100644 --- a/udev/udev_device_event.c +++ b/udev/udev_device_event.c @@ -31,6 +31,33 @@ #include "udev.h" #include "udev_rules.h" +struct udev_event *udev_event_new(struct udev_device *dev) +{ + struct udev_event *event; + + event = malloc(sizeof(struct udev_event)); + if (event == NULL) + return NULL; + memset(event, 0x00, sizeof(struct udev_event)); + + event->dev = dev; + event->udev = udev_device_get_udev(dev); + udev_list_init(&event->run_list); + event->mode = 0660; + util_strlcpy(event->owner, "0", sizeof(event->owner)); + util_strlcpy(event->group, "0", sizeof(event->group)); + + dbg(event->udev, "allocated event %p\n", event); + return event; +} + +void udev_event_unref(struct udev_event *event) +{ + udev_list_cleanup(event->udev, &event->run_list); + dbg(event->udev, "free event %p\n", event); + free(event); +} + static void kernel_log(struct ifreq ifr) { int klog; @@ -51,209 +78,209 @@ static void kernel_log(struct ifreq ifr) fclose(f); } -static int rename_netif(struct udevice *udevice) +static int rename_netif(struct udev_event *event) { + struct udev_device *dev = event->dev; int sk; struct ifreq ifr; - int retval; + int err; - info(udevice->udev, "changing net interface name from '%s' to '%s'\n", udevice->dev->kernel, udevice->name); - if (udevice->test_run) + info(event->udev, "changing net interface name from '%s' to '%s'\n", + udev_device_get_sysname(dev), event->name); + if (event->test) return 0; sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { - err(udevice->udev, "error opening socket: %m\n"); + err(event->udev, "error opening socket: %m\n"); return -1; } memset(&ifr, 0x00, sizeof(struct ifreq)); - util_strlcpy(ifr.ifr_name, udevice->dev->kernel, IFNAMSIZ); - util_strlcpy(ifr.ifr_newname, udevice->name, IFNAMSIZ); - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval == 0) + util_strlcpy(ifr.ifr_name, udev_device_get_sysname(dev), IFNAMSIZ); + util_strlcpy(ifr.ifr_newname, event->name, IFNAMSIZ); + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err == 0) kernel_log(ifr); else { int loop; /* see if the destination interface name already exists */ if (errno != EEXIST) { - err(udevice->udev, "error changing netif name %s to %s: %m\n", + err(event->udev, "error changing netif name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); goto exit; } /* free our own name, another process may wait for us */ - util_strlcpy(ifr.ifr_newname, udevice->dev->kernel, IFNAMSIZ); + util_strlcpy(ifr.ifr_newname, udev_device_get_sysname(dev), IFNAMSIZ); util_strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval != 0) { - err(udevice->udev, "error changing netif name %s to %s: %m\n", + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err != 0) { + err(event->udev, "error changing netif name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); goto exit; } /* wait 30 seconds for our target to become available */ util_strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); - util_strlcpy(ifr.ifr_newname, udevice->name, IFNAMSIZ); + util_strlcpy(ifr.ifr_newname, udev_device_get_devnode(dev), IFNAMSIZ); loop = 30 * 20; while (loop--) { - retval = ioctl(sk, SIOCSIFNAME, &ifr); - if (retval == 0) { + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err == 0) { kernel_log(ifr); break; } if (errno != EEXIST) { - err(udevice->udev, "error changing net interface name %s to %s: %m\n", + err(event->udev, "error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); break; } - dbg(udevice->udev, "wait for netif '%s' to become free, loop=%i\n", - udevice->name, (30 * 20) - loop); + dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", + udev_device_get_devnode(dev), (30 * 20) - loop); usleep(1000 * 1000 / 20); } } exit: close(sk); - return retval; + return err; } -int udev_device_event(struct udev_rules *rules, struct udevice *udevice) +int udev_event_run(struct udev_event *event, struct udev_rules *rules) { - int retval = 0; + struct udev_device *dev = event->dev; + int err = 0; - if (udevice->devpath_old != NULL) - if (udev_db_rename(udevice->udev, udevice->devpath_old, udevice->dev->devpath) == 0) - info(udevice->udev, "moved database from '%s' to '%s'\n", udevice->devpath_old, udevice->dev->devpath); + if (udev_device_get_devpath_old(dev) != NULL) { + if (udev_device_rename_db(dev, udev_device_get_devpath(dev)) == 0) + info(event->udev, "moved database from '%s' to '%s'\n", + udev_device_get_devpath_old(dev), udev_device_get_devpath(dev)); + } /* add device node */ - if (major(udevice->devt) != 0 && - (strcmp(udevice->action, "add") == 0 || strcmp(udevice->action, "change") == 0)) { - struct udevice *udevice_old; + if (major(udev_device_get_devnum(dev)) != 0 && + (strcmp(udev_device_get_action(dev), "add") == 0 || strcmp(udev_device_get_action(dev), "change") == 0)) { + char filename[UTIL_PATH_SIZE]; + struct udev_device *dev_old; - dbg(udevice->udev, "device node add '%s'\n", udevice->dev->devpath); + dbg(event->udev, "device node add '%s'\n", udev_device_get_devpath(dev)); - udev_rules_get_name(rules, udevice); - if (udevice->ignore_device) { - info(udevice->udev, "device event will be ignored\n"); + udev_rules_get_name(rules, event); + if (event->ignore_device) { + info(event->udev, "device event will be ignored\n"); goto exit; } - if (udevice->name[0] == '\0') { - info(udevice->udev, "device node creation supressed\n"); + + if (event->name[0] == '\0') { + info(event->udev, "device node creation supressed\n"); goto exit; } + /* set device node name */ + util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, event->name, sizeof(filename)); + udev_device_set_devnode(dev, filename); + /* read current database entry; cleanup, if it is known device */ - udevice_old = udev_device_init(udevice->udev); - if (udevice_old != NULL) { - udevice_old->test_run = udevice->test_run; - if (udev_db_get_device(udevice_old, udevice->dev->devpath) == 0) { - info(udevice->udev, "device '%s' already in database, cleanup\n", udevice->dev->devpath); - udev_db_delete_device(udevice_old); - } else { - udev_device_cleanup(udevice_old); - udevice_old = NULL; - } + dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); + if (dev_old != NULL) { + info(event->udev, "device '%s' already in database, updating\n", + udev_device_get_devpath(dev)); + udev_node_update_old_links(dev, dev_old, event->test); + udev_device_unref(dev_old); } - /* create node */ - retval = udev_node_add(udevice); - if (retval != 0) - goto exit; - - /* store in database */ - udev_db_add_device(udevice); + udev_device_update_db(dev); - /* create, replace, delete symlinks according to priority */ - udev_node_update_symlinks(udevice, udevice_old); + err = udev_node_add(dev, event->mode, event->owner, event->group, event->test); + if (err != 0) + goto exit; - if (udevice_old != NULL) - udev_device_cleanup(udevice_old); goto exit; } /* add netif */ - if (strcmp(udevice->dev->subsystem, "net") == 0 && strcmp(udevice->action, "add") == 0) { - dbg(udevice->udev, "netif add '%s'\n", udevice->dev->devpath); - udev_rules_get_name(rules, udevice); - if (udevice->ignore_device) { - info(udevice->udev, "device event will be ignored\n"); + if (strcmp(udev_device_get_subsystem(dev), "net") == 0 && strcmp(udev_device_get_action(dev), "add") == 0) { + dbg(event->udev, "netif add '%s'\n", udev_device_get_devpath(dev)); + + udev_rules_get_name(rules, event); + if (event->ignore_device) { + info(event->udev, "device event will be ignored\n"); goto exit; } - if (udevice->name[0] == '\0') { - info(udevice->udev, "device renaming supressed\n"); + if (event->name[0] == '\0') { + info(event->udev, "device renaming supressed\n"); goto exit; } /* look if we want to change the name of the netif */ - if (strcmp(udevice->name, udevice->dev->kernel) != 0) { - char devpath[PATH_MAX]; + if (strcmp(event->name, udev_device_get_sysname(dev)) != 0) { + char syspath[UTIL_PATH_SIZE]; char *pos; - retval = rename_netif(udevice); - if (retval != 0) + err = rename_netif(event); + if (err != 0) goto exit; - info(udevice->udev, "renamed netif to '%s'\n", udevice->name); + info(event->udev, "renamed netif to '%s'\n", event->name); - /* export old name */ - setenv("INTERFACE_OLD", udevice->dev->kernel, 1); + /* remember old name */ + udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); /* now change the devpath, because the kernel device name has changed */ - util_strlcpy(devpath, udevice->dev->devpath, sizeof(devpath)); - pos = strrchr(devpath, '/'); + util_strlcpy(syspath, udev_device_get_syspath(dev), sizeof(syspath)); + pos = strrchr(syspath, '/'); if (pos != NULL) { pos[1] = '\0'; - util_strlcat(devpath, udevice->name, sizeof(devpath)); - sysfs_device_set_values(udevice->udev, udevice->dev, devpath, NULL, NULL); - setenv("DEVPATH", udevice->dev->devpath, 1); - setenv("INTERFACE", udevice->name, 1); - info(udevice->udev, "changed devpath to '%s'\n", udevice->dev->devpath); + util_strlcat(syspath, event->name, sizeof(syspath)); + udev_device_set_syspath(event->dev, syspath); + udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); + info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); } } goto exit; } /* remove device node */ - if (major(udevice->devt) != 0 && strcmp(udevice->action, "remove") == 0) { - struct name_entry *name_loop; - - /* import database entry, and delete it */ - if (udev_db_get_device(udevice, udevice->dev->devpath) == 0) { - udev_db_delete_device(udevice); - /* restore stored persistent data */ - list_for_each_entry(name_loop, &udevice->env_list, node) - putenv(name_loop->name); - } else { - dbg(udevice->udev, "'%s' not found in database, using kernel name '%s'\n", - udevice->dev->devpath, udevice->dev->kernel); - util_strlcpy(udevice->name, udevice->dev->kernel, sizeof(udevice->name)); + if (major(udev_device_get_devnum(dev)) != 0 && strcmp(udev_device_get_action(dev), "remove") == 0) { + /* import database entry and delete it */ + udev_device_read_db(dev); + if (!event->test) + udev_device_delete_db(dev); + + if (udev_device_get_devnode(dev) == NULL) { + char devnode[UTIL_PATH_SIZE]; + + info(event->udev, "'%s' not found in database, using kernel name '%s'\n", + udev_device_get_syspath(dev), udev_device_get_sysname(dev)); + util_strlcpy(devnode, udev_get_dev_path(event->udev), sizeof(devnode)); + util_strlcat(devnode, "/", sizeof(devnode)); + util_strlcat(devnode, udev_device_get_sysname(dev), sizeof(devnode)); + udev_device_set_devnode(dev, devnode); } - udev_rules_get_run(rules, udevice); - if (udevice->ignore_device) { - info(udevice->udev, "device event will be ignored\n"); + udev_rules_get_run(rules, event); + if (event->ignore_device) { + info(event->udev, "device event will be ignored\n"); goto exit; } - if (udevice->ignore_remove) { - info(udevice->udev, "ignore_remove for '%s'\n", udevice->name); + if (udev_device_get_ignore_remove(dev)) { + info(event->udev, "ignore_remove for '%s'\n", udev_device_get_devnode(dev)); goto exit; } - /* remove the node */ - retval = udev_node_remove(udevice); - /* delete or restore symlinks according to priority */ - udev_node_update_symlinks(udevice, NULL); + err = udev_node_remove(dev, event->test); goto exit; } /* default devices */ - udev_rules_get_run(rules, udevice); - if (udevice->ignore_device) - info(udevice->udev, "device event will be ignored\n"); - + udev_rules_get_run(rules, event); + if (event->ignore_device) + info(event->udev, "device event will be ignored\n"); exit: - return retval; + return err; } diff --git a/udev/udev_node.c b/udev/udev_node.c index a43e5bd63f..425764242a 100644 --- a/udev/udev_node.c +++ b/udev/udev_node.c @@ -32,68 +32,108 @@ #define TMP_FILE_EXT ".udev-tmp" -int udev_node_mknod(struct udevice *udevice, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid) +/* reverse mapping from the device file name to the devpath */ +static int name_index(struct udev *udev, const char *devpath, const char *name, int add, int test) { + char device[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE * 2]; + size_t devlen = strlen(udev_get_dev_path(udev))+1; + size_t start; + int fd; + + /* directory with device name */ + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + start = util_strlcat(filename, "/.udev/names/", sizeof(filename)); + util_strlcat(filename, &name[devlen], sizeof(filename)); + util_path_encode(&filename[start], sizeof(filename) - start); + /* entry with the devpath */ + util_strlcpy(device, devpath, sizeof(device)); + util_path_encode(device, sizeof(device)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, device, sizeof(filename)); + + if (add) { + info(udev, "creating index: '%s'\n", filename); + create_path(udev, filename); + fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); + if (fd > 0) + close(fd); + } else { + info(udev, "removing index: '%s'\n", filename); + unlink(filename); + delete_path(udev, filename); + } + return 0; +} + +int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid) +{ + struct udev *udev = udev_device_get_udev(dev); char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; struct stat stats; int preserve = 0; int err = 0; - if (major(devt) != 0 && strcmp(udevice->dev->subsystem, "block") == 0) + if (major(devnum) == 0) + devnum = udev_device_get_devnum(dev); + + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) mode |= S_IFBLK; else mode |= S_IFCHR; + if (file == NULL) + file = udev_device_get_devnode(dev); + if (lstat(file, &stats) == 0) { - if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devt)) { - info(udevice->udev, "preserve file '%s', because it has correct dev_t\n", file); + if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) { + info(udev, "preserve file '%s', because it has correct dev_t\n", file); preserve = 1; - udev_selinux_lsetfilecon(udevice->udev, file, mode); + udev_selinux_lsetfilecon(udev, file, mode); } else { - info(udevice->udev, "atomically replace existing file '%s'\n", file); + info(udev, "atomically replace existing file '%s'\n", file); util_strlcpy(file_tmp, file, sizeof(file_tmp)); util_strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); unlink(file_tmp); - udev_selinux_setfscreatecon(udevice->udev, file_tmp, mode); - err = mknod(file_tmp, mode, devt); - udev_selinux_resetfscreatecon(udevice->udev); + udev_selinux_setfscreatecon(udev, file_tmp, mode); + err = mknod(file_tmp, mode, devnum); + udev_selinux_resetfscreatecon(udev); if (err != 0) { - err(udevice->udev, "mknod(%s, %#o, %u, %u) failed: %m\n", - file_tmp, mode, major(devt), minor(devt)); + err(udev, "mknod(%s, %#o, %u, %u) failed: %m\n", + file_tmp, mode, major(devnum), minor(devnum)); goto exit; } err = rename(file_tmp, file); if (err != 0) { - err(udevice->udev, "rename(%s, %s) failed: %m\n", file_tmp, file); + err(udev, "rename(%s, %s) failed: %m\n", file_tmp, file); unlink(file_tmp); } } } else { - info(udevice->udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devt), minor(devt)); - udev_selinux_setfscreatecon(udevice->udev, file, mode); - err = mknod(file, mode, devt); - udev_selinux_resetfscreatecon(udevice->udev); + info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); + udev_selinux_setfscreatecon(udev, file, mode); + err = mknod(file, mode, devnum); + udev_selinux_resetfscreatecon(udev); if (err != 0) { - err(udevice->udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", - file, mode, major(devt), minor(devt)); + err(udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", file, mode, major(devnum), minor(devnum)); goto exit; } } if (!preserve || stats.st_mode != mode) { - info(udevice->udev, "chmod(%s, %#o)\n", file, mode); + info(udev, "chmod(%s, %#o)\n", file, mode); err = chmod(file, mode); if (err != 0) { - err(udevice->udev, "chmod(%s, %#o) failed: %m\n", file, mode); + err(udev, "chmod(%s, %#o) failed: %m\n", file, mode); goto exit; } } if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { - info(udevice->udev, "chown(%s, %u, %u)\n", file, uid, gid); + info(udev, "chown(%s, %u, %u)\n", file, uid, gid); err = chown(file, uid, gid); if (err != 0) { - err(udevice->udev, "chown(%s, %u, %u) failed: %m\n", file, uid, gid); + err(udev, "chown(%s, %u, %u) failed: %m\n", file, uid, gid); goto exit; } } @@ -101,7 +141,7 @@ exit: return err; } -static int node_symlink(struct udevice *udevice, const char *node, const char *slink) +static int node_symlink(struct udev *udev, const char *node, const char *slink) { struct stat stats; char target[UTIL_PATH_SIZE] = ""; @@ -109,7 +149,7 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s int i = 0; int tail = 0; int len; - int retval = 0; + int err = 0; /* use relative link */ while (node[i] && (node[i] == slink[i])) { @@ -129,316 +169,357 @@ static int node_symlink(struct udevice *udevice, const char *node, const char *s if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { struct stat stats2; - info(udevice->udev, "found existing node instead of symlink '%s'\n", slink); + info(udev, "found existing node instead of symlink '%s'\n", slink); if (lstat(node, &stats2) == 0) { if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && stats.st_rdev == stats2.st_rdev) { - info(udevice->udev, "replace device node '%s' with symlink to our node '%s'\n", slink, node); + info(udev, "replace device node '%s' with symlink to our node '%s'\n", + slink, node); } else { - err(udevice->udev, "device node '%s' already exists, link to '%s' will not overwrite it\n", slink, node); + err(udev, "device node '%s' already exists, " + "link to '%s' will not overwrite it\n", + slink, node); goto exit; } } } else if (S_ISLNK(stats.st_mode)) { char buf[UTIL_PATH_SIZE]; - info(udevice->udev, "found existing symlink '%s'\n", slink); + info(udev, "found existing symlink '%s'\n", slink); len = readlink(slink, buf, sizeof(buf)); if (len > 0) { buf[len] = '\0'; if (strcmp(target, buf) == 0) { - info(udevice->udev, "preserve already existing symlink '%s' to '%s'\n", slink, target); - udev_selinux_lsetfilecon(udevice->udev, slink, S_IFLNK); + info(udev, "preserve already existing symlink '%s' to '%s'\n", + slink, target); + udev_selinux_lsetfilecon(udev, slink, S_IFLNK); goto exit; } } } } else { - info(udevice->udev, "creating symlink '%s' to '%s'\n", slink, target); - udev_selinux_setfscreatecon(udevice->udev, slink, S_IFLNK); - retval = symlink(target, slink); - udev_selinux_resetfscreatecon(udevice->udev); - if (retval == 0) + info(udev, "creating symlink '%s' to '%s'\n", slink, target); + udev_selinux_setfscreatecon(udev, slink, S_IFLNK); + err = symlink(target, slink); + udev_selinux_resetfscreatecon(udev); + if (err == 0) goto exit; } - info(udevice->udev, "atomically replace '%s'\n", slink); + info(udev, "atomically replace '%s'\n", slink); util_strlcpy(slink_tmp, slink, sizeof(slink_tmp)); util_strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); unlink(slink_tmp); - udev_selinux_setfscreatecon(udevice->udev, slink, S_IFLNK); - retval = symlink(target, slink_tmp); - udev_selinux_resetfscreatecon(udevice->udev); - if (retval != 0) { - err(udevice->udev, "symlink(%s, %s) failed: %m\n", target, slink_tmp); + udev_selinux_setfscreatecon(udev, slink, S_IFLNK); + err = symlink(target, slink_tmp); + udev_selinux_resetfscreatecon(udev); + if (err != 0) { + err(udev, "symlink(%s, %s) failed: %m\n", target, slink_tmp); goto exit; } - retval = rename(slink_tmp, slink); - if (retval != 0) { - err(udevice->udev, "rename(%s, %s) failed: %m\n", slink_tmp, slink); + err = rename(slink_tmp, slink); + if (err != 0) { + err(udev, "rename(%s, %s) failed: %m\n", slink_tmp, slink); unlink(slink_tmp); goto exit; } exit: - return retval; + return err; } -static int update_link(struct udevice *udevice, const char *name) +static int get_devices_by_name(struct udev *udev, const char *name, struct list_head *name_list) { + char dirname[PATH_MAX]; + size_t devlen = strlen(udev_get_dev_path(udev))+1; + size_t start; + DIR *dir; + int count = 0; + + util_strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); + start = util_strlcat(dirname, "/.udev/names/", sizeof(dirname)); + util_strlcat(dirname, &name[devlen], sizeof(dirname)); + util_path_encode(&dirname[start], sizeof(dirname) - start); + + dir = opendir(dirname); + if (dir == NULL) { + info(udev, "no index directory '%s': %m\n", dirname); + count = -1; + goto out; + } + + info(udev, "found index directory '%s'\n", dirname); + while (1) { + struct dirent *ent; + char device[UTIL_PATH_SIZE]; + + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + if (ent->d_name[0] == '.') + continue; + + util_strlcpy(device, udev_get_sys_path(udev), sizeof(device)); + util_strlcat(device, ent->d_name, sizeof(device)); + util_path_decode(device); + name_list_add(udev, name_list, device, 0); + count++; + } + closedir(dir); +out: + return count; +} + +static int update_link(struct udev_device *dev, const char *slink, int test) +{ + struct udev *udev = udev_device_get_udev(dev); LIST_HEAD(name_list); - char slink[UTIL_PATH_SIZE]; - char node[UTIL_PATH_SIZE]; - struct udevice *udevice_db; struct name_entry *device; char target[UTIL_PATH_SIZE] = ""; int count; int priority = 0; int rc = 0; - util_strlcpy(slink, udev_get_dev_path(udevice->udev), sizeof(slink)); - util_strlcat(slink, "/", sizeof(slink)); - util_strlcat(slink, name, sizeof(slink)); + info(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); - count = udev_db_get_devices_by_name(udevice->udev, name, &name_list); - info(udevice->udev, "found %i devices with name '%s'\n", count, name); + count = get_devices_by_name(udev, slink, &name_list); + info(udev, "found %i devices with name '%s'\n", count, slink); /* if we don't have a reference, delete it */ if (count <= 0) { - info(udevice->udev, "no reference left, remove '%s'\n", name); - if (!udevice->test_run) { + info(udev, "no reference left, remove '%s'\n", slink); + if (!test) { unlink(slink); - delete_path(udevice->udev, slink); + delete_path(udev, slink); } goto out; } /* find the device with the highest priority */ list_for_each_entry(device, &name_list, node) { - info(udevice->udev, "found '%s' for '%s'\n", device->name, name); + struct udev_device *dev_db; + const char *devnode; + + info(udev, "found '%s' for '%s'\n", device->name, slink); /* did we find ourself? we win, if we have the same priority */ - if (strcmp(udevice->dev->devpath, device->name) == 0) { - info(udevice->udev, "compare (our own) priority of '%s' %i >= %i\n", - udevice->dev->devpath, udevice->link_priority, priority); - if (strcmp(udevice->name, name) == 0) { - info(udevice->udev, "'%s' is our device node, database inconsistent, skip link update\n", udevice->name); - } else if (target[0] == '\0' || udevice->link_priority >= priority) { - priority = udevice->link_priority; - util_strlcpy(target, udevice->name, sizeof(target)); + if (strcmp(udev_device_get_syspath(dev), device->name) == 0) { + info(udev, "compare (our own) priority of '%s' %i >= %i\n", + udev_device_get_devpath(dev), udev_device_get_devlink_priority(dev), priority); + if (strcmp(udev_device_get_devnode(dev), slink) == 0) { + info(udev, "'%s' is our device node, database inconsistent, skip link update\n", + udev_device_get_devnode(dev)); + } else if (target[0] == '\0' || udev_device_get_devlink_priority(dev) >= priority) { + priority = udev_device_get_devlink_priority(dev); + util_strlcpy(target, udev_device_get_devnode(dev), sizeof(target)); } continue; } /* another device, read priority from database */ - udevice_db = udev_device_init(udevice->udev); - if (udevice_db == NULL) + dev_db = udev_device_new_from_syspath(udev, device->name); + if (dev_db == NULL) continue; - if (udev_db_get_device(udevice_db, device->name) == 0) { - if (strcmp(udevice_db->name, name) == 0) { - info(udevice->udev, "'%s' is a device node of '%s', skip link update\n", udevice_db->name, device->name); + devnode = udev_device_get_devnode(dev_db); + if (devnode != NULL) { + if (strcmp(devnode, slink) == 0) { + info(udev, "'%s' is a device node of '%s', skip link update\n", + devnode, device->name); } else { - info(udevice->udev, "compare priority of '%s' %i > %i\n", - udevice_db->dev->devpath, udevice_db->link_priority, priority); - if (target[0] == '\0' || udevice_db->link_priority > priority) { - priority = udevice_db->link_priority; - util_strlcpy(target, udevice_db->name, sizeof(target)); + info(udev, "compare priority of '%s' %i > %i\n", + udev_device_get_devpath(dev_db), + udev_device_get_devlink_priority(dev_db), + priority); + if (target[0] == '\0' || udev_device_get_devlink_priority(dev_db) > priority) { + priority = udev_device_get_devlink_priority(dev_db); + util_strlcpy(target, devnode, sizeof(target)); } } } - udev_device_cleanup(udevice_db); + udev_device_unref(dev_db); } - name_list_cleanup(udevice->udev, &name_list); + name_list_cleanup(udev, &name_list); if (target[0] == '\0') { - info(udevice->udev, "no current target for '%s' found\n", name); + info(udev, "no current target for '%s' found\n", slink); rc = 1; goto out; } /* create symlink to the target with the highest priority */ - util_strlcpy(node, udev_get_dev_path(udevice->udev), sizeof(node)); - util_strlcat(node, "/", sizeof(node)); - util_strlcat(node, target, sizeof(node)); - info(udevice->udev, "'%s' with target '%s' has the highest priority %i, create it\n", name, target, priority); - if (!udevice->test_run) { - create_path(udevice->udev, slink); - node_symlink(udevice, node, slink); + info(udev, "'%s' with target '%s' has the highest priority %i, create it\n", slink, target, priority); + if (!test) { + create_path(udev, slink); + node_symlink(udev, target, slink); } out: return rc; } -void udev_node_update_symlinks(struct udevice *udevice, struct udevice *udevice_old) +void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test) { - struct name_entry *name_loop; - char symlinks[UTIL_PATH_SIZE] = ""; - - list_for_each_entry(name_loop, &udevice->symlink_list, node) { - info(udevice->udev, "update symlink '%s' of '%s'\n", name_loop->name, udevice->dev->devpath); - update_link(udevice, name_loop->name); - util_strlcat(symlinks, udev_get_dev_path(udevice->udev), sizeof(symlinks)); - util_strlcat(symlinks, "/", sizeof(symlinks)); - util_strlcat(symlinks, name_loop->name, sizeof(symlinks)); - util_strlcat(symlinks, " ", sizeof(symlinks)); + struct udev *udev = udev_device_get_udev(dev); + struct udev_list_entry *list_entry; + const char *devnode_old; + + /* update possible left-over symlinks */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { + struct udev_list_entry *list_entry_current; + + udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { + if (strcmp(udev_list_entry_get_name(list_entry_current), + udev_list_entry_get_name(list_entry)) == 0) + continue; + } + /* link does no longer belong to this device */ + info(udev, "update old symlink '%s' no longer belonging to '%s'\n", + udev_list_entry_get_name(list_entry), udev_device_get_devpath(dev)); + update_link(dev, udev_list_entry_get_name(list_entry), test); } - /* export symlinks to environment */ - util_remove_trailing_chars(symlinks, ' '); - if (symlinks[0] != '\0') - setenv("DEVLINKS", symlinks, 1); - - /* update possible left-over symlinks (device metadata changed) */ - if (udevice_old != NULL) { - struct name_entry *link_loop; - struct name_entry *link_old_loop; - int found; - - /* remove current symlinks from old list */ - list_for_each_entry(link_old_loop, &udevice_old->symlink_list, node) { - found = 0; - list_for_each_entry(link_loop, &udevice->symlink_list, node) { - if (strcmp(link_old_loop->name, link_loop->name) == 0) { - found = 1; - break; - } - } - if (!found) { - /* link does no longer belong to this device */ - info(udevice->udev, "update old symlink '%s' no longer belonging to '%s'\n", - link_old_loop->name, udevice->dev->devpath); - update_link(udevice, link_old_loop->name); - } - } + /* + * if the node name has changed, delete the node, + * and possibly restore a symlink of another device + */ + devnode_old = udev_device_get_devnode(dev_old); + if (devnode_old != NULL) { + const char *devnode = udev_device_get_devnode(dev); - /* - * if the node name has changed, delete the node, - * or possibly restore a symlink of another device - */ - if (strcmp(udevice->name, udevice_old->name) != 0) - update_link(udevice, udevice_old->name); + if (devnode != NULL && strcmp(devnode_old, devnode) != 0) + update_link(dev, devnode_old, test); } } -int udev_node_add(struct udevice *udevice) +int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const char *group, int test) { - char filename[UTIL_PATH_SIZE]; + struct udev *udev = udev_device_get_udev(dev); uid_t uid; gid_t gid; int i; - int retval = 0; + int num; + struct udev_list_entry *list_entry; + int err = 0; - util_strlcpy(filename, udev_get_dev_path(udevice->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, udevice->name, sizeof(filename)); - create_path(udevice->udev, filename); + create_path(udev, udev_device_get_devnode(dev)); - if (strcmp(udevice->owner, "root") == 0) + if (strcmp(owner, "root") == 0) uid = 0; else { char *endptr; unsigned long id; - id = strtoul(udevice->owner, &endptr, 10); + id = strtoul(owner, &endptr, 10); if (endptr[0] == '\0') uid = (uid_t) id; else - uid = lookup_user(udevice->udev, udevice->owner); + uid = lookup_user(udev, owner); } - if (strcmp(udevice->group, "root") == 0) + if (strcmp(group, "root") == 0) gid = 0; else { char *endptr; unsigned long id; - id = strtoul(udevice->group, &endptr, 10); + id = strtoul(group, &endptr, 10); if (endptr[0] == '\0') gid = (gid_t) id; else - gid = lookup_group(udevice->udev, udevice->group); + gid = lookup_group(udev, group); } - info(udevice->udev, "creating device node '%s', major=%d, minor=%d, mode=%#o, uid=%d, gid=%d\n", - filename, major(udevice->devt), minor(udevice->devt), udevice->mode, uid, gid); + info(udev, "creating device node '%s', devnum=%d:%d, mode=%#o, uid=%d, gid=%d\n", + udev_device_get_devnode(dev), + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)), + mode, uid, gid); - if (!udevice->test_run) - if (udev_node_mknod(udevice, filename, udevice->devt, udevice->mode, uid, gid) != 0) { - retval = -1; + if (!test) + if (udev_node_mknod(dev, NULL, makedev(0,0), mode, uid, gid) != 0) { + err = -1; goto exit; } - setenv("DEVNAME", filename, 1); - /* create all_partitions if requested */ - if (udevice->partitions) { - char partitionname[UTIL_PATH_SIZE]; - char *attr; - int range; - - /* take the maximum registered minor range */ - attr = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, "range"); - if (attr != NULL) { - range = atoi(attr); - if (range > 1) - udevice->partitions = range-1; - } - info(udevice->udev, "creating device partition nodes '%s[1-%i]'\n", filename, udevice->partitions); - if (!udevice->test_run) { - for (i = 1; i <= udevice->partitions; i++) { - dev_t part_devt; - - snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); + num = udev_device_get_num_fake_partitions(dev); + if (num > 0) { + info(udev, "creating device partition nodes '%s[1-%i]'\n", udev_device_get_devnode(dev), num); + if (!test) { + for (i = 1; i <= num; i++) { + char partitionname[UTIL_PATH_SIZE]; + dev_t part_devnum; + + snprintf(partitionname, sizeof(partitionname), "%s%d", + udev_device_get_devnode(dev), i); partitionname[sizeof(partitionname)-1] = '\0'; - part_devt = makedev(major(udevice->devt), minor(udevice->devt) + i); - udev_node_mknod(udevice, partitionname, part_devt, udevice->mode, uid, gid); + part_devnum = makedev(major(udev_device_get_devnum(dev)), + minor(udev_device_get_devnum(dev)) + i); + udev_node_mknod(dev, partitionname, part_devnum, mode, uid, gid); } } } + + /* add node and to name index */ + name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 1, test); + + /* create/update symlinks, add symlinks to name index */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { + name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 1, test); + update_link(dev, udev_list_entry_get_name(list_entry), test); + } exit: - return retval; + return err; } -int udev_node_remove(struct udevice *udevice) +extern int udev_node_remove(struct udev_device *dev, int test) { - char filename[UTIL_PATH_SIZE]; + struct udev *udev = udev_device_get_udev(dev); + struct udev_list_entry *list_entry; + const char *devnode; char partitionname[UTIL_PATH_SIZE]; struct stat stats; - int retval = 0; + int err = 0; int num; - util_strlcpy(filename, udev_get_dev_path(udevice->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, udevice->name, sizeof(filename)); - if (stat(filename, &stats) != 0) { - info(udevice->udev, "device node '%s' not found\n", filename); + /* remove node from name index */ + name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 0, test); + + /* remove,update symlinks, remove symlinks from name index */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { + name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 0, test); + update_link(dev, udev_list_entry_get_name(list_entry), test); + } + + devnode = udev_device_get_devnode(dev); + if (devnode == NULL) + return 0; + if (stat(devnode, &stats) != 0) { + info(udev, "device node '%s' not found\n", devnode); return 0; } - if (udevice->devt && stats.st_rdev != udevice->devt) { - info(udevice->udev, "device node '%s' points to a different device, skip removal\n", filename); + if (stats.st_rdev != udev_device_get_devnum(dev)) { + info(udev, "device node '%s' points to a different device, skip removal\n", devnode); return -1; } - info(udevice->udev, "removing device node '%s'\n", filename); - if (!udevice->test_run) - retval = unlink_secure(udevice->udev, filename); - if (retval) - return retval; + info(udev, "removing device node '%s'\n", devnode); + if (!test) + err = unlink_secure(udev, devnode); + if (err) + return err; - setenv("DEVNAME", filename, 1); - num = udevice->partitions; + num = udev_device_get_num_fake_partitions(dev); if (num > 0) { int i; - info(udevice->udev, "removing all_partitions '%s[1-%i]'\n", filename, num); + info(udev, "removing all_partitions '%s[1-%i]'\n", devnode, num); if (num > 255) return -1; for (i = 1; i <= num; i++) { - snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i); + snprintf(partitionname, sizeof(partitionname), "%s%d", devnode, i); partitionname[sizeof(partitionname)-1] = '\0'; - if (!udevice->test_run) - unlink_secure(udevice->udev, partitionname); + if (!test) + unlink_secure(udev, partitionname); } } - delete_path(udevice->udev, filename); - return retval; + delete_path(udev, devnode); + return err; } diff --git a/udev/udev_rules.c b/udev/udev_rules.c index d06f536d1e..dfcd87539c 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -116,10 +116,12 @@ out: return 0; } -static int run_program(struct udev *udev, const char *command, const char *subsystem, +static int run_program(struct udev_device *dev, const char *command, char *result, size_t ressize, size_t *reslen) { + struct udev *udev = udev_device_get_udev(dev); int status; + char **envp; int outpipe[2] = {-1, -1}; int errpipe[2] = {-1, -1}; pid_t pid; @@ -128,9 +130,9 @@ static int run_program(struct udev *udev, const char *command, const char *subsy char *argv[(sizeof(arg) / 2) + 1]; int devnull; int i; - int retval = 0; + int err = 0; - /* build argv from comand */ + /* build argv from command */ util_strlcpy(arg, command, sizeof(arg)); i = 0; if (strchr(arg, ' ') != NULL) { @@ -170,13 +172,15 @@ static int run_program(struct udev *udev, const char *command, const char *subsy } } - /* allow programs in /lib/udev called without the path */ + /* allow programs in /lib/udev/ to be called without the path */ if (strchr(argv[0], '/') == NULL) { util_strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); util_strlcat(program, argv[0], sizeof(program)); argv[0] = program; } + envp = udev_device_get_properties_envp(dev); + pid = fork(); switch(pid) { case 0: @@ -205,7 +209,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy dup2(errpipe[WRITE_END], STDERR_FILENO); close(errpipe[WRITE_END]); } - execv(argv[0], argv); + execve(argv[0], argv, envp); if (errno == ENOENT || errno == ENOTDIR) { /* may be on a filesytem which is not mounted right now */ info(udev, "program '%s' not found\n", argv[0]); @@ -243,7 +247,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy if (fdcount < 0) { if (errno == EINTR) continue; - retval = -1; + err = -1; break; } @@ -259,7 +263,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy outpipe[READ_END] = -1; if (count < 0) { err(udev, "stdin read failed: %m\n"); - retval = -1; + err = -1; } continue; } @@ -272,7 +276,7 @@ static int run_program(struct udev *udev, const char *command, const char *subsy respos += count; } else { err(udev, "ressize %ld too short\n", (long)ressize); - retval = -1; + err = -1; } } pos = inbuf; @@ -319,18 +323,19 @@ static int run_program(struct udev *udev, const char *command, const char *subsy if (WIFEXITED(status)) { info(udev, "'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); if (WEXITSTATUS(status) != 0) - retval = -1; + err = -1; } else { err(udev, "'%s' abnormal exit\n", argv[0]); - retval = -1; + err = -1; } } - return retval; + return err; } -static int import_keys_into_env(struct udevice *udevice, const char *buf, size_t bufsize) +static int import_keys_into_env(struct udev_event *event, const char *buf, size_t bufsize) { + struct udev_device *dev = event->dev; char line[UTIL_LINE_SIZE]; const char *bufline; char *linepos; @@ -362,7 +367,7 @@ static int import_keys_into_env(struct udevice *udevice, const char *buf, size_t continue; if (count >= sizeof(line)) { - err(udevice->udev, "line too long, skipped\n"); + err(event->udev, "line too long, skipped\n"); continue; } @@ -371,162 +376,112 @@ static int import_keys_into_env(struct udevice *udevice, const char *buf, size_t linepos = line; if (get_key(&linepos, &variable, &value) == 0) { - dbg(udevice->udev, "import '%s=%s'\n", variable, value); + char syspath[UTIL_PATH_SIZE]; + dbg(event->udev, "import '%s=%s'\n", variable, value); /* handle device, renamed by external tool, returning new path */ if (strcmp(variable, "DEVPATH") == 0) { - info(udevice->udev, "updating devpath from '%s' to '%s'\n", udevice->dev->devpath, value); - sysfs_device_set_values(udevice->udev, udevice->dev, value, NULL, NULL); - } else - name_list_key_add(udevice->udev, &udevice->env_list, variable, value); - setenv(variable, value, 1); + info(event->udev, "updating devpath from '%s' to '%s'\n", + udev_device_get_devpath(dev), value); + util_strlcpy(syspath, udev_get_sys_path(event->udev), sizeof(syspath)); + util_strlcat(syspath, value, sizeof(syspath)); + udev_device_set_syspath(dev, syspath); + } else { + struct udev_list_entry *entry; + + entry = udev_device_add_property(dev, variable, value); + /* store in db */ + udev_list_entry_set_flag(entry, 1); + } } } - return 0; } -static int import_file_into_env(struct udevice *udevice, const char *filename) +static int import_file_into_env(struct udev_event *event, const char *filename) { char *buf; size_t bufsize; if (file_map(filename, &buf, &bufsize) != 0) { - err(udevice->udev, "can't open '%s': %m\n", filename); + err(event->udev, "can't open '%s': %m\n", filename); return -1; } - import_keys_into_env(udevice, buf, bufsize); + import_keys_into_env(event, buf, bufsize); file_unmap(buf, bufsize); return 0; } -static int import_program_into_env(struct udevice *udevice, const char *program) +static int import_program_into_env(struct udev_event *event, const char *program) { char result[2048]; size_t reslen; - if (run_program(udevice->udev, program, udevice->dev->subsystem, result, sizeof(result), &reslen) != 0) + if (run_program(event->dev, program, result, sizeof(result), &reslen) != 0) return -1; - return import_keys_into_env(udevice, result, reslen); + return import_keys_into_env(event, result, reslen); } -static int import_parent_into_env(struct udevice *udevice, const char *filter) +static int import_parent_into_env(struct udev_event *event, const char *filter) { - struct sysfs_device *dev_parent; - int rc = -1; + struct udev_device *dev_parent; + struct udev_list_entry *list_entry; - dev_parent = sysfs_device_get_parent(udevice->udev, udevice->dev); - if (dev_parent != NULL) { - struct udevice *udev_parent; - struct name_entry *name_loop; - - dbg(udevice->udev, "found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(udevice->udev); - if (udev_parent == NULL) - return -1; - /* import the udev_db of the parent */ - if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { - dbg(udevice->udev, "import stored parent env '%s'\n", udev_parent->name); - list_for_each_entry(name_loop, &udev_parent->env_list, node) { - char name[UTIL_NAME_SIZE]; - char *pos; - - util_strlcpy(name, name_loop->name, sizeof(name)); - pos = strchr(name, '='); - if (pos) { - pos[0] = '\0'; - pos++; - if (fnmatch(filter, name, 0) == 0) { - dbg(udevice->udev, "import key '%s'\n", name_loop->name); - name_list_add(udevice->udev, &udevice->env_list, name_loop->name, 0); - setenv(name, pos, 1); - } else - dbg(udevice->udev, "skip key '%s'\n", name_loop->name); - } - } - rc = 0; - } else - dbg(udevice->udev, "parent not found in database\n"); - udev_device_cleanup(udev_parent); - } + dev_parent = udev_device_get_parent(event->dev); + if (dev_parent == NULL) + return -1; - return rc; -} + dbg(event->udev, "found parent '%s', get the node name\n", udev_device_get_syspath(dev_parent)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev_parent)) { + const char *key = udev_list_entry_get_name(list_entry); + const char *val = udev_list_entry_get_value(list_entry); -static int pass_env_to_socket(struct udev *udev, const char *sockpath, const char *devpath, const char *action) -{ - int sock; - struct sockaddr_un saddr; - socklen_t saddrlen; - struct stat stats; - char buf[2048]; - size_t bufpos = 0; - int i; - ssize_t count; - int retval = 0; - - dbg(udev, "pass environment to socket '%s'\n", sockpath); - sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - memset(&saddr, 0x00, sizeof(struct sockaddr_un)); - saddr.sun_family = AF_LOCAL; - if (sockpath[0] == '@') { - /* abstract namespace socket requested */ - util_strlcpy(&saddr.sun_path[1], &sockpath[1], sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } else if (stat(sockpath, &stats) == 0 && S_ISSOCK(stats.st_mode)) { - /* existing socket file */ - util_strlcpy(saddr.sun_path, sockpath, sizeof(saddr.sun_path)); - saddrlen = offsetof(struct sockaddr_un, sun_path) + strlen(saddr.sun_path); - } else { - /* no socket file, assume abstract namespace socket */ - util_strlcpy(&saddr.sun_path[1], sockpath, sizeof(saddr.sun_path)-1); - saddrlen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&saddr.sun_path[1]); - } + if (fnmatch(filter, key, 0) == 0) { + struct udev_list_entry *entry; - bufpos = snprintf(buf, sizeof(buf), "%s@%s", action, devpath); - bufpos++; - for (i = 0; environ[i] != NULL && bufpos < (sizeof(buf)); i++) { - bufpos += util_strlcpy(&buf[bufpos], environ[i], sizeof(buf) - bufpos); - bufpos++; + dbg(event->udev, "import key '%s=%s'\n", key, val); + entry = udev_device_add_property(event->dev, key, val); + /* store in db */ + udev_list_entry_set_flag(entry, 1); + } } - if (bufpos > sizeof(buf)) - bufpos = sizeof(buf); - - count = sendto(sock, &buf, bufpos, 0, (struct sockaddr *)&saddr, saddrlen); - if (count < 0) - retval = -1; - info(udev, "passed %zi bytes to socket '%s', \n", count, sockpath); - - close(sock); - return retval; + return 0; } -int udev_rules_run(struct udevice *udevice) +int udev_rules_run(struct udev_event *event) { - struct name_entry *name_loop; - int retval = 0; + struct udev_list_entry *list_entry; + int err = 0; + + dbg(event->udev, "executing run list\n"); + udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { + const char *cmd = udev_list_entry_get_name(list_entry); + + if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { + struct udev_monitor *monitor; - dbg(udevice->udev, "executing run list\n"); - list_for_each_entry(name_loop, &udevice->run_list, node) { - if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) { - pass_env_to_socket(udevice->udev, &name_loop->name[strlen("socket:")], udevice->dev->devpath, udevice->action); + monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); + if (monitor == NULL) + continue; + udev_monitor_send_device(monitor, event->dev); + udev_monitor_unref(monitor); } else { char program[UTIL_PATH_SIZE]; - util_strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udevice, program, sizeof(program)); - if (run_program(udevice->udev, program, udevice->dev->subsystem, NULL, 0, NULL) != 0) - if (!name_loop->ignore_error) - retval = -1; + util_strlcpy(program, cmd, sizeof(program)); + udev_rules_apply_format(event, program, sizeof(program)); + if (run_program(event->dev, program, NULL, 0, NULL) != 0) { + if (!udev_list_entry_get_flag(list_entry)) + err = -1; + } } } - - return retval; + return err; } #define WAIT_LOOP_PER_SECOND 50 -static int wait_for_file(struct udevice *udevice, const char *file, int timeout) +static int wait_for_file(struct udev_event *event, const char *file, int timeout) { char filepath[UTIL_PATH_SIZE]; char devicepath[UTIL_PATH_SIZE] = ""; @@ -535,8 +490,8 @@ static int wait_for_file(struct udevice *udevice, const char *file, int timeout) /* a relative path is a device attribute */ if (file[0] != '/') { - util_strlcpy(devicepath, udev_get_sys_path(udevice->udev), sizeof(devicepath)); - util_strlcat(devicepath, udevice->dev->devpath, sizeof(devicepath)); + util_strlcpy(devicepath, udev_get_sys_path(event->udev), sizeof(devicepath)); + util_strlcat(devicepath, udev_device_get_devpath(event->dev), sizeof(devicepath)); util_strlcpy(filepath, devicepath, sizeof(filepath)); util_strlcat(filepath, "/", sizeof(filepath)); @@ -544,63 +499,53 @@ static int wait_for_file(struct udevice *udevice, const char *file, int timeout) file = filepath; } - dbg(udevice->udev, "will wait %i sec for '%s'\n", timeout, file); + dbg(event->udev, "will wait %i sec for '%s'\n", timeout, file); while (--loop) { /* lookup file */ if (stat(file, &stats) == 0) { - info(udevice->udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + info(event->udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } /* make sure, the device did not disappear in the meantime */ if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { - info(udevice->udev, "device disappeared while waiting for '%s'\n", file); + info(event->udev, "device disappeared while waiting for '%s'\n", file); return -2; } - info(udevice->udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); + info(event->udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - info(udevice->udev, "waiting for '%s' failed\n", file); + info(event->udev, "waiting for '%s' failed\n", file); return -1; } /* handle "[$SUBSYSTEM/$KERNEL]" lookup */ -static int attr_get_by_subsys_id(struct udev *udev, const char *attrstr, char *devpath, size_t len, char **attr) +static int split_subsys_sysname(struct udev *udev, char *attrstr, char **subsys, char **sysname, char **attr) { - char subsys[UTIL_NAME_SIZE]; char *pos; - char *id; - char *attrib; - int found = 0; if (attrstr[0] != '[') - goto out; + return -1; + + *subsys = &attrstr[1]; + pos = strchr(*subsys, ']'); + if (pos == NULL) + return -1; + pos[0] = '\0'; + pos = &pos[1]; - attrib = strchr(&attrstr[1], ']'); - if (attrib == NULL) - goto out; - attrib = &attrib[1]; + if (pos[0] == '/') + pos = &pos[1]; + if (pos[0] != '\0') + *attr = pos; + else + *attr = NULL; - util_strlcpy(subsys, &attrstr[1], sizeof(subsys)); - pos = strchr(subsys, ']'); + pos = strchr(*subsys, '/'); if (pos == NULL) - goto out; + return -1; pos[0] = '\0'; - id = strchr(subsys, '/'); - if (id == NULL) - goto out; - id[0] = '\0'; - id = &id[1]; - if (sysfs_lookup_devpath_by_subsys_id(udev, devpath, len, subsys, id)) { - if (attr != NULL) { - if (attrib[0] != '\0') - *attr = attrib; - else - *attr = NULL; - } - found = 1; - } -out: - return found; + *sysname = &pos[1]; + return 0; } static int attr_subst_subdir(char *attr, size_t len) @@ -641,11 +586,12 @@ static int attr_subst_subdir(char *attr, size_t len) return found; } -void udev_rules_apply_format(struct udevice *udevice, char *string, size_t maxsize) +void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize) { + struct udev_device *dev = event->dev; char temp[UTIL_PATH_SIZE]; char temp2[UTIL_PATH_SIZE]; - char *head, *tail, *pos, *cpos, *attr, *rest; + char *head, *tail, *cpos, *attr, *rest; int len; int i; int count; @@ -714,12 +660,12 @@ void udev_rules_apply_format(struct udevice *udevice, char *string, size_t maxsi if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { type = subst->type; tail = head + strlen(subst->name)+1; - dbg(udevice->udev, "will substitute format name '%s'\n", subst->name); + dbg(event->udev, "will substitute format name '%s'\n", subst->name); goto found; } } head[0] = '$'; - err(udevice->udev, "unknown format variable '%s'\n", head); + err(event->udev, "unknown format variable '%s'\n", head); } else if (head[0] == '%') { /* substitute format char */ if (head[1] == '\0') @@ -732,71 +678,77 @@ void udev_rules_apply_format(struct udevice *udevice, char *string, size_t maxsi } head[0] = '\0'; tail = head+1; - len = get_format_len(udevice->udev, &tail); + len = get_format_len(event->udev, &tail); for (subst = map; subst->name; subst++) { if (tail[0] == subst->fmt) { type = subst->type; tail++; - dbg(udevice->udev, "will substitute format char '%c'\n", subst->fmt); + dbg(event->udev, "will substitute format char '%c'\n", subst->fmt); goto found; } } head[0] = '%'; - err(udevice->udev, "unknown format char '%c'\n", tail[0]); + err(event->udev, "unknown format char '%c'\n", tail[0]); } head++; } break; found: - attr = get_format_attribute(udevice->udev, &tail); + attr = get_format_attribute(event->udev, &tail); util_strlcpy(temp, tail, sizeof(temp)); - dbg(udevice->udev, "format=%i, string='%s', tail='%s'\n", type ,string, tail); + dbg(event->udev, "format=%i, string='%s', tail='%s'\n", type ,string, tail); switch (type) { case SUBST_DEVPATH: - util_strlcat(string, udevice->dev->devpath, maxsize); - dbg(udevice->udev, "substitute devpath '%s'\n", udevice->dev->devpath); + util_strlcat(string, udev_device_get_devpath(dev), maxsize); + dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); break; case SUBST_KERNEL: - util_strlcat(string, udevice->dev->kernel, maxsize); - dbg(udevice->udev, "substitute kernel name '%s'\n", udevice->dev->kernel); + util_strlcat(string, udev_device_get_sysname(dev), maxsize); + dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); break; case SUBST_KERNEL_NUMBER: - util_strlcat(string, udevice->dev->kernel_number, maxsize); - dbg(udevice->udev, "substitute kernel number '%s'\n", udevice->dev->kernel_number); + if (udev_device_get_sysnum(dev) == NULL) + break; + util_strlcat(string, udev_device_get_sysnum(dev), maxsize); + dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); break; case SUBST_ID: - if (udevice->dev_parent != NULL) { - util_strlcat(string, udevice->dev_parent->kernel, maxsize); - dbg(udevice->udev, "substitute id '%s'\n", udevice->dev_parent->kernel); + if (event->dev_parent != NULL) { + util_strlcat(string, udev_device_get_sysname(event->dev_parent), maxsize); + dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); } break; case SUBST_DRIVER: - if (udevice->dev_parent != NULL) { - util_strlcat(string, udevice->dev_parent->driver, maxsize); - dbg(udevice->udev, "substitute driver '%s'\n", udevice->dev_parent->driver); + if (event->dev_parent != NULL) { + const char *driver = udev_device_get_driver(event->dev_parent); + + if (driver == NULL) + break; + util_strlcat(string, driver, maxsize); + dbg(event->udev, "substitute driver '%s'\n", driver); } break; case SUBST_MAJOR: - sprintf(temp2, "%d", major(udevice->devt)); + sprintf(temp2, "%d", major(udev_device_get_devnum(dev))); util_strlcat(string, temp2, maxsize); - dbg(udevice->udev, "substitute major number '%s'\n", temp2); + dbg(event->udev, "substitute major number '%s'\n", temp2); break; case SUBST_MINOR: - sprintf(temp2, "%d", minor(udevice->devt)); + sprintf(temp2, "%d", minor(udev_device_get_devnum(dev))); util_strlcat(string, temp2, maxsize); - dbg(udevice->udev, "substitute minor number '%s'\n", temp2); + dbg(event->udev, "substitute minor number '%s'\n", temp2); break; case SUBST_RESULT: - if (udevice->program_result[0] == '\0') + if (event->program_result[0] == '\0') break; /* get part part of the result string */ i = 0; if (attr != NULL) i = strtoul(attr, &rest, 10); if (i > 0) { - dbg(udevice->udev, "request part #%d of result string\n", i); - cpos = udevice->program_result; + dbg(event->udev, "request part #%d of result string\n", i); + cpos = event->program_result; while (--i) { while (cpos[0] != '\0' && !isspace(cpos[0])) cpos++; @@ -804,7 +756,7 @@ found: cpos++; } if (i > 0) { - err(udevice->udev, "requested part of result string not found\n"); + err(event->udev, "requested part of result string not found\n"); break; } util_strlcpy(temp2, cpos, sizeof(temp2)); @@ -815,145 +767,159 @@ found: cpos[0] = '\0'; } util_strlcat(string, temp2, maxsize); - dbg(udevice->udev, "substitute part of result string '%s'\n", temp2); + dbg(event->udev, "substitute part of result string '%s'\n", temp2); } else { - util_strlcat(string, udevice->program_result, maxsize); - dbg(udevice->udev, "substitute result string '%s'\n", udevice->program_result); + util_strlcat(string, event->program_result, maxsize); + dbg(event->udev, "substitute result string '%s'\n", event->program_result); } break; case SUBST_ATTR: if (attr == NULL) - err(udevice->udev, "missing file parameter for attr\n"); + err(event->udev, "missing file parameter for attr\n"); else { - char devpath[UTIL_PATH_SIZE]; + char *subsys; + char *sysname; char *attrib; - const char *value = NULL; + char value[UTIL_NAME_SIZE] = ""; size_t size; - if (attr_get_by_subsys_id(udevice->udev, attr, devpath, sizeof(devpath), &attrib)) { - if (attrib != NULL) - value = sysfs_attr_get_value(udevice->udev, devpath, attrib); - else + if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { + struct udev_device *d; + const char *val; + + if (attrib == NULL) break; + d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); + if (d == NULL) + break; + val = udev_device_get_attr_value(d, attrib); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + udev_device_unref(d); } /* try the current device, other matches may have selected */ - if (value == NULL && udevice->dev_parent != NULL && udevice->dev_parent != udevice->dev) - value = sysfs_attr_get_value(udevice->udev, udevice->dev_parent->devpath, attr); + if (value[0]=='\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { + const char *val; + + val = udev_device_get_attr_value(event->dev_parent, attr); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + } /* look at all devices along the chain of parents */ - if (value == NULL) { - struct sysfs_device *dev_parent = udevice->dev; + if (value[0]=='\0') { + struct udev_device *dev_parent = dev; + const char *val; do { - dbg(udevice->udev, "looking at '%s'\n", dev_parent->devpath); - value = sysfs_attr_get_value(udevice->udev, dev_parent->devpath, attr); - if (value != NULL) + dbg(event->udev, "looking at '%s'\n", udev_device_get_syspath(dev_parent)); + val = udev_device_get_attr_value(dev_parent, attr); + if (val != NULL) { + util_strlcpy(value, val, sizeof(value)); break; - dev_parent = sysfs_device_get_parent(udevice->udev, dev_parent); + } + dev_parent = udev_device_get_parent(dev_parent); } while (dev_parent != NULL); } - if (value == NULL) + if (value[0]=='\0') break; /* strip trailing whitespace, and replace unwanted characters */ - size = util_strlcpy(temp2, value, sizeof(temp2)); - if (size >= sizeof(temp2)) - size = sizeof(temp2)-1; - while (size > 0 && isspace(temp2[size-1])) - temp2[--size] = '\0'; - count = util_replace_chars(temp2, ALLOWED_CHARS_INPUT); + size = strlen(value); + while (size > 0 && isspace(value[--size])) + value[size] = '\0'; + count = util_replace_chars(value, ALLOWED_CHARS_INPUT); if (count > 0) - info(udevice->udev, "%i character(s) replaced\n" , count); - util_strlcat(string, temp2, maxsize); - dbg(udevice->udev, "substitute sysfs value '%s'\n", temp2); + info(event->udev, "%i character(s) replaced\n" , count); + util_strlcat(string, value, maxsize); + dbg(event->udev, "substitute sysfs value '%s'\n", value); } break; case SUBST_PARENT: { - struct sysfs_device *dev_parent; - - dev_parent = sysfs_device_get_parent(udevice->udev, udevice->dev); - if (dev_parent != NULL) { - struct udevice *udev_parent; - - dbg(udevice->udev, "found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(udevice->udev); - if (udev_parent != NULL) { - /* lookup the name in the udev_db with the DEVPATH of the parent */ - if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) { - util_strlcat(string, udev_parent->name, maxsize); - dbg(udevice->udev, "substitute parent node name'%s'\n", udev_parent->name); - } else - dbg(udevice->udev, "parent not found in database\n"); - udev_device_cleanup(udev_parent); - } + struct udev_device *dev_parent; + const char *devnode; + + dev_parent = udev_device_get_parent(event->dev); + if (dev_parent == NULL) + break; + devnode = udev_device_get_devnode(dev_parent); + if (devnode != NULL) { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + + util_strlcat(string, &devnode[devlen], maxsize); + dbg(event->udev, "found parent '%s', got node name '%s'\n", + udev_device_get_syspath(dev_parent), &devnode[devlen]); } } break; case SUBST_TEMP_NODE: - if (udevice->tmp_node[0] == '\0' && major(udevice->devt) > 0) { - dbg(udevice->udev, "create temporary device node for callout\n"); - snprintf(udevice->tmp_node, sizeof(udevice->tmp_node), "%s/.tmp-%u-%u", - udev_get_dev_path(udevice->udev), major(udevice->devt), minor(udevice->devt)); - udevice->tmp_node[sizeof(udevice->tmp_node)-1] = '\0'; - udev_node_mknod(udevice, udevice->tmp_node, udevice->devt, 0600, 0, 0); + if (event->tmp_node[0] == '\0' && major(udev_device_get_devnum(dev)) > 0) { + dbg(event->udev, "create temporary device node for callout\n"); + snprintf(event->tmp_node, sizeof(event->tmp_node), "%s/.tmp-%u-%u", + udev_get_dev_path(event->udev), + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + udev_node_mknod(dev, event->tmp_node, makedev(0,0), 0600, 0, 0); } - util_strlcat(string, udevice->tmp_node, maxsize); - dbg(udevice->udev, "substitute temporary device node name '%s'\n", udevice->tmp_node); + util_strlcat(string, event->tmp_node, maxsize); + dbg(event->udev, "substitute temporary device node name '%s'\n", event->tmp_node); break; case SUBST_NAME: - if (udevice->name[0] == '\0') { - util_strlcat(string, udevice->dev->kernel, maxsize); - dbg(udevice->udev, "substitute udevice->kernel '%s'\n", udevice->name); + if (event->name != NULL) { + util_strlcat(string, event->name, maxsize); + dbg(event->udev, "substitute name '%s'\n", event->name); } else { - util_strlcat(string, udevice->name, maxsize); - dbg(udevice->udev, "substitute udevice->name '%s'\n", udevice->name); + util_strlcat(string, udev_device_get_sysname(dev), maxsize); + dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); } break; case SUBST_LINKS: - if (!list_empty(&udevice->symlink_list)) { - struct name_entry *name_loop; - char symlinks[UTIL_PATH_SIZE] = ""; + { + struct udev_list_entry *list_entry; - list_for_each_entry(name_loop, &udevice->symlink_list, node) { - util_strlcat(symlinks, name_loop->name, sizeof(symlinks)); - util_strlcat(symlinks, " ", sizeof(symlinks)); + list_entry = udev_device_get_properties_list_entry(dev); + util_strlcpy(string, udev_list_entry_get_name(list_entry), maxsize); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { + util_strlcat(string, " ", maxsize); + util_strlcat(string, udev_list_entry_get_name(list_entry), maxsize); } - util_remove_trailing_chars(symlinks, ' '); - util_strlcat(string, symlinks, maxsize); } break; case SUBST_ROOT: - util_strlcat(string, udev_get_dev_path(udevice->udev), maxsize); - dbg(udevice->udev, "substitute udev_root '%s'\n", udev_get_dev_path(udevice->udev)); + util_strlcat(string, udev_get_dev_path(event->udev), maxsize); + dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); break; case SUBST_SYS: - util_strlcat(string, udev_get_sys_path(udevice->udev), maxsize); - dbg(udevice->udev, "substitute sys_path '%s'\n", udev_get_sys_path(udevice->udev)); + util_strlcat(string, udev_get_sys_path(event->udev), maxsize); + dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); break; case SUBST_ENV: if (attr == NULL) { - dbg(udevice->udev, "missing attribute\n"); + dbg(event->udev, "missing attribute\n"); break; - } - pos = getenv(attr); - if (pos == NULL) { - dbg(udevice->udev, "env '%s' not available\n", attr); + } else { + struct udev_list_entry *list_entry; + const char *value; + + list_entry = udev_device_get_properties_list_entry(event->dev); + list_entry = udev_list_entry_get_by_name(list_entry, attr); + if (list_entry == NULL) + break; + value = udev_list_entry_get_value(list_entry); + dbg(event->udev, "substitute env '%s=%s'\n", attr, value); + util_strlcat(string, value, maxsize); break; } - dbg(udevice->udev, "substitute env '%s=%s'\n", attr, pos); - util_strlcat(string, pos, maxsize); - break; default: - err(udevice->udev, "unknown substitution type=%i\n", type); + err(event->udev, "unknown substitution type=%i\n", type); break; } /* possibly truncate to format-char specified length */ if (len >= 0 && len < (int)strlen(head)) { head[len] = '\0'; - dbg(udevice->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head); + dbg(event->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head); } util_strlcat(string, temp, maxsize); } @@ -980,15 +946,18 @@ static int match_key(struct udev *udev, const char *key_name, struct udev_rule * key->operation != KEY_OP_NOMATCH) return 0; + if (val == NULL) + val = ""; + /* look for a matching string, parts are separated by '|' */ util_strlcpy(value, rule->buf + key->val_off, sizeof(value)); key_value = value; dbg(udev, "key %s value='%s'\n", key_name, key_value); - while (key_value) { + while (key_value != NULL) { pos = strchr(key_value, '|'); - if (pos) { + if (pos != NULL) { pos[0] = '\0'; - pos++; + pos = &pos[1]; } dbg(udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); @@ -1011,37 +980,42 @@ static int match_key(struct udev *udev, const char *key_name, struct udev_rule * } /* match a single rule against a given device and possibly its parent devices */ -static int match_rule(struct udevice *udevice, struct udev_rule *rule) +static int match_rule(struct udev_event *event, struct udev_rule *rule) { + struct udev_device *dev = event->dev; int i; - if (match_key(udevice->udev, "ACTION", rule, &rule->action, udevice->action)) + if (match_key(event->udev, "ACTION", rule, &rule->action, udev_device_get_action(dev))) goto nomatch; - if (match_key(udevice->udev, "KERNEL", rule, &rule->kernel, udevice->dev->kernel)) + if (match_key(event->udev, "KERNEL", rule, &rule->kernel, udev_device_get_sysname(dev))) goto nomatch; - if (match_key(udevice->udev, "SUBSYSTEM", rule, &rule->subsystem, udevice->dev->subsystem)) + if (match_key(event->udev, "SUBSYSTEM", rule, &rule->subsystem, udev_device_get_subsystem(dev))) goto nomatch; - if (match_key(udevice->udev, "DEVPATH", rule, &rule->devpath, udevice->dev->devpath)) + if (match_key(event->udev, "DEVPATH", rule, &rule->devpath, udev_device_get_devpath(dev))) goto nomatch; - if (match_key(udevice->udev, "DRIVER", rule, &rule->driver, udevice->dev->driver)) + if (match_key(event->udev, "DRIVER", rule, &rule->driver, udev_device_get_driver(dev))) goto nomatch; /* match NAME against a value assigned by an earlier rule */ - if (match_key(udevice->udev, "NAME", rule, &rule->name, udevice->name)) + if (match_key(event->udev, "NAME", rule, &rule->name, event->name)) goto nomatch; /* match against current list of symlinks */ if (rule->symlink_match.operation == KEY_OP_MATCH || rule->symlink_match.operation == KEY_OP_NOMATCH) { - struct name_entry *name_loop; + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; int match = 0; - list_for_each_entry(name_loop, &udevice->symlink_list, node) { - if (match_key(udevice->udev, "SYMLINK", rule, &rule->symlink_match, name_loop->name) == 0) { + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { + const char *devlink; + + devlink = &udev_list_entry_get_name(list_entry)[devlen]; + if (match_key(event->udev, "SYMLINK", rule, &rule->symlink_match, devlink) == 0) { match = 1; break; } @@ -1056,14 +1030,18 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) /* we only check for matches, assignments will be handled later */ if (pair->key.operation == KEY_OP_MATCH || pair->key.operation == KEY_OP_NOMATCH) { + struct udev_list_entry *list_entry; const char *key_name = key_pair_name(rule, pair); - const char *value = getenv(key_name); + const char *value; - if (!value) { - dbg(udevice->udev, "ENV{'%s'} is not set, treat as empty\n", key_name); + list_entry = udev_device_get_properties_list_entry(event->dev); + list_entry = udev_list_entry_get_by_name(list_entry, key_name); + value = udev_list_entry_get_value(list_entry); + if (value == NULL) { + dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); value = ""; } - if (match_key(udevice->udev, "ENV", rule, &pair->key, value)) + if (match_key(event->udev, "ENV", rule, &pair->key, value)) goto nomatch; } } @@ -1071,26 +1049,30 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) if (rule->test.operation == KEY_OP_MATCH || rule->test.operation == KEY_OP_NOMATCH) { char filename[UTIL_PATH_SIZE]; - char devpath[UTIL_PATH_SIZE]; - char *attr; + char *subsys; + char *sysname; + char *attrib; struct stat statbuf; int match; util_strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); - udev_rules_apply_format(udevice, filename, sizeof(filename)); - - if (attr_get_by_subsys_id(udevice->udev, filename, devpath, sizeof(devpath), &attr)) { - util_strlcpy(filename, udev_get_sys_path(udevice->udev), sizeof(filename)); - util_strlcat(filename, devpath, sizeof(filename)); - if (attr != NULL) { - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, attr, sizeof(filename)); + udev_rules_apply_format(event, filename, sizeof(filename)); + + if (split_subsys_sysname(event->udev, filename, &subsys, &sysname, &attrib) == 0) { + struct udev_device *d; + d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); + if (d != NULL) { + util_strlcpy(filename, udev_device_get_syspath(d), sizeof(filename)); + if (attrib != NULL) { + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, attrib, sizeof(filename)); + } + udev_device_unref(d); } } else if (filename[0] != '/') { char tmp[UTIL_PATH_SIZE]; - util_strlcpy(tmp, udev_get_sys_path(udevice->udev), sizeof(tmp)); - util_strlcat(tmp, udevice->dev->devpath, sizeof(tmp)); + util_strlcpy(tmp, udev_device_get_syspath(dev), sizeof(tmp)); util_strlcat(tmp, "/", sizeof(tmp)); util_strlcat(tmp, filename, sizeof(tmp)); util_strlcpy(filename, tmp, sizeof(filename)); @@ -1099,10 +1081,10 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) attr_subst_subdir(filename, sizeof(filename)); match = (stat(filename, &statbuf) == 0); - info(udevice->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + info(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); if (match && rule->test_mode_mask > 0) { match = ((statbuf.st_mode & rule->test_mode_mask) > 0); - info(udevice->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + info(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, match ? "matches" : "does not match", rule->test_mode_mask); } @@ -1110,7 +1092,7 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) goto nomatch; if (!match && rule->test.operation == KEY_OP_MATCH) goto nomatch; - dbg(udevice->udev, "TEST key is true\n"); + dbg(event->udev, "TEST key is true\n"); } if (rule->wait_for.operation != KEY_OP_UNSET) { @@ -1118,8 +1100,8 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) int found; util_strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); - udev_rules_apply_format(udevice, filename, sizeof(filename)); - found = (wait_for_file(udevice, filename, 10) == 0); + udev_rules_apply_format(event, filename, sizeof(filename)); + found = (wait_for_file(event, filename, 10) == 0); if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) goto nomatch; } @@ -1130,53 +1112,72 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) if (pair->key.operation == KEY_OP_MATCH || pair->key.operation == KEY_OP_NOMATCH) { + char attr[UTIL_PATH_SIZE]; const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); - char devpath[UTIL_PATH_SIZE]; + char *subsys; + char *sysname; char *attrib; - const char *value = NULL; - char val[UTIL_NAME_SIZE]; + char value[UTIL_NAME_SIZE] = ""; size_t len; - if (attr_get_by_subsys_id(udevice->udev, key_name, devpath, sizeof(devpath), &attrib)) { - if (attrib != NULL) - value = sysfs_attr_get_value(udevice->udev, devpath, attrib); - else + util_strlcpy(attr, key_name, sizeof(attr)); + if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { + struct udev_device *d; + const char *val; + + if (attrib == NULL) goto nomatch; + d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); + if (d == NULL) + goto nomatch; + val = udev_device_get_attr_value(d, attrib); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + udev_device_unref(d); } - if (value == NULL) - value = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, key_name); - if (value == NULL) + + if (value[0]=='\0') { + const char *val; + + val = udev_device_get_attr_value(dev, key_name); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + } + + if (value[0]=='\0') goto nomatch; - util_strlcpy(val, value, sizeof(val)); /* strip trailing whitespace of value, if not asked to match for it */ len = strlen(key_value); if (len > 0 && !isspace(key_value[len-1])) { - len = strlen(val); - while (len > 0 && isspace(val[len-1])) - val[--len] = '\0'; - dbg(udevice->udev, "removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); + len = strlen(value); + while (len > 0 && isspace(value[--len])) + value[len] = '\0'; + dbg(event->udev, "removed trailing whitespace from '%s'\n", value); } - if (match_key(udevice->udev, "ATTR", rule, &pair->key, val)) + if (match_key(event->udev, "ATTR", rule, &pair->key, value)) goto nomatch; } } /* walk up the chain of parent devices and find a match */ - udevice->dev_parent = udevice->dev; + event->dev_parent = dev; while (1) { /* check for matching kernel device name */ - if (match_key(udevice->udev, "KERNELS", rule, &rule->kernels, udevice->dev_parent->kernel)) + if (match_key(event->udev, "KERNELS", rule, + &rule->kernels, udev_device_get_sysname(event->dev_parent))) goto try_parent; /* check for matching subsystem value */ - if (match_key(udevice->udev, "SUBSYSTEMS", rule, &rule->subsystems, udevice->dev_parent->subsystem)) + if (match_key(event->udev, "SUBSYSTEMS", rule, + &rule->subsystems, udev_device_get_subsystem(event->dev_parent))) goto try_parent; /* check for matching driver */ - if (match_key(udevice->udev, "DRIVERS", rule, &rule->drivers, udevice->dev_parent->driver)) + if (match_key(event->udev, "DRIVERS", rule, + &rule->drivers, udev_device_get_driver(event->dev_parent))) goto try_parent; /* check for matching sysfs attribute pairs */ @@ -1187,27 +1188,27 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) pair->key.operation == KEY_OP_NOMATCH) { const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); - const char *value; - char val[UTIL_NAME_SIZE]; + const char *val; + char value[UTIL_NAME_SIZE]; size_t len; - value = sysfs_attr_get_value(udevice->udev, udevice->dev_parent->devpath, key_name); - if (value == NULL) - value = sysfs_attr_get_value(udevice->udev, udevice->dev->devpath, key_name); - if (value == NULL) + val = udev_device_get_attr_value(event->dev_parent, key_name); + if (val == NULL) + val = udev_device_get_attr_value(dev, key_name); + if (val == NULL) goto try_parent; - util_strlcpy(val, value, sizeof(val)); + util_strlcpy(value, val, sizeof(value)); /* strip trailing whitespace of value, if not asked to match for it */ len = strlen(key_value); if (len > 0 && !isspace(key_value[len-1])) { - len = strlen(val); - while (len > 0 && isspace(val[len-1])) - val[--len] = '\0'; - dbg(udevice->udev, "removed %zi trailing whitespace chars from '%s'\n", strlen(val)-len, val); + len = strlen(value); + while (len > 0 && isspace(value[--len])) + value[len] = '\0'; + dbg(event->udev, "removed trailing whitespace from '%s'\n", value); } - if (match_key(udevice->udev, "ATTRS", rule, &pair->key, val)) + if (match_key(event->udev, "ATTRS", rule, &pair->key, value)) goto try_parent; } } @@ -1216,12 +1217,12 @@ static int match_rule(struct udevice *udevice, struct udev_rule *rule) break; try_parent: /* move to parent device */ - dbg(udevice->udev, "try parent sysfs device\n"); - udevice->dev_parent = sysfs_device_get_parent(udevice->udev, udevice->dev_parent); - if (udevice->dev_parent == NULL) + dbg(event->udev, "try parent sysfs device\n"); + event->dev_parent = udev_device_get_parent(event->dev_parent); + if (event->dev_parent == NULL) goto nomatch; - dbg(udevice->udev, "looking at dev_parent->devpath='%s'\n", udevice->dev_parent->devpath); - dbg(udevice->udev, "looking at dev_parent->kernel='%s'\n", udevice->dev_parent->kernel); + dbg(event->udev, "looking at dev_parent->devpath='%s'\n", + udev_device_get_syspath(event->dev_parent)); } /* execute external program */ @@ -1230,34 +1231,34 @@ try_parent: char result[UTIL_PATH_SIZE]; util_strlcpy(program, key_val(rule, &rule->program), sizeof(program)); - udev_rules_apply_format(udevice, program, sizeof(program)); - if (run_program(udevice->udev, program, udevice->dev->subsystem, result, sizeof(result), NULL) != 0) { - dbg(udevice->udev, "PROGRAM is false\n"); - udevice->program_result[0] = '\0'; + udev_rules_apply_format(event, program, sizeof(program)); + if (run_program(event->dev, program, result, sizeof(result), NULL) != 0) { + dbg(event->udev, "PROGRAM is false\n"); + event->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) goto nomatch; } else { int count; - dbg(udevice->udev, "PROGRAM matches\n"); + dbg(event->udev, "PROGRAM matches\n"); util_remove_trailing_chars(result, '\n'); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { count = util_replace_chars(result, ALLOWED_CHARS_INPUT); if (count > 0) - info(udevice->udev, "%i character(s) replaced\n" , count); + info(event->udev, "%i character(s) replaced\n" , count); } - dbg(udevice->udev, "result is '%s'\n", result); - util_strlcpy(udevice->program_result, result, sizeof(udevice->program_result)); - dbg(udevice->udev, "PROGRAM returned successful\n"); + dbg(event->udev, "result is '%s'\n", result); + util_strlcpy(event->program_result, result, sizeof(event->program_result)); + dbg(event->udev, "PROGRAM returned successful\n"); if (rule->program.operation == KEY_OP_NOMATCH) goto nomatch; } - dbg(udevice->udev, "PROGRAM key is true\n"); + dbg(event->udev, "PROGRAM key is true\n"); } /* check for matching result of external program */ - if (match_key(udevice->udev, "RESULT", rule, &rule->result, udevice->program_result)) + if (match_key(event->udev, "RESULT", rule, &rule->result, event->program_result)) goto nomatch; /* import variables returned from program or or file into environment */ @@ -1266,24 +1267,24 @@ try_parent: int rc = -1; util_strlcpy(import, key_val(rule, &rule->import), sizeof(import)); - udev_rules_apply_format(udevice, import, sizeof(import)); - dbg(udevice->udev, "check for IMPORT import='%s'\n", import); + udev_rules_apply_format(event, import, sizeof(import)); + dbg(event->udev, "check for IMPORT import='%s'\n", import); if (rule->import_type == IMPORT_PROGRAM) { - rc = import_program_into_env(udevice, import); + rc = import_program_into_env(event, import); } else if (rule->import_type == IMPORT_FILE) { - dbg(udevice->udev, "import file import='%s'\n", import); - rc = import_file_into_env(udevice, import); + dbg(event->udev, "import file import='%s'\n", import); + rc = import_file_into_env(event, import); } else if (rule->import_type == IMPORT_PARENT) { - dbg(udevice->udev, "import parent import='%s'\n", import); - rc = import_parent_into_env(udevice, import); + dbg(event->udev, "import parent import='%s'\n", import); + rc = import_parent_into_env(event, import); } if (rc != 0) { - dbg(udevice->udev, "IMPORT failed\n"); + dbg(event->udev, "IMPORT failed\n"); if (rule->import.operation != KEY_OP_NOMATCH) goto nomatch; } else - dbg(udevice->udev, "IMPORT '%s' imported\n", key_val(rule, &rule->import)); - dbg(udevice->udev, "IMPORT key is true\n"); + dbg(event->udev, "IMPORT '%s' imported\n", key_val(rule, &rule->import)); + dbg(event->udev, "IMPORT key is true\n"); } /* rule matches, if we have ENV assignments export it */ @@ -1297,20 +1298,15 @@ try_parent: /* make sure we don't write to the same string we possibly read from */ util_strlcpy(temp_value, value, sizeof(temp_value)); - udev_rules_apply_format(udevice, temp_value, sizeof(temp_value)); + udev_rules_apply_format(event, temp_value, sizeof(temp_value)); - if (temp_value[0] == '\0') { - name_list_key_remove(udevice->udev, &udevice->env_list, key_name); - unsetenv(key_name); - info(udevice->udev, "unset ENV '%s'\n", key_name); - } else { - struct name_entry *entry; + if (temp_value[0] != '\0') { + struct udev_list_entry *entry; - entry = name_list_key_add(udevice->udev, &udevice->env_list, key_name, temp_value); - if (entry == NULL) - break; - putenv(entry->name); - info(udevice->udev, "set ENV '%s'\n", entry->name); + info(event->udev, "set ENV '%s=%s'\n", key_name, temp_value); + entry = udev_device_add_property(dev, key_name, temp_value); + /* store in db */ + udev_list_entry_set_flag(entry, 1); } } } @@ -1321,24 +1317,28 @@ try_parent: if (pair->key.operation == KEY_OP_ASSIGN) { const char *key_name = key_pair_name(rule, pair); - char devpath[UTIL_PATH_SIZE]; + char *subsys; + char *sysname; char *attrib; - char attr[UTIL_PATH_SIZE] = ""; + char attr[UTIL_PATH_SIZE]; char value[UTIL_NAME_SIZE]; FILE *f; - if (attr_get_by_subsys_id(udevice->udev, key_name, devpath, sizeof(devpath), &attrib)) { - if (attrib != NULL) { - util_strlcpy(attr, udev_get_sys_path(udevice->udev), sizeof(attr)); - util_strlcat(attr, devpath, sizeof(attr)); - util_strlcat(attr, "/", sizeof(attr)); - util_strlcat(attr, attrib, sizeof(attr)); - } - } + util_strlcpy(attr, key_name, sizeof(attr)); + if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { + struct udev_device *d; - if (attr[0] == '\0') { - util_strlcpy(attr, udev_get_sys_path(udevice->udev), sizeof(attr)); - util_strlcat(attr, udevice->dev->devpath, sizeof(attr)); + d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); + if (d != NULL) { + util_strlcpy(attr, udev_device_get_syspath(d), sizeof(attr)); + if (attrib != NULL) { + util_strlcat(attr, "/", sizeof(attr)); + util_strlcat(attr, attrib, sizeof(attr)); + } + udev_device_unref(d); + } + } else { + util_strlcpy(attr, udev_device_get_syspath(dev), sizeof(attr)); util_strlcat(attr, "/", sizeof(attr)); util_strlcat(attr, key_name, sizeof(attr)); } @@ -1346,16 +1346,16 @@ try_parent: attr_subst_subdir(attr, sizeof(attr)); util_strlcpy(value, key_val(rule, &pair->key), sizeof(value)); - udev_rules_apply_format(udevice, value, sizeof(value)); - info(udevice->udev, "writing '%s' to sysfs file '%s'\n", value, attr); + udev_rules_apply_format(event, value, sizeof(value)); + info(event->udev, "writing '%s' to sysfs file '%s'\n", value, attr); f = fopen(attr, "w"); if (f != NULL) { - if (!udevice->test_run) + if (!event->test) if (fprintf(f, "%s", value) <= 0) - err(udevice->udev, "error writing ATTR{%s}: %m\n", attr); + err(event->udev, "error writing ATTR{%s}: %m\n", attr); fclose(f); } else - err(udevice->udev, "error opening ATTR{%s} for writing: %m\n", attr); + err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); } } return 0; @@ -1364,14 +1364,14 @@ nomatch: return -1; } -int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) +int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) { + struct udev_device *dev = event->dev; struct udev_rules_iter iter; struct udev_rule *rule; int name_set = 0; - dbg(udevice->udev, "udevice->dev->devpath='%s'\n", udevice->dev->devpath); - dbg(udevice->udev, "udevice->dev->kernel='%s'\n", udevice->dev->kernel); + dbg(event->udev, "device: '%s'\n", udev_device_get_syspath(dev)); /* look for a matching rule to apply */ udev_rules_iter_init(&iter, rules); @@ -1384,104 +1384,115 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) (rule->name.operation == KEY_OP_ASSIGN || rule->name.operation == KEY_OP_ASSIGN_FINAL || rule->name.operation == KEY_OP_ADD)) { - dbg(udevice->udev, "node name already set, rule ignored\n"); + dbg(event->udev, "node name already set, rule ignored\n"); continue; } - dbg(udevice->udev, "process rule\n"); - if (match_rule(udevice, rule) == 0) { + dbg(event->udev, "process rule\n"); + if (match_rule(event, rule) == 0) { /* apply options */ if (rule->ignore_device) { - info(udevice->udev, "rule applied, '%s' is ignored\n", udevice->dev->kernel); - udevice->ignore_device = 1; + info(event->udev, "rule applied, '%s' is ignored\n", udev_device_get_sysname(dev)); + event->ignore_device = 1; return 0; } if (rule->ignore_remove) { - udevice->ignore_remove = 1; - dbg(udevice->udev, "remove event should be ignored\n"); + udev_device_set_ignore_remove(dev, 1); + dbg(event->udev, "remove event should be ignored\n"); } if (rule->link_priority != 0) { - udevice->link_priority = rule->link_priority; - info(udevice->udev, "link_priority=%i\n", udevice->link_priority); + udev_device_set_devlink_priority(dev, rule->link_priority); + info(event->udev, "devlink_priority=%i\n", rule->link_priority); } if (rule->event_timeout >= 0) { - udevice->event_timeout = rule->event_timeout; - info(udevice->udev, "event_timeout=%i\n", udevice->event_timeout); + udev_device_set_event_timeout(dev, rule->event_timeout); + info(event->udev, "event_timeout=%i\n", rule->event_timeout); } - /* apply all_partitions option only at a main block device */ - if (rule->partitions && - strcmp(udevice->dev->subsystem, "block") == 0 && udevice->dev->kernel_number[0] == '\0') { - udevice->partitions = rule->partitions; - dbg(udevice->udev, "creation of partition nodes requested\n"); + /* apply all_partitions option only at a disk device */ + if (rule->partitions > 0 && + strcmp(udev_device_get_subsystem(dev), "block") == 0 && + udev_device_get_sysnum(dev) == NULL) { + udev_device_set_num_fake_partitions(dev, rule->partitions); + dbg(event->udev, "creation of partition nodes requested\n"); } /* apply permissions */ - if (!udevice->mode_final && rule->mode.operation != KEY_OP_UNSET) { + if (!event->mode_final && rule->mode.operation != KEY_OP_UNSET) { if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) - udevice->mode_final = 1; + event->mode_final = 1; char buf[20]; util_strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); - udev_rules_apply_format(udevice, buf, sizeof(buf)); - udevice->mode = strtol(buf, NULL, 8); - dbg(udevice->udev, "applied mode=%#o to '%s'\n", udevice->mode, udevice->dev->kernel); + udev_rules_apply_format(event, buf, sizeof(buf)); + event->mode = strtol(buf, NULL, 8); + dbg(event->udev, "applied mode=%#o to '%s'\n", + event->mode, udev_device_get_sysname(dev)); } - if (!udevice->owner_final && rule->owner.operation != KEY_OP_UNSET) { + if (!event->owner_final && rule->owner.operation != KEY_OP_UNSET) { if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) - udevice->owner_final = 1; - util_strlcpy(udevice->owner, key_val(rule, &rule->owner), sizeof(udevice->owner)); - udev_rules_apply_format(udevice, udevice->owner, sizeof(udevice->owner)); - dbg(udevice->udev, "applied owner='%s' to '%s'\n", udevice->owner, udevice->dev->kernel); + event->owner_final = 1; + util_strlcpy(event->owner, key_val(rule, &rule->owner), sizeof(event->owner)); + udev_rules_apply_format(event, event->owner, sizeof(event->owner)); + dbg(event->udev, "applied owner='%s' to '%s'\n", + event->owner, udev_device_get_sysname(dev)); } - if (!udevice->group_final && rule->group.operation != KEY_OP_UNSET) { + if (!event->group_final && rule->group.operation != KEY_OP_UNSET) { if (rule->group.operation == KEY_OP_ASSIGN_FINAL) - udevice->group_final = 1; - util_strlcpy(udevice->group, key_val(rule, &rule->group), sizeof(udevice->group)); - udev_rules_apply_format(udevice, udevice->group, sizeof(udevice->group)); - dbg(udevice->udev, "applied group='%s' to '%s'\n", udevice->group, udevice->dev->kernel); + event->group_final = 1; + util_strlcpy(event->group, key_val(rule, &rule->group), sizeof(event->group)); + udev_rules_apply_format(event, event->group, sizeof(event->group)); + dbg(event->udev, "applied group='%s' to '%s'\n", + event->group, udev_device_get_sysname(dev)); } /* collect symlinks */ - if (!udevice->symlink_final && + if (!event->devlink_final && (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL || rule->symlink.operation == KEY_OP_ADD)) { char temp[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; char *pos, *next; int count = 0; if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) - udevice->symlink_final = 1; + event->devlink_final = 1; if (rule->symlink.operation == KEY_OP_ASSIGN || rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { - info(udevice->udev, "reset symlink list\n"); - name_list_cleanup(udevice->udev, &udevice->symlink_list); + info(event->udev, "reset symlink list\n"); + udev_device_cleanup_devlinks_list(dev); } /* allow multiple symlinks separated by spaces */ util_strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); - udev_rules_apply_format(udevice, temp, sizeof(temp)); + udev_rules_apply_format(event, temp, sizeof(temp)); if (rule->string_escape == ESCAPE_UNSET) count = util_replace_chars(temp, ALLOWED_CHARS_FILE " "); else if (rule->string_escape == ESCAPE_REPLACE) count = util_replace_chars(temp, ALLOWED_CHARS_FILE); if (count > 0) - info(udevice->udev, "%i character(s) replaced\n" , count); - dbg(udevice->udev, "rule applied, added symlink(s) '%s'\n", temp); + info(event->udev, "%i character(s) replaced\n" , count); + dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); pos = temp; while (isspace(pos[0])) pos++; next = strchr(pos, ' '); while (next) { next[0] = '\0'; - info(udevice->udev, "add symlink '%s'\n", pos); - name_list_add(udevice->udev, &udevice->symlink_list, pos, 0); + info(event->udev, "add symlink '%s'\n", pos); + util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, pos, sizeof(filename)); + udev_device_add_devlink(dev, filename); while (isspace(next[1])) next++; pos = &next[1]; next = strchr(pos, ' '); } if (pos[0] != '\0') { - info(udevice->udev, "add symlink '%s'\n", pos); - name_list_add(udevice->udev, &udevice->symlink_list, pos, 0); + info(event->udev, "add symlink '%s'\n", pos); + util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, pos, sizeof(filename)); + udev_device_add_devlink(dev, filename); } } @@ -1492,68 +1503,72 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udevice) int count; name_set = 1; - util_strlcpy(udevice->name, key_val(rule, &rule->name), sizeof(udevice->name)); - udev_rules_apply_format(udevice, udevice->name, sizeof(udevice->name)); + util_strlcpy(event->name, key_val(rule, &rule->name), sizeof(event->name)); + udev_rules_apply_format(event, event->name, sizeof(event->name)); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { - count = util_replace_chars(udevice->name, ALLOWED_CHARS_FILE); + count = util_replace_chars(event->name, ALLOWED_CHARS_FILE); if (count > 0) - info(udevice->udev, "%i character(s) replaced\n", count); + info(event->udev, "%i character(s) replaced\n", count); } - info(udevice->udev, "rule applied, '%s' becomes '%s'\n", udevice->dev->kernel, udevice->name); - if (strcmp(udevice->dev->subsystem, "net") != 0) - dbg(udevice->udev, "name, '%s' is going to have owner='%s', group='%s', mode=%#o partitions=%i\n", - udevice->name, udevice->owner, udevice->group, udevice->mode, udevice->partitions); + info(event->udev, "rule applied, '%s' becomes '%s'\n", + udev_device_get_sysname(dev), event->name); + if (strcmp(udev_device_get_subsystem(dev), "net") != 0) + dbg(event->udev, "'%s' owner='%s', group='%s', mode=%#o partitions=%i\n", + event->name, event->owner, event->group, event->mode, + udev_device_get_num_fake_partitions(dev)); } - if (!udevice->run_final && rule->run.operation != KEY_OP_UNSET) { - struct name_entry *entry; + if (!event->run_final && rule->run.operation != KEY_OP_UNSET) { + struct udev_list_entry *list_entry; if (rule->run.operation == KEY_OP_ASSIGN_FINAL) - udevice->run_final = 1; + event->run_final = 1; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info(udevice->udev, "reset run list\n"); - name_list_cleanup(udevice->udev, &udevice->run_list); + info(event->udev, "reset run list\n"); + udev_list_cleanup(event->udev, &event->run_list); } - dbg(udevice->udev, "add run '%s'\n", key_val(rule, &rule->run)); - entry = name_list_add(udevice->udev, &udevice->run_list, key_val(rule, &rule->run), 0); - if (rule->run_ignore_error) - entry->ignore_error = 1; + dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); + list_entry = udev_list_entry_add(event->udev, &event->run_list, + key_val(rule, &rule->run), NULL, 1, 0); + if (rule->run_ignore_error && list_entry != NULL) + udev_list_entry_set_flag(list_entry, 1); } if (rule->last_rule) { - dbg(udevice->udev, "last rule to be applied\n"); + dbg(event->udev, "last rule to be applied\n"); break; } if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg(udevice->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); + dbg(event->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); udev_rules_iter_goto(&iter, rule->goto_rule_off); } } } if (!name_set) { - info(udevice->udev, "no node name set, will use kernel name '%s'\n", udevice->dev->kernel); - util_strlcpy(udevice->name, udevice->dev->kernel, sizeof(udevice->name)); + info(event->udev, "no node name set, will use kernel name '%s'\n", + udev_device_get_sysname(dev)); + util_strlcpy(event->name, udev_device_get_sysname(dev), sizeof(event->name)); } - if (udevice->tmp_node[0] != '\0') { - dbg(udevice->udev, "removing temporary device node\n"); - unlink_secure(udevice->udev, udevice->tmp_node); - udevice->tmp_node[0] = '\0'; + if (event->tmp_node[0] != '\0') { + dbg(event->udev, "removing temporary device node\n"); + unlink_secure(event->udev, event->tmp_node); + event->tmp_node[0] = '\0'; } - return 0; } -int udev_rules_get_run(struct udev_rules *rules, struct udevice *udevice) +int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event) { + struct udev_device *dev = event->dev; struct udev_rules_iter iter; struct udev_rule *rule; - dbg(udevice->udev, "udevice->kernel='%s'\n", udevice->dev->kernel); + dbg(event->udev, "sysname: '%s'\n", udev_device_get_sysname(dev)); /* look for a matching rule to apply */ udev_rules_iter_init(&iter, rules); @@ -1562,7 +1577,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udevice) if (rule == NULL) break; - dbg(udevice->udev, "process rule\n"); + dbg(event->udev, "process rule\n"); if (rule->name.operation == KEY_OP_ASSIGN || rule->name.operation == KEY_OP_ASSIGN_FINAL || rule->name.operation == KEY_OP_ADD || @@ -1571,44 +1586,45 @@ int udev_rules_get_run(struct udev_rules *rules, struct udevice *udevice) rule->symlink.operation == KEY_OP_ADD || rule->mode.operation != KEY_OP_UNSET || rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { - dbg(udevice->udev, "skip rule that names a device\n"); + dbg(event->udev, "skip rule that names a device\n"); continue; } - if (match_rule(udevice, rule) == 0) { + if (match_rule(event, rule) == 0) { if (rule->ignore_device) { - info(udevice->udev, "rule applied, '%s' is ignored\n", udevice->dev->kernel); - udevice->ignore_device = 1; + info(event->udev, "rule applied, '%s' is ignored\n", udev_device_get_sysname(dev)); + event->ignore_device = 1; return 0; } if (rule->ignore_remove) { - udevice->ignore_remove = 1; - dbg(udevice->udev, "remove event should be ignored\n"); + udev_device_set_ignore_remove(dev, 1); + dbg(event->udev, "remove event should be ignored\n"); } - if (!udevice->run_final && rule->run.operation != KEY_OP_UNSET) { - struct name_entry *entry; + if (!event->run_final && rule->run.operation != KEY_OP_UNSET) { + struct udev_list_entry *list_entry; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info(udevice->udev, "reset run list\n"); - name_list_cleanup(udevice->udev, &udevice->run_list); + info(event->udev, "reset run list\n"); + udev_list_cleanup(event->udev, &event->run_list); } - dbg(udevice->udev, "add run '%s'\n", key_val(rule, &rule->run)); - entry = name_list_add(udevice->udev, &udevice->run_list, key_val(rule, &rule->run), 0); - if (rule->run_ignore_error) - entry->ignore_error = 1; + dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); + list_entry = udev_list_entry_add(event->udev, &event->run_list, + key_val(rule, &rule->run), NULL, 1, 0); + if (rule->run_ignore_error && list_entry != NULL) + udev_list_entry_set_flag(list_entry, 1); if (rule->run.operation == KEY_OP_ASSIGN_FINAL) break; } if (rule->last_rule) { - dbg(udevice->udev, "last rule to be applied\n"); + dbg(event->udev, "last rule to be applied\n"); break; } if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg(udevice->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); + dbg(event->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); udev_rules_iter_goto(&iter, rule->goto_rule_off); } } diff --git a/udev/udev_rules.h b/udev/udev_rules.h index af96b8119b..d8f2f367c9 100644 --- a/udev/udev_rules.h +++ b/udev/udev_rules.h @@ -125,10 +125,10 @@ extern void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules extern struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter); extern struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off); -extern int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev); -extern int udev_rules_get_run(struct udev_rules *rules, struct udevice *udev); -extern int udev_rules_run(struct udevice *udev); +extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event); +extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event); +extern int udev_rules_run(struct udev_event *event); -extern void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize); +extern void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize); #endif diff --git a/udev/udev_sysfs.c b/udev/udev_sysfs.c deleted file mode 100644 index 2ea724a78f..0000000000 --- a/udev/udev_sysfs.c +++ /dev/null @@ -1,499 +0,0 @@ -/* - * Copyright (C) 2005-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -/* device cache */ -static LIST_HEAD(dev_list); - -/* attribute value cache */ -static LIST_HEAD(attr_list); - -struct sysfs_attr { - struct list_head node; - char path[UTIL_PATH_SIZE]; - char *value; /* points to value_local if value is cached */ - char value_local[UTIL_NAME_SIZE]; -}; - -static int resolve_sys_link(struct udev *udev, char *path, size_t size) -{ - char link_path[UTIL_PATH_SIZE]; - char link_target[UTIL_PATH_SIZE]; - - int len; - int i; - int back; - - util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - util_strlcat(link_path, path, sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len <= 0) - return -1; - link_target[len] = '\0'; - dbg(udev, "path link '%s' points to '%s'\n", path, link_target); - - for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) - ; - dbg(udev, "base '%s', tail '%s', back %i\n", path, &link_target[back * 3], back); - for (i = 0; i <= back; i++) { - char *pos = strrchr(path, '/'); - - if (pos == NULL) - return -1; - pos[0] = '\0'; - } - dbg(udev, "after moving back '%s'\n", path); - util_strlcat(path, "/", size); - util_strlcat(path, &link_target[back * 3], size); - return 0; -} - -int sysfs_init(void) -{ - INIT_LIST_HEAD(&dev_list); - INIT_LIST_HEAD(&attr_list); - return 0; -} - -void sysfs_cleanup(void) -{ - struct sysfs_attr *attr_loop; - struct sysfs_attr *attr_temp; - struct sysfs_device *dev_loop; - struct sysfs_device *dev_temp; - - list_for_each_entry_safe(attr_loop, attr_temp, &attr_list, node) { - list_del(&attr_loop->node); - free(attr_loop); - } - - list_for_each_entry_safe(dev_loop, dev_temp, &dev_list, node) { - list_del(&dev_loop->node); - free(dev_loop); - } -} - -void sysfs_device_set_values(struct udev *udev, - struct sysfs_device *dev, const char *devpath, - const char *subsystem, const char *driver) -{ - char *pos; - - util_strlcpy(dev->devpath, devpath, sizeof(dev->devpath)); - if (subsystem != NULL) - util_strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); - if (driver != NULL) - util_strlcpy(dev->driver, driver, sizeof(dev->driver)); - - /* set kernel name */ - pos = strrchr(dev->devpath, '/'); - if (pos == NULL) - return; - util_strlcpy(dev->kernel, &pos[1], sizeof(dev->kernel)); - dbg(udev, "kernel='%s'\n", dev->kernel); - - /* some devices have '!' in their name, change that to '/' */ - pos = dev->kernel; - while (pos[0] != '\0') { - if (pos[0] == '!') - pos[0] = '/'; - pos++; - } - - /* get kernel number */ - pos = &dev->kernel[strlen(dev->kernel)]; - while (isdigit(pos[-1])) - pos--; - util_strlcpy(dev->kernel_number, pos, sizeof(dev->kernel_number)); - dbg(udev, "kernel_number='%s'\n", dev->kernel_number); -} - -struct sysfs_device *sysfs_device_get(struct udev *udev, const char *devpath) -{ - char path[UTIL_PATH_SIZE]; - char devpath_real[UTIL_PATH_SIZE]; - struct sysfs_device *dev; - struct sysfs_device *dev_loop; - struct stat statbuf; - char link_path[UTIL_PATH_SIZE]; - char link_target[UTIL_PATH_SIZE]; - int len; - char *pos; - - /* we handle only these devpathes */ - if (devpath != NULL && - strncmp(devpath, "/devices/", 9) != 0 && - strncmp(devpath, "/subsystem/", 11) != 0 && - strncmp(devpath, "/module/", 8) != 0 && - strncmp(devpath, "/bus/", 5) != 0 && - strncmp(devpath, "/class/", 7) != 0 && - strncmp(devpath, "/block/", 7) != 0) - return NULL; - - dbg(udev, "open '%s'\n", devpath); - util_strlcpy(devpath_real, devpath, sizeof(devpath_real)); - util_remove_trailing_chars(devpath_real, '/'); - if (devpath[0] == '\0' ) - return NULL; - - /* look for device already in cache (we never put an untranslated path in the cache) */ - list_for_each_entry(dev_loop, &dev_list, node) { - if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg(udev, "found in cache '%s'\n", dev_loop->devpath); - return dev_loop; - } - } - - /* if we got a link, resolve it to the real device */ - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, devpath_real, sizeof(path)); - if (lstat(path, &statbuf) != 0) { - dbg(udev, "stat '%s' failed: %m\n", path); - return NULL; - } - if (S_ISLNK(statbuf.st_mode)) { - if (resolve_sys_link(udev, devpath_real, sizeof(devpath_real)) != 0) - return NULL; - - /* now look for device in cache after path translation */ - list_for_each_entry(dev_loop, &dev_list, node) { - if (strcmp(dev_loop->devpath, devpath_real) == 0) { - dbg(udev, "found in cache '%s'\n", dev_loop->devpath); - return dev_loop; - } - } - } - - /* it is a new device */ - dbg(udev, "new uncached device '%s'\n", devpath_real); - dev = malloc(sizeof(struct sysfs_device)); - if (dev == NULL) - return NULL; - memset(dev, 0x00, sizeof(struct sysfs_device)); - - sysfs_device_set_values(udev, dev, devpath_real, NULL, NULL); - - /* get subsystem name */ - util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - util_strlcat(link_path, dev->devpath, sizeof(link_path)); - util_strlcat(link_path, "/subsystem", sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len > 0) { - /* get subsystem from "subsystem" link */ - link_target[len] = '\0'; - dbg(udev, "subsystem link '%s' points to '%s'\n", link_path, link_target); - pos = strrchr(link_target, '/'); - if (pos != NULL) - util_strlcpy(dev->subsystem, &pos[1], sizeof(dev->subsystem)); - } else if (strstr(dev->devpath, "/drivers/") != NULL) { - util_strlcpy(dev->subsystem, "drivers", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/module/", 8) == 0) { - util_strlcpy(dev->subsystem, "module", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/subsystem/", 11) == 0) { - pos = strrchr(dev->devpath, '/'); - if (pos == &dev->devpath[10]) - util_strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/class/", 7) == 0) { - pos = strrchr(dev->devpath, '/'); - if (pos == &dev->devpath[6]) - util_strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); - } else if (strncmp(dev->devpath, "/bus/", 5) == 0) { - pos = strrchr(dev->devpath, '/'); - if (pos == &dev->devpath[4]) - util_strlcpy(dev->subsystem, "subsystem", sizeof(dev->subsystem)); - } - - /* get driver name */ - util_strlcpy(link_path, udev_get_sys_path(udev), sizeof(link_path)); - util_strlcat(link_path, dev->devpath, sizeof(link_path)); - util_strlcat(link_path, "/driver", sizeof(link_path)); - len = readlink(link_path, link_target, sizeof(link_target)); - if (len > 0) { - link_target[len] = '\0'; - dbg(udev, "driver link '%s' points to '%s'\n", link_path, link_target); - pos = strrchr(link_target, '/'); - if (pos != NULL) - util_strlcpy(dev->driver, &pos[1], sizeof(dev->driver)); - } - - dbg(udev, "add to cache 'devpath=%s', subsystem='%s', driver='%s'\n", dev->devpath, dev->subsystem, dev->driver); - list_add(&dev->node, &dev_list); - - return dev; -} - -struct sysfs_device *sysfs_device_get_parent(struct udev *udev, struct sysfs_device *dev) -{ - char parent_devpath[UTIL_PATH_SIZE]; - char *pos; - - dbg(udev, "open '%s'\n", dev->devpath); - - /* look if we already know the parent */ - if (dev->parent != NULL) - return dev->parent; - - util_strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - dbg(udev, "'%s'\n", parent_devpath); - - /* strip last element */ - pos = strrchr(parent_devpath, '/'); - if (pos == NULL || pos == parent_devpath) - return NULL; - pos[0] = '\0'; - - if (strncmp(parent_devpath, "/class", 6) == 0) { - pos = strrchr(parent_devpath, '/'); - if (pos == &parent_devpath[6] || pos == parent_devpath) { - dbg(udev, "/class top level, look for device link\n"); - goto device_link; - } - } - if (strcmp(parent_devpath, "/block") == 0) { - dbg(udev, "/block top level, look for device link\n"); - goto device_link; - } - - /* are we at the top level? */ - pos = strrchr(parent_devpath, '/'); - if (pos == NULL || pos == parent_devpath) - return NULL; - - /* get parent and remember it */ - dev->parent = sysfs_device_get(udev, parent_devpath); - return dev->parent; - -device_link: - util_strlcpy(parent_devpath, dev->devpath, sizeof(parent_devpath)); - util_strlcat(parent_devpath, "/device", sizeof(parent_devpath)); - if (resolve_sys_link(udev, parent_devpath, sizeof(parent_devpath)) != 0) - return NULL; - - /* get parent and remember it */ - dev->parent = sysfs_device_get(udev, parent_devpath); - return dev->parent; -} - -struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct udev *udev, struct sysfs_device *dev, const char *subsystem) -{ - struct sysfs_device *dev_parent; - - dev_parent = sysfs_device_get_parent(udev, dev); - while (dev_parent != NULL) { - if (strcmp(dev_parent->subsystem, subsystem) == 0) - return dev_parent; - dev_parent = sysfs_device_get_parent(udev, dev_parent); - } - return NULL; -} - -char *sysfs_attr_get_value(struct udev *udev, const char *devpath, const char *attr_name) -{ - char path_full[UTIL_PATH_SIZE]; - const char *path; - char value[UTIL_NAME_SIZE]; - struct sysfs_attr *attr_loop; - struct sysfs_attr *attr; - struct stat statbuf; - int fd; - ssize_t size; - size_t sysfs_len; - - dbg(udev, "open '%s'/'%s'\n", devpath, attr_name); - sysfs_len = util_strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); - if(sysfs_len >= sizeof(path_full)) - sysfs_len = sizeof(path_full) - 1; - path = &path_full[sysfs_len]; - util_strlcat(path_full, devpath, sizeof(path_full)); - util_strlcat(path_full, "/", sizeof(path_full)); - util_strlcat(path_full, attr_name, sizeof(path_full)); - - /* look for attribute in cache */ - list_for_each_entry(attr_loop, &attr_list, node) { - if (strcmp(attr_loop->path, path) == 0) { - dbg(udev, "found in cache '%s'\n", attr_loop->path); - return attr_loop->value; - } - } - - /* store attribute in cache (also negatives are kept in cache) */ - dbg(udev, "new uncached attribute '%s'\n", path_full); - attr = malloc(sizeof(struct sysfs_attr)); - if (attr == NULL) - return NULL; - memset(attr, 0x00, sizeof(struct sysfs_attr)); - util_strlcpy(attr->path, path, sizeof(attr->path)); - dbg(udev, "add to cache '%s'\n", path_full); - list_add(&attr->node, &attr_list); - - if (lstat(path_full, &statbuf) != 0) { - dbg(udev, "stat '%s' failed: %m\n", path_full); - goto out; - } - - if (S_ISLNK(statbuf.st_mode)) { - /* links return the last element of the target path */ - char link_target[UTIL_PATH_SIZE]; - int len; - const char *pos; - - len = readlink(path_full, link_target, sizeof(link_target)); - if (len > 0) { - link_target[len] = '\0'; - pos = strrchr(link_target, '/'); - if (pos != NULL) { - dbg(udev, "cache '%s' with link value '%s'\n", path_full, value); - util_strlcpy(attr->value_local, &pos[1], sizeof(attr->value_local)); - attr->value = attr->value_local; - } - } - goto out; - } - - /* skip directories */ - if (S_ISDIR(statbuf.st_mode)) - goto out; - - /* skip non-readable files */ - if ((statbuf.st_mode & S_IRUSR) == 0) - goto out; - - /* read attribute value */ - fd = open(path_full, O_RDONLY); - if (fd < 0) { - dbg(udev, "attribute '%s' can not be opened\n", path_full); - goto out; - } - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - if (size == sizeof(value)) - goto out; - - /* got a valid value, store and return it */ - value[size] = '\0'; - util_remove_trailing_chars(value, '\n'); - dbg(udev, "cache '%s' with attribute value '%s'\n", path_full, value); - util_strlcpy(attr->value_local, value, sizeof(attr->value_local)); - attr->value = attr->value_local; - -out: - return attr->value; -} - -int sysfs_lookup_devpath_by_subsys_id(struct udev *udev, char *devpath_full, size_t len, const char *subsystem, const char *id) -{ - size_t sysfs_len; - char path_full[UTIL_PATH_SIZE]; - char *path; - struct stat statbuf; - - sysfs_len = util_strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); - path = &path_full[sysfs_len]; - - if (strcmp(subsystem, "subsystem") == 0) { - util_strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); - util_strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); - util_strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - - util_strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); - util_strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - } - - if (strcmp(subsystem, "module") == 0) { - util_strlcpy(path, "/module/", sizeof(path_full) - sysfs_len); - util_strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - } - - if (strcmp(subsystem, "drivers") == 0) { - char subsys[UTIL_NAME_SIZE]; - char *driver; - - util_strlcpy(subsys, id, sizeof(subsys)); - driver = strchr(subsys, ':'); - if (driver != NULL) { - driver[0] = '\0'; - driver = &driver[1]; - util_strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); - util_strlcat(path, subsys, sizeof(path_full) - sysfs_len); - util_strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); - util_strlcat(path, driver, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); - util_strlcat(path, subsys, sizeof(path_full) - sysfs_len); - util_strlcat(path, "/drivers/", sizeof(path_full) - sysfs_len); - util_strlcat(path, driver, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - } - goto out; - } - - util_strlcpy(path, "/subsystem/", sizeof(path_full) - sysfs_len); - util_strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - util_strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); - util_strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strlcpy(path, "/bus/", sizeof(path_full) - sysfs_len); - util_strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - util_strlcat(path, "/devices/", sizeof(path_full) - sysfs_len); - util_strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strlcpy(path, "/class/", sizeof(path_full) - sysfs_len); - util_strlcat(path, subsystem, sizeof(path_full) - sysfs_len); - util_strlcat(path, "/", sizeof(path_full) - sysfs_len); - util_strlcat(path, id, sizeof(path_full) - sysfs_len); - if (stat(path_full, &statbuf) == 0) - goto found; -out: - return 0; -found: - if (S_ISLNK(statbuf.st_mode)) - resolve_sys_link(udev, path, sizeof(path_full) - sysfs_len); - util_strlcpy(devpath_full, path, len); - return 1; -} diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index b18f249495..78c218eef0 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -141,15 +141,15 @@ static void print_record(struct udev_device *device) if (str != NULL) printf("N: %s\n", &str[len+1]); - i = device_get_devlink_priority(device); + i = udev_device_get_devlink_priority(device); if (i != 0) printf("L: %i\n", i); - i = device_get_num_fake_partitions(device); + i = udev_device_get_num_fake_partitions(device); if (i != 0) printf("A:%u\n", i); - i = device_get_ignore_remove(device); + i = udev_device_get_ignore_remove(device); if (i != 0) printf("R:%u\n", i); diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index f4b0125d3c..70da9ebf67 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -31,60 +31,20 @@ #include "udev.h" #include "udev_rules.h" -static int import_uevent_var(struct udev *udev, const char *devpath) -{ - char path[UTIL_PATH_SIZE]; - static char value[4096]; /* must stay, used with putenv */ - ssize_t size; - int fd; - char *key; - char *next; - int rc = -1; - - /* read uevent file */ - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, devpath, sizeof(path)); - util_strlcat(path, "/uevent", sizeof(path)); - fd = open(path, O_RDONLY); - if (fd < 0) - goto out; - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - value[size] = '\0'; - - /* import keys into environment */ - key = value; - while (key[0] != '\0') { - next = strchr(key, '\n'); - if (next == NULL) - goto out; - next[0] = '\0'; - info(udev, "import into environment: '%s'\n", key); - putenv(key); - key = &next[1]; - } - rc = 0; -out: - return rc; -} - int udevadm_test(struct udev *udev, int argc, char *argv[]) { + char filename[UTIL_PATH_SIZE]; int force = 0; const char *action = "add"; - const char *subsystem = NULL; - const char *devpath = NULL; - struct udevice *udevice; - struct sysfs_device *dev; + const char *syspath = NULL; + struct udev_event *event; + struct udev_device *dev; struct udev_rules rules = {}; - int retval; + int err; int rc = 0; static const struct option options[] = { { "action", required_argument, NULL, 'a' }, - { "subsystem", required_argument, NULL, 's' }, { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, {} @@ -92,14 +52,6 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) info(udev, "version %s\n", VERSION); - /* export log priority to executed programs */ - if (udev_get_log_priority(udev) > 0) { - char priority[32]; - - sprintf(priority, "%i", udev_get_log_priority(udev)); - setenv("UDEV_LOG", priority, 1); - } - while (1) { int option; @@ -112,16 +64,12 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) case 'a': action = optarg; break; - case 's': - subsystem = optarg; - break; case 'f': force = 1; break; case 'h': - printf("Usage: udevadm test OPTIONS \n" + printf("Usage: udevadm test OPTIONS \n" " --action= set action string\n" - " --subsystem= set subsystem string\n" " --force don't skip node/link creation\n" " --help print this help text\n\n"); exit(0); @@ -129,10 +77,10 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) exit(1); } } - devpath = argv[optind]; + syspath = argv[optind]; - if (devpath == NULL) { - fprintf(stderr, "devpath parameter missing\n"); + if (syspath == NULL) { + fprintf(stderr, "syspath parameter missing\n"); rc = 1; goto exit; } @@ -144,60 +92,49 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) udev_rules_init(udev, &rules, 0); - /* remove /sys if given */ - if (strncmp(devpath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) == 0) - devpath = &devpath[strlen(udev_get_sys_path(udev))]; + /* add /sys if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { + util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); + util_strlcat(filename, syspath, sizeof(filename)); + syspath = filename; + } - dev = sysfs_device_get(udev, devpath); + dev = udev_device_new_from_syspath(udev, syspath); if (dev == NULL) { - fprintf(stderr, "unable to open device '%s'\n", devpath); + fprintf(stderr, "unable to open device '%s'\n", syspath); rc = 2; goto exit; } - udevice = udev_device_init(udev); - if (udevice == NULL) { - fprintf(stderr, "error initializing device\n"); - rc = 3; - goto exit; - } + /* skip reading of db, but read kernel parameters */ + udev_device_set_info_loaded(dev); + udev_device_read_uevent_file(dev); - if (subsystem != NULL) - util_strlcpy(dev->subsystem, subsystem, sizeof(dev->subsystem)); - - /* override built-in sysfs device */ - udevice->dev = dev; - util_strlcpy(udevice->action, action, sizeof(udevice->action)); - udevice->devt = udev_device_get_devt(udevice); + udev_device_set_action(dev, action); + event = udev_event_new(dev); /* simulate node creation with test flag */ if (!force) - udevice->test_run = 1; - - setenv("DEVPATH", udevice->dev->devpath, 1); - setenv("SUBSYSTEM", udevice->dev->subsystem, 1); - setenv("ACTION", udevice->action, 1); - import_uevent_var(udev, udevice->dev->devpath); + event->test = 1; - info(udev, "looking at device '%s' from subsystem '%s'\n", udevice->dev->devpath, udevice->dev->subsystem); - retval = udev_device_event(&rules, udevice); + err = udev_event_run(event, &rules); - if (udevice->event_timeout >= 0) - info(udev, "custom event timeout: %i\n", udevice->event_timeout); + if (udev_device_get_event_timeout(dev) >= 0) + info(udev, "custom event timeout: %i\n", udev_device_get_event_timeout(dev)); - if (retval == 0 && !udevice->ignore_device && udev_get_run(udev)) { - struct name_entry *name_loop; + if (err == 0 && !event->ignore_device && udev_get_run(udev)) { + struct udev_list_entry *entry; - list_for_each_entry(name_loop, &udevice->run_list, node) { + udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; - util_strlcpy(program, name_loop->name, sizeof(program)); - udev_rules_apply_format(udevice, program, sizeof(program)); + util_strlcpy(program, udev_list_entry_get_name(entry), sizeof(program)); + udev_rules_apply_format(event, program, sizeof(program)); info(udev, "run: '%s'\n", program); } } - udev_device_cleanup(udevice); - + udev_event_unref(event); + udev_device_unref(dev); exit: udev_rules_cleanup(&rules); return rc; diff --git a/udev/udevadm.c b/udev/udevadm.c index 3671b9ee59..8fd976a6de 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -141,7 +141,6 @@ int main(int argc, char *argv[]) logging_init("udevadm"); udev_set_log_fn(udev, log_fn); selinux_init(udev); - sysfs_init(); /* see if we are a compat link, this will be removed in a future release */ command = argv[0]; @@ -211,7 +210,6 @@ int main(int argc, char *argv[]) help(udev, argc, argv); rc = 2; out: - sysfs_cleanup(); selinux_exit(udev); udev_unref(udev); logging_close(); diff --git a/udev/udevd.c b/udev/udevd.c index ee686c6eb7..15ec0fbb03 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -33,11 +33,8 @@ #include #include #include -#include #include #include -#include -#include #ifdef HAVE_INOTIFY #include #endif @@ -65,29 +62,10 @@ static void log_fn(struct udev *udev, int priority, } } -struct udevd_uevent_msg { - struct udev *udev; - struct list_head node; - pid_t pid; - int exitstatus; - time_t queue_time; - char *action; - char *devpath; - char *subsystem; - char *driver; - dev_t devt; - unsigned long long seqnum; - char *devpath_old; - char *physdevpath; - unsigned int timeout; - char *envp[UEVENT_NUM_ENVP+1]; - char envbuf[]; -}; - static int debug_trace; static struct udev_rules rules; static struct udev_ctrl *udev_ctrl; -static int uevent_netlink_sock = -1; +static struct udev_monitor *kernel_monitor; static int inotify_fd = -1; static int signal_pipe[2] = {-1, -1}; @@ -97,156 +75,108 @@ static volatile int reload_config; static int run_exec_q; static int stop_exec_q; static int max_childs; -static char udev_log_env[32]; static LIST_HEAD(exec_list); static LIST_HEAD(running_list); -static void asmlinkage udev_event_sig_handler(int signum) -{ - if (signum == SIGALRM) - exit(1); -} - -static int udev_event_process(struct udevd_uevent_msg *msg) -{ - struct sigaction act; - struct udevice *udevice; - int i; - int retval; - - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = (void (*)(int)) udev_event_sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - - /* reset to default */ - act.sa_handler = SIG_DFL; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigaction(SIGCHLD, &act, NULL); - sigaction(SIGHUP, &act, NULL); - - /* trigger timeout to prevent hanging processes */ - alarm(UDEV_EVENT_TIMEOUT); - - /* reconstruct event environment from message */ - for (i = 0; msg->envp[i]; i++) - putenv(msg->envp[i]); - - udevice = udev_device_init(msg->udev); - if (udevice == NULL) - return -1; - util_strlcpy(udevice->action, msg->action, sizeof(udevice->action)); - sysfs_device_set_values(udevice->udev, udevice->dev, msg->devpath, msg->subsystem, msg->driver); - udevice->devpath_old = msg->devpath_old; - udevice->devt = msg->devt; - - retval = udev_device_event(&rules, udevice); - - /* rules may change/disable the timeout */ - if (udevice->event_timeout >= 0) - alarm(udevice->event_timeout); - - /* run programs collected by RUN-key*/ - if (retval == 0 && !udevice->ignore_device && udev_get_run(msg->udev)) - retval = udev_rules_run(udevice); - - udev_device_cleanup(udevice); - return retval; -} - enum event_state { EVENT_QUEUED, EVENT_FINISHED, EVENT_FAILED, }; -static void export_event_state(struct udevd_uevent_msg *msg, enum event_state state) +static void export_event_state(struct udev_event *event, enum event_state state) { char filename[UTIL_PATH_SIZE]; char filename_failed[UTIL_PATH_SIZE]; size_t start; /* location of queue file */ - snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", udev_get_dev_path(msg->udev), msg->seqnum); + snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", + udev_get_dev_path(event->udev), udev_device_get_seqnum(event->dev)); /* location of failed file */ - util_strlcpy(filename_failed, udev_get_dev_path(msg->udev), sizeof(filename_failed)); + util_strlcpy(filename_failed, udev_get_dev_path(event->udev), sizeof(filename_failed)); util_strlcat(filename_failed, "/", sizeof(filename_failed)); start = util_strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed)); - util_strlcat(filename_failed, msg->devpath, sizeof(filename_failed)); + util_strlcat(filename_failed, udev_device_get_devpath(event->dev), sizeof(filename_failed)); util_path_encode(&filename_failed[start], sizeof(filename_failed) - start); switch (state) { case EVENT_QUEUED: unlink(filename_failed); - delete_path(msg->udev, filename_failed); - create_path(msg->udev, filename); - udev_selinux_setfscreatecon(msg->udev, filename, S_IFLNK); - symlink(msg->devpath, filename); - udev_selinux_resetfscreatecon(msg->udev); + delete_path(event->udev, filename_failed); + create_path(event->udev, filename); + udev_selinux_setfscreatecon(event->udev, filename, S_IFLNK); + symlink(udev_device_get_devpath(event->dev), filename); + udev_selinux_resetfscreatecon(event->udev); break; case EVENT_FINISHED: - if (msg->devpath_old != NULL) { + if (udev_device_get_devpath_old(event->dev) != NULL) { /* "move" event - rename failed file to current name, do not delete failed */ char filename_failed_old[UTIL_PATH_SIZE]; - util_strlcpy(filename_failed_old, udev_get_dev_path(msg->udev), sizeof(filename_failed_old)); + util_strlcpy(filename_failed_old, udev_get_dev_path(event->udev), sizeof(filename_failed_old)); util_strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); start = util_strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old)); - util_strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old)); + util_strlcat(filename_failed_old, udev_device_get_devpath_old(event->dev), sizeof(filename_failed_old)); util_path_encode(&filename_failed_old[start], sizeof(filename) - start); if (rename(filename_failed_old, filename_failed) == 0) - info(msg->udev, "renamed devpath, moved failed state of '%s' to %s'\n", - msg->devpath_old, msg->devpath); + info(event->udev, "renamed devpath, moved failed state of '%s' to %s'\n", + udev_device_get_devpath_old(event->dev), udev_device_get_devpath(event->dev)); } else { unlink(filename_failed); - delete_path(msg->udev, filename_failed); + delete_path(event->udev, filename_failed); } unlink(filename); - delete_path(msg->udev, filename); + delete_path(event->udev, filename); break; case EVENT_FAILED: /* move failed event to the failed directory */ - create_path(msg->udev, filename_failed); + create_path(event->udev, filename_failed); rename(filename, filename_failed); /* clean up possibly empty queue directory */ - delete_path(msg->udev, filename); + delete_path(event->udev, filename); break; } return; } -static void msg_queue_delete(struct udevd_uevent_msg *msg) +static void event_queue_delete(struct udev_event *event) { - list_del(&msg->node); + list_del(&event->node); /* mark as failed, if "add" event returns non-zero */ - if (msg->exitstatus && strcmp(msg->action, "add") == 0) - export_event_state(msg, EVENT_FAILED); + if (event->exitstatus && strcmp(udev_device_get_action(event->dev), "add") == 0) + export_event_state(event, EVENT_FAILED); else - export_event_state(msg, EVENT_FINISHED); + export_event_state(event, EVENT_FINISHED); + + udev_device_unref(event->dev); + udev_event_unref(event); +} - free(msg); +static void asmlinkage event_sig_handler(int signum) +{ + if (signum == SIGALRM) + exit(1); } -static void udev_event_run(struct udevd_uevent_msg *msg) +static void event_fork(struct udev_event *event) { pid_t pid; - int retval; + struct sigaction act; + int err; pid = fork(); switch (pid) { case 0: /* child */ - close(uevent_netlink_sock); + udev_monitor_unref(kernel_monitor); udev_ctrl_unref(udev_ctrl); if (inotify_fd >= 0) close(inotify_fd); @@ -256,64 +186,93 @@ static void udev_event_run(struct udevd_uevent_msg *msg) logging_init("udevd-event"); setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); - retval = udev_event_process(msg); - info(msg->udev, "seq %llu finished with %i\n", msg->seqnum, retval); - + /* set signal handlers */ + memset(&act, 0x00, sizeof(act)); + act.sa_handler = (void (*)(int)) event_sig_handler; + sigemptyset (&act.sa_mask); + act.sa_flags = 0; + sigaction(SIGALRM, &act, NULL); + + /* reset to default */ + act.sa_handler = SIG_DFL; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + sigaction(SIGCHLD, &act, NULL); + sigaction(SIGHUP, &act, NULL); + + /* set timeout to prevent hanging processes */ + alarm(UDEV_EVENT_TIMEOUT); + + /* apply rules, create node, symlinks */ + err = udev_event_run(event, &rules); + + /* rules may change/disable the timeout */ + if (udev_device_get_event_timeout(event->dev) >= 0) + alarm(udev_device_get_event_timeout(event->dev)); + + /* execute RUN= */ + if (err == 0 && !event->ignore_device && udev_get_run(event->udev)) + udev_rules_run(event); + info(event->udev, "seq %llu finished with %i\n", udev_device_get_seqnum(event->dev), err); logging_close(); - if (retval) + if (err != 0) exit(1); exit(0); case -1: - err(msg->udev, "fork of child failed: %m\n"); - msg_queue_delete(msg); + err(event->udev, "fork of child failed: %m\n"); + event_queue_delete(event); break; default: /* get SIGCHLD in main loop */ - info(msg->udev, "seq %llu forked, pid [%d], '%s' '%s', %ld seconds old\n", - msg->seqnum, pid, msg->action, msg->subsystem, time(NULL) - msg->queue_time); - msg->pid = pid; + info(event->udev, "seq %llu forked, pid [%d], '%s' '%s', %ld seconds old\n", + udev_device_get_seqnum(event->dev), + pid, + udev_device_get_action(event->dev), + udev_device_get_subsystem(event->dev), + time(NULL) - event->queue_time); + event->pid = pid; } } -static void msg_queue_insert(struct udevd_uevent_msg *msg) +static void event_queue_insert(struct udev_event *event) { char filename[UTIL_PATH_SIZE]; int fd; - msg->queue_time = time(NULL); + event->queue_time = time(NULL); - export_event_state(msg, EVENT_QUEUED); - info(msg->udev, "seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem); + export_event_state(event, EVENT_QUEUED); + info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(event->dev), udev_device_get_action(event->dev), udev_device_get_subsystem(event->dev)); - util_strlcpy(filename, udev_get_dev_path(msg->udev), sizeof(filename)); + util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { char str[32]; int len; - len = sprintf(str, "%llu\n", msg->seqnum); + len = sprintf(str, "%llu\n", udev_device_get_seqnum(event->dev)); write(fd, str, len); close(fd); } /* run one event after the other in debug mode */ if (debug_trace) { - list_add_tail(&msg->node, &running_list); - udev_event_run(msg); - waitpid(msg->pid, NULL, 0); - msg_queue_delete(msg); + list_add_tail(&event->node, &running_list); + event_fork(event); + waitpid(event->pid, NULL, 0); + event_queue_delete(event); return; } /* run all events with a timeout set immediately */ - if (msg->timeout != 0) { - list_add_tail(&msg->node, &running_list); - udev_event_run(msg); + if (udev_device_get_timeout(event->dev) > 0) { + list_add_tail(&event->node, &running_list); + event_fork(event); return; } - list_add_tail(&msg->node, &exec_list); + list_add_tail(&event->node, &exec_list); run_exec_q = 1; } @@ -366,80 +325,99 @@ static int compare_devpath(const char *running, const char *waiting) } /* lookup event for identical, parent, child, or physical device */ -static int devpath_busy(struct udevd_uevent_msg *msg, int limit) +static int devpath_busy(struct udev_event *event, int limit) { - struct udevd_uevent_msg *loop_msg; + struct udev_event *loop_event; int childs_count = 0; /* check exec-queue which may still contain delayed events we depend on */ - list_for_each_entry(loop_msg, &exec_list, node) { + list_for_each_entry(loop_event, &exec_list, node) { /* skip ourself and all later events */ - if (loop_msg->seqnum >= msg->seqnum) + if (udev_device_get_seqnum(loop_event->dev) >= udev_device_get_seqnum(event->dev)) break; /* check our old name */ - if (msg->devpath_old != NULL) - if (strcmp(loop_msg->devpath , msg->devpath_old) == 0) + if (udev_device_get_devpath_old(event->dev) != NULL) + if (strcmp(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath_old(event->dev)) == 0) return 2; /* check identical, parent, or child device event */ - if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg(msg->udev, "%llu, device event still pending %llu (%s)\n", - msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + if (compare_devpath(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath(event->dev)) != 0) { + dbg(event->udev, "%llu, device event still pending %llu (%s)\n", + udev_device_get_seqnum(event->dev), + udev_device_get_seqnum(loop_event->dev), + udev_device_get_devpath(loop_event->dev)); return 3; } /* check for our major:minor number */ - if (msg->devt && loop_msg->devt == msg->devt && - strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg(msg->udev, "%llu, device event still pending %llu (%d:%d)\n", msg->seqnum, - loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); + if (major(udev_device_get_devnum(event->dev)) > 0 && + udev_device_get_devnum(loop_event->dev) == udev_device_get_devnum(event->dev) && + strcmp(udev_device_get_subsystem(event->dev), udev_device_get_subsystem(loop_event->dev)) == 0) { + dbg(event->udev, "%llu, device event still pending %llu (%d:%d)\n", + udev_device_get_seqnum(event->dev), + udev_device_get_seqnum(loop_event->dev), + major(udev_device_get_devnum(loop_event->dev)), minor(udev_device_get_devnum(loop_event->dev))); return 4; } /* check physical device event (special case of parent) */ - if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) - if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg(msg->udev, "%llu, physical device event still pending %llu (%s)\n", - msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + if (udev_device_get_physdevpath(event->dev) != NULL && + strcmp(udev_device_get_action(event->dev), "add") == 0) + if (compare_devpath(udev_device_get_devpath(loop_event->dev), + udev_device_get_physdevpath(event->dev)) != 0) { + dbg(event->udev, "%llu, physical device event still pending %llu (%s)\n", + udev_device_get_seqnum(event->dev), + udev_device_get_seqnum(loop_event->dev), + udev_device_get_devpath(loop_event->dev)); return 5; } } /* check run queue for still running events */ - list_for_each_entry(loop_msg, &running_list, node) { + list_for_each_entry(loop_event, &running_list, node) { childs_count++; if (childs_count++ >= limit) { - info(msg->udev, "%llu, maximum number (%i) of childs reached\n", msg->seqnum, childs_count); + info(event->udev, "%llu, maximum number (%i) of childs reached\n", + udev_device_get_seqnum(event->dev), childs_count); return 1; } /* check our old name */ - if (msg->devpath_old != NULL) - if (strcmp(loop_msg->devpath , msg->devpath_old) == 0) + if (udev_device_get_devpath_old(event->dev) != NULL) + if (strcmp(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath_old(event->dev)) == 0) return 2; /* check identical, parent, or child device event */ - if (compare_devpath(loop_msg->devpath, msg->devpath) != 0) { - dbg(msg->udev, "%llu, device event still running %llu (%s)\n", - msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + if (compare_devpath(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath(event->dev)) != 0) { + dbg(event->udev, "%llu, device event still running %llu (%s)\n", + udev_device_get_seqnum(event->dev), + udev_device_get_seqnum(loop_event->dev), + udev_device_get_devpath(loop_event->dev)); return 3; } /* check for our major:minor number */ - if (msg->devt && loop_msg->devt == msg->devt && - strcmp(msg->subsystem, loop_msg->subsystem) == 0) { - dbg(msg->udev, "%llu, device event still running %llu (%d:%d)\n", msg->seqnum, - loop_msg->seqnum, major(loop_msg->devt), minor(loop_msg->devt)); + if (major(udev_device_get_devnum(event->dev)) > 0 && + udev_device_get_devnum(loop_event->dev) == udev_device_get_devnum(event->dev) && + strcmp(udev_device_get_subsystem(event->dev), udev_device_get_subsystem(loop_event->dev)) == 0) { + dbg(event->udev, "%llu, device event still pending %llu (%d:%d)\n", + udev_device_get_seqnum(event->dev), + udev_device_get_seqnum(loop_event->dev), + major(udev_device_get_devnum(loop_event->dev)), minor(udev_device_get_devnum(loop_event->dev))); return 4; } /* check physical device event (special case of parent) */ - if (msg->physdevpath && msg->action && strcmp(msg->action, "add") == 0) - if (compare_devpath(loop_msg->devpath, msg->physdevpath) != 0) { - dbg(msg->udev, "%llu, physical device event still running %llu (%s)\n", - msg->seqnum, loop_msg->seqnum, loop_msg->devpath); + if (udev_device_get_physdevpath(event->dev) != NULL && + strcmp(udev_device_get_action(event->dev), "add") == 0) + if (compare_devpath(udev_device_get_devpath(loop_event->dev), + udev_device_get_physdevpath(event->dev)) != 0) { + dbg(event->udev, "%llu, physical device event still pending %llu (%s)\n", + udev_device_get_seqnum(event->dev), + udev_device_get_seqnum(loop_event->dev), + udev_device_get_devpath(loop_event->dev)); return 5; } } @@ -447,97 +425,28 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit) } /* serializes events for the identical and parent and child devices */ -static void msg_queue_manager(struct udev *udev) +static void event_queue_manager(struct udev *udev) { - struct udevd_uevent_msg *loop_msg; - struct udevd_uevent_msg *tmp_msg; + struct udev_event *loop_event; + struct udev_event *tmp_event; if (list_empty(&exec_list)) return; - list_for_each_entry_safe(loop_msg, tmp_msg, &exec_list, node) { + list_for_each_entry_safe(loop_event, tmp_event, &exec_list, node) { /* serialize and wait for parent or child events */ - if (devpath_busy(loop_msg, max_childs) != 0) { - dbg(udev, "delay seq %llu (%s)\n", loop_msg->seqnum, loop_msg->devpath); + if (devpath_busy(loop_event, max_childs) != 0) { + dbg(udev, "delay seq %llu (%s)\n", + udev_device_get_seqnum(loop_event->dev), + udev_device_get_devpath(loop_event->dev)); continue; } /* move event to run list */ - list_move_tail(&loop_msg->node, &running_list); - udev_event_run(loop_msg); - dbg(udev, "moved seq %llu to running list\n", loop_msg->seqnum); - } -} - -static struct udevd_uevent_msg *get_msg_from_envbuf(struct udev *udev, const char *buf, int buf_size) -{ - int bufpos; - int i; - struct udevd_uevent_msg *msg; - char *physdevdriver_key = NULL; - int maj = 0; - int min = 0; - - msg = malloc(sizeof(struct udevd_uevent_msg) + buf_size); - if (msg == NULL) - return NULL; - memset(msg, 0x00, sizeof(struct udevd_uevent_msg) + buf_size); - msg->udev = udev; - - /* copy environment buffer and reconstruct envp */ - memcpy(msg->envbuf, buf, buf_size); - bufpos = 0; - for (i = 0; (bufpos < buf_size) && (i < UEVENT_NUM_ENVP-2); i++) { - int keylen; - char *key; - - key = &msg->envbuf[bufpos]; - keylen = strlen(key); - msg->envp[i] = key; - bufpos += keylen + 1; - dbg(udev, "add '%s' to msg.envp[%i]\n", msg->envp[i], i); - - /* remember some keys for further processing */ - if (strncmp(key, "ACTION=", 7) == 0) - msg->action = &key[7]; - else if (strncmp(key, "DEVPATH=", 8) == 0) - msg->devpath = &key[8]; - else if (strncmp(key, "SUBSYSTEM=", 10) == 0) - msg->subsystem = &key[10]; - else if (strncmp(key, "DRIVER=", 7) == 0) - msg->driver = &key[7]; - else if (strncmp(key, "SEQNUM=", 7) == 0) - msg->seqnum = strtoull(&key[7], NULL, 10); - else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) - msg->devpath_old = &key[12]; - else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) - msg->physdevpath = &key[12]; - else if (strncmp(key, "PHYSDEVDRIVER=", 14) == 0) - physdevdriver_key = key; - else if (strncmp(key, "MAJOR=", 6) == 0) - maj = strtoull(&key[6], NULL, 10); - else if (strncmp(key, "MINOR=", 6) == 0) - min = strtoull(&key[6], NULL, 10); - else if (strncmp(key, "TIMEOUT=", 8) == 0) - msg->timeout = strtoull(&key[8], NULL, 10); - } - msg->devt = makedev(maj, min); - msg->envp[i++] = "UDEVD_EVENT=1"; - - if (msg->driver == NULL && msg->physdevpath == NULL && physdevdriver_key != NULL) { - /* for older kernels DRIVER is empty for a bus device, export PHYSDEVDRIVER as DRIVER */ - msg->envp[i++] = &physdevdriver_key[7]; - msg->driver = &physdevdriver_key[14]; - } - - msg->envp[i] = NULL; - - if (msg->devpath == NULL || msg->action == NULL) { - info(udev, "DEVPATH or ACTION missing, ignore message\n"); - free(msg); - return NULL; + list_move_tail(&loop_event->node, &running_list); + event_fork(loop_event); + dbg(udev, "moved seq %llu to running list\n", udev_device_get_seqnum(loop_event->dev)); } - return msg; } /* receive the udevd message from userspace */ @@ -556,8 +465,6 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) if (i >= 0) { info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", i); udev_set_log_priority(udev, i); - sprintf(udev_log_env, "UDEV_LOG=%i", i); - putenv(udev_log_env); } if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) { @@ -568,7 +475,7 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) { info(udev, "udevd message (START_EXEC_QUEUE) received\n"); stop_exec_q = 0; - msg_queue_manager(udev); + event_queue_manager(udev); } if (udev_ctrl_get_reload_rules(ctrl_msg) > 0) { @@ -578,24 +485,28 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) str = udev_ctrl_get_set_env(ctrl_msg); if (str != NULL) { - char *key = strdup(str); - char *val; - - val = strchr(str, '='); - if (val != NULL) { - val[0] = '\0'; - val = &val[1]; - if (val[0] == '\0') { - info(udev, "udevd message (ENV) received, unset '%s'\n", key); - unsetenv(str); + char *key; + + key = strdup(str); + if (key != NULL) { + char *val; + + val = strchr(key, '='); + if (val != NULL) { + val[0] = '\0'; + val = &val[1]; + if (val[0] == '\0') { + info(udev, "udevd message (ENV) received, unset '%s'\n", key); + udev_add_property(udev, key, NULL); + } else { + info(udev, "udevd message (ENV) received, set '%s=%s'\n", key, val); + udev_add_property(udev, key, val); + } } else { - info(udev, "udevd message (ENV) received, set '%s=%s'\n", key, val); - setenv(key, val, 1); + err(udev, "wrong key format '%s'\n", key); } - } else { - err(udev, "wrong key format '%s'\n", key); + free(key); } - free(key); } i = udev_ctrl_get_set_max_childs(ctrl_msg); @@ -607,57 +518,6 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) udev_ctrl_msg_unref(ctrl_msg); } -/* receive the kernel user event message and do some sanity checks */ -static struct udevd_uevent_msg *get_netlink_msg(struct udev *udev) -{ - struct udevd_uevent_msg *msg; - int bufpos; - ssize_t size; - static char buffer[UEVENT_BUFFER_SIZE+512]; - char *pos; - - size = recv(uevent_netlink_sock, &buffer, sizeof(buffer), 0); - if (size < 0) { - if (errno != EINTR) - err(udev, "unable to receive kernel netlink message: %m\n"); - return NULL; - } - - if ((size_t)size > sizeof(buffer)-1) - size = sizeof(buffer)-1; - buffer[size] = '\0'; - dbg(udev, "uevent_size=%zi\n", size); - - /* start of event payload */ - bufpos = strlen(buffer)+1; - msg = get_msg_from_envbuf(udev, &buffer[bufpos], size-bufpos); - if (msg == NULL) - return NULL; - - /* validate message */ - pos = strchr(buffer, '@'); - if (pos == NULL) { - err(udev, "invalid uevent '%s'\n", buffer); - free(msg); - return NULL; - } - pos[0] = '\0'; - - if (msg->action == NULL) { - info(udev, "no ACTION in payload found, skip event '%s'\n", buffer); - free(msg); - return NULL; - } - - if (strcmp(msg->action, buffer) != 0) { - err(udev, "ACTION in payload does not match uevent, skip event '%s'\n", buffer); - free(msg); - return NULL; - } - - return msg; -} - static void asmlinkage sig_handler(int signum) { switch (signum) { @@ -680,15 +540,16 @@ static void asmlinkage sig_handler(int signum) static void udev_done(int pid, int exitstatus) { - /* find msg associated with pid and delete it */ - struct udevd_uevent_msg *msg; + /* find event associated with pid and delete it */ + struct udev_event *event; - list_for_each_entry(msg, &running_list, node) { - if (msg->pid == pid) { - info(msg->udev, "seq %llu, pid [%d] exit with %i, %ld seconds old\n", msg->seqnum, msg->pid, - exitstatus, time(NULL) - msg->queue_time); - msg->exitstatus = exitstatus; - msg_queue_delete(msg); + list_for_each_entry(event, &running_list, node) { + if (event->pid == pid) { + info(event->udev, "seq %llu, pid [%d] exit with %i, %ld seconds old\n", + udev_device_get_seqnum(event->dev), event->pid, + exitstatus, time(NULL) - event->queue_time); + event->exitstatus = exitstatus; + event_queue_delete(event); /* there may be events waiting with the same devpath */ run_exec_q = 1; @@ -716,36 +577,6 @@ static void reap_sigchilds(void) } } -static int init_uevent_netlink_sock(struct udev *udev) -{ - struct sockaddr_nl snl; - const int buffersize = 16 * 1024 * 1024; - int retval; - - memset(&snl, 0x00, sizeof(struct sockaddr_nl)); - snl.nl_family = AF_NETLINK; - snl.nl_pid = getpid(); - snl.nl_groups = 1; - - uevent_netlink_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); - if (uevent_netlink_sock == -1) { - err(udev, "error getting socket: %m\n"); - return -1; - } - - /* set receive buffersize */ - setsockopt(uevent_netlink_sock, SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize)); - - retval = bind(uevent_netlink_sock, (struct sockaddr *) &snl, sizeof(struct sockaddr_nl)); - if (retval < 0) { - err(udev, "bind failed: %m\n"); - close(uevent_netlink_sock); - uevent_netlink_sock = -1; - return -1; - } - return 0; -} - static void export_initial_seqnum(struct udev *udev) { char filename[UTIL_PATH_SIZE]; @@ -777,7 +608,7 @@ static void export_initial_seqnum(struct udev *udev) int main(int argc, char *argv[]) { struct udev *udev; - int retval; + int err; int fd; struct sigaction act; fd_set readfds; @@ -800,7 +631,7 @@ int main(int argc, char *argv[]) logging_init("udevd"); udev_set_log_fn(udev, log_fn); - dbg(udev, "version %s\n", VERSION); + info(udev, "version %s\n", VERSION); selinux_init(udev); while (1) { @@ -868,45 +699,49 @@ int main(int argc, char *argv[]) goto exit; } - if (init_uevent_netlink_sock(udev) < 0) { + kernel_monitor = udev_monitor_new_from_netlink(udev); + if (kernel_monitor == NULL || udev_monitor_enable_receiving(kernel_monitor) < 0) { fprintf(stderr, "error initializing netlink socket\n"); err(udev, "error initializing netlink socket\n"); rc = 3; goto exit; + } else { + /* set receive buffersize */ + const int buffersize = 32 * 1024 * 1024; + + setsockopt(udev_monitor_get_fd(kernel_monitor), + SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize)); } - retval = pipe(signal_pipe); - if (retval < 0) { + err = pipe(signal_pipe); + if (err < 0) { err(udev, "error getting pipes: %m\n"); goto exit; } - retval = fcntl(signal_pipe[READ_END], F_GETFL, 0); - if (retval < 0) { + err = fcntl(signal_pipe[READ_END], F_GETFL, 0); + if (err < 0) { err(udev, "error fcntl on read pipe: %m\n"); goto exit; } - retval = fcntl(signal_pipe[READ_END], F_SETFL, retval | O_NONBLOCK); - if (retval < 0) { + err = fcntl(signal_pipe[READ_END], F_SETFL, err | O_NONBLOCK); + if (err < 0) { err(udev, "error fcntl on read pipe: %m\n"); goto exit; } - retval = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); - if (retval < 0) { + err = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); + if (err < 0) { err(udev, "error fcntl on write pipe: %m\n"); goto exit; } - retval = fcntl(signal_pipe[WRITE_END], F_SETFL, retval | O_NONBLOCK); - if (retval < 0) { + err = fcntl(signal_pipe[WRITE_END], F_SETFL, err | O_NONBLOCK); + if (err < 0) { err(udev, "error fcntl on write pipe: %m\n"); goto exit; } - /* parse the rules and keep them in memory */ - sysfs_init(); udev_rules_init(udev, &rules, 1); - export_initial_seqnum(udev); if (daemonize) { @@ -1021,28 +856,18 @@ int main(int argc, char *argv[]) } info(udev, "initialize max_childs to %u\n", max_childs); - /* clear environment for forked event processes */ - clearenv(); - - /* export log_priority , as called programs may want to follow that setting */ - sprintf(udev_log_env, "UDEV_LOG=%i", udev_get_log_priority(udev)); - putenv(udev_log_env); - if (debug_trace) - putenv("DEBUG=1"); - maxfd = udev_ctrl_get_fd(udev_ctrl); - maxfd = UDEV_MAX(maxfd, uevent_netlink_sock); + maxfd = UDEV_MAX(maxfd, udev_monitor_get_fd(kernel_monitor)); maxfd = UDEV_MAX(maxfd, signal_pipe[READ_END]); maxfd = UDEV_MAX(maxfd, inotify_fd); while (!udev_exit) { - struct udevd_uevent_msg *msg; int fdcount; FD_ZERO(&readfds); FD_SET(signal_pipe[READ_END], &readfds); FD_SET(udev_ctrl_get_fd(udev_ctrl), &readfds); - FD_SET(uevent_netlink_sock, &readfds); + FD_SET(udev_monitor_get_fd(kernel_monitor), &readfds); if (inotify_fd >= 0) FD_SET(inotify_fd, &readfds); @@ -1057,11 +882,20 @@ int main(int argc, char *argv[]) if (FD_ISSET(udev_ctrl_get_fd(udev_ctrl), &readfds)) handle_ctrl_msg(udev_ctrl); - /* get netlink message */ - if (FD_ISSET(uevent_netlink_sock, &readfds)) { - msg = get_netlink_msg(udev); - if (msg) - msg_queue_insert(msg); + /* get kernel uevent */ + if (FD_ISSET(udev_monitor_get_fd(kernel_monitor), &readfds)) { + struct udev_device *dev; + + dev = udev_monitor_receive_device(kernel_monitor); + if (dev != NULL) { + struct udev_event *event; + + event = udev_event_new(dev); + if (event != NULL) + event_queue_insert(event); + else + udev_device_unref(dev); + } } /* received a signal, clear our notification pipe */ @@ -1098,7 +932,6 @@ int main(int argc, char *argv[]) udev_rules_init(udev, &rules, 1); } - /* forked child has returned */ if (sigchilds_waiting) { sigchilds_waiting = 0; reap_sigchilds(); @@ -1107,14 +940,13 @@ int main(int argc, char *argv[]) if (run_exec_q) { run_exec_q = 0; if (!stop_exec_q) - msg_queue_manager(udev); + event_queue_manager(udev); } } rc = 0; exit: udev_rules_cleanup(&rules); - sysfs_cleanup(); if (signal_pipe[READ_END] >= 0) close(signal_pipe[READ_END]); @@ -1124,8 +956,7 @@ exit: udev_ctrl_unref(udev_ctrl); if (inotify_fd >= 0) close(inotify_fd); - if (uevent_netlink_sock >= 0) - close(uevent_netlink_sock); + udev_monitor_unref(kernel_monitor); selinux_exit(udev); udev_unref(udev); -- cgit v1.2.3-54-g00ecf From fc233a874bc93ac82bed7eda1d6967d6281a6fe2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 17:30:06 +0200 Subject: move udev_device_db to libudev --- udev/Makefile.am | 2 +- udev/lib/libudev-device-db-write.c | 135 +++++++++++++++++++++++++++++++++++++ udev/lib/libudev-private.h | 5 ++ udev/udev.h | 5 -- udev/udev_db.c | 135 ------------------------------------- 5 files changed, 141 insertions(+), 141 deletions(-) create mode 100644 udev/lib/libudev-device-db-write.c delete mode 100644 udev/udev_db.c diff --git a/udev/Makefile.am b/udev/Makefile.am index ff8b275552..9c765ffe96 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -16,7 +16,6 @@ common_files = \ udev.h \ udev_rules.h \ udev_sysdeps.h \ - udev_db.c \ udev_device_event.c \ udev_node.c \ udev_rules.c \ @@ -30,6 +29,7 @@ common_files = \ lib/libudev-list.c \ lib/libudev-util.c \ lib/libudev-device.c \ + lib/libudev-device-db-write.c \ lib/libudev-monitor.c \ lib/libudev-enumerate.c \ lib/libudev-queue.c \ diff --git a/udev/lib/libudev-device-db-write.c b/udev/lib/libudev-device-db-write.c new file mode 100644 index 0000000000..17e989310e --- /dev/null +++ b/udev/lib/libudev-device-db-write.c @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) +{ + size_t start; + + /* translate to location of db file */ + util_strlcpy(filename, udev_get_dev_path(udev), len); + start = util_strlcat(filename, "/.udev/db/", len); + util_strlcat(filename, devpath, len); + return util_path_encode(&filename[start], len - start); +} + +int udev_device_update_db(struct udev_device *udev_device) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + FILE *f; + char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ + size_t devlen = strlen(udev_get_dev_path(udev))+1; + struct udev_list_entry *list_entry; + int ret; + + devpath_to_db_path(udev, + udev_device_get_devpath(udev_device), + filename, sizeof(filename)); + create_path(udev, filename); + unlink(filename); + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) + if (udev_list_entry_get_flag(list_entry)) + goto file; + if (udev_device_get_num_fake_partitions(udev_device)) + goto file; + if (udev_device_get_ignore_remove(udev_device)) + goto file; + /* try not to waste tmpfs memory; store values, if they fit, in a symlink target */ + util_strlcpy(target, &udev_device_get_devnode(udev_device)[devlen], sizeof(target)); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) { + size_t len; + + util_strlcat(target, " ", sizeof(target)); + len = util_strlcat(target, &udev_list_entry_get_name(list_entry)[devlen], sizeof(target)); + if (len >= sizeof(target)) { + info(udev, "size of links too large, create file\n"); + goto file; + } + } + info(udev, "create db link (%s)\n", target); + udev_selinux_setfscreatecon(udev, filename, S_IFLNK); + ret = symlink(target, filename); + udev_selinux_resetfscreatecon(udev); + if (ret == 0) + goto out; +file: + f = fopen(filename, "w"); + if (f == NULL) { + err(udev, "unable to create db file '%s': %m\n", filename); + return -1; + } + info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); + + fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) + fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + if (udev_device_get_devlink_priority(udev_device) != 0) + fprintf(f, "L:%u\n", udev_device_get_devlink_priority(udev_device)); + if (udev_device_get_event_timeout(udev_device) >= 0) + fprintf(f, "T:%u\n", udev_device_get_event_timeout(udev_device)); + if (udev_device_get_num_fake_partitions(udev_device) != 0) + fprintf(f, "A:%u\n", udev_device_get_num_fake_partitions(udev_device)); + if (udev_device_get_ignore_remove(udev_device)) + fprintf(f, "R:%u\n", udev_device_get_ignore_remove(udev_device)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + if (!udev_list_entry_get_flag(list_entry)) + continue; + fprintf(f, "E:%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + fclose(f); +out: + return 0; +} + +int udev_device_delete_db(struct udev_device *udev_device) +{ + char filename[UTIL_PATH_SIZE]; + + devpath_to_db_path(udev_device_get_udev(udev_device), + udev_device_get_devpath(udev_device), + filename, sizeof(filename)); + unlink(filename); + return 0; +} + +int udev_device_rename_db(struct udev_device *udev_device, const char *devpath_old) +{ + char filename_old[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + + devpath_to_db_path(udev_device_get_udev(udev_device), + devpath_old, + filename_old, sizeof(filename_old)); + devpath_to_db_path(udev_device_get_udev(udev_device), + udev_device_get_devpath(udev_device), + filename, sizeof(filename)); + return rename(filename_old, filename); +} diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 5290bc8018..040a48b0e3 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -84,6 +84,11 @@ extern int udev_device_get_ignore_remove(struct udev_device *udev_device); extern int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore); extern void udev_device_set_info_loaded(struct udev_device *device); +/* libudev-device-db-write.c */ +extern int udev_device_update_db(struct udev_device *udev_device); +extern int udev_device_delete_db(struct udev_device *udev_device); +extern int udev_device_rename_db(struct udev_device *udev_device, const char *devpath); + /* libudev-monitor - netlink/unix socket communication */ extern int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device); diff --git a/udev/udev.h b/udev/udev.h index 896a466762..e486df3656 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -101,11 +101,6 @@ extern int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner extern int udev_node_remove(struct udev_device *dev, int test); extern void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test); -/* udev-device-db.c */ -extern int udev_device_update_db(struct udev_device *udev_device); -extern int udev_device_delete_db(struct udev_device *udev_device); -extern int udev_device_rename_db(struct udev_device *udev_device, const char *devpath); - /* udev-util.c */ struct name_entry { struct list_head node; diff --git a/udev/udev_db.c b/udev/udev_db.c deleted file mode 100644 index 17e989310e..0000000000 --- a/udev/udev_db.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) -{ - size_t start; - - /* translate to location of db file */ - util_strlcpy(filename, udev_get_dev_path(udev), len); - start = util_strlcat(filename, "/.udev/db/", len); - util_strlcat(filename, devpath, len); - return util_path_encode(&filename[start], len - start); -} - -int udev_device_update_db(struct udev_device *udev_device) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - FILE *f; - char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ - size_t devlen = strlen(udev_get_dev_path(udev))+1; - struct udev_list_entry *list_entry; - int ret; - - devpath_to_db_path(udev, - udev_device_get_devpath(udev_device), - filename, sizeof(filename)); - create_path(udev, filename); - unlink(filename); - - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_flag(list_entry)) - goto file; - if (udev_device_get_num_fake_partitions(udev_device)) - goto file; - if (udev_device_get_ignore_remove(udev_device)) - goto file; - /* try not to waste tmpfs memory; store values, if they fit, in a symlink target */ - util_strlcpy(target, &udev_device_get_devnode(udev_device)[devlen], sizeof(target)); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) { - size_t len; - - util_strlcat(target, " ", sizeof(target)); - len = util_strlcat(target, &udev_list_entry_get_name(list_entry)[devlen], sizeof(target)); - if (len >= sizeof(target)) { - info(udev, "size of links too large, create file\n"); - goto file; - } - } - info(udev, "create db link (%s)\n", target); - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); - ret = symlink(target, filename); - udev_selinux_resetfscreatecon(udev); - if (ret == 0) - goto out; -file: - f = fopen(filename, "w"); - if (f == NULL) { - err(udev, "unable to create db file '%s': %m\n", filename); - return -1; - } - info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); - - fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) - fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); - if (udev_device_get_devlink_priority(udev_device) != 0) - fprintf(f, "L:%u\n", udev_device_get_devlink_priority(udev_device)); - if (udev_device_get_event_timeout(udev_device) >= 0) - fprintf(f, "T:%u\n", udev_device_get_event_timeout(udev_device)); - if (udev_device_get_num_fake_partitions(udev_device) != 0) - fprintf(f, "A:%u\n", udev_device_get_num_fake_partitions(udev_device)); - if (udev_device_get_ignore_remove(udev_device)) - fprintf(f, "R:%u\n", udev_device_get_ignore_remove(udev_device)); - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - if (!udev_list_entry_get_flag(list_entry)) - continue; - fprintf(f, "E:%s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - } - fclose(f); -out: - return 0; -} - -int udev_device_delete_db(struct udev_device *udev_device) -{ - char filename[UTIL_PATH_SIZE]; - - devpath_to_db_path(udev_device_get_udev(udev_device), - udev_device_get_devpath(udev_device), - filename, sizeof(filename)); - unlink(filename); - return 0; -} - -int udev_device_rename_db(struct udev_device *udev_device, const char *devpath_old) -{ - char filename_old[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - - devpath_to_db_path(udev_device_get_udev(udev_device), - devpath_old, - filename_old, sizeof(filename_old)); - devpath_to_db_path(udev_device_get_udev(udev_device), - udev_device_get_devpath(udev_device), - filename, sizeof(filename)); - return rename(filename_old, filename); -} -- cgit v1.2.3-54-g00ecf From 8460299b572eb13e7b97a0956b59c053f9009afa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 18:13:48 +0200 Subject: rename udev source files --- extras/floppy/Makefile.am | 4 +- udev/Makefile.am | 18 +- udev/test-udev.c | 2 +- udev/udev-event.c | 286 ++++++++ udev/udev-node.c | 525 +++++++++++++++ udev/udev-rules-parse.c | 850 +++++++++++++++++++++++ udev/udev-rules.c | 1634 +++++++++++++++++++++++++++++++++++++++++++++ udev/udev-rules.h | 134 ++++ udev/udev-selinux.c | 90 +++ udev/udev-sysdeps.h | 50 ++ udev/udev-util-file.c | 176 +++++ udev/udev-util.c | 203 ++++++ udev/udev.h | 2 +- udev/udev_device_event.c | 286 -------- udev/udev_node.c | 525 --------------- udev/udev_rules.c | 1634 --------------------------------------------- udev/udev_rules.h | 134 ---- udev/udev_rules_parse.c | 850 ----------------------- udev/udev_selinux.c | 90 --- udev/udev_sysdeps.h | 50 -- udev/udev_utils.c | 203 ------ udev/udev_utils_file.c | 176 ----- udev/udevadm-test.c | 2 +- udev/udevd.c | 2 +- 24 files changed, 3963 insertions(+), 3963 deletions(-) create mode 100644 udev/udev-event.c create mode 100644 udev/udev-node.c create mode 100644 udev/udev-rules-parse.c create mode 100644 udev/udev-rules.c create mode 100644 udev/udev-rules.h create mode 100644 udev/udev-selinux.c create mode 100644 udev/udev-sysdeps.h create mode 100644 udev/udev-util-file.c create mode 100644 udev/udev-util.c delete mode 100644 udev/udev_device_event.c delete mode 100644 udev/udev_node.c delete mode 100644 udev/udev_rules.c delete mode 100644 udev/udev_rules.h delete mode 100644 udev/udev_rules_parse.c delete mode 100644 udev/udev_selinux.c delete mode 100644 udev/udev_sysdeps.h delete mode 100644 udev/udev_utils.c delete mode 100644 udev/udev_utils_file.c diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 0b154498d0..c812689586 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -10,11 +10,11 @@ create_floppy_devices_SOURCES = \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c \ - ../../udev/udev_utils.c + ../../udev/udev-util.c if USE_SELINUX create_floppy_devices_SOURCES += \ - ../../udev/udev_selinux.c + ../../udev/udev-selinux.c create_floppy_devices_LDADD = \ $(SELINUX_LIBS) endif diff --git a/udev/Makefile.am b/udev/Makefile.am index 9c765ffe96..cbab15d34b 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -14,14 +14,14 @@ common_ldadd = common_files = \ udev.h \ - udev_rules.h \ - udev_sysdeps.h \ - udev_device_event.c \ - udev_node.c \ - udev_rules.c \ - udev_rules_parse.c \ - udev_utils.c \ - udev_utils_file.c \ + udev-rules.h \ + udev-sysdeps.h \ + udev-event.c \ + udev-node.c \ + udev-rules.c \ + udev-rules-parse.c \ + udev-util.c \ + udev-util-file.c \ list.h \ lib/libudev.h \ lib/libudev-private.h \ @@ -37,7 +37,7 @@ common_files = \ if USE_SELINUX common_files += \ - udev_selinux.c + udev-selinux.c common_ldadd += \ $(SELINUX_LIBS) endif diff --git a/udev/test-udev.c b/udev/test-udev.c index 6c327a6e08..43c97aeb34 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -29,7 +29,7 @@ #include #include "udev.h" -#include "udev_rules.h" +#include "udev-rules.h" static void asmlinkage sig_handler(int signum) { diff --git a/udev/udev-event.c b/udev/udev-event.c new file mode 100644 index 0000000000..24f7c55bbc --- /dev/null +++ b/udev/udev-event.c @@ -0,0 +1,286 @@ +/* + * Copyright (C) 2004-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev-rules.h" + +struct udev_event *udev_event_new(struct udev_device *dev) +{ + struct udev_event *event; + + event = malloc(sizeof(struct udev_event)); + if (event == NULL) + return NULL; + memset(event, 0x00, sizeof(struct udev_event)); + + event->dev = dev; + event->udev = udev_device_get_udev(dev); + udev_list_init(&event->run_list); + event->mode = 0660; + util_strlcpy(event->owner, "0", sizeof(event->owner)); + util_strlcpy(event->group, "0", sizeof(event->group)); + + dbg(event->udev, "allocated event %p\n", event); + return event; +} + +void udev_event_unref(struct udev_event *event) +{ + udev_list_cleanup(event->udev, &event->run_list); + dbg(event->udev, "free event %p\n", event); + free(event); +} + +static void kernel_log(struct ifreq ifr) +{ + int klog; + FILE *f; + + klog = open("/dev/kmsg", O_WRONLY); + if (klog < 0) + return; + + f = fdopen(klog, "w"); + if (f == NULL) { + close(klog); + return; + } + + fprintf(f, "<6>udev: renamed network interface %s to %s\n", + ifr.ifr_name, ifr.ifr_newname); + fclose(f); +} + +static int rename_netif(struct udev_event *event) +{ + struct udev_device *dev = event->dev; + int sk; + struct ifreq ifr; + int err; + + info(event->udev, "changing net interface name from '%s' to '%s'\n", + udev_device_get_sysname(dev), event->name); + if (event->test) + return 0; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) { + err(event->udev, "error opening socket: %m\n"); + return -1; + } + + memset(&ifr, 0x00, sizeof(struct ifreq)); + util_strlcpy(ifr.ifr_name, udev_device_get_sysname(dev), IFNAMSIZ); + util_strlcpy(ifr.ifr_newname, event->name, IFNAMSIZ); + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err == 0) + kernel_log(ifr); + else { + int loop; + + /* see if the destination interface name already exists */ + if (errno != EEXIST) { + err(event->udev, "error changing netif name %s to %s: %m\n", + ifr.ifr_name, ifr.ifr_newname); + goto exit; + } + + /* free our own name, another process may wait for us */ + util_strlcpy(ifr.ifr_newname, udev_device_get_sysname(dev), IFNAMSIZ); + util_strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err != 0) { + err(event->udev, "error changing netif name %s to %s: %m\n", + ifr.ifr_name, ifr.ifr_newname); + goto exit; + } + + /* wait 30 seconds for our target to become available */ + util_strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); + util_strlcpy(ifr.ifr_newname, udev_device_get_devnode(dev), IFNAMSIZ); + loop = 30 * 20; + while (loop--) { + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err == 0) { + kernel_log(ifr); + break; + } + + if (errno != EEXIST) { + err(event->udev, "error changing net interface name %s to %s: %m\n", + ifr.ifr_name, ifr.ifr_newname); + break; + } + dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", + udev_device_get_devnode(dev), (30 * 20) - loop); + usleep(1000 * 1000 / 20); + } + } + +exit: + close(sk); + return err; +} + +int udev_event_run(struct udev_event *event, struct udev_rules *rules) +{ + struct udev_device *dev = event->dev; + int err = 0; + + if (udev_device_get_devpath_old(dev) != NULL) { + if (udev_device_rename_db(dev, udev_device_get_devpath(dev)) == 0) + info(event->udev, "moved database from '%s' to '%s'\n", + udev_device_get_devpath_old(dev), udev_device_get_devpath(dev)); + } + + /* add device node */ + if (major(udev_device_get_devnum(dev)) != 0 && + (strcmp(udev_device_get_action(dev), "add") == 0 || strcmp(udev_device_get_action(dev), "change") == 0)) { + char filename[UTIL_PATH_SIZE]; + struct udev_device *dev_old; + + dbg(event->udev, "device node add '%s'\n", udev_device_get_devpath(dev)); + + udev_rules_get_name(rules, event); + if (event->ignore_device) { + info(event->udev, "device event will be ignored\n"); + goto exit; + } + + if (event->name[0] == '\0') { + info(event->udev, "device node creation supressed\n"); + goto exit; + } + + /* set device node name */ + util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, event->name, sizeof(filename)); + udev_device_set_devnode(dev, filename); + + /* read current database entry; cleanup, if it is known device */ + dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); + if (dev_old != NULL) { + info(event->udev, "device '%s' already in database, updating\n", + udev_device_get_devpath(dev)); + udev_node_update_old_links(dev, dev_old, event->test); + udev_device_unref(dev_old); + } + + udev_device_update_db(dev); + + err = udev_node_add(dev, event->mode, event->owner, event->group, event->test); + if (err != 0) + goto exit; + + goto exit; + } + + /* add netif */ + if (strcmp(udev_device_get_subsystem(dev), "net") == 0 && strcmp(udev_device_get_action(dev), "add") == 0) { + dbg(event->udev, "netif add '%s'\n", udev_device_get_devpath(dev)); + + udev_rules_get_name(rules, event); + if (event->ignore_device) { + info(event->udev, "device event will be ignored\n"); + goto exit; + } + if (event->name[0] == '\0') { + info(event->udev, "device renaming supressed\n"); + goto exit; + } + + /* look if we want to change the name of the netif */ + if (strcmp(event->name, udev_device_get_sysname(dev)) != 0) { + char syspath[UTIL_PATH_SIZE]; + char *pos; + + err = rename_netif(event); + if (err != 0) + goto exit; + info(event->udev, "renamed netif to '%s'\n", event->name); + + /* remember old name */ + udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); + + /* now change the devpath, because the kernel device name has changed */ + util_strlcpy(syspath, udev_device_get_syspath(dev), sizeof(syspath)); + pos = strrchr(syspath, '/'); + if (pos != NULL) { + pos[1] = '\0'; + util_strlcat(syspath, event->name, sizeof(syspath)); + udev_device_set_syspath(event->dev, syspath); + udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); + info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); + } + } + goto exit; + } + + /* remove device node */ + if (major(udev_device_get_devnum(dev)) != 0 && strcmp(udev_device_get_action(dev), "remove") == 0) { + /* import database entry and delete it */ + udev_device_read_db(dev); + if (!event->test) + udev_device_delete_db(dev); + + if (udev_device_get_devnode(dev) == NULL) { + char devnode[UTIL_PATH_SIZE]; + + info(event->udev, "'%s' not found in database, using kernel name '%s'\n", + udev_device_get_syspath(dev), udev_device_get_sysname(dev)); + util_strlcpy(devnode, udev_get_dev_path(event->udev), sizeof(devnode)); + util_strlcat(devnode, "/", sizeof(devnode)); + util_strlcat(devnode, udev_device_get_sysname(dev), sizeof(devnode)); + udev_device_set_devnode(dev, devnode); + } + + udev_rules_get_run(rules, event); + if (event->ignore_device) { + info(event->udev, "device event will be ignored\n"); + goto exit; + } + + if (udev_device_get_ignore_remove(dev)) { + info(event->udev, "ignore_remove for '%s'\n", udev_device_get_devnode(dev)); + goto exit; + } + + err = udev_node_remove(dev, event->test); + goto exit; + } + + /* default devices */ + udev_rules_get_run(rules, event); + if (event->ignore_device) + info(event->udev, "device event will be ignored\n"); +exit: + return err; +} diff --git a/udev/udev-node.c b/udev/udev-node.c new file mode 100644 index 0000000000..9f2b6cf014 --- /dev/null +++ b/udev/udev-node.c @@ -0,0 +1,525 @@ +/* + * Copyright (C) 2004-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev-rules.h" + +#define TMP_FILE_EXT ".udev-tmp" + +/* reverse mapping from the device file name to the devpath */ +static int name_index(struct udev *udev, const char *devpath, const char *name, int add, int test) +{ + char device[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE * 2]; + size_t devlen = strlen(udev_get_dev_path(udev))+1; + size_t start; + int fd; + + /* directory with device name */ + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + start = util_strlcat(filename, "/.udev/names/", sizeof(filename)); + util_strlcat(filename, &name[devlen], sizeof(filename)); + util_path_encode(&filename[start], sizeof(filename) - start); + /* entry with the devpath */ + util_strlcpy(device, devpath, sizeof(device)); + util_path_encode(device, sizeof(device)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, device, sizeof(filename)); + + if (add) { + info(udev, "creating index: '%s'\n", filename); + create_path(udev, filename); + fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); + if (fd > 0) + close(fd); + } else { + info(udev, "removing index: '%s'\n", filename); + unlink(filename); + delete_path(udev, filename); + } + return 0; +} + +int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid) +{ + struct udev *udev = udev_device_get_udev(dev); + char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; + struct stat stats; + int preserve = 0; + int err = 0; + + if (major(devnum) == 0) + devnum = udev_device_get_devnum(dev); + + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + mode |= S_IFBLK; + else + mode |= S_IFCHR; + + if (file == NULL) + file = udev_device_get_devnode(dev); + + if (lstat(file, &stats) == 0) { + if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) { + info(udev, "preserve file '%s', because it has correct dev_t\n", file); + preserve = 1; + udev_selinux_lsetfilecon(udev, file, mode); + } else { + info(udev, "atomically replace existing file '%s'\n", file); + util_strlcpy(file_tmp, file, sizeof(file_tmp)); + util_strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); + unlink(file_tmp); + udev_selinux_setfscreatecon(udev, file_tmp, mode); + err = mknod(file_tmp, mode, devnum); + udev_selinux_resetfscreatecon(udev); + if (err != 0) { + err(udev, "mknod(%s, %#o, %u, %u) failed: %m\n", + file_tmp, mode, major(devnum), minor(devnum)); + goto exit; + } + err = rename(file_tmp, file); + if (err != 0) { + err(udev, "rename(%s, %s) failed: %m\n", file_tmp, file); + unlink(file_tmp); + } + } + } else { + info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); + udev_selinux_setfscreatecon(udev, file, mode); + err = mknod(file, mode, devnum); + udev_selinux_resetfscreatecon(udev); + if (err != 0) { + err(udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", file, mode, major(devnum), minor(devnum)); + goto exit; + } + } + + if (!preserve || stats.st_mode != mode) { + info(udev, "chmod(%s, %#o)\n", file, mode); + err = chmod(file, mode); + if (err != 0) { + err(udev, "chmod(%s, %#o) failed: %m\n", file, mode); + goto exit; + } + } + + if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { + info(udev, "chown(%s, %u, %u)\n", file, uid, gid); + err = chown(file, uid, gid); + if (err != 0) { + err(udev, "chown(%s, %u, %u) failed: %m\n", file, uid, gid); + goto exit; + } + } +exit: + return err; +} + +static int node_symlink(struct udev *udev, const char *node, const char *slink) +{ + struct stat stats; + char target[UTIL_PATH_SIZE] = ""; + char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; + int i = 0; + int tail = 0; + int len; + int err = 0; + + /* use relative link */ + while (node[i] && (node[i] == slink[i])) { + if (node[i] == '/') + tail = i+1; + i++; + } + while (slink[i] != '\0') { + if (slink[i] == '/') + util_strlcat(target, "../", sizeof(target)); + i++; + } + util_strlcat(target, &node[tail], sizeof(target)); + + /* preserve link with correct target, do not replace node of other device */ + if (lstat(slink, &stats) == 0) { + if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { + struct stat stats2; + + info(udev, "found existing node instead of symlink '%s'\n", slink); + if (lstat(node, &stats2) == 0) { + if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && + stats.st_rdev == stats2.st_rdev) { + info(udev, "replace device node '%s' with symlink to our node '%s'\n", + slink, node); + } else { + err(udev, "device node '%s' already exists, " + "link to '%s' will not overwrite it\n", + slink, node); + goto exit; + } + } + } else if (S_ISLNK(stats.st_mode)) { + char buf[UTIL_PATH_SIZE]; + + info(udev, "found existing symlink '%s'\n", slink); + len = readlink(slink, buf, sizeof(buf)); + if (len > 0) { + buf[len] = '\0'; + if (strcmp(target, buf) == 0) { + info(udev, "preserve already existing symlink '%s' to '%s'\n", + slink, target); + udev_selinux_lsetfilecon(udev, slink, S_IFLNK); + goto exit; + } + } + } + } else { + info(udev, "creating symlink '%s' to '%s'\n", slink, target); + udev_selinux_setfscreatecon(udev, slink, S_IFLNK); + err = symlink(target, slink); + udev_selinux_resetfscreatecon(udev); + if (err == 0) + goto exit; + } + + info(udev, "atomically replace '%s'\n", slink); + util_strlcpy(slink_tmp, slink, sizeof(slink_tmp)); + util_strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); + unlink(slink_tmp); + udev_selinux_setfscreatecon(udev, slink, S_IFLNK); + err = symlink(target, slink_tmp); + udev_selinux_resetfscreatecon(udev); + if (err != 0) { + err(udev, "symlink(%s, %s) failed: %m\n", target, slink_tmp); + goto exit; + } + err = rename(slink_tmp, slink); + if (err != 0) { + err(udev, "rename(%s, %s) failed: %m\n", slink_tmp, slink); + unlink(slink_tmp); + goto exit; + } +exit: + return err; +} + +static int get_devices_by_name(struct udev *udev, const char *name, struct list_head *name_list) +{ + char dirname[PATH_MAX]; + size_t devlen = strlen(udev_get_dev_path(udev))+1; + size_t start; + DIR *dir; + int count = 0; + + util_strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); + start = util_strlcat(dirname, "/.udev/names/", sizeof(dirname)); + util_strlcat(dirname, &name[devlen], sizeof(dirname)); + util_path_encode(&dirname[start], sizeof(dirname) - start); + + dir = opendir(dirname); + if (dir == NULL) { + info(udev, "no index directory '%s': %m\n", dirname); + count = -1; + goto out; + } + + info(udev, "found index directory '%s'\n", dirname); + while (1) { + struct dirent *ent; + char device[UTIL_PATH_SIZE]; + + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + if (ent->d_name[0] == '.') + continue; + + util_strlcpy(device, udev_get_sys_path(udev), sizeof(device)); + util_strlcat(device, ent->d_name, sizeof(device)); + util_path_decode(device); + name_list_add(udev, name_list, device, 0); + count++; + } + closedir(dir); +out: + return count; +} + +static int update_link(struct udev_device *dev, const char *slink, int test) +{ + struct udev *udev = udev_device_get_udev(dev); + LIST_HEAD(name_list); + struct name_entry *device; + char target[UTIL_PATH_SIZE] = ""; + int count; + int priority = 0; + int rc = 0; + + info(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); + + count = get_devices_by_name(udev, slink, &name_list); + info(udev, "found %i devices with name '%s'\n", count, slink); + + /* if we don't have a reference, delete it */ + if (count <= 0) { + info(udev, "no reference left, remove '%s'\n", slink); + if (!test) { + unlink(slink); + delete_path(udev, slink); + } + goto out; + } + + /* find the device with the highest priority */ + list_for_each_entry(device, &name_list, node) { + struct udev_device *dev_db; + const char *devnode; + + info(udev, "found '%s' for '%s'\n", device->name, slink); + + /* did we find ourself? we win, if we have the same priority */ + if (strcmp(udev_device_get_syspath(dev), device->name) == 0) { + info(udev, "compare (our own) priority of '%s' %i >= %i\n", + udev_device_get_devpath(dev), udev_device_get_devlink_priority(dev), priority); + if (strcmp(udev_device_get_devnode(dev), slink) == 0) { + info(udev, "'%s' is our device node, database inconsistent, skip link update\n", + udev_device_get_devnode(dev)); + } else if (target[0] == '\0' || udev_device_get_devlink_priority(dev) >= priority) { + priority = udev_device_get_devlink_priority(dev); + util_strlcpy(target, udev_device_get_devnode(dev), sizeof(target)); + } + continue; + } + + /* another device, read priority from database */ + dev_db = udev_device_new_from_syspath(udev, device->name); + if (dev_db == NULL) + continue; + devnode = udev_device_get_devnode(dev_db); + if (devnode != NULL) { + if (strcmp(devnode, slink) == 0) { + info(udev, "'%s' is a device node of '%s', skip link update\n", + devnode, device->name); + } else { + info(udev, "compare priority of '%s' %i > %i\n", + udev_device_get_devpath(dev_db), + udev_device_get_devlink_priority(dev_db), + priority); + if (target[0] == '\0' || udev_device_get_devlink_priority(dev_db) > priority) { + priority = udev_device_get_devlink_priority(dev_db); + util_strlcpy(target, devnode, sizeof(target)); + } + } + } + udev_device_unref(dev_db); + } + name_list_cleanup(udev, &name_list); + + if (target[0] == '\0') { + info(udev, "no current target for '%s' found\n", slink); + rc = 1; + goto out; + } + + /* create symlink to the target with the highest priority */ + info(udev, "'%s' with target '%s' has the highest priority %i, create it\n", slink, target, priority); + if (!test) { + create_path(udev, slink); + node_symlink(udev, target, slink); + } +out: + return rc; +} + +void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test) +{ + struct udev *udev = udev_device_get_udev(dev); + struct udev_list_entry *list_entry; + const char *devnode_old; + + /* update possible left-over symlinks */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { + struct udev_list_entry *list_entry_current; + + udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { + if (strcmp(udev_list_entry_get_name(list_entry_current), + udev_list_entry_get_name(list_entry)) == 0) + continue; + } + /* link does no longer belong to this device */ + info(udev, "update old symlink '%s' no longer belonging to '%s'\n", + udev_list_entry_get_name(list_entry), udev_device_get_devpath(dev)); + update_link(dev, udev_list_entry_get_name(list_entry), test); + } + + /* + * if the node name has changed, delete the node, + * and possibly restore a symlink of another device + */ + devnode_old = udev_device_get_devnode(dev_old); + if (devnode_old != NULL) { + const char *devnode = udev_device_get_devnode(dev); + + if (devnode != NULL && strcmp(devnode_old, devnode) != 0) + update_link(dev, devnode_old, test); + } +} + +int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const char *group, int test) +{ + struct udev *udev = udev_device_get_udev(dev); + uid_t uid; + gid_t gid; + int i; + int num; + struct udev_list_entry *list_entry; + int err = 0; + + create_path(udev, udev_device_get_devnode(dev)); + + if (strcmp(owner, "root") == 0) + uid = 0; + else { + char *endptr; + unsigned long id; + + id = strtoul(owner, &endptr, 10); + if (endptr[0] == '\0') + uid = (uid_t) id; + else + uid = lookup_user(udev, owner); + } + + if (strcmp(group, "root") == 0) + gid = 0; + else { + char *endptr; + unsigned long id; + + id = strtoul(group, &endptr, 10); + if (endptr[0] == '\0') + gid = (gid_t) id; + else + gid = lookup_group(udev, group); + } + + info(udev, "creating device node '%s', devnum=%d:%d, mode=%#o, uid=%d, gid=%d\n", + udev_device_get_devnode(dev), + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)), + mode, uid, gid); + + if (!test) + if (udev_node_mknod(dev, NULL, makedev(0,0), mode, uid, gid) != 0) { + err = -1; + goto exit; + } + + /* create all_partitions if requested */ + num = udev_device_get_num_fake_partitions(dev); + if (num > 0) { + info(udev, "creating device partition nodes '%s[1-%i]'\n", udev_device_get_devnode(dev), num); + if (!test) { + for (i = 1; i <= num; i++) { + char partitionname[UTIL_PATH_SIZE]; + dev_t part_devnum; + + snprintf(partitionname, sizeof(partitionname), "%s%d", + udev_device_get_devnode(dev), i); + partitionname[sizeof(partitionname)-1] = '\0'; + part_devnum = makedev(major(udev_device_get_devnum(dev)), + minor(udev_device_get_devnum(dev)) + i); + udev_node_mknod(dev, partitionname, part_devnum, mode, uid, gid); + } + } + } + + /* add node and to name index */ + name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 1, test); + + /* create/update symlinks, add symlinks to name index */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { + name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 1, test); + update_link(dev, udev_list_entry_get_name(list_entry), test); + } +exit: + return err; +} + +extern int udev_node_remove(struct udev_device *dev, int test) +{ + struct udev *udev = udev_device_get_udev(dev); + struct udev_list_entry *list_entry; + const char *devnode; + char partitionname[UTIL_PATH_SIZE]; + struct stat stats; + int err = 0; + int num; + + /* remove node from name index */ + name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 0, test); + + /* remove,update symlinks, remove symlinks from name index */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { + name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 0, test); + update_link(dev, udev_list_entry_get_name(list_entry), test); + } + + devnode = udev_device_get_devnode(dev); + if (devnode == NULL) + return 0; + if (stat(devnode, &stats) != 0) { + info(udev, "device node '%s' not found\n", devnode); + return 0; + } + if (stats.st_rdev != udev_device_get_devnum(dev)) { + info(udev, "device node '%s' points to a different device, skip removal\n", devnode); + return -1; + } + + info(udev, "removing device node '%s'\n", devnode); + if (!test) + err = unlink_secure(udev, devnode); + if (err) + return err; + + num = udev_device_get_num_fake_partitions(dev); + if (num > 0) { + int i; + + info(udev, "removing all_partitions '%s[1-%i]'\n", devnode, num); + if (num > 255) + return -1; + for (i = 1; i <= num; i++) { + snprintf(partitionname, sizeof(partitionname), "%s%d", devnode, i); + partitionname[sizeof(partitionname)-1] = '\0'; + if (!test) + unlink_secure(udev, partitionname); + } + } + delete_path(udev, devnode); + return err; +} diff --git a/udev/udev-rules-parse.c b/udev/udev-rules-parse.c new file mode 100644 index 0000000000..354ed2882d --- /dev/null +++ b/udev/udev-rules-parse.c @@ -0,0 +1,850 @@ +/* + * Copyright (C) 2003,2004 Greg Kroah-Hartman + * Copyright (C) 2003-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev-rules.h" + + +void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules) +{ + dbg(rules->udev, "bufsize=%zi\n", rules->bufsize); + iter->rules = rules; + iter->current = 0; +} + +struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter) +{ + struct udev_rules *rules; + struct udev_rule *rule; + + rules = iter->rules; + if (!rules) + return NULL; + + dbg(rules->udev, "current=%zi\n", iter->current); + if (iter->current >= rules->bufsize) { + dbg(rules->udev, "no more rules\n"); + return NULL; + } + + /* get next rule */ + rule = (struct udev_rule *) (rules->buf + iter->current); + iter->current += sizeof(struct udev_rule) + rule->bufsize; + + return rule; +} + +struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off) +{ + struct udev_rules *rules = iter->rules; + struct udev_rule *rule; + + dbg(rules->udev, "current=%zi\n", iter->current); + iter->current = rule_off; + rule = (struct udev_rule *) (rules->buf + iter->current); + + return rule; +} + +static size_t find_label(const struct udev_rules_iter *iter, const char *label) +{ + struct udev_rule *rule; + struct udev_rules *rules = iter->rules; + size_t current = iter->current; + +next: + dbg(rules->udev, "current=%zi\n", current); + if (current >= rules->bufsize) { + dbg(rules->udev, "LABEL='%s' not found\n", label); + return 0; + } + rule = (struct udev_rule *) (rules->buf + current); + + if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { + dbg(rules->udev, "moving forward, looking for label '%s'\n", label); + current += sizeof(struct udev_rule) + rule->bufsize; + goto next; + } + + dbg(rules->udev, "found label '%s'\n", label); + return current; +} + +static int get_key(struct udev_rules *rules, char **line, char **key, enum key_operation *operation, char **value) +{ + char *linepos; + char *temp; + + linepos = *line; + if (linepos == NULL && linepos[0] == '\0') + return -1; + + /* skip whitespace */ + while (isspace(linepos[0]) || linepos[0] == ',') + linepos++; + + /* get the key */ + if (linepos[0] == '\0') + return -1; + *key = linepos; + + while (1) { + linepos++; + if (linepos[0] == '\0') + return -1; + if (isspace(linepos[0])) + break; + if (linepos[0] == '=') + break; + if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) + if (linepos[1] == '=') + break; + } + + /* remember end of key */ + temp = linepos; + + /* skip whitespace after key */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get operation type */ + if (linepos[0] == '=' && linepos[1] == '=') { + *operation = KEY_OP_MATCH; + linepos += 2; + dbg(rules->udev, "operator=match\n"); + } else if (linepos[0] == '!' && linepos[1] == '=') { + *operation = KEY_OP_NOMATCH; + linepos += 2; + dbg(rules->udev, "operator=nomatch\n"); + } else if (linepos[0] == '+' && linepos[1] == '=') { + *operation = KEY_OP_ADD; + linepos += 2; + dbg(rules->udev, "operator=add\n"); + } else if (linepos[0] == '=') { + *operation = KEY_OP_ASSIGN; + linepos++; + dbg(rules->udev, "operator=assign\n"); + } else if (linepos[0] == ':' && linepos[1] == '=') { + *operation = KEY_OP_ASSIGN_FINAL; + linepos += 2; + dbg(rules->udev, "operator=assign_final\n"); + } else + return -1; + + /* terminate key */ + temp[0] = '\0'; + dbg(rules->udev, "key='%s'\n", *key); + + /* skip whitespace after operator */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get the value*/ + if (linepos[0] == '"') + linepos++; + else + return -1; + *value = linepos; + + temp = strchr(linepos, '"'); + if (!temp) + return -1; + temp[0] = '\0'; + temp++; + dbg(rules->udev, "value='%s'\n", *value); + + /* move line to next key */ + *line = temp; + + return 0; +} + +/* extract possible KEY{attr} */ +static char *get_key_attribute(struct udev_rules *rules, char *str) +{ + char *pos; + char *attr; + + attr = strchr(str, '{'); + if (attr != NULL) { + attr++; + pos = strchr(attr, '}'); + if (pos == NULL) { + err(rules->udev, "missing closing brace for format\n"); + return NULL; + } + pos[0] = '\0'; + dbg(rules->udev, "attribute='%s'\n", attr); + return attr; + } + + return NULL; +} + +static int add_rule_key(struct udev_rule *rule, struct key *key, + enum key_operation operation, const char *value) +{ + size_t val_len = strnlen(value, UTIL_PATH_SIZE); + + key->operation = operation; + + key->val_off = rule->bufsize; + util_strlcpy(rule->buf + rule->bufsize, value, val_len+1); + rule->bufsize += val_len+1; + + return 0; +} + +static int add_rule_key_pair(struct udev_rules *rules, struct udev_rule *rule, struct key_pairs *pairs, + enum key_operation operation, const char *key, const char *value) +{ + size_t key_len = strnlen(key, UTIL_PATH_SIZE); + + if (pairs->count >= PAIRS_MAX) { + err(rules->udev, "skip, too many keys of the same type in a single rule\n"); + return -1; + } + + add_rule_key(rule, &pairs->keys[pairs->count].key, operation, value); + + /* add the key-name of the pair */ + pairs->keys[pairs->count].key_name_off = rule->bufsize; + util_strlcpy(rule->buf + rule->bufsize, key, key_len+1); + rule->bufsize += key_len+1; + + pairs->count++; + + return 0; +} + +static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) +{ + char buf[sizeof(struct udev_rule) + UTIL_LINE_SIZE]; + struct udev_rule *rule; + size_t rule_size; + int valid; + char *linepos; + char *attr; + size_t padding; + int physdev = 0; + int retval; + + memset(buf, 0x00, sizeof(buf)); + rule = (struct udev_rule *) buf; + rule->event_timeout = -1; + linepos = line; + valid = 0; + + /* get all the keys */ + while (1) { + char *key; + char *value; + enum key_operation operation = KEY_OP_UNSET; + + retval = get_key(rules, &linepos, &key, &operation, &value); + if (retval) + break; + + if (strcasecmp(key, "ACTION") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid ACTION operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->action, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "DEVPATH") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid DEVPATH operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->devpath, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "KERNEL") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid KERNEL operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->kernel, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "SUBSYSTEM") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid SUBSYSTEM operation\n"); + goto invalid; + } + /* bus, class, subsystem events should all be the same */ + if (strcmp(value, "subsystem") == 0 || + strcmp(value, "bus") == 0 || + strcmp(value, "class") == 0) { + if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) + err(rules->udev, "'%s' must be specified as 'subsystem' \n" + "please fix it in %s:%u", value, filename, lineno); + add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); + } else + add_rule_key(rule, &rule->subsystem, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "DRIVER") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid DRIVER operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->driver, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("ATTR")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ATTR attribute\n"); + goto invalid; + } + if (add_rule_key_pair(rules, rule, &rule->attr, operation, attr, value) != 0) + goto invalid; + valid = 1; + continue; + } + + if (strcasecmp(key, "KERNELS") == 0 || + strcasecmp(key, "ID") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid KERNELS operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->kernels, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "SUBSYSTEMS") == 0 || + strcasecmp(key, "BUS") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid SUBSYSTEMS operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->subsystems, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "DRIVERS") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid DRIVERS operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->drivers, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || + strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid ATTRS operation\n"); + goto invalid; + } + attr = get_key_attribute(rules, key + sizeof("ATTRS")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ATTRS attribute\n"); + goto invalid; + } + if (strncmp(attr, "device/", 7) == 0) + err(rules->udev, "the 'device' link is deprecated and will be removed from a future kernel, \n" + "please fix it in %s:%u", filename, lineno); + else if (strstr(attr, "../") != NULL) + err(rules->udev, "do not reference parent sysfs directories directly, that may break with a future kernel, \n" + "please fix it in %s:%u", filename, lineno); + if (add_rule_key_pair(rules, rule, &rule->attrs, operation, attr, value) != 0) + goto invalid; + valid = 1; + continue; + } + + if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("ENV")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ENV attribute\n"); + goto invalid; + } + if (strncmp(attr, "PHYSDEV", 7) == 0) + physdev = 1; + if (add_rule_key_pair(rules, rule, &rule->env, operation, attr, value) != 0) + goto invalid; + valid = 1; + continue; + } + + if (strcasecmp(key, "PROGRAM") == 0) { + add_rule_key(rule, &rule->program, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "RESULT") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid RESULT operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->result, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("IMPORT")-1); + if (attr != NULL && strstr(attr, "program")) { + dbg(rules->udev, "IMPORT will be executed\n"); + rule->import_type = IMPORT_PROGRAM; + } else if (attr != NULL && strstr(attr, "file")) { + dbg(rules->udev, "IMPORT will be included as file\n"); + rule->import_type = IMPORT_FILE; + } else if (attr != NULL && strstr(attr, "parent")) { + dbg(rules->udev, "IMPORT will include the parent values\n"); + rule->import_type = IMPORT_PARENT; + } else { + /* figure it out if it is executable */ + char file[UTIL_PATH_SIZE]; + char *pos; + struct stat statbuf; + + util_strlcpy(file, value, sizeof(file)); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + + /* allow programs in /lib/udev called without the path */ + if (strchr(file, '/') == NULL) { + util_strlcpy(file, UDEV_PREFIX "/lib/udev/", sizeof(file)); + util_strlcat(file, value, sizeof(file)); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + } + + dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); + if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { + dbg(rules->udev, "IMPORT is executable, will be executed (autotype)\n"); + rule->import_type = IMPORT_PROGRAM; + } else { + dbg(rules->udev, "IMPORT is not executable, will be included as file (autotype)\n"); + rule->import_type = IMPORT_FILE; + } + } + add_rule_key(rule, &rule->import, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid TEST operation\n"); + goto invalid; + } + attr = get_key_attribute(rules, key + sizeof("TEST")-1); + if (attr != NULL) + rule->test_mode_mask = strtol(attr, NULL, 8); + add_rule_key(rule, &rule->test, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("RUN")-1); + if (attr != NULL) { + if (strstr(attr, "ignore_error")) + rule->run_ignore_error = 1; + } + add_rule_key(rule, &rule->run, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { + add_rule_key(rule, &rule->wait_for, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "LABEL") == 0) { + add_rule_key(rule, &rule->label, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "GOTO") == 0) { + add_rule_key(rule, &rule->goto_label, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("NAME")-1); + if (attr != NULL) { + if (strstr(attr, "all_partitions") != NULL) { + dbg(rules->udev, "creation of partition nodes requested\n"); + rule->partitions = DEFAULT_PARTITIONS_COUNT; + } + if (strstr(attr, "ignore_remove") != NULL) { + dbg(rules->udev, "remove event should be ignored\n"); + rule->ignore_remove = 1; + } + } + if (value[0] == '\0') + dbg(rules->udev, "name empty, node creation supressed\n"); + add_rule_key(rule, &rule->name, operation, value); + continue; + } + + if (strcasecmp(key, "SYMLINK") == 0) { + if (operation == KEY_OP_MATCH || + operation == KEY_OP_NOMATCH) + add_rule_key(rule, &rule->symlink_match, operation, value); + else + add_rule_key(rule, &rule->symlink, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "OWNER") == 0) { + valid = 1; + if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { + char *endptr; + strtoul(value, &endptr, 10); + if (endptr[0] != '\0') { + char owner[32]; + uid_t uid = lookup_user(rules->udev, value); + dbg(rules->udev, "replacing username='%s' by id=%i\n", value, uid); + sprintf(owner, "%u", (unsigned int) uid); + add_rule_key(rule, &rule->owner, operation, owner); + continue; + } + } + + add_rule_key(rule, &rule->owner, operation, value); + continue; + } + + if (strcasecmp(key, "GROUP") == 0) { + valid = 1; + if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { + char *endptr; + strtoul(value, &endptr, 10); + if (endptr[0] != '\0') { + char group[32]; + gid_t gid = lookup_group(rules->udev, value); + dbg(rules->udev, "replacing groupname='%s' by id=%i\n", value, gid); + sprintf(group, "%u", (unsigned int) gid); + add_rule_key(rule, &rule->group, operation, group); + continue; + } + } + + add_rule_key(rule, &rule->group, operation, value); + continue; + } + + if (strcasecmp(key, "MODE") == 0) { + add_rule_key(rule, &rule->mode, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "OPTIONS") == 0) { + const char *pos; + + if (strstr(value, "last_rule") != NULL) { + dbg(rules->udev, "last rule to be applied\n"); + rule->last_rule = 1; + } + if (strstr(value, "ignore_device") != NULL) { + dbg(rules->udev, "device should be ignored\n"); + rule->ignore_device = 1; + } + if (strstr(value, "ignore_remove") != NULL) { + dbg(rules->udev, "remove event should be ignored\n"); + rule->ignore_remove = 1; + } + pos = strstr(value, "link_priority="); + if (pos != NULL) { + rule->link_priority = atoi(&pos[strlen("link_priority=")]); + dbg(rules->udev, "link priority=%i\n", rule->link_priority); + } + pos = strstr(value, "event_timeout="); + if (pos != NULL) { + rule->event_timeout = atoi(&pos[strlen("event_timeout=")]); + dbg(rules->udev, "event timout=%i\n", rule->event_timeout); + } + pos = strstr(value, "string_escape="); + if (pos != NULL) { + pos = &pos[strlen("string_escape=")]; + if (strncmp(pos, "none", strlen("none")) == 0) + rule->string_escape = ESCAPE_NONE; + else if (strncmp(pos, "replace", strlen("replace")) == 0) + rule->string_escape = ESCAPE_REPLACE; + } + if (strstr(value, "all_partitions") != NULL) { + dbg(rules->udev, "creation of partition nodes requested\n"); + rule->partitions = DEFAULT_PARTITIONS_COUNT; + } + valid = 1; + continue; + } + + err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); + } + + if (physdev && rule->wait_for.operation == KEY_OP_UNSET) + err(rules->udev, "PHYSDEV* values are deprecated and will be removed from a future kernel, \n" + "please fix it in %s:%u", filename, lineno); + + /* skip line if not any valid key was found */ + if (!valid) + goto invalid; + + /* grow buffer and add rule */ + rule_size = sizeof(struct udev_rule) + rule->bufsize; + padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); + dbg(rules->udev, "add %zi padding bytes\n", padding); + rule_size += padding; + rule->bufsize += padding; + + rules->buf = realloc(rules->buf, rules->bufsize + rule_size); + if (!rules->buf) { + err(rules->udev, "realloc failed\n"); + goto exit; + } + dbg(rules->udev, "adding rule to offset %zi\n", rules->bufsize); + memcpy(rules->buf + rules->bufsize, rule, rule_size); + rules->bufsize += rule_size; +exit: + return 0; + +invalid: + err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); + return -1; +} + +static int parse_file(struct udev_rules *rules, const char *filename) +{ + char line[UTIL_LINE_SIZE]; + char *bufline; + unsigned int lineno; + char *buf; + size_t bufsize; + size_t cur; + size_t count; + int retval = 0; + size_t start; + struct udev_rule *rule; + struct udev_rules_iter iter; + + start = rules->bufsize; + + if (file_map(filename, &buf, &bufsize) != 0) { + err(rules->udev, "can't open '%s' as rules file: %m\n", filename); + return -1; + } + info(rules->udev, "reading '%s' as rules file\n", filename); + + /* loop through the whole file */ + cur = 0; + lineno = 0; + while (cur < bufsize) { + unsigned int i, j; + + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + lineno++; + + /* eat the whitespace */ + while ((count > 0) && isspace(bufline[0])) { + bufline++; + count--; + } + if (count == 0) + continue; + + /* see if this is a comment */ + if (bufline[0] == '#') + continue; + + if (count >= sizeof(line)) { + err(rules->udev, "line too long, rule skipped '%s:%u'\n", filename, lineno); + continue; + } + + /* skip backslash and newline from multiline rules */ + for (i = j = 0; i < count; i++) { + if (bufline[i] == '\\' && bufline[i+1] == '\n') + continue; + + line[j++] = bufline[i]; + } + line[j] = '\0'; + + dbg(rules->udev, "read '%s'\n", line); + add_to_rules(rules, line, filename, lineno); + } + + /* Compute all goto targets within this file */ + udev_rules_iter_init(&iter, rules); + udev_rules_iter_goto(&iter, start); + while((rule = udev_rules_iter_next(&iter))) { + if (rule->goto_label.operation != KEY_OP_UNSET) { + char *goto_label = &rule->buf[rule->goto_label.val_off]; + + dbg(rules->udev, "resolving goto label '%s'\n", goto_label); + rule->goto_rule_off = find_label(&iter, goto_label); + if (rule->goto_rule_off == 0) { + err(rules->udev, "ignore goto to nonexistent label '%s' in '%s'\n", + goto_label, filename); + rule->goto_rule_off = iter.current; + } + } + } + + file_unmap(buf, bufsize); + return retval; +} + +int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names) +{ + struct stat statbuf; + char filename[PATH_MAX]; + LIST_HEAD(name_list); + LIST_HEAD(sort_list); + struct name_entry *name_loop, *name_tmp; + struct name_entry *sort_loop, *sort_tmp; + int retval = 0; + + memset(rules, 0x00, sizeof(struct udev_rules)); + rules->udev = udev; + rules->resolve_names = resolve_names; + + if (udev_get_rules_path(udev) != NULL) { + /* custom rules location for testing */ + add_matching_files(udev, &name_list, udev_get_rules_path(udev), ".rules"); + } else { + /* read user/custom rules */ + add_matching_files(udev, &name_list, SYSCONFDIR "/udev/rules.d", ".rules"); + + /* read dynamic/temporary rules */ + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + util_strlcat(filename, "/.udev/rules.d", sizeof(filename)); + if (stat(filename, &statbuf) != 0) { + create_path(udev, filename); + udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); + mkdir(filename, 0755); + udev_selinux_resetfscreatecon(udev); + } + add_matching_files(udev, &sort_list, filename, ".rules"); + + /* read default rules */ + add_matching_files(udev, &sort_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); + + /* sort all rules files by basename into list of files */ + list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) { + const char *sort_base = strrchr(sort_loop->name, '/'); + + if (sort_base == NULL) + continue; + + list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { + const char *name_base = strrchr(name_loop->name, '/'); + + if (name_base == NULL) + continue; + + if (strcmp(name_base, sort_base) == 0) { + info(udev, "rule file '%s' already added, ignoring '%s'\n", + name_loop->name, sort_loop->name); + list_del(&sort_loop->node); + free(sort_loop); + sort_loop = NULL; + continue; + } + + if (strcmp(name_base, sort_base) > 0) + break; + } + if (sort_loop != NULL) + list_move_tail(&sort_loop->node, &name_loop->node); + } + } + + /* parse list of files */ + list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { + if (stat(name_loop->name, &statbuf) == 0) { + if (statbuf.st_size) + parse_file(rules, name_loop->name); + else + dbg(udev, "empty rules file '%s'\n", name_loop->name); + } else + err(udev, "could not read '%s': %m\n", name_loop->name); + list_del(&name_loop->node); + free(name_loop); + } + + return retval; +} + +void udev_rules_cleanup(struct udev_rules *rules) +{ + if (rules->buf) { + free(rules->buf); + rules->buf = NULL; + } +} + diff --git a/udev/udev-rules.c b/udev/udev-rules.c new file mode 100644 index 0000000000..8b94d40c0b --- /dev/null +++ b/udev/udev-rules.c @@ -0,0 +1,1634 @@ +/* + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "udev-rules.h" + +extern char **environ; + +/* extract possible {attr} and move str behind it */ +static char *get_format_attribute(struct udev *udev, char **str) +{ + char *pos; + char *attr = NULL; + + if (*str[0] == '{') { + pos = strchr(*str, '}'); + if (pos == NULL) { + err(udev, "missing closing brace for format\n"); + return NULL; + } + pos[0] = '\0'; + attr = *str+1; + *str = pos+1; + dbg(udev, "attribute='%s', str='%s'\n", attr, *str); + } + return attr; +} + +/* extract possible format length and move str behind it*/ +static int get_format_len(struct udev *udev, char **str) +{ + int num; + char *tail; + + if (isdigit(*str[0])) { + num = (int) strtoul(*str, &tail, 10); + if (num > 0) { + *str = tail; + dbg(udev, "format length=%i\n", num); + return num; + } else { + err(udev, "format parsing error '%s'\n", *str); + } + } + return -1; +} + +static int get_key(char **line, char **key, char **value) +{ + char *linepos; + char *temp; + + linepos = *line; + if (linepos == NULL) + return -1; + + /* skip whitespace */ + while (isspace(linepos[0])) + linepos++; + + /* get the key */ + temp = strchr(linepos, '='); + if (temp == NULL || temp == linepos) + return -1; + temp[0] = '\0'; + *key = linepos; + linepos = &temp[1]; + + /* get a quoted value */ + if (linepos[0] == '"' || linepos[0] == '\'') { + temp = strchr(&linepos[1], linepos[0]); + if (temp != NULL) { + temp[0] = '\0'; + *value = &linepos[1]; + goto out; + } + } + + /* get the value*/ + temp = strchr(linepos, '\n'); + if (temp != NULL) + temp[0] = '\0'; + *value = linepos; +out: + return 0; +} + +static int run_program(struct udev_device *dev, const char *command, + char *result, size_t ressize, size_t *reslen) +{ + struct udev *udev = udev_device_get_udev(dev); + int status; + char **envp; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[UTIL_PATH_SIZE]; + char program[UTIL_PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; + int devnull; + int i; + int err = 0; + + /* build argv from command */ + util_strlcpy(arg, command, sizeof(arg)); + i = 0; + if (strchr(arg, ' ') != NULL) { + char *pos = arg; + + while (pos != NULL) { + if (pos[0] == '\'') { + /* don't separate if in apostrophes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos != NULL && pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg(udev, "arg[%i] '%s'\n", i, argv[i]); + i++; + } + argv[i] = NULL; + } else { + argv[0] = arg; + argv[1] = NULL; + } + info(udev, "'%s'\n", command); + + /* prepare pipes from child to parent */ + if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe(outpipe) != 0) { + err(udev, "pipe failed: %m\n"); + return -1; + } + } + if (udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe(errpipe) != 0) { + err(udev, "pipe failed: %m\n"); + return -1; + } + } + + /* allow programs in /lib/udev/ to be called without the path */ + if (strchr(argv[0], '/') == NULL) { + util_strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); + util_strlcat(program, argv[0], sizeof(program)); + argv[0] = program; + } + + envp = udev_device_get_properties_envp(dev); + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent ends of pipes */ + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* discard child output or connect to pipe */ + devnull = open("/dev/null", O_RDWR); + if (devnull > 0) { + dup2(devnull, STDIN_FILENO); + if (outpipe[WRITE_END] < 0) + dup2(devnull, STDOUT_FILENO); + if (errpipe[WRITE_END] < 0) + dup2(devnull, STDERR_FILENO); + close(devnull); + } else + err(udev, "open /dev/null failed: %m\n"); + if (outpipe[WRITE_END] > 0) { + dup2(outpipe[WRITE_END], STDOUT_FILENO); + close(outpipe[WRITE_END]); + } + if (errpipe[WRITE_END] > 0) { + dup2(errpipe[WRITE_END], STDERR_FILENO); + close(errpipe[WRITE_END]); + } + execve(argv[0], argv, envp); + if (errno == ENOENT || errno == ENOTDIR) { + /* may be on a filesytem which is not mounted right now */ + info(udev, "program '%s' not found\n", argv[0]); + } else { + /* other problems */ + err(udev, "exec of program '%s' failed\n", argv[0]); + } + _exit(1); + case -1: + err(udev, "fork of '%s' failed: %m\n", argv[0]); + return -1; + default: + /* read from child if requested */ + if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + ssize_t count; + size_t respos = 0; + + /* parent closes child ends of pipes */ + if (outpipe[WRITE_END] > 0) + close(outpipe[WRITE_END]); + if (errpipe[WRITE_END] > 0) + close(errpipe[WRITE_END]); + + /* read child output */ + while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + int fdcount; + fd_set readfds; + + FD_ZERO(&readfds); + if (outpipe[READ_END] > 0) + FD_SET(outpipe[READ_END], &readfds); + if (errpipe[READ_END] > 0) + FD_SET(errpipe[READ_END], &readfds); + fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -1; + break; + } + + /* get stdout */ + if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { + char inbuf[1024]; + char *pos; + char *line; + + count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); + if (count <= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + if (count < 0) { + err(udev, "stdin read failed: %m\n"); + err = -1; + } + continue; + } + inbuf[count] = '\0'; + + /* store result for rule processing */ + if (result) { + if (respos + count < ressize) { + memcpy(&result[respos], inbuf, count); + respos += count; + } else { + err(udev, "ressize %ld too short\n", (long)ressize); + err = -1; + } + } + pos = inbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info(udev, "'%s' (stdout) '%s'\n", argv[0], line); + } + + /* get stderr */ + if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { + char errbuf[1024]; + char *pos; + char *line; + + count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); + if (count <= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + if (count < 0) + err(udev, "stderr read failed: %m\n"); + continue; + } + errbuf[count] = '\0'; + pos = errbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info(udev, "'%s' (stderr) '%s'\n", argv[0], line); + } + } + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* return the childs stdout string */ + if (result) { + result[respos] = '\0'; + dbg(udev, "result='%s'\n", result); + if (reslen) + *reslen = respos; + } + } + waitpid(pid, &status, 0); + if (WIFEXITED(status)) { + info(udev, "'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + err = -1; + } else { + err(udev, "'%s' abnormal exit\n", argv[0]); + err = -1; + } + } + + return err; +} + +static int import_keys_into_env(struct udev_event *event, const char *buf, size_t bufsize) +{ + struct udev_device *dev = event->dev; + char line[UTIL_LINE_SIZE]; + const char *bufline; + char *linepos; + char *variable; + char *value; + size_t cur; + size_t count; + int lineno; + + /* loop through the whole buffer */ + lineno = 0; + cur = 0; + while (cur < bufsize) { + count = buf_get_line(buf, bufsize, cur); + bufline = &buf[cur]; + cur += count+1; + lineno++; + + /* eat the whitespace */ + while ((count > 0) && isspace(bufline[0])) { + bufline++; + count--; + } + if (count == 0) + continue; + + /* see if this is a comment */ + if (bufline[0] == '#') + continue; + + if (count >= sizeof(line)) { + err(event->udev, "line too long, skipped\n"); + continue; + } + + memcpy(line, bufline, count); + line[count] = '\0'; + + linepos = line; + if (get_key(&linepos, &variable, &value) == 0) { + char syspath[UTIL_PATH_SIZE]; + + dbg(event->udev, "import '%s=%s'\n", variable, value); + /* handle device, renamed by external tool, returning new path */ + if (strcmp(variable, "DEVPATH") == 0) { + info(event->udev, "updating devpath from '%s' to '%s'\n", + udev_device_get_devpath(dev), value); + util_strlcpy(syspath, udev_get_sys_path(event->udev), sizeof(syspath)); + util_strlcat(syspath, value, sizeof(syspath)); + udev_device_set_syspath(dev, syspath); + } else { + struct udev_list_entry *entry; + + entry = udev_device_add_property(dev, variable, value); + /* store in db */ + udev_list_entry_set_flag(entry, 1); + } + } + } + return 0; +} + +static int import_file_into_env(struct udev_event *event, const char *filename) +{ + char *buf; + size_t bufsize; + + if (file_map(filename, &buf, &bufsize) != 0) { + err(event->udev, "can't open '%s': %m\n", filename); + return -1; + } + import_keys_into_env(event, buf, bufsize); + file_unmap(buf, bufsize); + + return 0; +} + +static int import_program_into_env(struct udev_event *event, const char *program) +{ + char result[2048]; + size_t reslen; + + if (run_program(event->dev, program, result, sizeof(result), &reslen) != 0) + return -1; + return import_keys_into_env(event, result, reslen); +} + +static int import_parent_into_env(struct udev_event *event, const char *filter) +{ + struct udev_device *dev_parent; + struct udev_list_entry *list_entry; + + dev_parent = udev_device_get_parent(event->dev); + if (dev_parent == NULL) + return -1; + + dbg(event->udev, "found parent '%s', get the node name\n", udev_device_get_syspath(dev_parent)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev_parent)) { + const char *key = udev_list_entry_get_name(list_entry); + const char *val = udev_list_entry_get_value(list_entry); + + if (fnmatch(filter, key, 0) == 0) { + struct udev_list_entry *entry; + + dbg(event->udev, "import key '%s=%s'\n", key, val); + entry = udev_device_add_property(event->dev, key, val); + /* store in db */ + udev_list_entry_set_flag(entry, 1); + } + } + return 0; +} + +int udev_rules_run(struct udev_event *event) +{ + struct udev_list_entry *list_entry; + int err = 0; + + dbg(event->udev, "executing run list\n"); + udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { + const char *cmd = udev_list_entry_get_name(list_entry); + + if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { + struct udev_monitor *monitor; + + monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); + if (monitor == NULL) + continue; + udev_monitor_send_device(monitor, event->dev); + udev_monitor_unref(monitor); + } else { + char program[UTIL_PATH_SIZE]; + + util_strlcpy(program, cmd, sizeof(program)); + udev_rules_apply_format(event, program, sizeof(program)); + if (run_program(event->dev, program, NULL, 0, NULL) != 0) { + if (!udev_list_entry_get_flag(list_entry)) + err = -1; + } + } + } + return err; +} + +#define WAIT_LOOP_PER_SECOND 50 +static int wait_for_file(struct udev_event *event, const char *file, int timeout) +{ + char filepath[UTIL_PATH_SIZE]; + char devicepath[UTIL_PATH_SIZE] = ""; + struct stat stats; + int loop = timeout * WAIT_LOOP_PER_SECOND; + + /* a relative path is a device attribute */ + if (file[0] != '/') { + util_strlcpy(devicepath, udev_get_sys_path(event->udev), sizeof(devicepath)); + util_strlcat(devicepath, udev_device_get_devpath(event->dev), sizeof(devicepath)); + + util_strlcpy(filepath, devicepath, sizeof(filepath)); + util_strlcat(filepath, "/", sizeof(filepath)); + util_strlcat(filepath, file, sizeof(filepath)); + file = filepath; + } + + dbg(event->udev, "will wait %i sec for '%s'\n", timeout, file); + while (--loop) { + /* lookup file */ + if (stat(file, &stats) == 0) { + info(event->udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + return 0; + } + /* make sure, the device did not disappear in the meantime */ + if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { + info(event->udev, "device disappeared while waiting for '%s'\n", file); + return -2; + } + info(event->udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); + usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + } + info(event->udev, "waiting for '%s' failed\n", file); + return -1; +} + +/* handle "[$SUBSYSTEM/$KERNEL]" lookup */ +static int split_subsys_sysname(struct udev *udev, char *attrstr, char **subsys, char **sysname, char **attr) +{ + char *pos; + + if (attrstr[0] != '[') + return -1; + + *subsys = &attrstr[1]; + pos = strchr(*subsys, ']'); + if (pos == NULL) + return -1; + pos[0] = '\0'; + pos = &pos[1]; + + if (pos[0] == '/') + pos = &pos[1]; + if (pos[0] != '\0') + *attr = pos; + else + *attr = NULL; + + pos = strchr(*subsys, '/'); + if (pos == NULL) + return -1; + pos[0] = '\0'; + *sysname = &pos[1]; + return 0; +} + +static int attr_subst_subdir(char *attr, size_t len) +{ + char *pos; + int found = 0; + + pos = strstr(attr, "/*/"); + if (pos != NULL) { + char str[UTIL_PATH_SIZE]; + DIR *dir; + + pos[1] = '\0'; + util_strlcpy(str, &pos[2], sizeof(str)); + dir = opendir(attr); + if (dir != NULL) { + struct dirent *dent; + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + util_strlcat(attr, dent->d_name, len); + util_strlcat(attr, str, len); + if (stat(attr, &stats) == 0) { + found = 1; + break; + } + pos[1] = '\0'; + } + closedir(dir); + } + if (!found) + util_strlcat(attr, str, len); + } + + return found; +} + +void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize) +{ + struct udev_device *dev = event->dev; + char temp[UTIL_PATH_SIZE]; + char temp2[UTIL_PATH_SIZE]; + char *head, *tail, *cpos, *attr, *rest; + int len; + int i; + int count; + enum subst_type { + SUBST_UNKNOWN, + SUBST_DEVPATH, + SUBST_KERNEL, + SUBST_KERNEL_NUMBER, + SUBST_ID, + SUBST_DRIVER, + SUBST_MAJOR, + SUBST_MINOR, + SUBST_RESULT, + SUBST_ATTR, + SUBST_PARENT, + SUBST_TEMP_NODE, + SUBST_NAME, + SUBST_LINKS, + SUBST_ROOT, + SUBST_SYS, + SUBST_ENV, + }; + static const struct subst_map { + char *name; + char fmt; + enum subst_type type; + } map[] = { + { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, + { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, + { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, + { .name = "id", .fmt = 'b', .type = SUBST_ID }, + { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, + { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, + { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, + { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, + { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, + { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, + { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, + { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, + { .name = "name", .fmt = 'D', .type = SUBST_NAME }, + { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, + { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, + { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, + { .name = "env", .fmt = 'E', .type = SUBST_ENV }, + { NULL, '\0', 0 } + }; + enum subst_type type; + const struct subst_map *subst; + + head = string; + while (1) { + len = -1; + while (head[0] != '\0') { + if (head[0] == '$') { + /* substitute named variable */ + if (head[1] == '\0') + break; + if (head[1] == '$') { + util_strlcpy(temp, head+2, sizeof(temp)); + util_strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + for (subst = map; subst->name; subst++) { + if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { + type = subst->type; + tail = head + strlen(subst->name)+1; + dbg(event->udev, "will substitute format name '%s'\n", subst->name); + goto found; + } + } + head[0] = '$'; + err(event->udev, "unknown format variable '%s'\n", head); + } else if (head[0] == '%') { + /* substitute format char */ + if (head[1] == '\0') + break; + if (head[1] == '%') { + util_strlcpy(temp, head+2, sizeof(temp)); + util_strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + tail = head+1; + len = get_format_len(event->udev, &tail); + for (subst = map; subst->name; subst++) { + if (tail[0] == subst->fmt) { + type = subst->type; + tail++; + dbg(event->udev, "will substitute format char '%c'\n", subst->fmt); + goto found; + } + } + head[0] = '%'; + err(event->udev, "unknown format char '%c'\n", tail[0]); + } + head++; + } + break; +found: + attr = get_format_attribute(event->udev, &tail); + util_strlcpy(temp, tail, sizeof(temp)); + dbg(event->udev, "format=%i, string='%s', tail='%s'\n", type ,string, tail); + + switch (type) { + case SUBST_DEVPATH: + util_strlcat(string, udev_device_get_devpath(dev), maxsize); + dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); + break; + case SUBST_KERNEL: + util_strlcat(string, udev_device_get_sysname(dev), maxsize); + dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); + break; + case SUBST_KERNEL_NUMBER: + if (udev_device_get_sysnum(dev) == NULL) + break; + util_strlcat(string, udev_device_get_sysnum(dev), maxsize); + dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); + break; + case SUBST_ID: + if (event->dev_parent != NULL) { + util_strlcat(string, udev_device_get_sysname(event->dev_parent), maxsize); + dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); + } + break; + case SUBST_DRIVER: + if (event->dev_parent != NULL) { + const char *driver = udev_device_get_driver(event->dev_parent); + + if (driver == NULL) + break; + util_strlcat(string, driver, maxsize); + dbg(event->udev, "substitute driver '%s'\n", driver); + } + break; + case SUBST_MAJOR: + sprintf(temp2, "%d", major(udev_device_get_devnum(dev))); + util_strlcat(string, temp2, maxsize); + dbg(event->udev, "substitute major number '%s'\n", temp2); + break; + case SUBST_MINOR: + sprintf(temp2, "%d", minor(udev_device_get_devnum(dev))); + util_strlcat(string, temp2, maxsize); + dbg(event->udev, "substitute minor number '%s'\n", temp2); + break; + case SUBST_RESULT: + if (event->program_result[0] == '\0') + break; + /* get part part of the result string */ + i = 0; + if (attr != NULL) + i = strtoul(attr, &rest, 10); + if (i > 0) { + dbg(event->udev, "request part #%d of result string\n", i); + cpos = event->program_result; + while (--i) { + while (cpos[0] != '\0' && !isspace(cpos[0])) + cpos++; + while (isspace(cpos[0])) + cpos++; + } + if (i > 0) { + err(event->udev, "requested part of result string not found\n"); + break; + } + util_strlcpy(temp2, cpos, sizeof(temp2)); + /* %{2+}c copies the whole string from the second part on */ + if (rest[0] != '+') { + cpos = strchr(temp2, ' '); + if (cpos) + cpos[0] = '\0'; + } + util_strlcat(string, temp2, maxsize); + dbg(event->udev, "substitute part of result string '%s'\n", temp2); + } else { + util_strlcat(string, event->program_result, maxsize); + dbg(event->udev, "substitute result string '%s'\n", event->program_result); + } + break; + case SUBST_ATTR: + if (attr == NULL) + err(event->udev, "missing file parameter for attr\n"); + else { + char *subsys; + char *sysname; + char *attrib; + char value[UTIL_NAME_SIZE] = ""; + size_t size; + + if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { + struct udev_device *d; + const char *val; + + if (attrib == NULL) + break; + d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); + if (d == NULL) + break; + val = udev_device_get_attr_value(d, attrib); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + udev_device_unref(d); + } + + /* try the current device, other matches may have selected */ + if (value[0]=='\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { + const char *val; + + val = udev_device_get_attr_value(event->dev_parent, attr); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + } + + /* look at all devices along the chain of parents */ + if (value[0]=='\0') { + struct udev_device *dev_parent = dev; + const char *val; + + do { + dbg(event->udev, "looking at '%s'\n", udev_device_get_syspath(dev_parent)); + val = udev_device_get_attr_value(dev_parent, attr); + if (val != NULL) { + util_strlcpy(value, val, sizeof(value)); + break; + } + dev_parent = udev_device_get_parent(dev_parent); + } while (dev_parent != NULL); + } + + if (value[0]=='\0') + break; + + /* strip trailing whitespace, and replace unwanted characters */ + size = strlen(value); + while (size > 0 && isspace(value[--size])) + value[size] = '\0'; + count = util_replace_chars(value, ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + util_strlcat(string, value, maxsize); + dbg(event->udev, "substitute sysfs value '%s'\n", value); + } + break; + case SUBST_PARENT: + { + struct udev_device *dev_parent; + const char *devnode; + + dev_parent = udev_device_get_parent(event->dev); + if (dev_parent == NULL) + break; + devnode = udev_device_get_devnode(dev_parent); + if (devnode != NULL) { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + + util_strlcat(string, &devnode[devlen], maxsize); + dbg(event->udev, "found parent '%s', got node name '%s'\n", + udev_device_get_syspath(dev_parent), &devnode[devlen]); + } + } + break; + case SUBST_TEMP_NODE: + if (event->tmp_node[0] == '\0' && major(udev_device_get_devnum(dev)) > 0) { + dbg(event->udev, "create temporary device node for callout\n"); + snprintf(event->tmp_node, sizeof(event->tmp_node), "%s/.tmp-%u-%u", + udev_get_dev_path(event->udev), + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + udev_node_mknod(dev, event->tmp_node, makedev(0,0), 0600, 0, 0); + } + util_strlcat(string, event->tmp_node, maxsize); + dbg(event->udev, "substitute temporary device node name '%s'\n", event->tmp_node); + break; + case SUBST_NAME: + if (event->name != NULL) { + util_strlcat(string, event->name, maxsize); + dbg(event->udev, "substitute name '%s'\n", event->name); + } else { + util_strlcat(string, udev_device_get_sysname(dev), maxsize); + dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); + } + break; + case SUBST_LINKS: + { + struct udev_list_entry *list_entry; + + list_entry = udev_device_get_properties_list_entry(dev); + util_strlcpy(string, udev_list_entry_get_name(list_entry), maxsize); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { + util_strlcat(string, " ", maxsize); + util_strlcat(string, udev_list_entry_get_name(list_entry), maxsize); + } + } + break; + case SUBST_ROOT: + util_strlcat(string, udev_get_dev_path(event->udev), maxsize); + dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); + break; + case SUBST_SYS: + util_strlcat(string, udev_get_sys_path(event->udev), maxsize); + dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); + break; + case SUBST_ENV: + if (attr == NULL) { + dbg(event->udev, "missing attribute\n"); + break; + } else { + struct udev_list_entry *list_entry; + const char *value; + + list_entry = udev_device_get_properties_list_entry(event->dev); + list_entry = udev_list_entry_get_by_name(list_entry, attr); + if (list_entry == NULL) + break; + value = udev_list_entry_get_value(list_entry); + dbg(event->udev, "substitute env '%s=%s'\n", attr, value); + util_strlcat(string, value, maxsize); + break; + } + default: + err(event->udev, "unknown substitution type=%i\n", type); + break; + } + /* possibly truncate to format-char specified length */ + if (len >= 0 && len < (int)strlen(head)) { + head[len] = '\0'; + dbg(event->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head); + } + util_strlcat(string, temp, maxsize); + } +} + +static char *key_val(struct udev_rule *rule, struct key *key) +{ + return rule->buf + key->val_off; +} + +static char *key_pair_name(struct udev_rule *rule, struct key_pair *pair) +{ + return rule->buf + pair->key_name_off; +} + +static int match_key(struct udev *udev, const char *key_name, struct udev_rule *rule, struct key *key, const char *val) +{ + char value[UTIL_PATH_SIZE]; + char *key_value; + char *pos; + int match = 0; + + if (key->operation != KEY_OP_MATCH && + key->operation != KEY_OP_NOMATCH) + return 0; + + if (val == NULL) + val = ""; + + /* look for a matching string, parts are separated by '|' */ + util_strlcpy(value, rule->buf + key->val_off, sizeof(value)); + key_value = value; + dbg(udev, "key %s value='%s'\n", key_name, key_value); + while (key_value != NULL) { + pos = strchr(key_value, '|'); + if (pos != NULL) { + pos[0] = '\0'; + pos = &pos[1]; + } + + dbg(udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); + match = (fnmatch(key_value, val, 0) == 0); + if (match) + break; + + key_value = pos; + } + + if (match && (key->operation == KEY_OP_MATCH)) { + dbg(udev, "%s is true (matching value)\n", key_name); + return 0; + } + if (!match && (key->operation == KEY_OP_NOMATCH)) { + dbg(udev, "%s is true (non-matching value)\n", key_name); + return 0; + } + return -1; +} + +/* match a single rule against a given device and possibly its parent devices */ +static int match_rule(struct udev_event *event, struct udev_rule *rule) +{ + struct udev_device *dev = event->dev; + int i; + + if (match_key(event->udev, "ACTION", rule, &rule->action, udev_device_get_action(dev))) + goto nomatch; + + if (match_key(event->udev, "KERNEL", rule, &rule->kernel, udev_device_get_sysname(dev))) + goto nomatch; + + if (match_key(event->udev, "SUBSYSTEM", rule, &rule->subsystem, udev_device_get_subsystem(dev))) + goto nomatch; + + if (match_key(event->udev, "DEVPATH", rule, &rule->devpath, udev_device_get_devpath(dev))) + goto nomatch; + + if (match_key(event->udev, "DRIVER", rule, &rule->driver, udev_device_get_driver(dev))) + goto nomatch; + + /* match NAME against a value assigned by an earlier rule */ + if (match_key(event->udev, "NAME", rule, &rule->name, event->name)) + goto nomatch; + + /* match against current list of symlinks */ + if (rule->symlink_match.operation == KEY_OP_MATCH || + rule->symlink_match.operation == KEY_OP_NOMATCH) { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; + int match = 0; + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { + const char *devlink; + + devlink = &udev_list_entry_get_name(list_entry)[devlen]; + if (match_key(event->udev, "SYMLINK", rule, &rule->symlink_match, devlink) == 0) { + match = 1; + break; + } + } + if (!match) + goto nomatch; + } + + for (i = 0; i < rule->env.count; i++) { + struct key_pair *pair = &rule->env.keys[i]; + + /* we only check for matches, assignments will be handled later */ + if (pair->key.operation == KEY_OP_MATCH || + pair->key.operation == KEY_OP_NOMATCH) { + struct udev_list_entry *list_entry; + const char *key_name = key_pair_name(rule, pair); + const char *value; + + list_entry = udev_device_get_properties_list_entry(event->dev); + list_entry = udev_list_entry_get_by_name(list_entry, key_name); + value = udev_list_entry_get_value(list_entry); + if (value == NULL) { + dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); + value = ""; + } + if (match_key(event->udev, "ENV", rule, &pair->key, value)) + goto nomatch; + } + } + + if (rule->test.operation == KEY_OP_MATCH || + rule->test.operation == KEY_OP_NOMATCH) { + char filename[UTIL_PATH_SIZE]; + char *subsys; + char *sysname; + char *attrib; + struct stat statbuf; + int match; + + util_strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); + udev_rules_apply_format(event, filename, sizeof(filename)); + + if (split_subsys_sysname(event->udev, filename, &subsys, &sysname, &attrib) == 0) { + struct udev_device *d; + d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); + if (d != NULL) { + util_strlcpy(filename, udev_device_get_syspath(d), sizeof(filename)); + if (attrib != NULL) { + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, attrib, sizeof(filename)); + } + udev_device_unref(d); + } + } else if (filename[0] != '/') { + char tmp[UTIL_PATH_SIZE]; + + util_strlcpy(tmp, udev_device_get_syspath(dev), sizeof(tmp)); + util_strlcat(tmp, "/", sizeof(tmp)); + util_strlcat(tmp, filename, sizeof(tmp)); + util_strlcpy(filename, tmp, sizeof(filename)); + } + + attr_subst_subdir(filename, sizeof(filename)); + + match = (stat(filename, &statbuf) == 0); + info(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + if (match && rule->test_mode_mask > 0) { + match = ((statbuf.st_mode & rule->test_mode_mask) > 0); + info(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + match ? "matches" : "does not match", + rule->test_mode_mask); + } + if (match && rule->test.operation == KEY_OP_NOMATCH) + goto nomatch; + if (!match && rule->test.operation == KEY_OP_MATCH) + goto nomatch; + dbg(event->udev, "TEST key is true\n"); + } + + if (rule->wait_for.operation != KEY_OP_UNSET) { + char filename[UTIL_PATH_SIZE]; + int found; + + util_strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); + udev_rules_apply_format(event, filename, sizeof(filename)); + found = (wait_for_file(event, filename, 10) == 0); + if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) + goto nomatch; + } + + /* check for matching sysfs attribute pairs */ + for (i = 0; i < rule->attr.count; i++) { + struct key_pair *pair = &rule->attr.keys[i]; + + if (pair->key.operation == KEY_OP_MATCH || + pair->key.operation == KEY_OP_NOMATCH) { + char attr[UTIL_PATH_SIZE]; + const char *key_name = key_pair_name(rule, pair); + const char *key_value = key_val(rule, &pair->key); + char *subsys; + char *sysname; + char *attrib; + char value[UTIL_NAME_SIZE] = ""; + size_t len; + + util_strlcpy(attr, key_name, sizeof(attr)); + if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { + struct udev_device *d; + const char *val; + + if (attrib == NULL) + goto nomatch; + d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); + if (d == NULL) + goto nomatch; + val = udev_device_get_attr_value(d, attrib); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + udev_device_unref(d); + } + + if (value[0]=='\0') { + const char *val; + + val = udev_device_get_attr_value(dev, key_name); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + } + + if (value[0]=='\0') + goto nomatch; + + /* strip trailing whitespace of value, if not asked to match for it */ + len = strlen(key_value); + if (len > 0 && !isspace(key_value[len-1])) { + len = strlen(value); + while (len > 0 && isspace(value[--len])) + value[len] = '\0'; + dbg(event->udev, "removed trailing whitespace from '%s'\n", value); + } + + if (match_key(event->udev, "ATTR", rule, &pair->key, value)) + goto nomatch; + } + } + + /* walk up the chain of parent devices and find a match */ + event->dev_parent = dev; + while (1) { + /* check for matching kernel device name */ + if (match_key(event->udev, "KERNELS", rule, + &rule->kernels, udev_device_get_sysname(event->dev_parent))) + goto try_parent; + + /* check for matching subsystem value */ + if (match_key(event->udev, "SUBSYSTEMS", rule, + &rule->subsystems, udev_device_get_subsystem(event->dev_parent))) + goto try_parent; + + /* check for matching driver */ + if (match_key(event->udev, "DRIVERS", rule, + &rule->drivers, udev_device_get_driver(event->dev_parent))) + goto try_parent; + + /* check for matching sysfs attribute pairs */ + for (i = 0; i < rule->attrs.count; i++) { + struct key_pair *pair = &rule->attrs.keys[i]; + + if (pair->key.operation == KEY_OP_MATCH || + pair->key.operation == KEY_OP_NOMATCH) { + const char *key_name = key_pair_name(rule, pair); + const char *key_value = key_val(rule, &pair->key); + const char *val; + char value[UTIL_NAME_SIZE]; + size_t len; + + val = udev_device_get_attr_value(event->dev_parent, key_name); + if (val == NULL) + val = udev_device_get_attr_value(dev, key_name); + if (val == NULL) + goto try_parent; + util_strlcpy(value, val, sizeof(value)); + + /* strip trailing whitespace of value, if not asked to match for it */ + len = strlen(key_value); + if (len > 0 && !isspace(key_value[len-1])) { + len = strlen(value); + while (len > 0 && isspace(value[--len])) + value[len] = '\0'; + dbg(event->udev, "removed trailing whitespace from '%s'\n", value); + } + + if (match_key(event->udev, "ATTRS", rule, &pair->key, value)) + goto try_parent; + } + } + + /* found matching device */ + break; +try_parent: + /* move to parent device */ + dbg(event->udev, "try parent sysfs device\n"); + event->dev_parent = udev_device_get_parent(event->dev_parent); + if (event->dev_parent == NULL) + goto nomatch; + dbg(event->udev, "looking at dev_parent->devpath='%s'\n", + udev_device_get_syspath(event->dev_parent)); + } + + /* execute external program */ + if (rule->program.operation != KEY_OP_UNSET) { + char program[UTIL_PATH_SIZE]; + char result[UTIL_PATH_SIZE]; + + util_strlcpy(program, key_val(rule, &rule->program), sizeof(program)); + udev_rules_apply_format(event, program, sizeof(program)); + if (run_program(event->dev, program, result, sizeof(result), NULL) != 0) { + dbg(event->udev, "PROGRAM is false\n"); + event->program_result[0] = '\0'; + if (rule->program.operation != KEY_OP_NOMATCH) + goto nomatch; + } else { + int count; + + dbg(event->udev, "PROGRAM matches\n"); + util_remove_trailing_chars(result, '\n'); + if (rule->string_escape == ESCAPE_UNSET || + rule->string_escape == ESCAPE_REPLACE) { + count = util_replace_chars(result, ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + } + dbg(event->udev, "result is '%s'\n", result); + util_strlcpy(event->program_result, result, sizeof(event->program_result)); + dbg(event->udev, "PROGRAM returned successful\n"); + if (rule->program.operation == KEY_OP_NOMATCH) + goto nomatch; + } + dbg(event->udev, "PROGRAM key is true\n"); + } + + /* check for matching result of external program */ + if (match_key(event->udev, "RESULT", rule, &rule->result, event->program_result)) + goto nomatch; + + /* import variables returned from program or or file into environment */ + if (rule->import.operation != KEY_OP_UNSET) { + char import[UTIL_PATH_SIZE]; + int rc = -1; + + util_strlcpy(import, key_val(rule, &rule->import), sizeof(import)); + udev_rules_apply_format(event, import, sizeof(import)); + dbg(event->udev, "check for IMPORT import='%s'\n", import); + if (rule->import_type == IMPORT_PROGRAM) { + rc = import_program_into_env(event, import); + } else if (rule->import_type == IMPORT_FILE) { + dbg(event->udev, "import file import='%s'\n", import); + rc = import_file_into_env(event, import); + } else if (rule->import_type == IMPORT_PARENT) { + dbg(event->udev, "import parent import='%s'\n", import); + rc = import_parent_into_env(event, import); + } + if (rc != 0) { + dbg(event->udev, "IMPORT failed\n"); + if (rule->import.operation != KEY_OP_NOMATCH) + goto nomatch; + } else + dbg(event->udev, "IMPORT '%s' imported\n", key_val(rule, &rule->import)); + dbg(event->udev, "IMPORT key is true\n"); + } + + /* rule matches, if we have ENV assignments export it */ + for (i = 0; i < rule->env.count; i++) { + struct key_pair *pair = &rule->env.keys[i]; + + if (pair->key.operation == KEY_OP_ASSIGN) { + char temp_value[UTIL_NAME_SIZE]; + const char *key_name = key_pair_name(rule, pair); + const char *value = key_val(rule, &pair->key); + + /* make sure we don't write to the same string we possibly read from */ + util_strlcpy(temp_value, value, sizeof(temp_value)); + udev_rules_apply_format(event, temp_value, sizeof(temp_value)); + + if (temp_value[0] != '\0') { + struct udev_list_entry *entry; + + info(event->udev, "set ENV '%s=%s'\n", key_name, temp_value); + entry = udev_device_add_property(dev, key_name, temp_value); + /* store in db */ + udev_list_entry_set_flag(entry, 1); + } + } + } + + /* if we have ATTR assignments, write value to sysfs file */ + for (i = 0; i < rule->attr.count; i++) { + struct key_pair *pair = &rule->attr.keys[i]; + + if (pair->key.operation == KEY_OP_ASSIGN) { + const char *key_name = key_pair_name(rule, pair); + char *subsys; + char *sysname; + char *attrib; + char attr[UTIL_PATH_SIZE]; + char value[UTIL_NAME_SIZE]; + FILE *f; + + util_strlcpy(attr, key_name, sizeof(attr)); + if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { + struct udev_device *d; + + d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); + if (d != NULL) { + util_strlcpy(attr, udev_device_get_syspath(d), sizeof(attr)); + if (attrib != NULL) { + util_strlcat(attr, "/", sizeof(attr)); + util_strlcat(attr, attrib, sizeof(attr)); + } + udev_device_unref(d); + } + } else { + util_strlcpy(attr, udev_device_get_syspath(dev), sizeof(attr)); + util_strlcat(attr, "/", sizeof(attr)); + util_strlcat(attr, key_name, sizeof(attr)); + } + + attr_subst_subdir(attr, sizeof(attr)); + + util_strlcpy(value, key_val(rule, &pair->key), sizeof(value)); + udev_rules_apply_format(event, value, sizeof(value)); + info(event->udev, "writing '%s' to sysfs file '%s'\n", value, attr); + f = fopen(attr, "w"); + if (f != NULL) { + if (!event->test) + if (fprintf(f, "%s", value) <= 0) + err(event->udev, "error writing ATTR{%s}: %m\n", attr); + fclose(f); + } else + err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); + } + } + return 0; + +nomatch: + return -1; +} + +int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) +{ + struct udev_device *dev = event->dev; + struct udev_rules_iter iter; + struct udev_rule *rule; + int name_set = 0; + + dbg(event->udev, "device: '%s'\n", udev_device_get_syspath(dev)); + + /* look for a matching rule to apply */ + udev_rules_iter_init(&iter, rules); + while (1) { + rule = udev_rules_iter_next(&iter); + if (rule == NULL) + break; + + if (name_set && + (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD)) { + dbg(event->udev, "node name already set, rule ignored\n"); + continue; + } + + dbg(event->udev, "process rule\n"); + if (match_rule(event, rule) == 0) { + /* apply options */ + if (rule->ignore_device) { + info(event->udev, "rule applied, '%s' is ignored\n", udev_device_get_sysname(dev)); + event->ignore_device = 1; + return 0; + } + if (rule->ignore_remove) { + udev_device_set_ignore_remove(dev, 1); + dbg(event->udev, "remove event should be ignored\n"); + } + if (rule->link_priority != 0) { + udev_device_set_devlink_priority(dev, rule->link_priority); + info(event->udev, "devlink_priority=%i\n", rule->link_priority); + } + if (rule->event_timeout >= 0) { + udev_device_set_event_timeout(dev, rule->event_timeout); + info(event->udev, "event_timeout=%i\n", rule->event_timeout); + } + /* apply all_partitions option only at a disk device */ + if (rule->partitions > 0 && + strcmp(udev_device_get_subsystem(dev), "block") == 0 && + udev_device_get_sysnum(dev) == NULL) { + udev_device_set_num_fake_partitions(dev, rule->partitions); + dbg(event->udev, "creation of partition nodes requested\n"); + } + + /* apply permissions */ + if (!event->mode_final && rule->mode.operation != KEY_OP_UNSET) { + if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) + event->mode_final = 1; + char buf[20]; + util_strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); + udev_rules_apply_format(event, buf, sizeof(buf)); + event->mode = strtol(buf, NULL, 8); + dbg(event->udev, "applied mode=%#o to '%s'\n", + event->mode, udev_device_get_sysname(dev)); + } + if (!event->owner_final && rule->owner.operation != KEY_OP_UNSET) { + if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) + event->owner_final = 1; + util_strlcpy(event->owner, key_val(rule, &rule->owner), sizeof(event->owner)); + udev_rules_apply_format(event, event->owner, sizeof(event->owner)); + dbg(event->udev, "applied owner='%s' to '%s'\n", + event->owner, udev_device_get_sysname(dev)); + } + if (!event->group_final && rule->group.operation != KEY_OP_UNSET) { + if (rule->group.operation == KEY_OP_ASSIGN_FINAL) + event->group_final = 1; + util_strlcpy(event->group, key_val(rule, &rule->group), sizeof(event->group)); + udev_rules_apply_format(event, event->group, sizeof(event->group)); + dbg(event->udev, "applied group='%s' to '%s'\n", + event->group, udev_device_get_sysname(dev)); + } + + /* collect symlinks */ + if (!event->devlink_final && + (rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL || + rule->symlink.operation == KEY_OP_ADD)) { + char temp[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char *pos, *next; + int count = 0; + + if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) + event->devlink_final = 1; + if (rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { + info(event->udev, "reset symlink list\n"); + udev_device_cleanup_devlinks_list(dev); + } + /* allow multiple symlinks separated by spaces */ + util_strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); + udev_rules_apply_format(event, temp, sizeof(temp)); + if (rule->string_escape == ESCAPE_UNSET) + count = util_replace_chars(temp, ALLOWED_CHARS_FILE " "); + else if (rule->string_escape == ESCAPE_REPLACE) + count = util_replace_chars(temp, ALLOWED_CHARS_FILE); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); + pos = temp; + while (isspace(pos[0])) + pos++; + next = strchr(pos, ' '); + while (next) { + next[0] = '\0'; + info(event->udev, "add symlink '%s'\n", pos); + util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, pos, sizeof(filename)); + udev_device_add_devlink(dev, filename); + while (isspace(next[1])) + next++; + pos = &next[1]; + next = strchr(pos, ' '); + } + if (pos[0] != '\0') { + info(event->udev, "add symlink '%s'\n", pos); + util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, pos, sizeof(filename)); + udev_device_add_devlink(dev, filename); + } + } + + /* set name, later rules with name set will be ignored */ + if (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD) { + int count; + + name_set = 1; + util_strlcpy(event->name, key_val(rule, &rule->name), sizeof(event->name)); + udev_rules_apply_format(event, event->name, sizeof(event->name)); + if (rule->string_escape == ESCAPE_UNSET || + rule->string_escape == ESCAPE_REPLACE) { + count = util_replace_chars(event->name, ALLOWED_CHARS_FILE); + if (count > 0) + info(event->udev, "%i character(s) replaced\n", count); + } + + info(event->udev, "rule applied, '%s' becomes '%s'\n", + udev_device_get_sysname(dev), event->name); + if (strcmp(udev_device_get_subsystem(dev), "net") != 0) + dbg(event->udev, "'%s' owner='%s', group='%s', mode=%#o partitions=%i\n", + event->name, event->owner, event->group, event->mode, + udev_device_get_num_fake_partitions(dev)); + } + + if (!event->run_final && rule->run.operation != KEY_OP_UNSET) { + struct udev_list_entry *list_entry; + + if (rule->run.operation == KEY_OP_ASSIGN_FINAL) + event->run_final = 1; + if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { + info(event->udev, "reset run list\n"); + udev_list_cleanup(event->udev, &event->run_list); + } + dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); + list_entry = udev_list_entry_add(event->udev, &event->run_list, + key_val(rule, &rule->run), NULL, 1, 0); + if (rule->run_ignore_error && list_entry != NULL) + udev_list_entry_set_flag(list_entry, 1); + } + + if (rule->last_rule) { + dbg(event->udev, "last rule to be applied\n"); + break; + } + + if (rule->goto_label.operation != KEY_OP_UNSET) { + dbg(event->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); + udev_rules_iter_goto(&iter, rule->goto_rule_off); + } + } + } + + if (!name_set) { + info(event->udev, "no node name set, will use kernel name '%s'\n", + udev_device_get_sysname(dev)); + util_strlcpy(event->name, udev_device_get_sysname(dev), sizeof(event->name)); + } + + if (event->tmp_node[0] != '\0') { + dbg(event->udev, "removing temporary device node\n"); + unlink_secure(event->udev, event->tmp_node); + event->tmp_node[0] = '\0'; + } + return 0; +} + +int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event) +{ + struct udev_device *dev = event->dev; + struct udev_rules_iter iter; + struct udev_rule *rule; + + dbg(event->udev, "sysname: '%s'\n", udev_device_get_sysname(dev)); + + /* look for a matching rule to apply */ + udev_rules_iter_init(&iter, rules); + while (1) { + rule = udev_rules_iter_next(&iter); + if (rule == NULL) + break; + + dbg(event->udev, "process rule\n"); + if (rule->name.operation == KEY_OP_ASSIGN || + rule->name.operation == KEY_OP_ASSIGN_FINAL || + rule->name.operation == KEY_OP_ADD || + rule->symlink.operation == KEY_OP_ASSIGN || + rule->symlink.operation == KEY_OP_ASSIGN_FINAL || + rule->symlink.operation == KEY_OP_ADD || + rule->mode.operation != KEY_OP_UNSET || + rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { + dbg(event->udev, "skip rule that names a device\n"); + continue; + } + + if (match_rule(event, rule) == 0) { + if (rule->ignore_device) { + info(event->udev, "rule applied, '%s' is ignored\n", udev_device_get_sysname(dev)); + event->ignore_device = 1; + return 0; + } + if (rule->ignore_remove) { + udev_device_set_ignore_remove(dev, 1); + dbg(event->udev, "remove event should be ignored\n"); + } + + if (!event->run_final && rule->run.operation != KEY_OP_UNSET) { + struct udev_list_entry *list_entry; + + if (rule->run.operation == KEY_OP_ASSIGN || + rule->run.operation == KEY_OP_ASSIGN_FINAL) { + info(event->udev, "reset run list\n"); + udev_list_cleanup(event->udev, &event->run_list); + } + dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); + list_entry = udev_list_entry_add(event->udev, &event->run_list, + key_val(rule, &rule->run), NULL, 1, 0); + if (rule->run_ignore_error && list_entry != NULL) + udev_list_entry_set_flag(list_entry, 1); + if (rule->run.operation == KEY_OP_ASSIGN_FINAL) + break; + } + + if (rule->last_rule) { + dbg(event->udev, "last rule to be applied\n"); + break; + } + + if (rule->goto_label.operation != KEY_OP_UNSET) { + dbg(event->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); + udev_rules_iter_goto(&iter, rule->goto_rule_off); + } + } + } + + return 0; +} diff --git a/udev/udev-rules.h b/udev/udev-rules.h new file mode 100644 index 0000000000..d8f2f367c9 --- /dev/null +++ b/udev/udev-rules.h @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef UDEV_RULES_H +#define UDEV_RULES_H + +#include "udev.h" + +#define PAIRS_MAX 5 + +enum key_operation { + KEY_OP_UNSET, + KEY_OP_MATCH, + KEY_OP_NOMATCH, + KEY_OP_ADD, + KEY_OP_ASSIGN, + KEY_OP_ASSIGN_FINAL, +}; + +struct key { + enum key_operation operation; + size_t val_off; +}; + +struct key_pair { + struct key key; + size_t key_name_off; +}; + +struct key_pairs { + int count; + struct key_pair keys[PAIRS_MAX]; +}; + +enum import_type { + IMPORT_UNSET, + IMPORT_PROGRAM, + IMPORT_FILE, + IMPORT_PARENT, +}; + +enum escape_type { + ESCAPE_UNSET, + ESCAPE_NONE, + ESCAPE_REPLACE, +}; + +struct udev_rule { + struct key action; + struct key devpath; + struct key kernel; + struct key subsystem; + struct key driver; + struct key_pairs attr; + + struct key kernels; + struct key subsystems; + struct key drivers; + struct key_pairs attrs; + + struct key_pairs env; + struct key program; + struct key result; + struct key import; + enum import_type import_type; + struct key test; + mode_t test_mode_mask; + struct key run; + struct key wait_for; + struct key label; + struct key goto_label; + size_t goto_rule_off; + + struct key name; + struct key symlink; + struct key symlink_match; + struct key owner; + struct key group; + struct key mode; + enum escape_type string_escape; + + unsigned int link_priority; + int event_timeout; + unsigned int partitions; + unsigned int last_rule:1, + run_ignore_error:1, + ignore_device:1, + ignore_remove:1; + + size_t bufsize; + char buf[]; +}; + +struct udev_rules { + struct udev *udev; + char *buf; + size_t bufsize; + int resolve_names; +}; + +struct udev_rules_iter { + struct udev_rules *rules; + size_t current; +}; + +extern int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names); +extern void udev_rules_cleanup(struct udev_rules *rules); + +extern void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules); +extern struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter); +extern struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off); + +extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event); +extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event); +extern int udev_rules_run(struct udev_event *event); + +extern void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize); + +#endif diff --git a/udev/udev-selinux.c b/udev/udev-selinux.c new file mode 100644 index 0000000000..cf7f43496a --- /dev/null +++ b/udev/udev-selinux.c @@ -0,0 +1,90 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int selinux_enabled; +security_context_t selinux_prev_scontext; + +void selinux_init(struct udev *udev) +{ + /* record the present security context */ + selinux_enabled = (is_selinux_enabled() > 0); + info(udev, "selinux=%i\n", selinux_enabled); + if (!selinux_enabled) + return; + matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); + if (getfscreatecon(&selinux_prev_scontext) < 0) { + err(udev, "getfscreatecon failed\n"); + selinux_prev_scontext = NULL; + } +} + +void selinux_exit(struct udev *udev) +{ + if (!selinux_enabled) + return; + freecon(selinux_prev_scontext); + selinux_prev_scontext = NULL; +} + +void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) +{ + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (lsetfilecon(file, scontext) < 0) + err(udev, "setfilecon %s failed: %m\n", file); + freecon(scontext); +} + +void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) +{ + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (setfscreatecon(scontext) < 0) + err(udev, "setfscreatecon %s failed: %m\n", file); + freecon(scontext); +} + +void udev_selinux_resetfscreatecon(struct udev *udev) +{ + if (!selinux_enabled) + return; + if (setfscreatecon(selinux_prev_scontext) < 0) + err(udev, "setfscreatecon failed: %m\n"); +} diff --git a/udev/udev-sysdeps.h b/udev/udev-sysdeps.h new file mode 100644 index 0000000000..eaeab86f6b --- /dev/null +++ b/udev/udev-sysdeps.h @@ -0,0 +1,50 @@ +/* + * wrapping of libc features and kernel interfaces + * + * Copyright (C) 2005-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef _UDEV_SYSDEPS_H_ +#define _UDEV_SYSDEPS_H_ + +#include + +/* needed for our signal handlers to work */ +#undef asmlinkage +#ifdef __i386__ +#define asmlinkage __attribute__((regparm(0))) +#else +#define asmlinkage +#endif /* __i386__ */ + +#ifndef HAVE_INOTIFY +static inline int inotify_init(void) +{ + return -1; +} + +static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) +{ + return -1; +} + +#define IN_CREATE 0 +#define IN_DELETE 0 +#define IN_MOVE 0 +#define IN_CLOSE_WRITE 0 + +#endif /* HAVE_INOTIFY */ +#endif diff --git a/udev/udev-util-file.c b/udev/udev-util-file.c new file mode 100644 index 0000000000..84ff09e050 --- /dev/null +++ b/udev/udev-util-file.c @@ -0,0 +1,176 @@ +/* + * Copyright (C) 2004-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +int create_path(struct udev *udev, const char *path) +{ + char p[UTIL_PATH_SIZE]; + char *pos; + struct stat stats; + int ret; + + util_strlcpy(p, path, sizeof(p)); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (pos[-1] == '/') + pos--; + pos[0] = '\0'; + + dbg(udev, "stat '%s'\n", p); + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + + if (create_path(udev, p) != 0) + return -1; + + dbg(udev, "mkdir '%s'\n", p); + udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); + ret = mkdir(p, 0755); + udev_selinux_resetfscreatecon(udev); + if (ret == 0) + return 0; + + if (errno == EEXIST) + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + return -1; +} + +int delete_path(struct udev *udev, const char *path) +{ + char p[UTIL_PATH_SIZE]; + char *pos; + int retval; + + strcpy (p, path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (1) { + *pos = '\0'; + pos = strrchr(p, '/'); + + /* don't remove the last one */ + if ((pos == p) || (pos == NULL)) + break; + + /* remove if empty */ + retval = rmdir(p); + if (errno == ENOENT) + retval = 0; + if (retval) { + if (errno == ENOTEMPTY) + return 0; + err(udev, "rmdir(%s) failed: %m\n", p); + break; + } + dbg(udev, "removed '%s'\n", p); + } + return 0; +} + +/* Reset permissions on the device node, before unlinking it to make sure, + * that permisions of possible hard links will be removed too. + */ +int unlink_secure(struct udev *udev, const char *filename) +{ + int retval; + + retval = chown(filename, 0, 0); + if (retval) + err(udev, "chown(%s, 0, 0) failed: %m\n", filename); + + retval = chmod(filename, 0000); + if (retval) + err(udev, "chmod(%s, 0000) failed: %m\n", filename); + + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; + + if (retval) + err(udev, "unlink(%s) failed: %m\n", filename); + + return retval; +} + +int file_map(const char *filename, char **buf, size_t *bufsize) +{ + struct stat stats; + int fd; + + fd = open(filename, O_RDONLY); + if (fd < 0) { + return -1; + } + + if (fstat(fd, &stats) < 0) { + close(fd); + return -1; + } + + *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); + if (*buf == MAP_FAILED) { + close(fd); + return -1; + } + *bufsize = stats.st_size; + + close(fd); + + return 0; +} + +void file_unmap(void *buf, size_t bufsize) +{ + munmap(buf, bufsize); +} + +/* return number of chars until the next newline, skip escaped newline */ +size_t buf_get_line(const char *buf, size_t buflen, size_t cur) +{ + int escape = 0; + size_t count; + + for (count = cur; count < buflen; count++) { + if (!escape && buf[count] == '\n') + break; + + if (buf[count] == '\\') + escape = 1; + else + escape = 0; + } + + return count - cur; +} diff --git a/udev/udev-util.c b/udev/udev-util.c new file mode 100644 index 0000000000..4623c30caf --- /dev/null +++ b/udev/udev-util.c @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2004-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +struct name_entry *name_list_add(struct udev *udev, struct list_head *name_list, const char *name, int sort) +{ + struct name_entry *name_loop; + struct name_entry *name_new; + + /* avoid duplicate entries */ + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) == 0) { + dbg(udev, "'%s' is already in the list\n", name); + return name_loop; + } + } + + if (sort) + list_for_each_entry(name_loop, name_list, node) { + if (strcmp(name_loop->name, name) > 0) + break; + } + + name_new = malloc(sizeof(struct name_entry)); + if (name_new == NULL) + return NULL; + memset(name_new, 0x00, sizeof(struct name_entry)); + util_strlcpy(name_new->name, name, sizeof(name_new->name)); + dbg(udev, "adding '%s'\n", name_new->name); + list_add_tail(&name_new->node, &name_loop->node); + + return name_new; +} + +struct name_entry *name_list_key_add(struct udev *udev, struct list_head *name_list, const char *key, const char *value) +{ + struct name_entry *name_loop; + struct name_entry *name_new; + size_t keylen = strlen(key); + + list_for_each_entry(name_loop, name_list, node) { + if (strncmp(name_loop->name, key, keylen) != 0) + continue; + if (name_loop->name[keylen] != '=') + continue; + dbg(udev, "key already present '%s', replace it\n", name_loop->name); + snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); + name_loop->name[sizeof(name_loop->name)-1] = '\0'; + return name_loop; + } + + name_new = malloc(sizeof(struct name_entry)); + if (name_new == NULL) + return NULL; + memset(name_new, 0x00, sizeof(struct name_entry)); + snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); + name_new->name[sizeof(name_new->name)-1] = '\0'; + dbg(udev, "adding '%s'\n", name_new->name); + list_add_tail(&name_new->node, &name_loop->node); + + return name_new; +} + +int name_list_key_remove(struct udev *udev, struct list_head *name_list, const char *key) +{ + struct name_entry *name_loop; + struct name_entry *name_tmp; + size_t keylen = strlen(key); + int retval = 0; + + list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { + if (strncmp(name_loop->name, key, keylen) != 0) + continue; + if (name_loop->name[keylen] != '=') + continue; + list_del(&name_loop->node); + free(name_loop); + retval = 1; + break; + } + return retval; +} + +void name_list_cleanup(struct udev *udev, struct list_head *name_list) +{ + struct name_entry *name_loop; + struct name_entry *name_tmp; + + list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { + list_del(&name_loop->node); + free(name_loop); + } +} + +/* calls function for every file found in specified directory */ +int add_matching_files(struct udev *udev, struct list_head *name_list, const char *dirname, const char *suffix) +{ + struct dirent *ent; + DIR *dir; + char filename[UTIL_PATH_SIZE]; + + dbg(udev, "open directory '%s'\n", dirname); + dir = opendir(dirname); + if (dir == NULL) { + err(udev, "unable to open '%s': %m\n", dirname); + return -1; + } + + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + + if ((ent->d_name[0] == '.') || (ent->d_name[0] == '#')) + continue; + + /* look for file matching with specified suffix */ + if (suffix != NULL) { + const char *ext; + + ext = strrchr(ent->d_name, '.'); + if (ext == NULL) + continue; + if (strcmp(ext, suffix) != 0) + continue; + } + dbg(udev, "put file '%s/%s' into list\n", dirname, ent->d_name); + + snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); + filename[sizeof(filename)-1] = '\0'; + name_list_add(udev, name_list, filename, 1); + } + + closedir(dir); + return 0; +} + +uid_t lookup_user(struct udev *udev, const char *user) +{ + struct passwd *pw; + uid_t uid = 0; + + errno = 0; + pw = getpwnam(user); + if (pw == NULL) { + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err(udev, "specified user '%s' unknown\n", user); + else + err(udev, "error resolving user '%s': %m\n", user); + } else + uid = pw->pw_uid; + + return uid; +} + +extern gid_t lookup_group(struct udev *udev, const char *group) +{ + struct group *gr; + gid_t gid = 0; + + errno = 0; + gr = getgrnam(group); + if (gr == NULL) { + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err(udev, "specified group '%s' unknown\n", group); + else + err(udev, "error resolving group '%s': %m\n", group); + } else + gid = gr->gr_gid; + + return gid; +} + diff --git a/udev/udev.h b/udev/udev.h index e486df3656..d789d443ac 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -22,7 +22,7 @@ #include #include -#include "udev_sysdeps.h" +#include "udev-sysdeps.h" #include "lib/libudev.h" #include "lib/libudev-private.h" #include "list.h" diff --git a/udev/udev_device_event.c b/udev/udev_device_event.c deleted file mode 100644 index e5d716085a..0000000000 --- a/udev/udev_device_event.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" - -struct udev_event *udev_event_new(struct udev_device *dev) -{ - struct udev_event *event; - - event = malloc(sizeof(struct udev_event)); - if (event == NULL) - return NULL; - memset(event, 0x00, sizeof(struct udev_event)); - - event->dev = dev; - event->udev = udev_device_get_udev(dev); - udev_list_init(&event->run_list); - event->mode = 0660; - util_strlcpy(event->owner, "0", sizeof(event->owner)); - util_strlcpy(event->group, "0", sizeof(event->group)); - - dbg(event->udev, "allocated event %p\n", event); - return event; -} - -void udev_event_unref(struct udev_event *event) -{ - udev_list_cleanup(event->udev, &event->run_list); - dbg(event->udev, "free event %p\n", event); - free(event); -} - -static void kernel_log(struct ifreq ifr) -{ - int klog; - FILE *f; - - klog = open("/dev/kmsg", O_WRONLY); - if (klog < 0) - return; - - f = fdopen(klog, "w"); - if (f == NULL) { - close(klog); - return; - } - - fprintf(f, "<6>udev: renamed network interface %s to %s\n", - ifr.ifr_name, ifr.ifr_newname); - fclose(f); -} - -static int rename_netif(struct udev_event *event) -{ - struct udev_device *dev = event->dev; - int sk; - struct ifreq ifr; - int err; - - info(event->udev, "changing net interface name from '%s' to '%s'\n", - udev_device_get_sysname(dev), event->name); - if (event->test) - return 0; - - sk = socket(PF_INET, SOCK_DGRAM, 0); - if (sk < 0) { - err(event->udev, "error opening socket: %m\n"); - return -1; - } - - memset(&ifr, 0x00, sizeof(struct ifreq)); - util_strlcpy(ifr.ifr_name, udev_device_get_sysname(dev), IFNAMSIZ); - util_strlcpy(ifr.ifr_newname, event->name, IFNAMSIZ); - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err == 0) - kernel_log(ifr); - else { - int loop; - - /* see if the destination interface name already exists */ - if (errno != EEXIST) { - err(event->udev, "error changing netif name %s to %s: %m\n", - ifr.ifr_name, ifr.ifr_newname); - goto exit; - } - - /* free our own name, another process may wait for us */ - util_strlcpy(ifr.ifr_newname, udev_device_get_sysname(dev), IFNAMSIZ); - util_strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err != 0) { - err(event->udev, "error changing netif name %s to %s: %m\n", - ifr.ifr_name, ifr.ifr_newname); - goto exit; - } - - /* wait 30 seconds for our target to become available */ - util_strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); - util_strlcpy(ifr.ifr_newname, udev_device_get_devnode(dev), IFNAMSIZ); - loop = 30 * 20; - while (loop--) { - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err == 0) { - kernel_log(ifr); - break; - } - - if (errno != EEXIST) { - err(event->udev, "error changing net interface name %s to %s: %m\n", - ifr.ifr_name, ifr.ifr_newname); - break; - } - dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", - udev_device_get_devnode(dev), (30 * 20) - loop); - usleep(1000 * 1000 / 20); - } - } - -exit: - close(sk); - return err; -} - -int udev_event_run(struct udev_event *event, struct udev_rules *rules) -{ - struct udev_device *dev = event->dev; - int err = 0; - - if (udev_device_get_devpath_old(dev) != NULL) { - if (udev_device_rename_db(dev, udev_device_get_devpath(dev)) == 0) - info(event->udev, "moved database from '%s' to '%s'\n", - udev_device_get_devpath_old(dev), udev_device_get_devpath(dev)); - } - - /* add device node */ - if (major(udev_device_get_devnum(dev)) != 0 && - (strcmp(udev_device_get_action(dev), "add") == 0 || strcmp(udev_device_get_action(dev), "change") == 0)) { - char filename[UTIL_PATH_SIZE]; - struct udev_device *dev_old; - - dbg(event->udev, "device node add '%s'\n", udev_device_get_devpath(dev)); - - udev_rules_get_name(rules, event); - if (event->ignore_device) { - info(event->udev, "device event will be ignored\n"); - goto exit; - } - - if (event->name[0] == '\0') { - info(event->udev, "device node creation supressed\n"); - goto exit; - } - - /* set device node name */ - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, event->name, sizeof(filename)); - udev_device_set_devnode(dev, filename); - - /* read current database entry; cleanup, if it is known device */ - dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); - if (dev_old != NULL) { - info(event->udev, "device '%s' already in database, updating\n", - udev_device_get_devpath(dev)); - udev_node_update_old_links(dev, dev_old, event->test); - udev_device_unref(dev_old); - } - - udev_device_update_db(dev); - - err = udev_node_add(dev, event->mode, event->owner, event->group, event->test); - if (err != 0) - goto exit; - - goto exit; - } - - /* add netif */ - if (strcmp(udev_device_get_subsystem(dev), "net") == 0 && strcmp(udev_device_get_action(dev), "add") == 0) { - dbg(event->udev, "netif add '%s'\n", udev_device_get_devpath(dev)); - - udev_rules_get_name(rules, event); - if (event->ignore_device) { - info(event->udev, "device event will be ignored\n"); - goto exit; - } - if (event->name[0] == '\0') { - info(event->udev, "device renaming supressed\n"); - goto exit; - } - - /* look if we want to change the name of the netif */ - if (strcmp(event->name, udev_device_get_sysname(dev)) != 0) { - char syspath[UTIL_PATH_SIZE]; - char *pos; - - err = rename_netif(event); - if (err != 0) - goto exit; - info(event->udev, "renamed netif to '%s'\n", event->name); - - /* remember old name */ - udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); - - /* now change the devpath, because the kernel device name has changed */ - util_strlcpy(syspath, udev_device_get_syspath(dev), sizeof(syspath)); - pos = strrchr(syspath, '/'); - if (pos != NULL) { - pos[1] = '\0'; - util_strlcat(syspath, event->name, sizeof(syspath)); - udev_device_set_syspath(event->dev, syspath); - udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); - info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); - } - } - goto exit; - } - - /* remove device node */ - if (major(udev_device_get_devnum(dev)) != 0 && strcmp(udev_device_get_action(dev), "remove") == 0) { - /* import database entry and delete it */ - udev_device_read_db(dev); - if (!event->test) - udev_device_delete_db(dev); - - if (udev_device_get_devnode(dev) == NULL) { - char devnode[UTIL_PATH_SIZE]; - - info(event->udev, "'%s' not found in database, using kernel name '%s'\n", - udev_device_get_syspath(dev), udev_device_get_sysname(dev)); - util_strlcpy(devnode, udev_get_dev_path(event->udev), sizeof(devnode)); - util_strlcat(devnode, "/", sizeof(devnode)); - util_strlcat(devnode, udev_device_get_sysname(dev), sizeof(devnode)); - udev_device_set_devnode(dev, devnode); - } - - udev_rules_get_run(rules, event); - if (event->ignore_device) { - info(event->udev, "device event will be ignored\n"); - goto exit; - } - - if (udev_device_get_ignore_remove(dev)) { - info(event->udev, "ignore_remove for '%s'\n", udev_device_get_devnode(dev)); - goto exit; - } - - err = udev_node_remove(dev, event->test); - goto exit; - } - - /* default devices */ - udev_rules_get_run(rules, event); - if (event->ignore_device) - info(event->udev, "device event will be ignored\n"); -exit: - return err; -} diff --git a/udev/udev_node.c b/udev/udev_node.c deleted file mode 100644 index 425764242a..0000000000 --- a/udev/udev_node.c +++ /dev/null @@ -1,525 +0,0 @@ -/* - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" - -#define TMP_FILE_EXT ".udev-tmp" - -/* reverse mapping from the device file name to the devpath */ -static int name_index(struct udev *udev, const char *devpath, const char *name, int add, int test) -{ - char device[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE * 2]; - size_t devlen = strlen(udev_get_dev_path(udev))+1; - size_t start; - int fd; - - /* directory with device name */ - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - start = util_strlcat(filename, "/.udev/names/", sizeof(filename)); - util_strlcat(filename, &name[devlen], sizeof(filename)); - util_path_encode(&filename[start], sizeof(filename) - start); - /* entry with the devpath */ - util_strlcpy(device, devpath, sizeof(device)); - util_path_encode(device, sizeof(device)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, device, sizeof(filename)); - - if (add) { - info(udev, "creating index: '%s'\n", filename); - create_path(udev, filename); - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd > 0) - close(fd); - } else { - info(udev, "removing index: '%s'\n", filename); - unlink(filename); - delete_path(udev, filename); - } - return 0; -} - -int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid) -{ - struct udev *udev = udev_device_get_udev(dev); - char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; - struct stat stats; - int preserve = 0; - int err = 0; - - if (major(devnum) == 0) - devnum = udev_device_get_devnum(dev); - - if (strcmp(udev_device_get_subsystem(dev), "block") == 0) - mode |= S_IFBLK; - else - mode |= S_IFCHR; - - if (file == NULL) - file = udev_device_get_devnode(dev); - - if (lstat(file, &stats) == 0) { - if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) { - info(udev, "preserve file '%s', because it has correct dev_t\n", file); - preserve = 1; - udev_selinux_lsetfilecon(udev, file, mode); - } else { - info(udev, "atomically replace existing file '%s'\n", file); - util_strlcpy(file_tmp, file, sizeof(file_tmp)); - util_strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); - unlink(file_tmp); - udev_selinux_setfscreatecon(udev, file_tmp, mode); - err = mknod(file_tmp, mode, devnum); - udev_selinux_resetfscreatecon(udev); - if (err != 0) { - err(udev, "mknod(%s, %#o, %u, %u) failed: %m\n", - file_tmp, mode, major(devnum), minor(devnum)); - goto exit; - } - err = rename(file_tmp, file); - if (err != 0) { - err(udev, "rename(%s, %s) failed: %m\n", file_tmp, file); - unlink(file_tmp); - } - } - } else { - info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); - udev_selinux_setfscreatecon(udev, file, mode); - err = mknod(file, mode, devnum); - udev_selinux_resetfscreatecon(udev); - if (err != 0) { - err(udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", file, mode, major(devnum), minor(devnum)); - goto exit; - } - } - - if (!preserve || stats.st_mode != mode) { - info(udev, "chmod(%s, %#o)\n", file, mode); - err = chmod(file, mode); - if (err != 0) { - err(udev, "chmod(%s, %#o) failed: %m\n", file, mode); - goto exit; - } - } - - if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { - info(udev, "chown(%s, %u, %u)\n", file, uid, gid); - err = chown(file, uid, gid); - if (err != 0) { - err(udev, "chown(%s, %u, %u) failed: %m\n", file, uid, gid); - goto exit; - } - } -exit: - return err; -} - -static int node_symlink(struct udev *udev, const char *node, const char *slink) -{ - struct stat stats; - char target[UTIL_PATH_SIZE] = ""; - char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; - int i = 0; - int tail = 0; - int len; - int err = 0; - - /* use relative link */ - while (node[i] && (node[i] == slink[i])) { - if (node[i] == '/') - tail = i+1; - i++; - } - while (slink[i] != '\0') { - if (slink[i] == '/') - util_strlcat(target, "../", sizeof(target)); - i++; - } - util_strlcat(target, &node[tail], sizeof(target)); - - /* preserve link with correct target, do not replace node of other device */ - if (lstat(slink, &stats) == 0) { - if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { - struct stat stats2; - - info(udev, "found existing node instead of symlink '%s'\n", slink); - if (lstat(node, &stats2) == 0) { - if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && - stats.st_rdev == stats2.st_rdev) { - info(udev, "replace device node '%s' with symlink to our node '%s'\n", - slink, node); - } else { - err(udev, "device node '%s' already exists, " - "link to '%s' will not overwrite it\n", - slink, node); - goto exit; - } - } - } else if (S_ISLNK(stats.st_mode)) { - char buf[UTIL_PATH_SIZE]; - - info(udev, "found existing symlink '%s'\n", slink); - len = readlink(slink, buf, sizeof(buf)); - if (len > 0) { - buf[len] = '\0'; - if (strcmp(target, buf) == 0) { - info(udev, "preserve already existing symlink '%s' to '%s'\n", - slink, target); - udev_selinux_lsetfilecon(udev, slink, S_IFLNK); - goto exit; - } - } - } - } else { - info(udev, "creating symlink '%s' to '%s'\n", slink, target); - udev_selinux_setfscreatecon(udev, slink, S_IFLNK); - err = symlink(target, slink); - udev_selinux_resetfscreatecon(udev); - if (err == 0) - goto exit; - } - - info(udev, "atomically replace '%s'\n", slink); - util_strlcpy(slink_tmp, slink, sizeof(slink_tmp)); - util_strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); - unlink(slink_tmp); - udev_selinux_setfscreatecon(udev, slink, S_IFLNK); - err = symlink(target, slink_tmp); - udev_selinux_resetfscreatecon(udev); - if (err != 0) { - err(udev, "symlink(%s, %s) failed: %m\n", target, slink_tmp); - goto exit; - } - err = rename(slink_tmp, slink); - if (err != 0) { - err(udev, "rename(%s, %s) failed: %m\n", slink_tmp, slink); - unlink(slink_tmp); - goto exit; - } -exit: - return err; -} - -static int get_devices_by_name(struct udev *udev, const char *name, struct list_head *name_list) -{ - char dirname[PATH_MAX]; - size_t devlen = strlen(udev_get_dev_path(udev))+1; - size_t start; - DIR *dir; - int count = 0; - - util_strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); - start = util_strlcat(dirname, "/.udev/names/", sizeof(dirname)); - util_strlcat(dirname, &name[devlen], sizeof(dirname)); - util_path_encode(&dirname[start], sizeof(dirname) - start); - - dir = opendir(dirname); - if (dir == NULL) { - info(udev, "no index directory '%s': %m\n", dirname); - count = -1; - goto out; - } - - info(udev, "found index directory '%s'\n", dirname); - while (1) { - struct dirent *ent; - char device[UTIL_PATH_SIZE]; - - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - if (ent->d_name[0] == '.') - continue; - - util_strlcpy(device, udev_get_sys_path(udev), sizeof(device)); - util_strlcat(device, ent->d_name, sizeof(device)); - util_path_decode(device); - name_list_add(udev, name_list, device, 0); - count++; - } - closedir(dir); -out: - return count; -} - -static int update_link(struct udev_device *dev, const char *slink, int test) -{ - struct udev *udev = udev_device_get_udev(dev); - LIST_HEAD(name_list); - struct name_entry *device; - char target[UTIL_PATH_SIZE] = ""; - int count; - int priority = 0; - int rc = 0; - - info(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); - - count = get_devices_by_name(udev, slink, &name_list); - info(udev, "found %i devices with name '%s'\n", count, slink); - - /* if we don't have a reference, delete it */ - if (count <= 0) { - info(udev, "no reference left, remove '%s'\n", slink); - if (!test) { - unlink(slink); - delete_path(udev, slink); - } - goto out; - } - - /* find the device with the highest priority */ - list_for_each_entry(device, &name_list, node) { - struct udev_device *dev_db; - const char *devnode; - - info(udev, "found '%s' for '%s'\n", device->name, slink); - - /* did we find ourself? we win, if we have the same priority */ - if (strcmp(udev_device_get_syspath(dev), device->name) == 0) { - info(udev, "compare (our own) priority of '%s' %i >= %i\n", - udev_device_get_devpath(dev), udev_device_get_devlink_priority(dev), priority); - if (strcmp(udev_device_get_devnode(dev), slink) == 0) { - info(udev, "'%s' is our device node, database inconsistent, skip link update\n", - udev_device_get_devnode(dev)); - } else if (target[0] == '\0' || udev_device_get_devlink_priority(dev) >= priority) { - priority = udev_device_get_devlink_priority(dev); - util_strlcpy(target, udev_device_get_devnode(dev), sizeof(target)); - } - continue; - } - - /* another device, read priority from database */ - dev_db = udev_device_new_from_syspath(udev, device->name); - if (dev_db == NULL) - continue; - devnode = udev_device_get_devnode(dev_db); - if (devnode != NULL) { - if (strcmp(devnode, slink) == 0) { - info(udev, "'%s' is a device node of '%s', skip link update\n", - devnode, device->name); - } else { - info(udev, "compare priority of '%s' %i > %i\n", - udev_device_get_devpath(dev_db), - udev_device_get_devlink_priority(dev_db), - priority); - if (target[0] == '\0' || udev_device_get_devlink_priority(dev_db) > priority) { - priority = udev_device_get_devlink_priority(dev_db); - util_strlcpy(target, devnode, sizeof(target)); - } - } - } - udev_device_unref(dev_db); - } - name_list_cleanup(udev, &name_list); - - if (target[0] == '\0') { - info(udev, "no current target for '%s' found\n", slink); - rc = 1; - goto out; - } - - /* create symlink to the target with the highest priority */ - info(udev, "'%s' with target '%s' has the highest priority %i, create it\n", slink, target, priority); - if (!test) { - create_path(udev, slink); - node_symlink(udev, target, slink); - } -out: - return rc; -} - -void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test) -{ - struct udev *udev = udev_device_get_udev(dev); - struct udev_list_entry *list_entry; - const char *devnode_old; - - /* update possible left-over symlinks */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { - struct udev_list_entry *list_entry_current; - - udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { - if (strcmp(udev_list_entry_get_name(list_entry_current), - udev_list_entry_get_name(list_entry)) == 0) - continue; - } - /* link does no longer belong to this device */ - info(udev, "update old symlink '%s' no longer belonging to '%s'\n", - udev_list_entry_get_name(list_entry), udev_device_get_devpath(dev)); - update_link(dev, udev_list_entry_get_name(list_entry), test); - } - - /* - * if the node name has changed, delete the node, - * and possibly restore a symlink of another device - */ - devnode_old = udev_device_get_devnode(dev_old); - if (devnode_old != NULL) { - const char *devnode = udev_device_get_devnode(dev); - - if (devnode != NULL && strcmp(devnode_old, devnode) != 0) - update_link(dev, devnode_old, test); - } -} - -int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const char *group, int test) -{ - struct udev *udev = udev_device_get_udev(dev); - uid_t uid; - gid_t gid; - int i; - int num; - struct udev_list_entry *list_entry; - int err = 0; - - create_path(udev, udev_device_get_devnode(dev)); - - if (strcmp(owner, "root") == 0) - uid = 0; - else { - char *endptr; - unsigned long id; - - id = strtoul(owner, &endptr, 10); - if (endptr[0] == '\0') - uid = (uid_t) id; - else - uid = lookup_user(udev, owner); - } - - if (strcmp(group, "root") == 0) - gid = 0; - else { - char *endptr; - unsigned long id; - - id = strtoul(group, &endptr, 10); - if (endptr[0] == '\0') - gid = (gid_t) id; - else - gid = lookup_group(udev, group); - } - - info(udev, "creating device node '%s', devnum=%d:%d, mode=%#o, uid=%d, gid=%d\n", - udev_device_get_devnode(dev), - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)), - mode, uid, gid); - - if (!test) - if (udev_node_mknod(dev, NULL, makedev(0,0), mode, uid, gid) != 0) { - err = -1; - goto exit; - } - - /* create all_partitions if requested */ - num = udev_device_get_num_fake_partitions(dev); - if (num > 0) { - info(udev, "creating device partition nodes '%s[1-%i]'\n", udev_device_get_devnode(dev), num); - if (!test) { - for (i = 1; i <= num; i++) { - char partitionname[UTIL_PATH_SIZE]; - dev_t part_devnum; - - snprintf(partitionname, sizeof(partitionname), "%s%d", - udev_device_get_devnode(dev), i); - partitionname[sizeof(partitionname)-1] = '\0'; - part_devnum = makedev(major(udev_device_get_devnum(dev)), - minor(udev_device_get_devnum(dev)) + i); - udev_node_mknod(dev, partitionname, part_devnum, mode, uid, gid); - } - } - } - - /* add node and to name index */ - name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 1, test); - - /* create/update symlinks, add symlinks to name index */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 1, test); - update_link(dev, udev_list_entry_get_name(list_entry), test); - } -exit: - return err; -} - -extern int udev_node_remove(struct udev_device *dev, int test) -{ - struct udev *udev = udev_device_get_udev(dev); - struct udev_list_entry *list_entry; - const char *devnode; - char partitionname[UTIL_PATH_SIZE]; - struct stat stats; - int err = 0; - int num; - - /* remove node from name index */ - name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 0, test); - - /* remove,update symlinks, remove symlinks from name index */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 0, test); - update_link(dev, udev_list_entry_get_name(list_entry), test); - } - - devnode = udev_device_get_devnode(dev); - if (devnode == NULL) - return 0; - if (stat(devnode, &stats) != 0) { - info(udev, "device node '%s' not found\n", devnode); - return 0; - } - if (stats.st_rdev != udev_device_get_devnum(dev)) { - info(udev, "device node '%s' points to a different device, skip removal\n", devnode); - return -1; - } - - info(udev, "removing device node '%s'\n", devnode); - if (!test) - err = unlink_secure(udev, devnode); - if (err) - return err; - - num = udev_device_get_num_fake_partitions(dev); - if (num > 0) { - int i; - - info(udev, "removing all_partitions '%s[1-%i]'\n", devnode, num); - if (num > 255) - return -1; - for (i = 1; i <= num; i++) { - snprintf(partitionname, sizeof(partitionname), "%s%d", devnode, i); - partitionname[sizeof(partitionname)-1] = '\0'; - if (!test) - unlink_secure(udev, partitionname); - } - } - delete_path(udev, devnode); - return err; -} diff --git a/udev/udev_rules.c b/udev/udev_rules.c deleted file mode 100644 index dfcd87539c..0000000000 --- a/udev/udev_rules.c +++ /dev/null @@ -1,1634 +0,0 @@ -/* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" - -extern char **environ; - -/* extract possible {attr} and move str behind it */ -static char *get_format_attribute(struct udev *udev, char **str) -{ - char *pos; - char *attr = NULL; - - if (*str[0] == '{') { - pos = strchr(*str, '}'); - if (pos == NULL) { - err(udev, "missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - attr = *str+1; - *str = pos+1; - dbg(udev, "attribute='%s', str='%s'\n", attr, *str); - } - return attr; -} - -/* extract possible format length and move str behind it*/ -static int get_format_len(struct udev *udev, char **str) -{ - int num; - char *tail; - - if (isdigit(*str[0])) { - num = (int) strtoul(*str, &tail, 10); - if (num > 0) { - *str = tail; - dbg(udev, "format length=%i\n", num); - return num; - } else { - err(udev, "format parsing error '%s'\n", *str); - } - } - return -1; -} - -static int get_key(char **line, char **key, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (linepos == NULL) - return -1; - - /* skip whitespace */ - while (isspace(linepos[0])) - linepos++; - - /* get the key */ - temp = strchr(linepos, '='); - if (temp == NULL || temp == linepos) - return -1; - temp[0] = '\0'; - *key = linepos; - linepos = &temp[1]; - - /* get a quoted value */ - if (linepos[0] == '"' || linepos[0] == '\'') { - temp = strchr(&linepos[1], linepos[0]); - if (temp != NULL) { - temp[0] = '\0'; - *value = &linepos[1]; - goto out; - } - } - - /* get the value*/ - temp = strchr(linepos, '\n'); - if (temp != NULL) - temp[0] = '\0'; - *value = linepos; -out: - return 0; -} - -static int run_program(struct udev_device *dev, const char *command, - char *result, size_t ressize, size_t *reslen) -{ - struct udev *udev = udev_device_get_udev(dev); - int status; - char **envp; - int outpipe[2] = {-1, -1}; - int errpipe[2] = {-1, -1}; - pid_t pid; - char arg[UTIL_PATH_SIZE]; - char program[UTIL_PATH_SIZE]; - char *argv[(sizeof(arg) / 2) + 1]; - int devnull; - int i; - int err = 0; - - /* build argv from command */ - util_strlcpy(arg, command, sizeof(arg)); - i = 0; - if (strchr(arg, ' ') != NULL) { - char *pos = arg; - - while (pos != NULL) { - if (pos[0] == '\'') { - /* don't separate if in apostrophes */ - pos++; - argv[i] = strsep(&pos, "\'"); - while (pos != NULL && pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - } - dbg(udev, "arg[%i] '%s'\n", i, argv[i]); - i++; - } - argv[i] = NULL; - } else { - argv[0] = arg; - argv[1] = NULL; - } - info(udev, "'%s'\n", command); - - /* prepare pipes from child to parent */ - if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(outpipe) != 0) { - err(udev, "pipe failed: %m\n"); - return -1; - } - } - if (udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(errpipe) != 0) { - err(udev, "pipe failed: %m\n"); - return -1; - } - } - - /* allow programs in /lib/udev/ to be called without the path */ - if (strchr(argv[0], '/') == NULL) { - util_strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); - util_strlcat(program, argv[0], sizeof(program)); - argv[0] = program; - } - - envp = udev_device_get_properties_envp(dev); - - pid = fork(); - switch(pid) { - case 0: - /* child closes parent ends of pipes */ - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* discard child output or connect to pipe */ - devnull = open("/dev/null", O_RDWR); - if (devnull > 0) { - dup2(devnull, STDIN_FILENO); - if (outpipe[WRITE_END] < 0) - dup2(devnull, STDOUT_FILENO); - if (errpipe[WRITE_END] < 0) - dup2(devnull, STDERR_FILENO); - close(devnull); - } else - err(udev, "open /dev/null failed: %m\n"); - if (outpipe[WRITE_END] > 0) { - dup2(outpipe[WRITE_END], STDOUT_FILENO); - close(outpipe[WRITE_END]); - } - if (errpipe[WRITE_END] > 0) { - dup2(errpipe[WRITE_END], STDERR_FILENO); - close(errpipe[WRITE_END]); - } - execve(argv[0], argv, envp); - if (errno == ENOENT || errno == ENOTDIR) { - /* may be on a filesytem which is not mounted right now */ - info(udev, "program '%s' not found\n", argv[0]); - } else { - /* other problems */ - err(udev, "exec of program '%s' failed\n", argv[0]); - } - _exit(1); - case -1: - err(udev, "fork of '%s' failed: %m\n", argv[0]); - return -1; - default: - /* read from child if requested */ - if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - ssize_t count; - size_t respos = 0; - - /* parent closes child ends of pipes */ - if (outpipe[WRITE_END] > 0) - close(outpipe[WRITE_END]); - if (errpipe[WRITE_END] > 0) - close(errpipe[WRITE_END]); - - /* read child output */ - while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - int fdcount; - fd_set readfds; - - FD_ZERO(&readfds); - if (outpipe[READ_END] > 0) - FD_SET(outpipe[READ_END], &readfds); - if (errpipe[READ_END] > 0) - FD_SET(errpipe[READ_END], &readfds); - fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err = -1; - break; - } - - /* get stdout */ - if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { - char inbuf[1024]; - char *pos; - char *line; - - count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); - if (count <= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - if (count < 0) { - err(udev, "stdin read failed: %m\n"); - err = -1; - } - continue; - } - inbuf[count] = '\0'; - - /* store result for rule processing */ - if (result) { - if (respos + count < ressize) { - memcpy(&result[respos], inbuf, count); - respos += count; - } else { - err(udev, "ressize %ld too short\n", (long)ressize); - err = -1; - } - } - pos = inbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stdout) '%s'\n", argv[0], line); - } - - /* get stderr */ - if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { - char errbuf[1024]; - char *pos; - char *line; - - count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); - if (count <= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - if (count < 0) - err(udev, "stderr read failed: %m\n"); - continue; - } - errbuf[count] = '\0'; - pos = errbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stderr) '%s'\n", argv[0], line); - } - } - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* return the childs stdout string */ - if (result) { - result[respos] = '\0'; - dbg(udev, "result='%s'\n", result); - if (reslen) - *reslen = respos; - } - } - waitpid(pid, &status, 0); - if (WIFEXITED(status)) { - info(udev, "'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); - if (WEXITSTATUS(status) != 0) - err = -1; - } else { - err(udev, "'%s' abnormal exit\n", argv[0]); - err = -1; - } - } - - return err; -} - -static int import_keys_into_env(struct udev_event *event, const char *buf, size_t bufsize) -{ - struct udev_device *dev = event->dev; - char line[UTIL_LINE_SIZE]; - const char *bufline; - char *linepos; - char *variable; - char *value; - size_t cur; - size_t count; - int lineno; - - /* loop through the whole buffer */ - lineno = 0; - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; - - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) - continue; - - /* see if this is a comment */ - if (bufline[0] == '#') - continue; - - if (count >= sizeof(line)) { - err(event->udev, "line too long, skipped\n"); - continue; - } - - memcpy(line, bufline, count); - line[count] = '\0'; - - linepos = line; - if (get_key(&linepos, &variable, &value) == 0) { - char syspath[UTIL_PATH_SIZE]; - - dbg(event->udev, "import '%s=%s'\n", variable, value); - /* handle device, renamed by external tool, returning new path */ - if (strcmp(variable, "DEVPATH") == 0) { - info(event->udev, "updating devpath from '%s' to '%s'\n", - udev_device_get_devpath(dev), value); - util_strlcpy(syspath, udev_get_sys_path(event->udev), sizeof(syspath)); - util_strlcat(syspath, value, sizeof(syspath)); - udev_device_set_syspath(dev, syspath); - } else { - struct udev_list_entry *entry; - - entry = udev_device_add_property(dev, variable, value); - /* store in db */ - udev_list_entry_set_flag(entry, 1); - } - } - } - return 0; -} - -static int import_file_into_env(struct udev_event *event, const char *filename) -{ - char *buf; - size_t bufsize; - - if (file_map(filename, &buf, &bufsize) != 0) { - err(event->udev, "can't open '%s': %m\n", filename); - return -1; - } - import_keys_into_env(event, buf, bufsize); - file_unmap(buf, bufsize); - - return 0; -} - -static int import_program_into_env(struct udev_event *event, const char *program) -{ - char result[2048]; - size_t reslen; - - if (run_program(event->dev, program, result, sizeof(result), &reslen) != 0) - return -1; - return import_keys_into_env(event, result, reslen); -} - -static int import_parent_into_env(struct udev_event *event, const char *filter) -{ - struct udev_device *dev_parent; - struct udev_list_entry *list_entry; - - dev_parent = udev_device_get_parent(event->dev); - if (dev_parent == NULL) - return -1; - - dbg(event->udev, "found parent '%s', get the node name\n", udev_device_get_syspath(dev_parent)); - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev_parent)) { - const char *key = udev_list_entry_get_name(list_entry); - const char *val = udev_list_entry_get_value(list_entry); - - if (fnmatch(filter, key, 0) == 0) { - struct udev_list_entry *entry; - - dbg(event->udev, "import key '%s=%s'\n", key, val); - entry = udev_device_add_property(event->dev, key, val); - /* store in db */ - udev_list_entry_set_flag(entry, 1); - } - } - return 0; -} - -int udev_rules_run(struct udev_event *event) -{ - struct udev_list_entry *list_entry; - int err = 0; - - dbg(event->udev, "executing run list\n"); - udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { - const char *cmd = udev_list_entry_get_name(list_entry); - - if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { - struct udev_monitor *monitor; - - monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); - if (monitor == NULL) - continue; - udev_monitor_send_device(monitor, event->dev); - udev_monitor_unref(monitor); - } else { - char program[UTIL_PATH_SIZE]; - - util_strlcpy(program, cmd, sizeof(program)); - udev_rules_apply_format(event, program, sizeof(program)); - if (run_program(event->dev, program, NULL, 0, NULL) != 0) { - if (!udev_list_entry_get_flag(list_entry)) - err = -1; - } - } - } - return err; -} - -#define WAIT_LOOP_PER_SECOND 50 -static int wait_for_file(struct udev_event *event, const char *file, int timeout) -{ - char filepath[UTIL_PATH_SIZE]; - char devicepath[UTIL_PATH_SIZE] = ""; - struct stat stats; - int loop = timeout * WAIT_LOOP_PER_SECOND; - - /* a relative path is a device attribute */ - if (file[0] != '/') { - util_strlcpy(devicepath, udev_get_sys_path(event->udev), sizeof(devicepath)); - util_strlcat(devicepath, udev_device_get_devpath(event->dev), sizeof(devicepath)); - - util_strlcpy(filepath, devicepath, sizeof(filepath)); - util_strlcat(filepath, "/", sizeof(filepath)); - util_strlcat(filepath, file, sizeof(filepath)); - file = filepath; - } - - dbg(event->udev, "will wait %i sec for '%s'\n", timeout, file); - while (--loop) { - /* lookup file */ - if (stat(file, &stats) == 0) { - info(event->udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); - return 0; - } - /* make sure, the device did not disappear in the meantime */ - if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { - info(event->udev, "device disappeared while waiting for '%s'\n", file); - return -2; - } - info(event->udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); - } - info(event->udev, "waiting for '%s' failed\n", file); - return -1; -} - -/* handle "[$SUBSYSTEM/$KERNEL]" lookup */ -static int split_subsys_sysname(struct udev *udev, char *attrstr, char **subsys, char **sysname, char **attr) -{ - char *pos; - - if (attrstr[0] != '[') - return -1; - - *subsys = &attrstr[1]; - pos = strchr(*subsys, ']'); - if (pos == NULL) - return -1; - pos[0] = '\0'; - pos = &pos[1]; - - if (pos[0] == '/') - pos = &pos[1]; - if (pos[0] != '\0') - *attr = pos; - else - *attr = NULL; - - pos = strchr(*subsys, '/'); - if (pos == NULL) - return -1; - pos[0] = '\0'; - *sysname = &pos[1]; - return 0; -} - -static int attr_subst_subdir(char *attr, size_t len) -{ - char *pos; - int found = 0; - - pos = strstr(attr, "/*/"); - if (pos != NULL) { - char str[UTIL_PATH_SIZE]; - DIR *dir; - - pos[1] = '\0'; - util_strlcpy(str, &pos[2], sizeof(str)); - dir = opendir(attr); - if (dir != NULL) { - struct dirent *dent; - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat stats; - - if (dent->d_name[0] == '.') - continue; - util_strlcat(attr, dent->d_name, len); - util_strlcat(attr, str, len); - if (stat(attr, &stats) == 0) { - found = 1; - break; - } - pos[1] = '\0'; - } - closedir(dir); - } - if (!found) - util_strlcat(attr, str, len); - } - - return found; -} - -void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize) -{ - struct udev_device *dev = event->dev; - char temp[UTIL_PATH_SIZE]; - char temp2[UTIL_PATH_SIZE]; - char *head, *tail, *cpos, *attr, *rest; - int len; - int i; - int count; - enum subst_type { - SUBST_UNKNOWN, - SUBST_DEVPATH, - SUBST_KERNEL, - SUBST_KERNEL_NUMBER, - SUBST_ID, - SUBST_DRIVER, - SUBST_MAJOR, - SUBST_MINOR, - SUBST_RESULT, - SUBST_ATTR, - SUBST_PARENT, - SUBST_TEMP_NODE, - SUBST_NAME, - SUBST_LINKS, - SUBST_ROOT, - SUBST_SYS, - SUBST_ENV, - }; - static const struct subst_map { - char *name; - char fmt; - enum subst_type type; - } map[] = { - { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, - { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, - { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, - { .name = "id", .fmt = 'b', .type = SUBST_ID }, - { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, - { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, - { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, - { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, - { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, - { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, - { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, - { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, - { .name = "name", .fmt = 'D', .type = SUBST_NAME }, - { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, - { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, - { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, - { .name = "env", .fmt = 'E', .type = SUBST_ENV }, - { NULL, '\0', 0 } - }; - enum subst_type type; - const struct subst_map *subst; - - head = string; - while (1) { - len = -1; - while (head[0] != '\0') { - if (head[0] == '$') { - /* substitute named variable */ - if (head[1] == '\0') - break; - if (head[1] == '$') { - util_strlcpy(temp, head+2, sizeof(temp)); - util_strlcpy(head+1, temp, maxsize); - head++; - continue; - } - head[0] = '\0'; - for (subst = map; subst->name; subst++) { - if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { - type = subst->type; - tail = head + strlen(subst->name)+1; - dbg(event->udev, "will substitute format name '%s'\n", subst->name); - goto found; - } - } - head[0] = '$'; - err(event->udev, "unknown format variable '%s'\n", head); - } else if (head[0] == '%') { - /* substitute format char */ - if (head[1] == '\0') - break; - if (head[1] == '%') { - util_strlcpy(temp, head+2, sizeof(temp)); - util_strlcpy(head+1, temp, maxsize); - head++; - continue; - } - head[0] = '\0'; - tail = head+1; - len = get_format_len(event->udev, &tail); - for (subst = map; subst->name; subst++) { - if (tail[0] == subst->fmt) { - type = subst->type; - tail++; - dbg(event->udev, "will substitute format char '%c'\n", subst->fmt); - goto found; - } - } - head[0] = '%'; - err(event->udev, "unknown format char '%c'\n", tail[0]); - } - head++; - } - break; -found: - attr = get_format_attribute(event->udev, &tail); - util_strlcpy(temp, tail, sizeof(temp)); - dbg(event->udev, "format=%i, string='%s', tail='%s'\n", type ,string, tail); - - switch (type) { - case SUBST_DEVPATH: - util_strlcat(string, udev_device_get_devpath(dev), maxsize); - dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); - break; - case SUBST_KERNEL: - util_strlcat(string, udev_device_get_sysname(dev), maxsize); - dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); - break; - case SUBST_KERNEL_NUMBER: - if (udev_device_get_sysnum(dev) == NULL) - break; - util_strlcat(string, udev_device_get_sysnum(dev), maxsize); - dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); - break; - case SUBST_ID: - if (event->dev_parent != NULL) { - util_strlcat(string, udev_device_get_sysname(event->dev_parent), maxsize); - dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); - } - break; - case SUBST_DRIVER: - if (event->dev_parent != NULL) { - const char *driver = udev_device_get_driver(event->dev_parent); - - if (driver == NULL) - break; - util_strlcat(string, driver, maxsize); - dbg(event->udev, "substitute driver '%s'\n", driver); - } - break; - case SUBST_MAJOR: - sprintf(temp2, "%d", major(udev_device_get_devnum(dev))); - util_strlcat(string, temp2, maxsize); - dbg(event->udev, "substitute major number '%s'\n", temp2); - break; - case SUBST_MINOR: - sprintf(temp2, "%d", minor(udev_device_get_devnum(dev))); - util_strlcat(string, temp2, maxsize); - dbg(event->udev, "substitute minor number '%s'\n", temp2); - break; - case SUBST_RESULT: - if (event->program_result[0] == '\0') - break; - /* get part part of the result string */ - i = 0; - if (attr != NULL) - i = strtoul(attr, &rest, 10); - if (i > 0) { - dbg(event->udev, "request part #%d of result string\n", i); - cpos = event->program_result; - while (--i) { - while (cpos[0] != '\0' && !isspace(cpos[0])) - cpos++; - while (isspace(cpos[0])) - cpos++; - } - if (i > 0) { - err(event->udev, "requested part of result string not found\n"); - break; - } - util_strlcpy(temp2, cpos, sizeof(temp2)); - /* %{2+}c copies the whole string from the second part on */ - if (rest[0] != '+') { - cpos = strchr(temp2, ' '); - if (cpos) - cpos[0] = '\0'; - } - util_strlcat(string, temp2, maxsize); - dbg(event->udev, "substitute part of result string '%s'\n", temp2); - } else { - util_strlcat(string, event->program_result, maxsize); - dbg(event->udev, "substitute result string '%s'\n", event->program_result); - } - break; - case SUBST_ATTR: - if (attr == NULL) - err(event->udev, "missing file parameter for attr\n"); - else { - char *subsys; - char *sysname; - char *attrib; - char value[UTIL_NAME_SIZE] = ""; - size_t size; - - if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { - struct udev_device *d; - const char *val; - - if (attrib == NULL) - break; - d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); - if (d == NULL) - break; - val = udev_device_get_attr_value(d, attrib); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - udev_device_unref(d); - } - - /* try the current device, other matches may have selected */ - if (value[0]=='\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { - const char *val; - - val = udev_device_get_attr_value(event->dev_parent, attr); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - } - - /* look at all devices along the chain of parents */ - if (value[0]=='\0') { - struct udev_device *dev_parent = dev; - const char *val; - - do { - dbg(event->udev, "looking at '%s'\n", udev_device_get_syspath(dev_parent)); - val = udev_device_get_attr_value(dev_parent, attr); - if (val != NULL) { - util_strlcpy(value, val, sizeof(value)); - break; - } - dev_parent = udev_device_get_parent(dev_parent); - } while (dev_parent != NULL); - } - - if (value[0]=='\0') - break; - - /* strip trailing whitespace, and replace unwanted characters */ - size = strlen(value); - while (size > 0 && isspace(value[--size])) - value[size] = '\0'; - count = util_replace_chars(value, ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - util_strlcat(string, value, maxsize); - dbg(event->udev, "substitute sysfs value '%s'\n", value); - } - break; - case SUBST_PARENT: - { - struct udev_device *dev_parent; - const char *devnode; - - dev_parent = udev_device_get_parent(event->dev); - if (dev_parent == NULL) - break; - devnode = udev_device_get_devnode(dev_parent); - if (devnode != NULL) { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - - util_strlcat(string, &devnode[devlen], maxsize); - dbg(event->udev, "found parent '%s', got node name '%s'\n", - udev_device_get_syspath(dev_parent), &devnode[devlen]); - } - } - break; - case SUBST_TEMP_NODE: - if (event->tmp_node[0] == '\0' && major(udev_device_get_devnum(dev)) > 0) { - dbg(event->udev, "create temporary device node for callout\n"); - snprintf(event->tmp_node, sizeof(event->tmp_node), "%s/.tmp-%u-%u", - udev_get_dev_path(event->udev), - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); - udev_node_mknod(dev, event->tmp_node, makedev(0,0), 0600, 0, 0); - } - util_strlcat(string, event->tmp_node, maxsize); - dbg(event->udev, "substitute temporary device node name '%s'\n", event->tmp_node); - break; - case SUBST_NAME: - if (event->name != NULL) { - util_strlcat(string, event->name, maxsize); - dbg(event->udev, "substitute name '%s'\n", event->name); - } else { - util_strlcat(string, udev_device_get_sysname(dev), maxsize); - dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); - } - break; - case SUBST_LINKS: - { - struct udev_list_entry *list_entry; - - list_entry = udev_device_get_properties_list_entry(dev); - util_strlcpy(string, udev_list_entry_get_name(list_entry), maxsize); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { - util_strlcat(string, " ", maxsize); - util_strlcat(string, udev_list_entry_get_name(list_entry), maxsize); - } - } - break; - case SUBST_ROOT: - util_strlcat(string, udev_get_dev_path(event->udev), maxsize); - dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); - break; - case SUBST_SYS: - util_strlcat(string, udev_get_sys_path(event->udev), maxsize); - dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); - break; - case SUBST_ENV: - if (attr == NULL) { - dbg(event->udev, "missing attribute\n"); - break; - } else { - struct udev_list_entry *list_entry; - const char *value; - - list_entry = udev_device_get_properties_list_entry(event->dev); - list_entry = udev_list_entry_get_by_name(list_entry, attr); - if (list_entry == NULL) - break; - value = udev_list_entry_get_value(list_entry); - dbg(event->udev, "substitute env '%s=%s'\n", attr, value); - util_strlcat(string, value, maxsize); - break; - } - default: - err(event->udev, "unknown substitution type=%i\n", type); - break; - } - /* possibly truncate to format-char specified length */ - if (len >= 0 && len < (int)strlen(head)) { - head[len] = '\0'; - dbg(event->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head); - } - util_strlcat(string, temp, maxsize); - } -} - -static char *key_val(struct udev_rule *rule, struct key *key) -{ - return rule->buf + key->val_off; -} - -static char *key_pair_name(struct udev_rule *rule, struct key_pair *pair) -{ - return rule->buf + pair->key_name_off; -} - -static int match_key(struct udev *udev, const char *key_name, struct udev_rule *rule, struct key *key, const char *val) -{ - char value[UTIL_PATH_SIZE]; - char *key_value; - char *pos; - int match = 0; - - if (key->operation != KEY_OP_MATCH && - key->operation != KEY_OP_NOMATCH) - return 0; - - if (val == NULL) - val = ""; - - /* look for a matching string, parts are separated by '|' */ - util_strlcpy(value, rule->buf + key->val_off, sizeof(value)); - key_value = value; - dbg(udev, "key %s value='%s'\n", key_name, key_value); - while (key_value != NULL) { - pos = strchr(key_value, '|'); - if (pos != NULL) { - pos[0] = '\0'; - pos = &pos[1]; - } - - dbg(udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); - match = (fnmatch(key_value, val, 0) == 0); - if (match) - break; - - key_value = pos; - } - - if (match && (key->operation == KEY_OP_MATCH)) { - dbg(udev, "%s is true (matching value)\n", key_name); - return 0; - } - if (!match && (key->operation == KEY_OP_NOMATCH)) { - dbg(udev, "%s is true (non-matching value)\n", key_name); - return 0; - } - return -1; -} - -/* match a single rule against a given device and possibly its parent devices */ -static int match_rule(struct udev_event *event, struct udev_rule *rule) -{ - struct udev_device *dev = event->dev; - int i; - - if (match_key(event->udev, "ACTION", rule, &rule->action, udev_device_get_action(dev))) - goto nomatch; - - if (match_key(event->udev, "KERNEL", rule, &rule->kernel, udev_device_get_sysname(dev))) - goto nomatch; - - if (match_key(event->udev, "SUBSYSTEM", rule, &rule->subsystem, udev_device_get_subsystem(dev))) - goto nomatch; - - if (match_key(event->udev, "DEVPATH", rule, &rule->devpath, udev_device_get_devpath(dev))) - goto nomatch; - - if (match_key(event->udev, "DRIVER", rule, &rule->driver, udev_device_get_driver(dev))) - goto nomatch; - - /* match NAME against a value assigned by an earlier rule */ - if (match_key(event->udev, "NAME", rule, &rule->name, event->name)) - goto nomatch; - - /* match against current list of symlinks */ - if (rule->symlink_match.operation == KEY_OP_MATCH || - rule->symlink_match.operation == KEY_OP_NOMATCH) { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - struct udev_list_entry *list_entry; - int match = 0; - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - const char *devlink; - - devlink = &udev_list_entry_get_name(list_entry)[devlen]; - if (match_key(event->udev, "SYMLINK", rule, &rule->symlink_match, devlink) == 0) { - match = 1; - break; - } - } - if (!match) - goto nomatch; - } - - for (i = 0; i < rule->env.count; i++) { - struct key_pair *pair = &rule->env.keys[i]; - - /* we only check for matches, assignments will be handled later */ - if (pair->key.operation == KEY_OP_MATCH || - pair->key.operation == KEY_OP_NOMATCH) { - struct udev_list_entry *list_entry; - const char *key_name = key_pair_name(rule, pair); - const char *value; - - list_entry = udev_device_get_properties_list_entry(event->dev); - list_entry = udev_list_entry_get_by_name(list_entry, key_name); - value = udev_list_entry_get_value(list_entry); - if (value == NULL) { - dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); - value = ""; - } - if (match_key(event->udev, "ENV", rule, &pair->key, value)) - goto nomatch; - } - } - - if (rule->test.operation == KEY_OP_MATCH || - rule->test.operation == KEY_OP_NOMATCH) { - char filename[UTIL_PATH_SIZE]; - char *subsys; - char *sysname; - char *attrib; - struct stat statbuf; - int match; - - util_strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); - udev_rules_apply_format(event, filename, sizeof(filename)); - - if (split_subsys_sysname(event->udev, filename, &subsys, &sysname, &attrib) == 0) { - struct udev_device *d; - d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); - if (d != NULL) { - util_strlcpy(filename, udev_device_get_syspath(d), sizeof(filename)); - if (attrib != NULL) { - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, attrib, sizeof(filename)); - } - udev_device_unref(d); - } - } else if (filename[0] != '/') { - char tmp[UTIL_PATH_SIZE]; - - util_strlcpy(tmp, udev_device_get_syspath(dev), sizeof(tmp)); - util_strlcat(tmp, "/", sizeof(tmp)); - util_strlcat(tmp, filename, sizeof(tmp)); - util_strlcpy(filename, tmp, sizeof(filename)); - } - - attr_subst_subdir(filename, sizeof(filename)); - - match = (stat(filename, &statbuf) == 0); - info(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); - if (match && rule->test_mode_mask > 0) { - match = ((statbuf.st_mode & rule->test_mode_mask) > 0); - info(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, - match ? "matches" : "does not match", - rule->test_mode_mask); - } - if (match && rule->test.operation == KEY_OP_NOMATCH) - goto nomatch; - if (!match && rule->test.operation == KEY_OP_MATCH) - goto nomatch; - dbg(event->udev, "TEST key is true\n"); - } - - if (rule->wait_for.operation != KEY_OP_UNSET) { - char filename[UTIL_PATH_SIZE]; - int found; - - util_strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); - udev_rules_apply_format(event, filename, sizeof(filename)); - found = (wait_for_file(event, filename, 10) == 0); - if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) - goto nomatch; - } - - /* check for matching sysfs attribute pairs */ - for (i = 0; i < rule->attr.count; i++) { - struct key_pair *pair = &rule->attr.keys[i]; - - if (pair->key.operation == KEY_OP_MATCH || - pair->key.operation == KEY_OP_NOMATCH) { - char attr[UTIL_PATH_SIZE]; - const char *key_name = key_pair_name(rule, pair); - const char *key_value = key_val(rule, &pair->key); - char *subsys; - char *sysname; - char *attrib; - char value[UTIL_NAME_SIZE] = ""; - size_t len; - - util_strlcpy(attr, key_name, sizeof(attr)); - if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { - struct udev_device *d; - const char *val; - - if (attrib == NULL) - goto nomatch; - d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); - if (d == NULL) - goto nomatch; - val = udev_device_get_attr_value(d, attrib); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - udev_device_unref(d); - } - - if (value[0]=='\0') { - const char *val; - - val = udev_device_get_attr_value(dev, key_name); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - } - - if (value[0]=='\0') - goto nomatch; - - /* strip trailing whitespace of value, if not asked to match for it */ - len = strlen(key_value); - if (len > 0 && !isspace(key_value[len-1])) { - len = strlen(value); - while (len > 0 && isspace(value[--len])) - value[len] = '\0'; - dbg(event->udev, "removed trailing whitespace from '%s'\n", value); - } - - if (match_key(event->udev, "ATTR", rule, &pair->key, value)) - goto nomatch; - } - } - - /* walk up the chain of parent devices and find a match */ - event->dev_parent = dev; - while (1) { - /* check for matching kernel device name */ - if (match_key(event->udev, "KERNELS", rule, - &rule->kernels, udev_device_get_sysname(event->dev_parent))) - goto try_parent; - - /* check for matching subsystem value */ - if (match_key(event->udev, "SUBSYSTEMS", rule, - &rule->subsystems, udev_device_get_subsystem(event->dev_parent))) - goto try_parent; - - /* check for matching driver */ - if (match_key(event->udev, "DRIVERS", rule, - &rule->drivers, udev_device_get_driver(event->dev_parent))) - goto try_parent; - - /* check for matching sysfs attribute pairs */ - for (i = 0; i < rule->attrs.count; i++) { - struct key_pair *pair = &rule->attrs.keys[i]; - - if (pair->key.operation == KEY_OP_MATCH || - pair->key.operation == KEY_OP_NOMATCH) { - const char *key_name = key_pair_name(rule, pair); - const char *key_value = key_val(rule, &pair->key); - const char *val; - char value[UTIL_NAME_SIZE]; - size_t len; - - val = udev_device_get_attr_value(event->dev_parent, key_name); - if (val == NULL) - val = udev_device_get_attr_value(dev, key_name); - if (val == NULL) - goto try_parent; - util_strlcpy(value, val, sizeof(value)); - - /* strip trailing whitespace of value, if not asked to match for it */ - len = strlen(key_value); - if (len > 0 && !isspace(key_value[len-1])) { - len = strlen(value); - while (len > 0 && isspace(value[--len])) - value[len] = '\0'; - dbg(event->udev, "removed trailing whitespace from '%s'\n", value); - } - - if (match_key(event->udev, "ATTRS", rule, &pair->key, value)) - goto try_parent; - } - } - - /* found matching device */ - break; -try_parent: - /* move to parent device */ - dbg(event->udev, "try parent sysfs device\n"); - event->dev_parent = udev_device_get_parent(event->dev_parent); - if (event->dev_parent == NULL) - goto nomatch; - dbg(event->udev, "looking at dev_parent->devpath='%s'\n", - udev_device_get_syspath(event->dev_parent)); - } - - /* execute external program */ - if (rule->program.operation != KEY_OP_UNSET) { - char program[UTIL_PATH_SIZE]; - char result[UTIL_PATH_SIZE]; - - util_strlcpy(program, key_val(rule, &rule->program), sizeof(program)); - udev_rules_apply_format(event, program, sizeof(program)); - if (run_program(event->dev, program, result, sizeof(result), NULL) != 0) { - dbg(event->udev, "PROGRAM is false\n"); - event->program_result[0] = '\0'; - if (rule->program.operation != KEY_OP_NOMATCH) - goto nomatch; - } else { - int count; - - dbg(event->udev, "PROGRAM matches\n"); - util_remove_trailing_chars(result, '\n'); - if (rule->string_escape == ESCAPE_UNSET || - rule->string_escape == ESCAPE_REPLACE) { - count = util_replace_chars(result, ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - } - dbg(event->udev, "result is '%s'\n", result); - util_strlcpy(event->program_result, result, sizeof(event->program_result)); - dbg(event->udev, "PROGRAM returned successful\n"); - if (rule->program.operation == KEY_OP_NOMATCH) - goto nomatch; - } - dbg(event->udev, "PROGRAM key is true\n"); - } - - /* check for matching result of external program */ - if (match_key(event->udev, "RESULT", rule, &rule->result, event->program_result)) - goto nomatch; - - /* import variables returned from program or or file into environment */ - if (rule->import.operation != KEY_OP_UNSET) { - char import[UTIL_PATH_SIZE]; - int rc = -1; - - util_strlcpy(import, key_val(rule, &rule->import), sizeof(import)); - udev_rules_apply_format(event, import, sizeof(import)); - dbg(event->udev, "check for IMPORT import='%s'\n", import); - if (rule->import_type == IMPORT_PROGRAM) { - rc = import_program_into_env(event, import); - } else if (rule->import_type == IMPORT_FILE) { - dbg(event->udev, "import file import='%s'\n", import); - rc = import_file_into_env(event, import); - } else if (rule->import_type == IMPORT_PARENT) { - dbg(event->udev, "import parent import='%s'\n", import); - rc = import_parent_into_env(event, import); - } - if (rc != 0) { - dbg(event->udev, "IMPORT failed\n"); - if (rule->import.operation != KEY_OP_NOMATCH) - goto nomatch; - } else - dbg(event->udev, "IMPORT '%s' imported\n", key_val(rule, &rule->import)); - dbg(event->udev, "IMPORT key is true\n"); - } - - /* rule matches, if we have ENV assignments export it */ - for (i = 0; i < rule->env.count; i++) { - struct key_pair *pair = &rule->env.keys[i]; - - if (pair->key.operation == KEY_OP_ASSIGN) { - char temp_value[UTIL_NAME_SIZE]; - const char *key_name = key_pair_name(rule, pair); - const char *value = key_val(rule, &pair->key); - - /* make sure we don't write to the same string we possibly read from */ - util_strlcpy(temp_value, value, sizeof(temp_value)); - udev_rules_apply_format(event, temp_value, sizeof(temp_value)); - - if (temp_value[0] != '\0') { - struct udev_list_entry *entry; - - info(event->udev, "set ENV '%s=%s'\n", key_name, temp_value); - entry = udev_device_add_property(dev, key_name, temp_value); - /* store in db */ - udev_list_entry_set_flag(entry, 1); - } - } - } - - /* if we have ATTR assignments, write value to sysfs file */ - for (i = 0; i < rule->attr.count; i++) { - struct key_pair *pair = &rule->attr.keys[i]; - - if (pair->key.operation == KEY_OP_ASSIGN) { - const char *key_name = key_pair_name(rule, pair); - char *subsys; - char *sysname; - char *attrib; - char attr[UTIL_PATH_SIZE]; - char value[UTIL_NAME_SIZE]; - FILE *f; - - util_strlcpy(attr, key_name, sizeof(attr)); - if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { - struct udev_device *d; - - d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); - if (d != NULL) { - util_strlcpy(attr, udev_device_get_syspath(d), sizeof(attr)); - if (attrib != NULL) { - util_strlcat(attr, "/", sizeof(attr)); - util_strlcat(attr, attrib, sizeof(attr)); - } - udev_device_unref(d); - } - } else { - util_strlcpy(attr, udev_device_get_syspath(dev), sizeof(attr)); - util_strlcat(attr, "/", sizeof(attr)); - util_strlcat(attr, key_name, sizeof(attr)); - } - - attr_subst_subdir(attr, sizeof(attr)); - - util_strlcpy(value, key_val(rule, &pair->key), sizeof(value)); - udev_rules_apply_format(event, value, sizeof(value)); - info(event->udev, "writing '%s' to sysfs file '%s'\n", value, attr); - f = fopen(attr, "w"); - if (f != NULL) { - if (!event->test) - if (fprintf(f, "%s", value) <= 0) - err(event->udev, "error writing ATTR{%s}: %m\n", attr); - fclose(f); - } else - err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); - } - } - return 0; - -nomatch: - return -1; -} - -int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) -{ - struct udev_device *dev = event->dev; - struct udev_rules_iter iter; - struct udev_rule *rule; - int name_set = 0; - - dbg(event->udev, "device: '%s'\n", udev_device_get_syspath(dev)); - - /* look for a matching rule to apply */ - udev_rules_iter_init(&iter, rules); - while (1) { - rule = udev_rules_iter_next(&iter); - if (rule == NULL) - break; - - if (name_set && - (rule->name.operation == KEY_OP_ASSIGN || - rule->name.operation == KEY_OP_ASSIGN_FINAL || - rule->name.operation == KEY_OP_ADD)) { - dbg(event->udev, "node name already set, rule ignored\n"); - continue; - } - - dbg(event->udev, "process rule\n"); - if (match_rule(event, rule) == 0) { - /* apply options */ - if (rule->ignore_device) { - info(event->udev, "rule applied, '%s' is ignored\n", udev_device_get_sysname(dev)); - event->ignore_device = 1; - return 0; - } - if (rule->ignore_remove) { - udev_device_set_ignore_remove(dev, 1); - dbg(event->udev, "remove event should be ignored\n"); - } - if (rule->link_priority != 0) { - udev_device_set_devlink_priority(dev, rule->link_priority); - info(event->udev, "devlink_priority=%i\n", rule->link_priority); - } - if (rule->event_timeout >= 0) { - udev_device_set_event_timeout(dev, rule->event_timeout); - info(event->udev, "event_timeout=%i\n", rule->event_timeout); - } - /* apply all_partitions option only at a disk device */ - if (rule->partitions > 0 && - strcmp(udev_device_get_subsystem(dev), "block") == 0 && - udev_device_get_sysnum(dev) == NULL) { - udev_device_set_num_fake_partitions(dev, rule->partitions); - dbg(event->udev, "creation of partition nodes requested\n"); - } - - /* apply permissions */ - if (!event->mode_final && rule->mode.operation != KEY_OP_UNSET) { - if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) - event->mode_final = 1; - char buf[20]; - util_strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); - udev_rules_apply_format(event, buf, sizeof(buf)); - event->mode = strtol(buf, NULL, 8); - dbg(event->udev, "applied mode=%#o to '%s'\n", - event->mode, udev_device_get_sysname(dev)); - } - if (!event->owner_final && rule->owner.operation != KEY_OP_UNSET) { - if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) - event->owner_final = 1; - util_strlcpy(event->owner, key_val(rule, &rule->owner), sizeof(event->owner)); - udev_rules_apply_format(event, event->owner, sizeof(event->owner)); - dbg(event->udev, "applied owner='%s' to '%s'\n", - event->owner, udev_device_get_sysname(dev)); - } - if (!event->group_final && rule->group.operation != KEY_OP_UNSET) { - if (rule->group.operation == KEY_OP_ASSIGN_FINAL) - event->group_final = 1; - util_strlcpy(event->group, key_val(rule, &rule->group), sizeof(event->group)); - udev_rules_apply_format(event, event->group, sizeof(event->group)); - dbg(event->udev, "applied group='%s' to '%s'\n", - event->group, udev_device_get_sysname(dev)); - } - - /* collect symlinks */ - if (!event->devlink_final && - (rule->symlink.operation == KEY_OP_ASSIGN || - rule->symlink.operation == KEY_OP_ASSIGN_FINAL || - rule->symlink.operation == KEY_OP_ADD)) { - char temp[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - char *pos, *next; - int count = 0; - - if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) - event->devlink_final = 1; - if (rule->symlink.operation == KEY_OP_ASSIGN || - rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { - info(event->udev, "reset symlink list\n"); - udev_device_cleanup_devlinks_list(dev); - } - /* allow multiple symlinks separated by spaces */ - util_strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); - udev_rules_apply_format(event, temp, sizeof(temp)); - if (rule->string_escape == ESCAPE_UNSET) - count = util_replace_chars(temp, ALLOWED_CHARS_FILE " "); - else if (rule->string_escape == ESCAPE_REPLACE) - count = util_replace_chars(temp, ALLOWED_CHARS_FILE); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); - pos = temp; - while (isspace(pos[0])) - pos++; - next = strchr(pos, ' '); - while (next) { - next[0] = '\0'; - info(event->udev, "add symlink '%s'\n", pos); - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, pos, sizeof(filename)); - udev_device_add_devlink(dev, filename); - while (isspace(next[1])) - next++; - pos = &next[1]; - next = strchr(pos, ' '); - } - if (pos[0] != '\0') { - info(event->udev, "add symlink '%s'\n", pos); - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, pos, sizeof(filename)); - udev_device_add_devlink(dev, filename); - } - } - - /* set name, later rules with name set will be ignored */ - if (rule->name.operation == KEY_OP_ASSIGN || - rule->name.operation == KEY_OP_ASSIGN_FINAL || - rule->name.operation == KEY_OP_ADD) { - int count; - - name_set = 1; - util_strlcpy(event->name, key_val(rule, &rule->name), sizeof(event->name)); - udev_rules_apply_format(event, event->name, sizeof(event->name)); - if (rule->string_escape == ESCAPE_UNSET || - rule->string_escape == ESCAPE_REPLACE) { - count = util_replace_chars(event->name, ALLOWED_CHARS_FILE); - if (count > 0) - info(event->udev, "%i character(s) replaced\n", count); - } - - info(event->udev, "rule applied, '%s' becomes '%s'\n", - udev_device_get_sysname(dev), event->name); - if (strcmp(udev_device_get_subsystem(dev), "net") != 0) - dbg(event->udev, "'%s' owner='%s', group='%s', mode=%#o partitions=%i\n", - event->name, event->owner, event->group, event->mode, - udev_device_get_num_fake_partitions(dev)); - } - - if (!event->run_final && rule->run.operation != KEY_OP_UNSET) { - struct udev_list_entry *list_entry; - - if (rule->run.operation == KEY_OP_ASSIGN_FINAL) - event->run_final = 1; - if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info(event->udev, "reset run list\n"); - udev_list_cleanup(event->udev, &event->run_list); - } - dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); - list_entry = udev_list_entry_add(event->udev, &event->run_list, - key_val(rule, &rule->run), NULL, 1, 0); - if (rule->run_ignore_error && list_entry != NULL) - udev_list_entry_set_flag(list_entry, 1); - } - - if (rule->last_rule) { - dbg(event->udev, "last rule to be applied\n"); - break; - } - - if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg(event->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_goto(&iter, rule->goto_rule_off); - } - } - } - - if (!name_set) { - info(event->udev, "no node name set, will use kernel name '%s'\n", - udev_device_get_sysname(dev)); - util_strlcpy(event->name, udev_device_get_sysname(dev), sizeof(event->name)); - } - - if (event->tmp_node[0] != '\0') { - dbg(event->udev, "removing temporary device node\n"); - unlink_secure(event->udev, event->tmp_node); - event->tmp_node[0] = '\0'; - } - return 0; -} - -int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event) -{ - struct udev_device *dev = event->dev; - struct udev_rules_iter iter; - struct udev_rule *rule; - - dbg(event->udev, "sysname: '%s'\n", udev_device_get_sysname(dev)); - - /* look for a matching rule to apply */ - udev_rules_iter_init(&iter, rules); - while (1) { - rule = udev_rules_iter_next(&iter); - if (rule == NULL) - break; - - dbg(event->udev, "process rule\n"); - if (rule->name.operation == KEY_OP_ASSIGN || - rule->name.operation == KEY_OP_ASSIGN_FINAL || - rule->name.operation == KEY_OP_ADD || - rule->symlink.operation == KEY_OP_ASSIGN || - rule->symlink.operation == KEY_OP_ASSIGN_FINAL || - rule->symlink.operation == KEY_OP_ADD || - rule->mode.operation != KEY_OP_UNSET || - rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { - dbg(event->udev, "skip rule that names a device\n"); - continue; - } - - if (match_rule(event, rule) == 0) { - if (rule->ignore_device) { - info(event->udev, "rule applied, '%s' is ignored\n", udev_device_get_sysname(dev)); - event->ignore_device = 1; - return 0; - } - if (rule->ignore_remove) { - udev_device_set_ignore_remove(dev, 1); - dbg(event->udev, "remove event should be ignored\n"); - } - - if (!event->run_final && rule->run.operation != KEY_OP_UNSET) { - struct udev_list_entry *list_entry; - - if (rule->run.operation == KEY_OP_ASSIGN || - rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info(event->udev, "reset run list\n"); - udev_list_cleanup(event->udev, &event->run_list); - } - dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); - list_entry = udev_list_entry_add(event->udev, &event->run_list, - key_val(rule, &rule->run), NULL, 1, 0); - if (rule->run_ignore_error && list_entry != NULL) - udev_list_entry_set_flag(list_entry, 1); - if (rule->run.operation == KEY_OP_ASSIGN_FINAL) - break; - } - - if (rule->last_rule) { - dbg(event->udev, "last rule to be applied\n"); - break; - } - - if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg(event->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_goto(&iter, rule->goto_rule_off); - } - } - } - - return 0; -} diff --git a/udev/udev_rules.h b/udev/udev_rules.h deleted file mode 100644 index d8f2f367c9..0000000000 --- a/udev/udev_rules.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef UDEV_RULES_H -#define UDEV_RULES_H - -#include "udev.h" - -#define PAIRS_MAX 5 - -enum key_operation { - KEY_OP_UNSET, - KEY_OP_MATCH, - KEY_OP_NOMATCH, - KEY_OP_ADD, - KEY_OP_ASSIGN, - KEY_OP_ASSIGN_FINAL, -}; - -struct key { - enum key_operation operation; - size_t val_off; -}; - -struct key_pair { - struct key key; - size_t key_name_off; -}; - -struct key_pairs { - int count; - struct key_pair keys[PAIRS_MAX]; -}; - -enum import_type { - IMPORT_UNSET, - IMPORT_PROGRAM, - IMPORT_FILE, - IMPORT_PARENT, -}; - -enum escape_type { - ESCAPE_UNSET, - ESCAPE_NONE, - ESCAPE_REPLACE, -}; - -struct udev_rule { - struct key action; - struct key devpath; - struct key kernel; - struct key subsystem; - struct key driver; - struct key_pairs attr; - - struct key kernels; - struct key subsystems; - struct key drivers; - struct key_pairs attrs; - - struct key_pairs env; - struct key program; - struct key result; - struct key import; - enum import_type import_type; - struct key test; - mode_t test_mode_mask; - struct key run; - struct key wait_for; - struct key label; - struct key goto_label; - size_t goto_rule_off; - - struct key name; - struct key symlink; - struct key symlink_match; - struct key owner; - struct key group; - struct key mode; - enum escape_type string_escape; - - unsigned int link_priority; - int event_timeout; - unsigned int partitions; - unsigned int last_rule:1, - run_ignore_error:1, - ignore_device:1, - ignore_remove:1; - - size_t bufsize; - char buf[]; -}; - -struct udev_rules { - struct udev *udev; - char *buf; - size_t bufsize; - int resolve_names; -}; - -struct udev_rules_iter { - struct udev_rules *rules; - size_t current; -}; - -extern int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names); -extern void udev_rules_cleanup(struct udev_rules *rules); - -extern void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules); -extern struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter); -extern struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off); - -extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event); -extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event); -extern int udev_rules_run(struct udev_event *event); - -extern void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize); - -#endif diff --git a/udev/udev_rules_parse.c b/udev/udev_rules_parse.c deleted file mode 100644 index c42bd08c51..0000000000 --- a/udev/udev_rules_parse.c +++ /dev/null @@ -1,850 +0,0 @@ -/* - * Copyright (C) 2003,2004 Greg Kroah-Hartman - * Copyright (C) 2003-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev_rules.h" - - -void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules) -{ - dbg(rules->udev, "bufsize=%zi\n", rules->bufsize); - iter->rules = rules; - iter->current = 0; -} - -struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter) -{ - struct udev_rules *rules; - struct udev_rule *rule; - - rules = iter->rules; - if (!rules) - return NULL; - - dbg(rules->udev, "current=%zi\n", iter->current); - if (iter->current >= rules->bufsize) { - dbg(rules->udev, "no more rules\n"); - return NULL; - } - - /* get next rule */ - rule = (struct udev_rule *) (rules->buf + iter->current); - iter->current += sizeof(struct udev_rule) + rule->bufsize; - - return rule; -} - -struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off) -{ - struct udev_rules *rules = iter->rules; - struct udev_rule *rule; - - dbg(rules->udev, "current=%zi\n", iter->current); - iter->current = rule_off; - rule = (struct udev_rule *) (rules->buf + iter->current); - - return rule; -} - -static size_t find_label(const struct udev_rules_iter *iter, const char *label) -{ - struct udev_rule *rule; - struct udev_rules *rules = iter->rules; - size_t current = iter->current; - -next: - dbg(rules->udev, "current=%zi\n", current); - if (current >= rules->bufsize) { - dbg(rules->udev, "LABEL='%s' not found\n", label); - return 0; - } - rule = (struct udev_rule *) (rules->buf + current); - - if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { - dbg(rules->udev, "moving forward, looking for label '%s'\n", label); - current += sizeof(struct udev_rule) + rule->bufsize; - goto next; - } - - dbg(rules->udev, "found label '%s'\n", label); - return current; -} - -static int get_key(struct udev_rules *rules, char **line, char **key, enum key_operation *operation, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (linepos == NULL && linepos[0] == '\0') - return -1; - - /* skip whitespace */ - while (isspace(linepos[0]) || linepos[0] == ',') - linepos++; - - /* get the key */ - if (linepos[0] == '\0') - return -1; - *key = linepos; - - while (1) { - linepos++; - if (linepos[0] == '\0') - return -1; - if (isspace(linepos[0])) - break; - if (linepos[0] == '=') - break; - if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) - if (linepos[1] == '=') - break; - } - - /* remember end of key */ - temp = linepos; - - /* skip whitespace after key */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get operation type */ - if (linepos[0] == '=' && linepos[1] == '=') { - *operation = KEY_OP_MATCH; - linepos += 2; - dbg(rules->udev, "operator=match\n"); - } else if (linepos[0] == '!' && linepos[1] == '=') { - *operation = KEY_OP_NOMATCH; - linepos += 2; - dbg(rules->udev, "operator=nomatch\n"); - } else if (linepos[0] == '+' && linepos[1] == '=') { - *operation = KEY_OP_ADD; - linepos += 2; - dbg(rules->udev, "operator=add\n"); - } else if (linepos[0] == '=') { - *operation = KEY_OP_ASSIGN; - linepos++; - dbg(rules->udev, "operator=assign\n"); - } else if (linepos[0] == ':' && linepos[1] == '=') { - *operation = KEY_OP_ASSIGN_FINAL; - linepos += 2; - dbg(rules->udev, "operator=assign_final\n"); - } else - return -1; - - /* terminate key */ - temp[0] = '\0'; - dbg(rules->udev, "key='%s'\n", *key); - - /* skip whitespace after operator */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get the value*/ - if (linepos[0] == '"') - linepos++; - else - return -1; - *value = linepos; - - temp = strchr(linepos, '"'); - if (!temp) - return -1; - temp[0] = '\0'; - temp++; - dbg(rules->udev, "value='%s'\n", *value); - - /* move line to next key */ - *line = temp; - - return 0; -} - -/* extract possible KEY{attr} */ -static char *get_key_attribute(struct udev_rules *rules, char *str) -{ - char *pos; - char *attr; - - attr = strchr(str, '{'); - if (attr != NULL) { - attr++; - pos = strchr(attr, '}'); - if (pos == NULL) { - err(rules->udev, "missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - dbg(rules->udev, "attribute='%s'\n", attr); - return attr; - } - - return NULL; -} - -static int add_rule_key(struct udev_rule *rule, struct key *key, - enum key_operation operation, const char *value) -{ - size_t val_len = strnlen(value, UTIL_PATH_SIZE); - - key->operation = operation; - - key->val_off = rule->bufsize; - util_strlcpy(rule->buf + rule->bufsize, value, val_len+1); - rule->bufsize += val_len+1; - - return 0; -} - -static int add_rule_key_pair(struct udev_rules *rules, struct udev_rule *rule, struct key_pairs *pairs, - enum key_operation operation, const char *key, const char *value) -{ - size_t key_len = strnlen(key, UTIL_PATH_SIZE); - - if (pairs->count >= PAIRS_MAX) { - err(rules->udev, "skip, too many keys of the same type in a single rule\n"); - return -1; - } - - add_rule_key(rule, &pairs->keys[pairs->count].key, operation, value); - - /* add the key-name of the pair */ - pairs->keys[pairs->count].key_name_off = rule->bufsize; - util_strlcpy(rule->buf + rule->bufsize, key, key_len+1); - rule->bufsize += key_len+1; - - pairs->count++; - - return 0; -} - -static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) -{ - char buf[sizeof(struct udev_rule) + UTIL_LINE_SIZE]; - struct udev_rule *rule; - size_t rule_size; - int valid; - char *linepos; - char *attr; - size_t padding; - int physdev = 0; - int retval; - - memset(buf, 0x00, sizeof(buf)); - rule = (struct udev_rule *) buf; - rule->event_timeout = -1; - linepos = line; - valid = 0; - - /* get all the keys */ - while (1) { - char *key; - char *value; - enum key_operation operation = KEY_OP_UNSET; - - retval = get_key(rules, &linepos, &key, &operation, &value); - if (retval) - break; - - if (strcasecmp(key, "ACTION") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid ACTION operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->action, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DEVPATH") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid DEVPATH operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->devpath, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "KERNEL") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid KERNEL operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->kernel, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "SUBSYSTEM") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid SUBSYSTEM operation\n"); - goto invalid; - } - /* bus, class, subsystem events should all be the same */ - if (strcmp(value, "subsystem") == 0 || - strcmp(value, "bus") == 0 || - strcmp(value, "class") == 0) { - if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) - err(rules->udev, "'%s' must be specified as 'subsystem' \n" - "please fix it in %s:%u", value, filename, lineno); - add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); - } else - add_rule_key(rule, &rule->subsystem, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DRIVER") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid DRIVER operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->driver, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("ATTR")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTR attribute\n"); - goto invalid; - } - if (add_rule_key_pair(rules, rule, &rule->attr, operation, attr, value) != 0) - goto invalid; - valid = 1; - continue; - } - - if (strcasecmp(key, "KERNELS") == 0 || - strcasecmp(key, "ID") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid KERNELS operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->kernels, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "SUBSYSTEMS") == 0 || - strcasecmp(key, "BUS") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid SUBSYSTEMS operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->subsystems, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DRIVERS") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid DRIVERS operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->drivers, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || - strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid ATTRS operation\n"); - goto invalid; - } - attr = get_key_attribute(rules, key + sizeof("ATTRS")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTRS attribute\n"); - goto invalid; - } - if (strncmp(attr, "device/", 7) == 0) - err(rules->udev, "the 'device' link is deprecated and will be removed from a future kernel, \n" - "please fix it in %s:%u", filename, lineno); - else if (strstr(attr, "../") != NULL) - err(rules->udev, "do not reference parent sysfs directories directly, that may break with a future kernel, \n" - "please fix it in %s:%u", filename, lineno); - if (add_rule_key_pair(rules, rule, &rule->attrs, operation, attr, value) != 0) - goto invalid; - valid = 1; - continue; - } - - if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("ENV")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ENV attribute\n"); - goto invalid; - } - if (strncmp(attr, "PHYSDEV", 7) == 0) - physdev = 1; - if (add_rule_key_pair(rules, rule, &rule->env, operation, attr, value) != 0) - goto invalid; - valid = 1; - continue; - } - - if (strcasecmp(key, "PROGRAM") == 0) { - add_rule_key(rule, &rule->program, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "RESULT") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid RESULT operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->result, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("IMPORT")-1); - if (attr != NULL && strstr(attr, "program")) { - dbg(rules->udev, "IMPORT will be executed\n"); - rule->import_type = IMPORT_PROGRAM; - } else if (attr != NULL && strstr(attr, "file")) { - dbg(rules->udev, "IMPORT will be included as file\n"); - rule->import_type = IMPORT_FILE; - } else if (attr != NULL && strstr(attr, "parent")) { - dbg(rules->udev, "IMPORT will include the parent values\n"); - rule->import_type = IMPORT_PARENT; - } else { - /* figure it out if it is executable */ - char file[UTIL_PATH_SIZE]; - char *pos; - struct stat statbuf; - - util_strlcpy(file, value, sizeof(file)); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - - /* allow programs in /lib/udev called without the path */ - if (strchr(file, '/') == NULL) { - util_strlcpy(file, UDEV_PREFIX "/lib/udev/", sizeof(file)); - util_strlcat(file, value, sizeof(file)); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - } - - dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); - if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { - dbg(rules->udev, "IMPORT is executable, will be executed (autotype)\n"); - rule->import_type = IMPORT_PROGRAM; - } else { - dbg(rules->udev, "IMPORT is not executable, will be included as file (autotype)\n"); - rule->import_type = IMPORT_FILE; - } - } - add_rule_key(rule, &rule->import, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid TEST operation\n"); - goto invalid; - } - attr = get_key_attribute(rules, key + sizeof("TEST")-1); - if (attr != NULL) - rule->test_mode_mask = strtol(attr, NULL, 8); - add_rule_key(rule, &rule->test, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("RUN")-1); - if (attr != NULL) { - if (strstr(attr, "ignore_error")) - rule->run_ignore_error = 1; - } - add_rule_key(rule, &rule->run, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { - add_rule_key(rule, &rule->wait_for, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "LABEL") == 0) { - add_rule_key(rule, &rule->label, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "GOTO") == 0) { - add_rule_key(rule, &rule->goto_label, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("NAME")-1); - if (attr != NULL) { - if (strstr(attr, "all_partitions") != NULL) { - dbg(rules->udev, "creation of partition nodes requested\n"); - rule->partitions = DEFAULT_PARTITIONS_COUNT; - } - if (strstr(attr, "ignore_remove") != NULL) { - dbg(rules->udev, "remove event should be ignored\n"); - rule->ignore_remove = 1; - } - } - if (value[0] == '\0') - dbg(rules->udev, "name empty, node creation supressed\n"); - add_rule_key(rule, &rule->name, operation, value); - continue; - } - - if (strcasecmp(key, "SYMLINK") == 0) { - if (operation == KEY_OP_MATCH || - operation == KEY_OP_NOMATCH) - add_rule_key(rule, &rule->symlink_match, operation, value); - else - add_rule_key(rule, &rule->symlink, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "OWNER") == 0) { - valid = 1; - if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { - char *endptr; - strtoul(value, &endptr, 10); - if (endptr[0] != '\0') { - char owner[32]; - uid_t uid = lookup_user(rules->udev, value); - dbg(rules->udev, "replacing username='%s' by id=%i\n", value, uid); - sprintf(owner, "%u", (unsigned int) uid); - add_rule_key(rule, &rule->owner, operation, owner); - continue; - } - } - - add_rule_key(rule, &rule->owner, operation, value); - continue; - } - - if (strcasecmp(key, "GROUP") == 0) { - valid = 1; - if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { - char *endptr; - strtoul(value, &endptr, 10); - if (endptr[0] != '\0') { - char group[32]; - gid_t gid = lookup_group(rules->udev, value); - dbg(rules->udev, "replacing groupname='%s' by id=%i\n", value, gid); - sprintf(group, "%u", (unsigned int) gid); - add_rule_key(rule, &rule->group, operation, group); - continue; - } - } - - add_rule_key(rule, &rule->group, operation, value); - continue; - } - - if (strcasecmp(key, "MODE") == 0) { - add_rule_key(rule, &rule->mode, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "OPTIONS") == 0) { - const char *pos; - - if (strstr(value, "last_rule") != NULL) { - dbg(rules->udev, "last rule to be applied\n"); - rule->last_rule = 1; - } - if (strstr(value, "ignore_device") != NULL) { - dbg(rules->udev, "device should be ignored\n"); - rule->ignore_device = 1; - } - if (strstr(value, "ignore_remove") != NULL) { - dbg(rules->udev, "remove event should be ignored\n"); - rule->ignore_remove = 1; - } - pos = strstr(value, "link_priority="); - if (pos != NULL) { - rule->link_priority = atoi(&pos[strlen("link_priority=")]); - dbg(rules->udev, "link priority=%i\n", rule->link_priority); - } - pos = strstr(value, "event_timeout="); - if (pos != NULL) { - rule->event_timeout = atoi(&pos[strlen("event_timeout=")]); - dbg(rules->udev, "event timout=%i\n", rule->event_timeout); - } - pos = strstr(value, "string_escape="); - if (pos != NULL) { - pos = &pos[strlen("string_escape=")]; - if (strncmp(pos, "none", strlen("none")) == 0) - rule->string_escape = ESCAPE_NONE; - else if (strncmp(pos, "replace", strlen("replace")) == 0) - rule->string_escape = ESCAPE_REPLACE; - } - if (strstr(value, "all_partitions") != NULL) { - dbg(rules->udev, "creation of partition nodes requested\n"); - rule->partitions = DEFAULT_PARTITIONS_COUNT; - } - valid = 1; - continue; - } - - err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); - } - - if (physdev && rule->wait_for.operation == KEY_OP_UNSET) - err(rules->udev, "PHYSDEV* values are deprecated and will be removed from a future kernel, \n" - "please fix it in %s:%u", filename, lineno); - - /* skip line if not any valid key was found */ - if (!valid) - goto invalid; - - /* grow buffer and add rule */ - rule_size = sizeof(struct udev_rule) + rule->bufsize; - padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); - dbg(rules->udev, "add %zi padding bytes\n", padding); - rule_size += padding; - rule->bufsize += padding; - - rules->buf = realloc(rules->buf, rules->bufsize + rule_size); - if (!rules->buf) { - err(rules->udev, "realloc failed\n"); - goto exit; - } - dbg(rules->udev, "adding rule to offset %zi\n", rules->bufsize); - memcpy(rules->buf + rules->bufsize, rule, rule_size); - rules->bufsize += rule_size; -exit: - return 0; - -invalid: - err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); - return -1; -} - -static int parse_file(struct udev_rules *rules, const char *filename) -{ - char line[UTIL_LINE_SIZE]; - char *bufline; - unsigned int lineno; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - int retval = 0; - size_t start; - struct udev_rule *rule; - struct udev_rules_iter iter; - - start = rules->bufsize; - - if (file_map(filename, &buf, &bufsize) != 0) { - err(rules->udev, "can't open '%s' as rules file: %m\n", filename); - return -1; - } - info(rules->udev, "reading '%s' as rules file\n", filename); - - /* loop through the whole file */ - cur = 0; - lineno = 0; - while (cur < bufsize) { - unsigned int i, j; - - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; - - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) - continue; - - /* see if this is a comment */ - if (bufline[0] == '#') - continue; - - if (count >= sizeof(line)) { - err(rules->udev, "line too long, rule skipped '%s:%u'\n", filename, lineno); - continue; - } - - /* skip backslash and newline from multiline rules */ - for (i = j = 0; i < count; i++) { - if (bufline[i] == '\\' && bufline[i+1] == '\n') - continue; - - line[j++] = bufline[i]; - } - line[j] = '\0'; - - dbg(rules->udev, "read '%s'\n", line); - add_to_rules(rules, line, filename, lineno); - } - - /* Compute all goto targets within this file */ - udev_rules_iter_init(&iter, rules); - udev_rules_iter_goto(&iter, start); - while((rule = udev_rules_iter_next(&iter))) { - if (rule->goto_label.operation != KEY_OP_UNSET) { - char *goto_label = &rule->buf[rule->goto_label.val_off]; - - dbg(rules->udev, "resolving goto label '%s'\n", goto_label); - rule->goto_rule_off = find_label(&iter, goto_label); - if (rule->goto_rule_off == 0) { - err(rules->udev, "ignore goto to nonexistent label '%s' in '%s'\n", - goto_label, filename); - rule->goto_rule_off = iter.current; - } - } - } - - file_unmap(buf, bufsize); - return retval; -} - -int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names) -{ - struct stat statbuf; - char filename[PATH_MAX]; - LIST_HEAD(name_list); - LIST_HEAD(sort_list); - struct name_entry *name_loop, *name_tmp; - struct name_entry *sort_loop, *sort_tmp; - int retval = 0; - - memset(rules, 0x00, sizeof(struct udev_rules)); - rules->udev = udev; - rules->resolve_names = resolve_names; - - if (udev_get_rules_path(udev) != NULL) { - /* custom rules location for testing */ - add_matching_files(udev, &name_list, udev_get_rules_path(udev), ".rules"); - } else { - /* read user/custom rules */ - add_matching_files(udev, &name_list, SYSCONFDIR "/udev/rules.d", ".rules"); - - /* read dynamic/temporary rules */ - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - util_strlcat(filename, "/.udev/rules.d", sizeof(filename)); - if (stat(filename, &statbuf) != 0) { - create_path(udev, filename); - udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); - mkdir(filename, 0755); - udev_selinux_resetfscreatecon(udev); - } - add_matching_files(udev, &sort_list, filename, ".rules"); - - /* read default rules */ - add_matching_files(udev, &sort_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); - - /* sort all rules files by basename into list of files */ - list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) { - const char *sort_base = strrchr(sort_loop->name, '/'); - - if (sort_base == NULL) - continue; - - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - const char *name_base = strrchr(name_loop->name, '/'); - - if (name_base == NULL) - continue; - - if (strcmp(name_base, sort_base) == 0) { - info(udev, "rule file '%s' already added, ignoring '%s'\n", - name_loop->name, sort_loop->name); - list_del(&sort_loop->node); - free(sort_loop); - sort_loop = NULL; - continue; - } - - if (strcmp(name_base, sort_base) > 0) - break; - } - if (sort_loop != NULL) - list_move_tail(&sort_loop->node, &name_loop->node); - } - } - - /* parse list of files */ - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - if (stat(name_loop->name, &statbuf) == 0) { - if (statbuf.st_size) - parse_file(rules, name_loop->name); - else - dbg(udev, "empty rules file '%s'\n", name_loop->name); - } else - err(udev, "could not read '%s': %m\n", name_loop->name); - list_del(&name_loop->node); - free(name_loop); - } - - return retval; -} - -void udev_rules_cleanup(struct udev_rules *rules) -{ - if (rules->buf) { - free(rules->buf); - rules->buf = NULL; - } -} - diff --git a/udev/udev_selinux.c b/udev/udev_selinux.c deleted file mode 100644 index cf7f43496a..0000000000 --- a/udev/udev_selinux.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int selinux_enabled; -security_context_t selinux_prev_scontext; - -void selinux_init(struct udev *udev) -{ - /* record the present security context */ - selinux_enabled = (is_selinux_enabled() > 0); - info(udev, "selinux=%i\n", selinux_enabled); - if (!selinux_enabled) - return; - matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); - if (getfscreatecon(&selinux_prev_scontext) < 0) { - err(udev, "getfscreatecon failed\n"); - selinux_prev_scontext = NULL; - } -} - -void selinux_exit(struct udev *udev) -{ - if (!selinux_enabled) - return; - freecon(selinux_prev_scontext); - selinux_prev_scontext = NULL; -} - -void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) -{ - security_context_t scontext = NULL; - - if (!selinux_enabled) - return; - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (lsetfilecon(file, scontext) < 0) - err(udev, "setfilecon %s failed: %m\n", file); - freecon(scontext); -} - -void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) -{ - security_context_t scontext = NULL; - - if (!selinux_enabled) - return; - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (setfscreatecon(scontext) < 0) - err(udev, "setfscreatecon %s failed: %m\n", file); - freecon(scontext); -} - -void udev_selinux_resetfscreatecon(struct udev *udev) -{ - if (!selinux_enabled) - return; - if (setfscreatecon(selinux_prev_scontext) < 0) - err(udev, "setfscreatecon failed: %m\n"); -} diff --git a/udev/udev_sysdeps.h b/udev/udev_sysdeps.h deleted file mode 100644 index eaeab86f6b..0000000000 --- a/udev/udev_sysdeps.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * wrapping of libc features and kernel interfaces - * - * Copyright (C) 2005-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _UDEV_SYSDEPS_H_ -#define _UDEV_SYSDEPS_H_ - -#include - -/* needed for our signal handlers to work */ -#undef asmlinkage -#ifdef __i386__ -#define asmlinkage __attribute__((regparm(0))) -#else -#define asmlinkage -#endif /* __i386__ */ - -#ifndef HAVE_INOTIFY -static inline int inotify_init(void) -{ - return -1; -} - -static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) -{ - return -1; -} - -#define IN_CREATE 0 -#define IN_DELETE 0 -#define IN_MOVE 0 -#define IN_CLOSE_WRITE 0 - -#endif /* HAVE_INOTIFY */ -#endif diff --git a/udev/udev_utils.c b/udev/udev_utils.c deleted file mode 100644 index 4623c30caf..0000000000 --- a/udev/udev_utils.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -struct name_entry *name_list_add(struct udev *udev, struct list_head *name_list, const char *name, int sort) -{ - struct name_entry *name_loop; - struct name_entry *name_new; - - /* avoid duplicate entries */ - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) == 0) { - dbg(udev, "'%s' is already in the list\n", name); - return name_loop; - } - } - - if (sort) - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) > 0) - break; - } - - name_new = malloc(sizeof(struct name_entry)); - if (name_new == NULL) - return NULL; - memset(name_new, 0x00, sizeof(struct name_entry)); - util_strlcpy(name_new->name, name, sizeof(name_new->name)); - dbg(udev, "adding '%s'\n", name_new->name); - list_add_tail(&name_new->node, &name_loop->node); - - return name_new; -} - -struct name_entry *name_list_key_add(struct udev *udev, struct list_head *name_list, const char *key, const char *value) -{ - struct name_entry *name_loop; - struct name_entry *name_new; - size_t keylen = strlen(key); - - list_for_each_entry(name_loop, name_list, node) { - if (strncmp(name_loop->name, key, keylen) != 0) - continue; - if (name_loop->name[keylen] != '=') - continue; - dbg(udev, "key already present '%s', replace it\n", name_loop->name); - snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); - name_loop->name[sizeof(name_loop->name)-1] = '\0'; - return name_loop; - } - - name_new = malloc(sizeof(struct name_entry)); - if (name_new == NULL) - return NULL; - memset(name_new, 0x00, sizeof(struct name_entry)); - snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); - name_new->name[sizeof(name_new->name)-1] = '\0'; - dbg(udev, "adding '%s'\n", name_new->name); - list_add_tail(&name_new->node, &name_loop->node); - - return name_new; -} - -int name_list_key_remove(struct udev *udev, struct list_head *name_list, const char *key) -{ - struct name_entry *name_loop; - struct name_entry *name_tmp; - size_t keylen = strlen(key); - int retval = 0; - - list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { - if (strncmp(name_loop->name, key, keylen) != 0) - continue; - if (name_loop->name[keylen] != '=') - continue; - list_del(&name_loop->node); - free(name_loop); - retval = 1; - break; - } - return retval; -} - -void name_list_cleanup(struct udev *udev, struct list_head *name_list) -{ - struct name_entry *name_loop; - struct name_entry *name_tmp; - - list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { - list_del(&name_loop->node); - free(name_loop); - } -} - -/* calls function for every file found in specified directory */ -int add_matching_files(struct udev *udev, struct list_head *name_list, const char *dirname, const char *suffix) -{ - struct dirent *ent; - DIR *dir; - char filename[UTIL_PATH_SIZE]; - - dbg(udev, "open directory '%s'\n", dirname); - dir = opendir(dirname); - if (dir == NULL) { - err(udev, "unable to open '%s': %m\n", dirname); - return -1; - } - - while (1) { - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - - if ((ent->d_name[0] == '.') || (ent->d_name[0] == '#')) - continue; - - /* look for file matching with specified suffix */ - if (suffix != NULL) { - const char *ext; - - ext = strrchr(ent->d_name, '.'); - if (ext == NULL) - continue; - if (strcmp(ext, suffix) != 0) - continue; - } - dbg(udev, "put file '%s/%s' into list\n", dirname, ent->d_name); - - snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); - filename[sizeof(filename)-1] = '\0'; - name_list_add(udev, name_list, filename, 1); - } - - closedir(dir); - return 0; -} - -uid_t lookup_user(struct udev *udev, const char *user) -{ - struct passwd *pw; - uid_t uid = 0; - - errno = 0; - pw = getpwnam(user); - if (pw == NULL) { - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err(udev, "specified user '%s' unknown\n", user); - else - err(udev, "error resolving user '%s': %m\n", user); - } else - uid = pw->pw_uid; - - return uid; -} - -extern gid_t lookup_group(struct udev *udev, const char *group) -{ - struct group *gr; - gid_t gid = 0; - - errno = 0; - gr = getgrnam(group); - if (gr == NULL) { - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err(udev, "specified group '%s' unknown\n", group); - else - err(udev, "error resolving group '%s': %m\n", group); - } else - gid = gr->gr_gid; - - return gid; -} - diff --git a/udev/udev_utils_file.c b/udev/udev_utils_file.c deleted file mode 100644 index 84ff09e050..0000000000 --- a/udev/udev_utils_file.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -int create_path(struct udev *udev, const char *path) -{ - char p[UTIL_PATH_SIZE]; - char *pos; - struct stat stats; - int ret; - - util_strlcpy(p, path, sizeof(p)); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (pos[-1] == '/') - pos--; - pos[0] = '\0'; - - dbg(udev, "stat '%s'\n", p); - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - - if (create_path(udev, p) != 0) - return -1; - - dbg(udev, "mkdir '%s'\n", p); - udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); - ret = mkdir(p, 0755); - udev_selinux_resetfscreatecon(udev); - if (ret == 0) - return 0; - - if (errno == EEXIST) - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - return -1; -} - -int delete_path(struct udev *udev, const char *path) -{ - char p[UTIL_PATH_SIZE]; - char *pos; - int retval; - - strcpy (p, path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (1) { - *pos = '\0'; - pos = strrchr(p, '/'); - - /* don't remove the last one */ - if ((pos == p) || (pos == NULL)) - break; - - /* remove if empty */ - retval = rmdir(p); - if (errno == ENOENT) - retval = 0; - if (retval) { - if (errno == ENOTEMPTY) - return 0; - err(udev, "rmdir(%s) failed: %m\n", p); - break; - } - dbg(udev, "removed '%s'\n", p); - } - return 0; -} - -/* Reset permissions on the device node, before unlinking it to make sure, - * that permisions of possible hard links will be removed too. - */ -int unlink_secure(struct udev *udev, const char *filename) -{ - int retval; - - retval = chown(filename, 0, 0); - if (retval) - err(udev, "chown(%s, 0, 0) failed: %m\n", filename); - - retval = chmod(filename, 0000); - if (retval) - err(udev, "chmod(%s, 0000) failed: %m\n", filename); - - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - - if (retval) - err(udev, "unlink(%s) failed: %m\n", filename); - - return retval; -} - -int file_map(const char *filename, char **buf, size_t *bufsize) -{ - struct stat stats; - int fd; - - fd = open(filename, O_RDONLY); - if (fd < 0) { - return -1; - } - - if (fstat(fd, &stats) < 0) { - close(fd); - return -1; - } - - *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (*buf == MAP_FAILED) { - close(fd); - return -1; - } - *bufsize = stats.st_size; - - close(fd); - - return 0; -} - -void file_unmap(void *buf, size_t bufsize) -{ - munmap(buf, bufsize); -} - -/* return number of chars until the next newline, skip escaped newline */ -size_t buf_get_line(const char *buf, size_t buflen, size_t cur) -{ - int escape = 0; - size_t count; - - for (count = cur; count < buflen; count++) { - if (!escape && buf[count] == '\n') - break; - - if (buf[count] == '\\') - escape = 1; - else - escape = 0; - } - - return count - cur; -} diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 70da9ebf67..090c524190 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -29,7 +29,7 @@ #include #include "udev.h" -#include "udev_rules.h" +#include "udev-rules.h" int udevadm_test(struct udev *udev, int argc, char *argv[]) { diff --git a/udev/udevd.c b/udev/udevd.c index 15ec0fbb03..1583e22ac9 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -40,7 +40,7 @@ #endif #include "udev.h" -#include "udev_rules.h" +#include "udev-rules.h" #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 -- cgit v1.2.3-54-g00ecf From 3fb629fd5e3e90e04dc6f6e07998a277f0515a32 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 18:51:05 +0200 Subject: libudev: always add UDEV_LOG --- udev/lib/libudev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index c698be6e46..511054a01a 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -198,7 +198,7 @@ struct udev *udev_new(void) } if (strcasecmp(key, "udev_log") == 0) { - udev->log_priority = util_log_priority(val); + udev_set_log_priority(udev, util_log_priority(val)); continue; } if (strcasecmp(key, "udev_root") == 0) { -- cgit v1.2.3-54-g00ecf From 3361a0f1105a2fe6000800431e8ef15293b41673 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 18:56:19 +0200 Subject: libudev: monitor - export MAJOR/MINOR only if available --- udev/lib/libudev-monitor.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 382fbfac5f..d0f28849aa 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -367,7 +367,8 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito udev_device_unref(udev_device); return NULL; } - udev_device_set_devnum(udev_device, makedev(maj, min)); + if (maj > 0) + udev_device_set_devnum(udev_device, makedev(maj, min)); udev_device_set_info_loaded(udev_device); return udev_device; } -- cgit v1.2.3-54-g00ecf From 7db6580f42325bedf88c8e5b79956545e0b07eb6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 19:23:07 +0200 Subject: udev-node: name_list -> udev_list --- udev/udev-node.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 9f2b6cf014..73075ee0aa 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -227,7 +227,7 @@ exit: return err; } -static int get_devices_by_name(struct udev *udev, const char *name, struct list_head *name_list) +static int name_index_get_devices(struct udev *udev, const char *name, struct udev_list_node *dev_list) { char dirname[PATH_MAX]; size_t devlen = strlen(udev_get_dev_path(udev))+1; @@ -239,15 +239,14 @@ static int get_devices_by_name(struct udev *udev, const char *name, struct list_ start = util_strlcat(dirname, "/.udev/names/", sizeof(dirname)); util_strlcat(dirname, &name[devlen], sizeof(dirname)); util_path_encode(&dirname[start], sizeof(dirname) - start); - dir = opendir(dirname); if (dir == NULL) { info(udev, "no index directory '%s': %m\n", dirname); count = -1; goto out; } - info(udev, "found index directory '%s'\n", dirname); + while (1) { struct dirent *ent; char device[UTIL_PATH_SIZE]; @@ -261,7 +260,7 @@ static int get_devices_by_name(struct udev *udev, const char *name, struct list_ util_strlcpy(device, udev_get_sys_path(udev), sizeof(device)); util_strlcat(device, ent->d_name, sizeof(device)); util_path_decode(device); - name_list_add(udev, name_list, device, 0); + udev_list_entry_add(udev, dev_list, device, NULL, 1, 0); count++; } closedir(dir); @@ -272,8 +271,8 @@ out: static int update_link(struct udev_device *dev, const char *slink, int test) { struct udev *udev = udev_device_get_udev(dev); - LIST_HEAD(name_list); - struct name_entry *device; + struct udev_list_node dev_list; + struct udev_list_entry *dev_entry; char target[UTIL_PATH_SIZE] = ""; int count; int priority = 0; @@ -281,7 +280,8 @@ static int update_link(struct udev_device *dev, const char *slink, int test) info(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); - count = get_devices_by_name(udev, slink, &name_list); + udev_list_init(&dev_list); + count = name_index_get_devices(udev, slink, &dev_list); info(udev, "found %i devices with name '%s'\n", count, slink); /* if we don't have a reference, delete it */ @@ -295,14 +295,16 @@ static int update_link(struct udev_device *dev, const char *slink, int test) } /* find the device with the highest priority */ - list_for_each_entry(device, &name_list, node) { + udev_list_entry_foreach(dev_entry, udev_list_get_entry(&dev_list)) { + const char *syspath; struct udev_device *dev_db; const char *devnode; - info(udev, "found '%s' for '%s'\n", device->name, slink); + syspath = udev_list_entry_get_name(dev_entry); + info(udev, "found '%s' for '%s'\n", syspath, slink); /* did we find ourself? we win, if we have the same priority */ - if (strcmp(udev_device_get_syspath(dev), device->name) == 0) { + if (strcmp(udev_device_get_syspath(dev), syspath) == 0) { info(udev, "compare (our own) priority of '%s' %i >= %i\n", udev_device_get_devpath(dev), udev_device_get_devlink_priority(dev), priority); if (strcmp(udev_device_get_devnode(dev), slink) == 0) { @@ -316,14 +318,14 @@ static int update_link(struct udev_device *dev, const char *slink, int test) } /* another device, read priority from database */ - dev_db = udev_device_new_from_syspath(udev, device->name); + dev_db = udev_device_new_from_syspath(udev, syspath); if (dev_db == NULL) continue; devnode = udev_device_get_devnode(dev_db); if (devnode != NULL) { if (strcmp(devnode, slink) == 0) { info(udev, "'%s' is a device node of '%s', skip link update\n", - devnode, device->name); + devnode, syspath); } else { info(udev, "compare priority of '%s' %i > %i\n", udev_device_get_devpath(dev_db), @@ -337,7 +339,7 @@ static int update_link(struct udev_device *dev, const char *slink, int test) } udev_device_unref(dev_db); } - name_list_cleanup(udev, &name_list); + udev_list_cleanup(udev, &dev_list); if (target[0] == '\0') { info(udev, "no current target for '%s' found\n", slink); -- cgit v1.2.3-54-g00ecf From daa849db6faf73fd712b6ff8fc63adcd7d82f178 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 20:12:16 +0200 Subject: udev-rules-parse: name_list -> udev_list --- udev/lib/libudev-list.c | 9 +++- udev/lib/libudev-private.h | 3 +- udev/udev-rules-parse.c | 104 ++++++++++++++++++++++++++++++++------------- udev/udev-util.c | 44 ------------------- udev/udev.h | 1 - 5 files changed, 84 insertions(+), 77 deletions(-) diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index ac57ee4ebf..918277cb64 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -165,7 +165,7 @@ void udev_list_cleanup(struct udev *udev, struct udev_list_node *list) struct udev_list_entry *entry_loop; struct udev_list_entry *entry_tmp; - list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) + udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) udev_list_entry_remove(entry_loop); } @@ -175,6 +175,13 @@ void udev_list_entry_move_to_end(struct udev_list_entry *list_entry) list_node_insert_between(&list_entry->node, list_entry->list->prev, list_entry->list); } +void udev_list_entry_move_to_list(struct udev_list_entry *list_entry, struct udev_list_node *list) +{ + list_node_remove(&list_entry->node); + list_node_insert_between(&list_entry->node, list->prev, list); + list_entry->list = list; +} + struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) { if (list_is_empty(list)) diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 040a48b0e3..6549669711 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -130,9 +130,10 @@ extern struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct ude extern void udev_list_entry_remove(struct udev_list_entry *entry); extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); extern void udev_list_entry_move_to_end(struct udev_list_entry *list_entry); +extern void udev_list_entry_move_to_list(struct udev_list_entry *list_entry, struct udev_list_node *list); extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry); extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); -#define list_entry_foreach_safe(entry, tmp, first) \ +#define udev_list_entry_foreach_safe(entry, tmp, first) \ for (entry = first, \ tmp = udev_list_entry_get_next(entry); \ entry != NULL; \ diff --git a/udev/udev-rules-parse.c b/udev/udev-rules-parse.c index 354ed2882d..737bbf4d92 100644 --- a/udev/udev-rules-parse.c +++ b/udev/udev-rules-parse.c @@ -22,8 +22,9 @@ #include #include #include -#include +#include #include +#include #include "udev.h" #include "udev-rules.h" @@ -759,26 +760,70 @@ static int parse_file(struct udev_rules *rules, const char *filename) return retval; } +static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix) +{ + struct dirent *ent; + DIR *dir; + char filename[UTIL_PATH_SIZE]; + + dbg(udev, "open directory '%s'\n", dirname); + dir = opendir(dirname); + if (dir == NULL) { + err(udev, "unable to open '%s': %m\n", dirname); + return -1; + } + + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + + if ((ent->d_name[0] == '.') || (ent->d_name[0] == '#')) + continue; + + /* look for file matching with specified suffix */ + if (suffix != NULL) { + const char *ext; + + ext = strrchr(ent->d_name, '.'); + if (ext == NULL) + continue; + if (strcmp(ext, suffix) != 0) + continue; + } + dbg(udev, "put file '%s/%s' into list\n", dirname, ent->d_name); + + snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); + filename[sizeof(filename)-1] = '\0'; + udev_list_entry_add(udev, file_list, filename, NULL, 1, 1); + } + + closedir(dir); + return 0; +} + int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names) { struct stat statbuf; char filename[PATH_MAX]; - LIST_HEAD(name_list); - LIST_HEAD(sort_list); - struct name_entry *name_loop, *name_tmp; - struct name_entry *sort_loop, *sort_tmp; + struct udev_list_node file_list; + struct udev_list_entry *file_loop, *file_tmp; int retval = 0; memset(rules, 0x00, sizeof(struct udev_rules)); rules->udev = udev; rules->resolve_names = resolve_names; + udev_list_init(&file_list); if (udev_get_rules_path(udev) != NULL) { /* custom rules location for testing */ - add_matching_files(udev, &name_list, udev_get_rules_path(udev), ".rules"); + add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); } else { + struct udev_list_node sort_list; + struct udev_list_entry *sort_loop, *sort_tmp; + /* read user/custom rules */ - add_matching_files(udev, &name_list, SYSCONFDIR "/udev/rules.d", ".rules"); + add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); /* read dynamic/temporary rules */ util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); @@ -789,54 +834,53 @@ int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_nam mkdir(filename, 0755); udev_selinux_resetfscreatecon(udev); } + udev_list_init(&sort_list); add_matching_files(udev, &sort_list, filename, ".rules"); /* read default rules */ add_matching_files(udev, &sort_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); /* sort all rules files by basename into list of files */ - list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) { - const char *sort_base = strrchr(sort_loop->name, '/'); + udev_list_entry_foreach_safe(sort_loop, sort_tmp, udev_list_get_entry(&sort_list)) { + const char *sort_name = udev_list_entry_get_name(sort_loop); + const char *sort_base = strrchr(sort_name, '/'); if (sort_base == NULL) continue; - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - const char *name_base = strrchr(name_loop->name, '/'); + udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { + const char *file_name = udev_list_entry_get_name(file_loop); + const char *file_base = strrchr(file_name, '/'); - if (name_base == NULL) + if (file_base == NULL) continue; - if (strcmp(name_base, sort_base) == 0) { - info(udev, "rule file '%s' already added, ignoring '%s'\n", - name_loop->name, sort_loop->name); - list_del(&sort_loop->node); - free(sort_loop); + if (strcmp(file_base, sort_base) == 0) { + info(udev, "rule file basename '%s' already added, ignoring '%s'\n", + file_name, sort_name); + udev_list_entry_remove(sort_loop); sort_loop = NULL; continue; } - if (strcmp(name_base, sort_base) > 0) + if (strcmp(file_base, sort_base) > 0) break; } if (sort_loop != NULL) - list_move_tail(&sort_loop->node, &name_loop->node); + udev_list_entry_move_to_list(sort_loop, &file_list); } } /* parse list of files */ - list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) { - if (stat(name_loop->name, &statbuf) == 0) { - if (statbuf.st_size) - parse_file(rules, name_loop->name); - else - dbg(udev, "empty rules file '%s'\n", name_loop->name); - } else - err(udev, "could not read '%s': %m\n", name_loop->name); - list_del(&name_loop->node); - free(name_loop); + udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { + const char *file_name = udev_list_entry_get_name(file_loop); + + if (stat(file_name, &statbuf) == 0 && statbuf.st_size > 0) + parse_file(rules, file_name); + else + err(udev, "could not read '%s': %m\n", file_name); + udev_list_entry_remove(file_loop); } - return retval; } diff --git a/udev/udev-util.c b/udev/udev-util.c index 4623c30caf..e22e9b285a 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -122,49 +122,6 @@ void name_list_cleanup(struct udev *udev, struct list_head *name_list) } } -/* calls function for every file found in specified directory */ -int add_matching_files(struct udev *udev, struct list_head *name_list, const char *dirname, const char *suffix) -{ - struct dirent *ent; - DIR *dir; - char filename[UTIL_PATH_SIZE]; - - dbg(udev, "open directory '%s'\n", dirname); - dir = opendir(dirname); - if (dir == NULL) { - err(udev, "unable to open '%s': %m\n", dirname); - return -1; - } - - while (1) { - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - - if ((ent->d_name[0] == '.') || (ent->d_name[0] == '#')) - continue; - - /* look for file matching with specified suffix */ - if (suffix != NULL) { - const char *ext; - - ext = strrchr(ent->d_name, '.'); - if (ext == NULL) - continue; - if (strcmp(ext, suffix) != 0) - continue; - } - dbg(udev, "put file '%s/%s' into list\n", dirname, ent->d_name); - - snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); - filename[sizeof(filename)-1] = '\0'; - name_list_add(udev, name_list, filename, 1); - } - - closedir(dir); - return 0; -} - uid_t lookup_user(struct udev *udev, const char *user) { struct passwd *pw; @@ -200,4 +157,3 @@ extern gid_t lookup_group(struct udev *udev, const char *group) return gid; } - diff --git a/udev/udev.h b/udev/udev.h index d789d443ac..9a808c39aa 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -111,7 +111,6 @@ extern struct name_entry *name_list_add(struct udev *udev, struct list_head *nam extern struct name_entry *name_list_key_add(struct udev *udev, struct list_head *name_list, const char *key, const char *value); extern int name_list_key_remove(struct udev *udev, struct list_head *name_list, const char *key); extern void name_list_cleanup(struct udev *udev, struct list_head *name_list); -extern int add_matching_files(struct udev *udev, struct list_head *name_list, const char *dirname, const char *suffix); extern uid_t lookup_user(struct udev *udev, const char *user); extern gid_t lookup_group(struct udev *udev, const char *group); -- cgit v1.2.3-54-g00ecf From a390e6f764087b74b1567e1daf1f1c41eae42c74 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 20:23:56 +0200 Subject: delete name_list, move common file functions --- udev/udev-util-file.c | 95 ----------------------------- udev/udev-util.c | 163 +++++++++++++++++++++++++------------------------- udev/udev.h | 15 +---- 3 files changed, 85 insertions(+), 188 deletions(-) diff --git a/udev/udev-util-file.c b/udev/udev-util-file.c index 84ff09e050..29c0d2c14a 100644 --- a/udev/udev-util-file.c +++ b/udev/udev-util-file.c @@ -29,101 +29,6 @@ #include "udev.h" -int create_path(struct udev *udev, const char *path) -{ - char p[UTIL_PATH_SIZE]; - char *pos; - struct stat stats; - int ret; - - util_strlcpy(p, path, sizeof(p)); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (pos[-1] == '/') - pos--; - pos[0] = '\0'; - - dbg(udev, "stat '%s'\n", p); - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - - if (create_path(udev, p) != 0) - return -1; - - dbg(udev, "mkdir '%s'\n", p); - udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); - ret = mkdir(p, 0755); - udev_selinux_resetfscreatecon(udev); - if (ret == 0) - return 0; - - if (errno == EEXIST) - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - return -1; -} - -int delete_path(struct udev *udev, const char *path) -{ - char p[UTIL_PATH_SIZE]; - char *pos; - int retval; - - strcpy (p, path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (1) { - *pos = '\0'; - pos = strrchr(p, '/'); - - /* don't remove the last one */ - if ((pos == p) || (pos == NULL)) - break; - - /* remove if empty */ - retval = rmdir(p); - if (errno == ENOENT) - retval = 0; - if (retval) { - if (errno == ENOTEMPTY) - return 0; - err(udev, "rmdir(%s) failed: %m\n", p); - break; - } - dbg(udev, "removed '%s'\n", p); - } - return 0; -} - -/* Reset permissions on the device node, before unlinking it to make sure, - * that permisions of possible hard links will be removed too. - */ -int unlink_secure(struct udev *udev, const char *filename) -{ - int retval; - - retval = chown(filename, 0, 0); - if (retval) - err(udev, "chown(%s, 0, 0) failed: %m\n", filename); - - retval = chmod(filename, 0000); - if (retval) - err(udev, "chmod(%s, 0000) failed: %m\n", filename); - - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - - if (retval) - err(udev, "unlink(%s) failed: %m\n", filename); - - return retval; -} - int file_map(const char *filename, char **buf, size_t *bufsize) { struct stat stats; diff --git a/udev/udev-util.c b/udev/udev-util.c index e22e9b285a..59c4d194dd 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -23,103 +23,104 @@ #include #include #include -#include -#include #include #include -#include -#include #include "udev.h" -struct name_entry *name_list_add(struct udev *udev, struct list_head *name_list, const char *name, int sort) +int create_path(struct udev *udev, const char *path) { - struct name_entry *name_loop; - struct name_entry *name_new; - - /* avoid duplicate entries */ - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) == 0) { - dbg(udev, "'%s' is already in the list\n", name); - return name_loop; - } - } + char p[UTIL_PATH_SIZE]; + char *pos; + struct stat stats; + int ret; + + util_strlcpy(p, path, sizeof(p)); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (pos[-1] == '/') + pos--; + pos[0] = '\0'; + + dbg(udev, "stat '%s'\n", p); + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + + if (create_path(udev, p) != 0) + return -1; + + dbg(udev, "mkdir '%s'\n", p); + udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); + ret = mkdir(p, 0755); + udev_selinux_resetfscreatecon(udev); + if (ret == 0) + return 0; + + if (errno == EEXIST) + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + return -1; +} - if (sort) - list_for_each_entry(name_loop, name_list, node) { - if (strcmp(name_loop->name, name) > 0) - break; +int delete_path(struct udev *udev, const char *path) +{ + char p[UTIL_PATH_SIZE]; + char *pos; + int retval; + + strcpy (p, path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (1) { + *pos = '\0'; + pos = strrchr(p, '/'); + + /* don't remove the last one */ + if ((pos == p) || (pos == NULL)) + break; + + /* remove if empty */ + retval = rmdir(p); + if (errno == ENOENT) + retval = 0; + if (retval) { + if (errno == ENOTEMPTY) + return 0; + err(udev, "rmdir(%s) failed: %m\n", p); + break; } - - name_new = malloc(sizeof(struct name_entry)); - if (name_new == NULL) - return NULL; - memset(name_new, 0x00, sizeof(struct name_entry)); - util_strlcpy(name_new->name, name, sizeof(name_new->name)); - dbg(udev, "adding '%s'\n", name_new->name); - list_add_tail(&name_new->node, &name_loop->node); - - return name_new; + dbg(udev, "removed '%s'\n", p); + } + return 0; } -struct name_entry *name_list_key_add(struct udev *udev, struct list_head *name_list, const char *key, const char *value) +/* Reset permissions on the device node, before unlinking it to make sure, + * that permisions of possible hard links will be removed too. + */ +int unlink_secure(struct udev *udev, const char *filename) { - struct name_entry *name_loop; - struct name_entry *name_new; - size_t keylen = strlen(key); - - list_for_each_entry(name_loop, name_list, node) { - if (strncmp(name_loop->name, key, keylen) != 0) - continue; - if (name_loop->name[keylen] != '=') - continue; - dbg(udev, "key already present '%s', replace it\n", name_loop->name); - snprintf(name_loop->name, sizeof(name_loop->name), "%s=%s", key, value); - name_loop->name[sizeof(name_loop->name)-1] = '\0'; - return name_loop; - } + int retval; - name_new = malloc(sizeof(struct name_entry)); - if (name_new == NULL) - return NULL; - memset(name_new, 0x00, sizeof(struct name_entry)); - snprintf(name_new->name, sizeof(name_new->name), "%s=%s", key, value); - name_new->name[sizeof(name_new->name)-1] = '\0'; - dbg(udev, "adding '%s'\n", name_new->name); - list_add_tail(&name_new->node, &name_loop->node); + retval = chown(filename, 0, 0); + if (retval) + err(udev, "chown(%s, 0, 0) failed: %m\n", filename); - return name_new; -} + retval = chmod(filename, 0000); + if (retval) + err(udev, "chmod(%s, 0000) failed: %m\n", filename); -int name_list_key_remove(struct udev *udev, struct list_head *name_list, const char *key) -{ - struct name_entry *name_loop; - struct name_entry *name_tmp; - size_t keylen = strlen(key); - int retval = 0; - - list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { - if (strncmp(name_loop->name, key, keylen) != 0) - continue; - if (name_loop->name[keylen] != '=') - continue; - list_del(&name_loop->node); - free(name_loop); - retval = 1; - break; - } - return retval; -} + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; -void name_list_cleanup(struct udev *udev, struct list_head *name_list) -{ - struct name_entry *name_loop; - struct name_entry *name_tmp; + if (retval) + err(udev, "unlink(%s) failed: %m\n", filename); - list_for_each_entry_safe(name_loop, name_tmp, name_list, node) { - list_del(&name_loop->node); - free(name_loop); - } + return retval; } uid_t lookup_user(struct udev *udev, const char *user) diff --git a/udev/udev.h b/udev/udev.h index 9a808c39aa..e5c7cd192f 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -102,22 +102,13 @@ extern int udev_node_remove(struct udev_device *dev, int test); extern void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test); /* udev-util.c */ -struct name_entry { - struct list_head node; - char name[UTIL_PATH_SIZE]; - unsigned int ignore_error:1; -}; -extern struct name_entry *name_list_add(struct udev *udev, struct list_head *name_list, const char *name, int sort); -extern struct name_entry *name_list_key_add(struct udev *udev, struct list_head *name_list, const char *key, const char *value); -extern int name_list_key_remove(struct udev *udev, struct list_head *name_list, const char *key); -extern void name_list_cleanup(struct udev *udev, struct list_head *name_list); +extern int create_path(struct udev *udev, const char *path); +extern int delete_path(struct udev *udev, const char *path); +extern int unlink_secure(struct udev *udev, const char *filename); extern uid_t lookup_user(struct udev *udev, const char *user); extern gid_t lookup_group(struct udev *udev, const char *group); /* udev_utils_file.c */ -extern int create_path(struct udev *udev, const char *path); -extern int delete_path(struct udev *udev, const char *path); -extern int unlink_secure(struct udev *udev, const char *filename); extern int file_map(const char *filename, char **buf, size_t *bufsize); extern void file_unmap(void *buf, size_t bufsize); extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); -- cgit v1.2.3-54-g00ecf From be7f7f57012e61b062bd540152a1af529c1509f2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 21:12:08 +0200 Subject: fix sorting of rules files --- udev/lib/libudev-list.c | 9 ++++++++- udev/lib/libudev-private.h | 1 + udev/udev-rules-parse.c | 8 +++----- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index 918277cb64..fb8301b0bd 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -148,7 +148,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_ list_entry_insert_before(entry_new, entry_loop); else list_entry_append(entry_new, list); - info(udev, "'%s=%s' added\n", entry_new->name, entry_new->value); + dbg(udev, "'%s=%s' added\n", entry_new->name, entry_new->value); return entry_new; } @@ -182,6 +182,13 @@ void udev_list_entry_move_to_list(struct udev_list_entry *list_entry, struct ude list_entry->list = list; } +void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry) +{ + list_node_remove(&list_entry->node); + list_node_insert_between(&list_entry->node, entry->node.prev, &entry->node); + list_entry->list = entry->list; +} + struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) { if (list_is_empty(list)) diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 6549669711..96e62a8ec5 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -131,6 +131,7 @@ extern void udev_list_entry_remove(struct udev_list_entry *entry); extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); extern void udev_list_entry_move_to_end(struct udev_list_entry *list_entry); extern void udev_list_entry_move_to_list(struct udev_list_entry *list_entry, struct udev_list_node *list); +extern void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry); extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry); extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); #define udev_list_entry_foreach_safe(entry, tmp, first) \ diff --git a/udev/udev-rules-parse.c b/udev/udev-rules-parse.c index 737bbf4d92..41dc85aba8 100644 --- a/udev/udev-rules-parse.c +++ b/udev/udev-rules-parse.c @@ -854,20 +854,18 @@ int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_nam if (file_base == NULL) continue; - if (strcmp(file_base, sort_base) == 0) { info(udev, "rule file basename '%s' already added, ignoring '%s'\n", file_name, sort_name); udev_list_entry_remove(sort_loop); sort_loop = NULL; - continue; + break; } - if (strcmp(file_base, sort_base) > 0) break; } if (sort_loop != NULL) - udev_list_entry_move_to_list(sort_loop, &file_list); + udev_list_entry_move_before(sort_loop, file_loop); } } @@ -878,7 +876,7 @@ int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_nam if (stat(file_name, &statbuf) == 0 && statbuf.st_size > 0) parse_file(rules, file_name); else - err(udev, "could not read '%s': %m\n", file_name); + info(udev, "can not read '%s'\n", file_name); udev_list_entry_remove(file_loop); } return retval; -- cgit v1.2.3-54-g00ecf From c28c4486af3fd970aef599be65e9c2d424765329 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 21:35:11 +0200 Subject: run_program: prevent empty last argv entry --- udev/udev-rules.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 8b94d40c0b..0bad2171fa 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -138,9 +138,9 @@ static int run_program(struct udev_device *dev, const char *command, if (strchr(arg, ' ') != NULL) { char *pos = arg; - while (pos != NULL) { + while (pos != NULL && pos[0] != '\0') { if (pos[0] == '\'') { - /* don't separate if in apostrophes */ + /* do not separate quotes */ pos++; argv[i] = strsep(&pos, "\'"); while (pos != NULL && pos[0] == ' ') -- cgit v1.2.3-54-g00ecf From bb144ed14d34716435f18ea6a0ea0ee899f809e9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Oct 2008 22:41:52 +0200 Subject: update IMPORT= file/stdout property parsing --- udev/udev-rules.c | 216 +++++++++++++++++++++++++----------------------------- 1 file changed, 101 insertions(+), 115 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 0bad2171fa..6f53b6a88b 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -76,46 +76,6 @@ static int get_format_len(struct udev *udev, char **str) return -1; } -static int get_key(char **line, char **key, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (linepos == NULL) - return -1; - - /* skip whitespace */ - while (isspace(linepos[0])) - linepos++; - - /* get the key */ - temp = strchr(linepos, '='); - if (temp == NULL || temp == linepos) - return -1; - temp[0] = '\0'; - *key = linepos; - linepos = &temp[1]; - - /* get a quoted value */ - if (linepos[0] == '"' || linepos[0] == '\'') { - temp = strchr(&linepos[1], linepos[0]); - if (temp != NULL) { - temp[0] = '\0'; - *value = &linepos[1]; - goto out; - } - } - - /* get the value*/ - temp = strchr(linepos, '\n'); - if (temp != NULL) - temp[0] = '\0'; - *value = linepos; -out: - return 0; -} - static int run_program(struct udev_device *dev, const char *command, char *result, size_t ressize, size_t *reslen) { @@ -333,106 +293,132 @@ static int run_program(struct udev_device *dev, const char *command, return err; } -static int import_keys_into_env(struct udev_event *event, const char *buf, size_t bufsize) +static int import_property_from_string(struct udev_device *dev, char *line) { - struct udev_device *dev = event->dev; - char line[UTIL_LINE_SIZE]; - const char *bufline; - char *linepos; - char *variable; - char *value; - size_t cur; - size_t count; - int lineno; - - /* loop through the whole buffer */ - lineno = 0; - cur = 0; - while (cur < bufsize) { - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; - - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) - continue; + struct udev *udev = udev_device_get_udev(dev); + char *key; + char *val; + size_t len; - /* see if this is a comment */ - if (bufline[0] == '#') - continue; + /* find key */ + key = line; + while (isspace(key[0])) + key++; - if (count >= sizeof(line)) { - err(event->udev, "line too long, skipped\n"); - continue; - } + /* comment or empty line */ + if (key[0] == '#' || key[0] == '\0') + return -1; - memcpy(line, bufline, count); - line[count] = '\0'; - - linepos = line; - if (get_key(&linepos, &variable, &value) == 0) { - char syspath[UTIL_PATH_SIZE]; - - dbg(event->udev, "import '%s=%s'\n", variable, value); - /* handle device, renamed by external tool, returning new path */ - if (strcmp(variable, "DEVPATH") == 0) { - info(event->udev, "updating devpath from '%s' to '%s'\n", - udev_device_get_devpath(dev), value); - util_strlcpy(syspath, udev_get_sys_path(event->udev), sizeof(syspath)); - util_strlcat(syspath, value, sizeof(syspath)); - udev_device_set_syspath(dev, syspath); - } else { - struct udev_list_entry *entry; + /* split key/value */ + val = strchr(key, '='); + if (val == NULL) + return -1; + val[0] = '\0'; + val++; - entry = udev_device_add_property(dev, variable, value); - /* store in db */ - udev_list_entry_set_flag(entry, 1); - } + /* find value */ + while (isspace(val[0])) + val++; + + /* terminate key */ + len = strlen(key); + if (len == 0) + return -1; + while (isspace(key[len-1])) + len--; + key[len] = '\0'; + + /* terminate value */ + len = strlen(val); + if (len == 0) + return -1; + while (isspace(val[len-1])) + len--; + val[len] = '\0'; + + if (len == 0) + return -1; + + /* unquote */ + if (val[0] == '"' || val[0] == '\'') { + if (val[len-1] != val[0]) { + info(udev, "inconsistent quoting: '%s', skip\n", line); + return -1; } + val[len-1] = '\0'; + val++; + } + + info(udev, "adding '%s'='%s'\n", key, val); + + /* handle device, renamed by external tool, returning new path */ + if (strcmp(key, "DEVPATH") == 0) { + char syspath[UTIL_PATH_SIZE]; + + info(udev, "updating devpath from '%s' to '%s'\n", + udev_device_get_devpath(dev), val); + util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); + util_strlcat(syspath, val, sizeof(syspath)); + udev_device_set_syspath(dev, syspath); + } else { + struct udev_list_entry *entry; + + entry = udev_device_add_property(dev, key, val); + /* store in db */ + udev_list_entry_set_flag(entry, 1); } return 0; } -static int import_file_into_env(struct udev_event *event, const char *filename) +static int import_file_into_env(struct udev_device *dev, const char *filename) { - char *buf; - size_t bufsize; + FILE *f; + char line[UTIL_LINE_SIZE]; - if (file_map(filename, &buf, &bufsize) != 0) { - err(event->udev, "can't open '%s': %m\n", filename); + f = fopen(filename, "r"); + if (f == NULL) return -1; - } - import_keys_into_env(event, buf, bufsize); - file_unmap(buf, bufsize); - + while (fgets(line, sizeof(line), f)) + import_property_from_string(dev, line); + fclose(f); return 0; } -static int import_program_into_env(struct udev_event *event, const char *program) +static int import_program_into_env(struct udev_device *dev, const char *program) { char result[2048]; size_t reslen; + char *line; - if (run_program(event->dev, program, result, sizeof(result), &reslen) != 0) + if (run_program(dev, program, result, sizeof(result), &reslen) != 0) return -1; - return import_keys_into_env(event, result, reslen); + + line = result; + while (line != NULL) { + char *pos; + + pos = strchr(line, '\n'); + if (pos != NULL) { + pos[0] = '\0'; + pos = &pos[1]; + } + import_property_from_string(dev, line); + line = pos; + } + return 0; } -static int import_parent_into_env(struct udev_event *event, const char *filter) +static int import_parent_into_env(struct udev_device *dev, const char *filter) { + struct udev *udev = udev_device_get_udev(dev); struct udev_device *dev_parent; struct udev_list_entry *list_entry; - dev_parent = udev_device_get_parent(event->dev); + dev_parent = udev_device_get_parent(dev); if (dev_parent == NULL) return -1; - dbg(event->udev, "found parent '%s', get the node name\n", udev_device_get_syspath(dev_parent)); + dbg(udev, "found parent '%s', get the node name\n", udev_device_get_syspath(dev_parent)); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev_parent)) { const char *key = udev_list_entry_get_name(list_entry); const char *val = udev_list_entry_get_value(list_entry); @@ -440,8 +426,8 @@ static int import_parent_into_env(struct udev_event *event, const char *filter) if (fnmatch(filter, key, 0) == 0) { struct udev_list_entry *entry; - dbg(event->udev, "import key '%s=%s'\n", key, val); - entry = udev_device_add_property(event->dev, key, val); + dbg(udev, "import key '%s=%s'\n", key, val); + entry = udev_device_add_property(dev, key, val); /* store in db */ udev_list_entry_set_flag(entry, 1); } @@ -1270,13 +1256,13 @@ try_parent: udev_rules_apply_format(event, import, sizeof(import)); dbg(event->udev, "check for IMPORT import='%s'\n", import); if (rule->import_type == IMPORT_PROGRAM) { - rc = import_program_into_env(event, import); + rc = import_program_into_env(event->dev, import); } else if (rule->import_type == IMPORT_FILE) { dbg(event->udev, "import file import='%s'\n", import); - rc = import_file_into_env(event, import); + rc = import_file_into_env(event->dev, import); } else if (rule->import_type == IMPORT_PARENT) { dbg(event->udev, "import parent import='%s'\n", import); - rc = import_parent_into_env(event, import); + rc = import_parent_into_env(event->dev, import); } if (rc != 0) { dbg(event->udev, "IMPORT failed\n"); -- cgit v1.2.3-54-g00ecf From fc42bd5d6b56654bf8c88edec63e90dcab75699c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 00:40:03 +0200 Subject: update rules file parsing --- udev/udev-rules-parse.c | 88 ++++++++++++++++++++----------------------------- udev/udev-rules.c | 2 +- 2 files changed, 37 insertions(+), 53 deletions(-) diff --git a/udev/udev-rules-parse.c b/udev/udev-rules-parse.c index 41dc85aba8..16bb91573a 100644 --- a/udev/udev-rules-parse.c +++ b/udev/udev-rules-parse.c @@ -139,29 +139,28 @@ static int get_key(struct udev_rules *rules, char **line, char **key, enum key_o if (linepos[0] == '=' && linepos[1] == '=') { *operation = KEY_OP_MATCH; linepos += 2; - dbg(rules->udev, "operator=match\n"); + dbg(rules->udev, "match:\n"); } else if (linepos[0] == '!' && linepos[1] == '=') { *operation = KEY_OP_NOMATCH; linepos += 2; - dbg(rules->udev, "operator=nomatch\n"); + dbg(rules->udev, "nomatch:\n"); } else if (linepos[0] == '+' && linepos[1] == '=') { *operation = KEY_OP_ADD; linepos += 2; - dbg(rules->udev, "operator=add\n"); + dbg(rules->udev, "add:\n"); } else if (linepos[0] == '=') { *operation = KEY_OP_ASSIGN; linepos++; - dbg(rules->udev, "operator=assign\n"); + dbg(rules->udev, "assign:\n"); } else if (linepos[0] == ':' && linepos[1] == '=') { *operation = KEY_OP_ASSIGN_FINAL; linepos += 2; - dbg(rules->udev, "operator=assign_final\n"); + dbg(rules->udev, "assign_final:\n"); } else return -1; /* terminate key */ temp[0] = '\0'; - dbg(rules->udev, "key='%s'\n", *key); /* skip whitespace after operator */ while (isspace(linepos[0])) @@ -181,7 +180,7 @@ static int get_key(struct udev_rules *rules, char **line, char **key, enum key_o return -1; temp[0] = '\0'; temp++; - dbg(rules->udev, "value='%s'\n", *value); + dbg(rules->udev, "'%s'-'%s'\n", *key, *value); /* move line to next key */ *line = temp; @@ -678,68 +677,55 @@ invalid: static int parse_file(struct udev_rules *rules, const char *filename) { + FILE *f; char line[UTIL_LINE_SIZE]; - char *bufline; - unsigned int lineno; - char *buf; - size_t bufsize; - size_t cur; - size_t count; - int retval = 0; size_t start; struct udev_rule *rule; struct udev_rules_iter iter; start = rules->bufsize; + info(rules->udev, "reading '%s' as rules file\n", filename); - if (file_map(filename, &buf, &bufsize) != 0) { - err(rules->udev, "can't open '%s' as rules file: %m\n", filename); + f = fopen(filename, "r"); + if (f == NULL) return -1; - } - info(rules->udev, "reading '%s' as rules file\n", filename); - /* loop through the whole file */ - cur = 0; - lineno = 0; - while (cur < bufsize) { - unsigned int i, j; + while(fgets(line, sizeof(line), f) != NULL) { + int line_nr = 0; + char *key; + size_t len; - count = buf_get_line(buf, bufsize, cur); - bufline = &buf[cur]; - cur += count+1; - lineno++; + /* skip whitespace */ + line_nr++; + key = line; + while (isspace(key[0])) + key++; - /* eat the whitespace */ - while ((count > 0) && isspace(bufline[0])) { - bufline++; - count--; - } - if (count == 0) + /* comment */ + if (key[0] == '#') continue; - /* see if this is a comment */ - if (bufline[0] == '#') + len = strlen(line); + if (len < 3) continue; - if (count >= sizeof(line)) { - err(rules->udev, "line too long, rule skipped '%s:%u'\n", filename, lineno); - continue; + /* continue reading if backslash+newline is found */ + while (line[len-2] == '\\') { + if (fgets(&line[len-2], (sizeof(line)-len)+2, f) == NULL) + break; + line_nr++; + len = strlen(line); } - /* skip backslash and newline from multiline rules */ - for (i = j = 0; i < count; i++) { - if (bufline[i] == '\\' && bufline[i+1] == '\n') - continue; - - line[j++] = bufline[i]; + if (len+1 >= sizeof(line)) { + err(rules->udev, "line too long '%s':%u, ignored\n", filename, line_nr); + continue; } - line[j] = '\0'; - - dbg(rules->udev, "read '%s'\n", line); - add_to_rules(rules, line, filename, lineno); + add_to_rules(rules, key, filename, line_nr); } + fclose(f); - /* Compute all goto targets within this file */ + /* compute all goto targets within this file */ udev_rules_iter_init(&iter, rules); udev_rules_iter_goto(&iter, start); while((rule = udev_rules_iter_next(&iter))) { @@ -755,9 +741,7 @@ static int parse_file(struct udev_rules *rules, const char *filename) } } } - - file_unmap(buf, bufsize); - return retval; + return 0; } static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 6f53b6a88b..00435d4af7 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -378,7 +378,7 @@ static int import_file_into_env(struct udev_device *dev, const char *filename) f = fopen(filename, "r"); if (f == NULL) return -1; - while (fgets(line, sizeof(line), f)) + while (fgets(line, sizeof(line), f) != NULL) import_property_from_string(dev, line); fclose(f); return 0; -- cgit v1.2.3-54-g00ecf From d130881d348bff7a593bfc4e3530e0b63d87b795 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 00:42:48 +0200 Subject: delete udev-util-file.c --- udev/Makefile.am | 1 - udev/udev-util-file.c | 81 --------------------------------------------------- 2 files changed, 82 deletions(-) delete mode 100644 udev/udev-util-file.c diff --git a/udev/Makefile.am b/udev/Makefile.am index cbab15d34b..84a4451446 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -21,7 +21,6 @@ common_files = \ udev-rules.c \ udev-rules-parse.c \ udev-util.c \ - udev-util-file.c \ list.h \ lib/libudev.h \ lib/libudev-private.h \ diff --git a/udev/udev-util-file.c b/udev/udev-util-file.c deleted file mode 100644 index 29c0d2c14a..0000000000 --- a/udev/udev-util-file.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -int file_map(const char *filename, char **buf, size_t *bufsize) -{ - struct stat stats; - int fd; - - fd = open(filename, O_RDONLY); - if (fd < 0) { - return -1; - } - - if (fstat(fd, &stats) < 0) { - close(fd); - return -1; - } - - *buf = mmap(NULL, stats.st_size, PROT_READ, MAP_SHARED, fd, 0); - if (*buf == MAP_FAILED) { - close(fd); - return -1; - } - *bufsize = stats.st_size; - - close(fd); - - return 0; -} - -void file_unmap(void *buf, size_t bufsize) -{ - munmap(buf, bufsize); -} - -/* return number of chars until the next newline, skip escaped newline */ -size_t buf_get_line(const char *buf, size_t buflen, size_t cur) -{ - int escape = 0; - size_t count; - - for (count = cur; count < buflen; count++) { - if (!escape && buf[count] == '\n') - break; - - if (buf[count] == '\\') - escape = 1; - else - escape = 0; - } - - return count - cur; -} -- cgit v1.2.3-54-g00ecf From 3feeb77c97a62cbb714bb95ed38ec8c44cb459ce Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 01:39:10 +0200 Subject: libudev: list - prepend udev_* to all functions --- udev/lib/libudev-list.c | 29 +++++++++++------------------ udev/lib/libudev-private.h | 1 - 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index fb8301b0bd..76c2f7e93b 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -43,12 +43,12 @@ void udev_list_init(struct udev_list_node *list) list->prev = list; } -static int list_is_empty(struct udev_list_node *list) +static int udev_list_is_empty(struct udev_list_node *list) { return list->next == list; } -static void list_node_insert_between(struct udev_list_node *new, +static void udev_list_node_insert_between(struct udev_list_node *new, struct udev_list_node *prev, struct udev_list_node *next) { @@ -58,7 +58,7 @@ static void list_node_insert_between(struct udev_list_node *new, prev->next = new; } -static void list_node_remove(struct udev_list_node *entry) +static void udev_list_node_remove(struct udev_list_node *entry) { struct udev_list_node *prev = entry->prev; struct udev_list_node *next = entry->next; @@ -84,14 +84,14 @@ static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) static void list_entry_append(struct udev_list_entry *new, struct udev_list_node *list) { /* inserting before the list head make the node the last node in the list */ - list_node_insert_between(&new->node, list->prev, list); + udev_list_node_insert_between(&new->node, list->prev, list); new->list = list; } /* insert entry into a list, before a given existing entry */ static void list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) { - list_node_insert_between(&new->node, entry->node.prev, &entry->node); + udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node); new->list = entry->list; } @@ -154,7 +154,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_ void udev_list_entry_remove(struct udev_list_entry *entry) { - list_node_remove(&entry->node); + udev_list_node_remove(&entry->node); free(entry->name); free(entry->value); free(entry); @@ -171,27 +171,20 @@ void udev_list_cleanup(struct udev *udev, struct udev_list_node *list) void udev_list_entry_move_to_end(struct udev_list_entry *list_entry) { - list_node_remove(&list_entry->node); - list_node_insert_between(&list_entry->node, list_entry->list->prev, list_entry->list); -} - -void udev_list_entry_move_to_list(struct udev_list_entry *list_entry, struct udev_list_node *list) -{ - list_node_remove(&list_entry->node); - list_node_insert_between(&list_entry->node, list->prev, list); - list_entry->list = list; + udev_list_node_remove(&list_entry->node); + udev_list_node_insert_between(&list_entry->node, list_entry->list->prev, list_entry->list); } void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry) { - list_node_remove(&list_entry->node); - list_node_insert_between(&list_entry->node, entry->node.prev, &entry->node); + udev_list_node_remove(&list_entry->node); + udev_list_node_insert_between(&list_entry->node, entry->node.prev, &entry->node); list_entry->list = entry->list; } struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) { - if (list_is_empty(list)) + if (udev_list_is_empty(list)) return NULL; return list_node_to_entry(list->next); } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 96e62a8ec5..f2814c4ad6 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -130,7 +130,6 @@ extern struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct ude extern void udev_list_entry_remove(struct udev_list_entry *entry); extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); extern void udev_list_entry_move_to_end(struct udev_list_entry *list_entry); -extern void udev_list_entry_move_to_list(struct udev_list_entry *list_entry, struct udev_list_node *list); extern void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry); extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry); extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); -- cgit v1.2.3-54-g00ecf From babcf3cb22af24725030ad795f2e41d024afced3 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Fri, 17 Oct 2008 13:19:54 +0200 Subject: libudev: fix sysnum logic for digit-only device names --- udev/lib/libudev-device.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 65ba6e30d8..b5d42354e5 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -936,8 +936,13 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath } /* trailing number */ - while (isdigit(udev_device->sysname[--len])) + while (len > 0 && isdigit(udev_device->sysname[--len])) udev_device->sysnum = &udev_device->sysname[len]; + + /* sysname is completely numeric */ + if (len == 0) + udev_device->sysnum = NULL; + return 0; } -- cgit v1.2.3-54-g00ecf From bdeab5c7fd0489feb241483140a81091cf2802c7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 13:54:14 +0200 Subject: libudev: add sysnum to test program --- udev/lib/test-libudev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 65d84159ce..ded65cca91 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -53,6 +53,13 @@ static void print_device(struct udev_device *device) str = udev_device_get_syspath(device); printf("syspath: '%s'\n", str); + str = udev_device_get_sysname(device); + printf("sysname: '%s'\n", str); + + str = udev_device_get_sysnum(device); + if (str != NULL) + printf("sysnum: '%s'\n", str); + str = udev_device_get_devpath(device); printf("devpath: '%s'\n", str); -- cgit v1.2.3-54-g00ecf From d960ad1546548d4b7aaf35e8b8f2cef652449ee7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 13:54:50 +0200 Subject: test: fix a few unintentially wrongly written rules which cause parse errors --- test/udev-test.pl | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 4c6a70f1af..243e9619db 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -92,7 +92,7 @@ SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS", NAME="boot EOF }, { - desc => "label test of max sysfs files", + desc => "label test of max sysfs files (skip invalid rule)", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , @@ -230,7 +230,7 @@ EOF # \\ -\\\\ +\\ #\\ @@ -1249,7 +1249,7 @@ SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{PARTITION}="true", ENV{MAINDEVICE}="fa SUBSYSTEM=="block", KERNEL=="*[!0-9]", ENV{PARTITION}="false", ENV{MAINDEVICE}="true" ENV{MAINDEVICE}=="true", NAME="disk" ENV{PARTITION}=="true", NAME="part" -NAME="bad" +SUBSYSTEM=="block", NAME="bad" EOF }, { @@ -1365,20 +1365,20 @@ EOF subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", - exp_perms => "root:nobody:0640", + exp_perms => "root:tty:0640", rules => < "final assignment", + desc => "final assignment 2", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", - exp_perms => "root:nobody:0640", + exp_perms => "root:tty:0640", rules => < "yes", rules => < "there", rules => < "TEST invalid NAME= only (skip invalid rule)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "yes", + rules => < Date: Fri, 17 Oct 2008 16:49:27 +0200 Subject: libudev: monitor - add set_receive_buffer_size() --- udev/lib/libudev-monitor.c | 7 +++++++ udev/lib/libudev-private.h | 1 + udev/udevd.c | 20 +++++--------------- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index d0f28849aa..6c6f4aa7e0 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -152,6 +152,13 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) return 0; } +int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) +{ + if (udev_monitor == NULL) + return -1; + return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size)); +} + /** * udev_monitor_ref: * @udev_monitor: udev monitor diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index f2814c4ad6..50c96571c5 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -91,6 +91,7 @@ extern int udev_device_rename_db(struct udev_device *udev_device, const char *de /* libudev-monitor - netlink/unix socket communication */ extern int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device); +extern int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); /* libudev-ctrl - daemon runtime setup */ struct udev_ctrl; diff --git a/udev/udevd.c b/udev/udevd.c index 1583e22ac9..0c82e56dc5 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -24,15 +24,11 @@ #include #include #include -#include #include -#include #include #include #include #include -#include -#include #include #include #ifdef HAVE_INOTIFY @@ -213,7 +209,7 @@ static void event_fork(struct udev_event *event) /* execute RUN= */ if (err == 0 && !event->ignore_device && udev_get_run(event->udev)) udev_rules_run(event); - info(event->udev, "seq %llu finished with %i\n", udev_device_get_seqnum(event->dev), err); + info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err); logging_close(); if (err != 0) exit(1); @@ -242,7 +238,8 @@ static void event_queue_insert(struct udev_event *event) event->queue_time = time(NULL); export_event_state(event, EVENT_QUEUED); - info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(event->dev), udev_device_get_action(event->dev), udev_device_get_subsystem(event->dev)); + info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(event->dev), + udev_device_get_action(event->dev), udev_device_get_subsystem(event->dev)); util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); @@ -545,7 +542,7 @@ static void udev_done(int pid, int exitstatus) list_for_each_entry(event, &running_list, node) { if (event->pid == pid) { - info(event->udev, "seq %llu, pid [%d] exit with %i, %ld seconds old\n", + info(event->udev, "seq %llu cleanup, pid [%d], status %i, %ld seconds old\n", udev_device_get_seqnum(event->dev), event->pid, exitstatus, time(NULL) - event->queue_time); event->exitstatus = exitstatus; @@ -705,13 +702,8 @@ int main(int argc, char *argv[]) err(udev, "error initializing netlink socket\n"); rc = 3; goto exit; - } else { - /* set receive buffersize */ - const int buffersize = 32 * 1024 * 1024; - - setsockopt(udev_monitor_get_fd(kernel_monitor), - SOL_SOCKET, SO_RCVBUFFORCE, &buffersize, sizeof(buffersize)); } + udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); err = pipe(signal_pipe); if (err < 0) { @@ -860,7 +852,6 @@ int main(int argc, char *argv[]) maxfd = UDEV_MAX(maxfd, udev_monitor_get_fd(kernel_monitor)); maxfd = UDEV_MAX(maxfd, signal_pipe[READ_END]); maxfd = UDEV_MAX(maxfd, inotify_fd); - while (!udev_exit) { int fdcount; @@ -870,7 +861,6 @@ int main(int argc, char *argv[]) FD_SET(udev_monitor_get_fd(kernel_monitor), &readfds); if (inotify_fd >= 0) FD_SET(inotify_fd, &readfds); - fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) -- cgit v1.2.3-54-g00ecf From b692a750899453e45faa07c057020a22594eb521 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 17:32:17 +0200 Subject: libudev: ctrl - change magic to integer --- udev/lib/libudev-ctrl.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index 75356b1d5f..848f507878 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -31,7 +31,7 @@ #include "libudev-private.h" /* last known version with this wire protocol */ -#define UDEV_CTRL_MAGIC "udevd-128" +#define UDEV_CTRL_MAGIC 0xdead1dea enum udev_ctrl_msg_type { UDEV_CTRL_UNKNOWN, @@ -44,8 +44,9 @@ enum udev_ctrl_msg_type { UDEV_CTRL_SET_MAX_CHILDS_RUNNING, }; -struct ctrl_msg_wire { - char magic[32]; +struct udev_ctrl_msg_wire { + char version[16]; + unsigned int magic; enum udev_ctrl_msg_type type; union { int intval; @@ -56,7 +57,7 @@ struct ctrl_msg_wire { struct udev_ctrl_msg { int refcount; struct udev_ctrl *uctrl; - struct ctrl_msg_wire ctrl_msg_wire; + struct udev_ctrl_msg_wire ctrl_msg_wire; }; struct udev_ctrl { @@ -145,11 +146,12 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl) static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf) { - struct ctrl_msg_wire ctrl_msg_wire; + struct udev_ctrl_msg_wire ctrl_msg_wire; int err; - memset(&ctrl_msg_wire, 0x00, sizeof(struct ctrl_msg_wire)); - strcpy(ctrl_msg_wire.magic, UDEV_CTRL_MAGIC); + memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); + strcpy(ctrl_msg_wire.version, "udev-" VERSION); + ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; ctrl_msg_wire.type = type; if (buf != NULL) @@ -157,7 +159,8 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int else ctrl_msg_wire.intval = intval; - err = sendto(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + err = sendto(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0, + (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); if (err == -1) { err(uctrl->udev, "error sending message: %m\n"); } @@ -218,7 +221,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) uctrl_msg->uctrl = uctrl; iov.iov_base = &uctrl_msg->ctrl_msg_wire; - iov.iov_len = sizeof(struct udev_ctrl_msg); + iov.iov_len = sizeof(struct udev_ctrl_msg_wire); memset(&smsg, 0x00, sizeof(struct msghdr)); smsg.msg_iov = &iov; @@ -244,8 +247,8 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) goto err; } - if (strncmp(uctrl_msg->ctrl_msg_wire.magic, UDEV_CTRL_MAGIC, sizeof(UDEV_CTRL_MAGIC)) != 0 ) { - err(uctrl->udev, "message magic '%s' doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); + if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { + err(uctrl->udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); goto err; } -- cgit v1.2.3-54-g00ecf From 9dcf7ec8a0411aeb432eee20035e6c0f385ae7fe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 18:59:08 +0200 Subject: libudev: make list_node functions available --- udev/lib/libudev-list.c | 13 +++++++++---- udev/lib/libudev-private.h | 16 +++++++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index 76c2f7e93b..606e3d5d63 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -43,14 +43,14 @@ void udev_list_init(struct udev_list_node *list) list->prev = list; } -static int udev_list_is_empty(struct udev_list_node *list) +int udev_list_is_empty(struct udev_list_node *list) { return list->next == list; } static void udev_list_node_insert_between(struct udev_list_node *new, - struct udev_list_node *prev, - struct udev_list_node *next) + struct udev_list_node *prev, + struct udev_list_node *next) { next->prev = new; new->next = next; @@ -58,7 +58,12 @@ static void udev_list_node_insert_between(struct udev_list_node *new, prev->next = new; } -static void udev_list_node_remove(struct udev_list_node *entry) +void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list) +{ + udev_list_node_insert_between(new, list->prev, list); +} + +void udev_list_node_remove(struct udev_list_node *entry) { struct udev_list_node *prev = entry->prev; struct udev_list_node *next = entry->next; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 50c96571c5..07f1491773 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -124,19 +124,29 @@ struct udev_list_node { struct udev_list_node *next, *prev; }; extern void udev_list_init(struct udev_list_node *list); -extern void udev_list_cleanup(struct udev *udev, struct udev_list_node *name_list); +extern int udev_list_is_empty(struct udev_list_node *list); +extern void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list); +extern void udev_list_node_remove(struct udev_list_node *entry); +#define udev_list_node_foreach(node, list) \ + for (node = (list)->next; \ + node != list; \ + node = (node)->next) +#define udev_list_node_foreach_safe(node, tmp, list) \ + for (node = (list)->next, tmp = (node)->next; \ + node != list; \ + node = tmp, tmp = (tmp)->next) extern struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, const char *name, const char *value, int unique, int sort); extern void udev_list_entry_remove(struct udev_list_entry *entry); +extern void udev_list_cleanup(struct udev *udev, struct udev_list_node *name_list); extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); extern void udev_list_entry_move_to_end(struct udev_list_entry *list_entry); extern void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry); extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry); extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); #define udev_list_entry_foreach_safe(entry, tmp, first) \ - for (entry = first, \ - tmp = udev_list_entry_get_next(entry); \ + for (entry = first, tmp = udev_list_entry_get_next(entry); \ entry != NULL; \ entry = tmp, tmp = udev_list_entry_get_next(tmp)) -- cgit v1.2.3-54-g00ecf From 7e0279276013b7b55edfd5248fae9fabcbc09703 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 18:59:27 +0200 Subject: udevd: use udev_list_node --- udev/Makefile.am | 1 - udev/udev.h | 3 +-- udev/udevd.c | 64 ++++++++++++++++++++++++++++++++++++-------------------- 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/udev/Makefile.am b/udev/Makefile.am index 84a4451446..fc97aad044 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -21,7 +21,6 @@ common_files = \ udev-rules.c \ udev-rules-parse.c \ udev-util.c \ - list.h \ lib/libudev.h \ lib/libudev-private.h \ lib/libudev.c \ diff --git a/udev/udev.h b/udev/udev.h index e5c7cd192f..5030972d9b 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -25,7 +25,6 @@ #include "udev-sysdeps.h" #include "lib/libudev.h" #include "lib/libudev-private.h" -#include "list.h" #define ALLOWED_CHARS "#+-.:=@_" #define ALLOWED_CHARS_FILE ALLOWED_CHARS "/" @@ -86,7 +85,7 @@ struct udev_event { int ignore_device; int test; - struct list_head node; + struct udev_list_node node; pid_t pid; int exitstatus; time_t queue_time; diff --git a/udev/udevd.c b/udev/udevd.c index 0c82e56dc5..576f9e8233 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -72,8 +72,8 @@ static int run_exec_q; static int stop_exec_q; static int max_childs; -static LIST_HEAD(exec_list); -static LIST_HEAD(running_list); +static struct udev_list_node exec_list; +static struct udev_list_node running_list; enum event_state { EVENT_QUEUED, @@ -81,6 +81,15 @@ enum event_state { EVENT_FAILED, }; +static struct udev_event *node_to_event(struct udev_list_node *node) +{ + char *event; + + event = (char *)node; + event -= offsetof(struct udev_event, node); + return (struct udev_event *)event; +} + static void export_event_state(struct udev_event *event, enum event_state state) { char filename[UTIL_PATH_SIZE]; @@ -144,7 +153,7 @@ static void export_event_state(struct udev_event *event, enum event_state state) static void event_queue_delete(struct udev_event *event) { - list_del(&event->node); + udev_list_node_remove(&event->node); /* mark as failed, if "add" event returns non-zero */ if (event->exitstatus && strcmp(udev_device_get_action(event->dev), "add") == 0) @@ -255,7 +264,7 @@ static void event_queue_insert(struct udev_event *event) /* run one event after the other in debug mode */ if (debug_trace) { - list_add_tail(&event->node, &running_list); + udev_list_node_append(&event->node, &running_list); event_fork(event); waitpid(event->pid, NULL, 0); event_queue_delete(event); @@ -264,12 +273,12 @@ static void event_queue_insert(struct udev_event *event) /* run all events with a timeout set immediately */ if (udev_device_get_timeout(event->dev) > 0) { - list_add_tail(&event->node, &running_list); + udev_list_node_append(&event->node, &running_list); event_fork(event); return; } - list_add_tail(&event->node, &exec_list); + udev_list_node_append(&event->node, &exec_list); run_exec_q = 1; } @@ -324,11 +333,13 @@ static int compare_devpath(const char *running, const char *waiting) /* lookup event for identical, parent, child, or physical device */ static int devpath_busy(struct udev_event *event, int limit) { - struct udev_event *loop_event; + struct udev_list_node *loop; int childs_count = 0; /* check exec-queue which may still contain delayed events we depend on */ - list_for_each_entry(loop_event, &exec_list, node) { + udev_list_node_foreach(loop, &exec_list) { + struct udev_event *loop_event = node_to_event(loop); + /* skip ourself and all later events */ if (udev_device_get_seqnum(loop_event->dev) >= udev_device_get_seqnum(event->dev)) break; @@ -372,8 +383,8 @@ static int devpath_busy(struct udev_event *event, int limit) } /* check run queue for still running events */ - list_for_each_entry(loop_event, &running_list, node) { - childs_count++; + udev_list_node_foreach(loop, &running_list) { + struct udev_event *loop_event = node_to_event(loop); if (childs_count++ >= limit) { info(event->udev, "%llu, maximum number (%i) of childs reached\n", @@ -424,13 +435,15 @@ static int devpath_busy(struct udev_event *event, int limit) /* serializes events for the identical and parent and child devices */ static void event_queue_manager(struct udev *udev) { - struct udev_event *loop_event; - struct udev_event *tmp_event; + struct udev_list_node *loop; + struct udev_list_node *tmp; - if (list_empty(&exec_list)) + if (udev_list_is_empty(&exec_list)) return; - list_for_each_entry_safe(loop_event, tmp_event, &exec_list, node) { + udev_list_node_foreach_safe(loop, tmp, &exec_list) { + struct udev_event *loop_event = node_to_event(loop); + /* serialize and wait for parent or child events */ if (devpath_busy(loop_event, max_childs) != 0) { dbg(udev, "delay seq %llu (%s)\n", @@ -440,7 +453,8 @@ static void event_queue_manager(struct udev *udev) } /* move event to run list */ - list_move_tail(&loop_event->node, &running_list); + udev_list_node_remove(&loop_event->node); + udev_list_node_append(&loop_event->node, &running_list); event_fork(loop_event); dbg(udev, "moved seq %llu to running list\n", udev_device_get_seqnum(loop_event->dev)); } @@ -537,16 +551,18 @@ static void asmlinkage sig_handler(int signum) static void udev_done(int pid, int exitstatus) { + struct udev_list_node *loop; + /* find event associated with pid and delete it */ - struct udev_event *event; + udev_list_node_foreach(loop, &running_list) { + struct udev_event *loop_event = node_to_event(loop); - list_for_each_entry(event, &running_list, node) { - if (event->pid == pid) { - info(event->udev, "seq %llu cleanup, pid [%d], status %i, %ld seconds old\n", - udev_device_get_seqnum(event->dev), event->pid, - exitstatus, time(NULL) - event->queue_time); - event->exitstatus = exitstatus; - event_queue_delete(event); + if (loop_event->pid == pid) { + info(loop_event->udev, "seq %llu cleanup, pid [%d], status %i, %ld seconds old\n", + udev_device_get_seqnum(loop_event->dev), loop_event->pid, + exitstatus, time(NULL) - loop_event->queue_time); + loop_event->exitstatus = exitstatus; + event_queue_delete(loop_event); /* there may be events waiting with the same devpath */ run_exec_q = 1; @@ -733,6 +749,8 @@ int main(int argc, char *argv[]) goto exit; } + udev_list_init(&running_list); + udev_list_init(&exec_list); udev_rules_init(udev, &rules, 1); export_initial_seqnum(udev); -- cgit v1.2.3-54-g00ecf From 002a957762969c32907f55586b2b2cefe8555732 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 19:29:02 +0200 Subject: collect: use udev_list --- extras/collect/Makefile.am | 8 ++++++ extras/collect/collect.c | 71 +++++++++++++++++++++++++++++++--------------- 2 files changed, 56 insertions(+), 23 deletions(-) diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am index 60315dd84f..78eb5c7591 100644 --- a/extras/collect/Makefile.am +++ b/extras/collect/Makefile.am @@ -4,6 +4,14 @@ udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = \ collect +collect_SOURCES = \ + collect.c \ + ../../udev/lib/libudev \ + ../../udev/lib/libudev-private.h \ + ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-util.c \ + ../../udev/lib/libudev-list.c + distclean-local: rm -f Makefile.in diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 7ebe865b62..355b85b5cf 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -31,7 +31,8 @@ #include #include -#include "../../udev/list.h" +#include "../../udev/lib/libudev.h" +#include "../../udev/lib/libudev-private.h" #define TMPFILE UDEV_PREFIX "/dev/.udev/collect" #define BUFSIZE 16 @@ -44,17 +45,26 @@ enum collect_state { }; struct _mate { - struct list_head node; + struct udev_list_node node; char *name; enum collect_state state; }; -static LIST_HEAD(bunch); +static struct udev_list_node bunch; static int debug; /* This can increase dynamically */ static size_t bufsize = BUFSIZE; +static struct _mate *node_to_mate(struct udev_list_node *node) +{ + char *mate; + + mate = (char *)node; + mate -= offsetof(struct _mate, node); + return (struct _mate *)mate; +} + static void sig_alrm(int signo) { exit(4); @@ -164,7 +174,7 @@ static int checkout(int fd) him->name = malloc(strlen(word) + 1); strcpy(him->name, word); him->state = STATE_OLD; - list_add_tail(&him->node, &bunch); + udev_list_node_append(&him->node, &bunch); word = NULL; } } @@ -190,13 +200,15 @@ static int checkout(int fd) */ static void invite(char *us) { - struct _mate *him, *who; + struct udev_list_node *him_node; + struct _mate *who = NULL; if (debug) fprintf(stderr, "Adding ID '%s'\n", us); - who = NULL; - list_for_each_entry(him, &bunch, node) { + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + if (!strcmp(him->name, us)) { him->state = STATE_CONFIRMED; who = him; @@ -216,13 +228,15 @@ static void invite(char *us) */ static void reject(char *us) { - struct _mate *him, *who; + struct udev_list_node *him_node; + struct _mate *who = NULL; if (debug) fprintf(stderr, "Removing ID '%s'\n", us); - who = NULL; - list_for_each_entry(him, &bunch, node) { + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + if (!strcmp(him->name, us)) { him->state = STATE_NONE; who = him; @@ -230,7 +244,6 @@ static void reject(char *us) } if (debug && !who) fprintf(stderr, "ID '%s' not in database\n", us); - } /* @@ -241,11 +254,14 @@ static void reject(char *us) */ static void kickout(void) { - struct _mate *him, *them; + struct udev_list_node *him_node; + struct udev_list_node *tmp; + + udev_list_node_foreach_safe(him_node, tmp, &bunch) { + struct _mate *him = node_to_mate(him_node); - list_for_each_entry_safe(him, them, &bunch, node) { if (him->state == STATE_OLD) { - list_del(&him->node); + udev_list_node_remove(&him->node); free(him->name); free(him); } @@ -261,13 +277,15 @@ static int missing(int fd) { char *buf; int ret = 0; - struct _mate *him; + struct udev_list_node *him_node; buf = malloc(bufsize); if (!buf) return -1; - list_for_each_entry(him, &bunch, node) { + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + if (him->state == STATE_NONE) { ret++; } else { @@ -288,7 +306,6 @@ static int missing(int fd) } free(buf); - return ret; } @@ -299,10 +316,12 @@ static int missing(int fd) */ static void everybody(void) { - struct _mate *him; + struct udev_list_node *him_node; const char *state = ""; - list_for_each_entry(him, &bunch, node) { + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + switch (him->state) { case STATE_NONE: state = "none"; @@ -329,7 +348,6 @@ int main(int argc, char **argv) }; int argi; char *checkpoint, *us; - struct _mate *him, *who; int fd; int i; int ret = 0; @@ -376,7 +394,7 @@ int main(int argc, char **argv) goto exit; } - INIT_LIST_HEAD(&bunch); + udev_list_init(&bunch); if (debug) fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); @@ -393,19 +411,26 @@ int main(int argc, char **argv) } for (i = argi; i < argc; i++) { + struct udev_list_node *him_node; + struct _mate *who; + who = NULL; - list_for_each_entry(him, &bunch, node) { + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + if (!strcmp(him->name, argv[i])) who = him; } if (!who) { + struct _mate *him; + if (debug) fprintf(stderr, "ID %s: not in database\n", argv[i]); him = malloc(sizeof (struct _mate)); him->name = malloc(strlen(argv[i]) + 1); strcpy(him->name, argv[i]); him->state = STATE_NONE; - list_add_tail(&him->node, &bunch); + udev_list_node_append(&him->node, &bunch); } else { if (debug) fprintf(stderr, "ID %s: found in database\n", argv[i]); -- cgit v1.2.3-54-g00ecf From bec02e330460d0986e1dc35ff5124b6961117e49 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Oct 2008 19:29:57 +0200 Subject: delete list.h --- udev/list.h | 183 ------------------------------------------------------------ 1 file changed, 183 deletions(-) delete mode 100644 udev/list.h diff --git a/udev/list.h b/udev/list.h deleted file mode 100644 index c679e50ace..0000000000 --- a/udev/list.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Simple doubly linked list implementation. - * - * Based on list.h in the Linux kernel source tree, licensed under - * the GNU GPL version 2. - */ - -#ifndef _LIST_H -#define _LIST_H - -/** - * container_of: - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - * cast a member of a structure out to the containing structure - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -/* - * These are non-NULL pointers that will result in page faults - * under normal circumstances, used to verify that nobody uses - * non-initialized list entries. - */ -#define LIST_POISON1 ((void *) 0x00100100) -#define LIST_POISON2 ((void *) 0x00200200) - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -#define INIT_LIST_HEAD(ptr) do { \ - (ptr)->next = (ptr); (ptr)->prev = (ptr); \ -} while (0) - -/* Insert a new entry between two known consecutive entries. */ -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add: - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail: - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - */ -static inline void __list_del(struct list_head * prev, struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del: - * @entry: the element to delete from the list. - * - * deletes entry from list. - * - * Note: list_empty on entry does not return true after this, the entry is - * in an undefined state. - */ -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = LIST_POISON1; - entry->prev = LIST_POISON2; -} - -/** - * list_move - * @list: the entry to move - * @head: the head that will precede our entry - * delete from one list and add as another's head - */ -static inline void list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - * @list: the entry to move - * @head: the head that will follow our entry - * - * delete from one list and add as another's tail - */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_empty: - * @head: the list to test. - * - * tests whether a list is empty - */ -static inline int list_empty(struct list_head *head) -{ - return head->next == head; -} - -/** - * list_entry: - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * get the struct for this entry - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * list_for_each_entry: - * @pos: the type * to use as a loop counter. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * iterate over list of given type - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_safe: - * @pos: the type * to use as a loop counter. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * iterate over list of given type safe against removal of list entry - */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -#endif /* _LIST_H */ -- cgit v1.2.3-54-g00ecf From c7521974a39bcb68f313a324b8ec60ec11fed3d8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 14:33:37 +0200 Subject: merge udev-rules.c and udev-rules-parse.c --- udev/Makefile.am | 2 - udev/test-udev.c | 1 - udev/udev-event.c | 1 - udev/udev-node.c | 1 - udev/udev-rules-parse.c | 876 -------------------------------------------- udev/udev-rules.c | 937 +++++++++++++++++++++++++++++++++++++++++++++++- udev/udev-rules.h | 134 ------- udev/udev.h | 21 +- udev/udevadm-test.c | 1 - udev/udevd.c | 1 - 10 files changed, 950 insertions(+), 1025 deletions(-) delete mode 100644 udev/udev-rules-parse.c delete mode 100644 udev/udev-rules.h diff --git a/udev/Makefile.am b/udev/Makefile.am index fc97aad044..c374942c6e 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -14,12 +14,10 @@ common_ldadd = common_files = \ udev.h \ - udev-rules.h \ udev-sysdeps.h \ udev-event.c \ udev-node.c \ udev-rules.c \ - udev-rules-parse.c \ udev-util.c \ lib/libudev.h \ lib/libudev-private.h \ diff --git a/udev/test-udev.c b/udev/test-udev.c index 43c97aeb34..1caccce304 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -29,7 +29,6 @@ #include #include "udev.h" -#include "udev-rules.h" static void asmlinkage sig_handler(int signum) { diff --git a/udev/udev-event.c b/udev/udev-event.c index 24f7c55bbc..07c02211a0 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -29,7 +29,6 @@ #include #include "udev.h" -#include "udev-rules.h" struct udev_event *udev_event_new(struct udev_device *dev) { diff --git a/udev/udev-node.c b/udev/udev-node.c index 73075ee0aa..62786d417b 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -28,7 +28,6 @@ #include #include "udev.h" -#include "udev-rules.h" #define TMP_FILE_EXT ".udev-tmp" diff --git a/udev/udev-rules-parse.c b/udev/udev-rules-parse.c deleted file mode 100644 index 16bb91573a..0000000000 --- a/udev/udev-rules-parse.c +++ /dev/null @@ -1,876 +0,0 @@ -/* - * Copyright (C) 2003,2004 Greg Kroah-Hartman - * Copyright (C) 2003-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "udev-rules.h" - - -void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules) -{ - dbg(rules->udev, "bufsize=%zi\n", rules->bufsize); - iter->rules = rules; - iter->current = 0; -} - -struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter) -{ - struct udev_rules *rules; - struct udev_rule *rule; - - rules = iter->rules; - if (!rules) - return NULL; - - dbg(rules->udev, "current=%zi\n", iter->current); - if (iter->current >= rules->bufsize) { - dbg(rules->udev, "no more rules\n"); - return NULL; - } - - /* get next rule */ - rule = (struct udev_rule *) (rules->buf + iter->current); - iter->current += sizeof(struct udev_rule) + rule->bufsize; - - return rule; -} - -struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off) -{ - struct udev_rules *rules = iter->rules; - struct udev_rule *rule; - - dbg(rules->udev, "current=%zi\n", iter->current); - iter->current = rule_off; - rule = (struct udev_rule *) (rules->buf + iter->current); - - return rule; -} - -static size_t find_label(const struct udev_rules_iter *iter, const char *label) -{ - struct udev_rule *rule; - struct udev_rules *rules = iter->rules; - size_t current = iter->current; - -next: - dbg(rules->udev, "current=%zi\n", current); - if (current >= rules->bufsize) { - dbg(rules->udev, "LABEL='%s' not found\n", label); - return 0; - } - rule = (struct udev_rule *) (rules->buf + current); - - if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { - dbg(rules->udev, "moving forward, looking for label '%s'\n", label); - current += sizeof(struct udev_rule) + rule->bufsize; - goto next; - } - - dbg(rules->udev, "found label '%s'\n", label); - return current; -} - -static int get_key(struct udev_rules *rules, char **line, char **key, enum key_operation *operation, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (linepos == NULL && linepos[0] == '\0') - return -1; - - /* skip whitespace */ - while (isspace(linepos[0]) || linepos[0] == ',') - linepos++; - - /* get the key */ - if (linepos[0] == '\0') - return -1; - *key = linepos; - - while (1) { - linepos++; - if (linepos[0] == '\0') - return -1; - if (isspace(linepos[0])) - break; - if (linepos[0] == '=') - break; - if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) - if (linepos[1] == '=') - break; - } - - /* remember end of key */ - temp = linepos; - - /* skip whitespace after key */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get operation type */ - if (linepos[0] == '=' && linepos[1] == '=') { - *operation = KEY_OP_MATCH; - linepos += 2; - dbg(rules->udev, "match:\n"); - } else if (linepos[0] == '!' && linepos[1] == '=') { - *operation = KEY_OP_NOMATCH; - linepos += 2; - dbg(rules->udev, "nomatch:\n"); - } else if (linepos[0] == '+' && linepos[1] == '=') { - *operation = KEY_OP_ADD; - linepos += 2; - dbg(rules->udev, "add:\n"); - } else if (linepos[0] == '=') { - *operation = KEY_OP_ASSIGN; - linepos++; - dbg(rules->udev, "assign:\n"); - } else if (linepos[0] == ':' && linepos[1] == '=') { - *operation = KEY_OP_ASSIGN_FINAL; - linepos += 2; - dbg(rules->udev, "assign_final:\n"); - } else - return -1; - - /* terminate key */ - temp[0] = '\0'; - - /* skip whitespace after operator */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get the value*/ - if (linepos[0] == '"') - linepos++; - else - return -1; - *value = linepos; - - temp = strchr(linepos, '"'); - if (!temp) - return -1; - temp[0] = '\0'; - temp++; - dbg(rules->udev, "'%s'-'%s'\n", *key, *value); - - /* move line to next key */ - *line = temp; - - return 0; -} - -/* extract possible KEY{attr} */ -static char *get_key_attribute(struct udev_rules *rules, char *str) -{ - char *pos; - char *attr; - - attr = strchr(str, '{'); - if (attr != NULL) { - attr++; - pos = strchr(attr, '}'); - if (pos == NULL) { - err(rules->udev, "missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - dbg(rules->udev, "attribute='%s'\n", attr); - return attr; - } - - return NULL; -} - -static int add_rule_key(struct udev_rule *rule, struct key *key, - enum key_operation operation, const char *value) -{ - size_t val_len = strnlen(value, UTIL_PATH_SIZE); - - key->operation = operation; - - key->val_off = rule->bufsize; - util_strlcpy(rule->buf + rule->bufsize, value, val_len+1); - rule->bufsize += val_len+1; - - return 0; -} - -static int add_rule_key_pair(struct udev_rules *rules, struct udev_rule *rule, struct key_pairs *pairs, - enum key_operation operation, const char *key, const char *value) -{ - size_t key_len = strnlen(key, UTIL_PATH_SIZE); - - if (pairs->count >= PAIRS_MAX) { - err(rules->udev, "skip, too many keys of the same type in a single rule\n"); - return -1; - } - - add_rule_key(rule, &pairs->keys[pairs->count].key, operation, value); - - /* add the key-name of the pair */ - pairs->keys[pairs->count].key_name_off = rule->bufsize; - util_strlcpy(rule->buf + rule->bufsize, key, key_len+1); - rule->bufsize += key_len+1; - - pairs->count++; - - return 0; -} - -static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) -{ - char buf[sizeof(struct udev_rule) + UTIL_LINE_SIZE]; - struct udev_rule *rule; - size_t rule_size; - int valid; - char *linepos; - char *attr; - size_t padding; - int physdev = 0; - int retval; - - memset(buf, 0x00, sizeof(buf)); - rule = (struct udev_rule *) buf; - rule->event_timeout = -1; - linepos = line; - valid = 0; - - /* get all the keys */ - while (1) { - char *key; - char *value; - enum key_operation operation = KEY_OP_UNSET; - - retval = get_key(rules, &linepos, &key, &operation, &value); - if (retval) - break; - - if (strcasecmp(key, "ACTION") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid ACTION operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->action, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DEVPATH") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid DEVPATH operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->devpath, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "KERNEL") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid KERNEL operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->kernel, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "SUBSYSTEM") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid SUBSYSTEM operation\n"); - goto invalid; - } - /* bus, class, subsystem events should all be the same */ - if (strcmp(value, "subsystem") == 0 || - strcmp(value, "bus") == 0 || - strcmp(value, "class") == 0) { - if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) - err(rules->udev, "'%s' must be specified as 'subsystem' \n" - "please fix it in %s:%u", value, filename, lineno); - add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); - } else - add_rule_key(rule, &rule->subsystem, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DRIVER") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid DRIVER operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->driver, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("ATTR")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTR attribute\n"); - goto invalid; - } - if (add_rule_key_pair(rules, rule, &rule->attr, operation, attr, value) != 0) - goto invalid; - valid = 1; - continue; - } - - if (strcasecmp(key, "KERNELS") == 0 || - strcasecmp(key, "ID") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid KERNELS operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->kernels, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "SUBSYSTEMS") == 0 || - strcasecmp(key, "BUS") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid SUBSYSTEMS operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->subsystems, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DRIVERS") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid DRIVERS operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->drivers, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || - strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid ATTRS operation\n"); - goto invalid; - } - attr = get_key_attribute(rules, key + sizeof("ATTRS")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTRS attribute\n"); - goto invalid; - } - if (strncmp(attr, "device/", 7) == 0) - err(rules->udev, "the 'device' link is deprecated and will be removed from a future kernel, \n" - "please fix it in %s:%u", filename, lineno); - else if (strstr(attr, "../") != NULL) - err(rules->udev, "do not reference parent sysfs directories directly, that may break with a future kernel, \n" - "please fix it in %s:%u", filename, lineno); - if (add_rule_key_pair(rules, rule, &rule->attrs, operation, attr, value) != 0) - goto invalid; - valid = 1; - continue; - } - - if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("ENV")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ENV attribute\n"); - goto invalid; - } - if (strncmp(attr, "PHYSDEV", 7) == 0) - physdev = 1; - if (add_rule_key_pair(rules, rule, &rule->env, operation, attr, value) != 0) - goto invalid; - valid = 1; - continue; - } - - if (strcasecmp(key, "PROGRAM") == 0) { - add_rule_key(rule, &rule->program, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "RESULT") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid RESULT operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->result, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("IMPORT")-1); - if (attr != NULL && strstr(attr, "program")) { - dbg(rules->udev, "IMPORT will be executed\n"); - rule->import_type = IMPORT_PROGRAM; - } else if (attr != NULL && strstr(attr, "file")) { - dbg(rules->udev, "IMPORT will be included as file\n"); - rule->import_type = IMPORT_FILE; - } else if (attr != NULL && strstr(attr, "parent")) { - dbg(rules->udev, "IMPORT will include the parent values\n"); - rule->import_type = IMPORT_PARENT; - } else { - /* figure it out if it is executable */ - char file[UTIL_PATH_SIZE]; - char *pos; - struct stat statbuf; - - util_strlcpy(file, value, sizeof(file)); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - - /* allow programs in /lib/udev called without the path */ - if (strchr(file, '/') == NULL) { - util_strlcpy(file, UDEV_PREFIX "/lib/udev/", sizeof(file)); - util_strlcat(file, value, sizeof(file)); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - } - - dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); - if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { - dbg(rules->udev, "IMPORT is executable, will be executed (autotype)\n"); - rule->import_type = IMPORT_PROGRAM; - } else { - dbg(rules->udev, "IMPORT is not executable, will be included as file (autotype)\n"); - rule->import_type = IMPORT_FILE; - } - } - add_rule_key(rule, &rule->import, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid TEST operation\n"); - goto invalid; - } - attr = get_key_attribute(rules, key + sizeof("TEST")-1); - if (attr != NULL) - rule->test_mode_mask = strtol(attr, NULL, 8); - add_rule_key(rule, &rule->test, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("RUN")-1); - if (attr != NULL) { - if (strstr(attr, "ignore_error")) - rule->run_ignore_error = 1; - } - add_rule_key(rule, &rule->run, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { - add_rule_key(rule, &rule->wait_for, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "LABEL") == 0) { - add_rule_key(rule, &rule->label, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "GOTO") == 0) { - add_rule_key(rule, &rule->goto_label, operation, value); - valid = 1; - continue; - } - - if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("NAME")-1); - if (attr != NULL) { - if (strstr(attr, "all_partitions") != NULL) { - dbg(rules->udev, "creation of partition nodes requested\n"); - rule->partitions = DEFAULT_PARTITIONS_COUNT; - } - if (strstr(attr, "ignore_remove") != NULL) { - dbg(rules->udev, "remove event should be ignored\n"); - rule->ignore_remove = 1; - } - } - if (value[0] == '\0') - dbg(rules->udev, "name empty, node creation supressed\n"); - add_rule_key(rule, &rule->name, operation, value); - continue; - } - - if (strcasecmp(key, "SYMLINK") == 0) { - if (operation == KEY_OP_MATCH || - operation == KEY_OP_NOMATCH) - add_rule_key(rule, &rule->symlink_match, operation, value); - else - add_rule_key(rule, &rule->symlink, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "OWNER") == 0) { - valid = 1; - if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { - char *endptr; - strtoul(value, &endptr, 10); - if (endptr[0] != '\0') { - char owner[32]; - uid_t uid = lookup_user(rules->udev, value); - dbg(rules->udev, "replacing username='%s' by id=%i\n", value, uid); - sprintf(owner, "%u", (unsigned int) uid); - add_rule_key(rule, &rule->owner, operation, owner); - continue; - } - } - - add_rule_key(rule, &rule->owner, operation, value); - continue; - } - - if (strcasecmp(key, "GROUP") == 0) { - valid = 1; - if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { - char *endptr; - strtoul(value, &endptr, 10); - if (endptr[0] != '\0') { - char group[32]; - gid_t gid = lookup_group(rules->udev, value); - dbg(rules->udev, "replacing groupname='%s' by id=%i\n", value, gid); - sprintf(group, "%u", (unsigned int) gid); - add_rule_key(rule, &rule->group, operation, group); - continue; - } - } - - add_rule_key(rule, &rule->group, operation, value); - continue; - } - - if (strcasecmp(key, "MODE") == 0) { - add_rule_key(rule, &rule->mode, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "OPTIONS") == 0) { - const char *pos; - - if (strstr(value, "last_rule") != NULL) { - dbg(rules->udev, "last rule to be applied\n"); - rule->last_rule = 1; - } - if (strstr(value, "ignore_device") != NULL) { - dbg(rules->udev, "device should be ignored\n"); - rule->ignore_device = 1; - } - if (strstr(value, "ignore_remove") != NULL) { - dbg(rules->udev, "remove event should be ignored\n"); - rule->ignore_remove = 1; - } - pos = strstr(value, "link_priority="); - if (pos != NULL) { - rule->link_priority = atoi(&pos[strlen("link_priority=")]); - dbg(rules->udev, "link priority=%i\n", rule->link_priority); - } - pos = strstr(value, "event_timeout="); - if (pos != NULL) { - rule->event_timeout = atoi(&pos[strlen("event_timeout=")]); - dbg(rules->udev, "event timout=%i\n", rule->event_timeout); - } - pos = strstr(value, "string_escape="); - if (pos != NULL) { - pos = &pos[strlen("string_escape=")]; - if (strncmp(pos, "none", strlen("none")) == 0) - rule->string_escape = ESCAPE_NONE; - else if (strncmp(pos, "replace", strlen("replace")) == 0) - rule->string_escape = ESCAPE_REPLACE; - } - if (strstr(value, "all_partitions") != NULL) { - dbg(rules->udev, "creation of partition nodes requested\n"); - rule->partitions = DEFAULT_PARTITIONS_COUNT; - } - valid = 1; - continue; - } - - err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); - } - - if (physdev && rule->wait_for.operation == KEY_OP_UNSET) - err(rules->udev, "PHYSDEV* values are deprecated and will be removed from a future kernel, \n" - "please fix it in %s:%u", filename, lineno); - - /* skip line if not any valid key was found */ - if (!valid) - goto invalid; - - /* grow buffer and add rule */ - rule_size = sizeof(struct udev_rule) + rule->bufsize; - padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); - dbg(rules->udev, "add %zi padding bytes\n", padding); - rule_size += padding; - rule->bufsize += padding; - - rules->buf = realloc(rules->buf, rules->bufsize + rule_size); - if (!rules->buf) { - err(rules->udev, "realloc failed\n"); - goto exit; - } - dbg(rules->udev, "adding rule to offset %zi\n", rules->bufsize); - memcpy(rules->buf + rules->bufsize, rule, rule_size); - rules->bufsize += rule_size; -exit: - return 0; - -invalid: - err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); - return -1; -} - -static int parse_file(struct udev_rules *rules, const char *filename) -{ - FILE *f; - char line[UTIL_LINE_SIZE]; - size_t start; - struct udev_rule *rule; - struct udev_rules_iter iter; - - start = rules->bufsize; - info(rules->udev, "reading '%s' as rules file\n", filename); - - f = fopen(filename, "r"); - if (f == NULL) - return -1; - - while(fgets(line, sizeof(line), f) != NULL) { - int line_nr = 0; - char *key; - size_t len; - - /* skip whitespace */ - line_nr++; - key = line; - while (isspace(key[0])) - key++; - - /* comment */ - if (key[0] == '#') - continue; - - len = strlen(line); - if (len < 3) - continue; - - /* continue reading if backslash+newline is found */ - while (line[len-2] == '\\') { - if (fgets(&line[len-2], (sizeof(line)-len)+2, f) == NULL) - break; - line_nr++; - len = strlen(line); - } - - if (len+1 >= sizeof(line)) { - err(rules->udev, "line too long '%s':%u, ignored\n", filename, line_nr); - continue; - } - add_to_rules(rules, key, filename, line_nr); - } - fclose(f); - - /* compute all goto targets within this file */ - udev_rules_iter_init(&iter, rules); - udev_rules_iter_goto(&iter, start); - while((rule = udev_rules_iter_next(&iter))) { - if (rule->goto_label.operation != KEY_OP_UNSET) { - char *goto_label = &rule->buf[rule->goto_label.val_off]; - - dbg(rules->udev, "resolving goto label '%s'\n", goto_label); - rule->goto_rule_off = find_label(&iter, goto_label); - if (rule->goto_rule_off == 0) { - err(rules->udev, "ignore goto to nonexistent label '%s' in '%s'\n", - goto_label, filename); - rule->goto_rule_off = iter.current; - } - } - } - return 0; -} - -static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix) -{ - struct dirent *ent; - DIR *dir; - char filename[UTIL_PATH_SIZE]; - - dbg(udev, "open directory '%s'\n", dirname); - dir = opendir(dirname); - if (dir == NULL) { - err(udev, "unable to open '%s': %m\n", dirname); - return -1; - } - - while (1) { - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') - break; - - if ((ent->d_name[0] == '.') || (ent->d_name[0] == '#')) - continue; - - /* look for file matching with specified suffix */ - if (suffix != NULL) { - const char *ext; - - ext = strrchr(ent->d_name, '.'); - if (ext == NULL) - continue; - if (strcmp(ext, suffix) != 0) - continue; - } - dbg(udev, "put file '%s/%s' into list\n", dirname, ent->d_name); - - snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); - filename[sizeof(filename)-1] = '\0'; - udev_list_entry_add(udev, file_list, filename, NULL, 1, 1); - } - - closedir(dir); - return 0; -} - -int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names) -{ - struct stat statbuf; - char filename[PATH_MAX]; - struct udev_list_node file_list; - struct udev_list_entry *file_loop, *file_tmp; - int retval = 0; - - memset(rules, 0x00, sizeof(struct udev_rules)); - rules->udev = udev; - rules->resolve_names = resolve_names; - udev_list_init(&file_list); - - if (udev_get_rules_path(udev) != NULL) { - /* custom rules location for testing */ - add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); - } else { - struct udev_list_node sort_list; - struct udev_list_entry *sort_loop, *sort_tmp; - - /* read user/custom rules */ - add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); - - /* read dynamic/temporary rules */ - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - util_strlcat(filename, "/.udev/rules.d", sizeof(filename)); - if (stat(filename, &statbuf) != 0) { - create_path(udev, filename); - udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); - mkdir(filename, 0755); - udev_selinux_resetfscreatecon(udev); - } - udev_list_init(&sort_list); - add_matching_files(udev, &sort_list, filename, ".rules"); - - /* read default rules */ - add_matching_files(udev, &sort_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); - - /* sort all rules files by basename into list of files */ - udev_list_entry_foreach_safe(sort_loop, sort_tmp, udev_list_get_entry(&sort_list)) { - const char *sort_name = udev_list_entry_get_name(sort_loop); - const char *sort_base = strrchr(sort_name, '/'); - - if (sort_base == NULL) - continue; - - udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { - const char *file_name = udev_list_entry_get_name(file_loop); - const char *file_base = strrchr(file_name, '/'); - - if (file_base == NULL) - continue; - if (strcmp(file_base, sort_base) == 0) { - info(udev, "rule file basename '%s' already added, ignoring '%s'\n", - file_name, sort_name); - udev_list_entry_remove(sort_loop); - sort_loop = NULL; - break; - } - if (strcmp(file_base, sort_base) > 0) - break; - } - if (sort_loop != NULL) - udev_list_entry_move_before(sort_loop, file_loop); - } - } - - /* parse list of files */ - udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { - const char *file_name = udev_list_entry_get_name(file_loop); - - if (stat(file_name, &statbuf) == 0 && statbuf.st_size > 0) - parse_file(rules, file_name); - else - info(udev, "can not read '%s'\n", file_name); - udev_list_entry_remove(file_loop); - } - return retval; -} - -void udev_rules_cleanup(struct udev_rules *rules) -{ - if (rules->buf) { - free(rules->buf); - rules->buf = NULL; - } -} - diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 00435d4af7..445eec4239 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -33,9 +33,161 @@ #include #include "udev.h" -#include "udev-rules.h" -extern char **environ; +#define PAIRS_MAX 5 + +enum key_operation { + KEY_OP_UNSET, + KEY_OP_MATCH, + KEY_OP_NOMATCH, + KEY_OP_ADD, + KEY_OP_ASSIGN, + KEY_OP_ASSIGN_FINAL, +}; + +struct key { + enum key_operation operation; + size_t val_off; +}; + +struct key_pair { + struct key key; + size_t key_name_off; +}; + +struct key_pairs { + int count; + struct key_pair keys[PAIRS_MAX]; +}; + +enum import_type { + IMPORT_UNSET, + IMPORT_PROGRAM, + IMPORT_FILE, + IMPORT_PARENT, +}; + +enum escape_type { + ESCAPE_UNSET, + ESCAPE_NONE, + ESCAPE_REPLACE, +}; + +struct udev_rule { + struct key action; + struct key devpath; + struct key kernel; + struct key subsystem; + struct key driver; + struct key_pairs attr; + + struct key kernels; + struct key subsystems; + struct key drivers; + struct key_pairs attrs; + + struct key_pairs env; + struct key program; + struct key result; + struct key import; + enum import_type import_type; + struct key test; + mode_t test_mode_mask; + struct key run; + struct key wait_for; + struct key label; + struct key goto_label; + size_t goto_rule_off; + + struct key name; + struct key symlink; + struct key symlink_match; + struct key owner; + struct key group; + struct key mode; + enum escape_type string_escape; + + unsigned int link_priority; + int event_timeout; + unsigned int partitions; + unsigned int last_rule:1, + run_ignore_error:1, + ignore_device:1, + ignore_remove:1; + + size_t bufsize; + char buf[]; +}; + +struct udev_rules_iter { + struct udev_rules *rules; + size_t current; +}; + +static void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules) +{ + dbg(rules->udev, "bufsize=%zi\n", rules->bufsize); + iter->rules = rules; + iter->current = 0; +} + +static struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter) +{ + struct udev_rules *rules; + struct udev_rule *rule; + + rules = iter->rules; + if (!rules) + return NULL; + + dbg(rules->udev, "current=%zi\n", iter->current); + if (iter->current >= rules->bufsize) { + dbg(rules->udev, "no more rules\n"); + return NULL; + } + + /* get next rule */ + rule = (struct udev_rule *) (rules->buf + iter->current); + iter->current += sizeof(struct udev_rule) + rule->bufsize; + + return rule; +} + +static struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off) +{ + struct udev_rules *rules = iter->rules; + struct udev_rule *rule; + + dbg(rules->udev, "current=%zi\n", iter->current); + iter->current = rule_off; + rule = (struct udev_rule *) (rules->buf + iter->current); + + return rule; +} + +static size_t find_label(const struct udev_rules_iter *iter, const char *label) +{ + struct udev_rule *rule; + struct udev_rules *rules = iter->rules; + size_t current = iter->current; + +next: + dbg(rules->udev, "current=%zi\n", current); + if (current >= rules->bufsize) { + dbg(rules->udev, "LABEL='%s' not found\n", label); + return 0; + } + rule = (struct udev_rule *) (rules->buf + current); + + if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { + dbg(rules->udev, "moving forward, looking for label '%s'\n", label); + current += sizeof(struct udev_rule) + rule->bufsize; + goto next; + } + + dbg(rules->udev, "found label '%s'\n", label); + return current; +} /* extract possible {attr} and move str behind it */ static char *get_format_attribute(struct udev *udev, char **str) @@ -1247,7 +1399,7 @@ try_parent: if (match_key(event->udev, "RESULT", rule, &rule->result, event->program_result)) goto nomatch; - /* import variables returned from program or or file into environment */ + /* import variables returned from program or or file into properties */ if (rule->import.operation != KEY_OP_UNSET) { char import[UTIL_PATH_SIZE]; int rc = -1; @@ -1618,3 +1770,782 @@ int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event) return 0; } + +static int get_key(struct udev_rules *rules, char **line, char **key, enum key_operation *operation, char **value) +{ + char *linepos; + char *temp; + + linepos = *line; + if (linepos == NULL && linepos[0] == '\0') + return -1; + + /* skip whitespace */ + while (isspace(linepos[0]) || linepos[0] == ',') + linepos++; + + /* get the key */ + if (linepos[0] == '\0') + return -1; + *key = linepos; + + while (1) { + linepos++; + if (linepos[0] == '\0') + return -1; + if (isspace(linepos[0])) + break; + if (linepos[0] == '=') + break; + if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) + if (linepos[1] == '=') + break; + } + + /* remember end of key */ + temp = linepos; + + /* skip whitespace after key */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get operation type */ + if (linepos[0] == '=' && linepos[1] == '=') { + *operation = KEY_OP_MATCH; + linepos += 2; + dbg(rules->udev, "match:\n"); + } else if (linepos[0] == '!' && linepos[1] == '=') { + *operation = KEY_OP_NOMATCH; + linepos += 2; + dbg(rules->udev, "nomatch:\n"); + } else if (linepos[0] == '+' && linepos[1] == '=') { + *operation = KEY_OP_ADD; + linepos += 2; + dbg(rules->udev, "add:\n"); + } else if (linepos[0] == '=') { + *operation = KEY_OP_ASSIGN; + linepos++; + dbg(rules->udev, "assign:\n"); + } else if (linepos[0] == ':' && linepos[1] == '=') { + *operation = KEY_OP_ASSIGN_FINAL; + linepos += 2; + dbg(rules->udev, "assign_final:\n"); + } else + return -1; + + /* terminate key */ + temp[0] = '\0'; + + /* skip whitespace after operator */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get the value*/ + if (linepos[0] == '"') + linepos++; + else + return -1; + *value = linepos; + + temp = strchr(linepos, '"'); + if (!temp) + return -1; + temp[0] = '\0'; + temp++; + dbg(rules->udev, "'%s'-'%s'\n", *key, *value); + + /* move line to next key */ + *line = temp; + + return 0; +} + +/* extract possible KEY{attr} */ +static char *get_key_attribute(struct udev_rules *rules, char *str) +{ + char *pos; + char *attr; + + attr = strchr(str, '{'); + if (attr != NULL) { + attr++; + pos = strchr(attr, '}'); + if (pos == NULL) { + err(rules->udev, "missing closing brace for format\n"); + return NULL; + } + pos[0] = '\0'; + dbg(rules->udev, "attribute='%s'\n", attr); + return attr; + } + + return NULL; +} + +static int add_rule_key(struct udev_rule *rule, struct key *key, + enum key_operation operation, const char *value) +{ + size_t val_len = strnlen(value, UTIL_PATH_SIZE); + + key->operation = operation; + + key->val_off = rule->bufsize; + util_strlcpy(rule->buf + rule->bufsize, value, val_len+1); + rule->bufsize += val_len+1; + + return 0; +} + +static int add_rule_key_pair(struct udev_rules *rules, struct udev_rule *rule, struct key_pairs *pairs, + enum key_operation operation, const char *key, const char *value) +{ + size_t key_len = strnlen(key, UTIL_PATH_SIZE); + + if (pairs->count >= PAIRS_MAX) { + err(rules->udev, "skip, too many keys of the same type in a single rule\n"); + return -1; + } + + add_rule_key(rule, &pairs->keys[pairs->count].key, operation, value); + + /* add the key-name of the pair */ + pairs->keys[pairs->count].key_name_off = rule->bufsize; + util_strlcpy(rule->buf + rule->bufsize, key, key_len+1); + rule->bufsize += key_len+1; + + pairs->count++; + + return 0; +} + +static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) +{ + char buf[sizeof(struct udev_rule) + UTIL_LINE_SIZE]; + struct udev_rule *rule; + size_t rule_size; + int valid; + char *linepos; + char *attr; + size_t padding; + int physdev = 0; + int retval; + + memset(buf, 0x00, sizeof(buf)); + rule = (struct udev_rule *) buf; + rule->event_timeout = -1; + linepos = line; + valid = 0; + + /* get all the keys */ + while (1) { + char *key; + char *value; + enum key_operation operation = KEY_OP_UNSET; + + retval = get_key(rules, &linepos, &key, &operation, &value); + if (retval) + break; + + if (strcasecmp(key, "ACTION") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid ACTION operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->action, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "DEVPATH") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid DEVPATH operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->devpath, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "KERNEL") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid KERNEL operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->kernel, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "SUBSYSTEM") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid SUBSYSTEM operation\n"); + goto invalid; + } + /* bus, class, subsystem events should all be the same */ + if (strcmp(value, "subsystem") == 0 || + strcmp(value, "bus") == 0 || + strcmp(value, "class") == 0) { + if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) + err(rules->udev, "'%s' must be specified as 'subsystem' \n" + "please fix it in %s:%u", value, filename, lineno); + add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); + } else + add_rule_key(rule, &rule->subsystem, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "DRIVER") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid DRIVER operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->driver, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("ATTR")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ATTR attribute\n"); + goto invalid; + } + if (add_rule_key_pair(rules, rule, &rule->attr, operation, attr, value) != 0) + goto invalid; + valid = 1; + continue; + } + + if (strcasecmp(key, "KERNELS") == 0 || + strcasecmp(key, "ID") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid KERNELS operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->kernels, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "SUBSYSTEMS") == 0 || + strcasecmp(key, "BUS") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid SUBSYSTEMS operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->subsystems, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "DRIVERS") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid DRIVERS operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->drivers, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || + strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid ATTRS operation\n"); + goto invalid; + } + attr = get_key_attribute(rules, key + sizeof("ATTRS")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ATTRS attribute\n"); + goto invalid; + } + if (strncmp(attr, "device/", 7) == 0) + err(rules->udev, "the 'device' link may not be available in a future kernel, " + "please fix it in %s:%u", filename, lineno); + else if (strstr(attr, "../") != NULL) + err(rules->udev, "do not reference parent sysfs directories directly, " + "it may break with a future kernel, please fix it in %s:%u", filename, lineno); + if (add_rule_key_pair(rules, rule, &rule->attrs, operation, attr, value) != 0) + goto invalid; + valid = 1; + continue; + } + + if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("ENV")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ENV attribute\n"); + goto invalid; + } + if (strncmp(attr, "PHYSDEV", 7) == 0) + physdev = 1; + if (add_rule_key_pair(rules, rule, &rule->env, operation, attr, value) != 0) + goto invalid; + valid = 1; + continue; + } + + if (strcasecmp(key, "PROGRAM") == 0) { + add_rule_key(rule, &rule->program, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "RESULT") == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid RESULT operation\n"); + goto invalid; + } + add_rule_key(rule, &rule->result, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("IMPORT")-1); + if (attr != NULL && strstr(attr, "program")) { + dbg(rules->udev, "IMPORT will be executed\n"); + rule->import_type = IMPORT_PROGRAM; + } else if (attr != NULL && strstr(attr, "file")) { + dbg(rules->udev, "IMPORT will be included as file\n"); + rule->import_type = IMPORT_FILE; + } else if (attr != NULL && strstr(attr, "parent")) { + dbg(rules->udev, "IMPORT will include the parent values\n"); + rule->import_type = IMPORT_PARENT; + } else { + /* figure it out if it is executable */ + char file[UTIL_PATH_SIZE]; + char *pos; + struct stat statbuf; + + util_strlcpy(file, value, sizeof(file)); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + + /* allow programs in /lib/udev called without the path */ + if (strchr(file, '/') == NULL) { + util_strlcpy(file, UDEV_PREFIX "/lib/udev/", sizeof(file)); + util_strlcat(file, value, sizeof(file)); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + } + + dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); + if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { + dbg(rules->udev, "IMPORT is executable, will be executed (autotype)\n"); + rule->import_type = IMPORT_PROGRAM; + } else { + dbg(rules->udev, "IMPORT is not executable, will be included as file (autotype)\n"); + rule->import_type = IMPORT_FILE; + } + } + add_rule_key(rule, &rule->import, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { + if (operation != KEY_OP_MATCH && + operation != KEY_OP_NOMATCH) { + err(rules->udev, "invalid TEST operation\n"); + goto invalid; + } + attr = get_key_attribute(rules, key + sizeof("TEST")-1); + if (attr != NULL) + rule->test_mode_mask = strtol(attr, NULL, 8); + add_rule_key(rule, &rule->test, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("RUN")-1); + if (attr != NULL) { + if (strstr(attr, "ignore_error")) + rule->run_ignore_error = 1; + } + add_rule_key(rule, &rule->run, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { + add_rule_key(rule, &rule->wait_for, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "LABEL") == 0) { + add_rule_key(rule, &rule->label, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "GOTO") == 0) { + add_rule_key(rule, &rule->goto_label, operation, value); + valid = 1; + continue; + } + + if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { + attr = get_key_attribute(rules, key + sizeof("NAME")-1); + if (attr != NULL) { + if (strstr(attr, "all_partitions") != NULL) { + dbg(rules->udev, "creation of partition nodes requested\n"); + rule->partitions = DEFAULT_FAKE_PARTITIONS_COUNT; + } + if (strstr(attr, "ignore_remove") != NULL) { + dbg(rules->udev, "remove event should be ignored\n"); + rule->ignore_remove = 1; + } + } + if (value[0] == '\0') + dbg(rules->udev, "name empty, node creation supressed\n"); + add_rule_key(rule, &rule->name, operation, value); + continue; + } + + if (strcasecmp(key, "SYMLINK") == 0) { + if (operation == KEY_OP_MATCH || + operation == KEY_OP_NOMATCH) + add_rule_key(rule, &rule->symlink_match, operation, value); + else + add_rule_key(rule, &rule->symlink, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "OWNER") == 0) { + valid = 1; + if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { + char *endptr; + strtoul(value, &endptr, 10); + if (endptr[0] != '\0') { + char owner[32]; + uid_t uid = lookup_user(rules->udev, value); + dbg(rules->udev, "replacing username='%s' by id=%i\n", value, uid); + sprintf(owner, "%u", (unsigned int) uid); + add_rule_key(rule, &rule->owner, operation, owner); + continue; + } + } + + add_rule_key(rule, &rule->owner, operation, value); + continue; + } + + if (strcasecmp(key, "GROUP") == 0) { + valid = 1; + if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { + char *endptr; + strtoul(value, &endptr, 10); + if (endptr[0] != '\0') { + char group[32]; + gid_t gid = lookup_group(rules->udev, value); + dbg(rules->udev, "replacing groupname='%s' by id=%i\n", value, gid); + sprintf(group, "%u", (unsigned int) gid); + add_rule_key(rule, &rule->group, operation, group); + continue; + } + } + + add_rule_key(rule, &rule->group, operation, value); + continue; + } + + if (strcasecmp(key, "MODE") == 0) { + add_rule_key(rule, &rule->mode, operation, value); + valid = 1; + continue; + } + + if (strcasecmp(key, "OPTIONS") == 0) { + const char *pos; + + if (strstr(value, "last_rule") != NULL) { + dbg(rules->udev, "last rule to be applied\n"); + rule->last_rule = 1; + } + if (strstr(value, "ignore_device") != NULL) { + dbg(rules->udev, "device should be ignored\n"); + rule->ignore_device = 1; + } + if (strstr(value, "ignore_remove") != NULL) { + dbg(rules->udev, "remove event should be ignored\n"); + rule->ignore_remove = 1; + } + pos = strstr(value, "link_priority="); + if (pos != NULL) { + rule->link_priority = atoi(&pos[strlen("link_priority=")]); + dbg(rules->udev, "link priority=%i\n", rule->link_priority); + } + pos = strstr(value, "event_timeout="); + if (pos != NULL) { + rule->event_timeout = atoi(&pos[strlen("event_timeout=")]); + dbg(rules->udev, "event timout=%i\n", rule->event_timeout); + } + pos = strstr(value, "string_escape="); + if (pos != NULL) { + pos = &pos[strlen("string_escape=")]; + if (strncmp(pos, "none", strlen("none")) == 0) + rule->string_escape = ESCAPE_NONE; + else if (strncmp(pos, "replace", strlen("replace")) == 0) + rule->string_escape = ESCAPE_REPLACE; + } + if (strstr(value, "all_partitions") != NULL) { + dbg(rules->udev, "creation of partition nodes requested\n"); + rule->partitions = DEFAULT_FAKE_PARTITIONS_COUNT; + } + valid = 1; + continue; + } + + err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); + } + + if (physdev && rule->wait_for.operation == KEY_OP_UNSET) + err(rules->udev, "PHYSDEV* values are deprecated and will be removed from a future kernel, \n" + "please fix it in %s:%u", filename, lineno); + + /* skip line if not any valid key was found */ + if (!valid) + goto invalid; + + /* grow buffer and add rule */ + rule_size = sizeof(struct udev_rule) + rule->bufsize; + padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); + dbg(rules->udev, "add %zi padding bytes\n", padding); + rule_size += padding; + rule->bufsize += padding; + + rules->buf = realloc(rules->buf, rules->bufsize + rule_size); + if (!rules->buf) { + err(rules->udev, "realloc failed\n"); + goto exit; + } + dbg(rules->udev, "adding rule to offset %zi\n", rules->bufsize); + memcpy(rules->buf + rules->bufsize, rule, rule_size); + rules->bufsize += rule_size; +exit: + return 0; + +invalid: + err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); + return -1; +} + +static int parse_file(struct udev_rules *rules, const char *filename) +{ + FILE *f; + char line[UTIL_LINE_SIZE]; + size_t start; + struct udev_rule *rule; + struct udev_rules_iter iter; + + start = rules->bufsize; + info(rules->udev, "reading '%s' as rules file\n", filename); + + f = fopen(filename, "r"); + if (f == NULL) + return -1; + + while(fgets(line, sizeof(line), f) != NULL) { + int line_nr = 0; + char *key; + size_t len; + + /* skip whitespace */ + line_nr++; + key = line; + while (isspace(key[0])) + key++; + + /* comment */ + if (key[0] == '#') + continue; + + len = strlen(line); + if (len < 3) + continue; + + /* continue reading if backslash+newline is found */ + while (line[len-2] == '\\') { + if (fgets(&line[len-2], (sizeof(line)-len)+2, f) == NULL) + break; + line_nr++; + len = strlen(line); + } + + if (len+1 >= sizeof(line)) { + err(rules->udev, "line too long '%s':%u, ignored\n", filename, line_nr); + continue; + } + add_to_rules(rules, key, filename, line_nr); + } + fclose(f); + + /* compute all goto targets within this file */ + udev_rules_iter_init(&iter, rules); + udev_rules_iter_goto(&iter, start); + while((rule = udev_rules_iter_next(&iter))) { + if (rule->goto_label.operation != KEY_OP_UNSET) { + char *goto_label = &rule->buf[rule->goto_label.val_off]; + + dbg(rules->udev, "resolving goto label '%s'\n", goto_label); + rule->goto_rule_off = find_label(&iter, goto_label); + if (rule->goto_rule_off == 0) { + err(rules->udev, "ignore goto to nonexistent label '%s' in '%s'\n", + goto_label, filename); + rule->goto_rule_off = iter.current; + } + } + } + return 0; +} + +static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix) +{ + struct dirent *ent; + DIR *dir; + char filename[UTIL_PATH_SIZE]; + + dbg(udev, "open directory '%s'\n", dirname); + dir = opendir(dirname); + if (dir == NULL) { + err(udev, "unable to open '%s': %m\n", dirname); + return -1; + } + + while (1) { + ent = readdir(dir); + if (ent == NULL || ent->d_name[0] == '\0') + break; + + if ((ent->d_name[0] == '.') || (ent->d_name[0] == '#')) + continue; + + /* look for file matching with specified suffix */ + if (suffix != NULL) { + const char *ext; + + ext = strrchr(ent->d_name, '.'); + if (ext == NULL) + continue; + if (strcmp(ext, suffix) != 0) + continue; + } + dbg(udev, "put file '%s/%s' into list\n", dirname, ent->d_name); + + snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); + filename[sizeof(filename)-1] = '\0'; + udev_list_entry_add(udev, file_list, filename, NULL, 1, 1); + } + + closedir(dir); + return 0; +} + +int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names) +{ + struct stat statbuf; + char filename[PATH_MAX]; + struct udev_list_node file_list; + struct udev_list_entry *file_loop, *file_tmp; + int retval = 0; + + memset(rules, 0x00, sizeof(struct udev_rules)); + rules->udev = udev; + rules->resolve_names = resolve_names; + udev_list_init(&file_list); + + if (udev_get_rules_path(udev) != NULL) { + /* custom rules location for testing */ + add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); + } else { + struct udev_list_node sort_list; + struct udev_list_entry *sort_loop, *sort_tmp; + + /* read user/custom rules */ + add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); + + /* read dynamic/temporary rules */ + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + util_strlcat(filename, "/.udev/rules.d", sizeof(filename)); + if (stat(filename, &statbuf) != 0) { + create_path(udev, filename); + udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); + mkdir(filename, 0755); + udev_selinux_resetfscreatecon(udev); + } + udev_list_init(&sort_list); + add_matching_files(udev, &sort_list, filename, ".rules"); + + /* read default rules */ + add_matching_files(udev, &sort_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); + + /* sort all rules files by basename into list of files */ + udev_list_entry_foreach_safe(sort_loop, sort_tmp, udev_list_get_entry(&sort_list)) { + const char *sort_name = udev_list_entry_get_name(sort_loop); + const char *sort_base = strrchr(sort_name, '/'); + + if (sort_base == NULL) + continue; + + udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { + const char *file_name = udev_list_entry_get_name(file_loop); + const char *file_base = strrchr(file_name, '/'); + + if (file_base == NULL) + continue; + if (strcmp(file_base, sort_base) == 0) { + info(udev, "rule file basename '%s' already added, ignoring '%s'\n", + file_name, sort_name); + udev_list_entry_remove(sort_loop); + sort_loop = NULL; + break; + } + if (strcmp(file_base, sort_base) > 0) + break; + } + if (sort_loop != NULL) + udev_list_entry_move_before(sort_loop, file_loop); + } + } + + /* parse list of files */ + udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { + const char *file_name = udev_list_entry_get_name(file_loop); + + if (stat(file_name, &statbuf) == 0 && statbuf.st_size > 0) + parse_file(rules, file_name); + else + info(udev, "can not read '%s'\n", file_name); + udev_list_entry_remove(file_loop); + } + return retval; +} + +void udev_rules_cleanup(struct udev_rules *rules) +{ + if (rules->buf) { + free(rules->buf); + rules->buf = NULL; + } +} diff --git a/udev/udev-rules.h b/udev/udev-rules.h deleted file mode 100644 index d8f2f367c9..0000000000 --- a/udev/udev-rules.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef UDEV_RULES_H -#define UDEV_RULES_H - -#include "udev.h" - -#define PAIRS_MAX 5 - -enum key_operation { - KEY_OP_UNSET, - KEY_OP_MATCH, - KEY_OP_NOMATCH, - KEY_OP_ADD, - KEY_OP_ASSIGN, - KEY_OP_ASSIGN_FINAL, -}; - -struct key { - enum key_operation operation; - size_t val_off; -}; - -struct key_pair { - struct key key; - size_t key_name_off; -}; - -struct key_pairs { - int count; - struct key_pair keys[PAIRS_MAX]; -}; - -enum import_type { - IMPORT_UNSET, - IMPORT_PROGRAM, - IMPORT_FILE, - IMPORT_PARENT, -}; - -enum escape_type { - ESCAPE_UNSET, - ESCAPE_NONE, - ESCAPE_REPLACE, -}; - -struct udev_rule { - struct key action; - struct key devpath; - struct key kernel; - struct key subsystem; - struct key driver; - struct key_pairs attr; - - struct key kernels; - struct key subsystems; - struct key drivers; - struct key_pairs attrs; - - struct key_pairs env; - struct key program; - struct key result; - struct key import; - enum import_type import_type; - struct key test; - mode_t test_mode_mask; - struct key run; - struct key wait_for; - struct key label; - struct key goto_label; - size_t goto_rule_off; - - struct key name; - struct key symlink; - struct key symlink_match; - struct key owner; - struct key group; - struct key mode; - enum escape_type string_escape; - - unsigned int link_priority; - int event_timeout; - unsigned int partitions; - unsigned int last_rule:1, - run_ignore_error:1, - ignore_device:1, - ignore_remove:1; - - size_t bufsize; - char buf[]; -}; - -struct udev_rules { - struct udev *udev; - char *buf; - size_t bufsize; - int resolve_names; -}; - -struct udev_rules_iter { - struct udev_rules *rules; - size_t current; -}; - -extern int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names); -extern void udev_rules_cleanup(struct udev_rules *rules); - -extern void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules); -extern struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter); -extern struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off); - -extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event); -extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event); -extern int udev_rules_run(struct udev_event *event); - -extern void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize); - -#endif diff --git a/udev/udev.h b/udev/udev.h index 5030972d9b..0e8a8697bd 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -30,7 +30,7 @@ #define ALLOWED_CHARS_FILE ALLOWED_CHARS "/" #define ALLOWED_CHARS_INPUT ALLOWED_CHARS_FILE " $%?," -#define DEFAULT_PARTITIONS_COUNT 15 +#define DEFAULT_FAKE_PARTITIONS_COUNT 15 #define UDEV_EVENT_TIMEOUT 180 /* linux/include/linux/kobject.h */ @@ -40,13 +40,9 @@ #define UDEV_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd" #define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) - -/* pipes */ #define READ_END 0 #define WRITE_END 1 -struct udev_rules; - static inline void logging_init(const char *program_name) { openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); @@ -90,10 +86,25 @@ struct udev_event { int exitstatus; time_t queue_time; }; +struct udev_rules; extern struct udev_event *udev_event_new(struct udev_device *dev); extern void udev_event_unref(struct udev_event *event); extern int udev_event_run(struct udev_event *event, struct udev_rules *rules); +/* udev-rules.c */ +struct udev_rules { + struct udev *udev; + char *buf; + size_t bufsize; + int resolve_names; +}; +extern int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names); +extern void udev_rules_cleanup(struct udev_rules *rules); +extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event); +extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event); +extern int udev_rules_run(struct udev_event *event); +extern void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize); + /* udev-node.c */ extern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid); extern int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const char *group, int test); diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 090c524190..99f6c36dde 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -29,7 +29,6 @@ #include #include "udev.h" -#include "udev-rules.h" int udevadm_test(struct udev *udev, int argc, char *argv[]) { diff --git a/udev/udevd.c b/udev/udevd.c index 576f9e8233..5388961c42 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -36,7 +36,6 @@ #endif #include "udev.h" -#include "udev-rules.h" #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 -- cgit v1.2.3-54-g00ecf From d7ddce186c8a0171eb98862b6f8ff72d64261b33 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 15:02:01 +0200 Subject: make struct udev_rules opaque --- udev/test-udev.c | 8 ++++---- udev/udev-rules.c | 37 +++++++++++++++++++++++-------------- udev/udev.h | 10 ++-------- udev/udevadm-test.c | 13 +++++++++---- udev/udevd.c | 21 +++++++++++++++------ 5 files changed, 53 insertions(+), 36 deletions(-) diff --git a/udev/test-udev.c b/udev/test-udev.c index 1caccce304..4f8a7e4f66 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) struct udev *udev; struct udev_event *event; struct udev_device *dev; - struct udev_rules rules; + struct udev_rules *rules; char syspath[UTIL_PATH_SIZE]; const char *devpath; const char *action; @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) goto exit; } - udev_rules_init(udev, &rules, 0); + rules = udev_rules_new(udev, 0); util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); util_strlcat(syspath, devpath, sizeof(syspath)); @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) udev_device_set_action(dev, action); event = udev_event_new(dev); - err = udev_event_run(event, &rules); + err = udev_event_run(event, rules); /* rules may change/disable the timeout */ if (udev_device_get_event_timeout(dev) >= 0) @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) udev_event_unref(event); udev_device_unref(dev); fail: - udev_rules_cleanup(&rules); + udev_rules_unref(rules); exit: selinux_exit(udev); udev_unref(udev); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 445eec4239..6d7e3f4fca 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -34,7 +34,17 @@ #include "udev.h" -#define PAIRS_MAX 5 +struct udev_rules { + struct udev *udev; + char *buf; + size_t bufsize; + int resolve_names; +}; + +struct udev_rules_iter { + struct udev_rules *rules; + size_t current; +}; enum key_operation { KEY_OP_UNSET, @@ -55,6 +65,7 @@ struct key_pair { size_t key_name_off; }; +#define PAIRS_MAX 5 struct key_pairs { int count; struct key_pair keys[PAIRS_MAX]; @@ -119,11 +130,6 @@ struct udev_rule { char buf[]; }; -struct udev_rules_iter { - struct udev_rules *rules; - size_t current; -}; - static void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules) { dbg(rules->udev, "bufsize=%zi\n", rules->bufsize); @@ -1860,7 +1866,6 @@ static int get_key(struct udev_rules *rules, char **line, char **key, enum key_o /* move line to next key */ *line = temp; - return 0; } @@ -1932,7 +1937,6 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena char *attr; size_t padding; int physdev = 0; - int retval; memset(buf, 0x00, sizeof(buf)); rule = (struct udev_rule *) buf; @@ -1946,8 +1950,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena char *value; enum key_operation operation = KEY_OP_UNSET; - retval = get_key(rules, &linepos, &key, &operation, &value); - if (retval) + if (get_key(rules, &linepos, &key, &operation, &value) != 0) break; if (strcasecmp(key, "ACTION") == 0) { @@ -2462,14 +2465,17 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis return 0; } -int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names) +struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { + struct udev_rules *rules; struct stat statbuf; char filename[PATH_MAX]; struct udev_list_node file_list; struct udev_list_entry *file_loop, *file_tmp; - int retval = 0; + rules = malloc(sizeof(struct udev_rules)); + if (rules == NULL) + return rules; memset(rules, 0x00, sizeof(struct udev_rules)); rules->udev = udev; rules->resolve_names = resolve_names; @@ -2539,13 +2545,16 @@ int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_nam info(udev, "can not read '%s'\n", file_name); udev_list_entry_remove(file_loop); } - return retval; + return rules; } -void udev_rules_cleanup(struct udev_rules *rules) +void udev_rules_unref(struct udev_rules *rules) { + if (rules == NULL) + return; if (rules->buf) { free(rules->buf); rules->buf = NULL; } + free(rules); } diff --git a/udev/udev.h b/udev/udev.h index 0e8a8697bd..eb020cd3bb 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -92,14 +92,8 @@ extern void udev_event_unref(struct udev_event *event); extern int udev_event_run(struct udev_event *event, struct udev_rules *rules); /* udev-rules.c */ -struct udev_rules { - struct udev *udev; - char *buf; - size_t bufsize; - int resolve_names; -}; -extern int udev_rules_init(struct udev *udev, struct udev_rules *rules, int resolve_names); -extern void udev_rules_cleanup(struct udev_rules *rules); +extern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); +extern void udev_rules_unref(struct udev_rules *rules); extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event); extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event); extern int udev_rules_run(struct udev_event *event); diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 99f6c36dde..c64e0456bb 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -38,7 +38,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) const char *syspath = NULL; struct udev_event *event; struct udev_device *dev; - struct udev_rules rules = {}; + struct udev_rules *rules = NULL; int err; int rc = 0; @@ -89,7 +89,12 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) "some values may be different, or not available at a simulation run.\n" "\n"); - udev_rules_init(udev, &rules, 0); + rules = udev_rules_new(udev, 0); + if (rules == NULL) { + fprintf(stderr, "error reading rules\n"); + rc = 1; + goto exit; + } /* add /sys if needed */ if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { @@ -116,7 +121,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) if (!force) event->test = 1; - err = udev_event_run(event, &rules); + err = udev_event_run(event, rules); if (udev_device_get_event_timeout(dev) >= 0) info(udev, "custom event timeout: %i\n", udev_device_get_event_timeout(dev)); @@ -135,6 +140,6 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) udev_event_unref(event); udev_device_unref(dev); exit: - udev_rules_cleanup(&rules); + udev_rules_unref(rules); return rc; } diff --git a/udev/udevd.c b/udev/udevd.c index 5388961c42..918825ae50 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -58,7 +58,7 @@ static void log_fn(struct udev *udev, int priority, } static int debug_trace; -static struct udev_rules rules; +static struct udev_rules *rules; static struct udev_ctrl *udev_ctrl; static struct udev_monitor *kernel_monitor; static int inotify_fd = -1; @@ -208,7 +208,7 @@ static void event_fork(struct udev_event *event) alarm(UDEV_EVENT_TIMEOUT); /* apply rules, create node, symlinks */ - err = udev_event_run(event, &rules); + err = udev_event_run(event, rules); /* rules may change/disable the timeout */ if (udev_device_get_event_timeout(event->dev) >= 0) @@ -748,9 +748,13 @@ int main(int argc, char *argv[]) goto exit; } + rules = udev_rules_new(udev, 1); + if (rules == NULL) { + err(udev, "error reading rules\n"); + goto exit; + } udev_list_init(&running_list); udev_list_init(&exec_list); - udev_rules_init(udev, &rules, 1); export_initial_seqnum(udev); if (daemonize) { @@ -934,9 +938,14 @@ int main(int argc, char *argv[]) /* rules changed, set by inotify or a HUP signal */ if (reload_config) { + struct udev_rules *rules_new; + reload_config = 0; - udev_rules_cleanup(&rules); - udev_rules_init(udev, &rules, 1); + rules_new = udev_rules_new(udev, 1); + if (rules_new != NULL) { + udev_rules_unref(rules); + rules = rules_new; + } } if (sigchilds_waiting) { @@ -953,7 +962,7 @@ int main(int argc, char *argv[]) rc = 0; exit: - udev_rules_cleanup(&rules); + udev_rules_unref(rules); if (signal_pipe[READ_END] >= 0) close(signal_pipe[READ_END]); -- cgit v1.2.3-54-g00ecf From d0db192fa5a50eee27bce3e92c89f3ec1294638d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 15:25:05 +0200 Subject: move run_program to util --- udev/udev-rules.c | 235 +++--------------------------------------------------- udev/udev-util.c | 213 +++++++++++++++++++++++++++++++++++++++++++++++++ udev/udev.h | 2 + 3 files changed, 225 insertions(+), 225 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 6d7e3f4fca..62624bbc85 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -24,13 +24,8 @@ #include #include #include -#include #include #include -#include -#include -#include -#include #include "udev.h" @@ -234,223 +229,6 @@ static int get_format_len(struct udev *udev, char **str) return -1; } -static int run_program(struct udev_device *dev, const char *command, - char *result, size_t ressize, size_t *reslen) -{ - struct udev *udev = udev_device_get_udev(dev); - int status; - char **envp; - int outpipe[2] = {-1, -1}; - int errpipe[2] = {-1, -1}; - pid_t pid; - char arg[UTIL_PATH_SIZE]; - char program[UTIL_PATH_SIZE]; - char *argv[(sizeof(arg) / 2) + 1]; - int devnull; - int i; - int err = 0; - - /* build argv from command */ - util_strlcpy(arg, command, sizeof(arg)); - i = 0; - if (strchr(arg, ' ') != NULL) { - char *pos = arg; - - while (pos != NULL && pos[0] != '\0') { - if (pos[0] == '\'') { - /* do not separate quotes */ - pos++; - argv[i] = strsep(&pos, "\'"); - while (pos != NULL && pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - } - dbg(udev, "arg[%i] '%s'\n", i, argv[i]); - i++; - } - argv[i] = NULL; - } else { - argv[0] = arg; - argv[1] = NULL; - } - info(udev, "'%s'\n", command); - - /* prepare pipes from child to parent */ - if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(outpipe) != 0) { - err(udev, "pipe failed: %m\n"); - return -1; - } - } - if (udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(errpipe) != 0) { - err(udev, "pipe failed: %m\n"); - return -1; - } - } - - /* allow programs in /lib/udev/ to be called without the path */ - if (strchr(argv[0], '/') == NULL) { - util_strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); - util_strlcat(program, argv[0], sizeof(program)); - argv[0] = program; - } - - envp = udev_device_get_properties_envp(dev); - - pid = fork(); - switch(pid) { - case 0: - /* child closes parent ends of pipes */ - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* discard child output or connect to pipe */ - devnull = open("/dev/null", O_RDWR); - if (devnull > 0) { - dup2(devnull, STDIN_FILENO); - if (outpipe[WRITE_END] < 0) - dup2(devnull, STDOUT_FILENO); - if (errpipe[WRITE_END] < 0) - dup2(devnull, STDERR_FILENO); - close(devnull); - } else - err(udev, "open /dev/null failed: %m\n"); - if (outpipe[WRITE_END] > 0) { - dup2(outpipe[WRITE_END], STDOUT_FILENO); - close(outpipe[WRITE_END]); - } - if (errpipe[WRITE_END] > 0) { - dup2(errpipe[WRITE_END], STDERR_FILENO); - close(errpipe[WRITE_END]); - } - execve(argv[0], argv, envp); - if (errno == ENOENT || errno == ENOTDIR) { - /* may be on a filesytem which is not mounted right now */ - info(udev, "program '%s' not found\n", argv[0]); - } else { - /* other problems */ - err(udev, "exec of program '%s' failed\n", argv[0]); - } - _exit(1); - case -1: - err(udev, "fork of '%s' failed: %m\n", argv[0]); - return -1; - default: - /* read from child if requested */ - if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - ssize_t count; - size_t respos = 0; - - /* parent closes child ends of pipes */ - if (outpipe[WRITE_END] > 0) - close(outpipe[WRITE_END]); - if (errpipe[WRITE_END] > 0) - close(errpipe[WRITE_END]); - - /* read child output */ - while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - int fdcount; - fd_set readfds; - - FD_ZERO(&readfds); - if (outpipe[READ_END] > 0) - FD_SET(outpipe[READ_END], &readfds); - if (errpipe[READ_END] > 0) - FD_SET(errpipe[READ_END], &readfds); - fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err = -1; - break; - } - - /* get stdout */ - if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { - char inbuf[1024]; - char *pos; - char *line; - - count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); - if (count <= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - if (count < 0) { - err(udev, "stdin read failed: %m\n"); - err = -1; - } - continue; - } - inbuf[count] = '\0'; - - /* store result for rule processing */ - if (result) { - if (respos + count < ressize) { - memcpy(&result[respos], inbuf, count); - respos += count; - } else { - err(udev, "ressize %ld too short\n", (long)ressize); - err = -1; - } - } - pos = inbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stdout) '%s'\n", argv[0], line); - } - - /* get stderr */ - if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { - char errbuf[1024]; - char *pos; - char *line; - - count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); - if (count <= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - if (count < 0) - err(udev, "stderr read failed: %m\n"); - continue; - } - errbuf[count] = '\0'; - pos = errbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stderr) '%s'\n", argv[0], line); - } - } - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* return the childs stdout string */ - if (result) { - result[respos] = '\0'; - dbg(udev, "result='%s'\n", result); - if (reslen) - *reslen = respos; - } - } - waitpid(pid, &status, 0); - if (WIFEXITED(status)) { - info(udev, "'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); - if (WEXITSTATUS(status) != 0) - err = -1; - } else { - err(udev, "'%s' abnormal exit\n", argv[0]); - err = -1; - } - } - - return err; -} - static int import_property_from_string(struct udev_device *dev, char *line) { struct udev *udev = udev_device_get_udev(dev); @@ -544,11 +322,14 @@ static int import_file_into_env(struct udev_device *dev, const char *filename) static int import_program_into_env(struct udev_device *dev, const char *program) { + struct udev *udev = udev_device_get_udev(dev); + char **envp; char result[2048]; size_t reslen; char *line; - if (run_program(dev, program, result, sizeof(result), &reslen) != 0) + envp = udev_device_get_properties_envp(dev); + if (run_program(udev, program, envp, result, sizeof(result), &reslen) != 0) return -1; line = result; @@ -612,10 +393,12 @@ int udev_rules_run(struct udev_event *event) udev_monitor_unref(monitor); } else { char program[UTIL_PATH_SIZE]; + char **envp; util_strlcpy(program, cmd, sizeof(program)); udev_rules_apply_format(event, program, sizeof(program)); - if (run_program(event->dev, program, NULL, 0, NULL) != 0) { + envp = udev_device_get_properties_envp(event->dev); + if (run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { if (!udev_list_entry_get_flag(list_entry)) err = -1; } @@ -1372,11 +1155,13 @@ try_parent: /* execute external program */ if (rule->program.operation != KEY_OP_UNSET) { char program[UTIL_PATH_SIZE]; + char **envp; char result[UTIL_PATH_SIZE]; util_strlcpy(program, key_val(rule, &rule->program), sizeof(program)); udev_rules_apply_format(event, program, sizeof(program)); - if (run_program(event->dev, program, result, sizeof(result), NULL) != 0) { + envp = udev_device_get_properties_envp(dev); + if (run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { dbg(event->udev, "PROGRAM is false\n"); event->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) diff --git a/udev/udev-util.c b/udev/udev-util.c index 59c4d194dd..d17a151966 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "udev.h" @@ -158,3 +159,215 @@ extern gid_t lookup_group(struct udev *udev, const char *group) return gid; } + +int run_program(struct udev *udev, const char *command, char **envp, + char *result, size_t ressize, size_t *reslen) +{ + int status; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[UTIL_PATH_SIZE]; + char program[UTIL_PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; + int devnull; + int i; + int err = 0; + + /* build argv from command */ + util_strlcpy(arg, command, sizeof(arg)); + i = 0; + if (strchr(arg, ' ') != NULL) { + char *pos = arg; + + while (pos != NULL && pos[0] != '\0') { + if (pos[0] == '\'') { + /* do not separate quotes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos != NULL && pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg(udev, "arg[%i] '%s'\n", i, argv[i]); + i++; + } + argv[i] = NULL; + } else { + argv[0] = arg; + argv[1] = NULL; + } + info(udev, "'%s'\n", command); + + /* prepare pipes from child to parent */ + if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe(outpipe) != 0) { + err(udev, "pipe failed: %m\n"); + return -1; + } + } + if (udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe(errpipe) != 0) { + err(udev, "pipe failed: %m\n"); + return -1; + } + } + + /* allow programs in /lib/udev/ to be called without the path */ + if (strchr(argv[0], '/') == NULL) { + util_strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); + util_strlcat(program, argv[0], sizeof(program)); + argv[0] = program; + } + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent ends of pipes */ + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* discard child output or connect to pipe */ + devnull = open("/dev/null", O_RDWR); + if (devnull > 0) { + dup2(devnull, STDIN_FILENO); + if (outpipe[WRITE_END] < 0) + dup2(devnull, STDOUT_FILENO); + if (errpipe[WRITE_END] < 0) + dup2(devnull, STDERR_FILENO); + close(devnull); + } else + err(udev, "open /dev/null failed: %m\n"); + if (outpipe[WRITE_END] > 0) { + dup2(outpipe[WRITE_END], STDOUT_FILENO); + close(outpipe[WRITE_END]); + } + if (errpipe[WRITE_END] > 0) { + dup2(errpipe[WRITE_END], STDERR_FILENO); + close(errpipe[WRITE_END]); + } + execve(argv[0], argv, envp); + if (errno == ENOENT || errno == ENOTDIR) { + /* may be on a filesytem which is not mounted right now */ + info(udev, "program '%s' not found\n", argv[0]); + } else { + /* other problems */ + err(udev, "exec of program '%s' failed\n", argv[0]); + } + _exit(1); + case -1: + err(udev, "fork of '%s' failed: %m\n", argv[0]); + return -1; + default: + /* read from child if requested */ + if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + ssize_t count; + size_t respos = 0; + + /* parent closes child ends of pipes */ + if (outpipe[WRITE_END] > 0) + close(outpipe[WRITE_END]); + if (errpipe[WRITE_END] > 0) + close(errpipe[WRITE_END]); + + /* read child output */ + while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + int fdcount; + fd_set readfds; + + FD_ZERO(&readfds); + if (outpipe[READ_END] > 0) + FD_SET(outpipe[READ_END], &readfds); + if (errpipe[READ_END] > 0) + FD_SET(errpipe[READ_END], &readfds); + fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -1; + break; + } + + /* get stdout */ + if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { + char inbuf[1024]; + char *pos; + char *line; + + count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); + if (count <= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + if (count < 0) { + err(udev, "stdin read failed: %m\n"); + err = -1; + } + continue; + } + inbuf[count] = '\0'; + + /* store result for rule processing */ + if (result) { + if (respos + count < ressize) { + memcpy(&result[respos], inbuf, count); + respos += count; + } else { + err(udev, "ressize %ld too short\n", (long)ressize); + err = -1; + } + } + pos = inbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info(udev, "'%s' (stdout) '%s'\n", argv[0], line); + } + + /* get stderr */ + if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { + char errbuf[1024]; + char *pos; + char *line; + + count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); + if (count <= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + if (count < 0) + err(udev, "stderr read failed: %m\n"); + continue; + } + errbuf[count] = '\0'; + pos = errbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info(udev, "'%s' (stderr) '%s'\n", argv[0], line); + } + } + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* return the childs stdout string */ + if (result) { + result[respos] = '\0'; + dbg(udev, "result='%s'\n", result); + if (reslen) + *reslen = respos; + } + } + waitpid(pid, &status, 0); + if (WIFEXITED(status)) { + info(udev, "'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + err = -1; + } else { + err(udev, "'%s' abnormal exit\n", argv[0]); + err = -1; + } + } + return err; +} diff --git a/udev/udev.h b/udev/udev.h index eb020cd3bb..be76fe3ceb 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -111,6 +111,8 @@ extern int delete_path(struct udev *udev, const char *path); extern int unlink_secure(struct udev *udev, const char *filename); extern uid_t lookup_user(struct udev *udev, const char *user); extern gid_t lookup_group(struct udev *udev, const char *group); +extern int run_program(struct udev *udev, const char *command, char **envp, + char *result, size_t ressize, size_t *reslen); /* udev_utils_file.c */ extern int file_map(const char *filename, char **buf, size_t *bufsize); -- cgit v1.2.3-54-g00ecf From 836dcf951c0f6c4f76f7b194d5bb96d1cbb5366f Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sat, 18 Oct 2008 13:39:04 +0100 Subject: udevd: avoid overhead of calling rmdir on non-empty directories Unfortunately the linux rmdir implementation unhashes the dentry even when the directory is not removed. This is apparently by design (for filesystems that don't allow deleting open files). Results from time(1) and oprofile follow. Before: 0.35user 0.90system samples % image name symbol name 608 9.6738 vmlinux shrink_dcache_parent 293 4.6619 vmlinux copy_page_c 271 4.3119 vmlinux copy_page_range 257 4.0891 udevd udev_rules_iter_next After: 0.31user 0.67system samples % image name symbol name 361 5.0419 vmlinux copy_page_range 322 4.4972 udevd udev_rules_iter_next 300 4.1899 vmlinux copy_page_c Signed-off-by: Alan Jenkins --- udev/udevd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 918825ae50..d5c12ad56c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -108,8 +108,8 @@ static void export_event_state(struct udev_event *event, enum event_state state) switch (state) { case EVENT_QUEUED: - unlink(filename_failed); - delete_path(event->udev, filename_failed); + if(unlink(filename_failed) == 0) + delete_path(event->udev, filename_failed); create_path(event->udev, filename); udev_selinux_setfscreatecon(event->udev, filename, S_IFLNK); symlink(udev_device_get_devpath(event->dev), filename); @@ -130,12 +130,15 @@ static void export_event_state(struct udev_event *event, enum event_state state) info(event->udev, "renamed devpath, moved failed state of '%s' to %s'\n", udev_device_get_devpath_old(event->dev), udev_device_get_devpath(event->dev)); } else { - unlink(filename_failed); - delete_path(event->udev, filename_failed); + if (unlink(filename_failed) == 0) + delete_path(event->udev, filename_failed); } unlink(filename); - delete_path(event->udev, filename); + + /* clean up possibly empty queue directory */ + if (udev_list_is_empty(&exec_list) && udev_list_is_empty(&running_list)) + delete_path(event->udev, filename); break; case EVENT_FAILED: /* move failed event to the failed directory */ @@ -143,7 +146,8 @@ static void export_event_state(struct udev_event *event, enum event_state state) rename(filename, filename_failed); /* clean up possibly empty queue directory */ - delete_path(event->udev, filename); + if (udev_list_is_empty(&exec_list) && udev_list_is_empty(&running_list)) + delete_path(event->udev, filename); break; } -- cgit v1.2.3-54-g00ecf From dcdcb8cc06c044a0429a688266799838e914f88d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 15:46:55 +0200 Subject: udev_event_run() -> udev_event_execute_rules() --- udev/test-udev.c | 2 +- udev/udev-event.c | 3 +-- udev/udev.h | 2 +- udev/udevadm-test.c | 2 +- udev/udevd.c | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/udev/test-udev.c b/udev/test-udev.c index 4f8a7e4f66..d304a1cc15 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) udev_device_set_action(dev, action); event = udev_event_new(dev); - err = udev_event_run(event, rules); + err = udev_event_execute_rules(event, rules); /* rules may change/disable the timeout */ if (udev_device_get_event_timeout(dev) >= 0) diff --git a/udev/udev-event.c b/udev/udev-event.c index 07c02211a0..fe4dcec4e1 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -142,13 +142,12 @@ static int rename_netif(struct udev_event *event) usleep(1000 * 1000 / 20); } } - exit: close(sk); return err; } -int udev_event_run(struct udev_event *event, struct udev_rules *rules) +int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) { struct udev_device *dev = event->dev; int err = 0; diff --git a/udev/udev.h b/udev/udev.h index be76fe3ceb..d0ffb6cb31 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -89,7 +89,7 @@ struct udev_event { struct udev_rules; extern struct udev_event *udev_event_new(struct udev_device *dev); extern void udev_event_unref(struct udev_event *event); -extern int udev_event_run(struct udev_event *event, struct udev_rules *rules); +extern int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules); /* udev-rules.c */ extern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index c64e0456bb..342b89d084 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -121,7 +121,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) if (!force) event->test = 1; - err = udev_event_run(event, rules); + err = udev_event_execute_rules(event, rules); if (udev_device_get_event_timeout(dev) >= 0) info(udev, "custom event timeout: %i\n", udev_device_get_event_timeout(dev)); diff --git a/udev/udevd.c b/udev/udevd.c index d5c12ad56c..111f120006 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -212,7 +212,7 @@ static void event_fork(struct udev_event *event) alarm(UDEV_EVENT_TIMEOUT); /* apply rules, create node, symlinks */ - err = udev_event_run(event, rules); + err = udev_event_execute_rules(event, rules); /* rules may change/disable the timeout */ if (udev_device_get_event_timeout(event->dev) >= 0) -- cgit v1.2.3-54-g00ecf From 2d73813ebc5a9b507655ec629ba8b40e4fbf28a8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 15:50:16 +0200 Subject: udev_rules_run() -> udev_event_execute_run(); --- udev/test-udev.c | 2 +- udev/udev-event.c | 33 +++++++++++++++++++++++++++++++++ udev/udev-rules.c | 33 --------------------------------- udev/udev.h | 2 +- udev/udevd.c | 2 +- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/udev/test-udev.c b/udev/test-udev.c index d304a1cc15..1cc83c4a69 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) alarm(udev_device_get_event_timeout(dev)); if (err == 0 && !event->ignore_device && udev_get_run(udev)) - udev_rules_run(event); + udev_event_execute_run(event); udev_event_unref(event); udev_device_unref(dev); diff --git a/udev/udev-event.c b/udev/udev-event.c index fe4dcec4e1..b7c3ff142a 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -282,3 +282,36 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) exit: return err; } + +int udev_event_execute_run(struct udev_event *event) +{ + struct udev_list_entry *list_entry; + int err = 0; + + dbg(event->udev, "executing run list\n"); + udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { + const char *cmd = udev_list_entry_get_name(list_entry); + + if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { + struct udev_monitor *monitor; + + monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); + if (monitor == NULL) + continue; + udev_monitor_send_device(monitor, event->dev); + udev_monitor_unref(monitor); + } else { + char program[UTIL_PATH_SIZE]; + char **envp; + + util_strlcpy(program, cmd, sizeof(program)); + udev_rules_apply_format(event, program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + if (run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { + if (!udev_list_entry_get_flag(list_entry)) + err = -1; + } + } + } + return err; +} diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 62624bbc85..978581fb50 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -374,39 +374,6 @@ static int import_parent_into_env(struct udev_device *dev, const char *filter) return 0; } -int udev_rules_run(struct udev_event *event) -{ - struct udev_list_entry *list_entry; - int err = 0; - - dbg(event->udev, "executing run list\n"); - udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { - const char *cmd = udev_list_entry_get_name(list_entry); - - if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { - struct udev_monitor *monitor; - - monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); - if (monitor == NULL) - continue; - udev_monitor_send_device(monitor, event->dev); - udev_monitor_unref(monitor); - } else { - char program[UTIL_PATH_SIZE]; - char **envp; - - util_strlcpy(program, cmd, sizeof(program)); - udev_rules_apply_format(event, program, sizeof(program)); - envp = udev_device_get_properties_envp(event->dev); - if (run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { - if (!udev_list_entry_get_flag(list_entry)) - err = -1; - } - } - } - return err; -} - #define WAIT_LOOP_PER_SECOND 50 static int wait_for_file(struct udev_event *event, const char *file, int timeout) { diff --git a/udev/udev.h b/udev/udev.h index d0ffb6cb31..c8425f768f 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -90,13 +90,13 @@ struct udev_rules; extern struct udev_event *udev_event_new(struct udev_device *dev); extern void udev_event_unref(struct udev_event *event); extern int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules); +extern int udev_event_execute_run(struct udev_event *event); /* udev-rules.c */ extern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); extern void udev_rules_unref(struct udev_rules *rules); extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event); extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event); -extern int udev_rules_run(struct udev_event *event); extern void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize); /* udev-node.c */ diff --git a/udev/udevd.c b/udev/udevd.c index 111f120006..f812940364 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -220,7 +220,7 @@ static void event_fork(struct udev_event *event) /* execute RUN= */ if (err == 0 && !event->ignore_device && udev_get_run(event->udev)) - udev_rules_run(event); + udev_event_execute_run(event); info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err); logging_close(); if (err != 0) -- cgit v1.2.3-54-g00ecf From f1128767cbc805461a8f2e54810146c562d54524 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 19:19:56 +0200 Subject: move udev_rules_apply_format() to udev-event.c --- udev/udev-event.c | 433 ++++++++++++++++++++++++++++++++++++++++++++- udev/udev-rules.c | 495 +++------------------------------------------------- udev/udev.h | 22 ++- udev/udevadm-test.c | 2 +- 4 files changed, 461 insertions(+), 491 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index b7c3ff142a..59ae7c5378 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -57,7 +57,432 @@ void udev_event_unref(struct udev_event *event) free(event); } -static void kernel_log(struct ifreq ifr) +/* extract possible {attr} and move str behind it */ +static char *get_format_attribute(struct udev *udev, char **str) +{ + char *pos; + char *attr = NULL; + + if (*str[0] == '{') { + pos = strchr(*str, '}'); + if (pos == NULL) { + err(udev, "missing closing brace for format\n"); + return NULL; + } + pos[0] = '\0'; + attr = *str+1; + *str = pos+1; + dbg(udev, "attribute='%s', str='%s'\n", attr, *str); + } + return attr; +} + +/* extract possible format length and move str behind it*/ +static int get_format_len(struct udev *udev, char **str) +{ + int num; + char *tail; + + if (isdigit(*str[0])) { + num = (int) strtoul(*str, &tail, 10); + if (num > 0) { + *str = tail; + dbg(udev, "format length=%i\n", num); + return num; + } else { + err(udev, "format parsing error '%s'\n", *str); + } + } + return -1; +} + +/* handle "[/]" format */ +int udev_event_apply_subsys_kernel(struct udev_event *udev_event, const char *string, + char *result, size_t maxsize, int read_value) +{ + char temp[UTIL_PATH_SIZE]; + char *subsys; + char *sysname; + char *attr; + struct udev_device *dev; + + if (string == NULL) + string = result; + if (string[0] != '[') + return -1; + + util_strlcpy(temp, string, sizeof(temp)); + + subsys = &temp[1]; + + sysname = strchr(subsys, '/'); + if (sysname == NULL) + return -1; + sysname[0] = '\0'; + sysname = &sysname[1]; + + attr = strchr(sysname, ']'); + if (attr == NULL) + return -1; + attr[0] = '\0'; + attr = &attr[1]; + if (attr[0] == '/') + attr = &attr[1]; + if (attr[0] == '\0') + attr = NULL; + + if (read_value && attr == NULL) + return -1; + + dev = udev_device_new_from_subsystem_sysname(udev_event->udev, subsys, sysname); + if (dev == NULL) + return -1; + + if (read_value) { + const char *val; + + val = udev_device_get_attr_value(dev, attr); + if (val != NULL) + util_strlcpy(result, val, maxsize); + else + result[0] = '\0'; + info(udev_event->udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } else { + util_strlcpy(result, udev_device_get_syspath(dev), maxsize); + if (attr != NULL) { + util_strlcat(result, "/", maxsize); + util_strlcat(result, attr, maxsize); + } + info(udev_event->udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } + udev_device_unref(dev); + return 0; +} + +void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize) +{ + struct udev_device *dev = event->dev; + char temp[UTIL_PATH_SIZE]; + char temp2[UTIL_PATH_SIZE]; + char *head, *tail, *cpos, *attr, *rest; + int len; + int i; + int count; + enum subst_type { + SUBST_UNKNOWN, + SUBST_DEVPATH, + SUBST_KERNEL, + SUBST_KERNEL_NUMBER, + SUBST_ID, + SUBST_DRIVER, + SUBST_MAJOR, + SUBST_MINOR, + SUBST_RESULT, + SUBST_ATTR, + SUBST_PARENT, + SUBST_TEMP_NODE, + SUBST_NAME, + SUBST_LINKS, + SUBST_ROOT, + SUBST_SYS, + SUBST_ENV, + }; + static const struct subst_map { + char *name; + char fmt; + enum subst_type type; + } map[] = { + { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, + { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, + { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, + { .name = "id", .fmt = 'b', .type = SUBST_ID }, + { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, + { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, + { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, + { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, + { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, + { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, + { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, + { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, + { .name = "name", .fmt = 'D', .type = SUBST_NAME }, + { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, + { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, + { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, + { .name = "env", .fmt = 'E', .type = SUBST_ENV }, + { NULL, '\0', 0 } + }; + enum subst_type type; + const struct subst_map *subst; + + head = string; + while (1) { + len = -1; + while (head[0] != '\0') { + if (head[0] == '$') { + /* substitute named variable */ + if (head[1] == '\0') + break; + if (head[1] == '$') { + util_strlcpy(temp, head+2, sizeof(temp)); + util_strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + for (subst = map; subst->name; subst++) { + if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { + type = subst->type; + tail = head + strlen(subst->name)+1; + dbg(event->udev, "will substitute format name '%s'\n", subst->name); + goto found; + } + } + head[0] = '$'; + err(event->udev, "unknown format variable '%s'\n", head); + } else if (head[0] == '%') { + /* substitute format char */ + if (head[1] == '\0') + break; + if (head[1] == '%') { + util_strlcpy(temp, head+2, sizeof(temp)); + util_strlcpy(head+1, temp, maxsize); + head++; + continue; + } + head[0] = '\0'; + tail = head+1; + len = get_format_len(event->udev, &tail); + for (subst = map; subst->name; subst++) { + if (tail[0] == subst->fmt) { + type = subst->type; + tail++; + dbg(event->udev, "will substitute format char '%c'\n", subst->fmt); + goto found; + } + } + head[0] = '%'; + err(event->udev, "unknown format char '%c'\n", tail[0]); + } + head++; + } + break; +found: + attr = get_format_attribute(event->udev, &tail); + util_strlcpy(temp, tail, sizeof(temp)); + dbg(event->udev, "format=%i, string='%s', tail='%s'\n", type ,string, tail); + + switch (type) { + case SUBST_DEVPATH: + util_strlcat(string, udev_device_get_devpath(dev), maxsize); + dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); + break; + case SUBST_KERNEL: + util_strlcat(string, udev_device_get_sysname(dev), maxsize); + dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); + break; + case SUBST_KERNEL_NUMBER: + if (udev_device_get_sysnum(dev) == NULL) + break; + util_strlcat(string, udev_device_get_sysnum(dev), maxsize); + dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); + break; + case SUBST_ID: + if (event->dev_parent != NULL) { + util_strlcat(string, udev_device_get_sysname(event->dev_parent), maxsize); + dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); + } + break; + case SUBST_DRIVER: + if (event->dev_parent != NULL) { + const char *driver = udev_device_get_driver(event->dev_parent); + + if (driver == NULL) + break; + util_strlcat(string, driver, maxsize); + dbg(event->udev, "substitute driver '%s'\n", driver); + } + break; + case SUBST_MAJOR: + sprintf(temp2, "%d", major(udev_device_get_devnum(dev))); + util_strlcat(string, temp2, maxsize); + dbg(event->udev, "substitute major number '%s'\n", temp2); + break; + case SUBST_MINOR: + sprintf(temp2, "%d", minor(udev_device_get_devnum(dev))); + util_strlcat(string, temp2, maxsize); + dbg(event->udev, "substitute minor number '%s'\n", temp2); + break; + case SUBST_RESULT: + if (event->program_result[0] == '\0') + break; + /* get part part of the result string */ + i = 0; + if (attr != NULL) + i = strtoul(attr, &rest, 10); + if (i > 0) { + dbg(event->udev, "request part #%d of result string\n", i); + cpos = event->program_result; + while (--i) { + while (cpos[0] != '\0' && !isspace(cpos[0])) + cpos++; + while (isspace(cpos[0])) + cpos++; + } + if (i > 0) { + err(event->udev, "requested part of result string not found\n"); + break; + } + util_strlcpy(temp2, cpos, sizeof(temp2)); + /* %{2+}c copies the whole string from the second part on */ + if (rest[0] != '+') { + cpos = strchr(temp2, ' '); + if (cpos) + cpos[0] = '\0'; + } + util_strlcat(string, temp2, maxsize); + dbg(event->udev, "substitute part of result string '%s'\n", temp2); + } else { + util_strlcat(string, event->program_result, maxsize); + dbg(event->udev, "substitute result string '%s'\n", event->program_result); + } + break; + case SUBST_ATTR: + if (attr == NULL) + err(event->udev, "missing file parameter for attr\n"); + else { + char value[UTIL_NAME_SIZE] = ""; + size_t size; + + udev_event_apply_subsys_kernel(event, attr, value, sizeof(value), 1); + + /* try the current device, other matches may have selected */ + if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { + const char *val; + + val = udev_device_get_attr_value(event->dev_parent, attr); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + } + + /* look at all devices along the chain of parents */ + if (value[0] == '\0') { + struct udev_device *dev_parent = dev; + const char *val; + + do { + dbg(event->udev, "looking at '%s'\n", udev_device_get_syspath(dev_parent)); + val = udev_device_get_attr_value(dev_parent, attr); + if (val != NULL) { + util_strlcpy(value, val, sizeof(value)); + break; + } + dev_parent = udev_device_get_parent(dev_parent); + } while (dev_parent != NULL); + } + + if (value[0]=='\0') + break; + + /* strip trailing whitespace, and replace unwanted characters */ + size = strlen(value); + while (size > 0 && isspace(value[--size])) + value[size] = '\0'; + count = util_replace_chars(value, ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + util_strlcat(string, value, maxsize); + dbg(event->udev, "substitute sysfs value '%s'\n", value); + } + break; + case SUBST_PARENT: + { + struct udev_device *dev_parent; + const char *devnode; + + dev_parent = udev_device_get_parent(event->dev); + if (dev_parent == NULL) + break; + devnode = udev_device_get_devnode(dev_parent); + if (devnode != NULL) { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + + util_strlcat(string, &devnode[devlen], maxsize); + dbg(event->udev, "found parent '%s', got node name '%s'\n", + udev_device_get_syspath(dev_parent), &devnode[devlen]); + } + } + break; + case SUBST_TEMP_NODE: + if (event->tmp_node[0] == '\0' && major(udev_device_get_devnum(dev)) > 0) { + dbg(event->udev, "create temporary device node for callout\n"); + snprintf(event->tmp_node, sizeof(event->tmp_node), "%s/.tmp-%u-%u", + udev_get_dev_path(event->udev), + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + udev_node_mknod(dev, event->tmp_node, makedev(0,0), 0600, 0, 0); + } + util_strlcat(string, event->tmp_node, maxsize); + dbg(event->udev, "substitute temporary device node name '%s'\n", event->tmp_node); + break; + case SUBST_NAME: + if (event->name != NULL) { + util_strlcat(string, event->name, maxsize); + dbg(event->udev, "substitute name '%s'\n", event->name); + } else { + util_strlcat(string, udev_device_get_sysname(dev), maxsize); + dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); + } + break; + case SUBST_LINKS: + { + struct udev_list_entry *list_entry; + + list_entry = udev_device_get_properties_list_entry(dev); + util_strlcpy(string, udev_list_entry_get_name(list_entry), maxsize); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { + util_strlcat(string, " ", maxsize); + util_strlcat(string, udev_list_entry_get_name(list_entry), maxsize); + } + } + break; + case SUBST_ROOT: + util_strlcat(string, udev_get_dev_path(event->udev), maxsize); + dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); + break; + case SUBST_SYS: + util_strlcat(string, udev_get_sys_path(event->udev), maxsize); + dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); + break; + case SUBST_ENV: + if (attr == NULL) { + dbg(event->udev, "missing attribute\n"); + break; + } else { + struct udev_list_entry *list_entry; + const char *value; + + list_entry = udev_device_get_properties_list_entry(event->dev); + list_entry = udev_list_entry_get_by_name(list_entry, attr); + if (list_entry == NULL) + break; + value = udev_list_entry_get_value(list_entry); + dbg(event->udev, "substitute env '%s=%s'\n", attr, value); + util_strlcat(string, value, maxsize); + break; + } + default: + err(event->udev, "unknown substitution type=%i\n", type); + break; + } + /* possibly truncate to format-char specified length */ + if (len >= 0 && len < (int)strlen(head)) { + head[len] = '\0'; + dbg(event->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head); + } + util_strlcat(string, temp, maxsize); + } +} + +static void rename_netif_kernel_log(struct ifreq ifr) { int klog; FILE *f; @@ -100,7 +525,7 @@ static int rename_netif(struct udev_event *event) util_strlcpy(ifr.ifr_newname, event->name, IFNAMSIZ); err = ioctl(sk, SIOCSIFNAME, &ifr); if (err == 0) - kernel_log(ifr); + rename_netif_kernel_log(ifr); else { int loop; @@ -128,7 +553,7 @@ static int rename_netif(struct udev_event *event) while (loop--) { err = ioctl(sk, SIOCSIFNAME, &ifr); if (err == 0) { - kernel_log(ifr); + rename_netif_kernel_log(ifr); break; } @@ -305,7 +730,7 @@ int udev_event_execute_run(struct udev_event *event) char **envp; util_strlcpy(program, cmd, sizeof(program)); - udev_rules_apply_format(event, program, sizeof(program)); + udev_event_apply_format(event, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); if (run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { if (!udev_list_entry_get_flag(list_entry)) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 978581fb50..a9793f4e8d 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -190,45 +190,6 @@ next: return current; } -/* extract possible {attr} and move str behind it */ -static char *get_format_attribute(struct udev *udev, char **str) -{ - char *pos; - char *attr = NULL; - - if (*str[0] == '{') { - pos = strchr(*str, '}'); - if (pos == NULL) { - err(udev, "missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - attr = *str+1; - *str = pos+1; - dbg(udev, "attribute='%s', str='%s'\n", attr, *str); - } - return attr; -} - -/* extract possible format length and move str behind it*/ -static int get_format_len(struct udev *udev, char **str) -{ - int num; - char *tail; - - if (isdigit(*str[0])) { - num = (int) strtoul(*str, &tail, 10); - if (num > 0) { - *str = tail; - dbg(udev, "format length=%i\n", num); - return num; - } else { - err(udev, "format parsing error '%s'\n", *str); - } - } - return -1; -} - static int import_property_from_string(struct udev_device *dev, char *line) { struct udev *udev = udev_device_get_udev(dev); @@ -412,36 +373,6 @@ static int wait_for_file(struct udev_event *event, const char *file, int timeout return -1; } -/* handle "[$SUBSYSTEM/$KERNEL]" lookup */ -static int split_subsys_sysname(struct udev *udev, char *attrstr, char **subsys, char **sysname, char **attr) -{ - char *pos; - - if (attrstr[0] != '[') - return -1; - - *subsys = &attrstr[1]; - pos = strchr(*subsys, ']'); - if (pos == NULL) - return -1; - pos[0] = '\0'; - pos = &pos[1]; - - if (pos[0] == '/') - pos = &pos[1]; - if (pos[0] != '\0') - *attr = pos; - else - *attr = NULL; - - pos = strchr(*subsys, '/'); - if (pos == NULL) - return -1; - pos[0] = '\0'; - *sysname = &pos[1]; - return 0; -} - static int attr_subst_subdir(char *attr, size_t len) { char *pos; @@ -480,345 +411,6 @@ static int attr_subst_subdir(char *attr, size_t len) return found; } -void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize) -{ - struct udev_device *dev = event->dev; - char temp[UTIL_PATH_SIZE]; - char temp2[UTIL_PATH_SIZE]; - char *head, *tail, *cpos, *attr, *rest; - int len; - int i; - int count; - enum subst_type { - SUBST_UNKNOWN, - SUBST_DEVPATH, - SUBST_KERNEL, - SUBST_KERNEL_NUMBER, - SUBST_ID, - SUBST_DRIVER, - SUBST_MAJOR, - SUBST_MINOR, - SUBST_RESULT, - SUBST_ATTR, - SUBST_PARENT, - SUBST_TEMP_NODE, - SUBST_NAME, - SUBST_LINKS, - SUBST_ROOT, - SUBST_SYS, - SUBST_ENV, - }; - static const struct subst_map { - char *name; - char fmt; - enum subst_type type; - } map[] = { - { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, - { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, - { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, - { .name = "id", .fmt = 'b', .type = SUBST_ID }, - { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, - { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, - { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, - { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, - { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, - { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, - { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, - { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, - { .name = "name", .fmt = 'D', .type = SUBST_NAME }, - { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, - { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, - { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, - { .name = "env", .fmt = 'E', .type = SUBST_ENV }, - { NULL, '\0', 0 } - }; - enum subst_type type; - const struct subst_map *subst; - - head = string; - while (1) { - len = -1; - while (head[0] != '\0') { - if (head[0] == '$') { - /* substitute named variable */ - if (head[1] == '\0') - break; - if (head[1] == '$') { - util_strlcpy(temp, head+2, sizeof(temp)); - util_strlcpy(head+1, temp, maxsize); - head++; - continue; - } - head[0] = '\0'; - for (subst = map; subst->name; subst++) { - if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { - type = subst->type; - tail = head + strlen(subst->name)+1; - dbg(event->udev, "will substitute format name '%s'\n", subst->name); - goto found; - } - } - head[0] = '$'; - err(event->udev, "unknown format variable '%s'\n", head); - } else if (head[0] == '%') { - /* substitute format char */ - if (head[1] == '\0') - break; - if (head[1] == '%') { - util_strlcpy(temp, head+2, sizeof(temp)); - util_strlcpy(head+1, temp, maxsize); - head++; - continue; - } - head[0] = '\0'; - tail = head+1; - len = get_format_len(event->udev, &tail); - for (subst = map; subst->name; subst++) { - if (tail[0] == subst->fmt) { - type = subst->type; - tail++; - dbg(event->udev, "will substitute format char '%c'\n", subst->fmt); - goto found; - } - } - head[0] = '%'; - err(event->udev, "unknown format char '%c'\n", tail[0]); - } - head++; - } - break; -found: - attr = get_format_attribute(event->udev, &tail); - util_strlcpy(temp, tail, sizeof(temp)); - dbg(event->udev, "format=%i, string='%s', tail='%s'\n", type ,string, tail); - - switch (type) { - case SUBST_DEVPATH: - util_strlcat(string, udev_device_get_devpath(dev), maxsize); - dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); - break; - case SUBST_KERNEL: - util_strlcat(string, udev_device_get_sysname(dev), maxsize); - dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); - break; - case SUBST_KERNEL_NUMBER: - if (udev_device_get_sysnum(dev) == NULL) - break; - util_strlcat(string, udev_device_get_sysnum(dev), maxsize); - dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); - break; - case SUBST_ID: - if (event->dev_parent != NULL) { - util_strlcat(string, udev_device_get_sysname(event->dev_parent), maxsize); - dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); - } - break; - case SUBST_DRIVER: - if (event->dev_parent != NULL) { - const char *driver = udev_device_get_driver(event->dev_parent); - - if (driver == NULL) - break; - util_strlcat(string, driver, maxsize); - dbg(event->udev, "substitute driver '%s'\n", driver); - } - break; - case SUBST_MAJOR: - sprintf(temp2, "%d", major(udev_device_get_devnum(dev))); - util_strlcat(string, temp2, maxsize); - dbg(event->udev, "substitute major number '%s'\n", temp2); - break; - case SUBST_MINOR: - sprintf(temp2, "%d", minor(udev_device_get_devnum(dev))); - util_strlcat(string, temp2, maxsize); - dbg(event->udev, "substitute minor number '%s'\n", temp2); - break; - case SUBST_RESULT: - if (event->program_result[0] == '\0') - break; - /* get part part of the result string */ - i = 0; - if (attr != NULL) - i = strtoul(attr, &rest, 10); - if (i > 0) { - dbg(event->udev, "request part #%d of result string\n", i); - cpos = event->program_result; - while (--i) { - while (cpos[0] != '\0' && !isspace(cpos[0])) - cpos++; - while (isspace(cpos[0])) - cpos++; - } - if (i > 0) { - err(event->udev, "requested part of result string not found\n"); - break; - } - util_strlcpy(temp2, cpos, sizeof(temp2)); - /* %{2+}c copies the whole string from the second part on */ - if (rest[0] != '+') { - cpos = strchr(temp2, ' '); - if (cpos) - cpos[0] = '\0'; - } - util_strlcat(string, temp2, maxsize); - dbg(event->udev, "substitute part of result string '%s'\n", temp2); - } else { - util_strlcat(string, event->program_result, maxsize); - dbg(event->udev, "substitute result string '%s'\n", event->program_result); - } - break; - case SUBST_ATTR: - if (attr == NULL) - err(event->udev, "missing file parameter for attr\n"); - else { - char *subsys; - char *sysname; - char *attrib; - char value[UTIL_NAME_SIZE] = ""; - size_t size; - - if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { - struct udev_device *d; - const char *val; - - if (attrib == NULL) - break; - d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); - if (d == NULL) - break; - val = udev_device_get_attr_value(d, attrib); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - udev_device_unref(d); - } - - /* try the current device, other matches may have selected */ - if (value[0]=='\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { - const char *val; - - val = udev_device_get_attr_value(event->dev_parent, attr); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - } - - /* look at all devices along the chain of parents */ - if (value[0]=='\0') { - struct udev_device *dev_parent = dev; - const char *val; - - do { - dbg(event->udev, "looking at '%s'\n", udev_device_get_syspath(dev_parent)); - val = udev_device_get_attr_value(dev_parent, attr); - if (val != NULL) { - util_strlcpy(value, val, sizeof(value)); - break; - } - dev_parent = udev_device_get_parent(dev_parent); - } while (dev_parent != NULL); - } - - if (value[0]=='\0') - break; - - /* strip trailing whitespace, and replace unwanted characters */ - size = strlen(value); - while (size > 0 && isspace(value[--size])) - value[size] = '\0'; - count = util_replace_chars(value, ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - util_strlcat(string, value, maxsize); - dbg(event->udev, "substitute sysfs value '%s'\n", value); - } - break; - case SUBST_PARENT: - { - struct udev_device *dev_parent; - const char *devnode; - - dev_parent = udev_device_get_parent(event->dev); - if (dev_parent == NULL) - break; - devnode = udev_device_get_devnode(dev_parent); - if (devnode != NULL) { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - - util_strlcat(string, &devnode[devlen], maxsize); - dbg(event->udev, "found parent '%s', got node name '%s'\n", - udev_device_get_syspath(dev_parent), &devnode[devlen]); - } - } - break; - case SUBST_TEMP_NODE: - if (event->tmp_node[0] == '\0' && major(udev_device_get_devnum(dev)) > 0) { - dbg(event->udev, "create temporary device node for callout\n"); - snprintf(event->tmp_node, sizeof(event->tmp_node), "%s/.tmp-%u-%u", - udev_get_dev_path(event->udev), - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); - udev_node_mknod(dev, event->tmp_node, makedev(0,0), 0600, 0, 0); - } - util_strlcat(string, event->tmp_node, maxsize); - dbg(event->udev, "substitute temporary device node name '%s'\n", event->tmp_node); - break; - case SUBST_NAME: - if (event->name != NULL) { - util_strlcat(string, event->name, maxsize); - dbg(event->udev, "substitute name '%s'\n", event->name); - } else { - util_strlcat(string, udev_device_get_sysname(dev), maxsize); - dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); - } - break; - case SUBST_LINKS: - { - struct udev_list_entry *list_entry; - - list_entry = udev_device_get_properties_list_entry(dev); - util_strlcpy(string, udev_list_entry_get_name(list_entry), maxsize); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { - util_strlcat(string, " ", maxsize); - util_strlcat(string, udev_list_entry_get_name(list_entry), maxsize); - } - } - break; - case SUBST_ROOT: - util_strlcat(string, udev_get_dev_path(event->udev), maxsize); - dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); - break; - case SUBST_SYS: - util_strlcat(string, udev_get_sys_path(event->udev), maxsize); - dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); - break; - case SUBST_ENV: - if (attr == NULL) { - dbg(event->udev, "missing attribute\n"); - break; - } else { - struct udev_list_entry *list_entry; - const char *value; - - list_entry = udev_device_get_properties_list_entry(event->dev); - list_entry = udev_list_entry_get_by_name(list_entry, attr); - if (list_entry == NULL) - break; - value = udev_list_entry_get_value(list_entry); - dbg(event->udev, "substitute env '%s=%s'\n", attr, value); - util_strlcat(string, value, maxsize); - break; - } - default: - err(event->udev, "unknown substitution type=%i\n", type); - break; - } - /* possibly truncate to format-char specified length */ - if (len >= 0 && len < (int)strlen(head)) { - head[len] = '\0'; - dbg(event->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head); - } - util_strlcat(string, temp, maxsize); - } -} - static char *key_val(struct udev_rule *rule, struct key *key) { return rule->buf + key->val_off; @@ -943,34 +535,20 @@ static int match_rule(struct udev_event *event, struct udev_rule *rule) if (rule->test.operation == KEY_OP_MATCH || rule->test.operation == KEY_OP_NOMATCH) { char filename[UTIL_PATH_SIZE]; - char *subsys; - char *sysname; - char *attrib; struct stat statbuf; int match; util_strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); - udev_rules_apply_format(event, filename, sizeof(filename)); - - if (split_subsys_sysname(event->udev, filename, &subsys, &sysname, &attrib) == 0) { - struct udev_device *d; - d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); - if (d != NULL) { - util_strlcpy(filename, udev_device_get_syspath(d), sizeof(filename)); - if (attrib != NULL) { - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, attrib, sizeof(filename)); - } - udev_device_unref(d); - } - } else if (filename[0] != '/') { - char tmp[UTIL_PATH_SIZE]; + udev_event_apply_format(event, filename, sizeof(filename)); + if (udev_event_apply_subsys_kernel(event, NULL, filename, sizeof(filename), 0) != 0) + if (filename[0] != '/') { + char tmp[UTIL_PATH_SIZE]; - util_strlcpy(tmp, udev_device_get_syspath(dev), sizeof(tmp)); - util_strlcat(tmp, "/", sizeof(tmp)); - util_strlcat(tmp, filename, sizeof(tmp)); - util_strlcpy(filename, tmp, sizeof(filename)); - } + util_strlcpy(tmp, udev_device_get_syspath(dev), sizeof(tmp)); + util_strlcat(tmp, "/", sizeof(tmp)); + util_strlcat(tmp, filename, sizeof(tmp)); + util_strlcpy(filename, tmp, sizeof(filename)); + } attr_subst_subdir(filename, sizeof(filename)); @@ -994,7 +572,7 @@ static int match_rule(struct udev_event *event, struct udev_rule *rule) int found; util_strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); - udev_rules_apply_format(event, filename, sizeof(filename)); + udev_event_apply_format(event, filename, sizeof(filename)); found = (wait_for_file(event, filename, 10) == 0); if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) goto nomatch; @@ -1009,27 +587,11 @@ static int match_rule(struct udev_event *event, struct udev_rule *rule) char attr[UTIL_PATH_SIZE]; const char *key_name = key_pair_name(rule, pair); const char *key_value = key_val(rule, &pair->key); - char *subsys; - char *sysname; - char *attrib; char value[UTIL_NAME_SIZE] = ""; size_t len; util_strlcpy(attr, key_name, sizeof(attr)); - if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { - struct udev_device *d; - const char *val; - - if (attrib == NULL) - goto nomatch; - d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); - if (d == NULL) - goto nomatch; - val = udev_device_get_attr_value(d, attrib); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - udev_device_unref(d); - } + udev_event_apply_subsys_kernel(event, attr, value, sizeof(value), 1); if (value[0]=='\0') { const char *val; @@ -1126,7 +688,7 @@ try_parent: char result[UTIL_PATH_SIZE]; util_strlcpy(program, key_val(rule, &rule->program), sizeof(program)); - udev_rules_apply_format(event, program, sizeof(program)); + udev_event_apply_format(event, program, sizeof(program)); envp = udev_device_get_properties_envp(dev); if (run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { dbg(event->udev, "PROGRAM is false\n"); @@ -1163,7 +725,7 @@ try_parent: int rc = -1; util_strlcpy(import, key_val(rule, &rule->import), sizeof(import)); - udev_rules_apply_format(event, import, sizeof(import)); + udev_event_apply_format(event, import, sizeof(import)); dbg(event->udev, "check for IMPORT import='%s'\n", import); if (rule->import_type == IMPORT_PROGRAM) { rc = import_program_into_env(event->dev, import); @@ -1194,7 +756,7 @@ try_parent: /* make sure we don't write to the same string we possibly read from */ util_strlcpy(temp_value, value, sizeof(temp_value)); - udev_rules_apply_format(event, temp_value, sizeof(temp_value)); + udev_event_apply_format(event, temp_value, sizeof(temp_value)); if (temp_value[0] != '\0') { struct udev_list_entry *entry; @@ -1213,27 +775,12 @@ try_parent: if (pair->key.operation == KEY_OP_ASSIGN) { const char *key_name = key_pair_name(rule, pair); - char *subsys; - char *sysname; - char *attrib; char attr[UTIL_PATH_SIZE]; char value[UTIL_NAME_SIZE]; FILE *f; util_strlcpy(attr, key_name, sizeof(attr)); - if (split_subsys_sysname(event->udev, attr, &subsys, &sysname, &attrib) == 0) { - struct udev_device *d; - - d = udev_device_new_from_subsystem_sysname(event->udev, subsys, sysname); - if (d != NULL) { - util_strlcpy(attr, udev_device_get_syspath(d), sizeof(attr)); - if (attrib != NULL) { - util_strlcat(attr, "/", sizeof(attr)); - util_strlcat(attr, attrib, sizeof(attr)); - } - udev_device_unref(d); - } - } else { + if (udev_event_apply_subsys_kernel(event, key_name, attr, sizeof(attr), 0) != 0) { util_strlcpy(attr, udev_device_get_syspath(dev), sizeof(attr)); util_strlcat(attr, "/", sizeof(attr)); util_strlcat(attr, key_name, sizeof(attr)); @@ -1242,7 +789,7 @@ try_parent: attr_subst_subdir(attr, sizeof(attr)); util_strlcpy(value, key_val(rule, &pair->key), sizeof(value)); - udev_rules_apply_format(event, value, sizeof(value)); + udev_event_apply_format(event, value, sizeof(value)); info(event->udev, "writing '%s' to sysfs file '%s'\n", value, attr); f = fopen(attr, "w"); if (f != NULL) { @@ -1318,7 +865,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) event->mode_final = 1; char buf[20]; util_strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); - udev_rules_apply_format(event, buf, sizeof(buf)); + udev_event_apply_format(event, buf, sizeof(buf)); event->mode = strtol(buf, NULL, 8); dbg(event->udev, "applied mode=%#o to '%s'\n", event->mode, udev_device_get_sysname(dev)); @@ -1327,7 +874,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) event->owner_final = 1; util_strlcpy(event->owner, key_val(rule, &rule->owner), sizeof(event->owner)); - udev_rules_apply_format(event, event->owner, sizeof(event->owner)); + udev_event_apply_format(event, event->owner, sizeof(event->owner)); dbg(event->udev, "applied owner='%s' to '%s'\n", event->owner, udev_device_get_sysname(dev)); } @@ -1335,7 +882,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) if (rule->group.operation == KEY_OP_ASSIGN_FINAL) event->group_final = 1; util_strlcpy(event->group, key_val(rule, &rule->group), sizeof(event->group)); - udev_rules_apply_format(event, event->group, sizeof(event->group)); + udev_event_apply_format(event, event->group, sizeof(event->group)); dbg(event->udev, "applied group='%s' to '%s'\n", event->group, udev_device_get_sysname(dev)); } @@ -1359,7 +906,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) } /* allow multiple symlinks separated by spaces */ util_strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); - udev_rules_apply_format(event, temp, sizeof(temp)); + udev_event_apply_format(event, temp, sizeof(temp)); if (rule->string_escape == ESCAPE_UNSET) count = util_replace_chars(temp, ALLOWED_CHARS_FILE " "); else if (rule->string_escape == ESCAPE_REPLACE) @@ -1400,7 +947,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) name_set = 1; util_strlcpy(event->name, key_val(rule, &rule->name), sizeof(event->name)); - udev_rules_apply_format(event, event->name, sizeof(event->name)); + udev_event_apply_format(event, event->name, sizeof(event->name)); if (rule->string_escape == ESCAPE_UNSET || rule->string_escape == ESCAPE_REPLACE) { count = util_replace_chars(event->name, ALLOWED_CHARS_FILE); diff --git a/udev/udev.h b/udev/udev.h index c8425f768f..c73ec906e1 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -60,7 +60,6 @@ static inline void logging_close(void) closelog(); } -/* udev-event.c */ struct udev_event { struct udev *udev; struct udev_device *dev; @@ -86,18 +85,22 @@ struct udev_event { int exitstatus; time_t queue_time; }; -struct udev_rules; -extern struct udev_event *udev_event_new(struct udev_device *dev); -extern void udev_event_unref(struct udev_event *event); -extern int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules); -extern int udev_event_execute_run(struct udev_event *event); /* udev-rules.c */ +struct udev_rules; extern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); extern void udev_rules_unref(struct udev_rules *rules); extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event); extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event); -extern void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize); + +/* udev-event.c */ +extern struct udev_event *udev_event_new(struct udev_device *dev); +extern void udev_event_unref(struct udev_event *event); +extern int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules); +extern int udev_event_execute_run(struct udev_event *event); +extern void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize); +extern int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, + char *result, size_t maxsize, int read_value); /* udev-node.c */ extern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid); @@ -114,11 +117,6 @@ extern gid_t lookup_group(struct udev *udev, const char *group); extern int run_program(struct udev *udev, const char *command, char **envp, char *result, size_t ressize, size_t *reslen); -/* udev_utils_file.c */ -extern int file_map(const char *filename, char **buf, size_t *bufsize); -extern void file_unmap(void *buf, size_t bufsize); -extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur); - /* udev-selinux.c */ #ifndef USE_SELINUX static inline void selinux_init(struct udev *udev) {} diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 342b89d084..ceeead0c8a 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -133,7 +133,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) char program[UTIL_PATH_SIZE]; util_strlcpy(program, udev_list_entry_get_name(entry), sizeof(program)); - udev_rules_apply_format(event, program, sizeof(program)); + udev_event_apply_format(event, program, sizeof(program)); info(udev, "run: '%s'\n", program); } } -- cgit v1.2.3-54-g00ecf From eb8837e15cdb9ad8f6840406f6ef0c8cfd702b98 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 19:27:38 +0200 Subject: udev_list_cleanup() -> udev_list_cleanup_entries() --- udev/lib/libudev-device.c | 8 ++++---- udev/lib/libudev-enumerate.c | 10 +++++----- udev/lib/libudev-list.c | 2 +- udev/lib/libudev-private.h | 2 +- udev/lib/libudev-queue.c | 8 ++++---- udev/lib/libudev.c | 2 +- udev/udev-event.c | 2 +- udev/udev-node.c | 2 +- udev/udev-rules.c | 4 ++-- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index b5d42354e5..c030eb0585 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -604,13 +604,13 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->sysname); free(udev_device->devnode); free(udev_device->subsystem); - udev_list_cleanup(udev_device->udev, &udev_device->devlinks_list); - udev_list_cleanup(udev_device->udev, &udev_device->properties_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->properties_list); free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); free(udev_device->physdevpath); - udev_list_cleanup(udev_device->udev, &udev_device->attr_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->attr_list); for (i = 0; i < ARRAY_SIZE(udev_device->envp) && udev_device->envp[i] != NULL; i++) free(udev_device->envp[i]); info(udev_device->udev, "udev_device: %p released\n", udev_device); @@ -747,7 +747,7 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device * void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) { udev_device->devlinks_uptodate = 0; - udev_list_cleanup(udev_device->udev, &udev_device->devlinks_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); } /** diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index fab9c4d88d..7a8c51c078 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -82,11 +82,11 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) udev_enumerate->refcount--; if (udev_enumerate->refcount > 0) return; - udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->devices_list); - udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->attr_match_list); - udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->attr_nomatch_list); - udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); - udev_list_cleanup(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->attr_match_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->attr_nomatch_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); free(udev_enumerate); } diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index 606e3d5d63..f205c61a70 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -165,7 +165,7 @@ void udev_list_entry_remove(struct udev_list_entry *entry) free(entry); } -void udev_list_cleanup(struct udev *udev, struct udev_list_node *list) +void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *list) { struct udev_list_entry *entry_loop; struct udev_list_entry *entry_tmp; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 07f1491773..0dda4c3b5e 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -139,7 +139,7 @@ extern struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct ude const char *name, const char *value, int unique, int sort); extern void udev_list_entry_remove(struct udev_list_entry *entry); -extern void udev_list_cleanup(struct udev *udev, struct udev_list_node *name_list); +extern void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list); extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); extern void udev_list_entry_move_to_end(struct udev_list_entry *list_entry); extern void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry); diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index 60f7209d76..f1c69fdb93 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -71,8 +71,8 @@ void udev_queue_unref(struct udev_queue *udev_queue) udev_queue->refcount--; if (udev_queue->refcount > 0) return; - udev_list_cleanup(udev_queue->udev, &udev_queue->queue_list); - udev_list_cleanup(udev_queue->udev, &udev_queue->failed_list); + udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); + udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); free(udev_queue); } @@ -192,7 +192,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev if (udev_queue == NULL) return NULL; - udev_list_cleanup(udev_queue->udev, &udev_queue->queue_list); + udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); util_strlcpy(path, udev_get_dev_path(udev_queue->udev), sizeof(path)); util_strlcat(path, "/.udev/queue", sizeof(path)); dir = opendir(path); @@ -230,7 +230,7 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev if (udev_queue == NULL) return NULL; - udev_list_cleanup(udev_queue->udev, &udev_queue->failed_list); + udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); util_strlcpy(path, udev_get_dev_path(udev_queue->udev), sizeof(path)); util_strlcat(path, "/.udev/failed", sizeof(path)); dir = opendir(path); diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 511054a01a..a09aa051b3 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -278,7 +278,7 @@ void udev_unref(struct udev *udev) udev->refcount--; if (udev->refcount > 0) return; - udev_list_cleanup(udev, &udev->properties_list); + udev_list_cleanup_entries(udev, &udev->properties_list); free(udev->dev_path); free(udev->sys_path); free(udev->rules_path); diff --git a/udev/udev-event.c b/udev/udev-event.c index 59ae7c5378..86cb92ea94 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -52,7 +52,7 @@ struct udev_event *udev_event_new(struct udev_device *dev) void udev_event_unref(struct udev_event *event) { - udev_list_cleanup(event->udev, &event->run_list); + udev_list_cleanup_entries(event->udev, &event->run_list); dbg(event->udev, "free event %p\n", event); free(event); } diff --git a/udev/udev-node.c b/udev/udev-node.c index 62786d417b..c384eb7764 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -338,7 +338,7 @@ static int update_link(struct udev_device *dev, const char *slink, int test) } udev_device_unref(dev_db); } - udev_list_cleanup(udev, &dev_list); + udev_list_cleanup_entries(udev, &dev_list); if (target[0] == '\0') { info(udev, "no current target for '%s' found\n", slink); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index a9793f4e8d..ff61574ac6 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -970,7 +970,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) event->run_final = 1; if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { info(event->udev, "reset run list\n"); - udev_list_cleanup(event->udev, &event->run_list); + udev_list_cleanup_entries(event->udev, &event->run_list); } dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); list_entry = udev_list_entry_add(event->udev, &event->run_list, @@ -1050,7 +1050,7 @@ int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event) if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { info(event->udev, "reset run list\n"); - udev_list_cleanup(event->udev, &event->run_list); + udev_list_cleanup_entries(event->udev, &event->run_list); } dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); list_entry = udev_list_entry_add(event->udev, &event->run_list, -- cgit v1.2.3-54-g00ecf From c3b1fa66d2685780e60e4c5b8bc0c2e717c1ee71 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 19:30:42 +0200 Subject: selinux_init(udev) -> udev_selinux_init(udev) --- udev/test-udev.c | 4 ++-- udev/udev-selinux.c | 4 ++-- udev/udev.h | 8 ++++---- udev/udevadm.c | 4 ++-- udev/udevd.c | 4 ++-- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/udev/test-udev.c b/udev/test-udev.c index 1cc83c4a69..76045132bf 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -58,7 +58,7 @@ int main(int argc, char *argv[]) if (udev == NULL) exit(1); info(udev, "version %s\n", VERSION); - selinux_init(udev); + udev_selinux_init(udev); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) fail: udev_rules_unref(rules); exit: - selinux_exit(udev); + udev_selinux_exit(udev); udev_unref(udev); if (err != 0) return 1; diff --git a/udev/udev-selinux.c b/udev/udev-selinux.c index cf7f43496a..cd86870b18 100644 --- a/udev/udev-selinux.c +++ b/udev/udev-selinux.c @@ -29,7 +29,7 @@ static int selinux_enabled; security_context_t selinux_prev_scontext; -void selinux_init(struct udev *udev) +void udev_selinux_init(struct udev *udev) { /* record the present security context */ selinux_enabled = (is_selinux_enabled() > 0); @@ -43,7 +43,7 @@ void selinux_init(struct udev *udev) } } -void selinux_exit(struct udev *udev) +void udev_selinux_exit(struct udev *udev) { if (!selinux_enabled) return; diff --git a/udev/udev.h b/udev/udev.h index c73ec906e1..66ad73ad92 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -119,14 +119,14 @@ extern int run_program(struct udev *udev, const char *command, char **envp, /* udev-selinux.c */ #ifndef USE_SELINUX -static inline void selinux_init(struct udev *udev) {} -static inline void selinux_exit(struct udev *udev) {} +static inline void udev_selinux_init(struct udev *udev) {} +static inline void udev_selinux_exit(struct udev *udev) {} static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} static inline void udev_selinux_resetfscreatecon(struct udev *udev) {} #else -extern void selinux_init(struct udev *udev); -extern void selinux_exit(struct udev *udev); +extern void udev_selinux_init(struct udev *udev); +extern void udev_selinux_exit(struct udev *udev); extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); extern void udev_selinux_resetfscreatecon(struct udev *udev); diff --git a/udev/udevadm.c b/udev/udevadm.c index 8fd976a6de..2de9fbcf22 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -140,7 +140,7 @@ int main(int argc, char *argv[]) logging_init("udevadm"); udev_set_log_fn(udev, log_fn); - selinux_init(udev); + udev_selinux_init(udev); /* see if we are a compat link, this will be removed in a future release */ command = argv[0]; @@ -210,7 +210,7 @@ int main(int argc, char *argv[]) help(udev, argc, argv); rc = 2; out: - selinux_exit(udev); + udev_selinux_exit(udev); udev_unref(udev); logging_close(); return rc; diff --git a/udev/udevd.c b/udev/udevd.c index f812940364..4f46b6c1a9 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -648,7 +648,7 @@ int main(int argc, char *argv[]) logging_init("udevd"); udev_set_log_fn(udev, log_fn); info(udev, "version %s\n", VERSION); - selinux_init(udev); + udev_selinux_init(udev); while (1) { int option; @@ -978,7 +978,7 @@ exit: close(inotify_fd); udev_monitor_unref(kernel_monitor); - selinux_exit(udev); + udev_selinux_exit(udev); udev_unref(udev); logging_close(); return rc; -- cgit v1.2.3-54-g00ecf From 54808d77a3a62172fc6acbeec968be67c207509e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 20:12:55 +0200 Subject: prefix udev-util.c functions with util_* --- extras/floppy/create_floppy_devices.c | 8 ++++---- udev/lib/libudev-device-db-write.c | 2 +- udev/udev-event.c | 2 +- udev/udev-node.c | 20 ++++++++++---------- udev/udev-rules.c | 12 ++++++------ udev/udev-util.c | 16 ++++++++-------- udev/udev.h | 18 +++++++----------- udev/udevd.c | 14 +++++++------- 8 files changed, 44 insertions(+), 48 deletions(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 6c5b3b4800..f5069f7220 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -68,7 +68,7 @@ int main(int argc, char **argv) logging_init("create_floppy_devices"); udev_set_log_fn(udev, log_fn); - selinux_init(udev); + udev_selinux_init(udev); while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { switch (c) { @@ -79,10 +79,10 @@ int main(int argc, char **argv) print_nodes = 1; break; case 'U': - uid = lookup_user(udev, optarg); + uid = util_lookup_user(udev, optarg); break; case 'G': - gid = lookup_group(udev, optarg); + gid = util_lookup_group(udev, optarg); break; case 'M': mode = strtol(optarg, NULL, 0); @@ -162,7 +162,7 @@ int main(int argc, char **argv) i++; } - selinux_exit(udev); + udev_selinux_exit(udev); udev_unref(udev); exit: return 0; diff --git a/udev/lib/libudev-device-db-write.c b/udev/lib/libudev-device-db-write.c index 17e989310e..34095e5682 100644 --- a/udev/lib/libudev-device-db-write.c +++ b/udev/lib/libudev-device-db-write.c @@ -50,7 +50,7 @@ int udev_device_update_db(struct udev_device *udev_device) devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); - create_path(udev, filename); + util_create_path(udev, filename); unlink(filename); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) diff --git a/udev/udev-event.c b/udev/udev-event.c index 86cb92ea94..54006b5927 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -732,7 +732,7 @@ int udev_event_execute_run(struct udev_event *event) util_strlcpy(program, cmd, sizeof(program)); udev_event_apply_format(event, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); - if (run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { + if (util_run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { if (!udev_list_entry_get_flag(list_entry)) err = -1; } diff --git a/udev/udev-node.c b/udev/udev-node.c index c384eb7764..03b8d61fd0 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -53,14 +53,14 @@ static int name_index(struct udev *udev, const char *devpath, const char *name, if (add) { info(udev, "creating index: '%s'\n", filename); - create_path(udev, filename); + util_create_path(udev, filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd > 0) close(fd); } else { info(udev, "removing index: '%s'\n", filename); unlink(filename); - delete_path(udev, filename); + util_delete_path(udev, filename); } return 0; } @@ -288,7 +288,7 @@ static int update_link(struct udev_device *dev, const char *slink, int test) info(udev, "no reference left, remove '%s'\n", slink); if (!test) { unlink(slink); - delete_path(udev, slink); + util_delete_path(udev, slink); } goto out; } @@ -349,7 +349,7 @@ static int update_link(struct udev_device *dev, const char *slink, int test) /* create symlink to the target with the highest priority */ info(udev, "'%s' with target '%s' has the highest priority %i, create it\n", slink, target, priority); if (!test) { - create_path(udev, slink); + util_create_path(udev, slink); node_symlink(udev, target, slink); } out: @@ -400,7 +400,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const struct udev_list_entry *list_entry; int err = 0; - create_path(udev, udev_device_get_devnode(dev)); + util_create_path(udev, udev_device_get_devnode(dev)); if (strcmp(owner, "root") == 0) uid = 0; @@ -412,7 +412,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const if (endptr[0] == '\0') uid = (uid_t) id; else - uid = lookup_user(udev, owner); + uid = util_lookup_user(udev, owner); } if (strcmp(group, "root") == 0) @@ -425,7 +425,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const if (endptr[0] == '\0') gid = (gid_t) id; else - gid = lookup_group(udev, group); + gid = util_lookup_group(udev, group); } info(udev, "creating device node '%s', devnum=%d:%d, mode=%#o, uid=%d, gid=%d\n", @@ -503,7 +503,7 @@ extern int udev_node_remove(struct udev_device *dev, int test) info(udev, "removing device node '%s'\n", devnode); if (!test) - err = unlink_secure(udev, devnode); + err = util_unlink_secure(udev, devnode); if (err) return err; @@ -518,9 +518,9 @@ extern int udev_node_remove(struct udev_device *dev, int test) snprintf(partitionname, sizeof(partitionname), "%s%d", devnode, i); partitionname[sizeof(partitionname)-1] = '\0'; if (!test) - unlink_secure(udev, partitionname); + util_unlink_secure(udev, partitionname); } } - delete_path(udev, devnode); + util_delete_path(udev, devnode); return err; } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index ff61574ac6..cbf3511595 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -290,7 +290,7 @@ static int import_program_into_env(struct udev_device *dev, const char *program) char *line; envp = udev_device_get_properties_envp(dev); - if (run_program(udev, program, envp, result, sizeof(result), &reslen) != 0) + if (util_run_program(udev, program, envp, result, sizeof(result), &reslen) != 0) return -1; line = result; @@ -690,7 +690,7 @@ try_parent: util_strlcpy(program, key_val(rule, &rule->program), sizeof(program)); udev_event_apply_format(event, program, sizeof(program)); envp = udev_device_get_properties_envp(dev); - if (run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { + if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { dbg(event->udev, "PROGRAM is false\n"); event->program_result[0] = '\0'; if (rule->program.operation != KEY_OP_NOMATCH) @@ -999,7 +999,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) if (event->tmp_node[0] != '\0') { dbg(event->udev, "removing temporary device node\n"); - unlink_secure(event->udev, event->tmp_node); + util_unlink_secure(event->udev, event->tmp_node); event->tmp_node[0] = '\0'; } return 0; @@ -1541,7 +1541,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strtoul(value, &endptr, 10); if (endptr[0] != '\0') { char owner[32]; - uid_t uid = lookup_user(rules->udev, value); + uid_t uid = util_lookup_user(rules->udev, value); dbg(rules->udev, "replacing username='%s' by id=%i\n", value, uid); sprintf(owner, "%u", (unsigned int) uid); add_rule_key(rule, &rule->owner, operation, owner); @@ -1560,7 +1560,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena strtoul(value, &endptr, 10); if (endptr[0] != '\0') { char group[32]; - gid_t gid = lookup_group(rules->udev, value); + gid_t gid = util_lookup_group(rules->udev, value); dbg(rules->udev, "replacing groupname='%s' by id=%i\n", value, gid); sprintf(group, "%u", (unsigned int) gid); add_rule_key(rule, &rule->group, operation, group); @@ -1794,7 +1794,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); util_strlcat(filename, "/.udev/rules.d", sizeof(filename)); if (stat(filename, &statbuf) != 0) { - create_path(udev, filename); + util_create_path(udev, filename); udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); mkdir(filename, 0755); udev_selinux_resetfscreatecon(udev); diff --git a/udev/udev-util.c b/udev/udev-util.c index d17a151966..d45d444e97 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -29,7 +29,7 @@ #include "udev.h" -int create_path(struct udev *udev, const char *path) +int util_create_path(struct udev *udev, const char *path) { char p[UTIL_PATH_SIZE]; char *pos; @@ -49,7 +49,7 @@ int create_path(struct udev *udev, const char *path) if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) return 0; - if (create_path(udev, p) != 0) + if (util_create_path(udev, p) != 0) return -1; dbg(udev, "mkdir '%s'\n", p); @@ -65,7 +65,7 @@ int create_path(struct udev *udev, const char *path) return -1; } -int delete_path(struct udev *udev, const char *path) +int util_delete_path(struct udev *udev, const char *path) { char p[UTIL_PATH_SIZE]; char *pos; @@ -102,7 +102,7 @@ int delete_path(struct udev *udev, const char *path) /* Reset permissions on the device node, before unlinking it to make sure, * that permisions of possible hard links will be removed too. */ -int unlink_secure(struct udev *udev, const char *filename) +int util_unlink_secure(struct udev *udev, const char *filename) { int retval; @@ -124,7 +124,7 @@ int unlink_secure(struct udev *udev, const char *filename) return retval; } -uid_t lookup_user(struct udev *udev, const char *user) +uid_t util_lookup_user(struct udev *udev, const char *user) { struct passwd *pw; uid_t uid = 0; @@ -142,7 +142,7 @@ uid_t lookup_user(struct udev *udev, const char *user) return uid; } -extern gid_t lookup_group(struct udev *udev, const char *group) +extern gid_t util_lookup_group(struct udev *udev, const char *group) { struct group *gr; gid_t gid = 0; @@ -160,8 +160,8 @@ extern gid_t lookup_group(struct udev *udev, const char *group) return gid; } -int run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen) +int util_run_program(struct udev *udev, const char *command, char **envp, + char *result, size_t ressize, size_t *reslen) { int status; int outpipe[2] = {-1, -1}; diff --git a/udev/udev.h b/udev/udev.h index 66ad73ad92..89f6f11edf 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -33,10 +33,6 @@ #define DEFAULT_FAKE_PARTITIONS_COUNT 15 #define UDEV_EVENT_TIMEOUT 180 -/* linux/include/linux/kobject.h */ -#define UEVENT_BUFFER_SIZE 2048 -#define UEVENT_NUM_ENVP 32 - #define UDEV_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd" #define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) @@ -109,13 +105,13 @@ extern int udev_node_remove(struct udev_device *dev, int test); extern void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test); /* udev-util.c */ -extern int create_path(struct udev *udev, const char *path); -extern int delete_path(struct udev *udev, const char *path); -extern int unlink_secure(struct udev *udev, const char *filename); -extern uid_t lookup_user(struct udev *udev, const char *user); -extern gid_t lookup_group(struct udev *udev, const char *group); -extern int run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen); +extern int util_create_path(struct udev *udev, const char *path); +extern int util_delete_path(struct udev *udev, const char *path); +extern int util_unlink_secure(struct udev *udev, const char *filename); +extern uid_t util_lookup_user(struct udev *udev, const char *user); +extern gid_t util_lookup_group(struct udev *udev, const char *group); +extern int util_run_program(struct udev *udev, const char *command, char **envp, + char *result, size_t ressize, size_t *reslen); /* udev-selinux.c */ #ifndef USE_SELINUX diff --git a/udev/udevd.c b/udev/udevd.c index 4f46b6c1a9..21fd6f82e7 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -109,8 +109,8 @@ static void export_event_state(struct udev_event *event, enum event_state state) switch (state) { case EVENT_QUEUED: if(unlink(filename_failed) == 0) - delete_path(event->udev, filename_failed); - create_path(event->udev, filename); + util_delete_path(event->udev, filename_failed); + util_create_path(event->udev, filename); udev_selinux_setfscreatecon(event->udev, filename, S_IFLNK); symlink(udev_device_get_devpath(event->dev), filename); udev_selinux_resetfscreatecon(event->udev); @@ -131,23 +131,23 @@ static void export_event_state(struct udev_event *event, enum event_state state) udev_device_get_devpath_old(event->dev), udev_device_get_devpath(event->dev)); } else { if (unlink(filename_failed) == 0) - delete_path(event->udev, filename_failed); + util_delete_path(event->udev, filename_failed); } unlink(filename); /* clean up possibly empty queue directory */ if (udev_list_is_empty(&exec_list) && udev_list_is_empty(&running_list)) - delete_path(event->udev, filename); + util_delete_path(event->udev, filename); break; case EVENT_FAILED: /* move failed event to the failed directory */ - create_path(event->udev, filename_failed); + util_create_path(event->udev, filename_failed); rename(filename, filename_failed); /* clean up possibly empty queue directory */ if (udev_list_is_empty(&exec_list) && udev_list_is_empty(&running_list)) - delete_path(event->udev, filename); + util_delete_path(event->udev, filename); break; } @@ -613,7 +613,7 @@ static void export_initial_seqnum(struct udev *udev) } util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); - create_path(udev, filename); + util_create_path(udev, filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { write(fd, seqnum, len); -- cgit v1.2.3-54-g00ecf From 2d9a1b1ef284663b14e2fda714eddcd9c12bc42a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Oct 2008 20:33:06 +0200 Subject: pass make distcheck --- NEWS | 4 ++++ TODO | 5 +---- configure.ac | 6 +++--- extras/collect/Makefile.am | 1 - 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 35b57a3b4e..289db9c8ec 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 131 +======== +Bugfixes. + udev 130 ======== Bugfixes. diff --git a/TODO b/TODO index e1ef804319..7cbe9163ba 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,8 @@ o add DVB variables to kernel, and drop shell script rule - o use libudev device in udev_rules.c - get rid of udevice, store rule matching state in rule iterator o rework rules to a match-action list, instead of a rules array - o add watershed extra o DEVTYPE for disks is set by the kernel, they will be removed from the default rules o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names - o remove "udevinfo -V" + o fix "udevadm info -V" format o get distros to agree on a default set of rules diff --git a/configure.ac b/configure.ac index 6e98f37fba..5c96bb9277 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [130], + [131], [kay.sievers@vrfy.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) @@ -11,7 +11,7 @@ AC_PROG_LIBTOOL dnl /* libudev version */ LIBUDEV_LT_CURRENT=0 -LIBUDEV_LT_REVISION=3 +LIBUDEV_LT_REVISION=4 LIBUDEV_LT_AGE=0 AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) @@ -19,7 +19,7 @@ AC_SUBST(LIBUDEV_LT_AGE) dnl /* libvolume_id version */ VOLID_LT_CURRENT=1 -VOLID_LT_REVISION=3 +VOLID_LT_REVISION=4 VOLID_LT_AGE=0 AC_SUBST(VOLID_LT_CURRENT) AC_SUBST(VOLID_LT_REVISION) diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am index 78eb5c7591..895f1b7f0b 100644 --- a/extras/collect/Makefile.am +++ b/extras/collect/Makefile.am @@ -6,7 +6,6 @@ udevhome_PROGRAMS = \ collect_SOURCES = \ collect.c \ - ../../udev/lib/libudev \ ../../udev/lib/libudev-private.h \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c \ -- cgit v1.2.3-54-g00ecf From 69239210bee89c1745f2dd5f1e7cff4efd07e429 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 20 Oct 2008 18:12:36 +0200 Subject: libudev: device - get_attr_value() -> get_sysattr_value() --- extras/usb_id/usb_id.c | 24 ++++++++++++------------ udev/Makefile.am | 2 +- udev/lib/exported_symbols | 6 +++--- udev/lib/libudev-device.c | 26 +++++++++++++------------- udev/lib/libudev-enumerate.c | 42 +++++++++++++++++++++--------------------- udev/lib/libudev.h | 6 +++--- udev/lib/test-libudev.c | 2 +- udev/udev-event.c | 6 +++--- udev/udevadm-info.c | 2 +- udev/udevadm-trigger.c | 4 ++-- 10 files changed, 60 insertions(+), 60 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 4d5265532d..59cdd40b31 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -221,7 +221,7 @@ static int usb_id(struct udev_device *dev) return 1; } - if_class = udev_device_get_attr_value(dev_interface, "bInterfaceClass"); + if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass"); if (!if_class) { info(udev, "%s: cannot get bInterfaceClass attribute\n", udev_device_get_sysname(dev)); @@ -229,7 +229,7 @@ static int usb_id(struct udev_device *dev) } if_class_num = strtoul(if_class, NULL, 16); if (if_class_num == 8) { - if_subclass = udev_device_get_attr_value(dev_interface, "bInterfaceSubClass"); + if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass"); if (if_subclass != NULL) protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); } else { @@ -266,7 +266,7 @@ static int usb_id(struct udev_device *dev) } /* Generic SPC-2 device */ - scsi_vendor = udev_device_get_attr_value(dev_scsi, "vendor"); + scsi_vendor = udev_device_get_sysattr_value(dev_scsi, "vendor"); if (!scsi_vendor) { info(udev, "%s: cannot get SCSI vendor attribute\n", udev_device_get_sysname(dev_scsi)); @@ -274,7 +274,7 @@ static int usb_id(struct udev_device *dev) } set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); - scsi_model = udev_device_get_attr_value(dev_scsi, "model"); + scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); if (!scsi_model) { info(udev, "%s: cannot get SCSI model attribute\n", udev_device_get_sysname(dev_scsi)); @@ -282,7 +282,7 @@ static int usb_id(struct udev_device *dev) } set_str(model_str, scsi_model, sizeof(model_str)-1); - scsi_type = udev_device_get_attr_value(dev_scsi, "type"); + scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); if (!scsi_type) { info(udev, "%s: cannot get SCSI type attribute\n", udev_device_get_sysname(dev_scsi)); @@ -290,7 +290,7 @@ static int usb_id(struct udev_device *dev) } set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); - scsi_rev = udev_device_get_attr_value(dev_scsi, "rev"); + scsi_rev = udev_device_get_sysattr_value(dev_scsi, "rev"); if (!scsi_rev) { info(udev, "%s: cannot get SCSI revision attribute\n", udev_device_get_sysname(dev_scsi)); @@ -311,10 +311,10 @@ fallback: const char *usb_vendor = NULL; if (!use_num_info) - usb_vendor = udev_device_get_attr_value(dev_usb, "manufacturer"); + usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); if (!usb_vendor) - usb_vendor = udev_device_get_attr_value(dev_usb, "idVendor"); + usb_vendor = udev_device_get_sysattr_value(dev_usb, "idVendor"); if (!usb_vendor) { info(udev, "No USB vendor information available\n"); @@ -327,10 +327,10 @@ fallback: const char *usb_model = NULL; if (!use_num_info) - usb_model = udev_device_get_attr_value(dev_usb, "product"); + usb_model = udev_device_get_sysattr_value(dev_usb, "product"); if (!usb_model) - usb_model = udev_device_get_attr_value(dev_usb, "idProduct"); + usb_model = udev_device_get_sysattr_value(dev_usb, "idProduct"); if (!usb_model) { dbg(udev, "No USB model information available\n"); @@ -342,7 +342,7 @@ fallback: if (revision_str[0] == '\0') { const char *usb_rev; - usb_rev = udev_device_get_attr_value(dev_usb, "bcdDevice"); + usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); if (usb_rev) set_str(revision_str, usb_rev, sizeof(revision_str)-1); } @@ -350,7 +350,7 @@ fallback: if (serial_str[0] == '\0') { const char *usb_serial; - usb_serial = udev_device_get_attr_value(dev_usb, "serial"); + usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); if (usb_serial) set_str(serial_str, usb_serial, sizeof(serial_str)-1); } diff --git a/udev/Makefile.am b/udev/Makefile.am index c374942c6e..faf68d6c4d 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -17,7 +17,7 @@ common_files = \ udev-sysdeps.h \ udev-event.c \ udev-node.c \ - udev-rules.c \ + udev-rules2.c \ udev-util.c \ lib/libudev.h \ lib/libudev-private.h \ diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 1fe0cc30be..da84a8939e 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -32,7 +32,7 @@ udev_device_get_action udev_device_get_driver udev_device_get_devnum udev_device_get_seqnum -udev_device_get_attr_value +udev_device_get_sysattr_value udev_enumerate_new udev_enumerate_ref udev_enumerate_unref @@ -40,8 +40,8 @@ udev_enumerate_get_udev udev_enumerate_get_list_entry udev_enumerate_add_match_subsystem udev_enumerate_add_nomatch_subsystem -udev_enumerate_add_match_attr -udev_enumerate_add_nomatch_attr +udev_enumerate_add_match_sysattr +udev_enumerate_add_nomatch_sysattr udev_enumerate_scan_devices udev_enumerate_scan_subsystems udev_enumerate_add_syspath diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index c030eb0585..b54c7271e7 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -60,7 +60,7 @@ struct udev_device { int num_fake_partitions; int devlink_priority; int ignore_remove; - struct udev_list_node attr_list; + struct udev_list_node sysattr_list; int info_loaded; }; @@ -244,7 +244,7 @@ struct udev_device *device_new(struct udev *udev) udev_device->udev = udev; udev_list_init(&udev_device->devlinks_list); udev_list_init(&udev_device->properties_list); - udev_list_init(&udev_device->attr_list); + udev_list_init(&udev_device->sysattr_list); udev_device->event_timeout = -1; /* copy global properties */ udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) @@ -610,7 +610,7 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->driver); free(udev_device->devpath_old); free(udev_device->physdevpath); - udev_list_cleanup_entries(udev_device->udev, &udev_device->attr_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); for (i = 0; i < ARRAY_SIZE(udev_device->envp) && udev_device->envp[i] != NULL; i++) free(udev_device->envp[i]); info(udev_device->udev, "udev_device: %p released\n", udev_device); @@ -823,7 +823,7 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) return udev_device->seqnum; } -const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr) +const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) { struct udev_list_entry *list_entry; char path[UTIL_PATH_SIZE]; @@ -835,25 +835,25 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch if (udev_device == NULL) return NULL; - if (attr == NULL) + if (sysattr == NULL) return NULL; /* look for possibly already cached result */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->attr_list)) { - if (strcmp(udev_list_entry_get_name(list_entry), attr) == 0) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_list)) { + if (strcmp(udev_list_entry_get_name(list_entry), sysattr) == 0) { info(udev_device->udev, "got '%s' (%s) from cache\n", - attr, udev_list_entry_get_value(list_entry)); + sysattr, udev_list_entry_get_value(list_entry)); return udev_list_entry_get_value(list_entry); } } util_strlcpy(path, udev_device_get_syspath(udev_device), sizeof(path)); util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, attr, sizeof(path)); + util_strlcat(path, sysattr, sizeof(path)); if (lstat(path, &statbuf) != 0) { info(udev_device->udev, "no attribute '%s', keep negative entry\n", path); - udev_list_entry_add(udev_device->udev, &udev_device->attr_list, attr, NULL, 0, 0); + udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, NULL, 0, 0); goto out; } @@ -869,8 +869,8 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch pos = strrchr(target, '/'); if (pos != NULL) { pos = &pos[1]; - info(udev_device->udev, "cache '%s' with link value '%s'\n", attr, pos); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->attr_list, attr, pos, 0, 0); + info(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0); val = udev_list_entry_get_value(list_entry); } } @@ -902,7 +902,7 @@ const char *udev_device_get_attr_value(struct udev_device *udev_device, const ch value[size] = '\0'; util_remove_trailing_chars(value, '\n'); info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->attr_list, attr, value, 0, 0); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, value, 0, 0); val = udev_list_entry_get_value(list_entry); out: return val; diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 7a8c51c078..b35a82d0ce 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -35,8 +35,8 @@ static int devices_sort(struct udev_enumerate *udev_enumerate); struct udev_enumerate { struct udev *udev; int refcount; - struct udev_list_node attr_match_list; - struct udev_list_node attr_nomatch_list; + struct udev_list_node sysattr_match_list; + struct udev_list_node sysattr_nomatch_list; struct udev_list_node subsystem_match_list; struct udev_list_node subsystem_nomatch_list; struct udev_list_node devices_list; @@ -60,8 +60,8 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) udev_enumerate->refcount = 1; udev_enumerate->udev = udev; udev_list_init(&udev_enumerate->devices_list); - udev_list_init(&udev_enumerate->attr_match_list); - udev_list_init(&udev_enumerate->attr_nomatch_list); + udev_list_init(&udev_enumerate->sysattr_match_list); + udev_list_init(&udev_enumerate->sysattr_nomatch_list); udev_list_init(&udev_enumerate->subsystem_match_list); udev_list_init(&udev_enumerate->subsystem_nomatch_list); return udev_enumerate; @@ -83,8 +83,8 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) if (udev_enumerate->refcount > 0) return; udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->attr_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->attr_nomatch_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_match_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_nomatch_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); free(udev_enumerate); @@ -130,31 +130,31 @@ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, return 0; } -int udev_enumerate_add_match_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value) +int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) return -EINVAL; - if (attr == NULL) + if (sysattr == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->attr_match_list, attr, value, 1, 0) == NULL) + &udev_enumerate->sysattr_match_list, sysattr, value, 1, 0) == NULL) return -ENOMEM; return 0; } -int udev_enumerate_add_nomatch_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value) +int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) return -EINVAL; - if (attr == NULL) + if (sysattr == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->attr_nomatch_list, attr, value, 1, 0) == NULL) + &udev_enumerate->sysattr_nomatch_list, sysattr, value, 1, 0) == NULL) return -ENOMEM; return 0; } -static int match_attr_value(struct udev *udev, const char *syspath, const char *attr, const char *match_val) +static int match_sysattr_value(struct udev *udev, const char *syspath, const char *sysattr, const char *match_val) { struct udev_device *device; const char *val = NULL; @@ -163,7 +163,7 @@ static int match_attr_value(struct udev *udev, const char *syspath, const char * device = udev_device_new_from_syspath(udev, syspath); if (device == NULL) return -EINVAL; - val = udev_device_get_attr_value(device, attr); + val = udev_device_get_sysattr_value(device, sysattr); if (val == NULL) goto exit; if (match_val == NULL) { @@ -179,23 +179,23 @@ exit: return match; } -static int match_attr(struct udev_enumerate *udev_enumerate, const char *syspath) +static int match_sysattr(struct udev_enumerate *udev_enumerate, const char *syspath) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); struct udev_list_entry *list_entry; /* skip list */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->attr_nomatch_list)) { - if (match_attr_value(udev, syspath, + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_nomatch_list)) { + if (match_sysattr_value(udev, syspath, udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry))) return 0; } /* include list */ - if (udev_list_get_entry(&udev_enumerate->attr_match_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->attr_match_list)) { + if (udev_list_get_entry(&udev_enumerate->sysattr_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_match_list)) { /* anything that does not match, will make it FALSE */ - if (!match_attr_value(udev, syspath, + if (!match_sysattr_value(udev, syspath, udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry))) return 0; @@ -247,7 +247,7 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, util_strlcat(filename, "/uevent", sizeof(filename)); if (stat(filename, &statbuf) != 0) continue; - if (!match_attr(udev_enumerate, syspath)) + if (!match_sysattr(udev_enumerate, syspath)) continue; udev_list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); } diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 8949724844..041ffd4dd9 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -77,7 +77,7 @@ extern const char *udev_device_get_driver(struct udev_device *udev_device); extern dev_t udev_device_get_devnum(struct udev_device *udev_device); extern const char *udev_device_get_action(struct udev_device *udev_device); extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); -extern const char *udev_device_get_attr_value(struct udev_device *udev_device, const char *attr); +extern const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); /* udev and kernel device events */ struct udev_monitor; @@ -98,8 +98,8 @@ extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); extern struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); extern int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); extern int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); -extern int udev_enumerate_add_match_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value); -extern int udev_enumerate_add_nomatch_attr(struct udev_enumerate *udev_enumerate, const char *attr, const char *value); +extern int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); +extern int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); extern int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); extern int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); extern int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index ded65cca91..4c3bc16aed 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -97,7 +97,7 @@ static void print_device(struct udev_device *device) if (count > 0) printf("found %i properties\n", count); - str = udev_device_get_attr_value(device, "dev"); + str = udev_device_get_sysattr_value(device, "dev"); if (str != NULL) printf("attr{dev}: '%s'\n", str); diff --git a/udev/udev-event.c b/udev/udev-event.c index 54006b5927..007a14ebe9 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -141,7 +141,7 @@ int udev_event_apply_subsys_kernel(struct udev_event *udev_event, const char *st if (read_value) { const char *val; - val = udev_device_get_attr_value(dev, attr); + val = udev_device_get_sysattr_value(dev, attr); if (val != NULL) util_strlcpy(result, val, maxsize); else @@ -359,7 +359,7 @@ found: if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { const char *val; - val = udev_device_get_attr_value(event->dev_parent, attr); + val = udev_device_get_sysattr_value(event->dev_parent, attr); if (val != NULL) util_strlcpy(value, val, sizeof(value)); } @@ -371,7 +371,7 @@ found: do { dbg(event->udev, "looking at '%s'\n", udev_device_get_syspath(dev_parent)); - val = udev_device_get_attr_value(dev_parent, attr); + val = udev_device_get_sysattr_value(dev_parent, attr); if (val != NULL) { util_strlcpy(value, val, sizeof(value)); break; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 78c218eef0..d30fc0031c 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -60,7 +60,7 @@ static void print_all_attributes(struct udev_device *device, const char *key) if (S_ISLNK(statbuf.st_mode)) continue; - value = udev_device_get_attr_value(device, dent->d_name); + value = udev_device_get_sysattr_value(device, dent->d_name); if (value == NULL) continue; dbg(udev, "attr '%s'='%s'(%zi)\n", dent->d_name, value, len); diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index eb46a2983c..e475e40949 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -156,7 +156,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) val[0] = 0; val = &val[1]; } - udev_enumerate_add_match_attr(udev_enumerate, attr, val); + udev_enumerate_add_match_sysattr(udev_enumerate, attr, val); break; case 'A': util_strlcpy(attr, optarg, sizeof(attr)); @@ -165,7 +165,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) val[0] = 0; val = &val[1]; } - udev_enumerate_add_nomatch_attr(udev_enumerate, attr, val); + udev_enumerate_add_nomatch_sysattr(udev_enumerate, attr, val); break; case 'h': printf("Usage: udevadm trigger OPTIONS\n" -- cgit v1.2.3-54-g00ecf From e02d738ee4da950e9228802ea52d9a6f0992c442 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Oct 2008 12:40:47 +0200 Subject: cdrom_id: remove ARRAY_SIZE() declaration --- extras/cdrom_id/cdrom_id.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 381aa70bed..7be0789f35 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -39,10 +39,6 @@ #include "../../udev/udev.h" -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -#endif - static int debug; static void log_fn(struct udev *udev, int priority, -- cgit v1.2.3-54-g00ecf From 94db05d28837d8c419b1110c79c71e1025ac58ac Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Oct 2008 12:42:13 +0200 Subject: replace missing get_attr_value() -> get_sysattr_value() --- udev/udev-rules.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index cbf3511595..9b2a6ab3ec 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -596,7 +596,7 @@ static int match_rule(struct udev_event *event, struct udev_rule *rule) if (value[0]=='\0') { const char *val; - val = udev_device_get_attr_value(dev, key_name); + val = udev_device_get_sysattr_value(dev, key_name); if (val != NULL) util_strlcpy(value, val, sizeof(value)); } @@ -648,9 +648,9 @@ static int match_rule(struct udev_event *event, struct udev_rule *rule) char value[UTIL_NAME_SIZE]; size_t len; - val = udev_device_get_attr_value(event->dev_parent, key_name); + val = udev_device_get_sysattr_value(event->dev_parent, key_name); if (val == NULL) - val = udev_device_get_attr_value(dev, key_name); + val = udev_device_get_sysattr_value(dev, key_name); if (val == NULL) goto try_parent; util_strlcpy(value, val, sizeof(value)); -- cgit v1.2.3-54-g00ecf From 20254eb02172d5763556ce5c50ce3a3c6c1d3070 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Oct 2008 12:43:07 +0200 Subject: add "root" == 0 shortcuts to lookup_user/group() --- udev/udev-util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/udev/udev-util.c b/udev/udev-util.c index d45d444e97..76445bbcdc 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -129,6 +129,8 @@ uid_t util_lookup_user(struct udev *udev, const char *user) struct passwd *pw; uid_t uid = 0; + if (strcmp(user, "root") == 0) + return 0; errno = 0; pw = getpwnam(user); if (pw == NULL) { @@ -138,7 +140,6 @@ uid_t util_lookup_user(struct udev *udev, const char *user) err(udev, "error resolving user '%s': %m\n", user); } else uid = pw->pw_uid; - return uid; } @@ -147,6 +148,8 @@ extern gid_t util_lookup_group(struct udev *udev, const char *group) struct group *gr; gid_t gid = 0; + if (strcmp(group, "root") == 0) + return 0; errno = 0; gr = getgrnam(group); if (gr == NULL) { @@ -156,7 +159,6 @@ extern gid_t util_lookup_group(struct udev *udev, const char *group) err(udev, "error resolving group '%s': %m\n", group); } else gid = gr->gr_gid; - return gid; } -- cgit v1.2.3-54-g00ecf From a8a8930072c78013bfa4064067242e4826ef837a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Oct 2008 12:45:54 +0200 Subject: do not use the new work-in-progress parser rule matcher --- udev/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/Makefile.am b/udev/Makefile.am index faf68d6c4d..c374942c6e 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -17,7 +17,7 @@ common_files = \ udev-sysdeps.h \ udev-event.c \ udev-node.c \ - udev-rules2.c \ + udev-rules.c \ udev-util.c \ lib/libudev.h \ lib/libudev-private.h \ -- cgit v1.2.3-54-g00ecf From b29a5e4ab98f460d2f79a11d1969858640e897e6 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 21 Oct 2008 11:10:32 +0100 Subject: use more appropriate alternatives to malloc() Use calloc to request cleared memory instead. Kernel and libc conspire to make this more efficient. Also, replace one malloc() + strcpy() with strdup(). Signed-off-by: Alan Jenkins --- extras/collect/collect.c | 3 +-- extras/volume_id/lib/volume_id.c | 3 +-- udev/lib/libudev-ctrl.c | 6 ++---- udev/lib/libudev-device.c | 3 +-- udev/lib/libudev-enumerate.c | 3 +-- udev/lib/libudev-monitor.c | 6 ++---- udev/lib/libudev-queue.c | 3 +-- udev/lib/libudev.c | 3 +-- udev/udev-event.c | 3 +-- udev/udev-rules.c | 3 +-- 10 files changed, 12 insertions(+), 24 deletions(-) diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 355b85b5cf..3a7e826e4d 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -171,8 +171,7 @@ static int checkout(int fd) if (debug) fprintf(stderr, "Found word %s\n", word); him = malloc(sizeof (struct _mate)); - him->name = malloc(strlen(word) + 1); - strcpy(him->name, word); + him->name = strdup(word); him->state = STATE_OLD; udev_list_node_append(&him->node, &bunch); word = NULL; diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 791be43515..8f22509ca6 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -483,10 +483,9 @@ struct volume_id *volume_id_open_fd(int fd) { struct volume_id *id; - id = malloc(sizeof(struct volume_id)); + id = calloc(1, sizeof(struct volume_id)); if (id == NULL) return NULL; - memset(id, 0x00, sizeof(struct volume_id)); id->fd = fd; diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index 848f507878..2e15db0be0 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -72,10 +72,9 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke { struct udev_ctrl *uctrl; - uctrl = malloc(sizeof(struct udev_ctrl)); + uctrl = calloc(1, sizeof(struct udev_ctrl)); if (uctrl == NULL) return NULL; - memset(uctrl, 0x00, sizeof(struct udev_ctrl)); uctrl->refcount = 1; uctrl->udev = udev; @@ -213,10 +212,9 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) struct ucred *cred; char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - uctrl_msg = malloc(sizeof(struct udev_ctrl_msg)); + uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); if (uctrl_msg == NULL) return NULL; - memset(uctrl_msg, 0x00, sizeof(struct udev_ctrl_msg)); uctrl_msg->refcount = 1; uctrl_msg->uctrl = uctrl; diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index b54c7271e7..e4cbd8e689 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -236,10 +236,9 @@ struct udev_device *device_new(struct udev *udev) if (udev == NULL) return NULL; - udev_device = malloc(sizeof(struct udev_device)); + udev_device = calloc(1, sizeof(struct udev_device)); if (udev_device == NULL) return NULL; - memset(udev_device, 0x00, sizeof(struct udev_device)); udev_device->refcount = 1; udev_device->udev = udev; udev_list_init(&udev_device->devlinks_list); diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index b35a82d0ce..e5a4ccee3b 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -53,10 +53,9 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) { struct udev_enumerate *udev_enumerate; - udev_enumerate = malloc(sizeof(struct udev_enumerate)); + udev_enumerate = calloc(1, sizeof(struct udev_enumerate)); if (udev_enumerate == NULL) return NULL; - memset(udev_enumerate, 0x00, (sizeof(struct udev_enumerate))); udev_enumerate->refcount = 1; udev_enumerate->udev = udev; udev_list_init(&udev_enumerate->devices_list); diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 6c6f4aa7e0..7f7f8460c2 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -67,10 +67,9 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char return NULL; if (socket_path == NULL) return NULL; - udev_monitor = malloc(sizeof(struct udev_monitor)); + udev_monitor = calloc(1, sizeof(struct udev_monitor)); if (udev_monitor == NULL) return NULL; - memset(udev_monitor, 0x00, sizeof(struct udev_monitor)); udev_monitor->refcount = 1; udev_monitor->udev = udev; @@ -105,10 +104,9 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev) if (udev == NULL) return NULL; - udev_monitor = malloc(sizeof(struct udev_monitor)); + udev_monitor = calloc(1, sizeof(struct udev_monitor)); if (udev_monitor == NULL) return NULL; - memset(udev_monitor, 0x00, sizeof(struct udev_monitor)); udev_monitor->refcount = 1; udev_monitor->udev = udev; diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index f1c69fdb93..ea75f22044 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -45,10 +45,9 @@ struct udev_queue *udev_queue_new(struct udev *udev) if (udev == NULL) return NULL; - udev_queue = malloc(sizeof(struct udev_queue)); + udev_queue = calloc(1, sizeof(struct udev_queue)); if (udev_queue == NULL) return NULL; - memset(udev_queue, 0x00, sizeof(struct udev_queue)); udev_queue->refcount = 1; udev_queue->udev = udev; udev_list_init(&udev_queue->queue_list); diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index a09aa051b3..fcb784580b 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -96,10 +96,9 @@ struct udev *udev_new(void) char *config_file; FILE *f; - udev = malloc(sizeof(struct udev)); + udev = calloc(1, sizeof(struct udev)); if (udev == NULL) return NULL; - memset(udev, 0x00, (sizeof(struct udev))); udev->refcount = 1; udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; diff --git a/udev/udev-event.c b/udev/udev-event.c index 007a14ebe9..05bb022d1b 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -34,10 +34,9 @@ struct udev_event *udev_event_new(struct udev_device *dev) { struct udev_event *event; - event = malloc(sizeof(struct udev_event)); + event = calloc(1, sizeof(struct udev_event)); if (event == NULL) return NULL; - memset(event, 0x00, sizeof(struct udev_event)); event->dev = dev; event->udev = udev_device_get_udev(dev); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 9b2a6ab3ec..32eed78d8a 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1772,10 +1772,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) struct udev_list_node file_list; struct udev_list_entry *file_loop, *file_tmp; - rules = malloc(sizeof(struct udev_rules)); + rules = calloc(1, sizeof(struct udev_rules)); if (rules == NULL) return rules; - memset(rules, 0x00, sizeof(struct udev_rules)); rules->udev = udev; rules->resolve_names = resolve_names; udev_list_init(&file_list); -- cgit v1.2.3-54-g00ecf From fa0e955a93ca7d7e90d286a68454c6bd808a1c01 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 21 Oct 2008 11:12:57 +0100 Subject: libudev: util - optimize path_encode() Since we already know the length, use memcpy() instead. Measured 2% _user_ cpu time reduction on EeePC coldplug. Signed-off-by: Alan Jenkins --- udev/lib/libudev-util.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 0ff121d774..6586d1c825 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -114,7 +114,6 @@ size_t util_path_encode(char *s, size_t len) char t[(len * 3)+1]; size_t i, j; - t[0] = '\0'; for (i = 0, j = 0; s[i] != '\0'; i++) { if (s[i] == '/') { memcpy(&t[j], "\\x2f", 4); @@ -127,8 +126,11 @@ size_t util_path_encode(char *s, size_t len) j++; } } - t[j] = '\0'; - strncpy(s, t, len); + if (len == 0) + return j; + i = (j < len - 1) ? j : len - 1; + memcpy(s, t, i); + s[i] = '\0'; return j; } -- cgit v1.2.3-54-g00ecf From be18918f65eb88d34953e8083aa5ca1e2c16f86c Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 21 Oct 2008 11:11:41 +0100 Subject: libudev: allocate udev_device->envp[] dynamically Measured 2% _user_ cpu time reduction on EeePC coldplug. Signed-off-by: Alan Jenkins --- udev/lib/libudev-device.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index e4cbd8e689..86f7918d49 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -31,6 +31,8 @@ #include "libudev.h" #include "libudev-private.h" +#define ENVP_SIZE 128 + struct udev_device { int refcount; struct udev *udev; @@ -46,7 +48,7 @@ struct udev_device { struct udev_list_node devlinks_list; int devlinks_uptodate; struct udev_list_node properties_list; - char *envp[128]; + char **envp; int envp_uptodate; char *driver; int driver_set; @@ -610,8 +612,11 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->devpath_old); free(udev_device->physdevpath); udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); - for (i = 0; i < ARRAY_SIZE(udev_device->envp) && udev_device->envp[i] != NULL; i++) - free(udev_device->envp[i]); + if (udev_device->envp != NULL) { + for (i = 0; i < ENVP_SIZE && udev_device->envp[i] != NULL; i++) + free(udev_device->envp[i]); + free(udev_device->envp); + } info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } @@ -1013,14 +1018,18 @@ char **udev_device_get_properties_envp(struct udev_device *udev_device) unsigned int i; struct udev_list_entry *list_entry; - for (i = 0; i < ARRAY_SIZE(udev_device->envp) && udev_device->envp[i] != NULL; i++) - free(udev_device->envp[i]); + if (udev_device->envp) { + for (i = 0; i < 128 && udev_device->envp[i] != NULL; i++) + free(udev_device->envp[i]); + } else + udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); + i = 0; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { asprintf(&udev_device->envp[i++], "%s=%s", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - if (i+1 >= ARRAY_SIZE(udev_device->envp)) + if (i+1 >= ENVP_SIZE) break; } udev_device->envp[i] = NULL; -- cgit v1.2.3-54-g00ecf From 9a23e9e7754027775f62baec847b46703e20d166 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Oct 2008 13:58:19 +0200 Subject: libudev: device - 128 -> ENVP_SIZE --- udev/lib/libudev-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 86f7918d49..5a43548736 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -1019,7 +1019,7 @@ char **udev_device_get_properties_envp(struct udev_device *udev_device) struct udev_list_entry *list_entry; if (udev_device->envp) { - for (i = 0; i < 128 && udev_device->envp[i] != NULL; i++) + for (i = 0; i < ENVP_SIZE && udev_device->envp[i] != NULL; i++) free(udev_device->envp[i]); } else udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); -- cgit v1.2.3-54-g00ecf From 111e4f81ff057fd5869d152a503ad982e2116f85 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 21 Oct 2008 22:42:15 +0100 Subject: replace strncpy() with strlcpy() The problem was strncpy() doesn't stop after writing the terminating NUL; by definition it goes on to zero the entire buffer. I spy another use of strncpy in udev_device_add_property_from_string(), which is responsible for another ~1% user cpu time... Signed-off-by: Alan Jenkins --- extras/scsi_id/scsi_id.c | 12 ++++-------- udev/lib/libudev-device.c | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 6334af386b..86c76cfcc4 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -135,8 +135,7 @@ static void set_type(char *to, const char *from, size_t len) break; } } - strncpy(to, type, len); - to[len-1] = '\0'; + util_strlcpy(to, type, len); } /* @@ -385,8 +384,7 @@ static int set_options(struct udev *udev, case 'd': dev_specified = 1; - strncpy(maj_min_dev, optarg, MAX_PATH_LEN); - maj_min_dev[MAX_PATH_LEN-1] = '\0'; + util_strlcpy(maj_min_dev, optarg, MAX_PATH_LEN); break; case 'e': @@ -394,8 +392,7 @@ static int set_options(struct udev *udev, break; case 'f': - strncpy(config_file, optarg, MAX_PATH_LEN); - config_file[MAX_PATH_LEN-1] = '\0'; + util_strlcpy(config_file, optarg, MAX_PATH_LEN); break; case 'g': @@ -461,8 +458,7 @@ static int set_options(struct udev *udev, } if (optind < argc && !dev_specified) { dev_specified = 1; - strncpy(maj_min_dev, argv[optind], MAX_PATH_LEN); - maj_min_dev[MAX_PATH_LEN-1] = '\0'; + util_strlcpy(maj_min_dev, argv[optind], MAX_PATH_LEN); } return 0; } diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 5a43548736..f56db7ff15 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -1001,7 +1001,7 @@ struct udev_list_entry *udev_device_add_property_from_string(struct udev_device char name[UTIL_PATH_SIZE]; char *val; - strncpy(name, property, sizeof(name)); + util_strlcpy(name, property, sizeof(name)); val = strchr(name, '='); if (val == NULL) return NULL; -- cgit v1.2.3-54-g00ecf From fcd070d010de9ed803abec8899cefc399cfc5fe7 Mon Sep 17 00:00:00 2001 From: Matthias Koenig Date: Wed, 22 Oct 2008 11:45:27 +0200 Subject: volume_id: swap - larger PAGE_SIZE support --- extras/volume_id/lib/linux_swap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 7b24a46b2d..c4beeab978 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -40,7 +40,7 @@ struct swap_header_v1_2 { uint8_t volume_name[16]; } PACKED; -#define LARGEST_PAGESIZE 0x4000 +#define LARGEST_PAGESIZE 0x10000 int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size) { -- cgit v1.2.3-54-g00ecf From 14f4025607e905cb230c6e5b32488e9f2d07a0d2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 22 Oct 2008 18:03:38 +0200 Subject: add util_resolve_subsys_kernel() --- extras/floppy/Makefile.am | 2 ++ udev/udev-util.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++ udev/udev.h | 2 ++ 3 files changed, 67 insertions(+) diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index c812689586..8dadefa08d 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -10,6 +10,8 @@ create_floppy_devices_SOURCES = \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c \ + ../../udev/lib/libudev-device.c \ + ../../udev/lib/libudev-enumerate.c \ ../../udev/udev-util.c if USE_SELINUX diff --git a/udev/udev-util.c b/udev/udev-util.c index 76445bbcdc..3c2e2a5089 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -162,6 +162,69 @@ extern gid_t util_lookup_group(struct udev *udev, const char *group) return gid; } +/* handle "[/]" format */ +int util_resolve_subsys_kernel(struct udev *udev, const char *string, + char *result, size_t maxsize, int read_value) +{ + char temp[UTIL_PATH_SIZE]; + char *subsys; + char *sysname; + struct udev_device *dev; + char *attr; + + if (string == NULL) + string = result; + if (string[0] != '[') + return -1; + + util_strlcpy(temp, string, sizeof(temp)); + + subsys = &temp[1]; + + sysname = strchr(subsys, '/'); + if (sysname == NULL) + return -1; + sysname[0] = '\0'; + sysname = &sysname[1]; + + attr = strchr(sysname, ']'); + if (attr == NULL) + return -1; + attr[0] = '\0'; + attr = &attr[1]; + if (attr[0] == '/') + attr = &attr[1]; + if (attr[0] == '\0') + attr = NULL; + + if (read_value && attr == NULL) + return -1; + + dev = udev_device_new_from_subsystem_sysname(udev, subsys, sysname); + if (dev == NULL) + return -1; + + if (read_value) { + const char *val; + + val = udev_device_get_sysattr_value(dev, attr); + if (val != NULL) + util_strlcpy(result, val, maxsize); + else + result[0] = '\0'; + info(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } else { + util_strlcpy(result, udev_device_get_syspath(dev), maxsize); + if (attr != NULL) { + util_strlcat(result, "/", maxsize); + util_strlcat(result, attr, maxsize); + } + info(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } + udev_device_unref(dev); + return 0; +} + int util_run_program(struct udev *udev, const char *command, char **envp, char *result, size_t ressize, size_t *reslen) { diff --git a/udev/udev.h b/udev/udev.h index 89f6f11edf..217e942c18 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -112,6 +112,8 @@ extern uid_t util_lookup_user(struct udev *udev, const char *user); extern gid_t util_lookup_group(struct udev *udev, const char *group); extern int util_run_program(struct udev *udev, const char *command, char **envp, char *result, size_t ressize, size_t *reslen); +extern int util_resolve_subsys_kernel(struct udev *udev, const char *string, + char *result, size_t maxsize, int read_value); /* udev-selinux.c */ #ifndef USE_SELINUX -- cgit v1.2.3-54-g00ecf From aaff3d023f89522f56f7cd345b6849e1251a6a74 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 22 Oct 2008 15:13:08 +0100 Subject: use re-entrant variants of getpwnam and getgrnam Signed-off-by: Alan Jenkins --- udev/udev-util.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/udev/udev-util.c b/udev/udev-util.c index 3c2e2a5089..76d7270f66 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -126,13 +126,16 @@ int util_unlink_secure(struct udev *udev, const char *filename) uid_t util_lookup_user(struct udev *udev, const char *user) { + int buflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char buf[buflen]; + struct passwd pwbuf; struct passwd *pw; uid_t uid = 0; if (strcmp(user, "root") == 0) return 0; errno = 0; - pw = getpwnam(user); + getpwnam_r(user, &pwbuf, buf, buflen, &pw); if (pw == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) err(udev, "specified user '%s' unknown\n", user); @@ -140,18 +143,22 @@ uid_t util_lookup_user(struct udev *udev, const char *user) err(udev, "error resolving user '%s': %m\n", user); } else uid = pw->pw_uid; + return uid; } extern gid_t util_lookup_group(struct udev *udev, const char *group) { + int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); + char buf[buflen]; + struct group grbuf; struct group *gr; gid_t gid = 0; if (strcmp(group, "root") == 0) return 0; errno = 0; - gr = getgrnam(group); + getgrnam_r(group, &grbuf, buf, buflen, &gr); if (gr == NULL) { if (errno == 0 || errno == ENOENT || errno == ESRCH) err(udev, "specified group '%s' unknown\n", group); -- cgit v1.2.3-54-g00ecf From a391f49d7f5433e6204f35331b81391c2d110309 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 22 Oct 2008 23:59:53 +0200 Subject: handle numerical owner/group string in lookup_user/group() --- udev/udev-util.c | 57 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/udev/udev-util.c b/udev/udev-util.c index 76d7270f66..2620d9a994 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -126,48 +126,55 @@ int util_unlink_secure(struct udev *udev, const char *filename) uid_t util_lookup_user(struct udev *udev, const char *user) { + char *endptr; int buflen = sysconf(_SC_GETPW_R_SIZE_MAX); char buf[buflen]; struct passwd pwbuf; struct passwd *pw; - uid_t uid = 0; + uid_t uid; if (strcmp(user, "root") == 0) return 0; - errno = 0; - getpwnam_r(user, &pwbuf, buf, buflen, &pw); - if (pw == NULL) { + uid = strtoul(user, &endptr, 10); + if (endptr[0] == '\0') + return uid; + + errno = 0; + getpwnam_r(user, &pwbuf, buf, buflen, &pw); + if (pw != NULL) + return pw->pw_uid; if (errno == 0 || errno == ENOENT || errno == ESRCH) err(udev, "specified user '%s' unknown\n", user); else err(udev, "error resolving user '%s': %m\n", user); - } else - uid = pw->pw_uid; - - return uid; -} + return 0; + } -extern gid_t util_lookup_group(struct udev *udev, const char *group) -{ - int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); - char buf[buflen]; - struct group grbuf; - struct group *gr; - gid_t gid = 0; + extern gid_t util_lookup_group(struct udev *udev, const char *group) + { + char *endptr; + int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); + char buf[buflen]; + struct group grbuf; + struct group *gr; + gid_t gid = 0; - if (strcmp(group, "root") == 0) - return 0; - errno = 0; - getgrnam_r(group, &grbuf, buf, buflen, &gr); - if (gr == NULL) { + if (strcmp(group, "root") == 0) + return 0; + gid = strtoul(group, &endptr, 10); + if (endptr[0] == '\0') + return gid; + + errno = 0; + getgrnam_r(group, &grbuf, buf, buflen, &gr); + if (gr != NULL) + return gr->gr_gid; if (errno == 0 || errno == ENOENT || errno == ESRCH) err(udev, "specified group '%s' unknown\n", group); else err(udev, "error resolving group '%s': %m\n", group); - } else - gid = gr->gr_gid; - return gid; -} + return 0; + } /* handle "[/]" format */ int util_resolve_subsys_kernel(struct udev *udev, const char *string, -- cgit v1.2.3-54-g00ecf From 6880b25d4044f2d154908f88e717435412187355 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Oct 2008 00:13:59 +0200 Subject: replace in-memory rules array with match/action token list The in-memory rule array of a common desktop distro install took: 1151088 bytes with the token list: 109232 bytes tokens (6827 * 16 bytes), 71302 bytes buffer --- TODO | 2 +- test/udev-test.pl | 53 +- udev/udev-event.c | 124 +-- udev/udev-node.c | 33 +- udev/udev-rules.c | 2469 +++++++++++++++++++++++++++++------------------------ udev/udev.h | 22 +- udev/udev.xml | 26 +- 7 files changed, 1435 insertions(+), 1294 deletions(-) diff --git a/TODO b/TODO index 7cbe9163ba..fd9b2be563 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ + o use node for tmpnode, if it already exists o add DVB variables to kernel, and drop shell script rule - o rework rules to a match-action list, instead of a rules array o DEVTYPE for disks is set by the kernel, they will be removed from the default rules o "udevadm control" commands will only accept the -- syntax diff --git a/test/udev-test.pl b/test/udev-test.pl index 243e9619db..9725aff5ba 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -470,8 +470,8 @@ EOF devpath => "/devices/virtual/tty/console", exp_name => "foo" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "match", rules => < "not-anything", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "nonzero-program", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < < < < "read sysfs value from device down in the chain", + desc => "read sysfs value from parent device", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "serial-354172020305000", rules => < "apply NAME only once", + desc => "apply NAME final", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "link", exp_target => "ok", rules => < "yes", option => "clean", rules => < "test empty NAME", subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "node", + exp_name => "", not_exp_name => "wrong", exp_add_error => "yes", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "right", rules => < < "sda", exp_perms => "0:0:0400", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", - exp_perms => "0:0:0400", + exp_perms => "0:0:0660", rules => <dev = dev; event->udev = udev_device_get_udev(dev); udev_list_init(&event->run_list); event->mode = 0660; - util_strlcpy(event->owner, "0", sizeof(event->owner)); - util_strlcpy(event->group, "0", sizeof(event->group)); - dbg(event->udev, "allocated event %p\n", event); return event; } @@ -95,69 +91,6 @@ static int get_format_len(struct udev *udev, char **str) return -1; } -/* handle "[/]" format */ -int udev_event_apply_subsys_kernel(struct udev_event *udev_event, const char *string, - char *result, size_t maxsize, int read_value) -{ - char temp[UTIL_PATH_SIZE]; - char *subsys; - char *sysname; - char *attr; - struct udev_device *dev; - - if (string == NULL) - string = result; - if (string[0] != '[') - return -1; - - util_strlcpy(temp, string, sizeof(temp)); - - subsys = &temp[1]; - - sysname = strchr(subsys, '/'); - if (sysname == NULL) - return -1; - sysname[0] = '\0'; - sysname = &sysname[1]; - - attr = strchr(sysname, ']'); - if (attr == NULL) - return -1; - attr[0] = '\0'; - attr = &attr[1]; - if (attr[0] == '/') - attr = &attr[1]; - if (attr[0] == '\0') - attr = NULL; - - if (read_value && attr == NULL) - return -1; - - dev = udev_device_new_from_subsystem_sysname(udev_event->udev, subsys, sysname); - if (dev == NULL) - return -1; - - if (read_value) { - const char *val; - - val = udev_device_get_sysattr_value(dev, attr); - if (val != NULL) - util_strlcpy(result, val, maxsize); - else - result[0] = '\0'; - info(udev_event->udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); - } else { - util_strlcpy(result, udev_device_get_syspath(dev), maxsize); - if (attr != NULL) { - util_strlcat(result, "/", maxsize); - util_strlcat(result, attr, maxsize); - } - info(udev_event->udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); - } - udev_device_unref(dev); - return 0; -} - void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize) { struct udev_device *dev = event->dev; @@ -349,36 +282,23 @@ found: if (attr == NULL) err(event->udev, "missing file parameter for attr\n"); else { + const char *val; char value[UTIL_NAME_SIZE] = ""; size_t size; - udev_event_apply_subsys_kernel(event, attr, value, sizeof(value), 1); + util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); + + val = udev_device_get_sysattr_value(event->dev, attr); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); /* try the current device, other matches may have selected */ if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { - const char *val; - val = udev_device_get_sysattr_value(event->dev_parent, attr); if (val != NULL) util_strlcpy(value, val, sizeof(value)); } - /* look at all devices along the chain of parents */ - if (value[0] == '\0') { - struct udev_device *dev_parent = dev; - const char *val; - - do { - dbg(event->udev, "looking at '%s'\n", udev_device_get_syspath(dev_parent)); - val = udev_device_get_sysattr_value(dev_parent, attr); - if (val != NULL) { - util_strlcpy(value, val, sizeof(value)); - break; - } - dev_parent = udev_device_get_parent(dev_parent); - } while (dev_parent != NULL); - } - if (value[0]=='\0') break; @@ -590,17 +510,29 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) dbg(event->udev, "device node add '%s'\n", udev_device_get_devpath(dev)); - udev_rules_get_name(rules, event); + udev_rules_apply_to_event(rules, event); + if (event->tmp_node[0] != '\0') { + dbg(event->udev, "removing temporary device node\n"); + util_unlink_secure(event->udev, event->tmp_node); + event->tmp_node[0] = '\0'; + } + if (event->ignore_device) { info(event->udev, "device event will be ignored\n"); goto exit; } - if (event->name[0] == '\0') { + if (event->name_ignore) { info(event->udev, "device node creation supressed\n"); goto exit; } + if (event->name[0] == '\0') { + info(event->udev, "no node name set, will use kernel name '%s'\n", + udev_device_get_sysname(event->dev)); + util_strlcpy(event->name, udev_device_get_sysname(event->dev), sizeof(event->name)); + } + /* set device node name */ util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); util_strlcat(filename, "/", sizeof(filename)); @@ -610,15 +542,17 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) /* read current database entry; cleanup, if it is known device */ dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); if (dev_old != NULL) { - info(event->udev, "device '%s' already in database, updating\n", - udev_device_get_devpath(dev)); - udev_node_update_old_links(dev, dev_old, event->test); + if (udev_device_get_devnode(dev_old) != NULL) { + info(event->udev, "device node '%s' already in database, updating\n", + udev_device_get_devnode(dev_old)); + udev_node_update_old_links(dev, dev_old, event->test); + } udev_device_unref(dev_old); } udev_device_update_db(dev); - err = udev_node_add(dev, event->mode, event->owner, event->group, event->test); + err = udev_node_add(dev, event->mode, event->uid, event->gid, event->test); if (err != 0) goto exit; @@ -629,7 +563,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (strcmp(udev_device_get_subsystem(dev), "net") == 0 && strcmp(udev_device_get_action(dev), "add") == 0) { dbg(event->udev, "netif add '%s'\n", udev_device_get_devpath(dev)); - udev_rules_get_name(rules, event); + udev_rules_apply_to_event(rules, event); if (event->ignore_device) { info(event->udev, "device event will be ignored\n"); goto exit; @@ -684,7 +618,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) udev_device_set_devnode(dev, devnode); } - udev_rules_get_run(rules, event); + udev_rules_apply_to_event(rules, event); if (event->ignore_device) { info(event->udev, "device event will be ignored\n"); goto exit; @@ -700,7 +634,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) } /* default devices */ - udev_rules_get_run(rules, event); + udev_rules_apply_to_event(rules, event); if (event->ignore_device) info(event->udev, "device event will be ignored\n"); exit: diff --git a/udev/udev-node.c b/udev/udev-node.c index 03b8d61fd0..b39100dcee 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -390,49 +390,20 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev } } -int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const char *group, int test) +int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, int test) { struct udev *udev = udev_device_get_udev(dev); - uid_t uid; - gid_t gid; int i; int num; struct udev_list_entry *list_entry; int err = 0; - util_create_path(udev, udev_device_get_devnode(dev)); - - if (strcmp(owner, "root") == 0) - uid = 0; - else { - char *endptr; - unsigned long id; - - id = strtoul(owner, &endptr, 10); - if (endptr[0] == '\0') - uid = (uid_t) id; - else - uid = util_lookup_user(udev, owner); - } - - if (strcmp(group, "root") == 0) - gid = 0; - else { - char *endptr; - unsigned long id; - - id = strtoul(group, &endptr, 10); - if (endptr[0] == '\0') - gid = (gid_t) id; - else - gid = util_lookup_group(udev, group); - } - info(udev, "creating device node '%s', devnum=%d:%d, mode=%#o, uid=%d, gid=%d\n", udev_device_get_devnode(dev), major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)), mode, uid, gid); + util_create_path(udev, udev_device_get_devnode(dev)); if (!test) if (udev_node_mknod(dev, NULL, makedev(0,0), mode, uid, gid) != 0) { err = -1; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 32eed78d8a..b456c3da33 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1,6 +1,5 @@ /* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2008 Kay Sievers + * Copyright (C) 2008 Kay Sievers * * 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 @@ -29,17 +28,8 @@ #include "udev.h" -struct udev_rules { - struct udev *udev; - char *buf; - size_t bufsize; - int resolve_names; -}; - -struct udev_rules_iter { - struct udev_rules *rules; - size_t current; -}; +#define PREALLOC_TOKEN 2048 +#define PREALLOC_STRBUF 32 * 1024 enum key_operation { KEY_OP_UNSET, @@ -50,144 +40,216 @@ enum key_operation { KEY_OP_ASSIGN_FINAL, }; -struct key { - enum key_operation operation; - size_t val_off; +static const char *operation_str[] = { + [KEY_OP_MATCH] = "match", + [KEY_OP_NOMATCH] = "nomatch", + [KEY_OP_ADD] = "add", + [KEY_OP_ASSIGN] = "assign", + [KEY_OP_ASSIGN_FINAL] = "assign-final", }; -struct key_pair { - struct key key; - size_t key_name_off; +enum token_type { + TK_UNDEF, + TK_RULE, + + TK_M_WAITFOR, /* val */ + TK_M_ACTION, /* val */ + TK_M_DEVPATH, /* val */ + TK_M_KERNEL, /* val */ + TK_M_DEVLINK, /* val */ + TK_M_NAME, /* val */ + TK_M_ENV, /* val, attr */ + TK_M_SUBSYSTEM, /* val */ + TK_M_DRIVER, /* val */ + TK_M_ATTR, /* val, attr */ + + TK_M_KERNELS, /* val */ + TK_M_SUBSYSTEMS, /* val */ + TK_M_DRIVERS, /* val */ + TK_M_ATTRS, /* val, attr */ + TK_PARENTS_MAX, + + TK_M_TEST, /* val, mode_t */ + TK_M_PROGRAM, /* val */ + TK_M_IMPORT_FILE, /* val */ + TK_M_IMPORT_PROG, /* val */ + TK_M_IMPORT_PARENT, /* val */ + TK_M_RESULT, /* val */ + + TK_A_IGNORE_DEVICE, + TK_A_STRING_ESCAPE_NONE, + TK_A_STRING_ESCAPE_REPLACE, + TK_A_NUM_FAKE_PART, /* int */ + TK_A_DEVLINK_PRIO, /* int */ + TK_A_OWNER, /* val */ + TK_A_GROUP, /* val */ + TK_A_MODE, /* val */ + TK_A_OWNER_ID, /* uid_t */ + TK_A_GROUP_ID, /* gid_t */ + TK_A_MODE_ID, /* mode_t */ + TK_A_ENV, /* val, attr */ + TK_A_NAME, /* val */ + TK_A_DEVLINK, /* val */ + TK_A_EVENT_TIMEOUT, /* int */ + TK_A_IGNORE_REMOVE, + TK_A_ATTR, /* val, attr */ + TK_A_RUN, /* val, bool */ + TK_A_GOTO, /* size_t */ + TK_A_LAST_RULE, + + TK_END, }; -#define PAIRS_MAX 5 -struct key_pairs { - int count; - struct key_pair keys[PAIRS_MAX]; +static const char *token_str[] = { + [TK_UNDEF] = "UNDEF", + [TK_RULE] = "RULE", + + [TK_M_WAITFOR] = "M WAITFOR", + [TK_M_ACTION] = "M ACTION", + [TK_M_DEVPATH] = "M DEVPATH", + [TK_M_KERNEL] = "M KERNEL", + [TK_M_DEVLINK] = "M DEVLINK", + [TK_M_NAME] = "M NAME", + [TK_M_ENV] = "M ENV", + [TK_M_SUBSYSTEM] = "M SUBSYSTEM", + [TK_M_DRIVER] = "M DRIVER", + [TK_M_ATTR] = "M ATTR", + + [TK_M_KERNELS] = "M KERNELS", + [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", + [TK_M_DRIVERS] = "M DRIVERS", + [TK_M_ATTRS] = "M ATTRS", + [TK_PARENTS_MAX] = "PARENTS_MAX", + + [TK_M_TEST] = "M TEST", + [TK_M_PROGRAM] = "M PROGRAM", + [TK_M_IMPORT_FILE] = "M IMPORT_FILE", + [TK_M_IMPORT_PROG] = "M IMPORT_PROG", + [TK_M_IMPORT_PARENT] = "M MPORT_PARENT", + [TK_M_RESULT] = "M RESULT", + + [TK_A_IGNORE_DEVICE] = "A IGNORE_DEVICE", + [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", + [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", + [TK_A_NUM_FAKE_PART] = "A NUM_FAKE_PART", + [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", + [TK_A_OWNER] = "A OWNER", + [TK_A_GROUP] = "A GROUP", + [TK_A_MODE] = "A MODE", + [TK_A_OWNER_ID] = "A OWNER_ID", + [TK_A_GROUP_ID] = "A GROUP_ID", + [TK_A_MODE_ID] = "A MODE_ID", + [TK_A_ENV] = "A ENV", + [TK_A_NAME] = "A NAME", + [TK_A_DEVLINK] = "A DEVLINK", + [TK_A_EVENT_TIMEOUT] = "A EVENT_TIMEOUT", + [TK_A_IGNORE_REMOVE] = "A IGNORE_REMOVE", + [TK_A_ATTR] = "A ATTR", + [TK_A_RUN] = "A RUN", + [TK_A_GOTO] = "A GOTO", + [TK_A_LAST_RULE] = "A LAST_RULE", + + [TK_END] = "END", }; -enum import_type { - IMPORT_UNSET, - IMPORT_PROGRAM, - IMPORT_FILE, - IMPORT_PARENT, +struct token { + enum token_type type; + union { + struct { + unsigned int next_rule; + unsigned int label_off; + unsigned int filename_off; + } rule; + struct { + enum key_operation op; + unsigned int value_off; + union { + unsigned int attr_off; + int ignore_error; + int i; + unsigned int rule_goto; + mode_t mode; + uid_t uid; + gid_t gid; + int num_fake_part; + int devlink_prio; + int event_timeout; + }; + } key; + }; }; -enum escape_type { - ESCAPE_UNSET, - ESCAPE_NONE, - ESCAPE_REPLACE, +#define MAX_TK 64 +struct rule_tmp { + struct udev_rules *rules; + struct token rule; + struct token token[MAX_TK]; + unsigned int token_cur; }; -struct udev_rule { - struct key action; - struct key devpath; - struct key kernel; - struct key subsystem; - struct key driver; - struct key_pairs attr; - - struct key kernels; - struct key subsystems; - struct key drivers; - struct key_pairs attrs; - - struct key_pairs env; - struct key program; - struct key result; - struct key import; - enum import_type import_type; - struct key test; - mode_t test_mode_mask; - struct key run; - struct key wait_for; - struct key label; - struct key goto_label; - size_t goto_rule_off; - - struct key name; - struct key symlink; - struct key symlink_match; - struct key owner; - struct key group; - struct key mode; - enum escape_type string_escape; - - unsigned int link_priority; - int event_timeout; - unsigned int partitions; - unsigned int last_rule:1, - run_ignore_error:1, - ignore_device:1, - ignore_remove:1; - - size_t bufsize; - char buf[]; +struct udev_rules { + struct udev *udev; + int resolve_names; + struct token *tokens; + unsigned int token_cur; + unsigned int token_max; + char *buf; + size_t buf_cur; + size_t buf_max; + unsigned int buf_count; }; -static void udev_rules_iter_init(struct udev_rules_iter *iter, struct udev_rules *rules) +/* we could lookup and return existing strings, or tails of strings */ +static int add_string(struct udev_rules *rules, const char *str) { - dbg(rules->udev, "bufsize=%zi\n", rules->bufsize); - iter->rules = rules; - iter->current = 0; -} + size_t len = strlen(str)+1; + int off; -static struct udev_rule *udev_rules_iter_next(struct udev_rules_iter *iter) -{ - struct udev_rules *rules; - struct udev_rule *rule; + if (rules->buf_cur + len+1 >= rules->buf_max) { + char *buf; + unsigned int add; - rules = iter->rules; - if (!rules) - return NULL; + /* double the buffer size */ + add = rules->buf_max; + if (add < len) + add = len; - dbg(rules->udev, "current=%zi\n", iter->current); - if (iter->current >= rules->bufsize) { - dbg(rules->udev, "no more rules\n"); - return NULL; + buf = realloc(rules->buf, rules->buf_max + add); + if (buf == NULL) + return -1; + info(rules->udev, "extend buffer from %zu to %zu\n", rules->buf_max, rules->buf_max + add); + rules->buf = buf; + rules->buf_max += add; } - - /* get next rule */ - rule = (struct udev_rule *) (rules->buf + iter->current); - iter->current += sizeof(struct udev_rule) + rule->bufsize; - - return rule; + off = rules->buf_cur; + memcpy(&rules->buf[rules->buf_cur], str, len); + rules->buf_cur += len; + rules->buf_count++; + return off; } -static struct udev_rule *udev_rules_iter_goto(struct udev_rules_iter *iter, size_t rule_off) +static int add_token(struct udev_rules *rules, struct token *token) { - struct udev_rules *rules = iter->rules; - struct udev_rule *rule; - - dbg(rules->udev, "current=%zi\n", iter->current); - iter->current = rule_off; - rule = (struct udev_rule *) (rules->buf + iter->current); - return rule; -} + if (rules->token_cur+1 >= rules->token_max) { + struct token *tokens; + unsigned int add; -static size_t find_label(const struct udev_rules_iter *iter, const char *label) -{ - struct udev_rule *rule; - struct udev_rules *rules = iter->rules; - size_t current = iter->current; - -next: - dbg(rules->udev, "current=%zi\n", current); - if (current >= rules->bufsize) { - dbg(rules->udev, "LABEL='%s' not found\n", label); - return 0; - } - rule = (struct udev_rule *) (rules->buf + current); + /* double the buffer size */ + add = rules->token_max; + if (add < 1) + add = 1; - if (strcmp(&rule->buf[rule->label.val_off], label) != 0) { - dbg(rules->udev, "moving forward, looking for label '%s'\n", label); - current += sizeof(struct udev_rule) + rule->bufsize; - goto next; + tokens = realloc(rules->tokens, (rules->token_max + add ) * sizeof(struct token)); + if (tokens == NULL) + return -1; + info(rules->udev, "extend tokens from %u to %u\n", rules->token_max, rules->token_max + add); + rules->tokens = tokens; + rules->token_max += add; } - - dbg(rules->udev, "found label '%s'\n", label); - return current; + memcpy(&rules->tokens[rules->token_cur], token, sizeof(struct token)); + rules->token_cur++; + return 0; } static int import_property_from_string(struct udev_device *dev, char *line) @@ -267,7 +329,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) return 0; } -static int import_file_into_env(struct udev_device *dev, const char *filename) +static int import_file_into_properties(struct udev_device *dev, const char *filename) { FILE *f; char line[UTIL_LINE_SIZE]; @@ -281,7 +343,7 @@ static int import_file_into_env(struct udev_device *dev, const char *filename) return 0; } -static int import_program_into_env(struct udev_device *dev, const char *program) +static int import_program_into_properties(struct udev_device *dev, const char *program) { struct udev *udev = udev_device_get_udev(dev); char **envp; @@ -308,7 +370,7 @@ static int import_program_into_env(struct udev_device *dev, const char *program) return 0; } -static int import_parent_into_env(struct udev_device *dev, const char *filter) +static int import_parent_into_properties(struct udev_device *dev, const char *filter) { struct udev *udev = udev_device_get_udev(dev); struct udev_device *dev_parent; @@ -336,8 +398,9 @@ static int import_parent_into_env(struct udev_device *dev, const char *filter) } #define WAIT_LOOP_PER_SECOND 50 -static int wait_for_file(struct udev_event *event, const char *file, int timeout) +static int wait_for_file(struct udev_device *dev, const char *file, int timeout) { + struct udev *udev = udev_device_get_udev(dev); char filepath[UTIL_PATH_SIZE]; char devicepath[UTIL_PATH_SIZE] = ""; struct stat stats; @@ -345,8 +408,8 @@ static int wait_for_file(struct udev_event *event, const char *file, int timeout /* a relative path is a device attribute */ if (file[0] != '/') { - util_strlcpy(devicepath, udev_get_sys_path(event->udev), sizeof(devicepath)); - util_strlcat(devicepath, udev_device_get_devpath(event->dev), sizeof(devicepath)); + util_strlcpy(devicepath, udev_get_sys_path(udev), sizeof(devicepath)); + util_strlcat(devicepath, udev_device_get_devpath(dev), sizeof(devicepath)); util_strlcpy(filepath, devicepath, sizeof(filepath)); util_strlcat(filepath, "/", sizeof(filepath)); @@ -354,22 +417,22 @@ static int wait_for_file(struct udev_event *event, const char *file, int timeout file = filepath; } - dbg(event->udev, "will wait %i sec for '%s'\n", timeout, file); + dbg(udev, "will wait %i sec for '%s'\n", timeout, file); while (--loop) { /* lookup file */ if (stat(file, &stats) == 0) { - info(event->udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + info(udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); return 0; } /* make sure, the device did not disappear in the meantime */ if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { - info(event->udev, "device disappeared while waiting for '%s'\n", file); + info(udev, "device disappeared while waiting for '%s'\n", file); return -2; } - info(event->udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); + info(udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); } - info(event->udev, "waiting for '%s' failed\n", file); + info(udev, "waiting for '%s' failed\n", file); return -1; } @@ -411,883 +474,407 @@ static int attr_subst_subdir(char *attr, size_t len) return found; } -static char *key_val(struct udev_rule *rule, struct key *key) -{ - return rule->buf + key->val_off; -} - -static char *key_pair_name(struct udev_rule *rule, struct key_pair *pair) -{ - return rule->buf + pair->key_name_off; -} - -static int match_key(struct udev *udev, const char *key_name, struct udev_rule *rule, struct key *key, const char *val) +static int get_key(struct udev *udev, char **line, char **key, enum key_operation *op, char **value) { - char value[UTIL_PATH_SIZE]; - char *key_value; - char *pos; - int match = 0; + char *linepos; + char *temp; - if (key->operation != KEY_OP_MATCH && - key->operation != KEY_OP_NOMATCH) - return 0; + linepos = *line; + if (linepos == NULL && linepos[0] == '\0') + return -1; - if (val == NULL) - val = ""; + /* skip whitespace */ + while (isspace(linepos[0]) || linepos[0] == ',') + linepos++; - /* look for a matching string, parts are separated by '|' */ - util_strlcpy(value, rule->buf + key->val_off, sizeof(value)); - key_value = value; - dbg(udev, "key %s value='%s'\n", key_name, key_value); - while (key_value != NULL) { - pos = strchr(key_value, '|'); - if (pos != NULL) { - pos[0] = '\0'; - pos = &pos[1]; - } + /* get the key */ + if (linepos[0] == '\0') + return -1; + *key = linepos; - dbg(udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); - match = (fnmatch(key_value, val, 0) == 0); - if (match) + while (1) { + linepos++; + if (linepos[0] == '\0') + return -1; + if (isspace(linepos[0])) break; - - key_value = pos; - } - - if (match && (key->operation == KEY_OP_MATCH)) { - dbg(udev, "%s is true (matching value)\n", key_name); - return 0; - } - if (!match && (key->operation == KEY_OP_NOMATCH)) { - dbg(udev, "%s is true (non-matching value)\n", key_name); - return 0; - } - return -1; -} - -/* match a single rule against a given device and possibly its parent devices */ -static int match_rule(struct udev_event *event, struct udev_rule *rule) -{ - struct udev_device *dev = event->dev; - int i; - - if (match_key(event->udev, "ACTION", rule, &rule->action, udev_device_get_action(dev))) - goto nomatch; - - if (match_key(event->udev, "KERNEL", rule, &rule->kernel, udev_device_get_sysname(dev))) - goto nomatch; - - if (match_key(event->udev, "SUBSYSTEM", rule, &rule->subsystem, udev_device_get_subsystem(dev))) - goto nomatch; - - if (match_key(event->udev, "DEVPATH", rule, &rule->devpath, udev_device_get_devpath(dev))) - goto nomatch; - - if (match_key(event->udev, "DRIVER", rule, &rule->driver, udev_device_get_driver(dev))) - goto nomatch; - - /* match NAME against a value assigned by an earlier rule */ - if (match_key(event->udev, "NAME", rule, &rule->name, event->name)) - goto nomatch; - - /* match against current list of symlinks */ - if (rule->symlink_match.operation == KEY_OP_MATCH || - rule->symlink_match.operation == KEY_OP_NOMATCH) { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - struct udev_list_entry *list_entry; - int match = 0; - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - const char *devlink; - - devlink = &udev_list_entry_get_name(list_entry)[devlen]; - if (match_key(event->udev, "SYMLINK", rule, &rule->symlink_match, devlink) == 0) { - match = 1; + if (linepos[0] == '=') + break; + if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) + if (linepos[1] == '=') break; - } - } - if (!match) - goto nomatch; - } - - for (i = 0; i < rule->env.count; i++) { - struct key_pair *pair = &rule->env.keys[i]; - - /* we only check for matches, assignments will be handled later */ - if (pair->key.operation == KEY_OP_MATCH || - pair->key.operation == KEY_OP_NOMATCH) { - struct udev_list_entry *list_entry; - const char *key_name = key_pair_name(rule, pair); - const char *value; - - list_entry = udev_device_get_properties_list_entry(event->dev); - list_entry = udev_list_entry_get_by_name(list_entry, key_name); - value = udev_list_entry_get_value(list_entry); - if (value == NULL) { - dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); - value = ""; - } - if (match_key(event->udev, "ENV", rule, &pair->key, value)) - goto nomatch; - } - } - - if (rule->test.operation == KEY_OP_MATCH || - rule->test.operation == KEY_OP_NOMATCH) { - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; - int match; - - util_strlcpy(filename, key_val(rule, &rule->test), sizeof(filename)); - udev_event_apply_format(event, filename, sizeof(filename)); - if (udev_event_apply_subsys_kernel(event, NULL, filename, sizeof(filename), 0) != 0) - if (filename[0] != '/') { - char tmp[UTIL_PATH_SIZE]; - - util_strlcpy(tmp, udev_device_get_syspath(dev), sizeof(tmp)); - util_strlcat(tmp, "/", sizeof(tmp)); - util_strlcat(tmp, filename, sizeof(tmp)); - util_strlcpy(filename, tmp, sizeof(filename)); - } - - attr_subst_subdir(filename, sizeof(filename)); - - match = (stat(filename, &statbuf) == 0); - info(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); - if (match && rule->test_mode_mask > 0) { - match = ((statbuf.st_mode & rule->test_mode_mask) > 0); - info(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, - match ? "matches" : "does not match", - rule->test_mode_mask); - } - if (match && rule->test.operation == KEY_OP_NOMATCH) - goto nomatch; - if (!match && rule->test.operation == KEY_OP_MATCH) - goto nomatch; - dbg(event->udev, "TEST key is true\n"); } - if (rule->wait_for.operation != KEY_OP_UNSET) { - char filename[UTIL_PATH_SIZE]; - int found; + /* remember end of key */ + temp = linepos; - util_strlcpy(filename, key_val(rule, &rule->wait_for), sizeof(filename)); - udev_event_apply_format(event, filename, sizeof(filename)); - found = (wait_for_file(event, filename, 10) == 0); - if (!found && (rule->wait_for.operation != KEY_OP_NOMATCH)) - goto nomatch; - } + /* skip whitespace after key */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; - /* check for matching sysfs attribute pairs */ - for (i = 0; i < rule->attr.count; i++) { - struct key_pair *pair = &rule->attr.keys[i]; + /* get operation type */ + if (linepos[0] == '=' && linepos[1] == '=') { + *op = KEY_OP_MATCH; + linepos += 2; + } else if (linepos[0] == '!' && linepos[1] == '=') { + *op = KEY_OP_NOMATCH; + linepos += 2; + } else if (linepos[0] == '+' && linepos[1] == '=') { + *op = KEY_OP_ADD; + linepos += 2; + } else if (linepos[0] == '=') { + *op = KEY_OP_ASSIGN; + linepos++; + } else if (linepos[0] == ':' && linepos[1] == '=') { + *op = KEY_OP_ASSIGN_FINAL; + linepos += 2; + } else + return -1; - if (pair->key.operation == KEY_OP_MATCH || - pair->key.operation == KEY_OP_NOMATCH) { - char attr[UTIL_PATH_SIZE]; - const char *key_name = key_pair_name(rule, pair); - const char *key_value = key_val(rule, &pair->key); - char value[UTIL_NAME_SIZE] = ""; - size_t len; + /* terminate key */ + temp[0] = '\0'; - util_strlcpy(attr, key_name, sizeof(attr)); - udev_event_apply_subsys_kernel(event, attr, value, sizeof(value), 1); + /* skip whitespace after operator */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; - if (value[0]=='\0') { - const char *val; + /* get the value*/ + if (linepos[0] == '"') + linepos++; + else + return -1; + *value = linepos; - val = udev_device_get_sysattr_value(dev, key_name); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - } + temp = strchr(linepos, '"'); + if (!temp) + return -1; + temp[0] = '\0'; + temp++; + dbg(udev, "%s '%s'-'%s'\n", operation_str[*op], *key, *value); - if (value[0]=='\0') - goto nomatch; + /* move line to next key */ + *line = temp; + return 0; +} - /* strip trailing whitespace of value, if not asked to match for it */ - len = strlen(key_value); - if (len > 0 && !isspace(key_value[len-1])) { - len = strlen(value); - while (len > 0 && isspace(value[--len])) - value[len] = '\0'; - dbg(event->udev, "removed trailing whitespace from '%s'\n", value); - } +/* extract possible KEY{attr} */ +static char *get_key_attribute(struct udev *udev, char *str) +{ + char *pos; + char *attr; - if (match_key(event->udev, "ATTR", rule, &pair->key, value)) - goto nomatch; + attr = strchr(str, '{'); + if (attr != NULL) { + attr++; + pos = strchr(attr, '}'); + if (pos == NULL) { + err(udev, "missing closing brace for format\n"); + return NULL; } + pos[0] = '\0'; + dbg(udev, "attribute='%s'\n", attr); + return attr; } + return NULL; +} - /* walk up the chain of parent devices and find a match */ - event->dev_parent = dev; - while (1) { - /* check for matching kernel device name */ - if (match_key(event->udev, "KERNELS", rule, - &rule->kernels, udev_device_get_sysname(event->dev_parent))) - goto try_parent; - - /* check for matching subsystem value */ - if (match_key(event->udev, "SUBSYSTEMS", rule, - &rule->subsystems, udev_device_get_subsystem(event->dev_parent))) - goto try_parent; - - /* check for matching driver */ - if (match_key(event->udev, "DRIVERS", rule, - &rule->drivers, udev_device_get_driver(event->dev_parent))) - goto try_parent; - - /* check for matching sysfs attribute pairs */ - for (i = 0; i < rule->attrs.count; i++) { - struct key_pair *pair = &rule->attrs.keys[i]; - - if (pair->key.operation == KEY_OP_MATCH || - pair->key.operation == KEY_OP_NOMATCH) { - const char *key_name = key_pair_name(rule, pair); - const char *key_value = key_val(rule, &pair->key); - const char *val; - char value[UTIL_NAME_SIZE]; - size_t len; - - val = udev_device_get_sysattr_value(event->dev_parent, key_name); - if (val == NULL) - val = udev_device_get_sysattr_value(dev, key_name); - if (val == NULL) - goto try_parent; - util_strlcpy(value, val, sizeof(value)); - - /* strip trailing whitespace of value, if not asked to match for it */ - len = strlen(key_value); - if (len > 0 && !isspace(key_value[len-1])) { - len = strlen(value); - while (len > 0 && isspace(value[--len])) - value[len] = '\0'; - dbg(event->udev, "removed trailing whitespace from '%s'\n", value); - } - - if (match_key(event->udev, "ATTRS", rule, &pair->key, value)) - goto try_parent; - } - } - - /* found matching device */ +static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, + enum key_operation op, + const char *value, const void *data) +{ + struct token *token = &rule_tmp->token[rule_tmp->token_cur]; + const char *attr = data; + mode_t mode = 0000; + + switch (type) { + case TK_M_WAITFOR: + case TK_M_ACTION: + case TK_M_DEVPATH: + case TK_M_KERNEL: + case TK_M_SUBSYSTEM: + case TK_M_DRIVER: + case TK_M_DEVLINK: + case TK_M_NAME: + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_PROGRAM: + case TK_M_IMPORT_FILE: + case TK_M_IMPORT_PROG: + case TK_M_IMPORT_PARENT: + case TK_M_RESULT: + case TK_A_OWNER: + case TK_A_GROUP: + case TK_A_MODE: + case TK_A_NAME: + case TK_A_DEVLINK: + case TK_A_GOTO: + token->key.value_off = add_string(rule_tmp->rules, value); break; -try_parent: - /* move to parent device */ - dbg(event->udev, "try parent sysfs device\n"); - event->dev_parent = udev_device_get_parent(event->dev_parent); - if (event->dev_parent == NULL) - goto nomatch; - dbg(event->udev, "looking at dev_parent->devpath='%s'\n", - udev_device_get_syspath(event->dev_parent)); + case TK_M_ENV: + case TK_M_ATTR: + case TK_M_ATTRS: + case TK_A_ATTR: + case TK_A_ENV: + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.attr_off = add_string(rule_tmp->rules, attr); + break; + case TK_M_TEST: + if (data != NULL) + mode = *(mode_t *)data; + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.mode = mode; + break; + case TK_A_IGNORE_DEVICE: + case TK_A_STRING_ESCAPE_NONE: + case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_IGNORE_REMOVE: + case TK_A_LAST_RULE: + break; + case TK_A_RUN: + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.ignore_error = *(int *)data; + break; + case TK_A_NUM_FAKE_PART: + token->key.num_fake_part = *(int *)data; + break; + case TK_A_DEVLINK_PRIO: + token->key.devlink_prio = *(int *)data; + break; + case TK_A_OWNER_ID: + token->key.uid = *(uid_t *)data; + break; + case TK_A_GROUP_ID: + token->key.gid = *(gid_t *)data; + break; + case TK_A_MODE_ID: + token->key.mode = *(mode_t *)data; + break; + case TK_A_EVENT_TIMEOUT: + token->key.event_timeout = *(int *)data; + break; + case TK_RULE: + case TK_PARENTS_MAX: + case TK_END: + case TK_UNDEF: + err(rule_tmp->rules->udev, "wrong type %u\n", type); + return -1; } - - /* execute external program */ - if (rule->program.operation != KEY_OP_UNSET) { - char program[UTIL_PATH_SIZE]; - char **envp; - char result[UTIL_PATH_SIZE]; - - util_strlcpy(program, key_val(rule, &rule->program), sizeof(program)); - udev_event_apply_format(event, program, sizeof(program)); - envp = udev_device_get_properties_envp(dev); - if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { - dbg(event->udev, "PROGRAM is false\n"); - event->program_result[0] = '\0'; - if (rule->program.operation != KEY_OP_NOMATCH) - goto nomatch; - } else { - int count; - - dbg(event->udev, "PROGRAM matches\n"); - util_remove_trailing_chars(result, '\n'); - if (rule->string_escape == ESCAPE_UNSET || - rule->string_escape == ESCAPE_REPLACE) { - count = util_replace_chars(result, ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - } - dbg(event->udev, "result is '%s'\n", result); - util_strlcpy(event->program_result, result, sizeof(event->program_result)); - dbg(event->udev, "PROGRAM returned successful\n"); - if (rule->program.operation == KEY_OP_NOMATCH) - goto nomatch; - } - dbg(event->udev, "PROGRAM key is true\n"); + token->type = type; + token->key.op = op; + rule_tmp->token_cur++; + if (rule_tmp->token_cur >= ARRAY_SIZE(rule_tmp->token)) { + err(rule_tmp->rules->udev, "temporary rule array too small\n"); + return -1; } + return 0; +} - /* check for matching result of external program */ - if (match_key(event->udev, "RESULT", rule, &rule->result, event->program_result)) - goto nomatch; - - /* import variables returned from program or or file into properties */ - if (rule->import.operation != KEY_OP_UNSET) { - char import[UTIL_PATH_SIZE]; - int rc = -1; - - util_strlcpy(import, key_val(rule, &rule->import), sizeof(import)); - udev_event_apply_format(event, import, sizeof(import)); - dbg(event->udev, "check for IMPORT import='%s'\n", import); - if (rule->import_type == IMPORT_PROGRAM) { - rc = import_program_into_env(event->dev, import); - } else if (rule->import_type == IMPORT_FILE) { - dbg(event->udev, "import file import='%s'\n", import); - rc = import_file_into_env(event->dev, import); - } else if (rule->import_type == IMPORT_PARENT) { - dbg(event->udev, "import parent import='%s'\n", import); - rc = import_parent_into_env(event->dev, import); +#ifdef DEBUG +static void dump_token(struct udev_rules *rules, struct token *token) +{ + enum token_type type = token->type; + enum key_operation op = token->key.op; + const char *value = &rules->buf[token->key.value_off]; + const char *attr = &rules->buf[token->key.attr_off]; + + switch (type) { + case TK_RULE: + { + const char *tks_ptr = (char *)rules->tokens; + const char *tk_ptr = (char *)token; + unsigned int off = tk_ptr - tks_ptr; + + dbg(rules->udev, "* RULE '%s', off: %u(%u), next: %u, label: '%s'\n", + &rules->buf[token->rule.filename_off], + off / (unsigned int) sizeof(struct token), off, + token->rule.next_rule, + &rules->buf[token->rule.label_off]); + break; } - if (rc != 0) { - dbg(event->udev, "IMPORT failed\n"); - if (rule->import.operation != KEY_OP_NOMATCH) - goto nomatch; - } else - dbg(event->udev, "IMPORT '%s' imported\n", key_val(rule, &rule->import)); - dbg(event->udev, "IMPORT key is true\n"); + case TK_M_WAITFOR: + case TK_M_ACTION: + case TK_M_DEVPATH: + case TK_M_KERNEL: + case TK_M_SUBSYSTEM: + case TK_M_DRIVER: + case TK_M_DEVLINK: + case TK_M_NAME: + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_PROGRAM: + case TK_M_IMPORT_FILE: + case TK_M_IMPORT_PROG: + case TK_M_IMPORT_PARENT: + case TK_M_RESULT: + case TK_A_NAME: + case TK_A_DEVLINK: + case TK_A_OWNER: + case TK_A_GROUP: + case TK_A_MODE: + case TK_A_RUN: + dbg(rules->udev, "%s %s '%s'\n", token_str[type], operation_str[op], value); + break; + case TK_M_ATTR: + case TK_M_ATTRS: + case TK_M_ENV: + case TK_A_ATTR: + case TK_A_ENV: + dbg(rules->udev, "%s %s '%s' '%s'\n", token_str[type], operation_str[op], attr, value); + break; + case TK_A_IGNORE_DEVICE: + case TK_A_STRING_ESCAPE_NONE: + case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_LAST_RULE: + case TK_A_IGNORE_REMOVE: + dbg(rules->udev, "%s\n", token_str[type]); + break; + case TK_M_TEST: + dbg(rules->udev, "%s %s '%s' %#o\n", token_str[type], operation_str[op], value, token->key.mode); + break; + case TK_A_NUM_FAKE_PART: + dbg(rules->udev, "%s %u\n", token_str[type], token->key.num_fake_part); + break; + case TK_A_DEVLINK_PRIO: + dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.devlink_prio); + break; + case TK_A_OWNER_ID: + dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.uid); + break; + case TK_A_GROUP_ID: + dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.gid); + break; + case TK_A_MODE_ID: + dbg(rules->udev, "%s %s %#o\n", token_str[type], operation_str[op], token->key.mode); + break; + case TK_A_EVENT_TIMEOUT: + dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.event_timeout); + break; + case TK_A_GOTO: + dbg(rules->udev, "%s '%s' %u\n", token_str[type], value, token->key.rule_goto); + break; + case TK_END: + dbg(rules->udev, "* %s\n", token_str[type]); + break; + case TK_PARENTS_MAX: + case TK_UNDEF: + dbg(rules->udev, "unknown type %u\n", type); + break; } +} - /* rule matches, if we have ENV assignments export it */ - for (i = 0; i < rule->env.count; i++) { - struct key_pair *pair = &rule->env.keys[i]; - - if (pair->key.operation == KEY_OP_ASSIGN) { - char temp_value[UTIL_NAME_SIZE]; - const char *key_name = key_pair_name(rule, pair); - const char *value = key_val(rule, &pair->key); - - /* make sure we don't write to the same string we possibly read from */ - util_strlcpy(temp_value, value, sizeof(temp_value)); - udev_event_apply_format(event, temp_value, sizeof(temp_value)); - - if (temp_value[0] != '\0') { - struct udev_list_entry *entry; +static void dump_rules(struct udev_rules *rules) +{ + unsigned int i; + + dbg(rules->udev, "dumping %u (%zu bytes) tokens, %u (%zu bytes) strings\n", + rules->token_cur, + rules->token_cur * sizeof(struct token), + rules->buf_count, + rules->buf_cur); + for(i = 0; i < rules->token_cur; i++) + dump_token(rules, &rules->tokens[i]); +} +#else +static inline void dump_token(struct udev_rules *rules, struct token *token) {} +static inline void dump_rules(struct udev_rules *rules) {} +#endif /* DEBUG */ - info(event->udev, "set ENV '%s=%s'\n", key_name, temp_value); - entry = udev_device_add_property(dev, key_name, temp_value); - /* store in db */ - udev_list_entry_set_flag(entry, 1); +static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) +{ + unsigned int i; + unsigned int start = 0; + unsigned int end = rule_tmp->token_cur; + + for (i = 0; i < rule_tmp->token_cur; i++) { + enum token_type next_val = TK_UNDEF; + unsigned int next_idx; + unsigned int j; + + /* find smallest value */ + for (j = start; j < end; j++) { + if (rule_tmp->token[j].type == TK_UNDEF) + continue; + if (next_val == TK_UNDEF || rule_tmp->token[j].type < next_val) { + next_val = rule_tmp->token[j].type; + next_idx = j; } } - } - /* if we have ATTR assignments, write value to sysfs file */ - for (i = 0; i < rule->attr.count; i++) { - struct key_pair *pair = &rule->attr.keys[i]; - - if (pair->key.operation == KEY_OP_ASSIGN) { - const char *key_name = key_pair_name(rule, pair); - char attr[UTIL_PATH_SIZE]; - char value[UTIL_NAME_SIZE]; - FILE *f; - - util_strlcpy(attr, key_name, sizeof(attr)); - if (udev_event_apply_subsys_kernel(event, key_name, attr, sizeof(attr), 0) != 0) { - util_strlcpy(attr, udev_device_get_syspath(dev), sizeof(attr)); - util_strlcat(attr, "/", sizeof(attr)); - util_strlcat(attr, key_name, sizeof(attr)); - } + /* add token and mark done */ + if (add_token(rules, &rule_tmp->token[next_idx]) != 0) + return -1; + rule_tmp->token[next_idx].type = TK_UNDEF; - attr_subst_subdir(attr, sizeof(attr)); - - util_strlcpy(value, key_val(rule, &pair->key), sizeof(value)); - udev_event_apply_format(event, value, sizeof(value)); - info(event->udev, "writing '%s' to sysfs file '%s'\n", value, attr); - f = fopen(attr, "w"); - if (f != NULL) { - if (!event->test) - if (fprintf(f, "%s", value) <= 0) - err(event->udev, "error writing ATTR{%s}: %m\n", attr); - fclose(f); - } else - err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); - } + /* shrink range */ + if (next_idx == start) + start++; + if (next_idx+1 == end) + end--; } return 0; - -nomatch: - return -1; } -int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event) +static int add_rule(struct udev_rules *rules, char *line, + const char *filename, unsigned int filename_off, unsigned int lineno) { - struct udev_device *dev = event->dev; - struct udev_rules_iter iter; - struct udev_rule *rule; - int name_set = 0; + int valid = 0; + char *linepos; + char *attr; + int physdev = 0; + struct rule_tmp rule_tmp; - dbg(event->udev, "device: '%s'\n", udev_device_get_syspath(dev)); + memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); + rule_tmp.rules = rules; + rule_tmp.rule.type = TK_RULE; + rule_tmp.rule.rule.filename_off = filename_off; - /* look for a matching rule to apply */ - udev_rules_iter_init(&iter, rules); + linepos = line; while (1) { - rule = udev_rules_iter_next(&iter); - if (rule == NULL) + char *key; + char *value; + enum key_operation op = KEY_OP_UNSET; + + if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) break; - if (name_set && - (rule->name.operation == KEY_OP_ASSIGN || - rule->name.operation == KEY_OP_ASSIGN_FINAL || - rule->name.operation == KEY_OP_ADD)) { - dbg(event->udev, "node name already set, rule ignored\n"); + if (strcasecmp(key, "ACTION") == 0) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + err(rules->udev, "invalid ACTION operation\n"); + goto invalid; + } + rule_add_token(&rule_tmp, TK_M_ACTION, op, value, NULL); + valid = 1; continue; } - dbg(event->udev, "process rule\n"); - if (match_rule(event, rule) == 0) { - /* apply options */ - if (rule->ignore_device) { - info(event->udev, "rule applied, '%s' is ignored\n", udev_device_get_sysname(dev)); - event->ignore_device = 1; - return 0; - } - if (rule->ignore_remove) { - udev_device_set_ignore_remove(dev, 1); - dbg(event->udev, "remove event should be ignored\n"); - } - if (rule->link_priority != 0) { - udev_device_set_devlink_priority(dev, rule->link_priority); - info(event->udev, "devlink_priority=%i\n", rule->link_priority); - } - if (rule->event_timeout >= 0) { - udev_device_set_event_timeout(dev, rule->event_timeout); - info(event->udev, "event_timeout=%i\n", rule->event_timeout); - } - /* apply all_partitions option only at a disk device */ - if (rule->partitions > 0 && - strcmp(udev_device_get_subsystem(dev), "block") == 0 && - udev_device_get_sysnum(dev) == NULL) { - udev_device_set_num_fake_partitions(dev, rule->partitions); - dbg(event->udev, "creation of partition nodes requested\n"); + if (strcasecmp(key, "DEVPATH") == 0) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + err(rules->udev, "invalid DEVPATH operation\n"); + goto invalid; } - - /* apply permissions */ - if (!event->mode_final && rule->mode.operation != KEY_OP_UNSET) { - if (rule->mode.operation == KEY_OP_ASSIGN_FINAL) - event->mode_final = 1; - char buf[20]; - util_strlcpy(buf, key_val(rule, &rule->mode), sizeof(buf)); - udev_event_apply_format(event, buf, sizeof(buf)); - event->mode = strtol(buf, NULL, 8); - dbg(event->udev, "applied mode=%#o to '%s'\n", - event->mode, udev_device_get_sysname(dev)); - } - if (!event->owner_final && rule->owner.operation != KEY_OP_UNSET) { - if (rule->owner.operation == KEY_OP_ASSIGN_FINAL) - event->owner_final = 1; - util_strlcpy(event->owner, key_val(rule, &rule->owner), sizeof(event->owner)); - udev_event_apply_format(event, event->owner, sizeof(event->owner)); - dbg(event->udev, "applied owner='%s' to '%s'\n", - event->owner, udev_device_get_sysname(dev)); - } - if (!event->group_final && rule->group.operation != KEY_OP_UNSET) { - if (rule->group.operation == KEY_OP_ASSIGN_FINAL) - event->group_final = 1; - util_strlcpy(event->group, key_val(rule, &rule->group), sizeof(event->group)); - udev_event_apply_format(event, event->group, sizeof(event->group)); - dbg(event->udev, "applied group='%s' to '%s'\n", - event->group, udev_device_get_sysname(dev)); - } - - /* collect symlinks */ - if (!event->devlink_final && - (rule->symlink.operation == KEY_OP_ASSIGN || - rule->symlink.operation == KEY_OP_ASSIGN_FINAL || - rule->symlink.operation == KEY_OP_ADD)) { - char temp[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - char *pos, *next; - int count = 0; - - if (rule->symlink.operation == KEY_OP_ASSIGN_FINAL) - event->devlink_final = 1; - if (rule->symlink.operation == KEY_OP_ASSIGN || - rule->symlink.operation == KEY_OP_ASSIGN_FINAL) { - info(event->udev, "reset symlink list\n"); - udev_device_cleanup_devlinks_list(dev); - } - /* allow multiple symlinks separated by spaces */ - util_strlcpy(temp, key_val(rule, &rule->symlink), sizeof(temp)); - udev_event_apply_format(event, temp, sizeof(temp)); - if (rule->string_escape == ESCAPE_UNSET) - count = util_replace_chars(temp, ALLOWED_CHARS_FILE " "); - else if (rule->string_escape == ESCAPE_REPLACE) - count = util_replace_chars(temp, ALLOWED_CHARS_FILE); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); - pos = temp; - while (isspace(pos[0])) - pos++; - next = strchr(pos, ' '); - while (next) { - next[0] = '\0'; - info(event->udev, "add symlink '%s'\n", pos); - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, pos, sizeof(filename)); - udev_device_add_devlink(dev, filename); - while (isspace(next[1])) - next++; - pos = &next[1]; - next = strchr(pos, ' '); - } - if (pos[0] != '\0') { - info(event->udev, "add symlink '%s'\n", pos); - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, pos, sizeof(filename)); - udev_device_add_devlink(dev, filename); - } - } - - /* set name, later rules with name set will be ignored */ - if (rule->name.operation == KEY_OP_ASSIGN || - rule->name.operation == KEY_OP_ASSIGN_FINAL || - rule->name.operation == KEY_OP_ADD) { - int count; - - name_set = 1; - util_strlcpy(event->name, key_val(rule, &rule->name), sizeof(event->name)); - udev_event_apply_format(event, event->name, sizeof(event->name)); - if (rule->string_escape == ESCAPE_UNSET || - rule->string_escape == ESCAPE_REPLACE) { - count = util_replace_chars(event->name, ALLOWED_CHARS_FILE); - if (count > 0) - info(event->udev, "%i character(s) replaced\n", count); - } - - info(event->udev, "rule applied, '%s' becomes '%s'\n", - udev_device_get_sysname(dev), event->name); - if (strcmp(udev_device_get_subsystem(dev), "net") != 0) - dbg(event->udev, "'%s' owner='%s', group='%s', mode=%#o partitions=%i\n", - event->name, event->owner, event->group, event->mode, - udev_device_get_num_fake_partitions(dev)); - } - - if (!event->run_final && rule->run.operation != KEY_OP_UNSET) { - struct udev_list_entry *list_entry; - - if (rule->run.operation == KEY_OP_ASSIGN_FINAL) - event->run_final = 1; - if (rule->run.operation == KEY_OP_ASSIGN || rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info(event->udev, "reset run list\n"); - udev_list_cleanup_entries(event->udev, &event->run_list); - } - dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); - list_entry = udev_list_entry_add(event->udev, &event->run_list, - key_val(rule, &rule->run), NULL, 1, 0); - if (rule->run_ignore_error && list_entry != NULL) - udev_list_entry_set_flag(list_entry, 1); - } - - if (rule->last_rule) { - dbg(event->udev, "last rule to be applied\n"); - break; - } - - if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg(event->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_goto(&iter, rule->goto_rule_off); - } - } - } - - if (!name_set) { - info(event->udev, "no node name set, will use kernel name '%s'\n", - udev_device_get_sysname(dev)); - util_strlcpy(event->name, udev_device_get_sysname(dev), sizeof(event->name)); - } - - if (event->tmp_node[0] != '\0') { - dbg(event->udev, "removing temporary device node\n"); - util_unlink_secure(event->udev, event->tmp_node); - event->tmp_node[0] = '\0'; - } - return 0; -} - -int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event) -{ - struct udev_device *dev = event->dev; - struct udev_rules_iter iter; - struct udev_rule *rule; - - dbg(event->udev, "sysname: '%s'\n", udev_device_get_sysname(dev)); - - /* look for a matching rule to apply */ - udev_rules_iter_init(&iter, rules); - while (1) { - rule = udev_rules_iter_next(&iter); - if (rule == NULL) - break; - - dbg(event->udev, "process rule\n"); - if (rule->name.operation == KEY_OP_ASSIGN || - rule->name.operation == KEY_OP_ASSIGN_FINAL || - rule->name.operation == KEY_OP_ADD || - rule->symlink.operation == KEY_OP_ASSIGN || - rule->symlink.operation == KEY_OP_ASSIGN_FINAL || - rule->symlink.operation == KEY_OP_ADD || - rule->mode.operation != KEY_OP_UNSET || - rule->owner.operation != KEY_OP_UNSET || rule->group.operation != KEY_OP_UNSET) { - dbg(event->udev, "skip rule that names a device\n"); - continue; - } - - if (match_rule(event, rule) == 0) { - if (rule->ignore_device) { - info(event->udev, "rule applied, '%s' is ignored\n", udev_device_get_sysname(dev)); - event->ignore_device = 1; - return 0; - } - if (rule->ignore_remove) { - udev_device_set_ignore_remove(dev, 1); - dbg(event->udev, "remove event should be ignored\n"); - } - - if (!event->run_final && rule->run.operation != KEY_OP_UNSET) { - struct udev_list_entry *list_entry; - - if (rule->run.operation == KEY_OP_ASSIGN || - rule->run.operation == KEY_OP_ASSIGN_FINAL) { - info(event->udev, "reset run list\n"); - udev_list_cleanup_entries(event->udev, &event->run_list); - } - dbg(event->udev, "add run '%s'\n", key_val(rule, &rule->run)); - list_entry = udev_list_entry_add(event->udev, &event->run_list, - key_val(rule, &rule->run), NULL, 1, 0); - if (rule->run_ignore_error && list_entry != NULL) - udev_list_entry_set_flag(list_entry, 1); - if (rule->run.operation == KEY_OP_ASSIGN_FINAL) - break; - } - - if (rule->last_rule) { - dbg(event->udev, "last rule to be applied\n"); - break; - } - - if (rule->goto_label.operation != KEY_OP_UNSET) { - dbg(event->udev, "moving forward to label '%s'\n", key_val(rule, &rule->goto_label)); - udev_rules_iter_goto(&iter, rule->goto_rule_off); - } - } - } - - return 0; -} - -static int get_key(struct udev_rules *rules, char **line, char **key, enum key_operation *operation, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (linepos == NULL && linepos[0] == '\0') - return -1; - - /* skip whitespace */ - while (isspace(linepos[0]) || linepos[0] == ',') - linepos++; - - /* get the key */ - if (linepos[0] == '\0') - return -1; - *key = linepos; - - while (1) { - linepos++; - if (linepos[0] == '\0') - return -1; - if (isspace(linepos[0])) - break; - if (linepos[0] == '=') - break; - if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) - if (linepos[1] == '=') - break; - } - - /* remember end of key */ - temp = linepos; - - /* skip whitespace after key */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get operation type */ - if (linepos[0] == '=' && linepos[1] == '=') { - *operation = KEY_OP_MATCH; - linepos += 2; - dbg(rules->udev, "match:\n"); - } else if (linepos[0] == '!' && linepos[1] == '=') { - *operation = KEY_OP_NOMATCH; - linepos += 2; - dbg(rules->udev, "nomatch:\n"); - } else if (linepos[0] == '+' && linepos[1] == '=') { - *operation = KEY_OP_ADD; - linepos += 2; - dbg(rules->udev, "add:\n"); - } else if (linepos[0] == '=') { - *operation = KEY_OP_ASSIGN; - linepos++; - dbg(rules->udev, "assign:\n"); - } else if (linepos[0] == ':' && linepos[1] == '=') { - *operation = KEY_OP_ASSIGN_FINAL; - linepos += 2; - dbg(rules->udev, "assign_final:\n"); - } else - return -1; - - /* terminate key */ - temp[0] = '\0'; - - /* skip whitespace after operator */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get the value*/ - if (linepos[0] == '"') - linepos++; - else - return -1; - *value = linepos; - - temp = strchr(linepos, '"'); - if (!temp) - return -1; - temp[0] = '\0'; - temp++; - dbg(rules->udev, "'%s'-'%s'\n", *key, *value); - - /* move line to next key */ - *line = temp; - return 0; -} - -/* extract possible KEY{attr} */ -static char *get_key_attribute(struct udev_rules *rules, char *str) -{ - char *pos; - char *attr; - - attr = strchr(str, '{'); - if (attr != NULL) { - attr++; - pos = strchr(attr, '}'); - if (pos == NULL) { - err(rules->udev, "missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - dbg(rules->udev, "attribute='%s'\n", attr); - return attr; - } - - return NULL; -} - -static int add_rule_key(struct udev_rule *rule, struct key *key, - enum key_operation operation, const char *value) -{ - size_t val_len = strnlen(value, UTIL_PATH_SIZE); - - key->operation = operation; - - key->val_off = rule->bufsize; - util_strlcpy(rule->buf + rule->bufsize, value, val_len+1); - rule->bufsize += val_len+1; - - return 0; -} - -static int add_rule_key_pair(struct udev_rules *rules, struct udev_rule *rule, struct key_pairs *pairs, - enum key_operation operation, const char *key, const char *value) -{ - size_t key_len = strnlen(key, UTIL_PATH_SIZE); - - if (pairs->count >= PAIRS_MAX) { - err(rules->udev, "skip, too many keys of the same type in a single rule\n"); - return -1; - } - - add_rule_key(rule, &pairs->keys[pairs->count].key, operation, value); - - /* add the key-name of the pair */ - pairs->keys[pairs->count].key_name_off = rule->bufsize; - util_strlcpy(rule->buf + rule->bufsize, key, key_len+1); - rule->bufsize += key_len+1; - - pairs->count++; - - return 0; -} - -static int add_to_rules(struct udev_rules *rules, char *line, const char *filename, unsigned int lineno) -{ - char buf[sizeof(struct udev_rule) + UTIL_LINE_SIZE]; - struct udev_rule *rule; - size_t rule_size; - int valid; - char *linepos; - char *attr; - size_t padding; - int physdev = 0; - - memset(buf, 0x00, sizeof(buf)); - rule = (struct udev_rule *) buf; - rule->event_timeout = -1; - linepos = line; - valid = 0; - - /* get all the keys */ - while (1) { - char *key; - char *value; - enum key_operation operation = KEY_OP_UNSET; - - if (get_key(rules, &linepos, &key, &operation, &value) != 0) - break; - - if (strcasecmp(key, "ACTION") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid ACTION operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->action, operation, value); - valid = 1; - continue; - } - - if (strcasecmp(key, "DEVPATH") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { - err(rules->udev, "invalid DEVPATH operation\n"); - goto invalid; - } - add_rule_key(rule, &rule->devpath, operation, value); - valid = 1; - continue; - } + rule_add_token(&rule_tmp, TK_M_DEVPATH, op, value, NULL); + valid = 1; + continue; + } if (strcasecmp(key, "KERNEL") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { err(rules->udev, "invalid KERNEL operation\n"); goto invalid; } - add_rule_key(rule, &rule->kernel, operation, value); + rule_add_token(&rule_tmp, TK_M_KERNEL, op, value, NULL); valid = 1; continue; } if (strcasecmp(key, "SUBSYSTEM") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { err(rules->udev, "invalid SUBSYSTEM operation\n"); goto invalid; } @@ -1298,79 +885,77 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) err(rules->udev, "'%s' must be specified as 'subsystem' \n" "please fix it in %s:%u", value, filename, lineno); - add_rule_key(rule, &rule->subsystem, operation, "subsystem|class|bus"); + rule_add_token(&rule_tmp, TK_M_SUBSYSTEM, op, "subsystem|class|bus", NULL); } else - add_rule_key(rule, &rule->subsystem, operation, value); + rule_add_token(&rule_tmp, TK_M_SUBSYSTEM, op, value, NULL); valid = 1; continue; } if (strcasecmp(key, "DRIVER") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { err(rules->udev, "invalid DRIVER operation\n"); goto invalid; } - add_rule_key(rule, &rule->driver, operation, value); + rule_add_token(&rule_tmp, TK_M_DRIVER, op, value, NULL); valid = 1; continue; } if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("ATTR")-1); + attr = get_key_attribute(rules->udev, key + sizeof("ATTR")-1); if (attr == NULL) { err(rules->udev, "error parsing ATTR attribute\n"); goto invalid; } - if (add_rule_key_pair(rules, rule, &rule->attr, operation, attr, value) != 0) - goto invalid; + if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + rule_add_token(&rule_tmp, TK_M_ATTR, op, value, attr); + } else { + rule_add_token(&rule_tmp, TK_A_ATTR, op, value, attr); + } valid = 1; continue; } if (strcasecmp(key, "KERNELS") == 0 || strcasecmp(key, "ID") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { err(rules->udev, "invalid KERNELS operation\n"); goto invalid; } - add_rule_key(rule, &rule->kernels, operation, value); + rule_add_token(&rule_tmp, TK_M_KERNELS, op, value, NULL); valid = 1; continue; } if (strcasecmp(key, "SUBSYSTEMS") == 0 || strcasecmp(key, "BUS") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { err(rules->udev, "invalid SUBSYSTEMS operation\n"); goto invalid; } - add_rule_key(rule, &rule->subsystems, operation, value); + rule_add_token(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); valid = 1; continue; } if (strcasecmp(key, "DRIVERS") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { err(rules->udev, "invalid DRIVERS operation\n"); goto invalid; } - add_rule_key(rule, &rule->drivers, operation, value); + rule_add_token(&rule_tmp, TK_M_DRIVERS, op, value, NULL); valid = 1; continue; } if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { err(rules->udev, "invalid ATTRS operation\n"); goto invalid; } - attr = get_key_attribute(rules, key + sizeof("ATTRS")-1); + attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1); if (attr == NULL) { err(rules->udev, "error parsing ATTRS attribute\n"); goto invalid; @@ -1381,54 +966,60 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena else if (strstr(attr, "../") != NULL) err(rules->udev, "do not reference parent sysfs directories directly, " "it may break with a future kernel, please fix it in %s:%u", filename, lineno); - if (add_rule_key_pair(rules, rule, &rule->attrs, operation, attr, value) != 0) - goto invalid; + rule_add_token(&rule_tmp, TK_M_ATTRS, op, value, attr); valid = 1; continue; } if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("ENV")-1); + attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1); if (attr == NULL) { err(rules->udev, "error parsing ENV attribute\n"); goto invalid; } if (strncmp(attr, "PHYSDEV", 7) == 0) physdev = 1; - if (add_rule_key_pair(rules, rule, &rule->env, operation, attr, value) != 0) - goto invalid; + if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + if (rule_add_token(&rule_tmp, TK_M_ENV, op, value, attr) != 0) + goto invalid; + } else { + if (rule_add_token(&rule_tmp, TK_A_ENV, op, value, attr) != 0) + goto invalid; + } valid = 1; continue; } if (strcasecmp(key, "PROGRAM") == 0) { - add_rule_key(rule, &rule->program, operation, value); + rule_add_token(&rule_tmp, TK_M_PROGRAM, op, value, NULL); valid = 1; continue; } if (strcasecmp(key, "RESULT") == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { err(rules->udev, "invalid RESULT operation\n"); goto invalid; } - add_rule_key(rule, &rule->result, operation, value); + rule_add_token(&rule_tmp, TK_M_RESULT, op, value, NULL); valid = 1; continue; } if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("IMPORT")-1); + attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1); if (attr != NULL && strstr(attr, "program")) { dbg(rules->udev, "IMPORT will be executed\n"); - rule->import_type = IMPORT_PROGRAM; + rule_add_token(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); + valid = 1; } else if (attr != NULL && strstr(attr, "file")) { dbg(rules->udev, "IMPORT will be included as file\n"); - rule->import_type = IMPORT_FILE; + rule_add_token(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); + valid = 1; } else if (attr != NULL && strstr(attr, "parent")) { dbg(rules->udev, "IMPORT will include the parent values\n"); - rule->import_type = IMPORT_PARENT; + rule_add_token(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); + valid = 1; } else { /* figure it out if it is executable */ char file[UTIL_PATH_SIZE]; @@ -1451,129 +1042,141 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { - dbg(rules->udev, "IMPORT is executable, will be executed (autotype)\n"); - rule->import_type = IMPORT_PROGRAM; + dbg(rules->udev, "IMPORT will be executed (autotype)\n"); + rule_add_token(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); + valid = 1; } else { - dbg(rules->udev, "IMPORT is not executable, will be included as file (autotype)\n"); - rule->import_type = IMPORT_FILE; + dbg(rules->udev, "IMPORT will be included as file (autotype)\n"); + rule_add_token(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); + valid = 1; } } - add_rule_key(rule, &rule->import, operation, value); - valid = 1; continue; } if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { - if (operation != KEY_OP_MATCH && - operation != KEY_OP_NOMATCH) { + mode_t mode = 0; + + if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { err(rules->udev, "invalid TEST operation\n"); goto invalid; } - attr = get_key_attribute(rules, key + sizeof("TEST")-1); - if (attr != NULL) - rule->test_mode_mask = strtol(attr, NULL, 8); - add_rule_key(rule, &rule->test, operation, value); + attr = get_key_attribute(rules->udev, key + sizeof("TEST")-1); + if (attr != NULL) { + mode = strtol(attr, NULL, 8); + rule_add_token(&rule_tmp, TK_M_TEST, op, value, &mode); + } else { + rule_add_token(&rule_tmp, TK_M_TEST, op, value, NULL); + } valid = 1; continue; } if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("RUN")-1); - if (attr != NULL) { - if (strstr(attr, "ignore_error")) - rule->run_ignore_error = 1; - } - add_rule_key(rule, &rule->run, operation, value); + int flag = 0; + + attr = get_key_attribute(rules->udev, key + sizeof("RUN")-1); + if (attr != NULL && strstr(attr, "ignore_error")) + flag = 1; + rule_add_token(&rule_tmp, TK_A_RUN, op, value, &flag); valid = 1; continue; } if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { - add_rule_key(rule, &rule->wait_for, operation, value); + rule_add_token(&rule_tmp, TK_M_WAITFOR, 0, value, NULL); valid = 1; continue; } if (strcasecmp(key, "LABEL") == 0) { - add_rule_key(rule, &rule->label, operation, value); + rule_tmp.rule.rule.label_off = add_string(rules, value); valid = 1; continue; } if (strcasecmp(key, "GOTO") == 0) { - add_rule_key(rule, &rule->goto_label, operation, value); + rule_add_token(&rule_tmp, TK_A_GOTO, 0, value, NULL); valid = 1; continue; } if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { - attr = get_key_attribute(rules, key + sizeof("NAME")-1); - if (attr != NULL) { - if (strstr(attr, "all_partitions") != NULL) { - dbg(rules->udev, "creation of partition nodes requested\n"); - rule->partitions = DEFAULT_FAKE_PARTITIONS_COUNT; - } - if (strstr(attr, "ignore_remove") != NULL) { - dbg(rules->udev, "remove event should be ignored\n"); - rule->ignore_remove = 1; + if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + rule_add_token(&rule_tmp, TK_M_NAME, op, value, NULL); + } else { + if (value[0] == '\0') + dbg(rules->udev, "name empty, node creation suppressed\n"); + rule_add_token(&rule_tmp, TK_A_NAME, op, value, NULL); + attr = get_key_attribute(rules->udev, key + sizeof("NAME")-1); + if (attr != NULL) { + if (strstr(attr, "all_partitions") != NULL) { + int num = DEFAULT_FAKE_PARTITIONS_COUNT; + + dbg(rules->udev, "creation of partition nodes requested\n"); + rule_add_token(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num); + } + if (strstr(attr, "ignore_remove") != NULL) { + dbg(rules->udev, "remove event should be ignored\n"); + rule_add_token(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); + } } } - if (value[0] == '\0') - dbg(rules->udev, "name empty, node creation supressed\n"); - add_rule_key(rule, &rule->name, operation, value); continue; } if (strcasecmp(key, "SYMLINK") == 0) { - if (operation == KEY_OP_MATCH || - operation == KEY_OP_NOMATCH) - add_rule_key(rule, &rule->symlink_match, operation, value); - else - add_rule_key(rule, &rule->symlink, operation, value); - valid = 1; - continue; - } + if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) + rule_add_token(&rule_tmp, TK_M_DEVLINK, op, value, NULL); + else + rule_add_token(&rule_tmp, TK_A_DEVLINK, op, value, NULL); + valid = 1; + continue; + } if (strcasecmp(key, "OWNER") == 0) { - valid = 1; - if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { - char *endptr; - strtoul(value, &endptr, 10); - if (endptr[0] != '\0') { - char owner[32]; - uid_t uid = util_lookup_user(rules->udev, value); - dbg(rules->udev, "replacing username='%s' by id=%i\n", value, uid); - sprintf(owner, "%u", (unsigned int) uid); - add_rule_key(rule, &rule->owner, operation, owner); - continue; - } + uid_t uid; + char *endptr; + + uid = strtoul(value, &endptr, 10); + if (endptr[0] == '\0') { + rule_add_token(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); + } else if (rules->resolve_names && strchr("$%", value[0]) == NULL) { + uid = util_lookup_user(rules->udev, value); + rule_add_token(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); + } else { + rule_add_token(&rule_tmp, TK_A_OWNER, op, value, NULL); } - - add_rule_key(rule, &rule->owner, operation, value); + valid = 1; continue; } if (strcasecmp(key, "GROUP") == 0) { - valid = 1; - if (rules->resolve_names && (!strchr(value, '$') && !strchr(value, '%'))) { - char *endptr; - strtoul(value, &endptr, 10); - if (endptr[0] != '\0') { - char group[32]; - gid_t gid = util_lookup_group(rules->udev, value); - dbg(rules->udev, "replacing groupname='%s' by id=%i\n", value, gid); - sprintf(group, "%u", (unsigned int) gid); - add_rule_key(rule, &rule->group, operation, group); - continue; - } + gid_t gid; + char *endptr; + + gid = strtoul(value, &endptr, 10); + if (endptr[0] == '\0') { + rule_add_token(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); + } else if (rules->resolve_names && strchr("$%", value[0]) == NULL) { + gid = util_lookup_group(rules->udev, value); + rule_add_token(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); + } else { + rule_add_token(&rule_tmp, TK_A_GROUP, op, value, NULL); } - - add_rule_key(rule, &rule->group, operation, value); + valid = 1; continue; } if (strcasecmp(key, "MODE") == 0) { - add_rule_key(rule, &rule->mode, operation, value); + mode_t mode; + char *endptr; + + mode = strtol(value, &endptr, 8); + if (endptr[0] == '\0') + rule_add_token(&rule_tmp, TK_A_MODE_ID, op, NULL, &mode); + else + rule_add_token(&rule_tmp, TK_A_MODE, op, value, NULL); valid = 1; continue; } @@ -1583,71 +1186,66 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena if (strstr(value, "last_rule") != NULL) { dbg(rules->udev, "last rule to be applied\n"); - rule->last_rule = 1; + rule_add_token(&rule_tmp, TK_A_LAST_RULE, 0, NULL, NULL); } if (strstr(value, "ignore_device") != NULL) { dbg(rules->udev, "device should be ignored\n"); - rule->ignore_device = 1; + rule_add_token(&rule_tmp, TK_A_IGNORE_DEVICE, 0, NULL, NULL); } if (strstr(value, "ignore_remove") != NULL) { dbg(rules->udev, "remove event should be ignored\n"); - rule->ignore_remove = 1; + rule_add_token(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); } pos = strstr(value, "link_priority="); if (pos != NULL) { - rule->link_priority = atoi(&pos[strlen("link_priority=")]); - dbg(rules->udev, "link priority=%i\n", rule->link_priority); + int prio = atoi(&pos[strlen("link_priority=")]); + + rule_add_token(&rule_tmp, TK_A_DEVLINK_PRIO, 0, NULL, &prio); + dbg(rules->udev, "link priority=%i\n", prio); } pos = strstr(value, "event_timeout="); if (pos != NULL) { - rule->event_timeout = atoi(&pos[strlen("event_timeout=")]); - dbg(rules->udev, "event timout=%i\n", rule->event_timeout); + int tout = atoi(&pos[strlen("event_timeout=")]); + + rule_add_token(&rule_tmp, TK_A_EVENT_TIMEOUT, 0, NULL, &tout); + dbg(rules->udev, "event timout=%i\n", tout); } pos = strstr(value, "string_escape="); if (pos != NULL) { pos = &pos[strlen("string_escape=")]; if (strncmp(pos, "none", strlen("none")) == 0) - rule->string_escape = ESCAPE_NONE; + rule_add_token(&rule_tmp, TK_A_STRING_ESCAPE_NONE, 0, NULL, NULL); else if (strncmp(pos, "replace", strlen("replace")) == 0) - rule->string_escape = ESCAPE_REPLACE; + rule_add_token(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, 0, NULL, NULL); } if (strstr(value, "all_partitions") != NULL) { + int num = DEFAULT_FAKE_PARTITIONS_COUNT; + + rule_add_token(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num); dbg(rules->udev, "creation of partition nodes requested\n"); - rule->partitions = DEFAULT_FAKE_PARTITIONS_COUNT; } valid = 1; continue; } - err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); } - if (physdev && rule->wait_for.operation == KEY_OP_UNSET) - err(rules->udev, "PHYSDEV* values are deprecated and will be removed from a future kernel, \n" + if (physdev) + err(rules->udev, "PHYSDEV* values are deprecated and not available on recent kernels, \n" "please fix it in %s:%u", filename, lineno); /* skip line if not any valid key was found */ if (!valid) goto invalid; - /* grow buffer and add rule */ - rule_size = sizeof(struct udev_rule) + rule->bufsize; - padding = (sizeof(size_t) - rule_size % sizeof(size_t)) % sizeof(size_t); - dbg(rules->udev, "add %zi padding bytes\n", padding); - rule_size += padding; - rule->bufsize += padding; - - rules->buf = realloc(rules->buf, rules->bufsize + rule_size); - if (!rules->buf) { - err(rules->udev, "realloc failed\n"); - goto exit; - } - dbg(rules->udev, "adding rule to offset %zi\n", rules->bufsize); - memcpy(rules->buf + rules->bufsize, rule, rule_size); - rules->bufsize += rule_size; -exit: - return 0; + /* add rule token */ + if (add_token(rules, &rule_tmp.rule) != 0) + goto invalid; + /* add tokens to list, sorted by type */ + if (sort_token(rules, &rule_tmp) != 0) + goto invalid; + return 0; invalid: err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); return -1; @@ -1656,20 +1254,22 @@ invalid: static int parse_file(struct udev_rules *rules, const char *filename) { FILE *f; + unsigned int filename_off; + unsigned int first_token; char line[UTIL_LINE_SIZE]; - size_t start; - struct udev_rule *rule; - struct udev_rules_iter iter; + int line_nr = 0; + unsigned int i; - start = rules->bufsize; info(rules->udev, "reading '%s' as rules file\n", filename); f = fopen(filename, "r"); if (f == NULL) return -1; + filename_off = add_string(rules, filename); + first_token = rules->token_cur; + while(fgets(line, sizeof(line), f) != NULL) { - int line_nr = 0; char *key; size_t len; @@ -1699,24 +1299,27 @@ static int parse_file(struct udev_rules *rules, const char *filename) err(rules->udev, "line too long '%s':%u, ignored\n", filename, line_nr); continue; } - add_to_rules(rules, key, filename, line_nr); + add_rule(rules, key, filename, filename_off, line_nr); } fclose(f); - /* compute all goto targets within this file */ - udev_rules_iter_init(&iter, rules); - udev_rules_iter_goto(&iter, start); - while((rule = udev_rules_iter_next(&iter))) { - if (rule->goto_label.operation != KEY_OP_UNSET) { - char *goto_label = &rule->buf[rule->goto_label.val_off]; - - dbg(rules->udev, "resolving goto label '%s'\n", goto_label); - rule->goto_rule_off = find_label(&iter, goto_label); - if (rule->goto_rule_off == 0) { - err(rules->udev, "ignore goto to nonexistent label '%s' in '%s'\n", - goto_label, filename); - rule->goto_rule_off = iter.current; + /* link GOTOs to LABEL rules in this file to be able to fast-forward */ + for (i = first_token+1; i < rules->token_cur; i++) { + if (rules->tokens[i].type == TK_A_GOTO) { + char *label = &rules->buf[rules->tokens[i].key.value_off]; + unsigned int j; + + for (j = i+1; j < rules->token_cur; j++) { + if (rules->tokens[j].type != TK_RULE) + continue; + if (rules->tokens[j].rule.label_off == 0) + continue; + if (strcmp(label, &rules->buf[rules->tokens[j].rule.label_off]) != 0) + continue; + rules->tokens[i].key.rule_goto = j; } + if (rules->tokens[i].key.rule_goto == 0) + err(rules->udev, "GOTO '%s' has no matching label in: '%s'\n", label, filename); } } return 0; @@ -1771,14 +1374,30 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) char filename[PATH_MAX]; struct udev_list_node file_list; struct udev_list_entry *file_loop, *file_tmp; + unsigned int prev_rule; + struct token end_token; + unsigned int i; - rules = calloc(1, sizeof(struct udev_rules)); + rules = malloc(sizeof(struct udev_rules)); if (rules == NULL) - return rules; + return NULL; + memset(rules, 0x00, sizeof(struct udev_rules)); rules->udev = udev; rules->resolve_names = resolve_names; udev_list_init(&file_list); + /* init token array and string buffer */ + rules->tokens = malloc(PREALLOC_TOKEN * sizeof(struct token)); + if (rules->tokens != NULL) + rules->token_max = PREALLOC_TOKEN; + rules->buf = malloc(PREALLOC_STRBUF); + if (rules->buf != NULL) + rules->buf_max = PREALLOC_STRBUF; + info(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); + /* offset 0 in the string buffer is always empty */ + add_string(rules, ""); + if (udev_get_rules_path(udev) != NULL) { /* custom rules location for testing */ add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); @@ -1843,6 +1462,42 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) info(udev, "can not read '%s'\n", file_name); udev_list_entry_remove(file_loop); } + + memset(&end_token, 0x00, sizeof(struct token)); + end_token.type = TK_END; + add_token(rules, &end_token); + + /* shrink allocate buffers */ + if (rules->token_cur < rules->token_max) { + struct token *tokens; + + tokens = realloc(rules->tokens, rules->token_cur * sizeof(struct token)); + if (tokens != NULL || rules->token_cur == 0) { + rules->tokens = tokens; + rules->token_max = rules->token_cur; + } + } + if (rules->buf_cur < rules->buf_max) { + char *buf; + + buf = realloc(rules->buf, rules->buf_cur); + if (buf != NULL || rules->buf_cur == 0) { + rules->buf = buf; + rules->buf_max = rules->buf_cur; + } + } + info(udev, "shrunk to %lu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); + + /* link all TK_RULE tokens to be able to fast-forward to next TK_RULE */ + prev_rule = 0; + for (i = 1; i < rules->token_cur; i++) { + if (rules->tokens[i].type == TK_RULE) { + rules->tokens[prev_rule].rule.next_rule = i; + prev_rule = i; + } + } + dump_rules(rules); return rules; } @@ -1850,9 +1505,591 @@ void udev_rules_unref(struct udev_rules *rules) { if (rules == NULL) return; - if (rules->buf) { - free(rules->buf); - rules->buf = NULL; - } + free(rules->tokens); + free(rules->buf); free(rules); } + +static int match_key(struct udev_rules *rules, struct token *token, const char *val) +{ + const char *key_name = token_str[token->type]; + char *key_value = &rules->buf[token->key.value_off]; + char *pos; + int match = 0; + + if (val == NULL) + val = ""; + + /* look for a matching string, parts are separated by '|' */ + if (strchr(key_value, '|') != NULL) { + char value[UTIL_PATH_SIZE]; + + util_strlcpy(value, &rules->buf[token->key.value_off], sizeof(value)); + key_value = value; + while (key_value != NULL) { + pos = strchr(key_value, '|'); + if (pos != NULL) { + pos[0] = '\0'; + pos = &pos[1]; + } + dbg(rules->udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); + match = (fnmatch(key_value, val, 0) == 0); + if (match) + break; + key_value = pos; + } + } else { + match = (fnmatch(key_value, val, 0) == 0); + } + + if (match && (token->key.op == KEY_OP_MATCH)) { + dbg(rules->udev, "%s is true (matching value)\n", key_name); + return 0; + } + if (!match && (token->key.op == KEY_OP_NOMATCH)) { + dbg(rules->udev, "%s is true (non-matching value)\n", key_name); + return 0; + } + dbg(rules->udev, "%s is not true\n", key_name); + return -1; +} + +static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur) +{ + char attr[UTIL_PATH_SIZE]; + const char *key_name = &rules->buf[cur->key.attr_off]; + const char *key_value = &rules->buf[cur->key.value_off]; + char value[UTIL_NAME_SIZE] = ""; + size_t len; + + util_strlcpy(attr, key_name, sizeof(attr)); + util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); + if (value[0] == '\0') { + const char *val; + + val = udev_device_get_sysattr_value(dev, key_name); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + } + if (value[0]=='\0') + return -1; + + /* strip trailing whitespace of value, if not asked to match for it */ + len = strlen(key_value); + if (len > 0 && !isspace(key_value[len-1])) { + len = strlen(value); + while (len > 0 && isspace(value[--len])) + value[len] = '\0'; + dbg(rules->udev, "removed trailing whitespace from '%s'\n", value); + } + return match_key(rules, cur, value); +} + +enum escape_type { + ESCAPE_UNSET, + ESCAPE_NONE, + ESCAPE_REPLACE, +}; + +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event) +{ + struct token *rule; + struct token *cur; + + if (rules->tokens == NULL) + return -1; + + /* loop through token list, match, run actions or forward to next rule */ + cur = &rules->tokens[0]; + while (cur != NULL && cur->type != TK_END) { + enum escape_type esc = ESCAPE_UNSET; + unsigned int idx; + + dump_token(rules, cur); + switch (cur->type) { + case TK_RULE: + /* current rule */ + rule = cur; + esc = ESCAPE_UNSET; + break; + case TK_M_WAITFOR: + { + char filename[UTIL_PATH_SIZE]; + int found; + + util_strlcpy(filename, &rules->buf[cur->key.value_off], sizeof(filename)); + udev_event_apply_format(event, filename, sizeof(filename)); + found = (wait_for_file(event->dev, filename, 10) == 0); + if (!found && (cur->key.op != KEY_OP_NOMATCH)) + goto nomatch; + break; + } + case TK_M_ACTION: + if (match_key(rules, cur, udev_device_get_action(event->dev)) != 0) + goto nomatch; + break; + case TK_M_DEVPATH: + if (match_key(rules, cur, udev_device_get_devpath(event->dev)) != 0) + goto nomatch; + break; + case TK_M_KERNEL: + if (match_key(rules, cur, udev_device_get_sysname(event->dev)) != 0) + goto nomatch; + break; + case TK_M_DEVLINK: + { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; + int match = 0; + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { + const char *devlink; + + devlink = &udev_list_entry_get_name(list_entry)[devlen]; + if (match_key(rules, cur, devlink) == 0) { + match = 1; + break; + } + } + if (!match) + goto nomatch; + break; + } + case TK_M_NAME: + if (match_key(rules, cur, event->name) != 0) + goto nomatch; + break; + case TK_M_ENV: + { + struct udev_list_entry *list_entry; + const char *key_name = &rules->buf[cur->key.attr_off]; + const char *value; + + list_entry = udev_device_get_properties_list_entry(event->dev); + list_entry = udev_list_entry_get_by_name(list_entry, key_name); + value = udev_list_entry_get_value(list_entry); + if (value == NULL) { + dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); + value = ""; + } + if (match_key(rules, cur, value)) + goto nomatch; + break; + } + case TK_M_SUBSYSTEM: + if (match_key(rules, cur, udev_device_get_subsystem(event->dev)) != 0) + goto nomatch; + break; + case TK_M_DRIVER: + if (match_key(rules, cur, udev_device_get_driver(event->dev)) != 0) + goto nomatch; + break; + case TK_M_ATTR: + if (match_attr(rules, event->dev, event, cur) != 0) + goto nomatch; + break; + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_ATTRS: + { + struct token *next; + + /* get whole sequence of parent matches */ + next = cur; + while (next->type < TK_PARENTS_MAX) + next++; + + /* loop over parents */ + event->dev_parent = event->dev; + while (1) { + struct token *key; + + dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); + /* loop over sequence of parent match keys */ + for (key = cur; key < next; key++ ) { + dump_token(rules, key); + switch(key->type) { + case TK_M_KERNELS: + if (match_key(rules, key, udev_device_get_sysname(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_SUBSYSTEMS: + if (match_key(rules, key, udev_device_get_subsystem(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_DRIVERS: + if (match_key(rules, key, udev_device_get_driver(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_ATTRS: + if (match_attr(rules, event->dev_parent, event, key) != 0) + goto try_parent; + break; + default: + goto nomatch; + } + dbg(event->udev, "parent key matched\n"); + } + dbg(event->udev, "all parent keys matched\n"); + /* all keys matched */ + break; + + try_parent: + event->dev_parent = udev_device_get_parent(event->dev_parent); + if (event->dev_parent == NULL) + goto nomatch; + } + /* move behind our sequence of parent match keys */ + cur = next; + continue; + } + case TK_M_TEST: + { + char filename[UTIL_PATH_SIZE]; + struct stat statbuf; + int match; + + util_strlcpy(filename, &rules->buf[cur->key.value_off], sizeof(filename)); + udev_event_apply_format(event, filename, sizeof(filename)); + if (util_resolve_subsys_kernel(event->udev, NULL, filename, sizeof(filename), 0) != 0) + if (filename[0] != '/') { + char tmp[UTIL_PATH_SIZE]; + + util_strlcpy(tmp, udev_device_get_syspath(event->dev), sizeof(tmp)); + util_strlcat(tmp, "/", sizeof(tmp)); + util_strlcat(tmp, filename, sizeof(tmp)); + util_strlcpy(filename, tmp, sizeof(filename)); + } + + attr_subst_subdir(filename, sizeof(filename)); + + match = (stat(filename, &statbuf) == 0); + info(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + if (match && cur->key.mode > 0) { + match = ((statbuf.st_mode & cur->key.mode) > 0); + info(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + match ? "matches" : "does not match", cur->key.mode); + } + if (match && cur->key.op == KEY_OP_NOMATCH) + goto nomatch; + if (!match && cur->key.op == KEY_OP_MATCH) + goto nomatch; + break; + } + case TK_M_PROGRAM: + { + char program[UTIL_PATH_SIZE]; + char **envp; + char result[UTIL_PATH_SIZE]; + + util_strlcpy(program, &rules->buf[cur->key.value_off], sizeof(program)); + udev_event_apply_format(event, program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { + event->program_result[0] = '\0'; + if (cur->key.op != KEY_OP_NOMATCH) + goto nomatch; + } else { + int count; + + util_remove_trailing_chars(result, '\n'); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = util_replace_chars(result, ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + } + util_strlcpy(event->program_result, result, sizeof(event->program_result)); + if (cur->key.op == KEY_OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_FILE: + { + char import[UTIL_PATH_SIZE]; + + util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); + udev_event_apply_format(event, import, sizeof(import)); + if (import_file_into_properties(event->dev, import) != 0) + if (cur->key.op != KEY_OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PROG: + { + char import[UTIL_PATH_SIZE]; + + util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); + udev_event_apply_format(event, import, sizeof(import)); + if (import_program_into_properties(event->dev, import) != 0) + if (cur->key.op != KEY_OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PARENT: + { + char import[UTIL_PATH_SIZE]; + + util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); + udev_event_apply_format(event, import, sizeof(import)); + if (import_parent_into_properties(event->dev, import) != 0) + if (cur->key.op != KEY_OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_RESULT: + if (match_key(rules, cur, event->program_result) != 0) + goto nomatch; + break; + + case TK_A_IGNORE_DEVICE: + event->ignore_device = 1; + return 0; + break; + case TK_A_STRING_ESCAPE_NONE: + esc = ESCAPE_NONE; + break; + case TK_A_STRING_ESCAPE_REPLACE: + esc = ESCAPE_REPLACE; + break; + case TK_A_NUM_FAKE_PART: + if (strcmp(udev_device_get_subsystem(event->dev), "block") != 0) + break; + if (udev_device_get_sysnum(event->dev) != NULL) + break; + udev_device_set_num_fake_partitions(event->dev, cur->key.num_fake_part); + break; + case TK_A_DEVLINK_PRIO: + udev_device_set_devlink_priority(event->dev, cur->key.devlink_prio); + break; + case TK_A_OWNER: + { + char owner[UTIL_NAME_SIZE]; + + if (event->owner_final) + break; + if (cur->key.op == KEY_OP_ASSIGN_FINAL) + event->owner_final = 1; + util_strlcpy(owner, &rules->buf[cur->key.value_off], sizeof(owner)); + udev_event_apply_format(event, owner, sizeof(owner)); + event->uid = util_lookup_user(event->udev, owner); + break; + } + case TK_A_GROUP: + { + char group[UTIL_NAME_SIZE]; + + if (event->group_final) + break; + if (cur->key.op == KEY_OP_ASSIGN_FINAL) + event->group_final = 1; + util_strlcpy(group, &rules->buf[cur->key.value_off], sizeof(group)); + udev_event_apply_format(event, group, sizeof(group)); + event->gid = util_lookup_group(event->udev, group); + break; + } + case TK_A_MODE: + { + char mode[UTIL_NAME_SIZE]; + char *endptr; + + if (event->mode_final) + break; + if (cur->key.op == KEY_OP_ASSIGN_FINAL) + event->mode_final = 1; + util_strlcpy(mode, &rules->buf[cur->key.value_off], sizeof(mode)); + udev_event_apply_format(event, mode, sizeof(mode)); + event->mode = strtol(mode, &endptr, 8); + if (endptr[0] != '\0') { + err(event->udev, "invalide mode '%s' set default mode 0660\n", mode); + event->mode = 0660; + } + break; + } + case TK_A_OWNER_ID: + if (event->owner_final) + break; + if (cur->key.op == KEY_OP_ASSIGN_FINAL) + event->owner_final = 1; + event->uid = cur->key.uid; + break; + case TK_A_GROUP_ID: + if (event->group_final) + break; + if (cur->key.op == KEY_OP_ASSIGN_FINAL) + event->group_final = 1; + event->gid = cur->key.gid; + break; + case TK_A_MODE_ID: + if (event->mode_final) + break; + if (cur->key.op == KEY_OP_ASSIGN_FINAL) + event->mode_final = 1; + event->mode = cur->key.mode; + break; + case TK_A_ENV: + { + const char *name = &rules->buf[cur->key.attr_off]; + char *value = &rules->buf[cur->key.value_off]; + + if (value[0] != '\0') { + char temp_value[UTIL_NAME_SIZE]; + struct udev_list_entry *entry; + + util_strlcpy(temp_value, value, sizeof(temp_value)); + udev_event_apply_format(event, temp_value, sizeof(temp_value)); + entry = udev_device_add_property(event->dev, name, temp_value); + /* store in db */ + udev_list_entry_set_flag(entry, 1); + } else { + udev_device_add_property(event->dev, name, NULL); + } + break; + } + case TK_A_NAME: + { + const char *name = &rules->buf[cur->key.value_off]; + int count; + + if (event->name_final) + break; + if (cur->key.op == KEY_OP_ASSIGN_FINAL) + event->name_final = 1; + if (name[0] == '\0') { + event->name[0] = '\0'; + event->name_ignore = 1; + break; + } + event->name_ignore = 0; + util_strlcpy(event->name, name, sizeof(event->name)); + udev_event_apply_format(event, event->name, sizeof(event->name)); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = util_replace_chars(event->name, ALLOWED_CHARS_FILE); + if (count > 0) + info(event->udev, "%i character(s) replaced\n", count); + } + break; + } + case TK_A_DEVLINK: + { + char temp[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char *pos, *next; + int count = 0; + + if (event->devlink_final) + break; + if (cur->key.op == KEY_OP_ASSIGN_FINAL) + event->devlink_final = 1; + if (cur->key.op == KEY_OP_ASSIGN || cur->key.op == KEY_OP_ASSIGN_FINAL) + udev_device_cleanup_devlinks_list(event->dev); + + /* allow multiple symlinks separated by spaces */ + util_strlcpy(temp, &rules->buf[cur->key.value_off], sizeof(temp)); + udev_event_apply_format(event, temp, sizeof(temp)); + if (esc == ESCAPE_UNSET) + count = util_replace_chars(temp, ALLOWED_CHARS_FILE " "); + else if (esc == ESCAPE_REPLACE) + count = util_replace_chars(temp, ALLOWED_CHARS_FILE); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); + pos = temp; + while (isspace(pos[0])) + pos++; + next = strchr(pos, ' '); + while (next) { + next[0] = '\0'; + info(event->udev, "add symlink '%s'\n", pos); + util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, pos, sizeof(filename)); + udev_device_add_devlink(event->dev, filename); + while (isspace(next[1])) + next++; + pos = &next[1]; + next = strchr(pos, ' '); + } + if (pos[0] != '\0') { + info(event->udev, "add symlink '%s'\n", pos); + util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, pos, sizeof(filename)); + udev_device_add_devlink(event->dev, filename); + } + } + break; + case TK_A_EVENT_TIMEOUT: + udev_device_set_event_timeout(event->dev, cur->key.event_timeout); + break; + case TK_A_IGNORE_REMOVE: + udev_device_set_ignore_remove(event->dev, 1); + break; + case TK_A_ATTR: + { + const char *key_name = &rules->buf[cur->key.attr_off]; + char attr[UTIL_PATH_SIZE]; + char value[UTIL_NAME_SIZE]; + FILE *f; + + util_strlcpy(attr, key_name, sizeof(attr)); + if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) { + util_strlcpy(attr, udev_device_get_syspath(event->dev), sizeof(attr)); + util_strlcat(attr, "/", sizeof(attr)); + util_strlcat(attr, key_name, sizeof(attr)); + } + + attr_subst_subdir(attr, sizeof(attr)); + + util_strlcpy(value, &rules->buf[cur->key.value_off], sizeof(value)); + udev_event_apply_format(event, value, sizeof(value)); + info(event->udev, "writing '%s' to sysfs file '%s'\n", value, attr); + f = fopen(attr, "w"); + if (f != NULL) { + if (!event->test) + if (fprintf(f, "%s", value) <= 0) + err(event->udev, "error writing ATTR{%s}: %m\n", attr); + fclose(f); + } else { + err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); + } + break; + } + case TK_A_RUN: + { + struct udev_list_entry *list_entry; + + if (cur->key.op == KEY_OP_ASSIGN || cur->key.op == KEY_OP_ASSIGN_FINAL) + udev_list_cleanup_entries(event->udev, &event->run_list); + list_entry = udev_list_entry_add(event->udev, &event->run_list, + &rules->buf[cur->key.value_off], NULL, 1, 0); + if (cur->key.ignore_error) + udev_list_entry_set_flag(list_entry, 1); + break; + } + case TK_A_GOTO: + cur = &rules->tokens[cur->key.rule_goto]; + continue; + case TK_A_LAST_RULE: + break; + + case TK_PARENTS_MAX: + case TK_END: + case TK_UNDEF: + err(rules->udev, "wrong type %u\n", cur->type); + goto nomatch; + } + + cur++; + continue; + nomatch: + /* fast-forward to next rule */ + idx = rule->rule.next_rule; + if (idx == 0) + break; + dbg(rules->udev, "forward to rule: %u\n", idx); + cur = &rules->tokens[idx]; + } + return 0; +} diff --git a/udev/udev.h b/udev/udev.h index 217e942c18..a00be37334 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -61,18 +61,19 @@ struct udev_event { struct udev_device *dev; struct udev_device *dev_parent; int devlink_final; - int owner_final; - int group_final; - int mode_final; - char tmp_node[UTIL_PATH_SIZE]; char program_result[UTIL_PATH_SIZE]; - int run_final; - char name[UTIL_PATH_SIZE]; + int name_final; + int name_ignore; + char tmp_node[UTIL_PATH_SIZE]; mode_t mode; - char owner[UTIL_NAME_SIZE]; - char group[UTIL_NAME_SIZE]; + int mode_final; + uid_t uid; + int owner_final; + gid_t gid; + int group_final; struct udev_list_node run_list; + int run_final; int ignore_device; int test; @@ -86,8 +87,7 @@ struct udev_event { struct udev_rules; extern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); extern void udev_rules_unref(struct udev_rules *rules); -extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event); -extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event); +extern int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event); /* udev-event.c */ extern struct udev_event *udev_event_new(struct udev_device *dev); @@ -100,7 +100,7 @@ extern int udev_event_apply_subsys_kernel(struct udev_event *event, const char * /* udev-node.c */ extern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid); -extern int udev_node_add(struct udev_device *dev, mode_t mode, const char *owner, const char *group, int test); +extern int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, int test); extern int udev_node_remove(struct udev_device *dev, int test); extern void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test); diff --git a/udev/udev.xml b/udev/udev.xml index 51e2fdc84e..c4e99f1ad5 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -184,8 +184,7 @@ - Match sysfs attribute values of the event device. Up to five - keys can be specified per rule. Trailing + Match sysfs attribute values of the event device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. Depending on the type of operator, this key is also used to set the value of a sysfs attribute. @@ -218,7 +217,7 @@ Search the devpath upwards for a device with matching sysfs attribute values. - Up to five keys can be specified per rule, but all of them + If multiple matches are specified, all of them must match on the same device. Trailing whitespace in the attribute values is ignored, if the specified match value does not contain trailing whitespace itself. @@ -227,9 +226,7 @@ - Match against the value of an environment variable. Up to five - keys can be specified per rule. Depending on the type of operator, this key is also used - to export a variable to the environment. + Match against a device property value. @@ -244,10 +241,10 @@ - Execute external program. The key is true, if the program returns - with exit code zero. The whole event environment is available to the - executed program. The program's output printed to stdout, is available in - the RESULT key. + Execute a program. The key is true, if the program returns + successfully. The device properties are made available to the + executed program in the environment. The program's output printed to + stdout, is available in the RESULT key. @@ -329,8 +326,7 @@ - Export a variable to the environment. Depending on the type of operator, - this key is also to match against an environment variable. + Set a device property value. @@ -368,7 +364,7 @@ - Import a set of variables into the event environment, + Import a set of variables as device properties, depending on type: @@ -473,7 +469,7 @@ , , and fields support simple printf-like string substitutions. The format chars gets applied after all rules have been processed, right before the program - is executed. It allows the use of the complete environment set by earlier matching + is executed. It allows the use of device properties set by earlier matching rules. For all other fields, substitutions are applied while the individual rule is being processed. The available substitutions are: @@ -532,7 +528,7 @@ , - The value of an environment variable. + A device property value. -- cgit v1.2.3-54-g00ecf From 5a05e120af1fa09d08f564e847ef48d50efa1156 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Oct 2008 01:13:52 +0200 Subject: do not create temporary node ($tempnode) if node already exists --- TODO | 1 - udev/udev-event.c | 42 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index fd9b2be563..b4a967c258 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ - o use node for tmpnode, if it already exists o add DVB variables to kernel, and drop shell script rule o DEVTYPE for disks is set by the kernel, they will be removed from the default rules diff --git a/udev/udev-event.c b/udev/udev-event.c index b41dcd070e..a41d4edb41 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -332,15 +332,41 @@ found: } break; case SUBST_TEMP_NODE: - if (event->tmp_node[0] == '\0' && major(udev_device_get_devnum(dev)) > 0) { - dbg(event->udev, "create temporary device node for callout\n"); - snprintf(event->tmp_node, sizeof(event->tmp_node), "%s/.tmp-%u-%u", - udev_get_dev_path(event->udev), - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); - udev_node_mknod(dev, event->tmp_node, makedev(0,0), 0600, 0, 0); + { + dev_t devnum; + struct stat statbuf; + char filename[UTIL_PATH_SIZE]; + const char *devtype; + + if (event->tmp_node[0] != '\0') { + util_strlcat(string, event->tmp_node, maxsize); + dbg(event->udev, "return existing temporary node\n"); + break; + } + devnum = udev_device_get_devnum(dev); + if (major(udev_device_get_devnum(dev) == 0)) + break; + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + devtype = "block"; + else + devtype = "char"; + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(event->udev), devtype, + major(udev_device_get_devnum(dev)), + minor(udev_device_get_devnum(dev))); + if (stat(filename, &statbuf) == 0 && statbuf.st_rdev == devnum) { + util_strlcat(string, filename, maxsize); + dbg(event->udev, "return existing temporary node\n"); + break; + } + dbg(event->udev, "create temporary node\n"); + snprintf(event->tmp_node, sizeof(event->tmp_node), "%s/.tmp-%s-%u:%u", + udev_get_dev_path(event->udev), devtype, + major(udev_device_get_devnum(dev)), + minor(udev_device_get_devnum(dev))); + udev_node_mknod(dev, event->tmp_node, makedev(0, 0), 0600, 0, 0); + util_strlcat(string, event->tmp_node, maxsize); } - util_strlcat(string, event->tmp_node, maxsize); - dbg(event->udev, "substitute temporary device node name '%s'\n", event->tmp_node); break; case SUBST_NAME: if (event->name != NULL) { -- cgit v1.2.3-54-g00ecf From 40fd3bc837e04538df305b512157e55a2a5e0789 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Oct 2008 02:34:22 +0200 Subject: shrink struct udev_event --- udev/udev-event.c | 22 ++++++++++++++++------ udev/udev-rules.c | 10 ++++++---- udev/udev.h | 4 ++-- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index a41d4edb41..36d36ac643 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -47,7 +47,11 @@ struct udev_event *udev_event_new(struct udev_device *dev) void udev_event_unref(struct udev_event *event) { + if (event == NULL) + return; udev_list_cleanup_entries(event->udev, &event->run_list); + free(event->tmp_node); + free(event->program_result); dbg(event->udev, "free event %p\n", event); free(event); } @@ -245,15 +249,18 @@ found: dbg(event->udev, "substitute minor number '%s'\n", temp2); break; case SUBST_RESULT: - if (event->program_result[0] == '\0') + if (event->program_result == NULL) break; /* get part part of the result string */ i = 0; if (attr != NULL) i = strtoul(attr, &rest, 10); if (i > 0) { + char result[UTIL_PATH_SIZE]; + dbg(event->udev, "request part #%d of result string\n", i); - cpos = event->program_result; + util_strlcpy(result, event->program_result, sizeof(result)); + cpos = result; while (--i) { while (cpos[0] != '\0' && !isspace(cpos[0])) cpos++; @@ -338,7 +345,7 @@ found: char filename[UTIL_PATH_SIZE]; const char *devtype; - if (event->tmp_node[0] != '\0') { + if (event->tmp_node != NULL) { util_strlcat(string, event->tmp_node, maxsize); dbg(event->udev, "return existing temporary node\n"); break; @@ -360,10 +367,12 @@ found: break; } dbg(event->udev, "create temporary node\n"); - snprintf(event->tmp_node, sizeof(event->tmp_node), "%s/.tmp-%s-%u:%u", + asprintf(&event->tmp_node, "%s/.tmp-%s-%u:%u", udev_get_dev_path(event->udev), devtype, major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + if (event->tmp_node == NULL) + break; udev_node_mknod(dev, event->tmp_node, makedev(0, 0), 0600, 0, 0); util_strlcat(string, event->tmp_node, maxsize); } @@ -537,10 +546,11 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) dbg(event->udev, "device node add '%s'\n", udev_device_get_devpath(dev)); udev_rules_apply_to_event(rules, event); - if (event->tmp_node[0] != '\0') { + if (event->tmp_node != NULL) { dbg(event->udev, "removing temporary device node\n"); util_unlink_secure(event->udev, event->tmp_node); - event->tmp_node[0] = '\0'; + free(event->tmp_node); + event->tmp_node = NULL; } if (event->ignore_device) { diff --git a/udev/udev-rules.c b/udev/udev-rules.c index b456c3da33..675a7f0625 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1783,11 +1783,12 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event char **envp; char result[UTIL_PATH_SIZE]; + free(event->program_result); + event->program_result = NULL; util_strlcpy(program, &rules->buf[cur->key.value_off], sizeof(program)); udev_event_apply_format(event, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { - event->program_result[0] = '\0'; if (cur->key.op != KEY_OP_NOMATCH) goto nomatch; } else { @@ -1799,7 +1800,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (count > 0) info(event->udev, "%i character(s) replaced\n" , count); } - util_strlcpy(event->program_result, result, sizeof(event->program_result)); + event->program_result = strdup(result); + dbg(event->udev, "storing result '%s'\n", event->program_result); if (cur->key.op == KEY_OP_NOMATCH) goto nomatch; } @@ -1884,7 +1886,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; if (cur->key.op == KEY_OP_ASSIGN_FINAL) event->group_final = 1; - util_strlcpy(group, &rules->buf[cur->key.value_off], sizeof(group)); + util_strlcpy(group, &rules->buf[cur->key.value_off], sizeof(group)); udev_event_apply_format(event, group, sizeof(group)); event->gid = util_lookup_group(event->udev, group); break; @@ -1898,7 +1900,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; if (cur->key.op == KEY_OP_ASSIGN_FINAL) event->mode_final = 1; - util_strlcpy(mode, &rules->buf[cur->key.value_off], sizeof(mode)); + util_strlcpy(mode, &rules->buf[cur->key.value_off], sizeof(mode)); udev_event_apply_format(event, mode, sizeof(mode)); event->mode = strtol(mode, &endptr, 8); if (endptr[0] != '\0') { diff --git a/udev/udev.h b/udev/udev.h index a00be37334..927ff36e01 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -61,11 +61,11 @@ struct udev_event { struct udev_device *dev; struct udev_device *dev_parent; int devlink_final; - char program_result[UTIL_PATH_SIZE]; char name[UTIL_PATH_SIZE]; int name_final; int name_ignore; - char tmp_node[UTIL_PATH_SIZE]; + char *tmp_node; + char *program_result; mode_t mode; int mode_final; uid_t uid; -- cgit v1.2.3-54-g00ecf From b99028c96307e729303be8f6750418979a7488b9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Oct 2008 02:57:08 +0200 Subject: shrink struct udev_event --- udev/lib/libudev-device.c | 28 ++++++++++++++-------------- udev/udev-event.c | 13 +++++++------ udev/udev-rules.c | 13 +++++++------ udev/udev.h | 22 ++++++++++------------ 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index f56db7ff15..8812f1fc84 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -34,36 +34,36 @@ #define ENVP_SIZE 128 struct udev_device { - int refcount; struct udev *udev; struct udev_device *parent_device; - int parent_set; char *syspath; const char *devpath; char *sysname; const char *sysnum; char *devnode; char *subsystem; - int subsystem_set; - struct udev_list_node devlinks_list; - int devlinks_uptodate; - struct udev_list_node properties_list; char **envp; - int envp_uptodate; char *driver; - int driver_set; - dev_t devnum; char *action; - int event_timeout; char *devpath_old; char *physdevpath; - int timeout; + struct udev_list_node devlinks_list; + struct udev_list_node properties_list; + struct udev_list_node sysattr_list; unsigned long long int seqnum; + int event_timeout; + int timeout; int num_fake_partitions; int devlink_priority; - int ignore_remove; - struct udev_list_node sysattr_list; - int info_loaded; + int refcount; + dev_t devnum; + unsigned int parent_set:1; + unsigned int subsystem_set:1; + unsigned int devlinks_uptodate:1; + unsigned int envp_uptodate:1; + unsigned int driver_set:1; + unsigned int info_loaded:1; + unsigned int ignore_remove:1; }; static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) diff --git a/udev/udev-event.c b/udev/udev-event.c index 36d36ac643..fcb9993709 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -52,6 +52,7 @@ void udev_event_unref(struct udev_event *event) udev_list_cleanup_entries(event->udev, &event->run_list); free(event->tmp_node); free(event->program_result); + free(event->name); dbg(event->udev, "free event %p\n", event); free(event); } @@ -558,15 +559,17 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) goto exit; } - if (event->name_ignore) { + if (event->name != NULL && event->name[0] == '\0') { info(event->udev, "device node creation supressed\n"); goto exit; } - if (event->name[0] == '\0') { + if (event->name == NULL) { info(event->udev, "no node name set, will use kernel name '%s'\n", udev_device_get_sysname(event->dev)); - util_strlcpy(event->name, udev_device_get_sysname(event->dev), sizeof(event->name)); + event->name = strdup(udev_device_get_sysname(event->dev)); + if (event->name == NULL) + goto exit; } /* set device node name */ @@ -604,10 +607,8 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) info(event->udev, "device event will be ignored\n"); goto exit; } - if (event->name[0] == '\0') { - info(event->udev, "device renaming supressed\n"); + if (event->name == NULL) goto exit; - } /* look if we want to change the name of the netif */ if (strcmp(event->name, udev_device_get_sysname(dev)) != 0) { diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 675a7f0625..19ee06d379 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1952,6 +1952,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_NAME: { const char *name = &rules->buf[cur->key.value_off]; + char name_str[UTIL_PATH_SIZE]; int count; if (event->name_final) @@ -1959,17 +1960,17 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (cur->key.op == KEY_OP_ASSIGN_FINAL) event->name_final = 1; if (name[0] == '\0') { - event->name[0] = '\0'; - event->name_ignore = 1; + free(event->name); + event->name = NULL; break; } - event->name_ignore = 0; - util_strlcpy(event->name, name, sizeof(event->name)); - udev_event_apply_format(event, event->name, sizeof(event->name)); + util_strlcpy(name_str, name, sizeof(name_str)); + udev_event_apply_format(event, name_str, sizeof(name_str)); if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = util_replace_chars(event->name, ALLOWED_CHARS_FILE); + count = util_replace_chars(name_str, ALLOWED_CHARS_FILE); if (count > 0) info(event->udev, "%i character(s) replaced\n", count); + event->name = strdup(name_str); } break; } diff --git a/udev/udev.h b/udev/udev.h index 927ff36e01..faa1bf6851 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -57,30 +57,28 @@ static inline void logging_close(void) } struct udev_event { + struct udev_list_node node; struct udev *udev; struct udev_device *dev; struct udev_device *dev_parent; - int devlink_final; - char name[UTIL_PATH_SIZE]; - int name_final; - int name_ignore; + char *name; char *tmp_node; char *program_result; mode_t mode; - int mode_final; uid_t uid; - int owner_final; gid_t gid; - int group_final; struct udev_list_node run_list; - int run_final; - int ignore_device; - int test; - - struct udev_list_node node; pid_t pid; int exitstatus; time_t queue_time; + unsigned int group_final:1; + unsigned int owner_final:1; + unsigned int mode_final:1; + unsigned int name_final:1; + unsigned int devlink_final:1; + unsigned int run_final:1; + unsigned int ignore_device:1; + unsigned int test:1; }; /* udev-rules.c */ -- cgit v1.2.3-54-g00ecf From 84629ccd85cb65c82dd9cb1c5411c55f2c0abbf0 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Thu, 23 Oct 2008 10:27:36 +0100 Subject: udevd: fix memory leak Re: b99028c96307e729303be8f6750418979a7488b9 shrink struct udev_event TEST 136: test multi matches 2 device '/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0' expecting node 'right' ==15011== ==15011== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==15011== at 0x47F9AB8: malloc (vg_replace_malloc.c:207) ==15011== by 0x489CB5F: strdup (in /lib32/libc-2.7.so) ==15011== by 0x8050F40: udev_rules_apply_to_event (udev-rules.c:1973) ==15011== by 0x804A658: udev_event_execute_rules (udev-event.c:549) ==15011== by 0x805A636: main (test-udev.c:100) add: ok ==15012== ==15012== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==15012== at 0x47F1AB8: malloc (vg_replace_malloc.c:207) ==15012== by 0x4898B5F: strdup (in /lib32/libc-2.7.so) ==15012== by 0x8050F40: udev_rules_apply_to_event (udev-rules.c:1973) ==15012== by 0x804A9DF: udev_event_execute_rules (udev-event.c:658) ==15012== by 0x805A636: main (test-udev.c:100) remove: ok Signed-off-by: Alan Jenkins --- udev/udev-rules.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 19ee06d379..55e27b7bca 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1970,6 +1970,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event count = util_replace_chars(name_str, ALLOWED_CHARS_FILE); if (count > 0) info(event->udev, "%i character(s) replaced\n", count); + free(event->name); event->name = strdup(name_str); } break; -- cgit v1.2.3-54-g00ecf From 9bdca442ef3f7d54cea9827605ec635712009735 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Oct 2008 15:44:34 +0200 Subject: rule_generator: fix netif NAME= value extraction regex $ sed -n -r \ -e 's/^#.*//' \ -e 's/[[:space:],]NAME="(eth[0-9]*)"[[:space:]]*(,.*|\\|)$/\1/p' \ /dev/null /etc/udev/rules.d/70-persistent-net.rules SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:16:41:e2:8d:c7", ATTR{type}=="1", KERNEL=="eth*",eth4 $ sed -n -r \ -e 's/^#.*//' \ -e 's/.*[[:space:],]NAME="(eth[0-9]*)".*/\1/p' \ /dev/null /etc/udev/rules.d/70-persistent-net.rules eth4 --- extras/rule_generator/rule_generator.functions | 3 +-- extras/rule_generator/write_cd_rules | 13 ++++++++++--- extras/rule_generator/write_net_rules | 12 ++++++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index aaf66a6fa0..b972091615 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -92,8 +92,7 @@ find_all_rules() { local linkre="$2" local match="$3" - local search='[[:space:],]'"$key"'"('"$linkre"')"[[:space:]]*(,.*|\\|)$' - + local search='.*[[:space:],]'"$key"'"('"$linkre"')".*' echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \ $RO_RULES_FILE \ $([ -e $RULES_FILE ] && echo $RULES_FILE) \ diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules index d74b20128d..8de227661d 100644 --- a/extras/rule_generator/write_cd_rules +++ b/extras/rule_generator/write_cd_rules @@ -11,6 +11,13 @@ # under the terms of the GNU General Public License as published by the # Free Software Foundation version 2 of the License. +# debug, if UDEV_LOG= +if [ -n "$UDEV_LOG" ]; then + if [ "$UDEV_LOG" -ge 7 ]; then + set -x + fi +fi + RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" . /lib/udev/rule_generator.functions @@ -28,10 +35,10 @@ write_rule() { if [ "$PRINT_HEADER" ]; then PRINT_HEADER= echo "# This file was automatically generated by the $0" - echo "# program, probably run by the cd-aliases-generator.rules rules file." + echo "# program, run by the cd-aliases-generator.rules rules file." echo "#" - echo "# You can modify it, as long as you keep each rule on a single line" - echo "# and set the \$GENERATED variable." + echo "# You can modify it, as long as you keep each rule on a single" + echo "# line, and set the \$GENERATED variable." echo "" fi diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index d1086f086e..cb346757cc 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -22,6 +22,13 @@ # INTERFACE_NAME requested name supplied by external tool # INTERFACE_NEW new interface name returned by rule writer +# debug, if UDEV_LOG= +if [ -n "$UDEV_LOG" ]; then + if [ "$UDEV_LOG" -ge 7 ]; then + set -x + fi +fi + RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' . /lib/udev/rule_generator.functions @@ -48,9 +55,10 @@ write_rule() { if [ "$PRINT_HEADER" ]; then PRINT_HEADER= echo "# This file was automatically generated by the $0" - echo "# program run by the persistent-net-generator.rules rules file." + echo "# program, run by the persistent-net-generator.rules rules file." echo "#" - echo "# You can modify it, as long as you keep each rule on a single line." + echo "# You can modify it, as long as you keep each rule on a single" + echo "# line, and change only the value of the NAME= key." fi echo "" -- cgit v1.2.3-54-g00ecf From 7aeeaedc5f73fa304849b8768de455ab5dae49a4 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Thu, 23 Oct 2008 19:37:30 +0100 Subject: udevd: fix WAIT_FOR_SYSFS execution order The wait should be ordered after matching KERNEL, ENV, etc. but before ATTR. Without this, WAIT_FOR_SYSFS rules will be applied unconditionally to all events. Signed-off-by: Alan Jenkins --- udev/udev-rules.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 55e27b7bca..168867b8a4 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -52,7 +52,6 @@ enum token_type { TK_UNDEF, TK_RULE, - TK_M_WAITFOR, /* val */ TK_M_ACTION, /* val */ TK_M_DEVPATH, /* val */ TK_M_KERNEL, /* val */ @@ -61,6 +60,7 @@ enum token_type { TK_M_ENV, /* val, attr */ TK_M_SUBSYSTEM, /* val */ TK_M_DRIVER, /* val */ + TK_M_WAITFOR, /* val */ TK_M_ATTR, /* val, attr */ TK_M_KERNELS, /* val */ @@ -104,7 +104,6 @@ static const char *token_str[] = { [TK_UNDEF] = "UNDEF", [TK_RULE] = "RULE", - [TK_M_WAITFOR] = "M WAITFOR", [TK_M_ACTION] = "M ACTION", [TK_M_DEVPATH] = "M DEVPATH", [TK_M_KERNEL] = "M KERNEL", @@ -113,6 +112,7 @@ static const char *token_str[] = { [TK_M_ENV] = "M ENV", [TK_M_SUBSYSTEM] = "M SUBSYSTEM", [TK_M_DRIVER] = "M DRIVER", + [TK_M_WAITFOR] = "M WAITFOR", [TK_M_ATTR] = "M ATTR", [TK_M_KERNELS] = "M KERNELS", @@ -591,12 +591,12 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, mode_t mode = 0000; switch (type) { - case TK_M_WAITFOR: case TK_M_ACTION: case TK_M_DEVPATH: case TK_M_KERNEL: case TK_M_SUBSYSTEM: case TK_M_DRIVER: + case TK_M_WAITFOR: case TK_M_DEVLINK: case TK_M_NAME: case TK_M_KERNELS: @@ -696,12 +696,12 @@ static void dump_token(struct udev_rules *rules, struct token *token) &rules->buf[token->rule.label_off]); break; } - case TK_M_WAITFOR: case TK_M_ACTION: case TK_M_DEVPATH: case TK_M_KERNEL: case TK_M_SUBSYSTEM: case TK_M_DRIVER: + case TK_M_WAITFOR: case TK_M_DEVLINK: case TK_M_NAME: case TK_M_KERNELS: @@ -1612,18 +1612,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rule = cur; esc = ESCAPE_UNSET; break; - case TK_M_WAITFOR: - { - char filename[UTIL_PATH_SIZE]; - int found; - - util_strlcpy(filename, &rules->buf[cur->key.value_off], sizeof(filename)); - udev_event_apply_format(event, filename, sizeof(filename)); - found = (wait_for_file(event->dev, filename, 10) == 0); - if (!found && (cur->key.op != KEY_OP_NOMATCH)) - goto nomatch; - break; - } case TK_M_ACTION: if (match_key(rules, cur, udev_device_get_action(event->dev)) != 0) goto nomatch; @@ -1684,6 +1672,18 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (match_key(rules, cur, udev_device_get_driver(event->dev)) != 0) goto nomatch; break; + case TK_M_WAITFOR: + { + char filename[UTIL_PATH_SIZE]; + int found; + + util_strlcpy(filename, &rules->buf[cur->key.value_off], sizeof(filename)); + udev_event_apply_format(event, filename, sizeof(filename)); + found = (wait_for_file(event->dev, filename, 10) == 0); + if (!found && (cur->key.op != KEY_OP_NOMATCH)) + goto nomatch; + break; + } case TK_M_ATTR: if (match_attr(rules, event->dev, event, cur) != 0) goto nomatch; -- cgit v1.2.3-54-g00ecf From 548459e9393c5b76db1686af2cc79156b9bf2cb9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Oct 2008 21:42:23 +0200 Subject: skip SYMLINK rules for devices without a device node --- udev/udev-rules.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 168867b8a4..22fb2c3857 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1984,6 +1984,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->devlink_final) break; + if (major(udev_device_get_devnum(event->dev)) == 0) + break; if (cur->key.op == KEY_OP_ASSIGN_FINAL) event->devlink_final = 1; if (cur->key.op == KEY_OP_ASSIGN || cur->key.op == KEY_OP_ASSIGN_FINAL) -- cgit v1.2.3-54-g00ecf From 34d6a259dc1c32f974b9d9dc6518dba12cb6a4d6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 08:07:37 +0200 Subject: rules: let empty strings added to buffer always return offset 0 --- udev/udev-rules.c | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 22fb2c3857..535ec3f141 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -205,6 +205,11 @@ static int add_string(struct udev_rules *rules, const char *str) size_t len = strlen(str)+1; int off; + /* offset 0 is always '\0' */ + if (str[0] == '\0') + return 0; + + /* grow buffer if needed */ if (rules->buf_cur + len+1 >= rules->buf_max) { char *buf; unsigned int add; @@ -212,7 +217,7 @@ static int add_string(struct udev_rules *rules, const char *str) /* double the buffer size */ add = rules->buf_max; if (add < len) - add = len; + add = len * 2; buf = realloc(rules->buf, rules->buf_max + add); if (buf == NULL) @@ -231,6 +236,7 @@ static int add_string(struct udev_rules *rules, const char *str) static int add_token(struct udev_rules *rules, struct token *token) { + /* grow buffer if needed */ if (rules->token_cur+1 >= rules->token_max) { struct token *tokens; unsigned int add; @@ -238,7 +244,7 @@ static int add_token(struct udev_rules *rules, struct token *token) /* double the buffer size */ add = rules->token_max; if (add < 1) - add = 1; + add = 2; tokens = realloc(rules->tokens, (rules->token_max + add ) * sizeof(struct token)); if (tokens == NULL) @@ -1388,15 +1394,18 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) /* init token array and string buffer */ rules->tokens = malloc(PREALLOC_TOKEN * sizeof(struct token)); - if (rules->tokens != NULL) - rules->token_max = PREALLOC_TOKEN; + if (rules->tokens == NULL) + return NULL; + rules->token_max = PREALLOC_TOKEN; rules->buf = malloc(PREALLOC_STRBUF); - if (rules->buf != NULL) - rules->buf_max = PREALLOC_STRBUF; + if (rules->buf == NULL) + return NULL; + rules->buf_max = PREALLOC_STRBUF; + /* offset 0 is always '\0' */ + rules->buf[0] = '\0'; + rules->buf_cur = 1; info(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); - /* offset 0 in the string buffer is always empty */ - add_string(rules, ""); if (udev_get_rules_path(udev) != NULL) { /* custom rules location for testing */ @@ -1593,14 +1602,15 @@ enum escape_type { int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event) { - struct token *rule; struct token *cur; + struct token *rule; if (rules->tokens == NULL) return -1; /* loop through token list, match, run actions or forward to next rule */ cur = &rules->tokens[0]; + rule = cur; while (cur != NULL && cur->type != TK_END) { enum escape_type esc = ESCAPE_UNSET; unsigned int idx; -- cgit v1.2.3-54-g00ecf From f6bb9e981aea06f1a7460868fb60f1a9ff14c504 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 09:37:37 +0200 Subject: fix uninitialized variable warnings --- extras/usb_id/usb_id.c | 2 +- udev/udevadm-settle.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 59cdd40b31..22f075b5d9 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -368,7 +368,7 @@ int main(int argc, char **argv) {} }; struct udev *udev; - struct udev_device *dev; + struct udev_device *dev = NULL; char syspath[UTIL_PATH_SIZE]; const char *devpath; static int export; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 5e5a080bc8..a274e089d4 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -41,7 +41,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) {} }; int timeout = DEFAULT_TIMEOUT; - struct udev_queue *udev_queue; + struct udev_queue *udev_queue = NULL; int loop; int rc = 0; -- cgit v1.2.3-54-g00ecf From 154a7b8428731fb90cc639439fcdb98003471298 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 10:51:04 +0200 Subject: cache uid/gid during rule parsing This cuts down the number of parsing /etc/group from ~700 to 11, with some large rule files installed. --- udev/test-udev.c | 2 +- udev/udev-rules.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++------ udev/udevadm-test.c | 2 +- 3 files changed, 139 insertions(+), 18 deletions(-) diff --git a/udev/test-udev.c b/udev/test-udev.c index 76045132bf..ff1c353e66 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) goto exit; } - rules = udev_rules_new(udev, 0); + rules = udev_rules_new(udev, 1); util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); util_strlcat(syspath, devpath, sizeof(syspath)); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 535ec3f141..b19edc5ed6 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -31,6 +31,7 @@ #define PREALLOC_TOKEN 2048 #define PREALLOC_STRBUF 32 * 1024 +/* KEY=="", KEY!="", KEY+="", KEY="", KEY:="" */ enum key_operation { KEY_OP_UNSET, KEY_OP_MATCH, @@ -48,6 +49,7 @@ static const char *operation_str[] = { [KEY_OP_ASSIGN_FINAL] = "assign-final", }; +/* tokens of a rule are sorted/handled in this order */ enum token_type { TK_UNDEF, TK_RULE, @@ -187,19 +189,39 @@ struct rule_tmp { unsigned int token_cur; }; +struct uid_gid { + unsigned int name_off; + union { + uid_t uid; + gid_t gid; + }; +}; + struct udev_rules { struct udev *udev; int resolve_names; + + /* every key in the rules file becomes a token */ struct token *tokens; unsigned int token_cur; unsigned int token_max; + + /* all key strings are copied to a single string buffer */ char *buf; size_t buf_cur; size_t buf_max; unsigned int buf_count; + + /* during rule parsing, we cache uid/gid lookup results */ + struct uid_gid *uids; + unsigned int uids_cur; + unsigned int uids_max; + struct uid_gid *gids; + unsigned int gids_cur; + unsigned int gids_max; }; -/* we could lookup and return existing strings, or tails of strings */ +/* NOTE: we could lookup and return existing strings, or tails of strings */ static int add_string(struct udev_rules *rules, const char *str) { size_t len = strlen(str)+1; @@ -216,8 +238,8 @@ static int add_string(struct udev_rules *rules, const char *str) /* double the buffer size */ add = rules->buf_max; - if (add < len) - add = len * 2; + if (add < len * 8) + add = len * 8; buf = realloc(rules->buf, rules->buf_max + add); if (buf == NULL) @@ -243,8 +265,8 @@ static int add_token(struct udev_rules *rules, struct token *token) /* double the buffer size */ add = rules->token_max; - if (add < 1) - add = 2; + if (add < 8) + add = 8; tokens = realloc(rules->tokens, (rules->token_max + add ) * sizeof(struct token)); if (tokens == NULL) @@ -258,6 +280,92 @@ static int add_token(struct udev_rules *rules, struct token *token) return 0; } +static uid_t add_uid(struct udev_rules *rules, const char *owner) +{ + unsigned int i; + uid_t uid; + unsigned int off; + + /* lookup, if we know it already */ + for (i = 0; i < rules->uids_cur; i++) { + off = rules->uids[i].name_off; + if (strcmp(&rules->buf[off], owner) == 0) { + uid = rules->uids[i].uid; + dbg(rules->udev, "return existing %u for '%s'\n", uid, owner); + return uid; + } + } + uid = util_lookup_user(rules->udev, owner); + + /* grow buffer if needed */ + if (rules->uids_cur+1 >= rules->uids_max) { + struct uid_gid *uids; + unsigned int add; + + /* double the buffer size */ + add = rules->uids_max; + if (add < 1) + add = 8; + + uids = realloc(rules->uids, (rules->uids_max + add ) * sizeof(struct uid_gid)); + if (uids == NULL) + return uid; + info(rules->udev, "extend uids from %u to %u\n", rules->uids_max, rules->uids_max + add); + rules->uids = uids; + rules->uids_max += add; + } + rules->uids[rules->uids_cur].uid = uid; + off = add_string(rules, owner); + if (off <= 0) + return uid; + rules->uids[rules->uids_cur].name_off = off; + rules->uids_cur++; + return uid; +} + +static gid_t add_gid(struct udev_rules *rules, const char *group) +{ + unsigned int i; + gid_t gid; + unsigned int off; + + /* lookup, if we know it already */ + for (i = 0; i < rules->gids_cur; i++) { + off = rules->gids[i].name_off; + if (strcmp(&rules->buf[off], group) == 0) { + gid = rules->gids[i].gid; + info(rules->udev, "return existing %u for '%s'\n", gid, group); + return gid; + } + } + gid = util_lookup_group(rules->udev, group); + + /* grow buffer if needed */ + if (rules->gids_cur+1 >= rules->gids_max) { + struct uid_gid *gids; + unsigned int add; + + /* double the buffer size */ + add = rules->gids_max; + if (add < 1) + add = 8; + + gids = realloc(rules->gids, (rules->gids_max + add ) * sizeof(struct uid_gid)); + if (gids == NULL) + return gid; + info(rules->udev, "extend gids from %u to %u\n", rules->gids_max, rules->gids_max + add); + rules->gids = gids; + rules->gids_max += add; + } + rules->gids[rules->gids_cur].gid = gid; + off = add_string(rules, group); + if (off <= 0) + return gid; + rules->gids[rules->gids_cur].name_off = off; + rules->gids_cur++; + return gid; +} + static int import_property_from_string(struct udev_device *dev, char *line) { struct udev *udev = udev_device_get_udev(dev); @@ -1148,7 +1256,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (endptr[0] == '\0') { rule_add_token(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); } else if (rules->resolve_names && strchr("$%", value[0]) == NULL) { - uid = util_lookup_user(rules->udev, value); + uid = add_uid(rules, value); rule_add_token(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); } else { rule_add_token(&rule_tmp, TK_A_OWNER, op, value, NULL); @@ -1165,7 +1273,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (endptr[0] == '\0') { rule_add_token(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); } else if (rules->resolve_names && strchr("$%", value[0]) == NULL) { - gid = util_lookup_group(rules->udev, value); + gid = add_gid(rules, value); rule_add_token(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); } else { rule_add_token(&rule_tmp, TK_A_GROUP, op, value, NULL); @@ -1476,7 +1584,16 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) end_token.type = TK_END; add_token(rules, &end_token); - /* shrink allocate buffers */ + /* link all TK_RULE tokens to be able to fast-forward to next TK_RULE */ + prev_rule = 0; + for (i = 1; i < rules->token_cur; i++) { + if (rules->tokens[i].type == TK_RULE) { + rules->tokens[prev_rule].rule.next_rule = i; + prev_rule = i; + } + } + + /* shrink allocated token and string buffer */ if (rules->token_cur < rules->token_max) { struct token *tokens; @@ -1498,14 +1615,16 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) info(udev, "shrunk to %lu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); - /* link all TK_RULE tokens to be able to fast-forward to next TK_RULE */ - prev_rule = 0; - for (i = 1; i < rules->token_cur; i++) { - if (rules->tokens[i].type == TK_RULE) { - rules->tokens[prev_rule].rule.next_rule = i; - prev_rule = i; - } - } + /* cleanup uid/gid cache */ + free(rules->uids); + rules->uids = NULL; + rules->uids_cur = 0; + rules->uids_max = 0; + free(rules->gids); + rules->gids = NULL; + rules->gids_cur = 0; + rules->gids_max = 0; + dump_rules(rules); return rules; } @@ -1516,6 +1635,8 @@ void udev_rules_unref(struct udev_rules *rules) return; free(rules->tokens); free(rules->buf); + free(rules->uids); + free(rules->gids); free(rules); } diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index ceeead0c8a..2c8e0bff98 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -89,7 +89,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) "some values may be different, or not available at a simulation run.\n" "\n"); - rules = udev_rules_new(udev, 0); + rules = udev_rules_new(udev, 1); if (rules == NULL) { fprintf(stderr, "error reading rules\n"); rc = 1; -- cgit v1.2.3-54-g00ecf From b0f7409f2416a95cf38bfc19410bd8466778194b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 11:38:05 +0200 Subject: distinguish "match" from "assign" by (op < OP_MATCH_MAX) --- udev/udev-rules.c | 143 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 74 insertions(+), 69 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index b19edc5ed6..7a0d8a593d 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -32,21 +32,26 @@ #define PREALLOC_STRBUF 32 * 1024 /* KEY=="", KEY!="", KEY+="", KEY="", KEY:="" */ -enum key_operation { - KEY_OP_UNSET, - KEY_OP_MATCH, - KEY_OP_NOMATCH, - KEY_OP_ADD, - KEY_OP_ASSIGN, - KEY_OP_ASSIGN_FINAL, +enum operation_type { + OP_UNSET, + + OP_MATCH, + OP_NOMATCH, + OP_MATCH_MAX, + + OP_ADD, + OP_ASSIGN, + OP_ASSIGN_FINAL, }; static const char *operation_str[] = { - [KEY_OP_MATCH] = "match", - [KEY_OP_NOMATCH] = "nomatch", - [KEY_OP_ADD] = "add", - [KEY_OP_ASSIGN] = "assign", - [KEY_OP_ASSIGN_FINAL] = "assign-final", + [OP_MATCH] = "match", + [OP_NOMATCH] = "nomatch", + [OP_MATCH_MAX] = "match-max", + + [OP_ADD] = "add", + [OP_ASSIGN] = "assign", + [OP_ASSIGN_FINAL] = "assign-final", }; /* tokens of a rule are sorted/handled in this order */ @@ -69,7 +74,7 @@ enum token_type { TK_M_SUBSYSTEMS, /* val */ TK_M_DRIVERS, /* val */ TK_M_ATTRS, /* val, attr */ - TK_PARENTS_MAX, + TK_M_PARENTS_MAX, TK_M_TEST, /* val, mode_t */ TK_M_PROGRAM, /* val */ @@ -121,7 +126,7 @@ static const char *token_str[] = { [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", [TK_M_DRIVERS] = "M DRIVERS", [TK_M_ATTRS] = "M ATTRS", - [TK_PARENTS_MAX] = "PARENTS_MAX", + [TK_M_PARENTS_MAX] = "M PARENTS_MAX", [TK_M_TEST] = "M TEST", [TK_M_PROGRAM] = "M PROGRAM", @@ -163,7 +168,7 @@ struct token { unsigned int filename_off; } rule; struct { - enum key_operation op; + enum operation_type op; unsigned int value_off; union { unsigned int attr_off; @@ -588,7 +593,7 @@ static int attr_subst_subdir(char *attr, size_t len) return found; } -static int get_key(struct udev *udev, char **line, char **key, enum key_operation *op, char **value) +static int get_key(struct udev *udev, char **line, char **key, enum operation_type *op, char **value) { char *linepos; char *temp; @@ -630,19 +635,19 @@ static int get_key(struct udev *udev, char **line, char **key, enum key_operatio /* get operation type */ if (linepos[0] == '=' && linepos[1] == '=') { - *op = KEY_OP_MATCH; + *op = OP_MATCH; linepos += 2; } else if (linepos[0] == '!' && linepos[1] == '=') { - *op = KEY_OP_NOMATCH; + *op = OP_NOMATCH; linepos += 2; } else if (linepos[0] == '+' && linepos[1] == '=') { - *op = KEY_OP_ADD; + *op = OP_ADD; linepos += 2; } else if (linepos[0] == '=') { - *op = KEY_OP_ASSIGN; + *op = OP_ASSIGN; linepos++; } else if (linepos[0] == ':' && linepos[1] == '=') { - *op = KEY_OP_ASSIGN_FINAL; + *op = OP_ASSIGN_FINAL; linepos += 2; } else return -1; @@ -697,7 +702,7 @@ static char *get_key_attribute(struct udev *udev, char *str) } static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, - enum key_operation op, + enum operation_type op, const char *value, const void *data) { struct token *token = &rule_tmp->token[rule_tmp->token_cur]; @@ -772,7 +777,7 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, token->key.event_timeout = *(int *)data; break; case TK_RULE: - case TK_PARENTS_MAX: + case TK_M_PARENTS_MAX: case TK_END: case TK_UNDEF: err(rule_tmp->rules->udev, "wrong type %u\n", type); @@ -792,7 +797,7 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, static void dump_token(struct udev_rules *rules, struct token *token) { enum token_type type = token->type; - enum key_operation op = token->key.op; + enum operation_type op = token->key.op; const char *value = &rules->buf[token->key.value_off]; const char *attr = &rules->buf[token->key.attr_off]; @@ -875,7 +880,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_END: dbg(rules->udev, "* %s\n", token_str[type]); break; - case TK_PARENTS_MAX: + case TK_M_PARENTS_MAX: case TK_UNDEF: dbg(rules->udev, "unknown type %u\n", type); break; @@ -952,13 +957,13 @@ static int add_rule(struct udev_rules *rules, char *line, while (1) { char *key; char *value; - enum key_operation op = KEY_OP_UNSET; + enum operation_type op = OP_UNSET; if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) break; if (strcasecmp(key, "ACTION") == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid ACTION operation\n"); goto invalid; } @@ -968,7 +973,7 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcasecmp(key, "DEVPATH") == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid DEVPATH operation\n"); goto invalid; } @@ -978,7 +983,7 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcasecmp(key, "KERNEL") == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid KERNEL operation\n"); goto invalid; } @@ -988,7 +993,7 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcasecmp(key, "SUBSYSTEM") == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid SUBSYSTEM operation\n"); goto invalid; } @@ -1007,7 +1012,7 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcasecmp(key, "DRIVER") == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid DRIVER operation\n"); goto invalid; } @@ -1022,7 +1027,7 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "error parsing ATTR attribute\n"); goto invalid; } - if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + if (op < OP_MATCH_MAX) { rule_add_token(&rule_tmp, TK_M_ATTR, op, value, attr); } else { rule_add_token(&rule_tmp, TK_A_ATTR, op, value, attr); @@ -1033,7 +1038,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcasecmp(key, "KERNELS") == 0 || strcasecmp(key, "ID") == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid KERNELS operation\n"); goto invalid; } @@ -1044,7 +1049,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcasecmp(key, "SUBSYSTEMS") == 0 || strcasecmp(key, "BUS") == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid SUBSYSTEMS operation\n"); goto invalid; } @@ -1054,7 +1059,7 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcasecmp(key, "DRIVERS") == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid DRIVERS operation\n"); goto invalid; } @@ -1065,7 +1070,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid ATTRS operation\n"); goto invalid; } @@ -1093,7 +1098,7 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strncmp(attr, "PHYSDEV", 7) == 0) physdev = 1; - if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + if (op < OP_MATCH_MAX) { if (rule_add_token(&rule_tmp, TK_M_ENV, op, value, attr) != 0) goto invalid; } else { @@ -1111,7 +1116,7 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcasecmp(key, "RESULT") == 0) { - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid RESULT operation\n"); goto invalid; } @@ -1171,7 +1176,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { mode_t mode = 0; - if (op != KEY_OP_MATCH && op != KEY_OP_NOMATCH) { + if (op > OP_MATCH_MAX) { err(rules->udev, "invalid TEST operation\n"); goto invalid; } @@ -1216,7 +1221,7 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { - if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) { + if (op < OP_MATCH_MAX) { rule_add_token(&rule_tmp, TK_M_NAME, op, value, NULL); } else { if (value[0] == '\0') @@ -1240,13 +1245,13 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcasecmp(key, "SYMLINK") == 0) { - if (op == KEY_OP_MATCH || op == KEY_OP_NOMATCH) - rule_add_token(&rule_tmp, TK_M_DEVLINK, op, value, NULL); - else - rule_add_token(&rule_tmp, TK_A_DEVLINK, op, value, NULL); - valid = 1; - continue; - } + if (op < OP_MATCH_MAX) + rule_add_token(&rule_tmp, TK_M_DEVLINK, op, value, NULL); + else + rule_add_token(&rule_tmp, TK_A_DEVLINK, op, value, NULL); + valid = 1; + continue; + } if (strcasecmp(key, "OWNER") == 0) { uid_t uid; @@ -1672,11 +1677,11 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * match = (fnmatch(key_value, val, 0) == 0); } - if (match && (token->key.op == KEY_OP_MATCH)) { + if (match && (token->key.op == OP_MATCH)) { dbg(rules->udev, "%s is true (matching value)\n", key_name); return 0; } - if (!match && (token->key.op == KEY_OP_NOMATCH)) { + if (!match && (token->key.op == OP_NOMATCH)) { dbg(rules->udev, "%s is true (non-matching value)\n", key_name); return 0; } @@ -1811,7 +1816,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(filename, &rules->buf[cur->key.value_off], sizeof(filename)); udev_event_apply_format(event, filename, sizeof(filename)); found = (wait_for_file(event->dev, filename, 10) == 0); - if (!found && (cur->key.op != KEY_OP_NOMATCH)) + if (!found && (cur->key.op != OP_NOMATCH)) goto nomatch; break; } @@ -1828,7 +1833,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* get whole sequence of parent matches */ next = cur; - while (next->type < TK_PARENTS_MAX) + while (next->type < TK_M_PARENTS_MAX) next++; /* loop over parents */ @@ -1902,9 +1907,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event info(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, match ? "matches" : "does not match", cur->key.mode); } - if (match && cur->key.op == KEY_OP_NOMATCH) + if (match && cur->key.op == OP_NOMATCH) goto nomatch; - if (!match && cur->key.op == KEY_OP_MATCH) + if (!match && cur->key.op == OP_MATCH) goto nomatch; break; } @@ -1920,7 +1925,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event udev_event_apply_format(event, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { - if (cur->key.op != KEY_OP_NOMATCH) + if (cur->key.op != OP_NOMATCH) goto nomatch; } else { int count; @@ -1933,7 +1938,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event } event->program_result = strdup(result); dbg(event->udev, "storing result '%s'\n", event->program_result); - if (cur->key.op == KEY_OP_NOMATCH) + if (cur->key.op == OP_NOMATCH) goto nomatch; } break; @@ -1945,7 +1950,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); udev_event_apply_format(event, import, sizeof(import)); if (import_file_into_properties(event->dev, import) != 0) - if (cur->key.op != KEY_OP_NOMATCH) + if (cur->key.op != OP_NOMATCH) goto nomatch; break; } @@ -1956,7 +1961,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); udev_event_apply_format(event, import, sizeof(import)); if (import_program_into_properties(event->dev, import) != 0) - if (cur->key.op != KEY_OP_NOMATCH) + if (cur->key.op != OP_NOMATCH) goto nomatch; break; } @@ -1967,7 +1972,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); udev_event_apply_format(event, import, sizeof(import)); if (import_parent_into_properties(event->dev, import) != 0) - if (cur->key.op != KEY_OP_NOMATCH) + if (cur->key.op != OP_NOMATCH) goto nomatch; break; } @@ -2002,7 +2007,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->owner_final) break; - if (cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN_FINAL) event->owner_final = 1; util_strlcpy(owner, &rules->buf[cur->key.value_off], sizeof(owner)); udev_event_apply_format(event, owner, sizeof(owner)); @@ -2015,7 +2020,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->group_final) break; - if (cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN_FINAL) event->group_final = 1; util_strlcpy(group, &rules->buf[cur->key.value_off], sizeof(group)); udev_event_apply_format(event, group, sizeof(group)); @@ -2029,7 +2034,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->mode_final) break; - if (cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN_FINAL) event->mode_final = 1; util_strlcpy(mode, &rules->buf[cur->key.value_off], sizeof(mode)); udev_event_apply_format(event, mode, sizeof(mode)); @@ -2043,21 +2048,21 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_OWNER_ID: if (event->owner_final) break; - if (cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN_FINAL) event->owner_final = 1; event->uid = cur->key.uid; break; case TK_A_GROUP_ID: if (event->group_final) break; - if (cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN_FINAL) event->group_final = 1; event->gid = cur->key.gid; break; case TK_A_MODE_ID: if (event->mode_final) break; - if (cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN_FINAL) event->mode_final = 1; event->mode = cur->key.mode; break; @@ -2088,7 +2093,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->name_final) break; - if (cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN_FINAL) event->name_final = 1; if (name[0] == '\0') { free(event->name); @@ -2117,9 +2122,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; if (major(udev_device_get_devnum(event->dev)) == 0) break; - if (cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN_FINAL) event->devlink_final = 1; - if (cur->key.op == KEY_OP_ASSIGN || cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) udev_device_cleanup_devlinks_list(event->dev); /* allow multiple symlinks separated by spaces */ @@ -2197,7 +2202,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event { struct udev_list_entry *list_entry; - if (cur->key.op == KEY_OP_ASSIGN || cur->key.op == KEY_OP_ASSIGN_FINAL) + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) udev_list_cleanup_entries(event->udev, &event->run_list); list_entry = udev_list_entry_add(event->udev, &event->run_list, &rules->buf[cur->key.value_off], NULL, 1, 0); @@ -2211,7 +2216,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_LAST_RULE: break; - case TK_PARENTS_MAX: + case TK_M_PARENTS_MAX: case TK_END: case TK_UNDEF: err(rules->udev, "wrong type %u\n", cur->type); -- cgit v1.2.3-54-g00ecf From ac218d9cc8344755654f6be34f8c60863fe2fb33 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 13:32:32 +0200 Subject: determine at rule parse time if we need to call fnmatch() This cuts down the large rule set's 120.000 calls to fnmatch() to 51.000, and we can just call strcmp for the simple matches. --- udev/udev-rules.c | 161 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 123 insertions(+), 38 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 7a0d8a593d..2746bd551e 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -45,18 +45,37 @@ enum operation_type { }; static const char *operation_str[] = { + [OP_UNSET] = "UNSET", [OP_MATCH] = "match", [OP_NOMATCH] = "nomatch", - [OP_MATCH_MAX] = "match-max", + [OP_MATCH_MAX] = "MATCH_MAX", [OP_ADD] = "add", [OP_ASSIGN] = "assign", [OP_ASSIGN_FINAL] = "assign-final", }; +enum string_glob_type { + GL_UNSET, + GL_PLAIN, + GL_GLOB, + GL_SPLIT, + GL_SPLIT_GLOB, + GL_FORMAT, +}; + +static const char *string_glob_str[] = { + [GL_UNSET] = "UNSET", + [GL_PLAIN] = "plain", + [GL_GLOB] = "glob", + [GL_SPLIT] = "split", + [GL_SPLIT_GLOB] = "split-glob", + [GL_FORMAT] = "format", +}; + /* tokens of a rule are sorted/handled in this order */ enum token_type { - TK_UNDEF, + TK_UNSET, TK_RULE, TK_M_ACTION, /* val */ @@ -82,6 +101,7 @@ enum token_type { TK_M_IMPORT_PROG, /* val */ TK_M_IMPORT_PARENT, /* val */ TK_M_RESULT, /* val */ + TK_M_MAX, TK_A_IGNORE_DEVICE, TK_A_STRING_ESCAPE_NONE, @@ -108,7 +128,7 @@ enum token_type { }; static const char *token_str[] = { - [TK_UNDEF] = "UNDEF", + [TK_UNSET] = "UNSET", [TK_RULE] = "RULE", [TK_M_ACTION] = "M ACTION", @@ -134,6 +154,7 @@ static const char *token_str[] = { [TK_M_IMPORT_PROG] = "M IMPORT_PROG", [TK_M_IMPORT_PARENT] = "M MPORT_PARENT", [TK_M_RESULT] = "M RESULT", + [TK_M_MAX] = "M MAX", [TK_A_IGNORE_DEVICE] = "A IGNORE_DEVICE", [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", @@ -168,7 +189,8 @@ struct token { unsigned int filename_off; } rule; struct { - enum operation_type op; + unsigned short op; + unsigned short glob; unsigned int value_off; union { unsigned int attr_off; @@ -339,7 +361,7 @@ static gid_t add_gid(struct udev_rules *rules, const char *group) off = rules->gids[i].name_off; if (strcmp(&rules->buf[off], group) == 0) { gid = rules->gids[i].gid; - info(rules->udev, "return existing %u for '%s'\n", gid, group); + dbg(rules->udev, "return existing %u for '%s'\n", gid, group); return gid; } } @@ -661,13 +683,14 @@ static int get_key(struct udev *udev, char **line, char **key, enum operation_ty if (linepos[0] == '\0') return -1; - /* get the value*/ + /* get the value */ if (linepos[0] == '"') linepos++; else return -1; *value = linepos; + /* terminate */ temp = strchr(linepos, '"'); if (!temp) return -1; @@ -707,7 +730,9 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, { struct token *token = &rule_tmp->token[rule_tmp->token_cur]; const char *attr = data; - mode_t mode = 0000; + enum string_glob_type glob; + + memset(token, 0x00, sizeof(struct token)); switch (type) { case TK_M_ACTION: @@ -743,10 +768,9 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, token->key.attr_off = add_string(rule_tmp->rules, attr); break; case TK_M_TEST: - if (data != NULL) - mode = *(mode_t *)data; token->key.value_off = add_string(rule_tmp->rules, value); - token->key.mode = mode; + if (data != NULL) + token->key.mode = *(mode_t *)data; break; case TK_A_IGNORE_DEVICE: case TK_A_STRING_ESCAPE_NONE: @@ -778,13 +802,39 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, break; case TK_RULE: case TK_M_PARENTS_MAX: + case TK_M_MAX: case TK_END: - case TK_UNDEF: + case TK_UNSET: err(rule_tmp->rules->udev, "wrong type %u\n", type); return -1; } + + glob = GL_PLAIN; + if (value != NULL) { + if (type < TK_M_MAX) { + /* check if we need to split or call fnmatch() while matching rules */ + int has_split = 0; + int has_glob = 0; + + has_split = (strchr(value, '|') != NULL); + has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || + strchr(value, '[') != NULL || strchr(value, ']') != NULL); + if (has_split && has_glob) + glob = GL_SPLIT_GLOB; + else if (has_split) + glob = GL_SPLIT; + else if (has_glob) + glob = GL_GLOB; + } else { + /* check if we need to substitute format strings for matching rules */ + if (strchr(value, '%') != NULL || strchr(value, '$') != NULL) + glob = GL_FORMAT; + } + } + token->type = type; token->key.op = op; + token->key.glob = glob; rule_tmp->token_cur++; if (rule_tmp->token_cur >= ARRAY_SIZE(rule_tmp->token)) { err(rule_tmp->rules->udev, "temporary rule array too small\n"); @@ -798,6 +848,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) { enum token_type type = token->type; enum operation_type op = token->key.op; + enum string_glob_type glob = token->key.glob; const char *value = &rules->buf[token->key.value_off]; const char *attr = &rules->buf[token->key.attr_off]; @@ -837,14 +888,16 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_GROUP: case TK_A_MODE: case TK_A_RUN: - dbg(rules->udev, "%s %s '%s'\n", token_str[type], operation_str[op], value); + dbg(rules->udev, "%s %s '%s'(%s)\n", + token_str[type], operation_str[op], value, string_glob_str[glob]); break; case TK_M_ATTR: case TK_M_ATTRS: case TK_M_ENV: case TK_A_ATTR: case TK_A_ENV: - dbg(rules->udev, "%s %s '%s' '%s'\n", token_str[type], operation_str[op], attr, value); + dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", + token_str[type], operation_str[op], attr, value, string_glob_str[glob]); break; case TK_A_IGNORE_DEVICE: case TK_A_STRING_ESCAPE_NONE: @@ -854,7 +907,8 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "%s\n", token_str[type]); break; case TK_M_TEST: - dbg(rules->udev, "%s %s '%s' %#o\n", token_str[type], operation_str[op], value, token->key.mode); + dbg(rules->udev, "%s %s '%s'(%s) %#o\n", + token_str[type], operation_str[op], value, string_glob_str[glob], token->key.mode); break; case TK_A_NUM_FAKE_PART: dbg(rules->udev, "%s %u\n", token_str[type], token->key.num_fake_part); @@ -881,7 +935,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "* %s\n", token_str[type]); break; case TK_M_PARENTS_MAX: - case TK_UNDEF: + case TK_UNSET: dbg(rules->udev, "unknown type %u\n", type); break; } @@ -911,15 +965,15 @@ static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) unsigned int end = rule_tmp->token_cur; for (i = 0; i < rule_tmp->token_cur; i++) { - enum token_type next_val = TK_UNDEF; + enum token_type next_val = TK_UNSET; unsigned int next_idx; unsigned int j; /* find smallest value */ for (j = start; j < end; j++) { - if (rule_tmp->token[j].type == TK_UNDEF) + if (rule_tmp->token[j].type == TK_UNSET) continue; - if (next_val == TK_UNDEF || rule_tmp->token[j].type < next_val) { + if (next_val == TK_UNSET || rule_tmp->token[j].type < next_val) { next_val = rule_tmp->token[j].type; next_idx = j; } @@ -928,7 +982,7 @@ static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) /* add token and mark done */ if (add_token(rules, &rule_tmp->token[next_idx]) != 0) return -1; - rule_tmp->token[next_idx].type = TK_UNDEF; + rule_tmp->token[next_idx].type = TK_UNSET; /* shrink range */ if (next_idx == start) @@ -957,7 +1011,7 @@ static int add_rule(struct udev_rules *rules, char *line, while (1) { char *key; char *value; - enum operation_type op = OP_UNSET; + enum operation_type op; if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) break; @@ -1655,26 +1709,56 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * if (val == NULL) val = ""; - /* look for a matching string, parts are separated by '|' */ - if (strchr(key_value, '|') != NULL) { - char value[UTIL_PATH_SIZE]; + switch (token->key.glob) { + case GL_PLAIN: + match = (strcmp(key_value, val) == 0); + break; + case GL_GLOB: + match = (fnmatch(key_value, val, 0) == 0); + break; + case GL_SPLIT: + { + char value[UTIL_PATH_SIZE]; - util_strlcpy(value, &rules->buf[token->key.value_off], sizeof(value)); - key_value = value; - while (key_value != NULL) { - pos = strchr(key_value, '|'); - if (pos != NULL) { - pos[0] = '\0'; - pos = &pos[1]; + util_strlcpy(value, &rules->buf[token->key.value_off], sizeof(value)); + key_value = value; + while (key_value != NULL) { + pos = strchr(key_value, '|'); + if (pos != NULL) { + pos[0] = '\0'; + pos = &pos[1]; + } + dbg(rules->udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); + match = (strcmp(key_value, val) == 0); + if (match) + break; + key_value = pos; } - dbg(rules->udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); - match = (fnmatch(key_value, val, 0) == 0); - if (match) - break; - key_value = pos; + break; } - } else { - match = (fnmatch(key_value, val, 0) == 0); + case GL_SPLIT_GLOB: + { + char value[UTIL_PATH_SIZE]; + + util_strlcpy(value, &rules->buf[token->key.value_off], sizeof(value)); + key_value = value; + while (key_value != NULL) { + pos = strchr(key_value, '|'); + if (pos != NULL) { + pos[0] = '\0'; + pos = &pos[1]; + } + dbg(rules->udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); + match = (fnmatch(key_value, val, 0) == 0); + if (match) + break; + key_value = pos; + } + break; + } + case GL_FORMAT: + case GL_UNSET: + return -1; } if (match && (token->key.op == OP_MATCH)) { @@ -2217,8 +2301,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; case TK_M_PARENTS_MAX: + case TK_M_MAX: case TK_END: - case TK_UNDEF: + case TK_UNSET: err(rules->udev, "wrong type %u\n", cur->type); goto nomatch; } -- cgit v1.2.3-54-g00ecf From db463fd3091ac9077c32ed9530b061a92d62b126 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 14:19:42 +0200 Subject: special-case "?*" match to skip fnmatch() --- udev/udev-rules.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 2746bd551e..5a2ae1af82 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -57,10 +57,11 @@ static const char *operation_str[] = { enum string_glob_type { GL_UNSET, - GL_PLAIN, - GL_GLOB, - GL_SPLIT, - GL_SPLIT_GLOB, + GL_PLAIN, /* no special chars */ + GL_GLOB, /* shell globs ?,*,[] */ + GL_SPLIT, /* multi-value A|B */ + GL_SPLIT_GLOB, /* multi-value with glob A*|B* */ + GL_SOMETHING, /* commonly used "?*" */ GL_FORMAT, }; @@ -70,6 +71,7 @@ static const char *string_glob_str[] = { [GL_GLOB] = "glob", [GL_SPLIT] = "split", [GL_SPLIT_GLOB] = "split-glob", + [GL_SOMETHING] = "split-glob", [GL_FORMAT] = "format", }; @@ -813,18 +815,22 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, if (value != NULL) { if (type < TK_M_MAX) { /* check if we need to split or call fnmatch() while matching rules */ - int has_split = 0; - int has_glob = 0; + int has_split; + int has_glob; has_split = (strchr(value, '|') != NULL); has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || strchr(value, '[') != NULL || strchr(value, ']') != NULL); - if (has_split && has_glob) + if (has_split && has_glob) { glob = GL_SPLIT_GLOB; - else if (has_split) + } else if (has_split) { glob = GL_SPLIT; - else if (has_glob) - glob = GL_GLOB; + } else if (has_glob) { + if (strcmp(value, "?*") == 0) + glob = GL_SOMETHING; + else + glob = GL_GLOB; + } } else { /* check if we need to substitute format strings for matching rules */ if (strchr(value, '%') != NULL || strchr(value, '$') != NULL) @@ -1756,6 +1762,9 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * } break; } + case GL_SOMETHING: + match = (val[0] != '\0'); + break; case GL_FORMAT: case GL_UNSET: return -1; -- cgit v1.2.3-54-g00ecf From 3c67f7d2dfd1f6955552b9133107a5eb5bce824b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 15:09:43 +0200 Subject: libudev: monitor - replace far too expensive snprintf() with strlcpy() --- udev/lib/libudev-monitor.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 7f7f8460c2..9f13917042 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -384,19 +384,37 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi struct udev_list_entry *list_entry; char buf[4096]; size_t bufpos; + size_t len; ssize_t count; action = udev_device_get_action(udev_device); if (action == NULL) return -EINVAL; - bufpos = snprintf(buf, sizeof(buf), "%s@%s", action, udev_device_get_devpath(udev_device)); - bufpos++; + + bufpos = util_strlcpy(buf, action, sizeof(buf)); + len = util_strlcpy(&buf[bufpos], "@", sizeof(buf)-bufpos); + if (len >= sizeof(buf)-bufpos) + return -1; + bufpos += len; + len = util_strlcpy(&buf[bufpos], udev_device_get_devpath(udev_device), sizeof(buf)-bufpos); + if (len+1 >= sizeof(buf)-bufpos) + return -1; + bufpos += len+1; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - bufpos += snprintf(&buf[bufpos], sizeof(buf) - bufpos, "%s=%s", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - bufpos++; + len = util_strlcpy(&buf[bufpos], udev_list_entry_get_name(list_entry), sizeof(buf)-bufpos); + if (len >= sizeof(buf)-bufpos) + return -1; + bufpos += len; + len = util_strlcpy(&buf[bufpos], "=", sizeof(buf)-bufpos); + if (len >= sizeof(buf)-bufpos) + return -1; + bufpos += len; + len = util_strlcpy(&buf[bufpos], udev_list_entry_get_value(list_entry), sizeof(buf)-bufpos); + if (len+1 >= sizeof(buf)-bufpos) + return -1; + bufpos += len+1; } + count = sendto(udev_monitor->sock, &buf, bufpos, 0, (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); -- cgit v1.2.3-54-g00ecf From c2654402790de8ba3e9f413ab1da0b18dd262317 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 16:36:27 +0200 Subject: libudev: monitor - cache result of monitor send buffer --- udev/lib/libudev-device.c | 64 ++++++++++++++++++++++++++++++++++++++++++++-- udev/lib/libudev-monitor.c | 38 ++++----------------------- udev/lib/libudev-private.h | 1 + 3 files changed, 68 insertions(+), 35 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 8812f1fc84..dc198f0a0a 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -47,6 +47,8 @@ struct udev_device { char *action; char *devpath_old; char *physdevpath; + char *monitor_buf; + size_t monitor_buf_len; struct udev_list_node devlinks_list; struct udev_list_node properties_list; struct udev_list_node sysattr_list; @@ -617,6 +619,7 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->envp[i]); free(udev_device->envp); } + free(udev_device->monitor_buf); info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } @@ -983,6 +986,7 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { + udev_device->monitor_buf_len = 0; udev_device->envp_uptodate = 0; if (value == NULL) { struct udev_list_entry *list_entry; @@ -1018,11 +1022,12 @@ char **udev_device_get_properties_envp(struct udev_device *udev_device) unsigned int i; struct udev_list_entry *list_entry; - if (udev_device->envp) { + if (udev_device->envp != NULL) { for (i = 0; i < ENVP_SIZE && udev_device->envp[i] != NULL; i++) free(udev_device->envp[i]); - } else + } else { udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); + } i = 0; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { @@ -1039,6 +1044,61 @@ char **udev_device_get_properties_envp(struct udev_device *udev_device) return udev_device->envp; } +#define MONITOR_BUF_SIZE 4096 +ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf) +{ + if (udev_device->monitor_buf_len == 0) { + const char *action; + struct udev_list_entry *list_entry; + size_t bufpos; + size_t len; + + free(udev_device->monitor_buf); + udev_device->monitor_buf = malloc(MONITOR_BUF_SIZE); + if (udev_device->monitor_buf == NULL) + return -ENOMEM; + + /* header @ */ + action = udev_device_get_action(udev_device); + if (action == NULL) + return -EINVAL; + bufpos = util_strlcpy(udev_device->monitor_buf, action, MONITOR_BUF_SIZE); + len = util_strlcpy(&udev_device->monitor_buf[bufpos], "@", MONITOR_BUF_SIZE-bufpos); + if (len >= MONITOR_BUF_SIZE-bufpos) + return -EINVAL; + bufpos += len; + len = util_strlcpy(&udev_device->monitor_buf[bufpos], + udev_device_get_devpath(udev_device), + MONITOR_BUF_SIZE-bufpos); + if (len+1 >= MONITOR_BUF_SIZE-bufpos) + return -EINVAL; + bufpos += len+1; + + /* property strings */ + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + len = util_strlcpy(&udev_device->monitor_buf[bufpos], + udev_list_entry_get_name(list_entry), MONITOR_BUF_SIZE-bufpos); + if (len >= MONITOR_BUF_SIZE-bufpos) + return -EINVAL; + bufpos += len; + len = util_strlcpy(&udev_device->monitor_buf[bufpos], "=", MONITOR_BUF_SIZE-bufpos); + if (len >= MONITOR_BUF_SIZE-bufpos) + return -EINVAL; + bufpos += len; + len = util_strlcpy(&udev_device->monitor_buf[bufpos], udev_list_entry_get_value(list_entry), + MONITOR_BUF_SIZE-bufpos); + if (len+1 >= MONITOR_BUF_SIZE-bufpos) + return -EINVAL; + bufpos += len+1; + } +printf("created buf %p, size %zu '%s'\n", udev_device->monitor_buf, bufpos, udev_device->monitor_buf); + udev_device->monitor_buf_len = bufpos; + } + *buf = udev_device->monitor_buf; +printf("return buf %p, size %zu '%s'\n", *buf, udev_device->monitor_buf_len, *buf); + return udev_device->monitor_buf_len; +} + int udev_device_set_action(struct udev_device *udev_device, const char *action) { free(udev_device->action); diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 9f13917042..f70bdb2d03 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -380,43 +380,15 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device) { - const char *action; - struct udev_list_entry *list_entry; - char buf[4096]; - size_t bufpos; - size_t len; + const char *buf; + ssize_t len; ssize_t count; - action = udev_device_get_action(udev_device); - if (action == NULL) - return -EINVAL; - - bufpos = util_strlcpy(buf, action, sizeof(buf)); - len = util_strlcpy(&buf[bufpos], "@", sizeof(buf)-bufpos); - if (len >= sizeof(buf)-bufpos) + len = udev_device_get_properties_monitor_buf(udev_device, &buf); + if (len < 32) return -1; - bufpos += len; - len = util_strlcpy(&buf[bufpos], udev_device_get_devpath(udev_device), sizeof(buf)-bufpos); - if (len+1 >= sizeof(buf)-bufpos) - return -1; - bufpos += len+1; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - len = util_strlcpy(&buf[bufpos], udev_list_entry_get_name(list_entry), sizeof(buf)-bufpos); - if (len >= sizeof(buf)-bufpos) - return -1; - bufpos += len; - len = util_strlcpy(&buf[bufpos], "=", sizeof(buf)-bufpos); - if (len >= sizeof(buf)-bufpos) - return -1; - bufpos += len; - len = util_strlcpy(&buf[bufpos], udev_list_entry_get_value(list_entry), sizeof(buf)-bufpos); - if (len+1 >= sizeof(buf)-bufpos) - return -1; - bufpos += len+1; - } - count = sendto(udev_monitor->sock, - &buf, bufpos, 0, + buf, len, 0, (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); info(udev_monitor->udev, "passed %zi bytes to monitor %p, \n", count, udev_monitor); return count; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 0dda4c3b5e..11e9ad9cb3 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -62,6 +62,7 @@ extern void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); extern struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); extern struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); extern char **udev_device_get_properties_envp(struct udev_device *udev_device); +extern ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); extern int udev_device_read_db(struct udev_device *udev_device); extern int udev_device_read_uevent_file(struct udev_device *udev_device); extern int udev_device_set_action(struct udev_device *udev_device, const char *action); -- cgit v1.2.3-54-g00ecf From 39a08013a26d0b708b9471f961d40d884ac5af71 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 17:42:31 +0200 Subject: fix "unused" warnings --- udev/udev-rules.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 5a2ae1af82..0643811d7a 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -65,6 +65,7 @@ enum string_glob_type { GL_FORMAT, }; +#ifdef DEBUG static const char *string_glob_str[] = { [GL_UNSET] = "UNSET", [GL_PLAIN] = "plain", @@ -74,6 +75,7 @@ static const char *string_glob_str[] = { [GL_SOMETHING] = "split-glob", [GL_FORMAT] = "format", }; +#endif /* tokens of a rule are sorted/handled in this order */ enum token_type { @@ -941,6 +943,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "* %s\n", token_str[type]); break; case TK_M_PARENTS_MAX: + case TK_M_MAX: case TK_UNSET: dbg(rules->udev, "unknown type %u\n", type); break; @@ -1707,7 +1710,6 @@ void udev_rules_unref(struct udev_rules *rules) static int match_key(struct udev_rules *rules, struct token *token, const char *val) { - const char *key_name = token_str[token->type]; char *key_value = &rules->buf[token->key.value_off]; char *pos; int match = 0; @@ -1734,7 +1736,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * pos[0] = '\0'; pos = &pos[1]; } - dbg(rules->udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); + dbg(rules->udev, "match %s '%s' <-> '%s'\n", token_str[token->type], key_value, val); match = (strcmp(key_value, val) == 0); if (match) break; @@ -1754,7 +1756,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * pos[0] = '\0'; pos = &pos[1]; } - dbg(rules->udev, "match %s '%s' <-> '%s'\n", key_name, key_value, val); + dbg(rules->udev, "match %s '%s' <-> '%s'\n", token_str[token->type], key_value, val); match = (fnmatch(key_value, val, 0) == 0); if (match) break; @@ -1771,14 +1773,14 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * } if (match && (token->key.op == OP_MATCH)) { - dbg(rules->udev, "%s is true (matching value)\n", key_name); + dbg(rules->udev, "%s is true (matching value)\n", token_str[token->type]); return 0; } if (!match && (token->key.op == OP_NOMATCH)) { - dbg(rules->udev, "%s is true (non-matching value)\n", key_name); + dbg(rules->udev, "%s is true (non-matching value)\n", token_str[token->type]); return 0; } - dbg(rules->udev, "%s is not true\n", key_name); + dbg(rules->udev, "%s is not true\n", token_str[token->type]); return -1; } -- cgit v1.2.3-54-g00ecf From b62557daff59dbe3096dc31ac1f42a20ff6a9f92 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Oct 2008 18:09:13 +0200 Subject: remove debug printf --- udev/lib/libudev-device.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index dc198f0a0a..513c65653b 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -1091,11 +1091,9 @@ ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, return -EINVAL; bufpos += len+1; } -printf("created buf %p, size %zu '%s'\n", udev_device->monitor_buf, bufpos, udev_device->monitor_buf); udev_device->monitor_buf_len = bufpos; } *buf = udev_device->monitor_buf; -printf("return buf %p, size %zu '%s'\n", *buf, udev_device->monitor_buf_len, *buf); return udev_device->monitor_buf_len; } -- cgit v1.2.3-54-g00ecf From 91a75e4ad4071d9d0ce1adb5c8d8272aac379d0a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 25 Oct 2008 03:00:03 +0200 Subject: match KEY="A|B" without temporary string copy --- test/udev-test.pl | 25 +++++++++++++++++++++++++ udev/udev-rules.c | 31 ++++++++++++++++++------------- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 9725aff5ba..f630b74a9d 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1448,6 +1448,31 @@ EOF KERNEL=="dontknow*|*nothing", NAME="nomatch" KERNEL=="ttyACM*", NAME="before" KERNEL=="dontknow*|ttyACM*|nothing*", NAME="right" +EOF + }, + { + desc => "test multi matches 3", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 4", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => <buf[token->key.value_off], sizeof(value)); - key_value = value; - while (key_value != NULL) { - pos = strchr(key_value, '|'); - if (pos != NULL) { - pos[0] = '\0'; - pos = &pos[1]; - } - dbg(rules->udev, "match %s '%s' <-> '%s'\n", token_str[token->type], key_value, val); - match = (strcmp(key_value, val) == 0); - if (match) + split = &rules->buf[token->key.value_off]; + len = strlen(val); + while (1) { + const char *next; + + next = strchr(split, '|'); + if (next != NULL) { + size_t matchlen = (size_t)(next - split); + + match = (matchlen == len && strncmp(split, val, matchlen) == 0); + if (match) + break; + } else { + match = (strcmp(split, val) == 0); break; - key_value = pos; + } + split = &next[1]; } break; } -- cgit v1.2.3-54-g00ecf From 3e5c759543f57e6aabb8142ef194d5e4d45722d8 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sat, 25 Oct 2008 15:19:48 +0200 Subject: fix handling of string_escape option --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 8c0e1d961b..4df9eb35c8 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1830,6 +1830,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event { struct token *cur; struct token *rule; + enum escape_type esc = ESCAPE_UNSET; if (rules->tokens == NULL) return -1; @@ -1838,7 +1839,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event cur = &rules->tokens[0]; rule = cur; while (cur != NULL && cur->type != TK_END) { - enum escape_type esc = ESCAPE_UNSET; unsigned int idx; dump_token(rules, cur); -- cgit v1.2.3-54-g00ecf From e25fa4faf5b4977cc90c87003a41107a920bbe4d Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sat, 25 Oct 2008 17:01:21 +0100 Subject: udevd: use a tighter loop for compare_devpath() This crops up in my threaded udevd profiles from time to time. It's not consistent - probably due to variations in the number of concurrent events - but it can hit 4% user time and higher. The change halves the user time spent in compare_devpath(). Signed-off-by: Alan Jenkins --- udev/udevd.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 21fd6f82e7..0bacb3994b 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -310,26 +310,24 @@ static int mem_size_mb(void) static int compare_devpath(const char *running, const char *waiting) { - int i; + int i = 0; - for (i = 0; i < UTIL_PATH_SIZE; i++) { - /* identical device event found */ - if (running[i] == '\0' && waiting[i] == '\0') - return 1; + while (running[i] == waiting[i] && running[i] != '\0') + i++; - /* parent device event found */ - if (running[i] == '\0' && waiting[i] == '/') - return 2; + /* identical device event found */ + if (running[i] == '\0' && waiting[i] == '\0') + return 1; - /* child device event found */ - if (running[i] == '/' && waiting[i] == '\0') - return 3; + /* parent device event found */ + if (running[i] == '\0' && waiting[i] == '/') + return 2; - /* no matching event */ - if (running[i] != waiting[i]) - break; - } + /* child device event found */ + if (running[i] == '/' && waiting[i] == '\0') + return 3; + /* no matching event */ return 0; } -- cgit v1.2.3-54-g00ecf From cd94c04c518fffbf7f2c173952d77414a5d6bb6b Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sat, 25 Oct 2008 15:51:19 +0100 Subject: udevd: avoid implicit memset in match_attr() Initializing a char array to "" is equivalent to a memset() call - which is exactly what it gets compiled to. Fixing this one callsite reduced memset() _user_ cpu cycles from 2-4% to 0.05% on the EeePC. Signed-off-by: Alan Jenkins --- udev/udev-rules.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 4df9eb35c8..44b26906b4 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1794,10 +1794,11 @@ static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct char attr[UTIL_PATH_SIZE]; const char *key_name = &rules->buf[cur->key.attr_off]; const char *key_value = &rules->buf[cur->key.value_off]; - char value[UTIL_NAME_SIZE] = ""; + char value[UTIL_NAME_SIZE]; size_t len; util_strlcpy(attr, key_name, sizeof(attr)); + util_strlcpy(value, "", sizeof(value)); util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); if (value[0] == '\0') { const char *val; -- cgit v1.2.3-54-g00ecf From 21cfb0436c736c262baa37d96625041e3a96db07 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Oct 2008 02:16:54 +0100 Subject: match_attr() - copy attr value only when needed --- udev/udev-rules.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 44b26906b4..1647f5cb09 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1791,15 +1791,18 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur) { - char attr[UTIL_PATH_SIZE]; const char *key_name = &rules->buf[cur->key.attr_off]; const char *key_value = &rules->buf[cur->key.value_off]; char value[UTIL_NAME_SIZE]; size_t len; - util_strlcpy(attr, key_name, sizeof(attr)); - util_strlcpy(value, "", sizeof(value)); - util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); + value[0] = '\0'; + if (key_name[0] == '[') { + char attr[UTIL_PATH_SIZE]; + + util_strlcpy(attr, key_name, sizeof(attr)); + util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); + } if (value[0] == '\0') { const char *val; @@ -1807,7 +1810,7 @@ static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct if (val != NULL) util_strlcpy(value, val, sizeof(value)); } - if (value[0]=='\0') + if (value[0] == '\0') return -1; /* strip trailing whitespace of value, if not asked to match for it */ -- cgit v1.2.3-54-g00ecf From 1822e9b033fcd91a7dfd3b0bfd12cfbbd93fc470 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Oct 2008 02:31:54 +0100 Subject: do not init string arrays, just clear first byte --- extras/edd_id/edd_id.c | 5 +++-- extras/scsi_id/scsi_id.c | 3 ++- udev/udev-event.c | 3 ++- udev/udev-node.c | 6 ++++-- udev/udev-rules.c | 3 ++- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index d7aec1488c..4154387cb6 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -45,9 +45,9 @@ int main(int argc, char *argv[]) int sysfs_fd; DIR *dir = NULL; int rc = 1; - char match[NAME_MAX] = ""; + char match[NAME_MAX]; - udev = udev_new(); + udev = udev_new(); if (udev == NULL) goto exit; @@ -124,6 +124,7 @@ int main(int argc, char *argv[]) } /* lookup signature in sysfs to determine the name */ + match[0] = '\0'; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char file[UTIL_PATH_SIZE]; char sysfs_id_buf[256]; diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 86c76cfcc4..45e48601f7 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -579,8 +579,9 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) struct scsi_id_device dev_scsi; int good_dev; int page_code; - char serial_short[MAX_SERIAL_LEN] = ""; + char serial_short[MAX_SERIAL_LEN]; + serial_short[0] = '\0'; set_inq_values(udev, &dev_scsi, maj_min_dev); /* get per device (vendor + model) options from the config file */ diff --git a/udev/udev-event.c b/udev/udev-event.c index fcb9993709..e297df0383 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -291,9 +291,10 @@ found: err(event->udev, "missing file parameter for attr\n"); else { const char *val; - char value[UTIL_NAME_SIZE] = ""; + char value[UTIL_NAME_SIZE]; size_t size; + value[0] = '\0'; util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); val = udev_device_get_sysattr_value(event->dev, attr); diff --git a/udev/udev-node.c b/udev/udev-node.c index b39100dcee..e402dc9de3 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -143,7 +143,7 @@ exit: static int node_symlink(struct udev *udev, const char *node, const char *slink) { struct stat stats; - char target[UTIL_PATH_SIZE] = ""; + char target[UTIL_PATH_SIZE]; char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; int i = 0; int tail = 0; @@ -151,6 +151,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) int err = 0; /* use relative link */ + target[0] = '\0'; while (node[i] && (node[i] == slink[i])) { if (node[i] == '/') tail = i+1; @@ -272,7 +273,7 @@ static int update_link(struct udev_device *dev, const char *slink, int test) struct udev *udev = udev_device_get_udev(dev); struct udev_list_node dev_list; struct udev_list_entry *dev_entry; - char target[UTIL_PATH_SIZE] = ""; + char target[UTIL_PATH_SIZE]; int count; int priority = 0; int rc = 0; @@ -294,6 +295,7 @@ static int update_link(struct udev_device *dev, const char *slink, int test) } /* find the device with the highest priority */ + target[0] = '\0'; udev_list_entry_foreach(dev_entry, udev_list_get_entry(&dev_list)) { const char *syspath; struct udev_device *dev_db; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 1647f5cb09..a6f9220352 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -547,11 +547,12 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) { struct udev *udev = udev_device_get_udev(dev); char filepath[UTIL_PATH_SIZE]; - char devicepath[UTIL_PATH_SIZE] = ""; + char devicepath[UTIL_PATH_SIZE]; struct stat stats; int loop = timeout * WAIT_LOOP_PER_SECOND; /* a relative path is a device attribute */ + devicepath[0] = '\0'; if (file[0] != '/') { util_strlcpy(devicepath, udev_get_sys_path(udev), sizeof(devicepath)); util_strlcat(devicepath, udev_device_get_devpath(dev), sizeof(devicepath)); -- cgit v1.2.3-54-g00ecf From dc4c7e463df35776631150e4e18a4ba41749843c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Oct 2008 02:48:14 +0100 Subject: fix $attr{[/]} substitution --- test/udev-test.pl | 10 ++++++++++ udev/udev-event.c | 12 ++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index f630b74a9d..767f6adeb4 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1654,6 +1654,16 @@ EOF rules => < "magic [subsys/sysname] attribute substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda-8741C4G-end", + exp_perms => "0:0:0660", + rules => <udev, attr, value, sizeof(value), 1); - val = udev_device_get_sysattr_value(event->dev, attr); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); + /* try to read attribute of the current device */ + if (value[0] == '\0') { + val = udev_device_get_sysattr_value(event->dev, attr); + if (val != NULL) + util_strlcpy(value, val, sizeof(value)); + } - /* try the current device, other matches may have selected */ + /* try to read the attribute of the parent device, other matches have selected */ if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { val = udev_device_get_sysattr_value(event->dev_parent, attr); if (val != NULL) -- cgit v1.2.3-54-g00ecf From 6493e655f7387a37ad6e8cb928afc1c1a5c1a454 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Oct 2008 03:39:41 +0100 Subject: libudev: device - fill envp array while composing monitor buffer Thanks to Alan Jenkins, for the idea. --- udev/lib/libudev-device.c | 142 ++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 73 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 513c65653b..b8f4b8ba71 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -31,8 +31,6 @@ #include "libudev.h" #include "libudev-private.h" -#define ENVP_SIZE 128 - struct udev_device { struct udev *udev; struct udev_device *parent_device; @@ -42,11 +40,11 @@ struct udev_device { const char *sysnum; char *devnode; char *subsystem; - char **envp; char *driver; char *action; char *devpath_old; char *physdevpath; + char **envp; char *monitor_buf; size_t monitor_buf_len; struct udev_list_node devlinks_list; @@ -594,8 +592,6 @@ struct udev_device *udev_device_ref(struct udev_device *udev_device) **/ void udev_device_unref(struct udev_device *udev_device) { - unsigned int i; - if (udev_device == NULL) return; udev_device->refcount--; @@ -614,11 +610,7 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->devpath_old); free(udev_device->physdevpath); udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); - if (udev_device->envp != NULL) { - for (i = 0; i < ENVP_SIZE && udev_device->envp[i] != NULL; i++) - free(udev_device->envp[i]); - free(udev_device->envp); - } + free(udev_device->envp); free(udev_device->monitor_buf); info(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); @@ -986,7 +978,6 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { - udev_device->monitor_buf_len = 0; udev_device->envp_uptodate = 0; if (value == NULL) { struct udev_list_entry *list_entry; @@ -1016,83 +1007,88 @@ struct udev_list_entry *udev_device_add_property_from_string(struct udev_device return udev_device_add_property(udev_device, name, val); } -char **udev_device_get_properties_envp(struct udev_device *udev_device) +#define ENVP_SIZE 128 +#define MONITOR_BUF_SIZE 4096 +static int update_envp_monitor_buf(struct udev_device *udev_device) { - if (!udev_device->envp_uptodate) { - unsigned int i; - struct udev_list_entry *list_entry; + const char *action; + struct udev_list_entry *list_entry; + size_t bufpos; + size_t len; + unsigned int i; - if (udev_device->envp != NULL) { - for (i = 0; i < ENVP_SIZE && udev_device->envp[i] != NULL; i++) - free(udev_device->envp[i]); - } else { - udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); - } + /* monitor buffer of property strings */ + free(udev_device->monitor_buf); + udev_device->monitor_buf_len = 0; + udev_device->monitor_buf = malloc(MONITOR_BUF_SIZE); + if (udev_device->monitor_buf == NULL) + return -ENOMEM; - i = 0; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - asprintf(&udev_device->envp[i++], "%s=%s", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - if (i+1 >= ENVP_SIZE) - break; - } - udev_device->envp[i] = NULL; - info(udev_device->udev, "constructed envp from %u properties\n", i); - udev_device->envp_uptodate = 1; - } - return udev_device->envp; -} + /* envp array, strings will point into monitor buffer */ + free(udev_device->envp); + udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); + if (udev_device->envp == NULL) + return -ENOMEM; -#define MONITOR_BUF_SIZE 4096 -ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf) -{ - if (udev_device->monitor_buf_len == 0) { - const char *action; - struct udev_list_entry *list_entry; - size_t bufpos; - size_t len; + /* header @ */ + action = udev_device_get_action(udev_device); + if (action == NULL) + return -EINVAL; + bufpos = util_strlcpy(udev_device->monitor_buf, action, MONITOR_BUF_SIZE); + len = util_strlcpy(&udev_device->monitor_buf[bufpos], "@", MONITOR_BUF_SIZE-bufpos); + if (len >= MONITOR_BUF_SIZE-bufpos) + return -EINVAL; + bufpos += len; + len = util_strlcpy(&udev_device->monitor_buf[bufpos], + udev_device_get_devpath(udev_device), + MONITOR_BUF_SIZE-bufpos); + if (len+1 >= MONITOR_BUF_SIZE-bufpos) + return -EINVAL; + bufpos += len+1; - free(udev_device->monitor_buf); - udev_device->monitor_buf = malloc(MONITOR_BUF_SIZE); - if (udev_device->monitor_buf == NULL) - return -ENOMEM; + i = 0; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + /* add string to envp array */ + udev_device->envp[i++] = &udev_device->monitor_buf[bufpos]; + if (i+1 >= ENVP_SIZE) + return -EINVAL; - /* header @ */ - action = udev_device_get_action(udev_device); - if (action == NULL) + /* add property string to monitor buffer */ + len = util_strlcpy(&udev_device->monitor_buf[bufpos], + udev_list_entry_get_name(list_entry), MONITOR_BUF_SIZE-bufpos); + if (len >= MONITOR_BUF_SIZE-bufpos) return -EINVAL; - bufpos = util_strlcpy(udev_device->monitor_buf, action, MONITOR_BUF_SIZE); - len = util_strlcpy(&udev_device->monitor_buf[bufpos], "@", MONITOR_BUF_SIZE-bufpos); + bufpos += len; + len = util_strlcpy(&udev_device->monitor_buf[bufpos], "=", MONITOR_BUF_SIZE-bufpos); if (len >= MONITOR_BUF_SIZE-bufpos) return -EINVAL; bufpos += len; - len = util_strlcpy(&udev_device->monitor_buf[bufpos], - udev_device_get_devpath(udev_device), + len = util_strlcpy(&udev_device->monitor_buf[bufpos], udev_list_entry_get_value(list_entry), MONITOR_BUF_SIZE-bufpos); if (len+1 >= MONITOR_BUF_SIZE-bufpos) return -EINVAL; bufpos += len+1; - - /* property strings */ - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - len = util_strlcpy(&udev_device->monitor_buf[bufpos], - udev_list_entry_get_name(list_entry), MONITOR_BUF_SIZE-bufpos); - if (len >= MONITOR_BUF_SIZE-bufpos) - return -EINVAL; - bufpos += len; - len = util_strlcpy(&udev_device->monitor_buf[bufpos], "=", MONITOR_BUF_SIZE-bufpos); - if (len >= MONITOR_BUF_SIZE-bufpos) - return -EINVAL; - bufpos += len; - len = util_strlcpy(&udev_device->monitor_buf[bufpos], udev_list_entry_get_value(list_entry), - MONITOR_BUF_SIZE-bufpos); - if (len+1 >= MONITOR_BUF_SIZE-bufpos) - return -EINVAL; - bufpos += len+1; - } - udev_device->monitor_buf_len = bufpos; } + udev_device->envp[i] = NULL; + udev_device->monitor_buf_len = bufpos; + udev_device->envp_uptodate = 1; + info(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", i, bufpos); + return 0; +} + +char **udev_device_get_properties_envp(struct udev_device *udev_device) +{ + if (!udev_device->envp_uptodate) + if (update_envp_monitor_buf(udev_device) < 32) + return NULL; + return udev_device->envp; +} + +ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf) +{ + if (!udev_device->envp_uptodate) + if (update_envp_monitor_buf(udev_device) < 32) + return -EINVAL; *buf = udev_device->monitor_buf; return udev_device->monitor_buf_len; } -- cgit v1.2.3-54-g00ecf From c6243a414e5ea233862445db0e57d6033879985f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Oct 2008 04:35:32 +0100 Subject: test: add RUN+="socket: ..." to a test to run monitor code --- test/udev-test.pl | 4 ++-- udev/lib/libudev-device.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 767f6adeb4..096977a611 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -36,7 +36,7 @@ my @tests = ( devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "sda-8741C4G-end", exp_perms => "0:0:0660", rules => <envp_uptodate) - if (update_envp_monitor_buf(udev_device) < 32) + if (update_envp_monitor_buf(udev_device) != 0) return NULL; return udev_device->envp; } @@ -1087,7 +1087,7 @@ char **udev_device_get_properties_envp(struct udev_device *udev_device) ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf) { if (!udev_device->envp_uptodate) - if (update_envp_monitor_buf(udev_device) < 32) + if (update_envp_monitor_buf(udev_device) != 0) return -EINVAL; *buf = udev_device->monitor_buf; return udev_device->monitor_buf_len; -- cgit v1.2.3-54-g00ecf From 427e20b261b056cf781af75ff60f067714b750bb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Oct 2008 14:31:46 +0100 Subject: libudev: device - allocate envp array only once --- test/udev-test.pl | 3 ++- udev/lib/libudev-device.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 096977a611..95f9af0e2b 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1663,10 +1663,11 @@ EOF exp_name => "sda-8741C4G-end", exp_perms => "0:0:0660", rules => <envp); - udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); + if (udev_device->envp == NULL) + udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); if (udev_device->envp == NULL) return -ENOMEM; -- cgit v1.2.3-54-g00ecf From be7de4097af70515783cd0030f5e7a7a89bbadc8 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sun, 26 Oct 2008 14:48:48 +0000 Subject: kerneldoc comment fixes s/ressources/resources/ Also reduce commas per sentence and add a possessive apostrophe. --- udev/lib/libudev-device.c | 4 ++-- udev/lib/libudev-monitor.c | 10 +++++----- udev/lib/libudev.c | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 11a6037d1b..3f8ee1071c 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -266,7 +266,7 @@ struct udev_device *device_new(struct udev *udev) * path to the device, including the sys mount point. * * The initial refcount is 1, and needs to be decremented to - * release the ressources of the udev device. + * release the resources of the udev device. * * Returns: a new udev device, or #NULL, if it does not exist **/ @@ -587,7 +587,7 @@ struct udev_device *udev_device_ref(struct udev_device *udev_device) * @udev_device: udev device * * Drop a reference of a udev device. If the refcount reaches zero, - * the ressources of the device will be released. + * the resources of the device will be released. * **/ void udev_device_unref(struct udev_device *udev_device) diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index f70bdb2d03..fc5b176be0 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -54,7 +54,7 @@ struct udev_monitor { * socket will be used. * * The initial refcount is 1, and needs to be decremented to - * release the ressources of the udev monitor. + * release the resources of the udev monitor. * * Returns: a new udev monitor, or #NULL, in case of an error **/ @@ -178,7 +178,7 @@ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) * @udev_monitor: udev monitor * * Drop a reference ofa udev monitor. If the refcount reaches zero, - * the bound socket will be closed, and the ressources of the monitor + * the bound socket will be closed, and the resources of the monitor * will be released. * **/ @@ -233,11 +233,11 @@ int udev_monitor_get_fd(struct udev_monitor *udev_monitor) * device, fill in the received data, and return the device. * * Only socket connections with uid=0 are accepted. The caller - * needs to make sure, that there is data to read from the socket, - * the call will block until the socket becomes readable. + * needs to make sure that there is data to read from the socket. + * The call will block until the socket becomes readable. * * The initial refcount is 1, and needs to be decremented to - * release the ressources of the udev device. + * release the resources of the udev device. * * Returns: a new udev device, or #NULL, in case of an error **/ diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index fcb784580b..e26e8b132d 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -85,7 +85,7 @@ void udev_set_userdata(struct udev *udev, void *userdata) * Create udev library context. * * The initial refcount is 1, and needs to be decremented to - * release the ressources of the udev library context. + * release the resources of the udev library context. * * Returns: a new udev library context **/ @@ -267,7 +267,7 @@ struct udev *udev_ref(struct udev *udev) * @udev: udev library context * * Drop a reference of the udev library context. If the refcount - * reaches zero, the ressources of the context will be released. + * reaches zero, the resources of the context will be released. * **/ void udev_unref(struct udev *udev) @@ -290,9 +290,9 @@ void udev_unref(struct udev *udev) * @udev: udev library context * @log_fn: function to be called for logging messages * - * The built-in logging, which writes to stderr, it can be + * The built-in logging writes to stderr. It can be * overridden by a custom function, to plug log messages - * into the users logging functionality. + * into the users' logging functionality. * **/ void udev_set_log_fn(struct udev *udev, -- cgit v1.2.3-54-g00ecf From 65807d09ecc2f09d7643b9c2f3e9c89358304fab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Oct 2008 02:26:35 +0100 Subject: update NEWS --- NEWS | 17 ++++++++++++++++- TODO | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 289db9c8ec..0e486f4621 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,21 @@ udev 131 ======== -Bugfixes. +Bugfixes. (And probably new bugs. :)) + +The rule matching engine got converted from a rule list to a token +array which reduced the in-memory rules representation of a full +featured distros with thousends of rules from 1.2MB to 0.17 MB. + +The limit of 5 ENV and ATTR matches, and a single instance for most +other keys per rule is gone with the new parser. + +The NAME assignment is no longer special cased. If later rules assign +a NAME value again, the former value will be overwritten. As usual +for most other keys, the NAME value can be protected by doing a final +assignment with NAME:="". + +Many thanks to Alan Jenkins for finding and optimizing some of the +computing expensive parts. udev 130 ======== diff --git a/TODO b/TODO index b4a967c258..054d52f984 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ - o add DVB variables to kernel, and drop shell script rule + o add DVB variables to kernel (patch sent), and drop shell script rule o DEVTYPE for disks is set by the kernel, they will be removed from the default rules o "udevadm control" commands will only accept the -- syntax -- cgit v1.2.3-54-g00ecf From 6270756cdca967adce6badaf1360d872a0907bf0 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 28 Oct 2008 08:58:18 +0000 Subject: udevd: simplify rules execution loop cur can't become NULL, and the check for TK_END can be folded into the switch statement. Signed-off-by: Alan Jenkins --- udev/udev-rules.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index a6f9220352..665ad71e80 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1843,7 +1843,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* loop through token list, match, run actions or forward to next rule */ cur = &rules->tokens[0]; rule = cur; - while (cur != NULL && cur->type != TK_END) { + while (1) { unsigned int idx; dump_token(rules, cur); @@ -2319,11 +2319,11 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event cur = &rules->tokens[cur->key.rule_goto]; continue; case TK_A_LAST_RULE: + case TK_END: break; case TK_M_PARENTS_MAX: case TK_M_MAX: - case TK_END: case TK_UNSET: err(rules->udev, "wrong type %u\n", cur->type); goto nomatch; -- cgit v1.2.3-54-g00ecf From 0bc74ea79f68a89c5ec4bf5676dede97626ceade Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Oct 2008 17:32:13 +0100 Subject: udevd: merge exec and run queue to minimize devpath string compares --- udev/udev-event.c | 5 ++ udev/udev.h | 2 + udev/udevd.c | 174 ++++++++++++++++++++++++------------------------------ 3 files changed, 84 insertions(+), 97 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 02c5c99dc1..79a4cde651 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -706,6 +706,11 @@ int udev_event_execute_run(struct udev_event *event) util_strlcpy(program, cmd, sizeof(program)); udev_event_apply_format(event, program, sizeof(program)); + if (event->trace) + printf("run %s (%llu) '%s'\n", + udev_device_get_syspath(event->dev), + udev_device_get_seqnum(event->dev), + program); envp = udev_device_get_properties_envp(event->dev); if (util_run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { if (!udev_list_entry_get_flag(list_entry)) diff --git a/udev/udev.h b/udev/udev.h index faa1bf6851..732b131390 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -71,6 +71,7 @@ struct udev_event { pid_t pid; int exitstatus; time_t queue_time; + unsigned long long int delaying_seqnum; unsigned int group_final:1; unsigned int owner_final:1; unsigned int mode_final:1; @@ -78,6 +79,7 @@ struct udev_event { unsigned int devlink_final:1; unsigned int run_final:1; unsigned int ignore_device:1; + unsigned int trace:1; unsigned int test:1; }; diff --git a/udev/udevd.c b/udev/udevd.c index 0bacb3994b..6f2e188cea 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -62,7 +62,6 @@ static struct udev_rules *rules; static struct udev_ctrl *udev_ctrl; static struct udev_monitor *kernel_monitor; static int inotify_fd = -1; - static int signal_pipe[2] = {-1, -1}; static volatile int sigchilds_waiting; static volatile int udev_exit; @@ -70,9 +69,8 @@ static volatile int reload_config; static int run_exec_q; static int stop_exec_q; static int max_childs; - -static struct udev_list_node exec_list; -static struct udev_list_node running_list; +static int childs; +static struct udev_list_node event_list; enum event_state { EVENT_QUEUED, @@ -137,7 +135,7 @@ static void export_event_state(struct udev_event *event, enum event_state state) unlink(filename); /* clean up possibly empty queue directory */ - if (udev_list_is_empty(&exec_list) && udev_list_is_empty(&running_list)) + if (udev_list_is_empty(&event_list)) util_delete_path(event->udev, filename); break; case EVENT_FAILED: @@ -146,7 +144,7 @@ static void export_event_state(struct udev_event *event, enum event_state state) rename(filename, filename_failed); /* clean up possibly empty queue directory */ - if (udev_list_is_empty(&exec_list) && udev_list_is_empty(&running_list)) + if (udev_list_is_empty(&event_list)) util_delete_path(event->udev, filename); break; } @@ -180,6 +178,13 @@ static void event_fork(struct udev_event *event) struct sigaction act; int err; + if (debug_trace) { + event->trace = 1; + printf("fork %s (%llu)\n", + udev_device_get_syspath(event->dev), + udev_device_get_seqnum(event->dev)); + } + pid = fork(); switch (pid) { case 0: @@ -221,6 +226,7 @@ static void event_fork(struct udev_event *event) /* execute RUN= */ if (err == 0 && !event->ignore_device && udev_get_run(event->udev)) udev_event_execute_run(event); + info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err); logging_close(); if (err != 0) @@ -239,6 +245,7 @@ static void event_fork(struct udev_event *event) udev_device_get_subsystem(event->dev), time(NULL) - event->queue_time); event->pid = pid; + childs++; } } @@ -265,24 +272,15 @@ static void event_queue_insert(struct udev_event *event) close(fd); } - /* run one event after the other in debug mode */ - if (debug_trace) { - udev_list_node_append(&event->node, &running_list); - event_fork(event); - waitpid(event->pid, NULL, 0); - event_queue_delete(event); - return; - } + + udev_list_node_append(&event->node, &event_list); + run_exec_q = 1; /* run all events with a timeout set immediately */ if (udev_device_get_timeout(event->dev) > 0) { - udev_list_node_append(&event->node, &running_list); event_fork(event); return; } - - udev_list_node_append(&event->node, &exec_list); - run_exec_q = 1; } static int mem_size_mb(void) @@ -312,7 +310,7 @@ static int compare_devpath(const char *running, const char *waiting) { int i = 0; - while (running[i] == waiting[i] && running[i] != '\0') + while (running[i] != '\0' && running[i] == waiting[i]) i++; /* identical device event found */ @@ -332,23 +330,34 @@ static int compare_devpath(const char *running, const char *waiting) } /* lookup event for identical, parent, child, or physical device */ -static int devpath_busy(struct udev_event *event, int limit) +static int devpath_busy(struct udev_event *event) { struct udev_list_node *loop; - int childs_count = 0; - /* check exec-queue which may still contain delayed events we depend on */ - udev_list_node_foreach(loop, &exec_list) { + if (event->delaying_seqnum > 0) { + } + /* check if queue contains events we depend on */ + udev_list_node_foreach(loop, &event_list) { struct udev_event *loop_event = node_to_event(loop); - /* skip ourself and all later events */ + /* we already found a later event, earlier can not block us, no need to check again */ + if (udev_device_get_seqnum(loop_event->dev) < event->delaying_seqnum) + continue; + + /* event we checked earlier still exists, no need to check again */ + if (udev_device_get_seqnum(loop_event->dev) == event->delaying_seqnum) + return 2; + + /* found ourself, no later event can block us */ if (udev_device_get_seqnum(loop_event->dev) >= udev_device_get_seqnum(event->dev)) break; /* check our old name */ if (udev_device_get_devpath_old(event->dev) != NULL) - if (strcmp(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath_old(event->dev)) == 0) - return 2; + if (strcmp(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath_old(event->dev)) == 0) { + event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev); + return 3; + } /* check identical, parent, or child device event */ if (compare_devpath(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath(event->dev)) != 0) { @@ -356,57 +365,10 @@ static int devpath_busy(struct udev_event *event, int limit) udev_device_get_seqnum(event->dev), udev_device_get_seqnum(loop_event->dev), udev_device_get_devpath(loop_event->dev)); - return 3; - } - - /* check for our major:minor number */ - if (major(udev_device_get_devnum(event->dev)) > 0 && - udev_device_get_devnum(loop_event->dev) == udev_device_get_devnum(event->dev) && - strcmp(udev_device_get_subsystem(event->dev), udev_device_get_subsystem(loop_event->dev)) == 0) { - dbg(event->udev, "%llu, device event still pending %llu (%d:%d)\n", - udev_device_get_seqnum(event->dev), - udev_device_get_seqnum(loop_event->dev), - major(udev_device_get_devnum(loop_event->dev)), minor(udev_device_get_devnum(loop_event->dev))); + event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev); return 4; } - /* check physical device event (special case of parent) */ - if (udev_device_get_physdevpath(event->dev) != NULL && - strcmp(udev_device_get_action(event->dev), "add") == 0) - if (compare_devpath(udev_device_get_devpath(loop_event->dev), - udev_device_get_physdevpath(event->dev)) != 0) { - dbg(event->udev, "%llu, physical device event still pending %llu (%s)\n", - udev_device_get_seqnum(event->dev), - udev_device_get_seqnum(loop_event->dev), - udev_device_get_devpath(loop_event->dev)); - return 5; - } - } - - /* check run queue for still running events */ - udev_list_node_foreach(loop, &running_list) { - struct udev_event *loop_event = node_to_event(loop); - - if (childs_count++ >= limit) { - info(event->udev, "%llu, maximum number (%i) of childs reached\n", - udev_device_get_seqnum(event->dev), childs_count); - return 1; - } - - /* check our old name */ - if (udev_device_get_devpath_old(event->dev) != NULL) - if (strcmp(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath_old(event->dev)) == 0) - return 2; - - /* check identical, parent, or child device event */ - if (compare_devpath(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath(event->dev)) != 0) { - dbg(event->udev, "%llu, device event still running %llu (%s)\n", - udev_device_get_seqnum(event->dev), - udev_device_get_seqnum(loop_event->dev), - udev_device_get_devpath(loop_event->dev)); - return 3; - } - /* check for our major:minor number */ if (major(udev_device_get_devnum(event->dev)) > 0 && udev_device_get_devnum(loop_event->dev) == udev_device_get_devnum(event->dev) && @@ -415,7 +377,8 @@ static int devpath_busy(struct udev_event *event, int limit) udev_device_get_seqnum(event->dev), udev_device_get_seqnum(loop_event->dev), major(udev_device_get_devnum(loop_event->dev)), minor(udev_device_get_devnum(loop_event->dev))); - return 4; + event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev); + return 5; } /* check physical device event (special case of parent) */ @@ -427,7 +390,8 @@ static int devpath_busy(struct udev_event *event, int limit) udev_device_get_seqnum(event->dev), udev_device_get_seqnum(loop_event->dev), udev_device_get_devpath(loop_event->dev)); - return 5; + event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev); + return 6; } } return 0; @@ -439,23 +403,34 @@ static void event_queue_manager(struct udev *udev) struct udev_list_node *loop; struct udev_list_node *tmp; - if (udev_list_is_empty(&exec_list)) + if (udev_list_is_empty(&event_list)) { + if (childs > 0) { + err(udev, "event list empty, but childs count is %i", childs); + childs = 0; + } return; + } - udev_list_node_foreach_safe(loop, tmp, &exec_list) { + udev_list_node_foreach_safe(loop, tmp, &event_list) { struct udev_event *loop_event = node_to_event(loop); - /* serialize and wait for parent or child events */ - if (devpath_busy(loop_event, max_childs) != 0) { + if (childs >= max_childs) { + info(udev, "maximum number (%i) of childs reached\n", childs); + break; + } + + if (loop_event->pid != 0) + continue; + + /* do not start event if parent or child event is still running */ + if (devpath_busy(loop_event) != 0) { dbg(udev, "delay seq %llu (%s)\n", udev_device_get_seqnum(loop_event->dev), udev_device_get_devpath(loop_event->dev)); continue; } - /* move event to run list */ - udev_list_node_remove(&loop_event->node); - udev_list_node_append(&loop_event->node, &running_list); + /* do dendencies, start event */ event_fork(loop_event); dbg(udev, "moved seq %llu to running list\n", udev_device_get_seqnum(loop_event->dev)); } @@ -526,7 +501,6 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) info(udev, "udevd message (SET_MAX_CHILDS) received, max_childs=%i\n", i); max_childs = i; } - udev_ctrl_msg_unref(ctrl_msg); } @@ -555,7 +529,7 @@ static void udev_done(int pid, int exitstatus) struct udev_list_node *loop; /* find event associated with pid and delete it */ - udev_list_node_foreach(loop, &running_list) { + udev_list_node_foreach(loop, &event_list) { struct udev_event *loop_event = node_to_event(loop); if (loop_event->pid == pid) { @@ -563,9 +537,14 @@ static void udev_done(int pid, int exitstatus) udev_device_get_seqnum(loop_event->dev), loop_event->pid, exitstatus, time(NULL) - loop_event->queue_time); loop_event->exitstatus = exitstatus; + if (debug_trace) + printf("exit %s (%llu)\n", + udev_device_get_syspath(loop_event->dev), + udev_device_get_seqnum(loop_event->dev)); event_queue_delete(loop_event); + childs--; - /* there may be events waiting with the same devpath */ + /* there may be dependent events waiting */ run_exec_q = 1; return; } @@ -690,8 +669,6 @@ int main(int argc, char *argv[]) fprintf(stderr, "cannot open /dev/null\n"); err(udev, "cannot open /dev/null\n"); } - if (fd > STDIN_FILENO) - dup2(fd, STDIN_FILENO); if (write(STDOUT_FILENO, 0, 0) < 0) dup2(fd, STDOUT_FILENO); if (write(STDERR_FILENO, 0, 0) < 0) @@ -755,8 +732,7 @@ int main(int argc, char *argv[]) err(udev, "error reading rules\n"); goto exit; } - udev_list_init(&running_list); - udev_list_init(&exec_list); + udev_list_init(&event_list); export_initial_seqnum(udev); if (daemonize) { @@ -779,7 +755,8 @@ int main(int argc, char *argv[]) } /* redirect std{out,err} */ - if (!debug) { + if (!debug && !debug_trace) { + dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); } @@ -840,7 +817,7 @@ int main(int argc, char *argv[]) inotify_add_watch(inotify_fd, udev_get_rules_path(udev), IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } else { - char filename[PATH_MAX]; + char filename[UTIL_PATH_SIZE]; inotify_add_watch(inotify_fd, UDEV_PREFIX "/lib/udev/rules.d", IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); @@ -858,17 +835,20 @@ int main(int argc, char *argv[]) else err(udev, "inotify_init failed: %m\n"); - /* maximum limit of forked childs */ - value = getenv("UDEVD_MAX_CHILDS"); - if (value) - max_childs = strtoul(value, NULL, 10); - else { + /* in trace mode run one event after the other */ + if (debug_trace) { + max_childs = 1; + } else { int memsize = mem_size_mb(); if (memsize > 0) max_childs = 128 + (memsize / 4); else max_childs = UDEVD_MAX_CHILDS; } + /* possibly overwrite maximum limit of executed events */ + value = getenv("UDEVD_MAX_CHILDS"); + if (value) + max_childs = strtoul(value, NULL, 10); info(udev, "initialize max_childs to %u\n", max_childs); maxfd = udev_ctrl_get_fd(udev_ctrl); -- cgit v1.2.3-54-g00ecf From aeb53ca3d60057dfbb948b222046dcecfcc11ed9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Oct 2008 22:22:12 +0100 Subject: ATTR{}== always fails if the attribute does not exist --- TODO | 1 + udev/udev-rules.c | 7 +++---- udev/udev.xml | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index 054d52f984..a8d3fc0515 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ + o add DVB variables to kernel (patch sent), and drop shell script rule o DEVTYPE for disks is set by the kernel, they will be removed from the default rules diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 665ad71e80..f6cc45ba75 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1808,11 +1808,10 @@ static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct const char *val; val = udev_device_get_sysattr_value(dev, key_name); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); + if (val == NULL) + return -1; + util_strlcpy(value, val, sizeof(value)); } - if (value[0] == '\0') - return -1; /* strip trailing whitespace of value, if not asked to match for it */ len = strlen(key_value); diff --git a/udev/udev.xml b/udev/udev.xml index c4e99f1ad5..ccc1f45e4c 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -186,8 +186,7 @@ Match sysfs attribute values of the event device. Trailing whitespace in the attribute values is ignored, if the specified match - value does not contain trailing whitespace itself. Depending on the type - of operator, this key is also used to set the value of a sysfs attribute. + value does not contain trailing whitespace itself. @@ -318,8 +317,7 @@ The value that should be written to a sysfs attribute of the - event device. Depending on the type of operator, this key is also - used to match against the value of a sysfs attribute. + event device. -- cgit v1.2.3-54-g00ecf From ba6e84fe6a00069e59f787f417cb305843cb85f7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Oct 2008 09:20:03 +0100 Subject: rules: remove SCSI timeouts On Thu, Oct 30, 2008 at 03:55, Tejun Heo wrote: The appropriate default timeout differs depending on the transport and the type of the attached device, so the above two rules harm more than help. The affect of the above two rules weren't visible for some reason but with recent block layer timeout update, they actually work and cause problems. --- rules/rules.d/50-udev-default.rules | 2 -- 1 file changed, 2 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index b41718c771..5b56e4b983 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -63,8 +63,6 @@ KERNEL=="irlpt[0-9]*", GROUP="lp" # block, tapes, block-releated SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="0|7|14", ATTR{timeout}="60" -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", ACTION=="add", ATTR{type}=="1", ATTR{timeout}="900" KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" KERNEL=="fd[0-9]", GROUP="floppy" KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" -- cgit v1.2.3-54-g00ecf From 87fb336f39ea55ed76b3d909658f3390720a9244 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Oct 2008 16:11:49 +0100 Subject: rules: remove "add" match from usb device node rule --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 5b56e4b983..9b7f7207d1 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -51,7 +51,7 @@ KERNEL=="video1394*", NAME="video1394/%n" SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" # libusb device nodes -SUBSYSTEM=="usb", ACTION=="add", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" # printer KERNEL=="parport[0-9]*", GROUP="lp" -- cgit v1.2.3-54-g00ecf From 11ddcbf7b4ea0f82f53a34d0b0d75adf84dc3266 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Oct 2008 16:41:27 +0100 Subject: edd_id: add "change" event match --- extras/edd_id/61-persistent-storage-edd.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/edd_id/61-persistent-storage-edd.rules b/extras/edd_id/61-persistent-storage-edd.rules index b430fe9fd8..bd020b7172 100644 --- a/extras/edd_id/61-persistent-storage-edd.rules +++ b/extras/edd_id/61-persistent-storage-edd.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add", GOTO="persistent_storage_edd_end" +ACTION!="add|change", GOTO="persistent_storage_edd_end" SUBSYSTEM!="block", GOTO="persistent_storage_edd_end" KERNEL!="sd*|hd*", GOTO="persistent_storage_edd_end" -- cgit v1.2.3-54-g00ecf From bf182702221411e68cec79305adaa79df7518cf4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 30 Oct 2008 16:41:47 +0100 Subject: fstab_import: add "change" event match --- extras/fstab_import/79-fstab_import.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/fstab_import/79-fstab_import.rules b/extras/fstab_import/79-fstab_import.rules index 44accde482..2adfe04c73 100644 --- a/extras/fstab_import/79-fstab_import.rules +++ b/extras/fstab_import/79-fstab_import.rules @@ -1,2 +1,2 @@ -ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem|other", IMPORT="fstab_import $name $links mapper/$env{DM_NAME}" +ACTION=="add|change", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem|other", IMPORT="fstab_import $name $links mapper/$env{DM_NAME}" -- cgit v1.2.3-54-g00ecf From 27691aa3ae65b2162e12b5f1d657363908263e12 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 31 Oct 2008 16:22:55 +0100 Subject: write trace log to stderr --- udev/udev-event.c | 2 +- udev/udevd.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 79a4cde651..a6459eb8d9 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -707,7 +707,7 @@ int udev_event_execute_run(struct udev_event *event) util_strlcpy(program, cmd, sizeof(program)); udev_event_apply_format(event, program, sizeof(program)); if (event->trace) - printf("run %s (%llu) '%s'\n", + fprintf(stderr, "run %s (%llu) '%s'\n", udev_device_get_syspath(event->dev), udev_device_get_seqnum(event->dev), program); diff --git a/udev/udevd.c b/udev/udevd.c index 6f2e188cea..9096f9505b 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -180,7 +180,7 @@ static void event_fork(struct udev_event *event) if (debug_trace) { event->trace = 1; - printf("fork %s (%llu)\n", + fprintf(stderr, "fork %s (%llu)\n", udev_device_get_syspath(event->dev), udev_device_get_seqnum(event->dev)); } @@ -538,7 +538,7 @@ static void udev_done(int pid, int exitstatus) exitstatus, time(NULL) - loop_event->queue_time); loop_event->exitstatus = exitstatus; if (debug_trace) - printf("exit %s (%llu)\n", + fprintf(stderr, "exit %s (%llu)\n", udev_device_get_syspath(loop_event->dev), udev_device_get_seqnum(loop_event->dev)); event_queue_delete(loop_event); -- cgit v1.2.3-54-g00ecf From 11ae7578505caa8df5604c6c86c82e9558439b30 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sat, 1 Nov 2008 16:09:16 +0000 Subject: udevd: fix termination of rule execution LAST_RULE was broken, and I broke TK_END by making it do the same. It used a "break" which exited the switch statement, but not the loop! ==2953== Invalid read of size 4 ==2953== at 0x4081EE: dump_token (udev-rules.c:859) ==2953== by 0x40BADB: udev_rules_apply_to_event (udev-rules.c:1849) ==2953== by 0x403F17: udev_event_execute_rules (udev-event.c:554) ==2953== by 0x418626: main (test-udev.c:100) ==2953== Address 0x55ab1f8 is 0 bytes after a block of size 80 alloc'd ==2953== at 0x4C23082: realloc (vg_replace_malloc.c:429) ==2953== by 0x40B13B: udev_rules_new (udev-rules.c:1670) ==2953== by 0x418536: main (test-udev.c:84) ... Signed-off-by: Alan Jenkins --- udev/udev-rules.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index f6cc45ba75..77029f7bec 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2319,7 +2319,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event continue; case TK_A_LAST_RULE: case TK_END: - break; + return 0; case TK_M_PARENTS_MAX: case TK_M_MAX: @@ -2334,9 +2334,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* fast-forward to next rule */ idx = rule->rule.next_rule; if (idx == 0) - break; + return 0; dbg(rules->udev, "forward to rule: %u\n", idx); cur = &rules->tokens[idx]; } - return 0; } -- cgit v1.2.3-54-g00ecf From d15fcce4b3e90a27eb911bd954efd07219c1c9db Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sat, 1 Nov 2008 17:32:16 +0100 Subject: udevd: be more careful when matching against parents I'm worried about what will happen with things like KERNELS=="*" # pointless rule KERNELS=="doesnt-match" # another pointless rule Since TK_RULE < TK_M_PARENTS_MAX, we will try to match all three tokens against parents of the current device. I can't think of a bad case, but it's not exactly good either. Signed-off-by: Alan Jenkins --- udev/udev-rules.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 77029f7bec..e1307252d8 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -93,6 +93,7 @@ enum token_type { TK_M_WAITFOR, /* val */ TK_M_ATTR, /* val, attr */ + TK_M_PARENTS_MIN, TK_M_KERNELS, /* val */ TK_M_SUBSYSTEMS, /* val */ TK_M_DRIVERS, /* val */ @@ -146,6 +147,7 @@ static const char *token_str[] = { [TK_M_WAITFOR] = "M WAITFOR", [TK_M_ATTR] = "M ATTR", + [TK_M_PARENTS_MIN] = "M PARENTS_MIN", [TK_M_KERNELS] = "M KERNELS", [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", [TK_M_DRIVERS] = "M DRIVERS", @@ -806,6 +808,7 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, token->key.event_timeout = *(int *)data; break; case TK_RULE: + case TK_M_PARENTS_MIN: case TK_M_PARENTS_MAX: case TK_M_MAX: case TK_END: @@ -943,6 +946,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_END: dbg(rules->udev, "* %s\n", token_str[type]); break; + case TK_M_PARENTS_MIN: case TK_M_PARENTS_MAX: case TK_M_MAX: case TK_UNSET: @@ -1937,7 +1941,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* get whole sequence of parent matches */ next = cur; - while (next->type < TK_M_PARENTS_MAX) + while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX) next++; /* loop over parents */ @@ -2321,6 +2325,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_END: return 0; + case TK_M_PARENTS_MIN: case TK_M_PARENTS_MAX: case TK_M_MAX: case TK_UNSET: -- cgit v1.2.3-54-g00ecf From 0ef254d5800c0c0dabfaf943886a47731784a955 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 1 Nov 2008 18:34:54 +0100 Subject: log rules file and line number when NAME, SYMLINK, OWNER, GROUP, MODE, RUN is applied --- udev/udev-rules.c | 189 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 122 insertions(+), 67 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index e1307252d8..b5fe2f468b 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -186,15 +186,21 @@ static const char *token_str[] = { [TK_END] = "END", }; +/* we try to pack stuff in a way that we take only 16 bytes per token */ struct token { - enum token_type type; union { + unsigned short type; /* same as in rule and key */ struct { + unsigned short type; + unsigned short flags; unsigned int next_rule; unsigned int label_off; - unsigned int filename_off; + unsigned short filename_off; + unsigned short filename_line; } rule; struct { + unsigned short type; + unsigned short flags; unsigned short op; unsigned short glob; unsigned int value_off; @@ -254,7 +260,7 @@ struct udev_rules { unsigned int gids_max; }; -/* NOTE: we could lookup and return existing strings, or tails of strings */ +/* we could lookup and return existing strings, or tails of strings */ static int add_string(struct udev_rules *rules, const char *str) { size_t len = strlen(str)+1; @@ -731,9 +737,9 @@ static char *get_key_attribute(struct udev *udev, char *str) return NULL; } -static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, - enum operation_type op, - const char *value, const void *data) +static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, + enum operation_type op, + const char *value, const void *data) { struct token *token = &rule_tmp->token[rule_tmp->token_cur]; const char *attr = data; @@ -844,7 +850,7 @@ static int rule_add_token(struct rule_tmp *rule_tmp, enum token_type type, } } - token->type = type; + token->key.type = type; token->key.op = op; token->key.glob = glob; rule_tmp->token_cur++; @@ -871,8 +877,8 @@ static void dump_token(struct udev_rules *rules, struct token *token) const char *tk_ptr = (char *)token; unsigned int off = tk_ptr - tks_ptr; - dbg(rules->udev, "* RULE '%s', off: %u(%u), next: %u, label: '%s'\n", - &rules->buf[token->rule.filename_off], + dbg(rules->udev, "* RULE %s:%u, off: %u(%u), next: %u, label: '%s'\n", + &rules->buf[token->rule.filename_off], token->rule.filename_line, off / (unsigned int) sizeof(struct token), off, token->rule.next_rule, &rules->buf[token->rule.label_off]); @@ -1020,6 +1026,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_tmp.rules = rules; rule_tmp.rule.type = TK_RULE; rule_tmp.rule.rule.filename_off = filename_off; + rule_tmp.rule.rule.filename_line = lineno; linepos = line; while (1) { @@ -1035,7 +1042,7 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "invalid ACTION operation\n"); goto invalid; } - rule_add_token(&rule_tmp, TK_M_ACTION, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_ACTION, op, value, NULL); valid = 1; continue; } @@ -1045,7 +1052,7 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "invalid DEVPATH operation\n"); goto invalid; } - rule_add_token(&rule_tmp, TK_M_DEVPATH, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_DEVPATH, op, value, NULL); valid = 1; continue; } @@ -1055,7 +1062,7 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "invalid KERNEL operation\n"); goto invalid; } - rule_add_token(&rule_tmp, TK_M_KERNEL, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_KERNEL, op, value, NULL); valid = 1; continue; } @@ -1072,9 +1079,9 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) err(rules->udev, "'%s' must be specified as 'subsystem' \n" "please fix it in %s:%u", value, filename, lineno); - rule_add_token(&rule_tmp, TK_M_SUBSYSTEM, op, "subsystem|class|bus", NULL); + rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, "subsystem|class|bus", NULL); } else - rule_add_token(&rule_tmp, TK_M_SUBSYSTEM, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, value, NULL); valid = 1; continue; } @@ -1084,7 +1091,7 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "invalid DRIVER operation\n"); goto invalid; } - rule_add_token(&rule_tmp, TK_M_DRIVER, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_DRIVER, op, value, NULL); valid = 1; continue; } @@ -1096,9 +1103,9 @@ static int add_rule(struct udev_rules *rules, char *line, goto invalid; } if (op < OP_MATCH_MAX) { - rule_add_token(&rule_tmp, TK_M_ATTR, op, value, attr); + rule_add_key(&rule_tmp, TK_M_ATTR, op, value, attr); } else { - rule_add_token(&rule_tmp, TK_A_ATTR, op, value, attr); + rule_add_key(&rule_tmp, TK_A_ATTR, op, value, attr); } valid = 1; continue; @@ -1110,7 +1117,7 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "invalid KERNELS operation\n"); goto invalid; } - rule_add_token(&rule_tmp, TK_M_KERNELS, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL); valid = 1; continue; } @@ -1121,7 +1128,7 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "invalid SUBSYSTEMS operation\n"); goto invalid; } - rule_add_token(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); valid = 1; continue; } @@ -1131,7 +1138,7 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "invalid DRIVERS operation\n"); goto invalid; } - rule_add_token(&rule_tmp, TK_M_DRIVERS, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_DRIVERS, op, value, NULL); valid = 1; continue; } @@ -1153,7 +1160,7 @@ static int add_rule(struct udev_rules *rules, char *line, else if (strstr(attr, "../") != NULL) err(rules->udev, "do not reference parent sysfs directories directly, " "it may break with a future kernel, please fix it in %s:%u", filename, lineno); - rule_add_token(&rule_tmp, TK_M_ATTRS, op, value, attr); + rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr); valid = 1; continue; } @@ -1167,10 +1174,10 @@ static int add_rule(struct udev_rules *rules, char *line, if (strncmp(attr, "PHYSDEV", 7) == 0) physdev = 1; if (op < OP_MATCH_MAX) { - if (rule_add_token(&rule_tmp, TK_M_ENV, op, value, attr) != 0) + if (rule_add_key(&rule_tmp, TK_M_ENV, op, value, attr) != 0) goto invalid; } else { - if (rule_add_token(&rule_tmp, TK_A_ENV, op, value, attr) != 0) + if (rule_add_key(&rule_tmp, TK_A_ENV, op, value, attr) != 0) goto invalid; } valid = 1; @@ -1178,7 +1185,7 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcasecmp(key, "PROGRAM") == 0) { - rule_add_token(&rule_tmp, TK_M_PROGRAM, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_PROGRAM, op, value, NULL); valid = 1; continue; } @@ -1188,7 +1195,7 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "invalid RESULT operation\n"); goto invalid; } - rule_add_token(&rule_tmp, TK_M_RESULT, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_RESULT, op, value, NULL); valid = 1; continue; } @@ -1197,15 +1204,15 @@ static int add_rule(struct udev_rules *rules, char *line, attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1); if (attr != NULL && strstr(attr, "program")) { dbg(rules->udev, "IMPORT will be executed\n"); - rule_add_token(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); valid = 1; } else if (attr != NULL && strstr(attr, "file")) { dbg(rules->udev, "IMPORT will be included as file\n"); - rule_add_token(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); valid = 1; } else if (attr != NULL && strstr(attr, "parent")) { dbg(rules->udev, "IMPORT will include the parent values\n"); - rule_add_token(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); valid = 1; } else { /* figure it out if it is executable */ @@ -1230,11 +1237,11 @@ static int add_rule(struct udev_rules *rules, char *line, dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { dbg(rules->udev, "IMPORT will be executed (autotype)\n"); - rule_add_token(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); valid = 1; } else { dbg(rules->udev, "IMPORT will be included as file (autotype)\n"); - rule_add_token(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); valid = 1; } } @@ -1251,9 +1258,9 @@ static int add_rule(struct udev_rules *rules, char *line, attr = get_key_attribute(rules->udev, key + sizeof("TEST")-1); if (attr != NULL) { mode = strtol(attr, NULL, 8); - rule_add_token(&rule_tmp, TK_M_TEST, op, value, &mode); + rule_add_key(&rule_tmp, TK_M_TEST, op, value, &mode); } else { - rule_add_token(&rule_tmp, TK_M_TEST, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_TEST, op, value, NULL); } valid = 1; continue; @@ -1265,13 +1272,13 @@ static int add_rule(struct udev_rules *rules, char *line, attr = get_key_attribute(rules->udev, key + sizeof("RUN")-1); if (attr != NULL && strstr(attr, "ignore_error")) flag = 1; - rule_add_token(&rule_tmp, TK_A_RUN, op, value, &flag); + rule_add_key(&rule_tmp, TK_A_RUN, op, value, &flag); valid = 1; continue; } if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { - rule_add_token(&rule_tmp, TK_M_WAITFOR, 0, value, NULL); + rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL); valid = 1; continue; } @@ -1283,29 +1290,29 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcasecmp(key, "GOTO") == 0) { - rule_add_token(&rule_tmp, TK_A_GOTO, 0, value, NULL); + rule_add_key(&rule_tmp, TK_A_GOTO, 0, value, NULL); valid = 1; continue; } if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { if (op < OP_MATCH_MAX) { - rule_add_token(&rule_tmp, TK_M_NAME, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL); } else { if (value[0] == '\0') dbg(rules->udev, "name empty, node creation suppressed\n"); - rule_add_token(&rule_tmp, TK_A_NAME, op, value, NULL); + rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); attr = get_key_attribute(rules->udev, key + sizeof("NAME")-1); if (attr != NULL) { if (strstr(attr, "all_partitions") != NULL) { int num = DEFAULT_FAKE_PARTITIONS_COUNT; dbg(rules->udev, "creation of partition nodes requested\n"); - rule_add_token(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num); + rule_add_key(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num); } if (strstr(attr, "ignore_remove") != NULL) { dbg(rules->udev, "remove event should be ignored\n"); - rule_add_token(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); + rule_add_key(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); } } } @@ -1314,9 +1321,9 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcasecmp(key, "SYMLINK") == 0) { if (op < OP_MATCH_MAX) - rule_add_token(&rule_tmp, TK_M_DEVLINK, op, value, NULL); + rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL); else - rule_add_token(&rule_tmp, TK_A_DEVLINK, op, value, NULL); + rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, NULL); valid = 1; continue; } @@ -1327,12 +1334,12 @@ static int add_rule(struct udev_rules *rules, char *line, uid = strtoul(value, &endptr, 10); if (endptr[0] == '\0') { - rule_add_token(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); + rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); } else if (rules->resolve_names && strchr("$%", value[0]) == NULL) { uid = add_uid(rules, value); - rule_add_token(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); + rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); } else { - rule_add_token(&rule_tmp, TK_A_OWNER, op, value, NULL); + rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL); } valid = 1; continue; @@ -1344,12 +1351,12 @@ static int add_rule(struct udev_rules *rules, char *line, gid = strtoul(value, &endptr, 10); if (endptr[0] == '\0') { - rule_add_token(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); + rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); } else if (rules->resolve_names && strchr("$%", value[0]) == NULL) { gid = add_gid(rules, value); - rule_add_token(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); + rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); } else { - rule_add_token(&rule_tmp, TK_A_GROUP, op, value, NULL); + rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL); } valid = 1; continue; @@ -1361,9 +1368,9 @@ static int add_rule(struct udev_rules *rules, char *line, mode = strtol(value, &endptr, 8); if (endptr[0] == '\0') - rule_add_token(&rule_tmp, TK_A_MODE_ID, op, NULL, &mode); + rule_add_key(&rule_tmp, TK_A_MODE_ID, op, NULL, &mode); else - rule_add_token(&rule_tmp, TK_A_MODE, op, value, NULL); + rule_add_key(&rule_tmp, TK_A_MODE, op, value, NULL); valid = 1; continue; } @@ -1373,42 +1380,42 @@ static int add_rule(struct udev_rules *rules, char *line, if (strstr(value, "last_rule") != NULL) { dbg(rules->udev, "last rule to be applied\n"); - rule_add_token(&rule_tmp, TK_A_LAST_RULE, 0, NULL, NULL); + rule_add_key(&rule_tmp, TK_A_LAST_RULE, 0, NULL, NULL); } if (strstr(value, "ignore_device") != NULL) { dbg(rules->udev, "device should be ignored\n"); - rule_add_token(&rule_tmp, TK_A_IGNORE_DEVICE, 0, NULL, NULL); + rule_add_key(&rule_tmp, TK_A_IGNORE_DEVICE, 0, NULL, NULL); } if (strstr(value, "ignore_remove") != NULL) { dbg(rules->udev, "remove event should be ignored\n"); - rule_add_token(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); + rule_add_key(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); } pos = strstr(value, "link_priority="); if (pos != NULL) { int prio = atoi(&pos[strlen("link_priority=")]); - rule_add_token(&rule_tmp, TK_A_DEVLINK_PRIO, 0, NULL, &prio); + rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, 0, NULL, &prio); dbg(rules->udev, "link priority=%i\n", prio); } pos = strstr(value, "event_timeout="); if (pos != NULL) { int tout = atoi(&pos[strlen("event_timeout=")]); - rule_add_token(&rule_tmp, TK_A_EVENT_TIMEOUT, 0, NULL, &tout); + rule_add_key(&rule_tmp, TK_A_EVENT_TIMEOUT, 0, NULL, &tout); dbg(rules->udev, "event timout=%i\n", tout); } pos = strstr(value, "string_escape="); if (pos != NULL) { pos = &pos[strlen("string_escape=")]; if (strncmp(pos, "none", strlen("none")) == 0) - rule_add_token(&rule_tmp, TK_A_STRING_ESCAPE_NONE, 0, NULL, NULL); + rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_NONE, 0, NULL, NULL); else if (strncmp(pos, "replace", strlen("replace")) == 0) - rule_add_token(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, 0, NULL, NULL); + rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, 0, NULL, NULL); } if (strstr(value, "all_partitions") != NULL) { int num = DEFAULT_FAKE_PARTITIONS_COUNT; - rule_add_token(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num); + rule_add_key(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num); dbg(rules->udev, "creation of partition nodes requested\n"); } valid = 1; @@ -1438,10 +1445,9 @@ invalid: return -1; } -static int parse_file(struct udev_rules *rules, const char *filename) +static int parse_file(struct udev_rules *rules, const char *filename, unsigned short filename_off) { FILE *f; - unsigned int filename_off; unsigned int first_token; char line[UTIL_LINE_SIZE]; int line_nr = 0; @@ -1453,7 +1459,6 @@ static int parse_file(struct udev_rules *rules, const char *filename) if (f == NULL) return -1; - filename_off = add_string(rules, filename); first_token = rules->token_cur; while(fgets(line, sizeof(line), f) != NULL) { @@ -1558,7 +1563,6 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { struct udev_rules *rules; struct stat statbuf; - char filename[PATH_MAX]; struct udev_list_node file_list; struct udev_list_entry *file_loop, *file_tmp; unsigned int prev_rule; @@ -1592,6 +1596,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) /* custom rules location for testing */ add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); } else { + char filename[PATH_MAX]; struct udev_list_node sort_list; struct udev_list_entry *sort_loop, *sort_tmp; @@ -1642,14 +1647,26 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) } } + /* add all filenames to the string buffer */ + udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { + const char *filename = udev_list_entry_get_name(file_loop); + unsigned int filename_off; + + filename_off = add_string(rules, filename); + /* the offset in the rule is limited to unsigned short */ + if (filename_off < USHRT_MAX) + udev_list_entry_set_flag(file_loop, filename_off); + } + /* parse list of files */ udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { - const char *file_name = udev_list_entry_get_name(file_loop); + const char *filename = udev_list_entry_get_name(file_loop); + unsigned int filename_off = udev_list_entry_get_flag(file_loop); - if (stat(file_name, &statbuf) == 0 && statbuf.st_size > 0) - parse_file(rules, file_name); + if (stat(filename, &statbuf) == 0 && statbuf.st_size > 0) + parse_file(rules, filename, filename_off); else - info(udev, "can not read '%s'\n", file_name); + info(udev, "can not read '%s'\n", filename); udev_list_entry_remove(file_loop); } @@ -2120,6 +2137,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(owner, &rules->buf[cur->key.value_off], sizeof(owner)); udev_event_apply_format(event, owner, sizeof(owner)); event->uid = util_lookup_user(event->udev, owner); + info(event->udev, "OWNER %u %s:%u\n", + event->uid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); break; } case TK_A_GROUP: @@ -2133,6 +2154,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(group, &rules->buf[cur->key.value_off], sizeof(group)); udev_event_apply_format(event, group, sizeof(group)); event->gid = util_lookup_group(event->udev, group); + info(event->udev, "GROUP %u %s:%u\n", + event->gid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); break; } case TK_A_MODE: @@ -2151,6 +2176,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event err(event->udev, "invalide mode '%s' set default mode 0660\n", mode); event->mode = 0660; } + info(event->udev, "MODE %#o %s:%u\n", + event->mode, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); break; } case TK_A_OWNER_ID: @@ -2159,6 +2188,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (cur->key.op == OP_ASSIGN_FINAL) event->owner_final = 1; event->uid = cur->key.uid; + info(event->udev, "OWNER %u %s:%u\n", + event->uid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); break; case TK_A_GROUP_ID: if (event->group_final) @@ -2166,6 +2199,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (cur->key.op == OP_ASSIGN_FINAL) event->group_final = 1; event->gid = cur->key.gid; + info(event->udev, "GROUP %u %s:%u\n", + event->gid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); break; case TK_A_MODE_ID: if (event->mode_final) @@ -2173,6 +2210,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (cur->key.op == OP_ASSIGN_FINAL) event->mode_final = 1; event->mode = cur->key.mode; + info(event->udev, "MODE %#o %s:%u\n", + event->mode, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); break; case TK_A_ENV: { @@ -2216,6 +2257,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event info(event->udev, "%i character(s) replaced\n", count); free(event->name); event->name = strdup(name_str); + info(event->udev, "NAME '%s' %s:%u\n", + event->name, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); } break; } @@ -2251,7 +2296,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event next = strchr(pos, ' '); while (next) { next[0] = '\0'; - info(event->udev, "add symlink '%s'\n", pos); + info(event->udev, "LINK '%s' %s:%u\n", + pos, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); util_strlcat(filename, "/", sizeof(filename)); util_strlcat(filename, pos, sizeof(filename)); @@ -2262,7 +2310,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event next = strchr(pos, ' '); } if (pos[0] != '\0') { - info(event->udev, "add symlink '%s'\n", pos); + info(event->udev, "LINK '%s' %s:%u\n", + pos, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); util_strlcat(filename, "/", sizeof(filename)); util_strlcat(filename, pos, sizeof(filename)); @@ -2312,6 +2363,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) udev_list_cleanup_entries(event->udev, &event->run_list); + info(event->udev, "RUN '%s' %s:%u\n", + &rules->buf[cur->key.value_off], + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); list_entry = udev_list_entry_add(event->udev, &event->run_list, &rules->buf[cur->key.value_off], NULL, 1, 0); if (cur->key.ignore_error) -- cgit v1.2.3-54-g00ecf From 00f98bd2b3cc8205ec70e2b1a6fc2132dba3d9ba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 1 Nov 2008 19:12:20 +0100 Subject: skip entire rule containing device naming keys, if no device can be named If rules set NAME, SYMLINK, OWNER, GROUP, MODE, events without a device node and remove events will skip the entire rule. The old parser did the same. --- TODO | 1 + udev/udev-rules.c | 19 +++++++++++++++++-- udev/udevd.c | 1 - 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index a8d3fc0515..ac0618ec16 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ + o drop pnp shell script, acpi will take care of loading pnp modules o add DVB variables to kernel (patch sent), and drop shell script rule o DEVTYPE for disks is set by the kernel, they will be removed from the default rules diff --git a/udev/udev-rules.c b/udev/udev-rules.c index b5fe2f468b..d1c02e9204 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -877,11 +877,12 @@ static void dump_token(struct udev_rules *rules, struct token *token) const char *tk_ptr = (char *)token; unsigned int off = tk_ptr - tks_ptr; - dbg(rules->udev, "* RULE %s:%u, off: %u(%u), next: %u, label: '%s'\n", + dbg(rules->udev, "* RULE %s:%u, off: %u(%u), next: %u, label: '%s', flags: 0x%02x\n", &rules->buf[token->rule.filename_off], token->rule.filename_line, off / (unsigned int) sizeof(struct token), off, token->rule.next_rule, - &rules->buf[token->rule.label_off]); + &rules->buf[token->rule.label_off], + token->rule.flags); break; } case TK_M_ACTION: @@ -1316,6 +1317,7 @@ static int add_rule(struct udev_rules *rules, char *line, } } } + rule_tmp.rule.rule.flags = 1; continue; } @@ -1324,6 +1326,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL); else rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, NULL); + rule_tmp.rule.rule.flags = 1; valid = 1; continue; } @@ -1341,6 +1344,7 @@ static int add_rule(struct udev_rules *rules, char *line, } else { rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL); } + rule_tmp.rule.rule.flags = 1; valid = 1; continue; } @@ -1358,6 +1362,7 @@ static int add_rule(struct udev_rules *rules, char *line, } else { rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL); } + rule_tmp.rule.rule.flags = 1; valid = 1; continue; } @@ -1371,6 +1376,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_MODE_ID, op, NULL, &mode); else rule_add_key(&rule_tmp, TK_A_MODE, op, value, NULL); + rule_tmp.rule.rule.flags = 1; valid = 1; continue; } @@ -1856,10 +1862,16 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event struct token *cur; struct token *rule; enum escape_type esc = ESCAPE_UNSET; + int can_set_name; if (rules->tokens == NULL) return -1; + can_set_name = ((strcmp(udev_device_get_action(event->dev), "add") == 0 || + strcmp(udev_device_get_action(event->dev), "change") == 0) && + (major(udev_device_get_devnum(event->dev)) > 0 || + strcmp(udev_device_get_subsystem(event->dev), "net") == 0)); + /* loop through token list, match, run actions or forward to next rule */ cur = &rules->tokens[0]; rule = cur; @@ -1871,6 +1883,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_RULE: /* current rule */ rule = cur; + /* possibly skip rules which want to set NAME, SYMLINK, OWNER, GROUP, MODE */ + if (!can_set_name && rule->rule.flags) + ;//goto nomatch; esc = ESCAPE_UNSET; break; case TK_M_ACTION: diff --git a/udev/udevd.c b/udev/udevd.c index 9096f9505b..405a1ed907 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -430,7 +430,6 @@ static void event_queue_manager(struct udev *udev) continue; } - /* do dendencies, start event */ event_fork(loop_event); dbg(udev, "moved seq %llu to running list\n", udev_device_get_seqnum(loop_event->dev)); } -- cgit v1.2.3-54-g00ecf From 5755d586e17d7397ddf255e4483e01039cb38d1d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 1 Nov 2008 20:05:41 +0100 Subject: fix udev_node_update_old_links() logic No need to check if links that still belong to us, need to be updated. --- udev/udev-node.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index e402dc9de3..ae343eb2da 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -52,13 +52,13 @@ static int name_index(struct udev *udev, const char *devpath, const char *name, util_strlcat(filename, device, sizeof(filename)); if (add) { - info(udev, "creating index: '%s'\n", filename); + dbg(udev, "creating index: '%s'\n", filename); util_create_path(udev, filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd > 0) close(fd); } else { - info(udev, "removing index: '%s'\n", filename); + dbg(udev, "removing index: '%s'\n", filename); unlink(filename); util_delete_path(udev, filename); } @@ -185,7 +185,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) } else if (S_ISLNK(stats.st_mode)) { char buf[UTIL_PATH_SIZE]; - info(udev, "found existing symlink '%s'\n", slink); + dbg(udev, "found existing symlink '%s'\n", slink); len = readlink(slink, buf, sizeof(buf)); if (len > 0) { buf[len] = '\0'; @@ -241,11 +241,11 @@ static int name_index_get_devices(struct udev *udev, const char *name, struct ud util_path_encode(&dirname[start], sizeof(dirname) - start); dir = opendir(dirname); if (dir == NULL) { - info(udev, "no index directory '%s': %m\n", dirname); + dbg(udev, "no index directory '%s': %m\n", dirname); count = -1; goto out; } - info(udev, "found index directory '%s'\n", dirname); + dbg(udev, "found index directory '%s'\n", dirname); while (1) { struct dirent *ent; @@ -278,11 +278,12 @@ static int update_link(struct udev_device *dev, const char *slink, int test) int priority = 0; int rc = 0; - info(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); + dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); udev_list_init(&dev_list); count = name_index_get_devices(udev, slink, &dev_list); - info(udev, "found %i devices with name '%s'\n", count, slink); + if (count > 1) + info(udev, "found %i devices with name '%s'\n", count, slink); /* if we don't have a reference, delete it */ if (count <= 0) { @@ -302,12 +303,12 @@ static int update_link(struct udev_device *dev, const char *slink, int test) const char *devnode; syspath = udev_list_entry_get_name(dev_entry); - info(udev, "found '%s' for '%s'\n", syspath, slink); + dbg(udev, "found '%s' for '%s'\n", syspath, slink); /* did we find ourself? we win, if we have the same priority */ if (strcmp(udev_device_get_syspath(dev), syspath) == 0) { - info(udev, "compare (our own) priority of '%s' %i >= %i\n", - udev_device_get_devpath(dev), udev_device_get_devlink_priority(dev), priority); + dbg(udev, "compare (our own) priority of '%s' %i >= %i\n", + udev_device_get_devpath(dev), udev_device_get_devlink_priority(dev), priority); if (strcmp(udev_device_get_devnode(dev), slink) == 0) { info(udev, "'%s' is our device node, database inconsistent, skip link update\n", udev_device_get_devnode(dev)); @@ -328,10 +329,10 @@ static int update_link(struct udev_device *dev, const char *slink, int test) info(udev, "'%s' is a device node of '%s', skip link update\n", devnode, syspath); } else { - info(udev, "compare priority of '%s' %i > %i\n", - udev_device_get_devpath(dev_db), - udev_device_get_devlink_priority(dev_db), - priority); + dbg(udev, "compare priority of '%s' %i > %i\n", + udev_device_get_devpath(dev_db), + udev_device_get_devlink_priority(dev_db), + priority); if (target[0] == '\0' || udev_device_get_devlink_priority(dev_db) > priority) { priority = udev_device_get_devlink_priority(dev_db); util_strlcpy(target, devnode, sizeof(target)); @@ -367,12 +368,18 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev /* update possible left-over symlinks */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { struct udev_list_entry *list_entry_current; + int found; + found = 0; udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { if (strcmp(udev_list_entry_get_name(list_entry_current), - udev_list_entry_get_name(list_entry)) == 0) - continue; + udev_list_entry_get_name(list_entry)) == 0) { + found = 1; + break; + } } + if (found) + continue; /* link does no longer belong to this device */ info(udev, "update old symlink '%s' no longer belonging to '%s'\n", udev_list_entry_get_name(list_entry), udev_device_get_devpath(dev)); -- cgit v1.2.3-54-g00ecf From 86b5778857522087e74182f26f0e565adea0c699 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 1 Nov 2008 20:16:24 +0100 Subject: move some info() to dbg() --- udev/lib/libudev-ctrl.c | 4 ++-- udev/lib/libudev-device.c | 32 ++++++++++++++++---------------- udev/lib/libudev-enumerate.c | 16 ++++++++-------- udev/lib/libudev-list.c | 6 +++--- udev/lib/libudev-monitor.c | 10 +++++----- udev/lib/libudev-queue.c | 18 +++++++++--------- udev/lib/libudev-util.c | 2 +- udev/lib/libudev.c | 14 +++++++------- udev/udev-rules.c | 24 +++++++++++++----------- 9 files changed, 64 insertions(+), 62 deletions(-) diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c index 2e15db0be0..caf0dc08a3 100644 --- a/udev/lib/libudev-ctrl.c +++ b/udev/lib/libudev-ctrl.c @@ -250,7 +250,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) goto err; } - info(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); + dbg(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); return uctrl_msg; err: udev_ctrl_msg_unref(uctrl_msg); @@ -272,7 +272,7 @@ void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) ctrl_msg->refcount--; if (ctrl_msg->refcount > 0) return; - info(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + dbg(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); free(ctrl_msg); } diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 3f8ee1071c..e9d040cdfc 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -87,7 +87,7 @@ int udev_device_read_db(struct udev_device *udev_device) devpath_to_db_path(udev_device->udev, udev_device->devpath, filename, sizeof(filename)); if (lstat(filename, &stats) != 0) { - info(udev_device->udev, "no db file to read %s: %m\n", filename); + dbg(udev_device->udev, "no db file to read %s: %m\n", filename); return -1; } if ((stats.st_mode & S_IFMT) == S_IFLNK) { @@ -100,7 +100,7 @@ int udev_device_read_db(struct udev_device *udev_device) if (target_len > 0) target[target_len] = '\0'; else { - info(udev_device->udev, "error reading db link %s: %m\n", filename); + dbg(udev_device->udev, "error reading db link %s: %m\n", filename); return -1; } @@ -134,7 +134,7 @@ int udev_device_read_db(struct udev_device *udev_device) f = fopen(filename, "r"); if (f == NULL) { - info(udev_device->udev, "error reading db file %s: %m\n", filename); + dbg(udev_device->udev, "error reading db file %s: %m\n", filename); return -1; } while (fgets(line, sizeof(line), f)) { @@ -252,7 +252,7 @@ struct udev_device *device_new(struct udev *udev) udev_device_add_property(udev_device, udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - info(udev_device->udev, "udev_device: %p created\n", udev_device); + dbg(udev_device->udev, "udev_device: %p created\n", udev_device); return udev_device; } @@ -295,7 +295,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * subdir = &syspath[len+1]; pos = strrchr(subdir, '/'); if (pos == NULL || pos < &subdir[2]) { - info(udev, "not a subdir :%s\n", syspath); + dbg(udev, "not a subdir :%s\n", syspath); return NULL; } @@ -330,13 +330,13 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * util_strlcpy(file, path, sizeof(file)); util_strlcat(file, "/uevent", sizeof(file)); if (stat(file, &statbuf) != 0) { - info(udev, "not a device: %s\n", syspath); + dbg(udev, "not a device: %s\n", syspath); return NULL; } } else { /* everything else just needs to be a directory */ if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) { - info(udev, "directory not found: %s\n", syspath); + dbg(udev, "directory not found: %s\n", syspath); return NULL; } } @@ -531,7 +531,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) udev_device->parent_device = device_new_from_parent(udev_device); } if (udev_device->parent_device != NULL) - info(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); + dbg(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); return udev_device->parent_device; } @@ -612,7 +612,7 @@ void udev_device_unref(struct udev_device *udev_device) udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); free(udev_device->envp); free(udev_device->monitor_buf); - info(udev_device->udev, "udev_device: %p released\n", udev_device); + dbg(udev_device->udev, "udev_device: %p released\n", udev_device); free(udev_device); } @@ -840,8 +840,8 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const /* look for possibly already cached result */ udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_list)) { if (strcmp(udev_list_entry_get_name(list_entry), sysattr) == 0) { - info(udev_device->udev, "got '%s' (%s) from cache\n", - sysattr, udev_list_entry_get_value(list_entry)); + dbg(udev_device->udev, "got '%s' (%s) from cache\n", + sysattr, udev_list_entry_get_value(list_entry)); return udev_list_entry_get_value(list_entry); } } @@ -851,7 +851,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const util_strlcat(path, sysattr, sizeof(path)); if (lstat(path, &statbuf) != 0) { - info(udev_device->udev, "no attribute '%s', keep negative entry\n", path); + dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, NULL, 0, 0); goto out; } @@ -868,7 +868,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const pos = strrchr(target, '/'); if (pos != NULL) { pos = &pos[1]; - info(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); + dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0); val = udev_list_entry_get_value(list_entry); } @@ -887,7 +887,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const /* read attribute value */ fd = open(path, O_RDONLY); if (fd < 0) { - info(udev_device->udev, "attribute '%s' can not be opened\n", path); + dbg(udev_device->udev, "attribute '%s' can not be opened\n", path); goto out; } size = read(fd, value, sizeof(value)); @@ -900,7 +900,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const /* got a valid value, store it in cache and return it */ value[size] = '\0'; util_remove_trailing_chars(value, '\n'); - info(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); + dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, value, 0, 0); val = udev_list_entry_get_value(list_entry); out: @@ -1072,7 +1072,7 @@ static int update_envp_monitor_buf(struct udev_device *udev_device) udev_device->envp[i] = NULL; udev_device->monitor_buf_len = bufpos; udev_device->envp_uptodate = 1; - info(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", i, bufpos); + dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", i, bufpos); return 0; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index e5a4ccee3b..1b40d63484 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -310,7 +310,7 @@ static int devices_delay(struct udev *udev, const char *syspath) len = strlen(udev_get_sys_path(udev)); for (i = 0; delay_device_list[i] != NULL; i++) { if (strstr(&syspath[len], delay_device_list[i]) != NULL) { - info(udev, "delaying: %s\n", syspath); + dbg(udev, "delaying: %s\n", syspath); return 1; } } @@ -368,23 +368,23 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) util_strlcat(base, "/subsystem", sizeof(base)); if (stat(base, &statbuf) == 0) { /* we have /subsystem/, forget all the old stuff */ - info(udev, "searching '/subsystem/*/devices/*' dir\n"); + dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); scan_dir(udev_enumerate, "subsystem", "devices", NULL); } else { - info(udev, "searching '/bus/*/devices/*' dir\n"); + dbg(udev, "searching '/bus/*/devices/*' dir\n"); scan_dir(udev_enumerate, "bus", "devices", NULL); - info(udev, "searching '/class/*' dir\n"); + dbg(udev, "searching '/class/*' dir\n"); scan_dir(udev_enumerate, "class", NULL, NULL); /* if block isn't a class, scan /block/ */ util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); util_strlcat(base, "/class/block", sizeof(base)); if (stat(base, &statbuf) != 0) { if (match_subsystem(udev_enumerate, "block")) { - info(udev, "searching '/block/*' dir\n"); + dbg(udev, "searching '/block/*' dir\n"); /* scan disks */ scan_dir_and_add_devices(udev_enumerate, "block", NULL, NULL); /* scan partitions */ - info(udev, "searching '/block/*/*' dir\n"); + dbg(udev, "searching '/block/*/*' dir\n"); scan_dir(udev_enumerate, "block", NULL, "block"); } } @@ -419,11 +419,11 @@ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) else subsysdir = "bus"; if (match_subsystem(udev_enumerate, "subsystem")) { - info(udev, "searching '%s/*' dir\n", subsysdir); + dbg(udev, "searching '%s/*' dir\n", subsysdir); scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); } if (match_subsystem(udev_enumerate, "drivers")) { - info(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); + dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); } return 0; diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index f205c61a70..e681e23e84 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -110,17 +110,17 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_ if (unique) udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { if (strcmp(entry_loop->name, name) == 0) { - info(udev, "'%s' is already in the list\n", name); + dbg(udev, "'%s' is already in the list\n", name); free(entry_loop->value); if (value == NULL) { entry_loop->value = NULL; - info(udev, "'%s' value unset\n", name); + dbg(udev, "'%s' value unset\n", name); return entry_loop; } entry_loop->value = strdup(value); if (entry_loop->value == NULL) return NULL; - info(udev, "'%s' value replaced with '%s'\n", name, value); + dbg(udev, "'%s' value replaced with '%s'\n", name, value); return entry_loop; } } diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index fc5b176be0..502fe24ce1 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -94,7 +94,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char free(udev_monitor); return NULL; } - info(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); + dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); return udev_monitor; } @@ -121,7 +121,7 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev) udev_monitor->snl.nl_pid = getpid(); udev_monitor->snl.nl_groups = 1; - info(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT\n", udev_monitor); + dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT\n", udev_monitor); return udev_monitor; } @@ -136,7 +136,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) err(udev_monitor->udev, "bind failed: %m\n"); return err; } - info(udev_monitor->udev, "monitor %p listening on netlink\n", udev_monitor); + dbg(udev_monitor->udev, "monitor %p listening on netlink\n", udev_monitor); } else if (udev_monitor->sun.sun_family != 0) { err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); if (err < 0) { @@ -145,7 +145,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) } /* enable receiving of the sender credentials */ setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - info(udev_monitor->udev, "monitor %p listening on socket\n", udev_monitor); + dbg(udev_monitor->udev, "monitor %p listening on socket\n", udev_monitor); } return 0; } @@ -191,7 +191,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) return; if (udev_monitor->sock >= 0) close(udev_monitor->sock); - info(udev_monitor->udev, "monitor %p released\n", udev_monitor); + dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); free(udev_monitor); } diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index ea75f22044..28d877749d 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -103,7 +103,7 @@ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queu return 0; buf[len-1] = '\0'; seqnum = strtoull(buf, NULL, 10); - info(udev_queue->udev, "seqnum=%llu\n", seqnum); + dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); return seqnum; } @@ -128,7 +128,7 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) return 0; buf[len-1] = '\0'; seqnum = strtoull(buf, NULL, 10); - info(udev_queue->udev, "seqnum=%llu\n", seqnum); + dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); udev_queue->last_seen_udev_seqnum = seqnum; return seqnum; } @@ -144,20 +144,20 @@ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) util_strlcpy(queuename, udev_get_dev_path(udev_queue->udev), sizeof(queuename)); util_strlcat(queuename, "/.udev/queue", sizeof(queuename)); if (stat(queuename, &statbuf) == 0) { - info(udev_queue->udev, "queue is not empty\n"); + dbg(udev_queue->udev, "queue is not empty\n"); return 0; } seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) { - info(udev_queue->udev, "queue is empty\n"); + dbg(udev_queue->udev, "queue is empty\n"); return 1; } udev_queue_get_udev_seqnum(udev_queue); if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) { - info(udev_queue->udev, "queue is empty\n"); + dbg(udev_queue->udev, "queue is empty\n"); return 1; } - info(udev_queue->udev, "queue is empty, but kernel events still pending [%llu]<->[%llu]\n", + dbg(udev_queue->udev, "queue is empty, but kernel events still pending [%llu]<->[%llu]\n", seqnum_kernel, udev_queue->last_seen_udev_seqnum); return 0; } @@ -179,7 +179,7 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo udev_get_dev_path(udev_queue->udev), seqnum); if (stat(filename, &statbuf) == 0) return 0; - info(udev_queue->udev, "seqnum: %llu finished\n", seqnum); + dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum); return 1; } @@ -214,7 +214,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev if (len < 0 || len >= (ssize_t)(sizeof(syspath)-syslen)) continue; syspath[syslen + len] = '\0'; - info(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); + dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, dent->d_name, 0, 0); } closedir(dir); @@ -253,7 +253,7 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev if (len < 0 || len >= (ssize_t)(sizeof(syspath)-syslen)) continue; syspath[syslen + len] = '\0'; - info(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); + dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); util_strlcpy(filename, syspath, sizeof(filename)); util_strlcat(filename, "/uevent", sizeof(filename)); if (stat(filename, &statbuf) != 0) diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 6586d1c825..9353e8eda7 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -48,7 +48,7 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy if (pos == NULL) return -1; pos = &pos[1]; - info(udev, "resolved link to: '%s'\n", pos); + dbg(udev, "resolved link to: '%s'\n", pos); return util_strlcpy(value, pos, size); } diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index e26e8b132d..f427151f40 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -230,13 +230,13 @@ struct udev *udev_new(void) if (udev->dev_path == NULL || udev->sys_path == NULL) goto err; - info(udev, "context %p created\n", udev); - info(udev, "log_priority=%d\n", udev->log_priority); - info(udev, "config_file='%s'\n", config_file); - info(udev, "dev_path='%s'\n", udev->dev_path); - info(udev, "sys_path='%s'\n", udev->sys_path); + dbg(udev, "context %p created\n", udev); + dbg(udev, "log_priority=%d\n", udev->log_priority); + dbg(udev, "config_file='%s'\n", config_file); + dbg(udev, "dev_path='%s'\n", udev->dev_path); + dbg(udev, "sys_path='%s'\n", udev->sys_path); if (udev->rules_path != NULL) - info(udev, "rules_path='%s'\n", udev->rules_path); + dbg(udev, "rules_path='%s'\n", udev->rules_path); free(config_file); return udev; err: @@ -281,7 +281,7 @@ void udev_unref(struct udev *udev) free(udev->dev_path); free(udev->sys_path); free(udev->rules_path); - info(udev, "context %p released\n", udev); + dbg(udev, "context %p released\n", udev); free(udev); } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index d1c02e9204..455da4234c 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -283,7 +283,7 @@ static int add_string(struct udev_rules *rules, const char *str) buf = realloc(rules->buf, rules->buf_max + add); if (buf == NULL) return -1; - info(rules->udev, "extend buffer from %zu to %zu\n", rules->buf_max, rules->buf_max + add); + dbg(rules->udev, "extend buffer from %zu to %zu\n", rules->buf_max, rules->buf_max + add); rules->buf = buf; rules->buf_max += add; } @@ -310,7 +310,7 @@ static int add_token(struct udev_rules *rules, struct token *token) tokens = realloc(rules->tokens, (rules->token_max + add ) * sizeof(struct token)); if (tokens == NULL) return -1; - info(rules->udev, "extend tokens from %u to %u\n", rules->token_max, rules->token_max + add); + dbg(rules->udev, "extend tokens from %u to %u\n", rules->token_max, rules->token_max + add); rules->tokens = tokens; rules->token_max += add; } @@ -349,7 +349,7 @@ static uid_t add_uid(struct udev_rules *rules, const char *owner) uids = realloc(rules->uids, (rules->uids_max + add ) * sizeof(struct uid_gid)); if (uids == NULL) return uid; - info(rules->udev, "extend uids from %u to %u\n", rules->uids_max, rules->uids_max + add); + dbg(rules->udev, "extend uids from %u to %u\n", rules->uids_max, rules->uids_max + add); rules->uids = uids; rules->uids_max += add; } @@ -392,7 +392,7 @@ static gid_t add_gid(struct udev_rules *rules, const char *group) gids = realloc(rules->gids, (rules->gids_max + add ) * sizeof(struct uid_gid)); if (gids == NULL) return gid; - info(rules->udev, "extend gids from %u to %u\n", rules->gids_max, rules->gids_max + add); + dbg(rules->udev, "extend gids from %u to %u\n", rules->gids_max, rules->gids_max + add); rules->gids = gids; rules->gids_max += add; } @@ -461,7 +461,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) val++; } - info(udev, "adding '%s'='%s'\n", key, val); + dbg(udev, "adding '%s'='%s'\n", key, val); /* handle device, renamed by external tool, returning new path */ if (strcmp(key, "DEVPATH") == 0) { @@ -1595,8 +1595,8 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) /* offset 0 is always '\0' */ rules->buf[0] = '\0'; rules->buf_cur = 1; - info(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", - rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); + dbg(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); if (udev_get_rules_path(udev) != NULL) { /* custom rules location for testing */ @@ -2041,11 +2041,11 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event attr_subst_subdir(filename, sizeof(filename)); match = (stat(filename, &statbuf) == 0); - info(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); if (match && cur->key.mode > 0) { match = ((statbuf.st_mode & cur->key.mode) > 0); - info(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, - match ? "matches" : "does not match", cur->key.mode); + dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + match ? "matches" : "does not match", cur->key.mode); } if (match && cur->key.op == OP_NOMATCH) goto nomatch; @@ -2360,7 +2360,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(value, &rules->buf[cur->key.value_off], sizeof(value)); udev_event_apply_format(event, value, sizeof(value)); - info(event->udev, "writing '%s' to sysfs file '%s'\n", value, attr); + info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); f = fopen(attr, "w"); if (f != NULL) { if (!event->test) -- cgit v1.2.3-54-g00ecf From b929e83acc964cc1648f5f536f1a776f8d8add46 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 1 Nov 2008 20:57:22 +0100 Subject: add "devel" and "install" switches to autogen.sh --- autogen.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/autogen.sh b/autogen.sh index b6db9f919c..b4c853f977 100755 --- a/autogen.sh +++ b/autogen.sh @@ -41,17 +41,24 @@ autoheader echo " automake: $(automake --version | head -1)" automake --add-missing -if test -z "$@"; then - args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux --enable-debug" - args="$args --with-libdir-name=$(basename $(gcc -print-multi-os-directory))" - export CFLAGS="-g -Wall \ +CFLAGS="-g -Wall \ -Wmissing-declarations -Wmissing-prototypes \ -Wnested-externs -Wpointer-arith \ -Wpointer-arith -Wsign-compare -Wchar-subscripts \ -Wstrict-prototypes -Wshadow" + +if test -z "$1" -o "$1" = "install"; then + args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux" + args="$args --with-libdir-name=$(basename $(gcc -print-multi-os-directory))" + CFLAGS="$CFLAGS -O2" +elif test "$1" = "devel" ; then + args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux --enable-debug" + args="$args --with-libdir-name=$(basename $(gcc -print-multi-os-directory))" + CFLAGS="$CFLAGS -O0" else args=$@ fi echo " configure: $args" echo +export CFLAGS ./configure $args -- cgit v1.2.3-54-g00ecf From 4052400fa05d09a12ee89003ce1a74109bb814c3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 1 Nov 2008 21:05:25 +0100 Subject: move debugging strings inside #ifdef DEBUG --- udev/udev-rules.c | 420 +++++++++++++++++++++++++++--------------------------- 1 file changed, 210 insertions(+), 210 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 455da4234c..226f35296d 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -31,7 +31,39 @@ #define PREALLOC_TOKEN 2048 #define PREALLOC_STRBUF 32 * 1024 +struct uid_gid { + unsigned int name_off; + union { + uid_t uid; + gid_t gid; + }; +}; + /* KEY=="", KEY!="", KEY+="", KEY="", KEY:="" */ +struct udev_rules { + struct udev *udev; + int resolve_names; + + /* every key in the rules file becomes a token */ + struct token *tokens; + unsigned int token_cur; + unsigned int token_max; + + /* all key strings are copied to a single string buffer */ + char *buf; + size_t buf_cur; + size_t buf_max; + unsigned int buf_count; + + /* during rule parsing, we cache uid/gid lookup results */ + struct uid_gid *uids; + unsigned int uids_cur; + unsigned int uids_max; + struct uid_gid *gids; + unsigned int gids_cur; + unsigned int gids_max; +}; + enum operation_type { OP_UNSET, @@ -44,17 +76,6 @@ enum operation_type { OP_ASSIGN_FINAL, }; -static const char *operation_str[] = { - [OP_UNSET] = "UNSET", - [OP_MATCH] = "match", - [OP_NOMATCH] = "nomatch", - [OP_MATCH_MAX] = "MATCH_MAX", - - [OP_ADD] = "add", - [OP_ASSIGN] = "assign", - [OP_ASSIGN_FINAL] = "assign-final", -}; - enum string_glob_type { GL_UNSET, GL_PLAIN, /* no special chars */ @@ -65,18 +86,6 @@ enum string_glob_type { GL_FORMAT, }; -#ifdef DEBUG -static const char *string_glob_str[] = { - [GL_UNSET] = "UNSET", - [GL_PLAIN] = "plain", - [GL_GLOB] = "glob", - [GL_SPLIT] = "split", - [GL_SPLIT_GLOB] = "split-glob", - [GL_SOMETHING] = "split-glob", - [GL_FORMAT] = "format", -}; -#endif - /* tokens of a rule are sorted/handled in this order */ enum token_type { TK_UNSET, @@ -132,6 +141,70 @@ enum token_type { TK_END, }; +/* we try to pack stuff in a way that we take only 16 bytes per token */ +struct token { + union { + unsigned short type; /* same as in rule and key */ + struct { + unsigned short type; + unsigned short flags; + unsigned int next_rule; + unsigned int label_off; + unsigned short filename_off; + unsigned short filename_line; + } rule; + struct { + unsigned short type; + unsigned short flags; + unsigned short op; + unsigned short glob; + unsigned int value_off; + union { + unsigned int attr_off; + int ignore_error; + int i; + unsigned int rule_goto; + mode_t mode; + uid_t uid; + gid_t gid; + int num_fake_part; + int devlink_prio; + int event_timeout; + }; + } key; + }; +}; + +#define MAX_TK 64 +struct rule_tmp { + struct udev_rules *rules; + struct token rule; + struct token token[MAX_TK]; + unsigned int token_cur; +}; + +#ifdef DEBUG +static const char *operation_str[] = { + [OP_UNSET] = "UNSET", + [OP_MATCH] = "match", + [OP_NOMATCH] = "nomatch", + [OP_MATCH_MAX] = "MATCH_MAX", + + [OP_ADD] = "add", + [OP_ASSIGN] = "assign", + [OP_ASSIGN_FINAL] = "assign-final", +}; + +static const char *string_glob_str[] = { + [GL_UNSET] = "UNSET", + [GL_PLAIN] = "plain", + [GL_GLOB] = "glob", + [GL_SPLIT] = "split", + [GL_SPLIT_GLOB] = "split-glob", + [GL_SOMETHING] = "split-glob", + [GL_FORMAT] = "format", +}; + static const char *token_str[] = { [TK_UNSET] = "UNSET", [TK_RULE] = "RULE", @@ -186,79 +259,124 @@ static const char *token_str[] = { [TK_END] = "END", }; -/* we try to pack stuff in a way that we take only 16 bytes per token */ -struct token { - union { - unsigned short type; /* same as in rule and key */ - struct { - unsigned short type; - unsigned short flags; - unsigned int next_rule; - unsigned int label_off; - unsigned short filename_off; - unsigned short filename_line; - } rule; - struct { - unsigned short type; - unsigned short flags; - unsigned short op; - unsigned short glob; - unsigned int value_off; - union { - unsigned int attr_off; - int ignore_error; - int i; - unsigned int rule_goto; - mode_t mode; - uid_t uid; - gid_t gid; - int num_fake_part; - int devlink_prio; - int event_timeout; - }; - } key; - }; -}; - -#define MAX_TK 64 -struct rule_tmp { - struct udev_rules *rules; - struct token rule; - struct token token[MAX_TK]; - unsigned int token_cur; -}; - -struct uid_gid { - unsigned int name_off; - union { - uid_t uid; - gid_t gid; - }; -}; +static void dump_token(struct udev_rules *rules, struct token *token) +{ + enum token_type type = token->type; + enum operation_type op = token->key.op; + enum string_glob_type glob = token->key.glob; + const char *value = &rules->buf[token->key.value_off]; + const char *attr = &rules->buf[token->key.attr_off]; -struct udev_rules { - struct udev *udev; - int resolve_names; + switch (type) { + case TK_RULE: + { + const char *tks_ptr = (char *)rules->tokens; + const char *tk_ptr = (char *)token; + unsigned int off = tk_ptr - tks_ptr; - /* every key in the rules file becomes a token */ - struct token *tokens; - unsigned int token_cur; - unsigned int token_max; + dbg(rules->udev, "* RULE %s:%u, off: %u(%u), next: %u, label: '%s', flags: 0x%02x\n", + &rules->buf[token->rule.filename_off], token->rule.filename_line, + off / (unsigned int) sizeof(struct token), off, + token->rule.next_rule, + &rules->buf[token->rule.label_off], + token->rule.flags); + break; + } + case TK_M_ACTION: + case TK_M_DEVPATH: + case TK_M_KERNEL: + case TK_M_SUBSYSTEM: + case TK_M_DRIVER: + case TK_M_WAITFOR: + case TK_M_DEVLINK: + case TK_M_NAME: + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_PROGRAM: + case TK_M_IMPORT_FILE: + case TK_M_IMPORT_PROG: + case TK_M_IMPORT_PARENT: + case TK_M_RESULT: + case TK_A_NAME: + case TK_A_DEVLINK: + case TK_A_OWNER: + case TK_A_GROUP: + case TK_A_MODE: + case TK_A_RUN: + dbg(rules->udev, "%s %s '%s'(%s)\n", + token_str[type], operation_str[op], value, string_glob_str[glob]); + break; + case TK_M_ATTR: + case TK_M_ATTRS: + case TK_M_ENV: + case TK_A_ATTR: + case TK_A_ENV: + dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", + token_str[type], operation_str[op], attr, value, string_glob_str[glob]); + break; + case TK_A_IGNORE_DEVICE: + case TK_A_STRING_ESCAPE_NONE: + case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_LAST_RULE: + case TK_A_IGNORE_REMOVE: + dbg(rules->udev, "%s\n", token_str[type]); + break; + case TK_M_TEST: + dbg(rules->udev, "%s %s '%s'(%s) %#o\n", + token_str[type], operation_str[op], value, string_glob_str[glob], token->key.mode); + break; + case TK_A_NUM_FAKE_PART: + dbg(rules->udev, "%s %u\n", token_str[type], token->key.num_fake_part); + break; + case TK_A_DEVLINK_PRIO: + dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.devlink_prio); + break; + case TK_A_OWNER_ID: + dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.uid); + break; + case TK_A_GROUP_ID: + dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.gid); + break; + case TK_A_MODE_ID: + dbg(rules->udev, "%s %s %#o\n", token_str[type], operation_str[op], token->key.mode); + break; + case TK_A_EVENT_TIMEOUT: + dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.event_timeout); + break; + case TK_A_GOTO: + dbg(rules->udev, "%s '%s' %u\n", token_str[type], value, token->key.rule_goto); + break; + case TK_END: + dbg(rules->udev, "* %s\n", token_str[type]); + break; + case TK_M_PARENTS_MIN: + case TK_M_PARENTS_MAX: + case TK_M_MAX: + case TK_UNSET: + dbg(rules->udev, "unknown type %u\n", type); + break; + } +} - /* all key strings are copied to a single string buffer */ - char *buf; - size_t buf_cur; - size_t buf_max; - unsigned int buf_count; +static void dump_rules(struct udev_rules *rules) +{ + unsigned int i; - /* during rule parsing, we cache uid/gid lookup results */ - struct uid_gid *uids; - unsigned int uids_cur; - unsigned int uids_max; - struct uid_gid *gids; - unsigned int gids_cur; - unsigned int gids_max; -}; + dbg(rules->udev, "dumping %u (%zu bytes) tokens, %u (%zu bytes) strings\n", + rules->token_cur, + rules->token_cur * sizeof(struct token), + rules->buf_count, + rules->buf_cur); + for(i = 0; i < rules->token_cur; i++) + dump_token(rules, &rules->tokens[i]); +} +#else +static const char **operation_str; +static const char **token_str; +static inline void dump_token(struct udev_rules *rules, struct token *token) {} +static inline void dump_rules(struct udev_rules *rules) {} +#endif /* DEBUG */ /* we could lookup and return existing strings, or tails of strings */ static int add_string(struct udev_rules *rules, const char *str) @@ -861,124 +979,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, return 0; } -#ifdef DEBUG -static void dump_token(struct udev_rules *rules, struct token *token) -{ - enum token_type type = token->type; - enum operation_type op = token->key.op; - enum string_glob_type glob = token->key.glob; - const char *value = &rules->buf[token->key.value_off]; - const char *attr = &rules->buf[token->key.attr_off]; - - switch (type) { - case TK_RULE: - { - const char *tks_ptr = (char *)rules->tokens; - const char *tk_ptr = (char *)token; - unsigned int off = tk_ptr - tks_ptr; - - dbg(rules->udev, "* RULE %s:%u, off: %u(%u), next: %u, label: '%s', flags: 0x%02x\n", - &rules->buf[token->rule.filename_off], token->rule.filename_line, - off / (unsigned int) sizeof(struct token), off, - token->rule.next_rule, - &rules->buf[token->rule.label_off], - token->rule.flags); - break; - } - case TK_M_ACTION: - case TK_M_DEVPATH: - case TK_M_KERNEL: - case TK_M_SUBSYSTEM: - case TK_M_DRIVER: - case TK_M_WAITFOR: - case TK_M_DEVLINK: - case TK_M_NAME: - case TK_M_KERNELS: - case TK_M_SUBSYSTEMS: - case TK_M_DRIVERS: - case TK_M_PROGRAM: - case TK_M_IMPORT_FILE: - case TK_M_IMPORT_PROG: - case TK_M_IMPORT_PARENT: - case TK_M_RESULT: - case TK_A_NAME: - case TK_A_DEVLINK: - case TK_A_OWNER: - case TK_A_GROUP: - case TK_A_MODE: - case TK_A_RUN: - dbg(rules->udev, "%s %s '%s'(%s)\n", - token_str[type], operation_str[op], value, string_glob_str[glob]); - break; - case TK_M_ATTR: - case TK_M_ATTRS: - case TK_M_ENV: - case TK_A_ATTR: - case TK_A_ENV: - dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", - token_str[type], operation_str[op], attr, value, string_glob_str[glob]); - break; - case TK_A_IGNORE_DEVICE: - case TK_A_STRING_ESCAPE_NONE: - case TK_A_STRING_ESCAPE_REPLACE: - case TK_A_LAST_RULE: - case TK_A_IGNORE_REMOVE: - dbg(rules->udev, "%s\n", token_str[type]); - break; - case TK_M_TEST: - dbg(rules->udev, "%s %s '%s'(%s) %#o\n", - token_str[type], operation_str[op], value, string_glob_str[glob], token->key.mode); - break; - case TK_A_NUM_FAKE_PART: - dbg(rules->udev, "%s %u\n", token_str[type], token->key.num_fake_part); - break; - case TK_A_DEVLINK_PRIO: - dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.devlink_prio); - break; - case TK_A_OWNER_ID: - dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.uid); - break; - case TK_A_GROUP_ID: - dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.gid); - break; - case TK_A_MODE_ID: - dbg(rules->udev, "%s %s %#o\n", token_str[type], operation_str[op], token->key.mode); - break; - case TK_A_EVENT_TIMEOUT: - dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.event_timeout); - break; - case TK_A_GOTO: - dbg(rules->udev, "%s '%s' %u\n", token_str[type], value, token->key.rule_goto); - break; - case TK_END: - dbg(rules->udev, "* %s\n", token_str[type]); - break; - case TK_M_PARENTS_MIN: - case TK_M_PARENTS_MAX: - case TK_M_MAX: - case TK_UNSET: - dbg(rules->udev, "unknown type %u\n", type); - break; - } -} - -static void dump_rules(struct udev_rules *rules) -{ - unsigned int i; - - dbg(rules->udev, "dumping %u (%zu bytes) tokens, %u (%zu bytes) strings\n", - rules->token_cur, - rules->token_cur * sizeof(struct token), - rules->buf_count, - rules->buf_cur); - for(i = 0; i < rules->token_cur; i++) - dump_token(rules, &rules->tokens[i]); -} -#else -static inline void dump_token(struct udev_rules *rules, struct token *token) {} -static inline void dump_rules(struct udev_rules *rules) {} -#endif /* DEBUG */ - static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) { unsigned int i; -- cgit v1.2.3-54-g00ecf From a0e17034eecf3933223503377b5e3f4c4eac0e86 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 4 Nov 2008 18:38:06 +0100 Subject: firmware.sh: record missing files in /dev/.udev/firmware-missing/ --- extras/firmware/firmware.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/firmware/firmware.sh b/extras/firmware/firmware.sh index 466b653226..eececa85a1 100755 --- a/extras/firmware/firmware.sh +++ b/extras/firmware/firmware.sh @@ -22,4 +22,7 @@ done echo -1 > /sys$DEVPATH/loading err "Cannot find firmware file '$FIRMWARE'" +mkdir -p /dev/.udev/firmware-missing +file=$(echo "$FIRMWARE" | sed 's:/:\\x2f:g') +ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file exit 1 -- cgit v1.2.3-54-g00ecf From 1e78dcbe51419124846e1f35e540cb0253362231 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 4 Nov 2008 20:19:01 +0100 Subject: fix list handling in enumerate and rules file sorting --- TODO | 4 +++- udev/lib/libudev-device.c | 2 +- udev/lib/libudev-enumerate.c | 25 +++++++++++++++---------- udev/lib/libudev-list.c | 34 ++++++++++++++-------------------- udev/lib/libudev-private.h | 5 +++-- udev/lib/libudev.c | 2 +- udev/udev-rules.c | 21 +++++++++++++++------ 7 files changed, 52 insertions(+), 41 deletions(-) diff --git a/TODO b/TODO index ac0618ec16..3320d91347 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,8 @@ + o convert firmware.sh to C o drop pnp shell script, acpi will take care of loading pnp modules - o add DVB variables to kernel (patch sent), and drop shell script rule + o add DVB variables to kernel (patch merged in v4l tree), drop the + shell script rule o DEVTYPE for disks is set by the kernel, they will be removed from the default rules o "udevadm control" commands will only accept the -- syntax diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index e9d040cdfc..eda3f5d97e 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -985,7 +985,7 @@ struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device list_entry = udev_device_get_properties_list_entry(udev_device); list_entry = udev_list_entry_get_by_name(list_entry, key); if (list_entry != NULL) - udev_list_entry_remove(list_entry); + udev_list_entry_delete(list_entry); return NULL; } return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 1b40d63484..618ffbc3e9 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -320,11 +320,22 @@ static int devices_delay(struct udev *udev, const char *syspath) /* sort delayed devices to the end of the list */ static int devices_sort(struct udev_enumerate *udev_enumerate) { - struct udev_list_entry *list_entry; + struct udev_list_entry *entry_loop; + struct udev_list_entry *entry_tmp; + struct udev_list_node devices_list; - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->devices_list)) { - if (devices_delay(udev_enumerate->udev, udev_list_entry_get_name(list_entry))) - udev_list_entry_move_to_end(list_entry); + udev_list_init(&devices_list); + /* move delayed to delay list */ + udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(&udev_enumerate->devices_list)) { + if (devices_delay(udev_enumerate->udev, udev_list_entry_get_name(entry_loop))) { + udev_list_entry_remove(entry_loop); + udev_list_entry_append(entry_loop, &devices_list); + } + } + /* move delayed back to end of list */ + udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(&devices_list)) { + udev_list_entry_remove(entry_loop); + udev_list_entry_append(entry_loop, &udev_enumerate->devices_list); } udev_enumerate->devices_sorted = 1; return 0; @@ -360,7 +371,6 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) struct udev *udev = udev_enumerate_get_udev(udev_enumerate); char base[UTIL_PATH_SIZE]; struct stat statbuf; - struct udev_list_entry *list_entry; if (udev_enumerate == NULL) return -EINVAL; @@ -389,11 +399,6 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) } } } - /* sort delayed devices to the end of the list */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->devices_list)) { - if (devices_delay(udev, udev_list_entry_get_name(list_entry))) - udev_list_entry_move_to_end(list_entry); - } return 0; } diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c index e681e23e84..9d157616a8 100644 --- a/udev/lib/libudev-list.c +++ b/udev/lib/libudev-list.c @@ -28,8 +28,8 @@ #include "libudev-private.h" struct udev_list_entry { - struct udev *udev; struct udev_list_node node; + struct udev *udev; struct udev_list_node *list; char *name; char *value; @@ -86,15 +86,22 @@ static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) } /* insert entry into a list as the last element */ -static void list_entry_append(struct udev_list_entry *new, struct udev_list_node *list) +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list) { /* inserting before the list head make the node the last node in the list */ udev_list_node_insert_between(&new->node, list->prev, list); new->list = list; } +/* remove entry from a list */ +void udev_list_entry_remove(struct udev_list_entry *entry) +{ + udev_list_node_remove(&entry->node); + entry->list = NULL; +} + /* insert entry into a list, before a given existing entry */ -static void list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) +void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) { udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node); new->list = entry->list; @@ -150,14 +157,14 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_ } } if (entry_loop != NULL) - list_entry_insert_before(entry_new, entry_loop); + udev_list_entry_insert_before(entry_new, entry_loop); else - list_entry_append(entry_new, list); + udev_list_entry_append(entry_new, list); dbg(udev, "'%s=%s' added\n", entry_new->name, entry_new->value); return entry_new; } -void udev_list_entry_remove(struct udev_list_entry *entry) +void udev_list_entry_delete(struct udev_list_entry *entry) { udev_list_node_remove(&entry->node); free(entry->name); @@ -171,20 +178,7 @@ void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *list) struct udev_list_entry *entry_tmp; udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) - udev_list_entry_remove(entry_loop); -} - -void udev_list_entry_move_to_end(struct udev_list_entry *list_entry) -{ - udev_list_node_remove(&list_entry->node); - udev_list_node_insert_between(&list_entry->node, list_entry->list->prev, list_entry->list); -} - -void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry) -{ - udev_list_node_remove(&list_entry->node); - udev_list_node_insert_between(&list_entry->node, entry->node.prev, &entry->node); - list_entry->list = entry->list; + udev_list_entry_delete(entry_loop); } struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 11e9ad9cb3..2f8b8259b5 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -139,11 +139,12 @@ extern void udev_list_node_remove(struct udev_list_node *entry); extern struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, const char *name, const char *value, int unique, int sort); +extern void udev_list_entry_delete(struct udev_list_entry *entry); extern void udev_list_entry_remove(struct udev_list_entry *entry); +extern void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry); +extern void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list); extern void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list); extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); -extern void udev_list_entry_move_to_end(struct udev_list_entry *list_entry); -extern void udev_list_entry_move_before(struct udev_list_entry *list_entry, struct udev_list_entry *entry); extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry); extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); #define udev_list_entry_foreach_safe(entry, tmp, first) \ diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index f427151f40..2d8b7754ff 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -370,7 +370,7 @@ struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, co list_entry = udev_get_properties_list_entry(udev); list_entry = udev_list_entry_get_by_name(list_entry, key); if (list_entry != NULL) - udev_list_entry_remove(list_entry); + udev_list_entry_delete(list_entry); return NULL; } return udev_list_entry_add(udev, &udev->properties_list, key, value, 1, 0); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 226f35296d..21fa11775d 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1631,7 +1631,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (sort_base == NULL) continue; - + /* sort entry into existing list */ udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { const char *file_name = udev_list_entry_get_name(file_loop); const char *file_base = strrchr(file_name, '/'); @@ -1641,15 +1641,24 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (strcmp(file_base, sort_base) == 0) { info(udev, "rule file basename '%s' already added, ignoring '%s'\n", file_name, sort_name); - udev_list_entry_remove(sort_loop); + udev_list_entry_delete(sort_loop); sort_loop = NULL; break; } - if (strcmp(file_base, sort_base) > 0) + if (strcmp(file_base, sort_base) > 0) { + /* found later file, insert before */ + udev_list_entry_remove(sort_loop); + udev_list_entry_insert_before(sort_loop, file_loop); + sort_loop = NULL; break; + } } - if (sort_loop != NULL) - udev_list_entry_move_before(sort_loop, file_loop); + /* current file already handled */ + if (sort_loop == NULL) + continue; + /* no later file, append to end of list */ + udev_list_entry_remove(sort_loop); + udev_list_entry_append(sort_loop, &file_list); } } @@ -1673,7 +1682,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) parse_file(rules, filename, filename_off); else info(udev, "can not read '%s'\n", filename); - udev_list_entry_remove(file_loop); + udev_list_entry_delete(file_loop); } memset(&end_token, 0x00, sizeof(struct token)); -- cgit v1.2.3-54-g00ecf From 0d5076dd92a35c3c7cf48e4998d08feac27827ff Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Nov 2008 02:22:07 +0100 Subject: volume_id: btrfs update --- extras/volume_id/lib/btrfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/btrfs.c b/extras/volume_id/lib/btrfs.c index 75a9b0a9a9..a725c4d12f 100644 --- a/extras/volume_id/lib/btrfs.c +++ b/extras/volume_id/lib/btrfs.c @@ -81,7 +81,7 @@ int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size) if (buf == NULL) return -1; bfs = (struct btrfs_super_block *)buf; - if (memcmp(bfs->magic, "_BBRfS_M", 8) != 0) + if (memcmp(bfs->magic, "_BDRfS_M", 8) != 0) return -1; volume_id_set_uuid(id, bfs->fsid, 0, UUID_DCE); volume_id_set_label_raw(id, bfs->label, 256); -- cgit v1.2.3-54-g00ecf From 08e7f22913075d25af283b3001db598840663f70 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Nov 2008 04:05:17 +0100 Subject: info() PROGRAM and IMPORT execution --- udev/udev-rules.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 21fa11775d..e07cd3264c 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2073,6 +2073,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(program, &rules->buf[cur->key.value_off], sizeof(program)); udev_event_apply_format(event, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); + info(event->udev, "PROGRAM '%s' %s:%u\n", + program, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { if (cur->key.op != OP_NOMATCH) goto nomatch; @@ -2109,6 +2113,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); udev_event_apply_format(event, import, sizeof(import)); + info(event->udev, "IMPORT '%s' %s:%u\n", + import, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); if (import_program_into_properties(event->dev, import) != 0) if (cur->key.op != OP_NOMATCH) goto nomatch; -- cgit v1.2.3-54-g00ecf From 7c4573e46d703ff65bcaeff8ad91250667f82fe2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Nov 2008 04:08:44 +0100 Subject: fix $links substitution --- udev/udev-event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index a6459eb8d9..db61d58925 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -396,8 +396,8 @@ found: { struct udev_list_entry *list_entry; - list_entry = udev_device_get_properties_list_entry(dev); - util_strlcpy(string, udev_list_entry_get_name(list_entry), maxsize); + list_entry = udev_device_get_devlinks_list_entry(dev); + util_strlcat(string, udev_list_entry_get_name(list_entry), maxsize); udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { util_strlcat(string, " ", maxsize); util_strlcat(string, udev_list_entry_get_name(list_entry), maxsize); -- cgit v1.2.3-54-g00ecf From 6e0cb78c9d59f976222ecd88c172b4cd9a5b7347 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Nov 2008 04:45:23 +0100 Subject: fix cleanup of possible left-over symlinks --- udev/lib/libudev-device.c | 22 +++++++++++----------- udev/lib/libudev-private.h | 2 +- udev/udev-event.c | 26 +++++++++++--------------- udev/udev-node.c | 14 ++++++++------ 4 files changed, 31 insertions(+), 33 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index eda3f5d97e..38af0e7c94 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -77,7 +77,7 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f return util_path_encode(&filename[start], len - start); } -int udev_device_read_db(struct udev_device *udev_device) +static int device_read_db(struct udev_device *udev_device) { struct stat stats; char filename[UTIL_PATH_SIZE]; @@ -218,11 +218,11 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) return 0; } -static void device_load_info(struct udev_device *device) +void udev_device_load_info(struct udev_device *device) { device->info_loaded = 1; udev_device_read_uevent_file(device); - udev_device_read_db(device); + device_read_db(device); } void udev_device_set_info_loaded(struct udev_device *device) @@ -676,7 +676,7 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_load_info(udev_device); return udev_device->devnode; } @@ -739,7 +739,7 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device * if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_load_info(udev_device); return udev_list_get_entry(&udev_device->devlinks_list); } @@ -766,7 +766,7 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_load_info(udev_device); if (!udev_device->devlinks_uptodate) { char symlinks[UTIL_PATH_SIZE]; struct udev_list_entry *list_entry; @@ -804,7 +804,7 @@ dev_t udev_device_get_devnum(struct udev_device *udev_device) if (udev_device == NULL) return makedev(0, 0); if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_load_info(udev_device); return udev_device->devnum; } @@ -1154,7 +1154,7 @@ int udev_device_set_timeout(struct udev_device *udev_device, int timeout) int udev_device_get_event_timeout(struct udev_device *udev_device) { if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_load_info(udev_device); return udev_device->event_timeout; } @@ -1190,7 +1190,7 @@ int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) int udev_device_get_num_fake_partitions(struct udev_device *udev_device) { if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_load_info(udev_device); return udev_device->num_fake_partitions; } @@ -1203,7 +1203,7 @@ int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num int udev_device_get_devlink_priority(struct udev_device *udev_device) { if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_load_info(udev_device); return udev_device->devlink_priority; } @@ -1216,7 +1216,7 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) int udev_device_get_ignore_remove(struct udev_device *udev_device) { if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_load_info(udev_device); return udev_device->ignore_remove; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 2f8b8259b5..5d6b94bf5b 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -63,7 +63,7 @@ extern struct udev_list_entry *udev_device_add_property(struct udev_device *udev extern struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); extern char **udev_device_get_properties_envp(struct udev_device *udev_device); extern ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); -extern int udev_device_read_db(struct udev_device *udev_device); +extern void udev_device_load_info(struct udev_device *udev_device); extern int udev_device_read_uevent_file(struct udev_device *udev_device); extern int udev_device_set_action(struct udev_device *udev_device, const char *action); extern int udev_device_set_driver(struct udev_device *udev_device, const char *driver); diff --git a/udev/udev-event.c b/udev/udev-event.c index db61d58925..1c640cf37d 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -583,23 +583,20 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) util_strlcat(filename, event->name, sizeof(filename)); udev_device_set_devnode(dev, filename); - /* read current database entry; cleanup, if it is known device */ + /* read current database entry */ dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); - if (dev_old != NULL) { - if (udev_device_get_devnode(dev_old) != NULL) { - info(event->udev, "device node '%s' already in database, updating\n", - udev_device_get_devnode(dev_old)); - udev_node_update_old_links(dev, dev_old, event->test); - } - udev_device_unref(dev_old); - } + if (dev_old != NULL) + udev_device_load_info(dev_old); + /* update database, create node and symlinks */ udev_device_update_db(dev); - err = udev_node_add(dev, event->mode, event->uid, event->gid, event->test); - if (err != 0) - goto exit; + /* remove/update possible left-over symlinks from old database entry */ + if (dev_old != NULL) { + udev_node_update_old_links(dev, dev_old, event->test); + udev_device_unref(dev_old); + } goto exit; } @@ -645,9 +642,8 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) /* remove device node */ if (major(udev_device_get_devnum(dev)) != 0 && strcmp(udev_device_get_action(dev), "remove") == 0) { /* import database entry and delete it */ - udev_device_read_db(dev); - if (!event->test) - udev_device_delete_db(dev); + udev_device_load_info(dev); + udev_device_delete_db(dev); if (udev_device_get_devnode(dev) == NULL) { char devnode[UTIL_PATH_SIZE]; diff --git a/udev/udev-node.c b/udev/udev-node.c index ae343eb2da..1a189c5aae 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -367,13 +367,15 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev /* update possible left-over symlinks */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { + const char *name = udev_list_entry_get_name(list_entry); struct udev_list_entry *list_entry_current; int found; found = 0; udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { - if (strcmp(udev_list_entry_get_name(list_entry_current), - udev_list_entry_get_name(list_entry)) == 0) { + const char *name_current = udev_list_entry_get_name(list_entry_current); + + if (strcmp(name_current, name) == 0) { found = 1; break; } @@ -381,9 +383,9 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev if (found) continue; /* link does no longer belong to this device */ - info(udev, "update old symlink '%s' no longer belonging to '%s'\n", - udev_list_entry_get_name(list_entry), udev_device_get_devpath(dev)); - update_link(dev, udev_list_entry_get_name(list_entry), test); + info(udev, "update old symlink '%s' no longer belonging to '%s'\n", name, udev_device_get_devpath(dev)); + name_index(udev, udev_device_get_devpath(dev), name, 0, test); + update_link(dev, name, test); } /* @@ -438,7 +440,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, in } } - /* add node and to name index */ + /* add node to name index */ name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 1, test); /* create/update symlinks, add symlinks to name index */ -- cgit v1.2.3-54-g00ecf From 77b852f3334311575b9c19ffb29d4a77a21b4bb2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Nov 2008 12:23:06 +0100 Subject: do not import the "uevent" file when we only read the db to get old symlinks --- udev/lib/libudev-device.c | 22 +++++++++++----------- udev/lib/libudev-private.h | 2 +- udev/udev-event.c | 9 ++++++--- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 38af0e7c94..eda3f5d97e 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -77,7 +77,7 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f return util_path_encode(&filename[start], len - start); } -static int device_read_db(struct udev_device *udev_device) +int udev_device_read_db(struct udev_device *udev_device) { struct stat stats; char filename[UTIL_PATH_SIZE]; @@ -218,11 +218,11 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) return 0; } -void udev_device_load_info(struct udev_device *device) +static void device_load_info(struct udev_device *device) { device->info_loaded = 1; udev_device_read_uevent_file(device); - device_read_db(device); + udev_device_read_db(device); } void udev_device_set_info_loaded(struct udev_device *device) @@ -676,7 +676,7 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - udev_device_load_info(udev_device); + device_load_info(udev_device); return udev_device->devnode; } @@ -739,7 +739,7 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device * if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - udev_device_load_info(udev_device); + device_load_info(udev_device); return udev_list_get_entry(&udev_device->devlinks_list); } @@ -766,7 +766,7 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - udev_device_load_info(udev_device); + device_load_info(udev_device); if (!udev_device->devlinks_uptodate) { char symlinks[UTIL_PATH_SIZE]; struct udev_list_entry *list_entry; @@ -804,7 +804,7 @@ dev_t udev_device_get_devnum(struct udev_device *udev_device) if (udev_device == NULL) return makedev(0, 0); if (!udev_device->info_loaded) - udev_device_load_info(udev_device); + device_load_info(udev_device); return udev_device->devnum; } @@ -1154,7 +1154,7 @@ int udev_device_set_timeout(struct udev_device *udev_device, int timeout) int udev_device_get_event_timeout(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_load_info(udev_device); + device_load_info(udev_device); return udev_device->event_timeout; } @@ -1190,7 +1190,7 @@ int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) int udev_device_get_num_fake_partitions(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_load_info(udev_device); + device_load_info(udev_device); return udev_device->num_fake_partitions; } @@ -1203,7 +1203,7 @@ int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num int udev_device_get_devlink_priority(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_load_info(udev_device); + device_load_info(udev_device); return udev_device->devlink_priority; } @@ -1216,7 +1216,7 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) int udev_device_get_ignore_remove(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_load_info(udev_device); + device_load_info(udev_device); return udev_device->ignore_remove; } diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 5d6b94bf5b..2f8b8259b5 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -63,7 +63,7 @@ extern struct udev_list_entry *udev_device_add_property(struct udev_device *udev extern struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); extern char **udev_device_get_properties_envp(struct udev_device *udev_device); extern ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); -extern void udev_device_load_info(struct udev_device *udev_device); +extern int udev_device_read_db(struct udev_device *udev_device); extern int udev_device_read_uevent_file(struct udev_device *udev_device); extern int udev_device_set_action(struct udev_device *udev_device, const char *action); extern int udev_device_set_driver(struct udev_device *udev_device, const char *driver); diff --git a/udev/udev-event.c b/udev/udev-event.c index 1c640cf37d..fe579b49c7 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -585,8 +585,10 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) /* read current database entry */ dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); - if (dev_old != NULL) - udev_device_load_info(dev_old); + if (dev_old != NULL) { + udev_device_read_db(dev_old); + udev_device_set_info_loaded(dev_old); + } /* update database, create node and symlinks */ udev_device_update_db(dev); @@ -642,7 +644,8 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) /* remove device node */ if (major(udev_device_get_devnum(dev)) != 0 && strcmp(udev_device_get_action(dev), "remove") == 0) { /* import database entry and delete it */ - udev_device_load_info(dev); + udev_device_read_db(dev); + udev_device_set_info_loaded(dev); udev_device_delete_db(dev); if (udev_device_get_devnode(dev) == NULL) { -- cgit v1.2.3-54-g00ecf From b467444884865167296b588c9529e1643b9e4899 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Nov 2008 19:02:56 +0100 Subject: usb_id: MassStorage SubClass 6 is "scsi" not "disk" --- extras/usb_id/usb_id.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 22f075b5d9..1499695c67 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -141,8 +141,10 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len type = "floppy"; break; case 1: /* RBC devices */ + type = "rbc"; + break; case 6: /* Transparent SPC-2 devices */ - type = "disk"; + type = "scsi"; break; default: break; -- cgit v1.2.3-54-g00ecf From 92f4313665bc726baf055f81e2daae48c77123fc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Nov 2008 21:49:52 +0100 Subject: unify string replacement --- extras/ata_id/ata_id.c | 38 ++---------------- extras/scsi_id/scsi_id.c | 47 ++++------------------ extras/usb_id/usb_id.c | 52 ++++--------------------- extras/volume_id/vol_id.c | 40 ++----------------- udev/lib/libudev-private.h | 11 ++++-- udev/lib/libudev-util.c | 97 ++++++++++++++++++++++++++++++++++++++++------ udev/udev-event.c | 2 +- udev/udev-rules.c | 8 ++-- udev/udev.h | 4 -- 9 files changed, 118 insertions(+), 181 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index a4f73b8dfd..d407b0fad9 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -44,38 +44,6 @@ static void log_fn(struct udev *udev, int priority, vsyslog(priority, format, args); } -static void set_str(char *to, const char *from, size_t count) -{ - size_t i, j, len; - - /* strip trailing whitespace */ - len = strnlen(from, count); - while (len && isspace(from[len-1])) - len--; - - /* strip leading whitespace */ - i = 0; - while (isspace(from[i]) && (i < len)) - i++; - - j = 0; - while (i < len) { - /* substitute multiple whitespace */ - if (isspace(from[i])) { - while (isspace(from[i])) - i++; - to[j++] = '_'; - } - /* skip chars */ - if (from[i] == '/') { - i++; - continue; - } - to[j++] = from[i++]; - } - to[j] = '\0'; -} - int main(int argc, char *argv[]) { struct udev *udev; @@ -146,9 +114,9 @@ int main(int argc, char *argv[]) goto close; } - set_str(model, (char *) id.model, 40); - set_str(serial, (char *) id.serial_no, 20); - set_str(revision, (char *) id.fw_rev, 8); + udev_util_replace_whitespace((char *) id.model, model, 40); + udev_util_replace_whitespace((char *) id.serial_no, serial, 20); + udev_util_replace_whitespace((char *) id.fw_rev, revision, 8); if (export) { if ((id.config >> 8) & 0x80) { diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 45e48601f7..69994dd9d3 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -69,39 +69,7 @@ static void log_fn(struct udev *udev, int priority, vsyslog(priority, format, args); } -static void set_str(char *to, const char *from, size_t count) -{ - size_t i, j, len; - - /* strip trailing whitespace */ - len = strnlen(from, count); - while (len && isspace(from[len-1])) - len--; - - /* strip leading whitespace */ - i = 0; - while (isspace(from[i]) && (i < len)) - i++; - - j = 0; - while (i < len) { - /* substitute multiple whitespace */ - if (isspace(from[i])) { - while (isspace(from[i])) - i++; - to[j++] = '_'; - } - /* skip chars */ - if (from[i] == '/') { - i++; - continue; - } - to[j++] = from[i++]; - } - to[j] = '\0'; -} - -static void set_type(char *to, const char *from, size_t len) +static void set_type(const char *from, char *to, size_t len) { int type_num; char *eptr; @@ -533,11 +501,10 @@ static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, co if (retval) return retval; - set_str(vendor_str, dev_scsi->vendor, sizeof(vendor_str)); - set_str(model_str, dev_scsi->model, sizeof(model_str)); - set_type(type_str, dev_scsi->type, sizeof(type_str)); - set_str(revision_str, dev_scsi->revision, sizeof(revision_str)); - + udev_util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); + udev_util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); + set_type(dev_scsi->type, type_str, sizeof(type_str)); + udev_util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); return 0; } @@ -604,9 +571,9 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) printf("ID_VENDOR=%s\n", vendor_str); printf("ID_MODEL=%s\n", model_str); printf("ID_REVISION=%s\n", revision_str); - set_str(serial_str, dev_scsi.serial, sizeof(serial_str)); + udev_util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); printf("ID_SERIAL=%s\n", serial_str); - set_str(serial_str, serial_short, sizeof(serial_str)); + udev_util_replace_whitespace(serial_short, serial_str, sizeof(serial_str)); printf("ID_SERIAL_SHORT=%s\n", serial_str); printf("ID_TYPE=%s\n", type_str); } else { diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 1499695c67..6dd1d450fb 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -46,44 +46,6 @@ static char instance_str[64]; static int use_usb_info; static int use_num_info; -static void set_str(char *to, const char *from, size_t count) -{ - size_t i, j, len; - - /* strip trailing whitespace */ - len = strnlen(from, count); - while (len && isspace(from[len-1])) - len--; - - /* strip leading whitespace */ - i = 0; - while (isspace(from[i]) && (i < len)) - i++; - - j = 0; - while (i < len) { - /* substitute multiple whitespace */ - if (isspace(from[i])) { - while (isspace(from[i])) - i++; - to[j++] = '_'; - } - /* Replace '/' with '.' */ - if (from[i] == '/') { - to[j++] = '.'; - i++; - continue; - } - /* skip non-printable chars */ - if (!isalnum(from[i]) && !ispunct(from[i])) { - i++; - continue; - } - to[j++] = from[i++]; - } - to[j] = '\0'; -} - static void set_usb_iftype(char *to, int if_class_num, size_t len) { char *type = "generic"; @@ -274,7 +236,7 @@ static int usb_id(struct udev_device *dev) udev_device_get_sysname(dev_scsi)); goto fallback; } - set_str(vendor_str, scsi_vendor, sizeof(vendor_str)-1); + udev_util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); if (!scsi_model) { @@ -282,7 +244,7 @@ static int usb_id(struct udev_device *dev) udev_device_get_sysname(dev_scsi)); goto fallback; } - set_str(model_str, scsi_model, sizeof(model_str)-1); + udev_util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); if (!scsi_type) { @@ -298,7 +260,7 @@ static int usb_id(struct udev_device *dev) udev_device_get_sysname(dev_scsi)); goto fallback; } - set_str(revision_str, scsi_rev, sizeof(revision_str)-1); + udev_util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); /* * some broken devices have the same identifiers @@ -322,7 +284,7 @@ fallback: info(udev, "No USB vendor information available\n"); return 1; } - set_str(vendor_str, usb_vendor, sizeof(vendor_str)-1); + udev_util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); } if (model_str[0] == '\0') { @@ -338,7 +300,7 @@ fallback: dbg(udev, "No USB model information available\n"); return 1; } - set_str(model_str, usb_model, sizeof(model_str)-1); + udev_util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); } if (revision_str[0] == '\0') { @@ -346,7 +308,7 @@ fallback: usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); if (usb_rev) - set_str(revision_str, usb_rev, sizeof(revision_str)-1); + udev_util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); } if (serial_str[0] == '\0') { @@ -354,7 +316,7 @@ fallback: usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); if (usb_serial) - set_str(serial_str, usb_serial, sizeof(serial_str)-1); + udev_util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); } return 0; } diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index b4db5adcd8..df47501a6b 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -66,38 +66,6 @@ static void vid_log(int priority, const char *file, int line, const char *format return; } -static void set_str(char *to, const char *from, size_t count) -{ - size_t i, j, len; - - /* strip trailing whitespace */ - len = strnlen(from, count); - while (len && isspace(from[len-1])) - len--; - - /* strip leading whitespace */ - i = 0; - while (isspace(from[i]) && (i < len)) - i++; - - j = 0; - while (i < len) { - /* substitute multiple whitespace */ - if (isspace(from[i])) { - while (isspace(from[i])) - i++; - to[j++] = '_'; - } - /* skip chars */ - if (from[i] == '/') { - i++; - continue; - } - to[j++] = from[i++]; - } - to[j] = '\0'; -} - static int all_probers(volume_id_probe_fn_t probe_fn, struct volume_id *id, uint64_t off, uint64_t size, void *data) @@ -288,12 +256,12 @@ int main(int argc, char *argv[]) goto exit; } - set_str(label_safe, label, sizeof(label_safe)); - util_replace_chars(label_safe, ALLOWED_CHARS_INPUT); + udev_util_replace_whitespace(label, label_safe, sizeof(label_safe)); + udev_util_replace_chars(label_safe, UDEV_ALLOWED_CHARS_INPUT); volume_id_encode_string(label, label_enc, sizeof(label_enc)); - set_str(uuid_safe, uuid, sizeof(uuid_safe)); - util_replace_chars(uuid_safe, ALLOWED_CHARS_INPUT); + udev_util_replace_whitespace(uuid, uuid_safe, sizeof(uuid_safe)); + udev_util_replace_chars(uuid_safe, UDEV_ALLOWED_CHARS_INPUT); volume_id_encode_string(uuid, uuid_enc, sizeof(uuid_enc)); volume_id_encode_string(type, type_enc, sizeof(type_enc)); diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 2f8b8259b5..5e09188f08 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -159,9 +159,10 @@ extern int udev_queue_export_device_finished(struct udev_queue *udev_queue, stru extern int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device); /* libudev-utils */ -#define UTIL_PATH_SIZE 1024 -#define UTIL_LINE_SIZE 2048 -#define UTIL_NAME_SIZE 512 +#define UTIL_PATH_SIZE 1024 +#define UTIL_LINE_SIZE 2048 +#define UTIL_NAME_SIZE 512 +#define UDEV_ALLOWED_CHARS_INPUT "/ $%?," extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); extern ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); extern int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); @@ -171,5 +172,7 @@ extern size_t util_path_decode(char *s); extern void util_remove_trailing_chars(char *path, char c); extern size_t util_strlcpy(char *dst, const char *src, size_t size); extern size_t util_strlcat(char *dst, const char *src, size_t size); -extern int util_replace_chars(char *str, const char *white); +extern int udev_util_replace_whitespace(const char *str, char *to, size_t len); +extern int udev_util_replace_chars(char *str, const char *white); +extern int udev_util_encode_string(const char *str, char *str_enc, size_t len); #endif diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 9353e8eda7..f4e78850f9 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -331,8 +331,47 @@ static int utf8_encoded_valid_unichar(const char *str) return len; } +int udev_util_replace_whitespace(const char *str, char *to, size_t len) +{ + size_t i, j; + + /* strip trailing whitespace */ + len = strnlen(str, len); + while (len && isspace(str[len-1])) + len--; + + /* strip leading whitespace */ + i = 0; + while (isspace(str[i]) && (i < len)) + i++; + + j = 0; + while (i < len) { + /* substitute multiple whitespace with a single '_' */ + if (isspace(str[i])) { + while (isspace(str[i])) + i++; + to[j++] = '_'; + } + to[j++] = str[i++]; + } + to[j] = '\0'; + return 0; +} + +static int is_whitelisted(char c, const char *white) +{ + if ((c >= '0' && c <= '9') || + (c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') || + strchr("#+-.:=@_", c) != NULL || + (white != NULL && strchr(white, c) != NULL)) + return 1; + return 0; +} + /* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ -int util_replace_chars(char *str, const char *white) +int udev_util_replace_chars(char *str, const char *white) { size_t i = 0; int replaced = 0; @@ -340,16 +379,7 @@ int util_replace_chars(char *str, const char *white) while (str[i] != '\0') { int len; - /* accept whitelist */ - if (white != NULL && strchr(white, str[i]) != NULL) { - i++; - continue; - } - - /* accept plain ascii char */ - if ((str[i] >= '0' && str[i] <= '9') || - (str[i] >= 'A' && str[i] <= 'Z') || - (str[i] >= 'a' && str[i] <= 'z')) { + if (is_whitelisted(str[i], white)) { i++; continue; } @@ -380,6 +410,49 @@ int util_replace_chars(char *str, const char *white) i++; replaced++; } - return replaced; } + +/** + * util_encode_string: + * @str: input string to be encoded + * @str_enc: output string to store the encoded input string + * @len: maximum size of the output string, which may be + * four times as long as the input string + * + * Encode all potentially unsafe characters of a string to the + * corresponding hex value prefixed by '\x'. + * + * Returns: 0 if the entire string was copied, non-zero otherwise. + **/ +int udev_util_encode_string(const char *str, char *str_enc, size_t len) +{ + size_t i, j; + + if (str == NULL || str_enc == NULL || len == 0) + return -1; + + str_enc[0] = '\0'; + for (i = 0, j = 0; str[i] != '\0'; i++) { + int seqlen; + + seqlen = utf8_encoded_valid_unichar(&str[i]); + if (seqlen > 1) { + memcpy(&str_enc[j], &str[i], seqlen); + j += seqlen; + i += (seqlen-1); + } else if (str[i] == '\\' || !is_whitelisted(str[i], NULL)) { + sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); + j += 4; + } else { + str_enc[j] = str[i]; + j++; + } + if (j+3 >= len) + goto err; + } + str_enc[j] = '\0'; + return 0; +err: + return -1; +} diff --git a/udev/udev-event.c b/udev/udev-event.c index fe579b49c7..2d513d7b65 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -319,7 +319,7 @@ found: size = strlen(value); while (size > 0 && isspace(value[--size])) value[size] = '\0'; - count = util_replace_chars(value, ALLOWED_CHARS_INPUT); + count = udev_util_replace_chars(value, UDEV_ALLOWED_CHARS_INPUT); if (count > 0) info(event->udev, "%i character(s) replaced\n" , count); util_strlcat(string, value, maxsize); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index e07cd3264c..876aa76713 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2085,7 +2085,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_remove_trailing_chars(result, '\n'); if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = util_replace_chars(result, ALLOWED_CHARS_INPUT); + count = udev_util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); if (count > 0) info(event->udev, "%i character(s) replaced\n" , count); } @@ -2284,7 +2284,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(name_str, name, sizeof(name_str)); udev_event_apply_format(event, name_str, sizeof(name_str)); if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = util_replace_chars(name_str, ALLOWED_CHARS_FILE); + count = udev_util_replace_chars(name_str, "/"); if (count > 0) info(event->udev, "%i character(s) replaced\n", count); free(event->name); @@ -2316,9 +2316,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_strlcpy(temp, &rules->buf[cur->key.value_off], sizeof(temp)); udev_event_apply_format(event, temp, sizeof(temp)); if (esc == ESCAPE_UNSET) - count = util_replace_chars(temp, ALLOWED_CHARS_FILE " "); + count = udev_util_replace_chars(temp, "/ "); else if (esc == ESCAPE_REPLACE) - count = util_replace_chars(temp, ALLOWED_CHARS_FILE); + count = udev_util_replace_chars(temp, "/"); if (count > 0) info(event->udev, "%i character(s) replaced\n" , count); dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); diff --git a/udev/udev.h b/udev/udev.h index 732b131390..ea8c8d919d 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -26,10 +26,6 @@ #include "lib/libudev.h" #include "lib/libudev-private.h" -#define ALLOWED_CHARS "#+-.:=@_" -#define ALLOWED_CHARS_FILE ALLOWED_CHARS "/" -#define ALLOWED_CHARS_INPUT ALLOWED_CHARS_FILE " $%?," - #define DEFAULT_FAKE_PARTITIONS_COUNT 15 #define UDEV_EVENT_TIMEOUT 180 -- cgit v1.2.3-54-g00ecf From adea2cc22b8b3d645ce2bf5eeef7a08980cc750c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Nov 2008 22:13:49 +0100 Subject: $links should be relative --- udev/udev-event.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 2d513d7b65..27bb5eb79a 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -394,13 +394,14 @@ found: break; case SUBST_LINKS: { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; struct udev_list_entry *list_entry; list_entry = udev_device_get_devlinks_list_entry(dev); - util_strlcat(string, udev_list_entry_get_name(list_entry), maxsize); + util_strlcat(string, &udev_list_entry_get_name(list_entry)[devlen], maxsize); udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { util_strlcat(string, " ", maxsize); - util_strlcat(string, udev_list_entry_get_name(list_entry), maxsize); + util_strlcat(string, &udev_list_entry_get_name(list_entry)[devlen], maxsize); } } break; -- cgit v1.2.3-54-g00ecf From 3f3aa9f57cdd1aacf9fba1c90bacd1840392b7e8 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 5 Nov 2008 22:28:52 +0100 Subject: udevd: shrink struct token to 12 bytes --- udev/udev-rules.c | 46 +++++++++++++++++----------------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 876aa76713..40947685d0 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -141,23 +141,23 @@ enum token_type { TK_END, }; -/* we try to pack stuff in a way that we take only 16 bytes per token */ +/* we try to pack stuff in a way that we take only 12 bytes per token */ struct token { union { - unsigned short type; /* same as in rule and key */ + unsigned char type; /* same as in rule and key */ struct { - unsigned short type; - unsigned short flags; - unsigned int next_rule; + unsigned char type; + unsigned char flags; + unsigned short token_count; unsigned int label_off; unsigned short filename_off; unsigned short filename_line; } rule; struct { - unsigned short type; - unsigned short flags; - unsigned short op; - unsigned short glob; + unsigned char type; + unsigned char flags; + unsigned char op; + unsigned char glob; unsigned int value_off; union { unsigned int attr_off; @@ -274,10 +274,11 @@ static void dump_token(struct udev_rules *rules, struct token *token) const char *tk_ptr = (char *)token; unsigned int off = tk_ptr - tks_ptr; - dbg(rules->udev, "* RULE %s:%u, off: %u(%u), next: %u, label: '%s', flags: 0x%02x\n", + dbg(rules->udev, "* RULE %s:%u, off: %u(%u), token_count: %u(%u), label: '%s', flags: 0x%02x\n", &rules->buf[token->rule.filename_off], token->rule.filename_line, off / (unsigned int) sizeof(struct token), off, - token->rule.next_rule, + token->rule.token_count, + token->rule.token_count * (unsigned int) sizeof(struct token), &rules->buf[token->rule.label_off], token->rule.flags); break; @@ -1439,12 +1440,14 @@ static int add_rule(struct udev_rules *rules, char *line, goto invalid; /* add rule token */ + rule_tmp.rule.rule.token_count = 1 + rule_tmp.token_cur; if (add_token(rules, &rule_tmp.rule) != 0) goto invalid; /* add tokens to list, sorted by type */ if (sort_token(rules, &rule_tmp) != 0) goto invalid; + return 0; invalid: err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); @@ -1571,9 +1574,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) struct stat statbuf; struct udev_list_node file_list; struct udev_list_entry *file_loop, *file_tmp; - unsigned int prev_rule; struct token end_token; - unsigned int i; rules = malloc(sizeof(struct udev_rules)); if (rules == NULL) @@ -1689,15 +1690,6 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) end_token.type = TK_END; add_token(rules, &end_token); - /* link all TK_RULE tokens to be able to fast-forward to next TK_RULE */ - prev_rule = 0; - for (i = 1; i < rules->token_cur; i++) { - if (rules->tokens[i].type == TK_RULE) { - rules->tokens[prev_rule].rule.next_rule = i; - prev_rule = i; - } - } - /* shrink allocated token and string buffer */ if (rules->token_cur < rules->token_max) { struct token *tokens; @@ -1885,8 +1877,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event cur = &rules->tokens[0]; rule = cur; while (1) { - unsigned int idx; - dump_token(rules, cur); switch (cur->type) { case TK_RULE: @@ -2426,10 +2416,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event continue; nomatch: /* fast-forward to next rule */ - idx = rule->rule.next_rule; - if (idx == 0) - return 0; - dbg(rules->udev, "forward to rule: %u\n", idx); - cur = &rules->tokens[idx]; + cur = rule + rule->rule.token_count; + dbg(rules->udev, "forward to rule: %u\n", + (unsigned int) (cur - rules->tokens)); } } -- cgit v1.2.3-54-g00ecf From 90024521e73a734f668b8168f1577bd0d02f3b7b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Nov 2008 02:56:45 +0100 Subject: fix indentation --- udev/udev-util.c | 74 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/udev/udev-util.c b/udev/udev-util.c index 2620d9a994..271941b8ff 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -135,46 +135,46 @@ uid_t util_lookup_user(struct udev *udev, const char *user) if (strcmp(user, "root") == 0) return 0; - uid = strtoul(user, &endptr, 10); - if (endptr[0] == '\0') - return uid; - - errno = 0; - getpwnam_r(user, &pwbuf, buf, buflen, &pw); - if (pw != NULL) - return pw->pw_uid; - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err(udev, "specified user '%s' unknown\n", user); - else - err(udev, "error resolving user '%s': %m\n", user); - return 0; - } + uid = strtoul(user, &endptr, 10); + if (endptr[0] == '\0') + return uid; + + errno = 0; + getpwnam_r(user, &pwbuf, buf, buflen, &pw); + if (pw != NULL) + return pw->pw_uid; + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err(udev, "specified user '%s' unknown\n", user); + else + err(udev, "error resolving user '%s': %m\n", user); + return 0; +} - extern gid_t util_lookup_group(struct udev *udev, const char *group) - { - char *endptr; - int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); - char buf[buflen]; - struct group grbuf; - struct group *gr; - gid_t gid = 0; +extern gid_t util_lookup_group(struct udev *udev, const char *group) +{ + char *endptr; + int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); + char buf[buflen]; + struct group grbuf; + struct group *gr; + gid_t gid = 0; - if (strcmp(group, "root") == 0) - return 0; - gid = strtoul(group, &endptr, 10); - if (endptr[0] == '\0') - return gid; - - errno = 0; - getgrnam_r(group, &grbuf, buf, buflen, &gr); - if (gr != NULL) - return gr->gr_gid; - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err(udev, "specified group '%s' unknown\n", group); - else - err(udev, "error resolving group '%s': %m\n", group); + if (strcmp(group, "root") == 0) return 0; - } + gid = strtoul(group, &endptr, 10); + if (endptr[0] == '\0') + return gid; + + errno = 0; + getgrnam_r(group, &grbuf, buf, buflen, &gr); + if (gr != NULL) + return gr->gr_gid; + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err(udev, "specified group '%s' unknown\n", group); + else + err(udev, "error resolving group '%s': %m\n", group); + return 0; +} /* handle "[/]" format */ int util_resolve_subsys_kernel(struct udev *udev, const char *string, -- cgit v1.2.3-54-g00ecf From e32135825f70ec1f1c449a9201a80917abe5d842 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Nov 2008 08:17:33 +0100 Subject: rules: md - add mdadm 3 device naming --- rules/packages/64-md-raid.rules | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rules/packages/64-md-raid.rules b/rules/packages/64-md-raid.rules index 0e6a939c12..6fe4d46dc9 100644 --- a/rules/packages/64-md-raid.rules +++ b/rules/packages/64-md-raid.rules @@ -8,13 +8,20 @@ ACTION!="add|change", GOTO="md_end" # import data from a raid set KERNEL!="md*", GOTO="md_end" +# container devices have a metadata version of e.g. 'external:ddf' and +# never leave state 'inactive' +ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state" ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" +LABEL="md_ignore_state" IMPORT{program}="/sbin/mdadm --detail --export $tempnode" ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace" ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" +ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}" ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace" ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n" +ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n" +ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n" IMPORT{program}="vol_id --export $tempnode" OPTIONS+="link_priority=100" -- cgit v1.2.3-54-g00ecf From 78230c0dbedbb9273bf2abde8c48db1e8be952f8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Nov 2008 17:43:12 +0100 Subject: cleanup /dev/.udev/queue on startup and exit --- udev/udev-rules.c | 15 ++++++++------- udev/udevd.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 40947685d0..c718ff04eb 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1528,7 +1528,6 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix) { - struct dirent *ent; DIR *dir; char filename[UTIL_PATH_SIZE]; @@ -1540,26 +1539,28 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis } while (1) { - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') + struct dirent *dent; + + dent = readdir(dir); + if (dent == NULL || dent->d_name[0] == '\0') break; - if ((ent->d_name[0] == '.') || (ent->d_name[0] == '#')) + if (dent->d_name[0] == '.') continue; /* look for file matching with specified suffix */ if (suffix != NULL) { const char *ext; - ext = strrchr(ent->d_name, '.'); + ext = strrchr(dent->d_name, '.'); if (ext == NULL) continue; if (strcmp(ext, suffix) != 0) continue; } - dbg(udev, "put file '%s/%s' into list\n", dirname, ent->d_name); + dbg(udev, "put file '%s/%s' into list\n", dirname, dent->d_name); - snprintf(filename, sizeof(filename), "%s/%s", dirname, ent->d_name); + snprintf(filename, sizeof(filename), "%s/%s", dirname, dent->d_name); filename[sizeof(filename)-1] = '\0'; udev_list_entry_add(udev, file_list, filename, NULL, 1, 1); } diff --git a/udev/udevd.c b/udev/udevd.c index 405a1ed907..15a197e561 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -569,6 +570,38 @@ static void reap_sigchilds(void) } } +static void cleanup_queue_dir(struct udev *udev) +{ + char dirname[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + DIR *dir; + + util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); + util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + unlink(filename); + + util_strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); + util_strlcat(dirname, "/.udev/queue", sizeof(dirname)); + dir = opendir(dirname); + if (dir != NULL) { + while (1) { + struct dirent *dent; + + dent = readdir(dir); + if (dent == NULL || dent->d_name[0] == '\0') + break; + if (dent->d_name[0] == '.') + continue; + util_strlcpy(filename, dirname, sizeof(filename)); + util_strlcat(filename, "/", sizeof(filename)); + util_strlcat(filename, dent->d_name, sizeof(filename)); + unlink(filename); + } + closedir(dir); + rmdir(dirname); + } +} + static void export_initial_seqnum(struct udev *udev) { char filename[UTIL_PATH_SIZE]; @@ -732,6 +765,7 @@ int main(int argc, char *argv[]) goto exit; } udev_list_init(&event_list); + cleanup_queue_dir(udev); export_initial_seqnum(udev); if (daemonize) { @@ -954,7 +988,7 @@ exit: if (inotify_fd >= 0) close(inotify_fd); udev_monitor_unref(kernel_monitor); - + cleanup_queue_dir(udev); udev_selinux_exit(udev); udev_unref(udev); logging_close(); -- cgit v1.2.3-54-g00ecf From 11d5eec2cb75327b3d3f5360010d6afc3550a8e6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Nov 2008 19:41:58 +0100 Subject: udevadm: settle - exit if udevd exits --- udev/lib/exported_symbols | 1 + udev/lib/libudev-queue.c | 19 ++++++++++++++++++- udev/lib/libudev.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index da84a8939e..abb6ae3a57 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -59,6 +59,7 @@ udev_queue_unref udev_queue_get_udev udev_queue_get_kernel_seqnum udev_queue_get_udev_seqnum +udev_queue_get_udev_is_active udev_queue_get_queue_is_empty udev_queue_get_seqnum_is_finished udev_queue_get_queued_list_entry diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index 28d877749d..51878dab67 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -133,6 +133,20 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) return seqnum; } +int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) +{ + char filename[UTIL_PATH_SIZE]; + struct stat statbuf; + + if (udev_queue == NULL) + return 0; + util_strlcpy(filename, udev_get_dev_path(udev_queue->udev), sizeof(filename)); + util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + if (stat(filename, &statbuf) == 0) + return 1; + return 0; +} + int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) { char queuename[UTIL_PATH_SIZE]; @@ -152,7 +166,10 @@ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) dbg(udev_queue->udev, "queue is empty\n"); return 1; } - udev_queue_get_udev_seqnum(udev_queue); + /* update udev seqnum, and check if udev is still running */ + if (udev_queue_get_udev_seqnum(udev_queue) == 0) + if (!udev_queue_get_udev_is_active(udev_queue)) + return 1; if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) { dbg(udev_queue->udev, "queue is empty\n"); return 1; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 041ffd4dd9..ea6c9ddf02 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -113,6 +113,7 @@ extern void udev_queue_unref(struct udev_queue *udev_queue); extern struct udev *udev_queue_get_udev(struct udev_queue *udev_queue); extern unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue); extern unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue); +extern int udev_queue_get_udev_is_active(struct udev_queue *udev_queue); extern int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); extern int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum); extern struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); -- cgit v1.2.3-54-g00ecf From acae628f5278b96301b6dcc47a71f92880085e30 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 Nov 2008 02:36:20 +0100 Subject: release 131 --- ChangeLog | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 17 +++++--- 2 files changed, 154 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index b008f90fba..ff244323d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,147 @@ +Summary of changes from v130 to v131 +============================================ + +Alan Jenkins (17): + libudev: fix sysnum logic for digit-only device names + udevd: avoid overhead of calling rmdir on non-empty directories + use more appropriate alternatives to malloc() + libudev: util - optimize path_encode() + libudev: allocate udev_device->envp[] dynamically + replace strncpy() with strlcpy() + use re-entrant variants of getpwnam and getgrnam + udevd: fix memory leak + udevd: fix WAIT_FOR_SYSFS execution order + fix handling of string_escape option + udevd: use a tighter loop for compare_devpath() + udevd: avoid implicit memset in match_attr() + kerneldoc comment fixes + udevd: simplify rules execution loop + udevd: fix termination of rule execution + udevd: be more careful when matching against parents + udevd: shrink struct token to 12 bytes + +Kay Sievers (113): + remove outdated docs/README-gcov_for_udev + libudev: device - add device lookup by subsystem:sysname + libudev: also prefix non-exported functions with udev_* + libudev: add udev_monitor_send_device() + libudev: list - add flag + libudev: device - generate DEVNAME and DEVLINKS properties + vol_id: update README + libudev: handle ! in sysname, add sysnum, return allocated list_entry on add + delete simple-build-check.sh + test: move global ENV{ENV_KEY_TEST}="test" to local rule + libudev: monitor - fix send_device() property copying + libudev: device - add get_envp() to construct envp from property list + libudev: do not include ctrl in libudev.so + libudev: monitor - do not mangle DEVLINKS property + libudev: update DEVLINKS property when properties are read + libudev: device - lookup "subsystem" and "driver" only once + libudev: device - export properties when values are set + libudev: list - handle update of key with NULL value + libudev: ctrl - fix typo in set_env() + libudev: add global property list + libudev: device - copy global properties, unset empty properties + volume_id: btrfs - update magic to latest disk format + udevd: use libudev + move udev_device_db to libudev + rename udev source files + libudev: always add UDEV_LOG + libudev: monitor - export MAJOR/MINOR only if available + udev-node: name_list -> udev_list + udev-rules-parse: name_list -> udev_list + delete name_list, move common file functions + fix sorting of rules files + run_program: prevent empty last argv entry + update IMPORT= file/stdout property parsing + update rules file parsing + delete udev-util-file.c + libudev: list - prepend udev_* to all functions + libudev: add sysnum to test program + test: fix a few unintentially wrongly written rules which cause parse errors + libudev: monitor - add set_receive_buffer_size() + libudev: ctrl - change magic to integer + libudev: make list_node functions available + udevd: use udev_list_node + collect: use udev_list + delete list.h + merge udev-rules.c and udev-rules-parse.c + make struct udev_rules opaque + move run_program to util + udev_event_run() -> udev_event_execute_rules() + udev_rules_run() -> udev_event_execute_run(); + move udev_rules_apply_format() to udev-event.c + udev_list_cleanup() -> udev_list_cleanup_entries() + selinux_init(udev) -> udev_selinux_init(udev) + prefix udev-util.c functions with util_* + pass make distcheck + libudev: device - get_attr_value() -> get_sysattr_value() + cdrom_id: remove ARRAY_SIZE() declaration + replace missing get_attr_value() -> get_sysattr_value() + add "root" == 0 shortcuts to lookup_user/group() + do not use the new work-in-progress parser rule matcher + libudev: device - 128 -> ENVP_SIZE + add util_resolve_subsys_kernel() + handle numerical owner/group string in lookup_user/group() + replace in-memory rules array with match/action token list + do not create temporary node ($tempnode) if node already exists + shrink struct udev_event + shrink struct udev_event + rule_generator: fix netif NAME= value extraction regex + skip SYMLINK rules for devices without a device node + rules: let empty strings added to buffer always return offset 0 + fix uninitialized variable warnings + cache uid/gid during rule parsing + distinguish "match" from "assign" by (op < OP_MATCH_MAX) + determine at rule parse time if we need to call fnmatch() + special-case "?*" match to skip fnmatch() + libudev: monitor - replace far too expensive snprintf() with strlcpy() + libudev: monitor - cache result of monitor send buffer + fix "unused" warnings + remove debug printf + match KEY="A|B" without temporary string copy + match_attr() - copy attr value only when needed + do not init string arrays, just clear first byte + fix $attr{[/]} substitution + libudev: device - fill envp array while composing monitor buffer + test: add RUN+="socket: ..." to a test to run monitor code + libudev: device - allocate envp array only once + update NEWS + udevd: merge exec and run queue to minimize devpath string compares + ATTR{}== always fails if the attribute does not exist + rules: remove SCSI timeouts + rules: remove "add" match from usb device node rule + edd_id: add "change" event match + fstab_import: add "change" event match + write trace log to stderr + log rules file and line number when NAME, SYMLINK, OWNER, GROUP, MODE, RUN is applied + skip entire rule containing device naming keys, if no device can be named + fix udev_node_update_old_links() logic + move some info() to dbg() + add "devel" and "install" switches to autogen.sh + move debugging strings inside #ifdef DEBUG + firmware.sh: record missing files in /dev/.udev/firmware-missing/ + fix list handling in enumerate and rules file sorting + volume_id: btrfs update + info() PROGRAM and IMPORT execution + fix $links substitution + fix cleanup of possible left-over symlinks + do not import the "uevent" file when we only read the db to get old symlinks + usb_id: MassStorage SubClass 6 is "scsi" not "disk" + unify string replacement + $links should be relative + fix indentation + rules: md - add mdadm 3 device naming + cleanup /dev/.udev/queue on startup and exit + udevadm: settle - exit if udevd exits + +Matthias Koenig (1): + volume_id: swap - larger PAGE_SIZE support + +Steven Whitehouse (1): + volume_id: support for GFS2 UUIDs + + Summary of changes from v129 to v130 ============================================ diff --git a/NEWS b/NEWS index 0e486f4621..2ac15873d4 100644 --- a/NEWS +++ b/NEWS @@ -1,21 +1,24 @@ udev 131 ======== -Bugfixes. (And probably new bugs. :)) +Bugfixes. (And maybe new bugs. :)) The rule matching engine got converted from a rule list to a token array which reduced the in-memory rules representation of a full -featured distros with thousends of rules from 1.2MB to 0.17 MB. - -The limit of 5 ENV and ATTR matches, and a single instance for most -other keys per rule is gone with the new parser. +featured distros with thousends of udev rules from 1.2MB to 0.12 MB. +Limits like 5 ENV and ATTR matches, and one single instance for most +other keys per rule are gone. The NAME assignment is no longer special cased. If later rules assign a NAME value again, the former value will be overwritten. As usual for most other keys, the NAME value can be protected by doing a final assignment with NAME:="". -Many thanks to Alan Jenkins for finding and optimizing some of the -computing expensive parts. +All udev code now uses libudev, which is also exported. The library +is still under development, marked as experimental, and its interface +may change as long as the DeviceKit integration is not finished. + +Many thanks to Alan Jenkins for his continuous help, and finding and +optimizing some of the computing expensive parts. udev 130 ======== -- cgit v1.2.3-54-g00ecf From e230e966f44c0ebb4954cbd30740384e14c1ca0f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 Nov 2008 02:58:54 +0100 Subject: fix size_t compiler warning on 32 bit platforms --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index c718ff04eb..4713352826 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1710,7 +1710,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) rules->buf_max = rules->buf_cur; } } - info(udev, "shrunk to %lu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + info(udev, "shrunk to %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); /* cleanup uid/gid cache */ -- cgit v1.2.3-54-g00ecf From 5d6a1fa6e92b9760c243725ea543ade85b8b2b79 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 Nov 2008 15:59:58 +0100 Subject: convert debug string arrays to functions On Fri, Nov 7, 2008 at 13:07, Matthias Schwarzott wrote: > I managed to let udev-131 segfault at startup. > > I configured it like this: > CFLAGS="-Wall -ggdb" ./configure --prefix=/usr --sysconfdir=/etc --exec-prefix= > > Running it in gdb shows it segfaults at udev-rules.c:831 > > (gdb) run > Starting program: /tmp/udev-131/udev/udevd > > Program received signal SIGSEGV, Segmentation fault. > 0x0804ea06 in get_key (udev=0x9175008, line=0xafcdc8f0, key=0xafcdc5d8, > op=0xafcdc5d0, value=0xafcdc5d4) > at udev-rules.c:831 > 831 dbg(udev, "%s '%s'-'%s'\n", operation_str[*op], *key, *value); If compiled without optimization, the dbg() macro dereferences variables which are not available. Convert the string array to a function, which just returns NULL if compiled without DEBUG. --- udev/udev-rules.c | 205 +++++++++++++++++++++++++++++------------------------- 1 file changed, 109 insertions(+), 96 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 4713352826..810a863a18 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -184,80 +184,95 @@ struct rule_tmp { }; #ifdef DEBUG -static const char *operation_str[] = { - [OP_UNSET] = "UNSET", - [OP_MATCH] = "match", - [OP_NOMATCH] = "nomatch", - [OP_MATCH_MAX] = "MATCH_MAX", - - [OP_ADD] = "add", - [OP_ASSIGN] = "assign", - [OP_ASSIGN_FINAL] = "assign-final", -}; +static const char *operation_str(enum operation_type type) +{ + static const char *operation_strs[] = { + [OP_UNSET] = "UNSET", + [OP_MATCH] = "match", + [OP_NOMATCH] = "nomatch", + [OP_MATCH_MAX] = "MATCH_MAX", + + [OP_ADD] = "add", + [OP_ASSIGN] = "assign", + [OP_ASSIGN_FINAL] = "assign-final", +} ; + + return operation_strs[type]; +} -static const char *string_glob_str[] = { - [GL_UNSET] = "UNSET", - [GL_PLAIN] = "plain", - [GL_GLOB] = "glob", - [GL_SPLIT] = "split", - [GL_SPLIT_GLOB] = "split-glob", - [GL_SOMETHING] = "split-glob", - [GL_FORMAT] = "format", -}; +static const char *string_glob_str(enum string_glob_type type) +{ + static const char *string_glob_strs[] = { + [GL_UNSET] = "UNSET", + [GL_PLAIN] = "plain", + [GL_GLOB] = "glob", + [GL_SPLIT] = "split", + [GL_SPLIT_GLOB] = "split-glob", + [GL_SOMETHING] = "split-glob", + [GL_FORMAT] = "format", + }; -static const char *token_str[] = { - [TK_UNSET] = "UNSET", - [TK_RULE] = "RULE", - - [TK_M_ACTION] = "M ACTION", - [TK_M_DEVPATH] = "M DEVPATH", - [TK_M_KERNEL] = "M KERNEL", - [TK_M_DEVLINK] = "M DEVLINK", - [TK_M_NAME] = "M NAME", - [TK_M_ENV] = "M ENV", - [TK_M_SUBSYSTEM] = "M SUBSYSTEM", - [TK_M_DRIVER] = "M DRIVER", - [TK_M_WAITFOR] = "M WAITFOR", - [TK_M_ATTR] = "M ATTR", - - [TK_M_PARENTS_MIN] = "M PARENTS_MIN", - [TK_M_KERNELS] = "M KERNELS", - [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", - [TK_M_DRIVERS] = "M DRIVERS", - [TK_M_ATTRS] = "M ATTRS", - [TK_M_PARENTS_MAX] = "M PARENTS_MAX", - - [TK_M_TEST] = "M TEST", - [TK_M_PROGRAM] = "M PROGRAM", - [TK_M_IMPORT_FILE] = "M IMPORT_FILE", - [TK_M_IMPORT_PROG] = "M IMPORT_PROG", - [TK_M_IMPORT_PARENT] = "M MPORT_PARENT", - [TK_M_RESULT] = "M RESULT", - [TK_M_MAX] = "M MAX", - - [TK_A_IGNORE_DEVICE] = "A IGNORE_DEVICE", - [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", - [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", - [TK_A_NUM_FAKE_PART] = "A NUM_FAKE_PART", - [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", - [TK_A_OWNER] = "A OWNER", - [TK_A_GROUP] = "A GROUP", - [TK_A_MODE] = "A MODE", - [TK_A_OWNER_ID] = "A OWNER_ID", - [TK_A_GROUP_ID] = "A GROUP_ID", - [TK_A_MODE_ID] = "A MODE_ID", - [TK_A_ENV] = "A ENV", - [TK_A_NAME] = "A NAME", - [TK_A_DEVLINK] = "A DEVLINK", - [TK_A_EVENT_TIMEOUT] = "A EVENT_TIMEOUT", - [TK_A_IGNORE_REMOVE] = "A IGNORE_REMOVE", - [TK_A_ATTR] = "A ATTR", - [TK_A_RUN] = "A RUN", - [TK_A_GOTO] = "A GOTO", - [TK_A_LAST_RULE] = "A LAST_RULE", - - [TK_END] = "END", -}; + return string_glob_strs[type]; +} + +static const char *token_str(enum token_type type) +{ + static const char *token_strs[] = { + [TK_UNSET] = "UNSET", + [TK_RULE] = "RULE", + + [TK_M_ACTION] = "M ACTION", + [TK_M_DEVPATH] = "M DEVPATH", + [TK_M_KERNEL] = "M KERNEL", + [TK_M_DEVLINK] = "M DEVLINK", + [TK_M_NAME] = "M NAME", + [TK_M_ENV] = "M ENV", + [TK_M_SUBSYSTEM] = "M SUBSYSTEM", + [TK_M_DRIVER] = "M DRIVER", + [TK_M_WAITFOR] = "M WAITFOR", + [TK_M_ATTR] = "M ATTR", + + [TK_M_PARENTS_MIN] = "M PARENTS_MIN", + [TK_M_KERNELS] = "M KERNELS", + [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", + [TK_M_DRIVERS] = "M DRIVERS", + [TK_M_ATTRS] = "M ATTRS", + [TK_M_PARENTS_MAX] = "M PARENTS_MAX", + + [TK_M_TEST] = "M TEST", + [TK_M_PROGRAM] = "M PROGRAM", + [TK_M_IMPORT_FILE] = "M IMPORT_FILE", + [TK_M_IMPORT_PROG] = "M IMPORT_PROG", + [TK_M_IMPORT_PARENT] = "M MPORT_PARENT", + [TK_M_RESULT] = "M RESULT", + [TK_M_MAX] = "M MAX", + + [TK_A_IGNORE_DEVICE] = "A IGNORE_DEVICE", + [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", + [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", + [TK_A_NUM_FAKE_PART] = "A NUM_FAKE_PART", + [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", + [TK_A_OWNER] = "A OWNER", + [TK_A_GROUP] = "A GROUP", + [TK_A_MODE] = "A MODE", + [TK_A_OWNER_ID] = "A OWNER_ID", + [TK_A_GROUP_ID] = "A GROUP_ID", + [TK_A_MODE_ID] = "A MODE_ID", + [TK_A_ENV] = "A ENV", + [TK_A_NAME] = "A NAME", + [TK_A_DEVLINK] = "A DEVLINK", + [TK_A_EVENT_TIMEOUT] = "A EVENT_TIMEOUT", + [TK_A_IGNORE_REMOVE] = "A IGNORE_REMOVE", + [TK_A_ATTR] = "A ATTR", + [TK_A_RUN] = "A RUN", + [TK_A_GOTO] = "A GOTO", + [TK_A_LAST_RULE] = "A LAST_RULE", + + [TK_END] = "END", + }; + + return token_strs[type]; +} static void dump_token(struct udev_rules *rules, struct token *token) { @@ -272,13 +287,11 @@ static void dump_token(struct udev_rules *rules, struct token *token) { const char *tks_ptr = (char *)rules->tokens; const char *tk_ptr = (char *)token; - unsigned int off = tk_ptr - tks_ptr; + unsigned int idx = (tk_ptr - tks_ptr) / sizeof(struct token); - dbg(rules->udev, "* RULE %s:%u, off: %u(%u), token_count: %u(%u), label: '%s', flags: 0x%02x\n", + dbg(rules->udev, "* RULE %s:%u, token: %u, count: %u, label: '%s', flags: 0x%02x\n", &rules->buf[token->rule.filename_off], token->rule.filename_line, - off / (unsigned int) sizeof(struct token), off, - token->rule.token_count, - token->rule.token_count * (unsigned int) sizeof(struct token), + idx, token->rule.token_count, &rules->buf[token->rule.label_off], token->rule.flags); break; @@ -306,7 +319,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_MODE: case TK_A_RUN: dbg(rules->udev, "%s %s '%s'(%s)\n", - token_str[type], operation_str[op], value, string_glob_str[glob]); + token_str(type), operation_str(op), value, string_glob_str(glob)); break; case TK_M_ATTR: case TK_M_ATTRS: @@ -314,42 +327,42 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_ATTR: case TK_A_ENV: dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", - token_str[type], operation_str[op], attr, value, string_glob_str[glob]); + token_str(type), operation_str(op), attr, value, string_glob_str(glob)); break; case TK_A_IGNORE_DEVICE: case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: case TK_A_LAST_RULE: case TK_A_IGNORE_REMOVE: - dbg(rules->udev, "%s\n", token_str[type]); + dbg(rules->udev, "%s\n", token_str(type)); break; case TK_M_TEST: dbg(rules->udev, "%s %s '%s'(%s) %#o\n", - token_str[type], operation_str[op], value, string_glob_str[glob], token->key.mode); + token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode); break; case TK_A_NUM_FAKE_PART: - dbg(rules->udev, "%s %u\n", token_str[type], token->key.num_fake_part); + dbg(rules->udev, "%s %u\n", token_str(type), token->key.num_fake_part); break; case TK_A_DEVLINK_PRIO: - dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.devlink_prio); + dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.devlink_prio); break; case TK_A_OWNER_ID: - dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.uid); + dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.uid); break; case TK_A_GROUP_ID: - dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.gid); + dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.gid); break; case TK_A_MODE_ID: - dbg(rules->udev, "%s %s %#o\n", token_str[type], operation_str[op], token->key.mode); + dbg(rules->udev, "%s %s %#o\n", token_str(type), operation_str(op), token->key.mode); break; case TK_A_EVENT_TIMEOUT: - dbg(rules->udev, "%s %s %u\n", token_str[type], operation_str[op], token->key.event_timeout); + dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.event_timeout); break; case TK_A_GOTO: - dbg(rules->udev, "%s '%s' %u\n", token_str[type], value, token->key.rule_goto); + dbg(rules->udev, "%s '%s' %u\n", token_str(type), value, token->key.rule_goto); break; case TK_END: - dbg(rules->udev, "* %s\n", token_str[type]); + dbg(rules->udev, "* %s\n", token_str(type)); break; case TK_M_PARENTS_MIN: case TK_M_PARENTS_MAX: @@ -373,8 +386,8 @@ static void dump_rules(struct udev_rules *rules) dump_token(rules, &rules->tokens[i]); } #else -static const char **operation_str; -static const char **token_str; +static inline const char *operation_str(enum operation_type type) { return NULL; } +static inline const char *token_str(enum token_type type) { return NULL; } static inline void dump_token(struct udev_rules *rules, struct token *token) {} static inline void dump_rules(struct udev_rules *rules) {} #endif /* DEBUG */ @@ -828,7 +841,7 @@ static int get_key(struct udev *udev, char **line, char **key, enum operation_ty return -1; temp[0] = '\0'; temp++; - dbg(udev, "%s '%s'-'%s'\n", operation_str[*op], *key, *value); + dbg(udev, "%s '%s'-'%s'\n", operation_str(*op), *key, *value); /* move line to next key */ *line = temp; @@ -1791,7 +1804,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * pos[0] = '\0'; pos = &pos[1]; } - dbg(rules->udev, "match %s '%s' <-> '%s'\n", token_str[token->type], key_value, val); + dbg(rules->udev, "match %s '%s' <-> '%s'\n", token_str(token->type), key_value, val); match = (fnmatch(key_value, val, 0) == 0); if (match) break; @@ -1808,14 +1821,14 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * } if (match && (token->key.op == OP_MATCH)) { - dbg(rules->udev, "%s is true (matching value)\n", token_str[token->type]); + dbg(rules->udev, "%s is true (matching value)\n", token_str(token->type)); return 0; } if (!match && (token->key.op == OP_NOMATCH)) { - dbg(rules->udev, "%s is true (non-matching value)\n", token_str[token->type]); + dbg(rules->udev, "%s is true (non-matching value)\n", token_str(token->type)); return 0; } - dbg(rules->udev, "%s is not true\n", token_str[token->type]); + dbg(rules->udev, "%s is not true\n", token_str(token->type)); return -1; } -- cgit v1.2.3-54-g00ecf From bfa9938c0378a4ab21666ca5add4f20192609ef3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 Nov 2008 16:08:58 +0100 Subject: release 132 --- ChangeLog | 8 ++++++++ NEWS | 6 ++++++ configure.ac | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ff244323d0..d91c9f489e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Summary of changes from v131 to v132 +============================================ + +Kay Sievers (2): + fix size_t compiler warning on 32 bit platforms + convert debug string arrays to functions + + Summary of changes from v130 to v131 ============================================ diff --git a/NEWS b/NEWS index 2ac15873d4..275676d103 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +udev 132 +======== + +Fix segfault if compiled without optimization and dbg() does not get +compiled out and uses variables which are not available. + udev 131 ======== Bugfixes. (And maybe new bugs. :)) diff --git a/configure.ac b/configure.ac index 5c96bb9277..e0e01adba1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [131], + [132], [kay.sievers@vrfy.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) -- cgit v1.2.3-54-g00ecf From 1449a55ded1e54ed8cb81c17296344d5905ea9d6 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Tue, 11 Nov 2008 20:20:11 +0000 Subject: udevd: de-duplicate strings in rules On my Ubuntu installation this removes 15k of duplicate strings, using a temporary index of about 25k. Signed-off-by: Alan Jenkins --- udev/udev-rules.c | 172 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 158 insertions(+), 14 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 810a863a18..df5ed5360e 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -30,6 +31,7 @@ #define PREALLOC_TOKEN 2048 #define PREALLOC_STRBUF 32 * 1024 +#define PREALLOC_TRIE 256 struct uid_gid { unsigned int name_off; @@ -39,7 +41,16 @@ struct uid_gid { }; }; -/* KEY=="", KEY!="", KEY+="", KEY="", KEY:="" */ +#define TRIE_CHILD_MAX 10 + +struct trie_node { + unsigned int value_off; + size_t value_len; + unsigned char child_cur; + unsigned char child_key[TRIE_CHILD_MAX]; + unsigned short child[TRIE_CHILD_MAX]; +}; + struct udev_rules { struct udev *udev; int resolve_names; @@ -55,6 +66,12 @@ struct udev_rules { size_t buf_max; unsigned int buf_count; + /* key strings are indexed to avoid wasting space with duplicates */ + struct trie_node *trie; + unsigned short trie_cur; + unsigned short trie_max; + unsigned short *trie_root; + /* during rule parsing, we cache uid/gid lookup results */ struct uid_gid *uids; unsigned int uids_cur; @@ -64,6 +81,7 @@ struct udev_rules { unsigned int gids_max; }; +/* KEY=="", KEY!="", KEY+="", KEY="", KEY:="" */ enum operation_type { OP_UNSET, @@ -392,25 +410,19 @@ static inline void dump_token(struct udev_rules *rules, struct token *token) {} static inline void dump_rules(struct udev_rules *rules) {} #endif /* DEBUG */ -/* we could lookup and return existing strings, or tails of strings */ -static int add_string(struct udev_rules *rules, const char *str) +static int add_new_string(struct udev_rules *rules, const char *str, size_t bytes) { - size_t len = strlen(str)+1; int off; - /* offset 0 is always '\0' */ - if (str[0] == '\0') - return 0; - /* grow buffer if needed */ - if (rules->buf_cur + len+1 >= rules->buf_max) { + if (rules->buf_cur + bytes+1 >= rules->buf_max) { char *buf; unsigned int add; /* double the buffer size */ add = rules->buf_max; - if (add < len * 8) - add = len * 8; + if (add < bytes * 8) + add = bytes * 8; buf = realloc(rules->buf, rules->buf_max + add); if (buf == NULL) @@ -420,15 +432,128 @@ static int add_string(struct udev_rules *rules, const char *str) rules->buf_max += add; } off = rules->buf_cur; - memcpy(&rules->buf[rules->buf_cur], str, len); - rules->buf_cur += len; + memcpy(&rules->buf[rules->buf_cur], str, bytes); + rules->buf_cur += bytes; rules->buf_count++; return off; } -static int add_token(struct udev_rules *rules, struct token *token) +static unsigned char trie_child_slot(struct trie_node *node, char key) { + unsigned char child_slot; + + for (child_slot = 0; child_slot < node->child_cur; child_slot++) { + if (node->child_key[child_slot] == key) + break; + } + + return child_slot; +} + +static int add_string(struct udev_rules *rules, const char *str) +{ + struct trie_node *child; + unsigned short child_off; + unsigned short node_off; + unsigned char key; + size_t len; + int depth; + unsigned int off; + + len = strlen(str); + + /* offset 0 is always '\0' */ + if (len == 0) + return 0; + + /* strings with spaces are probably commands e.g. modprobe, + with unique arguments. */ + if (strchr(str, ' ') != NULL) + return add_new_string(rules, str, len + 1); + + /* descend root - start from last character of str */ + key = str[len - 1]; + node_off = rules->trie_root[key]; + depth = 0; + + /* descend suffix trie */ + if (node_off != 0) { + while (1) { + struct trie_node *node = &rules->trie[node_off]; + unsigned char child_slot; + + depth++; + off = node->value_off + node->value_len - len; + + /* match against current node */ + if (depth == len || + (node->value_len >= len && + memcmp(&rules->buf[off], str, len) == 0)) + { + return off; + } + /* lookup child node */ + key = str[len - 1 - depth]; + child_slot = trie_child_slot(node, key); + + if(child_slot == node->child_cur) + break; + + node_off = node->child[child_slot]; + } + } + + /* string not found, add it */ + off = add_new_string(rules, str, len + 1); + + /* grow trie storage if needed */ + if (rules->trie_cur >= rules->trie_max) { + struct trie_node *trie; + unsigned short add; + + /* double the buffer size */ + add = rules->trie_max; + if (add < 8) + add = 8; + + trie = realloc(rules->trie, (rules->trie_max + add) * sizeof(struct trie_node)); + if (trie == NULL) + return -1; + dbg(rules->udev, "extend string index nodes from %u to %u\n", rules->trie_max, rules->trie_max + add); + rules->trie = trie; + rules->trie_max += add; + } + + /* insert new child node */ + child_off = rules->trie_cur; + if (depth == 0) { + rules->trie_root[key] = child_off; + } else { + struct trie_node *parent = &rules->trie[node_off]; + unsigned char child_slot = parent->child_cur; + + /* no space in parent, we can't index this string, nevermind */ + if (child_slot == TRIE_CHILD_MAX) + return off; + + parent->child[child_slot] = child_off; + parent->child_key[child_slot] = key; + parent->child_cur = child_slot + 1; + } + + /* allocate and construct the child node */ + rules->trie_cur++; + child = &rules->trie[child_off]; + memset(child, 0x00, sizeof(struct trie_node)); + child->value_off = off; + child->value_len = len; + + return off; +} + +static int add_token(struct udev_rules *rules, struct token *token) +{ /* grow buffer if needed */ if (rules->token_cur+1 >= rules->token_max) { struct token *tokens; @@ -1607,9 +1732,16 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (rules->buf == NULL) return NULL; rules->buf_max = PREALLOC_STRBUF; + rules->trie = malloc(PREALLOC_TRIE * sizeof(struct trie_node)); + if (rules->trie == NULL) + return NULL; + rules->trie_max = PREALLOC_TRIE; + rules->trie_root = calloc(UCHAR_MAX + 1, sizeof(unsigned short)); /* offset 0 is always '\0' */ rules->buf[0] = '\0'; rules->buf_cur = 1; + /* offset 0 is reserved for the null trie node */ + rules->trie_cur = 1; dbg(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); @@ -1725,6 +1857,16 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) } info(udev, "shrunk to %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); + info(udev, "used %zu bytes of string index nodes (%hu * %zu bytes)\n", + rules->trie_cur * sizeof(struct trie_node), rules->trie_cur, sizeof(struct trie_node)); + + /* cleanup trie */ + free(rules->trie); + rules->trie = NULL; + rules->trie_cur = 0; + rules->trie_max = 0; + free(rules->trie_root); + rules->trie_root = NULL; /* cleanup uid/gid cache */ free(rules->uids); @@ -1746,6 +1888,8 @@ void udev_rules_unref(struct udev_rules *rules) return; free(rules->tokens); free(rules->buf); + free(rules->trie); + free(rules->trie_root); free(rules->uids); free(rules->gids); free(rules); -- cgit v1.2.3-54-g00ecf From 1c8af93aca64033f00d493bad7d505757c1ab414 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 11 Nov 2008 23:47:01 +0100 Subject: silence "comparison between signed and unsigned" --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index df5ed5360e..dc4009f74a 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -457,7 +457,7 @@ static int add_string(struct udev_rules *rules, const char *str) unsigned short node_off; unsigned char key; size_t len; - int depth; + unsigned int depth; unsigned int off; len = strlen(str); -- cgit v1.2.3-54-g00ecf From bcf44d55762557096fdd627b14415e35f3a4e14d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 12 Nov 2008 05:50:05 +0100 Subject: string index - split nodes and childs to allow and unlimited number of childs --- test/udev-test.pl | 8 ++ udev/udev-rules.c | 216 ++++++++++++++++++++++++++++++++---------------------- 2 files changed, 135 insertions(+), 89 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 95f9af0e2b..61e91c48b6 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -30,6 +30,14 @@ my $udev_conf = "udev-test.conf"; my $udev_rules = "udev-test.rules"; my @tests = ( + { + desc => "no rules", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda" , + rules => < "label test of scsi disc (old key names)", subsys => "block", diff --git a/udev/udev-rules.c b/udev/udev-rules.c index dc4009f74a..efd8310cd0 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -41,14 +41,17 @@ struct uid_gid { }; }; -#define TRIE_CHILD_MAX 10 +struct trie_child { + unsigned int next_idx; + unsigned int node_idx; + unsigned char key; +}; struct trie_node { + unsigned int child_idx; + unsigned int last_child_idx; unsigned int value_off; - size_t value_len; - unsigned char child_cur; - unsigned char child_key[TRIE_CHILD_MAX]; - unsigned short child[TRIE_CHILD_MAX]; + unsigned short value_len; }; struct udev_rules { @@ -66,13 +69,16 @@ struct udev_rules { size_t buf_max; unsigned int buf_count; - /* key strings are indexed to avoid wasting space with duplicates */ - struct trie_node *trie; - unsigned short trie_cur; - unsigned short trie_max; - unsigned short *trie_root; + /* during rule parsing, strings are indexed to find duplicates */ + unsigned int *trie_root; + struct trie_node *trie_nodes; + unsigned int trie_nodes_cur; + unsigned int trie_nodes_max; + struct trie_child *trie_childs; + unsigned int trie_childs_cur; + unsigned int trie_childs_max; - /* during rule parsing, we cache uid/gid lookup results */ + /* during rule parsing, uid/gid lookup results are cached */ struct uid_gid *uids; unsigned int uids_cur; unsigned int uids_max; @@ -438,25 +444,13 @@ static int add_new_string(struct udev_rules *rules, const char *str, size_t byte return off; } -static unsigned char trie_child_slot(struct trie_node *node, char key) -{ - unsigned char child_slot; - - for (child_slot = 0; child_slot < node->child_cur; child_slot++) { - if (node->child_key[child_slot] == key) - break; - } - - return child_slot; -} - static int add_string(struct udev_rules *rules, const char *str) { - struct trie_node *child; - unsigned short child_off; - unsigned short node_off; + unsigned int node_idx; + struct trie_node *new_node; + unsigned int new_node_idx; unsigned char key; - size_t len; + unsigned short len; unsigned int depth; unsigned int off; @@ -466,89 +460,118 @@ static int add_string(struct udev_rules *rules, const char *str) if (len == 0) return 0; - /* strings with spaces are probably commands e.g. modprobe, - with unique arguments. */ - if (strchr(str, ' ') != NULL) - return add_new_string(rules, str, len + 1); - /* descend root - start from last character of str */ key = str[len - 1]; - node_off = rules->trie_root[key]; + node_idx = rules->trie_root[key]; depth = 0; /* descend suffix trie */ - if (node_off != 0) { + if (node_idx > 0) { while (1) { - struct trie_node *node = &rules->trie[node_off]; - unsigned char child_slot; + struct trie_node *node; + unsigned int child_idx; + node = &rules->trie_nodes[node_idx]; depth++; off = node->value_off + node->value_len - len; /* match against current node */ - if (depth == len || - (node->value_len >= len && - memcmp(&rules->buf[off], str, len) == 0)) - { + if (depth == len || (node->value_len >= len && memcmp(&rules->buf[off], str, len) == 0)) return off; - } /* lookup child node */ key = str[len - 1 - depth]; - child_slot = trie_child_slot(node, key); - - if(child_slot == node->child_cur) + child_idx = node->child_idx; + while (child_idx > 0) { + if (rules->trie_childs[child_idx].key == key) + break; + child_idx = rules->trie_childs[child_idx].next_idx; + } + if (child_idx == 0) break; - - node_off = node->child[child_slot]; + node_idx = rules->trie_childs[child_idx].node_idx; } } /* string not found, add it */ off = add_new_string(rules, str, len + 1); - /* grow trie storage if needed */ - if (rules->trie_cur >= rules->trie_max) { - struct trie_node *trie; - unsigned short add; + /* grow trie nodes if needed */ + if (rules->trie_nodes_cur >= rules->trie_nodes_max) { + struct trie_node *nodes; + unsigned int add; /* double the buffer size */ - add = rules->trie_max; + add = rules->trie_nodes_max; if (add < 8) add = 8; - trie = realloc(rules->trie, (rules->trie_max + add) * sizeof(struct trie_node)); - if (trie == NULL) + nodes = realloc(rules->trie_nodes, (rules->trie_nodes_max + add) * sizeof(struct trie_node)); + if (nodes == NULL) return -1; - dbg(rules->udev, "extend string index nodes from %u to %u\n", rules->trie_max, rules->trie_max + add); - rules->trie = trie; - rules->trie_max += add; + dbg(rules->udev, "extend trie nodes from %u to %u\n", + rules->trie_nodes_max, rules->trie_nodes_max + add); + rules->trie_nodes = nodes; + rules->trie_nodes_max += add; } - /* insert new child node */ - child_off = rules->trie_cur; - if (depth == 0) { - rules->trie_root[key] = child_off; - } else { - struct trie_node *parent = &rules->trie[node_off]; - unsigned char child_slot = parent->child_cur; + /* grow trie childs if needed */ + if (rules->trie_childs_cur >= rules->trie_childs_max) { + struct trie_child *childs; + unsigned int add; - /* no space in parent, we can't index this string, nevermind */ - if (child_slot == TRIE_CHILD_MAX) - return off; + /* double the buffer size */ + add = rules->trie_childs_max; + if (add < 8) + add = 8; - parent->child[child_slot] = child_off; - parent->child_key[child_slot] = key; - parent->child_cur = child_slot + 1; + childs = realloc(rules->trie_childs, (rules->trie_childs_max + add) * sizeof(struct trie_child)); + if (childs == NULL) + return -1; + dbg(rules->udev, "extend trie childs from %u to %u\n", + rules->trie_childs_max, rules->trie_childs_max + add); + rules->trie_childs = childs; + rules->trie_childs_max += add; } - /* allocate and construct the child node */ - rules->trie_cur++; - child = &rules->trie[child_off]; - memset(child, 0x00, sizeof(struct trie_node)); - child->value_off = off; - child->value_len = len; + /* get new node */ + new_node_idx = rules->trie_nodes_cur; + rules->trie_nodes_cur++; + new_node = &rules->trie_nodes[new_node_idx]; + new_node->value_off = off; + new_node->value_len = len; + new_node->child_idx = 0; + new_node->last_child_idx = 0; + if (depth == 0) { + /* add node to root */ + rules->trie_root[key] = new_node_idx; + } else { + /* add node to parent */ + struct trie_node *parent; + struct trie_child *new_child; + unsigned int new_child_idx; + + /* get new child link for list of childs of parent */ + new_child_idx = rules->trie_childs_cur; + rules->trie_childs_cur++; + new_child = &rules->trie_childs[new_child_idx]; + new_child->next_idx = 0; + new_child->node_idx = new_node_idx; + new_child->key = key; + + /* append child link to list of childs of parent */ + parent = &rules->trie_nodes[node_idx]; + if (parent->child_idx == 0) { + parent->child_idx = new_child_idx; + } else { + struct trie_child *last_child; + + last_child = &rules->trie_childs[parent->last_child_idx]; + last_child->next_idx = new_child_idx; + } + parent->last_child_idx = new_child_idx; + } return off; } @@ -1728,23 +1751,31 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (rules->tokens == NULL) return NULL; rules->token_max = PREALLOC_TOKEN; + rules->buf = malloc(PREALLOC_STRBUF); if (rules->buf == NULL) return NULL; rules->buf_max = PREALLOC_STRBUF; - rules->trie = malloc(PREALLOC_TRIE * sizeof(struct trie_node)); - if (rules->trie == NULL) - return NULL; - rules->trie_max = PREALLOC_TRIE; - rules->trie_root = calloc(UCHAR_MAX + 1, sizeof(unsigned short)); /* offset 0 is always '\0' */ rules->buf[0] = '\0'; rules->buf_cur = 1; - /* offset 0 is reserved for the null trie node */ - rules->trie_cur = 1; dbg(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); + rules->trie_nodes = malloc(PREALLOC_TRIE * sizeof(struct trie_node)); + if (rules->trie_nodes == NULL) + return NULL; + rules->trie_nodes_max = PREALLOC_TRIE; + /* offset 0 is reserved for the null trie node */ + rules->trie_nodes_cur = 1; + + rules->trie_childs = malloc(PREALLOC_TRIE * sizeof(struct trie_child)); + if (rules->trie_childs == NULL) + return NULL; + rules->trie_childs_max = PREALLOC_TRIE; + + rules->trie_root = calloc(UCHAR_MAX + 1, sizeof(unsigned short)); + if (udev_get_rules_path(udev) != NULL) { /* custom rules location for testing */ add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); @@ -1857,14 +1888,20 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) } info(udev, "shrunk to %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); - info(udev, "used %zu bytes of string index nodes (%hu * %zu bytes)\n", - rules->trie_cur * sizeof(struct trie_node), rules->trie_cur, sizeof(struct trie_node)); + info(udev, "used %zu bytes for index (%u * %zu bytes nodes, %u * %zu bytes child links)\n", + rules->trie_nodes_cur * sizeof(struct trie_node) + rules->trie_childs_cur * sizeof(struct trie_child), + rules->trie_nodes_cur, sizeof(struct trie_node), + rules->trie_childs_cur, sizeof(struct trie_child)); /* cleanup trie */ - free(rules->trie); - rules->trie = NULL; - rules->trie_cur = 0; - rules->trie_max = 0; + free(rules->trie_nodes); + rules->trie_nodes = NULL; + rules->trie_nodes_cur = 0; + rules->trie_nodes_max = 0; + free(rules->trie_childs); + rules->trie_childs = NULL; + rules->trie_childs_cur = 0; + rules->trie_childs_max = 0; free(rules->trie_root); rules->trie_root = NULL; @@ -1888,7 +1925,8 @@ void udev_rules_unref(struct udev_rules *rules) return; free(rules->tokens); free(rules->buf); - free(rules->trie); + free(rules->trie_nodes); + free(rules->trie_childs); free(rules->trie_root); free(rules->uids); free(rules->gids); -- cgit v1.2.3-54-g00ecf From 0dd9f015d3a7be6502ba3ec5ebbe6bcc9b056755 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 12 Nov 2008 15:01:20 +0100 Subject: reserve child slot 0 --- udev/udev-rules.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index efd8310cd0..1f28e4f09a 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1773,6 +1773,8 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (rules->trie_childs == NULL) return NULL; rules->trie_childs_max = PREALLOC_TRIE; + /* offset 0 is reserved for the null child node */ + rules->trie_childs_cur = 1; rules->trie_root = calloc(UCHAR_MAX + 1, sizeof(unsigned short)); @@ -1886,9 +1888,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) rules->buf_max = rules->buf_cur; } } - info(udev, "shrunk to %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + info(udev, "rules use %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); - info(udev, "used %zu bytes for index (%u * %zu bytes nodes, %u * %zu bytes child links)\n", + info(udev, "temporary index used %zu bytes (%u * %zu bytes nodes, %u * %zu bytes child links)\n", rules->trie_nodes_cur * sizeof(struct trie_node) + rules->trie_childs_cur * sizeof(struct trie_child), rules->trie_nodes_cur, sizeof(struct trie_node), rules->trie_childs_cur, sizeof(struct trie_child)); -- cgit v1.2.3-54-g00ecf From 023ed7b0a360756e71394e08447e1c979799f5ac Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 00:52:12 +0100 Subject: merge trie nodes, childs and root into a single array --- udev/udev-rules.c | 158 +++++++++++++++++------------------------------------- 1 file changed, 49 insertions(+), 109 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 1f28e4f09a..796d2c157f 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008 Alan Jenkins * * 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 @@ -41,17 +42,16 @@ struct uid_gid { }; }; -struct trie_child { - unsigned int next_idx; - unsigned int node_idx; - unsigned char key; -}; - struct trie_node { + /* this node's first child */ unsigned int child_idx; + /* the next child of our parent node's child list */ + unsigned int next_child_idx; + /* this node's last child (shortcut for append) */ unsigned int last_child_idx; unsigned int value_off; unsigned short value_len; + unsigned char key; }; struct udev_rules { @@ -70,13 +70,9 @@ struct udev_rules { unsigned int buf_count; /* during rule parsing, strings are indexed to find duplicates */ - unsigned int *trie_root; struct trie_node *trie_nodes; unsigned int trie_nodes_cur; unsigned int trie_nodes_max; - struct trie_child *trie_childs; - unsigned int trie_childs_cur; - unsigned int trie_childs_max; /* during rule parsing, uid/gid lookup results are cached */ struct uid_gid *uids; @@ -453,6 +449,7 @@ static int add_string(struct udev_rules *rules, const char *str) unsigned short len; unsigned int depth; unsigned int off; + struct trie_node *parent; len = strlen(str); @@ -460,37 +457,34 @@ static int add_string(struct udev_rules *rules, const char *str) if (len == 0) return 0; - /* descend root - start from last character of str */ - key = str[len - 1]; - node_idx = rules->trie_root[key]; - depth = 0; - - /* descend suffix trie */ - if (node_idx > 0) { - while (1) { - struct trie_node *node; - unsigned int child_idx; - - node = &rules->trie_nodes[node_idx]; - depth++; - off = node->value_off + node->value_len - len; - - /* match against current node */ - if (depth == len || (node->value_len >= len && memcmp(&rules->buf[off], str, len) == 0)) - return off; - - /* lookup child node */ - key = str[len - 1 - depth]; - child_idx = node->child_idx; - while (child_idx > 0) { - if (rules->trie_childs[child_idx].key == key) - break; - child_idx = rules->trie_childs[child_idx].next_idx; - } - if (child_idx == 0) + /* walk trie, start from last character of str to find matching tails */ + node_idx = 0; + key = str[len-1]; + for (depth = 0; depth <= len; depth++) { + struct trie_node *node; + unsigned int child_idx; + + node = &rules->trie_nodes[node_idx]; + off = node->value_off + node->value_len - len; + + /* match against current node */ + if (depth == len || (node->value_len >= len && memcmp(&rules->buf[off], str, len) == 0)) + return off; + + /* lookup child node */ + key = str[len - 1 - depth]; + child_idx = node->child_idx; + while (child_idx > 0) { + struct trie_node *child; + + child = &rules->trie_nodes[child_idx]; + if (child->key == key) break; - node_idx = rules->trie_childs[child_idx].node_idx; + child_idx = child->next_child_idx; } + if (child_idx == 0) + break; + node_idx = child_idx; } /* string not found, add it */ @@ -515,63 +509,26 @@ static int add_string(struct udev_rules *rules, const char *str) rules->trie_nodes_max += add; } - /* grow trie childs if needed */ - if (rules->trie_childs_cur >= rules->trie_childs_max) { - struct trie_child *childs; - unsigned int add; - - /* double the buffer size */ - add = rules->trie_childs_max; - if (add < 8) - add = 8; - - childs = realloc(rules->trie_childs, (rules->trie_childs_max + add) * sizeof(struct trie_child)); - if (childs == NULL) - return -1; - dbg(rules->udev, "extend trie childs from %u to %u\n", - rules->trie_childs_max, rules->trie_childs_max + add); - rules->trie_childs = childs; - rules->trie_childs_max += add; - } - - /* get new node */ + /* get a new node */ new_node_idx = rules->trie_nodes_cur; rules->trie_nodes_cur++; new_node = &rules->trie_nodes[new_node_idx]; + memset(new_node, 0x00, sizeof(struct trie_node)); new_node->value_off = off; new_node->value_len = len; - new_node->child_idx = 0; - new_node->last_child_idx = 0; + new_node->key = key; - if (depth == 0) { - /* add node to root */ - rules->trie_root[key] = new_node_idx; + /* join the parent's child list */ + parent = &rules->trie_nodes[node_idx]; + if (parent->child_idx == 0) { + parent->child_idx = new_node_idx; } else { - /* add node to parent */ - struct trie_node *parent; - struct trie_child *new_child; - unsigned int new_child_idx; - - /* get new child link for list of childs of parent */ - new_child_idx = rules->trie_childs_cur; - rules->trie_childs_cur++; - new_child = &rules->trie_childs[new_child_idx]; - new_child->next_idx = 0; - new_child->node_idx = new_node_idx; - new_child->key = key; - - /* append child link to list of childs of parent */ - parent = &rules->trie_nodes[node_idx]; - if (parent->child_idx == 0) { - parent->child_idx = new_child_idx; - } else { - struct trie_child *last_child; + struct trie_node *last_child; - last_child = &rules->trie_childs[parent->last_child_idx]; - last_child->next_idx = new_child_idx; - } - parent->last_child_idx = new_child_idx; + last_child = &rules->trie_nodes[parent->last_child_idx]; + last_child->next_child_idx = new_node_idx; } + parent->last_child_idx = new_node_idx; return off; } @@ -1766,18 +1723,10 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (rules->trie_nodes == NULL) return NULL; rules->trie_nodes_max = PREALLOC_TRIE; - /* offset 0 is reserved for the null trie node */ + /* offset 0 is the trie root */ + memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); rules->trie_nodes_cur = 1; - rules->trie_childs = malloc(PREALLOC_TRIE * sizeof(struct trie_child)); - if (rules->trie_childs == NULL) - return NULL; - rules->trie_childs_max = PREALLOC_TRIE; - /* offset 0 is reserved for the null child node */ - rules->trie_childs_cur = 1; - - rules->trie_root = calloc(UCHAR_MAX + 1, sizeof(unsigned short)); - if (udev_get_rules_path(udev) != NULL) { /* custom rules location for testing */ add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); @@ -1890,22 +1839,15 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) } info(udev, "rules use %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); - info(udev, "temporary index used %zu bytes (%u * %zu bytes nodes, %u * %zu bytes child links)\n", - rules->trie_nodes_cur * sizeof(struct trie_node) + rules->trie_childs_cur * sizeof(struct trie_child), - rules->trie_nodes_cur, sizeof(struct trie_node), - rules->trie_childs_cur, sizeof(struct trie_child)); + info(udev, "temporary index used %zu bytes (%u * %zu bytes)\n", + rules->trie_nodes_cur * sizeof(struct trie_node), + rules->trie_nodes_cur, sizeof(struct trie_node)); /* cleanup trie */ free(rules->trie_nodes); rules->trie_nodes = NULL; rules->trie_nodes_cur = 0; rules->trie_nodes_max = 0; - free(rules->trie_childs); - rules->trie_childs = NULL; - rules->trie_childs_cur = 0; - rules->trie_childs_max = 0; - free(rules->trie_root); - rules->trie_root = NULL; /* cleanup uid/gid cache */ free(rules->uids); @@ -1928,8 +1870,6 @@ void udev_rules_unref(struct udev_rules *rules) free(rules->tokens); free(rules->buf); free(rules->trie_nodes); - free(rules->trie_childs); - free(rules->trie_root); free(rules->uids); free(rules->gids); free(rules); -- cgit v1.2.3-54-g00ecf From 0bf41e6c24ac3d8cea08dd965e29b0d66ef51f1a Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 12 Nov 2008 16:23:17 +0000 Subject: scsi_id: we don't use DEVPATH env var anymore, update man page Signed-off-by: Alan Jenkins --- extras/scsi_id/scsi_id.8 | 7 ------- 1 file changed, 7 deletions(-) diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 4656e6889e..5f4d997ce9 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -98,13 +98,6 @@ Generate verbose debugging output. Display version number and exit. .RE -.SH ENVIRONMENT - -If the DEVPATH environment variable is set, scsi_id assumes it has been -invoked via udev (or some other hotplug program), and all errors or -warnings are sent using syslog. -.P - .SH "FILES" .nf .ft B -- cgit v1.2.3-54-g00ecf From 95d61c274566700ea2d39a4a048e2fa6ea2cc58f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 01:52:33 +0100 Subject: set errno = ENOSYS in inotify stub --- udev/udev-sysdeps.h | 1 + udev/udevd.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/udev-sysdeps.h b/udev/udev-sysdeps.h index eaeab86f6b..08d7e48543 100644 --- a/udev/udev-sysdeps.h +++ b/udev/udev-sysdeps.h @@ -33,6 +33,7 @@ #ifndef HAVE_INOTIFY static inline int inotify_init(void) { + errno = ENOSYS; return -1; } diff --git a/udev/udevd.c b/udev/udevd.c index 15a197e561..08a87b033b 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -864,7 +864,7 @@ int main(int argc, char *argv[]) IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } } else if (errno == ENOSYS) - err(udev, "the kernel does not support inotify, udevd can't monitor rules file changes\n"); + info(udev, "unable to use inotify, udevd will not monitor rule files changes\n"); else err(udev, "inotify_init failed: %m\n"); -- cgit v1.2.3-54-g00ecf From 50025605e0f9942da513c9dcfde289495afefd17 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 07:31:04 +0100 Subject: udevadm: info - unify -V and --version --- TODO | 1 - udev/udevadm-info.c | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 3320d91347..4d6f6d4d19 100644 --- a/TODO +++ b/TODO @@ -7,5 +7,4 @@ the default rules o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names - o fix "udevadm info -V" format o get distros to agree on a default set of rules diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index d30fc0031c..745b4fdb7b 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -228,7 +228,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) { "device-id-of-file", required_argument, NULL, 'd' }, { "export", no_argument, NULL, 'x' }, { "export-prefix", required_argument, NULL, 'P' }, - { "version", no_argument, NULL, 1 }, /* -V outputs braindead format */ + { "version", no_argument, NULL, 'V' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -366,11 +366,8 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case 'P': export_prefix = optarg; break; - case 1: - printf("%s\n", VERSION); - goto exit; case 'V': - printf("udevinfo, version %s\n", VERSION); + printf("%s\n", VERSION); goto exit; case 'h': printf("Usage: udevadm info OPTIONS\n" -- cgit v1.2.3-54-g00ecf From 8e9c06be26a5c40454bb3925a10d9ccdaab37b2d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 07:45:58 +0100 Subject: rules: remove DEVTYPE disk/partition --- TODO | 2 -- rules/rules.d/60-persistent-storage.rules | 4 ---- 2 files changed, 6 deletions(-) diff --git a/TODO b/TODO index 4d6f6d4d19..8986d19722 100644 --- a/TODO +++ b/TODO @@ -3,8 +3,6 @@ o drop pnp shell script, acpi will take care of loading pnp modules o add DVB variables to kernel (patch merged in v4l tree), drop the shell script rule - o DEVTYPE for disks is set by the kernel, they will be removed from - the default rules o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names o get distros to agree on a default set of rules diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index dec83cfe7e..4f8de28a7f 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -19,10 +19,6 @@ KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" # ignore partitions that span the entire disk TEST=="whole_disk", GOTO="persistent_storage_end" -# /sys/class/block will export this -ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" -ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" - # for partitions import parent information ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" -- cgit v1.2.3-54-g00ecf From bd20bada37d55f1a747d7bc797e18f990cb9cdfe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 07:47:16 +0100 Subject: rules: remove pnp shell script, acpi loads these modules properly --- TODO | 1 - rules/rules.d/80-drivers.rules | 2 -- 2 files changed, 3 deletions(-) diff --git a/TODO b/TODO index 8986d19722..c06451dd60 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ o convert firmware.sh to C - o drop pnp shell script, acpi will take care of loading pnp modules o add DVB variables to kernel (patch merged in v4l tree), drop the shell script rule o "udevadm control" commands will only accept the -- syntax diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index 881d7581bf..ca0fa6bc42 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -3,8 +3,6 @@ ACTION!="add", GOTO="drivers_end" DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" -SUBSYSTEM=="pnp", DRIVER!="?*", ENV{MODALIAS}!="?*", \ - RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" -- cgit v1.2.3-54-g00ecf From fc0d4bd4a5f31ad5467918c0f899cffa25a153ca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 08:03:49 +0100 Subject: update NEWS --- NEWS | 16 ++++++++++++++++ configure.ac | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 275676d103..aec8bb330b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,19 @@ +udev 133 +======== + +The strings of the parsed rules, which are kept in memory, no longer +contain duplicate entries, or duplicate tails of strings. This reduces +the total size of a huge distro rule set to 0.08 MB, compared to the +1.2MB of udev version 130. + +The export of DEVTYPE=disk/partition got removed from the default +rules. This value is available from the kernel. +The pnp shell script modprobe hack is removed from the default rules. +ACPI devices have proper modalias support and take care of the same +functionality. +Installations which support old kernels, but install current default +udev rules may need to add that to the compat rules file. + udev 132 ======== diff --git a/configure.ac b/configure.ac index e0e01adba1..f5f03b074d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [132], + [133], [kay.sievers@vrfy.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) -- cgit v1.2.3-54-g00ecf From 1d36813d4c3353c1194d3a7cdb31ac6f64a66e8f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 08:16:55 +0100 Subject: configure: add linux-hotplug mail address --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f5f03b074d..803b0436f4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_INIT([udev], [133], - [kay.sievers@vrfy.org]) + [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) -- cgit v1.2.3-54-g00ecf From 3e39ff63658ed76398d0ee98f361221744fe591f Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 13 Nov 2008 17:32:14 +0100 Subject: volume_id: fat - move check for msdos signature (0x55 0xaa) Make the msdos signature (0x55 0xaa) at 510 and 511 optional when the standard FAT magic string is present. --- extras/volume_id/lib/fat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 95735c2d2d..e30318cf09 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -281,10 +281,6 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) if (buf == NULL) return -1; - /* check signature */ - if (buf[510] != 0x55 || buf[511] != 0xaa) - return -1; - vs = (struct vfat_super_block *) buf; if (memcmp(vs->sysid, "NTFS", 4) == 0) return -1; @@ -305,6 +301,10 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) goto magic; + /* check signature */ + if (buf[510] != 0x55 || buf[511] != 0xaa) + return -1; + /* some old floppies don't have a magic, expect the boot jump address to match */ if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && vs->boot_jump[0] != 0xe9) -- cgit v1.2.3-54-g00ecf From 949075dbbdbc2a10b38e5022a4f51d39e391deca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 18:21:28 +0100 Subject: remove len == 0 check, the index root is always '\0' --- udev/udev-rules.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 796d2c157f..df9fc7877d 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -451,15 +451,10 @@ static int add_string(struct udev_rules *rules, const char *str) unsigned int off; struct trie_node *parent; - len = strlen(str); - - /* offset 0 is always '\0' */ - if (len == 0) - return 0; - /* walk trie, start from last character of str to find matching tails */ - node_idx = 0; + len = strlen(str); key = str[len-1]; + node_idx = 0; for (depth = 0; depth <= len; depth++) { struct trie_node *node; unsigned int child_idx; @@ -1723,7 +1718,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (rules->trie_nodes == NULL) return NULL; rules->trie_nodes_max = PREALLOC_TRIE; - /* offset 0 is the trie root */ + /* offset 0 is the trie root, with an empty string */ memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); rules->trie_nodes_cur = 1; -- cgit v1.2.3-54-g00ecf From 90dca5ff9d927273c47cfbe365cc925add1a67e8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 18:22:39 +0100 Subject: volume_id: bump revision --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 803b0436f4..64b88dcfb3 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ AC_SUBST(LIBUDEV_LT_AGE) dnl /* libvolume_id version */ VOLID_LT_CURRENT=1 -VOLID_LT_REVISION=4 +VOLID_LT_REVISION=5 VOLID_LT_AGE=0 AC_SUBST(VOLID_LT_CURRENT) AC_SUBST(VOLID_LT_REVISION) -- cgit v1.2.3-54-g00ecf From 779d2d851ee5dbd4c759bb973113373897d3adce Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 19:34:41 +0100 Subject: volume_id: always check for all filesystem types and skip conflicting results We probe for all known filesystems to find conflicting signatures. If we find multiple matching signatures and one of the detected filesystem types claims that it can not co-exist with any other filesystem type, we do not return a probing result. We can not afford to mount a volume with the wrong filesystem code and possibly corrupt it. Linux ssytems have the problem of dozens of possible filesystem types, and volumes with left-over signatures from former filesystem types. Invalid signature need to be removed from the volume to make the filesystem detection successful. We do not want to read that many bytes from probed floppies, skip volumes smaller than a usual floppy disk. --- extras/volume_id/lib/fat.c | 3 +- extras/volume_id/lib/libvolume_id-private.h | 1 + extras/volume_id/lib/linux_swap.c | 2 ++ extras/volume_id/lib/volume_id.c | 52 ++++++++++++++++++++++++++--- 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index e30318cf09..2d98b65b50 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -497,6 +497,7 @@ fat32: found: volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "vfat"; - + /* we think this is fat, but we make sure no other signatures are found */ + id->force_unique_result = 1; return 0; } diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h index 14f7568fec..1b4a782b65 100644 --- a/extras/volume_id/lib/libvolume_id-private.h +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -120,6 +120,7 @@ struct volume_id { uint8_t *seekbuf; uint64_t seekbuf_off; size_t seekbuf_len; + int force_unique_result; }; /* utils */ diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index c4beeab978..1698e9dbf7 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -97,5 +97,7 @@ found_label: found: volume_id_set_usage(id, VOLUME_ID_OTHER); + /* we think this is swap, but we make sure no other signatures are found */ + id->force_unique_result = 1; return 0; } diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 8f22509ca6..e4d2ed4cfa 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -369,9 +369,12 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - for (i = 0; i < ARRAY_SIZE(prober_raid); i++) - if (prober_raid[i].prober(id, off, size) == 0) + for (i = 0; i < ARRAY_SIZE(prober_raid); i++) { + if (prober_raid[i].prober(id, off, size) == 0) { + info("signature '%s' detected\n", id->type); goto found; + } + } return -1; found: @@ -402,11 +405,50 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) - if (prober_filesystem[i].prober(id, off, size) == 0) + /* + * We probe for all known filesystems to find conflicting signatures. If + * we find multiple matching signatures and one of the detected filesystem + * types claims that it can not co-exist with any other filesystem type, + * we do not return a probing result. + * + * We can not afford to mount a volume with the wrong filesystem code and + * possibly corrupt it. Linux ssytems have the problem of dozens of possible + * filesystem types, and volumes with left-over signatures from former + * filesystem types. Invalid signature need to be removed from the volume + * to make the filesystem detection successful. + * + * We do not want to read that many bytes from probed floppies, skip volumes + * smaller than a usual floppy disk + */ + if (size > 1440 * 1024) { + int found = 0; + int force_unique_result = 0; + + for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) { + int match; + + match = (prober_filesystem[i].prober(id, off, size) == 0); + if (match) { + info("signature '%s' detected\n", id->type); + if (id->force_unique_result) + force_unique_result = id->force_unique_result; + if (found && force_unique_result) { + info("conflicting signatures found, skip results\n"); + return -1; + } + found = 1; + } + } + } + + /* return the first match */ + for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) { + if (prober_filesystem[i].prober(id, off, size) == 0) { + info("signature '%s' detected\n", id->type); goto found; + } + } return -1; - found: /* If recognized, we free the allocated buffers */ volume_id_free_buffer(id); -- cgit v1.2.3-54-g00ecf From 387a8271207b4e921258194cf359039babbc33b9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 19:40:24 +0100 Subject: volume_id: fat - accept empty FAT32 fsinfo signature --- extras/volume_id/lib/fat.c | 14 ++++++++++---- extras/volume_id/lib/volume_id.c | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c index 2d98b65b50..c0cfed82c0 100644 --- a/extras/volume_id/lib/fat.c +++ b/extras/volume_id/lib/fat.c @@ -411,7 +411,11 @@ magic: fat32: info("looking for FAT32\n"); - /* FAT32 should have a valid signature in the fsinfo block */ + /* + * FAT32 should have a valid signature in the fsinfo block, + * but also allow all bytes set to '\0', because some volumes + * do not set the signature at all. + */ fsinfo_sect = le16_to_cpu(vs->type.fat32.fsinfo_sector); buf = volume_id_get_buffer(id, off + (fsinfo_sect * sector_size), 0x200); if (buf == NULL) @@ -423,11 +427,13 @@ fat32: info("signature2: 0x%02x%02x%02x%02x\n", fsinfo->signature2[0], fsinfo->signature2[1], fsinfo->signature2[2], fsinfo->signature2[3]); - if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0) + if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0 && + memcmp(fsinfo->signature1, "\x00\x00\x00\x00", 4) != 0) return -1; - if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0) + if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0 && + memcmp(fsinfo->signature2, "\x00\x00\x00\x00", 4) != 0) return -1 ; - info("FAT32 signatures match\n"); + info("FAT32 signatures ok\n"); vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); if (vs == NULL) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index e4d2ed4cfa..aaaab7ed74 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -418,7 +418,7 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size * to make the filesystem detection successful. * * We do not want to read that many bytes from probed floppies, skip volumes - * smaller than a usual floppy disk + * smaller than a usual floppy disk. */ if (size > 1440 * 1024) { int found = 0; -- cgit v1.2.3-54-g00ecf From 8c7630b704f2a106a2cd6192c89e2d8a7cd0ff31 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 20:46:25 +0100 Subject: fix spelling in comment --- extras/volume_id/lib/volume_id.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index aaaab7ed74..aaa15e1e75 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -412,9 +412,9 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size * we do not return a probing result. * * We can not afford to mount a volume with the wrong filesystem code and - * possibly corrupt it. Linux ssytems have the problem of dozens of possible + * possibly corrupt it. Linux sytems have the problem of dozens of possible * filesystem types, and volumes with left-over signatures from former - * filesystem types. Invalid signature need to be removed from the volume + * filesystem types. Invalid signatures need to be removed from the volume * to make the filesystem detection successful. * * We do not want to read that many bytes from probed floppies, skip volumes @@ -431,7 +431,7 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (match) { info("signature '%s' detected\n", id->type); if (id->force_unique_result) - force_unique_result = id->force_unique_result; + force_unique_result = 1; if (found && force_unique_result) { info("conflicting signatures found, skip results\n"); return -1; -- cgit v1.2.3-54-g00ecf From 510af2e9397373a562aa66f9a8027980057bfa09 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 13 Nov 2008 21:44:28 +0100 Subject: volume_id: ntfs - mark as no other fs must match --- NEWS | 14 ++++++++++++++ extras/volume_id/lib/ntfs.c | 3 ++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index aec8bb330b..b102ba37a3 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,20 @@ functionality. Installations which support old kernels, but install current default udev rules may need to add that to the compat rules file. +Libvolume_id now always probes for all known filesystems, and does not +stop at the first match. Some filesystems are marked as "exclusive probe" +and if one of these filesytem types match, libvolume_id will not return +a probing result if any other filesystem type matches. This is intended +to help with conflicting left-over signatures from earlier file system +formats. That way, we no longer depend on the probing order for competing +signatures. +In some cases the kernel allows to mount a volume with the old filesystem +type, before it has been re-formatted with a different type. This can +damage the new filesystem and lead to data loss. Because volume_id can +not decide which is the correct signature, the wrong signatures need to +be removed manually from the volume, or the volume needs to be reformatted +to make filesystem auto-detection and possible auto-mounting working. + udev 132 ======== diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c index f861b4bf28..b322c77dbd 100644 --- a/extras/volume_id/lib/ntfs.c +++ b/extras/volume_id/lib/ntfs.c @@ -195,6 +195,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); id->type = "ntfs"; - + /* we think this is ntfs, but we make sure no other signatures are found */ + id->force_unique_result = 1; return 0; } -- cgit v1.2.3-54-g00ecf From 4dfe61c9668a0f6528de14ec413fce06be0b575c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Nov 2008 00:57:34 +0100 Subject: vol_id: clarify error message --- NEWS | 29 ++++++++++++++--------------- extras/volume_id/vol_id.c | 3 ++- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index b102ba37a3..69c6beff2d 100644 --- a/NEWS +++ b/NEWS @@ -3,8 +3,8 @@ udev 133 The strings of the parsed rules, which are kept in memory, no longer contain duplicate entries, or duplicate tails of strings. This reduces -the total size of a huge distro rule set to 0.08 MB, compared to the -1.2MB of udev version 130. +the total in-memory size of a huge distro rule set to 0.08 MB, compared +to the 1.2MB of udev version 130. The export of DEVTYPE=disk/partition got removed from the default rules. This value is available from the kernel. @@ -12,21 +12,20 @@ The pnp shell script modprobe hack is removed from the default rules. ACPI devices have proper modalias support and take care of the same functionality. Installations which support old kernels, but install current default -udev rules may need to add that to the compat rules file. +udev rules may want to add that to the compat rules file. Libvolume_id now always probes for all known filesystems, and does not -stop at the first match. Some filesystems are marked as "exclusive probe" -and if one of these filesytem types match, libvolume_id will not return -a probing result if any other filesystem type matches. This is intended -to help with conflicting left-over signatures from earlier file system -formats. That way, we no longer depend on the probing order for competing -signatures. -In some cases the kernel allows to mount a volume with the old filesystem -type, before it has been re-formatted with a different type. This can -damage the new filesystem and lead to data loss. Because volume_id can -not decide which is the correct signature, the wrong signatures need to -be removed manually from the volume, or the volume needs to be reformatted -to make filesystem auto-detection and possible auto-mounting working. +stop at the first match. Some filesystems are marked as "exclusive probe", +and if any other filesytem type matches at the same time, libvolume_id +will by default not return any probing result. This is intended to help +with conflicting left-over signatures from earlier file system formats. +That way, we no longer depend on the probe-order in case of competing +signatures. In some setups the kernel allows to mount a volume with just +the old filesystem signature still in place. This may damage the new +filesystem and cause data-loss, just by mounting it. Because volume_id +can not decide which one the correct signature is, the wrong signatures +need to be removed manually from the volume, or the volume needs to be +reformatted, to enable filesystem detection and possible auto-mounting. udev 132 ======== diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index df47501a6b..a50560c097 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -242,7 +242,8 @@ int main(int argc, char *argv[]) else retval = volume_id_probe_all(vid, offset, size); if (retval != 0) { - fprintf(stderr, "%s: unknown volume type\n", node); + fprintf(stderr, "unknown or non-unique volume type " + "(--probe-all lists possibly conflicting types)\n"); rc = 4; goto exit; } -- cgit v1.2.3-54-g00ecf From f454ecf7544077349c24e9fcfd418dbfca927063 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Nov 2008 18:26:49 +0100 Subject: libudev: device - handle disk "device" link for partitions in deprecated sysfs layout Thanks to Mikhail Kolesnik for finding this. --- udev/lib/libudev-device.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index eda3f5d97e..c4714e4088 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -501,9 +501,11 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic strncmp(udev_device->devpath, "/block/", 7) == 0) { util_strlcpy(path, udev_device->syspath, sizeof(path)); util_strlcat(path, "/device", sizeof(path)); - if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) + if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) { udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); - return udev_device_parent; + if (udev_device_parent != NULL) + return udev_device_parent; + } } util_strlcpy(path, udev_device->syspath, sizeof(path)); -- cgit v1.2.3-54-g00ecf From 56116314d114fb7e8a9c7ce6dc3ef4e929f9ecb0 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Sat, 15 Nov 2008 00:34:43 +0300 Subject: udevadm: fix option parsing breakage with klibc The klibc implementation of getopt_long() behaves slightly different from the glibc one - in particular, it treats the change of the option string argument between invocations as start of parsing a different command line, and resets its state. However, the udevadm code expected getopt_long() invocations in subcommands to continue parsing the rest of command line after initial options has been parsed at the top level; with klibc this broke, causing all udevadm subcommands to stop recognizing their options. Instead of relying on the glibc behavior, reset the getopt_long() state properly before invoking the subcommand handler: move argv to point to the subcommand name, decrease argc appropriately, and set optind = 0. This also fixes a minor bug visible with glibc - without setting optind = 0 all getopt_long() calls in subcommand handlers were behaving as if "+" was specified as the first character of the option string (which disables option reordering), because that state was set by the first getopt_long() call at the top level, and was not reset when parsing subcommand options. Signed-off-by: Sergey Vlasov --- udev/udevadm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev/udevadm.c b/udev/udevadm.c index 2de9fbcf22..0927981ab2 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -200,7 +200,9 @@ int main(int argc, char *argv[]) if (command != NULL) for (i = 0; cmds[i].cmd != NULL; i++) { if (strcmp(cmds[i].name, command) == 0) { - optind++; + argc -= optind; + argv += optind; + optind = 0; rc = run_command(udev, &cmds[i], argc, argv); goto out; } -- cgit v1.2.3-54-g00ecf From 096e59edc98646edb1072c646c631729bee04ad0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 17 Nov 2008 02:01:37 +0100 Subject: limit $attr() magic to well-known links only --- udev/lib/libudev-device.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index c4714e4088..055263bbef 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -859,11 +859,16 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const } if (S_ISLNK(statbuf.st_mode)) { - /* links return the last element of the target path */ char target[UTIL_NAME_SIZE]; int len; char *pos; + /* some core links return the last element of the target path */ + if (strcmp(sysattr, "driver") != 0 && + strcmp(sysattr, "subsystem") != 0 && + strcmp(sysattr, "module") != 0) + goto out; + len = readlink(path, target, sizeof(target)); if (len > 0) { target[len] = '\0'; -- cgit v1.2.3-54-g00ecf From c969f8806272b9fec50eb3325727cd012ce8dd1c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 17 Nov 2008 14:43:58 +0100 Subject: udevd: fix cleanup of /dev/.udev/uevent_seqnum --- udev/udevd.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 08a87b033b..bfd732319d 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -974,21 +974,18 @@ int main(int argc, char *argv[]) event_queue_manager(udev); } } + cleanup_queue_dir(udev); rc = 0; - exit: udev_rules_unref(rules); - if (signal_pipe[READ_END] >= 0) close(signal_pipe[READ_END]); if (signal_pipe[WRITE_END] >= 0) close(signal_pipe[WRITE_END]); - udev_ctrl_unref(udev_ctrl); if (inotify_fd >= 0) close(inotify_fd); udev_monitor_unref(kernel_monitor); - cleanup_queue_dir(udev); udev_selinux_exit(udev); udev_unref(udev); logging_close(); -- cgit v1.2.3-54-g00ecf From 5375c80eba10d8813a123429b655942fd7073209 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 17 Nov 2008 15:24:47 +0100 Subject: fix $links substitution for devices without any link Reported-by: Michel Hermier --- udev/udev-event.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 27bb5eb79a..32b45e9bac 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -231,8 +231,9 @@ found: break; case SUBST_DRIVER: if (event->dev_parent != NULL) { - const char *driver = udev_device_get_driver(event->dev_parent); + const char *driver; + driver = udev_device_get_driver(event->dev_parent); if (driver == NULL) break; util_strlcat(string, driver, maxsize); @@ -398,6 +399,8 @@ found: struct udev_list_entry *list_entry; list_entry = udev_device_get_devlinks_list_entry(dev); + if (list_entry == NULL) + break; util_strlcat(string, &udev_list_entry_get_name(list_entry)[devlen], maxsize); udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { util_strlcat(string, " ", maxsize); @@ -426,6 +429,8 @@ found: if (list_entry == NULL) break; value = udev_list_entry_get_value(list_entry); + if (value == NULL) + break; dbg(event->udev, "substitute env '%s=%s'\n", attr, value); util_strlcat(string, value, maxsize); break; -- cgit v1.2.3-54-g00ecf From d78c0b3a5b15fa1be9c70b99f91a026d0a43826a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 18 Nov 2008 02:49:08 +0100 Subject: update NEWS --- NEWS | 42 ++++++++++++++++++++++++++---------------- configure.ac | 2 +- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/NEWS b/NEWS index 69c6beff2d..ab5b8cac0e 100644 --- a/NEWS +++ b/NEWS @@ -1,31 +1,41 @@ udev 133 ======== +Bugfix for kernels using SYSFS_DEPRECATED* option and finding parent +block devices in some cases. No common distro uses this option anymore, +and we do not get enough testing for this and recent udev versions. If +this option is not needed to run some old distro with a new kernel, +it should be disabled in the kernel config. + +Bugfix for the $links substitution variable, which may crash if no links +are created. This should not happen in usual setups because we always +create /dev/{block,char}/ links. The strings of the parsed rules, which are kept in memory, no longer -contain duplicate entries, or duplicate tails of strings. This reduces -the total in-memory size of a huge distro rule set to 0.08 MB, compared -to the 1.2MB of udev version 130. +contain duplicate entries, or duplicate tails of strings. This, and the +new rules parsing/matching code reduces the total in-memory size of +a huge distro rule sets to 0.08 MB, compared to the 1.2MB of udev +version 130. The export of DEVTYPE=disk/partition got removed from the default -rules. This value is available from the kernel. -The pnp shell script modprobe hack is removed from the default rules. -ACPI devices have proper modalias support and take care of the same -functionality. +rules. This value is available from the kernel. The pnp shell script +modprobe hack is removed from the default rules. ACPI devices have _proper_ +modalias support and take care of the same functionality. Installations which support old kernels, but install current default udev rules may want to add that to the compat rules file. Libvolume_id now always probes for all known filesystems, and does not stop at the first match. Some filesystems are marked as "exclusive probe", and if any other filesytem type matches at the same time, libvolume_id -will by default not return any probing result. This is intended to help -with conflicting left-over signatures from earlier file system formats. -That way, we no longer depend on the probe-order in case of competing -signatures. In some setups the kernel allows to mount a volume with just -the old filesystem signature still in place. This may damage the new -filesystem and cause data-loss, just by mounting it. Because volume_id -can not decide which one the correct signature is, the wrong signatures -need to be removed manually from the volume, or the volume needs to be -reformatted, to enable filesystem detection and possible auto-mounting. +will, by default, not return any probing result. This is intended to prevent +mis-detection with conflicting left-over signatures found from earlier +file system formats. That way, we no longer depend on the probe-order +in case of multiple competing signatures. In some setups the kernel allows +to mount a volume with just the old filesystem signature still in place. +This may damage the new filesystem and cause data-loss, just by mounting +it. Because volume_id can not decide which one the correct signature is, +the wrong signatures need to be removed manually from the volume, or the +volume needs to be reformatted, to enable filesystem detection and possible +auto-mounting. udev 132 ======== diff --git a/configure.ac b/configure.ac index 64b88dcfb3..e74c86ebe2 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ AC_PROG_LIBTOOL dnl /* libudev version */ LIBUDEV_LT_CURRENT=0 -LIBUDEV_LT_REVISION=4 +LIBUDEV_LT_REVISION=5 LIBUDEV_LT_AGE=0 AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) -- cgit v1.2.3-54-g00ecf From 13f362dec578cb7480f290b0c0b67068313db149 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 18 Nov 2008 02:50:58 +0100 Subject: release 133 --- ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/ChangeLog b/ChangeLog index d91c9f489e..7cd4dabc59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +Summary of changes from v132 to v133 +============================================ + +Alan Jenkins (2): + udevd: de-duplicate strings in rules + scsi_id: we don't use DEVPATH env var anymore, update man page + +Karel Zak (1): + volume_id: fat - move check for msdos signature (0x55 0xaa) + +Kay Sievers (22): + silence "comparison between signed and unsigned" + string index - split nodes and childs to allow and unlimited number of childs + reserve child slot 0 + merge trie nodes, childs and root into a single array + set errno = ENOSYS in inotify stub + udevadm: info - unify -V and --version + rules: remove DEVTYPE disk/partition + rules: remove pnp shell script, acpi loads these modules properly + update NEWS + configure: add linux-hotplug mail address + remove len == 0 check, the index root is always '\0' + volume_id: bump revision + volume_id: always check for all filesystem types and skip conflicting results + volume_id: fat - accept empty FAT32 fsinfo signature + fix spelling in comment + volume_id: ntfs - mark as no other fs must match + vol_id: clarify error message + libudev: device - handle disk "device" link for partitions in deprecated sysfs layout + limit $attr() magic to well-known links only + udevd: fix cleanup of /dev/.udev/uevent_seqnum + fix $links substitution for devices without any link + update NEWS + +Sergey Vlasov (1): + udevadm: fix option parsing breakage with klibc + + Summary of changes from v131 to v132 ============================================ -- cgit v1.2.3-54-g00ecf From 88608b1704ae8d701251614eb40c2e2e9e1f6d0e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 18 Nov 2008 03:52:05 +0100 Subject: autogen.sh: fix -print-multi-os-directory usage --- autogen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index b4c853f977..ef3f579cbd 100755 --- a/autogen.sh +++ b/autogen.sh @@ -49,11 +49,11 @@ CFLAGS="-g -Wall \ if test -z "$1" -o "$1" = "install"; then args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux" - args="$args --with-libdir-name=$(basename $(gcc -print-multi-os-directory))" + args="$args --with-libdir-name=lib/$(gcc -print-multi-os-directory)" CFLAGS="$CFLAGS -O2" elif test "$1" = "devel" ; then args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux --enable-debug" - args="$args --with-libdir-name=$(basename $(gcc -print-multi-os-directory))" + args="$args --with-libdir-name=lib/$(gcc -print-multi-os-directory)" CFLAGS="$CFLAGS -O0" else args=$@ -- cgit v1.2.3-54-g00ecf From 361b8a7423e9e50486b0efdf6e68ab6ffafe7785 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 18 Nov 2008 19:14:37 +0100 Subject: volume_id: update btrfs magic --- extras/volume_id/lib/btrfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/btrfs.c b/extras/volume_id/lib/btrfs.c index a725c4d12f..315abddae6 100644 --- a/extras/volume_id/lib/btrfs.c +++ b/extras/volume_id/lib/btrfs.c @@ -81,7 +81,7 @@ int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size) if (buf == NULL) return -1; bfs = (struct btrfs_super_block *)buf; - if (memcmp(bfs->magic, "_BDRfS_M", 8) != 0) + if (memcmp(bfs->magic, "_BFRfS_M", 8) != 0) return -1; volume_id_set_uuid(id, bfs->fsid, 0, UUID_DCE); volume_id_set_label_raw(id, bfs->label, 256); -- cgit v1.2.3-54-g00ecf From 449934822e7386311fa738d6b34bde393d845ce6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 18 Nov 2008 19:16:42 +0100 Subject: bump version --- NEWS | 4 +++- configure.ac | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ab5b8cac0e..670b624756 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +udev 134 +======== + udev 133 ======== Bugfix for kernels using SYSFS_DEPRECATED* option and finding parent @@ -39,7 +42,6 @@ auto-mounting. udev 132 ======== - Fix segfault if compiled without optimization and dbg() does not get compiled out and uses variables which are not available. diff --git a/configure.ac b/configure.ac index e74c86ebe2..0ccd8d560a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [133], + [134], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) @@ -19,7 +19,7 @@ AC_SUBST(LIBUDEV_LT_AGE) dnl /* libvolume_id version */ VOLID_LT_CURRENT=1 -VOLID_LT_REVISION=5 +VOLID_LT_REVISION=6 VOLID_LT_AGE=0 AC_SUBST(VOLID_LT_CURRENT) AC_SUBST(VOLID_LT_REVISION) -- cgit v1.2.3-54-g00ecf From 15b3df5507e4cbc772dd415f2ddbc5924f41aa8e Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 19 Nov 2008 11:24:03 +0100 Subject: rules: add persistent rules for memory stick block devices commit 5a9aed145ac0ffb3e29b1c8e0f19b34e277f9117 Author: Harald Hoyer Date: Wed Nov 19 11:22:30 2008 +0100 added persistent rules for memory stick block devices --- rules/rules.d/60-persistent-storage.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 4f8de28a7f..b9298f7e98 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -44,6 +44,9 @@ KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_A KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" +KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + # by-path (parent device path) ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" -- cgit v1.2.3-54-g00ecf From 874c43e42af96a43ff4983feeb91c1e6334eff6a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 19 Nov 2008 21:47:07 +0100 Subject: rules: merge group "video" into default rules --- rules/rules.d/50-udev-default.rules | 11 ++++++++++- rules/suse/40-suse.rules | 14 -------------- 2 files changed, 10 insertions(+), 15 deletions(-) delete mode 100644 rules/suse/40-suse.rules diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 9b7f7207d1..64c73b92ec 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -31,21 +31,30 @@ KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0600" KERNEL=="js[0-9]*", NAME="input/%k", MODE="0644", SYMLINK+="%k" # video4linux +SUBSYSTEM=="video4linux", GROUP="video" +KERNEL=="vttuner*", GROUP="video" +KERNEL=="vtx*|vbi*", GROUP="video" +KERNEL=="winradio*", GROUP="video" KERNEL=="vbi0", SYMLINK+="vbi" KERNEL=="radio0", SYMLINK+="radio" KERNEL=="video0", SYMLINK+="video" # graphics -KERNEL=="agpgart", MODE="0600" +KERNEL=="agpgart", MODE="0600", GROUP="video" KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666" KERNEL=="fb0", SYMLINK+="fb" +KERNEL=="pmu", GROUP="video" +KERNEL=="nvidia*|nvidiactl*", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" # DVB video SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" +SUBSYSTEM=="dvb", GROUP="video" # Firewire KERNEL=="dv1394*", SYMLINK+="dv1394/%n" KERNEL=="video1394*", NAME="video1394/%n" +KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" # firmware class requests SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" diff --git a/rules/suse/40-suse.rules b/rules/suse/40-suse.rules deleted file mode 100644 index d07a72eced..0000000000 --- a/rules/suse/40-suse.rules +++ /dev/null @@ -1,14 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="pmu", GROUP="video" -KERNEL=="nvidia*|nvidiactl*", GROUP="video" -KERNEL=="nvidia*|nvidiactl*", GROUP="video" -KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" -KERNEL=="vttuner*", GROUP="video" -KERNEL=="vtx*|vbi*", GROUP="video" -KERNEL=="winradio*", GROUP="video" -SUBSYSTEM=="dvb", GROUP="video" -SUBSYSTEM=="graphics", GROUP="video" -SUBSYSTEM=="video4linux", GROUP="video" -KERNEL=="agpgart", GROUP="video" - -- cgit v1.2.3-54-g00ecf From 24239ded2d7a152d1c428880ae2cf82d904a350d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Nov 2008 02:26:13 +0100 Subject: rules: v4l - add by-id/ links for USB devices /dev/v4l |-- by-id | |-- usb-046d_09a4_C4B15020-video-index0 -> ../../video0 | `-- usb-05a9_a511-video-index0 -> ../../video1 `-- by-path |-- pci-0000:00:1d.0-usb-0:1:1.0-video-index0 -> ../../video1 `-- pci-0000:00:1d.7-usb-0:2:1.0-video-index0 -> ../../video0 --- extras/usb_id/usb_id.c | 4 +++- rules/rules.d/60-persistent-v4l.rules | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 6dd1d450fb..00d8a4c139 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -70,7 +70,9 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len) case 0x0a: /* CDC-Data */ case 0x0b: /* Chip/Smart Card */ case 0x0d: /* Content Security */ - case 0x0e: /* Video */ + case 0x0e: + type = "video"; + break; case 0xdc: /* Diagnostic Device */ case 0xe0: /* Wireless Controller */ case 0xf2: /* Application-specific */ diff --git a/rules/rules.d/60-persistent-v4l.rules b/rules/rules.d/60-persistent-v4l.rules index 0d673ab396..fb961b79e0 100644 --- a/rules/rules.d/60-persistent-v4l.rules +++ b/rules/rules.d/60-persistent-v4l.rules @@ -3,6 +3,9 @@ ACTION!="add|change", GOTO="persistent_v4l_end" SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export" +KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" + # check for valid "index" number TEST!="index", GOTO="persistent_v4l_end" ATTR{index}!="?*", GOTO="persistent_v4l_end" -- cgit v1.2.3-54-g00ecf From bbfaec2b2f43ddf7b8ef42a2a687f536ac445183 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Nov 2008 02:43:34 +0100 Subject: libudev: accept NULL whitelist in util_replace_chars() --- udev/lib/libudev-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index f4e78850f9..1cd18c8906 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -398,7 +398,7 @@ int udev_util_replace_chars(char *str, const char *white) } /* if space is allowed, replace whitespace with ordinary space */ - if (isspace(str[i]) && strchr(white, ' ') != NULL) { + if (isspace(str[i]) && white != NULL && strchr(white, ' ') != NULL) { str[i] = ' '; i++; replaced++; -- cgit v1.2.3-54-g00ecf From 5317ca29e531dc32a4cca738e4862bb47230bead Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Nov 2008 02:44:08 +0100 Subject: usb_id: replace chars in returned strings Slashes are not funny in device names: |-- input | |-- by-id | | `-- usb-Logitech_USB-PS | | |-- 2_Optical_Mouse-event-mouse -> ../../event2 | | `-- 2_Optical_Mouse-mouse -> ../../mouse1 --- extras/usb_id/usb_id.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 00d8a4c139..91e3ecce4d 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -239,6 +239,7 @@ static int usb_id(struct udev_device *dev) goto fallback; } udev_util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); + udev_util_replace_chars(vendor_str, NULL); scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); if (!scsi_model) { @@ -247,6 +248,7 @@ static int usb_id(struct udev_device *dev) goto fallback; } udev_util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); + udev_util_replace_chars(model_str, NULL); scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); if (!scsi_type) { @@ -263,6 +265,7 @@ static int usb_id(struct udev_device *dev) goto fallback; } udev_util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); + udev_util_replace_chars(revision_str, NULL); /* * some broken devices have the same identifiers @@ -287,6 +290,7 @@ fallback: return 1; } udev_util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); + udev_util_replace_chars(vendor_str, NULL); } if (model_str[0] == '\0') { @@ -303,22 +307,27 @@ fallback: return 1; } udev_util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); + udev_util_replace_chars(model_str, NULL); } if (revision_str[0] == '\0') { const char *usb_rev; usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); - if (usb_rev) + if (usb_rev) { udev_util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); + udev_util_replace_chars(revision_str, NULL); + } } if (serial_str[0] == '\0') { const char *usb_serial; usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); - if (usb_serial) + if (usb_serial) { udev_util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); + udev_util_replace_chars(serial_str, NULL); + } } return 0; } -- cgit v1.2.3-54-g00ecf From 97f37a7e784d11e3aabdc676b5af90d3bc1a1793 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Nov 2008 07:52:33 +0100 Subject: ata_id: make sure, we do not have slashes in values --- extras/ata_id/ata_id.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index d407b0fad9..dae464a4dc 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -115,8 +115,11 @@ int main(int argc, char *argv[]) } udev_util_replace_whitespace((char *) id.model, model, 40); + udev_util_replace_chars(model, NULL); udev_util_replace_whitespace((char *) id.serial_no, serial, 20); + udev_util_replace_chars(serial, NULL); udev_util_replace_whitespace((char *) id.fw_rev, revision, 8); + udev_util_replace_chars(revision, NULL); if (export) { if ((id.config >> 8) & 0x80) { -- cgit v1.2.3-54-g00ecf From 1340a9e9ec72bde2eac873167920739883ada650 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Nov 2008 07:57:17 +0100 Subject: scsi_id: make sure, we do not have slashes in values --- extras/scsi_id/scsi_id.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 69994dd9d3..943cbb21ca 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -502,9 +502,12 @@ static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, co return retval; udev_util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); + udev_util_replace_chars(vendor_str, NULL); udev_util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); + udev_util_replace_chars(model_str, NULL); set_type(dev_scsi->type, type_str, sizeof(type_str)); udev_util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); + udev_util_replace_chars(revision_str, NULL); return 0; } @@ -572,8 +575,10 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) printf("ID_MODEL=%s\n", model_str); printf("ID_REVISION=%s\n", revision_str); udev_util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + udev_util_replace_chars(serial_str, NULL); printf("ID_SERIAL=%s\n", serial_str); udev_util_replace_whitespace(serial_short, serial_str, sizeof(serial_str)); + udev_util_replace_chars(serial_str, NULL); printf("ID_SERIAL_SHORT=%s\n", serial_str); printf("ID_TYPE=%s\n", type_str); } else { -- cgit v1.2.3-54-g00ecf From 28673dd75c912fca8cfb7ddb3f7c5182fbf3b406 Mon Sep 17 00:00:00 2001 From: "Gabor Z. Papp" Date: Fri, 21 Nov 2008 04:19:11 +0100 Subject: include errno.h in sysdeps.h --- udev/udev-sysdeps.h | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/udev-sysdeps.h b/udev/udev-sysdeps.h index 08d7e48543..e20ea48a2f 100644 --- a/udev/udev-sysdeps.h +++ b/udev/udev-sysdeps.h @@ -21,6 +21,7 @@ #define _UDEV_SYSDEPS_H_ #include +#include /* needed for our signal handlers to work */ #undef asmlinkage -- cgit v1.2.3-54-g00ecf From 2b22881cae4194e453766036300098fa19ccc1e6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Nov 2008 04:22:04 +0100 Subject: volume_id: remove unused usage types --- extras/volume_id/lib/libvolume_id-private.h | 2 -- extras/volume_id/lib/util.c | 4 ---- 2 files changed, 6 deletions(-) diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h index 1b4a782b65..8a5c327aea 100644 --- a/extras/volume_id/lib/libvolume_id-private.h +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -94,11 +94,9 @@ enum endian { enum volume_id_usage { VOLUME_ID_UNUSED, - VOLUME_ID_UNPROBED, VOLUME_ID_OTHER, VOLUME_ID_FILESYSTEM, VOLUME_ID_RAID, - VOLUME_ID_DISKLABEL, VOLUME_ID_CRYPTO, }; diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 671f97ee27..9844e5e97c 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -200,12 +200,8 @@ static char *usage_to_string(enum volume_id_usage usage_id) return "other"; case VOLUME_ID_RAID: return "raid"; - case VOLUME_ID_DISKLABEL: - return "disklabel"; case VOLUME_ID_CRYPTO: return "crypto"; - case VOLUME_ID_UNPROBED: - return "unprobed"; case VOLUME_ID_UNUSED: return "unused"; } -- cgit v1.2.3-54-g00ecf From 405d2830431742ca156833edd1f868ede015c83b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Nov 2008 05:02:02 +0100 Subject: vol_id: if regular files are probed, use stat() for the size value --- extras/volume_id/vol_id.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index a50560c097..889bd3483d 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -214,9 +215,17 @@ int main(int argc, char *argv[]) } if (size == 0) { - if (ioctl(fd, BLKGETSIZE64, &size) != 0) - size = 0; - info(udev_ctx, "BLKGETSIZE64=%" PRIu64 " (%" PRIu64 "GB)\n", size, size >> 30); + if (ioctl(fd, BLKGETSIZE64, &size) == 0) { + info(udev_ctx, "BLKGETSIZE64=%" PRIu64 " (%" PRIu64 "GB)\n", size, size >> 30); + } else { + struct stat statbuf; + + if (fstat(fd, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) + size = statbuf.st_size; + else + size = 0; + info(udev_ctx, "stat=%" PRIu64 " (%" PRIu64 "GB)\n", size, size >> 30); + } } /* try to drop all privileges before reading disk content */ -- cgit v1.2.3-54-g00ecf From 7106902dce55b68a878cb209e55222a904ff10ff Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Nov 2008 07:26:09 +0100 Subject: volume_id: update btrfs --- extras/volume_id/lib/btrfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/volume_id/lib/btrfs.c b/extras/volume_id/lib/btrfs.c index 315abddae6..1df8db50f1 100644 --- a/extras/volume_id/lib/btrfs.c +++ b/extras/volume_id/lib/btrfs.c @@ -51,6 +51,7 @@ struct btrfs_super_block { uint32_t leafsize; uint32_t stripesize; uint32_t sys_chunk_array_size; + uint64_t chunk_root_generation; uint8_t root_level; uint8_t chunk_root_level; uint8_t log_root_level; @@ -62,10 +63,12 @@ struct btrfs_super_block { uint32_t io_width; uint32_t sector_size; uint64_t type; + uint64_t generation; uint32_t dev_group; uint8_t seek_speed; uint8_t bandwidth; uint8_t uuid[16]; + uint8_t fsid[16]; } PACKED dev_item; uint8_t label[256]; } PACKED; -- cgit v1.2.3-54-g00ecf From f1ab8f912e06e50e6e42c3e3ece259d7f3e81f6b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Nov 2008 07:26:44 +0100 Subject: volume_id: clear probing result before probing and do not probe a second time, if not needed On Thu, Nov 20, 2008 at 14:17, Karel Zak wrote: > I see the patch (volume_id_probe_filesystem()) and a few things come > to mind: > > - shouldn't be the relevant parts (label, uuid, version, ...) of > the "struct volume_id" zeroized when you found a signature and > before you call the next probing function? > > - it seems as overkill to use two for()s and probe two times for all > filesystems. What about to store the first result and re-use it? > > - .. or at least never use the second for() when the fist for() found > nothing ;-) --- extras/volume_id/lib/volume_id.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index aaa15e1e75..a93ade6427 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -383,6 +383,18 @@ found: return 0; } +static void volume_id_reset_result(struct volume_id *id) +{ + id->label_raw_len = 0; + id->label[0] = '\0'; + id->uuid_raw_len = 0; + id->uuid[0] = '\0'; + id->usage_id = VOLUME_ID_UNUSED; + id->usage = NULL; + id->type = NULL; + id->type_version[0] = '\0'; +} + /** * volume_id_probe_filesystem: * @id: Probing context. @@ -423,25 +435,41 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size if (size > 1440 * 1024) { int found = 0; int force_unique_result = 0; + int first_match = -1; + volume_id_reset_result(id); for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) { int match; match = (prober_filesystem[i].prober(id, off, size) == 0); if (match) { - info("signature '%s' detected\n", id->type); + info("signature '%s' %i detected\n", id->type, i); if (id->force_unique_result) force_unique_result = 1; if (found && force_unique_result) { info("conflicting signatures found, skip results\n"); return -1; } - found = 1; + found++; + if (first_match < 0) + first_match = i; } } + if (found < 1) + return -1; + if (found == 1) + goto found; + if (found > 1) { + volume_id_reset_result(id); + info("re-read first match metadata %i\n", first_match); + if (prober_filesystem[first_match].prober(id, off, size) == 0) + goto found; + return -1; + } } /* return the first match */ + volume_id_reset_result(id); for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) { if (prober_filesystem[i].prober(id, off, size) == 0) { info("signature '%s' detected\n", id->type); -- cgit v1.2.3-54-g00ecf From 4435308844467c0dab329531def8dbfa451d9781 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Fri, 21 Nov 2008 10:50:12 +0100 Subject: man: fix typos --- extras/floppy/create_floppy_devices.8 | 2 +- extras/scsi_id/scsi_id.8 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/floppy/create_floppy_devices.8 b/extras/floppy/create_floppy_devices.8 index 8f5f048f6a..332110ab31 100644 --- a/extras/floppy/create_floppy_devices.8 +++ b/extras/floppy/create_floppy_devices.8 @@ -28,7 +28,7 @@ Set group ownership. Set device node mode. .TP \fB\-t\fR -Sed floppy type number. +Set floppy type number. .SH SEE ALSO .BR udev (7) .SH AUTHORS diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 5f4d997ce9..e133b7e63f 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -17,7 +17,7 @@ with a non\-zero value. \fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP that require a unique SCSI identifier. -By default all devices are assume black listed, the \fB\-\-whitelisted\fP option must +By default all devices are assumed black listed, the \fB\-\-whitelisted\fP option must be specified on the command line or in the config file for any useful behaviour. -- cgit v1.2.3-54-g00ecf From c3f0b654fc18b5f98bc65074e2118177e0f37ae9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 21 Nov 2008 20:48:24 +0100 Subject: path_id: fix fibre channel handling --- extras/path_id/path_id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index 0fad30cfb2..f7b1435d3d 100755 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -254,7 +254,7 @@ handle_fc () { fc_tgt_lun="${fc_tgt_hcil##*:}" fc_tgt_path="${DEV%/*}" fc_tgt_num="${fc_tgt_path##*/}" - fc_tgt_dev="${fc_tgt_path}/fc_transport:${fc_tgt_num}" + fc_tgt_dev="${fc_tgt_path}/fc_transport/${fc_tgt_num}" if [ -e "$fc_tgt_dev/port_name" ]; then read wwpn < $fc_tgt_dev/port_name fi -- cgit v1.2.3-54-g00ecf From 6733f60178cc67d5064583d433335ce8fb25eae1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 22 Nov 2008 00:34:42 +0100 Subject: update NEWS TODO --- NEWS | 3 +++ TODO | 4 ++++ configure.ac | 2 +- extras/volume_id/lib/volume_id.c | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 670b624756..940bfa6148 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ udev 134 ======== +Bugfixes. + +The group "video" is part of the default rules now. udev 133 ======== diff --git a/TODO b/TODO index c06451dd60..3fd49ac5da 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,8 @@ + o switch device mapper rules to: + dmsetup info -c --nameprefixes --unquoted --rows --noheadings \ + -o name,uuid,suspended,readonly,major,minor,open,tables_loaded + o implement path_id with libudev o convert firmware.sh to C o add DVB variables to kernel (patch merged in v4l tree), drop the shell script rule diff --git a/configure.ac b/configure.ac index 0ccd8d560a..cbd760edbf 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ AC_PROG_LIBTOOL dnl /* libudev version */ LIBUDEV_LT_CURRENT=0 -LIBUDEV_LT_REVISION=5 +LIBUDEV_LT_REVISION=6 LIBUDEV_LT_AGE=0 AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index a93ade6427..8bbbc38c32 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -446,7 +446,7 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size info("signature '%s' %i detected\n", id->type, i); if (id->force_unique_result) force_unique_result = 1; - if (found && force_unique_result) { + if (found > 0 && force_unique_result) { info("conflicting signatures found, skip results\n"); return -1; } -- cgit v1.2.3-54-g00ecf From 013332b93c880692e51d1056528c805fd7e4a882 Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Sun, 23 Nov 2008 17:22:32 +0100 Subject: floppy: fix array bounds check and minor calculation Fix off-by-4 bug in floppy minors for fd[4-7]. Avoid segmentation fault for bad CMOS type. Print mode in human readable, i.e., octal form. --- extras/floppy/create_floppy_devices.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index f5069f7220..14df052cf7 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -130,14 +130,14 @@ int main(int argc, char **argv) return 1; } if (fdnum > 3) - fdnum += 128; + fdnum += 124; if (major < 1) { fprintf(stderr,"Invalid major number %d\n", major); return 1; } - if (type < 0 || type > (int) sizeof(table)) { + if (type < 0 || type >= (int) (sizeof(table_sup) / sizeof(table_sup[0]))) { fprintf(stderr,"Invalid CMOS type %d\n", type); return 1; } @@ -150,7 +150,7 @@ int main(int argc, char **argv) sprintf(node, "%s%s", dev, table[table_sup[type][i]]); minor = (table_sup[type][i] << 2) + fdnum; if (print_nodes) - printf("%s b %d %d %d\n", node, mode, major, minor); + printf("%s b %.4o %d %d\n", node, mode, major, minor); if (create_nodes) { unlink(node); udev_selinux_setfscreatecon(udev, node, S_IFBLK | mode); -- cgit v1.2.3-54-g00ecf From 45a9e9e27b9a497985ec68d6a21e2e4eea05922b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 23 Nov 2008 17:29:37 +0100 Subject: floppy: use ARRAY_SIZE() --- extras/floppy/create_floppy_devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 14df052cf7..0698fcd3e8 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -137,7 +137,7 @@ int main(int argc, char **argv) return 1; } - if (type < 0 || type >= (int) (sizeof(table_sup) / sizeof(table_sup[0]))) { + if (type < 0 || type >= (int) ARRAY_SIZE(table_sup)) { fprintf(stderr,"Invalid CMOS type %d\n", type); return 1; } -- cgit v1.2.3-54-g00ecf From f408fd919a7af5fcd5dac5a505411842b3e8d853 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 24 Nov 2008 02:21:12 +0100 Subject: fix handling of swapping node name with symlink name --- udev/udev-node.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 1a189c5aae..100ca92903 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -371,18 +371,23 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev struct udev_list_entry *list_entry_current; int found; + /* check if old link name is now our node name */ + if (strcmp(name, udev_device_get_devnode(dev)) == 0) + continue; + + /* check if old link name still belongs to this device */ found = 0; udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { const char *name_current = udev_list_entry_get_name(list_entry_current); - if (strcmp(name_current, name) == 0) { + if (strcmp(name, name_current) == 0) { found = 1; break; } } if (found) continue; - /* link does no longer belong to this device */ + info(udev, "update old symlink '%s' no longer belonging to '%s'\n", name, udev_device_get_devpath(dev)); name_index(udev, udev_device_get_devpath(dev), name, 0, test); update_link(dev, name, test); -- cgit v1.2.3-54-g00ecf From ae2d346642aee4fab33c88708627bcf5b0cb317d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 24 Nov 2008 21:24:04 +0100 Subject: silence PHYSDEV* warning for WAIT_FOR* rules --- udev/udev-rules.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index df9fc7877d..afd2e884e9 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1135,6 +1135,7 @@ static int add_rule(struct udev_rules *rules, char *line, char *linepos; char *attr; int physdev = 0; + int waitfor = 0; struct rule_tmp rule_tmp; memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); @@ -1395,6 +1396,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL); valid = 1; + waitfor = 1; continue; } @@ -1544,11 +1546,11 @@ static int add_rule(struct udev_rules *rules, char *line, err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); } - if (physdev) - err(rules->udev, "PHYSDEV* values are deprecated and not available on recent kernels, \n" - "please fix it in %s:%u", filename, lineno); + if (physdev && !waitfor) + err(rules->udev, "PHYSDEV* values are deprecated and not available on recent kernels, " + "please fix it in %s:%u\n", filename, lineno); - /* skip line if not any valid key was found */ + /* skip line if no valid key was found */ if (!valid) goto invalid; -- cgit v1.2.3-54-g00ecf From 1d698ef647a8905ca549ebd599b000d4c4ecde78 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 25 Nov 2008 17:13:07 +0100 Subject: rules: Gentoo update --- rules/gentoo/30-kernel-compat.rules | 32 ++++++++++++++++++++++++++++++-- rules/gentoo/40-video.rules | 24 ------------------------ 2 files changed, 30 insertions(+), 26 deletions(-) delete mode 100644 rules/gentoo/40-video.rules diff --git a/rules/gentoo/30-kernel-compat.rules b/rules/gentoo/30-kernel-compat.rules index 1f767df8d8..d07e7fa1c3 100644 --- a/rules/gentoo/30-kernel-compat.rules +++ b/rules/gentoo/30-kernel-compat.rules @@ -1,9 +1,17 @@ # do not edit this file, it will be overwritten on update -ACTION!="add", GOTO="kernel_compat_end" +ACTION!="add|change", GOTO="kernel_compat_end" + +# +# rules to workaround bad sysfs timing +# + +ACTION!="add", GOTO="kernel_compat_wait_end" # workarounds needed to synchronize with sysfs +# needed for kernels < v2.6.18-rc1 DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" +SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt" # needed for kernels <2.6.16 SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" @@ -11,13 +19,29 @@ SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" # needed for kernels <2.6.17 SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" +LABEL="kernel_compat_wait_end" +# +# naming device rules +# +# old style usb sysfs devices # needed for kernels <2.6.22 SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" +# /sys/class/block will export this +# needed for kernels <2.6.25-rc1 +SUBSYSTEM!="block", GOTO="block_devtype_end" +ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" +ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" +LABEL="block_devtype_end" +# +# module loading rules +# +ACTION!="add", GOTO="kernel_compat_end" + # this driver is broken and should not be loaded automatically # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=398962 # needed for kernels <2.6.21 @@ -26,6 +50,11 @@ SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", ENV{MODALIAS}="" # No need for more code, as MODALIAS is present ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" +# needed for kernel <2.6.27-rc5 +# acpi will do on newer kernels +SUBSYSTEM=="pnp", DRIVER!="?*", \ + RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" + # needed for kernels <2.6.22 SUBSYSTEM!="scsi_device", GOTO="kernel_compat_end" @@ -44,4 +73,3 @@ SUBSYSTEM!="scsi_device", GOTO="kernel_compat_end" LABEL="kernel_compat_end" - diff --git a/rules/gentoo/40-video.rules b/rules/gentoo/40-video.rules deleted file mode 100644 index 2d5e53411c..0000000000 --- a/rules/gentoo/40-video.rules +++ /dev/null @@ -1,24 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# video4linux -KERNEL=="video[0-9]*", NAME="v4l/video%n", SYMLINK+="%k", GROUP="video" -KERNEL=="radio[0-9]*", NAME="v4l/radio%n", SYMLINK+="%k", GROUP="video" -KERNEL=="vbi[0-9]*", NAME="v4l/vbi%n", SYMLINK+="%k", GROUP="video" -KERNEL=="vtx[0-9]*", NAME="v4l/vtx%n", GROUP="video" - -SUBSYSTEM=="dvb", GROUP="video" - -# device node will be /dev/dri/card? -KERNEL=="card*", GROUP="video" -KERNEL=="nvidia*", GROUP="video" -KERNEL=="3dfx*", GROUP="video" - -# svgalib -KERNEL=="svga*", GROUP="video" - -# Framebuffer -KERNEL=="fb[0-9]*", GROUP="video" - -# IEEE1394 (firewire) devices -KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" - -- cgit v1.2.3-54-g00ecf From b257afd0a204666dffe8ee72ce3a2a5baf99f1d7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Nov 2008 17:25:14 +0100 Subject: rules: exclude "btibm" devices from vol_id calls --- rules/rules.d/60-persistent-storage.rules | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index b9298f7e98..f9c85b004a 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -10,7 +10,7 @@ ACTION!="add|change", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end" +KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*|btibm*", GOTO="persistent_storage_end" # never access non-cdrom removable ide devices, the drivers are causing event loops on open() KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end" @@ -43,7 +43,6 @@ KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_A KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" - KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From 74463b75fae2c5fcae27a968e14354097e456522 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 26 Nov 2008 04:36:25 +0100 Subject: release 134 --- ChangeLog | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7cd4dabc59..5d1431d344 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +Summary of changes from v133 to v134 +============================================ + +Gabor Z. Papp (1): + include errno.h in sysdeps.h + +Harald Hoyer (1): + rules: add persistent rules for memory stick block devices + +Kay Sievers (19): + autogen.sh: fix -print-multi-os-directory usage + volume_id: update btrfs magic + bump version + rules: merge group "video" into default rules + rules: v4l - add by-id/ links for USB devices + libudev: accept NULL whitelist in util_replace_chars() + usb_id: replace chars in returned strings + ata_id: make sure, we do not have slashes in values + scsi_id: make sure, we do not have slashes in values + volume_id: remove unused usage types + vol_id: if regular files are probed, use stat() for the size value + volume_id: update btrfs + volume_id: clear probing result before probing and do not probe a second time, if not needed + path_id: fix fibre channel handling + update NEWS TODO + floppy: use ARRAY_SIZE() + fix handling of swapping node name with symlink name + silence PHYSDEV* warning for WAIT_FOR* rules + rules: exclude "btibm" devices from vol_id calls + +Matthias Schwarzott (1): + rules: Gentoo update + +Peter Breitenlohner (2): + man: fix typos + floppy: fix array bounds check and minor calculation + + Summary of changes from v132 to v133 ============================================ -- cgit v1.2.3-54-g00ecf From 62a7b2d5a5dc731984e342ce249e25ffd1b738a6 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 26 Nov 2008 13:31:37 +0100 Subject: usb_id: fix switch statement for video type Introducing the video type, creating a fall-through case where other devices might now be declared as type video. --- extras/usb_id/usb_id.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 91e3ecce4d..ce1eb0b9fb 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -70,6 +70,7 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len) case 0x0a: /* CDC-Data */ case 0x0b: /* Chip/Smart Card */ case 0x0d: /* Content Security */ + break; case 0x0e: type = "video"; break; -- cgit v1.2.3-54-g00ecf From aba31da054ccdcf306cdb21473457da05ced3d28 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 26 Nov 2008 13:38:49 +0100 Subject: usb_id: add "break" to currently unused case labels --- extras/usb_id/usb_id.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index ce1eb0b9fb..492484da39 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -64,19 +64,28 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len) type = "storage"; break; case 2: /* CDC-Control */ + break; case 5: /* Physical */ + break; case 6: /* Image */ + break; case 9: /* HUB */ + break; case 0x0a: /* CDC-Data */ + break; case 0x0b: /* Chip/Smart Card */ + break; case 0x0d: /* Content Security */ break; case 0x0e: type = "video"; break; case 0xdc: /* Diagnostic Device */ + break; case 0xe0: /* Wireless Controller */ + break; case 0xf2: /* Application-specific */ + break; case 0xff: /* Vendor-specific */ break; default: -- cgit v1.2.3-54-g00ecf From 453ca4f907740d50c1e0e7bba8f2d7b68448ebd7 Mon Sep 17 00:00:00 2001 From: Piter PUNK Date: Fri, 28 Nov 2008 01:18:15 +0100 Subject: rules: /dev/null -> X0R /dev/X0R null symbolic Required by iBCS-2 Note: /dev/X0R is -- --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 64c73b92ec..f98b628750 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -20,7 +20,7 @@ KERNEL=="lirc0", SYMLINK+="lirc" # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" -KERNEL=="null", SYMLINK+="XOR" +KERNEL=="null", SYMLINK+="X0R" KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" KERNEL=="ram0", SYMLINK+="ramdisk" KERNEL=="ram1", SYMLINK+="ram" -- cgit v1.2.3-54-g00ecf From a4a2edb0ead43ae5bae63ca8c2a7ad162016372f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 Nov 2008 01:18:48 +0100 Subject: rules: fix cciss disk/by-id/ links --- rules/rules.d/60-persistent-storage.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index f9c85b004a..d433a0ff26 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -29,9 +29,9 @@ KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" -KERNEL=="cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" -KERNEL=="sd*[!0-9]|sr*|cciss?c[0-9]d[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*[0-9]|cciss*p[0-9]*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" +KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" # firewire KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" -- cgit v1.2.3-54-g00ecf From d5bdc83f3da5432998a1e27c98edf0c56259d890 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 Nov 2008 01:46:38 +0100 Subject: rules: add infiniband rules --- rules/packages/infiniband.rules | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 rules/packages/infiniband.rules diff --git a/rules/packages/infiniband.rules b/rules/packages/infiniband.rules new file mode 100644 index 0000000000..6601faae09 --- /dev/null +++ b/rules/packages/infiniband.rules @@ -0,0 +1,7 @@ +KERNEL=="umad[0-9]*", NAME="infiniband/%k" +KERNEL=="issm[0-9]*", NAME="infiniband/%k" +KERNEL=="ucm[0-9]*", NAME="infiniband/%k", MODE="0666" +KERNEL=="uverbs[0-9]*", NAME="infiniband/%k", MODE="0666" +KERNEL=="uat", NAME="infiniband/%k", MODE="0666" +KERNEL=="ucma", NAME="infiniband/%k", MODE="0666" +KERNEL=="rdma_cm", NAME="infiniband/%k", MODE="0666" -- cgit v1.2.3-54-g00ecf From 310119085123384a1620f23f6bcd3b26645a70be Mon Sep 17 00:00:00 2001 From: Piter PUNK Date: Fri, 28 Nov 2008 02:01:51 +0100 Subject: rules: add usb device nodes --- rules/rules.d/50-udev-default.rules | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index f98b628750..ad725fc34f 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -111,6 +111,11 @@ KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" KERNEL=="iowarrior[0-9]*", NAME="usb/%k" +KERNEL=="hiddev[0-9]*", NAME="usb/%k" +KERNEL=="legousbtower[0-9]*", NAME="usb/%k" +KERNEL=="dabusb[0-9]*", NAME="usb/%k" +KERNEL=="usbdpfp[0-9]*", NAME="usb/%k" +KERNEL=="cpad[0-9]*", NAME="usb/%k" # do not delete static device nodes ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove" -- cgit v1.2.3-54-g00ecf From 4894330e26f2e873a5c311c2783d17c16f167bd2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 Nov 2008 03:34:03 +0100 Subject: rules: infiniband.rules -> 40-infiniband.rules --- rules/packages/40-infiniband.rules | 7 +++++++ rules/packages/infiniband.rules | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 rules/packages/40-infiniband.rules delete mode 100644 rules/packages/infiniband.rules diff --git a/rules/packages/40-infiniband.rules b/rules/packages/40-infiniband.rules new file mode 100644 index 0000000000..6601faae09 --- /dev/null +++ b/rules/packages/40-infiniband.rules @@ -0,0 +1,7 @@ +KERNEL=="umad[0-9]*", NAME="infiniband/%k" +KERNEL=="issm[0-9]*", NAME="infiniband/%k" +KERNEL=="ucm[0-9]*", NAME="infiniband/%k", MODE="0666" +KERNEL=="uverbs[0-9]*", NAME="infiniband/%k", MODE="0666" +KERNEL=="uat", NAME="infiniband/%k", MODE="0666" +KERNEL=="ucma", NAME="infiniband/%k", MODE="0666" +KERNEL=="rdma_cm", NAME="infiniband/%k", MODE="0666" diff --git a/rules/packages/infiniband.rules b/rules/packages/infiniband.rules deleted file mode 100644 index 6601faae09..0000000000 --- a/rules/packages/infiniband.rules +++ /dev/null @@ -1,7 +0,0 @@ -KERNEL=="umad[0-9]*", NAME="infiniband/%k" -KERNEL=="issm[0-9]*", NAME="infiniband/%k" -KERNEL=="ucm[0-9]*", NAME="infiniband/%k", MODE="0666" -KERNEL=="uverbs[0-9]*", NAME="infiniband/%k", MODE="0666" -KERNEL=="uat", NAME="infiniband/%k", MODE="0666" -KERNEL=="ucma", NAME="infiniband/%k", MODE="0666" -KERNEL=="rdma_cm", NAME="infiniband/%k", MODE="0666" -- cgit v1.2.3-54-g00ecf From e2c9d3c36f9a2519e909c792bb273a34a5310685 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Dec 2008 01:04:23 +0100 Subject: fix network interface name swapping --- udev/udev-event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 32b45e9bac..bc692392d2 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -514,7 +514,7 @@ static int rename_netif(struct udev_event *event) /* wait 30 seconds for our target to become available */ util_strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); - util_strlcpy(ifr.ifr_newname, udev_device_get_devnode(dev), IFNAMSIZ); + util_strlcpy(ifr.ifr_newname, event->name, IFNAMSIZ); loop = 30 * 20; while (loop--) { err = ioctl(sk, SIOCSIFNAME, &ifr); @@ -529,7 +529,7 @@ static int rename_netif(struct udev_event *event) break; } dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", - udev_device_get_devnode(dev), (30 * 20) - loop); + event->name, (30 * 20) - loop); usleep(1000 * 1000 / 20); } } -- cgit v1.2.3-54-g00ecf From ae0f55cb86736eaa22fe0242353afbd7049628e4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Dec 2008 01:10:24 +0100 Subject: update configure and NEWS --- NEWS | 7 +++++++ configure.ac | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 940bfa6148..7970db2796 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +udev 135 +======== +Bugfixes. + +Fix for a possible segfault while swapping network interface names in udev +versions 131-134. + udev 134 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index cbd760edbf..d795aa114d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [134], + [135], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) -- cgit v1.2.3-54-g00ecf From ae52aa269ea554b8a070bbc55d1e5ff3431fb858 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Dec 2008 02:35:48 +0100 Subject: release 135 --- ChangeLog | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ChangeLog b/ChangeLog index 5d1431d344..b24cf2b4a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Summary of changes from v134 to v135 +============================================ + +Kay Sievers (6): + usb_id: add "break" to currently unused case labels + rules: fix cciss disk/by-id/ links + rules: add infiniband rules + rules: infiniband.rules -> 40-infiniband.rules + fix network interface name swapping + update configure and NEWS + +Marcel Holtmann (1): + usb_id: fix switch statement for video type + +Piter PUNK (2): + rules: /dev/null -> X0R + rules: add usb device nodes + + Summary of changes from v133 to v134 ============================================ -- cgit v1.2.3-54-g00ecf From 18c969a12b6b43f1cacd8d00310820392dad51ef Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Dec 2008 17:33:11 +0100 Subject: rules: ATA_COMPAT do not try to match on sr*, it will never have vendor ATA --- rules/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index d433a0ff26..abb9fce30b 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -38,7 +38,7 @@ KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394 KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" # libata compat (ata-* links, like old hd* devices did create) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" +KERNEL=="sd*[!0-9]", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -- cgit v1.2.3-54-g00ecf From caf4c97a2c443eeb8eebe7d42806eaca500db223 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Dec 2008 19:23:38 +0100 Subject: scsi_id: do not fail if no serial is found like for optical drives --- extras/scsi_id/scsi_id.c | 61 ++++++++++++++++++++++---------------------- extras/scsi_id/scsi_id.h | 3 ++- extras/scsi_id/scsi_serial.c | 14 +++++----- 3 files changed, 40 insertions(+), 38 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 943cbb21ca..21b7cbeaec 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -538,58 +538,59 @@ static void format_serial(char *serial) /* * scsi_id: try to get an id, if one is found, printf it to stdout. - * returns a value passed to exit() - 0 if printed an id, else 1. This - * could be expanded, for example, if we want to report a failure like no - * memory etc. return 2, and return 1 for expected cases (like broken - * device found) that do not print an id. + * returns a value passed to exit() - 0 if printed an id, else 1. */ static int scsi_id(struct udev *udev, char *maj_min_dev) { - int retval; struct scsi_id_device dev_scsi; int good_dev; int page_code; - char serial_short[MAX_SERIAL_LEN]; + int retval = 0; - serial_short[0] = '\0'; - set_inq_values(udev, &dev_scsi, maj_min_dev); + memset(&dev_scsi, 0x00, sizeof(struct scsi_id_device)); + + if (set_inq_values(udev, &dev_scsi, maj_min_dev) < 0) { + retval = 1; + goto out; + } /* get per device (vendor + model) options from the config file */ - retval = per_dev_options(udev, &dev_scsi, &good_dev, &page_code); + per_dev_options(udev, &dev_scsi, &good_dev, &page_code); dbg(udev, "per dev options: good %d; page code 0x%x\n", good_dev, page_code); - if (!good_dev) { retval = 1; - } else if (scsi_get_serial(udev, - &dev_scsi, maj_min_dev, page_code, - serial_short, MAX_SERIAL_LEN)) { - retval = 1; - } else { - retval = 0; + goto out; } - if (!retval) { - if (export) { - char serial_str[MAX_SERIAL_LEN]; - printf("ID_VENDOR=%s\n", vendor_str); - printf("ID_MODEL=%s\n", model_str); - printf("ID_REVISION=%s\n", revision_str); + /* read serial number from mode pages (no values for optical drives) */ + scsi_get_serial(udev, &dev_scsi, maj_min_dev, page_code, MAX_SERIAL_LEN); + + if (export) { + char serial_str[MAX_SERIAL_LEN]; + + printf("ID_VENDOR=%s\n", vendor_str); + printf("ID_MODEL=%s\n", model_str); + printf("ID_REVISION=%s\n", revision_str); + printf("ID_TYPE=%s\n", type_str); + if (dev_scsi.serial[0] != '\0') { udev_util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); udev_util_replace_chars(serial_str, NULL); printf("ID_SERIAL=%s\n", serial_str); - udev_util_replace_whitespace(serial_short, serial_str, sizeof(serial_str)); + udev_util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); udev_util_replace_chars(serial_str, NULL); printf("ID_SERIAL_SHORT=%s\n", serial_str); - printf("ID_TYPE=%s\n", type_str); - } else { - if (reformat_serial) - format_serial(dev_scsi.serial); - printf("%s\n", dev_scsi.serial); } - dbg(udev, "%s\n", dev_scsi.serial); - retval = 0; + goto out; } + if (dev_scsi.serial[0] == '\0') { + retval = 1; + goto out; + } + if (reformat_serial) + format_serial(dev_scsi.serial); + printf("%s\n", dev_scsi.serial); +out: return retval; } diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 48e4a58231..9fcadec173 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -37,12 +37,13 @@ struct scsi_id_device { char type[33]; char kernel[64]; char serial[MAX_SERIAL_LEN]; + char serial_short[MAX_SERIAL_LEN]; int use_sg; }; extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); extern int scsi_get_serial (struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname, - int page_code, char *serial_short, int len); + int page_code, int len); /* * Page code values. diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 20d30cf0df..cbacf379fe 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -837,7 +837,7 @@ out: int scsi_get_serial(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname, - int page_code, char *serial_short, int len) + int page_code, int len) { unsigned char page0[SCSI_INQ_BUFF_LEN]; int fd = -1; @@ -860,7 +860,7 @@ int scsi_get_serial(struct udev *udev, return 1; if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len)) { + if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { retval = 1; goto completed; } else { @@ -868,7 +868,7 @@ int scsi_get_serial(struct udev *udev, goto completed; } } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { retval = 1; goto completed; } else { @@ -876,7 +876,7 @@ int scsi_get_serial(struct udev *udev, goto completed; } } else if (page_code == PAGE_83_PRE_SPC3) { - retval = do_scsi_page83_prespc3_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len); + retval = do_scsi_page83_prespc3_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len); if (retval) { /* * Fallback to servicing a SPC-2/3 compliant page 83 @@ -884,7 +884,7 @@ int scsi_get_serial(struct udev *udev, * conform to pre-SPC3 expectations. */ if (retval == 2) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, serial_short, len)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { retval = 1; goto completed; } else { @@ -924,7 +924,7 @@ int scsi_get_serial(struct udev *udev, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, serial_short, len)) { + dev_scsi->serial, dev_scsi->serial_short, len)) { /* * Success */ @@ -935,7 +935,7 @@ int scsi_get_serial(struct udev *udev, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_80) if (!do_scsi_page80_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, serial_short, len)) { + dev_scsi->serial, dev_scsi->serial_short, len)) { /* * Success */ -- cgit v1.2.3-54-g00ecf From 3e18fb062f16e99cd3b308089f1459f4eeb33003 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 2 Dec 2008 19:26:33 +0100 Subject: update configure and NEWS --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7970db2796..0f567ad923 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 136 +======== +Bugfixes. + udev 135 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index d795aa114d..cdd85efb2d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [135], + [136], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) -- cgit v1.2.3-54-g00ecf From 1ac8fad8e56097cf8e08a0a17f044309317cb50f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 3 Dec 2008 01:32:00 +0100 Subject: rules: fix isdn rules On Tue, Dec 2, 2008 at 21:07, Matthias Schwarzott wrote: > It seems that the rules related to capi devices are not correct: > > KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" > KERNEL=="capi*", NAME="capi/%n" > > Changing the second rule to match only on KERNEL=="capi[0-9]*" is reported to > make it work. > So I can only guess that the problem is the second rule overwriting the NAME > set by the first one. --- rules/packages/40-isdn.rules | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/rules/packages/40-isdn.rules b/rules/packages/40-isdn.rules index f2bc34e5c8..8a4686f0b7 100644 --- a/rules/packages/40-isdn.rules +++ b/rules/packages/40-isdn.rules @@ -1,5 +1,4 @@ # do not edit this file, it will be overwritten on update -SUBSYSTEM=="capi", GROUP="uucp" -KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20" -KERNEL=="capi*", NAME="capi/%n" +SUBSYSTEM=="capi", KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20", GROUP="uucp" +SUBSYSTEM=="tty", KERNEL=="capi[0-9]*", NAME="capi/%n" -- cgit v1.2.3-54-g00ecf From 43f7e87f549c9b0630f27c05b0bf15102f1ed8cc Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 3 Dec 2008 11:49:50 +0100 Subject: volume_id: HPFS code clean up * fix typo (hs vs. hbb) * set id->{version,usage,type} when all tests pass * be paranoid and don't use hs->version when "hs" source buffer was possibly modified by next volume_id_get_buffer() call. Signed-off-by: Karel Zak --- extras/volume_id/lib/hpfs.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c index ce9118d370..0f0770f05f 100644 --- a/extras/volume_id/lib/hpfs.c +++ b/extras/volume_id/lib/hpfs.c @@ -79,6 +79,7 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size) struct hpfs_super *hs; struct hpfs_spare_super *hss; struct hpfs_boot_block *hbb; + uint8_t version; info("probing at offset 0x%" PRIx64 "\n", off); @@ -94,13 +95,11 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size) if (memcmp(hss->magic, "\x49\x18\x91\xf9", 4) != 0) return -1; - sprintf(id->type_version, "%u", hs->version); - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hpfs"; + version = hs->version; /* if boot block looks valid, read label and uuid from there */ hbb = (struct hpfs_boot_block *) volume_id_get_buffer(id, off, 0x200); - if (hs == NULL) + if (hbb == NULL) return -1; if (memcmp(hbb->magic, "\x55\xaa", 2) == 0 && memcmp(hbb->sig_hpfs, "HPFS", 4) == 0 && @@ -109,6 +108,9 @@ int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size) volume_id_set_label_string(id, hbb->vol_label, 11); volume_id_set_uuid(id, hbb->vol_serno, 0, UUID_DOS); } + sprintf(id->type_version, "%u", version); + volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); + id->type = "hpfs"; return 0; } -- cgit v1.2.3-54-g00ecf From bc4c751802147f1ff21bf52a57a2976754949453 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Dec 2008 01:43:33 +0100 Subject: rules: add persistent /dev/serial/{by-id,by-path} rules $ tree /dev/serial/ /dev/serial/ |-- by-id | |-- usb-067b_2303-if00-port0 -> ../../ttyUSB0 | |-- usb-FTDI_FT232R_USB_UART_A7005uBP-if00-port0 -> ../../ttyUSB3 | |-- usb-HUAWEI_Technology_HUAWEI_Mobile-if00-port0 -> ../../ttyUSB1 | `-- usb-HUAWEI_Technology_HUAWEI_Mobile-if01-port0 -> ../../ttyUSB2 `-- by-path |-- pci-0000:00:1d.0-usb-0:1:1.0-port0 -> ../../ttyUSB3 |-- pci-0000:00:1d.7-usb-0:2.2.2:1.0-port0 -> ../../ttyUSB0 |-- pci-0000:00:1d.7-usb-0:2.3:1.0-port0 -> ../../ttyUSB1 `-- pci-0000:00:1d.7-usb-0:2.3:1.1-port0 -> ../../ttyUSB2 $ tree /dev/serial/ /dev/serial/ |-- by-id | |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port0 -> ../../ttyUSB0 | |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port1 -> ../../ttyUSB1 | |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port2 -> ../../ttyUSB2 | |-- usb-Inside_Out_Networks_Edgeport_4_04-01-006467-if00-port3 -> ../../ttyUSB3 | |-- usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-if00-port0 -> ../../ttyUSB8 | |-- usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-if00-port1 -> ../../ttyUSB9 | |-- usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-if00-port2 -> ../../ttyUSB10 | |-- usb-Keyspan__a_division_of_InnoSys_Inc._USB_4-port_Serial_Adapter-if00-port3 -> ../../ttyUSB11 | `-- usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0 -> ../../ttyUSB7 `-- by-path |-- pci-0000:00:1d.2-usb-0:1.3:1.0-port0 -> ../../ttyUSB7 |-- pci-0000:00:1d.7-usb-0:6.1.4.1:1.0-port0 -> ../../ttyUSB4 |-- pci-0000:00:1d.7-usb-0:6.1.4.1:1.0-port1 -> ../../ttyUSB5 |-- pci-0000:00:1d.7-usb-0:6.1.4.1:1.0-port2 -> ../../ttyUSB6 |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port0 -> ../../ttyUSB0 |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port1 -> ../../ttyUSB1 |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port2 -> ../../ttyUSB2 |-- pci-0000:00:1d.7-usb-0:6.1.4.4:1.0-port3 -> ../../ttyUSB3 |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port0 -> ../../ttyUSB8 |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port1 -> ../../ttyUSB9 |-- pci-0000:00:1d.7-usb-0:6.3:1.0-port2 -> ../../ttyUSB10 `-- pci-0000:00:1d.7-usb-0:6.3:1.0-port3 -> ../../ttyUSB11 --- extras/path_id/path_id | 3 +++ rules/rules.d/60-persistent-serial.rules | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 rules/rules.d/60-persistent-serial.rules diff --git a/extras/path_id/path_id b/extras/path_id/path_id index f7b1435d3d..f45f62ad32 100755 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -515,6 +515,9 @@ handle_device () { */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) handle_scsi "$D" ;; + */ttyUSB*) + D=${D%/ttyUSB*} + ;; */usb[0-9]*/[0-9]*/*) handle_usb "$D" ;; diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules new file mode 100644 index 0000000000..df10606e07 --- /dev/null +++ b/rules/rules.d/60-persistent-serial.rules @@ -0,0 +1,19 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="persistent_serial_end" +SUBSYSTEM!="tty", GOTO="persistent_serial_end" +KERNEL!="ttyUSB[0-9]*", GOTO="persistent_serial_end" + +SUBSYSTEMS=="usb-serial", ENV{ID_PORT}="$attr{port_number}" +ENV{ID_PORT}=="", GOTO="persistent_serial_end" + +IMPORT="path_id" +ENV{ID_PATH}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{ID_PORT}" + +IMPORT="usb_id --export" +ENV{ID_SERIAL}=="", GOTO="persistent_serial_end" +SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}" +ENV{ID_IFACE}=="", GOTO="persistent_serial_end" +SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}-port$env{ID_PORT}" + +LABEL="persistent_serial_end" -- cgit v1.2.3-54-g00ecf From 626ed3b6c119090dab7bd7491c423ef8ef93c94b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Dec 2008 02:04:50 +0100 Subject: make: install serial rules file --- configure.ac | 2 +- rules/Makefile.am | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index cdd85efb2d..4439166d6a 100644 --- a/configure.ac +++ b/configure.ac @@ -19,7 +19,7 @@ AC_SUBST(LIBUDEV_LT_AGE) dnl /* libvolume_id version */ VOLID_LT_CURRENT=1 -VOLID_LT_REVISION=6 +VOLID_LT_REVISION=7 VOLID_LT_AGE=0 AC_SUBST(VOLID_LT_CURRENT) AC_SUBST(VOLID_LT_REVISION) diff --git a/rules/Makefile.am b/rules/Makefile.am index af0933885b..d6cefe3cc3 100644 --- a/rules/Makefile.am +++ b/rules/Makefile.am @@ -5,6 +5,7 @@ dist_udevrules_DATA = \ rules.d/50-udev-default.rules \ rules.d/60-persistent-storage.rules \ rules.d/60-persistent-storage-tape.rules \ + rules.d/60-persistent-serial.rules \ rules.d/60-persistent-input.rules \ rules.d/60-persistent-v4l.rules \ rules.d/80-drivers.rules \ -- cgit v1.2.3-54-g00ecf From 5d89ef7bf94d8a708a1159be22eb1cf458a1d101 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Dec 2008 04:03:08 +0100 Subject: make: do not delete autotools generated file with distclean [...] running the command `make maintainer-clean' should not delete `configure' even if `configure' can be remade using a rule in the Makefile. More generally, `make maintainer-clean' should not delete anything that needs to exist in order to run `configure' and then begin to build the program. This is the only exception; `maintainer-clean' should delete everything else that can be rebuilt. --- Makefile.am | 13 ++++++----- autogen.sh | 46 ++++++++++++++++++++++++++------------- extras/Makefile.am | 3 --- extras/ata_id/Makefile.am | 3 --- extras/cdrom_id/Makefile.am | 3 --- extras/collect/Makefile.am | 4 ---- extras/edd_id/Makefile.am | 3 --- extras/firmware/Makefile.am | 3 --- extras/floppy/Makefile.am | 3 --- extras/fstab_import/Makefile.am | 3 --- extras/path_id/Makefile.am | 4 ---- extras/rule_generator/Makefile.am | 3 --- extras/scsi_id/Makefile.am | 3 --- extras/usb_id/Makefile.am | 3 --- extras/volume_id/Makefile.am | 5 ++--- extras/volume_id/lib/Makefile.am | 3 --- rules/Makefile.am | 4 ---- udev/Makefile.am | 6 +++-- 18 files changed, 44 insertions(+), 71 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1d87bfd1a8..55df27e2c7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,15 +14,16 @@ EXTRA_DIST = \ docs \ autogen.sh -PREVIOUS_VERSION = `expr $(VERSION) - 1` +CLEANFILES = \ + udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 + +clean-local: + rm -rf udev-test-install distclean-local: - rm -f *~ rm -rf autom4te.cache - rm -f depcomp aclocal.m4 config.h.in configure install-sh - rm -f Makefile.in missing config.guess config.sub ltmain.sh - rm -rf udev-test-install - rm -f udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 + +PREVIOUS_VERSION = `expr $(VERSION) - 1` changelog: @ head -1 ChangeLog | grep -q "to v$(PREVIOUS_VERSION)" diff --git a/autogen.sh b/autogen.sh index ef3f579cbd..926ca7ec92 100755 --- a/autogen.sh +++ b/autogen.sh @@ -47,18 +47,34 @@ CFLAGS="-g -Wall \ -Wpointer-arith -Wsign-compare -Wchar-subscripts \ -Wstrict-prototypes -Wshadow" -if test -z "$1" -o "$1" = "install"; then - args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux" - args="$args --with-libdir-name=lib/$(gcc -print-multi-os-directory)" - CFLAGS="$CFLAGS -O2" -elif test "$1" = "devel" ; then - args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux --enable-debug" - args="$args --with-libdir-name=lib/$(gcc -print-multi-os-directory)" - CFLAGS="$CFLAGS -O0" -else - args=$@ -fi -echo " configure: $args" -echo -export CFLAGS -./configure $args +args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux" +libdir=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd)) + +case "$1" in + *install|"") + args="$args --with-libdir-name=$libdir" + export CFLAGS="$CFLAGS -O2" + echo " configure: $args" + echo + ./configure $args + ;; + *devel) + args="$args --enable-debug --with-libdir-name=$libdir" + export CFLAGS="$CFLAGS -O0" + echo " configure: $args" + echo + ./configure $args + ;; + *clean) + ./configure + make maintainer-clean + find . -name Makefile.in | xargs -r rm + rm -f depcomp aclocal.m4 config.h.in configure install-sh + rm -f missing config.guess config.sub ltmain.sh + exit 0 + ;; + *) + echo "Usage: $0 [--install|--devel|--clean]" + exit 1 + ;; +esac diff --git a/extras/Makefile.am b/extras/Makefile.am index 30e6e95d89..fc46668fdc 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -13,6 +13,3 @@ SUBDIRS = \ scsi_id \ usb_id \ volume_id - -distclean-local: - rm -f Makefile.in diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index 47ab0d6631..d31fd2c93c 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -13,6 +13,3 @@ ata_id_SOURCES = \ dist_man_MANS = \ ata_id.8 - -distclean-local: - rm -f Makefile.in diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index bb97d96dc0..51b6a20ee2 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -17,6 +17,3 @@ cdrom_id_SOURCES = \ dist_man_MANS = \ cdrom_id.8 - -distclean-local: - rm -f Makefile.in diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am index 895f1b7f0b..d9792b89eb 100644 --- a/extras/collect/Makefile.am +++ b/extras/collect/Makefile.am @@ -10,7 +10,3 @@ collect_SOURCES = \ ../../udev/lib/libudev.c \ ../../udev/lib/libudev-util.c \ ../../udev/lib/libudev-list.c - -distclean-local: - rm -f Makefile.in - diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 28ff8aa46e..9bfe43231f 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -17,6 +17,3 @@ edd_id_SOURCES = \ dist_man_MANS = \ edd_id.8 - -distclean-local: - rm -f Makefile.in diff --git a/extras/firmware/Makefile.am b/extras/firmware/Makefile.am index 78b28f61f0..4d1b19523e 100644 --- a/extras/firmware/Makefile.am +++ b/extras/firmware/Makefile.am @@ -4,6 +4,3 @@ udevhomedir = $(udev_prefix)/lib/udev dist_udevhome_SCRIPTS = \ firmware.sh -distclean-local: - rm -f Makefile.in - diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 8dadefa08d..8cb9cbd47d 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -23,6 +23,3 @@ endif dist_man_MANS = \ create_floppy_devices.8 - -distclean-local: - rm -f Makefile.in diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index d16c681ad1..c63dc7cf17 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -15,6 +15,3 @@ fstab_import_SOURCES = \ ../../udev/lib/libudev-list.c \ ../../udev/lib/libudev-util.c -distclean-local: - rm -f Makefile.in - diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am index b85b7473bb..f489290399 100644 --- a/extras/path_id/Makefile.am +++ b/extras/path_id/Makefile.am @@ -6,7 +6,3 @@ dist_udevhome_SCRIPTS = \ dist_man_MANS = \ path_id.8 - -distclean-local: - rm -f Makefile.in - diff --git a/extras/rule_generator/Makefile.am b/extras/rule_generator/Makefile.am index 898191281d..e8a8f17ee0 100644 --- a/extras/rule_generator/Makefile.am +++ b/extras/rule_generator/Makefile.am @@ -13,6 +13,3 @@ dist_udevrules_DATA = \ 75-cd-aliases-generator.rules \ 75-persistent-net-generator.rules -distclean-local: - rm -f Makefile.in - diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index 08da1c9de5..29d5fe7344 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -21,6 +21,3 @@ dist_sysconf_DATA = \ dist_man_MANS = \ scsi_id.8 -distclean-local: - rm -f Makefile.in - diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index c54d83e088..dfb52f17e2 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -12,6 +12,3 @@ usb_id_SOURCES = \ ../../udev/lib/libudev-util.c \ ../../udev/lib/libudev-device.c \ ../../udev/lib/libudev-enumerate.c - -distclean-local: - rm -f Makefile.in diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am index c58f1a8782..4a8ba94654 100644 --- a/extras/volume_id/Makefile.am +++ b/extras/volume_id/Makefile.am @@ -26,7 +26,6 @@ EXTRA_DIST = \ %.7 %.8 : %.xml $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< -distclean-local: - rm -f Makefile.in - rm -f $(dist_man_MANS) +MAINTAINERCLEANFILES= \ + $(dist_man_MANS) diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am index 678e44ec1c..d5fd6560f1 100644 --- a/extras/volume_id/lib/Makefile.am +++ b/extras/volume_id/lib/Makefile.am @@ -72,6 +72,3 @@ EXTRA_DIST = \ pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig pkgconfig_DATA = libvolume_id.pc - -distclean-local: - rm -f Makefile.in diff --git a/rules/Makefile.am b/rules/Makefile.am index d6cefe3cc3..7f3cd5982d 100644 --- a/rules/Makefile.am +++ b/rules/Makefile.am @@ -19,7 +19,3 @@ EXTRA_DIST = \ redhat \ suse \ gentoo - - -distclean-local: - rm -f Makefile.in diff --git a/udev/Makefile.am b/udev/Makefile.am index c374942c6e..2d185f477d 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -81,6 +81,8 @@ EXTRA_DIST = \ %.7 %.8 : %.xml $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< -distclean-local: +MAINTAINERCLEANFILES = \ + $(dist_man_MANS) + +git-clean: rm -f Makefile.in - rm -f $(dist_man_MANS) -- cgit v1.2.3-54-g00ecf From b76ad2e537e8672ace442eb27439521c9b107b09 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Dec 2008 16:48:54 +0100 Subject: udevadm: settle - allow --timeout=0 and --quiet --- udev/udevadm-settle.c | 25 ++++++++++++++++--------- udev/udevadm.xml | 9 ++++++++- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index a274e089d4..5bb3d22a49 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -37,10 +37,12 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { { "timeout", required_argument, NULL, 't' }, + { "quiet", no_argument, NULL, 'q' }, { "help", no_argument, NULL, 'h' }, {} }; int timeout = DEFAULT_TIMEOUT; + int quiet = 0; struct udev_queue *udev_queue = NULL; int loop; int rc = 0; @@ -51,21 +53,24 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) int option; int seconds; - option = getopt_long(argc, argv, "t:h", options, NULL); + option = getopt_long(argc, argv, "t:qh", options, NULL); if (option == -1) break; switch (option) { case 't': seconds = atoi(optarg); - if (seconds > 0) + if (seconds >= 0) timeout = seconds; else fprintf(stderr, "invalid timeout value\n"); dbg(udev, "timeout=%i\n", timeout); break; + case 'q': + quiet = 1; + break; case 'h': - printf("Usage: udevadm settle [--help] [--timeout=]\n\n"); + printf("Usage: udevadm settle [--help] [--timeout=] [--quiet]\n\n"); goto exit; } } @@ -82,12 +87,14 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (loop <= 0) { struct udev_list_entry *list_entry; - info(udev, "timeout waiting for udev queue\n"); - printf("\ndevadm settle timeout of %i seconds reached, the event queue contains:\n", timeout); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf(" '%s' [%s]\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); + if (!quiet) { + info(udev, "timeout waiting for udev queue\n"); + printf("\ndevadm settle timeout of %i seconds reached, the event queue contains:\n", timeout); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf(" %s (%s)\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } rc = 1; } exit: diff --git a/udev/udevadm.xml b/udev/udevadm.xml index b7687d5dd1..ebc4aa150f 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -220,7 +220,14 @@ Maximum number of seconds to wait for the event queue to become empty. - The default value is 180 seconds. + The default value is 180 seconds. A value of 0 will check if the queue is empty + and always return immediately. + + + + + + Do not print any output, like the remaining queue entries when reachin the timeout. -- cgit v1.2.3-54-g00ecf From 4fbf41c01835212c3a791b40cfcfccce58c21afd Mon Sep 17 00:00:00 2001 From: Ryan Thomas Date: Mon, 8 Dec 2008 19:10:03 -0500 Subject: rules: add rules for AoE devices In the interest of standardizing udev rules, please consider the following patch that adds udev rules for the ATA over Ethernet character and block devices. The aoe module has been a long-time member of the kernel and needs inclusion in the standard udev rules. --- rules/packages/40-aoe.rules | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 rules/packages/40-aoe.rules diff --git a/rules/packages/40-aoe.rules b/rules/packages/40-aoe.rules new file mode 100644 index 0000000000..4c01442e1c --- /dev/null +++ b/rules/packages/40-aoe.rules @@ -0,0 +1,9 @@ +# aoe char devices +SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" +SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="flush", NAME="etherd/%k", GROUP="disk", MODE="0220" + +# aoe block devices +SUBSYSTEM=="aoe", KERNEL=="etherd*", NAME="%k", GROUP="disk" -- cgit v1.2.3-54-g00ecf From 2fc635fb67dbd509f4ee532c8bf0d3885cc71989 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Dec 2008 04:18:21 +0100 Subject: rules: move aoe rules to default rules file --- rules/packages/40-aoe.rules | 9 --------- rules/rules.d/50-udev-default.rules | 3 ++- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 rules/packages/40-aoe.rules diff --git a/rules/packages/40-aoe.rules b/rules/packages/40-aoe.rules deleted file mode 100644 index 4c01442e1c..0000000000 --- a/rules/packages/40-aoe.rules +++ /dev/null @@ -1,9 +0,0 @@ -# aoe char devices -SUBSYSTEM=="aoe", KERNEL=="discover", NAME="etherd/%k", GROUP="disk", MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="err", NAME="etherd/%k", GROUP="disk", MODE="0440" -SUBSYSTEM=="aoe", KERNEL=="interfaces", NAME="etherd/%k", GROUP="disk", MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="revalidate", NAME="etherd/%k", GROUP="disk", MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="flush", NAME="etherd/%k", GROUP="disk", MODE="0220" - -# aoe block devices -SUBSYSTEM=="aoe", KERNEL=="etherd*", NAME="%k", GROUP="disk" diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index ad725fc34f..0f27982d85 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -87,7 +87,8 @@ KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" KERNEL=="pktcdvd", NAME="pktcdvd/control" KERNEL=="qft0", SYMLINK+="ftape" SUBSYSTEM=="bsg", NAME="bsg/%k" -SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk" +SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" # network KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" -- cgit v1.2.3-54-g00ecf From c9809be56844710fffcba8741f485e0911551f19 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Dec 2008 15:33:23 +0100 Subject: volume_id: btrfs - update format --- extras/volume_id/lib/btrfs.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extras/volume_id/lib/btrfs.c b/extras/volume_id/lib/btrfs.c index 1df8db50f1..09b03a68dc 100644 --- a/extras/volume_id/lib/btrfs.c +++ b/extras/volume_id/lib/btrfs.c @@ -42,6 +42,7 @@ struct btrfs_super_block { uint64_t root; uint64_t chunk_root; uint64_t log_root; + uint64_t log_root_transid; uint64_t total_bytes; uint64_t bytes_used; uint64_t root_dir_objectid; @@ -52,6 +53,10 @@ struct btrfs_super_block { uint32_t stripesize; uint32_t sys_chunk_array_size; uint64_t chunk_root_generation; + uint64_t compat_flags; + uint64_t compat_ro_flags; + uint64_t incompat_flags; + uint16_t csum_type; uint8_t root_level; uint8_t chunk_root_level; uint8_t log_root_level; @@ -64,6 +69,7 @@ struct btrfs_super_block { uint32_t sector_size; uint64_t type; uint64_t generation; + uint64_t start_offset; uint32_t dev_group; uint8_t seek_speed; uint8_t bandwidth; @@ -80,11 +86,11 @@ int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size) info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - buf = volume_id_get_buffer(id, off + 0x4000, 0x200); + buf = volume_id_get_buffer(id, off + 0x10000, 0x200); if (buf == NULL) return -1; bfs = (struct btrfs_super_block *)buf; - if (memcmp(bfs->magic, "_BFRfS_M", 8) != 0) + if (memcmp(bfs->magic, "_BHRfS_M", 8) != 0) return -1; volume_id_set_uuid(id, bfs->fsid, 0, UUID_DCE); volume_id_set_label_raw(id, bfs->label, 256); -- cgit v1.2.3-54-g00ecf From 07d9b845c665f9f0288585aed7c913b7f323df99 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Dec 2008 15:35:56 +0100 Subject: rules: add "do not edit header" --- rules/packages/40-infiniband.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/packages/40-infiniband.rules b/rules/packages/40-infiniband.rules index 6601faae09..e2e47480a9 100644 --- a/rules/packages/40-infiniband.rules +++ b/rules/packages/40-infiniband.rules @@ -1,3 +1,5 @@ +# do not edit this file, it will be overwritten on update + KERNEL=="umad[0-9]*", NAME="infiniband/%k" KERNEL=="issm[0-9]*", NAME="infiniband/%k" KERNEL=="ucm[0-9]*", NAME="infiniband/%k", MODE="0666" -- cgit v1.2.3-54-g00ecf From 14e182788853c56b14aa28dccf326c7d1671cfb5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Dec 2008 18:14:23 +0100 Subject: volume_id: support sub-uuid's and plug in btrfs device uuid --- extras/volume_id/lib/btrfs.c | 1 + extras/volume_id/lib/exported_symbols | 1 + extras/volume_id/lib/libvolume_id-private.h | 4 +++ extras/volume_id/lib/libvolume_id.h | 1 + extras/volume_id/lib/util.c | 48 +++++++++++++++++++---------- extras/volume_id/lib/volume_id.c | 13 ++++++++ extras/volume_id/vol_id.c | 10 ++++-- 7 files changed, 59 insertions(+), 19 deletions(-) diff --git a/extras/volume_id/lib/btrfs.c b/extras/volume_id/lib/btrfs.c index 09b03a68dc..5ef979f2f0 100644 --- a/extras/volume_id/lib/btrfs.c +++ b/extras/volume_id/lib/btrfs.c @@ -93,6 +93,7 @@ int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size) if (memcmp(bfs->magic, "_BHRfS_M", 8) != 0) return -1; volume_id_set_uuid(id, bfs->fsid, 0, UUID_DCE); + volume_id_set_uuid_sub(id, bfs->dev_item.uuid, 0, UUID_DCE); volume_id_set_label_raw(id, bfs->label, 256); volume_id_set_label_string(id, bfs->label, 256); volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols index d3b925c683..215a267dad 100644 --- a/extras/volume_id/lib/exported_symbols +++ b/extras/volume_id/lib/exported_symbols @@ -3,6 +3,7 @@ volume_id_get_label volume_id_get_label_raw volume_id_get_uuid volume_id_get_uuid_raw +volume_id_get_uuid_sub volume_id_get_usage volume_id_get_type volume_id_get_type_version diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h index 8a5c327aea..046a1e39ed 100644 --- a/extras/volume_id/lib/libvolume_id-private.h +++ b/extras/volume_id/lib/libvolume_id-private.h @@ -107,6 +107,9 @@ struct volume_id { uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; size_t uuid_raw_len; char uuid[VOLUME_ID_UUID_SIZE+1]; + uint8_t uuid_sub_raw[VOLUME_ID_UUID_SIZE]; + size_t uuid_sub_raw_len; + char uuid_sub[VOLUME_ID_UUID_SIZE+1]; enum volume_id_usage usage_id; char *usage; char *type; @@ -129,6 +132,7 @@ extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, si extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format); +extern void volume_id_set_uuid_sub(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format); extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); extern void volume_id_free_buffer(struct volume_id *id); diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h index e830504697..24c9c4e7eb 100644 --- a/extras/volume_id/lib/libvolume_id.h +++ b/extras/volume_id/lib/libvolume_id.h @@ -45,6 +45,7 @@ extern void volume_id_all_probers(all_probers_fn_t all_probers_fn, extern int volume_id_get_label(struct volume_id *id, const char **label); extern int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len); extern int volume_id_get_uuid(struct volume_id *id, const char **uuid); +extern int volume_id_get_uuid_sub(struct volume_id *id, const char **uuid); extern int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len); extern int volume_id_get_usage(struct volume_id *id, const char **usage); extern int volume_id_get_type(struct volume_id *id, const char **type); diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c index 9844e5e97c..ea5ff16e91 100644 --- a/extras/volume_id/lib/util.c +++ b/extras/volume_id/lib/util.c @@ -250,14 +250,12 @@ void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enu volume_id_set_unicode16((uint8_t *)id->label, sizeof(id->label), buf, endianess, count); } -void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format) +static void set_uuid(const uint8_t *buf, size_t len, enum uuid_format format, + char *uuid, uint8_t *uuid_raw, size_t *uuid_raw_len) { unsigned int i; unsigned int count = 0; - if (len > sizeof(id->uuid_raw)) - len = sizeof(id->uuid_raw); - switch(format) { case UUID_STRING: count = len; @@ -281,8 +279,8 @@ void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, en count = 32; break; } - memcpy(id->uuid_raw, buf, count); - id->uuid_raw_len = count; + memcpy(uuid_raw, buf, count); + *uuid_raw_len = count; /* if set, create string in the same format, the native platform uses */ for (i = 0; i < count; i++) @@ -293,16 +291,16 @@ void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, en set: switch(format) { case UUID_DOS: - sprintf(id->uuid, "%02X%02X-%02X%02X", + sprintf(uuid, "%02X%02X-%02X%02X", buf[3], buf[2], buf[1], buf[0]); break; case UUID_64BIT_LE: - sprintf(id->uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", + sprintf(uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", buf[7], buf[6], buf[5], buf[4], buf[3], buf[2], buf[1], buf[0]); break; case UUID_DCE: - sprintf(id->uuid, + sprintf(uuid, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], @@ -312,18 +310,18 @@ set: break; case UUID_HEX_STRING: /* translate A..F to a..f */ - memcpy(id->uuid, buf, count); + memcpy(uuid, buf, count); for (i = 0; i < count; i++) - if (id->uuid[i] >= 'A' && id->uuid[i] <= 'F') - id->uuid[i] = (id->uuid[i] - 'A') + 'a'; - id->uuid[count] = '\0'; + if (uuid[i] >= 'A' && uuid[i] <= 'F') + uuid[i] = (uuid[i] - 'A') + 'a'; + uuid[count] = '\0'; break; case UUID_STRING: - memcpy(id->uuid, buf, count); - id->uuid[count] = '\0'; + memcpy(uuid, buf, count); + uuid[count] = '\0'; break; case UUID_MD: - sprintf(id->uuid, + sprintf(uuid, "%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], @@ -331,7 +329,7 @@ set: buf[12], buf[13], buf[14],buf[15]); break; case UUID_LVM: - sprintf(id->uuid, + sprintf(uuid, "%c%c%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c%c%c", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], buf[8], buf[9], @@ -344,6 +342,22 @@ set: } } +void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format) +{ + if (len > sizeof(id->uuid_raw)) + len = sizeof(id->uuid_raw); + + set_uuid(buf, len, format, id->uuid, id->uuid_raw, &id->uuid_raw_len); +} + +void volume_id_set_uuid_sub(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format) +{ + if (len > sizeof(id->uuid_sub_raw)) + len = sizeof(id->uuid_sub_raw); + + set_uuid(buf, len, format, id->uuid_sub, id->uuid_sub_raw, &id->uuid_sub_raw_len); +} + uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) { ssize_t buf_len; diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c index 8bbbc38c32..48bfd88624 100644 --- a/extras/volume_id/lib/volume_id.c +++ b/extras/volume_id/lib/volume_id.c @@ -219,6 +219,19 @@ int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *l return 1; } +int volume_id_get_uuid_sub(struct volume_id *id, const char **uuid) +{ + if (id == NULL) + return 0; + if (uuid == NULL) + return 0; + if (id->usage_id == VOLUME_ID_UNUSED) + return 0; + + *uuid = id->uuid_sub; + return 1; +} + /** * volume_id_get_usage: * @id: Probing context. diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c index 889bd3483d..3e44c3b069 100644 --- a/extras/volume_id/vol_id.c +++ b/extras/volume_id/vol_id.c @@ -110,6 +110,7 @@ int main(int argc, char *argv[]) char label_enc[256]; char uuid_safe[256]; char uuid_enc[256]; + char uuid_sub_enc[256]; char type_enc[256]; char type_version_enc[256]; uint64_t size = 0; @@ -118,7 +119,7 @@ int main(int argc, char *argv[]) uint64_t offset = 0; const char *node; int fd; - const char *label, *uuid, *type, *type_version, *usage; + const char *label, *uuid, *uuid_sub, *type, *type_version, *usage; int retval; int rc = 0; @@ -261,7 +262,8 @@ int main(int argc, char *argv[]) !volume_id_get_usage(vid, &usage) || !volume_id_get_type(vid, &type) || !volume_id_get_type_version(vid, &type_version) || - !volume_id_get_uuid(vid, &uuid)) { + !volume_id_get_uuid(vid, &uuid) || + !volume_id_get_uuid_sub(vid, &uuid_sub)) { rc = 4; goto exit; } @@ -274,6 +276,8 @@ int main(int argc, char *argv[]) udev_util_replace_chars(uuid_safe, UDEV_ALLOWED_CHARS_INPUT); volume_id_encode_string(uuid, uuid_enc, sizeof(uuid_enc)); + volume_id_encode_string(uuid_sub, uuid_sub_enc, sizeof(uuid_sub_enc)); + volume_id_encode_string(type, type_enc, sizeof(type_enc)); volume_id_encode_string(type_version, type_version_enc, sizeof(type_version_enc)); @@ -284,6 +288,8 @@ int main(int argc, char *argv[]) printf("ID_FS_VERSION=%s\n", type_version_enc); printf("ID_FS_UUID=%s\n", uuid_safe); printf("ID_FS_UUID_ENC=%s\n", uuid_enc); + if (uuid_sub_enc[0] != '\0') + printf("ID_FS_UUID_SUB_ENC=%s\n", uuid_sub_enc); printf("ID_FS_LABEL=%s\n", label_safe); printf("ID_FS_LABEL_ENC=%s\n", label_enc); break; -- cgit v1.2.3-54-g00ecf From 4f06aaa9d8dc710826c92ba97d11e57858e8370a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Dec 2008 14:48:33 +0100 Subject: libudev: include --- udev/lib/libudev.h | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index ea6c9ddf02..64746ad7c8 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -21,6 +21,7 @@ #define _LIBUDEV_H_ #include +#include #include /* this will stay as long as the DeviceKit integration of udev is work in progress */ -- cgit v1.2.3-54-g00ecf From b6626d096285f856c78c763297114902d635b252 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Dec 2008 16:17:53 +0100 Subject: build: add -lsepol Harald needs it for static binaries. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4439166d6a..e9519a78f0 100644 --- a/configure.ac +++ b/configure.ac @@ -53,7 +53,7 @@ if test "x$with_selinux" = xyes; then AC_MSG_ERROR([SELinux selected but libselinux not found])) LIBS=$LIBS_save AC_DEFINE(USE_SELINUX, [1] ,[compile with SELinux support]) - SELINUX_LIBS="-lselinux" + SELINUX_LIBS="-lselinux -lsepol" fi AC_SUBST([SELINUX_LIBS]) AM_CONDITIONAL(USE_SELINUX, [test "x$with_selinux" = xyes], [compile with SELinux support]) -- cgit v1.2.3-54-g00ecf From 6a481373b490604c54800e665f806e90b028b136 Mon Sep 17 00:00:00 2001 From: Jeremy Higdon Date: Thu, 18 Dec 2008 13:42:28 +0100 Subject: path_id: rework SAS persistent names --- extras/path_id/path_id | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/extras/path_id/path_id b/extras/path_id/path_id index f45f62ad32..d21dea7011 100755 --- a/extras/path_id/path_id +++ b/extras/path_id/path_id @@ -285,44 +285,46 @@ handle_sas () { : handle_sas $* local DEV=$1 local cil adapter controller_dev + local lun + lun=${DEV##*:} # SAS device - sas_host_path="${DEV%%/port*}" - sas_phy_path="${DEV#*/host*/}" - sas_phy_path="${sas_phy_path%%/target*}" - sas_phy_id="${sas_phy_path%%/*}" - sas_phy_id="${sas_phy_id##*port-}" - sas_port_id="${sas_phy_path%%/end_device*}" - sas_port_id="${sas_port_id##*port-}" - sas_end_id="${sas_phy_path##*end_device-}" - sas_phy_dev="/sys/class/sas_phy/phy-${sas_phy_id}" - if [ -e "$sas_phy_dev/sas_address" ]; then - read phy_address < $sas_phy_dev/sas_address - read phy_id < $sas_phy_dev/phy_identifier - fi - if [ -z "$phy_address" ] ; then + sas_end_path="${DEV%%/target*}" + sas_host_path="${sas_end_path%%/port*}" + sas_phy_path="${sas_end_path#*/host*/}" + sas_phy_path="${sas_phy_path%%/*}" + sas_phy_path="${sas_host_path}/${sas_phy_path}" + + sas_phy_id=255 + for phy in $sas_phy_path/phy-*/sas_phy/phy-* ; do + if [ -d "$phy" ] ; then + read phy_id < $phy/phy_identifier + if [ $phy_id -lt $sas_phy_id ]; then + sas_phy_id=$phy_id + fi + fi + done + + if [ $sas_phy_id -eq 255 ] ; then : no initiator address D= RESULT=1 return fi + + sas_port_id="${sas_phy_path##*/port-}" sas_port_dev="/sys/class/sas_port/port-${sas_port_id}" if [ -e "$sas_port_dev/num_phys" ] ; then read phy_port < $sas_port_dev/num_phys fi - if [ -z "$phy_port" ] ; then - : no initiator address - D= - RESULT=1 - return - fi - sas_phy_address="$phy_address:$phy_port:$phy_id" + + sas_end_id="${sas_end_path##*end_device-}" sas_end_dev="/sys/class/sas_device/end_device-${sas_end_id}" if [ -e "$sas_end_dev/sas_address" ]; then read end_address < $sas_end_dev/sas_address read end_id < $sas_end_dev/phy_identifier fi if [ -z "$end_address" ] ; then - : no initiator address + : no end device address D= RESULT=1 return @@ -330,7 +332,7 @@ handle_sas () { sas_end_address="$end_address:$end_id" controller_dev="${sas_host_path%/host[0-9]*}" # SAS devices are always endpoints - d="sas-${sas_phy_address}-${sas_end_address}" + d="sas-phy${sas_phy_id}:${phy_port}-${sas_end_address}-lun$lun" D="$controller_dev" RESULT=0 } -- cgit v1.2.3-54-g00ecf From d4e7bda70c9ae96df91660e62b160e7ae959e43c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Dec 2008 01:30:41 +0100 Subject: build: just use autoreconf -i Thanks to Scott for mentioning! --- autogen.sh | 46 ++-------------------------------------------- 1 file changed, 2 insertions(+), 44 deletions(-) diff --git a/autogen.sh b/autogen.sh index 926ca7ec92..f088a8f5d1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,52 +1,12 @@ #!/bin/sh -e -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoconf installed to generate the build system." - echo - exit 1 -} -(libtoolize --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have libtool installed to generate the build system." - echo - exit 1 -} -(autoheader --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have autoheader installed to generate the build system." - echo - exit 1 -} -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "You must have automake installed to generate the build system." - echo - exit 1 -} - -test -f udev/udevd.c || { - echo "You must run this script in the top-level source directory" - exit 1 -} - -echo " aclocal: $(aclocal --version | head -1)" -aclocal -echo " autoconf: $(autoconf --version | head -1)" -autoconf -echo " libtool: $(automake --version | head -1)" -libtoolize --force -echo " autoheader: $(autoheader --version | head -1)" -autoheader -echo " automake: $(automake --version | head -1)" -automake --add-missing +autoreconf -i CFLAGS="-g -Wall \ -Wmissing-declarations -Wmissing-prototypes \ -Wnested-externs -Wpointer-arith \ -Wpointer-arith -Wsign-compare -Wchar-subscripts \ -Wstrict-prototypes -Wshadow" - args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux" libdir=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd)) @@ -68,9 +28,7 @@ case "$1" in *clean) ./configure make maintainer-clean - find . -name Makefile.in | xargs -r rm - rm -f depcomp aclocal.m4 config.h.in configure install-sh - rm -f missing config.guess config.sub ltmain.sh + git clean -f -X exit 0 ;; *) -- cgit v1.2.3-54-g00ecf From 93e4f2cfc8fce58e8d50346b417e7023f7cf3552 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Dec 2008 04:37:09 +0100 Subject: rules: remove ide-scsi --- rules/rules.d/80-drivers.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index ca0fa6bc42..66c0375268 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -7,7 +7,6 @@ SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" -SUBSYSTEM=="ide", ATTR{media}=="tape", RUN+="/sbin/modprobe ide-scsi" SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe ppdev" -- cgit v1.2.3-54-g00ecf From a31f59b570d12da609878d5c69fd576b215fae19 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Dec 2008 16:49:56 +0100 Subject: rules: first simple step merging with Ubuntu rules --- TODO | 1 + extras/firmware/50-firmware.rules | 4 ++++ extras/firmware/Makefile.am | 3 +++ rules/rules.d/50-udev-default.rules | 3 --- rules/rules.d/80-drivers.rules | 16 +++++++++------- 5 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 extras/firmware/50-firmware.rules diff --git a/TODO b/TODO index 3fd49ac5da..8cb24b807c 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ + o add scsi:t-0x09* to ch and remove modprobe rule o switch device mapper rules to: dmsetup info -c --nameprefixes --unquoted --rows --noheadings \ -o name,uuid,suspended,readonly,major,minor,open,tables_loaded diff --git a/extras/firmware/50-firmware.rules b/extras/firmware/50-firmware.rules new file mode 100644 index 0000000000..a28e2a875d --- /dev/null +++ b/extras/firmware/50-firmware.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +# firmware-class requests, copies files into the kernel +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" diff --git a/extras/firmware/Makefile.am b/extras/firmware/Makefile.am index 4d1b19523e..42f58768c9 100644 --- a/extras/firmware/Makefile.am +++ b/extras/firmware/Makefile.am @@ -4,3 +4,6 @@ udevhomedir = $(udev_prefix)/lib/udev dist_udevhome_SCRIPTS = \ firmware.sh +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = \ + 50-firmware.rules diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 0f27982d85..c58e24f66e 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -56,9 +56,6 @@ KERNEL=="dv1394*", SYMLINK+="dv1394/%n" KERNEL=="video1394*", NAME="video1394/%n" KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" -# firmware class requests -SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" - # libusb device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index 66c0375268..7e13e80764 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -2,13 +2,15 @@ ACTION!="add", GOTO="drivers_end" -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe $env{MODALIAS}" -SUBSYSTEM=="tifm", RUN+="/sbin/modprobe --all tifm_sd tifm_ms" -SUBSYSTEM=="memstick", RUN+="/sbin/modprobe --all ms_block mspro_block" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe mmc_block" -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe i2o_block" -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe sg" -SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe ppdev" +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe -b $env{MODALIAS}" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -b tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -b tifm_ms" +SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -b --all ms_block mspro_block" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" +SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -b i2o_block" +SUBSYSTEM=="scsi", ATTR{type}=="8", RUN+="/sbin/modprobe -b ch" +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe -b sg" +SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -b ppdev" LABEL="drivers_end" -- cgit v1.2.3-54-g00ecf From c4e63d54124062659f9d8cf18ad3cb7430326938 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 20 Dec 2008 00:03:53 +0100 Subject: "'/sbin/modprobe abnormal' exit" - also print program options --- udev/udev-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-util.c b/udev/udev-util.c index 271941b8ff..3d5eb7657c 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -444,7 +444,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp, if (WEXITSTATUS(status) != 0) err = -1; } else { - err(udev, "'%s' abnormal exit\n", argv[0]); + err(udev, "'%s' abnormal exit\n", command); err = -1; } } -- cgit v1.2.3-54-g00ecf From 23456b19eba54a5b9d760f134b574191f459c71d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 21 Dec 2008 13:01:40 +0100 Subject: rules: more changes toward Ubuntu rules merge specialix_rioctl: no kernel name symlink specialix_sxctl: no kernel name symlink bus/usb: 0644 -> 0664 ppdev: lp dri: 0666 -> 0660 js: no kernel name symlink --- rules/rules.d/50-udev-default.rules | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index c58e24f66e..c2dda7688e 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -27,8 +27,8 @@ KERNEL=="ram1", SYMLINK+="ram" # input KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" -KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0600" -KERNEL=="js[0-9]*", NAME="input/%k", MODE="0644", SYMLINK+="%k" +KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0640" +KERNEL=="js[0-9]*", NAME="input/%k", MODE="0644" # video4linux SUBSYSTEM=="video4linux", GROUP="video" @@ -41,7 +41,7 @@ KERNEL=="video0", SYMLINK+="video" # graphics KERNEL=="agpgart", MODE="0600", GROUP="video" -KERNEL=="card[0-9]*", NAME="dri/%k", MODE="0666" +KERNEL=="card[0-9]*", NAME="dri/%k" KERNEL=="fb0", SYMLINK+="fb" KERNEL=="pmu", GROUP="video" KERNEL=="nvidia*|nvidiactl*", GROUP="video" @@ -57,11 +57,12 @@ KERNEL=="video1394*", NAME="video1394/%n" KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" # libusb device nodes -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0644" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0664" # printer KERNEL=="parport[0-9]*", GROUP="lp" SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp", SYMLINK+="par%n" KERNEL=="irlpt[0-9]*", GROUP="lp" @@ -106,8 +107,8 @@ KERNEL=="rflash[0-9]*", MODE="0400" KERNEL=="rrom[0-9]*", MODE="0400" KERNEL=="sbpcd0", SYMLINK+="sbpcd" KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" -KERNEL=="sxctl", NAME="specialix_sxctl", SYMLINK+="%k" -KERNEL=="rioctl", NAME="specialix_rioctl", SYMLINK+="%k" +KERNEL=="sxctl", NAME="specialix_sxctl"" +KERNEL=="rioctl", NAME="specialix_rioctl" KERNEL=="iowarrior[0-9]*", NAME="usb/%k" KERNEL=="hiddev[0-9]*", NAME="usb/%k" KERNEL=="legousbtower[0-9]*", NAME="usb/%k" -- cgit v1.2.3-54-g00ecf From 41e7f55711db043370e1681bb5a97ebdeda5d6d3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 21 Dec 2008 13:17:37 +0100 Subject: rules: more changes toward Ubuntu rules merge dv1394*: no kernel name symlink lp*: no par* symlink hwrng: no kernel name symlink --- rules/rules.d/50-udev-default.rules | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index c2dda7688e..67ed827a37 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -52,9 +52,9 @@ SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/ SUBSYSTEM=="dvb", GROUP="video" # Firewire -KERNEL=="dv1394*", SYMLINK+="dv1394/%n" -KERNEL=="video1394*", NAME="video1394/%n" -KERNEL=="dv1394*|video1394*|raw1394*", GROUP="video" +KERNEL=="dv1394[0-9]*", NAME="dv1394/%n", GROUP="video" +KERNEL=="video1394[0-9]*", NAME="video1394/%n", GROUP="video" +KERNEL=="raw1394*", GROUP="video" # libusb device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0664" @@ -64,7 +64,7 @@ KERNEL=="parport[0-9]*", GROUP="lp" SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" SUBSYSTEM=="ppdev", GROUP="lp" SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" -KERNEL=="lp[0-9]*", GROUP="lp", SYMLINK+="par%n" +KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" # block, tapes, block-releated @@ -101,7 +101,7 @@ KERNEL=="fuse", MODE="0666" KERNEL=="rtc|rtc0", MODE="0644" KERNEL=="rtc0", SYMLINK+="rtc" KERNEL=="auer[0-9]*", NAME="usb/%k" -KERNEL=="hw_random", NAME="hwrng", SYMLINK+="%k" +KERNEL=="hw_random", NAME="hwrng" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" KERNEL=="rrom[0-9]*", MODE="0400" -- cgit v1.2.3-54-g00ecf From d4e0db3c5de9a4899c87a4cf09b74f8bdc764060 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 21 Dec 2008 13:42:08 +0100 Subject: rules: remove /dev/raw/raxctl symlink, it's a devfs leftover --- NEWS | 10 ++++++++++ rules/rules.d/50-udev-default.rules | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 0f567ad923..c59d93c55d 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,16 @@ udev 136 ======== Bugfixes. +/dev/serial/by-{id,path}/ now contains links for ttyUSB devices, +which do not depend on the kernel device name. As usual, unique +devices - only a single one per product connected, or a real +USB serial number in the device - are always found with the same +name in the by-id/ directory. +Completely Identical devices may overwrite their names in by-id/ +and can only be found reliably in the by-path/ directory. Devices +specified by by-path/ must not change their connection, like the +USB port number they are plugged in, to keep their name. + udev 135 ======== Bugfixes. diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 67ed827a37..4576799175 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -79,7 +79,7 @@ KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" -KERNEL=="rawctl", NAME="raw/%k", GROUP="disk" +KERNEL=="rawctl", GROUP="disk" SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" KERNEL=="pktcdvd", NAME="pktcdvd/control" -- cgit v1.2.3-54-g00ecf From f0bbea669698e474f5ec00c2ed6b4f10261a345d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 21 Dec 2008 13:48:55 +0100 Subject: rules: rtc - create rtc compat link only for cmos type rtc --- rules/rules.d/50-udev-default.rules | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 4576799175..da8437e01f 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -98,8 +98,7 @@ KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" # miscellaneous KERNEL=="fuse", MODE="0666" -KERNEL=="rtc|rtc0", MODE="0644" -KERNEL=="rtc0", SYMLINK+="rtc" +SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" KERNEL=="auer[0-9]*", NAME="usb/%k" KERNEL=="hw_random", NAME="hwrng" KERNEL=="mmtimer", MODE="0644" -- cgit v1.2.3-54-g00ecf From 6b956a99836b936ee252243d9d0680318aaf3f0a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Dec 2008 13:34:54 +0100 Subject: rules: remove legacy symlinks --- rules/rules.d/50-udev-default.rules | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index da8437e01f..afcf2bc80f 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -16,14 +16,10 @@ KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" KERNEL=="mwave", NAME="modems/mwave", GROUP="uucp" KERNEL=="hvc*|hvsi*", GROUP="uucp" -KERNEL=="lirc0", SYMLINK+="lirc" # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" -KERNEL=="null", SYMLINK+="X0R" KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" -KERNEL=="ram0", SYMLINK+="ramdisk" -KERNEL=="ram1", SYMLINK+="ram" # input KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" @@ -35,14 +31,10 @@ SUBSYSTEM=="video4linux", GROUP="video" KERNEL=="vttuner*", GROUP="video" KERNEL=="vtx*|vbi*", GROUP="video" KERNEL=="winradio*", GROUP="video" -KERNEL=="vbi0", SYMLINK+="vbi" -KERNEL=="radio0", SYMLINK+="radio" -KERNEL=="video0", SYMLINK+="video" # graphics KERNEL=="agpgart", MODE="0600", GROUP="video" KERNEL=="card[0-9]*", NAME="dri/%k" -KERNEL=="fb0", SYMLINK+="fb" KERNEL=="pmu", GROUP="video" KERNEL=="nvidia*|nvidiactl*", GROUP="video" SUBSYSTEM=="graphics", GROUP="video" @@ -83,7 +75,6 @@ KERNEL=="rawctl", GROUP="disk" SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" KERNEL=="pktcdvd", NAME="pktcdvd/control" -KERNEL=="qft0", SYMLINK+="ftape" SUBSYSTEM=="bsg", NAME="bsg/%k" SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk", MODE="0220" SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" @@ -104,8 +95,6 @@ KERNEL=="hw_random", NAME="hwrng" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" KERNEL=="rrom[0-9]*", MODE="0400" -KERNEL=="sbpcd0", SYMLINK+="sbpcd" -KERNEL=="slram[0-9]*", SYMLINK+="xpram%n" KERNEL=="sxctl", NAME="specialix_sxctl"" KERNEL=="rioctl", NAME="specialix_rioctl" KERNEL=="iowarrior[0-9]*", NAME="usb/%k" -- cgit v1.2.3-54-g00ecf From a8cf7cf2c7b4c41c14508a808b09a5fa9256a024 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Dec 2008 14:58:11 +0100 Subject: rules: do not put raw1394 in "video" group A note on /dev/raw1394's security implications: 1. You cannot access local memory through raw1394, except for ROMs and CSRs that are exposed to other nodes any way. 2. It is extremely hard to manipulate data on attached SBP-2 devices (FireWire storage devices). 3. You can disturb operation of the FireWire bus, e.g. creating a DoS situation for audio/video applications, for SBP-2 devices, or eth1394 network interfaces. 4. If another PC is attached to the FireWire bus, it may be possible to read or overwrite the entire RAM of that remote PC. This depends on the PC's configuration. Most FireWire controllers support this feature (yes, it's not a bug, or at least wasn't intended to be one...) but not all OSs enable the feature. Actually, a cheap setup to achieve #1 by #4 is to have two FireWire controllers in the PC and connect them. https://bugs.launchpad.net/ubuntu/+source/kino/+bug/6290/comments/21 --- rules/rules.d/50-udev-default.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index afcf2bc80f..5d91cb6a09 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -46,7 +46,6 @@ SUBSYSTEM=="dvb", GROUP="video" # Firewire KERNEL=="dv1394[0-9]*", NAME="dv1394/%n", GROUP="video" KERNEL=="video1394[0-9]*", NAME="video1394/%n", GROUP="video" -KERNEL=="raw1394*", GROUP="video" # libusb device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0664" -- cgit v1.2.3-54-g00ecf From de2dc210e5fa9ad2967c8f315259a69441936141 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 22 Dec 2008 12:26:06 +0100 Subject: rule_generator: fix enumeration for write_cd_rules quote +, as it would be taken as a part of the regexp otherwise https://bugzilla.redhat.com/show_bug.cgi?id=477535 --- extras/rule_generator/write_cd_rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules index 8de227661d..398cd2737b 100644 --- a/extras/rule_generator/write_cd_rules +++ b/extras/rule_generator/write_cd_rules @@ -23,7 +23,7 @@ RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" . /lib/udev/rule_generator.functions find_next_available() { - raw_find_next_available "$(find_all_rules 'SYMLINK+=' "$1")" + raw_find_next_available "$(find_all_rules 'SYMLINK\+=' "$1")" } write_rule() { -- cgit v1.2.3-54-g00ecf From a7cb7d79f787614b9c4ade94a7a95144ef46eacd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Dec 2008 16:15:37 +0100 Subject: rules: second round merging with Ubuntu rules --- rules/rules.d/50-udev-default.rules | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 5d91cb6a09..d6fdf00bf9 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -3,17 +3,17 @@ SUBSYSTEM=="block", SYMLINK+="block/%M:%m" SUBSYSTEM!="block", SYMLINK+="char/%M:%m" -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660", OPTIONS+="last_rule" -KERNEL=="ptmx", GROUP="tty", MODE="0666", OPTIONS+="last_rule" -KERNEL=="tty", GROUP="tty", MODE="0666", OPTIONS+="last_rule" -KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620", OPTIONS+="last_rule" -KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty", OPTIONS+="last_rule" -KERNEL=="console", MODE="0600", OPTIONS+="last_rule" +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" +KERNEL=="ptmx", GROUP="tty", MODE="0666" +KERNEL=="tty", GROUP="tty", MODE="0666" +KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" +KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty" +KERNEL=="console", MODE="0600" # serial KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" -KERNEL=="ppp", MODE="0600", OPTIONS+="ignore_remove" +KERNEL=="ppp", MODE="0600" KERNEL=="mwave", NAME="modems/mwave", GROUP="uucp" KERNEL=="hvc*|hvsi*", GROUP="uucp" @@ -79,7 +79,7 @@ SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk", MODE="0220" SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" # network -KERNEL=="tun", NAME="net/%k", MODE="0666", OPTIONS+="ignore_remove" +KERNEL=="tun", NAME="net/%k", MODE="0666" # CPU KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" @@ -105,4 +105,4 @@ KERNEL=="cpad[0-9]*", NAME="usb/%k" # do not delete static device nodes ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove" - +ACTION=="remove", NAME=="", TEST=="/lib/udev/devices/%k", OPTIONS+="ignore_remove" -- cgit v1.2.3-54-g00ecf From 6c172fd41dc6148560e9a2c1fb98b53ec659ebf7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Dec 2008 16:16:46 +0100 Subject: rules: remove /dev/dsp /dev/audio --- rules/packages/40-alsa.rules | 2 -- 1 file changed, 2 deletions(-) diff --git a/rules/packages/40-alsa.rules b/rules/packages/40-alsa.rules index d30a1da8fc..c21840972e 100644 --- a/rules/packages/40-alsa.rules +++ b/rules/packages/40-alsa.rules @@ -7,5 +7,3 @@ KERNEL=="midiC[D0-9]*", NAME="snd/%k" KERNEL=="timer", NAME="snd/%k" KERNEL=="seq", NAME="snd/%k" KERNEL=="mixer0", SYMLINK+="mixer" -KERNEL=="dsp0", SYMLINK+="dsp" -KERNEL=="audio0", SYMLINK+="audio" -- cgit v1.2.3-54-g00ecf From 20e9677d226cf2e626255129f6a757a782edaf7e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Dec 2008 16:19:38 +0100 Subject: rules: put alsa in group "audio" --- rules/packages/40-alsa.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/packages/40-alsa.rules b/rules/packages/40-alsa.rules index c21840972e..abdde8cf91 100644 --- a/rules/packages/40-alsa.rules +++ b/rules/packages/40-alsa.rules @@ -1,5 +1,6 @@ # do not edit this file, it will be overwritten on update +SUBSYSTEM=="sound", GROUP="audio" KERNEL=="controlC[0-9]*", NAME="snd/%k" KERNEL=="hwC[D0-9]*", NAME="snd/%k" KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -- cgit v1.2.3-54-g00ecf From 58dc66fdb7dca8860191b3c702c2bef788fa039c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Dec 2008 17:11:01 +0100 Subject: rules: isdn - remove /dev/isdn/capi20 symlink --- rules/packages/40-isdn.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/packages/40-isdn.rules b/rules/packages/40-isdn.rules index 8a4686f0b7..22d9fe691b 100644 --- a/rules/packages/40-isdn.rules +++ b/rules/packages/40-isdn.rules @@ -1,4 +1,4 @@ # do not edit this file, it will be overwritten on update -SUBSYSTEM=="capi", KERNEL=="capi", NAME="capi20", SYMLINK+="isdn/capi20", GROUP="uucp" +SUBSYSTEM=="capi", KERNEL=="capi", NAME="capi20", GROUP="uucp" SUBSYSTEM=="tty", KERNEL=="capi[0-9]*", NAME="capi/%n" -- cgit v1.2.3-54-g00ecf From 49bb7a8a2a942db5b763e5375295f81debc31ff5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 26 Dec 2008 01:41:36 +0100 Subject: rules: provide /dev/raw/rawctl On Fri, Dec 26, 2008 at 01:26, Karel Zak wrote: > On Fri, Dec 26, 2008 at 12:39:16AM +0100, Kay Sievers wrote: >> On Fri, Dec 26, 2008 at 00:26, Karel Zak wrote: >> > The upstream raw(8) command supports /dev/rawctl and also >> > /dev/raw/rawctl. I think it makes more sense to use raw/rawctl when >> > you have all your raw devices in raw/ subdirectory (e.g. /dev/raw/raw). >> >> The raw tool looks for /dev/rawctl first and the fallback to >> /dev/raw/rawctl is named DEVFS_*. Should we turn that order around and >> remove the devfs notion from the raw tool and let udev create a >> dev/raw/rawctl node? > > Yeah. Fixed, committed and pushed. > > $ strace -e open ./raw > open("/dev/raw/rawctl", O_RDWR) = -1 ENOENT (No such file or directory) > open("/dev/rawctl", O_RDWR) = -1 ENOENT (No such file or directory) > > I have also removed the #ifdef OLD_RAW_DEVS (/dev/raw) junk. --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index d6fdf00bf9..0eb401cda2 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -70,7 +70,7 @@ KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" -KERNEL=="rawctl", GROUP="disk" +KERNEL=="rawctl", NAME="raw/rawctl", GROUP="disk" SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" KERNEL=="pktcdvd", NAME="pktcdvd/control" -- cgit v1.2.3-54-g00ecf From 1028fe14b65d861415cda99c4ff7d0bafd67bb7f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Dec 2008 01:49:01 +0100 Subject: if needed, store database entries also for devices which do not have a device node --- udev/lib/libudev-device-db-write.c | 22 +++++++++++++++++----- udev/udev-event.c | 7 +++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/udev/lib/libudev-device-db-write.c b/udev/lib/libudev-device-db-write.c index 34095e5682..11e0ab5f60 100644 --- a/udev/lib/libudev-device-db-write.c +++ b/udev/lib/libudev-device-db-write.c @@ -56,11 +56,21 @@ int udev_device_update_db(struct udev_device *udev_device) udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) if (udev_list_entry_get_flag(list_entry)) goto file; - if (udev_device_get_num_fake_partitions(udev_device)) + if (udev_device_get_num_fake_partitions(udev_device) != 0) goto file; if (udev_device_get_ignore_remove(udev_device)) goto file; - /* try not to waste tmpfs memory; store values, if they fit, in a symlink target */ + if (udev_device_get_devlink_priority(udev_device) != 0) + goto file; + if (udev_device_get_event_timeout(udev_device) >= 0) + goto file; + if (udev_device_get_devnode(udev_device) == NULL) + goto out; + + /* + * if we have only the node and symlinks to store, try not to waste + * tmpfs memory -- store values, if they fit, in a symlink target + */ util_strlcpy(target, &udev_device_get_devnode(udev_device)[devlen], sizeof(target)); udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) { size_t len; @@ -86,9 +96,11 @@ file: } info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); - fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) - fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + if (udev_device_get_devnode(udev_device) != NULL) { + fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) + fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + } if (udev_device_get_devlink_priority(udev_device) != 0) fprintf(f, "L:%u\n", udev_device_get_devlink_priority(udev_device)); if (udev_device_get_event_timeout(udev_device) >= 0) diff --git a/udev/udev-event.c b/udev/udev-event.c index bc692392d2..93a65e7352 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -611,6 +611,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) /* add netif */ if (strcmp(udev_device_get_subsystem(dev), "net") == 0 && strcmp(udev_device_get_action(dev), "add") == 0) { dbg(event->udev, "netif add '%s'\n", udev_device_get_devpath(dev)); + udev_device_delete_db(dev); udev_rules_apply_to_event(rules, event); if (event->ignore_device) { @@ -644,6 +645,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); } } + udev_device_update_db(dev); goto exit; } @@ -684,6 +686,11 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) udev_rules_apply_to_event(rules, event); if (event->ignore_device) info(event->udev, "device event will be ignored\n"); + + if (strcmp(udev_device_get_action(dev), "remove") != 0) + udev_device_update_db(dev); + else + udev_device_delete_db(dev); exit: return err; } -- cgit v1.2.3-54-g00ecf From 12dda308d9aed677a6cceb9d6a4c6b831987dcd6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Dec 2008 05:47:53 +0100 Subject: build: use autoreconf --symlink --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index f088a8f5d1..be3b6749b8 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,6 +1,6 @@ #!/bin/sh -e -autoreconf -i +autoreconf --install --symlink CFLAGS="-g -Wall \ -Wmissing-declarations -Wmissing-prototypes \ -- cgit v1.2.3-54-g00ecf From e6fa87a11f61548f5442ec3c76b44ce6b25184cc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Dec 2008 05:54:44 +0100 Subject: usb_id: add "image" class --- extras/usb_id/usb_id.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 492484da39..28352eb08a 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -54,22 +54,24 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len) case 1: type = "audio"; break; + case 2: /* CDC-Control */ + break; case 3: type = "hid"; break; + case 5: /* Physical */ + break; + case 6: + type = "image"; + break; case 7: type = "printer"; break; case 8: type = "storage"; break; - case 2: /* CDC-Control */ - break; - case 5: /* Physical */ - break; - case 6: /* Image */ - break; - case 9: /* HUB */ + case 9: + type = "hub"; break; case 0x0a: /* CDC-Data */ break; @@ -84,7 +86,7 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len) break; case 0xe0: /* Wireless Controller */ break; - case 0xf2: /* Application-specific */ + case 0xfe: /* Application-specific */ break; case 0xff: /* Vendor-specific */ break; -- cgit v1.2.3-54-g00ecf From 64be143742a487e826068e906d1bfb180acdb0ae Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Dec 2008 06:04:09 +0100 Subject: require non-SYSFS_DEPRECATED 2.6.20+ kernel --- README | 9 ++++----- udev/udevd.c | 7 ++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README b/README index a76583abab..0add462f31 100644 --- a/README +++ b/README @@ -9,13 +9,12 @@ Important Note: recommend to replace a distro's udev installation with the upstream version. Requirements: - - Version 2.6.19 of the Linux kernel for reliable operation of this release of - udev. The kernel may have a requirement on udev too, see Documentation/Changes - in the kernel source tree for the actual dependency. + - Version 2.6.20 of the Linux kernel for reliable operation of this release of + udev. The kernel must not use the CONFIG_SYSFS_DEPRECATED* option. - The kernel must have sysfs, unix domain sockets and networking enabled. - (unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, - but it does not make any sense - don't complain if anything goes wrong.) + Unix domain sockets (CONFIG_UNIX) as a loadable kernel module is not + supported. - The proc filesystem must be mounted on /proc/, the sysfs filesystem must be mounted at /sys/. No other locations are supported by udev. diff --git a/udev/udevd.c b/udev/udevd.c index bfd732319d..993964d23d 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -823,9 +823,10 @@ int main(int argc, char *argv[]) util_strlcat(path, "/class/mem/null", sizeof(path)); if (lstat(path, &statbuf) == 0) { if (S_ISDIR(statbuf.st_mode)) { - const char *depr_str = "<6>udev: deprecated sysfs layout (kernel too old, " - "or CONFIG_SYSFS_DEPRECATED) is unsupported, some " - "udev features may fail\n"; + const char *depr_str = + "<6>udev: deprecated sysfs layout; update the kernel or " + "disable CONFIG_SYSFS_DEPRECATED; some udev features will " + "not work correctly\n"; write(fd, depr_str, strlen(depr_str)); } -- cgit v1.2.3-54-g00ecf From 109d114578a785c33fae01af2bea4ea88dda3def Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Dec 2008 06:20:17 +0100 Subject: build: default to --prefix=/usr --exec-prefix="" --- configure.ac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index e9519a78f0..377a27e59e 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,10 @@ AC_DISABLE_STATIC AC_SYS_LARGEFILE AC_PROG_LIBTOOL +dnl /* prefix is /usr, exec_prefix in /, if overridden exec_prefix follows prefix */ +AC_PREFIX_DEFAULT([/usr]) +test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix= + dnl /* libudev version */ LIBUDEV_LT_CURRENT=0 LIBUDEV_LT_REVISION=6 -- cgit v1.2.3-54-g00ecf From f089350234e39b868a5e3df71a8f8c036aaae4fd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Dec 2008 07:42:19 +0100 Subject: libudev: enumerate - add lookup by property --- udev/lib/exported_symbols | 1 + udev/lib/libudev-enumerate.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev.h | 1 + udev/lib/test-libudev.c | 9 +++++++ 4 files changed, 73 insertions(+) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index abb6ae3a57..a2f0ca7cb3 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -42,6 +42,7 @@ udev_enumerate_add_match_subsystem udev_enumerate_add_nomatch_subsystem udev_enumerate_add_match_sysattr udev_enumerate_add_nomatch_sysattr +udev_enumerate_add_match_property udev_enumerate_scan_devices udev_enumerate_scan_subsystems udev_enumerate_add_syspath diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index 618ffbc3e9..abc89d5cab 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -39,6 +39,7 @@ struct udev_enumerate { struct udev_list_node sysattr_nomatch_list; struct udev_list_node subsystem_match_list; struct udev_list_node subsystem_nomatch_list; + struct udev_list_node properties_match_list; struct udev_list_node devices_list; int devices_sorted; }; @@ -63,6 +64,7 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) udev_list_init(&udev_enumerate->sysattr_nomatch_list); udev_list_init(&udev_enumerate->subsystem_match_list); udev_list_init(&udev_enumerate->subsystem_nomatch_list); + udev_list_init(&udev_enumerate->properties_match_list); return udev_enumerate; } @@ -86,6 +88,7 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_nomatch_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->properties_match_list); free(udev_enumerate); } @@ -178,6 +181,18 @@ exit: return match; } +int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (property == NULL) + return 0; + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->properties_match_list, property, value, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + static int match_sysattr(struct udev_enumerate *udev_enumerate, const char *syspath) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); @@ -204,6 +219,51 @@ static int match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysp return 1; } +static int match_property(struct udev_enumerate *udev_enumerate, const char *syspath) +{ + struct udev_device *dev; + struct udev_list_entry *list_entry; + int match = 0; + + /* no match always matches */ + if (udev_list_get_entry(&udev_enumerate->properties_match_list) == NULL) + return 1; + + /* no device does not match */ + dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (dev == NULL) + return 0; + + /* loop over matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) { + struct udev_list_entry *property_entry; + + /* loop over device properties */ + udev_list_entry_foreach(property_entry, udev_device_get_properties_list_entry(dev)) { + if (fnmatch(udev_list_entry_get_name(list_entry), udev_list_entry_get_name(property_entry), 0) == 0) { + const char *match_value; + const char *dev_value; + + match_value = udev_list_entry_get_value(list_entry); + dev_value = udev_list_entry_get_value(property_entry); + if (match_value == NULL && dev_value == NULL) { + match = 1; + goto out; + } + if (match_value == NULL || dev_value == NULL) + continue; + if (fnmatch(match_value, dev_value, 0) == 0) { + match = 1; + goto out; + } + } + } + } +out: + udev_device_unref(dev); + return match; +} + static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir1, const char *subdir2) { @@ -248,6 +308,8 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, continue; if (!match_sysattr(udev_enumerate, syspath)) continue; + if (!match_property(udev_enumerate, syspath)) + continue; udev_list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); } closedir(dir); diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 64746ad7c8..a9e399c4b4 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -101,6 +101,7 @@ extern int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumer extern int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); extern int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); extern int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); +extern int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); extern int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); extern int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); extern int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 4c3bc16aed..5120626520 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -359,6 +359,15 @@ static int test_enumerate(struct udev *udev, const char *subsystem) udev_enumerate_scan_subsystems(udev_enumerate); test_enumerate_print_list(udev_enumerate); udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'property IF_FS_*=filesystem'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_property(udev_enumerate, "ID_FS*", "filesystem"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); return 0; } -- cgit v1.2.3-54-g00ecf From 01acecef8f763907e5535b074e32ce836b236fca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 2 Jan 2009 03:26:44 +0100 Subject: rules: input - make sure needed variables are set --- rules/rules.d/60-persistent-input.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index 9405b73011..7a4b23c630 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -26,8 +26,8 @@ KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/ # by-path IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" -ENV{ID_PATH}=="?*", KERNEL=="event*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" LABEL="persistent_input_end" -- cgit v1.2.3-54-g00ecf From bf8b2ae177fd016d03349b3aa881b72afd7d037d Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 2 Jan 2009 04:14:47 +0100 Subject: libudev: device - add devtype support --- udev/lib/exported_symbols | 2 ++ udev/lib/libudev-device.c | 53 +++++++++++++++++++++++++++++++++++++++++++++- udev/lib/libudev-monitor.c | 2 ++ udev/lib/libudev-private.h | 1 + udev/lib/libudev.h | 2 ++ udev/lib/test-libudev.c | 4 ++++ 6 files changed, 63 insertions(+), 1 deletion(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index a2f0ca7cb3..6b07842a81 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -17,6 +17,7 @@ udev_device_new_from_devnum udev_device_new_from_subsystem_sysname udev_device_get_parent udev_device_get_parent_with_subsystem +udev_device_get_parent_with_devtype udev_device_ref udev_device_unref udev_device_get_udev @@ -26,6 +27,7 @@ udev_device_get_devnode udev_device_get_sysname udev_device_get_sysnum udev_device_get_subsystem +udev_device_get_devtype udev_device_get_devlinks_list_entry udev_device_get_properties_list_entry udev_device_get_action diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 055263bbef..06227be328 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -40,6 +40,7 @@ struct udev_device { const char *sysnum; char *devnode; char *subsystem; + char *devtype; char *driver; char *action; char *devpath_old; @@ -59,6 +60,7 @@ struct udev_device { dev_t devnum; unsigned int parent_set:1; unsigned int subsystem_set:1; + unsigned int devtype_set:1; unsigned int devlinks_uptodate:1; unsigned int envp_uptodate:1; unsigned int driver_set:1; @@ -204,7 +206,9 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) continue; pos[0] = '\0'; - if (strncmp(line, "MAJOR=", 6) == 0) + if (strncmp(line, "DEVTYPE=", 8) == 0) + udev_device_set_devtype(udev_device, &line[8]); + else if (strncmp(line, "MAJOR=", 6) == 0) maj = strtoull(&line[6], NULL, 10); else if (strncmp(line, "MINOR=", 6) == 0) min = strtoull(&line[6], NULL, 10); @@ -553,6 +557,22 @@ struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *ud return parent; } +struct udev_device *udev_device_get_parent_with_devtype(struct udev_device *udev_device, const char *devtype) +{ + struct udev_device *parent; + + parent = udev_device_get_parent(udev_device); + while (parent != NULL) { + const char *parent_devtype; + + parent_devtype = udev_device_get_devtype(parent); + if (parent_devtype != NULL && strcmp(parent_devtype, devtype) == 0) + break; + parent = udev_device_get_parent(parent); + } + return parent; +} + /** * udev_device_get_udev: * @udev_device: udev device @@ -605,6 +625,7 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->sysname); free(udev_device->devnode); free(udev_device->subsystem); + free(udev_device->devtype); udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); udev_list_cleanup_entries(udev_device->udev, &udev_device->properties_list); free(udev_device->action); @@ -723,6 +744,25 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) return udev_device->subsystem; } +/** + * udev_device_get_devtype: + * @udev_device: udev device + * + * Retrieve the devtype string of the udev device. + * + * Returns: the devtype name of the udev device, or #NULL if it can not be determined + **/ +const char *udev_device_get_devtype(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->devtype_set) { + udev_device->devtype_set = 1; + udev_device_read_uevent_file(udev_device); + } + return udev_device->devtype; +} + /** * udev_device_get_devlinks_list_entry: * @udev_device: udev device @@ -963,6 +1003,17 @@ int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsy return 0; } +int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) +{ + free(udev_device->devtype); + udev_device->devtype = strdup(devtype); + if (udev_device->devtype == NULL) + return -ENOMEM; + udev_device->devtype_set = 1; + udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); + return 0; +} + int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) { free(udev_device->devnode); diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 502fe24ce1..e4cb80769c 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -325,6 +325,8 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { udev_device_set_subsystem(udev_device, &key[10]); subsystem_set = 1; + } else if (strncmp(key, "DEVTYPE=", 8) == 0) { + udev_device_set_devtype(udev_device, &key[8]); } else if (strncmp(key, "DEVNAME=", 8) == 0) { udev_device_set_devnode(udev_device, &key[8]); } else if (strncmp(key, "DEVLINKS=", 9) == 0) { diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 5e09188f08..0d752bb1e5 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -56,6 +56,7 @@ extern struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) /* libudev-device */ extern int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); extern int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); +extern int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype); extern int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); extern int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink); extern void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index a9e399c4b4..b96e49429b 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -63,11 +63,13 @@ extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char t extern struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); extern struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem); +extern struct udev_device *udev_device_get_parent_with_devtype(struct udev_device *udev_device, const char *devtype); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); extern struct udev *udev_device_get_udev(struct udev_device *udev_device); extern const char *udev_device_get_devpath(struct udev_device *udev_device); extern const char *udev_device_get_subsystem(struct udev_device *udev_device); +extern const char *udev_device_get_devtype(struct udev_device *udev_device); extern const char *udev_device_get_syspath(struct udev_device *udev_device); extern const char *udev_device_get_sysname(struct udev_device *udev_device); extern const char *udev_device_get_sysnum(struct udev_device *udev_device); diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index 5120626520..fd12bd9344 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -67,6 +67,10 @@ static void print_device(struct udev_device *device) if (str != NULL) printf("subsystem: '%s'\n", str); + str = udev_device_get_devtype(device); + if (str != NULL) + printf("devtype: '%s'\n", str); + str = udev_device_get_driver(device); if (str != NULL) printf("driver: '%s'\n", str); -- cgit v1.2.3-54-g00ecf From db71b500b2fe1fc74c4d9b60082cb142283b6eda Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Fri, 2 Jan 2009 14:07:54 +0100 Subject: man: udev - update NAME assignment --- udev/udev.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index ccc1f45e4c..f11a56cc04 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -290,8 +290,7 @@ The name of the node to be created, or the name the network interface - should be renamed to. Only one rule can set the node name, all later rules with - a NAME key will be ignored. + should be renamed to. -- cgit v1.2.3-54-g00ecf From b92511747af31bcfc880b33505c61ef6c96c6dac Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Jan 2009 04:55:15 +0100 Subject: libudev: device - read "uevent" only if info is not already loaded --- udev/lib/libudev-device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 06227be328..a25716d95d 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -758,7 +758,8 @@ const char *udev_device_get_devtype(struct udev_device *udev_device) return NULL; if (!udev_device->devtype_set) { udev_device->devtype_set = 1; - udev_device_read_uevent_file(udev_device); + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); } return udev_device->devtype; } -- cgit v1.2.3-54-g00ecf From 883012d49b0635ab20898a649fcce6db21288571 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 3 Jan 2009 11:10:10 +0100 Subject: libudev: device - lookup subsystem and devtype together --- udev/lib/exported_symbols | 2 +- udev/lib/libudev-device.c | 17 +++++++++++++---- udev/lib/libudev.h | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 6b07842a81..88d5c48c10 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -17,7 +17,7 @@ udev_device_new_from_devnum udev_device_new_from_subsystem_sysname udev_device_get_parent udev_device_get_parent_with_subsystem -udev_device_get_parent_with_devtype +udev_device_get_parent_with_subsystem_devtype udev_device_ref udev_device_unref udev_device_get_udev diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index a25716d95d..7c803594e4 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -557,17 +557,26 @@ struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *ud return parent; } -struct udev_device *udev_device_get_parent_with_devtype(struct udev_device *udev_device, const char *devtype) +struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) { struct udev_device *parent; + if (subsystem == NULL) + return NULL; + parent = udev_device_get_parent(udev_device); while (parent != NULL) { + const char *parent_subsystem; const char *parent_devtype; - parent_devtype = udev_device_get_devtype(parent); - if (parent_devtype != NULL && strcmp(parent_devtype, devtype) == 0) - break; + parent_subsystem = udev_device_get_subsystem(parent); + if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) { + if (devtype == NULL) + break; + parent_devtype = udev_device_get_devtype(parent); + if (parent_devtype != NULL && strcmp(parent_devtype, devtype) == 0) + break; + } parent = udev_device_get_parent(parent); } return parent; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index b96e49429b..bac362a360 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -63,7 +63,7 @@ extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char t extern struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); extern struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem); -extern struct udev_device *udev_device_get_parent_with_devtype(struct udev_device *udev_device, const char *devtype); +extern struct udev_device *udev_device_get_parent_with_subsytem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); extern struct udev *udev_device_get_udev(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From 61ee8cc92d5298da4fd4f46016991369a933ef7f Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 3 Jan 2009 11:13:51 +0100 Subject: libudev: device - remove udev_device_get_parent_with_subsystem --- extras/usb_id/usb_id.c | 6 +++--- udev/lib/exported_symbols | 1 - udev/lib/libudev-device.c | 16 ---------------- udev/lib/libudev.h | 1 - 4 files changed, 3 insertions(+), 21 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 28352eb08a..9ee4e6ece3 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -192,7 +192,7 @@ static int usb_id(struct udev_device *dev) dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); /* usb interface directory */ - dev_interface = udev_device_get_parent_with_subsystem(dev, "usb"); + dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", NULL); if (dev_interface == NULL) { info(udev, "unable to access usb_interface device of '%s'\n", udev_device_get_syspath(dev)); @@ -218,7 +218,7 @@ static int usb_id(struct udev_device *dev) udev_device_get_syspath(dev_interface), if_class_num, protocol); /* usb device directory */ - dev_usb = udev_device_get_parent_with_subsystem(dev_interface, "usb"); + dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", NULL); if (!dev_usb) { info(udev, "unable to find parent 'usb' device of '%s'\n", udev_device_get_syspath(dev)); @@ -232,7 +232,7 @@ static int usb_id(struct udev_device *dev) int host, bus, target, lun; /* get scsi device */ - dev_scsi = udev_device_get_parent_with_subsystem(dev, "scsi"); + dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", NULL); if (dev_scsi == NULL) { info(udev, "unable to find parent 'scsi' device of '%s'\n", udev_device_get_syspath(dev)); diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 88d5c48c10..abf5051791 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -16,7 +16,6 @@ udev_device_new_from_syspath udev_device_new_from_devnum udev_device_new_from_subsystem_sysname udev_device_get_parent -udev_device_get_parent_with_subsystem udev_device_get_parent_with_subsystem_devtype udev_device_ref udev_device_unref diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 7c803594e4..0cb5921281 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -541,22 +541,6 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) return udev_device->parent_device; } -struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem) -{ - struct udev_device *parent; - - parent = udev_device_get_parent(udev_device); - while (parent != NULL) { - const char *parent_subsystem; - - parent_subsystem = udev_device_get_subsystem(parent); - if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) - break; - parent = udev_device_get_parent(parent); - } - return parent; -} - struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) { struct udev_device *parent; diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index bac362a360..63b9b79d3f 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -62,7 +62,6 @@ extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); extern struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); -extern struct udev_device *udev_device_get_parent_with_subsystem(struct udev_device *udev_device, const char *subsystem); extern struct udev_device *udev_device_get_parent_with_subsytem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From 58d882a6d7f1374e97cf96e140b4fbede7f8e714 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Jan 2009 15:24:59 +0100 Subject: libudev: subsytem -> subsystem --- udev/lib/libudev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 63b9b79d3f..6d6618a9ec 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -62,7 +62,7 @@ extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); extern struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device); -extern struct udev_device *udev_device_get_parent_with_subsytem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype); +extern struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype); extern struct udev_device *udev_device_ref(struct udev_device *udev_device); extern void udev_device_unref(struct udev_device *udev_device); extern struct udev *udev_device_get_udev(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From ada4df151f4d5d67083d1dfe174b9425489ff4ed Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Jan 2009 15:26:08 +0100 Subject: libudev: bump revision --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 377a27e59e..849939c78e 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix= dnl /* libudev version */ LIBUDEV_LT_CURRENT=0 -LIBUDEV_LT_REVISION=6 +LIBUDEV_LT_REVISION=7 LIBUDEV_LT_AGE=0 AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) -- cgit v1.2.3-54-g00ecf From 4fad506ed8c963d20ae3f78c7d34fd4fd80272f9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Jan 2009 15:26:34 +0100 Subject: usb_id: use devtype lookup --- extras/usb_id/usb_id.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 9ee4e6ece3..f069f3a1ac 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -192,7 +192,7 @@ static int usb_id(struct udev_device *dev) dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); /* usb interface directory */ - dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", NULL); + dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface"); if (dev_interface == NULL) { info(udev, "unable to access usb_interface device of '%s'\n", udev_device_get_syspath(dev)); @@ -218,7 +218,7 @@ static int usb_id(struct udev_device *dev) udev_device_get_syspath(dev_interface), if_class_num, protocol); /* usb device directory */ - dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", NULL); + dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", "usb_device"); if (!dev_usb) { info(udev, "unable to find parent 'usb' device of '%s'\n", udev_device_get_syspath(dev)); @@ -232,7 +232,7 @@ static int usb_id(struct udev_device *dev) int host, bus, target, lun; /* get scsi device */ - dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", NULL); + dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); if (dev_scsi == NULL) { info(udev, "unable to find parent 'scsi' device of '%s'\n", udev_device_get_syspath(dev)); -- cgit v1.2.3-54-g00ecf From 19f8fd9088f02c672f42cf1005c43cb5aac18e93 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Jan 2009 15:35:41 +0100 Subject: require 2.6.22+ kernel --- NEWS | 7 +++++++ README | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c59d93c55d..76aec06472 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ udev 136 ======== Bugfixes. +For some more advanced features Linux 2.6.22 is the oldest supported +version now. The kernel config with enabled SYSFS_DEPRECATED +is no longer supported. Older kernels should still work, and devices +nodes should be reliably created, but some rules and libudev will +not work correctly because the old kernels do not provide the expected +information or interfaces. + /dev/serial/by-{id,path}/ now contains links for ttyUSB devices, which do not depend on the kernel device name. As usual, unique devices - only a single one per product connected, or a real diff --git a/README b/README index 0add462f31..a253ccfb4f 100644 --- a/README +++ b/README @@ -9,7 +9,7 @@ Important Note: recommend to replace a distro's udev installation with the upstream version. Requirements: - - Version 2.6.20 of the Linux kernel for reliable operation of this release of + - Version 2.6.22 of the Linux kernel for reliable operation of this release of udev. The kernel must not use the CONFIG_SYSFS_DEPRECATED* option. - The kernel must have sysfs, unix domain sockets and networking enabled. -- cgit v1.2.3-54-g00ecf From cc02d72c82d4ebc2c0803bae0c94707e9d1eea83 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Jan 2009 15:50:17 +0100 Subject: rules: Ubuntu merge - use group "cdrom" --- rules/rules.d/50-udev-default.rules | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 0eb401cda2..d6533d6bc7 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -40,8 +40,7 @@ KERNEL=="nvidia*|nvidiactl*", GROUP="video" SUBSYSTEM=="graphics", GROUP="video" # DVB video -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c" -SUBSYSTEM=="dvb", GROUP="video" +SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" # Firewire KERNEL=="dv1394[0-9]*", NAME="dv1394/%n", GROUP="video" @@ -59,21 +58,23 @@ KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" # block, tapes, block-releated -SUBSYSTEM=="block", GROUP="disk" -SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n" -KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" +SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" +SUBSYSTEM=="block", KERNEL=="hd[0-9]*", SUBSYSTEMS=="ide", ATTRS{media}=="cdrom", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k", GROUP="cdrom" +KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom" KERNEL=="fd[0-9]", GROUP="floppy" KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" +SUBSYSTEM=="block", GROUP="disk" +KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" KERNEL=="sch[0-9]*", GROUP="disk" -KERNEL=="sg[0-9]*", ATTRS{type}!="3|6", GROUP="disk", MODE="0640" +KERNEL=="sg[0-9]*", ATTRS{type}=="0|1|8", GROUP="disk" +KERNEL=="sg[0-9]*", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" KERNEL=="rawctl", NAME="raw/rawctl", GROUP="disk" SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" -KERNEL=="pktcdvd", NAME="pktcdvd/control" SUBSYSTEM=="bsg", NAME="bsg/%k" SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk", MODE="0220" SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" -- cgit v1.2.3-54-g00ecf From 8553cf06b93739c859534a85cc7ef1bdd8e33a5c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Jan 2009 16:25:15 +0100 Subject: rules: Ubuntu merge - use group "tape" --- NEWS | 6 ++++++ README | 4 ++++ rules/rules.d/50-udev-default.rules | 21 ++++++++++++++------- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 76aec06472..90a68d3652 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,12 @@ nodes should be reliably created, but some rules and libudev will not work correctly because the old kernels do not provide the expected information or interfaces. +We are currently merging the Ubuntu rules in the udev default rules, and +get one step closer to provide a common Linux /dev setup regarding device +names, symlinks, and default device permissions. On udev startup, we now +expect the following groups to be resolvable to their ids by glibc's +getgrnam(): "disk cdrom floppy tape audio video lp tty kmem". + /dev/serial/by-{id,path}/ now contains links for ttyUSB devices, which do not depend on the kernel device name. As usual, unique devices - only a single one per product connected, or a real diff --git a/README b/README index a253ccfb4f..ecb520b2fd 100644 --- a/README +++ b/README @@ -19,6 +19,10 @@ Requirements: - The proc filesystem must be mounted on /proc/, the sysfs filesystem must be mounted at /sys/. No other locations are supported by udev. + - The system must have the following group names resolvable at udev startup: + disk cdrom floppy tape audio video lp tty kmem + Especially in LDAP setups, it is required, that getgrnam() is able to resolve + these group names while no network is available. Operation: Udev creates and removes device nodes in /dev/, based on events the kernel diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index d6533d6bc7..b2b2ee949f 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -57,21 +57,28 @@ SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" -# block, tapes, block-releated +# floppy +KERNEL=="fd[0-9]", GROUP="floppy" +KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" + +# cdrom SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" SUBSYSTEM=="block", KERNEL=="hd[0-9]*", SUBSYSTEMS=="ide", ATTRS{media}=="cdrom", GROUP="cdrom" +SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k", GROUP="cdrom" KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom" -KERNEL=="fd[0-9]", GROUP="floppy" -KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" + +# tape +KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="tape" +KERNEL=="pt[0-9]*|npt[0-9]*|pht[0-9]*", GROUP="tape" +SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape" + +# block, block-releated SUBSYSTEM=="block", GROUP="disk" KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" KERNEL=="sch[0-9]*", GROUP="disk" -KERNEL=="sg[0-9]*", ATTRS{type}=="0|1|8", GROUP="disk" -KERNEL=="sg[0-9]*", ATTRS{type}=="4|5", GROUP="cdrom" -KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="disk" +SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" -KERNEL=="pt[0-9]*|npt[0-9]*", GROUP="disk" KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" KERNEL=="rawctl", NAME="raw/rawctl", GROUP="disk" SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -- cgit v1.2.3-54-g00ecf From e1cc6b6a81f9ed64e29eea5ccbe79616a220ee9f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 3 Jan 2009 22:30:05 +0100 Subject: rules: replace DVB shell script rule --- TODO | 5 ++--- rules/rules.d/50-udev-default.rules | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 8cb24b807c..dc5d9879cf 100644 --- a/TODO +++ b/TODO @@ -4,9 +4,8 @@ dmsetup info -c --nameprefixes --unquoted --rows --noheadings \ -o name,uuid,suspended,readonly,major,minor,open,tables_loaded o implement path_id with libudev - o convert firmware.sh to C - o add DVB variables to kernel (patch merged in v4l tree), drop the - shell script rule + o convert firmware.sh to C (?) + o drop the DVB shell script rule (2.6.29+) o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names o get distros to agree on a default set of rules diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index b2b2ee949f..38e1aa6b15 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -39,8 +39,9 @@ KERNEL=="pmu", GROUP="video" KERNEL=="nvidia*|nvidiactl*", GROUP="video" SUBSYSTEM=="graphics", GROUP="video" -# DVB video -SUBSYSTEM=="dvb", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" +# DVB (video) +SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}", GROUP="video" +SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" # Firewire KERNEL=="dv1394[0-9]*", NAME="dv1394/%n", GROUP="video" -- cgit v1.2.3-54-g00ecf From 1aa8fdf779219d953633323b4206acadc8b8e37b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 4 Jan 2009 17:01:47 +0100 Subject: rules: Ubuntu merge - s/uucp/dialout/ --- NEWS | 11 ++++++----- README | 2 +- rules/packages/40-isdn.rules | 2 +- rules/packages/40-ppc.rules | 2 +- rules/rules.d/50-udev-default.rules | 6 +++--- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 90a68d3652..1a1d5fb71e 100644 --- a/NEWS +++ b/NEWS @@ -9,11 +9,12 @@ nodes should be reliably created, but some rules and libudev will not work correctly because the old kernels do not provide the expected information or interfaces. -We are currently merging the Ubuntu rules in the udev default rules, and -get one step closer to provide a common Linux /dev setup regarding device -names, symlinks, and default device permissions. On udev startup, we now -expect the following groups to be resolvable to their ids by glibc's -getgrnam(): "disk cdrom floppy tape audio video lp tty kmem". +We are currently merging the Ubuntu rules in the udev default rules, +and get one step closer to provide a common Linux /dev setup regarding +device names, symlinks, and default device permissions. On udev startup, +we now expect the following groups to be resolvable to their ids by +glibc's getgrnam(): + disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, kmem. /dev/serial/by-{id,path}/ now contains links for ttyUSB devices, which do not depend on the kernel device name. As usual, unique diff --git a/README b/README index ecb520b2fd..cd3628736f 100644 --- a/README +++ b/README @@ -20,7 +20,7 @@ Requirements: be mounted at /sys/. No other locations are supported by udev. - The system must have the following group names resolvable at udev startup: - disk cdrom floppy tape audio video lp tty kmem + disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, kmem Especially in LDAP setups, it is required, that getgrnam() is able to resolve these group names while no network is available. diff --git a/rules/packages/40-isdn.rules b/rules/packages/40-isdn.rules index 22d9fe691b..1a31cb6c98 100644 --- a/rules/packages/40-isdn.rules +++ b/rules/packages/40-isdn.rules @@ -1,4 +1,4 @@ # do not edit this file, it will be overwritten on update -SUBSYSTEM=="capi", KERNEL=="capi", NAME="capi20", GROUP="uucp" +SUBSYSTEM=="capi", KERNEL=="capi", NAME="capi20", GROUP="dialout" SUBSYSTEM=="tty", KERNEL=="capi[0-9]*", NAME="capi/%n" diff --git a/rules/packages/40-ppc.rules b/rules/packages/40-ppc.rules index 8b62d79e0c..47ecdd0027 100644 --- a/rules/packages/40-ppc.rules +++ b/rules/packages/40-ppc.rules @@ -3,4 +3,4 @@ KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vtty*", GROUP="uucp" +KERNEL=="iseries/vtty*", GROUP="dialout" diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 38e1aa6b15..120c58152d 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -12,10 +12,10 @@ KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty" KERNEL=="console", MODE="0600" # serial -KERNEL=="tty[A-Z]*|pppox*|ircomm*|noz*", GROUP="uucp" +KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*", GROUP="dialout" KERNEL=="ppp", MODE="0600" -KERNEL=="mwave", NAME="modems/mwave", GROUP="uucp" -KERNEL=="hvc*|hvsi*", GROUP="uucp" +KERNEL=="mwave", NAME="modems/mwave", GROUP="dialout" +KERNEL=="hvc*|hvsi*", GROUP="dialout" # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" -- cgit v1.2.3-54-g00ecf From 67c89548d112e3d00ccdbad399720458b8289117 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 4 Jan 2009 17:38:33 +0100 Subject: update NEWS --- NEWS | 34 +++++++++++++++++++++++++--------- README | 5 +++-- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 1a1d5fb71e..0e5395b3b4 100644 --- a/NEWS +++ b/NEWS @@ -2,19 +2,29 @@ udev 136 ======== Bugfixes. -For some more advanced features Linux 2.6.22 is the oldest supported -version now. The kernel config with enabled SYSFS_DEPRECATED -is no longer supported. Older kernels should still work, and devices -nodes should be reliably created, but some rules and libudev will -not work correctly because the old kernels do not provide the expected -information or interfaces. - We are currently merging the Ubuntu rules in the udev default rules, -and get one step closer to provide a common Linux /dev setup regarding +and get one step closer to provide a common Linux /dev setup, regarding device names, symlinks, and default device permissions. On udev startup, -we now expect the following groups to be resolvable to their ids by +we now expect the following groups to be resolvable to their ids with glibc's getgrnam(): disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, kmem. +LDAP setups need to make sure, that these groups are always resolvable at +bootup, with only the rootfs mounted, and without network access available. + +Some systems may need to add some new, currently not used groups, or need +to add some users to new groups, but the cost of this change is minimal, +compared to the pain the current, rather random, differences between the +various distributions cause for upstream projects and third-party vendors. + +In general, "normal" users who log into a machine should never be a member +of any such group, but the device-access should be managed by dynamic ACLs, +which get added and removed for the specific users on login/logout and +session activity/inactivity. These groups are only provided for custom setups, +and mainly system services, to allow proper privilege separation. +A video-streaming daemon uid would be a member of "audio" and "video", to get +access to the sound and video devices, but no "normal" user ever belongs in +the "audio" group, because he could listen to the built-in microphone with +any ssh-session established from the other side of the world. /dev/serial/by-{id,path}/ now contains links for ttyUSB devices, which do not depend on the kernel device name. As usual, unique @@ -26,6 +36,12 @@ and can only be found reliably in the by-path/ directory. Devices specified by by-path/ must not change their connection, like the USB port number they are plugged in, to keep their name. +To support some advanced features, Linux 2.6.22 is the oldest supported +version now. The kernel config with enabled SYSFS_DEPRECATED is no longer +supported. Older kernels should still work, and devices nodes should be +reliably created, but some rules and libudev will not work correctly because +the old kernels do not provide the expected information or interfaces. + udev 135 ======== Bugfixes. diff --git a/README b/README index cd3628736f..773bc5508d 100644 --- a/README +++ b/README @@ -20,9 +20,10 @@ Requirements: be mounted at /sys/. No other locations are supported by udev. - The system must have the following group names resolvable at udev startup: - disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, kmem + disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, kmem. Especially in LDAP setups, it is required, that getgrnam() is able to resolve - these group names while no network is available. + these group names with only the rootfs mounted, and while no network is + available. Operation: Udev creates and removes device nodes in /dev/, based on events the kernel -- cgit v1.2.3-54-g00ecf From 31a733070e2d324fbad4b3163b419626ef506cc6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 5 Jan 2009 02:55:16 +0100 Subject: update NEWS --- NEWS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 0e5395b3b4..d03de2f230 100644 --- a/NEWS +++ b/NEWS @@ -22,8 +22,8 @@ which get added and removed for the specific users on login/logout and session activity/inactivity. These groups are only provided for custom setups, and mainly system services, to allow proper privilege separation. A video-streaming daemon uid would be a member of "audio" and "video", to get -access to the sound and video devices, but no "normal" user ever belongs in -the "audio" group, because he could listen to the built-in microphone with +access to the sound and video devices, but no "normal" user should ever belong +to the "audio" group, because he could listen to the built-in microphone with any ssh-session established from the other side of the world. /dev/serial/by-{id,path}/ now contains links for ttyUSB devices, -- cgit v1.2.3-54-g00ecf From 0c057e9c75f8acad2cd89b8ad8b9ec09f2c615af Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 5 Jan 2009 02:55:37 +0100 Subject: enable skipping of "naming-only" rules --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index afd2e884e9..9861a88a52 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2019,7 +2019,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rule = cur; /* possibly skip rules which want to set NAME, SYMLINK, OWNER, GROUP, MODE */ if (!can_set_name && rule->rule.flags) - ;//goto nomatch; + goto nomatch; esc = ESCAPE_UNSET; break; case TK_M_ACTION: -- cgit v1.2.3-54-g00ecf From 9bd66b9dbf5387a9b68c64742daefd07198d2193 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 5 Jan 2009 03:44:28 +0100 Subject: usb_id: s/image/media/ --- extras/usb_id/usb_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index f069f3a1ac..ac5e0edc1a 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -62,7 +62,7 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len) case 5: /* Physical */ break; case 6: - type = "image"; + type = "media"; break; case 7: type = "printer"; -- cgit v1.2.3-54-g00ecf From b620292bd2b55d2e8758108a59447f0a512cfea3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 5 Jan 2009 12:28:09 +0100 Subject: udevadm: s/udevinfo/udevadm info/ --- udev/udevadm-info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 745b4fdb7b..6fe1f86313 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -87,7 +87,7 @@ static int print_device_chain(struct udev_device *device) const char *str; printf("\n" - "Udevinfo starts with the device specified by the devpath and then\n" + "Udevadm info starts with the device specified by the devpath and then\n" "walks up the chain of parent devices. It prints for every device\n" "found, all possible attributes in the udev rules key format.\n" "A rule to match, can be composed by the attributes of the device\n" -- cgit v1.2.3-54-g00ecf From b6c8f986ecc7073a67ec8d3c174ccff0a31f8e11 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 5 Jan 2009 12:34:55 +0100 Subject: rules: reorder block rules --- rules/rules.d/50-udev-default.rules | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 120c58152d..119941be1d 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -58,33 +58,35 @@ SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" +# block +SUBSYSTEM=="block", GROUP="disk" + # floppy -KERNEL=="fd[0-9]", GROUP="floppy" +KERNEL=="fd[0-9]", GROUP="floppy" KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" +KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" # cdrom SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" SUBSYSTEM=="block", KERNEL=="hd[0-9]*", SUBSYSTEMS=="ide", ATTRS{media}=="cdrom", GROUP="cdrom" SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k", GROUP="cdrom" -KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k", GROUP="cdrom" +KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom" # tape KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="tape" KERNEL=="pt[0-9]*|npt[0-9]*|pht[0-9]*", GROUP="tape" SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape" -# block, block-releated -SUBSYSTEM=="block", GROUP="disk" -KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" -KERNEL=="sch[0-9]*", GROUP="disk" +# block-releated +KERNEL=="sch[0-9]*", GROUP="disk" SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk" -KERNEL=="pg[0-9]*", GROUP="disk" +KERNEL=="pg[0-9]*", GROUP="disk" KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" KERNEL=="rawctl", NAME="raw/rawctl", GROUP="disk" SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -SUBSYSTEM=="bsg", NAME="bsg/%k" -SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk", MODE="0220" +SUBSYSTEM=="bsg", NAME="bsg/%k" +SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk", MODE="0220" SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" # network -- cgit v1.2.3-54-g00ecf From 34ac42b98d75c401520b9f69ff29b6832b6ab668 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 5 Jan 2009 17:51:22 +0100 Subject: rules: zaptel - add "dialout" group --- rules/packages/40-zaptel.rules | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/rules/packages/40-zaptel.rules b/rules/packages/40-zaptel.rules index 4313a9172e..cbd8b8abe0 100644 --- a/rules/packages/40-zaptel.rules +++ b/rules/packages/40-zaptel.rules @@ -1,8 +1,7 @@ # do not edit this file, it will be overwritten on update -KERNEL=="zap[0-9]*", NAME="zap/%n" -KERNEL=="zapchannel", NAME="zap/channel" -KERNEL=="zapctl", NAME="zap/ctl" -KERNEL=="zappseudo", NAME="zap/pseudo" -KERNEL=="zaptimer", NAME="zap/timer" - +KERNEL=="zap[0-9]*", NAME="zap/%n", GROUP="dialout" +KERNEL=="zapchannel", NAME="zap/channel", GROUP="dialout" +KERNEL=="zapctl", NAME="zap/ctl", GROUP="dialout" +KERNEL=="zappseudo", NAME="zap/pseudo", GROUP="dialout" +KERNEL=="zaptimer", NAME="zap/timer", GROUP="dialout" -- cgit v1.2.3-54-g00ecf From 3d7b2831cd661afd7d946791110b6ad5a7156d7f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 6 Jan 2009 00:26:28 +0100 Subject: libudev: device - add udev_device_get_property_value() --- udev/lib/exported_symbols | 1 + udev/lib/libudev-device.c | 14 ++++++++++++++ udev/lib/libudev.h | 1 + udev/udev-event.c | 7 +------ udev/udev-rules.c | 5 +---- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index abf5051791..86ab1059fe 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -29,6 +29,7 @@ udev_device_get_subsystem udev_device_get_devtype udev_device_get_devlinks_list_entry udev_device_get_properties_list_entry +udev_device_get_properties_value udev_device_get_action udev_device_get_driver udev_device_get_devnum diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 0cb5921281..a7722b3f6e 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -1059,6 +1059,20 @@ struct udev_list_entry *udev_device_add_property_from_string(struct udev_device return udev_device_add_property(udev_device, name, val); } +const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) +{ + struct udev_list_entry *list_entry; + + if (udev_device == NULL) + return NULL; + if (key == NULL) + return NULL; + + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + return udev_list_entry_get_value(list_entry); +} + #define ENVP_SIZE 128 #define MONITOR_BUF_SIZE 4096 static int update_envp_monitor_buf(struct udev_device *udev_device) diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 6d6618a9ec..58d7ef98c4 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -75,6 +75,7 @@ extern const char *udev_device_get_sysnum(struct udev_device *udev_device); extern const char *udev_device_get_devnode(struct udev_device *udev_device); extern struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); extern struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); +extern const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key); extern const char *udev_device_get_driver(struct udev_device *udev_device); extern dev_t udev_device_get_devnum(struct udev_device *udev_device); extern const char *udev_device_get_action(struct udev_device *udev_device); diff --git a/udev/udev-event.c b/udev/udev-event.c index 93a65e7352..9e82f8de42 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -421,14 +421,9 @@ found: dbg(event->udev, "missing attribute\n"); break; } else { - struct udev_list_entry *list_entry; const char *value; - list_entry = udev_device_get_properties_list_entry(event->dev); - list_entry = udev_list_entry_get_by_name(list_entry, attr); - if (list_entry == NULL) - break; - value = udev_list_entry_get_value(list_entry); + value = udev_device_get_property_value(event->dev, attr); if (value == NULL) break; dbg(event->udev, "substitute env '%s=%s'\n", attr, value); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 9861a88a52..7ba52208fb 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2059,13 +2059,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; case TK_M_ENV: { - struct udev_list_entry *list_entry; const char *key_name = &rules->buf[cur->key.attr_off]; const char *value; - list_entry = udev_device_get_properties_list_entry(event->dev); - list_entry = udev_list_entry_get_by_name(list_entry, key_name); - value = udev_list_entry_get_value(list_entry); + value = udev_device_get_property_value(event->dev, key_name); if (value == NULL) { dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); value = ""; -- cgit v1.2.3-54-g00ecf From 56c141eceb34041aa68bb9695c23eda165f47726 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 6 Jan 2009 16:52:40 +0100 Subject: libudev: test - add udev_device_get_property_value() --- udev/lib/exported_symbols | 2 +- udev/lib/test-libudev.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 86ab1059fe..27314e4a26 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -29,7 +29,7 @@ udev_device_get_subsystem udev_device_get_devtype udev_device_get_devlinks_list_entry udev_device_get_properties_list_entry -udev_device_get_properties_value +udev_device_get_property_value udev_device_get_action udev_device_get_driver udev_device_get_devnum diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c index fd12bd9344..592a147e01 100644 --- a/udev/lib/test-libudev.c +++ b/udev/lib/test-libudev.c @@ -101,6 +101,10 @@ static void print_device(struct udev_device *device) if (count > 0) printf("found %i properties\n", count); + str = udev_device_get_property_value(device, "MAJOR"); + if (str != NULL) + printf("MAJOR: '%s'\n", str); + str = udev_device_get_sysattr_value(device, "dev"); if (str != NULL) printf("attr{dev}: '%s'\n", str); -- cgit v1.2.3-54-g00ecf From fdcd1f4666a4cceb0de7935a72567f30f1905c08 Mon Sep 17 00:00:00 2001 From: Adam Buchbinder Date: Tue, 6 Jan 2009 19:43:01 +0100 Subject: extras: fix mis-spelling of "environment" --- extras/ata_id/ata_id.c | 2 +- extras/usb_id/usb_id.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index dae464a4dc..6f2e28baa3 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) break; case 'h': printf("Usage: ata_id [--export] [--help] \n" - " --export print values as environemt keys\n" + " --export print values as environment keys\n" " --help print this help text\n\n"); default: rc = 1; diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index ac5e0edc1a..0565e6403f 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -395,7 +395,7 @@ int main(int argc, char **argv) printf("Usage: usb_id [--usb-info] [--num-info] [--export] [--help] \n" " --usb-info use usb strings instead\n" " --num-info use numerical values\n" - " --export print values as environemt keys\n" + " --export print values as environment keys\n" " --help print this help text\n\n"); default: retval = 1; -- cgit v1.2.3-54-g00ecf From 5fadcc76c8c86cc0363fa0010f3e30933a7dcaa5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 6 Jan 2009 22:01:50 +0100 Subject: release 136 --- ChangeLog | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 2 +- 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b24cf2b4a7..03433f1a8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,86 @@ +Summary of changes from v135 to v136 +============================================ + +Adam Buchbinder (1): + extras: fix mis-spelling of "environment" + +Harald Hoyer (1): + rule_generator: fix enumeration for write_cd_rules + +Jeremy Higdon (1): + path_id: rework SAS persistent names + +Karel Zak (1): + volume_id: HPFS code clean up + +Kay Sievers (54): + rules: ATA_COMPAT do not try to match on sr*, it will never have vendor ATA + scsi_id: do not fail if no serial is found like for optical drives + update configure and NEWS + rules: fix isdn rules + rules: add persistent /dev/serial/{by-id,by-path} rules + make: install serial rules file + make: do not delete autotools generated file with distclean + udevadm: settle - allow --timeout=0 and --quiet + rules: move aoe rules to default rules file + volume_id: btrfs - update format + rules: add "do not edit header" + volume_id: support sub-uuid's and plug in btrfs device uuid + libudev: include + build: add -lsepol + build: just use autoreconf -i + rules: remove ide-scsi + rules: first simple step merging with Ubuntu rules + "'/sbin/modprobe abnormal' exit" - also print program options + rules: more changes toward Ubuntu rules merge + rules: more changes toward Ubuntu rules merge + rules: remove /dev/raw/raxctl symlink, it's a devfs leftover + rules: rtc - create rtc compat link only for cmos type rtc + rules: remove legacy symlinks + rules: do not put raw1394 in "video" group + rules: second round merging with Ubuntu rules + rules: remove /dev/dsp /dev/audio + rules: put alsa in group "audio" + rules: isdn - remove /dev/isdn/capi20 symlink + rules: provide /dev/raw/rawctl + if needed, store database entries also for devices which do not have a device node + build: use autoreconf --symlink + usb_id: add "image" class + require non-SYSFS_DEPRECATED 2.6.20+ kernel + build: default to --prefix=/usr --exec-prefix="" + libudev: enumerate - add lookup by property + rules: input - make sure needed variables are set + libudev: device - read "uevent" only if info is not already loaded + libudev: subsytem -> subsystem + libudev: bump revision + usb_id: use devtype lookup + require 2.6.22+ kernel + rules: Ubuntu merge - use group "cdrom" + rules: Ubuntu merge - use group "tape" + rules: replace DVB shell script rule + rules: Ubuntu merge - s/uucp/dialout/ + update NEWS + update NEWS + enable skipping of "naming-only" rules + usb_id: s/image/media/ + udevadm: s/udevinfo/udevadm info/ + rules: reorder block rules + rules: zaptel - add "dialout" group + libudev: device - add udev_device_get_property_value() + libudev: test - add udev_device_get_property_value() + +Marcel Holtmann (3): + libudev: device - add devtype support + libudev: device - lookup subsystem and devtype together + libudev: device - remove udev_device_get_parent_with_subsystem + +Michal Soltys (1): + man: udev - update NAME assignment + +Ryan Thomas (1): + rules: add rules for AoE devices + + Summary of changes from v134 to v135 ============================================ diff --git a/NEWS b/NEWS index d03de2f230..df1b782b5e 100644 --- a/NEWS +++ b/NEWS @@ -31,7 +31,7 @@ which do not depend on the kernel device name. As usual, unique devices - only a single one per product connected, or a real USB serial number in the device - are always found with the same name in the by-id/ directory. -Completely Identical devices may overwrite their names in by-id/ +Completely identical devices may overwrite their names in by-id/ and can only be found reliably in the by-path/ directory. Devices specified by by-path/ must not change their connection, like the USB port number they are plugged in, to keep their name. -- cgit v1.2.3-54-g00ecf From b04ba6ce63556e4fbe0d0a8b59153f74a3ea2385 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 10 Jan 2009 01:38:54 +0100 Subject: version bump --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 849939c78e..5e7adb938c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [136], + [137], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AC_CONFIG_SRCDIR([udev/udevd.c]) @@ -9,7 +9,7 @@ AC_DISABLE_STATIC AC_SYS_LARGEFILE AC_PROG_LIBTOOL -dnl /* prefix is /usr, exec_prefix in /, if overridden exec_prefix follows prefix */ +dnl /* prefix is /usr, exec_prefix is /, if overridden exec_prefix follows prefix */ AC_PREFIX_DEFAULT([/usr]) test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix= -- cgit v1.2.3-54-g00ecf From 8b739dec53f8bca23e46e2d2a9732abee9b8d591 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 10 Jan 2009 01:37:03 +0100 Subject: fix naming for tape nst devices in /dev/tape/by-path/ $env{ID_PATH} includes the "-nst" suffix anyway, so we shouldn't append it a second time as part of the rule creating the device file symlink. Signed-off-by: Lennart Poettering --- rules/rules.d/60-persistent-storage-tape.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index d3226f1320..8d53888924 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -19,6 +19,6 @@ KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$en # by-path (parent device path) KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p" KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst" +KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" LABEL="persistent_storage_tape_end" -- cgit v1.2.3-54-g00ecf From 18cff5c3b2e3591fa46107288ea2d7026a15ccf3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 10 Jan 2009 17:44:09 +0100 Subject: rules: fix typo in ide cd rule Thanks to Scott, who found that. --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 119941be1d..7730f0ddf0 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -68,7 +68,7 @@ KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitio # cdrom SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" -SUBSYSTEM=="block", KERNEL=="hd[0-9]*", SUBSYSTEMS=="ide", ATTRS{media}=="cdrom", GROUP="cdrom" +SUBSYSTEM=="block", KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="cdrom", GROUP="cdrom" SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k", GROUP="cdrom" KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom" -- cgit v1.2.3-54-g00ecf From affed87af1ad1a19a1baab3bfd2d271049f52e6c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Jan 2009 21:54:31 +0100 Subject: libudev: use 4096 bytes buffer for attribute reading --- configure.ac | 2 +- udev/lib/libudev-device.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5e7adb938c..bc2e9c27b0 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix= dnl /* libudev version */ LIBUDEV_LT_CURRENT=0 -LIBUDEV_LT_REVISION=7 +LIBUDEV_LT_REVISION=8 LIBUDEV_LT_AGE=0 AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index a7722b3f6e..fc881fb3fd 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -862,7 +862,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const { struct udev_list_entry *list_entry; char path[UTIL_PATH_SIZE]; - char value[UTIL_NAME_SIZE]; + char value[4096]; struct stat statbuf; int fd; ssize_t size; -- cgit v1.2.3-54-g00ecf From 66d9b44f8302efe383ada6a52d8431655614bf76 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Jan 2009 17:06:14 +0100 Subject: rules: add drm devices to group "video" https://bugs.launchpad.net/bugs/317430 --- rules/rules.d/50-udev-default.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 7730f0ddf0..95d82d7292 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -38,6 +38,7 @@ KERNEL=="card[0-9]*", NAME="dri/%k" KERNEL=="pmu", GROUP="video" KERNEL=="nvidia*|nvidiactl*", GROUP="video" SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" # DVB (video) SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}", GROUP="video" -- cgit v1.2.3-54-g00ecf From 92e52e2fd1698547ccec3feec479178c6988479d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Jan 2009 17:52:17 +0100 Subject: do not complain about a missing /etc/udev/rules.d/ Scott mentioned that initramfs does not neccessarily have that directory, so do not log an error. --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 7ba52208fb..c5f44aa20f 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1649,7 +1649,7 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis dbg(udev, "open directory '%s'\n", dirname); dir = opendir(dirname); if (dir == NULL) { - err(udev, "unable to open '%s': %m\n", dirname); + info(udev, "unable to open '%s': %m\n", dirname); return -1; } -- cgit v1.2.3-54-g00ecf From 64b333fdcc69798ab7874cf042d590b3f2d990b5 Mon Sep 17 00:00:00 2001 From: Sven Jost Date: Thu, 15 Jan 2009 19:09:12 +0100 Subject: volume_id: support via raid version 2 --- configure.ac | 2 +- extras/volume_id/lib/via_raid.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index bc2e9c27b0..81fff06f30 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AC_SUBST(LIBUDEV_LT_AGE) dnl /* libvolume_id version */ VOLID_LT_CURRENT=1 -VOLID_LT_REVISION=7 +VOLID_LT_REVISION=8 VOLID_LT_AGE=0 AC_SUBST(VOLID_LT_CURRENT) AC_SUBST(VOLID_LT_REVISION) diff --git a/extras/volume_id/lib/via_raid.c b/extras/volume_id/lib/via_raid.c index 9e4be5a90d..2d022a0060 100644 --- a/extras/volume_id/lib/via_raid.c +++ b/extras/volume_id/lib/via_raid.c @@ -83,7 +83,7 @@ int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) if (le16_to_cpu(via->signature) != VIA_SIGNATURE) return -1; - if (via->version_number > 1) + if (via->version_number > 2) return -1; if (!meta_checksum(via)) -- cgit v1.2.3-54-g00ecf From ec2dd02e2a2748134f9c8347e12b802b42dea6b5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Jan 2009 20:20:16 +0100 Subject: udevadm: test - remove --force option Since a while we change the database with a "test" run, but do not update the node and symlinks. We need to "force" all the time, to keep things in sync. --- udev/udev-event.c | 8 +++--- udev/udev-node.c | 77 +++++++++++++++++++++++------------------------------ udev/udev-rules.c | 5 ++-- udev/udev.h | 7 +++-- udev/udevadm-test.c | 11 -------- udev/udevadm.xml | 10 +------ 6 files changed, 43 insertions(+), 75 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 9e82f8de42..6d05594337 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -472,8 +472,6 @@ static int rename_netif(struct udev_event *event) info(event->udev, "changing net interface name from '%s' to '%s'\n", udev_device_get_sysname(dev), event->name); - if (event->test) - return 0; sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { @@ -593,11 +591,11 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) /* update database, create node and symlinks */ udev_device_update_db(dev); - err = udev_node_add(dev, event->mode, event->uid, event->gid, event->test); + err = udev_node_add(dev, event->mode, event->uid, event->gid); /* remove/update possible left-over symlinks from old database entry */ if (dev_old != NULL) { - udev_node_update_old_links(dev, dev_old, event->test); + udev_node_update_old_links(dev, dev_old); udev_device_unref(dev_old); } goto exit; @@ -673,7 +671,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) goto exit; } - err = udev_node_remove(dev, event->test); + err = udev_node_remove(dev); goto exit; } diff --git a/udev/udev-node.c b/udev/udev-node.c index 100ca92903..18a9d11017 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -32,7 +32,7 @@ #define TMP_FILE_EXT ".udev-tmp" /* reverse mapping from the device file name to the devpath */ -static int name_index(struct udev *udev, const char *devpath, const char *name, int add, int test) +static int name_index(struct udev *udev, const char *devpath, const char *name, int add) { char device[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE * 2]; @@ -268,7 +268,7 @@ out: return count; } -static int update_link(struct udev_device *dev, const char *slink, int test) +static int update_link(struct udev_device *dev, const char *slink) { struct udev *udev = udev_device_get_udev(dev); struct udev_list_node dev_list; @@ -288,10 +288,8 @@ static int update_link(struct udev_device *dev, const char *slink, int test) /* if we don't have a reference, delete it */ if (count <= 0) { info(udev, "no reference left, remove '%s'\n", slink); - if (!test) { - unlink(slink); - util_delete_path(udev, slink); - } + unlink(slink); + util_delete_path(udev, slink); goto out; } @@ -351,15 +349,13 @@ static int update_link(struct udev_device *dev, const char *slink, int test) /* create symlink to the target with the highest priority */ info(udev, "'%s' with target '%s' has the highest priority %i, create it\n", slink, target, priority); - if (!test) { - util_create_path(udev, slink); - node_symlink(udev, target, slink); - } + util_create_path(udev, slink); + node_symlink(udev, target, slink); out: return rc; } -void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test) +void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old) { struct udev *udev = udev_device_get_udev(dev); struct udev_list_entry *list_entry; @@ -389,8 +385,8 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev continue; info(udev, "update old symlink '%s' no longer belonging to '%s'\n", name, udev_device_get_devpath(dev)); - name_index(udev, udev_device_get_devpath(dev), name, 0, test); - update_link(dev, name, test); + name_index(udev, udev_device_get_devpath(dev), name, 0); + update_link(dev, name); } /* @@ -402,11 +398,11 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev const char *devnode = udev_device_get_devnode(dev); if (devnode != NULL && strcmp(devnode_old, devnode) != 0) - update_link(dev, devnode_old, test); + update_link(dev, devnode_old); } } -int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, int test) +int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); int i; @@ -420,44 +416,41 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, in mode, uid, gid); util_create_path(udev, udev_device_get_devnode(dev)); - if (!test) - if (udev_node_mknod(dev, NULL, makedev(0,0), mode, uid, gid) != 0) { - err = -1; - goto exit; - } + if (udev_node_mknod(dev, NULL, makedev(0,0), mode, uid, gid) != 0) { + err = -1; + goto exit; + } /* create all_partitions if requested */ num = udev_device_get_num_fake_partitions(dev); if (num > 0) { info(udev, "creating device partition nodes '%s[1-%i]'\n", udev_device_get_devnode(dev), num); - if (!test) { - for (i = 1; i <= num; i++) { - char partitionname[UTIL_PATH_SIZE]; - dev_t part_devnum; - - snprintf(partitionname, sizeof(partitionname), "%s%d", - udev_device_get_devnode(dev), i); - partitionname[sizeof(partitionname)-1] = '\0'; - part_devnum = makedev(major(udev_device_get_devnum(dev)), - minor(udev_device_get_devnum(dev)) + i); - udev_node_mknod(dev, partitionname, part_devnum, mode, uid, gid); - } + for (i = 1; i <= num; i++) { + char partitionname[UTIL_PATH_SIZE]; + dev_t part_devnum; + + snprintf(partitionname, sizeof(partitionname), "%s%d", + udev_device_get_devnode(dev), i); + partitionname[sizeof(partitionname)-1] = '\0'; + part_devnum = makedev(major(udev_device_get_devnum(dev)), + minor(udev_device_get_devnum(dev)) + i); + udev_node_mknod(dev, partitionname, part_devnum, mode, uid, gid); } } /* add node to name index */ - name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 1, test); + name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 1); /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 1, test); - update_link(dev, udev_list_entry_get_name(list_entry), test); + name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 1); + update_link(dev, udev_list_entry_get_name(list_entry)); } exit: return err; } -extern int udev_node_remove(struct udev_device *dev, int test) +extern int udev_node_remove(struct udev_device *dev) { struct udev *udev = udev_device_get_udev(dev); struct udev_list_entry *list_entry; @@ -468,12 +461,12 @@ extern int udev_node_remove(struct udev_device *dev, int test) int num; /* remove node from name index */ - name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 0, test); + name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 0); /* remove,update symlinks, remove symlinks from name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 0, test); - update_link(dev, udev_list_entry_get_name(list_entry), test); + name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 0); + update_link(dev, udev_list_entry_get_name(list_entry)); } devnode = udev_device_get_devnode(dev); @@ -489,8 +482,7 @@ extern int udev_node_remove(struct udev_device *dev, int test) } info(udev, "removing device node '%s'\n", devnode); - if (!test) - err = util_unlink_secure(udev, devnode); + err = util_unlink_secure(udev, devnode); if (err) return err; @@ -504,8 +496,7 @@ extern int udev_node_remove(struct udev_device *dev, int test) for (i = 1; i <= num; i++) { snprintf(partitionname, sizeof(partitionname), "%s%d", devnode, i); partitionname[sizeof(partitionname)-1] = '\0'; - if (!test) - util_unlink_secure(udev, partitionname); + util_unlink_secure(udev, partitionname); } } util_delete_path(udev, devnode); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index c5f44aa20f..2d120dd927 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2504,9 +2504,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rule->rule.filename_line); f = fopen(attr, "w"); if (f != NULL) { - if (!event->test) - if (fprintf(f, "%s", value) <= 0) - err(event->udev, "error writing ATTR{%s}: %m\n", attr); + if (fprintf(f, "%s", value) <= 0) + err(event->udev, "error writing ATTR{%s}: %m\n", attr); fclose(f); } else { err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); diff --git a/udev/udev.h b/udev/udev.h index ea8c8d919d..d1b207196e 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -76,7 +76,6 @@ struct udev_event { unsigned int run_final:1; unsigned int ignore_device:1; unsigned int trace:1; - unsigned int test:1; }; /* udev-rules.c */ @@ -96,9 +95,9 @@ extern int udev_event_apply_subsys_kernel(struct udev_event *event, const char * /* udev-node.c */ extern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid); -extern int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid, int test); -extern int udev_node_remove(struct udev_device *dev, int test); -extern void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old, int test); +extern int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); +extern int udev_node_remove(struct udev_device *dev); +extern void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); /* udev-util.c */ extern int util_create_path(struct udev *udev, const char *path); diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 2c8e0bff98..9d505146cf 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -33,7 +33,6 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) { char filename[UTIL_PATH_SIZE]; - int force = 0; const char *action = "add"; const char *syspath = NULL; struct udev_event *event; @@ -44,7 +43,6 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) static const struct option options[] = { { "action", required_argument, NULL, 'a' }, - { "force", no_argument, NULL, 'f' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -63,13 +61,9 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) case 'a': action = optarg; break; - case 'f': - force = 1; - break; case 'h': printf("Usage: udevadm test OPTIONS \n" " --action= set action string\n" - " --force don't skip node/link creation\n" " --help print this help text\n\n"); exit(0); default: @@ -116,11 +110,6 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) udev_device_set_action(dev, action); event = udev_event_new(dev); - - /* simulate node creation with test flag */ - if (!force) - event->test = 1; - err = udev_event_execute_rules(event, rules); if (udev_device_get_event_timeout(dev) >= 0) diff --git a/udev/udevadm.xml b/udev/udevadm.xml index ebc4aa150f..7ed2107f88 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -326,8 +326,7 @@ udevadm test <optional>options</optional> <replaceable>devpath</replaceable> - Simulate a udev event run for the given device, and print out debug - output. Unless forced to, no device node or symlink will be created. + Simulate a udev event run for the given device, and print debug output. @@ -341,13 +340,6 @@ The subsystem string. - - - - Force the creation of a device node or symlink. Usually the test run - prints only debug output. - - -- cgit v1.2.3-54-g00ecf From 87702fa03914b91f0068755533bde4e002d20564 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Jan 2009 20:54:11 +0100 Subject: update NEWS --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index df1b782b5e..bcfd773c6f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +udev 137 +======== +Bugfixes. + +The udevadm test command has no longer a --force option, nodes and symlinks +are always updated with a test run now. + udev 136 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 8257730d392cf227fd3eba2915021aad6a2cc2e4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Jan 2009 21:14:13 +0100 Subject: remove name from index if the node name has changed Scott discovered that a changed rule, which renames a device node leaves the old node name around as a symlink. So drop the reference to the old name. --- udev/udev-node.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 18a9d11017..74ec00b1eb 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -384,21 +384,25 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev if (found) continue; - info(udev, "update old symlink '%s' no longer belonging to '%s'\n", name, udev_device_get_devpath(dev)); + info(udev, "update old name, '%s' no longer belonging to '%s'\n", + name, udev_device_get_devpath(dev)); name_index(udev, udev_device_get_devpath(dev), name, 0); update_link(dev, name); } /* * if the node name has changed, delete the node, - * and possibly restore a symlink of another device + * and possibly restore a symlink of a different device */ devnode_old = udev_device_get_devnode(dev_old); if (devnode_old != NULL) { const char *devnode = udev_device_get_devnode(dev); - if (devnode != NULL && strcmp(devnode_old, devnode) != 0) + if (devnode != NULL && strcmp(devnode_old, devnode) != 0) { + info(udev, "node has changed from '%s' to '%s'\n", devnode_old, devnode); + name_index(udev, udev_device_get_devpath(dev), devnode_old, 0); update_link(dev, devnode_old); + } } } -- cgit v1.2.3-54-g00ecf From fc7d16f993df6cef0e6038c63942d17994fde672 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 16 Jan 2009 21:15:53 +0100 Subject: cleanup old names before creating the new names Scott found that the node /dev/pktcdvd can not be replaced by /dev/pktcdvd/control by changing the rules, and re-trigger the event. We used to create the new names before we cleaned up the old ones, which can not work if we need to create subdir with the same name. --- udev/udev-event.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 6d05594337..4b00cab30d 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -582,22 +582,24 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) util_strlcat(filename, event->name, sizeof(filename)); udev_device_set_devnode(dev, filename); - /* read current database entry */ + /* read old database entry */ dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); if (dev_old != NULL) { udev_device_read_db(dev_old); udev_device_set_info_loaded(dev_old); } - /* update database, create node and symlinks */ + /* write current database entry */ udev_device_update_db(dev); - err = udev_node_add(dev, event->mode, event->uid, event->gid); /* remove/update possible left-over symlinks from old database entry */ if (dev_old != NULL) { udev_node_update_old_links(dev, dev_old); udev_device_unref(dev_old); } + + /* create new node and symlinks */ + err = udev_node_add(dev, event->mode, event->uid, event->gid); goto exit; } -- cgit v1.2.3-54-g00ecf From e5e641518bb20d44db58d9715ac4cd450fcb4dcc Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Fri, 16 Jan 2009 20:26:16 +0000 Subject: man: typo fixes --- udev/udev.xml | 2 +- udev/udevadm.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index f11a56cc04..4c35e19791 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -335,7 +335,7 @@ event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. - If the specifiefd string starts with + If the specified string starts with , all current event values will be passed to the specified socket, as a message in the same format the kernel sends an uevent. If the first character of the specified path diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 7ed2107f88..9d905abd0c 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -227,7 +227,7 @@ - Do not print any output, like the remaining queue entries when reachin the timeout. + Do not print any output, like the remaining queue entries when reaching the timeout. -- cgit v1.2.3-54-g00ecf From a3ab20722d966ae33dbdb4f8fd6ead50b2472f7d Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Fri, 16 Jan 2009 20:35:34 +0000 Subject: remove stray initializer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Picked up by "gcc -Wextra". udevadm.c:83: warning: initialized field overwritten udevadm.c:83: warning: (near initialization for ‘cmds[2].help’) This is just a cleanup. It doesn't change the code generated by gcc. --- udev/udevadm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevadm.c b/udev/udevadm.c index 0927981ab2..072280a58e 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -79,7 +79,7 @@ static const struct command cmds[] = { }, { .name = "settle", - .cmd = udevadm_settle, "", + .cmd = udevadm_settle, .help = "wait for the event queue to finish", }, { -- cgit v1.2.3-54-g00ecf From 3210a72ba314dd15e6f7ed85ee22d7a5a0944b7a Mon Sep 17 00:00:00 2001 From: Olaf Kirch Date: Tue, 20 Jan 2009 12:49:20 +0100 Subject: udevd: use ppoll instead of signal pipes udevd uses a rather old-fashioned way of handling signals while waiting for input through select (ie by using an unnamed pipe, to which the signal handler writes one byte for every signal received). This is rather awkward and may potentially even block if we receive more signals than the kernel's pipe buffer. This patch replaces all of that with ppoll, which was designed for this purpose. It also removes the SA_RESTART flag from all installed signal handlers, because otherwise the ppoll call would just be restarted after handling eg a SIGCHLD. Signed-off-by: Olaf Kirch --- udev/udevd.c | 99 +++++++++++++++++++++--------------------------------------- 1 file changed, 35 insertions(+), 64 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 993964d23d..bc6484b1b0 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -63,10 +64,10 @@ static struct udev_rules *rules; static struct udev_ctrl *udev_ctrl; static struct udev_monitor *kernel_monitor; static int inotify_fd = -1; -static int signal_pipe[2] = {-1, -1}; static volatile int sigchilds_waiting; static volatile int udev_exit; static volatile int reload_config; +static volatile int signal_received; static int run_exec_q; static int stop_exec_q; static int max_childs; @@ -194,8 +195,6 @@ static void event_fork(struct udev_event *event) udev_ctrl_unref(udev_ctrl); if (inotify_fd >= 0) close(inotify_fd); - close(signal_pipe[READ_END]); - close(signal_pipe[WRITE_END]); logging_close(); logging_init("udevd-event"); setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); @@ -520,8 +519,7 @@ static void asmlinkage sig_handler(int signum) break; } - /* write to pipe, which will wakeup select() in our mainloop */ - write(signal_pipe[WRITE_END], "", 1); + signal_received = 1; } static void udev_done(int pid, int exitstatus) @@ -633,10 +631,8 @@ static void export_initial_seqnum(struct udev *udev) int main(int argc, char *argv[]) { struct udev *udev; - int err; int fd; struct sigaction act; - fd_set readfds; const char *value; int daemonize = 0; static const struct option options[] = { @@ -648,7 +644,6 @@ int main(int argc, char *argv[]) {} }; int rc = 1; - int maxfd; udev = udev_new(); if (udev == NULL) @@ -731,34 +726,6 @@ int main(int argc, char *argv[]) } udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); - err = pipe(signal_pipe); - if (err < 0) { - err(udev, "error getting pipes: %m\n"); - goto exit; - } - - err = fcntl(signal_pipe[READ_END], F_GETFL, 0); - if (err < 0) { - err(udev, "error fcntl on read pipe: %m\n"); - goto exit; - } - err = fcntl(signal_pipe[READ_END], F_SETFL, err | O_NONBLOCK); - if (err < 0) { - err(udev, "error fcntl on read pipe: %m\n"); - goto exit; - } - - err = fcntl(signal_pipe[WRITE_END], F_GETFL, 0); - if (err < 0) { - err(udev, "error fcntl on write pipe: %m\n"); - goto exit; - } - err = fcntl(signal_pipe[WRITE_END], F_SETFL, err | O_NONBLOCK); - if (err < 0) { - err(udev, "error fcntl on write pipe: %m\n"); - goto exit; - } - rules = udev_rules_new(udev, 1); if (rules == NULL) { err(udev, "error reading rules\n"); @@ -838,7 +805,6 @@ int main(int argc, char *argv[]) memset(&act, 0x00, sizeof(struct sigaction)); act.sa_handler = (void (*)(int)) sig_handler; sigemptyset(&act.sa_mask); - act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); sigaction(SIGCHLD, &act, NULL); @@ -885,32 +851,45 @@ int main(int argc, char *argv[]) max_childs = strtoul(value, NULL, 10); info(udev, "initialize max_childs to %u\n", max_childs); - maxfd = udev_ctrl_get_fd(udev_ctrl); - maxfd = UDEV_MAX(maxfd, udev_monitor_get_fd(kernel_monitor)); - maxfd = UDEV_MAX(maxfd, signal_pipe[READ_END]); - maxfd = UDEV_MAX(maxfd, inotify_fd); while (!udev_exit) { - int fdcount; + sigset_t blocked_mask, orig_mask; + struct pollfd *ctrl_poll, *monitor_poll, *inotify_poll = NULL; + struct pollfd pfd[10]; + int fdcount, nfds = 0; + + sigfillset(&blocked_mask); + sigprocmask(SIG_SETMASK, &blocked_mask, &orig_mask); + if (signal_received) { + sigprocmask(SIG_SETMASK, &orig_mask, NULL); + goto handle_signals; + } - FD_ZERO(&readfds); - FD_SET(signal_pipe[READ_END], &readfds); - FD_SET(udev_ctrl_get_fd(udev_ctrl), &readfds); - FD_SET(udev_monitor_get_fd(kernel_monitor), &readfds); +#define POLL_FOR(__desc, __pollptr) do { \ + pfd[nfds].fd = (__desc); pfd[nfds].events = POLLIN; \ + __pollptr = &pfd[nfds++]; \ +} while (0) + POLL_FOR(udev_ctrl_get_fd(udev_ctrl), ctrl_poll); + POLL_FOR(udev_monitor_get_fd(kernel_monitor), monitor_poll); if (inotify_fd >= 0) - FD_SET(inotify_fd, &readfds); - fdcount = select(maxfd+1, &readfds, NULL, NULL, NULL); + POLL_FOR(inotify_fd, inotify_poll); +#undef POLL_FOR + + fdcount = ppoll(pfd, nfds, NULL, &orig_mask); + sigprocmask(SIG_SETMASK, &orig_mask, NULL); + if (fdcount < 0) { - if (errno != EINTR) - err(udev, "error in select: %m\n"); + if (errno == EINTR) + goto handle_signals; + err(udev, "error in select: %m\n"); continue; } /* get control message */ - if (FD_ISSET(udev_ctrl_get_fd(udev_ctrl), &readfds)) + if (ctrl_poll->revents & POLLIN) handle_ctrl_msg(udev_ctrl); /* get kernel uevent */ - if (FD_ISSET(udev_monitor_get_fd(kernel_monitor), &readfds)) { + if (monitor_poll->revents & POLLIN) { struct udev_device *dev; dev = udev_monitor_receive_device(kernel_monitor); @@ -925,15 +904,8 @@ int main(int argc, char *argv[]) } } - /* received a signal, clear our notification pipe */ - if (FD_ISSET(signal_pipe[READ_END], &readfds)) { - char buf[256]; - - read(signal_pipe[READ_END], &buf, sizeof(buf)); - } - /* rules directory inotify watch */ - if ((inotify_fd >= 0) && FD_ISSET(inotify_fd, &readfds)) { + if (inotify_poll && (inotify_poll->revents & POLLIN)) { int nbytes; /* discard all possible events, we can just reload the config */ @@ -952,6 +924,9 @@ int main(int argc, char *argv[]) } } +handle_signals: + signal_received = 0; + /* rules changed, set by inotify or a HUP signal */ if (reload_config) { struct udev_rules *rules_new; @@ -979,10 +954,6 @@ int main(int argc, char *argv[]) rc = 0; exit: udev_rules_unref(rules); - if (signal_pipe[READ_END] >= 0) - close(signal_pipe[READ_END]); - if (signal_pipe[WRITE_END] >= 0) - close(signal_pipe[WRITE_END]); udev_ctrl_unref(udev_ctrl); if (inotify_fd >= 0) close(inotify_fd); -- cgit v1.2.3-54-g00ecf From 5f03ed8a56d308af72db8a48ab66ed68667af2c6 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Tue, 20 Jan 2009 21:33:02 +0000 Subject: Allow user and group lookup to be disabled. In certain cut-down situations such as an installer or inside the initramfs, we simply don't have any kind of name service. While we could use rules without OWNER or GROUP, it's better to have the same rules as a full system and have udevd ignore those parts of the rules. Adds a --resolve-names=never switch to udevd that has this effect. --- NEWS | 3 +++ udev/udev-rules.c | 8 ++++---- udev/udevd.c | 19 ++++++++++++++++--- udev/udevd.xml | 11 +++++++++++ 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index bcfd773c6f..52bfa6a991 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ Bugfixes. The udevadm test command has no longer a --force option, nodes and symlinks are always updated with a test run now. +The udevd daemon can be started with --resolve-names=never to avoid all user +and group lookups (e.g. in cut-down systems). + udev 136 ======== Bugfixes. diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 2d120dd927..ccf1eaaf8f 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1454,10 +1454,10 @@ static int add_rule(struct udev_rules *rules, char *line, uid = strtoul(value, &endptr, 10); if (endptr[0] == '\0') { rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); - } else if (rules->resolve_names && strchr("$%", value[0]) == NULL) { + } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { uid = add_uid(rules, value); rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); - } else { + } else if (rules->resolve_names == 0) { rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL); } rule_tmp.rule.rule.flags = 1; @@ -1472,10 +1472,10 @@ static int add_rule(struct udev_rules *rules, char *line, gid = strtoul(value, &endptr, 10); if (endptr[0] == '\0') { rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); - } else if (rules->resolve_names && strchr("$%", value[0]) == NULL) { + } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { gid = add_gid(rules, value); rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); - } else { + } else if (rules->resolve_names == 0) { rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL); } rule_tmp.rule.rule.flags = 1; diff --git a/udev/udevd.c b/udev/udevd.c index 993964d23d..9a8d791800 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -639,12 +639,14 @@ int main(int argc, char *argv[]) fd_set readfds; const char *value; int daemonize = 0; + int resolve_names = 1; static const struct option options[] = { { "daemon", no_argument, NULL, 'd' }, { "debug-trace", no_argument, NULL, 't' }, { "debug", no_argument, NULL, 'D' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, + { "resolve-names", required_argument, NULL, 'N' }, {} }; int rc = 1; @@ -678,8 +680,19 @@ int main(int argc, char *argv[]) if (udev_get_log_priority(udev) < LOG_INFO) udev_set_log_priority(udev, LOG_INFO); break; + case 'N': + if (strcmp (optarg, "early") == 0) { + resolve_names = 1; + } else if (strcmp (optarg, "never") == 0) { + resolve_names = -1; + } else { + fprintf(stderr, "resolve-names must be early or never\n"); + err(udev, "resolve-names must be early or never\n"); + goto exit; + } + break; case 'h': - printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n"); + printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--resolve-names=early|never] [--version]\n"); goto exit; case 'V': printf("%s\n", VERSION); @@ -759,7 +772,7 @@ int main(int argc, char *argv[]) goto exit; } - rules = udev_rules_new(udev, 1); + rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { err(udev, "error reading rules\n"); goto exit; @@ -957,7 +970,7 @@ int main(int argc, char *argv[]) struct udev_rules *rules_new; reload_config = 0; - rules_new = udev_rules_new(udev, 1); + rules_new = udev_rules_new(udev, resolve_names); if (rules_new != NULL) { udev_rules_unref(rules); rules = rules_new; diff --git a/udev/udevd.xml b/udev/udevd.xml index b5726b8b03..010411c781 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -29,6 +29,7 @@ + @@ -64,6 +65,16 @@ Print debug messages to stderr. + + + + Specify when udevd should resolve names of users and groups. + When set to (the default) names will be + resolved when the rules are parsed. + When set to names will never be resolved + and all devices will be owned by root. + + -- cgit v1.2.3-54-g00ecf From 9032f119f07ad3b5116b3d4858816d851d4127de Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Tue, 20 Jan 2009 21:36:09 +0000 Subject: Expose delayed name resolution udevd had the ability to delay name resolution until the event, but this was never exposed. Add a --resolve-names=late option to do so. --- NEWS | 3 ++- udev/udevd.c | 8 +++++--- udev/udevd.xml | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 52bfa6a991..972b9b0b11 100644 --- a/NEWS +++ b/NEWS @@ -6,7 +6,8 @@ The udevadm test command has no longer a --force option, nodes and symlinks are always updated with a test run now. The udevd daemon can be started with --resolve-names=never to avoid all user -and group lookups (e.g. in cut-down systems). +and group lookups (e.g. in cut-down systems) or --resolve-names=late to +lookup user and groups every time events are handled. udev 136 ======== diff --git a/udev/udevd.c b/udev/udevd.c index 9a8d791800..4d6f465f96 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -683,16 +683,18 @@ int main(int argc, char *argv[]) case 'N': if (strcmp (optarg, "early") == 0) { resolve_names = 1; + } else if (strcmp (optarg, "late") == 0) { + resolve_names = 0; } else if (strcmp (optarg, "never") == 0) { resolve_names = -1; } else { - fprintf(stderr, "resolve-names must be early or never\n"); - err(udev, "resolve-names must be early or never\n"); + fprintf(stderr, "resolve-names must be early, late or never\n"); + err(udev, "resolve-names must be early, late or never\n"); goto exit; } break; case 'h': - printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--resolve-names=early|never] [--version]\n"); + printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--resolve-names=early|late|never] [--version]\n"); goto exit; case 'V': printf("%s\n", VERSION); diff --git a/udev/udevd.xml b/udev/udevd.xml index 010411c781..0df6f4ba59 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -29,7 +29,7 @@ - + @@ -70,7 +70,8 @@ Specify when udevd should resolve names of users and groups. When set to (the default) names will be - resolved when the rules are parsed. + resolved when the rules are parsed. When set to + names will be resolved for every event. When set to names will never be resolved and all devices will be owned by root. -- cgit v1.2.3-54-g00ecf From e9a77fd828e9d415e4d64dd74aa780a61f726536 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Jan 2009 11:09:27 +0100 Subject: open-code pollfd setup --- udev/udevd.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index bc6484b1b0..d227a71fd1 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -853,9 +853,10 @@ int main(int argc, char *argv[]) while (!udev_exit) { sigset_t blocked_mask, orig_mask; + struct pollfd pfd[4]; struct pollfd *ctrl_poll, *monitor_poll, *inotify_poll = NULL; - struct pollfd pfd[10]; - int fdcount, nfds = 0; + int nfds = 0; + int fdcount; sigfillset(&blocked_mask); sigprocmask(SIG_SETMASK, &blocked_mask, &orig_mask); @@ -864,19 +865,22 @@ int main(int argc, char *argv[]) goto handle_signals; } -#define POLL_FOR(__desc, __pollptr) do { \ - pfd[nfds].fd = (__desc); pfd[nfds].events = POLLIN; \ - __pollptr = &pfd[nfds++]; \ -} while (0) - POLL_FOR(udev_ctrl_get_fd(udev_ctrl), ctrl_poll); - POLL_FOR(udev_monitor_get_fd(kernel_monitor), monitor_poll); - if (inotify_fd >= 0) - POLL_FOR(inotify_fd, inotify_poll); -#undef POLL_FOR + ctrl_poll = &pfd[nfds++]; + ctrl_poll->fd = udev_ctrl_get_fd(udev_ctrl); + ctrl_poll->events = POLLIN; + + monitor_poll = &pfd[nfds++]; + monitor_poll->fd = udev_monitor_get_fd(kernel_monitor); + monitor_poll->events = POLLIN; + + if (inotify_fd >= 0) { + inotify_poll = &pfd[nfds++]; + inotify_poll->fd = inotify_fd; + inotify_poll->events = POLLIN; + } fdcount = ppoll(pfd, nfds, NULL, &orig_mask); sigprocmask(SIG_SETMASK, &orig_mask, NULL); - if (fdcount < 0) { if (errno == EINTR) goto handle_signals; -- cgit v1.2.3-54-g00ecf From d1cc6562f3b8fb17d061aa37aedd40163dd714e5 Mon Sep 17 00:00:00 2001 From: Olaf Kirch Date: Wed, 21 Jan 2009 11:17:11 +0100 Subject: reap children faster udevd's event_queue_manager loop is pretty sensitive to the delays of exiting child processes. I found that it helps boot times if we try to reap children as quickly as possible. This patch changes event_queue_manager to call sigchilds_waiting if it finds a signal has been received. Signed-off-by: Olaf Kirch --- udev/udevd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/udev/udevd.c b/udev/udevd.c index d227a71fd1..9a278ce1f3 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -59,6 +59,8 @@ static void log_fn(struct udev *udev, int priority, } } +static void reap_sigchilds(void); + static int debug_trace; static struct udev_rules *rules; static struct udev_ctrl *udev_ctrl; @@ -403,6 +405,7 @@ static void event_queue_manager(struct udev *udev) struct udev_list_node *loop; struct udev_list_node *tmp; +start_over: if (udev_list_is_empty(&event_list)) { if (childs > 0) { err(udev, "event list empty, but childs count is %i", childs); @@ -432,6 +435,13 @@ static void event_queue_manager(struct udev *udev) event_fork(loop_event); dbg(udev, "moved seq %llu to running list\n", udev_device_get_seqnum(loop_event->dev)); + + /* retry if events finished in the meantime */ + if (sigchilds_waiting) { + sigchilds_waiting = 0; + reap_sigchilds(); + goto start_over; + } } } -- cgit v1.2.3-54-g00ecf From c807ad918c7c61a8af3fcc930cc2a5ad4c978ea1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Jan 2009 11:17:58 +0100 Subject: increase netif renaming timeout from 30 to 90 seconds --- udev/udev-event.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 4b00cab30d..e34f09cfe3 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -505,10 +505,10 @@ static int rename_netif(struct udev_event *event) goto exit; } - /* wait 30 seconds for our target to become available */ + /* wait 90 seconds for our target to become available */ util_strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); util_strlcpy(ifr.ifr_newname, event->name, IFNAMSIZ); - loop = 30 * 20; + loop = 90 * 20; while (loop--) { err = ioctl(sk, SIOCSIFNAME, &ifr); if (err == 0) { @@ -522,7 +522,7 @@ static int rename_netif(struct udev_event *event) break; } dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", - event->name, (30 * 20) - loop); + event->name, (90 * 20) - loop); usleep(1000 * 1000 / 20); } } -- cgit v1.2.3-54-g00ecf From 6469c77216f02c53faeeb397e44c041d6ff57b82 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Jan 2009 15:11:38 +0100 Subject: split up long line --- udev/udevd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index 7d82d2132e..7e87068068 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -699,7 +699,8 @@ int main(int argc, char *argv[]) } break; case 'h': - printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--resolve-names=early|late|never] [--version]\n"); + printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] " + "[--resolve-names=early|late|never] [--version]\n"); goto exit; case 'V': printf("%s\n", VERSION); -- cgit v1.2.3-54-g00ecf From 5db88229d1d1d727ee1e60de583cedc6c6aa6d73 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Jan 2009 18:55:59 +0100 Subject: udevd: add back SA_RESTART poll, select, ppoll, pselect, epoll, etc. are *explicitly* NOT restarted in case of signal ok --- udev/udevd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/udevd.c b/udev/udevd.c index 7e87068068..d08cf30f29 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -831,6 +831,7 @@ int main(int argc, char *argv[]) memset(&act, 0x00, sizeof(struct sigaction)); act.sa_handler = (void (*)(int)) sig_handler; sigemptyset(&act.sa_mask); + act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); sigaction(SIGCHLD, &act, NULL); -- cgit v1.2.3-54-g00ecf From e339233993ede35a1e8eba5c0644e20622d6ba40 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Jan 2009 19:23:33 +0100 Subject: usb_id: handle ATAPI devices like SCSI devices Some weird mass storage devices identify the disks as ATAPI/cdrom devices, and all disks in such enclusure get the same ids which overwrite each other, in such cases, get the typ of device from the scsi device, which has more knowledge what kind of device it really is. --- extras/usb_id/usb_id.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 0565e6403f..3d007f9ee5 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -107,7 +107,7 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len if (eptr != from) { switch (type_num) { case 2: - type = "cd"; + type = "atapi"; break; case 3: type = "tape"; @@ -127,7 +127,6 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len } } util_strlcpy(to, type, len); - return type_num; } @@ -205,8 +204,10 @@ static int usb_id(struct udev_device *dev) udev_device_get_sysname(dev)); return 1; } + if_class_num = strtoul(if_class, NULL, 16); if (if_class_num == 8) { + /* mass storage */ if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass"); if (if_subclass != NULL) protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); @@ -225,8 +226,8 @@ static int usb_id(struct udev_device *dev) return 1; } - /* mass storage */ - if (protocol == 6 && !use_usb_info) { + /* mass storage : SCSI or ATAPI */ + if ((protocol == 6 || protocol == 2) && !use_usb_info) { struct udev_device *dev_scsi; const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; int host, bus, target, lun; -- cgit v1.2.3-54-g00ecf From c2de781ef0684e2f90760301da402b571bb38b9e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Jan 2009 02:19:12 +0100 Subject: udevadm: settle - fix typo --- udev/udevadm-settle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 5bb3d22a49..8a765f61cf 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -89,7 +89,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (!quiet) { info(udev, "timeout waiting for udev queue\n"); - printf("\ndevadm settle timeout of %i seconds reached, the event queue contains:\n", timeout); + printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) printf(" %s (%s)\n", udev_list_entry_get_name(list_entry), -- cgit v1.2.3-54-g00ecf From 9ad0d7370cffff0bc07e9c561559b4066ae39dc6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Jan 2009 03:05:05 +0100 Subject: release 137 --- ChangeLog | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/ChangeLog b/ChangeLog index 03433f1a8c..d7bcf5ff1c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,44 @@ +Summary of changes from v136 to v137 +============================================ + +Alan Jenkins (2): + man: typo fixes + remove stray initializer + +Kay Sievers (17): + version bump + rules: fix typo in ide cd rule + libudev: use 4096 bytes buffer for attribute reading + rules: add drm devices to group "video" + do not complain about a missing /etc/udev/rules.d/ + udevadm: test - remove --force option + update NEWS + remove name from index if the node name has changed + cleanup old names before creating the new names + open-code pollfd setup + increase netif renaming timeout from 30 to 90 seconds + Merge commit '5f03ed8a56d308af72db8a48ab66ed68667af2c6' + Merge commit '9032f119f07ad3b5116b3d4858816d851d4127de' + split up long line + udevd: add back SA_RESTART + usb_id: handle ATAPI devices like SCSI devices + udevadm: settle - fix typo + +Lennart Poettering (1): + fix naming for tape nst devices in /dev/tape/by-path/ + +Olaf Kirch (2): + udevd: use ppoll instead of signal pipes + reap children faster + +Scott James Remnant (2): + Allow user and group lookup to be disabled. + Expose delayed name resolution + +Sven Jost (1): + volume_id: support via raid version 2 + + Summary of changes from v135 to v136 ============================================ -- cgit v1.2.3-54-g00ecf From 3e2084614b4d8308d5c0ceb34ec3634eb3353c00 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Sat, 24 Jan 2009 00:37:22 +0100 Subject: vol_id: fix ddf version string The version string in DDF suberblock does not include the null terminator and the snprintf() function writes at most "size" bytes *including* the null byte. old version: ID_FS_VERSION=02.00.0 new version: ID_FS_VERSION=02.00.00 Signed-off-by: Karel Zak --- extras/volume_id/lib/ddf_raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c index 58bdae94a7..32f20ced49 100644 --- a/extras/volume_id/lib/ddf_raid.c +++ b/extras/volume_id/lib/ddf_raid.c @@ -87,7 +87,7 @@ int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) return -1; found: volume_id_set_uuid(id, ddf->guid, DDF_GUID_LENGTH, UUID_STRING); - snprintf(id->type_version, DDF_REV_LENGTH, "%s", ddf->ddf_rev); + snprintf(id->type_version, DDF_REV_LENGTH + 1, "%s", ddf->ddf_rev); volume_id_set_usage(id, VOLUME_ID_RAID); id->type = "ddf_raid_member"; return 0; -- cgit v1.2.3-54-g00ecf From 7e5861ff70994fdc2e383e227ff24225ac5f7ce5 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Sat, 24 Jan 2009 00:37:23 +0100 Subject: vol_id: add missing id->type to swap0 Signed-off-by: Karel Zak --- extras/volume_id/lib/linux_swap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c index 1698e9dbf7..53649bdb75 100644 --- a/extras/volume_id/lib/linux_swap.c +++ b/extras/volume_id/lib/linux_swap.c @@ -57,6 +57,7 @@ int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size return -1; if (memcmp(buf, "SWAP-SPACE", 10) == 0) { + id->type = "swap"; strcpy(id->type_version, "1"); goto found; } -- cgit v1.2.3-54-g00ecf From 04f2a4fb6eded359cc8be1ba4ce33d7f7db6919f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 23 Jan 2009 03:55:24 +0100 Subject: doc: writing udev rules - refer to 'udevadm info' instead of 'udevinfo' Signed-off-by: Miklos Vajna --- docs/writing_udev_rules/index.html | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index 5fedb3f8c0..ca4fb9d311 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -52,7 +52,7 @@ The most recent version of this document can always be found at:
                  • Finding suitable information from sysfs
                  • @@ -429,15 +429,15 @@ In a udev rule, I could use ATTR{size}=="234441648" to identify this disk. As ud Although this serves as a useful introduction as to the structure of sysfs and exactly how udev matches values, manually trawling through sysfs is both time consuming and unnecessary.

                    - -

                    udevinfo

                    + +

                    udevadm info

                    -Enter udevinfo, which is probably the most straightforward tool you can use to construct rules. All you need to know is the sysfs device path of the device in question. A trimmed example is shown below: +Enter udevadm info, which is probably the most straightforward tool you can use to construct rules. All you need to know is the sysfs device path of the device in question. A trimmed example is shown below:

                    -# udevinfo -a -p /sys/block/sda
                    +# udevadm info -a -p /sys/block/sda
                     
                       looking at device '/block/sda':
                         KERNEL=="sda"
                    @@ -476,7 +476,7 @@ Enter udevinfo, which is probably the most straightforward tool you can
                     

                    -As you can see, udevinfo simply produces a list of attributes you can use as-is as match keys in your udev rules. From the above example, I could produce (e.g.) either of the following two rules for this device: +As you can see, udevadm info simply produces a list of attributes you can use as-is as match keys in your udev rules. From the above example, I could produce (e.g.) either of the following two rules for this device:

                    @@ -495,24 +495,24 @@ You are usually provided with a large number of attributes, and you must pick a
                     

                    -Observe the effects of hierarchy in the udevinfo output. The green section corresponding to the device in question uses the standard match keys such as KERNEL and ATTR. The blue and maroon sections corresponding to parent devices use the parent-traversing variants such as SUBSYSTEMS and ATTRS. This is why the complexity introduced by the hierarchical structure is actually quite easy to deal with, just be sure to use the exact values that udevinfo suggests. +Observe the effects of hierarchy in the udevadm info output. The green section corresponding to the device in question uses the standard match keys such as KERNEL and ATTR. The blue and maroon sections corresponding to parent devices use the parent-traversing variants such as SUBSYSTEMS and ATTRS. This is why the complexity introduced by the hierarchical structure is actually quite easy to deal with, just be sure to use the exact values that udevadm info suggests.

                    -Another point to note is that it is common for text attributes to appear in the udevinfo output to be padded with spaces (e.g. see ST3120827AS above). In your rules, you can either specify the extra spaces, or you can cut them off as I have done. +Another point to note is that it is common for text attributes to appear in the udevadm info output to be padded with spaces (e.g. see ST3120827AS above). In your rules, you can either specify the extra spaces, or you can cut them off as I have done.

                    -The only complication with using udevinfo is that you are required to know the top-level device path (/sys/block/sda in the example above). This is not always obvious. However, as you are generally writing rules for device nodes which already exist, you can use udevinfo to look up the device path for you: +The only complication with using udevadm info is that you are required to know the top-level device path (/sys/block/sda in the example above). This is not always obvious. However, as you are generally writing rules for device nodes which already exist, you can use udevadm info to look up the device path for you:

                    -
                    # udevinfo -a -p $(udevinfo -q path -n /dev/sda)
                    +
                    # udevadm info -a -p $(udevadm info -q path -n /dev/sda)

                    Alternative methods

                    -Although udevinfo is almost certainly the most straightforward way of listing the exact attributes you can build rules from, some users are happier with other tools. Utilities such as usbview display a similar set of information, most of which can be used in rules. +Although udevadm info is almost certainly the most straightforward way of listing the exact attributes you can build rules from, some users are happier with other tools. Utilities such as usbview display a similar set of information, most of which can be used in rules.

                    Advanced topics

                    @@ -659,11 +659,11 @@ For example, the rule below sets the group ownership on my hard disk node, and e

                    USB Printer

                    -I power on my printer, and it is assigned device node /dev/lp0. Not satisfied with such a bland name, I decide to use udevinfo to aid me in writing a rule which will provide an alternative name: +I power on my printer, and it is assigned device node /dev/lp0. Not satisfied with such a bland name, I decide to use udevadm info to aid me in writing a rule which will provide an alternative name:

                    -# udevinfo -a -p $(udevinfo -q path -n /dev/lp0)
                    +# udevadm info -a -p $(udevadm info -q path -n /dev/lp0)
                       looking at device '/class/usb/lp0':
                         KERNEL=="lp0"
                         SUBSYSTEM=="usb"
                    @@ -695,7 +695,7 @@ Not all cameras work in this way: some of them use a non-storage protocol such a
                     

                    -A common complication with USB camera devices is that they usually identify themselves as a disk with a single partition, in this case /dev/sdb with /dev/sdb1. The sdb node is useless to me, but sdb1 is interesting - this is the one I want to mount. There is a problem here that because sysfs is chained, the useful attributes which udevinfo produces for /dev/sdb1 are identical to the ones for /dev/sdb. This results in your rule potentially matching both the raw disk and the partition, which is not what you want, your rule should be specific. +A common complication with USB camera devices is that they usually identify themselves as a disk with a single partition, in this case /dev/sdb with /dev/sdb1. The sdb node is useless to me, but sdb1 is interesting - this is the one I want to mount. There is a problem here that because sysfs is chained, the useful attributes which udevadm info produces for /dev/sdb1 are identical to the ones for /dev/sdb. This results in your rule potentially matching both the raw disk and the partition, which is not what you want, your rule should be specific.

                    @@ -703,7 +703,7 @@ To get around this, you simply need to think about what differs between sdb and

                    -# udevinfo -a -p $(udevinfo -q path -n /dev/sdb1)
                    +# udevadm info -a -p $(udevadm info -q path -n /dev/sdb1)
                       looking at device '/block/sdb/sdb1':
                         KERNEL=="sdb1"
                         SUBSYSTEM=="block"
                    @@ -781,7 +781,7 @@ These devices work as USB-serial devices, so by default, you only get the tt
                     
                    SUBSYSTEMS=="usb", ATTRS{product}=="Palm Handheld", KERNEL=="ttyUSB*", SYMLINK+="pilot"

                    -Note that the product string seems to vary from product to product, so make sure that you check (using udevinfo) which one applies to you. +Note that the product string seems to vary from product to product, so make sure that you check (using udevadm info) which one applies to you.

                    @@ -808,11 +808,11 @@ Even though they are referenced by names, network interfaces typically do not ha

                    -It makes sense to simply match the MAC address of your interface in the rule, as this is unique. However, make sure that you use the exact MAC address as shown as udevinfo, because if you do not match the case exactly, your rule will not work. +It makes sense to simply match the MAC address of your interface in the rule, as this is unique. However, make sure that you use the exact MAC address as shown as udevadm info, because if you do not match the case exactly, your rule will not work.

                    -# udevinfo -a -p /sys/class/net/eth0
                    +# udevadm info -a -p /sys/class/net/eth0
                       looking at class device '/sys/class/net/eth0':
                         KERNEL=="eth0"
                         ATTR{address}=="00:52:8b:d5:04:48"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 722af2d0d346803dc15bff825703f705bafa830c Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sun, 25 Jan 2009 21:21:43 +0100
                    Subject: man: fix grammar
                    
                    Reported-by: Robert Peterson 
                    ---
                     udev/udev.xml | 4 ++--
                     1 file changed, 2 insertions(+), 2 deletions(-)
                    
                    diff --git a/udev/udev.xml b/udev/udev.xml
                    index 4c35e19791..6a92154cc1 100644
                    --- a/udev/udev.xml
                    +++ b/udev/udev.xml
                    @@ -90,7 +90,7 @@
                               pointing to the node, or run a specified program as part of the event handling.
                               If no matching rule is found, the default device node name is used.
                     
                    -          A rule may consist of a list of one or more key value pairs separated by
                    +          A rule consists of a list of one or more key value pairs separated by
                               a comma. Each key has a distinct operation, depending on the used operator. Valid
                               operators are:
                               
                    @@ -104,7 +104,7 @@
                                 
                                   
                                   
                    -                Compare for non-equality.
                    +                Compare for inequality.
                                   
                                 
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 705e1c7ffe417a04334877707c2eddf42418b0f6 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sun, 25 Jan 2009 21:25:41 +0100
                    Subject: version bump
                    
                    ---
                     NEWS         | 3 +++
                     configure.ac | 4 ++--
                     2 files changed, 5 insertions(+), 2 deletions(-)
                    
                    diff --git a/NEWS b/NEWS
                    index 972b9b0b11..1737d9faea 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -1,3 +1,6 @@
                    +udev 138
                    +========
                    +
                     udev 137
                     ========
                     Bugfixes.
                    diff --git a/configure.ac b/configure.ac
                    index 81fff06f30..7fbc42c41b 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -1,5 +1,5 @@
                     AC_INIT([udev],
                    -	[137],
                    +	[138],
                     	[linux-hotplug@vger.kernel.org])
                     AC_PREREQ(2.60)
                     AC_CONFIG_SRCDIR([udev/udevd.c])
                    @@ -23,7 +23,7 @@ AC_SUBST(LIBUDEV_LT_AGE)
                     
                     dnl /* libvolume_id version */
                     VOLID_LT_CURRENT=1
                    -VOLID_LT_REVISION=8
                    +VOLID_LT_REVISION=9
                     VOLID_LT_AGE=0
                     AC_SUBST(VOLID_LT_CURRENT)
                     AC_SUBST(VOLID_LT_REVISION)
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 57d057d28d96fdbf36b7a5f32ded7af5d3b8d6f1 Mon Sep 17 00:00:00 2001
                    From: Matthias Schwarzott 
                    Date: Tue, 27 Jan 2009 11:56:45 +0100
                    Subject: rules: Gentoo update
                    
                    ---
                     rules/gentoo/40-gentoo.rules      | 21 +++++++++++++++++----
                     rules/gentoo/65-permissions.rules | 26 --------------------------
                     2 files changed, 17 insertions(+), 30 deletions(-)
                     delete mode 100644 rules/gentoo/65-permissions.rules
                    
                    diff --git a/rules/gentoo/40-gentoo.rules b/rules/gentoo/40-gentoo.rules
                    index 99a1c66c69..4751b51bce 100644
                    --- a/rules/gentoo/40-gentoo.rules
                    +++ b/rules/gentoo/40-gentoo.rules
                    @@ -1,12 +1,25 @@
                     # do not edit this file, it will be overwritten on update
                     
                    -# capi devices
                    -KERNEL=="capi",		NAME="capi20", SYMLINK+="isdn/capi20"
                    -KERNEL=="capi*",	NAME="capi/%n"
                    -
                     # old devfs path, removing this could break systems
                     # Bug 195839
                     KERNEL=="md[0-9]*",	SYMLINK+="md/%n"
                     KERNEL=="loop[0-9]*",	SYMLINK+="loop/%n"
                     KERNEL=="ram[0-9]*",	SYMLINK+="rd/%n"
                     
                    +# keep devices after driver unload
                    +KERNEL=="ppp", OPTIONS+="ignore_remove"
                    +KERNEL=="tun", OPTIONS+="ignore_remove"
                    +
                    +
                    +# setting permissions
                    +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb"
                    +
                    +# dialout devices
                    +KERNEL=="ippp*|isdn*|dcbri*|rfcomm*|ttyACM[0-9]*|pilot", GROUP="dialout"
                    +
                    +# sound devices (oss)
                    +SUBSYSTEM=="snd",	GROUP="audio"
                    +
                    +# Sony Vaio Jogdial sonypi device
                    +KERNEL=="sonypi",	MODE="0666"
                    +
                    diff --git a/rules/gentoo/65-permissions.rules b/rules/gentoo/65-permissions.rules
                    deleted file mode 100644
                    index 173e08783d..0000000000
                    --- a/rules/gentoo/65-permissions.rules
                    +++ /dev/null
                    @@ -1,26 +0,0 @@
                    -# do not edit this file, it will be overwritten on update
                    -
                    -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb", MODE="664"
                    -
                    -# cdrom devices
                    -ENV{ID_CDROM}=="?*", GROUP="cdrom", MODE="660"
                    -KERNEL=="pktcdvd|pktcdvd[0-9]*", GROUP="cdrom", MODE="660"
                    -# assign cdrom-permission also to associated generic device (for cd-burning ...)
                    -SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[45]", GROUP="cdrom", MODE="660"
                    -
                    -
                    -# tape devices
                    -KERNEL=="st[0-9]*|nst[0-9]*|ht[0-9]*|nht[0-9]*|pt[0-9]*|npt[0-9]*", \
                    -	GROUP="tape", MODE="660"
                    -SUBSYSTEMS=="scsi", KERNEL=="sg[0-9]*", ATTRS{type}=="[18]", GROUP="tape", MODE="660"
                    -
                    -# dialout devices
                    -KERNEL=="ippp*|isdn*|dcbri*|capi*|rfcomm*|ttyACM[0-9]*", GROUP="uucp"
                    -KERNEL=="pilot",	GROUP="uucp"
                    -
                    -# sound devices (sound=alsa, snd=oss)
                    -SUBSYSTEM=="sound|snd",	GROUP="audio"
                    -
                    -# Sony Vaio Jogdial sonypi device
                    -KERNEL=="sonypi",	MODE="0666"
                    -
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 647f7c49e8ddfbbe2afd9545484a3ad936f438e9 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Fri, 30 Jan 2009 03:53:09 +0100
                    Subject: fix NAME="" logic
                    
                    Reported-By: Soh Kam Yung 
                    ---
                     test/udev-test.pl | 40 +++++++++++++++++++++-------------------
                     udev/udev-rules.c | 40 +---------------------------------------
                     2 files changed, 22 insertions(+), 58 deletions(-)
                    
                    diff --git a/test/udev-test.pl b/test/udev-test.pl
                    index 61e91c48b6..1b81eb8d72 100755
                    --- a/test/udev-test.pl
                    +++ b/test/udev-test.pl
                    @@ -1032,7 +1032,7 @@ EOF
                     		not_exp_name	=> "node",
                     		exp_add_error	=> "yes",
                     		rules		=> < "tty",
                     		devpath		=> "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                     		exp_name	=> "",
                    +		not_exp_name	=> "ttyACM0",
                    +		exp_add_error	=> "yes",
                    +		rules		=> < "test empty NAME (empty override)",
                    +		subsys		=> "tty",
                    +		devpath		=> "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                    +		exp_name	=> "",
                     		not_exp_name	=> "wrong",
                     		exp_add_error	=> "yes",
                     		rules		=> < "test empty NAME 2",
                    +		desc		=> "test empty NAME (non-empty override)",
                     		subsys		=> "tty",
                     		devpath		=> "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
                     		exp_name	=> "right",
                    @@ -1593,16 +1604,6 @@ EOF
                     		rules		=> < "TEST invalid NAME= only (skip invalid rule)",
                    -		subsys		=> "block",
                    -		devpath		=> "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                    -		exp_name	=> "yes",
                    -		rules		=> <{subsys}, $rules->{devpath}, \$rules->{rules});
                    +	if (defined($rules->{not_exp_name})) {
                    +		if ((-e "$PWD/$udev_root$rules->{not_exp_name}") ||
                    +		    (-l "$PWD/$udev_root$rules->{not_exp_name}")) {
                    +			print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n";
                    +			$error++
                    +		}
                    +	}
                    +
                     	if ((-e "$PWD/$udev_root$rules->{exp_name}") ||
                     	    (-l "$PWD/$udev_root$rules->{exp_name}")) {
                     
                     		my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size,
                     		    $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$rules->{exp_name}");
                     
                    -		if (defined($rules->{not_exp_name})) {
                    -			if ((-e "$PWD/$udev_root$rules->{not_exp_name}") ||
                    -			    (-l "$PWD/$udev_root$rules->{not_exp_name}")) {
                    -				print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n";
                    -				$error++
                    -			}
                    -		}
                     		if (defined($rules->{exp_perms})) {
                     			permissions_test($rules, $uid, $gid, $mode);
                     		}
                    diff --git a/udev/udev-rules.c b/udev/udev-rules.c
                    index ccf1eaaf8f..52638aeb1d 100644
                    --- a/udev/udev-rules.c
                    +++ b/udev/udev-rules.c
                    @@ -1131,7 +1131,6 @@ static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp)
                     static int add_rule(struct udev_rules *rules, char *line,
                     		    const char *filename, unsigned int filename_off, unsigned int lineno)
                     {
                    -	int valid = 0;
                     	char *linepos;
                     	char *attr;
                     	int physdev = 0;
                    @@ -1159,7 +1158,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				goto invalid;
                     			}
                     			rule_add_key(&rule_tmp, TK_M_ACTION, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1169,7 +1167,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				goto invalid;
                     			}
                     			rule_add_key(&rule_tmp, TK_M_DEVPATH, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1179,7 +1176,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				goto invalid;
                     			}
                     			rule_add_key(&rule_tmp, TK_M_KERNEL, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1198,7 +1194,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, "subsystem|class|bus", NULL);
                     			} else
                     				rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1208,7 +1203,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				goto invalid;
                     			}
                     			rule_add_key(&rule_tmp, TK_M_DRIVER, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1223,7 +1217,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     			} else {
                     				rule_add_key(&rule_tmp, TK_A_ATTR, op, value, attr);
                     			}
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1234,7 +1227,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				goto invalid;
                     			}
                     			rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1245,7 +1237,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				goto invalid;
                     			}
                     			rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1255,7 +1246,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				goto invalid;
                     			}
                     			rule_add_key(&rule_tmp, TK_M_DRIVERS, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1277,7 +1267,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				err(rules->udev, "do not reference parent sysfs directories directly, "
                     				    "it may break with a future kernel, please fix it in %s:%u", filename, lineno);
                     			rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1296,13 +1285,11 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				if (rule_add_key(&rule_tmp, TK_A_ENV, op, value, attr) != 0)
                     					goto invalid;
                     			}
                    -			valid = 1;
                     			continue;
                     		}
                     
                     		if (strcasecmp(key, "PROGRAM") == 0) {
                     			rule_add_key(&rule_tmp, TK_M_PROGRAM, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1312,7 +1299,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				goto invalid;
                     			}
                     			rule_add_key(&rule_tmp, TK_M_RESULT, op, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1321,15 +1307,12 @@ static int add_rule(struct udev_rules *rules, char *line,
                     			if (attr != NULL && strstr(attr, "program")) {
                     				dbg(rules->udev, "IMPORT will be executed\n");
                     				rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL);
                    -				valid = 1;
                     			} else if (attr != NULL && strstr(attr, "file")) {
                     				dbg(rules->udev, "IMPORT will be included as file\n");
                     				rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL);
                    -				valid = 1;
                     			} else if (attr != NULL && strstr(attr, "parent")) {
                     				dbg(rules->udev, "IMPORT will include the parent values\n");
                     				rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL);
                    -				valid = 1;
                     			} else {
                     				/* figure it out if it is executable */
                     				char file[UTIL_PATH_SIZE];
                    @@ -1354,11 +1337,9 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) {
                     					dbg(rules->udev, "IMPORT will be executed (autotype)\n");
                     					rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL);
                    -					valid = 1;
                     				} else {
                     					dbg(rules->udev, "IMPORT will be included as file (autotype)\n");
                     					rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL);
                    -					valid = 1;
                     				}
                     			}
                     			continue;
                    @@ -1378,7 +1359,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     			} else {
                     				rule_add_key(&rule_tmp, TK_M_TEST, op, value, NULL);
                     			}
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1389,26 +1369,22 @@ static int add_rule(struct udev_rules *rules, char *line,
                     			if (attr != NULL && strstr(attr, "ignore_error"))
                     				flag = 1;
                     			rule_add_key(&rule_tmp, TK_A_RUN, op, value, &flag);
                    -			valid = 1;
                     			continue;
                     		}
                     
                     		if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) {
                     			rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL);
                    -			valid = 1;
                     			waitfor = 1;
                     			continue;
                     		}
                     
                     		if (strcasecmp(key, "LABEL") == 0) {
                     			rule_tmp.rule.rule.label_off = add_string(rules, value);
                    -			valid = 1;
                     			continue;
                     		}
                     
                     		if (strcasecmp(key, "GOTO") == 0) {
                     			rule_add_key(&rule_tmp, TK_A_GOTO, 0, value, NULL);
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1417,7 +1393,7 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL);
                     			} else {
                     				if (value[0] == '\0')
                    -					dbg(rules->udev, "name empty, node creation suppressed\n");
                    +					info(rules->udev, "name empty, node creation suppressed\n");
                     				rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL);
                     				attr = get_key_attribute(rules->udev, key + sizeof("NAME")-1);
                     				if (attr != NULL) {
                    @@ -1443,7 +1419,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     			else
                     				rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, NULL);
                     			rule_tmp.rule.rule.flags = 1;
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1461,7 +1436,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL);
                     			}
                     			rule_tmp.rule.rule.flags = 1;
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1479,7 +1453,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL);
                     			}
                     			rule_tmp.rule.rule.flags = 1;
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1493,7 +1466,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     			else
                     				rule_add_key(&rule_tmp, TK_A_MODE, op, value, NULL);
                     			rule_tmp.rule.rule.flags = 1;
                    -			valid = 1;
                     			continue;
                     		}
                     
                    @@ -1540,7 +1512,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				rule_add_key(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num);
                     				dbg(rules->udev, "creation of partition nodes requested\n");
                     			}
                    -			valid = 1;
                     			continue;
                     		}
                     		err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno);
                    @@ -1550,10 +1521,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     		err(rules->udev, "PHYSDEV* values are deprecated and not available on recent kernels, "
                     		    "please fix it in %s:%u\n", filename, lineno);
                     
                    -	/* skip line if no valid key was found */
                    -	if (!valid)
                    -		goto invalid;
                    -
                     	/* add rule token */
                     	rule_tmp.rule.rule.token_count = 1 + rule_tmp.token_cur;
                     	if (add_token(rules, &rule_tmp.rule) != 0)
                    @@ -2398,11 +2365,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
                     					break;
                     				if (cur->key.op == OP_ASSIGN_FINAL)
                     					event->name_final = 1;
                    -				if (name[0] == '\0') {
                    -					free(event->name);
                    -					event->name = NULL;
                    -					break;
                    -				}
                     				util_strlcpy(name_str, name, sizeof(name_str));
                     				udev_event_apply_format(event, name_str, sizeof(name_str));
                     				if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) {
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 198882e9ae1dc65bbca3c00fa67a711c80f3a89c Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Fri, 30 Jan 2009 13:18:59 +0100
                    Subject: rules: dm - add escape for uuid links with whitespace
                    
                    ---
                     rules/suse/64-device-mapper.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/suse/64-device-mapper.rules b/rules/suse/64-device-mapper.rules
                    index e0a63eee72..bc5d7ea629 100644
                    --- a/rules/suse/64-device-mapper.rules
                    +++ b/rules/suse/64-device-mapper.rules
                    @@ -9,7 +9,7 @@ IMPORT{program}="/sbin/dmsetup export -j%M -m%m"
                     ENV{DM_NAME}!="?*", GOTO="device_mapper_end"
                     
                     SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}", OPTIONS+="string_escape=replace"
                    -ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}"
                    +ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}", OPTIONS+="string_escape=replace"
                     
                     ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end"
                     ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From a402404fb23195839a9e008dbbe5edb5349c05b0 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 5 Feb 2009 12:40:15 +0100
                    Subject: test: add test for empty and non-existent ATTR
                    
                    ---
                     .../target0:0:0/0:0:0:0/block/sda/test_empty_file  |  0
                     test/udev-test.pl                                  | 27 ++++++++++++++++++++++
                     udev/udevadm-settle.c                              |  2 ++
                     3 files changed, 29 insertions(+)
                     create mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file
                    
                    diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file
                    new file mode 100644
                    index 0000000000..e69de29bb2
                    diff --git a/test/udev-test.pl b/test/udev-test.pl
                    index 1b81eb8d72..4f61ce3e5d 100755
                    --- a/test/udev-test.pl
                    +++ b/test/udev-test.pl
                    @@ -480,6 +480,33 @@ EOF
                     		rules		=> < "ATTR (empty file)",
                    +		subsys		=> "tty",
                    +		devpath		=> "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                    +		exp_name	=> "empty" ,
                    +		rules		=> < "ATTR (non-existent file)",
                    +		subsys		=> "tty",
                    +		devpath		=> "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
                    +		exp_name	=> "non-existent" ,
                    +		rules		=> <
                    Date: Thu, 5 Feb 2009 14:03:17 +0100
                    Subject: rules: fix md "change"/"remove" handling
                    
                    On Thu, Feb 5, 2009 at 08:43, Harald Hoyer  wrote:
                    > Radek Vykydal  encountered a problem with md devices.
                    > If the raid is about to be removed a "change" and "remove" event is sent.
                    ---
                     rules/packages/64-md-raid.rules | 1 +
                     1 file changed, 1 insertion(+)
                    
                    diff --git a/rules/packages/64-md-raid.rules b/rules/packages/64-md-raid.rules
                    index 6fe4d46dc9..def184f42c 100644
                    --- a/rules/packages/64-md-raid.rules
                    +++ b/rules/packages/64-md-raid.rules
                    @@ -11,6 +11,7 @@ KERNEL!="md*", GOTO="md_end"
                     # container devices have a metadata version of e.g. 'external:ddf' and
                     # never leave state 'inactive'
                     ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
                    +TEST!="md/array_state", GOTO="md_end"
                     ATTR{md/array_state}=="|clear|inactive", GOTO="md_end"
                     LABEL="md_ignore_state"
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 9dc4a84a255107cb9eea906e1de3f546c26bc55c Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 5 Feb 2009 19:01:27 +0100
                    Subject: autogen.sh: add more warnings
                    
                    ---
                     autogen.sh | 3 ++-
                     1 file changed, 2 insertions(+), 1 deletion(-)
                    
                    diff --git a/autogen.sh b/autogen.sh
                    index be3b6749b8..fb96d4aeb1 100755
                    --- a/autogen.sh
                    +++ b/autogen.sh
                    @@ -6,7 +6,8 @@ CFLAGS="-g -Wall \
                     -Wmissing-declarations -Wmissing-prototypes \
                     -Wnested-externs -Wpointer-arith \
                     -Wpointer-arith -Wsign-compare -Wchar-subscripts \
                    --Wstrict-prototypes -Wshadow"
                    +-Wstrict-prototypes -Wshadow \
                    +-Wformat=2 -Wtype-limits"
                     args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux"
                     libdir=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd))
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 10b2d011e70ddf9361c61f6147dc88f670d28abd Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sun, 8 Feb 2009 16:02:15 +0100
                    Subject: fix NAME= and OPTION+="string_escape=..." logic
                    
                    Scott discovered this silly bug.
                    ---
                     udev/udev-rules.c | 12 ++++++------
                     1 file changed, 6 insertions(+), 6 deletions(-)
                    
                    diff --git a/udev/udev-rules.c b/udev/udev-rules.c
                    index 52638aeb1d..f0b11aa85b 100644
                    --- a/udev/udev-rules.c
                    +++ b/udev/udev-rules.c
                    @@ -2371,13 +2371,13 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
                     					count = udev_util_replace_chars(name_str, "/");
                     					if (count > 0)
                     						info(event->udev, "%i character(s) replaced\n", count);
                    -					free(event->name);
                    -					event->name = strdup(name_str);
                    -					info(event->udev, "NAME '%s' %s:%u\n",
                    -					     event->name,
                    -					     &rules->buf[rule->rule.filename_off],
                    -					     rule->rule.filename_line);
                     				}
                    +				free(event->name);
                    +				event->name = strdup(name_str);
                    +				info(event->udev, "NAME '%s' %s:%u\n",
                    +				     event->name,
                    +				     &rules->buf[rule->rule.filename_off],
                    +				     rule->rule.filename_line);
                     				break;
                     			}
                     		case TK_A_DEVLINK:
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From bd284db142c1d3fb6e2a709678c8828c12c52466 Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Wed, 11 Feb 2009 17:38:56 +0000
                    Subject: udevd: optionally watch device nodes with inotify
                    
                    This allows you to re-process the rules if the content of the device
                    has been changed, most useful for block subsystem to cause vol_id to
                    be run again.
                    ---
                     NEWS              |   2 +
                     udev/Makefile.am  |   1 +
                     udev/udev-event.c |   8 ++
                     udev/udev-rules.c |  12 +++
                     udev/udev-watch.c | 236 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
                     udev/udev.h       |  16 ++++
                     udev/udev.xml     |   7 ++
                     udev/udevd.c      |  84 +++++++++++++------
                     8 files changed, 340 insertions(+), 26 deletions(-)
                     create mode 100644 udev/udev-watch.c
                    
                    diff --git a/NEWS b/NEWS
                    index 1737d9faea..98f4937fa8 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -1,5 +1,7 @@
                     udev 138
                     ========
                    +Device nodes can be watched for changes with inotify with OPTIONS="watch".  If
                    +closed after being opened for writing, a "change" uevent will occur.
                     
                     udev 137
                     ========
                    diff --git a/udev/Makefile.am b/udev/Makefile.am
                    index 2d185f477d..fa8279dd61 100644
                    --- a/udev/Makefile.am
                    +++ b/udev/Makefile.am
                    @@ -16,6 +16,7 @@ common_files = \
                     	udev.h \
                     	udev-sysdeps.h \
                     	udev-event.c \
                    +	udev-watch.c \
                     	udev-node.c \
                     	udev-rules.c \
                     	udev-util.c \
                    diff --git a/udev/udev-event.c b/udev/udev-event.c
                    index e34f09cfe3..592da01099 100644
                    --- a/udev/udev-event.c
                    +++ b/udev/udev-event.c
                    @@ -600,6 +600,14 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     
                     		/* create new node and symlinks */
                     		err = udev_node_add(dev, event->mode, event->uid, event->gid);
                    +
                    +		/* watch for changes */
                    +		if (event->inotify_watch && inotify_fd != -1) {
                    +			info(event->udev, "device will be watched for changes\n");
                    +			udev_watch_begin(event->udev, event->dev);
                    +		} else {
                    +			udev_watch_clear(event->udev, event->dev);
                    +		}
                     		goto exit;
                     	}
                     
                    diff --git a/udev/udev-rules.c b/udev/udev-rules.c
                    index f0b11aa85b..3751cbb36d 100644
                    --- a/udev/udev-rules.c
                    +++ b/udev/udev-rules.c
                    @@ -140,6 +140,7 @@ enum token_type {
                     	TK_A_IGNORE_DEVICE,
                     	TK_A_STRING_ESCAPE_NONE,
                     	TK_A_STRING_ESCAPE_REPLACE,
                    +	TK_A_INOTIFY_WATCH,
                     	TK_A_NUM_FAKE_PART,		/* int */
                     	TK_A_DEVLINK_PRIO,		/* int */
                     	TK_A_OWNER,			/* val */
                    @@ -270,6 +271,7 @@ static const char *token_str(enum token_type type)
                     		[TK_A_IGNORE_DEVICE] =		"A IGNORE_DEVICE",
                     		[TK_A_STRING_ESCAPE_NONE] =	"A STRING_ESCAPE_NONE",
                     		[TK_A_STRING_ESCAPE_REPLACE] =	"A STRING_ESCAPE_REPLACE",
                    +		[TK_A_INOTIFY_WATCH] = 		"A INOTIFY_WATCH",
                     		[TK_A_NUM_FAKE_PART] =		"A NUM_FAKE_PART",
                     		[TK_A_DEVLINK_PRIO] =		"A DEVLINK_PRIO",
                     		[TK_A_OWNER] =			"A OWNER",
                    @@ -352,6 +354,7 @@ static void dump_token(struct udev_rules *rules, struct token *token)
                     	case TK_A_IGNORE_DEVICE:
                     	case TK_A_STRING_ESCAPE_NONE:
                     	case TK_A_STRING_ESCAPE_REPLACE:
                    +	case TK_A_INOTIFY_WATCH:
                     	case TK_A_LAST_RULE:
                     	case TK_A_IGNORE_REMOVE:
                     		dbg(rules->udev, "%s\n", token_str(type));
                    @@ -1020,6 +1023,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
                     	case TK_A_IGNORE_DEVICE:
                     	case TK_A_STRING_ESCAPE_NONE:
                     	case TK_A_STRING_ESCAPE_REPLACE:
                    +	case TK_A_INOTIFY_WATCH:
                     	case TK_A_IGNORE_REMOVE:
                     	case TK_A_LAST_RULE:
                     		break;
                    @@ -1512,6 +1516,11 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				rule_add_key(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num);
                     				dbg(rules->udev, "creation of partition nodes requested\n");
                     			}
                    +			pos = strstr(value, "watch");
                    +			if (pos != NULL) {
                    +				rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, 0, NULL, NULL);
                    +				dbg(rules->udev, "inotify watch of device requested\n");
                    +			}
                     			continue;
                     		}
                     		err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno);
                    @@ -2244,6 +2253,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
                     				break;
                     			udev_device_set_num_fake_partitions(event->dev, cur->key.num_fake_part);
                     			break;
                    +		case TK_A_INOTIFY_WATCH:
                    +			event->inotify_watch = 1;
                    +			break;
                     		case TK_A_DEVLINK_PRIO:
                     			udev_device_set_devlink_priority(event->dev, cur->key.devlink_prio);
                     			break;
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    new file mode 100644
                    index 0000000000..24df481cf8
                    --- /dev/null
                    +++ b/udev/udev-watch.c
                    @@ -0,0 +1,236 @@
                    +/*
                    + * Copyright (C) 2004-2008 Kay Sievers 
                    + * Copyright (C) 2009 Canonical Ltd.
                    + *
                    + * 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, either version 2 of the License, or
                    + * (at your option) any later version.
                    + *
                    + * 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, see .
                    + */
                    +
                    +#include 
                    +#include 
                    +#include 
                    +#include 
                    +#include 
                    +#include 
                    +#include 
                    +#include 
                    +#include 
                    +#ifdef HAVE_INOTIFY
                    +#include 
                    +#endif
                    +
                    +#include "udev.h"
                    +
                    +int inotify_fd = -1;
                    +
                    +/* inotify descriptor, will be shared with rules directory;
                    + * set to cloexec since we need our children to be able to add
                    + * watches for us
                    + */
                    +void udev_watch_init(struct udev *udev)
                    +{
                    +	inotify_fd = inotify_init();
                    +	if (inotify_fd >= 0) {
                    +		int flags;
                    +
                    +		flags = fcntl(inotify_fd, F_GETFD);
                    +		if (flags < 0)
                    +			flags = FD_CLOEXEC;
                    +		else
                    +			flags |= FD_CLOEXEC;
                    +		fcntl(inotify_fd, F_SETFD, flags);
                    +	} else if (errno == ENOSYS)
                    +		info(udev, "unable to use inotify, udevd will not monitor rule files changes\n");
                    +	else
                    +		err(udev, "inotify_init failed: %m\n");
                    +}
                    +
                    +/* move any old watches directory out of the way, and then restore
                    + * the watches
                    + */
                    +void udev_watch_restore(struct udev *udev)
                    +{
                    +	char filename[UTIL_PATH_SIZE], oldname[UTIL_PATH_SIZE];
                    +
                    +	if (inotify_fd < 0)
                    +		return;
                    +
                    +	util_strlcpy(oldname, udev_get_dev_path(udev), sizeof(oldname));
                    +	util_strlcat(oldname, "/.udev/watch.old", sizeof(oldname));
                    +
                    +	util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
                    +	util_strlcat(filename, "/.udev/watch", sizeof(filename));
                    +
                    +	if (rename(filename, oldname) == 0) {
                    +		DIR *dir;
                    +		struct dirent *ent;
                    +
                    +		dir = opendir(oldname);
                    +		if (dir == NULL) {
                    +			err(udev, "unable to open old watches dir '%s', old watches will not be restored: %m", oldname);
                    +			return;
                    +		}
                    +
                    +		while ((ent = readdir(dir)) != NULL) {
                    +			char path[UTIL_PATH_SIZE];
                    +			char buf[UTIL_PATH_SIZE];
                    +			ssize_t len;
                    +			struct udev_device *dev;
                    +
                    +			if (ent->d_name[0] < '0' || ent->d_name[0] > '9')
                    +				continue;
                    +
                    +			util_strlcpy(path, oldname, sizeof(path));
                    +			util_strlcat(path, "/", sizeof(path));
                    +			util_strlcat(path, ent->d_name, sizeof(path));
                    +
                    +			len = readlink(path, buf, sizeof(buf));
                    +			if (len <= 0) {
                    +				unlink(path);
                    +				continue;
                    +			}
                    +
                    +			buf[len] = '\0';
                    +			dbg(udev, "old watch to '%s' found\n", buf);
                    +
                    +			dev = udev_device_new_from_syspath(udev, buf);
                    +			if (dev == NULL) {
                    +				unlink(path);
                    +				continue;
                    +			}
                    +
                    +			udev_device_read_db(dev);
                    +			udev_device_set_info_loaded(dev);
                    +
                    +			info(udev, "restoring old watch on '%s'\n", udev_device_get_devnode(dev));
                    +			udev_watch_begin(udev, dev);
                    +
                    +			udev_device_unref(dev);
                    +
                    +			unlink(path);
                    +		}
                    +
                    +		closedir(dir);
                    +		rmdir(oldname);
                    +
                    +	} else if (errno != ENOENT) {
                    +		err(udev, "unable to move watches dir '%s', old watches will not be restored: %m", filename);
                    +	}
                    +}
                    +
                    +static const char *udev_watch_filename(struct udev *udev, int wd)
                    +{
                    +	static char filename[UTIL_PATH_SIZE];
                    +	char str[32];
                    +
                    +	sprintf(str, "%d", wd);
                    +	util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
                    +	util_strlcat(filename, "/.udev/watch/", sizeof(filename));
                    +	util_strlcat(filename, str, sizeof(filename));
                    +
                    +	return filename;
                    +}
                    +
                    +void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                    +{
                    +	const char *filename;
                    +	int wd;
                    +
                    +	if (inotify_fd < 0)
                    +		return;
                    +
                    +	wd = inotify_add_watch (inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
                    +	if (wd < 0) {
                    +		err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n",
                    +		    inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
                    +	}
                    +
                    +	filename = udev_watch_filename(udev, wd);
                    +	util_create_path(udev, filename);
                    +	unlink(filename);
                    +	symlink(udev_device_get_syspath(dev), filename);
                    +}
                    +
                    +void udev_watch_clear(struct udev *udev, struct udev_device *dev)
                    +{
                    +	static char filename[UTIL_PATH_SIZE];
                    +	DIR *dir;
                    +	struct dirent *ent;
                    +
                    +	util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
                    +	util_strlcat(filename, "/.udev/watch", sizeof(filename));
                    +
                    +	dir = opendir(filename);
                    +	if (dir == NULL)
                    +		return;
                    +
                    +	while ((ent = readdir(dir)) != NULL) {
                    +		char path[UTIL_PATH_SIZE];
                    +		char buf[UTIL_PATH_SIZE];
                    +		ssize_t len;
                    +
                    +		if (ent->d_name[0] < '0' || ent->d_name[0] > '9')
                    +			continue;
                    +
                    +		util_strlcpy(path, filename, sizeof(path));
                    +		util_strlcat(path, "/", sizeof(path));
                    +		util_strlcat(path, ent->d_name, sizeof(path));
                    +
                    +		len = readlink(path, buf, sizeof(buf));
                    +		if (len <= 0)
                    +			continue;
                    +
                    +		buf[len] = '\0';
                    +		if (strcmp(buf, udev_device_get_syspath(dev)))
                    +			continue;
                    +
                    +		/* this is the watch we're looking for */
                    +		info(udev, "clearing existing watch on '%s'\n", udev_device_get_devnode(dev));
                    +		udev_watch_end(udev, atoi(ent->d_name));
                    +	}
                    +
                    +	closedir(dir);
                    +}
                    +
                    +void udev_watch_end(struct udev *udev, int wd)
                    +{
                    +	const char *filename;
                    +
                    +	if (inotify_fd < 0 || wd < 0)
                    +		return;
                    +
                    +	inotify_rm_watch(inotify_fd, wd);
                    +
                    +	filename = udev_watch_filename(udev, wd);
                    +	unlink(filename);
                    +}
                    +
                    +const char *udev_watch_lookup(struct udev *udev, int wd)
                    +{
                    +	const char *filename;
                    +	static char buf[UTIL_PATH_SIZE];
                    +	ssize_t len;
                    +
                    +	if (inotify_fd < 0 || wd < 0)
                    +		return NULL;
                    +
                    +	filename = udev_watch_filename(udev, wd);
                    +	len = readlink(filename, buf, sizeof(buf));
                    +	if (len > 0) {
                    +		buf[len] = '\0';
                    +
                    +		return buf;
                    +	}
                    +
                    +	return NULL;
                    +}
                    diff --git a/udev/udev.h b/udev/udev.h
                    index d1b207196e..57e2d73c2e 100644
                    --- a/udev/udev.h
                    +++ b/udev/udev.h
                    @@ -75,9 +75,16 @@ struct udev_event {
                     	unsigned int devlink_final:1;
                     	unsigned int run_final:1;
                     	unsigned int ignore_device:1;
                    +	unsigned int inotify_watch:1;
                     	unsigned int trace:1;
                     };
                     
                    +struct udev_watch {
                    +	struct udev_list_node node;
                    +	int handle;
                    +	char *name;
                    +};
                    +
                     /* udev-rules.c */
                     struct udev_rules;
                     extern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names);
                    @@ -93,6 +100,15 @@ extern void udev_event_apply_format(struct udev_event *event, char *string, size
                     extern int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string,
                     					  char *result, size_t maxsize, int read_value);
                     
                    +/* udev-watch.c */
                    +extern int inotify_fd;
                    +extern void udev_watch_init(struct udev *udev);
                    +extern void udev_watch_restore(struct udev *udev);
                    +extern void udev_watch_begin(struct udev *udev, struct udev_device *dev);
                    +extern void udev_watch_clear(struct udev *udev, struct udev_device *dev);
                    +extern void udev_watch_end(struct udev *udev, int wd);
                    +extern const char *udev_watch_lookup(struct udev *udev, int wd);
                    +
                     /* udev-node.c */
                     extern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid);
                     extern int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid);
                    diff --git a/udev/udev.xml b/udev/udev.xml
                    index 6a92154cc1..084c13bd98 100644
                    --- a/udev/udev.xml
                    +++ b/udev/udev.xml
                    @@ -457,6 +457,13 @@
                                           with this option.
                                         
                                       
                    +                  
                    +                    
                    +                    
                    +                      Watch the device node with inotify, when closed after being opened for
                    +		      writing, a change uevent will be synthesised.
                    +                    
                    +                  
                                     
                                   
                                 
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index d08cf30f29..d93781f411 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -65,7 +65,6 @@ static int debug_trace;
                     static struct udev_rules *rules;
                     static struct udev_ctrl *udev_ctrl;
                     static struct udev_monitor *kernel_monitor;
                    -static int inotify_fd = -1;
                     static volatile int sigchilds_waiting;
                     static volatile int udev_exit;
                     static volatile int reload_config;
                    @@ -195,8 +194,6 @@ static void event_fork(struct udev_event *event)
                     		/* child */
                     		udev_monitor_unref(kernel_monitor);
                     		udev_ctrl_unref(udev_ctrl);
                    -		if (inotify_fd >= 0)
                    -			close(inotify_fd);
                     		logging_close();
                     		logging_init("udevd-event");
                     		setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY);
                    @@ -513,6 +510,58 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl)
                     	udev_ctrl_msg_unref(ctrl_msg);
                     }
                     
                    +/* read inotify messages */
                    +static int handle_inotify(struct udev *udev)
                    +{
                    +	int nbytes, pos;
                    +	char *buf;
                    +	struct inotify_event *ev;
                    +	int reload_config = 0;
                    +
                    +	if ((ioctl(inotify_fd, FIONREAD, &nbytes) < 0) || (nbytes <= 0))
                    +		return 0;
                    +
                    +	buf = malloc(nbytes);
                    +	if (buf == NULL) {
                    +		err(udev, "error getting buffer for inotify, disable watching\n");
                    +		close(inotify_fd);
                    +		inotify_fd = -1;
                    +		return 0;
                    +	}
                    +
                    +	read(inotify_fd, buf, nbytes);
                    +
                    +	for (pos = 0, ev = (struct inotify_event *)(buf + pos); pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) {
                    +		const char *syspath;
                    +
                    +		dbg(udev, "inotify event: %x for %d (%s)\n", ev->mask, ev->wd, ev->len ? ev->name : "*");
                    +
                    +		syspath = udev_watch_lookup(udev, ev->wd);
                    +		if (syspath != NULL) {
                    +			dbg(udev, "inotify event: %x for %s\n", ev->mask, syspath);
                    +			if (ev->mask & IN_CLOSE_WRITE) {
                    +				char filename[UTIL_PATH_SIZE];
                    +				int fd;
                    +
                    +				info(udev, "device %s closed, synthesising write\n", syspath);
                    +				util_strlcpy(filename, syspath, sizeof(filename));
                    +				util_strlcat(filename, "/uevent", sizeof(filename));
                    +				fd = open(filename, O_WRONLY);
                    +				if (fd < 0 || write(fd, "change", 6) < 0)
                    +					info(udev, "error writing uevent: %m\n");
                    +				close(fd);
                    +			}
                    +			if (ev->mask & IN_IGNORED)
                    +				udev_watch_end(udev, ev->wd);
                    +		} else {
                    +			reload_config = 1;
                    +		}
                    +	}
                    +
                    +	free (buf);
                    +	return reload_config;
                    +}
                    +
                     static void asmlinkage sig_handler(int signum)
                     {
                     	switch (signum) {
                    @@ -838,7 +887,7 @@ int main(int argc, char *argv[])
                     	sigaction(SIGHUP, &act, NULL);
                     
                     	/* watch rules directory */
                    -	inotify_fd = inotify_init();
                    +	udev_watch_init(udev);
                     	if (inotify_fd >= 0) {
                     		if (udev_get_rules_path(udev) != NULL) {
                     			inotify_add_watch(inotify_fd, udev_get_rules_path(udev),
                    @@ -857,10 +906,9 @@ int main(int argc, char *argv[])
                     			inotify_add_watch(inotify_fd, filename,
                     					  IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
                     		}
                    -	} else if (errno == ENOSYS)
                    -		info(udev, "unable to use inotify, udevd will not monitor rule files changes\n");
                    -	else
                    -		err(udev, "inotify_init failed: %m\n");
                    +
                    +		udev_watch_restore(udev);
                    +	}
                     
                     	/* in trace mode run one event after the other */
                     	if (debug_trace) {
                    @@ -936,24 +984,8 @@ int main(int argc, char *argv[])
                     		}
                     
                     		/* rules directory inotify watch */
                    -		if (inotify_poll && (inotify_poll->revents & POLLIN)) {
                    -			int nbytes;
                    -
                    -			/* discard all possible events, we can just reload the config */
                    -			if ((ioctl(inotify_fd, FIONREAD, &nbytes) == 0) && nbytes > 0) {
                    -				char *buf;
                    -
                    -				reload_config = 1;
                    -				buf = malloc(nbytes);
                    -				if (buf == NULL) {
                    -					err(udev, "error getting buffer for inotify, disable watching\n");
                    -					close(inotify_fd);
                    -					inotify_fd = -1;
                    -				}
                    -				read(inotify_fd, buf, nbytes);
                    -				free(buf);
                    -			}
                    -		}
                    +		if (inotify_poll && (inotify_poll->revents & POLLIN))
                    +			reload_config = handle_inotify(udev);
                     
                     handle_signals:
                     		signal_received = 0;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From f24036d63b0aee735c3098d09b9e0ed450e93177 Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Wed, 11 Feb 2009 17:44:03 +0000
                    Subject: rules: update persistent storage rules to use inotify watches
                    
                    ---
                     NEWS                                      | 2 ++
                     rules/rules.d/60-persistent-storage.rules | 4 ++--
                     2 files changed, 4 insertions(+), 2 deletions(-)
                    
                    diff --git a/NEWS b/NEWS
                    index 98f4937fa8..4170697292 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -3,6 +3,8 @@ udev 138
                     Device nodes can be watched for changes with inotify with OPTIONS="watch".  If
                     closed after being opened for writing, a "change" uevent will occur.
                     
                    +/dev/disk/by-*/* symlinks will be automatically updated.
                    +
                     udev 137
                     ========
                     Bugfixes.
                    diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
                    index abb9fce30b..8476f14ecf 100644
                    --- a/rules/rules.d/60-persistent-storage.rules
                    +++ b/rules/rules.d/60-persistent-storage.rules
                    @@ -57,8 +57,8 @@ ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_
                     # probe filesystem metadata of optical drives which have a media inserted
                     KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
                     
                    -# probe filesystem metadata of disks
                    -KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
                    +# probe filesystem metadata of disks, watch for future changes
                    +KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode", OPTIONS+="watch"
                     
                     # by-label/by-uuid links (filesystem metadata)
                     ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 88ec7bb7543ff9fd15fdce03a1889e7e388a0051 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 11 Feb 2009 21:54:43 +0100
                    Subject: rules: move OPTIONS to separate rule
                    
                    A failing IMPORT+ match would prevent the OPTIONS+= action
                    from being applied.
                    ---
                     rules/rules.d/60-persistent-storage.rules | 7 +++++--
                     1 file changed, 5 insertions(+), 2 deletions(-)
                    
                    diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
                    index 8476f14ecf..532b09b5ec 100644
                    --- a/rules/rules.d/60-persistent-storage.rules
                    +++ b/rules/rules.d/60-persistent-storage.rules
                    @@ -57,8 +57,11 @@ ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_
                     # probe filesystem metadata of optical drives which have a media inserted
                     KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
                     
                    -# probe filesystem metadata of disks, watch for future changes
                    -KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode", OPTIONS+="watch"
                    +# probe filesystem metadata of disks
                    +KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
                    +
                    +# watch for future changes
                    +KERNEL!="sr*", OPTIONS+="watch"
                     
                     # by-label/by-uuid links (filesystem metadata)
                     ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 4aca304e48d69766d47439f0d3dcaa8797b46c78 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 11 Feb 2009 21:56:35 +0100
                    Subject: use global "reload_config" flag
                    
                    ---
                     udev/udev-watch.c | 7 +------
                     udev/udevd.c      | 7 +++----
                     2 files changed, 4 insertions(+), 10 deletions(-)
                    
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index 24df481cf8..92ab907856 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -102,21 +102,16 @@ void udev_watch_restore(struct udev *udev)
                     
                     			buf[len] = '\0';
                     			dbg(udev, "old watch to '%s' found\n", buf);
                    -
                     			dev = udev_device_new_from_syspath(udev, buf);
                     			if (dev == NULL) {
                     				unlink(path);
                     				continue;
                     			}
                     
                    -			udev_device_read_db(dev);
                    -			udev_device_set_info_loaded(dev);
                    -
                     			info(udev, "restoring old watch on '%s'\n", udev_device_get_devnode(dev));
                     			udev_watch_begin(udev, dev);
                     
                     			udev_device_unref(dev);
                    -
                     			unlink(path);
                     		}
                     
                    @@ -149,7 +144,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     	if (inotify_fd < 0)
                     		return;
                     
                    -	wd = inotify_add_watch (inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
                    +	wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
                     	if (wd < 0) {
                     		err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n",
                     		    inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index d93781f411..094175ac4a 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -516,7 +516,6 @@ static int handle_inotify(struct udev *udev)
                     	int nbytes, pos;
                     	char *buf;
                     	struct inotify_event *ev;
                    -	int reload_config = 0;
                     
                     	if ((ioctl(inotify_fd, FIONREAD, &nbytes) < 0) || (nbytes <= 0))
                     		return 0;
                    @@ -543,7 +542,7 @@ static int handle_inotify(struct udev *udev)
                     				char filename[UTIL_PATH_SIZE];
                     				int fd;
                     
                    -				info(udev, "device %s closed, synthesising write\n", syspath);
                    +				info(udev, "device %s closed, synthesising 'change'\n", syspath);
                     				util_strlcpy(filename, syspath, sizeof(filename));
                     				util_strlcat(filename, "/uevent", sizeof(filename));
                     				fd = open(filename, O_WRONLY);
                    @@ -559,7 +558,7 @@ static int handle_inotify(struct udev *udev)
                     	}
                     
                     	free (buf);
                    -	return reload_config;
                    +	return 0;
                     }
                     
                     static void asmlinkage sig_handler(int signum)
                    @@ -985,7 +984,7 @@ int main(int argc, char *argv[])
                     
                     		/* rules directory inotify watch */
                     		if (inotify_poll && (inotify_poll->revents & POLLIN))
                    -			reload_config = handle_inotify(udev);
                    +			handle_inotify(udev);
                     
                     handle_signals:
                     		signal_received = 0;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 64746532e84c586f7347e0581e6078cefb20044d Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Fri, 13 Feb 2009 16:02:36 +0100
                    Subject: rules: add "watch" option to dm and md rules
                    
                    ---
                     rules/packages/64-md-raid.rules   | 1 +
                     rules/suse/64-device-mapper.rules | 1 +
                     udev/udev-watch.c                 | 1 +
                     3 files changed, 3 insertions(+)
                    
                    diff --git a/rules/packages/64-md-raid.rules b/rules/packages/64-md-raid.rules
                    index def184f42c..abb029c46f 100644
                    --- a/rules/packages/64-md-raid.rules
                    +++ b/rules/packages/64-md-raid.rules
                    @@ -26,6 +26,7 @@ ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNA
                     
                     IMPORT{program}="vol_id --export $tempnode"
                     OPTIONS+="link_priority=100"
                    +OPTIONS+="watch"
                     ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
                     ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
                     
                    diff --git a/rules/suse/64-device-mapper.rules b/rules/suse/64-device-mapper.rules
                    index bc5d7ea629..15e7ddf755 100644
                    --- a/rules/suse/64-device-mapper.rules
                    +++ b/rules/suse/64-device-mapper.rules
                    @@ -16,6 +16,7 @@ ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end"
                     
                     IMPORT{program}="vol_id --export $tempnode"
                     OPTIONS+="link_priority=-100"
                    +OPTIONS+="watch"
                     ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90"
                     ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
                     ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index 92ab907856..24688c3b19 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -1,6 +1,7 @@
                     /*
                      * Copyright (C) 2004-2008 Kay Sievers 
                      * Copyright (C) 2009 Canonical Ltd.
                    + * Copyright (C) 2009 Scott James Remnant 
                      *
                      * 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
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From dc9aa5e941a0aabde9d8ee225a0c5508fa5f83a1 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 16 Feb 2009 22:22:57 +0100
                    Subject: rules: include loop block devices in persistent links
                    
                    ---
                     rules/rules.d/60-persistent-storage.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
                    index 532b09b5ec..14bd75f7dc 100644
                    --- a/rules/rules.d/60-persistent-storage.rules
                    +++ b/rules/rules.d/60-persistent-storage.rules
                    @@ -10,7 +10,7 @@ ACTION!="add|change", GOTO="persistent_storage_end"
                     SUBSYSTEM!="block", GOTO="persistent_storage_end"
                     
                     # skip rules for inappropriate block devices
                    -KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*|btibm*", GOTO="persistent_storage_end"
                    +KERNEL=="ram*|fd*|nbd*|gnbd*|dm-*|md*|btibm*", GOTO="persistent_storage_end"
                     
                     # never access non-cdrom removable ide devices, the drivers are causing event loops on open()
                     KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From ad88f9409a546ed3f1d69df66040a8f19b6eeafb Mon Sep 17 00:00:00 2001
                    From: David Zeuthen 
                    Date: Tue, 17 Feb 2009 14:15:17 -0500
                    Subject: *_id: add model/vendor enc strings
                    
                    So ID_MODEL and ID_VENDOR are pretty useful keys. However since we fix
                    them up (removing leading/trailing whitespace, converts spaces to
                    underscores) for use in device naming etc. we also force these fixups on
                    the desktop shell. And this looks pretty ugly.
                    
                    The attached patch introduces the ID_MODEL_ENC and ID_VENDOR_ENC keys
                    that contains the encoded version of the raw strings obtained. It's
                    pretty similar in spirit to ID_FS_LABEL and its cousin ID_FS_LABEL_ENC.
                    
                    With this patch a desktop shell can fix up these strings as it sees fit.
                    Note that some fixup is still needed though, for example
                    
                    # /lib/udev/ata_id --export /dev/sda |grep ID_MODEL
                    ID_MODEL=INTEL_SSDSA2MH080G1GC
                    ID_MODEL_ENC=INTEL\x20SSDSA2MH080G1GC\x20\x20\x20\x20\x20\x20\x20\x20
                    \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
                    
                    Note the trailing and leading whitespace. Anyway with the attached patch
                    the desktop shell should be able to display "INTEL SSDSA2MH080G1GC"
                    rather than "INTEL_SSDSA2MH080G1GC" to the user.
                    ---
                     extras/ata_id/ata_id.c   | 5 +++++
                     extras/scsi_id/scsi_id.c | 7 +++++++
                     extras/usb_id/usb_id.c   | 8 ++++++++
                     3 files changed, 20 insertions(+)
                    
                    diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c
                    index 6f2e28baa3..dd28d91f4a 100644
                    --- a/extras/ata_id/ata_id.c
                    +++ b/extras/ata_id/ata_id.c
                    @@ -49,6 +49,7 @@ int main(int argc, char *argv[])
                     	struct udev *udev;
                     	struct hd_driveid id;
                     	char model[41];
                    +	char model_enc[256];
                     	char serial[21];
                     	char revision[9];
                     	const char *node = NULL;
                    @@ -114,6 +115,9 @@ int main(int argc, char *argv[])
                     		goto close;
                     	}
                     
                    +	memcpy (model, id.model, 40);
                    +	model[40] = '\0';
                    +	udev_util_encode_string(model, model_enc, sizeof(model_enc));
                     	udev_util_replace_whitespace((char *) id.model, model, 40);
                     	udev_util_replace_chars(model, NULL);
                     	udev_util_replace_whitespace((char *) id.serial_no, serial, 20);
                    @@ -145,6 +149,7 @@ int main(int argc, char *argv[])
                     			printf("ID_TYPE=disk\n");
                     		}
                     		printf("ID_MODEL=%s\n", model);
                    +		printf("ID_MODEL_ENC=%s\n", model_enc);
                     		printf("ID_SERIAL=%s\n", serial);
                     		printf("ID_REVISION=%s\n", revision);
                     		printf("ID_BUS=ata\n");
                    diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c
                    index 21b7cbeaec..d630cf902b 100644
                    --- a/extras/scsi_id/scsi_id.c
                    +++ b/extras/scsi_id/scsi_id.c
                    @@ -59,6 +59,8 @@ static int reformat_serial;
                     static int export;
                     static char vendor_str[64];
                     static char model_str[64];
                    +static char vendor_enc_str[256];
                    +static char model_enc_str[256];
                     static char revision_str[16];
                     static char type_str[16];
                     
                    @@ -501,6 +503,9 @@ static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, co
                     	if (retval)
                     		return retval;
                     
                    +	udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str));
                    +	udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str));
                    +
                     	udev_util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str));
                     	udev_util_replace_chars(vendor_str, NULL);
                     	udev_util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str));
                    @@ -569,7 +574,9 @@ static int scsi_id(struct udev *udev, char *maj_min_dev)
                     		char serial_str[MAX_SERIAL_LEN];
                     
                     		printf("ID_VENDOR=%s\n", vendor_str);
                    +		printf("ID_VENDOR_ENC=%s\n", vendor_enc_str);
                     		printf("ID_MODEL=%s\n", model_str);
                    +		printf("ID_MODEL_ENC=%s\n", model_enc_str);
                     		printf("ID_REVISION=%s\n", revision_str);
                     		printf("ID_TYPE=%s\n", type_str);
                     		if (dev_scsi.serial[0] != '\0') {
                    diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c
                    index 3d007f9ee5..39576e4504 100644
                    --- a/extras/usb_id/usb_id.c
                    +++ b/extras/usb_id/usb_id.c
                    @@ -38,6 +38,8 @@ static void log_fn(struct udev *udev, int priority,
                     
                     static char vendor_str[64];
                     static char model_str[64];
                    +static char model_str_enc[256];
                    +static char vendor_str_enc[256];
                     static char serial_str[UTIL_NAME_SIZE];
                     static char revision_str[64];
                     static char type_str[64];
                    @@ -251,6 +253,7 @@ static int usb_id(struct udev_device *dev)
                     			     udev_device_get_sysname(dev_scsi));
                     			goto fallback;
                     		}
                    +		udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc));
                     		udev_util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1);
                     		udev_util_replace_chars(vendor_str, NULL);
                     
                    @@ -260,6 +263,7 @@ static int usb_id(struct udev_device *dev)
                     			     udev_device_get_sysname(dev_scsi));
                     			goto fallback;
                     		}
                    +		udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc));
                     		udev_util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1);
                     		udev_util_replace_chars(model_str, NULL);
                     
                    @@ -302,6 +306,7 @@ fallback:
                     			info(udev, "No USB vendor information available\n");
                     			return 1;
                     		}
                    +		udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc));
                     		udev_util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1);
                     		udev_util_replace_chars(vendor_str, NULL);
                     	}
                    @@ -319,6 +324,7 @@ fallback:
                     			dbg(udev, "No USB model information available\n");
                     			return 1;
                     		}
                    +		udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc));
                     		udev_util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1);
                     		udev_util_replace_chars(model_str, NULL);
                     	}
                    @@ -439,7 +445,9 @@ int main(int argc, char **argv)
                     
                     		if (export) {
                     			printf("ID_VENDOR=%s\n", vendor_str);
                    +			printf("ID_VENDOR_ENC=%s\n", vendor_str_enc);
                     			printf("ID_MODEL=%s\n", model_str);
                    +			printf("ID_MODEL_ENC=%s\n", model_str_enc);
                     			printf("ID_REVISION=%s\n", revision_str);
                     			printf("ID_SERIAL=%s\n", serial);
                     			if (serial_str[0] != '\0')
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From e8c84c98b9452dd1f4fe738f7e12149e0198dff6 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 19 Feb 2009 00:27:24 +0100
                    Subject: release 138
                    
                    ---
                     ChangeLog | 36 ++++++++++++++++++++++++++++++++++++
                     NEWS      |  7 ++++---
                     2 files changed, 40 insertions(+), 3 deletions(-)
                    
                    diff --git a/ChangeLog b/ChangeLog
                    index d7bcf5ff1c..d17cb9e025 100644
                    --- a/ChangeLog
                    +++ b/ChangeLog
                    @@ -1,3 +1,39 @@
                    +Summary of changes from v137 to v138
                    +============================================
                    +
                    +David Zeuthen (1):
                    +      *_id: add model/vendor enc strings
                    +
                    +Karel Zak (2):
                    +      vol_id: fix ddf version string
                    +      vol_id: add missing id->type to swap0
                    +
                    +Kay Sievers (13):
                    +      man: fix grammar
                    +      version bump
                    +      fix NAME="" logic
                    +      rules: dm - add escape for uuid links with whitespace
                    +      test: add test for empty and non-existent ATTR
                    +      rules: fix md "change"/"remove" handling
                    +      autogen.sh: add more warnings
                    +      fix NAME= and OPTION+="string_escape=..." logic
                    +      rules: move OPTIONS to separate rule
                    +      use global "reload_config" flag
                    +      rules: add "watch" option to dm and md rules
                    +      rules: include loop block devices in persistent links
                    +      release 138
                    +
                    +Matthias Schwarzott (1):
                    +      rules: Gentoo update
                    +
                    +Miklos Vajna (1):
                    +      doc: writing udev rules - refer to 'udevadm info' instead of 'udevinfo'
                    +
                    +Scott James Remnant (2):
                    +      udevd: optionally watch device nodes with inotify
                    +      rules: update persistent storage rules to use inotify watches
                    +
                    +
                     Summary of changes from v136 to v137
                     ============================================
                     
                    diff --git a/NEWS b/NEWS
                    index 4170697292..5dafcad1db 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -1,9 +1,10 @@
                     udev 138
                     ========
                    -Device nodes can be watched for changes with inotify with OPTIONS="watch".  If
                    -closed after being opened for writing, a "change" uevent will occur.
                    +Bugfixes.
                     
                    -/dev/disk/by-*/* symlinks will be automatically updated.
                    +Device nodes can be watched for changes with inotify with OPTIONS="watch".
                    +If closed after being opened for writing, a "change" uevent will occur.
                    +/dev/disk/by-{label,uuid}/* symlinks will be automatically updated.
                     
                     udev 137
                     ========
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 5ae82640c5f02c9be22e01da367875e8a3e636bf Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 17:17:20 +0000
                    Subject: Don't add inotify watch until RUN rules processed.
                    
                    The programs we RUN can open device nodes, and thus we can end up
                    chasing our own tail.
                    ---
                     udev/udev-event.c |  8 --------
                     udev/udevd.c      | 10 ++++++++++
                     2 files changed, 10 insertions(+), 8 deletions(-)
                    
                    diff --git a/udev/udev-event.c b/udev/udev-event.c
                    index 592da01099..e34f09cfe3 100644
                    --- a/udev/udev-event.c
                    +++ b/udev/udev-event.c
                    @@ -600,14 +600,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     
                     		/* create new node and symlinks */
                     		err = udev_node_add(dev, event->mode, event->uid, event->gid);
                    -
                    -		/* watch for changes */
                    -		if (event->inotify_watch && inotify_fd != -1) {
                    -			info(event->udev, "device will be watched for changes\n");
                    -			udev_watch_begin(event->udev, event->dev);
                    -		} else {
                    -			udev_watch_clear(event->udev, event->dev);
                    -		}
                     		goto exit;
                     	}
                     
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index 094175ac4a..e4fa2b63e1 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -226,6 +226,16 @@ static void event_fork(struct udev_event *event)
                     		if (err == 0 && !event->ignore_device && udev_get_run(event->udev))
                     			udev_event_execute_run(event);
                     
                    +		/* apply/restore inotify watch */
                    +		if (err == 0 && event->inotify_watch && inotify_fd != -1 &&
                    +		    major(udev_device_get_devnum(event->dev)) != 0 &&
                    +		    strcmp(udev_device_get_action(event->dev), "remove") != 0) {
                    +			info(event->udev, "device will be watched for changes\n");
                    +			udev_watch_begin(event->udev, event->dev);
                    +		} else {
                    +			udev_watch_clear(event->udev, event->dev);
                    +		}
                    +
                     		info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err);
                     		logging_close();
                     		if (err != 0)
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 521b3a9211b4e2d98bf7ae61c3844a42dde773e2 Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 17:19:05 +0000
                    Subject: Clear existing inotify watch before processing.
                    
                    Likewise when re-processing an event, we want to drop the existing
                    inotify watch first to avoid side-effects.
                    ---
                     udev/udevd.c | 10 ++++++----
                     1 file changed, 6 insertions(+), 4 deletions(-)
                    
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index e4fa2b63e1..50205f1e43 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -215,6 +215,11 @@ static void event_fork(struct udev_event *event)
                     		/* set timeout to prevent hanging processes */
                     		alarm(UDEV_EVENT_TIMEOUT);
                     
                    +		/* clear any existing udev watch on the node */
                    +		if (inotify_fd != -1 &&
                    +		    major(udev_device_get_devnum(event->dev)) != 0)
                    +			udev_watch_clear(event->udev, event->dev);
                    +
                     		/* apply rules, create node, symlinks */
                     		err = udev_event_execute_rules(event, rules);
                     
                    @@ -229,12 +234,9 @@ static void event_fork(struct udev_event *event)
                     		/* apply/restore inotify watch */
                     		if (err == 0 && event->inotify_watch && inotify_fd != -1 &&
                     		    major(udev_device_get_devnum(event->dev)) != 0 &&
                    -		    strcmp(udev_device_get_action(event->dev), "remove") != 0) {
                    +		    strcmp(udev_device_get_action(event->dev), "remove") != 0)
                     			info(event->udev, "device will be watched for changes\n");
                     			udev_watch_begin(event->udev, event->dev);
                    -		} else {
                    -			udev_watch_clear(event->udev, event->dev);
                    -		}
                     
                     		info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err);
                     		logging_close();
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 03e0170db3ef69c70db7cd74e6689c7b78c91c3d Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 17:21:24 +0000
                    Subject: Cleanup a little.
                    
                    Move some of the checks into udev_watch_begin() and udev_watch_clear()
                    so we don't have to repeat them all the time.
                    ---
                     udev/udev-watch.c | 5 ++++-
                     udev/udevd.c      | 7 ++-----
                     2 files changed, 6 insertions(+), 6 deletions(-)
                    
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index 24688c3b19..33b493d512 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -142,7 +142,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     	const char *filename;
                     	int wd;
                     
                    -	if (inotify_fd < 0)
                    +	if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0)
                     		return;
                     
                     	wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
                    @@ -163,6 +163,9 @@ void udev_watch_clear(struct udev *udev, struct udev_device *dev)
                     	DIR *dir;
                     	struct dirent *ent;
                     
                    +	if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0)
                    +		return;
                    +
                     	util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
                     	util_strlcat(filename, "/.udev/watch", sizeof(filename));
                     
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index 50205f1e43..27e64dae3a 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -216,9 +216,7 @@ static void event_fork(struct udev_event *event)
                     		alarm(UDEV_EVENT_TIMEOUT);
                     
                     		/* clear any existing udev watch on the node */
                    -		if (inotify_fd != -1 &&
                    -		    major(udev_device_get_devnum(event->dev)) != 0)
                    -			udev_watch_clear(event->udev, event->dev);
                    +		udev_watch_clear(event->udev, event->dev);
                     
                     		/* apply rules, create node, symlinks */
                     		err = udev_event_execute_rules(event, rules);
                    @@ -232,8 +230,7 @@ static void event_fork(struct udev_event *event)
                     			udev_event_execute_run(event);
                     
                     		/* apply/restore inotify watch */
                    -		if (err == 0 && event->inotify_watch && inotify_fd != -1 &&
                    -		    major(udev_device_get_devnum(event->dev)) != 0 &&
                    +		if (err == 0 && event->inotify_watch &&
                     		    strcmp(udev_device_get_action(event->dev), "remove") != 0)
                     			info(event->udev, "device will be watched for changes\n");
                     			udev_watch_begin(event->udev, event->dev);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From d7ce7539d327780fba18c8ae8951e1ff50cd0b3e Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 17:31:26 +0000
                    Subject: Allow watch handle to be stored in the udevdb.
                    
                    ---
                     udev/lib/libudev-device-db-write.c |  4 ++++
                     udev/lib/libudev-device.c          | 18 ++++++++++++++++++
                     udev/lib/libudev-private.h         |  2 ++
                     3 files changed, 24 insertions(+)
                    
                    diff --git a/udev/lib/libudev-device-db-write.c b/udev/lib/libudev-device-db-write.c
                    index 11e0ab5f60..e96f3101c6 100644
                    --- a/udev/lib/libudev-device-db-write.c
                    +++ b/udev/lib/libudev-device-db-write.c
                    @@ -64,6 +64,8 @@ int udev_device_update_db(struct udev_device *udev_device)
                     		goto file;
                     	if (udev_device_get_event_timeout(udev_device) >= 0)
                     		goto file;
                    +	if (udev_device_get_watch_handle(udev_device) >= 0)
                    +		goto file;
                     	if (udev_device_get_devnode(udev_device) == NULL)
                     		goto out;
                     
                    @@ -109,6 +111,8 @@ file:
                     		fprintf(f, "A:%u\n", udev_device_get_num_fake_partitions(udev_device));
                     	if (udev_device_get_ignore_remove(udev_device))
                     		fprintf(f, "R:%u\n", udev_device_get_ignore_remove(udev_device));
                    +	if (udev_device_get_watch_handle(udev_device) >= 0)
                    +		fprintf(f, "W:%u\n", udev_device_get_watch_handle(udev_device));
                     	udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) {
                     		if (!udev_list_entry_get_flag(list_entry))
                     			continue;
                    diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
                    index fc881fb3fd..1a9d0a1e69 100644
                    --- a/udev/lib/libudev-device.c
                    +++ b/udev/lib/libudev-device.c
                    @@ -58,6 +58,7 @@ struct udev_device {
                     	int devlink_priority;
                     	int refcount;
                     	dev_t devnum;
                    +	int watch_handle;
                     	unsigned int parent_set:1;
                     	unsigned int subsystem_set:1;
                     	unsigned int devtype_set:1;
                    @@ -176,6 +177,9 @@ int udev_device_read_db(struct udev_device *udev_device)
                     		case 'E':
                     			udev_device_add_property_from_string(udev_device, val);
                     			break;
                    +		case 'W':
                    +			udev_device_set_watch_handle(udev_device, atoi(val));
                    +			break;
                     		}
                     	}
                     	fclose(f);
                    @@ -251,6 +255,7 @@ struct udev_device *device_new(struct udev *udev)
                     	udev_list_init(&udev_device->properties_list);
                     	udev_list_init(&udev_device->sysattr_list);
                     	udev_device->event_timeout = -1;
                    +	udev_device->watch_handle = -1;
                     	/* copy global properties */
                     	udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev))
                     		udev_device_add_property(udev_device,
                    @@ -1291,3 +1296,16 @@ int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore)
                     	udev_device->ignore_remove = ignore;
                     	return 0;
                     }
                    +
                    +int udev_device_get_watch_handle(struct udev_device *udev_device)
                    +{
                    +	if (!udev_device->info_loaded)
                    +		device_load_info(udev_device);
                    +	return udev_device->watch_handle;
                    +}
                    +
                    +int udev_device_set_watch_handle(struct udev_device *udev_device, int handle)
                    +{
                    +	udev_device->watch_handle = handle;
                    +	return 0;
                    +}
                    diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
                    index 0d752bb1e5..0627aea071 100644
                    --- a/udev/lib/libudev-private.h
                    +++ b/udev/lib/libudev-private.h
                    @@ -84,6 +84,8 @@ extern int udev_device_get_devlink_priority(struct udev_device *udev_device);
                     extern int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio);
                     extern int udev_device_get_ignore_remove(struct udev_device *udev_device);
                     extern int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore);
                    +extern int udev_device_get_watch_handle(struct udev_device *udev_device);
                    +extern int udev_device_set_watch_handle(struct udev_device *udev_device, int handle);
                     extern void udev_device_set_info_loaded(struct udev_device *device);
                     
                     /* libudev-device-db-write.c */
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 25bdd197ec23ad62e533991b18119b5fce68b4a6 Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 17:34:07 +0000
                    Subject: Store watch handle in db.
                    
                    ---
                     udev/udev-watch.c | 3 +++
                     1 file changed, 3 insertions(+)
                    
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index 33b493d512..dd6d2f8b29 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -155,6 +155,9 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     	util_create_path(udev, filename);
                     	unlink(filename);
                     	symlink(udev_device_get_syspath(dev), filename);
                    +
                    +	udev_device_set_watch_handle(dev, wd);
                    +	udev_device_update_db(dev);
                     }
                     
                     void udev_watch_clear(struct udev *udev, struct udev_device *dev)
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 047f88bca31f364253fe230a1c2ec7fbc43c7fc3 Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 17:43:53 +0000
                    Subject: Use the udevdb to speed up watch clearing.
                    
                    Also return a udev_device when looking up by handle as well, so
                    everything works the same way.
                    ---
                     udev/udev-watch.c | 59 +++++++++++--------------------------------------------
                     udev/udev.h       |  5 ++---
                     udev/udevd.c      | 19 +++++++++---------
                     3 files changed, 24 insertions(+), 59 deletions(-)
                    
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index dd6d2f8b29..2d672e211c 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -160,67 +160,32 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     	udev_device_update_db(dev);
                     }
                     
                    -void udev_watch_clear(struct udev *udev, struct udev_device *dev)
                    +void udev_watch_end(struct udev *udev, struct udev_device *dev)
                     {
                    -	static char filename[UTIL_PATH_SIZE];
                    -	DIR *dir;
                    -	struct dirent *ent;
                    +	int wd;
                    +	const char *filename;
                     
                     	if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0)
                     		return;
                     
                    -	util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
                    -	util_strlcat(filename, "/.udev/watch", sizeof(filename));
                    -
                    -	dir = opendir(filename);
                    -	if (dir == NULL)
                    -		return;
                    -
                    -	while ((ent = readdir(dir)) != NULL) {
                    -		char path[UTIL_PATH_SIZE];
                    -		char buf[UTIL_PATH_SIZE];
                    -		ssize_t len;
                    -
                    -		if (ent->d_name[0] < '0' || ent->d_name[0] > '9')
                    -			continue;
                    -
                    -		util_strlcpy(path, filename, sizeof(path));
                    -		util_strlcat(path, "/", sizeof(path));
                    -		util_strlcat(path, ent->d_name, sizeof(path));
                    -
                    -		len = readlink(path, buf, sizeof(buf));
                    -		if (len <= 0)
                    -			continue;
                    -
                    -		buf[len] = '\0';
                    -		if (strcmp(buf, udev_device_get_syspath(dev)))
                    -			continue;
                    -
                    -		/* this is the watch we're looking for */
                    -		info(udev, "clearing existing watch on '%s'\n", udev_device_get_devnode(dev));
                    -		udev_watch_end(udev, atoi(ent->d_name));
                    -	}
                    -
                    -	closedir(dir);
                    -}
                    -
                    -void udev_watch_end(struct udev *udev, int wd)
                    -{
                    -	const char *filename;
                    -
                    -	if (inotify_fd < 0 || wd < 0)
                    +	wd = udev_device_get_watch_handle(dev);
                    +	if (wd < 0)
                     		return;
                     
                    +	info(udev, "removing watch on '%s'\n", udev_device_get_devnode(dev));
                     	inotify_rm_watch(inotify_fd, wd);
                     
                     	filename = udev_watch_filename(udev, wd);
                     	unlink(filename);
                    +
                    +	udev_device_set_watch_handle(dev, -1);
                    +	udev_device_update_db(dev);
                     }
                     
                    -const char *udev_watch_lookup(struct udev *udev, int wd)
                    +struct udev_device *udev_watch_lookup(struct udev *udev, int wd)
                     {
                     	const char *filename;
                    -	static char buf[UTIL_PATH_SIZE];
                    +	char buf[UTIL_PATH_SIZE];
                     	ssize_t len;
                     
                     	if (inotify_fd < 0 || wd < 0)
                    @@ -231,7 +196,7 @@ const char *udev_watch_lookup(struct udev *udev, int wd)
                     	if (len > 0) {
                     		buf[len] = '\0';
                     
                    -		return buf;
                    +		return udev_device_new_from_syspath(udev, buf);
                     	}
                     
                     	return NULL;
                    diff --git a/udev/udev.h b/udev/udev.h
                    index 57e2d73c2e..d5fa4f3edc 100644
                    --- a/udev/udev.h
                    +++ b/udev/udev.h
                    @@ -105,9 +105,8 @@ extern int inotify_fd;
                     extern void udev_watch_init(struct udev *udev);
                     extern void udev_watch_restore(struct udev *udev);
                     extern void udev_watch_begin(struct udev *udev, struct udev_device *dev);
                    -extern void udev_watch_clear(struct udev *udev, struct udev_device *dev);
                    -extern void udev_watch_end(struct udev *udev, int wd);
                    -extern const char *udev_watch_lookup(struct udev *udev, int wd);
                    +extern void udev_watch_end(struct udev *udev, struct udev_device *dev);
                    +extern struct udev_device *udev_watch_lookup(struct udev *udev, int wd);
                     
                     /* udev-node.c */
                     extern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid);
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index 27e64dae3a..5fb6d5f734 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -216,7 +216,7 @@ static void event_fork(struct udev_event *event)
                     		alarm(UDEV_EVENT_TIMEOUT);
                     
                     		/* clear any existing udev watch on the node */
                    -		udev_watch_clear(event->udev, event->dev);
                    +		udev_watch_end(event->udev, event->dev);
                     
                     		/* apply rules, create node, symlinks */
                     		err = udev_event_execute_rules(event, rules);
                    @@ -540,19 +540,18 @@ static int handle_inotify(struct udev *udev)
                     	read(inotify_fd, buf, nbytes);
                     
                     	for (pos = 0, ev = (struct inotify_event *)(buf + pos); pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) {
                    -		const char *syspath;
                    +		struct udev_device *dev;
                     
                     		dbg(udev, "inotify event: %x for %d (%s)\n", ev->mask, ev->wd, ev->len ? ev->name : "*");
                    -
                    -		syspath = udev_watch_lookup(udev, ev->wd);
                    -		if (syspath != NULL) {
                    -			dbg(udev, "inotify event: %x for %s\n", ev->mask, syspath);
                    +		dev = udev_watch_lookup(udev, ev->wd);
                    +		if (dev != NULL) {
                    +			dbg(udev, "inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev));
                     			if (ev->mask & IN_CLOSE_WRITE) {
                     				char filename[UTIL_PATH_SIZE];
                     				int fd;
                     
                    -				info(udev, "device %s closed, synthesising 'change'\n", syspath);
                    -				util_strlcpy(filename, syspath, sizeof(filename));
                    +				info(udev, "device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev));
                    +				util_strlcpy(filename, udev_device_get_syspath(dev), sizeof(filename));
                     				util_strlcat(filename, "/uevent", sizeof(filename));
                     				fd = open(filename, O_WRONLY);
                     				if (fd < 0 || write(fd, "change", 6) < 0)
                    @@ -560,7 +559,9 @@ static int handle_inotify(struct udev *udev)
                     				close(fd);
                     			}
                     			if (ev->mask & IN_IGNORED)
                    -				udev_watch_end(udev, ev->wd);
                    +				udev_watch_end(udev, dev);
                    +
                    +			udev_device_unref(dev);
                     		} else {
                     			reload_config = 1;
                     		}
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 9ce462721a02e38c15e4cdeff7dfc98eeb56224a Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 17:46:00 +0000
                    Subject: Put a log message in a more sensible place.
                    
                    ---
                     udev/udev-watch.c | 1 +
                     udev/udevd.c      | 1 -
                     2 files changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index 2d672e211c..8d6cef6ac8 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -145,6 +145,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     	if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0)
                     		return;
                     
                    +	info(udev, "adding watch on '%s'\n", udev_device_get_devnode(dev));
                     	wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
                     	if (wd < 0) {
                     		err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n",
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index 5fb6d5f734..c764b33b0a 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -232,7 +232,6 @@ static void event_fork(struct udev_event *event)
                     		/* apply/restore inotify watch */
                     		if (err == 0 && event->inotify_watch &&
                     		    strcmp(udev_device_get_action(event->dev), "remove") != 0)
                    -			info(event->udev, "device will be watched for changes\n");
                     			udev_watch_begin(event->udev, event->dev);
                     
                     		info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From c08337da5c988e3e65d2ff63a1b554ca365deda7 Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 17:48:18 +0000
                    Subject: Output watch handle in udevadm info.
                    
                    ---
                     udev/udevadm-info.c | 4 ++++
                     1 file changed, 4 insertions(+)
                    
                    diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c
                    index 6fe1f86313..094c6ce2a8 100644
                    --- a/udev/udevadm-info.c
                    +++ b/udev/udevadm-info.c
                    @@ -153,6 +153,10 @@ static void print_record(struct udev_device *device)
                     	if (i != 0)
                     		printf("R:%u\n", i);
                     
                    +	i = udev_device_get_watch_handle(device);
                    +	if (i >= 0)
                    +		printf("W:%u\n", i);
                    +
                     	udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) {
                     		len = strlen(udev_get_dev_path(udev_device_get_udev(device)));
                     		printf("S: %s\n", &udev_list_entry_get_name(list_entry)[len+1]);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From b8e96d67a2c842dc750b5193cb732a077a3149ed Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 17:59:01 +0000
                    Subject: lookup the old watch handle; reload only if has a path
                    
                    ---
                     udev/udevd.c | 20 ++++++++++++++++----
                     1 file changed, 16 insertions(+), 4 deletions(-)
                    
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index c764b33b0a..5598628a51 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -216,7 +216,15 @@ static void event_fork(struct udev_event *event)
                     		alarm(UDEV_EVENT_TIMEOUT);
                     
                     		/* clear any existing udev watch on the node */
                    -		udev_watch_end(event->udev, event->dev);
                    +		if (inotify_fd != -1) {
                    +			struct udev_device *dev_old;
                    +
                    +			dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(event->dev));
                    +			if (dev_old != NULL) {
                    +				udev_watch_end(event->udev, dev_old);
                    +				udev_device_unref(dev_old);
                    +			}
                    +		}
                     
                     		/* apply rules, create node, symlinks */
                     		err = udev_event_execute_rules(event, rules);
                    @@ -541,7 +549,12 @@ static int handle_inotify(struct udev *udev)
                     	for (pos = 0, ev = (struct inotify_event *)(buf + pos); pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) {
                     		struct udev_device *dev;
                     
                    -		dbg(udev, "inotify event: %x for %d (%s)\n", ev->mask, ev->wd, ev->len ? ev->name : "*");
                    +		if (ev->len) {
                    +			dbg(udev, "inotify event: %x for %s\n", ev->mask, ev->name);
                    +			reload_config = 1;
                    +			continue;
                    +		}
                    +
                     		dev = udev_watch_lookup(udev, ev->wd);
                     		if (dev != NULL) {
                     			dbg(udev, "inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev));
                    @@ -561,9 +574,8 @@ static int handle_inotify(struct udev *udev)
                     				udev_watch_end(udev, dev);
                     
                     			udev_device_unref(dev);
                    -		} else {
                    -			reload_config = 1;
                     		}
                    +
                     	}
                     
                     	free (buf);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 80be8c48c59708c52993ceddeedef8c2ed417016 Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Mon, 23 Feb 2009 18:33:49 +0000
                    Subject: Look at more inotify events in the buffer than just the first.
                    
                    ---
                     udev/udevd.c | 3 ++-
                     1 file changed, 2 insertions(+), 1 deletion(-)
                    
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index 5598628a51..cfc091b699 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -546,9 +546,10 @@ static int handle_inotify(struct udev *udev)
                     
                     	read(inotify_fd, buf, nbytes);
                     
                    -	for (pos = 0, ev = (struct inotify_event *)(buf + pos); pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) {
                    +	for (pos = 0; pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) {
                     		struct udev_device *dev;
                     
                    +		ev = (struct inotify_event *)(buf + pos);
                     		if (ev->len) {
                     			dbg(udev, "inotify event: %x for %s\n", ev->mask, ev->name);
                     			reload_config = 1;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 58e495438bee4b1e737286e874702bcfddf23212 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 23 Feb 2009 21:27:03 +0100
                    Subject: version bump
                    
                    ---
                     NEWS         | 4 ++++
                     configure.ac | 2 +-
                     2 files changed, 5 insertions(+), 1 deletion(-)
                    
                    diff --git a/NEWS b/NEWS
                    index 5dafcad1db..e57e0fe517 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -1,3 +1,7 @@
                    +udev 139
                    +========
                    +Bugfixes.
                    +
                     udev 138
                     ========
                     Bugfixes.
                    diff --git a/configure.ac b/configure.ac
                    index 7fbc42c41b..3663ee809f 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -1,5 +1,5 @@
                     AC_INIT([udev],
                    -	[138],
                    +	[139],
                     	[linux-hotplug@vger.kernel.org])
                     AC_PREREQ(2.60)
                     AC_CONFIG_SRCDIR([udev/udevd.c])
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From d5d04d4f9f75b5c5318bf2aa3bc10719d9a2e3bc Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 24 Feb 2009 12:58:48 +0100
                    Subject: remove static local variable
                    
                    ---
                     udev/udev-watch.c | 25 ++++++-------------------
                     1 file changed, 6 insertions(+), 19 deletions(-)
                    
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index 8d6cef6ac8..a581f02cb5 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -124,22 +124,9 @@ void udev_watch_restore(struct udev *udev)
                     	}
                     }
                     
                    -static const char *udev_watch_filename(struct udev *udev, int wd)
                    -{
                    -	static char filename[UTIL_PATH_SIZE];
                    -	char str[32];
                    -
                    -	sprintf(str, "%d", wd);
                    -	util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
                    -	util_strlcat(filename, "/.udev/watch/", sizeof(filename));
                    -	util_strlcat(filename, str, sizeof(filename));
                    -
                    -	return filename;
                    -}
                    -
                     void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     {
                    -	const char *filename;
                    +	char filename[UTIL_PATH_SIZE];
                     	int wd;
                     
                     	if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0)
                    @@ -152,7 +139,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     		    inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE);
                     	}
                     
                    -	filename = udev_watch_filename(udev, wd);
                    +	snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd);
                     	util_create_path(udev, filename);
                     	unlink(filename);
                     	symlink(udev_device_get_syspath(dev), filename);
                    @@ -164,7 +151,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     void udev_watch_end(struct udev *udev, struct udev_device *dev)
                     {
                     	int wd;
                    -	const char *filename;
                    +	char filename[UTIL_PATH_SIZE];
                     
                     	if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0)
                     		return;
                    @@ -176,7 +163,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev)
                     	info(udev, "removing watch on '%s'\n", udev_device_get_devnode(dev));
                     	inotify_rm_watch(inotify_fd, wd);
                     
                    -	filename = udev_watch_filename(udev, wd);
                    +	snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd);
                     	unlink(filename);
                     
                     	udev_device_set_watch_handle(dev, -1);
                    @@ -185,14 +172,14 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev)
                     
                     struct udev_device *udev_watch_lookup(struct udev *udev, int wd)
                     {
                    -	const char *filename;
                    +	char filename[UTIL_PATH_SIZE];
                     	char buf[UTIL_PATH_SIZE];
                     	ssize_t len;
                     
                     	if (inotify_fd < 0 || wd < 0)
                     		return NULL;
                     
                    -	filename = udev_watch_filename(udev, wd);
                    +	snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd);
                     	len = readlink(filename, buf, sizeof(buf));
                     	if (len > 0) {
                     		buf[len] = '\0';
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 3d3a0a709a38805259fe07240c3ca47a120dd5d6 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 24 Feb 2009 15:11:17 +0100
                    Subject: use the event udev_device to disable the watch on "remove"
                    
                    ---
                     configure.ac      |  2 +-
                     udev/udev-event.c | 32 +++++++++++++++++++-------------
                     udev/udev-watch.c |  6 ++----
                     udev/udevd.c      | 16 +++-------------
                     4 files changed, 25 insertions(+), 31 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index 3663ee809f..f23c377df0 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -15,7 +15,7 @@ test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix=
                     
                     dnl /* libudev version */
                     LIBUDEV_LT_CURRENT=0
                    -LIBUDEV_LT_REVISION=8
                    +LIBUDEV_LT_REVISION=9
                     LIBUDEV_LT_AGE=0
                     AC_SUBST(LIBUDEV_LT_CURRENT)
                     AC_SUBST(LIBUDEV_LT_REVISION)
                    diff --git a/udev/udev-event.c b/udev/udev-event.c
                    index e34f09cfe3..f4d7121793 100644
                    --- a/udev/udev-event.c
                    +++ b/udev/udev-event.c
                    @@ -550,6 +550,16 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     
                     		dbg(event->udev, "device node add '%s'\n", udev_device_get_devpath(dev));
                     
                    +		/* read old database entry */
                    +		dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev));
                    +		if (dev_old != NULL) {
                    +			udev_device_read_db(dev_old);
                    +			udev_device_set_info_loaded(dev_old);
                    +
                    +			/* disable watch during event processing */
                    +			udev_watch_end(event->udev, dev_old);
                    +		}
                    +
                     		udev_rules_apply_to_event(rules, event);
                     		if (event->tmp_node != NULL) {
                     			dbg(event->udev, "removing temporary device node\n");
                    @@ -560,12 +570,12 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     
                     		if (event->ignore_device) {
                     			info(event->udev, "device event will be ignored\n");
                    -			goto exit;
                    +			goto exit_add;
                     		}
                     
                     		if (event->name != NULL && event->name[0] == '\0') {
                     			info(event->udev, "device node creation supressed\n");
                    -			goto exit;
                    +			goto exit_add;
                     		}
                     
                     		if (event->name == NULL) {
                    @@ -573,7 +583,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     			     udev_device_get_sysname(event->dev));
                     			event->name = strdup(udev_device_get_sysname(event->dev));
                     			if (event->name == NULL)
                    -				goto exit;
                    +				goto exit_add;
                     		}
                     
                     		/* set device node name */
                    @@ -582,24 +592,17 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     		util_strlcat(filename, event->name, sizeof(filename));
                     		udev_device_set_devnode(dev, filename);
                     
                    -		/* read old database entry */
                    -		dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev));
                    -		if (dev_old != NULL) {
                    -			udev_device_read_db(dev_old);
                    -			udev_device_set_info_loaded(dev_old);
                    -		}
                    -
                     		/* write current database entry */
                     		udev_device_update_db(dev);
                     
                     		/* remove/update possible left-over symlinks from old database entry */
                    -		if (dev_old != NULL) {
                    +		if (dev_old != NULL)
                     			udev_node_update_old_links(dev, dev_old);
                    -			udev_device_unref(dev_old);
                    -		}
                     
                     		/* create new node and symlinks */
                     		err = udev_node_add(dev, event->mode, event->uid, event->gid);
                    +exit_add:
                    +		udev_device_unref(dev_old);
                     		goto exit;
                     	}
                     
                    @@ -651,6 +654,9 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     		udev_device_set_info_loaded(dev);
                     		udev_device_delete_db(dev);
                     
                    +		/* remove watch */
                    +		udev_watch_end(event->udev, dev);
                    +
                     		if (udev_device_get_devnode(dev) == NULL) {
                     			char devnode[UTIL_PATH_SIZE];
                     
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index a581f02cb5..dff3de1cb4 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -129,7 +129,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     	char filename[UTIL_PATH_SIZE];
                     	int wd;
                     
                    -	if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0)
                    +	if (inotify_fd < 0)
                     		return;
                     
                     	info(udev, "adding watch on '%s'\n", udev_device_get_devnode(dev));
                    @@ -145,7 +145,6 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     	symlink(udev_device_get_syspath(dev), filename);
                     
                     	udev_device_set_watch_handle(dev, wd);
                    -	udev_device_update_db(dev);
                     }
                     
                     void udev_watch_end(struct udev *udev, struct udev_device *dev)
                    @@ -153,7 +152,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev)
                     	int wd;
                     	char filename[UTIL_PATH_SIZE];
                     
                    -	if (inotify_fd < 0 || major(udev_device_get_devnum(dev)) == 0)
                    +	if (inotify_fd < 0)
                     		return;
                     
                     	wd = udev_device_get_watch_handle(dev);
                    @@ -167,7 +166,6 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev)
                     	unlink(filename);
                     
                     	udev_device_set_watch_handle(dev, -1);
                    -	udev_device_update_db(dev);
                     }
                     
                     struct udev_device *udev_watch_lookup(struct udev *udev, int wd)
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index cfc091b699..ee3d6f5033 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -215,17 +215,6 @@ static void event_fork(struct udev_event *event)
                     		/* set timeout to prevent hanging processes */
                     		alarm(UDEV_EVENT_TIMEOUT);
                     
                    -		/* clear any existing udev watch on the node */
                    -		if (inotify_fd != -1) {
                    -			struct udev_device *dev_old;
                    -
                    -			dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(event->dev));
                    -			if (dev_old != NULL) {
                    -				udev_watch_end(event->udev, dev_old);
                    -				udev_device_unref(dev_old);
                    -			}
                    -		}
                    -
                     		/* apply rules, create node, symlinks */
                     		err = udev_event_execute_rules(event, rules);
                     
                    @@ -238,9 +227,10 @@ static void event_fork(struct udev_event *event)
                     			udev_event_execute_run(event);
                     
                     		/* apply/restore inotify watch */
                    -		if (err == 0 && event->inotify_watch &&
                    -		    strcmp(udev_device_get_action(event->dev), "remove") != 0)
                    +		if (err == 0 && event->inotify_watch) {
                     			udev_watch_begin(event->udev, event->dev);
                    +			udev_device_update_db(event->dev);
                    +		}
                     
                     		info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err);
                     		logging_close();
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 46f194cbdecda5a8a0cb4d647b9c74b477a89133 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 25 Feb 2009 11:18:15 +0100
                    Subject: add "nowatch" to disable a default installed watch with a later rule
                    
                    ---
                     udev/udev-rules.c | 30 ++++++++++++++++++++----------
                     1 file changed, 20 insertions(+), 10 deletions(-)
                    
                    diff --git a/udev/udev-rules.c b/udev/udev-rules.c
                    index 3751cbb36d..905a1a0038 100644
                    --- a/udev/udev-rules.c
                    +++ b/udev/udev-rules.c
                    @@ -140,7 +140,7 @@ enum token_type {
                     	TK_A_IGNORE_DEVICE,
                     	TK_A_STRING_ESCAPE_NONE,
                     	TK_A_STRING_ESCAPE_REPLACE,
                    -	TK_A_INOTIFY_WATCH,
                    +	TK_A_INOTIFY_WATCH,		/* int */
                     	TK_A_NUM_FAKE_PART,		/* int */
                     	TK_A_DEVLINK_PRIO,		/* int */
                     	TK_A_OWNER,			/* val */
                    @@ -183,7 +183,6 @@ struct token {
                     			union {
                     				unsigned int attr_off;
                     				int ignore_error;
                    -				int i;
                     				unsigned int rule_goto;
                     				mode_t  mode;
                     				uid_t uid;
                    @@ -191,6 +190,7 @@ struct token {
                     				int num_fake_part;
                     				int devlink_prio;
                     				int event_timeout;
                    +				int watch;
                     			};
                     		} key;
                     	};
                    @@ -354,7 +354,6 @@ static void dump_token(struct udev_rules *rules, struct token *token)
                     	case TK_A_IGNORE_DEVICE:
                     	case TK_A_STRING_ESCAPE_NONE:
                     	case TK_A_STRING_ESCAPE_REPLACE:
                    -	case TK_A_INOTIFY_WATCH:
                     	case TK_A_LAST_RULE:
                     	case TK_A_IGNORE_REMOVE:
                     		dbg(rules->udev, "%s\n", token_str(type));
                    @@ -363,6 +362,9 @@ static void dump_token(struct udev_rules *rules, struct token *token)
                     		dbg(rules->udev, "%s %s '%s'(%s) %#o\n",
                     		    token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode);
                     		break;
                    +	case TK_A_INOTIFY_WATCH:
                    +		dbg(rules->udev, "%s %u\n", token_str(type), token->key.i);
                    +		break;
                     	case TK_A_NUM_FAKE_PART:
                     		dbg(rules->udev, "%s %u\n", token_str(type), token->key.num_fake_part);
                     		break;
                    @@ -1023,7 +1025,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
                     	case TK_A_IGNORE_DEVICE:
                     	case TK_A_STRING_ESCAPE_NONE:
                     	case TK_A_STRING_ESCAPE_REPLACE:
                    -	case TK_A_INOTIFY_WATCH:
                     	case TK_A_IGNORE_REMOVE:
                     	case TK_A_LAST_RULE:
                     		break;
                    @@ -1031,9 +1032,8 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
                     		token->key.value_off = add_string(rule_tmp->rules, value);
                     		token->key.ignore_error = *(int *)data;
                     		break;
                    +	case TK_A_INOTIFY_WATCH:
                     	case TK_A_NUM_FAKE_PART:
                    -		token->key.num_fake_part = *(int *)data;
                    -		break;
                     	case TK_A_DEVLINK_PRIO:
                     		token->key.devlink_prio = *(int *)data;
                     		break;
                    @@ -1516,10 +1516,20 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				rule_add_key(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num);
                     				dbg(rules->udev, "creation of partition nodes requested\n");
                     			}
                    -			pos = strstr(value, "watch");
                    +			pos = strstr(value, "nowatch");
                     			if (pos != NULL) {
                    -				rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, 0, NULL, NULL);
                    -				dbg(rules->udev, "inotify watch of device requested\n");
                    +				const int off = 0;
                    +
                    +				rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, 0, NULL, &off);
                    +				dbg(rules->udev, "inotify watch of device disabled\n");
                    +			} else {
                    +				pos = strstr(value, "watch");
                    +				if (pos != NULL) {
                    +					const int on = 1;
                    +
                    +					rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, 0, NULL, &on);
                    +					dbg(rules->udev, "inotify watch of device requested\n");
                    +				}
                     			}
                     			continue;
                     		}
                    @@ -2254,7 +2264,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
                     			udev_device_set_num_fake_partitions(event->dev, cur->key.num_fake_part);
                     			break;
                     		case TK_A_INOTIFY_WATCH:
                    -			event->inotify_watch = 1;
                    +			event->inotify_watch = cur->key.watch;
                     			break;
                     		case TK_A_DEVLINK_PRIO:
                     			udev_device_set_devlink_priority(event->dev, cur->key.devlink_prio);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 03733b04c3919920520c8b2ab1e18a44b2691cb5 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 26 Feb 2009 14:11:43 +0100
                    Subject: add m4/ subdir
                    
                    ---
                     Makefile.am   | 2 ++
                     configure.ac  | 1 +
                     m4/.gitignore | 2 ++
                     3 files changed, 5 insertions(+)
                     create mode 100644 m4/.gitignore
                    
                    diff --git a/Makefile.am b/Makefile.am
                    index 55df27e2c7..1bb2d7773b 100644
                    --- a/Makefile.am
                    +++ b/Makefile.am
                    @@ -17,6 +17,8 @@ EXTRA_DIST = \
                     CLEANFILES = \
                     	udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2
                     
                    +ACLOCAL_AMFLAGS = -I m4
                    +
                     clean-local:
                     	rm -rf udev-test-install
                     
                    diff --git a/configure.ac b/configure.ac
                    index f23c377df0..66dc866521 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -8,6 +8,7 @@ AC_GNU_SOURCE
                     AC_DISABLE_STATIC
                     AC_SYS_LARGEFILE
                     AC_PROG_LIBTOOL
                    +AC_CONFIG_MACRO_DIR([m4])
                     
                     dnl /* prefix is /usr, exec_prefix is /, if overridden exec_prefix follows prefix */
                     AC_PREFIX_DEFAULT([/usr])
                    diff --git a/m4/.gitignore b/m4/.gitignore
                    new file mode 100644
                    index 0000000000..e1b74742f1
                    --- /dev/null
                    +++ b/m4/.gitignore
                    @@ -0,0 +1,2 @@
                    +libtool.m4
                    +lt*m4
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 45a1dbba490a6ccb4fffb0fe1286c7afedeb25d9 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 26 Feb 2009 14:17:04 +0100
                    Subject: use AC_USE_SYSTEM_EXTENSIONS instead of AC_GNU_SOURCE
                    
                    ---
                     configure.ac | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index 66dc866521..40311cd385 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -4,8 +4,8 @@ AC_INIT([udev],
                     AC_PREREQ(2.60)
                     AC_CONFIG_SRCDIR([udev/udevd.c])
                     AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2])
                    -AC_GNU_SOURCE
                     AC_DISABLE_STATIC
                    +AC_USE_SYSTEM_EXTENSIONS
                     AC_SYS_LARGEFILE
                     AC_PROG_LIBTOOL
                     AC_CONFIG_MACRO_DIR([m4])
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 7e827bcde81cc702f232a53d84506cf065274ded Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 26 Feb 2009 17:05:58 +0100
                    Subject: usb_id: add ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:
                    
                    ---
                     extras/usb_id/usb_id.c                   | 82 ++++++++++++++++++++++++++++++--
                     rules/rules.d/60-persistent-input.rules  |  2 +-
                     rules/rules.d/60-persistent-serial.rules |  2 +-
                     rules/rules.d/60-persistent-v4l.rules    |  2 +-
                     4 files changed, 82 insertions(+), 6 deletions(-)
                    
                    diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c
                    index 39576e4504..489f97e537 100644
                    --- a/extras/usb_id/usb_id.c
                    +++ b/extras/usb_id/usb_id.c
                    @@ -17,6 +17,7 @@
                     #include 
                     #include 
                     #include 
                    +#include 
                     #include 
                     #include 
                     
                    @@ -41,6 +42,7 @@ static char model_str[64];
                     static char model_str_enc[256];
                     static char vendor_str_enc[256];
                     static char serial_str[UTIL_NAME_SIZE];
                    +static char packed_if_str[UTIL_NAME_SIZE];
                     static char revision_str[64];
                     static char type_str[64];
                     static char instance_str[64];
                    @@ -163,6 +165,77 @@ static void set_scsi_type(char *to, const char *from, size_t len)
                     	util_strlcpy(to, type, len);
                     }
                     
                    +#define USB_DT_DEVICE			0x01
                    +#define USB_DT_INTERFACE		0x04
                    +
                    +static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len)
                    +{
                    +	char *filename = NULL;
                    +	int fd;
                    +	ssize_t size;
                    +	unsigned char buf[18 + 65535];
                    +	unsigned int pos, strpos;
                    +	struct usb_interface_descriptor {
                    +		u_int8_t	bLength;
                    +		u_int8_t	bDescriptorType;
                    +		u_int8_t	bInterfaceNumber;
                    +		u_int8_t	bAlternateSetting;
                    +		u_int8_t	bNumEndpoints;
                    +		u_int8_t	bInterfaceClass;
                    +		u_int8_t	bInterfaceSubClass;
                    +		u_int8_t	bInterfaceProtocol;
                    +		u_int8_t	iInterface;
                    +	} __attribute__((packed));
                    +	int err;
                    +
                    +	if (asprintf(&filename, "%s/descriptors", udev_device_get_syspath(dev)) < 0) {
                    +		err = -1;
                    +		goto out;
                    +	}
                    +	fd = open(filename, O_RDONLY);
                    +	if (fd < 0) {
                    +		fprintf(stderr, "error opening USB device 'descriptors' file\n");
                    +		err = -1;
                    +		goto out;
                    +	}
                    +	size = read(fd, buf, sizeof(buf));
                    +	close(fd);
                    +	if (size < 18 || size == sizeof(buf)) {
                    +		err = -1;
                    +		goto out;
                    +	}
                    +
                    +	pos = 0;
                    +	strpos = 0;
                    +	while (pos < sizeof(buf) && strpos+7 < len) {
                    +		struct usb_interface_descriptor *desc;
                    +		char if_str[8];
                    +
                    +		desc = (struct usb_interface_descriptor *) &buf[pos];
                    +		if (desc->bLength < 3)
                    +			break;
                    +		pos += desc->bLength;
                    +
                    +		if (desc->bDescriptorType != USB_DT_INTERFACE)
                    +			continue;
                    +
                    +		if (snprintf(if_str, 8, "%02x%02x%02x:",
                    +			     desc->bInterfaceClass,
                    +			     desc->bInterfaceSubClass,
                    +			     desc->bInterfaceProtocol) != 7)
                    +			continue;
                    +
                    +		if (strstr(ifs_str, if_str) != NULL)
                    +			continue;
                    +
                    +		memcpy(&ifs_str[strpos], if_str, 8),
                    +		strpos += 7;
                    +	}
                    +out:
                    +	free(filename);
                    +	return 0;
                    +}
                    +
                     /*
                      * A unique USB identification is generated like this:
                      *
                    @@ -228,6 +301,9 @@ static int usb_id(struct udev_device *dev)
                     		return 1;
                     	}
                     
                    +	/* all interfaces of the device in a single string */
                    +	dev_if_packed_info(dev_usb, packed_if_str, sizeof(packed_if_str));
                    +
                     	/* mass storage : SCSI or ATAPI */
                     	if ((protocol == 6 || protocol == 2) && !use_usb_info) {
                     		struct udev_device *dev_scsi;
                    @@ -410,9 +486,7 @@ int main(int argc, char **argv)
                     		}
                     	}
                     
                    -	devpath = getenv("DEVPATH");
                    -	if (devpath == NULL)
                    -		devpath = argv[optind];
                    +	devpath = argv[optind];
                     	if (devpath == NULL) {
                     		fprintf(stderr, "No device specified\n");
                     		retval = 1;
                    @@ -456,6 +530,8 @@ int main(int argc, char **argv)
                     			if (instance_str[0] != '\0')
                     				printf("ID_INSTANCE=%s\n", instance_str);
                     			printf("ID_BUS=usb\n");
                    +			if (packed_if_str[0] != '\0')
                    +				printf("ID_USB_INTERFACES=:%s\n", packed_if_str);
                     		} else
                     			printf("%s\n", serial);
                     	}
                    diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules
                    index 7a4b23c630..fff766fb1c 100644
                    --- a/rules/rules.d/60-persistent-input.rules
                    +++ b/rules/rules.d/60-persistent-input.rules
                    @@ -5,7 +5,7 @@ SUBSYSTEM!="input", GOTO="persistent_input_end"
                     KERNEL=="input[0-9]*", GOTO="persistent_input_end"
                     
                     # usb devices
                    -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export"
                    +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
                     SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd"
                     SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse"
                     
                    diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules
                    index df10606e07..6d09506dec 100644
                    --- a/rules/rules.d/60-persistent-serial.rules
                    +++ b/rules/rules.d/60-persistent-serial.rules
                    @@ -10,7 +10,7 @@ ENV{ID_PORT}=="", GOTO="persistent_serial_end"
                     IMPORT="path_id"
                     ENV{ID_PATH}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{ID_PORT}"
                     
                    -IMPORT="usb_id --export"
                    +IMPORT="usb_id --export %p"
                     ENV{ID_SERIAL}=="", GOTO="persistent_serial_end"
                     SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}"
                     ENV{ID_IFACE}=="", GOTO="persistent_serial_end"
                    diff --git a/rules/rules.d/60-persistent-v4l.rules b/rules/rules.d/60-persistent-v4l.rules
                    index fb961b79e0..8415cd059b 100644
                    --- a/rules/rules.d/60-persistent-v4l.rules
                    +++ b/rules/rules.d/60-persistent-v4l.rules
                    @@ -3,7 +3,7 @@
                     ACTION!="add|change", GOTO="persistent_v4l_end"
                     SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end"
                     
                    -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export"
                    +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
                     KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}"
                     
                     # check for valid "index" number
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From f95f1deea1eb15994fe9652d2d9377b466cbd07c Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 26 Feb 2009 17:58:22 +0100
                    Subject: usb_id: return values if called directly for an usb_device
                    
                    ---
                     extras/usb_id/usb_id.c | 18 +++++++++++++-----
                     1 file changed, 13 insertions(+), 5 deletions(-)
                    
                    diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c
                    index 489f97e537..92c5f479c3 100644
                    --- a/extras/usb_id/usb_id.c
                    +++ b/extras/usb_id/usb_id.c
                    @@ -186,7 +186,7 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len
                     		u_int8_t	bInterfaceProtocol;
                     		u_int8_t	iInterface;
                     	} __attribute__((packed));
                    -	int err;
                    +	int err = 0;
                     
                     	if (asprintf(&filename, "%s/descriptors", udev_device_get_syspath(dev)) < 0) {
                     		err = -1;
                    @@ -233,7 +233,7 @@ static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len
                     	}
                     out:
                     	free(filename);
                    -	return 0;
                    +	return err;
                     }
                     
                     /*
                    @@ -257,14 +257,21 @@ out:
                     static int usb_id(struct udev_device *dev)
                     {
                     	struct udev *udev = udev_device_get_udev(dev);
                    -	struct udev_device *dev_interface;
                    -	struct udev_device *dev_usb;
                    +	struct udev_device *dev_interface = NULL;
                    +	struct udev_device *dev_usb = NULL;
                     	const char *if_class, *if_subclass;
                     	int if_class_num;
                     	int protocol = 0;
                     
                     	dbg(udev, "syspath %s\n", udev_device_get_syspath(dev));
                     
                    +	/* shortcut if we are called for a usb_device */
                    +	if (strcmp(udev_device_get_devtype(dev), "usb_device") == 0) {
                    +		dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str));
                    +		dev_usb = dev;
                    +		goto fallback;
                    +	}
                    +
                     	/* usb interface directory */
                     	dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface");
                     	if (dev_interface == NULL) {
                    @@ -526,7 +533,8 @@ int main(int argc, char **argv)
                     			printf("ID_SERIAL=%s\n", serial);
                     			if (serial_str[0] != '\0')
                     				printf("ID_SERIAL_SHORT=%s\n", serial_str);
                    -			printf("ID_TYPE=%s\n", type_str);
                    +			if (type_str[0] != '\0')
                    +				printf("ID_TYPE=%s\n", type_str);
                     			if (instance_str[0] != '\0')
                     				printf("ID_INSTANCE=%s\n", instance_str);
                     			printf("ID_BUS=usb\n");
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 468641f87fbe458f8ee7ed7696b408f6ba98e57d Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 26 Feb 2009 20:57:48 +0100
                    Subject: usb_id: fix NULL string usage
                    
                    ---
                     extras/usb_id/usb_id.c | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c
                    index 92c5f479c3..9ce0cdbe13 100644
                    --- a/extras/usb_id/usb_id.c
                    +++ b/extras/usb_id/usb_id.c
                    @@ -266,7 +266,7 @@ static int usb_id(struct udev_device *dev)
                     	dbg(udev, "syspath %s\n", udev_device_get_syspath(dev));
                     
                     	/* shortcut if we are called for a usb_device */
                    -	if (strcmp(udev_device_get_devtype(dev), "usb_device") == 0) {
                    +	if (udev_device_get_devtype(dev) != NULL && strcmp(udev_device_get_devtype(dev), "usb_device") == 0) {
                     		dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str));
                     		dev_usb = dev;
                     		goto fallback;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 5afd777ebb6c797aaf7fe8b6c3b9eab62521abd7 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 26 Feb 2009 22:10:40 +0100
                    Subject: usb_id: fix comment
                    
                    ---
                     extras/usb_id/usb_id.c | 5 ++---
                     1 file changed, 2 insertions(+), 3 deletions(-)
                    
                    diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c
                    index 9ce0cdbe13..b15263ef7d 100644
                    --- a/extras/usb_id/usb_id.c
                    +++ b/extras/usb_id/usb_id.c
                    @@ -239,8 +239,7 @@ out:
                     /*
                      * A unique USB identification is generated like this:
                      *
                    - * 1.) Get the USB device type from DeviceClass, InterfaceClass
                    - *     and InterfaceSubClass
                    + * 1.) Get the USB device type from InterfaceClass and InterfaceSubClass
                      * 2.) If the device type is 'Mass-Storage/SPC-2' or 'Mass-Storage/RBC'
                      *     use the SCSI vendor and model as USB-Vendor and USB-model.
                      * 3.) Otherwise use the USB manufacturer and product as
                    @@ -265,7 +264,7 @@ static int usb_id(struct udev_device *dev)
                     
                     	dbg(udev, "syspath %s\n", udev_device_get_syspath(dev));
                     
                    -	/* shortcut if we are called for a usb_device */
                    +	/* shortcut, if we are called directly for a "usb_device" type */
                     	if (udev_device_get_devtype(dev) != NULL && strcmp(udev_device_get_devtype(dev), "usb_device") == 0) {
                     		dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str));
                     		dev_usb = dev;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From b38a5801f90b936469f69214a2f4d8e4bb99814f Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 26 Feb 2009 22:59:40 +0100
                    Subject: udevadm: info - export all devices with --export-db
                    
                    ---
                     udev/udevadm-info.c | 3 +--
                     1 file changed, 1 insertion(+), 2 deletions(-)
                    
                    diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c
                    index 094c6ce2a8..b9892eca05 100644
                    --- a/udev/udevadm-info.c
                    +++ b/udev/udevadm-info.c
                    @@ -202,8 +202,7 @@ static int export_devices(struct udev *udev)
                     
                     		device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry));
                     		if (device != NULL) {
                    -			if (udev_device_get_devnode(device) != NULL)
                    -				print_record(device);
                    +			print_record(device);
                     			udev_device_unref(device);
                     		}
                     	}
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 0ee5a241fcdc68ad5fe12dd59f5c92389774a8ad Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 26 Feb 2009 23:28:20 +0100
                    Subject: release 139
                    
                    ---
                     ChangeLog | 29 +++++++++++++++++++++++++++++
                     NEWS      |  5 +++++
                     2 files changed, 34 insertions(+)
                    
                    diff --git a/ChangeLog b/ChangeLog
                    index d17cb9e025..6ddc0a511a 100644
                    --- a/ChangeLog
                    +++ b/ChangeLog
                    @@ -1,3 +1,32 @@
                    +Summary of changes from v138 to v139
                    +============================================
                    +
                    +Kay Sievers (11):
                    +      version bump
                    +      remove static local variable
                    +      use the event udev_device to disable the watch on "remove"
                    +      add "nowatch" to disable a default installed watch with a later rule
                    +      add m4/ subdir
                    +      use AC_USE_SYSTEM_EXTENSIONS instead of AC_GNU_SOURCE
                    +      usb_id: add ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:
                    +      usb_id: return values if called directly for an usb_device
                    +      usb_id: fix NULL string usage
                    +      usb_id: fix comment
                    +      udevadm: info - export all devices with --export-db
                    +
                    +Scott James Remnant (10):
                    +      Don't add inotify watch until RUN rules processed.
                    +      Clear existing inotify watch before processing.
                    +      Cleanup a little.
                    +      Allow watch handle to be stored in the udevdb.
                    +      Store watch handle in db.
                    +      Use the udevdb to speed up watch clearing.
                    +      Put a log message in a more sensible place.
                    +      Output watch handle in udevadm info.
                    +      lookup the old watch handle; reload only if has a path
                    +      Look at more inotify events in the buffer than just the first.
                    +
                    +
                     Summary of changes from v137 to v138
                     ============================================
                     
                    diff --git a/NEWS b/NEWS
                    index e57e0fe517..5fb79d3ccc 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -2,6 +2,11 @@ udev 139
                     ========
                     Bugfixes.
                     
                    +The installed watch for block device metadata changes is now removed
                    +during event hadling, because some (broken) tools may be called from udev
                    +rules and (wrongly) open the device with write access. After the finished
                    +event handling the watch is restored.
                    +
                     udev 138
                     ========
                     Bugfixes.
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From cb81636a01be769c1aa23105e7b711a70d18a4ac Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 3 Mar 2009 00:55:42 +0100
                    Subject: version bump
                    
                    ---
                     NEWS         | 4 ++++
                     configure.ac | 2 +-
                     2 files changed, 5 insertions(+), 1 deletion(-)
                    
                    diff --git a/NEWS b/NEWS
                    index 5fb79d3ccc..4d59c95f61 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -1,3 +1,7 @@
                    +udev 140
                    +========
                    +Bugfixes.
                    +
                     udev 139
                     ========
                     Bugfixes.
                    diff --git a/configure.ac b/configure.ac
                    index 40311cd385..e916cfca9f 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -1,5 +1,5 @@
                     AC_INIT([udev],
                    -	[139],
                    +	[140],
                     	[linux-hotplug@vger.kernel.org])
                     AC_PREREQ(2.60)
                     AC_CONFIG_SRCDIR([udev/udevd.c])
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 2236ddae2dc1c7d7b380452341b3beefeb471bd9 Mon Sep 17 00:00:00 2001
                    From: Michael Prokop 
                    Date: Tue, 3 Mar 2009 16:50:58 +0100
                    Subject: fix compile error in debug mode
                    MIME-Version: 1.0
                    Content-Type: text/plain; charset=UTF-8
                    Content-Transfer-Encoding: 8bit
                    
                    When building with './configure --enable-debug && make' it fails with:
                      udev-rules.c: In function ‘dump_token’:
                      udev-rules.c:366: error: ‘struct ’ has no member named ‘i’
                    
                    Signed-off-by: Michael Prokop 
                    ---
                     udev/udev-rules.c | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/udev/udev-rules.c b/udev/udev-rules.c
                    index 905a1a0038..663a6d4f04 100644
                    --- a/udev/udev-rules.c
                    +++ b/udev/udev-rules.c
                    @@ -363,7 +363,7 @@ static void dump_token(struct udev_rules *rules, struct token *token)
                     		    token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode);
                     		break;
                     	case TK_A_INOTIFY_WATCH:
                    -		dbg(rules->udev, "%s %u\n", token_str(type), token->key.i);
                    +		dbg(rules->udev, "%s %u\n", token_str(type), token->key.watch);
                     		break;
                     	case TK_A_NUM_FAKE_PART:
                     		dbg(rules->udev, "%s %u\n", token_str(type), token->key.num_fake_part);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 9270e080822df3be6d320248f98bfc71b3984abf Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 3 Mar 2009 18:26:11 +0100
                    Subject: update TODO
                    
                    ---
                     TODO | 3 ++-
                     1 file changed, 2 insertions(+), 1 deletion(-)
                    
                    diff --git a/TODO b/TODO
                    index dc5d9879cf..26900609b2 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -1,9 +1,10 @@
                     
                    +  o remove MMC rules, they got a modalias now
                       o add scsi:t-0x09* to ch and remove modprobe rule
                       o switch device mapper rules to:
                          dmsetup info -c --nameprefixes --unquoted --rows --noheadings \
                            -o name,uuid,suspended,readonly,major,minor,open,tables_loaded
                    -  o implement path_id with libudev
                    +  o implement path_id in C with libudev
                       o convert firmware.sh to C (?)
                       o drop the DVB shell script rule (2.6.29+)
                       o "udevadm control" commands will only accept the -- syntax
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 1597517c9effc275b8b89c8722c808777c17173f Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 3 Mar 2009 20:11:09 +0100
                    Subject: volume_id: ntfs - fix uuid setting
                    
                    In my scenario, the ntfs prober did *not* detect the presence of a
                    ntfs filesystem (i.e. vol_id --probe-all returned *only* ext3).
                    However, if you examine the source of the ntfs prober, it overwrites
                    the uuid field of the volume_id object long before it actually
                    decides there's a valid filesystem there - this resulted in vol_id
                    returning the rather bizarre combination of type=ext3, but a uuid
                    populated by the ntfs prober.
                    
                    https://bugs.edge.launchpad.net/ubuntu/+source/udev/+bug/337015
                    ---
                     configure.ac                | 2 +-
                     extras/volume_id/lib/ntfs.c | 4 +++-
                     2 files changed, 4 insertions(+), 2 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index e916cfca9f..5b2d920721 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -24,7 +24,7 @@ AC_SUBST(LIBUDEV_LT_AGE)
                     
                     dnl /* libvolume_id version */
                     VOLID_LT_CURRENT=1
                    -VOLID_LT_REVISION=9
                    +VOLID_LT_REVISION=10
                     VOLID_LT_AGE=0
                     AC_SUBST(VOLID_LT_CURRENT)
                     AC_SUBST(VOLID_LT_REVISION)
                    diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c
                    index b322c77dbd..f727634094 100644
                    --- a/extras/volume_id/lib/ntfs.c
                    +++ b/extras/volume_id/lib/ntfs.c
                    @@ -97,6 +97,7 @@ static struct volume_info {
                     
                     int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
                     {
                    +	uint8_t volume_serial[8];
                     	unsigned int sector_size;
                     	unsigned int cluster_size;
                     	uint64_t mft_cluster;
                    @@ -119,7 +120,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
                     	if (memcmp(ns->oem_id, "NTFS", 4) != 0)
                     		return -1;
                     
                    -	volume_id_set_uuid(id, ns->volume_serial, 0, UUID_64BIT_LE);
                    +	memcpy(volume_serial, ns->volume_serial, sizeof(volume_serial));
                     
                     	sector_size = le16_to_cpu(ns->bytes_per_sector);
                     	if (sector_size < 0x200)
                    @@ -193,6 +194,7 @@ int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size)
                     		}
                     	}
                     
                    +	volume_id_set_uuid(id, volume_serial, 0, UUID_64BIT_LE);
                     	volume_id_set_usage(id, VOLUME_ID_FILESYSTEM);
                     	id->type = "ntfs";
                     	/* we think this is ntfs, but we make sure no other signatures are found */
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 00440f21af1c847589c35e0ac98d7b9b4db0e0bd Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 4 Mar 2009 12:39:52 +0100
                    Subject: update TODO
                    
                    ---
                     TODO | 7 +++----
                     1 file changed, 3 insertions(+), 4 deletions(-)
                    
                    diff --git a/TODO b/TODO
                    index 26900609b2..47f142193b 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -1,12 +1,11 @@
                     
                    -  o remove MMC rules, they got a modalias now
                    -  o add scsi:t-0x09* to ch and remove modprobe rule
                    +  o drop the DVB shell script rule (2.6.29)
                    +  o remove MMC rules, they got a modalias now (2.6.30)
                    +  o add scsi:t-0x09* to "ch" and remove modprobe rule
                       o switch device mapper rules to:
                          dmsetup info -c --nameprefixes --unquoted --rows --noheadings \
                            -o name,uuid,suspended,readonly,major,minor,open,tables_loaded
                       o implement path_id in C with libudev
                       o convert firmware.sh to C (?)
                    -  o drop the DVB shell script rule (2.6.29+)
                       o "udevadm control" commands will only accept the -- syntax
                       o symlink names to udevadm will no longer be resolved to old command names
                    -  o get distros to agree on a default set of rules
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 56a7cb127177f4022e5d2df3e51d7a5d7a297da5 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 4 Mar 2009 12:44:08 +0100
                    Subject: rules: Fedora update
                    
                    ---
                     rules/redhat/95-pam-console.rules | 1 -
                     1 file changed, 1 deletion(-)
                     delete mode 100644 rules/redhat/95-pam-console.rules
                    
                    diff --git a/rules/redhat/95-pam-console.rules b/rules/redhat/95-pam-console.rules
                    deleted file mode 100644
                    index cbb2d4aaf9..0000000000
                    --- a/rules/redhat/95-pam-console.rules
                    +++ /dev/null
                    @@ -1 +0,0 @@
                    -ENV{STARTUP}!="1", ACTION=="add", SYSFS{dev}=="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From a5d8cffad9020247c9ba81a9e0a9b9cee5c4a4d5 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 4 Mar 2009 23:32:16 +0100
                    Subject: libudev: queue - use lstat() to check existence of symlink
                    
                    ---
                     configure.ac             | 2 +-
                     udev/lib/libudev-queue.c | 2 +-
                     2 files changed, 2 insertions(+), 2 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index 5b2d920721..022c4cb011 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -16,7 +16,7 @@ test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix=
                     
                     dnl /* libudev version */
                     LIBUDEV_LT_CURRENT=0
                    -LIBUDEV_LT_REVISION=9
                    +LIBUDEV_LT_REVISION=10
                     LIBUDEV_LT_AGE=0
                     AC_SUBST(LIBUDEV_LT_CURRENT)
                     AC_SUBST(LIBUDEV_LT_REVISION)
                    diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c
                    index 51878dab67..7ec2237010 100644
                    --- a/udev/lib/libudev-queue.c
                    +++ b/udev/lib/libudev-queue.c
                    @@ -194,7 +194,7 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo
                     	}
                     	snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu",
                     		 udev_get_dev_path(udev_queue->udev), seqnum);
                    -	if (stat(filename, &statbuf) == 0)
                    +	if (lstat(filename, &statbuf) == 0)
                     		return 0;
                     	dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum);
                     	return 1;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 98d3d51715de205b8231984b57ffbf01af0fb470 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 4 Mar 2009 23:48:53 +0100
                    Subject: udevadm: settle - add --seq-start= --seq-end=
                    
                    It might be useful in some cases not to wait for "all" events.
                    
                      $ read START < /sys/kernel/uevent_seqnum
                      $ (do something which may create uevents)
                      $ udevadm settle --seq-start=$START
                    ---
                     udev/udevadm-settle.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++-
                     1 file changed, 59 insertions(+), 1 deletion(-)
                    
                    diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c
                    index 867bbed137..8976c9a16b 100644
                    --- a/udev/udevadm-settle.c
                    +++ b/udev/udevadm-settle.c
                    @@ -36,11 +36,15 @@
                     int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     {
                     	static const struct option options[] = {
                    +		{ "seq-start", required_argument, NULL, 's' },
                    +		{ "seq-end", required_argument, NULL, 'e' },
                     		{ "timeout", required_argument, NULL, 't' },
                     		{ "quiet", no_argument, NULL, 'q' },
                     		{ "help", no_argument, NULL, 'h' },
                     		{}
                     	};
                    +	unsigned long long start = 0;
                    +	unsigned long long end = 0;
                     	int timeout = DEFAULT_TIMEOUT;
                     	int quiet = 0;
                     	struct udev_queue *udev_queue = NULL;
                    @@ -53,11 +57,17 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     		int option;
                     		int seconds;
                     
                    -		option = getopt_long(argc, argv, "t:qh", options, NULL);
                    +		option = getopt_long(argc, argv, "s:e:t:qh", options, NULL);
                     		if (option == -1)
                     			break;
                     
                     		switch (option) {
                    +		case 's':
                    +			start = strtoull(optarg, NULL, 0);
                    +			break;
                    +		case 'e':
                    +			end = strtoull(optarg, NULL, 0);
                    +			break;
                     		case 't':
                     			seconds = atoi(optarg);
                     			if (seconds >= 0)
                    @@ -79,9 +89,57 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     	if (udev_queue == NULL)
                     		goto exit;
                     	loop = timeout * LOOP_PER_SECOND;
                    +
                    +	if (start > 0) {
                    +		unsigned long long kernel_seq;
                    +
                    +		kernel_seq = udev_queue_get_kernel_seqnum(udev_queue);
                    +
                    +		/* unless specified, the last event is the current kernel seqnum */
                    +		if (end == 0)
                    +			end = udev_queue_get_kernel_seqnum(udev_queue);
                    +
                    +		if (start > end) {
                    +			err(udev, "seq-start larger than seq-end, ignoring\n");
                    +			fprintf(stderr, "seq-start larger than seq-end, ignoring\n");
                    +			start = 0;
                    +			end = 0;
                    +		}
                    +
                    +		if (start > kernel_seq || end > kernel_seq) {
                    +			err(udev, "seq-start or seq-end larger than current kernel value, ignoring\n");
                    +			fprintf(stderr, "seq-start or seq-end larger than current kernel value, ignoring\n");
                    +			start = 0;
                    +			end = 0;
                    +		}
                    +		info(udev, "start=%llu end=%llu current=%llu\n", start, end, kernel_seq);
                    +	} else {
                    +		if (end > 0) {
                    +			err(udev, "seq-end needs seq-start parameter, ignoring\n");
                    +			fprintf(stderr, "seq-end needs seq-start parameter, ignoring\n");
                    +			end = 0;
                    +		}
                    +	}
                    +
                     	while (loop--) {
                    +		/* exit if queue is empty */
                     		if (udev_queue_get_queue_is_empty(udev_queue))
                     			break;
                    +
                    +		/* if asked for, wait for a specific sequence of events */
                    +		if (start > 0) {
                    +			unsigned long long seq;
                    +			int finished;
                    +
                    +			finished = 0;
                    +			for (seq = start; seq <= end; seq++) {
                    +				finished  = udev_queue_get_seqnum_is_finished(udev_queue, seq);
                    +				if (!finished)
                    +					break;
                    +			}
                    +			if (finished)
                    +				break;
                    +		}
                     		usleep(1000 * 1000 / LOOP_PER_SECOND);
                     	}
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 45bcd16ca5e2c7917579c63f701683e47b3a4008 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 5 Mar 2009 00:35:58 +0100
                    Subject: udevd: switch watch symlinks to devpath
                    
                    Some broken tools get confused following links to /sys, switch
                    to link targets carrying the devpath instead of the syspath, like
                    the queue links.
                    ---
                     rules/rules.d/50-udev-default.rules |  1 +
                     udev/udev-watch.c                   | 20 +++++++++++---------
                     2 files changed, 12 insertions(+), 9 deletions(-)
                    
                    diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
                    index 95d82d7292..38b954df1e 100644
                    --- a/rules/rules.d/50-udev-default.rules
                    +++ b/rules/rules.d/50-udev-default.rules
                    @@ -1,4 +1,5 @@
                     # do not edit this file, it will be overwritten on update
                    +# initramfs:default
                     
                     SUBSYSTEM=="block", SYMLINK+="block/%M:%m"
                     SUBSYSTEM!="block", SYMLINK+="char/%M:%m"
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index dff3de1cb4..e2c096af0f 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -85,6 +85,7 @@ void udev_watch_restore(struct udev *udev)
                     		while ((ent = readdir(dir)) != NULL) {
                     			char path[UTIL_PATH_SIZE];
                     			char buf[UTIL_PATH_SIZE];
                    +			ssize_t syslen;
                     			ssize_t len;
                     			struct udev_device *dev;
                     
                    @@ -95,13 +96,13 @@ void udev_watch_restore(struct udev *udev)
                     			util_strlcat(path, "/", sizeof(path));
                     			util_strlcat(path, ent->d_name, sizeof(path));
                     
                    -			len = readlink(path, buf, sizeof(buf));
                    -			if (len <= 0) {
                    +			syslen = util_strlcpy(buf, udev_get_sys_path(udev), sizeof(buf));
                    +			len = readlink(path, &buf[syslen], sizeof(buf)-syslen);
                    +			if (len <= 0 || len >= (ssize_t)(sizeof(buf)-syslen)) {
                     				unlink(path);
                     				continue;
                     			}
                    -
                    -			buf[len] = '\0';
                    +			buf[syslen + len] = '\0';
                     			dbg(udev, "old watch to '%s' found\n", buf);
                     			dev = udev_device_new_from_syspath(udev, buf);
                     			if (dev == NULL) {
                    @@ -142,7 +143,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev)
                     	snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd);
                     	util_create_path(udev, filename);
                     	unlink(filename);
                    -	symlink(udev_device_get_syspath(dev), filename);
                    +	symlink(udev_device_get_devpath(dev), filename);
                     
                     	udev_device_set_watch_handle(dev, wd);
                     }
                    @@ -172,16 +173,17 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd)
                     {
                     	char filename[UTIL_PATH_SIZE];
                     	char buf[UTIL_PATH_SIZE];
                    +	ssize_t syslen;
                     	ssize_t len;
                     
                     	if (inotify_fd < 0 || wd < 0)
                     		return NULL;
                     
                     	snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd);
                    -	len = readlink(filename, buf, sizeof(buf));
                    -	if (len > 0) {
                    -		buf[len] = '\0';
                    -
                    +	syslen = util_strlcpy(buf, udev_get_sys_path(udev), sizeof(buf));
                    +	len = readlink(filename, &buf[syslen], sizeof(buf)-syslen);
                    +	if (len > 0 || len < (ssize_t)(sizeof(buf)-syslen)) {
                    +		buf[syslen + len] = '\0';
                     		return udev_device_new_from_syspath(udev, buf);
                     	}
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 18e3d9abc3a0bc57c2f4d45705308e7dc3a60fab Mon Sep 17 00:00:00 2001
                    From: Harald Hoyer 
                    Date: Fri, 6 Mar 2009 12:42:00 +0100
                    Subject: libvolume_id: bump age
                    
                    Because you added the symbol volume_id_set_uuid_sub() in commit
                    14e18278, you have to increase the library minor version.
                    ---
                     configure.ac | 6 +++---
                     1 file changed, 3 insertions(+), 3 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index 022c4cb011..ab92a86ad5 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -23,9 +23,9 @@ AC_SUBST(LIBUDEV_LT_REVISION)
                     AC_SUBST(LIBUDEV_LT_AGE)
                     
                     dnl /* libvolume_id version */
                    -VOLID_LT_CURRENT=1
                    -VOLID_LT_REVISION=10
                    -VOLID_LT_AGE=0
                    +VOLID_LT_CURRENT=2
                    +VOLID_LT_REVISION=0
                    +VOLID_LT_AGE=1
                     AC_SUBST(VOLID_LT_CURRENT)
                     AC_SUBST(VOLID_LT_REVISION)
                     AC_SUBST(VOLID_LT_AGE)
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From f1e7e360465acc7fb038e941c398216cdb569253 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sat, 7 Mar 2009 02:32:40 +0100
                    Subject: udevadm: add text for new options to command and man page
                    
                    ---
                     udev/udevadm-info.c    |  3 +--
                     udev/udevadm-monitor.c |  2 +-
                     udev/udevadm-settle.c  |  7 ++++++-
                     udev/udevadm-test.c    |  2 +-
                     udev/udevadm-trigger.c |  3 +--
                     udev/udevadm.xml       | 12 ++++++++++++
                     6 files changed, 22 insertions(+), 7 deletions(-)
                    
                    diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c
                    index b9892eca05..f20eb07e04 100644
                    --- a/udev/udevadm-info.c
                    +++ b/udev/udevadm-info.c
                    @@ -387,8 +387,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[])
                     			       "                             of parent devices\n"
                     			       "  --device-id-of-file= print major:minor of device containing this file\n"
                     			       "  --export-db                export the content of the udev database\n"
                    -			       "  --help                     print this text\n"
                    -			       "\n");
                    +			       "  --help\n\n");
                     			goto exit;
                     		default:
                     			goto exit;
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index 14a6edc844..77d98facd5 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -104,7 +104,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     			       "  --env    print the whole event environment\n"
                     			       "  --kernel print kernel uevents\n"
                     			       "  --udev   print udev events\n"
                    -			       "  --help   print this help text\n\n");
                    +			       "  --help\n\n");
                     		default:
                     			goto out;
                     		}
                    diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c
                    index 8976c9a16b..f9e6415a00 100644
                    --- a/udev/udevadm-settle.c
                    +++ b/udev/udevadm-settle.c
                    @@ -80,7 +80,12 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     			quiet = 1;
                     			break;
                     		case 'h':
                    -			printf("Usage: udevadm settle [--help] [--timeout=] [--quiet]\n\n");
                    +			printf("Usage: udevadm settle OPTIONS\n"
                    +			       "  --timeout=   maximum time to wait for events\n"
                    +			       "  --seq-start=  first seqnum to wait for\n"
                    +			       "  --seq-end=    last seqnum to wait for\n"
                    +			       "  --quiet               do not print list after timeout\n"
                    +			       "  --help\n\n");
                     			goto exit;
                     		}
                     	}
                    diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c
                    index 9d505146cf..664d72f6d3 100644
                    --- a/udev/udevadm-test.c
                    +++ b/udev/udevadm-test.c
                    @@ -64,7 +64,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[])
                     		case 'h':
                     			printf("Usage: udevadm test OPTIONS \n"
                     			       "  --action=     set action string\n"
                    -			       "  --help                print this help text\n\n");
                    +			       "  --help\n\n");
                     			exit(0);
                     		default:
                     			exit(1);
                    diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c
                    index e475e40949..c88534600d 100644
                    --- a/udev/udevadm-trigger.c
                    +++ b/udev/udevadm-trigger.c
                    @@ -180,8 +180,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[])
                     			       "  --subsystem-nomatch= exclude devices from a matching subystem\n"
                     			       "  --attr-match=]>   trigger devices with a matching attribute\n"
                     			       "  --attr-nomatch=]> exclude devices with a matching attribute\n"
                    -			       "  --help                          print this text\n"
                    -			       "\n");
                    +			       "  --help\n\n");
                     			goto exit;
                     		default:
                     			goto exit;
                    diff --git a/udev/udevadm.xml b/udev/udevadm.xml
                    index 9d905abd0c..1092498a46 100644
                    --- a/udev/udevadm.xml
                    +++ b/udev/udevadm.xml
                    @@ -224,6 +224,18 @@
                                     and always return immediately.
                                   
                                 
                    +            
                    +              
                    +              
                    +                Wait only for events after the given sequence number.
                    +              
                    +            
                    +            
                    +              
                    +              
                    +                Wait only for events before the given sequence number.
                    +              
                    +            
                                 
                                   
                                   
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From b2fbf53a081539c8ade6759f1df7d8953f76dc8d Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sat, 7 Mar 2009 02:35:18 +0100
                    Subject: update TODO
                    
                    ---
                     TODO | 3 ++-
                     1 file changed, 2 insertions(+), 1 deletion(-)
                    
                    diff --git a/TODO b/TODO
                    index 47f142193b..316ec65859 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -1,11 +1,12 @@
                     
                    +  o drop modprobe floppy alias, it will be in the module (2.6.30)
                       o drop the DVB shell script rule (2.6.29)
                       o remove MMC rules, they got a modalias now (2.6.30)
                       o add scsi:t-0x09* to "ch" and remove modprobe rule
                       o switch device mapper rules to:
                          dmsetup info -c --nameprefixes --unquoted --rows --noheadings \
                            -o name,uuid,suspended,readonly,major,minor,open,tables_loaded
                    -  o implement path_id in C with libudev
                    +  o implement path_id in C with libudev (?)
                       o convert firmware.sh to C (?)
                       o "udevadm control" commands will only accept the -- syntax
                       o symlink names to udevadm will no longer be resolved to old command names
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 89d080c3aedacadfb0b1022e101957998d4cdaf1 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 11 Mar 2009 13:32:39 +0100
                    Subject: libudev: ctrl - return error after sending ctrl message
                    
                    ---
                     configure.ac            |  6 +++---
                     udev/lib/libudev-ctrl.c | 18 ++++++------------
                     2 files changed, 9 insertions(+), 15 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index ab92a86ad5..3a624308df 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -15,9 +15,9 @@ AC_PREFIX_DEFAULT([/usr])
                     test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix=
                     
                     dnl /* libudev version */
                    -LIBUDEV_LT_CURRENT=0
                    -LIBUDEV_LT_REVISION=10
                    -LIBUDEV_LT_AGE=0
                    +LIBUDEV_LT_CURRENT=1
                    +LIBUDEV_LT_REVISION=0
                    +LIBUDEV_LT_AGE=1
                     AC_SUBST(LIBUDEV_LT_CURRENT)
                     AC_SUBST(LIBUDEV_LT_REVISION)
                     AC_SUBST(LIBUDEV_LT_AGE)
                    diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c
                    index caf0dc08a3..570e91c89e 100644
                    --- a/udev/lib/libudev-ctrl.c
                    +++ b/udev/lib/libudev-ctrl.c
                    @@ -168,38 +168,32 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int
                     
                     int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority)
                     {
                    -	ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL);
                    -	return 0;
                    +	return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL);
                     }
                     
                     int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl)
                     {
                    -	ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL);
                    -	return 0;
                    +	return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL);
                     }
                     
                     int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl)
                     {
                    -	ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL);
                    -	return 0;
                    +	return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL);
                     }
                     
                     int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl)
                     {
                    -	ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL);
                    -	return 0;
                    +	return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL);
                     }
                     
                     int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key)
                     {
                    -	ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key);
                    -	return 0;
                    +	return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key);
                     }
                     
                     int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count)
                     {
                    -	ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS, count, NULL);
                    -	return 0;
                    +	return ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS, count, NULL);
                     }
                     
                     struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl)
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From c2c24d4d3c8f83c5f4507bb13ba6c989f9d6ea45 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 11 Mar 2009 15:06:14 +0100
                    Subject: udevadm: settle - use timeout signal, instead of loop counter
                    
                    ---
                     udev/udevadm-settle.c | 32 +++++++++++++++++++++++++++-----
                     1 file changed, 27 insertions(+), 5 deletions(-)
                    
                    diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c
                    index f9e6415a00..54f905bf6f 100644
                    --- a/udev/udevadm-settle.c
                    +++ b/udev/udevadm-settle.c
                    @@ -25,6 +25,7 @@
                     #include 
                     #include 
                     #include 
                    +#include 
                     #include 
                     #include 
                     
                    @@ -33,6 +34,16 @@
                     #define DEFAULT_TIMEOUT			180
                     #define LOOP_PER_SECOND			20
                     
                    +static int volatile is_timeout;
                    +
                    +static void asmlinkage sig_handler(int signum)
                    +{
                    +	switch (signum) {
                    +		case SIGALRM:
                    +			is_timeout = 1;
                    +	}
                    +}
                    +
                     int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     {
                     	static const struct option options[] = {
                    @@ -45,14 +56,21 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     	};
                     	unsigned long long start = 0;
                     	unsigned long long end = 0;
                    -	int timeout = DEFAULT_TIMEOUT;
                     	int quiet = 0;
                    +	int timeout = 0;
                    +	struct sigaction act;
                     	struct udev_queue *udev_queue = NULL;
                    -	int loop;
                     	int rc = 0;
                     
                     	dbg(udev, "version %s\n", VERSION);
                     
                    +	/* set signal handlers */
                    +	memset(&act, 0x00, sizeof(act));
                    +	act.sa_handler = (void (*)(int)) sig_handler;
                    +	sigemptyset (&act.sa_mask);
                    +	act.sa_flags = 0;
                    +	sigaction(SIGALRM, &act, NULL);
                    +
                     	while (1) {
                     		int option;
                     		int seconds;
                    @@ -90,10 +108,14 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     		}
                     	}
                     
                    +	if (timeout > 0)
                    +		alarm(timeout);
                    +	else
                    +		alarm(DEFAULT_TIMEOUT);
                    +
                     	udev_queue = udev_queue_new(udev);
                     	if (udev_queue == NULL)
                     		goto exit;
                    -	loop = timeout * LOOP_PER_SECOND;
                     
                     	if (start > 0) {
                     		unsigned long long kernel_seq;
                    @@ -126,7 +148,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     		}
                     	}
                     
                    -	while (loop--) {
                    +	while (!is_timeout) {
                     		/* exit if queue is empty */
                     		if (udev_queue_get_queue_is_empty(udev_queue))
                     			break;
                    @@ -149,7 +171,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     	}
                     
                     	/* if we reached the timeout, print the list of remaining events */
                    -	if (loop <= 0) {
                    +	if (is_timeout) {
                     		struct udev_list_entry *list_entry;
                     
                     		if (!quiet) {
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From bb38678e3ccc02bcd970ccde3d8166a40edf92d3 Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Tue, 10 Mar 2009 13:00:16 +0000
                    Subject: udevadm: settle - synchronise with the udev daemon
                    
                    There's still a slight race condition when using udevadm settle, if the
                    udev daemon has a pending inotify event but hasn't yet generated the
                    "change" uevent for it, the kernel and udev sequence numbers will match
                    and settle will exit.
                    
                    Now udevadm settle will send a control message to udevd, which will
                    respond by sending SIGUSR1 back to the waiting udevadm settle once it
                    has completed the main loop iteration in which it received the control
                    message.
                    
                    If there were no pending inotify events, this will simply wake up the
                    udev daemon and allow settle to continue.  If there are pending inotify
                    events, they are handled first in the main loop so when settle is
                    continued they will have been turned into uevents and the kernel
                    sequence number will have been incremented.
                    
                    Since the inotify event is pending for udevd when the close() system
                    call returns (it's queued as part of the kernel handling for that system
                    call), and since the kernel sequence number is incremented by writing to
                    the uevent file (as udevd does), this solves the race.
                    
                    When the settle continues, if there were pending inotify events that
                    udevd had not read, they are now pending uevents which settle can wait
                    for.
                    
                    Signed-off-by: Scott James Remnant 
                    ---
                     udev/lib/libudev-ctrl.c    | 16 ++++++++++++++++
                     udev/lib/libudev-private.h |  2 ++
                     udev/udevadm-settle.c      | 23 +++++++++++++++++++++++
                     udev/udevd.c               | 13 +++++++++++++
                     4 files changed, 54 insertions(+)
                    
                    diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c
                    index 570e91c89e..ca8b845b94 100644
                    --- a/udev/lib/libudev-ctrl.c
                    +++ b/udev/lib/libudev-ctrl.c
                    @@ -42,6 +42,7 @@ enum udev_ctrl_msg_type {
                     	UDEV_CTRL_SET_ENV,
                     	UDEV_CTRL_SET_MAX_CHILDS,
                     	UDEV_CTRL_SET_MAX_CHILDS_RUNNING,
                    +	UDEV_CTRL_SETTLE,
                     };
                     
                     struct udev_ctrl_msg_wire {
                    @@ -58,6 +59,7 @@ struct udev_ctrl_msg {
                     	int refcount;
                     	struct udev_ctrl *uctrl;
                     	struct udev_ctrl_msg_wire ctrl_msg_wire;
                    +	pid_t pid;
                     };
                     
                     struct udev_ctrl {
                    @@ -196,6 +198,11 @@ int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count)
                     	return ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS, count, NULL);
                     }
                     
                    +int udev_ctrl_send_settle(struct udev_ctrl *uctrl)
                    +{
                    +	return ctrl_send(uctrl, UDEV_CTRL_SETTLE, 0, NULL);
                    +}
                    +
                     struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl)
                     {
                     	struct udev_ctrl_msg *uctrl_msg;
                    @@ -239,6 +246,8 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl)
                     		goto err;
                     	}
                     
                    +	uctrl_msg->pid = cred->pid;
                    +
                     	if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) {
                     		err(uctrl->udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic);
                     		goto err;
                    @@ -311,3 +320,10 @@ int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg)
                     		return ctrl_msg->ctrl_msg_wire.intval;
                     	return -1;
                     }
                    +
                    +pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg)
                    +{
                    +	if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SETTLE)
                    +		return ctrl_msg->pid;
                    +	return -1;
                    +}
                    diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
                    index 0627aea071..91e2d5f816 100644
                    --- a/udev/lib/libudev-private.h
                    +++ b/udev/lib/libudev-private.h
                    @@ -109,6 +109,7 @@ extern int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority);
                     extern int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl);
                     extern int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl);
                     extern int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl);
                    +extern int udev_ctrl_send_settle(struct udev_ctrl *uctrl);
                     extern int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key);
                     extern int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count);
                     struct udev_ctrl_msg;
                    @@ -120,6 +121,7 @@ extern int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg);
                     extern int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg);
                     extern int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg);
                     extern int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg);
                    +extern pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg);
                     extern const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg);
                     extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg);
                     
                    diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c
                    index 54f905bf6f..1c3c28176b 100644
                    --- a/udev/udevadm-settle.c
                    +++ b/udev/udevadm-settle.c
                    @@ -1,5 +1,7 @@
                     /*
                      * Copyright (C) 2006-2008 Kay Sievers 
                    + * Copyright (C) 2009 Canonical Ltd.
                    + * Copyright (C) 2009 Scott James Remnant 
                      *
                      * 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
                    @@ -41,6 +43,8 @@ static void asmlinkage sig_handler(int signum)
                     	switch (signum) {
                     		case SIGALRM:
                     			is_timeout = 1;
                    +		case SIGUSR1:
                    +			;
                     	}
                     }
                     
                    @@ -70,6 +74,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     	sigemptyset (&act.sa_mask);
                     	act.sa_flags = 0;
                     	sigaction(SIGALRM, &act, NULL);
                    +	sigaction(SIGUSR1, &act, NULL);
                     
                     	while (1) {
                     		int option;
                    @@ -148,6 +153,24 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     		}
                     	}
                     
                    +	/* guarantee that the udev daemon isn't pre-processing */
                    +	if (getuid() == 0) {
                    +		struct udev_ctrl *uctrl;
                    +
                    +		uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH);
                    +		if (uctrl != NULL) {
                    +			sigset_t mask, oldmask;
                    +
                    +			sigemptyset(&mask);
                    +			sigaddset(&mask, SIGUSR1);
                    +			sigaddset(&mask, SIGALRM);
                    +			sigprocmask(SIG_BLOCK, &mask, &oldmask);
                    +			if (udev_ctrl_send_settle(uctrl) > 0)
                    +				sigsuspend(&oldmask);
                    +			udev_ctrl_unref(uctrl);
                    +		}
                    +	}
                    +
                     	while (!is_timeout) {
                     		/* exit if queue is empty */
                     		if (udev_queue_get_queue_is_empty(udev_queue))
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index ee3d6f5033..291655ef00 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -1,6 +1,8 @@
                     /*
                      * Copyright (C) 2004-2008 Kay Sievers 
                      * Copyright (C) 2004 Chris Friesen 
                    + * Copyright (C) 2009 Canonical Ltd.
                    + * Copyright (C) 2009 Scott James Remnant 
                      *
                      * 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
                    @@ -69,6 +71,7 @@ static volatile int sigchilds_waiting;
                     static volatile int udev_exit;
                     static volatile int reload_config;
                     static volatile int signal_received;
                    +static volatile pid_t settle_pid;
                     static int run_exec_q;
                     static int stop_exec_q;
                     static int max_childs;
                    @@ -513,6 +516,11 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl)
                     		info(udev, "udevd message (SET_MAX_CHILDS) received, max_childs=%i\n", i);
                     		max_childs = i;
                     	}
                    +
                    +	settle_pid = udev_ctrl_get_settle(ctrl_msg);
                    +	if (settle_pid > 0) {
                    +		info(udev, "udevd message (SETTLE) received\n");
                    +	}
                     	udev_ctrl_msg_unref(ctrl_msg);
                     }
                     
                    @@ -1023,6 +1031,11 @@ handle_signals:
                     			if (!stop_exec_q)
                     				event_queue_manager(udev);
                     		}
                    +
                    +		if (settle_pid > 0) {
                    +			kill(settle_pid, SIGUSR1);
                    +			settle_pid = 0;
                    +		}
                     	}
                     	cleanup_queue_dir(udev);
                     	rc = 0;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 3d8599873a3dcba1ebd83dc984cd490384d40c30 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Fri, 13 Mar 2009 13:17:31 +0100
                    Subject: release 140
                    
                    ---
                     ChangeLog | 27 +++++++++++++++++++++++++++
                     NEWS      |  3 +++
                     TODO      |  2 +-
                     3 files changed, 31 insertions(+), 1 deletion(-)
                    
                    diff --git a/ChangeLog b/ChangeLog
                    index 6ddc0a511a..c7be324fee 100644
                    --- a/ChangeLog
                    +++ b/ChangeLog
                    @@ -1,3 +1,30 @@
                    +Summary of changes from v139 to v140
                    +============================================
                    +
                    +Harald Hoyer (1):
                    +      libvolume_id: bump age
                    +
                    +Kay Sievers (12):
                    +      version bump
                    +      update TODO
                    +      volume_id: ntfs - fix uuid setting
                    +      update TODO
                    +      rules: Fedora update
                    +      libudev: queue - use lstat() to check existence of symlink
                    +      udevadm: settle - add --seq-start= --seq-end=
                    +      udevd: switch watch symlinks to devpath
                    +      udevadm: add text for new options to command and man page
                    +      update TODO
                    +      libudev: ctrl - return error after sending ctrl message
                    +      udevadm: settle - use timeout signal, instead of loop counter
                    +
                    +Michael Prokop (1):
                    +      fix compile error in debug mode
                    +
                    +Scott James Remnant (1):
                    +      udevadm: settle - synchronise with the udev daemon
                    +
                    +
                     Summary of changes from v138 to v139
                     ============================================
                     
                    diff --git a/NEWS b/NEWS
                    index 4d59c95f61..eca93c4d98 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -2,6 +2,9 @@ udev 140
                     ========
                     Bugfixes.
                     
                    +"udevadm settle" now optionally accepts a range of events to wait for,
                    +instead of waiting for "all" events.
                    +
                     udev 139
                     ========
                     Bugfixes.
                    diff --git a/TODO b/TODO
                    index 316ec65859..8deff6aaf2 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -1,5 +1,5 @@
                     
                    -  o drop modprobe floppy alias, it will be in the module (2.6.30)
                    +  o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30)
                       o drop the DVB shell script rule (2.6.29)
                       o remove MMC rules, they got a modalias now (2.6.30)
                       o add scsi:t-0x09* to "ch" and remove modprobe rule
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 376f0a1ef57721a9223b9a3fdf18c717ace64d81 Mon Sep 17 00:00:00 2001
                    From: Michal Soltys 
                    Date: Mon, 16 Mar 2009 01:29:19 +0100
                    Subject: rules: md-raid.rules fix
                    
                    md/array_state in case of partition doesn't exist, so all uevents
                    for partitions didn't execute any SYMLINK rules
                    
                    Signed-off-by: Michal Soltys 
                    ---
                     rules/packages/64-md-raid.rules | 3 +++
                     1 file changed, 3 insertions(+)
                    
                    diff --git a/rules/packages/64-md-raid.rules b/rules/packages/64-md-raid.rules
                    index abb029c46f..4faf18c106 100644
                    --- a/rules/packages/64-md-raid.rules
                    +++ b/rules/packages/64-md-raid.rules
                    @@ -8,6 +8,9 @@ ACTION!="add|change", GOTO="md_end"
                     # import data from a raid set
                     KERNEL!="md*", GOTO="md_end"
                     
                    +# partitions have no md/{array_state,metadata_version}
                    +ENV{DEVTYPE}=="partition", GOTO="md_ignore_state"
                    +
                     # container devices have a metadata version of e.g. 'external:ddf' and
                     # never leave state 'inactive'
                     ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 57df0207aa51216f6ed6ab54c04cc14c295490c5 Mon Sep 17 00:00:00 2001
                    From: Adam Buchbinder 
                    Date: Mon, 16 Mar 2009 16:22:51 -0400
                    Subject: usb_id: add manpage
                    
                    Signed-off-by: Adam Buchbinder 
                    ---
                     extras/usb_id/Makefile.am |  3 +++
                     extras/usb_id/usb_id.8    | 38 ++++++++++++++++++++++++++++++++++++++
                     2 files changed, 41 insertions(+)
                     create mode 100644 extras/usb_id/usb_id.8
                    
                    diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am
                    index dfb52f17e2..07b286d61f 100644
                    --- a/extras/usb_id/Makefile.am
                    +++ b/extras/usb_id/Makefile.am
                    @@ -12,3 +12,6 @@ usb_id_SOURCES = \
                     	../../udev/lib/libudev-util.c \
                     	../../udev/lib/libudev-device.c \
                     	../../udev/lib/libudev-enumerate.c
                    +
                    +dist_man_MANS = \
                    +	usb_id.8
                    diff --git a/extras/usb_id/usb_id.8 b/extras/usb_id/usb_id.8
                    new file mode 100644
                    index 0000000000..0d5c0958b8
                    --- /dev/null
                    +++ b/extras/usb_id/usb_id.8
                    @@ -0,0 +1,38 @@
                    +.TH USB_ID 8 "January 2009" "" "Linux Administrator's Manual"
                    +.SH NAME
                    +usb_id \- udev callout to read information from USB devices
                    +.SH SYNOPSIS
                    +.B usb_id
                    +[\fB--usb-info\fP] [\fB--num-info\fP] [\fB--export\fP] [\fB--debug\fP]
                    +.I devpath
                    +.br
                    +.B usb_id --help
                    +.SH "DESCRIPTION"
                    +.B usb_id
                    +is normally called from a udev rule, to provide udev with a unique string and
                    +additional information (uuid, label) for a USB device. Udev can use this
                    +information to create symlinks in /dev to the real device node.
                    +.SH USAGE
                    +.B usb_id \fIdevpath\fP
                    +opens the device node specified at the commandline and prints the
                    +information chosen by the options.
                    +.SH OPTIONS
                    +The following commandline switches are supported to specify what usb_id
                    +should print:
                    +.TP
                    +.B -u, --usb-info
                    +print USB strings instead of, e.g. SCSI strings for a mass storage device
                    +.TP
                    +.B -n, --num-info
                    +print numerical values instead of strings. Implies \fB--usb-info\fP.
                    +.TP
                    +.B -x, --export
                    +print values as environment keys
                    +.TP
                    +.B -h, --help
                    +print usage help
                    +.RE
                    +.SH SEE ALSO
                    +.BR udev (7)
                    +.SH AUTHORS
                    +Developed by Hannes Reinecke .
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 57a9e68eb7862c14ba7694ff9a0e253f40f97feb Mon Sep 17 00:00:00 2001
                    From: Adam Buchbinder 
                    Date: Mon, 16 Mar 2009 16:22:52 -0400
                    Subject: cdrom_id: update manpage
                    
                    Include usage information on the -d/--debug flag. Also bump the date.
                    
                    Signed-off-by: Adam Buchbinder 
                    ---
                     extras/cdrom_id/cdrom_id.8 | 20 +++++++++++++++-----
                     1 file changed, 15 insertions(+), 5 deletions(-)
                    
                    diff --git a/extras/cdrom_id/cdrom_id.8 b/extras/cdrom_id/cdrom_id.8
                    index 1d4d70dc85..617d9f67d1 100644
                    --- a/extras/cdrom_id/cdrom_id.8
                    +++ b/extras/cdrom_id/cdrom_id.8
                    @@ -1,9 +1,12 @@
                    -.TH CDROM_ID 8 "April 2008" "" "Linux Administrator's Manual"
                    +.TH CDROM_ID 8 "January 2009" "" "Linux Administrator's Manual"
                     .SH NAME
                     cdrom_id \- udev callout to determine the capabilities of optical drives and media
                     .SH SYNOPSIS
                    -.BI cdrom_id
                    -[\fI--export\fP] \fIdevice\fP
                    +.B cdrom_id
                    +[\fB--export\fP] [\fB--debug\fP] \fIdevice\fP
                    +.br
                    +.B cdrom_id
                    +\fB--help\fP
                     .SH "DESCRIPTION"
                     .B cdrom_id
                     is normally called from a udev rule, to provide udev with the list of
                    @@ -16,8 +19,15 @@ discovered capabilities.
                     The following commandline switches are supported to specify what cdrom_id
                     should print:
                     .TP
                    -.BI --export
                    -print all values (default)
                    +.B -x, --export
                    +Print all values as environment keys. This is the default at present, so this
                    +option is currently redundant.
                    +.TP
                    +.B -d, --debug
                    +Print a debug trace.
                    +.TP
                    +.B -h, --help
                    +Print usage help.
                     .RE
                     .SH SEE ALSO
                     .BR udev (7)
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 9a2773c4a42bf36fc5122a42229530e421bc51c3 Mon Sep 17 00:00:00 2001
                    From: Adam Buchbinder 
                    Date: Mon, 16 Mar 2009 16:22:53 -0400
                    Subject: create_floppy_devices: expand manpage
                    
                    Include a table of what the CMOS types are, and note that nothing
                    will be created unless the -t option is specified. Also clean up
                    the formatting and bump the date.
                    
                    Signed-off-by: Adam Buchbinder 
                    ---
                     extras/floppy/create_floppy_devices.8 | 45 ++++++++++++++++++++++-------------
                     1 file changed, 28 insertions(+), 17 deletions(-)
                    
                    diff --git a/extras/floppy/create_floppy_devices.8 b/extras/floppy/create_floppy_devices.8
                    index 332110ab31..2727fc84a0 100644
                    --- a/extras/floppy/create_floppy_devices.8
                    +++ b/extras/floppy/create_floppy_devices.8
                    @@ -1,34 +1,45 @@
                    -.TH CREATE_FLOPPY_DEVICES 8 "May 2007" "" "Linux Administrator's Manual"
                    +.TH CREATE_FLOPPY_DEVICES 8 "January 2009" "" "Linux Administrator's Manual"
                     .SH NAME
                    -create_floppy_devices \- udev callout to create all possible floppy device
                    +create_floppy_devices \- udev callout to create all possible floppy devices
                     based on the CMOS type.
                     .SH SYNOPSIS
                    -create_floppy_devices [options] device
                    +create_floppy_devices [\fIoptions\fP] \fIdevice\fP
                     .SH OPTIONS
                    +Note that no output will be produced unless the \fB-t\fP option is set.
                     .TP
                    -\fB\-c\fR
                    +.B -c
                     Create nodes.
                     .TP
                    -\fB\-u\fR
                    -Unlink nodes.
                    -.TP
                    -\fB\-d\fR
                    -Print nodes.
                    -.TP
                    -\fB\-m\fR 
                    +.B -d
                    +Print nodes to stdout.
                    +.TP
                    +.BI "-t " type
                    +Set CMOS floppy type. Type numbers are based on the six floppy types specified
                    +in the kernel's drivers/block/floppy.c, as follows.
                    +.TS
                    +lb lb
                    +l l.
                    +Type	Device
                    +0	Unknown. (Produces no output.)
                    +1	5 1/4" 360KB PC
                    +2	5 1/4" HD AT
                    +3	3 1/2" DD
                    +4	3 1/2" HD
                    +5	3 1/2" ED
                    +6	Same as 5.
                    +.TE
                    +.TP
                    +.BI "-m " number
                     Set major number.
                     .TP
                    -\fB\-U\fR 
                    +.BI "-U " user
                     Set user ownership.
                     .TP
                    -\fB\-G\fR 
                    +.BI "-G " group
                     Set group ownership.
                     .TP
                    -\fB\-M\fR 
                    +.BI "-M " mode
                     Set device node mode.
                    -.TP
                    -\fB\-t\fR 
                    -Set floppy type number.
                     .SH SEE ALSO
                     .BR udev (7)
                     .SH AUTHORS
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 977f6f4b3dfbdd32d7df5a774a4ed761d5d4b98f Mon Sep 17 00:00:00 2001
                    From: Adam Buchbinder 
                    Date: Mon, 16 Mar 2009 16:22:54 -0400
                    Subject: vol_id: fix language in manpage
                    
                    The documentation for the --offset option wasn't in complete
                    sentences.
                    
                    Signed-off-by: Adam Buchbinder 
                    ---
                     extras/volume_id/vol_id.xml | 4 ++--
                     1 file changed, 2 insertions(+), 2 deletions(-)
                    
                    diff --git a/extras/volume_id/vol_id.xml b/extras/volume_id/vol_id.xml
                    index 3ab0b05c82..475e9bc389 100644
                    --- a/extras/volume_id/vol_id.xml
                    +++ b/extras/volume_id/vol_id.xml
                    @@ -100,8 +100,8 @@
                               
                                 
                                 
                    -              Probing at the given offset, instead of the start of the volume.
                    -              The offset value is specified in bytes.
                    +              Start probing at the given offset, instead of the beginning
                    +              of the volume. The offset value is specified in bytes.
                                 
                               
                               
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 1d59ba40772517ad92212c89f34529c943c9a849 Mon Sep 17 00:00:00 2001
                    From: Robby Workman 
                    Date: Tue, 17 Mar 2009 10:31:32 +0100
                    Subject: udevadm: trigger - add "--action" to --help
                    
                    ---
                     udev/udevadm-trigger.c | 3 ++-
                     1 file changed, 2 insertions(+), 1 deletion(-)
                    
                    diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c
                    index c88534600d..15e7dc17fb 100644
                    --- a/udev/udevadm-trigger.c
                    +++ b/udev/udevadm-trigger.c
                    @@ -172,10 +172,11 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[])
                     			       "  --verbose                       print the list of devices while running\n"
                     			       "  --dry-run                       do not actually trigger the events\n"
                     			       "  --type=                         type of events to trigger\n"
                    -			       "      devices                       sys devices\n"
                    +			       "      devices                       sys devices (default)\n"
                     			       "      subsystems                    sys subsystems and drivers\n"
                     			       "      failed                        trigger only the events which have been\n"
                     			       "                                    marked as failed during a previous run\n"
                    +			       "  --action=               event action value, default is \"add\"\n"
                     			       "  --subsystem-match=   trigger devices from a matching subystem\n"
                     			       "  --subsystem-nomatch= exclude devices from a matching subystem\n"
                     			       "  --attr-match=]>   trigger devices with a matching attribute\n"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 3b8103d45f99218f44b4ea87ab4284f6a253409b Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 18 Mar 2009 02:32:12 +0100
                    Subject: rules: fix extra quote in 50-udev-default.rules
                    
                    Patch from Gerardo Exequiel Pozzi.
                    ---
                     rules/rules.d/50-udev-default.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
                    index 38b954df1e..240cb3b3a6 100644
                    --- a/rules/rules.d/50-udev-default.rules
                    +++ b/rules/rules.d/50-udev-default.rules
                    @@ -107,7 +107,7 @@ KERNEL=="hw_random",		NAME="hwrng"
                     KERNEL=="mmtimer",		MODE="0644"
                     KERNEL=="rflash[0-9]*",		MODE="0400"
                     KERNEL=="rrom[0-9]*",		MODE="0400"
                    -KERNEL=="sxctl",		NAME="specialix_sxctl""
                    +KERNEL=="sxctl",		NAME="specialix_sxctl"
                     KERNEL=="rioctl",		NAME="specialix_rioctl"
                     KERNEL=="iowarrior[0-9]*",	NAME="usb/%k"
                     KERNEL=="hiddev[0-9]*",		NAME="usb/%k"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From b25d8cfa93c93fb2b98fdd747777294c787c6619 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 18 Mar 2009 17:54:00 +0100
                    Subject: version bump
                    
                    ---
                     NEWS         | 4 ++++
                     configure.ac | 2 +-
                     2 files changed, 5 insertions(+), 1 deletion(-)
                    
                    diff --git a/NEWS b/NEWS
                    index eca93c4d98..7c09248a8d 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -1,3 +1,7 @@
                    +udev 141
                    +========
                    +Bugfixes.
                    +
                     udev 140
                     ========
                     Bugfixes.
                    diff --git a/configure.ac b/configure.ac
                    index 3a624308df..5e6213f951 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -1,5 +1,5 @@
                     AC_INIT([udev],
                    -	[140],
                    +	[141],
                     	[linux-hotplug@vger.kernel.org])
                     AC_PREREQ(2.60)
                     AC_CONFIG_SRCDIR([udev/udevd.c])
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From f454f6708a1ca439dbe9abd6b9fb660423a71d14 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 18 Mar 2009 18:42:16 +0100
                    Subject: udevadm: test - handling trailing '/' in devpath
                    
                    On Wed, Mar 18, 2009 at 16:00, Matthias Schwarzott  wrote:
                    found out how the error occurs:
                    It is a difference between
                    A. udevadm test /sys/class/mem/null/
                    and
                    B. udevadm test /sys/class/mem/null
                    
                    Case A was the case that showed the error behaviour. It seems udevadm is
                    confused by the trailing slash. This behaviour seems to be there since ages.
                    ---
                     configure.ac              | 2 +-
                     udev/lib/libudev-device.c | 2 +-
                     udev/udevadm-test.c       | 8 +++++---
                     3 files changed, 7 insertions(+), 5 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index 5e6213f951..001f338d14 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -16,7 +16,7 @@ test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix=
                     
                     dnl /* libudev version */
                     LIBUDEV_LT_CURRENT=1
                    -LIBUDEV_LT_REVISION=0
                    +LIBUDEV_LT_REVISION=1
                     LIBUDEV_LT_AGE=1
                     AC_SUBST(LIBUDEV_LT_CURRENT)
                     AC_SUBST(LIBUDEV_LT_REVISION)
                    diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
                    index 1a9d0a1e69..e13cbe554b 100644
                    --- a/udev/lib/libudev-device.c
                    +++ b/udev/lib/libudev-device.c
                    @@ -303,7 +303,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *
                     	/* path is not a root directory */
                     	subdir = &syspath[len+1];
                     	pos = strrchr(subdir, '/');
                    -	if (pos == NULL || pos < &subdir[2]) {
                    +	if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) {
                     		dbg(udev, "not a subdir :%s\n", syspath);
                     		return NULL;
                     	}
                    diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c
                    index 664d72f6d3..c53c273295 100644
                    --- a/udev/udevadm-test.c
                    +++ b/udev/udevadm-test.c
                    @@ -94,12 +94,14 @@ int udevadm_test(struct udev *udev, int argc, char *argv[])
                     	if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) {
                     		util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename));
                     		util_strlcat(filename, syspath, sizeof(filename));
                    -		syspath = filename;
                    +	} else {
                    +		util_strlcpy(filename, syspath, sizeof(filename));
                     	}
                    +	util_remove_trailing_chars(filename, '/');
                     
                    -	dev = udev_device_new_from_syspath(udev, syspath);
                    +	dev = udev_device_new_from_syspath(udev, filename);
                     	if (dev == NULL) {
                    -		fprintf(stderr, "unable to open device '%s'\n", syspath);
                    +		fprintf(stderr, "unable to open device '%s'\n", filename);
                     		rc = 2;
                     		goto exit;
                     	}
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 498c2750bf31e5492d215a832487d6fd47c9e714 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 18 Mar 2009 18:47:23 +0100
                    Subject: udevadm: monitor - clarify printed header
                    
                    ---
                     udev/udevadm-monitor.c | 4 ++--
                     1 file changed, 2 insertions(+), 2 deletions(-)
                    
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index 77d98facd5..9be02da16c 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -139,7 +139,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     			rc = 2;
                     			goto out;
                     		}
                    -		printf("UDEV the event which udev sends out after rule processing\n");
                    +		printf("UDEV - the event which udev sends out after rule processing\n");
                     	}
                     	if (print_kernel) {
                     		kernel_monitor = udev_monitor_new_from_netlink(udev);
                    @@ -151,7 +151,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     			rc = 4;
                     			goto out;
                     		}
                    -		printf("UEVENT the kernel uevent\n");
                    +		printf("UEVENT - the kernel uevent\n");
                     	}
                     	printf("\n");
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From c51446e8936cb37ada9113d0e2905a1e4e0e68d1 Mon Sep 17 00:00:00 2001
                    From: Borislav Petkov 
                    Date: Sun, 22 Mar 2009 13:22:49 +0100
                    Subject: rules: rename ide-floppy to ide-gd
                    
                    The driver's name changed in the 2.6.28 timeframe.
                    ---
                     rules/rules.d/60-persistent-storage.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
                    index 14bd75f7dc..5032663352 100644
                    --- a/rules/rules.d/60-persistent-storage.rules
                    +++ b/rules/rules.d/60-persistent-storage.rules
                    @@ -13,7 +13,7 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end"
                     KERNEL=="ram*|fd*|nbd*|gnbd*|dm-*|md*|btibm*", GOTO="persistent_storage_end"
                     
                     # never access non-cdrom removable ide devices, the drivers are causing event loops on open()
                    -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-floppy", GOTO="persistent_storage_end"
                    +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-gd", GOTO="persistent_storage_end"
                     KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
                     
                     # ignore partitions that span the entire disk
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 684028b5be855502abdb07661c8b66aeb8064f0f Mon Sep 17 00:00:00 2001
                    From: David Brownell 
                    Date: Mon, 23 Mar 2009 21:03:00 +0100
                    Subject: rules: exclude mtd* from persistent disk links
                    
                    ---
                     rules/rules.d/60-persistent-storage.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
                    index 5032663352..adf6a11561 100644
                    --- a/rules/rules.d/60-persistent-storage.rules
                    +++ b/rules/rules.d/60-persistent-storage.rules
                    @@ -10,7 +10,7 @@ ACTION!="add|change", GOTO="persistent_storage_end"
                     SUBSYSTEM!="block", GOTO="persistent_storage_end"
                     
                     # skip rules for inappropriate block devices
                    -KERNEL=="ram*|fd*|nbd*|gnbd*|dm-*|md*|btibm*", GOTO="persistent_storage_end"
                    +KERNEL=="ram*|fd*|mtd*|nbd*|gnbd*|dm-*|md*|btibm*", GOTO="persistent_storage_end"
                     
                     # never access non-cdrom removable ide devices, the drivers are causing event loops on open()
                     KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-gd", GOTO="persistent_storage_end"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From c4390e0711b749adb02739918db34ce686d66256 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 23 Mar 2009 21:09:02 +0100
                    Subject: rules: remove ram* from persisten disk links blacklist
                    
                    ---
                     rules/rules.d/60-persistent-storage.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
                    index adf6a11561..825535c805 100644
                    --- a/rules/rules.d/60-persistent-storage.rules
                    +++ b/rules/rules.d/60-persistent-storage.rules
                    @@ -10,7 +10,7 @@ ACTION!="add|change", GOTO="persistent_storage_end"
                     SUBSYSTEM!="block", GOTO="persistent_storage_end"
                     
                     # skip rules for inappropriate block devices
                    -KERNEL=="ram*|fd*|mtd*|nbd*|gnbd*|dm-*|md*|btibm*", GOTO="persistent_storage_end"
                    +KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end"
                     
                     # never access non-cdrom removable ide devices, the drivers are causing event loops on open()
                     KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-gd", GOTO="persistent_storage_end"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 65336f861496aa33802957dcf325b24e31fb5728 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 24 Mar 2009 01:55:47 +0100
                    Subject: rules: serial - support ttyACM devices
                    
                    ---
                     rules/rules.d/60-persistent-serial.rules | 9 +++++----
                     1 file changed, 5 insertions(+), 4 deletions(-)
                    
                    diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules
                    index 6d09506dec..00727d7785 100644
                    --- a/rules/rules.d/60-persistent-serial.rules
                    +++ b/rules/rules.d/60-persistent-serial.rules
                    @@ -2,18 +2,19 @@
                     
                     ACTION!="add|change", GOTO="persistent_serial_end"
                     SUBSYSTEM!="tty", GOTO="persistent_serial_end"
                    -KERNEL!="ttyUSB[0-9]*", GOTO="persistent_serial_end"
                    +KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="persistent_serial_end"
                     
                     SUBSYSTEMS=="usb-serial", ENV{ID_PORT}="$attr{port_number}"
                    -ENV{ID_PORT}=="", GOTO="persistent_serial_end"
                     
                     IMPORT="path_id"
                    -ENV{ID_PATH}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{ID_PORT}"
                    +ENV{ID_PATH}=="?*", ENV{ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}"
                    +ENV{ID_PATH}=="?*", ENV{ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{ID_PORT}"
                     
                     IMPORT="usb_id --export %p"
                     ENV{ID_SERIAL}=="", GOTO="persistent_serial_end"
                     SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}"
                     ENV{ID_IFACE}=="", GOTO="persistent_serial_end"
                    -SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}-port$env{ID_PORT}"
                    +ENV{ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}"
                    +ENV{ID_PORT}=="?*", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}-port$env{ID_PORT}"
                     
                     LABEL="persistent_serial_end"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From a0aa1d76d0c7c6986e1b94b1868841fc9414cf1f Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 25 Mar 2009 13:40:55 +0100
                    Subject: rules: replace IDE driver with media match
                    
                    ---
                     rules/rules.d/60-persistent-storage.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
                    index 825535c805..23c21f8c6c 100644
                    --- a/rules/rules.d/60-persistent-storage.rules
                    +++ b/rules/rules.d/60-persistent-storage.rules
                    @@ -13,7 +13,7 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end"
                     KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end"
                     
                     # never access non-cdrom removable ide devices, the drivers are causing event loops on open()
                    -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", DRIVERS=="ide-cs|ide-gd", GOTO="persistent_storage_end"
                    +KERNEL=="hd*[!0-9]", ATTR{removable}=="1", SUBSYSTEMS=="ide", ATTRS{media}=="disk|floppy", GOTO="persistent_storage_end"
                     KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end"
                     
                     # ignore partitions that span the entire disk
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 9ae847f420d9266ffa87fd95e5a0e80764da7144 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 25 Mar 2009 21:24:21 +0100
                    Subject: usb_id: add ID_VENDOR_ID, ID_MODEL_ID, ID_USB_INTERFACE_NUM,
                     ID_USB_DRIVER
                    
                    $ extras/usb_id/usb_id -x /class/tty/ttyUSB1
                    ID_VENDOR=HUAWEI_Technology
                    ID_VENDOR_ENC=HUAWEI\x20Technology
                    ID_VENDOR_ID=12d1
                    ID_MODEL=HUAWEI_Mobile
                    ID_MODEL_ENC=HUAWEI\x20Mobile
                    ID_MODEL_ID=1003
                    ID_REVISION=0000
                    ID_SERIAL=HUAWEI_Technology_HUAWEI_Mobile
                    ID_TYPE=generic
                    ID_BUS=usb
                    ID_USB_INTERFACES=:ffffff:080650:
                    ID_USB_INTERFACE_NUM=01
                    ID_USB_DRIVER=option
                    ---
                     extras/usb_id/usb_id.c | 23 ++++++++++++++++++++---
                     1 file changed, 20 insertions(+), 3 deletions(-)
                    
                    diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c
                    index b15263ef7d..5765b5952e 100644
                    --- a/extras/usb_id/usb_id.c
                    +++ b/extras/usb_id/usb_id.c
                    @@ -38,14 +38,18 @@ static void log_fn(struct udev *udev, int priority,
                     }
                     
                     static char vendor_str[64];
                    +static char vendor_str_enc[256];
                    +static const char *vendor_id = "";
                     static char model_str[64];
                     static char model_str_enc[256];
                    -static char vendor_str_enc[256];
                    +static const char *product_id = "";
                     static char serial_str[UTIL_NAME_SIZE];
                     static char packed_if_str[UTIL_NAME_SIZE];
                     static char revision_str[64];
                     static char type_str[64];
                     static char instance_str[64];
                    +static const char *ifnum;
                    +static const char *driver;
                     
                     static int use_usb_info;
                     static int use_num_info;
                    @@ -261,6 +265,7 @@ static int usb_id(struct udev_device *dev)
                     	const char *if_class, *if_subclass;
                     	int if_class_num;
                     	int protocol = 0;
                    +	const char *str;
                     
                     	dbg(udev, "syspath %s\n", udev_device_get_syspath(dev));
                     
                    @@ -279,6 +284,9 @@ static int usb_id(struct udev_device *dev)
                     		return 1;
                     	}
                     
                    +	ifnum = udev_device_get_sysattr_value(dev_interface, "bInterfaceNumber");
                    +	driver = udev_device_get_sysattr_value(dev_interface, "driver");
                    +
                     	if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass");
                     	if (!if_class) {
                     		info(udev, "%s: cannot get bInterfaceClass attribute\n",
                    @@ -374,6 +382,9 @@ static int usb_id(struct udev_device *dev)
                     	}
                     
                     fallback:
                    +	vendor_id = udev_device_get_sysattr_value(dev_usb, "idVendor");
                    +	product_id = udev_device_get_sysattr_value(dev_usb, "idProduct");
                    +
                     	/* fallback to USB vendor & device */
                     	if (vendor_str[0] == '\0') {
                     		const char *usb_vendor = NULL;
                    @@ -382,7 +393,7 @@ fallback:
                     			usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer");
                     
                     		if (!usb_vendor)
                    -			usb_vendor = udev_device_get_sysattr_value(dev_usb, "idVendor");
                    +			usb_vendor = vendor_id;
                     
                     		if (!usb_vendor) {
                     			info(udev, "No USB vendor information available\n");
                    @@ -400,7 +411,7 @@ fallback:
                     			usb_model = udev_device_get_sysattr_value(dev_usb, "product");
                     
                     		if (!usb_model)
                    -			usb_model = udev_device_get_sysattr_value(dev_usb, "idProduct");
                    +			usb_model = product_id;
                     
                     		if (!usb_model) {
                     			dbg(udev, "No USB model information available\n");
                    @@ -526,8 +537,10 @@ int main(int argc, char **argv)
                     		if (export) {
                     			printf("ID_VENDOR=%s\n", vendor_str);
                     			printf("ID_VENDOR_ENC=%s\n", vendor_str_enc);
                    +			printf("ID_VENDOR_ID=%s\n", vendor_id);
                     			printf("ID_MODEL=%s\n", model_str);
                     			printf("ID_MODEL_ENC=%s\n", model_str_enc);
                    +			printf("ID_MODEL_ID=%s\n", product_id);
                     			printf("ID_REVISION=%s\n", revision_str);
                     			printf("ID_SERIAL=%s\n", serial);
                     			if (serial_str[0] != '\0')
                    @@ -539,6 +552,10 @@ int main(int argc, char **argv)
                     			printf("ID_BUS=usb\n");
                     			if (packed_if_str[0] != '\0')
                     				printf("ID_USB_INTERFACES=:%s\n", packed_if_str);
                    +			if (ifnum != NULL)
                    +				printf("ID_USB_INTERFACE_NUM=%s\n", ifnum);
                    +			if (driver != NULL)
                    +				printf("ID_USB_DRIVER=%s\n", driver);
                     		} else
                     			printf("%s\n", serial);
                     	}
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 4061ab9f4bb0bdad3858e8ef1738dc892afe9de4 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 26 Mar 2009 19:29:36 +0100
                    Subject: libudev: GPL -> LGPL
                    
                    ---
                     udev/lib/libudev-ctrl.c            | 16 ++++------------
                     udev/lib/libudev-device-db-write.c | 18 ++++++------------
                     udev/lib/libudev-device.c          | 16 ++++------------
                     udev/lib/libudev-enumerate.c       | 16 ++++------------
                     udev/lib/libudev-list.c            | 16 ++++------------
                     udev/lib/libudev-monitor.c         | 16 ++++------------
                     udev/lib/libudev-private.h         | 16 ++++------------
                     udev/lib/libudev-queue.c           | 16 ++++------------
                     udev/lib/libudev-util.c            | 16 ++++------------
                     udev/lib/libudev.c                 | 16 ++++------------
                     udev/lib/libudev.h                 | 16 ++++------------
                     udev/lib/test-libudev.c            | 16 ++++------------
                     12 files changed, 50 insertions(+), 144 deletions(-)
                    
                    diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c
                    index ca8b845b94..25661cade9 100644
                    --- a/udev/lib/libudev-ctrl.c
                    +++ b/udev/lib/libudev-ctrl.c
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    diff --git a/udev/lib/libudev-device-db-write.c b/udev/lib/libudev-device-db-write.c
                    index e96f3101c6..fa9f520f17 100644
                    --- a/udev/lib/libudev-device-db-write.c
                    +++ b/udev/lib/libudev-device-db-write.c
                    @@ -1,18 +1,12 @@
                     /*
                    - * Copyright (C) 2008 Kay Sievers 
                    - *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    + * libudev - interface to udev device information
                      *
                    - * 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.
                    + * Copyright (C) 2008 Kay Sievers 
                      *
                    - * You should have received a copy of the GNU General Public License
                    - * along with this program.  If not, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
                    index e13cbe554b..2b6086d032 100644
                    --- a/udev/lib/libudev-device.c
                    +++ b/udev/lib/libudev-device.c
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c
                    index abc89d5cab..a92bf0b620 100644
                    --- a/udev/lib/libudev-enumerate.c
                    +++ b/udev/lib/libudev-enumerate.c
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c
                    index 9d157616a8..0c13b6d927 100644
                    --- a/udev/lib/libudev-list.c
                    +++ b/udev/lib/libudev-list.c
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index e4cb80769c..c0aa99c65a 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
                    index 91e2d5f816..c7b74a4218 100644
                    --- a/udev/lib/libudev-private.h
                    +++ b/udev/lib/libudev-private.h
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #ifndef _LIBUDEV_PRIVATE_H_
                    diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c
                    index 7ec2237010..a0f4c5575c 100644
                    --- a/udev/lib/libudev-queue.c
                    +++ b/udev/lib/libudev-queue.c
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c
                    index 1cd18c8906..867a41d211 100644
                    --- a/udev/lib/libudev-util.c
                    +++ b/udev/lib/libudev-util.c
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c
                    index 2d8b7754ff..2177e5459c 100644
                    --- a/udev/lib/libudev.c
                    +++ b/udev/lib/libudev.c
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h
                    index 58d7ef98c4..a5d2c22e8c 100644
                    --- a/udev/lib/libudev.h
                    +++ b/udev/lib/libudev.h
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #ifndef _LIBUDEV_H_
                    diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c
                    index 592a147e01..965da55862 100644
                    --- a/udev/lib/test-libudev.c
                    +++ b/udev/lib/test-libudev.c
                    @@ -3,18 +3,10 @@
                      *
                      * Copyright (C) 2008 Kay Sievers 
                      *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    + * This library is free software; you can redistribute it and/or
                    + * modify it under the terms of the GNU Lesser General Public
                    + * License as published by the Free Software Foundation; either
                    + * version 2.1 of the License, or (at your option) any later version.
                      */
                     
                     #include 
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 241e5a21f9ad7bc986e1bb74093adf9fdb98b170 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sat, 28 Mar 2009 20:57:01 +0100
                    Subject: usb_id: remove unused variable
                    
                    ---
                     extras/usb_id/usb_id.c | 1 -
                     1 file changed, 1 deletion(-)
                    
                    diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c
                    index 5765b5952e..36477669c5 100644
                    --- a/extras/usb_id/usb_id.c
                    +++ b/extras/usb_id/usb_id.c
                    @@ -265,7 +265,6 @@ static int usb_id(struct udev_device *dev)
                     	const char *if_class, *if_subclass;
                     	int if_class_num;
                     	int protocol = 0;
                    -	const char *str;
                     
                     	dbg(udev, "syspath %s\n", udev_device_get_syspath(dev));
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 116254097ad3c07d9f7ed06042dbec7ba4f0f4fd Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sun, 29 Mar 2009 04:24:39 +0200
                    Subject: send monitor events back to netlink socket
                    
                    Instead of of our own private monitor socket, we send the
                    processed event back to our netlink socket, to the multicast
                    group 2 -- so any number of users can listen to udev events,
                    just like they can listen to kernel emitted events on group 1.
                    ---
                     configure.ac                     |  6 +++---
                     rules/rules.d/95-udev-late.rules |  4 ----
                     udev/lib/libudev-monitor.c       | 31 ++++++++++++++++++++++---------
                     udev/lib/libudev.h               |  6 +++++-
                     udev/udevadm-monitor.c           | 10 +++-------
                     udev/udevd.c                     |  6 ++++--
                     6 files changed, 37 insertions(+), 26 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index 001f338d14..3fd51ce36e 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -15,9 +15,9 @@ AC_PREFIX_DEFAULT([/usr])
                     test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix=
                     
                     dnl /* libudev version */
                    -LIBUDEV_LT_CURRENT=1
                    -LIBUDEV_LT_REVISION=1
                    -LIBUDEV_LT_AGE=1
                    +LIBUDEV_LT_CURRENT=2
                    +LIBUDEV_LT_REVISION=0
                    +LIBUDEV_LT_AGE=2
                     AC_SUBST(LIBUDEV_LT_CURRENT)
                     AC_SUBST(LIBUDEV_LT_REVISION)
                     AC_SUBST(LIBUDEV_LT_AGE)
                    diff --git a/rules/rules.d/95-udev-late.rules b/rules/rules.d/95-udev-late.rules
                    index 7207081d46..eca0faa5c5 100644
                    --- a/rules/rules.d/95-udev-late.rules
                    +++ b/rules/rules.d/95-udev-late.rules
                    @@ -2,7 +2,3 @@
                     
                     # run a command on remove events
                     ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}"
                    -
                    -# event to be catched by udevmonitor
                    -RUN+="socket:@/org/kernel/udev/monitor"
                    -
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index c0aa99c65a..b2f76c3129 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -29,6 +29,7 @@ struct udev_monitor {
                     	int refcount;
                     	int sock;
                     	struct sockaddr_nl snl;
                    +	struct sockaddr_nl snl_peer;
                     	struct sockaddr_un sun;
                     	socklen_t addrlen;
                     };
                    @@ -90,7 +91,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char
                     	return udev_monitor;
                     }
                     
                    -struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev)
                    +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, unsigned int group)
                     {
                     	struct udev_monitor *udev_monitor;
                     
                    @@ -110,10 +111,11 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev)
                     	}
                     
                     	udev_monitor->snl.nl_family = AF_NETLINK;
                    -	udev_monitor->snl.nl_pid = getpid();
                    -	udev_monitor->snl.nl_groups = 1;
                    +	udev_monitor->snl.nl_groups = group;
                    +	udev_monitor->snl_peer.nl_family = AF_NETLINK;
                    +	udev_monitor->snl_peer.nl_groups = UDEV_MONITOR_UDEV;
                     
                    -	dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT\n", udev_monitor);
                    +	dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT (%u)\n", udev_monitor, group);
                     	return udev_monitor;
                     }
                     
                    @@ -123,14 +125,16 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
                     	const int on = 1;
                     
                     	if (udev_monitor->snl.nl_family != 0) {
                    -		err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl));
                    +		err = bind(udev_monitor->sock,
                    +			   (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl));
                     		if (err < 0) {
                     			err(udev_monitor->udev, "bind failed: %m\n");
                     			return err;
                     		}
                     		dbg(udev_monitor->udev, "monitor %p listening on netlink\n", udev_monitor);
                     	} else if (udev_monitor->sun.sun_family != 0) {
                    -		err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen);
                    +		err = bind(udev_monitor->sock,
                    +			   (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen);
                     		if (err < 0) {
                     			err(udev_monitor->udev, "bind failed: %m\n");
                     			return err;
                    @@ -381,9 +385,18 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi
                     	len = udev_device_get_properties_monitor_buf(udev_device, &buf);
                     	if (len < 32)
                     		return -1;
                    -	count = sendto(udev_monitor->sock,
                    -		       buf, len, 0,
                    -		       (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen);
                    +	if (udev_monitor->sun.sun_family != 0) {
                    +		count = sendto(udev_monitor->sock,
                    +			       buf, len, 0,
                    +			       (struct sockaddr *)&udev_monitor->sun,
                    +			       udev_monitor->addrlen);
                    +	} else {
                    +		/* no destination besides the muticast group, we will always get -1 ECONNREFUSED */
                    +		count = sendto(udev_monitor->sock,
                    +			       buf, len, 0,
                    +			       (struct sockaddr *)&udev_monitor->snl_peer,
                    +			       sizeof(struct sockaddr_nl));
                    +	}
                     	info(udev_monitor->udev, "passed %zi bytes to monitor %p, \n", count, udev_monitor);
                     	return count;
                     }
                    diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h
                    index a5d2c22e8c..be09ddb75a 100644
                    --- a/udev/lib/libudev.h
                    +++ b/udev/lib/libudev.h
                    @@ -76,8 +76,12 @@ extern const char *udev_device_get_sysattr_value(struct udev_device *udev_device
                     
                     /* udev and kernel device events */
                     struct udev_monitor;
                    +enum udev_monitor_netlink_group {
                    +	UDEV_MONITOR_KERNEL	= 1,
                    +	UDEV_MONITOR_UDEV	= 2,
                    +};
                     extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path);
                    -extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev);
                    +extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, enum udev_monitor_netlink_group group);
                     extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);
                     extern struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor);
                     extern void udev_monitor_unref(struct udev_monitor *udev_monitor);
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index 9be02da16c..43c1cc1163 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -115,11 +115,6 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     		print_udev =1;
                     	}
                     
                    -	if (getuid() != 0 && print_kernel) {
                    -		fprintf(stderr, "root privileges needed to subscribe to kernel events\n");
                    -		goto out;
                    -	}
                    -
                     	/* set signal handlers */
                     	memset(&act, 0x00, sizeof(struct sigaction));
                     	act.sa_handler = (void (*)(int)) sig_handler;
                    @@ -130,7 +125,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     
                     	printf("monitor will print the received events for:\n");
                     	if (print_udev) {
                    -		udev_monitor = udev_monitor_new_from_socket(udev, "@/org/kernel/udev/monitor");
                    +		udev_monitor = udev_monitor_new_from_netlink(udev, UDEV_MONITOR_UDEV);
                     		if (udev_monitor == NULL) {
                     			rc = 1;
                     			goto out;
                    @@ -142,8 +137,9 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     		printf("UDEV - the event which udev sends out after rule processing\n");
                     	}
                     	if (print_kernel) {
                    -		kernel_monitor = udev_monitor_new_from_netlink(udev);
                    +		kernel_monitor = udev_monitor_new_from_netlink(udev, UDEV_MONITOR_KERNEL);
                     		if (kernel_monitor == NULL) {
                    +			fprintf(stderr, "unable to subscribe to kernel events\n");
                     			rc = 3;
                     			goto out;
                     		}
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index 291655ef00..d9de26ea6c 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -195,7 +195,6 @@ static void event_fork(struct udev_event *event)
                     	switch (pid) {
                     	case 0:
                     		/* child */
                    -		udev_monitor_unref(kernel_monitor);
                     		udev_ctrl_unref(udev_ctrl);
                     		logging_close();
                     		logging_init("udevd-event");
                    @@ -235,6 +234,9 @@ static void event_fork(struct udev_event *event)
                     			udev_device_update_db(event->dev);
                     		}
                     
                    +		/* send processed event back to the kernel netlink socket */
                    +		udev_monitor_send_device(kernel_monitor, event->dev);
                    +
                     		info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err);
                     		logging_close();
                     		if (err != 0)
                    @@ -811,7 +813,7 @@ int main(int argc, char *argv[])
                     		goto exit;
                     	}
                     
                    -	kernel_monitor = udev_monitor_new_from_netlink(udev);
                    +	kernel_monitor = udev_monitor_new_from_netlink(udev, UDEV_MONITOR_KERNEL);
                     	if (kernel_monitor == NULL || udev_monitor_enable_receiving(kernel_monitor) < 0) {
                     		fprintf(stderr, "error initializing netlink socket\n");
                     		err(udev, "error initializing netlink socket\n");
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From f2b937440c682bca3837263a1bafd78e30b17e4d Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sun, 29 Mar 2009 20:08:52 +0200
                    Subject: "UDEV_MONITOR_KERNEL/UDEV" -> "kernel/udev"
                    
                    ---
                     udev/lib/libudev-monitor.c | 18 +++++++++++++++++-
                     udev/lib/libudev.h         |  6 +-----
                     udev/udevadm-monitor.c     |  8 ++++----
                     udev/udevd.c               |  2 +-
                     4 files changed, 23 insertions(+), 11 deletions(-)
                    
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index b2f76c3129..d006596e07 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -34,6 +34,11 @@ struct udev_monitor {
                     	socklen_t addrlen;
                     };
                     
                    +enum udev_monitor_netlink_group {
                    +	UDEV_MONITOR_KERNEL	= 1,
                    +	UDEV_MONITOR_UDEV	= 2,
                    +};
                    +
                     /**
                      * udev_monitor_new_from_socket:
                      * @udev: udev library context
                    @@ -91,12 +96,23 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char
                     	return udev_monitor;
                     }
                     
                    -struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, unsigned int group)
                    +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name)
                     {
                     	struct udev_monitor *udev_monitor;
                    +	unsigned int group;
                     
                     	if (udev == NULL)
                     		return NULL;
                    +
                    +	if (name == NULL)
                    +		return NULL;
                    +	if (strcmp(name, "kernel") == 0)
                    +		group = UDEV_MONITOR_KERNEL;
                    +	else if (strcmp(name, "udev") == 0)
                    +		group = UDEV_MONITOR_UDEV;
                    +	else
                    +		return NULL;
                    +
                     	udev_monitor = calloc(1, sizeof(struct udev_monitor));
                     	if (udev_monitor == NULL)
                     		return NULL;
                    diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h
                    index be09ddb75a..e0aa571e26 100644
                    --- a/udev/lib/libudev.h
                    +++ b/udev/lib/libudev.h
                    @@ -76,12 +76,8 @@ extern const char *udev_device_get_sysattr_value(struct udev_device *udev_device
                     
                     /* udev and kernel device events */
                     struct udev_monitor;
                    -enum udev_monitor_netlink_group {
                    -	UDEV_MONITOR_KERNEL	= 1,
                    -	UDEV_MONITOR_UDEV	= 2,
                    -};
                     extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path);
                    -extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, enum udev_monitor_netlink_group group);
                    +extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name);
                     extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);
                     extern struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor);
                     extern void udev_monitor_unref(struct udev_monitor *udev_monitor);
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index 43c1cc1163..d8ec066467 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -125,7 +125,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     
                     	printf("monitor will print the received events for:\n");
                     	if (print_udev) {
                    -		udev_monitor = udev_monitor_new_from_netlink(udev, UDEV_MONITOR_UDEV);
                    +		udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
                     		if (udev_monitor == NULL) {
                     			rc = 1;
                     			goto out;
                    @@ -137,7 +137,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     		printf("UDEV - the event which udev sends out after rule processing\n");
                     	}
                     	if (print_kernel) {
                    -		kernel_monitor = udev_monitor_new_from_netlink(udev, UDEV_MONITOR_KERNEL);
                    +		kernel_monitor = udev_monitor_new_from_netlink(udev, "kernel");
                     		if (kernel_monitor == NULL) {
                     			fprintf(stderr, "unable to subscribe to kernel events\n");
                     			rc = 3;
                    @@ -147,7 +147,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     			rc = 4;
                     			goto out;
                     		}
                    -		printf("UEVENT - the kernel uevent\n");
                    +		printf("KERNEL - the kernel uevent\n");
                     	}
                     	printf("\n");
                     
                    @@ -174,7 +174,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     			device = udev_monitor_receive_device(kernel_monitor);
                     			if (device == NULL)
                     				continue;
                    -			print_device(device, "UEVENT", env);
                    +			print_device(device, "KERNEL", env);
                     			udev_device_unref(device);
                     		}
                     
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index d9de26ea6c..6de1196421 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -813,7 +813,7 @@ int main(int argc, char *argv[])
                     		goto exit;
                     	}
                     
                    -	kernel_monitor = udev_monitor_new_from_netlink(udev, UDEV_MONITOR_KERNEL);
                    +	kernel_monitor = udev_monitor_new_from_netlink(udev, "kernel");
                     	if (kernel_monitor == NULL || udev_monitor_enable_receiving(kernel_monitor) < 0) {
                     		fprintf(stderr, "error initializing netlink socket\n");
                     		err(udev, "error initializing netlink socket\n");
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 52761bb0a99cb80ccb19c9edf23963fdad67060d Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 30 Mar 2009 20:09:08 +0200
                    Subject: IMPORT: 2048 -> 4096 bytes buffer
                    
                    ---
                     udev/udev-rules.c | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/udev/udev-rules.c b/udev/udev-rules.c
                    index 663a6d4f04..e4594c31cd 100644
                    --- a/udev/udev-rules.c
                    +++ b/udev/udev-rules.c
                    @@ -737,7 +737,7 @@ static int import_program_into_properties(struct udev_device *dev, const char *p
                     {
                     	struct udev *udev = udev_device_get_udev(dev);
                     	char **envp;
                    -	char result[2048];
                    +	char result[4096];
                     	size_t reslen;
                     	char *line;
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 4b09a2fc4383f191d96a8d6134b95a4b84aef931 Mon Sep 17 00:00:00 2001
                    From: Alan Jenkins 
                    Date: Mon, 6 Apr 2009 10:18:41 +0100
                    Subject: avoid leaking netlink socket fd to external programs
                    
                    The netlink socket is now used by udev event processes. We should take
                    care not to pass it to the programs they execute. This is the same way
                    the inotify fd was handled.
                    
                    Signed-off-by: Alan Jenkins 
                    ---
                     udev/lib/libudev-monitor.c |  3 +++
                     udev/lib/libudev-private.h |  1 +
                     udev/lib/libudev-util.c    | 12 ++++++++++++
                     udev/udev-watch.c          | 13 +++----------
                     4 files changed, 19 insertions(+), 10 deletions(-)
                    
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index d006596e07..a8b1a4e2e5 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -92,6 +92,8 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char
                     		free(udev_monitor);
                     		return NULL;
                     	}
                    +	util_set_fd_cloexec(udev_monitor->sock);
                    +
                     	dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path);
                     	return udev_monitor;
                     }
                    @@ -125,6 +127,7 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char
                     		free(udev_monitor);
                     		return NULL;
                     	}
                    +	util_set_fd_cloexec(udev_monitor->sock);
                     
                     	udev_monitor->snl.nl_family = AF_NETLINK;
                     	udev_monitor->snl.nl_groups = group;
                    diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
                    index c7b74a4218..1e47d51080 100644
                    --- a/udev/lib/libudev-private.h
                    +++ b/udev/lib/libudev-private.h
                    @@ -172,4 +172,5 @@ extern size_t util_strlcat(char *dst, const char *src, size_t size);
                     extern int udev_util_replace_whitespace(const char *str, char *to, size_t len);
                     extern int udev_util_replace_chars(char *str, const char *white);
                     extern int udev_util_encode_string(const char *str, char *str_enc, size_t len);
                    +extern void util_set_fd_cloexec(int fd);
                     #endif
                    diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c
                    index 867a41d211..b628fdd44c 100644
                    --- a/udev/lib/libudev-util.c
                    +++ b/udev/lib/libudev-util.c
                    @@ -448,3 +448,15 @@ int udev_util_encode_string(const char *str, char *str_enc, size_t len)
                     err:
                     	return -1;
                     }
                    +
                    +void util_set_fd_cloexec(int fd)
                    +{
                    +	int flags;
                    +
                    +	flags = fcntl(fd, F_GETFD);
                    +	if (flags < 0)
                    +		flags = FD_CLOEXEC;
                    +	else
                    +		flags |= FD_CLOEXEC;
                    +	fcntl(fd, F_SETFD, flags);
                    +}
                    diff --git a/udev/udev-watch.c b/udev/udev-watch.c
                    index e2c096af0f..d333476346 100644
                    --- a/udev/udev-watch.c
                    +++ b/udev/udev-watch.c
                    @@ -41,16 +41,9 @@ int inotify_fd = -1;
                     void udev_watch_init(struct udev *udev)
                     {
                     	inotify_fd = inotify_init();
                    -	if (inotify_fd >= 0) {
                    -		int flags;
                    -
                    -		flags = fcntl(inotify_fd, F_GETFD);
                    -		if (flags < 0)
                    -			flags = FD_CLOEXEC;
                    -		else
                    -			flags |= FD_CLOEXEC;
                    -		fcntl(inotify_fd, F_SETFD, flags);
                    -	} else if (errno == ENOSYS)
                    +	if (inotify_fd >= 0)
                    +		util_set_fd_cloexec(inotify_fd);
                    +	else if (errno == ENOSYS)
                     		info(udev, "unable to use inotify, udevd will not monitor rule files changes\n");
                     	else
                     		err(udev, "inotify_init failed: %m\n");
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 662c3110803bd8c1aedacc36788e6fd028944314 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 8 Apr 2009 06:06:01 -0700
                    Subject: path_encode: fix max length calculation
                    
                    Sebastian Krahmer wrote:
                    > it should reserve 4 times not 3 times len :)
                    ---
                     udev/lib/libudev-util.c | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c
                    index b628fdd44c..a40be06757 100644
                    --- a/udev/lib/libudev-util.c
                    +++ b/udev/lib/libudev-util.c
                    @@ -103,7 +103,7 @@ int util_log_priority(const char *priority)
                     
                     size_t util_path_encode(char *s, size_t len)
                     {
                    -	char t[(len * 3)+1];
                    +	char t[(len * 4)+1];
                     	size_t i, j;
                     
                     	for (i = 0, j = 0; s[i] != '\0'; i++) {
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From e2b362d9f23d4c63018709ab5f81a02f72b91e75 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 8 Apr 2009 07:46:54 -0700
                    Subject: libudev: monitor - unify socket message handling
                    
                    ---
                     udev/lib/libudev-monitor.c | 62 ++++++++++++++++++++++------------------------
                     1 file changed, 30 insertions(+), 32 deletions(-)
                    
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index a8b1a4e2e5..21bd19ba03 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -143,25 +143,22 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
                     	int err;
                     	const int on = 1;
                     
                    -	if (udev_monitor->snl.nl_family != 0) {
                    -		err = bind(udev_monitor->sock,
                    -			   (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl));
                    -		if (err < 0) {
                    -			err(udev_monitor->udev, "bind failed: %m\n");
                    -			return err;
                    -		}
                    -		dbg(udev_monitor->udev, "monitor %p listening on netlink\n", udev_monitor);
                    -	} else if (udev_monitor->sun.sun_family != 0) {
                    +	if (udev_monitor->sun.sun_family != 0)
                     		err = bind(udev_monitor->sock,
                     			   (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen);
                    -		if (err < 0) {
                    -			err(udev_monitor->udev, "bind failed: %m\n");
                    -			return err;
                    -		}
                    -		/* enable receiving of the sender credentials */
                    -		setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
                    -		dbg(udev_monitor->udev, "monitor %p listening on socket\n", udev_monitor);
                    +	else if (udev_monitor->snl.nl_family != 0)
                    +		err = bind(udev_monitor->sock,
                    +			   (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl));
                    +	else
                    +		return -EINVAL;
                    +
                    +	if (err < 0) {
                    +		err(udev_monitor->udev, "bind failed: %m\n");
                    +		return err;
                     	}
                    +
                    +	/* enable receiving of sender credentials */
                    +	setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
                     	return 0;
                     }
                     
                    @@ -262,6 +259,8 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     	struct msghdr smsg;
                     	struct iovec iov;
                     	char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
                    +	struct cmsghdr *cmsg;
                    +	struct ucred *cred;
                     	char buf[4096];
                     	size_t bufpos;
                     	int devpath_set = 0;
                    @@ -287,19 +286,16 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     		return NULL;
                     	}
                     
                    -	if (udev_monitor->sun.sun_family != 0) {
                    -		struct cmsghdr *cmsg = CMSG_FIRSTHDR(&smsg);
                    -		struct ucred *cred = (struct ucred *)CMSG_DATA (cmsg);
                    -
                    -		if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
                    -			info(udev_monitor->udev, "no sender credentials received, message ignored");
                    -			return NULL;
                    -		}
                    +	cmsg = CMSG_FIRSTHDR(&smsg);
                    +	if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
                    +		info(udev_monitor->udev, "no sender credentials received, message ignored");
                    +		return NULL;
                    +	}
                     
                    -		if (cred->uid != 0) {
                    -			info(udev_monitor->udev, "sender uid=%d, message ignored", cred->uid);
                    -			return NULL;
                    -		}
                    +	cred = (struct ucred *)CMSG_DATA(cmsg);
                    +	if (cred->uid != 0) {
                    +		info(udev_monitor->udev, "sender uid=%d, message ignored", cred->uid);
                    +		return NULL;
                     	}
                     
                     	/* skip header */
                    @@ -404,18 +400,20 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi
                     	len = udev_device_get_properties_monitor_buf(udev_device, &buf);
                     	if (len < 32)
                     		return -1;
                    -	if (udev_monitor->sun.sun_family != 0) {
                    +	if (udev_monitor->sun.sun_family != 0)
                     		count = sendto(udev_monitor->sock,
                     			       buf, len, 0,
                     			       (struct sockaddr *)&udev_monitor->sun,
                     			       udev_monitor->addrlen);
                    -	} else {
                    -		/* no destination besides the muticast group, we will always get -1 ECONNREFUSED */
                    +	else if (udev_monitor->snl.nl_family != 0)
                    +		/* no destination besides the muticast group, we will always get ECONNREFUSED */
                     		count = sendto(udev_monitor->sock,
                     			       buf, len, 0,
                     			       (struct sockaddr *)&udev_monitor->snl_peer,
                     			       sizeof(struct sockaddr_nl));
                    -	}
                    +	else
                    +		return -1;
                    +
                     	info(udev_monitor->udev, "passed %zi bytes to monitor %p, \n", count, udev_monitor);
                     	return count;
                     }
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From e86a923d508c2aed371cdd958ce82489cf2ab615 Mon Sep 17 00:00:00 2001
                    From: Scott James Remnant 
                    Date: Wed, 8 Apr 2009 16:16:14 -0700
                    Subject: libudev: monitor - ignore messages from unusual sources
                    
                    For added protection, ignore any unicast message received on the
                    netlink socket or any multicast message on the kernel group not
                    received from the kernel.
                    
                    Signed-off-by: Scott James Remnant 
                    ---
                     udev/lib/libudev-monitor.c | 29 +++++++++++++++++++++++------
                     1 file changed, 23 insertions(+), 6 deletions(-)
                    
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index 21bd19ba03..79627ed4a4 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -260,6 +260,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     	struct iovec iov;
                     	char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
                     	struct cmsghdr *cmsg;
                    +	struct sockaddr_nl snl;
                     	struct ucred *cred;
                     	char buf[4096];
                     	size_t bufpos;
                    @@ -280,34 +281,50 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     	smsg.msg_control = cred_msg;
                     	smsg.msg_controllen = sizeof(cred_msg);
                     
                    +	if (udev_monitor->snl.nl_family != 0) {
                    +		smsg.msg_name = &snl;
                    +		smsg.msg_namelen = sizeof snl;
                    +	}
                    +
                     	if (recvmsg(udev_monitor->sock, &smsg, 0) < 0) {
                     		if (errno != EINTR)
                    -			info(udev_monitor->udev, "unable to receive message");
                    +			info(udev_monitor->udev, "unable to receive message\n");
                     		return NULL;
                     	}
                     
                    +	if (udev_monitor->snl.nl_family != 0) {
                    +		if (snl.nl_groups == 0) {
                    +			info(udev_monitor->udev, "unicast netlink message ignored\n");
                    +			return NULL;
                    +		}
                    +		if ((snl.nl_groups == UDEV_MONITOR_KERNEL) && (snl.nl_pid > 0)) {
                    +			info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", snl.nl_pid);
                    +			return NULL;
                    +		}
                    +	}
                    +
                     	cmsg = CMSG_FIRSTHDR(&smsg);
                     	if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) {
                    -		info(udev_monitor->udev, "no sender credentials received, message ignored");
                    +		info(udev_monitor->udev, "no sender credentials received, message ignored\n");
                     		return NULL;
                     	}
                     
                     	cred = (struct ucred *)CMSG_DATA(cmsg);
                     	if (cred->uid != 0) {
                    -		info(udev_monitor->udev, "sender uid=%d, message ignored", cred->uid);
                    +		info(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid);
                     		return NULL;
                     	}
                     
                     	/* skip header */
                     	bufpos = strlen(buf) + 1;
                     	if (bufpos < sizeof("a@/d") || bufpos >= sizeof(buf)) {
                    -		info(udev_monitor->udev, "invalid message length");
                    +		info(udev_monitor->udev, "invalid message length\n");
                     		return NULL;
                     	}
                     
                     	/* check message header */
                     	if (strstr(buf, "@/") == NULL) {
                    -		info(udev_monitor->udev, "unrecognized message header");
                    +		info(udev_monitor->udev, "unrecognized message header\n");
                     		return NULL;
                     	}
                     
                    @@ -414,6 +431,6 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi
                     	else
                     		return -1;
                     
                    -	info(udev_monitor->udev, "passed %zi bytes to monitor %p, \n", count, udev_monitor);
                    +	info(udev_monitor->udev, "passed %zi bytes to monitor %p\n", count, udev_monitor);
                     	return count;
                     }
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From dbf4ba73c2c81ca4baa8327dda80569754935d3a Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 8 Apr 2009 16:35:53 -0700
                    Subject: release 141
                    
                    ---
                     ChangeLog | 45 +++++++++++++++++++++++++++++++++++++++++++++
                     NEWS      |  6 ++++++
                     2 files changed, 51 insertions(+)
                    
                    diff --git a/ChangeLog b/ChangeLog
                    index c7be324fee..8b607c3a3b 100644
                    --- a/ChangeLog
                    +++ b/ChangeLog
                    @@ -1,3 +1,48 @@
                    +Summary of changes from v140 to v141
                    +============================================
                    +
                    +Adam Buchbinder (4):
                    +      usb_id: add manpage
                    +      cdrom_id: update manpage
                    +      create_floppy_devices: expand manpage
                    +      vol_id: fix language in manpage
                    +
                    +Alan Jenkins (1):
                    +      avoid leaking netlink socket fd to external programs
                    +
                    +Borislav Petkov (1):
                    +      rules: rename ide-floppy to ide-gd
                    +
                    +David Brownell (1):
                    +      rules: exclude mtd* from persistent disk links
                    +
                    +Kay Sievers (15):
                    +      rules: fix extra quote in 50-udev-default.rules
                    +      version bump
                    +      udevadm: test - handling trailing '/' in devpath
                    +      udevadm: monitor - clarify printed header
                    +      rules: remove ram* from persisten disk links blacklist
                    +      rules: serial - support ttyACM devices
                    +      rules: replace IDE driver with media match
                    +      usb_id: add ID_VENDOR_ID, ID_MODEL_ID, ID_USB_INTERFACE_NUM, ID_USB_DRIVER
                    +      libudev: GPL -> LGPL
                    +      usb_id: remove unused variable
                    +      send monitor events back to netlink socket
                    +      "UDEV_MONITOR_KERNEL/UDEV" -> "kernel/udev"
                    +      IMPORT: 2048 -> 4096 bytes buffer
                    +      path_encode: fix max length calculation
                    +      libudev: monitor - unify socket message handling
                    +
                    +Michal Soltys (1):
                    +      rules: md-raid.rules fix
                    +
                    +Robby Workman (1):
                    +      udevadm: trigger - add "--action" to --help
                    +
                    +Scott James Remnant (1):
                    +      libudev: monitor - ignore messages from unusual sources
                    +
                    +
                     Summary of changes from v139 to v140
                     ============================================
                     
                    diff --git a/NEWS b/NEWS
                    index 7c09248a8d..128ca23f8d 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -2,6 +2,12 @@ udev 141
                     ========
                     Bugfixes.
                     
                    +The processed udev events get send back to the netlink socket. Libudev
                    +provides access to these events. This is work-in-progress, to replace
                    +the DeviceKit daemon functionality directly with libudev. There are
                    +upcoming kernel changes to allow non-root users to subcribe to these
                    +events.
                    +
                     udev 140
                     ========
                     Bugfixes.
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 9b144b88577e944659aa915cb27ff09af40223d2 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 14 Apr 2009 21:02:39 +0200
                    Subject: version bump
                    
                    ---
                     configure.ac | 5 ++---
                     1 file changed, 2 insertions(+), 3 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index 3fd51ce36e..3aa6e7c7af 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -1,14 +1,13 @@
                     AC_INIT([udev],
                    -	[141],
                    +	[142],
                     	[linux-hotplug@vger.kernel.org])
                     AC_PREREQ(2.60)
                    -AC_CONFIG_SRCDIR([udev/udevd.c])
                     AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2])
                     AC_DISABLE_STATIC
                     AC_USE_SYSTEM_EXTENSIONS
                     AC_SYS_LARGEFILE
                    -AC_PROG_LIBTOOL
                     AC_CONFIG_MACRO_DIR([m4])
                    +AC_PROG_LIBTOOL
                     
                     dnl /* prefix is /usr, exec_prefix is /, if overridden exec_prefix follows prefix */
                     AC_PREFIX_DEFAULT([/usr])
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 3e5bafc98ad359f112d04071cfbb96a268a7ebc1 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 15 Apr 2009 21:47:04 +0200
                    Subject: libudev: path_encode - always return 0 if encoded string does not fit
                     into size
                    
                    ---
                     configure.ac            |  2 +-
                     udev/lib/libudev-util.c | 19 ++++++++++---------
                     2 files changed, 11 insertions(+), 10 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index 3aa6e7c7af..cbe2833f22 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -15,7 +15,7 @@ test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix=
                     
                     dnl /* libudev version */
                     LIBUDEV_LT_CURRENT=2
                    -LIBUDEV_LT_REVISION=0
                    +LIBUDEV_LT_REVISION=1
                     LIBUDEV_LT_AGE=2
                     AC_SUBST(LIBUDEV_LT_CURRENT)
                     AC_SUBST(LIBUDEV_LT_REVISION)
                    diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c
                    index a40be06757..243a99dce9 100644
                    --- a/udev/lib/libudev-util.c
                    +++ b/udev/lib/libudev-util.c
                    @@ -101,12 +101,12 @@ int util_log_priority(const char *priority)
                     	return 0;
                     }
                     
                    -size_t util_path_encode(char *s, size_t len)
                    +size_t util_path_encode(char *s, size_t size)
                     {
                    -	char t[(len * 4)+1];
                    +	char t[(size * 4)+1];
                     	size_t i, j;
                     
                    -	for (i = 0, j = 0; s[i] != '\0'; i++) {
                    +	for (i = 0, j = 0; s[i] != '\0' && i < size; i++) {
                     		if (s[i] == '/') {
                     			memcpy(&t[j], "\\x2f", 4);
                     			j += 4;
                    @@ -118,11 +118,12 @@ size_t util_path_encode(char *s, size_t len)
                     			j++;
                     		}
                     	}
                    -	if (len == 0)
                    -		return j;
                    -	i = (j < len - 1) ? j : len - 1;
                    -	memcpy(s, t, i);
                    -	s[i] = '\0';
                    +	if (i >= size)
                    +		return 0;
                    +	if (j >= size)
                    +		return 0;
                    +	memcpy(s, t, j);
                    +	s[j] = '\0';
                     	return j;
                     }
                     
                    @@ -134,7 +135,7 @@ size_t util_path_decode(char *s)
                     		if (memcmp(&s[i], "\\x2f", 4) == 0) {
                     			s[j] = '/';
                     			i += 4;
                    -		}else if (memcmp(&s[i], "\\x5c", 4) == 0) {
                    +		} else if (memcmp(&s[i], "\\x5c", 4) == 0) {
                     			s[j] = '\\';
                     			i += 4;
                     		} else {
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From ff109b8ded61ad1241843090dea2a367572ac375 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 16 Apr 2009 01:49:16 +0200
                    Subject: libudev: monitor - clarify socket handling documentation
                    
                    ---
                     udev/lib/libudev-monitor.c | 40 ++++++++++++++++++++++++++++++++++------
                     1 file changed, 34 insertions(+), 6 deletions(-)
                    
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index 79627ed4a4..e68bdf5bac 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -44,13 +44,16 @@ enum udev_monitor_netlink_group {
                      * @udev: udev library context
                      * @socket_path: unix socket path
                      *
                    - * Create new udev monitor, setup and connect to a specified socket. The
                    - * path to a socket can point to an existing socket file, or it will be
                    - * created if needed. If neccessary, the permissions adjustment as well as
                    - * the later cleanup of the socket file, needs to be done by the caller.
                    - * If the socket path starts with a '@' character, an abstract namespace
                    + * Create new udev monitor and connect to a specified socket. The
                    + * path to a socket either points to an existing socket file, or if
                    + * the socket path starts with a '@' character, an abstract namespace
                      * socket will be used.
                      *
                    + * A socket file will not be created. If it does not already exist,
                    + * it will fall-back and connect to an abstract namespace socket with
                    + * the given path. The permissions adjustment of a socket file, as
                    + * well as the later cleanup, needs to be done by the caller.
                    + *
                      * The initial refcount is 1, and needs to be decremented to
                      * release the resources of the udev monitor.
                      *
                    @@ -98,6 +101,31 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char
                     	return udev_monitor;
                     }
                     
                    +/**
                    + * udev_monitor_new_from_netlink:
                    + * @udev: udev library context
                    + * @name: name of event source
                    + *
                    + * Create new udev monitor and connect to a specified event
                    + * source. Valid sources identifiers are "udev" and "kernel".
                    + *
                    + * Applications should usually not connect directly to the
                    + * "kernel" events, because the devices might not be useable
                    + * at that time, before udev has configured them, and created
                    + * device nodes.
                    + *
                    + * Accessing devices at the same time as udev, might result
                    + * in unpredictable behavior.
                    + *
                    + * The "udev" events are sent out after udev has finished its
                    + * event processing, all rules have been processed, and needed
                    + * device nodes are created.
                    + *
                    + * The initial refcount is 1, and needs to be decremented to
                    + * release the resources of the udev monitor.
                    + *
                    + * Returns: a new udev monitor, or #NULL, in case of an error
                    + **/
                     struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name)
                     {
                     	struct udev_monitor *udev_monitor;
                    @@ -189,7 +217,7 @@ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor)
                      * udev_monitor_unref:
                      * @udev_monitor: udev monitor
                      *
                    - * Drop a reference ofa udev monitor. If the refcount reaches zero,
                    + * Drop a reference of a udev monitor. If the refcount reaches zero,
                      * the bound socket will be closed, and the resources of the monitor
                      * will be released.
                      *
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From b44b7f884136e1ef4452818ed514a5d7e51567f1 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 16 Apr 2009 22:34:26 +0200
                    Subject: udevd: log error for too old kernels or CONFIG_SYSFS_DEPRECATED
                    
                    ---
                     udev/udevd.c | 52 ++++++++++++++++++++++++++++++----------------------
                     1 file changed, 30 insertions(+), 22 deletions(-)
                    
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index 6de1196421..1aa50eb74c 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -295,7 +295,7 @@ static void event_queue_insert(struct udev_event *event)
                     
                     static int mem_size_mb(void)
                     {
                    -	FILE* f;
                    +	FILE *f;
                     	char buf[4096];
                     	long int memsize = -1;
                     
                    @@ -708,6 +708,34 @@ static void export_initial_seqnum(struct udev *udev)
                     	}
                     }
                     
                    +static void startup_log(struct udev *udev)
                    +{
                    +	FILE *f;
                    +	char path[UTIL_PATH_SIZE];
                    +	struct stat statbuf;
                    +
                    +	f = fopen("/dev/kmsg", "w");
                    +	if (f != NULL)
                    +		fprintf(f, "<6>udev: starting version " VERSION "\n");
                    +
                    +	util_strlcpy(path, udev_get_sys_path(udev), sizeof(path));
                    +	util_strlcat(path, "/class/mem/null", sizeof(path));
                    +	if (lstat(path, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) {
                    +		const char *depr_str =
                    +			"udev: missing sysfs features; please update the kernel "
                    +			"or disable the kernel's CONFIG_SYSFS_DEPRECATED option; "
                    +			"udev may fail to work correctly";
                    +
                    +		if (f != NULL)
                    +			fprintf(f, "<3>%s\n", depr_str);
                    +		err(udev, "%s\n", depr_str);
                    +		sleep(3);
                    +	}
                    +
                    +	if (f != NULL)
                    +		fclose(f);
                    +}
                    +
                     int main(int argc, char *argv[])
                     {
                     	struct udev *udev;
                    @@ -875,27 +903,7 @@ int main(int argc, char *argv[])
                     		close(fd);
                     	}
                     
                    -	fd = open("/dev/kmsg", O_WRONLY);
                    -	if (fd > 0) {
                    -		const char *ver_str = "<6>udev: starting version " VERSION "\n";
                    -		char path[UTIL_PATH_SIZE];
                    -		struct stat statbuf;
                    -
                    -		write(fd, ver_str, strlen(ver_str));
                    -		util_strlcpy(path, udev_get_sys_path(udev), sizeof(path));
                    -		util_strlcat(path, "/class/mem/null", sizeof(path));
                    -		if (lstat(path, &statbuf) == 0) {
                    -			if (S_ISDIR(statbuf.st_mode)) {
                    -				const char *depr_str =
                    -					"<6>udev: deprecated sysfs layout; update the kernel or "
                    -					"disable CONFIG_SYSFS_DEPRECATED; some udev features will "
                    -					"not work correctly\n";
                    -
                    -				write(fd, depr_str, strlen(depr_str));
                    -			}
                    -		}
                    -		close(fd);
                    -	}
                    +	startup_log(udev);
                     
                     	/* set signal handlers */
                     	memset(&act, 0x00, sizeof(struct sigaction));
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 7a87d34f8ab8572e3ff622b2785fb5fe2af2e07a Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 16 Apr 2009 22:35:59 +0200
                    Subject: rules: remove DVB shell script
                    
                    ---
                     TODO                                | 3 +--
                     rules/rules.d/50-udev-default.rules | 1 -
                     2 files changed, 1 insertion(+), 3 deletions(-)
                    
                    diff --git a/TODO b/TODO
                    index 8deff6aaf2..9214fb4874 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -1,8 +1,7 @@
                     
                       o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30)
                    -  o drop the DVB shell script rule (2.6.29)
                       o remove MMC rules, they got a modalias now (2.6.30)
                    -  o add scsi:t-0x09* to "ch" and remove modprobe rule
                    +  o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30)
                       o switch device mapper rules to:
                          dmsetup info -c --nameprefixes --unquoted --rows --noheadings \
                            -o name,uuid,suspended,readonly,major,minor,open,tables_loaded
                    diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
                    index 240cb3b3a6..abc5113cfc 100644
                    --- a/rules/rules.d/50-udev-default.rules
                    +++ b/rules/rules.d/50-udev-default.rules
                    @@ -43,7 +43,6 @@ SUBSYSTEM=="drm",		GROUP="video"
                     
                     # DVB (video)
                     SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}", GROUP="video"
                    -SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video"
                     
                     # Firewire
                     KERNEL=="dv1394[0-9]*",		NAME="dv1394/%n", GROUP="video"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From e2151b00e92dde5b9e2b06052b358c8101f29165 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 16 Apr 2009 22:36:26 +0200
                    Subject: update NEWS
                    
                    ---
                     NEWS | 12 ++++++++++++
                     1 file changed, 12 insertions(+)
                    
                    diff --git a/NEWS b/NEWS
                    index 128ca23f8d..f418687555 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -1,3 +1,15 @@
                    +udev 142
                    +========
                    +Bugfixes.
                    +
                    +A too old kernel or a kernel with CONFIG_SYSFS_DEPRECATED is not
                    +supported since while and udevd will log an error message at
                    +startup.
                    +
                    +DVB device naming is supplied by the kernel now. To support older
                    +kernels, the old shell script should be added to a possible compat
                    +rules file.
                    +
                     udev 141
                     ========
                     Bugfixes.
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 09b2999210c6843a2a3de529dd316b741261e31c Mon Sep 17 00:00:00 2001
                    From: Ian Campbell 
                    Date: Thu, 16 Apr 2009 22:46:18 +0200
                    Subject: path_id: support identification of Xen virtual block devices
                    
                    ---
                     extras/path_id/path_id | 27 +++++++++++++++++++++++++++
                     1 file changed, 27 insertions(+)
                    
                    diff --git a/extras/path_id/path_id b/extras/path_id/path_id
                    index d21dea7011..7b4973fa03 100755
                    --- a/extras/path_id/path_id
                    +++ b/extras/path_id/path_id
                    @@ -129,6 +129,30 @@ handle_platform () {
                     	RESULT=0
                     }
                     
                    +handle_xen () {
                    +	local DEV=$1
                    +	cd -P $1
                    +	vbd_id=${DEV##*/}
                    +	host_dev_path=$DEV
                    +	while [ ! -z "$host_dev_path" ] ; do
                    +		case "$host_dev_path" in
                    +			*/vbd*)
                    +				host_dev_path=${host_dev_path%/*}
                    +				;;
                    +			*)
                    +				break
                    +				;;
                    +		esac
                    +	done
                    +	if [ "$d" ]; then
                    +		d="xen-$vbd_id-$d"
                    +	else
                    +		d="xen-$vbd_id"
                    +	fi
                    +	D="$host_dev_path"
                    +	RESULT=0
                    +}
                    +
                     handle_serio () {
                     	local DEV=$1
                     	cd -P $1
                    @@ -532,6 +556,9 @@ handle_device () {
                     			*/platform/*)
                     				handle_platform "$D"
                     				;;
                    +			*/vbd-[0-9]*)
                    +				handle_xen "$D"
                    +				;;
                     			*/devices)
                     				D=
                     				;;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 55d8f5e208396589476583dad8f2a7f2db3e2ef5 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Fri, 17 Apr 2009 00:29:56 +0200
                    Subject: cdrom_id: add Xen cdrom support
                    
                    ---
                     extras/cdrom_id/60-cdrom_id.rules | 6 ++++--
                     extras/cdrom_id/cdrom_id.c        | 6 ++----
                     2 files changed, 6 insertions(+), 6 deletions(-)
                    
                    diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules
                    index 12fbf63779..a3e8e3c766 100644
                    --- a/extras/cdrom_id/60-cdrom_id.rules
                    +++ b/extras/cdrom_id/60-cdrom_id.rules
                    @@ -1,3 +1,5 @@
                    -# import optical drive properties
                    +# do not edit this file, it will be overwritten on update
                     
                    -ACTION=="add|change", KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]*", IMPORT{program}="cdrom_id --export $tempnode"
                    +# import optical drive properties
                    +ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \
                    +  KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]|xvd*", IMPORT{program}="cdrom_id --export $tempnode"
                    diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
                    index 7be0789f35..c578f12921 100644
                    --- a/extras/cdrom_id/cdrom_id.c
                    +++ b/extras/cdrom_id/cdrom_id.c
                    @@ -567,10 +567,8 @@ int main(int argc, char *argv[])
                     	}
                     
                     	/* check drive */
                    -	if (cd_inquiry(udev, fd) < 0) {
                    -		rc = 2;
                    -		goto exit;
                    -	}
                    +	if (cd_inquiry(udev, fd) < 0)
                    +		goto print;
                     
                     	/* read drive and possibly current profile */
                     	if (cd_profiles(udev, fd) < 0)
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From f1986e09fcce55cc18dc4a4d54f0b5a2785b91b2 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sat, 18 Apr 2009 13:23:10 +0200
                    Subject: test-libudev: update monitor source
                    
                    ---
                     udev/lib/test-libudev.c | 15 +++++----------
                     1 file changed, 5 insertions(+), 10 deletions(-)
                    
                    diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c
                    index 965da55862..be167cff47 100644
                    --- a/udev/lib/test-libudev.c
                    +++ b/udev/lib/test-libudev.c
                    @@ -217,13 +217,13 @@ static int test_enumerate_print_list(struct udev_enumerate *enumerate)
                     	return count;
                     }
                     
                    -static int test_monitor(struct udev *udev, const char *socket_path)
                    +static int test_monitor(struct udev *udev)
                     {
                     	struct udev_monitor *udev_monitor;
                     	fd_set readfds;
                     	int fd;
                     
                    -	udev_monitor = udev_monitor_new_from_socket(udev, socket_path);
                    +	udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
                     	if (udev_monitor == NULL) {
                     		printf("no socket\n");
                     		return -1;
                    @@ -243,7 +243,7 @@ static int test_monitor(struct udev *udev, const char *socket_path)
                     		FD_SET(STDIN_FILENO, &readfds);
                     		FD_SET(fd, &readfds);
                     
                    -		printf("waiting for events on %s, press ENTER to exit\n", socket_path);
                    +		printf("waiting for events from udev, press ENTER to exit\n");
                     		fdcount = select(fd+1, &readfds, NULL, NULL, NULL);
                     		printf("select fd count: %i\n", fdcount);
                     
                    @@ -377,7 +377,6 @@ int main(int argc, char *argv[])
                     	static const struct option options[] = {
                     		{ "syspath", required_argument, NULL, 'p' },
                     		{ "subsystem", required_argument, NULL, 's' },
                    -		{ "socket", required_argument, NULL, 'S' },
                     		{ "debug", no_argument, NULL, 'd' },
                     		{ "help", no_argument, NULL, 'h' },
                     		{ "version", no_argument, NULL, 'V' },
                    @@ -385,7 +384,6 @@ int main(int argc, char *argv[])
                     	};
                     	const char *syspath = "/devices/virtual/mem/null";
                     	const char *subsystem = NULL;
                    -	const char *socket = "@/org/kernel/udev/monitor";
                     	char path[1024];
                     	const char *str;
                     
                    @@ -412,15 +410,12 @@ int main(int argc, char *argv[])
                     		case 's':
                     			subsystem = optarg;
                     			break;
                    -		case 'S':
                    -			socket = optarg;
                    -			break;
                     		case 'd':
                     			if (udev_get_log_priority(udev) < LOG_INFO)
                     				udev_set_log_priority(udev, LOG_INFO);
                     			break;
                     		case 'h':
                    -			printf("--debug --syspath= --subsystem= --socket= --help\n");
                    +			printf("--debug --syspath= --subsystem= --help\n");
                     			goto out;
                     		case 'V':
                     			printf("%s\n", VERSION);
                    @@ -450,7 +445,7 @@ int main(int argc, char *argv[])
                     
                     	test_queue(udev);
                     
                    -	test_monitor(udev, socket);
                    +	test_monitor(udev);
                     out:
                     	udev_unref(udev);
                     	return 0;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From cc2c6d6ad9e3aaefc698636cf13121bb1cd205d0 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sat, 18 Apr 2009 13:23:55 +0200
                    Subject: TODO: add packet filter
                    
                    ---
                     TODO | 4 ++++
                     1 file changed, 4 insertions(+)
                    
                    diff --git a/TODO b/TODO
                    index 9214fb4874..e2f319853e 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -2,6 +2,10 @@
                       o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30)
                       o remove MMC rules, they got a modalias now (2.6.30)
                       o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30)
                    +
                    +  o add socket_filter (BPF) to match on properties to select which
                    +    messages are received on the socket:
                    +      udev_monitor_filter_property(mon, "SUBSYSTEM", "block");
                       o switch device mapper rules to:
                          dmsetup info -c --nameprefixes --unquoted --rows --noheadings \
                            -o name,uuid,suspended,readonly,major,minor,open,tables_loaded
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From ccc87b0e992063df81d07fc2581d7ca2d9c87c0a Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sat, 18 Apr 2009 13:24:20 +0200
                    Subject: update NEWS
                    
                    ---
                     NEWS | 8 ++++----
                     1 file changed, 4 insertions(+), 4 deletions(-)
                    
                    diff --git a/NEWS b/NEWS
                    index f418687555..4629e1ec01 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -2,12 +2,12 @@ udev 142
                     ========
                     Bugfixes.
                     
                    -A too old kernel or a kernel with CONFIG_SYSFS_DEPRECATED is not
                    -supported since while and udevd will log an error message at
                    +A too old kernel (2.6.21) or a kernel with CONFIG_SYSFS_DEPRECATED
                    +is not supported since while and udevd will log an error message at
                     startup.
                     
                    -DVB device naming is supplied by the kernel now. To support older
                    -kernels, the old shell script should be added to a possible compat
                    +DVB device naming is supplied by the kernel now. In case older kernels
                    +need to be supported, the old shell script should be added to a compat
                     rules file.
                     
                     udev 141
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 540f46698dd5a3bed767fa1c761ead1c9e41ed2e Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sun, 19 Apr 2009 03:25:04 +0200
                    Subject: udevd: at startup create /dev/null, /dev/console, /dev/kmsg
                    
                    ---
                     udev/lib/libudev-ctrl.c |  2 +-
                     udev/udev-node.c        | 12 ++++++++++--
                     udev/udevd.c            | 24 ++++++++++++++++++++++++
                     3 files changed, 35 insertions(+), 3 deletions(-)
                    
                    diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c
                    index 25661cade9..80ab0370e2 100644
                    --- a/udev/lib/libudev-ctrl.c
                    +++ b/udev/lib/libudev-ctrl.c
                    @@ -22,7 +22,7 @@
                     #include "libudev.h"
                     #include "libudev-private.h"
                     
                    -/* last known version with this wire protocol */
                    +/* wire protocol magic must match */
                     #define UDEV_CTRL_MAGIC				0xdead1dea
                     
                     enum udev_ctrl_msg_type {
                    diff --git a/udev/udev-node.c b/udev/udev-node.c
                    index 74ec00b1eb..965017240c 100644
                    --- a/udev/udev-node.c
                    +++ b/udev/udev-node.c
                    @@ -68,7 +68,7 @@ static int name_index(struct udev *udev, const char *devpath, const char *name,
                     int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid)
                     {
                     	struct udev *udev = udev_device_get_udev(dev);
                    -	char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)];
                    +	char filename[UTIL_PATH_SIZE];
                     	struct stat stats;
                     	int preserve = 0;
                     	int err = 0;
                    @@ -81,8 +81,14 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod
                     	else
                     		mode |= S_IFCHR;
                     
                    -	if (file == NULL)
                    +	if (file == NULL) {
                     		file = udev_device_get_devnode(dev);
                    +	} else if (file[0] != '/') {
                    +		util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
                    +		util_strlcat(filename, "/", sizeof(filename));
                    +		util_strlcat(filename, file, sizeof(filename));
                    +		file = filename;
                    +	}
                     
                     	if (lstat(file, &stats) == 0) {
                     		if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) {
                    @@ -90,6 +96,8 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod
                     			preserve = 1;
                     			udev_selinux_lsetfilecon(udev, file, mode);
                     		} else {
                    +			char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)];
                    +
                     			info(udev, "atomically replace existing file '%s'\n", file);
                     			util_strlcpy(file_tmp, file, sizeof(file_tmp));
                     			util_strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp));
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index 1aa50eb74c..d1a226673e 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -708,6 +708,28 @@ static void export_initial_seqnum(struct udev *udev)
                     	}
                     }
                     
                    +/* create the nodes the we depend on to properly start up */
                    +static void setup_initial_nodes(struct udev *udev)
                    +{
                    +	struct udev_device *dev;
                    +
                    +	dev = udev_device_new_from_subsystem_sysname(udev, "mem", "null");
                    +	if (dev != NULL) {
                    +		udev_node_mknod(dev, "null", makedev(0,0), 0666, 0, 0);
                    +		udev_device_unref(dev);
                    +	}
                    +	dev = udev_device_new_from_subsystem_sysname(udev, "mem", "kmsg");
                    +	if (dev != NULL) {
                    +		udev_node_mknod(dev, "kmsg", makedev(0,0), 0660, 0, 0);
                    +		udev_device_unref(dev);
                    +	}
                    +	dev = udev_device_new_from_subsystem_sysname(udev, "tty", "console");
                    +	if (dev != NULL) {
                    +		udev_node_mknod(dev, "console", makedev(0,0), 0600, 0, 0);
                    +		udev_device_unref(dev);
                    +	}
                    +}
                    +
                     static void startup_log(struct udev *udev)
                     {
                     	FILE *f;
                    @@ -814,6 +836,8 @@ int main(int argc, char *argv[])
                     		goto exit;
                     	}
                     
                    +	setup_initial_nodes(udev);
                    +
                     	/* make sure std{in,out,err} fd's are in a sane state */
                     	fd = open("/dev/null", O_RDWR);
                     	if (fd < 0) {
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From f907449eee3f58fafafee0658e80578b1dbb2722 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 21 Apr 2009 03:27:14 +0200
                    Subject: cdrom_id: add and use ID_CDROM_MEDIA to decide if we run vol_id
                    
                    Some broken mobile phones offer a faked cdrom drive with a media
                    without any tracks.
                    ---
                     extras/cdrom_id/cdrom_id.c                | 5 +++++
                     rules/rules.d/60-persistent-storage.rules | 2 +-
                     2 files changed, 6 insertions(+), 1 deletion(-)
                    
                    diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
                    index c578f12921..371d6a2dbd 100644
                    --- a/extras/cdrom_id/cdrom_id.c
                    +++ b/extras/cdrom_id/cdrom_id.c
                    @@ -76,6 +76,7 @@ static unsigned int cd_mrw;
                     static unsigned int cd_mrw_w;
                     
                     /* media info */
                    +static unsigned int cd_media;
                     static unsigned int cd_media_cd_rom;
                     static unsigned int cd_media_cd_r;
                     static unsigned int cd_media_cd_rw;
                    @@ -325,6 +326,8 @@ static int cd_profiles(struct udev *udev, int fd)
                     		return -1;
                     	}
                     
                    +	cd_media = 1;
                    +
                     	switch (cur_profile) {
                     	case 0x03:
                     	case 0x04:
                    @@ -625,6 +628,8 @@ print:
                     	if (cd_mrw_w)
                     		printf("ID_CDROM_MRW_W=1\n");
                     
                    +	if (cd_media)
                    +		printf("ID_CDROM_MEDIA=1\n");
                     	if (cd_media_mo)
                     		printf("ID_CDROM_MEDIA_MO=1\n");
                     	if (cd_media_mrw)
                    diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules
                    index 23c21f8c6c..409548893b 100644
                    --- a/rules/rules.d/60-persistent-storage.rules
                    +++ b/rules/rules.d/60-persistent-storage.rules
                    @@ -55,7 +55,7 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA
                     ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end"
                     
                     # probe filesystem metadata of optical drives which have a media inserted
                    -KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
                    +KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode"
                     
                     # probe filesystem metadata of disks
                     KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From e14bdd88e9796ec3c70966dd1899add6667431f5 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 22 Apr 2009 03:50:11 +0200
                    Subject: libudev: monitor - add client socket filter for subsystem value
                    
                    Messages send back by the udev daemon to the netlink socket are
                    multiplexed by the kernel and delivered to multiple clients. The
                    clients can upload a socket filter to let the kernel drop messages
                    not belonging to a certain subsystem. This prevent needless wakeups
                    and message processing for users who are only interested in a
                    subset of available events.
                    
                    Recent kernels allow untrusted users to listen to the netlink
                    messages.
                    
                    The messages send by the udev daemon are versioned, to prevent any
                    custom software reading them without libudev. The message wire format
                    may change with any udev version update.
                    ---
                     configure.ac               |   6 +-
                     udev/lib/exported_symbols  |   1 +
                     udev/lib/libudev-device.c  |  18 +--
                     udev/lib/libudev-monitor.c | 281 +++++++++++++++++++++++++++++++++++++++------
                     udev/lib/libudev-private.h |   1 +
                     udev/lib/libudev-util.c    |  65 +++++++++++
                     udev/lib/libudev.h         |   1 +
                     udev/lib/test-libudev.c    |   7 ++
                     8 files changed, 326 insertions(+), 54 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index cbe2833f22..f611864258 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -14,9 +14,9 @@ AC_PREFIX_DEFAULT([/usr])
                     test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix=
                     
                     dnl /* libudev version */
                    -LIBUDEV_LT_CURRENT=2
                    -LIBUDEV_LT_REVISION=1
                    -LIBUDEV_LT_AGE=2
                    +LIBUDEV_LT_CURRENT=3
                    +LIBUDEV_LT_REVISION=0
                    +LIBUDEV_LT_AGE=3
                     AC_SUBST(LIBUDEV_LT_CURRENT)
                     AC_SUBST(LIBUDEV_LT_REVISION)
                     AC_SUBST(LIBUDEV_LT_AGE)
                    diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols
                    index 27314e4a26..23cd8fbe28 100644
                    --- a/udev/lib/exported_symbols
                    +++ b/udev/lib/exported_symbols
                    @@ -56,6 +56,7 @@ udev_monitor_unref
                     udev_monitor_get_udev
                     udev_monitor_get_fd
                     udev_monitor_receive_device
                    +udev_monitor_filter_add_match_subsystem
                     udev_queue_new
                     udev_queue_ref
                     udev_queue_unref
                    diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
                    index 2b6086d032..92b2d18b83 100644
                    --- a/udev/lib/libudev-device.c
                    +++ b/udev/lib/libudev-device.c
                    @@ -1074,7 +1074,6 @@ const char *udev_device_get_property_value(struct udev_device *udev_device, cons
                     #define MONITOR_BUF_SIZE		4096
                     static int update_envp_monitor_buf(struct udev_device *udev_device)
                     {
                    -	const char *action;
                     	struct udev_list_entry *list_entry;
                     	size_t bufpos;
                     	size_t len;
                    @@ -1093,23 +1092,8 @@ static int update_envp_monitor_buf(struct udev_device *udev_device)
                     	if (udev_device->envp == NULL)
                     		return -ENOMEM;
                     
                    -	/* header @ */
                    -	action = udev_device_get_action(udev_device);
                    -	if (action == NULL)
                    -		return -EINVAL;
                    -	bufpos = util_strlcpy(udev_device->monitor_buf, action, MONITOR_BUF_SIZE);
                    -	len = util_strlcpy(&udev_device->monitor_buf[bufpos], "@", MONITOR_BUF_SIZE-bufpos);
                    -	if (len >= MONITOR_BUF_SIZE-bufpos)
                    -		return -EINVAL;
                    -	bufpos += len;
                    -	len = util_strlcpy(&udev_device->monitor_buf[bufpos],
                    -			   udev_device_get_devpath(udev_device),
                    -			   MONITOR_BUF_SIZE-bufpos);
                    -	if (len+1 >= MONITOR_BUF_SIZE-bufpos)
                    -		return -EINVAL;
                    -	bufpos += len+1;
                    -
                     	i = 0;
                    +	bufpos = 0;
                     	udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) {
                     		/* add string to envp array */
                     		udev_device->envp[i++] = &udev_device->monitor_buf[bufpos];
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index e68bdf5bac..570fcafbb4 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -16,10 +16,13 @@
                     #include 
                     #include 
                     #include 
                    +#include 
                     #include 
                     #include 
                     #include 
                    +#include 
                     #include 
                    +#include 
                     
                     #include "libudev.h"
                     #include "libudev-private.h"
                    @@ -32,6 +35,7 @@ struct udev_monitor {
                     	struct sockaddr_nl snl_peer;
                     	struct sockaddr_un sun;
                     	socklen_t addrlen;
                    +	struct udev_list_node filter_subsystem_list;
                     };
                     
                     enum udev_monitor_netlink_group {
                    @@ -39,6 +43,38 @@ enum udev_monitor_netlink_group {
                     	UDEV_MONITOR_UDEV	= 2,
                     };
                     
                    +#define UDEV_MONITOR_MAGIC		0xcafe1dea
                    +struct udev_monitor_netlink_header {
                    +	/* udev version text */
                    +	char version[16];
                    +	/*
                    +	 * magic to protect against daemon <-> library message format mismatch
                    +	 * used in the kernel from socket filter rules; needs to be stored in network order
                    +	 */
                    +	unsigned int magic;
                    +	/* properties buffer */
                    +	unsigned short properties_off;
                    +	unsigned short properties_len;
                    +	/*
                    +	 * crc32 of some common device properties to filter with socket filters in the client
                    +	 * used in the kernel from socket filter rules; needs to be stored in network order
                    +	 */
                    +	unsigned int filter_subsystem;
                    +};
                    +
                    +static struct udev_monitor *udev_monitor_new(struct udev *udev)
                    +{
                    +	struct udev_monitor *udev_monitor;
                    +
                    +	udev_monitor = calloc(1, sizeof(struct udev_monitor));
                    +	if (udev_monitor == NULL)
                    +		return NULL;
                    +	udev_monitor->refcount = 1;
                    +	udev_monitor->udev = udev;
                    +	udev_list_init(&udev_monitor->filter_subsystem_list);
                    +	return udev_monitor;
                    +}
                    +
                     /**
                      * udev_monitor_new_from_socket:
                      * @udev: udev library context
                    @@ -68,11 +104,9 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char
                     		return NULL;
                     	if (socket_path == NULL)
                     		return NULL;
                    -	udev_monitor = calloc(1, sizeof(struct udev_monitor));
                    +	udev_monitor = udev_monitor_new(udev);
                     	if (udev_monitor == NULL)
                     		return NULL;
                    -	udev_monitor->refcount = 1;
                    -	udev_monitor->udev = udev;
                     
                     	udev_monitor->sun.sun_family = AF_LOCAL;
                     	if (socket_path[0] == '@') {
                    @@ -143,11 +177,9 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char
                     	else
                     		return NULL;
                     
                    -	udev_monitor = calloc(1, sizeof(struct udev_monitor));
                    +	udev_monitor = udev_monitor_new(udev);
                     	if (udev_monitor == NULL)
                     		return NULL;
                    -	udev_monitor->refcount = 1;
                    -	udev_monitor->udev = udev;
                     
                     	udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT);
                     	if (udev_monitor->sock == -1) {
                    @@ -166,19 +198,91 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char
                     	return udev_monitor;
                     }
                     
                    +static inline void bpf_stmt(struct sock_filter *inss, unsigned int *i,
                    +			    unsigned short code, unsigned int data)
                    +{
                    +	struct sock_filter *ins = &inss[*i];
                    +
                    +	ins->code = code;
                    +	ins->k = data;
                    +	(*i)++;
                    +}
                    +
                    +static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i,
                    +			   unsigned short code, unsigned int data,
                    +			   unsigned short jt, unsigned short jf)
                    +{
                    +	struct sock_filter *ins = &inss[*i];
                    +
                    +	ins->code = code;
                    +	ins->jt = jt;
                    +	ins->jf = jf;
                    +	ins->k = data;
                    +	(*i)++;
                    +}
                    +
                    +static int filter_apply(struct udev_monitor *udev_monitor)
                    +{
                    +	static struct sock_filter ins[256];
                    +	static struct sock_fprog filter;
                    +	unsigned int i;
                    +	struct udev_list_entry *list_entry;
                    +	int err;
                    +
                    +	if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL)
                    +		return 0;
                    +
                    +	memset(ins, 0x00, sizeof(ins));
                    +	i = 0;
                    +
                    +	/* load magic in accu */
                    +	bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, magic));
                    +	/* jump if magic matches */
                    +	bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, UDEV_MONITOR_MAGIC, 1, 0);
                    +	/* wrong magic, drop packet */
                    +	bpf_stmt(ins, &i, BPF_RET|BPF_K, 0);
                    +
                    +	/* load filter_subsystem value in accu */
                    +	bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem));
                    +	/* add all subsystem match values */
                    +	udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) {
                    +		const char *subsys = udev_list_entry_get_name(list_entry);
                    +		unsigned int crc;
                    +
                    +		crc = util_crc32((unsigned char *)subsys, strlen(subsys));
                    +		/* jump if value does not match */
                    +		bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, crc, 0, 1);
                    +		/* matched, pass packet */
                    +		bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff);
                    +
                    +		if (i+1 >= ARRAY_SIZE(ins))
                    +			return -1;
                    +	}
                    +	/* nothing matched, drop packet */
                    +	bpf_stmt(ins, &i, BPF_RET|BPF_K, 0);
                    +
                    +	/* install filter */
                    +	filter.len = i;
                    +	filter.filter = ins;
                    +	err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter));
                    +	return err;
                    +}
                    +
                     int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
                     {
                     	int err;
                     	const int on = 1;
                     
                    -	if (udev_monitor->sun.sun_family != 0)
                    +	if (udev_monitor->sun.sun_family != 0) {
                     		err = bind(udev_monitor->sock,
                     			   (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen);
                    -	else if (udev_monitor->snl.nl_family != 0)
                    +	} else if (udev_monitor->snl.nl_family != 0) {
                    +		filter_apply(udev_monitor);
                     		err = bind(udev_monitor->sock,
                     			   (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl));
                    -	else
                    +	} else {
                     		return -EINVAL;
                    +	}
                     
                     	if (err < 0) {
                     		err(udev_monitor->udev, "bind failed: %m\n");
                    @@ -231,6 +335,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor)
                     		return;
                     	if (udev_monitor->sock >= 0)
                     		close(udev_monitor->sock);
                    +	udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list);
                     	dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor);
                     	free(udev_monitor);
                     }
                    @@ -265,6 +370,25 @@ int udev_monitor_get_fd(struct udev_monitor *udev_monitor)
                     	return udev_monitor->sock;
                     }
                     
                    +static int passes_filter(struct udev_monitor *udev_monitor, struct udev_device *udev_device)
                    +{
                    +	struct udev_list_entry *list_entry;
                    +	int pass = 0;
                    +
                    +	if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL)
                    +		return 1;
                    +
                    +	udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) {
                    +		const char *subsys = udev_device_get_subsystem(udev_device);
                    +
                    +		if (strcmp(udev_list_entry_get_name(list_entry), subsys) == 0) {
                    +			pass= 1;
                    +			break;
                    +		}
                    +	}
                    +	return pass;
                    +}
                    +
                     /**
                      * udev_monitor_receive_device:
                      * @udev_monitor: udev monitor
                    @@ -292,12 +416,14 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     	struct ucred *cred;
                     	char buf[4096];
                     	size_t bufpos;
                    +	struct udev_monitor_netlink_header *nlh;
                     	int devpath_set = 0;
                     	int subsystem_set = 0;
                     	int action_set = 0;
                     	int maj = 0;
                     	int min = 0;
                     
                    +retry:
                     	if (udev_monitor == NULL)
                     		return NULL;
                     	memset(buf, 0x00, sizeof(buf));
                    @@ -311,7 +437,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     
                     	if (udev_monitor->snl.nl_family != 0) {
                     		smsg.msg_name = &snl;
                    -		smsg.msg_namelen = sizeof snl;
                    +		smsg.msg_namelen = sizeof(snl);
                     	}
                     
                     	if (recvmsg(udev_monitor->sock, &smsg, 0) < 0) {
                    @@ -343,17 +469,27 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     		return NULL;
                     	}
                     
                    -	/* skip header */
                    -	bufpos = strlen(buf) + 1;
                    -	if (bufpos < sizeof("a@/d") || bufpos >= sizeof(buf)) {
                    -		info(udev_monitor->udev, "invalid message length\n");
                    -		return NULL;
                    -	}
                    +	nlh = (struct udev_monitor_netlink_header *) buf;
                    +	if (nlh->magic == ntohl(UDEV_MONITOR_MAGIC)) {
                    +		/* udev message with version magic */
                    +		if (nlh->properties_off < sizeof(struct udev_monitor_netlink_header))
                    +			return NULL;
                    +		if (nlh->properties_off+32U > sizeof(buf))
                    +			return NULL;
                    +		bufpos = nlh->properties_off;
                    +	} else {
                    +		/* kernel message with header */
                    +		bufpos = strlen(buf) + 1;
                    +		if (bufpos < sizeof("a@/d") || bufpos >= sizeof(buf)) {
                    +			info(udev_monitor->udev, "invalid message length\n");
                    +			return NULL;
                    +		}
                     
                    -	/* check message header */
                    -	if (strstr(buf, "@/") == NULL) {
                    -		info(udev_monitor->udev, "unrecognized message header\n");
                    -		return NULL;
                    +		/* check message header */
                    +		if (strstr(buf, "@/") == NULL) {
                    +			info(udev_monitor->udev, "unrecognized message header\n");
                    +			return NULL;
                    +		}
                     	}
                     
                     	udev_device = device_new(udev_monitor->udev);
                    @@ -430,6 +566,23 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     		udev_device_unref(udev_device);
                     		return NULL;
                     	}
                    +
                    +	/* skip device, if it does not pass the current filter */
                    +	if (!passes_filter(udev_monitor, udev_device)) {
                    +		struct pollfd pfd[1];
                    +		int rc;
                    +
                    +		udev_device_unref(udev_device);
                    +
                    +		/* if something is queued, get next device */
                    +		pfd[0].fd = udev_monitor->sock;
                    +		pfd[0].events = POLLIN;
                    +		rc = poll(pfd, 1, 0);
                    +		if (rc > 0)
                    +			goto retry;
                    +		return NULL;
                    +	}
                    +
                     	if (maj > 0)
                     		udev_device_set_devnum(udev_device, makedev(maj, min));
                     	udev_device_set_info_loaded(udev_device);
                    @@ -438,27 +591,87 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     
                     int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device)
                     {
                    +	struct msghdr smsg;
                    +	struct iovec iov[2];
                     	const char *buf;
                    -	ssize_t len;
                    +	ssize_t blen;
                     	ssize_t count;
                     
                    -	len = udev_device_get_properties_monitor_buf(udev_device, &buf);
                    -	if (len < 32)
                    +	blen = udev_device_get_properties_monitor_buf(udev_device, &buf);
                    +	if (blen < 32)
                     		return -1;
                    -	if (udev_monitor->sun.sun_family != 0)
                    -		count = sendto(udev_monitor->sock,
                    -			       buf, len, 0,
                    -			       (struct sockaddr *)&udev_monitor->sun,
                    -			       udev_monitor->addrlen);
                    -	else if (udev_monitor->snl.nl_family != 0)
                    +
                    +	if (udev_monitor->sun.sun_family != 0) {
                    +		const char *action;
                    +		char header[2048];
                    +		size_t hlen;
                    +
                    +		/* header @ */
                    +		action = udev_device_get_action(udev_device);
                    +		if (action == NULL)
                    +			return -EINVAL;
                    +		util_strlcpy(header, action, sizeof(header));
                    +		util_strlcat(header, "@", sizeof(header));
                    +		hlen = util_strlcat(header, udev_device_get_devpath(udev_device), sizeof(header))+1;
                    +		if (hlen >= sizeof(header))
                    +			return -EINVAL;
                    +		iov[0].iov_base = header;
                    +		iov[0].iov_len = hlen;
                    +
                    +		/* add properties list */
                    +		iov[1].iov_base = (char *)buf;
                    +		iov[1].iov_len = blen;
                    +
                    +		memset(&smsg, 0x00, sizeof(struct msghdr));
                    +		smsg.msg_iov = iov;
                    +		smsg.msg_iovlen = 2;
                    +		smsg.msg_name = &udev_monitor->sun;
                    +		smsg.msg_namelen = udev_monitor->addrlen;
                    +	} else if (udev_monitor->snl.nl_family != 0) {
                    +		const char *val;
                    +		size_t vlen;
                    +		struct udev_monitor_netlink_header nlh;
                    +
                    +
                    +		/* add versioned header */
                    +		memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header));
                    +		util_strlcpy(nlh.version, "udev-" VERSION, sizeof(nlh.version));
                    +		nlh.magic = htonl(UDEV_MONITOR_MAGIC);
                    +		val = udev_device_get_subsystem(udev_device);
                    +		vlen = strlen(val);
                    +		nlh.filter_subsystem = htonl(util_crc32((unsigned char *)val, vlen));
                    +		iov[0].iov_base = &nlh;
                    +		iov[0].iov_len = sizeof(struct udev_monitor_netlink_header);
                    +
                    +		/* add properties list */
                    +		nlh.properties_off = iov[0].iov_len;
                    +		nlh.properties_len = blen;
                    +		iov[1].iov_base = (char *)buf;
                    +		iov[1].iov_len = blen;
                    +
                    +		memset(&smsg, 0x00, sizeof(struct msghdr));
                    +		smsg.msg_iov = iov;
                    +		smsg.msg_iovlen = 2;
                     		/* no destination besides the muticast group, we will always get ECONNREFUSED */
                    -		count = sendto(udev_monitor->sock,
                    -			       buf, len, 0,
                    -			       (struct sockaddr *)&udev_monitor->snl_peer,
                    -			       sizeof(struct sockaddr_nl));
                    -	else
                    +		smsg.msg_name = &udev_monitor->snl_peer;
                    +		smsg.msg_namelen = sizeof(struct sockaddr_nl);
                    +	} else {
                     		return -1;
                    +	}
                     
                    +	count = sendmsg(udev_monitor->sock, &smsg, 0);
                     	info(udev_monitor->udev, "passed %zi bytes to monitor %p\n", count, udev_monitor);
                     	return count;
                     }
                    +
                    +int udev_monitor_filter_add_match_subsystem(struct udev_monitor *udev_monitor, const char *subsystem)
                    +{
                    +	if (udev_monitor == NULL)
                    +		return -EINVAL;
                    +	if (subsystem == NULL)
                    +		return 0;
                    +	if (udev_list_entry_add(udev_monitor->udev,
                    +				&udev_monitor->filter_subsystem_list, subsystem, NULL, 1, 0) == NULL)
                    +		return -ENOMEM;
                    +	return 0;
                    +}
                    diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
                    index 1e47d51080..178004c485 100644
                    --- a/udev/lib/libudev-private.h
                    +++ b/udev/lib/libudev-private.h
                    @@ -173,4 +173,5 @@ extern int udev_util_replace_whitespace(const char *str, char *to, size_t len);
                     extern int udev_util_replace_chars(char *str, const char *white);
                     extern int udev_util_encode_string(const char *str, char *str_enc, size_t len);
                     extern void util_set_fd_cloexec(int fd);
                    +extern unsigned int util_crc32(const unsigned char *buf, size_t len);
                     #endif
                    diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c
                    index 243a99dce9..018e2cdb08 100644
                    --- a/udev/lib/libudev-util.c
                    +++ b/udev/lib/libudev-util.c
                    @@ -461,3 +461,68 @@ void util_set_fd_cloexec(int fd)
                     		flags |= FD_CLOEXEC;
                     	fcntl(fd, F_SETFD, flags);
                     }
                    +
                    +unsigned int util_crc32(const unsigned char *buf, size_t len)
                    +{
                    +	unsigned int crc;
                    +	const unsigned char *end;
                    +	static const unsigned int crc32_table[256] = {
                    +		0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
                    +		0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
                    +		0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
                    +		0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
                    +		0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
                    +		0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
                    +		0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
                    +		0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
                    +		0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
                    +		0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
                    +		0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
                    +		0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
                    +		0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
                    +		0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
                    +		0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
                    +		0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
                    +		0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
                    +		0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
                    +		0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
                    +		0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
                    +		0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
                    +		0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
                    +		0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
                    +		0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
                    +		0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
                    +		0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
                    +		0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
                    +		0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
                    +		0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
                    +		0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
                    +		0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
                    +		0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
                    +		0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
                    +		0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
                    +		0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
                    +		0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
                    +		0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
                    +		0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
                    +		0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
                    +		0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
                    +		0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
                    +		0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
                    +		0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
                    +		0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
                    +		0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
                    +		0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
                    +		0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
                    +		0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
                    +		0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
                    +		0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
                    +		0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
                    +		0x2d02ef8d
                    +	};
                    +
                    +	crc = 0xffffffff;
                    +	for (end = buf + len; buf < end; ++buf)
                    +		crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
                    +	return ~crc;
                    +}
                    diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h
                    index e0aa571e26..4094b3a822 100644
                    --- a/udev/lib/libudev.h
                    +++ b/udev/lib/libudev.h
                    @@ -84,6 +84,7 @@ extern void udev_monitor_unref(struct udev_monitor *udev_monitor);
                     extern struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
                     extern int udev_monitor_get_fd(struct udev_monitor *udev_monitor);
                     extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor);
                    +extern int udev_monitor_filter_add_match_subsystem(struct udev_monitor *udev_monitor, const char *subsystem);
                     
                     /* sys enumeration */
                     struct udev_enumerate;
                    diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c
                    index be167cff47..0f09bbbb60 100644
                    --- a/udev/lib/test-libudev.c
                    +++ b/udev/lib/test-libudev.c
                    @@ -228,6 +228,12 @@ static int test_monitor(struct udev *udev)
                     		printf("no socket\n");
                     		return -1;
                     	}
                    +	if (udev_monitor_filter_add_match_subsystem(udev_monitor, "block") < 0 ||
                    +	    udev_monitor_filter_add_match_subsystem(udev_monitor, "tty") < 0 ||
                    +	    udev_monitor_filter_add_match_subsystem(udev_monitor, "usb") < 0) {
                    +		printf("filter failed\n");
                    +		return -1;
                    +	}
                     	if (udev_monitor_enable_receiving(udev_monitor) < 0) {
                     		printf("bind failed\n");
                     		return -1;
                    @@ -251,6 +257,7 @@ static int test_monitor(struct udev *udev)
                     			device = udev_monitor_receive_device(udev_monitor);
                     			if (device == NULL) {
                     				printf("no device from socket\n");
                    +sleep(1);
                     				continue;
                     			}
                     			print_device(device);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 3111a33e952a20d8bb60cb37e4ad0986b555f4e1 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 22 Apr 2009 04:11:18 +0200
                    Subject: udevadm: monitor - print error if we can not bind to socket
                    
                    ---
                     udev/udevadm-monitor.c | 5 ++++-
                     1 file changed, 4 insertions(+), 1 deletion(-)
                    
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index d8ec066467..b5897b9ff8 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -127,10 +127,12 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     	if (print_udev) {
                     		udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
                     		if (udev_monitor == NULL) {
                    +			fprintf(stderr, "error: unable to create netlink socket\n");
                     			rc = 1;
                     			goto out;
                     		}
                     		if (udev_monitor_enable_receiving(udev_monitor) < 0) {
                    +			fprintf(stderr, "error: unable to subscribe to udev events\n");
                     			rc = 2;
                     			goto out;
                     		}
                    @@ -139,11 +141,12 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     	if (print_kernel) {
                     		kernel_monitor = udev_monitor_new_from_netlink(udev, "kernel");
                     		if (kernel_monitor == NULL) {
                    -			fprintf(stderr, "unable to subscribe to kernel events\n");
                    +			fprintf(stderr, "error: unable to create netlink socket\n");
                     			rc = 3;
                     			goto out;
                     		}
                     		if (udev_monitor_enable_receiving(kernel_monitor) < 0) {
                    +			fprintf(stderr, "error: unable to subscribe to kernel events\n");
                     			rc = 4;
                     			goto out;
                     		}
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 4277453fd2478769a274f4664d924642f0411009 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 22 Apr 2009 04:32:25 +0200
                    Subject: update TODO
                    
                    ---
                     TODO                    | 6 ------
                     udev/lib/test-libudev.c | 1 -
                     2 files changed, 7 deletions(-)
                    
                    diff --git a/TODO b/TODO
                    index e2f319853e..5095944ade 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -3,12 +3,6 @@
                       o remove MMC rules, they got a modalias now (2.6.30)
                       o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30)
                     
                    -  o add socket_filter (BPF) to match on properties to select which
                    -    messages are received on the socket:
                    -      udev_monitor_filter_property(mon, "SUBSYSTEM", "block");
                    -  o switch device mapper rules to:
                    -     dmsetup info -c --nameprefixes --unquoted --rows --noheadings \
                    -       -o name,uuid,suspended,readonly,major,minor,open,tables_loaded
                       o implement path_id in C with libudev (?)
                       o convert firmware.sh to C (?)
                       o "udevadm control" commands will only accept the -- syntax
                    diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c
                    index 0f09bbbb60..be25d61121 100644
                    --- a/udev/lib/test-libudev.c
                    +++ b/udev/lib/test-libudev.c
                    @@ -257,7 +257,6 @@ static int test_monitor(struct udev *udev)
                     			device = udev_monitor_receive_device(udev_monitor);
                     			if (device == NULL) {
                     				printf("no device from socket\n");
                    -sleep(1);
                     				continue;
                     			}
                     			print_device(device);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From a9550eb11fba3c0ae5f71e0f0780bd100ecc742d Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 22 Apr 2009 05:00:15 +0200
                    Subject: udevadm monitor - add --subsystem-match=
                    
                    ---
                     udev/udevadm-monitor.c | 19 ++++++++++++++++++-
                     1 file changed, 18 insertions(+), 1 deletion(-)
                    
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index b5897b9ff8..92215b671b 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -71,6 +71,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     	int env = 0;
                     	int print_kernel = 0;
                     	int print_udev = 0;
                    +	struct udev_list_node subsystem_match_list;
                     	struct udev_monitor *udev_monitor = NULL;
                     	struct udev_monitor *kernel_monitor = NULL;
                     	fd_set readfds;
                    @@ -80,12 +81,14 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     		{ "environment", no_argument, NULL, 'e' },
                     		{ "kernel", no_argument, NULL, 'k' },
                     		{ "udev", no_argument, NULL, 'u' },
                    +		{ "subsystem-match", required_argument, NULL, 's' },
                     		{ "help", no_argument, NULL, 'h' },
                     		{}
                     	};
                     
                    +	udev_list_init(&subsystem_match_list);
                     	while (1) {
                    -		option = getopt_long(argc, argv, "ekuh", options, NULL);
                    +		option = getopt_long(argc, argv, "ekus:h", options, NULL);
                     		if (option == -1)
                     			break;
                     
                    @@ -99,6 +102,9 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     		case 'u':
                     			print_udev = 1;
                     			break;
                    +		case 's':
                    +			udev_list_entry_add(udev, &subsystem_match_list, optarg, NULL, 1, 0);
                    +			break;
                     		case 'h':
                     			printf("Usage: udevadm monitor [--environment] [--kernel] [--udev] [--help]\n"
                     			       "  --env    print the whole event environment\n"
                    @@ -125,12 +131,22 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     
                     	printf("monitor will print the received events for:\n");
                     	if (print_udev) {
                    +		struct udev_list_entry *entry;
                    +
                     		udev_monitor = udev_monitor_new_from_netlink(udev, "udev");
                     		if (udev_monitor == NULL) {
                     			fprintf(stderr, "error: unable to create netlink socket\n");
                     			rc = 1;
                     			goto out;
                     		}
                    +
                    +		udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) {
                    +			const char *subsys = udev_list_entry_get_name(entry);
                    +
                    +			if (udev_monitor_filter_add_match_subsystem(udev_monitor, subsys) < 0)
                    +				fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys);
                    +		}
                    +
                     		if (udev_monitor_enable_receiving(udev_monitor) < 0) {
                     			fprintf(stderr, "error: unable to subscribe to udev events\n");
                     			rc = 2;
                    @@ -195,5 +211,6 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     out:
                     	udev_monitor_unref(udev_monitor);
                     	udev_monitor_unref(kernel_monitor);
                    +	udev_list_cleanup_entries(udev, &subsystem_match_list);
                     	return rc;
                     }
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From a947e5eaaecdee69f7197c44f77e5ac5f8f58f04 Mon Sep 17 00:00:00 2001
                    From: John Wright 
                    Date: Wed, 22 Apr 2009 14:53:35 +0200
                    Subject: edd_id: add cciss devices
                    
                    Since cciss devices can be BIOS boot devices just as well as sd* and
                    hd*, the edd_id program should be run on them so that the later
                    /dev/disk/by-id/edd-* rules will work.
                    ---
                     extras/edd_id/61-persistent-storage-edd.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/extras/edd_id/61-persistent-storage-edd.rules b/extras/edd_id/61-persistent-storage-edd.rules
                    index bd020b7172..54ae0865e4 100644
                    --- a/extras/edd_id/61-persistent-storage-edd.rules
                    +++ b/extras/edd_id/61-persistent-storage-edd.rules
                    @@ -2,7 +2,7 @@
                     
                     ACTION!="add|change", GOTO="persistent_storage_edd_end"
                     SUBSYSTEM!="block", GOTO="persistent_storage_edd_end"
                    -KERNEL!="sd*|hd*", GOTO="persistent_storage_edd_end"
                    +KERNEL!="sd*|hd*|cciss*", GOTO="persistent_storage_edd_end"
                     
                     # BIOS Enhanced Disk Device
                     ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $tempnode"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From c7dff03e057a7548bc2f2adbd5d2798d209b56e6 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 22 Apr 2009 18:38:16 +0200
                    Subject: libudev: monitor - use simpler hash
                    
                    ---
                     udev/lib/libudev-monitor.c | 42 ++++++++++++++++-----------
                     udev/lib/libudev-private.h |  2 +-
                     udev/lib/libudev-util.c    | 72 +++++++---------------------------------------
                     3 files changed, 36 insertions(+), 80 deletions(-)
                    
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index 570fcafbb4..a0f93546f7 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -56,8 +56,9 @@ struct udev_monitor_netlink_header {
                     	unsigned short properties_off;
                     	unsigned short properties_len;
                     	/*
                    -	 * crc32 of some common device properties to filter with socket filters in the client
                    -	 * used in the kernel from socket filter rules; needs to be stored in network order
                    +	 * hashes of some common device propertie strings to filter with socket filters in
                    +	 * the client used in the kernel from socket filter rules; needs to be stored in
                    +	 * network order
                     	 */
                     	unsigned int filter_subsystem;
                     };
                    @@ -247,11 +248,11 @@ static int filter_apply(struct udev_monitor *udev_monitor)
                     	/* add all subsystem match values */
                     	udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) {
                     		const char *subsys = udev_list_entry_get_name(list_entry);
                    -		unsigned int crc;
                    +		unsigned int hash;
                     
                    -		crc = util_crc32((unsigned char *)subsys, strlen(subsys));
                    +		hash = util_string_hash32(subsys);
                     		/* jump if value does not match */
                    -		bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, crc, 0, 1);
                    +		bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1);
                     		/* matched, pass packet */
                     		bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff);
                     
                    @@ -414,8 +415,9 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     	struct cmsghdr *cmsg;
                     	struct sockaddr_nl snl;
                     	struct ucred *cred;
                    -	char buf[4096];
                    -	size_t bufpos;
                    +	char buf[8192];
                    +	ssize_t buflen;
                    +	ssize_t bufpos;
                     	struct udev_monitor_netlink_header *nlh;
                     	int devpath_set = 0;
                     	int subsystem_set = 0;
                    @@ -440,12 +442,18 @@ retry:
                     		smsg.msg_namelen = sizeof(snl);
                     	}
                     
                    -	if (recvmsg(udev_monitor->sock, &smsg, 0) < 0) {
                    +	buflen = recvmsg(udev_monitor->sock, &smsg, 0);
                    +	if (buflen < 0) {
                     		if (errno != EINTR)
                     			info(udev_monitor->udev, "unable to receive message\n");
                     		return NULL;
                     	}
                     
                    +	if (buflen < 32 || (size_t)buflen >= sizeof(buf)) {
                    +		info(udev_monitor->udev, "invalid message length\n");
                    +		return NULL;
                    +	}
                    +
                     	if (udev_monitor->snl.nl_family != 0) {
                     		if (snl.nl_groups == 0) {
                     			info(udev_monitor->udev, "unicast netlink message ignored\n");
                    @@ -469,18 +477,20 @@ retry:
                     		return NULL;
                     	}
                     
                    -	nlh = (struct udev_monitor_netlink_header *) buf;
                    -	if (nlh->magic == ntohl(UDEV_MONITOR_MAGIC)) {
                    -		/* udev message with version magic */
                    +	if (strncmp(buf, "udev-", 5) == 0) {
                    +		/* udev message needs proper version magic */
                    +		nlh = (struct udev_monitor_netlink_header *) buf;
                    +		if (nlh->magic != htonl(UDEV_MONITOR_MAGIC))
                    +			return NULL;
                     		if (nlh->properties_off < sizeof(struct udev_monitor_netlink_header))
                     			return NULL;
                    -		if (nlh->properties_off+32U > sizeof(buf))
                    +		if (nlh->properties_off+32U > buflen)
                     			return NULL;
                     		bufpos = nlh->properties_off;
                     	} else {
                     		/* kernel message with header */
                     		bufpos = strlen(buf) + 1;
                    -		if (bufpos < sizeof("a@/d") || bufpos >= sizeof(buf)) {
                    +		if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) {
                     			info(udev_monitor->udev, "invalid message length\n");
                     			return NULL;
                     		}
                    @@ -497,7 +507,7 @@ retry:
                     		return NULL;
                     	}
                     
                    -	while (bufpos < sizeof(buf)) {
                    +	while (bufpos < buflen) {
                     		char *key;
                     		size_t keylen;
                     
                    @@ -629,7 +639,6 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi
                     		smsg.msg_namelen = udev_monitor->addrlen;
                     	} else if (udev_monitor->snl.nl_family != 0) {
                     		const char *val;
                    -		size_t vlen;
                     		struct udev_monitor_netlink_header nlh;
                     
                     
                    @@ -638,8 +647,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi
                     		util_strlcpy(nlh.version, "udev-" VERSION, sizeof(nlh.version));
                     		nlh.magic = htonl(UDEV_MONITOR_MAGIC);
                     		val = udev_device_get_subsystem(udev_device);
                    -		vlen = strlen(val);
                    -		nlh.filter_subsystem = htonl(util_crc32((unsigned char *)val, vlen));
                    +		nlh.filter_subsystem = htonl(util_string_hash32(val));
                     		iov[0].iov_base = &nlh;
                     		iov[0].iov_len = sizeof(struct udev_monitor_netlink_header);
                     
                    diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
                    index 178004c485..0756efea81 100644
                    --- a/udev/lib/libudev-private.h
                    +++ b/udev/lib/libudev-private.h
                    @@ -173,5 +173,5 @@ extern int udev_util_replace_whitespace(const char *str, char *to, size_t len);
                     extern int udev_util_replace_chars(char *str, const char *white);
                     extern int udev_util_encode_string(const char *str, char *str_enc, size_t len);
                     extern void util_set_fd_cloexec(int fd);
                    -extern unsigned int util_crc32(const unsigned char *buf, size_t len);
                    +extern unsigned int util_string_hash32(const char *str);
                     #endif
                    diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c
                    index 018e2cdb08..2b8cda59f6 100644
                    --- a/udev/lib/libudev-util.c
                    +++ b/udev/lib/libudev-util.c
                    @@ -462,67 +462,15 @@ void util_set_fd_cloexec(int fd)
                     	fcntl(fd, F_SETFD, flags);
                     }
                     
                    -unsigned int util_crc32(const unsigned char *buf, size_t len)
                    +unsigned int util_string_hash32(const char *str)
                     {
                    -	unsigned int crc;
                    -	const unsigned char *end;
                    -	static const unsigned int crc32_table[256] = {
                    -		0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
                    -		0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
                    -		0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
                    -		0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
                    -		0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
                    -		0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
                    -		0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
                    -		0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
                    -		0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
                    -		0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
                    -		0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
                    -		0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
                    -		0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
                    -		0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
                    -		0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
                    -		0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
                    -		0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
                    -		0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
                    -		0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
                    -		0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
                    -		0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
                    -		0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
                    -		0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
                    -		0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
                    -		0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
                    -		0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
                    -		0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
                    -		0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
                    -		0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
                    -		0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
                    -		0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
                    -		0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
                    -		0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
                    -		0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
                    -		0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
                    -		0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
                    -		0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
                    -		0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
                    -		0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
                    -		0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
                    -		0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
                    -		0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
                    -		0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
                    -		0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
                    -		0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
                    -		0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
                    -		0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
                    -		0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
                    -		0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
                    -		0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
                    -		0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
                    -		0x2d02ef8d
                    -	};
                    -
                    -	crc = 0xffffffff;
                    -	for (end = buf + len; buf < end; ++buf)
                    -		crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
                    -	return ~crc;
                    +	unsigned int hash = 0;
                    +
                    +	while (str[0] != '\0') {
                    +		hash += str[0] << 4;
                    +		hash += str[0] >> 4;
                    +		hash *= 11;
                    +		str++;
                    +	}
                    +	return hash;
                     }
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From dacea9ff6be55f1b115c13b1ab530812d0d66879 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 23 Apr 2009 03:24:38 +0200
                    Subject: libudev: monitor - switch to filter_add_match_subsystem_devtype()
                    
                    ---
                     udev/lib/exported_symbols  |  2 +-
                     udev/lib/libudev-monitor.c | 58 ++++++++++++++++++++++++++++++++--------------
                     udev/lib/libudev.h         |  2 +-
                     udev/lib/test-libudev.c    |  6 ++---
                     udev/udevadm-monitor.c     |  2 +-
                     5 files changed, 47 insertions(+), 23 deletions(-)
                    
                    diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols
                    index 23cd8fbe28..a700f98ac8 100644
                    --- a/udev/lib/exported_symbols
                    +++ b/udev/lib/exported_symbols
                    @@ -56,7 +56,7 @@ udev_monitor_unref
                     udev_monitor_get_udev
                     udev_monitor_get_fd
                     udev_monitor_receive_device
                    -udev_monitor_filter_add_match_subsystem
                    +udev_monitor_filter_add_match_subsystem_devtype
                     udev_queue_new
                     udev_queue_ref
                     udev_queue_unref
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index a0f93546f7..d8b375c713 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -56,11 +56,12 @@ struct udev_monitor_netlink_header {
                     	unsigned short properties_off;
                     	unsigned short properties_len;
                     	/*
                    -	 * hashes of some common device propertie strings to filter with socket filters in
                    +	 * hashes of some common device properties strings to filter with socket filters in
                     	 * the client used in the kernel from socket filter rules; needs to be stored in
                     	 * network order
                     	 */
                     	unsigned int filter_subsystem;
                    +	unsigned int filter_devtype;
                     };
                     
                     static struct udev_monitor *udev_monitor_new(struct udev *udev)
                    @@ -236,23 +237,34 @@ static int filter_apply(struct udev_monitor *udev_monitor)
                     	memset(ins, 0x00, sizeof(ins));
                     	i = 0;
                     
                    -	/* load magic in accu */
                    +	/* load magic in A */
                     	bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, magic));
                     	/* jump if magic matches */
                     	bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, UDEV_MONITOR_MAGIC, 1, 0);
                     	/* wrong magic, drop packet */
                     	bpf_stmt(ins, &i, BPF_RET|BPF_K, 0);
                     
                    -	/* load filter_subsystem value in accu */
                    -	bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem));
                     	/* add all subsystem match values */
                     	udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) {
                    -		const char *subsys = udev_list_entry_get_name(list_entry);
                     		unsigned int hash;
                     
                    -		hash = util_string_hash32(subsys);
                    -		/* jump if value does not match */
                    -		bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1);
                    +		/* load filter_subsystem value in A */
                    +		bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem));
                    +		hash = util_string_hash32(udev_list_entry_get_name(list_entry));
                    +		if (udev_list_entry_get_value(list_entry) == NULL) {
                    +			/* jump if subsystem does not match */
                    +			bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1);
                    +		} else {
                    +			/* jump if subsystem does not match */
                    +			bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3);
                    +
                    +			/* load filter_devtype value in A */
                    +			bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_devtype));
                    +			/* jump if value does not match */
                    +			hash = util_string_hash32(udev_list_entry_get_value(list_entry));
                    +			bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1);
                    +		}
                    +
                     		/* matched, pass packet */
                     		bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff);
                     
                    @@ -374,20 +386,29 @@ int udev_monitor_get_fd(struct udev_monitor *udev_monitor)
                     static int passes_filter(struct udev_monitor *udev_monitor, struct udev_device *udev_device)
                     {
                     	struct udev_list_entry *list_entry;
                    -	int pass = 0;
                     
                     	if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL)
                     		return 1;
                     
                     	udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) {
                    -		const char *subsys = udev_device_get_subsystem(udev_device);
                    +		const char *subsys = udev_list_entry_get_name(list_entry);
                    +		const char *dsubsys = udev_device_get_subsystem(udev_device);
                    +		const char *devtype;
                    +		const char *ddevtype;
                     
                    -		if (strcmp(udev_list_entry_get_name(list_entry), subsys) == 0) {
                    -			pass= 1;
                    -			break;
                    -		}
                    +		if (strcmp(dsubsys, subsys) != 0)
                    +			continue;
                    +
                    +		devtype = udev_list_entry_get_value(list_entry);
                    +		if (devtype == NULL)
                    +			return 1;
                    +		ddevtype = udev_device_get_devtype(udev_device);
                    +		if (ddevtype == NULL)
                    +			continue;
                    +		if (strcmp(ddevtype, devtype) == 0)
                    +			return 1;
                     	}
                    -	return pass;
                    +	return 0;
                     }
                     
                     /**
                    @@ -648,6 +669,9 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi
                     		nlh.magic = htonl(UDEV_MONITOR_MAGIC);
                     		val = udev_device_get_subsystem(udev_device);
                     		nlh.filter_subsystem = htonl(util_string_hash32(val));
                    +		val = udev_device_get_devtype(udev_device);
                    +		if (val != NULL)
                    +			nlh.filter_devtype = htonl(util_string_hash32(val));
                     		iov[0].iov_base = &nlh;
                     		iov[0].iov_len = sizeof(struct udev_monitor_netlink_header);
                     
                    @@ -672,14 +696,14 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi
                     	return count;
                     }
                     
                    -int udev_monitor_filter_add_match_subsystem(struct udev_monitor *udev_monitor, const char *subsystem)
                    +int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype)
                     {
                     	if (udev_monitor == NULL)
                     		return -EINVAL;
                     	if (subsystem == NULL)
                     		return 0;
                     	if (udev_list_entry_add(udev_monitor->udev,
                    -				&udev_monitor->filter_subsystem_list, subsystem, NULL, 1, 0) == NULL)
                    +				&udev_monitor->filter_subsystem_list, subsystem, devtype, 0, 0) == NULL)
                     		return -ENOMEM;
                     	return 0;
                     }
                    diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h
                    index 4094b3a822..e366d76877 100644
                    --- a/udev/lib/libudev.h
                    +++ b/udev/lib/libudev.h
                    @@ -84,7 +84,7 @@ extern void udev_monitor_unref(struct udev_monitor *udev_monitor);
                     extern struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
                     extern int udev_monitor_get_fd(struct udev_monitor *udev_monitor);
                     extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor);
                    -extern int udev_monitor_filter_add_match_subsystem(struct udev_monitor *udev_monitor, const char *subsystem);
                    +extern int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype);
                     
                     /* sys enumeration */
                     struct udev_enumerate;
                    diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c
                    index be25d61121..db08d4845f 100644
                    --- a/udev/lib/test-libudev.c
                    +++ b/udev/lib/test-libudev.c
                    @@ -228,9 +228,9 @@ static int test_monitor(struct udev *udev)
                     		printf("no socket\n");
                     		return -1;
                     	}
                    -	if (udev_monitor_filter_add_match_subsystem(udev_monitor, "block") < 0 ||
                    -	    udev_monitor_filter_add_match_subsystem(udev_monitor, "tty") < 0 ||
                    -	    udev_monitor_filter_add_match_subsystem(udev_monitor, "usb") < 0) {
                    +	if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "block", NULL) < 0 ||
                    +	    udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL) < 0 ||
                    +	    udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device") < 0) {
                     		printf("filter failed\n");
                     		return -1;
                     	}
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index 92215b671b..10b2f2e71b 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -143,7 +143,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     		udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) {
                     			const char *subsys = udev_list_entry_get_name(entry);
                     
                    -			if (udev_monitor_filter_add_match_subsystem(udev_monitor, subsys) < 0)
                    +			if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, subsys, NULL) < 0)
                     				fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys);
                     		}
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From e93c38c3a2daaa2a8fedac59037f43a0403fdd03 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 23 Apr 2009 03:33:58 +0200
                    Subject: libudev: monitor - do not filter messages with wrong magic
                    
                    ---
                     udev/lib/libudev-monitor.c | 4 ++--
                     1 file changed, 2 insertions(+), 2 deletions(-)
                    
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index d8b375c713..211aa12f62 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -241,8 +241,8 @@ static int filter_apply(struct udev_monitor *udev_monitor)
                     	bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, magic));
                     	/* jump if magic matches */
                     	bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, UDEV_MONITOR_MAGIC, 1, 0);
                    -	/* wrong magic, drop packet */
                    -	bpf_stmt(ins, &i, BPF_RET|BPF_K, 0);
                    +	/* wrong magic, pass packet */
                    +	bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff);
                     
                     	/* add all subsystem match values */
                     	udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) {
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From bb7045a0a372abc3638e027e9d8c4b05b79c9f67 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 23 Apr 2009 04:07:15 +0200
                    Subject: udevadm: monitor - add : support
                    
                    ---
                     udev/udevadm-monitor.c | 36 ++++++++++++++++++++++++++++++------
                     1 file changed, 30 insertions(+), 6 deletions(-)
                    
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index 10b2f2e71b..7e8186f798 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -103,13 +103,26 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     			print_udev = 1;
                     			break;
                     		case 's':
                    -			udev_list_entry_add(udev, &subsystem_match_list, optarg, NULL, 1, 0);
                    -			break;
                    +			{
                    +				char subsys[UTIL_NAME_SIZE];
                    +				char *devtype;
                    +
                    +				util_strlcpy(subsys, optarg, sizeof(subsys));
                    +				devtype = strchr(subsys, ':');
                    +				if (devtype != NULL) {
                    +					devtype[0] = '\0';
                    +					devtype++;
                    +				}
                    +printf("add '%s' '%s')\n", subsys, devtype);
                    +				udev_list_entry_add(udev, &subsystem_match_list, subsys, devtype, 0, 0);
                    +				break;
                    +			}
                     		case 'h':
                     			printf("Usage: udevadm monitor [--environment] [--kernel] [--udev] [--help]\n"
                    -			       "  --env    print the whole event environment\n"
                    -			       "  --kernel print kernel uevents\n"
                    -			       "  --udev   print udev events\n"
                    +			       "  --env                         print the whole event environment\n"
                    +			       "  --kernel                      print kernel uevents\n"
                    +			       "  --udev                        print udev events\n"
                    +			       "  --subsystem-match= filter events\n"
                     			       "  --help\n\n");
                     		default:
                     			goto out;
                    @@ -142,8 +155,9 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     
                     		udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) {
                     			const char *subsys = udev_list_entry_get_name(entry);
                    +			const char *devtype = udev_list_entry_get_value(entry);
                     
                    -			if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, subsys, NULL) < 0)
                    +			if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, subsys, devtype) < 0)
                     				fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys);
                     		}
                     
                    @@ -155,12 +169,22 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     		printf("UDEV - the event which udev sends out after rule processing\n");
                     	}
                     	if (print_kernel) {
                    +		struct udev_list_entry *entry;
                    +
                     		kernel_monitor = udev_monitor_new_from_netlink(udev, "kernel");
                     		if (kernel_monitor == NULL) {
                     			fprintf(stderr, "error: unable to create netlink socket\n");
                     			rc = 3;
                     			goto out;
                     		}
                    +
                    +		udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) {
                    +			const char *subsys = udev_list_entry_get_name(entry);
                    +
                    +			if (udev_monitor_filter_add_match_subsystem_devtype(kernel_monitor, subsys, NULL) < 0)
                    +				fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys);
                    +		}
                    +
                     		if (udev_monitor_enable_receiving(kernel_monitor) < 0) {
                     			fprintf(stderr, "error: unable to subscribe to kernel events\n");
                     			rc = 4;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 08a7a795f61eaf42f31b26e435067a664f0a4d4d Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 23 Apr 2009 04:07:51 +0200
                    Subject: libudev: monitor - add udev_monitor_filter_remove
                    
                    ---
                     udev/lib/exported_symbols  | 1 +
                     udev/lib/libudev-monitor.c | 8 ++++++++
                     udev/lib/libudev.h         | 1 +
                     3 files changed, 10 insertions(+)
                    
                    diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols
                    index a700f98ac8..5b0d8fd011 100644
                    --- a/udev/lib/exported_symbols
                    +++ b/udev/lib/exported_symbols
                    @@ -57,6 +57,7 @@ udev_monitor_get_udev
                     udev_monitor_get_fd
                     udev_monitor_receive_device
                     udev_monitor_filter_add_match_subsystem_devtype
                    +udev_monitor_filter_remove
                     udev_queue_new
                     udev_queue_ref
                     udev_queue_unref
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index 211aa12f62..bf95657da2 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -707,3 +707,11 @@ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_mo
                     		return -ENOMEM;
                     	return 0;
                     }
                    +
                    +int udev_monitor_filter_remove(struct udev_monitor *udev_monitor)
                    +{
                    +	static struct sock_fprog filter = { 0, NULL };
                    +
                    +	udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list);
                    +	return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter));
                    +}
                    diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h
                    index e366d76877..0b52e6e775 100644
                    --- a/udev/lib/libudev.h
                    +++ b/udev/lib/libudev.h
                    @@ -85,6 +85,7 @@ extern struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
                     extern int udev_monitor_get_fd(struct udev_monitor *udev_monitor);
                     extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor);
                     extern int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype);
                    +extern int udev_monitor_filter_remove(struct udev_monitor *udev_monitor);
                     
                     /* sys enumeration */
                     struct udev_enumerate;
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 8c3ae78546a535cc9288a190680fb1eb88c6ea7e Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 23 Apr 2009 13:23:45 +0200
                    Subject: libudev: queue - fix get_seqnum_is_finished()
                    
                    On Thu, Apr 23, 2009 at 11:39, Alan Jenkins  wrote:
                    > I'm puzzled by this function:
                    >
                    >        /* if we have not seen this seqnum, check if it is/was already queued */
                    >        if (seqnum < udev_queue->last_seen_udev_seqnum) {
                    >                udev_queue_get_udev_seqnum(udev_queue);
                    >                if (seqnum < udev_queue->last_seen_udev_seqnum)
                    >
                    > Shouldn't the test be (seqnum > udev_queue->last_seen_udev_seqnum) ?
                    ---
                     udev/lib/libudev-queue.c | 7 +++----
                     1 file changed, 3 insertions(+), 4 deletions(-)
                    
                    diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c
                    index a0f4c5575c..7550d96370 100644
                    --- a/udev/lib/libudev-queue.c
                    +++ b/udev/lib/libudev-queue.c
                    @@ -179,11 +179,10 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo
                     	if (udev_queue == NULL)
                     		return -EINVAL;
                     	/* if we have not seen this seqnum, check if it is/was already queued */
                    -	if (seqnum < udev_queue->last_seen_udev_seqnum) {
                    -		udev_queue_get_udev_seqnum(udev_queue);
                    -		if (seqnum < udev_queue->last_seen_udev_seqnum)
                    +	if (seqnum > udev_queue->last_seen_udev_seqnum)
                    +		if (seqnum > udev_queue_get_udev_seqnum(udev_queue))
                     			return 0;
                    -	}
                    +
                     	snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu",
                     		 udev_get_dev_path(udev_queue->udev), seqnum);
                     	if (lstat(filename, &statbuf) == 0)
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From d6f0b22d574c6a5e5f3430be3fc619d4b2f46cd5 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 23 Apr 2009 15:04:16 +0200
                    Subject: cdrom_id: skip media tests if CDROM_DRIVE_STATUS != CDS_DISC_OK
                    
                    ---
                     extras/cdrom_id/cdrom_id.c | 16 +++++++++++++++-
                     1 file changed, 15 insertions(+), 1 deletion(-)
                    
                    diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c
                    index 371d6a2dbd..0d873ae8e5 100644
                    --- a/extras/cdrom_id/cdrom_id.c
                    +++ b/extras/cdrom_id/cdrom_id.c
                    @@ -197,6 +197,16 @@ static int cd_capability_compat(struct udev *udev, int fd)
                     	return 0;
                     }
                     
                    +static int cd_media_compat(struct udev *udev, int fd)
                    +{
                    +	if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) {
                    +		info(udev, "CDROM_DRIVE_STATUS != CDS_DISC_OK\n");
                    +		return -1;
                    +	}
                    +	cd_media = 1;
                    +	return 0;
                    +}
                    +
                     static int cd_inquiry(struct udev *udev, int fd) {
                     	struct scsi_cmd sc;
                     	unsigned char inq[128];
                    @@ -569,7 +579,11 @@ int main(int argc, char *argv[])
                     		goto exit;
                     	}
                     
                    -	/* check drive */
                    +	/* check for media */
                    +	if (cd_media_compat(udev, fd) < 0)
                    +		goto print;
                    +
                    +	/* check if drive talks MMC */
                     	if (cd_inquiry(udev, fd) < 0)
                     		goto print;
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 34f55e1dc7f0381229d11c4295a7289ce132d55f Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 23 Apr 2009 15:16:26 +0200
                    Subject: libudev: queue - clarify comments
                    
                    ---
                     udev/lib/libudev-queue.c | 4 ++--
                     1 file changed, 2 insertions(+), 2 deletions(-)
                    
                    diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c
                    index 7550d96370..5cd5ef75c9 100644
                    --- a/udev/lib/libudev-queue.c
                    +++ b/udev/lib/libudev-queue.c
                    @@ -178,11 +178,11 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo
                     
                     	if (udev_queue == NULL)
                     		return -EINVAL;
                    -	/* if we have not seen this seqnum, check if it is/was already queued */
                    +	/* did it reach the queue? */
                     	if (seqnum > udev_queue->last_seen_udev_seqnum)
                     		if (seqnum > udev_queue_get_udev_seqnum(udev_queue))
                     			return 0;
                    -
                    +	/* is it still in the queue? */
                     	snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu",
                     		 udev_get_dev_path(udev_queue->udev), seqnum);
                     	if (lstat(filename, &statbuf) == 0)
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 19d7e87cc0ef364fb13a18411cb165b2427b3529 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 23 Apr 2009 18:05:10 +0200
                    Subject: libudev: monitor - export filter_update()
                    
                    ---
                     udev/lib/exported_symbols  | 1 +
                     udev/lib/libudev-monitor.c | 4 ++--
                     udev/lib/libudev.h         | 1 +
                     3 files changed, 4 insertions(+), 2 deletions(-)
                    
                    diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols
                    index 5b0d8fd011..24a6595462 100644
                    --- a/udev/lib/exported_symbols
                    +++ b/udev/lib/exported_symbols
                    @@ -57,6 +57,7 @@ udev_monitor_get_udev
                     udev_monitor_get_fd
                     udev_monitor_receive_device
                     udev_monitor_filter_add_match_subsystem_devtype
                    +udev_monitor_filter_update
                     udev_monitor_filter_remove
                     udev_queue_new
                     udev_queue_ref
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index bf95657da2..c87ff7434f 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -223,7 +223,7 @@ static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i,
                     	(*i)++;
                     }
                     
                    -static int filter_apply(struct udev_monitor *udev_monitor)
                    +int udev_monitor_filter_update(struct udev_monitor *udev_monitor)
                     {
                     	static struct sock_filter ins[256];
                     	static struct sock_fprog filter;
                    @@ -290,7 +290,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor)
                     		err = bind(udev_monitor->sock,
                     			   (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen);
                     	} else if (udev_monitor->snl.nl_family != 0) {
                    -		filter_apply(udev_monitor);
                    +		udev_monitor_filter_update(udev_monitor);
                     		err = bind(udev_monitor->sock,
                     			   (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl));
                     	} else {
                    diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h
                    index 0b52e6e775..236e43bc3c 100644
                    --- a/udev/lib/libudev.h
                    +++ b/udev/lib/libudev.h
                    @@ -85,6 +85,7 @@ extern struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
                     extern int udev_monitor_get_fd(struct udev_monitor *udev_monitor);
                     extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor);
                     extern int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype);
                    +extern int udev_monitor_filter_update(struct udev_monitor *udev_monitor);
                     extern int udev_monitor_filter_remove(struct udev_monitor *udev_monitor);
                     
                     /* sys enumeration */
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 57ec3a57f1caa0e325e5ac8a7f54761148b36b1b Mon Sep 17 00:00:00 2001
                    From: Andre Przywara 
                    Date: Fri, 24 Apr 2009 00:29:53 +0200
                    Subject: rules: create /dev/cpu//cpuid world readable
                    
                    I don't see any security implications, to be actually useful,
                    /dev/cpu//cpuid should be world readable. The cpuid instruction
                    can be called from userspace anyway, so there is nothing to hide.
                    The device does not support any write operation, so 0444 should
                    suffice.
                    
                    Signed-off-by: Andre Przywara 
                    ---
                     rules/rules.d/50-udev-default.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
                    index abc5113cfc..6bf45cce9b 100644
                    --- a/rules/rules.d/50-udev-default.rules
                    +++ b/rules/rules.d/50-udev-default.rules
                    @@ -94,7 +94,7 @@ SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440"
                     KERNEL=="tun",			NAME="net/%k", MODE="0666"
                     
                     # CPU
                    -KERNEL=="cpu[0-9]*",		NAME="cpu/%n/cpuid"
                    +KERNEL=="cpu[0-9]*",		NAME="cpu/%n/cpuid", MODE="0444"
                     KERNEL=="msr[0-9]*",		NAME="cpu/%n/msr"
                     KERNEL=="microcode",		NAME="cpu/microcode", MODE="0600"
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From aa1aa46f95093df2d3f529a7ee7e3eecae9b81fe Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Fri, 24 Apr 2009 02:27:44 +0200
                    Subject: update NEWS
                    
                    ---
                     NEWS                   | 14 ++++++++++++++
                     udev/udevadm-monitor.c |  1 -
                     2 files changed, 14 insertions(+), 1 deletion(-)
                    
                    diff --git a/NEWS b/NEWS
                    index 4629e1ec01..8eb5fc8e24 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -2,6 +2,20 @@ udev 142
                     ========
                     Bugfixes.
                     
                    +The udev daemon will now create /dev/null, /dev/console, /dev/kmsg at
                    +startup, if they don't exist already.
                    +
                    +Libudev allows to subscribe to udev events. To prevent unwanted messages
                    +to be delivered, and waking up the subscribing process, a filter can be
                    +installed, to drop messages inside a kernel socket filter. The filters
                    +match on the : properties of the device.
                    +    This is part of the ongoing effort to replace HAL, and switch current
                    +users over to directly use libudev, or for higher-level services use the
                    +specialized D-Bus interface of a DeviceKit service.
                    +    Libudev is still marked as experimental, and its interface might
                    +change if needed, but no major changes of the currently exported interface
                    +are expected anymore, and a first stable release should happen soon.
                    +
                     A too old kernel (2.6.21) or a kernel with CONFIG_SYSFS_DEPRECATED
                     is not supported since while and udevd will log an error message at
                     startup.
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index 7e8186f798..27520f7061 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -113,7 +113,6 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     					devtype[0] = '\0';
                     					devtype++;
                     				}
                    -printf("add '%s' '%s')\n", subsys, devtype);
                     				udev_list_entry_add(udev, &subsystem_match_list, subsys, devtype, 0, 0);
                     				break;
                     			}
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 37ed4f5619d48ad8288613aca48639b8492cf1ad Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sun, 26 Apr 2009 13:59:39 +0200
                    Subject: drop "extern" keyword from non-static function
                    
                    ---
                     udev/lib/libudev-list.c    |   4 +-
                     udev/lib/libudev-private.h | 196 ++++++++++++++++++++++-----------------------
                     udev/lib/libudev-queue.c   |   6 +-
                     udev/lib/libudev.h         | 144 ++++++++++++++++-----------------
                     udev/udev-node.c           |   2 +-
                     udev/udev-util.c           |   2 +-
                     udev/udev.h                |  86 ++++++++++----------
                     7 files changed, 220 insertions(+), 220 deletions(-)
                    
                    diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c
                    index 0c13b6d927..182d75aa8a 100644
                    --- a/udev/lib/libudev-list.c
                    +++ b/udev/lib/libudev-list.c
                    @@ -220,14 +220,14 @@ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry)
                     	return list_entry->value;
                     }
                     
                    -extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry)
                    +int udev_list_entry_get_flag(struct udev_list_entry *list_entry)
                     {
                     	if (list_entry == NULL)
                     		return -EINVAL;
                     	return list_entry->flag;
                     }
                     
                    -extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag)
                    +void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag)
                     {
                     	if (list_entry == NULL)
                     		return;
                    diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
                    index 0756efea81..b283ff4ac3 100644
                    --- a/udev/lib/libudev-private.h
                    +++ b/udev/lib/libudev-private.h
                    @@ -39,92 +39,92 @@ void udev_log(struct udev *udev,
                     	      int priority, const char *file, int line, const char *fn,
                     	      const char *format, ...)
                     	      __attribute__ ((format(printf, 6, 7)));
                    -extern struct udev_device *device_new(struct udev *udev);
                    -extern const char *udev_get_rules_path(struct udev *udev);
                    -extern int udev_get_run(struct udev *udev);
                    -extern struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value);
                    -extern struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev);
                    +struct udev_device *device_new(struct udev *udev);
                    +const char *udev_get_rules_path(struct udev *udev);
                    +int udev_get_run(struct udev *udev);
                    +struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value);
                    +struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev);
                     
                     /* libudev-device */
                    -extern int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
                    -extern int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem);
                    -extern int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype);
                    -extern int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode);
                    -extern int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink);
                    -extern void udev_device_cleanup_devlinks_list(struct udev_device *udev_device);
                    -extern struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value);
                    -extern struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property);
                    -extern char **udev_device_get_properties_envp(struct udev_device *udev_device);
                    -extern ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf);
                    -extern int udev_device_read_db(struct udev_device *udev_device);
                    -extern int udev_device_read_uevent_file(struct udev_device *udev_device);
                    -extern int udev_device_set_action(struct udev_device *udev_device, const char *action);
                    -extern int udev_device_set_driver(struct udev_device *udev_device, const char *driver);
                    -extern const char *udev_device_get_devpath_old(struct udev_device *udev_device);
                    -extern int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old);
                    -extern const char *udev_device_get_physdevpath(struct udev_device *udev_device);
                    -extern int udev_device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath);
                    -extern int udev_device_get_timeout(struct udev_device *udev_device);
                    -extern int udev_device_set_timeout(struct udev_device *udev_device, int timeout);
                    -extern int udev_device_get_event_timeout(struct udev_device *udev_device);
                    -extern int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout);
                    -extern int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum);
                    -extern int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum);
                    -extern int udev_device_get_num_fake_partitions(struct udev_device *udev_device);
                    -extern int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num);
                    -extern int udev_device_get_devlink_priority(struct udev_device *udev_device);
                    -extern int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio);
                    -extern int udev_device_get_ignore_remove(struct udev_device *udev_device);
                    -extern int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore);
                    -extern int udev_device_get_watch_handle(struct udev_device *udev_device);
                    -extern int udev_device_set_watch_handle(struct udev_device *udev_device, int handle);
                    -extern void udev_device_set_info_loaded(struct udev_device *device);
                    +int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
                    +int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem);
                    +int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype);
                    +int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode);
                    +int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink);
                    +void udev_device_cleanup_devlinks_list(struct udev_device *udev_device);
                    +struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value);
                    +struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property);
                    +char **udev_device_get_properties_envp(struct udev_device *udev_device);
                    +ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf);
                    +int udev_device_read_db(struct udev_device *udev_device);
                    +int udev_device_read_uevent_file(struct udev_device *udev_device);
                    +int udev_device_set_action(struct udev_device *udev_device, const char *action);
                    +int udev_device_set_driver(struct udev_device *udev_device, const char *driver);
                    +const char *udev_device_get_devpath_old(struct udev_device *udev_device);
                    +int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old);
                    +const char *udev_device_get_physdevpath(struct udev_device *udev_device);
                    +int udev_device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath);
                    +int udev_device_get_timeout(struct udev_device *udev_device);
                    +int udev_device_set_timeout(struct udev_device *udev_device, int timeout);
                    +int udev_device_get_event_timeout(struct udev_device *udev_device);
                    +int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout);
                    +int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum);
                    +int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum);
                    +int udev_device_get_num_fake_partitions(struct udev_device *udev_device);
                    +int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num);
                    +int udev_device_get_devlink_priority(struct udev_device *udev_device);
                    +int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio);
                    +int udev_device_get_ignore_remove(struct udev_device *udev_device);
                    +int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore);
                    +int udev_device_get_watch_handle(struct udev_device *udev_device);
                    +int udev_device_set_watch_handle(struct udev_device *udev_device, int handle);
                    +void udev_device_set_info_loaded(struct udev_device *device);
                     
                     /* libudev-device-db-write.c */
                    -extern int udev_device_update_db(struct udev_device *udev_device);
                    -extern int udev_device_delete_db(struct udev_device *udev_device);
                    -extern int udev_device_rename_db(struct udev_device *udev_device, const char *devpath);
                    +int udev_device_update_db(struct udev_device *udev_device);
                    +int udev_device_delete_db(struct udev_device *udev_device);
                    +int udev_device_rename_db(struct udev_device *udev_device, const char *devpath);
                     
                     /* libudev-monitor - netlink/unix socket communication  */
                    -extern int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device);
                    -extern int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size);
                    +int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device);
                    +int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size);
                     
                     /* libudev-ctrl - daemon runtime setup */
                     struct udev_ctrl;
                    -extern struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path);
                    -extern int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl);
                    -extern struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl);
                    -extern void udev_ctrl_unref(struct udev_ctrl *uctrl);
                    -extern struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl);
                    -extern int udev_ctrl_get_fd(struct udev_ctrl *uctrl);
                    -extern int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority);
                    -extern int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl);
                    -extern int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl);
                    -extern int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl);
                    -extern int udev_ctrl_send_settle(struct udev_ctrl *uctrl);
                    -extern int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key);
                    -extern int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count);
                    +struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path);
                    +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl);
                    +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl);
                    +void udev_ctrl_unref(struct udev_ctrl *uctrl);
                    +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl);
                    +int udev_ctrl_get_fd(struct udev_ctrl *uctrl);
                    +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority);
                    +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl);
                    +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl);
                    +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl);
                    +int udev_ctrl_send_settle(struct udev_ctrl *uctrl);
                    +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key);
                    +int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count);
                     struct udev_ctrl_msg;
                    -extern struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl);
                    -extern struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl);
                    -extern struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg);
                    -extern void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg);
                    -extern int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg);
                    -extern int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg);
                    -extern int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg);
                    -extern int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg);
                    -extern pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg);
                    -extern const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg);
                    -extern int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg);
                    +struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl);
                    +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl);
                    +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg);
                    +void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg);
                    +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg);
                    +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg);
                    +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg);
                    +int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg);
                    +pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg);
                    +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg);
                    +int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg);
                     
                     /* libudev-list */
                     struct udev_list_node {
                     	struct udev_list_node *next, *prev;
                     };
                    -extern void udev_list_init(struct udev_list_node *list);
                    -extern int udev_list_is_empty(struct udev_list_node *list);
                    -extern void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list);
                    -extern void udev_list_node_remove(struct udev_list_node *entry);
                    +void udev_list_init(struct udev_list_node *list);
                    +int udev_list_is_empty(struct udev_list_node *list);
                    +void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list);
                    +void udev_list_node_remove(struct udev_list_node *entry);
                     #define udev_list_node_foreach(node, list) \
                     	for (node = (list)->next; \
                     	     node != list; \
                    @@ -133,45 +133,45 @@ extern void udev_list_node_remove(struct udev_list_node *entry);
                     	for (node = (list)->next, tmp = (node)->next; \
                     	     node != list; \
                     	     node = tmp, tmp = (tmp)->next)
                    -extern struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list,
                    +struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list,
                     						   const char *name, const char *value,
                     						   int unique, int sort);
                    -extern void udev_list_entry_delete(struct udev_list_entry *entry);
                    -extern void udev_list_entry_remove(struct udev_list_entry *entry);
                    -extern void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry);
                    -extern void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list);
                    -extern void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list);
                    -extern struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list);
                    -extern int udev_list_entry_get_flag(struct udev_list_entry *list_entry);
                    -extern void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag);
                    +void udev_list_entry_delete(struct udev_list_entry *entry);
                    +void udev_list_entry_remove(struct udev_list_entry *entry);
                    +void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry);
                    +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list);
                    +void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list);
                    +struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list);
                    +int udev_list_entry_get_flag(struct udev_list_entry *list_entry);
                    +void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag);
                     #define udev_list_entry_foreach_safe(entry, tmp, first) \
                     	for (entry = first, tmp = udev_list_entry_get_next(entry); \
                     	     entry != NULL; \
                     	     entry = tmp, tmp = udev_list_entry_get_next(tmp))
                     
                     /* libudev-queue */
                    -extern int udev_queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum);
                    -extern int udev_queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device);
                    -extern int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device);
                    -extern int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device);
                    +int udev_queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum);
                    +int udev_queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device);
                    +int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device);
                    +int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device);
                     
                     /* libudev-utils */
                     #define UTIL_PATH_SIZE				1024
                     #define UTIL_LINE_SIZE				2048
                     #define UTIL_NAME_SIZE				512
                     #define UDEV_ALLOWED_CHARS_INPUT		"/ $%?,"
                    -extern ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size);
                    -extern ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size);
                    -extern int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size);
                    -extern int util_log_priority(const char *priority);
                    -extern size_t util_path_encode(char *s, size_t len);
                    -extern size_t util_path_decode(char *s);
                    -extern void util_remove_trailing_chars(char *path, char c);
                    -extern size_t util_strlcpy(char *dst, const char *src, size_t size);
                    -extern size_t util_strlcat(char *dst, const char *src, size_t size);
                    -extern int udev_util_replace_whitespace(const char *str, char *to, size_t len);
                    -extern int udev_util_replace_chars(char *str, const char *white);
                    -extern int udev_util_encode_string(const char *str, char *str_enc, size_t len);
                    -extern void util_set_fd_cloexec(int fd);
                    -extern unsigned int util_string_hash32(const char *str);
                    +ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size);
                    +ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size);
                    +int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size);
                    +int util_log_priority(const char *priority);
                    +size_t util_path_encode(char *s, size_t len);
                    +size_t util_path_decode(char *s);
                    +void util_remove_trailing_chars(char *path, char c);
                    +size_t util_strlcpy(char *dst, const char *src, size_t size);
                    +size_t util_strlcat(char *dst, const char *src, size_t size);
                    +int udev_util_replace_whitespace(const char *str, char *to, size_t len);
                    +int udev_util_replace_chars(char *str, const char *white);
                    +int udev_util_encode_string(const char *str, char *str_enc, size_t len);
                    +void util_set_fd_cloexec(int fd);
                    +unsigned int util_string_hash32(const char *str);
                     #endif
                    diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c
                    index 5cd5ef75c9..63229fd8fe 100644
                    --- a/udev/lib/libudev-queue.c
                    +++ b/udev/lib/libudev-queue.c
                    @@ -277,17 +277,17 @@ int udev_queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long l
                     	return -1;
                     }
                     
                    -extern int udev_queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device)
                    +int udev_queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device)
                     {
                     	return -1;
                     }
                     
                    -extern int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device)
                    +int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device)
                     {
                     	return -1;
                     }
                     
                    -extern int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device)
                    +int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device)
                     {
                     	return -1;
                     }
                    diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h
                    index 236e43bc3c..9346eb4ddd 100644
                    --- a/udev/lib/libudev.h
                    +++ b/udev/lib/libudev.h
                    @@ -23,26 +23,26 @@
                     
                     /* library context */
                     struct udev;
                    -extern struct udev *udev_new(void);
                    -extern struct udev *udev_ref(struct udev *udev);
                    -extern void udev_unref(struct udev *udev);
                    -extern void udev_set_log_fn(struct udev *udev,
                    +struct udev *udev_new(void);
                    +struct udev *udev_ref(struct udev *udev);
                    +void udev_unref(struct udev *udev);
                    +void udev_set_log_fn(struct udev *udev,
                     			    void (*log_fn)(struct udev *udev,
                     					   int priority, const char *file, int line, const char *fn,
                     					   const char *format, va_list args));
                    -extern int udev_get_log_priority(struct udev *udev);
                    -extern void udev_set_log_priority(struct udev *udev, int priority);
                    -extern const char *udev_get_sys_path(struct udev *udev);
                    -extern const char *udev_get_dev_path(struct udev *udev);
                    -extern void *udev_get_userdata(struct udev *udev);
                    -extern void udev_set_userdata(struct udev *udev, void *userdata);
                    +int udev_get_log_priority(struct udev *udev);
                    +void udev_set_log_priority(struct udev *udev, int priority);
                    +const char *udev_get_sys_path(struct udev *udev);
                    +const char *udev_get_dev_path(struct udev *udev);
                    +void *udev_get_userdata(struct udev *udev);
                    +void udev_set_userdata(struct udev *udev, void *userdata);
                     
                     /* list iteration */
                     struct udev_list_entry;
                    -extern struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry);
                    -extern struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name);
                    -extern const char *udev_list_entry_get_name(struct udev_list_entry *list_entry);
                    -extern const char *udev_list_entry_get_value(struct udev_list_entry *list_entry);
                    +struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry);
                    +struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name);
                    +const char *udev_list_entry_get_name(struct udev_list_entry *list_entry);
                    +const char *udev_list_entry_get_value(struct udev_list_entry *list_entry);
                     #define udev_list_entry_foreach(entry, first) \
                     	for (entry = first; \
                     	     entry != NULL; \
                    @@ -50,71 +50,71 @@ extern const char *udev_list_entry_get_value(struct udev_list_entry *list_entry)
                     
                     /* sys devices */
                     struct udev_device;
                    -extern struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath);
                    -extern struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum);
                    -extern struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname);
                    -extern struct udev_device *udev_device_get_parent(struct udev_device *udev_device);
                    -extern struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype);
                    -extern struct udev_device *udev_device_ref(struct udev_device *udev_device);
                    -extern void udev_device_unref(struct udev_device *udev_device);
                    -extern struct udev *udev_device_get_udev(struct udev_device *udev_device);
                    -extern const char *udev_device_get_devpath(struct udev_device *udev_device);
                    -extern const char *udev_device_get_subsystem(struct udev_device *udev_device);
                    -extern const char *udev_device_get_devtype(struct udev_device *udev_device);
                    -extern const char *udev_device_get_syspath(struct udev_device *udev_device);
                    -extern const char *udev_device_get_sysname(struct udev_device *udev_device);
                    -extern const char *udev_device_get_sysnum(struct udev_device *udev_device);
                    -extern const char *udev_device_get_devnode(struct udev_device *udev_device);
                    -extern struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
                    -extern struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
                    -extern const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
                    -extern const char *udev_device_get_driver(struct udev_device *udev_device);
                    -extern dev_t udev_device_get_devnum(struct udev_device *udev_device);
                    -extern const char *udev_device_get_action(struct udev_device *udev_device);
                    -extern unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device);
                    -extern const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
                    +struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath);
                    +struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum);
                    +struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname);
                    +struct udev_device *udev_device_get_parent(struct udev_device *udev_device);
                    +struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype);
                    +struct udev_device *udev_device_ref(struct udev_device *udev_device);
                    +void udev_device_unref(struct udev_device *udev_device);
                    +struct udev *udev_device_get_udev(struct udev_device *udev_device);
                    +const char *udev_device_get_devpath(struct udev_device *udev_device);
                    +const char *udev_device_get_subsystem(struct udev_device *udev_device);
                    +const char *udev_device_get_devtype(struct udev_device *udev_device);
                    +const char *udev_device_get_syspath(struct udev_device *udev_device);
                    +const char *udev_device_get_sysname(struct udev_device *udev_device);
                    +const char *udev_device_get_sysnum(struct udev_device *udev_device);
                    +const char *udev_device_get_devnode(struct udev_device *udev_device);
                    +struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device);
                    +struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device);
                    +const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key);
                    +const char *udev_device_get_driver(struct udev_device *udev_device);
                    +dev_t udev_device_get_devnum(struct udev_device *udev_device);
                    +const char *udev_device_get_action(struct udev_device *udev_device);
                    +unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device);
                    +const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr);
                     
                     /* udev and kernel device events */
                     struct udev_monitor;
                    -extern struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path);
                    -extern struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name);
                    -extern int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);
                    -extern struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor);
                    -extern void udev_monitor_unref(struct udev_monitor *udev_monitor);
                    -extern struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
                    -extern int udev_monitor_get_fd(struct udev_monitor *udev_monitor);
                    -extern struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor);
                    -extern int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype);
                    -extern int udev_monitor_filter_update(struct udev_monitor *udev_monitor);
                    -extern int udev_monitor_filter_remove(struct udev_monitor *udev_monitor);
                    +struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path);
                    +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name);
                    +int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor);
                    +struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor);
                    +void udev_monitor_unref(struct udev_monitor *udev_monitor);
                    +struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor);
                    +int udev_monitor_get_fd(struct udev_monitor *udev_monitor);
                    +struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor);
                    +int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype);
                    +int udev_monitor_filter_update(struct udev_monitor *udev_monitor);
                    +int udev_monitor_filter_remove(struct udev_monitor *udev_monitor);
                     
                     /* sys enumeration */
                     struct udev_enumerate;
                    -extern struct udev_enumerate *udev_enumerate_new(struct udev *udev);
                    -extern struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate);
                    -extern void udev_enumerate_unref(struct udev_enumerate *udev_enumerate);
                    -extern struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate);
                    -extern int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
                    -extern int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
                    -extern int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
                    -extern int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
                    -extern int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
                    -extern int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath);
                    -extern int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate);
                    -extern int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate);
                    -extern struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate);
                    +struct udev_enumerate *udev_enumerate_new(struct udev *udev);
                    +struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate);
                    +void udev_enumerate_unref(struct udev_enumerate *udev_enumerate);
                    +struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate);
                    +int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
                    +int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem);
                    +int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
                    +int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value);
                    +int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value);
                    +int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath);
                    +int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate);
                    +int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate);
                    +struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate);
                     
                     /* event queue */
                     struct udev_queue;
                    -extern struct udev_queue *udev_queue_new(struct udev *udev);
                    -extern struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue);
                    -extern void udev_queue_unref(struct udev_queue *udev_queue);
                    -extern struct udev *udev_queue_get_udev(struct udev_queue *udev_queue);
                    -extern unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue);
                    -extern unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue);
                    -extern int udev_queue_get_udev_is_active(struct udev_queue *udev_queue);
                    -extern int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue);
                    -extern int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum);
                    -extern struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue);
                    -extern struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue);
                    +struct udev_queue *udev_queue_new(struct udev *udev);
                    +struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue);
                    +void udev_queue_unref(struct udev_queue *udev_queue);
                    +struct udev *udev_queue_get_udev(struct udev_queue *udev_queue);
                    +unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue);
                    +unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue);
                    +int udev_queue_get_udev_is_active(struct udev_queue *udev_queue);
                    +int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue);
                    +int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum);
                    +struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue);
                    +struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue);
                     #endif
                    diff --git a/udev/udev-node.c b/udev/udev-node.c
                    index 965017240c..322e0b88de 100644
                    --- a/udev/udev-node.c
                    +++ b/udev/udev-node.c
                    @@ -462,7 +462,7 @@ exit:
                     	return err;
                     }
                     
                    -extern int udev_node_remove(struct udev_device *dev)
                    +int udev_node_remove(struct udev_device *dev)
                     {
                     	struct udev *udev = udev_device_get_udev(dev);
                     	struct udev_list_entry *list_entry;
                    diff --git a/udev/udev-util.c b/udev/udev-util.c
                    index 3d5eb7657c..d5eaef70c1 100644
                    --- a/udev/udev-util.c
                    +++ b/udev/udev-util.c
                    @@ -150,7 +150,7 @@ uid_t util_lookup_user(struct udev *udev, const char *user)
                     	return 0;
                     }
                     
                    -extern gid_t util_lookup_group(struct udev *udev, const char *group)
                    +gid_t util_lookup_group(struct udev *udev, const char *group)
                     {
                     	char *endptr;
                     	int buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
                    diff --git a/udev/udev.h b/udev/udev.h
                    index d5fa4f3edc..478a51f3dc 100644
                    --- a/udev/udev.h
                    +++ b/udev/udev.h
                    @@ -87,64 +87,64 @@ struct udev_watch {
                     
                     /* udev-rules.c */
                     struct udev_rules;
                    -extern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names);
                    -extern void udev_rules_unref(struct udev_rules *rules);
                    -extern int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event);
                    +struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names);
                    +void udev_rules_unref(struct udev_rules *rules);
                    +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event);
                     
                     /* udev-event.c */
                    -extern struct udev_event *udev_event_new(struct udev_device *dev);
                    -extern void udev_event_unref(struct udev_event *event);
                    -extern int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules);
                    -extern int udev_event_execute_run(struct udev_event *event);
                    -extern void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize);
                    -extern int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string,
                    -					  char *result, size_t maxsize, int read_value);
                    +struct udev_event *udev_event_new(struct udev_device *dev);
                    +void udev_event_unref(struct udev_event *event);
                    +int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules);
                    +int udev_event_execute_run(struct udev_event *event);
                    +void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize);
                    +int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string,
                    +				   char *result, size_t maxsize, int read_value);
                     
                     /* udev-watch.c */
                     extern int inotify_fd;
                    -extern void udev_watch_init(struct udev *udev);
                    -extern void udev_watch_restore(struct udev *udev);
                    -extern void udev_watch_begin(struct udev *udev, struct udev_device *dev);
                    -extern void udev_watch_end(struct udev *udev, struct udev_device *dev);
                    -extern struct udev_device *udev_watch_lookup(struct udev *udev, int wd);
                    +void udev_watch_init(struct udev *udev);
                    +void udev_watch_restore(struct udev *udev);
                    +void udev_watch_begin(struct udev *udev, struct udev_device *dev);
                    +void udev_watch_end(struct udev *udev, struct udev_device *dev);
                    +struct udev_device *udev_watch_lookup(struct udev *udev, int wd);
                     
                     /* udev-node.c */
                    -extern int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid);
                    -extern int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid);
                    -extern int udev_node_remove(struct udev_device *dev);
                    -extern void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old);
                    +int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid);
                    +int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid);
                    +int udev_node_remove(struct udev_device *dev);
                    +void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old);
                     
                     /* udev-util.c */
                    -extern int util_create_path(struct udev *udev, const char *path);
                    -extern int util_delete_path(struct udev *udev, const char *path);
                    -extern int util_unlink_secure(struct udev *udev, const char *filename);
                    -extern uid_t util_lookup_user(struct udev *udev, const char *user);
                    -extern gid_t util_lookup_group(struct udev *udev, const char *group);
                    -extern int util_run_program(struct udev *udev, const char *command, char **envp,
                    -			    char *result, size_t ressize, size_t *reslen);
                    -extern int util_resolve_subsys_kernel(struct udev *udev, const char *string,
                    +int util_create_path(struct udev *udev, const char *path);
                    +int util_delete_path(struct udev *udev, const char *path);
                    +int util_unlink_secure(struct udev *udev, const char *filename);
                    +uid_t util_lookup_user(struct udev *udev, const char *user);
                    +gid_t util_lookup_group(struct udev *udev, const char *group);
                    +int util_run_program(struct udev *udev, const char *command, char **envp,
                    +		     char *result, size_t ressize, size_t *reslen);
                    +int util_resolve_subsys_kernel(struct udev *udev, const char *string,
                     				      char *result, size_t maxsize, int read_value);
                     
                     /* udev-selinux.c */
                     #ifndef USE_SELINUX
                    -static inline void udev_selinux_init(struct udev *udev) {}
                    -static inline void udev_selinux_exit(struct udev *udev) {}
                    -static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
                    -static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
                    -static inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
                    +inline void udev_selinux_init(struct udev *udev) {}
                    +inline void udev_selinux_exit(struct udev *udev) {}
                    +inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
                    +inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
                    +inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
                     #else
                    -extern void udev_selinux_init(struct udev *udev);
                    -extern void udev_selinux_exit(struct udev *udev);
                    -extern void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode);
                    -extern void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
                    -extern void udev_selinux_resetfscreatecon(struct udev *udev);
                    +void udev_selinux_init(struct udev *udev);
                    +void udev_selinux_exit(struct udev *udev);
                    +void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode);
                    +void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode);
                    +void udev_selinux_resetfscreatecon(struct udev *udev);
                     #endif
                     
                     /* udevadm commands */
                    -extern int udevadm_monitor(struct udev *udev, int argc, char *argv[]);
                    -extern int udevadm_info(struct udev *udev, int argc, char *argv[]);
                    -extern int udevadm_control(struct udev *udev, int argc, char *argv[]);
                    -extern int udevadm_trigger(struct udev *udev, int argc, char *argv[]);
                    -extern int udevadm_settle(struct udev *udev, int argc, char *argv[]);
                    -extern int udevadm_test(struct udev *udev, int argc, char *argv[]);
                    +int udevadm_monitor(struct udev *udev, int argc, char *argv[]);
                    +int udevadm_info(struct udev *udev, int argc, char *argv[]);
                    +int udevadm_control(struct udev *udev, int argc, char *argv[]);
                    +int udevadm_trigger(struct udev *udev, int argc, char *argv[]);
                    +int udevadm_settle(struct udev *udev, int argc, char *argv[]);
                    +int udevadm_test(struct udev *udev, int argc, char *argv[]);
                     #endif
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 1f698065bc616633e715db677a9584829e2063af Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sun, 26 Apr 2009 20:53:30 +0200
                    Subject: rule_generator: net - fix usb comment generation
                    
                    On Sat, Apr 4, 2009 at 22:17, Omair Eshkenazi  wrote:
                    > I noticed that in (70-)persistent-net.rules, the comments for USB devices
                    > are missing the device/vendor id's. Example:
                    > # USB device 0x:0x (rt73usb)
                    ---
                     extras/rule_generator/75-persistent-net-generator.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules
                    index 75b4534af2..5c2f100597 100644
                    --- a/extras/rule_generator/75-persistent-net-generator.rules
                    +++ b/extras/rule_generator/75-persistent-net-generator.rules
                    @@ -37,7 +37,7 @@ ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}=""
                     
                     # build comment line for generated rule:
                     SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)"
                    -SUBSYSTEMS=="usb", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)"
                    +SUBSYSTEMS=="usb", ATTRS{idVendor}=="?*", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)"
                     SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)"
                     SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})"
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 4d3657816a9652cc57b7a23c2adc858d83851f02 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 27 Apr 2009 03:23:41 +0200
                    Subject: rules: input - add links for USB/platform non-kbd/mouse devices
                    
                    ---
                     rules/rules.d/60-persistent-input.rules | 24 +++++++++++++++---------
                     1 file changed, 15 insertions(+), 9 deletions(-)
                    
                    diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules
                    index fff766fb1c..fa691939f8 100644
                    --- a/rules/rules.d/60-persistent-input.rules
                    +++ b/rules/rules.d/60-persistent-input.rules
                    @@ -6,28 +6,34 @@ KERNEL=="input[0-9]*", GOTO="persistent_input_end"
                     
                     # usb devices
                     SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
                    -SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd"
                    -SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse"
                    +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd", GOTO="serial"
                    +SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse", GOTO="serial"
                     
                     # other devices
                    -DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr"
                    -DRIVERS=="atkbd", ENV{ID_CLASS}="kbd"
                    -DRIVERS=="psmouse", ENV{ID_CLASS}="mouse"
                    -ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir"
                    +DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr", GOTO="serial"
                    +DRIVERS=="atkbd", ENV{ID_CLASS}="kbd", GOTO="serial"
                    +DRIVERS=="psmouse", ENV{ID_CLASS}="mouse", GOTO="serial"
                    +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir", GOTO="serial"
                     # joystick (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH
                    -ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", ENV{ID_CLASS}="joystick"
                    +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", \
                    +  ENV{ID_CLASS}="joystick", GOTO="serial"
                     
                     # fill empty serial number
                    -ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial"
                    +LABEL="serial", ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial"
                     
                     # by-id links
                     KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}"
                     KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}"
                    +# allow empty class for USB devices, and append the interface number
                    +SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \
                    +  SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}"
                     
                     # by-path
                     IMPORT{program}="path_id %p"
                     ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}"
                     ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}"
                    +# allow empty class for platform and usb devices; platform supports only a single interface that way
                    +SUBSYSTEMS=="usb|platform", ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{ID_CLASS}=="", \
                    +  SYMLINK+="input/by-path/$env{ID_PATH}-event"
                     
                     LABEL="persistent_input_end"
                    -
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From c311b393be8a129bf0137e95d322762a739fc9bf Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 27 Apr 2009 03:50:48 +0200
                    Subject: rules: input - fix comments
                    
                    ---
                     rules/rules.d/60-persistent-input.rules | 6 ++++--
                     1 file changed, 4 insertions(+), 2 deletions(-)
                    
                    diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules
                    index fa691939f8..9b0e75fb98 100644
                    --- a/rules/rules.d/60-persistent-input.rules
                    +++ b/rules/rules.d/60-persistent-input.rules
                    @@ -4,8 +4,9 @@ ACTION!="add|change", GOTO="persistent_input_end"
                     SUBSYSTEM!="input", GOTO="persistent_input_end"
                     KERNEL=="input[0-9]*", GOTO="persistent_input_end"
                     
                    -# usb devices
                     SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p"
                    +
                    +# well defined boot-subclass usb devices
                     SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd", GOTO="serial"
                     SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse", GOTO="serial"
                     
                    @@ -14,6 +15,7 @@ DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr", GOTO="serial"
                     DRIVERS=="atkbd", ENV{ID_CLASS}="kbd", GOTO="serial"
                     DRIVERS=="psmouse", ENV{ID_CLASS}="mouse", GOTO="serial"
                     ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir", GOTO="serial"
                    +
                     # joystick (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH
                     ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", \
                       ENV{ID_CLASS}="joystick", GOTO="serial"
                    @@ -24,7 +26,7 @@ LABEL="serial", ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noseria
                     # by-id links
                     KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}"
                     KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}"
                    -# allow empty class for USB devices, and append the interface number
                    +# allow empty class for USB devices, by appending the interface number
                     SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \
                       SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}"
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 6d34b6af12144a89f2b41c2c2d7613706b34122a Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 28 Apr 2009 11:24:25 +0200
                    Subject: rules: add rfcomm* to group dialout
                    
                    https://bugs.launchpad.net/bugs/368109
                    ---
                     rules/rules.d/50-udev-default.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
                    index 6bf45cce9b..6ce3e7f7f7 100644
                    --- a/rules/rules.d/50-udev-default.rules
                    +++ b/rules/rules.d/50-udev-default.rules
                    @@ -13,7 +13,7 @@ KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty"
                     KERNEL=="console",		MODE="0600"
                     
                     # serial
                    -KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*", GROUP="dialout"
                    +KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"
                     KERNEL=="ppp",			MODE="0600"
                     KERNEL=="mwave",		NAME="modems/mwave", GROUP="dialout"
                     KERNEL=="hvc*|hvsi*",		GROUP="dialout"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 8e4bd225584b63478de106d7b306ba6707c8b2b4 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 28 Apr 2009 15:59:45 +0200
                    Subject: accept DEVNAME from the kernel as a hint for the node name
                    
                    ---
                     udev/udev-event.c | 18 +++++++++++++++---
                     1 file changed, 15 insertions(+), 3 deletions(-)
                    
                    diff --git a/udev/udev-event.c b/udev/udev-event.c
                    index f4d7121793..b7cdbf3402 100644
                    --- a/udev/udev-event.c
                    +++ b/udev/udev-event.c
                    @@ -579,12 +579,24 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     		}
                     
                     		if (event->name == NULL) {
                    -			info(event->udev, "no node name set, will use kernel name '%s'\n",
                    +			const char *devname;
                    +
                    +			devname = udev_device_get_property_value(event->dev, "DEVNAME");
                    +			if (devname != NULL) {
                    +				info(event->udev, "no node name set, will use "
                    +				     "kernel supplied name '%s'\n", devname);
                    +				event->name = strdup(devname);
                    +				if (event->name == NULL)
                    +					goto exit_add;
                    +			}
                    +		}
                    +		if (event->name == NULL) {
                    +			info(event->udev, "no node name set, will use device name '%s'\n",
                     			     udev_device_get_sysname(event->dev));
                     			event->name = strdup(udev_device_get_sysname(event->dev));
                    -			if (event->name == NULL)
                    -				goto exit_add;
                     		}
                    +		if (event->name == NULL)
                    +			goto exit_add;
                     
                     		/* set device node name */
                     		util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename));
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 8abc567533a8133d22275890d5eda9b8b8cecd3e Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Wed, 29 Apr 2009 15:57:41 +0200
                    Subject: update TODO
                    
                    ---
                     TODO | 2 ++
                     1 file changed, 2 insertions(+)
                    
                    diff --git a/TODO b/TODO
                    index 5095944ade..6e359537ce 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -5,5 +5,7 @@
                     
                       o implement path_id in C with libudev (?)
                       o convert firmware.sh to C (?)
                    +
                    +  o drop all support for the DEPRECATED sysfs layout
                       o "udevadm control" commands will only accept the -- syntax
                       o symlink names to udevadm will no longer be resolved to old command names
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From cb0237d7d9f16f7aebb98a515fda90406d16db35 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Fri, 1 May 2009 05:09:51 +0200
                    Subject: build: use AC_MSG_RESULT
                    
                    ---
                     configure.ac | 6 +++---
                     1 file changed, 3 insertions(+), 3 deletions(-)
                    
                    diff --git a/configure.ac b/configure.ac
                    index f611864258..3e078a4621 100644
                    --- a/configure.ac
                    +++ b/configure.ac
                    @@ -101,9 +101,9 @@ AC_CONFIG_FILES([
                     	extras/volume_id/lib/Makefile
                     	extras/volume_id/lib/libvolume_id.pc
                     ])
                    -AC_OUTPUT
                     
                    -echo "
                    +AC_OUTPUT
                    +AC_MSG_RESULT([
                     	udev $VERSION
                     	========
                     
                    @@ -124,4 +124,4 @@ echo "
                     	ldflags:		${LDFLAGS}
                     
                     	xsltproc:		${XSLTPROC}
                    -"
                    +])
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 998d9788e76db8d323e4192b23d621fc5c65be4d Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Fri, 1 May 2009 17:52:21 +0200
                    Subject: rules: add "event*" match
                    
                    ---
                     rules/rules.d/60-persistent-input.rules | 2 +-
                     1 file changed, 1 insertion(+), 1 deletion(-)
                    
                    diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules
                    index 9b0e75fb98..f522b417b2 100644
                    --- a/rules/rules.d/60-persistent-input.rules
                    +++ b/rules/rules.d/60-persistent-input.rules
                    @@ -27,7 +27,7 @@ LABEL="serial", ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noseria
                     KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}"
                     KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}"
                     # allow empty class for USB devices, by appending the interface number
                    -SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \
                    +SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{ID_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \
                       SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}"
                     
                     # by-path
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From a00bdfa16b9bac7e4c31fcd31b4003d5a18f6d09 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sat, 2 May 2009 05:23:02 +0200
                    Subject: udevd: revert initial device node creation
                    
                    ---
                     NEWS         |  3 ---
                     udev/udevd.c | 24 ------------------------
                     2 files changed, 27 deletions(-)
                    
                    diff --git a/NEWS b/NEWS
                    index 8eb5fc8e24..91698d5380 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -2,9 +2,6 @@ udev 142
                     ========
                     Bugfixes.
                     
                    -The udev daemon will now create /dev/null, /dev/console, /dev/kmsg at
                    -startup, if they don't exist already.
                    -
                     Libudev allows to subscribe to udev events. To prevent unwanted messages
                     to be delivered, and waking up the subscribing process, a filter can be
                     installed, to drop messages inside a kernel socket filter. The filters
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index d1a226673e..1aa50eb74c 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -708,28 +708,6 @@ static void export_initial_seqnum(struct udev *udev)
                     	}
                     }
                     
                    -/* create the nodes the we depend on to properly start up */
                    -static void setup_initial_nodes(struct udev *udev)
                    -{
                    -	struct udev_device *dev;
                    -
                    -	dev = udev_device_new_from_subsystem_sysname(udev, "mem", "null");
                    -	if (dev != NULL) {
                    -		udev_node_mknod(dev, "null", makedev(0,0), 0666, 0, 0);
                    -		udev_device_unref(dev);
                    -	}
                    -	dev = udev_device_new_from_subsystem_sysname(udev, "mem", "kmsg");
                    -	if (dev != NULL) {
                    -		udev_node_mknod(dev, "kmsg", makedev(0,0), 0660, 0, 0);
                    -		udev_device_unref(dev);
                    -	}
                    -	dev = udev_device_new_from_subsystem_sysname(udev, "tty", "console");
                    -	if (dev != NULL) {
                    -		udev_node_mknod(dev, "console", makedev(0,0), 0600, 0, 0);
                    -		udev_device_unref(dev);
                    -	}
                    -}
                    -
                     static void startup_log(struct udev *udev)
                     {
                     	FILE *f;
                    @@ -836,8 +814,6 @@ int main(int argc, char *argv[])
                     		goto exit;
                     	}
                     
                    -	setup_initial_nodes(udev);
                    -
                     	/* make sure std{in,out,err} fd's are in a sane state */
                     	fd = open("/dev/null", O_RDWR);
                     	if (fd < 0) {
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 3157c02d2bb2753b7d5bebd54dba7262bafcc88c Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Sun, 3 May 2009 14:44:23 +0200
                    Subject: rules: remove initramfs comment
                    
                    ---
                     rules/rules.d/50-udev-default.rules | 3 +--
                     1 file changed, 1 insertion(+), 2 deletions(-)
                    
                    diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
                    index 6ce3e7f7f7..5f73866ada 100644
                    --- a/rules/rules.d/50-udev-default.rules
                    +++ b/rules/rules.d/50-udev-default.rules
                    @@ -1,5 +1,4 @@
                     # do not edit this file, it will be overwritten on update
                    -# initramfs:default
                     
                     SUBSYSTEM=="block", SYMLINK+="block/%M:%m"
                     SUBSYSTEM!="block", SYMLINK+="char/%M:%m"
                    @@ -9,8 +8,8 @@ KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660"
                     KERNEL=="ptmx",			GROUP="tty", MODE="0666"
                     KERNEL=="tty",			GROUP="tty", MODE="0666"
                     KERNEL=="tty[0-9]*",		GROUP="tty", MODE="0620"
                    -KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty"
                     KERNEL=="console",		MODE="0600"
                    +KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty"
                     
                     # serial
                     KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 9379b7c16dd3b2f11d9e69c063706037ae001a0a Mon Sep 17 00:00:00 2001
                    From: Lubomir Rintel 
                    Date: Sun, 3 May 2009 15:37:30 +0200
                    Subject: rule-generator: net - whitelist NICs that violate MAC local scheme
                    
                    According to list of assigned ethernet codes [1] referred to by
                    IANA [2] certain global addresses do not follow the assignement
                    scheme and use numbers reserved for local use. Several such adapters
                    are quite widely used, generate rules for them.
                    
                    [1] http://www.cavebear.com/archive/cavebear/Ethernet/vendor.html
                    [2] http://www.iana.org/assignments/ethernet-numbers
                    ---
                     .../75-persistent-net-generator.rules              | 28 ++++++++++++++++++++++
                     1 file changed, 28 insertions(+)
                    
                    diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules
                    index 5c2f100597..2583e22fce 100644
                    --- a/extras/rule_generator/75-persistent-net-generator.rules
                    +++ b/extras/rule_generator/75-persistent-net-generator.rules
                    @@ -29,12 +29,40 @@ ENV{MATCHADDR}="$attr{address}"
                     # match interface type
                     ENV{MATCHIFTYPE}="$attr{type}"
                     
                    +# These vendors are known to violate the local MAC address assignment scheme
                    +# Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom
                    +ENV{MATCHADDR}=="02:07:01:*", GOTO="globally_administered_whitelist"
                    +# 3Com
                    +ENV{MATCHADDR}=="02:60:60:*", GOTO="globally_administered_whitelist"
                    +# 3Com IBM PC; Imagen; Valid; Cisco; Apple
                    +ENV{MATCHADDR}=="02:60:8c:*", GOTO="globally_administered_whitelist"
                    +# Intel
                    +ENV{MATCHADDR}=="02:a0:c9:*", GOTO="globally_administered_whitelist"
                    +# Olivetti
                    +ENV{MATCHADDR}=="02:aa:3c:*", GOTO="globally_administered_whitelist"
                    +# CMC Masscomp; Silicon Graphics; Prime EXL
                    +ENV{MATCHADDR}=="02:cf:1f:*", GOTO="globally_administered_whitelist"
                    +# Prominet Corporation Gigabit Ethernet Switch
                    +ENV{MATCHADDR}=="02:e0:3b:*", GOTO="globally_administered_whitelist"
                    +# BTI (Bus-Tech, Inc.) IBM Mainframes
                    +ENV{MATCHADDR}=="02:e6:d3:*", GOTO="globally_administered_whitelist"
                    +# Realtek
                    +ENV{MATCHADDR}=="52:54:00:*", GOTO="globally_administered_whitelist"
                    +# Novell 2000
                    +ENV{MATCHADDR}=="52:54:4c:*", GOTO="globally_administered_whitelist"
                    +# Realtec
                    +ENV{MATCHADDR}=="52:54:ab:*", GOTO="globally_administered_whitelist"
                    +# Kingston Technologies
                    +ENV{MATCHADDR}=="e2:0c:0f:*", GOTO="globally_administered_whitelist"
                    +
                     # do not use "locally administered" MAC address
                     ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}=""
                     
                     # do not use empty address
                     ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}=""
                     
                    +LABEL="globally_administered_whitelist"
                    +
                     # build comment line for generated rule:
                     SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)"
                     SUBSYSTEMS=="usb", ATTRS{idVendor}=="?*", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From cb14f4543a941ff8a22ef2725df86b3b0190a189 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 4 May 2009 04:52:31 +0200
                    Subject: handle devtmpfs nodes
                    
                    UDev follows the kernel given name, and re-uses the kernel created
                    device node. If the kernel and spcecified udev rules disagree, the
                    udev specified node node is created and the kernel-created on is
                    deleted.
                    ---
                     TODO                                |  1 +
                     rules/rules.d/50-udev-default.rules |  1 -
                     udev/lib/libudev-device.c           | 17 +++++++++
                     udev/lib/libudev-monitor.c          | 17 ++++++---
                     udev/lib/libudev-private.h          |  2 ++
                     udev/udev-event.c                   | 69 +++++++++++++++++++++++++++----------
                     udev/udev-node.c                    |  9 +----
                     7 files changed, 83 insertions(+), 33 deletions(-)
                    
                    diff --git a/TODO b/TODO
                    index 6e359537ce..fe7eb17063 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -1,4 +1,5 @@
                     
                    +  o add tests for kernel provided DEVNAME logic
                       o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30)
                       o remove MMC rules, they got a modalias now (2.6.30)
                       o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30)
                    diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
                    index 5f73866ada..782db4010a 100644
                    --- a/rules/rules.d/50-udev-default.rules
                    +++ b/rules/rules.d/50-udev-default.rules
                    @@ -13,7 +13,6 @@ KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty"
                     
                     # serial
                     KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"
                    -KERNEL=="ppp",			MODE="0600"
                     KERNEL=="mwave",		NAME="modems/mwave", GROUP="dialout"
                     KERNEL=="hvc*|hvsi*",		GROUP="dialout"
                     
                    diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
                    index 92b2d18b83..8e29efff86 100644
                    --- a/udev/lib/libudev-device.c
                    +++ b/udev/lib/libudev-device.c
                    @@ -37,6 +37,7 @@ struct udev_device {
                     	char *action;
                     	char *devpath_old;
                     	char *physdevpath;
                    +	char *knodename;
                     	char **envp;
                     	char *monitor_buf;
                     	size_t monitor_buf_len;
                    @@ -208,6 +209,8 @@ int udev_device_read_uevent_file(struct udev_device *udev_device)
                     			maj = strtoull(&line[6], NULL, 10);
                     		else if (strncmp(line, "MINOR=", 6) == 0)
                     			min = strtoull(&line[6], NULL, 10);
                    +		else if (strncmp(line, "DEVNAME=", 8) == 0)
                    +			udev_device_set_knodename(udev_device, &line[8]);
                     
                     		udev_device_add_property_from_string(udev_device, line);
                     	}
                    @@ -621,6 +624,7 @@ void udev_device_unref(struct udev_device *udev_device)
                     	free(udev_device->action);
                     	free(udev_device->driver);
                     	free(udev_device->devpath_old);
                    +	free(udev_device->knodename);
                     	free(udev_device->physdevpath);
                     	udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list);
                     	free(udev_device->envp);
                    @@ -1175,6 +1179,19 @@ int udev_device_set_devpath_old(struct udev_device *udev_device, const char *dev
                     	return 0;
                     }
                     
                    +const char *udev_device_get_knodename(struct udev_device *udev_device)
                    +{
                    +	return udev_device->knodename;
                    +}
                    +
                    +int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename)
                    +{
                    +	udev_device->knodename = strdup(knodename);
                    +	if (udev_device->knodename == NULL)
                    +		return -ENOMEM;
                    +	return 0;
                    +}
                    +
                     const char *udev_device_get_physdevpath(struct udev_device *udev_device)
                     {
                     	return udev_device->physdevpath;
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index c87ff7434f..fc904c4a7c 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -445,6 +445,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito
                     	int action_set = 0;
                     	int maj = 0;
                     	int min = 0;
                    +	int is_kernel = 0;
                     
                     retry:
                     	if (udev_monitor == NULL)
                    @@ -480,9 +481,12 @@ retry:
                     			info(udev_monitor->udev, "unicast netlink message ignored\n");
                     			return NULL;
                     		}
                    -		if ((snl.nl_groups == UDEV_MONITOR_KERNEL) && (snl.nl_pid > 0)) {
                    -			info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", snl.nl_pid);
                    -			return NULL;
                    +		if (snl.nl_groups == UDEV_MONITOR_KERNEL) {
                    +			if (snl.nl_pid > 0) {
                    +				info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", snl.nl_pid);
                    +				return NULL;
                    +			}
                    +			is_kernel = 1;
                     		}
                     	}
                     
                    @@ -551,7 +555,10 @@ retry:
                     		} else if (strncmp(key, "DEVTYPE=", 8) == 0) {
                     			udev_device_set_devtype(udev_device, &key[8]);
                     		} else if (strncmp(key, "DEVNAME=", 8) == 0) {
                    -			udev_device_set_devnode(udev_device, &key[8]);
                    +			if (is_kernel)
                    +				udev_device_set_knodename(udev_device, &key[8]);
                    +			else
                    +				udev_device_set_devnode(udev_device, &key[8]);
                     		} else if (strncmp(key, "DEVLINKS=", 9) == 0) {
                     			char devlinks[UTIL_PATH_SIZE];
                     			char *slink;
                    @@ -586,7 +593,7 @@ retry:
                     		} else if (strncmp(key, "TIMEOUT=", 8) == 0) {
                     			udev_device_set_timeout(udev_device, strtoull(&key[8], NULL, 10));
                     		} else if (strncmp(key, "PHYSDEV", 7) == 0) {
                    -			/* skip deprecated values */
                    +			/* suppress deprecated values */
                     			continue;
                     		} else {
                     			udev_device_add_property_from_string(udev_device, key);
                    diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
                    index b283ff4ac3..8723cd7914 100644
                    --- a/udev/lib/libudev-private.h
                    +++ b/udev/lib/libudev-private.h
                    @@ -62,6 +62,8 @@ int udev_device_set_action(struct udev_device *udev_device, const char *action);
                     int udev_device_set_driver(struct udev_device *udev_device, const char *driver);
                     const char *udev_device_get_devpath_old(struct udev_device *udev_device);
                     int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old);
                    +const char *udev_device_get_knodename(struct udev_device *udev_device);
                    +int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename);
                     const char *udev_device_get_physdevpath(struct udev_device *udev_device);
                     int udev_device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath);
                     int udev_device_get_timeout(struct udev_device *udev_device);
                    diff --git a/udev/udev-event.c b/udev/udev-event.c
                    index b7cdbf3402..345fb20e22 100644
                    --- a/udev/udev-event.c
                    +++ b/udev/udev-event.c
                    @@ -354,12 +354,24 @@ found:
                     
                     				if (event->tmp_node != NULL) {
                     					util_strlcat(string, event->tmp_node, maxsize);
                    -					dbg(event->udev, "return existing temporary node\n");
                    +					dbg(event->udev, "tempnode: return earlier created one\n");
                     					break;
                     				}
                     				devnum = udev_device_get_devnum(dev);
                    -				if (major(udev_device_get_devnum(dev) == 0))
                    +				if (major(devnum) == 0)
                     					break;
                    +				/* lookup kernel provided node */
                    +				if (udev_device_get_knodename(dev) != NULL) {
                    +					util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename));
                    +					util_strlcat(filename, "/", sizeof(filename));
                    +					util_strlcat(filename, udev_device_get_knodename(dev), sizeof(filename));
                    +					if (stat(filename, &statbuf) == 0 && statbuf.st_rdev == devnum) {
                    +						util_strlcat(string, filename, maxsize);
                    +						dbg(event->udev, "tempnode: return kernel node\n");
                    +						break;
                    +					}
                    +				}
                    +				/* lookup /dev/{char,block}/: */
                     				if (strcmp(udev_device_get_subsystem(dev), "block") == 0)
                     					devtype = "block";
                     				else
                    @@ -370,10 +382,11 @@ found:
                     					 minor(udev_device_get_devnum(dev)));
                     				if (stat(filename, &statbuf) == 0 && statbuf.st_rdev == devnum) {
                     					util_strlcat(string, filename, maxsize);
                    -					dbg(event->udev, "return existing temporary node\n");
                    +					dbg(event->udev, "tempnode: return maj:min node\n");
                     					break;
                     				}
                    -				dbg(event->udev, "create temporary node\n");
                    +				/* create temporary node */
                    +				dbg(event->udev, "tempnode: create temp node\n");
                     				asprintf(&event->tmp_node, "%s/.tmp-%s-%u:%u",
                     					 udev_get_dev_path(event->udev), devtype,
                     					 major(udev_device_get_devnum(dev)),
                    @@ -547,6 +560,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     	    (strcmp(udev_device_get_action(dev), "add") == 0 || strcmp(udev_device_get_action(dev), "change") == 0)) {
                     		char filename[UTIL_PATH_SIZE];
                     		struct udev_device *dev_old;
                    +		int delete_kdevnode = 0;
                     
                     		dbg(event->udev, "device node add '%s'\n", udev_device_get_devpath(dev));
                     
                    @@ -562,7 +576,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     
                     		udev_rules_apply_to_event(rules, event);
                     		if (event->tmp_node != NULL) {
                    -			dbg(event->udev, "removing temporary device node\n");
                    +			dbg(event->udev, "cleanup temporary device node\n");
                     			util_unlink_secure(event->udev, event->tmp_node);
                     			free(event->tmp_node);
                     			event->tmp_node = NULL;
                    @@ -570,33 +584,38 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     
                     		if (event->ignore_device) {
                     			info(event->udev, "device event will be ignored\n");
                    +			delete_kdevnode = 1;
                     			goto exit_add;
                     		}
                     
                     		if (event->name != NULL && event->name[0] == '\0') {
                     			info(event->udev, "device node creation supressed\n");
                    +			delete_kdevnode = 1;
                     			goto exit_add;
                     		}
                     
                    +		/* if rule given name disagrees with kernel node name, delete kernel node */
                    +		if (event->name != NULL && udev_device_get_knodename(dev) != NULL) {
                    +			if (strcmp(event->name, udev_device_get_knodename(dev)) != 0)
                    +				delete_kdevnode = 1;
                    +		}
                    +
                    +		/* no rule, use kernel provided name */
                     		if (event->name == NULL) {
                    -			const char *devname;
                    -
                    -			devname = udev_device_get_property_value(event->dev, "DEVNAME");
                    -			if (devname != NULL) {
                    -				info(event->udev, "no node name set, will use "
                    -				     "kernel supplied name '%s'\n", devname);
                    -				event->name = strdup(devname);
                    -				if (event->name == NULL)
                    -					goto exit_add;
                    +			if (udev_device_get_knodename(dev) != NULL) {
                    +				event->name = strdup(udev_device_get_knodename(dev));
                    +				info(event->udev, "no node name set, will use kernel supplied name '%s'\n", event->name);
                    +			} else {
                    +				event->name = strdup(udev_device_get_sysname(event->dev));
                    +				info(event->udev, "no node name set, will use device name '%s'\n", event->name);
                     			}
                     		}
                    +
                    +		/* something went wrong */
                     		if (event->name == NULL) {
                    -			info(event->udev, "no node name set, will use device name '%s'\n",
                    -			     udev_device_get_sysname(event->dev));
                    -			event->name = strdup(udev_device_get_sysname(event->dev));
                    -		}
                    -		if (event->name == NULL)
                    +			err(event->udev, "no node name for '%s'\n", udev_device_get_sysname(event->dev));
                     			goto exit_add;
                    +		}
                     
                     		/* set device node name */
                     		util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename));
                    @@ -614,6 +633,18 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
                     		/* create new node and symlinks */
                     		err = udev_node_add(dev, event->mode, event->uid, event->gid);
                     exit_add:
                    +		if (delete_kdevnode && udev_device_get_knodename(dev) != NULL) {
                    +			struct stat stats;
                    +
                    +			util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename));
                    +			util_strlcat(filename, "/", sizeof(filename));
                    +			util_strlcat(filename, udev_device_get_knodename(dev), sizeof(filename));
                    +			if (stat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) {
                    +				unlink(filename);
                    +				util_delete_path(event->udev, filename);
                    +				info(event->udev, "removed kernel created node '%s'\n", filename);
                    +			}
                    +		}
                     		udev_device_unref(dev_old);
                     		goto exit;
                     	}
                    diff --git a/udev/udev-node.c b/udev/udev-node.c
                    index 322e0b88de..2f9cf4d7ac 100644
                    --- a/udev/udev-node.c
                    +++ b/udev/udev-node.c
                    @@ -68,7 +68,6 @@ static int name_index(struct udev *udev, const char *devpath, const char *name,
                     int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid)
                     {
                     	struct udev *udev = udev_device_get_udev(dev);
                    -	char filename[UTIL_PATH_SIZE];
                     	struct stat stats;
                     	int preserve = 0;
                     	int err = 0;
                    @@ -81,14 +80,8 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod
                     	else
                     		mode |= S_IFCHR;
                     
                    -	if (file == NULL) {
                    +	if (file == NULL)
                     		file = udev_device_get_devnode(dev);
                    -	} else if (file[0] != '/') {
                    -		util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename));
                    -		util_strlcat(filename, "/", sizeof(filename));
                    -		util_strlcat(filename, file, sizeof(filename));
                    -		file = filename;
                    -	}
                     
                     	if (lstat(file, &stats) == 0) {
                     		if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) {
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From efca104ccfa8894b84ad4ec56388780ff317ced7 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 4 May 2009 14:10:05 +0200
                    Subject: oops, removed ppp entry from rules got committed
                    
                    ---
                     rules/rules.d/50-udev-default.rules | 1 +
                     1 file changed, 1 insertion(+)
                    
                    diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
                    index 782db4010a..5f73866ada 100644
                    --- a/rules/rules.d/50-udev-default.rules
                    +++ b/rules/rules.d/50-udev-default.rules
                    @@ -13,6 +13,7 @@ KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty"
                     
                     # serial
                     KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout"
                    +KERNEL=="ppp",			MODE="0600"
                     KERNEL=="mwave",		NAME="modems/mwave", GROUP="dialout"
                     KERNEL=="hvc*|hvsi*",		GROUP="dialout"
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From e3196993f1f7fdd9fb7fbf4eeb397080554ae920 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 4 May 2009 22:08:05 +0200
                    Subject: remove all PHYSDEVPATH handling and warning about
                    
                    ---
                     udev/lib/libudev-device.c  | 15 ---------------
                     udev/lib/libudev-monitor.c |  5 -----
                     udev/lib/libudev-private.h |  2 --
                     udev/udev-rules.c          |  9 ---------
                     udev/udevd.c               | 15 +--------------
                     5 files changed, 1 insertion(+), 45 deletions(-)
                    
                    diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c
                    index 8e29efff86..ddc4b34115 100644
                    --- a/udev/lib/libudev-device.c
                    +++ b/udev/lib/libudev-device.c
                    @@ -36,7 +36,6 @@ struct udev_device {
                     	char *driver;
                     	char *action;
                     	char *devpath_old;
                    -	char *physdevpath;
                     	char *knodename;
                     	char **envp;
                     	char *monitor_buf;
                    @@ -625,7 +624,6 @@ void udev_device_unref(struct udev_device *udev_device)
                     	free(udev_device->driver);
                     	free(udev_device->devpath_old);
                     	free(udev_device->knodename);
                    -	free(udev_device->physdevpath);
                     	udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list);
                     	free(udev_device->envp);
                     	free(udev_device->monitor_buf);
                    @@ -1192,19 +1190,6 @@ int udev_device_set_knodename(struct udev_device *udev_device, const char *knode
                     	return 0;
                     }
                     
                    -const char *udev_device_get_physdevpath(struct udev_device *udev_device)
                    -{
                    -	return udev_device->physdevpath;
                    -}
                    -
                    -int udev_device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath)
                    -{
                    -	udev_device->physdevpath = strdup(physdevpath);
                    -	if (udev_device->physdevpath == NULL)
                    -		return -ENOMEM;
                    -	return 0;
                    -}
                    -
                     int udev_device_get_timeout(struct udev_device *udev_device)
                     {
                     	return udev_device->timeout;
                    diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c
                    index fc904c4a7c..2540e85c34 100644
                    --- a/udev/lib/libudev-monitor.c
                    +++ b/udev/lib/libudev-monitor.c
                    @@ -586,15 +586,10 @@ retry:
                     			min = strtoull(&key[6], NULL, 10);
                     		} else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) {
                     			udev_device_set_devpath_old(udev_device, &key[12]);
                    -		} else if (strncmp(key, "PHYSDEVPATH=", 12) == 0) {
                    -			udev_device_set_physdevpath(udev_device, &key[12]);
                     		} else if (strncmp(key, "SEQNUM=", 7) == 0) {
                     			udev_device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10));
                     		} else if (strncmp(key, "TIMEOUT=", 8) == 0) {
                     			udev_device_set_timeout(udev_device, strtoull(&key[8], NULL, 10));
                    -		} else if (strncmp(key, "PHYSDEV", 7) == 0) {
                    -			/* suppress deprecated values */
                    -			continue;
                     		} else {
                     			udev_device_add_property_from_string(udev_device, key);
                     		}
                    diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h
                    index 8723cd7914..7dd8e7dfe0 100644
                    --- a/udev/lib/libudev-private.h
                    +++ b/udev/lib/libudev-private.h
                    @@ -64,8 +64,6 @@ const char *udev_device_get_devpath_old(struct udev_device *udev_device);
                     int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old);
                     const char *udev_device_get_knodename(struct udev_device *udev_device);
                     int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename);
                    -const char *udev_device_get_physdevpath(struct udev_device *udev_device);
                    -int udev_device_set_physdevpath(struct udev_device *udev_device, const char *physdevpath);
                     int udev_device_get_timeout(struct udev_device *udev_device);
                     int udev_device_set_timeout(struct udev_device *udev_device, int timeout);
                     int udev_device_get_event_timeout(struct udev_device *udev_device);
                    diff --git a/udev/udev-rules.c b/udev/udev-rules.c
                    index e4594c31cd..fac418e526 100644
                    --- a/udev/udev-rules.c
                    +++ b/udev/udev-rules.c
                    @@ -1137,8 +1137,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     {
                     	char *linepos;
                     	char *attr;
                    -	int physdev = 0;
                    -	int waitfor = 0;
                     	struct rule_tmp rule_tmp;
                     
                     	memset(&rule_tmp, 0x00, sizeof(struct rule_tmp));
                    @@ -1280,8 +1278,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     				err(rules->udev, "error parsing ENV attribute\n");
                     				goto invalid;
                     			}
                    -			if (strncmp(attr, "PHYSDEV", 7) == 0)
                    -				physdev = 1;
                     			if (op < OP_MATCH_MAX) {
                     				if (rule_add_key(&rule_tmp, TK_M_ENV, op, value, attr) != 0)
                     					goto invalid;
                    @@ -1378,7 +1374,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     
                     		if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) {
                     			rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL);
                    -			waitfor = 1;
                     			continue;
                     		}
                     
                    @@ -1536,10 +1531,6 @@ static int add_rule(struct udev_rules *rules, char *line,
                     		err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno);
                     	}
                     
                    -	if (physdev && !waitfor)
                    -		err(rules->udev, "PHYSDEV* values are deprecated and not available on recent kernels, "
                    -		    "please fix it in %s:%u\n", filename, lineno);
                    -
                     	/* add rule token */
                     	rule_tmp.rule.rule.token_count = 1 + rule_tmp.token_cur;
                     	if (add_token(rules, &rule_tmp.rule) != 0)
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index 1aa50eb74c..ec6ee009cd 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -339,7 +339,7 @@ static int compare_devpath(const char *running, const char *waiting)
                     	return 0;
                     }
                     
                    -/* lookup event for identical, parent, child, or physical device */
                    +/* lookup event for identical, parent, child device */
                     static int devpath_busy(struct udev_event *event)
                     {
                     	struct udev_list_node *loop;
                    @@ -390,19 +390,6 @@ static int devpath_busy(struct udev_event *event)
                     			event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev);
                     			return 5;
                     		}
                    -
                    -		/* check physical device event (special case of parent) */
                    -		if (udev_device_get_physdevpath(event->dev) != NULL &&
                    -		    strcmp(udev_device_get_action(event->dev), "add") == 0)
                    -			if (compare_devpath(udev_device_get_devpath(loop_event->dev),
                    -					    udev_device_get_physdevpath(event->dev)) != 0) {
                    -				dbg(event->udev, "%llu, physical device event still pending %llu (%s)\n",
                    -				    udev_device_get_seqnum(event->dev),
                    -				    udev_device_get_seqnum(loop_event->dev),
                    -				    udev_device_get_devpath(loop_event->dev));
                    -				event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev);
                    -				return 6;
                    -			}
                     	}
                     	return 0;
                     }
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 619b97ff2b9e29c79dedd9aff425c7a11764c300 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 5 May 2009 02:39:16 +0200
                    Subject: remove asmlinkage
                    
                    ---
                     udev/test-udev.c       |  8 ++++----
                     udev/udev-sysdeps.h    |  8 --------
                     udev/udevadm-monitor.c |  4 ++--
                     udev/udevadm-settle.c  |  6 +++---
                     udev/udevd.c           | 18 +++++++++---------
                     5 files changed, 18 insertions(+), 26 deletions(-)
                    
                    diff --git a/udev/test-udev.c b/udev/test-udev.c
                    index ff1c353e66..6ec91c174a 100644
                    --- a/udev/test-udev.c
                    +++ b/udev/test-udev.c
                    @@ -30,14 +30,14 @@
                     
                     #include "udev.h"
                     
                    -static void asmlinkage sig_handler(int signum)
                    +static void sig_handler(int signum)
                     {
                     	switch (signum) {
                     		case SIGALRM:
                    -			exit(1);
                    +			_exit(1);
                     		case SIGINT:
                     		case SIGTERM:
                    -			exit(20 + signum);
                    +			_exit(20 + signum);
                     	}
                     }
                     
                    @@ -62,7 +62,7 @@ int main(int argc, char *argv[])
                     
                     	/* set signal handlers */
                     	memset(&act, 0x00, sizeof(act));
                    -	act.sa_handler = (void (*)(int)) sig_handler;
                    +	act.sa_handler = sig_handler;
                     	sigemptyset (&act.sa_mask);
                     	act.sa_flags = 0;
                     	sigaction(SIGALRM, &act, NULL);
                    diff --git a/udev/udev-sysdeps.h b/udev/udev-sysdeps.h
                    index e20ea48a2f..35671baca1 100644
                    --- a/udev/udev-sysdeps.h
                    +++ b/udev/udev-sysdeps.h
                    @@ -23,14 +23,6 @@
                     #include 
                     #include 
                     
                    -/* needed for our signal handlers to work */
                    -#undef asmlinkage
                    -#ifdef __i386__
                    -#define asmlinkage	__attribute__((regparm(0)))
                    -#else
                    -#define asmlinkage
                    -#endif /* __i386__ */
                    -
                     #ifndef HAVE_INOTIFY
                     static inline int inotify_init(void)
                     {
                    diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c
                    index 27520f7061..3f4cb5772d 100644
                    --- a/udev/udevadm-monitor.c
                    +++ b/udev/udevadm-monitor.c
                    @@ -35,7 +35,7 @@
                     
                     static int udev_exit;
                     
                    -static void asmlinkage sig_handler(int signum)
                    +static void sig_handler(int signum)
                     {
                     	if (signum == SIGINT || signum == SIGTERM)
                     		udev_exit = 1;
                    @@ -135,7 +135,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[])
                     
                     	/* set signal handlers */
                     	memset(&act, 0x00, sizeof(struct sigaction));
                    -	act.sa_handler = (void (*)(int)) sig_handler;
                    +	act.sa_handler = sig_handler;
                     	sigemptyset(&act.sa_mask);
                     	act.sa_flags = SA_RESTART;
                     	sigaction(SIGINT, &act, NULL);
                    diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c
                    index 1c3c28176b..3b26f10d50 100644
                    --- a/udev/udevadm-settle.c
                    +++ b/udev/udevadm-settle.c
                    @@ -36,9 +36,9 @@
                     #define DEFAULT_TIMEOUT			180
                     #define LOOP_PER_SECOND			20
                     
                    -static int volatile is_timeout;
                    +static volatile sig_atomic_t is_timeout;
                     
                    -static void asmlinkage sig_handler(int signum)
                    +static void sig_handler(int signum)
                     {
                     	switch (signum) {
                     		case SIGALRM:
                    @@ -70,7 +70,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[])
                     
                     	/* set signal handlers */
                     	memset(&act, 0x00, sizeof(act));
                    -	act.sa_handler = (void (*)(int)) sig_handler;
                    +	act.sa_handler = sig_handler;
                     	sigemptyset (&act.sa_mask);
                     	act.sa_flags = 0;
                     	sigaction(SIGALRM, &act, NULL);
                    diff --git a/udev/udevd.c b/udev/udevd.c
                    index ec6ee009cd..419c486ddd 100644
                    --- a/udev/udevd.c
                    +++ b/udev/udevd.c
                    @@ -67,10 +67,10 @@ static int debug_trace;
                     static struct udev_rules *rules;
                     static struct udev_ctrl *udev_ctrl;
                     static struct udev_monitor *kernel_monitor;
                    -static volatile int sigchilds_waiting;
                    -static volatile int udev_exit;
                    -static volatile int reload_config;
                    -static volatile int signal_received;
                    +static volatile sig_atomic_t sigchilds_waiting;
                    +static volatile sig_atomic_t udev_exit;
                    +static volatile sig_atomic_t reload_config;
                    +static volatile sig_atomic_t signal_received;
                     static volatile pid_t settle_pid;
                     static int run_exec_q;
                     static int stop_exec_q;
                    @@ -172,10 +172,10 @@ static void event_queue_delete(struct udev_event *event)
                     	udev_event_unref(event);
                     }
                     
                    -static void asmlinkage event_sig_handler(int signum)
                    +static void event_sig_handler(int signum)
                     {
                     	if (signum == SIGALRM)
                    -		exit(1);
                    +		_exit(1);
                     }
                     
                     static void event_fork(struct udev_event *event)
                    @@ -202,7 +202,7 @@ static void event_fork(struct udev_event *event)
                     
                     		/* set signal handlers */
                     		memset(&act, 0x00, sizeof(act));
                    -		act.sa_handler = (void (*)(int)) event_sig_handler;
                    +		act.sa_handler = event_sig_handler;
                     		sigemptyset (&act.sa_mask);
                     		act.sa_flags = 0;
                     		sigaction(SIGALRM, &act, NULL);
                    @@ -570,7 +570,7 @@ static int handle_inotify(struct udev *udev)
                     	return 0;
                     }
                     
                    -static void asmlinkage sig_handler(int signum)
                    +static void sig_handler(int signum)
                     {
                     	switch (signum) {
                     		case SIGINT:
                    @@ -894,7 +894,7 @@ int main(int argc, char *argv[])
                     
                     	/* set signal handlers */
                     	memset(&act, 0x00, sizeof(struct sigaction));
                    -	act.sa_handler = (void (*)(int)) sig_handler;
                    +	act.sa_handler = sig_handler;
                     	sigemptyset(&act.sa_mask);
                     	act.sa_flags = SA_RESTART;
                     	sigaction(SIGINT, &act, NULL);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From d67e32aeb2b64bba0db8840f5e679d3f76b3ffc5 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Tue, 5 May 2009 12:43:42 +0200
                    Subject: rules: fix ieee1394 rules
                    
                    ---
                     rules/rules.d/50-udev-default.rules | 4 ++--
                     1 file changed, 2 insertions(+), 2 deletions(-)
                    
                    diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules
                    index 5f73866ada..87c8977347 100644
                    --- a/rules/rules.d/50-udev-default.rules
                    +++ b/rules/rules.d/50-udev-default.rules
                    @@ -44,8 +44,8 @@ SUBSYSTEM=="drm",		GROUP="video"
                     SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}", GROUP="video"
                     
                     # Firewire
                    -KERNEL=="dv1394[0-9]*",		NAME="dv1394/%n", GROUP="video"
                    -KERNEL=="video1394[0-9]*",	NAME="video1394/%n", GROUP="video"
                    +KERNEL=="dv1394-[0-9]*",	NAME="dv1394/%n", GROUP="video"
                    +KERNEL=="video1394-[0-9]*",	NAME="video1394/%n", GROUP="video"
                     
                     # libusb device nodes
                     SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0664"
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 4a74214a585ce3a6130ed8c5c383bc4db0112326 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Thu, 7 May 2009 13:24:40 +0200
                    Subject: add "static" back to the inline functions
                    
                     kay: udev git head ftbfs
                     udev-watch.o: In function `udev_selinux_init':
                     /../udev/udev.h:130: multiple definition of `udev_selinux_init'
                    ---
                     udev/udev.h | 10 +++++-----
                     1 file changed, 5 insertions(+), 5 deletions(-)
                    
                    diff --git a/udev/udev.h b/udev/udev.h
                    index 478a51f3dc..abf354a668 100644
                    --- a/udev/udev.h
                    +++ b/udev/udev.h
                    @@ -127,11 +127,11 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string,
                     
                     /* udev-selinux.c */
                     #ifndef USE_SELINUX
                    -inline void udev_selinux_init(struct udev *udev) {}
                    -inline void udev_selinux_exit(struct udev *udev) {}
                    -inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
                    -inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
                    -inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
                    +static inline void udev_selinux_init(struct udev *udev) {}
                    +static inline void udev_selinux_exit(struct udev *udev) {}
                    +static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {}
                    +static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {}
                    +static inline void udev_selinux_resetfscreatecon(struct udev *udev) {}
                     #else
                     void udev_selinux_init(struct udev *udev);
                     void udev_selinux_exit(struct udev *udev);
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From 86d9bf4bece6d42d2ed91e99bf2773c6b5c30ec3 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 11 May 2009 03:53:55 +0200
                    Subject: update TODO
                    
                    ---
                     TODO | 5 ++++-
                     1 file changed, 4 insertions(+), 1 deletion(-)
                    
                    diff --git a/TODO b/TODO
                    index fe7eb17063..58875afc2b 100644
                    --- a/TODO
                    +++ b/TODO
                    @@ -1,9 +1,12 @@
                    -
                    +  udev 142:
                    +  o add udev_monitor_filter_add_match_property()
                       o add tests for kernel provided DEVNAME logic
                    +
                       o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30)
                       o remove MMC rules, they got a modalias now (2.6.30)
                       o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30)
                     
                    +  o convert readdir loops to unlinkat(), fstatat()
                       o implement path_id in C with libudev (?)
                       o convert firmware.sh to C (?)
                     
                    -- 
                    cgit v1.2.3-54-g00ecf
                    
                    
                    From f07996885dab45102492d7f16e7e2997e264c725 Mon Sep 17 00:00:00 2001
                    From: Kay Sievers 
                    Date: Mon, 11 May 2009 04:12:23 +0200
                    Subject: delete vol_id and require util-linux-ng's blkid
                    
                    ---
                     NEWS                                      |   9 +-
                     extras/volume_id/Makefile.am              |  27 ---
                     extras/volume_id/README                   |  66 ------
                     extras/volume_id/vol_id.c                 | 328 ------------------------------
                     extras/volume_id/vol_id.xml               | 151 --------------
                     rules/packages/64-md-raid.rules           |   2 +-
                     rules/rules.d/60-persistent-storage.rules |   4 +-
                     rules/suse/64-device-mapper.rules         |   2 +-
                     8 files changed, 12 insertions(+), 577 deletions(-)
                     delete mode 100644 extras/volume_id/README
                     delete mode 100644 extras/volume_id/vol_id.c
                     delete mode 100644 extras/volume_id/vol_id.xml
                    
                    diff --git a/NEWS b/NEWS
                    index 91698d5380..e743b11844 100644
                    --- a/NEWS
                    +++ b/NEWS
                    @@ -2,6 +2,11 @@ udev 142
                     ========
                     Bugfixes.
                     
                    +The program vol_id is removed from the repository and blkid from the
                    +latest util-linux-ng package replaces it. Persisten disk links for
                    +label and uuid depend on the util-linux-ng version of blkid now. Older
                    +versions can not be used with udev.
                    +
                     Libudev allows to subscribe to udev events. To prevent unwanted messages
                     to be delivered, and waking up the subscribing process, a filter can be
                     installed, to drop messages inside a kernel socket filter. The filters
                    @@ -15,7 +20,9 @@ are expected anymore, and a first stable release should happen soon.
                     
                     A too old kernel (2.6.21) or a kernel with CONFIG_SYSFS_DEPRECATED
                     is not supported since while and udevd will log an error message at
                    -startup.
                    +startup. It should still be able to boot-up, but advanced rules and system
                    +services which depend on the information not available in the old sysfs
                    +format will fail to work correctly.
                     
                     DVB device naming is supplied by the kernel now. In case older kernels
                     need to be supported, the old shell script should be added to a compat
                    diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am
                    index 4a8ba94654..e4d2e7f1f1 100644
                    --- a/extras/volume_id/Makefile.am
                    +++ b/extras/volume_id/Makefile.am
                    @@ -2,30 +2,3 @@ include $(top_srcdir)/Makefile.am.inc
                     
                     SUBDIRS = \
                     	lib
                    -
                    -udevhomedir = $(udev_prefix)/lib/udev
                    -udevhome_PROGRAMS = \
                    -	vol_id
                    -
                    -vol_id_SOURCES = \
                    -	vol_id.c \
                    -	../../udev/lib/libudev.h \
                    -	../../udev/lib/libudev.c \
                    -	../../udev/lib/libudev-list.c \
                    -	../../udev/lib/libudev-util.c
                    -
                    -vol_id_LDADD = \
                    -	lib/libvolume_id.la
                    -
                    -dist_man_MANS = \
                    -	vol_id.8
                    -
                    -EXTRA_DIST = \
                    -	vol_id.xml
                    -
                    -%.7 %.8 : %.xml
                    -	$(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
                    -
                    -MAINTAINERCLEANFILES= \
                    -	$(dist_man_MANS)
                    -
                    diff --git a/extras/volume_id/README b/extras/volume_id/README
                    deleted file mode 100644
                    index 9459c880f8..0000000000
                    --- a/extras/volume_id/README
                    +++ /dev/null
                    @@ -1,66 +0,0 @@
                    -vol_id - probe filesystem and read label and uuid
                    -
                    -vol_id will only return with a non-zero exit code if the string asked for,
                    -is not empty. All trailing whitespace will be removed, spaces replaced by
                    -underscore and slashes ignored.
                    -Unmangled values are available in the --export mode as hex-encoded strings
                    -in *_ENC= keys.
                    -
                    -  $ extras/volume_id/vol_id --export /dev/sda6
                    -  ID_FS_USAGE=filesystem
                    -  ID_FS_TYPE=ext3
                    -  ID_FS_VERSION=1.0
                    -  ID_FS_UUID=3e999973-00c9-4917-9442-b7633bd95b9e
                    -  ID_FS_UUID_ENC=3e999973-00c9-4917-9442-b7633bd95b9e
                    -  ID_FS_LABEL=devel
                    -  ID_FS_LABEL_ENC=devel
                    -
                    -  $ extras/volume_id/vol_id --label /dev/sda6
                    -  devel
                    -
                    -  $ extras/volume_id/vol_id --type /dev/sda6
                    -  ext3
                    -
                    -
                    -fstype                 probe  label  uuid  version
                    ---------------------------------------------------
                    -linux swap             *      *      *     *
                    -btrfs                  *      *      *     -
                    -ext                    *      *      *     *
                    -reiserfs jr/3.5/3.6/4  *      *      *     *
                    -fat (12, 16, 32)       *      *      *     *
                    -ntfs                   *      *      *     *
                    -jfs                    *      *      *     -
                    -xfs                    *      *      *     -
                    -hfs (plus, wrapped)    *      *      *     -
                    -udf                    *      *      -     -
                    -iso9660                *      *      -     -
                    -ufs                    *      -      -     -
                    -cramfs                 *      *      -     -
                    -sysv                   *      *      -     *
                    -luks                   *      -      *     -
                    -hpfs                   *      *      -     -
                    -romfs                  *      *      -     -
                    -squashfs               *      -      -     -
                    -minix                  *      -      -     *
                    -ocfs (1, 2)            *      *      *     *
                    -vxfs                   *      -      -     *
                    -nss (netware)          *      -      *     *
                    -gfs, gfs2              *      *      *     -
                    -oracleasm              *      *      -     -
                    -
                    -Raid members are detected to prevent the probing for a filesystem
                    ------------------------------------------------------------------
                    -linux raid (md)        *      *      *     *
                    -LVM 1                  *      -      -     -
                    -LVM 2                  *      -      -     *
                    -ddf                    *      -      *     *
                    -highpoint              *      -      -     -
                    -isw_raid               *      -      -     -
                    -lsi_raid               *      -      -     -
                    -nvidia_raid            *      -      -     -
                    -promise_raid           *      -      -     -
                    -silicon_raid           *      -      -     -
                    -via_raid               *      -      -     -
                    -jmicron                *      -      -     -
                    -adaptec                *      -      -     -
                    diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c
                    deleted file mode 100644
                    index 3e44c3b069..0000000000
                    --- a/extras/volume_id/vol_id.c
                    +++ /dev/null
                    @@ -1,328 +0,0 @@
                    -/*
                    - * vol_id - read filesystem label and uuid
                    - *
                    - * Copyright (C) 2005-2008 Kay Sievers 
                    - *
                    - * 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, either version 2 of the License, or
                    - * (at your option) any later version.
                    - *
                    - * 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, see .
                    - */
                    -
                    -#ifndef _GNU_SOURCE
                    -#define _GNU_SOURCE 1
                    -#endif
                    -
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -#include 
                    -
                    -#include "../../udev/udev.h"
                    -#include "lib/libvolume_id.h"
                    -
                    -#define BLKGETSIZE64 _IOR(0x12,114,size_t)
                    -
                    -static int debug;
                    -struct udev *udev_ctx;
                    -
                    -static void log_fn(struct udev *udev, int priority,
                    -		   const char *file, int line, const char *fn,
                    -		   const char *format, va_list args)
                    -{
                    -	if (debug) {
                    -		fprintf(stderr, "%s: ", fn != NULL ? fn : file);
                    -		vfprintf(stderr, format, args);
                    -	} else {
                    -		vsyslog(priority, format, args);
                    -	}
                    -}
                    -
                    -static void vid_log(int priority, const char *file, int line, const char *format, ...)
                    -{
                    -	va_list args;
                    -
                    -	if (priority > udev_get_log_priority(udev_ctx))
                    -		return;
                    -	va_start(args, format);
                    -	log_fn(udev_ctx, priority, file, line, NULL, format, args);
                    -	va_end(args);
                    -	return;
                    -}
                    -
                    -static int all_probers(volume_id_probe_fn_t probe_fn,
                    -		       struct volume_id *id, uint64_t off, uint64_t size,
                    -		       void *data)
                    -{
                    -	const char *type;
                    -
                    -	if (probe_fn(id, off, size) == 0)
                    -		if (volume_id_get_type(id, &type))
                    -			printf("%s\n", type);
                    -
                    -	return 0;
                    -}
                    -
                    -int main(int argc, char *argv[])
                    -{
                    -	static const struct option options[] = {
                    -		{ "label", no_argument, NULL, 'l' },
                    -		{ "label-raw", no_argument, NULL, 'L' },
                    -		{ "uuid", no_argument, NULL, 'u' },
                    -		{ "type", no_argument, NULL, 't' },
                    -		{ "export", no_argument, NULL, 'x' },
                    -		{ "skip-raid", no_argument, NULL, 's' },
                    -		{ "size", required_argument, NULL, 'S' },
                    -		{ "probe-all", no_argument, NULL, 'a' },
                    -		{ "offset", optional_argument, NULL, 'o' },
                    -		{ "debug", no_argument, NULL, 'd' },
                    -		{ "help", no_argument, NULL, 'h' },
                    -		{}
                    -	};
                    -
                    -	enum print_type {
                    -		PRINT_EXPORT,
                    -		PRINT_TYPE,
                    -		PRINT_LABEL,
                    -		PRINT_UUID,
                    -		PRINT_LABEL_RAW,
                    -	} print = PRINT_EXPORT;
                    -
                    -	struct volume_id *vid = NULL;
                    -	char label_safe[256];
                    -	char label_enc[256];
                    -	char uuid_safe[256];
                    -	char uuid_enc[256];
                    -	char uuid_sub_enc[256];
                    -	char type_enc[256];
                    -	char type_version_enc[256];
                    -	uint64_t size = 0;
                    -	int skip_raid = 0;
                    -	int probe_all = 0;
                    -	uint64_t offset = 0;
                    -	const char *node;
                    -	int fd;
                    -	const char *label, *uuid, *uuid_sub, *type, *type_version, *usage;
                    -	int retval;
                    -	int rc = 0;
                    -
                    -	udev_ctx = udev_new();
                    -	if (udev_ctx == NULL)
                    -		goto exit;
                    -	logging_init("vol_id");
                    -	udev_set_log_fn(udev_ctx, log_fn);
                    -
                    -	/* hook in our debug into libvolume_id */
                    -	volume_id_log_fn = vid_log;
                    -
                    -	while (1) {
                    -		int option;
                    -
                    -		option = getopt_long(argc, argv, "lLutxsS:aodh", options, NULL);
                    -		if (option == -1)
                    -			break;
                    -
                    -		switch (option) {
                    -		case 'd':
                    -			debug = 1;
                    -			if (udev_get_log_priority(udev_ctx) < LOG_INFO)
                    -				udev_set_log_priority(udev_ctx, LOG_INFO);
                    -			break;
                    -		case 'l':
                    -			print = PRINT_LABEL;
                    -			break;
                    -		case 'L':
                    -			print = PRINT_LABEL_RAW;
                    -			break;
                    -		case 'u':
                    -			print = PRINT_UUID;
                    -			break;
                    -		case 't':
                    -			print = PRINT_TYPE;
                    -			break;
                    -		case 'x':
                    -			print = PRINT_EXPORT;
                    -			break;
                    -		case 's':
                    -			skip_raid = 1;
                    -			break;
                    -		case 'a':
                    -			probe_all = 1;
                    -			break;
                    -		case 'S':
                    -			if (optarg[0] != '\0')
                    -				size = strtoull(optarg, NULL, 0);
                    -			break;
                    -		case 'o':
                    -			if (optarg[0] != '\0')
                    -				offset = strtoull(optarg, NULL, 0);
                    -			break;
                    -		case 'h':
                    -			printf("Usage: vol_id [options] \n"
                    -			    " --export         export key/value pairs\n"
                    -			    " --type           filesystem type\n"
                    -			    " --label          filesystem label\n"
                    -			    " --label-raw      raw label\n"
                    -			    " --uuid           filesystem uuid\n"
                    -			    " --skip-raid      don't probe for raid\n"
                    -			    " --probe-all      find possibly conflicting signatures\n"
                    -			    " --offset= probe at the given offset\n"
                    -			    " --size=   overwrite device size\n"
                    -			    " --debug          print debug output to stderr\n"
                    -			    " --help\n\n");
                    -			goto exit;
                    -		default:
                    -			retval = 1;
                    -			goto exit;
                    -		}
                    -	}
                    -
                    -	node = argv[optind];
                    -	if (!node) {
                    -		err(udev_ctx, "no device\n");
                    -		fprintf(stderr, "no device\n");
                    -		rc = 1;
                    -		goto exit;
                    -	}
                    -
                    -	fd = open(node, O_RDONLY);
                    -	if (fd < 0) {
                    -		fprintf(stderr, "%s: error opening volume\n", node);
                    -		rc = 2;
                    -		goto exit;
                    -	}
                    -
                    -	vid = volume_id_open_fd(fd);
                    -	if (vid == NULL) {
                    -		rc = 2;
                    -		goto exit;
                    -	}
                    -
                    -	if (size == 0) {
                    -		if (ioctl(fd, BLKGETSIZE64, &size) == 0) {
                    -			info(udev_ctx, "BLKGETSIZE64=%" PRIu64 " (%" PRIu64 "GB)\n", size, size >> 30);
                    -		} else {
                    -			struct stat statbuf;
                    -
                    -			if (fstat(fd, &statbuf) == 0 && S_ISREG(statbuf.st_mode))
                    -				size = statbuf.st_size;
                    -			else
                    -				size = 0;
                    -			info(udev_ctx, "stat=%" PRIu64 " (%" PRIu64 "GB)\n", size, size >> 30);
                    -		}
                    -	}
                    -
                    -	/* try to drop all privileges before reading disk content */
                    -	if (getuid() == 0) {
                    -		struct passwd *pw;
                    -
                    -		pw = getpwnam("nobody");
                    -		if (pw != NULL && pw->pw_uid > 0 && pw->pw_gid > 0) {
                    -			if (setgroups(0, NULL) != 0 ||
                    -			    setgid(pw->pw_gid) != 0 ||
                    -			    setuid(pw->pw_uid) != 0)
                    -				info(udev_ctx, "unable to drop privileges: %s\n\n", strerror(errno));
                    -		}
                    -	}
                    -
                    -	if (probe_all) {
                    -		volume_id_all_probers(all_probers, vid, offset, size, NULL);
                    -		goto exit;
                    -	}
                    -
                    -	if (skip_raid)
                    -		retval = volume_id_probe_filesystem(vid, offset, size);
                    -	else
                    -		retval = volume_id_probe_all(vid, offset, size);
                    -	if (retval != 0) {
                    -		fprintf(stderr, "unknown or non-unique volume type "
                    -				"(--probe-all lists possibly conflicting types)\n");
                    -		rc = 4;
                    -		goto exit;
                    -	}
                    -
                    -	if (!volume_id_get_label(vid, &label) ||
                    -	    !volume_id_get_usage(vid, &usage) ||
                    -	    !volume_id_get_type(vid, &type) ||
                    -	    !volume_id_get_type_version(vid, &type_version) ||
                    -	    !volume_id_get_uuid(vid, &uuid) ||
                    -	    !volume_id_get_uuid_sub(vid, &uuid_sub)) {
                    -		rc = 4;
                    -		goto exit;
                    -	}
                    -
                    -	udev_util_replace_whitespace(label, label_safe, sizeof(label_safe));
                    -	udev_util_replace_chars(label_safe, UDEV_ALLOWED_CHARS_INPUT);
                    -	volume_id_encode_string(label, label_enc, sizeof(label_enc));
                    -
                    -	udev_util_replace_whitespace(uuid, uuid_safe, sizeof(uuid_safe));
                    -	udev_util_replace_chars(uuid_safe, UDEV_ALLOWED_CHARS_INPUT);
                    -	volume_id_encode_string(uuid, uuid_enc, sizeof(uuid_enc));
                    -
                    -	volume_id_encode_string(uuid_sub, uuid_sub_enc, sizeof(uuid_sub_enc));
                    -
                    -	volume_id_encode_string(type, type_enc, sizeof(type_enc));
                    -	volume_id_encode_string(type_version, type_version_enc, sizeof(type_version_enc));
                    -
                    -	switch (print) {
                    -	case PRINT_EXPORT:
                    -		printf("ID_FS_USAGE=%s\n", usage);
                    -		printf("ID_FS_TYPE=%s\n", type_enc);
                    -		printf("ID_FS_VERSION=%s\n", type_version_enc);
                    -		printf("ID_FS_UUID=%s\n", uuid_safe);
                    -		printf("ID_FS_UUID_ENC=%s\n", uuid_enc);
                    -		if (uuid_sub_enc[0] != '\0')
                    -			printf("ID_FS_UUID_SUB_ENC=%s\n", uuid_sub_enc);
                    -		printf("ID_FS_LABEL=%s\n", label_safe);
                    -		printf("ID_FS_LABEL_ENC=%s\n", label_enc);
                    -		break;
                    -	case PRINT_TYPE:
                    -		printf("%s\n", type);
                    -		break;
                    -	case PRINT_LABEL:
                    -		if (label_safe[0] == '\0' || strcmp(usage, "raid") == 0) {
                    -			rc = 3;
                    -			goto exit;
                    -		}
                    -		printf("%s\n", label_safe);
                    -		break;
                    -	case PRINT_UUID:
                    -		if (uuid_enc[0] == '\0' || strcmp(usage, "raid") == 0) {
                    -			rc = 4;
                    -			goto exit;
                    -		}
                    -		printf("%s\n", uuid_enc);
                    -		break;
                    -	case PRINT_LABEL_RAW:
                    -		if (label[0] == '\0' || strcmp(usage, "raid") == 0) {
                    -			rc = 3;
                    -			goto exit;
                    -		}
                    -		printf("%s\n", label);
                    -		break;
                    -	}
                    -
                    -exit:
                    -	if (vid != NULL)
                    -		volume_id_close(vid);
                    -	udev_unref(udev_ctx);
                    -	logging_close();
                    -	return rc;
                    -}
                    diff --git a/extras/volume_id/vol_id.xml b/extras/volume_id/vol_id.xml
                    deleted file mode 100644
                    index 475e9bc389..0000000000
                    --- a/extras/volume_id/vol_id.xml
                    +++ /dev/null
                    @@ -1,151 +0,0 @@
                    -
                    -
                    -
                    -
                    -
                    - vol_id - - - vol_id - March 2006 - volume_id - - - - vol_id - 8 - - - - - vol_idprobe filesystem type and read label and uuid - - - - - vol_id - - - - - - - - - - - device - - - - DESCRIPTION - vol_id is usually called from a udev rule, to - provide udev with the filesystem type, the label and the uuid of a - volume. It supports most of the common filesystem formats and detects - various raid setups to prevent the recognition of raid members - as a volume with a filesystem. - - - OPTIONS - - - - - Print all values in key/value format to import them into the - environment. - - - - - - Print the filesystem type. - - - - - - - Print the safe version of volume label suitable for - use as filename. - - - - - - - - Print the raw volume label. - - - - - - - Print the uuid of a volume. - - - - - - Skip detection of raid metadata. - - - - - - Probe for all types and print all matches. - - - - - - Start probing at the given offset, instead of the beginning - of the volume. The offset value is specified in bytes. - - - - - - Print debug messages to stderr. - - - - - - Print usage. - - - - - - ENVIRONMENT - - - - - Set the syslog priority. - - - - - - EXIT STATUS - vol_id will only return successful if the - value asked for is not empty. All trailing whitespace will be removed, - spaces replaced by underscore and slashes ignored. - - - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org - - - - SEE ALSO - - udev7 - - - -
                    -
                    diff --git a/rules/packages/64-md-raid.rules b/rules/packages/64-md-raid.rules index 4faf18c106..6ba93b661e 100644 --- a/rules/packages/64-md-raid.rules +++ b/rules/packages/64-md-raid.rules @@ -27,7 +27,7 @@ ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n" ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n" -IMPORT{program}="vol_id --export $tempnode" +IMPORT{program}="/sbin/blkid -o udev -p $tempnode" OPTIONS+="link_priority=100" OPTIONS+="watch" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 409548893b..fea86d9310 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -55,10 +55,10 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" # probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="vol_id --export --skip-raid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" # probe filesystem metadata of disks -KERNEL!="sr*", IMPORT{program}="vol_id --export $tempnode" +KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" # watch for future changes KERNEL!="sr*", OPTIONS+="watch" diff --git a/rules/suse/64-device-mapper.rules b/rules/suse/64-device-mapper.rules index 15e7ddf755..2bffe8344a 100644 --- a/rules/suse/64-device-mapper.rules +++ b/rules/suse/64-device-mapper.rules @@ -14,7 +14,7 @@ ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}", OPTIONS+="strin ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end" ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" -IMPORT{program}="vol_id --export $tempnode" +IMPORT{program}="/sbin/blkid -o udev -p $tempnode" OPTIONS+="link_priority=-100" OPTIONS+="watch" ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90" -- cgit v1.2.3-54-g00ecf From 3de63a356f5a3dd34c8404e9775389389547d6d1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 12 May 2009 13:28:01 +0200 Subject: delete libvolume_id --- NEWS | 9 +- configure.ac | 11 - extras/Makefile.am | 3 +- extras/volume_id/.gitignore | 3 - extras/volume_id/Makefile.am | 4 - extras/volume_id/lib/.gitignore | 2 - extras/volume_id/lib/Makefile.am | 74 ---- extras/volume_id/lib/adaptec_raid.c | 116 ------ extras/volume_id/lib/btrfs.c | 102 ----- extras/volume_id/lib/cramfs.c | 69 ---- extras/volume_id/lib/ddf_raid.c | 94 ----- extras/volume_id/lib/exported_symbols | 17 - extras/volume_id/lib/ext.c | 203 ---------- extras/volume_id/lib/fat.c | 509 ------------------------ extras/volume_id/lib/gfs.c | 146 ------- extras/volume_id/lib/hfs.c | 325 --------------- extras/volume_id/lib/highpoint.c | 100 ----- extras/volume_id/lib/hpfs.c | 116 ------ extras/volume_id/lib/iso9660.c | 129 ------ extras/volume_id/lib/isw_raid.c | 70 ---- extras/volume_id/lib/jfs.c | 70 ---- extras/volume_id/lib/jmicron_raid.c | 66 ---- extras/volume_id/lib/libvolume_id-private.h | 187 --------- extras/volume_id/lib/libvolume_id.h | 55 --- extras/volume_id/lib/libvolume_id.pc.in | 10 - extras/volume_id/lib/linux_raid.c | 181 --------- extras/volume_id/lib/linux_swap.c | 104 ----- extras/volume_id/lib/lsi_raid.c | 64 --- extras/volume_id/lib/luks.c | 86 ---- extras/volume_id/lib/lvm.c | 113 ------ extras/volume_id/lib/md5.c | 213 ---------- extras/volume_id/lib/md5.h | 30 -- extras/volume_id/lib/minix.c | 122 ------ extras/volume_id/lib/netware.c | 108 ----- extras/volume_id/lib/ntfs.c | 203 ---------- extras/volume_id/lib/nvidia_raid.c | 68 ---- extras/volume_id/lib/ocfs.c | 198 ---------- extras/volume_id/lib/oracleasm.c | 70 ---- extras/volume_id/lib/promise_raid.c | 74 ---- extras/volume_id/lib/reiserfs.c | 123 ------ extras/volume_id/lib/romfs.c | 65 --- extras/volume_id/lib/silicon_raid.c | 81 ---- extras/volume_id/lib/squashfs.c | 76 ---- extras/volume_id/lib/sysv.c | 138 ------- extras/volume_id/lib/udf.c | 183 --------- extras/volume_id/lib/ufs.c | 227 ----------- extras/volume_id/lib/util.c | 449 --------------------- extras/volume_id/lib/via_raid.c | 97 ----- extras/volume_id/lib/volume_id.c | 592 ---------------------------- extras/volume_id/lib/vxfs.c | 59 --- extras/volume_id/lib/xfs.c | 70 ---- 51 files changed, 6 insertions(+), 6278 deletions(-) delete mode 100644 extras/volume_id/.gitignore delete mode 100644 extras/volume_id/Makefile.am delete mode 100644 extras/volume_id/lib/.gitignore delete mode 100644 extras/volume_id/lib/Makefile.am delete mode 100644 extras/volume_id/lib/adaptec_raid.c delete mode 100644 extras/volume_id/lib/btrfs.c delete mode 100644 extras/volume_id/lib/cramfs.c delete mode 100644 extras/volume_id/lib/ddf_raid.c delete mode 100644 extras/volume_id/lib/exported_symbols delete mode 100644 extras/volume_id/lib/ext.c delete mode 100644 extras/volume_id/lib/fat.c delete mode 100644 extras/volume_id/lib/gfs.c delete mode 100644 extras/volume_id/lib/hfs.c delete mode 100644 extras/volume_id/lib/highpoint.c delete mode 100644 extras/volume_id/lib/hpfs.c delete mode 100644 extras/volume_id/lib/iso9660.c delete mode 100644 extras/volume_id/lib/isw_raid.c delete mode 100644 extras/volume_id/lib/jfs.c delete mode 100644 extras/volume_id/lib/jmicron_raid.c delete mode 100644 extras/volume_id/lib/libvolume_id-private.h delete mode 100644 extras/volume_id/lib/libvolume_id.h delete mode 100644 extras/volume_id/lib/libvolume_id.pc.in delete mode 100644 extras/volume_id/lib/linux_raid.c delete mode 100644 extras/volume_id/lib/linux_swap.c delete mode 100644 extras/volume_id/lib/lsi_raid.c delete mode 100644 extras/volume_id/lib/luks.c delete mode 100644 extras/volume_id/lib/lvm.c delete mode 100644 extras/volume_id/lib/md5.c delete mode 100644 extras/volume_id/lib/md5.h delete mode 100644 extras/volume_id/lib/minix.c delete mode 100644 extras/volume_id/lib/netware.c delete mode 100644 extras/volume_id/lib/ntfs.c delete mode 100644 extras/volume_id/lib/nvidia_raid.c delete mode 100644 extras/volume_id/lib/ocfs.c delete mode 100644 extras/volume_id/lib/oracleasm.c delete mode 100644 extras/volume_id/lib/promise_raid.c delete mode 100644 extras/volume_id/lib/reiserfs.c delete mode 100644 extras/volume_id/lib/romfs.c delete mode 100644 extras/volume_id/lib/silicon_raid.c delete mode 100644 extras/volume_id/lib/squashfs.c delete mode 100644 extras/volume_id/lib/sysv.c delete mode 100644 extras/volume_id/lib/udf.c delete mode 100644 extras/volume_id/lib/ufs.c delete mode 100644 extras/volume_id/lib/util.c delete mode 100644 extras/volume_id/lib/via_raid.c delete mode 100644 extras/volume_id/lib/volume_id.c delete mode 100644 extras/volume_id/lib/vxfs.c delete mode 100644 extras/volume_id/lib/xfs.c diff --git a/NEWS b/NEWS index e743b11844..ba6668795a 100644 --- a/NEWS +++ b/NEWS @@ -2,10 +2,11 @@ udev 142 ======== Bugfixes. -The program vol_id is removed from the repository and blkid from the -latest util-linux-ng package replaces it. Persisten disk links for -label and uuid depend on the util-linux-ng version of blkid now. Older -versions can not be used with udev. +The program vol_id and the library libvolume_id is removed from the +repository. Libvolume_id is merged with libblkid from the util-linux-ng +package. Persistent disk links for label and uuid depend on the +util-linux-ng version (2.15) of blkid now. Older versions of blkid +can not be used with udev. Libudev allows to subscribe to udev events. To prevent unwanted messages to be delivered, and waking up the subscribing process, a filter can be diff --git a/configure.ac b/configure.ac index 3e078a4621..119bbb7859 100644 --- a/configure.ac +++ b/configure.ac @@ -21,14 +21,6 @@ AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) AC_SUBST(LIBUDEV_LT_AGE) -dnl /* libvolume_id version */ -VOLID_LT_CURRENT=2 -VOLID_LT_REVISION=0 -VOLID_LT_AGE=1 -AC_SUBST(VOLID_LT_CURRENT) -AC_SUBST(VOLID_LT_REVISION) -AC_SUBST(VOLID_LT_AGE) - AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_CHECK_LIB(c, inotify_init, @@ -97,9 +89,6 @@ AC_CONFIG_FILES([ extras/rule_generator/Makefile extras/scsi_id/Makefile extras/usb_id/Makefile - extras/volume_id/Makefile - extras/volume_id/lib/Makefile - extras/volume_id/lib/libvolume_id.pc ]) AC_OUTPUT diff --git a/extras/Makefile.am b/extras/Makefile.am index fc46668fdc..49a23d9777 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -11,5 +11,4 @@ SUBDIRS = \ fstab_import \ rule_generator \ scsi_id \ - usb_id \ - volume_id + usb_id diff --git a/extras/volume_id/.gitignore b/extras/volume_id/.gitignore deleted file mode 100644 index 3081cde4cb..0000000000 --- a/extras/volume_id/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -vol_id -*.8 - diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am deleted file mode 100644 index e4d2e7f1f1..0000000000 --- a/extras/volume_id/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -SUBDIRS = \ - lib diff --git a/extras/volume_id/lib/.gitignore b/extras/volume_id/lib/.gitignore deleted file mode 100644 index 33b7fea2be..0000000000 --- a/extras/volume_id/lib/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -libvolume_id.pc -libvolume_id.so* diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am deleted file mode 100644 index d5fd6560f1..0000000000 --- a/extras/volume_id/lib/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -rootlibdir = $(exec_prefix)/$(libdir_name) -rootlib_LTLIBRARIES = \ - libvolume_id.la - -include_HEADERS =\ - libvolume_id.h - -libvolume_id_la_SOURCES =\ - libvolume_id-private.h \ - volume_id.c \ - util.c \ - md5.h \ - md5.c \ - ext.c \ - fat.c \ - hfs.c \ - highpoint.c \ - isw_raid.c \ - lsi_raid.c \ - via_raid.c \ - silicon_raid.c \ - nvidia_raid.c \ - promise_raid.c \ - adaptec_raid.c \ - jmicron_raid.c \ - ddf_raid.c \ - iso9660.c \ - jfs.c \ - linux_raid.c \ - linux_swap.c \ - lvm.c \ - ntfs.c \ - reiserfs.c \ - udf.c \ - ufs.c \ - xfs.c \ - cramfs.c \ - hpfs.c \ - romfs.c \ - sysv.c \ - minix.c \ - gfs.c \ - luks.c \ - ocfs.c \ - vxfs.c \ - squashfs.c \ - netware.c \ - oracleasm.c \ - btrfs.c - -libvolume_id_la_LDFLAGS = \ - -version-info $(VOLID_LT_CURRENT):$(VOLID_LT_REVISION):$(VOLID_LT_AGE) \ - -export-symbols $(top_srcdir)/extras/volume_id/lib/exported_symbols - -# move devel files to $(prefix)$(libdir_name) if needed -install-data-hook: - rm $(DESTDIR)$(rootlibdir)/libvolume_id.la - if test "$(prefix)" != "$(exec_prefix)"; then \ - mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \ - mv $(DESTDIR)$(rootlibdir)/libvolume_id.a $(DESTDIR)$(prefix)/$(libdir_name)/; \ - so_img_name=$$(readlink $(DESTDIR)$(rootlibdir)/libvolume_id.so); \ - rm $(DESTDIR)$(rootlibdir)/libvolume_id.so; \ - so_img_rel_target_prefix=$$(echo $(prefix)/$(libdir_name) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ - ln -sf $$so_img_rel_target_prefix$(exec_prefix)/$(libdir_name)/$$so_img_name \ - $(DESTDIR)$(prefix)/$(libdir_name)/libvolume_id.so; \ - fi - -EXTRA_DIST = \ - exported_symbols - -pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig -pkgconfig_DATA = libvolume_id.pc diff --git a/extras/volume_id/lib/adaptec_raid.c b/extras/volume_id/lib/adaptec_raid.c deleted file mode 100644 index d20399c0ff..0000000000 --- a/extras/volume_id/lib/adaptec_raid.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2006 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct adaptec_meta { - uint32_t b0idcode; - uint8_t lunsave[8]; - uint16_t sdtype; - uint16_t ssavecyl; - uint8_t ssavehed; - uint8_t ssavesec; - uint8_t sb0flags; - uint8_t jbodEnable; - uint8_t lundsave; - uint8_t svpdirty; - uint16_t biosInfo; - uint16_t svwbskip; - uint16_t svwbcln; - uint16_t svwbmax; - uint16_t res3; - uint16_t svwbmin; - uint16_t res4; - uint16_t svrcacth; - uint16_t svwcacth; - uint16_t svwbdly; - uint8_t svsdtime; - uint8_t res5; - uint16_t firmval; - uint16_t firmbln; - uint32_t firmblk; - uint32_t fstrsvrb; - uint16_t svBlockStorageTid; - uint16_t svtid; - uint8_t svseccfl; - uint8_t res6; - uint8_t svhbanum; - uint8_t resver; - uint32_t drivemagic; - uint8_t reserved[20]; - uint8_t testnum; - uint8_t testflags; - uint16_t maxErrorCount; - uint32_t count; - uint32_t startTime; - uint32_t interval; - uint8_t tstxt0; - uint8_t tstxt1; - uint8_t serNum[32]; - uint8_t res8[102]; - uint32_t fwTestMagic; - uint32_t fwTestSeqNum; - uint8_t fwTestRes[8]; - uint8_t smagic[4]; - uint32_t raidtbl; - uint16_t raidline; - uint8_t res9[0xF6]; -} PACKED; - -int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct adaptec_meta *ad; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - ad = (struct adaptec_meta *) buf; - if (memcmp(ad->smagic, "DPTM", 4) != 0) - return -1; - - if (ad->b0idcode != be32_to_cpu(0x37FC4D1E)) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", ad->resver); - id->type = "adaptec_raid_member"; - - return 0; -} diff --git a/extras/volume_id/lib/btrfs.c b/extras/volume_id/lib/btrfs.c deleted file mode 100644 index 5ef979f2f0..0000000000 --- a/extras/volume_id/lib/btrfs.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct btrfs_super_block { - uint8_t csum[32]; - uint8_t fsid[16]; - uint64_t bytenr; - uint64_t flags; - uint8_t magic[8]; - uint64_t generation; - uint64_t root; - uint64_t chunk_root; - uint64_t log_root; - uint64_t log_root_transid; - uint64_t total_bytes; - uint64_t bytes_used; - uint64_t root_dir_objectid; - uint64_t num_devices; - uint32_t sectorsize; - uint32_t nodesize; - uint32_t leafsize; - uint32_t stripesize; - uint32_t sys_chunk_array_size; - uint64_t chunk_root_generation; - uint64_t compat_flags; - uint64_t compat_ro_flags; - uint64_t incompat_flags; - uint16_t csum_type; - uint8_t root_level; - uint8_t chunk_root_level; - uint8_t log_root_level; - struct btrfs_dev_item { - uint64_t devid; - uint64_t total_bytes; - uint64_t bytes_used; - uint32_t io_align; - uint32_t io_width; - uint32_t sector_size; - uint64_t type; - uint64_t generation; - uint64_t start_offset; - uint32_t dev_group; - uint8_t seek_speed; - uint8_t bandwidth; - uint8_t uuid[16]; - uint8_t fsid[16]; - } PACKED dev_item; - uint8_t label[256]; -} PACKED; - -int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct btrfs_super_block *bfs; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - buf = volume_id_get_buffer(id, off + 0x10000, 0x200); - if (buf == NULL) - return -1; - bfs = (struct btrfs_super_block *)buf; - if (memcmp(bfs->magic, "_BHRfS_M", 8) != 0) - return -1; - volume_id_set_uuid(id, bfs->fsid, 0, UUID_DCE); - volume_id_set_uuid_sub(id, bfs->dev_item.uuid, 0, UUID_DCE); - volume_id_set_label_raw(id, bfs->label, 256); - volume_id_set_label_string(id, bfs->label, 256); - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "btrfs"; - return 0; -} diff --git a/extras/volume_id/lib/cramfs.c b/extras/volume_id/lib/cramfs.c deleted file mode 100644 index b6460da5df..0000000000 --- a/extras/volume_id/lib/cramfs.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct cramfs_super { - uint8_t magic[4]; - uint32_t size; - uint32_t flags; - uint32_t future; - uint8_t signature[16]; - struct cramfs_info { - uint32_t crc; - uint32_t edition; - uint32_t blocks; - uint32_t files; - } PACKED info; - uint8_t name[16]; -} PACKED; - -int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct cramfs_super *cs; - - info("probing at offset 0x%" PRIx64 "\n", off); - - cs = (struct cramfs_super *) volume_id_get_buffer(id, off, 0x200); - if (cs == NULL) - return -1; - - if (memcmp(cs->magic, "\x45\x3d\xcd\x28", 4) == 0 || memcmp(cs->magic, "\x28\xcd\x3d\x45", 4) == 0) { - volume_id_set_label_raw(id, cs->name, 16); - volume_id_set_label_string(id, cs->name, 16); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "cramfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/lib/ddf_raid.c b/extras/volume_id/lib/ddf_raid.c deleted file mode 100644 index 32f20ced49..0000000000 --- a/extras/volume_id/lib/ddf_raid.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2007 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -/* http://www.snia.org/standards/home */ - -#define DDF_GUID_LENGTH 24 -#define DDF_REV_LENGTH 8 - -struct ddf_header { - uint8_t signature[4]; - uint32_t crc; - uint8_t guid[DDF_GUID_LENGTH]; - uint8_t ddf_rev[DDF_REV_LENGTH]; -} PACKED; - -int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - uint64_t ddf_off; - const uint8_t *buf; - struct ddf_header *ddf; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - if (size < 0x30000) - return -1; - - /* header at last sector */ - ddf_off = ((size / 0x200)-1) * 0x200; - buf = volume_id_get_buffer(id, off + ddf_off, 0x200); - if (buf == NULL) - return -1; - ddf = (struct ddf_header *) buf; - if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0) { - info("header (little endian) found at %" PRIu64 "\n", (off + ddf_off)); - goto found; - } - if (memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0) { - info("header (big endian) found at %" PRIu64 "\n", (off + ddf_off)); - goto found; - } - - /* adaptec non-standard header location */ - ddf_off = ((size / 0x200)-257) * 0x200; - buf = volume_id_get_buffer(id, off + ddf_off, 0x200); - if (buf == NULL) - return -1; - ddf = (struct ddf_header *) buf; - if (memcmp(ddf->signature, "\x11\xde\x11\xde", 4) == 0) { - info("header adaptec (little endian) found at %" PRIu64 "\n", (off + ddf_off)); - goto found; - } - if (memcmp(ddf->signature, "\xde\x11\xde\x11", 4) == 0) { - info("header adaptec (big endian) found at %" PRIu64 "\n", (off + ddf_off)); - goto found; - } - - return -1; -found: - volume_id_set_uuid(id, ddf->guid, DDF_GUID_LENGTH, UUID_STRING); - snprintf(id->type_version, DDF_REV_LENGTH + 1, "%s", ddf->ddf_rev); - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "ddf_raid_member"; - return 0; -} diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols deleted file mode 100644 index 215a267dad..0000000000 --- a/extras/volume_id/lib/exported_symbols +++ /dev/null @@ -1,17 +0,0 @@ -volume_id_log_fn -volume_id_get_label -volume_id_get_label_raw -volume_id_get_uuid -volume_id_get_uuid_raw -volume_id_get_uuid_sub -volume_id_get_usage -volume_id_get_type -volume_id_get_type_version -volume_id_open_fd -volume_id_close -volume_id_probe_all -volume_id_probe_filesystem -volume_id_probe_raid -volume_id_all_probers -volume_id_get_prober_by_type -volume_id_encode_string diff --git a/extras/volume_id/lib/ext.c b/extras/volume_id/lib/ext.c deleted file mode 100644 index 13ec470291..0000000000 --- a/extras/volume_id/lib/ext.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004-2008 Kay Sievers - * Copyright (C) 2008 Theodore Ts'o - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct ext2_super_block { - uint32_t s_inodes_count; - uint32_t s_blocks_count; - uint32_t s_r_blocks_count; - uint32_t s_free_blocks_count; - uint32_t s_free_inodes_count; - uint32_t s_first_data_block; - uint32_t s_log_block_size; - uint32_t s_log_frag_size; - uint32_t s_blocks_per_group; - uint32_t s_frags_per_group; - uint32_t s_inodes_per_group; - uint32_t s_mtime; - uint32_t s_wtime; - uint16_t s_mnt_count; - uint16_t s_max_mnt_count; - uint16_t s_magic; - uint16_t s_state; - uint16_t s_errors; - uint16_t s_minor_rev_level; - uint32_t s_lastcheck; - uint32_t s_checkinterval; - uint32_t s_creator_os; - uint32_t s_rev_level; - uint16_t s_def_resuid; - uint16_t s_def_resgid; - uint32_t s_first_ino; - uint16_t s_inode_size; - uint16_t s_block_group_nr; - uint32_t s_feature_compat; - uint32_t s_feature_incompat; - uint32_t s_feature_ro_compat; - uint8_t s_uuid[16]; - uint8_t s_volume_name[16]; - uint8_t s_last_mounted[64]; - uint32_t s_algorithm_usage_bitmap; - uint8_t s_prealloc_blocks; - uint8_t s_prealloc_dir_blocks; - uint16_t s_reserved_gdt_blocks; - uint8_t s_journal_uuid[16]; - uint32_t s_journal_inum; - uint32_t s_journal_dev; - uint32_t s_last_orphan; - uint32_t s_hash_seed[4]; - uint8_t s_def_hash_version; - uint8_t s_jnl_backup_type; - uint16_t s_reserved_word_pad; - uint32_t s_default_mount_opts; - uint32_t s_first_meta_bg; - uint32_t s_mkfs_time; - uint32_t s_jnl_blocks[17]; - uint32_t s_blocks_count_hi; - uint32_t s_r_blocks_count_hi; - uint32_t s_free_blocks_hi; - uint16_t s_min_extra_isize; - uint16_t s_want_extra_isize; - uint32_t s_flags; -} PACKED; - -#define EXT_SUPER_MAGIC 0xEF53 -#define EXT2_FLAGS_TEST_FILESYS 0x0004 -#define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 -#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 -#define EXT2_FEATURE_RO_COMPAT_BTREE_DIR 0x0004 -#define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 -#define EXT2_FEATURE_INCOMPAT_META_BG 0x0010 -#define EXT3_FEATURE_COMPAT_HAS_JOURNAL 0x0004 -#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 -#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 - - -#define EXT2_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ - EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ - EXT2_FEATURE_RO_COMPAT_BTREE_DIR) -#define EXT2_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT2_FEATURE_RO_COMPAT_SUPP - -#define EXT2_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ - EXT2_FEATURE_INCOMPAT_META_BG) -#define EXT2_FEATURE_INCOMPAT_UNSUPPORTED ~EXT2_FEATURE_INCOMPAT_SUPP - -#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER| \ - EXT2_FEATURE_RO_COMPAT_LARGE_FILE| \ - EXT2_FEATURE_RO_COMPAT_BTREE_DIR) -#define EXT3_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT3_FEATURE_RO_COMPAT_SUPP - -#define EXT3_FEATURE_INCOMPAT_SUPP (EXT2_FEATURE_INCOMPAT_FILETYPE| \ - EXT3_FEATURE_INCOMPAT_RECOVER| \ - EXT2_FEATURE_INCOMPAT_META_BG) -#define EXT3_FEATURE_INCOMPAT_UNSUPPORTED ~EXT3_FEATURE_INCOMPAT_SUPP - -#define EXT_SUPERBLOCK_OFFSET 0x400 -#define EXT3_MIN_BLOCK_SIZE 0x400 -#define EXT3_MAX_BLOCK_SIZE 0x1000 - -int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct ext2_super_block *es; - size_t bsize; - uint32_t feature_compat; - uint32_t feature_ro_compat; - uint32_t feature_incompat; - uint32_t flags; - - info("probing at offset 0x%" PRIx64 "\n", off); - - es = (struct ext2_super_block *) volume_id_get_buffer(id, off + EXT_SUPERBLOCK_OFFSET, 0x200); - if (es == NULL) - return -1; - - if (es->s_magic != cpu_to_le16(EXT_SUPER_MAGIC)) - return -1; - - bsize = 0x400 << le32_to_cpu(es->s_log_block_size); - dbg("ext blocksize 0x%zx\n", bsize); - if (bsize < EXT3_MIN_BLOCK_SIZE || bsize > EXT3_MAX_BLOCK_SIZE) { - dbg("invalid ext blocksize\n"); - return -1; - } - - feature_compat = le32_to_cpu(es->s_feature_compat); - feature_ro_compat = le32_to_cpu(es->s_feature_ro_compat); - feature_incompat = le32_to_cpu(es->s_feature_incompat); - flags = le32_to_cpu(es->s_flags); - - /* external journal device is jbd */ - if ((feature_incompat & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV) != 0) { - volume_id_set_usage(id, VOLUME_ID_OTHER); - id->type = "jbd"; - goto found; - } - - /* has journal */ - if ((feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) != 0) { - /* "use on development code" is ext4dev */ - if ((flags & EXT2_FLAGS_TEST_FILESYS) != 0) { - id->type = "ext4dev"; - goto found; - } - - /* incompatible ext3 features is ext4 */ - if ((feature_ro_compat & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) != 0 || - (feature_incompat & EXT3_FEATURE_INCOMPAT_UNSUPPORTED) != 0) { - id->type = "ext4"; - goto found; - } - - id->type = "ext3"; - goto found; - } else { - /* no incompatible ext2 feature is ext2 */ - if ((feature_ro_compat & EXT2_FEATURE_RO_COMPAT_UNSUPPORTED) == 0 && - (feature_incompat & EXT2_FEATURE_INCOMPAT_UNSUPPORTED) == 0) { - id->type = "ext2"; - goto found; - } - } - - return -1; - -found: - volume_id_set_label_raw(id, es->s_volume_name, 16); - volume_id_set_label_string(id, es->s_volume_name, 16); - volume_id_set_uuid(id, es->s_uuid, 0, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", - le32_to_cpu(es->s_rev_level), le16_to_cpu(es->s_minor_rev_level)); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - return 0; -} diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c deleted file mode 100644 index c0cfed82c0..0000000000 --- a/extras/volume_id/lib/fat.c +++ /dev/null @@ -1,509 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004-2007 Kay Sievers - * Copyright (C) 2007 Ryan Lortie - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -#define FAT12_MAX 0xff5 -#define FAT16_MAX 0xfff5 -#define FAT_ATTR_VOLUME_ID 0x08 -#define FAT_ATTR_DIR 0x10 -#define FAT_ATTR_LONG_NAME 0x0f -#define FAT_ATTR_MASK 0x3f -#define FAT_ENTRY_FREE 0xe5 - -#define VFAT_LFN_SEQ_MASK 0x3f -#define VFAT_LFN_SEQ_LAST 0x40 -#define VFAT_LFN_SEQ_MAX 20 -#define VFAT_LFN_CHARS_PER_ENTRY (5 + 6 + 2) -#define VFAT_LOWERCASE_NAME 0x10 -#define VFAT_LOWERCASE_EXT 0x08 - -struct vfat_super_block { - uint8_t boot_jump[3]; - uint8_t sysid[8]; - uint16_t sector_size; - uint8_t sectors_per_cluster; - uint16_t reserved; - uint8_t fats; - uint16_t dir_entries; - uint16_t sectors; - uint8_t media; - uint16_t fat_length; - uint16_t secs_track; - uint16_t heads; - uint32_t hidden; - uint32_t total_sect; - union { - struct fat_super_block { - uint8_t unknown[3]; - uint8_t serno[4]; - uint8_t label[11]; - uint8_t magic[8]; - uint8_t dummy2[192]; - uint8_t pmagic[2]; - } PACKED fat; - struct fat32_super_block { - uint32_t fat32_length; - uint16_t flags; - uint8_t version[2]; - uint32_t root_cluster; - uint16_t fsinfo_sector; - uint16_t backup_boot; - uint16_t reserved2[6]; - uint8_t unknown[3]; - uint8_t serno[4]; - uint8_t label[11]; - uint8_t magic[8]; - uint8_t dummy2[164]; - uint8_t pmagic[2]; - } PACKED fat32; - } PACKED type; -} PACKED; - -struct fat32_fsinfo { - uint8_t signature1[4]; - uint32_t reserved1[120]; - uint8_t signature2[4]; - uint32_t free_clusters; - uint32_t next_cluster; - uint32_t reserved2[4]; -} PACKED; - -struct vfat_dir_entry { - uint8_t name[11]; - uint8_t attr; - uint8_t lowercase; - uint8_t fine_time_creat; - uint16_t time_creat; - uint16_t date_creat; - uint16_t date_acc; - uint16_t cluster_high; - uint16_t time_write; - uint16_t date_write; - uint16_t cluster_low; - uint32_t size; -} PACKED; - - -struct vfat_lfn_entry { - uint8_t seq; - uint16_t name0[5]; - uint8_t attr; - uint8_t reserved; - uint8_t cksum; - uint16_t name1[6]; - uint16_t cluster; - uint16_t name2[2]; -} PACKED; - -static uint8_t fat_lfn_checksum(const uint8_t name[11]) -{ - uint8_t cksum = 0; - int i; - - /* http://en.wikipedia.org/wiki/File_Allocation_Table */ - for (i = 0; i < 11; i++) - cksum = ((cksum & 1) ? 0x80 : 0) + (cksum >> 1) + name[i]; - - return cksum; -} - -static size_t fat_read_lfn(uint8_t *filename, size_t fnsize, - struct vfat_dir_entry *dir, - struct vfat_dir_entry *entry) -{ - uint8_t buffer[VFAT_LFN_SEQ_MAX * VFAT_LFN_CHARS_PER_ENTRY * 2]; - uint8_t expected_seq = 1; - uint8_t cksum; - size_t len = 0; - size_t fnlen = 0; - - cksum = fat_lfn_checksum(entry->name); - - while (--entry >= dir) { - struct vfat_lfn_entry *lfn = (struct vfat_lfn_entry *) entry; - - if (expected_seq > VFAT_LFN_SEQ_MAX) - break; - - if ((lfn->attr & FAT_ATTR_MASK) != FAT_ATTR_LONG_NAME) - break; - - if (lfn->cksum != cksum) - break; - - if ((lfn->seq & VFAT_LFN_SEQ_MASK) != expected_seq++) - break; - - if (lfn->cluster != 0) - break; - - /* extra paranoia -- should never happen */ - if (len + sizeof(lfn->name0) + sizeof(lfn->name1) + - sizeof(lfn->name2) > sizeof(buffer)) - break; - - memcpy (&buffer[len], lfn->name0, sizeof(lfn->name0)); - len += sizeof(lfn->name0); - memcpy (&buffer[len], lfn->name1, sizeof(lfn->name1)); - len += sizeof(lfn->name1); - memcpy (&buffer[len], lfn->name2, sizeof(lfn->name2)); - len += sizeof(lfn->name2); - - if (lfn->seq & VFAT_LFN_SEQ_LAST) { - fnlen = volume_id_set_unicode16(filename, fnsize, buffer, LE, len); - break; - } - } - - return fnlen; -} - -static size_t fat_read_filename(uint8_t *filename, size_t fnsize, - struct vfat_dir_entry *dir, struct vfat_dir_entry *entry) -{ - size_t len; - int i; - - /* check if maybe we have LFN entries */ - len = fat_read_lfn(filename, fnsize, dir, entry); - if (len > 0) - goto out; - - /* else, read the normal 8.3 name */ - for (i = 0; i < 11; i++) { - if (entry->lowercase & ((i < 8) ? VFAT_LOWERCASE_NAME : VFAT_LOWERCASE_EXT)) - filename[i] = tolower(entry->name[i]); - else - filename[i] = entry->name[i]; - } - len = 11; - -out: - filename[len] = '\0'; - return len; -} - -/* fills filename, returns string length */ -static size_t get_fat_attr_volume_id(uint8_t *filename, size_t fnsize, - struct vfat_dir_entry *dir, unsigned int count) -{ - unsigned int i; - - for (i = 0; i < count; i++) { - /* end marker */ - if (dir[i].name[0] == 0x00) { - dbg("end of dir\n"); - break; - } - - /* empty entry */ - if (dir[i].name[0] == FAT_ENTRY_FREE) - continue; - - /* long name */ - if ((dir[i].attr & FAT_ATTR_MASK) == FAT_ATTR_LONG_NAME) - continue; - - if ((dir[i].attr & (FAT_ATTR_VOLUME_ID | FAT_ATTR_DIR)) == FAT_ATTR_VOLUME_ID) { - /* labels do not have file data */ - if (dir[i].cluster_high != 0 || dir[i].cluster_low != 0) - continue; - - dbg("found ATTR_VOLUME_ID id in root dir\n"); - return fat_read_filename(filename, fnsize, dir, &dir[i]); - } - - dbg("skip dir entry\n"); - } - - return 0; -} - -int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size) -{ - uint8_t filename[255 * 3]; - struct vfat_super_block *vs; - struct vfat_dir_entry *dir; - struct fat32_fsinfo *fsinfo; - uint16_t sector_size; - uint16_t dir_entries; - uint32_t sect_count; - uint16_t reserved; - uint32_t fat_size; - uint32_t root_cluster; - uint32_t dir_size; - uint32_t cluster_count; - uint16_t fat_length; - uint32_t fat32_length; - uint64_t root_start; - uint32_t start_data_sect; - uint16_t root_dir_entries; - uint16_t fsinfo_sect; - uint8_t *buf; - uint32_t buf_size; - uint32_t next; - int maxloop; - size_t fnlen; - - info("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off, 0x400); - if (buf == NULL) - return -1; - - vs = (struct vfat_super_block *) buf; - if (memcmp(vs->sysid, "NTFS", 4) == 0) - return -1; - - /* believe only that's fat, don't trust the version */ - if (memcmp(vs->type.fat32.magic, "MSWIN", 5) == 0) - goto magic; - - if (memcmp(vs->type.fat32.magic, "FAT32 ", 8) == 0) - goto magic; - - if (memcmp(vs->type.fat.magic, "FAT16 ", 8) == 0) - goto magic; - - if (memcmp(vs->type.fat.magic, "MSDOS", 5) == 0) - goto magic; - - if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0) - goto magic; - - /* check signature */ - if (buf[510] != 0x55 || buf[511] != 0xaa) - return -1; - - /* some old floppies don't have a magic, expect the boot jump address to match */ - if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) && - vs->boot_jump[0] != 0xe9) - return -1; - -magic: - info("magic found\n"); - /* reserverd sector count */ - if (!vs->reserved) - return -1; - - /* fat count */ - if (!vs->fats) - return -1; - - /* media check */ - if (vs->media < 0xf8 && vs->media != 0xf0) - return -1; - - /* cluster size check */ - if (vs->sectors_per_cluster == 0 || - (vs->sectors_per_cluster & (vs->sectors_per_cluster-1))) - return -1; - - /* sector size check */ - sector_size = le16_to_cpu(vs->sector_size); - if (sector_size == 0 || ((sector_size & (sector_size-1)) != 0)) - return -1; - - info("checks passed\n"); - dbg("sector_size 0x%x\n", sector_size); - dbg("sectors_per_cluster 0x%x\n", vs->sectors_per_cluster); - - dir_entries = le16_to_cpu(vs->dir_entries); - reserved = le16_to_cpu(vs->reserved); - dbg("reserved 0x%x\n", reserved); - - sect_count = le16_to_cpu(vs->sectors); - if (sect_count == 0) - sect_count = le32_to_cpu(vs->total_sect); - dbg("sect_count 0x%x\n", sect_count); - - fat_length = le16_to_cpu(vs->fat_length); - info("fat_length 0x%x\n", fat_length); - fat32_length = le32_to_cpu(vs->type.fat32.fat32_length); - info("fat32_length 0x%x\n", fat32_length); - - if (fat_length) - fat_size = fat_length * vs->fats; - else if (fat32_length) - fat_size = fat32_length * vs->fats; - else - return -1; - info("fat_size 0x%x\n", fat_size); - - dir_size = ((dir_entries * sizeof(struct vfat_dir_entry)) + - (sector_size-1)) / sector_size; - info("dir_size 0x%x\n", dir_size); - - cluster_count = sect_count - (reserved + fat_size + dir_size); - cluster_count /= vs->sectors_per_cluster; - info("cluster_count 0x%x\n", cluster_count); - - /* must be FAT32 */ - if (!fat_length && fat32_length) - goto fat32; - - /* cluster_count tells us the format */ - if (cluster_count < FAT12_MAX) - strcpy(id->type_version, "FAT12"); - else if (cluster_count < FAT16_MAX) - strcpy(id->type_version, "FAT16"); - else - goto fat32; - - /* the label may be an attribute in the root directory */ - root_start = (reserved + fat_size) * sector_size; - dbg("root dir start 0x%" PRIx64 "\n", root_start); - root_dir_entries = le16_to_cpu(vs->dir_entries); - dbg("expected entries 0x%x\n", root_dir_entries); - - buf_size = root_dir_entries * sizeof(struct vfat_dir_entry); - buf = volume_id_get_buffer(id, off + root_start, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - - fnlen = get_fat_attr_volume_id(filename, sizeof(filename), dir, root_dir_entries); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (fnlen > 0 && memcmp(filename, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, filename, fnlen); - volume_id_set_label_string(id, filename, fnlen); - } else if (memcmp(vs->type.fat.label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, vs->type.fat.label, 11); - volume_id_set_label_string(id, vs->type.fat.label, 11); - } - volume_id_set_uuid(id, vs->type.fat.serno, 0, UUID_DOS); - goto found; - -fat32: - info("looking for FAT32\n"); - /* - * FAT32 should have a valid signature in the fsinfo block, - * but also allow all bytes set to '\0', because some volumes - * do not set the signature at all. - */ - fsinfo_sect = le16_to_cpu(vs->type.fat32.fsinfo_sector); - buf = volume_id_get_buffer(id, off + (fsinfo_sect * sector_size), 0x200); - if (buf == NULL) - return -1; - fsinfo = (struct fat32_fsinfo *) buf; - info("signature1: 0x%02x%02x%02x%02x\n", - fsinfo->signature1[0], fsinfo->signature1[1], - fsinfo->signature1[2], fsinfo->signature1[3]); - info("signature2: 0x%02x%02x%02x%02x\n", - fsinfo->signature2[0], fsinfo->signature2[1], - fsinfo->signature2[2], fsinfo->signature2[3]); - if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0 && - memcmp(fsinfo->signature1, "\x00\x00\x00\x00", 4) != 0) - return -1; - if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0 && - memcmp(fsinfo->signature2, "\x00\x00\x00\x00", 4) != 0) - return -1 ; - info("FAT32 signatures ok\n"); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - strcpy(id->type_version, "FAT32"); - - /* FAT32 root dir is a cluster chain like any other directory */ - buf_size = vs->sectors_per_cluster * sector_size; - root_cluster = le32_to_cpu(vs->type.fat32.root_cluster); - dbg("root dir cluster %u\n", root_cluster); - start_data_sect = reserved + fat_size; - - next = root_cluster; - maxloop = 100; - while (--maxloop) { - uint32_t next_sect_off; - uint64_t next_off; - uint64_t fat_entry_off; - int count; - - dbg("next cluster %u\n", next); - next_sect_off = (next - 2) * vs->sectors_per_cluster; - next_off = (start_data_sect + next_sect_off) * sector_size; - dbg("cluster offset 0x%" PRIx64 "\n", next_off); - - /* get cluster */ - buf = volume_id_get_buffer(id, off + next_off, buf_size); - if (buf == NULL) - goto found; - - dir = (struct vfat_dir_entry*) buf; - count = buf_size / sizeof(struct vfat_dir_entry); - dbg("expected entries 0x%x\n", count); - - fnlen = get_fat_attr_volume_id(filename, sizeof(filename), dir, count); - if (fnlen > 0) - break; - - /* get FAT entry */ - fat_entry_off = (reserved * sector_size) + (next * sizeof(uint32_t)); - buf = volume_id_get_buffer(id, off + fat_entry_off, buf_size); - if (buf == NULL) - goto found; - - /* set next cluster */ - next = le32_to_cpu(*((uint32_t *) buf)) & 0x0fffffff; - if (next < 2 || next >= 0x0ffffff0) - break; - } - if (maxloop == 0) - dbg("reached maximum follow count of root cluster chain, give up\n"); - - vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200); - if (vs == NULL) - return -1; - - if (fnlen > 0 && memcmp(filename, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, filename, fnlen); - volume_id_set_label_string(id, filename, fnlen); - } else if (memcmp(vs->type.fat32.label, "NO NAME ", 11) != 0) { - volume_id_set_label_raw(id, vs->type.fat32.label, 11); - volume_id_set_label_string(id, vs->type.fat32.label, 11); - } - volume_id_set_uuid(id, vs->type.fat32.serno, 0, UUID_DOS); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "vfat"; - /* we think this is fat, but we make sure no other signatures are found */ - id->force_unique_result = 1; - return 0; -} diff --git a/extras/volume_id/lib/gfs.c b/extras/volume_id/lib/gfs.c deleted file mode 100644 index d97730c7a4..0000000000 --- a/extras/volume_id/lib/gfs.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2006 Red Hat, Inc. - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -/* Common gfs/gfs2 constants: */ -#define GFS_MAGIC 0x01161970 -#define GFS_DEFAULT_BSIZE 4096 -#define GFS_SUPERBLOCK_OFFSET (0x10 * GFS_DEFAULT_BSIZE) -#define GFS_METATYPE_SB 1 -#define GFS_FORMAT_SB 100 -#define GFS_LOCKNAME_LEN 64 - -/* gfs1 constants: */ -#define GFS_FORMAT_FS 1309 -#define GFS_FORMAT_MULTI 1401 -/* gfs2 constants: */ -#define GFS2_FORMAT_FS 1801 -#define GFS2_FORMAT_MULTI 1900 - -struct gfs2_meta_header { - uint32_t mh_magic; - uint32_t mh_type; - uint64_t __pad0; /* Was generation number in gfs1 */ - uint32_t mh_format; - uint32_t __pad1; /* Was incarnation number in gfs1 */ -}; - -struct gfs2_inum { - uint64_t no_formal_ino; - uint64_t no_addr; -}; - -struct gfs2_sb { - struct gfs2_meta_header sb_header; - - uint32_t sb_fs_format; - uint32_t sb_multihost_format; - uint32_t __pad0; /* Was superblock flags in gfs1 */ - - uint32_t sb_bsize; - uint32_t sb_bsize_shift; - uint32_t __pad1; /* Was journal segment size in gfs1 */ - - struct gfs2_inum sb_master_dir; /* Was jindex dinode in gfs1 */ - struct gfs2_inum __pad2; /* Was rindex dinode in gfs1 */ - struct gfs2_inum sb_root_dir; - - char sb_lockproto[GFS_LOCKNAME_LEN]; - char sb_locktable[GFS_LOCKNAME_LEN]; - - struct gfs2_inum __pad3; /* Was quota inode in gfs1 */ - struct gfs2_inum __pad4; /* Was licence inode in gfs1 */ - uint8_t sb_uuid[16]; /* The UUID maybe 0 for backwards compat */ -} PACKED; - -static int uuid_non_zero(const uint8_t *p) -{ - int i; - for (i = 0; i < 16; i++) { - if (p[i] != 0) - return 1; - } - return 0; -} - -static int volume_id_probe_gfs_generic(struct volume_id *id, uint64_t off, int vers) -{ - struct gfs2_sb *sbd; - - info("probing at offset 0x%" PRIx64 "\n", off); - - sbd = (struct gfs2_sb *) - volume_id_get_buffer(id, off + GFS_SUPERBLOCK_OFFSET, sizeof(struct gfs2_sb)); - if (sbd == NULL) - return -1; - - if (be32_to_cpu(sbd->sb_header.mh_magic) == GFS_MAGIC && - be32_to_cpu(sbd->sb_header.mh_type) == GFS_METATYPE_SB) { - if (vers == 1) { - if (be32_to_cpu(sbd->sb_fs_format) != GFS_FORMAT_FS || - be32_to_cpu(sbd->sb_multihost_format) != GFS_FORMAT_MULTI) - return -1; /* not gfs1 */ - id->type = "gfs"; - } - else if (vers == 2) { - if (be32_to_cpu(sbd->sb_fs_format) != GFS2_FORMAT_FS || - be32_to_cpu(sbd->sb_multihost_format) != GFS2_FORMAT_MULTI) - return -1; /* not gfs2 */ - id->type = "gfs2"; - } - else - return -1; - - if (strlen(sbd->sb_locktable)) { - uint8_t *label = (uint8_t *) sbd->sb_locktable; - - volume_id_set_label_raw(id, label, GFS_LOCKNAME_LEN); - volume_id_set_label_string(id, label, GFS_LOCKNAME_LEN); - } - if (vers == 2 && uuid_non_zero(sbd->sb_uuid)) - volume_id_set_uuid(id, sbd->sb_uuid, 0, UUID_DCE); - strcpy(id->type_version, "1"); - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - return 0; - } - return -1; -} - -int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - return volume_id_probe_gfs_generic(id, off, 1); -} - -int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size) -{ - return volume_id_probe_gfs_generic(id, off, 2); -} diff --git a/extras/volume_id/lib/hfs.c b/extras/volume_id/lib/hfs.c deleted file mode 100644 index 903378b34e..0000000000 --- a/extras/volume_id/lib/hfs.c +++ /dev/null @@ -1,325 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" -#include "md5.h" - -struct hfs_finder_info{ - uint32_t boot_folder; - uint32_t start_app; - uint32_t open_folder; - uint32_t os9_folder; - uint32_t reserved; - uint32_t osx_folder; - uint8_t id[8]; -} PACKED; - -static struct hfs_mdb { - uint8_t signature[2]; - uint32_t cr_date; - uint32_t ls_Mod; - uint16_t atrb; - uint16_t nm_fls; - uint16_t vbm_st; - uint16_t alloc_ptr; - uint16_t nm_al_blks; - uint32_t al_blk_size; - uint32_t clp_size; - uint16_t al_bl_st; - uint32_t nxt_cnid; - uint16_t free_bks; - uint8_t label_len; - uint8_t label[27]; - uint32_t vol_bkup; - uint16_t vol_seq_num; - uint32_t wr_cnt; - uint32_t xt_clump_size; - uint32_t ct_clump_size; - uint16_t num_root_dirs; - uint32_t file_count; - uint32_t dir_count; - struct hfs_finder_info finder_info; - uint8_t embed_sig[2]; - uint16_t embed_startblock; - uint16_t embed_blockcount; -} PACKED *hfs; - -struct hfsplus_bnode_descriptor { - uint32_t next; - uint32_t prev; - uint8_t type; - uint8_t height; - uint16_t num_recs; - uint16_t reserved; -} PACKED; - -struct hfsplus_bheader_record { - uint16_t depth; - uint32_t root; - uint32_t leaf_count; - uint32_t leaf_head; - uint32_t leaf_tail; - uint16_t node_size; -} PACKED; - -struct hfsplus_catalog_key { - uint16_t key_len; - uint32_t parent_id; - uint16_t unicode_len; - uint8_t unicode[255 * 2]; -} PACKED; - -struct hfsplus_extent { - uint32_t start_block; - uint32_t block_count; -} PACKED; - -#define HFSPLUS_EXTENT_COUNT 8 -struct hfsplus_fork { - uint64_t total_size; - uint32_t clump_size; - uint32_t total_blocks; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; -} PACKED; - -static struct hfsplus_vol_header { - uint8_t signature[2]; - uint16_t version; - uint32_t attributes; - uint32_t last_mount_vers; - uint32_t reserved; - uint32_t create_date; - uint32_t modify_date; - uint32_t backup_date; - uint32_t checked_date; - uint32_t file_count; - uint32_t folder_count; - uint32_t blocksize; - uint32_t total_blocks; - uint32_t free_blocks; - uint32_t next_alloc; - uint32_t rsrc_clump_sz; - uint32_t data_clump_sz; - uint32_t next_cnid; - uint32_t write_count; - uint64_t encodings_bmp; - struct hfs_finder_info finder_info; - struct hfsplus_fork alloc_file; - struct hfsplus_fork ext_file; - struct hfsplus_fork cat_file; - struct hfsplus_fork attr_file; - struct hfsplus_fork start_file; -} PACKED *hfsplus; - -#define HFS_SUPERBLOCK_OFFSET 0x400 -#define HFS_NODE_LEAF 0xff -#define HFSPLUS_POR_CNID 1 - -static void hfsid_set_uuid(struct volume_id *id, const uint8_t *hfs_id) -{ - struct md5_ctx md5c; - static const uint8_t hash_init[16] = { - 0xb3, 0xe2, 0x0f, 0x39, 0xf2, 0x92, 0x11, 0xd6, - 0x97, 0xa4, 0x00, 0x30, 0x65, 0x43, 0xec, 0xac - }; - uint8_t uuid[16]; - - if (*((uint64_t *)hfs_id) == 0) - return; - - md5_init(&md5c); - md5_update(&md5c, hash_init, 16); - md5_update(&md5c, hfs_id, 8); - md5_final(&md5c, uuid); - - uuid[6] = 0x30 | (uuid[6] & 0x0f); - uuid[8] = 0x80 | (uuid[8] & 0x3f); - volume_id_set_uuid(id, uuid, 0, UUID_DCE); -} - -int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size) -{ - unsigned int blocksize; - unsigned int cat_block; - unsigned int ext_block_start; - unsigned int ext_block_count; - int ext; - unsigned int leaf_node_head; - unsigned int leaf_node_count; - unsigned int leaf_node_size; - unsigned int leaf_block; - uint64_t leaf_off; - unsigned int alloc_block_size; - unsigned int alloc_first_block; - unsigned int embed_first_block; - unsigned int record_count; - struct hfsplus_bnode_descriptor *descr; - struct hfsplus_bheader_record *bnode; - struct hfsplus_catalog_key *key; - unsigned int label_len; - struct hfsplus_extent extents[HFSPLUS_EXTENT_COUNT]; - const uint8_t *buf; - - info("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - hfs = (struct hfs_mdb *) buf; - if (memcmp(hfs->signature, "BD", 2) != 0) - goto checkplus; - - /* it may be just a hfs wrapper for hfs+ */ - if (memcmp(hfs->embed_sig, "H+", 2) == 0) { - alloc_block_size = be32_to_cpu(hfs->al_blk_size); - dbg("alloc_block_size 0x%x\n", alloc_block_size); - - alloc_first_block = be16_to_cpu(hfs->al_bl_st); - dbg("alloc_first_block 0x%x\n", alloc_first_block); - - embed_first_block = be16_to_cpu(hfs->embed_startblock); - dbg("embed_first_block 0x%x\n", embed_first_block); - - off += (alloc_first_block * 512) + - (embed_first_block * alloc_block_size); - dbg("hfs wrapped hfs+ found at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off + HFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - goto checkplus; - } - - if (hfs->label_len > 0 && hfs->label_len < 28) { - volume_id_set_label_raw(id, hfs->label, hfs->label_len); - volume_id_set_label_string(id, hfs->label, hfs->label_len) ; - } - - hfsid_set_uuid(id, hfs->finder_info.id); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hfs"; - - return 0; - -checkplus: - hfsplus = (struct hfsplus_vol_header *) buf; - if (memcmp(hfsplus->signature, "H+", 2) == 0) - goto hfsplus; - if (memcmp(hfsplus->signature, "HX", 2) == 0) - goto hfsplus; - return -1; - -hfsplus: - hfsid_set_uuid(id, hfsplus->finder_info.id); - - blocksize = be32_to_cpu(hfsplus->blocksize); - dbg("blocksize %u\n", blocksize); - - memcpy(extents, hfsplus->cat_file.extents, sizeof(extents)); - cat_block = be32_to_cpu(extents[0].start_block); - dbg("catalog start block 0x%x\n", cat_block); - - buf = volume_id_get_buffer(id, off + (cat_block * blocksize), 0x2000); - if (buf == NULL) - goto found; - - bnode = (struct hfsplus_bheader_record *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - leaf_node_head = be32_to_cpu(bnode->leaf_head); - dbg("catalog leaf node 0x%x\n", leaf_node_head); - - leaf_node_size = be16_to_cpu(bnode->node_size); - dbg("leaf node size 0x%x\n", leaf_node_size); - - leaf_node_count = be32_to_cpu(bnode->leaf_count); - dbg("leaf node count 0x%x\n", leaf_node_count); - if (leaf_node_count == 0) - goto found; - - leaf_block = (leaf_node_head * leaf_node_size) / blocksize; - - /* get physical location */ - for (ext = 0; ext < HFSPLUS_EXTENT_COUNT; ext++) { - ext_block_start = be32_to_cpu(extents[ext].start_block); - ext_block_count = be32_to_cpu(extents[ext].block_count); - dbg("extent start block 0x%x, count 0x%x\n", ext_block_start, ext_block_count); - - if (ext_block_count == 0) - goto found; - - /* this is our extent */ - if (leaf_block < ext_block_count) - break; - - leaf_block -= ext_block_count; - } - if (ext == HFSPLUS_EXTENT_COUNT) - goto found; - dbg("found block in extent %i\n", ext); - - leaf_off = (ext_block_start + leaf_block) * blocksize; - - buf = volume_id_get_buffer(id, off + leaf_off, leaf_node_size); - if (buf == NULL) - goto found; - - descr = (struct hfsplus_bnode_descriptor *) buf; - dbg("descriptor type 0x%x\n", descr->type); - - record_count = be16_to_cpu(descr->num_recs); - dbg("number of records %u\n", record_count); - if (record_count == 0) - goto found; - - if (descr->type != HFS_NODE_LEAF) - goto found; - - key = (struct hfsplus_catalog_key *) - &buf[sizeof(struct hfsplus_bnode_descriptor)]; - - dbg("parent id 0x%x\n", be32_to_cpu(key->parent_id)); - if (be32_to_cpu(key->parent_id) != HFSPLUS_POR_CNID) - goto found; - - label_len = be16_to_cpu(key->unicode_len) * 2; - dbg("label unicode16 len %i\n", label_len); - volume_id_set_label_raw(id, key->unicode, label_len); - volume_id_set_label_unicode16(id, key->unicode, BE, label_len); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hfsplus"; - - return 0; -} diff --git a/extras/volume_id/lib/highpoint.c b/extras/volume_id/lib/highpoint.c deleted file mode 100644 index 33554f29a3..0000000000 --- a/extras/volume_id/lib/highpoint.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct hpt37x_meta { - uint8_t filler1[32]; - uint32_t magic; -} PACKED; - -struct hpt45x_meta { - uint32_t magic; -} PACKED; - -#define HPT37X_CONFIG_OFF 0x1200 -#define HPT37X_MAGIC_OK 0x5a7816f0 -#define HPT37X_MAGIC_BAD 0x5a7816fd - -#define HPT45X_MAGIC_OK 0x5a7816f3 -#define HPT45X_MAGIC_BAD 0x5a7816fd - - -int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct hpt37x_meta *hpt; - uint32_t magic; - - info("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off + HPT37X_CONFIG_OFF, 0x200); - if (buf == NULL) - return -1; - - hpt = (struct hpt37x_meta *) buf; - magic = le32_to_cpu(hpt->magic); - if (magic != HPT37X_MAGIC_OK && magic != HPT37X_MAGIC_BAD) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "highpoint_raid_member"; - - return 0; -} - -int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct hpt45x_meta *hpt; - uint64_t meta_off; - uint32_t magic; - - dbg("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-11) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - hpt = (struct hpt45x_meta *) buf; - magic = le32_to_cpu(hpt->magic); - if (magic != HPT45X_MAGIC_OK && magic != HPT45X_MAGIC_BAD) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "highpoint_raid_member"; - - return 0; -} diff --git a/extras/volume_id/lib/hpfs.c b/extras/volume_id/lib/hpfs.c deleted file mode 100644 index 0f0770f05f..0000000000 --- a/extras/volume_id/lib/hpfs.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct hpfs_boot_block -{ - uint8_t jmp[3]; - uint8_t oem_id[8]; - uint8_t bytes_per_sector[2]; - uint8_t sectors_per_cluster; - uint8_t n_reserved_sectors[2]; - uint8_t n_fats; - uint8_t n_rootdir_entries[2]; - uint8_t n_sectors_s[2]; - uint8_t media_byte; - uint16_t sectors_per_fat; - uint16_t sectors_per_track; - uint16_t heads_per_cyl; - uint32_t n_hidden_sectors; - uint32_t n_sectors_l; - uint8_t drive_number; - uint8_t mbz; - uint8_t sig_28h; - uint8_t vol_serno[4]; - uint8_t vol_label[11]; - uint8_t sig_hpfs[8]; - uint8_t pad[448]; - uint8_t magic[2]; -} PACKED; - -struct hpfs_super -{ - uint8_t magic[4]; - uint8_t magic1[4]; - uint8_t version; -} PACKED; - - -struct hpfs_spare_super -{ - uint8_t magic[4]; - uint8_t magic1[4]; -} PACKED; - -#define HPFS_SUPERBLOCK_OFFSET 0x2000 -#define HPFS_SUPERBLOCK_SPARE_OFFSET 0x2200 - -int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct hpfs_super *hs; - struct hpfs_spare_super *hss; - struct hpfs_boot_block *hbb; - uint8_t version; - - info("probing at offset 0x%" PRIx64 "\n", off); - - hs = (struct hpfs_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_OFFSET, 0x400); - if (hs == NULL) - return -1; - if (memcmp(hs->magic, "\x49\xe8\x95\xf9", 4) != 0) - return -1; - - hss = (struct hpfs_spare_super *) volume_id_get_buffer(id, off + HPFS_SUPERBLOCK_SPARE_OFFSET, 0x200); - if (hss == NULL) - return -1; - if (memcmp(hss->magic, "\x49\x18\x91\xf9", 4) != 0) - return -1; - - version = hs->version; - - /* if boot block looks valid, read label and uuid from there */ - hbb = (struct hpfs_boot_block *) volume_id_get_buffer(id, off, 0x200); - if (hbb == NULL) - return -1; - if (memcmp(hbb->magic, "\x55\xaa", 2) == 0 && - memcmp(hbb->sig_hpfs, "HPFS", 4) == 0 && - hbb->sig_28h == 0x28) { - volume_id_set_label_raw(id, hbb->vol_label, 11); - volume_id_set_label_string(id, hbb->vol_label, 11); - volume_id_set_uuid(id, hbb->vol_serno, 0, UUID_DOS); - } - sprintf(id->type_version, "%u", version); - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "hpfs"; - - return 0; -} diff --git a/extras/volume_id/lib/iso9660.c b/extras/volume_id/lib/iso9660.c deleted file mode 100644 index ea1464b066..0000000000 --- a/extras/volume_id/lib/iso9660.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -#define ISO_SUPERBLOCK_OFFSET 0x8000 -#define ISO_SECTOR_SIZE 0x800 -#define ISO_VD_OFFSET (ISO_SUPERBLOCK_OFFSET + ISO_SECTOR_SIZE) -#define ISO_VD_PRIMARY 0x1 -#define ISO_VD_SUPPLEMENTARY 0x2 -#define ISO_VD_END 0xff -#define ISO_VD_MAX 16 - -struct iso_volume_descriptor { - uint8_t type; - uint8_t id[5]; - uint8_t version; - uint8_t flags; - uint8_t system_id[32]; - uint8_t volume_id[32]; - uint8_t unused[8]; - uint8_t space_size[8]; - uint8_t escape_sequences[8]; -} PACKED; - -struct high_sierra_volume_descriptor { - uint8_t foo[8]; - uint8_t type; - uint8_t id[5]; - uint8_t version; -} PACKED; - -int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size) -{ - uint8_t *buf; - struct iso_volume_descriptor *is; - struct high_sierra_volume_descriptor *hs; - - info("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off + ISO_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - is = (struct iso_volume_descriptor *) buf; - - if (memcmp(is->id, "CD001", 5) == 0) { - int vd_offset; - int i; - - dbg("read label from PVD\n"); - volume_id_set_label_raw(id, is->volume_id, 32); - volume_id_set_label_string(id, is->volume_id, 32); - - dbg("looking for SVDs\n"); - vd_offset = ISO_VD_OFFSET; - for (i = 0; i < ISO_VD_MAX; i++) { - uint8_t svd_label[64]; - - is = (struct iso_volume_descriptor *) volume_id_get_buffer(id, off + vd_offset, 0x200); - if (is == NULL || is->type == ISO_VD_END) - break; - if (is->type != ISO_VD_SUPPLEMENTARY) - continue; - - dbg("found SVD at offset 0x%" PRIx64 "\n", (off + vd_offset)); - if (memcmp(is->escape_sequences, "%/@", 3) == 0|| - memcmp(is->escape_sequences, "%/C", 3) == 0|| - memcmp(is->escape_sequences, "%/E", 3) == 0) { - dbg("Joliet extension found\n"); - volume_id_set_unicode16(svd_label, sizeof(svd_label), is->volume_id, BE, 32); - if (memcmp(id->label, svd_label, 16) == 0) { - dbg("SVD label is identical, use the possibly longer PVD one\n"); - break; - } - - volume_id_set_label_raw(id, is->volume_id, 32); - volume_id_set_label_string(id, svd_label, 32); - strcpy(id->type_version, "Joliet Extension"); - goto found; - } - vd_offset += ISO_SECTOR_SIZE; - } - goto found; - } - - hs = (struct high_sierra_volume_descriptor *) buf; - - if (memcmp(hs->id, "CDROM", 5) == 0) { - strcpy(id->type_version, "High Sierra"); - goto found; - } - - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "iso9660"; - - return 0; -} diff --git a/extras/volume_id/lib/isw_raid.c b/extras/volume_id/lib/isw_raid.c deleted file mode 100644 index db31249716..0000000000 --- a/extras/volume_id/lib/isw_raid.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct isw_meta { - uint8_t sig[32]; - uint32_t check_sum; - uint32_t mpb_size; - uint32_t family_num; - uint32_t generation_num; -} PACKED; - -#define ISW_SIGNATURE "Intel Raid ISM Cfg Sig. " - - -int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct isw_meta *isw; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-2) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - isw = (struct isw_meta *) buf; - if (memcmp(isw->sig, ISW_SIGNATURE, sizeof(ISW_SIGNATURE)-1) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - memcpy(id->type_version, &isw->sig[sizeof(ISW_SIGNATURE)-1], 6); - id->type = "isw_raid_member"; - - return 0; -} diff --git a/extras/volume_id/lib/jfs.c b/extras/volume_id/lib/jfs.c deleted file mode 100644 index b84ded349b..0000000000 --- a/extras/volume_id/lib/jfs.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct jfs_super_block { - uint8_t magic[4]; - uint32_t version; - uint64_t size; - uint32_t bsize; - uint32_t dummy1; - uint32_t pbsize; - uint32_t dummy2[27]; - uint8_t uuid[16]; - uint8_t label[16]; - uint8_t loguuid[16]; -} PACKED; - -#define JFS_SUPERBLOCK_OFFSET 0x8000 - -int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct jfs_super_block *js; - - info("probing at offset 0x%" PRIx64 "\n", off); - - js = (struct jfs_super_block *) volume_id_get_buffer(id, off + JFS_SUPERBLOCK_OFFSET, 0x200); - if (js == NULL) - return -1; - - if (memcmp(js->magic, "JFS1", 4) != 0) - return -1; - - volume_id_set_label_raw(id, js->label, 16); - volume_id_set_label_string(id, js->label, 16); - volume_id_set_uuid(id, js->uuid, 0, UUID_DCE); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "jfs"; - - return 0; -} diff --git a/extras/volume_id/lib/jmicron_raid.c b/extras/volume_id/lib/jmicron_raid.c deleted file mode 100644 index e14862f340..0000000000 --- a/extras/volume_id/lib/jmicron_raid.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2006 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct jmicron_meta { - int8_t signature[2]; - uint8_t minor_version; - uint8_t major_version; - uint16_t checksum; -} PACKED; - -int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct jmicron_meta *jm; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - jm = (struct jmicron_meta *) buf; - if (memcmp(jm->signature, "JM", 2) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", jm->major_version, jm->minor_version); - id->type = "jmicron_raid_member"; - - return 0; -} diff --git a/extras/volume_id/lib/libvolume_id-private.h b/extras/volume_id/lib/libvolume_id-private.h deleted file mode 100644 index 046a1e39ed..0000000000 --- a/extras/volume_id/lib/libvolume_id-private.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * volume_id - reads volume label and uuid - * - * Copyright (C) 2005-2007 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _LIBVOLUME_ID_PRIVATE_H_ -#define _LIBVOLUME_ID_PRIVATE_H_ - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" - -#define ALLOWED_CHARS "#+-.:=@_" - -#ifndef PACKED -#define PACKED __attribute__((packed)) -#endif - -static inline void __attribute__ ((format(printf, 1, 2))) -log_null(const char *format, ...) {} - -#define err(format, arg...) volume_id_log_fn(LOG_ERR, __FILE__, __LINE__, format, ##arg) -#define info(format, arg...) volume_id_log_fn(LOG_INFO, __FILE__, __LINE__, format, ##arg) -#ifdef DEBUG -#define dbg(format, arg...) volume_id_log_fn(LOG_DEBUG, __FILE__, __LINE__, format, ##arg) -#else -#define dbg(format, arg...) log_null(format, ##arg) -#endif - -#if (__BYTE_ORDER == __LITTLE_ENDIAN) -#define le16_to_cpu(x) (x) -#define le32_to_cpu(x) (x) -#define le64_to_cpu(x) (x) -#define be16_to_cpu(x) bswap_16(x) -#define be32_to_cpu(x) bswap_32(x) -#define cpu_to_le16(x) (x) -#define cpu_to_le32(x) (x) -#define cpu_to_be32(x) bswap_32(x) -#elif (__BYTE_ORDER == __BIG_ENDIAN) -#define le16_to_cpu(x) bswap_16(x) -#define le32_to_cpu(x) bswap_32(x) -#define le64_to_cpu(x) bswap_64(x) -#define be16_to_cpu(x) (x) -#define be32_to_cpu(x) (x) -#define cpu_to_le16(x) bswap_16(x) -#define cpu_to_le32(x) bswap_32(x) -#define cpu_to_be32(x) (x) -#endif /* __BYTE_ORDER */ - -enum uuid_format { - UUID_STRING, - UUID_HEX_STRING, - UUID_DCE, - UUID_DOS, - UUID_64BIT_LE, - UUID_MD, - UUID_LVM, -}; - -enum endian { - LE = 0, - BE = 1 -}; - -#define VOLUME_ID_LABEL_SIZE 64 -#define VOLUME_ID_UUID_SIZE 36 -#define VOLUME_ID_FORMAT_SIZE 32 -#define VOLUME_ID_PATH_MAX 256 -#define VOLUME_ID_PARTITIONS_MAX 256 - -/* size of superblock buffer, reiserfs block is at 64k */ -#define SB_BUFFER_SIZE 0x11000 -/* size of seek buffer, FAT cluster is 32k max */ -#define SEEK_BUFFER_SIZE 0x10000 - -enum volume_id_usage { - VOLUME_ID_UNUSED, - VOLUME_ID_OTHER, - VOLUME_ID_FILESYSTEM, - VOLUME_ID_RAID, - VOLUME_ID_CRYPTO, -}; - -struct volume_id { - uint8_t label_raw[VOLUME_ID_LABEL_SIZE]; - size_t label_raw_len; - char label[VOLUME_ID_LABEL_SIZE+1]; - uint8_t uuid_raw[VOLUME_ID_UUID_SIZE]; - size_t uuid_raw_len; - char uuid[VOLUME_ID_UUID_SIZE+1]; - uint8_t uuid_sub_raw[VOLUME_ID_UUID_SIZE]; - size_t uuid_sub_raw_len; - char uuid_sub[VOLUME_ID_UUID_SIZE+1]; - enum volume_id_usage usage_id; - char *usage; - char *type; - char type_version[VOLUME_ID_FORMAT_SIZE]; - - int fd; - uint8_t *sbbuf; - size_t sbbuf_len; - uint8_t *seekbuf; - uint64_t seekbuf_off; - size_t seekbuf_len; - int force_unique_result; -}; - -/* utils */ -extern int volume_id_utf8_encoded_valid_unichar(const char *str); -extern size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count); -extern void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id); -extern void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count); -extern void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count); -extern void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count); -extern void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format); -extern void volume_id_set_uuid_sub(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format); -extern uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len); -extern void volume_id_free_buffer(struct volume_id *id); - -/* filesystems */ -extern int volume_id_probe_cramfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ext(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_hfs_hfsplus(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_hpfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_iso9660(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_jfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_gfs(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_gfs2(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_btrfs(struct volume_id *id, uint64_t off, uint64_t size); - -/* special formats */ -extern int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size); - -/* raid */ -extern int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_ddf_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_oracleasm(struct volume_id *id, uint64_t off, uint64_t size); - -/* bios raid */ -extern int volume_id_probe_intel_software_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_highpoint_37x_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_highpoint_45x_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_adaptec_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_jmicron_raid(struct volume_id *id, uint64_t off, uint64_t size); - -#endif diff --git a/extras/volume_id/lib/libvolume_id.h b/extras/volume_id/lib/libvolume_id.h deleted file mode 100644 index 24c9c4e7eb..0000000000 --- a/extras/volume_id/lib/libvolume_id.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * volume_id - reads volume label and uuid - * - * Copyright (C) 2005-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _LIBVOLUME_ID_H_ -#define _LIBVOLUME_ID_H_ - -#include -#include - -struct volume_id; -typedef void (*volume_id_log_fn_t)(int priority, const char *file, int line, const char *format, ...) - __attribute__ ((format(printf, 4, 5))); -extern volume_id_log_fn_t volume_id_log_fn; - -typedef int (*volume_id_probe_fn_t)(struct volume_id *id, uint64_t off, uint64_t size); -typedef int (*all_probers_fn_t)(volume_id_probe_fn_t probe_fn, - struct volume_id *id, uint64_t off, uint64_t size, - void *data); - -extern struct volume_id *volume_id_open_fd(int fd); -extern void volume_id_close(struct volume_id *id); -extern int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size); -extern int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size); -extern const volume_id_probe_fn_t *volume_id_get_prober_by_type(const char *type); -extern void volume_id_all_probers(all_probers_fn_t all_probers_fn, - struct volume_id *id, uint64_t off, uint64_t size, - void *data); -extern int volume_id_get_label(struct volume_id *id, const char **label); -extern int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len); -extern int volume_id_get_uuid(struct volume_id *id, const char **uuid); -extern int volume_id_get_uuid_sub(struct volume_id *id, const char **uuid); -extern int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len); -extern int volume_id_get_usage(struct volume_id *id, const char **usage); -extern int volume_id_get_type(struct volume_id *id, const char **type); -extern int volume_id_get_type_version(struct volume_id *id, const char **type_version); -extern int volume_id_encode_string(const char *str, char *str_enc, size_t len); - -#endif diff --git a/extras/volume_id/lib/libvolume_id.pc.in b/extras/volume_id/lib/libvolume_id.pc.in deleted file mode 100644 index 5a1e1b77ba..0000000000 --- a/extras/volume_id/lib/libvolume_id.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@prefix@ -libdir=@prefix@/@libdir_name@ -includedir=@prefix@/include - -Name: libvolume_id -Description: Library for reading metadata, label, uuid from various filesystems -Version: @VERSION@ -Libs: -L${libdir} -lvolume_id -Cflags: -I${includedir} diff --git a/extras/volume_id/lib/linux_raid.c b/extras/volume_id/lib/linux_raid.c deleted file mode 100644 index e845570823..0000000000 --- a/extras/volume_id/lib/linux_raid.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct mdp0_super_block { - uint32_t md_magic; - uint32_t major_version; - uint32_t minor_version; - uint32_t patch_version; - uint32_t gvalid_words; - uint32_t set_uuid0; - uint32_t ctime; - uint32_t level; - uint32_t size; - uint32_t nr_disks; - uint32_t raid_disks; - uint32_t md_minor; - uint32_t not_persistent; - uint32_t set_uuid1; - uint32_t set_uuid2; - uint32_t set_uuid3; -} PACKED; - -struct mdp1_super_block { - uint32_t magic; - uint32_t major_version; - uint32_t feature_map; - uint32_t pad0; - uint8_t set_uuid[16]; - uint8_t set_name[32]; -} PACKED; - -#define MD_RESERVED_BYTES 0x10000 -#define MD_SB_MAGIC 0xa92b4efc - -static int volume_id_probe_linux_raid0(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct mdp0_super_block *mdp0; - union { - uint32_t ints[4]; - uint8_t bytes[16]; - } uuid; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - if (size < 0x10000) - return -1; - - buf = volume_id_get_buffer(id, off, 0x800); - if (buf == NULL) - return -1; - mdp0 = (struct mdp0_super_block *) buf; - - if (le32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) { - uuid.ints[0] = bswap_32(mdp0->set_uuid0); - if (le32_to_cpu(mdp0->minor_version >= 90)) { - uuid.ints[1] = bswap_32(mdp0->set_uuid1); - uuid.ints[2] = bswap_32(mdp0->set_uuid2); - uuid.ints[3] = bswap_32(mdp0->set_uuid3); - } else { - uuid.ints[1] = 0; - uuid.ints[2] = 0; - uuid.ints[3] = 0; - } - volume_id_set_uuid(id, uuid.bytes, 0, UUID_MD); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", - le32_to_cpu(mdp0->major_version), - le32_to_cpu(mdp0->minor_version), - le32_to_cpu(mdp0->patch_version)); - } else if (be32_to_cpu(mdp0->md_magic) == MD_SB_MAGIC) { - uuid.ints[0] = mdp0->set_uuid0; - if (be32_to_cpu(mdp0->minor_version >= 90)) { - uuid.ints[1] = mdp0->set_uuid1; - uuid.ints[2] = mdp0->set_uuid2; - uuid.ints[3] = mdp0->set_uuid3; - } else { - uuid.ints[1] = 0; - uuid.ints[2] = 0; - uuid.ints[3] = 0; - } - volume_id_set_uuid(id, uuid.bytes, 0, UUID_MD); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u.%u", - be32_to_cpu(mdp0->major_version), - be32_to_cpu(mdp0->minor_version), - be32_to_cpu(mdp0->patch_version)); - } else - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "linux_raid_member"; - return 0; -} - -static int volume_id_probe_linux_raid1(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct mdp1_super_block *mdp1; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - buf = volume_id_get_buffer(id, off, 0x800); - if (buf == NULL) - return -1; - mdp1 = (struct mdp1_super_block *) buf; - - if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC) - return -1; - - if (le32_to_cpu(mdp1->major_version) != 1) - return -1; - - volume_id_set_uuid(id, mdp1->set_uuid, 0, UUID_MD); - volume_id_set_label_raw(id, mdp1->set_name, 32); - volume_id_set_label_string(id, mdp1->set_name, 32); - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "linux_raid_member"; - return 0; -} - -int volume_id_probe_linux_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - uint64_t sboff; - - if (size > MD_RESERVED_BYTES) { - /* version 0 at the end of the device */ - sboff = (size & ~(MD_RESERVED_BYTES - 1)) - MD_RESERVED_BYTES; - if (volume_id_probe_linux_raid0(id, off + sboff, size) == 0) - return 0; - - /* version 1.0 at the end of the device */ - sboff = (size & ~(0x1000 - 1)) - 0x2000; - if (volume_id_probe_linux_raid1(id, off + sboff, size) == 0) { - strcpy(id->type_version, "1.0"); - return 0; - } - } - - /* version 1.1 at the start of the device */ - if (volume_id_probe_linux_raid1(id, off, size) == 0) { - strcpy(id->type_version, "1.1"); - return 0; - } - - /* version 1.2 at 4k offset from the start */ - if (volume_id_probe_linux_raid1(id, off + 0x1000, size) == 0) { - strcpy(id->type_version, "1.2"); - return 0; - } - - return -1; -} diff --git a/extras/volume_id/lib/linux_swap.c b/extras/volume_id/lib/linux_swap.c deleted file mode 100644 index 53649bdb75..0000000000 --- a/extras/volume_id/lib/linux_swap.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct swap_header_v1_2 { - uint8_t bootbits[1024]; - uint32_t version; - uint32_t last_page; - uint32_t nr_badpages; - uint8_t uuid[16]; - uint8_t volume_name[16]; -} PACKED; - -#define LARGEST_PAGESIZE 0x10000 - -int volume_id_probe_linux_swap(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - unsigned int page; - struct swap_header_v1_2 *sw; - - info("probing at offset 0x%" PRIx64 "\n", off); - - /* eek, the swap signature is at the end of the PAGE_SIZE */ - for (page = 0x1000; page <= LARGEST_PAGESIZE; page <<= 1) { - buf = volume_id_get_buffer(id, off + page-10, 10); - if (buf == NULL) - return -1; - - if (memcmp(buf, "SWAP-SPACE", 10) == 0) { - id->type = "swap"; - strcpy(id->type_version, "1"); - goto found; - } - - if (memcmp(buf, "SWAPSPACE2", 10) == 0) { - id->type = "swap"; - strcpy(id->type_version, "2"); - goto found_label; - } - - if (memcmp(buf, "S1SUSPEND", 9) == 0) { - id->type = "suspend"; - strcpy(id->type_version, "s1suspend"); - goto found_label; - } - - if (memcmp(buf, "ULSUSPEND", 9) == 0) { - id->type = "suspend"; - strcpy(id->type_version, "ulsuspend"); - goto found_label; - } - - if (memcmp(buf, "\xed\xc3\x02\xe9\x98\x56\xe5\x0c", 8) == 0) { - id->type = "suspend"; - strcpy(id->type_version, "tuxonice"); - goto found_label; - } - } - return -1; - -found_label: - sw = (struct swap_header_v1_2 *) volume_id_get_buffer(id, off, sizeof(struct swap_header_v1_2)); - if (sw != NULL) { - volume_id_set_label_raw(id, sw->volume_name, 16); - volume_id_set_label_string(id, sw->volume_name, 16); - volume_id_set_uuid(id, sw->uuid, 0, UUID_DCE); - } - -found: - volume_id_set_usage(id, VOLUME_ID_OTHER); - /* we think this is swap, but we make sure no other signatures are found */ - id->force_unique_result = 1; - return 0; -} diff --git a/extras/volume_id/lib/lsi_raid.c b/extras/volume_id/lib/lsi_raid.c deleted file mode 100644 index 5a6ba4c72a..0000000000 --- a/extras/volume_id/lib/lsi_raid.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct lsi_meta { - uint8_t sig[6]; -} PACKED; - -#define LSI_SIGNATURE "$XIDE$" - -int volume_id_probe_lsi_mega_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct lsi_meta *lsi; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - lsi = (struct lsi_meta *) buf; - if (memcmp(lsi->sig, LSI_SIGNATURE, sizeof(LSI_SIGNATURE)-1) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "lsi_mega_raid_member"; - - return 0; -} diff --git a/extras/volume_id/lib/luks.c b/extras/volume_id/lib/luks.c deleted file mode 100644 index 1c9d412767..0000000000 --- a/extras/volume_id/lib/luks.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 W. Michael Petullo - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -#define SECTOR_SHIFT 9 -#define SECTOR_SIZE (1 << SECTOR_SHIFT) - -#define LUKS_CIPHERNAME_L 32 -#define LUKS_CIPHERMODE_L 32 -#define LUKS_HASHSPEC_L 32 -#define LUKS_DIGESTSIZE 20 -#define LUKS_SALTSIZE 32 -#define LUKS_NUMKEYS 8 - -#define LUKS_MAGIC_L 6 -#define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1) -#define UUID_STRING_L 40 -static const uint8_t LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe}; - -struct luks_phdr { - uint8_t magic[LUKS_MAGIC_L]; - uint16_t version; - uint8_t cipherName[LUKS_CIPHERNAME_L]; - uint8_t cipherMode[LUKS_CIPHERMODE_L]; - uint8_t hashSpec[LUKS_HASHSPEC_L]; - uint32_t payloadOffset; - uint32_t keyBytes; - uint8_t mkDigest[LUKS_DIGESTSIZE]; - uint8_t mkDigestSalt[LUKS_SALTSIZE]; - uint32_t mkDigestIterations; - uint8_t uuid[UUID_STRING_L]; - struct { - uint32_t active; - uint32_t passwordIterations; - uint8_t passwordSalt[LUKS_SALTSIZE]; - uint32_t keyMaterialOffset; - uint32_t stripes; - } keyblock[LUKS_NUMKEYS]; -}; - -int volume_id_probe_luks(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct luks_phdr *header; - - header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE); - if (header == NULL) - return -1; - - if (memcmp(header->magic, LUKS_MAGIC, LUKS_MAGIC_L)) - return -1; - - volume_id_set_usage(id, VOLUME_ID_CRYPTO); - volume_id_set_uuid(id, header->uuid, 36, UUID_HEX_STRING); - snprintf(id->type_version, sizeof(header->version), "%u", le16_to_cpu(header->version)); - id->type = "crypto_LUKS"; - return 0; -} diff --git a/extras/volume_id/lib/lvm.c b/extras/volume_id/lib/lvm.c deleted file mode 100644 index a3f409a0ee..0000000000 --- a/extras/volume_id/lib/lvm.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct lvm1_super_block { - uint8_t id[2]; -} PACKED; - -struct lvm2_super_block { - uint8_t id[8]; - uint64_t sector_xl; - uint32_t crc_xl; - uint32_t offset_xl; - uint8_t type[8]; -} PACKED; - -struct lvm2_pv_header { - uint8_t id[32]; - uint64_t devsize_xl; -} PACKED; - -#define LVM1_SB_OFF 0x400 -#define LVM1_MAGIC "HM" - -int volume_id_probe_lvm1(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct lvm1_super_block *lvm; - - info("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off + LVM1_SB_OFF, 0x800); - if (buf == NULL) - return -1; - - lvm = (struct lvm1_super_block *) buf; - - if (memcmp(lvm->id, LVM1_MAGIC, 2) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "LVM1_member"; - - return 0; -} - -#define LVM2_LABEL_ID "LABELONE" -#define LVM2LABEL_SCAN_SECTORS 4 - -int volume_id_probe_lvm2(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - unsigned int soff; - struct lvm2_super_block *lvm; - struct lvm2_pv_header *pvhdr; - - dbg("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off, LVM2LABEL_SCAN_SECTORS * 0x200); - if (buf == NULL) - return -1; - - - for (soff = 0; soff < LVM2LABEL_SCAN_SECTORS * 0x200; soff += 0x200) { - lvm = (struct lvm2_super_block *) &buf[soff]; - - if (memcmp(lvm->id, LVM2_LABEL_ID, 8) == 0) - goto found; - } - - return -1; - -found: - dbg("found at offset 0x%x (pv hdr offset 0x%x)\n", - soff, cpu_to_le32(lvm->offset_xl)); - soff += cpu_to_le32(lvm->offset_xl); - pvhdr = (struct lvm2_pv_header *) &buf[soff]; - memcpy(id->type_version, lvm->type, 8); - volume_id_set_usage(id, VOLUME_ID_RAID); - volume_id_set_uuid(id, pvhdr->id, 0, UUID_LVM); - id->type = "LVM2_member"; - - return 0; -} diff --git a/extras/volume_id/lib/md5.c b/extras/volume_id/lib/md5.c deleted file mode 100644 index 846a94963a..0000000000 --- a/extras/volume_id/lib/md5.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * MD5 Message Digest Algorithm (RFC1321). - * - * Derived from cryptoapi implementation, originally based on the - * public domain implementation written by Colin Plumb in 1993. - * - * Copyright (c) Cryptoapi developers. - * Copyright (c) 2002 James Morris - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include - -#include "md5.h" - -#if !defined __BYTE_ORDER || !(__BYTE_ORDER == __LITTLE_ENDIAN) && !(__BYTE_ORDER == __BIG_ENDIAN) -#error missing __BYTE_ORDER -#endif - -#define F1(x, y, z) (z ^ (x & (y ^ z))) -#define F2(x, y, z) F1(z, x, y) -#define F3(x, y, z) (x ^ y ^ z) -#define F4(x, y, z) (y ^ (x | ~z)) - -#define MD5STEP(f, w, x, y, z, in, s) \ - (w += f(x, y, z) + in, w = (w<>(32-s)) + x) - -static void md5_transform(uint32_t *hash, uint32_t const *in) -{ - uint32_t a, b, c, d; - - a = hash[0]; - b = hash[1]; - c = hash[2]; - d = hash[3]; - - MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); - MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); - MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); - MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); - MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); - MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); - MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); - MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); - MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); - MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); - MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); - MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); - MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); - MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); - MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); - MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); - - MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); - MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); - MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); - MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); - MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); - MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); - MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); - MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); - MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); - MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); - MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); - MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); - MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); - MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); - MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); - MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); - - MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); - MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); - MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); - MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); - MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); - MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); - MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); - MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); - MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); - MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); - MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); - MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); - MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); - MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); - MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); - MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); - - MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); - MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); - MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); - MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); - MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); - MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); - MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); - MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); - MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); - MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); - MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); - MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); - MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); - MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); - MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); - MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); - - hash[0] += a; - hash[1] += b; - hash[2] += c; - hash[3] += d; -} - -static inline void swab32_array(uint32_t *buf, unsigned int words) -{ - unsigned int i; - - for (i = 0; i < words; i++) - buf[i] = bswap_32(buf[i]); -} - -static inline void le32_to_cpu_array(uint32_t *buf, unsigned int words) -{ -#if (__BYTE_ORDER == __BIG_ENDIAN) - swab32_array(buf, words); -#endif -} -static inline void cpu_to_le32_array(uint32_t *buf, unsigned int words) -{ -#if (__BYTE_ORDER == __BIG_ENDIAN) - swab32_array(buf, words); -#endif -} - -static inline void md5_transform_helper(struct md5_ctx *ctx) -{ - le32_to_cpu_array(ctx->block, sizeof(ctx->block) / sizeof(uint32_t)); - md5_transform(ctx->hash, ctx->block); -} - -void md5_init(struct md5_ctx *mctx) -{ - mctx->hash[0] = 0x67452301; - mctx->hash[1] = 0xefcdab89; - mctx->hash[2] = 0x98badcfe; - mctx->hash[3] = 0x10325476; - mctx->byte_count = 0; -} - -void md5_update(struct md5_ctx *mctx, const uint8_t *data, unsigned int len) -{ - const uint32_t avail = sizeof(mctx->block) - (mctx->byte_count & 0x3f); - - mctx->byte_count += len; - - if (avail > len) { - memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), - data, len); - return; - } - - memcpy((char *)mctx->block + (sizeof(mctx->block) - avail), data, avail); - - md5_transform_helper(mctx); - data += avail; - len -= avail; - - while (len >= sizeof(mctx->block)) { - memcpy(mctx->block, data, sizeof(mctx->block)); - md5_transform_helper(mctx); - data += sizeof(mctx->block); - len -= sizeof(mctx->block); - } - - memcpy(mctx->block, data, len); -} - -void md5_final(struct md5_ctx *mctx, uint8_t *out) -{ - const unsigned int offset = mctx->byte_count & 0x3f; - char *p = (char *)mctx->block + offset; - int padding = 56 - (offset + 1); - - *p++ = 0x80; - if (padding < 0) { - memset(p, 0x00, padding + sizeof (uint64_t)); - md5_transform_helper(mctx); - p = (char *)mctx->block; - padding = 56; - } - - memset(p, 0, padding); - mctx->block[14] = mctx->byte_count << 3; - mctx->block[15] = mctx->byte_count >> 29; - le32_to_cpu_array(mctx->block, (sizeof(mctx->block) - - sizeof(uint64_t)) / sizeof(uint32_t)); - md5_transform(mctx->hash, mctx->block); - cpu_to_le32_array(mctx->hash, sizeof(mctx->hash) / sizeof(uint32_t)); - memcpy(out, mctx->hash, sizeof(mctx->hash)); - memset(mctx, 0, sizeof(*mctx)); -} diff --git a/extras/volume_id/lib/md5.h b/extras/volume_id/lib/md5.h deleted file mode 100644 index 3d7bd39a57..0000000000 --- a/extras/volume_id/lib/md5.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * MD5 Message Digest Algorithm (RFC1321). - * - * Derived from cryptoapi implementation, originally based on the - * public domain implementation written by Colin Plumb in 1993. - * - * Copyright (c) Cryptoapi developers. - * Copyright (c) 2002 James Morris - * - * 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; either version 2 of the License, or (at your option) - * any later version. - * - */ - -#define MD5_DIGEST_SIZE 16 -#define MD5_HMAC_BLOCK_SIZE 64 -#define MD5_BLOCK_WORDS 16 -#define MD5_HASH_WORDS 4 - -struct md5_ctx { - uint32_t hash[MD5_HASH_WORDS]; - uint32_t block[MD5_BLOCK_WORDS]; - uint64_t byte_count; -}; - -extern void md5_init(struct md5_ctx *mctx); -extern void md5_update(struct md5_ctx *mctx, const uint8_t *data, unsigned int len); -extern void md5_final(struct md5_ctx *mctx, uint8_t *out); diff --git a/extras/volume_id/lib/minix.c b/extras/volume_id/lib/minix.c deleted file mode 100644 index cca1585602..0000000000 --- a/extras/volume_id/lib/minix.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005-2007 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -#define MINIX_SUPERBLOCK_OFFSET 0x400 - -#define MINIX_SUPER_MAGIC 0x137F -#define MINIX_SUPER_MAGIC2 0x138F -#define MINIX2_SUPER_MAGIC 0x2468 -#define MINIX2_SUPER_MAGIC2 0x2478 -#define MINIX3_SUPER_MAGIC 0x4d5a - -struct minix_super_block -{ - uint16_t s_ninodes; - uint16_t s_nzones; - uint16_t s_imap_blocks; - uint16_t s_zmap_blocks; - uint16_t s_firstdatazone; - uint16_t s_log_zone_size; - uint32_t s_max_size; - uint16_t s_magic; - uint16_t s_state; - uint32_t s_zones; -} PACKED; - -struct minix3_super_block { - uint32_t s_ninodes; - uint16_t s_pad0; - uint16_t s_imap_blocks; - uint16_t s_zmap_blocks; - uint16_t s_firstdatazone; - uint16_t s_log_zone_size; - uint16_t s_pad1; - uint32_t s_max_size; - uint32_t s_zones; - uint16_t s_magic; - uint16_t s_pad2; - uint16_t s_blocksize; - uint8_t s_disk_version; -} PACKED; - -int volume_id_probe_minix(struct volume_id *id, uint64_t off, uint64_t size) -{ - uint8_t *buf; - struct minix_super_block *ms; - struct minix3_super_block *m3s; - - info("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off + MINIX_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - ms = (struct minix_super_block *) buf; - - if (ms->s_magic == MINIX_SUPER_MAGIC || - ms->s_magic == bswap_16(MINIX_SUPER_MAGIC)) { - strcpy(id->type_version, "1"); - goto found; - } - if (ms->s_magic == MINIX_SUPER_MAGIC2 || - ms->s_magic == bswap_16(MINIX_SUPER_MAGIC2)) { - strcpy(id->type_version, "1"); - goto found; - } - if (ms->s_magic == MINIX2_SUPER_MAGIC || - ms->s_magic == bswap_16(MINIX2_SUPER_MAGIC)) { - strcpy(id->type_version, "2"); - goto found; - } - if (ms->s_magic == MINIX2_SUPER_MAGIC2 || - ms->s_magic == bswap_16(MINIX2_SUPER_MAGIC2)) { - strcpy(id->type_version, "2"); - goto found; - } - - m3s = (struct minix3_super_block *) buf; - if (m3s->s_magic == MINIX3_SUPER_MAGIC || - m3s->s_magic == bswap_16(MINIX3_SUPER_MAGIC)) { - strcpy(id->type_version, "3"); - goto found; - } - goto exit; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "minix"; - return 0; - -exit: - return -1; -} diff --git a/extras/volume_id/lib/netware.c b/extras/volume_id/lib/netware.c deleted file mode 100644 index 58749e5f05..0000000000 --- a/extras/volume_id/lib/netware.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2006 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -#define NW_SUPERBLOCK_OFFSET 0x1000 - -struct netware_super_block { - uint8_t SBH_Signature[4]; - uint16_t SBH_VersionMajor; - uint16_t SBH_VersionMinor; - uint16_t SBH_VersionMediaMajor; - uint16_t SBH_VersionMediaMinor; - uint32_t SBH_ItemsMoved; - uint8_t SBH_InternalID[16]; - uint32_t SBH_PackedSize; - uint32_t SBH_Checksum; - uint32_t supersyncid; - int64_t superlocation[4]; - uint32_t physSizeUsed; - uint32_t sizeUsed; - uint32_t superTimeStamp; - uint32_t reserved0[1]; - int64_t SBH_LoggedPoolDataBlk; - int64_t SBH_PoolDataBlk; - uint8_t SBH_OldInternalID[16]; - uint32_t SBH_PoolToLVStartUTC; - uint32_t SBH_PoolToLVEndUTC; - uint16_t SBH_VersionMediaMajorCreate; - uint16_t SBH_VersionMediaMinorCreate; - uint32_t SBH_BlocksMoved; - uint32_t SBH_TempBTSpBlk; - uint32_t SBH_TempFTSpBlk; - uint32_t SBH_TempFTSpBlk1; - uint32_t SBH_TempFTSpBlk2; - uint32_t nssMagicNumber; - uint32_t poolClassID; - uint32_t poolID; - uint32_t createTime; - int64_t SBH_LoggedVolumeDataBlk; - int64_t SBH_VolumeDataBlk; - int64_t SBH_SystemBeastBlkNum; - uint64_t totalblocks; - uint16_t SBH_Name[64]; - uint8_t SBH_VolumeID[16]; - uint8_t SBH_PoolID[16]; - uint8_t SBH_PoolInternalID[16]; - uint64_t SBH_Lsn; - uint32_t SBH_SS_Enabled; - uint32_t SBH_SS_CreateTime; - uint8_t SBH_SS_OriginalPoolID[16]; - uint8_t SBH_SS_OriginalVolumeID[16]; - uint8_t SBH_SS_Guid[16]; - uint16_t SBH_SS_OriginalName[64]; - uint32_t reserved2[64-(2+46)]; -} PACKED; - -int volume_id_probe_netware(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct netware_super_block *nw; - - info("probing at offset 0x%" PRIx64 "\n", off); - - nw = (struct netware_super_block *) volume_id_get_buffer(id, off + NW_SUPERBLOCK_OFFSET, 0x200); - if (nw == NULL) - return -1; - - if (memcmp(nw->SBH_Signature, "SPB5", 4) != 0) - return -1; - - volume_id_set_uuid(id, nw->SBH_PoolID, 0, UUID_DCE); - - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%02u", - le16_to_cpu(nw->SBH_VersionMediaMajor), le16_to_cpu(nw->SBH_VersionMediaMinor)); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "nss"; - - return 0; -} diff --git a/extras/volume_id/lib/ntfs.c b/extras/volume_id/lib/ntfs.c deleted file mode 100644 index f727634094..0000000000 --- a/extras/volume_id/lib/ntfs.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -static struct ntfs_super_block { - uint8_t jump[3]; - uint8_t oem_id[8]; - uint16_t bytes_per_sector; - uint8_t sectors_per_cluster; - uint16_t reserved_sectors; - uint8_t fats; - uint16_t root_entries; - uint16_t sectors; - uint8_t media_type; - uint16_t sectors_per_fat; - uint16_t sectors_per_track; - uint16_t heads; - uint32_t hidden_sectors; - uint32_t large_sectors; - uint16_t unused[2]; - uint64_t number_of_sectors; - uint64_t mft_cluster_location; - uint64_t mft_mirror_cluster_location; - int8_t cluster_per_mft_record; - uint8_t reserved1[3]; - int8_t cluster_per_index_record; - uint8_t reserved2[3]; - uint8_t volume_serial[8]; - uint16_t checksum; -} PACKED *ns; - -static struct master_file_table_record { - uint8_t magic[4]; - uint16_t usa_ofs; - uint16_t usa_count; - uint64_t lsn; - uint16_t sequence_number; - uint16_t link_count; - uint16_t attrs_offset; - uint16_t flags; - uint32_t bytes_in_use; - uint32_t bytes_allocated; -} PACKED *mftr; - -static struct file_attribute { - uint32_t type; - uint32_t len; - uint8_t non_resident; - uint8_t name_len; - uint16_t name_offset; - uint16_t flags; - uint16_t instance; - uint32_t value_len; - uint16_t value_offset; -} PACKED *attr; - -static struct volume_info { - uint64_t reserved; - uint8_t major_ver; - uint8_t minor_ver; -} PACKED *info; - -#define MFT_RECORD_VOLUME 3 -#define MFT_RECORD_ATTR_VOLUME_NAME 0x60 -#define MFT_RECORD_ATTR_VOLUME_INFO 0x70 -#define MFT_RECORD_ATTR_OBJECT_ID 0x40 -#define MFT_RECORD_ATTR_END 0xffffffffu - -int volume_id_probe_ntfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - uint8_t volume_serial[8]; - unsigned int sector_size; - unsigned int cluster_size; - uint64_t mft_cluster; - uint64_t mft_off; - unsigned int mft_record_size; - unsigned int attr_type; - unsigned int attr_off; - unsigned int attr_len; - unsigned int val_off; - unsigned int val_len; - const uint8_t *buf; - const uint8_t *val; - - info("probing at offset 0x%" PRIx64 "\n", off); - - ns = (struct ntfs_super_block *) volume_id_get_buffer(id, off, 0x200); - if (ns == NULL) - return -1; - - if (memcmp(ns->oem_id, "NTFS", 4) != 0) - return -1; - - memcpy(volume_serial, ns->volume_serial, sizeof(volume_serial)); - - sector_size = le16_to_cpu(ns->bytes_per_sector); - if (sector_size < 0x200) - return -1; - - cluster_size = ns->sectors_per_cluster * sector_size; - mft_cluster = le64_to_cpu(ns->mft_cluster_location); - mft_off = mft_cluster * cluster_size; - - if (ns->cluster_per_mft_record < 0) - /* size = -log2(mft_record_size); normally 1024 Bytes */ - mft_record_size = 1 << -ns->cluster_per_mft_record; - else - mft_record_size = ns->cluster_per_mft_record * cluster_size; - - dbg("sectorsize 0x%x\n", sector_size); - dbg("clustersize 0x%x\n", cluster_size); - dbg("mftcluster %" PRIu64 "\n", mft_cluster); - dbg("mftoffset 0x%" PRIx64 "\n", mft_off); - dbg("cluster per mft_record %i\n", ns->cluster_per_mft_record); - dbg("mft record size %i\n", mft_record_size); - - buf = volume_id_get_buffer(id, off + mft_off + (MFT_RECORD_VOLUME * mft_record_size), - mft_record_size); - if (buf == NULL) - return -1; - - mftr = (struct master_file_table_record*) buf; - dbg("mftr->magic '%c%c%c%c'\n", mftr->magic[0], mftr->magic[1], mftr->magic[2], mftr->magic[3]); - if (memcmp(mftr->magic, "FILE", 4) != 0) - return -1; - - attr_off = le16_to_cpu(mftr->attrs_offset); - dbg("file $Volume's attributes are at offset %i\n", attr_off); - - while (1) { - attr = (struct file_attribute*) &buf[attr_off]; - attr_type = le32_to_cpu(attr->type); - attr_len = le16_to_cpu(attr->len); - val_off = le16_to_cpu(attr->value_offset); - val_len = le32_to_cpu(attr->value_len); - attr_off += attr_len; - - if (attr_len == 0) - break; - - if (attr_off >= mft_record_size) - break; - - if (attr_type == MFT_RECORD_ATTR_END) - break; - - dbg("found attribute type 0x%x, len %i, at offset %i\n", - attr_type, attr_len, attr_off); - - if (attr_type == MFT_RECORD_ATTR_VOLUME_INFO) { - dbg("found info, len %i\n", val_len); - info = (struct volume_info*) (((uint8_t *) attr) + val_off); - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", info->major_ver, info->minor_ver); - } - - if (attr_type == MFT_RECORD_ATTR_VOLUME_NAME) { - dbg("found label, len %i\n", val_len); - if (val_len > VOLUME_ID_LABEL_SIZE) - val_len = VOLUME_ID_LABEL_SIZE; - - val = ((uint8_t *) attr) + val_off; - volume_id_set_label_raw(id, val, val_len); - volume_id_set_label_unicode16(id, val, LE, val_len); - } - } - - volume_id_set_uuid(id, volume_serial, 0, UUID_64BIT_LE); - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "ntfs"; - /* we think this is ntfs, but we make sure no other signatures are found */ - id->force_unique_result = 1; - return 0; -} diff --git a/extras/volume_id/lib/nvidia_raid.c b/extras/volume_id/lib/nvidia_raid.c deleted file mode 100644 index 2969dbe3dd..0000000000 --- a/extras/volume_id/lib/nvidia_raid.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct nvidia_meta { - uint8_t vendor[8]; - uint32_t size; - uint32_t chksum; - uint16_t version; -} PACKED; - -#define NVIDIA_SIGNATURE "NVIDIA" - -int volume_id_probe_nvidia_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct nvidia_meta *nv; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-2) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - nv = (struct nvidia_meta *) buf; - if (memcmp(nv->vendor, NVIDIA_SIGNATURE, sizeof(NVIDIA_SIGNATURE)-1) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", le16_to_cpu(nv->version)); - id->type = "nvidia_raid_member"; - - return 0; -} diff --git a/extras/volume_id/lib/ocfs.c b/extras/volume_id/lib/ocfs.c deleted file mode 100644 index e7bf55c421..0000000000 --- a/extras/volume_id/lib/ocfs.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Andre Masella - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct ocfs1_super_block_header { - uint32_t minor_version; - uint32_t major_version; - uint8_t signature[128]; - uint8_t mount_point[128]; - uint64_t serial_num; - uint64_t device_size; - uint64_t start_off; - uint64_t bitmap_off; - uint64_t publ_off; - uint64_t vote_off; - uint64_t root_bitmap_off; - uint64_t data_start_off; - uint64_t root_bitmap_size; - uint64_t root_off; - uint64_t root_size; - uint64_t cluster_size; - uint64_t num_nodes; - uint64_t num_clusters; - uint64_t dir_node_size; - uint64_t file_node_size; - uint64_t internal_off; - uint64_t node_cfg_off; - uint64_t node_cfg_size; - uint64_t new_cfg_off; - uint32_t prot_bits; - int32_t excl_mount; -} PACKED; - -struct ocfs1_super_block_label { - struct ocfs1_disk_lock { - uint32_t curr_master; - uint8_t file_lock; - uint8_t compat_pad[3]; - uint64_t last_write_time; - uint64_t last_read_time; - uint32_t writer_node_num; - uint32_t reader_node_num; - uint64_t oin_node_map; - uint64_t dlock_seq_num; - } PACKED disk_lock; - uint8_t label[64]; - uint16_t label_len; - uint8_t vol_id[16]; - uint16_t vol_id_len; - uint8_t cluster_name[64]; - uint16_t cluster_name_len; -} PACKED; - -struct ocfs2_super_block { - uint8_t i_signature[8]; - uint32_t i_generation; - int16_t i_suballoc_slot; - uint16_t i_suballoc_bit; - uint32_t i_reserved0; - uint32_t i_clusters; - uint32_t i_uid; - uint32_t i_gid; - uint64_t i_size; - uint16_t i_mode; - uint16_t i_links_count; - uint32_t i_flags; - uint64_t i_atime; - uint64_t i_ctime; - uint64_t i_mtime; - uint64_t i_dtime; - uint64_t i_blkno; - uint64_t i_last_eb_blk; - uint32_t i_fs_generation; - uint32_t i_atime_nsec; - uint32_t i_ctime_nsec; - uint32_t i_mtime_nsec; - uint64_t i_reserved1[9]; - uint64_t i_pad1; - uint16_t s_major_rev_level; - uint16_t s_minor_rev_level; - uint16_t s_mnt_count; - int16_t s_max_mnt_count; - uint16_t s_state; - uint16_t s_errors; - uint32_t s_checkinterval; - uint64_t s_lastcheck; - uint32_t s_creator_os; - uint32_t s_feature_compat; - uint32_t s_feature_incompat; - uint32_t s_feature_ro_compat; - uint64_t s_root_blkno; - uint64_t s_system_dir_blkno; - uint32_t s_blocksize_bits; - uint32_t s_clustersize_bits; - uint16_t s_max_slots; - uint16_t s_reserved1; - uint32_t s_reserved2; - uint64_t s_first_cluster_group; - uint8_t s_label[64]; - uint8_t s_uuid[16]; -} PACKED; - -int volume_id_probe_ocfs1(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct ocfs1_super_block_header *osh; - struct ocfs1_super_block_label *osl; - - info("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off, 0x200); - if (buf == NULL) - return -1; - - osh = (struct ocfs1_super_block_header *) buf; - if (memcmp(osh->signature, "OracleCFS", 9) != 0) - return -1; - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", osh->major_version, osh->minor_version); - - dbg("found OracleCFS signature, now reading label\n"); - buf = volume_id_get_buffer(id, off + 0x200, 0x200); - if (buf == NULL) - return -1; - - osl = (struct ocfs1_super_block_label *) buf; - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - if (osl->label_len <= 64) { - volume_id_set_label_raw(id, osl->label, 64); - volume_id_set_label_string(id, osl->label, 64); - } - if (osl->vol_id_len == 16) - volume_id_set_uuid(id, osl->vol_id, 0, UUID_DCE); - id->type = "ocfs"; - return 0; -} - -#define OCFS2_MAX_BLOCKSIZE 0x1000 -#define OCFS2_SUPER_BLOCK_BLKNO 2 - -int volume_id_probe_ocfs2(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct ocfs2_super_block *os; - size_t blksize; - - info("probing at offset 0x%" PRIx64 "\n", off); - - for (blksize = 0x200; blksize <= OCFS2_MAX_BLOCKSIZE; blksize <<= 1) { - buf = volume_id_get_buffer(id, off + OCFS2_SUPER_BLOCK_BLKNO * blksize, 0x200); - if (buf == NULL) - return -1; - - os = (struct ocfs2_super_block *) buf; - if (memcmp(os->i_signature, "OCFSV2", 6) != 0) - continue; - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - volume_id_set_label_raw(id, os->s_label, 64); - volume_id_set_label_string(id, os->s_label, 64); - volume_id_set_uuid(id, os->s_uuid, 0, UUID_DCE); - snprintf(id->type_version, sizeof(id->type_version)-1, - "%u.%u", os->s_major_rev_level, os->s_minor_rev_level); - id->type = "ocfs2"; - return 0; - } - return -1; -} diff --git a/extras/volume_id/lib/oracleasm.c b/extras/volume_id/lib/oracleasm.c deleted file mode 100644 index 8e63fb1209..0000000000 --- a/extras/volume_id/lib/oracleasm.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct oracleasm_super_block { - uint8_t tag[8]; - uint8_t id[24]; -} PACKED; - -#define ASM_SB_OFF 0x20 -#define ASM_MAGIC "ORCLDISK" - -/* - * Detect Oracle Automatic Storage Management (ASM). - * It can do mirroring, but don't consider it RAID in the sense - * that an ext3 filesystem could live inside. Thus, mark it 'other'. - * There also is a magic word 'ORCLCLRD'; like blkid(8), we ignore that. - */ -int volume_id_probe_oracleasm(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct oracleasm_super_block *oracleasm; - - info("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off + ASM_SB_OFF, 0x800); - if (buf == NULL) - return -1; - - oracleasm = (struct oracleasm_super_block *) buf; - - if (memcmp(oracleasm->tag, ASM_MAGIC, 8) != 0) - return -1; - - volume_id_set_usage(id, VOLUME_ID_OTHER); - volume_id_set_label_raw(id, oracleasm->id, 24); - volume_id_set_label_string(id, oracleasm->id, 24); - id->type = "oracleasm"; - - return 0; -} diff --git a/extras/volume_id/lib/promise_raid.c b/extras/volume_id/lib/promise_raid.c deleted file mode 100644 index cdc90a1a65..0000000000 --- a/extras/volume_id/lib/promise_raid.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct promise_meta { - uint8_t sig[24]; -} PACKED; - -#define PDC_CONFIG_OFF 0x1200 -#define PDC_SIGNATURE "Promise Technology, Inc." - -int volume_id_probe_promise_fasttrack_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - struct promise_meta *pdc; - unsigned int i; - static unsigned int sectors[] = { - 63, 255, 256, 16, 399, 0 - }; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - if (size < 0x40000) - return -1; - - for (i = 0; sectors[i] != 0; i++) { - uint64_t meta_off; - - meta_off = ((size / 0x200) - sectors[i]) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - pdc = (struct promise_meta *) buf; - if (memcmp(pdc->sig, PDC_SIGNATURE, sizeof(PDC_SIGNATURE)-1) == 0) - goto found; - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_RAID); - id->type = "promise_fasttrack_raid_member"; - - return 0; -} diff --git a/extras/volume_id/lib/reiserfs.c b/extras/volume_id/lib/reiserfs.c deleted file mode 100644 index cdc46912ab..0000000000 --- a/extras/volume_id/lib/reiserfs.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * Copyright (C) 2005 Tobias Klauser - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct reiserfs_super_block { - uint32_t blocks_count; - uint32_t free_blocks; - uint32_t root_block; - uint32_t journal_block; - uint32_t journal_dev; - uint32_t orig_journal_size; - uint32_t dummy2[5]; - uint16_t blocksize; - uint16_t dummy3[3]; - uint8_t magic[12]; - uint32_t dummy4[5]; - uint8_t uuid[16]; - uint8_t label[16]; -} PACKED; - -struct reiser4_super_block { - uint8_t magic[16]; - uint16_t dummy[2]; - uint8_t uuid[16]; - uint8_t label[16]; - uint64_t dummy2; -} PACKED; - -#define REISERFS1_SUPERBLOCK_OFFSET 0x2000 -#define REISERFS_SUPERBLOCK_OFFSET 0x10000 - -int volume_id_probe_reiserfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct reiserfs_super_block *rs; - struct reiser4_super_block *rs4; - uint8_t *buf; - - info("probing at offset 0x%" PRIx64 "\n", off); - - buf = volume_id_get_buffer(id, off + REISERFS_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - rs = (struct reiserfs_super_block *) buf; - if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { - strcpy(id->type_version, "3.5"); - id->type = "reiserfs"; - goto found; - } - if (memcmp(rs->magic, "ReIsEr2Fs", 9) == 0) { - strcpy(id->type_version, "3.6"); - id->type = "reiserfs"; - goto found_label; - } - if (memcmp(rs->magic, "ReIsEr3Fs", 9) == 0) { - strcpy(id->type_version, "JR"); - id->type = "reiserfs"; - goto found_label; - } - - rs4 = (struct reiser4_super_block *) buf; - if (memcmp(rs4->magic, "ReIsEr4", 7) == 0) { - strcpy(id->type_version, "4"); - volume_id_set_label_raw(id, rs4->label, 16); - volume_id_set_label_string(id, rs4->label, 16); - volume_id_set_uuid(id, rs4->uuid, 0, UUID_DCE); - id->type = "reiser4"; - goto found; - } - - buf = volume_id_get_buffer(id, off + REISERFS1_SUPERBLOCK_OFFSET, 0x200); - if (buf == NULL) - return -1; - - rs = (struct reiserfs_super_block *) buf; - if (memcmp(rs->magic, "ReIsErFs", 8) == 0) { - strcpy(id->type_version, "3.5"); - id->type = "reiserfs"; - goto found; - } - - return -1; - -found_label: - volume_id_set_label_raw(id, rs->label, 16); - volume_id_set_label_string(id, rs->label, 16); - volume_id_set_uuid(id, rs->uuid, 0, UUID_DCE); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - - return 0; -} diff --git a/extras/volume_id/lib/romfs.c b/extras/volume_id/lib/romfs.c deleted file mode 100644 index 1c9a6f2497..0000000000 --- a/extras/volume_id/lib/romfs.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct romfs_super { - uint8_t magic[8]; - uint32_t size; - uint32_t checksum; - uint8_t name[0]; -} PACKED; - -int volume_id_probe_romfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct romfs_super *rfs; - - info("probing at offset 0x%" PRIx64 "\n", off); - - rfs = (struct romfs_super *) volume_id_get_buffer(id, off, 0x200); - if (rfs == NULL) - return -1; - - if (memcmp(rfs->magic, "-rom1fs-", 4) == 0) { - size_t len = strlen((char *)rfs->name); - - if (len) { - volume_id_set_label_raw(id, rfs->name, len); - volume_id_set_label_string(id, rfs->name, len); - } - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "romfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/lib/silicon_raid.c b/extras/volume_id/lib/silicon_raid.c deleted file mode 100644 index 4289788283..0000000000 --- a/extras/volume_id/lib/silicon_raid.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct silicon_meta { - uint8_t unknown0[0x2E]; - uint8_t ascii_version[0x36 - 0x2E]; - uint8_t diskname[0x56 - 0x36]; - uint8_t unknown1[0x60 - 0x56]; - uint32_t magic; - uint32_t unknown1a[0x6C - 0x64]; - uint32_t array_sectors_low; - uint32_t array_sectors_high; - uint8_t unknown2[0x78 - 0x74]; - uint32_t thisdisk_sectors; - uint8_t unknown3[0x100 - 0x7C]; - uint8_t unknown4[0x104 - 0x100]; - uint16_t product_id; - uint16_t vendor_id; - uint16_t minor_ver; - uint16_t major_ver; -} PACKED; - -#define SILICON_MAGIC 0x2F000000 - -int volume_id_probe_silicon_medley_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct silicon_meta *sil; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - sil = (struct silicon_meta *) buf; - if (le32_to_cpu(sil->magic) != SILICON_MAGIC) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u.%u", - le16_to_cpu(sil->major_ver), le16_to_cpu(sil->minor_ver)); - id->type = "silicon_medley_raid_member"; - - return 0; -} diff --git a/extras/volume_id/lib/squashfs.c b/extras/volume_id/lib/squashfs.c deleted file mode 100644 index 6952e5ceca..0000000000 --- a/extras/volume_id/lib/squashfs.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2006 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -#define SQUASHFS_MAGIC 0x73717368 -#define SQUASHFS_MAGIC_LZMA 0x71736873 - -struct squashfs_super { - uint32_t s_magic; - uint32_t inodes; - uint32_t bytes_used_2; - uint32_t uid_start_2; - uint32_t guid_start_2; - uint32_t inode_table_start_2; - uint32_t directory_table_start_2; - uint16_t s_major; - uint16_t s_minor; -} PACKED; - -int volume_id_probe_squashfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct squashfs_super *sqs; - - info("probing at offset 0x%" PRIx64 "\n", off); - - sqs = (struct squashfs_super *) volume_id_get_buffer(id, off, 0x200); - if (sqs == NULL) - return -1; - - if (sqs->s_magic == SQUASHFS_MAGIC || sqs->s_magic == SQUASHFS_MAGIC_LZMA) { - snprintf(id->type_version, sizeof(id->type_version), "%u.%u", - sqs->s_major, sqs->s_minor); - goto found; - } - if (sqs->s_magic == bswap_32(SQUASHFS_MAGIC) || sqs->s_magic == bswap_32(SQUASHFS_MAGIC_LZMA)) { - snprintf(id->type_version, sizeof(id->type_version), "%u.%u", - bswap_16(sqs->s_major), bswap_16(sqs->s_minor)); - goto found; - } - - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "squashfs"; - return 0; -} diff --git a/extras/volume_id/lib/sysv.c b/extras/volume_id/lib/sysv.c deleted file mode 100644 index 586dc1d145..0000000000 --- a/extras/volume_id/lib/sysv.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -#define SYSV_NICINOD 100 -#define SYSV_NICFREE 50 - -struct sysv_super -{ - uint16_t s_isize; - uint16_t s_pad0; - uint32_t s_fsize; - uint16_t s_nfree; - uint16_t s_pad1; - uint32_t s_free[SYSV_NICFREE]; - uint16_t s_ninode; - uint16_t s_pad2; - uint16_t s_inode[SYSV_NICINOD]; - uint8_t s_flock; - uint8_t s_ilock; - uint8_t s_fmod; - uint8_t s_ronly; - uint32_t s_time; - uint16_t s_dinfo[4]; - uint32_t s_tfree; - uint16_t s_tinode; - uint16_t s_pad3; - uint8_t s_fname[6]; - uint8_t s_fpack[6]; - uint32_t s_fill[12]; - uint32_t s_state; - uint32_t s_magic; - uint32_t s_type; -} PACKED; - -#define XENIX_NICINOD 100 -#define XENIX_NICFREE 100 - -struct xenix_super { - uint16_t s_isize; - uint32_t s_fsize; - uint16_t s_nfree; - uint32_t s_free[XENIX_NICFREE]; - uint16_t s_ninode; - uint16_t s_inode[XENIX_NICINOD]; - uint8_t s_flock; - uint8_t s_ilock; - uint8_t s_fmod; - uint8_t s_ronly; - uint32_t s_time; - uint32_t s_tfree; - uint16_t s_tinode; - uint16_t s_dinfo[4]; - uint8_t s_fname[6]; - uint8_t s_fpack[6]; - uint8_t s_clean; - uint8_t s_fill[371]; - uint32_t s_magic; - uint32_t s_type; -} PACKED; - -#define SYSV_SUPERBLOCK_BLOCK 0x01 -#define SYSV_MAGIC 0xfd187e20 -#define XENIX_SUPERBLOCK_BLOCK 0x18 -#define XENIX_MAGIC 0x2b5544 -#define SYSV_MAX_BLOCKSIZE 0x800 - -int volume_id_probe_sysv(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct sysv_super *vs; - struct xenix_super *xs; - unsigned int boff; - - info("probing at offset 0x%" PRIx64 "\n", off); - - for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { - vs = (struct sysv_super *) - volume_id_get_buffer(id, off + (boff * SYSV_SUPERBLOCK_BLOCK), 0x200); - if (vs == NULL) - return -1; - - if (vs->s_magic == cpu_to_le32(SYSV_MAGIC) || vs->s_magic == cpu_to_be32(SYSV_MAGIC)) { - volume_id_set_label_raw(id, vs->s_fname, 6); - volume_id_set_label_string(id, vs->s_fname, 6); - id->type = "sysv"; - goto found; - } - } - - for (boff = 0x200; boff <= SYSV_MAX_BLOCKSIZE; boff <<= 1) { - xs = (struct xenix_super *) - volume_id_get_buffer(id, off + (boff + XENIX_SUPERBLOCK_BLOCK), 0x200); - if (xs == NULL) - return -1; - - if (xs->s_magic == cpu_to_le32(XENIX_MAGIC) || xs->s_magic == cpu_to_be32(XENIX_MAGIC)) { - volume_id_set_label_raw(id, xs->s_fname, 6); - volume_id_set_label_string(id, xs->s_fname, 6); - id->type = "xenix"; - goto found; - } - } - - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - return 0; -} diff --git a/extras/volume_id/lib/udf.c b/extras/volume_id/lib/udf.c deleted file mode 100644 index aed0d76b52..0000000000 --- a/extras/volume_id/lib/udf.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct volume_descriptor { - struct descriptor_tag { - uint16_t id; - uint16_t version; - uint8_t checksum; - uint8_t reserved; - uint16_t serial; - uint16_t crc; - uint16_t crc_len; - uint32_t location; - } PACKED tag; - union { - struct anchor_descriptor { - uint32_t length; - uint32_t location; - } PACKED anchor; - struct primary_descriptor { - uint32_t seq_num; - uint32_t desc_num; - struct dstring { - uint8_t clen; - uint8_t c[31]; - } PACKED ident; - } PACKED primary; - } PACKED type; -} PACKED; - -struct volume_structure_descriptor { - uint8_t type; - uint8_t id[5]; - uint8_t version; -} PACKED; - -#define UDF_VSD_OFFSET 0x8000 - -int volume_id_probe_udf(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct volume_descriptor *vd; - struct volume_structure_descriptor *vsd; - unsigned int bs; - unsigned int b; - unsigned int type; - unsigned int count; - unsigned int loc; - unsigned int clen; - - info("probing at offset 0x%" PRIx64 "\n", off); - - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET, 0x200); - if (vsd == NULL) - return -1; - - if (memcmp(vsd->id, "NSR02", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "NSR03", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "BEA01", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "BOOT2", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "CD001", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "CDW02", 5) == 0) - goto blocksize; - if (memcmp(vsd->id, "TEA03", 5) == 0) - goto blocksize; - return -1; - -blocksize: - /* search the next VSD to get the logical block size of the volume */ - for (bs = 0x800; bs < 0x8000; bs += 0x800) { - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + bs, 0x800); - if (vsd == NULL) - return -1; - dbg("test for blocksize: 0x%x\n", bs); - if (vsd->id[0] != '\0') - goto nsr; - } - return -1; - -nsr: - /* search the list of VSDs for a NSR descriptor */ - for (b = 0; b < 64; b++) { - vsd = (struct volume_structure_descriptor *) volume_id_get_buffer(id, off + UDF_VSD_OFFSET + (b * bs), 0x800); - if (vsd == NULL) - return -1; - - dbg("vsd: %c%c%c%c%c\n", - vsd->id[0], vsd->id[1], vsd->id[2], vsd->id[3], vsd->id[4]); - - if (vsd->id[0] == '\0') - return -1; - if (memcmp(vsd->id, "NSR02", 5) == 0) - goto anchor; - if (memcmp(vsd->id, "NSR03", 5) == 0) - goto anchor; - } - return -1; - -anchor: - /* read anchor volume descriptor */ - vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + (256 * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - if (type != 2) /* TAG_ID_AVDP */ - goto found; - - /* get desriptor list address and block count */ - count = le32_to_cpu(vd->type.anchor.length) / bs; - loc = le32_to_cpu(vd->type.anchor.location); - dbg("0x%x descriptors starting at logical secor 0x%x\n", count, loc); - - /* pick the primary descriptor from the list */ - for (b = 0; b < count; b++) { - vd = (struct volume_descriptor *) volume_id_get_buffer(id, off + ((loc + b) * bs), 0x200); - if (vd == NULL) - return -1; - - type = le16_to_cpu(vd->tag.id); - dbg("descriptor type %i\n", type); - - /* check validity */ - if (type == 0) - goto found; - if (le32_to_cpu(vd->tag.location) != loc + b) - goto found; - - if (type == 1) /* TAG_ID_PVD */ - goto pvd; - } - goto found; - -pvd: - volume_id_set_label_raw(id, &(vd->type.primary.ident.clen), 32); - - clen = vd->type.primary.ident.clen; - dbg("label string charsize=%i bit\n", clen); - if (clen == 8) - volume_id_set_label_string(id, vd->type.primary.ident.c, 31); - else if (clen == 16) - volume_id_set_label_unicode16(id, vd->type.primary.ident.c, BE,31); - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "udf"; - - return 0; -} diff --git a/extras/volume_id/lib/ufs.c b/extras/volume_id/lib/ufs.c deleted file mode 100644 index 0648b454d3..0000000000 --- a/extras/volume_id/lib/ufs.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct ufs_super_block { - uint32_t fs_link; - uint32_t fs_rlink; - uint32_t fs_sblkno; - uint32_t fs_cblkno; - uint32_t fs_iblkno; - uint32_t fs_dblkno; - uint32_t fs_cgoffset; - uint32_t fs_cgmask; - uint32_t fs_time; - uint32_t fs_size; - uint32_t fs_dsize; - uint32_t fs_ncg; - uint32_t fs_bsize; - uint32_t fs_fsize; - uint32_t fs_frag; - uint32_t fs_minfree; - uint32_t fs_rotdelay; - uint32_t fs_rps; - uint32_t fs_bmask; - uint32_t fs_fmask; - uint32_t fs_bshift; - uint32_t fs_fshift; - uint32_t fs_maxcontig; - uint32_t fs_maxbpg; - uint32_t fs_fragshift; - uint32_t fs_fsbtodb; - uint32_t fs_sbsize; - uint32_t fs_csmask; - uint32_t fs_csshift; - uint32_t fs_nindir; - uint32_t fs_inopb; - uint32_t fs_nspf; - uint32_t fs_optim; - uint32_t fs_npsect_state; - uint32_t fs_interleave; - uint32_t fs_trackskew; - uint32_t fs_id[2]; - uint32_t fs_csaddr; - uint32_t fs_cssize; - uint32_t fs_cgsize; - uint32_t fs_ntrak; - uint32_t fs_nsect; - uint32_t fs_spc; - uint32_t fs_ncyl; - uint32_t fs_cpg; - uint32_t fs_ipg; - uint32_t fs_fpg; - struct ufs_csum { - uint32_t cs_ndir; - uint32_t cs_nbfree; - uint32_t cs_nifree; - uint32_t cs_nffree; - } PACKED fs_cstotal; - int8_t fs_fmod; - int8_t fs_clean; - int8_t fs_ronly; - int8_t fs_flags; - union { - struct { - int8_t fs_fsmnt[512]; - uint32_t fs_cgrotor; - uint32_t fs_csp[31]; - uint32_t fs_maxcluster; - uint32_t fs_cpc; - uint16_t fs_opostbl[16][8]; - } PACKED fs_u1; - struct { - int8_t fs_fsmnt[468]; - uint8_t fs_volname[32]; - uint64_t fs_swuid; - int32_t fs_pad; - uint32_t fs_cgrotor; - uint32_t fs_ocsp[28]; - uint32_t fs_contigdirs; - uint32_t fs_csp; - uint32_t fs_maxcluster; - uint32_t fs_active; - int32_t fs_old_cpc; - int32_t fs_maxbsize; - int64_t fs_sparecon64[17]; - int64_t fs_sblockloc; - struct ufs2_csum_total { - uint64_t cs_ndir; - uint64_t cs_nbfree; - uint64_t cs_nifree; - uint64_t cs_nffree; - uint64_t cs_numclusters; - uint64_t cs_spare[3]; - } PACKED fs_cstotal; - struct ufs_timeval { - int32_t tv_sec; - int32_t tv_usec; - } PACKED fs_time; - int64_t fs_size; - int64_t fs_dsize; - uint64_t fs_csaddr; - int64_t fs_pendingblocks; - int32_t fs_pendinginodes; - } PACKED fs_u2; - } fs_u11; - union { - struct { - int32_t fs_sparecon[53]; - int32_t fs_reclaim; - int32_t fs_sparecon2[1]; - int32_t fs_state; - uint32_t fs_qbmask[2]; - uint32_t fs_qfmask[2]; - } PACKED fs_sun; - struct { - int32_t fs_sparecon[53]; - int32_t fs_reclaim; - int32_t fs_sparecon2[1]; - uint32_t fs_npsect; - uint32_t fs_qbmask[2]; - uint32_t fs_qfmask[2]; - } PACKED fs_sunx86; - struct { - int32_t fs_sparecon[50]; - int32_t fs_contigsumsize; - int32_t fs_maxsymlinklen; - int32_t fs_inodefmt; - uint32_t fs_maxfilesize[2]; - uint32_t fs_qbmask[2]; - uint32_t fs_qfmask[2]; - int32_t fs_state; - } PACKED fs_44; - } fs_u2; - int32_t fs_postblformat; - int32_t fs_nrpos; - int32_t fs_postbloff; - int32_t fs_rotbloff; - uint32_t fs_magic; - uint8_t fs_space[1]; -} PACKED; - -#define UFS_MAGIC 0x00011954 -#define UFS2_MAGIC 0x19540119 -#define UFS_MAGIC_FEA 0x00195612 -#define UFS_MAGIC_LFN 0x00095014 - -int volume_id_probe_ufs(struct volume_id *id, uint64_t off, uint64_t size) -{ - uint32_t magic; - int i; - struct ufs_super_block *ufs; - int offsets[] = {0, 8, 64, 256, -1}; - - info("probing at offset 0x%" PRIx64 "\n", off); - - for (i = 0; offsets[i] >= 0; i++) { - ufs = (struct ufs_super_block *) volume_id_get_buffer(id, off + (offsets[i] * 0x400), 0x800); - if (ufs == NULL) - return -1; - - dbg("offset 0x%x\n", offsets[i] * 0x400); - magic = be32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(be)\n", magic); - goto found; - } - magic = le32_to_cpu(ufs->fs_magic); - if ((magic == UFS_MAGIC) || - (magic == UFS2_MAGIC) || - (magic == UFS_MAGIC_FEA) || - (magic == UFS_MAGIC_LFN)) { - dbg("magic 0x%08x(le)\n", magic); - goto found; - } - } - return -1; - -found: - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "ufs"; - switch (magic) { - case UFS_MAGIC: - strcpy(id->type_version, "1"); - break; - case UFS2_MAGIC: - strcpy(id->type_version, "2"); - volume_id_set_label_raw(id, ufs->fs_u11.fs_u2.fs_volname, 32); - volume_id_set_label_string(id, ufs->fs_u11.fs_u2.fs_volname, 32); - break; - default: - break; - } - - return 0; -} diff --git a/extras/volume_id/lib/util.c b/extras/volume_id/lib/util.c deleted file mode 100644 index ea5ff16e91..0000000000 --- a/extras/volume_id/lib/util.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005-2007 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -/* count of characters used to encode one unicode char */ -static int utf8_encoded_expected_len(const char *str) -{ - unsigned char c = (unsigned char)str[0]; - - if (c < 0x80) - return 1; - if ((c & 0xe0) == 0xc0) - return 2; - if ((c & 0xf0) == 0xe0) - return 3; - if ((c & 0xf8) == 0xf0) - return 4; - if ((c & 0xfc) == 0xf8) - return 5; - if ((c & 0xfe) == 0xfc) - return 6; - return 0; -} - -/* decode one unicode char */ -static int utf8_encoded_to_unichar(const char *str) -{ - int unichar; - int len; - int i; - - len = utf8_encoded_expected_len(str); - switch (len) { - case 1: - return (int)str[0]; - case 2: - unichar = str[0] & 0x1f; - break; - case 3: - unichar = (int)str[0] & 0x0f; - break; - case 4: - unichar = (int)str[0] & 0x07; - break; - case 5: - unichar = (int)str[0] & 0x03; - break; - case 6: - unichar = (int)str[0] & 0x01; - break; - default: - return -1; - } - - for (i = 1; i < len; i++) { - if (((int)str[i] & 0xc0) != 0x80) - return -1; - unichar <<= 6; - unichar |= (int)str[i] & 0x3f; - } - - return unichar; -} - -/* expected size used to encode one unicode char */ -static int utf8_unichar_to_encoded_len(int unichar) -{ - if (unichar < 0x80) - return 1; - if (unichar < 0x800) - return 2; - if (unichar < 0x10000) - return 3; - if (unichar < 0x200000) - return 4; - if (unichar < 0x4000000) - return 5; - return 6; -} - -/* check if unicode char has a valid numeric range */ -static int utf8_unichar_valid_range(int unichar) -{ - if (unichar > 0x10ffff) - return 0; - if ((unichar & 0xfffff800) == 0xd800) - return 0; - if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) - return 0; - if ((unichar & 0xffff) == 0xffff) - return 0; - return 1; -} - -/* validate one encoded unicode char and return its length */ -int volume_id_utf8_encoded_valid_unichar(const char *str) -{ - int len; - int unichar; - int i; - - len = utf8_encoded_expected_len(str); - if (len == 0) - return -1; - - /* ascii is valid */ - if (len == 1) - return 1; - - /* check if expected encoded chars are available */ - for (i = 0; i < len; i++) - if ((str[i] & 0x80) != 0x80) - return -1; - - unichar = utf8_encoded_to_unichar(str); - - /* check if encoded length matches encoded value */ - if (utf8_unichar_to_encoded_len(unichar) != len) - return -1; - - /* check if value has valid range */ - if (!utf8_unichar_valid_range(unichar)) - return -1; - - return len; -} - -size_t volume_id_set_unicode16(uint8_t *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count) -{ - size_t i, j; - uint16_t c; - - j = 0; - for (i = 0; i + 2 <= count; i += 2) { - if (endianess == LE) - c = (buf[i+1] << 8) | buf[i]; - else - c = (buf[i] << 8) | buf[i+1]; - if (c == 0) { - str[j] = '\0'; - break; - } else if (c < 0x80) { - if (j+1 >= len) - break; - str[j++] = (uint8_t) c; - } else if (c < 0x800) { - if (j+2 >= len) - break; - str[j++] = (uint8_t) (0xc0 | (c >> 6)); - str[j++] = (uint8_t) (0x80 | (c & 0x3f)); - } else { - if (j+3 >= len) - break; - str[j++] = (uint8_t) (0xe0 | (c >> 12)); - str[j++] = (uint8_t) (0x80 | ((c >> 6) & 0x3f)); - str[j++] = (uint8_t) (0x80 | (c & 0x3f)); - } - } - str[j] = '\0'; - return j; -} - -static char *usage_to_string(enum volume_id_usage usage_id) -{ - switch (usage_id) { - case VOLUME_ID_FILESYSTEM: - return "filesystem"; - case VOLUME_ID_OTHER: - return "other"; - case VOLUME_ID_RAID: - return "raid"; - case VOLUME_ID_CRYPTO: - return "crypto"; - case VOLUME_ID_UNUSED: - return "unused"; - } - return NULL; -} - -void volume_id_set_usage(struct volume_id *id, enum volume_id_usage usage_id) -{ - id->usage_id = usage_id; - id->usage = usage_to_string(usage_id); -} - -void volume_id_set_label_raw(struct volume_id *id, const uint8_t *buf, size_t count) -{ - if (count > sizeof(id->label_raw)) - count = sizeof(id->label_raw); - - memcpy(id->label_raw, buf, count); - id->label_raw_len = count; -} - -void volume_id_set_label_string(struct volume_id *id, const uint8_t *buf, size_t count) -{ - size_t i; - - if (count >= sizeof(id->label)) - count = sizeof(id->label)-1; - - memcpy(id->label, buf, count); - id->label[count] = '\0'; - - /* remove trailing whitespace */ - i = strnlen(id->label, count); - while (i--) { - if (!isspace(id->label[i])) - break; - } - id->label[i+1] = '\0'; -} - -void volume_id_set_label_unicode16(struct volume_id *id, const uint8_t *buf, enum endian endianess, size_t count) -{ - if (count >= sizeof(id->label)) - count = sizeof(id->label)-1; - - volume_id_set_unicode16((uint8_t *)id->label, sizeof(id->label), buf, endianess, count); -} - -static void set_uuid(const uint8_t *buf, size_t len, enum uuid_format format, - char *uuid, uint8_t *uuid_raw, size_t *uuid_raw_len) -{ - unsigned int i; - unsigned int count = 0; - - switch(format) { - case UUID_STRING: - count = len; - break; - case UUID_HEX_STRING: - count = len; - break; - case UUID_DOS: - count = 4; - break; - case UUID_64BIT_LE: - count = 8; - break; - case UUID_DCE: - count = 16; - break; - case UUID_MD: - count = 35; - break; - case UUID_LVM: - count = 32; - break; - } - memcpy(uuid_raw, buf, count); - *uuid_raw_len = count; - - /* if set, create string in the same format, the native platform uses */ - for (i = 0; i < count; i++) - if (buf[i] != 0) - goto set; - return; - -set: - switch(format) { - case UUID_DOS: - sprintf(uuid, "%02X%02X-%02X%02X", - buf[3], buf[2], buf[1], buf[0]); - break; - case UUID_64BIT_LE: - sprintf(uuid,"%02X%02X%02X%02X%02X%02X%02X%02X", - buf[7], buf[6], buf[5], buf[4], - buf[3], buf[2], buf[1], buf[0]); - break; - case UUID_DCE: - sprintf(uuid, - "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], - buf[6], buf[7], - buf[8], buf[9], - buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]); - break; - case UUID_HEX_STRING: - /* translate A..F to a..f */ - memcpy(uuid, buf, count); - for (i = 0; i < count; i++) - if (uuid[i] >= 'A' && uuid[i] <= 'F') - uuid[i] = (uuid[i] - 'A') + 'a'; - uuid[count] = '\0'; - break; - case UUID_STRING: - memcpy(uuid, buf, count); - uuid[count] = '\0'; - break; - case UUID_MD: - sprintf(uuid, - "%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x:%02x%02x%02x%02x", - buf[0], buf[1], buf[2], buf[3], - buf[4], buf[5], buf[6], buf[7], - buf[8], buf[9], buf[10], buf[11], - buf[12], buf[13], buf[14],buf[15]); - break; - case UUID_LVM: - sprintf(uuid, - "%c%c%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c-%c%c%c%c%c%c", - buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], - buf[6], buf[7], buf[8], buf[9], - buf[10], buf[11], buf[12], buf[13], - buf[14], buf[15], buf[16], buf[17], - buf[18], buf[19], buf[20], buf[21], - buf[22], buf[23], buf[24], buf[25], - buf[26], buf[27], buf[28], buf[29], buf[30], buf[31]); - break; - } -} - -void volume_id_set_uuid(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format) -{ - if (len > sizeof(id->uuid_raw)) - len = sizeof(id->uuid_raw); - - set_uuid(buf, len, format, id->uuid, id->uuid_raw, &id->uuid_raw_len); -} - -void volume_id_set_uuid_sub(struct volume_id *id, const uint8_t *buf, size_t len, enum uuid_format format) -{ - if (len > sizeof(id->uuid_sub_raw)) - len = sizeof(id->uuid_sub_raw); - - set_uuid(buf, len, format, id->uuid_sub, id->uuid_sub_raw, &id->uuid_sub_raw_len); -} - -uint8_t *volume_id_get_buffer(struct volume_id *id, uint64_t off, size_t len) -{ - ssize_t buf_len; - - info("get buffer off 0x%" PRIx64 "(%" PRIu64 "), len 0x%zx\n", off, off, len); - /* check if requested area fits in superblock buffer */ - if (off + len <= SB_BUFFER_SIZE) { - if (id->sbbuf == NULL) { - id->sbbuf = malloc(SB_BUFFER_SIZE); - if (id->sbbuf == NULL) { - dbg("error malloc\n"); - return NULL; - } - } - - /* check if we need to read */ - if ((off + len) > id->sbbuf_len) { - info("read sbbuf len:0x%" PRIx64 "\n", (off + len)); - if (lseek(id->fd, 0, SEEK_SET) < 0) { - dbg("lseek failed (%s)\n", strerror(errno)); - return NULL; - } - buf_len = read(id->fd, id->sbbuf, off + len); - if (buf_len < 0) { - dbg("read failed (%s)\n", strerror(errno)); - return NULL; - } - dbg("got 0x%zx (%zi) bytes\n", buf_len, buf_len); - id->sbbuf_len = buf_len; - if ((size_t)buf_len < off + len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes\n", len, buf_len); - return NULL; - } - } - - return &(id->sbbuf[off]); - } else { - if (len > SEEK_BUFFER_SIZE) { - dbg("seek buffer too small %d\n", SEEK_BUFFER_SIZE); - return NULL; - } - - /* get seek buffer */ - if (id->seekbuf == NULL) { - id->seekbuf = malloc(SEEK_BUFFER_SIZE); - if (id->seekbuf == NULL) { - dbg("error malloc\n"); - return NULL; - } - } - - /* check if we need to read */ - if ((off < id->seekbuf_off) || ((off + len) > (id->seekbuf_off + id->seekbuf_len))) { - info("read seekbuf off:0x%" PRIx64 " len:0x%zx\n", off, len); - if (lseek(id->fd, off, SEEK_SET) < 0) { - dbg("lseek failed (%s)\n", strerror(errno)); - return NULL; - } - buf_len = read(id->fd, id->seekbuf, len); - if (buf_len < 0) { - dbg("read failed (%s)\n", strerror(errno)); - return NULL; - } - dbg("got 0x%zx (%zi) bytes\n", buf_len, buf_len); - id->seekbuf_off = off; - id->seekbuf_len = buf_len; - if ((size_t)buf_len < len) { - dbg("requested 0x%zx bytes, got only 0x%zx bytes\n", len, buf_len); - return NULL; - } - } - - return &(id->seekbuf[off - id->seekbuf_off]); - } -} - -void volume_id_free_buffer(struct volume_id *id) -{ - if (id->sbbuf != NULL) { - free(id->sbbuf); - id->sbbuf = NULL; - id->sbbuf_len = 0; - } - if (id->seekbuf != NULL) { - free(id->seekbuf); - id->seekbuf = NULL; - id->seekbuf_len = 0; - } -} diff --git a/extras/volume_id/lib/via_raid.c b/extras/volume_id/lib/via_raid.c deleted file mode 100644 index 2d022a0060..0000000000 --- a/extras/volume_id/lib/via_raid.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2005 Kay Sievers - * - * Based on information taken from dmraid: - * Copyright (C) 2004-2006 Heinz Mauelshagen, Red Hat GmbH - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct via_meta { - uint16_t signature; - uint8_t version_number; - struct via_array { - uint16_t disk_bit_mask; - uint8_t disk_array_ex; - uint32_t capacity_low; - uint32_t capacity_high; - uint32_t serial_checksum; - } PACKED array; - uint32_t serial_checksum[8]; - uint8_t checksum; -} PACKED; - -#define VIA_SIGNATURE 0xAA55 - -/* 8 bit checksum on first 50 bytes of metadata. */ -static uint8_t meta_checksum(struct via_meta *via) -{ - uint8_t i = 50, sum = 0; - - while (i--) - sum += ((uint8_t*) via)[i]; - - return sum == via->checksum; -} - - -int volume_id_probe_via_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - const uint8_t *buf; - uint64_t meta_off; - struct via_meta *via; - - dbg("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - if (size < 0x10000) - return -1; - - meta_off = ((size / 0x200)-1) * 0x200; - - buf = volume_id_get_buffer(id, off + meta_off, 0x200); - if (buf == NULL) - return -1; - - via = (struct via_meta *) buf; - if (le16_to_cpu(via->signature) != VIA_SIGNATURE) - return -1; - - if (via->version_number > 2) - return -1; - - if (!meta_checksum(via)) - return -1; - - volume_id_set_usage(id, VOLUME_ID_RAID); - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", via->version_number); - id->type = "via_raid_member"; - - return 0; -} diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c deleted file mode 100644 index 48bfd88624..0000000000 --- a/extras/volume_id/lib/volume_id.c +++ /dev/null @@ -1,592 +0,0 @@ -/* - * volume_id - reads volume label and uuid - * - * Copyright (C) 2005-2007 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - -struct prober { - volume_id_probe_fn_t prober; - const char *name[4]; -}; - -static const struct prober prober_raid[] = { - { volume_id_probe_linux_raid, { "linux_raid", } }, - { volume_id_probe_ddf_raid, { "ddf_raid", } }, - { volume_id_probe_intel_software_raid, { "isw_raid", } }, - { volume_id_probe_lsi_mega_raid, { "lsi_mega_raid", } }, - { volume_id_probe_via_raid, { "via_raid", } }, - { volume_id_probe_silicon_medley_raid, { "silicon_medley_raid", } }, - { volume_id_probe_nvidia_raid, { "nvidia_raid", } }, - { volume_id_probe_promise_fasttrack_raid, { "promise_fasttrack_raid", } }, - { volume_id_probe_highpoint_45x_raid, { "highpoint_raid", } }, - { volume_id_probe_adaptec_raid, { "adaptec_raid", } }, - { volume_id_probe_jmicron_raid, { "jmicron_raid", } }, - { volume_id_probe_lvm1, { "lvm1", } }, - { volume_id_probe_lvm2, { "lvm2", } }, - { volume_id_probe_highpoint_37x_raid, { "highpoint_raid", } }, -}; - -static const struct prober prober_filesystem[] = { - { volume_id_probe_vfat, { "vfat", } }, - { volume_id_probe_linux_swap, { "swap", } }, - { volume_id_probe_luks, { "luks", } }, - { volume_id_probe_xfs, { "xfs", } }, - { volume_id_probe_ext, { "ext2", "ext3", "jbd", } }, - { volume_id_probe_reiserfs, { "reiserfs", "reiser4", } }, - { volume_id_probe_jfs, { "jfs", } }, - { volume_id_probe_udf, { "udf", } }, - { volume_id_probe_iso9660, { "iso9660", } }, - { volume_id_probe_hfs_hfsplus, { "hfs", "hfsplus", } }, - { volume_id_probe_ufs, { "ufs", } }, - { volume_id_probe_ntfs, { "ntfs", } }, - { volume_id_probe_cramfs, { "cramfs", } }, - { volume_id_probe_romfs, { "romfs", } }, - { volume_id_probe_hpfs, { "hpfs", } }, - { volume_id_probe_sysv, { "sysv", "xenix", } }, - { volume_id_probe_minix, { "minix", } }, - { volume_id_probe_gfs, { "gfs", } }, - { volume_id_probe_gfs2, { "gfs2", } }, - { volume_id_probe_ocfs1, { "ocfs1", } }, - { volume_id_probe_ocfs2, { "ocfs2", } }, - { volume_id_probe_vxfs, { "vxfs", } }, - { volume_id_probe_squashfs, { "squashfs", } }, - { volume_id_probe_netware, { "netware", } }, - { volume_id_probe_oracleasm, { "oracleasm", } }, - { volume_id_probe_btrfs, { "btrfs", } }, -}; - -/* the user can overwrite this log function */ -static void default_log(int priority, const char *file, int line, const char *format, ...) -{ - return; -} - -volume_id_log_fn_t volume_id_log_fn = default_log; - -/** - * volume_id_get_prober_by_type: - * @type: Type string. - * - * Lookup the probing function for a specific type. - * - * Returns: The probing function for the given type, #NULL otherwise. - **/ -const volume_id_probe_fn_t *volume_id_get_prober_by_type(const char *type) -{ - unsigned int p, n; - - if (type == NULL) - return NULL; - - for (p = 0; p < ARRAY_SIZE(prober_raid); p++) - for (n = 0; prober_raid[p].name[n] != NULL; n++) - if (strcmp(type, prober_raid[p].name[n]) == 0) - return &prober_raid[p].prober; - for (p = 0; p < ARRAY_SIZE(prober_filesystem); p++) - for (n = 0; prober_filesystem[p].name[n] != NULL; n++) - if (strcmp(type, prober_filesystem[p].name[n]) == 0) - return &prober_filesystem[p].prober; - return NULL; -} - -/** - * volume_id_get_label: - * @id: Probing context. - * @label: Label string. Must not be freed by the caller. - * - * Get the label string after a successful probe. Unicode - * is translated to UTF-8. - * - * Returns: 1 if the value was set, 0 otherwise. - **/ -int volume_id_get_label(struct volume_id *id, const char **label) -{ - if (id == NULL) - return 0; - if (label == NULL) - return 0; - if (id->usage_id == VOLUME_ID_UNUSED) - return 0; - - *label = id->label; - return 1; -} - -/** - * volume_id_get_label_raw: - * @id: Probing context. - * @label: Label byte array. Must not be freed by the caller. - * @len: Length of raw label byte array. - * - * Get the raw label byte array after a successful probe. It may - * contain undecoded multibyte character streams. - * - * Returns: 1 if the value was set, 0 otherwise. - **/ -int volume_id_get_label_raw(struct volume_id *id, const uint8_t **label, size_t *len) -{ - if (id == NULL) - return 0; - if (label == NULL) - return 0; - if (len == NULL) - return 0; - if (id->usage_id == VOLUME_ID_UNUSED) - return 0; - - *label = id->label_raw; - *len = id->label_raw_len; - return 1; -} - -/** - * volume_id_get_uuid: - * @id: Probing context. - * @uuid: UUID string. Must not be freed by the caller. - * - * Get the raw UUID string after a successful probe. - * - * Returns: 1 if the value was set, 0 otherwise. - **/ -int volume_id_get_uuid(struct volume_id *id, const char **uuid) -{ - if (id == NULL) - return 0; - if (uuid == NULL) - return 0; - if (id->usage_id == VOLUME_ID_UNUSED) - return 0; - - *uuid = id->uuid; - return 1; -} - -/** - * volume_id_get_uuid_raw: - * @id: Probing context. - * @uuid: UUID byte array. Must not be freed by the caller. - * @len: Length of raw UUID byte array. - * - * Get the raw UUID byte array after a successful probe. It may - * contain unconverted endianes values. - * - * Returns: 1 if the value was set, 0 otherwise. - **/ -int volume_id_get_uuid_raw(struct volume_id *id, const uint8_t **uuid, size_t *len) -{ - if (id == NULL) - return 0; - if (uuid == NULL) - return 0; - if (len == NULL) - return 0; - if (id->usage_id == VOLUME_ID_UNUSED) - return 0; - - *uuid = id->uuid_raw; - *len = id->uuid_raw_len; - return 1; -} - -int volume_id_get_uuid_sub(struct volume_id *id, const char **uuid) -{ - if (id == NULL) - return 0; - if (uuid == NULL) - return 0; - if (id->usage_id == VOLUME_ID_UNUSED) - return 0; - - *uuid = id->uuid_sub; - return 1; -} - -/** - * volume_id_get_usage: - * @id: Probing context. - * @usage: Usage string. Must not be freed by the caller. - * - * Get the usage string after a successful probe. - * - * Returns: 1 if the value was set, 0 otherwise. - **/ -int volume_id_get_usage(struct volume_id *id, const char **usage) -{ - if (id == NULL) - return 0; - if (usage == NULL) - return 0; - if (id->usage_id == VOLUME_ID_UNUSED) - return 0; - - *usage = id->usage; - return 1; -} - -/** - * volume_id_get_type: - * @id: Probing context - * @type: Type string. Must not be freed by the caller. - * - * Get the type string after a successful probe. - * - * Returns: 1 if the value was set, 0 otherwise. - **/ -int volume_id_get_type(struct volume_id *id, const char **type) -{ - if (id == NULL) - return 0; - if (type == NULL) - return 0; - if (id->usage_id == VOLUME_ID_UNUSED) - return 0; - - *type = id->type; - return 1; -} - -/** - * volume_id_get_type_version: - * @id: Probing context. - * @type_version: Type version string. Must not be freed by the caller. - * - * Get the Type version string after a successful probe. - * - * Returns: 1 if the value was set, 0 otherwise. - **/ -int volume_id_get_type_version(struct volume_id *id, const char **type_version) -{ - if (id == NULL) - return 0; - if (type_version == NULL) - return 0; - if (id->usage_id == VOLUME_ID_UNUSED) - return 0; - - *type_version = id->type_version; - return 1; -} - -static int needs_encoding(const char c) -{ - if ((c >= '0' && c <= '9') || - (c >= 'A' && c <= 'Z') || - (c >= 'a' && c <= 'z') || - strchr(ALLOWED_CHARS, c)) - return 0; - return 1; -} - -/** - * volume_id_encode_string: - * @str: Input string to be encoded. - * @str_enc: Target string to store the encoded input. - * @len: Location to store the encoded string. The target string, - * which may be four times as long as the input string. - * - * Encode all potentially unsafe characters of a string to the - * corresponding hex value prefixed by '\x'. - * - * Returns: 1 if the entire string was copied, 0 otherwise. - **/ -int volume_id_encode_string(const char *str, char *str_enc, size_t len) -{ - size_t i, j; - - if (str == NULL || str_enc == NULL || len == 0) - return 0; - - str_enc[0] = '\0'; - for (i = 0, j = 0; str[i] != '\0'; i++) { - int seqlen; - - seqlen = volume_id_utf8_encoded_valid_unichar(&str[i]); - if (seqlen > 1) { - memcpy(&str_enc[j], &str[i], seqlen); - j += seqlen; - i += (seqlen-1); - } else if (str[i] == '\\' || needs_encoding(str[i])) { - sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); - j += 4; - } else { - str_enc[j] = str[i]; - j++; - } - if (j+3 >= len) - goto err; - } - str_enc[j] = '\0'; - return 1; -err: - return 0; -} - -/* run only once into a timeout for unreadable devices */ -static int device_is_readable(struct volume_id *id, uint64_t off) -{ - if (volume_id_get_buffer(id, off, 0x200) != NULL) - return 1; - return 0; -} - -/** - * volume_id_probe_raid: - * @id: Probing context. - * @off: Probing offset relative to the start of the device. - * @size: Total size of the device. - * - * Probe device for all known raid signatures. - * - * Returns: 0 on successful probe, otherwise negative value. - **/ -int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size) -{ - unsigned int i; - - if (id == NULL) - return -EINVAL; - - if (!device_is_readable(id, off)) - return -1; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - for (i = 0; i < ARRAY_SIZE(prober_raid); i++) { - if (prober_raid[i].prober(id, off, size) == 0) { - info("signature '%s' detected\n", id->type); - goto found; - } - } - return -1; - -found: - /* If recognized, we free the allocated buffers */ - volume_id_free_buffer(id); - return 0; -} - -static void volume_id_reset_result(struct volume_id *id) -{ - id->label_raw_len = 0; - id->label[0] = '\0'; - id->uuid_raw_len = 0; - id->uuid[0] = '\0'; - id->usage_id = VOLUME_ID_UNUSED; - id->usage = NULL; - id->type = NULL; - id->type_version[0] = '\0'; -} - -/** - * volume_id_probe_filesystem: - * @id: Probing context. - * @off: Probing offset relative to the start of the device. - * @size: Total size of the device. - * - * Probe device for all known filesystem signatures. - * - * Returns: 0 on successful probe, otherwise negative value. - **/ -int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size) -{ - unsigned int i; - - if (id == NULL) - return -EINVAL; - - if (!device_is_readable(id, off)) - return -1; - - info("probing at offset 0x%" PRIx64 ", size 0x%" PRIx64 "\n", off, size); - - /* - * We probe for all known filesystems to find conflicting signatures. If - * we find multiple matching signatures and one of the detected filesystem - * types claims that it can not co-exist with any other filesystem type, - * we do not return a probing result. - * - * We can not afford to mount a volume with the wrong filesystem code and - * possibly corrupt it. Linux sytems have the problem of dozens of possible - * filesystem types, and volumes with left-over signatures from former - * filesystem types. Invalid signatures need to be removed from the volume - * to make the filesystem detection successful. - * - * We do not want to read that many bytes from probed floppies, skip volumes - * smaller than a usual floppy disk. - */ - if (size > 1440 * 1024) { - int found = 0; - int force_unique_result = 0; - int first_match = -1; - - volume_id_reset_result(id); - for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) { - int match; - - match = (prober_filesystem[i].prober(id, off, size) == 0); - if (match) { - info("signature '%s' %i detected\n", id->type, i); - if (id->force_unique_result) - force_unique_result = 1; - if (found > 0 && force_unique_result) { - info("conflicting signatures found, skip results\n"); - return -1; - } - found++; - if (first_match < 0) - first_match = i; - } - } - if (found < 1) - return -1; - if (found == 1) - goto found; - if (found > 1) { - volume_id_reset_result(id); - info("re-read first match metadata %i\n", first_match); - if (prober_filesystem[first_match].prober(id, off, size) == 0) - goto found; - return -1; - } - } - - /* return the first match */ - volume_id_reset_result(id); - for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) { - if (prober_filesystem[i].prober(id, off, size) == 0) { - info("signature '%s' detected\n", id->type); - goto found; - } - } - return -1; -found: - /* If recognized, we free the allocated buffers */ - volume_id_free_buffer(id); - return 0; -} - -/** - * volume_id_probe_all: - * @id: Probing context. - * @off: Probing offset relative to the start of the device. - * @size: Total size of the device. - * - * Probe device for all known raid and filesystem signatures. - * - * Returns: 0 on successful probe, otherwise negative value. - **/ -int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size) -{ - if (id == NULL) - return -EINVAL; - - if (!device_is_readable(id, off)) - return -1; - - /* probe for raid first, because fs probes may be successful on raid members */ - if (volume_id_probe_raid(id, off, size) == 0) - return 0; - - if (volume_id_probe_filesystem(id, off, size) == 0) - return 0; - - return -1; -} - -/** - * volume_id_probe_raid: - * @all_probers_fn: prober function to called for all known probing routines. - * @id: Context passed to prober function. - * @off: Offset value passed to prober function. - * @size: Size value passed to prober function. - * @data: Arbitrary data passed to the prober function. - * - * Run a custom function for all known probing routines. - **/ -void volume_id_all_probers(all_probers_fn_t all_probers_fn, - struct volume_id *id, uint64_t off, uint64_t size, - void *data) -{ - unsigned int i; - - if (all_probers_fn == NULL) - return; - - for (i = 0; i < ARRAY_SIZE(prober_raid); i++) - if (all_probers_fn(prober_raid[i].prober, id, off, size, data) != 0) - goto out; - for (i = 0; i < ARRAY_SIZE(prober_filesystem); i++) - if (all_probers_fn(prober_filesystem[i].prober, id, off, size, data) != 0) - goto out; -out: - return; -} - -/** - * volume_id_open_fd: - * @id: Probing context. - * @fd: Open file descriptor of device to read from. - * - * Create the context for probing. - * - * Returns: Probing context, or #NULL on failure. - **/ -struct volume_id *volume_id_open_fd(int fd) -{ - struct volume_id *id; - - id = calloc(1, sizeof(struct volume_id)); - if (id == NULL) - return NULL; - - id->fd = fd; - - return id; -} - -/** - * volume_id_close: - * @id: Probing context. - * - * Release probing context and free all associated data. - */ -void volume_id_close(struct volume_id *id) -{ - if (id == NULL) - return; - - volume_id_free_buffer(id); - - free(id); -} diff --git a/extras/volume_id/lib/vxfs.c b/extras/volume_id/lib/vxfs.c deleted file mode 100644 index da569495d2..0000000000 --- a/extras/volume_id/lib/vxfs.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -#define VXFS_SUPER_MAGIC 0xa501FCF5 - -struct vxfs_super { - uint32_t vs_magic; - int32_t vs_version; -} PACKED; - -int volume_id_probe_vxfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct vxfs_super *vxs; - - info("probing at offset 0x%" PRIx64 "\n", off); - - vxs = (struct vxfs_super *) volume_id_get_buffer(id, off + 0x200, 0x200); - if (vxs == NULL) - return -1; - - if (vxs->vs_magic == cpu_to_le32(VXFS_SUPER_MAGIC)) { - snprintf(id->type_version, sizeof(id->type_version)-1, "%u", (unsigned int) vxs->vs_version); - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "vxfs"; - return 0; - } - - return -1; -} diff --git a/extras/volume_id/lib/xfs.c b/extras/volume_id/lib/xfs.c deleted file mode 100644 index 35ba68ed3e..0000000000 --- a/extras/volume_id/lib/xfs.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * volume_id - reads filesystem label and uuid - * - * Copyright (C) 2004 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include - -#include "libvolume_id.h" -#include "libvolume_id-private.h" - -struct xfs_super_block { - uint8_t magic[4]; - uint32_t blocksize; - uint64_t dblocks; - uint64_t rblocks; - uint32_t dummy1[2]; - uint8_t uuid[16]; - uint32_t dummy2[15]; - uint8_t fname[12]; - uint32_t dummy3[2]; - uint64_t icount; - uint64_t ifree; - uint64_t fdblocks; -} PACKED; - -int volume_id_probe_xfs(struct volume_id *id, uint64_t off, uint64_t size) -{ - struct xfs_super_block *xs; - - info("probing at offset 0x%" PRIx64 "\n", off); - - xs = (struct xfs_super_block *) volume_id_get_buffer(id, off, 0x200); - if (xs == NULL) - return -1; - - if (memcmp(xs->magic, "XFSB", 4) != 0) - return -1; - - volume_id_set_label_raw(id, xs->fname, 12); - volume_id_set_label_string(id, xs->fname, 12); - volume_id_set_uuid(id, xs->uuid, 0, UUID_DCE); - - volume_id_set_usage(id, VOLUME_ID_FILESYSTEM); - id->type = "xfs"; - - return 0; -} -- cgit v1.2.3-54-g00ecf From 634ffc0ce27ce99e073a6ef367a39d57c3d73c48 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 May 2009 02:35:37 +0200 Subject: release 142 --- ChangeLog | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 10 +++++----- TODO | 4 ---- 3 files changed, 69 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b607c3a3b..598ce58be0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,67 @@ +Summary of changes from v141 to v142 +============================================ + +Andre Przywara (1): + rules: create /dev/cpu//cpuid world readable + +Ian Campbell (1): + path_id: support identification of Xen virtual block devices + +John Wright (1): + edd_id: add cciss devices + +Kay Sievers (46): + version bump + libudev: path_encode - always return 0 if encoded string does not fit into size + libudev: monitor - clarify socket handling documentation + udevd: log error for too old kernels or CONFIG_SYSFS_DEPRECATED + rules: remove DVB shell script + update NEWS + cdrom_id: add Xen cdrom support + test-libudev: update monitor source + TODO: add packet filter + update NEWS + udevd: at startup create /dev/null, /dev/console, /dev/kmsg + cdrom_id: add and use ID_CDROM_MEDIA to decide if we run vol_id + libudev: monitor - add client socket filter for subsystem value + udevadm: monitor - print error if we can not bind to socket + update TODO + udevadm monitor - add --subsystem-match= + libudev: monitor - use simpler hash + libudev: monitor - switch to filter_add_match_subsystem_devtype() + libudev: monitor - do not filter messages with wrong magic + udevadm: monitor - add : support + libudev: monitor - add udev_monitor_filter_remove + libudev: queue - fix get_seqnum_is_finished() + cdrom_id: skip media tests if CDROM_DRIVE_STATUS != CDS_DISC_OK + libudev: queue - clarify comments + libudev: monitor - export filter_update() + update NEWS + drop "extern" keyword from non-static function + rule_generator: net - fix usb comment generation + rules: input - add links for USB/platform non-kbd/mouse devices + rules: input - fix comments + rules: add rfcomm* to group dialout + accept DEVNAME from the kernel as a hint for the node name + update TODO + build: use AC_MSG_RESULT + rules: add "event*" match + udevd: revert initial device node creation + rules: remove initramfs comment + handle devtmpfs nodes + oops, removed ppp entry from rules got committed + remove all PHYSDEVPATH handling and warning about + remove asmlinkage + rules: fix ieee1394 rules + add "static" back to the inline functions + update TODO + delete vol_id and require util-linux-ng's blkid + delete libvolume_id + +Lubomir Rintel (1): + rule-generator: net - whitelist NICs that violate MAC local scheme + + Summary of changes from v140 to v141 ============================================ diff --git a/NEWS b/NEWS index ba6668795a..cc4618e340 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,7 @@ udev 142 ======== Bugfixes. -The program vol_id and the library libvolume_id is removed from the +The program vol_id and the library libvolume_id are removed from the repository. Libvolume_id is merged with libblkid from the util-linux-ng package. Persistent disk links for label and uuid depend on the util-linux-ng version (2.15) of blkid now. Older versions of blkid @@ -13,11 +13,11 @@ to be delivered, and waking up the subscribing process, a filter can be installed, to drop messages inside a kernel socket filter. The filters match on the : properties of the device. This is part of the ongoing effort to replace HAL, and switch current -users over to directly use libudev, or for higher-level services use the -specialized D-Bus interface of a DeviceKit service. +users over to directly use libudev. Libudev is still marked as experimental, and its interface might -change if needed, but no major changes of the currently exported interface -are expected anymore, and a first stable release should happen soon. +eventually change if needed, but no major changes of the currently exported +interface are expected anymore, and a first stable release should happen +soon. A too old kernel (2.6.21) or a kernel with CONFIG_SYSFS_DEPRECATED is not supported since while and udevd will log an error message at diff --git a/TODO b/TODO index 58875afc2b..541faea556 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,7 @@ - udev 142: - o add udev_monitor_filter_add_match_property() o add tests for kernel provided DEVNAME logic - o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) o remove MMC rules, they got a modalias now (2.6.30) o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30) - o convert readdir loops to unlinkat(), fstatat() o implement path_id in C with libudev (?) o convert firmware.sh to C (?) -- cgit v1.2.3-54-g00ecf From 9d5bdeb3d3c7995a132b297bd27003b50da82d08 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 May 2009 03:13:08 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index cc4618e340..97109e31b4 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 143 +======== +Bugfixes. + udev 142 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 119bbb7859..a6b53dbe54 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([udev], - [142], + [143], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) -- cgit v1.2.3-54-g00ecf From 6205f1186e4980544ea425d31770358d1b2579e4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 May 2009 17:55:08 +0200 Subject: rules: v4l do not mix vbi and video nodes --- rules/rules.d/60-persistent-v4l.rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-v4l.rules b/rules/rules.d/60-persistent-v4l.rules index 8415cd059b..81f9bbd94d 100644 --- a/rules/rules.d/60-persistent-v4l.rules +++ b/rules/rules.d/60-persistent-v4l.rules @@ -11,7 +11,8 @@ TEST!="index", GOTO="persistent_v4l_end" ATTR{index}!="?*", GOTO="persistent_v4l_end" IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" +ENV{ID_PATH}=="?*", KERNEL=="video*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" +ENV{ID_PATH}=="?*", KERNEL=="vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-vbi-index$attr{index}" ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" LABEL="persistent_v4l_end" -- cgit v1.2.3-54-g00ecf From 0c37798916bc87d72f5f1399d9e050307901db84 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 May 2009 18:01:32 +0200 Subject: fix possible endless loop for GOTO to non-existent LABEL http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=526365 --- test/udev-test.pl | 11 +++++++++++ udev/udev-rules.c | 3 +++ 2 files changed, 14 insertions(+) diff --git a/test/udev-test.pl b/test/udev-test.pl index 4f61ce3e5d..788bbeac25 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1554,6 +1554,17 @@ KERNEL=="sda1", GOTO="BAD" KERNEL=="sda1", NAME="", LABEL="NO" KERNEL=="sda1", NAME="right", LABEL="TEST" KERNEL=="sda1", LABEL="BAD" +EOF + }, + { + desc => "GOTO label does not exist", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + rules => <buf[rules->tokens[j].rule.label_off]) != 0) continue; rules->tokens[i].key.rule_goto = j; + break; } if (rules->tokens[i].key.rule_goto == 0) err(rules->udev, "GOTO '%s' has no matching label in: '%s'\n", label, filename); @@ -2504,6 +2505,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; } case TK_A_GOTO: + if (cur->key.rule_goto == 0) + break; cur = &rules->tokens[cur->key.rule_goto]; continue; case TK_A_LAST_RULE: -- cgit v1.2.3-54-g00ecf From 1e5e05730a2554b0bd9fe7ca25b4f7d31907ae97 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 May 2009 00:32:25 +0200 Subject: Revert "rules: v4l do not mix vbi and video nodes" This reverts commit 6205f1186e4980544ea425d31770358d1b2579e4. --- rules/rules.d/60-persistent-v4l.rules | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-v4l.rules b/rules/rules.d/60-persistent-v4l.rules index 81f9bbd94d..8415cd059b 100644 --- a/rules/rules.d/60-persistent-v4l.rules +++ b/rules/rules.d/60-persistent-v4l.rules @@ -11,8 +11,7 @@ TEST!="index", GOTO="persistent_v4l_end" ATTR{index}!="?*", GOTO="persistent_v4l_end" IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="video*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" -ENV{ID_PATH}=="?*", KERNEL=="vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-vbi-index$attr{index}" +ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" LABEL="persistent_v4l_end" -- cgit v1.2.3-54-g00ecf From b4fa1b67f86c9555cbb41c57774761730f6b8939 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 May 2009 12:57:19 +0200 Subject: rule-generator: cd - skip by-path links if we create by-id links --- extras/rule_generator/75-cd-aliases-generator.rules | 7 +++++-- extras/rule_generator/write_cd_rules | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extras/rule_generator/75-cd-aliases-generator.rules b/extras/rule_generator/75-cd-aliases-generator.rules index e357a6a8bd..e6da0101d6 100644 --- a/extras/rule_generator/75-cd-aliases-generator.rules +++ b/extras/rule_generator/75-cd-aliases-generator.rules @@ -1,6 +1,9 @@ # these rules generate rules for the /dev/{cdrom,dvd,...} symlinks -# the path of removable devices changes frequently -ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules by-id", SYMLINK+="%c" +# the "path" of usb/ieee1394 devices changes frequently, use "id" +ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", \ + PROGRAM="write_cd_rules by-id", SYMLINK+="%c", GOTO="persistent_cd_end" ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules", SYMLINK+="%c" + +LABEL="persistent_cd_end" diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules index 398cd2737b..0d16fe6eff 100644 --- a/extras/rule_generator/write_cd_rules +++ b/extras/rule_generator/write_cd_rules @@ -97,7 +97,7 @@ choose_rules_file link_num=$(find_next_available 'cdrom[0-9]*') -match="ENV{ID_CDROM}==\"?*\", $RULE" +match="SUBSYSTEM==\"block\", ENV{ID_CDROM}==\"?*\", $RULE" comment="$ID_MODEL ($ID_PATH)" @@ -108,6 +108,7 @@ comment="$ID_MODEL ($ID_PATH)" write_rule "$match" "dvd$link_num" [ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ] && \ write_rule "$match" "dvdrw$link_num" +echo >> $RULES_FILE unlock_rules_file -- cgit v1.2.3-54-g00ecf From 055e40edc647d8ccfc27c9cd3163ab5dbf63ed6c Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Thu, 14 May 2009 12:42:44 +0100 Subject: OWNER/GROUP: fix if logic The introduction of the --resolve-names=early/never code introduced a bug to the OWNER/GROUP lookup. Previously if the name had contained $, lookup would have been performed later; after the patch, the key ended up being ignored! --- udev/udev-rules.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index b8b7e52c83..39fe55aac1 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1431,7 +1431,7 @@ static int add_rule(struct udev_rules *rules, char *line, } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { uid = add_uid(rules, value); rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); - } else if (rules->resolve_names == 0) { + } else if (rules->resolve_names >= 0) { rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL); } rule_tmp.rule.rule.flags = 1; @@ -1448,7 +1448,7 @@ static int add_rule(struct udev_rules *rules, char *line, } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { gid = add_gid(rules, value); rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); - } else if (rules->resolve_names == 0) { + } else if (rules->resolve_names >= 0) { rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL); } rule_tmp.rule.rule.flags = 1; -- cgit v1.2.3-54-g00ecf From a0ee5a05bb3a9a838c35e07ff7a0bb7bbd2d0c9b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 19 May 2009 12:56:17 +0200 Subject: remove format char string truncation syntax --- test/udev-test.pl | 21 +-------------------- udev/udev-event.c | 27 --------------------------- udev/udev.xml | 3 --- 3 files changed, 1 insertion(+), 50 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 788bbeac25..b5abe620fb 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -281,15 +281,6 @@ EOF exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , rules => < "test substitution chars (with length limit)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "M8-m5-n5-b0:0-xAT" , - rules => < "program with escaped format char (callout returns format char!)", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "escape-5" , @@ -1019,16 +1010,6 @@ EOF exp_target => "ttyACM0", rules => < "symlink %Ns{filename} substitution", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "166", - exp_target => "ttyACM0", - rules => < 0) { - *str = tail; - dbg(udev, "format length=%i\n", num); - return num; - } else { - err(udev, "format parsing error '%s'\n", *str); - } - } - return -1; -} - void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize) { struct udev_device *dev = event->dev; char temp[UTIL_PATH_SIZE]; char temp2[UTIL_PATH_SIZE]; char *head, *tail, *cpos, *attr, *rest; - int len; int i; int count; enum subst_type { @@ -153,7 +133,6 @@ void udev_event_apply_format(struct udev_event *event, char *string, size_t maxs head = string; while (1) { - len = -1; while (head[0] != '\0') { if (head[0] == '$') { /* substitute named variable */ @@ -188,7 +167,6 @@ void udev_event_apply_format(struct udev_event *event, char *string, size_t maxs } head[0] = '\0'; tail = head+1; - len = get_format_len(event->udev, &tail); for (subst = map; subst->name; subst++) { if (tail[0] == subst->fmt) { type = subst->type; @@ -447,11 +425,6 @@ found: err(event->udev, "unknown substitution type=%i\n", type); break; } - /* possibly truncate to format-char specified length */ - if (len >= 0 && len < (int)strlen(head)) { - head[len] = '\0'; - dbg(event->udev, "truncate to %i chars, subtitution string becomes '%s'\n", len, head); - } util_strlcat(string, temp, maxsize); } } diff --git a/udev/udev.xml b/udev/udev.xml index 084c13bd98..cd4884d3b5 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -620,9 +620,6 @@
                    - The count of characters to be substituted may be limited by specifying - the format length value. For example, '%3s{file}' will only - insert the first three characters of the sysfs attribute -- cgit v1.2.3-54-g00ecf From f58a9099bb2b18f3f683615324a4382b95446305 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Wed, 20 May 2009 16:12:22 +0200 Subject: udevadm: settle - fix timeout The timeout wasn't working when settle was run as root: # udevadm control --stop-exec-queue # udevadm trigger # udevadm settle --timeout=1 ... (hangs) Signed-off-by: Alan Jenkins --- udev/udevadm-settle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 3b26f10d50..52d9c0b244 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -167,6 +167,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) sigprocmask(SIG_BLOCK, &mask, &oldmask); if (udev_ctrl_send_settle(uctrl) > 0) sigsuspend(&oldmask); + sigprocmask(SIG_SETMASK, &oldmask, NULL); udev_ctrl_unref(uctrl); } } -- cgit v1.2.3-54-g00ecf From 065db052211d3bf08d9b0f698a79a8798faf11d2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 May 2009 17:57:52 +0200 Subject: use more efficient string copying --- extras/edd_id/edd_id.c | 2 +- extras/fstab_import/fstab_import.c | 4 +- extras/scsi_id/scsi_id.c | 8 +- extras/usb_id/usb_id.c | 28 +-- test/udev-test.pl | 9 - udev/lib/libudev-ctrl.c | 2 +- udev/lib/libudev-device-db-write.c | 41 ++- udev/lib/libudev-device.c | 148 ++++------- udev/lib/libudev-enumerate.c | 40 ++- udev/lib/libudev-monitor.c | 25 +- udev/lib/libudev-private.h | 10 +- udev/lib/libudev-queue.c | 57 ++--- udev/lib/libudev-util.c | 142 ++++++----- udev/test-udev.c | 3 +- udev/udev-event.c | 504 +++++++++++++++++++------------------ udev/udev-node.c | 61 +++-- udev/udev-rules.c | 130 ++++------ udev/udev-util.c | 27 +- udev/udev-watch.c | 47 ++-- udev/udev.h | 2 +- udev/udevadm-info.c | 27 +- udev/udevadm-monitor.c | 2 +- udev/udevadm-test.c | 13 +- udev/udevadm-trigger.c | 7 +- udev/udevd.c | 48 ++-- 25 files changed, 635 insertions(+), 752 deletions(-) diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 4154387cb6..9e9667fc62 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) if (disk_id == sysfs_id) { if (match[0] == '\0') { /* store id */ - util_strlcpy(match, dent->d_name, sizeof(match)); + util_strscpy(match, sizeof(match), dent->d_name); } else { /* error, same signature for another device */ info(udev, "'%s' does not have a unique signature\n", node); diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c index e793604faa..e46ba7ec44 100644 --- a/extras/fstab_import/fstab_import.c +++ b/extras/fstab_import/fstab_import.c @@ -144,7 +144,7 @@ int main(int argc, char *argv[]) if (label[0] == '"' || label[0] == '\'') { char *pos; - util_strlcpy(str, &label[1], sizeof(str)); + util_strscpy(str, sizeof(str), &label[1]); pos = strrchr(str, label[0]); if (pos == NULL) continue; @@ -168,7 +168,7 @@ int main(int argc, char *argv[]) if (uuid[0] == '"' || uuid[0] == '\'') { char *pos; - util_strlcpy(str, &uuid[1], sizeof(str)); + util_strscpy(str, sizeof(str), &uuid[1]); pos = strrchr(str, uuid[0]); if (pos == NULL) continue; diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index d630cf902b..213a267afa 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -105,7 +105,7 @@ static void set_type(const char *from, char *to, size_t len) break; } } - util_strlcpy(to, type, len); + util_strscpy(to, len, type); } /* @@ -354,7 +354,7 @@ static int set_options(struct udev *udev, case 'd': dev_specified = 1; - util_strlcpy(maj_min_dev, optarg, MAX_PATH_LEN); + util_strscpy(maj_min_dev, MAX_PATH_LEN, optarg); break; case 'e': @@ -362,7 +362,7 @@ static int set_options(struct udev *udev, break; case 'f': - util_strlcpy(config_file, optarg, MAX_PATH_LEN); + util_strscpy(config_file, MAX_PATH_LEN, optarg); break; case 'g': @@ -428,7 +428,7 @@ static int set_options(struct udev *udev, } if (optind < argc && !dev_specified) { dev_specified = 1; - util_strlcpy(maj_min_dev, argv[optind], MAX_PATH_LEN); + util_strscpy(maj_min_dev, MAX_PATH_LEN, argv[optind]); } return 0; } diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 36477669c5..4679f94fde 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -134,7 +134,7 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len break; } } - util_strlcpy(to, type, len); + util_strscpy(to, len, type); return type_num; } @@ -166,7 +166,7 @@ static void set_scsi_type(char *to, const char *from, size_t len) break; } } - util_strlcpy(to, type, len); + util_strscpy(to, len, type); } #define USB_DT_DEVICE 0x01 @@ -509,8 +509,7 @@ int main(int argc, char **argv) goto exit; } - util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); - util_strlcat(syspath, devpath, sizeof(syspath)); + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); dev = udev_device_new_from_syspath(udev, syspath); if (dev == NULL) { err(udev, "unable to access '%s'\n", devpath); @@ -520,18 +519,15 @@ int main(int argc, char **argv) retval = usb_id(dev); if (retval == 0) { char serial[256]; - - util_strlcpy(serial, vendor_str, sizeof(serial)); - util_strlcat(serial, "_", sizeof(serial)); - util_strlcat(serial, model_str, sizeof(serial)); - if (serial_str[0] != '\0') { - util_strlcat(serial, "_", sizeof(serial)); - util_strlcat(serial, serial_str, sizeof(serial)); - } - if (instance_str[0] != '\0') { - util_strlcat(serial, "-", sizeof(serial)); - util_strlcat(serial, instance_str, sizeof(serial)); - } + size_t l; + char *s; + + s = serial; + l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); + if (serial_str[0] != '\0') + l = util_strpcpyl(&s, l, "_", serial_str, NULL); + if (instance_str[0] != '\0') + util_strpcpyl(&s, l, "-", instance_str, NULL); if (export) { printf("ID_VENDOR=%s\n", vendor_str); diff --git a/test/udev-test.pl b/test/udev-test.pl index b5abe620fb..30e8d2ac10 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -342,15 +342,6 @@ EOF exp_name => "test-0:0:0:0" , rules => < "program with escaped format char (callout returns format char!)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "escape-5" , - rules => <= sizeof(target)) { + l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); + if (l == 0) { info(udev, "size of links too large, create file\n"); goto file; } @@ -121,25 +118,21 @@ out: int udev_device_delete_db(struct udev_device *udev_device) { + struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; - devpath_to_db_path(udev_device_get_udev(udev_device), - udev_device_get_devpath(udev_device), - filename, sizeof(filename)); + devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); unlink(filename); return 0; } int udev_device_rename_db(struct udev_device *udev_device, const char *devpath_old) { + struct udev *udev = udev_device_get_udev(udev_device); char filename_old[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE]; - devpath_to_db_path(udev_device_get_udev(udev_device), - devpath_old, - filename_old, sizeof(filename_old)); - devpath_to_db_path(udev_device_get_udev(udev_device), - udev_device_get_devpath(udev_device), - filename, sizeof(filename)); + devpath_to_db_path(udev, devpath_old, filename_old, sizeof(filename_old)); + devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); return rename(filename_old, filename); } diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index ddc4b34115..37b3a3b7a2 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2009 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -63,13 +63,12 @@ struct udev_device { static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) { - size_t start; + char *s; + size_t l; - /* translate to location of db file */ - util_strlcpy(filename, udev_get_dev_path(udev), len); - start = util_strlcat(filename, "/.udev/db/", len); - util_strlcat(filename, devpath, len); - return util_path_encode(&filename[start], len - start); + s = filename; + l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); + return util_path_encode(devpath, filename, l); } int udev_device_read_db(struct udev_device *udev_device) @@ -104,9 +103,7 @@ int udev_device_read_db(struct udev_device *udev_device) next[0] = '\0'; next = &next[1]; } - util_strlcpy(devnode, udev_get_dev_path(udev_device->udev), sizeof(devnode)); - util_strlcat(devnode, "/", sizeof(devnode)); - util_strlcat(devnode, target, sizeof(devnode)); + util_strscpyl(devnode, sizeof(devnode), udev_get_dev_path(udev_device->udev), "/", target, NULL); udev_device_set_devnode(udev_device, devnode); while (next != NULL) { char devlink[UTIL_PATH_SIZE]; @@ -118,9 +115,7 @@ int udev_device_read_db(struct udev_device *udev_device) next[0] = '\0'; next = &next[1]; } - util_strlcpy(devlink, udev_get_dev_path(udev_device->udev), sizeof(devlink)); - util_strlcat(devlink, "/", sizeof(devlink)); - util_strlcat(devlink, lnk, sizeof(devlink)); + util_strscpyl(devlink, sizeof(devlink), udev_get_dev_path(udev_device->udev), "/", lnk, NULL); udev_device_add_devlink(udev_device, devlink); } info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); @@ -143,15 +138,11 @@ int udev_device_read_db(struct udev_device *udev_device) val = &line[2]; switch(line[0]) { case 'N': - util_strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, val, sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); udev_device_set_devnode(udev_device, filename); break; case 'S': - util_strlcpy(filename, udev_get_dev_path(udev_device->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, val, sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); udev_device_add_devlink(udev_device, filename); break; case 'L': @@ -188,8 +179,7 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) int maj = 0; int min = 0; - util_strlcpy(filename, udev_device->syspath, sizeof(filename)); - util_strlcat(filename, "/uevent", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL); f = fopen(filename, "r"); if (f == NULL) return -1; @@ -303,7 +293,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * } /* resolve possible symlink to real path */ - util_strlcpy(path, syspath, sizeof(path)); + util_strscpy(path, sizeof(path), syspath); util_resolve_sys_link(udev, path, sizeof(path)); /* try to resolve the silly block layout if needed */ @@ -311,16 +301,14 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * char block[UTIL_PATH_SIZE]; char part[UTIL_PATH_SIZE]; - util_strlcpy(block, path, sizeof(block)); + util_strscpy(block, sizeof(block), path); pos = strrchr(block, '/'); if (pos == NULL) return NULL; - util_strlcpy(part, pos, sizeof(part)); + util_strscpy(part, sizeof(part), pos); pos[0] = '\0'; - if (util_resolve_sys_link(udev, block, sizeof(block)) == 0) { - util_strlcpy(path, block, sizeof(path)); - util_strlcat(path, part, sizeof(path)); - } + if (util_resolve_sys_link(udev, block, sizeof(block)) == 0) + util_strscpyl(path, sizeof(path), block, part, NULL); } /* path exists in sys */ @@ -330,8 +318,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * char file[UTIL_PATH_SIZE]; /* all "devices" require a "uevent" file */ - util_strlcpy(file, path, sizeof(file)); - util_strlcat(file, "/uevent", sizeof(file)); + util_strscpyl(file, sizeof(file), path, "/uevent", NULL); if (stat(file, &statbuf) != 0) { dbg(udev, "not a device: %s\n", syspath); return NULL; @@ -407,35 +394,31 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) { - size_t sys_path_len; char path_full[UTIL_PATH_SIZE]; char *path; + size_t l; struct stat statbuf; - sys_path_len = util_strlcpy(path_full, udev_get_sys_path(udev), sizeof(path_full)); - path = &path_full[sys_path_len]; + path = path_full; + l = util_strpcpyl(&path, sizeof(path_full), udev_get_sys_path(udev), NULL); if (strcmp(subsystem, "subsystem") == 0) { - util_strlcpy(path, "/subsystem/", sizeof(path_full) - sys_path_len); - util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + util_strscpyl(path, l, "/subsystem/", sysname, NULL); if (stat(path_full, &statbuf) == 0) goto found; - util_strlcpy(path, "/bus/", sizeof(path_full) - sys_path_len); - util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + util_strscpyl(path, l, "/bus/", sysname, NULL); if (stat(path_full, &statbuf) == 0) goto found; - util_strlcpy(path, "/class/", sizeof(path_full) - sys_path_len); - util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + util_strscpyl(path, l, "/class/", sysname, NULL); if (stat(path_full, &statbuf) == 0) goto found; goto out; } if (strcmp(subsystem, "module") == 0) { - util_strlcpy(path, "/module/", sizeof(path_full) - sys_path_len); - util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + util_strscpyl(path, l, "/module/", sysname, NULL); if (stat(path_full, &statbuf) == 0) goto found; goto out; @@ -445,46 +428,32 @@ struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, co char subsys[UTIL_NAME_SIZE]; char *driver; - util_strlcpy(subsys, sysname, sizeof(subsys)); + util_strscpy(subsys, sizeof(subsys), sysname); driver = strchr(subsys, ':'); if (driver != NULL) { driver[0] = '\0'; driver = &driver[1]; - util_strlcpy(path, "/subsystem/", sizeof(path_full) - sys_path_len); - util_strlcat(path, subsys, sizeof(path_full) - sys_path_len); - util_strlcat(path, "/drivers/", sizeof(path_full) - sys_path_len); - util_strlcat(path, driver, sizeof(path_full) - sys_path_len); + + util_strscpyl(path, l, "/subsystem/", subsys, "/drivers/", driver, NULL); if (stat(path_full, &statbuf) == 0) goto found; - util_strlcpy(path, "/bus/", sizeof(path_full) - sys_path_len); - util_strlcat(path, subsys, sizeof(path_full) - sys_path_len); - util_strlcat(path, "/drivers/", sizeof(path_full) - sys_path_len); - util_strlcat(path, driver, sizeof(path_full) - sys_path_len); + util_strscpyl(path, l, "/bus/", subsys, "/drivers/", driver, NULL); if (stat(path_full, &statbuf) == 0) goto found; } goto out; } - util_strlcpy(path, "/subsystem/", sizeof(path_full) - sys_path_len); - util_strlcat(path, subsystem, sizeof(path_full) - sys_path_len); - util_strlcat(path, "/devices/", sizeof(path_full) - sys_path_len); - util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + util_strscpyl(path, l, "/subsystem/", subsystem, "/devices/", sysname, NULL); if (stat(path_full, &statbuf) == 0) goto found; - util_strlcpy(path, "/bus/", sizeof(path_full) - sys_path_len); - util_strlcat(path, subsystem, sizeof(path_full) - sys_path_len); - util_strlcat(path, "/devices/", sizeof(path_full) - sys_path_len); - util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + util_strscpyl(path, l, "/bus/", subsystem, "/devices/", sysname, NULL); if (stat(path_full, &statbuf) == 0) goto found; - util_strlcpy(path, "/class/", sizeof(path_full) - sys_path_len); - util_strlcat(path, subsystem, sizeof(path_full) - sys_path_len); - util_strlcat(path, "/", sizeof(path_full) - sys_path_len); - util_strlcat(path, sysname, sizeof(path_full) - sys_path_len); + util_strscpyl(path, l, "/class/", subsystem, "/", sysname, NULL); if (stat(path_full, &statbuf) == 0) goto found; out: @@ -502,8 +471,7 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic /* follow "device" link in deprecated sys layout */ if (strncmp(udev_device->devpath, "/class/", 7) == 0 || strncmp(udev_device->devpath, "/block/", 7) == 0) { - util_strlcpy(path, udev_device->syspath, sizeof(path)); - util_strlcat(path, "/device", sizeof(path)); + util_strscpyl(path, sizeof(path), udev_device->syspath, "/device", NULL); if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) { udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); if (udev_device_parent != NULL) @@ -511,7 +479,7 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic } } - util_strlcpy(path, udev_device->syspath, sizeof(path)); + util_strscpy(path, sizeof(path), udev_device->syspath); subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; while (1) { char *pos; @@ -809,11 +777,13 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device udev_device->devlinks_uptodate = 1; list_entry = udev_device_get_devlinks_list_entry(udev_device); if (list_entry != NULL) { - util_strlcpy(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { - util_strlcat(symlinks, " ", sizeof(symlinks)); - util_strlcat(symlinks, udev_list_entry_get_name(list_entry), sizeof(symlinks)); - } + char *s; + size_t l; + + s = symlinks; + l = util_strpcpyl(&s, sizeof(symlinks), udev_list_entry_get_name(list_entry), NULL); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) + l = util_strpcpyl(&s, l, " ", udev_list_entry_get_name(list_entry), NULL); udev_device_add_property(udev_device, "DEVLINKS", symlinks); } } @@ -881,10 +851,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const } } - util_strlcpy(path, udev_device_get_syspath(udev_device), sizeof(path)); - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, sysattr, sizeof(path)); - + util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); if (lstat(path, &statbuf) != 0) { dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, NULL, 0, 0); @@ -1047,7 +1014,7 @@ struct udev_list_entry *udev_device_add_property_from_string(struct udev_device char name[UTIL_PATH_SIZE]; char *val; - util_strlcpy(name, property, sizeof(name)); + util_strscpy(name, sizeof(name), property); val = strchr(name, '='); if (val == NULL) return NULL; @@ -1077,8 +1044,8 @@ const char *udev_device_get_property_value(struct udev_device *udev_device, cons static int update_envp_monitor_buf(struct udev_device *udev_device) { struct udev_list_entry *list_entry; - size_t bufpos; - size_t len; + char *s; + size_t l; unsigned int i; /* monitor buffer of property strings */ @@ -1095,33 +1062,26 @@ static int update_envp_monitor_buf(struct udev_device *udev_device) return -ENOMEM; i = 0; - bufpos = 0; + s = udev_device->monitor_buf; + l = MONITOR_BUF_SIZE; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { /* add string to envp array */ - udev_device->envp[i++] = &udev_device->monitor_buf[bufpos]; + udev_device->envp[i++] = s; if (i+1 >= ENVP_SIZE) return -EINVAL; /* add property string to monitor buffer */ - len = util_strlcpy(&udev_device->monitor_buf[bufpos], - udev_list_entry_get_name(list_entry), MONITOR_BUF_SIZE-bufpos); - if (len >= MONITOR_BUF_SIZE-bufpos) - return -EINVAL; - bufpos += len; - len = util_strlcpy(&udev_device->monitor_buf[bufpos], "=", MONITOR_BUF_SIZE-bufpos); - if (len >= MONITOR_BUF_SIZE-bufpos) - return -EINVAL; - bufpos += len; - len = util_strlcpy(&udev_device->monitor_buf[bufpos], udev_list_entry_get_value(list_entry), - MONITOR_BUF_SIZE-bufpos); - if (len+1 >= MONITOR_BUF_SIZE-bufpos) + l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), "=", + udev_list_entry_get_value(list_entry), NULL); + if (l == 0) return -EINVAL; - bufpos += len+1; + s++; } udev_device->envp[i] = NULL; - udev_device->monitor_buf_len = bufpos; + udev_device->monitor_buf_len = s - udev_device->monitor_buf; udev_device->envp_uptodate = 1; - dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", i, bufpos); + dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", + i, udev_device->monitor_buf_len); return 0; } diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index a92bf0b620..c236a1c1b6 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -261,20 +261,17 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); char path[UTIL_PATH_SIZE]; + size_t l; + char *s; DIR *dir; struct dirent *dent; - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, basedir, sizeof(path)); - if (subdir1 != NULL) { - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, subdir1, sizeof(path)); - } - if (subdir2 != NULL) { - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, subdir2, sizeof(path)); - } + s = path; + l = util_strpcpyl(&s, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); + if (subdir1 != NULL) + l = util_strpcpyl(&s, l, "/", subdir1, NULL); + if (subdir2 != NULL) + l = util_strpcpyl(&s, l, "/", subdir2, NULL); dir = opendir(path); if (dir == NULL) return -1; @@ -285,17 +282,15 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, if (dent->d_name[0] == '.') continue; - util_strlcpy(syspath, path, sizeof(syspath)); - util_strlcat(syspath, "/", sizeof(syspath)); - util_strlcat(syspath, dent->d_name, sizeof(syspath)); + util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); if (lstat(syspath, &statbuf) != 0) continue; if (S_ISREG(statbuf.st_mode)) continue; if (S_ISLNK(statbuf.st_mode)) util_resolve_sys_link(udev, syspath, sizeof(syspath)); - util_strlcpy(filename, syspath, sizeof(filename)); - util_strlcat(filename, "/uevent", sizeof(filename)); + + util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); if (stat(filename, &statbuf) != 0) continue; if (!match_sysattr(udev_enumerate, syspath)) @@ -334,9 +329,7 @@ static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, DIR *dir; struct dirent *dent; - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, basedir, sizeof(path)); + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); dir = opendir(path); if (dir == NULL) return -1; @@ -428,8 +421,7 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) if (udev_enumerate == NULL) return -EINVAL; - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - util_strlcat(base, "/subsystem", sizeof(base)); + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); if (stat(base, &statbuf) == 0) { /* we have /subsystem/, forget all the old stuff */ dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); @@ -440,8 +432,7 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) dbg(udev, "searching '/class/*' dir\n"); scan_dir(udev_enumerate, "class", NULL, NULL); /* if block isn't a class, scan /block/ */ - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - util_strlcat(base, "/class/block", sizeof(base)); + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/class/block", NULL); if (stat(base, &statbuf) != 0) { if (match_subsystem(udev_enumerate, "block")) { dbg(udev, "searching '/block/*' dir\n"); @@ -471,8 +462,7 @@ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) if (udev_enumerate == NULL) return -EINVAL; - util_strlcpy(base, udev_get_sys_path(udev), sizeof(base)); - util_strlcat(base, "/subsystem", sizeof(base)); + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); if (stat(base, &statbuf) == 0) subsysdir = "subsystem"; else diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 2540e85c34..395a4d27e1 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2009 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -113,16 +113,16 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char udev_monitor->sun.sun_family = AF_LOCAL; if (socket_path[0] == '@') { /* translate leading '@' to abstract namespace */ - util_strlcpy(udev_monitor->sun.sun_path, socket_path, sizeof(udev_monitor->sun.sun_path)); + util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); udev_monitor->sun.sun_path[0] = '\0'; udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); } else if (stat(socket_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { /* existing socket file */ - util_strlcpy(udev_monitor->sun.sun_path, socket_path, sizeof(udev_monitor->sun.sun_path)); + util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); } else { /* no socket file, assume abstract namespace socket */ - util_strlcpy(&udev_monitor->sun.sun_path[1], socket_path, sizeof(udev_monitor->sun.sun_path)-1); + util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; } udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); @@ -545,8 +545,7 @@ retry: if (strncmp(key, "DEVPATH=", 8) == 0) { char path[UTIL_PATH_SIZE]; - util_strlcpy(path, udev_get_sys_path(udev_monitor->udev), sizeof(path)); - util_strlcat(path, &key[8], sizeof(path)); + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev_monitor->udev), &key[8], NULL); udev_device_set_syspath(udev_device, path); devpath_set = 1; } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { @@ -564,7 +563,7 @@ retry: char *slink; char *next; - util_strlcpy(devlinks, &key[9], sizeof(devlinks)); + util_strscpy(devlinks, sizeof(devlinks), &key[9]); slink = devlinks; next = strchr(slink, ' '); while (next != NULL) { @@ -637,19 +636,17 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi if (udev_monitor->sun.sun_family != 0) { const char *action; char header[2048]; - size_t hlen; + char *s; /* header @ */ action = udev_device_get_action(udev_device); if (action == NULL) return -EINVAL; - util_strlcpy(header, action, sizeof(header)); - util_strlcat(header, "@", sizeof(header)); - hlen = util_strlcat(header, udev_device_get_devpath(udev_device), sizeof(header))+1; - if (hlen >= sizeof(header)) + s = header; + if (util_strpcpyl(&s, sizeof(header), action, "@", udev_device_get_devpath(udev_device), NULL) == 0) return -EINVAL; iov[0].iov_base = header; - iov[0].iov_len = hlen; + iov[0].iov_len = (s - header)+1; /* add properties list */ iov[1].iov_base = (char *)buf; @@ -667,7 +664,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi /* add versioned header */ memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header)); - util_strlcpy(nlh.version, "udev-" VERSION, sizeof(nlh.version)); + util_strscpy(nlh.version, sizeof(nlh.version), "udev-" VERSION); nlh.magic = htonl(UDEV_MONITOR_MAGIC); val = udev_device_get_subsystem(udev_device); nlh.filter_subsystem = htonl(util_string_hash32(val)); diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 7dd8e7dfe0..9ec5e1aae2 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2009 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -164,11 +164,13 @@ ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *sub ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); int util_log_priority(const char *priority); -size_t util_path_encode(char *s, size_t len); +size_t util_path_encode(const char *src, char *dest, size_t size); size_t util_path_decode(char *s); void util_remove_trailing_chars(char *path, char c); -size_t util_strlcpy(char *dst, const char *src, size_t size); -size_t util_strlcat(char *dst, const char *src, size_t size); +size_t util_strpcpy(char **dest, size_t size, const char *src); +size_t util_strpcpyl(char **dest, size_t size, const char *src, ...); +size_t util_strscpy(char *dest, size_t size, const char *src); +size_t util_strscpyl(char *dest, size_t size, const char *src, ...); int udev_util_replace_whitespace(const char *str, char *to, size_t len); int udev_util_replace_chars(char *str, const char *white); int udev_util_encode_string(const char *str, char *str_enc, size_t len); diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index 63229fd8fe..a2860ec8c2 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -84,8 +84,7 @@ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queu if (udev_queue == NULL) return -EINVAL; - util_strlcpy(filename, udev_get_sys_path(udev_queue->udev), sizeof(filename)); - util_strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev_queue->udev), "/kernel/uevent_seqnum", NULL); fd = open(filename, O_RDONLY); if (fd < 0) return 0; @@ -109,8 +108,7 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) if (udev_queue == NULL) return -EINVAL; - util_strlcpy(filename, udev_get_dev_path(udev_queue->udev), sizeof(filename)); - util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/uevent_seqnum", NULL); fd = open(filename, O_RDONLY); if (fd < 0) return 0; @@ -132,8 +130,7 @@ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) if (udev_queue == NULL) return 0; - util_strlcpy(filename, udev_get_dev_path(udev_queue->udev), sizeof(filename)); - util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/uevent_seqnum", NULL); if (stat(filename, &statbuf) == 0) return 1; return 0; @@ -147,8 +144,7 @@ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) if (udev_queue == NULL) return -EINVAL; - util_strlcpy(queuename, udev_get_dev_path(udev_queue->udev), sizeof(queuename)); - util_strlcat(queuename, "/.udev/queue", sizeof(queuename)); + util_strscpyl(queuename, sizeof(queuename), udev_get_dev_path(udev_queue->udev), "/.udev/queue", NULL); if (stat(queuename, &statbuf) == 0) { dbg(udev_queue->udev, "queue is not empty\n"); return 0; @@ -200,28 +196,26 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev if (udev_queue == NULL) return NULL; udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); - util_strlcpy(path, udev_get_dev_path(udev_queue->udev), sizeof(path)); - util_strlcat(path, "/.udev/queue", sizeof(path)); + util_strscpyl(path, sizeof(path), udev_get_dev_path(udev_queue->udev), "/.udev/queue", NULL); dir = opendir(path); if (dir == NULL) return NULL; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char filename[UTIL_PATH_SIZE]; char syspath[UTIL_PATH_SIZE]; - size_t syslen; + char *s; + size_t l; ssize_t len; if (dent->d_name[0] == '.') continue; - util_strlcpy(filename, path, sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, dent->d_name, sizeof(filename)); - - syslen = util_strlcpy(syspath, udev_get_sys_path(udev_queue->udev), sizeof(syspath)); - len = readlink(filename, &syspath[syslen], sizeof(syspath)-syslen); - if (len < 0 || len >= (ssize_t)(sizeof(syspath)-syslen)) + util_strscpyl(filename, sizeof(filename), path, "/", dent->d_name, NULL); + s = syspath; + l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); + len = readlink(filename, s, l); + if (len < 0 || (size_t)len >= l) continue; - syspath[syslen + len] = '\0'; + s[len] = '\0'; dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, dent->d_name, 0, 0); } @@ -238,32 +232,29 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev if (udev_queue == NULL) return NULL; udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); - util_strlcpy(path, udev_get_dev_path(udev_queue->udev), sizeof(path)); - util_strlcat(path, "/.udev/failed", sizeof(path)); + util_strscpyl(path, sizeof(path), udev_get_dev_path(udev_queue->udev), "/.udev/failed", NULL); dir = opendir(path); if (dir == NULL) return NULL; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char filename[UTIL_PATH_SIZE]; char syspath[UTIL_PATH_SIZE]; - struct stat statbuf; - size_t syslen; + char *s; + size_t l; ssize_t len; + struct stat statbuf; if (dent->d_name[0] == '.') continue; - util_strlcpy(filename, path, sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, dent->d_name, sizeof(filename)); - - syslen = util_strlcpy(syspath, udev_get_sys_path(udev_queue->udev), sizeof(syspath)); - len = readlink(filename, &syspath[syslen], sizeof(syspath)-syslen); - if (len < 0 || len >= (ssize_t)(sizeof(syspath)-syslen)) + util_strscpyl(filename, sizeof(filename), path, "/", dent->d_name, NULL); + s = syspath; + l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); + len = readlink(filename, s, l); + if (len < 0 || (size_t)len >= l) continue; - syspath[syslen + len] = '\0'; + s[len] = '\0'; dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); - util_strlcpy(filename, syspath, sizeof(filename)); - util_strlcat(filename, "/uevent", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); if (stat(filename, &statbuf) != 0) continue; udev_list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0, 0); diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 2b8cda59f6..24ea0daa51 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2009 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -29,9 +29,7 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy ssize_t len; const char *pos; - util_strlcpy(path, syspath, sizeof(path)); - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, slink, sizeof(path)); + util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL); len = readlink(path, path, sizeof(path)); if (len < 0 || len >= (ssize_t) sizeof(path)) return -1; @@ -41,7 +39,7 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy return -1; pos = &pos[1]; dbg(udev, "resolved link to: '%s'\n", pos); - return util_strlcpy(value, pos, size); + return util_strscpy(value, size, pos); } ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size) @@ -61,6 +59,7 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) int len; int i; int back; + char *base; len = readlink(syspath, link_target, sizeof(link_target)); if (len <= 0) @@ -72,15 +71,13 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) ; dbg(udev, "base '%s', tail '%s', back %i\n", syspath, &link_target[back * 3], back); for (i = 0; i <= back; i++) { - char *pos = strrchr(syspath, '/'); - - if (pos == NULL) + base = strrchr(syspath, '/'); + if (base == NULL) return -1; - pos[0] = '\0'; + base[0] = '\0'; } dbg(udev, "after moving back '%s'\n", syspath); - util_strlcat(syspath, "/", size); - util_strlcat(syspath, &link_target[back * 3], size); + util_strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL); return 0; } @@ -101,29 +98,35 @@ int util_log_priority(const char *priority) return 0; } -size_t util_path_encode(char *s, size_t size) +size_t util_path_encode(const char *src, char *dest, size_t size) { - char t[(size * 4)+1]; size_t i, j; - for (i = 0, j = 0; s[i] != '\0' && i < size; i++) { - if (s[i] == '/') { - memcpy(&t[j], "\\x2f", 4); + for (i = 0, j = 0; src[i] != '\0'; i++) { + if (src[i] == '/') { + if (j+4 >= size) { + j = 0; + break; + } + memcpy(&dest[j], "\\x2f", 4); j += 4; - } else if (s[i] == '\\') { - memcpy(&t[j], "\\x5c", 4); + } else if (src[i] == '\\') { + if (j+4 >= size) { + j = 0; + break; + } + memcpy(&dest[j], "\\x5c", 4); j += 4; } else { - t[j] = s[i]; + if (j+1 >= size) { + j = 0; + break; + } + dest[j] = src[i]; j++; } } - if (i >= size) - return 0; - if (j >= size) - return 0; - memcpy(s, t, j); - s[j] = '\0'; + dest[j] = '\0'; return j; } @@ -158,47 +161,70 @@ void util_remove_trailing_chars(char *path, char c) path[--len] = '\0'; } -size_t util_strlcpy(char *dst, const char *src, size_t size) +/* + * Concatenates strings. In any case, terminates in _all_ cases with '\0' + * and moves the @dest pointer forward to the added '\0'. Returns the + * remaining size, and 0 if the string was truncated. + */ +size_t util_strpcpy(char **dest, size_t size, const char *src) { - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while ((ch = *p++)) { - if (bytes+1 < size) - *q++ = ch; - bytes++; + size_t len; + + len = strlen(src); + if (len >= size) { + if (size > 1) + *dest = mempcpy(*dest, src, size-1); + size = 0; + *dest[0] = '\0'; + } else { + if (len > 0) { + *dest = mempcpy(*dest, src, len); + size -= len; + } + *dest[0] = '\0'; } + return size; +} + +/* concatenates list of strings, moves dest forward */ +size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) +{ + va_list va; + + va_start(va, src); + do { + size = util_strpcpy(dest, size, src); + src = va_arg(va, char *); + } while (src != NULL); + va_end(va); - /* If size == 0 there is no space for a final null... */ - if (size) - *q = '\0'; - return bytes; + return size; } -size_t util_strlcat(char *dst, const char *src, size_t size) +/* copies string */ +size_t util_strscpy(char *dest, size_t size, const char *src) { - size_t bytes = 0; - char *q = dst; - const char *p = src; - char ch; - - while (bytes < size && *q) { - q++; - bytes++; - } - if (bytes == size) - return (bytes + strlen(src)); + char *s; - while ((ch = *p++)) { - if (bytes+1 < size) - *q++ = ch; - bytes++; - } + s = dest; + return util_strpcpy(&s, size, src); +} - *q = '\0'; - return bytes; +/* concatenates list of strings */ +size_t util_strscpyl(char *dest, size_t size, const char *src, ...) +{ + va_list va; + char *s; + + va_start(va, src); + s = dest; + do { + size = util_strpcpy(&s, size, src); + src = va_arg(va, char *); + } while (src != NULL); + va_end(va); + + return size; } /* count of characters used to encode one unicode char */ diff --git a/udev/test-udev.c b/udev/test-udev.c index 6ec91c174a..c6b8bf573b 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -83,8 +83,7 @@ int main(int argc, char *argv[]) rules = udev_rules_new(udev, 1); - util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); - util_strlcat(syspath, devpath, sizeof(syspath)); + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); dev = udev_device_new_from_syspath(udev, syspath); if (dev == NULL) { info(udev, "unknown device '%s'\n", devpath); diff --git a/udev/udev-event.c b/udev/udev-event.c index 03ae352415..d52125193c 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Kay Sievers + * Copyright (C) 2004-2009 Kay Sievers * * 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 @@ -57,178 +57,185 @@ void udev_event_unref(struct udev_event *event) free(event); } -/* extract possible {attr} and move str behind it */ -static char *get_format_attribute(struct udev *udev, char **str) -{ - char *pos; - char *attr = NULL; - - if (*str[0] == '{') { - pos = strchr(*str, '}'); - if (pos == NULL) { - err(udev, "missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - attr = *str+1; - *str = pos+1; - dbg(udev, "attribute='%s', str='%s'\n", attr, *str); - } - return attr; -} - -void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize) +size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size) { struct udev_device *dev = event->dev; - char temp[UTIL_PATH_SIZE]; - char temp2[UTIL_PATH_SIZE]; - char *head, *tail, *cpos, *attr, *rest; - int i; - int count; enum subst_type { SUBST_UNKNOWN, - SUBST_DEVPATH, + SUBST_TEMP_NODE, + SUBST_ATTR, + SUBST_ENV, SUBST_KERNEL, SUBST_KERNEL_NUMBER, - SUBST_ID, SUBST_DRIVER, + SUBST_DEVPATH, + SUBST_ID, SUBST_MAJOR, SUBST_MINOR, SUBST_RESULT, - SUBST_ATTR, SUBST_PARENT, - SUBST_TEMP_NODE, SUBST_NAME, SUBST_LINKS, SUBST_ROOT, SUBST_SYS, - SUBST_ENV, }; static const struct subst_map { char *name; char fmt; enum subst_type type; } map[] = { - { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, - { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, + { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, + { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, + { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, + { .name = "env", .fmt = 'E', .type = SUBST_ENV }, { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, - { .name = "id", .fmt = 'b', .type = SUBST_ID }, + { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, + { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, + { .name = "id", .fmt = 'b', .type = SUBST_ID }, { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, - { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, - { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, - { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, { .name = "name", .fmt = 'D', .type = SUBST_NAME }, { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, - { .name = "env", .fmt = 'E', .type = SUBST_ENV }, - { NULL, '\0', 0 } }; - enum subst_type type; - const struct subst_map *subst; + const char *from; + char *s; + size_t l; + + from = src; + s = dest; + l = size; - head = string; while (1) { - while (head[0] != '\0') { - if (head[0] == '$') { + enum subst_type type = SUBST_UNKNOWN; + char attrbuf[UTIL_PATH_SIZE]; + char *attr = NULL; + + while (from[0] != '\0') { + if (from[0] == '$') { /* substitute named variable */ - if (head[1] == '\0') - break; - if (head[1] == '$') { - util_strlcpy(temp, head+2, sizeof(temp)); - util_strlcpy(head+1, temp, maxsize); - head++; - continue; + unsigned int i; + + if (from[1] == '$') { + from++; + goto copy; } - head[0] = '\0'; - for (subst = map; subst->name; subst++) { - if (strncasecmp(&head[1], subst->name, strlen(subst->name)) == 0) { - type = subst->type; - tail = head + strlen(subst->name)+1; - dbg(event->udev, "will substitute format name '%s'\n", subst->name); - goto found; + + for (i = 0; i < ARRAY_SIZE(map); i++) { + if (strncasecmp(&from[1], map[i].name, strlen(map[i].name)) == 0) { + type = map[i].type; + from += strlen(map[i].name)+1; + dbg(event->udev, "will substitute format name '%s'\n", map[i].name); + goto subst; } } - head[0] = '$'; - err(event->udev, "unknown format variable '%s'\n", head); - } else if (head[0] == '%') { + } else if (from[0] == '%') { /* substitute format char */ - if (head[1] == '\0') - break; - if (head[1] == '%') { - util_strlcpy(temp, head+2, sizeof(temp)); - util_strlcpy(head+1, temp, maxsize); - head++; - continue; + unsigned int i; + + if (from[1] == '%') { + from++; + goto copy; } - head[0] = '\0'; - tail = head+1; - for (subst = map; subst->name; subst++) { - if (tail[0] == subst->fmt) { - type = subst->type; - tail++; - dbg(event->udev, "will substitute format char '%c'\n", subst->fmt); - goto found; + + for (i = 0; i < ARRAY_SIZE(map); i++) { + if (from[1] == map[i].fmt) { + type = map[i].type; + from += 2; + dbg(event->udev, "will substitute format char '%c'\n", map[i].fmt); + goto subst; } } - head[0] = '%'; - err(event->udev, "unknown format char '%c'\n", tail[0]); } - head++; +copy: + /* copy char */ + if (l == 0) + goto out; + s[0] = from[0]; + from++; + s++; + l--; + } + + goto out; +subst: + /* extract possible $format{attr} */ + if (from[0] == '{') { + unsigned int i; + + from++; + for (i = 0; from[i] != '}'; i++) { + if (from[i] == '\0') { + err(event->udev, "missing closing brace for format '%s'\n", src); + goto out; + } + } + if (i >= sizeof(attrbuf)) + goto out; + memcpy(attrbuf, from, i); + attrbuf[i] = '\0'; + from += i+1; + attr = attrbuf; } - break; -found: - attr = get_format_attribute(event->udev, &tail); - util_strlcpy(temp, tail, sizeof(temp)); - dbg(event->udev, "format=%i, string='%s', tail='%s'\n", type ,string, tail); switch (type) { case SUBST_DEVPATH: - util_strlcat(string, udev_device_get_devpath(dev), maxsize); + l = util_strpcpy(&s, l, udev_device_get_devpath(dev)); dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); break; case SUBST_KERNEL: - util_strlcat(string, udev_device_get_sysname(dev), maxsize); + l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); break; case SUBST_KERNEL_NUMBER: if (udev_device_get_sysnum(dev) == NULL) break; - util_strlcat(string, udev_device_get_sysnum(dev), maxsize); + l = util_strpcpy(&s, l, udev_device_get_sysnum(dev)); dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); break; case SUBST_ID: - if (event->dev_parent != NULL) { - util_strlcat(string, udev_device_get_sysname(event->dev_parent), maxsize); - dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); - } + if (event->dev_parent == NULL) + break; + l = util_strpcpy(&s, l, udev_device_get_sysname(event->dev_parent)); + dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); break; - case SUBST_DRIVER: - if (event->dev_parent != NULL) { - const char *driver; + case SUBST_DRIVER: { + const char *driver; - driver = udev_device_get_driver(event->dev_parent); - if (driver == NULL) - break; - util_strlcat(string, driver, maxsize); - dbg(event->udev, "substitute driver '%s'\n", driver); - } + if (event->dev_parent == NULL) + break; + + driver = udev_device_get_driver(event->dev_parent); + if (driver == NULL) + break; + l = util_strpcpy(&s, l, driver); + dbg(event->udev, "substitute driver '%s'\n", driver); break; - case SUBST_MAJOR: - sprintf(temp2, "%d", major(udev_device_get_devnum(dev))); - util_strlcat(string, temp2, maxsize); - dbg(event->udev, "substitute major number '%s'\n", temp2); + } + case SUBST_MAJOR: { + char num[UTIL_PATH_SIZE]; + + sprintf(num, "%d", major(udev_device_get_devnum(dev))); + l = util_strpcpy(&s, l, num); + dbg(event->udev, "substitute major number '%s'\n", num); break; - case SUBST_MINOR: - sprintf(temp2, "%d", minor(udev_device_get_devnum(dev))); - util_strlcat(string, temp2, maxsize); - dbg(event->udev, "substitute minor number '%s'\n", temp2); + } + case SUBST_MINOR: { + char num[UTIL_PATH_SIZE]; + + sprintf(num, "%d", minor(udev_device_get_devnum(dev))); + l = util_strpcpy(&s, l, num); + dbg(event->udev, "substitute minor number '%s'\n", num); break; - case SUBST_RESULT: + } + case SUBST_RESULT: { + char *rest; + int i; + if (event->program_result == NULL) break; /* get part part of the result string */ @@ -237,9 +244,11 @@ found: i = strtoul(attr, &rest, 10); if (i > 0) { char result[UTIL_PATH_SIZE]; + char tmp[UTIL_PATH_SIZE]; + char *cpos; dbg(event->udev, "request part #%d of result string\n", i); - util_strlcpy(result, event->program_result, sizeof(result)); + util_strscpy(result, sizeof(result), event->program_result); cpos = result; while (--i) { while (cpos[0] != '\0' && !isspace(cpos[0])) @@ -251,160 +260,158 @@ found: err(event->udev, "requested part of result string not found\n"); break; } - util_strlcpy(temp2, cpos, sizeof(temp2)); + util_strscpy(tmp, sizeof(tmp), cpos); /* %{2+}c copies the whole string from the second part on */ if (rest[0] != '+') { - cpos = strchr(temp2, ' '); + cpos = strchr(tmp, ' '); if (cpos) cpos[0] = '\0'; } - util_strlcat(string, temp2, maxsize); - dbg(event->udev, "substitute part of result string '%s'\n", temp2); + l = util_strpcpy(&s, l, tmp); + dbg(event->udev, "substitute part of result string '%s'\n", tmp); } else { - util_strlcat(string, event->program_result, maxsize); + l = util_strpcpy(&s, l, event->program_result); dbg(event->udev, "substitute result string '%s'\n", event->program_result); } break; - case SUBST_ATTR: - if (attr == NULL) + } + case SUBST_ATTR: { + const char *val; + char value[UTIL_NAME_SIZE]; + size_t len; + int count; + + if (attr == NULL) { err(event->udev, "missing file parameter for attr\n"); - else { - const char *val; - char value[UTIL_NAME_SIZE]; - size_t size; - - value[0] = '\0'; - /* read the value specified by [usb/]*/ - util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); - - /* try to read attribute of the current device */ - if (value[0] == '\0') { - val = udev_device_get_sysattr_value(event->dev, attr); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - } + break; + } - /* try to read the attribute of the parent device, other matches have selected */ - if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { - val = udev_device_get_sysattr_value(event->dev_parent, attr); - if (val != NULL) - util_strlcpy(value, val, sizeof(value)); - } + value[0] = '\0'; + /* read the value specified by "[dmi/id]product_name" */ + util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); - if (value[0]=='\0') - break; + /* try to read attribute of the current device */ + if (value[0] == '\0') { + val = udev_device_get_sysattr_value(event->dev, attr); + if (val != NULL) + util_strscpy(value, sizeof(value), val); + } - /* strip trailing whitespace, and replace unwanted characters */ - size = strlen(value); - while (size > 0 && isspace(value[--size])) - value[size] = '\0'; - count = udev_util_replace_chars(value, UDEV_ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - util_strlcat(string, value, maxsize); - dbg(event->udev, "substitute sysfs value '%s'\n", value); + /* try to read the attribute of the parent device, other matches have selected */ + if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { + val = udev_device_get_sysattr_value(event->dev_parent, attr); + if (val != NULL) + util_strscpy(value, sizeof(value), val); } + + if (value[0]=='\0') + break; + + /* strip trailing whitespace, and replace unwanted characters */ + len = strlen(value); + while (len > 0 && isspace(value[--len])) + value[len] = '\0'; + count = udev_util_replace_chars(value, UDEV_ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + l = util_strpcpy(&s, l, value); + dbg(event->udev, "substitute sysfs value '%s'\n", value); break; - case SUBST_PARENT: - { - struct udev_device *dev_parent; - const char *devnode; + } + case SUBST_PARENT: { + struct udev_device *dev_parent; + const char *devnode; - dev_parent = udev_device_get_parent(event->dev); - if (dev_parent == NULL) - break; + dev_parent = udev_device_get_parent(event->dev); + if (dev_parent == NULL) + break; devnode = udev_device_get_devnode(dev_parent); - if (devnode != NULL) { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + if (devnode != NULL) { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - util_strlcat(string, &devnode[devlen], maxsize); - dbg(event->udev, "found parent '%s', got node name '%s'\n", - udev_device_get_syspath(dev_parent), &devnode[devlen]); - } + l = util_strpcpy(&s, l, &devnode[devlen]); + dbg(event->udev, "found parent '%s', got node name '%s'\n", + udev_device_get_syspath(dev_parent), &devnode[devlen]); } break; - case SUBST_TEMP_NODE: - { - dev_t devnum; - struct stat statbuf; - char filename[UTIL_PATH_SIZE]; - const char *devtype; - - if (event->tmp_node != NULL) { - util_strlcat(string, event->tmp_node, maxsize); - dbg(event->udev, "tempnode: return earlier created one\n"); - break; - } - devnum = udev_device_get_devnum(dev); - if (major(devnum) == 0) - break; - /* lookup kernel provided node */ - if (udev_device_get_knodename(dev) != NULL) { - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, udev_device_get_knodename(dev), sizeof(filename)); - if (stat(filename, &statbuf) == 0 && statbuf.st_rdev == devnum) { - util_strlcat(string, filename, maxsize); - dbg(event->udev, "tempnode: return kernel node\n"); - break; - } - } - /* lookup /dev/{char,block}/: */ - if (strcmp(udev_device_get_subsystem(dev), "block") == 0) - devtype = "block"; - else - devtype = "char"; - snprintf(filename, sizeof(filename), "%s/%s/%u:%u", - udev_get_dev_path(event->udev), devtype, - major(udev_device_get_devnum(dev)), - minor(udev_device_get_devnum(dev))); + } + case SUBST_TEMP_NODE: { + dev_t devnum; + struct stat statbuf; + char filename[UTIL_PATH_SIZE]; + const char *devtype; + + if (event->tmp_node != NULL) { + l = util_strpcpy(&s, l, event->tmp_node); + dbg(event->udev, "tempnode: return earlier created one\n"); + break; + } + devnum = udev_device_get_devnum(dev); + if (major(devnum) == 0) + break; + /* lookup kernel provided node */ + if (udev_device_get_knodename(dev) != NULL) { + util_strscpyl(filename, sizeof(filename), + udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); if (stat(filename, &statbuf) == 0 && statbuf.st_rdev == devnum) { - util_strlcat(string, filename, maxsize); - dbg(event->udev, "tempnode: return maj:min node\n"); + l = util_strpcpy(&s, l, filename); + dbg(event->udev, "tempnode: return kernel node\n"); break; } - /* create temporary node */ - dbg(event->udev, "tempnode: create temp node\n"); - asprintf(&event->tmp_node, "%s/.tmp-%s-%u:%u", - udev_get_dev_path(event->udev), devtype, - major(udev_device_get_devnum(dev)), - minor(udev_device_get_devnum(dev))); - if (event->tmp_node == NULL) - break; - udev_node_mknod(dev, event->tmp_node, makedev(0, 0), 0600, 0, 0); - util_strlcat(string, event->tmp_node, maxsize); } + /* lookup /dev/{char,block}/: */ + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + devtype = "block"; + else + devtype = "char"; + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(event->udev), devtype, + major(udev_device_get_devnum(dev)), + minor(udev_device_get_devnum(dev))); + if (stat(filename, &statbuf) == 0 && statbuf.st_rdev == devnum) { + l = util_strpcpy(&s, l, filename); + dbg(event->udev, "tempnode: return maj:min node\n"); + break; + } + /* create temporary node */ + dbg(event->udev, "tempnode: create temp node\n"); + asprintf(&event->tmp_node, "%s/.tmp-%s-%u:%u", + udev_get_dev_path(event->udev), devtype, + major(udev_device_get_devnum(dev)), + minor(udev_device_get_devnum(dev))); + if (event->tmp_node == NULL) + break; + udev_node_mknod(dev, event->tmp_node, makedev(0, 0), 0600, 0, 0); + l = util_strpcpy(&s, l, event->tmp_node); break; + } case SUBST_NAME: if (event->name != NULL) { - util_strlcat(string, event->name, maxsize); + l = util_strpcpy(&s, l, event->name); dbg(event->udev, "substitute name '%s'\n", event->name); } else { - util_strlcat(string, udev_device_get_sysname(dev), maxsize); + l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); } break; - case SUBST_LINKS: - { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - struct udev_list_entry *list_entry; + case SUBST_LINKS: { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; - list_entry = udev_device_get_devlinks_list_entry(dev); - if (list_entry == NULL) - break; - util_strlcat(string, &udev_list_entry_get_name(list_entry)[devlen], maxsize); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) { - util_strlcat(string, " ", maxsize); - util_strlcat(string, &udev_list_entry_get_name(list_entry)[devlen], maxsize); - } - } + list_entry = udev_device_get_devlinks_list_entry(dev); + if (list_entry == NULL) + break; + l = util_strpcpy(&s, l, &udev_list_entry_get_name(list_entry)[devlen]); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) + l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); break; + } case SUBST_ROOT: - util_strlcat(string, udev_get_dev_path(event->udev), maxsize); + l = util_strpcpy(&s, l, udev_get_dev_path(event->udev)); dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); break; case SUBST_SYS: - util_strlcat(string, udev_get_sys_path(event->udev), maxsize); + l = util_strpcpy(&s, l, udev_get_sys_path(event->udev)); dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); break; case SUBST_ENV: @@ -418,15 +425,19 @@ found: if (value == NULL) break; dbg(event->udev, "substitute env '%s=%s'\n", attr, value); - util_strlcat(string, value, maxsize); + l = util_strpcpy(&s, l, value); break; } default: err(event->udev, "unknown substitution type=%i\n", type); break; } - util_strlcat(string, temp, maxsize); } + +out: + s[0] = '\0'; + dbg(event->udev, "'%s' -> '%s' (%zu)\n", src, dest, l); + return l; } static void rename_netif_kernel_log(struct ifreq ifr) @@ -466,8 +477,8 @@ static int rename_netif(struct udev_event *event) } memset(&ifr, 0x00, sizeof(struct ifreq)); - util_strlcpy(ifr.ifr_name, udev_device_get_sysname(dev), IFNAMSIZ); - util_strlcpy(ifr.ifr_newname, event->name, IFNAMSIZ); + util_strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev)); + util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); err = ioctl(sk, SIOCSIFNAME, &ifr); if (err == 0) rename_netif_kernel_log(ifr); @@ -482,8 +493,8 @@ static int rename_netif(struct udev_event *event) } /* free our own name, another process may wait for us */ - util_strlcpy(ifr.ifr_newname, udev_device_get_sysname(dev), IFNAMSIZ); - util_strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ); + util_strscpy(ifr.ifr_newname, IFNAMSIZ, udev_device_get_sysname(dev)); + util_strscpy(ifr.ifr_newname, IFNAMSIZ, "_rename"); err = ioctl(sk, SIOCSIFNAME, &ifr); if (err != 0) { err(event->udev, "error changing netif name %s to %s: %m\n", @@ -492,8 +503,8 @@ static int rename_netif(struct udev_event *event) } /* wait 90 seconds for our target to become available */ - util_strlcpy(ifr.ifr_name, ifr.ifr_newname, IFNAMSIZ); - util_strlcpy(ifr.ifr_newname, event->name, IFNAMSIZ); + util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); + util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); loop = 90 * 20; while (loop--) { err = ioctl(sk, SIOCSIFNAME, &ifr); @@ -591,9 +602,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) } /* set device node name */ - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, event->name, sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", event->name, NULL); udev_device_set_devnode(dev, filename); /* write current database entry */ @@ -609,9 +618,8 @@ exit_add: if (delete_kdevnode && udev_device_get_knodename(dev) != NULL) { struct stat stats; - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, udev_device_get_knodename(dev), sizeof(filename)); + util_strscpyl(filename, sizeof(filename), + udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); if (stat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) { unlink(filename); util_delete_path(event->udev, filename); @@ -649,11 +657,11 @@ exit_add: udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); /* now change the devpath, because the kernel device name has changed */ - util_strlcpy(syspath, udev_device_get_syspath(dev), sizeof(syspath)); + util_strscpy(syspath, sizeof(syspath), udev_device_get_syspath(dev)); pos = strrchr(syspath, '/'); if (pos != NULL) { - pos[1] = '\0'; - util_strlcat(syspath, event->name, sizeof(syspath)); + pos++; + util_strscpy(pos, sizeof(syspath) - (pos - syspath), event->name); udev_device_set_syspath(event->dev, syspath); udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); @@ -678,9 +686,8 @@ exit_add: info(event->udev, "'%s' not found in database, using kernel name '%s'\n", udev_device_get_syspath(dev), udev_device_get_sysname(dev)); - util_strlcpy(devnode, udev_get_dev_path(event->udev), sizeof(devnode)); - util_strlcat(devnode, "/", sizeof(devnode)); - util_strlcat(devnode, udev_device_get_sysname(dev), sizeof(devnode)); + util_strscpyl(devnode, sizeof(devnode), + udev_get_dev_path(event->udev), "/", udev_device_get_sysname(dev), NULL); udev_device_set_devnode(dev, devnode); } @@ -733,8 +740,7 @@ int udev_event_execute_run(struct udev_event *event) char program[UTIL_PATH_SIZE]; char **envp; - util_strlcpy(program, cmd, sizeof(program)); - udev_event_apply_format(event, program, sizeof(program)); + udev_event_apply_format(event, cmd, program, sizeof(program)); if (event->trace) fprintf(stderr, "run %s (%llu) '%s'\n", udev_device_get_syspath(event->dev), diff --git a/udev/udev-node.c b/udev/udev-node.c index 2f9cf4d7ac..89b674e4c4 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -34,22 +34,15 @@ /* reverse mapping from the device file name to the devpath */ static int name_index(struct udev *udev, const char *devpath, const char *name, int add) { - char device[UTIL_PATH_SIZE]; + char devpath_enc[UTIL_PATH_SIZE]; + char name_enc[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE * 2]; - size_t devlen = strlen(udev_get_dev_path(udev))+1; - size_t start; int fd; - /* directory with device name */ - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - start = util_strlcat(filename, "/.udev/names/", sizeof(filename)); - util_strlcat(filename, &name[devlen], sizeof(filename)); - util_path_encode(&filename[start], sizeof(filename) - start); - /* entry with the devpath */ - util_strlcpy(device, devpath, sizeof(device)); - util_path_encode(device, sizeof(device)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, device, sizeof(filename)); + util_path_encode(&name[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); + util_path_encode(devpath, devpath_enc, sizeof(devpath_enc)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), + "/.udev/names/", name_enc, "/", devpath_enc, NULL); if (add) { dbg(udev, "creating index: '%s'\n", filename); @@ -92,8 +85,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; info(udev, "atomically replace existing file '%s'\n", file); - util_strlcpy(file_tmp, file, sizeof(file_tmp)); - util_strlcat(file_tmp, TMP_FILE_EXT, sizeof(file_tmp)); + util_strscpyl(file_tmp, sizeof(file_tmp), file, TMP_FILE_EXT, NULL); unlink(file_tmp); udev_selinux_setfscreatecon(udev, file_tmp, mode); err = mknod(file_tmp, mode, devnum); @@ -145,10 +137,11 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) { struct stat stats; char target[UTIL_PATH_SIZE]; + char *s; + size_t l; char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; int i = 0; int tail = 0; - int len; int err = 0; /* use relative link */ @@ -158,12 +151,18 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) tail = i+1; i++; } + s = target; + l = sizeof(target); while (slink[i] != '\0') { if (slink[i] == '/') - util_strlcat(target, "../", sizeof(target)); + l = util_strpcpy(&s, l, "../"); i++; } - util_strlcat(target, &node[tail], sizeof(target)); + l = util_strscpy(s, l, &node[tail]); + if (l == 0) { + err = -EINVAL; + goto exit; + } /* preserve link with correct target, do not replace node of other device */ if (lstat(slink, &stats) == 0) { @@ -185,6 +184,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) } } else if (S_ISLNK(stats.st_mode)) { char buf[UTIL_PATH_SIZE]; + int len; dbg(udev, "found existing symlink '%s'\n", slink); len = readlink(slink, buf, sizeof(buf)); @@ -208,8 +208,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) } info(udev, "atomically replace '%s'\n", slink); - util_strlcpy(slink_tmp, slink, sizeof(slink_tmp)); - util_strlcat(slink_tmp, TMP_FILE_EXT, sizeof(slink_tmp)); + util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); unlink(slink_tmp); udev_selinux_setfscreatecon(udev, slink, S_IFLNK); err = symlink(target, slink_tmp); @@ -222,7 +221,6 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) if (err != 0) { err(udev, "rename(%s, %s) failed: %m\n", slink_tmp, slink); unlink(slink_tmp); - goto exit; } exit: return err; @@ -230,16 +228,16 @@ exit: static int name_index_get_devices(struct udev *udev, const char *name, struct udev_list_node *dev_list) { - char dirname[PATH_MAX]; - size_t devlen = strlen(udev_get_dev_path(udev))+1; - size_t start; + char dirname[UTIL_PATH_SIZE]; + char *s; + size_t l; DIR *dir; int count = 0; - util_strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); - start = util_strlcat(dirname, "/.udev/names/", sizeof(dirname)); - util_strlcat(dirname, &name[devlen], sizeof(dirname)); - util_path_encode(&dirname[start], sizeof(dirname) - start); + s = dirname; + l = util_strpcpyl(&s, sizeof(dirname), udev_get_dev_path(udev), + "/.udev/names/", NULL); + util_path_encode(&name[strlen(udev_get_dev_path(udev))+1], s, l); dir = opendir(dirname); if (dir == NULL) { dbg(udev, "no index directory '%s': %m\n", dirname); @@ -258,8 +256,7 @@ static int name_index_get_devices(struct udev *udev, const char *name, struct ud if (ent->d_name[0] == '.') continue; - util_strlcpy(device, udev_get_sys_path(udev), sizeof(device)); - util_strlcat(device, ent->d_name, sizeof(device)); + util_strscpyl(device, sizeof(device), udev_get_sys_path(udev), ent->d_name, NULL); util_path_decode(device); udev_list_entry_add(udev, dev_list, device, NULL, 1, 0); count++; @@ -313,7 +310,7 @@ static int update_link(struct udev_device *dev, const char *slink) udev_device_get_devnode(dev)); } else if (target[0] == '\0' || udev_device_get_devlink_priority(dev) >= priority) { priority = udev_device_get_devlink_priority(dev); - util_strlcpy(target, udev_device_get_devnode(dev), sizeof(target)); + util_strscpy(target, sizeof(target), udev_device_get_devnode(dev)); } continue; } @@ -334,7 +331,7 @@ static int update_link(struct udev_device *dev, const char *slink) priority); if (target[0] == '\0' || udev_device_get_devlink_priority(dev_db) > priority) { priority = udev_device_get_devlink_priority(dev_db); - util_strlcpy(target, devnode, sizeof(target)); + util_strscpy(target, sizeof(target), devnode); } } } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 39fe55aac1..da1d322037 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -706,8 +706,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) info(udev, "updating devpath from '%s' to '%s'\n", udev_device_get_devpath(dev), val); - util_strlcpy(syspath, udev_get_sys_path(udev), sizeof(syspath)); - util_strlcat(syspath, val, sizeof(syspath)); + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), val, NULL); udev_device_set_syspath(dev, syspath); } else { struct udev_list_entry *entry; @@ -799,12 +798,9 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) /* a relative path is a device attribute */ devicepath[0] = '\0'; if (file[0] != '/') { - util_strlcpy(devicepath, udev_get_sys_path(udev), sizeof(devicepath)); - util_strlcat(devicepath, udev_device_get_devpath(dev), sizeof(devicepath)); - - util_strlcpy(filepath, devicepath, sizeof(filepath)); - util_strlcat(filepath, "/", sizeof(filepath)); - util_strlcat(filepath, file, sizeof(filepath)); + util_strscpyl(devicepath, sizeof(devicepath), + udev_get_sys_path(udev), udev_device_get_devpath(dev), NULL); + util_strscpyl(filepath, sizeof(filepath), devicepath, "/", file, NULL); file = filepath; } @@ -829,17 +825,21 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) static int attr_subst_subdir(char *attr, size_t len) { - char *pos; int found = 0; - pos = strstr(attr, "/*/"); - if (pos != NULL) { - char str[UTIL_PATH_SIZE]; + if (strstr(attr, "/*/")) { + char *pos; + char dirname[UTIL_PATH_SIZE]; + const char *tail; DIR *dir; - pos[1] = '\0'; - util_strlcpy(str, &pos[2], sizeof(str)); - dir = opendir(attr); + util_strscpy(dirname, sizeof(dirname), attr); + pos = strstr(dirname, "/*/"); + if (pos == NULL) + return -1; + pos[0] = '\0'; + tail = &pos[2]; + dir = opendir(dirname); if (dir != NULL) { struct dirent *dent; @@ -848,18 +848,14 @@ static int attr_subst_subdir(char *attr, size_t len) if (dent->d_name[0] == '.') continue; - util_strlcat(attr, dent->d_name, len); - util_strlcat(attr, str, len); + util_strscpyl(attr, len, dirname, "/", dent->d_name, tail, NULL); if (stat(attr, &stats) == 0) { found = 1; break; } - pos[1] = '\0'; } closedir(dir); } - if (!found) - util_strlcat(attr, str, len); } return found; @@ -1319,22 +1315,16 @@ static int add_rule(struct udev_rules *rules, char *line, char *pos; struct stat statbuf; - util_strlcpy(file, value, sizeof(file)); + /* allow programs in /lib/udev called without the path */ + if (value[0] != '/') + util_strscpyl(file, sizeof(file), UDEV_PREFIX "/lib/udev/", value, NULL); + else + util_strscpy(file, sizeof(file), value); pos = strchr(file, ' '); if (pos) pos[0] = '\0'; - - /* allow programs in /lib/udev called without the path */ - if (strchr(file, '/') == NULL) { - util_strlcpy(file, UDEV_PREFIX "/lib/udev/", sizeof(file)); - util_strlcat(file, value, sizeof(file)); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - } - dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); - if (!lstat(file, &statbuf) && (statbuf.st_mode & S_IXUSR)) { + if (stat(file, &statbuf) == 0 && (statbuf.st_mode & S_IXUSR)) { dbg(rules->udev, "IMPORT will be executed (autotype)\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); } else { @@ -1714,8 +1704,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); /* read dynamic/temporary rules */ - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - util_strlcat(filename, "/.udev/rules.d", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); if (stat(filename, &statbuf) != 0) { util_create_path(udev, filename); udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); @@ -1895,7 +1884,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * { char value[UTIL_PATH_SIZE]; - util_strlcpy(value, &rules->buf[token->key.value_off], sizeof(value)); + util_strscpy(value, sizeof(value), &rules->buf[token->key.value_off]); key_value = value; while (key_value != NULL) { pos = strchr(key_value, '|'); @@ -1942,7 +1931,7 @@ static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct if (key_name[0] == '[') { char attr[UTIL_PATH_SIZE]; - util_strlcpy(attr, key_name, sizeof(attr)); + util_strscpy(attr, sizeof(attr), key_name); util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); } if (value[0] == '\0') { @@ -1951,7 +1940,7 @@ static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct val = udev_device_get_sysattr_value(dev, key_name); if (val == NULL) return -1; - util_strlcpy(value, val, sizeof(value)); + util_strscpy(value, sizeof(value), val); } /* strip trailing whitespace of value, if not asked to match for it */ @@ -2062,8 +2051,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event char filename[UTIL_PATH_SIZE]; int found; - util_strlcpy(filename, &rules->buf[cur->key.value_off], sizeof(filename)); - udev_event_apply_format(event, filename, sizeof(filename)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); found = (wait_for_file(event->dev, filename, 10) == 0); if (!found && (cur->key.op != OP_NOMATCH)) goto nomatch; @@ -2135,18 +2123,16 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event struct stat statbuf; int match; - util_strlcpy(filename, &rules->buf[cur->key.value_off], sizeof(filename)); - udev_event_apply_format(event, filename, sizeof(filename)); - if (util_resolve_subsys_kernel(event->udev, NULL, filename, sizeof(filename), 0) != 0) + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); + if (util_resolve_subsys_kernel(event->udev, filename, filename, sizeof(filename), 0) != 0) { if (filename[0] != '/') { char tmp[UTIL_PATH_SIZE]; - util_strlcpy(tmp, udev_device_get_syspath(event->dev), sizeof(tmp)); - util_strlcat(tmp, "/", sizeof(tmp)); - util_strlcat(tmp, filename, sizeof(tmp)); - util_strlcpy(filename, tmp, sizeof(filename)); + util_strscpy(tmp, sizeof(tmp), filename); + util_strscpyl(filename, sizeof(filename), + udev_device_get_syspath(event->dev), "/", tmp, NULL); } - + } attr_subst_subdir(filename, sizeof(filename)); match = (stat(filename, &statbuf) == 0); @@ -2170,8 +2156,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event free(event->program_result); event->program_result = NULL; - util_strlcpy(program, &rules->buf[cur->key.value_off], sizeof(program)); - udev_event_apply_format(event, program, sizeof(program)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); info(event->udev, "PROGRAM '%s' %s:%u\n", program, @@ -2200,8 +2185,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event { char import[UTIL_PATH_SIZE]; - util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); - udev_event_apply_format(event, import, sizeof(import)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); if (import_file_into_properties(event->dev, import) != 0) if (cur->key.op != OP_NOMATCH) goto nomatch; @@ -2211,8 +2195,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event { char import[UTIL_PATH_SIZE]; - util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); - udev_event_apply_format(event, import, sizeof(import)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); info(event->udev, "IMPORT '%s' %s:%u\n", import, &rules->buf[rule->rule.filename_off], @@ -2226,8 +2209,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event { char import[UTIL_PATH_SIZE]; - util_strlcpy(import, &rules->buf[cur->key.value_off], sizeof(import)); - udev_event_apply_format(event, import, sizeof(import)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); if (import_parent_into_properties(event->dev, import) != 0) if (cur->key.op != OP_NOMATCH) goto nomatch; @@ -2269,8 +2251,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; if (cur->key.op == OP_ASSIGN_FINAL) event->owner_final = 1; - util_strlcpy(owner, &rules->buf[cur->key.value_off], sizeof(owner)); - udev_event_apply_format(event, owner, sizeof(owner)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); event->uid = util_lookup_user(event->udev, owner); info(event->udev, "OWNER %u %s:%u\n", event->uid, @@ -2286,8 +2267,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; if (cur->key.op == OP_ASSIGN_FINAL) event->group_final = 1; - util_strlcpy(group, &rules->buf[cur->key.value_off], sizeof(group)); - udev_event_apply_format(event, group, sizeof(group)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); event->gid = util_lookup_group(event->udev, group); info(event->udev, "GROUP %u %s:%u\n", event->gid, @@ -2304,8 +2284,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; if (cur->key.op == OP_ASSIGN_FINAL) event->mode_final = 1; - util_strlcpy(mode, &rules->buf[cur->key.value_off], sizeof(mode)); - udev_event_apply_format(event, mode, sizeof(mode)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode, sizeof(mode)); event->mode = strtol(mode, &endptr, 8); if (endptr[0] != '\0') { err(event->udev, "invalide mode '%s' set default mode 0660\n", mode); @@ -2359,8 +2338,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event char temp_value[UTIL_NAME_SIZE]; struct udev_list_entry *entry; - util_strlcpy(temp_value, value, sizeof(temp_value)); - udev_event_apply_format(event, temp_value, sizeof(temp_value)); + udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); entry = udev_device_add_property(event->dev, name, temp_value); /* store in db */ udev_list_entry_set_flag(entry, 1); @@ -2379,8 +2357,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; if (cur->key.op == OP_ASSIGN_FINAL) event->name_final = 1; - util_strlcpy(name_str, name, sizeof(name_str)); - udev_event_apply_format(event, name_str, sizeof(name_str)); + udev_event_apply_format(event, name, name_str, sizeof(name_str)); if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { count = udev_util_replace_chars(name_str, "/"); if (count > 0) @@ -2411,8 +2388,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event udev_device_cleanup_devlinks_list(event->dev); /* allow multiple symlinks separated by spaces */ - util_strlcpy(temp, &rules->buf[cur->key.value_off], sizeof(temp)); - udev_event_apply_format(event, temp, sizeof(temp)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); if (esc == ESCAPE_UNSET) count = udev_util_replace_chars(temp, "/ "); else if (esc == ESCAPE_REPLACE) @@ -2430,9 +2406,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event pos, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, pos, sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); udev_device_add_devlink(event->dev, filename); while (isspace(next[1])) next++; @@ -2444,9 +2418,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event pos, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, pos, sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); udev_device_add_devlink(event->dev, filename); } } @@ -2464,17 +2436,11 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event char value[UTIL_NAME_SIZE]; FILE *f; - util_strlcpy(attr, key_name, sizeof(attr)); - if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) { - util_strlcpy(attr, udev_device_get_syspath(event->dev), sizeof(attr)); - util_strlcat(attr, "/", sizeof(attr)); - util_strlcat(attr, key_name, sizeof(attr)); - } - + if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) + util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); attr_subst_subdir(attr, sizeof(attr)); - util_strlcpy(value, &rules->buf[cur->key.value_off], sizeof(value)); - udev_event_apply_format(event, value, sizeof(value)); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], value, sizeof(value)); info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); diff --git a/udev/udev-util.c b/udev/udev-util.c index d5eaef70c1..645293d389 100644 --- a/udev/udev-util.c +++ b/udev/udev-util.c @@ -36,7 +36,7 @@ int util_create_path(struct udev *udev, const char *path) struct stat stats; int ret; - util_strlcpy(p, path, sizeof(p)); + util_strscpy(p, sizeof(p), path); pos = strrchr(p, '/'); if (pos == p || pos == NULL) return 0; @@ -186,12 +186,10 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, struct udev_device *dev; char *attr; - if (string == NULL) - string = result; if (string[0] != '[') return -1; - util_strlcpy(temp, string, sizeof(temp)); + util_strscpy(temp, sizeof(temp), string); subsys = &temp[1]; @@ -223,16 +221,18 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, val = udev_device_get_sysattr_value(dev, attr); if (val != NULL) - util_strlcpy(result, val, maxsize); + util_strscpy(result, maxsize, val); else result[0] = '\0'; info(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); } else { - util_strlcpy(result, udev_device_get_syspath(dev), maxsize); - if (attr != NULL) { - util_strlcat(result, "/", maxsize); - util_strlcat(result, attr, maxsize); - } + size_t l; + char *s; + + s = result; + l = util_strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL); + if (attr != NULL) + util_strpcpyl(&s, l, "/", attr, NULL); info(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); } udev_device_unref(dev); @@ -254,7 +254,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp, int err = 0; /* build argv from command */ - util_strlcpy(arg, command, sizeof(arg)); + util_strscpy(arg, sizeof(arg), command); i = 0; if (strchr(arg, ' ') != NULL) { char *pos = arg; @@ -294,9 +294,8 @@ int util_run_program(struct udev *udev, const char *command, char **envp, } /* allow programs in /lib/udev/ to be called without the path */ - if (strchr(argv[0], '/') == NULL) { - util_strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); - util_strlcat(program, argv[0], sizeof(program)); + if (argv[0][0] != '/') { + util_strscpyl(program, sizeof(program), UDEV_PREFIX "/lib/udev/", argv[0], NULL); argv[0] = program; } diff --git a/udev/udev-watch.c b/udev/udev-watch.c index d333476346..8bc8775735 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -59,12 +59,8 @@ void udev_watch_restore(struct udev *udev) if (inotify_fd < 0) return; - util_strlcpy(oldname, udev_get_dev_path(udev), sizeof(oldname)); - util_strlcat(oldname, "/.udev/watch.old", sizeof(oldname)); - - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - util_strlcat(filename, "/.udev/watch", sizeof(filename)); - + util_strscpyl(oldname, sizeof(oldname), udev_get_dev_path(udev), "/.udev/watch.old", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/watch", NULL); if (rename(filename, oldname) == 0) { DIR *dir; struct dirent *ent; @@ -75,27 +71,26 @@ void udev_watch_restore(struct udev *udev) return; } - while ((ent = readdir(dir)) != NULL) { + for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) { char path[UTIL_PATH_SIZE]; char buf[UTIL_PATH_SIZE]; - ssize_t syslen; + char *s; + size_t l; ssize_t len; struct udev_device *dev; if (ent->d_name[0] < '0' || ent->d_name[0] > '9') continue; - util_strlcpy(path, oldname, sizeof(path)); - util_strlcat(path, "/", sizeof(path)); - util_strlcat(path, ent->d_name, sizeof(path)); - - syslen = util_strlcpy(buf, udev_get_sys_path(udev), sizeof(buf)); - len = readlink(path, &buf[syslen], sizeof(buf)-syslen); - if (len <= 0 || len >= (ssize_t)(sizeof(buf)-syslen)) { + util_strscpyl(path, sizeof(path), oldname, "/", ent->d_name, NULL); + s = buf; + l = util_strpcpy(&s, sizeof(buf), udev_get_sys_path(udev)); + len = readlink(path, s, l); + if (len <= 0 || len >= (ssize_t)l) { unlink(path); continue; } - buf[syslen + len] = '\0'; + s[len] = '\0'; dbg(udev, "old watch to '%s' found\n", buf); dev = udev_device_new_from_syspath(udev, buf); if (dev == NULL) { @@ -165,20 +160,20 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev) struct udev_device *udev_watch_lookup(struct udev *udev, int wd) { char filename[UTIL_PATH_SIZE]; - char buf[UTIL_PATH_SIZE]; - ssize_t syslen; + char syspath[UTIL_PATH_SIZE]; + char *s; + size_t l; ssize_t len; if (inotify_fd < 0 || wd < 0) return NULL; snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); - syslen = util_strlcpy(buf, udev_get_sys_path(udev), sizeof(buf)); - len = readlink(filename, &buf[syslen], sizeof(buf)-syslen); - if (len > 0 || len < (ssize_t)(sizeof(buf)-syslen)) { - buf[syslen + len] = '\0'; - return udev_device_new_from_syspath(udev, buf); - } - - return NULL; + s = syspath; + l = util_strpcpy(&s, sizeof(syspath), udev_get_sys_path(udev)); + len = readlink(filename, s, l); + if (len < 0 || (size_t)len >= l) + return NULL; + s[len] = '\0'; + return udev_device_new_from_syspath(udev, syspath); } diff --git a/udev/udev.h b/udev/udev.h index abf354a668..8f2c1c63dd 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -96,7 +96,7 @@ struct udev_event *udev_event_new(struct udev_device *dev); void udev_event_unref(struct udev_event *event); int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules); int udev_event_execute_run(struct udev_event *event); -void udev_event_apply_format(struct udev_event *event, char *string, size_t maxsize); +size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size); int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, char *result, size_t maxsize, int read_value); diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index f20eb07e04..db11a289b2 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -52,9 +52,7 @@ static void print_all_attributes(struct udev_device *device, const char *key) if (strcmp(dent->d_name, "dev") == 0) continue; - util_strlcpy(filename, udev_device_get_syspath(device), sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, dent->d_name, sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(device), "/", dent->d_name, NULL); if (lstat(filename, &statbuf) != 0) continue; if (S_ISLNK(statbuf.st_mode)) @@ -270,13 +268,10 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) goto exit; } /* remove /dev if given */ - if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) { - util_strlcpy(name, udev_get_dev_path(udev), sizeof(name)); - util_strlcat(name, "/", sizeof(name)); - util_strlcat(name, optarg, sizeof(name)); - } else { - util_strlcpy(name, optarg, sizeof(name)); - } + if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) + util_strscpyl(name, sizeof(name), udev_get_dev_path(udev), "/", optarg, NULL); + else + util_strscpy(name, sizeof(name), optarg); util_remove_trailing_chars(name, '/'); if (stat(name, &statbuf) < 0) { fprintf(stderr, "device node not found\n"); @@ -309,12 +304,10 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) goto exit; } /* add sys dir if needed */ - if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, optarg, sizeof(path)); - } else { - util_strlcpy(path, optarg, sizeof(path)); - } + if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); + else + util_strscpy(path, sizeof(path), optarg); util_remove_trailing_chars(path, '/'); device = udev_device_new_from_syspath(udev, path); if (device == NULL) { @@ -355,7 +348,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) break; case 'd': action = ACTION_DEVICE_ID_FILE; - util_strlcpy(name, optarg, sizeof(name)); + util_strscpy(name, sizeof(name), optarg); break; case 'a': action = ACTION_ATTRIBUTE_WALK; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 3f4cb5772d..1f0946114d 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -107,7 +107,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) char subsys[UTIL_NAME_SIZE]; char *devtype; - util_strlcpy(subsys, optarg, sizeof(subsys)); + util_strscpy(subsys, sizeof(subsys), optarg); devtype = strchr(subsys, ':'); if (devtype != NULL) { devtype[0] = '\0'; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index c53c273295..e49d52c5f1 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -91,12 +91,10 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) } /* add /sys if needed */ - if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { - util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); - util_strlcat(filename, syspath, sizeof(filename)); - } else { - util_strlcpy(filename, syspath, sizeof(filename)); - } + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); + else + util_strscpy(filename, sizeof(filename), syspath); util_remove_trailing_chars(filename, '/'); dev = udev_device_new_from_syspath(udev, filename); @@ -123,8 +121,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; - util_strlcpy(program, udev_list_entry_get_name(entry), sizeof(program)); - udev_event_apply_format(event, program, sizeof(program)); + udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); info(udev, "run: '%s'\n", program); } } diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 15e7dc17fb..c256a9e5da 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -49,8 +49,7 @@ static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) printf("%s\n", udev_list_entry_get_name(entry)); if (dry_run) continue; - util_strlcpy(filename, udev_list_entry_get_name(entry), sizeof(filename)); - util_strlcat(filename, "/uevent", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_list_entry_get_name(entry), "/uevent", NULL); fd = open(filename, O_WRONLY); if (fd < 0) { dbg(udev, "error on opening %s: %m\n", filename); @@ -150,7 +149,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) udev_enumerate_add_nomatch_subsystem(udev_enumerate, optarg); break; case 'a': - util_strlcpy(attr, optarg, sizeof(attr)); + util_strscpy(attr, sizeof(attr), optarg); val = strchr(attr, '='); if (val != NULL) { val[0] = 0; @@ -159,7 +158,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) udev_enumerate_add_match_sysattr(udev_enumerate, attr, val); break; case 'A': - util_strlcpy(attr, optarg, sizeof(attr)); + util_strscpy(attr, sizeof(attr), optarg); val = strchr(attr, '='); if (val != NULL) { val[0] = 0; diff --git a/udev/udevd.c b/udev/udevd.c index 419c486ddd..1fe76f8829 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -97,18 +97,17 @@ static void export_event_state(struct udev_event *event, enum event_state state) { char filename[UTIL_PATH_SIZE]; char filename_failed[UTIL_PATH_SIZE]; - size_t start; + char *s; + size_t l; /* location of queue file */ snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", udev_get_dev_path(event->udev), udev_device_get_seqnum(event->dev)); /* location of failed file */ - util_strlcpy(filename_failed, udev_get_dev_path(event->udev), sizeof(filename_failed)); - util_strlcat(filename_failed, "/", sizeof(filename_failed)); - start = util_strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed)); - util_strlcat(filename_failed, udev_device_get_devpath(event->dev), sizeof(filename_failed)); - util_path_encode(&filename_failed[start], sizeof(filename_failed) - start); + s = filename_failed; + l = util_strpcpyl(&s, sizeof(filename_failed), udev_get_dev_path(event->udev), "/.udev/failed/", NULL); + util_path_encode(udev_device_get_devpath(event->dev), s, l); switch (state) { case EVENT_QUEUED: @@ -124,12 +123,9 @@ static void export_event_state(struct udev_event *event, enum event_state state) /* "move" event - rename failed file to current name, do not delete failed */ char filename_failed_old[UTIL_PATH_SIZE]; - util_strlcpy(filename_failed_old, udev_get_dev_path(event->udev), sizeof(filename_failed_old)); - util_strlcat(filename_failed_old, "/", sizeof(filename_failed_old)); - start = util_strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old)); - util_strlcat(filename_failed_old, udev_device_get_devpath_old(event->dev), sizeof(filename_failed_old)); - util_path_encode(&filename_failed_old[start], sizeof(filename) - start); - + s = filename_failed_old; + l = util_strpcpyl(&s, sizeof(filename_failed_old), udev_get_dev_path(event->udev), "/.udev/failed/", NULL); + util_path_encode(udev_device_get_devpath_old(event->dev), s, l); if (rename(filename_failed_old, filename_failed) == 0) info(event->udev, "renamed devpath, moved failed state of '%s' to %s'\n", udev_device_get_devpath_old(event->dev), udev_device_get_devpath(event->dev)); @@ -270,8 +266,7 @@ static void event_queue_insert(struct udev_event *event) info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(event->dev), udev_device_get_action(event->dev), udev_device_get_subsystem(event->dev)); - util_strlcpy(filename, udev_get_dev_path(event->udev), sizeof(filename)); - util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/.udev/uevent_seqnum", NULL); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { char str[32]; @@ -551,8 +546,7 @@ static int handle_inotify(struct udev *udev) int fd; info(udev, "device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev)); - util_strlcpy(filename, udev_device_get_syspath(dev), sizeof(filename)); - util_strlcat(filename, "/uevent", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); fd = open(filename, O_WRONLY); if (fd < 0 || write(fd, "change", 6) < 0) info(udev, "error writing uevent: %m\n"); @@ -641,12 +635,10 @@ static void cleanup_queue_dir(struct udev *udev) char filename[UTIL_PATH_SIZE]; DIR *dir; - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/uevent_seqnum", NULL); unlink(filename); - util_strlcpy(dirname, udev_get_dev_path(udev), sizeof(dirname)); - util_strlcat(dirname, "/.udev/queue", sizeof(dirname)); + util_strscpyl(dirname, sizeof(dirname), udev_get_dev_path(udev), "/.udev/queue", NULL); dir = opendir(dirname); if (dir != NULL) { while (1) { @@ -657,9 +649,7 @@ static void cleanup_queue_dir(struct udev *udev) break; if (dent->d_name[0] == '.') continue; - util_strlcpy(filename, dirname, sizeof(filename)); - util_strlcat(filename, "/", sizeof(filename)); - util_strlcat(filename, dent->d_name, sizeof(filename)); + util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL); unlink(filename); } closedir(dir); @@ -674,8 +664,7 @@ static void export_initial_seqnum(struct udev *udev) char seqnum[32]; ssize_t len = 0; - util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename)); - util_strlcat(filename, "/kernel/uevent_seqnum", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); fd = open(filename, O_RDONLY); if (fd >= 0) { len = read(fd, seqnum, sizeof(seqnum)-1); @@ -685,8 +674,7 @@ static void export_initial_seqnum(struct udev *udev) strcpy(seqnum, "0\n"); len = 3; } - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - util_strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/uevent_seqnum", NULL); util_create_path(udev, filename); fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); if (fd >= 0) { @@ -705,8 +693,7 @@ static void startup_log(struct udev *udev) if (f != NULL) fprintf(f, "<6>udev: starting version " VERSION "\n"); - util_strlcpy(path, udev_get_sys_path(udev), sizeof(path)); - util_strlcat(path, "/class/mem/null", sizeof(path)); + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/class/mem/null", NULL); if (lstat(path, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) { const char *depr_str = "udev: missing sysfs features; please update the kernel " @@ -917,8 +904,7 @@ int main(int argc, char *argv[]) IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ - util_strlcpy(filename, udev_get_dev_path(udev), sizeof(filename)); - util_strlcat(filename, "/.udev/rules.d", sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); inotify_add_watch(inotify_fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } -- cgit v1.2.3-54-g00ecf From eba87f55f6383cd61a11fce2ae37ac8100d6ded2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 May 2009 18:10:26 +0200 Subject: edd_id: use openat() --- extras/edd_id/edd_id.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 9e9667fc62..90656b4411 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -45,7 +45,8 @@ int main(int argc, char *argv[]) int sysfs_fd; DIR *dir = NULL; int rc = 1; - char match[NAME_MAX]; + char filename[UTIL_PATH_SIZE]; + char match[UTIL_PATH_SIZE]; udev = udev_new(); if (udev == NULL) @@ -69,7 +70,8 @@ int main(int argc, char *argv[]) } /* check for kernel support */ - dir = opendir("/sys/firmware/edd"); + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/firmware/edd", NULL); + dir = opendir(filename); if (dir == NULL) { info(udev, "no kernel EDD support\n"); fprintf(stderr, "no kernel EDD support\n"); @@ -126,7 +128,6 @@ int main(int argc, char *argv[]) /* lookup signature in sysfs to determine the name */ match[0] = '\0'; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char file[UTIL_PATH_SIZE]; char sysfs_id_buf[256]; uint32_t sysfs_id; ssize_t size; @@ -134,23 +135,21 @@ int main(int argc, char *argv[]) if (dent->d_name[0] == '.') continue; - snprintf(file, sizeof(file), "/sys/firmware/edd/%s/mbr_signature", dent->d_name); - file[sizeof(file)-1] = '\0'; - - sysfs_fd = open(file, O_RDONLY); + util_strscpyl(filename, sizeof(filename), dent->d_name, "/mbr_signature", NULL); + sysfs_fd = openat(dirfd(dir), filename, O_RDONLY); if (sysfs_fd < 0) { - info(udev, "unable to open sysfs '%s'\n", file); + info(udev, "unable to open sysfs '%s'\n", filename); continue; } size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); close(sysfs_fd); if (size <= 0) { - info(udev, "read sysfs '%s' failed\n", file); + info(udev, "read sysfs '%s' failed\n", filename); continue; } sysfs_id_buf[size] = '\0'; - info(udev, "read '%s' from '%s'\n", sysfs_id_buf, file); + info(udev, "read '%s' from '%s'\n", sysfs_id_buf, filename); sysfs_id = strtoul(sysfs_id_buf, NULL, 16); /* look for matching value, that appears only once */ -- cgit v1.2.3-54-g00ecf From e6c1a2bde7609cc703a5fad34c3bc1d15d19bbdc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 May 2009 18:58:52 +0200 Subject: use openat(), unlinkat(), fstatat() --- TODO | 1 - udev/lib/libudev-queue.c | 7 ++----- udev/udev-rules.c | 6 ++---- udev/udev-watch.c | 20 +++++++++----------- udev/udevadm-info.c | 5 ++--- udev/udevd.c | 3 +-- 6 files changed, 16 insertions(+), 26 deletions(-) diff --git a/TODO b/TODO index 541faea556..161df02f05 100644 --- a/TODO +++ b/TODO @@ -2,7 +2,6 @@ o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) o remove MMC rules, they got a modalias now (2.6.30) o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30) - o convert readdir loops to unlinkat(), fstatat() o implement path_id in C with libudev (?) o convert firmware.sh to C (?) diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index a2860ec8c2..8dce6c314d 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -201,7 +201,6 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev if (dir == NULL) return NULL; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char filename[UTIL_PATH_SIZE]; char syspath[UTIL_PATH_SIZE]; char *s; size_t l; @@ -209,10 +208,9 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev if (dent->d_name[0] == '.') continue; - util_strscpyl(filename, sizeof(filename), path, "/", dent->d_name, NULL); s = syspath; l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); - len = readlink(filename, s, l); + len = readlinkat(dirfd(dir), dent->d_name, s, l); if (len < 0 || (size_t)len >= l) continue; s[len] = '\0'; @@ -246,10 +244,9 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev if (dent->d_name[0] == '.') continue; - util_strscpyl(filename, sizeof(filename), path, "/", dent->d_name, NULL); s = syspath; l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); - len = readlink(filename, s, l); + len = readlinkat(dirfd(dir), dent->d_name, s, l); if (len < 0 || (size_t)len >= l) continue; s[len] = '\0'; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index da1d322037..6d03ab63c0 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1641,10 +1641,8 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis if (strcmp(ext, suffix) != 0) continue; } - dbg(udev, "put file '%s/%s' into list\n", dirname, dent->d_name); - - snprintf(filename, sizeof(filename), "%s/%s", dirname, dent->d_name); - filename[sizeof(filename)-1] = '\0'; + util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL); + dbg(udev, "put file '%s' into list\n", filename); udev_list_entry_add(udev, file_list, filename, NULL, 1, 1); } diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 8bc8775735..53492e5f35 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -72,8 +72,7 @@ void udev_watch_restore(struct udev *udev) } for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) { - char path[UTIL_PATH_SIZE]; - char buf[UTIL_PATH_SIZE]; + char device[UTIL_PATH_SIZE]; char *s; size_t l; ssize_t len; @@ -82,19 +81,18 @@ void udev_watch_restore(struct udev *udev) if (ent->d_name[0] < '0' || ent->d_name[0] > '9') continue; - util_strscpyl(path, sizeof(path), oldname, "/", ent->d_name, NULL); - s = buf; - l = util_strpcpy(&s, sizeof(buf), udev_get_sys_path(udev)); - len = readlink(path, s, l); + s = device; + l = util_strpcpy(&s, sizeof(device), udev_get_sys_path(udev)); + len = readlinkat(dirfd(dir), ent->d_name, s, l); if (len <= 0 || len >= (ssize_t)l) { - unlink(path); + unlinkat(dirfd(dir), ent->d_name, 0); continue; } s[len] = '\0'; - dbg(udev, "old watch to '%s' found\n", buf); - dev = udev_device_new_from_syspath(udev, buf); + dbg(udev, "old watch to '%s' found\n", device); + dev = udev_device_new_from_syspath(udev, device); if (dev == NULL) { - unlink(path); + unlinkat(dirfd(dir), ent->d_name, 0); continue; } @@ -102,7 +100,7 @@ void udev_watch_restore(struct udev *udev) udev_watch_begin(udev, dev); udev_device_unref(dev); - unlink(path); + unlinkat(dirfd(dir), ent->d_name, 0); } closedir(dir); diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index db11a289b2..b743a1d642 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -40,7 +41,6 @@ static void print_all_attributes(struct udev_device *device, const char *key) if (dir != NULL) { for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { struct stat statbuf; - char filename[UTIL_PATH_SIZE]; const char *value; size_t len; @@ -52,8 +52,7 @@ static void print_all_attributes(struct udev_device *device, const char *key) if (strcmp(dent->d_name, "dev") == 0) continue; - util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(device), "/", dent->d_name, NULL); - if (lstat(filename, &statbuf) != 0) + if (fstatat(dirfd(dir), dent->d_name, &statbuf, AT_SYMLINK_NOFOLLOW) != 0) continue; if (S_ISLNK(statbuf.st_mode)) continue; diff --git a/udev/udevd.c b/udev/udevd.c index 1fe76f8829..b64f08b5c5 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -649,8 +649,7 @@ static void cleanup_queue_dir(struct udev *udev) break; if (dent->d_name[0] == '.') continue; - util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL); - unlink(filename); + unlinkat(dirfd(dir), dent->d_name, 0); } closedir(dir); rmdir(dirname); -- cgit v1.2.3-54-g00ecf From 690ed63a22408eea4e540bbdb5e1038df4a68df5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 May 2009 19:43:26 +0200 Subject: update TODO --- TODO | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/TODO b/TODO index 161df02f05..5b6af64e46 100644 --- a/TODO +++ b/TODO @@ -2,9 +2,8 @@ o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) o remove MMC rules, they got a modalias now (2.6.30) o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30) - o implement path_id in C with libudev (?) - o convert firmware.sh to C (?) o drop all support for the DEPRECATED sysfs layout o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names + o add warning for BUS, SYSFS, ID -- cgit v1.2.3-54-g00ecf From fb045134706a50f12361e37f936a87d62e757db3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 May 2009 23:12:22 +0200 Subject: remove unused GL_FORMAT from rules parser --- udev/udev-rules.c | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 6d03ab63c0..c036482759 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -103,7 +103,6 @@ enum string_glob_type { GL_SPLIT, /* multi-value A|B */ GL_SPLIT_GLOB, /* multi-value with glob A*|B* */ GL_SOMETHING, /* commonly used "?*" */ - GL_FORMAT, }; /* tokens of a rule are sorted/handled in this order */ @@ -230,7 +229,6 @@ static const char *string_glob_str(enum string_glob_type type) [GL_SPLIT] = "split", [GL_SPLIT_GLOB] = "split-glob", [GL_SOMETHING] = "split-glob", - [GL_FORMAT] = "format", }; return string_glob_strs[type]; @@ -1056,29 +1054,23 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, } glob = GL_PLAIN; - if (value != NULL) { - if (type < TK_M_MAX) { - /* check if we need to split or call fnmatch() while matching rules */ - int has_split; - int has_glob; - - has_split = (strchr(value, '|') != NULL); - has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || - strchr(value, '[') != NULL || strchr(value, ']') != NULL); - if (has_split && has_glob) { - glob = GL_SPLIT_GLOB; - } else if (has_split) { - glob = GL_SPLIT; - } else if (has_glob) { - if (strcmp(value, "?*") == 0) - glob = GL_SOMETHING; - else - glob = GL_GLOB; - } - } else { - /* check if we need to substitute format strings for matching rules */ - if (strchr(value, '%') != NULL || strchr(value, '$') != NULL) - glob = GL_FORMAT; + if (value != NULL && type < TK_M_MAX) { + /* check if we need to split or call fnmatch() while matching rules */ + int has_split; + int has_glob; + + has_split = (strchr(value, '|') != NULL); + has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || + strchr(value, '[') != NULL || strchr(value, ']') != NULL); + if (has_split && has_glob) { + glob = GL_SPLIT_GLOB; + } else if (has_split) { + glob = GL_SPLIT; + } else if (has_glob) { + if (strcmp(value, "?*") == 0) + glob = GL_SOMETHING; + else + glob = GL_GLOB; } } @@ -1901,7 +1893,6 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * case GL_SOMETHING: match = (val[0] != '\0'); break; - case GL_FORMAT: case GL_UNSET: return -1; } -- cgit v1.2.3-54-g00ecf From bd75fddbcbc65799bd4a684b3b6f4f04bcd637d8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 May 2009 23:45:32 +0200 Subject: require key names in uppercase Drop pretty expensive case-insensitive matching, and key names in mixed or lowercase are not supported anyway. --- udev/lib/libudev-util.c | 6 +++--- udev/lib/libudev.c | 6 +++--- udev/udev-rules.c | 56 ++++++++++++++++++++++++------------------------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c index 24ea0daa51..dcc4a0fd16 100644 --- a/udev/lib/libudev-util.c +++ b/udev/lib/libudev-util.c @@ -89,11 +89,11 @@ int util_log_priority(const char *priority) prio = strtol(priority, &endptr, 10); if (endptr[0] == '\0') return prio; - if (strncasecmp(priority, "err", 3) == 0) + if (strncmp(priority, "err", 3) == 0) return LOG_ERR; - if (strcasecmp(priority, "info") == 0) + if (strcmp(priority, "info") == 0) return LOG_INFO; - if (strcasecmp(priority, "debug") == 0) + if (strcmp(priority, "debug") == 0) return LOG_DEBUG; return 0; } diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c index 2177e5459c..a9baa70799 100644 --- a/udev/lib/libudev.c +++ b/udev/lib/libudev.c @@ -188,17 +188,17 @@ struct udev *udev_new(void) val++; } - if (strcasecmp(key, "udev_log") == 0) { + if (strcmp(key, "udev_log") == 0) { udev_set_log_priority(udev, util_log_priority(val)); continue; } - if (strcasecmp(key, "udev_root") == 0) { + if (strcmp(key, "udev_root") == 0) { free(udev->dev_path); udev->dev_path = strdup(val); util_remove_trailing_chars(udev->dev_path, '/'); continue; } - if (strcasecmp(key, "udev_rules") == 0) { + if (strcmp(key, "udev_rules") == 0) { free(udev->rules_path); udev->rules_path = strdup(val); util_remove_trailing_chars(udev->rules_path, '/'); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index c036482759..e6452a6fa4 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1142,7 +1142,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) break; - if (strcasecmp(key, "ACTION") == 0) { + if (strcmp(key, "ACTION") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid ACTION operation\n"); goto invalid; @@ -1151,7 +1151,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "DEVPATH") == 0) { + if (strcmp(key, "DEVPATH") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid DEVPATH operation\n"); goto invalid; @@ -1160,7 +1160,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "KERNEL") == 0) { + if (strcmp(key, "KERNEL") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid KERNEL operation\n"); goto invalid; @@ -1169,7 +1169,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "SUBSYSTEM") == 0) { + if (strcmp(key, "SUBSYSTEM") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid SUBSYSTEM operation\n"); goto invalid; @@ -1187,7 +1187,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "DRIVER") == 0) { + if (strcmp(key, "DRIVER") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid DRIVER operation\n"); goto invalid; @@ -1196,7 +1196,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncasecmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { + if (strncmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { attr = get_key_attribute(rules->udev, key + sizeof("ATTR")-1); if (attr == NULL) { err(rules->udev, "error parsing ATTR attribute\n"); @@ -1210,8 +1210,8 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "KERNELS") == 0 || - strcasecmp(key, "ID") == 0) { + if (strcmp(key, "KERNELS") == 0 || + strcmp(key, "ID") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid KERNELS operation\n"); goto invalid; @@ -1220,8 +1220,8 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "SUBSYSTEMS") == 0 || - strcasecmp(key, "BUS") == 0) { + if (strcmp(key, "SUBSYSTEMS") == 0 || + strcmp(key, "BUS") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid SUBSYSTEMS operation\n"); goto invalid; @@ -1230,7 +1230,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "DRIVERS") == 0) { + if (strcmp(key, "DRIVERS") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid DRIVERS operation\n"); goto invalid; @@ -1239,8 +1239,8 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncasecmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || - strncasecmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { + if (strncmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || + strncmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid ATTRS operation\n"); goto invalid; @@ -1260,7 +1260,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncasecmp(key, "ENV{", sizeof("ENV{")-1) == 0) { + if (strncmp(key, "ENV{", sizeof("ENV{")-1) == 0) { attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1); if (attr == NULL) { err(rules->udev, "error parsing ENV attribute\n"); @@ -1276,12 +1276,12 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "PROGRAM") == 0) { + if (strcmp(key, "PROGRAM") == 0) { rule_add_key(&rule_tmp, TK_M_PROGRAM, op, value, NULL); continue; } - if (strcasecmp(key, "RESULT") == 0) { + if (strcmp(key, "RESULT") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid RESULT operation\n"); goto invalid; @@ -1290,7 +1290,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncasecmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { + if (strncmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1); if (attr != NULL && strstr(attr, "program")) { dbg(rules->udev, "IMPORT will be executed\n"); @@ -1327,7 +1327,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncasecmp(key, "TEST", sizeof("TEST")-1) == 0) { + if (strncmp(key, "TEST", sizeof("TEST")-1) == 0) { mode_t mode = 0; if (op > OP_MATCH_MAX) { @@ -1344,7 +1344,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncasecmp(key, "RUN", sizeof("RUN")-1) == 0) { + if (strncmp(key, "RUN", sizeof("RUN")-1) == 0) { int flag = 0; attr = get_key_attribute(rules->udev, key + sizeof("RUN")-1); @@ -1354,22 +1354,22 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "WAIT_FOR") == 0 || strcasecmp(key, "WAIT_FOR_SYSFS") == 0) { + if (strcmp(key, "WAIT_FOR") == 0 || strcmp(key, "WAIT_FOR_SYSFS") == 0) { rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL); continue; } - if (strcasecmp(key, "LABEL") == 0) { + if (strcmp(key, "LABEL") == 0) { rule_tmp.rule.rule.label_off = add_string(rules, value); continue; } - if (strcasecmp(key, "GOTO") == 0) { + if (strcmp(key, "GOTO") == 0) { rule_add_key(&rule_tmp, TK_A_GOTO, 0, value, NULL); continue; } - if (strncasecmp(key, "NAME", sizeof("NAME")-1) == 0) { + if (strncmp(key, "NAME", sizeof("NAME")-1) == 0) { if (op < OP_MATCH_MAX) { rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL); } else { @@ -1394,7 +1394,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "SYMLINK") == 0) { + if (strcmp(key, "SYMLINK") == 0) { if (op < OP_MATCH_MAX) rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL); else @@ -1403,7 +1403,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "OWNER") == 0) { + if (strcmp(key, "OWNER") == 0) { uid_t uid; char *endptr; @@ -1420,7 +1420,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "GROUP") == 0) { + if (strcmp(key, "GROUP") == 0) { gid_t gid; char *endptr; @@ -1437,7 +1437,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "MODE") == 0) { + if (strcmp(key, "MODE") == 0) { mode_t mode; char *endptr; @@ -1450,7 +1450,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcasecmp(key, "OPTIONS") == 0) { + if (strcmp(key, "OPTIONS") == 0) { const char *pos; if (strstr(value, "last_rule") != NULL) { -- cgit v1.2.3-54-g00ecf From ce449f89d6e610dc57b0764e391d12259f625012 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 May 2009 01:20:18 +0200 Subject: keep the ifdef'd udevd testing/profiling hack --- udev/udevd.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/udev/udevd.c b/udev/udevd.c index b64f08b5c5..ebe3999daf 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -180,6 +180,16 @@ static void event_fork(struct udev_event *event) struct sigaction act; int err; +#if 0 + /* single process, no forking, just for testing/profiling */ + err = udev_event_execute_rules(event, rules); + if (err == 0 && !event->ignore_device && udev_get_run(event->udev)) + udev_event_execute_run(event); + info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err); + event_queue_delete(event); + return; +#endif + if (debug_trace) { event->trace = 1; fprintf(stderr, "fork %s (%llu)\n", -- cgit v1.2.3-54-g00ecf From 81469dae34a36e6916226fc7f60772452fc7bf0d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 May 2009 01:44:45 +0200 Subject: fix location of database files --- udev/lib/libudev-device-db-write.c | 2 +- udev/lib/libudev-device.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/lib/libudev-device-db-write.c b/udev/lib/libudev-device-db-write.c index d9d97d45a0..a8e66f7884 100644 --- a/udev/lib/libudev-device-db-write.c +++ b/udev/lib/libudev-device-db-write.c @@ -27,7 +27,7 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f s = filename; l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); - return util_path_encode(devpath, filename, l); + return util_path_encode(devpath, s, l); } int udev_device_update_db(struct udev_device *udev_device) diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 37b3a3b7a2..ea54badde4 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -68,7 +68,7 @@ static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *f s = filename; l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); - return util_path_encode(devpath, filename, l); + return util_path_encode(devpath, s, l); } int udev_device_read_db(struct udev_device *udev_device) -- cgit v1.2.3-54-g00ecf From f9b3f88f71f5bdfb18aa4bfba00d72fa41fdf286 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Thu, 21 May 2009 18:31:43 +0200 Subject: udevd: remove tiny bit of dead code --- udev/udevd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index ebe3999daf..23d594f556 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -349,8 +349,6 @@ static int devpath_busy(struct udev_event *event) { struct udev_list_node *loop; - if (event->delaying_seqnum > 0) { - } /* check if queue contains events we depend on */ udev_list_node_foreach(loop, &event_list) { struct udev_event *loop_event = node_to_event(loop); -- cgit v1.2.3-54-g00ecf From f503f6b22fa54d1a65156a51d8b3311190c73ae5 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Thu, 21 May 2009 22:22:37 +0200 Subject: udevd: implement a more efficient queue file format Directory lookups show up in profiling. The queue files are responsible for a large proportion of file-related system calls in udev coldplug. Instead of creating a file for each event, append their details to a log file. The file is periodically rebuilt (garbage-collected) to prevent it from growing indefinitely. This single queue file replaces both the queue directory and the uevent_seqnum file. On desktop systems the file tends not to grow beyond one page. So it should also save a small amount of memory in tmpfs. Tests on a running EeePC indicate average savings of 5% *udevd* cpu time as measured by oprofile. __link_path_walk is reduced from 1.5% to 1.3%. It is not completely clear where the rest of the gains come from. In tests running ~400 events, the queue file is rebuilt about 5 times. Signed-off-by: Alan Jenkins --- configure.ac | 4 +- udev/Makefile.am | 1 + udev/lib/exported_symbols | 1 + udev/lib/libudev-private.h | 16 +- udev/lib/libudev-queue-export.c | 473 ++++++++++++++++++++++++++++++++++++++++ udev/lib/libudev-queue.c | 310 ++++++++++++++++++-------- udev/lib/libudev.h | 2 + udev/udevadm-settle.c | 22 +- udev/udevd.c | 154 ++----------- 9 files changed, 726 insertions(+), 257 deletions(-) create mode 100644 udev/lib/libudev-queue-export.c diff --git a/configure.ac b/configure.ac index a6b53dbe54..f1d008e000 100644 --- a/configure.ac +++ b/configure.ac @@ -14,9 +14,9 @@ AC_PREFIX_DEFAULT([/usr]) test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix= dnl /* libudev version */ -LIBUDEV_LT_CURRENT=3 +LIBUDEV_LT_CURRENT=4 LIBUDEV_LT_REVISION=0 -LIBUDEV_LT_AGE=3 +LIBUDEV_LT_AGE=4 AC_SUBST(LIBUDEV_LT_CURRENT) AC_SUBST(LIBUDEV_LT_REVISION) AC_SUBST(LIBUDEV_LT_AGE) diff --git a/udev/Makefile.am b/udev/Makefile.am index fa8279dd61..6cd2f23dc3 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -30,6 +30,7 @@ common_files = \ lib/libudev-monitor.c \ lib/libudev-enumerate.c \ lib/libudev-queue.c \ + lib/libudev-queue-export.c \ lib/libudev-ctrl.c if USE_SELINUX diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols index 24a6595462..8e7749e488 100644 --- a/udev/lib/exported_symbols +++ b/udev/lib/exported_symbols @@ -68,5 +68,6 @@ udev_queue_get_udev_seqnum udev_queue_get_udev_is_active udev_queue_get_queue_is_empty udev_queue_get_seqnum_is_finished +udev_queue_get_seqnum_sequence_is_finished udev_queue_get_queued_list_entry udev_queue_get_failed_list_entry diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 9ec5e1aae2..3eb3d7957f 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -150,10 +150,18 @@ void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); entry = tmp, tmp = udev_list_entry_get_next(tmp)) /* libudev-queue */ -int udev_queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum); -int udev_queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device); -int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device); -int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device); +unsigned long long int udev_get_kernel_seqnum(struct udev *udev); +int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum); +ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size); +ssize_t udev_queue_skip_devpath(FILE *queue_file); + +/* libudev-queue-export */ +struct udev_queue_export *udev_queue_export_new(struct udev *udev); +void udev_queue_export_unref(struct udev_queue_export *udev_queue_export); +void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); +int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); +int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); +int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); /* libudev-utils */ #define UTIL_PATH_SIZE 1024 diff --git a/udev/lib/libudev-queue-export.c b/udev/lib/libudev-queue-export.c new file mode 100644 index 0000000000..ddb1974dbe --- /dev/null +++ b/udev/lib/libudev-queue-export.c @@ -0,0 +1,473 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2009 Alan Jenkins + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +/* + * DISCLAIMER - The file format mentioned here is private to udev/libudev, + * and may be changed without notice. + * + * + * The udev event queue is exported as a binary log file. + * Each log record consists of a sequence number followed by the device path. + * + * When a new event is queued, its details are appended to the log. + * When the event finishes, a second record is appended to the log + * with the same sequence number but a null devpath. + * + * Example: + * {1, "/devices/virtual/mem/null" }, + * {2, "/devices/virtual/mem/zero" }, + * {1, "" }, + * Event 2 is still queued, but event 1 has been finished + * + * The queue does not grow indefinitely. It is periodically re-created + * to remove finished events. Atomic rename() makes this transparent to readers. + * + * + * The queue file starts with a single sequence number which specifies the + * minimum sequence number in the log that follows. Any events prior to this + * sequence number have already finished. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); + +struct udev_queue_export { + struct udev *udev; + int failed_count; /* number of failed events exported */ + int queued_count; /* number of unfinished events exported in queue file */ + FILE *queue_file; + unsigned long long int seqnum_max; /* earliest sequence number in queue file */ + unsigned long long int seqnum_min; /* latest sequence number in queue file */ + int waste_bytes; /* queue file bytes wasted on finished events */ +}; + +struct udev_queue_export *udev_queue_export_new(struct udev *udev) +{ + struct udev_queue_export *udev_queue_export; + unsigned long long int initial_seqnum; + + if (udev == NULL) + return NULL; + + udev_queue_export = calloc(1, sizeof(struct udev_queue_export)); + if (udev_queue_export == NULL) + return NULL; + udev_queue_export->udev = udev; + + initial_seqnum = udev_get_kernel_seqnum(udev); + udev_queue_export->seqnum_min = initial_seqnum; + udev_queue_export->seqnum_max = initial_seqnum; + + udev_queue_export_cleanup(udev_queue_export); + if (rebuild_queue_file(udev_queue_export) != 0) { + free(udev_queue_export); + return NULL; + } + + return udev_queue_export; +} + +void udev_queue_export_unref(struct udev_queue_export *udev_queue_export) +{ + if (udev_queue_export == NULL) + return; + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + free(udev_queue_export); +} + +void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) +{ + char filename[UTIL_PATH_SIZE]; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + unlink(filename); + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + unlink(filename); +} + + +static int skip_to(FILE *file, long offset) +{ + long old_offset; + + /* fseek may drop buffered data, avoid it for small seeks */ + old_offset = ftell(file); + if (offset > old_offset && old_offset - offset <= BUFSIZ) { + size_t skip_bytes = old_offset - offset; + char buf[skip_bytes]; + + if (fread(buf, skip_bytes, 1, file) != skip_bytes) + return -1; + } + + return fseek(file, offset, SEEK_SET); +} + +struct queue_devpaths { + unsigned int devpaths_first; /* index of first queued event */ + unsigned int devpaths_size; + long devpaths[]; /* seqnum -> offset of devpath in queue file (or 0) */ +}; + +/* + * Returns a table mapping seqnum to devpath file offset for currently queued events. + * devpaths[i] represents the event with seqnum = i + udev_queue_export->seqnum_min. + */ +static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_export) +{ + struct queue_devpaths *devpaths; + unsigned long long int range; + long devpath_offset; + ssize_t devpath_len; + unsigned long long int seqnum; + unsigned long long int n; + unsigned int i; + + /* seek to the first event in the file */ + rewind(udev_queue_export->queue_file); + udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum); + + /* allocate the table */ + range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max; + if (range - 1 > INT_MAX) { + err(udev_queue_export->udev, "queue file overflow\n"); + return NULL; + } + devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); + if (index == NULL) + return NULL; + devpaths->devpaths_size = range + 1; + + /* read all records and populate the table */ + while(1) { + if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) + break; + n = seqnum - udev_queue_export->seqnum_max; + if (n >= devpaths->devpaths_size) + goto read_error; + + devpath_offset = ftell(udev_queue_export->queue_file); + devpath_len = udev_queue_skip_devpath(udev_queue_export->queue_file); + if (devpath_len < 0) + goto read_error; + + if (devpath_len > 0) + devpaths->devpaths[n] = devpath_offset; + else + devpaths->devpaths[n] = 0; + } + + /* find first queued event */ + for (i = 0; i < devpaths->devpaths_size; i++) { + if (devpaths->devpaths[i] != 0) + break; + } + devpaths->devpaths_first = i; + + return devpaths; + +read_error: + err(udev_queue_export->udev, "queue file corrupted\n"); + free(devpaths); + return NULL; +} + +static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) +{ + unsigned long long int seqnum; + struct queue_devpaths *devpaths = NULL; + char filename[UTIL_PATH_SIZE]; + char filename_tmp[UTIL_PATH_SIZE]; + FILE *new_queue_file = NULL; + unsigned int i; + + /* read old queue file */ + if (udev_queue_export->queue_file != NULL) { + dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n", + udev_queue_export->waste_bytes); + + devpaths = build_index(udev_queue_export); + if (devpaths != NULL) + udev_queue_export->seqnum_max += devpaths->devpaths_first; + } + if (devpaths == NULL) { + dbg(udev_queue_export->udev, "creating empty queue file\n"); + udev_queue_export->queued_count = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + } + + /* create new queue file */ + util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + new_queue_file = fopen(filename_tmp, "w+"); + if (new_queue_file == NULL) + goto error; + seqnum = udev_queue_export->seqnum_max; + fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); + + /* copy unfinished events only to the new file */ + if (devpaths != NULL) { + for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { + char devpath[UTIL_PATH_SIZE]; + int err; + unsigned short devpath_len; + + if (devpaths->devpaths[i] != 0) + { + skip_to(udev_queue_export->queue_file, devpaths->devpaths[i]); + err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); + devpath_len = err; + + fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); + fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); + fwrite(devpath, 1, devpath_len, new_queue_file); + } + seqnum++; + } + free(devpaths); + devpaths = NULL; + } + fflush(new_queue_file); + if (ferror(new_queue_file)) + goto error; + + /* rename the new file on top of the old one */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + if (rename(filename_tmp, filename) != 0) + goto error; + + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = new_queue_file; + udev_queue_export->waste_bytes = 0; + + return 0; + +error: + err(udev_queue_export->udev, "failed to create queue file: %m\n"); + udev_queue_export_cleanup(udev_queue_export); + + if (udev_queue_export->queue_file != NULL) { + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + } + if (new_queue_file != NULL) + fclose(new_queue_file); + + if (devpaths != NULL) + free(devpaths); + udev_queue_export->queued_count = 0; + udev_queue_export->waste_bytes = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + + return -1; +} + +static int write_queue_record(struct udev_queue_export *udev_queue_export, + unsigned long long int seqnum, const char *devpath, size_t devpath_len) +{ + unsigned short len; + + if (udev_queue_export->queue_file == NULL) { + dbg(udev_queue_export->udev, "can't record event: queue file not available\n"); + return -1; + } + + if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1) + goto write_error; + + len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; + if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) + goto write_error; + if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) + goto write_error; + + /* *must* flush output; caller may fork */ + if (fflush(udev_queue_export->queue_file) != 0) + goto write_error; + + return 0; + +write_error: + /* if we failed half way through writing a record to a file, + we should not try to write any further records to it. */ + err(udev_queue_export->udev, "error writing to queue file: %m\n"); + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + + return -1; +} + + +enum device_state { + DEVICE_QUEUED, + DEVICE_FINISHED, + DEVICE_FAILED, +}; + +static inline size_t queue_record_size(size_t devpath_len) +{ + return sizeof(unsigned long long int) + sizeof(unsigned short int) + devpath_len; +} + +static int update_queue(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + unsigned long long int seqnum = udev_device_get_seqnum(udev_device); + const char *devpath = NULL; + size_t devpath_len = 0; + int bytes; + int err; + + if (state == DEVICE_QUEUED) { + devpath = udev_device_get_devpath(udev_device); + devpath_len = strlen(devpath); + } + + /* recover from an earlier failed rebuild */ + if (udev_queue_export->queue_file == NULL) { + if (rebuild_queue_file(udev_queue_export) != 0) + return -1; + } + + /* when the queue files grow too large, they must be garbage collected and rebuilt */ + bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); + + /* if we're removing the last event from the queue, that's the best time to rebuild it */ + if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1 && bytes > 2048) { + /* because we don't need to read the old queue file */ + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + rebuild_queue_file(udev_queue_export); + return 0; + } + + /* try to rebuild the queue files before they grow larger than one page. */ + if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) + rebuild_queue_file(udev_queue_export); + + /* don't record a finished event, if we already dropped the event in a failed rebuild */ + if (seqnum < udev_queue_export->seqnum_max) + return 0; + + /* now write to the queue */ + if (state == DEVICE_QUEUED) { + udev_queue_export->queued_count++; + udev_queue_export->seqnum_min = seqnum; + } else { + udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0); + udev_queue_export->queued_count--; + } + err = write_queue_record(udev_queue_export, seqnum, devpath, devpath_len); + + /* try to handle ENOSPC */ + if (err != 0 && udev_queue_export->queued_count == 0) { + udev_queue_export_cleanup(udev_queue_export); + err = rebuild_queue_file(udev_queue_export); + } + + return err; +} + +static void update_failed(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + char *s; + size_t l; + + if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) + return; + + /* location of failed file */ + s = filename; + l = util_strpcpyl(&s, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); + util_path_encode(udev_device_get_devpath(udev_device), s, l); + + switch (state) { + case DEVICE_FAILED: + /* record event in the failed directory */ + if (udev_queue_export->failed_count == 0) + util_create_path(udev, filename); + udev_queue_export->failed_count++; + + udev_selinux_setfscreatecon(udev, filename, S_IFLNK); + symlink(udev_device_get_devpath(udev_device), filename); + udev_selinux_resetfscreatecon(udev); + break; + + case DEVICE_QUEUED: + /* delete failed file */ + if (unlink(filename) == 0) { + util_delete_path(udev, filename); + udev_queue_export->failed_count--; + } + break; + + case DEVICE_FINISHED: + if (udev_device_get_devpath_old(udev_device) != NULL) { + /* "move" event - rename failed file to current name, do not delete failed */ + char filename_old[UTIL_PATH_SIZE]; + + s = filename_old; + l = util_strpcpyl(&s, sizeof(filename_old), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); + util_path_encode(udev_device_get_devpath_old(udev_device), s, l); + + if (rename(filename_old, filename) == 0) + info(udev, "renamed devpath, moved failed state of '%s' to %s'\n", + udev_device_get_devpath_old(udev_device), udev_device_get_devpath(udev_device)); + } + break; + } + + return; +} + +static int update(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + update_failed(udev_queue_export, udev_device, state); + + if (update_queue(udev_queue_export, udev_device, state) != 0) + return -1; + + return 0; +} + +int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_QUEUED); +} + +int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_FINISHED); +} + +int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_FAILED); +} diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c index 8dce6c314d..cf1ddf3a07 100644 --- a/udev/lib/libudev-queue.c +++ b/udev/lib/libudev-queue.c @@ -2,6 +2,7 @@ * libudev - interface to udev device information * * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2009 Alan Jenkins * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,6 +18,7 @@ #include #include #include +#include #include #include "libudev.h" @@ -25,7 +27,6 @@ struct udev_queue { struct udev *udev; int refcount; - unsigned long long int last_seen_udev_seqnum; struct udev_list_node queue_list; struct udev_list_node failed_list; }; @@ -74,7 +75,7 @@ struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) return udev_queue->udev; } -unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) +unsigned long long int udev_get_kernel_seqnum(struct udev *udev) { char filename[UTIL_PATH_SIZE]; unsigned long long int seqnum; @@ -82,9 +83,7 @@ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queu char buf[32]; ssize_t len; - if (udev_queue == NULL) - return -EINVAL; - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev_queue->udev), "/kernel/uevent_seqnum", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); fd = open(filename, O_RDONLY); if (fd < 0) return 0; @@ -94,130 +93,271 @@ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queu return 0; buf[len-1] = '\0'; seqnum = strtoull(buf, NULL, 10); - dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); return seqnum; } -unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) +unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) { - char filename[UTIL_PATH_SIZE]; unsigned long long int seqnum; - int fd; - char buf[32]; - ssize_t len; if (udev_queue == NULL) return -EINVAL; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/uevent_seqnum", NULL); - fd = open(filename, O_RDONLY); - if (fd < 0) - return 0; - len = read(fd, buf, sizeof(buf)); - close(fd); - if (len <= 2) - return 0; - buf[len-1] = '\0'; - seqnum = strtoull(buf, NULL, 10); + + seqnum = udev_get_kernel_seqnum(udev_queue->udev); dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); - udev_queue->last_seen_udev_seqnum = seqnum; return seqnum; } -int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) +int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum) +{ + if (fread(seqnum, sizeof(unsigned long long int), 1, queue_file) != 1) + return -1; + + return 0; +} + +ssize_t udev_queue_skip_devpath(FILE *queue_file) +{ + unsigned short int len; + + if (fread(&len, sizeof(unsigned short int), 1, queue_file) == 1) { + char devpath[len]; + + /* use fread to skip, fseek might drop buffered data */ + if (fread(devpath, 1, len, queue_file) == len) + return len; + } + + return -1; +} + +ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size) +{ + unsigned short int read_bytes = 0; + unsigned short int len; + + if (fread(&len, sizeof(unsigned short int), 1, queue_file) != 1) + return -1; + + read_bytes = (len < size - 1) ? len : size - 1; + if (fread(devpath, 1, read_bytes, queue_file) != read_bytes) + return -1; + devpath[read_bytes] = '\0'; + + /* if devpath was too long, skip unread characters */ + if (read_bytes != len) { + unsigned short int skip_bytes = len - read_bytes; + char buf[skip_bytes]; + + if (fread(buf, 1, skip_bytes, queue_file) != skip_bytes) + return -1; + } + + return read_bytes; +} + +static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long int *seqnum_start) { char filename[UTIL_PATH_SIZE]; - struct stat statbuf; + FILE *queue_file; - if (udev_queue == NULL) + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/queue.bin", NULL); + queue_file = fopen(filename, "r"); + if (queue_file == NULL) + return NULL; + + if (udev_queue_read_seqnum(queue_file, seqnum_start) < 0) { + err(udev_queue->udev, "corrupt queue file\n"); + fclose(queue_file); + return NULL; + } + + return queue_file; +} + + +unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum_udev; + FILE *queue_file; + + queue_file = open_queue_file(udev_queue, &seqnum_udev); + if (queue_file == NULL) return 0; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/uevent_seqnum", NULL); - if (stat(filename, &statbuf) == 0) - return 1; - return 0; + + while (1) { + unsigned long long int seqnum; + ssize_t devpath_len; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + if (devpath_len > 0) + seqnum_udev = seqnum; + } + + fclose(queue_file); + return seqnum_udev; +} + +int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum_start; + FILE *queue_file; + + queue_file = open_queue_file(udev_queue, &seqnum_start); + if (queue_file == NULL) + return 0; + + fclose(queue_file); + return 1; } int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) { - char queuename[UTIL_PATH_SIZE]; - struct stat statbuf; unsigned long long int seqnum_kernel; + unsigned long long int seqnum_udev = 0; + int queued = 0; + int is_empty = 0; + FILE *queue_file; if (udev_queue == NULL) return -EINVAL; - util_strscpyl(queuename, sizeof(queuename), udev_get_dev_path(udev_queue->udev), "/.udev/queue", NULL); - if (stat(queuename, &statbuf) == 0) { + queue_file = open_queue_file(udev_queue, &seqnum_udev); + if (queue_file == NULL) + return 1; + + while (1) { + unsigned long long int seqnum; + ssize_t devpath_len; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + + if (devpath_len > 0) { + queued++; + seqnum_udev = seqnum; + } else { + queued--; + } + } + + if (queued > 0) { dbg(udev_queue->udev, "queue is not empty\n"); - return 0; + goto out; } + seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); - if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) { - dbg(udev_queue->udev, "queue is empty\n"); - return 1; - } - /* update udev seqnum, and check if udev is still running */ - if (udev_queue_get_udev_seqnum(udev_queue) == 0) - if (!udev_queue_get_udev_is_active(udev_queue)) - return 1; - if (seqnum_kernel <= udev_queue->last_seen_udev_seqnum) { - dbg(udev_queue->udev, "queue is empty\n"); - return 1; + if (seqnum_udev < seqnum_kernel) { + dbg(udev_queue->udev, "queue is empty but kernel events still pending [%llu]<->[%llu]\n", + seqnum_kernel, seqnum_udev); + goto out; } - dbg(udev_queue->udev, "queue is empty, but kernel events still pending [%llu]<->[%llu]\n", - seqnum_kernel, udev_queue->last_seen_udev_seqnum); - return 0; + + dbg(udev_queue->udev, "queue is empty\n"); + is_empty = 1; + +out: + fclose(queue_file); + return is_empty; } -int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) +int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, + unsigned long long int start, unsigned long long int end) { - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; + unsigned long long int seqnum = 0; + ssize_t devpath_len; + int unfinished; + FILE *queue_file; if (udev_queue == NULL) return -EINVAL; - /* did it reach the queue? */ - if (seqnum > udev_queue->last_seen_udev_seqnum) - if (seqnum > udev_queue_get_udev_seqnum(udev_queue)) - return 0; - /* is it still in the queue? */ - snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", - udev_get_dev_path(udev_queue->udev), seqnum); - if (lstat(filename, &statbuf) == 0) + queue_file = open_queue_file(udev_queue, &seqnum); + if (queue_file == NULL) + return 1; + if (start < seqnum) + start = seqnum; + if (start > end) + return 1; + if (end - start > INT_MAX - 1) + return -EOVERFLOW; + unfinished = (end - start) + 1; + + while (unfinished > 0) { + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + + if (devpath_len == 0) { + if (seqnum >= start && seqnum <= end) + unfinished--; + } + } + fclose(queue_file); + + return (unfinished == 0); +} + +int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) +{ + if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) return 0; + dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum); return 1; } struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) { - char path[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; + unsigned long long int seqnum; + FILE *queue_file; if (udev_queue == NULL) return NULL; udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); - util_strscpyl(path, sizeof(path), udev_get_dev_path(udev_queue->udev), "/.udev/queue", NULL); - dir = opendir(path); - if (dir == NULL) + + queue_file = open_queue_file(udev_queue, &seqnum); + if (queue_file == NULL) return NULL; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + + while (1) { char syspath[UTIL_PATH_SIZE]; char *s; size_t l; ssize_t len; + char seqnum_str[32]; + struct udev_list_entry *list_entry; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + snprintf(seqnum_str, sizeof(seqnum_str), "%llu", seqnum); - if (dent->d_name[0] == '.') - continue; s = syspath; l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); - len = readlinkat(dirfd(dir), dent->d_name, s, l); - if (len < 0 || (size_t)len >= l) - continue; - s[len] = '\0'; - dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); - udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, dent->d_name, 0, 0); + len = udev_queue_read_devpath(queue_file, s, l); + if (len < 0) + break; + + if (len > 0) { + udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, seqnum_str, 0, 0); + } else { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { + if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { + udev_list_entry_delete(list_entry); + break; + } + } + } } - closedir(dir); + fclose(queue_file); + return udev_list_get_entry(&udev_queue->queue_list); } @@ -259,23 +399,3 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev closedir(dir); return udev_list_get_entry(&udev_queue->failed_list); } - -int udev_queue_export_udev_seqnum(struct udev_queue *udev_queue, unsigned long long int seqnum) -{ - return -1; -} - -int udev_queue_export_device_queued(struct udev_queue *udev_queue, struct udev_device *udev_device) -{ - return -1; -} - -int udev_queue_export_device_finished(struct udev_queue *udev_queue, struct udev_device *udev_device) -{ - return -1; -} - -int udev_queue_export_device_failed(struct udev_queue *udev_queue, struct udev_device *udev_device) -{ - return -1; -} diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 9346eb4ddd..9b51ea3300 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -115,6 +115,8 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) int udev_queue_get_udev_is_active(struct udev_queue *udev_queue); int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum); +int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, + unsigned long long int start, unsigned long long int end); struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); #endif diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 52d9c0b244..f1052aa148 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -173,24 +173,16 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } while (!is_timeout) { - /* exit if queue is empty */ - if (udev_queue_get_queue_is_empty(udev_queue)) - break; - - /* if asked for, wait for a specific sequence of events */ if (start > 0) { - unsigned long long seq; - int finished; - - finished = 0; - for (seq = start; seq <= end; seq++) { - finished = udev_queue_get_seqnum_is_finished(udev_queue, seq); - if (!finished) - break; - } - if (finished) + /* if asked for, wait for a specific sequence of events */ + if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) + break; + } else { + /* exit if queue is empty */ + if (udev_queue_get_queue_is_empty(udev_queue)) break; } + usleep(1000 * 1000 / LOOP_PER_SECOND); } diff --git a/udev/udevd.c b/udev/udevd.c index 23d594f556..5ee61d2e23 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -65,6 +65,7 @@ static void reap_sigchilds(void); static int debug_trace; static struct udev_rules *rules; +static struct udev_queue_export *udev_queue_export; static struct udev_ctrl *udev_ctrl; static struct udev_monitor *kernel_monitor; static volatile sig_atomic_t sigchilds_waiting; @@ -78,12 +79,6 @@ static int max_childs; static int childs; static struct udev_list_node event_list; -enum event_state { - EVENT_QUEUED, - EVENT_FINISHED, - EVENT_FAILED, -}; - static struct udev_event *node_to_event(struct udev_list_node *node) { char *event; @@ -93,76 +88,15 @@ static struct udev_event *node_to_event(struct udev_list_node *node) return (struct udev_event *)event; } -static void export_event_state(struct udev_event *event, enum event_state state) -{ - char filename[UTIL_PATH_SIZE]; - char filename_failed[UTIL_PATH_SIZE]; - char *s; - size_t l; - - /* location of queue file */ - snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", - udev_get_dev_path(event->udev), udev_device_get_seqnum(event->dev)); - - /* location of failed file */ - s = filename_failed; - l = util_strpcpyl(&s, sizeof(filename_failed), udev_get_dev_path(event->udev), "/.udev/failed/", NULL); - util_path_encode(udev_device_get_devpath(event->dev), s, l); - - switch (state) { - case EVENT_QUEUED: - if(unlink(filename_failed) == 0) - util_delete_path(event->udev, filename_failed); - util_create_path(event->udev, filename); - udev_selinux_setfscreatecon(event->udev, filename, S_IFLNK); - symlink(udev_device_get_devpath(event->dev), filename); - udev_selinux_resetfscreatecon(event->udev); - break; - case EVENT_FINISHED: - if (udev_device_get_devpath_old(event->dev) != NULL) { - /* "move" event - rename failed file to current name, do not delete failed */ - char filename_failed_old[UTIL_PATH_SIZE]; - - s = filename_failed_old; - l = util_strpcpyl(&s, sizeof(filename_failed_old), udev_get_dev_path(event->udev), "/.udev/failed/", NULL); - util_path_encode(udev_device_get_devpath_old(event->dev), s, l); - if (rename(filename_failed_old, filename_failed) == 0) - info(event->udev, "renamed devpath, moved failed state of '%s' to %s'\n", - udev_device_get_devpath_old(event->dev), udev_device_get_devpath(event->dev)); - } else { - if (unlink(filename_failed) == 0) - util_delete_path(event->udev, filename_failed); - } - - unlink(filename); - - /* clean up possibly empty queue directory */ - if (udev_list_is_empty(&event_list)) - util_delete_path(event->udev, filename); - break; - case EVENT_FAILED: - /* move failed event to the failed directory */ - util_create_path(event->udev, filename_failed); - rename(filename, filename_failed); - - /* clean up possibly empty queue directory */ - if (udev_list_is_empty(&event_list)) - util_delete_path(event->udev, filename); - break; - } - - return; -} - static void event_queue_delete(struct udev_event *event) { udev_list_node_remove(&event->node); /* mark as failed, if "add" event returns non-zero */ if (event->exitstatus && strcmp(udev_device_get_action(event->dev), "add") == 0) - export_event_state(event, EVENT_FAILED); + udev_queue_export_device_failed(udev_queue_export, event->dev); else - export_event_state(event, EVENT_FINISHED); + udev_queue_export_device_finished(udev_queue_export, event->dev); udev_device_unref(event->dev); udev_event_unref(event); @@ -201,6 +135,7 @@ static void event_fork(struct udev_event *event) switch (pid) { case 0: /* child */ + udev_queue_export_unref(udev_queue_export); udev_ctrl_unref(udev_ctrl); logging_close(); logging_init("udevd-event"); @@ -267,27 +202,12 @@ static void event_fork(struct udev_event *event) static void event_queue_insert(struct udev_event *event) { - char filename[UTIL_PATH_SIZE]; - int fd; - event->queue_time = time(NULL); - export_event_state(event, EVENT_QUEUED); + udev_queue_export_device_queued(udev_queue_export, event->dev); info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(event->dev), udev_device_get_action(event->dev), udev_device_get_subsystem(event->dev)); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/.udev/uevent_seqnum", NULL); - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd >= 0) { - char str[32]; - int len; - - len = sprintf(str, "%llu\n", udev_device_get_seqnum(event->dev)); - write(fd, str, len); - close(fd); - } - - udev_list_node_append(&event->node, &event_list); run_exec_q = 1; @@ -637,59 +557,6 @@ static void reap_sigchilds(void) } } -static void cleanup_queue_dir(struct udev *udev) -{ - char dirname[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - DIR *dir; - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/uevent_seqnum", NULL); - unlink(filename); - - util_strscpyl(dirname, sizeof(dirname), udev_get_dev_path(udev), "/.udev/queue", NULL); - dir = opendir(dirname); - if (dir != NULL) { - while (1) { - struct dirent *dent; - - dent = readdir(dir); - if (dent == NULL || dent->d_name[0] == '\0') - break; - if (dent->d_name[0] == '.') - continue; - unlinkat(dirfd(dir), dent->d_name, 0); - } - closedir(dir); - rmdir(dirname); - } -} - -static void export_initial_seqnum(struct udev *udev) -{ - char filename[UTIL_PATH_SIZE]; - int fd; - char seqnum[32]; - ssize_t len = 0; - - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); - fd = open(filename, O_RDONLY); - if (fd >= 0) { - len = read(fd, seqnum, sizeof(seqnum)-1); - close(fd); - } - if (len <= 0) { - strcpy(seqnum, "0\n"); - len = 3; - } - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/uevent_seqnum", NULL); - util_create_path(udev, filename); - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd >= 0) { - write(fd, seqnum, len); - close(fd); - } -} - static void startup_log(struct udev *udev) { FILE *f; @@ -837,8 +704,11 @@ int main(int argc, char *argv[]) goto exit; } udev_list_init(&event_list); - cleanup_queue_dir(udev); - export_initial_seqnum(udev); + udev_queue_export = udev_queue_export_new(udev); + if (udev_queue_export == NULL) { + err(udev, "error creating queue file\n"); + goto exit; + } if (daemonize) { pid_t pid; @@ -1027,9 +897,11 @@ handle_signals: settle_pid = 0; } } - cleanup_queue_dir(udev); + udev_queue_export_cleanup(udev_queue_export); rc = 0; exit: + + udev_queue_export_unref(udev_queue_export); udev_rules_unref(rules); udev_ctrl_unref(udev_ctrl); if (inotify_fd >= 0) -- cgit v1.2.3-54-g00ecf From 9f894a33913ab1bdefd269938e86a0ece8880926 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 May 2009 23:49:53 +0200 Subject: udevadm: settle - make --timeout=0 working --- udev/udevadm-settle.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index f1052aa148..9059adc341 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -61,10 +61,10 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) unsigned long long start = 0; unsigned long long end = 0; int quiet = 0; - int timeout = 0; + int timeout = DEFAULT_TIMEOUT; struct sigaction act; struct udev_queue *udev_queue = NULL; - int rc = 0; + int rc = 1; dbg(udev, "version %s\n", VERSION); @@ -109,18 +109,18 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) " --seq-end= last seqnum to wait for\n" " --quiet do not print list after timeout\n" " --help\n\n"); - goto exit; + exit(0); } } if (timeout > 0) alarm(timeout); else - alarm(DEFAULT_TIMEOUT); + is_timeout = 1; udev_queue = udev_queue_new(udev); if (udev_queue == NULL) - goto exit; + exit(2); if (start > 0) { unsigned long long kernel_seq; @@ -172,17 +172,24 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } } - while (!is_timeout) { + while (1) { if (start > 0) { /* if asked for, wait for a specific sequence of events */ - if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) + if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) { + rc = 0; break; + } } else { /* exit if queue is empty */ - if (udev_queue_get_queue_is_empty(udev_queue)) + if (udev_queue_get_queue_is_empty(udev_queue)) { + rc = 0; break; + } } + if (is_timeout) + break; + usleep(1000 * 1000 / LOOP_PER_SECOND); } @@ -190,7 +197,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (is_timeout) { struct udev_list_entry *list_entry; - if (!quiet) { + if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) { info(udev, "timeout waiting for udev queue\n"); printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) @@ -198,9 +205,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); } - rc = 1; } -exit: + udev_queue_unref(udev_queue); return rc; } -- cgit v1.2.3-54-g00ecf From c406de19dc3ee4adcb2cd1ede704bfdd8b6b9789 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 May 2009 23:52:09 +0200 Subject: update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 97109e31b4..ac44d7a77d 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ udev 143 ======== Bugfixes. +The format of the queue exported by the udev damon has changed. There is +no longer a /dev/.udev/queue/ directory. The queue can be accessed with +udevadm settle and libudedv. + udev 142 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 12a7c14b86bb8039a46dfd1fe64e43ea9226d02f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 22 May 2009 16:44:53 +0200 Subject: rules: add SUBSYSTEM match to scsi rules On Fri, May 22, 2009 at 16:15, Alan Jenkins wrote: > I've been looking at what is responsible for all the path lookup activity in > coldplug. On my debian stable system, it looks like every device gets its > parent looked up in sysfs. I think this is due to SUBSYSTEMS matches. > > I see the udev default rules are different, but it looks like they still > test for SUBSYSTEMS on every single device. Should we add SUBSYSTEM="scsi_generic" > to these three rules? --- rules/rules.d/50-udev-default.rules | 6 +++--- rules/rules.d/60-persistent-storage-tape.rules | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 87c8977347..de96b95ba4 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -69,18 +69,18 @@ KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitio # cdrom SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" SUBSYSTEM=="block", KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="cdrom", GROUP="cdrom" -SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k", GROUP="cdrom" KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom" # tape KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="tape" KERNEL=="pt[0-9]*|npt[0-9]*|pht[0-9]*", GROUP="tape" -SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape" +SUBSYSTEM=="scsi_generic|scsi_tape", SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape" # block-releated KERNEL=="sch[0-9]*", GROUP="disk" -SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" KERNEL=="rawctl", NAME="raw/rawctl", GROUP="disk" diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index 8d53888924..30a0115608 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -5,7 +5,7 @@ ACTION!="add|change", GOTO="persistent_storage_tape_end" # type 8 devices are "Medium Changers" -KERNEL=="sg[0-9]*", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" -- cgit v1.2.3-54-g00ecf From bec7e07acc8ca2288e780d11b4d1e1387c3513dc Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 22 May 2009 20:54:46 +0200 Subject: test: check string substitutions in OWNER and GROUP String substitutions in OWNER and GROUP keys were broken in udev 137-142. Explicitly test for this, since such breakage will not manifest in typical rulesets. --- test/udev-test.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 30e8d2ac10..5516468bb7 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1654,14 +1654,14 @@ KERNEL=="sda", MODE="0000" EOF }, { - desc => "TEST PROGRAM feeds MODE", + desc => "TEST PROGRAM feeds OWNER, GROUP, MODE", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", - exp_perms => "0:0:0400", + exp_perms => "5000:100:0400", rules => < Date: Tue, 26 May 2009 00:50:45 +0200 Subject: cdrom_id: suppress ID_CDROM_MEDIA_STATE=blank for plain non-writable CDROM media Some broken fake cdrom drives return ID_CDROM_MEDIA_STATE=blank. $ /lib/udev/cdrom_id -d /dev/sr1 main: probing: '/dev/sr1' cd_inquiry: INQUIRY: [Nokia ][S60 ][1.0 ] cd_profiles: GET CONFIGURATION: number of profiles 76 cd_profiles: current profile 0x08 cd_media_toc: READ TOC: len: 12 cd_media_toc: last track 1 starts at block 0 cd_media_info: disk type 00 ID_CDROM=1 ID_CDROM_MRW=1 ID_CDROM_MRW_W=1 ID_CDROM_MEDIA=1 ID_CDROM_MEDIA_CD=1 ID_CDROM_MEDIA_STATE=blank Others work fine, but ID_CDROM_MEDIA_STATE is not needed for non-writable CDROM media: $ /lib/udev/cdrom_id -d /dev/sr1 main: probing: '/dev/sr1' cd_inquiry: INQUIRY: [SanDisk ][U3 Cruzer Micro ][8.02] cd_profiles: GET CONFIGURATION: number of profiles 72 cd_profiles: current profile 0x08 cd_media_toc: READ TOC: len: 20 cd_media_toc: track=1 info=0x4(data) start_block=0 cd_media_toc: last track 1 starts at block 0 cd_media_info: disk type 00 ID_CDROM=1 ID_CDROM_MRW=1 ID_CDROM_MRW_W=1 ID_CDROM_MEDIA=1 ID_CDROM_MEDIA_CD=1 ID_CDROM_MEDIA_STATE=complete ID_CDROM_MEDIA_SESSION_COUNT=1 ID_CDROM_MEDIA_TRACK_COUNT=1 ID_CDROM_MEDIA_TRACK_COUNT_DATA=1 --- extras/cdrom_id/cdrom_id.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 0d873ae8e5..921e5346c9 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -426,8 +426,10 @@ static int cd_media_info(struct udev *udev, int fd) info(udev, "disk type %02x\n", header[8]); - if ((header[2] & 3) < 4) + /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ + if (!cd_media_cd_rom && (header[2] & 3) < 4) cd_media_state = media_status[header[2] & 3]; + if ((header[2] & 3) != 2) cd_media_session_next = header[10] << 8 | header[5]; cd_media_session_count = header[9] << 8 | header[4]; -- cgit v1.2.3-54-g00ecf From a29b30b4115db16035998c551117685d8152a496 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Thu, 28 May 2009 12:50:10 +0200 Subject: udev-selinux.c: remove libudev header Signed-off-by: Alan Jenkins --- udev/udev-selinux.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/udev/udev-selinux.c b/udev/udev-selinux.c index cd86870b18..4f1b2bb2d1 100644 --- a/udev/udev-selinux.c +++ b/udev/udev-selinux.c @@ -1,6 +1,4 @@ /* - * libudev - interface to udev device information - * * Copyright (C) 2008 Kay Sievers * * This program is free software: you can redistribute it and/or modify -- cgit v1.2.3-54-g00ecf From 542aeeb48ab002c6136885f99aa23870f8ffa25b Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Thu, 28 May 2009 17:59:06 +0100 Subject: udevd: queue-export - fix crash The math in skip_to() was the wrong way round and allocated a variable size array on the stack with a massively negative size. Signed-off-by: Alan Jenkins --- udev/lib/libudev-queue-export.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/lib/libudev-queue-export.c b/udev/lib/libudev-queue-export.c index ddb1974dbe..a36ff5150a 100644 --- a/udev/lib/libudev-queue-export.c +++ b/udev/lib/libudev-queue-export.c @@ -115,8 +115,8 @@ static int skip_to(FILE *file, long offset) /* fseek may drop buffered data, avoid it for small seeks */ old_offset = ftell(file); - if (offset > old_offset && old_offset - offset <= BUFSIZ) { - size_t skip_bytes = old_offset - offset; + if (offset > old_offset && offset - old_offset <= BUFSIZ) { + size_t skip_bytes = offset - old_offset; char buf[skip_bytes]; if (fread(buf, skip_bytes, 1, file) != skip_bytes) -- cgit v1.2.3-54-g00ecf From dc383337b3e8c9128ea9c771527a55aabfff7297 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 28 May 2009 19:21:35 +0200 Subject: udevadm: control - add comment to man page about --reload-rules --- udev/udevadm.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 1092498a46..5996c01383 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -278,7 +278,10 @@ - Signal udevd to reload the rules from the config. + Signal udevd to reload the rules files. + Usually the udev daemon detects changes automatically, this may + only be needed on systems without inotify support. Reloading rules + does not apply any changes to already existing devices. -- cgit v1.2.3-54-g00ecf From e91ac78ffc62a7a4f10fc66ed492e5b67a11448a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 May 2009 13:21:38 +0200 Subject: cdrom_id: add error message if open() fails --- extras/cdrom_id/cdrom_id.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 921e5346c9..2306d9ad71 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -570,6 +570,7 @@ int main(int argc, char *argv[]) fd = open(node, O_RDONLY | O_NONBLOCK); if (fd < 0) { info(udev, "unable to open '%s'\n", node); + fprintf(stderr, "unable to open '%s'\n", node); rc = 1; goto exit; } -- cgit v1.2.3-54-g00ecf From 97f48a8c67520bf1a58f1516ea3f5953ef399a96 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 May 2009 14:05:39 +0200 Subject: udevadm: settle - add --exit-if-exists= --- udev/udevadm-settle.c | 23 ++++++++++++++++++----- udev/udevadm.xml | 6 ++++++ 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 9059adc341..0b3f2e2124 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -54,6 +54,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) { "seq-start", required_argument, NULL, 's' }, { "seq-end", required_argument, NULL, 'e' }, { "timeout", required_argument, NULL, 't' }, + { "exit-if-exists", required_argument, NULL, 'E' }, { "quiet", no_argument, NULL, 'q' }, { "help", no_argument, NULL, 'h' }, {} @@ -61,6 +62,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) unsigned long long start = 0; unsigned long long end = 0; int quiet = 0; + const char *exists = NULL; int timeout = DEFAULT_TIMEOUT; struct sigaction act; struct udev_queue *udev_queue = NULL; @@ -80,7 +82,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) int option; int seconds; - option = getopt_long(argc, argv, "s:e:t:qh", options, NULL); + option = getopt_long(argc, argv, "s:e:t:E:qh", options, NULL); if (option == -1) break; @@ -102,12 +104,16 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) case 'q': quiet = 1; break; + case 'E': + exists = optarg; + break; case 'h': printf("Usage: udevadm settle OPTIONS\n" - " --timeout= maximum time to wait for events\n" - " --seq-start= first seqnum to wait for\n" - " --seq-end= last seqnum to wait for\n" - " --quiet do not print list after timeout\n" + " --timeout= maximum time to wait for events\n" + " --seq-start= first seqnum to wait for\n" + " --seq-end= last seqnum to wait for\n" + " --exit-if-exists= stop waiting if file exists\n" + " --quiet do not print list after timeout\n" " --help\n\n"); exit(0); } @@ -173,6 +179,13 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } while (1) { + struct stat statbuf; + + if (exists != NULL && stat(exists, &statbuf) == 0) { + rc = 0; + break; + } + if (start > 0) { /* if asked for, wait for a specific sequence of events */ if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) { diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 5996c01383..538180babe 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -236,6 +236,12 @@ Wait only for events before the given sequence number. + + + + Stop waiting if file exists. + + -- cgit v1.2.3-54-g00ecf From 82c785e5dcc4bd221da30d48ba427dd609d14f90 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 May 2009 18:54:03 +0200 Subject: udevd: remove check for dev_t, DEVPATH_OLD takes care of that --- udev/udevd.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 5ee61d2e23..37b547ad65 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -301,18 +301,6 @@ static int devpath_busy(struct udev_event *event) event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev); return 4; } - - /* check for our major:minor number */ - if (major(udev_device_get_devnum(event->dev)) > 0 && - udev_device_get_devnum(loop_event->dev) == udev_device_get_devnum(event->dev) && - strcmp(udev_device_get_subsystem(event->dev), udev_device_get_subsystem(loop_event->dev)) == 0) { - dbg(event->udev, "%llu, device event still pending %llu (%d:%d)\n", - udev_device_get_seqnum(event->dev), - udev_device_get_seqnum(loop_event->dev), - major(udev_device_get_devnum(loop_event->dev)), minor(udev_device_get_devnum(loop_event->dev))); - event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev); - return 5; - } } return 0; } -- cgit v1.2.3-54-g00ecf From b61f48a0e8a4ad264bc0e904ea8bf3b054d5f562 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 1 Jun 2009 21:10:29 +0200 Subject: str[sp]cpyl: add __attribute__ ((sentinel)) --- udev/lib/libudev-private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index 3eb3d7957f..dc02a842b8 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -176,9 +176,9 @@ size_t util_path_encode(const char *src, char *dest, size_t size); size_t util_path_decode(char *s); void util_remove_trailing_chars(char *path, char c); size_t util_strpcpy(char **dest, size_t size, const char *src); -size_t util_strpcpyl(char **dest, size_t size, const char *src, ...); +size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__ ((sentinel)); size_t util_strscpy(char *dest, size_t size, const char *src); -size_t util_strscpyl(char *dest, size_t size, const char *src, ...); +size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__ ((sentinel)); int udev_util_replace_whitespace(const char *str, char *to, size_t len); int udev_util_replace_chars(char *str, const char *white); int udev_util_encode_string(const char *str, char *str_enc, size_t len); -- cgit v1.2.3-54-g00ecf From 1e03b754aef576a5cb75f01b1805cdc1f9cc292f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Jun 2009 01:44:04 +0200 Subject: udevd: convert to event worker processes Event processes now get re-used after they handled an event. This reduces pressure on the CPU significantly because cloned event processes no longer cause page faults in the main daemon. After the events have settled, the no longer needed worker processes get killed. --- NEWS | 12 +- README | 25 +- TODO | 1 + configure.ac | 5 +- udev/Makefile.am | 1 - udev/lib/libudev-monitor.c | 74 +++- udev/lib/libudev-private.h | 5 +- udev/udev-event.c | 7 +- udev/udev-sysdeps.h | 44 --- udev/udev-watch.c | 9 +- udev/udev.h | 10 +- udev/udevadm.xml | 6 +- udev/udevd.c | 830 +++++++++++++++++++++++++++------------------ 13 files changed, 588 insertions(+), 441 deletions(-) delete mode 100644 udev/udev-sysdeps.h diff --git a/NEWS b/NEWS index ac44d7a77d..8b51c10a84 100644 --- a/NEWS +++ b/NEWS @@ -2,9 +2,17 @@ udev 143 ======== Bugfixes. +Event processes now get re-used after they handled an event. This reduces +pressure on the CPU significantly because cloned event processes no longer +cause page faults in the main daemon. After the events have settled, the +no longer needed worker processes get killed. + +To be able to use signalfd(), udev depends on kernel version 2.6.25 now. +Also inotify support is required now to run udev. + The format of the queue exported by the udev damon has changed. There is -no longer a /dev/.udev/queue/ directory. The queue can be accessed with -udevadm settle and libudedv. +no longer a /dev/.udev/queue/ directory. The current event queue can be +accessed with udevadm settle and libudedv. udev 142 ======== diff --git a/README b/README index 773bc5508d..a14e5c0fcf 100644 --- a/README +++ b/README @@ -9,11 +9,13 @@ Important Note: recommend to replace a distro's udev installation with the upstream version. Requirements: - - Version 2.6.22 of the Linux kernel for reliable operation of this release of - udev. The kernel must not use the CONFIG_SYSFS_DEPRECATED* option. + - Version 2.6.25 of the Linux kernel with sysfs, procfs, signalfd, inotify, + unix domain sockets, networking and hotplug enabled. - - The kernel must have sysfs, unix domain sockets and networking enabled. - Unix domain sockets (CONFIG_UNIX) as a loadable kernel module is not + - For reliable operation, the kernel must not use the CONFIG_SYSFS_DEPRECATED* + option. + + - Unix domain sockets (CONFIG_UNIX) as a loadable kernel module is not supported. - The proc filesystem must be mounted on /proc/, the sysfs filesystem must @@ -29,21 +31,18 @@ Operation: Udev creates and removes device nodes in /dev/, based on events the kernel sends out on device discovery or removal. - - Very early in the boot process, the /dev/ directory should get a 'tmpfs' - filesystem mounted, which is populated from scratch by udev. Created nodes - or changed permissions will not survive a reboot, which is intentional. + - Early in the boot process, the /dev/ directory should get a 'tmpfs' + filesystem mounted, which is maintained by udev. Created nodes or changed + permissions will not survive a reboot, which is intentional. - The content of /lib/udev/devices/ directory which contains the nodes, symlinks and directories, which are always expected to be in /dev, should be copied over to the tmpfs mounted /dev, to provide the required nodes to initialize udev and continue booting. - - The old hotplug helper /sbin/hotplug should be disabled on bootup, before - actions like loading kernel modules are taken, which may cause a lot of - events. - - - The udevd daemon must be started on bootup to receive netlink uevents - from the kernel driver core. + - The old hotplug helper /sbin/hotplug should be disabled in the kernel + configuration, it is not needed, and may render the system unusable + because of a fork-bombing behavior. - All kernel events are matched against a set of specified rules in /lib/udev/rules.d/ which make it possible to hook into the event diff --git a/TODO b/TODO index 5b6af64e46..bedccdb635 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ + o add tests for kernel provided DEVNAME logic o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) o remove MMC rules, they got a modalias now (2.6.30) diff --git a/configure.ac b/configure.ac index f1d008e000..9857d52e4e 100644 --- a/configure.ac +++ b/configure.ac @@ -5,6 +5,7 @@ AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) AC_DISABLE_STATIC AC_USE_SYSTEM_EXTENSIONS +dnl AM_SILENT_RULES AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) AC_PROG_LIBTOOL @@ -23,10 +24,6 @@ AC_SUBST(LIBUDEV_LT_AGE) AC_PATH_PROG([XSLTPROC], [xsltproc]) -AC_CHECK_LIB(c, inotify_init, - [AC_DEFINE([HAVE_INOTIFY], 1, [inotify available])], - [AC_MSG_WARN([inotify support disabled])]) - AC_ARG_WITH(udev-prefix, AS_HELP_STRING([--with-udev-prefix=DIR], [add prefix to internal udev path names]), [], [with_udev_prefix='${exec_prefix}']) diff --git a/udev/Makefile.am b/udev/Makefile.am index 6cd2f23dc3..94989e64bf 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -14,7 +14,6 @@ common_ldadd = common_files = \ udev.h \ - udev-sysdeps.h \ udev-event.c \ udev-watch.c \ udev-node.c \ diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 395a4d27e1..33a0605492 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -32,15 +32,17 @@ struct udev_monitor { int refcount; int sock; struct sockaddr_nl snl; - struct sockaddr_nl snl_peer; + struct sockaddr_nl snl_trusted_sender; + struct sockaddr_nl snl_destination; struct sockaddr_un sun; socklen_t addrlen; struct udev_list_node filter_subsystem_list; }; enum udev_monitor_netlink_group { - UDEV_MONITOR_KERNEL = 1, - UDEV_MONITOR_UDEV = 2, + UDEV_MONITOR_NONE, + UDEV_MONITOR_KERNEL, + UDEV_MONITOR_UDEV, }; #define UDEV_MONITOR_MAGIC 0xcafe1dea @@ -171,11 +173,11 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char return NULL; if (name == NULL) - return NULL; - if (strcmp(name, "kernel") == 0) - group = UDEV_MONITOR_KERNEL; + group = UDEV_MONITOR_NONE; else if (strcmp(name, "udev") == 0) group = UDEV_MONITOR_UDEV; + else if (strcmp(name, "kernel") == 0) + group = UDEV_MONITOR_KERNEL; else return NULL; @@ -193,8 +195,10 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char udev_monitor->snl.nl_family = AF_NETLINK; udev_monitor->snl.nl_groups = group; - udev_monitor->snl_peer.nl_family = AF_NETLINK; - udev_monitor->snl_peer.nl_groups = UDEV_MONITOR_UDEV; + + /* default destination for sending */ + udev_monitor->snl_destination.nl_family = AF_NETLINK; + udev_monitor->snl_destination.nl_groups = UDEV_MONITOR_UDEV; dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT (%u)\n", udev_monitor, group); return udev_monitor; @@ -281,6 +285,12 @@ int udev_monitor_filter_update(struct udev_monitor *udev_monitor) return err; } +int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender) +{ + udev_monitor->snl_trusted_sender.nl_pid = sender->snl.nl_pid; + return 0; +} + int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) { int err; @@ -293,6 +303,19 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) udev_monitor_filter_update(udev_monitor); err = bind(udev_monitor->sock, (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); + if (err == 0) { + struct sockaddr_nl snl; + socklen_t addrlen; + + /* + * get the address the kernel has assigned us + * it is usually, but not neccessarily the pid + */ + addrlen = sizeof(struct sockaddr_nl); + err = getsockname(udev_monitor->sock, (struct sockaddr *)&snl, &addrlen); + if (err == 0) + udev_monitor->snl.nl_pid = snl.nl_pid; + } } else { return -EINVAL; } @@ -314,6 +337,15 @@ int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size)); } +int udev_monitor_disconnect(struct udev_monitor *udev_monitor) +{ + int err; + + err = close(udev_monitor->sock); + udev_monitor->sock = -1; + return err; +} + /** * udev_monitor_ref: * @udev_monitor: udev monitor @@ -478,10 +510,13 @@ retry: if (udev_monitor->snl.nl_family != 0) { if (snl.nl_groups == 0) { - info(udev_monitor->udev, "unicast netlink message ignored\n"); - return NULL; - } - if (snl.nl_groups == UDEV_MONITOR_KERNEL) { + /* unicast message, check if we trust the sender */ + if (udev_monitor->snl_trusted_sender.nl_pid == 0 || + snl.nl_pid != udev_monitor->snl_trusted_sender.nl_pid) { + info(udev_monitor->udev, "unicast netlink message ignored\n"); + return NULL; + } + } else if (snl.nl_groups == UDEV_MONITOR_KERNEL) { if (snl.nl_pid > 0) { info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", snl.nl_pid); return NULL; @@ -621,7 +656,8 @@ retry: return udev_device; } -int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device) +int udev_monitor_send_device(struct udev_monitor *udev_monitor, + struct udev_monitor *destination, struct udev_device *udev_device) { struct msghdr smsg; struct iovec iov[2]; @@ -683,8 +719,16 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_devi memset(&smsg, 0x00, sizeof(struct msghdr)); smsg.msg_iov = iov; smsg.msg_iovlen = 2; - /* no destination besides the muticast group, we will always get ECONNREFUSED */ - smsg.msg_name = &udev_monitor->snl_peer; + /* + * Use custom address for target, or the default one. + * + * If we send to a muticast group, we will get + * ECONNREFUSED, which is expected. + */ + if (destination != NULL) + smsg.msg_name = &destination->snl; + else + smsg.msg_name = &udev_monitor->snl_destination; smsg.msg_namelen = sizeof(struct sockaddr_nl); } else { return -1; diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h index dc02a842b8..5512341e9e 100644 --- a/udev/lib/libudev-private.h +++ b/udev/lib/libudev-private.h @@ -86,7 +86,10 @@ int udev_device_delete_db(struct udev_device *udev_device); int udev_device_rename_db(struct udev_device *udev_device, const char *devpath); /* libudev-monitor - netlink/unix socket communication */ -int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_device *udev_device); +int udev_monitor_disconnect(struct udev_monitor *udev_monitor); +int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); +int udev_monitor_send_device(struct udev_monitor *udev_monitor, + struct udev_monitor *destination, struct udev_device *udev_device); int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); /* libudev-ctrl - daemon runtime setup */ diff --git a/udev/udev-event.c b/udev/udev-event.c index d52125193c..3f69c0bb7a 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -734,18 +734,13 @@ int udev_event_execute_run(struct udev_event *event) monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); if (monitor == NULL) continue; - udev_monitor_send_device(monitor, event->dev); + udev_monitor_send_device(monitor, NULL, event->dev); udev_monitor_unref(monitor); } else { char program[UTIL_PATH_SIZE]; char **envp; udev_event_apply_format(event, cmd, program, sizeof(program)); - if (event->trace) - fprintf(stderr, "run %s (%llu) '%s'\n", - udev_device_get_syspath(event->dev), - udev_device_get_seqnum(event->dev), - program); envp = udev_device_get_properties_envp(event->dev); if (util_run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { if (!udev_list_entry_get_flag(list_entry)) diff --git a/udev/udev-sysdeps.h b/udev/udev-sysdeps.h deleted file mode 100644 index 35671baca1..0000000000 --- a/udev/udev-sysdeps.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * wrapping of libc features and kernel interfaces - * - * Copyright (C) 2005-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _UDEV_SYSDEPS_H_ -#define _UDEV_SYSDEPS_H_ - -#include -#include - -#ifndef HAVE_INOTIFY -static inline int inotify_init(void) -{ - errno = ENOSYS; - return -1; -} - -static inline int inotify_add_watch(int fd, const char *name, uint32_t mask) -{ - return -1; -} - -#define IN_CREATE 0 -#define IN_DELETE 0 -#define IN_MOVE 0 -#define IN_CLOSE_WRITE 0 - -#endif /* HAVE_INOTIFY */ -#endif diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 53492e5f35..5a49c963da 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -26,27 +26,24 @@ #include #include #include -#ifdef HAVE_INOTIFY #include -#endif #include "udev.h" -int inotify_fd = -1; +static int inotify_fd = -1; /* inotify descriptor, will be shared with rules directory; * set to cloexec since we need our children to be able to add * watches for us */ -void udev_watch_init(struct udev *udev) +int udev_watch_init(struct udev *udev) { inotify_fd = inotify_init(); if (inotify_fd >= 0) util_set_fd_cloexec(inotify_fd); - else if (errno == ENOSYS) - info(udev, "unable to use inotify, udevd will not monitor rule files changes\n"); else err(udev, "inotify_init failed: %m\n"); + return inotify_fd; } /* move any old watches directory out of the way, and then restore diff --git a/udev/udev.h b/udev/udev.h index 8f2c1c63dd..7187975390 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -22,7 +22,6 @@ #include #include -#include "udev-sysdeps.h" #include "lib/libudev.h" #include "lib/libudev-private.h" @@ -53,7 +52,6 @@ static inline void logging_close(void) } struct udev_event { - struct udev_list_node node; struct udev *udev; struct udev_device *dev; struct udev_device *dev_parent; @@ -64,10 +62,6 @@ struct udev_event { uid_t uid; gid_t gid; struct udev_list_node run_list; - pid_t pid; - int exitstatus; - time_t queue_time; - unsigned long long int delaying_seqnum; unsigned int group_final:1; unsigned int owner_final:1; unsigned int mode_final:1; @@ -76,7 +70,6 @@ struct udev_event { unsigned int run_final:1; unsigned int ignore_device:1; unsigned int inotify_watch:1; - unsigned int trace:1; }; struct udev_watch { @@ -101,8 +94,7 @@ int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, char *result, size_t maxsize, int read_value); /* udev-watch.c */ -extern int inotify_fd; -void udev_watch_init(struct udev *udev); +int udev_watch_init(struct udev *udev); void udev_watch_restore(struct udev *udev); void udev_watch_begin(struct udev *udev, struct udev_device *dev); void udev_watch_end(struct udev *udev, struct udev_device *dev); diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 538180babe..2e03d9886e 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -285,9 +285,9 @@ Signal udevd to reload the rules files. - Usually the udev daemon detects changes automatically, this may - only be needed on systems without inotify support. Reloading rules - does not apply any changes to already existing devices. + The udev daemon detects changes automatically, this option is + usually not needed. Reloading rules does not apply any changes + to already existing devices. diff --git a/udev/udevd.c b/udev/udevd.c index 37b547ad65..c0852022e2 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Kay Sievers + * Copyright (C) 2004-2009 Kay Sievers * Copyright (C) 2004 Chris Friesen * Copyright (C) 2009 Canonical Ltd. * Copyright (C) 2009 Scott James Remnant @@ -30,23 +30,21 @@ #include #include #include +#include +#include +#include #include #include #include #include #include -#ifdef HAVE_INOTIFY #include -#endif #include "udev.h" #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 -/* maximum limit of forked childs */ -#define UDEVD_MAX_CHILDS 256 - static int debug; static void log_fn(struct udev *udev, int priority, @@ -61,84 +59,159 @@ static void log_fn(struct udev *udev, int priority, } } -static void reap_sigchilds(void); - static int debug_trace; static struct udev_rules *rules; static struct udev_queue_export *udev_queue_export; static struct udev_ctrl *udev_ctrl; -static struct udev_monitor *kernel_monitor; -static volatile sig_atomic_t sigchilds_waiting; -static volatile sig_atomic_t udev_exit; -static volatile sig_atomic_t reload_config; -static volatile sig_atomic_t signal_received; -static volatile pid_t settle_pid; -static int run_exec_q; -static int stop_exec_q; +static struct udev_monitor *monitor; +static int worker_watch[2]; +static pid_t settle_pid; +static int stop_exec_queue; +static int reload_config; static int max_childs; static int childs; static struct udev_list_node event_list; - -static struct udev_event *node_to_event(struct udev_list_node *node) +static struct udev_list_node worker_list; +static int udev_exit; +static volatile sig_atomic_t worker_exit; + +enum poll_fd { + FD_CONTROL, + FD_NETLINK, + FD_INOTIFY, + FD_SIGNAL, + FD_WORKER, +}; + +static struct pollfd pfd[] = { + [FD_NETLINK] = { .events = POLLIN }, + [FD_WORKER] = { .events = POLLIN }, + [FD_SIGNAL] = { .events = POLLIN }, + [FD_INOTIFY] = { .events = POLLIN }, + [FD_CONTROL] = { .events = POLLIN }, +}; + +enum event_state { + EVENT_UNDEF, + EVENT_QUEUED, + EVENT_RUNNING, +}; + +struct event { + struct udev_list_node node; + struct udev *udev; + struct udev_device *dev; + enum event_state state; + int exitcode; + unsigned long long int delaying_seqnum; + unsigned long long int seqnum; + const char *devpath; + size_t devpath_len; + const char *devpath_old; +}; + +static struct event *node_to_event(struct udev_list_node *node) { char *event; event = (char *)node; - event -= offsetof(struct udev_event, node); - return (struct udev_event *)event; + event -= offsetof(struct event, node); + return (struct event *)event; +} + +enum worker_state { + WORKER_UNDEF, + WORKER_RUNNING, + WORKER_IDLE, + WORKER_KILLED, +}; + +struct worker { + struct udev_list_node node; + pid_t pid; + struct udev_monitor *monitor; + enum worker_state state; + struct event *event; +}; + +/* passed from worker to main process */ +struct worker_message { + pid_t pid; + int exitcode; +}; + +static struct worker *node_to_worker(struct udev_list_node *node) +{ + char *worker; + + worker = (char *)node; + worker -= offsetof(struct worker, node); + return (struct worker *)worker; } -static void event_queue_delete(struct udev_event *event) +static void event_queue_delete(struct event *event) { udev_list_node_remove(&event->node); /* mark as failed, if "add" event returns non-zero */ - if (event->exitstatus && strcmp(udev_device_get_action(event->dev), "add") == 0) + if (event->exitcode && strcmp(udev_device_get_action(event->dev), "add") == 0) udev_queue_export_device_failed(udev_queue_export, event->dev); else udev_queue_export_device_finished(udev_queue_export, event->dev); udev_device_unref(event->dev); - udev_event_unref(event); + free(event); } static void event_sig_handler(int signum) { - if (signum == SIGALRM) + switch (signum) { + case SIGALRM: _exit(1); + break; + case SIGTERM: + worker_exit = 1; + break; + } +} + +static void worker_unref(struct worker *worker) +{ + udev_monitor_unref(worker->monitor); + free(worker); } -static void event_fork(struct udev_event *event) +static void worker_new(struct event *event) { + struct worker *worker; + struct udev_monitor *worker_monitor; pid_t pid; struct sigaction act; - int err; - -#if 0 - /* single process, no forking, just for testing/profiling */ - err = udev_event_execute_rules(event, rules); - if (err == 0 && !event->ignore_device && udev_get_run(event->udev)) - udev_event_execute_run(event); - info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err); - event_queue_delete(event); - return; -#endif - if (debug_trace) { - event->trace = 1; - fprintf(stderr, "fork %s (%llu)\n", - udev_device_get_syspath(event->dev), - udev_device_get_seqnum(event->dev)); - } + /* listen for new events */ + worker_monitor = udev_monitor_new_from_netlink(event->udev, NULL); + if (worker_monitor == NULL) + return; + /* allow the main daemon netlink address to send devices to the worker */ + udev_monitor_allow_unicast_sender(worker_monitor, monitor); + udev_monitor_enable_receiving(worker_monitor); + + worker = calloc(1, sizeof(struct worker)); + if (worker == NULL) + return; pid = fork(); switch (pid) { - case 0: - /* child */ + case 0: { + sigset_t mask; + struct udev_device *dev; + udev_queue_export_unref(udev_queue_export); udev_ctrl_unref(udev_ctrl); + close(pfd[FD_SIGNAL].fd); + close(worker_watch[READ_END]); logging_close(); - logging_init("udevd-event"); + logging_init("udevd-work"); setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); /* set signal handlers */ @@ -146,78 +219,182 @@ static void event_fork(struct udev_event *event) act.sa_handler = event_sig_handler; sigemptyset (&act.sa_mask); act.sa_flags = 0; + sigaction(SIGTERM, &act, NULL); sigaction(SIGALRM, &act, NULL); - /* reset to default */ - act.sa_handler = SIG_DFL; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigaction(SIGCHLD, &act, NULL); - sigaction(SIGHUP, &act, NULL); + /* unblock signals */ + sigfillset(&mask); + sigdelset(&mask, SIGTERM); + sigdelset(&mask, SIGALRM); + sigprocmask(SIG_SETMASK, &mask, NULL); - /* set timeout to prevent hanging processes */ - alarm(UDEV_EVENT_TIMEOUT); + /* request TERM signal if parent exits */ + prctl(PR_SET_PDEATHSIG, SIGTERM); - /* apply rules, create node, symlinks */ - err = udev_event_execute_rules(event, rules); + /* initial device */ + dev = event->dev; - /* rules may change/disable the timeout */ - if (udev_device_get_event_timeout(event->dev) >= 0) - alarm(udev_device_get_event_timeout(event->dev)); + while (!worker_exit) { + struct udev_event *udev_event; + struct worker_message msg; + int err; - /* execute RUN= */ - if (err == 0 && !event->ignore_device && udev_get_run(event->udev)) - udev_event_execute_run(event); + udev_event = udev_event_new(dev); + if (udev_event == NULL) + _exit(3); - /* apply/restore inotify watch */ - if (err == 0 && event->inotify_watch) { - udev_watch_begin(event->udev, event->dev); - udev_device_update_db(event->dev); - } + /* set timeout to prevent hanging processes */ + alarm(UDEV_EVENT_TIMEOUT); + + /* apply rules, create node, symlinks */ + err = udev_event_execute_rules(udev_event, rules); + + /* rules may change/disable the timeout */ + if (udev_device_get_event_timeout(dev) >= 0) + alarm(udev_device_get_event_timeout(dev)); + + /* execute RUN= */ + if (err == 0 && !udev_event->ignore_device && udev_get_run(udev_event->udev)) + udev_event_execute_run(udev_event); + + /* reset alarm */ + alarm(0); + + /* apply/restore inotify watch */ + if (err == 0 && udev_event->inotify_watch) { + udev_watch_begin(udev_event->udev, dev); + udev_device_update_db(dev); + } - /* send processed event back to the kernel netlink socket */ - udev_monitor_send_device(kernel_monitor, event->dev); + /* send processed event back to libudev listeners */ + udev_monitor_send_device(worker_monitor, NULL, dev); - info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err); + info(event->udev, "seq %llu finished with %i\n", udev_device_get_seqnum(dev), err); + udev_device_unref(dev); + udev_event_unref(udev_event); + + /* send back the result of the event execution */ + msg.exitcode = err; + msg.pid = getpid(); + send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); + + /* wait for more device messages from udevd */ + do + dev = udev_monitor_receive_device(worker_monitor); + while (!worker_exit && dev == NULL); + } + + udev_monitor_unref(worker_monitor); logging_close(); - if (err != 0) - exit(1); exit(0); + } case -1: + udev_monitor_unref(worker_monitor); + event->state = EVENT_QUEUED; + free(worker); err(event->udev, "fork of child failed: %m\n"); - event_queue_delete(event); break; default: - /* get SIGCHLD in main loop */ - info(event->udev, "seq %llu forked, pid [%d], '%s' '%s', %ld seconds old\n", - udev_device_get_seqnum(event->dev), - pid, - udev_device_get_action(event->dev), - udev_device_get_subsystem(event->dev), - time(NULL) - event->queue_time); - event->pid = pid; + /* close monitor, but keep address around */ + udev_monitor_disconnect(worker_monitor); + worker->monitor = worker_monitor; + worker->pid = pid; + worker->state = WORKER_RUNNING; + worker->event = event; + event->state = EVENT_RUNNING; + udev_list_node_append(&worker->node, &worker_list); childs++; + break; } } -static void event_queue_insert(struct udev_event *event) +static void event_run(struct event *event) { - event->queue_time = time(NULL); + struct udev_list_node *loop; + + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); + ssize_t count; - udev_queue_export_device_queued(udev_queue_export, event->dev); - info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(event->dev), - udev_device_get_action(event->dev), udev_device_get_subsystem(event->dev)); + if (worker->state != WORKER_IDLE) + continue; + worker->event = event; + worker->state = WORKER_RUNNING; + event->state = EVENT_RUNNING; + count = udev_monitor_send_device(monitor, worker->monitor, event->dev); + if (count < 0) { + err(event->udev, "worker [%u] did not accept message, kill it\n", worker->pid); + event->state = EVENT_QUEUED; + worker->state = WORKER_KILLED; + kill(worker->pid, SIGKILL); + continue; + } + return; + } + + if (childs >= max_childs) { + info(event->udev, "maximum number (%i) of childs reached\n", childs); + return; + } + + /* start new worker and pass initial device */ + worker_new(event); +} + +static void event_queue_insert(struct udev_device *dev) +{ + struct event *event; + + event = calloc(1, sizeof(struct event)); + if (event == NULL) + return; + + event->udev = udev_device_get_udev(dev); + event->dev = dev; + event->seqnum = udev_device_get_seqnum(dev); + event->devpath = udev_device_get_devpath(dev); + event->devpath_len = strlen(event->devpath); + event->devpath_old = udev_device_get_devpath_old(dev); + + udev_queue_export_device_queued(udev_queue_export, dev); + info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev), + udev_device_get_action(dev), udev_device_get_subsystem(dev)); + + event->state = EVENT_QUEUED; udev_list_node_append(&event->node, &event_list); - run_exec_q = 1; /* run all events with a timeout set immediately */ - if (udev_device_get_timeout(event->dev) > 0) { - event_fork(event); + if (udev_device_get_timeout(dev) > 0) { + worker_new(event); return; } } +static void worker_kill(int retain) +{ + struct udev_list_node *loop; + int max; + + if (childs <= retain) + return; + + max = childs - retain; + + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); + + if (max-- <= 0) + break; + + if (worker->state == WORKER_KILLED) + continue; + + worker->state = WORKER_KILLED; + kill(worker->pid, SIGTERM); + } +} + static int mem_size_mb(void) { FILE *f; @@ -241,112 +418,111 @@ static int mem_size_mb(void) return memsize; } -static int compare_devpath(const char *running, const char *waiting) -{ - int i = 0; - - while (running[i] != '\0' && running[i] == waiting[i]) - i++; - - /* identical device event found */ - if (running[i] == '\0' && waiting[i] == '\0') - return 1; - - /* parent device event found */ - if (running[i] == '\0' && waiting[i] == '/') - return 2; - - /* child device event found */ - if (running[i] == '/' && waiting[i] == '\0') - return 3; - - /* no matching event */ - return 0; -} - /* lookup event for identical, parent, child device */ -static int devpath_busy(struct udev_event *event) +static int devpath_busy(struct event *event) { struct udev_list_node *loop; + size_t common; /* check if queue contains events we depend on */ udev_list_node_foreach(loop, &event_list) { - struct udev_event *loop_event = node_to_event(loop); + struct event *loop_event = node_to_event(loop); /* we already found a later event, earlier can not block us, no need to check again */ - if (udev_device_get_seqnum(loop_event->dev) < event->delaying_seqnum) + if (loop_event->seqnum < event->delaying_seqnum) continue; /* event we checked earlier still exists, no need to check again */ - if (udev_device_get_seqnum(loop_event->dev) == event->delaying_seqnum) + if (loop_event->seqnum == event->delaying_seqnum) return 2; /* found ourself, no later event can block us */ - if (udev_device_get_seqnum(loop_event->dev) >= udev_device_get_seqnum(event->dev)) + if (loop_event->seqnum >= event->seqnum) break; /* check our old name */ - if (udev_device_get_devpath_old(event->dev) != NULL) - if (strcmp(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath_old(event->dev)) == 0) { - event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev); + if (event->devpath_old != NULL) + if (strcmp(loop_event->devpath, event->devpath_old) == 0) { + event->delaying_seqnum = loop_event->seqnum; return 3; } - /* check identical, parent, or child device event */ - if (compare_devpath(udev_device_get_devpath(loop_event->dev), udev_device_get_devpath(event->dev)) != 0) { - dbg(event->udev, "%llu, device event still pending %llu (%s)\n", - udev_device_get_seqnum(event->dev), - udev_device_get_seqnum(loop_event->dev), - udev_device_get_devpath(loop_event->dev)); - event->delaying_seqnum = udev_device_get_seqnum(loop_event->dev); + /* compare devpath */ + common = MIN(loop_event->devpath_len, event->devpath_len); + + /* one devpath is contained in the other? */ + if (memcmp(loop_event->devpath, event->devpath, common) != 0) + continue; + + /* identical device event found */ + if (loop_event->devpath_len == event->devpath_len) { + event->delaying_seqnum = loop_event->seqnum; return 4; } + + /* parent device event found */ + if (event->devpath[common] == '/') { + event->delaying_seqnum = loop_event->seqnum; + return 5; + } + + /* child device event found */ + if (loop_event->devpath[common] == '/') { + event->delaying_seqnum = loop_event->seqnum; + return 6; + } + + /* no matching device */ + continue; } + return 0; } -/* serializes events for the identical and parent and child devices */ -static void event_queue_manager(struct udev *udev) +static void events_start(struct udev *udev) { struct udev_list_node *loop; - struct udev_list_node *tmp; - -start_over: - if (udev_list_is_empty(&event_list)) { - if (childs > 0) { - err(udev, "event list empty, but childs count is %i", childs); - childs = 0; - } - return; - } - udev_list_node_foreach_safe(loop, tmp, &event_list) { - struct udev_event *loop_event = node_to_event(loop); - - if (childs >= max_childs) { - info(udev, "maximum number (%i) of childs reached\n", childs); - break; - } + udev_list_node_foreach(loop, &event_list) { + struct event *event = node_to_event(loop); - if (loop_event->pid != 0) + if (event->state != EVENT_QUEUED) continue; /* do not start event if parent or child event is still running */ - if (devpath_busy(loop_event) != 0) { - dbg(udev, "delay seq %llu (%s)\n", - udev_device_get_seqnum(loop_event->dev), - udev_device_get_devpath(loop_event->dev)); + if (devpath_busy(event) != 0) { + dbg(udev, "delay seq %llu (%s)\n", event->seqnum, event->devpath); continue; } - event_fork(loop_event); - dbg(udev, "moved seq %llu to running list\n", udev_device_get_seqnum(loop_event->dev)); + event_run(event); + } +} + +static void worker_returned(void) +{ + while (1) { + struct worker_message msg; + ssize_t size; + struct udev_list_node *loop; + + size = recv(pfd[FD_WORKER].fd, &msg, sizeof(struct worker_message), MSG_DONTWAIT); + if (size != sizeof(struct worker_message)) + break; + + /* lookup worker who sent the signal */ + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); - /* retry if events finished in the meantime */ - if (sigchilds_waiting) { - sigchilds_waiting = 0; - reap_sigchilds(); - goto start_over; + if (worker->pid != msg.pid) + continue; + + /* worker returned */ + worker->event->exitcode = msg.exitcode; + event_queue_delete(worker->event); + worker->event = NULL; + worker->state = WORKER_IDLE; + break; } } } @@ -367,17 +543,17 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) if (i >= 0) { info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", i); udev_set_log_priority(udev, i); + worker_kill(0); } if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) { info(udev, "udevd message (STOP_EXEC_QUEUE) received\n"); - stop_exec_q = 1; + stop_exec_queue = 1; } if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) { info(udev, "udevd message (START_EXEC_QUEUE) received\n"); - stop_exec_q = 0; - event_queue_manager(udev); + stop_exec_queue = 0; } if (udev_ctrl_get_reload_rules(ctrl_msg) > 0) { @@ -409,6 +585,7 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) } free(key); } + worker_kill(0); } i = udev_ctrl_get_set_max_childs(ctrl_msg); @@ -420,6 +597,8 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) settle_pid = udev_ctrl_get_settle(ctrl_msg); if (settle_pid > 0) { info(udev, "udevd message (SETTLE) received\n"); + kill(settle_pid, SIGUSR1); + settle_pid = 0; } udev_ctrl_msg_unref(ctrl_msg); } @@ -427,22 +606,20 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) /* read inotify messages */ static int handle_inotify(struct udev *udev) { - int nbytes, pos; + ssize_t nbytes, pos; char *buf; struct inotify_event *ev; - if ((ioctl(inotify_fd, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) + if ((ioctl(pfd[FD_INOTIFY].fd, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) return 0; buf = malloc(nbytes); if (buf == NULL) { err(udev, "error getting buffer for inotify, disable watching\n"); - close(inotify_fd); - inotify_fd = -1; - return 0; + return -1; } - read(inotify_fd, buf, nbytes); + nbytes = read(pfd[FD_INOTIFY].fd, buf, nbytes); for (pos = 0; pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) { struct udev_device *dev; @@ -476,72 +653,48 @@ static int handle_inotify(struct udev *udev) } - free (buf); + free(buf); return 0; } -static void sig_handler(int signum) +static void handle_signal(int signo) { - switch (signum) { - case SIGINT: - case SIGTERM: - udev_exit = 1; - break; - case SIGCHLD: - /* set flag, then write to pipe if needed */ - sigchilds_waiting = 1; - break; - case SIGHUP: - reload_config = 1; - break; - } + switch (signo) { + case SIGINT: + case SIGTERM: + udev_exit = 1; + break; + case SIGCHLD: + while (1) { + pid_t pid; + struct udev_list_node *loop, *tmp; - signal_received = 1; -} + pid = waitpid(-1, NULL, WNOHANG); + if (pid <= 0) + break; -static void udev_done(int pid, int exitstatus) -{ - struct udev_list_node *loop; + udev_list_node_foreach_safe(loop, tmp, &worker_list) { + struct worker *worker = node_to_worker(loop); - /* find event associated with pid and delete it */ - udev_list_node_foreach(loop, &event_list) { - struct udev_event *loop_event = node_to_event(loop); - - if (loop_event->pid == pid) { - info(loop_event->udev, "seq %llu cleanup, pid [%d], status %i, %ld seconds old\n", - udev_device_get_seqnum(loop_event->dev), loop_event->pid, - exitstatus, time(NULL) - loop_event->queue_time); - loop_event->exitstatus = exitstatus; - if (debug_trace) - fprintf(stderr, "exit %s (%llu)\n", - udev_device_get_syspath(loop_event->dev), - udev_device_get_seqnum(loop_event->dev)); - event_queue_delete(loop_event); - childs--; - - /* there may be dependent events waiting */ - run_exec_q = 1; - return; - } - } -} + if (worker->pid != pid) + continue; -static void reap_sigchilds(void) -{ - pid_t pid; - int status; + /* fail event, if worker died unexpectedly */ + if (worker->event != NULL) { + worker->event->exitcode = 127; + event_queue_delete(worker->event); + } - while (1) { - pid = waitpid(-1, &status, WNOHANG); - if (pid <= 0) - break; - if (WIFEXITED(status)) - status = WEXITSTATUS(status); - else if (WIFSIGNALED(status)) - status = WTERMSIG(status) + 128; - else - status = 0; - udev_done(pid, status); + udev_list_node_remove(&worker->node); + worker_unref(worker); + childs--; + break; + } + } + break; + case SIGHUP: + reload_config = 1; + break; } } @@ -576,7 +729,7 @@ int main(int argc, char *argv[]) { struct udev *udev; int fd; - struct sigaction act; + sigset_t mask; const char *value; int daemonize = 0; int resolve_names = 1; @@ -669,29 +822,76 @@ int main(int argc, char *argv[]) rc = 1; goto exit; } - if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { fprintf(stderr, "error binding control socket, seems udevd is already running\n"); err(udev, "error binding control socket, seems udevd is already running\n"); rc = 1; goto exit; } + pfd[FD_CONTROL].fd = udev_ctrl_get_fd(udev_ctrl); - kernel_monitor = udev_monitor_new_from_netlink(udev, "kernel"); - if (kernel_monitor == NULL || udev_monitor_enable_receiving(kernel_monitor) < 0) { + monitor = udev_monitor_new_from_netlink(udev, "kernel"); + if (monitor == NULL || udev_monitor_enable_receiving(monitor) < 0) { fprintf(stderr, "error initializing netlink socket\n"); err(udev, "error initializing netlink socket\n"); rc = 3; goto exit; } - udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); + udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); + pfd[FD_NETLINK].fd = udev_monitor_get_fd(monitor); + + pfd[FD_INOTIFY].fd = udev_watch_init(udev); + if (pfd[FD_INOTIFY].fd < 0) { + fprintf(stderr, "error initializing inotify\n"); + err(udev, "error initializing inotify\n"); + rc = 4; + goto exit; + } + + if (udev_get_rules_path(udev) != NULL) { + inotify_add_watch(pfd[FD_INOTIFY].fd, udev_get_rules_path(udev), + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + } else { + char filename[UTIL_PATH_SIZE]; + + inotify_add_watch(pfd[FD_INOTIFY].fd, UDEV_PREFIX "/lib/udev/rules.d", + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + inotify_add_watch(pfd[FD_INOTIFY].fd, SYSCONFDIR "/udev/rules.d", + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + + /* watch dynamic rules directory */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); + inotify_add_watch(pfd[FD_INOTIFY].fd, filename, + IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + } + udev_watch_restore(udev); + + /* block and listen to all signals on signalfd */ + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, NULL); + pfd[FD_SIGNAL].fd = signalfd(-1, &mask, 0); + if (pfd[FD_SIGNAL].fd < 0) { + fprintf(stderr, "error getting signalfd\n"); + err(udev, "error getting signalfd\n"); + rc = 5; + goto exit; + } + + /* unnamed socket from workers to the main daemon */ + if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, worker_watch) < 0) { + fprintf(stderr, "error getting socketpair\n"); + err(udev, "error getting socketpair\n"); + rc = 6; + goto exit; + } + pfd[FD_WORKER].fd = worker_watch[READ_END]; rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { err(udev, "error reading rules\n"); goto exit; } - udev_list_init(&event_list); + udev_queue_export = udev_queue_export_new(udev); if (udev_queue_export == NULL) { err(udev, "error creating queue file\n"); @@ -704,19 +904,19 @@ int main(int argc, char *argv[]) pid = fork(); switch (pid) { case 0: - dbg(udev, "daemonized fork running\n"); break; case -1: err(udev, "fork of daemon failed: %m\n"); rc = 4; goto exit; default: - dbg(udev, "child [%u] running, parent exits\n", pid); rc = 0; goto exit; } } + startup_log(udev); + /* redirect std{out,err} */ if (!debug && !debug_trace) { dup2(fd, STDIN_FILENO); @@ -742,159 +942,115 @@ int main(int argc, char *argv[]) close(fd); } - startup_log(udev); - - /* set signal handlers */ - memset(&act, 0x00, sizeof(struct sigaction)); - act.sa_handler = sig_handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_RESTART; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigaction(SIGCHLD, &act, NULL); - sigaction(SIGHUP, &act, NULL); - - /* watch rules directory */ - udev_watch_init(udev); - if (inotify_fd >= 0) { - if (udev_get_rules_path(udev) != NULL) { - inotify_add_watch(inotify_fd, udev_get_rules_path(udev), - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - } else { - char filename[UTIL_PATH_SIZE]; - - inotify_add_watch(inotify_fd, UDEV_PREFIX "/lib/udev/rules.d", - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - inotify_add_watch(inotify_fd, SYSCONFDIR "/udev/rules.d", - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - - /* watch dynamic rules directory */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); - inotify_add_watch(inotify_fd, filename, - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - } - - udev_watch_restore(udev); - } - /* in trace mode run one event after the other */ if (debug_trace) { max_childs = 1; } else { int memsize = mem_size_mb(); + if (memsize > 0) - max_childs = 128 + (memsize / 4); + max_childs = 128 + (memsize / 8); else - max_childs = UDEVD_MAX_CHILDS; + max_childs = 128; } + /* possibly overwrite maximum limit of executed events */ value = getenv("UDEVD_MAX_CHILDS"); if (value) max_childs = strtoul(value, NULL, 10); info(udev, "initialize max_childs to %u\n", max_childs); + udev_list_init(&event_list); + udev_list_init(&worker_list); + while (!udev_exit) { - sigset_t blocked_mask, orig_mask; - struct pollfd pfd[4]; - struct pollfd *ctrl_poll, *monitor_poll, *inotify_poll = NULL; - int nfds = 0; int fdcount; + int timeout; - sigfillset(&blocked_mask); - sigprocmask(SIG_SETMASK, &blocked_mask, &orig_mask); - if (signal_received) { - sigprocmask(SIG_SETMASK, &orig_mask, NULL); - goto handle_signals; - } + /* set timeout to kill idle workers */ + if (udev_list_is_empty(&event_list) && childs > 2) + timeout = 3 * 1000; + else + timeout = -1; + /* wait for events */ + fdcount = poll(pfd, ARRAY_SIZE(pfd), timeout); + if (fdcount < 0) + continue; - ctrl_poll = &pfd[nfds++]; - ctrl_poll->fd = udev_ctrl_get_fd(udev_ctrl); - ctrl_poll->events = POLLIN; + /* timeout - kill idle workers */ + if (fdcount == 0) + worker_kill(2); - monitor_poll = &pfd[nfds++]; - monitor_poll->fd = udev_monitor_get_fd(kernel_monitor); - monitor_poll->events = POLLIN; + /* event has finished */ + if (pfd[FD_WORKER].revents & POLLIN) + worker_returned(); - if (inotify_fd >= 0) { - inotify_poll = &pfd[nfds++]; - inotify_poll->fd = inotify_fd; - inotify_poll->events = POLLIN; - } + /* get kernel uevent */ + if (pfd[FD_NETLINK].revents & POLLIN) { + struct udev_device *dev; - fdcount = ppoll(pfd, nfds, NULL, &orig_mask); - sigprocmask(SIG_SETMASK, &orig_mask, NULL); - if (fdcount < 0) { - if (errno == EINTR) - goto handle_signals; - err(udev, "error in select: %m\n"); - continue; + dev = udev_monitor_receive_device(monitor); + if (dev != NULL) + event_queue_insert(dev); + else + udev_device_unref(dev); } - /* get control message */ - if (ctrl_poll->revents & POLLIN) - handle_ctrl_msg(udev_ctrl); - - /* get kernel uevent */ - if (monitor_poll->revents & POLLIN) { - struct udev_device *dev; + /* start new events */ + if (!udev_list_is_empty(&event_list) && !stop_exec_queue) + events_start(udev); - dev = udev_monitor_receive_device(kernel_monitor); - if (dev != NULL) { - struct udev_event *event; + /* get signal */ + if (pfd[FD_SIGNAL].revents & POLLIN) { + struct signalfd_siginfo fdsi; + ssize_t size; - event = udev_event_new(dev); - if (event != NULL) - event_queue_insert(event); - else - udev_device_unref(dev); - } + size = read(pfd[FD_SIGNAL].fd, &fdsi, sizeof(struct signalfd_siginfo)); + if (size == sizeof(struct signalfd_siginfo)) + handle_signal(fdsi.ssi_signo); } - /* rules directory inotify watch */ - if (inotify_poll && (inotify_poll->revents & POLLIN)) + /* device node and rules directory inotify watch */ + if (pfd[FD_INOTIFY].revents & POLLIN) handle_inotify(udev); -handle_signals: - signal_received = 0; + /* + * get control message + * + * This needs to be after the inotify handling, to make sure, + * that the settle signal is send back after the possibly generated + * "change" events by the inotify device node watch. + */ + if (pfd[FD_CONTROL].revents & POLLIN) + handle_ctrl_msg(udev_ctrl); /* rules changed, set by inotify or a HUP signal */ if (reload_config) { struct udev_rules *rules_new; - reload_config = 0; + worker_kill(0); rules_new = udev_rules_new(udev, resolve_names); if (rules_new != NULL) { udev_rules_unref(rules); rules = rules_new; } - } - - if (sigchilds_waiting) { - sigchilds_waiting = 0; - reap_sigchilds(); - } - - if (run_exec_q) { - run_exec_q = 0; - if (!stop_exec_q) - event_queue_manager(udev); - } - - if (settle_pid > 0) { - kill(settle_pid, SIGUSR1); - settle_pid = 0; + reload_config = 0; } } + udev_queue_export_cleanup(udev_queue_export); rc = 0; exit: - udev_queue_export_unref(udev_queue_export); udev_rules_unref(rules); udev_ctrl_unref(udev_ctrl); - if (inotify_fd >= 0) - close(inotify_fd); - udev_monitor_unref(kernel_monitor); + if (pfd[FD_SIGNAL].fd >= 0) + close(pfd[FD_SIGNAL].fd); + if (worker_watch[READ_END] >= 0) + close(worker_watch[READ_END]); + if (worker_watch[WRITE_END] >= 0) + close(worker_watch[WRITE_END]); + udev_monitor_unref(monitor); udev_selinux_exit(udev); udev_unref(udev); logging_close(); -- cgit v1.2.3-54-g00ecf From 9290143d2d8ee9e42459d198b87ad2c35d93819d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Jun 2009 02:49:42 +0200 Subject: udevd: close netlink socket in worker and set cloexec --- udev/udevd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udev/udevd.c b/udev/udevd.c index c0852022e2..2e7a179cbc 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -195,6 +195,7 @@ static void worker_new(struct event *event) /* allow the main daemon netlink address to send devices to the worker */ udev_monitor_allow_unicast_sender(worker_monitor, monitor); udev_monitor_enable_receiving(worker_monitor); + util_set_fd_cloexec(udev_monitor_get_fd(worker_monitor)); worker = calloc(1, sizeof(struct worker)); if (worker == NULL) @@ -207,6 +208,7 @@ static void worker_new(struct event *event) struct udev_device *dev; udev_queue_export_unref(udev_queue_export); + udev_monitor_unref(monitor); udev_ctrl_unref(udev_ctrl); close(pfd[FD_SIGNAL].fd); close(worker_watch[READ_END]); @@ -885,6 +887,7 @@ int main(int argc, char *argv[]) goto exit; } pfd[FD_WORKER].fd = worker_watch[READ_END]; + util_set_fd_cloexec(worker_watch[WRITE_END]); rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { -- cgit v1.2.3-54-g00ecf From 9fc643a41490dd891d42e2e3885db183809d0ffc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Jun 2009 03:21:33 +0200 Subject: rules: do not call path_id for virtual devices --- rules/rules.d/60-persistent-input.rules | 2 +- rules/rules.d/60-persistent-storage.rules | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index f522b417b2..c733ad5605 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -31,7 +31,7 @@ SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{ID_CLASS}=="", ATTRS SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" # by-path -IMPORT{program}="path_id %p" +SUBSYSTEMS=="usb|platform", IMPORT{program}="path_id %p" ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" # allow empty class for platform and usb devices; platform supports only a single interface that way diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index fea86d9310..e47cf21571 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -47,7 +47,7 @@ KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}= KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (parent device path) -ENV{DEVTYPE}=="disk", IMPORT{program}="path_id %p" +ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -- cgit v1.2.3-54-g00ecf From 213f0355c057bf55afcba45b51ffa0490060bc45 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Fri, 5 Jun 2009 15:09:05 +0200 Subject: rules: make RFKILL control device world readable --- rules/rules.d/50-udev-default.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index de96b95ba4..f19fb63afb 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -91,6 +91,7 @@ SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" # network KERNEL=="tun", NAME="net/%k", MODE="0666" +KERNEL=="rfkill", MODE="0664" # CPU KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid", MODE="0444" -- cgit v1.2.3-54-g00ecf From a25d547dd4a67783b939da6f2d592af01336aa6d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 5 Jun 2009 23:27:11 +0200 Subject: udevd: use enum instead of char in struct declaration --- udev/lib/libudev.h | 4 ++-- udev/udev-rules.c | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 9b51ea3300..207dd821a6 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2009 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -76,8 +76,8 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const /* udev and kernel device events */ struct udev_monitor; -struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); +struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); void udev_monitor_unref(struct udev_monitor *udev_monitor); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index e6452a6fa4..4e760a5176 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2009 Kay Sievers * Copyright (C) 2008 Alan Jenkins * * This program is free software: you can redistribute it and/or modify @@ -166,7 +166,7 @@ struct token { union { unsigned char type; /* same as in rule and key */ struct { - unsigned char type; + enum token_type type:8; unsigned char flags; unsigned short token_count; unsigned int label_off; @@ -174,10 +174,10 @@ struct token { unsigned short filename_line; } rule; struct { - unsigned char type; + enum token_type type:8; + enum operation_type op:8; + enum string_glob_type glob:8; unsigned char flags; - unsigned char op; - unsigned char glob; unsigned int value_off; union { unsigned int attr_off; -- cgit v1.2.3-54-g00ecf From 32028733ee9ee1fca2f18497ff302de003916c4f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Jun 2009 04:52:52 +0200 Subject: allow format substitution in path of ATTR{}=="" --- udev/udev-rules.c | 107 ++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 76 insertions(+), 31 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 4e760a5176..5cb381ebac 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -105,6 +105,13 @@ enum string_glob_type { GL_SOMETHING, /* commonly used "?*" */ }; +enum string_subst_type { + SB_UNSET, + SB_NONE, + SB_FORMAT, + SB_SUBSYS, +}; + /* tokens of a rule are sorted/handled in this order */ enum token_type { TK_UNSET, @@ -167,7 +174,7 @@ struct token { unsigned char type; /* same as in rule and key */ struct { enum token_type type:8; - unsigned char flags; + unsigned int flags:8; unsigned short token_count; unsigned int label_off; unsigned short filename_off; @@ -177,7 +184,8 @@ struct token { enum token_type type:8; enum operation_type op:8; enum string_glob_type glob:8; - unsigned char flags; + enum string_subst_type subst:4; + enum string_subst_type attrsubst:4; unsigned int value_off; union { unsigned int attr_off; @@ -973,8 +981,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, const char *value, const void *data) { struct token *token = &rule_tmp->token[rule_tmp->token_cur]; - const char *attr = data; - enum string_glob_type glob; + const char *attr = NULL; memset(token, 0x00, sizeof(struct token)); @@ -1008,6 +1015,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_M_ATTRS: case TK_A_ATTR: case TK_A_ENV: + attr = data; token->key.value_off = add_string(rule_tmp->rules, value); token->key.attr_off = add_string(rule_tmp->rules, attr); break; @@ -1053,15 +1061,14 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, return -1; } - glob = GL_PLAIN; if (value != NULL && type < TK_M_MAX) { /* check if we need to split or call fnmatch() while matching rules */ + enum string_glob_type glob; int has_split; int has_glob; has_split = (strchr(value, '|') != NULL); - has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || - strchr(value, '[') != NULL || strchr(value, ']') != NULL); + has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || strchr(value, '[') != NULL); if (has_split && has_glob) { glob = GL_SPLIT_GLOB; } else if (has_split) { @@ -1071,12 +1078,34 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, glob = GL_SOMETHING; else glob = GL_GLOB; + } else { + glob = GL_PLAIN; } + token->key.glob = glob; + } + + if (value != NULL && type > TK_M_MAX) { + /* check if assigned value has substitution chars */ + if (value[0] == '[') + token->key.subst = SB_SUBSYS; + else if (strchr(value, '%') != NULL || strchr(value, '$') != NULL) + token->key.subst = SB_FORMAT; + else + token->key.subst = SB_NONE; + } + + if (attr != NULL) { + /* check if property/attribut name has substitution chars */ + if (attr[0] == '[') + token->key.attrsubst = SB_SUBSYS; + else if (strchr(attr, '%') != NULL || strchr(attr, '$') != NULL) + token->key.attrsubst = SB_FORMAT; + else + token->key.attrsubst = SB_NONE; } token->key.type = type; token->key.op = op; - token->key.glob = glob; rule_tmp->token_cur++; if (rule_tmp->token_cur >= ARRAY_SIZE(rule_tmp->token)) { err(rule_tmp->rules->udev, "temporary rule array too small\n"); @@ -1911,35 +1940,51 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur) { - const char *key_name = &rules->buf[cur->key.attr_off]; - const char *key_value = &rules->buf[cur->key.value_off]; - char value[UTIL_NAME_SIZE]; + const char *name; + char nbuf[UTIL_NAME_SIZE]; + const char *value; + char vbuf[UTIL_NAME_SIZE]; size_t len; - value[0] = '\0'; - if (key_name[0] == '[') { - char attr[UTIL_PATH_SIZE]; - - util_strscpy(attr, sizeof(attr), key_name); - util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); - } - if (value[0] == '\0') { - const char *val; - - val = udev_device_get_sysattr_value(dev, key_name); - if (val == NULL) + name = &rules->buf[cur->key.attr_off]; + switch (cur->key.attrsubst) { + case SB_FORMAT: + udev_event_apply_format(event, name, nbuf, sizeof(nbuf)); + name = nbuf; + /* fall through */ + case SB_NONE: + value = udev_device_get_sysattr_value(dev, name); + if (value == NULL) return -1; - util_strscpy(value, sizeof(value), val); + break; + case SB_SUBSYS: + if (util_resolve_subsys_kernel(event->udev, name, vbuf, sizeof(vbuf), 1) != 0) + return -1; + value = vbuf; + break; + default: + return -1; } - /* strip trailing whitespace of value, if not asked to match for it */ - len = strlen(key_value); - if (len > 0 && !isspace(key_value[len-1])) { - len = strlen(value); - while (len > 0 && isspace(value[--len])) - value[len] = '\0'; - dbg(rules->udev, "removed trailing whitespace from '%s'\n", value); + /* remove trailing whitespace, if not asked to match for it */ + len = strlen(value); + if (len > 0 && isspace(value[len-1])) { + const char *key_value; + size_t klen; + + key_value = &rules->buf[cur->key.value_off]; + klen = strlen(key_value); + if (klen > 0 && !isspace(key_value[klen-1])) { + if (value != vbuf) { + util_strscpy(vbuf, sizeof(vbuf), value); + value = vbuf; + } + while (len > 0 && isspace(vbuf[--len])) + vbuf[len] = '\0'; + dbg(rules->udev, "removed trailing whitespace from '%s'\n", value); + } } + return match_key(rules, cur, value); } -- cgit v1.2.3-54-g00ecf From 4950b6e6a8c298085a8c135393cfa8649644f7c9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Jun 2009 04:54:41 +0200 Subject: cleanup $attr{} substitution --- udev/udev-event.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 3f69c0bb7a..2f32805f30 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -180,6 +180,8 @@ subst: attrbuf[i] = '\0'; from += i+1; attr = attrbuf; + } else { + attr = NULL; } switch (type) { @@ -276,8 +278,8 @@ subst: break; } case SUBST_ATTR: { - const char *val; - char value[UTIL_NAME_SIZE]; + const char *value = NULL; + char vbuf[UTIL_NAME_SIZE]; size_t len; int count; @@ -286,36 +288,32 @@ subst: break; } - value[0] = '\0'; - /* read the value specified by "[dmi/id]product_name" */ - util_resolve_subsys_kernel(event->udev, attr, value, sizeof(value), 1); + /* try to read the value specified by "[dmi/id]product_name" */ + if (util_resolve_subsys_kernel(event->udev, attr, vbuf, sizeof(vbuf), 1) == 0) + value = vbuf; - /* try to read attribute of the current device */ - if (value[0] == '\0') { - val = udev_device_get_sysattr_value(event->dev, attr); - if (val != NULL) - util_strscpy(value, sizeof(value), val); - } + /* try to read the attribute the device */ + if (value == NULL) + value = udev_device_get_sysattr_value(event->dev, attr); /* try to read the attribute of the parent device, other matches have selected */ - if (value[0] == '\0' && event->dev_parent != NULL && event->dev_parent != event->dev) { - val = udev_device_get_sysattr_value(event->dev_parent, attr); - if (val != NULL) - util_strscpy(value, sizeof(value), val); - } + if (value == NULL && event->dev_parent != NULL && event->dev_parent != event->dev) + value = udev_device_get_sysattr_value(event->dev_parent, attr); - if (value[0]=='\0') + if (value == NULL) break; /* strip trailing whitespace, and replace unwanted characters */ - len = strlen(value); - while (len > 0 && isspace(value[--len])) - value[len] = '\0'; - count = udev_util_replace_chars(value, UDEV_ALLOWED_CHARS_INPUT); + if (value != vbuf) + util_strscpy(vbuf, sizeof(vbuf), value); + len = strlen(vbuf); + while (len > 0 && isspace(vbuf[--len])) + vbuf[len] = '\0'; + count = udev_util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); if (count > 0) info(event->udev, "%i character(s) replaced\n" , count); - l = util_strpcpy(&s, l, value); - dbg(event->udev, "substitute sysfs value '%s'\n", value); + l = util_strpcpy(&s, l, vbuf); + dbg(event->udev, "substitute sysfs value '%s'\n", vbuf); break; } case SUBST_PARENT: { -- cgit v1.2.3-54-g00ecf From 185ea6a76d3f3a9e9708239d2302bd98e00460fa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Jun 2009 16:07:06 +0200 Subject: path_id: implement in C using libudev --- TODO | 1 + extras/path_id/.gitignore | 1 + extras/path_id/Makefile.am | 12 + extras/path_id/path_id | 601 ------------------------- extras/path_id/path_id.c | 365 +++++++++++++++ extras/path_id/path_id.sh | 601 +++++++++++++++++++++++++ rules/rules.d/60-persistent-storage-tape.rules | 2 +- rules/rules.d/60-persistent-storage.rules | 4 +- 8 files changed, 984 insertions(+), 603 deletions(-) create mode 100644 extras/path_id/.gitignore delete mode 100755 extras/path_id/path_id create mode 100644 extras/path_id/path_id.c create mode 100755 extras/path_id/path_id.sh diff --git a/TODO b/TODO index bedccdb635..dfbb18d0cc 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ + o kill path_id.sh (add fc, sas, iscsi to C version) o add tests for kernel provided DEVNAME logic o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) o remove MMC rules, they got a modalias now (2.6.30) diff --git a/extras/path_id/.gitignore b/extras/path_id/.gitignore new file mode 100644 index 0000000000..6fd2f89761 --- /dev/null +++ b/extras/path_id/.gitignore @@ -0,0 +1 @@ +path_id diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am index f489290399..2e936234ff 100644 --- a/extras/path_id/Makefile.am +++ b/extras/path_id/Makefile.am @@ -2,7 +2,19 @@ include $(top_srcdir)/Makefile.am.inc udevhomedir = $(udev_prefix)/lib/udev dist_udevhome_SCRIPTS = \ + path_id.sh + +udevhome_PROGRAMS = \ path_id +path_id_SOURCES = \ + path_id.c \ + ../../udev/lib/libudev.h \ + ../../udev/lib/libudev.c \ + ../../udev/lib/libudev-device.c \ + ../../udev/lib/libudev-enumerate.c \ + ../../udev/lib/libudev-list.c \ + ../../udev/lib/libudev-util.c + dist_man_MANS = \ path_id.8 diff --git a/extras/path_id/path_id b/extras/path_id/path_id deleted file mode 100755 index 7b4973fa03..0000000000 --- a/extras/path_id/path_id +++ /dev/null @@ -1,601 +0,0 @@ -#!/bin/sh - -# provide the shortest possible unique hardware path to a device -# for the Linux Persistent Device Naming scheme -# -# Copyright (C) 2005-2006 SUSE Linux Products GmbH -# Author: -# Hannes Reinecke -# -# 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. - -SYSFS=/sys -RESULT=1 -TYPE= -OPWD="`pwd`" -full_sysfs_path= -full_sysfs_device_path= - -if [ -z "$DEVPATH" -a -z "$1" ] ; then - exit 1 -fi - -if [ -z "$DEVPATH" ] ; then - case "$1" in - $SYSFS/*) - DEVPATH="${1#$SYSFS}" - ;; - *) - DEVPATH=$1 - ;; - esac -fi - -if [ ! -e $SYSFS$DEVPATH/dev ] ; then - exit 1 -fi - -case "$DEVPATH" in - /devices/*) - cd "$SYSFS$DEVPATH/subsystem"; - TYPE="`pwd -P`" - cd "$OPWD" - TYPE="${TYPE##*/}" - ;; - /class/*) - TYPE="${DEVPATH#/class/}" - TYPE="${TYPE%%/*}" - ;; - /block/*) - TYPE=block - ;; - *) - exit 1 - ;; -esac - -get_port_offset () { - local type offset port - type=$1 - offset=$2 - for i in $type[0-9]* ; do - : i $i - port="${i#$type}" - if [ "$port" -lt "$offset" ] ; then offset=$port ; fi - done - echo $offset -} - -handle_pci () { - local DEV=$1 - cd -P $1 - DEV=${PWD} - pci_id=${DEV##*/} - host_dev_path=$DEV - - # cciss devices don't have a separate sysfs node - for blk_link in block*; do - if [ -L "$blk_link" ]; then - case "$blk_link" in - *cciss*) - d=cciss-${blk_link#*cciss\!} - ;; - esac - fi - done - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */pci[0-9]*) - host_dev_path=${host_dev_path%/*} - ;; - *) - break - ;; - esac - done - if [ "$d" ]; then - d="pci-$pci_id-$d" - else - d="pci-$pci_id" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_platform () { - local DEV=$1 - cd -P $1 - DEV=${PWD} - platform_id=${DEV##*/} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */platform*) - host_dev_path=${host_dev_path%/*} - ;; - *) - break - ;; - esac - done - if [ "$d" ]; then - d="platform-$platform_id-$d" - else - d="platform-$platform_id" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_xen () { - local DEV=$1 - cd -P $1 - vbd_id=${DEV##*/} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */vbd*) - host_dev_path=${host_dev_path%/*} - ;; - *) - break - ;; - esac - done - if [ "$d" ]; then - d="xen-$vbd_id-$d" - else - d="xen-$vbd_id" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_serio () { - local DEV=$1 - cd -P $1 - DEV=${PWD} - serio_id=${DEV##*/serio} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */serio*) - host_dev_path=${host_dev_path%/*} - ;; - *) - break - ;; - esac - done - if [ "$d" ]; then - d="serio-$serio_id-$d" - else - d="serio-$serio_id" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_ide () { - : handle_ide $* - local DEV=$1 - local port idedev idecontroller - # IDE - : DEV $DEV - port=${DEV##*/} - idedev=${DEV%/*} - idecontroller=${idedev%/*} - # port info if the controller has more than one interface - port="${port#ide}" - : port $port d $d - : idedev $idedev kernel_port $port - case "${port#*.}" in - 0) - channel=0 - ;; - 1) - channel=1 - ;; - *) - echo "Error: $idedev is neither master or slave" >&2 - ;; - esac - cd $idecontroller - offset="`get_port_offset ide ${port%.*}`" - cd "$OPWD" - : port offset $offset - port=$((${port%.*} - $offset)) - if [ "$d" ] ; then - d="ide-${port}:$channel-$d" - else - d="ide-${port}:$channel" - fi - D=$idecontroller - RESULT=0 -} - -handle_scsi () { - : handle_scsi $* - local DEV=$1 - local cil controller_port controller_dev - # SCSI device - cil="${DEV##*/}" - cil="${cil#*:}" - target_dev=${DEV%/*} - target_id=${target_dev##*/target} - cd "$target_dev" - target_num=0 - for tid in ${target_id}* ; do - target_num=$(( $target_num + 1 )) - done - controller_port=${target_dev%/*} - controller_dev="${controller_port%/*}" - : controller_dev $controller_dev - : controller_port $controller_port - # a host controller may have more than one interface/port - controller_port="${controller_port##*/host}" - # - cd "$controller_dev" - controller_offset=$(get_port_offset host $controller_port) - cd "$OPWD" - controller_port=$(( $controller_port - $controller_offset)) - scsi_id="scsi-${controller_port}:${cil}" - if [ "$d" ] ; then - d="${scsi_id}-$d" - else - d="$scsi_id" - fi - D="$controller_dev" - RESULT=0 -} - -handle_firewire () { - : handle_firewire $* - local DEV=$1 - if [ -f "$D/ieee1394_id" ] ; then - read ieee1394_id < $D/ieee1394_id - fi - if [ -z "$ieee1394_id" ] ; then - : no IEEE1394 ID - RESULT=1 - return - fi - fw_host_dev=${DEV%/fw-host*} - # IEEE1394 devices are always endpoints - d="ieee1394-0x$ieee1394_id" - D="$fw_host_dev" - RESULT=0 -} - -handle_fc () { - : handle_fc $* - local DEV=$1 - local cil controller_port controller_dev - # SCSI-FC device - fc_tgt_hcil="${DEV##*/}" - fc_tgt_lun="${fc_tgt_hcil##*:}" - fc_tgt_path="${DEV%/*}" - fc_tgt_num="${fc_tgt_path##*/}" - fc_tgt_dev="${fc_tgt_path}/fc_transport/${fc_tgt_num}" - if [ -e "$fc_tgt_dev/port_name" ]; then - read wwpn < $fc_tgt_dev/port_name - fi - if [ -z "$wwpn" ] ; then - : no WWPN - D= - RESULT=1 - return - fi - # Linux currently knows about 32bit luns - tmp_lun3=$(printf "%04x" $(($fc_tgt_lun & 0xFFFF))) - tmp_lun2=$(printf "%04x" $(( ($fc_tgt_lun >> 16) & 0xFFFF))) - tmp_lun1="0000" - tmp_lun0="0000" - if (($fc_tgt_lun == 0)) ; then - lun="0x0000000000000000" - else - lun="0x${tmp_lun3}${tmp_lun2}${tmp_lun1}${tmp_lun0}" - fi - controller_dev="${fc_tgt_path%/host[0-9]*}" - # FC devices are always endpoints - d="fc-${wwpn}:${lun}" - D="$controller_dev" - RESULT=0 -} - -handle_sas () { - : handle_sas $* - local DEV=$1 - local cil adapter controller_dev - local lun - lun=${DEV##*:} - # SAS device - sas_end_path="${DEV%%/target*}" - sas_host_path="${sas_end_path%%/port*}" - sas_phy_path="${sas_end_path#*/host*/}" - sas_phy_path="${sas_phy_path%%/*}" - sas_phy_path="${sas_host_path}/${sas_phy_path}" - - sas_phy_id=255 - for phy in $sas_phy_path/phy-*/sas_phy/phy-* ; do - if [ -d "$phy" ] ; then - read phy_id < $phy/phy_identifier - if [ $phy_id -lt $sas_phy_id ]; then - sas_phy_id=$phy_id - fi - fi - done - - if [ $sas_phy_id -eq 255 ] ; then - : no initiator address - D= - RESULT=1 - return - fi - - sas_port_id="${sas_phy_path##*/port-}" - sas_port_dev="/sys/class/sas_port/port-${sas_port_id}" - if [ -e "$sas_port_dev/num_phys" ] ; then - read phy_port < $sas_port_dev/num_phys - fi - - sas_end_id="${sas_end_path##*end_device-}" - sas_end_dev="/sys/class/sas_device/end_device-${sas_end_id}" - if [ -e "$sas_end_dev/sas_address" ]; then - read end_address < $sas_end_dev/sas_address - read end_id < $sas_end_dev/phy_identifier - fi - if [ -z "$end_address" ] ; then - : no end device address - D= - RESULT=1 - return - fi - sas_end_address="$end_address:$end_id" - controller_dev="${sas_host_path%/host[0-9]*}" - # SAS devices are always endpoints - d="sas-phy${sas_phy_id}:${phy_port}-${sas_end_address}-lun$lun" - D="$controller_dev" - RESULT=0 -} - -handle_iscsi() { - local DEV=$1 - local iscsi_session_dir - local iscsi_session iscsi_session_path - local iscsi_connection iscsi_connection_path - local iscsi_scsi_lun - # iSCSI device - iscsi_session_dir="${DEV%%/target*}" - iscsi_session="${iscsi_session_dir##*/}" - iscsi_session_path=/sys/class/iscsi_session/${iscsi_session} - if [ ! -d "$iscsi_session_path" ] ; then - : no iSCSI session path - RESULT=1 - return - fi - # Currently we're not doing MC/S - for conn in ${iscsi_session_dir}/connection* ; do - iscsi_conn_num=${conn##*:} - if [ "$iscsi_conn_num" = '0' ] ; then - iscsi_connection=$(basename $conn) - fi - done - if [ -z "$iscsi_connection" ] ; then - : no iSCSI connection found - RESULT=1 - return - fi - iscsi_connection_path=/sys/class/iscsi_connection/${iscsi_connection} - if [ ! -d "$iscsi_connection_path" ] ; then - : no iSCSI connection path - RESULT=1 - return - fi - if [ -e "${iscsi_session_path}/targetname" ]; then - read iscsi_tgtname < ${iscsi_session_path}/targetname - fi - if [ -z "$iscsi_tgtname" ] ; then - : No iSCSI Targetname - RESULT=1 - return - fi - if [ -e "${iscsi_connection_path}/persistent_address" ] ; then - read iscsi_address < ${iscsi_connection_path}/persistent_address - fi - if [ -z "$iscsi_address" ] ; then - : No iSCSI Target address - RESULT=1 - return - fi - if [ -e "${iscsi_connection_path}/persistent_port" ] ; then - read iscsi_port < ${iscsi_connection_path}/persistent_port - fi - iscsi_scsi_lun="${DEV##*:}" - d="ip-${iscsi_address}:${iscsi_port}-iscsi-${iscsi_tgtname}-lun-${iscsi_scsi_lun}" - RESULT=0 -} - -handle_usb () { -: handle_usb $* - local DEV=$1 - cd -P $1 - DEV=${PWD} - port_id=${DEV##*/} - port_num=${port_id#*-} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */usb*) - usb_host_path=$host_dev_path - host_dev_path="${host_dev_path%/*}" - ;; - *) - break - ;; - esac - done - : host_dev_path $host_dev_path - usb_host_num=${usb_host_path##*/usb} - - cd "$host_dev_path" - usb_host_offset=$(get_port_offset usb $usb_host_num) - usb_host_port=$(($usb_host_num - $usb_host_offset)) - cd "$OPWD" - if [ "$d" ] ; then - d="usb-$usb_host_port:$port_num-${d}" - else - d="usb-$usb_host_port:$port_num" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_device () { - full_sysfs_path="$SYSFS$DEVPATH" - case "$DEVPATH" in - /devices/*) - full_sysfs_path="${full_sysfs_path%/*}" - # skip parent device of the same subsystem - if [ -L $full_sysfs_path/subsystem ]; then - cd "$full_sysfs_path/subsystem"; - subsys="`pwd -P`" - cd "$OPWD" - subsys="${subsys##*/}" - if [ "$subsys" = "$TYPE" ]; then - : skip same subsystem parent - full_sysfs_path="${full_sysfs_path%/*}" - fi - fi - # skip subsystem directory - subsys="${full_sysfs_path##*/}" - if [ "$subsys" = "$TYPE" ]; then - : skip subsystem directory - full_sysfs_path="${full_sysfs_path%/*}" - fi - cd $full_sysfs_path - ;; - *) - # old sysfs layout - if [ ! -L $full_sysfs_path/device ]; then - full_sysfs_path="${full_sysfs_path%/*}" - : full_sysfs_path "$full_sysfs_path" - if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ]; then - return - fi - fi - if [ -L $full_sysfs_path/device/device ]; then - cd $full_sysfs_path/device/device - else - cd $full_sysfs_path/device - fi - ;; - esac - full_sysfs_device_path="`pwd -P`" - cd "$OPWD" - - D=$full_sysfs_device_path - while [ ! -z "$D" ] ; do - case "$D" in - */ide[0-9]/[0-9].[0-9]*|*/ide[0-9][0-9]/[0-9][0-9].[0-9]*) - handle_ide "$D" - ;; - */css0/*) - if [ -r $full_sysfs_device_path/wwpn ]; then - read wwpn < $full_sysfs_device_path/wwpn - fi - if [ -r $full_sysfs_device_path/fcp_lun ]; then - read lun < $full_sysfs_device_path/fcp_lun - fi - if [ -r $full_sysfs_device_path/hba_id ]; then - read bus_id < $full_sysfs_device_path/hba_id - fi - if [ "$bus_id" -a "$wwpn" -a "$lun" ]; then - # S/390 zfcp adapter - d="ccw-$bus_id-zfcp-$wwpn:$lun" - RESULT=0 - else - # DASD devices - bus="ccw" - adapter=${D##*/} - d="$bus-$adapter" - RESULT=0 - fi - D= - ;; - */rport-[0-9]*:[0-9]*-[0-9]*/*) - handle_fc "$D" - ;; - */end_device-[0-9]*:[0-9]*:[0-9]*/*) - handle_sas "$D" - ;; - */fw-host[0-9]*/*) - handle_firewire "$D" - ;; - */session[0-9]*/*) - handle_iscsi "$D" - D= - ;; - */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) - handle_scsi "$D" - ;; - */ttyUSB*) - D=${D%/ttyUSB*} - ;; - */usb[0-9]*/[0-9]*/*) - handle_usb "$D" - ;; - */pci[0-9]*:[0-9]*) - handle_pci "$D" - ;; - */serio[0-9]*) - handle_serio "$D" - ;; - */platform/*) - handle_platform "$D" - ;; - */vbd-[0-9]*) - handle_xen "$D" - ;; - */devices) - D= - ;; - *) - : not handled - RESULT=1 - return - ;; - esac - done - if [ "$TYPE" = "scsi_tape" ] ; then - devname=${full_sysfs_path##*/} - rewind="${devname%%st*}" - mode="${devname##*st}" - case "$mode" in - *l) - mode="l" - ;; - *m) - mode="m" - ;; - *a) - mode="a" - ;; - *) - mode="" - ;; - esac - if [ "$d" ]; then - d="$d-${rewind}st${mode}" - fi - fi -} - -handle_device -if [ -z "$d" ]; then - exit 1 -fi -echo "ID_PATH=$d" -exit 0 diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c new file mode 100644 index 0000000000..872f0c932e --- /dev/null +++ b/extras/path_id/path_id.c @@ -0,0 +1,365 @@ +/* + * compose persisistent device path + * + * Copyright (C) 2009 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include <../../udev/udev.h> + +int debug; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "%s: ", fn != NULL ? fn : file); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } +} + +static int path_prepend(char **path, const char *fmt, ...) +{ + va_list va; + char *old; + char *pre; + int err; + + old = *path; + + va_start(va, fmt); + err = vasprintf(&pre, fmt, va); + va_end(va); + if (err < 0) + return err; + + if (old != NULL) { + err = asprintf(path, "%s-%s", pre, old); + if (err < 0) + return err; + free(pre); + } else { + *path = pre; + } + + free(old); + return 0; +} + +static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) +{ + struct udev_device *parent = dev; + + while (parent != NULL) { + const char *subsystem; + + subsystem = udev_device_get_subsystem(parent); + if (subsystem == NULL || strcmp(subsystem, subsys) != 0) + break; + dev = parent; + parent = udev_device_get_parent(parent); + } + return dev; +} + +/* find smallest number of instances of / */ +static int base_number(const char *syspath, const char *name) +{ + char *base; + char *pos; + DIR *dir; + struct dirent *dent; + size_t len; + int number = -1; + + base = strdup(syspath); + if (base == NULL) + goto out; + + pos = strrchr(base, '/'); + if (pos == NULL) + goto out; + pos[0] = '\0'; + + len = strlen(name); + dir = opendir(base); + if (dir == NULL) + goto out; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char *rest; + int i; + + if (dent->d_name[0] == '.') + continue; + if (dent->d_type != DT_DIR && dent->d_type != DT_LNK) + continue; + if (strncmp(dent->d_name, name, len) != 0) + continue; + i = strtoul(&dent->d_name[len], &rest, 10); + if (rest[0] != '\0') + continue; + if (number == -1 || i < number) + number = i; + } + closedir(dir); +out: + free(base); + return number; +} + +static struct udev_device *handle_scsi(struct udev_device *dev, char **path) +{ + const char *devtype; + struct udev_device *hostdev; + const char *name; + int host, bus, target, lun; + int base; + + devtype = udev_device_get_devtype(dev); + if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) + return dev; + + hostdev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_host"); + if (hostdev == NULL) + return dev; + + name = udev_device_get_sysname(dev); + if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) + return dev; + + /* rebase host offset to get the local relative number */ + base = base_number(udev_device_get_syspath(hostdev), "host"); + if (base < 0) + return dev; + host -= base; + + path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun); + dev = skip_subsystem(dev, "scsi"); + return dev; +} + +static void handle_scsi_tape(struct udev_device *dev, char **suffix) +{ + const char *name; + + name = udev_device_get_sysname(dev); + if (strncmp(name, "nst", 3) == 0 && strchr("lma", name[3]) != NULL) + asprintf(suffix, "nst%c", name[3]); + else if (strncmp(name, "st", 2) == 0 && strchr("lma", name[2]) != NULL) + asprintf(suffix, "st%c", name[2]); +} + +static struct udev_device *handle_usb(struct udev_device *dev, char **path) +{ + const char *devtype; + const char *str; + const char *port; + + devtype = udev_device_get_devtype(dev); + if (devtype == NULL || strcmp(devtype, "usb_interface") != 0) + return dev; + + str = udev_device_get_sysname(dev); + port = strchr(str, '-'); + if (port == NULL) + return dev; + port++; + + dev = skip_subsystem(dev, "usb"); + path_prepend(path, "usb-0:%s", port); + return dev; +} + +static struct udev_device *handle_firewire(struct udev_device *parent, struct udev_device *dev, char **path) +{ + struct udev_device *scsi_dev; + + scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); + if (scsi_dev != NULL) { + const char *id; + + id = udev_device_get_sysattr_value(scsi_dev, "ieee1394_id"); + if (id != NULL) + path_prepend(path, "ieee1394-0x%s", id); + } + + parent = skip_subsystem(parent, "firewire"); + return parent; +} + +static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) +{ + struct udev_device *scsi_dev; + + scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); + if (scsi_dev != NULL) { + const char *wwpn; + const char *lun; + const char *hba_id; + + hba_id = udev_device_get_sysattr_value(scsi_dev, "hba_id"); + wwpn = udev_device_get_sysattr_value(scsi_dev, "wwpn"); + lun = udev_device_get_sysattr_value(scsi_dev, "fcp_lun"); + if (hba_id != NULL && lun != NULL && wwpn != NULL) { + path_prepend(path, "ccw-%s-zfcp-%s:%s", hba_id, wwpn, lun); + goto out; + } + } + + path_prepend(path, "ccw-%s", udev_device_get_sysname(parent)); +out: + parent = skip_subsystem(parent, "ccw"); + return parent; +} + +int main(int argc, char **argv) +{ + static const struct option options[] = { + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + struct udev *udev; + struct udev_device *dev; + struct udev_device *parent; + char syspath[UTIL_PATH_SIZE]; + const char *devpath; + char *path; + char *path_suffix; + int rc = 1; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + logging_init("usb_id"); + udev_set_log_fn(udev, log_fn); + + while (1) { + int option; + + option = getopt_long(argc, argv, "dh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + printf("Usage: path_id [--debug] [--help] \n" + " --debug print debug information\n" + " --help print this help text\n\n"); + default: + rc = 1; + goto exit; + } + } + + devpath = argv[optind]; + if (devpath == NULL) { + fprintf(stderr, "No device specified\n"); + rc = 2; + goto exit; + } + + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); + dev = udev_device_new_from_syspath(udev, syspath); + if (dev == NULL) { + fprintf(stderr, "unable to access '%s'\n", devpath); + rc = 3; + goto exit; + } + + path = NULL; + path_suffix = NULL; + + parent = dev; + while (parent != NULL) { + const char *subsys; + + subsys = udev_device_get_subsystem(parent); + + if (subsys == NULL) { + ; + } else if (strcmp(subsys, "scsi_tape") == 0) { + handle_scsi_tape(parent, &path_suffix); + } else if (strcmp(subsys, "scsi") == 0) { + parent = handle_scsi(parent, &path); + } else if (strcmp(subsys, "fc_transport") == 0) { + ; //handle_fc(); + } else if (strcmp(subsys, "sas_end_device") == 0) { + ; //handle_sas(); + } else if (strcmp(subsys, "iscsi_session") == 0) { + ; //handle_iscsi() + } else if (strcmp(subsys, "ccw") == 0) { + handle_ccw(parent, dev, &path); + } else if (strcmp(subsys, "cciss") == 0) { + ; //handle_cciss(); + } else if (strcmp(subsys, "usb") == 0) { + parent = handle_usb(parent, &path); + } else if (strcmp(subsys, "serio") == 0) { + path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); + parent = skip_subsystem(parent, "serio"); + } else if (strcmp(subsys, "firewire") == 0 || strcmp(subsys, "ieee1394") == 0) { + parent = handle_firewire(parent, dev, &path); + } else if (strcmp(subsys, "pci") == 0) { + path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "pci"); + } else if (strcmp(subsys, "platform") == 0) { + path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "platform"); + } else if (strcmp(subsys, "xen") == 0) { + path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "xen"); + } + + parent = udev_device_get_parent(parent); + } + + if (path != NULL) { + if (path_suffix != NULL) { + printf("ID_PATH=%s%s\n", path, path_suffix); + free(path_suffix); + } else { + printf("ID_PATH=%s\n", path); + } + free(path); + rc = 0; + } + + udev_device_unref(dev); +exit: + udev_unref(udev); + logging_close(); + return rc; +} diff --git a/extras/path_id/path_id.sh b/extras/path_id/path_id.sh new file mode 100755 index 0000000000..7b4973fa03 --- /dev/null +++ b/extras/path_id/path_id.sh @@ -0,0 +1,601 @@ +#!/bin/sh + +# provide the shortest possible unique hardware path to a device +# for the Linux Persistent Device Naming scheme +# +# Copyright (C) 2005-2006 SUSE Linux Products GmbH +# Author: +# Hannes Reinecke +# +# 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. + +SYSFS=/sys +RESULT=1 +TYPE= +OPWD="`pwd`" +full_sysfs_path= +full_sysfs_device_path= + +if [ -z "$DEVPATH" -a -z "$1" ] ; then + exit 1 +fi + +if [ -z "$DEVPATH" ] ; then + case "$1" in + $SYSFS/*) + DEVPATH="${1#$SYSFS}" + ;; + *) + DEVPATH=$1 + ;; + esac +fi + +if [ ! -e $SYSFS$DEVPATH/dev ] ; then + exit 1 +fi + +case "$DEVPATH" in + /devices/*) + cd "$SYSFS$DEVPATH/subsystem"; + TYPE="`pwd -P`" + cd "$OPWD" + TYPE="${TYPE##*/}" + ;; + /class/*) + TYPE="${DEVPATH#/class/}" + TYPE="${TYPE%%/*}" + ;; + /block/*) + TYPE=block + ;; + *) + exit 1 + ;; +esac + +get_port_offset () { + local type offset port + type=$1 + offset=$2 + for i in $type[0-9]* ; do + : i $i + port="${i#$type}" + if [ "$port" -lt "$offset" ] ; then offset=$port ; fi + done + echo $offset +} + +handle_pci () { + local DEV=$1 + cd -P $1 + DEV=${PWD} + pci_id=${DEV##*/} + host_dev_path=$DEV + + # cciss devices don't have a separate sysfs node + for blk_link in block*; do + if [ -L "$blk_link" ]; then + case "$blk_link" in + *cciss*) + d=cciss-${blk_link#*cciss\!} + ;; + esac + fi + done + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */pci[0-9]*) + host_dev_path=${host_dev_path%/*} + ;; + *) + break + ;; + esac + done + if [ "$d" ]; then + d="pci-$pci_id-$d" + else + d="pci-$pci_id" + fi + D="$host_dev_path" + RESULT=0 +} + +handle_platform () { + local DEV=$1 + cd -P $1 + DEV=${PWD} + platform_id=${DEV##*/} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */platform*) + host_dev_path=${host_dev_path%/*} + ;; + *) + break + ;; + esac + done + if [ "$d" ]; then + d="platform-$platform_id-$d" + else + d="platform-$platform_id" + fi + D="$host_dev_path" + RESULT=0 +} + +handle_xen () { + local DEV=$1 + cd -P $1 + vbd_id=${DEV##*/} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */vbd*) + host_dev_path=${host_dev_path%/*} + ;; + *) + break + ;; + esac + done + if [ "$d" ]; then + d="xen-$vbd_id-$d" + else + d="xen-$vbd_id" + fi + D="$host_dev_path" + RESULT=0 +} + +handle_serio () { + local DEV=$1 + cd -P $1 + DEV=${PWD} + serio_id=${DEV##*/serio} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */serio*) + host_dev_path=${host_dev_path%/*} + ;; + *) + break + ;; + esac + done + if [ "$d" ]; then + d="serio-$serio_id-$d" + else + d="serio-$serio_id" + fi + D="$host_dev_path" + RESULT=0 +} + +handle_ide () { + : handle_ide $* + local DEV=$1 + local port idedev idecontroller + # IDE + : DEV $DEV + port=${DEV##*/} + idedev=${DEV%/*} + idecontroller=${idedev%/*} + # port info if the controller has more than one interface + port="${port#ide}" + : port $port d $d + : idedev $idedev kernel_port $port + case "${port#*.}" in + 0) + channel=0 + ;; + 1) + channel=1 + ;; + *) + echo "Error: $idedev is neither master or slave" >&2 + ;; + esac + cd $idecontroller + offset="`get_port_offset ide ${port%.*}`" + cd "$OPWD" + : port offset $offset + port=$((${port%.*} - $offset)) + if [ "$d" ] ; then + d="ide-${port}:$channel-$d" + else + d="ide-${port}:$channel" + fi + D=$idecontroller + RESULT=0 +} + +handle_scsi () { + : handle_scsi $* + local DEV=$1 + local cil controller_port controller_dev + # SCSI device + cil="${DEV##*/}" + cil="${cil#*:}" + target_dev=${DEV%/*} + target_id=${target_dev##*/target} + cd "$target_dev" + target_num=0 + for tid in ${target_id}* ; do + target_num=$(( $target_num + 1 )) + done + controller_port=${target_dev%/*} + controller_dev="${controller_port%/*}" + : controller_dev $controller_dev + : controller_port $controller_port + # a host controller may have more than one interface/port + controller_port="${controller_port##*/host}" + # + cd "$controller_dev" + controller_offset=$(get_port_offset host $controller_port) + cd "$OPWD" + controller_port=$(( $controller_port - $controller_offset)) + scsi_id="scsi-${controller_port}:${cil}" + if [ "$d" ] ; then + d="${scsi_id}-$d" + else + d="$scsi_id" + fi + D="$controller_dev" + RESULT=0 +} + +handle_firewire () { + : handle_firewire $* + local DEV=$1 + if [ -f "$D/ieee1394_id" ] ; then + read ieee1394_id < $D/ieee1394_id + fi + if [ -z "$ieee1394_id" ] ; then + : no IEEE1394 ID + RESULT=1 + return + fi + fw_host_dev=${DEV%/fw-host*} + # IEEE1394 devices are always endpoints + d="ieee1394-0x$ieee1394_id" + D="$fw_host_dev" + RESULT=0 +} + +handle_fc () { + : handle_fc $* + local DEV=$1 + local cil controller_port controller_dev + # SCSI-FC device + fc_tgt_hcil="${DEV##*/}" + fc_tgt_lun="${fc_tgt_hcil##*:}" + fc_tgt_path="${DEV%/*}" + fc_tgt_num="${fc_tgt_path##*/}" + fc_tgt_dev="${fc_tgt_path}/fc_transport/${fc_tgt_num}" + if [ -e "$fc_tgt_dev/port_name" ]; then + read wwpn < $fc_tgt_dev/port_name + fi + if [ -z "$wwpn" ] ; then + : no WWPN + D= + RESULT=1 + return + fi + # Linux currently knows about 32bit luns + tmp_lun3=$(printf "%04x" $(($fc_tgt_lun & 0xFFFF))) + tmp_lun2=$(printf "%04x" $(( ($fc_tgt_lun >> 16) & 0xFFFF))) + tmp_lun1="0000" + tmp_lun0="0000" + if (($fc_tgt_lun == 0)) ; then + lun="0x0000000000000000" + else + lun="0x${tmp_lun3}${tmp_lun2}${tmp_lun1}${tmp_lun0}" + fi + controller_dev="${fc_tgt_path%/host[0-9]*}" + # FC devices are always endpoints + d="fc-${wwpn}:${lun}" + D="$controller_dev" + RESULT=0 +} + +handle_sas () { + : handle_sas $* + local DEV=$1 + local cil adapter controller_dev + local lun + lun=${DEV##*:} + # SAS device + sas_end_path="${DEV%%/target*}" + sas_host_path="${sas_end_path%%/port*}" + sas_phy_path="${sas_end_path#*/host*/}" + sas_phy_path="${sas_phy_path%%/*}" + sas_phy_path="${sas_host_path}/${sas_phy_path}" + + sas_phy_id=255 + for phy in $sas_phy_path/phy-*/sas_phy/phy-* ; do + if [ -d "$phy" ] ; then + read phy_id < $phy/phy_identifier + if [ $phy_id -lt $sas_phy_id ]; then + sas_phy_id=$phy_id + fi + fi + done + + if [ $sas_phy_id -eq 255 ] ; then + : no initiator address + D= + RESULT=1 + return + fi + + sas_port_id="${sas_phy_path##*/port-}" + sas_port_dev="/sys/class/sas_port/port-${sas_port_id}" + if [ -e "$sas_port_dev/num_phys" ] ; then + read phy_port < $sas_port_dev/num_phys + fi + + sas_end_id="${sas_end_path##*end_device-}" + sas_end_dev="/sys/class/sas_device/end_device-${sas_end_id}" + if [ -e "$sas_end_dev/sas_address" ]; then + read end_address < $sas_end_dev/sas_address + read end_id < $sas_end_dev/phy_identifier + fi + if [ -z "$end_address" ] ; then + : no end device address + D= + RESULT=1 + return + fi + sas_end_address="$end_address:$end_id" + controller_dev="${sas_host_path%/host[0-9]*}" + # SAS devices are always endpoints + d="sas-phy${sas_phy_id}:${phy_port}-${sas_end_address}-lun$lun" + D="$controller_dev" + RESULT=0 +} + +handle_iscsi() { + local DEV=$1 + local iscsi_session_dir + local iscsi_session iscsi_session_path + local iscsi_connection iscsi_connection_path + local iscsi_scsi_lun + # iSCSI device + iscsi_session_dir="${DEV%%/target*}" + iscsi_session="${iscsi_session_dir##*/}" + iscsi_session_path=/sys/class/iscsi_session/${iscsi_session} + if [ ! -d "$iscsi_session_path" ] ; then + : no iSCSI session path + RESULT=1 + return + fi + # Currently we're not doing MC/S + for conn in ${iscsi_session_dir}/connection* ; do + iscsi_conn_num=${conn##*:} + if [ "$iscsi_conn_num" = '0' ] ; then + iscsi_connection=$(basename $conn) + fi + done + if [ -z "$iscsi_connection" ] ; then + : no iSCSI connection found + RESULT=1 + return + fi + iscsi_connection_path=/sys/class/iscsi_connection/${iscsi_connection} + if [ ! -d "$iscsi_connection_path" ] ; then + : no iSCSI connection path + RESULT=1 + return + fi + if [ -e "${iscsi_session_path}/targetname" ]; then + read iscsi_tgtname < ${iscsi_session_path}/targetname + fi + if [ -z "$iscsi_tgtname" ] ; then + : No iSCSI Targetname + RESULT=1 + return + fi + if [ -e "${iscsi_connection_path}/persistent_address" ] ; then + read iscsi_address < ${iscsi_connection_path}/persistent_address + fi + if [ -z "$iscsi_address" ] ; then + : No iSCSI Target address + RESULT=1 + return + fi + if [ -e "${iscsi_connection_path}/persistent_port" ] ; then + read iscsi_port < ${iscsi_connection_path}/persistent_port + fi + iscsi_scsi_lun="${DEV##*:}" + d="ip-${iscsi_address}:${iscsi_port}-iscsi-${iscsi_tgtname}-lun-${iscsi_scsi_lun}" + RESULT=0 +} + +handle_usb () { +: handle_usb $* + local DEV=$1 + cd -P $1 + DEV=${PWD} + port_id=${DEV##*/} + port_num=${port_id#*-} + host_dev_path=$DEV + while [ ! -z "$host_dev_path" ] ; do + case "$host_dev_path" in + */usb*) + usb_host_path=$host_dev_path + host_dev_path="${host_dev_path%/*}" + ;; + *) + break + ;; + esac + done + : host_dev_path $host_dev_path + usb_host_num=${usb_host_path##*/usb} + + cd "$host_dev_path" + usb_host_offset=$(get_port_offset usb $usb_host_num) + usb_host_port=$(($usb_host_num - $usb_host_offset)) + cd "$OPWD" + if [ "$d" ] ; then + d="usb-$usb_host_port:$port_num-${d}" + else + d="usb-$usb_host_port:$port_num" + fi + D="$host_dev_path" + RESULT=0 +} + +handle_device () { + full_sysfs_path="$SYSFS$DEVPATH" + case "$DEVPATH" in + /devices/*) + full_sysfs_path="${full_sysfs_path%/*}" + # skip parent device of the same subsystem + if [ -L $full_sysfs_path/subsystem ]; then + cd "$full_sysfs_path/subsystem"; + subsys="`pwd -P`" + cd "$OPWD" + subsys="${subsys##*/}" + if [ "$subsys" = "$TYPE" ]; then + : skip same subsystem parent + full_sysfs_path="${full_sysfs_path%/*}" + fi + fi + # skip subsystem directory + subsys="${full_sysfs_path##*/}" + if [ "$subsys" = "$TYPE" ]; then + : skip subsystem directory + full_sysfs_path="${full_sysfs_path%/*}" + fi + cd $full_sysfs_path + ;; + *) + # old sysfs layout + if [ ! -L $full_sysfs_path/device ]; then + full_sysfs_path="${full_sysfs_path%/*}" + : full_sysfs_path "$full_sysfs_path" + if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ]; then + return + fi + fi + if [ -L $full_sysfs_path/device/device ]; then + cd $full_sysfs_path/device/device + else + cd $full_sysfs_path/device + fi + ;; + esac + full_sysfs_device_path="`pwd -P`" + cd "$OPWD" + + D=$full_sysfs_device_path + while [ ! -z "$D" ] ; do + case "$D" in + */ide[0-9]/[0-9].[0-9]*|*/ide[0-9][0-9]/[0-9][0-9].[0-9]*) + handle_ide "$D" + ;; + */css0/*) + if [ -r $full_sysfs_device_path/wwpn ]; then + read wwpn < $full_sysfs_device_path/wwpn + fi + if [ -r $full_sysfs_device_path/fcp_lun ]; then + read lun < $full_sysfs_device_path/fcp_lun + fi + if [ -r $full_sysfs_device_path/hba_id ]; then + read bus_id < $full_sysfs_device_path/hba_id + fi + if [ "$bus_id" -a "$wwpn" -a "$lun" ]; then + # S/390 zfcp adapter + d="ccw-$bus_id-zfcp-$wwpn:$lun" + RESULT=0 + else + # DASD devices + bus="ccw" + adapter=${D##*/} + d="$bus-$adapter" + RESULT=0 + fi + D= + ;; + */rport-[0-9]*:[0-9]*-[0-9]*/*) + handle_fc "$D" + ;; + */end_device-[0-9]*:[0-9]*:[0-9]*/*) + handle_sas "$D" + ;; + */fw-host[0-9]*/*) + handle_firewire "$D" + ;; + */session[0-9]*/*) + handle_iscsi "$D" + D= + ;; + */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) + handle_scsi "$D" + ;; + */ttyUSB*) + D=${D%/ttyUSB*} + ;; + */usb[0-9]*/[0-9]*/*) + handle_usb "$D" + ;; + */pci[0-9]*:[0-9]*) + handle_pci "$D" + ;; + */serio[0-9]*) + handle_serio "$D" + ;; + */platform/*) + handle_platform "$D" + ;; + */vbd-[0-9]*) + handle_xen "$D" + ;; + */devices) + D= + ;; + *) + : not handled + RESULT=1 + return + ;; + esac + done + if [ "$TYPE" = "scsi_tape" ] ; then + devname=${full_sysfs_path##*/} + rewind="${devname%%st*}" + mode="${devname##*st}" + case "$mode" in + *l) + mode="l" + ;; + *m) + mode="m" + ;; + *a) + mode="a" + ;; + *) + mode="" + ;; + esac + if [ "$d" ]; then + d="$d-${rewind}st${mode}" + fi + fi +} + +handle_device +if [ -z "$d" ]; then + exit 1 +fi +echo "ID_PATH=$d" +exit 0 diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index 30a0115608..968528d845 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -17,7 +17,7 @@ KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$en KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" # by-path (parent device path) -KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p" +KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id.sh %p" KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index e47cf21571..b39ea03321 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -47,7 +47,9 @@ KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}= KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (parent device path) -ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{program}="path_id %p" +# old shell script for fc, sas, iscsi, s390, ide +ENV{DEVTYPE}=="disk", DEVPATH=="*/css0/*|*/rport-[0-9]*|*/end_device-*|*/session[0-9]*|*/ide[0-9]*", IMPORT{program}="path_id.sh %p" +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -- cgit v1.2.3-54-g00ecf From c122b6fadfad94fc66c89390ac2354418a45ded7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Jun 2009 20:30:56 +0200 Subject: path_id: update SCSI handling --- extras/path_id/path_id.c | 134 ++++++++++++++++++++++++++++++----------------- 1 file changed, 87 insertions(+), 47 deletions(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 872f0c932e..603e108aeb 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -134,35 +134,88 @@ out: return number; } -static struct udev_device *handle_scsi(struct udev_device *dev, char **path) +static struct udev_device *handle_fc(struct udev_device *parent, char **path) +{ + path_prepend(path, "fc-PATH_ID_NOT_IMPLEMENTED"); + return parent; +} + +static struct udev_device *handle_sas(struct udev_device *parent, char **path) +{ + path_prepend(path, "sas-PATH_ID_NOT_IMPLEMENTED"); + return parent; +} + +static struct udev_device *handle_iscsi(struct udev_device *parent, char **path) +{ + path_prepend(path, "ip-PATH_ID_NOT_IMPLEMENTED"); + return parent; +} + +static struct udev_device *handle_scsi(struct udev_device *parent, char **path) { - const char *devtype; struct udev_device *hostdev; - const char *name; int host, bus, target, lun; + const char *name; int base; - devtype = udev_device_get_devtype(dev); - if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) - return dev; - - hostdev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_host"); + hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host"); if (hostdev == NULL) - return dev; + return parent; - name = udev_device_get_sysname(dev); + name = udev_device_get_sysname(parent); if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) - return dev; + return parent; /* rebase host offset to get the local relative number */ base = base_number(udev_device_get_syspath(hostdev), "host"); if (base < 0) - return dev; + return parent; host -= base; path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun); - dev = skip_subsystem(dev, "scsi"); - return dev; + return hostdev; +} + +static struct udev_device *handle_scsi_lun(struct udev_device *parent, char **path) +{ + const char *devtype; + const char *name; + const char *id; + + devtype = udev_device_get_devtype(parent); + if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) + return parent; + + /* firewire */ + id = udev_device_get_sysattr_value(parent, "ieee1394_id"); + if (id != NULL) { + path_prepend(path, "ieee1394-0x%s", id); + goto out; + } + + name = udev_device_get_syspath(parent); + + /* fibre channel */ + if (strstr(name, "/rport-") != NULL) { + parent = handle_fc(parent, path); + goto out; + } + + /* sas */ + if (strstr(name, "/end_device-") != NULL) { + parent = handle_sas(parent, path); + goto out; + } + + if (strstr(name, "/session") != NULL) { + parent = handle_iscsi(parent, path); + goto out; + } + + parent = handle_scsi(parent, path); +out: + return parent; } static void handle_scsi_tape(struct udev_device *dev, char **suffix) @@ -176,41 +229,30 @@ static void handle_scsi_tape(struct udev_device *dev, char **suffix) asprintf(suffix, "st%c", name[2]); } -static struct udev_device *handle_usb(struct udev_device *dev, char **path) +static struct udev_device *handle_usb(struct udev_device *parent, char **path) { const char *devtype; const char *str; const char *port; - devtype = udev_device_get_devtype(dev); + devtype = udev_device_get_devtype(parent); if (devtype == NULL || strcmp(devtype, "usb_interface") != 0) - return dev; + return parent; - str = udev_device_get_sysname(dev); + str = udev_device_get_sysname(parent); port = strchr(str, '-'); if (port == NULL) - return dev; + return parent; port++; - dev = skip_subsystem(dev, "usb"); + parent = skip_subsystem(parent, "usb"); path_prepend(path, "usb-0:%s", port); - return dev; + return parent; } -static struct udev_device *handle_firewire(struct udev_device *parent, struct udev_device *dev, char **path) +static struct udev_device *handle_cciss(struct udev_device *parent, char **path) { - struct udev_device *scsi_dev; - - scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); - if (scsi_dev != NULL) { - const char *id; - - id = udev_device_get_sysattr_value(scsi_dev, "ieee1394_id"); - if (id != NULL) - path_prepend(path, "ieee1394-0x%s", id); - } - - parent = skip_subsystem(parent, "firewire"); + path_prepend(path, "cciss-PATH_ID_NOT_IMPLEMENTED"); return parent; } @@ -303,6 +345,14 @@ int main(int argc, char **argv) path = NULL; path_suffix = NULL; + /* S390 ccw bus */ + parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); + if (parent != NULL) { + handle_ccw(parent, dev, &path); + goto out; + } + + /* walk up the chain of devices and compose path */ parent = dev; while (parent != NULL) { const char *subsys; @@ -314,24 +364,14 @@ int main(int argc, char **argv) } else if (strcmp(subsys, "scsi_tape") == 0) { handle_scsi_tape(parent, &path_suffix); } else if (strcmp(subsys, "scsi") == 0) { - parent = handle_scsi(parent, &path); - } else if (strcmp(subsys, "fc_transport") == 0) { - ; //handle_fc(); - } else if (strcmp(subsys, "sas_end_device") == 0) { - ; //handle_sas(); - } else if (strcmp(subsys, "iscsi_session") == 0) { - ; //handle_iscsi() - } else if (strcmp(subsys, "ccw") == 0) { - handle_ccw(parent, dev, &path); + parent = handle_scsi_lun(parent, &path); } else if (strcmp(subsys, "cciss") == 0) { - ; //handle_cciss(); + handle_cciss(parent, &path); } else if (strcmp(subsys, "usb") == 0) { parent = handle_usb(parent, &path); } else if (strcmp(subsys, "serio") == 0) { path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); parent = skip_subsystem(parent, "serio"); - } else if (strcmp(subsys, "firewire") == 0 || strcmp(subsys, "ieee1394") == 0) { - parent = handle_firewire(parent, dev, &path); } else if (strcmp(subsys, "pci") == 0) { path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "pci"); @@ -345,7 +385,7 @@ int main(int argc, char **argv) parent = udev_device_get_parent(parent); } - +out: if (path != NULL) { if (path_suffix != NULL) { printf("ID_PATH=%s%s\n", path, path_suffix); -- cgit v1.2.3-54-g00ecf From ffd0afe8a996f8716e5fa9b58bbd313d98007a2f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Jun 2009 20:36:46 +0200 Subject: path_id: add comments --- extras/path_id/path_id.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 603e108aeb..4531b5e29a 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -190,6 +190,7 @@ static struct udev_device *handle_scsi_lun(struct udev_device *parent, char **pa /* firewire */ id = udev_device_get_sysattr_value(parent, "ieee1394_id"); if (id != NULL) { + parent = skip_subsystem(parent, "scsi"); path_prepend(path, "ieee1394-0x%s", id); goto out; } @@ -208,11 +209,13 @@ static struct udev_device *handle_scsi_lun(struct udev_device *parent, char **pa goto out; } + /* iSCSI */ if (strstr(name, "/session") != NULL) { parent = handle_iscsi(parent, path); goto out; } + /* default */ parent = handle_scsi(parent, path); out: return parent; -- cgit v1.2.3-54-g00ecf From 93ee84ce079c472ef22403c86a3081324d6eef40 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 6 Jun 2009 21:19:56 +0200 Subject: fix signed/unsigned warning --- extras/path_id/path_id.c | 2 +- udev/lib/libudev-monitor.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 4531b5e29a..ce12e92c82 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -28,7 +28,7 @@ #include #include -#include +#include <../../udev/lib/libudev.h> #include <../../udev/udev.h> int debug; diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c index 33a0605492..7a0cb47852 100644 --- a/udev/lib/libudev-monitor.c +++ b/udev/lib/libudev-monitor.c @@ -544,7 +544,7 @@ retry: return NULL; if (nlh->properties_off < sizeof(struct udev_monitor_netlink_header)) return NULL; - if (nlh->properties_off+32U > buflen) + if (nlh->properties_off+32 > buflen) return NULL; bufpos = nlh->properties_off; } else { -- cgit v1.2.3-54-g00ecf From 701a57da317ebf0a641bef2be9a4f77d291e01f5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Jun 2009 01:51:38 +0200 Subject: libudev: enumerate - allow multiple keys with the same name --- udev/lib/libudev-enumerate.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c index c236a1c1b6..63f84062b2 100644 --- a/udev/lib/libudev-enumerate.c +++ b/udev/lib/libudev-enumerate.c @@ -131,7 +131,7 @@ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, cons if (sysattr == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_match_list, sysattr, value, 1, 0) == NULL) + &udev_enumerate->sysattr_match_list, sysattr, value, 0, 0) == NULL) return -ENOMEM; return 0; } @@ -143,7 +143,7 @@ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, co if (sysattr == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_nomatch_list, sysattr, value, 1, 0) == NULL) + &udev_enumerate->sysattr_nomatch_list, sysattr, value, 0, 0) == NULL) return -ENOMEM; return 0; } @@ -180,7 +180,7 @@ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, con if (property == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->properties_match_list, property, value, 1, 0) == NULL) + &udev_enumerate->properties_match_list, property, value, 0, 0) == NULL) return -ENOMEM; return 0; } @@ -228,26 +228,26 @@ static int match_property(struct udev_enumerate *udev_enumerate, const char *sys /* loop over matches */ udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) { + const char *match_key = udev_list_entry_get_name(list_entry); + const char *match_value = udev_list_entry_get_value(list_entry); struct udev_list_entry *property_entry; /* loop over device properties */ udev_list_entry_foreach(property_entry, udev_device_get_properties_list_entry(dev)) { - if (fnmatch(udev_list_entry_get_name(list_entry), udev_list_entry_get_name(property_entry), 0) == 0) { - const char *match_value; - const char *dev_value; - - match_value = udev_list_entry_get_value(list_entry); - dev_value = udev_list_entry_get_value(property_entry); - if (match_value == NULL && dev_value == NULL) { - match = 1; - goto out; - } - if (match_value == NULL || dev_value == NULL) - continue; - if (fnmatch(match_value, dev_value, 0) == 0) { - match = 1; - goto out; - } + const char *dev_key = udev_list_entry_get_name(property_entry); + const char *dev_value = udev_list_entry_get_value(property_entry); + + if (fnmatch(match_key, dev_key, 0) != 0) + continue; + if (match_value == NULL && dev_value == NULL) { + match = 1; + goto out; + } + if (match_value == NULL || dev_value == NULL) + continue; + if (fnmatch(match_value, dev_value, 0) == 0) { + match = 1; + goto out; } } } -- cgit v1.2.3-54-g00ecf From 80381823bc460a48a531c6befd9e8fe3d17813b9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Jun 2009 02:07:54 +0200 Subject: udevadm: trigger - add --property-match=: --- udev/udevadm-trigger.c | 45 ++++++++++++++++++++++++++++----------------- udev/udevadm.xml | 7 +++++++ 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index c256a9e5da..2e9fe6ba96 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -75,6 +75,20 @@ static int scan_failed(struct udev_enumerate *udev_enumerate) return 0; } +static const char *keyval(const char *str, const char **val, char *buf, size_t size) +{ + char *pos; + + util_strscpy(buf, size,str); + pos = strchr(buf, '='); + if (pos != NULL) { + pos[0] = 0; + pos++; + } + *val = pos; + return buf; +} + int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { @@ -87,6 +101,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { "subsystem-nomatch", required_argument, NULL, 'S' }, { "attr-match", required_argument, NULL, 'a' }, { "attr-nomatch", required_argument, NULL, 'A' }, + { "property-match", required_argument, NULL, 'p' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -108,10 +123,11 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) while (1) { int option; - char attr[UTIL_PATH_SIZE]; - char *val; + const char *key; + const char *val; + char buf[UTIL_PATH_SIZE]; - option = getopt_long(argc, argv, "vnFo:t:hce::s:S:a:A:", options, NULL); + option = getopt_long(argc, argv, "vnFo:t:hcp:s:S:a:A:", options, NULL); if (option == -1) break; @@ -149,22 +165,16 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) udev_enumerate_add_nomatch_subsystem(udev_enumerate, optarg); break; case 'a': - util_strscpy(attr, sizeof(attr), optarg); - val = strchr(attr, '='); - if (val != NULL) { - val[0] = 0; - val = &val[1]; - } - udev_enumerate_add_match_sysattr(udev_enumerate, attr, val); + key = keyval(optarg, &val, buf, sizeof(buf)); + udev_enumerate_add_match_sysattr(udev_enumerate, key, val); break; case 'A': - util_strscpy(attr, sizeof(attr), optarg); - val = strchr(attr, '='); - if (val != NULL) { - val[0] = 0; - val = &val[1]; - } - udev_enumerate_add_nomatch_sysattr(udev_enumerate, attr, val); + key = keyval(optarg, &val, buf, sizeof(buf)); + udev_enumerate_add_nomatch_sysattr(udev_enumerate, key, val); + break; + case 'p': + key = keyval(optarg, &val, buf, sizeof(buf)); + udev_enumerate_add_match_property(udev_enumerate, key, val); break; case 'h': printf("Usage: udevadm trigger OPTIONS\n" @@ -180,6 +190,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) " --subsystem-nomatch= exclude devices from a matching subystem\n" " --attr-match=]> trigger devices with a matching attribute\n" " --attr-nomatch=]> exclude devices with a matching attribute\n" + " --property-match== trigger devices with a matching property\n" " --help\n\n"); goto exit; default: diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 2e03d9886e..2447367844 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -210,6 +210,13 @@ of the sysfs attribute is checked. This option can be specified multiple times. + + + + Trigger events for devices with a matching propery value. This option can be + specified multiple times and supports shell style pattern matching. + + -- cgit v1.2.3-54-g00ecf From 0254b2118f123504c268edb0b382c587ac15aaa3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Jun 2009 02:39:54 +0200 Subject: udevadm: info - accept --query without a value and print properties --- udev/udevadm-info.c | 39 ++++++++++++++++----------------------- udev/udevadm.xml | 2 +- 2 files changed, 17 insertions(+), 24 deletions(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index b743a1d642..2ffce27ed7 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -221,7 +221,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) static const struct option options[] = { { "name", required_argument, NULL, 'n' }, { "path", required_argument, NULL, 'p' }, - { "query", required_argument, NULL, 'q' }, + { "query", optional_argument, NULL, 'q' }, { "attribute-walk", no_argument, NULL, 'a' }, { "export-db", no_argument, NULL, 'e' }, { "root", no_argument, NULL, 'r' }, @@ -246,7 +246,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) QUERY_NAME, QUERY_PATH, QUERY_SYMLINK, - QUERY_ENV, + QUERY_PROPERTY, QUERY_ALL, } query = QUERY_NONE; @@ -254,7 +254,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) int option; struct stat statbuf; - option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); + option = getopt_long(argc, argv, "aed:n:p:q::rxPVh", options, NULL); if (option == -1) break; @@ -317,29 +317,22 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) break; case 'q': action = ACTION_QUERY; - if (strcmp(optarg, "name") == 0) { + if (optarg == NULL || strcmp(optarg, "property") == 0 || strcmp(optarg, "env") == 0) { + query = QUERY_PROPERTY; + } else if (strcmp(optarg, "name") == 0) { query = QUERY_NAME; - break; - } - if (strcmp(optarg, "symlink") == 0) { + } else if (strcmp(optarg, "symlink") == 0) { query = QUERY_SYMLINK; - break; - } - if (strcmp(optarg, "path") == 0) { + } else if (strcmp(optarg, "path") == 0) { query = QUERY_PATH; - break; - } - if (strcmp(optarg, "env") == 0) { - query = QUERY_ENV; - break; - } - if (strcmp(optarg, "all") == 0) { + } else if (strcmp(optarg, "all") == 0) { query = QUERY_ALL; - break; + } else { + fprintf(stderr, "unknown query type\n"); + rc = 3; + goto exit; } - fprintf(stderr, "unknown query type\n"); - rc = 3; - goto exit; + break; case 'r': if (action == ACTION_NONE) action = ACTION_ROOT; @@ -370,7 +363,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) " name name of device node\n" " symlink pointing to node\n" " path sys device path\n" - " env the device related imported environment\n" + " property the device properties\n" " all all values\n" " --path= sys device path used for query or attribute walk\n" " --name= node or symlink name used for query or attribute walk\n" @@ -432,7 +425,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case QUERY_PATH: printf("%s\n", udev_device_get_devpath(device)); goto exit; - case QUERY_ENV: + case QUERY_PROPERTY: list_entry = udev_device_get_properties_list_entry(device); while (list_entry != NULL) { printf("%s=%s\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 2447367844..093dd21428 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -90,7 +90,7 @@ or to identify the specified device. Valid queries are: name, symlink, path, - env, all. + property, all. -- cgit v1.2.3-54-g00ecf From 5654503680ac8381e2acbf9f6c91512ccd47f950 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Jun 2009 02:53:35 +0200 Subject: udevadm: control - --env -> --property --- udev/udevadm-control.c | 9 +++++---- udev/udevadm.xml | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 50020b57d9..3fe41977c5 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -34,7 +34,7 @@ static void print_help(void) " --stop-exec-queue keep udevd from executing events, queue only\n" " --start-exec-queue execute events, flush queue\n" " --reload-rules reloads the rules files\n" - " --env== set a global environment variable\n" + " --property== set a global property for all events\n" " --max-childs= maximum number of childs\n" " --help print this help text\n\n"); } @@ -54,7 +54,8 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) { "start_exec_queue", no_argument, NULL, 'S' + 256}, { "reload-rules", no_argument, NULL, 'R' }, { "reload_rules", no_argument, NULL, 'R' + 256}, - { "env", required_argument, NULL, 'e' }, + { "property", required_argument, NULL, 'p' }, + { "env", required_argument, NULL, 'p' }, { "max-childs", required_argument, NULL, 'm' }, { "max_childs", required_argument, NULL, 'm' + 256}, { "help", no_argument, NULL, 'h' }, @@ -75,7 +76,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) int i; char *endp; - option = getopt_long(argc, argv, "l:sSRe:m:M:h", options, NULL); + option = getopt_long(argc, argv, "l:sSRp:m:M:h", options, NULL); if (option == -1) break; @@ -112,7 +113,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) udev_ctrl_send_reload_rules(uctrl); rc = 0; break; - case 'e': + case 'p': if (strchr(optarg, '=') == NULL) { fprintf(stderr, "expect = instead of '%s'\n", optarg); goto exit; diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 093dd21428..4377b20d27 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -298,9 +298,9 @@ - + - Set global variable. + Set a global property for all events. -- cgit v1.2.3-54-g00ecf From b0d5e0df3e193a3beb4514a430c7ba62114845b6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Jun 2009 03:07:33 +0200 Subject: udevadm: monitor --environment -> --property --- udev/udevadm-monitor.c | 20 +++++++++++--------- udev/udevadm.xml | 15 +++++++-------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 1f0946114d..73516069ba 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -41,7 +41,7 @@ static void sig_handler(int signum) udev_exit = 1; } -static void print_device(struct udev_device *device, const char *source, int env) +static void print_device(struct udev_device *device, const char *source, int prop) { struct timeval tv; struct timezone tz; @@ -53,7 +53,7 @@ static void print_device(struct udev_device *device, const char *source, int env udev_device_get_action(device), udev_device_get_devpath(device), udev_device_get_subsystem(device)); - if (env) { + if (prop) { struct udev_list_entry *list_entry; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) @@ -68,7 +68,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) { struct sigaction act; int option; - int env = 0; + int prop = 0; int print_kernel = 0; int print_udev = 0; struct udev_list_node subsystem_match_list; @@ -78,6 +78,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) int rc = 0; static const struct option options[] = { + { "property", no_argument, NULL, 'p' }, { "environment", no_argument, NULL, 'e' }, { "kernel", no_argument, NULL, 'k' }, { "udev", no_argument, NULL, 'u' }, @@ -88,13 +89,14 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) udev_list_init(&subsystem_match_list); while (1) { - option = getopt_long(argc, argv, "ekus:h", options, NULL); + option = getopt_long(argc, argv, "epkus:h", options, NULL); if (option == -1) break; switch (option) { + case 'p': case 'e': - env = 1; + prop = 1; break; case 'k': print_kernel = 1; @@ -117,8 +119,8 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) break; } case 'h': - printf("Usage: udevadm monitor [--environment] [--kernel] [--udev] [--help]\n" - " --env print the whole event environment\n" + printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" + " --property print the event properties\n" " --kernel print kernel uevents\n" " --udev print udev events\n" " --subsystem-match= filter events\n" @@ -216,7 +218,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) device = udev_monitor_receive_device(kernel_monitor); if (device == NULL) continue; - print_device(device, "KERNEL", env); + print_device(device, "KERNEL", prop); udev_device_unref(device); } @@ -226,7 +228,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) device = udev_monitor_receive_device(udev_monitor); if (device == NULL) continue; - print_device(device, "UDEV", env); + print_device(device, "UDEV", prop); udev_device_unref(device); } } diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 4377b20d27..64e6f2aeb9 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -213,7 +213,7 @@ - Trigger events for devices with a matching propery value. This option can be + Trigger events for devices with a matching property value. This option can be specified multiple times and supports shell style pattern matching. @@ -325,13 +325,6 @@ event timing, by comparing the timestamps of the kernel uevent and the udev event. - - - - Print the complete environment for all events. Can be used to compare the - kernel supplied and the udev added environment values. - - @@ -344,6 +337,12 @@ Print the udev event after the rule processing. + + + + Also print the properties of the event. + + -- cgit v1.2.3-54-g00ecf From 7f011f6bf242b01ab684b13583590e529ff6acde Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Jun 2009 14:56:49 +0200 Subject: path_id: handle fibre channel --- extras/path_id/path_id.c | 35 ++++++++++++++++++++++++++++++- rules/rules.d/60-persistent-storage.rules | 4 ++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index ce12e92c82..379334f02f 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -136,7 +136,40 @@ out: static struct udev_device *handle_fc(struct udev_device *parent, char **path) { - path_prepend(path, "fc-PATH_ID_NOT_IMPLEMENTED"); + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *targetdev = NULL; + char *syspath = NULL; + struct udev_device *fcdev; + const char *port; + unsigned int lun; + + targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); + if (targetdev == NULL) { + parent = NULL; + goto out; + } + + if (asprintf(&syspath, "%s/fc_transport/%s", udev_device_get_syspath(targetdev), udev_device_get_sysname(targetdev)) < 0) { + parent = NULL; + goto out; + } + fcdev = udev_device_new_from_syspath(udev, syspath); + if (fcdev == NULL) { + parent = NULL; + goto out; + } + + port = udev_device_get_sysattr_value(fcdev, "port_name"); + if (port == NULL) { + parent = NULL; + goto out; + } + + lun = strtoul(udev_device_get_sysnum(parent), NULL, 10); + path_prepend(path, "fc-%s:0x%04x%04x00000000", port, lun & 0xffff, (lun >> 16) & 0xffff); +out: + free(syspath); + udev_device_unref(fcdev); return parent; } diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index b39ea03321..f4ac6a0277 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -47,8 +47,8 @@ KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}= KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (parent device path) -# old shell script for fc, sas, iscsi, s390, ide -ENV{DEVTYPE}=="disk", DEVPATH=="*/css0/*|*/rport-[0-9]*|*/end_device-*|*/session[0-9]*|*/ide[0-9]*", IMPORT{program}="path_id.sh %p" +# old shell script for sas, iscsi, ide +ENV{DEVTYPE}=="disk", DEVPATH=="*/end_device-*|*/session[0-9]*|*/ide[0-9]*", IMPORT{program}="path_id.sh %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -- cgit v1.2.3-54-g00ecf From a2fe9450bba1c57ddf17c5f94795c035d9ff3b65 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Jun 2009 16:48:27 +0200 Subject: path_id: add iscsi support --- extras/path_id/path_id.c | 85 ++++++++++++++++++++++--------- rules/rules.d/60-persistent-storage.rules | 4 +- 2 files changed, 64 insertions(+), 25 deletions(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 379334f02f..b0a0bfd885 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -137,28 +137,18 @@ out: static struct udev_device *handle_fc(struct udev_device *parent, char **path) { struct udev *udev = udev_device_get_udev(parent); - struct udev_device *targetdev = NULL; - char *syspath = NULL; - struct udev_device *fcdev; + struct udev_device *targetdev; + struct udev_device *fcdev = NULL; const char *port; unsigned int lun; targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); - if (targetdev == NULL) { - parent = NULL; - goto out; - } - - if (asprintf(&syspath, "%s/fc_transport/%s", udev_device_get_syspath(targetdev), udev_device_get_sysname(targetdev)) < 0) { - parent = NULL; - goto out; - } - fcdev = udev_device_new_from_syspath(udev, syspath); - if (fcdev == NULL) { - parent = NULL; - goto out; - } + if (targetdev == NULL) + return NULL; + fcdev = udev_device_new_from_subsystem_sysname(udev, "fc_transport", udev_device_get_sysname(targetdev)); + if (fcdev == NULL) + return NULL; port = udev_device_get_sysattr_value(fcdev, "port_name"); if (port == NULL) { parent = NULL; @@ -168,20 +158,69 @@ static struct udev_device *handle_fc(struct udev_device *parent, char **path) lun = strtoul(udev_device_get_sysnum(parent), NULL, 10); path_prepend(path, "fc-%s:0x%04x%04x00000000", port, lun & 0xffff, (lun >> 16) & 0xffff); out: - free(syspath); udev_device_unref(fcdev); return parent; } static struct udev_device *handle_sas(struct udev_device *parent, char **path) { - path_prepend(path, "sas-PATH_ID_NOT_IMPLEMENTED"); - return parent; + return NULL; } static struct udev_device *handle_iscsi(struct udev_device *parent, char **path) { - path_prepend(path, "ip-PATH_ID_NOT_IMPLEMENTED"); + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *transportdev; + struct udev_device *sessiondev = NULL; + const char *target; + char *connname; + struct udev_device *conndev = NULL; + const char *addr; + const char *port; + + /* find iscsi session */ + transportdev = parent; + while (1) { + transportdev = udev_device_get_parent(transportdev); + if (transportdev == NULL) + return NULL; + if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0) + break; + } + if (transportdev == NULL) + return NULL; + + /* find iscsi session device */ + sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev)); + if (sessiondev == NULL) + return NULL; + target = udev_device_get_sysattr_value(sessiondev, "targetname"); + if (target == NULL) { + parent = NULL; + goto out; + } + + if (asprintf(&connname, "connection%s:0", udev_device_get_sysnum(transportdev)) < 0) { + parent = NULL; + goto out; + } + conndev = udev_device_new_from_subsystem_sysname(udev, "iscsi_connection", connname); + free(connname); + if (conndev == NULL) { + parent = NULL; + goto out; + } + addr = udev_device_get_sysattr_value(conndev, "persistent_address"); + port = udev_device_get_sysattr_value(conndev, "persistent_port"); + if (addr == NULL || port == NULL) { + parent = NULL; + goto out; + } + + path_prepend(path, "ip-%s:%s-iscsi-%s-lun-%s", addr, port, target, udev_device_get_sysnum(parent)); +out: + udev_device_unref(sessiondev); + udev_device_unref(conndev); return parent; } @@ -228,6 +267,7 @@ static struct udev_device *handle_scsi_lun(struct udev_device *parent, char **pa goto out; } + /* broken scsi transport devices would need a subsystem */ name = udev_device_get_syspath(parent); /* fibre channel */ @@ -288,8 +328,7 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path) static struct udev_device *handle_cciss(struct udev_device *parent, char **path) { - path_prepend(path, "cciss-PATH_ID_NOT_IMPLEMENTED"); - return parent; + return NULL; } static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index f4ac6a0277..9c46a14de5 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -47,8 +47,8 @@ KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}= KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (parent device path) -# old shell script for sas, iscsi, ide -ENV{DEVTYPE}=="disk", DEVPATH=="*/end_device-*|*/session[0-9]*|*/ide[0-9]*", IMPORT{program}="path_id.sh %p" +# old shell script for sas, ide +ENV{DEVTYPE}=="disk", DEVPATH=="*/end_device-*|*/ide[0-9]*", IMPORT{program}="path_id.sh %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -- cgit v1.2.3-54-g00ecf From 33a76159433a5763ff6050cfaaee8fd897102639 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Jun 2009 16:51:13 +0200 Subject: path_id: delete old shell script Removed with this is SAS disk support which never really worked properly, and legacy IDE disk support, which can be re-implemented if needed. --- extras/path_id/Makefile.am | 3 - extras/path_id/path_id.sh | 601 ------------------------------ rules/rules.d/60-persistent-storage.rules | 2 - 3 files changed, 606 deletions(-) delete mode 100755 extras/path_id/path_id.sh diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am index 2e936234ff..5d4bf6283d 100644 --- a/extras/path_id/Makefile.am +++ b/extras/path_id/Makefile.am @@ -1,9 +1,6 @@ include $(top_srcdir)/Makefile.am.inc udevhomedir = $(udev_prefix)/lib/udev -dist_udevhome_SCRIPTS = \ - path_id.sh - udevhome_PROGRAMS = \ path_id diff --git a/extras/path_id/path_id.sh b/extras/path_id/path_id.sh deleted file mode 100755 index 7b4973fa03..0000000000 --- a/extras/path_id/path_id.sh +++ /dev/null @@ -1,601 +0,0 @@ -#!/bin/sh - -# provide the shortest possible unique hardware path to a device -# for the Linux Persistent Device Naming scheme -# -# Copyright (C) 2005-2006 SUSE Linux Products GmbH -# Author: -# Hannes Reinecke -# -# 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. - -SYSFS=/sys -RESULT=1 -TYPE= -OPWD="`pwd`" -full_sysfs_path= -full_sysfs_device_path= - -if [ -z "$DEVPATH" -a -z "$1" ] ; then - exit 1 -fi - -if [ -z "$DEVPATH" ] ; then - case "$1" in - $SYSFS/*) - DEVPATH="${1#$SYSFS}" - ;; - *) - DEVPATH=$1 - ;; - esac -fi - -if [ ! -e $SYSFS$DEVPATH/dev ] ; then - exit 1 -fi - -case "$DEVPATH" in - /devices/*) - cd "$SYSFS$DEVPATH/subsystem"; - TYPE="`pwd -P`" - cd "$OPWD" - TYPE="${TYPE##*/}" - ;; - /class/*) - TYPE="${DEVPATH#/class/}" - TYPE="${TYPE%%/*}" - ;; - /block/*) - TYPE=block - ;; - *) - exit 1 - ;; -esac - -get_port_offset () { - local type offset port - type=$1 - offset=$2 - for i in $type[0-9]* ; do - : i $i - port="${i#$type}" - if [ "$port" -lt "$offset" ] ; then offset=$port ; fi - done - echo $offset -} - -handle_pci () { - local DEV=$1 - cd -P $1 - DEV=${PWD} - pci_id=${DEV##*/} - host_dev_path=$DEV - - # cciss devices don't have a separate sysfs node - for blk_link in block*; do - if [ -L "$blk_link" ]; then - case "$blk_link" in - *cciss*) - d=cciss-${blk_link#*cciss\!} - ;; - esac - fi - done - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */pci[0-9]*) - host_dev_path=${host_dev_path%/*} - ;; - *) - break - ;; - esac - done - if [ "$d" ]; then - d="pci-$pci_id-$d" - else - d="pci-$pci_id" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_platform () { - local DEV=$1 - cd -P $1 - DEV=${PWD} - platform_id=${DEV##*/} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */platform*) - host_dev_path=${host_dev_path%/*} - ;; - *) - break - ;; - esac - done - if [ "$d" ]; then - d="platform-$platform_id-$d" - else - d="platform-$platform_id" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_xen () { - local DEV=$1 - cd -P $1 - vbd_id=${DEV##*/} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */vbd*) - host_dev_path=${host_dev_path%/*} - ;; - *) - break - ;; - esac - done - if [ "$d" ]; then - d="xen-$vbd_id-$d" - else - d="xen-$vbd_id" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_serio () { - local DEV=$1 - cd -P $1 - DEV=${PWD} - serio_id=${DEV##*/serio} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */serio*) - host_dev_path=${host_dev_path%/*} - ;; - *) - break - ;; - esac - done - if [ "$d" ]; then - d="serio-$serio_id-$d" - else - d="serio-$serio_id" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_ide () { - : handle_ide $* - local DEV=$1 - local port idedev idecontroller - # IDE - : DEV $DEV - port=${DEV##*/} - idedev=${DEV%/*} - idecontroller=${idedev%/*} - # port info if the controller has more than one interface - port="${port#ide}" - : port $port d $d - : idedev $idedev kernel_port $port - case "${port#*.}" in - 0) - channel=0 - ;; - 1) - channel=1 - ;; - *) - echo "Error: $idedev is neither master or slave" >&2 - ;; - esac - cd $idecontroller - offset="`get_port_offset ide ${port%.*}`" - cd "$OPWD" - : port offset $offset - port=$((${port%.*} - $offset)) - if [ "$d" ] ; then - d="ide-${port}:$channel-$d" - else - d="ide-${port}:$channel" - fi - D=$idecontroller - RESULT=0 -} - -handle_scsi () { - : handle_scsi $* - local DEV=$1 - local cil controller_port controller_dev - # SCSI device - cil="${DEV##*/}" - cil="${cil#*:}" - target_dev=${DEV%/*} - target_id=${target_dev##*/target} - cd "$target_dev" - target_num=0 - for tid in ${target_id}* ; do - target_num=$(( $target_num + 1 )) - done - controller_port=${target_dev%/*} - controller_dev="${controller_port%/*}" - : controller_dev $controller_dev - : controller_port $controller_port - # a host controller may have more than one interface/port - controller_port="${controller_port##*/host}" - # - cd "$controller_dev" - controller_offset=$(get_port_offset host $controller_port) - cd "$OPWD" - controller_port=$(( $controller_port - $controller_offset)) - scsi_id="scsi-${controller_port}:${cil}" - if [ "$d" ] ; then - d="${scsi_id}-$d" - else - d="$scsi_id" - fi - D="$controller_dev" - RESULT=0 -} - -handle_firewire () { - : handle_firewire $* - local DEV=$1 - if [ -f "$D/ieee1394_id" ] ; then - read ieee1394_id < $D/ieee1394_id - fi - if [ -z "$ieee1394_id" ] ; then - : no IEEE1394 ID - RESULT=1 - return - fi - fw_host_dev=${DEV%/fw-host*} - # IEEE1394 devices are always endpoints - d="ieee1394-0x$ieee1394_id" - D="$fw_host_dev" - RESULT=0 -} - -handle_fc () { - : handle_fc $* - local DEV=$1 - local cil controller_port controller_dev - # SCSI-FC device - fc_tgt_hcil="${DEV##*/}" - fc_tgt_lun="${fc_tgt_hcil##*:}" - fc_tgt_path="${DEV%/*}" - fc_tgt_num="${fc_tgt_path##*/}" - fc_tgt_dev="${fc_tgt_path}/fc_transport/${fc_tgt_num}" - if [ -e "$fc_tgt_dev/port_name" ]; then - read wwpn < $fc_tgt_dev/port_name - fi - if [ -z "$wwpn" ] ; then - : no WWPN - D= - RESULT=1 - return - fi - # Linux currently knows about 32bit luns - tmp_lun3=$(printf "%04x" $(($fc_tgt_lun & 0xFFFF))) - tmp_lun2=$(printf "%04x" $(( ($fc_tgt_lun >> 16) & 0xFFFF))) - tmp_lun1="0000" - tmp_lun0="0000" - if (($fc_tgt_lun == 0)) ; then - lun="0x0000000000000000" - else - lun="0x${tmp_lun3}${tmp_lun2}${tmp_lun1}${tmp_lun0}" - fi - controller_dev="${fc_tgt_path%/host[0-9]*}" - # FC devices are always endpoints - d="fc-${wwpn}:${lun}" - D="$controller_dev" - RESULT=0 -} - -handle_sas () { - : handle_sas $* - local DEV=$1 - local cil adapter controller_dev - local lun - lun=${DEV##*:} - # SAS device - sas_end_path="${DEV%%/target*}" - sas_host_path="${sas_end_path%%/port*}" - sas_phy_path="${sas_end_path#*/host*/}" - sas_phy_path="${sas_phy_path%%/*}" - sas_phy_path="${sas_host_path}/${sas_phy_path}" - - sas_phy_id=255 - for phy in $sas_phy_path/phy-*/sas_phy/phy-* ; do - if [ -d "$phy" ] ; then - read phy_id < $phy/phy_identifier - if [ $phy_id -lt $sas_phy_id ]; then - sas_phy_id=$phy_id - fi - fi - done - - if [ $sas_phy_id -eq 255 ] ; then - : no initiator address - D= - RESULT=1 - return - fi - - sas_port_id="${sas_phy_path##*/port-}" - sas_port_dev="/sys/class/sas_port/port-${sas_port_id}" - if [ -e "$sas_port_dev/num_phys" ] ; then - read phy_port < $sas_port_dev/num_phys - fi - - sas_end_id="${sas_end_path##*end_device-}" - sas_end_dev="/sys/class/sas_device/end_device-${sas_end_id}" - if [ -e "$sas_end_dev/sas_address" ]; then - read end_address < $sas_end_dev/sas_address - read end_id < $sas_end_dev/phy_identifier - fi - if [ -z "$end_address" ] ; then - : no end device address - D= - RESULT=1 - return - fi - sas_end_address="$end_address:$end_id" - controller_dev="${sas_host_path%/host[0-9]*}" - # SAS devices are always endpoints - d="sas-phy${sas_phy_id}:${phy_port}-${sas_end_address}-lun$lun" - D="$controller_dev" - RESULT=0 -} - -handle_iscsi() { - local DEV=$1 - local iscsi_session_dir - local iscsi_session iscsi_session_path - local iscsi_connection iscsi_connection_path - local iscsi_scsi_lun - # iSCSI device - iscsi_session_dir="${DEV%%/target*}" - iscsi_session="${iscsi_session_dir##*/}" - iscsi_session_path=/sys/class/iscsi_session/${iscsi_session} - if [ ! -d "$iscsi_session_path" ] ; then - : no iSCSI session path - RESULT=1 - return - fi - # Currently we're not doing MC/S - for conn in ${iscsi_session_dir}/connection* ; do - iscsi_conn_num=${conn##*:} - if [ "$iscsi_conn_num" = '0' ] ; then - iscsi_connection=$(basename $conn) - fi - done - if [ -z "$iscsi_connection" ] ; then - : no iSCSI connection found - RESULT=1 - return - fi - iscsi_connection_path=/sys/class/iscsi_connection/${iscsi_connection} - if [ ! -d "$iscsi_connection_path" ] ; then - : no iSCSI connection path - RESULT=1 - return - fi - if [ -e "${iscsi_session_path}/targetname" ]; then - read iscsi_tgtname < ${iscsi_session_path}/targetname - fi - if [ -z "$iscsi_tgtname" ] ; then - : No iSCSI Targetname - RESULT=1 - return - fi - if [ -e "${iscsi_connection_path}/persistent_address" ] ; then - read iscsi_address < ${iscsi_connection_path}/persistent_address - fi - if [ -z "$iscsi_address" ] ; then - : No iSCSI Target address - RESULT=1 - return - fi - if [ -e "${iscsi_connection_path}/persistent_port" ] ; then - read iscsi_port < ${iscsi_connection_path}/persistent_port - fi - iscsi_scsi_lun="${DEV##*:}" - d="ip-${iscsi_address}:${iscsi_port}-iscsi-${iscsi_tgtname}-lun-${iscsi_scsi_lun}" - RESULT=0 -} - -handle_usb () { -: handle_usb $* - local DEV=$1 - cd -P $1 - DEV=${PWD} - port_id=${DEV##*/} - port_num=${port_id#*-} - host_dev_path=$DEV - while [ ! -z "$host_dev_path" ] ; do - case "$host_dev_path" in - */usb*) - usb_host_path=$host_dev_path - host_dev_path="${host_dev_path%/*}" - ;; - *) - break - ;; - esac - done - : host_dev_path $host_dev_path - usb_host_num=${usb_host_path##*/usb} - - cd "$host_dev_path" - usb_host_offset=$(get_port_offset usb $usb_host_num) - usb_host_port=$(($usb_host_num - $usb_host_offset)) - cd "$OPWD" - if [ "$d" ] ; then - d="usb-$usb_host_port:$port_num-${d}" - else - d="usb-$usb_host_port:$port_num" - fi - D="$host_dev_path" - RESULT=0 -} - -handle_device () { - full_sysfs_path="$SYSFS$DEVPATH" - case "$DEVPATH" in - /devices/*) - full_sysfs_path="${full_sysfs_path%/*}" - # skip parent device of the same subsystem - if [ -L $full_sysfs_path/subsystem ]; then - cd "$full_sysfs_path/subsystem"; - subsys="`pwd -P`" - cd "$OPWD" - subsys="${subsys##*/}" - if [ "$subsys" = "$TYPE" ]; then - : skip same subsystem parent - full_sysfs_path="${full_sysfs_path%/*}" - fi - fi - # skip subsystem directory - subsys="${full_sysfs_path##*/}" - if [ "$subsys" = "$TYPE" ]; then - : skip subsystem directory - full_sysfs_path="${full_sysfs_path%/*}" - fi - cd $full_sysfs_path - ;; - *) - # old sysfs layout - if [ ! -L $full_sysfs_path/device ]; then - full_sysfs_path="${full_sysfs_path%/*}" - : full_sysfs_path "$full_sysfs_path" - if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ]; then - return - fi - fi - if [ -L $full_sysfs_path/device/device ]; then - cd $full_sysfs_path/device/device - else - cd $full_sysfs_path/device - fi - ;; - esac - full_sysfs_device_path="`pwd -P`" - cd "$OPWD" - - D=$full_sysfs_device_path - while [ ! -z "$D" ] ; do - case "$D" in - */ide[0-9]/[0-9].[0-9]*|*/ide[0-9][0-9]/[0-9][0-9].[0-9]*) - handle_ide "$D" - ;; - */css0/*) - if [ -r $full_sysfs_device_path/wwpn ]; then - read wwpn < $full_sysfs_device_path/wwpn - fi - if [ -r $full_sysfs_device_path/fcp_lun ]; then - read lun < $full_sysfs_device_path/fcp_lun - fi - if [ -r $full_sysfs_device_path/hba_id ]; then - read bus_id < $full_sysfs_device_path/hba_id - fi - if [ "$bus_id" -a "$wwpn" -a "$lun" ]; then - # S/390 zfcp adapter - d="ccw-$bus_id-zfcp-$wwpn:$lun" - RESULT=0 - else - # DASD devices - bus="ccw" - adapter=${D##*/} - d="$bus-$adapter" - RESULT=0 - fi - D= - ;; - */rport-[0-9]*:[0-9]*-[0-9]*/*) - handle_fc "$D" - ;; - */end_device-[0-9]*:[0-9]*:[0-9]*/*) - handle_sas "$D" - ;; - */fw-host[0-9]*/*) - handle_firewire "$D" - ;; - */session[0-9]*/*) - handle_iscsi "$D" - D= - ;; - */host[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*) - handle_scsi "$D" - ;; - */ttyUSB*) - D=${D%/ttyUSB*} - ;; - */usb[0-9]*/[0-9]*/*) - handle_usb "$D" - ;; - */pci[0-9]*:[0-9]*) - handle_pci "$D" - ;; - */serio[0-9]*) - handle_serio "$D" - ;; - */platform/*) - handle_platform "$D" - ;; - */vbd-[0-9]*) - handle_xen "$D" - ;; - */devices) - D= - ;; - *) - : not handled - RESULT=1 - return - ;; - esac - done - if [ "$TYPE" = "scsi_tape" ] ; then - devname=${full_sysfs_path##*/} - rewind="${devname%%st*}" - mode="${devname##*st}" - case "$mode" in - *l) - mode="l" - ;; - *m) - mode="m" - ;; - *a) - mode="a" - ;; - *) - mode="" - ;; - esac - if [ "$d" ]; then - d="$d-${rewind}st${mode}" - fi - fi -} - -handle_device -if [ -z "$d" ]; then - exit 1 -fi -echo "ID_PATH=$d" -exit 0 diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 9c46a14de5..6688a3958e 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -47,8 +47,6 @@ KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}= KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (parent device path) -# old shell script for sas, ide -ENV{DEVTYPE}=="disk", DEVPATH=="*/end_device-*|*/ide[0-9]*", IMPORT{program}="path_id.sh %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{program}="path_id %p" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" -- cgit v1.2.3-54-g00ecf From 45798927f8532cd412622e9762619b46a9b638cd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Jun 2009 17:16:48 +0200 Subject: udevd: print error if worker dies unexpectedly --- TODO | 3 +-- udev/lib/libudev.h | 2 +- udev/udevd.c | 27 +++++++++++++++++++-------- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/TODO b/TODO index dfbb18d0cc..af745ff5a2 100644 --- a/TODO +++ b/TODO @@ -1,10 +1,9 @@ - o kill path_id.sh (add fc, sas, iscsi to C version) + o enumerate: sort control* after pcm* o add tests for kernel provided DEVNAME logic o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) o remove MMC rules, they got a modalias now (2.6.30) o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30) - o drop all support for the DEPRECATED sysfs layout o "udevadm control" commands will only accept the -- syntax o symlink names to udevadm will no longer be resolved to old command names diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 207dd821a6..63cb478b8f 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -74,7 +74,7 @@ const char *udev_device_get_action(struct udev_device *udev_device); unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); -/* udev and kernel device events */ +/* device events */ struct udev_monitor; struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); diff --git a/udev/udevd.c b/udev/udevd.c index 2e7a179cbc..e7a0c9840a 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -159,6 +159,7 @@ static void event_queue_delete(struct event *event) else udev_queue_export_device_finished(udev_queue_export, event->dev); + info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); udev_device_unref(event->dev); free(event); } @@ -271,7 +272,7 @@ static void worker_new(struct event *event) /* send processed event back to libudev listeners */ udev_monitor_send_device(worker_monitor, NULL, dev); - info(event->udev, "seq %llu finished with %i\n", udev_device_get_seqnum(dev), err); + info(event->udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); udev_device_unref(dev); udev_event_unref(udev_event); @@ -617,7 +618,7 @@ static int handle_inotify(struct udev *udev) buf = malloc(nbytes); if (buf == NULL) { - err(udev, "error getting buffer for inotify, disable watching\n"); + err(udev, "error getting buffer for inotify\n"); return -1; } @@ -659,7 +660,7 @@ static int handle_inotify(struct udev *udev) return 0; } -static void handle_signal(int signo) +static void handle_signal(struct udev *udev, int signo) { switch (signo) { case SIGINT: @@ -669,9 +670,10 @@ static void handle_signal(int signo) case SIGCHLD: while (1) { pid_t pid; + int status; struct udev_list_node *loop, *tmp; - pid = waitpid(-1, NULL, WNOHANG); + pid = waitpid(-1, &status, WNOHANG); if (pid <= 0) break; @@ -683,7 +685,16 @@ static void handle_signal(int signo) /* fail event, if worker died unexpectedly */ if (worker->event != NULL) { - worker->event->exitcode = 127; + int exitcode; + + if (WIFEXITED(status)) + exitcode = WEXITSTATUS(status); + else if (WIFSIGNALED(status)) + exitcode = WTERMSIG(status) + 128; + else + exitcode = 0; + worker->event->exitcode = exitcode; + err(udev, "worker [%u] unexpectedly returned with %i\n", pid, exitcode); event_queue_delete(worker->event); } @@ -938,9 +949,9 @@ int main(int argc, char *argv[]) /* OOM_DISABLE == -17 */ fd = open("/proc/self/oom_adj", O_RDWR); - if (fd < 0) + if (fd < 0) { err(udev, "error disabling OOM: %m\n"); - else { + } else { write(fd, "-17", 3); close(fd); } @@ -1010,7 +1021,7 @@ int main(int argc, char *argv[]) size = read(pfd[FD_SIGNAL].fd, &fdsi, sizeof(struct signalfd_siginfo)); if (size == sizeof(struct signalfd_siginfo)) - handle_signal(fdsi.ssi_signo); + handle_signal(udev, fdsi.ssi_signo); } /* device node and rules directory inotify watch */ -- cgit v1.2.3-54-g00ecf From 67dd1cdf9d42497c5e164549cd5f67a7ee62e796 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Jun 2009 19:22:53 +0200 Subject: path_id: rename scsi sub-fuctions --- extras/path_id/path_id.c | 126 ++++++++++++++++++++++------------------------- 1 file changed, 58 insertions(+), 68 deletions(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index b0a0bfd885..08b7e150c9 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -89,52 +89,7 @@ static struct udev_device *skip_subsystem(struct udev_device *dev, const char *s return dev; } -/* find smallest number of instances of / */ -static int base_number(const char *syspath, const char *name) -{ - char *base; - char *pos; - DIR *dir; - struct dirent *dent; - size_t len; - int number = -1; - - base = strdup(syspath); - if (base == NULL) - goto out; - - pos = strrchr(base, '/'); - if (pos == NULL) - goto out; - pos[0] = '\0'; - - len = strlen(name); - dir = opendir(base); - if (dir == NULL) - goto out; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char *rest; - int i; - - if (dent->d_name[0] == '.') - continue; - if (dent->d_type != DT_DIR && dent->d_type != DT_LNK) - continue; - if (strncmp(dent->d_name, name, len) != 0) - continue; - i = strtoul(&dent->d_name[len], &rest, 10); - if (rest[0] != '\0') - continue; - if (number == -1 || i < number) - number = i; - } - closedir(dir); -out: - free(base); - return number; -} - -static struct udev_device *handle_fc(struct udev_device *parent, char **path) +static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) { struct udev *udev = udev_device_get_udev(parent); struct udev_device *targetdev; @@ -162,12 +117,12 @@ out: return parent; } -static struct udev_device *handle_sas(struct udev_device *parent, char **path) +static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) { return NULL; } -static struct udev_device *handle_iscsi(struct udev_device *parent, char **path) +static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) { struct udev *udev = udev_device_get_udev(parent); struct udev_device *transportdev; @@ -178,7 +133,7 @@ static struct udev_device *handle_iscsi(struct udev_device *parent, char **path) const char *addr; const char *port; - /* find iscsi session */ + /* find iscsi session */ transportdev = parent; while (1) { transportdev = udev_device_get_parent(transportdev); @@ -224,32 +179,71 @@ out: return parent; } -static struct udev_device *handle_scsi(struct udev_device *parent, char **path) +static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path) { struct udev_device *hostdev; int host, bus, target, lun; const char *name; - int base; + char *base; + char *pos; + DIR *dir; + struct dirent *dent; + int basenum; hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host"); if (hostdev == NULL) - return parent; + return NULL; name = udev_device_get_sysname(parent); if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) - return parent; + return NULL; /* rebase host offset to get the local relative number */ - base = base_number(udev_device_get_syspath(hostdev), "host"); - if (base < 0) - return parent; - host -= base; + basenum = -1; + base = strdup(udev_device_get_syspath(hostdev)); + if (base == NULL) + return NULL; + pos = strrchr(base, '/'); + if (pos == NULL) { + parent = NULL; + goto out; + } + pos[0] = '\0'; + dir = opendir(base); + if (dir == NULL) { + parent = NULL; + goto out; + } + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char *rest; + int i; + + if (dent->d_name[0] == '.') + continue; + if (dent->d_type != DT_DIR && dent->d_type != DT_LNK) + continue; + if (strncmp(dent->d_name, "host", 4) != 0) + continue; + i = strtoul(&dent->d_name[4], &rest, 10); + if (rest[0] != '\0') + continue; + if (basenum == -1 || i < basenum) + basenum = i; + } + closedir(dir); + if (basenum == -1) { + parent = NULL; + goto out; + } + host -= basenum; path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun); +out: + free(base); return hostdev; } -static struct udev_device *handle_scsi_lun(struct udev_device *parent, char **path) +static struct udev_device *handle_scsi(struct udev_device *parent, char **path) { const char *devtype; const char *name; @@ -267,29 +261,25 @@ static struct udev_device *handle_scsi_lun(struct udev_device *parent, char **pa goto out; } - /* broken scsi transport devices would need a subsystem */ + /* lousy scsi sysfs does not have a "subsystem" for the transport */ name = udev_device_get_syspath(parent); - /* fibre channel */ if (strstr(name, "/rport-") != NULL) { - parent = handle_fc(parent, path); + parent = handle_scsi_fibre_channel(parent, path); goto out; } - /* sas */ if (strstr(name, "/end_device-") != NULL) { - parent = handle_sas(parent, path); + parent = handle_scsi_sas(parent, path); goto out; } - /* iSCSI */ if (strstr(name, "/session") != NULL) { - parent = handle_iscsi(parent, path); + parent = handle_scsi_iscsi(parent, path); goto out; } - /* default */ - parent = handle_scsi(parent, path); + parent = handle_scsi_default(parent, path); out: return parent; } @@ -439,7 +429,7 @@ int main(int argc, char **argv) } else if (strcmp(subsys, "scsi_tape") == 0) { handle_scsi_tape(parent, &path_suffix); } else if (strcmp(subsys, "scsi") == 0) { - parent = handle_scsi_lun(parent, &path); + parent = handle_scsi(parent, &path); } else if (strcmp(subsys, "cciss") == 0) { handle_cciss(parent, &path); } else if (strcmp(subsys, "usb") == 0) { -- cgit v1.2.3-54-g00ecf From 15a45c89e5c79e374247bad5c6ae28ad41496161 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Jun 2009 19:31:07 +0200 Subject: libudev: add comments to libudev.h --- udev/lib/libudev.h | 70 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 17 deletions(-) diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h index 63cb478b8f..241091c37d 100644 --- a/udev/lib/libudev.h +++ b/udev/lib/libudev.h @@ -21,11 +21,16 @@ #error "#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE is needed to use this experimental library version" #endif -/* library context */ +/* + * udev - library context + * + * reads the udev config and system environment + * allows custom logging + */ struct udev; -struct udev *udev_new(void); struct udev *udev_ref(struct udev *udev); void udev_unref(struct udev *udev); +struct udev *udev_new(void); void udev_set_log_fn(struct udev *udev, void (*log_fn)(struct udev *udev, int priority, const char *file, int line, const char *fn, @@ -37,7 +42,11 @@ const char *udev_get_dev_path(struct udev *udev); void *udev_get_userdata(struct udev *udev); void udev_set_userdata(struct udev *udev, void *userdata); -/* list iteration */ +/* + * udev_list + * + * access to libudev generated lists + */ struct udev_list_entry; struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); @@ -48,16 +57,23 @@ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); entry != NULL; \ entry = udev_list_entry_get_next(entry)) -/* sys devices */ +/* + * udev_device + * + * access to sysfs/kernel devices + */ struct udev_device; +struct udev_device *udev_device_ref(struct udev_device *udev_device); +void udev_device_unref(struct udev_device *udev_device); +struct udev *udev_device_get_udev(struct udev_device *udev_device); struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); +/* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */ struct udev_device *udev_device_get_parent(struct udev_device *udev_device); -struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype); -struct udev_device *udev_device_ref(struct udev_device *udev_device); -void udev_device_unref(struct udev_device *udev_device); -struct udev *udev_device_get_udev(struct udev_device *udev_device); +struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, + const char *subsystem, const char *devtype); +/* retrieve device properties */ const char *udev_device_get_devpath(struct udev_device *udev_device); const char *udev_device_get_subsystem(struct udev_device *udev_device); const char *udev_device_get_devtype(struct udev_device *udev_device); @@ -74,42 +90,62 @@ const char *udev_device_get_action(struct udev_device *udev_device); unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); -/* device events */ +/* + * udev_monitor + * + * access to kernel uevents and udev events + */ struct udev_monitor; -struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); -struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); -int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); void udev_monitor_unref(struct udev_monitor *udev_monitor); struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); +/* kernel and udev generated events over netlink */ +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); +/* custom socket (use netlink and filters instead) */ +struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); +/* bind socket */ +int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); int udev_monitor_get_fd(struct udev_monitor *udev_monitor); struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); -int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype); +/* in-kernel socket filters to select messages that get delivered to a listener */ +int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, + const char *subsystem, const char *devtype); int udev_monitor_filter_update(struct udev_monitor *udev_monitor); int udev_monitor_filter_remove(struct udev_monitor *udev_monitor); -/* sys enumeration */ +/* + * udev_enumerate + * + * search sysfs for specific devices and provide a sorted list + */ struct udev_enumerate; -struct udev_enumerate *udev_enumerate_new(struct udev *udev); struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); +struct udev_enumerate *udev_enumerate_new(struct udev *udev); +/* device properties filter */ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); +/* run enumeration with active filters */ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); +/* return device list */ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); -/* event queue */ +/* + * udev_queue + * + * access to the currently running udev events + */ struct udev_queue; -struct udev_queue *udev_queue_new(struct udev *udev); struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue); void udev_queue_unref(struct udev_queue *udev_queue); struct udev *udev_queue_get_udev(struct udev_queue *udev_queue); +struct udev_queue *udev_queue_new(struct udev *udev); unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue); unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue); int udev_queue_get_udev_is_active(struct udev_queue *udev_queue); -- cgit v1.2.3-54-g00ecf From 48a9b173e88738ff4eefb3519f1d27711b417c8d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Jun 2009 21:36:06 +0200 Subject: libudev: move to top-level directory --- Makefile.am | 1 + Makefile.am.inc | 4 +- configure.ac | 4 +- extras/ata_id/Makefile.am | 8 +- extras/cdrom_id/Makefile.am | 8 +- extras/collect/Makefile.am | 8 +- extras/collect/collect.c | 4 +- extras/edd_id/Makefile.am | 8 +- extras/floppy/Makefile.am | 12 +- extras/fstab_import/Makefile.am | 8 +- extras/path_id/Makefile.am | 12 +- extras/path_id/path_id.c | 6 +- extras/scsi_id/Makefile.am | 8 +- extras/usb_id/Makefile.am | 12 +- libudev/.gitignore | 4 + libudev/Makefile.am | 54 ++ libudev/exported_symbols | 73 +++ libudev/libudev-ctrl.c | 321 +++++++++ libudev/libudev-device-db-write.c | 138 ++++ libudev/libudev-device.c | 1249 ++++++++++++++++++++++++++++++++++++ libudev/libudev-enumerate.c | 479 ++++++++++++++ libudev/libudev-list.c | 235 +++++++ libudev/libudev-monitor.c | 760 ++++++++++++++++++++++ libudev/libudev-private.h | 190 ++++++ libudev/libudev-queue-export.c | 473 ++++++++++++++ libudev/libudev-queue.c | 401 ++++++++++++ libudev/libudev-util.c | 502 +++++++++++++++ libudev/libudev.c | 374 +++++++++++ libudev/libudev.h | 153 +++++ libudev/libudev.pc.in | 11 + libudev/test-libudev.c | 458 +++++++++++++ udev/Makefile.am | 27 +- udev/lib/.gitignore | 4 - udev/lib/Makefile.am | 54 -- udev/lib/exported_symbols | 73 --- udev/lib/libudev-ctrl.c | 321 --------- udev/lib/libudev-device-db-write.c | 138 ---- udev/lib/libudev-device.c | 1249 ------------------------------------ udev/lib/libudev-enumerate.c | 479 -------------- udev/lib/libudev-list.c | 235 ------- udev/lib/libudev-monitor.c | 760 ---------------------- udev/lib/libudev-private.h | 190 ------ udev/lib/libudev-queue-export.c | 473 -------------- udev/lib/libudev-queue.c | 401 ------------ udev/lib/libudev-util.c | 502 --------------- udev/lib/libudev.c | 374 ----------- udev/lib/libudev.h | 158 ----- udev/lib/libudev.pc.in | 11 - udev/lib/test-libudev.c | 458 ------------- udev/udev.h | 4 +- 50 files changed, 5941 insertions(+), 5948 deletions(-) create mode 100644 libudev/.gitignore create mode 100644 libudev/Makefile.am create mode 100644 libudev/exported_symbols create mode 100644 libudev/libudev-ctrl.c create mode 100644 libudev/libudev-device-db-write.c create mode 100644 libudev/libudev-device.c create mode 100644 libudev/libudev-enumerate.c create mode 100644 libudev/libudev-list.c create mode 100644 libudev/libudev-monitor.c create mode 100644 libudev/libudev-private.h create mode 100644 libudev/libudev-queue-export.c create mode 100644 libudev/libudev-queue.c create mode 100644 libudev/libudev-util.c create mode 100644 libudev/libudev.c create mode 100644 libudev/libudev.h create mode 100644 libudev/libudev.pc.in create mode 100644 libudev/test-libudev.c delete mode 100644 udev/lib/.gitignore delete mode 100644 udev/lib/Makefile.am delete mode 100644 udev/lib/exported_symbols delete mode 100644 udev/lib/libudev-ctrl.c delete mode 100644 udev/lib/libudev-device-db-write.c delete mode 100644 udev/lib/libudev-device.c delete mode 100644 udev/lib/libudev-enumerate.c delete mode 100644 udev/lib/libudev-list.c delete mode 100644 udev/lib/libudev-monitor.c delete mode 100644 udev/lib/libudev-private.h delete mode 100644 udev/lib/libudev-queue-export.c delete mode 100644 udev/lib/libudev-queue.c delete mode 100644 udev/lib/libudev-util.c delete mode 100644 udev/lib/libudev.c delete mode 100644 udev/lib/libudev.h delete mode 100644 udev/lib/libudev.pc.in delete mode 100644 udev/lib/test-libudev.c diff --git a/Makefile.am b/Makefile.am index 1bb2d7773b..678a3e426a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,7 @@ include $(top_srcdir)/Makefile.am.inc SUBDIRS = \ + libudev \ udev \ rules \ extras diff --git a/Makefile.am.inc b/Makefile.am.inc index 7ecd55de78..802143bb6b 100644 --- a/Makefile.am.inc +++ b/Makefile.am.inc @@ -1,8 +1,8 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ + -I$(top_builddir)/libudev \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" \ - -D_LIBUDEV_COMPILATION + -DUDEV_PREFIX=\""$(udev_prefix)"\" AM_CFLAGS = diff --git a/configure.ac b/configure.ac index 9857d52e4e..e9c949647a 100644 --- a/configure.ac +++ b/configure.ac @@ -70,9 +70,9 @@ fi AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile + libudev/Makefile + libudev/libudev.pc udev/Makefile - udev/lib/Makefile - udev/lib/libudev.pc rules/Makefile extras/Makefile extras/ata_id/Makefile diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index d31fd2c93c..ffbdba32f2 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -6,10 +6,10 @@ udevhome_PROGRAMS = \ ata_id_SOURCES = \ ata_id.c \ - ../../udev/lib/libudev.h \ - ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-list.c \ - ../../udev/lib/libudev-util.c + ../../udev/udev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c dist_man_MANS = \ ata_id.8 diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index 51b6a20ee2..8e1968e6e1 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -10,10 +10,10 @@ dist_udevrules_DATA = \ cdrom_id_SOURCES = \ cdrom_id.c \ - ../../udev/lib/libudev.h \ - ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-list.c \ - ../../udev/lib/libudev-util.c + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c dist_man_MANS = \ cdrom_id.8 diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am index d9792b89eb..7ad2937f5d 100644 --- a/extras/collect/Makefile.am +++ b/extras/collect/Makefile.am @@ -6,7 +6,7 @@ udevhome_PROGRAMS = \ collect_SOURCES = \ collect.c \ - ../../udev/lib/libudev-private.h \ - ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-util.c \ - ../../udev/lib/libudev-list.c + ../../libudev/libudev-private.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-util.c \ + ../../libudev/libudev-list.c diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 3a7e826e4d..3284c3df40 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -31,8 +31,8 @@ #include #include -#include "../../udev/lib/libudev.h" -#include "../../udev/lib/libudev-private.h" +#include "libudev.h" +#include "libudev-private.h" #define TMPFILE UDEV_PREFIX "/dev/.udev/collect" #define BUFSIZE 16 diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 9bfe43231f..7c562d3c31 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -10,10 +10,10 @@ dist_udevrules_DATA = \ edd_id_SOURCES = \ edd_id.c \ - ../../udev/lib/libudev.h \ - ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-list.c \ - ../../udev/lib/libudev-util.c + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c dist_man_MANS = \ edd_id.8 diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 8cb9cbd47d..2baaa10f02 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -6,12 +6,12 @@ udevhome_PROGRAMS = \ create_floppy_devices_SOURCES = \ create_floppy_devices.c \ - ../../udev/lib/libudev.h \ - ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-list.c \ - ../../udev/lib/libudev-util.c \ - ../../udev/lib/libudev-device.c \ - ../../udev/lib/libudev-enumerate.c \ + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c \ + ../../libudev/libudev-device.c \ + ../../libudev/libudev-enumerate.c \ ../../udev/udev-util.c if USE_SELINUX diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index c63dc7cf17..42acfd15cf 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -10,8 +10,8 @@ dist_udevrules_DATA = \ fstab_import_SOURCES = \ fstab_import.c \ - ../../udev/lib/libudev.h \ - ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-list.c \ - ../../udev/lib/libudev-util.c + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am index 5d4bf6283d..867ad5ef8e 100644 --- a/extras/path_id/Makefile.am +++ b/extras/path_id/Makefile.am @@ -6,12 +6,12 @@ udevhome_PROGRAMS = \ path_id_SOURCES = \ path_id.c \ - ../../udev/lib/libudev.h \ - ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-device.c \ - ../../udev/lib/libudev-enumerate.c \ - ../../udev/lib/libudev-list.c \ - ../../udev/lib/libudev-util.c + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-device.c \ + ../../libudev/libudev-enumerate.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c dist_man_MANS = \ path_id.8 diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 08b7e150c9..dbb52bad21 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -28,8 +28,8 @@ #include #include -#include <../../udev/lib/libudev.h> -#include <../../udev/udev.h> +#include "libudev.h" +#include "../../udev/udev.h" int debug; @@ -366,7 +366,7 @@ int main(int argc, char **argv) if (udev == NULL) goto exit; - logging_init("usb_id"); + logging_init("path_id"); udev_set_log_fn(udev, log_fn); while (1) { diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index 29d5fe7344..ffebc38e20 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -10,10 +10,10 @@ scsi_id_SOURCES = \ scsi.h \ scsi_id.h \ bsg.h \ - ../../udev/lib/libudev.h \ - ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-list.c \ - ../../udev/lib/libudev-util.c + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c dist_sysconf_DATA = \ scsi_id.config diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index 07b286d61f..a9bd407031 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -6,12 +6,12 @@ udevhome_PROGRAMS = \ usb_id_SOURCES = \ usb_id.c \ - ../../udev/lib/libudev.h \ - ../../udev/lib/libudev.c \ - ../../udev/lib/libudev-list.c \ - ../../udev/lib/libudev-util.c \ - ../../udev/lib/libudev-device.c \ - ../../udev/lib/libudev-enumerate.c + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c \ + ../../libudev/libudev-device.c \ + ../../libudev/libudev-enumerate.c dist_man_MANS = \ usb_id.8 diff --git a/libudev/.gitignore b/libudev/.gitignore new file mode 100644 index 0000000000..74a5f1d379 --- /dev/null +++ b/libudev/.gitignore @@ -0,0 +1,4 @@ +test-libudev +libudev.pc +libudev.so* + diff --git a/libudev/Makefile.am b/libudev/Makefile.am new file mode 100644 index 0000000000..1f0bf2f3ad --- /dev/null +++ b/libudev/Makefile.am @@ -0,0 +1,54 @@ +include $(top_srcdir)/Makefile.am.inc + +noinst_PROGRAMS = \ + test-libudev + +test_libudev_SOURCES = \ + test-libudev.c + +test_libudev_LDADD = \ + libudev.la + +rootlibdir = $(exec_prefix)/$(libdir_name) +rootlib_LTLIBRARIES = \ + libudev.la + +include_HEADERS =\ + libudev.h + +libudev_la_SOURCES =\ + libudev-private.h \ + libudev.c \ + libudev-list.c \ + libudev-util.c \ + libudev-device.c \ + libudev-enumerate.c \ + libudev-monitor.c \ + libudev-queue.c + +libudev_la_LDFLAGS = \ + -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ + -export-symbols $(top_srcdir)/libudev/exported_symbols + +pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig +pkgconfig_DATA = libudev.pc + +EXTRA_DIST = \ + exported_symbols + +# move devel files to $(prefix)$(libdir_name) if needed +install-data-hook: + rm $(DESTDIR)$(rootlibdir)/libudev.la + if test "$(prefix)" != "$(exec_prefix)"; then \ + mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \ + mv $(DESTDIR)$(rootlibdir)/libudev.a $(DESTDIR)$(prefix)/$(libdir_name)/; \ + so_img_name=$$(readlink $(DESTDIR)$(rootlibdir)/libudev.so); \ + rm $(DESTDIR)$(rootlibdir)/libudev.so; \ + so_img_rel_target_prefix=$$(echo $(prefix)/$(libdir_name) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ + ln -sf $$so_img_rel_target_prefix$(exec_prefix)/$(libdir_name)/$$so_img_name \ + $(DESTDIR)$(prefix)/$(libdir_name)/libudev.so; \ + fi + +uninstall-hook: + rm -f $(DESTDIR)$(prefix)/$(libdir_name)/libudev.a + rm -f $(DESTDIR)$(prefix)/$(libdir_name)/libudev.so* diff --git a/libudev/exported_symbols b/libudev/exported_symbols new file mode 100644 index 0000000000..8e7749e488 --- /dev/null +++ b/libudev/exported_symbols @@ -0,0 +1,73 @@ +udev_new +udev_ref +udev_unref +udev_set_log_fn +udev_get_log_priority +udev_set_log_priority +udev_get_userdata +udev_set_userdata +udev_get_sys_path +udev_get_dev_path +udev_list_entry_get_next +udev_list_entry_get_by_name +udev_list_entry_get_name +udev_list_entry_get_value +udev_device_new_from_syspath +udev_device_new_from_devnum +udev_device_new_from_subsystem_sysname +udev_device_get_parent +udev_device_get_parent_with_subsystem_devtype +udev_device_ref +udev_device_unref +udev_device_get_udev +udev_device_get_syspath +udev_device_get_devpath +udev_device_get_devnode +udev_device_get_sysname +udev_device_get_sysnum +udev_device_get_subsystem +udev_device_get_devtype +udev_device_get_devlinks_list_entry +udev_device_get_properties_list_entry +udev_device_get_property_value +udev_device_get_action +udev_device_get_driver +udev_device_get_devnum +udev_device_get_seqnum +udev_device_get_sysattr_value +udev_enumerate_new +udev_enumerate_ref +udev_enumerate_unref +udev_enumerate_get_udev +udev_enumerate_get_list_entry +udev_enumerate_add_match_subsystem +udev_enumerate_add_nomatch_subsystem +udev_enumerate_add_match_sysattr +udev_enumerate_add_nomatch_sysattr +udev_enumerate_add_match_property +udev_enumerate_scan_devices +udev_enumerate_scan_subsystems +udev_enumerate_add_syspath +udev_monitor_new_from_socket +udev_monitor_new_from_netlink +udev_monitor_enable_receiving +udev_monitor_ref +udev_monitor_unref +udev_monitor_get_udev +udev_monitor_get_fd +udev_monitor_receive_device +udev_monitor_filter_add_match_subsystem_devtype +udev_monitor_filter_update +udev_monitor_filter_remove +udev_queue_new +udev_queue_ref +udev_queue_unref +udev_queue_get_udev +udev_queue_get_kernel_seqnum +udev_queue_get_udev_seqnum +udev_queue_get_udev_is_active +udev_queue_get_queue_is_empty +udev_queue_get_seqnum_is_finished +udev_queue_get_seqnum_sequence_is_finished +udev_queue_get_queued_list_entry +udev_queue_get_failed_list_entry diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c new file mode 100644 index 0000000000..e47b2b66dc --- /dev/null +++ b/libudev/libudev-ctrl.c @@ -0,0 +1,321 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/* wire protocol magic must match */ +#define UDEV_CTRL_MAGIC 0xdead1dea + +enum udev_ctrl_msg_type { + UDEV_CTRL_UNKNOWN, + UDEV_CTRL_SET_LOG_LEVEL, + UDEV_CTRL_STOP_EXEC_QUEUE, + UDEV_CTRL_START_EXEC_QUEUE, + UDEV_CTRL_RELOAD_RULES, + UDEV_CTRL_SET_ENV, + UDEV_CTRL_SET_MAX_CHILDS, + UDEV_CTRL_SET_MAX_CHILDS_RUNNING, + UDEV_CTRL_SETTLE, +}; + +struct udev_ctrl_msg_wire { + char version[16]; + unsigned int magic; + enum udev_ctrl_msg_type type; + union { + int intval; + char buf[256]; + }; +}; + +struct udev_ctrl_msg { + int refcount; + struct udev_ctrl *uctrl; + struct udev_ctrl_msg_wire ctrl_msg_wire; + pid_t pid; +}; + +struct udev_ctrl { + int refcount; + struct udev *udev; + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; +}; + +struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) +{ + struct udev_ctrl *uctrl; + + uctrl = calloc(1, sizeof(struct udev_ctrl)); + if (uctrl == NULL) + return NULL; + uctrl->refcount = 1; + uctrl->udev = udev; + + uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (uctrl->sock < 0) { + err(udev, "error getting socket: %m\n"); + udev_ctrl_unref(uctrl); + return NULL; + } + + uctrl->saddr.sun_family = AF_LOCAL; + strcpy(uctrl->saddr.sun_path, socket_path); + uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); + /* translate leading '@' to abstract namespace */ + if (uctrl->saddr.sun_path[0] == '@') + uctrl->saddr.sun_path[0] = '\0'; + + return uctrl; +} + +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) +{ + int err; + const int feature_on = 1; + + err= bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err < 0) { + err(uctrl->udev, "bind failed: %m\n"); + return err; + } + + /* enable receiving of the sender credentials */ + setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); + return 0; +} + +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) +{ + return uctrl->udev; +} + +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return NULL; + uctrl->refcount++; + return uctrl; +} + +void udev_ctrl_unref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return; + uctrl->refcount--; + if (uctrl->refcount > 0) + return; + if (uctrl->sock >= 0) + close(uctrl->sock); + free(uctrl); +} + +int udev_ctrl_get_fd(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return -1; + return uctrl->sock; +} + +static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf) +{ + struct udev_ctrl_msg_wire ctrl_msg_wire; + int err; + + memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); + strcpy(ctrl_msg_wire.version, "udev-" VERSION); + ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; + ctrl_msg_wire.type = type; + + if (buf != NULL) + util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); + else + ctrl_msg_wire.intval = intval; + + err = sendto(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0, + (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err == -1) { + err(uctrl->udev, "error sending message: %m\n"); + } + return err; +} + +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL); +} + +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl) +{ + return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL); +} + +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl) +{ + return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL); +} + +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl) +{ + return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL); +} + +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key); +} + +int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS, count, NULL); +} + +int udev_ctrl_send_settle(struct udev_ctrl *uctrl) +{ + return ctrl_send(uctrl, UDEV_CTRL_SETTLE, 0, NULL); +} + +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) +{ + struct udev_ctrl_msg *uctrl_msg; + ssize_t size; + struct msghdr smsg; + struct cmsghdr *cmsg; + struct iovec iov; + struct ucred *cred; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + + uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); + if (uctrl_msg == NULL) + return NULL; + uctrl_msg->refcount = 1; + uctrl_msg->uctrl = uctrl; + + iov.iov_base = &uctrl_msg->ctrl_msg_wire; + iov.iov_len = sizeof(struct udev_ctrl_msg_wire); + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + + size = recvmsg(uctrl->sock, &smsg, 0); + if (size < 0) { + err(uctrl->udev, "unable to receive user udevd message: %m\n"); + goto err; + } + cmsg = CMSG_FIRSTHDR(&smsg); + cred = (struct ucred *) CMSG_DATA(cmsg); + + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + err(uctrl->udev, "no sender credentials received, message ignored\n"); + goto err; + } + + if (cred->uid != 0) { + err(uctrl->udev, "sender uid=%i, message ignored\n", cred->uid); + goto err; + } + + uctrl_msg->pid = cred->pid; + + if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { + err(uctrl->udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); + goto err; + } + + dbg(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); + return uctrl_msg; +err: + udev_ctrl_msg_unref(uctrl_msg); + return NULL; +} + +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount++; + return ctrl_msg; +} + +void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return; + ctrl_msg->refcount--; + if (ctrl_msg->refcount > 0) + return; + dbg(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + free(ctrl_msg); +} + +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; +} + +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD_RULES) + return 1; + return -1; +} + +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) + return ctrl_msg->ctrl_msg_wire.buf; + return NULL; +} + +int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_MAX_CHILDS) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; +} + +pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SETTLE) + return ctrl_msg->pid; + return -1; +} diff --git a/libudev/libudev-device-db-write.c b/libudev/libudev-device-db-write.c new file mode 100644 index 0000000000..a8e66f7884 --- /dev/null +++ b/libudev/libudev-device-db-write.c @@ -0,0 +1,138 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) +{ + char *s; + size_t l; + + s = filename; + l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); + return util_path_encode(devpath, s, l); +} + +int udev_device_update_db(struct udev_device *udev_device) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + FILE *f; + char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ + size_t devlen = strlen(udev_get_dev_path(udev))+1; + char *s; + size_t l; + struct udev_list_entry *list_entry; + int ret; + + devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); + util_create_path(udev, filename); + unlink(filename); + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) + if (udev_list_entry_get_flag(list_entry)) + goto file; + if (udev_device_get_num_fake_partitions(udev_device) != 0) + goto file; + if (udev_device_get_ignore_remove(udev_device)) + goto file; + if (udev_device_get_devlink_priority(udev_device) != 0) + goto file; + if (udev_device_get_event_timeout(udev_device) >= 0) + goto file; + if (udev_device_get_watch_handle(udev_device) >= 0) + goto file; + if (udev_device_get_devnode(udev_device) == NULL) + goto out; + + /* + * if we have only the node and symlinks to store, try not to waste + * tmpfs memory -- store values, if they fit, in a symlink target + */ + s = target; + l = util_strpcpy(&s, sizeof(target), &udev_device_get_devnode(udev_device)[devlen]); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) { + l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); + if (l == 0) { + info(udev, "size of links too large, create file\n"); + goto file; + } + } + info(udev, "create db link (%s)\n", target); + udev_selinux_setfscreatecon(udev, filename, S_IFLNK); + ret = symlink(target, filename); + udev_selinux_resetfscreatecon(udev); + if (ret == 0) + goto out; +file: + f = fopen(filename, "w"); + if (f == NULL) { + err(udev, "unable to create db file '%s': %m\n", filename); + return -1; + } + info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); + + if (udev_device_get_devnode(udev_device) != NULL) { + fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) + fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + } + if (udev_device_get_devlink_priority(udev_device) != 0) + fprintf(f, "L:%u\n", udev_device_get_devlink_priority(udev_device)); + if (udev_device_get_event_timeout(udev_device) >= 0) + fprintf(f, "T:%u\n", udev_device_get_event_timeout(udev_device)); + if (udev_device_get_num_fake_partitions(udev_device) != 0) + fprintf(f, "A:%u\n", udev_device_get_num_fake_partitions(udev_device)); + if (udev_device_get_ignore_remove(udev_device)) + fprintf(f, "R:%u\n", udev_device_get_ignore_remove(udev_device)); + if (udev_device_get_watch_handle(udev_device) >= 0) + fprintf(f, "W:%u\n", udev_device_get_watch_handle(udev_device)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + if (!udev_list_entry_get_flag(list_entry)) + continue; + fprintf(f, "E:%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + fclose(f); +out: + return 0; +} + +int udev_device_delete_db(struct udev_device *udev_device) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + + devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); + unlink(filename); + return 0; +} + +int udev_device_rename_db(struct udev_device *udev_device, const char *devpath_old) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename_old[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + + devpath_to_db_path(udev, devpath_old, filename_old, sizeof(filename_old)); + devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); + return rename(filename_old, filename); +} diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c new file mode 100644 index 0000000000..ea54badde4 --- /dev/null +++ b/libudev/libudev-device.c @@ -0,0 +1,1249 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2009 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +struct udev_device { + struct udev *udev; + struct udev_device *parent_device; + char *syspath; + const char *devpath; + char *sysname; + const char *sysnum; + char *devnode; + char *subsystem; + char *devtype; + char *driver; + char *action; + char *devpath_old; + char *knodename; + char **envp; + char *monitor_buf; + size_t monitor_buf_len; + struct udev_list_node devlinks_list; + struct udev_list_node properties_list; + struct udev_list_node sysattr_list; + unsigned long long int seqnum; + int event_timeout; + int timeout; + int num_fake_partitions; + int devlink_priority; + int refcount; + dev_t devnum; + int watch_handle; + unsigned int parent_set:1; + unsigned int subsystem_set:1; + unsigned int devtype_set:1; + unsigned int devlinks_uptodate:1; + unsigned int envp_uptodate:1; + unsigned int driver_set:1; + unsigned int info_loaded:1; + unsigned int ignore_remove:1; +}; + +static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) +{ + char *s; + size_t l; + + s = filename; + l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); + return util_path_encode(devpath, s, l); +} + +int udev_device_read_db(struct udev_device *udev_device) +{ + struct stat stats; + char filename[UTIL_PATH_SIZE]; + char line[UTIL_LINE_SIZE]; + FILE *f; + + devpath_to_db_path(udev_device->udev, udev_device->devpath, filename, sizeof(filename)); + + if (lstat(filename, &stats) != 0) { + dbg(udev_device->udev, "no db file to read %s: %m\n", filename); + return -1; + } + if ((stats.st_mode & S_IFMT) == S_IFLNK) { + char target[UTIL_PATH_SIZE]; + char devnode[UTIL_PATH_SIZE]; + int target_len; + char *next; + + target_len = readlink(filename, target, sizeof(target)); + if (target_len > 0) + target[target_len] = '\0'; + else { + dbg(udev_device->udev, "error reading db link %s: %m\n", filename); + return -1; + } + + next = strchr(target, ' '); + if (next != NULL) { + next[0] = '\0'; + next = &next[1]; + } + util_strscpyl(devnode, sizeof(devnode), udev_get_dev_path(udev_device->udev), "/", target, NULL); + udev_device_set_devnode(udev_device, devnode); + while (next != NULL) { + char devlink[UTIL_PATH_SIZE]; + const char *lnk; + + lnk = next; + next = strchr(next, ' '); + if (next != NULL) { + next[0] = '\0'; + next = &next[1]; + } + util_strscpyl(devlink, sizeof(devlink), udev_get_dev_path(udev_device->udev), "/", lnk, NULL); + udev_device_add_devlink(udev_device, devlink); + } + info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); + return 0; + } + + f = fopen(filename, "r"); + if (f == NULL) { + dbg(udev_device->udev, "error reading db file %s: %m\n", filename); + return -1; + } + while (fgets(line, sizeof(line), f)) { + ssize_t len; + const char *val; + + len = strlen(line); + if (len < 4) + break; + line[len-1] = '\0'; + val = &line[2]; + switch(line[0]) { + case 'N': + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); + udev_device_set_devnode(udev_device, filename); + break; + case 'S': + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); + udev_device_add_devlink(udev_device, filename); + break; + case 'L': + udev_device_set_devlink_priority(udev_device, atoi(val)); + break; + case 'T': + udev_device_set_event_timeout(udev_device, atoi(val)); + break; + case 'A': + udev_device_set_num_fake_partitions(udev_device, atoi(val)); + break; + case 'R': + udev_device_set_ignore_remove(udev_device, atoi(val)); + break; + case 'E': + udev_device_add_property_from_string(udev_device, val); + break; + case 'W': + udev_device_set_watch_handle(udev_device, atoi(val)); + break; + } + } + fclose(f); + + info(udev_device->udev, "device %p filled with db file data\n", udev_device); + return 0; +} + +int udev_device_read_uevent_file(struct udev_device *udev_device) +{ + char filename[UTIL_PATH_SIZE]; + FILE *f; + char line[UTIL_LINE_SIZE]; + int maj = 0; + int min = 0; + + util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL); + f = fopen(filename, "r"); + if (f == NULL) + return -1; + + while (fgets(line, sizeof(line), f)) { + char *pos; + + pos = strchr(line, '\n'); + if (pos == NULL) + continue; + pos[0] = '\0'; + + if (strncmp(line, "DEVTYPE=", 8) == 0) + udev_device_set_devtype(udev_device, &line[8]); + else if (strncmp(line, "MAJOR=", 6) == 0) + maj = strtoull(&line[6], NULL, 10); + else if (strncmp(line, "MINOR=", 6) == 0) + min = strtoull(&line[6], NULL, 10); + else if (strncmp(line, "DEVNAME=", 8) == 0) + udev_device_set_knodename(udev_device, &line[8]); + + udev_device_add_property_from_string(udev_device, line); + } + + udev_device->devnum = makedev(maj, min); + + fclose(f); + return 0; +} + +static void device_load_info(struct udev_device *device) +{ + device->info_loaded = 1; + udev_device_read_uevent_file(device); + udev_device_read_db(device); +} + +void udev_device_set_info_loaded(struct udev_device *device) +{ + device->info_loaded = 1; +} + +struct udev_device *device_new(struct udev *udev) +{ + struct udev_device *udev_device; + struct udev_list_entry *list_entry; + + if (udev == NULL) + return NULL; + + udev_device = calloc(1, sizeof(struct udev_device)); + if (udev_device == NULL) + return NULL; + udev_device->refcount = 1; + udev_device->udev = udev; + udev_list_init(&udev_device->devlinks_list); + udev_list_init(&udev_device->properties_list); + udev_list_init(&udev_device->sysattr_list); + udev_device->event_timeout = -1; + udev_device->watch_handle = -1; + /* copy global properties */ + udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) + udev_device_add_property(udev_device, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + dbg(udev_device->udev, "udev_device: %p created\n", udev_device); + return udev_device; +} + +/** + * udev_device_new_from_syspath: + * @udev: udev library context + * @syspath: sys device path including sys directory + * + * Create new udev device, and fill in information from the sys + * device and the udev database entry. The sypath is the absolute + * path to the device, including the sys mount point. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ +struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) +{ + size_t len; + const char *subdir; + char path[UTIL_PATH_SIZE]; + char *pos; + struct stat statbuf; + struct udev_device *udev_device; + + if (udev == NULL) + return NULL; + if (syspath == NULL) + return NULL; + + /* path starts in sys */ + len = strlen(udev_get_sys_path(udev)); + if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) { + info(udev, "not in sys :%s\n", syspath); + return NULL; + } + + /* path is not a root directory */ + subdir = &syspath[len+1]; + pos = strrchr(subdir, '/'); + if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) { + dbg(udev, "not a subdir :%s\n", syspath); + return NULL; + } + + /* resolve possible symlink to real path */ + util_strscpy(path, sizeof(path), syspath); + util_resolve_sys_link(udev, path, sizeof(path)); + + /* try to resolve the silly block layout if needed */ + if (strncmp(&path[len], "/block/", 7) == 0) { + char block[UTIL_PATH_SIZE]; + char part[UTIL_PATH_SIZE]; + + util_strscpy(block, sizeof(block), path); + pos = strrchr(block, '/'); + if (pos == NULL) + return NULL; + util_strscpy(part, sizeof(part), pos); + pos[0] = '\0'; + if (util_resolve_sys_link(udev, block, sizeof(block)) == 0) + util_strscpyl(path, sizeof(path), block, part, NULL); + } + + /* path exists in sys */ + if (strncmp(&syspath[len], "/devices/", 9) == 0 || + strncmp(&syspath[len], "/class/", 7) == 0 || + strncmp(&syspath[len], "/block/", 7) == 0) { + char file[UTIL_PATH_SIZE]; + + /* all "devices" require a "uevent" file */ + util_strscpyl(file, sizeof(file), path, "/uevent", NULL); + if (stat(file, &statbuf) != 0) { + dbg(udev, "not a device: %s\n", syspath); + return NULL; + } + } else { + /* everything else just needs to be a directory */ + if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) { + dbg(udev, "directory not found: %s\n", syspath); + return NULL; + } + } + + udev_device = device_new(udev); + if (udev_device == NULL) + return NULL; + + udev_device_set_syspath(udev_device, path); + info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); + + return udev_device; +} + +struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) +{ + char path[UTIL_PATH_SIZE]; + const char *type_str; + struct udev_enumerate *udev_enumerate; + struct udev_list_entry *list_entry; + struct udev_device *device = NULL; + + if (type == 'b') + type_str = "block"; + else if (type == 'c') + type_str = "char"; + else + return NULL; + + /* /sys/dev/{block,char}/: link */ + snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", udev_get_sys_path(udev), + type_str, major(devnum), minor(devnum)); + if (util_resolve_sys_link(udev, path, sizeof(path)) == 0) + return udev_device_new_from_syspath(udev, path); + + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return NULL; + + /* fallback to search sys devices for the major/minor */ + if (type == 'b') + udev_enumerate_add_match_subsystem(udev_enumerate, "block"); + else if (type == 'c') + udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); + udev_enumerate_scan_devices(udev_enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { + struct udev_device *device_loop; + + device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + if (device_loop != NULL) { + if (udev_device_get_devnum(device_loop) == devnum) { + if (type == 'b' && strcmp(udev_device_get_subsystem(device_loop), "block") != 0) + continue; + if (type == 'c' && strcmp(udev_device_get_subsystem(device_loop), "block") == 0) + continue; + device = device_loop; + break; + } + udev_device_unref(device_loop); + } + } + udev_enumerate_unref(udev_enumerate); + return device; +} + +struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) +{ + char path_full[UTIL_PATH_SIZE]; + char *path; + size_t l; + struct stat statbuf; + + path = path_full; + l = util_strpcpyl(&path, sizeof(path_full), udev_get_sys_path(udev), NULL); + + if (strcmp(subsystem, "subsystem") == 0) { + util_strscpyl(path, l, "/subsystem/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/bus/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/class/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "module") == 0) { + util_strscpyl(path, l, "/module/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "drivers") == 0) { + char subsys[UTIL_NAME_SIZE]; + char *driver; + + util_strscpy(subsys, sizeof(subsys), sysname); + driver = strchr(subsys, ':'); + if (driver != NULL) { + driver[0] = '\0'; + driver = &driver[1]; + + util_strscpyl(path, l, "/subsystem/", subsys, "/drivers/", driver, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/bus/", subsys, "/drivers/", driver, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + } + goto out; + } + + util_strscpyl(path, l, "/subsystem/", subsystem, "/devices/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/bus/", subsystem, "/devices/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/class/", subsystem, "/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; +out: + return NULL; +found: + return udev_device_new_from_syspath(udev, path_full); +} + +static struct udev_device *device_new_from_parent(struct udev_device *udev_device) +{ + struct udev_device *udev_device_parent = NULL; + char path[UTIL_PATH_SIZE]; + const char *subdir; + + /* follow "device" link in deprecated sys layout */ + if (strncmp(udev_device->devpath, "/class/", 7) == 0 || + strncmp(udev_device->devpath, "/block/", 7) == 0) { + util_strscpyl(path, sizeof(path), udev_device->syspath, "/device", NULL); + if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) { + udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); + if (udev_device_parent != NULL) + return udev_device_parent; + } + } + + util_strscpy(path, sizeof(path), udev_device->syspath); + subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; + while (1) { + char *pos; + + pos = strrchr(subdir, '/'); + if (pos == NULL || pos < &subdir[2]) + break; + pos[0] = '\0'; + udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); + if (udev_device_parent != NULL) + return udev_device_parent; + } + return NULL; +} + +struct udev_device *udev_device_get_parent(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->parent_set) { + udev_device->parent_set = 1; + udev_device->parent_device = device_new_from_parent(udev_device); + } + if (udev_device->parent_device != NULL) + dbg(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); + return udev_device->parent_device; +} + +struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) +{ + struct udev_device *parent; + + if (subsystem == NULL) + return NULL; + + parent = udev_device_get_parent(udev_device); + while (parent != NULL) { + const char *parent_subsystem; + const char *parent_devtype; + + parent_subsystem = udev_device_get_subsystem(parent); + if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) { + if (devtype == NULL) + break; + parent_devtype = udev_device_get_devtype(parent); + if (parent_devtype != NULL && strcmp(parent_devtype, devtype) == 0) + break; + } + parent = udev_device_get_parent(parent); + } + return parent; +} + +/** + * udev_device_get_udev: + * @udev_device: udev device + * + * Retrieve the udev library context the device was created with. + * + * Returns: the udev library context + **/ +struct udev *udev_device_get_udev(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->udev; +} + +/** + * udev_device_ref: + * @udev_device: udev device + * + * Take a reference of a udev device. + * + * Returns: the passed udev device + **/ +struct udev_device *udev_device_ref(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + udev_device->refcount++; + return udev_device; +} + +/** + * udev_device_unref: + * @udev_device: udev device + * + * Drop a reference of a udev device. If the refcount reaches zero, + * the resources of the device will be released. + * + **/ +void udev_device_unref(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return; + udev_device->refcount--; + if (udev_device->refcount > 0) + return; + if (udev_device->parent_device != NULL) + udev_device_unref(udev_device->parent_device); + free(udev_device->syspath); + free(udev_device->sysname); + free(udev_device->devnode); + free(udev_device->subsystem); + free(udev_device->devtype); + udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->properties_list); + free(udev_device->action); + free(udev_device->driver); + free(udev_device->devpath_old); + free(udev_device->knodename); + udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); + free(udev_device->envp); + free(udev_device->monitor_buf); + dbg(udev_device->udev, "udev_device: %p released\n", udev_device); + free(udev_device); +} + +/** + * udev_device_get_devpath: + * @udev_device: udev device + * + * Retrieve the kernel devpath value of the udev device. The path + * does not contain the sys mount point, and starts with a '/'. + * + * Returns: the devpath of the udev device + **/ +const char *udev_device_get_devpath(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->devpath; +} + +/** + * udev_device_get_syspath: + * @udev_device: udev device + * + * Retrieve the sys path of the udev device. The path is an + * absolute path and starts with the sys mount point. + * + * Returns: the sys path of the udev device + **/ +const char *udev_device_get_syspath(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->syspath; +} + +const char *udev_device_get_sysname(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->sysname; +} + +const char *udev_device_get_sysnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->sysnum; +} + +/** + * udev_device_get_devnode: + * @udev_device: udev device + * + * Retrieve the device node file name belonging to the udev device. + * The path is an absolute path, and starts with the device directory. + * + * Returns: the device node file name of the udev device, or #NULL if no device node exists + **/ +const char *udev_device_get_devnode(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_device->devnode; +} + +/** + * udev_device_get_subsystem: + * @udev_device: udev device + * + * Retrieve the subsystem string of the udev device. The string does not + * contain any "/". + * + * Returns: the subsystem name of the udev device, or #NULL if it can not be determined + **/ +const char *udev_device_get_subsystem(struct udev_device *udev_device) +{ + char subsystem[UTIL_NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (!udev_device->subsystem_set) { + udev_device->subsystem_set = 1; + /* read "subsytem" link */ + if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { + udev_device_set_subsystem(udev_device, subsystem); + return udev_device->subsystem; + } + /* implicit names */ + if (strncmp(udev_device->devpath, "/module/", 8) == 0) { + udev_device_set_subsystem(udev_device, "module"); + return udev_device->subsystem; + } + if (strstr(udev_device->devpath, "/drivers/") != NULL) { + udev_device_set_subsystem(udev_device, "drivers"); + return udev_device->subsystem; + } + if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || + strncmp(udev_device->devpath, "/class/", 7) == 0 || + strncmp(udev_device->devpath, "/bus/", 5) == 0) { + udev_device_set_subsystem(udev_device, "subsystem"); + return udev_device->subsystem; + } + } + return udev_device->subsystem; +} + +/** + * udev_device_get_devtype: + * @udev_device: udev device + * + * Retrieve the devtype string of the udev device. + * + * Returns: the devtype name of the udev device, or #NULL if it can not be determined + **/ +const char *udev_device_get_devtype(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->devtype_set) { + udev_device->devtype_set = 1; + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + } + return udev_device->devtype; +} + +/** + * udev_device_get_devlinks_list_entry: + * @udev_device: udev device + * + * Retrieve the list of device links pointing to the device file of + * the udev device. The next list entry can be retrieved with + * udev_list_entry_next(), which returns #NULL if no more entries exist. + * The devlink path can be retrieved from the list entry by + * udev_list_entry_get_name(). The path is an absolute path, and starts with + * the device directory. + * + * Returns: the first entry of the device node link list + **/ +struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_list_get_entry(&udev_device->devlinks_list); +} + +void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) +{ + udev_device->devlinks_uptodate = 0; + udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); +} + +/** + * udev_device_get_properties_list_entry: + * @udev_device: udev device + * + * Retrieve the list of key/value device properties of the udev + * device. The next list entry can be retrieved with udev_list_entry_next(), + * which returns #NULL if no more entries exist. The property name + * can be retrieved from the list entry by udev_list_get_name(), + * the property value by udev_list_get_value(). + * + * Returns: the first entry of the property list + **/ +struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) + device_load_info(udev_device); + if (!udev_device->devlinks_uptodate) { + char symlinks[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + + udev_device->devlinks_uptodate = 1; + list_entry = udev_device_get_devlinks_list_entry(udev_device); + if (list_entry != NULL) { + char *s; + size_t l; + + s = symlinks; + l = util_strpcpyl(&s, sizeof(symlinks), udev_list_entry_get_name(list_entry), NULL); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) + l = util_strpcpyl(&s, l, " ", udev_list_entry_get_name(list_entry), NULL); + udev_device_add_property(udev_device, "DEVLINKS", symlinks); + } + } + return udev_list_get_entry(&udev_device->properties_list); +} + +const char *udev_device_get_driver(struct udev_device *udev_device) +{ + char driver[UTIL_NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (!udev_device->driver_set) { + udev_device->driver_set = 1; + if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) > 0) + udev_device->driver = strdup(driver); + } + return udev_device->driver; +} + +dev_t udev_device_get_devnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return makedev(0, 0); + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_device->devnum; +} + +const char *udev_device_get_action(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->action; +} + +unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return 0; + return udev_device->seqnum; +} + +const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) +{ + struct udev_list_entry *list_entry; + char path[UTIL_PATH_SIZE]; + char value[4096]; + struct stat statbuf; + int fd; + ssize_t size; + const char *val = NULL; + + if (udev_device == NULL) + return NULL; + if (sysattr == NULL) + return NULL; + + /* look for possibly already cached result */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_list)) { + if (strcmp(udev_list_entry_get_name(list_entry), sysattr) == 0) { + dbg(udev_device->udev, "got '%s' (%s) from cache\n", + sysattr, udev_list_entry_get_value(list_entry)); + return udev_list_entry_get_value(list_entry); + } + } + + util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); + if (lstat(path, &statbuf) != 0) { + dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); + udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, NULL, 0, 0); + goto out; + } + + if (S_ISLNK(statbuf.st_mode)) { + char target[UTIL_NAME_SIZE]; + int len; + char *pos; + + /* some core links return the last element of the target path */ + if (strcmp(sysattr, "driver") != 0 && + strcmp(sysattr, "subsystem") != 0 && + strcmp(sysattr, "module") != 0) + goto out; + + len = readlink(path, target, sizeof(target)); + if (len > 0) { + target[len] = '\0'; + pos = strrchr(target, '/'); + if (pos != NULL) { + pos = &pos[1]; + dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0); + val = udev_list_entry_get_value(list_entry); + } + } + goto out; + } + + /* skip directories */ + if (S_ISDIR(statbuf.st_mode)) + goto out; + + /* skip non-readable files */ + if ((statbuf.st_mode & S_IRUSR) == 0) + goto out; + + /* read attribute value */ + fd = open(path, O_RDONLY); + if (fd < 0) { + dbg(udev_device->udev, "attribute '%s' can not be opened\n", path); + goto out; + } + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + if (size == sizeof(value)) + goto out; + + /* got a valid value, store it in cache and return it */ + value[size] = '\0'; + util_remove_trailing_chars(value, '\n'); + dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, value, 0, 0); + val = udev_list_entry_get_value(list_entry); +out: + return val; +} + +int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) +{ + const char *pos; + size_t len; + + free(udev_device->syspath); + udev_device->syspath = strdup(syspath); + if (udev_device->syspath == NULL) + return -ENOMEM; + udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; + udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath); + + pos = strrchr(udev_device->syspath, '/'); + if (pos == NULL) + return -EINVAL; + udev_device->sysname = strdup(&pos[1]); + if (udev_device->sysname == NULL) + return -ENOMEM; + + /* some devices have '!' in their name, change that to '/' */ + len = 0; + while (udev_device->sysname[len] != '\0') { + if (udev_device->sysname[len] == '!') + udev_device->sysname[len] = '/'; + len++; + } + + /* trailing number */ + while (len > 0 && isdigit(udev_device->sysname[--len])) + udev_device->sysnum = &udev_device->sysname[len]; + + /* sysname is completely numeric */ + if (len == 0) + udev_device->sysnum = NULL; + + return 0; +} + +int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) +{ + free(udev_device->subsystem); + udev_device->subsystem = strdup(subsystem); + if (udev_device->subsystem == NULL) + return -ENOMEM; + udev_device->subsystem_set = 1; + udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); + return 0; +} + +int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) +{ + free(udev_device->devtype); + udev_device->devtype = strdup(devtype); + if (udev_device->devtype == NULL) + return -ENOMEM; + udev_device->devtype_set = 1; + udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); + return 0; +} + +int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) +{ + free(udev_device->devnode); + udev_device->devnode = strdup(devnode); + if (devnode == NULL) + return 0; + if (udev_device->devnode == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); + return 0; +} + +int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink) +{ + udev_device->devlinks_uptodate = 0; + if (udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + +struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) +{ + udev_device->envp_uptodate = 0; + if (value == NULL) { + struct udev_list_entry *list_entry; + + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + if (list_entry != NULL) + udev_list_entry_delete(list_entry); + return NULL; + } + return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); +} + +struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) +{ + char name[UTIL_PATH_SIZE]; + char *val; + + util_strscpy(name, sizeof(name), property); + val = strchr(name, '='); + if (val == NULL) + return NULL; + val[0] = '\0'; + val = &val[1]; + if (val[0] == '\0') + val = NULL; + return udev_device_add_property(udev_device, name, val); +} + +const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) +{ + struct udev_list_entry *list_entry; + + if (udev_device == NULL) + return NULL; + if (key == NULL) + return NULL; + + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + return udev_list_entry_get_value(list_entry); +} + +#define ENVP_SIZE 128 +#define MONITOR_BUF_SIZE 4096 +static int update_envp_monitor_buf(struct udev_device *udev_device) +{ + struct udev_list_entry *list_entry; + char *s; + size_t l; + unsigned int i; + + /* monitor buffer of property strings */ + free(udev_device->monitor_buf); + udev_device->monitor_buf_len = 0; + udev_device->monitor_buf = malloc(MONITOR_BUF_SIZE); + if (udev_device->monitor_buf == NULL) + return -ENOMEM; + + /* envp array, strings will point into monitor buffer */ + if (udev_device->envp == NULL) + udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); + if (udev_device->envp == NULL) + return -ENOMEM; + + i = 0; + s = udev_device->monitor_buf; + l = MONITOR_BUF_SIZE; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + /* add string to envp array */ + udev_device->envp[i++] = s; + if (i+1 >= ENVP_SIZE) + return -EINVAL; + + /* add property string to monitor buffer */ + l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), "=", + udev_list_entry_get_value(list_entry), NULL); + if (l == 0) + return -EINVAL; + s++; + } + udev_device->envp[i] = NULL; + udev_device->monitor_buf_len = s - udev_device->monitor_buf; + udev_device->envp_uptodate = 1; + dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", + i, udev_device->monitor_buf_len); + return 0; +} + +char **udev_device_get_properties_envp(struct udev_device *udev_device) +{ + if (!udev_device->envp_uptodate) + if (update_envp_monitor_buf(udev_device) != 0) + return NULL; + return udev_device->envp; +} + +ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf) +{ + if (!udev_device->envp_uptodate) + if (update_envp_monitor_buf(udev_device) != 0) + return -EINVAL; + *buf = udev_device->monitor_buf; + return udev_device->monitor_buf_len; +} + +int udev_device_set_action(struct udev_device *udev_device, const char *action) +{ + free(udev_device->action); + udev_device->action = strdup(action); + if (udev_device->action == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "ACTION", udev_device->action); + return 0; +} + +int udev_device_set_driver(struct udev_device *udev_device, const char *driver) +{ + free(udev_device->driver); + udev_device->driver = strdup(driver); + if (udev_device->driver == NULL) + return -ENOMEM; + udev_device->driver_set = 1; + udev_device_add_property(udev_device, "DRIVER", udev_device->driver); + return 0; +} + +const char *udev_device_get_devpath_old(struct udev_device *udev_device) +{ + return udev_device->devpath_old; +} + +int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) +{ + udev_device->devpath_old = strdup(devpath_old); + if (udev_device->devpath_old == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); + return 0; +} + +const char *udev_device_get_knodename(struct udev_device *udev_device) +{ + return udev_device->knodename; +} + +int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename) +{ + udev_device->knodename = strdup(knodename); + if (udev_device->knodename == NULL) + return -ENOMEM; + return 0; +} + +int udev_device_get_timeout(struct udev_device *udev_device) +{ + return udev_device->timeout; +} + +int udev_device_set_timeout(struct udev_device *udev_device, int timeout) +{ + udev_device->timeout = timeout; + return 0; +} +int udev_device_get_event_timeout(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_device->event_timeout; +} + +int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout) +{ + udev_device->event_timeout = event_timeout; + return 0; +} + +int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) +{ + char num[32]; + + udev_device->seqnum = seqnum; + snprintf(num, sizeof(num), "%llu", seqnum); + udev_device_add_property(udev_device, "SEQNUM", num); + return 0; +} + +int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) +{ + char num[32]; + + udev_device->devnum = devnum; + + snprintf(num, sizeof(num), "%u", major(devnum)); + udev_device_add_property(udev_device, "MAJOR", num); + snprintf(num, sizeof(num), "%u", minor(devnum)); + udev_device_add_property(udev_device, "MINOR", num); + return 0; +} + +int udev_device_get_num_fake_partitions(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_device->num_fake_partitions; +} + +int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num) +{ + udev_device->num_fake_partitions = num; + return 0; +} + +int udev_device_get_devlink_priority(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_device->devlink_priority; +} + +int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) +{ + udev_device->devlink_priority = prio; + return 0; +} + +int udev_device_get_ignore_remove(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_device->ignore_remove; +} + +int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore) +{ + udev_device->ignore_remove = ignore; + return 0; +} + +int udev_device_get_watch_handle(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + device_load_info(udev_device); + return udev_device->watch_handle; +} + +int udev_device_set_watch_handle(struct udev_device *udev_device, int handle) +{ + udev_device->watch_handle = handle; + return 0; +} diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c new file mode 100644 index 0000000000..63f84062b2 --- /dev/null +++ b/libudev/libudev-enumerate.c @@ -0,0 +1,479 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static int devices_sort(struct udev_enumerate *udev_enumerate); + +struct udev_enumerate { + struct udev *udev; + int refcount; + struct udev_list_node sysattr_match_list; + struct udev_list_node sysattr_nomatch_list; + struct udev_list_node subsystem_match_list; + struct udev_list_node subsystem_nomatch_list; + struct udev_list_node properties_match_list; + struct udev_list_node devices_list; + int devices_sorted; +}; + +/** + * udev_enumerate_new: + * @udev: udev library context + * + * Returns: an enumeration context + **/ +struct udev_enumerate *udev_enumerate_new(struct udev *udev) +{ + struct udev_enumerate *udev_enumerate; + + udev_enumerate = calloc(1, sizeof(struct udev_enumerate)); + if (udev_enumerate == NULL) + return NULL; + udev_enumerate->refcount = 1; + udev_enumerate->udev = udev; + udev_list_init(&udev_enumerate->devices_list); + udev_list_init(&udev_enumerate->sysattr_match_list); + udev_list_init(&udev_enumerate->sysattr_nomatch_list); + udev_list_init(&udev_enumerate->subsystem_match_list); + udev_list_init(&udev_enumerate->subsystem_nomatch_list); + udev_list_init(&udev_enumerate->properties_match_list); + return udev_enumerate; +} + +struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return NULL; + udev_enumerate->refcount++; + return udev_enumerate; +} + +void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return; + udev_enumerate->refcount--; + if (udev_enumerate->refcount > 0) + return; + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_match_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_nomatch_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->properties_match_list); + free(udev_enumerate); +} + +struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return NULL; + return udev_enumerate->udev; +} + +struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return NULL; + if (!udev_enumerate->devices_sorted) + devices_sort(udev_enumerate); + return udev_list_get_entry(&udev_enumerate->devices_list); +} + +int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (subsystem == NULL) + return 0; + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->subsystem_match_list, subsystem, NULL, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + +int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (subsystem == NULL) + return 0; + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->subsystem_nomatch_list, subsystem, NULL, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + +int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (sysattr == NULL) + return 0; + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->sysattr_match_list, sysattr, value, 0, 0) == NULL) + return -ENOMEM; + return 0; +} + +int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (sysattr == NULL) + return 0; + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->sysattr_nomatch_list, sysattr, value, 0, 0) == NULL) + return -ENOMEM; + return 0; +} + +static int match_sysattr_value(struct udev *udev, const char *syspath, const char *sysattr, const char *match_val) +{ + struct udev_device *device; + const char *val = NULL; + int match = 0; + + device = udev_device_new_from_syspath(udev, syspath); + if (device == NULL) + return -EINVAL; + val = udev_device_get_sysattr_value(device, sysattr); + if (val == NULL) + goto exit; + if (match_val == NULL) { + match = 1; + goto exit; + } + if (fnmatch(match_val, val, 0) == 0) { + match = 1; + goto exit; + } +exit: + udev_device_unref(device); + return match; +} + +int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (property == NULL) + return 0; + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->properties_match_list, property, value, 0, 0) == NULL) + return -ENOMEM; + return 0; +} + +static int match_sysattr(struct udev_enumerate *udev_enumerate, const char *syspath) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_list_entry *list_entry; + + /* skip list */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_nomatch_list)) { + if (match_sysattr_value(udev, syspath, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return 0; + } + /* include list */ + if (udev_list_get_entry(&udev_enumerate->sysattr_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_match_list)) { + /* anything that does not match, will make it FALSE */ + if (!match_sysattr_value(udev, syspath, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return 0; + } + return 1; + } + return 1; +} + +static int match_property(struct udev_enumerate *udev_enumerate, const char *syspath) +{ + struct udev_device *dev; + struct udev_list_entry *list_entry; + int match = 0; + + /* no match always matches */ + if (udev_list_get_entry(&udev_enumerate->properties_match_list) == NULL) + return 1; + + /* no device does not match */ + dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (dev == NULL) + return 0; + + /* loop over matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) { + const char *match_key = udev_list_entry_get_name(list_entry); + const char *match_value = udev_list_entry_get_value(list_entry); + struct udev_list_entry *property_entry; + + /* loop over device properties */ + udev_list_entry_foreach(property_entry, udev_device_get_properties_list_entry(dev)) { + const char *dev_key = udev_list_entry_get_name(property_entry); + const char *dev_value = udev_list_entry_get_value(property_entry); + + if (fnmatch(match_key, dev_key, 0) != 0) + continue; + if (match_value == NULL && dev_value == NULL) { + match = 1; + goto out; + } + if (match_value == NULL || dev_value == NULL) + continue; + if (fnmatch(match_value, dev_value, 0) == 0) { + match = 1; + goto out; + } + } + } +out: + udev_device_unref(dev); + return match; +} + +static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, + const char *basedir, const char *subdir1, const char *subdir2) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char path[UTIL_PATH_SIZE]; + size_t l; + char *s; + DIR *dir; + struct dirent *dent; + + s = path; + l = util_strpcpyl(&s, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); + if (subdir1 != NULL) + l = util_strpcpyl(&s, l, "/", subdir1, NULL); + if (subdir2 != NULL) + l = util_strpcpyl(&s, l, "/", subdir2, NULL); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char syspath[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + struct stat statbuf; + + if (dent->d_name[0] == '.') + continue; + util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); + if (lstat(syspath, &statbuf) != 0) + continue; + if (S_ISREG(statbuf.st_mode)) + continue; + if (S_ISLNK(statbuf.st_mode)) + util_resolve_sys_link(udev, syspath, sizeof(syspath)); + + util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); + if (stat(filename, &statbuf) != 0) + continue; + if (!match_sysattr(udev_enumerate, syspath)) + continue; + if (!match_property(udev_enumerate, syspath)) + continue; + udev_list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); + } + closedir(dir); + return 0; +} + +static int match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +{ + struct udev_list_entry *list_entry; + + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) + return 0; + } + if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) + return 1; + } + return 0; + } + return 1; +} + +static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir, const char *subsystem) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + + char path[UTIL_PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + if (!match_subsystem(udev_enumerate, subsystem != NULL ? subsystem : dent->d_name)) + continue; + scan_dir_and_add_devices(udev_enumerate, basedir, dent->d_name, subdir); + } + closedir(dir); + return 0; +} + +static int devices_delay(struct udev *udev, const char *syspath) +{ + static const char *delay_device_list[] = { + "/block/md", + "/block/dm-", + NULL + }; + size_t len; + int i; + + len = strlen(udev_get_sys_path(udev)); + for (i = 0; delay_device_list[i] != NULL; i++) { + if (strstr(&syspath[len], delay_device_list[i]) != NULL) { + dbg(udev, "delaying: %s\n", syspath); + return 1; + } + } + return 0; +} + +/* sort delayed devices to the end of the list */ +static int devices_sort(struct udev_enumerate *udev_enumerate) +{ + struct udev_list_entry *entry_loop; + struct udev_list_entry *entry_tmp; + struct udev_list_node devices_list; + + udev_list_init(&devices_list); + /* move delayed to delay list */ + udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(&udev_enumerate->devices_list)) { + if (devices_delay(udev_enumerate->udev, udev_list_entry_get_name(entry_loop))) { + udev_list_entry_remove(entry_loop); + udev_list_entry_append(entry_loop, &devices_list); + } + } + /* move delayed back to end of list */ + udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(&devices_list)) { + udev_list_entry_remove(entry_loop); + udev_list_entry_append(entry_loop, &udev_enumerate->devices_list); + } + udev_enumerate->devices_sorted = 1; + return 0; +} + +int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_device *udev_device; + + if (udev_enumerate == NULL) + return -EINVAL; + if (syspath == NULL) + return 0; + /* resolve to real syspath */ + udev_device = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (udev_device == NULL) + return -EINVAL; + udev_list_entry_add(udev, &udev_enumerate->devices_list, + udev_device_get_syspath(udev_device), NULL, 1, 1); + udev_device_unref(udev_device); + return 0; +} + +/** + * udev_enumerate_scan_devices: + * @udev_enumerate: udev enumeration context + * + * Returns: a negative value on error. + **/ +int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char base[UTIL_PATH_SIZE]; + struct stat statbuf; + + if (udev_enumerate == NULL) + return -EINVAL; + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); + if (stat(base, &statbuf) == 0) { + /* we have /subsystem/, forget all the old stuff */ + dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); + scan_dir(udev_enumerate, "subsystem", "devices", NULL); + } else { + dbg(udev, "searching '/bus/*/devices/*' dir\n"); + scan_dir(udev_enumerate, "bus", "devices", NULL); + dbg(udev, "searching '/class/*' dir\n"); + scan_dir(udev_enumerate, "class", NULL, NULL); + /* if block isn't a class, scan /block/ */ + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/class/block", NULL); + if (stat(base, &statbuf) != 0) { + if (match_subsystem(udev_enumerate, "block")) { + dbg(udev, "searching '/block/*' dir\n"); + /* scan disks */ + scan_dir_and_add_devices(udev_enumerate, "block", NULL, NULL); + /* scan partitions */ + dbg(udev, "searching '/block/*/*' dir\n"); + scan_dir(udev_enumerate, "block", NULL, "block"); + } + } + } + return 0; +} + +/** + * udev_enumerate_scan_subsystems: + * @udev_enumerate: udev enumeration context + * + * Returns: a negative value on error. + **/ +int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char base[UTIL_PATH_SIZE]; + struct stat statbuf; + const char *subsysdir; + + if (udev_enumerate == NULL) + return -EINVAL; + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); + if (stat(base, &statbuf) == 0) + subsysdir = "subsystem"; + else + subsysdir = "bus"; + if (match_subsystem(udev_enumerate, "subsystem")) { + dbg(udev, "searching '%s/*' dir\n", subsysdir); + scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); + } + if (match_subsystem(udev_enumerate, "drivers")) { + dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); + scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); + } + return 0; +} diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c new file mode 100644 index 0000000000..182d75aa8a --- /dev/null +++ b/libudev/libudev-list.c @@ -0,0 +1,235 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +struct udev_list_entry { + struct udev_list_node node; + struct udev *udev; + struct udev_list_node *list; + char *name; + char *value; + int flag; +}; + +/* list head point to itself if empty */ +void udev_list_init(struct udev_list_node *list) +{ + list->next = list; + list->prev = list; +} + +int udev_list_is_empty(struct udev_list_node *list) +{ + return list->next == list; +} + +static void udev_list_node_insert_between(struct udev_list_node *new, + struct udev_list_node *prev, + struct udev_list_node *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list) +{ + udev_list_node_insert_between(new, list->prev, list); +} + +void udev_list_node_remove(struct udev_list_node *entry) +{ + struct udev_list_node *prev = entry->prev; + struct udev_list_node *next = entry->next; + + next->prev = prev; + prev->next = next; + + entry->prev = NULL; + entry->next = NULL; +} + +/* return list entry which embeds this node */ +static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) +{ + char *list; + + list = (char *)node; + list -= offsetof(struct udev_list_entry, node); + return (struct udev_list_entry *)list; +} + +/* insert entry into a list as the last element */ +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list) +{ + /* inserting before the list head make the node the last node in the list */ + udev_list_node_insert_between(&new->node, list->prev, list); + new->list = list; +} + +/* remove entry from a list */ +void udev_list_entry_remove(struct udev_list_entry *entry) +{ + udev_list_node_remove(&entry->node); + entry->list = NULL; +} + +/* insert entry into a list, before a given existing entry */ +void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) +{ + udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node); + new->list = entry->list; +} + +struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, + const char *name, const char *value, + int unique, int sort) +{ + struct udev_list_entry *entry_loop = NULL; + struct udev_list_entry *entry_new; + + if (unique) + udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { + if (strcmp(entry_loop->name, name) == 0) { + dbg(udev, "'%s' is already in the list\n", name); + free(entry_loop->value); + if (value == NULL) { + entry_loop->value = NULL; + dbg(udev, "'%s' value unset\n", name); + return entry_loop; + } + entry_loop->value = strdup(value); + if (entry_loop->value == NULL) + return NULL; + dbg(udev, "'%s' value replaced with '%s'\n", name, value); + return entry_loop; + } + } + + if (sort) + udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { + if (strcmp(entry_loop->name, name) > 0) + break; + } + + entry_new = malloc(sizeof(struct udev_list_entry)); + if (entry_new == NULL) + return NULL; + memset(entry_new, 0x00, sizeof(struct udev_list_entry)); + entry_new->udev = udev; + entry_new->name = strdup(name); + if (entry_new->name == NULL) { + free(entry_new); + return NULL; + } + if (value != NULL) { + entry_new->value = strdup(value); + if (entry_new->value == NULL) { + free(entry_new->name); + free(entry_new); + return NULL; + } + } + if (entry_loop != NULL) + udev_list_entry_insert_before(entry_new, entry_loop); + else + udev_list_entry_append(entry_new, list); + dbg(udev, "'%s=%s' added\n", entry_new->name, entry_new->value); + return entry_new; +} + +void udev_list_entry_delete(struct udev_list_entry *entry) +{ + udev_list_node_remove(&entry->node); + free(entry->name); + free(entry->value); + free(entry); +} + +void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *list) +{ + struct udev_list_entry *entry_loop; + struct udev_list_entry *entry_tmp; + + udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) + udev_list_entry_delete(entry_loop); +} + +struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) +{ + if (udev_list_is_empty(list)) + return NULL; + return list_node_to_entry(list->next); +} + +struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) +{ + struct udev_list_node *next; + + if (list_entry == NULL) + return NULL; + next = list_entry->node.next; + /* empty list or no more entries */ + if (next == list_entry->list) + return NULL; + return list_node_to_entry(next); +} + +struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) +{ + struct udev_list_entry *entry; + + udev_list_entry_foreach(entry, list_entry) { + if (strcmp(udev_list_entry_get_name(entry), name) == 0) { + dbg(entry->udev, "found '%s=%s'\n", entry->name, entry->value); + return entry; + } + } + return NULL; +} + +const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) +{ + if (list_entry == NULL) + return NULL; + return list_entry->name; +} + +const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) +{ + if (list_entry == NULL) + return NULL; + return list_entry->value; +} + +int udev_list_entry_get_flag(struct udev_list_entry *list_entry) +{ + if (list_entry == NULL) + return -EINVAL; + return list_entry->flag; +} + +void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag) +{ + if (list_entry == NULL) + return; + list_entry->flag = flag; +} diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c new file mode 100644 index 0000000000..7a0cb47852 --- /dev/null +++ b/libudev/libudev-monitor.c @@ -0,0 +1,760 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2009 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +struct udev_monitor { + struct udev *udev; + int refcount; + int sock; + struct sockaddr_nl snl; + struct sockaddr_nl snl_trusted_sender; + struct sockaddr_nl snl_destination; + struct sockaddr_un sun; + socklen_t addrlen; + struct udev_list_node filter_subsystem_list; +}; + +enum udev_monitor_netlink_group { + UDEV_MONITOR_NONE, + UDEV_MONITOR_KERNEL, + UDEV_MONITOR_UDEV, +}; + +#define UDEV_MONITOR_MAGIC 0xcafe1dea +struct udev_monitor_netlink_header { + /* udev version text */ + char version[16]; + /* + * magic to protect against daemon <-> library message format mismatch + * used in the kernel from socket filter rules; needs to be stored in network order + */ + unsigned int magic; + /* properties buffer */ + unsigned short properties_off; + unsigned short properties_len; + /* + * hashes of some common device properties strings to filter with socket filters in + * the client used in the kernel from socket filter rules; needs to be stored in + * network order + */ + unsigned int filter_subsystem; + unsigned int filter_devtype; +}; + +static struct udev_monitor *udev_monitor_new(struct udev *udev) +{ + struct udev_monitor *udev_monitor; + + udev_monitor = calloc(1, sizeof(struct udev_monitor)); + if (udev_monitor == NULL) + return NULL; + udev_monitor->refcount = 1; + udev_monitor->udev = udev; + udev_list_init(&udev_monitor->filter_subsystem_list); + return udev_monitor; +} + +/** + * udev_monitor_new_from_socket: + * @udev: udev library context + * @socket_path: unix socket path + * + * Create new udev monitor and connect to a specified socket. The + * path to a socket either points to an existing socket file, or if + * the socket path starts with a '@' character, an abstract namespace + * socket will be used. + * + * A socket file will not be created. If it does not already exist, + * it will fall-back and connect to an abstract namespace socket with + * the given path. The permissions adjustment of a socket file, as + * well as the later cleanup, needs to be done by the caller. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev monitor. + * + * Returns: a new udev monitor, or #NULL, in case of an error + **/ +struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) +{ + struct udev_monitor *udev_monitor; + struct stat statbuf; + + if (udev == NULL) + return NULL; + if (socket_path == NULL) + return NULL; + udev_monitor = udev_monitor_new(udev); + if (udev_monitor == NULL) + return NULL; + + udev_monitor->sun.sun_family = AF_LOCAL; + if (socket_path[0] == '@') { + /* translate leading '@' to abstract namespace */ + util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); + udev_monitor->sun.sun_path[0] = '\0'; + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); + } else if (stat(socket_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { + /* existing socket file */ + util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); + } else { + /* no socket file, assume abstract namespace socket */ + util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; + } + udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + if (udev_monitor->sock == -1) { + err(udev, "error getting socket: %m\n"); + free(udev_monitor); + return NULL; + } + util_set_fd_cloexec(udev_monitor->sock); + + dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); + return udev_monitor; +} + +/** + * udev_monitor_new_from_netlink: + * @udev: udev library context + * @name: name of event source + * + * Create new udev monitor and connect to a specified event + * source. Valid sources identifiers are "udev" and "kernel". + * + * Applications should usually not connect directly to the + * "kernel" events, because the devices might not be useable + * at that time, before udev has configured them, and created + * device nodes. + * + * Accessing devices at the same time as udev, might result + * in unpredictable behavior. + * + * The "udev" events are sent out after udev has finished its + * event processing, all rules have been processed, and needed + * device nodes are created. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev monitor. + * + * Returns: a new udev monitor, or #NULL, in case of an error + **/ +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) +{ + struct udev_monitor *udev_monitor; + unsigned int group; + + if (udev == NULL) + return NULL; + + if (name == NULL) + group = UDEV_MONITOR_NONE; + else if (strcmp(name, "udev") == 0) + group = UDEV_MONITOR_UDEV; + else if (strcmp(name, "kernel") == 0) + group = UDEV_MONITOR_KERNEL; + else + return NULL; + + udev_monitor = udev_monitor_new(udev); + if (udev_monitor == NULL) + return NULL; + + udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + if (udev_monitor->sock == -1) { + err(udev, "error getting socket: %m\n"); + free(udev_monitor); + return NULL; + } + util_set_fd_cloexec(udev_monitor->sock); + + udev_monitor->snl.nl_family = AF_NETLINK; + udev_monitor->snl.nl_groups = group; + + /* default destination for sending */ + udev_monitor->snl_destination.nl_family = AF_NETLINK; + udev_monitor->snl_destination.nl_groups = UDEV_MONITOR_UDEV; + + dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT (%u)\n", udev_monitor, group); + return udev_monitor; +} + +static inline void bpf_stmt(struct sock_filter *inss, unsigned int *i, + unsigned short code, unsigned int data) +{ + struct sock_filter *ins = &inss[*i]; + + ins->code = code; + ins->k = data; + (*i)++; +} + +static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, + unsigned short code, unsigned int data, + unsigned short jt, unsigned short jf) +{ + struct sock_filter *ins = &inss[*i]; + + ins->code = code; + ins->jt = jt; + ins->jf = jf; + ins->k = data; + (*i)++; +} + +int udev_monitor_filter_update(struct udev_monitor *udev_monitor) +{ + static struct sock_filter ins[256]; + static struct sock_fprog filter; + unsigned int i; + struct udev_list_entry *list_entry; + int err; + + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) + return 0; + + memset(ins, 0x00, sizeof(ins)); + i = 0; + + /* load magic in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, magic)); + /* jump if magic matches */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, UDEV_MONITOR_MAGIC, 1, 0); + /* wrong magic, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + + /* add all subsystem match values */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { + unsigned int hash; + + /* load filter_subsystem value in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem)); + hash = util_string_hash32(udev_list_entry_get_name(list_entry)); + if (udev_list_entry_get_value(list_entry) == NULL) { + /* jump if subsystem does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); + } else { + /* jump if subsystem does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3); + + /* load filter_devtype value in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_devtype)); + /* jump if value does not match */ + hash = util_string_hash32(udev_list_entry_get_value(list_entry)); + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); + } + + /* matched, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + + if (i+1 >= ARRAY_SIZE(ins)) + return -1; + } + /* nothing matched, drop packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); + + /* install filter */ + filter.len = i; + filter.filter = ins; + err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); + return err; +} + +int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender) +{ + udev_monitor->snl_trusted_sender.nl_pid = sender->snl.nl_pid; + return 0; +} + +int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) +{ + int err; + const int on = 1; + + if (udev_monitor->sun.sun_family != 0) { + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); + } else if (udev_monitor->snl.nl_family != 0) { + udev_monitor_filter_update(udev_monitor); + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); + if (err == 0) { + struct sockaddr_nl snl; + socklen_t addrlen; + + /* + * get the address the kernel has assigned us + * it is usually, but not neccessarily the pid + */ + addrlen = sizeof(struct sockaddr_nl); + err = getsockname(udev_monitor->sock, (struct sockaddr *)&snl, &addrlen); + if (err == 0) + udev_monitor->snl.nl_pid = snl.nl_pid; + } + } else { + return -EINVAL; + } + + if (err < 0) { + err(udev_monitor->udev, "bind failed: %m\n"); + return err; + } + + /* enable receiving of sender credentials */ + setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + return 0; +} + +int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) +{ + if (udev_monitor == NULL) + return -1; + return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size)); +} + +int udev_monitor_disconnect(struct udev_monitor *udev_monitor) +{ + int err; + + err = close(udev_monitor->sock); + udev_monitor->sock = -1; + return err; +} + +/** + * udev_monitor_ref: + * @udev_monitor: udev monitor + * + * Take a reference of a udev monitor. + * + * Returns: the passed udev monitor + **/ +struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return NULL; + udev_monitor->refcount++; + return udev_monitor; +} + +/** + * udev_monitor_unref: + * @udev_monitor: udev monitor + * + * Drop a reference of a udev monitor. If the refcount reaches zero, + * the bound socket will be closed, and the resources of the monitor + * will be released. + * + **/ +void udev_monitor_unref(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return; + udev_monitor->refcount--; + if (udev_monitor->refcount > 0) + return; + if (udev_monitor->sock >= 0) + close(udev_monitor->sock); + udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); + dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); + free(udev_monitor); +} + +/** + * udev_monitor_get_udev: + * @udev_monitor: udev monitor + * + * Retrieve the udev library context the monitor was created with. + * + * Returns: the udev library context + **/ +struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return NULL; + return udev_monitor->udev; +} + +/** + * udev_monitor_get_fd: + * @udev_monitor: udev monitor + * + * Retrieve the socket file descriptor associated with the monitor. + * + * Returns: the socket file descriptor + **/ +int udev_monitor_get_fd(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return -1; + return udev_monitor->sock; +} + +static int passes_filter(struct udev_monitor *udev_monitor, struct udev_device *udev_device) +{ + struct udev_list_entry *list_entry; + + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) + return 1; + + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { + const char *subsys = udev_list_entry_get_name(list_entry); + const char *dsubsys = udev_device_get_subsystem(udev_device); + const char *devtype; + const char *ddevtype; + + if (strcmp(dsubsys, subsys) != 0) + continue; + + devtype = udev_list_entry_get_value(list_entry); + if (devtype == NULL) + return 1; + ddevtype = udev_device_get_devtype(udev_device); + if (ddevtype == NULL) + continue; + if (strcmp(ddevtype, devtype) == 0) + return 1; + } + return 0; +} + +/** + * udev_monitor_receive_device: + * @udev_monitor: udev monitor + * + * Receive data from the udev monitor socket, allocate a new udev + * device, fill in the received data, and return the device. + * + * Only socket connections with uid=0 are accepted. The caller + * needs to make sure that there is data to read from the socket. + * The call will block until the socket becomes readable. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, in case of an error + **/ +struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) +{ + struct udev_device *udev_device; + struct msghdr smsg; + struct iovec iov; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + struct cmsghdr *cmsg; + struct sockaddr_nl snl; + struct ucred *cred; + char buf[8192]; + ssize_t buflen; + ssize_t bufpos; + struct udev_monitor_netlink_header *nlh; + int devpath_set = 0; + int subsystem_set = 0; + int action_set = 0; + int maj = 0; + int min = 0; + int is_kernel = 0; + +retry: + if (udev_monitor == NULL) + return NULL; + memset(buf, 0x00, sizeof(buf)); + iov.iov_base = &buf; + iov.iov_len = sizeof(buf); + memset (&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + + if (udev_monitor->snl.nl_family != 0) { + smsg.msg_name = &snl; + smsg.msg_namelen = sizeof(snl); + } + + buflen = recvmsg(udev_monitor->sock, &smsg, 0); + if (buflen < 0) { + if (errno != EINTR) + info(udev_monitor->udev, "unable to receive message\n"); + return NULL; + } + + if (buflen < 32 || (size_t)buflen >= sizeof(buf)) { + info(udev_monitor->udev, "invalid message length\n"); + return NULL; + } + + if (udev_monitor->snl.nl_family != 0) { + if (snl.nl_groups == 0) { + /* unicast message, check if we trust the sender */ + if (udev_monitor->snl_trusted_sender.nl_pid == 0 || + snl.nl_pid != udev_monitor->snl_trusted_sender.nl_pid) { + info(udev_monitor->udev, "unicast netlink message ignored\n"); + return NULL; + } + } else if (snl.nl_groups == UDEV_MONITOR_KERNEL) { + if (snl.nl_pid > 0) { + info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", snl.nl_pid); + return NULL; + } + is_kernel = 1; + } + } + + cmsg = CMSG_FIRSTHDR(&smsg); + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + info(udev_monitor->udev, "no sender credentials received, message ignored\n"); + return NULL; + } + + cred = (struct ucred *)CMSG_DATA(cmsg); + if (cred->uid != 0) { + info(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid); + return NULL; + } + + if (strncmp(buf, "udev-", 5) == 0) { + /* udev message needs proper version magic */ + nlh = (struct udev_monitor_netlink_header *) buf; + if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) + return NULL; + if (nlh->properties_off < sizeof(struct udev_monitor_netlink_header)) + return NULL; + if (nlh->properties_off+32 > buflen) + return NULL; + bufpos = nlh->properties_off; + } else { + /* kernel message with header */ + bufpos = strlen(buf) + 1; + if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) { + info(udev_monitor->udev, "invalid message length\n"); + return NULL; + } + + /* check message header */ + if (strstr(buf, "@/") == NULL) { + info(udev_monitor->udev, "unrecognized message header\n"); + return NULL; + } + } + + udev_device = device_new(udev_monitor->udev); + if (udev_device == NULL) { + return NULL; + } + + while (bufpos < buflen) { + char *key; + size_t keylen; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + bufpos += keylen + 1; + + if (strncmp(key, "DEVPATH=", 8) == 0) { + char path[UTIL_PATH_SIZE]; + + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev_monitor->udev), &key[8], NULL); + udev_device_set_syspath(udev_device, path); + devpath_set = 1; + } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { + udev_device_set_subsystem(udev_device, &key[10]); + subsystem_set = 1; + } else if (strncmp(key, "DEVTYPE=", 8) == 0) { + udev_device_set_devtype(udev_device, &key[8]); + } else if (strncmp(key, "DEVNAME=", 8) == 0) { + if (is_kernel) + udev_device_set_knodename(udev_device, &key[8]); + else + udev_device_set_devnode(udev_device, &key[8]); + } else if (strncmp(key, "DEVLINKS=", 9) == 0) { + char devlinks[UTIL_PATH_SIZE]; + char *slink; + char *next; + + util_strscpy(devlinks, sizeof(devlinks), &key[9]); + slink = devlinks; + next = strchr(slink, ' '); + while (next != NULL) { + next[0] = '\0'; + udev_device_add_devlink(udev_device, slink); + slink = &next[1]; + next = strchr(slink, ' '); + } + if (slink[0] != '\0') + udev_device_add_devlink(udev_device, slink); + } else if (strncmp(key, "DRIVER=", 7) == 0) { + udev_device_set_driver(udev_device, &key[7]); + } else if (strncmp(key, "ACTION=", 7) == 0) { + udev_device_set_action(udev_device, &key[7]); + action_set = 1; + } else if (strncmp(key, "MAJOR=", 6) == 0) { + maj = strtoull(&key[6], NULL, 10); + } else if (strncmp(key, "MINOR=", 6) == 0) { + min = strtoull(&key[6], NULL, 10); + } else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) { + udev_device_set_devpath_old(udev_device, &key[12]); + } else if (strncmp(key, "SEQNUM=", 7) == 0) { + udev_device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10)); + } else if (strncmp(key, "TIMEOUT=", 8) == 0) { + udev_device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); + } else { + udev_device_add_property_from_string(udev_device, key); + } + } + if (!devpath_set || !subsystem_set || !action_set) { + info(udev_monitor->udev, "missing values, skip\n"); + udev_device_unref(udev_device); + return NULL; + } + + /* skip device, if it does not pass the current filter */ + if (!passes_filter(udev_monitor, udev_device)) { + struct pollfd pfd[1]; + int rc; + + udev_device_unref(udev_device); + + /* if something is queued, get next device */ + pfd[0].fd = udev_monitor->sock; + pfd[0].events = POLLIN; + rc = poll(pfd, 1, 0); + if (rc > 0) + goto retry; + return NULL; + } + + if (maj > 0) + udev_device_set_devnum(udev_device, makedev(maj, min)); + udev_device_set_info_loaded(udev_device); + return udev_device; +} + +int udev_monitor_send_device(struct udev_monitor *udev_monitor, + struct udev_monitor *destination, struct udev_device *udev_device) +{ + struct msghdr smsg; + struct iovec iov[2]; + const char *buf; + ssize_t blen; + ssize_t count; + + blen = udev_device_get_properties_monitor_buf(udev_device, &buf); + if (blen < 32) + return -1; + + if (udev_monitor->sun.sun_family != 0) { + const char *action; + char header[2048]; + char *s; + + /* header @ */ + action = udev_device_get_action(udev_device); + if (action == NULL) + return -EINVAL; + s = header; + if (util_strpcpyl(&s, sizeof(header), action, "@", udev_device_get_devpath(udev_device), NULL) == 0) + return -EINVAL; + iov[0].iov_base = header; + iov[0].iov_len = (s - header)+1; + + /* add properties list */ + iov[1].iov_base = (char *)buf; + iov[1].iov_len = blen; + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = iov; + smsg.msg_iovlen = 2; + smsg.msg_name = &udev_monitor->sun; + smsg.msg_namelen = udev_monitor->addrlen; + } else if (udev_monitor->snl.nl_family != 0) { + const char *val; + struct udev_monitor_netlink_header nlh; + + + /* add versioned header */ + memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header)); + util_strscpy(nlh.version, sizeof(nlh.version), "udev-" VERSION); + nlh.magic = htonl(UDEV_MONITOR_MAGIC); + val = udev_device_get_subsystem(udev_device); + nlh.filter_subsystem = htonl(util_string_hash32(val)); + val = udev_device_get_devtype(udev_device); + if (val != NULL) + nlh.filter_devtype = htonl(util_string_hash32(val)); + iov[0].iov_base = &nlh; + iov[0].iov_len = sizeof(struct udev_monitor_netlink_header); + + /* add properties list */ + nlh.properties_off = iov[0].iov_len; + nlh.properties_len = blen; + iov[1].iov_base = (char *)buf; + iov[1].iov_len = blen; + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = iov; + smsg.msg_iovlen = 2; + /* + * Use custom address for target, or the default one. + * + * If we send to a muticast group, we will get + * ECONNREFUSED, which is expected. + */ + if (destination != NULL) + smsg.msg_name = &destination->snl; + else + smsg.msg_name = &udev_monitor->snl_destination; + smsg.msg_namelen = sizeof(struct sockaddr_nl); + } else { + return -1; + } + + count = sendmsg(udev_monitor->sock, &smsg, 0); + info(udev_monitor->udev, "passed %zi bytes to monitor %p\n", count, udev_monitor); + return count; +} + +int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) +{ + if (udev_monitor == NULL) + return -EINVAL; + if (subsystem == NULL) + return 0; + if (udev_list_entry_add(udev_monitor->udev, + &udev_monitor->filter_subsystem_list, subsystem, devtype, 0, 0) == NULL) + return -ENOMEM; + return 0; +} + +int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) +{ + static struct sock_fprog filter = { 0, NULL }; + + udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); + return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); +} diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h new file mode 100644 index 0000000000..5512341e9e --- /dev/null +++ b/libudev/libudev-private.h @@ -0,0 +1,190 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2009 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#ifndef _LIBUDEV_PRIVATE_H_ +#define _LIBUDEV_PRIVATE_H_ + +#include +#include "libudev.h" + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +static inline void __attribute__ ((format(printf, 2, 3))) +udev_log_null(struct udev *udev, const char *format, ...) {} + +#ifdef USE_LOG +# ifdef DEBUG +# define dbg(udev, arg...) udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) +# else +# define dbg(udev, arg...) udev_log_null(udev, ## arg) +# endif +# define info(udev, arg...) udev_log(udev, LOG_INFO, __FILE__, __LINE__, __FUNCTION__, ## arg) +# define err(udev, arg...) udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) +#else +# define dbg(udev, arg...) udev_log_null(udev, ## arg) +# define info(udev, arg...) udev_log_null(udev, ## arg) +# define err(udev, arg...) udev_log_null(udev, ## arg) +#endif + +/* libudev */ +void udev_log(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, ...) + __attribute__ ((format(printf, 6, 7))); +struct udev_device *device_new(struct udev *udev); +const char *udev_get_rules_path(struct udev *udev); +int udev_get_run(struct udev *udev); +struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); +struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); + +/* libudev-device */ +int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); +int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); +int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype); +int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); +int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink); +void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); +struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); +struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); +char **udev_device_get_properties_envp(struct udev_device *udev_device); +ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); +int udev_device_read_db(struct udev_device *udev_device); +int udev_device_read_uevent_file(struct udev_device *udev_device); +int udev_device_set_action(struct udev_device *udev_device, const char *action); +int udev_device_set_driver(struct udev_device *udev_device, const char *driver); +const char *udev_device_get_devpath_old(struct udev_device *udev_device); +int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); +const char *udev_device_get_knodename(struct udev_device *udev_device); +int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename); +int udev_device_get_timeout(struct udev_device *udev_device); +int udev_device_set_timeout(struct udev_device *udev_device, int timeout); +int udev_device_get_event_timeout(struct udev_device *udev_device); +int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout); +int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); +int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); +int udev_device_get_num_fake_partitions(struct udev_device *udev_device); +int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num); +int udev_device_get_devlink_priority(struct udev_device *udev_device); +int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); +int udev_device_get_ignore_remove(struct udev_device *udev_device); +int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore); +int udev_device_get_watch_handle(struct udev_device *udev_device); +int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); +void udev_device_set_info_loaded(struct udev_device *device); + +/* libudev-device-db-write.c */ +int udev_device_update_db(struct udev_device *udev_device); +int udev_device_delete_db(struct udev_device *udev_device); +int udev_device_rename_db(struct udev_device *udev_device, const char *devpath); + +/* libudev-monitor - netlink/unix socket communication */ +int udev_monitor_disconnect(struct udev_monitor *udev_monitor); +int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); +int udev_monitor_send_device(struct udev_monitor *udev_monitor, + struct udev_monitor *destination, struct udev_device *udev_device); +int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); + +/* libudev-ctrl - daemon runtime setup */ +struct udev_ctrl; +struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); +void udev_ctrl_unref(struct udev_ctrl *uctrl); +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); +int udev_ctrl_get_fd(struct udev_ctrl *uctrl); +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority); +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl); +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl); +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl); +int udev_ctrl_send_settle(struct udev_ctrl *uctrl); +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key); +int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count); +struct udev_ctrl_msg; +struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl); +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl); +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); +void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); +pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg); +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); + +/* libudev-list */ +struct udev_list_node { + struct udev_list_node *next, *prev; +}; +void udev_list_init(struct udev_list_node *list); +int udev_list_is_empty(struct udev_list_node *list); +void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list); +void udev_list_node_remove(struct udev_list_node *entry); +#define udev_list_node_foreach(node, list) \ + for (node = (list)->next; \ + node != list; \ + node = (node)->next) +#define udev_list_node_foreach_safe(node, tmp, list) \ + for (node = (list)->next, tmp = (node)->next; \ + node != list; \ + node = tmp, tmp = (tmp)->next) +struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, + const char *name, const char *value, + int unique, int sort); +void udev_list_entry_delete(struct udev_list_entry *entry); +void udev_list_entry_remove(struct udev_list_entry *entry); +void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry); +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list); +void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list); +struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); +int udev_list_entry_get_flag(struct udev_list_entry *list_entry); +void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); +#define udev_list_entry_foreach_safe(entry, tmp, first) \ + for (entry = first, tmp = udev_list_entry_get_next(entry); \ + entry != NULL; \ + entry = tmp, tmp = udev_list_entry_get_next(tmp)) + +/* libudev-queue */ +unsigned long long int udev_get_kernel_seqnum(struct udev *udev); +int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum); +ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size); +ssize_t udev_queue_skip_devpath(FILE *queue_file); + +/* libudev-queue-export */ +struct udev_queue_export *udev_queue_export_new(struct udev *udev); +void udev_queue_export_unref(struct udev_queue_export *udev_queue_export); +void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); +int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); +int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); +int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); + +/* libudev-utils */ +#define UTIL_PATH_SIZE 1024 +#define UTIL_LINE_SIZE 2048 +#define UTIL_NAME_SIZE 512 +#define UDEV_ALLOWED_CHARS_INPUT "/ $%?," +ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); +ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); +int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); +int util_log_priority(const char *priority); +size_t util_path_encode(const char *src, char *dest, size_t size); +size_t util_path_decode(char *s); +void util_remove_trailing_chars(char *path, char c); +size_t util_strpcpy(char **dest, size_t size, const char *src); +size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__ ((sentinel)); +size_t util_strscpy(char *dest, size_t size, const char *src); +size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__ ((sentinel)); +int udev_util_replace_whitespace(const char *str, char *to, size_t len); +int udev_util_replace_chars(char *str, const char *white); +int udev_util_encode_string(const char *str, char *str_enc, size_t len); +void util_set_fd_cloexec(int fd); +unsigned int util_string_hash32(const char *str); +#endif diff --git a/libudev/libudev-queue-export.c b/libudev/libudev-queue-export.c new file mode 100644 index 0000000000..a36ff5150a --- /dev/null +++ b/libudev/libudev-queue-export.c @@ -0,0 +1,473 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2009 Alan Jenkins + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +/* + * DISCLAIMER - The file format mentioned here is private to udev/libudev, + * and may be changed without notice. + * + * + * The udev event queue is exported as a binary log file. + * Each log record consists of a sequence number followed by the device path. + * + * When a new event is queued, its details are appended to the log. + * When the event finishes, a second record is appended to the log + * with the same sequence number but a null devpath. + * + * Example: + * {1, "/devices/virtual/mem/null" }, + * {2, "/devices/virtual/mem/zero" }, + * {1, "" }, + * Event 2 is still queued, but event 1 has been finished + * + * The queue does not grow indefinitely. It is periodically re-created + * to remove finished events. Atomic rename() makes this transparent to readers. + * + * + * The queue file starts with a single sequence number which specifies the + * minimum sequence number in the log that follows. Any events prior to this + * sequence number have already finished. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); + +struct udev_queue_export { + struct udev *udev; + int failed_count; /* number of failed events exported */ + int queued_count; /* number of unfinished events exported in queue file */ + FILE *queue_file; + unsigned long long int seqnum_max; /* earliest sequence number in queue file */ + unsigned long long int seqnum_min; /* latest sequence number in queue file */ + int waste_bytes; /* queue file bytes wasted on finished events */ +}; + +struct udev_queue_export *udev_queue_export_new(struct udev *udev) +{ + struct udev_queue_export *udev_queue_export; + unsigned long long int initial_seqnum; + + if (udev == NULL) + return NULL; + + udev_queue_export = calloc(1, sizeof(struct udev_queue_export)); + if (udev_queue_export == NULL) + return NULL; + udev_queue_export->udev = udev; + + initial_seqnum = udev_get_kernel_seqnum(udev); + udev_queue_export->seqnum_min = initial_seqnum; + udev_queue_export->seqnum_max = initial_seqnum; + + udev_queue_export_cleanup(udev_queue_export); + if (rebuild_queue_file(udev_queue_export) != 0) { + free(udev_queue_export); + return NULL; + } + + return udev_queue_export; +} + +void udev_queue_export_unref(struct udev_queue_export *udev_queue_export) +{ + if (udev_queue_export == NULL) + return; + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + free(udev_queue_export); +} + +void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) +{ + char filename[UTIL_PATH_SIZE]; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + unlink(filename); + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + unlink(filename); +} + + +static int skip_to(FILE *file, long offset) +{ + long old_offset; + + /* fseek may drop buffered data, avoid it for small seeks */ + old_offset = ftell(file); + if (offset > old_offset && offset - old_offset <= BUFSIZ) { + size_t skip_bytes = offset - old_offset; + char buf[skip_bytes]; + + if (fread(buf, skip_bytes, 1, file) != skip_bytes) + return -1; + } + + return fseek(file, offset, SEEK_SET); +} + +struct queue_devpaths { + unsigned int devpaths_first; /* index of first queued event */ + unsigned int devpaths_size; + long devpaths[]; /* seqnum -> offset of devpath in queue file (or 0) */ +}; + +/* + * Returns a table mapping seqnum to devpath file offset for currently queued events. + * devpaths[i] represents the event with seqnum = i + udev_queue_export->seqnum_min. + */ +static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_export) +{ + struct queue_devpaths *devpaths; + unsigned long long int range; + long devpath_offset; + ssize_t devpath_len; + unsigned long long int seqnum; + unsigned long long int n; + unsigned int i; + + /* seek to the first event in the file */ + rewind(udev_queue_export->queue_file); + udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum); + + /* allocate the table */ + range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max; + if (range - 1 > INT_MAX) { + err(udev_queue_export->udev, "queue file overflow\n"); + return NULL; + } + devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); + if (index == NULL) + return NULL; + devpaths->devpaths_size = range + 1; + + /* read all records and populate the table */ + while(1) { + if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) + break; + n = seqnum - udev_queue_export->seqnum_max; + if (n >= devpaths->devpaths_size) + goto read_error; + + devpath_offset = ftell(udev_queue_export->queue_file); + devpath_len = udev_queue_skip_devpath(udev_queue_export->queue_file); + if (devpath_len < 0) + goto read_error; + + if (devpath_len > 0) + devpaths->devpaths[n] = devpath_offset; + else + devpaths->devpaths[n] = 0; + } + + /* find first queued event */ + for (i = 0; i < devpaths->devpaths_size; i++) { + if (devpaths->devpaths[i] != 0) + break; + } + devpaths->devpaths_first = i; + + return devpaths; + +read_error: + err(udev_queue_export->udev, "queue file corrupted\n"); + free(devpaths); + return NULL; +} + +static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) +{ + unsigned long long int seqnum; + struct queue_devpaths *devpaths = NULL; + char filename[UTIL_PATH_SIZE]; + char filename_tmp[UTIL_PATH_SIZE]; + FILE *new_queue_file = NULL; + unsigned int i; + + /* read old queue file */ + if (udev_queue_export->queue_file != NULL) { + dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n", + udev_queue_export->waste_bytes); + + devpaths = build_index(udev_queue_export); + if (devpaths != NULL) + udev_queue_export->seqnum_max += devpaths->devpaths_first; + } + if (devpaths == NULL) { + dbg(udev_queue_export->udev, "creating empty queue file\n"); + udev_queue_export->queued_count = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + } + + /* create new queue file */ + util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + new_queue_file = fopen(filename_tmp, "w+"); + if (new_queue_file == NULL) + goto error; + seqnum = udev_queue_export->seqnum_max; + fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); + + /* copy unfinished events only to the new file */ + if (devpaths != NULL) { + for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { + char devpath[UTIL_PATH_SIZE]; + int err; + unsigned short devpath_len; + + if (devpaths->devpaths[i] != 0) + { + skip_to(udev_queue_export->queue_file, devpaths->devpaths[i]); + err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); + devpath_len = err; + + fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); + fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); + fwrite(devpath, 1, devpath_len, new_queue_file); + } + seqnum++; + } + free(devpaths); + devpaths = NULL; + } + fflush(new_queue_file); + if (ferror(new_queue_file)) + goto error; + + /* rename the new file on top of the old one */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + if (rename(filename_tmp, filename) != 0) + goto error; + + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = new_queue_file; + udev_queue_export->waste_bytes = 0; + + return 0; + +error: + err(udev_queue_export->udev, "failed to create queue file: %m\n"); + udev_queue_export_cleanup(udev_queue_export); + + if (udev_queue_export->queue_file != NULL) { + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + } + if (new_queue_file != NULL) + fclose(new_queue_file); + + if (devpaths != NULL) + free(devpaths); + udev_queue_export->queued_count = 0; + udev_queue_export->waste_bytes = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + + return -1; +} + +static int write_queue_record(struct udev_queue_export *udev_queue_export, + unsigned long long int seqnum, const char *devpath, size_t devpath_len) +{ + unsigned short len; + + if (udev_queue_export->queue_file == NULL) { + dbg(udev_queue_export->udev, "can't record event: queue file not available\n"); + return -1; + } + + if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1) + goto write_error; + + len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; + if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) + goto write_error; + if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) + goto write_error; + + /* *must* flush output; caller may fork */ + if (fflush(udev_queue_export->queue_file) != 0) + goto write_error; + + return 0; + +write_error: + /* if we failed half way through writing a record to a file, + we should not try to write any further records to it. */ + err(udev_queue_export->udev, "error writing to queue file: %m\n"); + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + + return -1; +} + + +enum device_state { + DEVICE_QUEUED, + DEVICE_FINISHED, + DEVICE_FAILED, +}; + +static inline size_t queue_record_size(size_t devpath_len) +{ + return sizeof(unsigned long long int) + sizeof(unsigned short int) + devpath_len; +} + +static int update_queue(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + unsigned long long int seqnum = udev_device_get_seqnum(udev_device); + const char *devpath = NULL; + size_t devpath_len = 0; + int bytes; + int err; + + if (state == DEVICE_QUEUED) { + devpath = udev_device_get_devpath(udev_device); + devpath_len = strlen(devpath); + } + + /* recover from an earlier failed rebuild */ + if (udev_queue_export->queue_file == NULL) { + if (rebuild_queue_file(udev_queue_export) != 0) + return -1; + } + + /* when the queue files grow too large, they must be garbage collected and rebuilt */ + bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); + + /* if we're removing the last event from the queue, that's the best time to rebuild it */ + if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1 && bytes > 2048) { + /* because we don't need to read the old queue file */ + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + rebuild_queue_file(udev_queue_export); + return 0; + } + + /* try to rebuild the queue files before they grow larger than one page. */ + if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) + rebuild_queue_file(udev_queue_export); + + /* don't record a finished event, if we already dropped the event in a failed rebuild */ + if (seqnum < udev_queue_export->seqnum_max) + return 0; + + /* now write to the queue */ + if (state == DEVICE_QUEUED) { + udev_queue_export->queued_count++; + udev_queue_export->seqnum_min = seqnum; + } else { + udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0); + udev_queue_export->queued_count--; + } + err = write_queue_record(udev_queue_export, seqnum, devpath, devpath_len); + + /* try to handle ENOSPC */ + if (err != 0 && udev_queue_export->queued_count == 0) { + udev_queue_export_cleanup(udev_queue_export); + err = rebuild_queue_file(udev_queue_export); + } + + return err; +} + +static void update_failed(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + char *s; + size_t l; + + if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) + return; + + /* location of failed file */ + s = filename; + l = util_strpcpyl(&s, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); + util_path_encode(udev_device_get_devpath(udev_device), s, l); + + switch (state) { + case DEVICE_FAILED: + /* record event in the failed directory */ + if (udev_queue_export->failed_count == 0) + util_create_path(udev, filename); + udev_queue_export->failed_count++; + + udev_selinux_setfscreatecon(udev, filename, S_IFLNK); + symlink(udev_device_get_devpath(udev_device), filename); + udev_selinux_resetfscreatecon(udev); + break; + + case DEVICE_QUEUED: + /* delete failed file */ + if (unlink(filename) == 0) { + util_delete_path(udev, filename); + udev_queue_export->failed_count--; + } + break; + + case DEVICE_FINISHED: + if (udev_device_get_devpath_old(udev_device) != NULL) { + /* "move" event - rename failed file to current name, do not delete failed */ + char filename_old[UTIL_PATH_SIZE]; + + s = filename_old; + l = util_strpcpyl(&s, sizeof(filename_old), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); + util_path_encode(udev_device_get_devpath_old(udev_device), s, l); + + if (rename(filename_old, filename) == 0) + info(udev, "renamed devpath, moved failed state of '%s' to %s'\n", + udev_device_get_devpath_old(udev_device), udev_device_get_devpath(udev_device)); + } + break; + } + + return; +} + +static int update(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + update_failed(udev_queue_export, udev_device, state); + + if (update_queue(udev_queue_export, udev_device, state) != 0) + return -1; + + return 0; +} + +int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_QUEUED); +} + +int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_FINISHED); +} + +int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_FAILED); +} diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c new file mode 100644 index 0000000000..cf1ddf3a07 --- /dev/null +++ b/libudev/libudev-queue.c @@ -0,0 +1,401 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2009 Alan Jenkins + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +struct udev_queue { + struct udev *udev; + int refcount; + struct udev_list_node queue_list; + struct udev_list_node failed_list; +}; + +struct udev_queue *udev_queue_new(struct udev *udev) +{ + struct udev_queue *udev_queue; + + if (udev == NULL) + return NULL; + + udev_queue = calloc(1, sizeof(struct udev_queue)); + if (udev_queue == NULL) + return NULL; + udev_queue->refcount = 1; + udev_queue->udev = udev; + udev_list_init(&udev_queue->queue_list); + udev_list_init(&udev_queue->failed_list); + return udev_queue; +} + +struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) +{ + if (udev_queue == NULL) + return NULL; + udev_queue->refcount++; + return udev_queue; +} + +void udev_queue_unref(struct udev_queue *udev_queue) +{ + if (udev_queue == NULL) + return; + udev_queue->refcount--; + if (udev_queue->refcount > 0) + return; + udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); + udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); + free(udev_queue); +} + +struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) +{ + if (udev_queue == NULL) + return NULL; + return udev_queue->udev; +} + +unsigned long long int udev_get_kernel_seqnum(struct udev *udev) +{ + char filename[UTIL_PATH_SIZE]; + unsigned long long int seqnum; + int fd; + char buf[32]; + ssize_t len; + + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); + fd = open(filename, O_RDONLY); + if (fd < 0) + return 0; + len = read(fd, buf, sizeof(buf)); + close(fd); + if (len <= 2) + return 0; + buf[len-1] = '\0'; + seqnum = strtoull(buf, NULL, 10); + return seqnum; +} + +unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum; + + if (udev_queue == NULL) + return -EINVAL; + + seqnum = udev_get_kernel_seqnum(udev_queue->udev); + dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); + return seqnum; +} + +int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum) +{ + if (fread(seqnum, sizeof(unsigned long long int), 1, queue_file) != 1) + return -1; + + return 0; +} + +ssize_t udev_queue_skip_devpath(FILE *queue_file) +{ + unsigned short int len; + + if (fread(&len, sizeof(unsigned short int), 1, queue_file) == 1) { + char devpath[len]; + + /* use fread to skip, fseek might drop buffered data */ + if (fread(devpath, 1, len, queue_file) == len) + return len; + } + + return -1; +} + +ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size) +{ + unsigned short int read_bytes = 0; + unsigned short int len; + + if (fread(&len, sizeof(unsigned short int), 1, queue_file) != 1) + return -1; + + read_bytes = (len < size - 1) ? len : size - 1; + if (fread(devpath, 1, read_bytes, queue_file) != read_bytes) + return -1; + devpath[read_bytes] = '\0'; + + /* if devpath was too long, skip unread characters */ + if (read_bytes != len) { + unsigned short int skip_bytes = len - read_bytes; + char buf[skip_bytes]; + + if (fread(buf, 1, skip_bytes, queue_file) != skip_bytes) + return -1; + } + + return read_bytes; +} + +static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long int *seqnum_start) +{ + char filename[UTIL_PATH_SIZE]; + FILE *queue_file; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/queue.bin", NULL); + queue_file = fopen(filename, "r"); + if (queue_file == NULL) + return NULL; + + if (udev_queue_read_seqnum(queue_file, seqnum_start) < 0) { + err(udev_queue->udev, "corrupt queue file\n"); + fclose(queue_file); + return NULL; + } + + return queue_file; +} + + +unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum_udev; + FILE *queue_file; + + queue_file = open_queue_file(udev_queue, &seqnum_udev); + if (queue_file == NULL) + return 0; + + while (1) { + unsigned long long int seqnum; + ssize_t devpath_len; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + if (devpath_len > 0) + seqnum_udev = seqnum; + } + + fclose(queue_file); + return seqnum_udev; +} + +int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum_start; + FILE *queue_file; + + queue_file = open_queue_file(udev_queue, &seqnum_start); + if (queue_file == NULL) + return 0; + + fclose(queue_file); + return 1; +} + +int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum_kernel; + unsigned long long int seqnum_udev = 0; + int queued = 0; + int is_empty = 0; + FILE *queue_file; + + if (udev_queue == NULL) + return -EINVAL; + queue_file = open_queue_file(udev_queue, &seqnum_udev); + if (queue_file == NULL) + return 1; + + while (1) { + unsigned long long int seqnum; + ssize_t devpath_len; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + + if (devpath_len > 0) { + queued++; + seqnum_udev = seqnum; + } else { + queued--; + } + } + + if (queued > 0) { + dbg(udev_queue->udev, "queue is not empty\n"); + goto out; + } + + seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); + if (seqnum_udev < seqnum_kernel) { + dbg(udev_queue->udev, "queue is empty but kernel events still pending [%llu]<->[%llu]\n", + seqnum_kernel, seqnum_udev); + goto out; + } + + dbg(udev_queue->udev, "queue is empty\n"); + is_empty = 1; + +out: + fclose(queue_file); + return is_empty; +} + +int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, + unsigned long long int start, unsigned long long int end) +{ + unsigned long long int seqnum = 0; + ssize_t devpath_len; + int unfinished; + FILE *queue_file; + + if (udev_queue == NULL) + return -EINVAL; + queue_file = open_queue_file(udev_queue, &seqnum); + if (queue_file == NULL) + return 1; + if (start < seqnum) + start = seqnum; + if (start > end) + return 1; + if (end - start > INT_MAX - 1) + return -EOVERFLOW; + unfinished = (end - start) + 1; + + while (unfinished > 0) { + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + + if (devpath_len == 0) { + if (seqnum >= start && seqnum <= end) + unfinished--; + } + } + fclose(queue_file); + + return (unfinished == 0); +} + +int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) +{ + if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) + return 0; + + dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum); + return 1; +} + +struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum; + FILE *queue_file; + + if (udev_queue == NULL) + return NULL; + udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); + + queue_file = open_queue_file(udev_queue, &seqnum); + if (queue_file == NULL) + return NULL; + + while (1) { + char syspath[UTIL_PATH_SIZE]; + char *s; + size_t l; + ssize_t len; + char seqnum_str[32]; + struct udev_list_entry *list_entry; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + snprintf(seqnum_str, sizeof(seqnum_str), "%llu", seqnum); + + s = syspath; + l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); + len = udev_queue_read_devpath(queue_file, s, l); + if (len < 0) + break; + + if (len > 0) { + udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, seqnum_str, 0, 0); + } else { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { + if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { + udev_list_entry_delete(list_entry); + break; + } + } + } + } + fclose(queue_file); + + return udev_list_get_entry(&udev_queue->queue_list); +} + +struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) +{ + char path[UTIL_PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + if (udev_queue == NULL) + return NULL; + udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); + util_strscpyl(path, sizeof(path), udev_get_dev_path(udev_queue->udev), "/.udev/failed", NULL); + dir = opendir(path); + if (dir == NULL) + return NULL; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char filename[UTIL_PATH_SIZE]; + char syspath[UTIL_PATH_SIZE]; + char *s; + size_t l; + ssize_t len; + struct stat statbuf; + + if (dent->d_name[0] == '.') + continue; + s = syspath; + l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); + len = readlinkat(dirfd(dir), dent->d_name, s, l); + if (len < 0 || (size_t)len >= l) + continue; + s[len] = '\0'; + dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); + util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); + if (stat(filename, &statbuf) != 0) + continue; + udev_list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0, 0); + } + closedir(dir); + return udev_list_get_entry(&udev_queue->failed_list); +} diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c new file mode 100644 index 0000000000..dcc4a0fd16 --- /dev/null +++ b/libudev/libudev-util.c @@ -0,0 +1,502 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2009 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) +{ + char path[UTIL_PATH_SIZE]; + ssize_t len; + const char *pos; + + util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL); + len = readlink(path, path, sizeof(path)); + if (len < 0 || len >= (ssize_t) sizeof(path)) + return -1; + path[len] = '\0'; + pos = strrchr(path, '/'); + if (pos == NULL) + return -1; + pos = &pos[1]; + dbg(udev, "resolved link to: '%s'\n", pos); + return util_strscpy(value, size, pos); +} + +ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size) +{ + return get_sys_link(udev, "subsystem", syspath, subsystem, size); +} + +ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size) +{ + return get_sys_link(udev, "driver", syspath, driver, size); +} + +int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) +{ + char link_target[UTIL_PATH_SIZE]; + + int len; + int i; + int back; + char *base; + + len = readlink(syspath, link_target, sizeof(link_target)); + if (len <= 0) + return -1; + link_target[len] = '\0'; + dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target); + + for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) + ; + dbg(udev, "base '%s', tail '%s', back %i\n", syspath, &link_target[back * 3], back); + for (i = 0; i <= back; i++) { + base = strrchr(syspath, '/'); + if (base == NULL) + return -1; + base[0] = '\0'; + } + dbg(udev, "after moving back '%s'\n", syspath); + util_strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL); + return 0; +} + +int util_log_priority(const char *priority) +{ + char *endptr; + int prio; + + prio = strtol(priority, &endptr, 10); + if (endptr[0] == '\0') + return prio; + if (strncmp(priority, "err", 3) == 0) + return LOG_ERR; + if (strcmp(priority, "info") == 0) + return LOG_INFO; + if (strcmp(priority, "debug") == 0) + return LOG_DEBUG; + return 0; +} + +size_t util_path_encode(const char *src, char *dest, size_t size) +{ + size_t i, j; + + for (i = 0, j = 0; src[i] != '\0'; i++) { + if (src[i] == '/') { + if (j+4 >= size) { + j = 0; + break; + } + memcpy(&dest[j], "\\x2f", 4); + j += 4; + } else if (src[i] == '\\') { + if (j+4 >= size) { + j = 0; + break; + } + memcpy(&dest[j], "\\x5c", 4); + j += 4; + } else { + if (j+1 >= size) { + j = 0; + break; + } + dest[j] = src[i]; + j++; + } + } + dest[j] = '\0'; + return j; +} + +size_t util_path_decode(char *s) +{ + size_t i, j; + + for (i = 0, j = 0; s[i] != '\0'; j++) { + if (memcmp(&s[i], "\\x2f", 4) == 0) { + s[j] = '/'; + i += 4; + } else if (memcmp(&s[i], "\\x5c", 4) == 0) { + s[j] = '\\'; + i += 4; + } else { + s[j] = s[i]; + i++; + } + } + s[j] = '\0'; + return j; +} + +void util_remove_trailing_chars(char *path, char c) +{ + size_t len; + + if (path == NULL) + return; + len = strlen(path); + while (len > 0 && path[len-1] == c) + path[--len] = '\0'; +} + +/* + * Concatenates strings. In any case, terminates in _all_ cases with '\0' + * and moves the @dest pointer forward to the added '\0'. Returns the + * remaining size, and 0 if the string was truncated. + */ +size_t util_strpcpy(char **dest, size_t size, const char *src) +{ + size_t len; + + len = strlen(src); + if (len >= size) { + if (size > 1) + *dest = mempcpy(*dest, src, size-1); + size = 0; + *dest[0] = '\0'; + } else { + if (len > 0) { + *dest = mempcpy(*dest, src, len); + size -= len; + } + *dest[0] = '\0'; + } + return size; +} + +/* concatenates list of strings, moves dest forward */ +size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) +{ + va_list va; + + va_start(va, src); + do { + size = util_strpcpy(dest, size, src); + src = va_arg(va, char *); + } while (src != NULL); + va_end(va); + + return size; +} + +/* copies string */ +size_t util_strscpy(char *dest, size_t size, const char *src) +{ + char *s; + + s = dest; + return util_strpcpy(&s, size, src); +} + +/* concatenates list of strings */ +size_t util_strscpyl(char *dest, size_t size, const char *src, ...) +{ + va_list va; + char *s; + + va_start(va, src); + s = dest; + do { + size = util_strpcpy(&s, size, src); + src = va_arg(va, char *); + } while (src != NULL); + va_end(va); + + return size; +} + +/* count of characters used to encode one unicode char */ +static int utf8_encoded_expected_len(const char *str) +{ + unsigned char c = (unsigned char)str[0]; + + if (c < 0x80) + return 1; + if ((c & 0xe0) == 0xc0) + return 2; + if ((c & 0xf0) == 0xe0) + return 3; + if ((c & 0xf8) == 0xf0) + return 4; + if ((c & 0xfc) == 0xf8) + return 5; + if ((c & 0xfe) == 0xfc) + return 6; + return 0; +} + +/* decode one unicode char */ +static int utf8_encoded_to_unichar(const char *str) +{ + int unichar; + int len; + int i; + + len = utf8_encoded_expected_len(str); + switch (len) { + case 1: + return (int)str[0]; + case 2: + unichar = str[0] & 0x1f; + break; + case 3: + unichar = (int)str[0] & 0x0f; + break; + case 4: + unichar = (int)str[0] & 0x07; + break; + case 5: + unichar = (int)str[0] & 0x03; + break; + case 6: + unichar = (int)str[0] & 0x01; + break; + default: + return -1; + } + + for (i = 1; i < len; i++) { + if (((int)str[i] & 0xc0) != 0x80) + return -1; + unichar <<= 6; + unichar |= (int)str[i] & 0x3f; + } + + return unichar; +} + +/* expected size used to encode one unicode char */ +static int utf8_unichar_to_encoded_len(int unichar) +{ + if (unichar < 0x80) + return 1; + if (unichar < 0x800) + return 2; + if (unichar < 0x10000) + return 3; + if (unichar < 0x200000) + return 4; + if (unichar < 0x4000000) + return 5; + return 6; +} + +/* check if unicode char has a valid numeric range */ +static int utf8_unichar_valid_range(int unichar) +{ + if (unichar > 0x10ffff) + return 0; + if ((unichar & 0xfffff800) == 0xd800) + return 0; + if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) + return 0; + if ((unichar & 0xffff) == 0xffff) + return 0; + return 1; +} + +/* validate one encoded unicode char and return its length */ +static int utf8_encoded_valid_unichar(const char *str) +{ + int len; + int unichar; + int i; + + len = utf8_encoded_expected_len(str); + if (len == 0) + return -1; + + /* ascii is valid */ + if (len == 1) + return 1; + + /* check if expected encoded chars are available */ + for (i = 0; i < len; i++) + if ((str[i] & 0x80) != 0x80) + return -1; + + unichar = utf8_encoded_to_unichar(str); + + /* check if encoded length matches encoded value */ + if (utf8_unichar_to_encoded_len(unichar) != len) + return -1; + + /* check if value has valid range */ + if (!utf8_unichar_valid_range(unichar)) + return -1; + + return len; +} + +int udev_util_replace_whitespace(const char *str, char *to, size_t len) +{ + size_t i, j; + + /* strip trailing whitespace */ + len = strnlen(str, len); + while (len && isspace(str[len-1])) + len--; + + /* strip leading whitespace */ + i = 0; + while (isspace(str[i]) && (i < len)) + i++; + + j = 0; + while (i < len) { + /* substitute multiple whitespace with a single '_' */ + if (isspace(str[i])) { + while (isspace(str[i])) + i++; + to[j++] = '_'; + } + to[j++] = str[i++]; + } + to[j] = '\0'; + return 0; +} + +static int is_whitelisted(char c, const char *white) +{ + if ((c >= '0' && c <= '9') || + (c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') || + strchr("#+-.:=@_", c) != NULL || + (white != NULL && strchr(white, c) != NULL)) + return 1; + return 0; +} + +/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ +int udev_util_replace_chars(char *str, const char *white) +{ + size_t i = 0; + int replaced = 0; + + while (str[i] != '\0') { + int len; + + if (is_whitelisted(str[i], white)) { + i++; + continue; + } + + /* accept hex encoding */ + if (str[i] == '\\' && str[i+1] == 'x') { + i += 2; + continue; + } + + /* accept valid utf8 */ + len = utf8_encoded_valid_unichar(&str[i]); + if (len > 1) { + i += len; + continue; + } + + /* if space is allowed, replace whitespace with ordinary space */ + if (isspace(str[i]) && white != NULL && strchr(white, ' ') != NULL) { + str[i] = ' '; + i++; + replaced++; + continue; + } + + /* everything else is replaced with '_' */ + str[i] = '_'; + i++; + replaced++; + } + return replaced; +} + +/** + * util_encode_string: + * @str: input string to be encoded + * @str_enc: output string to store the encoded input string + * @len: maximum size of the output string, which may be + * four times as long as the input string + * + * Encode all potentially unsafe characters of a string to the + * corresponding hex value prefixed by '\x'. + * + * Returns: 0 if the entire string was copied, non-zero otherwise. + **/ +int udev_util_encode_string(const char *str, char *str_enc, size_t len) +{ + size_t i, j; + + if (str == NULL || str_enc == NULL || len == 0) + return -1; + + str_enc[0] = '\0'; + for (i = 0, j = 0; str[i] != '\0'; i++) { + int seqlen; + + seqlen = utf8_encoded_valid_unichar(&str[i]); + if (seqlen > 1) { + memcpy(&str_enc[j], &str[i], seqlen); + j += seqlen; + i += (seqlen-1); + } else if (str[i] == '\\' || !is_whitelisted(str[i], NULL)) { + sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); + j += 4; + } else { + str_enc[j] = str[i]; + j++; + } + if (j+3 >= len) + goto err; + } + str_enc[j] = '\0'; + return 0; +err: + return -1; +} + +void util_set_fd_cloexec(int fd) +{ + int flags; + + flags = fcntl(fd, F_GETFD); + if (flags < 0) + flags = FD_CLOEXEC; + else + flags |= FD_CLOEXEC; + fcntl(fd, F_SETFD, flags); +} + +unsigned int util_string_hash32(const char *str) +{ + unsigned int hash = 0; + + while (str[0] != '\0') { + hash += str[0] << 4; + hash += str[0] >> 4; + hash *= 11; + str++; + } + return hash; +} diff --git a/libudev/libudev.c b/libudev/libudev.c new file mode 100644 index 0000000000..a9baa70799 --- /dev/null +++ b/libudev/libudev.c @@ -0,0 +1,374 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +struct udev { + int refcount; + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args); + void *userdata; + char *sys_path; + char *dev_path; + char *rules_path; + struct udev_list_node properties_list; + int log_priority; + int run; +}; + +void udev_log(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, ...) +{ + va_list args; + + if (priority > udev->log_priority) + return; + + va_start(args, format); + udev->log_fn(udev, priority, file, line, fn, format, args); + va_end(args); +} + +static void log_stderr(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args) +{ + fprintf(stderr, "libudev: %s: ", fn); + vfprintf(stderr, format, args); +} + +void *udev_get_userdata(struct udev *udev) +{ + if (udev == NULL) + return NULL; + return udev->userdata; +} + +void udev_set_userdata(struct udev *udev, void *userdata) +{ + if (udev == NULL) + return; + udev->userdata = userdata; +} + +/** + * udev_new: + * + * Create udev library context. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev library context. + * + * Returns: a new udev library context + **/ +struct udev *udev_new(void) +{ + struct udev *udev; + const char *env; + char *config_file; + FILE *f; + + udev = calloc(1, sizeof(struct udev)); + if (udev == NULL) + return NULL; + udev->refcount = 1; + udev->log_fn = log_stderr; + udev->log_priority = LOG_ERR; + udev_list_init(&udev->properties_list); + udev->run = 1; + udev->dev_path = strdup(UDEV_PREFIX "/dev"); + udev->sys_path = strdup("/sys"); + config_file = strdup(SYSCONFDIR "/udev/udev.conf"); + if (udev->dev_path == NULL || + udev->sys_path == NULL || + config_file == NULL) + goto err; + + /* settings by environment and config file */ + env = getenv("SYSFS_PATH"); + if (env != NULL) { + free(udev->sys_path); + udev->sys_path = strdup(env); + util_remove_trailing_chars(udev->sys_path, '/'); + udev_add_property(udev, "SYSFS_PATH", udev->sys_path); + } + + env = getenv("UDEV_RUN"); + if (env != NULL && strcmp(env, "0") == 0) + udev->run = 0; + + env = getenv("UDEV_CONFIG_FILE"); + if (env != NULL) { + free(config_file); + config_file = strdup(env); + util_remove_trailing_chars(config_file, '/'); + } + if (config_file == NULL) + goto err; + f = fopen(config_file, "r"); + if (f != NULL) { + char line[UTIL_LINE_SIZE]; + int line_nr = 0; + + while (fgets(line, sizeof(line), f)) { + size_t len; + char *key; + char *val; + + line_nr++; + + /* find key */ + key = line; + while (isspace(key[0])) + key++; + + /* comment or empty line */ + if (key[0] == '#' || key[0] == '\0') + continue; + + /* split key/value */ + val = strchr(key, '='); + if (val == NULL) { + err(udev, "missing = in '%s'[%i], skip line\n", config_file, line_nr); + continue; + } + val[0] = '\0'; + val++; + + /* find value */ + while (isspace(val[0])) + val++; + + /* terminate key */ + len = strlen(key); + if (len == 0) + continue; + while (isspace(key[len-1])) + len--; + key[len] = '\0'; + + /* terminate value */ + len = strlen(val); + if (len == 0) + continue; + while (isspace(val[len-1])) + len--; + val[len] = '\0'; + + if (len == 0) + continue; + + /* unquote */ + if (val[0] == '"' || val[0] == '\'') { + if (val[len-1] != val[0]) { + err(udev, "inconsistent quoting in '%s'[%i], skip line\n", config_file, line_nr); + continue; + } + val[len-1] = '\0'; + val++; + } + + if (strcmp(key, "udev_log") == 0) { + udev_set_log_priority(udev, util_log_priority(val)); + continue; + } + if (strcmp(key, "udev_root") == 0) { + free(udev->dev_path); + udev->dev_path = strdup(val); + util_remove_trailing_chars(udev->dev_path, '/'); + continue; + } + if (strcmp(key, "udev_rules") == 0) { + free(udev->rules_path); + udev->rules_path = strdup(val); + util_remove_trailing_chars(udev->rules_path, '/'); + continue; + } + } + fclose(f); + } + + env = getenv("UDEV_ROOT"); + if (env != NULL) { + free(udev->dev_path); + udev->dev_path = strdup(env); + util_remove_trailing_chars(udev->dev_path, '/'); + udev_add_property(udev, "UDEV_ROOT", udev->dev_path); + } + + env = getenv("UDEV_LOG"); + if (env != NULL) + udev_set_log_priority(udev, util_log_priority(env)); + + if (udev->dev_path == NULL || udev->sys_path == NULL) + goto err; + dbg(udev, "context %p created\n", udev); + dbg(udev, "log_priority=%d\n", udev->log_priority); + dbg(udev, "config_file='%s'\n", config_file); + dbg(udev, "dev_path='%s'\n", udev->dev_path); + dbg(udev, "sys_path='%s'\n", udev->sys_path); + if (udev->rules_path != NULL) + dbg(udev, "rules_path='%s'\n", udev->rules_path); + free(config_file); + return udev; +err: + free(config_file); + err(udev, "context creation failed\n"); + udev_unref(udev); + return NULL; +} + +/** + * udev_ref: + * @udev: udev library context + * + * Take a reference of the udev library context. + * + * Returns: the passed udev library context + **/ +struct udev *udev_ref(struct udev *udev) +{ + if (udev == NULL) + return NULL; + udev->refcount++; + return udev; +} + +/** + * udev_unref: + * @udev: udev library context + * + * Drop a reference of the udev library context. If the refcount + * reaches zero, the resources of the context will be released. + * + **/ +void udev_unref(struct udev *udev) +{ + if (udev == NULL) + return; + udev->refcount--; + if (udev->refcount > 0) + return; + udev_list_cleanup_entries(udev, &udev->properties_list); + free(udev->dev_path); + free(udev->sys_path); + free(udev->rules_path); + dbg(udev, "context %p released\n", udev); + free(udev); +} + +/** + * udev_set_log_fn: + * @udev: udev library context + * @log_fn: function to be called for logging messages + * + * The built-in logging writes to stderr. It can be + * overridden by a custom function, to plug log messages + * into the users' logging functionality. + * + **/ +void udev_set_log_fn(struct udev *udev, + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args)) +{ + udev->log_fn = log_fn; + info(udev, "custom logging function %p registered\n", udev); +} + +int udev_get_log_priority(struct udev *udev) +{ + return udev->log_priority; +} + +void udev_set_log_priority(struct udev *udev, int priority) +{ + char num[32]; + + udev->log_priority = priority; + snprintf(num, sizeof(num), "%u", udev->log_priority); + udev_add_property(udev, "UDEV_LOG", num); +} + +const char *udev_get_rules_path(struct udev *udev) +{ + return udev->rules_path; +} + +int udev_get_run(struct udev *udev) +{ + return udev->run; +} + +/** + * udev_get_sys_path: + * @udev: udev library context + * + * Retrieve the sysfs mount point. The default is "/sys". For + * testing purposes, it can be overridden with the environment + * variable SYSFS_PATH. + * + * Returns: the sys mount point + **/ +const char *udev_get_sys_path(struct udev *udev) +{ + if (udev == NULL) + return NULL; + return udev->sys_path; +} + +/** + * udev_get_dev_path: + * @udev: udev library context + * + * Retrieve the device directory path. The default value is "/dev", + * the actual value may be overridden in the udev configuration + * file. + * + * Returns: the device directory path + **/ +const char *udev_get_dev_path(struct udev *udev) +{ + if (udev == NULL) + return NULL; + return udev->dev_path; +} + +struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) +{ + if (value == NULL) { + struct udev_list_entry *list_entry; + + list_entry = udev_get_properties_list_entry(udev); + list_entry = udev_list_entry_get_by_name(list_entry, key); + if (list_entry != NULL) + udev_list_entry_delete(list_entry); + return NULL; + } + return udev_list_entry_add(udev, &udev->properties_list, key, value, 1, 0); +} + +struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) +{ + return udev_list_get_entry(&udev->properties_list); +} diff --git a/libudev/libudev.h b/libudev/libudev.h new file mode 100644 index 0000000000..ffeb80f8d3 --- /dev/null +++ b/libudev/libudev.h @@ -0,0 +1,153 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2009 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#ifndef _LIBUDEV_H_ +#define _LIBUDEV_H_ + +#include +#include +#include + +/* + * udev - library context + * + * reads the udev config and system environment + * allows custom logging + */ +struct udev; +struct udev *udev_ref(struct udev *udev); +void udev_unref(struct udev *udev); +struct udev *udev_new(void); +void udev_set_log_fn(struct udev *udev, + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args)); +int udev_get_log_priority(struct udev *udev); +void udev_set_log_priority(struct udev *udev, int priority); +const char *udev_get_sys_path(struct udev *udev); +const char *udev_get_dev_path(struct udev *udev); +void *udev_get_userdata(struct udev *udev); +void udev_set_userdata(struct udev *udev, void *userdata); + +/* + * udev_list + * + * access to libudev generated lists + */ +struct udev_list_entry; +struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); +struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); +const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); +const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); +#define udev_list_entry_foreach(entry, first) \ + for (entry = first; \ + entry != NULL; \ + entry = udev_list_entry_get_next(entry)) + +/* + * udev_device + * + * access to sysfs/kernel devices + */ +struct udev_device; +struct udev_device *udev_device_ref(struct udev_device *udev_device); +void udev_device_unref(struct udev_device *udev_device); +struct udev *udev_device_get_udev(struct udev_device *udev_device); +struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); +struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); +struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); +/* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */ +struct udev_device *udev_device_get_parent(struct udev_device *udev_device); +struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, + const char *subsystem, const char *devtype); +/* retrieve device properties */ +const char *udev_device_get_devpath(struct udev_device *udev_device); +const char *udev_device_get_subsystem(struct udev_device *udev_device); +const char *udev_device_get_devtype(struct udev_device *udev_device); +const char *udev_device_get_syspath(struct udev_device *udev_device); +const char *udev_device_get_sysname(struct udev_device *udev_device); +const char *udev_device_get_sysnum(struct udev_device *udev_device); +const char *udev_device_get_devnode(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); +const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key); +const char *udev_device_get_driver(struct udev_device *udev_device); +dev_t udev_device_get_devnum(struct udev_device *udev_device); +const char *udev_device_get_action(struct udev_device *udev_device); +unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); +const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); + +/* + * udev_monitor + * + * access to kernel uevents and udev events + */ +struct udev_monitor; +struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); +void udev_monitor_unref(struct udev_monitor *udev_monitor); +struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); +/* kernel and udev generated events over netlink */ +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); +/* custom socket (use netlink and filters instead) */ +struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); +/* bind socket */ +int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); +int udev_monitor_get_fd(struct udev_monitor *udev_monitor); +struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); +/* in-kernel socket filters to select messages that get delivered to a listener */ +int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, + const char *subsystem, const char *devtype); +int udev_monitor_filter_update(struct udev_monitor *udev_monitor); +int udev_monitor_filter_remove(struct udev_monitor *udev_monitor); + +/* + * udev_enumerate + * + * search sysfs for specific devices and provide a sorted list + */ +struct udev_enumerate; +struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); +void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); +struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); +struct udev_enumerate *udev_enumerate_new(struct udev *udev); +/* device properties filter */ +int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); +int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); +int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); +int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); +int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); +int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); +/* run enumeration with active filters */ +int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); +int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); +/* return device list */ +struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); + +/* + * udev_queue + * + * access to the currently running udev events + */ +struct udev_queue; +struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue); +void udev_queue_unref(struct udev_queue *udev_queue); +struct udev *udev_queue_get_udev(struct udev_queue *udev_queue); +struct udev_queue *udev_queue_new(struct udev *udev); +unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue); +unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue); +int udev_queue_get_udev_is_active(struct udev_queue *udev_queue); +int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); +int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum); +int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, + unsigned long long int start, unsigned long long int end); +struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); +struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); +#endif diff --git a/libudev/libudev.pc.in b/libudev/libudev.pc.in new file mode 100644 index 0000000000..38fc052e34 --- /dev/null +++ b/libudev/libudev.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@prefix@ +libdir=@prefix@/@libdir_name@ +includedir=@prefix@/include + +Name: libudev +Description: Library to access udev device information +Version: @VERSION@ +Libs: -L${libdir} -ludev +Libs.private: +Cflags: -I${includedir} diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c new file mode 100644 index 0000000000..db08d4845f --- /dev/null +++ b/libudev/test-libudev.c @@ -0,0 +1,458 @@ +/* + * test-libudev + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" + +static void log_fn(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args) +{ + printf("test-libudev: %s %s:%d ", fn, file, line); + vprintf(format, args); +} + +static void print_device(struct udev_device *device) +{ + const char *str; + dev_t devnum; + int count; + struct udev_list_entry *list_entry; + + printf("*** device: %p ***\n", device); + str = udev_device_get_action(device); + if (str != NULL) + printf("action: '%s'\n", str); + + str = udev_device_get_syspath(device); + printf("syspath: '%s'\n", str); + + str = udev_device_get_sysname(device); + printf("sysname: '%s'\n", str); + + str = udev_device_get_sysnum(device); + if (str != NULL) + printf("sysnum: '%s'\n", str); + + str = udev_device_get_devpath(device); + printf("devpath: '%s'\n", str); + + str = udev_device_get_subsystem(device); + if (str != NULL) + printf("subsystem: '%s'\n", str); + + str = udev_device_get_devtype(device); + if (str != NULL) + printf("devtype: '%s'\n", str); + + str = udev_device_get_driver(device); + if (str != NULL) + printf("driver: '%s'\n", str); + + str = udev_device_get_devnode(device); + if (str != NULL) + printf("devname: '%s'\n", str); + + devnum = udev_device_get_devnum(device); + if (major(devnum) > 0) + printf("devnum: %u:%u\n", major(devnum), minor(devnum)); + + count = 0; + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { + printf("link: '%s'\n", udev_list_entry_get_name(list_entry)); + count++; + } + if (count > 0) + printf("found %i links\n", count); + + count = 0; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) { + printf("property: '%s=%s'\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + count++; + } + if (count > 0) + printf("found %i properties\n", count); + + str = udev_device_get_property_value(device, "MAJOR"); + if (str != NULL) + printf("MAJOR: '%s'\n", str); + + str = udev_device_get_sysattr_value(device, "dev"); + if (str != NULL) + printf("attr{dev}: '%s'\n", str); + + printf("\n"); +} + +static int test_device(struct udev *udev, const char *syspath) +{ + struct udev_device *device; + + printf("looking at device: %s\n", syspath); + device = udev_device_new_from_syspath(udev, syspath); + if (device == NULL) { + printf("no device found\n"); + return -1; + } + print_device(device); + udev_device_unref(device); + return 0; +} + +static int test_device_parents(struct udev *udev, const char *syspath) +{ + struct udev_device *device; + struct udev_device *device_parent; + + printf("looking at device: %s\n", syspath); + device = udev_device_new_from_syspath(udev, syspath); + if (device == NULL) + return -1; + + printf("looking at parents\n"); + device_parent = device; + do { + print_device(device_parent); + device_parent = udev_device_get_parent(device_parent); + } while (device_parent != NULL); + + printf("looking at parents again\n"); + device_parent = device; + do { + print_device(device_parent); + device_parent = udev_device_get_parent(device_parent); + } while (device_parent != NULL); + udev_device_unref(device); + + return 0; +} + +static int test_device_devnum(struct udev *udev) +{ + dev_t devnum = makedev(1, 3); + struct udev_device *device; + + printf("looking up device: %u:%u\n", major(devnum), minor(devnum)); + device = udev_device_new_from_devnum(udev, 'c', devnum); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + return 0; +} + +static int test_device_subsys_name(struct udev *udev) +{ + struct udev_device *device; + + printf("looking up device: 'block':'sda'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "block", "sda"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'subsystem':'pci'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "subsystem", "pci"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'drivers':'scsi:sd'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "drivers", "scsi:sd"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'module':'printk'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "module", "printk"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + return 0; +} + +static int test_enumerate_print_list(struct udev_enumerate *enumerate) +{ + struct udev_list_entry *list_entry; + int count = 0; + + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device != NULL) { + printf("device: '%s' (%s)\n", + udev_device_get_syspath(device), + udev_device_get_subsystem(device)); + udev_device_unref(device); + count++; + } + } + printf("found %i devices\n\n", count); + return count; +} + +static int test_monitor(struct udev *udev) +{ + struct udev_monitor *udev_monitor; + fd_set readfds; + int fd; + + udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); + if (udev_monitor == NULL) { + printf("no socket\n"); + return -1; + } + if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "block", NULL) < 0 || + udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL) < 0 || + udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device") < 0) { + printf("filter failed\n"); + return -1; + } + if (udev_monitor_enable_receiving(udev_monitor) < 0) { + printf("bind failed\n"); + return -1; + } + + fd = udev_monitor_get_fd(udev_monitor); + FD_ZERO(&readfds); + + while (1) { + struct udev_device *device; + int fdcount; + + FD_SET(STDIN_FILENO, &readfds); + FD_SET(fd, &readfds); + + printf("waiting for events from udev, press ENTER to exit\n"); + fdcount = select(fd+1, &readfds, NULL, NULL, NULL); + printf("select fd count: %i\n", fdcount); + + if (FD_ISSET(fd, &readfds)) { + device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) { + printf("no device from socket\n"); + continue; + } + print_device(device); + udev_device_unref(device); + } + + if (FD_ISSET(STDIN_FILENO, &readfds)) { + printf("exiting loop\n"); + break; + } + } + + udev_monitor_unref(udev_monitor); + return 0; +} + +static int test_queue(struct udev *udev) +{ + struct udev_queue *udev_queue; + unsigned long long int seqnum; + struct udev_list_entry *list_entry; + + udev_queue = udev_queue_new(udev); + if (udev_queue == NULL) + return -1; + seqnum = udev_queue_get_kernel_seqnum(udev_queue); + printf("seqnum kernel: %llu\n", seqnum); + seqnum = udev_queue_get_udev_seqnum(udev_queue); + printf("seqnum udev : %llu\n", seqnum); + + if (udev_queue_get_queue_is_empty(udev_queue)) + printf("queue is empty\n"); + printf("get queue list\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + printf("\n"); + printf("get queue list again\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + printf("\n"); + printf("get failed list\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) + printf("failed: '%s'\n", udev_list_entry_get_name(list_entry)); + printf("\n"); + + list_entry = udev_queue_get_queued_list_entry(udev_queue); + if (list_entry != NULL) { + printf("event [%llu] is queued\n", seqnum); + seqnum = strtoull(udev_list_entry_get_value(list_entry), NULL, 10); + if (udev_queue_get_seqnum_is_finished(udev_queue, seqnum)) + printf("event [%llu] is not finished\n", seqnum); + else + printf("event [%llu] is finished\n", seqnum); + } + printf("\n"); + udev_queue_unref(udev_queue); + return 0; +} + +static int test_enumerate(struct udev *udev, const char *subsystem) +{ + struct udev_enumerate *udev_enumerate; + + printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'block'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate,"block"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'not block'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'pci, mem, vc'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, "pci"); + udev_enumerate_add_match_subsystem(udev_enumerate, "mem"); + udev_enumerate_add_match_subsystem(udev_enumerate, "vc"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'subsystem'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_subsystems(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'property IF_FS_*=filesystem'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_property(udev_enumerate, "ID_FS*", "filesystem"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + return 0; +} + +int main(int argc, char *argv[]) +{ + struct udev *udev = NULL; + static const struct option options[] = { + { "syspath", required_argument, NULL, 'p' }, + { "subsystem", required_argument, NULL, 's' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + {} + }; + const char *syspath = "/devices/virtual/mem/null"; + const char *subsystem = NULL; + char path[1024]; + const char *str; + + udev = udev_new(); + printf("context: %p\n", udev); + if (udev == NULL) { + printf("no context\n"); + return 1; + } + udev_set_log_fn(udev, log_fn); + printf("set log: %p\n", log_fn); + + while (1) { + int option; + + option = getopt_long(argc, argv, "+dhV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'p': + syspath = optarg; + break; + case 's': + subsystem = optarg; + break; + case 'd': + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + printf("--debug --syspath= --subsystem= --help\n"); + goto out; + case 'V': + printf("%s\n", VERSION); + goto out; + default: + goto out; + } + } + + str = udev_get_sys_path(udev); + printf("sys_path: '%s'\n", str); + str = udev_get_dev_path(udev); + printf("dev_path: '%s'\n", str); + + /* add sys path if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { + snprintf(path, sizeof(path), "%s%s", udev_get_sys_path(udev), syspath); + syspath = path; + } + + test_device(udev, syspath); + test_device_devnum(udev); + test_device_subsys_name(udev); + test_device_parents(udev, syspath); + + test_enumerate(udev, subsystem); + + test_queue(udev); + + test_monitor(udev); +out: + udev_unref(udev); + return 0; +} diff --git a/udev/Makefile.am b/udev/Makefile.am index 94989e64bf..ca5b4fae59 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -1,8 +1,5 @@ include $(top_srcdir)/Makefile.am.inc -SUBDIRS = \ - lib - sbin_PROGRAMS = \ udevd \ udevadm @@ -19,18 +16,18 @@ common_files = \ udev-node.c \ udev-rules.c \ udev-util.c \ - lib/libudev.h \ - lib/libudev-private.h \ - lib/libudev.c \ - lib/libudev-list.c \ - lib/libudev-util.c \ - lib/libudev-device.c \ - lib/libudev-device-db-write.c \ - lib/libudev-monitor.c \ - lib/libudev-enumerate.c \ - lib/libudev-queue.c \ - lib/libudev-queue-export.c \ - lib/libudev-ctrl.c + ../libudev/libudev.h \ + ../libudev/libudev-private.h \ + ../libudev/libudev.c \ + ../libudev/libudev-list.c \ + ../libudev/libudev-util.c \ + ../libudev/libudev-device.c \ + ../libudev/libudev-device-db-write.c \ + ../libudev/libudev-monitor.c \ + ../libudev/libudev-enumerate.c \ + ../libudev/libudev-queue.c \ + ../libudev/libudev-queue-export.c \ + ../libudev/libudev-ctrl.c if USE_SELINUX common_files += \ diff --git a/udev/lib/.gitignore b/udev/lib/.gitignore deleted file mode 100644 index 74a5f1d379..0000000000 --- a/udev/lib/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -test-libudev -libudev.pc -libudev.so* - diff --git a/udev/lib/Makefile.am b/udev/lib/Makefile.am deleted file mode 100644 index 7cd883302c..0000000000 --- a/udev/lib/Makefile.am +++ /dev/null @@ -1,54 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -noinst_PROGRAMS = \ - test-libudev - -test_libudev_SOURCES = \ - test-libudev.c - -test_libudev_LDADD = \ - libudev.la - -rootlibdir = $(exec_prefix)/$(libdir_name) -rootlib_LTLIBRARIES = \ - libudev.la - -include_HEADERS =\ - libudev.h - -libudev_la_SOURCES =\ - libudev-private.h \ - libudev.c \ - libudev-list.c \ - libudev-util.c \ - libudev-device.c \ - libudev-enumerate.c \ - libudev-monitor.c \ - libudev-queue.c - -libudev_la_LDFLAGS = \ - -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ - -export-symbols $(top_srcdir)/udev/lib/exported_symbols - -pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig -pkgconfig_DATA = libudev.pc - -EXTRA_DIST = \ - exported_symbols - -# move devel files to $(prefix)$(libdir_name) if needed -install-data-hook: - rm $(DESTDIR)$(rootlibdir)/libudev.la - if test "$(prefix)" != "$(exec_prefix)"; then \ - mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \ - mv $(DESTDIR)$(rootlibdir)/libudev.a $(DESTDIR)$(prefix)/$(libdir_name)/; \ - so_img_name=$$(readlink $(DESTDIR)$(rootlibdir)/libudev.so); \ - rm $(DESTDIR)$(rootlibdir)/libudev.so; \ - so_img_rel_target_prefix=$$(echo $(prefix)/$(libdir_name) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ - ln -sf $$so_img_rel_target_prefix$(exec_prefix)/$(libdir_name)/$$so_img_name \ - $(DESTDIR)$(prefix)/$(libdir_name)/libudev.so; \ - fi - -uninstall-hook: - rm -f $(DESTDIR)$(prefix)/$(libdir_name)/libudev.a - rm -f $(DESTDIR)$(prefix)/$(libdir_name)/libudev.so* diff --git a/udev/lib/exported_symbols b/udev/lib/exported_symbols deleted file mode 100644 index 8e7749e488..0000000000 --- a/udev/lib/exported_symbols +++ /dev/null @@ -1,73 +0,0 @@ -udev_new -udev_ref -udev_unref -udev_set_log_fn -udev_get_log_priority -udev_set_log_priority -udev_get_userdata -udev_set_userdata -udev_get_sys_path -udev_get_dev_path -udev_list_entry_get_next -udev_list_entry_get_by_name -udev_list_entry_get_name -udev_list_entry_get_value -udev_device_new_from_syspath -udev_device_new_from_devnum -udev_device_new_from_subsystem_sysname -udev_device_get_parent -udev_device_get_parent_with_subsystem_devtype -udev_device_ref -udev_device_unref -udev_device_get_udev -udev_device_get_syspath -udev_device_get_devpath -udev_device_get_devnode -udev_device_get_sysname -udev_device_get_sysnum -udev_device_get_subsystem -udev_device_get_devtype -udev_device_get_devlinks_list_entry -udev_device_get_properties_list_entry -udev_device_get_property_value -udev_device_get_action -udev_device_get_driver -udev_device_get_devnum -udev_device_get_seqnum -udev_device_get_sysattr_value -udev_enumerate_new -udev_enumerate_ref -udev_enumerate_unref -udev_enumerate_get_udev -udev_enumerate_get_list_entry -udev_enumerate_add_match_subsystem -udev_enumerate_add_nomatch_subsystem -udev_enumerate_add_match_sysattr -udev_enumerate_add_nomatch_sysattr -udev_enumerate_add_match_property -udev_enumerate_scan_devices -udev_enumerate_scan_subsystems -udev_enumerate_add_syspath -udev_monitor_new_from_socket -udev_monitor_new_from_netlink -udev_monitor_enable_receiving -udev_monitor_ref -udev_monitor_unref -udev_monitor_get_udev -udev_monitor_get_fd -udev_monitor_receive_device -udev_monitor_filter_add_match_subsystem_devtype -udev_monitor_filter_update -udev_monitor_filter_remove -udev_queue_new -udev_queue_ref -udev_queue_unref -udev_queue_get_udev -udev_queue_get_kernel_seqnum -udev_queue_get_udev_seqnum -udev_queue_get_udev_is_active -udev_queue_get_queue_is_empty -udev_queue_get_seqnum_is_finished -udev_queue_get_seqnum_sequence_is_finished -udev_queue_get_queued_list_entry -udev_queue_get_failed_list_entry diff --git a/udev/lib/libudev-ctrl.c b/udev/lib/libudev-ctrl.c deleted file mode 100644 index e47b2b66dc..0000000000 --- a/udev/lib/libudev-ctrl.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/* wire protocol magic must match */ -#define UDEV_CTRL_MAGIC 0xdead1dea - -enum udev_ctrl_msg_type { - UDEV_CTRL_UNKNOWN, - UDEV_CTRL_SET_LOG_LEVEL, - UDEV_CTRL_STOP_EXEC_QUEUE, - UDEV_CTRL_START_EXEC_QUEUE, - UDEV_CTRL_RELOAD_RULES, - UDEV_CTRL_SET_ENV, - UDEV_CTRL_SET_MAX_CHILDS, - UDEV_CTRL_SET_MAX_CHILDS_RUNNING, - UDEV_CTRL_SETTLE, -}; - -struct udev_ctrl_msg_wire { - char version[16]; - unsigned int magic; - enum udev_ctrl_msg_type type; - union { - int intval; - char buf[256]; - }; -}; - -struct udev_ctrl_msg { - int refcount; - struct udev_ctrl *uctrl; - struct udev_ctrl_msg_wire ctrl_msg_wire; - pid_t pid; -}; - -struct udev_ctrl { - int refcount; - struct udev *udev; - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; -}; - -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) -{ - struct udev_ctrl *uctrl; - - uctrl = calloc(1, sizeof(struct udev_ctrl)); - if (uctrl == NULL) - return NULL; - uctrl->refcount = 1; - uctrl->udev = udev; - - uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (uctrl->sock < 0) { - err(udev, "error getting socket: %m\n"); - udev_ctrl_unref(uctrl); - return NULL; - } - - uctrl->saddr.sun_family = AF_LOCAL; - strcpy(uctrl->saddr.sun_path, socket_path); - uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); - /* translate leading '@' to abstract namespace */ - if (uctrl->saddr.sun_path[0] == '@') - uctrl->saddr.sun_path[0] = '\0'; - - return uctrl; -} - -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) -{ - int err; - const int feature_on = 1; - - err= bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err < 0) { - err(uctrl->udev, "bind failed: %m\n"); - return err; - } - - /* enable receiving of the sender credentials */ - setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); - return 0; -} - -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) -{ - return uctrl->udev; -} - -struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return NULL; - uctrl->refcount++; - return uctrl; -} - -void udev_ctrl_unref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return; - uctrl->refcount--; - if (uctrl->refcount > 0) - return; - if (uctrl->sock >= 0) - close(uctrl->sock); - free(uctrl); -} - -int udev_ctrl_get_fd(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return -1; - return uctrl->sock; -} - -static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf) -{ - struct udev_ctrl_msg_wire ctrl_msg_wire; - int err; - - memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); - strcpy(ctrl_msg_wire.version, "udev-" VERSION); - ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; - ctrl_msg_wire.type = type; - - if (buf != NULL) - util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); - else - ctrl_msg_wire.intval = intval; - - err = sendto(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0, - (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err == -1) { - err(uctrl->udev, "error sending message: %m\n"); - } - return err; -} - -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL); -} - -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl) -{ - return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL); -} - -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl) -{ - return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL); -} - -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl) -{ - return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL); -} - -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key); -} - -int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS, count, NULL); -} - -int udev_ctrl_send_settle(struct udev_ctrl *uctrl) -{ - return ctrl_send(uctrl, UDEV_CTRL_SETTLE, 0, NULL); -} - -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) -{ - struct udev_ctrl_msg *uctrl_msg; - ssize_t size; - struct msghdr smsg; - struct cmsghdr *cmsg; - struct iovec iov; - struct ucred *cred; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - - uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); - if (uctrl_msg == NULL) - return NULL; - uctrl_msg->refcount = 1; - uctrl_msg->uctrl = uctrl; - - iov.iov_base = &uctrl_msg->ctrl_msg_wire; - iov.iov_len = sizeof(struct udev_ctrl_msg_wire); - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - - size = recvmsg(uctrl->sock, &smsg, 0); - if (size < 0) { - err(uctrl->udev, "unable to receive user udevd message: %m\n"); - goto err; - } - cmsg = CMSG_FIRSTHDR(&smsg); - cred = (struct ucred *) CMSG_DATA(cmsg); - - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err(uctrl->udev, "no sender credentials received, message ignored\n"); - goto err; - } - - if (cred->uid != 0) { - err(uctrl->udev, "sender uid=%i, message ignored\n", cred->uid); - goto err; - } - - uctrl_msg->pid = cred->pid; - - if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { - err(uctrl->udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); - goto err; - } - - dbg(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); - return uctrl_msg; -err: - udev_ctrl_msg_unref(uctrl_msg); - return NULL; -} - -struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg == NULL) - return NULL; - ctrl_msg->refcount++; - return ctrl_msg; -} - -void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg == NULL) - return; - ctrl_msg->refcount--; - if (ctrl_msg->refcount > 0) - return; - dbg(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); - free(ctrl_msg); -} - -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; -} - -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) - return 1; - return -1; -} - -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) - return 1; - return -1; -} - -int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD_RULES) - return 1; - return -1; -} - -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) - return ctrl_msg->ctrl_msg_wire.buf; - return NULL; -} - -int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_MAX_CHILDS) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; -} - -pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SETTLE) - return ctrl_msg->pid; - return -1; -} diff --git a/udev/lib/libudev-device-db-write.c b/udev/lib/libudev-device-db-write.c deleted file mode 100644 index a8e66f7884..0000000000 --- a/udev/lib/libudev-device-db-write.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) -{ - char *s; - size_t l; - - s = filename; - l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); - return util_path_encode(devpath, s, l); -} - -int udev_device_update_db(struct udev_device *udev_device) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - FILE *f; - char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ - size_t devlen = strlen(udev_get_dev_path(udev))+1; - char *s; - size_t l; - struct udev_list_entry *list_entry; - int ret; - - devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); - util_create_path(udev, filename); - unlink(filename); - - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_flag(list_entry)) - goto file; - if (udev_device_get_num_fake_partitions(udev_device) != 0) - goto file; - if (udev_device_get_ignore_remove(udev_device)) - goto file; - if (udev_device_get_devlink_priority(udev_device) != 0) - goto file; - if (udev_device_get_event_timeout(udev_device) >= 0) - goto file; - if (udev_device_get_watch_handle(udev_device) >= 0) - goto file; - if (udev_device_get_devnode(udev_device) == NULL) - goto out; - - /* - * if we have only the node and symlinks to store, try not to waste - * tmpfs memory -- store values, if they fit, in a symlink target - */ - s = target; - l = util_strpcpy(&s, sizeof(target), &udev_device_get_devnode(udev_device)[devlen]); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) { - l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); - if (l == 0) { - info(udev, "size of links too large, create file\n"); - goto file; - } - } - info(udev, "create db link (%s)\n", target); - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); - ret = symlink(target, filename); - udev_selinux_resetfscreatecon(udev); - if (ret == 0) - goto out; -file: - f = fopen(filename, "w"); - if (f == NULL) { - err(udev, "unable to create db file '%s': %m\n", filename); - return -1; - } - info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); - - if (udev_device_get_devnode(udev_device) != NULL) { - fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) - fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); - } - if (udev_device_get_devlink_priority(udev_device) != 0) - fprintf(f, "L:%u\n", udev_device_get_devlink_priority(udev_device)); - if (udev_device_get_event_timeout(udev_device) >= 0) - fprintf(f, "T:%u\n", udev_device_get_event_timeout(udev_device)); - if (udev_device_get_num_fake_partitions(udev_device) != 0) - fprintf(f, "A:%u\n", udev_device_get_num_fake_partitions(udev_device)); - if (udev_device_get_ignore_remove(udev_device)) - fprintf(f, "R:%u\n", udev_device_get_ignore_remove(udev_device)); - if (udev_device_get_watch_handle(udev_device) >= 0) - fprintf(f, "W:%u\n", udev_device_get_watch_handle(udev_device)); - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - if (!udev_list_entry_get_flag(list_entry)) - continue; - fprintf(f, "E:%s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - } - fclose(f); -out: - return 0; -} - -int udev_device_delete_db(struct udev_device *udev_device) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - - devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); - unlink(filename); - return 0; -} - -int udev_device_rename_db(struct udev_device *udev_device, const char *devpath_old) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename_old[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - - devpath_to_db_path(udev, devpath_old, filename_old, sizeof(filename_old)); - devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); - return rename(filename_old, filename); -} diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c deleted file mode 100644 index ea54badde4..0000000000 --- a/udev/lib/libudev-device.c +++ /dev/null @@ -1,1249 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2009 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -struct udev_device { - struct udev *udev; - struct udev_device *parent_device; - char *syspath; - const char *devpath; - char *sysname; - const char *sysnum; - char *devnode; - char *subsystem; - char *devtype; - char *driver; - char *action; - char *devpath_old; - char *knodename; - char **envp; - char *monitor_buf; - size_t monitor_buf_len; - struct udev_list_node devlinks_list; - struct udev_list_node properties_list; - struct udev_list_node sysattr_list; - unsigned long long int seqnum; - int event_timeout; - int timeout; - int num_fake_partitions; - int devlink_priority; - int refcount; - dev_t devnum; - int watch_handle; - unsigned int parent_set:1; - unsigned int subsystem_set:1; - unsigned int devtype_set:1; - unsigned int devlinks_uptodate:1; - unsigned int envp_uptodate:1; - unsigned int driver_set:1; - unsigned int info_loaded:1; - unsigned int ignore_remove:1; -}; - -static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) -{ - char *s; - size_t l; - - s = filename; - l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); - return util_path_encode(devpath, s, l); -} - -int udev_device_read_db(struct udev_device *udev_device) -{ - struct stat stats; - char filename[UTIL_PATH_SIZE]; - char line[UTIL_LINE_SIZE]; - FILE *f; - - devpath_to_db_path(udev_device->udev, udev_device->devpath, filename, sizeof(filename)); - - if (lstat(filename, &stats) != 0) { - dbg(udev_device->udev, "no db file to read %s: %m\n", filename); - return -1; - } - if ((stats.st_mode & S_IFMT) == S_IFLNK) { - char target[UTIL_PATH_SIZE]; - char devnode[UTIL_PATH_SIZE]; - int target_len; - char *next; - - target_len = readlink(filename, target, sizeof(target)); - if (target_len > 0) - target[target_len] = '\0'; - else { - dbg(udev_device->udev, "error reading db link %s: %m\n", filename); - return -1; - } - - next = strchr(target, ' '); - if (next != NULL) { - next[0] = '\0'; - next = &next[1]; - } - util_strscpyl(devnode, sizeof(devnode), udev_get_dev_path(udev_device->udev), "/", target, NULL); - udev_device_set_devnode(udev_device, devnode); - while (next != NULL) { - char devlink[UTIL_PATH_SIZE]; - const char *lnk; - - lnk = next; - next = strchr(next, ' '); - if (next != NULL) { - next[0] = '\0'; - next = &next[1]; - } - util_strscpyl(devlink, sizeof(devlink), udev_get_dev_path(udev_device->udev), "/", lnk, NULL); - udev_device_add_devlink(udev_device, devlink); - } - info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); - return 0; - } - - f = fopen(filename, "r"); - if (f == NULL) { - dbg(udev_device->udev, "error reading db file %s: %m\n", filename); - return -1; - } - while (fgets(line, sizeof(line), f)) { - ssize_t len; - const char *val; - - len = strlen(line); - if (len < 4) - break; - line[len-1] = '\0'; - val = &line[2]; - switch(line[0]) { - case 'N': - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); - udev_device_set_devnode(udev_device, filename); - break; - case 'S': - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); - udev_device_add_devlink(udev_device, filename); - break; - case 'L': - udev_device_set_devlink_priority(udev_device, atoi(val)); - break; - case 'T': - udev_device_set_event_timeout(udev_device, atoi(val)); - break; - case 'A': - udev_device_set_num_fake_partitions(udev_device, atoi(val)); - break; - case 'R': - udev_device_set_ignore_remove(udev_device, atoi(val)); - break; - case 'E': - udev_device_add_property_from_string(udev_device, val); - break; - case 'W': - udev_device_set_watch_handle(udev_device, atoi(val)); - break; - } - } - fclose(f); - - info(udev_device->udev, "device %p filled with db file data\n", udev_device); - return 0; -} - -int udev_device_read_uevent_file(struct udev_device *udev_device) -{ - char filename[UTIL_PATH_SIZE]; - FILE *f; - char line[UTIL_LINE_SIZE]; - int maj = 0; - int min = 0; - - util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL); - f = fopen(filename, "r"); - if (f == NULL) - return -1; - - while (fgets(line, sizeof(line), f)) { - char *pos; - - pos = strchr(line, '\n'); - if (pos == NULL) - continue; - pos[0] = '\0'; - - if (strncmp(line, "DEVTYPE=", 8) == 0) - udev_device_set_devtype(udev_device, &line[8]); - else if (strncmp(line, "MAJOR=", 6) == 0) - maj = strtoull(&line[6], NULL, 10); - else if (strncmp(line, "MINOR=", 6) == 0) - min = strtoull(&line[6], NULL, 10); - else if (strncmp(line, "DEVNAME=", 8) == 0) - udev_device_set_knodename(udev_device, &line[8]); - - udev_device_add_property_from_string(udev_device, line); - } - - udev_device->devnum = makedev(maj, min); - - fclose(f); - return 0; -} - -static void device_load_info(struct udev_device *device) -{ - device->info_loaded = 1; - udev_device_read_uevent_file(device); - udev_device_read_db(device); -} - -void udev_device_set_info_loaded(struct udev_device *device) -{ - device->info_loaded = 1; -} - -struct udev_device *device_new(struct udev *udev) -{ - struct udev_device *udev_device; - struct udev_list_entry *list_entry; - - if (udev == NULL) - return NULL; - - udev_device = calloc(1, sizeof(struct udev_device)); - if (udev_device == NULL) - return NULL; - udev_device->refcount = 1; - udev_device->udev = udev; - udev_list_init(&udev_device->devlinks_list); - udev_list_init(&udev_device->properties_list); - udev_list_init(&udev_device->sysattr_list); - udev_device->event_timeout = -1; - udev_device->watch_handle = -1; - /* copy global properties */ - udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) - udev_device_add_property(udev_device, - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - dbg(udev_device->udev, "udev_device: %p created\n", udev_device); - return udev_device; -} - -/** - * udev_device_new_from_syspath: - * @udev: udev library context - * @syspath: sys device path including sys directory - * - * Create new udev device, and fill in information from the sys - * device and the udev database entry. The sypath is the absolute - * path to the device, including the sys mount point. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev device. - * - * Returns: a new udev device, or #NULL, if it does not exist - **/ -struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) -{ - size_t len; - const char *subdir; - char path[UTIL_PATH_SIZE]; - char *pos; - struct stat statbuf; - struct udev_device *udev_device; - - if (udev == NULL) - return NULL; - if (syspath == NULL) - return NULL; - - /* path starts in sys */ - len = strlen(udev_get_sys_path(udev)); - if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) { - info(udev, "not in sys :%s\n", syspath); - return NULL; - } - - /* path is not a root directory */ - subdir = &syspath[len+1]; - pos = strrchr(subdir, '/'); - if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) { - dbg(udev, "not a subdir :%s\n", syspath); - return NULL; - } - - /* resolve possible symlink to real path */ - util_strscpy(path, sizeof(path), syspath); - util_resolve_sys_link(udev, path, sizeof(path)); - - /* try to resolve the silly block layout if needed */ - if (strncmp(&path[len], "/block/", 7) == 0) { - char block[UTIL_PATH_SIZE]; - char part[UTIL_PATH_SIZE]; - - util_strscpy(block, sizeof(block), path); - pos = strrchr(block, '/'); - if (pos == NULL) - return NULL; - util_strscpy(part, sizeof(part), pos); - pos[0] = '\0'; - if (util_resolve_sys_link(udev, block, sizeof(block)) == 0) - util_strscpyl(path, sizeof(path), block, part, NULL); - } - - /* path exists in sys */ - if (strncmp(&syspath[len], "/devices/", 9) == 0 || - strncmp(&syspath[len], "/class/", 7) == 0 || - strncmp(&syspath[len], "/block/", 7) == 0) { - char file[UTIL_PATH_SIZE]; - - /* all "devices" require a "uevent" file */ - util_strscpyl(file, sizeof(file), path, "/uevent", NULL); - if (stat(file, &statbuf) != 0) { - dbg(udev, "not a device: %s\n", syspath); - return NULL; - } - } else { - /* everything else just needs to be a directory */ - if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) { - dbg(udev, "directory not found: %s\n", syspath); - return NULL; - } - } - - udev_device = device_new(udev); - if (udev_device == NULL) - return NULL; - - udev_device_set_syspath(udev_device, path); - info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); - - return udev_device; -} - -struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) -{ - char path[UTIL_PATH_SIZE]; - const char *type_str; - struct udev_enumerate *udev_enumerate; - struct udev_list_entry *list_entry; - struct udev_device *device = NULL; - - if (type == 'b') - type_str = "block"; - else if (type == 'c') - type_str = "char"; - else - return NULL; - - /* /sys/dev/{block,char}/: link */ - snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", udev_get_sys_path(udev), - type_str, major(devnum), minor(devnum)); - if (util_resolve_sys_link(udev, path, sizeof(path)) == 0) - return udev_device_new_from_syspath(udev, path); - - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return NULL; - - /* fallback to search sys devices for the major/minor */ - if (type == 'b') - udev_enumerate_add_match_subsystem(udev_enumerate, "block"); - else if (type == 'c') - udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); - udev_enumerate_scan_devices(udev_enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { - struct udev_device *device_loop; - - device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device_loop != NULL) { - if (udev_device_get_devnum(device_loop) == devnum) { - if (type == 'b' && strcmp(udev_device_get_subsystem(device_loop), "block") != 0) - continue; - if (type == 'c' && strcmp(udev_device_get_subsystem(device_loop), "block") == 0) - continue; - device = device_loop; - break; - } - udev_device_unref(device_loop); - } - } - udev_enumerate_unref(udev_enumerate); - return device; -} - -struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) -{ - char path_full[UTIL_PATH_SIZE]; - char *path; - size_t l; - struct stat statbuf; - - path = path_full; - l = util_strpcpyl(&path, sizeof(path_full), udev_get_sys_path(udev), NULL); - - if (strcmp(subsystem, "subsystem") == 0) { - util_strscpyl(path, l, "/subsystem/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/bus/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/class/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - } - - if (strcmp(subsystem, "module") == 0) { - util_strscpyl(path, l, "/module/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - } - - if (strcmp(subsystem, "drivers") == 0) { - char subsys[UTIL_NAME_SIZE]; - char *driver; - - util_strscpy(subsys, sizeof(subsys), sysname); - driver = strchr(subsys, ':'); - if (driver != NULL) { - driver[0] = '\0'; - driver = &driver[1]; - - util_strscpyl(path, l, "/subsystem/", subsys, "/drivers/", driver, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/bus/", subsys, "/drivers/", driver, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - } - goto out; - } - - util_strscpyl(path, l, "/subsystem/", subsystem, "/devices/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/bus/", subsystem, "/devices/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/class/", subsystem, "/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; -out: - return NULL; -found: - return udev_device_new_from_syspath(udev, path_full); -} - -static struct udev_device *device_new_from_parent(struct udev_device *udev_device) -{ - struct udev_device *udev_device_parent = NULL; - char path[UTIL_PATH_SIZE]; - const char *subdir; - - /* follow "device" link in deprecated sys layout */ - if (strncmp(udev_device->devpath, "/class/", 7) == 0 || - strncmp(udev_device->devpath, "/block/", 7) == 0) { - util_strscpyl(path, sizeof(path), udev_device->syspath, "/device", NULL); - if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) { - udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); - if (udev_device_parent != NULL) - return udev_device_parent; - } - } - - util_strscpy(path, sizeof(path), udev_device->syspath); - subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; - while (1) { - char *pos; - - pos = strrchr(subdir, '/'); - if (pos == NULL || pos < &subdir[2]) - break; - pos[0] = '\0'; - udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); - if (udev_device_parent != NULL) - return udev_device_parent; - } - return NULL; -} - -struct udev_device *udev_device_get_parent(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->parent_set) { - udev_device->parent_set = 1; - udev_device->parent_device = device_new_from_parent(udev_device); - } - if (udev_device->parent_device != NULL) - dbg(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); - return udev_device->parent_device; -} - -struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) -{ - struct udev_device *parent; - - if (subsystem == NULL) - return NULL; - - parent = udev_device_get_parent(udev_device); - while (parent != NULL) { - const char *parent_subsystem; - const char *parent_devtype; - - parent_subsystem = udev_device_get_subsystem(parent); - if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) { - if (devtype == NULL) - break; - parent_devtype = udev_device_get_devtype(parent); - if (parent_devtype != NULL && strcmp(parent_devtype, devtype) == 0) - break; - } - parent = udev_device_get_parent(parent); - } - return parent; -} - -/** - * udev_device_get_udev: - * @udev_device: udev device - * - * Retrieve the udev library context the device was created with. - * - * Returns: the udev library context - **/ -struct udev *udev_device_get_udev(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->udev; -} - -/** - * udev_device_ref: - * @udev_device: udev device - * - * Take a reference of a udev device. - * - * Returns: the passed udev device - **/ -struct udev_device *udev_device_ref(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - udev_device->refcount++; - return udev_device; -} - -/** - * udev_device_unref: - * @udev_device: udev device - * - * Drop a reference of a udev device. If the refcount reaches zero, - * the resources of the device will be released. - * - **/ -void udev_device_unref(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return; - udev_device->refcount--; - if (udev_device->refcount > 0) - return; - if (udev_device->parent_device != NULL) - udev_device_unref(udev_device->parent_device); - free(udev_device->syspath); - free(udev_device->sysname); - free(udev_device->devnode); - free(udev_device->subsystem); - free(udev_device->devtype); - udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); - udev_list_cleanup_entries(udev_device->udev, &udev_device->properties_list); - free(udev_device->action); - free(udev_device->driver); - free(udev_device->devpath_old); - free(udev_device->knodename); - udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); - free(udev_device->envp); - free(udev_device->monitor_buf); - dbg(udev_device->udev, "udev_device: %p released\n", udev_device); - free(udev_device); -} - -/** - * udev_device_get_devpath: - * @udev_device: udev device - * - * Retrieve the kernel devpath value of the udev device. The path - * does not contain the sys mount point, and starts with a '/'. - * - * Returns: the devpath of the udev device - **/ -const char *udev_device_get_devpath(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->devpath; -} - -/** - * udev_device_get_syspath: - * @udev_device: udev device - * - * Retrieve the sys path of the udev device. The path is an - * absolute path and starts with the sys mount point. - * - * Returns: the sys path of the udev device - **/ -const char *udev_device_get_syspath(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->syspath; -} - -const char *udev_device_get_sysname(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->sysname; -} - -const char *udev_device_get_sysnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->sysnum; -} - -/** - * udev_device_get_devnode: - * @udev_device: udev device - * - * Retrieve the device node file name belonging to the udev device. - * The path is an absolute path, and starts with the device directory. - * - * Returns: the device node file name of the udev device, or #NULL if no device node exists - **/ -const char *udev_device_get_devnode(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->devnode; -} - -/** - * udev_device_get_subsystem: - * @udev_device: udev device - * - * Retrieve the subsystem string of the udev device. The string does not - * contain any "/". - * - * Returns: the subsystem name of the udev device, or #NULL if it can not be determined - **/ -const char *udev_device_get_subsystem(struct udev_device *udev_device) -{ - char subsystem[UTIL_NAME_SIZE]; - - if (udev_device == NULL) - return NULL; - if (!udev_device->subsystem_set) { - udev_device->subsystem_set = 1; - /* read "subsytem" link */ - if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { - udev_device_set_subsystem(udev_device, subsystem); - return udev_device->subsystem; - } - /* implicit names */ - if (strncmp(udev_device->devpath, "/module/", 8) == 0) { - udev_device_set_subsystem(udev_device, "module"); - return udev_device->subsystem; - } - if (strstr(udev_device->devpath, "/drivers/") != NULL) { - udev_device_set_subsystem(udev_device, "drivers"); - return udev_device->subsystem; - } - if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || - strncmp(udev_device->devpath, "/class/", 7) == 0 || - strncmp(udev_device->devpath, "/bus/", 5) == 0) { - udev_device_set_subsystem(udev_device, "subsystem"); - return udev_device->subsystem; - } - } - return udev_device->subsystem; -} - -/** - * udev_device_get_devtype: - * @udev_device: udev device - * - * Retrieve the devtype string of the udev device. - * - * Returns: the devtype name of the udev device, or #NULL if it can not be determined - **/ -const char *udev_device_get_devtype(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->devtype_set) { - udev_device->devtype_set = 1; - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - } - return udev_device->devtype; -} - -/** - * udev_device_get_devlinks_list_entry: - * @udev_device: udev device - * - * Retrieve the list of device links pointing to the device file of - * the udev device. The next list entry can be retrieved with - * udev_list_entry_next(), which returns #NULL if no more entries exist. - * The devlink path can be retrieved from the list entry by - * udev_list_entry_get_name(). The path is an absolute path, and starts with - * the device directory. - * - * Returns: the first entry of the device node link list - **/ -struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_list_get_entry(&udev_device->devlinks_list); -} - -void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) -{ - udev_device->devlinks_uptodate = 0; - udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); -} - -/** - * udev_device_get_properties_list_entry: - * @udev_device: udev device - * - * Retrieve the list of key/value device properties of the udev - * device. The next list entry can be retrieved with udev_list_entry_next(), - * which returns #NULL if no more entries exist. The property name - * can be retrieved from the list entry by udev_list_get_name(), - * the property value by udev_list_get_value(). - * - * Returns: the first entry of the property list - **/ -struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->info_loaded) - device_load_info(udev_device); - if (!udev_device->devlinks_uptodate) { - char symlinks[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - - udev_device->devlinks_uptodate = 1; - list_entry = udev_device_get_devlinks_list_entry(udev_device); - if (list_entry != NULL) { - char *s; - size_t l; - - s = symlinks; - l = util_strpcpyl(&s, sizeof(symlinks), udev_list_entry_get_name(list_entry), NULL); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) - l = util_strpcpyl(&s, l, " ", udev_list_entry_get_name(list_entry), NULL); - udev_device_add_property(udev_device, "DEVLINKS", symlinks); - } - } - return udev_list_get_entry(&udev_device->properties_list); -} - -const char *udev_device_get_driver(struct udev_device *udev_device) -{ - char driver[UTIL_NAME_SIZE]; - - if (udev_device == NULL) - return NULL; - if (!udev_device->driver_set) { - udev_device->driver_set = 1; - if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) > 0) - udev_device->driver = strdup(driver); - } - return udev_device->driver; -} - -dev_t udev_device_get_devnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return makedev(0, 0); - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->devnum; -} - -const char *udev_device_get_action(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->action; -} - -unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return 0; - return udev_device->seqnum; -} - -const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) -{ - struct udev_list_entry *list_entry; - char path[UTIL_PATH_SIZE]; - char value[4096]; - struct stat statbuf; - int fd; - ssize_t size; - const char *val = NULL; - - if (udev_device == NULL) - return NULL; - if (sysattr == NULL) - return NULL; - - /* look for possibly already cached result */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_list)) { - if (strcmp(udev_list_entry_get_name(list_entry), sysattr) == 0) { - dbg(udev_device->udev, "got '%s' (%s) from cache\n", - sysattr, udev_list_entry_get_value(list_entry)); - return udev_list_entry_get_value(list_entry); - } - } - - util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); - if (lstat(path, &statbuf) != 0) { - dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); - udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, NULL, 0, 0); - goto out; - } - - if (S_ISLNK(statbuf.st_mode)) { - char target[UTIL_NAME_SIZE]; - int len; - char *pos; - - /* some core links return the last element of the target path */ - if (strcmp(sysattr, "driver") != 0 && - strcmp(sysattr, "subsystem") != 0 && - strcmp(sysattr, "module") != 0) - goto out; - - len = readlink(path, target, sizeof(target)); - if (len > 0) { - target[len] = '\0'; - pos = strrchr(target, '/'); - if (pos != NULL) { - pos = &pos[1]; - dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0); - val = udev_list_entry_get_value(list_entry); - } - } - goto out; - } - - /* skip directories */ - if (S_ISDIR(statbuf.st_mode)) - goto out; - - /* skip non-readable files */ - if ((statbuf.st_mode & S_IRUSR) == 0) - goto out; - - /* read attribute value */ - fd = open(path, O_RDONLY); - if (fd < 0) { - dbg(udev_device->udev, "attribute '%s' can not be opened\n", path); - goto out; - } - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - if (size == sizeof(value)) - goto out; - - /* got a valid value, store it in cache and return it */ - value[size] = '\0'; - util_remove_trailing_chars(value, '\n'); - dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, value, 0, 0); - val = udev_list_entry_get_value(list_entry); -out: - return val; -} - -int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) -{ - const char *pos; - size_t len; - - free(udev_device->syspath); - udev_device->syspath = strdup(syspath); - if (udev_device->syspath == NULL) - return -ENOMEM; - udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; - udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath); - - pos = strrchr(udev_device->syspath, '/'); - if (pos == NULL) - return -EINVAL; - udev_device->sysname = strdup(&pos[1]); - if (udev_device->sysname == NULL) - return -ENOMEM; - - /* some devices have '!' in their name, change that to '/' */ - len = 0; - while (udev_device->sysname[len] != '\0') { - if (udev_device->sysname[len] == '!') - udev_device->sysname[len] = '/'; - len++; - } - - /* trailing number */ - while (len > 0 && isdigit(udev_device->sysname[--len])) - udev_device->sysnum = &udev_device->sysname[len]; - - /* sysname is completely numeric */ - if (len == 0) - udev_device->sysnum = NULL; - - return 0; -} - -int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) -{ - free(udev_device->subsystem); - udev_device->subsystem = strdup(subsystem); - if (udev_device->subsystem == NULL) - return -ENOMEM; - udev_device->subsystem_set = 1; - udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); - return 0; -} - -int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) -{ - free(udev_device->devtype); - udev_device->devtype = strdup(devtype); - if (udev_device->devtype == NULL) - return -ENOMEM; - udev_device->devtype_set = 1; - udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); - return 0; -} - -int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) -{ - free(udev_device->devnode); - udev_device->devnode = strdup(devnode); - if (devnode == NULL) - return 0; - if (udev_device->devnode == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); - return 0; -} - -int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink) -{ - udev_device->devlinks_uptodate = 0; - if (udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, 1, 0) == NULL) - return -ENOMEM; - return 0; -} - -struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) -{ - udev_device->envp_uptodate = 0; - if (value == NULL) { - struct udev_list_entry *list_entry; - - list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); - if (list_entry != NULL) - udev_list_entry_delete(list_entry); - return NULL; - } - return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); -} - -struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) -{ - char name[UTIL_PATH_SIZE]; - char *val; - - util_strscpy(name, sizeof(name), property); - val = strchr(name, '='); - if (val == NULL) - return NULL; - val[0] = '\0'; - val = &val[1]; - if (val[0] == '\0') - val = NULL; - return udev_device_add_property(udev_device, name, val); -} - -const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) -{ - struct udev_list_entry *list_entry; - - if (udev_device == NULL) - return NULL; - if (key == NULL) - return NULL; - - list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); - return udev_list_entry_get_value(list_entry); -} - -#define ENVP_SIZE 128 -#define MONITOR_BUF_SIZE 4096 -static int update_envp_monitor_buf(struct udev_device *udev_device) -{ - struct udev_list_entry *list_entry; - char *s; - size_t l; - unsigned int i; - - /* monitor buffer of property strings */ - free(udev_device->monitor_buf); - udev_device->monitor_buf_len = 0; - udev_device->monitor_buf = malloc(MONITOR_BUF_SIZE); - if (udev_device->monitor_buf == NULL) - return -ENOMEM; - - /* envp array, strings will point into monitor buffer */ - if (udev_device->envp == NULL) - udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); - if (udev_device->envp == NULL) - return -ENOMEM; - - i = 0; - s = udev_device->monitor_buf; - l = MONITOR_BUF_SIZE; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - /* add string to envp array */ - udev_device->envp[i++] = s; - if (i+1 >= ENVP_SIZE) - return -EINVAL; - - /* add property string to monitor buffer */ - l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), "=", - udev_list_entry_get_value(list_entry), NULL); - if (l == 0) - return -EINVAL; - s++; - } - udev_device->envp[i] = NULL; - udev_device->monitor_buf_len = s - udev_device->monitor_buf; - udev_device->envp_uptodate = 1; - dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", - i, udev_device->monitor_buf_len); - return 0; -} - -char **udev_device_get_properties_envp(struct udev_device *udev_device) -{ - if (!udev_device->envp_uptodate) - if (update_envp_monitor_buf(udev_device) != 0) - return NULL; - return udev_device->envp; -} - -ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf) -{ - if (!udev_device->envp_uptodate) - if (update_envp_monitor_buf(udev_device) != 0) - return -EINVAL; - *buf = udev_device->monitor_buf; - return udev_device->monitor_buf_len; -} - -int udev_device_set_action(struct udev_device *udev_device, const char *action) -{ - free(udev_device->action); - udev_device->action = strdup(action); - if (udev_device->action == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "ACTION", udev_device->action); - return 0; -} - -int udev_device_set_driver(struct udev_device *udev_device, const char *driver) -{ - free(udev_device->driver); - udev_device->driver = strdup(driver); - if (udev_device->driver == NULL) - return -ENOMEM; - udev_device->driver_set = 1; - udev_device_add_property(udev_device, "DRIVER", udev_device->driver); - return 0; -} - -const char *udev_device_get_devpath_old(struct udev_device *udev_device) -{ - return udev_device->devpath_old; -} - -int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) -{ - udev_device->devpath_old = strdup(devpath_old); - if (udev_device->devpath_old == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); - return 0; -} - -const char *udev_device_get_knodename(struct udev_device *udev_device) -{ - return udev_device->knodename; -} - -int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename) -{ - udev_device->knodename = strdup(knodename); - if (udev_device->knodename == NULL) - return -ENOMEM; - return 0; -} - -int udev_device_get_timeout(struct udev_device *udev_device) -{ - return udev_device->timeout; -} - -int udev_device_set_timeout(struct udev_device *udev_device, int timeout) -{ - udev_device->timeout = timeout; - return 0; -} -int udev_device_get_event_timeout(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->event_timeout; -} - -int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout) -{ - udev_device->event_timeout = event_timeout; - return 0; -} - -int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) -{ - char num[32]; - - udev_device->seqnum = seqnum; - snprintf(num, sizeof(num), "%llu", seqnum); - udev_device_add_property(udev_device, "SEQNUM", num); - return 0; -} - -int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) -{ - char num[32]; - - udev_device->devnum = devnum; - - snprintf(num, sizeof(num), "%u", major(devnum)); - udev_device_add_property(udev_device, "MAJOR", num); - snprintf(num, sizeof(num), "%u", minor(devnum)); - udev_device_add_property(udev_device, "MINOR", num); - return 0; -} - -int udev_device_get_num_fake_partitions(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->num_fake_partitions; -} - -int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num) -{ - udev_device->num_fake_partitions = num; - return 0; -} - -int udev_device_get_devlink_priority(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->devlink_priority; -} - -int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) -{ - udev_device->devlink_priority = prio; - return 0; -} - -int udev_device_get_ignore_remove(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->ignore_remove; -} - -int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore) -{ - udev_device->ignore_remove = ignore; - return 0; -} - -int udev_device_get_watch_handle(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->watch_handle; -} - -int udev_device_set_watch_handle(struct udev_device *udev_device, int handle) -{ - udev_device->watch_handle = handle; - return 0; -} diff --git a/udev/lib/libudev-enumerate.c b/udev/lib/libudev-enumerate.c deleted file mode 100644 index 63f84062b2..0000000000 --- a/udev/lib/libudev-enumerate.c +++ /dev/null @@ -1,479 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static int devices_sort(struct udev_enumerate *udev_enumerate); - -struct udev_enumerate { - struct udev *udev; - int refcount; - struct udev_list_node sysattr_match_list; - struct udev_list_node sysattr_nomatch_list; - struct udev_list_node subsystem_match_list; - struct udev_list_node subsystem_nomatch_list; - struct udev_list_node properties_match_list; - struct udev_list_node devices_list; - int devices_sorted; -}; - -/** - * udev_enumerate_new: - * @udev: udev library context - * - * Returns: an enumeration context - **/ -struct udev_enumerate *udev_enumerate_new(struct udev *udev) -{ - struct udev_enumerate *udev_enumerate; - - udev_enumerate = calloc(1, sizeof(struct udev_enumerate)); - if (udev_enumerate == NULL) - return NULL; - udev_enumerate->refcount = 1; - udev_enumerate->udev = udev; - udev_list_init(&udev_enumerate->devices_list); - udev_list_init(&udev_enumerate->sysattr_match_list); - udev_list_init(&udev_enumerate->sysattr_nomatch_list); - udev_list_init(&udev_enumerate->subsystem_match_list); - udev_list_init(&udev_enumerate->subsystem_nomatch_list); - udev_list_init(&udev_enumerate->properties_match_list); - return udev_enumerate; -} - -struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) -{ - if (udev_enumerate == NULL) - return NULL; - udev_enumerate->refcount++; - return udev_enumerate; -} - -void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) -{ - if (udev_enumerate == NULL) - return; - udev_enumerate->refcount--; - if (udev_enumerate->refcount > 0) - return; - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_nomatch_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->properties_match_list); - free(udev_enumerate); -} - -struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) -{ - if (udev_enumerate == NULL) - return NULL; - return udev_enumerate->udev; -} - -struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) -{ - if (udev_enumerate == NULL) - return NULL; - if (!udev_enumerate->devices_sorted) - devices_sort(udev_enumerate); - return udev_list_get_entry(&udev_enumerate->devices_list); -} - -int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (subsystem == NULL) - return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_match_list, subsystem, NULL, 1, 0) == NULL) - return -ENOMEM; - return 0; -} - -int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (subsystem == NULL) - return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_nomatch_list, subsystem, NULL, 1, 0) == NULL) - return -ENOMEM; - return 0; -} - -int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (sysattr == NULL) - return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_match_list, sysattr, value, 0, 0) == NULL) - return -ENOMEM; - return 0; -} - -int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (sysattr == NULL) - return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_nomatch_list, sysattr, value, 0, 0) == NULL) - return -ENOMEM; - return 0; -} - -static int match_sysattr_value(struct udev *udev, const char *syspath, const char *sysattr, const char *match_val) -{ - struct udev_device *device; - const char *val = NULL; - int match = 0; - - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) - return -EINVAL; - val = udev_device_get_sysattr_value(device, sysattr); - if (val == NULL) - goto exit; - if (match_val == NULL) { - match = 1; - goto exit; - } - if (fnmatch(match_val, val, 0) == 0) { - match = 1; - goto exit; - } -exit: - udev_device_unref(device); - return match; -} - -int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (property == NULL) - return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->properties_match_list, property, value, 0, 0) == NULL) - return -ENOMEM; - return 0; -} - -static int match_sysattr(struct udev_enumerate *udev_enumerate, const char *syspath) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - struct udev_list_entry *list_entry; - - /* skip list */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_nomatch_list)) { - if (match_sysattr_value(udev, syspath, - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry))) - return 0; - } - /* include list */ - if (udev_list_get_entry(&udev_enumerate->sysattr_match_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_match_list)) { - /* anything that does not match, will make it FALSE */ - if (!match_sysattr_value(udev, syspath, - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry))) - return 0; - } - return 1; - } - return 1; -} - -static int match_property(struct udev_enumerate *udev_enumerate, const char *syspath) -{ - struct udev_device *dev; - struct udev_list_entry *list_entry; - int match = 0; - - /* no match always matches */ - if (udev_list_get_entry(&udev_enumerate->properties_match_list) == NULL) - return 1; - - /* no device does not match */ - dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); - if (dev == NULL) - return 0; - - /* loop over matches */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) { - const char *match_key = udev_list_entry_get_name(list_entry); - const char *match_value = udev_list_entry_get_value(list_entry); - struct udev_list_entry *property_entry; - - /* loop over device properties */ - udev_list_entry_foreach(property_entry, udev_device_get_properties_list_entry(dev)) { - const char *dev_key = udev_list_entry_get_name(property_entry); - const char *dev_value = udev_list_entry_get_value(property_entry); - - if (fnmatch(match_key, dev_key, 0) != 0) - continue; - if (match_value == NULL && dev_value == NULL) { - match = 1; - goto out; - } - if (match_value == NULL || dev_value == NULL) - continue; - if (fnmatch(match_value, dev_value, 0) == 0) { - match = 1; - goto out; - } - } - } -out: - udev_device_unref(dev); - return match; -} - -static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, - const char *basedir, const char *subdir1, const char *subdir2) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char path[UTIL_PATH_SIZE]; - size_t l; - char *s; - DIR *dir; - struct dirent *dent; - - s = path; - l = util_strpcpyl(&s, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); - if (subdir1 != NULL) - l = util_strpcpyl(&s, l, "/", subdir1, NULL); - if (subdir2 != NULL) - l = util_strpcpyl(&s, l, "/", subdir2, NULL); - dir = opendir(path); - if (dir == NULL) - return -1; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char syspath[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; - - if (dent->d_name[0] == '.') - continue; - util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); - if (lstat(syspath, &statbuf) != 0) - continue; - if (S_ISREG(statbuf.st_mode)) - continue; - if (S_ISLNK(statbuf.st_mode)) - util_resolve_sys_link(udev, syspath, sizeof(syspath)); - - util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); - if (stat(filename, &statbuf) != 0) - continue; - if (!match_sysattr(udev_enumerate, syspath)) - continue; - if (!match_property(udev_enumerate, syspath)) - continue; - udev_list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); - } - closedir(dir); - return 0; -} - -static int match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) -{ - struct udev_list_entry *list_entry; - - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { - if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) - return 0; - } - if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) { - if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) - return 1; - } - return 0; - } - return 1; -} - -static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir, const char *subsystem) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - - char path[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); - dir = opendir(path); - if (dir == NULL) - return -1; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - if (dent->d_name[0] == '.') - continue; - if (!match_subsystem(udev_enumerate, subsystem != NULL ? subsystem : dent->d_name)) - continue; - scan_dir_and_add_devices(udev_enumerate, basedir, dent->d_name, subdir); - } - closedir(dir); - return 0; -} - -static int devices_delay(struct udev *udev, const char *syspath) -{ - static const char *delay_device_list[] = { - "/block/md", - "/block/dm-", - NULL - }; - size_t len; - int i; - - len = strlen(udev_get_sys_path(udev)); - for (i = 0; delay_device_list[i] != NULL; i++) { - if (strstr(&syspath[len], delay_device_list[i]) != NULL) { - dbg(udev, "delaying: %s\n", syspath); - return 1; - } - } - return 0; -} - -/* sort delayed devices to the end of the list */ -static int devices_sort(struct udev_enumerate *udev_enumerate) -{ - struct udev_list_entry *entry_loop; - struct udev_list_entry *entry_tmp; - struct udev_list_node devices_list; - - udev_list_init(&devices_list); - /* move delayed to delay list */ - udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(&udev_enumerate->devices_list)) { - if (devices_delay(udev_enumerate->udev, udev_list_entry_get_name(entry_loop))) { - udev_list_entry_remove(entry_loop); - udev_list_entry_append(entry_loop, &devices_list); - } - } - /* move delayed back to end of list */ - udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(&devices_list)) { - udev_list_entry_remove(entry_loop); - udev_list_entry_append(entry_loop, &udev_enumerate->devices_list); - } - udev_enumerate->devices_sorted = 1; - return 0; -} - -int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - struct udev_device *udev_device; - - if (udev_enumerate == NULL) - return -EINVAL; - if (syspath == NULL) - return 0; - /* resolve to real syspath */ - udev_device = udev_device_new_from_syspath(udev_enumerate->udev, syspath); - if (udev_device == NULL) - return -EINVAL; - udev_list_entry_add(udev, &udev_enumerate->devices_list, - udev_device_get_syspath(udev_device), NULL, 1, 1); - udev_device_unref(udev_device); - return 0; -} - -/** - * udev_enumerate_scan_devices: - * @udev_enumerate: udev enumeration context - * - * Returns: a negative value on error. - **/ -int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char base[UTIL_PATH_SIZE]; - struct stat statbuf; - - if (udev_enumerate == NULL) - return -EINVAL; - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); - if (stat(base, &statbuf) == 0) { - /* we have /subsystem/, forget all the old stuff */ - dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "subsystem", "devices", NULL); - } else { - dbg(udev, "searching '/bus/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "bus", "devices", NULL); - dbg(udev, "searching '/class/*' dir\n"); - scan_dir(udev_enumerate, "class", NULL, NULL); - /* if block isn't a class, scan /block/ */ - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/class/block", NULL); - if (stat(base, &statbuf) != 0) { - if (match_subsystem(udev_enumerate, "block")) { - dbg(udev, "searching '/block/*' dir\n"); - /* scan disks */ - scan_dir_and_add_devices(udev_enumerate, "block", NULL, NULL); - /* scan partitions */ - dbg(udev, "searching '/block/*/*' dir\n"); - scan_dir(udev_enumerate, "block", NULL, "block"); - } - } - } - return 0; -} - -/** - * udev_enumerate_scan_subsystems: - * @udev_enumerate: udev enumeration context - * - * Returns: a negative value on error. - **/ -int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char base[UTIL_PATH_SIZE]; - struct stat statbuf; - const char *subsysdir; - - if (udev_enumerate == NULL) - return -EINVAL; - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); - if (stat(base, &statbuf) == 0) - subsysdir = "subsystem"; - else - subsysdir = "bus"; - if (match_subsystem(udev_enumerate, "subsystem")) { - dbg(udev, "searching '%s/*' dir\n", subsysdir); - scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); - } - if (match_subsystem(udev_enumerate, "drivers")) { - dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); - scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); - } - return 0; -} diff --git a/udev/lib/libudev-list.c b/udev/lib/libudev-list.c deleted file mode 100644 index 182d75aa8a..0000000000 --- a/udev/lib/libudev-list.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -struct udev_list_entry { - struct udev_list_node node; - struct udev *udev; - struct udev_list_node *list; - char *name; - char *value; - int flag; -}; - -/* list head point to itself if empty */ -void udev_list_init(struct udev_list_node *list) -{ - list->next = list; - list->prev = list; -} - -int udev_list_is_empty(struct udev_list_node *list) -{ - return list->next == list; -} - -static void udev_list_node_insert_between(struct udev_list_node *new, - struct udev_list_node *prev, - struct udev_list_node *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list) -{ - udev_list_node_insert_between(new, list->prev, list); -} - -void udev_list_node_remove(struct udev_list_node *entry) -{ - struct udev_list_node *prev = entry->prev; - struct udev_list_node *next = entry->next; - - next->prev = prev; - prev->next = next; - - entry->prev = NULL; - entry->next = NULL; -} - -/* return list entry which embeds this node */ -static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) -{ - char *list; - - list = (char *)node; - list -= offsetof(struct udev_list_entry, node); - return (struct udev_list_entry *)list; -} - -/* insert entry into a list as the last element */ -void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list) -{ - /* inserting before the list head make the node the last node in the list */ - udev_list_node_insert_between(&new->node, list->prev, list); - new->list = list; -} - -/* remove entry from a list */ -void udev_list_entry_remove(struct udev_list_entry *entry) -{ - udev_list_node_remove(&entry->node); - entry->list = NULL; -} - -/* insert entry into a list, before a given existing entry */ -void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) -{ - udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node); - new->list = entry->list; -} - -struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, - const char *name, const char *value, - int unique, int sort) -{ - struct udev_list_entry *entry_loop = NULL; - struct udev_list_entry *entry_new; - - if (unique) - udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { - if (strcmp(entry_loop->name, name) == 0) { - dbg(udev, "'%s' is already in the list\n", name); - free(entry_loop->value); - if (value == NULL) { - entry_loop->value = NULL; - dbg(udev, "'%s' value unset\n", name); - return entry_loop; - } - entry_loop->value = strdup(value); - if (entry_loop->value == NULL) - return NULL; - dbg(udev, "'%s' value replaced with '%s'\n", name, value); - return entry_loop; - } - } - - if (sort) - udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { - if (strcmp(entry_loop->name, name) > 0) - break; - } - - entry_new = malloc(sizeof(struct udev_list_entry)); - if (entry_new == NULL) - return NULL; - memset(entry_new, 0x00, sizeof(struct udev_list_entry)); - entry_new->udev = udev; - entry_new->name = strdup(name); - if (entry_new->name == NULL) { - free(entry_new); - return NULL; - } - if (value != NULL) { - entry_new->value = strdup(value); - if (entry_new->value == NULL) { - free(entry_new->name); - free(entry_new); - return NULL; - } - } - if (entry_loop != NULL) - udev_list_entry_insert_before(entry_new, entry_loop); - else - udev_list_entry_append(entry_new, list); - dbg(udev, "'%s=%s' added\n", entry_new->name, entry_new->value); - return entry_new; -} - -void udev_list_entry_delete(struct udev_list_entry *entry) -{ - udev_list_node_remove(&entry->node); - free(entry->name); - free(entry->value); - free(entry); -} - -void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *list) -{ - struct udev_list_entry *entry_loop; - struct udev_list_entry *entry_tmp; - - udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) - udev_list_entry_delete(entry_loop); -} - -struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) -{ - if (udev_list_is_empty(list)) - return NULL; - return list_node_to_entry(list->next); -} - -struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) -{ - struct udev_list_node *next; - - if (list_entry == NULL) - return NULL; - next = list_entry->node.next; - /* empty list or no more entries */ - if (next == list_entry->list) - return NULL; - return list_node_to_entry(next); -} - -struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) -{ - struct udev_list_entry *entry; - - udev_list_entry_foreach(entry, list_entry) { - if (strcmp(udev_list_entry_get_name(entry), name) == 0) { - dbg(entry->udev, "found '%s=%s'\n", entry->name, entry->value); - return entry; - } - } - return NULL; -} - -const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) -{ - if (list_entry == NULL) - return NULL; - return list_entry->name; -} - -const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) -{ - if (list_entry == NULL) - return NULL; - return list_entry->value; -} - -int udev_list_entry_get_flag(struct udev_list_entry *list_entry) -{ - if (list_entry == NULL) - return -EINVAL; - return list_entry->flag; -} - -void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag) -{ - if (list_entry == NULL) - return; - list_entry->flag = flag; -} diff --git a/udev/lib/libudev-monitor.c b/udev/lib/libudev-monitor.c deleted file mode 100644 index 7a0cb47852..0000000000 --- a/udev/lib/libudev-monitor.c +++ /dev/null @@ -1,760 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2009 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -struct udev_monitor { - struct udev *udev; - int refcount; - int sock; - struct sockaddr_nl snl; - struct sockaddr_nl snl_trusted_sender; - struct sockaddr_nl snl_destination; - struct sockaddr_un sun; - socklen_t addrlen; - struct udev_list_node filter_subsystem_list; -}; - -enum udev_monitor_netlink_group { - UDEV_MONITOR_NONE, - UDEV_MONITOR_KERNEL, - UDEV_MONITOR_UDEV, -}; - -#define UDEV_MONITOR_MAGIC 0xcafe1dea -struct udev_monitor_netlink_header { - /* udev version text */ - char version[16]; - /* - * magic to protect against daemon <-> library message format mismatch - * used in the kernel from socket filter rules; needs to be stored in network order - */ - unsigned int magic; - /* properties buffer */ - unsigned short properties_off; - unsigned short properties_len; - /* - * hashes of some common device properties strings to filter with socket filters in - * the client used in the kernel from socket filter rules; needs to be stored in - * network order - */ - unsigned int filter_subsystem; - unsigned int filter_devtype; -}; - -static struct udev_monitor *udev_monitor_new(struct udev *udev) -{ - struct udev_monitor *udev_monitor; - - udev_monitor = calloc(1, sizeof(struct udev_monitor)); - if (udev_monitor == NULL) - return NULL; - udev_monitor->refcount = 1; - udev_monitor->udev = udev; - udev_list_init(&udev_monitor->filter_subsystem_list); - return udev_monitor; -} - -/** - * udev_monitor_new_from_socket: - * @udev: udev library context - * @socket_path: unix socket path - * - * Create new udev monitor and connect to a specified socket. The - * path to a socket either points to an existing socket file, or if - * the socket path starts with a '@' character, an abstract namespace - * socket will be used. - * - * A socket file will not be created. If it does not already exist, - * it will fall-back and connect to an abstract namespace socket with - * the given path. The permissions adjustment of a socket file, as - * well as the later cleanup, needs to be done by the caller. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev monitor. - * - * Returns: a new udev monitor, or #NULL, in case of an error - **/ -struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) -{ - struct udev_monitor *udev_monitor; - struct stat statbuf; - - if (udev == NULL) - return NULL; - if (socket_path == NULL) - return NULL; - udev_monitor = udev_monitor_new(udev); - if (udev_monitor == NULL) - return NULL; - - udev_monitor->sun.sun_family = AF_LOCAL; - if (socket_path[0] == '@') { - /* translate leading '@' to abstract namespace */ - util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); - udev_monitor->sun.sun_path[0] = '\0'; - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); - } else if (stat(socket_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { - /* existing socket file */ - util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); - } else { - /* no socket file, assume abstract namespace socket */ - util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; - } - udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); - if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %m\n"); - free(udev_monitor); - return NULL; - } - util_set_fd_cloexec(udev_monitor->sock); - - dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); - return udev_monitor; -} - -/** - * udev_monitor_new_from_netlink: - * @udev: udev library context - * @name: name of event source - * - * Create new udev monitor and connect to a specified event - * source. Valid sources identifiers are "udev" and "kernel". - * - * Applications should usually not connect directly to the - * "kernel" events, because the devices might not be useable - * at that time, before udev has configured them, and created - * device nodes. - * - * Accessing devices at the same time as udev, might result - * in unpredictable behavior. - * - * The "udev" events are sent out after udev has finished its - * event processing, all rules have been processed, and needed - * device nodes are created. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev monitor. - * - * Returns: a new udev monitor, or #NULL, in case of an error - **/ -struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) -{ - struct udev_monitor *udev_monitor; - unsigned int group; - - if (udev == NULL) - return NULL; - - if (name == NULL) - group = UDEV_MONITOR_NONE; - else if (strcmp(name, "udev") == 0) - group = UDEV_MONITOR_UDEV; - else if (strcmp(name, "kernel") == 0) - group = UDEV_MONITOR_KERNEL; - else - return NULL; - - udev_monitor = udev_monitor_new(udev); - if (udev_monitor == NULL) - return NULL; - - udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); - if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %m\n"); - free(udev_monitor); - return NULL; - } - util_set_fd_cloexec(udev_monitor->sock); - - udev_monitor->snl.nl_family = AF_NETLINK; - udev_monitor->snl.nl_groups = group; - - /* default destination for sending */ - udev_monitor->snl_destination.nl_family = AF_NETLINK; - udev_monitor->snl_destination.nl_groups = UDEV_MONITOR_UDEV; - - dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT (%u)\n", udev_monitor, group); - return udev_monitor; -} - -static inline void bpf_stmt(struct sock_filter *inss, unsigned int *i, - unsigned short code, unsigned int data) -{ - struct sock_filter *ins = &inss[*i]; - - ins->code = code; - ins->k = data; - (*i)++; -} - -static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, - unsigned short code, unsigned int data, - unsigned short jt, unsigned short jf) -{ - struct sock_filter *ins = &inss[*i]; - - ins->code = code; - ins->jt = jt; - ins->jf = jf; - ins->k = data; - (*i)++; -} - -int udev_monitor_filter_update(struct udev_monitor *udev_monitor) -{ - static struct sock_filter ins[256]; - static struct sock_fprog filter; - unsigned int i; - struct udev_list_entry *list_entry; - int err; - - if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) - return 0; - - memset(ins, 0x00, sizeof(ins)); - i = 0; - - /* load magic in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, magic)); - /* jump if magic matches */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, UDEV_MONITOR_MAGIC, 1, 0); - /* wrong magic, pass packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); - - /* add all subsystem match values */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { - unsigned int hash; - - /* load filter_subsystem value in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem)); - hash = util_string_hash32(udev_list_entry_get_name(list_entry)); - if (udev_list_entry_get_value(list_entry) == NULL) { - /* jump if subsystem does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); - } else { - /* jump if subsystem does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3); - - /* load filter_devtype value in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_devtype)); - /* jump if value does not match */ - hash = util_string_hash32(udev_list_entry_get_value(list_entry)); - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); - } - - /* matched, pass packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); - - if (i+1 >= ARRAY_SIZE(ins)) - return -1; - } - /* nothing matched, drop packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); - - /* install filter */ - filter.len = i; - filter.filter = ins; - err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); - return err; -} - -int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender) -{ - udev_monitor->snl_trusted_sender.nl_pid = sender->snl.nl_pid; - return 0; -} - -int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) -{ - int err; - const int on = 1; - - if (udev_monitor->sun.sun_family != 0) { - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); - } else if (udev_monitor->snl.nl_family != 0) { - udev_monitor_filter_update(udev_monitor); - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); - if (err == 0) { - struct sockaddr_nl snl; - socklen_t addrlen; - - /* - * get the address the kernel has assigned us - * it is usually, but not neccessarily the pid - */ - addrlen = sizeof(struct sockaddr_nl); - err = getsockname(udev_monitor->sock, (struct sockaddr *)&snl, &addrlen); - if (err == 0) - udev_monitor->snl.nl_pid = snl.nl_pid; - } - } else { - return -EINVAL; - } - - if (err < 0) { - err(udev_monitor->udev, "bind failed: %m\n"); - return err; - } - - /* enable receiving of sender credentials */ - setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - return 0; -} - -int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) -{ - if (udev_monitor == NULL) - return -1; - return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size)); -} - -int udev_monitor_disconnect(struct udev_monitor *udev_monitor) -{ - int err; - - err = close(udev_monitor->sock); - udev_monitor->sock = -1; - return err; -} - -/** - * udev_monitor_ref: - * @udev_monitor: udev monitor - * - * Take a reference of a udev monitor. - * - * Returns: the passed udev monitor - **/ -struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) -{ - if (udev_monitor == NULL) - return NULL; - udev_monitor->refcount++; - return udev_monitor; -} - -/** - * udev_monitor_unref: - * @udev_monitor: udev monitor - * - * Drop a reference of a udev monitor. If the refcount reaches zero, - * the bound socket will be closed, and the resources of the monitor - * will be released. - * - **/ -void udev_monitor_unref(struct udev_monitor *udev_monitor) -{ - if (udev_monitor == NULL) - return; - udev_monitor->refcount--; - if (udev_monitor->refcount > 0) - return; - if (udev_monitor->sock >= 0) - close(udev_monitor->sock); - udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); - dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); - free(udev_monitor); -} - -/** - * udev_monitor_get_udev: - * @udev_monitor: udev monitor - * - * Retrieve the udev library context the monitor was created with. - * - * Returns: the udev library context - **/ -struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) -{ - if (udev_monitor == NULL) - return NULL; - return udev_monitor->udev; -} - -/** - * udev_monitor_get_fd: - * @udev_monitor: udev monitor - * - * Retrieve the socket file descriptor associated with the monitor. - * - * Returns: the socket file descriptor - **/ -int udev_monitor_get_fd(struct udev_monitor *udev_monitor) -{ - if (udev_monitor == NULL) - return -1; - return udev_monitor->sock; -} - -static int passes_filter(struct udev_monitor *udev_monitor, struct udev_device *udev_device) -{ - struct udev_list_entry *list_entry; - - if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) - return 1; - - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { - const char *subsys = udev_list_entry_get_name(list_entry); - const char *dsubsys = udev_device_get_subsystem(udev_device); - const char *devtype; - const char *ddevtype; - - if (strcmp(dsubsys, subsys) != 0) - continue; - - devtype = udev_list_entry_get_value(list_entry); - if (devtype == NULL) - return 1; - ddevtype = udev_device_get_devtype(udev_device); - if (ddevtype == NULL) - continue; - if (strcmp(ddevtype, devtype) == 0) - return 1; - } - return 0; -} - -/** - * udev_monitor_receive_device: - * @udev_monitor: udev monitor - * - * Receive data from the udev monitor socket, allocate a new udev - * device, fill in the received data, and return the device. - * - * Only socket connections with uid=0 are accepted. The caller - * needs to make sure that there is data to read from the socket. - * The call will block until the socket becomes readable. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev device. - * - * Returns: a new udev device, or #NULL, in case of an error - **/ -struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) -{ - struct udev_device *udev_device; - struct msghdr smsg; - struct iovec iov; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - struct cmsghdr *cmsg; - struct sockaddr_nl snl; - struct ucred *cred; - char buf[8192]; - ssize_t buflen; - ssize_t bufpos; - struct udev_monitor_netlink_header *nlh; - int devpath_set = 0; - int subsystem_set = 0; - int action_set = 0; - int maj = 0; - int min = 0; - int is_kernel = 0; - -retry: - if (udev_monitor == NULL) - return NULL; - memset(buf, 0x00, sizeof(buf)); - iov.iov_base = &buf; - iov.iov_len = sizeof(buf); - memset (&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - - if (udev_monitor->snl.nl_family != 0) { - smsg.msg_name = &snl; - smsg.msg_namelen = sizeof(snl); - } - - buflen = recvmsg(udev_monitor->sock, &smsg, 0); - if (buflen < 0) { - if (errno != EINTR) - info(udev_monitor->udev, "unable to receive message\n"); - return NULL; - } - - if (buflen < 32 || (size_t)buflen >= sizeof(buf)) { - info(udev_monitor->udev, "invalid message length\n"); - return NULL; - } - - if (udev_monitor->snl.nl_family != 0) { - if (snl.nl_groups == 0) { - /* unicast message, check if we trust the sender */ - if (udev_monitor->snl_trusted_sender.nl_pid == 0 || - snl.nl_pid != udev_monitor->snl_trusted_sender.nl_pid) { - info(udev_monitor->udev, "unicast netlink message ignored\n"); - return NULL; - } - } else if (snl.nl_groups == UDEV_MONITOR_KERNEL) { - if (snl.nl_pid > 0) { - info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", snl.nl_pid); - return NULL; - } - is_kernel = 1; - } - } - - cmsg = CMSG_FIRSTHDR(&smsg); - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - info(udev_monitor->udev, "no sender credentials received, message ignored\n"); - return NULL; - } - - cred = (struct ucred *)CMSG_DATA(cmsg); - if (cred->uid != 0) { - info(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid); - return NULL; - } - - if (strncmp(buf, "udev-", 5) == 0) { - /* udev message needs proper version magic */ - nlh = (struct udev_monitor_netlink_header *) buf; - if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) - return NULL; - if (nlh->properties_off < sizeof(struct udev_monitor_netlink_header)) - return NULL; - if (nlh->properties_off+32 > buflen) - return NULL; - bufpos = nlh->properties_off; - } else { - /* kernel message with header */ - bufpos = strlen(buf) + 1; - if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) { - info(udev_monitor->udev, "invalid message length\n"); - return NULL; - } - - /* check message header */ - if (strstr(buf, "@/") == NULL) { - info(udev_monitor->udev, "unrecognized message header\n"); - return NULL; - } - } - - udev_device = device_new(udev_monitor->udev); - if (udev_device == NULL) { - return NULL; - } - - while (bufpos < buflen) { - char *key; - size_t keylen; - - key = &buf[bufpos]; - keylen = strlen(key); - if (keylen == 0) - break; - bufpos += keylen + 1; - - if (strncmp(key, "DEVPATH=", 8) == 0) { - char path[UTIL_PATH_SIZE]; - - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev_monitor->udev), &key[8], NULL); - udev_device_set_syspath(udev_device, path); - devpath_set = 1; - } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { - udev_device_set_subsystem(udev_device, &key[10]); - subsystem_set = 1; - } else if (strncmp(key, "DEVTYPE=", 8) == 0) { - udev_device_set_devtype(udev_device, &key[8]); - } else if (strncmp(key, "DEVNAME=", 8) == 0) { - if (is_kernel) - udev_device_set_knodename(udev_device, &key[8]); - else - udev_device_set_devnode(udev_device, &key[8]); - } else if (strncmp(key, "DEVLINKS=", 9) == 0) { - char devlinks[UTIL_PATH_SIZE]; - char *slink; - char *next; - - util_strscpy(devlinks, sizeof(devlinks), &key[9]); - slink = devlinks; - next = strchr(slink, ' '); - while (next != NULL) { - next[0] = '\0'; - udev_device_add_devlink(udev_device, slink); - slink = &next[1]; - next = strchr(slink, ' '); - } - if (slink[0] != '\0') - udev_device_add_devlink(udev_device, slink); - } else if (strncmp(key, "DRIVER=", 7) == 0) { - udev_device_set_driver(udev_device, &key[7]); - } else if (strncmp(key, "ACTION=", 7) == 0) { - udev_device_set_action(udev_device, &key[7]); - action_set = 1; - } else if (strncmp(key, "MAJOR=", 6) == 0) { - maj = strtoull(&key[6], NULL, 10); - } else if (strncmp(key, "MINOR=", 6) == 0) { - min = strtoull(&key[6], NULL, 10); - } else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) { - udev_device_set_devpath_old(udev_device, &key[12]); - } else if (strncmp(key, "SEQNUM=", 7) == 0) { - udev_device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10)); - } else if (strncmp(key, "TIMEOUT=", 8) == 0) { - udev_device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); - } else { - udev_device_add_property_from_string(udev_device, key); - } - } - if (!devpath_set || !subsystem_set || !action_set) { - info(udev_monitor->udev, "missing values, skip\n"); - udev_device_unref(udev_device); - return NULL; - } - - /* skip device, if it does not pass the current filter */ - if (!passes_filter(udev_monitor, udev_device)) { - struct pollfd pfd[1]; - int rc; - - udev_device_unref(udev_device); - - /* if something is queued, get next device */ - pfd[0].fd = udev_monitor->sock; - pfd[0].events = POLLIN; - rc = poll(pfd, 1, 0); - if (rc > 0) - goto retry; - return NULL; - } - - if (maj > 0) - udev_device_set_devnum(udev_device, makedev(maj, min)); - udev_device_set_info_loaded(udev_device); - return udev_device; -} - -int udev_monitor_send_device(struct udev_monitor *udev_monitor, - struct udev_monitor *destination, struct udev_device *udev_device) -{ - struct msghdr smsg; - struct iovec iov[2]; - const char *buf; - ssize_t blen; - ssize_t count; - - blen = udev_device_get_properties_monitor_buf(udev_device, &buf); - if (blen < 32) - return -1; - - if (udev_monitor->sun.sun_family != 0) { - const char *action; - char header[2048]; - char *s; - - /* header @ */ - action = udev_device_get_action(udev_device); - if (action == NULL) - return -EINVAL; - s = header; - if (util_strpcpyl(&s, sizeof(header), action, "@", udev_device_get_devpath(udev_device), NULL) == 0) - return -EINVAL; - iov[0].iov_base = header; - iov[0].iov_len = (s - header)+1; - - /* add properties list */ - iov[1].iov_base = (char *)buf; - iov[1].iov_len = blen; - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = iov; - smsg.msg_iovlen = 2; - smsg.msg_name = &udev_monitor->sun; - smsg.msg_namelen = udev_monitor->addrlen; - } else if (udev_monitor->snl.nl_family != 0) { - const char *val; - struct udev_monitor_netlink_header nlh; - - - /* add versioned header */ - memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header)); - util_strscpy(nlh.version, sizeof(nlh.version), "udev-" VERSION); - nlh.magic = htonl(UDEV_MONITOR_MAGIC); - val = udev_device_get_subsystem(udev_device); - nlh.filter_subsystem = htonl(util_string_hash32(val)); - val = udev_device_get_devtype(udev_device); - if (val != NULL) - nlh.filter_devtype = htonl(util_string_hash32(val)); - iov[0].iov_base = &nlh; - iov[0].iov_len = sizeof(struct udev_monitor_netlink_header); - - /* add properties list */ - nlh.properties_off = iov[0].iov_len; - nlh.properties_len = blen; - iov[1].iov_base = (char *)buf; - iov[1].iov_len = blen; - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = iov; - smsg.msg_iovlen = 2; - /* - * Use custom address for target, or the default one. - * - * If we send to a muticast group, we will get - * ECONNREFUSED, which is expected. - */ - if (destination != NULL) - smsg.msg_name = &destination->snl; - else - smsg.msg_name = &udev_monitor->snl_destination; - smsg.msg_namelen = sizeof(struct sockaddr_nl); - } else { - return -1; - } - - count = sendmsg(udev_monitor->sock, &smsg, 0); - info(udev_monitor->udev, "passed %zi bytes to monitor %p\n", count, udev_monitor); - return count; -} - -int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) -{ - if (udev_monitor == NULL) - return -EINVAL; - if (subsystem == NULL) - return 0; - if (udev_list_entry_add(udev_monitor->udev, - &udev_monitor->filter_subsystem_list, subsystem, devtype, 0, 0) == NULL) - return -ENOMEM; - return 0; -} - -int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) -{ - static struct sock_fprog filter = { 0, NULL }; - - udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); - return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); -} diff --git a/udev/lib/libudev-private.h b/udev/lib/libudev-private.h deleted file mode 100644 index 5512341e9e..0000000000 --- a/udev/lib/libudev-private.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2009 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#ifndef _LIBUDEV_PRIVATE_H_ -#define _LIBUDEV_PRIVATE_H_ - -#include -#include "libudev.h" - -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - -static inline void __attribute__ ((format(printf, 2, 3))) -udev_log_null(struct udev *udev, const char *format, ...) {} - -#ifdef USE_LOG -# ifdef DEBUG -# define dbg(udev, arg...) udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) -# else -# define dbg(udev, arg...) udev_log_null(udev, ## arg) -# endif -# define info(udev, arg...) udev_log(udev, LOG_INFO, __FILE__, __LINE__, __FUNCTION__, ## arg) -# define err(udev, arg...) udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) -#else -# define dbg(udev, arg...) udev_log_null(udev, ## arg) -# define info(udev, arg...) udev_log_null(udev, ## arg) -# define err(udev, arg...) udev_log_null(udev, ## arg) -#endif - -/* libudev */ -void udev_log(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, ...) - __attribute__ ((format(printf, 6, 7))); -struct udev_device *device_new(struct udev *udev); -const char *udev_get_rules_path(struct udev *udev); -int udev_get_run(struct udev *udev); -struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); -struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); - -/* libudev-device */ -int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); -int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); -int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype); -int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); -int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink); -void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); -struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); -struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); -char **udev_device_get_properties_envp(struct udev_device *udev_device); -ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); -int udev_device_read_db(struct udev_device *udev_device); -int udev_device_read_uevent_file(struct udev_device *udev_device); -int udev_device_set_action(struct udev_device *udev_device, const char *action); -int udev_device_set_driver(struct udev_device *udev_device, const char *driver); -const char *udev_device_get_devpath_old(struct udev_device *udev_device); -int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); -const char *udev_device_get_knodename(struct udev_device *udev_device); -int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename); -int udev_device_get_timeout(struct udev_device *udev_device); -int udev_device_set_timeout(struct udev_device *udev_device, int timeout); -int udev_device_get_event_timeout(struct udev_device *udev_device); -int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout); -int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); -int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); -int udev_device_get_num_fake_partitions(struct udev_device *udev_device); -int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num); -int udev_device_get_devlink_priority(struct udev_device *udev_device); -int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); -int udev_device_get_ignore_remove(struct udev_device *udev_device); -int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore); -int udev_device_get_watch_handle(struct udev_device *udev_device); -int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); -void udev_device_set_info_loaded(struct udev_device *device); - -/* libudev-device-db-write.c */ -int udev_device_update_db(struct udev_device *udev_device); -int udev_device_delete_db(struct udev_device *udev_device); -int udev_device_rename_db(struct udev_device *udev_device, const char *devpath); - -/* libudev-monitor - netlink/unix socket communication */ -int udev_monitor_disconnect(struct udev_monitor *udev_monitor); -int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); -int udev_monitor_send_device(struct udev_monitor *udev_monitor, - struct udev_monitor *destination, struct udev_device *udev_device); -int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); - -/* libudev-ctrl - daemon runtime setup */ -struct udev_ctrl; -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); -struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); -void udev_ctrl_unref(struct udev_ctrl *uctrl); -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); -int udev_ctrl_get_fd(struct udev_ctrl *uctrl); -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority); -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl); -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl); -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl); -int udev_ctrl_send_settle(struct udev_ctrl *uctrl); -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key); -int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count); -struct udev_ctrl_msg; -struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl); -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl); -struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); -void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); -pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg); -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); - -/* libudev-list */ -struct udev_list_node { - struct udev_list_node *next, *prev; -}; -void udev_list_init(struct udev_list_node *list); -int udev_list_is_empty(struct udev_list_node *list); -void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list); -void udev_list_node_remove(struct udev_list_node *entry); -#define udev_list_node_foreach(node, list) \ - for (node = (list)->next; \ - node != list; \ - node = (node)->next) -#define udev_list_node_foreach_safe(node, tmp, list) \ - for (node = (list)->next, tmp = (node)->next; \ - node != list; \ - node = tmp, tmp = (tmp)->next) -struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, - const char *name, const char *value, - int unique, int sort); -void udev_list_entry_delete(struct udev_list_entry *entry); -void udev_list_entry_remove(struct udev_list_entry *entry); -void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry); -void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list); -void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list); -struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); -int udev_list_entry_get_flag(struct udev_list_entry *list_entry); -void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); -#define udev_list_entry_foreach_safe(entry, tmp, first) \ - for (entry = first, tmp = udev_list_entry_get_next(entry); \ - entry != NULL; \ - entry = tmp, tmp = udev_list_entry_get_next(tmp)) - -/* libudev-queue */ -unsigned long long int udev_get_kernel_seqnum(struct udev *udev); -int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum); -ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size); -ssize_t udev_queue_skip_devpath(FILE *queue_file); - -/* libudev-queue-export */ -struct udev_queue_export *udev_queue_export_new(struct udev *udev); -void udev_queue_export_unref(struct udev_queue_export *udev_queue_export); -void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); -int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); -int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); -int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); - -/* libudev-utils */ -#define UTIL_PATH_SIZE 1024 -#define UTIL_LINE_SIZE 2048 -#define UTIL_NAME_SIZE 512 -#define UDEV_ALLOWED_CHARS_INPUT "/ $%?," -ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); -ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); -int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); -int util_log_priority(const char *priority); -size_t util_path_encode(const char *src, char *dest, size_t size); -size_t util_path_decode(char *s); -void util_remove_trailing_chars(char *path, char c); -size_t util_strpcpy(char **dest, size_t size, const char *src); -size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__ ((sentinel)); -size_t util_strscpy(char *dest, size_t size, const char *src); -size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__ ((sentinel)); -int udev_util_replace_whitespace(const char *str, char *to, size_t len); -int udev_util_replace_chars(char *str, const char *white); -int udev_util_encode_string(const char *str, char *str_enc, size_t len); -void util_set_fd_cloexec(int fd); -unsigned int util_string_hash32(const char *str); -#endif diff --git a/udev/lib/libudev-queue-export.c b/udev/lib/libudev-queue-export.c deleted file mode 100644 index a36ff5150a..0000000000 --- a/udev/lib/libudev-queue-export.c +++ /dev/null @@ -1,473 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * Copyright (C) 2009 Alan Jenkins - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -/* - * DISCLAIMER - The file format mentioned here is private to udev/libudev, - * and may be changed without notice. - * - * - * The udev event queue is exported as a binary log file. - * Each log record consists of a sequence number followed by the device path. - * - * When a new event is queued, its details are appended to the log. - * When the event finishes, a second record is appended to the log - * with the same sequence number but a null devpath. - * - * Example: - * {1, "/devices/virtual/mem/null" }, - * {2, "/devices/virtual/mem/zero" }, - * {1, "" }, - * Event 2 is still queued, but event 1 has been finished - * - * The queue does not grow indefinitely. It is periodically re-created - * to remove finished events. Atomic rename() makes this transparent to readers. - * - * - * The queue file starts with a single sequence number which specifies the - * minimum sequence number in the log that follows. Any events prior to this - * sequence number have already finished. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); - -struct udev_queue_export { - struct udev *udev; - int failed_count; /* number of failed events exported */ - int queued_count; /* number of unfinished events exported in queue file */ - FILE *queue_file; - unsigned long long int seqnum_max; /* earliest sequence number in queue file */ - unsigned long long int seqnum_min; /* latest sequence number in queue file */ - int waste_bytes; /* queue file bytes wasted on finished events */ -}; - -struct udev_queue_export *udev_queue_export_new(struct udev *udev) -{ - struct udev_queue_export *udev_queue_export; - unsigned long long int initial_seqnum; - - if (udev == NULL) - return NULL; - - udev_queue_export = calloc(1, sizeof(struct udev_queue_export)); - if (udev_queue_export == NULL) - return NULL; - udev_queue_export->udev = udev; - - initial_seqnum = udev_get_kernel_seqnum(udev); - udev_queue_export->seqnum_min = initial_seqnum; - udev_queue_export->seqnum_max = initial_seqnum; - - udev_queue_export_cleanup(udev_queue_export); - if (rebuild_queue_file(udev_queue_export) != 0) { - free(udev_queue_export); - return NULL; - } - - return udev_queue_export; -} - -void udev_queue_export_unref(struct udev_queue_export *udev_queue_export) -{ - if (udev_queue_export == NULL) - return; - if (udev_queue_export->queue_file != NULL) - fclose(udev_queue_export->queue_file); - free(udev_queue_export); -} - -void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) -{ - char filename[UTIL_PATH_SIZE]; - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); - unlink(filename); - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); - unlink(filename); -} - - -static int skip_to(FILE *file, long offset) -{ - long old_offset; - - /* fseek may drop buffered data, avoid it for small seeks */ - old_offset = ftell(file); - if (offset > old_offset && offset - old_offset <= BUFSIZ) { - size_t skip_bytes = offset - old_offset; - char buf[skip_bytes]; - - if (fread(buf, skip_bytes, 1, file) != skip_bytes) - return -1; - } - - return fseek(file, offset, SEEK_SET); -} - -struct queue_devpaths { - unsigned int devpaths_first; /* index of first queued event */ - unsigned int devpaths_size; - long devpaths[]; /* seqnum -> offset of devpath in queue file (or 0) */ -}; - -/* - * Returns a table mapping seqnum to devpath file offset for currently queued events. - * devpaths[i] represents the event with seqnum = i + udev_queue_export->seqnum_min. - */ -static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_export) -{ - struct queue_devpaths *devpaths; - unsigned long long int range; - long devpath_offset; - ssize_t devpath_len; - unsigned long long int seqnum; - unsigned long long int n; - unsigned int i; - - /* seek to the first event in the file */ - rewind(udev_queue_export->queue_file); - udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum); - - /* allocate the table */ - range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max; - if (range - 1 > INT_MAX) { - err(udev_queue_export->udev, "queue file overflow\n"); - return NULL; - } - devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); - if (index == NULL) - return NULL; - devpaths->devpaths_size = range + 1; - - /* read all records and populate the table */ - while(1) { - if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) - break; - n = seqnum - udev_queue_export->seqnum_max; - if (n >= devpaths->devpaths_size) - goto read_error; - - devpath_offset = ftell(udev_queue_export->queue_file); - devpath_len = udev_queue_skip_devpath(udev_queue_export->queue_file); - if (devpath_len < 0) - goto read_error; - - if (devpath_len > 0) - devpaths->devpaths[n] = devpath_offset; - else - devpaths->devpaths[n] = 0; - } - - /* find first queued event */ - for (i = 0; i < devpaths->devpaths_size; i++) { - if (devpaths->devpaths[i] != 0) - break; - } - devpaths->devpaths_first = i; - - return devpaths; - -read_error: - err(udev_queue_export->udev, "queue file corrupted\n"); - free(devpaths); - return NULL; -} - -static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) -{ - unsigned long long int seqnum; - struct queue_devpaths *devpaths = NULL; - char filename[UTIL_PATH_SIZE]; - char filename_tmp[UTIL_PATH_SIZE]; - FILE *new_queue_file = NULL; - unsigned int i; - - /* read old queue file */ - if (udev_queue_export->queue_file != NULL) { - dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n", - udev_queue_export->waste_bytes); - - devpaths = build_index(udev_queue_export); - if (devpaths != NULL) - udev_queue_export->seqnum_max += devpaths->devpaths_first; - } - if (devpaths == NULL) { - dbg(udev_queue_export->udev, "creating empty queue file\n"); - udev_queue_export->queued_count = 0; - udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; - } - - /* create new queue file */ - util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); - new_queue_file = fopen(filename_tmp, "w+"); - if (new_queue_file == NULL) - goto error; - seqnum = udev_queue_export->seqnum_max; - fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); - - /* copy unfinished events only to the new file */ - if (devpaths != NULL) { - for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { - char devpath[UTIL_PATH_SIZE]; - int err; - unsigned short devpath_len; - - if (devpaths->devpaths[i] != 0) - { - skip_to(udev_queue_export->queue_file, devpaths->devpaths[i]); - err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); - devpath_len = err; - - fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); - fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); - fwrite(devpath, 1, devpath_len, new_queue_file); - } - seqnum++; - } - free(devpaths); - devpaths = NULL; - } - fflush(new_queue_file); - if (ferror(new_queue_file)) - goto error; - - /* rename the new file on top of the old one */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); - if (rename(filename_tmp, filename) != 0) - goto error; - - if (udev_queue_export->queue_file != NULL) - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = new_queue_file; - udev_queue_export->waste_bytes = 0; - - return 0; - -error: - err(udev_queue_export->udev, "failed to create queue file: %m\n"); - udev_queue_export_cleanup(udev_queue_export); - - if (udev_queue_export->queue_file != NULL) { - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - } - if (new_queue_file != NULL) - fclose(new_queue_file); - - if (devpaths != NULL) - free(devpaths); - udev_queue_export->queued_count = 0; - udev_queue_export->waste_bytes = 0; - udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; - - return -1; -} - -static int write_queue_record(struct udev_queue_export *udev_queue_export, - unsigned long long int seqnum, const char *devpath, size_t devpath_len) -{ - unsigned short len; - - if (udev_queue_export->queue_file == NULL) { - dbg(udev_queue_export->udev, "can't record event: queue file not available\n"); - return -1; - } - - if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1) - goto write_error; - - len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; - if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) - goto write_error; - if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) - goto write_error; - - /* *must* flush output; caller may fork */ - if (fflush(udev_queue_export->queue_file) != 0) - goto write_error; - - return 0; - -write_error: - /* if we failed half way through writing a record to a file, - we should not try to write any further records to it. */ - err(udev_queue_export->udev, "error writing to queue file: %m\n"); - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - - return -1; -} - - -enum device_state { - DEVICE_QUEUED, - DEVICE_FINISHED, - DEVICE_FAILED, -}; - -static inline size_t queue_record_size(size_t devpath_len) -{ - return sizeof(unsigned long long int) + sizeof(unsigned short int) + devpath_len; -} - -static int update_queue(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - unsigned long long int seqnum = udev_device_get_seqnum(udev_device); - const char *devpath = NULL; - size_t devpath_len = 0; - int bytes; - int err; - - if (state == DEVICE_QUEUED) { - devpath = udev_device_get_devpath(udev_device); - devpath_len = strlen(devpath); - } - - /* recover from an earlier failed rebuild */ - if (udev_queue_export->queue_file == NULL) { - if (rebuild_queue_file(udev_queue_export) != 0) - return -1; - } - - /* when the queue files grow too large, they must be garbage collected and rebuilt */ - bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); - - /* if we're removing the last event from the queue, that's the best time to rebuild it */ - if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1 && bytes > 2048) { - /* because we don't need to read the old queue file */ - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - rebuild_queue_file(udev_queue_export); - return 0; - } - - /* try to rebuild the queue files before they grow larger than one page. */ - if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) - rebuild_queue_file(udev_queue_export); - - /* don't record a finished event, if we already dropped the event in a failed rebuild */ - if (seqnum < udev_queue_export->seqnum_max) - return 0; - - /* now write to the queue */ - if (state == DEVICE_QUEUED) { - udev_queue_export->queued_count++; - udev_queue_export->seqnum_min = seqnum; - } else { - udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0); - udev_queue_export->queued_count--; - } - err = write_queue_record(udev_queue_export, seqnum, devpath, devpath_len); - - /* try to handle ENOSPC */ - if (err != 0 && udev_queue_export->queued_count == 0) { - udev_queue_export_cleanup(udev_queue_export); - err = rebuild_queue_file(udev_queue_export); - } - - return err; -} - -static void update_failed(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - char *s; - size_t l; - - if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) - return; - - /* location of failed file */ - s = filename; - l = util_strpcpyl(&s, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); - util_path_encode(udev_device_get_devpath(udev_device), s, l); - - switch (state) { - case DEVICE_FAILED: - /* record event in the failed directory */ - if (udev_queue_export->failed_count == 0) - util_create_path(udev, filename); - udev_queue_export->failed_count++; - - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); - symlink(udev_device_get_devpath(udev_device), filename); - udev_selinux_resetfscreatecon(udev); - break; - - case DEVICE_QUEUED: - /* delete failed file */ - if (unlink(filename) == 0) { - util_delete_path(udev, filename); - udev_queue_export->failed_count--; - } - break; - - case DEVICE_FINISHED: - if (udev_device_get_devpath_old(udev_device) != NULL) { - /* "move" event - rename failed file to current name, do not delete failed */ - char filename_old[UTIL_PATH_SIZE]; - - s = filename_old; - l = util_strpcpyl(&s, sizeof(filename_old), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); - util_path_encode(udev_device_get_devpath_old(udev_device), s, l); - - if (rename(filename_old, filename) == 0) - info(udev, "renamed devpath, moved failed state of '%s' to %s'\n", - udev_device_get_devpath_old(udev_device), udev_device_get_devpath(udev_device)); - } - break; - } - - return; -} - -static int update(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - update_failed(udev_queue_export, udev_device, state); - - if (update_queue(udev_queue_export, udev_device, state) != 0) - return -1; - - return 0; -} - -int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_QUEUED); -} - -int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_FINISHED); -} - -int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_FAILED); -} diff --git a/udev/lib/libudev-queue.c b/udev/lib/libudev-queue.c deleted file mode 100644 index cf1ddf3a07..0000000000 --- a/udev/lib/libudev-queue.c +++ /dev/null @@ -1,401 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * Copyright (C) 2009 Alan Jenkins - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -struct udev_queue { - struct udev *udev; - int refcount; - struct udev_list_node queue_list; - struct udev_list_node failed_list; -}; - -struct udev_queue *udev_queue_new(struct udev *udev) -{ - struct udev_queue *udev_queue; - - if (udev == NULL) - return NULL; - - udev_queue = calloc(1, sizeof(struct udev_queue)); - if (udev_queue == NULL) - return NULL; - udev_queue->refcount = 1; - udev_queue->udev = udev; - udev_list_init(&udev_queue->queue_list); - udev_list_init(&udev_queue->failed_list); - return udev_queue; -} - -struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) -{ - if (udev_queue == NULL) - return NULL; - udev_queue->refcount++; - return udev_queue; -} - -void udev_queue_unref(struct udev_queue *udev_queue) -{ - if (udev_queue == NULL) - return; - udev_queue->refcount--; - if (udev_queue->refcount > 0) - return; - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); - free(udev_queue); -} - -struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) -{ - if (udev_queue == NULL) - return NULL; - return udev_queue->udev; -} - -unsigned long long int udev_get_kernel_seqnum(struct udev *udev) -{ - char filename[UTIL_PATH_SIZE]; - unsigned long long int seqnum; - int fd; - char buf[32]; - ssize_t len; - - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); - fd = open(filename, O_RDONLY); - if (fd < 0) - return 0; - len = read(fd, buf, sizeof(buf)); - close(fd); - if (len <= 2) - return 0; - buf[len-1] = '\0'; - seqnum = strtoull(buf, NULL, 10); - return seqnum; -} - -unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum; - - if (udev_queue == NULL) - return -EINVAL; - - seqnum = udev_get_kernel_seqnum(udev_queue->udev); - dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); - return seqnum; -} - -int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum) -{ - if (fread(seqnum, sizeof(unsigned long long int), 1, queue_file) != 1) - return -1; - - return 0; -} - -ssize_t udev_queue_skip_devpath(FILE *queue_file) -{ - unsigned short int len; - - if (fread(&len, sizeof(unsigned short int), 1, queue_file) == 1) { - char devpath[len]; - - /* use fread to skip, fseek might drop buffered data */ - if (fread(devpath, 1, len, queue_file) == len) - return len; - } - - return -1; -} - -ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size) -{ - unsigned short int read_bytes = 0; - unsigned short int len; - - if (fread(&len, sizeof(unsigned short int), 1, queue_file) != 1) - return -1; - - read_bytes = (len < size - 1) ? len : size - 1; - if (fread(devpath, 1, read_bytes, queue_file) != read_bytes) - return -1; - devpath[read_bytes] = '\0'; - - /* if devpath was too long, skip unread characters */ - if (read_bytes != len) { - unsigned short int skip_bytes = len - read_bytes; - char buf[skip_bytes]; - - if (fread(buf, 1, skip_bytes, queue_file) != skip_bytes) - return -1; - } - - return read_bytes; -} - -static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long int *seqnum_start) -{ - char filename[UTIL_PATH_SIZE]; - FILE *queue_file; - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/queue.bin", NULL); - queue_file = fopen(filename, "r"); - if (queue_file == NULL) - return NULL; - - if (udev_queue_read_seqnum(queue_file, seqnum_start) < 0) { - err(udev_queue->udev, "corrupt queue file\n"); - fclose(queue_file); - return NULL; - } - - return queue_file; -} - - -unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum_udev; - FILE *queue_file; - - queue_file = open_queue_file(udev_queue, &seqnum_udev); - if (queue_file == NULL) - return 0; - - while (1) { - unsigned long long int seqnum; - ssize_t devpath_len; - - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - devpath_len = udev_queue_skip_devpath(queue_file); - if (devpath_len < 0) - break; - if (devpath_len > 0) - seqnum_udev = seqnum; - } - - fclose(queue_file); - return seqnum_udev; -} - -int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum_start; - FILE *queue_file; - - queue_file = open_queue_file(udev_queue, &seqnum_start); - if (queue_file == NULL) - return 0; - - fclose(queue_file); - return 1; -} - -int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum_kernel; - unsigned long long int seqnum_udev = 0; - int queued = 0; - int is_empty = 0; - FILE *queue_file; - - if (udev_queue == NULL) - return -EINVAL; - queue_file = open_queue_file(udev_queue, &seqnum_udev); - if (queue_file == NULL) - return 1; - - while (1) { - unsigned long long int seqnum; - ssize_t devpath_len; - - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - devpath_len = udev_queue_skip_devpath(queue_file); - if (devpath_len < 0) - break; - - if (devpath_len > 0) { - queued++; - seqnum_udev = seqnum; - } else { - queued--; - } - } - - if (queued > 0) { - dbg(udev_queue->udev, "queue is not empty\n"); - goto out; - } - - seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); - if (seqnum_udev < seqnum_kernel) { - dbg(udev_queue->udev, "queue is empty but kernel events still pending [%llu]<->[%llu]\n", - seqnum_kernel, seqnum_udev); - goto out; - } - - dbg(udev_queue->udev, "queue is empty\n"); - is_empty = 1; - -out: - fclose(queue_file); - return is_empty; -} - -int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, - unsigned long long int start, unsigned long long int end) -{ - unsigned long long int seqnum = 0; - ssize_t devpath_len; - int unfinished; - FILE *queue_file; - - if (udev_queue == NULL) - return -EINVAL; - queue_file = open_queue_file(udev_queue, &seqnum); - if (queue_file == NULL) - return 1; - if (start < seqnum) - start = seqnum; - if (start > end) - return 1; - if (end - start > INT_MAX - 1) - return -EOVERFLOW; - unfinished = (end - start) + 1; - - while (unfinished > 0) { - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - devpath_len = udev_queue_skip_devpath(queue_file); - if (devpath_len < 0) - break; - - if (devpath_len == 0) { - if (seqnum >= start && seqnum <= end) - unfinished--; - } - } - fclose(queue_file); - - return (unfinished == 0); -} - -int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) -{ - if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) - return 0; - - dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum); - return 1; -} - -struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum; - FILE *queue_file; - - if (udev_queue == NULL) - return NULL; - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); - - queue_file = open_queue_file(udev_queue, &seqnum); - if (queue_file == NULL) - return NULL; - - while (1) { - char syspath[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - char seqnum_str[32]; - struct udev_list_entry *list_entry; - - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - snprintf(seqnum_str, sizeof(seqnum_str), "%llu", seqnum); - - s = syspath; - l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); - len = udev_queue_read_devpath(queue_file, s, l); - if (len < 0) - break; - - if (len > 0) { - udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, seqnum_str, 0, 0); - } else { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { - if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { - udev_list_entry_delete(list_entry); - break; - } - } - } - } - fclose(queue_file); - - return udev_list_get_entry(&udev_queue->queue_list); -} - -struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) -{ - char path[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - if (udev_queue == NULL) - return NULL; - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); - util_strscpyl(path, sizeof(path), udev_get_dev_path(udev_queue->udev), "/.udev/failed", NULL); - dir = opendir(path); - if (dir == NULL) - return NULL; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char filename[UTIL_PATH_SIZE]; - char syspath[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - struct stat statbuf; - - if (dent->d_name[0] == '.') - continue; - s = syspath; - l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); - len = readlinkat(dirfd(dir), dent->d_name, s, l); - if (len < 0 || (size_t)len >= l) - continue; - s[len] = '\0'; - dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); - util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); - if (stat(filename, &statbuf) != 0) - continue; - udev_list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0, 0); - } - closedir(dir); - return udev_list_get_entry(&udev_queue->failed_list); -} diff --git a/udev/lib/libudev-util.c b/udev/lib/libudev-util.c deleted file mode 100644 index dcc4a0fd16..0000000000 --- a/udev/lib/libudev-util.c +++ /dev/null @@ -1,502 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2009 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) -{ - char path[UTIL_PATH_SIZE]; - ssize_t len; - const char *pos; - - util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL); - len = readlink(path, path, sizeof(path)); - if (len < 0 || len >= (ssize_t) sizeof(path)) - return -1; - path[len] = '\0'; - pos = strrchr(path, '/'); - if (pos == NULL) - return -1; - pos = &pos[1]; - dbg(udev, "resolved link to: '%s'\n", pos); - return util_strscpy(value, size, pos); -} - -ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size) -{ - return get_sys_link(udev, "subsystem", syspath, subsystem, size); -} - -ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size) -{ - return get_sys_link(udev, "driver", syspath, driver, size); -} - -int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) -{ - char link_target[UTIL_PATH_SIZE]; - - int len; - int i; - int back; - char *base; - - len = readlink(syspath, link_target, sizeof(link_target)); - if (len <= 0) - return -1; - link_target[len] = '\0'; - dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target); - - for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) - ; - dbg(udev, "base '%s', tail '%s', back %i\n", syspath, &link_target[back * 3], back); - for (i = 0; i <= back; i++) { - base = strrchr(syspath, '/'); - if (base == NULL) - return -1; - base[0] = '\0'; - } - dbg(udev, "after moving back '%s'\n", syspath); - util_strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL); - return 0; -} - -int util_log_priority(const char *priority) -{ - char *endptr; - int prio; - - prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0') - return prio; - if (strncmp(priority, "err", 3) == 0) - return LOG_ERR; - if (strcmp(priority, "info") == 0) - return LOG_INFO; - if (strcmp(priority, "debug") == 0) - return LOG_DEBUG; - return 0; -} - -size_t util_path_encode(const char *src, char *dest, size_t size) -{ - size_t i, j; - - for (i = 0, j = 0; src[i] != '\0'; i++) { - if (src[i] == '/') { - if (j+4 >= size) { - j = 0; - break; - } - memcpy(&dest[j], "\\x2f", 4); - j += 4; - } else if (src[i] == '\\') { - if (j+4 >= size) { - j = 0; - break; - } - memcpy(&dest[j], "\\x5c", 4); - j += 4; - } else { - if (j+1 >= size) { - j = 0; - break; - } - dest[j] = src[i]; - j++; - } - } - dest[j] = '\0'; - return j; -} - -size_t util_path_decode(char *s) -{ - size_t i, j; - - for (i = 0, j = 0; s[i] != '\0'; j++) { - if (memcmp(&s[i], "\\x2f", 4) == 0) { - s[j] = '/'; - i += 4; - } else if (memcmp(&s[i], "\\x5c", 4) == 0) { - s[j] = '\\'; - i += 4; - } else { - s[j] = s[i]; - i++; - } - } - s[j] = '\0'; - return j; -} - -void util_remove_trailing_chars(char *path, char c) -{ - size_t len; - - if (path == NULL) - return; - len = strlen(path); - while (len > 0 && path[len-1] == c) - path[--len] = '\0'; -} - -/* - * Concatenates strings. In any case, terminates in _all_ cases with '\0' - * and moves the @dest pointer forward to the added '\0'. Returns the - * remaining size, and 0 if the string was truncated. - */ -size_t util_strpcpy(char **dest, size_t size, const char *src) -{ - size_t len; - - len = strlen(src); - if (len >= size) { - if (size > 1) - *dest = mempcpy(*dest, src, size-1); - size = 0; - *dest[0] = '\0'; - } else { - if (len > 0) { - *dest = mempcpy(*dest, src, len); - size -= len; - } - *dest[0] = '\0'; - } - return size; -} - -/* concatenates list of strings, moves dest forward */ -size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) -{ - va_list va; - - va_start(va, src); - do { - size = util_strpcpy(dest, size, src); - src = va_arg(va, char *); - } while (src != NULL); - va_end(va); - - return size; -} - -/* copies string */ -size_t util_strscpy(char *dest, size_t size, const char *src) -{ - char *s; - - s = dest; - return util_strpcpy(&s, size, src); -} - -/* concatenates list of strings */ -size_t util_strscpyl(char *dest, size_t size, const char *src, ...) -{ - va_list va; - char *s; - - va_start(va, src); - s = dest; - do { - size = util_strpcpy(&s, size, src); - src = va_arg(va, char *); - } while (src != NULL); - va_end(va); - - return size; -} - -/* count of characters used to encode one unicode char */ -static int utf8_encoded_expected_len(const char *str) -{ - unsigned char c = (unsigned char)str[0]; - - if (c < 0x80) - return 1; - if ((c & 0xe0) == 0xc0) - return 2; - if ((c & 0xf0) == 0xe0) - return 3; - if ((c & 0xf8) == 0xf0) - return 4; - if ((c & 0xfc) == 0xf8) - return 5; - if ((c & 0xfe) == 0xfc) - return 6; - return 0; -} - -/* decode one unicode char */ -static int utf8_encoded_to_unichar(const char *str) -{ - int unichar; - int len; - int i; - - len = utf8_encoded_expected_len(str); - switch (len) { - case 1: - return (int)str[0]; - case 2: - unichar = str[0] & 0x1f; - break; - case 3: - unichar = (int)str[0] & 0x0f; - break; - case 4: - unichar = (int)str[0] & 0x07; - break; - case 5: - unichar = (int)str[0] & 0x03; - break; - case 6: - unichar = (int)str[0] & 0x01; - break; - default: - return -1; - } - - for (i = 1; i < len; i++) { - if (((int)str[i] & 0xc0) != 0x80) - return -1; - unichar <<= 6; - unichar |= (int)str[i] & 0x3f; - } - - return unichar; -} - -/* expected size used to encode one unicode char */ -static int utf8_unichar_to_encoded_len(int unichar) -{ - if (unichar < 0x80) - return 1; - if (unichar < 0x800) - return 2; - if (unichar < 0x10000) - return 3; - if (unichar < 0x200000) - return 4; - if (unichar < 0x4000000) - return 5; - return 6; -} - -/* check if unicode char has a valid numeric range */ -static int utf8_unichar_valid_range(int unichar) -{ - if (unichar > 0x10ffff) - return 0; - if ((unichar & 0xfffff800) == 0xd800) - return 0; - if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) - return 0; - if ((unichar & 0xffff) == 0xffff) - return 0; - return 1; -} - -/* validate one encoded unicode char and return its length */ -static int utf8_encoded_valid_unichar(const char *str) -{ - int len; - int unichar; - int i; - - len = utf8_encoded_expected_len(str); - if (len == 0) - return -1; - - /* ascii is valid */ - if (len == 1) - return 1; - - /* check if expected encoded chars are available */ - for (i = 0; i < len; i++) - if ((str[i] & 0x80) != 0x80) - return -1; - - unichar = utf8_encoded_to_unichar(str); - - /* check if encoded length matches encoded value */ - if (utf8_unichar_to_encoded_len(unichar) != len) - return -1; - - /* check if value has valid range */ - if (!utf8_unichar_valid_range(unichar)) - return -1; - - return len; -} - -int udev_util_replace_whitespace(const char *str, char *to, size_t len) -{ - size_t i, j; - - /* strip trailing whitespace */ - len = strnlen(str, len); - while (len && isspace(str[len-1])) - len--; - - /* strip leading whitespace */ - i = 0; - while (isspace(str[i]) && (i < len)) - i++; - - j = 0; - while (i < len) { - /* substitute multiple whitespace with a single '_' */ - if (isspace(str[i])) { - while (isspace(str[i])) - i++; - to[j++] = '_'; - } - to[j++] = str[i++]; - } - to[j] = '\0'; - return 0; -} - -static int is_whitelisted(char c, const char *white) -{ - if ((c >= '0' && c <= '9') || - (c >= 'A' && c <= 'Z') || - (c >= 'a' && c <= 'z') || - strchr("#+-.:=@_", c) != NULL || - (white != NULL && strchr(white, c) != NULL)) - return 1; - return 0; -} - -/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ -int udev_util_replace_chars(char *str, const char *white) -{ - size_t i = 0; - int replaced = 0; - - while (str[i] != '\0') { - int len; - - if (is_whitelisted(str[i], white)) { - i++; - continue; - } - - /* accept hex encoding */ - if (str[i] == '\\' && str[i+1] == 'x') { - i += 2; - continue; - } - - /* accept valid utf8 */ - len = utf8_encoded_valid_unichar(&str[i]); - if (len > 1) { - i += len; - continue; - } - - /* if space is allowed, replace whitespace with ordinary space */ - if (isspace(str[i]) && white != NULL && strchr(white, ' ') != NULL) { - str[i] = ' '; - i++; - replaced++; - continue; - } - - /* everything else is replaced with '_' */ - str[i] = '_'; - i++; - replaced++; - } - return replaced; -} - -/** - * util_encode_string: - * @str: input string to be encoded - * @str_enc: output string to store the encoded input string - * @len: maximum size of the output string, which may be - * four times as long as the input string - * - * Encode all potentially unsafe characters of a string to the - * corresponding hex value prefixed by '\x'. - * - * Returns: 0 if the entire string was copied, non-zero otherwise. - **/ -int udev_util_encode_string(const char *str, char *str_enc, size_t len) -{ - size_t i, j; - - if (str == NULL || str_enc == NULL || len == 0) - return -1; - - str_enc[0] = '\0'; - for (i = 0, j = 0; str[i] != '\0'; i++) { - int seqlen; - - seqlen = utf8_encoded_valid_unichar(&str[i]); - if (seqlen > 1) { - memcpy(&str_enc[j], &str[i], seqlen); - j += seqlen; - i += (seqlen-1); - } else if (str[i] == '\\' || !is_whitelisted(str[i], NULL)) { - sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); - j += 4; - } else { - str_enc[j] = str[i]; - j++; - } - if (j+3 >= len) - goto err; - } - str_enc[j] = '\0'; - return 0; -err: - return -1; -} - -void util_set_fd_cloexec(int fd) -{ - int flags; - - flags = fcntl(fd, F_GETFD); - if (flags < 0) - flags = FD_CLOEXEC; - else - flags |= FD_CLOEXEC; - fcntl(fd, F_SETFD, flags); -} - -unsigned int util_string_hash32(const char *str) -{ - unsigned int hash = 0; - - while (str[0] != '\0') { - hash += str[0] << 4; - hash += str[0] >> 4; - hash *= 11; - str++; - } - return hash; -} diff --git a/udev/lib/libudev.c b/udev/lib/libudev.c deleted file mode 100644 index a9baa70799..0000000000 --- a/udev/lib/libudev.c +++ /dev/null @@ -1,374 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -struct udev { - int refcount; - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args); - void *userdata; - char *sys_path; - char *dev_path; - char *rules_path; - struct udev_list_node properties_list; - int log_priority; - int run; -}; - -void udev_log(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, ...) -{ - va_list args; - - if (priority > udev->log_priority) - return; - - va_start(args, format); - udev->log_fn(udev, priority, file, line, fn, format, args); - va_end(args); -} - -static void log_stderr(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args) -{ - fprintf(stderr, "libudev: %s: ", fn); - vfprintf(stderr, format, args); -} - -void *udev_get_userdata(struct udev *udev) -{ - if (udev == NULL) - return NULL; - return udev->userdata; -} - -void udev_set_userdata(struct udev *udev, void *userdata) -{ - if (udev == NULL) - return; - udev->userdata = userdata; -} - -/** - * udev_new: - * - * Create udev library context. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev library context. - * - * Returns: a new udev library context - **/ -struct udev *udev_new(void) -{ - struct udev *udev; - const char *env; - char *config_file; - FILE *f; - - udev = calloc(1, sizeof(struct udev)); - if (udev == NULL) - return NULL; - udev->refcount = 1; - udev->log_fn = log_stderr; - udev->log_priority = LOG_ERR; - udev_list_init(&udev->properties_list); - udev->run = 1; - udev->dev_path = strdup(UDEV_PREFIX "/dev"); - udev->sys_path = strdup("/sys"); - config_file = strdup(SYSCONFDIR "/udev/udev.conf"); - if (udev->dev_path == NULL || - udev->sys_path == NULL || - config_file == NULL) - goto err; - - /* settings by environment and config file */ - env = getenv("SYSFS_PATH"); - if (env != NULL) { - free(udev->sys_path); - udev->sys_path = strdup(env); - util_remove_trailing_chars(udev->sys_path, '/'); - udev_add_property(udev, "SYSFS_PATH", udev->sys_path); - } - - env = getenv("UDEV_RUN"); - if (env != NULL && strcmp(env, "0") == 0) - udev->run = 0; - - env = getenv("UDEV_CONFIG_FILE"); - if (env != NULL) { - free(config_file); - config_file = strdup(env); - util_remove_trailing_chars(config_file, '/'); - } - if (config_file == NULL) - goto err; - f = fopen(config_file, "r"); - if (f != NULL) { - char line[UTIL_LINE_SIZE]; - int line_nr = 0; - - while (fgets(line, sizeof(line), f)) { - size_t len; - char *key; - char *val; - - line_nr++; - - /* find key */ - key = line; - while (isspace(key[0])) - key++; - - /* comment or empty line */ - if (key[0] == '#' || key[0] == '\0') - continue; - - /* split key/value */ - val = strchr(key, '='); - if (val == NULL) { - err(udev, "missing = in '%s'[%i], skip line\n", config_file, line_nr); - continue; - } - val[0] = '\0'; - val++; - - /* find value */ - while (isspace(val[0])) - val++; - - /* terminate key */ - len = strlen(key); - if (len == 0) - continue; - while (isspace(key[len-1])) - len--; - key[len] = '\0'; - - /* terminate value */ - len = strlen(val); - if (len == 0) - continue; - while (isspace(val[len-1])) - len--; - val[len] = '\0'; - - if (len == 0) - continue; - - /* unquote */ - if (val[0] == '"' || val[0] == '\'') { - if (val[len-1] != val[0]) { - err(udev, "inconsistent quoting in '%s'[%i], skip line\n", config_file, line_nr); - continue; - } - val[len-1] = '\0'; - val++; - } - - if (strcmp(key, "udev_log") == 0) { - udev_set_log_priority(udev, util_log_priority(val)); - continue; - } - if (strcmp(key, "udev_root") == 0) { - free(udev->dev_path); - udev->dev_path = strdup(val); - util_remove_trailing_chars(udev->dev_path, '/'); - continue; - } - if (strcmp(key, "udev_rules") == 0) { - free(udev->rules_path); - udev->rules_path = strdup(val); - util_remove_trailing_chars(udev->rules_path, '/'); - continue; - } - } - fclose(f); - } - - env = getenv("UDEV_ROOT"); - if (env != NULL) { - free(udev->dev_path); - udev->dev_path = strdup(env); - util_remove_trailing_chars(udev->dev_path, '/'); - udev_add_property(udev, "UDEV_ROOT", udev->dev_path); - } - - env = getenv("UDEV_LOG"); - if (env != NULL) - udev_set_log_priority(udev, util_log_priority(env)); - - if (udev->dev_path == NULL || udev->sys_path == NULL) - goto err; - dbg(udev, "context %p created\n", udev); - dbg(udev, "log_priority=%d\n", udev->log_priority); - dbg(udev, "config_file='%s'\n", config_file); - dbg(udev, "dev_path='%s'\n", udev->dev_path); - dbg(udev, "sys_path='%s'\n", udev->sys_path); - if (udev->rules_path != NULL) - dbg(udev, "rules_path='%s'\n", udev->rules_path); - free(config_file); - return udev; -err: - free(config_file); - err(udev, "context creation failed\n"); - udev_unref(udev); - return NULL; -} - -/** - * udev_ref: - * @udev: udev library context - * - * Take a reference of the udev library context. - * - * Returns: the passed udev library context - **/ -struct udev *udev_ref(struct udev *udev) -{ - if (udev == NULL) - return NULL; - udev->refcount++; - return udev; -} - -/** - * udev_unref: - * @udev: udev library context - * - * Drop a reference of the udev library context. If the refcount - * reaches zero, the resources of the context will be released. - * - **/ -void udev_unref(struct udev *udev) -{ - if (udev == NULL) - return; - udev->refcount--; - if (udev->refcount > 0) - return; - udev_list_cleanup_entries(udev, &udev->properties_list); - free(udev->dev_path); - free(udev->sys_path); - free(udev->rules_path); - dbg(udev, "context %p released\n", udev); - free(udev); -} - -/** - * udev_set_log_fn: - * @udev: udev library context - * @log_fn: function to be called for logging messages - * - * The built-in logging writes to stderr. It can be - * overridden by a custom function, to plug log messages - * into the users' logging functionality. - * - **/ -void udev_set_log_fn(struct udev *udev, - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args)) -{ - udev->log_fn = log_fn; - info(udev, "custom logging function %p registered\n", udev); -} - -int udev_get_log_priority(struct udev *udev) -{ - return udev->log_priority; -} - -void udev_set_log_priority(struct udev *udev, int priority) -{ - char num[32]; - - udev->log_priority = priority; - snprintf(num, sizeof(num), "%u", udev->log_priority); - udev_add_property(udev, "UDEV_LOG", num); -} - -const char *udev_get_rules_path(struct udev *udev) -{ - return udev->rules_path; -} - -int udev_get_run(struct udev *udev) -{ - return udev->run; -} - -/** - * udev_get_sys_path: - * @udev: udev library context - * - * Retrieve the sysfs mount point. The default is "/sys". For - * testing purposes, it can be overridden with the environment - * variable SYSFS_PATH. - * - * Returns: the sys mount point - **/ -const char *udev_get_sys_path(struct udev *udev) -{ - if (udev == NULL) - return NULL; - return udev->sys_path; -} - -/** - * udev_get_dev_path: - * @udev: udev library context - * - * Retrieve the device directory path. The default value is "/dev", - * the actual value may be overridden in the udev configuration - * file. - * - * Returns: the device directory path - **/ -const char *udev_get_dev_path(struct udev *udev) -{ - if (udev == NULL) - return NULL; - return udev->dev_path; -} - -struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) -{ - if (value == NULL) { - struct udev_list_entry *list_entry; - - list_entry = udev_get_properties_list_entry(udev); - list_entry = udev_list_entry_get_by_name(list_entry, key); - if (list_entry != NULL) - udev_list_entry_delete(list_entry); - return NULL; - } - return udev_list_entry_add(udev, &udev->properties_list, key, value, 1, 0); -} - -struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) -{ - return udev_list_get_entry(&udev->properties_list); -} diff --git a/udev/lib/libudev.h b/udev/lib/libudev.h deleted file mode 100644 index 241091c37d..0000000000 --- a/udev/lib/libudev.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2009 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#ifndef _LIBUDEV_H_ -#define _LIBUDEV_H_ - -#include -#include -#include - -/* this will stay as long as the DeviceKit integration of udev is work in progress */ -#if !defined _LIBUDEV_COMPILATION && !defined LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE -#error "#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE is needed to use this experimental library version" -#endif - -/* - * udev - library context - * - * reads the udev config and system environment - * allows custom logging - */ -struct udev; -struct udev *udev_ref(struct udev *udev); -void udev_unref(struct udev *udev); -struct udev *udev_new(void); -void udev_set_log_fn(struct udev *udev, - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args)); -int udev_get_log_priority(struct udev *udev); -void udev_set_log_priority(struct udev *udev, int priority); -const char *udev_get_sys_path(struct udev *udev); -const char *udev_get_dev_path(struct udev *udev); -void *udev_get_userdata(struct udev *udev); -void udev_set_userdata(struct udev *udev, void *userdata); - -/* - * udev_list - * - * access to libudev generated lists - */ -struct udev_list_entry; -struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); -struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); -const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); -const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); -#define udev_list_entry_foreach(entry, first) \ - for (entry = first; \ - entry != NULL; \ - entry = udev_list_entry_get_next(entry)) - -/* - * udev_device - * - * access to sysfs/kernel devices - */ -struct udev_device; -struct udev_device *udev_device_ref(struct udev_device *udev_device); -void udev_device_unref(struct udev_device *udev_device); -struct udev *udev_device_get_udev(struct udev_device *udev_device); -struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); -struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); -struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); -/* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */ -struct udev_device *udev_device_get_parent(struct udev_device *udev_device); -struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, - const char *subsystem, const char *devtype); -/* retrieve device properties */ -const char *udev_device_get_devpath(struct udev_device *udev_device); -const char *udev_device_get_subsystem(struct udev_device *udev_device); -const char *udev_device_get_devtype(struct udev_device *udev_device); -const char *udev_device_get_syspath(struct udev_device *udev_device); -const char *udev_device_get_sysname(struct udev_device *udev_device); -const char *udev_device_get_sysnum(struct udev_device *udev_device); -const char *udev_device_get_devnode(struct udev_device *udev_device); -struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); -struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); -const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key); -const char *udev_device_get_driver(struct udev_device *udev_device); -dev_t udev_device_get_devnum(struct udev_device *udev_device); -const char *udev_device_get_action(struct udev_device *udev_device); -unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); -const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); - -/* - * udev_monitor - * - * access to kernel uevents and udev events - */ -struct udev_monitor; -struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); -void udev_monitor_unref(struct udev_monitor *udev_monitor); -struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); -/* kernel and udev generated events over netlink */ -struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); -/* custom socket (use netlink and filters instead) */ -struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); -/* bind socket */ -int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); -int udev_monitor_get_fd(struct udev_monitor *udev_monitor); -struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); -/* in-kernel socket filters to select messages that get delivered to a listener */ -int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, - const char *subsystem, const char *devtype); -int udev_monitor_filter_update(struct udev_monitor *udev_monitor); -int udev_monitor_filter_remove(struct udev_monitor *udev_monitor); - -/* - * udev_enumerate - * - * search sysfs for specific devices and provide a sorted list - */ -struct udev_enumerate; -struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); -void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); -struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); -struct udev_enumerate *udev_enumerate_new(struct udev *udev); -/* device properties filter */ -int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); -int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); -int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); -int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); -int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); -int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); -/* run enumeration with active filters */ -int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); -int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); -/* return device list */ -struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); - -/* - * udev_queue - * - * access to the currently running udev events - */ -struct udev_queue; -struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue); -void udev_queue_unref(struct udev_queue *udev_queue); -struct udev *udev_queue_get_udev(struct udev_queue *udev_queue); -struct udev_queue *udev_queue_new(struct udev *udev); -unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue); -unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue); -int udev_queue_get_udev_is_active(struct udev_queue *udev_queue); -int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); -int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum); -int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, - unsigned long long int start, unsigned long long int end); -struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); -struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); -#endif diff --git a/udev/lib/libudev.pc.in b/udev/lib/libudev.pc.in deleted file mode 100644 index 38fc052e34..0000000000 --- a/udev/lib/libudev.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@prefix@ -libdir=@prefix@/@libdir_name@ -includedir=@prefix@/include - -Name: libudev -Description: Library to access udev device information -Version: @VERSION@ -Libs: -L${libdir} -ludev -Libs.private: -Cflags: -I${includedir} diff --git a/udev/lib/test-libudev.c b/udev/lib/test-libudev.c deleted file mode 100644 index db08d4845f..0000000000 --- a/udev/lib/test-libudev.c +++ /dev/null @@ -1,458 +0,0 @@ -/* - * test-libudev - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" - -static void log_fn(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args) -{ - printf("test-libudev: %s %s:%d ", fn, file, line); - vprintf(format, args); -} - -static void print_device(struct udev_device *device) -{ - const char *str; - dev_t devnum; - int count; - struct udev_list_entry *list_entry; - - printf("*** device: %p ***\n", device); - str = udev_device_get_action(device); - if (str != NULL) - printf("action: '%s'\n", str); - - str = udev_device_get_syspath(device); - printf("syspath: '%s'\n", str); - - str = udev_device_get_sysname(device); - printf("sysname: '%s'\n", str); - - str = udev_device_get_sysnum(device); - if (str != NULL) - printf("sysnum: '%s'\n", str); - - str = udev_device_get_devpath(device); - printf("devpath: '%s'\n", str); - - str = udev_device_get_subsystem(device); - if (str != NULL) - printf("subsystem: '%s'\n", str); - - str = udev_device_get_devtype(device); - if (str != NULL) - printf("devtype: '%s'\n", str); - - str = udev_device_get_driver(device); - if (str != NULL) - printf("driver: '%s'\n", str); - - str = udev_device_get_devnode(device); - if (str != NULL) - printf("devname: '%s'\n", str); - - devnum = udev_device_get_devnum(device); - if (major(devnum) > 0) - printf("devnum: %u:%u\n", major(devnum), minor(devnum)); - - count = 0; - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { - printf("link: '%s'\n", udev_list_entry_get_name(list_entry)); - count++; - } - if (count > 0) - printf("found %i links\n", count); - - count = 0; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) { - printf("property: '%s=%s'\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - count++; - } - if (count > 0) - printf("found %i properties\n", count); - - str = udev_device_get_property_value(device, "MAJOR"); - if (str != NULL) - printf("MAJOR: '%s'\n", str); - - str = udev_device_get_sysattr_value(device, "dev"); - if (str != NULL) - printf("attr{dev}: '%s'\n", str); - - printf("\n"); -} - -static int test_device(struct udev *udev, const char *syspath) -{ - struct udev_device *device; - - printf("looking at device: %s\n", syspath); - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) { - printf("no device found\n"); - return -1; - } - print_device(device); - udev_device_unref(device); - return 0; -} - -static int test_device_parents(struct udev *udev, const char *syspath) -{ - struct udev_device *device; - struct udev_device *device_parent; - - printf("looking at device: %s\n", syspath); - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) - return -1; - - printf("looking at parents\n"); - device_parent = device; - do { - print_device(device_parent); - device_parent = udev_device_get_parent(device_parent); - } while (device_parent != NULL); - - printf("looking at parents again\n"); - device_parent = device; - do { - print_device(device_parent); - device_parent = udev_device_get_parent(device_parent); - } while (device_parent != NULL); - udev_device_unref(device); - - return 0; -} - -static int test_device_devnum(struct udev *udev) -{ - dev_t devnum = makedev(1, 3); - struct udev_device *device; - - printf("looking up device: %u:%u\n", major(devnum), minor(devnum)); - device = udev_device_new_from_devnum(udev, 'c', devnum); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - return 0; -} - -static int test_device_subsys_name(struct udev *udev) -{ - struct udev_device *device; - - printf("looking up device: 'block':'sda'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "block", "sda"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - - printf("looking up device: 'subsystem':'pci'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "subsystem", "pci"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - - printf("looking up device: 'drivers':'scsi:sd'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "drivers", "scsi:sd"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - - printf("looking up device: 'module':'printk'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "module", "printk"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - return 0; -} - -static int test_enumerate_print_list(struct udev_enumerate *enumerate) -{ - struct udev_list_entry *list_entry; - int count = 0; - - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), - udev_list_entry_get_name(list_entry)); - if (device != NULL) { - printf("device: '%s' (%s)\n", - udev_device_get_syspath(device), - udev_device_get_subsystem(device)); - udev_device_unref(device); - count++; - } - } - printf("found %i devices\n\n", count); - return count; -} - -static int test_monitor(struct udev *udev) -{ - struct udev_monitor *udev_monitor; - fd_set readfds; - int fd; - - udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); - if (udev_monitor == NULL) { - printf("no socket\n"); - return -1; - } - if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "block", NULL) < 0 || - udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL) < 0 || - udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device") < 0) { - printf("filter failed\n"); - return -1; - } - if (udev_monitor_enable_receiving(udev_monitor) < 0) { - printf("bind failed\n"); - return -1; - } - - fd = udev_monitor_get_fd(udev_monitor); - FD_ZERO(&readfds); - - while (1) { - struct udev_device *device; - int fdcount; - - FD_SET(STDIN_FILENO, &readfds); - FD_SET(fd, &readfds); - - printf("waiting for events from udev, press ENTER to exit\n"); - fdcount = select(fd+1, &readfds, NULL, NULL, NULL); - printf("select fd count: %i\n", fdcount); - - if (FD_ISSET(fd, &readfds)) { - device = udev_monitor_receive_device(udev_monitor); - if (device == NULL) { - printf("no device from socket\n"); - continue; - } - print_device(device); - udev_device_unref(device); - } - - if (FD_ISSET(STDIN_FILENO, &readfds)) { - printf("exiting loop\n"); - break; - } - } - - udev_monitor_unref(udev_monitor); - return 0; -} - -static int test_queue(struct udev *udev) -{ - struct udev_queue *udev_queue; - unsigned long long int seqnum; - struct udev_list_entry *list_entry; - - udev_queue = udev_queue_new(udev); - if (udev_queue == NULL) - return -1; - seqnum = udev_queue_get_kernel_seqnum(udev_queue); - printf("seqnum kernel: %llu\n", seqnum); - seqnum = udev_queue_get_udev_seqnum(udev_queue); - printf("seqnum udev : %llu\n", seqnum); - - if (udev_queue_get_queue_is_empty(udev_queue)) - printf("queue is empty\n"); - printf("get queue list\n"); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - printf("\n"); - printf("get queue list again\n"); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - printf("\n"); - printf("get failed list\n"); - udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) - printf("failed: '%s'\n", udev_list_entry_get_name(list_entry)); - printf("\n"); - - list_entry = udev_queue_get_queued_list_entry(udev_queue); - if (list_entry != NULL) { - printf("event [%llu] is queued\n", seqnum); - seqnum = strtoull(udev_list_entry_get_value(list_entry), NULL, 10); - if (udev_queue_get_seqnum_is_finished(udev_queue, seqnum)) - printf("event [%llu] is not finished\n", seqnum); - else - printf("event [%llu] is finished\n", seqnum); - } - printf("\n"); - udev_queue_unref(udev_queue); - return 0; -} - -static int test_enumerate(struct udev *udev, const char *subsystem) -{ - struct udev_enumerate *udev_enumerate; - - printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'block'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate,"block"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'not block'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'pci, mem, vc'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, "pci"); - udev_enumerate_add_match_subsystem(udev_enumerate, "mem"); - udev_enumerate_add_match_subsystem(udev_enumerate, "vc"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'subsystem'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_subsystems(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'property IF_FS_*=filesystem'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_property(udev_enumerate, "ID_FS*", "filesystem"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - return 0; -} - -int main(int argc, char *argv[]) -{ - struct udev *udev = NULL; - static const struct option options[] = { - { "syspath", required_argument, NULL, 'p' }, - { "subsystem", required_argument, NULL, 's' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - {} - }; - const char *syspath = "/devices/virtual/mem/null"; - const char *subsystem = NULL; - char path[1024]; - const char *str; - - udev = udev_new(); - printf("context: %p\n", udev); - if (udev == NULL) { - printf("no context\n"); - return 1; - } - udev_set_log_fn(udev, log_fn); - printf("set log: %p\n", log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "+dhV", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'p': - syspath = optarg; - break; - case 's': - subsystem = optarg; - break; - case 'd': - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("--debug --syspath= --subsystem= --help\n"); - goto out; - case 'V': - printf("%s\n", VERSION); - goto out; - default: - goto out; - } - } - - str = udev_get_sys_path(udev); - printf("sys_path: '%s'\n", str); - str = udev_get_dev_path(udev); - printf("dev_path: '%s'\n", str); - - /* add sys path if needed */ - if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { - snprintf(path, sizeof(path), "%s%s", udev_get_sys_path(udev), syspath); - syspath = path; - } - - test_device(udev, syspath); - test_device_devnum(udev); - test_device_subsys_name(udev); - test_device_parents(udev, syspath); - - test_enumerate(udev, subsystem); - - test_queue(udev); - - test_monitor(udev); -out: - udev_unref(udev); - return 0; -} diff --git a/udev/udev.h b/udev/udev.h index 7187975390..8926dee932 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -22,8 +22,8 @@ #include #include -#include "lib/libudev.h" -#include "lib/libudev-private.h" +#include "libudev.h" +#include "libudev-private.h" #define DEFAULT_FAKE_PARTITIONS_COUNT 15 #define UDEV_EVENT_TIMEOUT 180 -- cgit v1.2.3-54-g00ecf From 62f11eed3ee2bbcf5a204f63a2d2bc9d78eb01e1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 8 Jun 2009 22:25:58 +0200 Subject: fix libudev include in Makefile.am.in --- Makefile.am.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am.inc b/Makefile.am.inc index 802143bb6b..7a8659ebb8 100644 --- a/Makefile.am.inc +++ b/Makefile.am.inc @@ -1,6 +1,6 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ - -I$(top_builddir)/libudev \ + -I$(top_srcdir)/libudev \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DUDEV_PREFIX=\""$(udev_prefix)"\" -- cgit v1.2.3-54-g00ecf From a5710160377a85e7c78601e2c45049b392891436 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Jun 2009 13:11:23 +0200 Subject: libudev: device_new() -> udev_device_new() --- libudev/libudev-device.c | 4 ++-- libudev/libudev-monitor.c | 2 +- libudev/libudev-private.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index ea54badde4..96cc2dba1c 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -222,7 +222,7 @@ void udev_device_set_info_loaded(struct udev_device *device) device->info_loaded = 1; } -struct udev_device *device_new(struct udev *udev) +struct udev_device *udev_device_new(struct udev *udev) { struct udev_device *udev_device; struct udev_list_entry *list_entry; @@ -331,7 +331,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * } } - udev_device = device_new(udev); + udev_device = udev_device_new(udev); if (udev_device == NULL) return NULL; diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 7a0cb47852..5c4e8ca04a 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -562,7 +562,7 @@ retry: } } - udev_device = device_new(udev_monitor->udev); + udev_device = udev_device_new(udev_monitor->udev); if (udev_device == NULL) { return NULL; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 5512341e9e..f1ff10b7f4 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -39,13 +39,13 @@ void udev_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, ...) __attribute__ ((format(printf, 6, 7))); -struct udev_device *device_new(struct udev *udev); const char *udev_get_rules_path(struct udev *udev); int udev_get_run(struct udev *udev); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); /* libudev-device */ +struct udev_device *udev_device_new(struct udev *udev); int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype); -- cgit v1.2.3-54-g00ecf From 12bc9c54f23a37b2dc1d2965ee452d76bd2b6a37 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Jun 2009 18:31:14 +0200 Subject: udevd: log info for created/killed workers --- udev/udevd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev/udevd.c b/udev/udevd.c index e7a0c9840a..d63fa7f486 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -307,6 +307,7 @@ static void worker_new(struct event *event) event->state = EVENT_RUNNING; udev_list_node_append(&worker->node, &worker_list); childs++; + info(event->udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); break; } } @@ -701,6 +702,7 @@ static void handle_signal(struct udev *udev, int signo) udev_list_node_remove(&worker->node); worker_unref(worker); childs--; + info(udev, "worker [%u] exit\n", pid); break; } } -- cgit v1.2.3-54-g00ecf From 119f66fc36b4f5164fb4a9ece247938e97609a05 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Jun 2009 19:03:39 +0200 Subject: libudev: call log functions conditionally --- libudev/libudev-private.h | 20 +++++++++++++------- libudev/libudev.c | 3 --- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index f1ff10b7f4..db5dde3164 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -17,17 +17,23 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -static inline void __attribute__ ((format(printf, 2, 3))) +static inline void __attribute__((always_inline, format(printf, 2, 3))) udev_log_null(struct udev *udev, const char *format, ...) {} +#define udev_log_cond(udev, prio, arg...) \ + do { \ + if (udev_get_log_priority(udev) >= prio) \ + udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg); \ + } while (0) + #ifdef USE_LOG # ifdef DEBUG -# define dbg(udev, arg...) udev_log(udev, LOG_DEBUG, __FILE__, __LINE__, __FUNCTION__, ## arg) +# define dbg(udev, arg...) udev_log_cond(udev, LOG_DEBUG, ## arg) # else # define dbg(udev, arg...) udev_log_null(udev, ## arg) # endif -# define info(udev, arg...) udev_log(udev, LOG_INFO, __FILE__, __LINE__, __FUNCTION__, ## arg) -# define err(udev, arg...) udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg) +# define info(udev, arg...) udev_log_cond(udev, LOG_INFO, ## arg) +# define err(udev, arg...) udev_log_cond(udev, LOG_ERR, ## arg) #else # define dbg(udev, arg...) udev_log_null(udev, ## arg) # define info(udev, arg...) udev_log_null(udev, ## arg) @@ -38,7 +44,7 @@ udev_log_null(struct udev *udev, const char *format, ...) {} void udev_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, ...) - __attribute__ ((format(printf, 6, 7))); + __attribute__((format(printf, 6, 7))); const char *udev_get_rules_path(struct udev *udev); int udev_get_run(struct udev *udev); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); @@ -179,9 +185,9 @@ size_t util_path_encode(const char *src, char *dest, size_t size); size_t util_path_decode(char *s); void util_remove_trailing_chars(char *path, char c); size_t util_strpcpy(char **dest, size_t size, const char *src); -size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__ ((sentinel)); +size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__((sentinel)); size_t util_strscpy(char *dest, size_t size, const char *src); -size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__ ((sentinel)); +size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__((sentinel)); int udev_util_replace_whitespace(const char *str, char *to, size_t len); int udev_util_replace_chars(char *str, const char *white); int udev_util_encode_string(const char *str, char *str_enc, size_t len); diff --git a/libudev/libudev.c b/libudev/libudev.c index a9baa70799..6645298544 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -41,9 +41,6 @@ void udev_log(struct udev *udev, { va_list args; - if (priority > udev->log_priority) - return; - va_start(args, format); udev->log_fn(udev, priority, file, line, fn, format, args); va_end(args); -- cgit v1.2.3-54-g00ecf From 9060b066d9e7aaca9795010ac5fff61018947f87 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Jun 2009 22:47:48 +0200 Subject: move syslog wrapper to libudev --- extras/ata_id/Makefile.am | 3 ++- extras/ata_id/ata_id.c | 7 ++++--- extras/cdrom_id/Makefile.am | 1 + extras/cdrom_id/cdrom_id.c | 7 ++++--- extras/edd_id/edd_id.c | 7 ++++--- extras/floppy/Makefile.am | 1 + extras/floppy/create_floppy_devices.c | 5 ++++- extras/fstab_import/fstab_import.c | 7 ++++--- extras/path_id/path_id.c | 6 +++--- extras/scsi_id/scsi_id.c | 7 ++++--- extras/scsi_id/scsi_serial.c | 3 ++- extras/usb_id/usb_id.c | 7 ++++--- libudev/libudev-private.h | 26 ++++++++++++++++++-------- udev/udev.h | 17 ----------------- udev/udevadm.c | 4 ++-- udev/udevd.c | 10 +++++----- 16 files changed, 62 insertions(+), 56 deletions(-) diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index ffbdba32f2..0c37d8029a 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -6,7 +6,8 @@ udevhome_PROGRAMS = \ ata_id_SOURCES = \ ata_id.c \ - ../../udev/udev.h \ + ../../libudev/libudev.h \ + ../../libudev/libudev-private.h \ ../../libudev/libudev.c \ ../../libudev/libudev-list.c \ ../../libudev/libudev-util.c diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index dd28d91f4a..d976467817 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -35,7 +35,8 @@ #include #include -#include "../../udev/udev.h" +#include "libudev.h" +#include "libudev-private.h" static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, @@ -66,7 +67,7 @@ int main(int argc, char *argv[]) if (udev == NULL) goto exit; - logging_init("ata_id"); + udev_log_init("ata_id"); udev_set_log_fn(udev, log_fn); while (1) { @@ -164,6 +165,6 @@ close: close(fd); exit: udev_unref(udev); - logging_close(); + udev_log_close(); return rc; } diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index 8e1968e6e1..bfdfdd3735 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -11,6 +11,7 @@ dist_udevrules_DATA = \ cdrom_id_SOURCES = \ cdrom_id.c \ ../../libudev/libudev.h \ + ../../libudev/libudev-private.h \ ../../libudev/libudev.c \ ../../libudev/libudev-list.c \ ../../libudev/libudev-util.c diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 2306d9ad71..d4156ce7ac 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -37,7 +37,8 @@ #include #include -#include "../../udev/udev.h" +#include "libudev.h" +#include "libudev-private.h" static int debug; @@ -528,7 +529,7 @@ int main(int argc, char *argv[]) if (udev == NULL) goto exit; - logging_init("cdrom_id"); + udev_log_init("cdrom_id"); udev_set_log_fn(udev, log_fn); while (1) { @@ -706,7 +707,7 @@ exit: if (fd >= 0) close(fd); udev_unref(udev); - logging_close(); + udev_log_close(); return rc; } diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 90656b4411..15295ed31f 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -23,7 +23,8 @@ #include #include -#include "../../udev/udev.h" +#include "libudev.h" +#include "libudev-private.h" static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, @@ -52,7 +53,7 @@ int main(int argc, char *argv[]) if (udev == NULL) goto exit; - logging_init("edd_id"); + udev_log_init("edd_id"); udev_set_log_fn(udev, log_fn); for (i = 1 ; i < argc; i++) { @@ -181,6 +182,6 @@ closedir: closedir(dir); exit: udev_unref(udev); - logging_close(); + udev_log_close(); return rc; } diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 2baaa10f02..365ece9ee9 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -12,6 +12,7 @@ create_floppy_devices_SOURCES = \ ../../libudev/libudev-util.c \ ../../libudev/libudev-device.c \ ../../libudev/libudev-enumerate.c \ + ../../udev/udev.h \ ../../udev/udev-util.c if USE_SELINUX diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 0698fcd3e8..b0d7b0bc85 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -24,6 +24,8 @@ #include #include +#include "libudev.h" +#include "libudev-private.h" #include "../../udev/udev.h" static char *table[] = { @@ -66,7 +68,7 @@ int main(int argc, char **argv) if (udev == NULL) goto exit; - logging_init("create_floppy_devices"); + udev_log_init("create_floppy_devices"); udev_set_log_fn(udev, log_fn); udev_selinux_init(udev); @@ -164,6 +166,7 @@ int main(int argc, char **argv) udev_selinux_exit(udev); udev_unref(udev); + udev_log_close(); exit: return 0; } diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c index e46ba7ec44..98ee75f174 100644 --- a/extras/fstab_import/fstab_import.c +++ b/extras/fstab_import/fstab_import.c @@ -24,7 +24,8 @@ #include #include -#include "../../udev/udev.h" +#include "libudev.h" +#include "libudev-private.h" static int debug; @@ -80,7 +81,7 @@ int main(int argc, char *argv[]) if (udev == NULL) goto exit; - logging_init("fstab_id"); + udev_log_init("fstab_id"); udev_set_log_fn(udev, log_fn); while (1) { @@ -197,6 +198,6 @@ int main(int argc, char *argv[]) exit: udev_unref(udev); - logging_close(); + udev_log_close(); return rc; } diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index dbb52bad21..4b57dec0d3 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -29,7 +29,7 @@ #include #include "libudev.h" -#include "../../udev/udev.h" +#include "libudev-private.h" int debug; @@ -366,7 +366,7 @@ int main(int argc, char **argv) if (udev == NULL) goto exit; - logging_init("path_id"); + udev_log_init("path_id"); udev_set_log_fn(udev, log_fn); while (1) { @@ -465,6 +465,6 @@ out: udev_device_unref(dev); exit: udev_unref(udev); - logging_close(); + udev_log_close(); return rc; } diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 213a267afa..7cf2f3765d 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -27,7 +27,8 @@ #include #include -#include "../../udev/udev.h" +#include "libudev.h" +#include "libudev-private.h" #include "scsi_id.h" static const struct option options[] = { @@ -613,7 +614,7 @@ int main(int argc, char **argv) if (udev == NULL) goto exit; - logging_init("scsi_id"); + udev_log_init("scsi_id"); udev_set_log_fn(udev, log_fn); /* @@ -649,6 +650,6 @@ int main(int argc, char **argv) exit: udev_unref(udev); - logging_close(); + udev_log_close(); return retval; } diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index cbacf379fe..c47712d859 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -30,7 +30,8 @@ /* #include */ #include "bsg.h" -#include "../../udev/udev.h" +#include "libudev.h" +#include "libudev-private.h" #include "scsi.h" #include "scsi_id.h" diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 4679f94fde..b412598d35 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -21,7 +21,8 @@ #include #include -#include "../../udev/udev.h" +#include "libudev.h" +#include "libudev-private.h" int debug; @@ -464,7 +465,7 @@ int main(int argc, char **argv) if (udev == NULL) goto exit; - logging_init("usb_id"); + udev_log_init("usb_id"); udev_set_log_fn(udev, log_fn); while (1) { @@ -558,6 +559,6 @@ int main(int argc, char **argv) exit: udev_device_unref(dev); udev_unref(udev); - logging_close(); + udev_log_close(); return retval; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index db5dde3164..21eb626dc1 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -40,7 +40,17 @@ udev_log_null(struct udev *udev, const char *format, ...) {} # define err(udev, arg...) udev_log_null(udev, ## arg) #endif -/* libudev */ +static inline void udev_log_init(const char *program_name) +{ + openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); +} + +static inline void udev_log_close(void) +{ + closelog(); +} + +/* libudev.c */ void udev_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, ...) @@ -50,7 +60,7 @@ int udev_get_run(struct udev *udev); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); -/* libudev-device */ +/* libudev-device.c */ struct udev_device *udev_device_new(struct udev *udev); int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); @@ -91,14 +101,14 @@ int udev_device_update_db(struct udev_device *udev_device); int udev_device_delete_db(struct udev_device *udev_device); int udev_device_rename_db(struct udev_device *udev_device, const char *devpath); -/* libudev-monitor - netlink/unix socket communication */ +/* libudev-monitor.c - netlink/unix socket communication */ int udev_monitor_disconnect(struct udev_monitor *udev_monitor); int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_monitor *destination, struct udev_device *udev_device); int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); -/* libudev-ctrl - daemon runtime setup */ +/* libudev-ctrl.c - daemon runtime setup */ struct udev_ctrl; struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); @@ -126,7 +136,7 @@ pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg); const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); -/* libudev-list */ +/* libudev-list.c */ struct udev_list_node { struct udev_list_node *next, *prev; }; @@ -158,13 +168,13 @@ void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); entry != NULL; \ entry = tmp, tmp = udev_list_entry_get_next(tmp)) -/* libudev-queue */ +/* libudev-queue.c */ unsigned long long int udev_get_kernel_seqnum(struct udev *udev); int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum); ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size); ssize_t udev_queue_skip_devpath(FILE *queue_file); -/* libudev-queue-export */ +/* libudev-queue-export.c */ struct udev_queue_export *udev_queue_export_new(struct udev *udev); void udev_queue_export_unref(struct udev_queue_export *udev_queue_export); void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); @@ -172,7 +182,7 @@ int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); -/* libudev-utils */ +/* libudev-utils.c */ #define UTIL_PATH_SIZE 1024 #define UTIL_LINE_SIZE 2048 #define UTIL_NAME_SIZE 512 diff --git a/udev/udev.h b/udev/udev.h index 8926dee932..bd3686b28a 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -34,23 +34,6 @@ #define READ_END 0 #define WRITE_END 1 -static inline void logging_init(const char *program_name) -{ - openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); -} - -static inline void logging_msg(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -static inline void logging_close(void) -{ - closelog(); -} - struct udev_event { struct udev *udev; struct udev_device *dev; diff --git a/udev/udevadm.c b/udev/udevadm.c index 072280a58e..99ac330082 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -138,7 +138,7 @@ int main(int argc, char *argv[]) if (udev == NULL) goto out; - logging_init("udevadm"); + udev_log_init("udevadm"); udev_set_log_fn(udev, log_fn); udev_selinux_init(udev); @@ -214,6 +214,6 @@ int main(int argc, char *argv[]) out: udev_selinux_exit(udev); udev_unref(udev); - logging_close(); + udev_log_close(); return rc; } diff --git a/udev/udevd.c b/udev/udevd.c index d63fa7f486..292f4374d7 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -213,8 +213,8 @@ static void worker_new(struct event *event) udev_ctrl_unref(udev_ctrl); close(pfd[FD_SIGNAL].fd); close(worker_watch[READ_END]); - logging_close(); - logging_init("udevd-work"); + udev_log_close(); + udev_log_init("udevd-work"); setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); /* set signal handlers */ @@ -288,7 +288,7 @@ static void worker_new(struct event *event) } udev_monitor_unref(worker_monitor); - logging_close(); + udev_log_close(); exit(0); } case -1: @@ -763,7 +763,7 @@ int main(int argc, char *argv[]) if (udev == NULL) goto exit; - logging_init("udevd"); + udev_log_init("udevd"); udev_set_log_fn(udev, log_fn); info(udev, "version %s\n", VERSION); udev_selinux_init(udev); @@ -1069,6 +1069,6 @@ exit: udev_monitor_unref(monitor); udev_selinux_exit(udev); udev_unref(udev); - logging_close(); + udev_log_close(); return rc; } -- cgit v1.2.3-54-g00ecf From 44b49d3736bfdc94da31b5670a2c5a3477a201eb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Jun 2009 23:05:25 +0200 Subject: move common stuff from udev/ to private parts of libudev/ --- extras/floppy/Makefile.am | 8 +- extras/floppy/create_floppy_devices.c | 1 - libudev/libudev-device-db-write.c | 3 +- libudev/libudev-private.h | 31 ++- libudev/libudev-queue-export.c | 7 +- libudev/libudev-selinux-private.c | 83 +++++++ libudev/libudev-util-private.c | 446 +++++++++++++++++++++++++++++++++ udev/Makefile.am | 4 +- udev/udev-selinux.c | 88 ------- udev/udev-util.c | 451 ---------------------------------- udev/udev.h | 30 --- 11 files changed, 569 insertions(+), 583 deletions(-) create mode 100644 libudev/libudev-selinux-private.c create mode 100644 libudev/libudev-util-private.c delete mode 100644 udev/udev-selinux.c delete mode 100644 udev/udev-util.c diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 365ece9ee9..cbdcf6e8fb 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -7,17 +7,17 @@ udevhome_PROGRAMS = \ create_floppy_devices_SOURCES = \ create_floppy_devices.c \ ../../libudev/libudev.h \ + ../../libudev/libudev-private.h \ ../../libudev/libudev.c \ ../../libudev/libudev-list.c \ ../../libudev/libudev-util.c \ + ../../libudev/libudev-util-private.c \ ../../libudev/libudev-device.c \ - ../../libudev/libudev-enumerate.c \ - ../../udev/udev.h \ - ../../udev/udev-util.c + ../../libudev/libudev-enumerate.c if USE_SELINUX create_floppy_devices_SOURCES += \ - ../../udev/udev-selinux.c + ../../libudev/libudev-selinux-private.c create_floppy_devices_LDADD = \ $(SELINUX_LIBS) endif diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index b0d7b0bc85..2fc05cc494 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -26,7 +26,6 @@ #include "libudev.h" #include "libudev-private.h" -#include "../../udev/udev.h" static char *table[] = { "", "d360", "h1200", "u360", "u720", "h360", "h720", diff --git a/libudev/libudev-device-db-write.c b/libudev/libudev-device-db-write.c index a8e66f7884..68dc0a5b98 100644 --- a/libudev/libudev-device-db-write.c +++ b/libudev/libudev-device-db-write.c @@ -18,7 +18,8 @@ #include #include -#include "udev.h" +#include "libudev.h" +#include "libudev-private.h" static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) { diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 21eb626dc1..9cda7bcb1e 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -16,6 +16,9 @@ #include "libudev.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) +#define READ_END 0 +#define WRITE_END 1 static inline void __attribute__((always_inline, format(printf, 2, 3))) udev_log_null(struct udev *udev, const char *format, ...) {} @@ -182,7 +185,7 @@ int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); -/* libudev-utils.c */ +/* libudev-util.c */ #define UTIL_PATH_SIZE 1024 #define UTIL_LINE_SIZE 2048 #define UTIL_NAME_SIZE 512 @@ -203,4 +206,30 @@ int udev_util_replace_chars(char *str, const char *white); int udev_util_encode_string(const char *str, char *str_enc, size_t len); void util_set_fd_cloexec(int fd); unsigned int util_string_hash32(const char *str); + +/* libudev-util-private.c */ +int util_create_path(struct udev *udev, const char *path); +int util_delete_path(struct udev *udev, const char *path); +int util_unlink_secure(struct udev *udev, const char *filename); +uid_t util_lookup_user(struct udev *udev, const char *user); +gid_t util_lookup_group(struct udev *udev, const char *group); +int util_run_program(struct udev *udev, const char *command, char **envp, + char *result, size_t ressize, size_t *reslen); +int util_resolve_subsys_kernel(struct udev *udev, const char *string, + char *result, size_t maxsize, int read_value); + +/* libudev-selinux-private.c */ +#ifndef USE_SELINUX +static inline void udev_selinux_init(struct udev *udev) {} +static inline void udev_selinux_exit(struct udev *udev) {} +static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} +static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} +static inline void udev_selinux_resetfscreatecon(struct udev *udev) {} +#else +void udev_selinux_init(struct udev *udev); +void udev_selinux_exit(struct udev *udev); +void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); +void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); +void udev_selinux_resetfscreatecon(struct udev *udev); +#endif #endif diff --git a/libudev/libudev-queue-export.c b/libudev/libudev-queue-export.c index a36ff5150a..9ae680c386 100644 --- a/libudev/libudev-queue-export.c +++ b/libudev/libudev-queue-export.c @@ -14,7 +14,6 @@ * DISCLAIMER - The file format mentioned here is private to udev/libudev, * and may be changed without notice. * - * * The udev event queue is exported as a binary log file. * Each log record consists of a sequence number followed by the device path. * @@ -31,7 +30,6 @@ * The queue does not grow indefinitely. It is periodically re-created * to remove finished events. Atomic rename() makes this transparent to readers. * - * * The queue file starts with a single sequence number which specifies the * minimum sequence number in the log that follows. Any events prior to this * sequence number have already finished. @@ -48,7 +46,8 @@ #include #include -#include "udev.h" +#include "libudev.h" +#include "libudev-private.h" static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); @@ -108,7 +107,6 @@ void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) unlink(filename); } - static int skip_to(FILE *file, long offset) { long old_offset; @@ -320,7 +318,6 @@ write_error: return -1; } - enum device_state { DEVICE_QUEUED, DEVICE_FINISHED, diff --git a/libudev/libudev-selinux-private.c b/libudev/libudev-selinux-private.c new file mode 100644 index 0000000000..84f8b6a63f --- /dev/null +++ b/libudev/libudev-selinux-private.c @@ -0,0 +1,83 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static int selinux_enabled; +security_context_t selinux_prev_scontext; + +void udev_selinux_init(struct udev *udev) +{ + /* record the present security context */ + selinux_enabled = (is_selinux_enabled() > 0); + info(udev, "selinux=%i\n", selinux_enabled); + if (!selinux_enabled) + return; + matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); + if (getfscreatecon(&selinux_prev_scontext) < 0) { + err(udev, "getfscreatecon failed\n"); + selinux_prev_scontext = NULL; + } +} + +void udev_selinux_exit(struct udev *udev) +{ + if (!selinux_enabled) + return; + freecon(selinux_prev_scontext); + selinux_prev_scontext = NULL; +} + +void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) +{ + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (lsetfilecon(file, scontext) < 0) + err(udev, "setfilecon %s failed: %m\n", file); + freecon(scontext); +} + +void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) +{ + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (setfscreatecon(scontext) < 0) + err(udev, "setfscreatecon %s failed: %m\n", file); + freecon(scontext); +} + +void udev_selinux_resetfscreatecon(struct udev *udev) +{ + if (!selinux_enabled) + return; + if (setfscreatecon(selinux_prev_scontext) < 0) + err(udev, "setfscreatecon failed: %m\n"); +} diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c new file mode 100644 index 0000000000..f22c04184b --- /dev/null +++ b/libudev/libudev-util-private.c @@ -0,0 +1,446 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2004-2009 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +int util_create_path(struct udev *udev, const char *path) +{ + char p[UTIL_PATH_SIZE]; + char *pos; + struct stat stats; + int ret; + + util_strscpy(p, sizeof(p), path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (pos[-1] == '/') + pos--; + pos[0] = '\0'; + + dbg(udev, "stat '%s'\n", p); + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + + if (util_create_path(udev, p) != 0) + return -1; + + dbg(udev, "mkdir '%s'\n", p); + udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); + ret = mkdir(p, 0755); + udev_selinux_resetfscreatecon(udev); + if (ret == 0) + return 0; + + if (errno == EEXIST) + if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + return -1; +} + +int util_delete_path(struct udev *udev, const char *path) +{ + char p[UTIL_PATH_SIZE]; + char *pos; + int retval; + + strcpy (p, path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + while (1) { + *pos = '\0'; + pos = strrchr(p, '/'); + + /* don't remove the last one */ + if ((pos == p) || (pos == NULL)) + break; + + /* remove if empty */ + retval = rmdir(p); + if (errno == ENOENT) + retval = 0; + if (retval) { + if (errno == ENOTEMPTY) + return 0; + err(udev, "rmdir(%s) failed: %m\n", p); + break; + } + dbg(udev, "removed '%s'\n", p); + } + return 0; +} + +/* Reset permissions on the device node, before unlinking it to make sure, + * that permisions of possible hard links will be removed too. + */ +int util_unlink_secure(struct udev *udev, const char *filename) +{ + int retval; + + retval = chown(filename, 0, 0); + if (retval) + err(udev, "chown(%s, 0, 0) failed: %m\n", filename); + + retval = chmod(filename, 0000); + if (retval) + err(udev, "chmod(%s, 0000) failed: %m\n", filename); + + retval = unlink(filename); + if (errno == ENOENT) + retval = 0; + + if (retval) + err(udev, "unlink(%s) failed: %m\n", filename); + + return retval; +} + +uid_t util_lookup_user(struct udev *udev, const char *user) +{ + char *endptr; + int buflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char buf[buflen]; + struct passwd pwbuf; + struct passwd *pw; + uid_t uid; + + if (strcmp(user, "root") == 0) + return 0; + uid = strtoul(user, &endptr, 10); + if (endptr[0] == '\0') + return uid; + + errno = 0; + getpwnam_r(user, &pwbuf, buf, buflen, &pw); + if (pw != NULL) + return pw->pw_uid; + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err(udev, "specified user '%s' unknown\n", user); + else + err(udev, "error resolving user '%s': %m\n", user); + return 0; +} + +gid_t util_lookup_group(struct udev *udev, const char *group) +{ + char *endptr; + int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); + char buf[buflen]; + struct group grbuf; + struct group *gr; + gid_t gid = 0; + + if (strcmp(group, "root") == 0) + return 0; + gid = strtoul(group, &endptr, 10); + if (endptr[0] == '\0') + return gid; + + errno = 0; + getgrnam_r(group, &grbuf, buf, buflen, &gr); + if (gr != NULL) + return gr->gr_gid; + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err(udev, "specified group '%s' unknown\n", group); + else + err(udev, "error resolving group '%s': %m\n", group); + return 0; +} + +/* handle "[/]" format */ +int util_resolve_subsys_kernel(struct udev *udev, const char *string, + char *result, size_t maxsize, int read_value) +{ + char temp[UTIL_PATH_SIZE]; + char *subsys; + char *sysname; + struct udev_device *dev; + char *attr; + + if (string[0] != '[') + return -1; + + util_strscpy(temp, sizeof(temp), string); + + subsys = &temp[1]; + + sysname = strchr(subsys, '/'); + if (sysname == NULL) + return -1; + sysname[0] = '\0'; + sysname = &sysname[1]; + + attr = strchr(sysname, ']'); + if (attr == NULL) + return -1; + attr[0] = '\0'; + attr = &attr[1]; + if (attr[0] == '/') + attr = &attr[1]; + if (attr[0] == '\0') + attr = NULL; + + if (read_value && attr == NULL) + return -1; + + dev = udev_device_new_from_subsystem_sysname(udev, subsys, sysname); + if (dev == NULL) + return -1; + + if (read_value) { + const char *val; + + val = udev_device_get_sysattr_value(dev, attr); + if (val != NULL) + util_strscpy(result, maxsize, val); + else + result[0] = '\0'; + info(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } else { + size_t l; + char *s; + + s = result; + l = util_strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL); + if (attr != NULL) + util_strpcpyl(&s, l, "/", attr, NULL); + info(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } + udev_device_unref(dev); + return 0; +} + +int util_run_program(struct udev *udev, const char *command, char **envp, + char *result, size_t ressize, size_t *reslen) +{ + int status; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[UTIL_PATH_SIZE]; + char program[UTIL_PATH_SIZE]; + char *argv[(sizeof(arg) / 2) + 1]; + int devnull; + int i; + int err = 0; + + /* build argv from command */ + util_strscpy(arg, sizeof(arg), command); + i = 0; + if (strchr(arg, ' ') != NULL) { + char *pos = arg; + + while (pos != NULL && pos[0] != '\0') { + if (pos[0] == '\'') { + /* do not separate quotes */ + pos++; + argv[i] = strsep(&pos, "\'"); + while (pos != NULL && pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + } + dbg(udev, "arg[%i] '%s'\n", i, argv[i]); + i++; + } + argv[i] = NULL; + } else { + argv[0] = arg; + argv[1] = NULL; + } + info(udev, "'%s'\n", command); + + /* prepare pipes from child to parent */ + if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe(outpipe) != 0) { + err(udev, "pipe failed: %m\n"); + return -1; + } + } + if (udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe(errpipe) != 0) { + err(udev, "pipe failed: %m\n"); + return -1; + } + } + + /* allow programs in /lib/udev/ to be called without the path */ + if (argv[0][0] != '/') { + util_strscpyl(program, sizeof(program), UDEV_PREFIX "/lib/udev/", argv[0], NULL); + argv[0] = program; + } + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent ends of pipes */ + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* discard child output or connect to pipe */ + devnull = open("/dev/null", O_RDWR); + if (devnull > 0) { + dup2(devnull, STDIN_FILENO); + if (outpipe[WRITE_END] < 0) + dup2(devnull, STDOUT_FILENO); + if (errpipe[WRITE_END] < 0) + dup2(devnull, STDERR_FILENO); + close(devnull); + } else + err(udev, "open /dev/null failed: %m\n"); + if (outpipe[WRITE_END] > 0) { + dup2(outpipe[WRITE_END], STDOUT_FILENO); + close(outpipe[WRITE_END]); + } + if (errpipe[WRITE_END] > 0) { + dup2(errpipe[WRITE_END], STDERR_FILENO); + close(errpipe[WRITE_END]); + } + execve(argv[0], argv, envp); + if (errno == ENOENT || errno == ENOTDIR) { + /* may be on a filesytem which is not mounted right now */ + info(udev, "program '%s' not found\n", argv[0]); + } else { + /* other problems */ + err(udev, "exec of program '%s' failed\n", argv[0]); + } + _exit(1); + case -1: + err(udev, "fork of '%s' failed: %m\n", argv[0]); + return -1; + default: + /* read from child if requested */ + if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + ssize_t count; + size_t respos = 0; + + /* parent closes child ends of pipes */ + if (outpipe[WRITE_END] > 0) + close(outpipe[WRITE_END]); + if (errpipe[WRITE_END] > 0) + close(errpipe[WRITE_END]); + + /* read child output */ + while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { + int fdcount; + fd_set readfds; + + FD_ZERO(&readfds); + if (outpipe[READ_END] > 0) + FD_SET(outpipe[READ_END], &readfds); + if (errpipe[READ_END] > 0) + FD_SET(errpipe[READ_END], &readfds); + fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -1; + break; + } + + /* get stdout */ + if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { + char inbuf[1024]; + char *pos; + char *line; + + count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); + if (count <= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + if (count < 0) { + err(udev, "stdin read failed: %m\n"); + err = -1; + } + continue; + } + inbuf[count] = '\0'; + + /* store result for rule processing */ + if (result) { + if (respos + count < ressize) { + memcpy(&result[respos], inbuf, count); + respos += count; + } else { + err(udev, "ressize %ld too short\n", (long)ressize); + err = -1; + } + } + pos = inbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info(udev, "'%s' (stdout) '%s'\n", argv[0], line); + } + + /* get stderr */ + if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { + char errbuf[1024]; + char *pos; + char *line; + + count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); + if (count <= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + if (count < 0) + err(udev, "stderr read failed: %m\n"); + continue; + } + errbuf[count] = '\0'; + pos = errbuf; + while ((line = strsep(&pos, "\n"))) + if (pos || line[0] != '\0') + info(udev, "'%s' (stderr) '%s'\n", argv[0], line); + } + } + if (outpipe[READ_END] > 0) + close(outpipe[READ_END]); + if (errpipe[READ_END] > 0) + close(errpipe[READ_END]); + + /* return the childs stdout string */ + if (result) { + result[respos] = '\0'; + dbg(udev, "result='%s'\n", result); + if (reslen) + *reslen = respos; + } + } + waitpid(pid, &status, 0); + if (WIFEXITED(status)) { + info(udev, "'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + err = -1; + } else { + err(udev, "'%s' abnormal exit\n", command); + err = -1; + } + } + return err; +} diff --git a/udev/Makefile.am b/udev/Makefile.am index ca5b4fae59..f2ceb99774 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -15,12 +15,12 @@ common_files = \ udev-watch.c \ udev-node.c \ udev-rules.c \ - udev-util.c \ ../libudev/libudev.h \ ../libudev/libudev-private.h \ ../libudev/libudev.c \ ../libudev/libudev-list.c \ ../libudev/libudev-util.c \ + ../libudev/libudev-util-private.c \ ../libudev/libudev-device.c \ ../libudev/libudev-device-db-write.c \ ../libudev/libudev-monitor.c \ @@ -31,7 +31,7 @@ common_files = \ if USE_SELINUX common_files += \ - udev-selinux.c + ../libudev/libudev-selinux-private.c common_ldadd += \ $(SELINUX_LIBS) endif diff --git a/udev/udev-selinux.c b/udev/udev-selinux.c deleted file mode 100644 index 4f1b2bb2d1..0000000000 --- a/udev/udev-selinux.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int selinux_enabled; -security_context_t selinux_prev_scontext; - -void udev_selinux_init(struct udev *udev) -{ - /* record the present security context */ - selinux_enabled = (is_selinux_enabled() > 0); - info(udev, "selinux=%i\n", selinux_enabled); - if (!selinux_enabled) - return; - matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); - if (getfscreatecon(&selinux_prev_scontext) < 0) { - err(udev, "getfscreatecon failed\n"); - selinux_prev_scontext = NULL; - } -} - -void udev_selinux_exit(struct udev *udev) -{ - if (!selinux_enabled) - return; - freecon(selinux_prev_scontext); - selinux_prev_scontext = NULL; -} - -void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) -{ - security_context_t scontext = NULL; - - if (!selinux_enabled) - return; - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (lsetfilecon(file, scontext) < 0) - err(udev, "setfilecon %s failed: %m\n", file); - freecon(scontext); -} - -void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) -{ - security_context_t scontext = NULL; - - if (!selinux_enabled) - return; - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (setfscreatecon(scontext) < 0) - err(udev, "setfscreatecon %s failed: %m\n", file); - freecon(scontext); -} - -void udev_selinux_resetfscreatecon(struct udev *udev) -{ - if (!selinux_enabled) - return; - if (setfscreatecon(selinux_prev_scontext) < 0) - err(udev, "setfscreatecon failed: %m\n"); -} diff --git a/udev/udev-util.c b/udev/udev-util.c deleted file mode 100644 index 645293d389..0000000000 --- a/udev/udev-util.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -int util_create_path(struct udev *udev, const char *path) -{ - char p[UTIL_PATH_SIZE]; - char *pos; - struct stat stats; - int ret; - - util_strscpy(p, sizeof(p), path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (pos[-1] == '/') - pos--; - pos[0] = '\0'; - - dbg(udev, "stat '%s'\n", p); - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - - if (util_create_path(udev, p) != 0) - return -1; - - dbg(udev, "mkdir '%s'\n", p); - udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); - ret = mkdir(p, 0755); - udev_selinux_resetfscreatecon(udev); - if (ret == 0) - return 0; - - if (errno == EEXIST) - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - return -1; -} - -int util_delete_path(struct udev *udev, const char *path) -{ - char p[UTIL_PATH_SIZE]; - char *pos; - int retval; - - strcpy (p, path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - while (1) { - *pos = '\0'; - pos = strrchr(p, '/'); - - /* don't remove the last one */ - if ((pos == p) || (pos == NULL)) - break; - - /* remove if empty */ - retval = rmdir(p); - if (errno == ENOENT) - retval = 0; - if (retval) { - if (errno == ENOTEMPTY) - return 0; - err(udev, "rmdir(%s) failed: %m\n", p); - break; - } - dbg(udev, "removed '%s'\n", p); - } - return 0; -} - -/* Reset permissions on the device node, before unlinking it to make sure, - * that permisions of possible hard links will be removed too. - */ -int util_unlink_secure(struct udev *udev, const char *filename) -{ - int retval; - - retval = chown(filename, 0, 0); - if (retval) - err(udev, "chown(%s, 0, 0) failed: %m\n", filename); - - retval = chmod(filename, 0000); - if (retval) - err(udev, "chmod(%s, 0000) failed: %m\n", filename); - - retval = unlink(filename); - if (errno == ENOENT) - retval = 0; - - if (retval) - err(udev, "unlink(%s) failed: %m\n", filename); - - return retval; -} - -uid_t util_lookup_user(struct udev *udev, const char *user) -{ - char *endptr; - int buflen = sysconf(_SC_GETPW_R_SIZE_MAX); - char buf[buflen]; - struct passwd pwbuf; - struct passwd *pw; - uid_t uid; - - if (strcmp(user, "root") == 0) - return 0; - uid = strtoul(user, &endptr, 10); - if (endptr[0] == '\0') - return uid; - - errno = 0; - getpwnam_r(user, &pwbuf, buf, buflen, &pw); - if (pw != NULL) - return pw->pw_uid; - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err(udev, "specified user '%s' unknown\n", user); - else - err(udev, "error resolving user '%s': %m\n", user); - return 0; -} - -gid_t util_lookup_group(struct udev *udev, const char *group) -{ - char *endptr; - int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); - char buf[buflen]; - struct group grbuf; - struct group *gr; - gid_t gid = 0; - - if (strcmp(group, "root") == 0) - return 0; - gid = strtoul(group, &endptr, 10); - if (endptr[0] == '\0') - return gid; - - errno = 0; - getgrnam_r(group, &grbuf, buf, buflen, &gr); - if (gr != NULL) - return gr->gr_gid; - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err(udev, "specified group '%s' unknown\n", group); - else - err(udev, "error resolving group '%s': %m\n", group); - return 0; -} - -/* handle "[/]" format */ -int util_resolve_subsys_kernel(struct udev *udev, const char *string, - char *result, size_t maxsize, int read_value) -{ - char temp[UTIL_PATH_SIZE]; - char *subsys; - char *sysname; - struct udev_device *dev; - char *attr; - - if (string[0] != '[') - return -1; - - util_strscpy(temp, sizeof(temp), string); - - subsys = &temp[1]; - - sysname = strchr(subsys, '/'); - if (sysname == NULL) - return -1; - sysname[0] = '\0'; - sysname = &sysname[1]; - - attr = strchr(sysname, ']'); - if (attr == NULL) - return -1; - attr[0] = '\0'; - attr = &attr[1]; - if (attr[0] == '/') - attr = &attr[1]; - if (attr[0] == '\0') - attr = NULL; - - if (read_value && attr == NULL) - return -1; - - dev = udev_device_new_from_subsystem_sysname(udev, subsys, sysname); - if (dev == NULL) - return -1; - - if (read_value) { - const char *val; - - val = udev_device_get_sysattr_value(dev, attr); - if (val != NULL) - util_strscpy(result, maxsize, val); - else - result[0] = '\0'; - info(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); - } else { - size_t l; - char *s; - - s = result; - l = util_strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL); - if (attr != NULL) - util_strpcpyl(&s, l, "/", attr, NULL); - info(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); - } - udev_device_unref(dev); - return 0; -} - -int util_run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen) -{ - int status; - int outpipe[2] = {-1, -1}; - int errpipe[2] = {-1, -1}; - pid_t pid; - char arg[UTIL_PATH_SIZE]; - char program[UTIL_PATH_SIZE]; - char *argv[(sizeof(arg) / 2) + 1]; - int devnull; - int i; - int err = 0; - - /* build argv from command */ - util_strscpy(arg, sizeof(arg), command); - i = 0; - if (strchr(arg, ' ') != NULL) { - char *pos = arg; - - while (pos != NULL && pos[0] != '\0') { - if (pos[0] == '\'') { - /* do not separate quotes */ - pos++; - argv[i] = strsep(&pos, "\'"); - while (pos != NULL && pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - } - dbg(udev, "arg[%i] '%s'\n", i, argv[i]); - i++; - } - argv[i] = NULL; - } else { - argv[0] = arg; - argv[1] = NULL; - } - info(udev, "'%s'\n", command); - - /* prepare pipes from child to parent */ - if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(outpipe) != 0) { - err(udev, "pipe failed: %m\n"); - return -1; - } - } - if (udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(errpipe) != 0) { - err(udev, "pipe failed: %m\n"); - return -1; - } - } - - /* allow programs in /lib/udev/ to be called without the path */ - if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), UDEV_PREFIX "/lib/udev/", argv[0], NULL); - argv[0] = program; - } - - pid = fork(); - switch(pid) { - case 0: - /* child closes parent ends of pipes */ - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* discard child output or connect to pipe */ - devnull = open("/dev/null", O_RDWR); - if (devnull > 0) { - dup2(devnull, STDIN_FILENO); - if (outpipe[WRITE_END] < 0) - dup2(devnull, STDOUT_FILENO); - if (errpipe[WRITE_END] < 0) - dup2(devnull, STDERR_FILENO); - close(devnull); - } else - err(udev, "open /dev/null failed: %m\n"); - if (outpipe[WRITE_END] > 0) { - dup2(outpipe[WRITE_END], STDOUT_FILENO); - close(outpipe[WRITE_END]); - } - if (errpipe[WRITE_END] > 0) { - dup2(errpipe[WRITE_END], STDERR_FILENO); - close(errpipe[WRITE_END]); - } - execve(argv[0], argv, envp); - if (errno == ENOENT || errno == ENOTDIR) { - /* may be on a filesytem which is not mounted right now */ - info(udev, "program '%s' not found\n", argv[0]); - } else { - /* other problems */ - err(udev, "exec of program '%s' failed\n", argv[0]); - } - _exit(1); - case -1: - err(udev, "fork of '%s' failed: %m\n", argv[0]); - return -1; - default: - /* read from child if requested */ - if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - ssize_t count; - size_t respos = 0; - - /* parent closes child ends of pipes */ - if (outpipe[WRITE_END] > 0) - close(outpipe[WRITE_END]); - if (errpipe[WRITE_END] > 0) - close(errpipe[WRITE_END]); - - /* read child output */ - while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - int fdcount; - fd_set readfds; - - FD_ZERO(&readfds); - if (outpipe[READ_END] > 0) - FD_SET(outpipe[READ_END], &readfds); - if (errpipe[READ_END] > 0) - FD_SET(errpipe[READ_END], &readfds); - fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err = -1; - break; - } - - /* get stdout */ - if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { - char inbuf[1024]; - char *pos; - char *line; - - count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); - if (count <= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - if (count < 0) { - err(udev, "stdin read failed: %m\n"); - err = -1; - } - continue; - } - inbuf[count] = '\0'; - - /* store result for rule processing */ - if (result) { - if (respos + count < ressize) { - memcpy(&result[respos], inbuf, count); - respos += count; - } else { - err(udev, "ressize %ld too short\n", (long)ressize); - err = -1; - } - } - pos = inbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stdout) '%s'\n", argv[0], line); - } - - /* get stderr */ - if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { - char errbuf[1024]; - char *pos; - char *line; - - count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); - if (count <= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - if (count < 0) - err(udev, "stderr read failed: %m\n"); - continue; - } - errbuf[count] = '\0'; - pos = errbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stderr) '%s'\n", argv[0], line); - } - } - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* return the childs stdout string */ - if (result) { - result[respos] = '\0'; - dbg(udev, "result='%s'\n", result); - if (reslen) - *reslen = respos; - } - } - waitpid(pid, &status, 0); - if (WIFEXITED(status)) { - info(udev, "'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); - if (WEXITSTATUS(status) != 0) - err = -1; - } else { - err(udev, "'%s' abnormal exit\n", command); - err = -1; - } - } - return err; -} diff --git a/udev/udev.h b/udev/udev.h index bd3686b28a..3e3ecfb1fe 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -30,10 +30,6 @@ #define UDEV_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd" -#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) -#define READ_END 0 -#define WRITE_END 1 - struct udev_event { struct udev *udev; struct udev_device *dev; @@ -89,32 +85,6 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); int udev_node_remove(struct udev_device *dev); void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); -/* udev-util.c */ -int util_create_path(struct udev *udev, const char *path); -int util_delete_path(struct udev *udev, const char *path); -int util_unlink_secure(struct udev *udev, const char *filename); -uid_t util_lookup_user(struct udev *udev, const char *user); -gid_t util_lookup_group(struct udev *udev, const char *group); -int util_run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen); -int util_resolve_subsys_kernel(struct udev *udev, const char *string, - char *result, size_t maxsize, int read_value); - -/* udev-selinux.c */ -#ifndef USE_SELINUX -static inline void udev_selinux_init(struct udev *udev) {} -static inline void udev_selinux_exit(struct udev *udev) {} -static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} -static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} -static inline void udev_selinux_resetfscreatecon(struct udev *udev) {} -#else -void udev_selinux_init(struct udev *udev); -void udev_selinux_exit(struct udev *udev); -void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); -void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); -void udev_selinux_resetfscreatecon(struct udev *udev); -#endif - /* udevadm commands */ int udevadm_monitor(struct udev *udev, int argc, char *argv[]); int udevadm_info(struct udev *udev, int argc, char *argv[]); -- cgit v1.2.3-54-g00ecf From 98631e1c21090db8fe8800f2a6658592406670ac Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 9 Jun 2009 23:12:12 +0200 Subject: libudev: rename private files to *-private.c --- libudev/libudev-device-db-write.c | 139 ----------- libudev/libudev-device-private.c | 139 +++++++++++ libudev/libudev-private.h | 4 +- libudev/libudev-queue-export.c | 470 -------------------------------------- libudev/libudev-queue-private.c | 470 ++++++++++++++++++++++++++++++++++++++ udev/Makefile.am | 4 +- 6 files changed, 613 insertions(+), 613 deletions(-) delete mode 100644 libudev/libudev-device-db-write.c create mode 100644 libudev/libudev-device-private.c delete mode 100644 libudev/libudev-queue-export.c create mode 100644 libudev/libudev-queue-private.c diff --git a/libudev/libudev-device-db-write.c b/libudev/libudev-device-db-write.c deleted file mode 100644 index 68dc0a5b98..0000000000 --- a/libudev/libudev-device-db-write.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) -{ - char *s; - size_t l; - - s = filename; - l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); - return util_path_encode(devpath, s, l); -} - -int udev_device_update_db(struct udev_device *udev_device) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - FILE *f; - char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ - size_t devlen = strlen(udev_get_dev_path(udev))+1; - char *s; - size_t l; - struct udev_list_entry *list_entry; - int ret; - - devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); - util_create_path(udev, filename); - unlink(filename); - - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_flag(list_entry)) - goto file; - if (udev_device_get_num_fake_partitions(udev_device) != 0) - goto file; - if (udev_device_get_ignore_remove(udev_device)) - goto file; - if (udev_device_get_devlink_priority(udev_device) != 0) - goto file; - if (udev_device_get_event_timeout(udev_device) >= 0) - goto file; - if (udev_device_get_watch_handle(udev_device) >= 0) - goto file; - if (udev_device_get_devnode(udev_device) == NULL) - goto out; - - /* - * if we have only the node and symlinks to store, try not to waste - * tmpfs memory -- store values, if they fit, in a symlink target - */ - s = target; - l = util_strpcpy(&s, sizeof(target), &udev_device_get_devnode(udev_device)[devlen]); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) { - l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); - if (l == 0) { - info(udev, "size of links too large, create file\n"); - goto file; - } - } - info(udev, "create db link (%s)\n", target); - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); - ret = symlink(target, filename); - udev_selinux_resetfscreatecon(udev); - if (ret == 0) - goto out; -file: - f = fopen(filename, "w"); - if (f == NULL) { - err(udev, "unable to create db file '%s': %m\n", filename); - return -1; - } - info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); - - if (udev_device_get_devnode(udev_device) != NULL) { - fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) - fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); - } - if (udev_device_get_devlink_priority(udev_device) != 0) - fprintf(f, "L:%u\n", udev_device_get_devlink_priority(udev_device)); - if (udev_device_get_event_timeout(udev_device) >= 0) - fprintf(f, "T:%u\n", udev_device_get_event_timeout(udev_device)); - if (udev_device_get_num_fake_partitions(udev_device) != 0) - fprintf(f, "A:%u\n", udev_device_get_num_fake_partitions(udev_device)); - if (udev_device_get_ignore_remove(udev_device)) - fprintf(f, "R:%u\n", udev_device_get_ignore_remove(udev_device)); - if (udev_device_get_watch_handle(udev_device) >= 0) - fprintf(f, "W:%u\n", udev_device_get_watch_handle(udev_device)); - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - if (!udev_list_entry_get_flag(list_entry)) - continue; - fprintf(f, "E:%s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - } - fclose(f); -out: - return 0; -} - -int udev_device_delete_db(struct udev_device *udev_device) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - - devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); - unlink(filename); - return 0; -} - -int udev_device_rename_db(struct udev_device *udev_device, const char *devpath_old) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename_old[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - - devpath_to_db_path(udev, devpath_old, filename_old, sizeof(filename_old)); - devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); - return rename(filename_old, filename); -} diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c new file mode 100644 index 0000000000..68dc0a5b98 --- /dev/null +++ b/libudev/libudev-device-private.c @@ -0,0 +1,139 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) +{ + char *s; + size_t l; + + s = filename; + l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); + return util_path_encode(devpath, s, l); +} + +int udev_device_update_db(struct udev_device *udev_device) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + FILE *f; + char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ + size_t devlen = strlen(udev_get_dev_path(udev))+1; + char *s; + size_t l; + struct udev_list_entry *list_entry; + int ret; + + devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); + util_create_path(udev, filename); + unlink(filename); + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) + if (udev_list_entry_get_flag(list_entry)) + goto file; + if (udev_device_get_num_fake_partitions(udev_device) != 0) + goto file; + if (udev_device_get_ignore_remove(udev_device)) + goto file; + if (udev_device_get_devlink_priority(udev_device) != 0) + goto file; + if (udev_device_get_event_timeout(udev_device) >= 0) + goto file; + if (udev_device_get_watch_handle(udev_device) >= 0) + goto file; + if (udev_device_get_devnode(udev_device) == NULL) + goto out; + + /* + * if we have only the node and symlinks to store, try not to waste + * tmpfs memory -- store values, if they fit, in a symlink target + */ + s = target; + l = util_strpcpy(&s, sizeof(target), &udev_device_get_devnode(udev_device)[devlen]); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) { + l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); + if (l == 0) { + info(udev, "size of links too large, create file\n"); + goto file; + } + } + info(udev, "create db link (%s)\n", target); + udev_selinux_setfscreatecon(udev, filename, S_IFLNK); + ret = symlink(target, filename); + udev_selinux_resetfscreatecon(udev); + if (ret == 0) + goto out; +file: + f = fopen(filename, "w"); + if (f == NULL) { + err(udev, "unable to create db file '%s': %m\n", filename); + return -1; + } + info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); + + if (udev_device_get_devnode(udev_device) != NULL) { + fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) + fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + } + if (udev_device_get_devlink_priority(udev_device) != 0) + fprintf(f, "L:%u\n", udev_device_get_devlink_priority(udev_device)); + if (udev_device_get_event_timeout(udev_device) >= 0) + fprintf(f, "T:%u\n", udev_device_get_event_timeout(udev_device)); + if (udev_device_get_num_fake_partitions(udev_device) != 0) + fprintf(f, "A:%u\n", udev_device_get_num_fake_partitions(udev_device)); + if (udev_device_get_ignore_remove(udev_device)) + fprintf(f, "R:%u\n", udev_device_get_ignore_remove(udev_device)); + if (udev_device_get_watch_handle(udev_device) >= 0) + fprintf(f, "W:%u\n", udev_device_get_watch_handle(udev_device)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + if (!udev_list_entry_get_flag(list_entry)) + continue; + fprintf(f, "E:%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + fclose(f); +out: + return 0; +} + +int udev_device_delete_db(struct udev_device *udev_device) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + + devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); + unlink(filename); + return 0; +} + +int udev_device_rename_db(struct udev_device *udev_device, const char *devpath_old) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename_old[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + + devpath_to_db_path(udev, devpath_old, filename_old, sizeof(filename_old)); + devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); + return rename(filename_old, filename); +} diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 9cda7bcb1e..9770e8b63c 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -99,7 +99,7 @@ int udev_device_get_watch_handle(struct udev_device *udev_device); int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); void udev_device_set_info_loaded(struct udev_device *device); -/* libudev-device-db-write.c */ +/* libudev-device-private.c */ int udev_device_update_db(struct udev_device *udev_device); int udev_device_delete_db(struct udev_device *udev_device); int udev_device_rename_db(struct udev_device *udev_device, const char *devpath); @@ -177,7 +177,7 @@ int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum); ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size); ssize_t udev_queue_skip_devpath(FILE *queue_file); -/* libudev-queue-export.c */ +/* libudev-queue-private.c */ struct udev_queue_export *udev_queue_export_new(struct udev *udev); void udev_queue_export_unref(struct udev_queue_export *udev_queue_export); void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); diff --git a/libudev/libudev-queue-export.c b/libudev/libudev-queue-export.c deleted file mode 100644 index 9ae680c386..0000000000 --- a/libudev/libudev-queue-export.c +++ /dev/null @@ -1,470 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * Copyright (C) 2009 Alan Jenkins - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -/* - * DISCLAIMER - The file format mentioned here is private to udev/libudev, - * and may be changed without notice. - * - * The udev event queue is exported as a binary log file. - * Each log record consists of a sequence number followed by the device path. - * - * When a new event is queued, its details are appended to the log. - * When the event finishes, a second record is appended to the log - * with the same sequence number but a null devpath. - * - * Example: - * {1, "/devices/virtual/mem/null" }, - * {2, "/devices/virtual/mem/zero" }, - * {1, "" }, - * Event 2 is still queued, but event 1 has been finished - * - * The queue does not grow indefinitely. It is periodically re-created - * to remove finished events. Atomic rename() makes this transparent to readers. - * - * The queue file starts with a single sequence number which specifies the - * minimum sequence number in the log that follows. Any events prior to this - * sequence number have already finished. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); - -struct udev_queue_export { - struct udev *udev; - int failed_count; /* number of failed events exported */ - int queued_count; /* number of unfinished events exported in queue file */ - FILE *queue_file; - unsigned long long int seqnum_max; /* earliest sequence number in queue file */ - unsigned long long int seqnum_min; /* latest sequence number in queue file */ - int waste_bytes; /* queue file bytes wasted on finished events */ -}; - -struct udev_queue_export *udev_queue_export_new(struct udev *udev) -{ - struct udev_queue_export *udev_queue_export; - unsigned long long int initial_seqnum; - - if (udev == NULL) - return NULL; - - udev_queue_export = calloc(1, sizeof(struct udev_queue_export)); - if (udev_queue_export == NULL) - return NULL; - udev_queue_export->udev = udev; - - initial_seqnum = udev_get_kernel_seqnum(udev); - udev_queue_export->seqnum_min = initial_seqnum; - udev_queue_export->seqnum_max = initial_seqnum; - - udev_queue_export_cleanup(udev_queue_export); - if (rebuild_queue_file(udev_queue_export) != 0) { - free(udev_queue_export); - return NULL; - } - - return udev_queue_export; -} - -void udev_queue_export_unref(struct udev_queue_export *udev_queue_export) -{ - if (udev_queue_export == NULL) - return; - if (udev_queue_export->queue_file != NULL) - fclose(udev_queue_export->queue_file); - free(udev_queue_export); -} - -void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) -{ - char filename[UTIL_PATH_SIZE]; - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); - unlink(filename); - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); - unlink(filename); -} - -static int skip_to(FILE *file, long offset) -{ - long old_offset; - - /* fseek may drop buffered data, avoid it for small seeks */ - old_offset = ftell(file); - if (offset > old_offset && offset - old_offset <= BUFSIZ) { - size_t skip_bytes = offset - old_offset; - char buf[skip_bytes]; - - if (fread(buf, skip_bytes, 1, file) != skip_bytes) - return -1; - } - - return fseek(file, offset, SEEK_SET); -} - -struct queue_devpaths { - unsigned int devpaths_first; /* index of first queued event */ - unsigned int devpaths_size; - long devpaths[]; /* seqnum -> offset of devpath in queue file (or 0) */ -}; - -/* - * Returns a table mapping seqnum to devpath file offset for currently queued events. - * devpaths[i] represents the event with seqnum = i + udev_queue_export->seqnum_min. - */ -static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_export) -{ - struct queue_devpaths *devpaths; - unsigned long long int range; - long devpath_offset; - ssize_t devpath_len; - unsigned long long int seqnum; - unsigned long long int n; - unsigned int i; - - /* seek to the first event in the file */ - rewind(udev_queue_export->queue_file); - udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum); - - /* allocate the table */ - range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max; - if (range - 1 > INT_MAX) { - err(udev_queue_export->udev, "queue file overflow\n"); - return NULL; - } - devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); - if (index == NULL) - return NULL; - devpaths->devpaths_size = range + 1; - - /* read all records and populate the table */ - while(1) { - if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) - break; - n = seqnum - udev_queue_export->seqnum_max; - if (n >= devpaths->devpaths_size) - goto read_error; - - devpath_offset = ftell(udev_queue_export->queue_file); - devpath_len = udev_queue_skip_devpath(udev_queue_export->queue_file); - if (devpath_len < 0) - goto read_error; - - if (devpath_len > 0) - devpaths->devpaths[n] = devpath_offset; - else - devpaths->devpaths[n] = 0; - } - - /* find first queued event */ - for (i = 0; i < devpaths->devpaths_size; i++) { - if (devpaths->devpaths[i] != 0) - break; - } - devpaths->devpaths_first = i; - - return devpaths; - -read_error: - err(udev_queue_export->udev, "queue file corrupted\n"); - free(devpaths); - return NULL; -} - -static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) -{ - unsigned long long int seqnum; - struct queue_devpaths *devpaths = NULL; - char filename[UTIL_PATH_SIZE]; - char filename_tmp[UTIL_PATH_SIZE]; - FILE *new_queue_file = NULL; - unsigned int i; - - /* read old queue file */ - if (udev_queue_export->queue_file != NULL) { - dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n", - udev_queue_export->waste_bytes); - - devpaths = build_index(udev_queue_export); - if (devpaths != NULL) - udev_queue_export->seqnum_max += devpaths->devpaths_first; - } - if (devpaths == NULL) { - dbg(udev_queue_export->udev, "creating empty queue file\n"); - udev_queue_export->queued_count = 0; - udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; - } - - /* create new queue file */ - util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); - new_queue_file = fopen(filename_tmp, "w+"); - if (new_queue_file == NULL) - goto error; - seqnum = udev_queue_export->seqnum_max; - fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); - - /* copy unfinished events only to the new file */ - if (devpaths != NULL) { - for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { - char devpath[UTIL_PATH_SIZE]; - int err; - unsigned short devpath_len; - - if (devpaths->devpaths[i] != 0) - { - skip_to(udev_queue_export->queue_file, devpaths->devpaths[i]); - err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); - devpath_len = err; - - fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); - fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); - fwrite(devpath, 1, devpath_len, new_queue_file); - } - seqnum++; - } - free(devpaths); - devpaths = NULL; - } - fflush(new_queue_file); - if (ferror(new_queue_file)) - goto error; - - /* rename the new file on top of the old one */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); - if (rename(filename_tmp, filename) != 0) - goto error; - - if (udev_queue_export->queue_file != NULL) - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = new_queue_file; - udev_queue_export->waste_bytes = 0; - - return 0; - -error: - err(udev_queue_export->udev, "failed to create queue file: %m\n"); - udev_queue_export_cleanup(udev_queue_export); - - if (udev_queue_export->queue_file != NULL) { - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - } - if (new_queue_file != NULL) - fclose(new_queue_file); - - if (devpaths != NULL) - free(devpaths); - udev_queue_export->queued_count = 0; - udev_queue_export->waste_bytes = 0; - udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; - - return -1; -} - -static int write_queue_record(struct udev_queue_export *udev_queue_export, - unsigned long long int seqnum, const char *devpath, size_t devpath_len) -{ - unsigned short len; - - if (udev_queue_export->queue_file == NULL) { - dbg(udev_queue_export->udev, "can't record event: queue file not available\n"); - return -1; - } - - if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1) - goto write_error; - - len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; - if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) - goto write_error; - if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) - goto write_error; - - /* *must* flush output; caller may fork */ - if (fflush(udev_queue_export->queue_file) != 0) - goto write_error; - - return 0; - -write_error: - /* if we failed half way through writing a record to a file, - we should not try to write any further records to it. */ - err(udev_queue_export->udev, "error writing to queue file: %m\n"); - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - - return -1; -} - -enum device_state { - DEVICE_QUEUED, - DEVICE_FINISHED, - DEVICE_FAILED, -}; - -static inline size_t queue_record_size(size_t devpath_len) -{ - return sizeof(unsigned long long int) + sizeof(unsigned short int) + devpath_len; -} - -static int update_queue(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - unsigned long long int seqnum = udev_device_get_seqnum(udev_device); - const char *devpath = NULL; - size_t devpath_len = 0; - int bytes; - int err; - - if (state == DEVICE_QUEUED) { - devpath = udev_device_get_devpath(udev_device); - devpath_len = strlen(devpath); - } - - /* recover from an earlier failed rebuild */ - if (udev_queue_export->queue_file == NULL) { - if (rebuild_queue_file(udev_queue_export) != 0) - return -1; - } - - /* when the queue files grow too large, they must be garbage collected and rebuilt */ - bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); - - /* if we're removing the last event from the queue, that's the best time to rebuild it */ - if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1 && bytes > 2048) { - /* because we don't need to read the old queue file */ - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - rebuild_queue_file(udev_queue_export); - return 0; - } - - /* try to rebuild the queue files before they grow larger than one page. */ - if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) - rebuild_queue_file(udev_queue_export); - - /* don't record a finished event, if we already dropped the event in a failed rebuild */ - if (seqnum < udev_queue_export->seqnum_max) - return 0; - - /* now write to the queue */ - if (state == DEVICE_QUEUED) { - udev_queue_export->queued_count++; - udev_queue_export->seqnum_min = seqnum; - } else { - udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0); - udev_queue_export->queued_count--; - } - err = write_queue_record(udev_queue_export, seqnum, devpath, devpath_len); - - /* try to handle ENOSPC */ - if (err != 0 && udev_queue_export->queued_count == 0) { - udev_queue_export_cleanup(udev_queue_export); - err = rebuild_queue_file(udev_queue_export); - } - - return err; -} - -static void update_failed(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - char *s; - size_t l; - - if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) - return; - - /* location of failed file */ - s = filename; - l = util_strpcpyl(&s, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); - util_path_encode(udev_device_get_devpath(udev_device), s, l); - - switch (state) { - case DEVICE_FAILED: - /* record event in the failed directory */ - if (udev_queue_export->failed_count == 0) - util_create_path(udev, filename); - udev_queue_export->failed_count++; - - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); - symlink(udev_device_get_devpath(udev_device), filename); - udev_selinux_resetfscreatecon(udev); - break; - - case DEVICE_QUEUED: - /* delete failed file */ - if (unlink(filename) == 0) { - util_delete_path(udev, filename); - udev_queue_export->failed_count--; - } - break; - - case DEVICE_FINISHED: - if (udev_device_get_devpath_old(udev_device) != NULL) { - /* "move" event - rename failed file to current name, do not delete failed */ - char filename_old[UTIL_PATH_SIZE]; - - s = filename_old; - l = util_strpcpyl(&s, sizeof(filename_old), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); - util_path_encode(udev_device_get_devpath_old(udev_device), s, l); - - if (rename(filename_old, filename) == 0) - info(udev, "renamed devpath, moved failed state of '%s' to %s'\n", - udev_device_get_devpath_old(udev_device), udev_device_get_devpath(udev_device)); - } - break; - } - - return; -} - -static int update(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - update_failed(udev_queue_export, udev_device, state); - - if (update_queue(udev_queue_export, udev_device, state) != 0) - return -1; - - return 0; -} - -int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_QUEUED); -} - -int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_FINISHED); -} - -int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_FAILED); -} diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c new file mode 100644 index 0000000000..9ae680c386 --- /dev/null +++ b/libudev/libudev-queue-private.c @@ -0,0 +1,470 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2009 Alan Jenkins + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +/* + * DISCLAIMER - The file format mentioned here is private to udev/libudev, + * and may be changed without notice. + * + * The udev event queue is exported as a binary log file. + * Each log record consists of a sequence number followed by the device path. + * + * When a new event is queued, its details are appended to the log. + * When the event finishes, a second record is appended to the log + * with the same sequence number but a null devpath. + * + * Example: + * {1, "/devices/virtual/mem/null" }, + * {2, "/devices/virtual/mem/zero" }, + * {1, "" }, + * Event 2 is still queued, but event 1 has been finished + * + * The queue does not grow indefinitely. It is periodically re-created + * to remove finished events. Atomic rename() makes this transparent to readers. + * + * The queue file starts with a single sequence number which specifies the + * minimum sequence number in the log that follows. Any events prior to this + * sequence number have already finished. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); + +struct udev_queue_export { + struct udev *udev; + int failed_count; /* number of failed events exported */ + int queued_count; /* number of unfinished events exported in queue file */ + FILE *queue_file; + unsigned long long int seqnum_max; /* earliest sequence number in queue file */ + unsigned long long int seqnum_min; /* latest sequence number in queue file */ + int waste_bytes; /* queue file bytes wasted on finished events */ +}; + +struct udev_queue_export *udev_queue_export_new(struct udev *udev) +{ + struct udev_queue_export *udev_queue_export; + unsigned long long int initial_seqnum; + + if (udev == NULL) + return NULL; + + udev_queue_export = calloc(1, sizeof(struct udev_queue_export)); + if (udev_queue_export == NULL) + return NULL; + udev_queue_export->udev = udev; + + initial_seqnum = udev_get_kernel_seqnum(udev); + udev_queue_export->seqnum_min = initial_seqnum; + udev_queue_export->seqnum_max = initial_seqnum; + + udev_queue_export_cleanup(udev_queue_export); + if (rebuild_queue_file(udev_queue_export) != 0) { + free(udev_queue_export); + return NULL; + } + + return udev_queue_export; +} + +void udev_queue_export_unref(struct udev_queue_export *udev_queue_export) +{ + if (udev_queue_export == NULL) + return; + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + free(udev_queue_export); +} + +void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) +{ + char filename[UTIL_PATH_SIZE]; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + unlink(filename); + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + unlink(filename); +} + +static int skip_to(FILE *file, long offset) +{ + long old_offset; + + /* fseek may drop buffered data, avoid it for small seeks */ + old_offset = ftell(file); + if (offset > old_offset && offset - old_offset <= BUFSIZ) { + size_t skip_bytes = offset - old_offset; + char buf[skip_bytes]; + + if (fread(buf, skip_bytes, 1, file) != skip_bytes) + return -1; + } + + return fseek(file, offset, SEEK_SET); +} + +struct queue_devpaths { + unsigned int devpaths_first; /* index of first queued event */ + unsigned int devpaths_size; + long devpaths[]; /* seqnum -> offset of devpath in queue file (or 0) */ +}; + +/* + * Returns a table mapping seqnum to devpath file offset for currently queued events. + * devpaths[i] represents the event with seqnum = i + udev_queue_export->seqnum_min. + */ +static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_export) +{ + struct queue_devpaths *devpaths; + unsigned long long int range; + long devpath_offset; + ssize_t devpath_len; + unsigned long long int seqnum; + unsigned long long int n; + unsigned int i; + + /* seek to the first event in the file */ + rewind(udev_queue_export->queue_file); + udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum); + + /* allocate the table */ + range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max; + if (range - 1 > INT_MAX) { + err(udev_queue_export->udev, "queue file overflow\n"); + return NULL; + } + devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); + if (index == NULL) + return NULL; + devpaths->devpaths_size = range + 1; + + /* read all records and populate the table */ + while(1) { + if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) + break; + n = seqnum - udev_queue_export->seqnum_max; + if (n >= devpaths->devpaths_size) + goto read_error; + + devpath_offset = ftell(udev_queue_export->queue_file); + devpath_len = udev_queue_skip_devpath(udev_queue_export->queue_file); + if (devpath_len < 0) + goto read_error; + + if (devpath_len > 0) + devpaths->devpaths[n] = devpath_offset; + else + devpaths->devpaths[n] = 0; + } + + /* find first queued event */ + for (i = 0; i < devpaths->devpaths_size; i++) { + if (devpaths->devpaths[i] != 0) + break; + } + devpaths->devpaths_first = i; + + return devpaths; + +read_error: + err(udev_queue_export->udev, "queue file corrupted\n"); + free(devpaths); + return NULL; +} + +static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) +{ + unsigned long long int seqnum; + struct queue_devpaths *devpaths = NULL; + char filename[UTIL_PATH_SIZE]; + char filename_tmp[UTIL_PATH_SIZE]; + FILE *new_queue_file = NULL; + unsigned int i; + + /* read old queue file */ + if (udev_queue_export->queue_file != NULL) { + dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n", + udev_queue_export->waste_bytes); + + devpaths = build_index(udev_queue_export); + if (devpaths != NULL) + udev_queue_export->seqnum_max += devpaths->devpaths_first; + } + if (devpaths == NULL) { + dbg(udev_queue_export->udev, "creating empty queue file\n"); + udev_queue_export->queued_count = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + } + + /* create new queue file */ + util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + new_queue_file = fopen(filename_tmp, "w+"); + if (new_queue_file == NULL) + goto error; + seqnum = udev_queue_export->seqnum_max; + fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); + + /* copy unfinished events only to the new file */ + if (devpaths != NULL) { + for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { + char devpath[UTIL_PATH_SIZE]; + int err; + unsigned short devpath_len; + + if (devpaths->devpaths[i] != 0) + { + skip_to(udev_queue_export->queue_file, devpaths->devpaths[i]); + err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); + devpath_len = err; + + fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); + fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); + fwrite(devpath, 1, devpath_len, new_queue_file); + } + seqnum++; + } + free(devpaths); + devpaths = NULL; + } + fflush(new_queue_file); + if (ferror(new_queue_file)) + goto error; + + /* rename the new file on top of the old one */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + if (rename(filename_tmp, filename) != 0) + goto error; + + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = new_queue_file; + udev_queue_export->waste_bytes = 0; + + return 0; + +error: + err(udev_queue_export->udev, "failed to create queue file: %m\n"); + udev_queue_export_cleanup(udev_queue_export); + + if (udev_queue_export->queue_file != NULL) { + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + } + if (new_queue_file != NULL) + fclose(new_queue_file); + + if (devpaths != NULL) + free(devpaths); + udev_queue_export->queued_count = 0; + udev_queue_export->waste_bytes = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + + return -1; +} + +static int write_queue_record(struct udev_queue_export *udev_queue_export, + unsigned long long int seqnum, const char *devpath, size_t devpath_len) +{ + unsigned short len; + + if (udev_queue_export->queue_file == NULL) { + dbg(udev_queue_export->udev, "can't record event: queue file not available\n"); + return -1; + } + + if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1) + goto write_error; + + len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; + if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) + goto write_error; + if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) + goto write_error; + + /* *must* flush output; caller may fork */ + if (fflush(udev_queue_export->queue_file) != 0) + goto write_error; + + return 0; + +write_error: + /* if we failed half way through writing a record to a file, + we should not try to write any further records to it. */ + err(udev_queue_export->udev, "error writing to queue file: %m\n"); + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + + return -1; +} + +enum device_state { + DEVICE_QUEUED, + DEVICE_FINISHED, + DEVICE_FAILED, +}; + +static inline size_t queue_record_size(size_t devpath_len) +{ + return sizeof(unsigned long long int) + sizeof(unsigned short int) + devpath_len; +} + +static int update_queue(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + unsigned long long int seqnum = udev_device_get_seqnum(udev_device); + const char *devpath = NULL; + size_t devpath_len = 0; + int bytes; + int err; + + if (state == DEVICE_QUEUED) { + devpath = udev_device_get_devpath(udev_device); + devpath_len = strlen(devpath); + } + + /* recover from an earlier failed rebuild */ + if (udev_queue_export->queue_file == NULL) { + if (rebuild_queue_file(udev_queue_export) != 0) + return -1; + } + + /* when the queue files grow too large, they must be garbage collected and rebuilt */ + bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); + + /* if we're removing the last event from the queue, that's the best time to rebuild it */ + if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1 && bytes > 2048) { + /* because we don't need to read the old queue file */ + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + rebuild_queue_file(udev_queue_export); + return 0; + } + + /* try to rebuild the queue files before they grow larger than one page. */ + if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) + rebuild_queue_file(udev_queue_export); + + /* don't record a finished event, if we already dropped the event in a failed rebuild */ + if (seqnum < udev_queue_export->seqnum_max) + return 0; + + /* now write to the queue */ + if (state == DEVICE_QUEUED) { + udev_queue_export->queued_count++; + udev_queue_export->seqnum_min = seqnum; + } else { + udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0); + udev_queue_export->queued_count--; + } + err = write_queue_record(udev_queue_export, seqnum, devpath, devpath_len); + + /* try to handle ENOSPC */ + if (err != 0 && udev_queue_export->queued_count == 0) { + udev_queue_export_cleanup(udev_queue_export); + err = rebuild_queue_file(udev_queue_export); + } + + return err; +} + +static void update_failed(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + char *s; + size_t l; + + if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) + return; + + /* location of failed file */ + s = filename; + l = util_strpcpyl(&s, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); + util_path_encode(udev_device_get_devpath(udev_device), s, l); + + switch (state) { + case DEVICE_FAILED: + /* record event in the failed directory */ + if (udev_queue_export->failed_count == 0) + util_create_path(udev, filename); + udev_queue_export->failed_count++; + + udev_selinux_setfscreatecon(udev, filename, S_IFLNK); + symlink(udev_device_get_devpath(udev_device), filename); + udev_selinux_resetfscreatecon(udev); + break; + + case DEVICE_QUEUED: + /* delete failed file */ + if (unlink(filename) == 0) { + util_delete_path(udev, filename); + udev_queue_export->failed_count--; + } + break; + + case DEVICE_FINISHED: + if (udev_device_get_devpath_old(udev_device) != NULL) { + /* "move" event - rename failed file to current name, do not delete failed */ + char filename_old[UTIL_PATH_SIZE]; + + s = filename_old; + l = util_strpcpyl(&s, sizeof(filename_old), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); + util_path_encode(udev_device_get_devpath_old(udev_device), s, l); + + if (rename(filename_old, filename) == 0) + info(udev, "renamed devpath, moved failed state of '%s' to %s'\n", + udev_device_get_devpath_old(udev_device), udev_device_get_devpath(udev_device)); + } + break; + } + + return; +} + +static int update(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + update_failed(udev_queue_export, udev_device, state); + + if (update_queue(udev_queue_export, udev_device, state) != 0) + return -1; + + return 0; +} + +int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_QUEUED); +} + +int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_FINISHED); +} + +int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_FAILED); +} diff --git a/udev/Makefile.am b/udev/Makefile.am index f2ceb99774..14ec79e8d6 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -22,11 +22,11 @@ common_files = \ ../libudev/libudev-util.c \ ../libudev/libudev-util-private.c \ ../libudev/libudev-device.c \ - ../libudev/libudev-device-db-write.c \ + ../libudev/libudev-device-private.c \ ../libudev/libudev-monitor.c \ ../libudev/libudev-enumerate.c \ ../libudev/libudev-queue.c \ - ../libudev/libudev-queue-export.c \ + ../libudev/libudev-queue-private.c \ ../libudev/libudev-ctrl.c if USE_SELINUX -- cgit v1.2.3-54-g00ecf From 3dd8cbecde3c7708c5c5a71d4eb1dd042a5dc7fc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Jun 2009 00:17:35 +0200 Subject: rules: remove scsi ch module loading rule --- TODO | 6 +++--- rules/rules.d/80-drivers.rules | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index af745ff5a2..5cea74e758 100644 --- a/TODO +++ b/TODO @@ -3,8 +3,8 @@ o add tests for kernel provided DEVNAME logic o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) o remove MMC rules, they got a modalias now (2.6.30) - o add scsi:t-0x09* to "ch" and remove modprobe rule (2.6.30) - o drop all support for the DEPRECATED sysfs layout - o "udevadm control" commands will only accept the -- syntax + o symlink names to udevadm will no longer be resolved to old command names + o "udevadm control" commands will only accept the -- syntax + o drop all support for the DEPRECATED sysfs layout o add warning for BUS, SYSFS, ID diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index 7e13e80764..68420b9b19 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -8,7 +8,6 @@ SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -b tifm_ms" SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -b --all ms_block mspro_block" SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -b i2o_block" -SUBSYSTEM=="scsi", ATTR{type}=="8", RUN+="/sbin/modprobe -b ch" SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe -b sg" SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -b ppdev" -- cgit v1.2.3-54-g00ecf From 20fa0fd6a002d6bf1eb1c180515c0fed336ac0b2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Jun 2009 00:18:00 +0200 Subject: update NEWS --- NEWS | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 8b51c10a84..3d5a53d074 100644 --- a/NEWS +++ b/NEWS @@ -4,8 +4,8 @@ Bugfixes. Event processes now get re-used after they handled an event. This reduces pressure on the CPU significantly because cloned event processes no longer -cause page faults in the main daemon. After the events have settled, the -no longer needed worker processes get killed. +cause page faults in the main daemon. After the events have settled, a few +worker processes stay around for future events, all others get cleaned up. To be able to use signalfd(), udev depends on kernel version 2.6.25 now. Also inotify support is required now to run udev. @@ -14,6 +14,9 @@ The format of the queue exported by the udev damon has changed. There is no longer a /dev/.udev/queue/ directory. The current event queue can be accessed with udevadm settle and libudedv. +Libudev does not have the unstable API header anymore. From now on, +incompatible changes will be handled by bumping the library major version. + udev 142 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From ff5d99e0b04d1e49204be60ac5641b01f89c34ac Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Jun 2009 15:55:24 +0200 Subject: udevadm: info -revert "accept --query without argument" Getopt is too dumb, the optional argument breaks "udevadm -q symlink". --- udev/udevadm-info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 2ffce27ed7..fa09b98299 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -221,7 +221,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) static const struct option options[] = { { "name", required_argument, NULL, 'n' }, { "path", required_argument, NULL, 'p' }, - { "query", optional_argument, NULL, 'q' }, + { "query", required_argument, NULL, 'q' }, { "attribute-walk", no_argument, NULL, 'a' }, { "export-db", no_argument, NULL, 'e' }, { "root", no_argument, NULL, 'r' }, @@ -254,7 +254,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) int option; struct stat statbuf; - option = getopt_long(argc, argv, "aed:n:p:q::rxPVh", options, NULL); + option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); if (option == -1) break; @@ -317,7 +317,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) break; case 'q': action = ACTION_QUERY; - if (optarg == NULL || strcmp(optarg, "property") == 0 || strcmp(optarg, "env") == 0) { + if (strcmp(optarg, "property") == 0 || strcmp(optarg, "env") == 0) { query = QUERY_PROPERTY; } else if (strcmp(optarg, "name") == 0) { query = QUERY_NAME; -- cgit v1.2.3-54-g00ecf From 262d5cca892db33cb0a154718577f06d04982ba3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Jun 2009 17:58:14 +0200 Subject: README: add kernel options --- README | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README b/README index a14e5c0fcf..d993184a77 100644 --- a/README +++ b/README @@ -10,7 +10,16 @@ Important Note: Requirements: - Version 2.6.25 of the Linux kernel with sysfs, procfs, signalfd, inotify, - unix domain sockets, networking and hotplug enabled. + unix domain sockets, networking and hotplug enabled: + CONFIG_HOTPLUG=y + CONFIG_UEVENT_HELPER_PATH="" + CONFIG_NET=y + CONFIG_UNIX=y + CONFIG_SYSFS=y + CONFIG_SYSFS_DEPRECATED*=n + CONFIG_PROC_FS=y + CONFIG_TMPFS=y + CONFIG_TMPFS_POSIX_ACL=y - For reliable operation, the kernel must not use the CONFIG_SYSFS_DEPRECATED* option. -- cgit v1.2.3-54-g00ecf From 98ad80f8737b0cfcd264e32e37d6c5d4e35e4ea5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Jun 2009 17:59:46 +0200 Subject: README: add INOTIFY and SIGNALFD --- README | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README b/README index d993184a77..d438afae46 100644 --- a/README +++ b/README @@ -20,6 +20,8 @@ Requirements: CONFIG_PROC_FS=y CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y + CONFIG_INOTIFY=y + CONFIG_SIGNALFD=y - For reliable operation, the kernel must not use the CONFIG_SYSFS_DEPRECATED* option. -- cgit v1.2.3-54-g00ecf From 045a3bc89e9cdb991aed3043792f032e4f397f11 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 14 Jun 2009 17:53:15 +0200 Subject: USE_LOG -> ENABLE_LOGGING, DEBUG -> ENABLE_DEBUG, USE_SELINUX -> WITH_SELINUX --- configure.ac | 18 ++++++++---------- extras/floppy/Makefile.am | 2 +- libudev/libudev-private.h | 6 +++--- udev/Makefile.am | 2 +- udev/udev-rules.c | 4 ++-- 5 files changed, 15 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index e9c949647a..85ca34aec6 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ libdir_name=$with_libdir_name AC_SUBST(libdir_name) AC_ARG_WITH(selinux, - AS_HELP_STRING([--with-selinux], [compile with SELinux support]), + AS_HELP_STRING([--with-selinux], [enable SELinux support]), [], with_selinux=no) if test "x$with_selinux" = xyes; then LIBS_save=$LIBS @@ -45,26 +45,24 @@ if test "x$with_selinux" = xyes; then [], AC_MSG_ERROR([SELinux selected but libselinux not found])) LIBS=$LIBS_save - AC_DEFINE(USE_SELINUX, [1] ,[compile with SELinux support]) SELINUX_LIBS="-lselinux -lsepol" + AC_DEFINE(WITH_SELINUX, [1] ,[SELinux support.]) fi AC_SUBST([SELINUX_LIBS]) -AM_CONDITIONAL(USE_SELINUX, [test "x$with_selinux" = xyes], [compile with SELinux support]) +AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = xyes]) AC_ARG_ENABLE(debug, - AS_HELP_STRING([--enable-debug], [turn on debugging]), + AS_HELP_STRING([--enable-debug], [enable debug messages]), [], enable_debug=no) if test "x$enable_debug" = "xyes"; then - AC_DEFINE(DEBUG, [1] ,[Compile in debug messages]) - DEBUG_CFLAGS="-DDEBUG" + AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) fi -AC_SUBST(DEBUG_CFLAGS) AC_ARG_ENABLE(logging, - AS_HELP_STRING([--disable-logging], [turn off logging/syslog]), + AS_HELP_STRING([--disable-logging], [disable system logging]), [], enable_logging=yes) -if test "x$enable_logging" != "xno"; then - AC_DEFINE(USE_LOG, [1] ,[Use logging/syslog]) +if test "x$enable_logging" = "xyes"; then + AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) fi AC_CONFIG_HEADERS(config.h) diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index cbdcf6e8fb..6854d62d57 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -15,7 +15,7 @@ create_floppy_devices_SOURCES = \ ../../libudev/libudev-device.c \ ../../libudev/libudev-enumerate.c -if USE_SELINUX +if WITH_SELINUX create_floppy_devices_SOURCES += \ ../../libudev/libudev-selinux-private.c create_floppy_devices_LDADD = \ diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 9770e8b63c..5c10b4e37a 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -29,8 +29,8 @@ udev_log_null(struct udev *udev, const char *format, ...) {} udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg); \ } while (0) -#ifdef USE_LOG -# ifdef DEBUG +#ifdef ENABLE_LOGGING +# ifdef ENABLE_DEBUG # define dbg(udev, arg...) udev_log_cond(udev, LOG_DEBUG, ## arg) # else # define dbg(udev, arg...) udev_log_null(udev, ## arg) @@ -219,7 +219,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); /* libudev-selinux-private.c */ -#ifndef USE_SELINUX +#ifndef WITH_SELINUX static inline void udev_selinux_init(struct udev *udev) {} static inline void udev_selinux_exit(struct udev *udev) {} static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} diff --git a/udev/Makefile.am b/udev/Makefile.am index 14ec79e8d6..5f6f7c54c0 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -29,7 +29,7 @@ common_files = \ ../libudev/libudev-queue-private.c \ ../libudev/libudev-ctrl.c -if USE_SELINUX +if WITH_SELINUX common_files += \ ../libudev/libudev-selinux-private.c common_ldadd += \ diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 5cb381ebac..7db890fed9 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -211,7 +211,7 @@ struct rule_tmp { unsigned int token_cur; }; -#ifdef DEBUG +#ifdef ENABLE_DEBUG static const char *operation_str(enum operation_type type) { static const char *operation_strs[] = { @@ -421,7 +421,7 @@ static inline const char *operation_str(enum operation_type type) { return NULL; static inline const char *token_str(enum token_type type) { return NULL; } static inline void dump_token(struct udev_rules *rules, struct token *token) {} static inline void dump_rules(struct udev_rules *rules) {} -#endif /* DEBUG */ +#endif /* ENABLE_DEBUG */ static int add_new_string(struct udev_rules *rules, const char *str, size_t bytes) { -- cgit v1.2.3-54-g00ecf From 7e8ea3320d194f34393224e4cecb39fbc8c94e57 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sun, 14 Jun 2009 18:27:52 +0200 Subject: rules: Gentoo update --- rules/gentoo/30-kernel-compat.rules | 59 ++++--------------------------------- 1 file changed, 6 insertions(+), 53 deletions(-) diff --git a/rules/gentoo/30-kernel-compat.rules b/rules/gentoo/30-kernel-compat.rules index d07e7fa1c3..95da1522d3 100644 --- a/rules/gentoo/30-kernel-compat.rules +++ b/rules/gentoo/30-kernel-compat.rules @@ -2,74 +2,27 @@ ACTION!="add|change", GOTO="kernel_compat_end" -# -# rules to workaround bad sysfs timing -# - -ACTION!="add", GOTO="kernel_compat_wait_end" - -# workarounds needed to synchronize with sysfs -# needed for kernels < v2.6.18-rc1 -DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus" -SUBSYSTEM=="scsi", KERNEL=="[0-9]*:[0-9]*", WAIT_FOR_SYSFS="ioerr_cnt" - -# needed for kernels <2.6.16 -SUBSYSTEM=="net", WAIT_FOR_SYSFS="address" - -# needed for kernels <2.6.17 -SUBSYSTEM=="net", ENV{PHYSDEVDRIVER}=="?*", WAIT_FOR_SYSFS="device/driver" - -LABEL="kernel_compat_wait_end" - # # naming device rules # -# old style usb sysfs devices -# needed for kernels <2.6.22 -SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="usb", MODE="0664" - -# /sys/class/block will export this -# needed for kernels <2.6.25-rc1 -SUBSYSTEM!="block", GOTO="block_devtype_end" -ENV{DEVTYPE}!="?*", ATTR{range}=="?*", ENV{DEVTYPE}="disk" -ENV{DEVTYPE}!="?*", ATTR{start}=="?*", ENV{DEVTYPE}="partition" -LABEL="block_devtype_end" - +# dvb device naming +# needed for kernels <2.6.29-rc1 +SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" # # module loading rules # ACTION!="add", GOTO="kernel_compat_end" -# this driver is broken and should not be loaded automatically -# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=398962 -# needed for kernels <2.6.21 -SUBSYSTEM=="platform", ENV{MODALIAS}=="i82365", ENV{MODALIAS}="" - # No need for more code, as MODALIAS is present ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" +# needed for kernel <2.6.30-rc1 +SUBSYSTEM=="scsi", ATTR{type}=="8", RUN+="/sbin/modprobe -b ch" + # needed for kernel <2.6.27-rc5 # acpi will do on newer kernels SUBSYSTEM=="pnp", DRIVER!="?*", \ RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" -# needed for kernels <2.6.22 -SUBSYSTEM!="scsi_device", GOTO="kernel_compat_end" - - # Parts taken from redhat-rules - # sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC - # sr: 4 TYPE_WORM, 5 TYPE_ROM - # st/osst: 1 TYPE_TAPE - - ATTRS{type}=="0|7|14", RUN+="/sbin/modprobe sd_mod" - ATTRS{type}=="4|5", RUN+="/sbin/modprobe sr_mod" - ATTRS{type}=="8", RUN+="/sbin/modprobe ch" - - ATTRS{type}=="1", ATTRS{vendor}=="On[sS]tream", \ - ATTRS{model}!="ADR*", RUN+="/sbin/modprobe osst", GOTO="kernel_compat_end" - ATTRS{type}=="1", RUN+="/sbin/modprobe st" - -LABEL="kernel_compat_end" - -- cgit v1.2.3-54-g00ecf From 26812f0a13eacb8615f66f9048cd9575b2b8a2cf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Jun 2009 13:22:21 +0200 Subject: libudev: add gtk-doc --- .gitignore | 1 + Makefile.am | 5 ++ NEWS | 14 +++-- autogen.sh | 3 +- configure.ac | 3 ++ libudev/Makefile.am | 3 ++ libudev/docs/.gitignore | 17 ++++++ libudev/docs/Makefile.am | 99 +++++++++++++++++++++++++++++++++++ libudev/docs/libudev-docs.sgml | 31 +++++++++++ libudev/docs/libudev-sections.txt | 107 ++++++++++++++++++++++++++++++++++++++ libudev/docs/version.xml.in | 1 + m4/.gitignore | 2 + 12 files changed, 281 insertions(+), 5 deletions(-) create mode 100644 libudev/docs/.gitignore create mode 100644 libudev/docs/Makefile.am create mode 100644 libudev/docs/libudev-docs.sgml create mode 100644 libudev/docs/libudev-sections.txt create mode 100644 libudev/docs/version.xml.in diff --git a/.gitignore b/.gitignore index 7f1fbb63ee..2be332aa16 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ configure stamp-h1 depcomp udev-test-install +gtk-doc.make diff --git a/Makefile.am b/Makefile.am index 678a3e426a..fd7538658b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,6 +20,8 @@ CLEANFILES = \ ACLOCAL_AMFLAGS = -I m4 +DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc + clean-local: rm -rf udev-test-install @@ -55,3 +57,6 @@ git-release: cat .git/refs/heads/master > .git/refs/tags/$(VERSION) git gc git prune + +doc-sync: + rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ diff --git a/NEWS b/NEWS index 3d5a53d074..c8480fa2b3 100644 --- a/NEWS +++ b/NEWS @@ -3,12 +3,13 @@ udev 143 Bugfixes. Event processes now get re-used after they handled an event. This reduces -pressure on the CPU significantly because cloned event processes no longer -cause page faults in the main daemon. After the events have settled, a few -worker processes stay around for future events, all others get cleaned up. +the number of forks and the pressure on the CPU significantly, because +cloned event processes no longer cause page faults in the main daemon. +After the events have settled, a few worker processes stay around for +future events, all others get cleaned up. To be able to use signalfd(), udev depends on kernel version 2.6.25 now. -Also inotify support is required now to run udev. +Also inotify support is mandatory now to run udev. The format of the queue exported by the udev damon has changed. There is no longer a /dev/.udev/queue/ directory. The current event queue can be @@ -17,6 +18,11 @@ accessed with udevadm settle and libudedv. Libudev does not have the unstable API header anymore. From now on, incompatible changes will be handled by bumping the library major version. +To build udev from the git tree gtk-doc is needed now. The tarballs will +build without it and contain the pre-built documentation. An online copy +is available here: + http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/ + udev 142 ======== Bugfixes. diff --git a/autogen.sh b/autogen.sh index fb96d4aeb1..d1477aa7a1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,5 +1,6 @@ #!/bin/sh -e +gtkdocize autoreconf --install --symlink CFLAGS="-g -Wall \ @@ -8,7 +9,7 @@ CFLAGS="-g -Wall \ -Wpointer-arith -Wsign-compare -Wchar-subscripts \ -Wstrict-prototypes -Wshadow \ -Wformat=2 -Wtype-limits" -args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux" +args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux --enable-gtk-doc" libdir=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd)) case "$1" in diff --git a/configure.ac b/configure.ac index 85ca34aec6..dd6161738a 100644 --- a/configure.ac +++ b/configure.ac @@ -9,6 +9,7 @@ dnl AM_SILENT_RULES AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) AC_PROG_LIBTOOL +GTK_DOC_CHECK(1.10) dnl /* prefix is /usr, exec_prefix is /, if overridden exec_prefix follows prefix */ AC_PREFIX_DEFAULT([/usr]) @@ -70,6 +71,8 @@ AC_CONFIG_FILES([ Makefile libudev/Makefile libudev/libudev.pc + libudev/docs/Makefile + libudev/docs/version.xml udev/Makefile rules/Makefile extras/Makefile diff --git a/libudev/Makefile.am b/libudev/Makefile.am index 1f0bf2f3ad..f8a85addae 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -1,5 +1,8 @@ include $(top_srcdir)/Makefile.am.inc +SUBDIRS = \ + docs + noinst_PROGRAMS = \ test-libudev diff --git a/libudev/docs/.gitignore b/libudev/docs/.gitignore new file mode 100644 index 0000000000..84db3aa997 --- /dev/null +++ b/libudev/docs/.gitignore @@ -0,0 +1,17 @@ +html/ +tmpl/ +xml/ +*.stamp +version.xml +libudev-decl-list.txt +libudev-decl.txt +libudev-overrides.txt +libudev-undeclared.txt +libudev-undocumented.txt +libudev-unused.txt +libudev.args +libudev.hierarchy +libudev.interfaces +libudev.prerequisites +libudev.signals + diff --git a/libudev/docs/Makefile.am b/libudev/docs/Makefile.am new file mode 100644 index 0000000000..59ee0aa46b --- /dev/null +++ b/libudev/docs/Makefile.am @@ -0,0 +1,99 @@ +## Process this file with automake to produce Makefile.in + +# We require automake 1.10 at least. +AUTOMAKE_OPTIONS = 1.10 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=libudev + +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=2 + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=.. + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS= + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS= + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-mkhtml +MKHTML_OPTIONS= + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS= + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=$(top_srcdir)/libudev/libudev*.h +CFILE_GLOB=$(top_srcdir)/libudev/libudev*.c + +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h +EXTRA_HFILES= + +# Header files to ignore when scanning. Use base file name, no paths +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES= + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES= + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = version.xml + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files= + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +GTKDOC_CFLAGS= +GTKDOC_LIBS= + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +include $(top_srcdir)/gtk-doc.make + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +EXTRA_DIST += version.xml.in + +# Files not to distribute +# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types +# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt +#DISTCLEANFILES += + +# Comment this out if you want your docs-status tested during 'make check' +if ENABLE_GTK_DOC +#TESTS_ENVIRONMENT = cd $(srcsrc) +#TESTS = $(GTKDOC_CHECK) +endif diff --git a/libudev/docs/libudev-docs.sgml b/libudev/docs/libudev-docs.sgml new file mode 100644 index 0000000000..b0372818c6 --- /dev/null +++ b/libudev/docs/libudev-docs.sgml @@ -0,0 +1,31 @@ + + +]> + + + libudev Reference Manual + for libudev version &version; + + 2009 + Kay Sievers <kay.sievers@vrfy.org> + + + + + libudev + + + + + + + + + + API Index + + + diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt new file mode 100644 index 0000000000..4d70bca322 --- /dev/null +++ b/libudev/docs/libudev-sections.txt @@ -0,0 +1,107 @@ +
                    +libudev +udev +udev +udev_ref +udev_unref +udev_new +udev_set_log_fn +udev_get_log_priority +udev_set_log_priority +udev_get_sys_path +udev_get_dev_path +udev_get_userdata +udev_set_userdata +
                    + +
                    +libudev-list +udev_list +udev_list_entry +udev_list_entry_get_next +udev_list_entry_get_by_name +udev_list_entry_get_name +udev_list_entry_get_value +udev_list_entry_foreach +
                    + +
                    +libudev-device +udev_device +udev_device +udev_device_ref +udev_device_unref +udev_device_get_udev +udev_device_new_from_syspath +udev_device_new_from_devnum +udev_device_new_from_subsystem_sysname +udev_device_get_parent +udev_device_get_parent_with_subsystem_devtype +udev_device_get_devpath +udev_device_get_subsystem +udev_device_get_devtype +udev_device_get_syspath +udev_device_get_sysname +udev_device_get_sysnum +udev_device_get_devnode +udev_device_get_devlinks_list_entry +udev_device_get_properties_list_entry +udev_device_get_property_value +udev_device_get_driver +udev_device_get_devnum +udev_device_get_action +udev_device_get_sysattr_value +
                    + +
                    +libudev-monitor +udev_monitor +udev_monitor +udev_monitor_ref +udev_monitor_unref +udev_monitor_get_udev +udev_monitor_new_from_netlink +udev_monitor_new_from_socket +udev_monitor_enable_receiving +udev_monitor_get_fd +udev_monitor_receive_device +udev_monitor_filter_add_match_subsystem_devtype +udev_monitor_filter_update +udev_monitor_filter_remove +
                    + +
                    +libudev-enumerate +udev_enumerate +udev_enumerate +udev_enumerate_ref +udev_enumerate_unref +udev_enumerate_get_udev +udev_enumerate_new +udev_enumerate_add_match_subsystem +udev_enumerate_add_nomatch_subsystem +udev_enumerate_add_match_sysattr +udev_enumerate_add_nomatch_sysattr +udev_enumerate_add_match_property +udev_enumerate_add_syspath +udev_enumerate_scan_devices +udev_enumerate_scan_subsystems +udev_enumerate_get_list_entry +
                    + +
                    +libudev-queue +udev_queue +udev_queue +udev_queue_ref +udev_queue_unref +udev_queue_get_udev +udev_queue_new +udev_queue_get_udev_is_active +udev_queue_get_queue_is_empty +udev_queue_get_seqnum_is_finished +udev_queue_get_seqnum_sequence_is_finished +udev_queue_get_queued_list_entry +udev_queue_get_failed_list_entry +
                    + diff --git a/libudev/docs/version.xml.in b/libudev/docs/version.xml.in new file mode 100644 index 0000000000..d78bda9342 --- /dev/null +++ b/libudev/docs/version.xml.in @@ -0,0 +1 @@ +@VERSION@ diff --git a/m4/.gitignore b/m4/.gitignore index e1b74742f1..0ca2c03722 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -1,2 +1,4 @@ libtool.m4 lt*m4 +gtk-doc.m4 + -- cgit v1.2.3-54-g00ecf From 1e5113228f8c5cde04b03616485e0c4ce54c3320 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Jun 2009 13:22:38 +0200 Subject: libudev: update documentation --- libudev/libudev-device.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++ libudev/libudev-list.c | 30 +++++++++++ libudev/libudev.c | 41 +++++++++++++- libudev/libudev.h | 15 ++++-- 4 files changed, 217 insertions(+), 5 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 96cc2dba1c..aef6256734 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -23,6 +23,11 @@ #include "libudev.h" #include "libudev-private.h" +/** + * udev_device: + * + * Representation of a kernel sys device. + */ struct udev_device { struct udev *udev; struct udev_device *parent_device; @@ -341,6 +346,23 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * return udev_device; } +/** + * udev_device_new_from_devnum: + * @udev: udev library context + * @type: char or block device + * @devnum: device major/minor number + * + * Create new udev device, and fill in information from the sys + * device and the udev database entry. The device is looked up + * by its major/minor number. Character and block device numbers + * are not unique across the two types, they do not share the same + * range of numbers. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) { char path[UTIL_PATH_SIZE]; @@ -392,6 +414,22 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de return device; } +/** + * udev_device_new_from_subsystem_sysname: + * @udev: udev library context + * @subsystem: the subsytem of the device + * @sysname: the name of the device + * + * Create new udev device, and fill in information from the sys + * device and the udev database entry. The device is looked up + * by the subsytem and name string of the device, like "mem", + * "zero", or "block", "sda". + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) { char path_full[UTIL_PATH_SIZE]; @@ -495,6 +533,25 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic return NULL; } +/** + * udev_device_get_parent: + * @udev_device: the device to start searching from + * + * Find the next parent device, and fill in information from the sys + * device and the udev database entry. + * + * The returned the device is not referenced. It is attached to the + * child device, and will be cleaned up when the child device + * is cleaned up. + * + * It is not neccessarily just the upper level directory, empty or not + * recognized sys directories are ignored. + * + * It can be called as many times as needed, without caring about + * references. + * + * Returns: a new udev device, or #NULL, if it no parent exist. + **/ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) { if (udev_device == NULL) @@ -508,6 +565,25 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) return udev_device->parent_device; } +/** + * udev_device_get_parent_with_subsystem_devtype: + * @udev_device: udev device to start searching from + * @subsystem: the subsytem of the device + * @devtype: the type (DEVTYPE) of the device + * + * Find the next parent device, with a matching subsystem and devtype + * value, and fill in information from the sys device and the udev + * database entry. + * + * The returned the device is not referenced. It is attached to the + * child device, and will be cleaned up when the child device + * is cleaned up. + * + * It can be called as many times as needed, without caring about + * references. + * + * Returns: a new udev device, or #NULL, if no matching parent exists. + **/ struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) { struct udev_device *parent; @@ -631,6 +707,12 @@ const char *udev_device_get_syspath(struct udev_device *udev_device) return udev_device->syspath; } +/** + * udev_device_get_sysname: + * @udev_device: udev device + * + * Returns: the sys name of the device device + **/ const char *udev_device_get_sysname(struct udev_device *udev_device) { if (udev_device == NULL) @@ -638,6 +720,12 @@ const char *udev_device_get_sysname(struct udev_device *udev_device) return udev_device->sysname; } +/** + * udev_device_get_sysnum: + * @udev_device: udev device + * + * Returns: the trailing number of of the device name + **/ const char *udev_device_get_sysnum(struct udev_device *udev_device) { if (udev_device == NULL) @@ -790,6 +878,12 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device return udev_list_get_entry(&udev_device->properties_list); } +/** + * udev_device_get_driver: + * @udev_device: udev device + * + * Returns: the driver string or #NULL, if ther is no driver attached. + **/ const char *udev_device_get_driver(struct udev_device *udev_device) { char driver[UTIL_NAME_SIZE]; @@ -804,6 +898,12 @@ const char *udev_device_get_driver(struct udev_device *udev_device) return udev_device->driver; } +/** + * udev_device_get_devnum: + * @udev_device: udev device + * + * Returns: the device major/minor number. + **/ dev_t udev_device_get_devnum(struct udev_device *udev_device) { if (udev_device == NULL) @@ -813,6 +913,16 @@ dev_t udev_device_get_devnum(struct udev_device *udev_device) return udev_device->devnum; } +/** + * udev_device_get_action: + * @udev_device: udev device + * + * This is only valid if the device was received through a monitor. Devices read from + * sys do not have an action string. Usual actions are: add, remove, change, online, + * offline. + * + * Returns: the kernel action value, or #NULL if there is no action value available. + **/ const char *udev_device_get_action(struct udev_device *udev_device) { if (udev_device == NULL) @@ -820,6 +930,15 @@ const char *udev_device_get_action(struct udev_device *udev_device) return udev_device->action; } +/** + * udev_device_get_devnum: + * @udev_device: udev device + * + * This is only valid if the device was received through a monitor. Devices read from + * sys do not have a sequence number. + * + * Returns: the kernel event sequence number, or 0 if there is no sequence number available. + **/ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) { if (udev_device == NULL) @@ -827,6 +946,16 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) return udev_device->seqnum; } +/** + * udev_device_get_sysattr_value: + * @udev_device: udev device + * @sysattr: attribute name + * + * The retrieved value is cached in the device. Repeated reads will return the same + * value and not open the attribute again. + * + * Returns: the content of a sys attribute file, or #NULL if there is no sys attribute value. + **/ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) { struct udev_list_entry *list_entry; @@ -1025,6 +1154,13 @@ struct udev_list_entry *udev_device_add_property_from_string(struct udev_device return udev_device_add_property(udev_device, name, val); } +/** + * udev_device_get_property_value: + * @udev_device: udev device + * @key: property name + * + * Returns: the value of a device property, or #NULL if there is no such property. + **/ const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) { struct udev_list_entry *list_entry; diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c index 182d75aa8a..bd9792ad6c 100644 --- a/libudev/libudev-list.c +++ b/libudev/libudev-list.c @@ -19,6 +19,11 @@ #include "libudev.h" #include "libudev-private.h" +/** + * udev_list_entry: + * + * One entry in a list, containing a name and an optional value. + */ struct udev_list_entry { struct udev_list_node node; struct udev *udev; @@ -180,6 +185,12 @@ struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) return list_node_to_entry(list->next); } +/** + * udev_list_entry_get_next: + * @list_entry: current entry + * + * Returns: the next entry from the list, #NULL is no more entries are found. + */ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) { struct udev_list_node *next; @@ -193,6 +204,13 @@ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_en return list_node_to_entry(next); } +/** + * udev_list_entry_get_by_name: + * @list_entry: current entry + * @name: name string to match + * + * Returns: the entry where @name matched, #NULL if no matching entry is found. + */ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) { struct udev_list_entry *entry; @@ -206,6 +224,12 @@ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list return NULL; } +/** + * udev_list_entry_get_name: + * @list_entry: current entry + * + * Returns: the name string of this entry. + */ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) { if (list_entry == NULL) @@ -213,6 +237,12 @@ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) return list_entry->name; } +/** + * udev_list_entry_get_value: + * @list_entry: current entry + * + * Returns: the value string of this entry. + */ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) { if (list_entry == NULL) diff --git a/libudev/libudev.c b/libudev/libudev.c index 6645298544..d197ba7b19 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -21,6 +21,11 @@ #include "libudev.h" #include "libudev-private.h" +/** + * udev: + * + * Library context, passed to all operations. + */ struct udev { int refcount; void (*log_fn)(struct udev *udev, @@ -54,6 +59,15 @@ static void log_stderr(struct udev *udev, vfprintf(stderr, format, args); } +/** + * udev_get_userdata: + * @udev: udev library context + * + * Retrieve stored data pointer from library context. This might be useful + * to access from callbacks. + * + * Returns: stored userdata + **/ void *udev_get_userdata(struct udev *udev) { if (udev == NULL) @@ -61,6 +75,13 @@ void *udev_get_userdata(struct udev *udev) return udev->userdata; } +/** + * udev_set_userdata: + * @udev: udev library context + * @userdata: data pointer + * + * Store custom @userdata in the library context. + **/ void udev_set_userdata(struct udev *udev, void *userdata) { if (udev == NULL) @@ -71,7 +92,8 @@ void udev_set_userdata(struct udev *udev, void *userdata) /** * udev_new: * - * Create udev library context. + * Create udev library context. This reads the udev configuration + * file, and fills in the default values. * * The initial refcount is 1, and needs to be decremented to * release the resources of the udev library context. @@ -293,11 +315,28 @@ void udev_set_log_fn(struct udev *udev, info(udev, "custom logging function %p registered\n", udev); } +/** + * udev_get_log_priority: + * @udev: udev library context + * + * The initial syslog priortity is read from the udev config file + * at startup. + * + * Returns: the current syslog priority + **/ int udev_get_log_priority(struct udev *udev) { return udev->log_priority; } +/** + * udev_set_log_priority: + * @udev: udev library context + * @priority: the new syslog priority + * + * Set the current syslog priority. The value controls which messages + * are send to syslog. + **/ void udev_set_log_priority(struct udev *udev, int priority) { char num[32]; diff --git a/libudev/libudev.h b/libudev/libudev.h index ffeb80f8d3..8b5391c066 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -47,10 +47,17 @@ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_en struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); -#define udev_list_entry_foreach(entry, first) \ - for (entry = first; \ - entry != NULL; \ - entry = udev_list_entry_get_next(entry)) +/** + * udev_list_entry_foreach: + * @list_entry: entry to store the current position + * @first_entry: first entry to start with + * + * Helper to iterate over all entries of a list. + */ +#define udev_list_entry_foreach(list_entry, first_entry) \ + for (list_entry = first_entry; \ + list_entry != NULL; \ + list_entry = udev_list_entry_get_next(list_entry)) /* * udev_device -- cgit v1.2.3-54-g00ecf From ce1d6d7fb47582588cfbcf0baba0c58e42a90ca6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Jun 2009 17:09:43 +0200 Subject: libudev: doc - add section headers --- libudev/libudev-device.c | 14 +++++++++++-- libudev/libudev-enumerate.c | 35 +++++++++++++++++++++++++++++++++ libudev/libudev-list.c | 10 +++++++++- libudev/libudev-monitor.c | 48 ++++++++++++++++++++++++++++++++++++++++++++- libudev/libudev-queue.c | 15 ++++++++++++++ libudev/libudev.c | 10 +++++++++- 6 files changed, 127 insertions(+), 5 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index aef6256734..9965972b32 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -23,10 +23,20 @@ #include "libudev.h" #include "libudev-private.h" +/** + * SECTION:libudev-device + * @short_description: kernel sys devices + * + * Representation of kernel sys devices. Devices are uniquely identified + * by their syspath, every device has exactly one path in the kernel sys + * filesystem. Devices usually belong to a kernel subsystem, and and have + * a unique name inside that subsytem. + */ + /** * udev_device: * - * Representation of a kernel sys device. + * Opaque object representing one kernel sys device. */ struct udev_device { struct udev *udev; @@ -882,7 +892,7 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device * udev_device_get_driver: * @udev_device: udev device * - * Returns: the driver string or #NULL, if ther is no driver attached. + * Returns: the driver string, or #NULL if there is no driver attached. **/ const char *udev_device_get_driver(struct udev_device *udev_device) { diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 63f84062b2..08f4af0ee7 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -24,6 +24,19 @@ static int devices_sort(struct udev_enumerate *udev_enumerate); +/** + * SECTION:libudev-enumerate + * @short_description: lookup and sort sys devices + * + * Lookup devices in the sys filesystem, filter devices by properties, + * and return a sorted list of matching devices. + */ + +/** + * udev_enumerate: + * + * Opaque object representing one device lookup/sort context. + */ struct udev_enumerate { struct udev *udev; int refcount; @@ -60,6 +73,14 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) return udev_enumerate; } +/** + * udev_enumerate_ref: + * @udev_enumerate: context + * + * Take a reference of a enumeration context. + * + * Returns: the passed enumeration context + **/ struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) @@ -68,6 +89,14 @@ struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) return udev_enumerate; } +/** + * udev_enumerate_unref: + * @udev_enumerate: context + * + * Drop a reference of an enumeration context. If the refcount reaches zero, + * all resources of the enumeration context will be released. + * + **/ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) @@ -84,6 +113,12 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) free(udev_enumerate); } +/** + * udev_enumerate_get_udev: + * @udev_enumerate: context + * + * Returns: the udev library context. + */ struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c index bd9792ad6c..f6637fc92d 100644 --- a/libudev/libudev-list.c +++ b/libudev/libudev-list.c @@ -19,10 +19,18 @@ #include "libudev.h" #include "libudev-private.h" +/** + * SECTION:libudev-list + * @short_description: list operation + * + * Libudev list operations. + */ + /** * udev_list_entry: * - * One entry in a list, containing a name and an optional value. + * Opaque object representing one entry in a list. An entry contains + * contains a name, and optionally a value. */ struct udev_list_entry { struct udev_list_node node; diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 5c4e8ca04a..c38edddc39 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -27,6 +27,19 @@ #include "libudev.h" #include "libudev-private.h" +/** + * SECTION:libudev-monitor + * @short_description: device event source + * + * Connects to a device event source. + */ + +/** +/** + * udev_monitor: + * + * Opaque object handling one event source. + */ struct udev_monitor { struct udev *udev; int refcount; @@ -227,6 +240,14 @@ static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, (*i)++; } +/** + * udev_monitor_filter_update: + * @udev_monitor: monitor + * + * Update the installed filter. This might only be needed, if the filter was removed or changed. + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_monitor_filter_update(struct udev_monitor *udev_monitor) { static struct sock_filter ins[256]; @@ -290,7 +311,14 @@ int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor->snl_trusted_sender.nl_pid = sender->snl.nl_pid; return 0; } - +/** + * udev_monitor_enable_receiving: + * @udev_monitor: the monitor which should receive events + * + * Binds the @udev_monitor socket to the event source. + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) { int err; @@ -739,6 +767,16 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, return count; } +/** + * udev_monitor_filter_add_match_subsystem_devtype: + * @udev_monitor: the monitor + * @subsystem: the subsystem value to match the incoming devices against + * @devtype: the devtype value to matvh the incoming devices against + * + * The filter must be installed before the monitor is switched to listening mode. + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) { if (udev_monitor == NULL) @@ -751,6 +789,14 @@ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_mo return 0; } +/** + * udev_monitor_filter_remove: + * @udev_monitor: monitor + * + * Remove all filters from monitor. + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) { static struct sock_fprog filter = { 0, NULL }; diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index cf1ddf3a07..bfd9097506 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -24,6 +24,21 @@ #include "libudev.h" #include "libudev-private.h" +/** + * SECTION:libudev-queue + * @short_description: access to currently active events + * + * The udev daemon processes event asynchronously. All events wich do not have + * interdependencies are run in parallel. This exports the current state of the + * event processing queue, and the currently event sequence numbers from the kernel + * and the udev daemon. + */ + +/** + * udev_queue: + * + * Opaque object representing the current event queue in the udev daemon. + */ struct udev_queue { struct udev *udev; int refcount; diff --git a/libudev/libudev.c b/libudev/libudev.c index d197ba7b19..f6fdcb2dfd 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -21,10 +21,18 @@ #include "libudev.h" #include "libudev-private.h" +/** + * SECTION:libudev + * @short_description: libudev context + * + * The context contains the default values read from the udev config file, + * and is passed to all library operations. + */ + /** * udev: * - * Library context, passed to all operations. + * Opaque object representing the library context. */ struct udev { int refcount; -- cgit v1.2.3-54-g00ecf From a7c140c723b8022173db4910cf20dad3e461fdd5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Jun 2009 20:04:46 +0200 Subject: libudev: doc - add enumerate --- libudev/docs/Makefile.am | 2 +- libudev/libudev-enumerate.c | 60 ++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 57 insertions(+), 5 deletions(-) diff --git a/libudev/docs/Makefile.am b/libudev/docs/Makefile.am index 59ee0aa46b..7cd1713912 100644 --- a/libudev/docs/Makefile.am +++ b/libudev/docs/Makefile.am @@ -57,7 +57,7 @@ EXTRA_HFILES= # Header files to ignore when scanning. Use base file name, no paths # e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES= +IGNORE_HFILES= libudev-private.h # Images to copy into HTML directory. # e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 08f4af0ee7..31e8e2e4f5 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -29,7 +29,7 @@ static int devices_sort(struct udev_enumerate *udev_enumerate); * @short_description: lookup and sort sys devices * * Lookup devices in the sys filesystem, filter devices by properties, - * and return a sorted list of matching devices. + * and return a sorted list of devices. */ /** @@ -95,7 +95,6 @@ struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) * * Drop a reference of an enumeration context. If the refcount reaches zero, * all resources of the enumeration context will be released. - * **/ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) { @@ -126,6 +125,12 @@ struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) return udev_enumerate->udev; } +/** + * udev_enumerate_get_list_entry: + * @udev_enumerate: context + * + * Returns: the first entry of the sorted list of device paths. + */ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) @@ -135,6 +140,13 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude return udev_list_get_entry(&udev_enumerate->devices_list); } +/** + * udev_enumerate_add_match_subsystem: + * @udev_enumerate: context + * @subsystem: filter for a subsystem of the device to include in the list + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { if (udev_enumerate == NULL) @@ -147,6 +159,13 @@ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, co return 0; } +/** + * udev_enumerate_add_nomatch_subsystem: + * @udev_enumerate: context + * @subsystem: filter for a subsystem of the device to exclude from the list + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { if (udev_enumerate == NULL) @@ -159,6 +178,14 @@ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, return 0; } +/** + * udev_enumerate_add_match_sysattr: + * @udev_enumerate: context + * @sysattr: filter for a sys attribute at the device to include in the list + * @value: optional value of the sys attribute + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) @@ -171,6 +198,14 @@ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, cons return 0; } +/** + * udev_enumerate_add_nomatch_sysattr: + * @udev_enumerate: context + * @sysattr: filter for a sys attribute at the device to exclude from the list + * @value: optional value of the sys attribute + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) @@ -208,6 +243,14 @@ exit: return match; } +/** + * udev_enumerate_add_match_property: + * @udev_enumerate: context + * @property: filter for a property of the device to include in the list + * @value: value of the property + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) { if (udev_enumerate == NULL) @@ -423,6 +466,15 @@ static int devices_sort(struct udev_enumerate *udev_enumerate) return 0; } +/** + * udev_enumerate_add_syspath: + * @udev_enumerate: context + * @syspath: path of a device + * + * Add a device to the list of devices, to retrieve it back sorted in dependency order. + * + * Returns: 0 on success, otherwise a negative error value. + */ int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); @@ -446,7 +498,7 @@ int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char * udev_enumerate_scan_devices: * @udev_enumerate: udev enumeration context * - * Returns: a negative value on error. + * Returns: 0 on success, otherwise a negative error value. **/ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) { @@ -486,7 +538,7 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) * udev_enumerate_scan_subsystems: * @udev_enumerate: udev enumeration context * - * Returns: a negative value on error. + * Returns: 0 on success, otherwise a negative error value. **/ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) { -- cgit v1.2.3-54-g00ecf From 8d6bc73aefb5dcfd36d9456ab2209bc410086f82 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 15 Jun 2009 20:28:28 +0200 Subject: libudev: doc - add queue --- libudev/libudev-device.c | 2 +- libudev/libudev-queue.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 2 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 9965972b32..669c51e35b 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -592,7 +592,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) * It can be called as many times as needed, without caring about * references. * - * Returns: a new udev device, or #NULL, if no matching parent exists. + * Returns: a new udev device, or #NULL if no matching parent exists. **/ struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) { diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index bfd9097506..691e6a7919 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -46,6 +46,15 @@ struct udev_queue { struct udev_list_node failed_list; }; +/** + * udev_queue_new: + * @udev: udev library context + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev queue context. + * + * Returns: the udev queue context, or #NULL on error. + **/ struct udev_queue *udev_queue_new(struct udev *udev) { struct udev_queue *udev_queue; @@ -63,6 +72,14 @@ struct udev_queue *udev_queue_new(struct udev *udev) return udev_queue; } +/** + * udev_queue_ref: + * @udev_queue: udev queue context + * + * Take a reference of a udev queue context. + * + * Returns: the same udev queue context. + **/ struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) { if (udev_queue == NULL) @@ -71,6 +88,13 @@ struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) return udev_queue; } +/** + * udev_queue_unref: + * @udev_queue: udev queue context + * + * Drop a reference of a udev queue context. If the refcount reaches zero, + * the resources of the queue context will be released. + **/ void udev_queue_unref(struct udev_queue *udev_queue) { if (udev_queue == NULL) @@ -83,6 +107,14 @@ void udev_queue_unref(struct udev_queue *udev_queue) free(udev_queue); } +/** + * udev_queue_get_udev: + * @udev_queue: udev queue context + * + * Retrieve the udev library context the queue context was created with. + * + * Returns: the udev library context. + **/ struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) { if (udev_queue == NULL) @@ -111,6 +143,12 @@ unsigned long long int udev_get_kernel_seqnum(struct udev *udev) return seqnum; } +/** + * udev_queue_get_kernel_seqnum: + * @udev_queue: udev queue context + * + * Returns: the current kernel event sequence number. + **/ unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) { unsigned long long int seqnum; @@ -190,7 +228,12 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i return queue_file; } - +/** + * udev_queue_get_udev_seqnum: + * @udev_queue: udev queue context + * + * Returns: the last known udev event sequence number. + **/ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) { unsigned long long int seqnum_udev; @@ -217,6 +260,12 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) return seqnum_udev; } +/** + * udev_queue_get_udev_is_active: + * @udev_queue: udev queue context + * + * Returns: a flag indicating if udev is active. + **/ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) { unsigned long long int seqnum_start; @@ -230,6 +279,12 @@ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) return 1; } +/** + * udev_queue_get_queue_is_empty: + * @udev_queue: udev queue context + * + * Returns: a flag indicating if udev is currently handling events. + **/ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) { unsigned long long int seqnum_kernel; @@ -282,6 +337,14 @@ out: return is_empty; } +/** + * udev_queue_get_seqnum_sequence_is_finished: + * @udev_queue: udev queue context + * @start: first event sequence number + * @end: last event sequence number + * + * Returns: if any of the sequence numbers in the given range is currently active. + **/ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end) { @@ -320,6 +383,13 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, return (unfinished == 0); } +/** + * udev_queue_get_seqnum_is_finished: + * @udev_queue: udev queue context + * @seqnum: sequence number + * + * Returns: a flag indicating if the given sequence number is handled. + **/ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) { if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) @@ -329,6 +399,12 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo return 1; } +/** + * udev_queue_get_queued_list_entry: + * @udev_queue: udev queue context + * + * Returns: the first entry of the list of queued events. + **/ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) { unsigned long long int seqnum; @@ -376,6 +452,12 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev return udev_list_get_entry(&udev_queue->queue_list); } +/** + * udev_queue_get_failed_list_entry: + * @udev_queue: udev queue context + * + * Returns: the first entry of the list of recorded failed events. + **/ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) { char path[UTIL_PATH_SIZE]; -- cgit v1.2.3-54-g00ecf From 76965436e9a06875a01e530f07c8d2d906d9fee1 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Tue, 16 Jun 2009 00:44:39 +0200 Subject: rules: Gentoo update --- rules/gentoo/30-kernel-compat.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/gentoo/30-kernel-compat.rules b/rules/gentoo/30-kernel-compat.rules index 95da1522d3..bf54e33423 100644 --- a/rules/gentoo/30-kernel-compat.rules +++ b/rules/gentoo/30-kernel-compat.rules @@ -26,3 +26,4 @@ SUBSYSTEM=="scsi", ATTR{type}=="8", RUN+="/sbin/modprobe -b ch" SUBSYSTEM=="pnp", DRIVER!="?*", \ RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" +LABEL="kernel_compat_end" -- cgit v1.2.3-54-g00ecf From 68a99a2c45f3367353a4bf7c36f60d2f7f7bb3f7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 02:03:26 +0200 Subject: update TODO --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index 5cea74e758..9085429df8 100644 --- a/TODO +++ b/TODO @@ -3,6 +3,7 @@ o add tests for kernel provided DEVNAME logic o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) o remove MMC rules, they got a modalias now (2.6.30) + o convert firmware.sh to C o symlink names to udevadm will no longer be resolved to old command names o "udevadm control" commands will only accept the -- syntax -- cgit v1.2.3-54-g00ecf From aebaa8a66f61372f33c9442cdbe4bd9df96e3d29 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 03:02:46 +0200 Subject: libudev: doc - add namespace for index --- libudev/docs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/docs/Makefile.am b/libudev/docs/Makefile.am index 7cd1713912..46b8797203 100644 --- a/libudev/docs/Makefile.am +++ b/libudev/docs/Makefile.am @@ -32,7 +32,7 @@ SCAN_OPTIONS= # Extra options to supply to gtkdoc-mkdb. # e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml -MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space udev # Extra options to supply to gtkdoc-mktmpl # e.g. MKTMPL_OPTIONS=--only-section-tmpl -- cgit v1.2.3-54-g00ecf From 1b98ae83be69f805f8197caa42a304e851dd7f95 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 14:18:16 +0200 Subject: libudev: move .so version to libudev Makefile --- configure.ac | 8 -------- libudev/Makefile.am | 3 +++ libudev/libudev-monitor.c | 1 - 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index dd6161738a..0df0f60f12 100644 --- a/configure.ac +++ b/configure.ac @@ -15,14 +15,6 @@ dnl /* prefix is /usr, exec_prefix is /, if overridden exec_prefix follows prefi AC_PREFIX_DEFAULT([/usr]) test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix= -dnl /* libudev version */ -LIBUDEV_LT_CURRENT=4 -LIBUDEV_LT_REVISION=0 -LIBUDEV_LT_AGE=4 -AC_SUBST(LIBUDEV_LT_CURRENT) -AC_SUBST(LIBUDEV_LT_REVISION) -AC_SUBST(LIBUDEV_LT_AGE) - AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_ARG_WITH(udev-prefix, diff --git a/libudev/Makefile.am b/libudev/Makefile.am index f8a85addae..e58786531c 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -29,6 +29,9 @@ libudev_la_SOURCES =\ libudev-monitor.c \ libudev-queue.c +LIBUDEV_LT_CURRENT=4 +LIBUDEV_LT_REVISION=0 +LIBUDEV_LT_AGE=4 libudev_la_LDFLAGS = \ -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ -export-symbols $(top_srcdir)/libudev/exported_symbols diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index c38edddc39..e8cdd30a16 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -34,7 +34,6 @@ * Connects to a device event source. */ -/** /** * udev_monitor: * -- cgit v1.2.3-54-g00ecf From 048dc83a78df76fd94af35dbddccfd47eca59c15 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 14:19:19 +0200 Subject: autogen.sh: simplify --- autogen.sh | 35 +++++++---------------------------- 1 file changed, 7 insertions(+), 28 deletions(-) diff --git a/autogen.sh b/autogen.sh index d1477aa7a1..83af29cd21 100755 --- a/autogen.sh +++ b/autogen.sh @@ -9,32 +9,11 @@ CFLAGS="-g -Wall \ -Wpointer-arith -Wsign-compare -Wchar-subscripts \ -Wstrict-prototypes -Wshadow \ -Wformat=2 -Wtype-limits" -args="--prefix=/usr --exec-prefix= --sysconfdir=/etc --with-selinux --enable-gtk-doc" -libdir=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd)) -case "$1" in - *install|"") - args="$args --with-libdir-name=$libdir" - export CFLAGS="$CFLAGS -O2" - echo " configure: $args" - echo - ./configure $args - ;; - *devel) - args="$args --enable-debug --with-libdir-name=$libdir" - export CFLAGS="$CFLAGS -O0" - echo " configure: $args" - echo - ./configure $args - ;; - *clean) - ./configure - make maintainer-clean - git clean -f -X - exit 0 - ;; - *) - echo "Usage: $0 [--install|--devel|--clean]" - exit 1 - ;; -esac +libdirname=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd)) +args="--prefix=/usr --exec-prefix= --sysconfdir=/etc \ +--libdir=/usr/$libdirname --with-libdir-name=$libdirname \ +--with-selinux --enable-gtk-doc + +export CFLAGS="$CFLAGS -O2" +./configure $args $@ -- cgit v1.2.3-54-g00ecf From df8bdf3fb851c1e0b398db65045dd31e99d1fc91 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 14:21:08 +0200 Subject: TODO: update --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index 9085429df8..da99da4034 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,5 @@ + o fix configure options and libdir-name, exec-prefix, udev-prefix, libdir, ... o enumerate: sort control* after pcm* o add tests for kernel provided DEVNAME logic o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) -- cgit v1.2.3-54-g00ecf From 80e9638bc88d8b8a45bb3733ed146b48cd10a6bf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 14:56:10 +0200 Subject: libudev: remove prefix from .so version variables --- libudev/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libudev/Makefile.am b/libudev/Makefile.am index e58786531c..5d0cbf74b1 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -29,11 +29,11 @@ libudev_la_SOURCES =\ libudev-monitor.c \ libudev-queue.c -LIBUDEV_LT_CURRENT=4 -LIBUDEV_LT_REVISION=0 -LIBUDEV_LT_AGE=4 +LT_CURRENT=4 +LT_REVISION=0 +LT_AGE=4 libudev_la_LDFLAGS = \ - -version-info $(LIBUDEV_LT_CURRENT):$(LIBUDEV_LT_REVISION):$(LIBUDEV_LT_AGE) \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ -export-symbols $(top_srcdir)/libudev/exported_symbols pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig -- cgit v1.2.3-54-g00ecf From 1a669a701914badc6ecbeb29eb2cab1e17d0994b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 15:38:40 +0200 Subject: libudev: doc - add empty libudev.types --- libudev/docs/libudev.types | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 libudev/docs/libudev.types diff --git a/libudev/docs/libudev.types b/libudev/docs/libudev.types new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3-54-g00ecf From af23b83ea714756aa4bfed7f7501739c69428e40 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 17:43:12 +0200 Subject: udev-acl: move from udev-extras The build of extras with larger external dependencies is wrapped in: --enable-extras --- Makefile.am | 4 +- autogen.sh | 2 +- configure.ac | 13 ++ extras/Makefile.am | 5 + extras/udev-acl/.gitignore | 1 + extras/udev-acl/70-acl.rules | 45 ++++++ extras/udev-acl/Makefile.am | 15 ++ extras/udev-acl/udev-acl.c | 334 +++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 417 insertions(+), 2 deletions(-) create mode 100644 extras/udev-acl/.gitignore create mode 100644 extras/udev-acl/70-acl.rules create mode 100644 extras/udev-acl/Makefile.am create mode 100644 extras/udev-acl/udev-acl.c diff --git a/Makefile.am b/Makefile.am index fd7538658b..fbaf2ae58e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,7 +20,9 @@ CLEANFILES = \ ACLOCAL_AMFLAGS = -I m4 -DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc +DISTCHECK_CONFIGURE_FLAGS = \ + --enable-gtk-doc \ + --enable-extras clean-local: rm -rf udev-test-install diff --git a/autogen.sh b/autogen.sh index 83af29cd21..e41bae05cf 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,7 +13,7 @@ CFLAGS="-g -Wall \ libdirname=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd)) args="--prefix=/usr --exec-prefix= --sysconfdir=/etc \ --libdir=/usr/$libdirname --with-libdir-name=$libdirname \ ---with-selinux --enable-gtk-doc +--with-selinux --enable-gtk-doc --enable-extras" export CFLAGS="$CFLAGS -O2" ./configure $args $@ diff --git a/configure.ac b/configure.ac index 0df0f60f12..9571c902f8 100644 --- a/configure.ac +++ b/configure.ac @@ -58,6 +58,16 @@ if test "x$enable_logging" = "xyes"; then AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) fi +AC_ARG_ENABLE([extras], + AS_HELP_STRING([--enable-extras], [enable extras with external dependencies]), + [], [enable_extras=no]) +if test "x$enable_extras" = xyes; then + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0]) + AC_SUBST([GLIB_CFLAGS]) + AC_SUBST([GLIB_LIBS]) +fi +AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) + AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile @@ -79,6 +89,7 @@ AC_CONFIG_FILES([ extras/rule_generator/Makefile extras/scsi_id/Makefile extras/usb_id/Makefile + extras/udev-acl/Makefile ]) AC_OUTPUT @@ -102,5 +113,7 @@ AC_MSG_RESULT([ cflags: ${CFLAGS} ldflags: ${LDFLAGS} + extras: ${enable_extras} + xsltproc: ${XSLTPROC} ]) diff --git a/extras/Makefile.am b/extras/Makefile.am index 49a23d9777..4c9b20442b 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -12,3 +12,8 @@ SUBDIRS = \ rule_generator \ scsi_id \ usb_id + +if ENABLE_EXTRAS +SUBDIRS += \ + udev-acl +endif diff --git a/extras/udev-acl/.gitignore b/extras/udev-acl/.gitignore new file mode 100644 index 0000000000..08891fed02 --- /dev/null +++ b/extras/udev-acl/.gitignore @@ -0,0 +1 @@ +udev-acl diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules new file mode 100644 index 0000000000..fc27039597 --- /dev/null +++ b/extras/udev-acl/70-acl.rules @@ -0,0 +1,45 @@ +# do not edit this file, it will be overwritten on update + +ENV{MAJOR}=="", GOTO="acl_end" +ACTION!="add|change", GOTO="acl_apply" + +# PTP/MTP protocol devices, cameras, portable media players +SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="", ENV{DEVTYPE}=="usb_device", IMPORT{program}="usb_id --export %p" +SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", ENV{ACL_MANAGE}="1" + +# digicams with proprietary protocol +ENV{ID_GPHOTO2}=="*?", ENV{ACL_MANAGE}="1" + +# SCSI scanners +KERNEL=="sg[0-9]*", ATTRS{type}=="6", ENV{ACL_MANAGE}="1" +KERNEL=="sg[0-9]*", ATTRS{type}=="3", ATTRS{vendor}=="HP|EPSON|Epson", ENV{ACL_MANAGE}="1" + +# USB scanners +ENV{libsane_matched}=="yes", ENV{ACL_MANAGE}="1" + +# optical drives +SUBSYSTEM=="block", ENV{ID_CDROM}=="1", ENV{ACL_MANAGE}="1" + +# sound devices +SUBSYSTEM=="sound", ENV{ACL_MANAGE}="1" +# sound jack-sense +SUBSYSTEM=="input", SUBSYSTEMS=="sound", ENV{ACL_MANAGE}="1" + +# webcams, frame grabber, TV cards +SUBSYSTEM=="video4linux", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="dvb", ENV{ACL_MANAGE}="1" + +# fingerprint readers +SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="2016", ENV{ACL_MANAGE}="1" + +# DRI video devices +SUBSYSTEM=="drm", KERNEL=="card*", ENV{ACL_MANAGE}="1" + +# KVM +SUBSYSTEM=="misc", KERNEL=="kvm", ENV{ACL_MANAGE}="1" + +# apply ACL for all locally logged in users +LABEL="acl_apply", ENV{ACL_MANAGE}=="?*", TEST=="/var/run/ConsoleKit/database", \ + RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" + +LABEL="acl_end" diff --git a/extras/udev-acl/Makefile.am b/extras/udev-acl/Makefile.am new file mode 100644 index 0000000000..f1a5fbd6c1 --- /dev/null +++ b/extras/udev-acl/Makefile.am @@ -0,0 +1,15 @@ +include $(top_srcdir)/Makefile.am.inc + +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = udev-acl + +udev_acl_SOURCES = udev-acl.c +udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) +udev_acl_LDADD = -lacl $(top_builddir)/libudev/libudev.la $(GLIB_LIBS) + +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = 70-acl.rules + +install-exec-hook: + mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d + ln -sf $(udevhomedir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c new file mode 100644 index 0000000000..ec95025eb3 --- /dev/null +++ b/extras/udev-acl/udev-acl.c @@ -0,0 +1,334 @@ +/* + * Copyright (C) 2009 Kay Sievers + * + * 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; either version 2 of the + * License, or (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int debug; + +static int set_facl(const char* filename, uid_t uid, int add) +{ + int get; + acl_t acl; + acl_entry_t entry = NULL; + acl_entry_t e; + acl_permset_t permset; + int ret; + + /* read current record */ + acl = acl_get_file(filename, ACL_TYPE_ACCESS); + if (!acl) + return -1; + + /* locate ACL_USER entry for uid */ + get = acl_get_entry(acl, ACL_FIRST_ENTRY, &e); + while (get == 1) { + acl_tag_t t; + + acl_get_tag_type(e, &t); + if (t == ACL_USER) { + uid_t *u; + + u = (uid_t*)acl_get_qualifier(e); + if (u == NULL) { + ret = -1; + goto out; + } + if (*u == uid) { + entry = e; + acl_free(u); + break; + } + acl_free(u); + } + + get = acl_get_entry(acl, ACL_NEXT_ENTRY, &e); + } + + /* remove ACL_USER entry for uid */ + if (!add) { + if (entry == NULL) { + ret = 0; + goto out; + } + acl_delete_entry(acl, entry); + goto update; + } + + /* create ACL_USER entry for uid */ + if (entry == NULL) { + ret = acl_create_entry(&acl, &entry); + if (ret != 0) + goto out; + acl_set_tag_type(entry, ACL_USER); + acl_set_qualifier(entry, &uid); + } + + /* add permissions for uid */ + acl_get_permset(entry, &permset); + acl_add_perm(permset, ACL_READ|ACL_WRITE); +update: + /* update record */ + if (debug) + printf("%c%u %s\n", add ? '+' : '-', uid, filename); + acl_calc_mask(&acl); + ret = acl_set_file(filename, ACL_TYPE_ACCESS, acl); + if (ret != 0) + goto out; +out: + acl_free(acl); + return ret; +} + +/* check if a given uid is listed */ +static int uid_in_list(GSList *list, uid_t uid) +{ + GSList *l; + + for (l = list; l != NULL; l = g_slist_next(l)) + if (uid == GPOINTER_TO_UINT(l->data)) + return 1; + return 0; +} + +/* return list of current uids of local active sessions */ +static GSList *uids_with_local_active_session(const char *own_id) +{ + GSList *list = NULL; + GKeyFile *keyfile; + + keyfile = g_key_file_new(); + if (g_key_file_load_from_file(keyfile, "/var/run/ConsoleKit/database", 0, NULL)) { + gchar **groups; + + groups = g_key_file_get_groups(keyfile, NULL); + if (groups != NULL) { + int i; + + for (i = 0; groups[i] != NULL; i++) { + uid_t u; + + if (!g_str_has_prefix(groups[i], "Session ")) + continue; + if (own_id != NULL &&g_str_has_suffix(groups[i], own_id)) + continue; + if (!g_key_file_get_boolean(keyfile, groups[i], "is_local", NULL)) + continue; + if (!g_key_file_get_boolean(keyfile, groups[i], "is_active", NULL)) + continue; + u = g_key_file_get_integer(keyfile, groups[i], "uid", NULL); + if (u > 0 && !uid_in_list(list, u)) + list = g_slist_prepend(list, GUINT_TO_POINTER(u)); + } + g_strfreev(groups); + } + } + g_key_file_free(keyfile); + + return list; +} + +/* ConsoleKit calls us with special variables */ +static int consolekit_called(const char *action, uid_t *uid, const char **own_session, int *add) +{ + int a; + uid_t u; + const char *s; + const char *session; + + if (strcmp(action, "session_active_changed") != 0) + return -1; + + s = getenv("CK_SESSION_IS_LOCAL"); + if (s == NULL) + return -1; + if (strcmp(s, "true") != 0) + return 0; + + s = getenv("CK_SESSION_IS_ACTIVE"); + if (s == NULL) + return -1; + if (strcmp(s, "true") == 0) + a = 1; + else + a = 0; + + session = getenv("CK_SESSION_ID"); + if (session == NULL) + return -1; + + s = getenv("CK_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + if (u == 0) + return 0; + + *own_session = session; + *uid = u; + *add = a; + return 0; +} + +/* add or remove a ACL for a given uid from all matching devices */ +static void apply_acl_to_devices(uid_t uid, int add) +{ + struct udev *udev; + struct udev_enumerate *enumerate; + struct udev_list_entry *list_entry; + + /* iterate over all devices tagged with ACL_SET */ + udev = udev_new(); + enumerate = udev_enumerate_new(udev); + udev_enumerate_add_match_property(enumerate, "ACL_MANAGE", "*"); + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + const char *node; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + node = udev_device_get_devnode(device); + if (node == NULL) + continue; + set_facl(node, uid, add); + udev_device_unref(device); + } + udev_enumerate_unref(enumerate); + udev_unref(udev); +} + +int main (int argc, char* argv[]) +{ + static const struct option options[] = { + { "action", required_argument, NULL, 'a' }, + { "device", required_argument, NULL, 'D' }, + { "user", required_argument, NULL, 'u' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + int add = -1; + const char *device = NULL; + uid_t uid = 0; + const char* own_session = NULL; + int rc = 0; + + /* valgrind is more important to us than a slice allocator */ + g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, 1); + + while (1) { + int option; + + option = getopt_long(argc, argv, "+a:D:u:dh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'a': + if (strcmp(optarg, "add") == 0 || strcmp(optarg, "change") == 0) + add = 1; + else if (strcmp(optarg, "remove") == 0) + add = 0; + else + goto out; + break; + case 'D': + device = optarg; + break; + case 'u': + uid = strtoul(optarg, NULL, 10); + break; + case 'd': + debug = 1; + break; + case 'h': + printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n"); + default: + goto out; + } + } + + if (add < 0 && device == NULL && uid == 0) + consolekit_called(argv[optind], &uid, &own_session, &add); + + if (add < 0) { + fprintf(stderr, "missing action\n\n"); + rc = 2; + goto out; + } + + if (device != NULL && uid != 0) { + fprintf(stderr, "only one option, --device=DEVICEFILE or --user=UID expected\n\n"); + rc = 3; + goto out; + } + + if (uid != 0) { + if (add) { + /* Add ACL for given uid to all matching devices. */ + apply_acl_to_devices(uid, 1); + } else { + /* + * Remove ACL for given uid from all matching devices + * when there is currently no local active session. + */ + GSList *list; + + list = uids_with_local_active_session(own_session); + if (!uid_in_list(list, uid)) + apply_acl_to_devices(uid, 0); + g_slist_free(list); + } + } else if (device != NULL) { + /* + * Add ACLs for all current session uids to a given device. + * + * Or remove ACLs for uids which do not have any current local + * active session. Remove is not really interesting, because in + * most cases the device node is removed anyway. + */ + GSList *list; + GSList *l; + + list = uids_with_local_active_session(NULL); + for (l = list; l != NULL; l = g_slist_next(l)) { + uid_t u; + + u = GPOINTER_TO_UINT(l->data); + if (add || !uid_in_list(list, u)) + set_facl(device, u, add); + } + g_slist_free(list); + } else { + fprintf(stderr, "--device=DEVICEFILE or --user=UID expected\n\n"); + rc = 3; + } +out: + return rc; +} -- cgit v1.2.3-54-g00ecf From bf05675a2007af645b1998d5b7c60ab7bf2dc1fc Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 16 Jun 2009 17:52:15 +0200 Subject: gudev: move from udev-extras GObject libudev access. Initial version from Bastien Nocera, current version by David Zeuthen. --- Makefile.am | 1 + configure.ac | 20 + extras/Makefile.am | 3 +- extras/gudev/.gitignore | 8 + extras/gudev/Makefile.am | 115 +++++ extras/gudev/docs/.gitignore | 17 + extras/gudev/docs/Makefile.am | 106 ++++ extras/gudev/docs/gudev-docs.xml | 88 ++++ extras/gudev/docs/gudev-sections.txt | 66 +++ extras/gudev/docs/gudev.types | 3 + extras/gudev/docs/version.xml.in | 1 + extras/gudev/gjs-example.js | 75 +++ extras/gudev/gudev-1.0.pc.in | 11 + extras/gudev/gudev.h | 36 ++ extras/gudev/gudevclient.c | 502 +++++++++++++++++++ extras/gudev/gudevclient.h | 101 ++++ extras/gudev/gudevdevice.c | 891 +++++++++++++++++++++++++++++++++ extras/gudev/gudevdevice.h | 126 +++++ extras/gudev/gudevenums.h | 49 ++ extras/gudev/gudevenumtypes.c.template | 39 ++ extras/gudev/gudevenumtypes.h.template | 24 + extras/gudev/gudevmarshal.list | 1 + extras/gudev/gudevprivate.h | 40 ++ extras/gudev/gudevtypes.h | 45 ++ extras/gudev/seed-example.js | 72 +++ 25 files changed, 2439 insertions(+), 1 deletion(-) create mode 100644 extras/gudev/.gitignore create mode 100644 extras/gudev/Makefile.am create mode 100644 extras/gudev/docs/.gitignore create mode 100644 extras/gudev/docs/Makefile.am create mode 100644 extras/gudev/docs/gudev-docs.xml create mode 100644 extras/gudev/docs/gudev-sections.txt create mode 100644 extras/gudev/docs/gudev.types create mode 100644 extras/gudev/docs/version.xml.in create mode 100755 extras/gudev/gjs-example.js create mode 100644 extras/gudev/gudev-1.0.pc.in create mode 100644 extras/gudev/gudev.h create mode 100644 extras/gudev/gudevclient.c create mode 100644 extras/gudev/gudevclient.h create mode 100644 extras/gudev/gudevdevice.c create mode 100644 extras/gudev/gudevdevice.h create mode 100644 extras/gudev/gudevenums.h create mode 100644 extras/gudev/gudevenumtypes.c.template create mode 100644 extras/gudev/gudevenumtypes.h.template create mode 100644 extras/gudev/gudevmarshal.list create mode 100644 extras/gudev/gudevprivate.h create mode 100644 extras/gudev/gudevtypes.h create mode 100755 extras/gudev/seed-example.js diff --git a/Makefile.am b/Makefile.am index fbaf2ae58e..0ebf232c80 100644 --- a/Makefile.am +++ b/Makefile.am @@ -62,3 +62,4 @@ git-release: doc-sync: rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ + rsync -av --delete extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libgudev/ diff --git a/configure.ac b/configure.ac index 9571c902f8..077944b3dd 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,20 @@ if test "x$enable_extras" = xyes; then fi AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) +AC_ARG_ENABLE([introspection], + AS_HELP_STRING([--enable-introspection], [enable GObject introspection]), + [], [enable_introspection=no]) +if test "$enable_introspection" = xyes; then + PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) + AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) + AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) + AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) + AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) + AC_SUBST([GIRDIR], [$($PKG_CONFIG --variable=girdir gobject-introspection-1.0)]) + AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)]) +fi +AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) + AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile @@ -90,6 +104,10 @@ AC_CONFIG_FILES([ extras/scsi_id/Makefile extras/usb_id/Makefile extras/udev-acl/Makefile + extras/gudev/Makefile + extras/gudev/gudev-1.0.pc + extras/gudev/docs/Makefile + extras/gudev/docs/version.xml ]) AC_OUTPUT @@ -100,6 +118,7 @@ AC_MSG_RESULT([ prefix: ${prefix} exec_prefix: ${exec_prefix} udev_prefix: ${udev_prefix} + libdir: ${libdir} libdir_name: ${libdir_name} datarootdir: ${datarootdir} mandir: ${mandir} @@ -114,6 +133,7 @@ AC_MSG_RESULT([ ldflags: ${LDFLAGS} extras: ${enable_extras} + gintrospection: ${enable_introspection} xsltproc: ${XSLTPROC} ]) diff --git a/extras/Makefile.am b/extras/Makefile.am index 4c9b20442b..629b70e387 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -15,5 +15,6 @@ SUBDIRS = \ if ENABLE_EXTRAS SUBDIRS += \ - udev-acl + udev-acl \ + gudev endif diff --git a/extras/gudev/.gitignore b/extras/gudev/.gitignore new file mode 100644 index 0000000000..575f13d785 --- /dev/null +++ b/extras/gudev/.gitignore @@ -0,0 +1,8 @@ +gtk-doc.make +docs/version.xml +gudev-1.0.pc +gudevenumtypes.c +gudevenumtypes.h +gudevmarshal.c +gudevmarshal.h + diff --git a/extras/gudev/Makefile.am b/extras/gudev/Makefile.am new file mode 100644 index 0000000000..852e455f67 --- /dev/null +++ b/extras/gudev/Makefile.am @@ -0,0 +1,115 @@ +include $(top_srcdir)/Makefile.am.inc + +# putting ‘.’ first causes prefix ordering of directories +SUBDIRS = \ + . \ + docs + +AM_CPPFLAGS += \ + -I$(top_builddir)/extras \ + -I$(top_srcdir)/extras \ + -I$(top_builddir)/extras/gudev \ + -I$(top_srcdir)/extras/gudev \ + -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ + -D_GUDEV_COMPILATION \ + -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ + -DG_LOG_DOMAIN=\"GUdev\" + +BUILT_SOURCES = \ + gudevmarshal.h gudevmarshal.c \ + gudevenumtypes.h gudevenumtypes.c + +gudevmarshal.h: gudevmarshal.list + glib-genmarshal $< --prefix=g_udev_marshal --header > $@ + +gudevmarshal.c: gudevmarshal.list + echo "#include \"gudevmarshal.h\"" > $@ && \ + glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ + +gudevenumtypes.h: $(srcdir)/gudevenumtypes.h.template gudevenums.h + glib-mkenums --template $(srcdir)/gudevenumtypes.h.template gudevenums.h > \ + gudevenumtypes.h.tmp && mv gudevenumtypes.h.tmp gudevenumtypes.h + +gudevenumtypes.c: $(srcdir)/gudevenumtypes.c.template gudevenums.h + glib-mkenums --template $(srcdir)/gudevenumtypes.c.template gudevenums.h > \ + gudevenumtypes.c.tmp && mv gudevenumtypes.c.tmp gudevenumtypes.c + +lib_LTLIBRARIES = libgudev-1.0.la + +libgudev_1_0_includedir=$(includedir)/gudev-1.0/gudev +libgudev_1_0_include_HEADERS = \ + gudev.h \ + gudevenums.h \ + gudevenumtypes.h \ + gudevtypes.h \ + gudevclient.h \ + gudevdevice.h + +libgudev_1_0_la_SOURCES = \ + gudevenums.h \ + gudevenumtypes.h gudevenumtypes.h\ + gudevtypes.h \ + gudevclient.h gudevclient.c \ + gudevdevice.h gudevdevice.c \ + gudevprivate.h \ + $(BUILT_SOURCES) + +libgudev_1_0_la_CFLAGS = $(GLIB_CFLAGS) + +libgudev_1_0_la_LIBADD = $(top_builddir)/libudev/libudev.la $(GLIB_LIBS) + +LT_CURRENT=0 +LT_REVISION=1 +LT_AGE=0 +libgudev_1_0_la_LDFLAGS = \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ + -export-dynamic -no-undefined \ + -export-symbols-regex '^g_udev_.*' + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = gudev-1.0.pc + +EXTRA_DIST = \ + gudev-1.0.pc.in \ + gudevmarshal.list \ + gudevenumtypes.h.template \ + gudevenumtypes.c.template + +CLEANFILES = $(BUILT_SOURCES) + +if ENABLE_INTROSPECTION +GUdev-1.0.gir: libgudev-1.0.la $(G_IR_SCANNER) Makefile.am + PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ + $(G_IR_SCANNER) -v \ + --namespace GUdev \ + --nsversion=1.0 \ + --include=GObject-2.0 \ + --library=gudev-1.0 \ + --output $@ \ + --pkg=glib-2.0 \ + --pkg=gobject-2.0 \ + -I$(top_srcdir) \ + -D_GUDEV_COMPILATION \ + -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ + $(top_srcdir)/extras/gudev/gudev.h \ + $(top_srcdir)/extras/gudev/gudevtypes.h \ + $(top_srcdir)/extras/gudev/gudevenums.h \ + $(top_srcdir)/extras/gudev/gudevenumtypes.h \ + $(top_srcdir)/extras/gudev/gudevclient.h \ + $(top_srcdir)/extras/gudev/gudevdevice.h \ + $(top_srcdir)/extras/gudev/gudevclient.c \ + $(top_srcdir)/extras/gudev/gudevdevice.c + +girdir = $(GIRDIR) +gir_DATA = GUdev-1.0.gir + +typelibsdir = $(GIRTYPELIBDIR) +typelibs_DATA = GUdev-1.0.typelib + +GUdev-1.0.typelib: GUdev-1.0.gir $(G_IR_COMPILER) + g-ir-compiler GUdev-1.0.gir -o GUdev-1.0.typelib + +EXTRA_DIST += GUdev-1.0.gir +CLEANFILES += $(gir_DATA) $(typelibs_DATA) + +endif # ENABLE_INTROSPECTION diff --git a/extras/gudev/docs/.gitignore b/extras/gudev/docs/.gitignore new file mode 100644 index 0000000000..a471783ca9 --- /dev/null +++ b/extras/gudev/docs/.gitignore @@ -0,0 +1,17 @@ +gudev-decl-list.txt +gudev-decl.txt +gudev-overrides.txt +gudev-undeclared.txt +gudev-undocumented.txt +gudev.args +gudev.hierarchy +gudev.interfaces +gudev.prerequisites +gudev.signals +gudev.unused +html.stamp +html/* +xml/* +tmpl/* +*.stamp + diff --git a/extras/gudev/docs/Makefile.am b/extras/gudev/docs/Makefile.am new file mode 100644 index 0000000000..47ca91524e --- /dev/null +++ b/extras/gudev/docs/Makefile.am @@ -0,0 +1,106 @@ +## Process this file with automake to produce Makefile.in + +# We require automake 1.10 at least. +AUTOMAKE_OPTIONS = 1.10 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=gudev + +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=2 + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=.. + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS= + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS= + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-mkhtml +MKHTML_OPTIONS= + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS= + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=$(top_srcdir)/extras/gudev/*.h +CFILE_GLOB=$(top_srcdir)/extras/gudev/*.c + +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h +EXTRA_HFILES= + +# Header files to ignore when scanning. Use base file name, no paths +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES= + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES= + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = version.xml + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files= + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +GTKDOC_CFLAGS = \ + $(DBUS_GLIB_CFLAGS) \ + $(GLIB_CFLAGS) \ + -I$(top_srcdir)/extras/gudev \ + -I$(top_builddir)/extras/gudev + +GTKDOC_LIBS = \ + $(GLIB_LIBS) \ + $(top_builddir)/extras/gudev/libgudev-1.0.la + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +include $(top_srcdir)/gtk-doc.make + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +EXTRA_DIST += version.xml.in + +# Files not to distribute +# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types +# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt +#DISTCLEANFILES += + +# Comment this out if you want your docs-status tested during 'make check' +if ENABLE_GTK_DOC +#TESTS_ENVIRONMENT = cd $(srcsrc) +#TESTS = $(GTKDOC_CHECK) +endif diff --git a/extras/gudev/docs/gudev-docs.xml b/extras/gudev/docs/gudev-docs.xml new file mode 100644 index 0000000000..8ad3b6e566 --- /dev/null +++ b/extras/gudev/docs/gudev-docs.xml @@ -0,0 +1,88 @@ + + +]> + + + GUDev Reference Manual + For GUdev version &version; + + + David + Zeuthen + +
                    + davidz@redhat.com +
                    +
                    +
                    + + Bastien + Nocera + +
                    + hadess@hadess.net +
                    +
                    +
                    +
                    + + + 2009 + The GUDev Authors + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
                    + The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
                    +
                    + + + Many of the names used by companies to distinguish their + products and services are claimed as trademarks. Where those + names appear in any freedesktop.org documentation, and those + trademarks are made aware to the members of the + freedesktop.org Project, the names have been printed in caps + or initial caps. + +
                    +
                    + + + API Reference + + + This part presents the class and function reference for the + libgudev library. + + + + + + + + Object Hierarchy + + + + Index + + +
                    diff --git a/extras/gudev/docs/gudev-sections.txt b/extras/gudev/docs/gudev-sections.txt new file mode 100644 index 0000000000..faa6a8d79d --- /dev/null +++ b/extras/gudev/docs/gudev-sections.txt @@ -0,0 +1,66 @@ +
                    +gudevclient +GUdevClient +GUdevClient +GUdevClientClass +GUdevDeviceType +GUdevDeviceNumber +g_udev_client_new +g_udev_client_query_by_subsystem +g_udev_client_query_by_device_number +g_udev_client_query_by_device_file +g_udev_client_query_by_sysfs_path +g_udev_client_query_by_subsystem_and_name + +G_UDEV_CLIENT +G_UDEV_IS_CLIENT +G_UDEV_TYPE_CLIENT +g_udev_client_get_type +G_UDEV_CLIENT_CLASS +G_UDEV_IS_CLIENT_CLASS +G_UDEV_CLIENT_GET_CLASS +
                    + +
                    +gudevdevice +GUdevDevice +GUdevDevice +GUdevDeviceClass +g_udev_device_get_subsystem +g_udev_device_get_devtype +g_udev_device_get_name +g_udev_device_get_number +g_udev_device_get_sysfs_path +g_udev_device_get_driver +g_udev_device_get_action +g_udev_device_get_seqnum +g_udev_device_get_device_type +g_udev_device_get_device_number +g_udev_device_get_device_file +g_udev_device_get_device_file_symlinks +g_udev_device_get_parent +g_udev_device_get_parent_with_subsystem +g_udev_device_get_property_keys +g_udev_device_has_property +g_udev_device_get_property +g_udev_device_get_property_as_int +g_udev_device_get_property_as_uint64 +g_udev_device_get_property_as_double +g_udev_device_get_property_as_boolean +g_udev_device_get_property_as_strv +g_udev_device_get_sysfs_attr +g_udev_device_get_sysfs_attr_as_int +g_udev_device_get_sysfs_attr_as_uint64 +g_udev_device_get_sysfs_attr_as_double +g_udev_device_get_sysfs_attr_as_boolean +g_udev_device_get_sysfs_attr_as_strv + +G_UDEV_DEVICE +G_UDEV_IS_DEVICE +G_UDEV_TYPE_DEVICE +g_udev_device_get_type +G_UDEV_DEVICE_CLASS +G_UDEV_IS_DEVICE_CLASS +G_UDEV_DEVICE_GET_CLASS +
                    + diff --git a/extras/gudev/docs/gudev.types b/extras/gudev/docs/gudev.types new file mode 100644 index 0000000000..be090b1481 --- /dev/null +++ b/extras/gudev/docs/gudev.types @@ -0,0 +1,3 @@ +g_udev_device_type_get_type +g_udev_device_get_type +g_udev_client_get_type diff --git a/extras/gudev/docs/version.xml.in b/extras/gudev/docs/version.xml.in new file mode 100644 index 0000000000..d78bda9342 --- /dev/null +++ b/extras/gudev/docs/version.xml.in @@ -0,0 +1 @@ +@VERSION@ diff --git a/extras/gudev/gjs-example.js b/extras/gudev/gjs-example.js new file mode 100755 index 0000000000..5586fd6a61 --- /dev/null +++ b/extras/gudev/gjs-example.js @@ -0,0 +1,75 @@ +#!/usr/bin/env gjs-console + +// This currently depends on the following patches to gjs +// +// http://bugzilla.gnome.org/show_bug.cgi?id=584558 +// http://bugzilla.gnome.org/show_bug.cgi?id=584560 +// http://bugzilla.gnome.org/show_bug.cgi?id=584568 + +const GUdev = imports.gi.GUdev; +const Mainloop = imports.mainloop; + +function print_device (device) { + print (" subsystem: " + device.get_subsystem ()); + print (" devtype: " + device.get_devtype ()); + print (" name: " + device.get_name ()); + print (" number: " + device.get_number ()); + print (" sysfs_path: " + device.get_sysfs_path ()); + print (" driver: " + device.get_driver ()); + print (" action: " + device.get_action ()); + print (" seqnum: " + device.get_seqnum ()); + print (" device type: " + device.get_device_type ()); + print (" device number: " + device.get_device_number ()); + print (" device file: " + device.get_device_file ()); + print (" device file symlinks: " + device.get_device_file_symlinks ()); + print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); + var keys = device.get_property_keys (); + for (var n = 0; n < keys.length; n++) { + print (" " + keys[n] + "=" + device.get_property (keys[n])); + } +} + +function on_uevent (client, action, device) { + print ("action " + action + " on device " + device.get_sysfs_path()); + print_device (device); + print (""); +} + +var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); +client.connect ("uevent", on_uevent); + +var block_devices = client.query_by_subsystem ("block"); +for (var n = 0; n < block_devices.length; n++) { + print ("block device: " + block_devices[n].get_device_file ()); +} + +var d; + +d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); +if (d == null) { + print ("query_by_device_number 0x810 -> null"); +} else { + print ("query_by_device_number 0x810 -> " + d.get_device_file ()); + var dd = d.get_parent_with_subsystem ("usb", null); + print_device (dd); + print ("--------------------------------------------------------------------------"); + while (d != null) { + print_device (d); + print (""); + d = d.get_parent (); + } +} + +d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); +print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); + +d = client.query_by_subsystem_and_name ("block", "sda2"); +print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/sda"); +print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/block/8:0"); +print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); + +Mainloop.run('udev-example'); diff --git a/extras/gudev/gudev-1.0.pc.in b/extras/gudev/gudev-1.0.pc.in new file mode 100644 index 0000000000..058262d767 --- /dev/null +++ b/extras/gudev/gudev-1.0.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: gudev-1.0 +Description: GObject bindings for libudev +Version: @VERSION@ +Requires: glib-2.0, gobject-2.0 +Libs: -L${libdir} -lgudev-1.0 +Cflags: -I${includedir}/gudev-1.0 diff --git a/extras/gudev/gudev.h b/extras/gudev/gudev.h new file mode 100644 index 0000000000..50c6e0d236 --- /dev/null +++ b/extras/gudev/gudev.h @@ -0,0 +1,36 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __G_UDEV_H__ +#define __G_UDEV_H__ + +#ifndef G_UDEV_API_IS_SUBJECT_TO_CHANGE +#error GUdev is currently unstable API. You must define G_UDEV_API_IS_SUBJECT_TO_CHANGE to acknowledge this. +#endif + +#define _GUDEV_INSIDE_GUDEV_H 1 +#include +#include +#include +#include +#include +#undef _GUDEV_INSIDE_GUDEV_H + +#endif /* __G_UDEV_H__ */ diff --git a/extras/gudev/gudevclient.c b/extras/gudev/gudevclient.c new file mode 100644 index 0000000000..bb6d67326f --- /dev/null +++ b/extras/gudev/gudevclient.c @@ -0,0 +1,502 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "gudevclient.h" +#include "gudevdevice.h" +#include "gudevmarshal.h" +#include "gudevprivate.h" + +/** + * SECTION:gudevclient + * @short_description: Query devices and listen to uevents + * + * #GUdevClient is used to query information about devices on a Linux + * system from the Linux kernel and the udev device + * manager. + * + * Device information is retrieved from the kernel (through the + * sysfs filesystem) and the udev daemon (through a + * tmpfs filesystem) and presented through + * #GUdevDevice objects. This means that no blocking IO ever happens + * (in both cases, we are essentially just reading data from kernel + * memory) and as such there are no asynchronous versions of the + * provided methods. + * + * To get information about a device, use + * g_udev_client_query_by_subsystem(), + * g_udev_client_query_by_device_number(), + * g_udev_client_query_by_device_file(), + * g_udev_client_query_by_sysfs_path() or + * g_udev_client_query_by_subsystem_and_name(). + * + * To listen to uevents, connect to the #GUdevClient::uevent signal. + */ + +struct _GUdevClientPrivate +{ + guint watch_id; + struct udev *udev; + struct udev_monitor *monitor; + + gchar **subsystems; +}; + +enum +{ + PROP_0, + PROP_SUBSYSTEMS, +}; + +enum +{ + UEVENT_SIGNAL, + LAST_SIGNAL, +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + +G_DEFINE_TYPE (GUdevClient, g_udev_client, G_TYPE_OBJECT) + +/* ---------------------------------------------------------------------------------------------------- */ + +static gboolean +monitor_event (GIOChannel *source, + GIOCondition condition, + gpointer data) +{ + GUdevClient *client = (GUdevClient *) data; + GUdevDevice *device; + struct udev_device *udevice; + + udevice = udev_monitor_receive_device (client->priv->monitor); + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + g_signal_emit (client, + signals[UEVENT_SIGNAL], + 0, + g_udev_device_get_action (device), + device); + g_object_unref (device); + + out: + return TRUE; +} + +static void +g_udev_client_finalize (GObject *object) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + + if (client->priv->watch_id != 0) + { + g_source_remove (client->priv->watch_id); + client->priv->watch_id = 0; + } + + if (client->priv->monitor != NULL) + { + udev_monitor_unref (client->priv->monitor); + client->priv->monitor = NULL; + } + + if (client->priv->udev != NULL) + { + udev_unref (client->priv->udev); + client->priv->udev = NULL; + } + + g_strfreev (client->priv->subsystems); + + if (G_OBJECT_CLASS (g_udev_client_parent_class)->finalize != NULL) + G_OBJECT_CLASS (g_udev_client_parent_class)->finalize (object); +} + +static void +g_udev_client_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + + switch (prop_id) + { + case PROP_SUBSYSTEMS: + if (client->priv->subsystems != NULL) + g_strfreev (client->priv->subsystems); + client->priv->subsystems = g_strdupv (g_value_get_boxed (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_client_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + + switch (prop_id) + { + case PROP_SUBSYSTEMS: + g_value_set_boxed (value, client->priv->subsystems); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_client_constructed (GObject *object) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + GIOChannel *channel; + guint n; + + client->priv->udev = udev_new (); + + /* connect to event source */ + client->priv->monitor = udev_monitor_new_from_netlink (client->priv->udev, "udev"); + + //g_debug ("ss = %p", client->priv->subsystems); + + if (client->priv->subsystems != NULL) + { + /* install subsytem filters to only wake up for certain events */ + for (n = 0; client->priv->subsystems[n] != NULL; n++) + { + gchar *subsystem; + gchar *devtype; + gchar *s; + + subsystem = g_strdup (client->priv->subsystems[n]); + devtype = NULL; + + //g_debug ("s = '%s'", subsystem); + + s = strstr (subsystem, "/"); + if (s != NULL) + { + devtype = s + 1; + *s = '\0'; + } + + udev_monitor_filter_add_match_subsystem_devtype (client->priv->monitor, subsystem, devtype); + + g_free (subsystem); + } + + /* listen to events, and buffer them */ + udev_monitor_enable_receiving (client->priv->monitor); + + channel = g_io_channel_unix_new (udev_monitor_get_fd (client->priv->monitor)); + client->priv->watch_id = g_io_add_watch (channel, G_IO_IN, monitor_event, client); + g_io_channel_unref (channel); + } + + if (G_OBJECT_CLASS (g_udev_client_parent_class)->constructed != NULL) + G_OBJECT_CLASS (g_udev_client_parent_class)->constructed (object); +} + + +static void +g_udev_client_class_init (GUdevClientClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->constructed = g_udev_client_constructed; + gobject_class->set_property = g_udev_client_set_property; + gobject_class->get_property = g_udev_client_get_property; + gobject_class->finalize = g_udev_client_finalize; + + /** + * GUdevClient:subsystems: + * + * The subsystems to listen for uevents on. + * + * To listen for only a specific DEVTYPE for a given SUBSYSTEM, use + * "subsystem/devtype". For example, to only listen for uevents + * where SUBSYSTEM is usb and DEVTYPE is usb_interface, use + * "usb/usb_interface". + * + * If this property is %NULL, then no events will be reported. If + * it's the empty array, events from all subsystems will be + * reported. + */ + g_object_class_install_property (gobject_class, + PROP_SUBSYSTEMS, + g_param_spec_boxed ("subsystems", + "The subsystems to listen for changes on", + "The subsystems to listen for changes on", + G_TYPE_STRV, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE)); + + /** + * GUdevClient::uevent: + * @client: The #GUdevClient receiving the event. + * @action: The action for the uevent e.g. "add", "remove", "change", "move", etc. + * @device: Details about the #GUdevDevice the event is for. + * + * Emitted when @client receives an uevent. + */ + signals[UEVENT_SIGNAL] = g_signal_new ("uevent", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GUdevClientClass, uevent), + NULL, + NULL, + g_udev_marshal_VOID__STRING_OBJECT, + G_TYPE_NONE, + 2, + G_TYPE_STRING, + G_UDEV_TYPE_DEVICE); + + g_type_class_add_private (klass, sizeof (GUdevClientPrivate)); +} + +static void +g_udev_client_init (GUdevClient *client) +{ + client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, + G_UDEV_TYPE_CLIENT, + GUdevClientPrivate); +} + +/** + * g_udev_client_new: + * @subsystems: (allow-none): A %NULL terminated string array of subsystems to listen for uevents on, %NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the #GUdevClient:subsystems property for details on this parameter. + * + * Constructs a #GUdevClient object that can be used to query + * information about devices. Connect to the #GUdevClient::uevent + * signal to listen for uevents. + * + * Returns: A new #GUdevClient object. Free with g_object_unref(). + */ +GUdevClient * +g_udev_client_new (const gchar * const *subsystems) +{ + return G_UDEV_CLIENT (g_object_new (G_UDEV_TYPE_CLIENT, "subsystems", subsystems, NULL)); +} + +/** + * g_udev_client_query_by_subsystem: + * @client: A #GUdevClient. + * @subsystem: (allow-none): The subsystem to get devices for or %NULL to get all devices. + * + * Gets all devices belonging to @subsystem. + * + * Returns: (element-type GUdevDevice): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. + */ +GList * +g_udev_client_query_by_subsystem (GUdevClient *client, + const gchar *subsystem) +{ + struct udev_enumerate *enumerate; + struct udev_list_entry *l, *devices; + GList *ret; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + + ret = NULL; + + /* prepare a device scan */ + enumerate = udev_enumerate_new (client->priv->udev); + + /* filter for subsystem */ + if (subsystem != NULL) + udev_enumerate_add_match_subsystem (enumerate, subsystem); + /* retrieve the list */ + udev_enumerate_scan_devices (enumerate); + + /* add devices to the list */ + devices = udev_enumerate_get_list_entry (enumerate); + for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) + { + struct udev_device *udevice; + GUdevDevice *device; + + udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerate), + udev_list_entry_get_name (l)); + if (udevice == NULL) + continue; + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + ret = g_list_prepend (ret, device); + } + udev_enumerate_unref (enumerate); + + ret = g_list_reverse (ret); + + return ret; +} + +/** + * g_udev_client_query_by_device_number: + * @client: A #GUdevClient. + * @type: A value from the #GUdevDeviceType enumeration. + * @number: A device number. + * + * Looks up a device for a type and device number. + * + * Returns: A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_device_number (GUdevClient *client, + GUdevDeviceType type, + GUdevDeviceNumber number) +{ + struct udev_device *udevice; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + + device = NULL; + udevice = udev_device_new_from_devnum (client->priv->udev, type, number); + + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + + out: + return device; +} + +/** + * g_udev_client_query_by_device_file: + * @client: A #GUdevClient. + * @device_file: A device file. + * + * Looks up a device for a device file. + * + * Returns: A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_device_file (GUdevClient *client, + const gchar *device_file) +{ + struct stat stat_buf; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + g_return_val_if_fail (device_file != NULL, NULL); + + device = NULL; + + if (stat (device_file, &stat_buf) != 0) + goto out; + + if (stat_buf.st_rdev == 0) + goto out; + + if (S_ISBLK (stat_buf.st_mode)) + device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_BLOCK, stat_buf.st_rdev); + else if (S_ISCHR (stat_buf.st_mode)) + device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_CHAR, stat_buf.st_rdev); + + out: + return device; +} + +/** + * g_udev_client_query_by_sysfs_path: + * @client: A #GUdevClient. + * @sysfs_path: A sysfs path. + * + * Looks up a device for a sysfs path. + * + * Returns: A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_sysfs_path (GUdevClient *client, + const gchar *sysfs_path) +{ + struct udev_device *udevice; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + g_return_val_if_fail (sysfs_path != NULL, NULL); + + device = NULL; + udevice = udev_device_new_from_syspath (client->priv->udev, sysfs_path); + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + + out: + return device; +} + +/** + * g_udev_client_query_by_subsystem_and_name: + * @client: A #GUdevClient. + * @subsystem: A subsystem name. + * @name: The name of the device. + * + * Looks up a device for a subsystem and name. + * + * Returns: A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_subsystem_and_name (GUdevClient *client, + const gchar *subsystem, + const gchar *name) +{ + struct udev_device *udevice; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + g_return_val_if_fail (name != NULL, NULL); + + device = NULL; + udevice = udev_device_new_from_subsystem_sysname (client->priv->udev, subsystem, name); + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + + out: + return device; +} + diff --git a/extras/gudev/gudevclient.h b/extras/gudev/gudevclient.h new file mode 100644 index 0000000000..6e365c6d35 --- /dev/null +++ b/extras/gudev/gudevclient.h @@ -0,0 +1,101 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_CLIENT_H__ +#define __G_UDEV_CLIENT_H__ + +#include + +G_BEGIN_DECLS + +#define G_UDEV_TYPE_CLIENT (g_udev_client_get_type ()) +#define G_UDEV_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_CLIENT, GUdevClient)) +#define G_UDEV_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_CLIENT, GUdevClientClass)) +#define G_UDEV_IS_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_CLIENT)) +#define G_UDEV_IS_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_CLIENT)) +#define G_UDEV_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_CLIENT, GUdevClientClass)) + +typedef struct _GUdevClientClass GUdevClientClass; +typedef struct _GUdevClientPrivate GUdevClientPrivate; + +/** + * GUdevClient: + * @parent: Parent instance. + * + * The #GUdevClient struct is opaque and should not be accessed directly. + */ +struct _GUdevClient +{ + GObject parent; + + /*< private >*/ + GUdevClientPrivate *priv; +}; + +/** + * GUdevClientClass: + * @parent_class: Parent class. + * @uevent: Signal class handler for the #GUdevClient::uevent signal. + * + * Class structure for #GUdevClient. + */ +struct _GUdevClientClass +{ + GObjectClass parent_class; + + /* signals */ + void (*uevent) (GUdevClient *client, + const gchar *action, + GUdevDevice *device); + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); + void (*reserved7) (void); + void (*reserved8) (void); +}; + +GType g_udev_client_get_type (void) G_GNUC_CONST; +GUdevClient *g_udev_client_new (const gchar* const *subsystems); +GList *g_udev_client_query_by_subsystem (GUdevClient *client, + const gchar *subsystem); +GUdevDevice *g_udev_client_query_by_device_number (GUdevClient *client, + GUdevDeviceType type, + GUdevDeviceNumber number); +GUdevDevice *g_udev_client_query_by_device_file (GUdevClient *client, + const gchar *device_file); +GUdevDevice *g_udev_client_query_by_sysfs_path (GUdevClient *client, + const gchar *sysfs_path); +GUdevDevice *g_udev_client_query_by_subsystem_and_name (GUdevClient *client, + const gchar *subsystem, + const gchar *name); + +G_END_DECLS + +#endif /* __G_UDEV_CLIENT_H__ */ diff --git a/extras/gudev/gudevdevice.c b/extras/gudev/gudevdevice.c new file mode 100644 index 0000000000..76f2d7e5f8 --- /dev/null +++ b/extras/gudev/gudevdevice.c @@ -0,0 +1,891 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "gudevdevice.h" +#include "gudevprivate.h" + +/** + * SECTION:gudevdevice + * @short_description: Get information about a device + * + * The #GUdevDevice class is used to get information about a specific + * device. Note that you cannot instantiate a #GUdevDevice object + * yourself. Instead you must use #GUdevClient to obtain #GUdevDevice + * objects. + * + * To get basic information about a device, use + * g_udev_device_get_subsystem(), g_udev_device_get_devtype(), + * g_udev_device_get_name(), g_udev_device_get_number(), + * g_udev_device_get_sysfs_path(), g_udev_device_get_driver(), + * g_udev_device_get_action(), g_udev_device_get_seqnum(), + * g_udev_device_get_device_type(), g_udev_device_get_device_number(), + * g_udev_device_get_device_file(), + * g_udev_device_get_device_file_symlinks(). + * + * To navigate the device tree, use g_udev_device_get_parent() and + * g_udev_device_get_parent_with_subsystem(). + * + * To access udev properties for the device, use + * g_udev_device_get_property_keys(), + * g_udev_device_has_property(), + * g_udev_device_get_property(), + * g_udev_device_get_property_as_int(), + * g_udev_device_get_property_as_uint64(), + * g_udev_device_get_property_as_double(), + * g_udev_device_get_property_as_boolean() and + * g_udev_device_get_property_as_strv(). + * + * To access sysfs attributes for the device, use + * g_udev_device_get_sysfs_attr(), + * g_udev_device_get_sysfs_attr_as_int(), + * g_udev_device_get_sysfs_attr_as_uint64(), + * g_udev_device_get_sysfs_attr_as_double(), + * g_udev_device_get_sysfs_attr_as_boolean() and + * g_udev_device_get_sysfs_attr_as_strv(). + * + * Note that all getters on #GUdevDevice are non-reffing – returned + * values are owned by the object, should not be freed and are only + * valid as long as the object is alive. + * + * By design, #GUdevDevice will not react to changes for a device – it + * only contains a snapshot of information when the #GUdevDevice + * object was created. To work with changes, you typically connect to + * the #GUdevClient::uevent signal on a #GUdevClient and get a new + * #GUdevDevice whenever an event happens. + */ + +struct _GUdevDevicePrivate +{ + struct udev_device *udevice; + + /* computed ondemand and cached */ + gchar **device_file_symlinks; + gchar **property_keys; + GHashTable *prop_strvs; + GHashTable *sysfs_attr_strvs; +}; + +G_DEFINE_TYPE (GUdevDevice, g_udev_device, G_TYPE_OBJECT) + +static void +g_udev_device_finalize (GObject *object) +{ + GUdevDevice *device = G_UDEV_DEVICE (object); + + g_strfreev (device->priv->device_file_symlinks); + g_strfreev (device->priv->property_keys); + + if (device->priv->udevice != NULL) + udev_device_unref (device->priv->udevice); + + if (device->priv->prop_strvs != NULL) + g_hash_table_unref (device->priv->prop_strvs); + + if (device->priv->sysfs_attr_strvs != NULL) + g_hash_table_unref (device->priv->sysfs_attr_strvs); + + if (G_OBJECT_CLASS (g_udev_device_parent_class)->finalize != NULL) + (* G_OBJECT_CLASS (g_udev_device_parent_class)->finalize) (object); +} + +static void +g_udev_device_class_init (GUdevDeviceClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->finalize = g_udev_device_finalize; + + g_type_class_add_private (klass, sizeof (GUdevDevicePrivate)); +} + +static void +g_udev_device_init (GUdevDevice *device) +{ + device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device, + G_UDEV_TYPE_DEVICE, + GUdevDevicePrivate); +} + + +GUdevDevice * +_g_udev_device_new (struct udev_device *udevice) +{ + GUdevDevice *device; + + device = G_UDEV_DEVICE (g_object_new (G_UDEV_TYPE_DEVICE, NULL)); + device->priv->udevice = udev_device_ref (udevice); + + return device; +} + +/** + * g_udev_device_get_subsystem: + * @device: A #GUdevDevice. + * + * Gets the subsystem for @device. + * + * Returns: The subsystem for @device. + */ +const gchar * +g_udev_device_get_subsystem (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_subsystem (device->priv->udevice); +} + +/** + * g_udev_device_get_devtype: + * @device: A #GUdevDevice. + * + * Gets the device type for @device. + * + * Returns: The devtype for @device. + */ +const gchar * +g_udev_device_get_devtype (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_devtype (device->priv->udevice); +} + +/** + * g_udev_device_get_name: + * @device: A #GUdevDevice. + * + * Gets the name of @device, e.g. "sda3". + * + * Returns: The name of @device. + */ +const gchar * +g_udev_device_get_name (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_sysname (device->priv->udevice); +} + +/** + * g_udev_device_get_number: + * @device: A #GUdevDevice. + * + * Gets the number of @device, e.g. "3" if g_udev_device_get_name() returns "sda3". + * + * Returns: The number of @device. + */ +const gchar * +g_udev_device_get_number (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_sysnum (device->priv->udevice); +} + +/** + * g_udev_device_get_sysfs_path: + * @device: A #GUdevDevice. + * + * Gets the sysfs path for @device. + * + * Returns: The sysfs path for @device. + */ +const gchar * +g_udev_device_get_sysfs_path (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_syspath (device->priv->udevice); +} + +/** + * g_udev_device_get_driver: + * @device: A #GUdevDevice. + * + * Gets the name of the driver used for @device. + * + * Returns: The name of the driver for @device or %NULL if unknown. + */ +const gchar * +g_udev_device_get_driver (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_driver (device->priv->udevice); +} + +/** + * g_udev_device_get_action: + * @device: A #GUdevDevice. + * + * Gets the most recent action (e.g. "add", "remove", "change", etc.) for @device. + * + * Returns: An action string. + */ +const gchar * +g_udev_device_get_action (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_action (device->priv->udevice); +} + +/** + * g_udev_device_get_seqnum: + * @device: A #GUdevDevice. + * + * Gets the most recent sequence number for @device. + * + * Returns: A sequence number. + */ +guint64 +g_udev_device_get_seqnum (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_seqnum (device->priv->udevice); +} + +/** + * g_udev_device_get_device_type: + * @device: A #GUdevDevice. + * + * Gets the type of the device file, if any, for @device. + * + * Returns: The device number for @device or #G_UDEV_DEVICE_TYPE_NONE if the device does not have a device file. + */ +GUdevDeviceType +g_udev_device_get_device_type (GUdevDevice *device) +{ + struct stat stat_buf; + const gchar *device_file; + GUdevDeviceType type; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), G_UDEV_DEVICE_TYPE_NONE); + + type = G_UDEV_DEVICE_TYPE_NONE; + + /* TODO: would be better to have support for this in libudev... */ + + device_file = g_udev_device_get_device_file (device); + if (device_file == NULL) + goto out; + + if (stat (device_file, &stat_buf) != 0) + goto out; + + if (S_ISBLK (stat_buf.st_mode)) + type = G_UDEV_DEVICE_TYPE_BLOCK; + else if (S_ISCHR (stat_buf.st_mode)) + type = G_UDEV_DEVICE_TYPE_CHAR; + + out: + return type; +} + +/** + * g_udev_device_get_device_number: + * @device: A #GUdevDevice. + * + * Gets the device number, if any, for @device. + * + * Returns: The device number for @device or 0 if unknown. + */ +GUdevDeviceNumber +g_udev_device_get_device_number (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_devnum (device->priv->udevice); +} + +/** + * g_udev_device_get_device_file: + * @device: A #GUdevDevice. + * + * Gets the device file for @device. + * + * Returns: The device file for @device or %NULL if no device file + * exists. + */ +const gchar * +g_udev_device_get_device_file (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_devnode (device->priv->udevice); +} + +/** + * g_udev_device_get_device_file_symlinks: + * @device: A #GUdevDevice. + * + * Gets a list of symlinks (in /dev) that points to + * the device file for @device. + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of symlinks. This array is owned by @device and should not be freed by the caller. + */ +const gchar * const * +g_udev_device_get_device_file_symlinks (GUdevDevice *device) +{ + struct udev_list_entry *l; + GPtrArray *p; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + if (device->priv->device_file_symlinks != NULL) + goto out; + + p = g_ptr_array_new (); + for (l = udev_device_get_devlinks_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) + { + g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); + } + g_ptr_array_add (p, NULL); + device->priv->device_file_symlinks = (gchar **) g_ptr_array_free (p, FALSE); + + out: + return (const gchar * const *) device->priv->device_file_symlinks; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * g_udev_device_get_parent: + * @device: A #GUdevDevice. + * + * Gets the immediate parent of @device, if any. + * + * Returns: A #GUdevDevice or %NULL if @device has no parent. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_device_get_parent (GUdevDevice *device) +{ + GUdevDevice *ret; + struct udev_device *udevice; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + ret = NULL; + + udevice = udev_device_get_parent (device->priv->udevice); + if (udevice == NULL) + goto out; + + ret = _g_udev_device_new (udevice); + + out: + return ret; +} + +/** + * g_udev_device_get_parent_with_subsystem: + * @device: A #GUdevDevice. + * @subsystem: The subsystem of the parent to get. + * @devtype: (allow-none): The devtype of the parent to get or %NULL. + * + * Walks up the chain of parents of @device and returns the first + * device encountered where @subsystem and @devtype matches, if any. + * + * Returns: A #GUdevDevice or %NULL if @device has no parent with @subsystem and @devtype. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_device_get_parent_with_subsystem (GUdevDevice *device, + const gchar *subsystem, + const gchar *devtype) +{ + GUdevDevice *ret; + struct udev_device *udevice; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + + ret = NULL; + + udevice = udev_device_get_parent_with_subsystem_devtype (device->priv->udevice, + subsystem, + devtype); + if (udevice == NULL) + goto out; + + ret = _g_udev_device_new (udevice); + + out: + return ret; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * g_udev_device_get_property_keys: + * @device: A #GUdevDevice. + * + * Gets all keys for properties on @device. + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of property keys. This array is owned by @device and should not be freed by the caller. + */ +const gchar* const * +g_udev_device_get_property_keys (GUdevDevice *device) +{ + struct udev_list_entry *l; + GPtrArray *p; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + if (device->priv->property_keys != NULL) + goto out; + + p = g_ptr_array_new (); + for (l = udev_device_get_properties_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) + { + g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); + } + g_ptr_array_add (p, NULL); + device->priv->property_keys = (gchar **) g_ptr_array_free (p, FALSE); + + out: + return (const gchar * const *) device->priv->property_keys; +} + + +/** + * g_udev_device_has_property: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Check if a the property with the given key exists. + * + * Returns: %TRUE only if the value for @key exist. + */ +gboolean +g_udev_device_has_property (GUdevDevice *device, + const gchar *key) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + g_return_val_if_fail (key != NULL, FALSE); + return udev_device_get_property_value (device->priv->udevice, key) != NULL; +} + +/** + * g_udev_device_get_property: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device. + * + * Returns: The value for @key or %NULL if @key doesn't exist on @device. Do not free this string, it is owned by @device. + */ +const gchar * +g_udev_device_get_property (GUdevDevice *device, + const gchar *key) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (key != NULL, NULL); + return udev_device_get_property_value (device->priv->udevice, key); +} + +/** + * g_udev_device_get_property_as_int: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to an integer + * using strtol(). + * + * Returns: The value for @key or 0 if @key doesn't exist or + * isn't an integer. + */ +gint +g_udev_device_get_property_as_int (GUdevDevice *device, + const gchar *key) +{ + gint result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (key != NULL, 0); + + result = 0; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = strtol (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_property_as_uint64: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to an unsigned + * 64-bit integer using strtoll(). + * + * Returns: The value for @key or 0 if @key doesn't exist or isn't a + * #guint64. + */ +guint64 +g_udev_device_get_property_as_uint64 (GUdevDevice *device, + const gchar *key) +{ + guint64 result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (key != NULL, 0); + + result = 0; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = strtoll (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_property_as_double: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to a double + * precision floating point number using strtod(). + * + * Returns: The value for @key or 0.0 if @key doesn't exist or isn't a + * #gdouble. + */ +gdouble +g_udev_device_get_property_as_double (GUdevDevice *device, + const gchar *key) +{ + gdouble result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); + g_return_val_if_fail (key != NULL, 0.0); + + result = 0.0; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = strtod (s, NULL); +out: + return result; +} + +/** + * g_udev_device_get_property_as_boolean: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to an + * boolean. This is done by doing a case-insensitive string comparison + * on the string value against "1" and "true". + * + * Returns: The value for @key or %FALSE if @key doesn't exist or + * isn't a #gboolean. + */ +gboolean +g_udev_device_get_property_as_boolean (GUdevDevice *device, + const gchar *key) +{ + gboolean result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + g_return_val_if_fail (key != NULL, FALSE); + + result = FALSE; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) + result = TRUE; + out: + return result; +} + +static gchar ** +split_at_whitespace (const gchar *s) +{ + gchar **result; + guint n; + guint m; + + result = g_strsplit_set (s, " \v\t\r\n", 0); + + /* remove empty strings, thanks GLib */ + for (n = 0; result[n] != NULL; n++) + { + if (strlen (result[n]) == 0) + { + g_free (result[n]); + for (m = n; result[m] != NULL; m++) + result[m] = result[m + 1]; + n--; + } + } + + return result; +} + +/** + * g_udev_device_get_property_as_strv: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and return the result of + * splitting it into non-empty tokens split at white space (only space + * (' '), form-feed ('\f'), newline ('\n'), carriage return ('\r'), + * horizontal tab ('\t'), and vertical tab ('\v') are considered; the + * locale is not taken into account). + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of @key on @device split into tokens or %NULL if @key doesn't exist. This array is owned by @device and should not be freed by the caller. + */ +const gchar* const * +g_udev_device_get_property_as_strv (GUdevDevice *device, + const gchar *key) +{ + gchar **result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (key != NULL, NULL); + + if (device->priv->prop_strvs != NULL) + { + result = g_hash_table_lookup (device->priv->prop_strvs, key); + if (result != NULL) + goto out; + } + + result = NULL; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = split_at_whitespace (s); + if (result == NULL) + goto out; + + if (device->priv->prop_strvs == NULL) + device->priv->prop_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); + g_hash_table_insert (device->priv->prop_strvs, g_strdup (key), result); + +out: + return (const gchar* const *) result; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * g_udev_device_get_sysfs_attr: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device. + * + * Returns: The value of the sysfs attribute or %NULL if there is no + * such attribute. Do not free this string, it is owned by @device. + */ +const gchar * +g_udev_device_get_sysfs_attr (GUdevDevice *device, + const gchar *name) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (name != NULL, NULL); + return udev_device_get_sysattr_value (device->priv->udevice, name); +} + +/** + * g_udev_device_get_sysfs_attr_as_int: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to an integer + * using strtol(). + * + * Returns: The value of the sysfs attribute or 0 if there is no such + * attribute. + */ +gint +g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, + const gchar *name) +{ + gint result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (name != NULL, 0); + + result = 0; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = strtol (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_uint64: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to an unsigned + * 64-bit integer using strtoll(). + * + * Returns: The value of the sysfs attribute or 0 if there is no such + * attribute. + */ +guint64 +g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, + const gchar *name) +{ + guint64 result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (name != NULL, 0); + + result = 0; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = strtoll (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_double: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to a double + * precision floating point number using strtod(). + * + * Returns: The value of the sysfs attribute or 0.0 if there is no such + * attribute. + */ +gdouble +g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, + const gchar *name) +{ + gdouble result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); + g_return_val_if_fail (name != NULL, 0.0); + + result = 0.0; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = strtod (s, NULL); +out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_boolean: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to an + * boolean. This is done by doing a case-insensitive string comparison + * on the string value against "1" and "true". + * + * Returns: The value of the sysfs attribute or %FALSE if there is no such + * attribute. + */ +gboolean +g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, + const gchar *name) +{ + gboolean result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + g_return_val_if_fail (name != NULL, FALSE); + + result = FALSE; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) + result = TRUE; + out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_strv: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and return the result of + * splitting it into non-empty tokens split at white space (only space (' '), + * form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal + * tab ('\t'), and vertical tab ('\v') are considered; the locale is + * not taken into account). + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of the sysfs attribute split into tokens or %NULL if there is no such attribute. This array is owned by @device and should not be freed by the caller. + */ +const gchar * const * +g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, + const gchar *name) +{ + gchar **result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (name != NULL, NULL); + + if (device->priv->sysfs_attr_strvs != NULL) + { + result = g_hash_table_lookup (device->priv->sysfs_attr_strvs, name); + if (result != NULL) + goto out; + } + + result = NULL; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = split_at_whitespace (s); + if (result == NULL) + goto out; + + if (device->priv->sysfs_attr_strvs == NULL) + device->priv->sysfs_attr_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); + g_hash_table_insert (device->priv->sysfs_attr_strvs, g_strdup (name), result); + +out: + return (const gchar* const *) result; +} diff --git a/extras/gudev/gudevdevice.h b/extras/gudev/gudevdevice.h new file mode 100644 index 0000000000..0ed3cf5364 --- /dev/null +++ b/extras/gudev/gudevdevice.h @@ -0,0 +1,126 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_DEVICE_H__ +#define __G_UDEV_DEVICE_H__ + +#include + +G_BEGIN_DECLS + +#define G_UDEV_TYPE_DEVICE (g_udev_device_get_type ()) +#define G_UDEV_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_DEVICE, GUdevDevice)) +#define G_UDEV_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) +#define G_UDEV_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_DEVICE)) +#define G_UDEV_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_DEVICE)) +#define G_UDEV_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) + +typedef struct _GUdevDeviceClass GUdevDeviceClass; +typedef struct _GUdevDevicePrivate GUdevDevicePrivate; + +/** + * GUdevDevice: + * @parent: Parent instance. + * + * The #GUdevDevice struct is opaque and should not be accessed directly. + */ +struct _GUdevDevice +{ + GObject parent; + + /*< private >*/ + GUdevDevicePrivate *priv; +}; + +/** + * GUdevDeviceClass: + * @parent_class: Parent class. + * + * Class structure for #GUdevDevice. + */ +struct _GUdevDeviceClass +{ + GObjectClass parent_class; + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); + void (*reserved7) (void); + void (*reserved8) (void); +}; + +GType g_udev_device_get_type (void) G_GNUC_CONST; +const gchar *g_udev_device_get_subsystem (GUdevDevice *device); +const gchar *g_udev_device_get_devtype (GUdevDevice *device); +const gchar *g_udev_device_get_name (GUdevDevice *device); +const gchar *g_udev_device_get_number (GUdevDevice *device); +const gchar *g_udev_device_get_sysfs_path (GUdevDevice *device); +const gchar *g_udev_device_get_driver (GUdevDevice *device); +const gchar *g_udev_device_get_action (GUdevDevice *device); +guint64 g_udev_device_get_seqnum (GUdevDevice *device); +GUdevDeviceType g_udev_device_get_device_type (GUdevDevice *device); +GUdevDeviceNumber g_udev_device_get_device_number (GUdevDevice *device); +const gchar *g_udev_device_get_device_file (GUdevDevice *device); +const gchar* const *g_udev_device_get_device_file_symlinks (GUdevDevice *device); +GUdevDevice *g_udev_device_get_parent (GUdevDevice *device); +GUdevDevice *g_udev_device_get_parent_with_subsystem (GUdevDevice *device, + const gchar *subsystem, + const gchar *devtype); +const gchar* const *g_udev_device_get_property_keys (GUdevDevice *device); +gboolean g_udev_device_has_property (GUdevDevice *device, + const gchar *key); +const gchar *g_udev_device_get_property (GUdevDevice *device, + const gchar *key); +gint g_udev_device_get_property_as_int (GUdevDevice *device, + const gchar *key); +guint64 g_udev_device_get_property_as_uint64 (GUdevDevice *device, + const gchar *key); +gdouble g_udev_device_get_property_as_double (GUdevDevice *device, + const gchar *key); +gboolean g_udev_device_get_property_as_boolean (GUdevDevice *device, + const gchar *key); +const gchar* const *g_udev_device_get_property_as_strv (GUdevDevice *device, + const gchar *key); + +const gchar *g_udev_device_get_sysfs_attr (GUdevDevice *device, + const gchar *name); +gint g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, + const gchar *name); +guint64 g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, + const gchar *name); +gdouble g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, + const gchar *name); +gboolean g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, + const gchar *name); +const gchar* const *g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, + const gchar *name); + +G_END_DECLS + +#endif /* __G_UDEV_DEVICE_H__ */ diff --git a/extras/gudev/gudevenums.h b/extras/gudev/gudevenums.h new file mode 100644 index 0000000000..c3a0aa8747 --- /dev/null +++ b/extras/gudev/gudevenums.h @@ -0,0 +1,49 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_ENUMS_H__ +#define __G_UDEV_ENUMS_H__ + +#include + +G_BEGIN_DECLS + +/** + * GUdevDeviceType: + * @G_UDEV_DEVICE_TYPE_NONE: Device does not have a device file. + * @G_UDEV_DEVICE_TYPE_BLOCK: Device is a block device. + * @G_UDEV_DEVICE_TYPE_CHAR: Device is a character device. + * + * Enumeration used to specify a the type of a device. + */ +typedef enum +{ + G_UDEV_DEVICE_TYPE_NONE = 0, + G_UDEV_DEVICE_TYPE_BLOCK = 'b', + G_UDEV_DEVICE_TYPE_CHAR = 'c', +} GUdevDeviceType; + +G_END_DECLS + +#endif /* __G_UDEV_ENUMS_H__ */ diff --git a/extras/gudev/gudevenumtypes.c.template b/extras/gudev/gudevenumtypes.c.template new file mode 100644 index 0000000000..fc30b39e2e --- /dev/null +++ b/extras/gudev/gudevenumtypes.c.template @@ -0,0 +1,39 @@ +/*** BEGIN file-header ***/ +#include + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} + +/*** END value-tail ***/ + +/*** BEGIN file-tail ***/ +/*** END file-tail ***/ diff --git a/extras/gudev/gudevenumtypes.h.template b/extras/gudev/gudevenumtypes.h.template new file mode 100644 index 0000000000..d0ab3393e6 --- /dev/null +++ b/extras/gudev/gudevenumtypes.h.template @@ -0,0 +1,24 @@ +/*** BEGIN file-header ***/ +#ifndef __GUDEV_ENUM_TYPES_H__ +#define __GUDEV_ENUM_TYPES_H__ + +#include + +G_BEGIN_DECLS +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) +/*** END value-header ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __GUDEV_ENUM_TYPES_H__ */ +/*** END file-tail ***/ diff --git a/extras/gudev/gudevmarshal.list b/extras/gudev/gudevmarshal.list new file mode 100644 index 0000000000..7e665999e8 --- /dev/null +++ b/extras/gudev/gudevmarshal.list @@ -0,0 +1 @@ +VOID:STRING,OBJECT diff --git a/extras/gudev/gudevprivate.h b/extras/gudev/gudevprivate.h new file mode 100644 index 0000000000..64b008fb83 --- /dev/null +++ b/extras/gudev/gudevprivate.h @@ -0,0 +1,40 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_PRIVATE_H__ +#define __G_UDEV_PRIVATE_H__ + +#include + +#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 1 +#include + +G_BEGIN_DECLS + +GUdevDevice * +_g_udev_device_new (struct udev_device *udevice); + +G_END_DECLS + +#endif /* __G_UDEV_PRIVATE_H__ */ diff --git a/extras/gudev/gudevtypes.h b/extras/gudev/gudevtypes.h new file mode 100644 index 0000000000..66156723f2 --- /dev/null +++ b/extras/gudev/gudevtypes.h @@ -0,0 +1,45 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_TYPES_H__ +#define __G_UDEV_TYPES_H__ + +#include + +G_BEGIN_DECLS + +typedef struct _GUdevClient GUdevClient; +typedef struct _GUdevDevice GUdevDevice; + +/** + * GUdevDeviceNumber: + * + * Corresponds to the standard #dev_t type as defined by POSIX (Until + * bug 584517 is resolved this is aliased to an integer). + */ +typedef int GUdevDeviceNumber; + +G_END_DECLS + +#endif /* __G_UDEV_TYPES_H__ */ diff --git a/extras/gudev/seed-example.js b/extras/gudev/seed-example.js new file mode 100755 index 0000000000..e2ac324d23 --- /dev/null +++ b/extras/gudev/seed-example.js @@ -0,0 +1,72 @@ +#!/usr/bin/env seed + +// seed example + +const GLib = imports.gi.GLib; +const GUdev = imports.gi.GUdev; + +function print_device (device) { + print (" subsystem: " + device.get_subsystem ()); + print (" devtype: " + device.get_devtype ()); + print (" name: " + device.get_name ()); + print (" number: " + device.get_number ()); + print (" sysfs_path: " + device.get_sysfs_path ()); + print (" driver: " + device.get_driver ()); + print (" action: " + device.get_action ()); + print (" seqnum: " + device.get_seqnum ()); + print (" device type: " + device.get_device_type ()); + print (" device number: " + device.get_device_number ()); + print (" device file: " + device.get_device_file ()); + print (" device file symlinks: " + device.get_device_file_symlinks ()); + print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); + var keys = device.get_property_keys (); + for (var n = 0; n < keys.length; n++) { + print (" " + keys[n] + "=" + device.get_property (keys[n])); + } +} + +function on_uevent (client, action, device) { + print ("action " + action + " on device " + device.get_sysfs_path()); + print_device (device); + print (""); +} + +var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); +client.signal.connect ("uevent", on_uevent); + +var block_devices = client.query_by_subsystem ("block"); +for (var n = 0; n < block_devices.length; n++) { + print ("block device: " + block_devices[n].get_device_file ()); +} + +var d; + +d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); +if (d == null) { + print ("query_by_device_number 0x810 -> null"); +} else { + print ("query_by_device_number 0x810 -> " + d.get_device_file ()); + dd = d.get_parent_with_subsystem ("usb", null); + print_device (dd); + print ("--------------------------------------------------------------------------"); + while (d != null) { + print_device (d); + print (""); + d = d.get_parent (); + } +} + +d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); +print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); + +d = client.query_by_subsystem_and_name ("block", "sda2"); +print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/sda"); +print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/block/8:0"); +print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); + +var mainloop = GLib.main_loop_new (); +GLib.main_loop_run (mainloop); -- cgit v1.2.3-54-g00ecf From 88a7923e91fddec8e4f4c9115168ede5d239d8ee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 18:06:13 +0200 Subject: INSTALL: add --enable-extras --- INSTALL | 4 ++++ configure.ac | 3 +++ 2 files changed, 7 insertions(+) diff --git a/INSTALL b/INSTALL index 743580c21e..9e24144728 100644 --- a/INSTALL +++ b/INSTALL @@ -31,6 +31,9 @@ All options: --with-selinux Link against SELInux libraries to set the expected context for created files. + --enable-extras + Build extras with larger external dependencies like glib, + libacl, libusb, ... The options used in a RPM spec file usually look like: --prefix=%{_prefix} @@ -38,6 +41,7 @@ The options used in a RPM spec file usually look like: --sysconfdir=%{_sysconfdir} --with-libdir-name=%{_lib} --with-selinux + --enable-extras The defined location for scripts and binaries which are called from rules is /lib/udev/ on all systems and architectures. Any diff --git a/configure.ac b/configure.ac index 077944b3dd..b4d00e8429 100644 --- a/configure.ac +++ b/configure.ac @@ -65,6 +65,9 @@ if test "x$enable_extras" = xyes; then PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0]) AC_SUBST([GLIB_CFLAGS]) AC_SUBST([GLIB_LIBS]) + + AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) + AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) fi AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) -- cgit v1.2.3-54-g00ecf From fc04059abfc5d1fa9bfe9afb15ca03017a26fb56 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 18:11:40 +0200 Subject: udev-acl: handle missing action when called in CK mode --- extras/udev-acl/udev-acl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index ec95025eb3..3eb29fe2f2 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -159,7 +159,7 @@ static int consolekit_called(const char *action, uid_t *uid, const char **own_se const char *s; const char *session; - if (strcmp(action, "session_active_changed") != 0) + if (action == NULL || strcmp(action, "session_active_changed") != 0) return -1; s = getenv("CK_SESSION_IS_LOCAL"); -- cgit v1.2.3-54-g00ecf From c5a9680ee7cddac4b7a7d05447209dcd5a4cfce3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 18:41:05 +0200 Subject: v4l_id: move from udev-extras --- configure.ac | 1 + extras/Makefile.am | 3 +- extras/gudev/docs/.gitignore | 2 +- extras/v4l_id/.gitignore | 1 + extras/v4l_id/70-v4l.rules | 20 +++++++ extras/v4l_id/Makefile.am | 9 +++ extras/v4l_id/v4l_id.c | 101 ++++++++++++++++++++++++++++++++++ rules/Makefile.am | 1 - rules/rules.d/60-persistent-v4l.rules | 17 ------ 9 files changed, 135 insertions(+), 20 deletions(-) create mode 100644 extras/v4l_id/.gitignore create mode 100644 extras/v4l_id/70-v4l.rules create mode 100644 extras/v4l_id/Makefile.am create mode 100644 extras/v4l_id/v4l_id.c delete mode 100644 rules/rules.d/60-persistent-v4l.rules diff --git a/configure.ac b/configure.ac index b4d00e8429..960a552e87 100644 --- a/configure.ac +++ b/configure.ac @@ -106,6 +106,7 @@ AC_CONFIG_FILES([ extras/rule_generator/Makefile extras/scsi_id/Makefile extras/usb_id/Makefile + extras/v4l_id/Makefile extras/udev-acl/Makefile extras/gudev/Makefile extras/gudev/gudev-1.0.pc diff --git a/extras/Makefile.am b/extras/Makefile.am index 629b70e387..9528e8afa3 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -11,7 +11,8 @@ SUBDIRS = \ fstab_import \ rule_generator \ scsi_id \ - usb_id + usb_id \ + v4l_id if ENABLE_EXTRAS SUBDIRS += \ diff --git a/extras/gudev/docs/.gitignore b/extras/gudev/docs/.gitignore index a471783ca9..1ac5f7f307 100644 --- a/extras/gudev/docs/.gitignore +++ b/extras/gudev/docs/.gitignore @@ -3,12 +3,12 @@ gudev-decl.txt gudev-overrides.txt gudev-undeclared.txt gudev-undocumented.txt +gudev-unused.txt gudev.args gudev.hierarchy gudev.interfaces gudev.prerequisites gudev.signals -gudev.unused html.stamp html/* xml/* diff --git a/extras/v4l_id/.gitignore b/extras/v4l_id/.gitignore new file mode 100644 index 0000000000..dffced9f08 --- /dev/null +++ b/extras/v4l_id/.gitignore @@ -0,0 +1 @@ +v4l_id diff --git a/extras/v4l_id/70-v4l.rules b/extras/v4l_id/70-v4l.rules new file mode 100644 index 0000000000..a342a71949 --- /dev/null +++ b/extras/v4l_id/70-v4l.rules @@ -0,0 +1,20 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="persistent_v4l_end" +SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" +ENV{MAJOR}=="", GOTO="persistent_v4l_end" + +IMPORT{program}="v4l_id $tempnode" + +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" + +# check for valid "index" number +TEST!="index", GOTO="persistent_v4l_end" +ATTR{index}!="?*", GOTO="persistent_v4l_end" + +IMPORT{program}="path_id %p" +ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" +ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" + +LABEL="persistent_v4l_end" diff --git a/extras/v4l_id/Makefile.am b/extras/v4l_id/Makefile.am new file mode 100644 index 0000000000..6ff9fcd630 --- /dev/null +++ b/extras/v4l_id/Makefile.am @@ -0,0 +1,9 @@ +include $(top_srcdir)/Makefile.am.inc + +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = v4l_id + +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = 70-v4l.rules + +v4l_id_SOURCES = v4l_id.c diff --git a/extras/v4l_id/v4l_id.c b/extras/v4l_id/v4l_id.c new file mode 100644 index 0000000000..59b4f2f737 --- /dev/null +++ b/extras/v4l_id/v4l_id.c @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2009 Kay Sievers + * Copyright (c) 2009 Filippo Argiolas + * + * 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; either version 2 of the + * License, or (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + {} + }; + int fd; + char *device; + struct video_capability v1cap; + struct v4l2_capability v2cap; + + while (1) { + int option; + + option = getopt_long(argc, argv, "h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + printf("Usage: v4l_id [--help] \n\n"); + default: + return 1; + } + } + device = argv[optind]; + + if (device == NULL) + return 2; + fd = open (device, O_RDONLY); + if (fd < 0) + return 3; + + if (ioctl (fd, VIDIOC_QUERYCAP, &v2cap) == 0) { + printf("ID_V4L_VERSION=2\n"); + printf("ID_V4L_PRODUCT=%s\n", v2cap.card); + printf("ID_V4L_CAPABILITIES=:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0) + printf("capture:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) > 0) + printf("video_output:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_OVERLAY) > 0) + printf("video_overlay:"); + if ((v2cap.capabilities & V4L2_CAP_AUDIO) > 0) + printf("audio:"); + if ((v2cap.capabilities & V4L2_CAP_TUNER) > 0) + printf("tuner:"); + if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0) + printf("radio:"); + printf("\n"); + } else if (ioctl (fd, VIDIOCGCAP, &v1cap) == 0) { + printf("ID_V4L_VERSION=1\n"); + printf("ID_V4L_PRODUCT=%s\n", v1cap.name); + printf("ID_V4L_CAPABILITIES=:"); + if ((v1cap.type & VID_TYPE_CAPTURE) > 0) + printf("capture:"); + if ((v1cap.type & VID_TYPE_OVERLAY) > 0) + printf("video_overlay:"); + if (v1cap.audios > 0) + printf("audio:"); + if ((v1cap.type & VID_TYPE_TUNER) > 0) + printf("tuner:"); + printf("\n"); + } + + close (fd); + return 0; +} diff --git a/rules/Makefile.am b/rules/Makefile.am index 7f3cd5982d..6f1744fdb3 100644 --- a/rules/Makefile.am +++ b/rules/Makefile.am @@ -7,7 +7,6 @@ dist_udevrules_DATA = \ rules.d/60-persistent-storage-tape.rules \ rules.d/60-persistent-serial.rules \ rules.d/60-persistent-input.rules \ - rules.d/60-persistent-v4l.rules \ rules.d/80-drivers.rules \ rules.d/95-udev-late.rules diff --git a/rules/rules.d/60-persistent-v4l.rules b/rules/rules.d/60-persistent-v4l.rules deleted file mode 100644 index 8415cd059b..0000000000 --- a/rules/rules.d/60-persistent-v4l.rules +++ /dev/null @@ -1,17 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add|change", GOTO="persistent_v4l_end" -SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" - -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" - -# check for valid "index" number -TEST!="index", GOTO="persistent_v4l_end" -ATTR{index}!="?*", GOTO="persistent_v4l_end" - -IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" -ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" - -LABEL="persistent_v4l_end" -- cgit v1.2.3-54-g00ecf From 0303f35723f75157d8ef05be4d28b425aaa2fc45 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 18:54:18 +0200 Subject: libudev: doc - libudev-docs.sgml -> libudev-doc.xml --- libudev/docs/Makefile.am | 2 +- libudev/docs/libudev-docs.sgml | 31 ------------------------------- libudev/docs/libudev-docs.xml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 32 deletions(-) delete mode 100644 libudev/docs/libudev-docs.sgml create mode 100644 libudev/docs/libudev-docs.xml diff --git a/libudev/docs/Makefile.am b/libudev/docs/Makefile.am index 46b8797203..5229f0f450 100644 --- a/libudev/docs/Makefile.am +++ b/libudev/docs/Makefile.am @@ -15,7 +15,7 @@ DOC_MODULE=libudev #DOC_MODULE_VERSION=2 # The top-level SGML file. You can change this if you want to. -DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml # The directory containing the source code. Relative to $(srcdir). # gtk-doc will search all .c & .h files beneath here for inline comments diff --git a/libudev/docs/libudev-docs.sgml b/libudev/docs/libudev-docs.sgml deleted file mode 100644 index b0372818c6..0000000000 --- a/libudev/docs/libudev-docs.sgml +++ /dev/null @@ -1,31 +0,0 @@ - - -]> - - - libudev Reference Manual - for libudev version &version; - - 2009 - Kay Sievers <kay.sievers@vrfy.org> - - - - - libudev - - - - - - - - - - API Index - - - diff --git a/libudev/docs/libudev-docs.xml b/libudev/docs/libudev-docs.xml new file mode 100644 index 0000000000..b0372818c6 --- /dev/null +++ b/libudev/docs/libudev-docs.xml @@ -0,0 +1,31 @@ + + +]> + + + libudev Reference Manual + for libudev version &version; + + 2009 + Kay Sievers <kay.sievers@vrfy.org> + + + + + libudev + + + + + + + + + + API Index + + + -- cgit v1.2.3-54-g00ecf From be51950dc4c20ba35af26e4d4d16c5298629e7a3 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Tue, 16 Jun 2009 19:30:22 +0200 Subject: hid2hci: move from udev-extras --- configure.ac | 5 + extras/Makefile.am | 1 + extras/hid2hci/.gitignore | 1 + extras/hid2hci/70-hid2hci.rules | 25 +++ extras/hid2hci/Makefile.am | 10 ++ extras/hid2hci/hid2hci.c | 376 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 418 insertions(+) create mode 100644 extras/hid2hci/.gitignore create mode 100644 extras/hid2hci/70-hid2hci.rules create mode 100644 extras/hid2hci/Makefile.am create mode 100644 extras/hid2hci/hid2hci.c diff --git a/configure.ac b/configure.ac index 960a552e87..82695b9138 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,10 @@ if test "x$enable_extras" = xyes; then AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) + + PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12) + AC_SUBST(LIBUSB_CFLAGS) + AC_SUBST(LIBUSB_LIBS) fi AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) @@ -107,6 +111,7 @@ AC_CONFIG_FILES([ extras/scsi_id/Makefile extras/usb_id/Makefile extras/v4l_id/Makefile + extras/hid2hci/Makefile extras/udev-acl/Makefile extras/gudev/Makefile extras/gudev/gudev-1.0.pc diff --git a/extras/Makefile.am b/extras/Makefile.am index 9528e8afa3..e4136ad531 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -17,5 +17,6 @@ SUBDIRS = \ if ENABLE_EXTRAS SUBDIRS += \ udev-acl \ + hid2hci \ gudev endif diff --git a/extras/hid2hci/.gitignore b/extras/hid2hci/.gitignore new file mode 100644 index 0000000000..efd972905a --- /dev/null +++ b/extras/hid2hci/.gitignore @@ -0,0 +1 @@ +hid2hci diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules new file mode 100644 index 0000000000..2cb2746050 --- /dev/null +++ b/extras/hid2hci/70-hid2hci.rules @@ -0,0 +1,25 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="hid2hci_end" +SUBSYSTEM!="usb", GOTO="hid2hci_end" + +# Variety of Dell Bluetooth devices - it looks like a bit of an odd rule, +# because it is matching on a mouse device that is self powered, but that +# is where a HID report needs to be sent to switch modes. +# +# Known supported devices: 413c:8154, 413c:8158, 413c:8162 +ATTR{bInterfaceProtocol}=="02", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ + RUN+="hid2hci --method dell -v $attr{idVendor} -p $attr{idProduct} --mode hci" + +ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" + +# Logitech devices +ATTR{idVendor}=="046d", ATTR{idProduct}=="c70[345abce]", RUN+="hid2hci --method logitech -v $attr{idVendor} -p $attr{idProduct} --mode hci" +ATTR{idVendor}=="046d", ATTR{idProduct}=="c71[34bc]", RUN+="hid2hci --method logitech -v $attr{idVendor} -p $attr{idProduct} --mode hci" + +# CSR devices (in HID mode) +ATTR{idVendor}=="0a12", ATTR{idProduct}=="1000", RUN+="hid2hci --method csr -v $attr{idVendor} -p $attr{idProduct} --mode hci" +ATTR{idVendor}=="0458", ATTR{idProduct}=="1000", RUN+="hid2hci --method csr -v $attr{idVendor} -p $attr{idProduct} --mode hci" +ATTR{idVendor}=="05ac", ATTR{idProduct}=="1000", RUN+="hid2hci --method csr -v $attr{idVendor} -p $attr{idProduct} --mode hci" + +LABEL="hid2hci_end" diff --git a/extras/hid2hci/Makefile.am b/extras/hid2hci/Makefile.am new file mode 100644 index 0000000000..45fb840337 --- /dev/null +++ b/extras/hid2hci/Makefile.am @@ -0,0 +1,10 @@ +include $(top_srcdir)/Makefile.am.inc + +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = hid2hci + +udevrulesdir = $(udev_prefix)/lib/udev/rules.d +dist_udevrules_DATA = 70-hid2hci.rules + +hid2hci_SOURCES = hid2hci.c +hid2hci_LDADD = @LIBUSB_LIBS@ diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c new file mode 100644 index 0000000000..aa44790f2b --- /dev/null +++ b/extras/hid2hci/hid2hci.c @@ -0,0 +1,376 @@ +/* + * + * hid2hci : a tool for switching the radio on devices that support + * it from HID to HCI and back + * + * Copyright (C) 2003-2009 Marcel Holtmann + * Copyright (C) 2008-2009 Mario Limonciello + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef NEED_USB_GET_BUSSES +static inline struct usb_bus *usb_get_busses(void) +{ + return usb_busses; +} +#endif + +#ifndef USB_DIR_OUT +#define USB_DIR_OUT 0x00 +#endif + +static char devpath[PATH_MAX + 1] = "/dev"; + +struct hiddev_devinfo { + unsigned int bustype; + unsigned int busnum; + unsigned int devnum; + unsigned int ifnum; + short vendor; + short product; + short version; + unsigned num_applications; +}; + +struct hiddev_report_info { + unsigned report_type; + unsigned report_id; + unsigned num_fields; +}; + +typedef __signed__ int __s32; + +struct hiddev_usage_ref { + unsigned report_type; + unsigned report_id; + unsigned field_index; + unsigned usage_index; + unsigned usage_code; + __s32 value; +}; + +#define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo) +#define HIDIOCINITREPORT _IO('H', 0x05) +#define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info) +#define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref) + +#define HID_REPORT_TYPE_OUTPUT 2 + +#define HCI 0 +#define HID 1 + +struct device_info { + struct usb_device *dev; + int mode; + uint16_t vendor; + uint16_t product; +}; + +static int switch_csr(struct device_info *devinfo) +{ + struct usb_dev_handle *udev; + int err; + + udev = usb_open(devinfo->dev); + if (!udev) + return -errno; + + err = usb_control_msg(udev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, devinfo->mode, 0, NULL, 0, 10000); + + if (err == 0) { + err = -1; + errno = EALREADY; + } else { + if (errno == ETIMEDOUT) + err = 0; + } + + usb_close(udev); + + return err; +} + +static int send_report(int fd, const char *buf, size_t size) +{ + struct hiddev_report_info rinfo; + struct hiddev_usage_ref uref; + unsigned int i; + int err; + + for (i = 0; i < size; i++) { + memset(&uref, 0, sizeof(uref)); + uref.report_type = HID_REPORT_TYPE_OUTPUT; + uref.report_id = 0x10; + uref.field_index = 0; + uref.usage_index = i; + uref.usage_code = 0xff000001; + uref.value = buf[i] & 0x000000ff; + err = ioctl(fd, HIDIOCSUSAGE, &uref); + if (err < 0) + return err; + } + + memset(&rinfo, 0, sizeof(rinfo)); + rinfo.report_type = HID_REPORT_TYPE_OUTPUT; + rinfo.report_id = 0x10; + rinfo.num_fields = 1; + err = ioctl(fd, HIDIOCSREPORT, &rinfo); + + return err; +} + +static int switch_logitech(struct device_info *devinfo) +{ + char devname[PATH_MAX + 1]; + int i, fd, err = -1; + + for (i = 0; i < 16; i++) { + struct hiddev_devinfo dinfo; + char rep1[] = { 0xff, 0x80, 0x80, 0x01, 0x00, 0x00 }; + char rep2[] = { 0xff, 0x80, 0x00, 0x00, 0x30, 0x00 }; + char rep3[] = { 0xff, 0x81, 0x80, 0x00, 0x00, 0x00 }; + + sprintf(devname, "%s/hiddev%d", devpath, i); + fd = open(devname, O_RDWR); + if (fd < 0) { + sprintf(devname, "%s/usb/hiddev%d", devpath, i); + fd = open(devname, O_RDWR); + if (fd < 0) { + sprintf(devname, "%s/usb/hid/hiddev%d", devpath, i); + fd = open(devname, O_RDWR); + if (fd < 0) + continue; + } + } + + memset(&dinfo, 0, sizeof(dinfo)); + err = ioctl(fd, HIDIOCGDEVINFO, &dinfo); + if (err < 0 || (int) dinfo.busnum != atoi(devinfo->dev->bus->dirname) || + (int) dinfo.devnum != atoi(devinfo->dev->filename)) { + close(fd); + continue; + } + + err = ioctl(fd, HIDIOCINITREPORT, 0); + if (err < 0) { + close(fd); + break; + } + + err = send_report(fd, rep1, sizeof(rep1)); + if (err < 0) { + close(fd); + break; + } + + err = send_report(fd, rep2, sizeof(rep2)); + if (err < 0) { + close(fd); + break; + } + + err = send_report(fd, rep3, sizeof(rep3)); + close(fd); + break; + } + + return err; +} + +static int switch_dell(struct device_info *devinfo) +{ + char report[] = { 0x7f, 0x00, 0x00, 0x00 }; + + struct usb_dev_handle *handle; + int err; + + switch (devinfo->mode) { + case HCI: + report[1] = 0x13; + break; + case HID: + report[1] = 0x14; + break; + } + + handle = usb_open(devinfo->dev); + if (!handle) + return -EIO; + + /* Don't need to check return, as might not be in use */ + usb_detach_kernel_driver_np(handle, 0); + + if (usb_claim_interface(handle, 0) < 0) { + usb_close(handle); + return -EIO; + } + + err = usb_control_msg(handle, + USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, + USB_REQ_SET_CONFIGURATION, 0x7f | (0x03 << 8), 0, + report, sizeof(report), 5000); + + if (err == 0) { + err = -1; + errno = EALREADY; + } else { + if (errno == ETIMEDOUT) + err = 0; + } + + usb_close(handle); + + return err; +} + +static int find_device(struct device_info* devinfo) +{ + struct usb_bus *bus; + struct usb_device *dev; + + usb_find_busses(); + usb_find_devices(); + + for (bus = usb_get_busses(); bus; bus = bus->next) + for (dev = bus->devices; dev; dev = dev->next) { + if (dev->descriptor.idVendor == devinfo->vendor && + dev->descriptor.idProduct == devinfo->product) { + devinfo->dev=dev; + return 1; + } + } + return 0; +} + +static void usage(char* error) +{ + if (error) + fprintf(stderr,"\n%s\n", error); + else + printf("hid2hci - Bluetooth HID to HCI mode switching utility\n\n"); + + printf("Usage:\n" + "\thid2hci [options]\n" + "\n"); + + printf("Options:\n" + "\t-h, --help Display help\n" + "\t-q, --quiet Don't display any messages\n" + "\t-r, --mode= Mode to switch to [hid, hci]\n" + "\t-v, --vendor= Vendor ID to act upon\n" + "\t-p, --product= Product ID to act upon\n" + "\t-m, --method= Method to use to switch [csr, logitech, dell]\n" + "\n"); + if (error) + exit(1); +} + +static const struct option main_options[] = { + { "help", no_argument, 0, 'h' }, + { "quiet", no_argument, 0, 'q' }, + { "mode", required_argument, 0, 'r' }, + { "vendor", required_argument, 0, 'v' }, + { "product", required_argument, 0, 'p' }, + { "method", required_argument, 0, 'm' }, + { 0, 0, 0, 0 } +}; + +int main(int argc, char *argv[]) +{ + struct device_info dev = { NULL, HCI, 0, 0 }; + int opt, quiet = 0; + int (*method)(struct device_info *dev) = NULL; + + while ((opt = getopt_long(argc, argv, "+r:v:p:m:qh", main_options, NULL)) != -1) { + switch (opt) { + case 'r': + if (optarg && !strcmp(optarg, "hid")) + dev.mode = HID; + else if (optarg && !strcmp(optarg, "hci")) + dev.mode = HCI; + else + usage("ERROR: Undefined radio mode\n"); + break; + case 'v': + sscanf(optarg, "%4hx", &dev.vendor); + break; + case 'p': + sscanf(optarg, "%4hx", &dev.product); + break; + case 'm': + if (optarg && !strcmp(optarg, "csr")) + method = switch_csr; + else if (optarg && !strcmp(optarg, "logitech")) + method = switch_logitech; + else if (optarg && !strcmp(optarg, "dell")) + method = switch_dell; + else + usage("ERROR: Undefined switching method\n"); + break; + case 'q': + quiet = 1; + break; + case 'h': + usage(NULL); + default: + exit(0); + } + } + + if (!quiet && (!dev.vendor || !dev.product || !method)) + usage("ERROR: Vendor ID, Product ID, and Switching Method must all be defined.\n"); + + argc -= optind; + argv += optind; + optind = 0; + + usb_init(); + + if (!find_device(&dev)) { + if (!quiet) + fprintf(stderr, "Device %04x:%04x not found on USB bus.\n", + dev.vendor, dev.product); + exit(1); + } + + if (!quiet) + printf("Attempting to switch device %04x:%04x to %s mode ", + dev.vendor, dev.product, dev.mode ? "HID" : "HCI"); + fflush(stdout); + + if (method(&dev) < 0 && !quiet) + printf("failed (%s)\n", strerror(errno)); + else if (!quiet) + printf("was successful\n"); + + return errno; +} -- cgit v1.2.3-54-g00ecf From c283f81cb7b3451cc3be75314d670cd5b8c7be3c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 19:56:31 +0200 Subject: gudev: fix typo in configure option --- configure.ac | 2 +- extras/gudev/.gitignore | 3 ++- extras/gudev/Makefile.am | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 82695b9138..2fae2ccd30 100644 --- a/configure.ac +++ b/configure.ac @@ -78,7 +78,7 @@ AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) AC_ARG_ENABLE([introspection], AS_HELP_STRING([--enable-introspection], [enable GObject introspection]), [], [enable_introspection=no]) -if test "$enable_introspection" = xyes; then +if test "x$enable_introspection" = xyes; then PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) diff --git a/extras/gudev/.gitignore b/extras/gudev/.gitignore index 575f13d785..d20fa523e4 100644 --- a/extras/gudev/.gitignore +++ b/extras/gudev/.gitignore @@ -5,4 +5,5 @@ gudevenumtypes.c gudevenumtypes.h gudevmarshal.c gudevmarshal.h - +GUdev-1.0.gir +GUdev-1.0.typelib diff --git a/extras/gudev/Makefile.am b/extras/gudev/Makefile.am index 852e455f67..71565e2a48 100644 --- a/extras/gudev/Makefile.am +++ b/extras/gudev/Makefile.am @@ -88,7 +88,7 @@ GUdev-1.0.gir: libgudev-1.0.la $(G_IR_SCANNER) Makefile.am --output $@ \ --pkg=glib-2.0 \ --pkg=gobject-2.0 \ - -I$(top_srcdir) \ + -I$(top_srcdir)/extras \ -D_GUDEV_COMPILATION \ -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ $(top_srcdir)/extras/gudev/gudev.h \ -- cgit v1.2.3-54-g00ecf From 446f9318161a10ef177b0a80c8ad2acc424b6454 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 20:13:17 +0200 Subject: v4l_id: 70-v4l.rules -> 60-persistent-v4l.rules --- extras/v4l_id/60-persistent-v4l.rules | 20 ++++++++++++++++++++ extras/v4l_id/70-v4l.rules | 20 -------------------- extras/v4l_id/Makefile.am | 2 +- 3 files changed, 21 insertions(+), 21 deletions(-) create mode 100644 extras/v4l_id/60-persistent-v4l.rules delete mode 100644 extras/v4l_id/70-v4l.rules diff --git a/extras/v4l_id/60-persistent-v4l.rules b/extras/v4l_id/60-persistent-v4l.rules new file mode 100644 index 0000000000..a342a71949 --- /dev/null +++ b/extras/v4l_id/60-persistent-v4l.rules @@ -0,0 +1,20 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="persistent_v4l_end" +SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" +ENV{MAJOR}=="", GOTO="persistent_v4l_end" + +IMPORT{program}="v4l_id $tempnode" + +SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" + +# check for valid "index" number +TEST!="index", GOTO="persistent_v4l_end" +ATTR{index}!="?*", GOTO="persistent_v4l_end" + +IMPORT{program}="path_id %p" +ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" +ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" + +LABEL="persistent_v4l_end" diff --git a/extras/v4l_id/70-v4l.rules b/extras/v4l_id/70-v4l.rules deleted file mode 100644 index a342a71949..0000000000 --- a/extras/v4l_id/70-v4l.rules +++ /dev/null @@ -1,20 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add|change", GOTO="persistent_v4l_end" -SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" -ENV{MAJOR}=="", GOTO="persistent_v4l_end" - -IMPORT{program}="v4l_id $tempnode" - -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" - -# check for valid "index" number -TEST!="index", GOTO="persistent_v4l_end" -ATTR{index}!="?*", GOTO="persistent_v4l_end" - -IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" -ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" - -LABEL="persistent_v4l_end" diff --git a/extras/v4l_id/Makefile.am b/extras/v4l_id/Makefile.am index 6ff9fcd630..3f8b0f75b4 100644 --- a/extras/v4l_id/Makefile.am +++ b/extras/v4l_id/Makefile.am @@ -4,6 +4,6 @@ udevhomedir = $(udev_prefix)/lib/udev udevhome_PROGRAMS = v4l_id udevrulesdir = $(udev_prefix)/lib/udev/rules.d -dist_udevrules_DATA = 70-v4l.rules +dist_udevrules_DATA = 60-persistent-v4l.rules v4l_id_SOURCES = v4l_id.c -- cgit v1.2.3-54-g00ecf From dc5440623faa52c75d93ae81d600063187129294 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 16 Jun 2009 20:26:20 +0200 Subject: rules: sound - move from udev-extra --- rules/Makefile.am | 2 + rules/rules.d/60-persistent-alsa.rules | 15 ++++++ rules/rules.d/78-sound-card.rules | 91 ++++++++++++++++++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 rules/rules.d/60-persistent-alsa.rules create mode 100644 rules/rules.d/78-sound-card.rules diff --git a/rules/Makefile.am b/rules/Makefile.am index 6f1744fdb3..b1dc088e2c 100644 --- a/rules/Makefile.am +++ b/rules/Makefile.am @@ -7,6 +7,8 @@ dist_udevrules_DATA = \ rules.d/60-persistent-storage-tape.rules \ rules.d/60-persistent-serial.rules \ rules.d/60-persistent-input.rules \ + rules.d/60-persistent-alsa.rules \ + rules.d/78-sound-card.rules \ rules.d/80-drivers.rules \ rules.d/95-udev-late.rules diff --git a/rules/rules.d/60-persistent-alsa.rules b/rules/rules.d/60-persistent-alsa.rules new file mode 100644 index 0000000000..a5206fdbb1 --- /dev/null +++ b/rules/rules.d/60-persistent-alsa.rules @@ -0,0 +1,15 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="persistent_alsa_end" +SUBSYSTEM!="sound", GOTO="persistent_alsa_end" +KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end" + +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}" +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}" +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +ENV{ID_PATH}=="", IMPORT{program}="path_id %p" +ENV{ID_PATH}=="?*", SYMLINK+="snd/by-path/$env{ID_PATH}" + +LABEL="persistent_alsa_end" diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules new file mode 100644 index 0000000000..f851b46e00 --- /dev/null +++ b/rules/rules.d/78-sound-card.rules @@ -0,0 +1,91 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM!="sound", GOTO="sound_end" + +ACTION=="add|change", KERNEL=="controlC*", ATTR{../uevent}="change" +ACTION!="change", GOTO="sound_end" + +# Ok, we probably need a little explanation here for what the two lines above +# are good for. +# +# The story goes like this: when ALSA registers a new sound card it emits a +# series of 'add' events to userspace, for the main card device and for all the +# child device nodes that belong to it. udev relays those to applications, +# however only maintains the order between father and child, but not between +# the siblings. The control device node creation can be used as synchronization +# point. All other devices that belong to a card are created in the kernel +# before it. However unfortunately due to the fact that siblings are forwarded +# out of order by udev this fact is lost to applications. +# +# OTOH before an application can open a device it needs to make sure that all +# its device nodes are completely created and set up. +# +# As a workaround for this issue we have added the udev rule above which will +# generate a 'change' event on the main card device from the 'add' event of the +# card's control device. Due to the ordering semantics of udev this event will +# only be relayed after all child devices have finished processing properly. +# When an application needs to listen for appearing devices it can hence look +# for 'change' events only, and ignore the actual 'add' events. +# +# When the application is initialized at the same time as a device is plugged +# in it may need to figure out if the 'change' event has already been triggered +# or not for a card. To find that out we store the flag environment variable +# SOUND_INITIALIZED on the device which simply tells us if the card 'change' +# event has already been processed. + +KERNEL!="card*", GOTO="sound_end" + +ENV{SOUND_INITIALIZED}="1" + +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" +SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" +SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}!="", ENV{ID_IFACE}="$attr{bInterfaceNumber}" +SUBSYSTEMS=="usb", GOTO="skip_pci" + +SUBSYSTEMS=="pci", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="pci-db %p" +SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" + +LABEL="skip_pci" + +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}" +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}" + +ENV{ID_PATH}=="", IMPORT{program}="/usr/bin/env -i /lib/udev/path_id %p/controlC%n" + +# The values used here for $SOUND_FORM_FACTOR and $SOUND_CLASS should be kept +# in sync with those defined for PulseAudio's src/pulse/proplist.h +# PA_PROP_DEVICE_FORM_FACTOR, PA_PROP_DEVICE_CLASS properties. + +# If the first PCM device of this card has the pcm class 'modem', then the card is a modem +ATTR{pcmC%nD0p/pcm_class}=="modem", ENV{SOUND_CLASS}="modem", GOTO="sound_end" + +# Identify cards on the internal PCI bus as internal +SUBSYSTEMS=="pci", DEVPATH=="*/0000:00:??.?/sound/*", ENV{SOUND_FORM_FACTOR}="internal", GOTO="sound_end" + +# Recognize good old WinTV cards as TV cards +SUBSYSTEMS=="pci", DRIVERS=="Bt87x", ENV{SOUND_FORM_FACTOR}="tv", GOTO="sound_end" + +# Hmm, do we really want this database here? +SUBSYSTEMS=="usb", ATTRS{idVendor}=="0471", ATTRS{idProduct}=="0311", ENV{SOUND_FORM_FACTOR}="webcam", GOTO="sound_end" + +# Devices that also support Image/Video interfaces are most likely webcams +SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACES}=="*:0e????:*", ENV{SOUND_FORM_FACTOR}="webcam", GOTO="sound_end" + +# Matching on the model strings is a bit ugly, I admit +ENV{ID_MODEL}=="*[Ss]peaker*", ENV{SOUND_FORM_FACTOR}="speaker", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Ss]peaker*", ENV{SOUND_FORM_FACTOR}="speaker", GOTO="sound_end" + +ENV{ID_MODEL}=="*[Hh]eadphone*", ENV{SOUND_FORM_FACTOR}="headphone", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Hh]eadphone*", ENV{SOUND_FORM_FACTOR}="headphone", GOTO="sound_end" + +ENV{ID_MODEL}=="*[Hh]eadset*", ENV{SOUND_FORM_FACTOR}="headset", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Hh]eadset*", ENV{SOUND_FORM_FACTOR}="headset", GOTO="sound_end" + +ENV{ID_MODEL}=="*[Hh]andset*", ENV{SOUND_FORM_FACTOR}="handset", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Hh]andset*", ENV{SOUND_FORM_FACTOR}="handset", GOTO="sound_end" + +ENV{ID_MODEL}=="*[Mm]icrophone*", ENV{SOUND_FORM_FACTOR}="microphone", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Mm]icrophone*", ENV{SOUND_FORM_FACTOR}="microphone", GOTO="sound_end" + +LABEL="sound_end" -- cgit v1.2.3-54-g00ecf From 5a92fd9c9b89d8c880e0a93f32555d4aa7bbc6e6 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 16 Jun 2009 20:27:22 +0200 Subject: rules: tty/net - move from udev-extras --- rules/Makefile.am | 2 ++ rules/rules.d/75-net-description.rules | 14 ++++++++++++++ rules/rules.d/75-tty-description.rules | 14 ++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 rules/rules.d/75-net-description.rules create mode 100644 rules/rules.d/75-tty-description.rules diff --git a/rules/Makefile.am b/rules/Makefile.am index b1dc088e2c..694c54be07 100644 --- a/rules/Makefile.am +++ b/rules/Makefile.am @@ -8,6 +8,8 @@ dist_udevrules_DATA = \ rules.d/60-persistent-serial.rules \ rules.d/60-persistent-input.rules \ rules.d/60-persistent-alsa.rules \ + rules.d/75-net-description.rules \ + rules.d/75-tty-description.rules \ rules.d/78-sound-card.rules \ rules.d/80-drivers.rules \ rules.d/95-udev-late.rules diff --git a/rules/rules.d/75-net-description.rules b/rules/rules.d/75-net-description.rules new file mode 100644 index 0000000000..1c4c401d3b --- /dev/null +++ b/rules/rules.d/75-net-description.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="net_end" +SUBSYSTEM!="net", GOTO="net_end" + +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" +SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" +SUBSYSTEMS=="usb", GOTO="net_end" + +SUBSYSTEMS=="pci", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="pci-db %p" +SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" + +LABEL="net_end" diff --git a/rules/rules.d/75-tty-description.rules b/rules/rules.d/75-tty-description.rules new file mode 100644 index 0000000000..ac868adc0a --- /dev/null +++ b/rules/rules.d/75-tty-description.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add|change", GOTO="tty_end" +SUBSYSTEM!="tty", GOTO="tty_end" + +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" +SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" +SUBSYSTEMS=="usb", GOTO="tty_end" + +SUBSYSTEMS=="pci", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="pci-db %p" +SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" + +LABEL="tty_end" -- cgit v1.2.3-54-g00ecf From ccba91c746dfbb5623d537f39842c6873607db96 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 16 Jun 2009 20:57:28 +0200 Subject: usb-db: move from udev-extras --- configure.ac | 20 ++++ extras/Makefile.am | 1 + extras/usb-db/.gitignore | 2 + extras/usb-db/Makefile.am | 12 +++ extras/usb-db/usb-db.c | 266 ++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 301 insertions(+) create mode 100644 extras/usb-db/.gitignore create mode 100644 extras/usb-db/Makefile.am create mode 100644 extras/usb-db/usb-db.c diff --git a/configure.ac b/configure.ac index 2fae2ccd30..947ab80fd0 100644 --- a/configure.ac +++ b/configure.ac @@ -72,6 +72,22 @@ if test "x$enable_extras" = xyes; then PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12) AC_SUBST(LIBUSB_CFLAGS) AC_SUBST(LIBUSB_LIBS) + + PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) + AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) + + AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) + AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) + AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) + AC_ARG_WITH(pci-ids-path, + AS_HELP_STRING([--pci-ids-path=DIR], [Path to pci.ids file]), + [PCI_DATABASE=${withval}], + [if test -n "$pciids" ; then + PCI_DATABASE="$pciids" + else + AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) + fi]) + AC_SUBST(PCI_DATABASE) fi AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) @@ -113,6 +129,7 @@ AC_CONFIG_FILES([ extras/v4l_id/Makefile extras/hid2hci/Makefile extras/udev-acl/Makefile + extras/usb-db/Makefile extras/gudev/Makefile extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile @@ -144,5 +161,8 @@ AC_MSG_RESULT([ extras: ${enable_extras} gintrospection: ${enable_introspection} + usb.ids: ${USB_DATABASE} + pci.ids: ${PCI_DATABASE} + xsltproc: ${XSLTPROC} ]) diff --git a/extras/Makefile.am b/extras/Makefile.am index e4136ad531..07bf48edf7 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -17,6 +17,7 @@ SUBDIRS = \ if ENABLE_EXTRAS SUBDIRS += \ udev-acl \ + usb-db \ hid2hci \ gudev endif diff --git a/extras/usb-db/.gitignore b/extras/usb-db/.gitignore new file mode 100644 index 0000000000..861a8382a6 --- /dev/null +++ b/extras/usb-db/.gitignore @@ -0,0 +1,2 @@ +usb-db +pci-db diff --git a/extras/usb-db/Makefile.am b/extras/usb-db/Makefile.am new file mode 100644 index 0000000000..58fd2c9370 --- /dev/null +++ b/extras/usb-db/Makefile.am @@ -0,0 +1,12 @@ +include $(top_srcdir)/Makefile.am.inc + +udevhomedir = $(udev_prefix)/lib/udev +udevhome_PROGRAMS = usb-db pci-db + +usb_db_SOURCES = usb-db.c +usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB +usb_db_LDADD = $(top_builddir)/libudev/libudev.la + +pci_db_SOURCES = $(usb_db_SOURCES) +pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI +pci_db_LDADD = $(top_builddir)/libudev/libudev.la diff --git a/extras/usb-db/usb-db.c b/extras/usb-db/usb-db.c new file mode 100644 index 0000000000..db1f843c1a --- /dev/null +++ b/extras/usb-db/usb-db.c @@ -0,0 +1,266 @@ +/*-*- linux-c -*-*/ + +/* + * Copyright (C) 2009 Lennart Poettering + * + * 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; either version 2 of the + * License, or (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include + +#include + +#if defined(BUILD_FOR_USB) +# define DATABASE USB_DATABASE +# define SUBSYSTEM "usb" +# define DEVTYPE "usb_device" +# define VENDOR_ATTR "idVendor" +# define PRODUCT_ATTR "idProduct" +#elif defined(BUILD_FOR_PCI) +# define DATABASE PCI_DATABASE +# define SUBSYSTEM "pci" +# define DEVTYPE NULL +# define VENDOR_ATTR "vendor" +# define PRODUCT_ATTR "device" +#else +# error "Are you havin' a laugh?" +#endif + +static int get_id_attr( + struct udev_device *parent, + const char *name, + uint16_t *value) { + + const char *t; + unsigned u; + + if (!(t = udev_device_get_sysattr_value(parent, name))) { + fprintf(stderr, "%s lacks %s.\n", udev_device_get_syspath(parent), name); + return -1; + } + + if (!strncmp(t, "0x", 2)) + t += 2; + + if (sscanf(t, "%04x", &u) != 1 || u > 0xFFFFU) { + fprintf(stderr, "Failed to parse %s on %s.\n", name, udev_device_get_syspath(parent)); + return -1; + } + + *value = (uint16_t) u; + return 0; +} + +static int get_vid_pid( + struct udev_device *parent, + uint16_t *vid, + uint16_t *pid) { + + if (get_id_attr(parent, VENDOR_ATTR, vid) < 0) + return -1; + else if (*vid <= 0) { + fprintf(stderr, "Invalid vendor id.\n"); + return -1; + } + + if (get_id_attr(parent, PRODUCT_ATTR, pid) < 0) + return -1; + + return 0; +} + +static void rstrip(char *n) { + size_t i; + + for (i = strlen(n); i > 0 && isspace(n[i-1]); i--) + n[i-1] = 0; +} + +#define HEXCHARS "0123456789abcdefABCDEF" +#define WHITESPACE " \t\n\r" + +static int lookup_vid_pid( + uint16_t vid, + uint16_t pid, + char **vendor, + char **product) { + + FILE *f; + int ret = -1; + int found_vendor = 0; + char *line = NULL; + + *vendor = *product = NULL; + + if (!(f = fopen(DATABASE, "r"))) { + fprintf(stderr, "Failed to open database file "DATABASE": %s\n", strerror(errno)); + return -1; + } + + for (;;) { + size_t n; + + if (line) { + free(line); + line = NULL; + } + + if (getline(&line, &n, f) < 0) + break; + + rstrip(line); + + if (line[0] == '#' || line[0] == 0) + continue; + + if (strspn(line, HEXCHARS) == 4) { + unsigned u; + + if (found_vendor) + break; + + if (sscanf(line, "%04x", &u) == 1 && u == vid) { + char *t; + + t = line+4; + t += strspn(t, WHITESPACE); + + if (!(*vendor = strdup(t))) { + fprintf(stderr, "Out of memory.\n"); + goto finish; + } + + found_vendor = 1; + } + + continue; + } + + if (found_vendor && line[0] == '\t' && strspn(line+1, HEXCHARS) == 4) { + unsigned u; + + if (sscanf(line+1, "%04x", &u) == 1 && u == pid) { + char *t; + + t = line+5; + t += strspn(t, WHITESPACE); + + if (!(*product = strdup(t))) { + fprintf(stderr, "Out of memory.\n"); + goto finish; + } + + break; + } + } + } + + ret = 0; + +finish: + free(line); + fclose(f); + + if (ret < 0) { + free(*product); + free(*vendor); + + *product = *vendor = NULL; + } + + return ret; +} + +static struct udev_device *find_device(struct udev_device *dev, const char *subsys, const char *devtype) +{ + const char *str; + + str = udev_device_get_subsystem(dev); + if (str == NULL) + goto try_parent; + if (strcmp(str, subsys) != 0) + goto try_parent; + + if (devtype != NULL) { + str = udev_device_get_devtype(dev); + if (str == NULL) + goto try_parent; + if (strcmp(str, devtype) != 0) + goto try_parent; + } + return dev; +try_parent: + return udev_device_get_parent_with_subsystem_devtype(dev, SUBSYSTEM, DEVTYPE); +} + +int main(int argc, char*argv[]) { + + struct udev *udev = NULL; + int ret = 1; + char *sp; + struct udev_device *dev = NULL, *parent = NULL; + uint16_t vid = 0, pid = 0; + char *vendor = NULL, *product = NULL; + + if (argc < 2) { + fprintf(stderr, "Need to pass sysfs path.\n"); + goto finish; + } + + if (!(udev = udev_new())) + goto finish; + + if (asprintf(&sp, "%s/%s", udev_get_sys_path(udev), argv[1]) < 0) { + fprintf(stderr, "Failed to allocate sysfs path.\n"); + goto finish; + } + + dev = udev_device_new_from_syspath(udev, sp); + free(sp); + + if (!dev) { + fprintf(stderr, "Failed to access %s.\n", argv[1]); + goto finish; + } + + parent = find_device(dev, SUBSYSTEM, DEVTYPE); + if (!parent) { + fprintf(stderr, "Failed to find device.\n"); + goto finish; + } + + if (get_vid_pid(parent, &vid, &pid) < 0) + goto finish; + + if (lookup_vid_pid(vid, pid, &vendor, &product) < 0) + goto finish; + + if (vendor) + printf("ID_VENDOR_FROM_DATABASE=%s\n", vendor); + + if (product) + printf("ID_MODEL_FROM_DATABASE=%s\n", product); + + ret = 0; + +finish: + udev_device_unref(dev); + udev_unref(udev); + free(vendor); + free(product); + + return ret; +} -- cgit v1.2.3-54-g00ecf From 514b8d62123e3d63f2b935aa1d58e5c411f3f603 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 21:13:15 +0200 Subject: configure: enable all extras by default, provide --disable-extras --- INSTALL | 7 +++---- README | 3 +++ TODO | 2 ++ autogen.sh | 2 +- configure.ac | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/INSTALL b/INSTALL index 9e24144728..12678a29bf 100644 --- a/INSTALL +++ b/INSTALL @@ -31,9 +31,9 @@ All options: --with-selinux Link against SELInux libraries to set the expected context for created files. - --enable-extras - Build extras with larger external dependencies like glib, - libacl, libusb, ... + --disable-extras + Disable the build of extras with larger external dependencies + like glib, libacl, libusb, ... The options used in a RPM spec file usually look like: --prefix=%{_prefix} @@ -41,7 +41,6 @@ The options used in a RPM spec file usually look like: --sysconfdir=%{_sysconfdir} --with-libdir-name=%{_lib} --with-selinux - --enable-extras The defined location for scripts and binaries which are called from rules is /lib/udev/ on all systems and architectures. Any diff --git a/README b/README index d438afae46..3a511802ea 100644 --- a/README +++ b/README @@ -38,6 +38,9 @@ Requirements: these group names with only the rootfs mounted, and while no network is available. + - To build all udev extras, libacl, libglib2, libusb, usbutils, pciutils are + needed. These dependencies can be disabled with the --disable-extras option. + Operation: Udev creates and removes device nodes in /dev/, based on events the kernel sends out on device discovery or removal. diff --git a/TODO b/TODO index da99da4034..d1ae2d7ae3 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ + o CFLAGS debug + o cleanup old extras which link libudev source directly o fix configure options and libdir-name, exec-prefix, udev-prefix, libdir, ... o enumerate: sort control* after pcm* diff --git a/autogen.sh b/autogen.sh index e41bae05cf..63c1997736 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,7 +13,7 @@ CFLAGS="-g -Wall \ libdirname=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd)) args="--prefix=/usr --exec-prefix= --sysconfdir=/etc \ --libdir=/usr/$libdirname --with-libdir-name=$libdirname \ ---with-selinux --enable-gtk-doc --enable-extras" +--with-selinux --enable-gtk-doc" export CFLAGS="$CFLAGS -O2" ./configure $args $@ diff --git a/configure.ac b/configure.ac index 947ab80fd0..bba82ee7bd 100644 --- a/configure.ac +++ b/configure.ac @@ -59,8 +59,8 @@ if test "x$enable_logging" = "xyes"; then fi AC_ARG_ENABLE([extras], - AS_HELP_STRING([--enable-extras], [enable extras with external dependencies]), - [], [enable_extras=no]) + AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]), + [], [enable_extras=yes]) if test "x$enable_extras" = xyes; then PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0]) AC_SUBST([GLIB_CFLAGS]) -- cgit v1.2.3-54-g00ecf From bb0059f36e14cca41bdc242b13f39d57e8b7884d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 21:29:13 +0200 Subject: autogen.sh: make "CFLAGS=-O0 ./autogen.sh" working --- TODO | 1 - autogen.sh | 12 ++++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index d1ae2d7ae3..e3631837cb 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ - o CFLAGS debug o cleanup old extras which link libudev source directly o fix configure options and libdir-name, exec-prefix, udev-prefix, libdir, ... diff --git a/autogen.sh b/autogen.sh index 63c1997736..5c5903e0eb 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,17 +3,25 @@ gtkdocize autoreconf --install --symlink -CFLAGS="-g -Wall \ +MYCFLAGS="-g -Wall \ -Wmissing-declarations -Wmissing-prototypes \ -Wnested-externs -Wpointer-arith \ -Wpointer-arith -Wsign-compare -Wchar-subscripts \ -Wstrict-prototypes -Wshadow \ -Wformat=2 -Wtype-limits" +case "$CFLAGS" in + *-O[0-9]*) + ;; + *) + MYCFLAGS="$MYCFLAGS -O2" + ;; +esac + libdirname=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd)) args="--prefix=/usr --exec-prefix= --sysconfdir=/etc \ --libdir=/usr/$libdirname --with-libdir-name=$libdirname \ --with-selinux --enable-gtk-doc" -export CFLAGS="$CFLAGS -O2" +export CFLAGS="$CFLAGS $MYCFLAGS" ./configure $args $@ -- cgit v1.2.3-54-g00ecf From 29cf5b58be1a783157edc37d7151d86acbdd5732 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Jun 2009 22:02:19 +0200 Subject: NEWS: add --disable-extras --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index c8480fa2b3..1299c315e7 100644 --- a/NEWS +++ b/NEWS @@ -23,6 +23,10 @@ build without it and contain the pre-built documentation. An online copy is available here: http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/ +Many extras of the udev-extras repository have been merged into the main +udev repository. Some of the extras have larger external dependencies, and +they can be disabled with the configure switch --disable-extras. + udev 142 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 6133f3432fe86bc140cc9ba74794826f75c915fa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Jun 2009 02:25:07 +0200 Subject: cleanup ./configure installation directory options --- INSTALL | 47 +++++++++++++++++++-------------------- Makefile.am.inc | 6 ++++- NEWS | 5 +++++ TODO | 3 --- autogen.sh | 16 +++++++++---- configure.ac | 41 +++++++++++++--------------------- extras/ata_id/Makefile.am | 3 +-- extras/cdrom_id/Makefile.am | 4 +--- extras/collect/Makefile.am | 3 +-- extras/collect/collect.c | 2 +- extras/edd_id/Makefile.am | 4 +--- extras/firmware/Makefile.am | 4 +--- extras/floppy/Makefile.am | 3 +-- extras/fstab_import/Makefile.am | 4 +--- extras/gudev/Makefile.am | 3 +++ extras/hid2hci/Makefile.am | 15 ++++++++----- extras/path_id/Makefile.am | 3 +-- extras/rule_generator/Makefile.am | 5 ++--- extras/scsi_id/Makefile.am | 3 +-- extras/udev-acl/Makefile.am | 18 +++++++++------ extras/usb-db/Makefile.am | 27 +++++++++++++++------- extras/usb_id/Makefile.am | 3 +-- extras/v4l_id/Makefile.am | 11 ++++----- libudev/Makefile.am | 24 +++++++++----------- libudev/libudev-util-private.c | 2 +- libudev/libudev.c | 2 +- libudev/libudev.pc.in | 2 +- rules/Makefile.am | 1 - udev/udev-rules.c | 4 ++-- udev/udev.h | 2 +- udev/udevd.c | 2 +- 31 files changed, 139 insertions(+), 133 deletions(-) diff --git a/INSTALL b/INSTALL index 12678a29bf..7894555df8 100644 --- a/INSTALL +++ b/INSTALL @@ -1,26 +1,22 @@ Usual options for udev installed in the root filesystem are: - ./configure - --prefix=/usr - --exec-prefix= - --sysconfdir=/etc -For 64bit multilib-installations also: - --with-libdir-name=lib64 -For SELinux support: + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --sbindir=/sbin \ + --libdir=/usr/lib64 \ + --with-rootlibdir=/lib64 \ + --libexecdir=/lib/udev \ --with-selinux All options: --prefix= - Prefix for man pages, include files. - --exec-prefix= - Prefix for libs, binaries, usually the root filesystem. - --with-udev-prefix= - Prefix for internal udev path names, like /dev/, /lib/udev/. - Only useful for testing and development installations. The - value is copied from exec-prefix, if not specified otherwise. + Usually /usr, prefix for man pages, include files. --sysconfdir= Usually /etc. - --with-libdir-name= - Directory name for libraries. This is not a path name. + --sbindir= + Usually /sbin, the place for udevd and udevadm. + --libexecdir= + Usually /lib/udev, the udev private directory. --enable-debug Compile-in verbose debug messages. Usually not needed, it increases the size of the binaries. @@ -29,18 +25,21 @@ All options: is not recommended, as it makes it almost impossible to debug udev in the running system. --with-selinux - Link against SELInux libraries to set the expected context + Link against SELinux libraries to set the expected context for created files. --disable-extras - Disable the build of extras with larger external dependencies - like glib, libacl, libusb, ... + Disable the build of all extras which have larger external + dependencies like glib, libacl, libusb, ... The options used in a RPM spec file usually look like: - --prefix=%{_prefix} - --exec-prefix= - --sysconfdir=%{_sysconfdir} - --with-libdir-name=%{_lib} - --with-selinux + %configure \ + --prefix=%{_prefix} \ + --sysconfdir=%{_sysconfdir} \ + --sbindir=%{_sbindir} \ + --libdir=%{_libdir} \ + --with-rootlibdir=/%{_lib} \ + --libexecdir=/lib/udev \ + --with-selinux The defined location for scripts and binaries which are called from rules is /lib/udev/ on all systems and architectures. Any diff --git a/Makefile.am.inc b/Makefile.am.inc index 7a8659ebb8..59d21aa22e 100644 --- a/Makefile.am.inc +++ b/Makefile.am.inc @@ -2,9 +2,13 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ -I$(top_srcdir)/libudev \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DUDEV_PREFIX=\""$(udev_prefix)"\" + -DLIBEXECDIR=\""$(libexecdir)"\" AM_CFLAGS = AM_LDFLAGS = \ -Wl,--as-needed + +udevrulesdir = \ + $(libexecdir)/rules.d + diff --git a/NEWS b/NEWS index 1299c315e7..89890a8d06 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ udev 143 ======== Bugfixes. +The configure options have changed because another library needs to be +installed in a different location. Instead of exec_prefix and udev_prefix, +libdir, rootlibdir and libexecdir are used. The Details are explained in +the README file. + Event processes now get re-used after they handled an event. This reduces the number of forks and the pressure on the CPU significantly, because cloned event processes no longer cause page faults in the main daemon. diff --git a/TODO b/TODO index e3631837cb..20395093c7 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,3 @@ - o cleanup old extras which link libudev source directly - - o fix configure options and libdir-name, exec-prefix, udev-prefix, libdir, ... o enumerate: sort control* after pcm* o add tests for kernel provided DEVNAME logic o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) diff --git a/autogen.sh b/autogen.sh index 5c5903e0eb..d35e9459ec 100755 --- a/autogen.sh +++ b/autogen.sh @@ -18,10 +18,18 @@ case "$CFLAGS" in ;; esac -libdirname=$(basename $(cd /lib/$(gcc -print-multi-os-directory); pwd)) -args="--prefix=/usr --exec-prefix= --sysconfdir=/etc \ ---libdir=/usr/$libdirname --with-libdir-name=$libdirname \ ---with-selinux --enable-gtk-doc" +libdir() { + echo $(cd $1/$(gcc -print-multi-os-directory); pwd) +} + +args="--prefix=/usr \ +--sysconfdir=/etc \ +--sbindir=/sbin \ +--libdir=$(libdir /usr/lib) \ +--with-rootlibdir=$(libdir /lib) \ +--libexecdir=/lib/udev \ +--with-selinux \ +--enable-gtk-doc" export CFLAGS="$CFLAGS $MYCFLAGS" ./configure $args $@ diff --git a/configure.ac b/configure.ac index bba82ee7bd..c73872e1ac 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,4 @@ -AC_INIT([udev], - [143], - [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [143], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) AC_DISABLE_STATIC @@ -10,28 +8,17 @@ AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) AC_PROG_LIBTOOL GTK_DOC_CHECK(1.10) - -dnl /* prefix is /usr, exec_prefix is /, if overridden exec_prefix follows prefix */ AC_PREFIX_DEFAULT([/usr]) -test "$prefix" = NONE && test "$exec_prefix" = NONE && exec_prefix= - AC_PATH_PROG([XSLTPROC], [xsltproc]) -AC_ARG_WITH(udev-prefix, - AS_HELP_STRING([--with-udev-prefix=DIR], [add prefix to internal udev path names]), - [], [with_udev_prefix='${exec_prefix}']) -udev_prefix=$with_udev_prefix -AC_SUBST(udev_prefix) +AC_ARG_WITH([rootlibdir], + AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), + [], [with_rootlibdir=$libdir]) +AC_SUBST([rootlibdir], [$with_rootlibdir]) -AC_ARG_WITH(libdir-name, - AS_HELP_STRING([--with-libdir-name=DIR], [name of the arch lib directory]), - [], [with_libdir_name=lib]) -libdir_name=$with_libdir_name -AC_SUBST(libdir_name) - -AC_ARG_WITH(selinux, +AC_ARG_WITH([selinux], AS_HELP_STRING([--with-selinux], [enable SELinux support]), - [], with_selinux=no) + [], [with_selinux=no]) if test "x$with_selinux" = xyes; then LIBS_save=$LIBS AC_CHECK_LIB(selinux, getprevcon, @@ -44,14 +31,14 @@ fi AC_SUBST([SELINUX_LIBS]) AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = xyes]) -AC_ARG_ENABLE(debug, +AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [enable debug messages]), - [], enable_debug=no) + [], [enable_debug=no]) if test "x$enable_debug" = "xyes"; then AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) fi -AC_ARG_ENABLE(logging, +AC_ARG_ENABLE([logging], AS_HELP_STRING([--disable-logging], [disable system logging]), [], enable_logging=yes) if test "x$enable_logging" = "xyes"; then @@ -142,10 +129,12 @@ AC_MSG_RESULT([ ======== prefix: ${prefix} - exec_prefix: ${exec_prefix} - udev_prefix: ${udev_prefix} + sysconfdir: ${sysconfdir} + sbindir: ${sbindir} libdir: ${libdir} - libdir_name: ${libdir_name} + rootlibdir: ${rootlibdir} + libexecdir: ${libexecdir} + datarootdir: ${datarootdir} mandir: ${mandir} includedir: ${includedir} diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index 0c37d8029a..18bf20d7f7 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = \ +libexec_PROGRAMS = \ ata_id ata_id_SOURCES = \ diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index bfdfdd3735..99c96b24e8 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -1,10 +1,8 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = \ +libexec_PROGRAMS = \ cdrom_id -udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ 60-cdrom_id.rules diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am index 7ad2937f5d..878b8ec133 100644 --- a/extras/collect/Makefile.am +++ b/extras/collect/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = \ +libexec_PROGRAMS = \ collect collect_SOURCES = \ diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 3284c3df40..1ec833ac9f 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -34,7 +34,7 @@ #include "libudev.h" #include "libudev-private.h" -#define TMPFILE UDEV_PREFIX "/dev/.udev/collect" +#define TMPFILE "/dev/.udev/collect" #define BUFSIZE 16 #define UDEV_ALARM_TIMEOUT 180 diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 7c562d3c31..8c5fafefea 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -1,10 +1,8 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = \ +libexec_PROGRAMS = \ edd_id -udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ 61-persistent-storage-edd.rules diff --git a/extras/firmware/Makefile.am b/extras/firmware/Makefile.am index 42f58768c9..b398beea76 100644 --- a/extras/firmware/Makefile.am +++ b/extras/firmware/Makefile.am @@ -1,9 +1,7 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -dist_udevhome_SCRIPTS = \ +dist_libexec_SCRIPTS = \ firmware.sh -udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ 50-firmware.rules diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 6854d62d57..c842324e48 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = \ +libexec_PROGRAMS = \ create_floppy_devices create_floppy_devices_SOURCES = \ diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index 42acfd15cf..59e208caba 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -1,10 +1,8 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = \ +libexec_PROGRAMS = \ fstab_import -udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ 79-fstab_import.rules diff --git a/extras/gudev/Makefile.am b/extras/gudev/Makefile.am index 71565e2a48..dcfc2bdcf3 100644 --- a/extras/gudev/Makefile.am +++ b/extras/gudev/Makefile.am @@ -113,3 +113,6 @@ EXTRA_DIST += GUdev-1.0.gir CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # ENABLE_INTROSPECTION + +install-data-hook: + rm -f $(DESTDIR)$(libdir)/libgudev-1.0.la diff --git a/extras/hid2hci/Makefile.am b/extras/hid2hci/Makefile.am index 45fb840337..62ba58d3fa 100644 --- a/extras/hid2hci/Makefile.am +++ b/extras/hid2hci/Makefile.am @@ -1,10 +1,13 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = hid2hci +libexec_PROGRAMS = \ + hid2hci -udevrulesdir = $(udev_prefix)/lib/udev/rules.d -dist_udevrules_DATA = 70-hid2hci.rules +dist_udevrules_DATA = \ + 70-hid2hci.rules -hid2hci_SOURCES = hid2hci.c -hid2hci_LDADD = @LIBUSB_LIBS@ +hid2hci_SOURCES = \ + hid2hci.c + +hid2hci_LDADD = \ + @LIBUSB_LIBS@ diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am index 867ad5ef8e..c501fc9340 100644 --- a/extras/path_id/Makefile.am +++ b/extras/path_id/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = \ +libexec_PROGRAMS = \ path_id path_id_SOURCES = \ diff --git a/extras/rule_generator/Makefile.am b/extras/rule_generator/Makefile.am index e8a8f17ee0..4f4e85ac87 100644 --- a/extras/rule_generator/Makefile.am +++ b/extras/rule_generator/Makefile.am @@ -1,14 +1,13 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -dist_udevhome_SCRIPTS = \ +dist_libexec_SCRIPTS = \ write_cd_rules \ write_net_rules +udevhomedir = $(libexecdir) dist_udevhome_DATA = \ rule_generator.functions -udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ 75-cd-aliases-generator.rules \ 75-persistent-net-generator.rules diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index ffebc38e20..2ae49e3c54 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = \ +libexec_PROGRAMS = \ scsi_id scsi_id_SOURCES = \ diff --git a/extras/udev-acl/Makefile.am b/extras/udev-acl/Makefile.am index f1a5fbd6c1..7586bb01c1 100644 --- a/extras/udev-acl/Makefile.am +++ b/extras/udev-acl/Makefile.am @@ -1,15 +1,19 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = udev-acl +libexec_PROGRAMS = \ + udev-acl -udev_acl_SOURCES = udev-acl.c -udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) -udev_acl_LDADD = -lacl $(top_builddir)/libudev/libudev.la $(GLIB_LIBS) +udev_acl_SOURCES = \ + udev-acl.c + +udev_acl_CPPFLAGS = \ + $(AM_CPPFLAGS) $(GLIB_CFLAGS) + +udev_acl_LDADD = \ + -lacl $(top_builddir)/libudev/libudev.la $(GLIB_LIBS) -udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = 70-acl.rules install-exec-hook: mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d - ln -sf $(udevhomedir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck + ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck diff --git a/extras/usb-db/Makefile.am b/extras/usb-db/Makefile.am index 58fd2c9370..2ac61f6aa1 100644 --- a/extras/usb-db/Makefile.am +++ b/extras/usb-db/Makefile.am @@ -1,12 +1,23 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = usb-db pci-db +libexec_PROGRAMS = \ + usb-db pci-db -usb_db_SOURCES = usb-db.c -usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB -usb_db_LDADD = $(top_builddir)/libudev/libudev.la +usb_db_SOURCES = \ + usb-db.c -pci_db_SOURCES = $(usb_db_SOURCES) -pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI -pci_db_LDADD = $(top_builddir)/libudev/libudev.la +usb_db_CPPFLAGS = \ + $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB + +usb_db_LDADD = \ + $(top_builddir)/libudev/libudev.la + + +pci_db_SOURCES = \ + $(usb_db_SOURCES) + +pci_db_CPPFLAGS = \ + $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI + +pci_db_LDADD = \ + $(top_builddir)/libudev/libudev.la diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index a9bd407031..bd76fb76c1 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -1,7 +1,6 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = \ +libexec_PROGRAMS = \ usb_id usb_id_SOURCES = \ diff --git a/extras/v4l_id/Makefile.am b/extras/v4l_id/Makefile.am index 3f8b0f75b4..9345282716 100644 --- a/extras/v4l_id/Makefile.am +++ b/extras/v4l_id/Makefile.am @@ -1,9 +1,10 @@ include $(top_srcdir)/Makefile.am.inc -udevhomedir = $(udev_prefix)/lib/udev -udevhome_PROGRAMS = v4l_id +libexec_PROGRAMS = \ + v4l_id -udevrulesdir = $(udev_prefix)/lib/udev/rules.d -dist_udevrules_DATA = 60-persistent-v4l.rules +dist_udevrules_DATA = \ + 60-persistent-v4l.rules -v4l_id_SOURCES = v4l_id.c +v4l_id_SOURCES = \ + v4l_id.c diff --git a/libudev/Makefile.am b/libudev/Makefile.am index 5d0cbf74b1..522244641e 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -12,7 +12,6 @@ test_libudev_SOURCES = \ test_libudev_LDADD = \ libudev.la -rootlibdir = $(exec_prefix)/$(libdir_name) rootlib_LTLIBRARIES = \ libudev.la @@ -36,25 +35,24 @@ libudev_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ -export-symbols $(top_srcdir)/libudev/exported_symbols -pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig -pkgconfig_DATA = libudev.pc +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = \ + libudev.pc EXTRA_DIST = \ exported_symbols -# move devel files to $(prefix)$(libdir_name) if needed +# move devel files from $(rootlibdir) to $(libdir) if needed install-data-hook: - rm $(DESTDIR)$(rootlibdir)/libudev.la - if test "$(prefix)" != "$(exec_prefix)"; then \ - mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \ - mv $(DESTDIR)$(rootlibdir)/libudev.a $(DESTDIR)$(prefix)/$(libdir_name)/; \ + rm -f $(DESTDIR)$(rootlibdir)/libudev.la + if test "$(libdir)" != "$(rootlibdir)"; then \ + mkdir -p $(DESTDIR)$(rootlibdir); \ so_img_name=$$(readlink $(DESTDIR)$(rootlibdir)/libudev.so); \ rm $(DESTDIR)$(rootlibdir)/libudev.so; \ - so_img_rel_target_prefix=$$(echo $(prefix)/$(libdir_name) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ - ln -sf $$so_img_rel_target_prefix$(exec_prefix)/$(libdir_name)/$$so_img_name \ - $(DESTDIR)$(prefix)/$(libdir_name)/libudev.so; \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ + ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so; \ fi uninstall-hook: - rm -f $(DESTDIR)$(prefix)/$(libdir_name)/libudev.a - rm -f $(DESTDIR)$(prefix)/$(libdir_name)/libudev.so* + rm -f $(DESTDIR)$(rootlibdir)/libudev.a + rm -f $(DESTDIR)$(rootlibdir)/libudev.so* diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index f22c04184b..811db9cf39 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -290,7 +290,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp, /* allow programs in /lib/udev/ to be called without the path */ if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), UDEV_PREFIX "/lib/udev/", argv[0], NULL); + util_strscpyl(program, sizeof(program), LIBEXECDIR "/", argv[0], NULL); argv[0] = program; } diff --git a/libudev/libudev.c b/libudev/libudev.c index f6fdcb2dfd..695443cf3b 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -123,7 +123,7 @@ struct udev *udev_new(void) udev->log_priority = LOG_ERR; udev_list_init(&udev->properties_list); udev->run = 1; - udev->dev_path = strdup(UDEV_PREFIX "/dev"); + udev->dev_path = strdup("/dev"); udev->sys_path = strdup("/sys"); config_file = strdup(SYSCONFDIR "/udev/udev.conf"); if (udev->dev_path == NULL || diff --git a/libudev/libudev.pc.in b/libudev/libudev.pc.in index 38fc052e34..677d53a97e 100644 --- a/libudev/libudev.pc.in +++ b/libudev/libudev.pc.in @@ -1,6 +1,6 @@ prefix=@prefix@ exec_prefix=@prefix@ -libdir=@prefix@/@libdir_name@ +libdir=@libdir@ includedir=@prefix@/include Name: libudev diff --git a/rules/Makefile.am b/rules/Makefile.am index 694c54be07..4bf5bc5f2b 100644 --- a/rules/Makefile.am +++ b/rules/Makefile.am @@ -1,6 +1,5 @@ include $(top_srcdir)/Makefile.am.inc -udevrulesdir = $(udev_prefix)/lib/udev/rules.d dist_udevrules_DATA = \ rules.d/50-udev-default.rules \ rules.d/60-persistent-storage.rules \ diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 7db890fed9..174edfd9c4 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1338,7 +1338,7 @@ static int add_rule(struct udev_rules *rules, char *line, /* allow programs in /lib/udev called without the path */ if (value[0] != '/') - util_strscpyl(file, sizeof(file), UDEV_PREFIX "/lib/udev/", value, NULL); + util_strscpyl(file, sizeof(file), LIBEXECDIR "/", value, NULL); else util_strscpy(file, sizeof(file), value); pos = strchr(file, ' '); @@ -1734,7 +1734,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) add_matching_files(udev, &sort_list, filename, ".rules"); /* read default rules */ - add_matching_files(udev, &sort_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules"); + add_matching_files(udev, &sort_list, LIBEXECDIR "/rules.d", ".rules"); /* sort all rules files by basename into list of files */ udev_list_entry_foreach_safe(sort_loop, sort_tmp, udev_list_get_entry(&sort_list)) { diff --git a/udev/udev.h b/udev/udev.h index 3e3ecfb1fe..391276f6e4 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -28,7 +28,7 @@ #define DEFAULT_FAKE_PARTITIONS_COUNT 15 #define UDEV_EVENT_TIMEOUT 180 -#define UDEV_CTRL_SOCK_PATH "@" UDEV_PREFIX "/org/kernel/udev/udevd" +#define UDEV_CTRL_SOCK_PATH "@/org/kernel/udev/udevd" struct udev_event { struct udev *udev; diff --git a/udev/udevd.c b/udev/udevd.c index 292f4374d7..b2e4a022c5 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -869,7 +869,7 @@ int main(int argc, char *argv[]) } else { char filename[UTIL_PATH_SIZE]; - inotify_add_watch(pfd[FD_INOTIFY].fd, UDEV_PREFIX "/lib/udev/rules.d", + inotify_add_watch(pfd[FD_INOTIFY].fd, LIBEXECDIR "/rules.d", IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); inotify_add_watch(pfd[FD_INOTIFY].fd, SYSCONFDIR "/udev/rules.d", IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); -- cgit v1.2.3-54-g00ecf From a8aab0e95b18c772c91104c02a283d03180ff19f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Jun 2009 02:33:49 +0200 Subject: rules: remove MMC rule, 2.6.30 has the modalias --- TODO | 1 - rules/rules.d/80-drivers.rules | 2 -- 2 files changed, 3 deletions(-) diff --git a/TODO b/TODO index 20395093c7..e5b4dfba06 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ o enumerate: sort control* after pcm* o add tests for kernel provided DEVNAME logic o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) - o remove MMC rules, they got a modalias now (2.6.30) o convert firmware.sh to C o symlink names to udevadm will no longer be resolved to old command names diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index 68420b9b19..63409cc01f 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -6,10 +6,8 @@ DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe -b $env{MO SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -b tifm_sd" SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -b tifm_ms" SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -b --all ms_block mspro_block" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -b i2o_block" SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe -b sg" SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -b ppdev" LABEL="drivers_end" - -- cgit v1.2.3-54-g00ecf From 2417dc20f5147556d0ed4f95a37b1547fb4b0f2b Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 17 Jun 2009 11:56:52 +0200 Subject: keymap: move from udev-extras --- configure.ac | 5 + extras/Makefile.am | 1 + extras/keymap/.gitignore | 6 + extras/keymap/95-keymap.rules | 79 +++++ extras/keymap/Makefile.am | 94 ++++++ extras/keymap/README.keymap.txt | 100 +++++++ extras/keymap/check-keymaps.sh | 30 ++ extras/keymap/findkeyboards | 45 +++ extras/keymap/keymap.c | 324 +++++++++++++++++++++ extras/keymap/keymaps/acer | 22 ++ extras/keymap/keymaps/acer-aspire_5920g | 4 + extras/keymap/keymaps/acer-extensa_5xxx | 1 + extras/keymap/keymaps/acer-travelmate_6292 | 1 + extras/keymap/keymaps/acer-travelmate_c300 | 5 + extras/keymap/keymaps/asus | 3 + extras/keymap/keymaps/benq-joybook_r22 | 1 + extras/keymap/keymaps/compaq-e_evo | 4 + extras/keymap/keymaps/dell | 27 ++ extras/keymap/keymaps/fujitsu-amilo_pa_2548 | 3 + .../keymap/keymaps/fujitsu-amilo_pro_edition_v3505 | 4 + extras/keymap/keymaps/fujitsu-amilo_pro_v3205 | 2 + extras/keymap/keymaps/fujitsu-amilo_si_1520 | 6 + extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 | 4 + extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 | 2 + extras/keymap/keymaps/hewlett-packard | 12 + extras/keymap/keymaps/hewlett-packard-2510p_2530p | 2 + .../keymaps/hewlett-packard-compaq_elitebook | 2 + extras/keymap/keymaps/hewlett-packard-pavilion | 3 + extras/keymap/keymaps/hewlett-packard-tablet | 6 + extras/keymap/keymaps/hewlett-packard-tx2 | 3 + extras/keymap/keymaps/inventec-symphony_6.0_7.0 | 2 + extras/keymap/keymaps/lenovo-3000 | 5 + extras/keymap/keymaps/lenovo-thinkpad_x200_tablet | 6 + extras/keymap/keymaps/lenovo-thinkpad_x6_tablet | 8 + extras/keymap/keymaps/maxdata-pro_7000 | 9 + extras/keymap/keymaps/medion-fid2060 | 2 + extras/keymap/keymaps/medionnb-a555 | 4 + extras/keymap/keymaps/micro-star | 12 + extras/keymap/keymaps/module-asus-w3j | 11 + extras/keymap/keymaps/module-ibm | 16 + extras/keymap/keymaps/module-lenovo | 16 + extras/keymap/keymaps/module-sony | 8 + extras/keymap/keymaps/module-sony-old | 2 + extras/keymap/keymaps/oqo-model2 | 5 + extras/keymap/keymaps/samsung-other | 14 + extras/keymap/keymaps/samsung-sq1us | 7 + extras/keymap/keymaps/samsung-sx20s | 4 + extras/keymap/keymaps/toshiba-satellite_a100 | 2 + extras/keymap/keymaps/toshiba-satellite_a110 | 10 + 49 files changed, 944 insertions(+) create mode 100644 extras/keymap/.gitignore create mode 100644 extras/keymap/95-keymap.rules create mode 100644 extras/keymap/Makefile.am create mode 100644 extras/keymap/README.keymap.txt create mode 100755 extras/keymap/check-keymaps.sh create mode 100755 extras/keymap/findkeyboards create mode 100644 extras/keymap/keymap.c create mode 100644 extras/keymap/keymaps/acer create mode 100644 extras/keymap/keymaps/acer-aspire_5920g create mode 100644 extras/keymap/keymaps/acer-extensa_5xxx create mode 100644 extras/keymap/keymaps/acer-travelmate_6292 create mode 100644 extras/keymap/keymaps/acer-travelmate_c300 create mode 100644 extras/keymap/keymaps/asus create mode 100644 extras/keymap/keymaps/benq-joybook_r22 create mode 100644 extras/keymap/keymaps/compaq-e_evo create mode 100644 extras/keymap/keymaps/dell create mode 100644 extras/keymap/keymaps/fujitsu-amilo_pa_2548 create mode 100644 extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 create mode 100644 extras/keymap/keymaps/fujitsu-amilo_pro_v3205 create mode 100644 extras/keymap/keymaps/fujitsu-amilo_si_1520 create mode 100644 extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 create mode 100644 extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 create mode 100644 extras/keymap/keymaps/hewlett-packard create mode 100644 extras/keymap/keymaps/hewlett-packard-2510p_2530p create mode 100644 extras/keymap/keymaps/hewlett-packard-compaq_elitebook create mode 100644 extras/keymap/keymaps/hewlett-packard-pavilion create mode 100644 extras/keymap/keymaps/hewlett-packard-tablet create mode 100644 extras/keymap/keymaps/hewlett-packard-tx2 create mode 100644 extras/keymap/keymaps/inventec-symphony_6.0_7.0 create mode 100644 extras/keymap/keymaps/lenovo-3000 create mode 100644 extras/keymap/keymaps/lenovo-thinkpad_x200_tablet create mode 100644 extras/keymap/keymaps/lenovo-thinkpad_x6_tablet create mode 100644 extras/keymap/keymaps/maxdata-pro_7000 create mode 100644 extras/keymap/keymaps/medion-fid2060 create mode 100644 extras/keymap/keymaps/medionnb-a555 create mode 100644 extras/keymap/keymaps/micro-star create mode 100644 extras/keymap/keymaps/module-asus-w3j create mode 100644 extras/keymap/keymaps/module-ibm create mode 100644 extras/keymap/keymaps/module-lenovo create mode 100644 extras/keymap/keymaps/module-sony create mode 100644 extras/keymap/keymaps/module-sony-old create mode 100644 extras/keymap/keymaps/oqo-model2 create mode 100644 extras/keymap/keymaps/samsung-other create mode 100644 extras/keymap/keymaps/samsung-sq1us create mode 100644 extras/keymap/keymaps/samsung-sx20s create mode 100644 extras/keymap/keymaps/toshiba-satellite_a100 create mode 100644 extras/keymap/keymaps/toshiba-satellite_a110 diff --git a/configure.ac b/configure.ac index c73872e1ac..ec2a148a9d 100644 --- a/configure.ac +++ b/configure.ac @@ -7,6 +7,7 @@ dnl AM_SILENT_RULES AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) AC_PROG_LIBTOOL +AC_PROG_AWK GTK_DOC_CHECK(1.10) AC_PREFIX_DEFAULT([/usr]) AC_PATH_PROG([XSLTPROC], [xsltproc]) @@ -49,6 +50,8 @@ AC_ARG_ENABLE([extras], AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]), [], [enable_extras=yes]) if test "x$enable_extras" = xyes; then + AC_PATH_PROG([GPERF], [gperf]) + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0]) AC_SUBST([GLIB_CFLAGS]) AC_SUBST([GLIB_LIBS]) @@ -121,6 +124,7 @@ AC_CONFIG_FILES([ extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml + extras/keymap/Makefile ]) AC_OUTPUT @@ -154,4 +158,5 @@ AC_MSG_RESULT([ pci.ids: ${PCI_DATABASE} xsltproc: ${XSLTPROC} + gperf: ${GPERF} ]) diff --git a/extras/Makefile.am b/extras/Makefile.am index 07bf48edf7..b327bee934 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -19,5 +19,6 @@ SUBDIRS += \ udev-acl \ usb-db \ hid2hci \ + keymap \ gudev endif diff --git a/extras/keymap/.gitignore b/extras/keymap/.gitignore new file mode 100644 index 0000000000..f2c4c8dca6 --- /dev/null +++ b/extras/keymap/.gitignore @@ -0,0 +1,6 @@ +keymap +keys-from-name.gperf +keys-from-name.h +keys-to-name.h +keys.txt + diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules new file mode 100644 index 0000000000..1a6321db1e --- /dev/null +++ b/extras/keymap/95-keymap.rules @@ -0,0 +1,79 @@ +ACTION!="add", GOTO="keyboard_end" +SUBSYSTEM!="input", GOTO="keyboard_end" +KERNEL!="event*", GOTO="keyboard_end" + +ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" +ENV{DMI_VENDOR}=="", GOTO="keyboard_end" + +# +# The following are exposed as separate input devices with low key codes, thus +# we need to check their input device product name +# + +ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" +ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-lenovo" +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" +ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" + +# Older Vaios have some different keys +ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*|*VGN-SZ2HP_B*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" + +# +# The following rules belong to standard i8042 AT keyboard with high key codes. +# + +DRIVERS=="atkbd", GOTO="keyboard_vendorcheck" +GOTO="keyboard_end" + +LABEL="keyboard_vendorcheck" + +ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" +ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N610c*|*Evo N600c*", RUN+="keymap $name compaq-e_evo" + +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x6_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X200 Tablet*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x200_tablet" + +ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keymap $name hewlett-packard-pavilion" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*", RUN+="keymap $name hewlett-packard-compaq_elitebook" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*", RUN+="keymap $name hewlett-packard-2510p_2530p" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" + +ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name acer-extensa_5xxx" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*", RUN+="keymap $name acer-travelmate_6292" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" + +ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name benq-joybook_r22" + +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro V3205*", RUN+="keymap $name fujitsu-amilo_pro_v3205" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pa 2548*", RUN+="keymap $name fujitsu-amilo_pa_2548" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V5*", RUN+="keymap $name fujitsu-esprimo_mobile_v5" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V6*", RUN+="keymap $name fujitsu-esprimo_mobile_v6" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro Edition V3505*", RUN+="keymap $name fujitsu-amilo_pro_edition_v3505" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+="keymap $name fujitsu-amilo_si_1520" + +ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" +ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" + +ENV{DMI_VENDOR}=="MICRO-STAR*", RUN+="keymap $name micro-star" + +ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" + +ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" + +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*SP55S*|*SQ45S70S*|*SX60P*|*SX30S*|*R59P/R60P/R61P*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" + +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" + +ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" + +ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" + +LABEL="keyboard_end" diff --git a/extras/keymap/Makefile.am b/extras/keymap/Makefile.am new file mode 100644 index 0000000000..55cce54ea2 --- /dev/null +++ b/extras/keymap/Makefile.am @@ -0,0 +1,94 @@ +# keymap 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; either version 2 of the License, or +# (at your option) any later version. +# +# keymap 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 keymap; if not, write to the Free Software Foundation, +# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +include $(top_srcdir)/Makefile.am.inc + +# rules and keymaps +dist_udevrules_DATA = 95-keymap.rules + +udevkeymapdir = $(libexecdir)/keymaps +udevkeymap_DATA = \ + keymaps/acer \ + keymaps/acer-aspire_5920g \ + keymaps/acer-extensa_5xxx \ + keymaps/acer-travelmate_6292 \ + keymaps/acer-travelmate_c300 \ + keymaps/asus \ + keymaps/benq-joybook_r22 \ + keymaps/compaq-e_evo \ + keymaps/dell \ + keymaps/fujitsu-amilo_pa_2548 \ + keymaps/fujitsu-amilo_pro_edition_v3505 \ + keymaps/fujitsu-amilo_pro_v3205 \ + keymaps/fujitsu-amilo_si_1520 \ + keymaps/fujitsu-esprimo_mobile_v5 \ + keymaps/fujitsu-esprimo_mobile_v6 \ + keymaps/hewlett-packard \ + keymaps/hewlett-packard-2510p_2530p \ + keymaps/hewlett-packard-compaq_elitebook \ + keymaps/hewlett-packard-pavilion \ + keymaps/hewlett-packard-tablet \ + keymaps/hewlett-packard-tx2 \ + keymaps/inventec-symphony_6.0_7.0 \ + keymaps/lenovo-3000 \ + keymaps/lenovo-thinkpad_x6_tablet \ + keymaps/lenovo-thinkpad_x200_tablet \ + keymaps/maxdata-pro_7000 \ + keymaps/medion-fid2060 \ + keymaps/medionnb-a555 \ + keymaps/micro-star \ + keymaps/module-asus-w3j \ + keymaps/module-ibm \ + keymaps/module-lenovo \ + keymaps/module-sony \ + keymaps/module-sony-old \ + keymaps/oqo-model2 \ + keymaps/samsung-other \ + keymaps/samsung-sq1us \ + keymaps/samsung-sx20s \ + keymaps/toshiba-satellite_a100 \ + keymaps/toshiba-satellite_a110 + +dist_pkgdata_SCRIPTS = findkeyboards + +# keymap program + +libexec_PROGRAMS = keymap + +keymap_SOURCES = keymap.c +nodist_keymap_SOURCES = keys-from-name.h keys-to-name.h +keymap_CPPFLAGS = $(AM_CPPFLAGS) + +dist_doc_DATA = README.keymap.txt + +EXTRA_DIST=keymaps check-keymaps.sh +BUILT_SOURCES = keys-from-name.h keys-to-name.h +CLEANFILES = keys.txt keys-from-name.gperf keys-from-name.h keys-to-name.h +TESTS = check-keymaps.sh + +# +# generation of keys-{from,to}-name.h from linux/input.h and gperf +# + +keys.txt: /usr/include/linux/input.h + $(AWK) '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ + +keys-from-name.gperf: keys.txt + $(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ + +keys-from-name.h: keys-from-name.gperf Makefile + $(GPERF) -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ + +keys-to-name.h: keys.txt Makefile + $(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt new file mode 100644 index 0000000000..988f742185 --- /dev/null +++ b/extras/keymap/README.keymap.txt @@ -0,0 +1,100 @@ += The udev keymap tool = + +== Introduction == + +This udev extension configures computer model specific key mappings. This is +particularly necessary for the non-standard extra keys found on many laptops, +such as "brightness up", "next song", "www browser", or "suspend". Often these +are accessed with the Fn key. + +Every key produces a "scan code", which is highly vendor/model specific for the +nonstandard keys. This tool maintains mappings for these scan codes to standard +"key codes", which denote the "meaning" of the key. The key codes are defined +in /usr/include/linux/input.h. + +If some of your keys on your keyboard are not working at all, or produce the +wrong effect, then a very likely cause of this is that the scan code -> key +code mapping is incorrect on your computer. + +== Structure == + +udev-keymap consists of the following parts: + + keymaps/*:: mappings of scan codes to key code names + + 95-keymap.rules:: udev rules for mapping system vendor/product names and + input module names to one of the keymaps above + + keymap:: manipulate an evdev input device: + * write a key map file into a device (used by udev rules) + * dump current scan → key code mapping + * interactively display scan and key codes of pressed keys + + findkeyboards:: display evdev input devices which belong to actual keyboards, + i. e. those suitable for the keymap program + + fdi2rules.py:: convert hal keymap FDIs into udev rules and key map files + (Please note that this is far from perfect, since the mapping between fdi and + udev rules is not straightforward, and impossible in some cases.) + +== Fixing broken keys == + +In order to make a broken key work on your system and send it back to upstream +for inclusion you need to do the following steps: + + 1. Find the keyboard device. + + Run /usr/share/udev-extras/findkeyboards. This should always give you an "AT + keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and + Acers) have multimedia/function keys on a separate input device instead of the + primary keyboard. The keyboard device should have a name like "input/event3". + In the following commands, the name will be written as "input/eventX". + + 2. Dump current mapping: + + sudo /lib/udev/keymap input/eventX > /tmp/orig-map.txt + + 3. Find broken scan codes: + + sudo /lib/udev/keymap -i input/eventX + + Press all multimedia/function keys and check if the key name that gets printed + out is plausible. If it is unknown or wrong, write down the scan code (looks + like "0x1E") and the intended functionality of this key. Look in + /usr/include/linux/input.h for an available KEY_XXXXX constant which most + closely approximates this functionality and write it down as the new key code. + + For example, you might press a key labeled "web browser" which currently + produces "unknown". Note down this: + + 0x1E www # Fn+F2 web browser + + Repeat that for all other keys. Write the resulting list into a file. Look at + /lib/udev/keymaps/ for existing key map files and make sure that you use the + same structure. + + 4. Find out your system vendor and product: + + cat /sys/class/dmi/id/sys_vendor + cat /sys/class/dmi/id/product_name + + 5. Generate a device dump with "udevadm info --export-db > /tmp/udev-db.txt". + + 6. Send the system vendor/product names, the key mapping from step 3, + /tmp/orig-map.txt from step 2, and /tmp/udev-db.txt from step 5 + to the bug tracker, so that they can be included in the next release: + + https://bugs.launchpad.net/udev-extras/+bugs + +For local testing, copy your map file to /lib/udev/keymaps/ with an appropriate +name, and add an appropriate udev rule to /lib/udev/rules.d/95-keymap.rules: + + * If you selected an "AT keyboard", add the rule to the section after + 'LABEL="keyboard_vendorcheck"'. + + * If you selected a "module", add the rule to the top section where the + "ThinkPad Extra Buttons" are. + +== Author == + +keymap is written and maintained by Martin Pitt . diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh new file mode 100755 index 0000000000..dc46f59531 --- /dev/null +++ b/extras/keymap/check-keymaps.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +# check that all key names in keymaps/* are known in +KEYLIST=./keys.txt +RULES=95-keymap.rules + +[ -e "$KEYLIST" ] || { + echo "need $KEYLIST please build first" >&2 + exit 1 +} + +missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) <(awk '{print $2}' keymaps/*|sort -u)) +[ -z "$missing" ] || { + echo "ERROR: unknown key names in keymaps/*:" >&2 + echo "$missing" >&2 + exit 1 +} + +# check that all maps referred to in $RULES exist +maps=$(sed -rn '/keymap \$name/ { s/^.*\$name ([^"]+).*$/\1/; p }' $RULES) +for m in $maps; do + [ -e keymaps/$m ] || { + echo "ERROR: unknown map name in $RULES: $m" >&2 + exit 1 + } + grep -q "keymaps/$m\>" Makefile.am || { + echo "ERROR: map file $m is not added to Makefile.am" >&2 + exit 1 + } +done diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards new file mode 100755 index 0000000000..e39084cde9 --- /dev/null +++ b/extras/keymap/findkeyboards @@ -0,0 +1,45 @@ +#!/bin/sh -e +# Find "real" keyboard devices and print their device path. +# Author: Martin Pitt +# +# Copyright (C) 2009, Canonical Ltd. +# +# 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; either version 2 of the License, or +# (at your option) any later version. +# +# 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. + + +# print a list of input devices which are keyboard-like +keyboard_devices() { + input_devs=`udevadm trigger --dry-run --verbose --subsystem-match=input --attr-match=dev` + + # standard AT keyboard + for dev in $input_devs; do + info=`udevadm info --attribute-walk --path=$dev` + + if echo "$info" | grep -q 'DRIVERS=="atkbd"'; then + echo -n 'AT keyboard: ' + udevadm info --query=name --path=$dev + fi + done + + # modules + module=`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons'` + module="$module +`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys'`" + for m in $module; do + evdev=`ls -d $m/event* 2>/dev/null` + if [ -e "$evdev/dev" ]; then + echo -n 'module: ' + udevadm info --query=name --path=$evdev + fi + done +} + +keyboard_devices diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c new file mode 100644 index 0000000000..454fc835c9 --- /dev/null +++ b/extras/keymap/keymap.c @@ -0,0 +1,324 @@ +/* + * keymap - dump keymap of an evdev device or set a new keymap from a file + * + * Based on keyfuzz by Lennart Poettering + * Adapted for udev-extras by Martin Pitt + * + * Copyright (C) 2006, Lennart Poettering + * Copyright (C) 2009, Canonical Ltd. + * + * keymap 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; either version 2 of the License, or + * (at your option) any later version. + * + * keymap 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 keymap; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const struct key* lookup_key (const char *str, unsigned int len); + +#include "keys-from-name.h" +#include "keys-to-name.h" + +#define MAX_SCANCODES 1024 + +/* If keymap file is given without a path, assume this one; must end with '/' * */ +#define DEFAULT_PATH "/lib/udev/keymaps/" + +static int evdev_open(const char *dev) +{ + int fd; + char fn[PATH_MAX]; + + if (strncmp(dev, "/dev", 4) != 0) { + snprintf(fn, sizeof(fn), "/dev/%s", dev); + dev = fn; + } + + if ((fd = open(dev, O_RDWR)) < 0) { + fprintf(stderr, "error open('%s'): %m\n", dev); + return -1; + } + return fd; +} + +static int evdev_get_keycode(int fd, int scancode, int e) +{ + int codes[2]; + + codes[0] = scancode; + if (ioctl(fd, EVIOCGKEYCODE, codes) < 0) { + if (e && errno == EINVAL) { + return -2; + } else { + fprintf(stderr, "EVIOCGKEYCODE: %m\n"); + return -1; + } + } + return codes[1]; +} + +static int evdev_set_keycode(int fd, int scancode, int keycode) +{ + int codes[2]; + + codes[0] = scancode; + codes[1] = keycode; + + if (ioctl(fd, EVIOCSKEYCODE, codes) < 0) { + fprintf(stderr, "EVIOCSKEYCODE: %m\n"); + return -1; + } + return 0; +} + +static int evdev_driver_version(int fd, char *v, size_t l) +{ + int version; + + if (ioctl(fd, EVIOCGVERSION, &version)) { + fprintf(stderr, "EVIOCGVERSION: %m\n"); + return -1; + } + + snprintf(v, l, "%i.%i.%i.", version >> 16, (version >> 8) & 0xff, version & 0xff); + return 0; +} + +static int evdev_device_name(int fd, char *n, size_t l) +{ + if (ioctl(fd, EVIOCGNAME(l), n) < 0) { + fprintf(stderr, "EVIOCGNAME: %m\n"); + return -1; + } + return 0; +} + +/* Return a lower-case string with KEY_ prefix removed */ +static const char* format_keyname(const char* key) { + static char result[101]; + const char* s; + int len; + + for (s = key+4, len = 0; *s && len < 100; ++len, ++s) + result[len] = tolower(*s); + result[len] = '\0'; + return result; +} + +static int dump_table(int fd) { + char version[256], name[256]; + int scancode, r = -1; + + if (evdev_driver_version(fd, version, sizeof(version)) < 0) + goto fail; + + if (evdev_device_name(fd, name, sizeof(name)) < 0) + goto fail; + + printf("### evdev %s, driver '%s'\n", version, name); + + r = 0; + for (scancode = 0; scancode < MAX_SCANCODES; scancode++) { + int keycode; + + if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { + if (keycode != -2) + r = -1; + break; + } + + if (keycode < KEY_MAX && key_names[keycode]) + printf("0x%03x %s\n", scancode, format_keyname(key_names[keycode])); + else + printf("0x%03x 0x%03x\n", scancode, keycode); + } +fail: + return r; +} + +static int merge_table(int fd, const char *filename) { + int r = 0; + int line = 0; + FILE* f; + + f = fopen(filename, "r"); + if (!f) { + perror(filename); + r = -1; + goto fail; + } + + while (!feof(f)) { + char s[256], *p; + int scancode, new_keycode, old_keycode; + + if (!fgets(s, sizeof(s), f)) + break; + + line++; + p = s+strspn(s, "\t "); + if (*p == '#' || *p == '\n') + continue; + + if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) { + char t[105] = "KEY_UNKNOWN"; + const struct key *k; + + if (sscanf(p, "%i %100s", &scancode, t+4) != 2) { + fprintf(stderr, "WARNING: Parse failure at line %i, ignoring.\n", line); + r = -1; + continue; + } + + if (!(k = lookup_key(t, strlen(t)))) { + fprintf(stderr, "WARNING: Unknown key '%s' at line %i, ignoring.\n", t, line); + r = -1; + continue; + } + + new_keycode = k->id; + } + + + if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0) { + r = -1; + goto fail; + } + + if (evdev_set_keycode(fd, scancode, new_keycode) < 0) { + r = -1; + goto fail; + } + + if (new_keycode != old_keycode) + fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x (prior: 0x%02x)\n", + scancode, new_keycode, old_keycode); + } +fail: + return r; +} + +static const char* default_keymap_path(const char* path) +{ + static char result[PATH_MAX]; + + if (!strchr(path, '/')) { + snprintf(result, sizeof(result), "%s%s", DEFAULT_PATH, path); + return result; + } + return path; +} + +static void print_key(struct input_event *event) +{ + static int cur_scancode = 0; + + /* save scan code for next EV_KEY event */ + if (event->type == EV_MSC && event->code == MSC_SCAN) + cur_scancode = event->value; + + /* key press */ + if (event->type == EV_KEY && event->value) + printf("scan code: 0x%02X key code: %s\n", cur_scancode, + format_keyname(key_names[event->code])); +} + +static void interactive(int fd) +{ + struct input_event ev; + int run = 1; + + /* grab input device */ + ioctl(fd, EVIOCGRAB, 1); + + puts("Press ESC to finish"); + while (run) { + switch (read(fd, &ev, sizeof(ev))) { + case -1: + perror("read"); + run = 0; + break; + case 0: + run = 0; + break; + default: + print_key(&ev); + /* stop on Escape key release */ + if (ev.type == EV_KEY && ev.code == KEY_ESC && ev.value == 0) + run = 0; + break; + } + } + + /* release input device */ + ioctl(fd, EVIOCGRAB, 0); +} + +int main(int argc, char **argv) +{ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "interactive", no_argument, NULL, 'i' }, + {} + }; + int fd = -1; + int opt_interactive = 0; + + while (1) { + int option; + + option = getopt_long(argc, argv, "hi", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + printf("Usage: keymap []\n\n"); + return 0; + + case 'i': + opt_interactive = 1; + break; + default: + return 1; + } + } + + if (argc < optind+1 || argc > optind+2) { + fprintf(stderr, "Usage: keymap []\n\n"); + return 2; + } + + if ((fd = evdev_open(argv[optind])) < 0) + return 3; + + if (argc == optind+2) + merge_table(fd, default_keymap_path(argv[optind+1])); + else { + if (opt_interactive) + interactive(fd); + else + dump_table(fd); + } + return 0; +} diff --git a/extras/keymap/keymaps/acer b/extras/keymap/keymaps/acer new file mode 100644 index 0000000000..6abe39cdb2 --- /dev/null +++ b/extras/keymap/keymaps/acer @@ -0,0 +1,22 @@ +0xA5 help # Fn+F1 +0xA6 setup # Fn+F2 Acer eSettings +0xA7 battery # Fn+F3 Power Management +0xA9 switchvideomode # Fn+F5 +0xB3 euro +0xB4 dollar +0xCE brightnessup # Fn+Right +0xD4 bluetooth # (toggle) off-to-on +0xD5 wlan # (toggle) on-to-off +0xD6 wlan # (toggle) off-to-on +0xD7 bluetooth # (toggle) on-to-off +0xD8 bluetooth # (toggle) off-to-on +0xD9 brightnessup # Fn+Right +0xEE brightnessup # Fn+Right +0xEF brightnessdown # Fn+Left +0xF1 f22 # Fn+F7 Touchpad toggle (off-to-on) +0xF2 f22 # Fn+F7 Touchpad toggle (on-to-off) +0xF3 prog2 # "P2" programmable button +0xF4 prog1 # "P1" programmable button +0xF5 presentation +0xF8 fn +0xF9 f23 # Launch NTI shadow diff --git a/extras/keymap/keymaps/acer-aspire_5920g b/extras/keymap/keymaps/acer-aspire_5920g new file mode 100644 index 0000000000..0e628bc1b3 --- /dev/null +++ b/extras/keymap/keymaps/acer-aspire_5920g @@ -0,0 +1,4 @@ +0x8A media +0xB2 www +0x92 prog2 +0xD9 bluetooth # (toggle) on-to-off diff --git a/extras/keymap/keymaps/acer-extensa_5xxx b/extras/keymap/keymaps/acer-extensa_5xxx new file mode 100644 index 0000000000..80f981b0d1 --- /dev/null +++ b/extras/keymap/keymaps/acer-extensa_5xxx @@ -0,0 +1 @@ +0xEE screenlock # Windows Lock function diff --git a/extras/keymap/keymaps/acer-travelmate_6292 b/extras/keymap/keymaps/acer-travelmate_6292 new file mode 100644 index 0000000000..e6c0845829 --- /dev/null +++ b/extras/keymap/keymaps/acer-travelmate_6292 @@ -0,0 +1 @@ +0xD9 bluetooth # (toggle) on-to-off diff --git a/extras/keymap/keymaps/acer-travelmate_c300 b/extras/keymap/keymaps/acer-travelmate_c300 new file mode 100644 index 0000000000..bfef4cf868 --- /dev/null +++ b/extras/keymap/keymaps/acer-travelmate_c300 @@ -0,0 +1,5 @@ +0x67 f24 # FIXME: rotate screen +0x68 up +0x69 down +0x6B fn +0x6C screenlock # FIXME: lock tablet device/buttons diff --git a/extras/keymap/keymaps/asus b/extras/keymap/keymaps/asus new file mode 100644 index 0000000000..2a5995f982 --- /dev/null +++ b/extras/keymap/keymaps/asus @@ -0,0 +1,3 @@ +0xED volumeup +0xEE volumedown +0xEF mute diff --git a/extras/keymap/keymaps/benq-joybook_r22 b/extras/keymap/keymaps/benq-joybook_r22 new file mode 100644 index 0000000000..d9c78bfa3e --- /dev/null +++ b/extras/keymap/keymaps/benq-joybook_r22 @@ -0,0 +1 @@ +0x6E wlan # Fn+F1 diff --git a/extras/keymap/keymaps/compaq-e_evo b/extras/keymap/keymaps/compaq-e_evo new file mode 100644 index 0000000000..5fbc573aa4 --- /dev/null +++ b/extras/keymap/keymaps/compaq-e_evo @@ -0,0 +1,4 @@ +0xA3 www # I key +0x9A search +0x9E email +0x9F homepage diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell new file mode 100644 index 0000000000..5ff44d6b38 --- /dev/null +++ b/extras/keymap/keymaps/dell @@ -0,0 +1,27 @@ +0x81 playpause # Play/Pause +0x82 stopcd # Stop +0x83 previoussong # Previous song +0x84 nextsong # Next song +0x85 brightnessdown # Fn+Down arrow Brightness Down +0x86 brightnessup # Fn+Up arrow Brightness Up +0x87 battery # Fn+F3 battery icon +0x88 wlan # Fn+F2 Turn On/Off Wireless +0x89 ejectclosecd # Fn+F10 Eject CD +0x8A suspend # Fn+F1 hibernate +0x8B switchvideomode # Fn+F8 CRT/LCD (high keycode: "displaytoggle") +0x8C f23 # Fn+Right arrow Auto Brightness +0x8F switchvideomode # Fn+F7 aspect ratio +0x90 previoussong # Front panel previous song +0x91 prog1 # Wifi Catcher (DELL Specific) +0x92 media # MediaDirect button (house icon) +0x93 f23 # FIXME Fn+Left arrow Auto Brightness +0x95 camera # Shutter button Takes a picture if optional camera available +0x97 email # Tablet email button +0x98 f21 # FIXME: Tablet screen rotatation +0x99 nextsong # Front panel next song +0x9A setup # Tablet tools button +0x9B switchvideomode # Display Toggle button +0xA2 playpause # Front panel play/pause +0xA4 stopcd # Front panel stop +0xD8 screenlock # FIXME: Tablet lock button +0xED media # MediaDirect button diff --git a/extras/keymap/keymaps/fujitsu-amilo_pa_2548 b/extras/keymap/keymaps/fujitsu-amilo_pa_2548 new file mode 100644 index 0000000000..f7b0c52444 --- /dev/null +++ b/extras/keymap/keymaps/fujitsu-amilo_pa_2548 @@ -0,0 +1,3 @@ +0xE0 volumedown +0xE1 volumeup +0xE5 prog1 diff --git a/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 b/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 new file mode 100644 index 0000000000..d2e38cbb23 --- /dev/null +++ b/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 @@ -0,0 +1,4 @@ +0xA5 help # Fn-F1 +0xA9 switchvideomode # Fn-F3 +0xD9 brightnessdown # Fn-F8 +0xE0 brightnessup # Fn-F9 diff --git a/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 b/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 new file mode 100644 index 0000000000..43e3199d59 --- /dev/null +++ b/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 @@ -0,0 +1,2 @@ +0xF4 f21 # FIXME: silent-mode decrease CPU/GPU clock +0xF7 switchvideomode # Fn+F3 diff --git a/extras/keymap/keymaps/fujitsu-amilo_si_1520 b/extras/keymap/keymaps/fujitsu-amilo_si_1520 new file mode 100644 index 0000000000..1419bd9b5e --- /dev/null +++ b/extras/keymap/keymaps/fujitsu-amilo_si_1520 @@ -0,0 +1,6 @@ +0xE1 wlan +0xF3 wlan +0xEE brightnessdown +0xE0 brightnessup +0xE2 bluetooth +0xF7 video diff --git a/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 b/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 new file mode 100644 index 0000000000..d3d056b366 --- /dev/null +++ b/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 @@ -0,0 +1,4 @@ +0xA9 switchvideomode +0xD9 brightnessdown +0xDF sleep +0xEF brightnessup diff --git a/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 b/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 new file mode 100644 index 0000000000..52c70c50cb --- /dev/null +++ b/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 @@ -0,0 +1,2 @@ +0xCE brightnessup +0xEF brightnessdown diff --git a/extras/keymap/keymaps/hewlett-packard b/extras/keymap/keymaps/hewlett-packard new file mode 100644 index 0000000000..4461fa2ce5 --- /dev/null +++ b/extras/keymap/keymaps/hewlett-packard @@ -0,0 +1,12 @@ +0x81 fn_esc +0x89 battery # FnF8 +0x8A screenlock # FnF6 +0x8B camera +0x8C media # music +0x8E dvd +0xB1 help +0xB3 f23 # FIXME: Auto brightness +0xD7 wlan +0x92 brightnessdown # FnF7 (FnF9 on 6730b) +0x97 brightnessup # FnF8 (FnF10 on 6730b) +0xEE switchvideomode # FnF4 diff --git a/extras/keymap/keymaps/hewlett-packard-2510p_2530p b/extras/keymap/keymaps/hewlett-packard-2510p_2530p new file mode 100644 index 0000000000..2bc70c2064 --- /dev/null +++ b/extras/keymap/keymaps/hewlett-packard-2510p_2530p @@ -0,0 +1,2 @@ +0xD8 f22 # touchpad off +0xD9 f23 # touchpad on diff --git a/extras/keymap/keymaps/hewlett-packard-compaq_elitebook b/extras/keymap/keymaps/hewlett-packard-compaq_elitebook new file mode 100644 index 0000000000..42007c5483 --- /dev/null +++ b/extras/keymap/keymaps/hewlett-packard-compaq_elitebook @@ -0,0 +1,2 @@ +0x88 presentation +0xD9 help # I key (high keycode: "info") diff --git a/extras/keymap/keymaps/hewlett-packard-pavilion b/extras/keymap/keymaps/hewlett-packard-pavilion new file mode 100644 index 0000000000..a55d2b7048 --- /dev/null +++ b/extras/keymap/keymaps/hewlett-packard-pavilion @@ -0,0 +1,3 @@ +0x88 media # FIXME: quick play +0xD8 f22 # touchpad off +0xD9 f23 # touchpad on diff --git a/extras/keymap/keymaps/hewlett-packard-tablet b/extras/keymap/keymaps/hewlett-packard-tablet new file mode 100644 index 0000000000..d19005ab90 --- /dev/null +++ b/extras/keymap/keymaps/hewlett-packard-tablet @@ -0,0 +1,6 @@ +0x82 prog2 # Funny Key +0x83 prog1 # Q +0x84 tab +0x85 esc +0x86 pageup +0x87 pagedown diff --git a/extras/keymap/keymaps/hewlett-packard-tx2 b/extras/keymap/keymaps/hewlett-packard-tx2 new file mode 100644 index 0000000000..206c004dd0 --- /dev/null +++ b/extras/keymap/keymaps/hewlett-packard-tx2 @@ -0,0 +1,3 @@ +0xC2 media +0xD8 f22 # Toggle touchpad button on tx2 (OFF) +0xD9 f22 # Toggle touchpad button on tx2 (ON) diff --git a/extras/keymap/keymaps/inventec-symphony_6.0_7.0 b/extras/keymap/keymaps/inventec-symphony_6.0_7.0 new file mode 100644 index 0000000000..4a8b4ba5a7 --- /dev/null +++ b/extras/keymap/keymaps/inventec-symphony_6.0_7.0 @@ -0,0 +1,2 @@ +0xF3 prog2 +0xF4 prog1 diff --git a/extras/keymap/keymaps/lenovo-3000 b/extras/keymap/keymaps/lenovo-3000 new file mode 100644 index 0000000000..5bd165654a --- /dev/null +++ b/extras/keymap/keymaps/lenovo-3000 @@ -0,0 +1,5 @@ +0x8B switchvideomode # Fn+F7 video +0x96 wlan # Fn+F5 wireless +0x97 sleep # Fn+F4 suspend +0x98 suspend # Fn+F12 hibernate +0xB4 prog1 # Lenovo Care diff --git a/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet b/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet new file mode 100644 index 0000000000..31ea3b2c70 --- /dev/null +++ b/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet @@ -0,0 +1,6 @@ +0x5D menu +0x63 fn +0x66 screenlock +0x67 cyclewindows # bezel circular arrow +0x68 setup # bezel setup / menu +0x6c direction # rotate screen diff --git a/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet b/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet new file mode 100644 index 0000000000..6fd16b5662 --- /dev/null +++ b/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet @@ -0,0 +1,8 @@ +0x6C f21 # rotate +0x68 screenlock # screenlock +0x6B esc # escape +0x6D right # right on d-pad +0x6E left # left on d-pad +0x71 up # up on d-pad +0x6F down # down on d-pad +0x69 enter # enter on d-pad diff --git a/extras/keymap/keymaps/maxdata-pro_7000 b/extras/keymap/keymaps/maxdata-pro_7000 new file mode 100644 index 0000000000..c0e4f77af4 --- /dev/null +++ b/extras/keymap/keymaps/maxdata-pro_7000 @@ -0,0 +1,9 @@ +0x97 prog2 +0x9F prog1 +0xA0 mute # Fn-F5 +0x82 www +0xEC email +0xAE volumedown # Fn-Down +0xB0 volumeup # Fn-Up +0xDF suspend # Fn+F2 +0xF5 help diff --git a/extras/keymap/keymaps/medion-fid2060 b/extras/keymap/keymaps/medion-fid2060 new file mode 100644 index 0000000000..5a76c76799 --- /dev/null +++ b/extras/keymap/keymaps/medion-fid2060 @@ -0,0 +1,2 @@ +0x6B channeldown # Thottle Down +0x6D channelup # Thottle Up diff --git a/extras/keymap/keymaps/medionnb-a555 b/extras/keymap/keymaps/medionnb-a555 new file mode 100644 index 0000000000..c3b5dfa60b --- /dev/null +++ b/extras/keymap/keymaps/medionnb-a555 @@ -0,0 +1,4 @@ +0x63 www # N button +0x66 prog1 # link 1 button +0x67 email # envelope button +0x69 prog2 # link 2 button diff --git a/extras/keymap/keymaps/micro-star b/extras/keymap/keymaps/micro-star new file mode 100644 index 0000000000..0469434030 --- /dev/null +++ b/extras/keymap/keymaps/micro-star @@ -0,0 +1,12 @@ +0xA0 mute # Fn-F9 +0xAE volumedown # Fn-F7 +0xB0 volumeup # Fn-F8 +0xB2 www # e button +0xDF sleep # Fn-F12 +0xE2 bluetooth # satellite dish2 +0xE4 f22 # Fn-F3 Touchpad disable +0xEC email # envelope button +0xF6 wlan # satellite dish1 +0xF7 brightnessdown # Fn-F4 +0xF8 brightnessup # Fn-F5 +0xF9 search diff --git a/extras/keymap/keymaps/module-asus-w3j b/extras/keymap/keymaps/module-asus-w3j new file mode 100644 index 0000000000..773e0b3e82 --- /dev/null +++ b/extras/keymap/keymaps/module-asus-w3j @@ -0,0 +1,11 @@ +0x41 nextsong +0x45 playpause +0x43 stopcd +0x40 previoussong +0x4C ejectclosecd +0x32 mute +0x31 volumedown +0x30 volumeup +0x5D wlan +0x7E bluetooth +0x8A media # high keycode: "tv" diff --git a/extras/keymap/keymaps/module-ibm b/extras/keymap/keymaps/module-ibm new file mode 100644 index 0000000000..c330f01af9 --- /dev/null +++ b/extras/keymap/keymaps/module-ibm @@ -0,0 +1,16 @@ +0x01 battery # Fn+F2 +0x02 screenlock # Fn+F3 +0x03 sleep # Fn+F4 +0x04 radio # Fn+F5 +0x06 switchvideomode # Fn+F7 +0x07 zoom # Fn+F8 screen expand +0x08 f24 # Fn+F9 undock +0x0B suspend # Fn+F12 +0x0F brightnessup # Fn+Home +0x10 brightnessdown # Fn+End +0x11 kbdillumtoggle # Fn+PgUp - ThinkLight +0x13 zoom # Fn+Space +0x14 volumeup +0x15 volumedown +0x16 mute +0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") diff --git a/extras/keymap/keymaps/module-lenovo b/extras/keymap/keymaps/module-lenovo new file mode 100644 index 0000000000..53f142b31f --- /dev/null +++ b/extras/keymap/keymaps/module-lenovo @@ -0,0 +1,16 @@ +0x1 screenlock # Fn+F2 +0x2 battery # Fn+F3 +0x3 sleep # Fn+F4 +0x4 radio # Fn+F5 +0x6 switchvideomode # Fn+F7 +0x7 f22 # Fn+F8 touchpadtoggle +0x8 f24 # Fn+F9 undock +0xB suspend # Fn+F12 +0xF brightnessup # Fn+Home +0x10 brightnessdown # Fn+End +0x11 kbdillumtoggle # Fn+PgUp - ThinkLight +0x13 zoom # Fn+Space +0x14 volumeup +0x15 volumedown +0x16 mute +0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") diff --git a/extras/keymap/keymaps/module-sony b/extras/keymap/keymaps/module-sony new file mode 100644 index 0000000000..7c000131d1 --- /dev/null +++ b/extras/keymap/keymaps/module-sony @@ -0,0 +1,8 @@ +0x06 mute # Fn+F2 +0x07 volumedown # Fn+F3 +0x08 volumeup # Fn+F4 +0x09 brightnessdown # Fn+F5 +0x0A brightnessup # Fn+F6 +0x0B switchvideomode # Fn+F7 +0x0E zoom # Fn+F10 +0x10 suspend # Fn+F12 diff --git a/extras/keymap/keymaps/module-sony-old b/extras/keymap/keymaps/module-sony-old new file mode 100644 index 0000000000..596a34258a --- /dev/null +++ b/extras/keymap/keymaps/module-sony-old @@ -0,0 +1,2 @@ +0x06 battery +0x07 mute diff --git a/extras/keymap/keymaps/oqo-model2 b/extras/keymap/keymaps/oqo-model2 new file mode 100644 index 0000000000..b7f4851abe --- /dev/null +++ b/extras/keymap/keymaps/oqo-model2 @@ -0,0 +1,5 @@ +0x8E wlan +0xF0 switchvideomode +0xF1 mute +0xF2 volumedown +0xF3 volumeup diff --git a/extras/keymap/keymaps/samsung-other b/extras/keymap/keymaps/samsung-other new file mode 100644 index 0000000000..6a0928c4b3 --- /dev/null +++ b/extras/keymap/keymaps/samsung-other @@ -0,0 +1,14 @@ +0x74 prog1 # User key +0x75 www +0x78 mail +0x82 switchvideomode # Fn+F4 CRT/LCD (high keycode: "displaytoggle") +0x83 battery # Fn+F2 +0x84 prog1 # Fn+F5 backlight on/off +0x86 wlan # Fn+F9 +0x88 brightnessup # Fn-Up +0x89 brightnessdown # Fn-Down +0xB1 prog2 # Fn+F7 run Samsung Magic Doctor (keypressed event is generated twice) +0xB3 prog3 # Fn+F8 switch power mode (battery/dynamic/performance) +0xB4 wlan # Fn+F9 (X60P) +0xF7 f22 # Fn+F10 Touchpad on +0xF9 f22 # Fn+F10 Touchpad off diff --git a/extras/keymap/keymaps/samsung-sq1us b/extras/keymap/keymaps/samsung-sq1us new file mode 100644 index 0000000000..3e05199785 --- /dev/null +++ b/extras/keymap/keymaps/samsung-sq1us @@ -0,0 +1,7 @@ +0xD4 menu +0xD8 f1 +0xD9 f10 +0xD6 f3 +0xD7 f9 +0xE4 f5 +0xEE f11 diff --git a/extras/keymap/keymaps/samsung-sx20s b/extras/keymap/keymaps/samsung-sx20s new file mode 100644 index 0000000000..daf7d3ea54 --- /dev/null +++ b/extras/keymap/keymaps/samsung-sx20s @@ -0,0 +1,4 @@ +0x74 mute +0x75 mute +0x77 f21 # FIXME: Touchpad on +0x79 f21 # FIXME: Touchpad off diff --git a/extras/keymap/keymaps/toshiba-satellite_a100 b/extras/keymap/keymaps/toshiba-satellite_a100 new file mode 100644 index 0000000000..22007be71b --- /dev/null +++ b/extras/keymap/keymaps/toshiba-satellite_a100 @@ -0,0 +1,2 @@ +0xA4 stopcd +0xB2 www diff --git a/extras/keymap/keymaps/toshiba-satellite_a110 b/extras/keymap/keymaps/toshiba-satellite_a110 new file mode 100644 index 0000000000..0f2aaec420 --- /dev/null +++ b/extras/keymap/keymaps/toshiba-satellite_a110 @@ -0,0 +1,10 @@ +0x92 stop +0x93 www +0x94 media +0x9E f21 # FIXME: Touchpad on +0x9F f21 # FIXME: Touchpad off +0xB9 nextsong +0xD9 brightnessup +0xEE screenlock +0xF4 previoussong +0xF7 playpause -- cgit v1.2.3-54-g00ecf From 0fb7c5184678821060843824a26514946a3b9302 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 17 Jun 2009 12:06:33 +0200 Subject: extras/keymap: Fix WLAN button on ThinkPads Fn+F5 was previously assigned to "radio" which is fairly useless under X. Switch it to "wlan". Reported in http://bugs.debian.org/504643 --- extras/keymap/keymaps/module-ibm | 2 +- extras/keymap/keymaps/module-lenovo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/keymap/keymaps/module-ibm b/extras/keymap/keymaps/module-ibm index c330f01af9..a92dfa2506 100644 --- a/extras/keymap/keymaps/module-ibm +++ b/extras/keymap/keymaps/module-ibm @@ -1,7 +1,7 @@ 0x01 battery # Fn+F2 0x02 screenlock # Fn+F3 0x03 sleep # Fn+F4 -0x04 radio # Fn+F5 +0x04 wlan # Fn+F5 0x06 switchvideomode # Fn+F7 0x07 zoom # Fn+F8 screen expand 0x08 f24 # Fn+F9 undock diff --git a/extras/keymap/keymaps/module-lenovo b/extras/keymap/keymaps/module-lenovo index 53f142b31f..7c597bd851 100644 --- a/extras/keymap/keymaps/module-lenovo +++ b/extras/keymap/keymaps/module-lenovo @@ -1,7 +1,7 @@ 0x1 screenlock # Fn+F2 0x2 battery # Fn+F3 0x3 sleep # Fn+F4 -0x4 radio # Fn+F5 +0x4 wlan # Fn+F5 0x6 switchvideomode # Fn+F7 0x7 f22 # Fn+F8 touchpadtoggle 0x8 f24 # Fn+F9 undock -- cgit v1.2.3-54-g00ecf From 181368a3b26329f77a93b06a5d2b285d4bf5f8e3 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Wed, 17 Jun 2009 12:16:54 +0200 Subject: extras/modem-modeswitch: move from udev-extras --- configure.ac | 1 + extras/Makefile.am | 1 + extras/modem-modeswitch/.gitignore | 1 + extras/modem-modeswitch/61-mobile-action.rules | 9 + .../61-option-modem-modeswitch.rules | 38 ++ extras/modem-modeswitch/Makefile.am | 26 ++ extras/modem-modeswitch/ma8280p_us.c | 454 +++++++++++++++++++++ extras/modem-modeswitch/ma8280p_us.h | 24 ++ extras/modem-modeswitch/modem-modeswitch.8 | 39 ++ extras/modem-modeswitch/modem-modeswitch.c | 266 ++++++++++++ extras/modem-modeswitch/option.c | 131 ++++++ extras/modem-modeswitch/option.h | 29 ++ extras/modem-modeswitch/utils.c | 83 ++++ extras/modem-modeswitch/utils.h | 32 ++ 14 files changed, 1134 insertions(+) create mode 100644 extras/modem-modeswitch/.gitignore create mode 100644 extras/modem-modeswitch/61-mobile-action.rules create mode 100644 extras/modem-modeswitch/61-option-modem-modeswitch.rules create mode 100644 extras/modem-modeswitch/Makefile.am create mode 100644 extras/modem-modeswitch/ma8280p_us.c create mode 100644 extras/modem-modeswitch/ma8280p_us.h create mode 100644 extras/modem-modeswitch/modem-modeswitch.8 create mode 100644 extras/modem-modeswitch/modem-modeswitch.c create mode 100644 extras/modem-modeswitch/option.c create mode 100644 extras/modem-modeswitch/option.h create mode 100644 extras/modem-modeswitch/utils.c create mode 100644 extras/modem-modeswitch/utils.h diff --git a/configure.ac b/configure.ac index ec2a148a9d..e81d999d9e 100644 --- a/configure.ac +++ b/configure.ac @@ -125,6 +125,7 @@ AC_CONFIG_FILES([ extras/gudev/docs/Makefile extras/gudev/docs/version.xml extras/keymap/Makefile + extras/modem-modeswitch/Makefile ]) AC_OUTPUT diff --git a/extras/Makefile.am b/extras/Makefile.am index b327bee934..b7c9fe860d 100644 --- a/extras/Makefile.am +++ b/extras/Makefile.am @@ -20,5 +20,6 @@ SUBDIRS += \ usb-db \ hid2hci \ keymap \ + modem-modeswitch \ gudev endif diff --git a/extras/modem-modeswitch/.gitignore b/extras/modem-modeswitch/.gitignore new file mode 100644 index 0000000000..0c1ff9f86c --- /dev/null +++ b/extras/modem-modeswitch/.gitignore @@ -0,0 +1 @@ +modem-modeswitch diff --git a/extras/modem-modeswitch/61-mobile-action.rules b/extras/modem-modeswitch/61-mobile-action.rules new file mode 100644 index 0000000000..bb99b43597 --- /dev/null +++ b/extras/modem-modeswitch/61-mobile-action.rules @@ -0,0 +1,9 @@ +ACTION!="add", GOTO="mobile_action_end" + +SUBSYSTEM=="usb", ATTR{bDeviceClass}=="ff", ATTR{bDeviceSubClass}=="ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" +GOTO="mobile_action_end" + +LABEL="mobile_action_switch" +ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" + +LABEL="mobile_action_end" diff --git a/extras/modem-modeswitch/61-option-modem-modeswitch.rules b/extras/modem-modeswitch/61-option-modem-modeswitch.rules new file mode 100644 index 0000000000..19dc5b4965 --- /dev/null +++ b/extras/modem-modeswitch/61-option-modem-modeswitch.rules @@ -0,0 +1,38 @@ +ACTION!="add", GOTO="option_zerocd_end" + +SUBSYSTEM=="usb", ATTR{bDeviceClass}!="ff", ENV{DEVTYPE}=="usb_device", GOTO="option_zerocd_disable" +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", GOTO="option_zerocd_disable" +GOTO="option_zerocd_end" + +LABEL="option_zerocd_disable" +ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="1000", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6711", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6711", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6731", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6751", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6771", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6791", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6811", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6911", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6951", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6971", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7011", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7051", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7071", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7111", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7211", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7251", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7271", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7311", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="c031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="d031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="d033", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7301", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7361", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7401", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7501", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7601", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7901", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" + +LABEL="option_zerocd_end" diff --git a/extras/modem-modeswitch/Makefile.am b/extras/modem-modeswitch/Makefile.am new file mode 100644 index 0000000000..94d58d065f --- /dev/null +++ b/extras/modem-modeswitch/Makefile.am @@ -0,0 +1,26 @@ +include $(top_srcdir)/Makefile.am.inc + +libexec_PROGRAMS = \ + modem-modeswitch + +modem_modeswitch_SOURCES = \ + modem-modeswitch.c \ + utils.c \ + utils.h \ + ma8280p_us.c \ + ma8280p_us.h \ + option.c \ + option.h + +modem_modeswitch_CPPFLAGS = \ + $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) + +modem_modeswitch_LDADD = \ + $(LIBUSB_LIBS) + +dist_udevrules_DATA = \ + 61-option-modem-modeswitch.rules \ + 61-mobile-action.rules + +dist_man_MANS = \ + modem-modeswitch.8 diff --git a/extras/modem-modeswitch/ma8280p_us.c b/extras/modem-modeswitch/ma8280p_us.c new file mode 100644 index 0000000000..13d11160e1 --- /dev/null +++ b/extras/modem-modeswitch/ma8280p_us.c @@ -0,0 +1,454 @@ +/* http://www.natox.be/ma8280p/ + * http://www.leopold.dk/~martin/ma-8230p.html + * http://figvam.blogspot.com/2007/01/mobile-action-8730p-usb-cable-and-linux.html + */ + +/* + * + * Code by davy hollevoet. This is simply an adaptation of code + * generated by usbsnoop2libusb. (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) + * + * This code is released under both the GPL version 2 and BSD licenses. + * Either license may be used. + * + * GPLv2 + * ******** + * 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; either version 2 + * of the License, or (at your option) any later version. + * + * 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. + * + * In addition: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * BSD + * ****** + * Copyright (c) 1998, Regents of the University of California + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* This file is (mostly) generated with usbsnoop2libusb.pl from a usbsnoop log file. */ +/* Latest version of the script should be in http://iki.fi/lindi/usb/usbsnoop2libusb.pl */ +#include +#include +#include +#include +#include +#include +#include + +#include "utils.h" +#include "ma8280p_us.h" + +int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) +{ + int ret = 1; + char *buf = NULL; + + buf = malloc (65535); + if (!buf) { + error ("%s: not enough memory", dev->filename, ret); + return -1; + } + + ret = usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); + usleep(6*1000); + ret = usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); + usleep(6*1000); + ret = usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); + usleep(10*1000); + ret = usb_release_interface(devh, 0); + if (ret != 0) + debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); + ret = usb_set_configuration(devh, 0x0000001); + ret = usb_claim_interface(devh, 0); + if (ret != 0) + debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); + //ret = usb_set_altinterface(devh, 0); + //usleep(33*1000); + ret = usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); + usleep(5*1000); + memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); + ret = usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); + usleep(4*1000); + memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); + ret = usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); + usleep(4*1000); + + usleep(4*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(6*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(1*1000); + //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped + usleep(4*1000); + memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); + ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usleep(3*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(1*1000); + memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); + ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usleep(7*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(1*1000); + memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); + ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usleep(7*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(2*1000); + //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped + usleep(4*1000); + memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); + ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usleep(2*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(1*1000); + memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); + ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usleep(7*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(1*1000); + memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); + ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usleep(7*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(8*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(1*1000); + //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped + usleep(4*1000); + memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); + ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usleep(3*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usleep(1*1000); + //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped + usleep(4*1000); + memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); + ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usleep(3*1000); + ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + + if (buf) + free (buf); + return 0; +} diff --git a/extras/modem-modeswitch/ma8280p_us.h b/extras/modem-modeswitch/ma8280p_us.h new file mode 100644 index 0000000000..bf0e304401 --- /dev/null +++ b/extras/modem-modeswitch/ma8280p_us.h @@ -0,0 +1,24 @@ +/* + * Modem mode switcher + * + * Copyright (C) 2009 Dan Williams + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#ifndef __MA8280P_H__ +#define __MA8280P_H__ + +#include + +int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev); + +#endif /* __MA8280P_H__ */ diff --git a/extras/modem-modeswitch/modem-modeswitch.8 b/extras/modem-modeswitch/modem-modeswitch.8 new file mode 100644 index 0000000000..80fab0d548 --- /dev/null +++ b/extras/modem-modeswitch/modem-modeswitch.8 @@ -0,0 +1,39 @@ +.TH MODEM_MODESWITCH 8 "November 2005" "" "Linux Administrator's Manual" +.SH NAME +modem-modeswitch \- udev callout to switch mobile broadband devices to their +intended modem mode +.SH SYNOPSIS +.BI modem-modeswitch +\fI--vendor \fP \fI--product \fP [\fI--debug\fP] +\fI--type \fP \fI\fP +.SH "DESCRIPTION" +.B modem-modeswitch +is normally called from a udev rule, to eject the driver CD that many mobile +broadband devices mount by default, and switch them into modem mode. +.SH USAGE +.B modem-modeswitch +switches the device into modem mode +.SH OPTIONS +The following commandline switches are supported: +.TP +.BI \-\-vendor\ +the USB vendor ID of the mobile broadband device to switch +.TP +.BI \-\-product\ +the USB product ID of the mobile broadband device to switch +.TP +.BI \-\-type\ +the type of switch to perform (one of: option-zerocd, mobile-action-8280p) +.TP +.BI \-\-log\ +log verbose debugging information about the switching process +.TP +.BI \-\-debug +print verbose debugging information about the switching process +.RE +.SH SEE ALSO +.BR udev (7) +.SH AUTHORS +Developed by Dan Williams based off code by Peter Henn +. + diff --git a/extras/modem-modeswitch/modem-modeswitch.c b/extras/modem-modeswitch/modem-modeswitch.c new file mode 100644 index 0000000000..a60ce7a41c --- /dev/null +++ b/extras/modem-modeswitch/modem-modeswitch.c @@ -0,0 +1,266 @@ +/* + * Modem mode switcher + * + * Copyright (C) 2008 Dan Williams + * Copyright (C) 2008 Peter Henn + * + * Heavily based on the 'ozerocdoff' tool by Peter Henn. + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "utils.h" + +#include "ma8280p_us.h" +#include "option.h" + +struct usb_dev_handle *handle = NULL; + +typedef struct usb_device * (*FindFunc) (int vid, int pid); +typedef int (*SwitchFunc) (struct usb_dev_handle *dh, struct usb_device *dev); + +typedef enum { + ST_UNKNOWN = 0, + ST_OPTION_ZEROCD, + ST_MA8280P +} SwitchType; + +typedef struct SwitchEntry { + SwitchType st; + const char *clopt; + FindFunc find_func; + SwitchFunc switch_func; +} SwitchEntry; + +static SwitchEntry switch_types[] = { + { ST_OPTION_ZEROCD, "option-zerocd", option_zerocd_find, option_zerocd_switch }, + { ST_MA8280P, "mobile-action-8280p", NULL, ma8280p_switch }, + { ST_UNKNOWN, NULL, NULL } +}; + +static struct usb_device * +generic_find (int vid, int pid) +{ + struct usb_bus *bus; + struct usb_device *dev; + + for (bus = usb_get_busses(); bus; bus = bus->next) { + for (dev = bus->devices; dev; dev = dev->next) { + if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { + debug ("Found device '%s'", dev->filename); + return dev; + } + } + } + return NULL; +} + +static void +release_usb_device (int param) +{ + usb_release_interface (handle, 0); + usb_close (handle); +} + +static void +print_usage (void) +{ + printf ("Usage: modem-modeswitch [-hdq] [-l ] -v -p -t \n" + " -h, --help show this help message\n" + " -v, --vendor target USB vendor ID\n" + " -p, --product target USB product ID\n" + " -t, --type type of switch to attempt, varies by device:\n" + " option-zerocd - For many newer Option N.V. devices\n" + " mobile-action-8280p - For Mobile Action 8xxxP USB cables\n" + " -l, --log log output to a file\n" + " -q, --quiet don't print anything to stdout\n" + " -d, --debug display debugging messages\n\n" + "Examples:\n" + " modem-modeswitch -v 0x0af0 -p 0xc031 -t option-zerocd\n"); +} + +static SwitchEntry * +parse_type (const char *s) +{ + SwitchEntry *entry = &switch_types[0]; + + while (entry->clopt) { + if (!strcmp (entry->clopt, s)) + return entry; + entry++; + } + + return NULL; +} + +static void +do_exit (int val) +{ + log_shutdown (); + exit (val); +} + +int main(int argc, char **argv) +{ + static struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "vendor", required_argument, NULL, 'v' }, + { "product", required_argument, NULL, 'p' }, + { "type", required_argument, NULL, 't' }, + { "log", required_argument, NULL, 'l' }, + { "debug", no_argument, NULL, 'd' }, + { "quiet", no_argument, NULL, 'q' }, + { NULL, 0, NULL, 0} + }; + + struct usb_device *dev; + int vid = 0, pid = 0; + const char *logpath = NULL; + char buffer[256]; + int ret, quiet = 0, debug = 0; + SwitchEntry *sentry = NULL; + + while (1) { + int option; + + option = getopt_long(argc, argv, "hv:p:l:t:dq", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'v': + vid = strtol (optarg, NULL, 0); + break; + case 'p': + pid = strtol (optarg, NULL, 0); + break; + case 't': + sentry = parse_type (optarg); + if (!sentry) { + error ("unknown switch type '%s'", optarg); + print_usage (); + exit (1); + } + break; + case 'l': + logpath = optarg; + break; + case 'q': + quiet = 1; + break; + case 'd': + debug = 1; + break; + case 'h': + default: + print_usage (); + exit (1); + } + } + + if (log_startup (logpath, debug, quiet)) { + fprintf (stderr, "Couldn't open/create logfile %s", logpath); + exit (2); + } + + if (!sentry) { + if (!quiet) + print_usage (); + else + error ("missing device switch type."); + do_exit (3); + } + + if (!vid || !pid) { + if (!quiet) + print_usage (); + else + error ("missing vendor and device IDs."); + do_exit (3); + } + + usb_init(); + + if (usb_find_busses() < 0) { + error ("no USB busses found."); + do_exit (4); + } + + if (usb_find_devices() < 0) { + error ("no USB devices found."); + do_exit (4); + } + + if (sentry->find_func) + dev = (*sentry->find_func) (vid, pid); + else + dev = generic_find (vid, pid); + if (dev == NULL) { + error ("no device found."); + do_exit (5); + } + + handle = usb_open (dev); + if (handle == NULL) { + error ("%s: could not access the device.", + dev->filename); + do_exit (6); + } + + /* detach running default driver */ + signal (SIGTERM, release_usb_device); + ret = usb_get_driver_np (handle, 0, buffer, sizeof (buffer)); + if (ret == 0) { + debug ("%s: found already attached driver '%s'", dev->filename, buffer); + + ret = usb_detach_kernel_driver_np (handle, 0); + if (ret != 0) { + debug ("%s: error: unable to detach current driver.", dev->filename); + usb_close (handle); + do_exit (7); + } + } + + ret = usb_claim_interface (handle, 0); + if (ret != 0) { + debug ("%s: couldn't claim device's USB interface: %d.", + dev->filename, ret); + usb_close (handle); + do_exit (8); + } + + ret = (*sentry->switch_func) (handle, dev); + if (ret < 0) { + debug ("%s: failed to switch device to modem mode.", dev->filename); + usb_release_interface (handle, 0); + usb_close (handle); + do_exit(9); + } + + usb_release_interface (handle, 0); + + ret = usb_close (handle); + if (ret < 0) + debug ("%s: failed to close the device.", dev->filename); + + do_exit (0); + return 0; +} diff --git a/extras/modem-modeswitch/option.c b/extras/modem-modeswitch/option.c new file mode 100644 index 0000000000..5b299fd1bf --- /dev/null +++ b/extras/modem-modeswitch/option.c @@ -0,0 +1,131 @@ +/* + * Modem mode switcher + * + * Copyright (C) 2008 Dan Williams + * Copyright (C) 2008 Peter Henn + * + * Heavily based on the 'ozerocdoff' tool by Peter Henn. + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#include + +#include "utils.h" +#include "option.h" + +/* Borrowed from /usr/include/linux/usb/ch9.h */ +#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ +#define USB_ENDPOINT_XFER_BULK 2 +#define USB_ENDPOINT_DIR_MASK 0x80 +#define USB_DIR_OUT 0 /* to device */ +#define USB_DIR_IN 0x80 /* to host */ + +struct usb_device * +option_zerocd_find (int vid, int pid) +{ + struct usb_bus *bus; + struct usb_device *dev; + + for (bus = usb_get_busses(); bus; bus = bus->next) { + for (dev = bus->devices; dev; dev = dev->next) { + if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { + debug ("Found mass storage device:"); + debug (" Endpoints: %d", dev->config[0].interface[0].altsetting[0].bNumEndpoints); + debug (" Class: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceClass); + debug (" SubClass: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceSubClass); + debug (" Protocol: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceProtocol); + + if ( (dev->config[0].interface[0].altsetting[0].bNumEndpoints == 2) + && (dev->config[0].interface[0].altsetting[0].bInterfaceClass == 0x08) + && (dev->config[0].interface[0].altsetting[0].bInterfaceSubClass == 0x06) + && (dev->config[0].interface[0].altsetting[0].bInterfaceProtocol == 0x50) ) { + debug ("Found modem mass storage device '%s'", dev->filename); + return dev; + } + } + } + } + return NULL; +} + +static int +find_endpoints (struct usb_device *dev, int *in_ep, int *out_ep) +{ + int i; + + for (i = 0; i < dev->config[0].interface[0].altsetting[0].bNumEndpoints; i++) { + struct usb_endpoint_descriptor *ep = &(dev->config[0].interface[0].altsetting[0].endpoint[i]); + + if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) { + unsigned int direction = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK; + + if (!*out_ep && (direction == USB_DIR_OUT)) + *out_ep = ep->bEndpointAddress; + else if (!*in_ep && (direction == USB_DIR_IN)) + *in_ep = ep->bEndpointAddress; + } + + if (*in_ep && *out_ep) + return 0; + } + + return -1; +} + +int +option_zerocd_switch (struct usb_dev_handle *dh, struct usb_device *dev) +{ + const char const rezero_cbw[] = { + 0x55, 0x53, 0x42, 0x43, /* bulk command signature (LE) */ + 0x78, 0x56, 0x34, 0x12, /* bulk command host tag */ + 0x01, 0x00, 0x00, 0x00, /* bulk command data transfer length (LE) */ + 0x80, /* flags: direction data-in */ + 0x00, /* LUN */ + 0x06, /* SCSI command length */ + 0x01, /* SCSI command: REZERO */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* filler */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + }; + + int ret = -1, ep_in = 0, ep_out = 0; + char buffer[256]; + + /* Find the device's bulk in and out endpoints */ + if (find_endpoints (dev, &ep_in, &ep_out) < 0) { + debug ("%s: couldn't find correct USB endpoints.", dev->filename); + goto out; + } + + usb_clear_halt (dh, ep_out); + ret = usb_set_altinterface (dh, 0); + if (ret != 0) { + debug ("%s: couldn't set device alternate interface.", dev->filename); + goto out; + } + + /* Let the mass storage device settle */ + sleep (1); + + /* Send the modeswitch command */ + ret = usb_bulk_write (dh, ep_out, (char *) rezero_cbw, sizeof (rezero_cbw), 1000); + if (ret < 0) + return ret; + + debug ("%s: REZERO command sent.", dev->filename); + + /* Some devices need to be read from */ + ret = usb_bulk_read (dh, ep_in, buffer, sizeof (buffer), 1000); + +out: + return ret; +} + diff --git a/extras/modem-modeswitch/option.h b/extras/modem-modeswitch/option.h new file mode 100644 index 0000000000..e00dabf082 --- /dev/null +++ b/extras/modem-modeswitch/option.h @@ -0,0 +1,29 @@ +/* + * Modem mode switcher + * + * Copyright (C) 2008 Dan Williams + * Copyright (C) 2008 Peter Henn + * + * Heavily based on the 'ozerocdoff' tool by Peter Henn. + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#ifndef __OPTION_H__ +#define __OPTION_H__ + +#include + +struct usb_device *option_zerocd_find (int vid, int pid); + +int option_zerocd_switch (struct usb_dev_handle *dh, struct usb_device *dev); + +#endif /* __OPTION_H__ */ diff --git a/extras/modem-modeswitch/utils.c b/extras/modem-modeswitch/utils.c new file mode 100644 index 0000000000..37d0df4d65 --- /dev/null +++ b/extras/modem-modeswitch/utils.c @@ -0,0 +1,83 @@ +/* + * Modem mode switcher + * + * Copyright (C) 2009 Dan Williams + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include + +#include "utils.h" + +static int debug_on = 0; +static int quiet = 0; +FILE *logfile = NULL; + +void +do_log (int level, const char *fmt, ...) +{ + va_list args; + char buffer[1024]; + char tag = 'L'; + + if (level >= LOG_DBG && !debug_on) + return; + + va_start (args, fmt); + vsnprintf (buffer, sizeof (buffer), fmt, args); + va_end (args); + + if (level == LOG_ERR) + tag = 'E'; + else if (level == LOG_MSG) + tag = 'L'; + else if (level == LOG_DBG) + tag = 'D'; + + if (logfile) + fprintf (logfile, "%c: %s\n", tag, buffer); + if (!quiet) + fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer); +} + +int +log_startup (const char *path, int do_debug, int be_quiet) +{ + time_t t; + + quiet = be_quiet; + debug_on = do_debug; + + if (!path) + return 0; + + logfile = fopen (path, "a+"); + if (!logfile) + return 1; + + t = time (NULL); + message ("\n**** Started: %s\n", ctime (&t)); + return 0; +} + +void +log_shutdown (void) +{ + if (logfile) + fclose (logfile); +} + diff --git a/extras/modem-modeswitch/utils.h b/extras/modem-modeswitch/utils.h new file mode 100644 index 0000000000..1ef557a892 --- /dev/null +++ b/extras/modem-modeswitch/utils.h @@ -0,0 +1,32 @@ +/* + * Modem mode switcher + * + * Copyright (C) 2009 Dan Williams + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#ifndef __UTILS_H__ +#define __UTILS_H__ + +#define LOG_ERR 0 +#define LOG_MSG 1 +#define LOG_DBG 2 + +#define message(fmt, args...) do_log (LOG_MSG, fmt, ##args); +#define error(fmt, args...) do_log (LOG_ERR, fmt, ##args); +#define debug(fmt, args...) do_log (LOG_DBG, fmt, ##args); + +void do_log (int level, const char *fmt, ...); +int log_startup (const char *path, int do_debug, int be_quiet); +void log_shutdown (void); + +#endif /* __UTILS_H__ */ -- cgit v1.2.3-54-g00ecf From 4b3be1c15836cfedcd017a6dd77fa1c3ac68a5f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Jun 2009 13:31:34 +0200 Subject: configure.ac: print error if gperf is missing --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index e81d999d9e..82c455ddcb 100644 --- a/configure.ac +++ b/configure.ac @@ -51,6 +51,9 @@ AC_ARG_ENABLE([extras], [], [enable_extras=yes]) if test "x$enable_extras" = xyes; then AC_PATH_PROG([GPERF], [gperf]) + if test -z "$GPERF"; then + AC_MSG_ERROR([gperf is needed]) + fi PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0]) AC_SUBST([GLIB_CFLAGS]) -- cgit v1.2.3-54-g00ecf From bc3ebcbdb8baca707519ccd471cca967e0245404 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Jun 2009 16:10:06 +0200 Subject: libudev: install in $libdir and move later to $rootlibdir That way, libudev.la will not get out of sync with the location of the development so link. --- libudev/Makefile.am | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libudev/Makefile.am b/libudev/Makefile.am index 522244641e..220cff0e58 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -12,7 +12,7 @@ test_libudev_SOURCES = \ test_libudev_LDADD = \ libudev.la -rootlib_LTLIBRARIES = \ +lib_LTLIBRARIES = \ libudev.la include_HEADERS =\ @@ -42,17 +42,16 @@ pkgconfig_DATA = \ EXTRA_DIST = \ exported_symbols -# move devel files from $(rootlibdir) to $(libdir) if needed +# move lib from $(libdir) to $(rootlibdir) and update devel link, if needed install-data-hook: - rm -f $(DESTDIR)$(rootlibdir)/libudev.la + rm -f $(DESTDIR)$(libdir)/libudev.la if test "$(libdir)" != "$(rootlibdir)"; then \ mkdir -p $(DESTDIR)$(rootlibdir); \ - so_img_name=$$(readlink $(DESTDIR)$(rootlibdir)/libudev.so); \ - rm $(DESTDIR)$(rootlibdir)/libudev.so; \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libudev.so); \ so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so; \ + mv $(DESTDIR)$(libdir)/libudev.so.* $(DESTDIR)$(rootlibdir); \ fi uninstall-hook: - rm -f $(DESTDIR)$(rootlibdir)/libudev.a rm -f $(DESTDIR)$(rootlibdir)/libudev.so* -- cgit v1.2.3-54-g00ecf From d0d3183278f987e583dfb5cd8720930148ed26f3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Jun 2009 16:18:04 +0200 Subject: extras/keymap: use LIBEXECDIR instead /lib/udev --- extras/keymap/keymap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 454fc835c9..b708f38e7b 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -41,9 +41,6 @@ const struct key* lookup_key (const char *str, unsigned int len); #define MAX_SCANCODES 1024 -/* If keymap file is given without a path, assume this one; must end with '/' * */ -#define DEFAULT_PATH "/lib/udev/keymaps/" - static int evdev_open(const char *dev) { int fd; @@ -222,8 +219,9 @@ static const char* default_keymap_path(const char* path) { static char result[PATH_MAX]; + /* If keymap file is given without a path, assume udev diretory; must end with '/' * */ if (!strchr(path, '/')) { - snprintf(result, sizeof(result), "%s%s", DEFAULT_PATH, path); + snprintf(result, sizeof(result), "%s%s", LIBEXECDIR "/keymaps/", path); return result; } return path; -- cgit v1.2.3-54-g00ecf From 46d1cd15375a562a49af1ecb28637a4c811f03d6 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Wed, 17 Jun 2009 16:24:16 +0200 Subject: rules: Gentoo update --- rules/gentoo/30-kernel-compat.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/gentoo/30-kernel-compat.rules b/rules/gentoo/30-kernel-compat.rules index bf54e33423..1501ec2054 100644 --- a/rules/gentoo/30-kernel-compat.rules +++ b/rules/gentoo/30-kernel-compat.rules @@ -20,6 +20,7 @@ ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" # needed for kernel <2.6.30-rc1 SUBSYSTEM=="scsi", ATTR{type}=="8", RUN+="/sbin/modprobe -b ch" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" # needed for kernel <2.6.27-rc5 # acpi will do on newer kernels -- cgit v1.2.3-54-g00ecf From 2719cef56f039286e06a3419580603221c26fab3 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 17 Jun 2009 16:57:30 +0200 Subject: keymap: Update findkeyboard path in docs findkeyboards is now in /usr/share/udev/ after the migration to udev proper. Update path in README.keymap.txt. --- extras/keymap/README.keymap.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt index 988f742185..1558db8782 100644 --- a/extras/keymap/README.keymap.txt +++ b/extras/keymap/README.keymap.txt @@ -44,7 +44,7 @@ for inclusion you need to do the following steps: 1. Find the keyboard device. - Run /usr/share/udev-extras/findkeyboards. This should always give you an "AT + Run /usr/share/udev/findkeyboards. This should always give you an "AT keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and Acers) have multimedia/function keys on a separate input device instead of the primary keyboard. The keyboard device should have a name like "input/event3". -- cgit v1.2.3-54-g00ecf From 0f50d0ef04feecfb33ac7dd7a38300679c3ed27d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Jun 2009 18:04:05 +0200 Subject: README: add /lib/udev/ is private --- README | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README b/README index 3a511802ea..a2f00021e8 100644 --- a/README +++ b/README @@ -1,12 +1,15 @@ udev - userspace device management -For more information see the files in the docs/ directory. +Integrating udev in the system has complex dependencies and differs from distro +to distro. All major distros depend on udev these days and the system may not +work without a properly installed version. The upstream udev project does not +recommend to replace a distro's udev installation with the upstream version. -Important Note: - Integrating udev in the system has complex dependencies and differs from distro - to distro. All major distros depend on udev these days and the system may not - work without a properly installed version. The upstream udev project does not - recommend to replace a distro's udev installation with the upstream version. +Tools and rules shipped by udev are not public API and may change at any time. +Never call any private tool in /lib/udev from any external application, it might +just go away in the next release. Access to udev information is only offered +by udevadm and libudev. Everything in /lib/udev and /dev/.udev/ is 100% private +to udev. Requirements: - Version 2.6.25 of the Linux kernel with sysfs, procfs, signalfd, inotify, @@ -38,8 +41,9 @@ Requirements: these group names with only the rootfs mounted, and while no network is available. - - To build all udev extras, libacl, libglib2, libusb, usbutils, pciutils are - needed. These dependencies can be disabled with the --disable-extras option. + - To build all udev extras, libacl, libglib2, libusb, usbutils, pciutils, + gperf are needed. These dependencies can be disabled with the + --disable-extras option. Operation: Udev creates and removes device nodes in /dev/, based on events the kernel -- cgit v1.2.3-54-g00ecf From 0373056e4528f89504cfbf6da97394396005a147 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Jun 2009 18:18:22 +0200 Subject: rules: do not install usb-id/pci-id rules when --disable-extras is used --- TODO | 1 + rules/Makefile.am | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index e5b4dfba06..c6576fdaf0 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ + o enumerate: sort control* after pcm* o add tests for kernel provided DEVNAME logic o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) diff --git a/rules/Makefile.am b/rules/Makefile.am index 4bf5bc5f2b..7247cef568 100644 --- a/rules/Makefile.am +++ b/rules/Makefile.am @@ -7,12 +7,16 @@ dist_udevrules_DATA = \ rules.d/60-persistent-serial.rules \ rules.d/60-persistent-input.rules \ rules.d/60-persistent-alsa.rules \ - rules.d/75-net-description.rules \ - rules.d/75-tty-description.rules \ - rules.d/78-sound-card.rules \ rules.d/80-drivers.rules \ rules.d/95-udev-late.rules +if ENABLE_EXTRAS +dist_udevrules_DATA += \ + rules.d/75-net-description.rules \ + rules.d/75-tty-description.rules \ + rules.d/78-sound-card.rules +endif + install-data-local: -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d -- cgit v1.2.3-54-g00ecf From bcee964977fe6a85e1c7e60f6a58ec61843e8921 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Jun 2009 21:57:40 +0200 Subject: extras: delete man pages for private udev tools These are mostly dummy man pages, without real content, some even outdated. None of these tools are part of any offered public interface, and they should not pretend to be by offering a man page. --- extras/ata_id/Makefile.am | 3 -- extras/ata_id/ata_id.8 | 28 ------------------ extras/cdrom_id/Makefile.am | 3 -- extras/cdrom_id/cdrom_id.8 | 36 ----------------------- extras/edd_id/Makefile.am | 3 -- extras/edd_id/edd_id.8 | 27 ------------------ extras/floppy/Makefile.am | 3 -- extras/floppy/create_floppy_devices.8 | 46 ------------------------------ extras/modem-modeswitch/Makefile.am | 3 -- extras/modem-modeswitch/modem-modeswitch.8 | 39 ------------------------- extras/path_id/Makefile.am | 3 -- extras/path_id/path_id.8 | 15 ---------- extras/usb_id/Makefile.am | 3 -- extras/usb_id/usb_id.8 | 38 ------------------------ 14 files changed, 250 deletions(-) delete mode 100644 extras/ata_id/ata_id.8 delete mode 100644 extras/cdrom_id/cdrom_id.8 delete mode 100644 extras/edd_id/edd_id.8 delete mode 100644 extras/floppy/create_floppy_devices.8 delete mode 100644 extras/modem-modeswitch/modem-modeswitch.8 delete mode 100644 extras/path_id/path_id.8 delete mode 100644 extras/usb_id/usb_id.8 diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index 18bf20d7f7..d0f467954e 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -10,6 +10,3 @@ ata_id_SOURCES = \ ../../libudev/libudev.c \ ../../libudev/libudev-list.c \ ../../libudev/libudev-util.c - -dist_man_MANS = \ - ata_id.8 diff --git a/extras/ata_id/ata_id.8 b/extras/ata_id/ata_id.8 deleted file mode 100644 index 32cb3714b9..0000000000 --- a/extras/ata_id/ata_id.8 +++ /dev/null @@ -1,28 +0,0 @@ -.TH ATA_ID 8 "November 2005" "" "Linux Administrator's Manual" -.SH NAME -ata_id \- udev callout to read product/serial number from ATA drives -.SH SYNOPSIS -.BI ata_id -[\fI--export\fP] \fIblockdevice\fP -.SH "DESCRIPTION" -.B ata_id -is normally called from a udev rule, to provide udev with a unique string and -additional information (uuid, label) for an ATA drive. Udev can use this -information to create symlinks in /dev/disk/by-id and /dev/disk/by-label -to the real device node. -.SH USAGE -.B ata_id -opens the blockdevice node specified at the commandline and prints the -information chosen by the options. -.SH OPTIONS -The following commandline switches are supported to specify what ata_id -should print: -.TP -.BI --export -print all values (instead of only the id) -.RE -.SH SEE ALSO -.BR udev (7) -.SH AUTHORS -Developed by Kay Sievers . - diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index 99c96b24e8..d86e68e990 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -13,6 +13,3 @@ cdrom_id_SOURCES = \ ../../libudev/libudev.c \ ../../libudev/libudev-list.c \ ../../libudev/libudev-util.c - -dist_man_MANS = \ - cdrom_id.8 diff --git a/extras/cdrom_id/cdrom_id.8 b/extras/cdrom_id/cdrom_id.8 deleted file mode 100644 index 617d9f67d1..0000000000 --- a/extras/cdrom_id/cdrom_id.8 +++ /dev/null @@ -1,36 +0,0 @@ -.TH CDROM_ID 8 "January 2009" "" "Linux Administrator's Manual" -.SH NAME -cdrom_id \- udev callout to determine the capabilities of optical drives and media -.SH SYNOPSIS -.B cdrom_id -[\fB--export\fP] [\fB--debug\fP] \fIdevice\fP -.br -.B cdrom_id -\fB--help\fP -.SH "DESCRIPTION" -.B cdrom_id -is normally called from a udev rule, to provide udev with the list of -capabilities of a optical drive. -.SH USAGE -.B cdrom_id -opens the device node specified at the commandline and prints the -discovered capabilities. -.SH OPTIONS -The following commandline switches are supported to specify what cdrom_id -should print: -.TP -.B -x, --export -Print all values as environment keys. This is the default at present, so this -option is currently redundant. -.TP -.B -d, --debug -Print a debug trace. -.TP -.B -h, --help -Print usage help. -.RE -.SH SEE ALSO -.BR udev (7) -.SH AUTHORS -Developed by Kay Sievers . - diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 8c5fafefea..464e667fad 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -12,6 +12,3 @@ edd_id_SOURCES = \ ../../libudev/libudev.c \ ../../libudev/libudev-list.c \ ../../libudev/libudev-util.c - -dist_man_MANS = \ - edd_id.8 diff --git a/extras/edd_id/edd_id.8 b/extras/edd_id/edd_id.8 deleted file mode 100644 index 86576bbb39..0000000000 --- a/extras/edd_id/edd_id.8 +++ /dev/null @@ -1,27 +0,0 @@ -.TH EDD_ID 8 "November 2005" "" "Linux Administrator's Manual" -.SH NAME -edd_id \- udev callout to identify BIOS disk drives via EDD -.SH SYNOPSIS -.BI edd_id -[\fI--export\fP] \fIblockdevice\fP -.SH "DESCRIPTION" -.B edd_id -is normally called from a udev rule, to provide udev with the edd id for -a BIOS disk drive. Udev can use this information to create symlinks in -/dev/disk/by-id and /dev/disk/by-label to the real device node. -.SH USAGE -.B edd_id -opens the blockdevice node specified at the commandline and prints the -information chosen by the options. -.SH OPTIONS -The following commandline switches are supported to specify what edd_id -should print: -.TP -.BI --export -print all values (instead of only the id) -.RE -.SH SEE ALSO -.BR udev (7) -.SH AUTHORS -Developed by John Hull and Kay Sievers . - diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index c842324e48..3160ce5e76 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -20,6 +20,3 @@ create_floppy_devices_SOURCES += \ create_floppy_devices_LDADD = \ $(SELINUX_LIBS) endif - -dist_man_MANS = \ - create_floppy_devices.8 diff --git a/extras/floppy/create_floppy_devices.8 b/extras/floppy/create_floppy_devices.8 deleted file mode 100644 index 2727fc84a0..0000000000 --- a/extras/floppy/create_floppy_devices.8 +++ /dev/null @@ -1,46 +0,0 @@ -.TH CREATE_FLOPPY_DEVICES 8 "January 2009" "" "Linux Administrator's Manual" -.SH NAME -create_floppy_devices \- udev callout to create all possible floppy devices -based on the CMOS type. -.SH SYNOPSIS -create_floppy_devices [\fIoptions\fP] \fIdevice\fP -.SH OPTIONS -Note that no output will be produced unless the \fB-t\fP option is set. -.TP -.B -c -Create nodes. -.TP -.B -d -Print nodes to stdout. -.TP -.BI "-t " type -Set CMOS floppy type. Type numbers are based on the six floppy types specified -in the kernel's drivers/block/floppy.c, as follows. -.TS -lb lb -l l. -Type Device -0 Unknown. (Produces no output.) -1 5 1/4" 360KB PC -2 5 1/4" HD AT -3 3 1/2" DD -4 3 1/2" HD -5 3 1/2" ED -6 Same as 5. -.TE -.TP -.BI "-m " number -Set major number. -.TP -.BI "-U " user -Set user ownership. -.TP -.BI "-G " group -Set group ownership. -.TP -.BI "-M " mode -Set device node mode. -.SH SEE ALSO -.BR udev (7) -.SH AUTHORS -Developed by Hannes Reinecke . diff --git a/extras/modem-modeswitch/Makefile.am b/extras/modem-modeswitch/Makefile.am index 94d58d065f..e3d18b8c52 100644 --- a/extras/modem-modeswitch/Makefile.am +++ b/extras/modem-modeswitch/Makefile.am @@ -21,6 +21,3 @@ modem_modeswitch_LDADD = \ dist_udevrules_DATA = \ 61-option-modem-modeswitch.rules \ 61-mobile-action.rules - -dist_man_MANS = \ - modem-modeswitch.8 diff --git a/extras/modem-modeswitch/modem-modeswitch.8 b/extras/modem-modeswitch/modem-modeswitch.8 deleted file mode 100644 index 80fab0d548..0000000000 --- a/extras/modem-modeswitch/modem-modeswitch.8 +++ /dev/null @@ -1,39 +0,0 @@ -.TH MODEM_MODESWITCH 8 "November 2005" "" "Linux Administrator's Manual" -.SH NAME -modem-modeswitch \- udev callout to switch mobile broadband devices to their -intended modem mode -.SH SYNOPSIS -.BI modem-modeswitch -\fI--vendor \fP \fI--product \fP [\fI--debug\fP] -\fI--type \fP \fI\fP -.SH "DESCRIPTION" -.B modem-modeswitch -is normally called from a udev rule, to eject the driver CD that many mobile -broadband devices mount by default, and switch them into modem mode. -.SH USAGE -.B modem-modeswitch -switches the device into modem mode -.SH OPTIONS -The following commandline switches are supported: -.TP -.BI \-\-vendor\ -the USB vendor ID of the mobile broadband device to switch -.TP -.BI \-\-product\ -the USB product ID of the mobile broadband device to switch -.TP -.BI \-\-type\ -the type of switch to perform (one of: option-zerocd, mobile-action-8280p) -.TP -.BI \-\-log\ -log verbose debugging information about the switching process -.TP -.BI \-\-debug -print verbose debugging information about the switching process -.RE -.SH SEE ALSO -.BR udev (7) -.SH AUTHORS -Developed by Dan Williams based off code by Peter Henn -. - diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am index c501fc9340..ca1c21eda5 100644 --- a/extras/path_id/Makefile.am +++ b/extras/path_id/Makefile.am @@ -11,6 +11,3 @@ path_id_SOURCES = \ ../../libudev/libudev-enumerate.c \ ../../libudev/libudev-list.c \ ../../libudev/libudev-util.c - -dist_man_MANS = \ - path_id.8 diff --git a/extras/path_id/path_id.8 b/extras/path_id/path_id.8 deleted file mode 100644 index 9dc5965979..0000000000 --- a/extras/path_id/path_id.8 +++ /dev/null @@ -1,15 +0,0 @@ -.TH PATH_ID 8 "April 2007" "" "Linux Administrator's Manual" -.SH NAME -path_id \- udev callout to create a device path based unique name -for a device to implement the Linux Persistent Device Naming scheme -.SH SYNOPSIS -path_id -.SH "DESCRIPTION" -.B path_id -is normally called from a udev rule, to create a unique name, based on -the device properties along the chain of parent devices. Udev uses this -information to create a persistent symlink to the real device node. -.SH SEE ALSO -.BR udev (7) -.SH AUTHORS -Developed by Hannes Reinecke . diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index bd76fb76c1..6ea7b5132c 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -11,6 +11,3 @@ usb_id_SOURCES = \ ../../libudev/libudev-util.c \ ../../libudev/libudev-device.c \ ../../libudev/libudev-enumerate.c - -dist_man_MANS = \ - usb_id.8 diff --git a/extras/usb_id/usb_id.8 b/extras/usb_id/usb_id.8 deleted file mode 100644 index 0d5c0958b8..0000000000 --- a/extras/usb_id/usb_id.8 +++ /dev/null @@ -1,38 +0,0 @@ -.TH USB_ID 8 "January 2009" "" "Linux Administrator's Manual" -.SH NAME -usb_id \- udev callout to read information from USB devices -.SH SYNOPSIS -.B usb_id -[\fB--usb-info\fP] [\fB--num-info\fP] [\fB--export\fP] [\fB--debug\fP] -.I devpath -.br -.B usb_id --help -.SH "DESCRIPTION" -.B usb_id -is normally called from a udev rule, to provide udev with a unique string and -additional information (uuid, label) for a USB device. Udev can use this -information to create symlinks in /dev to the real device node. -.SH USAGE -.B usb_id \fIdevpath\fP -opens the device node specified at the commandline and prints the -information chosen by the options. -.SH OPTIONS -The following commandline switches are supported to specify what usb_id -should print: -.TP -.B -u, --usb-info -print USB strings instead of, e.g. SCSI strings for a mass storage device -.TP -.B -n, --num-info -print numerical values instead of strings. Implies \fB--usb-info\fP. -.TP -.B -x, --export -print values as environment keys -.TP -.B -h, --help -print usage help -.RE -.SH SEE ALSO -.BR udev (7) -.SH AUTHORS -Developed by Hannes Reinecke . -- cgit v1.2.3-54-g00ecf From 89eaa6a56eded9f76c452e20994aaf45c7c2dad9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Jun 2009 22:14:52 +0200 Subject: README: update --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index a2f00021e8..b4c0ee051f 100644 --- a/README +++ b/README @@ -8,8 +8,8 @@ recommend to replace a distro's udev installation with the upstream version. Tools and rules shipped by udev are not public API and may change at any time. Never call any private tool in /lib/udev from any external application, it might just go away in the next release. Access to udev information is only offered -by udevadm and libudev. Everything in /lib/udev and /dev/.udev/ is 100% private -to udev. +by udevadm and libudev. Tools and rules in /lib/udev and the entire content of +/dev/.udev/ is private to udev. Requirements: - Version 2.6.25 of the Linux kernel with sysfs, procfs, signalfd, inotify, -- cgit v1.2.3-54-g00ecf From 3b338b6bb9747c5d56fdf73da113e3e0dd710704 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Jun 2009 11:48:04 +0200 Subject: extras/keymap: install findkeyboards in /lib/udev --- extras/keymap/Makefile.am | 118 +++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 65 deletions(-) diff --git a/extras/keymap/Makefile.am b/extras/keymap/Makefile.am index 55cce54ea2..5c74575c67 100644 --- a/extras/keymap/Makefile.am +++ b/extras/keymap/Makefile.am @@ -1,68 +1,51 @@ -# keymap 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; either version 2 of the License, or -# (at your option) any later version. -# -# keymap 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 keymap; if not, write to the Free Software Foundation, -# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - include $(top_srcdir)/Makefile.am.inc -# rules and keymaps dist_udevrules_DATA = 95-keymap.rules udevkeymapdir = $(libexecdir)/keymaps udevkeymap_DATA = \ - keymaps/acer \ - keymaps/acer-aspire_5920g \ - keymaps/acer-extensa_5xxx \ - keymaps/acer-travelmate_6292 \ - keymaps/acer-travelmate_c300 \ - keymaps/asus \ - keymaps/benq-joybook_r22 \ - keymaps/compaq-e_evo \ - keymaps/dell \ - keymaps/fujitsu-amilo_pa_2548 \ - keymaps/fujitsu-amilo_pro_edition_v3505 \ - keymaps/fujitsu-amilo_pro_v3205 \ - keymaps/fujitsu-amilo_si_1520 \ - keymaps/fujitsu-esprimo_mobile_v5 \ - keymaps/fujitsu-esprimo_mobile_v6 \ - keymaps/hewlett-packard \ - keymaps/hewlett-packard-2510p_2530p \ - keymaps/hewlett-packard-compaq_elitebook \ - keymaps/hewlett-packard-pavilion \ - keymaps/hewlett-packard-tablet \ - keymaps/hewlett-packard-tx2 \ - keymaps/inventec-symphony_6.0_7.0 \ - keymaps/lenovo-3000 \ - keymaps/lenovo-thinkpad_x6_tablet \ - keymaps/lenovo-thinkpad_x200_tablet \ - keymaps/maxdata-pro_7000 \ - keymaps/medion-fid2060 \ - keymaps/medionnb-a555 \ - keymaps/micro-star \ - keymaps/module-asus-w3j \ - keymaps/module-ibm \ - keymaps/module-lenovo \ - keymaps/module-sony \ - keymaps/module-sony-old \ - keymaps/oqo-model2 \ - keymaps/samsung-other \ - keymaps/samsung-sq1us \ - keymaps/samsung-sx20s \ - keymaps/toshiba-satellite_a100 \ - keymaps/toshiba-satellite_a110 - -dist_pkgdata_SCRIPTS = findkeyboards +keymaps/acer \ + keymaps/acer-aspire_5920g \ + keymaps/acer-extensa_5xxx \ + keymaps/acer-travelmate_6292 \ + keymaps/acer-travelmate_c300 \ + keymaps/asus \ + keymaps/benq-joybook_r22 \ + keymaps/compaq-e_evo \ + keymaps/dell \ + keymaps/fujitsu-amilo_pa_2548 \ + keymaps/fujitsu-amilo_pro_edition_v3505 \ + keymaps/fujitsu-amilo_pro_v3205 \ + keymaps/fujitsu-amilo_si_1520 \ + keymaps/fujitsu-esprimo_mobile_v5 \ + keymaps/fujitsu-esprimo_mobile_v6 \ + keymaps/hewlett-packard \ + keymaps/hewlett-packard-2510p_2530p \ + keymaps/hewlett-packard-compaq_elitebook \ + keymaps/hewlett-packard-pavilion \ + keymaps/hewlett-packard-tablet \ + keymaps/hewlett-packard-tx2 \ + keymaps/inventec-symphony_6.0_7.0 \ + keymaps/lenovo-3000 \ + keymaps/lenovo-thinkpad_x6_tablet \ + keymaps/lenovo-thinkpad_x200_tablet \ + keymaps/maxdata-pro_7000 \ + keymaps/medion-fid2060 \ + keymaps/medionnb-a555 \ + keymaps/micro-star \ + keymaps/module-asus-w3j \ + keymaps/module-ibm \ + keymaps/module-lenovo \ + keymaps/module-sony \ + keymaps/module-sony-old \ + keymaps/oqo-model2 \ + keymaps/samsung-other \ + keymaps/samsung-sq1us \ + keymaps/samsung-sx20s \ + keymaps/toshiba-satellite_a100 \ + keymaps/toshiba-satellite_a110 -# keymap program +dist_libexec_SCRIPTS = findkeyboards libexec_PROGRAMS = keymap @@ -72,14 +55,19 @@ keymap_CPPFLAGS = $(AM_CPPFLAGS) dist_doc_DATA = README.keymap.txt -EXTRA_DIST=keymaps check-keymaps.sh -BUILT_SOURCES = keys-from-name.h keys-to-name.h -CLEANFILES = keys.txt keys-from-name.gperf keys-from-name.h keys-to-name.h -TESTS = check-keymaps.sh +EXTRA_DIST = \ + keymaps \ + check-keymaps.sh -# -# generation of keys-{from,to}-name.h from linux/input.h and gperf -# +BUILT_SOURCES = \ + keys-from-name.h \ + keys-to-name.h + +CLEANFILES = \ + keys.txt keys-from-name.gperf \ + keys-from-name.h keys-to-name.h + +TESTS = check-keymaps.sh keys.txt: /usr/include/linux/input.h $(AWK) '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ -- cgit v1.2.3-54-g00ecf From 22e8ccdc02c7bf2e487f5422a7a41bbe6e26962b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Jun 2009 11:49:11 +0200 Subject: INSTALL: use /sbin instead of %{sbindir} --- INSTALL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL b/INSTALL index 7894555df8..02ad55fe47 100644 --- a/INSTALL +++ b/INSTALL @@ -35,7 +35,7 @@ The options used in a RPM spec file usually look like: %configure \ --prefix=%{_prefix} \ --sysconfdir=%{_sysconfdir} \ - --sbindir=%{_sbindir} \ + --sbindir=/sbin \ --libdir=%{_libdir} \ --with-rootlibdir=/%{_lib} \ --libexecdir=/lib/udev \ -- cgit v1.2.3-54-g00ecf From 8fac66c9d4045215d061ad73c3916937370c7c8e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Jun 2009 11:49:49 +0200 Subject: NEWS: update --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 89890a8d06..2d2a094a31 100644 --- a/NEWS +++ b/NEWS @@ -28,7 +28,7 @@ build without it and contain the pre-built documentation. An online copy is available here: http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/ -Many extras of the udev-extras repository have been merged into the main +The tools from the udev-extras repository have been merged into the main udev repository. Some of the extras have larger external dependencies, and they can be disabled with the configure switch --disable-extras. -- cgit v1.2.3-54-g00ecf From eb20485b407669720ce6fc7bc94de50ec0580b62 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 19 Jun 2009 14:49:35 +0200 Subject: udev-acl: Manage hplip device permissions hplip tools need user access to the devices for checking ink levels and user-level configuration. This was formerly done with hal FDIs. As per discussion with Till Kamppeter. --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index fc27039597..26b805565a 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -17,6 +17,9 @@ KERNEL=="sg[0-9]*", ATTRS{type}=="3", ATTRS{vendor}=="HP|EPSON|Epson", ENV{ACL_M # USB scanners ENV{libsane_matched}=="yes", ENV{ACL_MANAGE}="1" +# HPLIP devices (necessary for ink level check and HP tool maintenance) +ENV{ID_HPLIP}=="1", ENV{ACL_MANAGE}="1" + # optical drives SUBSYSTEM=="block", ENV{ID_CDROM}=="1", ENV{ACL_MANAGE}="1" -- cgit v1.2.3-54-g00ecf From a33da970ef0e07f204d6bfef4690902195dc4818 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 19 Jun 2009 14:53:18 +0200 Subject: extras/keymap: Update findkeyboards location Recent commit 3b338b6 moved findkeyboards from /usr/share/udev to /lib/udev/. Update documentation accordingly. --- extras/keymap/README.keymap.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt index 1558db8782..eab8587de8 100644 --- a/extras/keymap/README.keymap.txt +++ b/extras/keymap/README.keymap.txt @@ -44,7 +44,7 @@ for inclusion you need to do the following steps: 1. Find the keyboard device. - Run /usr/share/udev/findkeyboards. This should always give you an "AT + Run /lib/udev/findkeyboards. This should always give you an "AT keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and Acers) have multimedia/function keys on a separate input device instead of the primary keyboard. The keyboard device should have a name like "input/event3". -- cgit v1.2.3-54-g00ecf From 3ab2be88bde4c0baa1b3cad5d473bc07a8b5c1fb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Jun 2009 19:17:18 +0200 Subject: udev.pc: add --- configure.ac | 1 + udev/Makefile.am | 4 ++++ udev/udev.pc.in | 5 +++++ 3 files changed, 10 insertions(+) create mode 100644 udev/udev.pc.in diff --git a/configure.ac b/configure.ac index 82c455ddcb..9fde92a3a8 100644 --- a/configure.ac +++ b/configure.ac @@ -106,6 +106,7 @@ AC_CONFIG_FILES([ libudev/docs/Makefile libudev/docs/version.xml udev/Makefile + udev/udev.pc rules/Makefile extras/Makefile extras/ata_id/Makefile diff --git a/udev/Makefile.am b/udev/Makefile.am index 5f6f7c54c0..6c0b94e2cf 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -71,7 +71,11 @@ dist_man_MANS = \ udevadm.8 \ udevd.8 +pkgconfigdir = $(datadir)/pkgconfig +pkgconfig_DATA = udev.pc + EXTRA_DIST = \ + udev.pc.in \ udev.xml \ udevadm.xml \ udevd.xml diff --git a/udev/udev.pc.in b/udev/udev.pc.in new file mode 100644 index 0000000000..92a8b3ee17 --- /dev/null +++ b/udev/udev.pc.in @@ -0,0 +1,5 @@ +Name: udev +Description: udev +Version: @VERSION@ + +udevdir=@libexecdir@ -- cgit v1.2.3-54-g00ecf From 95023c77fc476355c2485ca1cce7b3e2b9619b68 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Jun 2009 19:33:22 +0200 Subject: docs: install writing_udev_rules --- Makefile.am | 7 +++---- configure.ac | 1 + docs/Makefile.am | 5 +++++ 3 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 docs/Makefile.am diff --git a/Makefile.am b/Makefile.am index 0ebf232c80..5da4779fb8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,18 +1,17 @@ include $(top_srcdir)/Makefile.am.inc SUBDIRS = \ + docs \ libudev \ udev \ rules \ extras udevconfdir = $(sysconfdir)/udev -udevconf_DATA = \ +dist_udevconf_DATA = \ udev.conf EXTRA_DIST = \ - udev.conf \ - docs \ autogen.sh CLEANFILES = \ @@ -62,4 +61,4 @@ git-release: doc-sync: rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ - rsync -av --delete extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libgudev/ + rsync -av --delete extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/gudev/ diff --git a/configure.ac b/configure.ac index 9fde92a3a8..e5642f6b13 100644 --- a/configure.ac +++ b/configure.ac @@ -101,6 +101,7 @@ AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile + docs/Makefile libudev/Makefile libudev/libudev.pc libudev/docs/Makefile diff --git a/docs/Makefile.am b/docs/Makefile.am new file mode 100644 index 0000000000..0c829b43f5 --- /dev/null +++ b/docs/Makefile.am @@ -0,0 +1,5 @@ +include $(top_srcdir)/Makefile.am.inc + +writing_udev_rulesdir = $(docdir)/writing_udev_rules +dist_writing_udev_rules_DATA = \ + writing_udev_rules/index.html -- cgit v1.2.3-54-g00ecf From e54a3c2f3fd2761d3cdb68c8dadea7e45c1f0892 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 19 Jun 2009 19:50:01 +0200 Subject: release 143 --- ChangeLog | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) diff --git a/ChangeLog b/ChangeLog index 598ce58be0..2d258f6b39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,146 @@ +Summary of changes from v142 to v143 +============================================ + +Alan Jenkins (5): + udevadm: settle - fix timeout + udevd: remove tiny bit of dead code + udevd: implement a more efficient queue file format + udev-selinux.c: remove libudev header + udevd: queue-export - fix crash + +Benjamin Gilbert (1): + test: check string substitutions in OWNER and GROUP + +Dan Williams (2): + rules: tty/net - move from udev-extras + extras/modem-modeswitch: move from udev-extras + +David Zeuthen (1): + gudev: move from udev-extras + +Kay Sievers (95): + version bump + rules: v4l do not mix vbi and video nodes + fix possible endless loop for GOTO to non-existent LABEL + Revert "rules: v4l do not mix vbi and video nodes" + rule-generator: cd - skip by-path links if we create by-id links + remove format char string truncation syntax + use more efficient string copying + edd_id: use openat() + use openat(), unlinkat(), fstatat() + update TODO + remove unused GL_FORMAT from rules parser + require key names in uppercase + keep the ifdef'd udevd testing/profiling hack + fix location of database files + udevadm: settle - make --timeout=0 working + update NEWS + rules: add SUBSYSTEM match to scsi rules + cdrom_id: suppress ID_CDROM_MEDIA_STATE=blank for plain non-writable CDROM media + udevadm: control - add comment to man page about --reload-rules + cdrom_id: add error message if open() fails + udevadm: settle - add --exit-if-exists= + udevd: remove check for dev_t, DEVPATH_OLD takes care of that + str[sp]cpyl: add __attribute__ ((sentinel)) + udevd: convert to event worker processes + udevd: close netlink socket in worker and set cloexec + rules: do not call path_id for virtual devices + udevd: use enum instead of char in struct declaration + allow format substitution in path of ATTR{}=="" + cleanup $attr{} substitution + path_id: implement in C using libudev + path_id: update SCSI handling + path_id: add comments + fix signed/unsigned warning + libudev: enumerate - allow multiple keys with the same name + udevadm: trigger - add --property-match=: + udevadm: info - accept --query without a value and print properties + udevadm: control - --env -> --property + udevadm: monitor --environment -> --property + path_id: handle fibre channel + path_id: add iscsi support + path_id: delete old shell script + udevd: print error if worker dies unexpectedly + path_id: rename scsi sub-fuctions + libudev: add comments to libudev.h + libudev: move to top-level directory + fix libudev include in Makefile.am.in + libudev: device_new() -> udev_device_new() + udevd: log info for created/killed workers + libudev: call log functions conditionally + move syslog wrapper to libudev + move common stuff from udev/ to private parts of libudev/ + libudev: rename private files to *-private.c + rules: remove scsi ch module loading rule + update NEWS + udevadm: info -revert "accept --query without argument" + README: add kernel options + README: add INOTIFY and SIGNALFD + USE_LOG -> ENABLE_LOGGING, DEBUG -> ENABLE_DEBUG, USE_SELINUX -> WITH_SELINUX + libudev: add gtk-doc + libudev: update documentation + libudev: doc - add section headers + libudev: doc - add enumerate + libudev: doc - add queue + update TODO + libudev: doc - add namespace for index + libudev: move .so version to libudev Makefile + autogen.sh: simplify + TODO: update + libudev: remove prefix from .so version variables + libudev: doc - add empty libudev.types + udev-acl: move from udev-extras + INSTALL: add --enable-extras + udev-acl: handle missing action when called in CK mode + v4l_id: move from udev-extras + libudev: doc - libudev-docs.sgml -> libudev-doc.xml + gudev: fix typo in configure option + v4l_id: 70-v4l.rules -> 60-persistent-v4l.rules + configure: enable all extras by default, provide --disable-extras + autogen.sh: make "CFLAGS=-O0 ./autogen.sh" working + NEWS: add --disable-extras + cleanup ./configure installation directory options + rules: remove MMC rule, 2.6.30 has the modalias + configure.ac: print error if gperf is missing + libudev: install in $libdir and move later to $rootlibdir + extras/keymap: use LIBEXECDIR instead /lib/udev + README: add /lib/udev/ is private + rules: do not install usb-id/pci-id rules when --disable-extras is used + extras: delete man pages for private udev tools + README: update + extras/keymap: install findkeyboards in /lib/udev + INSTALL: use /sbin instead of %{sbindir} + NEWS: update + udev.pc: add + Merge branch 'master' of git+ssh://master.kernel.org/pub/scm/linux/hotplug/udev + docs: install writing_udev_rules + +Lennart Poettering (2): + rules: sound - move from udev-extra + usb-db: move from udev-extras + +Marcel Holtmann (1): + rules: make RFKILL control device world readable + +Mario Limonciello (1): + hid2hci: move from udev-extras + +Martin Pitt (5): + keymap: move from udev-extras + extras/keymap: Fix WLAN button on ThinkPads + keymap: Update findkeyboard path in docs + udev-acl: Manage hplip device permissions + extras/keymap: Update findkeyboards location + +Matthias Schwarzott (3): + rules: Gentoo update + rules: Gentoo update + rules: Gentoo update + +Scott James Remnant (1): + OWNER/GROUP: fix if logic + + Summary of changes from v141 to v142 ============================================ -- cgit v1.2.3-54-g00ecf From a6c06e57a217b1bb0f10f836db80e9bf4f424484 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 20 Jun 2009 03:57:26 +0200 Subject: configure.ac: add AM_SILENT_RULES --- configure.ac | 2 +- extras/gudev/docs/gudev-docs.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index e5642f6b13..73687dc480 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ AC_INIT([udev], [143], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_DISABLE_STATIC AC_USE_SYSTEM_EXTENSIONS -dnl AM_SILENT_RULES AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) AC_PROG_LIBTOOL diff --git a/extras/gudev/docs/gudev-docs.xml b/extras/gudev/docs/gudev-docs.xml index 8ad3b6e566..bb5f560402 100644 --- a/extras/gudev/docs/gudev-docs.xml +++ b/extras/gudev/docs/gudev-docs.xml @@ -1,6 +1,6 @@ - ]> -- cgit v1.2.3-54-g00ecf From c668754b710bebf3ff413e1da58faae14559983c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Jun 2009 00:30:42 +0200 Subject: configure.ac: version bump --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 2d2a094a31..8838d93a38 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +udev 144 +======== + udev 143 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 73687dc480..0edc293965 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [143], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [14], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 7567ca34aafe537dff9734e312b37a021a4cdb9c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Jun 2009 00:31:46 +0200 Subject: TODO: add cleanup of ATA_COMPAT --- TODO | 1 + 1 file changed, 1 insertion(+) diff --git a/TODO b/TODO index c6576fdaf0..6506622a85 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,4 @@ + o cleanup ATA handling - kill ATA_COMPAT and calls of ata_id/scsi_id o enumerate: sort control* after pcm* o add tests for kernel provided DEVNAME logic -- cgit v1.2.3-54-g00ecf From f86ac6e170eae3f40548627cf5ba1264329d43d3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Jun 2009 00:32:26 +0200 Subject: libudev: queue - add comments for queue format udev/udev.pc --- libudev/libudev-queue-private.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 9ae680c386..0427b65a01 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -19,19 +19,22 @@ * * When a new event is queued, its details are appended to the log. * When the event finishes, a second record is appended to the log - * with the same sequence number but a null devpath. + * with the same sequence number but a devpath len of 0. * * Example: - * {1, "/devices/virtual/mem/null" }, - * {2, "/devices/virtual/mem/zero" }, - * {1, "" }, - * Event 2 is still queued, but event 1 has been finished + * { 0x0000000000000001 } + * { 0x0000000000000001, 0x0019, "/devices/virtual/mem/null" }, + * { 0x0000000000000002, 0x001b, "/devices/virtual/mem/random" }, + * { 0x0000000000000001, 0x0000 }, + * { 0x0000000000000003, 0x0019, "/devices/virtual/mem/zero" }, * - * The queue does not grow indefinitely. It is periodically re-created - * to remove finished events. Atomic rename() makes this transparent to readers. + * Events 2 and 3 are still queued, but event 1 has finished. + * + * The queue does not grow indefinitely. It is periodically re-created + * to remove finished events. Atomic rename() makes this transparent to readers. * * The queue file starts with a single sequence number which specifies the - * minimum sequence number in the log that follows. Any events prior to this + * minimum sequence number in the log that follows. Any events prior to this * sequence number have already finished. */ @@ -349,7 +352,7 @@ static int update_queue(struct udev_queue_export *udev_queue_export, return -1; } - /* when the queue files grow too large, they must be garbage collected and rebuilt */ + /* when the queue file grows too large, garbage-collect and rebuild it */ bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); /* if we're removing the last event from the queue, that's the best time to rebuild it */ -- cgit v1.2.3-54-g00ecf From 717244eba03210685529de9a1ccf96dccaea2142 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Jun 2009 00:33:09 +0200 Subject: udev/.gitignore: add udev.pc --- udev/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/.gitignore b/udev/.gitignore index f452b67232..97248fa319 100644 --- a/udev/.gitignore +++ b/udev/.gitignore @@ -2,4 +2,4 @@ udevd udevadm test-udev *.[78] - +udev.pc -- cgit v1.2.3-54-g00ecf From 7d063096c44630593b13eae76c03619b974e0364 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 22 Jun 2009 16:34:55 +0200 Subject: configure.ac: version bump --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0edc293965..498c4c9ab9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [14], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [144], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From b53c3a21b9992915f89624f60e85fe50b7aad4ad Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 26 Jun 2009 08:17:23 +0200 Subject: hid2hci: narrow matches to real HCI devices The previous rules just checked bInterfaceProtocol but not the actual device and interface class. This caused the hci rules to be applied for Dell USB hubs and attached input devices like keyboards and mouses as well, breaking them completely. Tighten the match to also check device and interface class/subclass. https://launchpad.net/bugs/392144 --- extras/hid2hci/70-hid2hci.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index 2cb2746050..caf9120f53 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -8,7 +8,7 @@ SUBSYSTEM!="usb", GOTO="hid2hci_end" # is where a HID report needs to be sent to switch modes. # # Known supported devices: 413c:8154, 413c:8158, 413c:8162 -ATTR{bInterfaceProtocol}=="02", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ +ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProtocol}=="02", ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ RUN+="hid2hci --method dell -v $attr{idVendor} -p $attr{idProduct} --mode hci" ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" -- cgit v1.2.3-54-g00ecf From b25a94549ce37cd7654f6f44b66944375919db58 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Jun 2009 02:21:58 +0200 Subject: do not exports properties starting with a '.' Private variables can be marked like: ENV{.FOO}="bar" --- libudev/libudev-device.c | 10 ++++++++-- udev/udev-rules.c | 15 +++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 669c51e35b..951f78aa5c 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1211,14 +1211,20 @@ static int update_envp_monitor_buf(struct udev_device *udev_device) s = udev_device->monitor_buf; l = MONITOR_BUF_SIZE; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + const char *key; + + key = udev_list_entry_get_name(list_entry); + /* skip private variables */ + if (key[0] == '.') + continue; + /* add string to envp array */ udev_device->envp[i++] = s; if (i+1 >= ENVP_SIZE) return -EINVAL; /* add property string to monitor buffer */ - l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), "=", - udev_list_entry_get_value(list_entry), NULL); + l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL); if (l == 0) return -EINVAL; s++; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 174edfd9c4..96d7377472 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -718,8 +718,9 @@ static int import_property_from_string(struct udev_device *dev, char *line) struct udev_list_entry *entry; entry = udev_device_add_property(dev, key, val); - /* store in db */ - udev_list_entry_set_flag(entry, 1); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_flag(entry, 1); } return 0; } @@ -785,8 +786,9 @@ static int import_parent_into_properties(struct udev_device *dev, const char *fi dbg(udev, "import key '%s=%s'\n", key, val); entry = udev_device_add_property(dev, key, val); - /* store in db */ - udev_list_entry_set_flag(entry, 1); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_flag(entry, 1); } } return 0; @@ -2374,8 +2376,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); entry = udev_device_add_property(event->dev, name, temp_value); - /* store in db */ - udev_list_entry_set_flag(entry, 1); + /* store in db, skip private keys */ + if (name[0] != '.') + udev_list_entry_set_flag(entry, 1); } else { udev_device_add_property(event->dev, name, NULL); } -- cgit v1.2.3-54-g00ecf From a8916c3400e2968aa17b296deff8736db86c338a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Jun 2009 02:27:23 +0200 Subject: scsi_id: --reformat_serial - use udev_util_replace_whitespace() --- extras/scsi_id/scsi_id.c | 37 ++++++++++--------------------------- extras/scsi_id/scsi_serial.c | 7 ++----- 2 files changed, 12 insertions(+), 32 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 7cf2f3765d..72a7257113 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -517,31 +517,6 @@ static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, co return 0; } -/* - * format_serial: replace to whitespaces by underscores for calling - * programs that use the serial for device naming (multipath, Suse - * naming, etc...) - */ -static void format_serial(char *serial) -{ - char *p = serial, *q; - - q = p; - while (*p != '\0') { - if (isspace(*p)) { - if (q > serial && q[-1] != '_') { - *q = '_'; - q++; - } - } else { - *q = *p; - q++; - } - p++; - } - *q = '\0'; -} - /* * scsi_id: try to get an id, if one is found, printf it to stdout. * returns a value passed to exit() - 0 if printed an id, else 1. @@ -595,8 +570,16 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) retval = 1; goto out; } - if (reformat_serial) - format_serial(dev_scsi.serial); + + if (reformat_serial) { + char serial_str[MAX_SERIAL_LEN]; + + udev_util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + udev_util_replace_chars(serial_str, NULL); + printf("%s\n", serial_str); + goto out; + } + printf("%s\n", dev_scsi.serial); out: return retval; diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index c47712d859..68bed08241 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -457,11 +457,8 @@ static int prepend_vendor_model(struct udev *udev, int ind; strncpy(serial, dev_scsi->vendor, VENDOR_LENGTH); - ind = strlen(serial) - 1; - strncat(serial, dev_scsi->model, MODEL_LENGTH); - ind = strlen(serial) - 1; - ind++; + ind = strlen(serial); /* * This is not a complete check, since we are using strncat/cpy @@ -773,7 +770,7 @@ static int do_scsi_page80_inquiry(struct udev *udev, len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; if (max_len < len) { info(udev, "%s: length %d too short - need %d\n", - dev_scsi->kernel, max_len, len); + dev_scsi->kernel, max_len, len); return 1; } /* -- cgit v1.2.3-54-g00ecf From fed0ad76941e8021ba1a7d88f7a8ca9d89c99016 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Jun 2009 02:58:12 +0200 Subject: ata_id: sync ID_SERIAL(_SHORT) with other *_id tools ID_SERIAL is the full serial number used for the links, ID_SERIAL_SHORT is the device serial number. --- extras/ata_id/ata_id.c | 5 +++-- rules/rules.d/60-persistent-storage.rules | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index d976467817..9644a45b19 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -149,11 +149,12 @@ int main(int argc, char *argv[]) } else { printf("ID_TYPE=disk\n"); } + printf("ID_BUS=ata\n"); printf("ID_MODEL=%s\n", model); printf("ID_MODEL_ENC=%s\n", model_enc); - printf("ID_SERIAL=%s\n", serial); printf("ID_REVISION=%s\n", revision); - printf("ID_BUS=ata\n"); + printf("ID_SERIAL=%s_%s\n", model, serial); + printf("ID_SERIAL_SHORT=%s\n", serial); } else { if (serial[0] != '\0') printf("%s_%s\n", model, serial); diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 6688a3958e..7a9d078ec8 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -24,8 +24,8 @@ ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" # by-id (hardware serial number) KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_MODEL}_$env{ID_SERIAL}-part%n" +KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}" +KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}-part%n" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" -- cgit v1.2.3-54-g00ecf From 8bbe3ca4277a7bf8411caf091cd001ca48131b63 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Jun 2009 02:59:48 +0200 Subject: rules: make ata_id properties the default for all ATA block devices We need to call ata_id as the default for libata sd* devices. We want ID_BUS=ata, and the ATA device proeprties, and be independent of the SCSI emulation with the truncated values. The links in /dev/disk/by-id/{ata-*,scsi-*} are still the same. --- TODO | 1 - rules/rules.d/60-persistent-storage.rules | 12 +++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 6506622a85..c6576fdaf0 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,3 @@ - o cleanup ATA handling - kill ATA_COMPAT and calls of ata_id/scsi_id o enumerate: sort control* after pcm* o add tests for kernel provided DEVNAME logic diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 7a9d078ec8..64e9578904 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -27,7 +27,13 @@ KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}" KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}-part%n" +# USB devices use their own serial number KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +# ATA devices with their own "ata" kernel subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" +# ATA devices using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" +# scsi devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" @@ -37,9 +43,9 @@ KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+= KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" -# libata compat (ata-* links, like old hd* devices did create) -KERNEL=="sd*[!0-9]", ENV{ID_VENDOR}=="ATA", PROGRAM="ata_id $tempnode", RESULT=="?*", ENV{ID_ATA_COMPAT}="$result", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}" -KERNEL=="sd*[0-9]", ENV{ID_ATA_COMPAT}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_ATA_COMPAT}-part%n" +# scsi compat links for ATA devices +KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d$tempnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" +KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -- cgit v1.2.3-54-g00ecf From 84875aa6b3cb6e3a69f42286fe30aad704dc6399 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Jun 2009 03:01:31 +0200 Subject: scsi_id: delete no longer needed config file --- extras/scsi_id/Makefile.am | 3 --- extras/scsi_id/scsi_id.8 | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index 2ae49e3c54..641a340ddb 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -14,9 +14,6 @@ scsi_id_SOURCES = \ ../../libudev/libudev-list.c \ ../../libudev/libudev-util.c -dist_sysconf_DATA = \ - scsi_id.config - dist_man_MANS = \ scsi_id.8 diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index e133b7e63f..0221b98831 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -104,7 +104,10 @@ Display version number and exit. .ft .TP \fI/etc/scsi_id.config\fP -configuration and black/white list entries +Configuration of black/white list entries and per device options: +# one config per line, short match strings match longer strings +# vendor=string[,model=string],options= +vendor="ATA",options=-p 0x80 .RE .fi .LP -- cgit v1.2.3-54-g00ecf From d5f1cc16ec5a98cd36474f1efebc0d352b3c03d9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Jun 2009 17:09:57 +0200 Subject: update NEWS --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 8838d93a38..df770f44f0 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,12 @@ udev 144 ======== +Bugfixes. + +ATA devices switched the property from ID_BUS=scsi to ID_BUS=ata. + +Properties set with ENV{.FOO}="bar" are marked private by starting the +name with a '.'. They will not be stored in the database, and not be +exported with the event. udev 143 ======== -- cgit v1.2.3-54-g00ecf From f045aa1cabab0ea0c3c3a6ee45cc9013a36c35b1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Jun 2009 17:10:04 +0200 Subject: man: udev - add private properties like ENV{.FOO}="bar" --- udev/udev.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index cd4884d3b5..934fe628ae 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -323,7 +323,8 @@ - Set a device property value. + Set a device property value. Property names with a leading '.' + are not stored in the database or exported to external tool or events. -- cgit v1.2.3-54-g00ecf From f0fb82d821a9b1c078d98fb283f20ee359d756ab Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Wed, 1 Jul 2009 21:41:43 +0200 Subject: rules: set group ownership of new firewire driver device files The newer firewire-core driver exposes per-device character device files, called /dev/fw[0-9]*, in contrast to the older raw1394, video1394, dv1394 drivers which created one global file or per-controller files. This allows to set ownership, permissions, or/ and access control lists for each device file based on device type markers obtained from sysfs. The "units" attribute which is used for this purpose has become available in Linux 2.6.31(-rc1) by commit 0210b66dd88a2a1e451901b00378a2068b6ccb35. The added rules match identifiers of - IIDC devices: industrial cameras and some webcams, - AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and similar devices. Signed-off-by: Stefan Richter --- rules/rules.d/50-udev-default.rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index f19fb63afb..fb8b1302c2 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -43,9 +43,12 @@ SUBSYSTEM=="drm", GROUP="video" # DVB (video) SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}", GROUP="video" -# Firewire +# FireWire (dv1394 and video1394 drivers) KERNEL=="dv1394-[0-9]*", NAME="dv1394/%n", GROUP="video" KERNEL=="video1394-[0-9]*", NAME="video1394/%n", GROUP="video" +# FireWire (firewire-core driver: IIDC devices, AV/C devices) +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="video" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" # libusb device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0664" -- cgit v1.2.3-54-g00ecf From 25688f4d67d452192c1cc6b201c29dab0f2b8ab8 Mon Sep 17 00:00:00 2001 From: Jon Masters Date: Wed, 1 Jul 2009 20:21:03 -0400 Subject: firmware: search for third party or sysadmin supplied firmware updates We currently search /lib/firmware and /lib/firmware/`uname -r` for firmware files for device drivers loaded by the currently running kernel. These are often packaged by distributions as a subpackage of the kernel or as a separate package containing firmware. But these files cannot easily be updated by third parties or sysadmins independently of that package. This patch causes udev to also look for firmware files in an "updates" directory, which is almost identical in purpose to the module-init-tools "updates" directories insomuch as local changes can go in here and will take preference over firmware supplied by any distribution. --- extras/firmware/firmware.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/firmware/firmware.sh b/extras/firmware/firmware.sh index eececa85a1..9d4659a34d 100755 --- a/extras/firmware/firmware.sh +++ b/extras/firmware/firmware.sh @@ -1,6 +1,7 @@ #!/bin/sh -e -FIRMWARE_DIRS="/lib/firmware/$(uname -r) /lib/firmware" +FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \ + /lib/firmware/$(uname -r) /lib/firmware" err() { echo "$@" >&2 -- cgit v1.2.3-54-g00ecf From 456719b6f941d917e7c9444fa6149f35a188d785 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 2 Jul 2009 22:56:19 +0200 Subject: udevadm: test - print list of properties --- libudev/libudev-device.c | 2 +- udev/udevadm-test.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 951f78aa5c..7644e6c63d 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -961,7 +961,7 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) * @udev_device: udev device * @sysattr: attribute name * - * The retrieved value is cached in the device. Repeated reads will return the same + * The retrieved value is cached in the device. Repeated calls will return the same * value and not open the attribute again. * * Returns: the content of a sys attribute file, or #NULL if there is no sys attribute value. diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index e49d52c5f1..6c5710380e 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -38,6 +38,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) struct udev_event *event; struct udev_device *dev; struct udev_rules *rules = NULL; + struct udev_list_entry *entry; int err; int rc = 0; @@ -115,9 +116,10 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) if (udev_device_get_event_timeout(dev) >= 0) info(udev, "custom event timeout: %i\n", udev_device_get_event_timeout(dev)); - if (err == 0 && !event->ignore_device && udev_get_run(udev)) { - struct udev_list_entry *entry; + udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) + info(udev, "%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); + if (err == 0 && !event->ignore_device && udev_get_run(udev)) { udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; -- cgit v1.2.3-54-g00ecf From 84176f979f487392de9a7f01e804e72669cf5590 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 3 Jul 2009 14:57:43 +0200 Subject: extras/udev-acl: add smartcard readers gnupg, psc-lite, etc. will ship udev rules for supported smartcard readers soon. Add the ACL management bit. Thanks to Michael Bienia! --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 26b805565a..f41bb66f7f 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -41,6 +41,9 @@ SUBSYSTEM=="drm", KERNEL=="card*", ENV{ACL_MANAGE}="1" # KVM SUBSYSTEM=="misc", KERNEL=="kvm", ENV{ACL_MANAGE}="1" +# smart-card readers +ENV{ID_SMARTCARD_READER}=="*?", ENV{ACL_MANAGE}="1" + # apply ACL for all locally logged in users LABEL="acl_apply", ENV{ACL_MANAGE}=="?*", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" -- cgit v1.2.3-54-g00ecf From fc8933f7f65d52d91f502dae778609242cdf3492 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Jul 2009 18:38:45 +0200 Subject: build: do not delete .la files --- extras/gudev/Makefile.am | 3 --- libudev/Makefile.am | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/extras/gudev/Makefile.am b/extras/gudev/Makefile.am index dcfc2bdcf3..71565e2a48 100644 --- a/extras/gudev/Makefile.am +++ b/extras/gudev/Makefile.am @@ -113,6 +113,3 @@ EXTRA_DIST += GUdev-1.0.gir CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # ENABLE_INTROSPECTION - -install-data-hook: - rm -f $(DESTDIR)$(libdir)/libgudev-1.0.la diff --git a/libudev/Makefile.am b/libudev/Makefile.am index 220cff0e58..cae12b1043 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -44,12 +44,11 @@ EXTRA_DIST = \ # move lib from $(libdir) to $(rootlibdir) and update devel link, if needed install-data-hook: - rm -f $(DESTDIR)$(libdir)/libudev.la if test "$(libdir)" != "$(rootlibdir)"; then \ - mkdir -p $(DESTDIR)$(rootlibdir); \ - so_img_name=$$(readlink $(DESTDIR)$(libdir)/libudev.so); \ - so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g'); \ - ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so; \ + mkdir -p $(DESTDIR)$(rootlibdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libudev.so) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so && \ mv $(DESTDIR)$(libdir)/libudev.so.* $(DESTDIR)$(rootlibdir); \ fi -- cgit v1.2.3-54-g00ecf From 9cc94b15223d158ad618a9b05210a7eb8f748007 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Jul 2009 18:40:38 +0200 Subject: libudev: monitor - handle kernel supplied DEVNAME properly --- libudev/Makefile.am | 2 +- libudev/libudev-device.c | 1 + libudev/libudev-monitor.c | 14 ++++++-------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/libudev/Makefile.am b/libudev/Makefile.am index cae12b1043..b50eac9628 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -29,7 +29,7 @@ libudev_la_SOURCES =\ libudev-queue.c LT_CURRENT=4 -LT_REVISION=0 +LT_REVISION=1 LT_AGE=4 libudev_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 7644e6c63d..cbbddaeff0 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1299,6 +1299,7 @@ int udev_device_set_knodename(struct udev_device *udev_device, const char *knode udev_device->knodename = strdup(knodename); if (udev_device->knodename == NULL) return -ENOMEM; + udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename); return 0; } diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index e8cdd30a16..2c6c685c6b 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -504,7 +504,6 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito int action_set = 0; int maj = 0; int min = 0; - int is_kernel = 0; retry: if (udev_monitor == NULL) @@ -545,10 +544,10 @@ retry: } } else if (snl.nl_groups == UDEV_MONITOR_KERNEL) { if (snl.nl_pid > 0) { - info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", snl.nl_pid); + info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", + snl.nl_pid); return NULL; } - is_kernel = 1; } } @@ -590,9 +589,8 @@ retry: } udev_device = udev_device_new(udev_monitor->udev); - if (udev_device == NULL) { + if (udev_device == NULL) return NULL; - } while (bufpos < buflen) { char *key; @@ -616,10 +614,10 @@ retry: } else if (strncmp(key, "DEVTYPE=", 8) == 0) { udev_device_set_devtype(udev_device, &key[8]); } else if (strncmp(key, "DEVNAME=", 8) == 0) { - if (is_kernel) - udev_device_set_knodename(udev_device, &key[8]); - else + if (key[8] == '/') udev_device_set_devnode(udev_device, &key[8]); + else + udev_device_set_knodename(udev_device, &key[8]); } else if (strncmp(key, "DEVLINKS=", 9) == 0) { char devlinks[UTIL_PATH_SIZE]; char *slink; -- cgit v1.2.3-54-g00ecf From 15106c483315faf737f560e833c2d3440af529ee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 4 Jul 2009 16:59:35 +0200 Subject: update NEWS --- NEWS | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index df770f44f0..7748aeaddb 100644 --- a/NEWS +++ b/NEWS @@ -2,12 +2,20 @@ udev 144 ======== Bugfixes. -ATA devices switched the property from ID_BUS=scsi to ID_BUS=ata. - Properties set with ENV{.FOO}="bar" are marked private by starting the name with a '.'. They will not be stored in the database, and not be exported with the event. +Firmware files are looked up in: + /lib/firmware/updates/$(uname -r) + /lib/firmware/updates + /lib/firmware/$(uname -r) + /lib/firmware" +now. + +ATA devices switched the property from ID_BUS=scsi to ID_BUS=ata. +ata_id, instead of scsi_id, is the default tool now for ATA devices. + udev 143 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 182c9b158495b55212651ed5e57d0d486a6ba781 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 5 Jul 2009 23:56:24 +0200 Subject: build: add *exec* to the internal rootlibdir name Automake like variables with *exec* in the directory names, to decide, that it isn't *data*: http://www.gnu.org/software/hello/manual/automake/The-Two-Parts-of-Install.html#The-Two-Parts-of-Install --- configure.ac | 4 ++-- libudev/Makefile.am | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 498c4c9ab9..96c10f7a62 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_ARG_WITH([rootlibdir], AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), [], [with_rootlibdir=$libdir]) -AC_SUBST([rootlibdir], [$with_rootlibdir]) +AC_SUBST([rootlib_execdir], [$with_rootlibdir]) AC_ARG_WITH([selinux], AS_HELP_STRING([--with-selinux], [enable SELinux support]), @@ -142,7 +142,7 @@ AC_MSG_RESULT([ sysconfdir: ${sysconfdir} sbindir: ${sbindir} libdir: ${libdir} - rootlibdir: ${rootlibdir} + rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} datarootdir: ${datarootdir} diff --git a/libudev/Makefile.am b/libudev/Makefile.am index b50eac9628..3ed05a31e3 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -42,15 +42,15 @@ pkgconfig_DATA = \ EXTRA_DIST = \ exported_symbols -# move lib from $(libdir) to $(rootlibdir) and update devel link, if needed -install-data-hook: - if test "$(libdir)" != "$(rootlibdir)"; then \ - mkdir -p $(DESTDIR)$(rootlibdir) && \ +# move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed +install-exec-hook: + if test "$(libdir)" != "$(rootlib_execdir)"; then \ + mkdir -p $(DESTDIR)$(rootlib_execdir) && \ so_img_name=$$(readlink $(DESTDIR)$(libdir)/libudev.so) && \ so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ - ln -sf $$so_img_rel_target_prefix$(rootlibdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so && \ - mv $(DESTDIR)$(libdir)/libudev.so.* $(DESTDIR)$(rootlibdir); \ + ln -sf $$so_img_rel_target_prefix$(rootlib_execdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so && \ + mv $(DESTDIR)$(libdir)/libudev.so.* $(DESTDIR)$(rootlib_execdir); \ fi uninstall-hook: - rm -f $(DESTDIR)$(rootlibdir)/libudev.so* + rm -f $(DESTDIR)$(rootlib_execdir)/libudev.so* -- cgit v1.2.3-54-g00ecf From 739ce84bfae2734e741a7fe94d4fa8af4903c050 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 6 Jul 2009 00:52:56 +0200 Subject: release 144 --- ChangeLog | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2d258f6b39..39e898cf50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,38 @@ +Summary of changes from v143 to v144 +============================================ + +Jon Masters (1): + firmware: search for third party or sysadmin supplied firmware updates + +Kay Sievers (19): + configure.ac: add AM_SILENT_RULES + configure.ac: version bump + TODO: add cleanup of ATA_COMPAT + libudev: queue - add comments for queue format + udev/.gitignore: add udev.pc + configure.ac: version bump + do not exports properties starting with a '.' + scsi_id: --reformat_serial - use udev_util_replace_whitespace() + ata_id: sync ID_SERIAL(_SHORT) with other *_id tools + rules: make ata_id properties the default for all ATA block devices + scsi_id: delete no longer needed config file + update NEWS + man: udev - add private properties like ENV{.FOO}="bar" + Merge branch 'firmware' of git://git.kernel.org/pub/scm/linux/kernel/git/jcm/udev-jcm + udevadm: test - print list of properties + build: do not delete .la files + libudev: monitor - handle kernel supplied DEVNAME properly + update NEWS + build: add *exec* to the internal rootlibdir name + +Martin Pitt (2): + hid2hci: narrow matches to real HCI devices + extras/udev-acl: add smartcard readers + +Stefan Richter (1): + rules: set group ownership of new firewire driver device files + + Summary of changes from v142 to v143 ============================================ -- cgit v1.2.3-54-g00ecf From c3eedf65671ea82704e68e4b69796d7067170815 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Mon, 6 Jul 2009 14:54:52 +0100 Subject: scsi_id: correct error handling in prepend_vendor_model The callers of prepend_vendor_model both expect < 0 to be returned on error and the index to be returned otherwise. However prepend_vendor_model actually returns 1 on error. Fix this by correctly returning -1. Older kernels (before e5b3cd42: "SCSI: sanitize INQUIRY strings") truncated the model field in sysfs (or propagated bad results from the target) to less than the expected/required 16 characters which meant that the SCSI id was mangled into: # /sbin/scsi_id -g -s /block/sdg S146cee20VIRTUAL-DISK when it should have been: # /sbin/scsi_id -g -s /block/sdg SIET VIRTUAL-DISK 146cee20 Notice how the serial number has been pasted over the vendor+model at index 1 instead of being added at the end. In the former case: # cat /sys/devices/platform/host5/session1/target5:0:0/5:0:0:1/model | od -t c -t x1 0000000 V I R T U A L - D I S K \n 56 49 52 54 55 41 4c 2d 44 49 53 4b 0a But it should have been: # cat /sys/devices/platform/host5/session1/target5:0:0/5:0:0:1/model | od -t c -t x1 0000000 V I R T U A L - D I S K 56 49 52 54 55 41 4c 2d 44 49 53 4b 20 20 20 20 0000020 \n 0a Signed-off-by: Ian Campbell --- extras/scsi_id/scsi_serial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 68bed08241..4248829180 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -467,7 +467,7 @@ static int prepend_vendor_model(struct udev *udev, if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { info(udev, "%s: expected length %d, got length %d\n", dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); - return 1; + return -1; } return ind; } -- cgit v1.2.3-54-g00ecf From e4c02c1ca68d74d040f5bb8cb0c0c244dd8adc71 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Jul 2009 09:48:23 +0200 Subject: README: add CONFIG_BLK_DEV_BSG --- README | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README b/README index b4c0ee051f..591e03a057 100644 --- a/README +++ b/README @@ -22,9 +22,10 @@ Requirements: CONFIG_SYSFS_DEPRECATED*=n CONFIG_PROC_FS=y CONFIG_TMPFS=y - CONFIG_TMPFS_POSIX_ACL=y CONFIG_INOTIFY=y CONFIG_SIGNALFD=y + CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes) + CONFIG_BLK_DEV_BSG=y (SCSI tape devices) - For reliable operation, the kernel must not use the CONFIG_SYSFS_DEPRECATED* option. -- cgit v1.2.3-54-g00ecf From 257bb4cdac76c00be6e17b0b656df0a2d7ee7b4d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Jul 2009 19:30:19 +0200 Subject: use MIN() MAX() from param.h --- libudev/libudev-private.h | 1 - libudev/libudev-util-private.c | 3 ++- udev/udevadm-monitor.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 5c10b4e37a..16f9f2e1c1 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -16,7 +16,6 @@ #include "libudev.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#define UDEV_MAX(a,b) ((a) > (b) ? (a) : (b)) #define READ_END 0 #define WRITE_END 1 diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 811db9cf39..1a37490a9e 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "libudev.h" #include "libudev-private.h" @@ -356,7 +357,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp, FD_SET(outpipe[READ_END], &readfds); if (errpipe[READ_END] > 0) FD_SET(errpipe[READ_END], &readfds); - fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); + fdcount = select(MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno == EINTR) continue; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 73516069ba..df1459ae17 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -204,7 +204,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) if (udev_monitor != NULL) FD_SET(udev_monitor_get_fd(udev_monitor), &readfds); - fdcount = select(UDEV_MAX(udev_monitor_get_fd(kernel_monitor), udev_monitor_get_fd(udev_monitor))+1, + fdcount = select(MAX(udev_monitor_get_fd(kernel_monitor), udev_monitor_get_fd(udev_monitor))+1, &readfds, NULL, NULL, NULL); if (fdcount < 0) { if (errno != EINTR) -- cgit v1.2.3-54-g00ecf From 804ab68550c5779a0a27b1ad2636184520f2a1cb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Jul 2009 02:02:02 +0200 Subject: configure.ac: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7748aeaddb..2ce846b586 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 145 +======== +Bugfixes. + udev 144 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 96c10f7a62..69c115dba9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [144], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [145], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From a71369b0db359cddeb207a317588b175630dcca8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Jul 2009 02:02:40 +0200 Subject: libudev: device - free values before updating them --- libudev/libudev-device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index cbbddaeff0..9d1e546c83 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1282,6 +1282,7 @@ const char *udev_device_get_devpath_old(struct udev_device *udev_device) int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) { + free(udev_device->devpath_old); udev_device->devpath_old = strdup(devpath_old); if (udev_device->devpath_old == NULL) return -ENOMEM; @@ -1296,6 +1297,7 @@ const char *udev_device_get_knodename(struct udev_device *udev_device) int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename) { + free(udev_device->knodename); udev_device->knodename = strdup(knodename); if (udev_device->knodename == NULL) return -ENOMEM; -- cgit v1.2.3-54-g00ecf From 871a36bd7e37a9d27e633b93ae0119a4553195ec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Jul 2009 02:04:49 +0200 Subject: libudev: enumerate - sort with qsort() On machines with many thousands of devices: $ time find /sys -name uevent | wc -l 74876 real 0m33.171s user 0m3.329s sys 0m29.719s the current udevtrigger spends minutes sorting the device list: $ time /sbin/udevadm trigger --dry-run real 4m56.739s user 4m45.743s sys 0m7.862s with qsort() it looks better: $ time udev/udevadm trigger --dry-run real 0m6.495s user 0m0.473s sys 0m5.923s --- libudev/Makefile.am | 2 +- libudev/libudev-enumerate.c | 196 ++++++++++++++++++++++++++++++-------------- libudev/test-libudev.c | 20 +++++ 3 files changed, 156 insertions(+), 62 deletions(-) diff --git a/libudev/Makefile.am b/libudev/Makefile.am index 3ed05a31e3..866a5ca135 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -29,7 +29,7 @@ libudev_la_SOURCES =\ libudev-queue.c LT_CURRENT=4 -LT_REVISION=1 +LT_REVISION=2 LT_AGE=4 libudev_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 31e8e2e4f5..db8c51404f 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -17,13 +17,13 @@ #include #include #include +#include #include +#include #include "libudev.h" #include "libudev-private.h" -static int devices_sort(struct udev_enumerate *udev_enumerate); - /** * SECTION:libudev-enumerate * @short_description: lookup and sort sys devices @@ -32,6 +32,11 @@ static int devices_sort(struct udev_enumerate *udev_enumerate); * and return a sorted list of devices. */ +struct syspath { + char *syspath; + size_t len; +}; + /** * udev_enumerate: * @@ -46,7 +51,10 @@ struct udev_enumerate { struct udev_list_node subsystem_nomatch_list; struct udev_list_node properties_match_list; struct udev_list_node devices_list; - int devices_sorted; + struct syspath *devices; + unsigned int devices_cur; + unsigned int devices_max; + bool devices_uptodate:1; }; /** @@ -64,12 +72,12 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) return NULL; udev_enumerate->refcount = 1; udev_enumerate->udev = udev; - udev_list_init(&udev_enumerate->devices_list); udev_list_init(&udev_enumerate->sysattr_match_list); udev_list_init(&udev_enumerate->sysattr_nomatch_list); udev_list_init(&udev_enumerate->subsystem_match_list); udev_list_init(&udev_enumerate->subsystem_nomatch_list); udev_list_init(&udev_enumerate->properties_match_list); + udev_list_init(&udev_enumerate->devices_list); return udev_enumerate; } @@ -98,17 +106,22 @@ struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) **/ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) { + unsigned int i; + if (udev_enumerate == NULL) return; udev_enumerate->refcount--; if (udev_enumerate->refcount > 0) return; - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_nomatch_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->properties_match_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); + for (i = 0; i < udev_enumerate->devices_cur; i++) + free(udev_enumerate->devices[i].syspath); + free(udev_enumerate->devices); free(udev_enumerate); } @@ -125,6 +138,75 @@ struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) return udev_enumerate->udev; } +static int syspath_add(struct udev_enumerate *udev_enumerate, const char *syspath) +{ + char *path; + struct syspath *entry; + + /* double array size if needed */ + if (udev_enumerate->devices_cur >= udev_enumerate->devices_max) { + struct syspath *buf; + unsigned int add; + + add = udev_enumerate->devices_max; + if (add < 1024) + add = 1024; + buf = realloc(udev_enumerate->devices, (udev_enumerate->devices_max + add) * sizeof(struct syspath)); + if (buf == NULL) + return -ENOMEM; + udev_enumerate->devices = buf; + udev_enumerate->devices_max += add; + } + + path = strdup(syspath); + if (path == NULL) + return -ENOMEM; + entry = &udev_enumerate->devices[udev_enumerate->devices_cur]; + entry->syspath = path; + entry->len = strlen(path); + udev_enumerate->devices_cur++; + udev_enumerate->devices_uptodate = false; + return 0; +} + +static int syspath_cmp(const void *p1, const void *p2) +{ + const struct syspath *path1 = p1; + const struct syspath *path2 = p2; + size_t len; + int ret; + + len = MIN(path1->len, path2->len); + ret = memcmp(path1->syspath, path2->syspath, len); + if (ret == 0) { + if (path1->len < path2->len) + ret = -1; + else if (path1->len > path2->len) + ret = 1; + } + return ret; +} + +static int devices_delay(struct udev *udev, const char *syspath) +{ + static const char *delay_device_list[] = { + "/block/md", + "/block/dm-", + NULL + }; + size_t len; + int i; + + len = strlen(udev_get_sys_path(udev)); + for (i = 0; delay_device_list[i] != NULL; i++) { + if (strstr(&syspath[len], delay_device_list[i]) != NULL) { + dbg(udev, "delaying: %s\n", syspath); + return 1; + } + } + return 0; +} + /** * udev_enumerate_get_list_entry: * @udev_enumerate: context @@ -135,8 +217,46 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude { if (udev_enumerate == NULL) return NULL; - if (!udev_enumerate->devices_sorted) - devices_sort(udev_enumerate); + if (!udev_enumerate->devices_uptodate) { + unsigned int i; + unsigned int max; + struct syspath *prev = NULL; + + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); + qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); + + max = udev_enumerate->devices_cur; + for (i = 0; i < max; i++) { + struct syspath *entry = &udev_enumerate->devices[i]; + + /* skip duplicated entries */ + if (prev != NULL && + entry->len == prev->len && + memcmp(entry->syspath, prev->syspath, entry->len) == 0) + continue; + prev = entry; + + /* skip to be delayed devices, and add them to the end of the list */ + if (devices_delay(udev_enumerate->udev, entry->syspath)) { + syspath_add(udev_enumerate, entry->syspath); + continue; + } + + udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, + entry->syspath, NULL, 0, 0); + } + /* add and cleanup delayed devices from end of list */ + for (i = max; i < udev_enumerate->devices_cur; i++) { + struct syspath *entry = &udev_enumerate->devices[i]; + + udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, + entry->syspath, NULL, 0, 0); + free(entry->syspath); + } + udev_enumerate->devices_cur = max; + + udev_enumerate->devices_uptodate = true; + } return udev_list_get_entry(&udev_enumerate->devices_list); } @@ -222,7 +342,7 @@ static int match_sysattr_value(struct udev *udev, const char *syspath, const cha { struct udev_device *device; const char *val = NULL; - int match = 0; + bool match = false; device = udev_device_new_from_syspath(udev, syspath); if (device == NULL) @@ -231,11 +351,11 @@ static int match_sysattr_value(struct udev *udev, const char *syspath, const cha if (val == NULL) goto exit; if (match_val == NULL) { - match = 1; + match = true; goto exit; } if (fnmatch(match_val, val, 0) == 0) { - match = 1; + match = true; goto exit; } exit: @@ -293,7 +413,7 @@ static int match_property(struct udev_enumerate *udev_enumerate, const char *sys { struct udev_device *dev; struct udev_list_entry *list_entry; - int match = 0; + int match = false; /* no match always matches */ if (udev_list_get_entry(&udev_enumerate->properties_match_list) == NULL) @@ -318,13 +438,13 @@ static int match_property(struct udev_enumerate *udev_enumerate, const char *sys if (fnmatch(match_key, dev_key, 0) != 0) continue; if (match_value == NULL && dev_value == NULL) { - match = 1; + match = true; goto out; } if (match_value == NULL || dev_value == NULL) continue; if (fnmatch(match_value, dev_value, 0) == 0) { - match = 1; + match = true; goto out; } } @@ -375,7 +495,7 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, continue; if (!match_property(udev_enumerate, syspath)) continue; - udev_list_entry_add(udev, &udev_enumerate->devices_list, syspath, NULL, 1, 1); + syspath_add(udev_enumerate, syspath); } closedir(dir); return 0; @@ -422,50 +542,6 @@ static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, return 0; } -static int devices_delay(struct udev *udev, const char *syspath) -{ - static const char *delay_device_list[] = { - "/block/md", - "/block/dm-", - NULL - }; - size_t len; - int i; - - len = strlen(udev_get_sys_path(udev)); - for (i = 0; delay_device_list[i] != NULL; i++) { - if (strstr(&syspath[len], delay_device_list[i]) != NULL) { - dbg(udev, "delaying: %s\n", syspath); - return 1; - } - } - return 0; -} - -/* sort delayed devices to the end of the list */ -static int devices_sort(struct udev_enumerate *udev_enumerate) -{ - struct udev_list_entry *entry_loop; - struct udev_list_entry *entry_tmp; - struct udev_list_node devices_list; - - udev_list_init(&devices_list); - /* move delayed to delay list */ - udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(&udev_enumerate->devices_list)) { - if (devices_delay(udev_enumerate->udev, udev_list_entry_get_name(entry_loop))) { - udev_list_entry_remove(entry_loop); - udev_list_entry_append(entry_loop, &devices_list); - } - } - /* move delayed back to end of list */ - udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(&devices_list)) { - udev_list_entry_remove(entry_loop); - udev_list_entry_append(entry_loop, &udev_enumerate->devices_list); - } - udev_enumerate->devices_sorted = 1; - return 0; -} - /** * udev_enumerate_add_syspath: * @udev_enumerate: context @@ -477,7 +553,6 @@ static int devices_sort(struct udev_enumerate *udev_enumerate) */ int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) { - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); struct udev_device *udev_device; if (udev_enumerate == NULL) @@ -488,8 +563,7 @@ int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char udev_device = udev_device_new_from_syspath(udev_enumerate->udev, syspath); if (udev_device == NULL) return -EINVAL; - udev_list_entry_add(udev, &udev_enumerate->devices_list, - udev_device_get_syspath(udev_device), NULL, 1, 1); + syspath_add(udev_enumerate, udev_device_get_syspath(udev_device)); udev_device_unref(udev_device); return 0; } diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index db08d4845f..34b3de86f1 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -329,6 +329,26 @@ static int test_enumerate(struct udev *udev, const char *subsystem) test_enumerate_print_list(udev_enumerate); udev_enumerate_unref(udev_enumerate); + printf("enumerate 'net' + duplicated scan + null + zero\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, "net"); + udev_enumerate_scan_devices(udev_enumerate); + udev_enumerate_scan_devices(udev_enumerate); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + printf("enumerate 'block'\n"); udev_enumerate = udev_enumerate_new(udev); if (udev_enumerate == NULL) -- cgit v1.2.3-54-g00ecf From a073cfa844e04010a2695f309b273c906ada271a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Jul 2009 14:13:20 +0200 Subject: udevd: detach event from worker if we kill a worker Jul 8 09:36:41 udevd[663]: worker [5491] did not accept message, kill it Jul 8 09:36:41 udevd[663]: worker [5491] unexpectedly returned with 0 Jul 8 09:36:41 udevd[663]: worker [5551] unexpectedly returned with 0 Jul 8 09:36:41 kernel: [ 156.832086] <6>udevd[663]: segfault at 4 ip 00959fbc sp bfbe7b78 error 6 in udevd[94f000+1c000] https://bugs.launchpad.net/ubuntu/+source/udev/+bug/396957 --- udev/udevd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index b2e4a022c5..cfb8823f4c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -328,8 +328,9 @@ static void event_run(struct event *event) event->state = EVENT_RUNNING; count = udev_monitor_send_device(monitor, worker->monitor, event->dev); if (count < 0) { - err(event->udev, "worker [%u] did not accept message, kill it\n", worker->pid); event->state = EVENT_QUEUED; + worker->event = NULL; + err(event->udev, "worker [%u] did not accept message %zi (%m), kill it\n", worker->pid, count); worker->state = WORKER_KILLED; kill(worker->pid, SIGKILL); continue; @@ -521,6 +522,9 @@ static void worker_returned(void) if (worker->pid != msg.pid) continue; + if (worker->state != WORKER_RUNNING) + break; + /* worker returned */ worker->event->exitcode = msg.exitcode; event_queue_delete(worker->event); -- cgit v1.2.3-54-g00ecf From 405c307a72af520a8aba5609112a8c3a2b8a42a3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 8 Jul 2009 17:05:55 +0200 Subject: udevadm: info - add space after R:, A:, W: on database export kay: udevadmin info -e prints all lines with a space after the :, but the W: line zzam: yeah, seems so, and the R: and the A: yeah --- udev/udevadm-info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index fa09b98299..88bb0d401f 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -144,15 +144,15 @@ static void print_record(struct udev_device *device) i = udev_device_get_num_fake_partitions(device); if (i != 0) - printf("A:%u\n", i); + printf("A: %u\n", i); i = udev_device_get_ignore_remove(device); if (i != 0) - printf("R:%u\n", i); + printf("R: %u\n", i); i = udev_device_get_watch_handle(device); if (i >= 0) - printf("W:%u\n", i); + printf("W: %u\n", i); udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { len = strlen(udev_get_dev_path(udev_device_get_udev(device))); -- cgit v1.2.3-54-g00ecf From adda4c682ad2c56fc091222be3bd94fa817013b9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 11 Jul 2009 18:21:26 +0200 Subject: udevd: make sure a worker finishes event handling before exiting Persistent network rules write out new rules files. When rules change, we need to kill all workers to update the in-memory copy of the rules. We need to make sure, that a worker finshes its work for all device messages it has accepted, before it exits after a SIGTERM from the main process. --- libudev/libudev-util-private.c | 4 +-- udev/udevd.c | 76 +++++++++++++++++++++++------------------- 2 files changed, 43 insertions(+), 37 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 1a37490a9e..5f5f4c1d89 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -435,11 +435,11 @@ int util_run_program(struct udev *udev, const char *command, char **envp, } waitpid(pid, &status, 0); if (WIFEXITED(status)) { - info(udev, "'%s' returned with status %i\n", argv[0], WEXITSTATUS(status)); + info(udev, "'%s' returned with exitcode %i\n", command, WEXITSTATUS(status)); if (WEXITSTATUS(status) != 0) err = -1; } else { - err(udev, "'%s' abnormal exit\n", command); + err(udev, "'%s' unexpected exit with status 0x%04x\n", command, status); err = -1; } } diff --git a/udev/udevd.c b/udev/udevd.c index cfb8823f4c..876d2ec1df 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -205,8 +205,12 @@ static void worker_new(struct event *event) pid = fork(); switch (pid) { case 0: { - sigset_t mask; + sigset_t sigmask; struct udev_device *dev; + struct pollfd pmon = { + .fd = udev_monitor_get_fd(worker_monitor), + .events = POLLIN, + }; udev_queue_export_unref(udev_queue_export); udev_monitor_unref(monitor); @@ -225,11 +229,12 @@ static void worker_new(struct event *event) sigaction(SIGTERM, &act, NULL); sigaction(SIGALRM, &act, NULL); - /* unblock signals */ - sigfillset(&mask); - sigdelset(&mask, SIGTERM); - sigdelset(&mask, SIGALRM); - sigprocmask(SIG_SETMASK, &mask, NULL); + /* unblock SIGALRM */ + sigfillset(&sigmask); + sigdelset(&sigmask, SIGALRM); + sigprocmask(SIG_SETMASK, &sigmask, NULL); + /* SIGTERM is unblocked in ppoll() */ + sigdelset(&sigmask, SIGTERM); /* request TERM signal if parent exits */ prctl(PR_SET_PDEATHSIG, SIGTERM); @@ -237,7 +242,7 @@ static void worker_new(struct event *event) /* initial device */ dev = event->dev; - while (!worker_exit) { + do { struct udev_event *udev_event; struct worker_message msg; int err; @@ -272,20 +277,31 @@ static void worker_new(struct event *event) /* send processed event back to libudev listeners */ udev_monitor_send_device(worker_monitor, NULL, dev); - info(event->udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); - udev_device_unref(dev); - udev_event_unref(udev_event); - /* send back the result of the event execution */ msg.exitcode = err; msg.pid = getpid(); send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); - /* wait for more device messages from udevd */ - do - dev = udev_monitor_receive_device(worker_monitor); - while (!worker_exit && dev == NULL); - } + info(event->udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); + udev_event_unref(udev_event); + udev_device_unref(dev); + dev = NULL; + + /* wait for more device messages or signal from udevd */ + while (!worker_exit) { + int fdcount; + + fdcount = ppoll(&pmon, 1, NULL, &sigmask); + if (fdcount < 0) + continue; + + if (pmon.revents & POLLIN) { + dev = udev_monitor_receive_device(worker_monitor); + if (dev != NULL) + break; + } + } + } while (dev != NULL); udev_monitor_unref(worker_monitor); udev_log_close(); @@ -376,7 +392,7 @@ static void event_queue_insert(struct udev_device *dev) } } -static void worker_kill(int retain) +static void worker_kill(struct udev *udev, int retain) { struct udev_list_node *loop; int max; @@ -522,14 +538,12 @@ static void worker_returned(void) if (worker->pid != msg.pid) continue; - if (worker->state != WORKER_RUNNING) - break; - /* worker returned */ worker->event->exitcode = msg.exitcode; event_queue_delete(worker->event); worker->event = NULL; - worker->state = WORKER_IDLE; + if (worker->state != WORKER_KILLED) + worker->state = WORKER_IDLE; break; } } @@ -551,7 +565,7 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) if (i >= 0) { info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", i); udev_set_log_priority(udev, i); - worker_kill(0); + worker_kill(udev, 0); } if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) { @@ -593,7 +607,7 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) } free(key); } - worker_kill(0); + worker_kill(udev, 0); } i = udev_ctrl_get_set_max_childs(ctrl_msg); @@ -690,16 +704,8 @@ static void handle_signal(struct udev *udev, int signo) /* fail event, if worker died unexpectedly */ if (worker->event != NULL) { - int exitcode; - - if (WIFEXITED(status)) - exitcode = WEXITSTATUS(status); - else if (WIFSIGNALED(status)) - exitcode = WTERMSIG(status) + 128; - else - exitcode = 0; - worker->event->exitcode = exitcode; - err(udev, "worker [%u] unexpectedly returned with %i\n", pid, exitcode); + worker->event->exitcode = status; + err(udev, "worker [%u] unexpectedly returned with status 0x%04x\n", pid, status); event_queue_delete(worker->event); } @@ -999,7 +1005,7 @@ int main(int argc, char *argv[]) /* timeout - kill idle workers */ if (fdcount == 0) - worker_kill(2); + worker_kill(udev, 2); /* event has finished */ if (pfd[FD_WORKER].revents & POLLIN) @@ -1048,7 +1054,7 @@ int main(int argc, char *argv[]) if (reload_config) { struct udev_rules *rules_new; - worker_kill(0); + worker_kill(udev, 0); rules_new = udev_rules_new(udev, resolve_names); if (rules_new != NULL) { udev_rules_unref(rules); -- cgit v1.2.3-54-g00ecf From bc113de9a4dc1229f7533acd41310a56d60fbe7e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 13 Jul 2009 03:09:05 +0200 Subject: udevd: handle SIGCHLD before the worker event message We may need to handle SIGCHLD before the queued worker message. The last reference, from the SIGCHLD or the worker message will clean up the worker context. In case we receive an unexpected SIGCHLD with an error, we let the event fail and clean up the worker context. --- udev/udevd.c | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 876d2ec1df..14736366d0 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -128,6 +128,8 @@ enum worker_state { struct worker { struct udev_list_node node; + struct udev *udev; + int refcount; pid_t pid; struct udev_monitor *monitor; enum worker_state state; @@ -176,9 +178,22 @@ static void event_sig_handler(int signum) } } +static struct worker *worker_ref(struct worker *worker) +{ + worker->refcount++; + return worker; +} + static void worker_unref(struct worker *worker) { + worker->refcount--; + if (worker->refcount > 0) + return; + + udev_list_node_remove(&worker->node); udev_monitor_unref(worker->monitor); + childs--; + info(worker->udev, "worker [%u] cleaned up\n", worker->pid); free(worker); } @@ -201,6 +216,9 @@ static void worker_new(struct event *event) worker = calloc(1, sizeof(struct worker)); if (worker == NULL) return; + /* worker + event reference */ + worker->refcount = 2; + worker->udev = event->udev; pid = fork(); switch (pid) { @@ -339,18 +357,17 @@ static void event_run(struct event *event) if (worker->state != WORKER_IDLE) continue; - worker->event = event; - worker->state = WORKER_RUNNING; - event->state = EVENT_RUNNING; count = udev_monitor_send_device(monitor, worker->monitor, event->dev); if (count < 0) { - event->state = EVENT_QUEUED; - worker->event = NULL; err(event->udev, "worker [%u] did not accept message %zi (%m), kill it\n", worker->pid, count); - worker->state = WORKER_KILLED; kill(worker->pid, SIGKILL); + worker->state = WORKER_KILLED; continue; } + worker_ref(worker); + worker->event = event; + worker->state = WORKER_RUNNING; + event->state = EVENT_RUNNING; return; } @@ -544,6 +561,7 @@ static void worker_returned(void) worker->event = NULL; if (worker->state != WORKER_KILLED) worker->state = WORKER_IDLE; + worker_unref(worker); break; } } @@ -702,17 +720,18 @@ static void handle_signal(struct udev *udev, int signo) if (worker->pid != pid) continue; - /* fail event, if worker died unexpectedly */ - if (worker->event != NULL) { - worker->event->exitcode = status; + info(udev, "worker [%u] exit\n", pid); + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { err(udev, "worker [%u] unexpectedly returned with status 0x%04x\n", pid, status); - event_queue_delete(worker->event); + if (worker->event != NULL) { + err(udev, "worker [%u] failed while handling '%s'\n", pid, worker->event->devpath); + worker->event->exitcode = -32; + event_queue_delete(worker->event); + /* drop reference from running event */ + worker_unref(worker); + } } - - udev_list_node_remove(&worker->node); worker_unref(worker); - childs--; - info(udev, "worker [%u] exit\n", pid); break; } } -- cgit v1.2.3-54-g00ecf From c380472899872292883d294c7978c8f054b9d18a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 13 Jul 2009 03:33:15 +0200 Subject: udevd: use bool --- udev/udevd.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 14736366d0..2cdc18b41e 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,7 @@ #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 -static int debug; +static bool debug; static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, @@ -59,20 +60,20 @@ static void log_fn(struct udev *udev, int priority, } } -static int debug_trace; +static bool debug_trace; static struct udev_rules *rules; static struct udev_queue_export *udev_queue_export; static struct udev_ctrl *udev_ctrl; static struct udev_monitor *monitor; static int worker_watch[2]; static pid_t settle_pid; -static int stop_exec_queue; -static int reload_config; +static bool stop_exec_queue; +static bool reload_config; static int max_childs; static int childs; static struct udev_list_node event_list; static struct udev_list_node worker_list; -static int udev_exit; +static bool udev_exit; static volatile sig_atomic_t worker_exit; enum poll_fd { @@ -173,7 +174,7 @@ static void event_sig_handler(int signum) _exit(1); break; case SIGTERM: - worker_exit = 1; + worker_exit = true; break; } } @@ -588,17 +589,17 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) { info(udev, "udevd message (STOP_EXEC_QUEUE) received\n"); - stop_exec_queue = 1; + stop_exec_queue = true; } if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) { info(udev, "udevd message (START_EXEC_QUEUE) received\n"); - stop_exec_queue = 0; + stop_exec_queue = false; } if (udev_ctrl_get_reload_rules(ctrl_msg) > 0) { info(udev, "udevd message (RELOAD_RULES) received\n"); - reload_config = 1; + reload_config = true; } str = udev_ctrl_get_set_env(ctrl_msg); @@ -667,7 +668,7 @@ static int handle_inotify(struct udev *udev) ev = (struct inotify_event *)(buf + pos); if (ev->len) { dbg(udev, "inotify event: %x for %s\n", ev->mask, ev->name); - reload_config = 1; + reload_config = true; continue; } @@ -702,7 +703,7 @@ static void handle_signal(struct udev *udev, int signo) switch (signo) { case SIGINT: case SIGTERM: - udev_exit = 1; + udev_exit = true; break; case SIGCHLD: while (1) { @@ -737,7 +738,7 @@ static void handle_signal(struct udev *udev, int signo) } break; case SIGHUP: - reload_config = 1; + reload_config = true; break; } } @@ -775,7 +776,7 @@ int main(int argc, char *argv[]) int fd; sigset_t mask; const char *value; - int daemonize = 0; + int daemonize = false; int resolve_names = 1; static const struct option options[] = { { "daemon", no_argument, NULL, 'd' }, @@ -806,13 +807,13 @@ int main(int argc, char *argv[]) switch (option) { case 'd': - daemonize = 1; + daemonize = true; break; case 't': - debug_trace = 1; + debug_trace = true; break; case 'D': - debug = 1; + debug = true; if (udev_get_log_priority(udev) < LOG_INFO) udev_set_log_priority(udev, LOG_INFO); break; -- cgit v1.2.3-54-g00ecf From 3d66c90fc49652343107113bb712b72f06864e35 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 13 Jul 2009 12:19:01 +0200 Subject: release 145 --- ChangeLog | 19 +++++++++++++++++++ NEWS | 3 ++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 39e898cf50..0a806b1d0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +Summary of changes from v144 to v145 +============================================ + +Ian Campbell (1): + scsi_id: correct error handling in prepend_vendor_model + +Kay Sievers (10): + README: add CONFIG_BLK_DEV_BSG + use MIN() MAX() from param.h + configure.ac: version bump + libudev: device - free values before updating them + libudev: enumerate - sort with qsort() + udevd: detach event from worker if we kill a worker + udevadm: info - add space after R:, A:, W: on database export + udevd: make sure a worker finishes event handling before exiting + udevd: handle SIGCHLD before the worker event message + udevd: use bool + + Summary of changes from v143 to v144 ============================================ diff --git a/NEWS b/NEWS index 2ce846b586..1985d300d1 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ udev 145 ======== -Bugfixes. +Fix possible crash in udevd when worker processes are busy, rules are +changed at the same time, and workers get killed to reload the rules. udev 144 ======== -- cgit v1.2.3-54-g00ecf From ba1747585232f0f4bde664a2c0f96681f5e9b9cd Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 16 Jul 2009 11:23:16 +0200 Subject: add keymap for Clevo D410J laptop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reported as hal-info patch by Németh Márton on hal ML. --- extras/keymap/95-keymap.rules | 2 ++ extras/keymap/keymaps/via-K8N800 | 1 + 2 files changed, 3 insertions(+) create mode 100644 extras/keymap/keymaps/via-K8N800 diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 1a6321db1e..084227e9bd 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -76,4 +76,6 @@ ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+=" ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" +ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name via-K8N800" + LABEL="keyboard_end" diff --git a/extras/keymap/keymaps/via-K8N800 b/extras/keymap/keymaps/via-K8N800 new file mode 100644 index 0000000000..64e2781840 --- /dev/null +++ b/extras/keymap/keymaps/via-K8N800 @@ -0,0 +1 @@ +0x81 prog1 # Application launch -- cgit v1.2.3-54-g00ecf From 9528405c4ac1defb8dc48f2095d971c978de5bb1 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 16 Jul 2009 17:34:01 +0200 Subject: extras/keymap: add Zepto ZNote Reported on https://launchpad.net/bugs/400252 --- extras/keymap/95-keymap.rules | 2 ++ extras/keymap/keymaps/zepto-znote | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 extras/keymap/keymaps/zepto-znote diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 084227e9bd..c1132ec718 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -78,4 +78,6 @@ ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name via-K8N800" +ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="62*|63*", RUN+="keymap $name zepto-znote" + LABEL="keyboard_end" diff --git a/extras/keymap/keymaps/zepto-znote b/extras/keymap/keymaps/zepto-znote new file mode 100644 index 0000000000..e07651621c --- /dev/null +++ b/extras/keymap/keymaps/zepto-znote @@ -0,0 +1,11 @@ +0x93 switchvideomode # Fn+F3 Toggle Video Output +0x95 brightnessdown # Fn+F4 Brightness Down +0x91 brightnessup # Fn+F5 Brightness Up +0xA5 f22 # Fn+F6 Disable Touchpad +0xA6 f22 # Fn+F6 Enable Touchpad +0xA7 bluetooth # Fn+F10 Enable Bluetooth +0XA9 bluetooth # Fn+F10 Disable Bluetooth +0xF1 wlan # RF Switch Off +0xF2 wlan # RF Switch On +0xF4 prog1 # P1 Button +0xF3 prog2 # P2 Button -- cgit v1.2.3-54-g00ecf From 820fc48f249012c673eb38f63dd8b5ee039627d0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 17 Jul 2009 13:24:37 +0200 Subject: udevd: add timestamp to --debug output --- libudev/libudev-util-private.c | 3 ++- udev/udevd.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 5f5f4c1d89..f7daa9460b 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -249,6 +249,8 @@ int util_run_program(struct udev *udev, const char *command, char **envp, int i; int err = 0; + info(udev, "'%s' started\n", command); + /* build argv from command */ util_strscpy(arg, sizeof(arg), command); i = 0; @@ -273,7 +275,6 @@ int util_run_program(struct udev *udev, const char *command, char **envp, argv[0] = arg; argv[1] = NULL; } - info(udev, "'%s'\n", command); /* prepare pipes from child to parent */ if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { diff --git a/udev/udevd.c b/udev/udevd.c index 2cdc18b41e..69d509ce91 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -53,8 +54,15 @@ static void log_fn(struct udev *udev, int priority, const char *format, va_list args) { if (debug) { - fprintf(stderr, "[%d] %s: ", (int) getpid(), fn); - vfprintf(stderr, format, args); + char buf[1024]; + struct timeval tv; + struct timezone tz; + + vsnprintf(buf, sizeof(buf), format, args); + gettimeofday(&tv, &tz); + fprintf(stderr, "%llu.%06u [%u] %s: %s", + (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec, + (int) getpid(), fn, buf); } else { vsyslog(priority, format, args); } @@ -266,6 +274,7 @@ static void worker_new(struct event *event) struct worker_message msg; int err; + info(event->udev, "seq %llu running\n", udev_device_get_seqnum(dev)); udev_event = udev_event_new(dev); if (udev_event == NULL) _exit(3); -- cgit v1.2.3-54-g00ecf From 4766e49e3ff7de26c04d323e788dff9ffcae8a60 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 09:27:38 +0200 Subject: extras/keymap: add Everex Stepnote XT5000T Reported in https://launchpad.net/bugs/400921 --- extras/keymap/95-keymap.rules | 2 ++ extras/keymap/keymaps/everex-xt5000 | 7 +++++++ 2 files changed, 9 insertions(+) create mode 100644 extras/keymap/keymaps/everex-xt5000 diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index c1132ec718..e21719ceef 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -80,4 +80,6 @@ ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]produ ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="62*|63*", RUN+="keymap $name zepto-znote" +ENV{DMI_VENDOR}=="Everex", ATTR{[dmi/id]product_name}=="XT5000*", RUN+="keymap $name everex-xt5000" + LABEL="keyboard_end" diff --git a/extras/keymap/keymaps/everex-xt5000 b/extras/keymap/keymaps/everex-xt5000 new file mode 100644 index 0000000000..53bdd7af24 --- /dev/null +++ b/extras/keymap/keymaps/everex-xt5000 @@ -0,0 +1,7 @@ +0x5C media +0x65 f22 # Fn+F5 Touchpad toggle +0x67 prog3 # Fan Speed Control button +0x6F brightnessup +0x7F brightnessdown +0xB2 www +0xEC mail -- cgit v1.2.3-54-g00ecf From acdf6ae7ac401d502359c29cbc5ada6f5fb6344c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 14:13:28 +0200 Subject: extras/keymap: add Compal Hel80i https://launchpad.net/bugs/198530 --- extras/keymap/95-keymap.rules | 2 ++ extras/keymap/keymaps/compal-hel80i | 1 + 2 files changed, 3 insertions(+) create mode 100644 extras/keymap/keymaps/compal-hel80i diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index e21719ceef..6824530744 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -82,4 +82,6 @@ ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]prod ENV{DMI_VENDOR}=="Everex", ATTR{[dmi/id]product_name}=="XT5000*", RUN+="keymap $name everex-xt5000" +ENV{DMI_COMPAL}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name compal-hel80i" + LABEL="keyboard_end" diff --git a/extras/keymap/keymaps/compal-hel80i b/extras/keymap/keymaps/compal-hel80i new file mode 100644 index 0000000000..7082364a5f --- /dev/null +++ b/extras/keymap/keymaps/compal-hel80i @@ -0,0 +1 @@ +0x84 wlan -- cgit v1.2.3-54-g00ecf From b02c9fa19bb3da9cd1c4684322333732cc2996de Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 14:27:50 +0200 Subject: keymap tool: improve help Do not duplicate help strings, and add missing calling variant for interactivity. --- extras/keymap/keymap.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index b708f38e7b..8fc731debf 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -272,6 +272,19 @@ static void interactive(int fd) ioctl(fd, EVIOCGRAB, 0); } +static void help(int error) +{ + const char* h = "Usage: keymap []\n" + " keymap -i \n"; + if (error) { + fputs(h, stderr); + exit(2); + } else { + fputs(h, stdout); + exit(0); + } +} + int main(int argc, char **argv) { static const struct option options[] = { @@ -291,8 +304,7 @@ int main(int argc, char **argv) switch (option) { case 'h': - printf("Usage: keymap []\n\n"); - return 0; + help(0); case 'i': opt_interactive = 1; @@ -302,10 +314,8 @@ int main(int argc, char **argv) } } - if (argc < optind+1 || argc > optind+2) { - fprintf(stderr, "Usage: keymap []\n\n"); - return 2; - } + if (argc < optind+1 || argc > optind+2) + help (1); if ((fd = evdev_open(argv[optind])) < 0) return 3; -- cgit v1.2.3-54-g00ecf From d03a6f20df9037b060ed28bac7b7e6b1c94b1be8 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 14:52:45 +0200 Subject: keymap tool: support scancode/keycode pair arguments This avoids having to create and parse an entire keymap file for cases where just one or two keys have to be remapped. --- extras/keymap/keymap.c | 56 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 8fc731debf..18e577a3a4 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -153,6 +153,34 @@ fail: return r; } +static void set_key(int fd, const char* scancode_str, const char* keyname) +{ + unsigned scancode; + char *endptr; + char t[105] = "KEY_UNKNOWN"; + const struct key *k; + + scancode = (unsigned) strtol(scancode_str, &endptr, 0); + if (*endptr != '\0') { + fprintf(stderr, "ERROR: Invalid scancode\n"); + exit(1); + } + + snprintf(t, sizeof(t), "KEY_%s", keyname); + + if (!(k = lookup_key(t, strlen(t)))) { + fprintf(stderr, "ERROR: Unknown key name '%s'\n", keyname); + exit(1); + } + + if (evdev_set_keycode(fd, scancode, k->id) < 0) + fprintf(stderr, "setting scancode 0x%2X to key code %i failed\n", + scancode, k->id); + else + printf("setting scancode 0x%2X to key code %i\n", + scancode, k->id); +} + static int merge_table(int fd, const char *filename) { int r = 0; int line = 0; @@ -275,6 +303,7 @@ static void interactive(int fd) static void help(int error) { const char* h = "Usage: keymap []\n" + " keymap scancode keyname [...]\n" " keymap -i \n"; if (error) { fputs(h, stderr); @@ -294,6 +323,7 @@ int main(int argc, char **argv) }; int fd = -1; int opt_interactive = 0; + int i; while (1) { int option; @@ -314,19 +344,35 @@ int main(int argc, char **argv) } } - if (argc < optind+1 || argc > optind+2) + if (argc < optind+1) help (1); if ((fd = evdev_open(argv[optind])) < 0) return 3; - if (argc == optind+2) - merge_table(fd, default_keymap_path(argv[optind+1])); - else { + /* one argument (device): dump or interactive */ + if (argc == optind+1) { if (opt_interactive) interactive(fd); else dump_table(fd); + return 0; } - return 0; + + /* two arguments (device, mapfile): set map file */ + if (argc == optind+2) { + merge_table(fd, default_keymap_path(argv[optind+1])); + return 0; + } + + /* more arguments (device, scancode/keyname pairs): set keys directly */ + if ((argc - optind - 1) % 2 == 0) { + for (i = optind+1; i < argc; i += 2) + set_key(fd, argv[i], argv[i+1]); + return 0; + } + + /* invalid number of arguments */ + help(1); + return 1; /* not reached */ } -- cgit v1.2.3-54-g00ecf From 9193c7df9ae55fd2d22ccb32473ed65bdec39f8b Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 15:02:25 +0200 Subject: keymap: inline one-line key maps Remove key map files which have only one override. Instead, use keymap tools' new feature of specifying scancode/keyname pairs directly at the command line. Also add a comment to 95-keymap.rules about how to specify key mappings in the rules. --- extras/keymap/95-keymap.rules | 17 ++++++++++++----- extras/keymap/Makefile.am | 3 --- extras/keymap/keymaps/acer-extensa_5xxx | 1 - extras/keymap/keymaps/acer-travelmate_6292 | 1 - extras/keymap/keymaps/benq-joybook_r22 | 1 - extras/keymap/keymaps/compal-hel80i | 1 - extras/keymap/keymaps/via-K8N800 | 1 - 7 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 extras/keymap/keymaps/acer-extensa_5xxx delete mode 100644 extras/keymap/keymaps/acer-travelmate_6292 delete mode 100644 extras/keymap/keymaps/benq-joybook_r22 delete mode 100644 extras/keymap/keymaps/compal-hel80i delete mode 100644 extras/keymap/keymaps/via-K8N800 diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 6824530744..77088a584b 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -1,3 +1,10 @@ +# Set model specific hotkey keycodes. +# +# Key map overrides can be specified by either giving scancode/keyname pairs +# directly as keymap arguments (if there are just one or two to change), or as +# a file name (in /lib/udev/keymaps), which has to contain scancode/keyname +# pairs. + ACTION!="add", GOTO="keyboard_end" SUBSYSTEM!="input", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" @@ -42,12 +49,12 @@ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name acer-extensa_5xxx" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*", RUN+="keymap $name acer-travelmate_6292" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" -ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name benq-joybook_r22" +ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro V3205*", RUN+="keymap $name fujitsu-amilo_pro_v3205" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pa 2548*", RUN+="keymap $name fujitsu-amilo_pa_2548" @@ -76,12 +83,12 @@ ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+=" ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" -ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name via-K8N800" +ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name 0x81 prog1" ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="62*|63*", RUN+="keymap $name zepto-znote" ENV{DMI_VENDOR}=="Everex", ATTR{[dmi/id]product_name}=="XT5000*", RUN+="keymap $name everex-xt5000" -ENV{DMI_COMPAL}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name compal-hel80i" +ENV{DMI_COMPAL}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name 0x84 wlan" LABEL="keyboard_end" diff --git a/extras/keymap/Makefile.am b/extras/keymap/Makefile.am index 5c74575c67..8d6961a839 100644 --- a/extras/keymap/Makefile.am +++ b/extras/keymap/Makefile.am @@ -6,11 +6,8 @@ udevkeymapdir = $(libexecdir)/keymaps udevkeymap_DATA = \ keymaps/acer \ keymaps/acer-aspire_5920g \ - keymaps/acer-extensa_5xxx \ - keymaps/acer-travelmate_6292 \ keymaps/acer-travelmate_c300 \ keymaps/asus \ - keymaps/benq-joybook_r22 \ keymaps/compaq-e_evo \ keymaps/dell \ keymaps/fujitsu-amilo_pa_2548 \ diff --git a/extras/keymap/keymaps/acer-extensa_5xxx b/extras/keymap/keymaps/acer-extensa_5xxx deleted file mode 100644 index 80f981b0d1..0000000000 --- a/extras/keymap/keymaps/acer-extensa_5xxx +++ /dev/null @@ -1 +0,0 @@ -0xEE screenlock # Windows Lock function diff --git a/extras/keymap/keymaps/acer-travelmate_6292 b/extras/keymap/keymaps/acer-travelmate_6292 deleted file mode 100644 index e6c0845829..0000000000 --- a/extras/keymap/keymaps/acer-travelmate_6292 +++ /dev/null @@ -1 +0,0 @@ -0xD9 bluetooth # (toggle) on-to-off diff --git a/extras/keymap/keymaps/benq-joybook_r22 b/extras/keymap/keymaps/benq-joybook_r22 deleted file mode 100644 index d9c78bfa3e..0000000000 --- a/extras/keymap/keymaps/benq-joybook_r22 +++ /dev/null @@ -1 +0,0 @@ -0x6E wlan # Fn+F1 diff --git a/extras/keymap/keymaps/compal-hel80i b/extras/keymap/keymaps/compal-hel80i deleted file mode 100644 index 7082364a5f..0000000000 --- a/extras/keymap/keymaps/compal-hel80i +++ /dev/null @@ -1 +0,0 @@ -0x84 wlan diff --git a/extras/keymap/keymaps/via-K8N800 b/extras/keymap/keymaps/via-K8N800 deleted file mode 100644 index 64e2781840..0000000000 --- a/extras/keymap/keymaps/via-K8N800 +++ /dev/null @@ -1 +0,0 @@ -0x81 prog1 # Application launch -- cgit v1.2.3-54-g00ecf From 04ff303730b3c6c38fd9d7df08f9e403ccd9de3c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 15:07:55 +0200 Subject: extras/keymap: fix check-keymaps.sh for inline mappings Do not complain about missing keymap files when giving scancode/keyname pairs on the keymap command line in the rules. --- extras/keymap/check-keymaps.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh index dc46f59531..15e8ef8c1e 100755 --- a/extras/keymap/check-keymaps.sh +++ b/extras/keymap/check-keymaps.sh @@ -17,8 +17,11 @@ missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) <( } # check that all maps referred to in $RULES exist -maps=$(sed -rn '/keymap \$name/ { s/^.*\$name ([^"]+).*$/\1/; p }' $RULES) +maps=$(sed -rn '/keymap \$name/ { s/^.*\$name ([^"[:space:]]+).*$/\1/; p }' $RULES) for m in $maps; do + # ignore inline mappings + [ "$m" = "${m#0x}" ] || continue + [ -e keymaps/$m ] || { echo "ERROR: unknown map name in $RULES: $m" >&2 exit 1 -- cgit v1.2.3-54-g00ecf From 31d55fb187ce7ed21d1785be7ac79e71dde9fb4a Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 15:09:05 +0200 Subject: extras/keymap: add recently added keymap files to Makefile.am --- extras/keymap/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/keymap/Makefile.am b/extras/keymap/Makefile.am index 8d6961a839..e68bbe4a1b 100644 --- a/extras/keymap/Makefile.am +++ b/extras/keymap/Makefile.am @@ -10,6 +10,7 @@ keymaps/acer \ keymaps/asus \ keymaps/compaq-e_evo \ keymaps/dell \ + keymaps/everex-xt5000 \ keymaps/fujitsu-amilo_pa_2548 \ keymaps/fujitsu-amilo_pro_edition_v3505 \ keymaps/fujitsu-amilo_pro_v3205 \ @@ -40,7 +41,8 @@ keymaps/acer \ keymaps/samsung-sq1us \ keymaps/samsung-sx20s \ keymaps/toshiba-satellite_a100 \ - keymaps/toshiba-satellite_a110 + keymaps/toshiba-satellite_a110 \ + keymaps/zepto-znote dist_libexec_SCRIPTS = findkeyboards -- cgit v1.2.3-54-g00ecf From 04c6b22fcdd15c0d7d0acb8ca20f311be6efad2d Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 15:17:20 +0200 Subject: extras/keymap: Add HP Presario 2100 https://launchpad.net/bugs/20223 --- extras/keymap/95-keymap.rules | 1 + extras/keymap/Makefile.am | 1 + extras/keymap/keymaps/hewlett-packard-presario-2100 | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 extras/keymap/keymaps/hewlett-packard-presario-2100 diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 77088a584b..a576c833ba 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -47,6 +47,7 @@ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*", RUN+="keymap $name hewlett-packard-compaq_elitebook" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*", RUN+="keymap $name hewlett-packard-2510p_2530p" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" diff --git a/extras/keymap/Makefile.am b/extras/keymap/Makefile.am index e68bbe4a1b..7704ba7d91 100644 --- a/extras/keymap/Makefile.am +++ b/extras/keymap/Makefile.am @@ -21,6 +21,7 @@ keymaps/acer \ keymaps/hewlett-packard-2510p_2530p \ keymaps/hewlett-packard-compaq_elitebook \ keymaps/hewlett-packard-pavilion \ + keymaps/hewlett-packard-presario-2100 \ keymaps/hewlett-packard-tablet \ keymaps/hewlett-packard-tx2 \ keymaps/inventec-symphony_6.0_7.0 \ diff --git a/extras/keymap/keymaps/hewlett-packard-presario-2100 b/extras/keymap/keymaps/hewlett-packard-presario-2100 new file mode 100644 index 0000000000..1df39dcbd2 --- /dev/null +++ b/extras/keymap/keymaps/hewlett-packard-presario-2100 @@ -0,0 +1,3 @@ +0xF0 help +0xF1 screenlock +0xF3 search -- cgit v1.2.3-54-g00ecf From 1d11776f27c052a2a803ff260bf851692181df95 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 15:23:55 +0200 Subject: extras/keymap: cover more Compaq Evo models https://launchpad.net/bugs/35382 shows that may Evo N* models share the same keymap, so generalize the existing rule. --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index a576c833ba..8fbb860851 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -35,7 +35,7 @@ GOTO="keyboard_end" LABEL="keyboard_vendorcheck" ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" -ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N610c*|*Evo N600c*", RUN+="keymap $name compaq-e_evo" +ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x6_tablet" -- cgit v1.2.3-54-g00ecf From 6e40a05718d570a13a267c4fb49e9b6d543330f9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 15:30:08 +0200 Subject: extras/keymap: Add Fujitsu Amilo M https://launchpad.net/bugs/48547 --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 8fbb860851..dac9c76b85 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -63,6 +63,7 @@ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V5*", ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V6*", RUN+="keymap $name fujitsu-esprimo_mobile_v6" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro Edition V3505*", RUN+="keymap $name fujitsu-amilo_pro_edition_v3505" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+="keymap $name fujitsu-amilo_si_1520" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" -- cgit v1.2.3-54-g00ecf From 0b8d9a73335bdd69aa600a0aae42645374cecae9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 18 Jul 2009 16:59:46 +0200 Subject: extras/keymap: teach findkeyboards about USB keyboards --- extras/keymap/findkeyboards | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards index e39084cde9..4fafc7775d 100755 --- a/extras/keymap/findkeyboards +++ b/extras/keymap/findkeyboards @@ -21,12 +21,17 @@ keyboard_devices() { # standard AT keyboard for dev in $input_devs; do - info=`udevadm info --attribute-walk --path=$dev` + walk=`udevadm info --attribute-walk --path=$dev` + env=`udevadm info --query=env --path=$dev` - if echo "$info" | grep -q 'DRIVERS=="atkbd"'; then + if echo "$walk" | grep -q 'DRIVERS=="atkbd"'; then echo -n 'AT keyboard: ' udevadm info --query=name --path=$dev fi + if echo "$env"| grep -q '^ID_CLASS=kbd' && echo "$env" | grep -q '^ID_USB_DRIVER=usbhid'; then + echo -n 'USB keyboard: ' + udevadm info --query=name --path=$dev + fi done # modules -- cgit v1.2.3-54-g00ecf From 9093c7c132aa68052dcc64ef66cee8c31f088b02 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 20 Jul 2009 17:59:11 +0200 Subject: extras/keymap: Add Samsung SX22S Reported on hal ML by Sergey Astanin . --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index dac9c76b85..877b8b8b5c 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -74,7 +74,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*SP55S*|*SQ45S70S*|*SX60P*|*SX30S*|*R59P/R60P/R61P*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" -- cgit v1.2.3-54-g00ecf From 7a1566b0eeeb820751fcd351a79a2ed2f6c08499 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Jul 2009 01:36:42 +0200 Subject: v4l_id: exit with 0 when --help is given --- extras/v4l_id/v4l_id.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/v4l_id/v4l_id.c b/extras/v4l_id/v4l_id.c index 59b4f2f737..d530a6d391 100644 --- a/extras/v4l_id/v4l_id.c +++ b/extras/v4l_id/v4l_id.c @@ -52,6 +52,7 @@ int main (int argc, char *argv[]) switch (option) { case 'h': printf("Usage: v4l_id [--help] \n\n"); + return 0; default: return 1; } -- cgit v1.2.3-54-g00ecf From be7fec4815ef3e96f2454b7fbcd08ac408f387d8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 21 Jul 2009 01:40:47 +0200 Subject: configure.ac: version bump --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 69c115dba9..d4fb4e19a0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [145], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [146], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 5bacd2aadc854a0c01934bab76d4f575543d361e Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Wed, 22 Jul 2009 00:33:27 +0200 Subject: hid2hci: support to hid2hci for recovering Dell BT devices after S3 --- extras/hid2hci/70-hid2hci.rules | 5 +++++ extras/hid2hci/hid2hci.c | 45 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index caf9120f53..47eec00abe 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -11,6 +11,11 @@ SUBSYSTEM!="usb", GOTO="hid2hci_end" ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProtocol}=="02", ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ RUN+="hid2hci --method dell -v $attr{idVendor} -p $attr{idProduct} --mode hci" +# When a Dell device recovers from S3, the mouse child needs to be repoked +# Unfortunately the only event seen is the BT device disappearing, so the mouse +# device needs to be chased down on the USB bus. +ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", ATTR{idVendor}=="413c", ATTR{bmAttributes}=="e0", IMPORT{parent}="ID_*", ENV{REMOVE_CMD}="hid2hci --method dell -v $env{ID_VENDOR_ID} -p $env{ID_MODEL_ID} --mode hci -s 02" + ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" # Logitech devices diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c index aa44790f2b..469f8709ea 100644 --- a/extras/hid2hci/hid2hci.c +++ b/extras/hid2hci/hid2hci.c @@ -271,6 +271,36 @@ static int find_device(struct device_info* devinfo) return 0; } +static int find_resuscitated_device(struct device_info* devinfo, uint8_t bInterfaceProtocol) +{ + int i,j,k,l; + struct usb_device *dev, *child; + struct usb_config_descriptor config; + struct usb_interface interface; + struct usb_interface_descriptor altsetting; + + /* Using the base device, attempt to find the child with the + * matching bInterfaceProtocol */ + dev = devinfo->dev; + for (i = 0; i < dev->num_children; i++) { + child = dev->children[i]; + for (j = 0; j < child->descriptor.bNumConfigurations; j++) { + config = child->config[j]; + for (k = 0; k < config.bNumInterfaces; k++) { + interface = config.interface[k]; + for (l = 0; l < interface.num_altsetting; l++) { + altsetting = interface.altsetting[l]; + if (altsetting.bInterfaceProtocol == bInterfaceProtocol) { + devinfo->dev = child; + return 1; + } + } + } + } + } + return 0; +} + static void usage(char* error) { if (error) @@ -289,6 +319,7 @@ static void usage(char* error) "\t-v, --vendor= Vendor ID to act upon\n" "\t-p, --product= Product ID to act upon\n" "\t-m, --method= Method to use to switch [csr, logitech, dell]\n" + "\t-s, --resuscitate= Find the child device with this bInterfaceProtocol to run on \n" "\n"); if (error) exit(1); @@ -301,6 +332,7 @@ static const struct option main_options[] = { { "vendor", required_argument, 0, 'v' }, { "product", required_argument, 0, 'p' }, { "method", required_argument, 0, 'm' }, + { "resuscitate",required_argument, 0, 's' }, { 0, 0, 0, 0 } }; @@ -309,8 +341,9 @@ int main(int argc, char *argv[]) struct device_info dev = { NULL, HCI, 0, 0 }; int opt, quiet = 0; int (*method)(struct device_info *dev) = NULL; + uint8_t resuscitate = 0; - while ((opt = getopt_long(argc, argv, "+r:v:p:m:qh", main_options, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, "+s:r:v:p:m:qh", main_options, NULL)) != -1) { switch (opt) { case 'r': if (optarg && !strcmp(optarg, "hid")) @@ -339,6 +372,9 @@ int main(int argc, char *argv[]) case 'q': quiet = 1; break; + case 's': + sscanf(optarg, "%2hx", (short unsigned int*) &resuscitate); + break; case 'h': usage(NULL); default: @@ -362,6 +398,13 @@ int main(int argc, char *argv[]) exit(1); } + if (resuscitate && !find_resuscitated_device(&dev, resuscitate)) { + if (!quiet) + fprintf(stderr, "Device %04x:%04x was unable to resucitate any child devices.\n", + dev.vendor,dev.product); + exit(1); + } + if (!quiet) printf("Attempting to switch device %04x:%04x to %s mode ", dev.vendor, dev.product, dev.mode ? "HID" : "HCI"); -- cgit v1.2.3-54-g00ecf From 9821e7026401553e9ccba124afd9408a83007ba6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 22 Jul 2009 01:03:33 +0200 Subject: hid2hci: remove hid structures and include kernel header --- extras/hid2hci/hid2hci.c | 82 ++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 66 deletions(-) diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c index 469f8709ea..10beb61c36 100644 --- a/extras/hid2hci/hid2hci.c +++ b/extras/hid2hci/hid2hci.c @@ -22,10 +22,6 @@ * */ -#ifdef HAVE_CONFIG_H -#include -#endif - #include #include #include @@ -33,57 +29,11 @@ #include #include #include - +#include #include -#ifdef NEED_USB_GET_BUSSES -static inline struct usb_bus *usb_get_busses(void) -{ - return usb_busses; -} -#endif - -#ifndef USB_DIR_OUT -#define USB_DIR_OUT 0x00 -#endif - static char devpath[PATH_MAX + 1] = "/dev"; -struct hiddev_devinfo { - unsigned int bustype; - unsigned int busnum; - unsigned int devnum; - unsigned int ifnum; - short vendor; - short product; - short version; - unsigned num_applications; -}; - -struct hiddev_report_info { - unsigned report_type; - unsigned report_id; - unsigned num_fields; -}; - -typedef __signed__ int __s32; - -struct hiddev_usage_ref { - unsigned report_type; - unsigned report_id; - unsigned field_index; - unsigned usage_index; - unsigned usage_code; - __s32 value; -}; - -#define HIDIOCGDEVINFO _IOR('H', 0x03, struct hiddev_devinfo) -#define HIDIOCINITREPORT _IO('H', 0x05) -#define HIDIOCSREPORT _IOW('H', 0x08, struct hiddev_report_info) -#define HIDIOCSUSAGE _IOW('H', 0x0C, struct hiddev_usage_ref) - -#define HID_REPORT_TYPE_OUTPUT 2 - #define HCI 0 #define HID 1 @@ -103,8 +53,9 @@ static int switch_csr(struct device_info *devinfo) if (!udev) return -errno; - err = usb_control_msg(udev, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, devinfo->mode, 0, NULL, 0, 10000); + err = usb_control_msg(udev, + USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + 0, devinfo->mode, 0, NULL, 0, 10000); if (err == 0) { err = -1; @@ -325,25 +276,24 @@ static void usage(char* error) exit(1); } -static const struct option main_options[] = { - { "help", no_argument, 0, 'h' }, - { "quiet", no_argument, 0, 'q' }, - { "mode", required_argument, 0, 'r' }, - { "vendor", required_argument, 0, 'v' }, - { "product", required_argument, 0, 'p' }, - { "method", required_argument, 0, 'm' }, - { "resuscitate",required_argument, 0, 's' }, - { 0, 0, 0, 0 } -}; - int main(int argc, char *argv[]) { + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "quiet", no_argument, NULL, 'q' }, + { "mode", required_argument, NULL, 'r' }, + { "vendor", required_argument, NULL, 'v' }, + { "product", required_argument, NULL, 'p' }, + { "method", required_argument, NULL, 'm' }, + { "resuscitate", required_argument, NULL, 's' }, + { } + }; struct device_info dev = { NULL, HCI, 0, 0 }; int opt, quiet = 0; int (*method)(struct device_info *dev) = NULL; uint8_t resuscitate = 0; - while ((opt = getopt_long(argc, argv, "+s:r:v:p:m:qh", main_options, NULL)) != -1) { + while ((opt = getopt_long(argc, argv, "+s:r:v:p:m:qh", options, NULL)) != -1) { switch (opt) { case 'r': if (optarg && !strcmp(optarg, "hid")) @@ -378,7 +328,7 @@ int main(int argc, char *argv[]) case 'h': usage(NULL); default: - exit(0); + exit(1); } } -- cgit v1.2.3-54-g00ecf From 1b691f831b43ceeef3d780f87e02fb177dd03281 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 22 Jul 2009 19:09:48 +0200 Subject: path_id: make global variable static --- extras/path_id/path_id.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 4b57dec0d3..53720e0fe2 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -3,6 +3,8 @@ * * Copyright (C) 2009 Kay Sievers * + * Log based on Hannes Reinecke's shell script. + * * 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, either version 2 of the License, or @@ -31,7 +33,7 @@ #include "libudev.h" #include "libudev-private.h" -int debug; +static int debug; static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, -- cgit v1.2.3-54-g00ecf From cf5bd04073671df31dbbaf525f870366b37e5256 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Jul 2009 00:02:28 +0200 Subject: udevadm: trigger - add --sysname-match= $ udevadm trigger -n -v --subsystem-match=usb --sysname-match=2-1.1* /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1 /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.1 /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.1/2-1.1.1:1.0 /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.2 /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2:1.0 /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1.2/2-1.1.2:1.1 /sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1/2-1.1/2-1.1:1.0 --- libudev/Makefile.am | 6 +++--- libudev/exported_symbols | 1 + libudev/libudev-enumerate.c | 40 ++++++++++++++++++++++++++++++++++++++++ libudev/libudev.h | 1 + udev/udevadm-trigger.c | 7 ++++++- udev/udevadm.xml | 7 +++++++ 6 files changed, 58 insertions(+), 4 deletions(-) diff --git a/libudev/Makefile.am b/libudev/Makefile.am index 866a5ca135..e83888617a 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -28,9 +28,9 @@ libudev_la_SOURCES =\ libudev-monitor.c \ libudev-queue.c -LT_CURRENT=4 -LT_REVISION=2 -LT_AGE=4 +LT_CURRENT=5 +LT_REVISION=0 +LT_AGE=5 libudev_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ -export-symbols $(top_srcdir)/libudev/exported_symbols diff --git a/libudev/exported_symbols b/libudev/exported_symbols index 8e7749e488..018463dd91 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -45,6 +45,7 @@ udev_enumerate_add_nomatch_subsystem udev_enumerate_add_match_sysattr udev_enumerate_add_nomatch_sysattr udev_enumerate_add_match_property +udev_enumerate_add_match_sysname udev_enumerate_scan_devices udev_enumerate_scan_subsystems udev_enumerate_add_syspath diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index db8c51404f..96cf060907 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -49,6 +49,7 @@ struct udev_enumerate { struct udev_list_node sysattr_nomatch_list; struct udev_list_node subsystem_match_list; struct udev_list_node subsystem_nomatch_list; + struct udev_list_node sysname_match_list; struct udev_list_node properties_match_list; struct udev_list_node devices_list; struct syspath *devices; @@ -76,6 +77,7 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) udev_list_init(&udev_enumerate->sysattr_nomatch_list); udev_list_init(&udev_enumerate->subsystem_match_list); udev_list_init(&udev_enumerate->subsystem_nomatch_list); + udev_list_init(&udev_enumerate->sysname_match_list); udev_list_init(&udev_enumerate->properties_match_list); udev_list_init(&udev_enumerate->devices_list); return udev_enumerate; @@ -117,6 +119,7 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_nomatch_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysname_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->properties_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); for (i = 0; i < udev_enumerate->devices_cur; i++) @@ -383,6 +386,25 @@ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, con return 0; } +/** + * udev_enumerate_add_match_sysname: + * @udev_enumerate: context + * @sysname: filter for the name of the device to include in the list + * + * Returns: 0 on success, otherwise a negative error value. + */ +int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (sysname == NULL) + return 0; + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->sysname_match_list, sysname, NULL, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + static int match_sysattr(struct udev_enumerate *udev_enumerate, const char *syspath) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); @@ -454,6 +476,21 @@ out: return match; } +static int match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) +{ + struct udev_list_entry *list_entry; + + if (udev_list_get_entry(&udev_enumerate->sysname_match_list) == NULL) + return 1; + + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysname_match_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), sysname, 0) != 0) + continue; + return 1; + } + return 0; +} + static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir1, const char *subdir2) { @@ -480,6 +517,9 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, if (dent->d_name[0] == '.') continue; + if (!match_sysname(udev_enumerate, dent->d_name)) + continue; + util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); if (lstat(syspath, &statbuf) != 0) continue; diff --git a/libudev/libudev.h b/libudev/libudev.h index 8b5391c066..4bcf442f51 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -131,6 +131,7 @@ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); +int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname); int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); /* run enumeration with active filters */ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 2e9fe6ba96..db7d1e0571 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -102,6 +102,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { "attr-match", required_argument, NULL, 'a' }, { "attr-nomatch", required_argument, NULL, 'A' }, { "property-match", required_argument, NULL, 'p' }, + { "sysname-match", required_argument, NULL, 'y' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -127,7 +128,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) const char *val; char buf[UTIL_PATH_SIZE]; - option = getopt_long(argc, argv, "vnFo:t:hcp:s:S:a:A:", options, NULL); + option = getopt_long(argc, argv, "vnFo:t:hcp:s:S:a:A:y:", options, NULL); if (option == -1) break; @@ -176,6 +177,9 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) key = keyval(optarg, &val, buf, sizeof(buf)); udev_enumerate_add_match_property(udev_enumerate, key, val); break; + case 'y': + udev_enumerate_add_match_sysname(udev_enumerate, optarg); + break; case 'h': printf("Usage: udevadm trigger OPTIONS\n" " --verbose print the list of devices while running\n" @@ -191,6 +195,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) " --attr-match=]> trigger devices with a matching attribute\n" " --attr-nomatch=]> exclude devices with a matching attribute\n" " --property-match== trigger devices with a matching property\n" + " --sysname-match= trigger devices with a matching name\n" " --help\n\n"); goto exit; default: diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 64e6f2aeb9..e4151e0ed4 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -217,6 +217,13 @@ specified multiple times and supports shell style pattern matching.
                    + + + + Trigger events for devices with a matching sys device name. This option can be + specified multiple times and supports shell style pattern matching. + +
                    -- cgit v1.2.3-54-g00ecf From 53842b53820a0f0b2b0ff5b28caf01e3f7e26f22 Mon Sep 17 00:00:00 2001 From: Erik Forsberg Date: Thu, 23 Jul 2009 16:40:25 +0200 Subject: extras/modem-modeswitch: Add Huawei E1550 GSM modem What's odd is that this is a huawei modem, not an option modem, so one would expect it to work better with usb_modeswitch and it's -H (huawei) mode - but that's not the case, I've tested that as well. https://launchpad.net/bugs/401655 --- extras/modem-modeswitch/61-option-modem-modeswitch.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/modem-modeswitch/61-option-modem-modeswitch.rules b/extras/modem-modeswitch/61-option-modem-modeswitch.rules index 19dc5b4965..7c94a06c06 100644 --- a/extras/modem-modeswitch/61-option-modem-modeswitch.rules +++ b/extras/modem-modeswitch/61-option-modem-modeswitch.rules @@ -34,5 +34,6 @@ ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7401", RUN+="modem-modeswitch -v 0x% ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7501", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7601", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7901", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" LABEL="option_zerocd_end" -- cgit v1.2.3-54-g00ecf From 0dcf1ce1f76325e88be8b1c6cc356a2123c9a757 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 23 Jul 2009 19:00:38 +0200 Subject: extras/keymap: Fix crash for unknown keys The keymap table has some holes in it, which caused the interactive mode to crash for unknown keys. In these cases, print the numeric key code instead. --- extras/keymap/keymap.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 18e577a3a4..117a41dbae 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -258,15 +258,22 @@ static const char* default_keymap_path(const char* path) static void print_key(struct input_event *event) { static int cur_scancode = 0; + const char *keyname; /* save scan code for next EV_KEY event */ if (event->type == EV_MSC && event->code == MSC_SCAN) cur_scancode = event->value; /* key press */ - if (event->type == EV_KEY && event->value) - printf("scan code: 0x%02X key code: %s\n", cur_scancode, - format_keyname(key_names[event->code])); + if (event->type == EV_KEY && event->value) { + keyname = key_names[event->code]; + if (keyname != NULL) + printf("scan code: 0x%02X key code: %s\n", cur_scancode, + format_keyname(key_names[event->code])); + else + printf("scan code: 0x%02X key code: %03X\n", cur_scancode, + event->code); + } } static void interactive(int fd) -- cgit v1.2.3-54-g00ecf From 8f2f1b1262aabe9a1ef8f25078c796de433bae3a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Jul 2009 20:26:45 +0200 Subject: rules: serial - fix path_id call --- rules/rules.d/60-persistent-serial.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules index 00727d7785..351b3856fd 100644 --- a/rules/rules.d/60-persistent-serial.rules +++ b/rules/rules.d/60-persistent-serial.rules @@ -6,7 +6,7 @@ KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="persistent_serial_end" SUBSYSTEMS=="usb-serial", ENV{ID_PORT}="$attr{port_number}" -IMPORT="path_id" +IMPORT="path_id %p" ENV{ID_PATH}=="?*", ENV{ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}" ENV{ID_PATH}=="?*", ENV{ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{ID_PORT}" -- cgit v1.2.3-54-g00ecf From 58230a77d34163a3ee6c261def756448d7d969a1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Jul 2009 20:27:13 +0200 Subject: path_id: fix typo in comment --- extras/path_id/path_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 53720e0fe2..2d70b6373d 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -3,7 +3,7 @@ * * Copyright (C) 2009 Kay Sievers * - * Log based on Hannes Reinecke's shell script. + * Logic based on Hannes Reinecke's shell script. * * 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 -- cgit v1.2.3-54-g00ecf From d5b5a611aeb6c78a9290ea31ad62dc039401fb44 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Jul 2009 20:28:16 +0200 Subject: format names are not case insensitive --- udev/udev-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 2f32805f30..a407975f08 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -126,7 +126,7 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char * } for (i = 0; i < ARRAY_SIZE(map); i++) { - if (strncasecmp(&from[1], map[i].name, strlen(map[i].name)) == 0) { + if (strncmp(&from[1], map[i].name, strlen(map[i].name)) == 0) { type = map[i].type; from += strlen(map[i].name)+1; dbg(event->udev, "will substitute format name '%s'\n", map[i].name); -- cgit v1.2.3-54-g00ecf From 4b6769f61206e90850aff8a30e8e93fbfcc18673 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 24 Jul 2009 18:06:22 +0200 Subject: hid2hci: rewrite (and break) rules and device handling We must never access random devices in /dev which do not belong to the event we are handling. Hard-coding /dev/hidrawX, and looping over all devices is absolutely not acceptable --> hook into hidraw events. We can not relay on (rather random) properties merged into the parent device by earlier rules --> use libudev to find the sibling device with a matching interface. Libusb does not fit into udev's use case. We never want want to scan and open() all usb devices in the system, just to find the device we are already handling the event for --> put all the stupid scanning into a single function and prepare for a fixed libusb or drop it later. --- TODO | 3 +- extras/hid2hci/70-hid2hci.rules | 33 ++- extras/hid2hci/Makefile.am | 8 +- extras/hid2hci/hid2hci.c | 494 ++++++++++++++++++++++------------------ 4 files changed, 293 insertions(+), 245 deletions(-) diff --git a/TODO b/TODO index c6576fdaf0..ac9b738e60 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,8 @@ + o get rid of braindead "scan all devices to find myself" libusb interface + if it can not be fixed, drop libusb entirely o enumerate: sort control* after pcm* o add tests for kernel provided DEVNAME logic - o drop modprobe floppy alias (SUSE), it will be in the module (2.6.30) o convert firmware.sh to C o symlink names to udevadm will no longer be resolved to old command names diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index 47eec00abe..1af356c993 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -3,28 +3,27 @@ ACTION!="add", GOTO="hid2hci_end" SUBSYSTEM!="usb", GOTO="hid2hci_end" -# Variety of Dell Bluetooth devices - it looks like a bit of an odd rule, -# because it is matching on a mouse device that is self powered, but that -# is where a HID report needs to be sent to switch modes. -# +# Variety of Dell Bluetooth devices - match on a mouse device that is +# self powered and where a HID report needs to be sent to switch modes # Known supported devices: 413c:8154, 413c:8158, 413c:8162 -ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProtocol}=="02", ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ - RUN+="hid2hci --method dell -v $attr{idVendor} -p $attr{idProduct} --mode hci" +ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProtocol}=="02", \ + ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ + RUN+="hid2hci --method=dell --devpath=%p" -# When a Dell device recovers from S3, the mouse child needs to be repoked -# Unfortunately the only event seen is the BT device disappearing, so the mouse -# device needs to be chased down on the USB bus. -ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", ATTR{idVendor}=="413c", ATTR{bmAttributes}=="e0", IMPORT{parent}="ID_*", ENV{REMOVE_CMD}="hid2hci --method dell -v $env{ID_VENDOR_ID} -p $env{ID_MODEL_ID} --mode hci -s 02" +# Logitech devices (hidraw) +KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ + RUN+="hid2hci --method=logitech-hid --devpath=%p" ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" -# Logitech devices -ATTR{idVendor}=="046d", ATTR{idProduct}=="c70[345abce]", RUN+="hid2hci --method logitech -v $attr{idVendor} -p $attr{idProduct} --mode hci" -ATTR{idVendor}=="046d", ATTR{idProduct}=="c71[34bc]", RUN+="hid2hci --method logitech -v $attr{idVendor} -p $attr{idProduct} --mode hci" +# When a Dell device recovers from S3, the mouse child needs to be repoked +# Unfortunately the only event seen is the BT device disappearing, so the mouse +# device needs to be chased down on the USB bus. +ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", \ + ATTR{idVendor}=="413c", ATTR{bmAttributes}=="e0", \ + ENV{REMOVE_CMD}="hid2hci --method=dell --devpath=%p --find-sibling-intf=03:01:02" -# CSR devices (in HID mode) -ATTR{idVendor}=="0a12", ATTR{idProduct}=="1000", RUN+="hid2hci --method csr -v $attr{idVendor} -p $attr{idProduct} --mode hci" -ATTR{idVendor}=="0458", ATTR{idProduct}=="1000", RUN+="hid2hci --method csr -v $attr{idVendor} -p $attr{idProduct} --mode hci" -ATTR{idVendor}=="05ac", ATTR{idProduct}=="1000", RUN+="hid2hci --method csr -v $attr{idVendor} -p $attr{idProduct} --mode hci" +# CSR devices +ATTR{idVendor}=="0a12|0458|05ac", ATTR{idProduct}=="1000", RUN+="hid2hci --method=csr --devpath=%p" LABEL="hid2hci_end" diff --git a/extras/hid2hci/Makefile.am b/extras/hid2hci/Makefile.am index 62ba58d3fa..5450c34198 100644 --- a/extras/hid2hci/Makefile.am +++ b/extras/hid2hci/Makefile.am @@ -7,7 +7,13 @@ dist_udevrules_DATA = \ 70-hid2hci.rules hid2hci_SOURCES = \ - hid2hci.c + hid2hci.c \ + ../../libudev/libudev.h \ + ../../libudev/libudev.c \ + ../../libudev/libudev-list.c \ + ../../libudev/libudev-util.c \ + ../../libudev/libudev-device.c \ + ../../libudev/libudev-enumerate.c hid2hci_LDADD = \ @LIBUSB_LIBS@ diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c index 10beb61c36..298ac39ec0 100644 --- a/extras/hid2hci/hid2hci.c +++ b/extras/hid2hci/hid2hci.c @@ -1,25 +1,24 @@ /* + * hid2hci : switch the radio on devices that support + * it from HID to HCI and back * - * hid2hci : a tool for switching the radio on devices that support - * it from HID to HCI and back + * Copyright (C) 2003-2009 Marcel Holtmann + * Copyright (C) 2008-2009 Mario Limonciello + * Copyright (C) 2009 Kay Sievers * - * Copyright (C) 2003-2009 Marcel Holtmann - * Copyright (C) 2008-2009 Mario Limonciello + * 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; either version 2 of the License, or + * (at your option) any later version. * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include @@ -32,31 +31,21 @@ #include #include -static char devpath[PATH_MAX + 1] = "/dev"; - -#define HCI 0 -#define HID 1 +#include "libudev.h" +#include "libudev-private.h" -struct device_info { - struct usb_device *dev; - int mode; - uint16_t vendor; - uint16_t product; +enum mode { + HCI = 0, + HID = 1, }; -static int switch_csr(struct device_info *devinfo) +static int usb_switch_csr(struct usb_dev_handle *dev, enum mode mode) { - struct usb_dev_handle *udev; int err; - udev = usb_open(devinfo->dev); - if (!udev) - return -errno; - - err = usb_control_msg(udev, + err = usb_control_msg(dev, USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, devinfo->mode, 0, NULL, 0, 10000); - + 0, mode, 0, NULL, 0, 10000); if (err == 0) { err = -1; errno = EALREADY; @@ -64,13 +53,10 @@ static int switch_csr(struct device_info *devinfo) if (errno == ETIMEDOUT) err = 0; } - - usb_close(udev); - return err; } -static int send_report(int fd, const char *buf, size_t size) +static int hid_logitech_send_report(int fd, const char *buf, size_t size) { struct hiddev_report_info rinfo; struct hiddev_usage_ref uref; @@ -99,72 +85,42 @@ static int send_report(int fd, const char *buf, size_t size) return err; } -static int switch_logitech(struct device_info *devinfo) +static int hid_switch_logitech(const char *filename) { - char devname[PATH_MAX + 1]; - int i, fd, err = -1; - - for (i = 0; i < 16; i++) { - struct hiddev_devinfo dinfo; - char rep1[] = { 0xff, 0x80, 0x80, 0x01, 0x00, 0x00 }; - char rep2[] = { 0xff, 0x80, 0x00, 0x00, 0x30, 0x00 }; - char rep3[] = { 0xff, 0x81, 0x80, 0x00, 0x00, 0x00 }; - - sprintf(devname, "%s/hiddev%d", devpath, i); - fd = open(devname, O_RDWR); - if (fd < 0) { - sprintf(devname, "%s/usb/hiddev%d", devpath, i); - fd = open(devname, O_RDWR); - if (fd < 0) { - sprintf(devname, "%s/usb/hid/hiddev%d", devpath, i); - fd = open(devname, O_RDWR); - if (fd < 0) - continue; - } - } - - memset(&dinfo, 0, sizeof(dinfo)); - err = ioctl(fd, HIDIOCGDEVINFO, &dinfo); - if (err < 0 || (int) dinfo.busnum != atoi(devinfo->dev->bus->dirname) || - (int) dinfo.devnum != atoi(devinfo->dev->filename)) { - close(fd); - continue; - } - - err = ioctl(fd, HIDIOCINITREPORT, 0); - if (err < 0) { - close(fd); - break; - } - - err = send_report(fd, rep1, sizeof(rep1)); - if (err < 0) { - close(fd); - break; - } - - err = send_report(fd, rep2, sizeof(rep2)); - if (err < 0) { - close(fd); - break; - } - - err = send_report(fd, rep3, sizeof(rep3)); - close(fd); - break; - } - + char rep1[] = { 0xff, 0x80, 0x80, 0x01, 0x00, 0x00 }; + char rep2[] = { 0xff, 0x80, 0x00, 0x00, 0x30, 0x00 }; + char rep3[] = { 0xff, 0x81, 0x80, 0x00, 0x00, 0x00 }; + int fd; + int err = -1; + + fd = open(filename, O_RDWR); + if (fd < 0) + return err; + + err = ioctl(fd, HIDIOCINITREPORT, 0); + if (err < 0) + goto out; + + err = hid_logitech_send_report(fd, rep1, sizeof(rep1)); + if (err < 0) + goto out; + + err = hid_logitech_send_report(fd, rep2, sizeof(rep2)); + if (err < 0) + goto out; + + err = hid_logitech_send_report(fd, rep3, sizeof(rep3)); +out: + close(fd); return err; } -static int switch_dell(struct device_info *devinfo) +static int usb_switch_dell(struct usb_dev_handle *dev, enum mode mode) { char report[] = { 0x7f, 0x00, 0x00, 0x00 }; - - struct usb_dev_handle *handle; int err; - switch (devinfo->mode) { + switch (mode) { case HCI: report[1] = 0x13; break; @@ -173,22 +129,16 @@ static int switch_dell(struct device_info *devinfo) break; } - handle = usb_open(devinfo->dev); - if (!handle) - return -EIO; - /* Don't need to check return, as might not be in use */ - usb_detach_kernel_driver_np(handle, 0); + usb_detach_kernel_driver_np(dev, 0); - if (usb_claim_interface(handle, 0) < 0) { - usb_close(handle); + if (usb_claim_interface(dev, 0) < 0) return -EIO; - } - err = usb_control_msg(handle, - USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, + err = usb_control_msg(dev, + USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, USB_REQ_SET_CONFIGURATION, 0x7f | (0x03 << 8), 0, - report, sizeof(report), 5000); + report, sizeof(report), 5000); if (err == 0) { err = -1; @@ -197,133 +147,194 @@ static int switch_dell(struct device_info *devinfo) if (errno == ETIMEDOUT) err = 0; } - - usb_close(handle); - return err; } -static int find_device(struct device_info* devinfo) +/* + * The braindead libusb needs to scan and open all devices, just to + * to find the device we already have. This needs to be fixed in libusb + * or it will be ripped out and we carry our own code. + */ +static struct usb_device *usb_device_open_from_udev(struct udev_device *usb_dev) { struct usb_bus *bus; - struct usb_device *dev; + const char *str; + int busnum; + int devnum; + + str = udev_device_get_sysattr_value(usb_dev, "busnum"); + if (str == NULL) + return NULL; + busnum = strtol(str, NULL, 0); + str = udev_device_get_sysattr_value(usb_dev, "devnum"); + if (str == NULL) + return NULL; + devnum = strtol(str, NULL, 0); + + usb_init(); usb_find_busses(); usb_find_devices(); - for (bus = usb_get_busses(); bus; bus = bus->next) + for (bus = usb_get_busses(); bus; bus = bus->next) { + struct usb_device *dev; + + if (strtol(bus->dirname, NULL, 10) != busnum) + continue; + for (dev = bus->devices; dev; dev = dev->next) { - if (dev->descriptor.idVendor == devinfo->vendor && - dev->descriptor.idProduct == devinfo->product) { - devinfo->dev=dev; - return 1; - } + if (dev->devnum == devnum) + return dev; } - return 0; + } + + return NULL; } -static int find_resuscitated_device(struct device_info* devinfo, uint8_t bInterfaceProtocol) +static struct usb_dev_handle *find_device(struct udev_device *udev_dev, const char *sibling_intf) { - int i,j,k,l; - struct usb_device *dev, *child; - struct usb_config_descriptor config; - struct usb_interface interface; - struct usb_interface_descriptor altsetting; - - /* Using the base device, attempt to find the child with the - * matching bInterfaceProtocol */ - dev = devinfo->dev; - for (i = 0; i < dev->num_children; i++) { - child = dev->children[i]; - for (j = 0; j < child->descriptor.bNumConfigurations; j++) { - config = child->config[j]; - for (k = 0; k < config.bNumInterfaces; k++) { - interface = config.interface[k]; - for (l = 0; l < interface.num_altsetting; l++) { - altsetting = interface.altsetting[l]; - if (altsetting.bInterfaceProtocol == bInterfaceProtocol) { - devinfo->dev = child; - return 1; - } - } - } - } + struct udev *udev = udev_device_get_udev(udev_dev); + struct usb_device *dev; + struct udev_device *udev_parent; + char str[UTIL_NAME_SIZE]; + struct udev_enumerate *enumerate; + struct udev_list_entry *entry; + struct usb_dev_handle *handle = NULL; + + if (sibling_intf == NULL) { + dev = usb_device_open_from_udev(udev_dev); + if (dev == NULL) + return NULL; + return usb_open(dev); } - return 0; + + /* find matching sibling of the current usb_device, they share the same hub */ + udev_parent = udev_device_get_parent_with_subsystem_devtype(udev_dev, "usb", "usb_device"); + if (udev_parent == NULL) + return NULL; + + enumerate = udev_enumerate_new(udev); + if (enumerate == NULL) + return NULL; + + udev_enumerate_add_match_subsystem(enumerate, "usb"); + + /* match all childs of the parent */ + util_strscpyl(str, sizeof(str), udev_device_get_sysname(udev_parent), "*", NULL); + udev_enumerate_add_match_sysname(enumerate, str); + + /* match the specified interface */ + util_strscpy(str, sizeof(str), sibling_intf); + str[2] = '\0'; + str[5] = '\0'; + str[8] = '\0'; + if (strcmp(str, "-1") != 0) + udev_enumerate_add_match_sysattr(enumerate, "bInterfaceClass", str); + if (strcmp(&str[3], "-1") != 0) + udev_enumerate_add_match_sysattr(enumerate, "bInterfaceSubClass", &str[3]); + if (strcmp(&str[6], "-1") != 0) + udev_enumerate_add_match_sysattr(enumerate, "bInterfaceProtocol", &str[6]); + + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *udev_device; + + udev_device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(entry)); + if (udev_device != NULL) { + /* get the usb_device of the usb_interface we matched */ + udev_parent = udev_device_get_parent_with_subsystem_devtype(udev_device, "usb", "usb_device"); + if (udev_parent == NULL) + continue; + /* only look at the first matching device */ + dev = usb_device_open_from_udev(udev_parent); + if (dev != NULL) + handle = usb_open(dev); + udev_device_unref(udev_device); + break; + } +} + udev_enumerate_unref(enumerate); + return handle; } -static void usage(char* error) +static void usage(const char *error) { if (error) fprintf(stderr,"\n%s\n", error); else printf("hid2hci - Bluetooth HID to HCI mode switching utility\n\n"); - printf("Usage:\n" - "\thid2hci [options]\n" - "\n"); - - printf("Options:\n" - "\t-h, --help Display help\n" - "\t-q, --quiet Don't display any messages\n" - "\t-r, --mode= Mode to switch to [hid, hci]\n" - "\t-v, --vendor= Vendor ID to act upon\n" - "\t-p, --product= Product ID to act upon\n" - "\t-m, --method= Method to use to switch [csr, logitech, dell]\n" - "\t-s, --resuscitate= Find the child device with this bInterfaceProtocol to run on \n" - "\n"); - if (error) - exit(1); + printf("Usage: hid2hci [options]\n" + " --mode= mode to switch to [hid|hci] (default hci)\n" + " --devpath= sys device path\n" + " --method= method to use to switch [csr|logitech-hid|dell]\n" + " --find-sibling-intf= find the sibling device with 00:00:00 (class:subclass:prot)\n" + " --help\n\n"); } int main(int argc, char *argv[]) { static const struct option options[] = { { "help", no_argument, NULL, 'h' }, - { "quiet", no_argument, NULL, 'q' }, - { "mode", required_argument, NULL, 'r' }, - { "vendor", required_argument, NULL, 'v' }, - { "product", required_argument, NULL, 'p' }, - { "method", required_argument, NULL, 'm' }, - { "resuscitate", required_argument, NULL, 's' }, + { "mode", required_argument, NULL, 'm' }, + { "devpath", required_argument, NULL, 'p' }, + { "method", required_argument, NULL, 'M' }, + { "find-sibling-intf", required_argument, NULL, 'I' }, { } }; - struct device_info dev = { NULL, HCI, 0, 0 }; - int opt, quiet = 0; - int (*method)(struct device_info *dev) = NULL; - uint8_t resuscitate = 0; - - while ((opt = getopt_long(argc, argv, "+s:r:v:p:m:qh", options, NULL)) != -1) { - switch (opt) { - case 'r': - if (optarg && !strcmp(optarg, "hid")) - dev.mode = HID; - else if (optarg && !strcmp(optarg, "hci")) - dev.mode = HCI; - else - usage("ERROR: Undefined radio mode\n"); + enum method { + METHOD_UNDEF, + METHOD_CSR, + METHOD_LOGITECH_HID, + METHOD_DELL, + } method = METHOD_UNDEF; + struct udev *udev; + struct udev_device *udev_dev = NULL; + char syspath[UTIL_PATH_SIZE]; + int (*usb_switch)(struct usb_dev_handle *dev, enum mode mode) = NULL; + enum mode mode = HCI; + const char *devpath = NULL; + const char *sibling_intf = NULL; + int err = -1; + int rc = 1; + + for (;;) { + int option; + + option = getopt_long(argc, argv, "m:p:M:I:qh", options, NULL); + if (option == -1) break; - case 'v': - sscanf(optarg, "%4hx", &dev.vendor); + + switch (option) { + case 'm': + if (!strcmp(optarg, "hid")) { + mode = HID; + } else if (!strcmp(optarg, "hci")) { + mode = HCI; + } else { + usage("error: undefined radio mode\n"); + exit(1); + } break; case 'p': - sscanf(optarg, "%4hx", &dev.product); - break; - case 'm': - if (optarg && !strcmp(optarg, "csr")) - method = switch_csr; - else if (optarg && !strcmp(optarg, "logitech")) - method = switch_logitech; - else if (optarg && !strcmp(optarg, "dell")) - method = switch_dell; - else - usage("ERROR: Undefined switching method\n"); + devpath = optarg; break; - case 'q': - quiet = 1; + case 'M': + if (!strcmp(optarg, "csr")) { + method = METHOD_CSR; + usb_switch = usb_switch_csr; + } else if (!strcmp(optarg, "logitech-hid")) { + method = METHOD_LOGITECH_HID; + } else if (!strcmp(optarg, "dell")) { + method = METHOD_DELL; + usb_switch = usb_switch_dell; + } else { + usage("error: undefined switching method\n"); + exit(1); + } break; - case 's': - sscanf(optarg, "%2hx", (short unsigned int*) &resuscitate); + case 'I': + sibling_intf = optarg; break; case 'h': usage(NULL); @@ -332,38 +343,69 @@ int main(int argc, char *argv[]) } } - if (!quiet && (!dev.vendor || !dev.product || !method)) - usage("ERROR: Vendor ID, Product ID, and Switching Method must all be defined.\n"); - - argc -= optind; - argv += optind; - optind = 0; - - usb_init(); - - if (!find_device(&dev)) { - if (!quiet) - fprintf(stderr, "Device %04x:%04x not found on USB bus.\n", - dev.vendor, dev.product); + if (!devpath || method == METHOD_UNDEF) { + usage("error: --devpath= and --method= must be defined\n"); exit(1); } - if (resuscitate && !find_resuscitated_device(&dev, resuscitate)) { - if (!quiet) - fprintf(stderr, "Device %04x:%04x was unable to resucitate any child devices.\n", - dev.vendor,dev.product); - exit(1); + udev = udev_new(); + if (udev == NULL) + goto exit; + + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); + udev_dev = udev_device_new_from_syspath(udev, syspath); + if (udev_dev == NULL) { + fprintf(stderr, "error: could not find '%s'\n", devpath); + goto exit; } - if (!quiet) - printf("Attempting to switch device %04x:%04x to %s mode ", - dev.vendor, dev.product, dev.mode ? "HID" : "HCI"); - fflush(stdout); + switch (method) { + case METHOD_CSR: + case METHOD_DELL: { + struct udev_device *dev; + struct usb_dev_handle *handle; + const char *type; + + /* get the parent usb_device if needed */ + dev = udev_dev; + type = udev_device_get_devtype(dev); + if (type == NULL || strcmp(type, "usb_device") != 0) { + dev = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device"); + if (dev == NULL) { + fprintf(stderr, "error: could not find usb_device for '%s'\n", devpath); + goto exit; + } + } - if (method(&dev) < 0 && !quiet) - printf("failed (%s)\n", strerror(errno)); - else if (!quiet) - printf("was successful\n"); + handle = find_device(dev, sibling_intf); + if (handle == NULL) { + fprintf(stderr, "error: unable to handle '%s' (intf=%s)\n", + udev_device_get_syspath(dev), sibling_intf); + goto exit; + } + err = usb_switch(handle, mode); + break; + } + case METHOD_LOGITECH_HID: { + const char *device; + + device = udev_device_get_devnode(udev_dev); + if (device == NULL) { + fprintf(stderr, "error: could not find hiddev device node\n"); + goto exit; + } + err = hid_switch_logitech(device); + break; + } + default: + break; + } - return errno; + if (err < 0) + fprintf(stderr, "error: switching device '%s' (intf=%s) failed.\n", + udev_device_get_syspath(udev_dev), sibling_intf); +exit: + udev_device_unref(udev_dev); + udev_unref(udev); + return rc; } -- cgit v1.2.3-54-g00ecf From 2a827c959a77eb6df9539235c46c96b78a824cf9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 25 Jul 2009 20:37:45 +0200 Subject: make: build internal tools against libudev-private.la --- NEWS | 5 +++++ extras/ata_id/Makefile.am | 11 +++++------ extras/cdrom_id/Makefile.am | 10 ++++------ extras/collect/Makefile.am | 10 +++++----- extras/edd_id/Makefile.am | 10 +++++----- extras/floppy/Makefile.am | 17 +++++------------ extras/fstab_import/Makefile.am | 8 +++----- extras/hid2hci/Makefile.am | 9 ++------- extras/path_id/Makefile.am | 12 +++++------- extras/scsi_id/Makefile.am | 9 ++++----- extras/udev-acl/Makefile.am | 2 +- extras/usb-db/Makefile.am | 4 ++-- extras/usb_id/Makefile.am | 12 +++++------- libudev/Makefile.am | 15 +++++++++++++++ udev/Makefile.am | 24 ++++-------------------- 15 files changed, 70 insertions(+), 88 deletions(-) diff --git a/NEWS b/NEWS index 1985d300d1..b36ace5c05 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +udev 146 +======== +New keymaps, new modem, hid2hci updated. + + udev 145 ======== Fix possible crash in udevd when worker processes are busy, rules are diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am index d0f467954e..54580661fe 100644 --- a/extras/ata_id/Makefile.am +++ b/extras/ata_id/Makefile.am @@ -4,9 +4,8 @@ libexec_PROGRAMS = \ ata_id ata_id_SOURCES = \ - ata_id.c \ - ../../libudev/libudev.h \ - ../../libudev/libudev-private.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-list.c \ - ../../libudev/libudev-util.c + ata_id.c + +ata_id_LDADD = \ + $(top_builddir)/libudev/libudev-private.la + diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am index d86e68e990..f2307d2e78 100644 --- a/extras/cdrom_id/Makefile.am +++ b/extras/cdrom_id/Makefile.am @@ -7,9 +7,7 @@ dist_udevrules_DATA = \ 60-cdrom_id.rules cdrom_id_SOURCES = \ - cdrom_id.c \ - ../../libudev/libudev.h \ - ../../libudev/libudev-private.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-list.c \ - ../../libudev/libudev-util.c + cdrom_id.c + +cdrom_id_LDADD = \ + $(top_builddir)/libudev/libudev-private.la diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am index 878b8ec133..19e25c5056 100644 --- a/extras/collect/Makefile.am +++ b/extras/collect/Makefile.am @@ -4,8 +4,8 @@ libexec_PROGRAMS = \ collect collect_SOURCES = \ - collect.c \ - ../../libudev/libudev-private.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-util.c \ - ../../libudev/libudev-list.c + collect.c + +collect_LDADD = \ + $(top_builddir)/libudev/libudev-private.la + diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am index 464e667fad..3ff562fdbd 100644 --- a/extras/edd_id/Makefile.am +++ b/extras/edd_id/Makefile.am @@ -7,8 +7,8 @@ dist_udevrules_DATA = \ 61-persistent-storage-edd.rules edd_id_SOURCES = \ - edd_id.c \ - ../../libudev/libudev.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-list.c \ - ../../libudev/libudev-util.c + edd_id.c + +edd_id_LDADD = \ + $(top_builddir)/libudev/libudev-private.la + diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am index 3160ce5e76..05f7a0f167 100644 --- a/extras/floppy/Makefile.am +++ b/extras/floppy/Makefile.am @@ -4,19 +4,12 @@ libexec_PROGRAMS = \ create_floppy_devices create_floppy_devices_SOURCES = \ - create_floppy_devices.c \ - ../../libudev/libudev.h \ - ../../libudev/libudev-private.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-list.c \ - ../../libudev/libudev-util.c \ - ../../libudev/libudev-util-private.c \ - ../../libudev/libudev-device.c \ - ../../libudev/libudev-enumerate.c + create_floppy_devices.c -if WITH_SELINUX -create_floppy_devices_SOURCES += \ - ../../libudev/libudev-selinux-private.c create_floppy_devices_LDADD = \ + $(top_builddir)/libudev/libudev-private.la + +if WITH_SELINUX +create_floppy_devices_LDADD += \ $(SELINUX_LIBS) endif diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am index 59e208caba..bfa0c4b59e 100644 --- a/extras/fstab_import/Makefile.am +++ b/extras/fstab_import/Makefile.am @@ -7,9 +7,7 @@ dist_udevrules_DATA = \ 79-fstab_import.rules fstab_import_SOURCES = \ - fstab_import.c \ - ../../libudev/libudev.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-list.c \ - ../../libudev/libudev-util.c + fstab_import.c +fstab_import_LDADD = \ + $(top_builddir)/libudev/libudev-private.la diff --git a/extras/hid2hci/Makefile.am b/extras/hid2hci/Makefile.am index 5450c34198..f3a73c5e86 100644 --- a/extras/hid2hci/Makefile.am +++ b/extras/hid2hci/Makefile.am @@ -7,13 +7,8 @@ dist_udevrules_DATA = \ 70-hid2hci.rules hid2hci_SOURCES = \ - hid2hci.c \ - ../../libudev/libudev.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-list.c \ - ../../libudev/libudev-util.c \ - ../../libudev/libudev-device.c \ - ../../libudev/libudev-enumerate.c + hid2hci.c hid2hci_LDADD = \ + $(top_builddir)/libudev/libudev-private.la \ @LIBUSB_LIBS@ diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am index ca1c21eda5..ffcc51f106 100644 --- a/extras/path_id/Makefile.am +++ b/extras/path_id/Makefile.am @@ -4,10 +4,8 @@ libexec_PROGRAMS = \ path_id path_id_SOURCES = \ - path_id.c \ - ../../libudev/libudev.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-device.c \ - ../../libudev/libudev-enumerate.c \ - ../../libudev/libudev-list.c \ - ../../libudev/libudev-util.c + path_id.c + +path_id_LDADD = \ + $(top_builddir)/libudev/libudev-private.la + diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am index 641a340ddb..4c6fe471c3 100644 --- a/extras/scsi_id/Makefile.am +++ b/extras/scsi_id/Makefile.am @@ -8,11 +8,10 @@ scsi_id_SOURCES = \ scsi_serial.c \ scsi.h \ scsi_id.h \ - bsg.h \ - ../../libudev/libudev.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-list.c \ - ../../libudev/libudev-util.c + bsg.h + +scsi_id_LDADD = \ + $(top_builddir)/libudev/libudev-private.la dist_man_MANS = \ scsi_id.8 diff --git a/extras/udev-acl/Makefile.am b/extras/udev-acl/Makefile.am index 7586bb01c1..1b337c3a2c 100644 --- a/extras/udev-acl/Makefile.am +++ b/extras/udev-acl/Makefile.am @@ -10,7 +10,7 @@ udev_acl_CPPFLAGS = \ $(AM_CPPFLAGS) $(GLIB_CFLAGS) udev_acl_LDADD = \ - -lacl $(top_builddir)/libudev/libudev.la $(GLIB_LIBS) + -lacl $(top_builddir)/libudev/libudev-private.la $(GLIB_LIBS) dist_udevrules_DATA = 70-acl.rules diff --git a/extras/usb-db/Makefile.am b/extras/usb-db/Makefile.am index 2ac61f6aa1..fa974b5f8f 100644 --- a/extras/usb-db/Makefile.am +++ b/extras/usb-db/Makefile.am @@ -10,7 +10,7 @@ usb_db_CPPFLAGS = \ $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB usb_db_LDADD = \ - $(top_builddir)/libudev/libudev.la + $(top_builddir)/libudev/libudev-private.la pci_db_SOURCES = \ @@ -20,4 +20,4 @@ pci_db_CPPFLAGS = \ $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI pci_db_LDADD = \ - $(top_builddir)/libudev/libudev.la + $(top_builddir)/libudev/libudev-private.la diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am index 6ea7b5132c..9d94493e7a 100644 --- a/extras/usb_id/Makefile.am +++ b/extras/usb_id/Makefile.am @@ -4,10 +4,8 @@ libexec_PROGRAMS = \ usb_id usb_id_SOURCES = \ - usb_id.c \ - ../../libudev/libudev.h \ - ../../libudev/libudev.c \ - ../../libudev/libudev-list.c \ - ../../libudev/libudev-util.c \ - ../../libudev/libudev-device.c \ - ../../libudev/libudev-enumerate.c + usb_id.c + +usb_id_LDADD = \ + $(top_builddir)/libudev/libudev-private.la + diff --git a/libudev/Makefile.am b/libudev/Makefile.am index e83888617a..6989bf31f3 100644 --- a/libudev/Makefile.am +++ b/libudev/Makefile.am @@ -28,6 +28,21 @@ libudev_la_SOURCES =\ libudev-monitor.c \ libudev-queue.c +noinst_LTLIBRARIES = \ + libudev-private.la + +libudev_private_la_SOURCES =\ + $(libudev_la_SOURCES) \ + libudev-ctrl.c \ + libudev-util-private.c \ + libudev-device-private.c \ + libudev-queue-private.c + +if WITH_SELINUX +libudev_private_la_SOURCES += \ + libudev-selinux-private.c +endif + LT_CURRENT=5 LT_REVISION=0 LT_AGE=5 diff --git a/udev/Makefile.am b/udev/Makefile.am index 6c0b94e2cf..f1d4d2d437 100644 --- a/udev/Makefile.am +++ b/udev/Makefile.am @@ -7,31 +7,16 @@ sbin_PROGRAMS = \ noinst_PROGRAMS = \ test-udev -common_ldadd = - -common_files = \ +common_files =\ udev.h \ udev-event.c \ udev-watch.c \ udev-node.c \ - udev-rules.c \ - ../libudev/libudev.h \ - ../libudev/libudev-private.h \ - ../libudev/libudev.c \ - ../libudev/libudev-list.c \ - ../libudev/libudev-util.c \ - ../libudev/libudev-util-private.c \ - ../libudev/libudev-device.c \ - ../libudev/libudev-device-private.c \ - ../libudev/libudev-monitor.c \ - ../libudev/libudev-enumerate.c \ - ../libudev/libudev-queue.c \ - ../libudev/libudev-queue-private.c \ - ../libudev/libudev-ctrl.c + udev-rules.c +common_ldadd = \ + $(top_builddir)/libudev/libudev-private.la if WITH_SELINUX -common_files += \ - ../libudev/libudev-selinux-private.c common_ldadd += \ $(SELINUX_LIBS) endif @@ -43,7 +28,6 @@ udevd_SOURCES = \ udevd_LDADD = \ $(common_ldadd) - udevadm_SOURCES = \ $(common_files) \ udevadm.c \ -- cgit v1.2.3-54-g00ecf From 3bf768245b98479a14190e1e1d32ef5fae3ddf8a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 27 Jul 2009 23:24:27 +0200 Subject: enumeration: move ALSA control devices to the end of the enumerated devices of each card Generally ALSA control devices should be the last ones to be processed for ACL changes and similar operations because they can then be used as indicators that ACL management finished for all device nodes of a specific card. This patch simple moves each controlC device behind all the pcmC devices (and similar). --- libudev/libudev-enumerate.c | 59 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 96cf060907..986c1fc3d5 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -190,7 +190,8 @@ static int syspath_cmp(const void *p1, const void *p2) return ret; } -static int devices_delay(struct udev *udev, const char *syspath) +/* For devices that should be moved to the absolute end of the list */ +static int devices_delay_end(struct udev *udev, const char *syspath) { static const char *delay_device_list[] = { "/block/md", @@ -210,6 +211,32 @@ static int devices_delay(struct udev *udev, const char *syspath) return 0; } +/* For devices that should just be moved a little bit later, just + * before the point where some common path prefix changes. Returns the + * number of characters that make up that common prefix */ +static size_t devices_delay_later(struct udev *udev, const char *syspath) +{ + const char *c; + + /* For sound cards the control device must be enumerated last + * to make sure it's the final device node that gets ACLs + * applied. Applications rely on this fact and use ACL changes + * on the control node as an indicator that the ACL change of + * the entire sound card completed. The kernel makes this + * guarantee when creating those devices, and hence we should + * too when enumerating them. */ + + if ((c = strstr(syspath, "/sound/card"))) { + c += 11; + c += strcspn(c, "/"); + + if (strncmp(c, "/controlC", 9) == 0) + return c - syspath + 1; + } + + return 0; +} + /** * udev_enumerate_get_list_entry: * @udev_enumerate: context @@ -223,7 +250,8 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude if (!udev_enumerate->devices_uptodate) { unsigned int i; unsigned int max; - struct syspath *prev = NULL; + struct syspath *prev = NULL, *move_later = NULL; + size_t move_later_prefix; udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); @@ -240,14 +268,39 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude prev = entry; /* skip to be delayed devices, and add them to the end of the list */ - if (devices_delay(udev_enumerate->udev, entry->syspath)) { + if (devices_delay_end(udev_enumerate->udev, entry->syspath)) { syspath_add(udev_enumerate, entry->syspath); continue; } + /* skip to be delayed devices, and move the to + * the point where the prefix changes. We can + * only move one item at a time. */ + if (!move_later) { + move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath); + + if (move_later_prefix > 0) { + move_later = entry; + continue; + } + } + + if (move_later && + strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) { + + udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, + move_later->syspath, NULL, 0, 0); + move_later = NULL; + } + udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, entry->syspath, NULL, 0, 0); } + + if (move_later) + udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, + move_later->syspath, NULL, 0, 0); + /* add and cleanup delayed devices from end of list */ for (i = max; i < udev_enumerate->devices_cur; i++) { struct syspath *entry = &udev_enumerate->devices[i]; -- cgit v1.2.3-54-g00ecf From 504a553e78eaf3f10a41f72c85a626d3942b13db Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Fri, 31 Jul 2009 22:26:10 -0700 Subject: fix util_lookup_group to handle large groups I have recently been getting the above message on fc11 and I have traced it down to a bug in util_lookup_group. As of 145 util_lookup_group reads: gid_t util_lookup_group(struct udev *udev, const char *group) { char *endptr; int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); char buf[buflen]; struct group grbuf; struct group *gr; gid_t gid = 0; if (strcmp(group, "root") == 0) return 0; gid = strtoul(group, &endptr, 10); if (endptr[0] == '\0') return gid; errno = 0; getgrnam_r(group, &grbuf, buf, buflen, &gr); if (gr != NULL) return gr->gr_gid; if (errno == 0 || errno == ENOENT || errno == ESRCH) err(udev, "specified group '%s' unknown\n", group); else err(udev, "error resolving group '%s': %m\n", group); return 0; } The errno value from getgrnam_r here is ERANGE which is documented as "Insufficient buffer space supplied". When I call get getgrnam_r with a large enough buffer everything works. Indicating that the problem is that sysconf is returning a value too small. A quick google search tells me that sysconf(_S_GETGR_R_SIZE_MAX) is documented as: > sysconf(_S_GETGR_R_SIZE_MAX) returns either -1 or a good > suggested starting value for buflen. It does not return the > worst case possible for buflen. In my case I have a group with about 50 users in /etc/group and that is what triggered the problem in udev and caused all of the udevs group lookups to fail. The following patch which dynamically allocates the group member buffer should fix this problem. Signed-off-by: "Eric W. Biederman" --- libudev/libudev-util-private.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index f7daa9460b..021734d772 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -149,8 +149,8 @@ uid_t util_lookup_user(struct udev *udev, const char *user) gid_t util_lookup_group(struct udev *udev, const char *group) { char *endptr; - int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); - char buf[buflen]; + int buflen; + char *buf; struct group grbuf; struct group *gr; gid_t gid = 0; @@ -161,15 +161,31 @@ gid_t util_lookup_group(struct udev *udev, const char *group) if (endptr[0] == '\0') return gid; - errno = 0; - getgrnam_r(group, &grbuf, buf, buflen, &gr); - if (gr != NULL) - return gr->gr_gid; - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err(udev, "specified group '%s' unknown\n", group); - else - err(udev, "error resolving group '%s': %m\n", group); - return 0; + buflen = sysconf(_SC_GETGR_R_SIZE_MAX); + if (buflen < 0) + buflen = 1000; + buf = NULL; + gid = 0; + for (;;) { + buf = realloc(buf, buflen); + if (!buf) + break; + errno = 0; + getgrnam_r(group, &grbuf, buf, buflen, &gr); + if (gr != NULL) + gid = gr->gr_gid; + else if (errno == ERANGE) { + buflen *= 2; + continue; + } + else if (errno == 0 || errno == ENOENT || errno == ESRCH) + err(udev, "specified group '%s' unknown\n", group); + else + err(udev, "error resolving group '%s': %m\n", group); + break; + } + free(buf); + return gid; } /* handle "[/]" format */ -- cgit v1.2.3-54-g00ecf From fc206fbe3e326f5acfc64243f9e04eecad121e27 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 1 Aug 2009 09:39:18 -0400 Subject: update a few years of copyright --- libudev/libudev-util-private.c | 4 ++-- libudev/libudev.c | 2 +- udev/udev-event.c | 2 +- udev/udev-node.c | 2 +- udev/udev-rules.c | 2 +- udev/udevadm-info.c | 2 +- udev/udevadm-monitor.c | 2 +- udev/udevadm-settle.c | 2 +- udev/udevadm-trigger.c | 2 +- udev/udevadm.c | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 021734d772..00d1c95d52 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2004-2009 Kay Sievers + * Copyright (C) 2003-2009 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -172,7 +172,7 @@ gid_t util_lookup_group(struct udev *udev, const char *group) break; errno = 0; getgrnam_r(group, &grbuf, buf, buflen, &gr); - if (gr != NULL) + if (gr != NULL) gid = gr->gr_gid; else if (errno == ERANGE) { buflen *= 2; diff --git a/libudev/libudev.c b/libudev/libudev.c index 695443cf3b..05b62efd86 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2009 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/udev/udev-event.c b/udev/udev-event.c index a407975f08..5716afef7a 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Kay Sievers + * Copyright (C) 2003-2009 Kay Sievers * * 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 diff --git a/udev/udev-node.c b/udev/udev-node.c index 89b674e4c4..03ab0ea86f 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Kay Sievers + * Copyright (C) 2003-2008 Kay Sievers * * 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 diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 96d7377472..a174d5db40 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2009 Kay Sievers + * Copyright (C) 2003-2009 Kay Sievers * Copyright (C) 2008 Alan Jenkins * * This program is free software: you can redistribute it and/or modify diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 88bb0d401f..519dc4a45b 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Kay Sievers + * Copyright (C) 2004-2009 Kay Sievers * * 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 diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index df1459ae17..90388db58e 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Kay Sievers + * Copyright (C) 2004-2009 Kay Sievers * * 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 diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 0b3f2e2124..682819201e 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006-2008 Kay Sievers + * Copyright (C) 2006-2009 Kay Sievers * Copyright (C) 2009 Canonical Ltd. * Copyright (C) 2009 Scott James Remnant * diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index db7d1e0571..a97feb79b3 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2009 Kay Sievers * * 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 diff --git a/udev/udevadm.c b/udev/udevadm.c index 99ac330082..b7295f3296 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 Kay Sievers + * Copyright (C) 2007-2009 Kay Sievers * * 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 -- cgit v1.2.3-54-g00ecf From d25645441549b3ca61b7257d6712da6facd411e7 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 27 Jul 2009 23:56:55 +0300 Subject: rules: exclude digitizers from joystick class Exclude digitizers and similar devices from ID_CLASS joystick by checking modalias for BTN_DIGI. This was also done for linux kernel joydev interface in linux commit d07a9cba6be5c0e947afc1014b5a62182a86f1f1. --- rules/rules.d/60-persistent-input.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index c733ad5605..c65517b8ae 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -16,8 +16,8 @@ DRIVERS=="atkbd", ENV{ID_CLASS}="kbd", GOTO="serial" DRIVERS=="psmouse", ENV{ID_CLASS}="mouse", GOTO="serial" ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir", GOTO="serial" -# joystick (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH -ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14A,*r*", \ +# joystick (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH && !BTN_DIGI +ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14[0A],*r*", \ ENV{ID_CLASS}="joystick", GOTO="serial" # fill empty serial number -- cgit v1.2.3-54-g00ecf From 2a0c6867cb0c8120cc1b8f48b755abb2a405fef7 Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Mon, 27 Jul 2009 23:59:44 +0300 Subject: udev-acl: add joystick devices User needs read-write access to joystick devices in order to use force feedback features. --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index f41bb66f7f..1222513623 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -44,6 +44,9 @@ SUBSYSTEM=="misc", KERNEL=="kvm", ENV{ACL_MANAGE}="1" # smart-card readers ENV{ID_SMARTCARD_READER}=="*?", ENV{ACL_MANAGE}="1" +# joysticks +SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ACL_MANAGE}="1" + # apply ACL for all locally logged in users LABEL="acl_apply", ENV{ACL_MANAGE}=="?*", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" -- cgit v1.2.3-54-g00ecf From 43c42ca454bccd0da581825d30bdb44b56ae3ef7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Aug 2009 15:37:55 +0200 Subject: libudev: silent gcc warning: may be used uninitialized in this function --- libudev/libudev-enumerate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 986c1fc3d5..e30a406e5a 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -251,7 +251,6 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude unsigned int i; unsigned int max; struct syspath *prev = NULL, *move_later = NULL; - size_t move_later_prefix; udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); @@ -259,6 +258,7 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude max = udev_enumerate->devices_cur; for (i = 0; i < max; i++) { struct syspath *entry = &udev_enumerate->devices[i]; + size_t move_later_prefix = 0; /* skip duplicated entries */ if (prev != NULL && -- cgit v1.2.3-54-g00ecf From 6e4025dfc8c2f6955d678b9f011c1d3b392a6e3e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Aug 2009 15:51:47 +0200 Subject: make: suppress enter/leaving directory messages --- Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.am b/Makefile.am index 5da4779fb8..bcc2f3b920 100644 --- a/Makefile.am +++ b/Makefile.am @@ -19,6 +19,8 @@ CLEANFILES = \ ACLOCAL_AMFLAGS = -I m4 +AM_MAKEFLAGS = --no-print-directory + DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ --enable-extras -- cgit v1.2.3-54-g00ecf From f7c5b04f69e004912327f082be8645b65bb1ff5d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Aug 2009 16:16:26 +0200 Subject: re-enable failed event tracking It did not work for the last couple of releases. If RUN{record_failed}+="..." is given, a non-zero execution will mark the event as failed. Recorded failed events can be re-triggered with: udevadm trigger --type=failed The failed tracking _might_ be useful for things which might not be ready to be executed at early bootup, but a bit later when the needed dependencies are available. In many cases though, it indicates that something is used in a way it should not. --- NEWS | 10 +++++++++- rules/rules.d/80-drivers.rules | 2 +- udev/udev-event.c | 2 +- udev/udev-rules.c | 2 +- udev/udev.xml | 5 ++++- udev/udevadm-trigger.c | 4 ---- udev/udevd.c | 12 ++++++++---- 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index b36ace5c05..0f41c18bbe 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,15 @@ udev 146 ======== -New keymaps, new modem, hid2hci updated. +Bugfixes. + +The udevadm trigger "--retry-failed" option, which is replaced since quite +a while by "--type=failed" is removed. +The failed tracking was not working at all for a few releases. The RUN +option "ignore_error" is replaces by a "record_failed" option, and the +default is not to track any failing RUN executions. + +New keymaps, new modem, hid2hci updated. udev 145 ======== diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index 63409cc01f..d0485e13c4 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -2,7 +2,7 @@ ACTION!="add", GOTO="drivers_end" -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN{ignore_error}+="/sbin/modprobe -b $env{MODALIAS}" +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -b $env{MODALIAS}" SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -b tifm_sd" SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -b tifm_ms" SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -b --all ms_block mspro_block" diff --git a/udev/udev-event.c b/udev/udev-event.c index 5716afef7a..6a8bb44cf4 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -741,7 +741,7 @@ int udev_event_execute_run(struct udev_event *event) udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); if (util_run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { - if (!udev_list_entry_get_flag(list_entry)) + if (udev_list_entry_get_flag(list_entry)) err = -1; } } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index a174d5db40..5f6ed06c9c 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1379,7 +1379,7 @@ static int add_rule(struct udev_rules *rules, char *line, int flag = 0; attr = get_key_attribute(rules->udev, key + sizeof("RUN")-1); - if (attr != NULL && strstr(attr, "ignore_error")) + if (attr != NULL && strstr(attr, "record_failed")) flag = 1; rule_add_key(&rule_tmp, TK_A_RUN, op, value, &flag); continue; diff --git a/udev/udev.xml b/udev/udev.xml index 934fe628ae..5aa6c38da4 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -335,7 +335,10 @@ device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately - detached from the event process itself. + detached from the event process itself. If the option + is specified, + and the executed program returns non-zero, the event will be marked as failed + for a possible later handling. If the specified string starts with , all current event values will be passed to the specified socket, as a message in the same diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index a97feb79b3..5cd4acd6ed 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -95,7 +95,6 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { "verbose", no_argument, NULL, 'v' }, { "dry-run", no_argument, NULL, 'n' }, { "type", required_argument, NULL, 't' }, - { "retry-failed", no_argument, NULL, 'F' }, { "action", required_argument, NULL, 'c' }, { "subsystem-match", required_argument, NULL, 's' }, { "subsystem-nomatch", required_argument, NULL, 'S' }, @@ -153,9 +152,6 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) goto exit; } break; - case 'F': - device_type = TYPE_FAILED; - break; case 'c': action = optarg; break; diff --git a/udev/udevd.c b/udev/udevd.c index 69d509ce91..4024460d4b 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -165,7 +165,7 @@ static void event_queue_delete(struct event *event) udev_list_node_remove(&event->node); /* mark as failed, if "add" event returns non-zero */ - if (event->exitcode && strcmp(udev_device_get_action(event->dev), "add") == 0) + if (event->exitcode != 0 && strcmp(udev_device_get_action(event->dev), "add") == 0) udev_queue_export_device_failed(udev_queue_export, event->dev); else udev_queue_export_device_finished(udev_queue_export, event->dev); @@ -271,8 +271,9 @@ static void worker_new(struct event *event) do { struct udev_event *udev_event; - struct worker_message msg; + struct worker_message msg = {}; int err; + int failed = 0; info(event->udev, "seq %llu running\n", udev_device_get_seqnum(dev)); udev_event = udev_event_new(dev); @@ -291,7 +292,7 @@ static void worker_new(struct event *event) /* execute RUN= */ if (err == 0 && !udev_event->ignore_device && udev_get_run(udev_event->udev)) - udev_event_execute_run(udev_event); + failed = udev_event_execute_run(udev_event); /* reset alarm */ alarm(0); @@ -306,7 +307,10 @@ static void worker_new(struct event *event) udev_monitor_send_device(worker_monitor, NULL, dev); /* send back the result of the event execution */ - msg.exitcode = err; + if (err != 0) + msg.exitcode = err; + else if (failed != 0) + msg.exitcode = failed; msg.pid = getpid(); send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); -- cgit v1.2.3-54-g00ecf From 16dd0aa9223b5e3fc281765ac809754716266456 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Aug 2009 19:23:06 +0200 Subject: "record_failed" -> "fail_event_on_error" --- NEWS | 2 +- udev/udev-rules.c | 2 +- udev/udev.xml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 0f41c18bbe..914b9498fa 100644 --- a/NEWS +++ b/NEWS @@ -6,7 +6,7 @@ The udevadm trigger "--retry-failed" option, which is replaced since quite a while by "--type=failed" is removed. The failed tracking was not working at all for a few releases. The RUN -option "ignore_error" is replaces by a "record_failed" option, and the +option "ignore_error" is replaced by a "fail_event_on_error" option, and the default is not to track any failing RUN executions. New keymaps, new modem, hid2hci updated. diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 5f6ed06c9c..03234fe2a1 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1379,7 +1379,7 @@ static int add_rule(struct udev_rules *rules, char *line, int flag = 0; attr = get_key_attribute(rules->udev, key + sizeof("RUN")-1); - if (attr != NULL && strstr(attr, "record_failed")) + if (attr != NULL && strstr(attr, "fail_event_on_error")) flag = 1; rule_add_key(&rule_tmp, TK_A_RUN, op, value, &flag); continue; diff --git a/udev/udev.xml b/udev/udev.xml index 5aa6c38da4..56fda1070d 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -336,9 +336,9 @@ event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately detached from the event process itself. If the option - is specified, - and the executed program returns non-zero, the event will be marked as failed - for a possible later handling. + is + specified, and the executed program returns non-zero, the event will be + marked as failed for a possible later handling. If the specified string starts with , all current event values will be passed to the specified socket, as a message in the same -- cgit v1.2.3-54-g00ecf From 8aba9a4bcabb791fa4dae89bc2d2ac194793ae9a Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Fri, 7 Aug 2009 02:23:44 +0200 Subject: hid2hci: install re-trigger for hid device when recovering from S3 --- extras/hid2hci/70-hid2hci.rules | 6 +-- extras/hid2hci/hid2hci.c | 82 +++++------------------------------------ 2 files changed, 13 insertions(+), 75 deletions(-) diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index 1af356c993..b332c168e9 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add", GOTO="hid2hci_end" +ACTION!="add|change", GOTO="hid2hci_end" SUBSYSTEM!="usb", GOTO="hid2hci_end" # Variety of Dell Bluetooth devices - match on a mouse device that is @@ -8,7 +8,7 @@ SUBSYSTEM!="usb", GOTO="hid2hci_end" # Known supported devices: 413c:8154, 413c:8158, 413c:8162 ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProtocol}=="02", \ ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ - RUN+="hid2hci --method=dell --devpath=%p" + RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" # Logitech devices (hidraw) KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ @@ -21,7 +21,7 @@ ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" # device needs to be chased down on the USB bus. ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", \ ATTR{idVendor}=="413c", ATTR{bmAttributes}=="e0", \ - ENV{REMOVE_CMD}="hid2hci --method=dell --devpath=%p --find-sibling-intf=03:01:02" + ENV{REMOVE_CMD}="/sbin/udevadm trigger --action=change --subsystem-match=usb --property-match=HID2HCI_SWITCH=1" # CSR devices ATTR{idVendor}=="0a12|0458|05ac", ATTR{idProduct}=="1000", RUN+="hid2hci --method=csr --devpath=%p" diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c index 298ac39ec0..0d0a022d52 100644 --- a/extras/hid2hci/hid2hci.c +++ b/extras/hid2hci/hid2hci.c @@ -191,70 +191,14 @@ static struct usb_device *usb_device_open_from_udev(struct udev_device *usb_dev) return NULL; } -static struct usb_dev_handle *find_device(struct udev_device *udev_dev, const char *sibling_intf) +static struct usb_dev_handle *find_device(struct udev_device *udev_dev) { - struct udev *udev = udev_device_get_udev(udev_dev); struct usb_device *dev; - struct udev_device *udev_parent; - char str[UTIL_NAME_SIZE]; - struct udev_enumerate *enumerate; - struct udev_list_entry *entry; - struct usb_dev_handle *handle = NULL; - - if (sibling_intf == NULL) { - dev = usb_device_open_from_udev(udev_dev); - if (dev == NULL) - return NULL; - return usb_open(dev); - } - - /* find matching sibling of the current usb_device, they share the same hub */ - udev_parent = udev_device_get_parent_with_subsystem_devtype(udev_dev, "usb", "usb_device"); - if (udev_parent == NULL) - return NULL; - enumerate = udev_enumerate_new(udev); - if (enumerate == NULL) + dev = usb_device_open_from_udev(udev_dev); + if (dev == NULL) return NULL; - - udev_enumerate_add_match_subsystem(enumerate, "usb"); - - /* match all childs of the parent */ - util_strscpyl(str, sizeof(str), udev_device_get_sysname(udev_parent), "*", NULL); - udev_enumerate_add_match_sysname(enumerate, str); - - /* match the specified interface */ - util_strscpy(str, sizeof(str), sibling_intf); - str[2] = '\0'; - str[5] = '\0'; - str[8] = '\0'; - if (strcmp(str, "-1") != 0) - udev_enumerate_add_match_sysattr(enumerate, "bInterfaceClass", str); - if (strcmp(&str[3], "-1") != 0) - udev_enumerate_add_match_sysattr(enumerate, "bInterfaceSubClass", &str[3]); - if (strcmp(&str[6], "-1") != 0) - udev_enumerate_add_match_sysattr(enumerate, "bInterfaceProtocol", &str[6]); - - udev_enumerate_scan_devices(enumerate); - udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *udev_device; - - udev_device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(entry)); - if (udev_device != NULL) { - /* get the usb_device of the usb_interface we matched */ - udev_parent = udev_device_get_parent_with_subsystem_devtype(udev_device, "usb", "usb_device"); - if (udev_parent == NULL) - continue; - /* only look at the first matching device */ - dev = usb_device_open_from_udev(udev_parent); - if (dev != NULL) - handle = usb_open(dev); - udev_device_unref(udev_device); - break; - } -} - udev_enumerate_unref(enumerate); - return handle; + return usb_open(dev); } static void usage(const char *error) @@ -268,7 +212,6 @@ static void usage(const char *error) " --mode= mode to switch to [hid|hci] (default hci)\n" " --devpath= sys device path\n" " --method= method to use to switch [csr|logitech-hid|dell]\n" - " --find-sibling-intf= find the sibling device with 00:00:00 (class:subclass:prot)\n" " --help\n\n"); } @@ -279,7 +222,6 @@ int main(int argc, char *argv[]) { "mode", required_argument, NULL, 'm' }, { "devpath", required_argument, NULL, 'p' }, { "method", required_argument, NULL, 'M' }, - { "find-sibling-intf", required_argument, NULL, 'I' }, { } }; enum method { @@ -294,14 +236,13 @@ int main(int argc, char *argv[]) int (*usb_switch)(struct usb_dev_handle *dev, enum mode mode) = NULL; enum mode mode = HCI; const char *devpath = NULL; - const char *sibling_intf = NULL; int err = -1; int rc = 1; for (;;) { int option; - option = getopt_long(argc, argv, "m:p:M:I:qh", options, NULL); + option = getopt_long(argc, argv, "m:p:M:qh", options, NULL); if (option == -1) break; @@ -333,9 +274,6 @@ int main(int argc, char *argv[]) exit(1); } break; - case 'I': - sibling_intf = optarg; - break; case 'h': usage(NULL); default: @@ -377,10 +315,10 @@ int main(int argc, char *argv[]) } } - handle = find_device(dev, sibling_intf); + handle = find_device(dev); if (handle == NULL) { - fprintf(stderr, "error: unable to handle '%s' (intf=%s)\n", - udev_device_get_syspath(dev), sibling_intf); + fprintf(stderr, "error: unable to handle '%s'\n", + udev_device_get_syspath(dev)); goto exit; } err = usb_switch(handle, mode); @@ -402,8 +340,8 @@ int main(int argc, char *argv[]) } if (err < 0) - fprintf(stderr, "error: switching device '%s' (intf=%s) failed.\n", - udev_device_get_syspath(udev_dev), sibling_intf); + fprintf(stderr, "error: switching device '%s' failed.\n", + udev_device_get_syspath(udev_dev)); exit: udev_device_unref(udev_dev); udev_unref(udev); -- cgit v1.2.3-54-g00ecf From 5e22aab2e953bda265e705d3a51ddd3a9b3334aa Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 7 Aug 2009 11:11:48 +0100 Subject: extras/keymap: Add Samsung NC20 Reported by Dirk Thierbach on hal ML. --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 877b8b8b5c..e8a82841a8 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -74,7 +74,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" -- cgit v1.2.3-54-g00ecf From 8e534e2a47385253a00ffa58247d69d079b66ca7 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Fri, 7 Aug 2009 13:28:27 +0100 Subject: man: fix unused, inaccurate metadata Dates aren't shown in the manpages. So they are not really useful, and no-one is going to remember to update them. "" sounds even less useful. I leave the unused "title" and "productname" tags. They could theoretically be useful, and aren't hard to maintain. We just need to fix the "title" for udevadm. Signed-off-by: Alan Jenkins --- udev/udev.xml | 2 -- udev/udevadm.xml | 3 +-- udev/udevd.xml | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 56fda1070d..0ea5892c7e 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -8,14 +8,12 @@ udev - August 2005 udev udev 7 - diff --git a/udev/udevadm.xml b/udev/udevadm.xml index e4151e0ed4..ad492494a1 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -7,8 +7,7 @@ udevadm - udevd - November 2007 + udevadm udev diff --git a/udev/udevd.xml b/udev/udevd.xml index 0df6f4ba59..5368f28144 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -8,7 +8,6 @@ udevd - August 2005 udev -- cgit v1.2.3-54-g00ecf From 5bdba42ddb9cda2858e042bac991f67ae36cc888 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Fri, 7 Aug 2009 13:29:49 +0100 Subject: man: SYMLINK can be matched as well as assigned If by-path / by-id links don't quite do what you want, this is a nice clean way to extend the behaviour. Real example: SYMLINK=="serial/by-id/usb-Novatel_Wireless_Inc*CDMA*-if00-port0", \\ SYMLINK+="cellcard" Some users ask how to do things like this. - create an additional link with a shorter name - create a link which matches more loosely (omit certain path segments e.g. serial numbers) - change permissions on certain USB device nodes Allow them to realize this without reading the friendly *.c files. Signed-off-by: Alan Jenkins --- udev/udev.xml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 0ea5892c7e..c34a106d20 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -166,6 +166,16 @@
                    + + + + Match the name of a symlink targeting the node. It can + be used once a SYMLINK key has been set in one of the preceding + rules. There may be multiple symlinks; only one needs to match. + + + + @@ -295,7 +305,7 @@ - The name of a symlink targeting the node. Every matching rule can add + The name of a symlink targeting the node. Every matching rule will add this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space character. -- cgit v1.2.3-54-g00ecf From 4de08374d010ca85a932e11f0bac441561a10608 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 7 Aug 2009 15:41:54 +0100 Subject: extras/keymap: Fix Bluetooth key on Acer Aspire 6920 See https://launchpad.net/bugs/407940 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index e8a82841a8..81011bbd75 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -52,7 +52,7 @@ ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*" ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|Aspire 6920", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" -- cgit v1.2.3-54-g00ecf From 59d93adb29fae25220955d44a5cd25f0d99e3528 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 02:01:29 +0200 Subject: Merge libudev, udev, and the unconditional extras in a single Makefile.am. Instead of using multiple recursive Makefile.am files, use a single Makefile.am that sets and builds all the basic suite of libraries and binaries for udev. This reduces the number of files in the source tree, and also reduces drastically the build time when using parallel-make. With this setup, all the compile steps will be executed in parallel, and just the linking stage will be (partially) serialised on the libraries creation. --- .gitignore | 1 + Makefile.am | 246 ++++++++++++++++++++++++++++++++++++-- configure.ac | 19 +-- docs/Makefile.am | 5 - extras/Makefile.am | 25 ---- extras/ata_id/Makefile.am | 11 -- extras/cdrom_id/Makefile.am | 13 -- extras/collect/Makefile.am | 11 -- extras/edd_id/Makefile.am | 14 --- extras/firmware/Makefile.am | 7 -- extras/floppy/Makefile.am | 15 --- extras/fstab_import/Makefile.am | 13 -- extras/path_id/Makefile.am | 11 -- extras/rule_generator/Makefile.am | 14 --- extras/scsi_id/Makefile.am | 18 --- extras/usb_id/Makefile.am | 11 -- extras/v4l_id/Makefile.am | 10 -- libudev/Makefile.am | 71 ----------- rules/Makefile.am | 27 ----- udev/Makefile.am | 74 ------------ 20 files changed, 241 insertions(+), 375 deletions(-) delete mode 100644 docs/Makefile.am delete mode 100644 extras/Makefile.am delete mode 100644 extras/ata_id/Makefile.am delete mode 100644 extras/cdrom_id/Makefile.am delete mode 100644 extras/collect/Makefile.am delete mode 100644 extras/edd_id/Makefile.am delete mode 100644 extras/firmware/Makefile.am delete mode 100644 extras/floppy/Makefile.am delete mode 100644 extras/fstab_import/Makefile.am delete mode 100644 extras/path_id/Makefile.am delete mode 100644 extras/rule_generator/Makefile.am delete mode 100644 extras/scsi_id/Makefile.am delete mode 100644 extras/usb_id/Makefile.am delete mode 100644 extras/v4l_id/Makefile.am delete mode 100644 libudev/Makefile.am delete mode 100644 rules/Makefile.am delete mode 100644 udev/Makefile.am diff --git a/.gitignore b/.gitignore index 2be332aa16..5a5c4a00b6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.la .libs .deps +.dirstamp Makefile Makefile.in aclocal.m4 diff --git a/Makefile.am b/Makefile.am index bcc2f3b920..b18ac91f00 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,18 +1,14 @@ include $(top_srcdir)/Makefile.am.inc -SUBDIRS = \ - docs \ - libudev \ - udev \ - rules \ - extras +SUBDIRS = . libudev/docs udevconfdir = $(sysconfdir)/udev dist_udevconf_DATA = \ udev.conf EXTRA_DIST = \ - autogen.sh + autogen.sh \ + libudev/exported_symbols CLEANFILES = \ udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 @@ -64,3 +60,239 @@ git-release: doc-sync: rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ rsync -av --delete extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/gudev/ + +include_HEADERS = libudev/libudev.h + +# ------------------------------------------------------------------------------ +# Libraries +# ------------------------------------------------------------------------------ +lib_LTLIBRARIES = libudev/libudev.la + +libudev_libudev_la_SOURCES =\ + libudev/libudev-private.h \ + libudev/libudev.c \ + libudev/libudev-list.c \ + libudev/libudev-util.c \ + libudev/libudev-device.c \ + libudev/libudev-enumerate.c \ + libudev/libudev-monitor.c \ + libudev/libudev-queue.c + +LIBUDEV_CURRENT=5 +LIBUDEV_REVISION=0 +LIBUDEV_AGE=5 +libudev_libudev_la_LDFLAGS = \ + -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \ + -export-symbols $(top_srcdir)/libudev/exported_symbols + +noinst_LTLIBRARIES = \ + libudev/libudev-private.la + +libudev_libudev_private_la_SOURCES =\ + $(libudev_libudev_la_SOURCES) \ + libudev/libudev-ctrl.c \ + libudev/libudev-util-private.c \ + libudev/libudev-device-private.c \ + libudev/libudev-queue-private.c + +libudev_libudev_private_la_LIBADD = + +# ------------------------------------------------------------------------------ +# Programs +# ------------------------------------------------------------------------------ + +sbin_PROGRAMS = \ + udev/udevd \ + udev/udevadm + +udev_common_sources =\ + udev/udev.h \ + udev/udev-event.c \ + udev/udev-watch.c \ + udev/udev-node.c \ + udev/udev-rules.c +udev_common_libs = libudev/libudev-private.la + +udev_udevd_SOURCES = \ + $(udev_common_sources) \ + udev/udevd.c + +udev_udevd_LDADD = $(udev_common_libs) + +udev_udevadm_SOURCES = \ + $(udev_common_sources) \ + udev/udevadm.c \ + udev/udevadm-info.c \ + udev/udevadm-control.c \ + udev/udevadm-test.c \ + udev/udevadm-monitor.c \ + udev/udevadm-settle.c \ + udev/udevadm-trigger.c + +udev_udevadm_LDADD = $(udev_common_libs) + +libexec_PROGRAMS = \ + extras/ata_id/ata_id \ + extras/cdrom_id/cdrom_id \ + extras/collect/collect \ + extras/edd_id/edd_id \ + extras/floppy/create_floppy_devices \ + extras/path_id/path_id \ + extras/fstab_import/fstab_import \ + extras/scsi_id/scsi_id \ + extras/usb_id/usb_id \ + extras/v4l_id/v4l_id + +dist_libexec_SCRIPTS = \ + extras/firmware/firmware.sh \ + extras/rule_generator/write_cd_rules \ + extras/rule_generator/write_net_rules + +udevhomedir = $(libexecdir) +dist_udevhome_DATA = \ + extras/rule_generator/rule_generator.functions + +extras_ata_id_ata_id_SOURCES = extras/ata_id/ata_id.c +extras_ata_id_ata_id_LDADD = libudev/libudev-private.la + +extras_cdrom_id_cdrom_id_SOURCES = extras/cdrom_id/cdrom_id.c +extras_cdrom_id_cdrom_id_LDADD = libudev/libudev-private.la + +extras_collect_collect_SOURCES = extras/collect/collect.c +extras_collect_collect_LDADD = libudev/libudev-private.la + +extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c +extras_edd_id_edd_id_LDADD = libudev/libudev-private.la + +extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c +extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la + +extras_path_id_path_id_SOURCES = extras/path_id/path_id.c +extras_path_id_path_id_LDADD = libudev/libudev-private.la + +extras_fstab_import_fstab_import_SOURCES = extras/fstab_import/fstab_import.c +extras_fstab_import_fstab_import_LDADD = libudev/libudev-private.la + +extras_scsi_id_scsi_id_SOURCES =\ + extras/scsi_id/scsi_id.c \ + extras/scsi_id/scsi_serial.c \ + extras/scsi_id/scsi.h \ + extras/scsi_id/scsi_id.h \ + extras/scsi_id/bsg.h +extras_scsi_id_scsi_id_LDADD = libudev/libudev-private.la + +extras_usb_id_usb_id_SOURCES = extras/usb_id/usb_id.c +extras_usb_id_usb_id_LDADD = libudev/libudev-private.la + +extras_v4l_id_v4l_id_SOURCES = extras/v4l_id/v4l_id.c +extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la + +# ------------------------------------------------------------------------------ +# Tests +# ------------------------------------------------------------------------------ +check_PROGRAMS = \ + libudev/test-libudev \ + udev/test-udev + +libudev_test_libudev_SOURCES = libudev/test-libudev.c +libudev_test_libudev_LDADD = libudev/libudev.la + +udev_test_udev_SOURCES = \ + $(udev_common_sources) \ + udev/test-udev.c +udev_test_udev_LDADD = $(udev_common_libs) + +# ------------------------------------------------------------------------------ +# Basic rules +# ------------------------------------------------------------------------------ + +dist_udevrules_DATA = \ + rules/rules.d/50-udev-default.rules \ + rules/rules.d/60-persistent-storage.rules \ + rules/rules.d/60-persistent-storage-tape.rules \ + rules/rules.d/60-persistent-serial.rules \ + rules/rules.d/60-persistent-input.rules \ + rules/rules.d/60-persistent-alsa.rules \ + rules/rules.d/80-drivers.rules \ + rules/rules.d/95-udev-late.rules \ + extras/rule_generator/75-cd-aliases-generator.rules \ + extras/rule_generator/75-persistent-net-generator.rules \ + extras/cdrom_id/60-cdrom_id.rules \ + extras/edd_id/61-persistent-storage-edd.rules \ + extras/firmware/50-firmware.rules \ + extras/fstab_import/79-fstab_import.rules \ + extras/v4l_id/60-persistent-v4l.rules + +EXTRA_DIST += \ + rules/packages \ + rules/redhat \ + rules/suse \ + rules/gentoo + +# ------------------------------------------------------------------------------ +# Conditionals (SElinux, etc…) +# ------------------------------------------------------------------------------ +if WITH_SELINUX +libudev_libudev_private_la_SOURCES += \ + libudev/libudev-selinux-private.c +libudev_libudev_private_la_LIBADD += \ + $(SELINUX_LIBS) +endif + +if ENABLE_EXTRAS +dist_udevrules_DATA += \ + rules/rules.d/75-net-description.rules \ + rules/rules.d/75-tty-description.rules \ + rules/rules.d/78-sound-card.rules + +SUBDIRS += \ + extras/udev-acl \ + extras/usb-db \ + extras/hid2hci \ + extras/keymap \ + extras/modem-modeswitch \ + extras/gudev +endif + +# ------------------------------------------------------------------------------ +# Pkg-config, docs and man pages +# ------------------------------------------------------------------------------ +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = \ + libudev/libudev.pc \ + udev/udev.pc + +writing_udev_rulesdir = $(docdir)/writing_udev_rules +dist_writing_udev_rules_DATA = \ + docs/writing_udev_rules/index.html + +dist_man_MANS = \ + udev/udev.7 \ + udev/udevadm.8 \ + udev/udevd.8 \ + extras/scsi_id/scsi_id.8 + +EXTRA_DIST += \ + udev/udev.xml \ + udev/udevadm.xml \ + udev/udevd.xml + +%.7 %.8 : %.xml + $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + +# ------------------------------------------------------------------------------ +# Install and uninstall hooks +# ------------------------------------------------------------------------------ +# move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed +install-exec-hook: + if test "$(libdir)" != "$(rootlib_execdir)"; then \ + mkdir -p $(DESTDIR)$(rootlib_execdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libudev.so) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlib_execdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so && \ + mv $(DESTDIR)$(libdir)/libudev.so.* $(DESTDIR)$(rootlib_execdir); \ + fi + +uninstall-hook: + rm -f $(DESTDIR)$(rootlib_execdir)/libudev.so* + diff --git a/configure.ac b/configure.ac index d4fb4e19a0..9041eeda7d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_INIT([udev], [146], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) -AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2]) +AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_DISABLE_STATIC AC_USE_SYSTEM_EXTENSIONS @@ -101,27 +101,10 @@ AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile - docs/Makefile - libudev/Makefile libudev/libudev.pc libudev/docs/Makefile libudev/docs/version.xml - udev/Makefile udev/udev.pc - rules/Makefile - extras/Makefile - extras/ata_id/Makefile - extras/cdrom_id/Makefile - extras/edd_id/Makefile - extras/path_id/Makefile - extras/firmware/Makefile - extras/collect/Makefile - extras/floppy/Makefile - extras/fstab_import/Makefile - extras/rule_generator/Makefile - extras/scsi_id/Makefile - extras/usb_id/Makefile - extras/v4l_id/Makefile extras/hid2hci/Makefile extras/udev-acl/Makefile extras/usb-db/Makefile diff --git a/docs/Makefile.am b/docs/Makefile.am deleted file mode 100644 index 0c829b43f5..0000000000 --- a/docs/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -writing_udev_rulesdir = $(docdir)/writing_udev_rules -dist_writing_udev_rules_DATA = \ - writing_udev_rules/index.html diff --git a/extras/Makefile.am b/extras/Makefile.am deleted file mode 100644 index b7c9fe860d..0000000000 --- a/extras/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -SUBDIRS = \ - ata_id \ - cdrom_id \ - edd_id \ - path_id \ - firmware \ - collect \ - floppy \ - fstab_import \ - rule_generator \ - scsi_id \ - usb_id \ - v4l_id - -if ENABLE_EXTRAS -SUBDIRS += \ - udev-acl \ - usb-db \ - hid2hci \ - keymap \ - modem-modeswitch \ - gudev -endif diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am deleted file mode 100644 index 54580661fe..0000000000 --- a/extras/ata_id/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - ata_id - -ata_id_SOURCES = \ - ata_id.c - -ata_id_LDADD = \ - $(top_builddir)/libudev/libudev-private.la - diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am deleted file mode 100644 index f2307d2e78..0000000000 --- a/extras/cdrom_id/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - cdrom_id - -dist_udevrules_DATA = \ - 60-cdrom_id.rules - -cdrom_id_SOURCES = \ - cdrom_id.c - -cdrom_id_LDADD = \ - $(top_builddir)/libudev/libudev-private.la diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am deleted file mode 100644 index 19e25c5056..0000000000 --- a/extras/collect/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - collect - -collect_SOURCES = \ - collect.c - -collect_LDADD = \ - $(top_builddir)/libudev/libudev-private.la - diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am deleted file mode 100644 index 3ff562fdbd..0000000000 --- a/extras/edd_id/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - edd_id - -dist_udevrules_DATA = \ - 61-persistent-storage-edd.rules - -edd_id_SOURCES = \ - edd_id.c - -edd_id_LDADD = \ - $(top_builddir)/libudev/libudev-private.la - diff --git a/extras/firmware/Makefile.am b/extras/firmware/Makefile.am deleted file mode 100644 index b398beea76..0000000000 --- a/extras/firmware/Makefile.am +++ /dev/null @@ -1,7 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -dist_libexec_SCRIPTS = \ - firmware.sh - -dist_udevrules_DATA = \ - 50-firmware.rules diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am deleted file mode 100644 index 05f7a0f167..0000000000 --- a/extras/floppy/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - create_floppy_devices - -create_floppy_devices_SOURCES = \ - create_floppy_devices.c - -create_floppy_devices_LDADD = \ - $(top_builddir)/libudev/libudev-private.la - -if WITH_SELINUX -create_floppy_devices_LDADD += \ - $(SELINUX_LIBS) -endif diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am deleted file mode 100644 index bfa0c4b59e..0000000000 --- a/extras/fstab_import/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - fstab_import - -dist_udevrules_DATA = \ - 79-fstab_import.rules - -fstab_import_SOURCES = \ - fstab_import.c - -fstab_import_LDADD = \ - $(top_builddir)/libudev/libudev-private.la diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am deleted file mode 100644 index ffcc51f106..0000000000 --- a/extras/path_id/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - path_id - -path_id_SOURCES = \ - path_id.c - -path_id_LDADD = \ - $(top_builddir)/libudev/libudev-private.la - diff --git a/extras/rule_generator/Makefile.am b/extras/rule_generator/Makefile.am deleted file mode 100644 index 4f4e85ac87..0000000000 --- a/extras/rule_generator/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -dist_libexec_SCRIPTS = \ - write_cd_rules \ - write_net_rules - -udevhomedir = $(libexecdir) -dist_udevhome_DATA = \ - rule_generator.functions - -dist_udevrules_DATA = \ - 75-cd-aliases-generator.rules \ - 75-persistent-net-generator.rules - diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am deleted file mode 100644 index 4c6fe471c3..0000000000 --- a/extras/scsi_id/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - scsi_id - -scsi_id_SOURCES = \ - scsi_id.c \ - scsi_serial.c \ - scsi.h \ - scsi_id.h \ - bsg.h - -scsi_id_LDADD = \ - $(top_builddir)/libudev/libudev-private.la - -dist_man_MANS = \ - scsi_id.8 - diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am deleted file mode 100644 index 9d94493e7a..0000000000 --- a/extras/usb_id/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - usb_id - -usb_id_SOURCES = \ - usb_id.c - -usb_id_LDADD = \ - $(top_builddir)/libudev/libudev-private.la - diff --git a/extras/v4l_id/Makefile.am b/extras/v4l_id/Makefile.am deleted file mode 100644 index 9345282716..0000000000 --- a/extras/v4l_id/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - v4l_id - -dist_udevrules_DATA = \ - 60-persistent-v4l.rules - -v4l_id_SOURCES = \ - v4l_id.c diff --git a/libudev/Makefile.am b/libudev/Makefile.am deleted file mode 100644 index 6989bf31f3..0000000000 --- a/libudev/Makefile.am +++ /dev/null @@ -1,71 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -SUBDIRS = \ - docs - -noinst_PROGRAMS = \ - test-libudev - -test_libudev_SOURCES = \ - test-libudev.c - -test_libudev_LDADD = \ - libudev.la - -lib_LTLIBRARIES = \ - libudev.la - -include_HEADERS =\ - libudev.h - -libudev_la_SOURCES =\ - libudev-private.h \ - libudev.c \ - libudev-list.c \ - libudev-util.c \ - libudev-device.c \ - libudev-enumerate.c \ - libudev-monitor.c \ - libudev-queue.c - -noinst_LTLIBRARIES = \ - libudev-private.la - -libudev_private_la_SOURCES =\ - $(libudev_la_SOURCES) \ - libudev-ctrl.c \ - libudev-util-private.c \ - libudev-device-private.c \ - libudev-queue-private.c - -if WITH_SELINUX -libudev_private_la_SOURCES += \ - libudev-selinux-private.c -endif - -LT_CURRENT=5 -LT_REVISION=0 -LT_AGE=5 -libudev_la_LDFLAGS = \ - -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ - -export-symbols $(top_srcdir)/libudev/exported_symbols - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = \ - libudev.pc - -EXTRA_DIST = \ - exported_symbols - -# move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed -install-exec-hook: - if test "$(libdir)" != "$(rootlib_execdir)"; then \ - mkdir -p $(DESTDIR)$(rootlib_execdir) && \ - so_img_name=$$(readlink $(DESTDIR)$(libdir)/libudev.so) && \ - so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ - ln -sf $$so_img_rel_target_prefix$(rootlib_execdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so && \ - mv $(DESTDIR)$(libdir)/libudev.so.* $(DESTDIR)$(rootlib_execdir); \ - fi - -uninstall-hook: - rm -f $(DESTDIR)$(rootlib_execdir)/libudev.so* diff --git a/rules/Makefile.am b/rules/Makefile.am deleted file mode 100644 index 7247cef568..0000000000 --- a/rules/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -dist_udevrules_DATA = \ - rules.d/50-udev-default.rules \ - rules.d/60-persistent-storage.rules \ - rules.d/60-persistent-storage-tape.rules \ - rules.d/60-persistent-serial.rules \ - rules.d/60-persistent-input.rules \ - rules.d/60-persistent-alsa.rules \ - rules.d/80-drivers.rules \ - rules.d/95-udev-late.rules - -if ENABLE_EXTRAS -dist_udevrules_DATA += \ - rules.d/75-net-description.rules \ - rules.d/75-tty-description.rules \ - rules.d/78-sound-card.rules -endif - -install-data-local: - -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d - -EXTRA_DIST = \ - packages \ - redhat \ - suse \ - gentoo diff --git a/udev/Makefile.am b/udev/Makefile.am deleted file mode 100644 index f1d4d2d437..0000000000 --- a/udev/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -sbin_PROGRAMS = \ - udevd \ - udevadm - -noinst_PROGRAMS = \ - test-udev - -common_files =\ - udev.h \ - udev-event.c \ - udev-watch.c \ - udev-node.c \ - udev-rules.c - -common_ldadd = \ - $(top_builddir)/libudev/libudev-private.la -if WITH_SELINUX -common_ldadd += \ - $(SELINUX_LIBS) -endif - -udevd_SOURCES = \ - $(common_files) \ - udevd.c - -udevd_LDADD = \ - $(common_ldadd) - -udevadm_SOURCES = \ - $(common_files) \ - udevadm.c \ - udevadm-info.c \ - udevadm-control.c \ - udevadm-test.c \ - udevadm-monitor.c \ - udevadm-settle.c \ - udevadm-trigger.c - -udevadm_LDADD = \ - $(common_ldadd) - - -test_udev_SOURCES = \ - $(common_files) \ - test-udev.c - -test_udev_LDADD = \ - $(common_ldadd) - - -dist_man_MANS = \ - udev.7 \ - udevadm.8 \ - udevd.8 - -pkgconfigdir = $(datadir)/pkgconfig -pkgconfig_DATA = udev.pc - -EXTRA_DIST = \ - udev.pc.in \ - udev.xml \ - udevadm.xml \ - udevd.xml - -%.7 %.8 : %.xml - $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< - -MAINTAINERCLEANFILES = \ - $(dist_man_MANS) - -git-clean: - rm -f Makefile.in -- cgit v1.2.3-54-g00ecf From 405e606f8649fd87a8a1d2e5a6399c27dcae28b8 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 02:23:01 +0200 Subject: Replace the custom test-run target with the standard make check. A little fix is needed for the udev-test.pl script (to be called with the proper path), but this allows for the test binaries to be only built when running the tests themselves. --- Makefile.am | 6 +++--- test/udev-test.pl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index b18ac91f00..6aacd7be94 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,9 +41,6 @@ changelog: @ cat ChangeLog.tmp >> ChangeLog @ rm ChangeLog.tmp -test-run: - cd test && ./udev-test.pl - test-install: rm -rf $(PWD)/udev-test-install/ make DESTDIR=$(PWD)/udev-test-install install @@ -190,6 +187,9 @@ extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ # Tests # ------------------------------------------------------------------------------ + +TESTS = test/udev-test.pl + check_PROGRAMS = \ libudev/test-libudev \ udev/test-udev diff --git a/test/udev-test.pl b/test/udev-test.pl index 5516468bb7..e90cd14612 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -22,7 +22,7 @@ use strict; my $PWD = $ENV{PWD}; my $sysfs = "sys/"; -my $udev_bin = "../udev/test-udev"; +my $udev_bin = "udev/test-udev"; my $valgrind = 0; my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; my $udev_root = "udev-root/"; -- cgit v1.2.3-54-g00ecf From b02140b6bcd080c5fd60306a493447ce7afdad64 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 02:38:02 +0200 Subject: Also merge into the top-level Makefile.am the simpler extras. --- Makefile.am | 56 ++++++++++++++++++++++++++++++++----- configure.ac | 4 --- extras/hid2hci/Makefile.am | 14 ---------- extras/modem-modeswitch/Makefile.am | 23 --------------- extras/udev-acl/Makefile.am | 19 ------------- extras/usb-db/Makefile.am | 23 --------------- 6 files changed, 49 insertions(+), 90 deletions(-) delete mode 100644 extras/hid2hci/Makefile.am delete mode 100644 extras/modem-modeswitch/Makefile.am delete mode 100644 extras/udev-acl/Makefile.am delete mode 100644 extras/usb-db/Makefile.am diff --git a/Makefile.am b/Makefile.am index 6aacd7be94..0aa8c071ad 100644 --- a/Makefile.am +++ b/Makefile.am @@ -184,6 +184,33 @@ extras_usb_id_usb_id_LDADD = libudev/libudev-private.la extras_v4l_id_v4l_id_SOURCES = extras/v4l_id/v4l_id.c extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la +extras_hid2hci_hid2hci_SOURCES = extras/hid2hci/hid2hci.c +extras_hid2hci_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) +extras_hid2hci_hid2hci_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) + +extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c +extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) +extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) + +extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c +extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB +extras_usb_db_usb_db_LDADD = libudev/libudev-private.la + +extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c +extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_PCI +extras_usb_db_pci_db_LDADD = libudev/libudev-private.la + +extras_modem_modeswitch_modem_modeswitch_SOURCES =\ + extras/modem-modeswitch/modem-modeswitch.c \ + extras/modem-modeswitch/utils.c \ + extras/modem-modeswitch/utils.h \ + extras/modem-modeswitch/ma8280p_us.c \ + extras/modem-modeswitch/ma8280p_us.h \ + extras/modem-modeswitch/option.c \ + extras/modem-modeswitch/option.h +extras_modem_modeswitch_modem_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) +extras_modem_modeswitch_modem_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) + # ------------------------------------------------------------------------------ # Tests # ------------------------------------------------------------------------------ @@ -243,14 +270,22 @@ if ENABLE_EXTRAS dist_udevrules_DATA += \ rules/rules.d/75-net-description.rules \ rules/rules.d/75-tty-description.rules \ - rules/rules.d/78-sound-card.rules + rules/rules.d/78-sound-card.rules \ + extras/hid2hci/70-hid2hci.rules \ + extras/modem-modeswitch/61-option-modem-modeswitch.rules \ + extras/modem-modeswitch/61-mobile-action.rules + +libexec_PROGRAMS += \ + extras/hid2hci/hid2hci \ + extras/udev-acl/udev-acl \ + extras/usb-db/usb-db \ + extras/usb-db/pci-db \ + extras/modem-modeswitch/modem-modeswitch + +install-exec-hook: udevacl-install-hook SUBDIRS += \ - extras/udev-acl \ - extras/usb-db \ - extras/hid2hci \ extras/keymap \ - extras/modem-modeswitch \ extras/gudev endif @@ -283,8 +318,12 @@ EXTRA_DIST += \ # ------------------------------------------------------------------------------ # Install and uninstall hooks # ------------------------------------------------------------------------------ +install-exec-hook: libudev-install-move-hook + +uninstall-hook: libudev-uninstall-move-hook + # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed -install-exec-hook: +libudev-install-move-hook: if test "$(libdir)" != "$(rootlib_execdir)"; then \ mkdir -p $(DESTDIR)$(rootlib_execdir) && \ so_img_name=$$(readlink $(DESTDIR)$(libdir)/libudev.so) && \ @@ -293,6 +332,9 @@ install-exec-hook: mv $(DESTDIR)$(libdir)/libudev.so.* $(DESTDIR)$(rootlib_execdir); \ fi -uninstall-hook: +libudev-uninstall-move-hook: rm -f $(DESTDIR)$(rootlib_execdir)/libudev.so* +udevacl-install-hook: + mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d + ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck diff --git a/configure.ac b/configure.ac index 9041eeda7d..a318768cd0 100644 --- a/configure.ac +++ b/configure.ac @@ -105,15 +105,11 @@ AC_CONFIG_FILES([ libudev/docs/Makefile libudev/docs/version.xml udev/udev.pc - extras/hid2hci/Makefile - extras/udev-acl/Makefile - extras/usb-db/Makefile extras/gudev/Makefile extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml extras/keymap/Makefile - extras/modem-modeswitch/Makefile ]) AC_OUTPUT diff --git a/extras/hid2hci/Makefile.am b/extras/hid2hci/Makefile.am deleted file mode 100644 index f3a73c5e86..0000000000 --- a/extras/hid2hci/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - hid2hci - -dist_udevrules_DATA = \ - 70-hid2hci.rules - -hid2hci_SOURCES = \ - hid2hci.c - -hid2hci_LDADD = \ - $(top_builddir)/libudev/libudev-private.la \ - @LIBUSB_LIBS@ diff --git a/extras/modem-modeswitch/Makefile.am b/extras/modem-modeswitch/Makefile.am deleted file mode 100644 index e3d18b8c52..0000000000 --- a/extras/modem-modeswitch/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - modem-modeswitch - -modem_modeswitch_SOURCES = \ - modem-modeswitch.c \ - utils.c \ - utils.h \ - ma8280p_us.c \ - ma8280p_us.h \ - option.c \ - option.h - -modem_modeswitch_CPPFLAGS = \ - $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) - -modem_modeswitch_LDADD = \ - $(LIBUSB_LIBS) - -dist_udevrules_DATA = \ - 61-option-modem-modeswitch.rules \ - 61-mobile-action.rules diff --git a/extras/udev-acl/Makefile.am b/extras/udev-acl/Makefile.am deleted file mode 100644 index 1b337c3a2c..0000000000 --- a/extras/udev-acl/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - udev-acl - -udev_acl_SOURCES = \ - udev-acl.c - -udev_acl_CPPFLAGS = \ - $(AM_CPPFLAGS) $(GLIB_CFLAGS) - -udev_acl_LDADD = \ - -lacl $(top_builddir)/libudev/libudev-private.la $(GLIB_LIBS) - -dist_udevrules_DATA = 70-acl.rules - -install-exec-hook: - mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d - ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck diff --git a/extras/usb-db/Makefile.am b/extras/usb-db/Makefile.am deleted file mode 100644 index fa974b5f8f..0000000000 --- a/extras/usb-db/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -libexec_PROGRAMS = \ - usb-db pci-db - -usb_db_SOURCES = \ - usb-db.c - -usb_db_CPPFLAGS = \ - $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB - -usb_db_LDADD = \ - $(top_builddir)/libudev/libudev-private.la - - -pci_db_SOURCES = \ - $(usb_db_SOURCES) - -pci_db_CPPFLAGS = \ - $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI - -pci_db_LDADD = \ - $(top_builddir)/libudev/libudev-private.la -- cgit v1.2.3-54-g00ecf From 402520cc08a66762a3683dfd11261f004fa42cb8 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 02:52:49 +0200 Subject: Change hook handling to be more portable. --- Makefile.am | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0aa8c071ad..5807cbbeb5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,6 +58,9 @@ doc-sync: rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ rsync -av --delete extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/gudev/ +INSTALL_EXEC_HOOKS = libudev-install-move-hook +UNINSTALL_EXEC_HOOKS = libudev-uninstall-move-hook + include_HEADERS = libudev/libudev.h # ------------------------------------------------------------------------------ @@ -267,6 +270,8 @@ libudev_libudev_private_la_LIBADD += \ endif if ENABLE_EXTRAS +INSTALL_EXEC_HOOKS += udevacl-install-hook + dist_udevrules_DATA += \ rules/rules.d/75-net-description.rules \ rules/rules.d/75-tty-description.rules \ @@ -282,7 +287,6 @@ libexec_PROGRAMS += \ extras/usb-db/pci-db \ extras/modem-modeswitch/modem-modeswitch -install-exec-hook: udevacl-install-hook SUBDIRS += \ extras/keymap \ @@ -318,9 +322,9 @@ EXTRA_DIST += \ # ------------------------------------------------------------------------------ # Install and uninstall hooks # ------------------------------------------------------------------------------ -install-exec-hook: libudev-install-move-hook +install-exec-hook: $(INSTALL_EXEC_HOOKS) -uninstall-hook: libudev-uninstall-move-hook +uninstall-hook: $(UNINSTALL_EXEC_HOOKS) # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed libudev-install-move-hook: -- cgit v1.2.3-54-g00ecf From 7d701b0e26f96c279ef9ba8e4ef82fc4fca56acf Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 02:58:23 +0200 Subject: Merge keymap building in the top-level Makefile.am. Slight adjustment around the tests and the rules for the new working directory. --- Makefile.am | 93 ++++++++++++++++++++++++++++++++++++++++-- configure.ac | 1 - extras/keymap/Makefile.am | 82 ------------------------------------- extras/keymap/check-keymaps.sh | 12 +++--- 4 files changed, 95 insertions(+), 93 deletions(-) delete mode 100644 extras/keymap/Makefile.am diff --git a/Makefile.am b/Makefile.am index 5807cbbeb5..1ebc5b6b59 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,6 +13,8 @@ EXTRA_DIST = \ CLEANFILES = \ udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 +BUILT_SOURCES = + ACLOCAL_AMFLAGS = -I m4 AM_MAKEFLAGS = --no-print-directory @@ -214,6 +216,11 @@ extras_modem_modeswitch_modem_modeswitch_SOURCES =\ extras_modem_modeswitch_modem_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) extras_modem_modeswitch_modem_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) +extras_keymap_keymap_SOURCES = extras/keymap/keymap.c +nodist_extras_keymap_keymap_SOURCES = \ + extras/keymap/keys-from-name.h \ + extras/keymap/keys-to-name.h + # ------------------------------------------------------------------------------ # Tests # ------------------------------------------------------------------------------ @@ -278,18 +285,80 @@ dist_udevrules_DATA += \ rules/rules.d/78-sound-card.rules \ extras/hid2hci/70-hid2hci.rules \ extras/modem-modeswitch/61-option-modem-modeswitch.rules \ - extras/modem-modeswitch/61-mobile-action.rules + extras/modem-modeswitch/61-mobile-action.rules \ + extras/keymap/95-keymap.rules libexec_PROGRAMS += \ extras/hid2hci/hid2hci \ extras/udev-acl/udev-acl \ extras/usb-db/usb-db \ extras/usb-db/pci-db \ - extras/modem-modeswitch/modem-modeswitch - + extras/modem-modeswitch/modem-modeswitch \ + extras/keymap/keymap + +dist_libexec_SCRIPTS += \ + extras/keymap/findkeyboards + +BUILT_SOURCES += \ + extras/keymap/keys-from-name.h \ + extras/keymap/keys-to-name.h + +TESTS += extras/keymap/check-keymaps.sh + +check_DATA = extras/keymap/keys.txt + +CLEANFILES += \ + extras/keymap/keys.txt \ + extras/keymap/keys-from-name.gperf \ + extras/keymap/keys-from-name.h \ + extras/keymap/keys-to-name.h + +dist_doc_DATA = extras/keymap/README.keymap.txt + +udevkeymapdir = $(libexecdir)/keymaps +dist_udevkeymap_DATA = \ + extras/keymap/keymaps/acer \ + extras/keymap/keymaps/acer-aspire_5920g \ + extras/keymap/keymaps/acer-travelmate_c300 \ + extras/keymap/keymaps/asus \ + extras/keymap/keymaps/compaq-e_evo \ + extras/keymap/keymaps/dell \ + extras/keymap/keymaps/everex-xt5000 \ + extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ + extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ + extras/keymap/keymaps/fujitsu-amilo_pro_v3205 \ + extras/keymap/keymaps/fujitsu-amilo_si_1520 \ + extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ + extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ + extras/keymap/keymaps/hewlett-packard \ + extras/keymap/keymaps/hewlett-packard-2510p_2530p \ + extras/keymap/keymaps/hewlett-packard-compaq_elitebook \ + extras/keymap/keymaps/hewlett-packard-pavilion \ + extras/keymap/keymaps/hewlett-packard-presario-2100 \ + extras/keymap/keymaps/hewlett-packard-tablet \ + extras/keymap/keymaps/hewlett-packard-tx2 \ + extras/keymap/keymaps/inventec-symphony_6.0_7.0 \ + extras/keymap/keymaps/lenovo-3000 \ + extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ + extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ + extras/keymap/keymaps/maxdata-pro_7000 \ + extras/keymap/keymaps/medion-fid2060 \ + extras/keymap/keymaps/medionnb-a555 \ + extras/keymap/keymaps/micro-star \ + extras/keymap/keymaps/module-asus-w3j \ + extras/keymap/keymaps/module-ibm \ + extras/keymap/keymaps/module-lenovo \ + extras/keymap/keymaps/module-sony \ + extras/keymap/keymaps/module-sony-old \ + extras/keymap/keymaps/oqo-model2 \ + extras/keymap/keymaps/samsung-other \ + extras/keymap/keymaps/samsung-sq1us \ + extras/keymap/keymaps/samsung-sx20s \ + extras/keymap/keymaps/toshiba-satellite_a100 \ + extras/keymap/keymaps/toshiba-satellite_a110 \ + extras/keymap/keymaps/zepto-znote SUBDIRS += \ - extras/keymap \ extras/gudev endif @@ -342,3 +411,19 @@ libudev-uninstall-move-hook: udevacl-install-hook: mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck + +# ------------------------------------------------------------------------------ +# Custom rules +# ------------------------------------------------------------------------------ + +extras/keymap/keys.txt: /usr/include/linux/input.h + $(AWK) '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ + +extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt + $(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ + +extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile + $(GPERF) -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ + +extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile + $(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ diff --git a/configure.ac b/configure.ac index a318768cd0..83e7a052fe 100644 --- a/configure.ac +++ b/configure.ac @@ -109,7 +109,6 @@ AC_CONFIG_FILES([ extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml - extras/keymap/Makefile ]) AC_OUTPUT diff --git a/extras/keymap/Makefile.am b/extras/keymap/Makefile.am deleted file mode 100644 index 7704ba7d91..0000000000 --- a/extras/keymap/Makefile.am +++ /dev/null @@ -1,82 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -dist_udevrules_DATA = 95-keymap.rules - -udevkeymapdir = $(libexecdir)/keymaps -udevkeymap_DATA = \ -keymaps/acer \ - keymaps/acer-aspire_5920g \ - keymaps/acer-travelmate_c300 \ - keymaps/asus \ - keymaps/compaq-e_evo \ - keymaps/dell \ - keymaps/everex-xt5000 \ - keymaps/fujitsu-amilo_pa_2548 \ - keymaps/fujitsu-amilo_pro_edition_v3505 \ - keymaps/fujitsu-amilo_pro_v3205 \ - keymaps/fujitsu-amilo_si_1520 \ - keymaps/fujitsu-esprimo_mobile_v5 \ - keymaps/fujitsu-esprimo_mobile_v6 \ - keymaps/hewlett-packard \ - keymaps/hewlett-packard-2510p_2530p \ - keymaps/hewlett-packard-compaq_elitebook \ - keymaps/hewlett-packard-pavilion \ - keymaps/hewlett-packard-presario-2100 \ - keymaps/hewlett-packard-tablet \ - keymaps/hewlett-packard-tx2 \ - keymaps/inventec-symphony_6.0_7.0 \ - keymaps/lenovo-3000 \ - keymaps/lenovo-thinkpad_x6_tablet \ - keymaps/lenovo-thinkpad_x200_tablet \ - keymaps/maxdata-pro_7000 \ - keymaps/medion-fid2060 \ - keymaps/medionnb-a555 \ - keymaps/micro-star \ - keymaps/module-asus-w3j \ - keymaps/module-ibm \ - keymaps/module-lenovo \ - keymaps/module-sony \ - keymaps/module-sony-old \ - keymaps/oqo-model2 \ - keymaps/samsung-other \ - keymaps/samsung-sq1us \ - keymaps/samsung-sx20s \ - keymaps/toshiba-satellite_a100 \ - keymaps/toshiba-satellite_a110 \ - keymaps/zepto-znote - -dist_libexec_SCRIPTS = findkeyboards - -libexec_PROGRAMS = keymap - -keymap_SOURCES = keymap.c -nodist_keymap_SOURCES = keys-from-name.h keys-to-name.h -keymap_CPPFLAGS = $(AM_CPPFLAGS) - -dist_doc_DATA = README.keymap.txt - -EXTRA_DIST = \ - keymaps \ - check-keymaps.sh - -BUILT_SOURCES = \ - keys-from-name.h \ - keys-to-name.h - -CLEANFILES = \ - keys.txt keys-from-name.gperf \ - keys-from-name.h keys-to-name.h - -TESTS = check-keymaps.sh - -keys.txt: /usr/include/linux/input.h - $(AWK) '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ - -keys-from-name.gperf: keys.txt - $(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ - -keys-from-name.h: keys-from-name.gperf Makefile - $(GPERF) -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ - -keys-to-name.h: keys.txt Makefile - $(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh index 15e8ef8c1e..f79c3f5a82 100755 --- a/extras/keymap/check-keymaps.sh +++ b/extras/keymap/check-keymaps.sh @@ -1,17 +1,17 @@ #!/bin/bash # check that all key names in keymaps/* are known in -KEYLIST=./keys.txt -RULES=95-keymap.rules +KEYLIST=extras/keymap/keys.txt +RULES=extras/keymap/95-keymap.rules [ -e "$KEYLIST" ] || { echo "need $KEYLIST please build first" >&2 exit 1 } -missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) <(awk '{print $2}' keymaps/*|sort -u)) +missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) <(awk '{print $2}' extras/keymap/keymaps/*|sort -u)) [ -z "$missing" ] || { - echo "ERROR: unknown key names in keymaps/*:" >&2 + echo "ERROR: unknown key names in extras/keymap/keymaps/*:" >&2 echo "$missing" >&2 exit 1 } @@ -22,11 +22,11 @@ for m in $maps; do # ignore inline mappings [ "$m" = "${m#0x}" ] || continue - [ -e keymaps/$m ] || { + [ -e extras/keymap/keymaps/$m ] || { echo "ERROR: unknown map name in $RULES: $m" >&2 exit 1 } - grep -q "keymaps/$m\>" Makefile.am || { + grep -q "extras/keymap/keymaps/$m\>" Makefile.am || { echo "ERROR: map file $m is not added to Makefile.am" >&2 exit 1 } -- cgit v1.2.3-54-g00ecf From c831e09b87752b47f32ec0a174075db974190693 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 03:00:23 +0200 Subject: Make keymap generation rules be silent (backward-compatible). --- Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 1ebc5b6b59..67a0fb08a7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -417,13 +417,13 @@ udevacl-install-hook: # ------------------------------------------------------------------------------ extras/keymap/keys.txt: /usr/include/linux/input.h - $(AWK) '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ + $(AM_V_GEN)$(AWK) '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt - $(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ + $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile - $(GPERF) -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ + $(AM_V_GEN)$(GPERF) -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile - $(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ + $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ -- cgit v1.2.3-54-g00ecf From 5b528d84796e64f42f97613b8479f22e500292f7 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 03:07:51 +0200 Subject: Move pkg-config docs and man pages before conditionals. Since gudev conditionally installs further pkg-config data, we have to set it before the condition might be expanded. --- Makefile.am | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Makefile.am b/Makefile.am index 67a0fb08a7..cc5c49ad6f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -266,6 +266,32 @@ EXTRA_DIST += \ rules/suse \ rules/gentoo +# ------------------------------------------------------------------------------ +# Pkg-config, docs and man pages +# ------------------------------------------------------------------------------ +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = \ + libudev/libudev.pc \ + udev/udev.pc + +writing_udev_rulesdir = $(docdir)/writing_udev_rules +dist_writing_udev_rules_DATA = \ + docs/writing_udev_rules/index.html + +dist_man_MANS = \ + udev/udev.7 \ + udev/udevadm.8 \ + udev/udevd.8 \ + extras/scsi_id/scsi_id.8 + +EXTRA_DIST += \ + udev/udev.xml \ + udev/udevadm.xml \ + udev/udevd.xml + +%.7 %.8 : %.xml + $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + # ------------------------------------------------------------------------------ # Conditionals (SElinux, etc…) # ------------------------------------------------------------------------------ @@ -362,32 +388,6 @@ SUBDIRS += \ extras/gudev endif -# ------------------------------------------------------------------------------ -# Pkg-config, docs and man pages -# ------------------------------------------------------------------------------ -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = \ - libudev/libudev.pc \ - udev/udev.pc - -writing_udev_rulesdir = $(docdir)/writing_udev_rules -dist_writing_udev_rules_DATA = \ - docs/writing_udev_rules/index.html - -dist_man_MANS = \ - udev/udev.7 \ - udev/udevadm.8 \ - udev/udevd.8 \ - extras/scsi_id/scsi_id.8 - -EXTRA_DIST += \ - udev/udev.xml \ - udev/udevadm.xml \ - udev/udevd.xml - -%.7 %.8 : %.xml - $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< - # ------------------------------------------------------------------------------ # Install and uninstall hooks # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From 33eb18305d9a53791afb80b975ab0eff22cda89e Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 03:16:32 +0200 Subject: Finally, also merge gudev into the top-level Makefile.am. The Introspection rules are not tested yet; more touch-ups have been made for them. --- Makefile.am | 114 ++++++++++++++++++++++++++++++++++++++++++++-- configure.ac | 1 - extras/gudev/Makefile.am | 115 ----------------------------------------------- 3 files changed, 110 insertions(+), 120 deletions(-) delete mode 100644 extras/gudev/Makefile.am diff --git a/Makefile.am b/Makefile.am index cc5c49ad6f..e18c121c24 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,10 @@ dist_udevconf_DATA = \ EXTRA_DIST = \ autogen.sh \ - libudev/exported_symbols + libudev/exported_symbols \ + extras/gudev/gudevmarshal.list \ + extras/gudev/gudevenumtypes.h.template \ + extras/gudev/gudevenumtypes.c.template CLEANFILES = \ udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 @@ -99,6 +102,45 @@ libudev_libudev_private_la_SOURCES =\ libudev_libudev_private_la_LIBADD = +extras_gudev_libgudev_1_0_la_SOURCES = \ + extras/gudev/gudevenums.h \ + extras/gudev/gudevenumtypes.h \ + extras/gudev/gudevenumtypes.h\ + extras/gudev/gudevtypes.h \ + extras/gudev/gudevclient.h \ + extras/gudev/gudevclient.c \ + extras/gudev/gudevdevice.h \ + extras/gudev/gudevdevice.c \ + extras/gudev/gudevprivate.h + +dist_extras_gudev_libgudev_1_0_la_SOURCES = \ + extras/gudev/gudevmarshal.h \ + extras/gudev/gudevmarshal.c \ + extras/gudev/gudevenumtypes.h \ + extras/gudev/gudevenumtypes.c + +extras_gudev_libgudev_1_0_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -I$(top_builddir)/extras \ + -I$(top_srcdir)/extras \ + -I$(top_builddir)/extras/gudev \ + -I$(top_srcdir)/extras/gudev \ + -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ + -D_GUDEV_COMPILATION \ + -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ + -DG_LOG_DOMAIN=\"GUdev\" +extras_gudev_libgudev_1_0_la_CFLAGS = $(GLIB_CFLAGS) +extras_gudev_libgudev_1_0_la_LIBADD = libudev/libudev.la $(GLIB_LIBS) + +LIBGUDEV_CURRENT=0 +LIBGUDEV_REVISION=1 +LIBGUDEV_AGE=0 + +extras_gudev_libgudev_1_0_la_LDFLAGS = \ + -version-info $(LIBGUDEV_CURRENT):$(LIBGUDEV_REVISION):$(LIBGUDEV_AGE) \ + -export-dynamic -no-undefined \ + -export-symbols-regex '^g_udev_.*' + # ------------------------------------------------------------------------------ # Programs # ------------------------------------------------------------------------------ @@ -305,6 +347,8 @@ endif if ENABLE_EXTRAS INSTALL_EXEC_HOOKS += udevacl-install-hook +lib_LTLIBRARIES += extras/gudev/libgudev-1.0.la + dist_udevrules_DATA += \ rules/rules.d/75-net-description.rules \ rules/rules.d/75-tty-description.rules \ @@ -326,8 +370,8 @@ dist_libexec_SCRIPTS += \ extras/keymap/findkeyboards BUILT_SOURCES += \ - extras/keymap/keys-from-name.h \ - extras/keymap/keys-to-name.h + $(nodist_extras_keymap_keymap_SOURCES) \ + $(dist_extras_gudev_libgudev_1_0_la_SOURCES) TESTS += extras/keymap/check-keymaps.sh @@ -384,10 +428,32 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/toshiba-satellite_a110 \ extras/keymap/keymaps/zepto-znote +libgudev_includedir=$(includedir)/gudev-1.0/gudev +libgudev_include_HEADERS = \ + extras/gudev/gudev.h \ + extras/gudev/gudevenums.h \ + extras/gudev/gudevenumtypes.h \ + extras/gudev/gudevtypes.h \ + extras/gudev/gudevclient.h \ + extras/gudev/gudevdevice.h + +pkgconfig_DATA += extras/gudev/gudev-1.0.pc + SUBDIRS += \ - extras/gudev + extras/gudev/docs endif +if ENABLE_INTROSPECTION +girdir = $(GIRDIR) +gir_DATA = extras/gudev/GUdev-1.0.gir + +typelibsdir = $(GIRTYPELIBDIR) +typelibs_DATA = extras/gudev/GUdev-1.0.typelib + +EXTRA_DIST += GUdev-1.0.gir +CLEANFILES += $(gir_DATA) $(typelibs_DATA) +endif # ENABLE_INTROSPECTION + # ------------------------------------------------------------------------------ # Install and uninstall hooks # ------------------------------------------------------------------------------ @@ -427,3 +493,43 @@ extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ + +extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list + glib-genmarshal $< --prefix=g_udev_marshal --header > $@ + +extras/gudev/gudevmarshal.c: extras/gudev/gudevmarshal.list + echo "#include \"gudevmarshal.h\"" > $@ && \ + glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ + +extras/gudev/gudevenumtypes.h: extras/gudev/gudevenumtypes.h.template extras/gudev/gudevenums.h + glib-mkenums --template $^ > \ + gudevenumtypes.h.tmp && mv gudevenumtypes.h.tmp gudevenumtypes.h + +extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gudev/gudevenums.h + glib-mkenums --template $^ > \ + gudevenumtypes.c.tmp && mv gudevenumtypes.c.tmp gudevenumtypes.c + +extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am + PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ + $(G_IR_SCANNER) -v \ + --namespace GUdev \ + --nsversion=1.0 \ + --include=GObject-2.0 \ + --library=gudev-1.0 \ + --output $@ \ + --pkg=glib-2.0 \ + --pkg=gobject-2.0 \ + -I$(top_srcdir)/extras \ + -D_GUDEV_COMPILATION \ + -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ + $(top_srcdir)/extras/gudev/gudev.h \ + $(top_srcdir)/extras/gudev/gudevtypes.h \ + $(top_srcdir)/extras/gudev/gudevenums.h \ + $(top_srcdir)/extras/gudev/gudevenumtypes.h \ + $(top_srcdir)/extras/gudev/gudevclient.h \ + $(top_srcdir)/extras/gudev/gudevdevice.h \ + $(top_srcdir)/extras/gudev/gudevclient.c \ + $(top_srcdir)/extras/gudev/gudevdevice.c + +extras/gudev/GUdev-1.0.typelib: extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) + g-ir-compiler $< -o $@ diff --git a/configure.ac b/configure.ac index 83e7a052fe..a38fd82075 100644 --- a/configure.ac +++ b/configure.ac @@ -105,7 +105,6 @@ AC_CONFIG_FILES([ libudev/docs/Makefile libudev/docs/version.xml udev/udev.pc - extras/gudev/Makefile extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml diff --git a/extras/gudev/Makefile.am b/extras/gudev/Makefile.am deleted file mode 100644 index 71565e2a48..0000000000 --- a/extras/gudev/Makefile.am +++ /dev/null @@ -1,115 +0,0 @@ -include $(top_srcdir)/Makefile.am.inc - -# putting ‘.’ first causes prefix ordering of directories -SUBDIRS = \ - . \ - docs - -AM_CPPFLAGS += \ - -I$(top_builddir)/extras \ - -I$(top_srcdir)/extras \ - -I$(top_builddir)/extras/gudev \ - -I$(top_srcdir)/extras/gudev \ - -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ - -D_GUDEV_COMPILATION \ - -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ - -DG_LOG_DOMAIN=\"GUdev\" - -BUILT_SOURCES = \ - gudevmarshal.h gudevmarshal.c \ - gudevenumtypes.h gudevenumtypes.c - -gudevmarshal.h: gudevmarshal.list - glib-genmarshal $< --prefix=g_udev_marshal --header > $@ - -gudevmarshal.c: gudevmarshal.list - echo "#include \"gudevmarshal.h\"" > $@ && \ - glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ - -gudevenumtypes.h: $(srcdir)/gudevenumtypes.h.template gudevenums.h - glib-mkenums --template $(srcdir)/gudevenumtypes.h.template gudevenums.h > \ - gudevenumtypes.h.tmp && mv gudevenumtypes.h.tmp gudevenumtypes.h - -gudevenumtypes.c: $(srcdir)/gudevenumtypes.c.template gudevenums.h - glib-mkenums --template $(srcdir)/gudevenumtypes.c.template gudevenums.h > \ - gudevenumtypes.c.tmp && mv gudevenumtypes.c.tmp gudevenumtypes.c - -lib_LTLIBRARIES = libgudev-1.0.la - -libgudev_1_0_includedir=$(includedir)/gudev-1.0/gudev -libgudev_1_0_include_HEADERS = \ - gudev.h \ - gudevenums.h \ - gudevenumtypes.h \ - gudevtypes.h \ - gudevclient.h \ - gudevdevice.h - -libgudev_1_0_la_SOURCES = \ - gudevenums.h \ - gudevenumtypes.h gudevenumtypes.h\ - gudevtypes.h \ - gudevclient.h gudevclient.c \ - gudevdevice.h gudevdevice.c \ - gudevprivate.h \ - $(BUILT_SOURCES) - -libgudev_1_0_la_CFLAGS = $(GLIB_CFLAGS) - -libgudev_1_0_la_LIBADD = $(top_builddir)/libudev/libudev.la $(GLIB_LIBS) - -LT_CURRENT=0 -LT_REVISION=1 -LT_AGE=0 -libgudev_1_0_la_LDFLAGS = \ - -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ - -export-dynamic -no-undefined \ - -export-symbols-regex '^g_udev_.*' - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = gudev-1.0.pc - -EXTRA_DIST = \ - gudev-1.0.pc.in \ - gudevmarshal.list \ - gudevenumtypes.h.template \ - gudevenumtypes.c.template - -CLEANFILES = $(BUILT_SOURCES) - -if ENABLE_INTROSPECTION -GUdev-1.0.gir: libgudev-1.0.la $(G_IR_SCANNER) Makefile.am - PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ - $(G_IR_SCANNER) -v \ - --namespace GUdev \ - --nsversion=1.0 \ - --include=GObject-2.0 \ - --library=gudev-1.0 \ - --output $@ \ - --pkg=glib-2.0 \ - --pkg=gobject-2.0 \ - -I$(top_srcdir)/extras \ - -D_GUDEV_COMPILATION \ - -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ - $(top_srcdir)/extras/gudev/gudev.h \ - $(top_srcdir)/extras/gudev/gudevtypes.h \ - $(top_srcdir)/extras/gudev/gudevenums.h \ - $(top_srcdir)/extras/gudev/gudevenumtypes.h \ - $(top_srcdir)/extras/gudev/gudevclient.h \ - $(top_srcdir)/extras/gudev/gudevdevice.h \ - $(top_srcdir)/extras/gudev/gudevclient.c \ - $(top_srcdir)/extras/gudev/gudevdevice.c - -girdir = $(GIRDIR) -gir_DATA = GUdev-1.0.gir - -typelibsdir = $(GIRTYPELIBDIR) -typelibs_DATA = GUdev-1.0.typelib - -GUdev-1.0.typelib: GUdev-1.0.gir $(G_IR_COMPILER) - g-ir-compiler GUdev-1.0.gir -o GUdev-1.0.typelib - -EXTRA_DIST += GUdev-1.0.gir -CLEANFILES += $(gir_DATA) $(typelibs_DATA) - -endif # ENABLE_INTROSPECTION -- cgit v1.2.3-54-g00ecf From ca7ad57020a3f8ffd71562de3bde355814725545 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 03:18:44 +0200 Subject: Make sure to clean up all the built sources. --- Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index e18c121c24..9a9ca78adc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -379,9 +379,7 @@ check_DATA = extras/keymap/keys.txt CLEANFILES += \ extras/keymap/keys.txt \ - extras/keymap/keys-from-name.gperf \ - extras/keymap/keys-from-name.h \ - extras/keymap/keys-to-name.h + extras/keymap/keys-from-name.gperf dist_doc_DATA = extras/keymap/README.keymap.txt @@ -454,6 +452,8 @@ EXTRA_DIST += GUdev-1.0.gir CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # ENABLE_INTROSPECTION +CLEANFILES += $(BUILT_SOURCES) + # ------------------------------------------------------------------------------ # Install and uninstall hooks # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From 8d28c2adbd146875667a0eecf2f2989a71e9caba Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 03:21:00 +0200 Subject: Make sure to use dependency/target variables. --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9a9ca78adc..4fc6240501 100644 --- a/Makefile.am +++ b/Makefile.am @@ -503,11 +503,11 @@ extras/gudev/gudevmarshal.c: extras/gudev/gudevmarshal.list extras/gudev/gudevenumtypes.h: extras/gudev/gudevenumtypes.h.template extras/gudev/gudevenums.h glib-mkenums --template $^ > \ - gudevenumtypes.h.tmp && mv gudevenumtypes.h.tmp gudevenumtypes.h + $@.tmp && mv $@.tmp $@ extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gudev/gudevenums.h glib-mkenums --template $^ > \ - gudevenumtypes.c.tmp && mv gudevenumtypes.c.tmp gudevenumtypes.c + $@.tmp && mv $@.tmp $@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ -- cgit v1.2.3-54-g00ecf From c860480dbb7b6c41bb811d96d27291f3b99751d6 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 03:22:21 +0200 Subject: Add silent-rule support for the gudev rules. --- Makefile.am | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 4fc6240501..eeef6beadb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -495,22 +495,22 @@ extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list - glib-genmarshal $< --prefix=g_udev_marshal --header > $@ + $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ extras/gudev/gudevmarshal.c: extras/gudev/gudevmarshal.list - echo "#include \"gudevmarshal.h\"" > $@ && \ + $(AM_V_GEN)echo "#include \"gudevmarshal.h\"" > $@ && \ glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ extras/gudev/gudevenumtypes.h: extras/gudev/gudevenumtypes.h.template extras/gudev/gudevenums.h - glib-mkenums --template $^ > \ + $(AM_V_GEN)glib-mkenums --template $^ > \ $@.tmp && mv $@.tmp $@ extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gudev/gudevenums.h - glib-mkenums --template $^ > \ + $(AM_V_GEN)glib-mkenums --template $^ > \ $@.tmp && mv $@.tmp $@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am - PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ + $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ $(G_IR_SCANNER) -v \ --namespace GUdev \ --nsversion=1.0 \ @@ -532,4 +532,4 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil $(top_srcdir)/extras/gudev/gudevdevice.c extras/gudev/GUdev-1.0.typelib: extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) - g-ir-compiler $< -o $@ + $(AM_V_GEN)g-ir-compiler $< -o $@ -- cgit v1.2.3-54-g00ecf From 3524b26220a424ce35bcfaf778002495f663eb26 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 11:04:58 +0200 Subject: Fix building of introspection library on top-level Makefile.am. Since the library is in a subdirectory, it has to know where to look for it. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index eeef6beadb..93302185e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -516,6 +516,7 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil --nsversion=1.0 \ --include=GObject-2.0 \ --library=gudev-1.0 \ + --library-path=extras/gudev \ --output $@ \ --pkg=glib-2.0 \ --pkg=gobject-2.0 \ -- cgit v1.2.3-54-g00ecf From 102831867ce5c0618fc06a9a3386881300d5994e Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 11:12:48 +0200 Subject: Fix another relative path for the new working directory. --- test/udev-test.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index e90cd14612..79ed247d46 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -21,7 +21,7 @@ use warnings; use strict; my $PWD = $ENV{PWD}; -my $sysfs = "sys/"; +my $sysfs = "test/sys/"; my $udev_bin = "udev/test-udev"; my $valgrind = 0; my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; -- cgit v1.2.3-54-g00ecf From 40e32b7160a459110caad0258d807decfcf8cde6 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 11:21:34 +0200 Subject: Include the correct directory for out-of-source builds. When building in-source, the source and header files are in the same directory, but they are not in out-of-source. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 93302185e3..f3f3940b01 100644 --- a/Makefile.am +++ b/Makefile.am @@ -259,6 +259,7 @@ extras_modem_modeswitch_modem_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLA extras_modem_modeswitch_modem_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) extras_keymap_keymap_SOURCES = extras/keymap/keymap.c +extras_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I extras/keymap nodist_extras_keymap_keymap_SOURCES = \ extras/keymap/keys-from-name.h \ extras/keymap/keys-to-name.h -- cgit v1.2.3-54-g00ecf From 1199a948e49758d067f33ed6ec6096c2edd9c25e Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 11:22:49 +0200 Subject: Add tests to the distribution; this fixes "make distcheck". --- Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.am b/Makefile.am index f3f3940b01..3d7c4d2618 100644 --- a/Makefile.am +++ b/Makefile.am @@ -455,6 +455,8 @@ endif # ENABLE_INTROSPECTION CLEANFILES += $(BUILT_SOURCES) +EXTRA_DIST += $(TESTS) + # ------------------------------------------------------------------------------ # Install and uninstall hooks # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From f5fcc00997481fb8b2898fc579eae5bcbf930fae Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 19:41:17 +0200 Subject: Ask gperf to use ANSI-C for generation. This avoids an '80s C prototype which caused a warning during our build. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3d7c4d2618..41d45a0127 100644 --- a/Makefile.am +++ b/Makefile.am @@ -492,7 +492,7 @@ extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile - $(AM_V_GEN)$(GPERF) -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ + $(AM_V_GEN)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ -- cgit v1.2.3-54-g00ecf From 51668e2c8b7ffba73ec420f9896ea837d58f7c15 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 19:44:30 +0200 Subject: Merge in Makefile.am.inc into Makefile.am This removes another file from the distribution, since we're not using it anywhere else but the top-level Makefile.am file. --- Makefile.am | 16 ++++++++++++++-- Makefile.am.inc | 14 -------------- 2 files changed, 14 insertions(+), 16 deletions(-) delete mode 100644 Makefile.am.inc diff --git a/Makefile.am b/Makefile.am index 41d45a0127..7d97af51e5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,3 @@ -include $(top_srcdir)/Makefile.am.inc - SUBDIRS = . libudev/docs udevconfdir = $(sysconfdir)/udev @@ -22,6 +20,20 @@ ACLOCAL_AMFLAGS = -I m4 AM_MAKEFLAGS = --no-print-directory +AM_CPPFLAGS = \ + -include $(top_builddir)/config.h \ + -I$(top_srcdir)/libudev \ + -DSYSCONFDIR=\""$(sysconfdir)"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" + +AM_CFLAGS = + +AM_LDFLAGS = \ + -Wl,--as-needed + +udevrulesdir = \ + $(libexecdir)/rules.d + DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ --enable-extras diff --git a/Makefile.am.inc b/Makefile.am.inc deleted file mode 100644 index 59d21aa22e..0000000000 --- a/Makefile.am.inc +++ /dev/null @@ -1,14 +0,0 @@ -AM_CPPFLAGS = \ - -include $(top_builddir)/config.h \ - -I$(top_srcdir)/libudev \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DLIBEXECDIR=\""$(libexecdir)"\" - -AM_CFLAGS = - -AM_LDFLAGS = \ - -Wl,--as-needed - -udevrulesdir = \ - $(libexecdir)/rules.d - -- cgit v1.2.3-54-g00ecf From eab32c2529ce53f9e01c12df739257511d58ebfb Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 20:05:55 +0200 Subject: Use the keymap check during “make distcheck” rather than “check”. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the check-keymaps.sh script checks for validity the source directory and the Makefile.am file, instead of running it during user-oriented “make check”, run it during developed-oriented “make distcheck”. An invalid keymap will abort the execution which will prevent shipping an incomplete Makefile.am. To properly support out-of-source builds, pass as single parameter to the test the path to the source directory. --- Makefile.am | 10 ++++++---- extras/keymap/check-keymaps.sh | 14 +++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7d97af51e5..c69529780d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,6 +7,7 @@ dist_udevconf_DATA = \ EXTRA_DIST = \ autogen.sh \ libudev/exported_symbols \ + extras/keymap/check-keymaps.sh \ extras/gudev/gudevmarshal.list \ extras/gudev/gudevenumtypes.h.template \ extras/gudev/gudevenumtypes.c.template @@ -386,10 +387,6 @@ BUILT_SOURCES += \ $(nodist_extras_keymap_keymap_SOURCES) \ $(dist_extras_gudev_libgudev_1_0_la_SOURCES) -TESTS += extras/keymap/check-keymaps.sh - -check_DATA = extras/keymap/keys.txt - CLEANFILES += \ extras/keymap/keys.txt \ extras/keymap/keys-from-name.gperf @@ -476,6 +473,8 @@ install-exec-hook: $(INSTALL_EXEC_HOOKS) uninstall-hook: $(UNINSTALL_EXEC_HOOKS) +distcheck-hook: keymaps-distcheck-hook + # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed libudev-install-move-hook: if test "$(libdir)" != "$(rootlib_execdir)"; then \ @@ -493,6 +492,9 @@ udevacl-install-hook: mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck +keymaps-distcheck-hook: extras/keymap/keys.txt + ./extras/keymap/check-keymaps.sh $(top_srcdir) + # ------------------------------------------------------------------------------ # Custom rules # ------------------------------------------------------------------------------ diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh index f79c3f5a82..d4e3e91760 100755 --- a/extras/keymap/check-keymaps.sh +++ b/extras/keymap/check-keymaps.sh @@ -1,15 +1,19 @@ #!/bin/bash # check that all key names in keymaps/* are known in -KEYLIST=extras/keymap/keys.txt -RULES=extras/keymap/95-keymap.rules +# and that all key maps listed in the rules are valid and present in +# Makefile.am +SRCDIR=$1 +KEYLIST=$SRCDIR/extras/keymap/keys.txt +KEYMAPS_DIR=$SRCDIR/extras/keymap/keymaps #extras/keymap/keymaps +RULES=$SRCDIR/extras/keymap/95-keymap.rules [ -e "$KEYLIST" ] || { echo "need $KEYLIST please build first" >&2 exit 1 } -missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) <(awk '{print $2}' extras/keymap/keymaps/*|sort -u)) +missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) <(awk '{print $2}' ${KEYMAPS_DIR}/*|sort -u)) [ -z "$missing" ] || { echo "ERROR: unknown key names in extras/keymap/keymaps/*:" >&2 echo "$missing" >&2 @@ -22,11 +26,11 @@ for m in $maps; do # ignore inline mappings [ "$m" = "${m#0x}" ] || continue - [ -e extras/keymap/keymaps/$m ] || { + [ -e ${KEYMAPS_DIR}/$m ] || { echo "ERROR: unknown map name in $RULES: $m" >&2 exit 1 } - grep -q "extras/keymap/keymaps/$m\>" Makefile.am || { + grep -q "extras/keymap/keymaps/$m\>" $SRCDIR/Makefile.am || { echo "ERROR: map file $m is not added to Makefile.am" >&2 exit 1 } -- cgit v1.2.3-54-g00ecf From bd2dab9ce566a4e30d5372be9fa4e1921b7749f7 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Fri, 7 Aug 2009 21:54:35 +0200 Subject: Fix building of documentation when doing out-of-source builds. Since gtk-mkhtml is executed in a sub-directory of the build directory, and make does not know of that, the $(buildir) variable will still be "." and the $(srcdir) will not properly be found. For this reason, use the absolute variants for the two functions, which won't be changing. --- extras/gudev/docs/Makefile.am | 2 +- libudev/docs/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/gudev/docs/Makefile.am b/extras/gudev/docs/Makefile.am index 47ca91524e..3da6fc7196 100644 --- a/extras/gudev/docs/Makefile.am +++ b/extras/gudev/docs/Makefile.am @@ -39,7 +39,7 @@ MKDB_OPTIONS=--sgml-mode --output-format=xml MKTMPL_OPTIONS= # Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS= +MKHTML_OPTIONS=--path=$(abs_srcdir) --path=$(abs_builddir) # Extra options to supply to gtkdoc-fixref. Not normally needed. # e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html diff --git a/libudev/docs/Makefile.am b/libudev/docs/Makefile.am index 5229f0f450..965902627f 100644 --- a/libudev/docs/Makefile.am +++ b/libudev/docs/Makefile.am @@ -39,7 +39,7 @@ MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space udev MKTMPL_OPTIONS= # Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS= +MKHTML_OPTIONS=--path=$(abs_srcdir) --path=$(abs_builddir) # Extra options to supply to gtkdoc-fixref. Not normally needed. # e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html -- cgit v1.2.3-54-g00ecf From 214a6c791cbc0c1a190c430eb37056087e661344 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Sat, 8 Aug 2009 14:29:38 +0100 Subject: fix spelling Fix spelling in docbook comments, code comments, and a local variable name. Thanks to "ispell -h" for docbook HTML and "scspell" for source code. Signed-off-by: Alan Jenkins --- extras/cdrom_id/cdrom_id.c | 20 ++++++++++---------- extras/collect/collect.c | 2 +- extras/gudev/gudevclient.c | 2 +- extras/keymap/keymap.c | 2 +- extras/path_id/path_id.c | 2 +- extras/scsi_id/scsi_serial.c | 2 +- libudev/libudev-device.c | 14 +++++++------- libudev/libudev-monitor.c | 6 +++--- libudev/libudev-queue.c | 2 +- libudev/libudev-util-private.c | 4 ++-- libudev/libudev.c | 2 +- rules/rules.d/50-udev-default.rules | 2 +- udev/udev-event.c | 2 +- udev/udev-rules.c | 4 ++-- udev/udevadm-control.c | 2 +- udev/udevadm-trigger.c | 4 ++-- 16 files changed, 36 insertions(+), 36 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index d4156ce7ac..6ea763b415 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -173,27 +173,27 @@ static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigne static int cd_capability_compat(struct udev *udev, int fd) { - int capabilty; + int capability; - capabilty = ioctl(fd, CDROM_GET_CAPABILITY, NULL); - if (capabilty < 0) { + capability = ioctl(fd, CDROM_GET_CAPABILITY, NULL); + if (capability < 0) { info(udev, "CDROM_GET_CAPABILITY failed\n"); return -1; } - if (capabilty & CDC_CD_R) + if (capability & CDC_CD_R) cd_cd_r = 1; - if (capabilty & CDC_CD_RW) + if (capability & CDC_CD_RW) cd_cd_rw = 1; - if (capabilty & CDC_DVD) + if (capability & CDC_DVD) cd_dvd_rom = 1; - if (capabilty & CDC_DVD_R) + if (capability & CDC_DVD_R) cd_dvd_r = 1; - if (capabilty & CDC_DVD_RAM) + if (capability & CDC_DVD_RAM) cd_dvd_ram = 1; - if (capabilty & CDC_MRW) + if (capability & CDC_MRW) cd_mrw = 1; - if (capabilty & CDC_MRW_W) + if (capability & CDC_MRW_W) cd_mrw_w = 1; return 0; } diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 1ec833ac9f..c4523f1d18 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -124,7 +124,7 @@ static int prepare(char *dir, char *filename) * Read checkpoint file * * Tricky reading this. We allocate a buffer twice as large - * as we're goint to read. Then we read into the upper half + * as we're going to read. Then we read into the upper half * of that buffer and start parsing. * Once we do _not_ find end-of-work terminator (whitespace * character) we move the upper half to the lower half, diff --git a/extras/gudev/gudevclient.c b/extras/gudev/gudevclient.c index bb6d67326f..fa31f70bf5 100644 --- a/extras/gudev/gudevclient.c +++ b/extras/gudev/gudevclient.c @@ -197,7 +197,7 @@ g_udev_client_constructed (GObject *object) if (client->priv->subsystems != NULL) { - /* install subsytem filters to only wake up for certain events */ + /* install subsystem filters to only wake up for certain events */ for (n = 0; client->priv->subsystems[n] != NULL; n++) { gchar *subsystem; diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 117a41dbae..b565c33e2f 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -247,7 +247,7 @@ static const char* default_keymap_path(const char* path) { static char result[PATH_MAX]; - /* If keymap file is given without a path, assume udev diretory; must end with '/' * */ + /* If keymap file is given without a path, assume udev directory; must end with '/' * */ if (!strchr(path, '/')) { snprintf(result, sizeof(result), "%s%s", LIBEXECDIR "/keymaps/", path); return result; diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 2d70b6373d..dcee37881f 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -1,5 +1,5 @@ /* - * compose persisistent device path + * compose persistent device path * * Copyright (C) 2009 Kay Sievers * diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 4248829180..0f883dc02f 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -612,7 +612,7 @@ static int do_scsi_page83_inquiry(struct udev *udev, /* * XXX Some devices (IBM 3542) return all spaces for an identifier if - * the LUN is not actually configured. This leads to identifers of + * the LUN is not actually configured. This leads to identifiers of * the form: "1 ". */ diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 9d1e546c83..eac6bd6041 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -30,7 +30,7 @@ * Representation of kernel sys devices. Devices are uniquely identified * by their syspath, every device has exactly one path in the kernel sys * filesystem. Devices usually belong to a kernel subsystem, and and have - * a unique name inside that subsytem. + * a unique name inside that subsystem. */ /** @@ -270,7 +270,7 @@ struct udev_device *udev_device_new(struct udev *udev) * @syspath: sys device path including sys directory * * Create new udev device, and fill in information from the sys - * device and the udev database entry. The sypath is the absolute + * device and the udev database entry. The syspath is the absolute * path to the device, including the sys mount point. * * The initial refcount is 1, and needs to be decremented to @@ -427,12 +427,12 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de /** * udev_device_new_from_subsystem_sysname: * @udev: udev library context - * @subsystem: the subsytem of the device + * @subsystem: the subsystem of the device * @sysname: the name of the device * * Create new udev device, and fill in information from the sys * device and the udev database entry. The device is looked up - * by the subsytem and name string of the device, like "mem", + * by the subsystem and name string of the device, like "mem", * "zero", or "block", "sda". * * The initial refcount is 1, and needs to be decremented to @@ -554,7 +554,7 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic * child device, and will be cleaned up when the child device * is cleaned up. * - * It is not neccessarily just the upper level directory, empty or not + * It is not necessarily just the upper level directory, empty or not * recognized sys directories are ignored. * * It can be called as many times as needed, without caring about @@ -578,7 +578,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) /** * udev_device_get_parent_with_subsystem_devtype: * @udev_device: udev device to start searching from - * @subsystem: the subsytem of the device + * @subsystem: the subsystem of the device * @devtype: the type (DEVTYPE) of the device * * Find the next parent device, with a matching subsystem and devtype @@ -778,7 +778,7 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) return NULL; if (!udev_device->subsystem_set) { udev_device->subsystem_set = 1; - /* read "subsytem" link */ + /* read "subsystem" link */ if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { udev_device_set_subsystem(udev_device, subsystem); return udev_device->subsystem; diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 2c6c685c6b..657f23d727 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -336,7 +336,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) /* * get the address the kernel has assigned us - * it is usually, but not neccessarily the pid + * it is usually, but not necessarily the pid */ addrlen = sizeof(struct sockaddr_nl); err = getsockname(udev_monitor->sock, (struct sockaddr *)&snl, &addrlen); @@ -747,7 +747,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, /* * Use custom address for target, or the default one. * - * If we send to a muticast group, we will get + * If we send to a multicast group, we will get * ECONNREFUSED, which is expected. */ if (destination != NULL) @@ -768,7 +768,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, * udev_monitor_filter_add_match_subsystem_devtype: * @udev_monitor: the monitor * @subsystem: the subsystem value to match the incoming devices against - * @devtype: the devtype value to matvh the incoming devices against + * @devtype: the devtype value to match the incoming devices against * * The filter must be installed before the monitor is switched to listening mode. * diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index 691e6a7919..68efba0eee 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -28,7 +28,7 @@ * SECTION:libudev-queue * @short_description: access to currently active events * - * The udev daemon processes event asynchronously. All events wich do not have + * The udev daemon processes event asynchronously. All events which do not have * interdependencies are run in parallel. This exports the current state of the * event processing queue, and the currently event sequence numbers from the kernel * and the udev daemon. diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 00d1c95d52..3641b3630f 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -96,7 +96,7 @@ int util_delete_path(struct udev *udev, const char *path) } /* Reset permissions on the device node, before unlinking it to make sure, - * that permisions of possible hard links will be removed too. + * that permissions of possible hard links will be removed too. */ int util_unlink_secure(struct udev *udev, const char *filename) { @@ -342,7 +342,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp, } execve(argv[0], argv, envp); if (errno == ENOENT || errno == ENOTDIR) { - /* may be on a filesytem which is not mounted right now */ + /* may be on a filesystem which is not mounted right now */ info(udev, "program '%s' not found\n", argv[0]); } else { /* other problems */ diff --git a/libudev/libudev.c b/libudev/libudev.c index 05b62efd86..190913871e 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -327,7 +327,7 @@ void udev_set_log_fn(struct udev *udev, * udev_get_log_priority: * @udev: udev library context * - * The initial syslog priortity is read from the udev config file + * The initial syslog priority is read from the udev config file * at startup. * * Returns: the current syslog priority diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index fb8b1302c2..aef3b601a4 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -81,7 +81,7 @@ KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="tape" KERNEL=="pt[0-9]*|npt[0-9]*|pht[0-9]*", GROUP="tape" SUBSYSTEM=="scsi_generic|scsi_tape", SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape" -# block-releated +# block-related KERNEL=="sch[0-9]*", GROUP="disk" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" diff --git a/udev/udev-event.c b/udev/udev-event.c index 6a8bb44cf4..f3c2bd2225 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -571,7 +571,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) } if (event->name != NULL && event->name[0] == '\0') { - info(event->udev, "device node creation supressed\n"); + info(event->udev, "device node creation suppressed\n"); delete_kdevnode = 1; goto exit_add; } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 03234fe2a1..53baa187e6 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -270,7 +270,7 @@ static const char *token_str(enum token_type type) [TK_M_PROGRAM] = "M PROGRAM", [TK_M_IMPORT_FILE] = "M IMPORT_FILE", [TK_M_IMPORT_PROG] = "M IMPORT_PROG", - [TK_M_IMPORT_PARENT] = "M MPORT_PARENT", + [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", [TK_M_RESULT] = "M RESULT", [TK_M_MAX] = "M MAX", @@ -1508,7 +1508,7 @@ static int add_rule(struct udev_rules *rules, char *line, int tout = atoi(&pos[strlen("event_timeout=")]); rule_add_key(&rule_tmp, TK_A_EVENT_TIMEOUT, 0, NULL, &tout); - dbg(rules->udev, "event timout=%i\n", tout); + dbg(rules->udev, "event timeout=%i\n", tout); } pos = strstr(value, "string_escape="); if (pos != NULL) { diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 3fe41977c5..3eb03d8b04 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -115,7 +115,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) break; case 'p': if (strchr(optarg, '=') == NULL) { - fprintf(stderr, "expect = instead of '%s'\n", optarg); + fprintf(stderr, "expect = instead of '%s'\n", optarg); goto exit; } udev_ctrl_send_set_env(uctrl, optarg); diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 5cd4acd6ed..8a626ec744 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -186,8 +186,8 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) " failed trigger only the events which have been\n" " marked as failed during a previous run\n" " --action= event action value, default is \"add\"\n" - " --subsystem-match= trigger devices from a matching subystem\n" - " --subsystem-nomatch= exclude devices from a matching subystem\n" + " --subsystem-match= trigger devices from a matching subsystem\n" + " --subsystem-nomatch= exclude devices from a matching subsystem\n" " --attr-match=]> trigger devices with a matching attribute\n" " --attr-nomatch=]> exclude devices with a matching attribute\n" " --property-match== trigger devices with a matching property\n" -- cgit v1.2.3-54-g00ecf From 90b955b8364ed83afb06cfd6a0e8b04d72510b12 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Sat, 8 Aug 2009 22:12:42 +0200 Subject: Fix “make distcheck” run outside of the source directory. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pass the path to keys.txt as second parameter of check-keymaps.sh so that it can be found in the right path. --- Makefile.am | 2 +- extras/keymap/check-keymaps.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index c69529780d..221e91f538 100644 --- a/Makefile.am +++ b/Makefile.am @@ -493,7 +493,7 @@ udevacl-install-hook: ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck keymaps-distcheck-hook: extras/keymap/keys.txt - ./extras/keymap/check-keymaps.sh $(top_srcdir) + $(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^ # ------------------------------------------------------------------------------ # Custom rules diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh index d4e3e91760..892fcfd6c3 100755 --- a/extras/keymap/check-keymaps.sh +++ b/extras/keymap/check-keymaps.sh @@ -4,7 +4,7 @@ # and that all key maps listed in the rules are valid and present in # Makefile.am SRCDIR=$1 -KEYLIST=$SRCDIR/extras/keymap/keys.txt +KEYLIST=$2 KEYMAPS_DIR=$SRCDIR/extras/keymap/keymaps #extras/keymap/keymaps RULES=$SRCDIR/extras/keymap/95-keymap.rules -- cgit v1.2.3-54-g00ecf From 09b9a97e1fcee61c3b6321bfb687a67cef53f066 Mon Sep 17 00:00:00 2001 From: Diego Elio 'Flameeyes' Pettenò Date: Sat, 8 Aug 2009 22:51:18 +0200 Subject: Use LT_INIT to explicit that udev needs libtool series 2. --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index a38fd82075..727cba6efa 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AC_DISABLE_STATIC AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) -AC_PROG_LIBTOOL +LT_INIT AC_PROG_AWK GTK_DOC_CHECK(1.10) AC_PREFIX_DEFAULT([/usr]) -- cgit v1.2.3-54-g00ecf From cb6268f41935a217f3694bf54f482d8770d8c3bc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 8 Aug 2009 22:59:41 +0200 Subject: udevd: block for 15 seconds after error when too old kernel is detected The compat code will go away some day and CONFIG_SYSFS_DEPRECATED kernels fail in too many setups now to be worth to support them. --- TODO | 2 -- udev/udevd.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/TODO b/TODO index ac9b738e60..6a475365be 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,6 @@ o get rid of braindead "scan all devices to find myself" libusb interface if it can not be fixed, drop libusb entirely - o enumerate: sort control* after pcm* - o add tests for kernel provided DEVNAME logic o convert firmware.sh to C o symlink names to udevadm will no longer be resolved to old command names diff --git a/udev/udevd.c b/udev/udevd.c index 4024460d4b..54064cbfcf 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -776,7 +776,7 @@ static void startup_log(struct udev *udev) if (f != NULL) fprintf(f, "<3>%s\n", depr_str); err(udev, "%s\n", depr_str); - sleep(3); + sleep(15); } if (f != NULL) -- cgit v1.2.3-54-g00ecf From 2016ac8ede502dfbcddaf4f4ce504d249183b47f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Aug 2009 14:17:50 +0200 Subject: make: fix issues from non-recursive conversion --- Makefile.am | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 221e91f538..bc18fd130f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,6 +39,9 @@ DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ --enable-extras +install-data-local: + -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d + clean-local: rm -rf udev-test-install @@ -115,6 +118,9 @@ libudev_libudev_private_la_SOURCES =\ libudev_libudev_private_la_LIBADD = +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libudev/libudev.pc + extras_gudev_libgudev_1_0_la_SOURCES = \ extras/gudev/gudevenums.h \ extras/gudev/gudevenumtypes.h \ @@ -325,10 +331,8 @@ EXTRA_DIST += \ # ------------------------------------------------------------------------------ # Pkg-config, docs and man pages # ------------------------------------------------------------------------------ -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = \ - libudev/libudev.pc \ - udev/udev.pc +sharepkgconfigdir = $(datadir)/pkgconfig +sharepkgconfig_DATA = udev/udev.pc writing_udev_rulesdir = $(docdir)/writing_udev_rules dist_writing_udev_rules_DATA = \ @@ -370,7 +374,8 @@ dist_udevrules_DATA += \ extras/hid2hci/70-hid2hci.rules \ extras/modem-modeswitch/61-option-modem-modeswitch.rules \ extras/modem-modeswitch/61-mobile-action.rules \ - extras/keymap/95-keymap.rules + extras/keymap/95-keymap.rules \ + extras/udev-acl/70-acl.rules libexec_PROGRAMS += \ extras/hid2hci/hid2hci \ @@ -447,8 +452,7 @@ libgudev_include_HEADERS = \ pkgconfig_DATA += extras/gudev/gudev-1.0.pc -SUBDIRS += \ - extras/gudev/docs +SUBDIRS += extras/gudev/docs endif if ENABLE_INTROSPECTION -- cgit v1.2.3-54-g00ecf From d4ab372e4f20576fa3dee939dd8110b4b6410a74 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Aug 2009 14:18:58 +0200 Subject: release 146 --- ChangeLog | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0a806b1d0c..16b520b886 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,91 @@ +Summary of changes from v145 to v146 +============================================ + +Alan Jenkins (3): + man: fix unused, inaccurate metadata + man: SYMLINK can be matched as well as assigned + fix spelling + +Anssi Hannula (2): + rules: exclude digitizers from joystick class + udev-acl: add joystick devices + +Diego Elio 'Flameeyes' Pettenò (21): + Merge libudev, udev, and the unconditional extras in a single Makefile.am. + Replace the custom test-run target with the standard make check. + Also merge into the top-level Makefile.am the simpler extras. + Change hook handling to be more portable. + Merge keymap building in the top-level Makefile.am. + Make keymap generation rules be silent (backward-compatible). + Move pkg-config docs and man pages before conditionals. + Finally, also merge gudev into the top-level Makefile.am. + Make sure to clean up all the built sources. + Make sure to use dependency/target variables. + Add silent-rule support for the gudev rules. + Fix building of introspection library on top-level Makefile.am. + Fix another relative path for the new working directory. + Include the correct directory for out-of-source builds. + Add tests to the distribution; this fixes "make distcheck". + Ask gperf to use ANSI-C for generation. + Merge in Makefile.am.inc into Makefile.am + Use the keymap check during “make distcheck” rather than “check”. + Fix building of documentation when doing out-of-source builds. + Fix “make distcheck” run outside of the source directory. + Use LT_INIT to explicit that udev needs libtool series 2. + +Eric W. Biederman (1): + fix util_lookup_group to handle large groups + +Erik Forsberg (1): + extras/modem-modeswitch: Add Huawei E1550 GSM modem + +Kay Sievers (18): + udevd: add timestamp to --debug output + v4l_id: exit with 0 when --help is given + configure.ac: version bump + hid2hci: remove hid structures and include kernel header + path_id: make global variable static + udevadm: trigger - add --sysname-match= + rules: serial - fix path_id call + path_id: fix typo in comment + format names are not case insensitive + hid2hci: rewrite (and break) rules and device handling + make: build internal tools against libudev-private.la + update a few years of copyright + libudev: silent gcc warning: may be used uninitialized in this function + make: suppress enter/leaving directory messages + re-enable failed event tracking + "record_failed" -> "fail_event_on_error" + udevd: block for 15 seconds after error when too old kernel is detected + make: fix issues from non-recursive conversion + +Lennart Poettering (1): + enumeration: move ALSA control devices to the end of the enumerated devices of each card + +Mario Limonciello (2): + hid2hci: support to hid2hci for recovering Dell BT devices after S3 + hid2hci: install re-trigger for hid device when recovering from S3 + +Martin Pitt (17): + add keymap for Clevo D410J laptop + extras/keymap: add Zepto ZNote + extras/keymap: add Everex Stepnote XT5000T + extras/keymap: add Compal Hel80i + keymap tool: improve help + keymap tool: support scancode/keycode pair arguments + keymap: inline one-line key maps + extras/keymap: fix check-keymaps.sh for inline mappings + extras/keymap: add recently added keymap files to Makefile.am + extras/keymap: Add HP Presario 2100 + extras/keymap: cover more Compaq Evo models + extras/keymap: Add Fujitsu Amilo M + extras/keymap: teach findkeyboards about USB keyboards + extras/keymap: Add Samsung SX22S + extras/keymap: Fix crash for unknown keys + extras/keymap: Add Samsung NC20 + extras/keymap: Fix Bluetooth key on Acer Aspire 6920 + + Summary of changes from v144 to v145 ============================================ -- cgit v1.2.3-54-g00ecf From 863ad21fbfdd6a39ab8009f37da631684e0a03a4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Aug 2009 19:27:00 +0200 Subject: make: sort Makefile.am per target/extra --- Makefile.am | 717 ++++++++++++++++++++++++++++++++---------------------------- 1 file changed, 380 insertions(+), 337 deletions(-) diff --git a/Makefile.am b/Makefile.am index bc18fd130f..604a33bc3a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,21 +1,11 @@ -SUBDIRS = . libudev/docs - -udevconfdir = $(sysconfdir)/udev -dist_udevconf_DATA = \ - udev.conf - -EXTRA_DIST = \ - autogen.sh \ - libudev/exported_symbols \ - extras/keymap/check-keymaps.sh \ - extras/gudev/gudevmarshal.list \ - extras/gudev/gudevenumtypes.h.template \ - extras/gudev/gudevenumtypes.c.template +# ------------------------------------------------------------------------------ +# Copyright (C) 2008-2009 Kay Sievers +# Copyright (C) 2009 Diego Elio 'Flameeyes' Pettenò +# ------------------------------------------------------------------------------ -CLEANFILES = \ - udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2 +SUBDIRS = . -BUILT_SOURCES = +EXTRA_DIST = autogen.sh ACLOCAL_AMFLAGS = -I m4 @@ -27,66 +17,25 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DLIBEXECDIR=\""$(libexecdir)"\" -AM_CFLAGS = - AM_LDFLAGS = \ -Wl,--as-needed -udevrulesdir = \ - $(libexecdir)/rules.d - DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ --enable-extras -install-data-local: - -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d - -clean-local: - rm -rf udev-test-install - -distclean-local: - rm -rf autom4te.cache - -PREVIOUS_VERSION = `expr $(VERSION) - 1` - -changelog: - @ head -1 ChangeLog | grep -q "to v$(PREVIOUS_VERSION)" - @ mv ChangeLog ChangeLog.tmp - @ echo "Summary of changes from v$(PREVIOUS_VERSION) to v$(VERSION)" >> ChangeLog - @ echo "============================================" >> ChangeLog - @ echo >> ChangeLog - @ git log --pretty=short $(PREVIOUS_VERSION)..HEAD | git shortlog >> ChangeLog - @ echo >> ChangeLog - @ cat ChangeLog - @ cat ChangeLog.tmp >> ChangeLog - @ rm ChangeLog.tmp - -test-install: - rm -rf $(PWD)/udev-test-install/ - make DESTDIR=$(PWD)/udev-test-install install - tree $(PWD)/udev-test-install/ - -git-release: - head -1 ChangeLog | grep -q "to v$(VERSION)" - head -1 NEWS | grep -q "udev $(VERSION)" - git commit -a -m "release $(VERSION)" - cat .git/refs/heads/master > .git/refs/tags/$(VERSION) - git gc - git prune +CLEANFILES = -doc-sync: - rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ - rsync -av --delete extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/gudev/ +# ------------------------------------------------------------------------------ +# libudev +# ------------------------------------------------------------------------------ +LIBUDEV_CURRENT=5 +LIBUDEV_REVISION=0 +LIBUDEV_AGE=5 -INSTALL_EXEC_HOOKS = libudev-install-move-hook -UNINSTALL_EXEC_HOOKS = libudev-uninstall-move-hook +SUBDIRS += libudev/docs include_HEADERS = libudev/libudev.h - -# ------------------------------------------------------------------------------ -# Libraries -# ------------------------------------------------------------------------------ lib_LTLIBRARIES = libudev/libudev.la libudev_libudev_la_SOURCES =\ @@ -99,9 +48,6 @@ libudev_libudev_la_SOURCES =\ libudev/libudev-monitor.c \ libudev/libudev-queue.c -LIBUDEV_CURRENT=5 -LIBUDEV_REVISION=0 -LIBUDEV_AGE=5 libudev_libudev_la_LDFLAGS = \ -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \ -export-symbols $(top_srcdir)/libudev/exported_symbols @@ -116,53 +62,59 @@ libudev_libudev_private_la_SOURCES =\ libudev/libudev-device-private.c \ libudev/libudev-queue-private.c -libudev_libudev_private_la_LIBADD = +if WITH_SELINUX +libudev_libudev_private_la_SOURCES += libudev/libudev-selinux-private.c +libudev_libudev_private_la_LIBADD = $(SELINUX_LIBS) +endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libudev/libudev.pc -extras_gudev_libgudev_1_0_la_SOURCES = \ - extras/gudev/gudevenums.h \ - extras/gudev/gudevenumtypes.h \ - extras/gudev/gudevenumtypes.h\ - extras/gudev/gudevtypes.h \ - extras/gudev/gudevclient.h \ - extras/gudev/gudevclient.c \ - extras/gudev/gudevdevice.h \ - extras/gudev/gudevdevice.c \ - extras/gudev/gudevprivate.h - -dist_extras_gudev_libgudev_1_0_la_SOURCES = \ - extras/gudev/gudevmarshal.h \ - extras/gudev/gudevmarshal.c \ - extras/gudev/gudevenumtypes.h \ - extras/gudev/gudevenumtypes.c - -extras_gudev_libgudev_1_0_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - -I$(top_builddir)/extras \ - -I$(top_srcdir)/extras \ - -I$(top_builddir)/extras/gudev \ - -I$(top_srcdir)/extras/gudev \ - -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ - -D_GUDEV_COMPILATION \ - -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ - -DG_LOG_DOMAIN=\"GUdev\" -extras_gudev_libgudev_1_0_la_CFLAGS = $(GLIB_CFLAGS) -extras_gudev_libgudev_1_0_la_LIBADD = libudev/libudev.la $(GLIB_LIBS) +EXTRA_DIST += libudev/exported_symbols +# move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed +libudev-install-move-hook: + if test "$(libdir)" != "$(rootlib_execdir)"; then \ + mkdir -p $(DESTDIR)$(rootlib_execdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libudev.so) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlib_execdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so && \ + mv $(DESTDIR)$(libdir)/libudev.so.* $(DESTDIR)$(rootlib_execdir); \ + fi -LIBGUDEV_CURRENT=0 -LIBGUDEV_REVISION=1 -LIBGUDEV_AGE=0 +libudev-uninstall-move-hook: + rm -f $(DESTDIR)$(rootlib_execdir)/libudev.so* -extras_gudev_libgudev_1_0_la_LDFLAGS = \ - -version-info $(LIBGUDEV_CURRENT):$(LIBGUDEV_REVISION):$(LIBGUDEV_AGE) \ - -export-dynamic -no-undefined \ - -export-symbols-regex '^g_udev_.*' +INSTALL_EXEC_HOOKS = libudev-install-move-hook +UNINSTALL_EXEC_HOOKS = libudev-uninstall-move-hook # ------------------------------------------------------------------------------ -# Programs +# main udev # ------------------------------------------------------------------------------ +install-data-local: + -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d + +EXTRA_DIST += \ + rules/packages \ + rules/redhat \ + rules/suse \ + rules/gentoo + +udevrulesdir = $(libexecdir)/rules.d +dist_udevrules_DATA = \ + rules/rules.d/50-udev-default.rules \ + rules/rules.d/60-persistent-storage.rules \ + rules/rules.d/60-persistent-storage-tape.rules \ + rules/rules.d/60-persistent-serial.rules \ + rules/rules.d/60-persistent-input.rules \ + rules/rules.d/60-persistent-alsa.rules \ + rules/rules.d/80-drivers.rules \ + rules/rules.d/95-udev-late.rules + +udevconfdir = $(sysconfdir)/udev +dist_udevconf_DATA = udev.conf + +sharepkgconfigdir = $(datadir)/pkgconfig +sharepkgconfig_DATA = udev/udev.pc sbin_PROGRAMS = \ udev/udevd \ @@ -174,13 +126,11 @@ udev_common_sources =\ udev/udev-watch.c \ udev/udev-node.c \ udev/udev-rules.c -udev_common_libs = libudev/libudev-private.la udev_udevd_SOURCES = \ $(udev_common_sources) \ udev/udevd.c - -udev_udevd_LDADD = $(udev_common_libs) +udev_udevd_LDADD = libudev/libudev-private.la udev_udevadm_SOURCES = \ $(udev_common_sources) \ @@ -191,51 +141,120 @@ udev_udevadm_SOURCES = \ udev/udevadm-monitor.c \ udev/udevadm-settle.c \ udev/udevadm-trigger.c +udev_udevadm_LDADD = libudev/libudev-private.la + +# ------------------------------------------------------------------------------ +# udev docs and man pages +# ------------------------------------------------------------------------------ +writing_udev_rulesdir = $(docdir)/writing_udev_rules +dist_writing_udev_rules_DATA = \ + docs/writing_udev_rules/index.html + +dist_man_MANS = \ + udev/udev.7 \ + udev/udevadm.8 \ + udev/udevd.8 + +EXTRA_DIST += \ + udev/udev.xml \ + udev/udevadm.xml \ + udev/udevd.xml + +%.7 %.8 : %.xml + $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + +# ------------------------------------------------------------------------------ +# udev tests +# ------------------------------------------------------------------------------ +TESTS = test/udev-test.pl + +check_PROGRAMS = \ + libudev/test-libudev \ + udev/test-udev + +libudev_test_libudev_SOURCES = libudev/test-libudev.c +libudev_test_libudev_LDADD = libudev/libudev.la + +udev_test_udev_SOURCES = \ + $(udev_common_sources) \ + udev/test-udev.c +udev_test_udev_LDADD = libudev/libudev-private.la -udev_udevadm_LDADD = $(udev_common_libs) - -libexec_PROGRAMS = \ - extras/ata_id/ata_id \ - extras/cdrom_id/cdrom_id \ - extras/collect/collect \ - extras/edd_id/edd_id \ - extras/floppy/create_floppy_devices \ - extras/path_id/path_id \ - extras/fstab_import/fstab_import \ - extras/scsi_id/scsi_id \ - extras/usb_id/usb_id \ - extras/v4l_id/v4l_id - -dist_libexec_SCRIPTS = \ - extras/firmware/firmware.sh \ +# ------------------------------------------------------------------------------ +# firmware.sh - firmware loading +# ------------------------------------------------------------------------------ +dist_libexec_SCRIPTS = extras/firmware/firmware.sh +dist_udevrules_DATA += extras/firmware/50-firmware.rules + +# ------------------------------------------------------------------------------ +# rule_generator - persistent network and optical device rule generator +# ------------------------------------------------------------------------------ +dist_libexec_SCRIPTS += \ extras/rule_generator/write_cd_rules \ extras/rule_generator/write_net_rules udevhomedir = $(libexecdir) -dist_udevhome_DATA = \ - extras/rule_generator/rule_generator.functions +dist_udevhome_DATA = extras/rule_generator/rule_generator.functions + +dist_udevrules_DATA += \ + extras/rule_generator/75-cd-aliases-generator.rules \ + extras/rule_generator/75-persistent-net-generator.rules +# ------------------------------------------------------------------------------ +# ata_id - ATA identify +# ------------------------------------------------------------------------------ extras_ata_id_ata_id_SOURCES = extras/ata_id/ata_id.c extras_ata_id_ata_id_LDADD = libudev/libudev-private.la +libexec_PROGRAMS = extras/ata_id/ata_id +# ------------------------------------------------------------------------------ +# cdrom_id - optical drive/media capability +# ------------------------------------------------------------------------------ extras_cdrom_id_cdrom_id_SOURCES = extras/cdrom_id/cdrom_id.c extras_cdrom_id_cdrom_id_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/cdrom_id/cdrom_id +dist_udevrules_DATA += extras/cdrom_id/60-cdrom_id.rules +# ------------------------------------------------------------------------------ +# collect - trigger action when a collection of devices appeared +# ------------------------------------------------------------------------------ extras_collect_collect_SOURCES = extras/collect/collect.c extras_collect_collect_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/collect/collect +# ------------------------------------------------------------------------------ +# edd_id - BIOS EDD block device match +# ------------------------------------------------------------------------------ extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c extras_edd_id_edd_id_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/edd_id/edd_id +dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules +# ------------------------------------------------------------------------------ +# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) +# ------------------------------------------------------------------------------ extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/floppy/create_floppy_devices +# ------------------------------------------------------------------------------ +# path_id - compose identifier of persistent elements of the parent buses +# ------------------------------------------------------------------------------ extras_path_id_path_id_SOURCES = extras/path_id/path_id.c extras_path_id_path_id_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/path_id/path_id +# ------------------------------------------------------------------------------ +# fstab_import - import /etc/fstab entry for block device +# ------------------------------------------------------------------------------ extras_fstab_import_fstab_import_SOURCES = extras/fstab_import/fstab_import.c extras_fstab_import_fstab_import_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/fstab_import/fstab_import +dist_udevrules_DATA += extras/fstab_import/79-fstab_import.rules +# ------------------------------------------------------------------------------ +# scsi_id - SCSI inquiry to get various serial numbers +# ------------------------------------------------------------------------------ extras_scsi_id_scsi_id_SOURCES =\ extras/scsi_id/scsi_id.c \ extras/scsi_id/scsi_serial.c \ @@ -243,161 +262,227 @@ extras_scsi_id_scsi_id_SOURCES =\ extras/scsi_id/scsi_id.h \ extras/scsi_id/bsg.h extras_scsi_id_scsi_id_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/scsi_id/scsi_id +dist_man_MANS += extras/scsi_id/scsi_id.8 +# ------------------------------------------------------------------------------ +# usb_id - USB device property import +# ------------------------------------------------------------------------------ extras_usb_id_usb_id_SOURCES = extras/usb_id/usb_id.c extras_usb_id_usb_id_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/usb_id/usb_id +# ------------------------------------------------------------------------------ +# v4l_id - video4linux capabilities +# ------------------------------------------------------------------------------ extras_v4l_id_v4l_id_SOURCES = extras/v4l_id/v4l_id.c extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/v4l_id/v4l_id +dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules -extras_hid2hci_hid2hci_SOURCES = extras/hid2hci/hid2hci.c -extras_hid2hci_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -extras_hid2hci_hid2hci_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) - -extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c -extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) -extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) - -extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c -extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB -extras_usb_db_usb_db_LDADD = libudev/libudev-private.la - -extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c -extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_PCI -extras_usb_db_pci_db_LDADD = libudev/libudev-private.la - -extras_modem_modeswitch_modem_modeswitch_SOURCES =\ - extras/modem-modeswitch/modem-modeswitch.c \ - extras/modem-modeswitch/utils.c \ - extras/modem-modeswitch/utils.h \ - extras/modem-modeswitch/ma8280p_us.c \ - extras/modem-modeswitch/ma8280p_us.h \ - extras/modem-modeswitch/option.c \ - extras/modem-modeswitch/option.h -extras_modem_modeswitch_modem_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -extras_modem_modeswitch_modem_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) - -extras_keymap_keymap_SOURCES = extras/keymap/keymap.c -extras_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I extras/keymap -nodist_extras_keymap_keymap_SOURCES = \ - extras/keymap/keys-from-name.h \ - extras/keymap/keys-to-name.h +# ------------------------------------------------------------------------------ +# conditional extras (need glib, libusb, libacl, ...) +# ------------------------------------------------------------------------------ +if ENABLE_EXTRAS +dist_udevrules_DATA += \ + rules/rules.d/75-net-description.rules \ + rules/rules.d/75-tty-description.rules \ + rules/rules.d/78-sound-card.rules # ------------------------------------------------------------------------------ -# Tests +# GUdev # ------------------------------------------------------------------------------ +LIBGUDEV_CURRENT=0 +LIBGUDEV_REVISION=1 +LIBGUDEV_AGE=0 -TESTS = test/udev-test.pl +SUBDIRS += extras/gudev/docs -check_PROGRAMS = \ - libudev/test-libudev \ - udev/test-udev +libgudev_includedir=$(includedir)/gudev-1.0/gudev +libgudev_include_HEADERS = \ + extras/gudev/gudev.h \ + extras/gudev/gudevenums.h \ + extras/gudev/gudevenumtypes.h \ + extras/gudev/gudevtypes.h \ + extras/gudev/gudevclient.h \ + extras/gudev/gudevdevice.h -libudev_test_libudev_SOURCES = libudev/test-libudev.c -libudev_test_libudev_LDADD = libudev/libudev.la +lib_LTLIBRARIES += extras/gudev/libgudev-1.0.la +pkgconfig_DATA += extras/gudev/gudev-1.0.pc -udev_test_udev_SOURCES = \ - $(udev_common_sources) \ - udev/test-udev.c -udev_test_udev_LDADD = $(udev_common_libs) +extras_gudev_libgudev_1_0_la_SOURCES = \ + extras/gudev/gudevenums.h \ + extras/gudev/gudevenumtypes.h \ + extras/gudev/gudevenumtypes.h\ + extras/gudev/gudevtypes.h \ + extras/gudev/gudevclient.h \ + extras/gudev/gudevclient.c \ + extras/gudev/gudevdevice.h \ + extras/gudev/gudevdevice.c \ + extras/gudev/gudevprivate.h -# ------------------------------------------------------------------------------ -# Basic rules -# ------------------------------------------------------------------------------ +dist_extras_gudev_libgudev_1_0_la_SOURCES = \ + extras/gudev/gudevmarshal.h \ + extras/gudev/gudevmarshal.c \ + extras/gudev/gudevenumtypes.h \ + extras/gudev/gudevenumtypes.c +BUILT_SOURCES = $(dist_extras_gudev_libgudev_1_0_la_SOURCES) -dist_udevrules_DATA = \ - rules/rules.d/50-udev-default.rules \ - rules/rules.d/60-persistent-storage.rules \ - rules/rules.d/60-persistent-storage-tape.rules \ - rules/rules.d/60-persistent-serial.rules \ - rules/rules.d/60-persistent-input.rules \ - rules/rules.d/60-persistent-alsa.rules \ - rules/rules.d/80-drivers.rules \ - rules/rules.d/95-udev-late.rules \ - extras/rule_generator/75-cd-aliases-generator.rules \ - extras/rule_generator/75-persistent-net-generator.rules \ - extras/cdrom_id/60-cdrom_id.rules \ - extras/edd_id/61-persistent-storage-edd.rules \ - extras/firmware/50-firmware.rules \ - extras/fstab_import/79-fstab_import.rules \ - extras/v4l_id/60-persistent-v4l.rules +extras_gudev_libgudev_1_0_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -I$(top_builddir)/extras \ + -I$(top_srcdir)/extras \ + -I$(top_builddir)/extras/gudev \ + -I$(top_srcdir)/extras/gudev \ + -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ + -D_GUDEV_COMPILATION \ + -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ + -DG_LOG_DOMAIN=\"GUdev\" +extras_gudev_libgudev_1_0_la_CFLAGS = $(GLIB_CFLAGS) +extras_gudev_libgudev_1_0_la_LIBADD = libudev/libudev.la $(GLIB_LIBS) + +extras_gudev_libgudev_1_0_la_LDFLAGS = \ + -version-info $(LIBGUDEV_CURRENT):$(LIBGUDEV_REVISION):$(LIBGUDEV_AGE) \ + -export-dynamic -no-undefined \ + -export-symbols-regex '^g_udev_.*' EXTRA_DIST += \ - rules/packages \ - rules/redhat \ - rules/suse \ - rules/gentoo + extras/gudev/gudevmarshal.list \ + extras/gudev/gudevenumtypes.h.template \ + extras/gudev/gudevenumtypes.c.template -# ------------------------------------------------------------------------------ -# Pkg-config, docs and man pages -# ------------------------------------------------------------------------------ -sharepkgconfigdir = $(datadir)/pkgconfig -sharepkgconfig_DATA = udev/udev.pc +extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list + $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ -writing_udev_rulesdir = $(docdir)/writing_udev_rules -dist_writing_udev_rules_DATA = \ - docs/writing_udev_rules/index.html +extras/gudev/gudevmarshal.c: extras/gudev/gudevmarshal.list + $(AM_V_GEN)echo "#include \"gudevmarshal.h\"" > $@ && \ + glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ -dist_man_MANS = \ - udev/udev.7 \ - udev/udevadm.8 \ - udev/udevd.8 \ - extras/scsi_id/scsi_id.8 +extras/gudev/gudevenumtypes.h: extras/gudev/gudevenumtypes.h.template extras/gudev/gudevenums.h + $(AM_V_GEN)glib-mkenums --template $^ > \ + $@.tmp && mv $@.tmp $@ -EXTRA_DIST += \ - udev/udev.xml \ - udev/udevadm.xml \ - udev/udevd.xml +extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gudev/gudevenums.h + $(AM_V_GEN)glib-mkenums --template $^ > \ + $@.tmp && mv $@.tmp $@ -%.7 %.8 : %.xml - $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< +extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am + $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ + $(G_IR_SCANNER) -v \ + --namespace GUdev \ + --nsversion=1.0 \ + --include=GObject-2.0 \ + --library=gudev-1.0 \ + --library-path=extras/gudev \ + --output $@ \ + --pkg=glib-2.0 \ + --pkg=gobject-2.0 \ + -I$(top_srcdir)/extras \ + -D_GUDEV_COMPILATION \ + -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ + $(top_srcdir)/extras/gudev/gudev.h \ + $(top_srcdir)/extras/gudev/gudevtypes.h \ + $(top_srcdir)/extras/gudev/gudevenums.h \ + $(top_srcdir)/extras/gudev/gudevenumtypes.h \ + $(top_srcdir)/extras/gudev/gudevclient.h \ + $(top_srcdir)/extras/gudev/gudevdevice.h \ + $(top_srcdir)/extras/gudev/gudevclient.c \ + $(top_srcdir)/extras/gudev/gudevdevice.c + +extras/gudev/GUdev-1.0.typelib: extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) + $(AM_V_GEN)g-ir-compiler $< -o $@ + +if ENABLE_INTROSPECTION +girdir = $(GIRDIR) +gir_DATA = extras/gudev/GUdev-1.0.gir + +typelibsdir = $(GIRTYPELIBDIR) +typelibs_DATA = extras/gudev/GUdev-1.0.typelib + +EXTRA_DIST += GUdev-1.0.gir +CLEANFILES += $(gir_DATA) $(typelibs_DATA) +endif # ENABLE_INTROSPECTION # ------------------------------------------------------------------------------ -# Conditionals (SElinux, etc…) +# Bluetooth HID devices with special magic to switch the device # ------------------------------------------------------------------------------ -if WITH_SELINUX -libudev_libudev_private_la_SOURCES += \ - libudev/libudev-selinux-private.c -libudev_libudev_private_la_LIBADD += \ - $(SELINUX_LIBS) -endif +extras_hid2hci_hid2hci_SOURCES = extras/hid2hci/hid2hci.c +extras_hid2hci_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) +extras_hid2hci_hid2hci_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) +dist_udevrules_DATA += extras/hid2hci/70-hid2hci.rules +libexec_PROGRAMS += extras/hid2hci/hid2hci + +# ------------------------------------------------------------------------------ +# udev_acl - apply ACLs for users with local forground sessions +# ------------------------------------------------------------------------------ +extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c +extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) +extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) +dist_udevrules_DATA += extras/udev-acl/70-acl.rules +libexec_PROGRAMS += extras/udev-acl/udev-acl + +udevacl-install-hook: + mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d + ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck -if ENABLE_EXTRAS INSTALL_EXEC_HOOKS += udevacl-install-hook -lib_LTLIBRARIES += extras/gudev/libgudev-1.0.la +# ------------------------------------------------------------------------------ +# usb-db - read USB vendor/device string database +# ------------------------------------------------------------------------------ +extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c +extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB +extras_usb_db_usb_db_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/usb-db/usb-db + +# ------------------------------------------------------------------------------ +# pci-db - read PCI vendor/device string database +# ------------------------------------------------------------------------------ +extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c +extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_PCI +extras_usb_db_pci_db_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/usb-db/pci-db + +# ------------------------------------------------------------------------------ +# modem-modeswitch - magic config switch for 3G modems +# ------------------------------------------------------------------------------ +extras_modem_modeswitch_modem_modeswitch_SOURCES =\ + extras/modem-modeswitch/modem-modeswitch.c \ + extras/modem-modeswitch/utils.c \ + extras/modem-modeswitch/utils.h \ + extras/modem-modeswitch/ma8280p_us.c \ + extras/modem-modeswitch/ma8280p_us.h \ + extras/modem-modeswitch/option.c \ + extras/modem-modeswitch/option.h +extras_modem_modeswitch_modem_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) +extras_modem_modeswitch_modem_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) dist_udevrules_DATA += \ - rules/rules.d/75-net-description.rules \ - rules/rules.d/75-tty-description.rules \ - rules/rules.d/78-sound-card.rules \ - extras/hid2hci/70-hid2hci.rules \ extras/modem-modeswitch/61-option-modem-modeswitch.rules \ - extras/modem-modeswitch/61-mobile-action.rules \ - extras/keymap/95-keymap.rules \ - extras/udev-acl/70-acl.rules - -libexec_PROGRAMS += \ - extras/hid2hci/hid2hci \ - extras/udev-acl/udev-acl \ - extras/usb-db/usb-db \ - extras/usb-db/pci-db \ - extras/modem-modeswitch/modem-modeswitch \ - extras/keymap/keymap + extras/modem-modeswitch/61-mobile-action.rules -dist_libexec_SCRIPTS += \ - extras/keymap/findkeyboards +libexec_PROGRAMS += extras/modem-modeswitch/modem-modeswitch -BUILT_SOURCES += \ - $(nodist_extras_keymap_keymap_SOURCES) \ - $(dist_extras_gudev_libgudev_1_0_la_SOURCES) +# ------------------------------------------------------------------------------ +# keymap - map custom hardware's multimedia keys +# ------------------------------------------------------------------------------ +extras_keymap_keymap_SOURCES = extras/keymap/keymap.c +extras_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I extras/keymap +nodist_extras_keymap_keymap_SOURCES = \ + extras/keymap/keys-from-name.h \ + extras/keymap/keys-to-name.h +BUILT_SOURCES += $(nodist_extras_keymap_keymap_SOURCES) + +EXTRA_DIST += extras/keymap/check-keymaps.sh +dist_udevrules_DATA += extras/keymap/95-keymap.rules +libexec_PROGRAMS += extras/keymap/keymap +dist_libexec_SCRIPTS += extras/keymap/findkeyboards +dist_doc_DATA = extras/keymap/README.keymap.txt CLEANFILES += \ extras/keymap/keys.txt \ extras/keymap/keys-from-name.gperf -dist_doc_DATA = extras/keymap/README.keymap.txt - udevkeymapdir = $(libexecdir)/keymaps dist_udevkeymap_DATA = \ extras/keymap/keymaps/acer \ @@ -441,117 +526,75 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/toshiba-satellite_a110 \ extras/keymap/keymaps/zepto-znote -libgudev_includedir=$(includedir)/gudev-1.0/gudev -libgudev_include_HEADERS = \ - extras/gudev/gudev.h \ - extras/gudev/gudevenums.h \ - extras/gudev/gudevenumtypes.h \ - extras/gudev/gudevtypes.h \ - extras/gudev/gudevclient.h \ - extras/gudev/gudevdevice.h - -pkgconfig_DATA += extras/gudev/gudev-1.0.pc - -SUBDIRS += extras/gudev/docs -endif +extras/keymap/keys.txt: /usr/include/linux/input.h + $(AM_V_GEN)$(AWK) '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ -if ENABLE_INTROSPECTION -girdir = $(GIRDIR) -gir_DATA = extras/gudev/GUdev-1.0.gir +extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt + $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ -typelibsdir = $(GIRTYPELIBDIR) -typelibs_DATA = extras/gudev/GUdev-1.0.typelib +extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile + $(AM_V_GEN)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ -EXTRA_DIST += GUdev-1.0.gir -CLEANFILES += $(gir_DATA) $(typelibs_DATA) -endif # ENABLE_INTROSPECTION +extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile + $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ -CLEANFILES += $(BUILT_SOURCES) +keymaps-distcheck-hook: extras/keymap/keys.txt + $(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^ +DISTCHECK_HOOKS = keymaps-distcheck-hook -EXTRA_DIST += $(TESTS) +endif # ENABLE_EXTRAS # ------------------------------------------------------------------------------ -# Install and uninstall hooks +# install, uninstall, clean hooks # ------------------------------------------------------------------------------ -install-exec-hook: $(INSTALL_EXEC_HOOKS) +clean-local: + rm -rf udev-test-install -uninstall-hook: $(UNINSTALL_EXEC_HOOKS) +distclean-local: + rm -rf autom4te.cache -distcheck-hook: keymaps-distcheck-hook +CLEANFILES += \ + udev-$(VERSION).tar.gz \ + udev-$(VERSION).tar.bz2 \ + $(BUILT_SOURCES) -# move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed -libudev-install-move-hook: - if test "$(libdir)" != "$(rootlib_execdir)"; then \ - mkdir -p $(DESTDIR)$(rootlib_execdir) && \ - so_img_name=$$(readlink $(DESTDIR)$(libdir)/libudev.so) && \ - so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ - ln -sf $$so_img_rel_target_prefix$(rootlib_execdir)/$$so_img_name $(DESTDIR)$(libdir)/libudev.so && \ - mv $(DESTDIR)$(libdir)/libudev.so.* $(DESTDIR)$(rootlib_execdir); \ - fi +EXTRA_DIST += $(TESTS) -libudev-uninstall-move-hook: - rm -f $(DESTDIR)$(rootlib_execdir)/libudev.so* +install-exec-hook: $(INSTALL_EXEC_HOOKS) -udevacl-install-hook: - mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d - ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck +uninstall-hook: $(UNINSTALL_EXEC_HOOKS) -keymaps-distcheck-hook: extras/keymap/keys.txt - $(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^ +distcheck-hook: $(DISTCHECK_HOOKS) # ------------------------------------------------------------------------------ -# Custom rules +# custom release helpers # ------------------------------------------------------------------------------ +PREVIOUS_VERSION = `expr $(VERSION) - 1` +changelog: + @ head -1 ChangeLog | grep -q "to v$(PREVIOUS_VERSION)" + @ mv ChangeLog ChangeLog.tmp + @ echo "Summary of changes from v$(PREVIOUS_VERSION) to v$(VERSION)" >> ChangeLog + @ echo "============================================" >> ChangeLog + @ echo >> ChangeLog + @ git log --pretty=short $(PREVIOUS_VERSION)..HEAD | git shortlog >> ChangeLog + @ echo >> ChangeLog + @ cat ChangeLog + @ cat ChangeLog.tmp >> ChangeLog + @ rm ChangeLog.tmp -extras/keymap/keys.txt: /usr/include/linux/input.h - $(AM_V_GEN)$(AWK) '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ - -extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt - $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ - -extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile - $(AM_V_GEN)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ - -extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile - $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ - -extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list - $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ - -extras/gudev/gudevmarshal.c: extras/gudev/gudevmarshal.list - $(AM_V_GEN)echo "#include \"gudevmarshal.h\"" > $@ && \ - glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ - -extras/gudev/gudevenumtypes.h: extras/gudev/gudevenumtypes.h.template extras/gudev/gudevenums.h - $(AM_V_GEN)glib-mkenums --template $^ > \ - $@.tmp && mv $@.tmp $@ - -extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gudev/gudevenums.h - $(AM_V_GEN)glib-mkenums --template $^ > \ - $@.tmp && mv $@.tmp $@ +test-install: + rm -rf $(PWD)/udev-test-install/ + make DESTDIR=$(PWD)/udev-test-install install + tree $(PWD)/udev-test-install/ -extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am - $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ - $(G_IR_SCANNER) -v \ - --namespace GUdev \ - --nsversion=1.0 \ - --include=GObject-2.0 \ - --library=gudev-1.0 \ - --library-path=extras/gudev \ - --output $@ \ - --pkg=glib-2.0 \ - --pkg=gobject-2.0 \ - -I$(top_srcdir)/extras \ - -D_GUDEV_COMPILATION \ - -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ - $(top_srcdir)/extras/gudev/gudev.h \ - $(top_srcdir)/extras/gudev/gudevtypes.h \ - $(top_srcdir)/extras/gudev/gudevenums.h \ - $(top_srcdir)/extras/gudev/gudevenumtypes.h \ - $(top_srcdir)/extras/gudev/gudevclient.h \ - $(top_srcdir)/extras/gudev/gudevdevice.h \ - $(top_srcdir)/extras/gudev/gudevclient.c \ - $(top_srcdir)/extras/gudev/gudevdevice.c +git-release: + head -1 ChangeLog | grep -q "to v$(VERSION)" + head -1 NEWS | grep -q "udev $(VERSION)" + git commit -a -m "release $(VERSION)" + cat .git/refs/heads/master > .git/refs/tags/$(VERSION) + git gc + git prune -extras/gudev/GUdev-1.0.typelib: extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) - $(AM_V_GEN)g-ir-compiler $< -o $@ +doc-sync: + rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ + rsync -av --delete extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/gudev/ -- cgit v1.2.3-54-g00ecf From 5751707e0e9564e631d3b200cc64a1630866791f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Aug 2009 20:08:47 +0200 Subject: configure.ac: version bump --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 727cba6efa..3afb94a82c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [146], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [147], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 11a421dab5ab4bf9b40464a64b81c9d5c282f414 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 Aug 2009 20:13:20 +0200 Subject: udev-acl: allow to skip ACL handling --- extras/udev-acl/70-acl.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 1222513623..8259a7a936 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -1,6 +1,7 @@ # do not edit this file, it will be overwritten on update ENV{MAJOR}=="", GOTO="acl_end" +ENV{ACL_MANAGE}=="0", GOTO="acl_end" ACTION!="add|change", GOTO="acl_apply" # PTP/MTP protocol devices, cameras, portable media players -- cgit v1.2.3-54-g00ecf From 79f3b4a161947a795537af2ece7b91669d0567f9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 16 Aug 2009 21:07:39 +0200 Subject: rules: rfkill has no group, so use 0644 Thanks to Marco d'Itri for noticing. --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index aef3b601a4..2507420b2c 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -94,7 +94,7 @@ SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" # network KERNEL=="tun", NAME="net/%k", MODE="0666" -KERNEL=="rfkill", MODE="0664" +KERNEL=="rfkill", MODE="0644" # CPU KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid", MODE="0444" -- cgit v1.2.3-54-g00ecf From c8663095e327e8c2859ac348ed75890a0102244e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 16 Aug 2009 21:12:04 +0200 Subject: rule_generator: net - fix MATCHDEVID This got lost for some reason with an earlier change. Thanks to Marco d'Itri for noticing. --- extras/rule_generator/75-persistent-net-generator.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 2583e22fce..a9dfdce7a5 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -55,6 +55,9 @@ ENV{MATCHADDR}=="52:54:ab:*", GOTO="globally_administered_whitelist" # Kingston Technologies ENV{MATCHADDR}=="e2:0c:0f:*", GOTO="globally_administered_whitelist" +# match interface dev_id +ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}" + # do not use "locally administered" MAC address ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" -- cgit v1.2.3-54-g00ecf From 9b0dded6b05ca042083f86eacb952c8871289c3c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 16 Aug 2009 21:14:39 +0200 Subject: make: add comment --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 604a33bc3a..3699ff2339 100644 --- a/Makefile.am +++ b/Makefile.am @@ -280,17 +280,17 @@ extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules +if ENABLE_EXTRAS # ------------------------------------------------------------------------------ # conditional extras (need glib, libusb, libacl, ...) # ------------------------------------------------------------------------------ -if ENABLE_EXTRAS dist_udevrules_DATA += \ rules/rules.d/75-net-description.rules \ rules/rules.d/75-tty-description.rules \ rules/rules.d/78-sound-card.rules # ------------------------------------------------------------------------------ -# GUdev +# GUdev - libudev gobject interface # ------------------------------------------------------------------------------ LIBGUDEV_CURRENT=0 LIBGUDEV_REVISION=1 -- cgit v1.2.3-54-g00ecf From a90221b61639e582e4a85d2a508784ca29a2401b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 16 Aug 2009 21:14:59 +0200 Subject: update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 914b9498fa..28321c5109 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 147 +======== +Bugfixes. + udev 146 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 8eefdffb6bb458403c4fa5c9435290189d8d2a60 Mon Sep 17 00:00:00 2001 From: Daniel Mierswa Date: Mon, 17 Aug 2009 23:13:19 +0200 Subject: don't compare a non-existing function with NULL Obviously someone forgot something here or didn't use -ansi. Either way, index is nowhere declared so I assume the current behaviour is to check against the index() function coming from somewhere in the POSIX headers. The comparison doesn't make sense then. Signed-off-by: Daniel Mierswa --- libudev/libudev-queue-private.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 0427b65a01..4dea4ad0e7 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -158,7 +158,7 @@ static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_e return NULL; } devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); - if (index == NULL) + if (devpaths == NULL) return NULL; devpaths->devpaths_size = range + 1; -- cgit v1.2.3-54-g00ecf From 8e2470d68ef093d39907cc67dcee377b36ba77be Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 19 Aug 2009 07:31:39 +0200 Subject: print warning for NAME="%k" - it breaks the kernel supplied DEVNAME --- udev/udev-rules.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 53baa187e6..3ca209a891 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1406,6 +1406,9 @@ static int add_rule(struct udev_rules *rules, char *line, } else { if (value[0] == '\0') info(rules->udev, "name empty, node creation suppressed\n"); + else if (strcmp(value, "%k") == 0) + err(rules->udev, "NAME=\"%%k\" is superfluous and breaks " + "kernel supplied names, please remove it from %s:%u\n", filename, lineno); rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); attr = get_key_attribute(rules->udev, key + sizeof("NAME")-1); if (attr != NULL) { -- cgit v1.2.3-54-g00ecf From 24d1fea8bd609f9eb7901efd7cba7f2dee05f557 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 19 Aug 2009 07:34:07 +0200 Subject: warn about non-readable or empty rules file --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 3ca209a891..eeb71bc87b 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1798,7 +1798,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) if (stat(filename, &statbuf) == 0 && statbuf.st_size > 0) parse_file(rules, filename, filename_off); else - info(udev, "can not read '%s'\n", filename); + err(udev, "can not read '%s'\n", filename); udev_list_entry_delete(file_loop); } -- cgit v1.2.3-54-g00ecf From 2ffc9cc1917b1bb6fe86881a94a47dce9aa15168 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 19 Aug 2009 20:49:49 +0200 Subject: change database file names With very deeply nested devices, We can not use a single file name to carry an entire DEVPATH. Use : as the database filename, which should also simplify the handling of devices moving around, as these values will not change but still be unique. For the name stack we use the : now as the filename. > On Tue, Aug 18, 2009 at 09:59:56AM -0400, Ric Wheeler wrote: > The first is that udev grumbles during boot about "file name too long" > like the following: > > Aug 17 06:49:58 megadeth udevd-event[20447]: unable to create db file > '/dev/.udev/db/\x2fdevices\x2fpci0000:00\x2f0000:00:04.0\x2f0000:17:00.0\x2f0000:18:0a.0\x2f0000:1f:00.0\x2fhost11\x2fport-11:0\x2fexpander-11:0\x2fport-11:0:0\x2fexpander-11:1\x2fport-11:1:0\x2fexpander-11:2\x2fport-11:2:17\x2fexpander-11:3\x2fport-11:3:1\x2fend_device-11:3:1\x2fbsg\x2fend_device-11:3:1': > File name too long --- NEWS | 11 ++++++++++ TODO | 8 +++++++ libudev/libudev-device-private.c | 27 ++++++++++------------- libudev/libudev-device.c | 40 ++++++++++++++++++++++++---------- libudev/libudev-private.h | 5 +++-- libudev/libudev-queue-private.c | 16 +++++--------- test/udev-test.pl | 4 ++-- udev/udev-event.c | 10 +++++---- udev/udev-node.c | 47 ++++++++++++++++++++-------------------- 9 files changed, 100 insertions(+), 68 deletions(-) diff --git a/NEWS b/NEWS index 28321c5109..daefed8812 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,17 @@ udev 147 ======== Bugfixes. +To support DEVPATH strings larger than the maximum file name length, the +private udev database format has changed. If some software still reads the +private files in /dev/.udev/, which it shouldn't, now it's time to fix it. +Please do not port anything to the new format again, everything in /dev/.udev +is and always was private to udev, and may and will change any time without +prior notice. + +NAME="%k" causes a warning now. It's is and always was completely superfluous. +It will break kernel supplied DEVNAMEs and therefore it needs to be removed +from all rules. + udev 146 ======== Bugfixes. diff --git a/TODO b/TODO index 6a475365be..5df63fad05 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,12 @@ + o drop support for node names in name stack, support only symlinks + With well defined and kernel-supplied node names, we no longer need + to support a possible stack of conflicting symlinks and node names. + From there on, only symlinks with identical names can be claimed + by multiple devices. It will simplify the logic a lot and shrink + /dev/.udev/names/ significantly. Also exclude "*/MAJ:MIN" link names + from the name stack, they can not conflict. + o remove most NAME= rules (they are provided by the 2.6.31 kernel) o get rid of braindead "scan all devices to find myself" libusb interface if it can not be fixed, drop libusb entirely o convert firmware.sh to C diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 68dc0a5b98..80a4da4c96 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -21,16 +21,6 @@ #include "libudev.h" #include "libudev-private.h" -static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) -{ - char *s; - size_t l; - - s = filename; - l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); - return util_path_encode(devpath, s, l); -} - int udev_device_update_db(struct udev_device *udev_device) { struct udev *udev = udev_device_get_udev(udev_device); @@ -43,8 +33,8 @@ int udev_device_update_db(struct udev_device *udev_device) struct udev_list_entry *list_entry; int ret; - devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); - util_create_path(udev, filename); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", + udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); unlink(filename); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) @@ -78,11 +68,13 @@ int udev_device_update_db(struct udev_device *udev_device) } info(udev, "create db link (%s)\n", target); udev_selinux_setfscreatecon(udev, filename, S_IFLNK); + util_create_path(udev, filename); ret = symlink(target, filename); udev_selinux_resetfscreatecon(udev); if (ret == 0) goto out; file: + util_create_path(udev, filename); f = fopen(filename, "w"); if (f == NULL) { err(udev, "unable to create db file '%s': %m\n", filename); @@ -122,18 +114,21 @@ int udev_device_delete_db(struct udev_device *udev_device) struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; - devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", + udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); unlink(filename); return 0; } -int udev_device_rename_db(struct udev_device *udev_device, const char *devpath_old) +int udev_device_rename_db(struct udev_device *udev_device) { struct udev *udev = udev_device_get_udev(udev_device); char filename_old[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE]; - devpath_to_db_path(udev, devpath_old, filename_old, sizeof(filename_old)); - devpath_to_db_path(udev, udev_device_get_devpath(udev_device), filename, sizeof(filename)); + util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/db/", + udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", + udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); return rename(filename_old, filename); } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index eac6bd6041..22d8349275 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -51,6 +51,7 @@ struct udev_device { char *driver; char *action; char *devpath_old; + char *sysname_old; char *knodename; char **envp; char *monitor_buf; @@ -76,16 +77,6 @@ struct udev_device { unsigned int ignore_remove:1; }; -static size_t devpath_to_db_path(struct udev *udev, const char *devpath, char *filename, size_t len) -{ - char *s; - size_t l; - - s = filename; - l = util_strpcpyl(&s, len, udev_get_dev_path(udev), "/.udev/db/", NULL); - return util_path_encode(devpath, s, l); -} - int udev_device_read_db(struct udev_device *udev_device) { struct stat stats; @@ -93,7 +84,8 @@ int udev_device_read_db(struct udev_device *udev_device) char line[UTIL_LINE_SIZE]; FILE *f; - devpath_to_db_path(udev_device->udev, udev_device->devpath, filename, sizeof(filename)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/.udev/db/", + udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); if (lstat(filename, &stats) != 0) { dbg(udev_device->udev, "no db file to read %s: %m\n", filename); @@ -677,6 +669,7 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); + free(udev_device->sysname_old); free(udev_device->knodename); udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); free(udev_device->envp); @@ -1282,14 +1275,39 @@ const char *udev_device_get_devpath_old(struct udev_device *udev_device) int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) { + const char *pos; + size_t len; + free(udev_device->devpath_old); udev_device->devpath_old = strdup(devpath_old); if (udev_device->devpath_old == NULL) return -ENOMEM; udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); + + pos = strrchr(udev_device->devpath_old, '/'); + if (pos == NULL) + return -EINVAL; + udev_device->sysname_old = strdup(&pos[1]); + if (udev_device->sysname_old == NULL) + return -ENOMEM; + + /* some devices have '!' in their name, change that to '/' */ + len = 0; + while (udev_device->sysname_old[len] != '\0') { + if (udev_device->sysname_old[len] == '!') + udev_device->sysname_old[len] = '/'; + len++; + } return 0; } +const char *udev_device_get_sysname_old(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->sysname_old; +} + const char *udev_device_get_knodename(struct udev_device *udev_device) { return udev_device->knodename; diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 16f9f2e1c1..b735298c67 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -79,6 +79,7 @@ int udev_device_read_uevent_file(struct udev_device *udev_device); int udev_device_set_action(struct udev_device *udev_device, const char *action); int udev_device_set_driver(struct udev_device *udev_device, const char *driver); const char *udev_device_get_devpath_old(struct udev_device *udev_device); +const char *udev_device_get_sysname_old(struct udev_device *udev_device); int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); const char *udev_device_get_knodename(struct udev_device *udev_device); int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename); @@ -101,7 +102,7 @@ void udev_device_set_info_loaded(struct udev_device *device); /* libudev-device-private.c */ int udev_device_update_db(struct udev_device *udev_device); int udev_device_delete_db(struct udev_device *udev_device); -int udev_device_rename_db(struct udev_device *udev_device, const char *devpath); +int udev_device_rename_db(struct udev_device *udev_device); /* libudev-monitor.c - netlink/unix socket communication */ int udev_monitor_disconnect(struct udev_monitor *udev_monitor); @@ -186,8 +187,8 @@ int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, /* libudev-util.c */ #define UTIL_PATH_SIZE 1024 -#define UTIL_LINE_SIZE 2048 #define UTIL_NAME_SIZE 512 +#define UTIL_LINE_SIZE 2048 #define UDEV_ALLOWED_CHARS_INPUT "/ $%?," ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 4dea4ad0e7..e0a8738e0e 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -396,16 +396,13 @@ static void update_failed(struct udev_queue_export *udev_queue_export, { struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; - char *s; - size_t l; if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) return; /* location of failed file */ - s = filename; - l = util_strpcpyl(&s, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); - util_path_encode(udev_device_get_devpath(udev_device), s, l); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/failed/", + udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); switch (state) { case DEVICE_FAILED: @@ -428,14 +425,13 @@ static void update_failed(struct udev_queue_export *udev_queue_export, break; case DEVICE_FINISHED: - if (udev_device_get_devpath_old(udev_device) != NULL) { + if (udev_device_get_sysname_old(udev_device) != NULL && + strcmp(udev_device_get_sysname_old(udev_device), udev_device_get_sysname(udev_device)) != 0) { /* "move" event - rename failed file to current name, do not delete failed */ char filename_old[UTIL_PATH_SIZE]; - s = filename_old; - l = util_strpcpyl(&s, sizeof(filename_old), udev_get_dev_path(udev_queue_export->udev), "/.udev/failed/", NULL); - util_path_encode(udev_device_get_devpath_old(udev_device), s, l); - + util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/failed/", + udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL); if (rename(filename_old, filename) == 0) info(udev, "renamed devpath, moved failed state of '%s' to %s'\n", udev_device_get_devpath_old(udev_device), udev_device_get_devpath(udev_device)); diff --git a/test/udev-test.pl b/test/udev-test.pl index 79ed247d46..aaeec24955 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -819,9 +819,9 @@ EOF subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink2-ttyACM0", - exp_target => "ttyACM0", + exp_target => "ttyACM-0", rules => <dev; int err = 0; - if (udev_device_get_devpath_old(dev) != NULL) { - if (udev_device_rename_db(dev, udev_device_get_devpath(dev)) == 0) - info(event->udev, "moved database from '%s' to '%s'\n", - udev_device_get_devpath_old(dev), udev_device_get_devpath(dev)); + if (udev_device_get_sysname_old(dev) != NULL && + strcmp(udev_device_get_sysname_old(dev), udev_device_get_sysname(dev)) != 0) { + udev_device_rename_db(dev); + info(event->udev, "moved database from '%s:%s' to '%s:%s'\n", + udev_device_get_subsystem(dev), udev_device_get_sysname_old(dev), + udev_device_get_subsystem(dev), udev_device_get_sysname(dev)); } /* add device node */ diff --git a/udev/udev-node.c b/udev/udev-node.c index 03ab0ea86f..36f6f6d993 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -32,24 +32,20 @@ #define TMP_FILE_EXT ".udev-tmp" /* reverse mapping from the device file name to the devpath */ -static int name_index(struct udev *udev, const char *devpath, const char *name, int add) +static int name_index(struct udev_device *dev, const char *name, int add) { - char devpath_enc[UTIL_PATH_SIZE]; + struct udev *udev = udev_device_get_udev(dev); char name_enc[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE * 2]; - int fd; util_path_encode(&name[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); - util_path_encode(devpath, devpath_enc, sizeof(devpath_enc)); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), - "/.udev/names/", name_enc, "/", devpath_enc, NULL); + snprintf(filename, sizeof(filename), "%s/.udev/names/%s/%u:%u", udev_get_dev_path(udev), name_enc, + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); if (add) { dbg(udev, "creating index: '%s'\n", filename); util_create_path(udev, filename); - fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644); - if (fd > 0) - close(fd); + symlink(udev_device_get_devpath(dev), filename); } else { dbg(udev, "removing index: '%s'\n", filename); unlink(filename); @@ -247,18 +243,23 @@ static int name_index_get_devices(struct udev *udev, const char *name, struct ud dbg(udev, "found index directory '%s'\n", dirname); while (1) { - struct dirent *ent; - char device[UTIL_PATH_SIZE]; + struct dirent *dent; + char devpath[UTIL_PATH_SIZE]; + char syspath[UTIL_PATH_SIZE]; + int len; - ent = readdir(dir); - if (ent == NULL || ent->d_name[0] == '\0') + dent = readdir(dir); + if (dent == NULL || dent->d_name[0] == '\0') break; - if (ent->d_name[0] == '.') + if (dent->d_name[0] == '.') continue; - util_strscpyl(device, sizeof(device), udev_get_sys_path(udev), ent->d_name, NULL); - util_path_decode(device); - udev_list_entry_add(udev, dev_list, device, NULL, 1, 0); + len = readlinkat(dirfd(dir), dent->d_name, devpath, sizeof(devpath)); + if (len < 0 || (size_t)len >= sizeof(devpath)) + continue; + devpath[len] = '\0'; + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); + udev_list_entry_add(udev, dev_list, syspath, NULL, 1, 0); count++; } closedir(dir); @@ -384,7 +385,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev info(udev, "update old name, '%s' no longer belonging to '%s'\n", name, udev_device_get_devpath(dev)); - name_index(udev, udev_device_get_devpath(dev), name, 0); + name_index(dev, name, 0); update_link(dev, name); } @@ -398,7 +399,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev if (devnode != NULL && strcmp(devnode_old, devnode) != 0) { info(udev, "node has changed from '%s' to '%s'\n", devnode_old, devnode); - name_index(udev, udev_device_get_devpath(dev), devnode_old, 0); + name_index(dev, devnode_old, 0); update_link(dev, devnode_old); } } @@ -441,11 +442,11 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) } /* add node to name index */ - name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 1); + name_index(dev, udev_device_get_devnode(dev), 1); /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 1); + name_index(dev, udev_list_entry_get_name(list_entry), 1); update_link(dev, udev_list_entry_get_name(list_entry)); } exit: @@ -463,11 +464,11 @@ int udev_node_remove(struct udev_device *dev) int num; /* remove node from name index */ - name_index(udev, udev_device_get_devpath(dev), udev_device_get_devnode(dev), 0); + name_index(dev, udev_device_get_devnode(dev), 0); /* remove,update symlinks, remove symlinks from name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - name_index(udev, udev_device_get_devpath(dev), udev_list_entry_get_name(list_entry), 0); + name_index(dev, udev_list_entry_get_name(list_entry), 0); update_link(dev, udev_list_entry_get_name(list_entry)); } -- cgit v1.2.3-54-g00ecf From 8a0217ffd432e56231b0d1bccda71449bca5f8f6 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Thu, 20 Aug 2009 19:43:51 +0200 Subject: hid2hci: remove superfluous bmAttributes match For the retrigger of the device on remove we were trying to match bmAttributes of self powered which is unnecessary. --- extras/hid2hci/70-hid2hci.rules | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index b332c168e9..e133afd625 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -19,8 +19,7 @@ ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" # When a Dell device recovers from S3, the mouse child needs to be repoked # Unfortunately the only event seen is the BT device disappearing, so the mouse # device needs to be chased down on the USB bus. -ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", \ - ATTR{idVendor}=="413c", ATTR{bmAttributes}=="e0", \ +ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", ATTR{idVendor}=="413c", \ ENV{REMOVE_CMD}="/sbin/udevadm trigger --action=change --subsystem-match=usb --property-match=HID2HCI_SWITCH=1" # CSR devices -- cgit v1.2.3-54-g00ecf From 5daaf29d7194970d102b866f674eff7c1ba514a9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 24 Aug 2009 08:36:30 +0200 Subject: extras/keymap: Add Acer Aspire 6920 https://launchpad.net/bugs/407940 --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 3 ++- extras/keymap/keymaps/acer-aspire_6920 | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 extras/keymap/keymaps/acer-aspire_6920 diff --git a/Makefile.am b/Makefile.am index 3699ff2339..d785f05611 100644 --- a/Makefile.am +++ b/Makefile.am @@ -487,6 +487,7 @@ udevkeymapdir = $(libexecdir)/keymaps dist_udevkeymap_DATA = \ extras/keymap/keymaps/acer \ extras/keymap/keymaps/acer-aspire_5920g \ + extras/keymap/keymaps/acer-aspire_6920 \ extras/keymap/keymaps/acer-travelmate_c300 \ extras/keymap/keymaps/asus \ extras/keymap/keymaps/compaq-e_evo \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 81011bbd75..10a88b0917 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -52,7 +52,8 @@ ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*" ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|Aspire 6920", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" diff --git a/extras/keymap/keymaps/acer-aspire_6920 b/extras/keymap/keymaps/acer-aspire_6920 new file mode 100644 index 0000000000..6a1c8cfeaa --- /dev/null +++ b/extras/keymap/keymaps/acer-aspire_6920 @@ -0,0 +1,6 @@ +0xD9 bluetooth # (toggle) on-to-off +0x92 media +0x9E back +0xCA stop # "Hold" +0x83 rewind +0x89 fastforward -- cgit v1.2.3-54-g00ecf From 3c47b388eef138cab2d931b73019650914305799 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 24 Aug 2009 12:02:07 +0200 Subject: extras/modem-modeswitch: eject ZTE MF6xx fake CD-ROMs modem-modeswitch does not fully work on ZTE MF6xx modems, their fake CD-ROMs need to be properly ejected in order for the actual modem to appear. Add udev rule for this device (19d2:2000 in CD-ROM mode). https://launchpad.net/bugs/281335 --- extras/modem-modeswitch/61-mobile-action.rules | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/modem-modeswitch/61-mobile-action.rules b/extras/modem-modeswitch/61-mobile-action.rules index bb99b43597..9f472318b8 100644 --- a/extras/modem-modeswitch/61-mobile-action.rules +++ b/extras/modem-modeswitch/61-mobile-action.rules @@ -6,4 +6,9 @@ GOTO="mobile_action_end" LABEL="mobile_action_switch" ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" +# modem-modeswitch does not work with these devices, the fake CD-ROM needs to be ejected + +# ZTE MF6xx +ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", RUN+="/usr/bin/eject %k" + LABEL="mobile_action_end" -- cgit v1.2.3-54-g00ecf From d25b7205db0b6a33f043c60c8466c848af5847df Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 24 Aug 2009 17:59:42 +0200 Subject: extras/keymap: Fix hold key on Acer Aspire 6920 The Hold key locks the panel and is hardwired. It doesn't have a sensible keycode to map to, and shouldn't be overloaded either. --- extras/keymap/keymaps/acer-aspire_6920 | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/keymap/keymaps/acer-aspire_6920 b/extras/keymap/keymaps/acer-aspire_6920 index 6a1c8cfeaa..699c954b4e 100644 --- a/extras/keymap/keymaps/acer-aspire_6920 +++ b/extras/keymap/keymaps/acer-aspire_6920 @@ -1,6 +1,5 @@ 0xD9 bluetooth # (toggle) on-to-off 0x92 media 0x9E back -0xCA stop # "Hold" 0x83 rewind 0x89 fastforward -- cgit v1.2.3-54-g00ecf From 4851d131d62936c531dc4044ce19a4c4a66ba0a1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Aug 2009 21:06:35 +0200 Subject: assign errno for getgrnam_r()/getpwnam_r() On Mon, Aug 24, 2009 at 19:50, Lennart Poettering wrote: > One little comment here: on POSIX getrnam_r() doesn't touch > errno. Instead it returns the error value as return value. --- libudev/libudev-util-private.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 3641b3630f..84dee559c4 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -135,8 +135,7 @@ uid_t util_lookup_user(struct udev *udev, const char *user) if (endptr[0] == '\0') return uid; - errno = 0; - getpwnam_r(user, &pwbuf, buf, buflen, &pw); + errno = getpwnam_r(user, &pwbuf, buf, buflen, &pw); if (pw != NULL) return pw->pw_uid; if (errno == 0 || errno == ENOENT || errno == ESRCH) @@ -149,7 +148,7 @@ uid_t util_lookup_user(struct udev *udev, const char *user) gid_t util_lookup_group(struct udev *udev, const char *group) { char *endptr; - int buflen; + int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); char *buf; struct group grbuf; struct group *gr; @@ -160,28 +159,23 @@ gid_t util_lookup_group(struct udev *udev, const char *group) gid = strtoul(group, &endptr, 10); if (endptr[0] == '\0') return gid; - - buflen = sysconf(_SC_GETGR_R_SIZE_MAX); - if (buflen < 0) - buflen = 1000; buf = NULL; gid = 0; for (;;) { buf = realloc(buf, buflen); if (!buf) break; - errno = 0; - getgrnam_r(group, &grbuf, buf, buflen, &gr); - if (gr != NULL) + errno = getgrnam_r(group, &grbuf, buf, buflen, &gr); + if (gr != NULL) { gid = gr->gr_gid; - else if (errno == ERANGE) { + } else if (errno == ERANGE) { buflen *= 2; continue; - } - else if (errno == 0 || errno == ENOENT || errno == ESRCH) + } else if (errno == 0 || errno == ENOENT || errno == ESRCH) { err(udev, "specified group '%s' unknown\n", group); - else + } else { err(udev, "error resolving group '%s': %m\n", group); + } break; } free(buf); -- cgit v1.2.3-54-g00ecf From 66bf63c05cdc4e9b09818aa5fab0b9d319a1c91c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Aug 2009 19:09:06 +0200 Subject: extras/keymap: Fix case matching for Micro-Star Some Micro-Star boards apparently have mixed case vendor, instead of all-caps. Update the glob to catch all such cases. https://launchpad.net/bugs/178860 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 10a88b0917..801e6a0b31 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -69,7 +69,7 @@ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keyma ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" -ENV{DMI_VENDOR}=="MICRO-STAR*", RUN+="keymap $name micro-star" +ENV{DMI_VENDOR}=="M[iI][cC][rR][oO]-S[tT][aA][rR]*", RUN+="keymap $name micro-star" ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" -- cgit v1.2.3-54-g00ecf From bc19bff974024066451a2486e155aa89fd09ab9f Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Aug 2009 22:39:32 +0200 Subject: Revert "extras/keymap: Fix case matching for Micro-Star" This reverts commit 66bf63c05cdc4e9b09818aa5fab0b9d319a1c91c. Further debugging in https://launchpad.net/bugs/178860 showed that for some weird reason the correct key codes already come out of the "Video Bus" input device, and the previous commit would cause them to appear a second time through the standard keyboard device. This is a kernel bug in the end, but let's not break working things prematurely. --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 801e6a0b31..10a88b0917 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -69,7 +69,7 @@ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keyma ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" -ENV{DMI_VENDOR}=="M[iI][cC][rR][oO]-S[tT][aA][rR]*", RUN+="keymap $name micro-star" +ENV{DMI_VENDOR}=="MICRO-STAR*", RUN+="keymap $name micro-star" ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" -- cgit v1.2.3-54-g00ecf From 133e51af3b3bf455ec1ebf96972c315a4fb70dce Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Thu, 27 Aug 2009 03:55:44 +0200 Subject: doc: writing_udev_rules updated for the new command names --- docs/writing_udev_rules/index.html | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index ca4fb9d311..8c0974879d 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -79,7 +79,7 @@ The most recent version of this document can always be found at:
                  • Testing and debugging
                  • Author and contact
                  • @@ -843,22 +843,18 @@ Despite this, udev will not automatically reprocess all devices and attempt to a

                    -To make the symbolic link show up, you can either disconnect and reconnect your camera, or alternatively in the case of non-removable devices, you can run udevtrigger. -

                    - -

                    -If your kernel does not have inotify support, new rules will not be detected automatically. In this situation, you must run udevcontrol reload_rules after making any rule file modifications for those modifications to take effect. +To make the symbolic link show up, you can either disconnect and reconnect your camera, or alternatively in the case of non-removable devices, you can run udevadm trigger.

                    -

                    udevtest

                    +

                    udevadm test

                    -If you know the top-level device path in sysfs, you can use udevtest to show the actions which udev would take. This may help you debug your rules. For example, assuming you want to debug a rule which acts on /sys/class/sound/dsp: +If you know the top-level device path in sysfs, you can use udevadm test to show the actions which udev would take. This may help you debug your rules. For example, assuming you want to debug a rule which acts on /sys/class/sound/dsp:

                    -# udevtest /class/sound/dsp
                    +# udevadm test /class/sound/dsp
                     main: looking at device '/class/sound/dsp' from subsystem 'sound'
                     udev_rules_get_name: add symlink 'dsp'
                     udev_rules_get_name: rule applied, 'dsp' becomes 'sound/dsp'
                    @@ -868,7 +864,7 @@ udev_node_add: creating symlink '/dev/dsp' to 'sound/dsp'
                     

                    -Note the /sys prefix was removed from the udevtest command line argument, this is because udevtest operates on device paths. Also note that udevtest is purely a testing/debugging tool, it does not create any device nodes, despite what the output suggests! +Note the /sys prefix was removed from the udevadm test test command line argument, this is because udevadm test operates on device paths. Also note that udevadm test is purely a testing/debugging tool, it does not create any device nodes, despite what the output suggests!

                    -- cgit v1.2.3-54-g00ecf From e20294e018ee1a8e3e6a4f5977a23728fdc08c0f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 Aug 2009 03:56:32 +0200 Subject: doc: udevadm test *does* create nodes and links these days --- docs/writing_udev_rules/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index 8c0974879d..7ca350635d 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -864,7 +864,7 @@ udev_node_add: creating symlink '/dev/dsp' to 'sound/dsp'

                    -Note the /sys prefix was removed from the udevadm test test command line argument, this is because udevadm test operates on device paths. Also note that udevadm test is purely a testing/debugging tool, it does not create any device nodes, despite what the output suggests! +Note the /sys prefix was removed from the udevadm test test command line argument, this is because udevadm test operates on device paths.

                    -- cgit v1.2.3-54-g00ecf From 39087d3bdd0b5195c2570a4f858b88a82d42a066 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Aug 2009 16:10:24 +0200 Subject: util_unlink_secure(): chmod() before chown() Suggested by Florian Zumbiehl . --- libudev/libudev-util-private.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 84dee559c4..cb8d2c8a2e 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -100,24 +100,16 @@ int util_delete_path(struct udev *udev, const char *path) */ int util_unlink_secure(struct udev *udev, const char *filename) { - int retval; - - retval = chown(filename, 0, 0); - if (retval) - err(udev, "chown(%s, 0, 0) failed: %m\n", filename); - - retval = chmod(filename, 0000); - if (retval) - err(udev, "chmod(%s, 0000) failed: %m\n", filename); + int err; - retval = unlink(filename); + chmod(filename, 0000); + chown(filename, 0, 0); + err = unlink(filename); if (errno == ENOENT) - retval = 0; - - if (retval) + err = 0; + if (err) err(udev, "unlink(%s) failed: %m\n", filename); - - return retval; + return err; } uid_t util_lookup_user(struct udev *udev, const char *user) -- cgit v1.2.3-54-g00ecf From f46b9c2628a4d28381ab297e699d9a0530a9e945 Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Sat, 29 Aug 2009 16:17:54 +0200 Subject: util_delete_path(): use util_strscpy() --- libudev/libudev-util-private.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index cb8d2c8a2e..5b5ecb1f50 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -67,7 +67,7 @@ int util_delete_path(struct udev *udev, const char *path) char *pos; int retval; - strcpy (p, path); + util_strscpy(p, sizeof(p), path); pos = strrchr(p, '/'); if (pos == p || pos == NULL) return 0; -- cgit v1.2.3-54-g00ecf From 72c0373f795a5c326e6bd0f7469601f492124d70 Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Sat, 29 Aug 2009 16:25:47 +0200 Subject: util_lookup_group(): fix memory leak if realloc() fails --- libudev/libudev-util-private.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 5b5ecb1f50..b33ee79d6b 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -154,9 +154,12 @@ gid_t util_lookup_group(struct udev *udev, const char *group) buf = NULL; gid = 0; for (;;) { - buf = realloc(buf, buflen); - if (!buf) + char *newbuf; + + newbuf = realloc(buf, buflen); + if (!newbuf) break; + buf = newbuf; errno = getgrnam_r(group, &grbuf, buf, buflen, &gr); if (gr != NULL) { gid = gr->gr_gid; -- cgit v1.2.3-54-g00ecf From 28da1a6186fcb55762b1649c6dd1e43545e0eb9a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 Aug 2009 16:38:01 +0200 Subject: util_create_path(): fix errno usage Based on a patch from: Florian Zumbiehl --- libudev/libudev-util-private.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index b33ee79d6b..c86567159e 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -30,7 +30,7 @@ int util_create_path(struct udev *udev, const char *path) char p[UTIL_PATH_SIZE]; char *pos; struct stat stats; - int ret; + int err; util_strscpy(p, sizeof(p), path); pos = strrchr(p, '/'); @@ -50,15 +50,12 @@ int util_create_path(struct udev *udev, const char *path) dbg(udev, "mkdir '%s'\n", p); udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); - ret = mkdir(p, 0755); - udev_selinux_resetfscreatecon(udev); - if (ret == 0) - return 0; - - if (errno == EEXIST) + err = mkdir(p, 0755); + if (err != 0 && errno == EEXIST) if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - return -1; + err = 0; + udev_selinux_resetfscreatecon(udev); + return err; } int util_delete_path(struct udev *udev, const char *path) -- cgit v1.2.3-54-g00ecf From b0de6a63270998662cc069cc2ca1579776bb28df Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Sat, 29 Aug 2009 16:50:43 +0200 Subject: util_delete_path(): handle multiple leading slashes --- libudev/libudev-util-private.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index c86567159e..042b711928 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -64,6 +64,9 @@ int util_delete_path(struct udev *udev, const char *path) char *pos; int retval; + if (path[0] == '/') + while(path[1] == '/') + path++; util_strscpy(p, sizeof(p), path); pos = strrchr(p, '/'); if (pos == p || pos == NULL) -- cgit v1.2.3-54-g00ecf From ebc1ba78edd35a5973f2671a80a71639f5949212 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 Aug 2009 20:42:06 +0200 Subject: inotify_add_watch(): do not store watch, if it failed On Sun, Aug 30, 2009 at 04:36, Marco d'Itri wrote: > inotify_add_watch may fail in udev_watch_begin, and then a link with > name -1 is created. > I do not know why, but it happened once on my system: > > lrwxrwxrwx 1 root root 27 Aug 4 11:27 -1 -> /devices/virtual/block/ram8 --- udev/udev-watch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 5a49c963da..102e16f81d 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -121,6 +121,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) if (wd < 0) { err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n", inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); + return; } snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); -- cgit v1.2.3-54-g00ecf From 4c21b7156d951c99fe8d57a36bf3b006cc3d3a73 Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Sun, 30 Aug 2009 21:40:13 +0200 Subject: util_create_path(): fix possible out of bounds array access --- libudev/libudev-util-private.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 042b711928..fe8f29b3a8 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -34,11 +34,12 @@ int util_create_path(struct udev *udev, const char *path) util_strscpy(p, sizeof(p), path); pos = strrchr(p, '/'); - if (pos == p || pos == NULL) + if (pos == NULL) return 0; - - while (pos[-1] == '/') + while (pos != p && pos[-1] == '/') pos--; + if (pos == p) + return 0; pos[0] = '\0'; dbg(udev, "stat '%s'\n", p); -- cgit v1.2.3-54-g00ecf From c45e22151313878dcce33c788f9eebbd93842008 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 Aug 2009 22:45:49 +0200 Subject: update TODO --- TODO | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 5df63fad05..84bfbf372e 100644 --- a/TODO +++ b/TODO @@ -7,11 +7,11 @@ /dev/.udev/names/ significantly. Also exclude "*/MAJ:MIN" link names from the name stack, they can not conflict. o remove most NAME= rules (they are provided by the 2.6.31 kernel) - o get rid of braindead "scan all devices to find myself" libusb interface - if it can not be fixed, drop libusb entirely o convert firmware.sh to C - o symlink names to udevadm will no longer be resolved to old command names o "udevadm control" commands will only accept the -- syntax + o get rid of braindead "scan all devices to find myself" libusb interface + if it can not be fixed, drop libusb entirely + o remove copy of bsg.h o drop all support for the DEPRECATED sysfs layout o add warning for BUS, SYSFS, ID -- cgit v1.2.3-54-g00ecf From 959e8b5decb32fda0a8c8be21aff8bc17382586d Mon Sep 17 00:00:00 2001 From: Daniel Mierswa Date: Sun, 30 Aug 2009 23:58:57 +0200 Subject: use nanosleep() instead of usleep() POSIX.1-2001 declares usleep() function obsolete and POSIX.1-2008 removes it. [Kay Sievers] - include time.h - use const for timespec - scsi_id: drop rand() in retry loop - modem-probe: rename msuspend() to msleep() --- extras/modem-modeswitch/ma8280p_us.c | 334 ++++++++++++++++++----------------- extras/scsi_id/scsi_serial.c | 5 +- udev/udev-event.c | 7 +- udev/udev-rules.c | 5 +- udev/udevadm-settle.c | 4 +- 5 files changed, 187 insertions(+), 168 deletions(-) diff --git a/extras/modem-modeswitch/ma8280p_us.c b/extras/modem-modeswitch/ma8280p_us.c index 13d11160e1..3cf9eb9eb2 100644 --- a/extras/modem-modeswitch/ma8280p_us.c +++ b/extras/modem-modeswitch/ma8280p_us.c @@ -87,11 +87,19 @@ #include #include #include +#include #include #include "utils.h" #include "ma8280p_us.h" +static void msleep(long msec) +{ + struct timespec duration = { 0, msec * 1000 * 1000 }; + + nanosleep(&duration, NULL); +} + int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) { int ret = 1; @@ -104,11 +112,11 @@ int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) } ret = usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); - usleep(6*1000); + msleep(6); ret = usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); - usleep(6*1000); + msleep(6); ret = usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); - usleep(10*1000); + msleep(10); ret = usb_release_interface(devh, 0); if (ret != 0) debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); @@ -117,335 +125,335 @@ int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) if (ret != 0) debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); //ret = usb_set_altinterface(devh, 0); - //usleep(33*1000); + //msleep(33); ret = usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - usleep(5*1000); + msleep(5); memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); ret = usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - usleep(4*1000); + msleep(4); memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); ret = usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - usleep(4*1000); + msleep(4); - usleep(4*1000); + msleep(4); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(6*1000); + msleep(6); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(1*1000); + msleep(1); //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - usleep(4*1000); + msleep(4); memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - usleep(3*1000); + msleep(3); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(1*1000); + msleep(1); memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - usleep(7*1000); + msleep(7); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(1*1000); + msleep(1); memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - usleep(7*1000); + msleep(7); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(2*1000); + msleep(2); //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - usleep(4*1000); + msleep(4); memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - usleep(2*1000); + msleep(2); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(1*1000); + msleep(1); memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - usleep(7*1000); + msleep(7); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(1*1000); + msleep(1); memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - usleep(7*1000); + msleep(7); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(8*1000); + msleep(8); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(1*1000); + msleep(1); //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - usleep(4*1000); + msleep(4); memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - usleep(3*1000); + msleep(3); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - usleep(1*1000); + msleep(1); //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - usleep(4*1000); + msleep(4); memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - usleep(3*1000); + msleep(3); ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); if (buf) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 0f883dc02f..2e9168f941 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -846,13 +847,15 @@ int scsi_get_serial(struct udev *udev, memset(dev_scsi->serial, 0, len); dbg(udev, "opening %s\n", devname); while (--cnt) { + const struct timespec duration = { 0, 500 * 1000 * 1000 }; + fd = open(devname, O_RDONLY | O_NONBLOCK); if (fd >= 0) break; info(udev, "%s: cannot open %s: %s\n", dev_scsi->kernel, devname, strerror(errno)); if (errno != EBUSY) break; - usleep(500000 + (rand() % 100000) ); + nanosleep(&duration, NULL); } if (fd < 0) return 1; diff --git a/udev/udev-event.c b/udev/udev-event.c index 3a6c71abe9..8183793e5f 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -23,9 +23,10 @@ #include #include #include +#include +#include #include #include -#include #include #include "udev.h" @@ -505,6 +506,8 @@ static int rename_netif(struct udev_event *event) util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); loop = 90 * 20; while (loop--) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; + err = ioctl(sk, SIOCSIFNAME, &ifr); if (err == 0) { rename_netif_kernel_log(ifr); @@ -518,7 +521,7 @@ static int rename_netif(struct udev_event *event) } dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", event->name, (90 * 20) - loop); - usleep(1000 * 1000 / 20); + nanosleep(&duration, NULL); } } exit: diff --git a/udev/udev-rules.c b/udev/udev-rules.c index eeb71bc87b..a45a8138f5 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "udev.h" @@ -814,6 +815,8 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) dbg(udev, "will wait %i sec for '%s'\n", timeout, file); while (--loop) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / WAIT_LOOP_PER_SECOND }; + /* lookup file */ if (stat(file, &stats) == 0) { info(udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); @@ -825,7 +828,7 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) return -2; } info(udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); - usleep(1000 * 1000 / WAIT_LOOP_PER_SECOND); + nanosleep(&duration, NULL); } info(udev, "waiting for '%s' failed\n", file); return -1; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 682819201e..124c59698c 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -180,6 +181,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) while (1) { struct stat statbuf; + const struct timespec duration = { 0 , 1000 * 1000 * 1000 / LOOP_PER_SECOND }; if (exists != NULL && stat(exists, &statbuf) == 0) { rc = 0; @@ -203,7 +205,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (is_timeout) break; - usleep(1000 * 1000 / LOOP_PER_SECOND); + nanosleep(&duration, NULL); } /* if we reached the timeout, print the list of remaining events */ -- cgit v1.2.3-54-g00ecf From a6c5b514d8e698316c57a0cf5183fcd8a7bc6d26 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 31 Aug 2009 10:19:40 +0200 Subject: update README --- README | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/README b/README index 591e03a057..f6d1ab5257 100644 --- a/README +++ b/README @@ -8,8 +8,8 @@ recommend to replace a distro's udev installation with the upstream version. Tools and rules shipped by udev are not public API and may change at any time. Never call any private tool in /lib/udev from any external application, it might just go away in the next release. Access to udev information is only offered -by udevadm and libudev. Tools and rules in /lib/udev and the entire content of -/dev/.udev/ is private to udev. +by udevadm and libudev. Tools and rules in /lib/udev, and the entire content of +the /dev/.udev directory is private to udev and does change whenever needed. Requirements: - Version 2.6.25 of the Linux kernel with sysfs, procfs, signalfd, inotify, @@ -25,16 +25,16 @@ Requirements: CONFIG_INOTIFY=y CONFIG_SIGNALFD=y CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes) - CONFIG_BLK_DEV_BSG=y (SCSI tape devices) + CONFIG_BLK_DEV_BSG=y (SCSI devices) - - For reliable operation, the kernel must not use the CONFIG_SYSFS_DEPRECATED* + - For reliable operations, the kernel must not use the CONFIG_SYSFS_DEPRECATED* option. - - Unix domain sockets (CONFIG_UNIX) as a loadable kernel module is not - supported. + - Unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, + but it is not supported. - - The proc filesystem must be mounted on /proc/, the sysfs filesystem must - be mounted at /sys/. No other locations are supported by udev. + - The proc filesystem must be mounted on /proc, the sysfs filesystem must + be mounted at /sys. No other locations are supported by udev. - The system must have the following group names resolvable at udev startup: disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, kmem. @@ -47,29 +47,30 @@ Requirements: --disable-extras option. Operation: - Udev creates and removes device nodes in /dev/, based on events the kernel + Udev creates and removes device nodes in /dev, based on events the kernel sends out on device discovery or removal. - - Early in the boot process, the /dev/ directory should get a 'tmpfs' + - Early in the boot process, the /dev directory should get a 'tmpfs' filesystem mounted, which is maintained by udev. Created nodes or changed permissions will not survive a reboot, which is intentional. - - The content of /lib/udev/devices/ directory which contains the nodes, + - The content of /lib/udev/devices directory which contains the nodes, symlinks and directories, which are always expected to be in /dev, should be copied over to the tmpfs mounted /dev, to provide the required nodes to initialize udev and continue booting. - - The old hotplug helper /sbin/hotplug should be disabled in the kernel - configuration, it is not needed, and may render the system unusable - because of a fork-bombing behavior. + - The deprecated hotplug helper /sbin/hotplug should be disabled in the + kernel configuration, it is not needed today, and may render the system + unusable because the kernel may create too many processes in parallel + so that the system runs out-of-memory. - All kernel events are matched against a set of specified rules in - /lib/udev/rules.d/ which make it possible to hook into the event + /lib/udev/rules.d which make it possible to hook into the event processing to load required kernel modules and setup devices. For all devices the kernel exports a major/minor number, udev will create a device node with the default kernel name, or the one specified by a matching udev rule. -Please direct any comment/question/concern to the linux-hotplug mailing list at: +Please direct any comment/question to the linux-hotplug mailing list at: linux-hotplug@vger.kernel.org -- cgit v1.2.3-54-g00ecf From 71b4b701b1c5261de0dba5b071ec10089361de0e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 31 Aug 2009 16:05:52 +0200 Subject: rules: suse - use NAME for mapper/control --- rules/suse/64-device-mapper.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/suse/64-device-mapper.rules b/rules/suse/64-device-mapper.rules index 2bffe8344a..36ac7566d3 100644 --- a/rules/suse/64-device-mapper.rules +++ b/rules/suse/64-device-mapper.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -KERNEL=="device-mapper", SYMLINK+="mapper/control" +KERNEL=="device-mapper", NAME="mapper/control" KERNEL!="dm-*", GOTO="device_mapper_end" ACTION!="add|change", GOTO="device_mapper_end" -- cgit v1.2.3-54-g00ecf From 1032141bd580b20bfe6c5efe737eb6e3fa595d06 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 1 Sep 2009 04:47:16 +0200 Subject: pci-db: make sure we actually read the pci.ids file instead of usb.ids Since the recent Makefile.am rework both usb-db and pci-db were built to read the usb.ids database file. This fix makes sure pci-db properly reads pci.ids instead. Originally pointed out by Marco d'Itri. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index d785f05611..61fbf222cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -439,7 +439,7 @@ libexec_PROGRAMS += extras/usb-db/usb-db # pci-db - read PCI vendor/device string database # ------------------------------------------------------------------------------ extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c -extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_PCI +extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI extras_usb_db_pci_db_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/usb-db/pci-db -- cgit v1.2.3-54-g00ecf From 069eab7c96532ab32ce62293f88b10aa8fd41a02 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 1 Sep 2009 12:04:26 +0200 Subject: rules: sound - do not use /usr/bin/env The C version of path_id does not look at the environment anymore, so there is no reason to empty it. --- rules/rules.d/78-sound-card.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules index f851b46e00..1a9cea2b72 100644 --- a/rules/rules.d/78-sound-card.rules +++ b/rules/rules.d/78-sound-card.rules @@ -51,7 +51,7 @@ LABEL="skip_pci" ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}" ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}" -ENV{ID_PATH}=="", IMPORT{program}="/usr/bin/env -i /lib/udev/path_id %p/controlC%n" +ENV{ID_PATH}=="", IMPORT{program}="path_id %p/controlC%n" # The values used here for $SOUND_FORM_FACTOR and $SOUND_CLASS should be kept # in sync with those defined for PulseAudio's src/pulse/proplist.h -- cgit v1.2.3-54-g00ecf From 9257ecfc191ede0029e3486fd50c85b080927d0b Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Tue, 1 Sep 2009 12:15:54 +0200 Subject: ude_rules.c: fix possible NULL pointer dereference in get_key() --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index a45a8138f5..96645e8f02 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -878,7 +878,7 @@ static int get_key(struct udev *udev, char **line, char **key, enum operation_ty char *temp; linepos = *line; - if (linepos == NULL && linepos[0] == '\0') + if (linepos == NULL || linepos[0] == '\0') return -1; /* skip whitespace */ -- cgit v1.2.3-54-g00ecf From 32ecabb15d76bd9db8f7d15dcd39807383a93934 Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Tue, 1 Sep 2009 12:38:16 +0200 Subject: util_resolve_sys_link(): fix possible buffer overflow --- libudev/libudev-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index dcc4a0fd16..61cd963421 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -56,13 +56,13 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) { char link_target[UTIL_PATH_SIZE]; - int len; + ssize_t len; int i; int back; char *base; len = readlink(syspath, link_target, sizeof(link_target)); - if (len <= 0) + if (len <= 0 || len == (ssize_t)sizeof(link_target)) return -1; link_target[len] = '\0'; dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target); -- cgit v1.2.3-54-g00ecf From 06526049121495429757a5d2aa39189c30ca4aa7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 1 Sep 2009 12:39:57 +0200 Subject: libudev-util.c: get_sys_link() - return error for empty link target --- libudev/libudev-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index 61cd963421..38cfd7d0e6 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -31,7 +31,7 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL); len = readlink(path, path, sizeof(path)); - if (len < 0 || len >= (ssize_t) sizeof(path)) + if (len <= 0 || len == (ssize_t)sizeof(path)) return -1; path[len] = '\0'; pos = strrchr(path, '/'); -- cgit v1.2.3-54-g00ecf From 8cfcf9980a3a7037a12a3052c38e4981cb0f0190 Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Tue, 1 Sep 2009 12:54:21 +0200 Subject: udev_util_encode_string(): fix possible buffer overflow --- libudev/libudev-util.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index 38cfd7d0e6..9a656b5a98 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -448,28 +448,33 @@ int udev_util_encode_string(const char *str, char *str_enc, size_t len) { size_t i, j; - if (str == NULL || str_enc == NULL || len == 0) + if (str == NULL || str_enc == NULL) return -1; - str_enc[0] = '\0'; for (i = 0, j = 0; str[i] != '\0'; i++) { int seqlen; seqlen = utf8_encoded_valid_unichar(&str[i]); if (seqlen > 1) { + if (len-j < (size_t)seqlen) + goto err; memcpy(&str_enc[j], &str[i], seqlen); j += seqlen; i += (seqlen-1); } else if (str[i] == '\\' || !is_whitelisted(str[i], NULL)) { + if (len-j < 4) + goto err; sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); j += 4; } else { + if (len-j < 1) + goto err; str_enc[j] = str[i]; j++; } - if (j+3 >= len) - goto err; } + if (len-j < 1) + goto err; str_enc[j] = '\0'; return 0; err: -- cgit v1.2.3-54-g00ecf From 710fdac1e49276683abe927472fe1b336960edd8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 1 Sep 2009 13:16:48 +0200 Subject: udev-rules.c: remove 'first_token' variable --- udev/udev-rules.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 96645e8f02..4d9fa70ae5 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1568,7 +1568,6 @@ invalid: static int parse_file(struct udev_rules *rules, const char *filename, unsigned short filename_off) { FILE *f; - unsigned int first_token; char line[UTIL_LINE_SIZE]; int line_nr = 0; unsigned int i; @@ -1578,10 +1577,7 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s f = fopen(filename, "r"); if (f == NULL) return -1; - - first_token = rules->token_cur; - - while(fgets(line, sizeof(line), f) != NULL) { + while (fgets(line, sizeof(line), f) != NULL) { char *key; size_t len; @@ -1616,7 +1612,7 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s fclose(f); /* link GOTOs to LABEL rules in this file to be able to fast-forward */ - for (i = first_token+1; i < rules->token_cur; i++) { + for (i = rules->token_cur+1; i < rules->token_cur; i++) { if (rules->tokens[i].type == TK_A_GOTO) { char *label = &rules->buf[rules->tokens[i].key.value_off]; unsigned int j; -- cgit v1.2.3-54-g00ecf From 6d691b2bd669ea0bb3472a7a7d86780dd351977f Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Tue, 1 Sep 2009 13:26:37 +0200 Subject: udev-rules.c: parse_file() - fix possible buffer overflow --- udev/udev-rules.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 4d9fa70ae5..da08bc11f6 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1599,6 +1599,8 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s while (line[len-2] == '\\') { if (fgets(&line[len-2], (sizeof(line)-len)+2, f) == NULL) break; + if (strlen(&line[len-2]) < 2) + break; line_nr++; len = strlen(line); } -- cgit v1.2.3-54-g00ecf From f61e72d8973cf9d889a4f1233150870085c0b3e1 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 4 Sep 2009 17:12:28 +0200 Subject: make raw USB printer devices accessible for lp Starting from version 1.4, cups now uses libusb and printer USB devices instead of the usblp generated /dev/usb/lpX ones. In order to not require the cups USB backend to run as root now, change raw USB printer devices to be root:lp 0660, similar to usblpX devices. This might also enable the hplip backend to not run as root, since this has always used raw device nodes. https://launchpad.net/bugs/420015 --- rules/rules.d/50-udev-default.rules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 2507420b2c..4e9a73751e 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -60,6 +60,10 @@ SUBSYSTEM=="ppdev", GROUP="lp" SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" +# hplip and cups 1.4+ use raw USB devices, so permissions should be similar to +# the ones from the old usblp kernel module +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}==":0701*:", GROUP="lp", MODE="660" # block SUBSYSTEM=="block", GROUP="disk" -- cgit v1.2.3-54-g00ecf From 77f89e933034d150b54e10552504b8c6f013c3fd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 6 Sep 2009 16:53:14 +0200 Subject: Revert "udev-rules.c: remove 'first_token' variable" That was a mistake. The variable is needed to be set before we parse the file. Thanks a lot to Alan Jenkins for spotting this. This reverts commit 710fdac1e49276683abe927472fe1b336960edd8. --- udev/udev-rules.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index da08bc11f6..a92446403f 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1568,6 +1568,7 @@ invalid: static int parse_file(struct udev_rules *rules, const char *filename, unsigned short filename_off) { FILE *f; + unsigned int first_token; char line[UTIL_LINE_SIZE]; int line_nr = 0; unsigned int i; @@ -1577,7 +1578,10 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s f = fopen(filename, "r"); if (f == NULL) return -1; - while (fgets(line, sizeof(line), f) != NULL) { + + first_token = rules->token_cur; + + while(fgets(line, sizeof(line), f) != NULL) { char *key; size_t len; @@ -1614,7 +1618,7 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s fclose(f); /* link GOTOs to LABEL rules in this file to be able to fast-forward */ - for (i = rules->token_cur+1; i < rules->token_cur; i++) { + for (i = first_token+1; i < rules->token_cur; i++) { if (rules->tokens[i].type == TK_A_GOTO) { char *label = &rules->buf[rules->tokens[i].key.value_off]; unsigned int j; -- cgit v1.2.3-54-g00ecf From 9dae0e89b9d2138e028c2a69170ba2a96503b766 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 6 Sep 2009 16:55:00 +0200 Subject: test: catch possible bug in GOTO resolving --- test/udev-test.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index aaeec24955..47cadc5db3 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1524,8 +1524,9 @@ KERNEL=="sda1", GOTO="TEST" KERNEL=="sda1", NAME="wrong" KERNEL=="sda1", GOTO="BAD" KERNEL=="sda1", NAME="", LABEL="NO" -KERNEL=="sda1", NAME="right", LABEL="TEST" -KERNEL=="sda1", LABEL="BAD" +KERNEL=="sda1", NAME="right", LABEL="TEST", GOTO="end" +KERNEL=="sda1", NAME="wrong2", LABEL="BAD" +LABEL="end" EOF }, { -- cgit v1.2.3-54-g00ecf From 6d837a5348e7b38cb122405290b7bc3c17d069aa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 6 Sep 2009 17:24:26 +0200 Subject: udevadm: remove symlink support for old commands --- NEWS | 3 +++ TODO | 1 - udev/udevadm.c | 31 ------------------------------- 3 files changed, 3 insertions(+), 32 deletions(-) diff --git a/NEWS b/NEWS index daefed8812..dcbf3a66b2 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,9 @@ NAME="%k" causes a warning now. It's is and always was completely superfluous. It will break kernel supplied DEVNAMEs and therefore it needs to be removed from all rules. +Symlinks to udevadm with the old command names are no longer resolved to +the udevadm commands. + udev 146 ======== Bugfixes. diff --git a/TODO b/TODO index 84bfbf372e..05b763efa0 100644 --- a/TODO +++ b/TODO @@ -8,7 +8,6 @@ from the name stack, they can not conflict. o remove most NAME= rules (they are provided by the 2.6.31 kernel) o convert firmware.sh to C - o symlink names to udevadm will no longer be resolved to old command names o "udevadm control" commands will only accept the -- syntax o get rid of braindead "scan all devices to find myself" libusb interface if it can not be fixed, drop libusb entirely diff --git a/udev/udevadm.c b/udev/udevadm.c index b7295f3296..452489a0c7 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -131,7 +131,6 @@ int main(int argc, char *argv[]) }; const char *command; int i; - const char *pos; int rc = 1; udev = udev_new(); @@ -142,36 +141,6 @@ int main(int argc, char *argv[]) udev_set_log_fn(udev, log_fn); udev_selinux_init(udev); - /* see if we are a compat link, this will be removed in a future release */ - command = argv[0]; - pos = strrchr(command, '/'); - if (pos != NULL) - command = &pos[1]; - - /* the trailing part of the binary or link name is the command */ - if (strncmp(command, "udev", 4) == 0) - command = &command[4]; - - for (i = 0; cmds[i].cmd != NULL; i++) { - if (strcmp(cmds[i].name, command) == 0) { - char path[128]; - char prog[512]; - ssize_t len; - - snprintf(path, sizeof(path), "/proc/%lu/exe", (unsigned long) getppid()); - len = readlink(path, prog, sizeof(prog)); - if (len > 0) { - prog[len] = '\0'; - fprintf(stderr, "the program '%s' called '%s', it should use 'udevadm %s ', " - "this will stop working in a future release\n", prog, argv[0], command); - err(udev, "the program '%s' called '%s', it should use 'udevadm %s ', " - "this will stop working in a future release\n", prog, argv[0], command); - } - rc = run_command(udev, &cmds[i], argc, argv); - goto out; - } - } - while (1) { int option; -- cgit v1.2.3-54-g00ecf From 9e6273c713c5a4b4317decca33d2fba830562ff2 Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Sun, 6 Sep 2009 17:28:26 +0200 Subject: udev_queue_get_seqnum_sequence_is_finished(): fix possible file handle leak --- libudev/libudev-queue.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index 68efba0eee..f06c9e8a7a 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -360,10 +360,14 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, return 1; if (start < seqnum) start = seqnum; - if (start > end) + if (start > end) { + fclose(queue_file); return 1; - if (end - start > INT_MAX - 1) + } + if (end - start > INT_MAX - 1) { + fclose(queue_file); return -EOVERFLOW; + } unfinished = (end - start) + 1; while (unfinished > 0) { -- cgit v1.2.3-54-g00ecf From d412a685736e3b3350b555f4d7d8ebfc80aa54c9 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Sat, 5 Sep 2009 17:48:23 +1000 Subject: util_run_program: restore signal mask before executing event RUN commands External programs triggered by events (via RUN=) will inherit udev's signal mask, which is set to block all but SIGALRM. For most utilities, this is OK, but if we start daemons from RUN=, we run into trouble (especially as SIGCHLD is blocked). This change saves the original sigmask when udev starts, and restores it just before we exec() the external command. Signed-off-by: Jeremy Kerr --- libudev/libudev-private.h | 4 +++- libudev/libudev-util-private.c | 7 ++++++- udev/test-udev.c | 2 +- udev/udev-event.c | 4 ++-- udev/udev-rules.c | 4 ++-- udev/udev.h | 3 ++- udev/udevd.c | 6 ++++-- 7 files changed, 20 insertions(+), 10 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index b735298c67..e90c79cb3e 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -13,6 +13,7 @@ #define _LIBUDEV_PRIVATE_H_ #include +#include #include "libudev.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) @@ -214,7 +215,8 @@ int util_unlink_secure(struct udev *udev, const char *filename); uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); int util_run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen); + char *result, size_t ressize, size_t *reslen, + const sigset_t *sigmask); int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index fe8f29b3a8..dfde5a998d 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -242,7 +242,8 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, } int util_run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen) + char *result, size_t ressize, size_t *reslen, + const sigset_t *sigmask) { int status; int outpipe[2] = {-1, -1}; @@ -330,6 +331,10 @@ int util_run_program(struct udev *udev, const char *command, char **envp, dup2(errpipe[WRITE_END], STDERR_FILENO); close(errpipe[WRITE_END]); } + + if (sigmask) + sigprocmask(SIG_BLOCK, sigmask, NULL); + execve(argv[0], argv, envp); if (errno == ENOENT || errno == ENOTDIR) { /* may be on a filesystem which is not mounted right now */ diff --git a/udev/test-udev.c b/udev/test-udev.c index c6b8bf573b..0806fbf9ce 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) alarm(udev_device_get_event_timeout(dev)); if (err == 0 && !event->ignore_device && udev_get_run(udev)) - udev_event_execute_run(event); + udev_event_execute_run(event, NULL); udev_event_unref(event); udev_device_unref(dev); diff --git a/udev/udev-event.c b/udev/udev-event.c index 8183793e5f..7b4e4ac5c3 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -722,7 +722,7 @@ exit: return err; } -int udev_event_execute_run(struct udev_event *event) +int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) { struct udev_list_entry *list_entry; int err = 0; @@ -745,7 +745,7 @@ int udev_event_execute_run(struct udev_event *event) udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); - if (util_run_program(event->udev, program, envp, NULL, 0, NULL) != 0) { + if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask) != 0) { if (udev_list_entry_get_flag(list_entry)) err = -1; } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index a92446403f..20ec2706bd 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -749,7 +749,7 @@ static int import_program_into_properties(struct udev_device *dev, const char *p char *line; envp = udev_device_get_properties_envp(dev); - if (util_run_program(udev, program, envp, result, sizeof(result), &reslen) != 0) + if (util_run_program(udev, program, envp, result, sizeof(result), &reslen, NULL) != 0) return -1; line = result; @@ -2206,7 +2206,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event program, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL) != 0) { + if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL, NULL) != 0) { if (cur->key.op != OP_NOMATCH) goto nomatch; } else { diff --git a/udev/udev.h b/udev/udev.h index 391276f6e4..8f0a3014b6 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -21,6 +21,7 @@ #include #include +#include #include "libudev.h" #include "libudev-private.h" @@ -67,7 +68,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event struct udev_event *udev_event_new(struct udev_device *dev); void udev_event_unref(struct udev_event *event); int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules); -int udev_event_execute_run(struct udev_event *event); +int udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size); int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, char *result, size_t maxsize, int read_value); diff --git a/udev/udevd.c b/udev/udevd.c index 54064cbfcf..2eb914a3f3 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -79,6 +79,7 @@ static bool stop_exec_queue; static bool reload_config; static int max_childs; static int childs; +static sigset_t orig_sigmask; static struct udev_list_node event_list; static struct udev_list_node worker_list; static bool udev_exit; @@ -292,7 +293,8 @@ static void worker_new(struct event *event) /* execute RUN= */ if (err == 0 && !udev_event->ignore_device && udev_get_run(udev_event->udev)) - failed = udev_event_execute_run(udev_event); + failed = udev_event_execute_run(udev_event, + &orig_sigmask); /* reset alarm */ alarm(0); @@ -926,7 +928,7 @@ int main(int argc, char *argv[]) /* block and listen to all signals on signalfd */ sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, NULL); + sigprocmask(SIG_SETMASK, &mask, &orig_sigmask); pfd[FD_SIGNAL].fd = signalfd(-1, &mask, 0); if (pfd[FD_SIGNAL].fd < 0) { fprintf(stderr, "error getting signalfd\n"); -- cgit v1.2.3-54-g00ecf From f55083ce34c4065a4c87c98e0c77cb4bf70909d0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Sep 2009 12:12:55 +0200 Subject: util_run_program(): skip multiple spaces in argv creation --- libudev/libudev-util-private.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index dfde5a998d..fb64c13229 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -269,10 +269,14 @@ int util_run_program(struct udev *udev, const char *command, char **envp, /* do not separate quotes */ pos++; argv[i] = strsep(&pos, "\'"); - while (pos != NULL && pos[0] == ' ') - pos++; + if (pos != NULL) + while (pos[0] == ' ') + pos++; } else { argv[i] = strsep(&pos, " "); + if (pos != NULL) + while (pos[0] == ' ') + pos++; } dbg(udev, "arg[%i] '%s'\n", i, argv[i]); i++; -- cgit v1.2.3-54-g00ecf From 335e316a716e72a7aa8e56f266b6c8d7ad4f70a6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Sep 2009 12:15:29 +0200 Subject: fix whitespace --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 20ec2706bd..bc224040d2 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1581,7 +1581,7 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s first_token = rules->token_cur; - while(fgets(line, sizeof(line), f) != NULL) { + while (fgets(line, sizeof(line), f) != NULL) { char *key; size_t len; -- cgit v1.2.3-54-g00ecf From bfde03a14962c380d0e43327142710718c351cdb Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 7 Sep 2009 19:37:43 +0200 Subject: modem-modeswitch rules: Match more devices extras/modem-modeswitch/61-mobile-action.rules: Match on device class/subclass "00" as well, some devices like the Vodafone K3565-Z have that. https://launchpad.net/bugs/281335 --- extras/modem-modeswitch/61-mobile-action.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/modem-modeswitch/61-mobile-action.rules b/extras/modem-modeswitch/61-mobile-action.rules index 9f472318b8..9116b25e22 100644 --- a/extras/modem-modeswitch/61-mobile-action.rules +++ b/extras/modem-modeswitch/61-mobile-action.rules @@ -1,6 +1,6 @@ ACTION!="add", GOTO="mobile_action_end" -SUBSYSTEM=="usb", ATTR{bDeviceClass}=="ff", ATTR{bDeviceSubClass}=="ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" +SUBSYSTEM=="usb", ATTR{bDeviceClass}=="00|ff", ATTR{bDeviceSubClass}=="00|ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" GOTO="mobile_action_end" LABEL="mobile_action_switch" -- cgit v1.2.3-54-g00ecf From 1da6c797fdbb94372c1a809acf1a0ca159b2d7b1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 8 Sep 2009 14:57:42 +0200 Subject: require 2.6.27 for proper signalfd handling kay: ping I found out why udev-145 fails on some systems with kernel 2.6.25 and 2.6.26 kay: it is because glibc was compiled against linux-headers-2.6.27 or newer and issues signalfd4 syscall which was introduced in kernel 2.6.27 and not older signalfd syscall --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index f6d1ab5257..664457de0f 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ by udevadm and libudev. Tools and rules in /lib/udev, and the entire content of the /dev/.udev directory is private to udev and does change whenever needed. Requirements: - - Version 2.6.25 of the Linux kernel with sysfs, procfs, signalfd, inotify, + - Version 2.6.27 of the Linux kernel with sysfs, procfs, signalfd, inotify, unix domain sockets, networking and hotplug enabled: CONFIG_HOTPLUG=y CONFIG_UEVENT_HELPER_PATH="" @@ -22,7 +22,7 @@ Requirements: CONFIG_SYSFS_DEPRECATED*=n CONFIG_PROC_FS=y CONFIG_TMPFS=y - CONFIG_INOTIFY=y + CONFIG_INOTIFY_USER=y CONFIG_SIGNALFD=y CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes) CONFIG_BLK_DEV_BSG=y (SCSI devices) -- cgit v1.2.3-54-g00ecf From 04d4a6f85863552eaedc61cfeef5681776c8bb38 Mon Sep 17 00:00:00 2001 From: Florian Zumbiehl Date: Tue, 8 Sep 2009 21:42:21 +0200 Subject: util_run_program(): fix possible buffer overflow #2 I'm not sure how likely it is for UTIL_PATH_SIZE to have an odd value (maybe it has right now? :-), but I guess making this universally correct doesn't hurt ... --- libudev/libudev-util-private.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index fb64c13229..e0670dbae5 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -251,7 +251,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp, pid_t pid; char arg[UTIL_PATH_SIZE]; char program[UTIL_PATH_SIZE]; - char *argv[(sizeof(arg) / 2) + 1]; + char *argv[((sizeof(arg) + 1) / 2) + 1]; int devnull; int i; int err = 0; -- cgit v1.2.3-54-g00ecf From 78715f65c92a8892960e2a5fce945496939f8599 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 8 Sep 2009 22:11:04 +0200 Subject: fix randonm findings from llvm-clang-analyzer Thanks to Lennart for the log file! --- extras/collect/collect.c | 2 +- extras/fstab_import/fstab_import.c | 4 +- extras/modem-modeswitch/ma8280p_us.c | 322 +++++++++++++++++------------------ extras/scsi_id/scsi_serial.c | 3 - libudev/libudev-enumerate.c | 2 +- udev/udev-rules.c | 2 +- udev/udevadm-info.c | 2 +- 7 files changed, 167 insertions(+), 170 deletions(-) diff --git a/extras/collect/collect.c b/extras/collect/collect.c index c4523f1d18..0069dea0df 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -331,8 +331,8 @@ static void everybody(void) case STATE_CONFIRMED: state = "confirmed"; break; - fprintf(stderr, "ID: %s=%s\n", him->name, state); } + fprintf(stderr, "ID: %s=%s\n", him->name, state); } } diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c index 98ee75f174..c66bffb25c 100644 --- a/extras/fstab_import/fstab_import.c +++ b/extras/fstab_import/fstab_import.c @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) pos[0] = '\0'; label = str; } - if (matches_device_list(udev, devices, str)) { + if (matches_device_list(udev, devices, label)) { print_fstab_entry(udev, mnt); rc = 0; break; @@ -176,7 +176,7 @@ int main(int argc, char *argv[]) pos[0] = '\0'; uuid = str; } - if (matches_device_list(udev, devices, str)) { + if (matches_device_list(udev, devices, uuid)) { print_fstab_entry(udev, mnt); rc = 0; break; diff --git a/extras/modem-modeswitch/ma8280p_us.c b/extras/modem-modeswitch/ma8280p_us.c index 3cf9eb9eb2..d7cf4f4b3f 100644 --- a/extras/modem-modeswitch/ma8280p_us.c +++ b/extras/modem-modeswitch/ma8280p_us.c @@ -103,7 +103,7 @@ static void msleep(long msec) int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) { int ret = 1; - char *buf = NULL; + char *buf = NULL; buf = malloc (65535); if (!buf) { @@ -111,350 +111,350 @@ int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) return -1; } - ret = usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); + usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); msleep(6); - ret = usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); + usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); msleep(6); - ret = usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); + usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); msleep(10); ret = usb_release_interface(devh, 0); if (ret != 0) debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); - ret = usb_set_configuration(devh, 0x0000001); + usb_set_configuration(devh, 0x0000001); ret = usb_claim_interface(devh, 0); if (ret != 0) debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); - //ret = usb_set_altinterface(devh, 0); + //usb_set_altinterface(devh, 0); //msleep(33); - ret = usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); + usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); msleep(5); memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); - ret = usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); + usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); msleep(4); memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); - ret = usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); + usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); msleep(4); msleep(4); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(6); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(1); //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped msleep(4); memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); - ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); msleep(3); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(1); memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); - ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); msleep(7); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(1); memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); - ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); msleep(7); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(2); //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped msleep(4); memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); - ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); msleep(2); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(1); memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); - ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); msleep(7); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(1); memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); - ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); msleep(7); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(8); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(1); //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped msleep(4); memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); - ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); msleep(3); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); msleep(1); //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped msleep(4); memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); - ret = usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); msleep(3); - ret = usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); if (buf) free (buf); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 2e9168f941..7b308a935c 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -170,7 +170,6 @@ static int scsi_dump_sense(struct udev *udev, int code; int sense_class; int sense_key; - int descriptor_format; int asc, ascq; #ifdef DUMP_SENSE char out_buffer[256]; @@ -210,7 +209,6 @@ static int scsi_dump_sense(struct udev *udev, return -1; } if ((code == 0x0) || (code == 0x1)) { - descriptor_format = 0; sense_key = sense_buffer[2] & 0xf; if (s < 14) { /* @@ -223,7 +221,6 @@ static int scsi_dump_sense(struct udev *udev, asc = sense_buffer[12]; ascq = sense_buffer[13]; } else if ((code == 0x2) || (code == 0x3)) { - descriptor_format = 1; sense_key = sense_buffer[1] & 0xf; asc = sense_buffer[2]; ascq = sense_buffer[3]; diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index e30a406e5a..186abb927e 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -559,7 +559,7 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, if (subdir1 != NULL) l = util_strpcpyl(&s, l, "/", subdir1, NULL); if (subdir2 != NULL) - l = util_strpcpyl(&s, l, "/", subdir2, NULL); + util_strpcpyl(&s, l, "/", subdir2, NULL); dir = opendir(path); if (dir == NULL) return -1; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index bc224040d2..a85800adf2 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1127,7 +1127,7 @@ static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) for (i = 0; i < rule_tmp->token_cur; i++) { enum token_type next_val = TK_UNSET; - unsigned int next_idx; + unsigned int next_idx = 0; unsigned int j; /* find smallest value */ diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 519dc4a45b..d95091c4a4 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -60,7 +60,7 @@ static void print_all_attributes(struct udev_device *device, const char *key) value = udev_device_get_sysattr_value(device, dent->d_name); if (value == NULL) continue; - dbg(udev, "attr '%s'='%s'(%zi)\n", dent->d_name, value, len); + dbg(udev, "attr '%s'='%s'\n", dent->d_name, value); /* skip nonprintable attributes */ len = strlen(value); -- cgit v1.2.3-54-g00ecf From 6983c0d0f2e396102118016eb7d9dafb3e193d57 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 9 Sep 2009 11:09:17 +0200 Subject: extras/keymap: fix hash table collisions More than one key name was mapped to the same key, due to linux/input.h defining some aliases (in particular, KEY_HANGUEL, KEY_SCREENLOCK, KEY_MIN_INTERESTING). These caused hash table collisions. Changed the generation of the tables to ignore these aliases, and updated all keymaps to use the canonical name. This was detected by llvm-clang-analyzer. Thanks to Lennart Poettering for doing these checks and pointing this out! https://launchpad.net/bugs/426647 --- Makefile.am | 2 +- extras/keymap/keymaps/acer-travelmate_c300 | 2 +- extras/keymap/keymaps/dell | 2 +- extras/keymap/keymaps/hewlett-packard | 2 +- extras/keymap/keymaps/hewlett-packard-presario-2100 | 2 +- extras/keymap/keymaps/lenovo-thinkpad_x200_tablet | 2 +- extras/keymap/keymaps/lenovo-thinkpad_x6_tablet | 2 +- extras/keymap/keymaps/module-ibm | 2 +- extras/keymap/keymaps/module-lenovo | 2 +- extras/keymap/keymaps/toshiba-satellite_a110 | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index 61fbf222cb..9f8ca8c3ae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -528,7 +528,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/zepto-znote extras/keymap/keys.txt: /usr/include/linux/input.h - $(AM_V_GEN)$(AWK) '/^#define.*KEY_/ { if ($$2 != "KEY_MAX" && $$2 != "KEY_CNT") { print $$2 } }' < $< > $@ + $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[[:space:]]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< > $@ extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ diff --git a/extras/keymap/keymaps/acer-travelmate_c300 b/extras/keymap/keymaps/acer-travelmate_c300 index bfef4cf868..790332a8a5 100644 --- a/extras/keymap/keymaps/acer-travelmate_c300 +++ b/extras/keymap/keymaps/acer-travelmate_c300 @@ -2,4 +2,4 @@ 0x68 up 0x69 down 0x6B fn -0x6C screenlock # FIXME: lock tablet device/buttons +0x6C coffee # FIXME: lock tablet device/buttons diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell index 5ff44d6b38..917ea982ea 100644 --- a/extras/keymap/keymaps/dell +++ b/extras/keymap/keymaps/dell @@ -23,5 +23,5 @@ 0x9B switchvideomode # Display Toggle button 0xA2 playpause # Front panel play/pause 0xA4 stopcd # Front panel stop -0xD8 screenlock # FIXME: Tablet lock button +0xD8 coffee # FIXME: Tablet lock button 0xED media # MediaDirect button diff --git a/extras/keymap/keymaps/hewlett-packard b/extras/keymap/keymaps/hewlett-packard index 4461fa2ce5..76178f2697 100644 --- a/extras/keymap/keymaps/hewlett-packard +++ b/extras/keymap/keymaps/hewlett-packard @@ -1,6 +1,6 @@ 0x81 fn_esc 0x89 battery # FnF8 -0x8A screenlock # FnF6 +0x8A coffee # FnF6 0x8B camera 0x8C media # music 0x8E dvd diff --git a/extras/keymap/keymaps/hewlett-packard-presario-2100 b/extras/keymap/keymaps/hewlett-packard-presario-2100 index 1df39dcbd2..f274cfdae4 100644 --- a/extras/keymap/keymaps/hewlett-packard-presario-2100 +++ b/extras/keymap/keymaps/hewlett-packard-presario-2100 @@ -1,3 +1,3 @@ 0xF0 help -0xF1 screenlock +0xF1 coffee 0xF3 search diff --git a/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet b/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet index 31ea3b2c70..f15e9cc947 100644 --- a/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet +++ b/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet @@ -1,6 +1,6 @@ 0x5D menu 0x63 fn -0x66 screenlock +0x66 coffee 0x67 cyclewindows # bezel circular arrow 0x68 setup # bezel setup / menu 0x6c direction # rotate screen diff --git a/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet b/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet index 6fd16b5662..25fc842808 100644 --- a/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet +++ b/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet @@ -1,5 +1,5 @@ 0x6C f21 # rotate -0x68 screenlock # screenlock +0x68 coffee # screenlock 0x6B esc # escape 0x6D right # right on d-pad 0x6E left # left on d-pad diff --git a/extras/keymap/keymaps/module-ibm b/extras/keymap/keymaps/module-ibm index a92dfa2506..7afe6fa50a 100644 --- a/extras/keymap/keymaps/module-ibm +++ b/extras/keymap/keymaps/module-ibm @@ -1,5 +1,5 @@ 0x01 battery # Fn+F2 -0x02 screenlock # Fn+F3 +0x02 coffee # Fn+F3 0x03 sleep # Fn+F4 0x04 wlan # Fn+F5 0x06 switchvideomode # Fn+F7 diff --git a/extras/keymap/keymaps/module-lenovo b/extras/keymap/keymaps/module-lenovo index 7c597bd851..82be94f372 100644 --- a/extras/keymap/keymaps/module-lenovo +++ b/extras/keymap/keymaps/module-lenovo @@ -1,4 +1,4 @@ -0x1 screenlock # Fn+F2 +0x1 coffee # Fn+F2 0x2 battery # Fn+F3 0x3 sleep # Fn+F4 0x4 wlan # Fn+F5 diff --git a/extras/keymap/keymaps/toshiba-satellite_a110 b/extras/keymap/keymaps/toshiba-satellite_a110 index 0f2aaec420..5561e4a3af 100644 --- a/extras/keymap/keymaps/toshiba-satellite_a110 +++ b/extras/keymap/keymaps/toshiba-satellite_a110 @@ -5,6 +5,6 @@ 0x9F f21 # FIXME: Touchpad off 0xB9 nextsong 0xD9 brightnessup -0xEE screenlock +0xEE coffee 0xF4 previoussong 0xF7 playpause -- cgit v1.2.3-54-g00ecf From 7f06ec2e19387424de34bae35320c2fe192cb69d Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 9 Sep 2009 15:22:48 +0200 Subject: extras/keymap: Rename KEY_COFFEE to KEY_SCREENLOCK Unfortunately KEY_COFFEE is the canonical name in linux/input.h, and the more sensible KEY_SCREENLOCK is an alias. Manually override this particular case, since it's better to have "screenlock" in keymaps. However, we still keep the automatic filtering for the general case, to avoid introducing this problem again when input.h changes. --- Makefile.am | 2 +- extras/keymap/keymaps/acer-travelmate_c300 | 2 +- extras/keymap/keymaps/dell | 2 +- extras/keymap/keymaps/hewlett-packard | 2 +- extras/keymap/keymaps/hewlett-packard-presario-2100 | 2 +- extras/keymap/keymaps/lenovo-thinkpad_x200_tablet | 2 +- extras/keymap/keymaps/lenovo-thinkpad_x6_tablet | 2 +- extras/keymap/keymaps/module-ibm | 2 +- extras/keymap/keymaps/module-lenovo | 2 +- extras/keymap/keymaps/toshiba-satellite_a110 | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9f8ca8c3ae..5a6bc80adb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -528,7 +528,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/zepto-znote extras/keymap/keys.txt: /usr/include/linux/input.h - $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[[:space:]]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< > $@ + $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[[:space:]]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ diff --git a/extras/keymap/keymaps/acer-travelmate_c300 b/extras/keymap/keymaps/acer-travelmate_c300 index 790332a8a5..bfef4cf868 100644 --- a/extras/keymap/keymaps/acer-travelmate_c300 +++ b/extras/keymap/keymaps/acer-travelmate_c300 @@ -2,4 +2,4 @@ 0x68 up 0x69 down 0x6B fn -0x6C coffee # FIXME: lock tablet device/buttons +0x6C screenlock # FIXME: lock tablet device/buttons diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell index 917ea982ea..5ff44d6b38 100644 --- a/extras/keymap/keymaps/dell +++ b/extras/keymap/keymaps/dell @@ -23,5 +23,5 @@ 0x9B switchvideomode # Display Toggle button 0xA2 playpause # Front panel play/pause 0xA4 stopcd # Front panel stop -0xD8 coffee # FIXME: Tablet lock button +0xD8 screenlock # FIXME: Tablet lock button 0xED media # MediaDirect button diff --git a/extras/keymap/keymaps/hewlett-packard b/extras/keymap/keymaps/hewlett-packard index 76178f2697..4461fa2ce5 100644 --- a/extras/keymap/keymaps/hewlett-packard +++ b/extras/keymap/keymaps/hewlett-packard @@ -1,6 +1,6 @@ 0x81 fn_esc 0x89 battery # FnF8 -0x8A coffee # FnF6 +0x8A screenlock # FnF6 0x8B camera 0x8C media # music 0x8E dvd diff --git a/extras/keymap/keymaps/hewlett-packard-presario-2100 b/extras/keymap/keymaps/hewlett-packard-presario-2100 index f274cfdae4..1df39dcbd2 100644 --- a/extras/keymap/keymaps/hewlett-packard-presario-2100 +++ b/extras/keymap/keymaps/hewlett-packard-presario-2100 @@ -1,3 +1,3 @@ 0xF0 help -0xF1 coffee +0xF1 screenlock 0xF3 search diff --git a/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet b/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet index f15e9cc947..31ea3b2c70 100644 --- a/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet +++ b/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet @@ -1,6 +1,6 @@ 0x5D menu 0x63 fn -0x66 coffee +0x66 screenlock 0x67 cyclewindows # bezel circular arrow 0x68 setup # bezel setup / menu 0x6c direction # rotate screen diff --git a/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet b/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet index 25fc842808..6fd16b5662 100644 --- a/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet +++ b/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet @@ -1,5 +1,5 @@ 0x6C f21 # rotate -0x68 coffee # screenlock +0x68 screenlock # screenlock 0x6B esc # escape 0x6D right # right on d-pad 0x6E left # left on d-pad diff --git a/extras/keymap/keymaps/module-ibm b/extras/keymap/keymaps/module-ibm index 7afe6fa50a..a92dfa2506 100644 --- a/extras/keymap/keymaps/module-ibm +++ b/extras/keymap/keymaps/module-ibm @@ -1,5 +1,5 @@ 0x01 battery # Fn+F2 -0x02 coffee # Fn+F3 +0x02 screenlock # Fn+F3 0x03 sleep # Fn+F4 0x04 wlan # Fn+F5 0x06 switchvideomode # Fn+F7 diff --git a/extras/keymap/keymaps/module-lenovo b/extras/keymap/keymaps/module-lenovo index 82be94f372..7c597bd851 100644 --- a/extras/keymap/keymaps/module-lenovo +++ b/extras/keymap/keymaps/module-lenovo @@ -1,4 +1,4 @@ -0x1 coffee # Fn+F2 +0x1 screenlock # Fn+F2 0x2 battery # Fn+F3 0x3 sleep # Fn+F4 0x4 wlan # Fn+F5 diff --git a/extras/keymap/keymaps/toshiba-satellite_a110 b/extras/keymap/keymaps/toshiba-satellite_a110 index 5561e4a3af..0f2aaec420 100644 --- a/extras/keymap/keymaps/toshiba-satellite_a110 +++ b/extras/keymap/keymaps/toshiba-satellite_a110 @@ -5,6 +5,6 @@ 0x9F f21 # FIXME: Touchpad off 0xB9 nextsong 0xD9 brightnessup -0xEE coffee +0xEE screenlock 0xF4 previoussong 0xF7 playpause -- cgit v1.2.3-54-g00ecf From 6c29f2b942358d4dd9d3e7c65c13c3612dded3cc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Sep 2009 18:18:17 +0200 Subject: simplify "symlink name stack" With well defined and kernel-supplied node names, we no longer need to support a possible stack of conflicting symlinks and node names. Only symlinks with identical names can be claimed by multiple devices. This shrinks the former /dev/.udev/names/ significantly. Also the /dev/{block,char}/MAJ:MIN" links are excluded from the name stack - they are unique and can not conflict. --- NEWS | 4 + TODO | 7 -- libudev/libudev-device.c | 13 +- libudev/libudev-monitor.c | 4 +- libudev/libudev-private.h | 2 +- rules/rules.d/50-udev-default.rules | 4 +- udev/udev-event.c | 4 +- udev/udev-node.c | 241 +++++++++++++----------------------- udev/udev-rules.c | 42 ++++--- 9 files changed, 128 insertions(+), 193 deletions(-) diff --git a/NEWS b/NEWS index dcbf3a66b2..ff6d932052 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ Please do not port anything to the new format again, everything in /dev/.udev is and always was private to udev, and may and will change any time without prior notice. +Multiple devices claiming the same names in /dev are limited to symlinks +only now. Mixing identical symlink names and node names is not supported. +This reduces the amount of data in the database significantly. + NAME="%k" causes a warning now. It's is and always was completely superfluous. It will break kernel supplied DEVNAMEs and therefore it needs to be removed from all rules. diff --git a/TODO b/TODO index 05b763efa0..e1c06d5c6a 100644 --- a/TODO +++ b/TODO @@ -1,11 +1,4 @@ - o drop support for node names in name stack, support only symlinks - With well defined and kernel-supplied node names, we no longer need - to support a possible stack of conflicting symlinks and node names. - From there on, only symlinks with identical names can be claimed - by multiple devices. It will simplify the logic a lot and shrink - /dev/.udev/names/ significantly. Also exclude "*/MAJ:MIN" link names - from the name stack, they can not conflict. o remove most NAME= rules (they are provided by the 2.6.31 kernel) o convert firmware.sh to C o "udevadm control" commands will only accept the -- syntax diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 22d8349275..5d1ad9f223 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -123,7 +123,7 @@ int udev_device_read_db(struct udev_device *udev_device) next = &next[1]; } util_strscpyl(devlink, sizeof(devlink), udev_get_dev_path(udev_device->udev), "/", lnk, NULL); - udev_device_add_devlink(udev_device, devlink); + udev_device_add_devlink(udev_device, devlink, 0); } info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); return 0; @@ -150,7 +150,7 @@ int udev_device_read_db(struct udev_device *udev_device) break; case 'S': util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); - udev_device_add_devlink(udev_device, filename); + udev_device_add_devlink(udev_device, filename, 0); break; case 'L': udev_device_set_devlink_priority(udev_device, atoi(val)); @@ -1118,11 +1118,16 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode return 0; } -int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink) +int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique) { + struct udev_list_entry *list_entry; + udev_device->devlinks_uptodate = 0; - if (udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, 1, 0) == NULL) + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, 1, 0); + if (list_entry == NULL) return -ENOMEM; + if (unique) + udev_list_entry_set_flag(list_entry, 1); return 0; } diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 657f23d727..ee855afac4 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -628,12 +628,12 @@ retry: next = strchr(slink, ' '); while (next != NULL) { next[0] = '\0'; - udev_device_add_devlink(udev_device, slink); + udev_device_add_devlink(udev_device, slink, 0); slink = &next[1]; next = strchr(slink, ' '); } if (slink[0] != '\0') - udev_device_add_devlink(udev_device, slink); + udev_device_add_devlink(udev_device, slink, 0); } else if (strncmp(key, "DRIVER=", 7) == 0) { udev_device_set_driver(udev_device, &key[7]); } else if (strncmp(key, "ACTION=", 7) == 0) { diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index e90c79cb3e..285b9d48c1 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -69,7 +69,7 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype); int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); -int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink); +int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique); void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 4e9a73751e..200e2b4e51 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -1,7 +1,7 @@ # do not edit this file, it will be overwritten on update -SUBSYSTEM=="block", SYMLINK+="block/%M:%m" -SUBSYSTEM!="block", SYMLINK+="char/%M:%m" +SUBSYSTEM=="block", SYMLINK{unique}+="block/%M:%m" +SUBSYSTEM!="block", SYMLINK{unique}+="char/%M:%m" KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" diff --git a/udev/udev-event.c b/udev/udev-event.c index 7b4e4ac5c3..701c061820 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -688,9 +688,9 @@ exit_add: char devnode[UTIL_PATH_SIZE]; info(event->udev, "'%s' not found in database, using kernel name '%s'\n", - udev_device_get_syspath(dev), udev_device_get_sysname(dev)); + udev_device_get_syspath(dev), udev_device_get_knodename(dev)); util_strscpyl(devnode, sizeof(devnode), - udev_get_dev_path(event->udev), "/", udev_device_get_sysname(dev), NULL); + udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); udev_device_set_devnode(dev, devnode); } diff --git a/udev/udev-node.c b/udev/udev-node.c index 36f6f6d993..f17c48a7b4 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2008 Kay Sievers + * Copyright (C) 2003-2009 Kay Sievers * * 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 @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -31,29 +32,6 @@ #define TMP_FILE_EXT ".udev-tmp" -/* reverse mapping from the device file name to the devpath */ -static int name_index(struct udev_device *dev, const char *name, int add) -{ - struct udev *udev = udev_device_get_udev(dev); - char name_enc[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE * 2]; - - util_path_encode(&name[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); - snprintf(filename, sizeof(filename), "%s/.udev/names/%s/%u:%u", udev_get_dev_path(udev), name_enc, - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); - - if (add) { - dbg(udev, "creating index: '%s'\n", filename); - util_create_path(udev, filename); - symlink(udev_device_get_devpath(dev), filename); - } else { - dbg(udev, "removing index: '%s'\n", filename); - unlink(filename); - util_delete_path(udev, filename); - } - return 0; -} - int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); @@ -168,7 +146,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) info(udev, "found existing node instead of symlink '%s'\n", slink); if (lstat(node, &stats2) == 0) { if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && - stats.st_rdev == stats2.st_rdev) { + stats.st_rdev == stats2.st_rdev && stats.st_ino != stats2.st_ino) { info(udev, "replace device node '%s' with symlink to our node '%s'\n", slink, node); } else { @@ -222,143 +200,115 @@ exit: return err; } -static int name_index_get_devices(struct udev *udev, const char *name, struct udev_list_node *dev_list) +/* find device node of device with highest priority */ +static const char *link_find_prioritized(struct udev_device *dev, bool add, const char *stackdir, char *buf, size_t bufsize) { - char dirname[UTIL_PATH_SIZE]; - char *s; - size_t l; + struct udev *udev = udev_device_get_udev(dev); DIR *dir; - int count = 0; - - s = dirname; - l = util_strpcpyl(&s, sizeof(dirname), udev_get_dev_path(udev), - "/.udev/names/", NULL); - util_path_encode(&name[strlen(udev_get_dev_path(udev))+1], s, l); - dir = opendir(dirname); - if (dir == NULL) { - dbg(udev, "no index directory '%s': %m\n", dirname); - count = -1; - goto out; + int priority = 0; + const char *target = NULL; + + if (add) { + priority = udev_device_get_devlink_priority(dev); + util_strscpy(buf, bufsize, udev_device_get_devnode(dev)); + target = buf; } - dbg(udev, "found index directory '%s'\n", dirname); - while (1) { + dir = opendir(stackdir); + if (dir == NULL) + return target; + for (;;) { + struct udev_device *dev_db; struct dirent *dent; char devpath[UTIL_PATH_SIZE]; char syspath[UTIL_PATH_SIZE]; - int len; + ssize_t len; dent = readdir(dir); if (dent == NULL || dent->d_name[0] == '\0') break; if (dent->d_name[0] == '.') continue; - + dbg(udev, "found '%s/%s'\n", stackdir, dent->d_name); len = readlinkat(dirfd(dir), dent->d_name, devpath, sizeof(devpath)); - if (len < 0 || (size_t)len >= sizeof(devpath)) + if (len <= 0 || len == (ssize_t)sizeof(devpath)) continue; devpath[len] = '\0'; util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - udev_list_entry_add(udev, dev_list, syspath, NULL, 1, 0); - count++; + info(udev, "found '%s' claiming '%s'\n", syspath, stackdir); + + /* did we find ourself? */ + if (strcmp(udev_device_get_syspath(dev), syspath) == 0) + continue; + + dev_db = udev_device_new_from_syspath(udev, syspath); + if (dev_db != NULL) { + const char *devnode; + + devnode = udev_device_get_devnode(dev_db); + if (devnode != NULL) { + dbg(udev, "compare priority of '%s'(%i) > '%s'(%i)\n", target, priority, + udev_device_get_devnode(dev_db), udev_device_get_devlink_priority(dev_db)); + if (target == NULL || udev_device_get_devlink_priority(dev_db) > priority) { + info(udev, "'%s' claims priority %i for '%s'\n", + syspath, udev_device_get_devlink_priority(dev_db), stackdir); + priority = udev_device_get_devlink_priority(dev_db); + util_strscpy(buf, bufsize, devnode); + target = buf; + } + } + udev_device_unref(dev_db); + } } - closedir(dir); -out: - return count; + return target; } -static int update_link(struct udev_device *dev, const char *slink) +/* manage "stack of names" with possibly specified device priorities */ +static void link_update(struct udev_device *dev, const char *slink, bool add) { struct udev *udev = udev_device_get_udev(dev); - struct udev_list_node dev_list; - struct udev_list_entry *dev_entry; - char target[UTIL_PATH_SIZE]; - int count; - int priority = 0; - int rc = 0; + char name_enc[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE * 2]; + char dirname[UTIL_PATH_SIZE]; + const char *target; + char buf[UTIL_PATH_SIZE]; dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); - udev_list_init(&dev_list); - count = name_index_get_devices(udev, slink, &dev_list); - if (count > 1) - info(udev, "found %i devices with name '%s'\n", count, slink); + util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); + snprintf(dirname, sizeof(dirname), "%s/.udev/links/%s", udev_get_dev_path(udev), name_enc); + snprintf(filename, sizeof(filename), "%s/%c%u:%u", dirname, + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? 'b' : 'c', + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + + if (!add) { + dbg(udev, "removing index: '%s'\n", filename); + unlink(filename); + util_delete_path(udev, filename); + } - /* if we don't have a reference, delete it */ - if (count <= 0) { + target = link_find_prioritized(dev, add, dirname, buf, sizeof(buf)); + if (target == NULL) { info(udev, "no reference left, remove '%s'\n", slink); unlink(slink); util_delete_path(udev, slink); - goto out; - } - - /* find the device with the highest priority */ - target[0] = '\0'; - udev_list_entry_foreach(dev_entry, udev_list_get_entry(&dev_list)) { - const char *syspath; - struct udev_device *dev_db; - const char *devnode; - - syspath = udev_list_entry_get_name(dev_entry); - dbg(udev, "found '%s' for '%s'\n", syspath, slink); - - /* did we find ourself? we win, if we have the same priority */ - if (strcmp(udev_device_get_syspath(dev), syspath) == 0) { - dbg(udev, "compare (our own) priority of '%s' %i >= %i\n", - udev_device_get_devpath(dev), udev_device_get_devlink_priority(dev), priority); - if (strcmp(udev_device_get_devnode(dev), slink) == 0) { - info(udev, "'%s' is our device node, database inconsistent, skip link update\n", - udev_device_get_devnode(dev)); - } else if (target[0] == '\0' || udev_device_get_devlink_priority(dev) >= priority) { - priority = udev_device_get_devlink_priority(dev); - util_strscpy(target, sizeof(target), udev_device_get_devnode(dev)); - } - continue; - } - - /* another device, read priority from database */ - dev_db = udev_device_new_from_syspath(udev, syspath); - if (dev_db == NULL) - continue; - devnode = udev_device_get_devnode(dev_db); - if (devnode != NULL) { - if (strcmp(devnode, slink) == 0) { - info(udev, "'%s' is a device node of '%s', skip link update\n", - devnode, syspath); - } else { - dbg(udev, "compare priority of '%s' %i > %i\n", - udev_device_get_devpath(dev_db), - udev_device_get_devlink_priority(dev_db), - priority); - if (target[0] == '\0' || udev_device_get_devlink_priority(dev_db) > priority) { - priority = udev_device_get_devlink_priority(dev_db); - util_strscpy(target, sizeof(target), devnode); - } - } - } - udev_device_unref(dev_db); + } else { + util_create_path(udev, slink); + info(udev, "creating link '%s' to '%s'\n", slink, target); + node_symlink(udev, target, slink); } - udev_list_cleanup_entries(udev, &dev_list); - if (target[0] == '\0') { - info(udev, "no current target for '%s' found\n", slink); - rc = 1; - goto out; + if (add) { + dbg(udev, "creating index: '%s'\n", filename); + util_create_path(udev, filename); + symlink(udev_device_get_devpath(dev), filename); } - - /* create symlink to the target with the highest priority */ - info(udev, "'%s' with target '%s' has the highest priority %i, create it\n", slink, target, priority); - util_create_path(udev, slink); - node_symlink(udev, target, slink); -out: - return rc; } void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old) { struct udev *udev = udev_device_get_udev(dev); struct udev_list_entry *list_entry; - const char *devnode_old; /* update possible left-over symlinks */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { @@ -366,10 +316,6 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev struct udev_list_entry *list_entry_current; int found; - /* check if old link name is now our node name */ - if (strcmp(name, udev_device_get_devnode(dev)) == 0) - continue; - /* check if old link name still belongs to this device */ found = 0; udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { @@ -385,23 +331,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev info(udev, "update old name, '%s' no longer belonging to '%s'\n", name, udev_device_get_devpath(dev)); - name_index(dev, name, 0); - update_link(dev, name); - } - - /* - * if the node name has changed, delete the node, - * and possibly restore a symlink of a different device - */ - devnode_old = udev_device_get_devnode(dev_old); - if (devnode_old != NULL) { - const char *devnode = udev_device_get_devnode(dev); - - if (devnode != NULL && strcmp(devnode_old, devnode) != 0) { - info(udev, "node has changed from '%s' to '%s'\n", devnode_old, devnode); - name_index(dev, devnode_old, 0); - update_link(dev, devnode_old); - } + link_update(dev, name, 0); } } @@ -441,13 +371,15 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) } } - /* add node to name index */ - name_index(dev, udev_device_get_devnode(dev), 1); - /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - name_index(dev, udev_list_entry_get_name(list_entry), 1); - update_link(dev, udev_list_entry_get_name(list_entry)); + if (udev_list_entry_get_flag(list_entry)) { + /* simple unmanaged link name */ + util_create_path(udev, udev_list_entry_get_name(list_entry)); + node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry)); + } else { + link_update(dev, udev_list_entry_get_name(list_entry), 1); + } } exit: return err; @@ -463,14 +395,9 @@ int udev_node_remove(struct udev_device *dev) int err = 0; int num; - /* remove node from name index */ - name_index(dev, udev_device_get_devnode(dev), 0); - /* remove,update symlinks, remove symlinks from name index */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - name_index(dev, udev_list_entry_get_name(list_entry), 0); - update_link(dev, udev_list_entry_get_name(list_entry)); - } + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) + link_update(dev, udev_list_entry_get_name(list_entry), 0); devnode = udev_device_get_devnode(dev); if (devnode == NULL) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index a85800adf2..904ddac72c 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -190,7 +190,8 @@ struct token { unsigned int value_off; union { unsigned int attr_off; - int ignore_error; + int devlink_unique; + int fail_on_error; unsigned int rule_goto; mode_t mode; uid_t uid; @@ -1011,7 +1012,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_GROUP: case TK_A_MODE: case TK_A_NAME: - case TK_A_DEVLINK: case TK_A_GOTO: token->key.value_off = add_string(rule_tmp->rules, value); break; @@ -1024,6 +1024,10 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, token->key.value_off = add_string(rule_tmp->rules, value); token->key.attr_off = add_string(rule_tmp->rules, attr); break; + case TK_A_DEVLINK: + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.devlink_unique = *(int *)data; + break; case TK_M_TEST: token->key.value_off = add_string(rule_tmp->rules, value); if (data != NULL) @@ -1037,7 +1041,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, break; case TK_A_RUN: token->key.value_off = add_string(rule_tmp->rules, value); - token->key.ignore_error = *(int *)data; + token->key.fail_on_error = *(int *)data; break; case TK_A_INOTIFY_WATCH: case TK_A_NUM_FAKE_PART: @@ -1432,10 +1436,16 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcmp(key, "SYMLINK") == 0) { - if (op < OP_MATCH_MAX) + if (op < OP_MATCH_MAX) { rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL); - else - rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, NULL); + } else { + int flag = 0; + + attr = get_key_attribute(rules->udev, key + sizeof("SYMLINK")-1); + if (attr != NULL && strstr(attr, "unique") != NULL) + flag = 1; + rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, &flag); + } rule_tmp.rule.rule.flags = 1; continue; } @@ -2445,26 +2455,22 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event while (isspace(pos[0])) pos++; next = strchr(pos, ' '); - while (next) { + while (next != NULL) { next[0] = '\0'; - info(event->udev, "LINK '%s' %s:%u\n", - pos, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); while (isspace(next[1])) next++; pos = &next[1]; next = strchr(pos, ' '); } if (pos[0] != '\0') { - info(event->udev, "LINK '%s' %s:%u\n", - pos, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); } } break; @@ -2511,7 +2517,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rule->rule.filename_line); list_entry = udev_list_entry_add(event->udev, &event->run_list, &rules->buf[cur->key.value_off], NULL, 1, 0); - if (cur->key.ignore_error) + if (cur->key.fail_on_error) udev_list_entry_set_flag(list_entry, 1); break; } -- cgit v1.2.3-54-g00ecf From c26e3f69010573710110d98b8f75bcd1ea5fdac5 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 9 Sep 2009 23:11:40 +0200 Subject: sound: recognize saa7134 TV card sound devices as TV cards --- rules/rules.d/78-sound-card.rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules index 1a9cea2b72..f40921d9d1 100644 --- a/rules/rules.d/78-sound-card.rules +++ b/rules/rules.d/78-sound-card.rules @@ -63,8 +63,9 @@ ATTR{pcmC%nD0p/pcm_class}=="modem", ENV{SOUND_CLASS}="modem", GOTO="sound_end" # Identify cards on the internal PCI bus as internal SUBSYSTEMS=="pci", DEVPATH=="*/0000:00:??.?/sound/*", ENV{SOUND_FORM_FACTOR}="internal", GOTO="sound_end" -# Recognize good old WinTV cards as TV cards +# Recognize good old WinTV cards and those based on saa7134 as TV cards SUBSYSTEMS=="pci", DRIVERS=="Bt87x", ENV{SOUND_FORM_FACTOR}="tv", GOTO="sound_end" +SUBSYSTEMS=="pci", DRIVERS=="saa7134", ENV{SOUND_FORM_FACTOR}="tv", GOTO="sound_end" # Hmm, do we really want this database here? SUBSYSTEMS=="usb", ATTRS{idVendor}=="0471", ATTRS{idProduct}=="0311", ENV{SOUND_FORM_FACTOR}="webcam", GOTO="sound_end" -- cgit v1.2.3-54-g00ecf From 676d294c23cf999ac7d192b058476f91242550c0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Sep 2009 01:35:48 +0200 Subject: reorder create_path() and node/link creation to be called in a direct sequence --- libudev/libudev-queue-private.c | 4 +--- udev/udev-node.c | 11 +++++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index e0a8738e0e..d9f7a67d18 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -407,10 +407,8 @@ static void update_failed(struct udev_queue_export *udev_queue_export, switch (state) { case DEVICE_FAILED: /* record event in the failed directory */ - if (udev_queue_export->failed_count == 0) - util_create_path(udev, filename); udev_queue_export->failed_count++; - + util_create_path(udev, filename); udev_selinux_setfscreatecon(udev, filename, S_IFLNK); symlink(udev_device_get_devpath(udev_device), filename); udev_selinux_resetfscreatecon(udev); diff --git a/udev/udev-node.c b/udev/udev-node.c index f17c48a7b4..3685485eb1 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -77,6 +77,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod } } else { info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); + util_create_path(udev, file); udev_selinux_setfscreatecon(udev, file, mode); err = mknod(file, mode, devnum); udev_selinux_resetfscreatecon(udev); @@ -174,6 +175,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) } } else { info(udev, "creating symlink '%s' to '%s'\n", slink, target); + util_create_path(udev, slink); udev_selinux_setfscreatecon(udev, slink, S_IFLNK); err = symlink(target, slink); udev_selinux_resetfscreatecon(udev); @@ -184,6 +186,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) info(udev, "atomically replace '%s'\n", slink); util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); unlink(slink_tmp); + util_create_path(udev, slink); udev_selinux_setfscreatecon(udev, slink, S_IFLNK); err = symlink(target, slink_tmp); udev_selinux_resetfscreatecon(udev); @@ -293,7 +296,6 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) unlink(slink); util_delete_path(udev, slink); } else { - util_create_path(udev, slink); info(udev, "creating link '%s' to '%s'\n", slink, target); node_symlink(udev, target, slink); } @@ -348,7 +350,6 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)), mode, uid, gid); - util_create_path(udev, udev_device_get_devnode(dev)); if (udev_node_mknod(dev, NULL, makedev(0,0), mode, uid, gid) != 0) { err = -1; goto exit; @@ -373,13 +374,11 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - if (udev_list_entry_get_flag(list_entry)) { + if (udev_list_entry_get_flag(list_entry)) /* simple unmanaged link name */ - util_create_path(udev, udev_list_entry_get_name(list_entry)); node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry)); - } else { + else link_update(dev, udev_list_entry_get_name(list_entry), 1); - } } exit: return err; -- cgit v1.2.3-54-g00ecf From b6a2637524e4b94ba51abcf5ee42f3676c9755ed Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Sep 2009 02:08:05 +0200 Subject: put util_create_path() and file creastion in a retry loop On 8/29/09, Florian Zumbiehl wrote: > Could it happen that > util_create_path() and util_delete_path() > do run in parallel for > the same directory? After all, util_create_path() > does handle > the case where creation of the directory happens in parallel > to it running, so it doesn't seem all that unlikely to me ... --- libudev/libudev-queue-private.c | 15 ++++++++++----- udev/udev-node.c | 42 +++++++++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 19 deletions(-) diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index d9f7a67d18..4e67a1f9d0 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -45,9 +45,9 @@ #include #include #include +#include #include #include -#include #include "libudev.h" #include "libudev-private.h" @@ -396,6 +396,7 @@ static void update_failed(struct udev_queue_export *udev_queue_export, { struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; + int err; if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) return; @@ -408,10 +409,14 @@ static void update_failed(struct udev_queue_export *udev_queue_export, case DEVICE_FAILED: /* record event in the failed directory */ udev_queue_export->failed_count++; - util_create_path(udev, filename); - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); - symlink(udev_device_get_devpath(udev_device), filename); - udev_selinux_resetfscreatecon(udev); + do { + util_create_path(udev, filename); + udev_selinux_setfscreatecon(udev, filename, S_IFLNK); + err = symlink(udev_device_get_devpath(udev_device), filename); + if (err != 0) + err = errno; + udev_selinux_resetfscreatecon(udev); + } while (err == ENOENT); break; case DEVICE_QUEUED: diff --git a/udev/udev-node.c b/udev/udev-node.c index 3685485eb1..39bec3e166 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -77,10 +77,14 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod } } else { info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); - util_create_path(udev, file); - udev_selinux_setfscreatecon(udev, file, mode); - err = mknod(file, mode, devnum); - udev_selinux_resetfscreatecon(udev); + do { + util_create_path(udev, file); + udev_selinux_setfscreatecon(udev, file, mode); + err = mknod(file, mode, devnum); + if (err != 0) + err = errno; + udev_selinux_resetfscreatecon(udev); + } while (err == ENOENT); if (err != 0) { err(udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", file, mode, major(devnum), minor(devnum)); goto exit; @@ -175,10 +179,14 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) } } else { info(udev, "creating symlink '%s' to '%s'\n", slink, target); - util_create_path(udev, slink); - udev_selinux_setfscreatecon(udev, slink, S_IFLNK); - err = symlink(target, slink); - udev_selinux_resetfscreatecon(udev); + do { + util_create_path(udev, slink); + udev_selinux_setfscreatecon(udev, slink, S_IFLNK); + err = symlink(target, slink); + if (err != 0) + err = errno; + udev_selinux_resetfscreatecon(udev); + } while (err == ENOENT); if (err == 0) goto exit; } @@ -186,10 +194,14 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) info(udev, "atomically replace '%s'\n", slink); util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); unlink(slink_tmp); - util_create_path(udev, slink); - udev_selinux_setfscreatecon(udev, slink, S_IFLNK); - err = symlink(target, slink_tmp); - udev_selinux_resetfscreatecon(udev); + do { + util_create_path(udev, slink); + udev_selinux_setfscreatecon(udev, slink, S_IFLNK); + err = symlink(target, slink_tmp); + if (err != 0) + err = errno; + udev_selinux_resetfscreatecon(udev); + } while (err == ENOENT); if (err != 0) { err(udev, "symlink(%s, %s) failed: %m\n", target, slink_tmp); goto exit; @@ -302,8 +314,10 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) if (add) { dbg(udev, "creating index: '%s'\n", filename); - util_create_path(udev, filename); - symlink(udev_device_get_devpath(dev), filename); + do { + util_create_path(udev, filename); + symlink(udev_device_get_devpath(dev), filename); + } while (errno == ENOENT); } } -- cgit v1.2.3-54-g00ecf From bbfeee28fc00642a01bf3f9c24e6c0e942d4adf8 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 14 Sep 2009 13:56:38 +0200 Subject: udevadm: print all messages to stderr with priority higher or equal than LOG_ERR It is needed to prevent errors in udev from going unnoticed (e.g. when udevd is not running). --- udev/udevadm-control.c | 5 ----- udev/udevadm-settle.c | 3 --- udev/udevadm-trigger.c | 1 - udev/udevadm.c | 2 ++ 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 3eb03d8b04..42818d9db7 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -81,8 +81,6 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) break; if (option > 255) { - fprintf(stderr, "udevadm control expects commands without underscore, " - "this will stop working in a future release\n"); err(udev, "udevadm control expects commands without underscore, " "this will stop working in a future release\n"); } @@ -144,8 +142,6 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) if (argv[optind] != NULL) { const char *arg = argv[optind]; - fprintf(stderr, "udevadm control commands requires the -- format, " - "this will stop working in a future release\n"); err(udev, "udevadm control commands requires the -- format, " "this will stop working in a future release\n"); @@ -177,7 +173,6 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) } if (rc != 0) { - fprintf(stderr, "unrecognized command\n"); err(udev, "unrecognized command\n"); } exit: diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 124c59698c..5030f18602 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -140,14 +140,12 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (start > end) { err(udev, "seq-start larger than seq-end, ignoring\n"); - fprintf(stderr, "seq-start larger than seq-end, ignoring\n"); start = 0; end = 0; } if (start > kernel_seq || end > kernel_seq) { err(udev, "seq-start or seq-end larger than current kernel value, ignoring\n"); - fprintf(stderr, "seq-start or seq-end larger than current kernel value, ignoring\n"); start = 0; end = 0; } @@ -155,7 +153,6 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } else { if (end > 0) { err(udev, "seq-end needs seq-start parameter, ignoring\n"); - fprintf(stderr, "seq-end needs seq-start parameter, ignoring\n"); end = 0; } } diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 8a626ec744..dbcaee3dbd 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -146,7 +146,6 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) } else if (strcmp(optarg, "failed") == 0) { device_type = TYPE_FAILED; } else { - fprintf(stderr, "unknown type --type=%s\n", optarg); err(udev, "unknown type --type=%s\n", optarg); rc = 2; goto exit; diff --git a/udev/udevadm.c b/udev/udevadm.c index 452489a0c7..3d94215ba9 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -35,6 +35,8 @@ static void log_fn(struct udev *udev, int priority, fprintf(stderr, "%s: ", fn); vfprintf(stderr, format, args); } else { + if (priority <= LOG_ERR) + vfprintf(stderr, format, args); vsyslog(priority, format, args); } } -- cgit v1.2.3-54-g00ecf From 2079b52e1739a984119b9294bc2b7b31b8cff2e0 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 14 Sep 2009 14:05:31 +0200 Subject: udevadmi: control = exit with rc=2 if there is some system error --- udev/udevadm-control.c | 79 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 52 insertions(+), 27 deletions(-) diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 42818d9db7..21d366b234 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -68,8 +68,10 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) } uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); - if (uctrl == NULL) + if (uctrl == NULL) { + rc = 2; goto exit; + } while (1) { int option; @@ -93,31 +95,41 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) fprintf(stderr, "invalid number '%s'\n", optarg); goto exit; } - udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg)); - rc = 0; + if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg)) < 0) + rc = 2; + else + rc = 0; break; case 's': case 's' + 256: - udev_ctrl_send_stop_exec_queue(uctrl); - rc = 0; + if (udev_ctrl_send_stop_exec_queue(uctrl) < 0) + rc = 2; + else + rc = 0; break; case 'S': case 'S' + 256: - udev_ctrl_send_start_exec_queue(uctrl); - rc = 0; + if (udev_ctrl_send_start_exec_queue(uctrl) < 0) + rc = 2; + else + rc = 0; break; case 'R': case 'R' + 256: - udev_ctrl_send_reload_rules(uctrl); - rc = 0; + if (udev_ctrl_send_reload_rules(uctrl) < 0) + rc = 2; + else + rc = 0; break; case 'p': if (strchr(optarg, '=') == NULL) { fprintf(stderr, "expect = instead of '%s'\n", optarg); goto exit; } - udev_ctrl_send_set_env(uctrl, optarg); - rc = 0; + if (udev_ctrl_send_set_env(uctrl, optarg) < 0) + rc = 2; + else + rc = 0; break; case 'm': case 'm' + 256: @@ -126,8 +138,10 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) fprintf(stderr, "invalid number '%s'\n", optarg); goto exit; } - udev_ctrl_send_set_max_childs(uctrl, i); - rc = 0; + if (udev_ctrl_send_set_max_childs(uctrl, i) < 0) + rc = 2; + else + rc = 0; break; case 'h': print_help(); @@ -146,35 +160,46 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) "this will stop working in a future release\n"); if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { - udev_ctrl_send_set_log_level(uctrl, util_log_priority(&arg[strlen("log_priority=")])); - rc = 0; + if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(&arg[strlen("log_priority=")])) < 0) + rc = 2; + else + rc = 0; goto exit; } else if (!strcmp(arg, "stop_exec_queue")) { - udev_ctrl_send_stop_exec_queue(uctrl); - rc = 0; + if (udev_ctrl_send_stop_exec_queue(uctrl) < 0) + rc = 2; + else + rc = 0; goto exit; } else if (!strcmp(arg, "start_exec_queue")) { - udev_ctrl_send_start_exec_queue(uctrl); - rc = 0; + if (udev_ctrl_send_start_exec_queue(uctrl) < 0) + rc = 2; + else + rc = 0; goto exit; } else if (!strcmp(arg, "reload_rules")) { - udev_ctrl_send_reload_rules(uctrl); - rc = 0; + if (udev_ctrl_send_reload_rules(uctrl) < 0) + rc = 2; + else + rc = 0; goto exit; } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { - udev_ctrl_send_set_max_childs(uctrl, strtoul(&arg[strlen("max_childs=")], NULL, 0)); - rc = 0; + if (udev_ctrl_send_set_max_childs(uctrl, strtoul(&arg[strlen("max_childs=")], NULL, 0)) < 0) + rc = 2; + else + rc = 0; goto exit; } else if (!strncmp(arg, "env", strlen("env"))) { - udev_ctrl_send_set_env(uctrl, &arg[strlen("env=")]); - rc = 0; + if (udev_ctrl_send_set_env(uctrl, &arg[strlen("env=")]) < 0) + rc = 2; + else + rc = 0; goto exit; } } - if (rc != 0) { + if (rc == 1) err(udev, "unrecognized command\n"); - } exit: udev_ctrl_unref(uctrl); return rc; -- cgit v1.2.3-54-g00ecf From ca508dd94dc785492b5c62f56b02c0eeb3775f38 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 14 Sep 2009 14:29:05 +0200 Subject: udevadm: control - remove compat code --- TODO | 1 - udev/udevadm-control.c | 73 +++----------------------------------------------- 2 files changed, 4 insertions(+), 70 deletions(-) diff --git a/TODO b/TODO index e1c06d5c6a..583d24e6be 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,6 @@ o remove most NAME= rules (they are provided by the 2.6.31 kernel) o convert firmware.sh to C - o "udevadm control" commands will only accept the -- syntax o get rid of braindead "scan all devices to find myself" libusb interface if it can not be fixed, drop libusb entirely o remove copy of bsg.h diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 21d366b234..0fd69b9a0a 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -47,31 +47,24 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) /* compat values with '_' will be removed in a future release */ static const struct option options[] = { { "log-priority", required_argument, NULL, 'l' }, - { "log_priority", required_argument, NULL, 'l' + 256 }, { "stop-exec-queue", no_argument, NULL, 's' }, - { "stop_exec_queue", no_argument, NULL, 's' + 256 }, { "start-exec-queue", no_argument, NULL, 'S' }, - { "start_exec_queue", no_argument, NULL, 'S' + 256}, { "reload-rules", no_argument, NULL, 'R' }, - { "reload_rules", no_argument, NULL, 'R' + 256}, { "property", required_argument, NULL, 'p' }, { "env", required_argument, NULL, 'p' }, { "max-childs", required_argument, NULL, 'm' }, - { "max_childs", required_argument, NULL, 'm' + 256}, { "help", no_argument, NULL, 'h' }, {} }; if (getuid() != 0) { fprintf(stderr, "root privileges required\n"); - goto exit; + return 1; } uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); - if (uctrl == NULL) { - rc = 2; - goto exit; - } + if (uctrl == NULL) + return 2; while (1) { int option; @@ -82,14 +75,8 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) if (option == -1) break; - if (option > 255) { - err(udev, "udevadm control expects commands without underscore, " - "this will stop working in a future release\n"); - } - switch (option) { case 'l': - case 'l' + 256: i = util_log_priority(optarg); if (i < 0) { fprintf(stderr, "invalid number '%s'\n", optarg); @@ -101,21 +88,18 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) rc = 0; break; case 's': - case 's' + 256: if (udev_ctrl_send_stop_exec_queue(uctrl) < 0) rc = 2; else rc = 0; break; case 'S': - case 'S' + 256: if (udev_ctrl_send_start_exec_queue(uctrl) < 0) rc = 2; else rc = 0; break; case 'R': - case 'R' + 256: if (udev_ctrl_send_reload_rules(uctrl) < 0) rc = 2; else @@ -132,7 +116,6 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) rc = 0; break; case 'm': - case 'm' + 256: i = strtoul(optarg, &endp, 0); if (endp[0] != '\0' || i < 1) { fprintf(stderr, "invalid number '%s'\n", optarg); @@ -146,55 +129,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) case 'h': print_help(); rc = 0; - goto exit; - default: - goto exit; - } - } - - /* compat stuff which will be removed in a future release */ - if (argv[optind] != NULL) { - const char *arg = argv[optind]; - - err(udev, "udevadm control commands requires the -- format, " - "this will stop working in a future release\n"); - - if (!strncmp(arg, "log_priority=", strlen("log_priority="))) { - if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(&arg[strlen("log_priority=")])) < 0) - rc = 2; - else - rc = 0; - goto exit; - } else if (!strcmp(arg, "stop_exec_queue")) { - if (udev_ctrl_send_stop_exec_queue(uctrl) < 0) - rc = 2; - else - rc = 0; - goto exit; - } else if (!strcmp(arg, "start_exec_queue")) { - if (udev_ctrl_send_start_exec_queue(uctrl) < 0) - rc = 2; - else - rc = 0; - goto exit; - } else if (!strcmp(arg, "reload_rules")) { - if (udev_ctrl_send_reload_rules(uctrl) < 0) - rc = 2; - else - rc = 0; - goto exit; - } else if (!strncmp(arg, "max_childs=", strlen("max_childs="))) { - if (udev_ctrl_send_set_max_childs(uctrl, strtoul(&arg[strlen("max_childs=")], NULL, 0)) < 0) - rc = 2; - else - rc = 0; - goto exit; - } else if (!strncmp(arg, "env", strlen("env"))) { - if (udev_ctrl_send_set_env(uctrl, &arg[strlen("env=")]) < 0) - rc = 2; - else - rc = 0; - goto exit; + break; } } -- cgit v1.2.3-54-g00ecf From 24355313dc9686a14a618fcd9bbdedc29c57b651 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 14 Sep 2009 14:33:26 +0200 Subject: scsi_id: delete copy of bsg.h It's provided by the kernel since 2.6.23. --- Makefile.am | 3 +- TODO | 1 - extras/scsi_id/bsg.h | 84 -------------------------------------------- extras/scsi_id/scsi_serial.c | 3 +- 4 files changed, 2 insertions(+), 89 deletions(-) delete mode 100644 extras/scsi_id/bsg.h diff --git a/Makefile.am b/Makefile.am index 5a6bc80adb..bc049b50cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -259,8 +259,7 @@ extras_scsi_id_scsi_id_SOURCES =\ extras/scsi_id/scsi_id.c \ extras/scsi_id/scsi_serial.c \ extras/scsi_id/scsi.h \ - extras/scsi_id/scsi_id.h \ - extras/scsi_id/bsg.h + extras/scsi_id/scsi_id.h extras_scsi_id_scsi_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/scsi_id/scsi_id dist_man_MANS += extras/scsi_id/scsi_id.8 diff --git a/TODO b/TODO index 583d24e6be..ec69ceb4b4 100644 --- a/TODO +++ b/TODO @@ -3,6 +3,5 @@ o convert firmware.sh to C o get rid of braindead "scan all devices to find myself" libusb interface if it can not be fixed, drop libusb entirely - o remove copy of bsg.h o drop all support for the DEPRECATED sysfs layout o add warning for BUS, SYSFS, ID diff --git a/extras/scsi_id/bsg.h b/extras/scsi_id/bsg.h deleted file mode 100644 index cf0303a606..0000000000 --- a/extras/scsi_id/bsg.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef BSG_H -#define BSG_H - -#define BSG_PROTOCOL_SCSI 0 - -#define BSG_SUB_PROTOCOL_SCSI_CMD 0 -#define BSG_SUB_PROTOCOL_SCSI_TMF 1 -#define BSG_SUB_PROTOCOL_SCSI_TRANSPORT 2 - -struct sg_io_v4 { - __s32 guard; /* [i] 'Q' to differentiate from v3 */ - __u32 protocol; /* [i] 0 -> SCSI , .... */ - __u32 subprotocol; /* [i] 0 -> SCSI command, 1 -> SCSI task - management function, .... */ - - __u32 request_len; /* [i] in bytes */ - __u64 request; /* [i], [*i] {SCSI: cdb} */ - __u64 request_tag; /* [i] {SCSI: task tag (only if flagged)} */ - __u32 request_attr; /* [i] {SCSI: task attribute} */ - __u32 request_priority; /* [i] {SCSI: task priority} */ - __u32 request_extra; /* [i] {spare, for padding} */ - __u32 max_response_len; /* [i] in bytes */ - __u64 response; /* [i], [*o] {SCSI: (auto)sense data} */ - - /* "dout_": data out (to device); "din_": data in (from device) */ - __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else - dout_xfer points to array of iovec */ - __u32 dout_xfer_len; /* [i] bytes to be transferred to device */ - __u32 din_iovec_count; /* [i] 0 -> "flat" din transfer */ - __u32 din_xfer_len; /* [i] bytes to be transferred from device */ - __u64 dout_xferp; /* [i], [*i] */ - __u64 din_xferp; /* [i], [*o] */ - - __u32 timeout; /* [i] units: millisecond */ - __u32 flags; /* [i] bit mask */ - __u64 usr_ptr; /* [i->o] unused internally */ - __u32 spare_in; /* [i] */ - - __u32 driver_status; /* [o] 0 -> ok */ - __u32 transport_status; /* [o] 0 -> ok */ - __u32 device_status; /* [o] {SCSI: command completion status} */ - __u32 retry_delay; /* [o] {SCSI: status auxiliary information} */ - __u32 info; /* [o] additional information */ - __u32 duration; /* [o] time to complete, in milliseconds */ - __u32 response_len; /* [o] bytes of response actually written */ - __s32 din_resid; /* [o] din_xfer_len - actual_din_xfer_len */ - __s32 dout_resid; /* [o] dout_xfer_len - actual_dout_xfer_len */ - __u64 generated_tag; /* [o] {SCSI: transport generated task tag} */ - __u32 spare_out; /* [o] */ - - __u32 padding; -}; - -#ifdef __KERNEL__ - -#if defined(CONFIG_BLK_DEV_BSG) -struct bsg_class_device { - struct device *class_dev; - struct device *parent; - int minor; - struct request_queue *queue; - struct kref ref; - void (*release)(struct device *); -}; - -extern int bsg_register_queue(struct request_queue *q, - struct device *parent, const char *name, - void (*release)(struct device *)); -extern void bsg_unregister_queue(struct request_queue *); -#else -static inline int bsg_register_queue(struct request_queue *q, - struct device *parent, const char *name, - void (*release)(struct device *)) -{ - return 0; -} -static inline void bsg_unregister_queue(struct request_queue *q) -{ -} -#endif - -#endif /* __KERNEL__ */ - -#endif diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 7b308a935c..92359122d8 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -28,8 +28,7 @@ #include #include #include -/* #include */ -#include "bsg.h" +#include #include "libudev.h" #include "libudev-private.h" -- cgit v1.2.3-54-g00ecf From bcb8b2315b192b03caa1a61d9d4e7704b7a742f3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Sep 2009 18:14:03 +0200 Subject: fix SYMLINK{} option parsing --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 904ddac72c..ddb51de8e1 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1435,7 +1435,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcmp(key, "SYMLINK") == 0) { + if (strncmp(key, "SYMLINK", sizeof("SYMLINK")-1) == 0) { if (op < OP_MATCH_MAX) { rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL); } else { -- cgit v1.2.3-54-g00ecf From 8a483b0cb223166a8ba9d063a731934816d7500b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Sep 2009 19:41:09 +0200 Subject: rules: remove remaining NAME="%k" --- rules/packages/40-ppc.rules | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rules/packages/40-ppc.rules b/rules/packages/40-ppc.rules index 47ecdd0027..90c15f0598 100644 --- a/rules/packages/40-ppc.rules +++ b/rules/packages/40-ppc.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -KERNEL=="iseries/ibmsis*", NAME="%k", GROUP="disk" -KERNEL=="iseries/nvt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vt*", NAME="%k", GROUP="disk" -KERNEL=="iseries/vtty*", GROUP="dialout" +KERNEL=="iseries/ibmsis*", GROUP="disk" +KERNEL=="iseries/nvt*", GROUP="disk" +KERNEL=="iseries/vt*", GROUP="disk" +KERNEL=="iseries/vtty*, GROUP="dialout" -- cgit v1.2.3-54-g00ecf From 4b4409b1eed0e40a34e16d3ef2e29462e5190ca0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Sep 2009 20:08:50 +0200 Subject: rules: drop almost all NAME= keys The drivers in kernel 2.6.31 supply the names for custom node names if needed. --- rules/packages/40-alsa.rules | 10 ------- rules/rules.d/50-udev-default.rules | 55 ++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 42 deletions(-) delete mode 100644 rules/packages/40-alsa.rules diff --git a/rules/packages/40-alsa.rules b/rules/packages/40-alsa.rules deleted file mode 100644 index abdde8cf91..0000000000 --- a/rules/packages/40-alsa.rules +++ /dev/null @@ -1,10 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM=="sound", GROUP="audio" -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" -KERNEL=="mixer0", SYMLINK+="mixer" diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 200e2b4e51..79c8e231f4 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -14,7 +14,7 @@ KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty" # serial KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout" KERNEL=="ppp", MODE="0600" -KERNEL=="mwave", NAME="modems/mwave", GROUP="dialout" +KERNEL=="mwave", GROUP="dialout" KERNEL=="hvc*|hvsi*", GROUP="dialout" # mem @@ -22,9 +22,9 @@ KERNEL=="null|zero|full|random|urandom", MODE="0666" KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" # input -KERNEL=="mouse*|mice|event*", NAME="input/%k", MODE="0640" -KERNEL=="ts[0-9]*|uinput", NAME="input/%k", MODE="0640" -KERNEL=="js[0-9]*", NAME="input/%k", MODE="0644" +KERNEL=="mouse*|mice|event*", MODE="0640" +KERNEL=="ts[0-9]*|uinput", MODE="0640" +KERNEL=="js[0-9]*", MODE="0644" # video4linux SUBSYSTEM=="video4linux", GROUP="video" @@ -34,30 +34,34 @@ KERNEL=="winradio*", GROUP="video" # graphics KERNEL=="agpgart", MODE="0600", GROUP="video" -KERNEL=="card[0-9]*", NAME="dri/%k" KERNEL=="pmu", GROUP="video" KERNEL=="nvidia*|nvidiactl*", GROUP="video" SUBSYSTEM=="graphics", GROUP="video" SUBSYSTEM=="drm", GROUP="video" +# sound +SUBSYSTEM=="sound", GROUP="audio" +KERNEL=="mixer0", SYMLINK+="mixer" + # DVB (video) -SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}", GROUP="video" +SUBSYSTEM=="dvb", GROUP="video" -# FireWire (dv1394 and video1394 drivers) -KERNEL=="dv1394-[0-9]*", NAME="dv1394/%n", GROUP="video" -KERNEL=="video1394-[0-9]*", NAME="video1394/%n", GROUP="video" # FireWire (firewire-core driver: IIDC devices, AV/C devices) SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" +# FireWire (deprecated dv1394 and video1394 drivers) +KERNEL=="dv1394-[0-9]*", NAME="dv1394/%n", GROUP="video" +KERNEL=="video1394-[0-9]*", NAME="video1394/%n", GROUP="video" + # libusb device nodes -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" # printer KERNEL=="parport[0-9]*", GROUP="lp" SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" SUBSYSTEM=="ppdev", GROUP="lp" -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k", SYMLINK+="usb%k", GROUP="lp" +SUBSYSTEM=="usb", KERNEL=="lp*", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" # hplip and cups 1.4+ use raw USB devices, so permissions should be similar to @@ -77,8 +81,8 @@ KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitio SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" SUBSYSTEM=="block", KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="cdrom", GROUP="cdrom" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k", GROUP="cdrom" -KERNEL=="pktcdvd", NAME="pktcdvd/control", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", GROUP="cdrom" # tape KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="tape" @@ -90,38 +94,25 @@ KERNEL=="sch[0-9]*", GROUP="disk" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk" KERNEL=="pg[0-9]*", GROUP="disk" KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" -KERNEL=="rawctl", NAME="raw/rawctl", GROUP="disk" -SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k", GROUP="disk" -SUBSYSTEM=="bsg", NAME="bsg/%k" -SUBSYSTEM=="aoe", NAME="etherd/%k", GROUP="disk", MODE="0220" +KERNEL=="rawctl", GROUP="disk" +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", GROUP="disk" +SUBSYSTEM=="aoe", GROUP="disk", MODE="0220" SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" # network -KERNEL=="tun", NAME="net/%k", MODE="0666" +KERNEL=="tun", MODE="0666" KERNEL=="rfkill", MODE="0644" # CPU -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid", MODE="0444" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" +KERNEL=="cpu[0-9]*", MODE="0444" # miscellaneous KERNEL=="fuse", MODE="0666" SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" -KERNEL=="auer[0-9]*", NAME="usb/%k" -KERNEL=="hw_random", NAME="hwrng" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" KERNEL=="rrom[0-9]*", MODE="0400" -KERNEL=="sxctl", NAME="specialix_sxctl" -KERNEL=="rioctl", NAME="specialix_rioctl" -KERNEL=="iowarrior[0-9]*", NAME="usb/%k" -KERNEL=="hiddev[0-9]*", NAME="usb/%k" -KERNEL=="legousbtower[0-9]*", NAME="usb/%k" -KERNEL=="dabusb[0-9]*", NAME="usb/%k" -KERNEL=="usbdpfp[0-9]*", NAME="usb/%k" -KERNEL=="cpad[0-9]*", NAME="usb/%k" # do not delete static device nodes -ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove" ACTION=="remove", NAME=="", TEST=="/lib/udev/devices/%k", OPTIONS+="ignore_remove" +ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove" -- cgit v1.2.3-54-g00ecf From 91554cf9a141c8b39ffcdd5cd7440bc2728736bc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Sep 2009 20:27:30 +0200 Subject: update TODO, NEWS --- NEWS | 4 ++++ TODO | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ff6d932052..8019bb1f93 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,10 @@ NAME="%k" causes a warning now. It's is and always was completely superfluous. It will break kernel supplied DEVNAMEs and therefore it needs to be removed from all rules. +Most NAME= instructions got removed. Kernel 2.6.31 supplies the needed names +if they are not the default. To support older kernels, the NAME= rules need to +be added to the compat rules file. + Symlinks to udevadm with the old command names are no longer resolved to the udevadm commands. diff --git a/TODO b/TODO index ec69ceb4b4..1f85973d40 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ - o remove most NAME= rules (they are provided by the 2.6.31 kernel) o convert firmware.sh to C o get rid of braindead "scan all devices to find myself" libusb interface if it can not be fixed, drop libusb entirely -- cgit v1.2.3-54-g00ecf From 676cea155a80b3a3e7b3d2fda1fce8a41d79e2b8 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 16 Sep 2009 17:42:15 +0200 Subject: scsi_id: prevent buffer overflow in check_fill_0x83_prespc3() see https://bugzilla.redhat.com/show_bug.cgi?id=516920 --- extras/scsi_id/scsi_serial.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 92359122d8..ab0ffd62aa 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -578,11 +578,12 @@ static int check_fill_0x83_prespc3(struct udev *udev, /* serial has been memset to zero before */ j = strlen(serial); /* j = 1; */ - for (i = 0; i < page_83[3]; ++i) { + for (i = 0; (i < page_83[3]) && (j < max_len-3); ++i) { serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; serial[j++] = hex_str[ page_83[4+i] & 0x0f]; } - strcpy(serial_short, serial); + serial[max_len-1] = 0; + strncpy(serial_short, serial, max_len-1); return 0; } -- cgit v1.2.3-54-g00ecf From 6068553195f43a2fd7987c48178de23b63a09f15 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 18 Sep 2009 13:14:30 +0200 Subject: rename interfaces to _rename if rename fails --- udev/udev-event.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 701c061820..d5b4d0941e 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -492,8 +492,7 @@ static int rename_netif(struct udev_event *event) } /* free our own name, another process may wait for us */ - util_strscpy(ifr.ifr_newname, IFNAMSIZ, udev_device_get_sysname(dev)); - util_strscpy(ifr.ifr_newname, IFNAMSIZ, "_rename"); + util_strscpyl(ifr.ifr_newname, IFNAMSIZ, udev_device_get_sysname(dev), "_rename", NULL); err = ioctl(sk, SIOCSIFNAME, &ifr); if (err != 0) { err(event->udev, "error changing netif name %s to %s: %m\n", -- cgit v1.2.3-54-g00ecf From 4dd9057209a09c523c04abe04a2540768e6b9d4e Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Sat, 19 Sep 2009 19:19:15 +0200 Subject: rules: Gentoo update --- rules/gentoo/30-kernel-compat.rules | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/rules/gentoo/30-kernel-compat.rules b/rules/gentoo/30-kernel-compat.rules index 1501ec2054..d6d4413726 100644 --- a/rules/gentoo/30-kernel-compat.rules +++ b/rules/gentoo/30-kernel-compat.rules @@ -10,6 +10,64 @@ ACTION!="add|change", GOTO="kernel_compat_end" # needed for kernels <2.6.29-rc1 SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" +# naming rules for kernels <2.6.31 + +# alsa names +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +KERNEL=="mwave", NAME="modems/mwave" + +KERNEL=="mouse*|mice|event*", NAME="input/%k" +KERNEL=="ts[0-9]*|uinput", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" + +KERNEL=="card[0-9]*", NAME="dri/%k" + +SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}" + +# libusb device nodes +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" + +# printer +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k" + +# block +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="rawctl", NAME="raw/rawctl" +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k" +SUBSYSTEM=="bsg", NAME="bsg/%k" +SUBSYSTEM=="aoe", NAME="etherd/%k" + +# network +KERNEL=="tun", NAME="net/%k" + +# CPU +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# miscellaneous +KERNEL=="auer[0-9]*", NAME="usb/%k" +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="sxctl", NAME="specialix_sxctl" +KERNEL=="rioctl", NAME="specialix_rioctl" +KERNEL=="iowarrior[0-9]*", NAME="usb/%k" +KERNEL=="hiddev[0-9]*", NAME="usb/%k" +KERNEL=="legousbtower[0-9]*", NAME="usb/%k" +KERNEL=="dabusb[0-9]*", NAME="usb/%k" +KERNEL=="usbdpfp[0-9]*", NAME="usb/%k" +KERNEL=="cpad[0-9]*", NAME="usb/%k" + +# end of naming rules for kernel <2.6.31 + + # # module loading rules # -- cgit v1.2.3-54-g00ecf From ce096702ec01b12ca8af9b4c19f4bb5a83c787a1 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 20 Sep 2009 19:07:51 +0200 Subject: fix single-session CD detection ID_CDROM_MEDIA_SESSION_LAST_OFFSET is not set for CDs with only a single session (i. e. for the vast majority of CDs out there). The previous rules ran blkid with invalid arguments for these, causing CD detection to fail in DK-disks and gvfs. Now check whether we actually have ID_CDROM_MEDIA_SESSION_LAST_OFFSET, and if not, call blkid without -O for specifying the offset. Many thanks to Maxim Levitsky for tracking this down! https://launchpad.net/bugs/431055 --- rules/rules.d/60-persistent-storage.rules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 64e9578904..1b85156cc0 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -61,7 +61,9 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" # probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET +KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" # probe filesystem metadata of disks KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" -- cgit v1.2.3-54-g00ecf From 6e1a152d1cf3c3b8724f5ed37444ce714887b441 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 20 Sep 2009 19:21:04 +0200 Subject: fix previous commit for CD detection Do not run blkid twice. *brown paperbag* --- rules/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 1b85156cc0..0950847b19 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -63,7 +63,7 @@ ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_ # probe filesystem metadata of optical drives which have a media inserted KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" # single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" +KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" # probe filesystem metadata of disks KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" -- cgit v1.2.3-54-g00ecf From 49c3a01d444052169363030dfd996fc7fd6a4fad Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Tue, 22 Sep 2009 14:39:23 -0700 Subject: util_run_program: *really* restore signal mask before executing event RUN commands The previous patch was almost, but not quite, correct. Rather than restoring the signal mask it actually tried to make an even more restrictive signal mask (had SIGALRM been blocked when udevd started, anyway). Fix it harder. Signed-off-by: Scott James Remnant --- libudev/libudev-util-private.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index e0670dbae5..585dfc6a41 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -337,7 +337,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp, } if (sigmask) - sigprocmask(SIG_BLOCK, sigmask, NULL); + sigprocmask(SIG_SETMASK, sigmask, NULL); execve(argv[0], argv, envp); if (errno == ENOENT || errno == ENOTDIR) { -- cgit v1.2.3-54-g00ecf From 4daa146bf71cea174271371a0eb3cf22719a550b Mon Sep 17 00:00:00 2001 From: Andrew Church Date: Thu, 24 Sep 2009 10:51:12 -0700 Subject: fix wrong parameter size on ioctl FIONREAD On Wed, Sep 23, 2009 at 23:11, Matthias Schwarzott wrote: > It is about ioctl failures on amd64: > http://bugs.gentoo.org/show_bug.cgi?id=286041 > > A bad parameter type to an ioctl() call causes udev-146 to generate "error > getting buffer for inotify" messages in syslog. The offending code is > roughly: > > ssize_t nbytes, pos; > // ... > ioctl(fd, FIONREAD, &nbytes); > > where ssize_t is 64 bits on amd64, but the kernel code for FIONREAD (at least > through gentoo-sources-2.6.31) uses type int: > > p = (void __user *) arg; > switch (cmd) { > case FIONREAD: > // ... > ret = put_user(send_len, (int __user *) p); > > so the upper 32 bits of "nbytes" are left uninitialized, and the subsequent > malloc(nbytes) fails unless those 32 bits happen to be zero (or the system has > a LOT of memory). --- udev/udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index 2eb914a3f3..62c643668c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -662,7 +662,7 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) /* read inotify messages */ static int handle_inotify(struct udev *udev) { - ssize_t nbytes, pos; + int nbytes, pos; char *buf; struct inotify_event *ev; -- cgit v1.2.3-54-g00ecf From 61c666c6b0fda22a6be125237290193a3e98907e Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Thu, 24 Sep 2009 10:55:55 -0700 Subject: gudev: gir-scanner workaround for out of tree builds Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=562885 --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index bc049b50cb..846152d871 100644 --- a/Makefile.am +++ b/Makefile.am @@ -367,6 +367,7 @@ extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gud extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ + LD_LIBRARY_PATH=$(top_builddir)/extras/gudev \ $(G_IR_SCANNER) -v \ --namespace GUdev \ --nsversion=1.0 \ -- cgit v1.2.3-54-g00ecf From bded570432d7017c47882758b037e77f1ec8e79e Mon Sep 17 00:00:00 2001 From: William Jon McCann Date: Sun, 27 Sep 2009 06:37:26 -0700 Subject: udev-acl: catch up with ConsoleKit 0.4.1 --- Makefile.am | 4 +- NEWS | 3 + extras/udev-acl/udev-acl.c | 204 ++++++++++++++++++++++++++++++++++----------- 3 files changed, 160 insertions(+), 51 deletions(-) diff --git a/Makefile.am b/Makefile.am index 846152d871..af321d8bdb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -422,8 +422,8 @@ dist_udevrules_DATA += extras/udev-acl/70-acl.rules libexec_PROGRAMS += extras/udev-acl/udev-acl udevacl-install-hook: - mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d - ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-session.d/udev-acl.ck + mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d + ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck INSTALL_EXEC_HOOKS += udevacl-install-hook diff --git a/NEWS b/NEWS index 8019bb1f93..27b778f255 100644 --- a/NEWS +++ b/NEWS @@ -24,6 +24,9 @@ be added to the compat rules file. Symlinks to udevadm with the old command names are no longer resolved to the udevadm commands. +The udev-acl tool got adopted to changes in ConsoleKit. Version 0.4.11 is +required now. + udev 146 ======== Bugfixes. diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index 3eb29fe2f2..e670ce707f 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -29,6 +29,13 @@ static int debug; +enum{ + ACTION_NONE = 0, + ACTION_REMOVE, + ACTION_ADD, + ACTION_CHANGE +}; + static int set_facl(const char* filename, uid_t uid, int add) { int get; @@ -152,44 +159,123 @@ static GSList *uids_with_local_active_session(const char *own_id) } /* ConsoleKit calls us with special variables */ -static int consolekit_called(const char *action, uid_t *uid, const char **own_session, int *add) +static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, const char **remove_session_id, int *action) { - int a; - uid_t u; + int a = ACTION_NONE; + uid_t u = 0; + uid_t u2 = 0; const char *s; - const char *session; - - if (action == NULL || strcmp(action, "session_active_changed") != 0) - return -1; + const char *s2; + const char *old_session = NULL; - s = getenv("CK_SESSION_IS_LOCAL"); - if (s == NULL) + if (ck_action == NULL || strcmp(ck_action, "seat_active_session_changed") != 0) return -1; - if (strcmp(s, "true") != 0) - return 0; - s = getenv("CK_SESSION_IS_ACTIVE"); - if (s == NULL) + /* We can have one of: remove, add, change, no-change */ + s = getenv("CK_SEAT_OLD_SESSION_ID"); + s2 = getenv("CK_SEAT_SESSION_ID"); + if (s == NULL && s2 == NULL) { return -1; - if (strcmp(s, "true") == 0) - a = 1; - else - a = 0; + } else if (s2 == NULL) { + a = ACTION_REMOVE; + } else if (s == NULL) { + a = ACTION_ADD; + } else { + a = ACTION_CHANGE; + } - session = getenv("CK_SESSION_ID"); - if (session == NULL) - return -1; + switch (a) { + case ACTION_ADD: + s = getenv("CK_SEAT_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + if (u == 0) + return 0; + + s = getenv("CK_SEAT_SESSION_IS_LOCAL"); + if (s == NULL) + return -1; + if (strcmp(s, "true") != 0) + return 0; + + break; + case ACTION_REMOVE: + s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + if (u == 0) + return 0; + + s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); + if (s == NULL) + return -1; + if (strcmp(s, "true") != 0) + return 0; + + old_session = getenv("CK_SEAT_OLD_SESSION_ID"); + if (old_session == NULL) + return -1; + + break; + case ACTION_CHANGE: + s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + if (u == 0) + return 0; + s = getenv("CK_SEAT_SESSION_USER_UID"); + if (s == NULL) + return -1; + u2 = strtoul(s, NULL, 10); + if (u2 == 0) + return 0; + + s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); + s2 = getenv("CK_SEAT_SESSION_IS_LOCAL"); + if (s == NULL || s2 == NULL) + return -1; + /* don't process non-local session changes */ + if (strcmp(s, "true") != 0 && strcmp(s2, "true") != 0) + return 0; + + if (strcmp(s, "true") == 0 && strcmp(s, "true") == 0) { + /* process the change */ + if (u == u2) { + /* special case: we noop if we are + * changing between local sessions for + * the same uid */ + a = ACTION_NONE; + } + old_session = getenv("CK_SEAT_OLD_SESSION_ID"); + if (old_session == NULL) + return -1; + } else if (strcmp(s, "true") == 0) { + /* only process the removal */ + a = ACTION_REMOVE; + old_session = getenv("CK_SEAT_OLD_SESSION_ID"); + if (old_session == NULL) + return -1; + } else if (strcmp(s2, "true") == 0) { + /* only process the addition */ + a = ACTION_ADD; + u = u2; + } - s = getenv("CK_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - if (u == 0) - return 0; + break; + case ACTION_NONE: + break; + default: + g_assert_not_reached (); + break; + } - *own_session = session; + *remove_session_id = old_session; *uid = u; - *add = a; + *uid2 = u2; + *action = a; return 0; } @@ -223,6 +309,21 @@ static void apply_acl_to_devices(uid_t uid, int add) udev_unref(udev); } +static void +remove_uid (uid_t uid, const char *remove_session_id) +{ + /* + * Remove ACL for given uid from all matching devices + * when there is currently no local active session. + */ + GSList *list; + + list = uids_with_local_active_session(remove_session_id); + if (!uid_in_list(list, uid)) + apply_acl_to_devices(uid, 0); + g_slist_free(list); +} + int main (int argc, char* argv[]) { static const struct option options[] = { @@ -233,10 +334,11 @@ int main (int argc, char* argv[]) { "help", no_argument, NULL, 'h' }, {} }; - int add = -1; + int action = -1; const char *device = NULL; uid_t uid = 0; - const char* own_session = NULL; + uid_t uid2 = 0; + const char* remove_session_id = NULL; int rc = 0; /* valgrind is more important to us than a slice allocator */ @@ -252,9 +354,9 @@ int main (int argc, char* argv[]) switch (option) { case 'a': if (strcmp(optarg, "add") == 0 || strcmp(optarg, "change") == 0) - add = 1; + action = ACTION_ADD; else if (strcmp(optarg, "remove") == 0) - add = 0; + action = ACTION_REMOVE; else goto out; break; @@ -274,10 +376,10 @@ int main (int argc, char* argv[]) } } - if (add < 0 && device == NULL && uid == 0) - consolekit_called(argv[optind], &uid, &own_session, &add); + if (action < 0 && device == NULL && uid == 0) + consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action); - if (add < 0) { + if (action < 0) { fprintf(stderr, "missing action\n\n"); rc = 2; goto out; @@ -290,20 +392,24 @@ int main (int argc, char* argv[]) } if (uid != 0) { - if (add) { + switch (action) { + case ACTION_ADD: /* Add ACL for given uid to all matching devices. */ apply_acl_to_devices(uid, 1); - } else { - /* - * Remove ACL for given uid from all matching devices - * when there is currently no local active session. - */ - GSList *list; - - list = uids_with_local_active_session(own_session); - if (!uid_in_list(list, uid)) - apply_acl_to_devices(uid, 0); - g_slist_free(list); + break; + case ACTION_REMOVE: + remove_uid(uid, remove_session_id); + break; + case ACTION_CHANGE: + remove_uid(uid, remove_session_id); + apply_acl_to_devices(uid2, 1); + break; + case ACTION_NONE: + goto out; + break; + default: + g_assert_not_reached(); + break; } } else if (device != NULL) { /* @@ -321,8 +427,8 @@ int main (int argc, char* argv[]) uid_t u; u = GPOINTER_TO_UINT(l->data); - if (add || !uid_in_list(list, u)) - set_facl(device, u, add); + if (action == ACTION_ADD || !uid_in_list(list, u)) + set_facl(device, u, action == ACTION_ADD); } g_slist_free(list); } else { -- cgit v1.2.3-54-g00ecf From 8d12968558873b90e0cfc18b62adcf199592de32 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 30 Sep 2009 11:10:24 +0200 Subject: make raw USB printer devices world-readable again Commit f61e72d8 made raw USB printers accessible for the lp group. However, chmoding them to 0660 is a bit over-zealous, since by default raw USB devices are world-readable. Not being so breaks lsusb unnecessarily. Now set permissions to 0664. --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 79c8e231f4..03f7836e2f 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -67,7 +67,7 @@ KERNEL=="irlpt[0-9]*", GROUP="lp" # hplip and cups 1.4+ use raw USB devices, so permissions should be similar to # the ones from the old usblp kernel module SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}==":0701*:", GROUP="lp", MODE="660" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}==":0701*:", GROUP="lp", MODE="664" # block SUBSYSTEM=="block", GROUP="disk" -- cgit v1.2.3-54-g00ecf From ca2bf8007da16fea5f49ff97c95669bfb76cd016 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 5 Oct 2009 11:38:44 +0200 Subject: 50-udev-default.rules: fix printer MODE Prefix with a 0 to be consistent with other rules. https://launchpad.net/bugs/438114 --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 03f7836e2f..a79073b90e 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -67,7 +67,7 @@ KERNEL=="irlpt[0-9]*", GROUP="lp" # hplip and cups 1.4+ use raw USB devices, so permissions should be similar to # the ones from the old usblp kernel module SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}==":0701*:", GROUP="lp", MODE="664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}==":0701*:", GROUP="lp", MODE="0664" # block SUBSYSTEM=="block", GROUP="disk" -- cgit v1.2.3-54-g00ecf From a05cd7ea3e582c9bf9680492e73687ea56cdd864 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Sat, 26 Sep 2009 02:19:43 +0300 Subject: keymap for Acer Aspire 5720 --- extras/keymap/95-keymap.rules | 1 + extras/keymap/keymaps/acer-aspire_5720 | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 extras/keymap/keymaps/acer-aspire_5720 diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 10a88b0917..c63ae4a857 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -55,6 +55,7 @@ ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+=" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" diff --git a/extras/keymap/keymaps/acer-aspire_5720 b/extras/keymap/keymaps/acer-aspire_5720 new file mode 100644 index 0000000000..b3515b772f --- /dev/null +++ b/extras/keymap/keymaps/acer-aspire_5720 @@ -0,0 +1,5 @@ +0x84 bluetooth # sent when bluetooth module missing, and key pressed +0x92 media # acer arcade +0xD4 bluetooth # bluetooth on +0xD9 bluetooth # bluetooth off + -- cgit v1.2.3-54-g00ecf From 19711e1933003a46456f477cb8f1cac77c54bcb0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 8 Oct 2009 00:06:23 +0200 Subject: udevd: serialize events for with the same major/minor On Wed, Oct 7, 2009 at 21:46, Alan Jenkins wrote: > Udev would have avoided the race prior to > > 82c785e "udevd: remove check for dev_t, DEVPATH_OLD takes care of that" > > (the "check" removed here used to serialize events based on the device > major:minor number). On Wed, Oct 7, 2009 at 22:31, Michael Guntsche wrote: > add /module/8250_pnp (module) > remove /devices/platform/serial8250/tty/ttyS0 (tty) > add /devices/pnp0/00:05/tty/ttyS0 (tty) --- udev/udevd.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 62c643668c..dfdbb4c245 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -118,6 +118,8 @@ struct event { const char *devpath; size_t devpath_len; const char *devpath_old; + dev_t devnum; + bool is_block; }; static struct event *node_to_event(struct udev_list_node *node) @@ -410,6 +412,8 @@ static void event_queue_insert(struct udev_device *dev) event->devpath = udev_device_get_devpath(dev); event->devpath_len = strlen(event->devpath); event->devpath_old = udev_device_get_devpath_old(dev); + event->devnum = udev_device_get_devnum(dev); + event->is_block = (strcmp("block", udev_device_get_subsystem(dev)) == 0); udev_queue_export_device_queued(udev_queue_export, dev); info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev), @@ -473,7 +477,7 @@ static int mem_size_mb(void) } /* lookup event for identical, parent, child device */ -static int devpath_busy(struct event *event) +static bool is_devpath_busy(struct event *event) { struct udev_list_node *loop; size_t common; @@ -488,18 +492,21 @@ static int devpath_busy(struct event *event) /* event we checked earlier still exists, no need to check again */ if (loop_event->seqnum == event->delaying_seqnum) - return 2; + return true; /* found ourself, no later event can block us */ if (loop_event->seqnum >= event->seqnum) break; + /* check major/minor */ + if (major(event->devnum) != 0 && event->devnum == loop_event->devnum && event->is_block == loop_event->is_block) + return true; + /* check our old name */ - if (event->devpath_old != NULL) - if (strcmp(loop_event->devpath, event->devpath_old) == 0) { - event->delaying_seqnum = loop_event->seqnum; - return 3; - } + if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) { + event->delaying_seqnum = loop_event->seqnum; + return true; + } /* compare devpath */ common = MIN(loop_event->devpath_len, event->devpath_len); @@ -511,26 +518,26 @@ static int devpath_busy(struct event *event) /* identical device event found */ if (loop_event->devpath_len == event->devpath_len) { event->delaying_seqnum = loop_event->seqnum; - return 4; + return true; } /* parent device event found */ if (event->devpath[common] == '/') { event->delaying_seqnum = loop_event->seqnum; - return 5; + return true; } /* child device event found */ if (loop_event->devpath[common] == '/') { event->delaying_seqnum = loop_event->seqnum; - return 6; + return true; } /* no matching device */ continue; } - return 0; + return false; } static void events_start(struct udev *udev) @@ -544,7 +551,7 @@ static void events_start(struct udev *udev) continue; /* do not start event if parent or child event is still running */ - if (devpath_busy(event) != 0) { + if (is_devpath_busy(event)) { dbg(udev, "delay seq %llu (%s)\n", event->seqnum, event->devpath); continue; } -- cgit v1.2.3-54-g00ecf From 5fa1d7942149d73f5dee8940834d6df8c7977266 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 8 Oct 2009 21:43:38 +0200 Subject: keymap: Add Logitech Wave USB This introduces a new rules section for USB keyboards, too. https://launchpad.net/bugs/215035 --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 20 ++++++++++++++++++-- extras/keymap/keymaps/logitech-wave | 16 ++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 extras/keymap/keymaps/logitech-wave diff --git a/Makefile.am b/Makefile.am index af321d8bdb..3610998e8e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -510,6 +510,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/lenovo-3000 \ extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ + extras/keymap/keymaps/logitech-wave \ extras/keymap/keymaps/maxdata-pro_7000 \ extras/keymap/keymaps/medion-fid2060 \ extras/keymap/keymaps/medionnb-a555 \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index c63ae4a857..967bb4bed1 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -9,14 +9,30 @@ ACTION!="add", GOTO="keyboard_end" SUBSYSTEM!="input", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" -ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="", GOTO="keyboard_end" +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p", GOTO="keyboard_usbcheck" +GOTO="keyboard_modulecheck" + +# +# The following are external USB keyboards +# + +LABEL="keyboard_usbcheck" + +ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" + + +GOTO="keyboard_end" # # The following are exposed as separate input devices with low key codes, thus # we need to check their input device product name # +LABEL="keyboard_modulecheck" + +ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" +ENV{DMI_VENDOR}=="", GOTO="keyboard_end" + ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-lenovo" ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" diff --git a/extras/keymap/keymaps/logitech-wave b/extras/keymap/keymaps/logitech-wave new file mode 100644 index 0000000000..caa5d5d310 --- /dev/null +++ b/extras/keymap/keymaps/logitech-wave @@ -0,0 +1,16 @@ +0x9001C scale #expo +0x9001F zoomout #zoom out +0x90020 zoomin #zoom in +0x9003D prog1 #gadget +0x90005 camera #camera +0x90018 media #media center +0x90041 wordprocessor #fn+f1 (word) +0x90042 spreadsheet #fn+f2 (excel) +0x90043 calendar #fn+f3 (calendar) +0x90044 prog2 #fn+f4 (program a) +0x90045 prog3 #fn+f5 (program b) +0x90046 prog4 #fn+f6 (program c) +0x90048 messenger #fn+f8 (msn messenger) +0x9002D find #fn+f10 (search www) +0x9004B search #fn+f11 (search pc) +0x9004C ejectclosecd #fn+f12 (eject) -- cgit v1.2.3-54-g00ecf From df3e07d6a8abaf7ebd685df0afb65f41622e8d9c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 8 Oct 2009 21:45:09 +0200 Subject: keymap: add missing map file This fixes commit a05cd7ea3e582c9bf9680492e73687ea56cdd864 --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 3610998e8e..fa09b17b25 100644 --- a/Makefile.am +++ b/Makefile.am @@ -486,6 +486,7 @@ CLEANFILES += \ udevkeymapdir = $(libexecdir)/keymaps dist_udevkeymap_DATA = \ extras/keymap/keymaps/acer \ + extras/keymap/keymaps/acer-aspire_5720 \ extras/keymap/keymaps/acer-aspire_5920g \ extras/keymap/keymaps/acer-aspire_6920 \ extras/keymap/keymaps/acer-travelmate_c300 \ -- cgit v1.2.3-54-g00ecf From e8f04b65f38cafe34af1dbbe4150b87b2771f1f9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 11 Oct 2009 18:18:43 +0200 Subject: keymap: fix usb_id invocation For deciding whether to call usb_id, test the property which we are actually querying further down. https://launchpad.net/215035 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 967bb4bed1..4ce84bced0 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -9,7 +9,7 @@ ACTION!="add", GOTO="keyboard_end" SUBSYSTEM!="input", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p", GOTO="keyboard_usbcheck" +SUBSYSTEMS=="usb", ENV{ID_VENDOR}=="", IMPORT{program}="usb_id --export %p", GOTO="keyboard_usbcheck" GOTO="keyboard_modulecheck" # -- cgit v1.2.3-54-g00ecf From e13eecbdf3462cf1ecc2c0ee6cb961700c380d46 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 11 Oct 2009 20:02:11 +0200 Subject: keymap: make USB keyboards really work Calling usb_id and GOTO in one rule did not make sense at all. --- extras/keymap/95-keymap.rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 4ce84bced0..dd586885a2 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -9,7 +9,8 @@ ACTION!="add", GOTO="keyboard_end" SUBSYSTEM!="input", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" -SUBSYSTEMS=="usb", ENV{ID_VENDOR}=="", IMPORT{program}="usb_id --export %p", GOTO="keyboard_usbcheck" +SUBSYSTEMS=="usb", ENV{ID_VENDOR}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", GOTO="keyboard_usbcheck" GOTO="keyboard_modulecheck" # -- cgit v1.2.3-54-g00ecf From 0ddfae5fff8bffb46263c4f0b5c1d41d559564ab Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 15 Oct 2009 00:13:17 +0200 Subject: keymap: Add Logitech Wave cordless https://launchpad.net/bugs/215035 --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 2 +- extras/keymap/keymaps/logitech-wave-cordless | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 extras/keymap/keymaps/logitech-wave-cordless diff --git a/Makefile.am b/Makefile.am index fa09b17b25..cf7d36419c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -512,6 +512,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ extras/keymap/keymaps/logitech-wave \ + extras/keymap/keymaps/logitech-wave-cordless \ extras/keymap/keymaps/maxdata-pro_7000 \ extras/keymap/keymaps/medion-fid2060 \ extras/keymap/keymaps/medionnb-a555 \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index dd586885a2..0e4c2dc6db 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -20,7 +20,7 @@ GOTO="keyboard_modulecheck" LABEL="keyboard_usbcheck" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" - +ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" GOTO="keyboard_end" diff --git a/extras/keymap/keymaps/logitech-wave-cordless b/extras/keymap/keymaps/logitech-wave-cordless new file mode 100644 index 0000000000..4d34c9739a --- /dev/null +++ b/extras/keymap/keymaps/logitech-wave-cordless @@ -0,0 +1,13 @@ +0xC0183 media +0xC1005 camera +0xC101F zoomout +0xC1020 zoomin +0xC1041 wordprocessor +0xC1042 spreadsheet +0xC1043 calendar +0xC1044 prog2 #fn+f4 (program a) +0xC1045 prog3 #fn+f5 (program b) +0xC1046 prog4 #fn+f6 (program c) +0xC1048 messenger +0xC104A find #fn+f10 (search www) +0xC104C ejectclosecd -- cgit v1.2.3-54-g00ecf From 1230d021bd75de9b1503bbaa807d6a59789963db Mon Sep 17 00:00:00 2001 From: Peter Rajnoha Date: Tue, 20 Oct 2009 06:55:42 +0900 Subject: libudev: allow to store negative values in the udev database --- libudev/libudev-device-private.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 80a4da4c96..66f0328eb3 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -88,15 +88,15 @@ file: fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); } if (udev_device_get_devlink_priority(udev_device) != 0) - fprintf(f, "L:%u\n", udev_device_get_devlink_priority(udev_device)); + fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); if (udev_device_get_event_timeout(udev_device) >= 0) - fprintf(f, "T:%u\n", udev_device_get_event_timeout(udev_device)); + fprintf(f, "T:%i\n", udev_device_get_event_timeout(udev_device)); if (udev_device_get_num_fake_partitions(udev_device) != 0) - fprintf(f, "A:%u\n", udev_device_get_num_fake_partitions(udev_device)); + fprintf(f, "A:%i\n", udev_device_get_num_fake_partitions(udev_device)); if (udev_device_get_ignore_remove(udev_device)) - fprintf(f, "R:%u\n", udev_device_get_ignore_remove(udev_device)); + fprintf(f, "R:%i\n", udev_device_get_ignore_remove(udev_device)); if (udev_device_get_watch_handle(udev_device) >= 0) - fprintf(f, "W:%u\n", udev_device_get_watch_handle(udev_device)); + fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { if (!udev_list_entry_get_flag(list_entry)) continue; -- cgit v1.2.3-54-g00ecf From d316d27c17d8915f4c1356a1b95de1ea7fe8306b Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Wed, 21 Oct 2009 04:02:04 +0900 Subject: rules: Gentoo update --- rules/gentoo/30-kernel-compat.rules | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rules/gentoo/30-kernel-compat.rules b/rules/gentoo/30-kernel-compat.rules index d6d4413726..213e218d93 100644 --- a/rules/gentoo/30-kernel-compat.rules +++ b/rules/gentoo/30-kernel-compat.rules @@ -2,6 +2,13 @@ ACTION!="add|change", GOTO="kernel_compat_end" +# +# sysfs timing rules +# + +# needed for kernels <2.6.30 +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", WAIT_FOR_SYSFS="descriptors" + # # naming device rules # -- cgit v1.2.3-54-g00ecf From 6834a4429997480b3959c04ac9a74de7f29b3056 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 28 Oct 2009 11:37:20 +0100 Subject: break loops if util_create_path() returns error Dangling symlinks in path components return -ENOENT. Do not retry to create the file in a loop in such case. --- libudev/libudev-queue-private.c | 8 +++++--- libudev/libudev-util-private.c | 25 ++++++++++++++++++------- udev/udev-node.c | 38 +++++++++++++++++++++++++------------- 3 files changed, 48 insertions(+), 23 deletions(-) diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 4e67a1f9d0..37de67a3d4 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -410,13 +410,15 @@ static void update_failed(struct udev_queue_export *udev_queue_export, /* record event in the failed directory */ udev_queue_export->failed_count++; do { - util_create_path(udev, filename); + err = util_create_path(udev, filename); + if (err != 0 && err != -ENOENT) + break; udev_selinux_setfscreatecon(udev, filename, S_IFLNK); err = symlink(udev_device_get_devpath(udev_device), filename); if (err != 0) - err = errno; + err = -errno; udev_selinux_resetfscreatecon(udev); - } while (err == ENOENT); + } while (err == -ENOENT); break; case DEVICE_QUEUED: diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 585dfc6a41..5b3e337643 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -43,18 +43,29 @@ int util_create_path(struct udev *udev, const char *path) pos[0] = '\0'; dbg(udev, "stat '%s'\n", p); - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - return 0; + if (stat(p, &stats) == 0) { + if ((stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + else + return -ENOTDIR; + } - if (util_create_path(udev, p) != 0) - return -1; + err = util_create_path(udev, p); + if (err != 0) + return err; dbg(udev, "mkdir '%s'\n", p); udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); err = mkdir(p, 0755); - if (err != 0 && errno == EEXIST) - if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR) - err = 0; + if (err != 0) { + err = -errno; + if (err == -EEXIST && stat(p, &stats) == 0) { + if ((stats.st_mode & S_IFMT) == S_IFDIR) + err = 0; + else + err = -ENOTDIR; + } + } udev_selinux_resetfscreatecon(udev); return err; } diff --git a/udev/udev-node.c b/udev/udev-node.c index 39bec3e166..8c2154d37e 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -78,13 +78,15 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod } else { info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); do { - util_create_path(udev, file); + err = util_create_path(udev, file); + if (err != 0 && err != -ENOENT) + break; udev_selinux_setfscreatecon(udev, file, mode); err = mknod(file, mode, devnum); if (err != 0) - err = errno; + err = -errno; udev_selinux_resetfscreatecon(udev); - } while (err == ENOENT); + } while (err == -ENOENT); if (err != 0) { err(udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", file, mode, major(devnum), minor(devnum)); goto exit; @@ -180,13 +182,15 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) } else { info(udev, "creating symlink '%s' to '%s'\n", slink, target); do { - util_create_path(udev, slink); + err = util_create_path(udev, slink); + if (err != 0 && err != -ENOENT) + break; udev_selinux_setfscreatecon(udev, slink, S_IFLNK); err = symlink(target, slink); if (err != 0) - err = errno; + err = -errno; udev_selinux_resetfscreatecon(udev); - } while (err == ENOENT); + } while (err == -ENOENT); if (err == 0) goto exit; } @@ -195,13 +199,15 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); unlink(slink_tmp); do { - util_create_path(udev, slink); - udev_selinux_setfscreatecon(udev, slink, S_IFLNK); + err = util_create_path(udev, slink_tmp); + if (err != 0 && err != -ENOENT) + break; + udev_selinux_setfscreatecon(udev, slink_tmp, S_IFLNK); err = symlink(target, slink_tmp); if (err != 0) - err = errno; + err = -errno; udev_selinux_resetfscreatecon(udev); - } while (err == ENOENT); + } while (err == -ENOENT); if (err != 0) { err(udev, "symlink(%s, %s) failed: %m\n", target, slink_tmp); goto exit; @@ -313,11 +319,17 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) } if (add) { + int err; + dbg(udev, "creating index: '%s'\n", filename); do { - util_create_path(udev, filename); - symlink(udev_device_get_devpath(dev), filename); - } while (errno == ENOENT); + err = util_create_path(udev, filename); + if (err != 0 && err != -ENOENT) + break; + err = symlink(udev_device_get_devpath(dev), filename); + if (err != 0) + err = -errno; + } while (err == -ENOENT); } } -- cgit v1.2.3-54-g00ecf From bfbf65aad06550afcc5b886c1d3acf4c561edb2b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 28 Oct 2009 11:45:32 +0100 Subject: remove "last_rule" option Its use breaks too many things which expect to be run from independent later rules, and is an idication that something needs to be fixed properly instead. --- NEWS | 4 ++++ udev/udev-rules.c | 9 --------- udev/udev.xml | 7 ------- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index 27b778f255..ec83316658 100644 --- a/NEWS +++ b/NEWS @@ -27,6 +27,10 @@ the udevadm commands. The udev-acl tool got adopted to changes in ConsoleKit. Version 0.4.11 is required now. +The option "last_rule" does no longer exist. Its use breaks too many +things which expect to be run from independent later rules, and is an idication +that something needs to be fixed properly instead. + udev 146 ======== Bugfixes. diff --git a/udev/udev-rules.c b/udev/udev-rules.c index ddb51de8e1..422e14ce23 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -164,7 +164,6 @@ enum token_type { TK_A_ATTR, /* val, attr */ TK_A_RUN, /* val, bool */ TK_A_GOTO, /* size_t */ - TK_A_LAST_RULE, TK_END, }; @@ -296,7 +295,6 @@ static const char *token_str(enum token_type type) [TK_A_ATTR] = "A ATTR", [TK_A_RUN] = "A RUN", [TK_A_GOTO] = "A GOTO", - [TK_A_LAST_RULE] = "A LAST_RULE", [TK_END] = "END", }; @@ -362,7 +360,6 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_IGNORE_DEVICE: case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: - case TK_A_LAST_RULE: case TK_A_IGNORE_REMOVE: dbg(rules->udev, "%s\n", token_str(type)); break; @@ -1037,7 +1034,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: case TK_A_IGNORE_REMOVE: - case TK_A_LAST_RULE: break; case TK_A_RUN: token->key.value_off = add_string(rule_tmp->rules, value); @@ -1500,10 +1496,6 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcmp(key, "OPTIONS") == 0) { const char *pos; - if (strstr(value, "last_rule") != NULL) { - dbg(rules->udev, "last rule to be applied\n"); - rule_add_key(&rule_tmp, TK_A_LAST_RULE, 0, NULL, NULL); - } if (strstr(value, "ignore_device") != NULL) { dbg(rules->udev, "device should be ignored\n"); rule_add_key(&rule_tmp, TK_A_IGNORE_DEVICE, 0, NULL, NULL); @@ -2526,7 +2518,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; cur = &rules->tokens[cur->key.rule_goto]; continue; - case TK_A_LAST_RULE: case TK_END: return 0; diff --git a/udev/udev.xml b/udev/udev.xml index c34a106d20..41941c820f 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -419,13 +419,6 @@ Rule and device options: - - - - Stops further rules application. No later rules will have - any effect. - - -- cgit v1.2.3-54-g00ecf From 5f4f842a8239c32e92cbd6a71f70e84e35762c69 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 29 Oct 2009 13:21:07 +0100 Subject: keymap: add HP Pavillion dv6315ea Taken from hal-info commit eba65779. --- extras/keymap/95-keymap.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 0e4c2dc6db..ac14cb9def 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -65,6 +65,8 @@ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*Elit ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*", RUN+="keymap $name hewlett-packard-2510p_2530p" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" +# HP Pavillion dv6315ea has empty DMI_VENDOR +ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" -- cgit v1.2.3-54-g00ecf From 1150c6e641374196f6dc47bd0e01dee7504abd9b Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 29 Oct 2009 13:23:14 +0100 Subject: keymap: add HP 2230s Taken from hal-info commit e6389d9fa. http://bugs.freedesktop.org/show_bug.cgi?id=21527 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index ac14cb9def..0fdb061eb0 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -61,7 +61,7 @@ ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X200 Tablet ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keymap $name hewlett-packard-pavilion" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*", RUN+="keymap $name hewlett-packard-compaq_elitebook" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*|*2230s*", RUN+="keymap $name hewlett-packard-compaq_elitebook" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*", RUN+="keymap $name hewlett-packard-2510p_2530p" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" -- cgit v1.2.3-54-g00ecf From 5448cc56f674b49aa0a2d718cac4266e18286712 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Thu, 29 Oct 2009 18:44:58 +0100 Subject: gudev: remove G_UDEV_API_IS_SUBJECT_TO_CHANGE since API is now stable Signed-off-by: David Zeuthen --- Makefile.am | 1 - NEWS | 3 +++ extras/gudev/gudev.h | 4 ---- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index cf7d36419c..a6043371cf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -335,7 +335,6 @@ extras_gudev_libgudev_1_0_la_CPPFLAGS = \ -I$(top_srcdir)/extras/gudev \ -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ -D_GUDEV_COMPILATION \ - -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ -DG_LOG_DOMAIN=\"GUdev\" extras_gudev_libgudev_1_0_la_CFLAGS = $(GLIB_CFLAGS) extras_gudev_libgudev_1_0_la_LIBADD = libudev/libudev.la $(GLIB_LIBS) diff --git a/NEWS b/NEWS index ec83316658..981aa058bc 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,9 @@ The option "last_rule" does no longer exist. Its use breaks too many things which expect to be run from independent later rules, and is an idication that something needs to be fixed properly instead. +The gudev API is no longer marked as experimental, +G_UDEV_API_IS_SUBJECT_TO_CHANGE is no longer needed. + udev 146 ======== Bugfixes. diff --git a/extras/gudev/gudev.h b/extras/gudev/gudev.h index 50c6e0d236..c3167f238c 100644 --- a/extras/gudev/gudev.h +++ b/extras/gudev/gudev.h @@ -21,10 +21,6 @@ #ifndef __G_UDEV_H__ #define __G_UDEV_H__ -#ifndef G_UDEV_API_IS_SUBJECT_TO_CHANGE -#error GUdev is currently unstable API. You must define G_UDEV_API_IS_SUBJECT_TO_CHANGE to acknowledge this. -#endif - #define _GUDEV_INSIDE_GUDEV_H 1 #include #include -- cgit v1.2.3-54-g00ecf From 82c6558e0109f66091e3a8e2c4ceef0372b0b331 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 30 Oct 2009 09:38:21 +0100 Subject: Makefile.am: fix build with mawk Don't use the [[:space:]] syntax in awk calls' regex, since that's GNU awk specific. Thanks to Alan Jenkins for finding this. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index a6043371cf..84f165476d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -530,7 +530,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/zepto-znote extras/keymap/keys.txt: /usr/include/linux/input.h - $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[[:space:]]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ + $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ -- cgit v1.2.3-54-g00ecf From 26347a4c5538008318188118872490128f43fcd3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 30 Oct 2009 12:31:59 +0100 Subject: use CLOEXEC flags instead of fcntl() --- Makefile.am | 2 +- libudev/docs/libudev-sections.txt | 1 + libudev/libudev-monitor.c | 6 ++---- libudev/libudev-private.h | 1 - libudev/libudev-util.c | 12 ------------ udev/udev-watch.c | 6 ++---- udev/udevd.c | 4 +--- 7 files changed, 7 insertions(+), 25 deletions(-) diff --git a/Makefile.am b/Makefile.am index 84f165476d..2185614c43 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,7 +30,7 @@ CLEANFILES = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=5 -LIBUDEV_REVISION=0 +LIBUDEV_REVISION=1 LIBUDEV_AGE=5 SUBDIRS += libudev/docs diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 4d70bca322..ff2dd363b1 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -83,6 +83,7 @@ udev_enumerate_add_nomatch_subsystem udev_enumerate_add_match_sysattr udev_enumerate_add_nomatch_sysattr udev_enumerate_add_match_property +udev_enumerate_add_match_sysname udev_enumerate_add_syspath udev_enumerate_scan_devices udev_enumerate_scan_subsystems diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index ee855afac4..96c153fbd7 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -139,13 +139,12 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; } - udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0); if (udev_monitor->sock == -1) { err(udev, "error getting socket: %m\n"); free(udev_monitor); return NULL; } - util_set_fd_cloexec(udev_monitor->sock); dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); return udev_monitor; @@ -197,13 +196,12 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char if (udev_monitor == NULL) return NULL; - udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_KOBJECT_UEVENT); + udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM|SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT); if (udev_monitor->sock == -1) { err(udev, "error getting socket: %m\n"); free(udev_monitor); return NULL; } - util_set_fd_cloexec(udev_monitor->sock); udev_monitor->snl.nl_family = AF_NETLINK; udev_monitor->snl.nl_groups = group; diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 285b9d48c1..28110d191c 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -205,7 +205,6 @@ size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute_ int udev_util_replace_whitespace(const char *str, char *to, size_t len); int udev_util_replace_chars(char *str, const char *white); int udev_util_encode_string(const char *str, char *str_enc, size_t len); -void util_set_fd_cloexec(int fd); unsigned int util_string_hash32(const char *str); /* libudev-util-private.c */ diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index 9a656b5a98..c0209f9cc6 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -481,18 +481,6 @@ err: return -1; } -void util_set_fd_cloexec(int fd) -{ - int flags; - - flags = fcntl(fd, F_GETFD); - if (flags < 0) - flags = FD_CLOEXEC; - else - flags |= FD_CLOEXEC; - fcntl(fd, F_SETFD, flags); -} - unsigned int util_string_hash32(const char *str) { unsigned int hash = 0; diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 102e16f81d..d67083b51b 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -38,10 +38,8 @@ static int inotify_fd = -1; */ int udev_watch_init(struct udev *udev) { - inotify_fd = inotify_init(); - if (inotify_fd >= 0) - util_set_fd_cloexec(inotify_fd); - else + inotify_fd = inotify_init1(IN_CLOEXEC); + if (inotify_fd < 0) err(udev, "inotify_init failed: %m\n"); return inotify_fd; } diff --git a/udev/udevd.c b/udev/udevd.c index dfdbb4c245..88e117f50a 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -223,7 +223,6 @@ static void worker_new(struct event *event) /* allow the main daemon netlink address to send devices to the worker */ udev_monitor_allow_unicast_sender(worker_monitor, monitor); udev_monitor_enable_receiving(worker_monitor); - util_set_fd_cloexec(udev_monitor_get_fd(worker_monitor)); worker = calloc(1, sizeof(struct worker)); if (worker == NULL) @@ -945,14 +944,13 @@ int main(int argc, char *argv[]) } /* unnamed socket from workers to the main daemon */ - if (socketpair(AF_LOCAL, SOCK_DGRAM, 0, worker_watch) < 0) { + if (socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, worker_watch) < 0) { fprintf(stderr, "error getting socketpair\n"); err(udev, "error getting socketpair\n"); rc = 6; goto exit; } pfd[FD_WORKER].fd = worker_watch[READ_END]; - util_set_fd_cloexec(worker_watch[WRITE_END]); rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { -- cgit v1.2.3-54-g00ecf From 88fbff03df6be4f0f71df11047d4a31daed357e4 Mon Sep 17 00:00:00 2001 From: Alan Jenkins Date: Thu, 29 Oct 2009 18:02:33 +0000 Subject: udevd: queue-export - remove retry loop These retry loops are required where create_path() could race with delete_path(). But only the main udevd process writes to the queue, so no races will happen here. Signed-off-by: Alan Jenkins --- libudev/libudev-queue-private.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 37de67a3d4..6109837f7e 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -396,7 +396,6 @@ static void update_failed(struct udev_queue_export *udev_queue_export, { struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; - int err; if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) return; @@ -409,16 +408,10 @@ static void update_failed(struct udev_queue_export *udev_queue_export, case DEVICE_FAILED: /* record event in the failed directory */ udev_queue_export->failed_count++; - do { - err = util_create_path(udev, filename); - if (err != 0 && err != -ENOENT) - break; - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); - err = symlink(udev_device_get_devpath(udev_device), filename); - if (err != 0) - err = -errno; - udev_selinux_resetfscreatecon(udev); - } while (err == -ENOENT); + util_create_path(udev, filename); + udev_selinux_setfscreatecon(udev, filename, S_IFLNK); + symlink(udev_device_get_devpath(udev_device), filename); + udev_selinux_resetfscreatecon(udev); break; case DEVICE_QUEUED: -- cgit v1.2.3-54-g00ecf From bc3ec7bd45814a75845529fd0aca5c5a9d9f0c14 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 31 Oct 2009 11:53:41 +0100 Subject: unblock signals we might want to handle On Thu, Oct 29, 2009 at 19:15, Christian P. Schmidt wrote: > After the getty replaces itself with login the pam module pam_mount > calls mount. This in turn determines that the partition to be mounted is > LUKS encrypted, and calls cryptsetup. Cryptsetup receives the password, > unlocks the partition, and calls udevadm settle in order to avoid some > problems in interaction with LVM. > > udevadm settle never returns. > > The problem here is that SIGUSR1 and SIGALRM are both blocked in oldmask > already, and never reach udevadm. No care is ever taken to ensure those > signals are not blocked. --- udev/test-udev.c | 6 ++++++ udev/udevadm-monitor.c | 5 +++++ udev/udevadm-settle.c | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/udev/test-udev.c b/udev/test-udev.c index 0806fbf9ce..bd61aa0695 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -52,6 +52,7 @@ int main(int argc, char *argv[]) const char *action; const char *subsystem; struct sigaction act; + sigset_t mask; int err = -EINVAL; udev = udev_new(); @@ -68,6 +69,11 @@ int main(int argc, char *argv[]) sigaction(SIGALRM, &act, NULL); sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); + sigemptyset(&mask); + sigaddset(&mask, SIGALRM); + sigaddset(&mask, SIGINT); + sigaddset(&mask, SIGTERM); + sigprocmask(SIG_UNBLOCK, &mask, NULL); /* trigger timeout to prevent hanging processes */ alarm(UDEV_EVENT_TIMEOUT); diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 90388db58e..00b130dafe 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -67,6 +67,7 @@ static void print_device(struct udev_device *device, const char *source, int pro int udevadm_monitor(struct udev *udev, int argc, char *argv[]) { struct sigaction act; + sigset_t mask; int option; int prop = 0; int print_kernel = 0; @@ -142,6 +143,10 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) act.sa_flags = SA_RESTART; sigaction(SIGINT, &act, NULL); sigaction(SIGTERM, &act, NULL); + sigemptyset(&mask); + sigaddset(&mask, SIGINT); + sigaddset(&mask, SIGTERM); + sigprocmask(SIG_UNBLOCK, &mask, NULL); printf("monitor will print the received events for:\n"); if (print_udev) { diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 5030f18602..4f422f9092 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -66,6 +66,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) const char *exists = NULL; int timeout = DEFAULT_TIMEOUT; struct sigaction act; + sigset_t mask; struct udev_queue *udev_queue = NULL; int rc = 1; @@ -78,6 +79,10 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) act.sa_flags = 0; sigaction(SIGALRM, &act, NULL); sigaction(SIGUSR1, &act, NULL); + sigemptyset(&mask); + sigaddset(&mask, SIGUSR1); + sigaddset(&mask, SIGALRM); + sigprocmask(SIG_UNBLOCK, &mask, NULL); while (1) { int option; @@ -163,7 +168,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); if (uctrl != NULL) { - sigset_t mask, oldmask; + sigset_t oldmask; sigemptyset(&mask); sigaddset(&mask, SIGUSR1); -- cgit v1.2.3-54-g00ecf From f0f7a43f4e60bc2233d86e6f24e2aca2410bc85e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 2 Nov 2009 16:22:14 +0100 Subject: extras/keymap/README.keymap.txt: Fix bug report link udev-extras is gone, ask people to file bugs against udev. --- extras/keymap/README.keymap.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt index eab8587de8..274dc6ac83 100644 --- a/extras/keymap/README.keymap.txt +++ b/extras/keymap/README.keymap.txt @@ -84,7 +84,7 @@ for inclusion you need to do the following steps: /tmp/orig-map.txt from step 2, and /tmp/udev-db.txt from step 5 to the bug tracker, so that they can be included in the next release: - https://bugs.launchpad.net/udev-extras/+bugs + https://bugs.launchpad.net/udev/+bugs For local testing, copy your map file to /lib/udev/keymaps/ with an appropriate name, and add an appropriate udev rule to /lib/udev/rules.d/95-keymap.rules: -- cgit v1.2.3-54-g00ecf From 495d408b36718ec68ed5a3d406bc2e74b7ffc219 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 3 Nov 2009 00:03:43 +0100 Subject: fix major fd leak in link handling link_find_prioritized(): Properly close directory handles to fix a major fd leak which caused hotplugging to fail entirely in many cases due to having too many open files. https://launchpad.net/bugs/463347 --- udev/udev-node.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/udev-node.c b/udev/udev-node.c index 8c2154d37e..24f2ccf618 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -281,6 +281,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons udev_device_unref(dev_db); } } + closedir(dir); return target; } -- cgit v1.2.3-54-g00ecf From 66094a4a7fc1d303e80785d586800eae9841502b Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 4 Nov 2009 16:34:22 +0100 Subject: ata_id: export more advanced ATA features --- extras/ata_id/ata_id.c | 380 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 367 insertions(+), 13 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 9644a45b19..66b9f42332 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -2,6 +2,8 @@ * ata_id - reads product/serial number from ATA drives * * Copyright (C) 2005-2008 Kay Sievers + * Copyright (C) 2009 Lennart Poettering + * Copyright (C) 2009 David Zeuthen * * 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 @@ -17,27 +19,238 @@ * along with this program. If not, see . */ -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - #include #include +#include #include #include #include +#include #include #include #include +#include +#include +#include #include #include #include #include #include +#include +#include #include "libudev.h" #include "libudev-private.h" +#define COMMAND_TIMEOUT 2000 + +/* Sends a SCSI command block */ +static int sg_io(int fd, int direction, + const void *cdb, size_t cdb_len, + void *data, size_t data_len, + void *sense, size_t sense_len) +{ + + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = cdb_len; + io_hdr.dxferp = data; + io_hdr.dxfer_len = data_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sense_len; + io_hdr.dxfer_direction = direction; + io_hdr.timeout = COMMAND_TIMEOUT; + return ioctl(fd, SG_IO, &io_hdr); +} + +static int disk_command(int fd, int command, int direction, void *cmd_data, + void *data, size_t *len) +{ + uint8_t *bytes = cmd_data; + uint8_t cdb[12]; + uint8_t sense[32]; + uint8_t *desc = sense+8; + int ret; + + /* + * ATA Pass-Through 12 byte command, as described in "T10 04-262r8 + * ATA Command Pass-Through": + * http://www.t10.org/ftp/t10/document.04/04-262r8.pdf + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0xa1; /* OPERATION CODE: 12 byte pass through */ + if (direction == SG_DXFER_NONE) { + cdb[1] = 3 << 1; /* PROTOCOL: Non-Data */ + cdb[2] = 0x20; /* OFF_LINE=0, CK_COND=1, T_DIR=0, BYT_BLOK=0, T_LENGTH=0 */ + } else if (direction == SG_DXFER_FROM_DEV) { + cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ + cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ + } else if (direction == SG_DXFER_TO_DEV) { + cdb[1] = 5 << 1; /* PROTOCOL: PIO Data-Out */ + cdb[2] = 0x26; /* OFF_LINE=0, CK_COND=1, T_DIR=0, BYT_BLOK=1, T_LENGTH=2 */ + } + cdb[3] = bytes[1]; /* FEATURES */ + cdb[4] = bytes[3]; /* SECTORS */ + cdb[5] = bytes[9]; /* LBA LOW */ + cdb[6] = bytes[8]; /* LBA MID */ + cdb[7] = bytes[7]; /* LBA HIGH */ + cdb[8] = bytes[10] & 0x4F; /* SELECT */ + cdb[9] = (uint8_t) command; + memset(sense, 0, sizeof(sense)); + if ((ret = sg_io(fd, direction, cdb, sizeof(cdb), data, len ? *len : 0, sense, sizeof(sense))) < 0) + return ret; + if (sense[0] != 0x72 || desc[0] != 0x9 || desc[1] != 0x0c) { + errno = EIO; + return -1; + } + + memset(bytes, 0, 12); + bytes[1] = desc[3]; /* FEATURES */ + bytes[2] = desc[4]; /* STATUS */ + bytes[3] = desc[5]; /* SECTORS */ + bytes[9] = desc[7]; /* LBA LOW */ + bytes[8] = desc[9]; /* LBA MID */ + bytes[7] = desc[11]; /* LBA HIGH */ + bytes[10] = desc[12]; /* SELECT */ + bytes[11] = desc[13]; /* ERROR */ + return ret; +} + +/** + * disk_identify_get_string: + * @identify: A block of IDENTIFY data + * @offset_words: Offset of the string to get, in words. + * @dest: Destination buffer for the string. + * @dest_len: Length of destination buffer, in bytes. + * + * Copies the ATA string from @identify located at @offset_words into @dest. + */ +static void disk_identify_get_string (uint8_t identify[512], + unsigned int offset_words, + char *dest, + size_t dest_len) +{ + unsigned int c1; + unsigned int c2; + + assert (identify != NULL); + assert (dest != NULL); + assert ((dest_len & 1) == 0); + + while (dest_len > 0) { + c1 = ((uint16_t *) identify)[offset_words] >> 8; + c2 = ((uint16_t *) identify)[offset_words] & 0xff; + *dest = c1; + dest++; + *dest = c2; + dest++; + offset_words++; + dest_len -= 2; + } +} + +static void disk_identify_fixup_string (uint8_t identify[512], + unsigned int offset_words, + size_t len) +{ + disk_identify_get_string(identify, offset_words, + (char *) identify + offset_words * 2, len); +} + +static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offset_words) +{ + uint16_t *p; + + p = (uint16_t *) identify; + p[offset_words] = le16toh (p[offset_words]); +} + +/** + * disk_identify: + * @udev: The libudev context. + * @fd: File descriptor for the block device. + * @out_identify: Return location for IDENTIFY data. + * + * Sends the IDENTIFY DEVICE command to the device represented by + * @fd. If successful, then the result will be copied into + * @out_identify. + * + * This routine is based on code from libatasmart, Copyright 2008 + * Lennart Poettering, LGPL v2.1. + * + * Returns: 0 if the IDENTIFY data was successfully obtained, + * otherwise non-zero with errno set. + */ +static int disk_identify (struct udev *udev, + int fd, + uint8_t out_identify[512]) +{ + int ret; + uint64_t size; + struct stat st; + uint16_t cmd[6]; + size_t len = 512; + const uint8_t *p; + + assert (out_identify != NULL); + + /* init results */ + ret = -1; + memset (out_identify, '\0', 512); + + if ((ret = fstat(fd, &st)) < 0) + goto fail; + + if (!S_ISBLK(st.st_mode)) { + errno = ENODEV; + goto fail; + } + + /* So, it's a block device. Let's make sure the ioctls work */ + if ((ret = ioctl(fd, BLKGETSIZE64, &size)) < 0) + goto fail; + + if (size <= 0 || size == (uint64_t) -1) { + errno = EIO; + goto fail; + } + + memset(cmd, 0, sizeof(cmd)); + cmd[1] = htons(1); + ret = disk_command(fd, + 0xEC, /* IDENTIFY DEVICE command */ + SG_DXFER_FROM_DEV, cmd, + out_identify, &len); + if (ret != 0) + goto fail; + + if (len != 512) { + errno = EIO; + goto fail; + } + + /* Check if IDENTIFY data is all NULs */ + for (p = out_identify; p < (const uint8_t*) out_identify + len; p++) { + if (*p) { + p = NULL; + break; + } + } + + if (p) { + errno = EIO; + goto fail; + } + + ret = 0; +fail: + return ret; +} + static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) @@ -49,6 +262,7 @@ int main(int argc, char *argv[]) { struct udev *udev; struct hd_driveid id; + uint8_t identify[512]; char model[41]; char model_enc[256]; char serial[21]; @@ -56,6 +270,7 @@ int main(int argc, char *argv[]) const char *node = NULL; int export = 0; int fd; + uint16_t word; int rc = 0; static const struct option options[] = { { "export", no_argument, NULL, 'x' }, @@ -105,15 +320,42 @@ int main(int argc, char *argv[]) goto exit; } - if (ioctl(fd, HDIO_GET_IDENTITY, &id)) { - if (errno == ENOTTY) { - info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); - rc = 2; - } else { - err(udev, "HDIO_GET_IDENTITY failed for '%s'\n", node); - rc = 3; + if (disk_identify(udev, fd, identify) == 0) { + /* + * fix up only the fields from the IDENTIFY data that we are going to + * use and copy it into the hd_driveid struct for convenience + */ + disk_identify_fixup_string (identify, 10, 20); /* serial */ + disk_identify_fixup_string (identify, 23, 6); /* fwrev */ + disk_identify_fixup_string (identify, 27, 40); /* model */ + disk_identify_fixup_uint16 (identify, 0); /* configuration */ + disk_identify_fixup_uint16 (identify, 75); /* queue depth */ + disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ + disk_identify_fixup_uint16 (identify, 82); /* command set supported */ + disk_identify_fixup_uint16 (identify, 83); /* command set supported */ + disk_identify_fixup_uint16 (identify, 84); /* command set supported */ + disk_identify_fixup_uint16 (identify, 85); /* command set supported */ + disk_identify_fixup_uint16 (identify, 86); /* command set supported */ + disk_identify_fixup_uint16 (identify, 87); /* command set supported */ + disk_identify_fixup_uint16 (identify, 89); /* time required for SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 90); /* time required for enhanced SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 91); /* current APM values */ + disk_identify_fixup_uint16 (identify, 94); /* current AAM value */ + disk_identify_fixup_uint16 (identify, 128); /* device lock function */ + disk_identify_fixup_uint16 (identify, 217); /* nominal media rotation rate */ + memcpy(&id, identify, sizeof id); + } else { + /* If this fails, then try HDIO_GET_IDENTITY */ + if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) { + if (errno == ENOTTY) { + info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); + rc = 2; + } else { + err(udev, "HDIO_GET_IDENTITY failed for '%s'\n", node); + rc = 3; + } + goto close; } - goto close; } memcpy (model, id.model, 40); @@ -127,6 +369,9 @@ int main(int argc, char *argv[]) udev_util_replace_chars(revision, NULL); if (export) { + /* Set this to convey the disk speaks the ATA protocol */ + printf("ID_ATA=1\n"); + if ((id.config >> 8) & 0x80) { /* This is an ATAPI device */ switch ((id.config >> 8) & 0x1f) { @@ -155,13 +400,122 @@ int main(int argc, char *argv[]) printf("ID_REVISION=%s\n", revision); printf("ID_SERIAL=%s_%s\n", model, serial); printf("ID_SERIAL_SHORT=%s\n", serial); + + if (id.command_set_1 & (1<<5)) { + printf ("ID_ATA_WRITE_CACHE=1\n"); + printf ("ID_ATA_WRITE_CACHE_ENABLED=%d\n", (id.cfs_enable_1 & (1<<5)) ? 1 : 0); + } + if (id.command_set_1 & (1<<10)) { + printf("ID_ATA_FEATURE_SET_HPA=1\n"); + printf("ID_ATA_FEATURE_SET_HPA_ENABLED=%d\n", (id.cfs_enable_1 & (1<<10)) ? 1 : 0); + + /* + * TODO: use the READ NATIVE MAX ADDRESS command to get the native max address + * so it is easy to check whether the protected area is in use. + */ + } + if (id.command_set_1 & (1<<3)) { + printf("ID_ATA_FEATURE_SET_PM=1\n"); + printf("ID_ATA_FEATURE_SET_PM_ENABLED=%d\n", (id.cfs_enable_1 & (1<<3)) ? 1 : 0); + } + if (id.command_set_1 & (1<<1)) { + printf("ID_ATA_FEATURE_SET_SECURITY=1\n"); + printf("ID_ATA_FEATURE_SET_SECURITY_ENABLED=%d\n", (id.cfs_enable_1 & (1<<1)) ? 1 : 0); + printf("ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=%d\n", id.trseuc * 2); + if ((id.cfs_enable_1 & (1<<1))) /* enabled */ { + if (id.dlf & (1<<8)) + printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=maximum\n"); + else + printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=high\n"); + } + if (id.dlf & (1<<5)) + printf("ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=%d\n", id.trsEuc * 2); + if (id.dlf & (1<<4)) + printf("ID_ATA_FEATURE_SET_SECURITY_EXPIRE=1\n"); + if (id.dlf & (1<<3)) + printf("ID_ATA_FEATURE_SET_SECURITY_FROZEN=1\n"); + if (id.dlf & (1<<2)) + printf("ID_ATA_FEATURE_SET_SECURITY_LOCKED=1\n"); + } + if (id.command_set_1 & (1<<0)) { + printf("ID_ATA_FEATURE_SET_SMART=1\n"); + printf("ID_ATA_FEATURE_SET_SMART_ENABLED=%d\n", (id.cfs_enable_1 & (1<<0)) ? 1 : 0); + } + if (id.command_set_2 & (1<<9)) { + printf("ID_ATA_FEATURE_SET_AAM=1\n"); + printf("ID_ATA_FEATURE_SET_AAM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<9)) ? 1 : 0); + printf("ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=%d\n", id.acoustic >> 8); + printf("ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=%d\n", id.acoustic & 0xff); + } + if (id.command_set_2 & (1<<5)) { + printf("ID_ATA_FEATURE_SET_PUIS=1\n"); + printf("ID_ATA_FEATURE_SET_PUIS_ENABLED=%d\n", (id.cfs_enable_2 & (1<<5)) ? 1 : 0); + } + if (id.command_set_2 & (1<<3)) { + printf("ID_ATA_FEATURE_SET_APM=1\n"); + printf("ID_ATA_FEATURE_SET_APM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<3)) ? 1 : 0); + if ((id.cfs_enable_2 & (1<<3))) + printf("ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=%d\n", id.CurAPMvalues & 0xff); + } + if (id.command_set_2 & (1<<0)) + printf("ID_ATA_DOWNLOAD_MICROCODE=1\n"); + + /* + * Word 76 indicates the capabilities of a SATA device. A PATA device shall set + * word 76 to 0000h or FFFFh. If word 76 is set to 0000h or FFFFh, then + * the device does not claim compliance with the Serial ATA specification and words + * 76 through 79 are not valid and shall be ignored. + */ + word = *((uint16_t *) identify + 76); + if (word != 0x0000 && word != 0xffff) { + printf("ID_ATA_SATA=1\n"); + /* + * If bit 2 of word 76 is set to one, then the device supports the Gen2 + * signaling rate of 3.0 Gb/s (see SATA 2.6). + * + * If bit 1 of word 76 is set to one, then the device supports the Gen1 + * signaling rate of 1.5 Gb/s (see SATA 2.6). + */ + if (word & (1<<2)) + printf("ID_ATA_SATA_SIGNAL_RATE_GEN2=1\n"); + if (word & (1<<1)) + printf("ID_ATA_SATA_SIGNAL_RATE_GEN1=1\n"); + } + + /* Word 217 indicates the nominal media rotation rate of the device */ + word = *((uint16_t *) identify + 217); + if (word != 0x0000) { + if (word == 0x0001) { + printf ("ID_ATA_ROTATION_RATE_RPM=0\n"); /* non-rotating e.g. SSD */ + } else if (word >= 0x0401 && word <= 0xfffe) { + printf ("ID_ATA_ROTATION_RATE_RPM=%d\n", word); + } + } + + /* + * Words 108-111 contain a mandatory World Wide Name (WWN) in the NAA IEEE Registered identifier + * format. Word 108 bits (15:12) shall contain 5h, indicating that the naming authority is IEEE. + * All other values are reserved. + */ + word = *((uint16_t *) identify + 108); + if ((word & 0xf000) == 0x5000) { + uint64_t wwwn; + + wwwn = *((uint16_t *) identify + 108); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 109); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 110); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 111); + printf("ID_WWN=0x%llx\n", (unsigned long long int) wwwn); + } } else { if (serial[0] != '\0') printf("%s_%s\n", model, serial); else printf("%s\n", model); } - close: close(fd); exit: -- cgit v1.2.3-54-g00ecf From 081be002eae9bc7fc03dbfd7b99b4d28a7c98f9d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 4 Nov 2009 17:06:52 +0100 Subject: udevd: create /dev/.udev/rules.d/ before watching it wit inotify This should also address: On Tue, Nov 3, 2009 at 16:21, Marco d'Itri wrote: > udev_rules_new() in udev/udev-rules.c unconditionally creates the > directory. > This is a problem because the function is called also by e.g. udevadm > test, and creating /dev/.udev/ when it does not exist is an unacceptable > side effect which will break everything else that checks for its > existence to know if udev is running. --- udev/udev-rules.c | 6 ------ udev/udevd.c | 7 +++++++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 422e14ce23..092ddcdc25 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1736,12 +1736,6 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) /* read dynamic/temporary rules */ util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); - if (stat(filename, &statbuf) != 0) { - util_create_path(udev, filename); - udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); - mkdir(filename, 0755); - udev_selinux_resetfscreatecon(udev); - } udev_list_init(&sort_list); add_matching_files(udev, &sort_list, filename, ".rules"); diff --git a/udev/udevd.c b/udev/udevd.c index 88e117f50a..72f9b180d3 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -919,6 +919,7 @@ int main(int argc, char *argv[]) IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } else { char filename[UTIL_PATH_SIZE]; + struct stat statbuf; inotify_add_watch(pfd[FD_INOTIFY].fd, LIBEXECDIR "/rules.d", IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); @@ -927,6 +928,12 @@ int main(int argc, char *argv[]) /* watch dynamic rules directory */ util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); + if (stat(filename, &statbuf) != 0) { + util_create_path(udev, filename); + udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); + mkdir(filename, 0755); + udev_selinux_resetfscreatecon(udev); + } inotify_add_watch(pfd[FD_INOTIFY].fd, filename, IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } -- cgit v1.2.3-54-g00ecf From ed1b2d9fc7d5c5bfe2a67b0b8ff9e5ea8694268e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 5 Nov 2009 04:32:41 +0100 Subject: sound: include ALSA sound card id in ID_ID property If two USB sound cards that have the same serial number are plugged in make sure ID_ID is unique at least during runtime, by including the ALSA card id in the ID_ID string. Fixes issues like this one: http://pulseaudio.org/ticket/661 --- rules/rules.d/78-sound-card.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules index f40921d9d1..0f0cf64d7c 100644 --- a/rules/rules.d/78-sound-card.rules +++ b/rules/rules.d/78-sound-card.rules @@ -48,8 +48,8 @@ SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_ LABEL="skip_pci" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}" +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}-$attr{id}" +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$attr{id}" ENV{ID_PATH}=="", IMPORT{program}="path_id %p/controlC%n" -- cgit v1.2.3-54-g00ecf From 368d325ba8a53090a3bb71cbdbe25e11d70fff02 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 5 Nov 2009 23:56:28 +0100 Subject: modem-modeswitch: fix ZTE MF6xx rule https://launchpad.net/bugs/281335 --- extras/modem-modeswitch/61-mobile-action.rules | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/modem-modeswitch/61-mobile-action.rules b/extras/modem-modeswitch/61-mobile-action.rules index 9116b25e22..29d460d53d 100644 --- a/extras/modem-modeswitch/61-mobile-action.rules +++ b/extras/modem-modeswitch/61-mobile-action.rules @@ -6,9 +6,10 @@ GOTO="mobile_action_end" LABEL="mobile_action_switch" ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" +LABEL="mobile_action_end" + # modem-modeswitch does not work with these devices, the fake CD-ROM needs to be ejected # ZTE MF6xx -ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", RUN+="/usr/bin/eject %k" +ACTION=="add", ENV{ID_CDROM}=="1", ENV{ID_VENDOR_ID}=="19d2", ENV{ID_MODEL_ID}=="2000", RUN+="/usr/bin/eject %k" -LABEL="mobile_action_end" -- cgit v1.2.3-54-g00ecf From 4e3664f22b39c3efa33f5778a651a083b5e1f544 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Sun, 8 Nov 2009 12:25:55 -0500 Subject: gudev: Fix up GUdevDeviceNumber Actually dev_t is an unsigned quad type (e.g. 64-bit even on 32-bit x86) so defining it to be an integer is wrong and not future proof. Thus, redefine it to actually be a dev_t (as originally wanted) and instead add a work-around for GNOME bug #584517, see https://bugzilla.gnome.org/show_bug.cgi?id=584517 for details. This way, GObject Introspection will still work. This change is technically an API/ABI break but - all released GUdev versions requires the user to understand that the API/ABI is unstable by requiring the G_UDEV_API_IS_SUBJECT_TO_CHANGE symbols to be defined - functions using GUdevDeviceNumber are rarely used so we don't bump the so number. Signed-off-by: David Zeuthen --- Makefile.am | 2 +- extras/gudev/gudevtypes.h | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2185614c43..92598a60c2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -378,7 +378,7 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil --pkg=gobject-2.0 \ -I$(top_srcdir)/extras \ -D_GUDEV_COMPILATION \ - -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \ + -D_GUDEV_WORK_AROUND_DEV_T_BUG \ $(top_srcdir)/extras/gudev/gudev.h \ $(top_srcdir)/extras/gudev/gudevtypes.h \ $(top_srcdir)/extras/gudev/gudevenums.h \ diff --git a/extras/gudev/gudevtypes.h b/extras/gudev/gudevtypes.h index 66156723f2..b95cf97529 100644 --- a/extras/gudev/gudevtypes.h +++ b/extras/gudev/gudevtypes.h @@ -26,6 +26,7 @@ #define __G_UDEV_TYPES_H__ #include +#include G_BEGIN_DECLS @@ -36,9 +37,13 @@ typedef struct _GUdevDevice GUdevDevice; * GUdevDeviceNumber: * * Corresponds to the standard #dev_t type as defined by POSIX (Until - * bug 584517 is resolved this is aliased to an integer). + * bug 584517 is resolved this work-around is needed). */ -typedef int GUdevDeviceNumber; +#ifdef _GUDEV_WORK_AROUND_DEV_T_BUG +typedef guint64 GUdevDeviceNumber; /* __UQUAD_TYPE */ +#else +typedef dev_t GUdevDeviceNumber; +#endif G_END_DECLS -- cgit v1.2.3-54-g00ecf From 68bffc607f7f0414fee77fa481d9c133ce0798e9 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 9 Nov 2009 22:11:29 +0100 Subject: sound: include ALSA sound card id in /dev/snd/by-id/ links If two USB sound cards that have the same serial number are plugged in make sure the by-id/ device node symlink is unique at least during runtime, by including the ALSA card id in the symlink name. This is a followup to ed1b2d9fc7. --- rules/rules.d/60-persistent-alsa.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/rules.d/60-persistent-alsa.rules b/rules/rules.d/60-persistent-alsa.rules index a5206fdbb1..624f57adec 100644 --- a/rules/rules.d/60-persistent-alsa.rules +++ b/rules/rules.d/60-persistent-alsa.rules @@ -5,9 +5,9 @@ SUBSYSTEM!="sound", GOTO="persistent_alsa_end" KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end" SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}!="", ENV{ID_IFACE}="$attr{bInterfaceNumber}" +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}-$attr{../id}" +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$attr{../id}" ENV{ID_PATH}=="", IMPORT{program}="path_id %p" ENV{ID_PATH}=="?*", SYMLINK+="snd/by-path/$env{ID_PATH}" -- cgit v1.2.3-54-g00ecf From 58e31304a4885fc242250ac6a06924bedf6e4e55 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Mon, 9 Nov 2009 16:30:18 -0500 Subject: gudev: Remove LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE from priv header Since libudev is no longer unstable either. Signed-off-by: David Zeuthen --- extras/gudev/gudevprivate.h | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/gudev/gudevprivate.h b/extras/gudev/gudevprivate.h index 64b008fb83..4fd498797a 100644 --- a/extras/gudev/gudevprivate.h +++ b/extras/gudev/gudevprivate.h @@ -27,7 +27,6 @@ #include -#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE 1 #include G_BEGIN_DECLS -- cgit v1.2.3-54-g00ecf From 088fbefafdf9deec211f7069b5ad0836f462cbab Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 9 Nov 2009 23:19:04 +0100 Subject: Revert "sound: include ALSA sound card id in /dev/snd/by-id/ links" This reverts commit 68bffc607f7f0414fee77fa481d9c133ce0798e9. After discussing this with Kay we decided to drop this again as by-id links only make sense for devices that have a unique serial id. If they don't any attempts to make them unique have the side effect of nourishing assumptions by users that cannot be met, as the by-id device link of a device could differ depending on the history of simultaneously plugged in device. So, to make sure that all device nodes follow the same rules for by-id/ symlinks, drop this patch again. --- rules/rules.d/60-persistent-alsa.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/rules.d/60-persistent-alsa.rules b/rules/rules.d/60-persistent-alsa.rules index 624f57adec..a5206fdbb1 100644 --- a/rules/rules.d/60-persistent-alsa.rules +++ b/rules/rules.d/60-persistent-alsa.rules @@ -5,9 +5,9 @@ SUBSYSTEM!="sound", GOTO="persistent_alsa_end" KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end" SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}!="", ENV{ID_IFACE}="$attr{bInterfaceNumber}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}-$attr{../id}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$attr{../id}" +SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}" +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}" +ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" ENV{ID_PATH}=="", IMPORT{program}="path_id %p" ENV{ID_PATH}=="?*", SYMLINK+="snd/by-path/$env{ID_PATH}" -- cgit v1.2.3-54-g00ecf From 882bcd951c8830218eed7d9c91ff675d14ed9cad Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Nov 2009 06:31:13 +0100 Subject: gudev: fix pkg-config call to work with "make distcheck" --- Makefile.am | 6 ++---- configure.ac | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 92598a60c2..08ff1578f8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,8 +21,7 @@ AM_LDFLAGS = \ -Wl,--as-needed DISTCHECK_CONFIGURE_FLAGS = \ - --enable-gtk-doc \ - --enable-extras + --enable-gtk-doc CLEANFILES = @@ -364,6 +363,7 @@ extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gud $(AM_V_GEN)glib-mkenums --template $^ > \ $@.tmp && mv $@.tmp $@ +if ENABLE_INTROSPECTION extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ LD_LIBRARY_PATH=$(top_builddir)/extras/gudev \ @@ -391,14 +391,12 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil extras/gudev/GUdev-1.0.typelib: extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) $(AM_V_GEN)g-ir-compiler $< -o $@ -if ENABLE_INTROSPECTION girdir = $(GIRDIR) gir_DATA = extras/gudev/GUdev-1.0.gir typelibsdir = $(GIRTYPELIBDIR) typelibs_DATA = extras/gudev/GUdev-1.0.typelib -EXTRA_DIST += GUdev-1.0.gir CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # ENABLE_INTROSPECTION diff --git a/configure.ac b/configure.ac index 3afb94a82c..3cb2299ce1 100644 --- a/configure.ac +++ b/configure.ac @@ -85,16 +85,16 @@ fi AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) AC_ARG_ENABLE([introspection], - AS_HELP_STRING([--enable-introspection], [enable GObject introspection]), - [], [enable_introspection=no]) + AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), + [], [enable_introspection=yes]) if test "x$enable_introspection" = xyes; then PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) - AC_SUBST([GIRDIR], [$($PKG_CONFIG --variable=girdir gobject-introspection-1.0)]) - AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)]) + AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=prefix=${prefix} --variable=girdir gobject-introspection-1.0)]) + AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) fi AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) -- cgit v1.2.3-54-g00ecf From b15b08913800c4a2fad6530becca55b896f66984 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 10 Nov 2009 06:35:20 +0100 Subject: gudev: fix out-of-tree build --- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 08ff1578f8..21a2b9b316 100644 --- a/Makefile.am +++ b/Makefile.am @@ -377,12 +377,13 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil --pkg=glib-2.0 \ --pkg=gobject-2.0 \ -I$(top_srcdir)/extras \ + -I$(top_builddir)/extras \ -D_GUDEV_COMPILATION \ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ $(top_srcdir)/extras/gudev/gudev.h \ $(top_srcdir)/extras/gudev/gudevtypes.h \ $(top_srcdir)/extras/gudev/gudevenums.h \ - $(top_srcdir)/extras/gudev/gudevenumtypes.h \ + $(top_builddir)/extras/gudev/gudevenumtypes.h \ $(top_srcdir)/extras/gudev/gudevclient.h \ $(top_srcdir)/extras/gudev/gudevdevice.h \ $(top_srcdir)/extras/gudev/gudevclient.c \ -- cgit v1.2.3-54-g00ecf From 04da95b1c4958b5015bc065e7cfeeed79cd718e0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Nov 2009 06:49:02 +0100 Subject: update NEWS --- NEWS | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 981aa058bc..c0196a18ab 100644 --- a/NEWS +++ b/NEWS @@ -32,7 +32,9 @@ things which expect to be run from independent later rules, and is an idication that something needs to be fixed properly instead. The gudev API is no longer marked as experimental, -G_UDEV_API_IS_SUBJECT_TO_CHANGE is no longer needed. +G_UDEV_API_IS_SUBJECT_TO_CHANGE is no longer needed. The gudev introspection +is enabled by default now. Various projects already depend on introspection +information to bind dynamic languages to the gudev interfaces. udev 146 ======== -- cgit v1.2.3-54-g00ecf From 7fa9bb9dbf538bf3c8a25a6699f65a8ac9cc8bbf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Nov 2009 15:09:27 +0100 Subject: Revert "gudev: fix out-of-tree build" This reverts commit b15b08913800c4a2fad6530becca55b896f66984. This breaks "make distcheck". The header is distributed in the tarball, and does not live in builddir. --- Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 21a2b9b316..08ff1578f8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -377,13 +377,12 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil --pkg=glib-2.0 \ --pkg=gobject-2.0 \ -I$(top_srcdir)/extras \ - -I$(top_builddir)/extras \ -D_GUDEV_COMPILATION \ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ $(top_srcdir)/extras/gudev/gudev.h \ $(top_srcdir)/extras/gudev/gudevtypes.h \ $(top_srcdir)/extras/gudev/gudevenums.h \ - $(top_builddir)/extras/gudev/gudevenumtypes.h \ + $(top_srcdir)/extras/gudev/gudevenumtypes.h \ $(top_srcdir)/extras/gudev/gudevclient.h \ $(top_srcdir)/extras/gudev/gudevdevice.h \ $(top_srcdir)/extras/gudev/gudevclient.c \ -- cgit v1.2.3-54-g00ecf From 86f380dd29249ff2dd7eeb26467e75da6585cec1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Nov 2009 15:35:11 +0100 Subject: release 147 --- ChangeLog | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) diff --git a/ChangeLog b/ChangeLog index 16b520b886..da89f2a6ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,149 @@ +Summary of changes from v146 to v147 +============================================ + +Alan Jenkins (1): + udevd: queue-export - remove retry loop + +Andrew Church (1): + fix wrong parameter size on ioctl FIONREAD + +Daniel Mierswa (2): + don't compare a non-existing function with NULL + use nanosleep() instead of usleep() + +David Zeuthen (4): + gudev: remove G_UDEV_API_IS_SUBJECT_TO_CHANGE since API is now stable + ata_id: export more advanced ATA features + gudev: Fix up GUdevDeviceNumber + gudev: Remove LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE from priv header + +Florian Zumbiehl (10): + util_delete_path(): use util_strscpy() + util_lookup_group(): fix memory leak if realloc() fails + util_delete_path(): handle multiple leading slashes + util_create_path(): fix possible out of bounds array access + ude_rules.c: fix possible NULL pointer dereference in get_key() + util_resolve_sys_link(): fix possible buffer overflow + udev_util_encode_string(): fix possible buffer overflow + udev-rules.c: parse_file() - fix possible buffer overflow + udev_queue_get_seqnum_sequence_is_finished(): fix possible file handle leak + util_run_program(): fix possible buffer overflow #2 + +Harald Hoyer (2): + scsi_id: prevent buffer overflow in check_fill_0x83_prespc3() + rename interfaces to _rename if rename fails + +Jeremy Kerr (1): + util_run_program: restore signal mask before executing event RUN commands + +Kay Sievers (45): + make: sort Makefile.am per target/extra + configure.ac: version bump + udev-acl: allow to skip ACL handling + rules: rfkill has no group, so use 0644 + rule_generator: net - fix MATCHDEVID + make: add comment + update NEWS + print warning for NAME="%k" - it breaks the kernel supplied DEVNAME + warn about non-readable or empty rules file + change database file names + assign errno for getgrnam_r()/getpwnam_r() + doc: udevadm test *does* create nodes and links these days + util_unlink_secure(): chmod() before chown() + util_create_path(): fix errno usage + inotify_add_watch(): do not store watch, if it failed + update TODO + update README + rules: suse - use NAME for mapper/control + libudev-util.c: get_sys_link() - return error for empty link target + udev-rules.c: remove 'first_token' variable + Revert "udev-rules.c: remove 'first_token' variable" + test: catch possible bug in GOTO resolving + udevadm: remove symlink support for old commands + util_run_program(): skip multiple spaces in argv creation + fix whitespace + require 2.6.27 for proper signalfd handling + fix randonm findings from llvm-clang-analyzer + simplify "symlink name stack" + reorder create_path() and node/link creation to be called in a direct sequence + put util_create_path() and file creastion in a retry loop + udevadm: control - remove compat code + scsi_id: delete copy of bsg.h + fix SYMLINK{} option parsing + rules: remove remaining NAME="%k" + rules: drop almost all NAME= keys + update TODO, NEWS + udevd: serialize events for with the same major/minor + break loops if util_create_path() returns error + remove "last_rule" option + use CLOEXEC flags instead of fcntl() + unblock signals we might want to handle + udevd: create /dev/.udev/rules.d/ before watching it wit inotify + gudev: fix pkg-config call to work with "make distcheck" + update NEWS + Revert "gudev: fix out-of-tree build" + +Lennart Poettering (5): + pci-db: make sure we actually read the pci.ids file instead of usb.ids + sound: recognize saa7134 TV card sound devices as TV cards + sound: include ALSA sound card id in ID_ID property + sound: include ALSA sound card id in /dev/snd/by-id/ links + Revert "sound: include ALSA sound card id in /dev/snd/by-id/ links" + +Marco d'Itri (6): + doc: writing_udev_rules updated for the new command names + rules: sound - do not use /usr/bin/env + udevadm: print all messages to stderr with priority higher or equal than LOG_ERR + udevadmi: control = exit with rc=2 if there is some system error + gudev: gir-scanner workaround for out of tree builds + gudev: fix out-of-tree build + +Mario Limonciello (1): + hid2hci: remove superfluous bmAttributes match + +Martin Pitt (24): + extras/keymap: Add Acer Aspire 6920 + extras/modem-modeswitch: eject ZTE MF6xx fake CD-ROMs + extras/keymap: Fix hold key on Acer Aspire 6920 + extras/keymap: Fix case matching for Micro-Star + Revert "extras/keymap: Fix case matching for Micro-Star" + make raw USB printer devices accessible for lp + modem-modeswitch rules: Match more devices + extras/keymap: fix hash table collisions + extras/keymap: Rename KEY_COFFEE to KEY_SCREENLOCK + fix single-session CD detection + fix previous commit for CD detection + make raw USB printer devices world-readable again + 50-udev-default.rules: fix printer MODE + keymap: Add Logitech Wave USB + keymap: add missing map file + keymap: fix usb_id invocation + keymap: make USB keyboards really work + keymap: Add Logitech Wave cordless + keymap: add HP Pavillion dv6315ea + keymap: add HP 2230s + Makefile.am: fix build with mawk + extras/keymap/README.keymap.txt: Fix bug report link + fix major fd leak in link handling + modem-modeswitch: fix ZTE MF6xx rule + +Matthias Schwarzott (2): + rules: Gentoo update + rules: Gentoo update + +Maxim Levitsky (1): + keymap for Acer Aspire 5720 + +Peter Rajnoha (1): + libudev: allow to store negative values in the udev database + +Scott James Remnant (1): + util_run_program: *really* restore signal mask before executing event RUN commands + +William Jon McCann (1): + udev-acl: catch up with ConsoleKit 0.4.1 + + Summary of changes from v145 to v146 ============================================ -- cgit v1.2.3-54-g00ecf From 7505831b7ee7b04d84424d2ed306a76abd32871c Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 10 Nov 2009 12:32:38 -0500 Subject: cdrom_id: Still check profiles even if there is no media Even when there is no medium in the drive, we should still check the profiles supported by the drive. Otherwise we fail to detect things like Blu-ray drives. See https://bugzilla.gnome.org/show_bug.cgi?id=600273 for more information. Signed-off-by: David Zeuthen --- extras/cdrom_id/cdrom_id.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 6ea763b415..2380b158a0 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -583,9 +583,9 @@ int main(int argc, char *argv[]) goto exit; } - /* check for media */ - if (cd_media_compat(udev, fd) < 0) - goto print; + /* check for media - don't bail if there's no media as we still need to + * to read profiles */ + cd_media_compat(udev, fd); /* check if drive talks MMC */ if (cd_inquiry(udev, fd) < 0) -- cgit v1.2.3-54-g00ecf From d93fb59c50a720e2a1ace2177cc824c00ff8eed6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Nov 2009 21:52:51 +0100 Subject: rules: set mode of floppy device nodes to 0660 --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index a79073b90e..3593a53658 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -74,7 +74,7 @@ SUBSYSTEM=="block", GROUP="disk" # floppy KERNEL=="fd[0-9]", GROUP="floppy" -KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0640 -G floppy $root/%k" +KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0660 -G floppy $root/%k" KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" # cdrom -- cgit v1.2.3-54-g00ecf From 5052297b6a8928d3ccfdd9996b71fdfff8bc8921 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 12 Nov 2009 22:17:47 +0100 Subject: modem-modeswitch: add a device --- extras/modem-modeswitch/61-option-modem-modeswitch.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/modem-modeswitch/61-option-modem-modeswitch.rules b/extras/modem-modeswitch/61-option-modem-modeswitch.rules index 7c94a06c06..3ef6f081aa 100644 --- a/extras/modem-modeswitch/61-option-modem-modeswitch.rules +++ b/extras/modem-modeswitch/61-option-modem-modeswitch.rules @@ -35,5 +35,6 @@ ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7501", RUN+="modem-modeswitch -v 0x% ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7601", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7901", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" LABEL="option_zerocd_end" -- cgit v1.2.3-54-g00ecf From cdae488a3fbca5a61b3f8ea0651730cfa2da9cb0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Nov 2009 15:22:17 +0100 Subject: remove "ignore_device" There is no way to ignore an event these days. Libudev events can not be suppressed. It only prevents RUN keys from being executed, which results in an inconsistent behavior in current setups. --- NEWS | 9 +++++++++ configure.ac | 2 +- udev/udev-event.c | 16 ---------------- udev/udev-rules.c | 13 ------------- udev/udev.h | 1 - udev/udev.xml | 6 ------ udev/udevadm-test.c | 2 +- udev/udevd.c | 2 +- 8 files changed, 12 insertions(+), 39 deletions(-) diff --git a/NEWS b/NEWS index c0196a18ab..66a71e0505 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +udev 148 +======== +Bugfixes. + +The option "ignore_device" does no longer exist. There is no way to +ignore an event, as libudev events can not be suppressed by rules. +It only prevented RUN keys from being executed, which results in an +inconsistent behavior in current setups. + udev 147 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 3cb2299ce1..12271f1461 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [147], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [148], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/udev/udev-event.c b/udev/udev-event.c index d5b4d0941e..4e1773ffea 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -568,12 +568,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) event->tmp_node = NULL; } - if (event->ignore_device) { - info(event->udev, "device event will be ignored\n"); - delete_kdevnode = 1; - goto exit_add; - } - if (event->name != NULL && event->name[0] == '\0') { info(event->udev, "device node creation suppressed\n"); delete_kdevnode = 1; @@ -638,10 +632,6 @@ exit_add: udev_device_delete_db(dev); udev_rules_apply_to_event(rules, event); - if (event->ignore_device) { - info(event->udev, "device event will be ignored\n"); - goto exit; - } if (event->name == NULL) goto exit; @@ -694,10 +684,6 @@ exit_add: } udev_rules_apply_to_event(rules, event); - if (event->ignore_device) { - info(event->udev, "device event will be ignored\n"); - goto exit; - } if (udev_device_get_ignore_remove(dev)) { info(event->udev, "ignore_remove for '%s'\n", udev_device_get_devnode(dev)); @@ -710,8 +696,6 @@ exit_add: /* default devices */ udev_rules_apply_to_event(rules, event); - if (event->ignore_device) - info(event->udev, "device event will be ignored\n"); if (strcmp(udev_device_get_action(dev), "remove") != 0) udev_device_update_db(dev); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 092ddcdc25..07cb4a7fbf 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -144,7 +144,6 @@ enum token_type { TK_M_RESULT, /* val */ TK_M_MAX, - TK_A_IGNORE_DEVICE, TK_A_STRING_ESCAPE_NONE, TK_A_STRING_ESCAPE_REPLACE, TK_A_INOTIFY_WATCH, /* int */ @@ -275,7 +274,6 @@ static const char *token_str(enum token_type type) [TK_M_RESULT] = "M RESULT", [TK_M_MAX] = "M MAX", - [TK_A_IGNORE_DEVICE] = "A IGNORE_DEVICE", [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", @@ -357,7 +355,6 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", token_str(type), operation_str(op), attr, value, string_glob_str(glob)); break; - case TK_A_IGNORE_DEVICE: case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: case TK_A_IGNORE_REMOVE: @@ -1030,7 +1027,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, if (data != NULL) token->key.mode = *(mode_t *)data; break; - case TK_A_IGNORE_DEVICE: case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: case TK_A_IGNORE_REMOVE: @@ -1496,10 +1492,6 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcmp(key, "OPTIONS") == 0) { const char *pos; - if (strstr(value, "ignore_device") != NULL) { - dbg(rules->udev, "device should be ignored\n"); - rule_add_key(&rule_tmp, TK_A_IGNORE_DEVICE, 0, NULL, NULL); - } if (strstr(value, "ignore_remove") != NULL) { dbg(rules->udev, "remove event should be ignored\n"); rule_add_key(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); @@ -2259,11 +2251,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (match_key(rules, cur, event->program_result) != 0) goto nomatch; break; - - case TK_A_IGNORE_DEVICE: - event->ignore_device = 1; - return 0; - break; case TK_A_STRING_ESCAPE_NONE: esc = ESCAPE_NONE; break; diff --git a/udev/udev.h b/udev/udev.h index 8f0a3014b6..555eae6311 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -48,7 +48,6 @@ struct udev_event { unsigned int name_final:1; unsigned int devlink_final:1; unsigned int run_final:1; - unsigned int ignore_device:1; unsigned int inotify_watch:1; }; diff --git a/udev/udev.xml b/udev/udev.xml index 41941c820f..ff01fefe58 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -419,12 +419,6 @@ Rule and device options: - - - - Ignore this event completely. - - diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 6c5710380e..5dd515bcdc 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -119,7 +119,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) info(udev, "%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); - if (err == 0 && !event->ignore_device && udev_get_run(udev)) { + if (err == 0 && udev_get_run(udev)) { udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; diff --git a/udev/udevd.c b/udev/udevd.c index 72f9b180d3..300d603519 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -293,7 +293,7 @@ static void worker_new(struct event *event) alarm(udev_device_get_event_timeout(dev)); /* execute RUN= */ - if (err == 0 && !udev_event->ignore_device && udev_get_run(udev_event->udev)) + if (err == 0 && udev_get_run(udev_event->udev)) failed = udev_event_execute_run(udev_event, &orig_sigmask); -- cgit v1.2.3-54-g00ecf From 6d87ee2e0024074b77001e57ff1d7b7d24b1be68 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Nov 2009 23:39:33 +0100 Subject: print warning for BUS=, SYSFS{}=, ID= --- NEWS | 4 ++++ TODO | 7 ++++--- udev/udev-rules.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++------ 3 files changed, 65 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 66a71e0505..32a6e49c0a 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,10 @@ ignore an event, as libudev events can not be suppressed by rules. It only prevented RUN keys from being executed, which results in an inconsistent behavior in current setups. +BUS=, SYSFS{}=, ID= are long deprecated and should be SUBSYSTEM(S)=, +ATTR(S){}=, KERNEL(S)=. It will cause a warning once for every rule +file from now on. + udev 147 ======== Bugfixes. diff --git a/TODO b/TODO index 1f85973d40..bc94f1b0ee 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,7 @@ o convert firmware.sh to C - o get rid of braindead "scan all devices to find myself" libusb interface - if it can not be fixed, drop libusb entirely + o get rid of "scan all devices to find myself" libusb interface + if it can not be fixed, drop libusb entirely and add a simple + wrapper around the Linux usb ioctls we need o drop all support for the DEPRECATED sysfs layout - o add warning for BUS, SYSFS, ID + o remove deprecated BUS=, SYSFS{}=, ID= keys diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 07cb4a7fbf..3da2033d51 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -1156,6 +1157,9 @@ static int add_rule(struct udev_rules *rules, char *line, char *linepos; char *attr; struct rule_tmp rule_tmp; + bool bus_warn = false; + bool sysfs_warn = false; + bool id_warn = false; memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); rule_tmp.rules = rules; @@ -1240,8 +1244,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcmp(key, "KERNELS") == 0 || - strcmp(key, "ID") == 0) { + if (strcmp(key, "KERNELS") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid KERNELS operation\n"); goto invalid; @@ -1250,8 +1253,37 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcmp(key, "SUBSYSTEMS") == 0 || - strcmp(key, "BUS") == 0) { + if (strcmp(key, "ID") == 0) { + if (!id_warn) { + id_warn = true; + err(rules->udev, "ID= will be removed in a future udev version, " + "please use KERNEL= to match the event device, or KERNELS= " + "to match a parent device, in %s:%u\n", filename, lineno); + } + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid KERNELS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL); + continue; + } + + if (strcmp(key, "SUBSYSTEMS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid SUBSYSTEMS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); + continue; + } + + if (strcmp(key, "BUS") == 0) { + if (!bus_warn) { + bus_warn = true; + err(rules->udev, "BUS= will be removed in a future udev version, " + "please use SUBSYSTEM= to match the event device, or SUBSYSTEMS= " + "to match a parent device, in %s:%u\n", filename, lineno); + } if (op > OP_MATCH_MAX) { err(rules->udev, "invalid SUBSYSTEMS operation\n"); goto invalid; @@ -1269,8 +1301,7 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0 || - strncmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { + if (strncmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid ATTRS operation\n"); goto invalid; @@ -1290,6 +1321,26 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } + if (strncmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { + if (!sysfs_warn) { + sysfs_warn = true; + err(rules->udev, "SYSFS{}= will be removed in a future udev version, " + "please use ATTR{}= to match the event device, or ATTRS{}= " + "to match a parent device, in %s:%u\n", filename, lineno); + } + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid ATTRS operation\n"); + goto invalid; + } + attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ATTRS attribute\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr); + continue; + } + if (strncmp(key, "ENV{", sizeof("ENV{")-1) == 0) { attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1); if (attr == NULL) { -- cgit v1.2.3-54-g00ecf From 86f77493bd48d8b95988a1f539b8b943a89757bf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Nov 2009 23:40:27 +0100 Subject: test-udev: remove "ignore_device" code --- udev/test-udev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/test-udev.c b/udev/test-udev.c index bd61aa0695..75518f628d 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) if (udev_device_get_event_timeout(dev) >= 0) alarm(udev_device_get_event_timeout(dev)); - if (err == 0 && !event->ignore_device && udev_get_run(udev)) + if (err == 0 && udev_get_run(udev)) udev_event_execute_run(event, NULL); udev_event_unref(event); -- cgit v1.2.3-54-g00ecf From f49a6b223e9b0e2808df173e31ae37da1ca32953 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Nov 2009 23:48:58 +0100 Subject: udev-test.pl: catch-up with recent changes --- test/udev-test.pl | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 47cadc5db3..896bb228c4 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -39,7 +39,7 @@ my @tests = ( EOF }, { - desc => "label test of scsi disc (old key names)", + desc => "label test of scsi disc", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , @@ -49,7 +49,7 @@ KERNEL=="ttyACM0", NAME="modem" EOF }, { - desc => "label test of scsi disc (old key names)", + desc => "label test of scsi disc", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , @@ -263,15 +263,6 @@ EOF exp_name => "first_disk5" , rules => < "test substitution chars (old key names)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , - rules => < "node", rules => < "ignore rule test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "nothing", - not_exp_name => "node", - exp_add_error => "yes", - rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", rules => < Date: Thu, 19 Nov 2009 16:25:18 +0100 Subject: rules: remove support for IDE (hd*) devices The kernel IDE drivers get deprecated now: http://article.gmane.org/gmane.linux.ide/43151 Almost everybody has switched over to libata devices long ago. Recent services do not work with the now deprecated IDE drivers at all and require libata drivers and SCSI infrastructure. Systems who care about the old stuff need to add the rules to the compat rules. --- NEWS | 4 ++++ rules/rules.d/50-udev-default.rules | 2 -- rules/rules.d/60-persistent-storage.rules | 9 --------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/NEWS b/NEWS index 32a6e49c0a..528c492e3c 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,10 @@ BUS=, SYSFS{}=, ID= are long deprecated and should be SUBSYSTEM(S)=, ATTR(S){}=, KERNEL(S)=. It will cause a warning once for every rule file from now on. +The support for the deprecated IDE devices has been removed from the +default set of rules. Distros who still care about non-libata drivers +need to add the rules to the compat rules file. + udev 147 ======== Bugfixes. diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 3593a53658..00c73dfe86 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -75,11 +75,9 @@ SUBSYSTEM=="block", GROUP="disk" # floppy KERNEL=="fd[0-9]", GROUP="floppy" KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0660 -G floppy $root/%k" -KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", OPTIONS+="all_partitions" # cdrom SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" -SUBSYSTEM=="block", KERNEL=="hd*", SUBSYSTEMS=="ide", ATTRS{media}=="cdrom", GROUP="cdrom" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd", GROUP="cdrom" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 0950847b19..f808c810ec 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -12,21 +12,12 @@ SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end" -# never access non-cdrom removable ide devices, the drivers are causing event loops on open() -KERNEL=="hd*[!0-9]", ATTR{removable}=="1", SUBSYSTEMS=="ide", ATTRS{media}=="disk|floppy", GOTO="persistent_storage_end" -KERNEL=="hd*[0-9]", ATTRS{removable}=="1", GOTO="persistent_storage_end" - # ignore partitions that span the entire disk TEST=="whole_disk", GOTO="persistent_storage_end" # for partitions import parent information ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" -# by-id (hardware serial number) -KERNEL=="hd*[!0-9]", IMPORT{program}="ata_id --export $tempnode" -KERNEL=="hd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}" -KERNEL=="hd*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/ata-$env{ID_SERIAL}-part%n" - # USB devices use their own serial number KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" # ATA devices with their own "ata" kernel subsystem -- cgit v1.2.3-54-g00ecf From 160b069c25690bfb0c785994c7c3710289179107 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 Nov 2009 03:03:27 +0100 Subject: ata_id: skip ATA commands if we find an optical drive Some drives are reported to erase CD-RW media with the ATA commands we send. Thanks to Christoph Stritt for his debugging. Original bug is here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635 --- extras/ata_id/ata_id.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 66b9f42332..cbd3b5b8d2 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include "libudev.h" @@ -210,6 +211,16 @@ static int disk_identify (struct udev *udev, goto fail; } + /* + * do not confuse optical drive firmware with ATA commands + * some drives are reported to blank CD-RWs + */ + if (ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0) { + errno = EIO; + ret = -1; + goto fail; + } + /* So, it's a block device. Let's make sure the ioctls work */ if ((ret = ioctl(fd, BLKGETSIZE64, &size)) < 0) goto fail; -- cgit v1.2.3-54-g00ecf From 5d490002b339f33a033fe09cef4272afb38da676 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 20 Nov 2009 18:22:53 -0600 Subject: README.keymap.txt: small clarification --- extras/keymap/README.keymap.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt index 274dc6ac83..ae8916bb67 100644 --- a/extras/keymap/README.keymap.txt +++ b/extras/keymap/README.keymap.txt @@ -48,7 +48,8 @@ for inclusion you need to do the following steps: keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and Acers) have multimedia/function keys on a separate input device instead of the primary keyboard. The keyboard device should have a name like "input/event3". - In the following commands, the name will be written as "input/eventX". + In the following commands, the name will be written as "input/eventX" (replace + X with the appropriate number). 2. Dump current mapping: -- cgit v1.2.3-54-g00ecf From 4e9fdfccbdd16f0cfdb5c8fa8484a8ba0f2e69d3 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Fri, 20 Nov 2009 20:21:58 -0500 Subject: scsi_id: Export WWN and Unit Serial Number Since the Unit Serial Number and the WWN are useful bits of information export them as properties in the udev database. These bits of information are often printed on the physical disk, see http://people.freedesktop.org/~david/FUJITSU-MAY2036RC-sas-disk-picture.jpg and displaying them separately in the UI (or in /dev/disk) might help users identify the physical disk. This patch exports these bits of information as ID_WWN and ID_SCSI_SERIAL. Note that ata_id also use the ID_WWN property since commit 66094a4a7fc1d303e80785d586800eae9841502b (2009-11-04). Also print out ID_SCSI=1 so users of the udev database knows the disk speaks SCSI. Here's the scsi_id output from one of my SAS disks with these changes: ID_SCSI=1 ID_VENDOR=FUJITSU ID_VENDOR_ENC=FUJITSU\x20 ID_MODEL=MAY2036RC ID_MODEL_ENC=MAY2036RC\x20\x20\x20\x20\x20\x20\x20 ID_REVISION=0103 ID_TYPE=disk ID_SERIAL=3500000e01b83f520 ID_SERIAL_SHORT=500000e01b83f520 ID_WWN=0x500000e01b83f520 ID_SCSI_SERIAL=B3G1P8500RWT Unfortunately we can't overload ID_SERIAL for two reasons 1. ID_SERIAL (and ID_SERIAL_SHORT) exported by scsi_id isn't really the unit serial number (as defined by SCSI) - it is sometimes the WWN (since it is more unique than the Unit Serial Number) and complex rules (to make the serial unique) govern what value to use. 2. It would break existing setups if the value of ID_SERIAL changed Signed-off-by: David Zeuthen --- extras/scsi_id/scsi_id.c | 7 ++++++ extras/scsi_id/scsi_id.h | 6 +++++ extras/scsi_id/scsi_serial.c | 57 +++++++++++++++++++++++++++++--------------- 3 files changed, 51 insertions(+), 19 deletions(-) diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 72a7257113..9c5b2c3a3c 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -549,6 +549,7 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) if (export) { char serial_str[MAX_SERIAL_LEN]; + printf("ID_SCSI=1\n"); printf("ID_VENDOR=%s\n", vendor_str); printf("ID_VENDOR_ENC=%s\n", vendor_enc_str); printf("ID_MODEL=%s\n", model_str); @@ -563,6 +564,12 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) udev_util_replace_chars(serial_str, NULL); printf("ID_SERIAL_SHORT=%s\n", serial_str); } + if (dev_scsi.wwn[0] != '\0') { + printf("ID_WWN=0x%s\n", dev_scsi.wwn); + } + if (dev_scsi.unit_serial_number[0] != '\0') { + printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); + } goto out; } diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 9fcadec173..4536cfd4f2 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -39,6 +39,12 @@ struct scsi_id_device { char serial[MAX_SERIAL_LEN]; char serial_short[MAX_SERIAL_LEN]; int use_sg; + + /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */ + char unit_serial_number[MAX_SERIAL_LEN]; + + /* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */ + char wwn[17]; }; extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index ab0ffd62aa..5b18b225a5 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -85,11 +85,15 @@ static const char hex_str[]="0123456789abcdef"; #define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ #define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ #define SG_ERR_CAT_TIMEOUT 3 -#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ -#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ +#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ #define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ #define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ +static int do_scsi_page80_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int max_len); + static int sg_err_category_new(struct udev *udev, int scsi_status, int msg_status, int host_status, int driver_status, const @@ -420,7 +424,7 @@ static int do_scsi_page0_inquiry(struct udev *udev, return 1; } if (buffer[3] > len) { - info(udev, "%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); + info(udev, "%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); return 1; } @@ -477,7 +481,8 @@ static int check_fill_0x83_id(struct udev *udev, struct scsi_id_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values - *id_search, char *serial, char *serial_short, int max_len) + *id_search, char *serial, char *serial_short, int max_len, + char *wwn) { int i, j, s, len; @@ -561,6 +566,10 @@ static int check_fill_0x83_id(struct udev *udev, } strcpy(serial_short, &serial[s]); + + if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { + strncpy(wwn, &serial[s], 16); + } return 0; } @@ -591,12 +600,16 @@ static int check_fill_0x83_prespc3(struct udev *udev, /* Get device identification VPD page */ static int do_scsi_page83_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int len) + char *serial, char *serial_short, int len, + char *unit_serial_number, char *wwn) { int retval; unsigned int id_ind, j; unsigned char page_83[SCSI_INQ_BUFF_LEN]; + /* also pick up the page 80 serial number */ + do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN); + memset(page_83, 0, SCSI_INQ_BUFF_LEN); retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); @@ -643,7 +656,8 @@ static int do_scsi_page83_inquiry(struct udev *udev, serial, serial_short, len); /* - * Search for a match in the prioritized id_search_list. + * Search for a match in the prioritized id_search_list - since WWN ids + * come first we can pick up the WWN in check_fill_0x83_id(). */ for (id_ind = 0; id_ind < sizeof(id_search_list)/sizeof(id_search_list[0]); @@ -656,7 +670,8 @@ static int do_scsi_page83_inquiry(struct udev *udev, retval = check_fill_0x83_id(udev, dev_scsi, &page_83[j], &id_search_list[id_ind], - serial, serial_short, len); + serial, serial_short, len, + wwn); dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, id_search_list[id_ind].id_type, id_search_list[id_ind].naa_type, @@ -775,15 +790,19 @@ static int do_scsi_page80_inquiry(struct udev *udev, * Prepend 'S' to avoid unlikely collision with page 0x83 vendor * specific type where we prepend '0' + vendor + model. */ - serial[0] = 'S'; - ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]); - if (ser_ind < 0) - return 1; - len = buf[3]; - for (i = 4; i < len + 4; i++, ser_ind++) - serial[ser_ind] = buf[i]; - memcpy(serial_short, &buf[4], len); - serial_short[len] = '\0'; + len = buf[3]; + if (serial != NULL) { + serial[0] = 'S'; + ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]); + if (ser_ind < 0) + return 1; + for (i = 4; i < len + 4; i++, ser_ind++) + serial[ser_ind] = buf[i]; + } + if (serial_short != NULL) { + memcpy(serial_short, &buf[4], len); + serial_short[len] = '\0'; + } return 0; } @@ -866,7 +885,7 @@ int scsi_get_serial(struct udev *udev, goto completed; } } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn)) { retval = 1; goto completed; } else { @@ -882,7 +901,7 @@ int scsi_get_serial(struct udev *udev, * conform to pre-SPC3 expectations. */ if (retval == 2) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn)) { retval = 1; goto completed; } else { @@ -922,7 +941,7 @@ int scsi_get_serial(struct udev *udev, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, dev_scsi->serial_short, len)) { + dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn)) { /* * Success */ -- cgit v1.2.3-54-g00ecf From a07d103e63f4ba1ed7560396c6fcd0eb293de059 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 23 Nov 2009 13:51:11 -0800 Subject: Revert "modem-modeswitch: add a device" This reverts commit 5052297b6a8928d3ccfdd9996b71fdfff8bc8921. The 'option-zerocd' method should *only* be used with Option NV devices since other manufacturers have completely different methods for killing their fake driver CD. --- extras/modem-modeswitch/61-option-modem-modeswitch.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/modem-modeswitch/61-option-modem-modeswitch.rules b/extras/modem-modeswitch/61-option-modem-modeswitch.rules index 3ef6f081aa..7c94a06c06 100644 --- a/extras/modem-modeswitch/61-option-modem-modeswitch.rules +++ b/extras/modem-modeswitch/61-option-modem-modeswitch.rules @@ -35,6 +35,5 @@ ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7501", RUN+="modem-modeswitch -v 0x% ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7601", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7901", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="19d2", ATTRS{idProduct}=="2000", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" LABEL="option_zerocd_end" -- cgit v1.2.3-54-g00ecf From 8a993fab2f218234f06743bcc127dda61a45711b Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 23 Nov 2009 13:52:08 -0800 Subject: Revert "extras/modem-modeswitch: Add Huawei E1550 GSM modem" This reverts commit 53842b53820a0f0b2b0ff5b28caf01e3f7e26f22. The 'option-zerocd' method should *only* be used with Option NV devices since other manufacturers have completely different methods for killing their fake driver CD. --- extras/modem-modeswitch/61-option-modem-modeswitch.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/modem-modeswitch/61-option-modem-modeswitch.rules b/extras/modem-modeswitch/61-option-modem-modeswitch.rules index 7c94a06c06..19dc5b4965 100644 --- a/extras/modem-modeswitch/61-option-modem-modeswitch.rules +++ b/extras/modem-modeswitch/61-option-modem-modeswitch.rules @@ -34,6 +34,5 @@ ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7401", RUN+="modem-modeswitch -v 0x% ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7501", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7601", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7901", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="12d1", ATTRS{idProduct}=="1446", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" LABEL="option_zerocd_end" -- cgit v1.2.3-54-g00ecf From 73045f9d3923c5046729921dc919b886655cfbc7 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 23 Nov 2009 13:54:35 -0800 Subject: modem-modeswitch: 61-option-modem-modeswitch.rules is only for Option NV devices Make people aware that they shouldn't add devices not manufactured by Option NV to 61-option-modem-modeswitch.rules. modem-modeswitch only supports ejecting the fake CD for Option NV devices at this time. People should be using (and fixing) usb_modeswitch instead of modem-modeswitch. --- extras/modem-modeswitch/61-option-modem-modeswitch.rules | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extras/modem-modeswitch/61-option-modem-modeswitch.rules b/extras/modem-modeswitch/61-option-modem-modeswitch.rules index 19dc5b4965..053733efb3 100644 --- a/extras/modem-modeswitch/61-option-modem-modeswitch.rules +++ b/extras/modem-modeswitch/61-option-modem-modeswitch.rules @@ -1,3 +1,6 @@ +# NOTE: only for devices manufactured by Option NV +# DO NOT add devices that are not manufactured by Option NV + ACTION!="add", GOTO="option_zerocd_end" SUBSYSTEM=="usb", ATTR{bDeviceClass}!="ff", ENV{DEVTYPE}=="usb_device", GOTO="option_zerocd_disable" @@ -35,4 +38,7 @@ ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7501", RUN+="modem-modeswitch -v 0x% ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7601", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7901", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" +# NOTE: only for devices manufactured by Option NV +# DO NOT add devices that are not manufactured by Option NV + LABEL="option_zerocd_end" -- cgit v1.2.3-54-g00ecf From de408510ec4197ba2b81cdfdac15740d2bd7151f Mon Sep 17 00:00:00 2001 From: Daniel Mierswa Date: Tue, 24 Nov 2009 06:22:03 +0100 Subject: Fix typo in NEWS, ConsoleKit-0.4.11 -> 0.4.1 Signed-off-by: Daniel Mierswa --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 528c492e3c..db0e028577 100644 --- a/NEWS +++ b/NEWS @@ -41,7 +41,7 @@ be added to the compat rules file. Symlinks to udevadm with the old command names are no longer resolved to the udevadm commands. -The udev-acl tool got adopted to changes in ConsoleKit. Version 0.4.11 is +The udev-acl tool got adopted to changes in ConsoleKit. Version 0.4.1 is required now. The option "last_rule" does no longer exist. Its use breaks too many -- cgit v1.2.3-54-g00ecf From 28c7463999c64517ddce0b52e89161d77dfac373 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 25 Nov 2009 11:06:10 -0500 Subject: Create /dev/disk/by-id/wwn-0x... symlinks Now that both ata_id and scsi_id exports the World Wide Name in the ID_WWN property, use this to create persistent symlinks. Example /dev/disk/by-id/wwn-0x500000e01b83f360 -> ../../sdn /dev/disk/by-id/wwn-0x500000e01b83f440 -> ../../sdm Signed-off-by: David Zeuthen --- rules/rules.d/60-persistent-storage.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index f808c810ec..e2a5e74b71 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -66,4 +66,7 @@ KERNEL!="sr*", OPTIONS+="watch" ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" +# by-id (World Wide Name) +ENV{DEVTYPE}=="disk", ENV{ID_WWN}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN}" + LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From d6b5571c1237c0a8e49dfc148615309f9c1a6c5c Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 25 Nov 2009 11:17:54 -0500 Subject: Also create /dev/disk/by-id/wwn-0x..-part%n symlinks for partitions # ls -l /dev/disk/by-id/wwn-0x500 wwn-0x500000e01b83f360 wwn-0x50014ee25578924f-part1 wwn-0x500000e01b83f440 wwn-0x50014ee25578924f-part2 wwn-0x500000e01b83f520 wwn-0x50014ee2aabdc41b wwn-0x500000e01b843d90 wwn-0x50014ee2aabdc41b-part1 wwn-0x5000c50016359fd1 wwn-0x50014ee2aabdc41b-part2 wwn-0x50014ee0016eb4f5 wwn-0x5001517958cabd77 wwn-0x50014ee0016eb572 wwn-0x5001517958cabd77-part1 wwn-0x50014ee055d524e2 wwn-0x5001517958cabd77-part2 wwn-0x50014ee055d524e2-part1 wwn-0x5001517958d6a74e wwn-0x50014ee055d524e2-part2 wwn-0x5001517958d6a74e-part1 wwn-0x50014ee1003d9c50 wwn-0x5001517958d6a74e-part2 wwn-0x50014ee1003d9c50-part1 wwn-0x50024e9200c0c693 wwn-0x50014ee1003d9c50-part2 wwn-0x50024e9200c0c694 wwn-0x50014ee1aac30d4e wwn-0x50024e9200c0c6ae wwn-0x50014ee1aac30d4e-part1 wwn-0x50024e9200c0c6af wwn-0x50014ee1aac30d4e-part2 wwn-0x50024e9200c0c6b0 wwn-0x50014ee25578924f wwn-0x50024e9200c0c6b1 Signed-off-by: David Zeuthen --- rules/rules.d/60-persistent-storage.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index e2a5e74b71..c839f3bc06 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -68,5 +68,6 @@ ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk # by-id (World Wide Name) ENV{DEVTYPE}=="disk", ENV{ID_WWN}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN}" +ENV{DEVTYPE}=="partition", ENV{ID_WWN}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN}-part%n" LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From a6cf7734015dfc4479f4fdd4585d8953979fe0b0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 30 Nov 2009 18:38:43 +0100 Subject: extras: Add input_id input_id probes input/event devices for their class (keyboard, keys, mouse, touchpad, tablet, joystick). This is based on the corresponding hal code in hald/linux/device.c, input_test_{abs,rel,...}. This should provide enough functionality to get hal-less X.org working (which in particular needs to know exactly which devices are touchpads). Replace the brittle hacks in 60-persistent-input.rules with checking for the new ID_INPUT_* flags. This keeps the old ID_CLASS properties for now (but they are to be removed later on). Note: The current code has several hacks still, which are to be replaced with proper libudev calls later on. --- Makefile.am | 6 ++ extras/input_id/.gitignore | 1 + extras/input_id/input_id.c | 154 ++++++++++++++++++++++++++++++++ rules/rules.d/60-persistent-input.rules | 18 ++-- 4 files changed, 168 insertions(+), 11 deletions(-) create mode 100644 extras/input_id/.gitignore create mode 100644 extras/input_id/input_id.c diff --git a/Makefile.am b/Makefile.am index 08ff1578f8..883cfc8cf7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -236,6 +236,12 @@ extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_device extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/floppy/create_floppy_devices +# ------------------------------------------------------------------------------ +# usb_id - USB device property import +# ------------------------------------------------------------------------------ +extras_input_id_input_id_SOURCES = extras/input_id/input_id.c +libexec_PROGRAMS += extras/input_id/input_id + # ------------------------------------------------------------------------------ # path_id - compose identifier of persistent elements of the parent buses # ------------------------------------------------------------------------------ diff --git a/extras/input_id/.gitignore b/extras/input_id/.gitignore new file mode 100644 index 0000000000..4f33cba4ad --- /dev/null +++ b/extras/input_id/.gitignore @@ -0,0 +1 @@ +input_id diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c new file mode 100644 index 0000000000..393a05d53a --- /dev/null +++ b/extras/input_id/input_id.c @@ -0,0 +1,154 @@ +/* + * input_id - input device classification + * + * Copyright (C) 2009 Martin Pitt + * Portions Copyright (C) 2004 David Zeuthen, + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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 keymap; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include + +/* we must use this kernel-compatible implementation */ +#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<> OFF(bit)) & 1) + +/* + * Read a capabilities/name file and return bitmask. + * @param path File to open + * @param bitmask: Output array; must have max_size elements + */ +static void get_cap_mask (const char *path, unsigned long *bitmask, size_t max_size) +{ + FILE* f; + int i; + char text[4096]; + char* word; + unsigned long val; + + f = fopen(path, "r"); + if (f == NULL) { + perror("opening caps file"); + exit(1); + } + if (fgets(text, sizeof(text), f) == NULL) { + perror("fgets"); + exit(1); + } + fclose(f); + + memset (bitmask, 0, max_size); + i = 0; + while ((word = strrchr(text, ' ')) != NULL) { + val = strtoul (word+1, NULL, 16); + bitmask[i] = val; + *word = '\0'; + ++i; + } + val = strtoul (text, NULL, 16); + bitmask[i] = val; +} + +/* pointer devices */ +static void test_pointers (const unsigned long* bitmask_abs, const unsigned long* bitmask_key, const unsigned long* bitmask_rel) +{ + int is_mouse = 0; + int is_touchpad = 0; + + if (test_bit (ABS_PRESSURE, bitmask_abs)) + is_touchpad = 1; + + if (test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { + if (test_bit (BTN_STYLUS, bitmask_key)) + puts("ID_INPUT_TABLET=1"); + else if (test_bit (BTN_TOUCH, bitmask_key)) + is_touchpad = 1; + else if (test_bit (BTN_TRIGGER, bitmask_key) || + test_bit (BTN_A, bitmask_key) || + test_bit (BTN_1, bitmask_key)) + puts("ID_INPUT_JOYSTICK=1"); + else if (test_bit (BTN_MOUSE, bitmask_key)) + /* This path is taken by VMware's USB mouse, which has + * absolute axes, but no touch/pressure button. */ + is_mouse = 1; + } + + if (test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel)) + is_mouse = 1; + + if (is_mouse) + puts("ID_INPUT_MOUSE=1"); + if (is_touchpad) + puts("ID_INPUT_TOUCHPAD=1"); +} + +/* key like devices */ +static void test_key (const unsigned long* bitmask_key) +{ + unsigned i; + unsigned long acc; + unsigned long mask; + + /* do we have any KEY_* capability? */ + acc = 0; + for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) + acc |= bitmask_key[i]; + if (acc > 0) + puts("ID_INPUT_KEY=1"); + + /* the first 32 bits are ESC, numbers, and Q to D; if we have all of + * those, consider it a full keyboard; do not test KEY_RESERVED, though */ + mask = 0xFFFFFFFE; + if ((bitmask_key[0] & mask) == mask) + puts("ID_INPUT_KEYBOARD=1"); +} + +int main (int argc, char** argv) +{ + char capfile[PATH_MAX]; + unsigned long bitmask_abs[NBITS(ABS_MAX)]; + unsigned long bitmask_key[NBITS(KEY_MAX)]; + unsigned long bitmask_rel[NBITS(REL_MAX)]; + + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(1); + } + + /* Use this as a flag that input devices were detected, so that this + * program doesn't need to be called more than once per device */ + puts("ID_INPUT=1"); + + snprintf(capfile, sizeof(capfile), "/sys/%s/device/capabilities/abs", argv[1]); + get_cap_mask (capfile, bitmask_abs, sizeof (bitmask_abs)); + snprintf(capfile, sizeof(capfile), "/sys/%s/device/capabilities/rel", argv[1]); + get_cap_mask (capfile, bitmask_rel, sizeof (bitmask_rel)); + snprintf(capfile, sizeof(capfile), "/sys/%s/device/capabilities/key", argv[1]); + get_cap_mask (capfile, bitmask_key, sizeof (bitmask_key)); + + test_pointers(bitmask_abs, bitmask_key, bitmask_rel); + + test_key(bitmask_key); + + return 0; +} diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index c65517b8ae..08fe49bbdc 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -4,22 +4,18 @@ ACTION!="add|change", GOTO="persistent_input_end" SUBSYSTEM!="input", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +ENV{ID_INPUT}=="", IMPORT{program}="input_id %p" +SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{program}="usb_id --export %p" -# well defined boot-subclass usb devices -SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="01", ENV{ID_CLASS}="kbd", GOTO="serial" -SUBSYSTEMS=="usb", ATTRS{bInterfaceClass}=="03", ATTRS{bInterfaceProtocol}=="02", ENV{ID_CLASS}="mouse", GOTO="serial" +# backwards-compatibility ID_CLASS +ENV{ID_INPUT_KEYBOARD}=="?*", ENV{ID_CLASS}="kbd" +ENV{ID_INPUT_MOUSE}=="?*", ENV{ID_CLASS}="mouse" +ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ID_CLASS}="joystick" -# other devices +# other device types which we need for persistent links DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr", GOTO="serial" -DRIVERS=="atkbd", ENV{ID_CLASS}="kbd", GOTO="serial" -DRIVERS=="psmouse", ENV{ID_CLASS}="mouse", GOTO="serial" ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir", GOTO="serial" -# joystick (ABS_X || ABS_WHEEL || ABS_THROTTLE) && !BTN_TOUCH && !BTN_DIGI -ATTRS{modalias}=="input:*-*a[068],*|input:*-*a*,[68],*m*", ATTRS{modalias}!="input:*-*k*14[0A],*r*", \ - ENV{ID_CLASS}="joystick", GOTO="serial" - # fill empty serial number LABEL="serial", ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" -- cgit v1.2.3-54-g00ecf From 897c0f175d239f7a94207197e2464f06b92368f7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 30 Nov 2009 18:46:51 +0100 Subject: 70-acl.rules: Use new-style input properties ID_CLASS is deprecated for input devices. Use new ID_INPUT_JOYSTICK instead. --- extras/udev-acl/70-acl.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 8259a7a936..278b9aae7c 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -46,7 +46,7 @@ SUBSYSTEM=="misc", KERNEL=="kvm", ENV{ACL_MANAGE}="1" ENV{ID_SMARTCARD_READER}=="*?", ENV{ACL_MANAGE}="1" # joysticks -SUBSYSTEM=="input", ENV{ID_CLASS}=="joystick", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ACL_MANAGE}="1" # apply ACL for all locally logged in users LABEL="acl_apply", ENV{ACL_MANAGE}=="?*", TEST=="/var/run/ConsoleKit/database", \ -- cgit v1.2.3-54-g00ecf From 6722e19ab1d379d7227450c402ee5d3c1c0e3889 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 30 Nov 2009 19:16:09 +0100 Subject: input: Deprecate ENV{ID_CLASS} The ID_CLASS property on input devices has been replaced by the more accurate set of flags ID_INPUT_{KEYBOARD,KEYS,MOUSE,TOUCHPAD,TABLET,JOYSTICK}. Rewrite 60-persistent-input.rules to use the new properties now and not export ID_CLASS any more, since it is not used by anything else any more. Add note about migration to NEWS, in case this is being used in custom rules. --- NEWS | 7 +++++++ rules/rules.d/60-persistent-input.rules | 30 +++++++++++++++--------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/NEWS b/NEWS index db0e028577..cd54a12466 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,13 @@ The support for the deprecated IDE devices has been removed from the default set of rules. Distros who still care about non-libata drivers need to add the rules to the compat rules file. +The ID_CLASS property on input devices has been replaced by the more accurate +set of flags ID_INPUT_{KEYBOARD,KEY,MOUSE,TOUCHPAD,TABLET,JOYSTICK}. These are +determined by the new "input_id" prober now. Some devices, such as touchpads, +can have several classes. So if you previously had custom udev rules which e. g. +checked for ENV{ID_CLASS}=="kbd", you need to replace this with +ENV{ID_INPUT_KEYBOARD}=="?*". + udev 147 ======== Bugfixes. diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index 08fe49bbdc..e4675aedcd 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -7,31 +7,31 @@ KERNEL=="input[0-9]*", GOTO="persistent_input_end" ENV{ID_INPUT}=="", IMPORT{program}="input_id %p" SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{program}="usb_id --export %p" -# backwards-compatibility ID_CLASS -ENV{ID_INPUT_KEYBOARD}=="?*", ENV{ID_CLASS}="kbd" -ENV{ID_INPUT_MOUSE}=="?*", ENV{ID_CLASS}="mouse" -ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ID_CLASS}="joystick" - -# other device types which we need for persistent links -DRIVERS=="pcspkr", ENV{ID_CLASS}="spkr", GOTO="serial" -ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{ID_CLASS}="ir", GOTO="serial" +# determine class name for persistent symlinks +ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd" +ENV{ID_INPUT_MOUSE}=="?*", ENV{.INPUT_CLASS}="mouse" +ENV{ID_INPUT_TOUCHPAD}=="?*", ENV{.INPUT_CLASS}="mouse" +ENV{ID_INPUT_TABLET}=="?*", ENV{.INPUT_CLASS}="mouse" +ENV{ID_INPUT_JOYSTICK}=="?*", ENV{.INPUT_CLASS}="joystick" +DRIVERS=="pcspkr", ENV{.INPUT_CLASS}="spkr" +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{.INPUT_CLASS}="ir" # fill empty serial number -LABEL="serial", ENV{ID_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" +ENV{.INPUT_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" # by-id links -KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{ID_CLASS}" +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{.INPUT_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{.INPUT_CLASS}" # allow empty class for USB devices, by appending the interface number -SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{ID_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \ +SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \ SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" # by-path SUBSYSTEMS=="usb|platform", IMPORT{program}="path_id %p" -ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{ID_CLASS}" -ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{ID_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{ID_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{.INPUT_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{.INPUT_CLASS}" # allow empty class for platform and usb devices; platform supports only a single interface that way -SUBSYSTEMS=="usb|platform", ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{ID_CLASS}=="", \ +SUBSYSTEMS=="usb|platform", ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", \ SYMLINK+="input/by-path/$env{ID_PATH}-event" LABEL="persistent_input_end" -- cgit v1.2.3-54-g00ecf From e0ead3ba820956648d103de2cac642f7097b519d Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Mon, 30 Nov 2009 23:03:05 +0100 Subject: extras/input_id: Correctly identify touchpads BTN_TOUCH (as well as ABS_PRESSURE) is used not only by touchpads but by touchscreens as well. The proper check for a touchpad is presence of BTN_TOOL_FINGER and absence of BTN_TOOL_PEN (the latter to filter out some tablets that use BTN_TOOL_FINGER). Tablet matching should be on either BTN_TOOL_PEN or BTN_STYLUS. --- extras/input_id/input_id.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 393a05d53a..2e143a5628 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -75,13 +75,10 @@ static void test_pointers (const unsigned long* bitmask_abs, const unsigned long int is_mouse = 0; int is_touchpad = 0; - if (test_bit (ABS_PRESSURE, bitmask_abs)) - is_touchpad = 1; - if (test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { - if (test_bit (BTN_STYLUS, bitmask_key)) + if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) puts("ID_INPUT_TABLET=1"); - else if (test_bit (BTN_TOUCH, bitmask_key)) + else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) is_touchpad = 1; else if (test_bit (BTN_TRIGGER, bitmask_key) || test_bit (BTN_A, bitmask_key) || -- cgit v1.2.3-54-g00ecf From 326e15a8ed97a22f2fe52d203896763d75f93c2c Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Wed, 2 Dec 2009 01:20:03 +0000 Subject: Fix out-of-tree builds gudevenumtypes.h won't be under $(top_srcdir) when built out-of-tree from GIT. Signed-off-by: Scott James Remnant --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 883cfc8cf7..994092775b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -388,7 +388,7 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil $(top_srcdir)/extras/gudev/gudev.h \ $(top_srcdir)/extras/gudev/gudevtypes.h \ $(top_srcdir)/extras/gudev/gudevenums.h \ - $(top_srcdir)/extras/gudev/gudevenumtypes.h \ + $(top_builddir)/extras/gudev/gudevenumtypes.h \ $(top_srcdir)/extras/gudev/gudevclient.h \ $(top_srcdir)/extras/gudev/gudevdevice.h \ $(top_srcdir)/extras/gudev/gudevclient.c \ -- cgit v1.2.3-54-g00ecf From 5b9204787f1c3f1c7199939fd1328ee35b75127e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 2 Dec 2009 11:14:19 +0100 Subject: input_id: code cleanup Now use libudev to clean up hardcoded /sys/ and /device/ paths, and to also support direct input device arguments. Now both "input4" and "event4" will work. --- Makefile.am | 3 ++- extras/input_id/input_id.c | 57 +++++++++++++++++++++++++++------------------- 2 files changed, 36 insertions(+), 24 deletions(-) diff --git a/Makefile.am b/Makefile.am index 994092775b..cd27f6f2d0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -237,9 +237,10 @@ extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/floppy/create_floppy_devices # ------------------------------------------------------------------------------ -# usb_id - USB device property import +# input_id - import input device class # ------------------------------------------------------------------------------ extras_input_id_input_id_SOURCES = extras/input_id/input_id.c +extras_input_id_input_id_LDADD = libudev/libudev.la libexec_PROGRAMS += extras/input_id/input_id # ------------------------------------------------------------------------------ diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 2e143a5628..3754cdefee 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -25,6 +25,8 @@ #include #include +#include "libudev.h" + /* we must use this kernel-compatible implementation */ #define BITS_PER_LONG (sizeof(unsigned long) * 8) #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) @@ -34,29 +36,21 @@ #define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) /* - * Read a capabilities/name file and return bitmask. - * @param path File to open + * Read a capability attribute and return bitmask. + * @param dev udev_device + * @param attr sysfs attribute name (e. g. "capabilities/key") * @param bitmask: Output array; must have max_size elements */ -static void get_cap_mask (const char *path, unsigned long *bitmask, size_t max_size) +static void get_cap_mask (struct udev_device *dev, const char* attr, + unsigned long *bitmask, size_t max_size) { - FILE* f; - int i; char text[4096]; + int i; char* word; unsigned long val; - f = fopen(path, "r"); - if (f == NULL) { - perror("opening caps file"); - exit(1); - } - if (fgets(text, sizeof(text), f) == NULL) { - perror("fgets"); - exit(1); - } - fclose(f); - + snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(dev, attr)); + memset (bitmask, 0, max_size); i = 0; while ((word = strrchr(text, ' ')) != NULL) { @@ -122,7 +116,10 @@ static void test_key (const unsigned long* bitmask_key) int main (int argc, char** argv) { - char capfile[PATH_MAX]; + struct udev *udev; + struct udev_device *dev; + + char devpath[PATH_MAX]; unsigned long bitmask_abs[NBITS(ABS_MAX)]; unsigned long bitmask_key[NBITS(KEY_MAX)]; unsigned long bitmask_rel[NBITS(REL_MAX)]; @@ -132,16 +129,30 @@ int main (int argc, char** argv) exit(1); } + /* get the device */ + udev = udev_new(); + if (udev == NULL) + return 1; + + snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[1]); + dev = udev_device_new_from_syspath(udev, devpath); + if (dev == NULL) { + fprintf(stderr, "unable to access '%s'\n", devpath); + return 1; + } + + /* walk up the parental chain until we find the real input device; the + * argument is very likely a subdevice of this, like eventN */ + while (udev_device_get_sysattr_value(dev, "capabilities/key") == NULL) + dev = udev_device_get_parent(dev); + /* Use this as a flag that input devices were detected, so that this * program doesn't need to be called more than once per device */ puts("ID_INPUT=1"); - snprintf(capfile, sizeof(capfile), "/sys/%s/device/capabilities/abs", argv[1]); - get_cap_mask (capfile, bitmask_abs, sizeof (bitmask_abs)); - snprintf(capfile, sizeof(capfile), "/sys/%s/device/capabilities/rel", argv[1]); - get_cap_mask (capfile, bitmask_rel, sizeof (bitmask_rel)); - snprintf(capfile, sizeof(capfile), "/sys/%s/device/capabilities/key", argv[1]); - get_cap_mask (capfile, bitmask_key, sizeof (bitmask_key)); + get_cap_mask (dev, "capabilities/abs", bitmask_abs, sizeof (bitmask_abs)); + get_cap_mask (dev, "capabilities/rel", bitmask_rel, sizeof (bitmask_rel)); + get_cap_mask (dev, "capabilities/key", bitmask_key, sizeof (bitmask_key)); test_pointers(bitmask_abs, bitmask_key, bitmask_rel); -- cgit v1.2.3-54-g00ecf From 17b94040531bf04df7fcb38190938dbc7c84a084 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Dec 2009 12:56:06 +0100 Subject: Revert "Fix out-of-tree builds" This reverts commit 326e15a8ed97a22f2fe52d203896763d75f93c2c. The issue in: http://git.kernel.org/?p=linux/hotplug/udev.git;a=commit;h=7fa9bb9dbf538bf3c8a25a6699f65a8ac9cc8bbf still exists. We need to find a reliable way not to break "make distcheck" here. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index cd27f6f2d0..31cb244893 100644 --- a/Makefile.am +++ b/Makefile.am @@ -389,7 +389,7 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil $(top_srcdir)/extras/gudev/gudev.h \ $(top_srcdir)/extras/gudev/gudevtypes.h \ $(top_srcdir)/extras/gudev/gudevenums.h \ - $(top_builddir)/extras/gudev/gudevenumtypes.h \ + $(top_srcdir)/extras/gudev/gudevenumtypes.h \ $(top_srcdir)/extras/gudev/gudevclient.h \ $(top_srcdir)/extras/gudev/gudevdevice.h \ $(top_srcdir)/extras/gudev/gudevclient.c \ -- cgit v1.2.3-54-g00ecf From 2ad6af0fc0c3e44da40274ecda1e707494b922e3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Dec 2009 12:58:47 +0100 Subject: release 148 --- ChangeLog | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/ChangeLog b/ChangeLog index da89f2a6ad..bccb162c6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ +Summary of changes from v147 to v148 +============================================ + +Dan Williams (3): + Revert "modem-modeswitch: add a device" + Revert "extras/modem-modeswitch: Add Huawei E1550 GSM modem" + modem-modeswitch: 61-option-modem-modeswitch.rules is only for Option NV devices + +Daniel Mierswa (1): + Fix typo in NEWS, ConsoleKit-0.4.11 -> 0.4.1 + +David Zeuthen (4): + cdrom_id: Still check profiles even if there is no media + scsi_id: Export WWN and Unit Serial Number + Create /dev/disk/by-id/wwn-0x... symlinks + Also create /dev/disk/by-id/wwn-0x..-part%n symlinks for partitions + +Dmitry Torokhov (1): + extras/input_id: Correctly identify touchpads + +Harald Hoyer (1): + modem-modeswitch: add a device + +Kay Sievers (8): + rules: set mode of floppy device nodes to 0660 + remove "ignore_device" + print warning for BUS=, SYSFS{}=, ID= + test-udev: remove "ignore_device" code + udev-test.pl: catch-up with recent changes + rules: remove support for IDE (hd*) devices + ata_id: skip ATA commands if we find an optical drive + Revert "Fix out-of-tree builds" + +Martin Pitt (5): + README.keymap.txt: small clarification + extras: Add input_id + 70-acl.rules: Use new-style input properties + input: Deprecate ENV{ID_CLASS} + input_id: code cleanup + +Scott James Remnant (1): + Fix out-of-tree builds + + Summary of changes from v146 to v147 ============================================ -- cgit v1.2.3-54-g00ecf From 22f9cb51c39a6fef1109bfd24e97d2fdda327a9e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 3 Dec 2009 10:16:49 +0100 Subject: input_id: Fix endless loop for non-input devices When being called on a device which is not in the "input" subsystem, or doesn't have an "input" parent, it got stuck in an endless loop. Unfortunately this includes the virtual/input/mice multiplexer, which exposes this bug on just about every system. --- extras/input_id/input_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 3754cdefee..fededa3f7d 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -143,7 +143,7 @@ int main (int argc, char** argv) /* walk up the parental chain until we find the real input device; the * argument is very likely a subdevice of this, like eventN */ - while (udev_device_get_sysattr_value(dev, "capabilities/key") == NULL) + while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/key") == NULL) dev = udev_device_get_parent(dev); /* Use this as a flag that input devices were detected, so that this -- cgit v1.2.3-54-g00ecf From b919e0ffee9356f34da1f94465e7235d30ceb154 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 3 Dec 2009 10:22:04 +0100 Subject: input_id: Do not tag non-input devices with ID_INPUT Current rules only call it for input devices, but let's be correct. --- extras/input_id/input_id.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index fededa3f7d..8024524681 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -146,6 +146,10 @@ int main (int argc, char** argv) while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/key") == NULL) dev = udev_device_get_parent(dev); + /* not an "input" class device */ + if (dev == NULL) + return 0; + /* Use this as a flag that input devices were detected, so that this * program doesn't need to be called more than once per device */ puts("ID_INPUT=1"); -- cgit v1.2.3-54-g00ecf From 175cb7b81d4e4d2c858bebacbf6b0ee62822afab Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 3 Dec 2009 12:46:22 +0100 Subject: input_id: small optimization In the parent traversal loop, use udev_device_get_parent_with_subsystem_devtype() to only grab "input" class devices. --- extras/input_id/input_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 8024524681..48097aa977 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -144,7 +144,7 @@ int main (int argc, char** argv) /* walk up the parental chain until we find the real input device; the * argument is very likely a subdevice of this, like eventN */ while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/key") == NULL) - dev = udev_device_get_parent(dev); + dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL); /* not an "input" class device */ if (dev == NULL) -- cgit v1.2.3-54-g00ecf From 7c3db771115570a951e7878062aee58119ab9046 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 3 Dec 2009 12:56:44 +0100 Subject: input_id: check event mask Check the capabilities/ev for the particular event class before testing bits in that event class. This avoids testing potentially bogus data if the device does not support that class of events at all. Thanks to Dmitry Torokhov for pointing out! --- extras/input_id/input_id.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 48097aa977..05bb085a03 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -64,12 +64,16 @@ static void get_cap_mask (struct udev_device *dev, const char* attr, } /* pointer devices */ -static void test_pointers (const unsigned long* bitmask_abs, const unsigned long* bitmask_key, const unsigned long* bitmask_rel) +static void test_pointers (const unsigned long* bitmask_ev, + const unsigned long* bitmask_abs, + const unsigned long* bitmask_key, + const unsigned long* bitmask_rel) { int is_mouse = 0; int is_touchpad = 0; - if (test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { + if (test_bit (EV_ABS, bitmask_ev) && test_bit (EV_KEY, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) puts("ID_INPUT_TABLET=1"); else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) @@ -84,7 +88,8 @@ static void test_pointers (const unsigned long* bitmask_abs, const unsigned long is_mouse = 1; } - if (test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel)) + if (test_bit (EV_REL, bitmask_ev) && + test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel)) is_mouse = 1; if (is_mouse) @@ -94,13 +99,17 @@ static void test_pointers (const unsigned long* bitmask_abs, const unsigned long } /* key like devices */ -static void test_key (const unsigned long* bitmask_key) +static void test_key (const unsigned long* bitmask_ev, + const unsigned long* bitmask_key) { unsigned i; unsigned long acc; unsigned long mask; /* do we have any KEY_* capability? */ + if (!test_bit (EV_KEY, bitmask_ev)) + return; + acc = 0; for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) acc |= bitmask_key[i]; @@ -120,6 +129,7 @@ int main (int argc, char** argv) struct udev_device *dev; char devpath[PATH_MAX]; + unsigned long bitmask_ev[NBITS(EV_MAX)]; unsigned long bitmask_abs[NBITS(ABS_MAX)]; unsigned long bitmask_key[NBITS(KEY_MAX)]; unsigned long bitmask_rel[NBITS(REL_MAX)]; @@ -143,7 +153,7 @@ int main (int argc, char** argv) /* walk up the parental chain until we find the real input device; the * argument is very likely a subdevice of this, like eventN */ - while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/key") == NULL) + while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/ev") == NULL) dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL); /* not an "input" class device */ @@ -154,13 +164,14 @@ int main (int argc, char** argv) * program doesn't need to be called more than once per device */ puts("ID_INPUT=1"); + get_cap_mask (dev, "capabilities/ev", bitmask_ev, sizeof (bitmask_ev)); get_cap_mask (dev, "capabilities/abs", bitmask_abs, sizeof (bitmask_abs)); get_cap_mask (dev, "capabilities/rel", bitmask_rel, sizeof (bitmask_rel)); get_cap_mask (dev, "capabilities/key", bitmask_key, sizeof (bitmask_key)); - test_pointers(bitmask_abs, bitmask_key, bitmask_rel); + test_pointers(bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel); - test_key(bitmask_key); + test_key(bitmask_ev, bitmask_key); return 0; } -- cgit v1.2.3-54-g00ecf From 01db50919ebdf1aa5a21ea839117f52938c33afe Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 3 Dec 2009 13:15:50 +0100 Subject: input_id: Check mouse button for ID_INPUT_MOUSE Before we bless an input device as a mouse, verify that it has a left button (BTN_MOUSE). Thanks to Dmitry Torokhov for pointing out! --- extras/input_id/input_id.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 05bb085a03..95f78795c0 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -72,7 +72,10 @@ static void test_pointers (const unsigned long* bitmask_ev, int is_mouse = 0; int is_touchpad = 0; - if (test_bit (EV_ABS, bitmask_ev) && test_bit (EV_KEY, bitmask_ev) && + if (!test_bit (EV_KEY, bitmask_ev)) + return; + + if (test_bit (EV_ABS, bitmask_ev) && test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) puts("ID_INPUT_TABLET=1"); @@ -89,7 +92,8 @@ static void test_pointers (const unsigned long* bitmask_ev, } if (test_bit (EV_REL, bitmask_ev) && - test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel)) + test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && + test_bit (BTN_MOUSE, bitmask_key)) is_mouse = 1; if (is_mouse) -- cgit v1.2.3-54-g00ecf From 89b62373422097a8eb6c1540bd41a572ed573fe6 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 3 Dec 2009 13:20:10 +0100 Subject: input-id: identify touchscreens Add detection of touchscreens to the input-id utility. Signed-off-by: Martin Pitt --- extras/input_id/input_id.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 95f78795c0..21ee6b3cd3 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -89,6 +89,8 @@ static void test_pointers (const unsigned long* bitmask_ev, /* This path is taken by VMware's USB mouse, which has * absolute axes, but no touch/pressure button. */ is_mouse = 1; + else if (test_bit (BTN_TOUCH, bitmask_key)) + puts("ID_INPUT_TOUCHSCREEN=1"); } if (test_bit (EV_REL, bitmask_ev) && -- cgit v1.2.3-54-g00ecf From 54d4f54e852cfe91246b8519e8daf48c52a3afa0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 3 Dec 2009 13:25:19 +0100 Subject: udev_device_get_parent_with_subsystem_devtype(): Clarify documentation devtype can be NULL, in which case it is ignored for matching. --- libudev/libudev-device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 5d1ad9f223..4717b582b3 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -577,6 +577,9 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) * value, and fill in information from the sys device and the udev * database entry. * + * If devtype is NULL, only subsystem is checked, and any devtype will + * match. + * * The returned the device is not referenced. It is attached to the * child device, and will be cleaned up when the child device * is cleaned up. -- cgit v1.2.3-54-g00ecf From 79ef2e97d96ca0dbb9a06fa410f126ccfe638841 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 Dec 2009 13:31:27 +0100 Subject: libudev: doc - use #NULL --- libudev/libudev-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 4717b582b3..add1c99ec0 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -577,7 +577,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) * value, and fill in information from the sys device and the udev * database entry. * - * If devtype is NULL, only subsystem is checked, and any devtype will + * If devtype is #NULL, only subsystem is checked, and any devtype will * match. * * The returned the device is not referenced. It is attached to the -- cgit v1.2.3-54-g00ecf From 4cf3298e1fc7678fe1a5022ed8ba66b775d7334f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 Dec 2009 13:31:43 +0100 Subject: configure.ac: version bump --- NEWS | 5 +++++ configure.ac | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index cd54a12466..e5dfd10d48 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +udev 149 +======== +Fix for a possible endless loop in the new input_id program. + + udev 148 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 12271f1461..29e19f09ab 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [148], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [149], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From a4035cce3632b95650fd89f581756bbea4628a7e Mon Sep 17 00:00:00 2001 From: Daniel Elstner Date: Wed, 2 Dec 2009 22:39:50 +0200 Subject: really fix both in-tree and out-of-tree builds Makefile.am (extras/gudev/GUdev-1.0.gir): Look for gudevenumtypes.h in both the build directory and the source directory, so that it works in either case. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 31cb244893..4dfab563ca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -389,7 +389,7 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil $(top_srcdir)/extras/gudev/gudev.h \ $(top_srcdir)/extras/gudev/gudevtypes.h \ $(top_srcdir)/extras/gudev/gudevenums.h \ - $(top_srcdir)/extras/gudev/gudevenumtypes.h \ + $(or $(wildcard extras/gudev/gudevenumtypes.h),$(top_srcdir)/extras/gudev/gudevenumtypes.h) \ $(top_srcdir)/extras/gudev/gudevclient.h \ $(top_srcdir)/extras/gudev/gudevdevice.h \ $(top_srcdir)/extras/gudev/gudevclient.c \ -- cgit v1.2.3-54-g00ecf From 83d288085fe1203a0bbfd2bd4d2486eb38699f7f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 Dec 2009 13:58:18 +0100 Subject: really really fix both in-tree and out-of-tree builds The include is still missing: GEN extras/gudev/GUdev-1.0.gir In file included from :4: /home/kay/work/src/udev/extras/gudev/gudev.h:26:34: error: gudev/gudevenumtypes.h: No such file or directory Also prepend $(builddir). --- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 4dfab563ca..83ecb74519 100644 --- a/Makefile.am +++ b/Makefile.am @@ -384,12 +384,13 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil --pkg=glib-2.0 \ --pkg=gobject-2.0 \ -I$(top_srcdir)/extras \ + -I$(top_builddir)/extras \ -D_GUDEV_COMPILATION \ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ $(top_srcdir)/extras/gudev/gudev.h \ $(top_srcdir)/extras/gudev/gudevtypes.h \ $(top_srcdir)/extras/gudev/gudevenums.h \ - $(or $(wildcard extras/gudev/gudevenumtypes.h),$(top_srcdir)/extras/gudev/gudevenumtypes.h) \ + $(or $(wildcard $(top_srcdir)/extras/gudev/gudevenumtypes.h),$(top_builddir)/extras/gudev/gudevenumtypes.h) \ $(top_srcdir)/extras/gudev/gudevclient.h \ $(top_srcdir)/extras/gudev/gudevdevice.h \ $(top_srcdir)/extras/gudev/gudevclient.c \ -- cgit v1.2.3-54-g00ecf From baf2e222d5c06cb3c4ee7d625e531119d3a999ba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 Dec 2009 14:36:36 +0100 Subject: fix both in-tree and out-of-tree builds On Thu, Dec 3, 2009 at 14:31, Daniel Elstner wrote: > However, I'd recommend to look first in the build directory, and then in > the source directory to match the behavior of make with VPATH builds. > The idea is that a file in the build tree, if it exists, overrides a > file of the same name in the source tree. --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 83ecb74519..3e9713fc91 100644 --- a/Makefile.am +++ b/Makefile.am @@ -383,14 +383,14 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil --output $@ \ --pkg=glib-2.0 \ --pkg=gobject-2.0 \ - -I$(top_srcdir)/extras \ -I$(top_builddir)/extras \ + -I$(top_srcdir)/extras \ -D_GUDEV_COMPILATION \ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ $(top_srcdir)/extras/gudev/gudev.h \ $(top_srcdir)/extras/gudev/gudevtypes.h \ $(top_srcdir)/extras/gudev/gudevenums.h \ - $(or $(wildcard $(top_srcdir)/extras/gudev/gudevenumtypes.h),$(top_builddir)/extras/gudev/gudevenumtypes.h) \ + $(or $(wildcard $(top_builddir)/extras/gudev/gudevenumtypes.h),$(top_srcdir)/extras/gudev/gudevenumtypes.h) \ $(top_srcdir)/extras/gudev/gudevclient.h \ $(top_srcdir)/extras/gudev/gudevdevice.h \ $(top_srcdir)/extras/gudev/gudevclient.c \ -- cgit v1.2.3-54-g00ecf From 07fb7fce66a101b22c3e121e3ee99438db798b8e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 3 Dec 2009 14:39:12 +0100 Subject: release 149 --- ChangeLog | 24 ++++++++++++++++++++++++ NEWS | 1 - 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index bccb162c6d..ac03a3d29a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +Summary of changes from v148 to v149 +============================================ + +Daniel Elstner (1): + really fix both in-tree and out-of-tree builds + +Dmitry Torokhov (1): + input-id: identify touchscreens + +Kay Sievers (4): + libudev: doc - use #NULL + configure.ac: version bump + really really fix both in-tree and out-of-tree builds + fix both in-tree and out-of-tree builds + +Martin Pitt (6): + input_id: Fix endless loop for non-input devices + input_id: Do not tag non-input devices with ID_INPUT + input_id: small optimization + input_id: check event mask + input_id: Check mouse button for ID_INPUT_MOUSE + udev_device_get_parent_with_subsystem_devtype(): Clarify documentation + + Summary of changes from v147 to v148 ============================================ diff --git a/NEWS b/NEWS index e5dfd10d48..df75359663 100644 --- a/NEWS +++ b/NEWS @@ -2,7 +2,6 @@ udev 149 ======== Fix for a possible endless loop in the new input_id program. - udev 148 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 7f4954d04026f28b0ebe65a514f06fefad8efaca Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Fri, 4 Dec 2009 11:25:09 -0500 Subject: Export ID_WWN_VENDOR_EXTENSION and ID_WWN_WITH_EXTENSION Some SCSI devices use the same WWN and have a WWN extension that we need to take into account when creating the /dev/disk/by-id/wwn symlinks. Thus, introduce ID_WWN_WITH_EXTENSION. This property will contain either the WWN (if no extension is present) or the WWN with the vendor extension appended. Example: # /lib/udev/ata_id/ata_id --export /dev/sda |grep WWN ID_WWN=0x5001517387d61905 ID_WWN_WITH_EXTENSION=0x5001517387d61905 # /lib/udev/scsi_id --whitelisted --export -d /dev/sdb |grep WWN ID_WWN=0x600508b400105df7 ID_WWN_VENDOR_EXTENSION=0x0000e00000d80000 ID_WWN_WITH_EXTENSION=0x600508b400105df70000e00000d80000 # /lib/udev/scsi_id --whitelisted --export -d /dev/sdc |grep WWN ID_WWN=0x600508b400105df7 ID_WWN_VENDOR_EXTENSION=0x0000e00000db0000 ID_WWN_WITH_EXTENSION=0x600508b400105df70000e00000db0000 Signed-off-by: David Zeuthen --- extras/ata_id/ata_id.c | 5 ++++- extras/scsi_id/scsi_id.c | 9 ++++++++- extras/scsi_id/scsi_id.h | 6 +++++- extras/scsi_id/scsi_serial.c | 21 ++++++++++++++------- rules/rules.d/60-persistent-storage.rules | 4 ++-- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index cbd3b5b8d2..25c7710127 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -1,4 +1,5 @@ -/* +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * * ata_id - reads product/serial number from ATA drives * * Copyright (C) 2005-2008 Kay Sievers @@ -520,6 +521,8 @@ int main(int argc, char *argv[]) wwwn <<= 16; wwwn |= *((uint16_t *) identify + 111); printf("ID_WWN=0x%llx\n", (unsigned long long int) wwwn); + /* ATA devices have no vendor extension */ + printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn); } } else { if (serial[0] != '\0') diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 9c5b2c3a3c..5c40658556 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -1,4 +1,5 @@ -/* +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * * scsi_id.c * * Main section of the scsi_id program @@ -566,6 +567,12 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) } if (dev_scsi.wwn[0] != '\0') { printf("ID_WWN=0x%s\n", dev_scsi.wwn); + if (dev_scsi.wwn_vendor_extension[0] != '\0') { + printf("ID_WWN_VENDOR_EXTENSION=0x%s\n", dev_scsi.wwn_vendor_extension); + printf("ID_WWN_WITH_EXTENSION=0x%s%s\n", dev_scsi.wwn, dev_scsi.wwn_vendor_extension); + } else { + printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn); + } } if (dev_scsi.unit_serial_number[0] != '\0') { printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 4536cfd4f2..3b8b236368 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -1,4 +1,5 @@ -/* +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * * scsi_id.h * * General defines and such for scsi_id @@ -45,6 +46,9 @@ struct scsi_id_device { /* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */ char wwn[17]; + + /* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */ + char wwn_vendor_extension[17]; }; extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 5b18b225a5..0c9d9c3095 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -1,4 +1,5 @@ -/* +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * * scsi_serial.c * * Code related to requesting and getting an id from a scsi device @@ -482,7 +483,8 @@ static int check_fill_0x83_id(struct udev *udev, unsigned char *page_83, const struct scsi_id_search_values *id_search, char *serial, char *serial_short, int max_len, - char *wwn) + char *wwn, + char *wwn_vendor_extension) { int i, j, s, len; @@ -569,6 +571,9 @@ static int check_fill_0x83_id(struct udev *udev, if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { strncpy(wwn, &serial[s], 16); + if (wwn_vendor_extension != NULL) { + strncpy(wwn_vendor_extension, &serial[s + 16], 16); + } } return 0; } @@ -601,7 +606,8 @@ static int check_fill_0x83_prespc3(struct udev *udev, static int do_scsi_page83_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int len, - char *unit_serial_number, char *wwn) + char *unit_serial_number, char *wwn, + char *wwn_vendor_extension) { int retval; unsigned int id_ind, j; @@ -671,7 +677,8 @@ static int do_scsi_page83_inquiry(struct udev *udev, dev_scsi, &page_83[j], &id_search_list[id_ind], serial, serial_short, len, - wwn); + wwn, + wwn_vendor_extension); dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, id_search_list[id_ind].id_type, id_search_list[id_ind].naa_type, @@ -885,7 +892,7 @@ int scsi_get_serial(struct udev *udev, goto completed; } } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension)) { retval = 1; goto completed; } else { @@ -901,7 +908,7 @@ int scsi_get_serial(struct udev *udev, * conform to pre-SPC3 expectations. */ if (retval == 2) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension)) { retval = 1; goto completed; } else { @@ -941,7 +948,7 @@ int scsi_get_serial(struct udev *udev, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn)) { + dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension)) { /* * Success */ diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index c839f3bc06..89041a950b 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -67,7 +67,7 @@ ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+ ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" # by-id (World Wide Name) -ENV{DEVTYPE}=="disk", ENV{ID_WWN}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN}" -ENV{DEVTYPE}=="partition", ENV{ID_WWN}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN}-part%n" +ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" +ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From 99eb7c451c912a460db4276ed253ffd0da5dcc4a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 8 Dec 2009 18:44:45 +0100 Subject: util_unlink_secure(): chmod() before chown() --- libudev/libudev-util-private.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 5b3e337643..c05c157575 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -114,8 +114,8 @@ int util_unlink_secure(struct udev *udev, const char *filename) { int err; - chmod(filename, 0000); chown(filename, 0, 0); + chmod(filename, 0000); err = unlink(filename); if (errno == ENOENT) err = 0; -- cgit v1.2.3-54-g00ecf From d0a161ce6416d925ab66251295e93ffb867ee835 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 10 Dec 2009 09:22:33 +0100 Subject: keymap: Add Acer Aspire 1810T https://launchpad.net/bugs/492657 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 0fdb061eb0..3af0770fa6 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -71,7 +71,7 @@ ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dm ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|Aspire 1810T", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" -- cgit v1.2.3-54-g00ecf From 4fe41ac874afab5d152aff151cba896817a2ab1f Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Thu, 10 Dec 2009 20:01:05 +0000 Subject: 70-acl.rules: ACL manage Android G1 dev phones There doesn't seem to be any special class for their developer interface, so match by Vendor and Device id like we do for things like fingerprint readers. This is better than their current 0666 suggestion Signed-off-by: Scott James Remnant --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 278b9aae7c..f135bff75c 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -48,6 +48,9 @@ ENV{ID_SMARTCARD_READER}=="*?", ENV{ACL_MANAGE}="1" # joysticks SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ACL_MANAGE}="1" +# smart phones +SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", ENV{ACL_MANAGE}="1" + # apply ACL for all locally logged in users LABEL="acl_apply", ENV{ACL_MANAGE}=="?*", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" -- cgit v1.2.3-54-g00ecf From 666faec4e474038226e13483c62aa6ad8ab660a6 Mon Sep 17 00:00:00 2001 From: Johannes Stezenbach Date: Mon, 14 Dec 2009 01:14:03 +0100 Subject: keymap: add Samsung N130 Signed-off-by: Johannes Stezenbach Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 3af0770fa6..7cbf9aa38f 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -95,7 +95,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N130*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" -- cgit v1.2.3-54-g00ecf From 92b8cea053c41315b57439400de9821928445fb3 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 14 Dec 2009 14:31:51 +0100 Subject: 95-keymap.rules: Run on change events, too --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 7cbf9aa38f..ad281cbcd8 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -5,7 +5,7 @@ # a file name (in /lib/udev/keymaps), which has to contain scancode/keyname # pairs. -ACTION!="add", GOTO="keyboard_end" +ACTION!="add|change", GOTO="keyboard_end" SUBSYSTEM!="input", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" -- cgit v1.2.3-54-g00ecf From 8350d0b9ec1f1b47e84549cb1cdd68127ed0e89b Mon Sep 17 00:00:00 2001 From: Johannes Stezenbach Date: Sun, 13 Dec 2009 23:54:05 +0100 Subject: keymap: handle atkbd force_release quirk Some laptop keyboards don't generate release events for some hotkeys. Since linux-2.6.32 the list of scancodes for which to enable the force_release quirk can be set via sysfs. Apply this to Samsung N130. Signed-off-by: Johannes Stezenbach Signed-off-by: Martin Pitt --- Makefile.am | 6 ++++++ extras/keymap/95-keyboard-force-release.rules | 24 +++++++++++++++++++++++ extras/keymap/keyboard-force-release.sh | 22 +++++++++++++++++++++ extras/keymap/keymaps/force-release/samsung-other | 10 ++++++++++ 4 files changed, 62 insertions(+) create mode 100644 extras/keymap/95-keyboard-force-release.rules create mode 100644 extras/keymap/keyboard-force-release.sh create mode 100644 extras/keymap/keymaps/force-release/samsung-other diff --git a/Makefile.am b/Makefile.am index 3e9713fc91..4435398e72 100644 --- a/Makefile.am +++ b/Makefile.am @@ -480,8 +480,10 @@ BUILT_SOURCES += $(nodist_extras_keymap_keymap_SOURCES) EXTRA_DIST += extras/keymap/check-keymaps.sh dist_udevrules_DATA += extras/keymap/95-keymap.rules +dist_udevrules_DATA += extras/keymap/95-keyboard-force-release.rules libexec_PROGRAMS += extras/keymap/keymap dist_libexec_SCRIPTS += extras/keymap/findkeyboards +dist_libexec_SCRIPTS += extras/keymap/keyboard-force-release.sh dist_doc_DATA = extras/keymap/README.keymap.txt CLEANFILES += \ @@ -535,6 +537,10 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/toshiba-satellite_a110 \ extras/keymap/keymaps/zepto-znote +udevkeymapforcereldir = $(libexecdir)/keymaps/force-release +dist_udevkeymapforcerel_DATA = \ + extras/keymap/keymaps/force-release/samsung-other + extras/keymap/keys.txt: /usr/include/linux/input.h $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules new file mode 100644 index 0000000000..4d0a877044 --- /dev/null +++ b/extras/keymap/95-keyboard-force-release.rules @@ -0,0 +1,24 @@ +# Set model specific atkbd force_release quirk +# +# Several laptops have hotkeys which don't generate release events, +# which can cause problems with software key repeat. +# The atkbd driver has a quirk handler for generating synthetic +# release events, which can be configured via sysfs since 2.6.32. +# Simply add a file with a list of scancodes for your laptop model +# in /lib/udev/keymaps, and add a rule here. +# If the hotkeys also need a keymap assignment you can copy the +# scancodes from the keymap file, otherwise you can run +# /lib/udev/keymap -i /dev/input/eventX +# on a Linux vt to find out. + +ACTION!="add|change", GOTO="force_release_end" +SUBSYSTEM!="serio", GOTO="force_release_end" +KERNEL!="serio*", GOTO="force_release_end" +DRIVER!="atkbd", GOTO="force_release_end" + +ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" + + +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*", RUN+="keyboard-force-release.sh $devpath samsung-other" + +LABEL="force_release_end" diff --git a/extras/keymap/keyboard-force-release.sh b/extras/keymap/keyboard-force-release.sh new file mode 100644 index 0000000000..b157ac310d --- /dev/null +++ b/extras/keymap/keyboard-force-release.sh @@ -0,0 +1,22 @@ +#!/bin/sh -e +# read list of scancodes, convert hex to decimal and +# append to the atkbd force_release sysfs attribute +# $1 sysfs devpath for serioX +# $2 file with scancode list (hex or dec) + +case "$2" in + /*) scf="$2" ;; + *) scf="/lib/udev/keymaps/force-release/$2" ;; +esac + +read attr <"/sys/$1/force_release" +while read scancode dummy; do + case "$scancode" in + \#*) ;; + *) + scancode=$(($scancode)) + attr="$attr${attr:+,}$scancode" + ;; + esac +done <"$scf" +echo "$attr" >"/sys/$1/force_release" diff --git a/extras/keymap/keymaps/force-release/samsung-other b/extras/keymap/keymaps/force-release/samsung-other new file mode 100644 index 0000000000..c51123a0b6 --- /dev/null +++ b/extras/keymap/keymaps/force-release/samsung-other @@ -0,0 +1,10 @@ +# list of scancodes (hex or decimal), optional comment +0x82 # Fn+F4 CRT/LCD +0x83 # Fn+F2 battery +0x84 # Fn+F5 backlight on/off +0x86 # Fn+F9 WLAN +0x88 # Fn-Up brightness up +0x89 # Fn-Down brightness down +0xB3 # Fn+F8 switch power mode (battery/dynamic/performance) +0xF7 # Fn+F10 Touchpad on +0xF9 # Fn+F10 Touchpad off -- cgit v1.2.3-54-g00ecf From 9c0c2fe6bb6c3e73d54c65149657dcfdba9b20b0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 15 Dec 2009 11:49:12 +0100 Subject: keymap: fix findkeyboards Update findkeyboards for the recent ID_CLASS deprecation, use ID_INPUT_KEYBOARD instead. This simplifies the logic a bit, too. --- extras/keymap/findkeyboards | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards index 4fafc7775d..acff534056 100755 --- a/extras/keymap/findkeyboards +++ b/extras/keymap/findkeyboards @@ -17,21 +17,18 @@ # print a list of input devices which are keyboard-like keyboard_devices() { - input_devs=`udevadm trigger --dry-run --verbose --subsystem-match=input --attr-match=dev` - # standard AT keyboard - for dev in $input_devs; do + for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do walk=`udevadm info --attribute-walk --path=$dev` - env=`udevadm info --query=env --path=$dev` - + env=`udevadm info --query=env --path=$dev` if echo "$walk" | grep -q 'DRIVERS=="atkbd"'; then echo -n 'AT keyboard: ' - udevadm info --query=name --path=$dev - fi - if echo "$env"| grep -q '^ID_CLASS=kbd' && echo "$env" | grep -q '^ID_USB_DRIVER=usbhid'; then + elif echo "$env" | grep -q '^ID_USB_DRIVER=usbhid'; then echo -n 'USB keyboard: ' - udevadm info --query=name --path=$dev + else + echo -n 'Unknown type: ' fi + udevadm info --query=name --path=$dev done # modules -- cgit v1.2.3-54-g00ecf From 3fac12b9a05f1849f7b1373060ade18269839856 Mon Sep 17 00:00:00 2001 From: Daniel Elstner Date: Mon, 14 Dec 2009 21:15:20 +0100 Subject: libudev: wrap in extern "C" block for C++ When libudev.h is included from C++ code, wrap the declarations in an extern "C" { ... } block. This tells the C++ compiler that symbols are exported with C linkage and no name-mangling. --- libudev/libudev.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libudev/libudev.h b/libudev/libudev.h index 4bcf442f51..ad11059f2c 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -16,6 +16,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + /* * udev - library context * @@ -158,4 +162,9 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end); struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif -- cgit v1.2.3-54-g00ecf From 78171d9549fafdfc1e29d30915104a3ad55e116b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Dec 2009 15:07:25 +0100 Subject: floppy: fix rule to create additional floppy device nodes --- Makefile.am | 1 + extras/floppy/60-floppy.rules | 4 ++++ rules/rules.d/50-udev-default.rules | 1 - 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 extras/floppy/60-floppy.rules diff --git a/Makefile.am b/Makefile.am index 4435398e72..62fe5a0f07 100644 --- a/Makefile.am +++ b/Makefile.am @@ -235,6 +235,7 @@ dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/floppy/create_floppy_devices +dist_udevrules_DATA += extras/floppy/60-floppy.rules # ------------------------------------------------------------------------------ # input_id - import input device class diff --git a/extras/floppy/60-floppy.rules b/extras/floppy/60-floppy.rules new file mode 100644 index 0000000000..3123bb55fd --- /dev/null +++ b/extras/floppy/60-floppy.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="block", KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", ENV{CMOS_TYPE}="$attr{cmos}", \ + RUN+="create_floppy_devices -c -t $env{CMOS_TYPE} -m %M -M 0640 -G floppy $root/%k" diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 00c73dfe86..f01fc03736 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -74,7 +74,6 @@ SUBSYSTEM=="block", GROUP="disk" # floppy KERNEL=="fd[0-9]", GROUP="floppy" -KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", RUN+="create_floppy_devices -c -t $attr{cmos} -m %M -M 0660 -G floppy $root/%k" # cdrom SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" -- cgit v1.2.3-54-g00ecf From ac9b4baac52d8713512629272384124fa1d01b23 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Dec 2009 15:53:21 +0100 Subject: configure.ac: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index df75359663..1b7377efb8 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 150 +======== +Bugfixes. + udev 149 ======== Fix for a possible endless loop in the new input_id program. diff --git a/configure.ac b/configure.ac index 29e19f09ab..836c30d5e3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [149], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [150], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 3c1898863fbf9c94cfb0258ae380b67b44c4b466 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Dec 2009 16:14:14 +0100 Subject: remove remaining support for CONFIG_SYSFS_DEPRECATED --- Makefile.am | 2 +- NEWS | 5 +++++ TODO | 1 - libudev/libudev-device.c | 13 +------------ libudev/libudev-enumerate.c | 12 ------------ udev/udevd.c | 34 ++++++---------------------------- 6 files changed, 13 insertions(+), 54 deletions(-) diff --git a/Makefile.am b/Makefile.am index 62fe5a0f07..993d70075d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ CLEANFILES = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=5 -LIBUDEV_REVISION=1 +LIBUDEV_REVISION=2 LIBUDEV_AGE=5 SUBDIRS += libudev/docs diff --git a/NEWS b/NEWS index 1b7377efb8..9977eaa6d2 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ udev 150 ======== Bugfixes. +Kernels with SYSFS_DEPRECATED=y are not supported since a while. Many users +depend on the current sysfs layout and the information not available in the +deprecated layout. All remaining support for the deprecated sysfs layout is +removed now. + udev 149 ======== Fix for a possible endless loop in the new input_id program. diff --git a/TODO b/TODO index bc94f1b0ee..1fc80e1a4a 100644 --- a/TODO +++ b/TODO @@ -3,5 +3,4 @@ o get rid of "scan all devices to find myself" libusb interface if it can not be fixed, drop libusb entirely and add a simple wrapper around the Linux usb ioctls we need - o drop all support for the DEPRECATED sysfs layout o remove deprecated BUS=, SYSFS{}=, ID= keys diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index add1c99ec0..dffeed0b79 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -508,20 +508,9 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic char path[UTIL_PATH_SIZE]; const char *subdir; - /* follow "device" link in deprecated sys layout */ - if (strncmp(udev_device->devpath, "/class/", 7) == 0 || - strncmp(udev_device->devpath, "/block/", 7) == 0) { - util_strscpyl(path, sizeof(path), udev_device->syspath, "/device", NULL); - if (util_resolve_sys_link(udev_device->udev, path, sizeof(path)) == 0) { - udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); - if (udev_device_parent != NULL) - return udev_device_parent; - } - } - util_strscpy(path, sizeof(path), udev_device->syspath); subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; - while (1) { + for (;;) { char *pos; pos = strrchr(subdir, '/'); diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 186abb927e..2fcd348296 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -685,18 +685,6 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) scan_dir(udev_enumerate, "bus", "devices", NULL); dbg(udev, "searching '/class/*' dir\n"); scan_dir(udev_enumerate, "class", NULL, NULL); - /* if block isn't a class, scan /block/ */ - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/class/block", NULL); - if (stat(base, &statbuf) != 0) { - if (match_subsystem(udev_enumerate, "block")) { - dbg(udev, "searching '/block/*' dir\n"); - /* scan disks */ - scan_dir_and_add_devices(udev_enumerate, "block", NULL, NULL); - /* scan partitions */ - dbg(udev, "searching '/block/*/*' dir\n"); - scan_dir(udev_enumerate, "block", NULL, "block"); - } - } } return 0; } diff --git a/udev/udevd.c b/udev/udevd.c index 300d603519..99647c683c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -764,37 +764,11 @@ static void handle_signal(struct udev *udev, int signo) } } -static void startup_log(struct udev *udev) -{ - FILE *f; - char path[UTIL_PATH_SIZE]; - struct stat statbuf; - - f = fopen("/dev/kmsg", "w"); - if (f != NULL) - fprintf(f, "<6>udev: starting version " VERSION "\n"); - - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/class/mem/null", NULL); - if (lstat(path, &statbuf) == 0 && S_ISDIR(statbuf.st_mode)) { - const char *depr_str = - "udev: missing sysfs features; please update the kernel " - "or disable the kernel's CONFIG_SYSFS_DEPRECATED option; " - "udev may fail to work correctly"; - - if (f != NULL) - fprintf(f, "<3>%s\n", depr_str); - err(udev, "%s\n", depr_str); - sleep(15); - } - - if (f != NULL) - fclose(f); -} - int main(int argc, char *argv[]) { struct udev *udev; int fd; + FILE *f; sigset_t mask; const char *value; int daemonize = false; @@ -988,7 +962,11 @@ int main(int argc, char *argv[]) } } - startup_log(udev); + f = fopen("/dev/kmsg", "w"); + if (f != NULL) { + fprintf(f, "<6>udev: starting version " VERSION "\n"); + fclose(f); + } /* redirect std{out,err} */ if (!debug && !debug_trace) { -- cgit v1.2.3-54-g00ecf From 63480d01aa61ac833517a48aea83dd8b12ccc828 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Dec 2009 16:15:33 +0100 Subject: cdrom_id: remove deprecated device matches --- extras/cdrom_id/60-cdrom_id.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index a3e8e3c766..132a68049d 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -2,4 +2,4 @@ # import optical drive properties ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \ - KERNEL=="sr[0-9]*|hd[a-z]|pcd[0-9]|xvd*", IMPORT{program}="cdrom_id --export $tempnode" + KERNEL=="sr[0-9]*|xvd*", IMPORT{program}="cdrom_id --export $tempnode" -- cgit v1.2.3-54-g00ecf From caf87866a764f3078d8de4ca8dc97385505c910b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Dec 2009 16:17:12 +0100 Subject: rules: add "block" match to floppy rule --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index f01fc03736..374db500e6 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -73,7 +73,7 @@ SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}==":0701*:", SUBSYSTEM=="block", GROUP="disk" # floppy -KERNEL=="fd[0-9]", GROUP="floppy" +SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy" # cdrom SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" -- cgit v1.2.3-54-g00ecf From 6fb1b637d4fc9e94d0c492d8a3049f30db88dd54 Mon Sep 17 00:00:00 2001 From: Piter PUNK Date: Tue, 15 Dec 2009 16:28:52 +0100 Subject: firmware: convert shell script to C --- Makefile.am | 18 ++-- TODO | 1 - extras/firmware/.gitignore | 1 + extras/firmware/50-firmware.rules | 2 +- extras/firmware/firmware.c | 195 ++++++++++++++++++++++++++++++++++++++ extras/firmware/firmware.sh | 29 ------ 6 files changed, 207 insertions(+), 39 deletions(-) create mode 100644 extras/firmware/.gitignore create mode 100644 extras/firmware/firmware.c delete mode 100755 extras/firmware/firmware.sh diff --git a/Makefile.am b/Makefile.am index 993d70075d..126064b631 100644 --- a/Makefile.am +++ b/Makefile.am @@ -179,16 +179,10 @@ udev_test_udev_SOURCES = \ udev/test-udev.c udev_test_udev_LDADD = libudev/libudev-private.la -# ------------------------------------------------------------------------------ -# firmware.sh - firmware loading -# ------------------------------------------------------------------------------ -dist_libexec_SCRIPTS = extras/firmware/firmware.sh -dist_udevrules_DATA += extras/firmware/50-firmware.rules - # ------------------------------------------------------------------------------ # rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ -dist_libexec_SCRIPTS += \ +dist_libexec_SCRIPTS = \ extras/rule_generator/write_cd_rules \ extras/rule_generator/write_net_rules @@ -199,12 +193,20 @@ dist_udevrules_DATA += \ extras/rule_generator/75-cd-aliases-generator.rules \ extras/rule_generator/75-persistent-net-generator.rules +# ------------------------------------------------------------------------------ +# firmware - firmware loading +# ------------------------------------------------------------------------------ +extras_firmware_firmware_SOURCES = extras/firmware/firmware.c +extras_firmware_firmware_LDADD = libudev/libudev-private.la +dist_udevrules_DATA += extras/firmware/50-firmware.rules +libexec_PROGRAMS = extras/firmware/firmware + # ------------------------------------------------------------------------------ # ata_id - ATA identify # ------------------------------------------------------------------------------ extras_ata_id_ata_id_SOURCES = extras/ata_id/ata_id.c extras_ata_id_ata_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS = extras/ata_id/ata_id +libexec_PROGRAMS += extras/ata_id/ata_id # ------------------------------------------------------------------------------ # cdrom_id - optical drive/media capability diff --git a/TODO b/TODO index 1fc80e1a4a..029b70e1b7 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,4 @@ - o convert firmware.sh to C o get rid of "scan all devices to find myself" libusb interface if it can not be fixed, drop libusb entirely and add a simple wrapper around the Linux usb ioctls we need diff --git a/extras/firmware/.gitignore b/extras/firmware/.gitignore new file mode 100644 index 0000000000..2b8800bd46 --- /dev/null +++ b/extras/firmware/.gitignore @@ -0,0 +1 @@ +firmware diff --git a/extras/firmware/50-firmware.rules b/extras/firmware/50-firmware.rules index a28e2a875d..a193adbced 100644 --- a/extras/firmware/50-firmware.rules +++ b/extras/firmware/50-firmware.rules @@ -1,4 +1,4 @@ # do not edit this file, it will be overwritten on update # firmware-class requests, copies files into the kernel -SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware.sh" +SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware --firmware=$env{FIRMWARE} --devpath=$env{DEVPATH}" diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c new file mode 100644 index 0000000000..8f70be42ac --- /dev/null +++ b/extras/firmware/firmware.c @@ -0,0 +1,195 @@ +/* + * firmware - Load firmware device + * + * Copyright (C) 2009 Piter Punk + * Copyright (C) 2009 Kay Sievers + * + * 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; either version 2 of the + * License, or (at your option) any later version. + * + * 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:* + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "libudev-private.h" + +static bool set_loading(struct udev *udev, char *loadpath, const char *state) +{ + FILE *ldfile; + + ldfile = fopen(loadpath, "w"); + if (ldfile == NULL) { + err(udev, "error: can not open '%s'\n", loadpath); + return false; + }; + fprintf(ldfile, "%s\n", state); + fclose(ldfile); + return true; +} + +static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) +{ + char *buf; + FILE *fsource, *ftarget; + bool ret = false; + + buf = malloc(size); + if (buf == NULL) { + err(udev,"No memory available to load firmware file"); + return false; + } + + fsource = fopen(source, "r"); + if (fsource == NULL) + goto exit; + ftarget = fopen(target, "w"); + if (ftarget == NULL) + goto exit; + if (fread(buf, size, 1, fsource) != 1) + goto exit; + if (fwrite(buf, size, 1, ftarget) == 1) + ret = true; +exit: + fclose(ftarget); + fclose(fsource); + free(buf); + return ret; +} + +int main(int argc, char **argv) +{ + static const struct option options[] = { + { "firmware", required_argument, NULL, 'f' }, + { "devpath", required_argument, NULL, 'p' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + static const char *searchpath[] = { + "/lib/firmware/updates/", + "/lib/firmware/" + }; + char fwencpath[UTIL_PATH_SIZE]; + char misspath[UTIL_PATH_SIZE]; + char loadpath[UTIL_PATH_SIZE]; + char datapath[UTIL_PATH_SIZE]; + char fwpath[UTIL_PATH_SIZE]; + char *devpath = NULL; + char *firmware = NULL; + FILE *fwfile; + struct utsname kernel; + struct stat statbuf; + struct udev *udev = NULL; + unsigned int i; + int rc = 0; + + udev_log_init("firmware"); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "f:p:h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'f': + firmware = optarg; + break; + case 'p': + devpath = optarg; + break; + case 'h': + printf("Usage: firmware --firmware= --devpath= [--help]\n\n"); + default: + rc = 1; + goto exit; + } + } + + if (devpath == NULL || firmware == NULL) { + fprintf(stderr, "firmware or devpath parameter missing\n\n"); + rc = 1; + goto exit; + } + + udev = udev_new(); + if (udev == NULL) { + rc = 1; + goto exit; + }; + + /* lookup firmware file */ + uname(&kernel); + for (i = 0; i < ARRAY_SIZE(searchpath); i++) { + util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); + dbg(udev, "trying %s\n", fwpath); + fwfile = fopen(fwpath, "r"); + if (fwfile != NULL) + break; + + util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); + dbg(udev, "trying %s\n", fwpath); + fwfile = fopen(fwpath, "r"); + if (fwfile != NULL) + break; + } + + util_path_encode(firmware, fwencpath, sizeof(fwencpath)); + util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.udev/firmware-missing/", fwencpath, NULL); + + if (fwfile == NULL) { + int err; + + /* This link indicates the missing firmware file and the associated device */ + info(udev, "did not find firmware file '%s'\n", firmware); + do { + err = util_create_path(udev, misspath); + if (err != 0 && err != -ENOENT) + break; + udev_selinux_setfscreatecon(udev, misspath, S_IFLNK); + err = symlink(devpath, misspath); + if (err != 0) + err = -errno; + udev_selinux_resetfscreatecon(udev); + } while (err == -ENOENT); + rc = 2; + goto exit; + } + + if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { + rc = 3; + goto exit; + } + if (unlink(misspath) == 0) + util_delete_path(udev, misspath); + + util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); + set_loading(udev, loadpath, "1"); + + util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL); + if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { + err(udev, "error sending firmware '%s' to device\n", firmware); + set_loading(udev, loadpath, "-1"); + rc = 4; + goto exit; + }; + + set_loading(udev, loadpath, "0"); +exit: + udev_unref(udev); + udev_log_close(); + return rc; +} diff --git a/extras/firmware/firmware.sh b/extras/firmware/firmware.sh deleted file mode 100755 index 9d4659a34d..0000000000 --- a/extras/firmware/firmware.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh -e - -FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \ - /lib/firmware/$(uname -r) /lib/firmware" - -err() { - echo "$@" >&2 - logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true -} - -if [ ! -e /sys$DEVPATH/loading ]; then - err "udev firmware loader misses sysfs directory" - exit 1 -fi - -for DIR in $FIRMWARE_DIRS; do - [ -e "$DIR/$FIRMWARE" ] || continue - echo 1 > /sys$DEVPATH/loading - cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data - echo 0 > /sys$DEVPATH/loading - exit 0 -done - -echo -1 > /sys$DEVPATH/loading -err "Cannot find firmware file '$FIRMWARE'" -mkdir -p /dev/.udev/firmware-missing -file=$(echo "$FIRMWARE" | sed 's:/:\\x2f:g') -ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file -exit 1 -- cgit v1.2.3-54-g00ecf From 560739148143061336096dc3c021f94fe1bce37b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 18 Dec 2009 21:25:13 +0100 Subject: update mtime of nodes and links when we re-use them --- udev/udev-node.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/udev/udev-node.c b/udev/udev-node.c index 24f2ccf618..c80a74c218 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -55,6 +56,8 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod info(udev, "preserve file '%s', because it has correct dev_t\n", file); preserve = 1; udev_selinux_lsetfilecon(udev, file, mode); + /* update time stamp when we re-use the node, like on media change events */ + utimes(file, NULL); } else { char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; @@ -175,6 +178,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) info(udev, "preserve already existing symlink '%s' to '%s'\n", slink, target); udev_selinux_lsetfilecon(udev, slink, S_IFLNK); + lutimes(slink, NULL); goto exit; } } -- cgit v1.2.3-54-g00ecf From c71d6a45aadbf69b394442e8b89c35db33afcff3 Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Mon, 21 Dec 2009 09:24:34 +0100 Subject: add Samsung R70/R71 keymap Required for the keyboard driver to recognize special keys such as Fn+F2 (battery), Fn+F3 (euro), Fn+F4 (switchmode), Fn+F6 (mute), Fn+F7 (XF86Launch2), Fn+up/down (brightness), Fn+left/right (volume). Fn+F5 (blank screen) and Fn+F8 still do not generate events after this change, howver. Signed-off-by: Clemens Buchacher Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index ad281cbcd8..d2bf4a287d 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -95,7 +95,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N130*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N130*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" -- cgit v1.2.3-54-g00ecf From b73bf332c2da4f539d029d5e9a09af76df12181f Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 21 Dec 2009 15:41:25 +0100 Subject: Speed up udev_enumerate_scan_* Check property match earlier, to avoid lots of readlink() and stat() calls when we check property matches. --- libudev/libudev-enumerate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 2fcd348296..53cd53b694 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -574,6 +574,8 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, continue; util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); + if (!match_property(udev_enumerate, syspath)) + continue; if (lstat(syspath, &statbuf) != 0) continue; if (S_ISREG(statbuf.st_mode)) @@ -586,8 +588,6 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, continue; if (!match_sysattr(udev_enumerate, syspath)) continue; - if (!match_property(udev_enumerate, syspath)) - continue; syspath_add(udev_enumerate, syspath); } closedir(dir); -- cgit v1.2.3-54-g00ecf From b24e3bb62f6af0e9d8968ce6ca98641aacde1e88 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 22 Dec 2009 12:48:50 +0100 Subject: keymap: Add hotkey quirk for Acer Aspire One (AO531h/AO751h) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From hal-info ML, thanks to Keng-Yü Lin! --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index d2bf4a287d..b3268f915f 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -71,7 +71,7 @@ ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dm ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|Aspire 1810T", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|Aspire 1810T|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" -- cgit v1.2.3-54-g00ecf From 7729cd2fadbe0a5dd1eea3b81050616431d93af6 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 22 Dec 2009 13:08:23 +0100 Subject: Clarify RUN/IMPORT documentation Explain command/argument separation rules, search path, and quoting for RUN and IMPORT. http://bugs.debian.org/550206 --- udev/udev.xml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index ff01fefe58..b6c5933419 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -347,12 +347,18 @@ is specified, and the executed program returns non-zero, the event will be marked as failed for a possible later handling. + If no path is given, the program must be in + /lib/udev, otherwise the full path must be + specified. If the specified string starts with , all current event values will be passed to the specified socket, as a message in the same format the kernel sends an uevent. If the first character of the specified path is an @ character, an abstract namespace socket is used, instead of an existing socket file. + Program name and arguments are separated with spaces. To + include spaces in an argument, use single quotes. Please note + that this does not run through a shell. @@ -380,7 +386,9 @@ Execute an external program specified as the assigned value and - import its output, which must be in environment key format. + import its output, which must be in environment key + format. Path specification, command/argument separation, + and quoting work like in . -- cgit v1.2.3-54-g00ecf From db05f937272d577dac014fa12537798f4981c112 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 23 Dec 2009 10:38:20 +0100 Subject: keymap: Add Logitech S510 USB keyboard The Logitech S510 identifies just like the already existing "logitech-wave-cordless" variant, but with wildly different scancodes. So just merge the tables, since they won't collide. https://launchpad.net/bugs/259244 --- extras/keymap/keymaps/logitech-wave-cordless | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/keymaps/logitech-wave-cordless b/extras/keymap/keymaps/logitech-wave-cordless index 4d34c9739a..a10dad5e4d 100644 --- a/extras/keymap/keymaps/logitech-wave-cordless +++ b/extras/keymap/keymaps/logitech-wave-cordless @@ -1,3 +1,5 @@ +0xD4 zoomin +0xCC zoomout 0xC0183 media 0xC1005 camera 0xC101F zoomout -- cgit v1.2.3-54-g00ecf From 299650f1e338b27aa77be3c572a69989b381d6bd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Dec 2009 20:42:02 +0100 Subject: udevadm: info - fix info --root --query=name --path= for device without a device node Subject: Bug#561279: udev: Crash location and first-level cause Reply-To: Stephen Kitt , 561279@bugs.debian.org --- udev/udevadm-info.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index d95091c4a4..47114092d7 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -388,23 +388,24 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) } switch(query) { - case QUERY_NAME: + case QUERY_NAME: { + const char *node = udev_device_get_devnode(device); + + if (node == NULL) { + fprintf(stderr, "no device node found\n"); + rc = 5; + goto exit; + } + if (root) { printf("%s\n", udev_device_get_devnode(device)); } else { - size_t len; - const char *node; - - len = strlen(udev_get_dev_path(udev)); - node = udev_device_get_devnode(device); - if (node == NULL) { - fprintf(stderr, "no device node found\n"); - rc = 5; - goto exit; - } - printf("%s\n", &udev_device_get_devnode(device)[len+1]); + size_t len = strlen(udev_get_dev_path(udev)); + + printf("%s\n", &udev_device_get_devnode(device)[len+1]); } break; + } case QUERY_SYMLINK: list_entry = udev_device_get_devlinks_list_entry(device); while (list_entry != NULL) { -- cgit v1.2.3-54-g00ecf From 58b533f417307fb66ce11fa8ad4a873c1953ae41 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Dec 2009 22:10:40 +0100 Subject: remove remaining support for CONFIG_SYSFS_DEPRECATED --- libudev/libudev-device.c | 61 ++++-------------------------------------------- 1 file changed, 5 insertions(+), 56 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index dffeed0b79..71fc775242 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -303,25 +303,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * util_strscpy(path, sizeof(path), syspath); util_resolve_sys_link(udev, path, sizeof(path)); - /* try to resolve the silly block layout if needed */ - if (strncmp(&path[len], "/block/", 7) == 0) { - char block[UTIL_PATH_SIZE]; - char part[UTIL_PATH_SIZE]; - - util_strscpy(block, sizeof(block), path); - pos = strrchr(block, '/'); - if (pos == NULL) - return NULL; - util_strscpy(part, sizeof(part), pos); - pos[0] = '\0'; - if (util_resolve_sys_link(udev, block, sizeof(block)) == 0) - util_strscpyl(path, sizeof(path), block, part, NULL); - } - - /* path exists in sys */ - if (strncmp(&syspath[len], "/devices/", 9) == 0 || - strncmp(&syspath[len], "/class/", 7) == 0 || - strncmp(&syspath[len], "/block/", 7) == 0) { + if (strncmp(&syspath[len], "/devices/", 9) == 0) { char file[UTIL_PATH_SIZE]; /* all "devices" require a "uevent" file */ @@ -369,9 +351,6 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de { char path[UTIL_PATH_SIZE]; const char *type_str; - struct udev_enumerate *udev_enumerate; - struct udev_list_entry *list_entry; - struct udev_device *device = NULL; if (type == 'b') type_str = "block"; @@ -380,40 +359,10 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de else return NULL; - /* /sys/dev/{block,char}/: link */ - snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", udev_get_sys_path(udev), - type_str, major(devnum), minor(devnum)); - if (util_resolve_sys_link(udev, path, sizeof(path)) == 0) - return udev_device_new_from_syspath(udev, path); - - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return NULL; - - /* fallback to search sys devices for the major/minor */ - if (type == 'b') - udev_enumerate_add_match_subsystem(udev_enumerate, "block"); - else if (type == 'c') - udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); - udev_enumerate_scan_devices(udev_enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { - struct udev_device *device_loop; - - device_loop = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device_loop != NULL) { - if (udev_device_get_devnum(device_loop) == devnum) { - if (type == 'b' && strcmp(udev_device_get_subsystem(device_loop), "block") != 0) - continue; - if (type == 'c' && strcmp(udev_device_get_subsystem(device_loop), "block") == 0) - continue; - device = device_loop; - break; - } - udev_device_unref(device_loop); - } - } - udev_enumerate_unref(udev_enumerate); - return device; + /* use /sys/dev/{block,char}/: link */ + snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", + udev_get_sys_path(udev), type_str, major(devnum), minor(devnum)); + return udev_device_new_from_syspath(udev, path); } /** -- cgit v1.2.3-54-g00ecf From 1d67ec16c44711bbfb50ac7dd8bb2fb6e64a80f3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Dec 2009 14:47:59 +0100 Subject: fix typo in log message priority handling --- libudev/libudev-private.h | 2 +- udev/udevadm.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 28110d191c..fe1575d60b 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -26,7 +26,7 @@ udev_log_null(struct udev *udev, const char *format, ...) {} #define udev_log_cond(udev, prio, arg...) \ do { \ if (udev_get_log_priority(udev) >= prio) \ - udev_log(udev, LOG_ERR, __FILE__, __LINE__, __FUNCTION__, ## arg); \ + udev_log(udev, prio, __FILE__, __LINE__, __FUNCTION__, ## arg); \ } while (0) #ifdef ENABLE_LOGGING diff --git a/udev/udevadm.c b/udev/udevadm.c index 3d94215ba9..00c2350d35 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -35,8 +35,7 @@ static void log_fn(struct udev *udev, int priority, fprintf(stderr, "%s: ", fn); vfprintf(stderr, format, args); } else { - if (priority <= LOG_ERR) - vfprintf(stderr, format, args); + vfprintf(stderr, format, args); vsyslog(priority, format, args); } } -- cgit v1.2.3-54-g00ecf From f46d2e54a82086eddcd9cd91e7908e87d7424148 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Dec 2009 15:23:45 +0100 Subject: remove UDEV_RUN environment variable It handles only RUN but not IMPORT and PROGRAM. There is no sane way to suppress program execution. Most important programs run with IMPORT these days. Also events can no longer suppressed with the libudev netlink messages, so UDEV_RUN does nothing useful and is just inconsistent. --- Makefile.am | 6 +++--- libudev/libudev-private.h | 1 - libudev/libudev.c | 11 ----------- udev/test-udev.c | 2 +- udev/udevadm-test.c | 3 +-- udev/udevd.c | 9 +++------ 6 files changed, 8 insertions(+), 24 deletions(-) diff --git a/Makefile.am b/Makefile.am index 126064b631..e037e607d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,9 +28,9 @@ CLEANFILES = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=5 -LIBUDEV_REVISION=2 -LIBUDEV_AGE=5 +LIBUDEV_CURRENT=6 +LIBUDEV_REVISION=0 +LIBUDEV_AGE=6 SUBDIRS += libudev/docs diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index fe1575d60b..c2fff00211 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -59,7 +59,6 @@ void udev_log(struct udev *udev, const char *format, ...) __attribute__((format(printf, 6, 7))); const char *udev_get_rules_path(struct udev *udev); -int udev_get_run(struct udev *udev); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); diff --git a/libudev/libudev.c b/libudev/libudev.c index 190913871e..411e9aec8b 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -45,7 +45,6 @@ struct udev { char *rules_path; struct udev_list_node properties_list; int log_priority; - int run; }; void udev_log(struct udev *udev, @@ -122,7 +121,6 @@ struct udev *udev_new(void) udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; udev_list_init(&udev->properties_list); - udev->run = 1; udev->dev_path = strdup("/dev"); udev->sys_path = strdup("/sys"); config_file = strdup(SYSCONFDIR "/udev/udev.conf"); @@ -140,10 +138,6 @@ struct udev *udev_new(void) udev_add_property(udev, "SYSFS_PATH", udev->sys_path); } - env = getenv("UDEV_RUN"); - if (env != NULL && strcmp(env, "0") == 0) - udev->run = 0; - env = getenv("UDEV_CONFIG_FILE"); if (env != NULL) { free(config_file); @@ -359,11 +353,6 @@ const char *udev_get_rules_path(struct udev *udev) return udev->rules_path; } -int udev_get_run(struct udev *udev) -{ - return udev->run; -} - /** * udev_get_sys_path: * @udev: udev library context diff --git a/udev/test-udev.c b/udev/test-udev.c index 75518f628d..28c833a9e5 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) if (udev_device_get_event_timeout(dev) >= 0) alarm(udev_device_get_event_timeout(dev)); - if (err == 0 && udev_get_run(udev)) + if (err == 0) udev_event_execute_run(event, NULL); udev_event_unref(event); diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 5dd515bcdc..894620073a 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -119,14 +119,13 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) info(udev, "%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); - if (err == 0 && udev_get_run(udev)) { + if (err == 0) udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); info(udev, "run: '%s'\n", program); } - } udev_event_unref(event); udev_device_unref(dev); exit: diff --git a/udev/udevd.c b/udev/udevd.c index 99647c683c..170225d00c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -292,12 +292,9 @@ static void worker_new(struct event *event) if (udev_device_get_event_timeout(dev) >= 0) alarm(udev_device_get_event_timeout(dev)); - /* execute RUN= */ - if (err == 0 && udev_get_run(udev_event->udev)) - failed = udev_event_execute_run(udev_event, - &orig_sigmask); + if (err == 0) + failed = udev_event_execute_run(udev_event, &orig_sigmask); - /* reset alarm */ alarm(0); /* apply/restore inotify watch */ @@ -309,7 +306,7 @@ static void worker_new(struct event *event) /* send processed event back to libudev listeners */ udev_monitor_send_device(worker_monitor, NULL, dev); - /* send back the result of the event execution */ + /* send udevd the result of the event execution */ if (err != 0) msg.exitcode = err; else if (failed != 0) -- cgit v1.2.3-54-g00ecf From d5a01cb8b31bd0791d1617c56d4c669a02018bd7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Dec 2009 16:14:22 +0100 Subject: udevadm: logging - copy va_list and do not use it twice --- udev/udevadm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/udev/udevadm.c b/udev/udevadm.c index 00c2350d35..21b7f616c3 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -35,7 +35,11 @@ static void log_fn(struct udev *udev, int priority, fprintf(stderr, "%s: ", fn); vfprintf(stderr, format, args); } else { - vfprintf(stderr, format, args); + va_list args2; + + va_copy(args2, args); + vfprintf(stderr, format, args2); + va_end(args2); vsyslog(priority, format, args); } } -- cgit v1.2.3-54-g00ecf From 6ab861dcce624d5eb9f6f1ddece320f1ddc336c4 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 26 Dec 2009 11:16:33 +0100 Subject: keymap: add Acer TravelMate 8471 https://launchpad.net/bugs/492657 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index b3268f915f..cdd4c0f159 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -71,7 +71,7 @@ ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dm ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|Aspire 1810T|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|Aspire 1810T|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" -- cgit v1.2.3-54-g00ecf From f1707f125ae7768eece6633d354ab4a224a3fa52 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 27 Dec 2009 11:30:53 +0100 Subject: keymap: Add Acer Aspire 1810TZ https://launchpad.net/bugs/492657 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index cdd4c0f159..8db47f8ded 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -71,7 +71,7 @@ ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dm ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|Aspire 1810T|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" -- cgit v1.2.3-54-g00ecf From bf088a572eda0eb95de1e0d08a68c9280ada2a10 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Thu, 24 Dec 2009 12:43:46 +0000 Subject: keymap: Add OLPC XO key mappings This supports both XO-1 and XO-1.5. Signed-off-by: Martin Pitt --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 2 ++ extras/keymap/keymaps/olpc-xo | 60 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 extras/keymap/keymaps/olpc-xo diff --git a/Makefile.am b/Makefile.am index e037e607d4..0d2e1b6071 100644 --- a/Makefile.am +++ b/Makefile.am @@ -532,6 +532,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/module-lenovo \ extras/keymap/keymaps/module-sony \ extras/keymap/keymaps/module-sony-old \ + extras/keymap/keymaps/olpc-xo \ extras/keymap/keymaps/oqo-model2 \ extras/keymap/keymaps/samsung-other \ extras/keymap/keymaps/samsung-sq1us \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 8db47f8ded..6da6b26a12 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -114,4 +114,6 @@ ENV{DMI_VENDOR}=="Everex", ATTR{[dmi/id]product_name}=="XT5000*", RUN+="keymap $ ENV{DMI_COMPAL}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="OLPC", ATTR{[dmi/id]product_name}=="XO", RUN+="keymap $name olpc-xo" + LABEL="keyboard_end" diff --git a/extras/keymap/keymaps/olpc-xo b/extras/keymap/keymaps/olpc-xo new file mode 100644 index 0000000000..7fe06629d3 --- /dev/null +++ b/extras/keymap/keymaps/olpc-xo @@ -0,0 +1,60 @@ +0x59 fn +0x81 fn_esc +0xF9 camera +0xF8 sound # Fn-CAMERA = Mic +0xBB fn_f1 +0xBC fn_f2 +0xBD fn_f3 +0xBE fn_f4 +0xBF fn_f5 +0xC0 fn_f6 +0xC1 fn_f7 +0xC2 fn_f8 +0xC3 fn_f9 +0xC4 fn_f10 +0xD7 fn_f11 +0xD8 fn_f12 + +# Using F13-F21 for the .5 F keys right now. +0xF7 f13 +0xF6 f14 +0xF5 f15 +0xF4 f16 +0xF3 f17 +0xF2 f18 +0xF1 f19 +0xF0 f20 +0xEF f21 + +0xEE chat +0xE4 chat # Just mapping Fn-Chat to Chat for now +0xDD menu # Frame +0xDA prog1 # Fn-Frame + +# The FN of some keys is other keys +0xD3 delete +0xD2 insert +0xC9 pageup +0xD1 pagedown +0xC7 home +0xCF end + +# Language key - don't ask what they are doing as KEY_HP +0x73 hp +0x7E hp + +0xDB leftmeta # left grab +0xDC rightmeta # right grab +0x85 rightmeta # Right grab releases on a different scancode +0xD6 kbdillumtoggle # Fn-space +0x69 switchvideomode # Brightness key + +# Game keys +0x65 kp8 # up +0x66 kp2 # down +0x67 kp4 # left +0x68 kp6 # right +0xE5 kp9 # pgup +0xE6 kp3 # pgdn +0xE7 kp7 # home +0xE8 kp1 # end -- cgit v1.2.3-54-g00ecf From fd3401a641f7b47ef7b5d4ae0d99a555889fed37 Mon Sep 17 00:00:00 2001 From: Daniel Drake Date: Thu, 24 Dec 2009 12:46:09 +0000 Subject: keymap: Fix typo in compal rules Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 6da6b26a12..a98055da0e 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -112,7 +112,7 @@ ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]prod ENV{DMI_VENDOR}=="Everex", ATTR{[dmi/id]product_name}=="XT5000*", RUN+="keymap $name everex-xt5000" -ENV{DMI_COMPAL}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name 0x84 wlan" ENV{DMI_VENDOR}=="OLPC", ATTR{[dmi/id]product_name}=="XO", RUN+="keymap $name olpc-xo" -- cgit v1.2.3-54-g00ecf From 1f819a177630863aca7bf651dc429aa4eb3ba3af Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 27 Dec 2009 11:42:21 +0100 Subject: keymap: Add LG X110 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is an MSI Wind clone. Reported on hal ML by Ozan Çağlayan --- extras/keymap/95-keymap.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index a98055da0e..d123c10661 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -86,6 +86,9 @@ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro Edition V35 ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+="keymap $name fujitsu-amilo_si_1520" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" +# MSI Wind clone +ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name micro-star" + ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" -- cgit v1.2.3-54-g00ecf From 9bdcffd738f9170bda7a962affcf5d42381748e0 Mon Sep 17 00:00:00 2001 From: Thomas de Grenier de Latour Date: Wed, 30 Dec 2009 16:21:59 +0100 Subject: libudev: enumerate - fix move_later logic The move_later_prefix variable was reset to zero on each loop iteration, and thus the move_later entry (if any) was not added right after changing to another syspath prefix, but rather after exiting the enumeration loop. --- libudev/libudev-enumerate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 53cd53b694..9a61a61f0d 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -251,6 +251,7 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude unsigned int i; unsigned int max; struct syspath *prev = NULL, *move_later = NULL; + size_t move_later_prefix = 0; udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); @@ -258,7 +259,6 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude max = udev_enumerate->devices_cur; for (i = 0; i < max; i++) { struct syspath *entry = &udev_enumerate->devices[i]; - size_t move_later_prefix = 0; /* skip duplicated entries */ if (prev != NULL && -- cgit v1.2.3-54-g00ecf From 5da8438016bbb8a9892abdd650127208c90c14cb Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Sun, 3 Jan 2010 11:42:12 +0100 Subject: keymap: Lenovo Thinkpad USB Keyboard with Tracepoint Add support for special function keys on Lenovo Thinkpad USB Keyboard Tracepoint. - VoIP hotkey "FN+F6" is mapped to camera, and may need to change if there is a standard VoIP hotkey defined. - Mute Microphone key has not been defined, as there is no standard key defined for it yet. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 1 + .../keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint diff --git a/Makefile.am b/Makefile.am index 0d2e1b6071..8fd6e32b81 100644 --- a/Makefile.am +++ b/Makefile.am @@ -519,6 +519,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/hewlett-packard-tx2 \ extras/keymap/keymaps/inventec-symphony_6.0_7.0 \ extras/keymap/keymaps/lenovo-3000 \ + extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ extras/keymap/keymaps/logitech-wave \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index d123c10661..33633f6d3a 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -21,6 +21,7 @@ LABEL="keyboard_usbcheck" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" +ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" GOTO="keyboard_end" diff --git a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint new file mode 100644 index 0000000000..2566f03877 --- /dev/null +++ b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint @@ -0,0 +1,13 @@ +0x90012 screenlock # Fn+F2 +0x90013 battery # Fn+F3 +0x90014 wlan # Fn+F5 +0x90016 switchvideomode # Fn+F7 +0x90017 f22 # Fn+F8 touchpadtoggle +0x90019 suspend # Fn+F12 +0x9001A brightnessup # Fn+Home +0x9001B brightnessdown # Fn+End +0x9001D zoom # Fn+Space +0x90011 prog1 # Thinkvantage button + +0x90015 camera # Fn+F6 headset/camera VoIP key ?? +0x90010 # Microphone mute button ?? -- cgit v1.2.3-54-g00ecf From 7cbbd7e7b130ba5108ab488f3f5d17c62b9ce4b2 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 5 Jan 2010 09:39:53 +0100 Subject: keymap: Add Fujitsu Amilo Li 1718 https://launchpad.net/bugs/250732 --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 33633f6d3a..2b1c4bd5d7 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -86,6 +86,7 @@ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V6*", ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro Edition V3505*", RUN+="keymap $name fujitsu-amilo_pro_edition_v3505" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+="keymap $name fujitsu-amilo_si_1520" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="Amilo Li 1718", RUN+="keymap $name 0xD6 wlan" # MSI Wind clone ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name micro-star" -- cgit v1.2.3-54-g00ecf From 1e69248fec27deb701713d2dc7bc449976ef0cce Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 5 Jan 2010 09:52:30 +0100 Subject: keymap: Document force-release Make a note in README.keymap.txt about stuck keys which need a force-release quirk. --- extras/keymap/README.keymap.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt index ae8916bb67..9c2d5dc16a 100644 --- a/extras/keymap/README.keymap.txt +++ b/extras/keymap/README.keymap.txt @@ -74,6 +74,12 @@ for inclusion you need to do the following steps: /lib/udev/keymaps/ for existing key map files and make sure that you use the same structure. + If the key only ever works once and then your keyboard (or the entire desktop) + gets stuck for a long time, then it is likely that the BIOS fails to send a + corresponding "key release" event after the key press event. Please note down + this case as well, as it can be worked around in + /lib/udev/keymaps/95-keyboard-force-release.rules . + 4. Find out your system vendor and product: cat /sys/class/dmi/id/sys_vendor -- cgit v1.2.3-54-g00ecf From 6b48014b182418ee5c623672415d292cc0f3d82d Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Tue, 5 Jan 2010 16:55:18 +0100 Subject: keymap: Samsung R70/R71 force-release quirk http://www.spinics.net/lists/hotplug/msg03269.html Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 4d0a877044..25bced61e0 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -19,6 +19,6 @@ DRIVER!="atkbd", GOTO="force_release_end" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*", RUN+="keyboard-force-release.sh $devpath samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*SR70S/SR71S*", RUN+="keyboard-force-release.sh $devpath samsung-other" LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From 6714dc2015bc1aea08e3b5b8ae0557c7691191e6 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Thu, 7 Jan 2010 16:16:00 +0100 Subject: build: keymap - create subdir --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 8fd6e32b81..743c5b84cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -547,6 +547,7 @@ dist_udevkeymapforcerel_DATA = \ extras/keymap/keymaps/force-release/samsung-other extras/keymap/keys.txt: /usr/include/linux/input.h + mkdir -p extras/keymap $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt -- cgit v1.2.3-54-g00ecf From fa0612104ad30d4228aa7782308a77e21b7f6fb5 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Thu, 7 Jan 2010 16:17:22 +0100 Subject: rules: udev-acl - add firewire video devices --- extras/udev-acl/70-acl.rules | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index f135bff75c..ab2984c229 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -33,6 +33,15 @@ SUBSYSTEM=="input", SUBSYSTEMS=="sound", ENV{ACL_MANAGE}="1" SUBSYSTEM=="video4linux", ENV{ACL_MANAGE}="1" SUBSYSTEM=="dvb", ENV{ACL_MANAGE}="1" +# IIDC devices: industrial cameras and some webcams +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", ENV{ACL_MANAGE}="1" +# AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", ENV{ACL_MANAGE}="1" + +# old style firewire devices +KERNEL=="dv1394-[0-9]*", ENV{ACL_MANAGE}="1" +KERNEL=="video1394-[0-9]*", ENV{ACL_MANAGE}="1" + # fingerprint readers SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="2016", ENV{ACL_MANAGE}="1" -- cgit v1.2.3-54-g00ecf From 1a259f1ac892e94593b661aec2bc93ad931f7c65 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jan 2010 16:42:23 +0100 Subject: libudev: doc - add symbols to sections.txt --- libudev/docs/libudev-sections.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index ff2dd363b1..c11a2735b2 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -51,6 +51,7 @@ udev_device_get_driver udev_device_get_devnum udev_device_get_action udev_device_get_sysattr_value +udev_device_get_seqnum
            @@ -104,5 +105,7 @@ udev_queue_get_seqnum_is_finished udev_queue_get_seqnum_sequence_is_finished udev_queue_get_queued_list_entry udev_queue_get_failed_list_entry +udev_queue_get_kernel_seqnum +udev_queue_get_udev_seqnum
            -- cgit v1.2.3-54-g00ecf From 43cb1551d5f4e276d79ced4eff8cd89d7e81f286 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jan 2010 17:11:06 +0100 Subject: work around gtk-doc which breaks distcheck --- extras/gudev/docs/.gitignore | 1 - extras/gudev/docs/gudev-overrides.txt | 0 libudev/docs/.gitignore | 1 - libudev/docs/libudev-overrides.txt | 0 4 files changed, 2 deletions(-) create mode 100644 extras/gudev/docs/gudev-overrides.txt create mode 100644 libudev/docs/libudev-overrides.txt diff --git a/extras/gudev/docs/.gitignore b/extras/gudev/docs/.gitignore index 1ac5f7f307..a68789bd13 100644 --- a/extras/gudev/docs/.gitignore +++ b/extras/gudev/docs/.gitignore @@ -1,6 +1,5 @@ gudev-decl-list.txt gudev-decl.txt -gudev-overrides.txt gudev-undeclared.txt gudev-undocumented.txt gudev-unused.txt diff --git a/extras/gudev/docs/gudev-overrides.txt b/extras/gudev/docs/gudev-overrides.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/libudev/docs/.gitignore b/libudev/docs/.gitignore index 84db3aa997..e06b113e2a 100644 --- a/libudev/docs/.gitignore +++ b/libudev/docs/.gitignore @@ -5,7 +5,6 @@ xml/ version.xml libudev-decl-list.txt libudev-decl.txt -libudev-overrides.txt libudev-undeclared.txt libudev-undocumented.txt libudev-unused.txt diff --git a/libudev/docs/libudev-overrides.txt b/libudev/docs/libudev-overrides.txt new file mode 100644 index 0000000000..e69de29bb2 -- cgit v1.2.3-54-g00ecf From 4e45e1ad93e267cdb3f951b4ca4742d255257a12 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jan 2010 17:16:23 +0100 Subject: gobject-introspection: use $datadir instead of $prefix --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 836c30d5e3..82e215cd68 100644 --- a/configure.ac +++ b/configure.ac @@ -93,7 +93,7 @@ if test "x$enable_introspection" = xyes; then AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) - AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=prefix=${prefix} --variable=girdir gobject-introspection-1.0)]) + AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) fi AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) -- cgit v1.2.3-54-g00ecf From ca63e6a8cf7b12601528e3048af10a54985aac46 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jan 2010 17:21:26 +0100 Subject: release 150 --- ChangeLog | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/ChangeLog b/ChangeLog index ac03a3d29a..12785c4f92 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,72 @@ +Summary of changes from v149 to v150 +============================================ + +Clemens Buchacher (2): + add Samsung R70/R71 keymap + keymap: Samsung R70/R71 force-release quirk + +Daniel Drake (2): + keymap: Add OLPC XO key mappings + keymap: Fix typo in compal rules + +Daniel Elstner (1): + libudev: wrap in extern "C" block for C++ + +David Zeuthen (1): + Export ID_WWN_VENDOR_EXTENSION and ID_WWN_WITH_EXTENSION + +Jerone Young (1): + keymap: Lenovo Thinkpad USB Keyboard with Tracepoint + +Johannes Stezenbach (2): + keymap: add Samsung N130 + keymap: handle atkbd force_release quirk + +Kay Sievers (15): + util_unlink_secure(): chmod() before chown() + floppy: fix rule to create additional floppy device nodes + configure.ac: version bump + remove remaining support for CONFIG_SYSFS_DEPRECATED + cdrom_id: remove deprecated device matches + rules: add "block" match to floppy rule + update mtime of nodes and links when we re-use them + udevadm: info - fix info --root --query=name --path= for device without a device node + remove remaining support for CONFIG_SYSFS_DEPRECATED + fix typo in log message priority handling + remove UDEV_RUN environment variable + udevadm: logging - copy va_list and do not use it twice + libudev: doc - add symbols to sections.txt + work around gtk-doc which breaks distcheck + gobject-introspection: use $datadir instead of $prefix + +Marco d'Itri (2): + build: keymap - create subdir + rules: udev-acl - add firewire video devices + +Martin Pitt (12): + keymap: Add Acer Aspire 1810T + 95-keymap.rules: Run on change events, too + keymap: fix findkeyboards + Speed up udev_enumerate_scan_* + keymap: Add hotkey quirk for Acer Aspire One (AO531h/AO751h) + Clarify RUN/IMPORT documentation + keymap: Add Logitech S510 USB keyboard + keymap: add Acer TravelMate 8471 + keymap: Add Acer Aspire 1810TZ + keymap: Add LG X110 + keymap: Add Fujitsu Amilo Li 1718 + keymap: Document force-release + +Piter PUNK (1): + firmware: convert shell script to C + +Scott James Remnant (1): + 70-acl.rules: ACL manage Android G1 dev phones + +Thomas de Grenier de Latour (1): + libudev: enumerate - fix move_later logic + + Summary of changes from v148 to v149 ============================================ -- cgit v1.2.3-54-g00ecf From 0196d02a7623be430a9dc13a51cd2320336ade1e Mon Sep 17 00:00:00 2001 From: Bryan Kadzban Date: Sun, 10 Jan 2010 17:02:29 -0800 Subject: Fix reverted floppy-device permissions Commit d93fb59c50a720e2a1ace2177cc824c00ff8eed6 ("rules: set mode of floppy device nodes to 0660") changed the create_floppy_devices -M argument to 0660, for udev-148. Commit 78171d9549fafdfc1e29d30915104a3ad55e116b reverted this, when it moved the call to create_floppy_devices out to another rules file, for udev-150. Presumably the 0660 mode was correct, and the 0640 reversion was not intentional; this restores 0660. Signed-off-by: Bryan Kadzban --- extras/floppy/60-floppy.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/floppy/60-floppy.rules b/extras/floppy/60-floppy.rules index 3123bb55fd..53e4a9e59a 100644 --- a/extras/floppy/60-floppy.rules +++ b/extras/floppy/60-floppy.rules @@ -1,4 +1,4 @@ # do not edit this file, it will be overwritten on update SUBSYSTEM=="block", KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", ENV{CMOS_TYPE}="$attr{cmos}", \ - RUN+="create_floppy_devices -c -t $env{CMOS_TYPE} -m %M -M 0640 -G floppy $root/%k" + RUN+="create_floppy_devices -c -t $env{CMOS_TYPE} -m %M -M 0660 -G floppy $root/%k" -- cgit v1.2.3-54-g00ecf From 390312b8edd9834293d0a73e96eba1aa8e7a6520 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 11 Jan 2010 11:55:50 +0100 Subject: writing_udev_rules: update rules files names --- docs/writing_udev_rules/index.html | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html index 7ca350635d..28274eef92 100644 --- a/docs/writing_udev_rules/index.html +++ b/docs/writing_udev_rules/index.html @@ -206,15 +206,11 @@ This works for all storage types. As an example, udev has created /dev/disk/

            Rule files and semantics

            -When deciding how to name a device and which additional actions to perform, udev reads a series of rules files. These files are kept in the /etc/udev/rules.d directory, and they all must have the .rules suffix. +When deciding how to name a device and which additional actions to perform, udev reads a series of rules files. These files are kept in the /etc/udev/rules.d and /lib/udev/rules.d directories, and they all must have the .rules suffix. If two files with the same name exist in both directories then only the one in /etc is used.

            -Default udev rules are stored in /etc/udev/rules.d/50-udev.rules. You may find it interesting to look over this file - it includes a few examples, and then some default rules proving a devfs-style /dev layout. However, you should not write rules into this file directly. -

            - -

            -Files in /etc/udev/rules.d/ are parsed in lexical order, and in some circumstances, the order in which rules are parsed is important. In general, you want your own rules to be parsed before the defaults, so I suggest you create a file at /etc/udev/rules.d/10-local.rules and write all your rules into this file. +Files in the rules.d directories are parsed in lexical order, and in some circumstances, the order in which rules are parsed is important. In general, you want your own rules to be parsed before the defaults, so I suggest you create a file at /etc/udev/rules.d/10-local.rules and write all your rules into this file.

            -- cgit v1.2.3-54-g00ecf From a16b18f0914226aed0f319499325e2d70866dec9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Jan 2010 12:59:37 +0100 Subject: configure.ac: version bump --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9977eaa6d2..ba8d662d54 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +udev 151 +======== + udev 150 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 82e215cd68..08df0a9dec 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [150], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [151], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 6f1892dc7abb26ca988521c89d563dd38a0349c0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Jan 2010 13:09:02 +0100 Subject: udevd: inotify - do not parse rules at create but at close We do not need to get notified about created files, only about moved ones or files closed-after-writing. --- udev/udevd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 170225d00c..fe3352ceb5 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -887,15 +887,15 @@ int main(int argc, char *argv[]) if (udev_get_rules_path(udev) != NULL) { inotify_add_watch(pfd[FD_INOTIFY].fd, udev_get_rules_path(udev), - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } else { char filename[UTIL_PATH_SIZE]; struct stat statbuf; inotify_add_watch(pfd[FD_INOTIFY].fd, LIBEXECDIR "/rules.d", - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); inotify_add_watch(pfd[FD_INOTIFY].fd, SYSCONFDIR "/udev/rules.d", - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); @@ -906,7 +906,7 @@ int main(int argc, char *argv[]) udev_selinux_resetfscreatecon(udev); } inotify_add_watch(pfd[FD_INOTIFY].fd, filename, - IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); + IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } udev_watch_restore(udev); -- cgit v1.2.3-54-g00ecf From 889dd1061c2e09044a6c0450c06180b47288fe4f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Jan 2010 13:18:14 +0100 Subject: do not remove device nodes of active kernel devices We do no longer delete the primary device node while handling "remove" events if the same kernel device is already re-created in the meantime. This prevents the asynchronously running udev from removing and re-creating primary device nodes for active devices. --- udev/udev-node.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index c80a74c218..c3df72b0d5 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -422,10 +422,11 @@ int udev_node_remove(struct udev_device *dev) const char *devnode; char partitionname[UTIL_PATH_SIZE]; struct stat stats; + struct udev_device *dev_check; int err = 0; int num; - /* remove,update symlinks, remove symlinks from name index */ + /* remove/update symlinks, remove symlinks from name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) link_update(dev, udev_list_entry_get_name(list_entry), 0); @@ -441,10 +442,15 @@ int udev_node_remove(struct udev_device *dev) return -1; } - info(udev, "removing device node '%s'\n", devnode); - err = util_unlink_secure(udev, devnode); - if (err) - return err; + dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); + if (dev_check != NULL && stats.st_rdev == udev_device_get_devnum(dev_check)) { + /* do not remove device node if the same sys-device is re-created in the meantime */ + info(udev, "keeping device node '%s'\n", devnode); + } else { + info(udev, "removing device node '%s'\n", devnode); + err = util_unlink_secure(udev, devnode); + } + udev_device_unref(dev_check); num = udev_device_get_num_fake_partitions(dev); if (num > 0) { -- cgit v1.2.3-54-g00ecf From 7c34949019720b3865c6d0080ae8c7cfdb313085 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Jan 2010 13:26:56 +0100 Subject: libudev: device - create db file atomically We need to prevent that libudev parses half-written database files. Also for "change" events, we need to make sure, that database files always exist to be read by libudev, and that they are not first deleted before they are re-created. --- Makefile.am | 2 +- libudev/libudev-device-private.c | 28 +++++++++++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Makefile.am b/Makefile.am index 743c5b84cc..322fb438b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ CLEANFILES = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=6 -LIBUDEV_REVISION=0 +LIBUDEV_REVISION=1 LIBUDEV_AGE=6 SUBDIRS += libudev/docs diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 66f0328eb3..07249c3885 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -25,6 +25,7 @@ int udev_device_update_db(struct udev_device *udev_device) { struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; + char filename_tmp[UTIL_PATH_SIZE]; FILE *f; char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ size_t devlen = strlen(udev_get_dev_path(udev))+1; @@ -35,7 +36,7 @@ int udev_device_update_db(struct udev_device *udev_device) util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); - unlink(filename); + util_strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) if (udev_list_entry_get_flag(list_entry)) @@ -66,21 +67,24 @@ int udev_device_update_db(struct udev_device *udev_device) goto file; } } - info(udev, "create db link (%s)\n", target); - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); - util_create_path(udev, filename); - ret = symlink(target, filename); + udev_selinux_setfscreatecon(udev, filename_tmp, S_IFLNK); + util_create_path(udev, filename_tmp); + ret = symlink(target, filename_tmp); udev_selinux_resetfscreatecon(udev); - if (ret == 0) - goto out; + if (ret != 0) + goto file; + ret = rename(filename_tmp, filename); + if (ret != 0) + goto file; + info(udev, "created db link (%s)\n", target); + goto out; file: - util_create_path(udev, filename); - f = fopen(filename, "w"); + util_create_path(udev, filename_tmp); + f = fopen(filename_tmp, "w"); if (f == NULL) { - err(udev, "unable to create db file '%s': %m\n", filename); + err(udev, "unable to create temporary db file '%s': %m\n", filename_tmp); return -1; } - info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); if (udev_device_get_devnode(udev_device) != NULL) { fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); @@ -105,6 +109,8 @@ file: udev_list_entry_get_value(list_entry)); } fclose(f); + rename(filename_tmp, filename); + info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); out: return 0; } -- cgit v1.2.3-54-g00ecf From 456863e3514d5432e1540c9017731d3e7612e20b Mon Sep 17 00:00:00 2001 From: Frederic Crozat Date: Thu, 14 Jan 2010 16:12:19 +0100 Subject: rules: acl - add COLOR_MEASUREMENT_DEVICE match --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index ab2984c229..78e3ebae53 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -60,6 +60,9 @@ SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ACL_MANAGE}="1" # smart phones SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", ENV{ACL_MANAGE}="1" +# color measurement devices +ENV{COLOR_MEASUREMENT_DEVICE}=="*?", ENV{ACL_MANAGE}="1" + # apply ACL for all locally logged in users LABEL="acl_apply", ENV{ACL_MANAGE}=="?*", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" -- cgit v1.2.3-54-g00ecf From 7b4038a96f6f581aea43ac97f47defdedc524e8b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 15 Jan 2010 00:32:10 +0100 Subject: clarify message about not removed device node --- udev/udev-node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index c3df72b0d5..a70c147d3e 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -445,7 +445,7 @@ int udev_node_remove(struct udev_device *dev) dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); if (dev_check != NULL && stats.st_rdev == udev_device_get_devnum(dev_check)) { /* do not remove device node if the same sys-device is re-created in the meantime */ - info(udev, "keeping device node '%s'\n", devnode); + info(udev, "keeping device node of existing device'%s'\n", devnode); } else { info(udev, "removing device node '%s'\n", devnode); err = util_unlink_secure(udev, devnode); -- cgit v1.2.3-54-g00ecf From fc8e4dd9329f145442fb61035db4730c5c874d94 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 19 Jan 2010 10:43:06 +0100 Subject: keymap: support for the Samsung N140 keyboard --- extras/keymap/95-keyboard-force-release.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 25bced61e0..689afe92fe 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -19,6 +19,6 @@ DRIVER!="atkbd", GOTO="force_release_end" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*SR70S/SR71S*", RUN+="keyboard-force-release.sh $devpath samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*", RUN+="keyboard-force-release.sh $devpath samsung-other" LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From bba10e1c9205d210fc61a0ae9f12f7629562169c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 19 Jan 2010 21:31:27 +0100 Subject: add ACL rule for Garmin GPSMap 60 https://qa.mandriva.com/show_bug.cgi?id=55836 --- extras/udev-acl/70-acl.rules | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 78e3ebae53..8380f53eb3 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -45,6 +45,11 @@ KERNEL=="video1394-[0-9]*", ENV{ACL_MANAGE}="1" # fingerprint readers SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="2016", ENV{ACL_MANAGE}="1" +# GPS devices + # Garmin GPSMap 60 +SUBSYSTEM=="usb", ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", ENV{ACL_MANAGE}="1" + + # DRI video devices SUBSYSTEM=="drm", KERNEL=="card*", ENV{ACL_MANAGE}="1" -- cgit v1.2.3-54-g00ecf From 9a6741ba2f5ef72c051b11484daabd56213742c0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 21 Jan 2010 00:55:59 +0100 Subject: keymap: move force-release directory Move extras/keymap/keymaps/force-release/ to extras/keymap/force-release-maps/, so that check-keymaps.sh does not stumble over the directory. It's also a more logical source layout. --- Makefile.am | 2 +- extras/keymap/force-release-maps/samsung-other | 10 ++++++++++ extras/keymap/keymaps/force-release/samsung-other | 10 ---------- 3 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 extras/keymap/force-release-maps/samsung-other delete mode 100644 extras/keymap/keymaps/force-release/samsung-other diff --git a/Makefile.am b/Makefile.am index 322fb438b8..b7ced1dc7f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -544,7 +544,7 @@ dist_udevkeymap_DATA = \ udevkeymapforcereldir = $(libexecdir)/keymaps/force-release dist_udevkeymapforcerel_DATA = \ - extras/keymap/keymaps/force-release/samsung-other + extras/keymap/force-release-maps/samsung-other extras/keymap/keys.txt: /usr/include/linux/input.h mkdir -p extras/keymap diff --git a/extras/keymap/force-release-maps/samsung-other b/extras/keymap/force-release-maps/samsung-other new file mode 100644 index 0000000000..c51123a0b6 --- /dev/null +++ b/extras/keymap/force-release-maps/samsung-other @@ -0,0 +1,10 @@ +# list of scancodes (hex or decimal), optional comment +0x82 # Fn+F4 CRT/LCD +0x83 # Fn+F2 battery +0x84 # Fn+F5 backlight on/off +0x86 # Fn+F9 WLAN +0x88 # Fn-Up brightness up +0x89 # Fn-Down brightness down +0xB3 # Fn+F8 switch power mode (battery/dynamic/performance) +0xF7 # Fn+F10 Touchpad on +0xF9 # Fn+F10 Touchpad off diff --git a/extras/keymap/keymaps/force-release/samsung-other b/extras/keymap/keymaps/force-release/samsung-other deleted file mode 100644 index c51123a0b6..0000000000 --- a/extras/keymap/keymaps/force-release/samsung-other +++ /dev/null @@ -1,10 +0,0 @@ -# list of scancodes (hex or decimal), optional comment -0x82 # Fn+F4 CRT/LCD -0x83 # Fn+F2 battery -0x84 # Fn+F5 backlight on/off -0x86 # Fn+F9 WLAN -0x88 # Fn-Up brightness up -0x89 # Fn-Down brightness down -0xB3 # Fn+F8 switch power mode (battery/dynamic/performance) -0xF7 # Fn+F10 Touchpad on -0xF9 # Fn+F10 Touchpad off -- cgit v1.2.3-54-g00ecf From 386aa6ebd810fb87718972e298c71184b73bd210 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 21 Jan 2010 01:09:16 +0100 Subject: extras/keymap/check-keymaps.sh: Ignore comment-only lines --- extras/keymap/check-keymaps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh index 892fcfd6c3..c92246a2cd 100755 --- a/extras/keymap/check-keymaps.sh +++ b/extras/keymap/check-keymaps.sh @@ -13,7 +13,8 @@ RULES=$SRCDIR/extras/keymap/95-keymap.rules exit 1 } -missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) <(awk '{print $2}' ${KEYMAPS_DIR}/*|sort -u)) +missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) \ + <(grep -hv '^#' ${KEYMAPS_DIR}/*| awk '{print $2}' | sort -u)) [ -z "$missing" ] || { echo "ERROR: unknown key names in extras/keymap/keymaps/*:" >&2 echo "$missing" >&2 -- cgit v1.2.3-54-g00ecf From 1e6cff0b3b5c1d1ceffd5ddc3124f3bb8e2e78da Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 21 Jan 2010 01:10:28 +0100 Subject: keymap: Fix invalid map line Fix invalid line in keymaps/lenovo-thinkpad-usb-keyboard-trackpoint which did not assign any key to a scan code. --- extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint index 2566f03877..7612f79b0c 100644 --- a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint +++ b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint @@ -10,4 +10,4 @@ 0x90011 prog1 # Thinkvantage button 0x90015 camera # Fn+F6 headset/camera VoIP key ?? -0x90010 # Microphone mute button ?? +# 0x90010 # Microphone mute button ?? -- cgit v1.2.3-54-g00ecf From 7ca9a05dca97f7ef3d7a3ffa1afba844aa23adbc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Jan 2010 00:23:17 +0100 Subject: input_id: include limits.h --- extras/input_id/input_id.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 21ee6b3cd3..602c90d0c4 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "libudev.h" -- cgit v1.2.3-54-g00ecf From 2b8a57353677d73219bee2d56307d40e63fde196 Mon Sep 17 00:00:00 2001 From: Egbert Eich Date: Thu, 21 Jan 2010 11:38:32 +0100 Subject: rulews: suse - add do-not-load-KMS-modules rules --- rules/suse/79-kms.rules | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 rules/suse/79-kms.rules diff --git a/rules/suse/79-kms.rules b/rules/suse/79-kms.rules new file mode 100644 index 0000000000..653d1f371d --- /dev/null +++ b/rules/suse/79-kms.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ENV{MODALIAS}="" + -- cgit v1.2.3-54-g00ecf From 7b79a59b28539a05458bec652781d42d20adc2f9 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Thu, 21 Jan 2010 18:45:04 +0530 Subject: rules: Add symlink rule for virtio ports virtio ports spawned by the virtio_console.c driver can have 'names' assigned to them by hosts. The ports are distinguishable using these names. Make a rule to create a symlink to the chardev associated for a port with a name. The symlink created is: /dev/virtio-ports/org.libvirt.console0 -> /dev/vport0p0 if the first port for the first device was given a name of 'org.libvirt.console0'. Signed-off-by: Amit Shah --- rules/rules.d/50-udev-default.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 374db500e6..f8556d1940 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -17,6 +17,9 @@ KERNEL=="ppp", MODE="0600" KERNEL=="mwave", GROUP="dialout" KERNEL=="hvc*|hvsi*", GROUP="dialout" +# virtio serial / console ports +KERNEL=="vport*", SYMLINK+="virtio-ports/$ATTR{name}" + # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" -- cgit v1.2.3-54-g00ecf From 97411493a3f064b25ad9d3e1df99bf35f484eb3a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 25 Jan 2010 07:37:41 +0100 Subject: keymap: include linux/limits.h --- extras/keymap/keymap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index b565c33e2f..3f01d1953e 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -32,6 +32,7 @@ #include #include #include +#include #include const struct key* lookup_key (const char *str, unsigned int len); -- cgit v1.2.3-54-g00ecf From d8f33f02527c5773438c2a29308edf25d06ce573 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 25 Jan 2010 08:22:47 +0100 Subject: keymap: linux/input.h - get absolute include path from gcc --- Makefile.am | 2 +- configure.ac | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index b7ced1dc7f..3567af81a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -546,7 +546,7 @@ udevkeymapforcereldir = $(libexecdir)/keymaps/force-release dist_udevkeymapforcerel_DATA = \ extras/keymap/force-release-maps/samsung-other -extras/keymap/keys.txt: /usr/include/linux/input.h +extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h mkdir -p extras/keymap $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ diff --git a/configure.ac b/configure.ac index 08df0a9dec..4cecb868f5 100644 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,9 @@ if test "x$enable_extras" = xyes; then AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) fi]) AC_SUBST(PCI_DATABASE) + + AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) + AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) fi AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) @@ -126,6 +129,8 @@ AC_MSG_RESULT([ mandir: ${mandir} includedir: ${includedir} + include_prefix: ${INCLUDE_PREFIX} + logging: ${enable_logging} debug: ${enable_debug} selinux: ${with_selinux} -- cgit v1.2.3-54-g00ecf From 26420abf5400bf047e4f861b6dba01b8934705a6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 25 Jan 2010 10:48:04 +0100 Subject: delete outdated and unmaintained writing_udev_rules Many statements in this document are no longer correct, or even suggest things we do not want to support, or do not work at all with the current version of udev. Any new documentation should better be added to the udev man page, which is usually kept up-to-date. --- Makefile.am | 6 +- docs/writing_udev_rules/index.html | 884 ------------------------------------- 2 files changed, 1 insertion(+), 889 deletions(-) delete mode 100644 docs/writing_udev_rules/index.html diff --git a/Makefile.am b/Makefile.am index 3567af81a6..728076a452 100644 --- a/Makefile.am +++ b/Makefile.am @@ -143,12 +143,8 @@ udev_udevadm_SOURCES = \ udev_udevadm_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ -# udev docs and man pages +# udev man pages # ------------------------------------------------------------------------------ -writing_udev_rulesdir = $(docdir)/writing_udev_rules -dist_writing_udev_rules_DATA = \ - docs/writing_udev_rules/index.html - dist_man_MANS = \ udev/udev.7 \ udev/udevadm.8 \ diff --git a/docs/writing_udev_rules/index.html b/docs/writing_udev_rules/index.html deleted file mode 100644 index 28274eef92..0000000000 --- a/docs/writing_udev_rules/index.html +++ /dev/null @@ -1,884 +0,0 @@ - - - - - -Writing udev rules - - - - -

            Writing udev rules

            -by Daniel Drake (dsd)
            -Version 0.74

            - -The most recent version of this document can always be found at:
            - -http://www.reactivated.net/writing_udev_rules.html - -

            Contents

            - - -

            Introduction

            - - -

            About this document

            - -

            -udev is targeted at Linux kernels 2.6 and beyond to provide a userspace solution for a dynamic /dev directory, with persistent device naming. The previous /dev implementation, devfs, is now deprecated, and udev is seen as the successor. udev vs devfs is a sensitive area of conversation - you should read this document before making comparisons. -

            - -

            -Over the years, the things that you might use udev rules for has changed, as well as the flexibility of rules themselves. On a modern system, udev provides persistent naming for some device types out-of-the-box, eliminating the need for custom rules for those devices. However, some users will still require the extra level of customisation. -

            - -

            -This document assumes that you have udev installed and running OK with default configurations. This is usually handled by your Linux distribution. -

            - -

            -This document does not cover every single detail of rule writing, but does aim to introduce all of the main concepts. The finer details can be found in the udev man page. -

            - -

            -This document uses various examples (many of which are entirely fictional) to illustrate ideas and concepts. Not all syntax is explicitly described in the accompanying text, be sure to look at the example rules to get a complete understanding. -

            - - -

            History

            - -
              -
            • April 5th 2008 v0.74: Typo fixes.
            • -
            • December 3rd 2007 v0.73: Update for new udev versions, and some miscellaneous improvements.
            • -
            • October 2nd 2006 v0.72: Fixed a typo in one of the example rules.
            • -
            • June 10th 2006 v0.71: Misc changes based on recent feedback - thanks!
            • -
            • June 3rd 2006 v0.7: Complete rework, to be more suited for the modern-day udev.
            • -
            • May 9th 2005 v0.6: Misc updates, including information about udevinfo, groups and permissions, logging, and udevtest.
            • -
            • June 20th 2004 v0.55: Added info on multiple symlinks, and some minor changes/updates.
            • -
            • April 26th 2004 v0.54: Added some Debian info. Minor corrections. Re-reverted information about what to call your rule file. Added info about naming network interfaces.
            • -
            • April 15th 2004 v0.53: Minor corrections. Added info about NAME{all_partitions}. Added info about other udevinfo tricks.
            • -
            • April 14th 2004 v0.52: Reverted to suggesting using "udev.rules" until the udev defaults allow for other files. Minor work.
            • -
            • April 6th 2004 v0.51: I now write suggest users to use their own "local.rules" file rather than prepending "udev.rules".
            • -
            • April 3rd 2004 v0.5: Minor cleanups and preparations for possible inclusion in the udev distribution.
            • -
            • March 20th 2004 v0.4: General improvements, clarifications, and cleanups. Added more information about writing rules for usb-storage.
            • -
            • February 23rd 2004 v0.3: Rewrote some parts to emphasise how sysfs naming works, and how it can be matched. Updated rule-writing parts to represent udev 018s new SYSFS{filename} naming scheme. Improved sectioning, and clarified many points. Added info about KDE.
            • -
            • February 18th 2004 v0.2: Fixed a small omission in an example. Updated section on identifying mass-storage devices. Updated section on nvidia.
            • -
            • February 15th 2004 v0.1: Initial publication.
            • -
            - -

            The concepts

            - - -

            Terminology: devfs, sysfs, nodes, etc.

            - -

            -A basic introduction only, might not be totally accurate. -

            - -

            -On typical Linux-based systems, the /dev directory is used to store file-like device nodes which refer to certain devices in the system. Each node points to a part of the system (a device), which might or might not exist. Userspace applications can use these device nodes to interface with the systems hardware, for example, the X server will "listen to" /dev/input/mice so that it can relate the user's mouse movements to moving the visual mouse pointer. -

            - -

            -The original /dev directories were just populated with every device that might possibly appear in the system. /dev directories were typically very large because of this. devfs came along to provide a more manageable approach (noticeably, it only populated /dev with hardware that is plugged into the system), as well as some other functionality, but the system proved to have problems which could not be easily fixed. -

            - -

            -udev is the "new" way of managing /dev directories, designed to clear up some issues with previous /dev implementations, and provide a robust path forward. In order to create and name /dev device nodes corresponding to devices that are present in the system, udev relies on matching information provided by sysfs with rules provided by the user. This documentation aims to detail the process of rule-writing, one of the only udev-related tasks that must (optionally) be performed by the user. -

            - -

            -sysfs is a new filesystem to the 2.6 kernels. It is managed by the kernel, and exports basic information about the devices currently plugged into your system. udev can use this information to create device nodes corresponding to your hardware. sysfs is mounted at /sys and is browseable. You may wish to investigate some of the files stored there before getting to grips with udev. Throughout this document, I will use the terms /sys and sysfs interchangeably. -

            - - -

            Why?

            - -

            -udev rules are flexible and very powerful. Here are some of the things you can use rules to achieve: -

            - -
              -
            • Rename a device node from the default name to something else
            • -
            • Provide an alternative/persistent name for a device node by creating a symbolic link to the default device node
            • -
            • Name a device node based on the output of a program
            • -
            • Change permissions and ownership of a device node
            • -
            • Launch a script when a device node is created or deleted (typically when a device is attached or unplugged)
            • -
            • Rename network interfaces
            • -
            - -

            -Writing rules is not a workaround for the problem where no device nodes for your particular device exist. Even if there are no matching rules, udev will create the device node with the default name supplied by the kernel. -

            - -

            -Having persistently named device nodes has several advantages. Assume you own two USB storage devices: a digital camera and a USB flash disk. These devices are typically assigned device nodes /dev/sda and /dev/sdb but the exact assignment depends on the order which they were originally connected. This may cause problems to some users, who would benefit greatly if each device could be named persistently every time, e.g. /dev/camera and /dev/flashdisk. -

            - - -

            Built-in persistent naming schemes

            - -

            -udev provides persistent naming for some device types out of the box. This is a very useful feature, and in many circumstances means that your journey ends here: you do not have to write any rules. -

            - -

            -udev provides out-of-the-box persistent naming for storage devices in the /dev/disk directory. To view the persistent names which have been created for your storage hardware, you can use the following command: -

            - -
            # ls -lR /dev/disk
            - -

            -This works for all storage types. As an example, udev has created /dev/disk/by-id/scsi-SATA_ST3120827AS_4MS1NDXZ-part3 which is a persistent-named symbolic link to my root partition. udev creates /dev/disk/by-id/usb-Prolific_Technology_Inc._USB_Mass_Storage_Device-part1 when I plug my USB flash disk in, which is also a persistent name. -

            - - - -

            Rule writing

            - - -

            Rule files and semantics

            - -

            -When deciding how to name a device and which additional actions to perform, udev reads a series of rules files. These files are kept in the /etc/udev/rules.d and /lib/udev/rules.d directories, and they all must have the .rules suffix. If two files with the same name exist in both directories then only the one in /etc is used. -

            - -

            -Files in the rules.d directories are parsed in lexical order, and in some circumstances, the order in which rules are parsed is important. In general, you want your own rules to be parsed before the defaults, so I suggest you create a file at /etc/udev/rules.d/10-local.rules and write all your rules into this file. -

            - -

            -In a rules file, lines starting with "#" are treated as comments. Every other non-blank line is a rule. Rules cannot span multiple lines. -

            - -

            -One device can be matched by more than one rule. This has it's practical advantages, for example, we can write two rules which match the same device, where each one provides its own alternate name for the device. Both alternate names will be created, even if the rules are in separate files. It is important to understand that udev will not stop processing when it finds a matching rule, it will continue searching and attempt to apply every rule that it knows about. -

            - - -

            Rule syntax

            - -

            -Each rule is constructed from a series of key-value pairs, which are separated by commas. match keys are conditions used to identify the device which the rule is acting upon. When all match keys in a rule correspond to the device being handled, then the rule is applied and the actions of the assignment keys are invoked. Every rule should consist of at least one match key and at least one assignment key. -

            - -

            -Here is an example rule to illustrate the above: -

            - -
            KERNEL=="hdb", NAME="my_spare_disk"
            - -

            -The above rule includes one match key (KERNEL) and one assignment key (NAME). The semantics of these keys and their properties will be detailed later. It is important to note that the match key is related to its value through the equality operator (==), whereas the assignment key is related to its value through the assignment operator (=). -

            - -

            -Be aware that udev does not support any form of line continuation. Do not insert any line breaks in your rules, as this will cause udev to see your one rule as multiple rules and will not work as expected. -

            - - -

            Basic Rules

            - -

            -udev provides several different match keys which can be used to write rules which match devices very precisely. Some of the most common keys are introduced below, others will be introduced later in this document. For a complete list, see the udev man page. -

            - -
              -
            • KERNEL - match against the kernel name for the device
            • -
            • SUBSYSTEM - match against the subsystem of the device
            • -
            • DRIVER - match against the name of the driver backing the device
            • -
            - -

            -After you have used a series of match keys to precisely match a device, udev gives you fine control over what happens next, through a range of assignment keys. For a complete list of possible assignment keys, see the udev man page. The most basic assignment keys are introduced below. Others will be introduced later in this document. -

            - -
              -
            • NAME - the name that shall be used for the device node
            • -
            • SYMLINK - a list of symbolic links which act as alternative names for the device node
            • -
            - -

            -As hinted above, udev only creates one true device node for one device. If you wish to provide alternate names for this device node, you use the symbolic link functionality. With the SYMLINK assignment, you are actually maintaining a list of symbolic links, all of which will be pointed at the real device node. To manipulate these links, we introduce a new operator for appending to lists: +=. You can append multiple symlinks to the list from any one rule by separating each one with a space. -

            - -
            KERNEL=="hdb", NAME="my_spare_disk"
            - -

            -The above rule says: match a device which was named by the kernel as hdb, and instead of calling it hdb, name the device node as my_spare_disk. The device node appears at /dev/my_spare_disk. -

            - -
            KERNEL=="hdb", DRIVER=="ide-disk", SYMLINK+="sparedisk"
            - -

            -The above rule says: match a device which was named by the kernel as hdb AND where the driver is ide-disk. Name the device node with the default name and create a symbolic link to it named sparedisk. Note that we did not specify a device node name, so udev uses the default. In order to preserve the standard /dev layout, your own rules will typically leave the NAME alone but create some SYMLINKs and/or perform other assignments. -

            - -
            KERNEL=="hdc", SYMLINK+="cdrom cdrom0"
            - -

            -The above rule is probably more typical of the types of rules you might be writing. It creates two symbolic links at /dev/cdrom and /dev/cdrom0, both of which point at /dev/hdc. Again, no NAME assignment was specified, so the default kernel name (hdc) is used. -

            - - -

            Matching sysfs attributes

            - -

            -The match keys introduced so far only provide limited matching capabilities. Realistically we require much finer control: we want to identify devices based on advanced properties such as vendor codes, exact product numbers, serial numbers, storage capacities, number of partitions, etc. -

            - -

            -Many drivers export information like this into sysfs, and udev allows us to incorporate sysfs-matching into our rules, using the ATTR key with a slightly different syntax. -

            - -

            -Here is an example rule which matches a single attribute from sysfs. Further detail will be provided later in this document which will aid you in writing rules based on sysfs attributes. -

            - -
            -SUBSYSTEM=="block", ATTR{size}=="234441648", SYMLINK+="my_disk"
            -
            - - -

            Device hierarchy

            - -

            -The Linux kernel actually represents devices in a tree-like structure, and this information is exposed through sysfs and useful when writing rules. For example, the device representation of my hard disk device is a child of the SCSI disk device, which is in turn a child of the Serial ATA controller device, which is in turn a child of the PCI bus device. It is likely that you will find yourself needing to refer to information from a parent of the device in question, for example the serial number of my hard disk device is not exposed at the device level, it is exposed by its direct parent at the SCSI disk level. -

            - -

            -The four main match keys introduced so far (KERNEL/SUBSYSTEM/DRIVER/ATTR) only match against values corresponding to the device in question, and do not match values from parent devices. udev provides variants of the match keys that will search upwards through the tree: -

            - -
              -
            • KERNELS - match against the kernel name for the device, or the kernel name for any of the parent devices
            • -
            • SUBSYSTEMS - match against the subsystem of the device, or the subsystem of any of the parent devices
            • -
            • DRIVERS - match against the name of the driver backing the device, or the name of the driver backing any of the parent devices
            • -
            • ATTRS - match a sysfs attribute of the device, or a sysfs attribute of any of the parent devices
            • -
            - -

            -With hierarchy considerations in mind, you may feel that rule writing is becoming a little complicated. Rest assured that there are tools that help out here, which will be introduced later. -

            - - -

            String substitutions

            - -

            -When writing rules which will potentially handle multiple similar devices, udev's printf-like string substitution operators are very useful. You can simply include these operators in any assignments your rule makes, and udev will evaluate them when they are executed. -

            - -

            -The most common operators are %k and %n. %k evaluates to the kernel name for the device, e.g. "sda3" for a device that would (by default) appear at /dev/sda3. %n evaluates to the kernel number for the device (the partition number for storage devices), e.g. "3" for /dev/sda3. -

            - -

            -udev also provides several other substitution operators for more advanced functionality. Consult the udev man page after reading the rest of this document. There is also an alternative syntax for these operators - $kernel and $number for the examples above. For this reason, if you wish to match a literal % in a rule then you must write %%, and if you wish to match a literal $ then you must write $$. -

            - -

            -To illustrate the concept of string substitution, some example rules are shown below. -

            - -
            -KERNEL=="mice", NAME="input/%k"
            -KERNEL=="loop0", NAME="loop/%n", SYMLINK+="%k"
            -
            - -

            -The first rule ensures that the mice device node appears exclusively in the /dev/input directory (by default it would be at /dev/mice). The second rule ensures that the device node named loop0 is created at /dev/loop/0 but also creates a symbolic link at /dev/loop0 as usual. -

            - -

            -The use of the above rules is questionable, as they all could be rewritten without using any substitution operators. The true power of these substitutions will become apparent in the next section. -

            - - -

            String matching

            - -

            -As well as matching strings exactly, udev allows you to use shell-style pattern matching. There are 3 patterns supported: -

            - -
              -
            • * - match any character, zero or more times
            • -
            • ? - match any character exactly once
            • -
            • [] - match any single character specified in the brackets, ranges are also permitted
            • -
            - -

            -Here are some examples which incorporate the above patterns. Note the use of the string substitution operators. -

            - -
            -KERNEL=="fd[0-9]*", NAME="floppy/%n", SYMLINK+="%k"
            -KERNEL=="hiddev*", NAME="usb/%k"
            -
            - -

            -The first rule matches all floppy disk drives, and ensures that the device nodes are placed in the /dev/floppy directory, as well as creating a symbolic link from the default name. The second rule ensures that hiddev devices are only present in the /dev/usb directory. -

            - -

            Finding information from sysfs

            - - -

            The sysfs tree

            - -

            -The concept of using interesting information from sysfs was briefly touched upon above. In order to write rules based on this information, you first need to know the names of the attributes and their current values. -

            - -

            -sysfs is actually a very simple structure. It is logically divided into directories. Each directory contains a number of files (attributes) which typically contain just one value. Some symbolic links are present, which link devices to their parents. The hierarchical structure was touched upon above. -

            - -

            -Some directories are referred to as top-level device paths. These directories represent actual devices that have corresponding device nodes. Top-level device paths can be classified as sysfs directories which contain a dev file, the following command will list these for you: -

            - -
            # find /sys -name dev
            - -

            -For example, on my system, the /sys/block/sda directory is the device path for my hard disk. It is linked to it's parent, the SCSI disk device, through the /sys/block/sda/device symbolic link. -

            - -

            -When you write rules based on sysfs information, you are simply matching attribute contents of some files in one part of the chain. For example, I can read the size of my hard disk as follows: -

            - -
            -# cat /sys/block/sda/size
            -234441648
            -
            - -

            -In a udev rule, I could use ATTR{size}=="234441648" to identify this disk. As udev iterates through the entire device chain, I could alternatively opt to match attributes in another part of the chain (e.g. attributes in /sys/class/block/sda/device/) using ATTRS, however there are some caveats when dealing with different parts of the chain which are described later. -

            - -

            -Although this serves as a useful introduction as to the structure of sysfs and exactly how udev matches values, manually trawling through sysfs is both time consuming and unnecessary. -

            - - -

            udevadm info

            - -

            -Enter udevadm info, which is probably the most straightforward tool you can use to construct rules. All you need to know is the sysfs device path of the device in question. A trimmed example is shown below: -

            - -
            -# udevadm info -a -p /sys/block/sda
            -
            -  looking at device '/block/sda':
            -    KERNEL=="sda"
            -    SUBSYSTEM=="block"
            -    ATTR{stat}=="  128535     2246  2788977   766188    73998   317300  3132216  5735004        0   516516  6503316"
            -    ATTR{size}=="234441648"
            -    ATTR{removable}=="0"
            -    ATTR{range}=="16"
            -    ATTR{dev}=="8:0"
            -
            -  looking at parent device '/devices/pci0000:00/0000:00:07.0/host0/target0:0:0/0:0:0:0':
            -    KERNELS=="0:0:0:0"
            -    SUBSYSTEMS=="scsi"
            -    DRIVERS=="sd"
            -    ATTRS{ioerr_cnt}=="0x0"
            -    ATTRS{iodone_cnt}=="0x31737"
            -    ATTRS{iorequest_cnt}=="0x31737"
            -    ATTRS{iocounterbits}=="32"
            -    ATTRS{timeout}=="30"
            -    ATTRS{state}=="running"
            -    ATTRS{rev}=="3.42"
            -    ATTRS{model}=="ST3120827AS     "
            -    ATTRS{vendor}=="ATA     "
            -    ATTRS{scsi_level}=="6"
            -    ATTRS{type}=="0"
            -    ATTRS{queue_type}=="none"
            -    ATTRS{queue_depth}=="1"
            -    ATTRS{device_blocked}=="0"
            -
            -  looking at parent device '/devices/pci0000:00/0000:00:07.0':
            -    KERNELS=="0000:00:07.0"
            -    SUBSYSTEMS=="pci"
            -    DRIVERS=="sata_nv"
            -    ATTRS{vendor}=="0x10de"
            -    ATTRS{device}=="0x037f"
            -
            - -

            -As you can see, udevadm info simply produces a list of attributes you can use as-is as match keys in your udev rules. From the above example, I could produce (e.g.) either of the following two rules for this device: -

            - -
            -SUBSYSTEM=="block", ATTR{size}=="234441648", NAME="my_hard_disk"
            -SUBSYSTEM=="block", SUBSYSTEMS=="scsi", ATTRS{model}=="ST3120827AS", NAME="my_hard_disk"
            - -

            -You may have noted the use of colour in the above examples. This is to demonstrate that while it is legal to combine the attributes from the device in question and a single parent device, you cannot mix-and-match attributes from multiple parent devices - your rule will not work. For example, the following rule is invalid as it attempts to match attributes from two parent devices: -

            - -
            -SUBSYSTEM=="block", ATTRS{model}=="ST3120827AS", DRIVERS=="sata_nv", NAME="my_hard_disk"
            - -

            -You are usually provided with a large number of attributes, and you must pick a number of them to construct your rule. In general, you want to choose attributes which identify your device in a persistent and human-recognisable way. In the examples above, I chose the size of my disk and its model number. I did not use meaningless numbers such as ATTRS{iodone_cnt}=="0x31737". -

            - -

            -Observe the effects of hierarchy in the udevadm info output. The green section corresponding to the device in question uses the standard match keys such as KERNEL and ATTR. The blue and maroon sections corresponding to parent devices use the parent-traversing variants such as SUBSYSTEMS and ATTRS. This is why the complexity introduced by the hierarchical structure is actually quite easy to deal with, just be sure to use the exact values that udevadm info suggests. -

            - -

            -Another point to note is that it is common for text attributes to appear in the udevadm info output to be padded with spaces (e.g. see ST3120827AS above). In your rules, you can either specify the extra spaces, or you can cut them off as I have done. -

            - -

            -The only complication with using udevadm info is that you are required to know the top-level device path (/sys/block/sda in the example above). This is not always obvious. However, as you are generally writing rules for device nodes which already exist, you can use udevadm info to look up the device path for you: -

            - -
            # udevadm info -a -p $(udevadm info -q path -n /dev/sda)
            - - -

            Alternative methods

            - -

            -Although udevadm info is almost certainly the most straightforward way of listing the exact attributes you can build rules from, some users are happier with other tools. Utilities such as usbview display a similar set of information, most of which can be used in rules. -

            - -

            Advanced topics

            - - -

            Controlling permissions and ownership

            - -

            -udev allows you to use additional assignments in rules to control ownership and permission attributes on each device. -

            - -

            -The GROUP assignment allows you to define which Unix group should own the device node. Here is an example rule which defines that the video group will own the framebuffer devices: -

            - -
            KERNEL=="fb[0-9]*", NAME="fb/%n", SYMLINK+="%k", GROUP="video"
            - -

            -The OWNER key, perhaps less useful, allows you to define which Unix user should have ownership permissions on the device node. Assuming the slightly odd situation where you would want john to own your floppy devices, you could use: -

            - -
            KERNEL=="fd[0-9]*", OWNER="john"
            - -

            -udev defaults to creating nodes with Unix permissions of 0660 (read/write to owner and group). If you need to, you can override these defaults on certain devices using rules including the MODE assignment. As an example, the following rule defines that the inotify node shall be readable and writable to everyone: -

            - -
            KERNEL=="inotify", NAME="misc/%k", SYMLINK+="%k", MODE="0666"
            - - -

            Using external programs to name devices

            - -

            -Under some circumstances, you may require more flexibility than standard udev rules can provide. In this case, you can ask udev to run a program and use the standard output from that program to provide device naming. -

            - -

            -To use this functionality, you simply specify the absolute path of the program to run (and any parameters) in the PROGRAM assignment, and you then use some variant of the %c substitution in the NAME/SYMLINK assignments. -

            - -

            -The following examples refer to a fictional program found at /bin/device_namer. device_namer takes one command line argument which is the kernel name for the device. Based upon this kernel name, device_namer does its magic and produces some output to the usual stdout pipe, split into several parts. Each part is just a single word, and parts are separated by a single space. -

            - -

            -In our first example, we assume that device_namer outputs a number of parts, each one to form a symbolic link (alternative name) for the device in question. -

            - -
            KERNEL=="hda", PROGRAM="/bin/device_namer %k", SYMLINK+="%c"
            - -

            -The next example assumes that device_namer outputs two parts, the first being the device name, and the second being the name for an additional symbolic link. We now introduce the %c{N} substitution, which refers to part N of the output: -

            - -
            KERNEL=="hda", PROGRAM="/bin/device_namer %k", NAME="%c{1}", SYMLINK+="%c{2}"
            - -

            -The next example assumes that device_namer outputs one part for the device name, followed by any number of parts which will form additional symbolic links. We now introduce the %c{N+} substitution, which evaluates to part N, N+1, N+2, ... until the end of the output. -

            - -
            KERNEL=="hda", PROGRAM="/bin/device_namer %k", NAME="%c{1}", SYMLINK+="%c{2+}"
            - -

            -Output parts can be used in any assignment key, not only NAME and SYMLINK. The example below uses a fictional program to determine the Unix group which should own the device: -

            - -
            KERNEL=="hda", PROGRAM="/bin/who_owns_device %k", GROUP="%c"
            - - -

            Running external programs upon certain events

            - -

            -Yet another reason for writing udev rules is to run a particular program when a device is connected or disconnected. For example, you might want to execute a script to automatically download all of your photos from your digital camera when it is connected. -

            - -

            -Do not confuse this with the PROGRAM functionality described above. PROGRAM is used for running programs which produce device names (and they shouldn't do anything other than that). When those programs are being executed, the device node has not yet been created, so acting upon the device in any way is not possible. -

            - -

            -The functionality introduced here allows you to run a program after the device node is put in place. This program can act on the device, however it must not run for any extended period of time, because udev is effectively paused while these programs are running. One workaround for this limitation is to make sure your program immediately detaches itself. -

            - -

            -Here is an example rule which demonstrates the use of the RUN list assignment: -

            - -
            KERNEL=="sdb", RUN+="/usr/bin/my_program"
            - -

            -When /usr/bin/my_program is executed, various parts of the udev environment are available as environment variables, including key values such as SUBSYSTEM. You can also use the ACTION environment variable to detect whether the device is being connected or disconnected - ACTION will be either "add" or "remove" respectively. -

            - -

            -udev does not run these programs on any active terminal, and it does not execute them under the context of a shell. Be sure to ensure your program is marked executable, if it is a shell script ensure it starts with an appropriate shebang (e.g. #!/bin/sh), and do not expect any standard output to appear on your terminal. -

            - - -

            Environment interaction

            - -

            -udev provides an ENV key for environment variables which can be used for both matching and assignment. -

            - -

            -In the assignment case, you can set environment variables which you can then match against later. You can also set environment variables which can be used by any external programs invoked using the techniques mentioned above. A fictional example rule which sets an environment variable is shown below. -

            - -
            KERNEL=="fd0", SYMLINK+="floppy", ENV{some_var}="value"
            - -

            -In the matching case, you can ensure that rules only run depending on the value of an environment variable. Note that the environment that udev sees will not be the same user environment as you get on the console. A fictional rule involving an environment match is shown below. -

            - -
            KERNEL=="fd0", ENV{an_env_var}=="yes", SYMLINK+="floppy"
            - -

            -The above rule only creates the /dev/floppy link if $an_env_var is set to "yes" in udev's environment. -

            - - -

            Additional options

            - -

            -Another assignment which can prove useful is the OPTIONS list. A few options are available: -

            - -
              -
            • all_partitions - create all possible partitions for a block device, rather than only those that were initially detected
            • -
            • ignore_device - ignore the event completely
            • -
            • last_rule - ensure that no later rules have any effect
            • -
            - -

            -For example, the rule below sets the group ownership on my hard disk node, and ensures that no later rule can have any effect: -

            - -
            KERNEL=="sda", GROUP="disk", OPTIONS+="last_rule"
            - - -

            Examples

            - - -

            USB Printer

            - -

            -I power on my printer, and it is assigned device node /dev/lp0. Not satisfied with such a bland name, I decide to use udevadm info to aid me in writing a rule which will provide an alternative name: -

            - -
            -# udevadm info -a -p $(udevadm info -q path -n /dev/lp0)
            -  looking at device '/class/usb/lp0':
            -    KERNEL=="lp0"
            -    SUBSYSTEM=="usb"
            -    DRIVER==""
            -    ATTR{dev}=="180:0"
            -
            -  looking at parent device '/devices/pci0000:00/0000:00:1d.0/usb1/1-1':
            -    SUBSYSTEMS=="usb"
            -    ATTRS{manufacturer}=="EPSON"
            -    ATTRS{product}=="USB Printer"
            -    ATTRS{serial}=="L72010011070626380"
            -
            - -

            -My rule becomes: -

            - -
            SUBSYSTEM=="usb", ATTRS{serial}=="L72010011070626380", SYMLINK+="epson_680"
            - - -

            USB Camera

            - -

            -Like most, my camera identifies itself as an external hard disk connected over the USB bus, using the SCSI transport. To access my photos, I mount the drive and copy the image files onto my hard disk. -

            - -

            -Not all cameras work in this way: some of them use a non-storage protocol such as cameras supported by gphoto2. In the gphoto case, you do not want to be writing rules for your device, as is it controlled purely through userspace (rather than a specific kernel driver). -

            - -

            -A common complication with USB camera devices is that they usually identify themselves as a disk with a single partition, in this case /dev/sdb with /dev/sdb1. The sdb node is useless to me, but sdb1 is interesting - this is the one I want to mount. There is a problem here that because sysfs is chained, the useful attributes which udevadm info produces for /dev/sdb1 are identical to the ones for /dev/sdb. This results in your rule potentially matching both the raw disk and the partition, which is not what you want, your rule should be specific. -

            - -

            -To get around this, you simply need to think about what differs between sdb and sdb1. It is surprisingly simple: the name itself differs, so we can use a simple pattern match on the NAME field. -

            - -
            -# udevadm info -a -p $(udevadm info -q path -n /dev/sdb1)
            -  looking at device '/block/sdb/sdb1':
            -    KERNEL=="sdb1"
            -    SUBSYSTEM=="block"
            -
            -  looking at parent device '/devices/pci0000:00/0000:00:02.1/usb1/1-1/1-1:1.0/host6/target6:0:0/6:0:0:0':
            -    KERNELS=="6:0:0:0"
            -    SUBSYSTEMS=="scsi"
            -    DRIVERS=="sd"
            -    ATTRS{rev}=="1.00"
            -    ATTRS{model}=="X250,D560Z,C350Z"
            -    ATTRS{vendor}=="OLYMPUS "
            -    ATTRS{scsi_level}=="3"
            -    ATTRS{type}=="0"
            -
            - -

            -My rule: -

            - -
            KERNEL=="sd?1", SUBSYSTEMS=="scsi", ATTRS{model}=="X250,D560Z,C350Z", SYMLINK+="camera"
            - - -

            USB Hard Disk

            - -

            -A USB hard disk is comparable to the USB camera I described above, however typical usage patterns are different. In the camera example, I explained that I am not interested in the sdb node - it's only real use is for partitioning (e.g. with fdisk), but why would I want to partition my camera!? -

            - -

            -Of course, if you have a 100GB USB hard disk, it is perfectly understandable that you might want to partition it, in which case we can take advantage of udev's string substitutions: -

            - -
            KERNEL=="sd*", SUBSYSTEMS=="scsi", ATTRS{model}=="USB 2.0 Storage Device", SYMLINK+="usbhd%n"
            - -

            -This rule creates symlinks such as: -

            - -
              -
            • /dev/usbhd - The fdiskable node
            • -
            • /dev/usbhd1 - The first partition (mountable)
            • -
            • /dev/usbhd2 - The second partition (mountable)
            • -
            - - -

            USB Card Reader

            - -

            -USB card readers (CompactFlash, SmartMedia, etc) are yet another range of USB storage devices which have different usage requirements. -

            - -

            -These devices typically do not inform the host computer upon media change. So, if you plug in the device with no media, and then insert a card, the computer does not realise, and you do not have your mountable sdb1 partition node for the media. -

            - -

            -One possible solution is to take advantage of the all_partitions option, which will create 16 partition nodes for every block device that the rule matches: -

            - -
            KERNEL="sd*", SUBSYSTEMS=="scsi", ATTRS{model}=="USB 2.0 CompactFlash Reader", SYMLINK+="cfrdr%n", OPTIONS+="all_partitions"
            - -You will now have nodes named: cfrdr, cfrdr1, cfrdr2, cfrdr3, ..., cfrdr15. - - -

            USB Palm Pilot

            - -

            -These devices work as USB-serial devices, so by default, you only get the ttyUSB1 device node. The palm utilities rely on /dev/pilot, so many users will want to use a rule to provide this. -

            - -

            -Carsten Clasohm's blog post appears to be the definitive source for this. Carsten's rule is shown below: -

            - -
            SUBSYSTEMS=="usb", ATTRS{product}=="Palm Handheld", KERNEL=="ttyUSB*", SYMLINK+="pilot"
            - -

            -Note that the product string seems to vary from product to product, so make sure that you check (using udevadm info) which one applies to you. -

            - - -

            CD/DVD drives

            - -

            -I have two optical drives in this computer: a DVD reader (hdc), and a DVD rewriter (hdd). I do not expect these device nodes to change, unless I physically rewire my system. However, many users like to have device nodes such as /dev/dvd for convenience. -

            - -

            -As we know the KERNEL names for these devices, rule writing is simple. Here are some examples for my system: -

            - -
            -SUBSYSTEM=="block", KERNEL=="hdc", SYMLINK+="dvd", GROUP="cdrom"
            -SUBSYSTEM=="block", KERNEL=="hdd", SYMLINK+="dvdrw", GROUP="cdrom"
            -
            - - -

            Network interfaces

            - -

            -Even though they are referenced by names, network interfaces typically do not have device nodes associated with them. Despite that, the rule writing process is almost identical. -

            - -

            -It makes sense to simply match the MAC address of your interface in the rule, as this is unique. However, make sure that you use the exact MAC address as shown as udevadm info, because if you do not match the case exactly, your rule will not work. -

            - -
            -# udevadm info -a -p /sys/class/net/eth0
            -  looking at class device '/sys/class/net/eth0':
            -    KERNEL=="eth0"
            -    ATTR{address}=="00:52:8b:d5:04:48"
            -
            - -

            -Here is my rule: -

            - -
            KERNEL=="eth*", ATTR{address}=="00:52:8b:d5:04:48", NAME="lan"
            - -

            -You will need to reload the net driver for this rule to take effect. You can either unload and reload the module, or simply reboot the system. You will also need to reconfigure your system to use "lan" rather than "eth0". I had some troubles getting this going (the interface wasn't being renamed) until I had completely dropped all references to eth0. -After that, you should be able to use "lan" instead of "eth0" in any calls to ifconfig or similar utilities. -

            - -

            Testing and debugging

            - - -

            Putting your rules into action

            - -

            -Assuming you are on a recent kernel with inotify support, udev will automatically monitor your rules directory and automatically pick up any modifications you make to the rule files. -

            - -

            -Despite this, udev will not automatically reprocess all devices and attempt to apply the new rule(s). For example, if you write a rule to add an extra symbolic link for your camera while your camera is plugged in, you cannot expect the extra symbolic link to show up right away. -

            - -

            -To make the symbolic link show up, you can either disconnect and reconnect your camera, or alternatively in the case of non-removable devices, you can run udevadm trigger. -

            - - -

            udevadm test

            - -

            -If you know the top-level device path in sysfs, you can use udevadm test to show the actions which udev would take. This may help you debug your rules. For example, assuming you want to debug a rule which acts on /sys/class/sound/dsp: -

            - -
            -# udevadm test /class/sound/dsp
            -main: looking at device '/class/sound/dsp' from subsystem 'sound'
            -udev_rules_get_name: add symlink 'dsp'
            -udev_rules_get_name: rule applied, 'dsp' becomes 'sound/dsp'
            -udev_device_event: device '/class/sound/dsp' already known, remove possible symlinks
            -udev_node_add: creating device node '/dev/sound/dsp', major = '14', minor = '3', mode = '0660', uid = '0', gid = '18'
            -udev_node_add: creating symlink '/dev/dsp' to 'sound/dsp'
            -
            - -

            -Note the /sys prefix was removed from the udevadm test test command line argument, this is because udevadm test operates on device paths. -

            - - -

            Author and contact

            - -

            -This document is written by Daniel Drake <dan@reactivated.net>. Feedback is appreciated. -

            - -

            -For support, you should mail the linux-hotplug mailing list: linux-hotplug-devel@lists.sourceforge.net. -

            - -

            -Copyright (C) 2003-2006 Daniel Drake.
            -This document is licensed under the GNU General Public License, Version 2. -

            - - - - -- cgit v1.2.3-54-g00ecf From eea1fd84f0088022ec681700d32dd9ef337b3538 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 25 Jan 2010 11:10:10 +0100 Subject: update README and NEWS --- NEWS | 1 + README | 87 ++++++++++++++++++++++++++++++++++++++++++------------------------ 2 files changed, 57 insertions(+), 31 deletions(-) diff --git a/NEWS b/NEWS index ba8d662d54..5b23a8b6c1 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ udev 151 ======== +Bugfixes. udev 150 ======== diff --git a/README b/README index 664457de0f..6e09b3a52d 100644 --- a/README +++ b/README @@ -1,9 +1,13 @@ -udev - userspace device management +udev - Linux userspace device management -Integrating udev in the system has complex dependencies and differs from distro -to distro. All major distros depend on udev these days and the system may not -work without a properly installed version. The upstream udev project does not -recommend to replace a distro's udev installation with the upstream version. +Integrating udev in the system has complex dependencies and may differ from +distribution to distribution. A system may not be able to boot up or work +reliably without a properly installed udev version. The upstream udev project +does not recommend to replace a distro's udev installation with the upstream +version. + +The upstream udev project's set of default rules may require a most recent +kernel release to work properly. Tools and rules shipped by udev are not public API and may change at any time. Never call any private tool in /lib/udev from any external application, it might @@ -27,14 +31,19 @@ Requirements: CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes) CONFIG_BLK_DEV_BSG=y (SCSI devices) - - For reliable operations, the kernel must not use the CONFIG_SYSFS_DEPRECATED* - option. + - Udev will not work with the CONFIG_SYSFS_DEPRECATED* option. - Unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, but it is not supported. + - The deprecated hotplug helper /sbin/hotplug should be disabled in the + kernel configuration, it is not needed today, and may render the system + unusable because the kernel may create too many processes in parallel + so that the system runs out-of-memory. + - The proc filesystem must be mounted on /proc, the sysfs filesystem must - be mounted at /sys. No other locations are supported by udev. + be mounted at /sys. No other locations are supported by a standard + udev installation. - The system must have the following group names resolvable at udev startup: disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, kmem. @@ -42,35 +51,51 @@ Requirements: these group names with only the rootfs mounted, and while no network is available. - - To build all udev extras, libacl, libglib2, libusb, usbutils, pciutils, + - To build all 'udev extras', libacl, libglib2, libusb, usbutils, pciutils, gperf are needed. These dependencies can be disabled with the - --disable-extras option. - -Operation: - Udev creates and removes device nodes in /dev, based on events the kernel - sends out on device discovery or removal. + --disable-extras configure option. - - Early in the boot process, the /dev directory should get a 'tmpfs' - filesystem mounted, which is maintained by udev. Created nodes or changed - permissions will not survive a reboot, which is intentional. +Setup: + - At bootup, the /dev directory should get the 'devtmpfs' filesystem + mounted. Udev will manage permissions and ownership of the kernel-created + device nodes, and possibly create additional symlinks. If needed, udev also + works on an empty 'tmpfs' filesystem, but some static device nodes like + /dev/null, /dev/console, /dev/kmsg are needed to be able to start udev itself. - - The content of /lib/udev/devices directory which contains the nodes, + - The content of /lib/udev/devices directory which contains static content like symlinks and directories, which are always expected to be in /dev, should - be copied over to the tmpfs mounted /dev, to provide the required nodes - to initialize udev and continue booting. + be copied over to the mounted /dev directory: + cp -axT --remove-destination /lib/udev/devices /dev - - The deprecated hotplug helper /sbin/hotplug should be disabled in the - kernel configuration, it is not needed today, and may render the system - unusable because the kernel may create too many processes in parallel - so that the system runs out-of-memory. + - The udev daemon should be started to handle device events sent by the kernel. + During bootup, the kernel can be asked to send events for all already existing + devices, to apply the configuration to these devices. This is usually done by: + /sbin/udevadm trigger --type=subsystems + /sbin/udevadm trigger --type=devices + + - Restarting the daemon does never apply any rules to existing devices. - - All kernel events are matched against a set of specified rules in - /lib/udev/rules.d which make it possible to hook into the event - processing to load required kernel modules and setup devices. For all - devices the kernel exports a major/minor number, udev will create a - device node with the default kernel name, or the one specified by a - matching udev rule. + - New/changed rule files are picked up automatically, there is no daemon + restart or signal needed. + +Operation: + - Udev creates/removes device nodes in /dev, based on events the kernel + sends out on device creation/removal. + + - All kernel events are matched against a set of specified rules, which + possibly hook into the event processing and load required kernel + modules to setup devices. For all devices the kernel exports a major/minor + number, if needed, udev will create a device node with the default kernel + name. If specified, udev applies permissions/ownership to the device + node, creates additional symlinks pointing to the node, and executes + programs to handle the device. + + - The events udev handles, and the information udev merges into its device + database, can be accessed with libudev: + http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/ + http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/ + +For more details about udev and udev rules see the udev(7) man page. Please direct any comment/question to the linux-hotplug mailing list at: linux-hotplug@vger.kernel.org - -- cgit v1.2.3-54-g00ecf From 5754e74c089a727183a281aa9071979dff2a9477 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 27 Jan 2010 09:30:48 +0100 Subject: update tests --- .../usb5/5-2/5-2:1.0/tty/ttyACM0/uevent | 1 + test/udev-test.pl | 595 +++++++++------------ 2 files changed, 253 insertions(+), 343 deletions(-) diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent index 2ba9f43730..e6caaabf08 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent @@ -1,2 +1,3 @@ +DEVNAME=ttyACM0 MAJOR=166 MINOR=0 diff --git a/test/udev-test.pl b/test/udev-test.pl index 896bb228c4..aeca9486f7 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -35,7 +35,9 @@ my @tests = ( subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda" , + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "modem" , rules => < "modem" , rules => < "modem" , rules => < "modem" , rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "aaa", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "sub/direct/ory/modem" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "first_disk5" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "subdir/err/node" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node12345678", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "disk-ATA-sda" , rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "special-device-5" , + not_exp_name => "not" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "newline_removed" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "test-0:0:0:0" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo9" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "bar9" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo7" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo9" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo8" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "850:0:0:05" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "855" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "8550:0:0:0" , rules => < "/devices/virtual/tty/console", exp_name => "TTY", rules => < "/devices/virtual/tty/console", exp_name => "TTY" , rules => < "/devices/virtual/tty/console", exp_name => "foo" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "empty" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "non-existent" , rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0" , rules => < "create all possible partitions", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk15" , + exp_name => "sda15" , exp_majorminor => "8:15", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "/devices/virtual/block/fake!blockdev0", exp_name => "is/a/fake/blockdev0" , rules => < "block", devpath => "/devices/virtual/block/fake!blockdev0", exp_name => "fake/blockdev0" , + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "driver-is-sd", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "driver-is-ahci", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ignored", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "matched-with-space", rules => < "tty33", exp_perms => "0:0:0660", rules => < "node", exp_perms => "5000::0660", rules => < "node", exp_perms => ":100:0660", rules => < "node", exp_perms => "nobody::0660", rules => < "node", exp_perms => ":daemon:0660", rules => < "node", exp_perms => "root:mail:0660", rules => < "node", exp_perms => "::0777", rules => < "node", exp_perms => "5000:100:0777", rules => < "ttyACM0", exp_perms => "5000::", rules => < "ttyACM0", exp_perms => ":100:0660", rules => < "ttyACM0", exp_perms => "::0060", rules => < "ttyACM0", exp_perms => "5000:100:0777", rules => < < "permissions only rule with override at NAME rule", + desc => "permissions only rule with override at SYMLINK+ rule", subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", @@ -772,7 +772,7 @@ SUBSYSTEM=="tty", OWNER="3000" SUBSYSTEM=="tty", GROUP="4000" SUBSYSTEM=="tty", MODE="0777" KERNEL=="ttyUSX[0-9]*", OWNER="5001", GROUP="101", MODE="0444" -KERNEL=="ttyACM[0-9]*", NAME="ttyACM%n", GROUP="8000" +KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", GROUP="8000" EOF }, { @@ -782,7 +782,7 @@ EOF exp_name => "node", exp_majorminor => "8:0", rules => < "node", exp_majorminor => "4095:1", rules => < "node", exp_majorminor => "4095:89999", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink2-ttyACM0", - exp_target => "ttyACM-0", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "one", not_exp_name => " ", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem0", - exp_target => "ttyACM0", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", exp_name => "1/2/symlink" , exp_target => "a/b/node", + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", exp_name => "1/2/c/d/symlink" , exp_target => "../../a/b/node", + exp_rem_error => "yes", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "second-0" , - exp_target => "modem" , rules => < "symlink only rule", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "symlink-only2", - exp_target => "link", - rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => ".", - exp_target => "link", exp_add_error => "yes", exp_rem_error => "yes", rules => < "tty", devpath => "/devices/virtual/tty/tty0", exp_name => "link", - exp_target => "link", exp_add_error => "yes", exp_rem_error => "yes", option => "clean", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink0", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink-ttyACM0", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "major-166:0", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", - exp_target => "ttyACM0", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "this", - exp_target => "ttyACM0", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "test", - exp_target => "link", rules => < "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "166:0", - exp_target => "ttyACM0", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link1", - exp_target => "node", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link4", - exp_target => "node", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node6", + exp_rem_error => "yes", rules => < "node", exp_rem_error => "yes", rules => < "ignore remove event test (with all partitions)", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node14", + exp_name => "sda14", exp_rem_error => "yes", option => "clean", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "devpath substitution test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "main_device", option => "keep", + exp_rem_error => "yes", rules => < "main_device-part-1", option => "clean", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "start-udev-root-end", rules => < "last", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "match", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "not-anything", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "nonzero-program", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "true", rules => < "true", rules => < "true", rules => < < < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "sane", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "uber", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "replaced", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "serial-354172020305000", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", rules => < "apply NAME final", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "link", - exp_target => "ok", - rules => < "test RUN key", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "testsymlink", - exp_target => "ok", - exp_rem_error => "yes", - option => "clean", - rules => < "test RUN key and DEVNAME", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "testsymlink", - exp_target => "ok", - exp_rem_error => "yes", - option => "clean", - rules => < < "root:tty:0640", rules => < < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node-add-me", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "three", not_exp_name => "two", - exp_target => "node", rules => < "test empty NAME (empty override)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "", - not_exp_name => "wrong", - exp_add_error => "yes", - rules => < "test empty NAME (non-empty override)", + desc => "test empty SYMLINK+ (empty override)", subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", + not_exp_name => "wrong", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "keep", rules => < "parentenv-parent_right", option => "clean", rules => < "right", rules => < "right", rules => < "NAME compare test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "link", - exp_target => "node", - not_exp_name => "wronglink", - rules => < "NAME compare test 2", + desc => "SYMLINK+ compare test", subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "link2", - exp_target => "sda1", - not_exp_name => "link", + exp_name => "right", + not_exp_name => "wrong", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "yes", rules => < < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "00:16:41:e2:8d:ff", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "there", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "relative", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "found-subdir", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "0:0:0000", + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "5000:100:0400", + exp_rem_error => "yes", rules => < "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "0:0:0660", + exp_rem_error => "yes", rules => < <{desc}\n"; if ($rules->{exp_target}) { - print "device \'$rules->{devpath}\' expecting symlink '$rules->{exp_name}' to node \'$rules->{exp_target}\'\n"; + print "device \'$rules->{devpath}\' expecting link '$rules->{exp_name}' to node \'$rules->{exp_target}\'\n"; } else { - print "device \'$rules->{devpath}\' expecting node \'$rules->{exp_name}\'\n"; + print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; } @@ -1813,7 +1719,8 @@ sub run_test { if ((-e "$PWD/$udev_root$rules->{not_exp_name}") || (-l "$PWD/$udev_root$rules->{not_exp_name}")) { print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; - $error++ + $error++; + sleep(1); } } @@ -1842,6 +1749,7 @@ sub run_test { system("tree $udev_root"); print "\n"; $error++; + sleep(1); } } @@ -1861,6 +1769,7 @@ sub run_test { system("tree $udev_root"); print "\n"; $error++; + sleep(1); } } else { print "remove: ok\n"; -- cgit v1.2.3-54-g00ecf From f5846e8c220b5408a81582089dbf89162a32ca91 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 27 Jan 2010 09:34:28 +0100 Subject: release 151 --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/ChangeLog b/ChangeLog index 12785c4f92..d07f7d2c4b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Summary of changes from v150 to v151 +============================================ + +Amit Shah (1): + rules: Add symlink rule for virtio ports + +Bryan Kadzban (1): + Fix reverted floppy-device permissions + +Egbert Eich (1): + rulews: suse - add do-not-load-KMS-modules rules + +Frederic Crozat (1): + rules: acl - add COLOR_MEASUREMENT_DEVICE match + +Kay Sievers (11): + configure.ac: version bump + udevd: inotify - do not parse rules at create but at close + do not remove device nodes of active kernel devices + libudev: device - create db file atomically + clarify message about not removed device node + input_id: include limits.h + keymap: include linux/limits.h + keymap: linux/input.h - get absolute include path from gcc + delete outdated and unmaintained writing_udev_rules + update README and NEWS + update tests + +Marco d'Itri (2): + writing_udev_rules: update rules files names + keymap: support for the Samsung N140 keyboard + +Martin Pitt (4): + add ACL rule for Garmin GPSMap 60 + keymap: move force-release directory + extras/keymap/check-keymaps.sh: Ignore comment-only lines + keymap: Fix invalid map line + + Summary of changes from v149 to v150 ============================================ -- cgit v1.2.3-54-g00ecf From 86a7a2f853fe6022c5b0c1b415918047b65533be Mon Sep 17 00:00:00 2001 From: Thomas Bächler Date: Sun, 31 Jan 2010 13:49:02 +0100 Subject: firmware: fix error reporting on missing firmware files The new firmware loader does not report an error to the kernel if a firmware file is missing. This results in modprobe stalling for 60 seconds for each firmware a module tries to load. --- extras/firmware/firmware.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c index 8f70be42ac..16455dec8f 100644 --- a/extras/firmware/firmware.c +++ b/extras/firmware/firmware.c @@ -149,6 +149,7 @@ int main(int argc, char **argv) util_path_encode(firmware, fwencpath, sizeof(fwencpath)); util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.udev/firmware-missing/", fwencpath, NULL); + util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); if (fwfile == NULL) { int err; @@ -166,6 +167,7 @@ int main(int argc, char **argv) udev_selinux_resetfscreatecon(udev); } while (err == -ENOENT); rc = 2; + set_loading(udev, loadpath, "-1"); goto exit; } @@ -176,7 +178,6 @@ int main(int argc, char **argv) if (unlink(misspath) == 0) util_delete_path(udev, misspath); - util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); set_loading(udev, loadpath, "1"); util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL); -- cgit v1.2.3-54-g00ecf From fc47e0b56779ceeaaa40d2dc3248fa002af63aaa Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 1 Feb 2010 15:27:46 -0800 Subject: keymap: Add Dell Inspiron 1011 (Mini 10) This fixes the broken WLAN key. --- extras/keymap/95-keymap.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 2b1c4bd5d7..51c8c3bfb1 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -53,6 +53,8 @@ GOTO="keyboard_end" LABEL="keyboard_vendorcheck" ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 1011", RUN+="keymap $name 0x84 wlan" + ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" -- cgit v1.2.3-54-g00ecf From d7e2d38c1f0ead2239808dd117577a99a3ad3cde Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 9 Feb 2010 15:47:47 +0100 Subject: Fix brightness keys on MSI Wind U-100 The MSI Wind 100 generates ACPI/input events on the LNXVIDEO input device. On top of that, the video module/BIOS synthesize some extra event on atkbd as an echo of actually changing the brightness. Ignore the wrong and useless atkbd ones, to avoid event loops. Many thanks to Hans de Goede for tracking this down! https://launchpad.net/bugs/415023 --- extras/keymap/95-keymap.rules | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 51c8c3bfb1..684619b5c5 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -98,6 +98,11 @@ ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $ ENV{DMI_VENDOR}=="MICRO-STAR*", RUN+="keymap $name micro-star" +# some MSI models generate ACPI/input events on the LNXVIDEO input devices, +# plus some extra synthesized ones on atkbd as an echo of actually changing the +# brightness; so ignore those atkbd ones, to avoid loops +ENV{DMI_VENDOR}=="MICRO-STAR*", ATTR{[dmi/id]product_name}=="*U-100*|*U100*|*N033", RUN+="keymap $name 0xF7 reserved 0xF8 reserved" + ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" -- cgit v1.2.3-54-g00ecf From 063985ef7dd6050f33920700777831426b221697 Mon Sep 17 00:00:00 2001 From: Robert Hooker Date: Sun, 7 Feb 2010 13:56:27 -0500 Subject: keymap: Add support for Gateway AOA110/AOA150 clones. https://launchpad.net/bugs/518496 Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 684619b5c5..d3690bb33e 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -71,6 +71,9 @@ ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*" # HP Pavillion dv6315ea has empty DMI_VENDOR ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play +# Gateway clone of Acer Aspire One AOA110/AOA150 +ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer" + ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" -- cgit v1.2.3-54-g00ecf From 4c514e31734a704ca58e543fa4330616ba584b39 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 12 Feb 2010 19:25:47 +0100 Subject: keymap: Fix LG X110 The LG X110 is not a perfect clone of the MSI Wind after all, and needs its own keymap. Thanks to Konstantin Lavrov! https://launchpad.net/bugs/520650 --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 3 +-- extras/keymap/keymaps/lg-x110 | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 extras/keymap/keymaps/lg-x110 diff --git a/Makefile.am b/Makefile.am index 728076a452..069bf7fb22 100644 --- a/Makefile.am +++ b/Makefile.am @@ -518,6 +518,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ + extras/keymap/keymaps/lg-x110 \ extras/keymap/keymaps/logitech-wave \ extras/keymap/keymaps/logitech-wave-cordless \ extras/keymap/keymaps/maxdata-pro_7000 \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index d3690bb33e..fcd42aae32 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -93,8 +93,7 @@ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="Amilo Li 1718", RUN+="keymap $name 0xD6 wlan" -# MSI Wind clone -ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name micro-star" +ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name lg-x110" ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" diff --git a/extras/keymap/keymaps/lg-x110 b/extras/keymap/keymaps/lg-x110 new file mode 100644 index 0000000000..a61cf3d21e --- /dev/null +++ b/extras/keymap/keymaps/lg-x110 @@ -0,0 +1,12 @@ +0xA0 mute # Fn-F9 +0xAE volumedown # Fn-Left +0xAF search # Fn-F3 +0xB0 volumeup # Fn-Right +0xB1 battery # Fn-F10 Info +0xB3 suspend # Fn-F12 +0xDF sleep # Fn-F4 +# 0xE2 bluetooth # satellite dish2 +0xE4 f22 # Fn-F5 Touchpad disable +0xF6 wlan # Fn-F6 +0xF7 reserved # brightnessdown # Fn-Down +0xF8 reserved # brightnessup # Fn-Up \ No newline at end of file -- cgit v1.2.3-54-g00ecf From b15bb8019094797aee65f35e3e654354b61bfd7b Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Fri, 12 Feb 2010 18:08:08 -0600 Subject: Force key release for volume keys on Dell Studio 1557 Dell Studio 1557 does not generate a release code when the volume keys are pressed, causing them to generate infinite key presses. This forces key release of these keys. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- Makefile.am | 3 ++- extras/keymap/95-keyboard-force-release.rules | 2 ++ extras/keymap/force-release-maps/dell-studio-1557 | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100755 extras/keymap/force-release-maps/dell-studio-1557 diff --git a/Makefile.am b/Makefile.am index 069bf7fb22..1b4e2eacae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -541,7 +541,8 @@ dist_udevkeymap_DATA = \ udevkeymapforcereldir = $(libexecdir)/keymaps/force-release dist_udevkeymapforcerel_DATA = \ - extras/keymap/force-release-maps/samsung-other + extras/keymap/force-release-maps/samsung-other \ + extras/keymap/force-release-maps/dell-studio-1557 extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h mkdir -p extras/keymap diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 689afe92fe..659ee9585a 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -21,4 +21,6 @@ ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*", RUN+="keyboard-force-release.sh $devpath samsung-other" +ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" + LABEL="force_release_end" diff --git a/extras/keymap/force-release-maps/dell-studio-1557 b/extras/keymap/force-release-maps/dell-studio-1557 new file mode 100755 index 0000000000..171867316d --- /dev/null +++ b/extras/keymap/force-release-maps/dell-studio-1557 @@ -0,0 +1,3 @@ +0xa0 #mute +0xae #volume up +0xb0 #volume down -- cgit v1.2.3-54-g00ecf From 4ca91a04e8b727a079a973fdd9bc2b093e8315a5 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 15 Feb 2010 13:15:25 +0100 Subject: keymap: Add Toshiba Satellite M30X Thanks to Alessio Gaeta! https://launchpad.net/bugs/510019 --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 1 + extras/keymap/keymaps/toshiba-satellite_m30x | 7 +++++++ 3 files changed, 9 insertions(+) create mode 100644 extras/keymap/keymaps/toshiba-satellite_m30x diff --git a/Makefile.am b/Makefile.am index 1b4e2eacae..db23f16e24 100644 --- a/Makefile.am +++ b/Makefile.am @@ -537,6 +537,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/samsung-sx20s \ extras/keymap/keymaps/toshiba-satellite_a100 \ extras/keymap/keymaps/toshiba-satellite_a110 \ + extras/keymap/keymaps/toshiba-satellite_m30x \ extras/keymap/keymaps/zepto-znote udevkeymapforcereldir = $(libexecdir)/keymaps/force-release diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index fcd42aae32..65b0d6eb0d 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -115,6 +115,7 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="S ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite M30X", RUN+="keymap $name toshiba-satellite_m30x" ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" diff --git a/extras/keymap/keymaps/toshiba-satellite_m30x b/extras/keymap/keymaps/toshiba-satellite_m30x new file mode 100644 index 0000000000..cf6d912be5 --- /dev/null +++ b/extras/keymap/keymaps/toshiba-satellite_m30x @@ -0,0 +1,7 @@ +0xef brightnessdown +0xd9 brightnessup +0xee screenlock +0x93 media +0x9e prog1 #touchpad_enable +0x9f prog2 #touchpad_disable + -- cgit v1.2.3-54-g00ecf From a571c23e954cb88cdd5faa28593b19bd7c340130 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Wed, 17 Feb 2010 15:26:00 +0000 Subject: libudev: export udev_monitor_set_receive_buffer_size() This function is useful for anything that's likely to be running alongside udevd during cold-plugging, and is using libudev to receive the events. It makes little sense for it to be private, or to require other software to relearn how to adjust the buffer size. Signed-off-by: Scott James Remnant --- libudev/exported_symbols | 1 + libudev/libudev-private.h | 1 - libudev/libudev.h | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libudev/exported_symbols b/libudev/exported_symbols index 018463dd91..f48025a423 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -51,6 +51,7 @@ udev_enumerate_scan_subsystems udev_enumerate_add_syspath udev_monitor_new_from_socket udev_monitor_new_from_netlink +udev_monitor_set_receive_buffer_size udev_monitor_enable_receiving udev_monitor_ref udev_monitor_unref diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index c2fff00211..0d28b80fda 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -109,7 +109,6 @@ int udev_monitor_disconnect(struct udev_monitor *udev_monitor); int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_monitor *destination, struct udev_device *udev_device); -int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); /* libudev-ctrl.c - daemon runtime setup */ struct udev_ctrl; diff --git a/libudev/libudev.h b/libudev/libudev.h index ad11059f2c..9576ad49ca 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -111,6 +111,7 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); /* bind socket */ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); +int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); int udev_monitor_get_fd(struct udev_monitor *udev_monitor); struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); /* in-kernel socket filters to select messages that get delivered to a listener */ -- cgit v1.2.3-54-g00ecf From 0fe3c26eab97c4ee381918e6925a6cd798be5f39 Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Wed, 17 Feb 2010 15:27:36 +0000 Subject: udevadm monitor: increase netlink buffer size A common use (e.g. in Ubuntu) for udevadm monitor is to log the events received by udev during boot; events can be lost of the buffer size isn't increased as udevd does. Signed-off-by: Scott James Remnant --- udev/udevadm-monitor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 00b130dafe..ea4b7dccbe 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -158,6 +158,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) rc = 1; goto out; } + udev_monitor_set_receive_buffer_size(udev_monitor, 128*1024*1024); udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { const char *subsys = udev_list_entry_get_name(entry); @@ -183,6 +184,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) rc = 3; goto out; } + udev_monitor_set_receive_buffer_size(udev, 128*1024*1024); udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { const char *subsys = udev_list_entry_get_name(entry); -- cgit v1.2.3-54-g00ecf From e0fcf21c030027101338c7673c5cb814b82261d1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Feb 2010 11:03:09 +0100 Subject: libudev: bump minor version --- Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index db23f16e24..3780f50797 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,9 +28,9 @@ CLEANFILES = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=6 -LIBUDEV_REVISION=1 -LIBUDEV_AGE=6 +LIBUDEV_CURRENT=7 +LIBUDEV_REVISION=0 +LIBUDEV_AGE=7 SUBDIRS += libudev/docs -- cgit v1.2.3-54-g00ecf From 044bd2bcc7a160c97f7dd052d6de50d35186df13 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Feb 2010 11:03:28 +0100 Subject: udevadm: fix untested and broken commit to set buffer size --- udev/udevadm-monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index ea4b7dccbe..4063c48303 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -184,7 +184,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) rc = 3; goto out; } - udev_monitor_set_receive_buffer_size(udev, 128*1024*1024); + udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { const char *subsys = udev_list_entry_get_name(entry); -- cgit v1.2.3-54-g00ecf From fff82e9d77415111193d9547bbe3618892147b39 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Feb 2010 11:09:25 +0100 Subject: configure.ac: version bump --- NEWS | 6 ++++++ configure.ac | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 5b23a8b6c1..a4d46d7b0c 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +udev 152 +======== +Bugfixes. + +New and fixed keymaps. + udev 151 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 4cecb868f5..88824b63b3 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [151], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [152], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 20b48c3727eef1f266cbfd6bf5854b5c1419beb9 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Tue, 2 Mar 2010 13:55:03 +0100 Subject: keymap: Add Samsung Q210/P210 force-release quirk The Samsung Q210/P210 laptop also needs all of its function keys quirked. https://launchpad.net/bugs/530093 Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 659ee9585a..48b896d9f7 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*", RUN+="keyboard-force-release.sh $devpath samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" -- cgit v1.2.3-54-g00ecf From da96a11b9c9164447bef206db47c405342ab8daa Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Tue, 2 Mar 2010 14:00:32 +0100 Subject: keymap: Add Fujitsu Amilo 1848+u force-release quirk The Fujitsu Amilo Si 1848+u laptop requires the volume and mute keys quirking. https://launchpad.net/bugs/530089 Signed-off-by: Martin Pitt --- Makefile.am | 1 + extras/keymap/95-keyboard-force-release.rules | 2 ++ extras/keymap/force-release-maps/fujitsu-amilo-si1848 | 3 +++ 3 files changed, 6 insertions(+) create mode 100644 extras/keymap/force-release-maps/fujitsu-amilo-si1848 diff --git a/Makefile.am b/Makefile.am index 3780f50797..471c5dd2f1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -543,6 +543,7 @@ dist_udevkeymap_DATA = \ udevkeymapforcereldir = $(libexecdir)/keymaps/force-release dist_udevkeymapforcerel_DATA = \ extras/keymap/force-release-maps/samsung-other \ + extras/keymap/force-release-maps/fujitsu-amilo-si1848 \ extras/keymap/force-release-maps/dell-studio-1557 extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 48b896d9f7..28639a5932 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -23,4 +23,6 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="* ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" +ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u", RUN+="keyboard-force-release.sh $devpath fujitsu-amilo-si1848" + LABEL="force_release_end" diff --git a/extras/keymap/force-release-maps/fujitsu-amilo-si1848 b/extras/keymap/force-release-maps/fujitsu-amilo-si1848 new file mode 100644 index 0000000000..171867316d --- /dev/null +++ b/extras/keymap/force-release-maps/fujitsu-amilo-si1848 @@ -0,0 +1,3 @@ +0xa0 #mute +0xae #volume up +0xb0 #volume down -- cgit v1.2.3-54-g00ecf From ecd42de2c56b4fcf0069b8b4a4d6607710e5de61 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 2 Mar 2010 17:06:33 -0500 Subject: Decrease buffer size when advancing past NUL byte Otherwise we'll overflow the buffer if space is tight. Also add a comment explaining this. Signed-off-by: David Zeuthen --- libudev/libudev-device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 71fc775242..4f42aa2810 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1166,7 +1166,9 @@ static int update_envp_monitor_buf(struct udev_device *udev_device) l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL); if (l == 0) return -EINVAL; + /* advance past the trailing '\0' that util_strpcpyl() guarantees */ s++; + l--; } udev_device->envp[i] = NULL; udev_device->monitor_buf_len = s - udev_device->monitor_buf; -- cgit v1.2.3-54-g00ecf From 3a19299202b5d34b89d5910fde25e8a4cfa2b31a Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 2 Mar 2010 17:07:14 -0500 Subject: Use UTIL_LINE_SIZE, not UTIL_PATH_SIZE to truncate properties Signed-off-by: David Zeuthen --- libudev/libudev-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 4f42aa2810..b841745991 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1089,7 +1089,7 @@ struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) { - char name[UTIL_PATH_SIZE]; + char name[UTIL_LINE_SIZE]; char *val; util_strscpy(name, sizeof(name), property); -- cgit v1.2.3-54-g00ecf From e32d5237ea045045c621edba7341631abd602d74 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 2 Mar 2010 17:10:02 -0500 Subject: Increase UTIL_LINE_SIZE from 2048 to 16384 Recent udisks versions, for LVM2 integration, ships with probers that produce very long lines such as UDISKS_LVM2_PV_VG_PV_LIST= uuid=98lyZl-Ya7U-p26Z-Ia7b-xf8u-xZqP-jc4njb;size=2000397795328;allocated_size=2000397795328 uuid=iFs0cM-sxCF-ceQK-hZl1-kbwo-ZTjq-gSewQR;size=2000397795328;allocated_size=2000397795328 [...] e.g. roughly 100 bytes per LVM2 physical volume for each LVM2 PV encountered. Signed-off-by: David Zeuthen --- libudev/libudev-private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 0d28b80fda..e0c51dca05 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -187,7 +187,7 @@ int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, /* libudev-util.c */ #define UTIL_PATH_SIZE 1024 #define UTIL_NAME_SIZE 512 -#define UTIL_LINE_SIZE 2048 +#define UTIL_LINE_SIZE 16384 #define UDEV_ALLOWED_CHARS_INPUT "/ $%?," ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); -- cgit v1.2.3-54-g00ecf From 3c4b1738a9d591d7ddce361ea184b76b253c4e87 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Fri, 26 Feb 2010 14:05:41 +0530 Subject: Fix virtio-ports rule to use $attr instead of $ATTR Newer udev versions don't understand $ATTR. Signed-off-by: Amit Shah Signed-off-by: Martin Pitt --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index f8556d1940..da1535f92b 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -18,7 +18,7 @@ KERNEL=="mwave", GROUP="dialout" KERNEL=="hvc*|hvsi*", GROUP="dialout" # virtio serial / console ports -KERNEL=="vport*", SYMLINK+="virtio-ports/$ATTR{name}" +KERNEL=="vport*", SYMLINK+="virtio-ports/$attr{name}" # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" -- cgit v1.2.3-54-g00ecf From 5c3ebbf35a2c101e0212c7066f0d65e457fcf40c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 4 Mar 2010 00:48:59 +0100 Subject: udev-acl: Correctly handle ENV{ACL_MANAGE}==0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a custom rule sets ACL_MANAGE to 0 to disable ACL management for a particular device, handle this as "disabled", by explicitly checking against "1" instead of "nonempty". Thanks to Rafał Rzepecki for pointing this out. --- extras/udev-acl/70-acl.rules | 2 +- extras/udev-acl/udev-acl.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 8380f53eb3..874667c5b1 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -69,7 +69,7 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", ENV{ACL_MANAG ENV{COLOR_MEASUREMENT_DEVICE}=="*?", ENV{ACL_MANAGE}="1" # apply ACL for all locally logged in users -LABEL="acl_apply", ENV{ACL_MANAGE}=="?*", TEST=="/var/run/ConsoleKit/database", \ +LABEL="acl_apply", ENV{ACL_MANAGE}=="1", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" LABEL="acl_end" diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index e670ce707f..c070fccd17 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -289,7 +289,7 @@ static void apply_acl_to_devices(uid_t uid, int add) /* iterate over all devices tagged with ACL_SET */ udev = udev_new(); enumerate = udev_enumerate_new(udev); - udev_enumerate_add_match_property(enumerate, "ACL_MANAGE", "*"); + udev_enumerate_add_match_property(enumerate, "ACL_MANAGE", "1"); udev_enumerate_scan_devices(enumerate); udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { struct udev_device *device; -- cgit v1.2.3-54-g00ecf From 9a87132677191e49c3d464c91aac7fc218e1eb18 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 7 Mar 2010 13:47:34 +0100 Subject: udev-acl: no not encourage use of ACL_MANAGE outside of rules file --- extras/udev-acl/70-acl.rules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 874667c5b1..fde265693c 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -1,7 +1,9 @@ # do not edit this file, it will be overwritten on update +# Do not use ACL_MANAGE outside of this file. This variable is private to +# udev-acl of this udev release and may be replaced at any time. + ENV{MAJOR}=="", GOTO="acl_end" -ENV{ACL_MANAGE}=="0", GOTO="acl_end" ACTION!="add|change", GOTO="acl_apply" # PTP/MTP protocol devices, cameras, portable media players -- cgit v1.2.3-54-g00ecf From a245a97b4e805c65ce22659742371550ccf002c1 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 10 Mar 2010 12:17:03 +0100 Subject: input_id: Fix linking Link against libudev-private.a instead of libudev.a, to avoid runtime dependency to libudev. --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 471c5dd2f1..99a0133b3a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -239,7 +239,7 @@ dist_udevrules_DATA += extras/floppy/60-floppy.rules # input_id - import input device class # ------------------------------------------------------------------------------ extras_input_id_input_id_SOURCES = extras/input_id/input_id.c -extras_input_id_input_id_LDADD = libudev/libudev.la +extras_input_id_input_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/input_id/input_id # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From 455f792e4791e037eb0406005b92c345cf0baf56 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Mar 2010 14:43:07 +0100 Subject: replace utimes() with utimensat() --- udev/udev-node.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index a70c147d3e..307a76b271 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -57,7 +57,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod preserve = 1; udev_selinux_lsetfilecon(udev, file, mode); /* update time stamp when we re-use the node, like on media change events */ - utimes(file, NULL); + utimensat(AT_FDCWD, file, NULL, 0); } else { char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; @@ -178,7 +178,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) info(udev, "preserve already existing symlink '%s' to '%s'\n", slink, target); udev_selinux_lsetfilecon(udev, slink, S_IFLNK); - lutimes(slink, NULL); + utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); goto exit; } } -- cgit v1.2.3-54-g00ecf From fbb31cd6e10fe66d2da781db0ba9a8d671a4c6aa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Mar 2010 14:52:42 +0100 Subject: libbudev-private: rename udev_list_entry_get_flag() --- libudev/libudev-device-private.c | 4 ++-- libudev/libudev-device.c | 4 ++-- libudev/libudev-list.c | 10 +++++----- libudev/libudev-private.h | 9 ++++++--- udev/udev-event.c | 2 +- udev/udev-node.c | 2 +- udev/udev-rules.c | 12 ++++++------ 7 files changed, 23 insertions(+), 20 deletions(-) diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 07249c3885..1bcf441237 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -39,7 +39,7 @@ int udev_device_update_db(struct udev_device *udev_device) util_strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_flag(list_entry)) + if (udev_list_entry_get_flags(list_entry)) goto file; if (udev_device_get_num_fake_partitions(udev_device) != 0) goto file; @@ -102,7 +102,7 @@ file: if (udev_device_get_watch_handle(udev_device) >= 0) fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - if (!udev_list_entry_get_flag(list_entry)) + if (!udev_list_entry_get_flags(list_entry)) continue; fprintf(f, "E:%s=%s\n", udev_list_entry_get_name(list_entry), diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index b841745991..aec5fb57fe 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2009 Kay Sievers + * Copyright (C) 2008-2010 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1068,7 +1068,7 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink if (list_entry == NULL) return -ENOMEM; if (unique) - udev_list_entry_set_flag(list_entry, 1); + udev_list_entry_set_flags(list_entry, 1); return 0; } diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c index f6637fc92d..b5e96458cc 100644 --- a/libudev/libudev-list.c +++ b/libudev/libudev-list.c @@ -38,7 +38,7 @@ struct udev_list_entry { struct udev_list_node *list; char *name; char *value; - int flag; + unsigned int flags; }; /* list head point to itself if empty */ @@ -258,16 +258,16 @@ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) return list_entry->value; } -int udev_list_entry_get_flag(struct udev_list_entry *list_entry) +unsigned int udev_list_entry_get_flags(struct udev_list_entry *list_entry) { if (list_entry == NULL) return -EINVAL; - return list_entry->flag; + return list_entry->flags; } -void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag) +void udev_list_entry_set_flags(struct udev_list_entry *list_entry, unsigned int flags) { if (list_entry == NULL) return; - list_entry->flag = flag; + list_entry->flags = flags; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index e0c51dca05..5ee0c58be8 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2009 Kay Sievers + * Copyright (C) 2008-2010 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -82,6 +82,9 @@ const char *udev_device_get_devpath_old(struct udev_device *udev_device); const char *udev_device_get_sysname_old(struct udev_device *udev_device); int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); const char *udev_device_get_knodename(struct udev_device *udev_device); +int udev_device_add_tag(struct udev_device *udev_device, const char *tag); +struct udev_list_entry *udev_device_get_tag_list_entry(struct udev_device *udev_device); +int udev_device_has_tag(struct udev_device *udev_device, const char *tag); int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename); int udev_device_get_timeout(struct udev_device *udev_device); int udev_device_set_timeout(struct udev_device *udev_device, int timeout); @@ -163,8 +166,8 @@ void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list); void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list); struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); -int udev_list_entry_get_flag(struct udev_list_entry *list_entry); -void udev_list_entry_set_flag(struct udev_list_entry *list_entry, int flag); +unsigned int udev_list_entry_get_flags(struct udev_list_entry *list_entry); +void udev_list_entry_set_flags(struct udev_list_entry *list_entry, unsigned int flags); #define udev_list_entry_foreach_safe(entry, tmp, first) \ for (entry = first, tmp = udev_list_entry_get_next(entry); \ entry != NULL; \ diff --git a/udev/udev-event.c b/udev/udev-event.c index 4e1773ffea..986c119fbb 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -729,7 +729,7 @@ int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask) != 0) { - if (udev_list_entry_get_flag(list_entry)) + if (udev_list_entry_get_flags(list_entry)) err = -1; } } diff --git a/udev/udev-node.c b/udev/udev-node.c index 307a76b271..23bfade28c 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -405,7 +405,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - if (udev_list_entry_get_flag(list_entry)) + if (udev_list_entry_get_flags(list_entry)) /* simple unmanaged link name */ node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry)); else diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 3da2033d51..60daad520a 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -717,7 +717,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) entry = udev_device_add_property(dev, key, val); /* store in db, skip private keys */ if (key[0] != '.') - udev_list_entry_set_flag(entry, 1); + udev_list_entry_set_flags(entry, 1); } return 0; } @@ -785,7 +785,7 @@ static int import_parent_into_properties(struct udev_device *dev, const char *fi entry = udev_device_add_property(dev, key, val); /* store in db, skip private keys */ if (key[0] != '.') - udev_list_entry_set_flag(entry, 1); + udev_list_entry_set_flags(entry, 1); } } return 0; @@ -1831,13 +1831,13 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) filename_off = add_string(rules, filename); /* the offset in the rule is limited to unsigned short */ if (filename_off < USHRT_MAX) - udev_list_entry_set_flag(file_loop, filename_off); + udev_list_entry_set_flags(file_loop, filename_off); } /* parse list of files */ udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { const char *filename = udev_list_entry_get_name(file_loop); - unsigned int filename_off = udev_list_entry_get_flag(file_loop); + unsigned int filename_off = udev_list_entry_get_flags(file_loop); if (stat(filename, &statbuf) == 0 && statbuf.st_size > 0) parse_file(rules, filename, filename_off); @@ -2420,7 +2420,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event entry = udev_device_add_property(event->dev, name, temp_value); /* store in db, skip private keys */ if (name[0] != '.') - udev_list_entry_set_flag(entry, 1); + udev_list_entry_set_flags(entry, 1); } else { udev_device_add_property(event->dev, name, NULL); } @@ -2542,7 +2542,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event list_entry = udev_list_entry_add(event->udev, &event->run_list, &rules->buf[cur->key.value_off], NULL, 1, 0); if (cur->key.fail_on_error) - udev_list_entry_set_flag(list_entry, 1); + udev_list_entry_set_flags(list_entry, 1); break; } case TK_A_GOTO: -- cgit v1.2.3-54-g00ecf From a00ff5db021b50864ba50cce15865bca2d52f91f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Mar 2010 15:00:00 +0100 Subject: udevadm: monitor - use / as separator in --subsystem-match=subsystem[/devtype] --- udev/udevadm-monitor.c | 12 ++++++------ udev/udevadm.xml | 6 ++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 4063c48303..d136c6070a 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Kay Sievers + * Copyright (C) 2004-2010 Kay Sievers * * 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 @@ -111,7 +111,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) char *devtype; util_strscpy(subsys, sizeof(subsys), optarg); - devtype = strchr(subsys, ':'); + devtype = strchr(subsys, '/'); if (devtype != NULL) { devtype[0] = '\0'; devtype++; @@ -121,10 +121,10 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) } case 'h': printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" - " --property print the event properties\n" - " --kernel print kernel uevents\n" - " --udev print udev events\n" - " --subsystem-match= filter events\n" + " --property print the event properties\n" + " --kernel print kernel uevents\n" + " --udev print udev events\n" + " --subsystem-match= filter events by subsystem\n" " --help\n\n"); default: goto out; diff --git a/udev/udevadm.xml b/udev/udevadm.xml index ad492494a1..fa1742bada 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -349,6 +349,12 @@ Also print the properties of the event. + + + + Filter events by subsystem[/devtype]. Only udev events with a matching subsystem value will pass. + + -- cgit v1.2.3-54-g00ecf From af24bb178eec6adcf4f04d3b183cd50a831c8b7e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Mar 2010 17:29:27 +0100 Subject: use major:minor as entries in symlink stack instead of devpath --- udev/udev-node.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 23bfade28c..4314cceb79 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -245,28 +245,26 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons for (;;) { struct udev_device *dev_db; struct dirent *dent; - char devpath[UTIL_PATH_SIZE]; - char syspath[UTIL_PATH_SIZE]; - ssize_t len; + int maj, min; + char type, type2; + dev_t devnum; dent = readdir(dir); if (dent == NULL || dent->d_name[0] == '\0') break; if (dent->d_name[0] == '.') continue; - dbg(udev, "found '%s/%s'\n", stackdir, dent->d_name); - len = readlinkat(dirfd(dir), dent->d_name, devpath, sizeof(devpath)); - if (len <= 0 || len == (ssize_t)sizeof(devpath)) + if (sscanf(dent->d_name, "%c%i:%i", &type, &maj, &min) != 3) continue; - devpath[len] = '\0'; - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - info(udev, "found '%s' claiming '%s'\n", syspath, stackdir); + info(udev, "found '%c%i:%i' claiming '%s'\n", type, maj, min, stackdir); + devnum = makedev(maj, min); /* did we find ourself? */ - if (strcmp(udev_device_get_syspath(dev), syspath) == 0) + type2 = strcmp(udev_device_get_subsystem(dev), "block") == 0 ? 'b' : 'c'; + if (udev_device_get_devnum(dev) == devnum && type == type2) continue; - dev_db = udev_device_new_from_syspath(udev, syspath); + dev_db = udev_device_new_from_devnum(udev, type, devnum); if (dev_db != NULL) { const char *devnode; @@ -276,7 +274,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons udev_device_get_devnode(dev_db), udev_device_get_devlink_priority(dev_db)); if (target == NULL || udev_device_get_devlink_priority(dev_db) > priority) { info(udev, "'%s' claims priority %i for '%s'\n", - syspath, udev_device_get_devlink_priority(dev_db), stackdir); + udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir); priority = udev_device_get_devlink_priority(dev_db); util_strscpy(buf, bufsize, devnode); target = buf; @@ -328,11 +326,15 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) dbg(udev, "creating index: '%s'\n", filename); do { + int fd; + err = util_create_path(udev, filename); if (err != 0 && err != -ENOENT) break; - err = symlink(udev_device_get_devpath(dev), filename); - if (err != 0) + fd = open(filename, O_WRONLY|O_CREAT, 0444); + if (fd >= 0) + close(fd); + else err = -errno; } while (err == -ENOENT); } -- cgit v1.2.3-54-g00ecf From 777239cb211ade308abb0a2b57d055614061f417 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 10 Mar 2010 18:54:35 +0100 Subject: use major:minor as entries in watch directory --- udev/udev-watch.c | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/udev/udev-watch.c b/udev/udev-watch.c index d67083b51b..7135d9f472 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Kay Sievers + * Copyright (C) 2004-2010 Kay Sievers * Copyright (C) 2009 Canonical Ltd. * Copyright (C) 2009 Scott James Remnant * @@ -72,29 +72,29 @@ void udev_watch_restore(struct udev *udev) size_t l; ssize_t len; struct udev_device *dev; + int maj, min; + char type; - if (ent->d_name[0] < '0' || ent->d_name[0] > '9') + if (ent->d_name[0] == '.') continue; s = device; l = util_strpcpy(&s, sizeof(device), udev_get_sys_path(udev)); len = readlinkat(dirfd(dir), ent->d_name, s, l); - if (len <= 0 || len >= (ssize_t)l) { - unlinkat(dirfd(dir), ent->d_name, 0); - continue; - } + if (len <= 0 || len >= (ssize_t)l) + goto unlink; s[len] = '\0'; - dbg(udev, "old watch to '%s' found\n", device); - dev = udev_device_new_from_syspath(udev, device); - if (dev == NULL) { - unlinkat(dirfd(dir), ent->d_name, 0); - continue; - } + + if (sscanf(s, "%c%i:%i", &type, &maj, &min) != 3) + goto unlink; + dev = udev_device_new_from_devnum(udev, type, makedev(maj, min)); + if (dev == NULL) + goto unlink; info(udev, "restoring old watch on '%s'\n", udev_device_get_devnode(dev)); udev_watch_begin(udev, dev); - udev_device_unref(dev); +unlink: unlinkat(dirfd(dir), ent->d_name, 0); } @@ -109,6 +109,7 @@ void udev_watch_restore(struct udev *udev) void udev_watch_begin(struct udev *udev, struct udev_device *dev) { char filename[UTIL_PATH_SIZE]; + char majmin[UTIL_PATH_SIZE]; int wd; if (inotify_fd < 0) @@ -122,10 +123,13 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) return; } + snprintf(majmin, sizeof(majmin), "%c%i:%i", + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? 'b' : 'c', + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); util_create_path(udev, filename); unlink(filename); - symlink(udev_device_get_devpath(dev), filename); + symlink(majmin, filename); udev_device_set_watch_handle(dev, wd); } @@ -154,20 +158,27 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev) struct udev_device *udev_watch_lookup(struct udev *udev, int wd) { char filename[UTIL_PATH_SIZE]; - char syspath[UTIL_PATH_SIZE]; + char majmin[UTIL_PATH_SIZE]; char *s; size_t l; ssize_t len; + int maj, min; + char type; + dev_t devnum; if (inotify_fd < 0 || wd < 0) return NULL; snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); - s = syspath; - l = util_strpcpy(&s, sizeof(syspath), udev_get_sys_path(udev)); + s = majmin; + l = util_strpcpy(&s, sizeof(majmin), udev_get_sys_path(udev)); len = readlink(filename, s, l); if (len < 0 || (size_t)len >= l) return NULL; s[len] = '\0'; - return udev_device_new_from_syspath(udev, syspath); + + if (sscanf(s, "%c%i:%i", &type, &maj, &min) != 3) + return NULL; + devnum = makedev(maj, min); + return udev_device_new_from_devnum(udev, type, devnum); } -- cgit v1.2.3-54-g00ecf From 9d1a67e956f285c71be2edbff1c729a42141d2db Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Mar 2010 13:01:48 +0100 Subject: libudev: docs - .gitignore backup files --- libudev/docs/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/libudev/docs/.gitignore b/libudev/docs/.gitignore index e06b113e2a..6fe7fd15d0 100644 --- a/libudev/docs/.gitignore +++ b/libudev/docs/.gitignore @@ -2,6 +2,7 @@ html/ tmpl/ xml/ *.stamp +*.bak version.xml libudev-decl-list.txt libudev-decl.txt -- cgit v1.2.3-54-g00ecf From b41102757d9d1f71aa04f3d264d57d573360d957 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Thu, 11 Mar 2010 15:05:42 +0200 Subject: udev needs automake 1.10 extras/gudev/docs/Makefile.am:4: require Automake 1.10, but have 1.9.6 libudev/docs/Makefile.am:4: require Automake 1.10, but have 1.9.6 Signed-off-by: Martin Pitt --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 88824b63b3..d53dd12a6c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_INIT([udev], [152], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) -AM_INIT_AUTOMAKE([check-news foreign 1.9 dist-bzip2 subdir-objects]) +AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_DISABLE_STATIC AC_USE_SYSTEM_EXTENSIONS -- cgit v1.2.3-54-g00ecf From d44c27c5ab71dbbcfcf4745977027502309dd795 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 16 Mar 2010 10:57:44 +0100 Subject: firmware: fix possible segfault when firmware device goes away while loading Thanks to Ruediger Oertel. --- extras/firmware/firmware.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c index 16455dec8f..92f0918c6f 100644 --- a/extras/firmware/firmware.c +++ b/extras/firmware/firmware.c @@ -63,8 +63,10 @@ static bool copy_firmware(struct udev *udev, const char *source, const char *tar if (fwrite(buf, size, 1, ftarget) == 1) ret = true; exit: - fclose(ftarget); - fclose(fsource); + if (ftarget != NULL) + fclose(ftarget); + if (fsource != NULL) + fclose(fsource); free(buf); return ret; } @@ -178,7 +180,8 @@ int main(int argc, char **argv) if (unlink(misspath) == 0) util_delete_path(udev, misspath); - set_loading(udev, loadpath, "1"); + if (!set_loading(udev, loadpath, "1")) + goto exit; util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL); if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { -- cgit v1.2.3-54-g00ecf From 6b32e8192934619f787c3b5b6f0fe40c32d7d94a Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 16 Mar 2010 12:44:43 +0100 Subject: rules: input - create by-path/ links for pci devices --- rules/rules.d/60-persistent-input.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index e4675aedcd..1ea4431d29 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -27,7 +27,7 @@ SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", A SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" # by-path -SUBSYSTEMS=="usb|platform", IMPORT{program}="path_id %p" +SUBSYSTEMS=="pci|usb|platform", IMPORT{program}="path_id %p" ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{.INPUT_CLASS}" ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{.INPUT_CLASS}" # allow empty class for platform and usb devices; platform supports only a single interface that way -- cgit v1.2.3-54-g00ecf From 2b463cb050cbf77d9c6b51e0f5a9d89bf7eb1bc3 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 16 Mar 2010 12:47:42 +0100 Subject: Fix switching Logitech bluetooth adapters into hci mode. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567237 https://bugs.launchpad.net/ubuntu/+source/udev/+bug/444420 --- extras/hid2hci/70-hid2hci.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index e133afd625..01ff30d417 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -10,8 +10,8 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" -# Logitech devices (hidraw) -KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ +# Logitech devices +KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ RUN+="hid2hci --method=logitech-hid --devpath=%p" ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" -- cgit v1.2.3-54-g00ecf From 578cc8a8085a47c963b5940459e475ac5f07219c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Mar 2010 09:15:18 +0100 Subject: do not reset SELinux context when the node was not touched --- udev/udev-node.c | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 4314cceb79..3aee15b584 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -37,7 +37,6 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod { struct udev *udev = udev_device_get_udev(dev); struct stat stats; - int preserve = 0; int err = 0; if (major(devnum) == 0) @@ -54,9 +53,15 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod if (lstat(file, &stats) == 0) { if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) { info(udev, "preserve file '%s', because it has correct dev_t\n", file); - preserve = 1; - udev_selinux_lsetfilecon(udev, file, mode); - /* update time stamp when we re-use the node, like on media change events */ + if (stats.st_mode != mode || stats.st_uid != uid || stats.st_gid != gid) { + info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); + chmod(file, mode); + chown(file, uid, gid); + udev_selinux_lsetfilecon(udev, file, mode); + } else { + info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); + } + /* always update timestamp when we re-use the node, like on media change events */ utimensat(AT_FDCWD, file, NULL, 0); } else { char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; @@ -76,7 +81,11 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod if (err != 0) { err(udev, "rename(%s, %s) failed: %m\n", file_tmp, file); unlink(file_tmp); + goto exit; } + info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); + chmod(file, mode); + chown(file, uid, gid); } } else { info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); @@ -90,28 +99,11 @@ int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mod err = -errno; udev_selinux_resetfscreatecon(udev); } while (err == -ENOENT); - if (err != 0) { + if (err != 0) err(udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", file, mode, major(devnum), minor(devnum)); - goto exit; - } - } - - if (!preserve || stats.st_mode != mode) { - info(udev, "chmod(%s, %#o)\n", file, mode); - err = chmod(file, mode); - if (err != 0) { - err(udev, "chmod(%s, %#o) failed: %m\n", file, mode); - goto exit; - } - } - - if (!preserve || stats.st_uid != uid || stats.st_gid != gid) { - info(udev, "chown(%s, %u, %u)\n", file, uid, gid); - err = chown(file, uid, gid); - if (err != 0) { - err(udev, "chown(%s, %u, %u) failed: %m\n", file, uid, gid); - goto exit; - } + info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); + chmod(file, mode); + chown(file, uid, gid); } exit: return err; -- cgit v1.2.3-54-g00ecf From fc8d61c53d6c181dc1e9f5a23c0f805c32a392af Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Mar 2010 17:42:35 +0100 Subject: libudev: add udev_device_new_from_environment() --- extras/usb_id/usb_id.c | 34 +++--- libudev/docs/libudev-sections.txt | 1 + libudev/exported_symbols | 1 + libudev/libudev-device.c | 214 +++++++++++++++++++++++++++++--------- libudev/libudev-monitor.c | 66 +----------- libudev/libudev-private.h | 3 +- libudev/libudev.h | 1 + 7 files changed, 192 insertions(+), 128 deletions(-) diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index b412598d35..42ccddff35 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -456,8 +456,6 @@ int main(int argc, char **argv) }; struct udev *udev; struct udev_device *dev = NULL; - char syspath[UTIL_PATH_SIZE]; - const char *devpath; static int export; int retval = 0; @@ -492,7 +490,7 @@ int main(int argc, char **argv) export = 1; break; case 'h': - printf("Usage: usb_id [--usb-info] [--num-info] [--export] [--help] \n" + printf("Usage: usb_id [--usb-info] [--num-info] [--export] [--help] []\n" " --usb-info use usb strings instead\n" " --num-info use numerical values\n" " --export print values as environment keys\n" @@ -503,18 +501,26 @@ int main(int argc, char **argv) } } - devpath = argv[optind]; - if (devpath == NULL) { - fprintf(stderr, "No device specified\n"); - retval = 1; - goto exit; - } - - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - dev = udev_device_new_from_syspath(udev, syspath); + dev = udev_device_new_from_environment(udev); if (dev == NULL) { - err(udev, "unable to access '%s'\n", devpath); - return 1; + char syspath[UTIL_PATH_SIZE]; + const char *devpath; + + devpath = argv[optind]; + if (devpath == NULL) { + fprintf(stderr, "missing device\n"); + retval = 1; + goto exit; + } + + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); + dev = udev_device_new_from_syspath(udev, syspath); + if (dev == NULL) { + err(udev, "unable to access '%s'\n", devpath); + retval = 1; + goto exit; + return 1; + } } retval = usb_id(dev); diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index c11a2735b2..ca781fff23 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -35,6 +35,7 @@ udev_device_get_udev udev_device_new_from_syspath udev_device_new_from_devnum udev_device_new_from_subsystem_sysname +udev_device_new_from_environment udev_device_get_parent udev_device_get_parent_with_subsystem_devtype udev_device_get_devpath diff --git a/libudev/exported_symbols b/libudev/exported_symbols index f48025a423..61486c6f48 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -15,6 +15,7 @@ udev_list_entry_get_value udev_device_new_from_syspath udev_device_new_from_devnum udev_device_new_from_subsystem_sysname +udev_device_new_from_environment udev_device_get_parent udev_device_get_parent_with_subsystem_devtype udev_device_ref diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index aec5fb57fe..fe4588015c 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,7 @@ struct udev_device { int refcount; dev_t devnum; int watch_handle; + int maj, min; unsigned int parent_set:1; unsigned int subsystem_set:1; unsigned int devtype_set:1; @@ -77,6 +79,130 @@ struct udev_device { unsigned int ignore_remove:1; }; +struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) +{ + udev_device->envp_uptodate = 0; + if (value == NULL) { + struct udev_list_entry *list_entry; + + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + if (list_entry != NULL) + udev_list_entry_delete(list_entry); + return NULL; + } + return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); +} + +static struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) +{ + char name[UTIL_LINE_SIZE]; + char *val; + + util_strscpy(name, sizeof(name), property); + val = strchr(name, '='); + if (val == NULL) + return NULL; + val[0] = '\0'; + val = &val[1]; + if (val[0] == '\0') + val = NULL; + return udev_device_add_property(udev_device, name, val); +} + +/* + * parse property string, and if needed, update internal values accordingly + * + * udev_device_add_property_from_string_parse_finish() needs to be + * called after adding properties, and its return value checked + * + * udev_device_set_info_loaded() needs to be set, to avoid trying + * to use a device without a DEVPATH set + */ +void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property) +{ + if (strncmp(property, "DEVPATH=", 8) == 0) { + char path[UTIL_PATH_SIZE]; + + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev_device->udev), &property[8], NULL); + udev_device_set_syspath(udev_device, path); + } else if (strncmp(property, "SUBSYSTEM=", 10) == 0) { + udev_device_set_subsystem(udev_device, &property[10]); + } else if (strncmp(property, "DEVTYPE=", 8) == 0) { + udev_device_set_devtype(udev_device, &property[8]); + } else if (strncmp(property, "DEVNAME=", 8) == 0) { + if (property[8] == '/') + udev_device_set_devnode(udev_device, &property[8]); + else + udev_device_set_knodename(udev_device, &property[8]); + } else if (strncmp(property, "DEVLINKS=", 9) == 0) { + char devlinks[UTIL_PATH_SIZE]; + char *slink; + char *next; + + util_strscpy(devlinks, sizeof(devlinks), &property[9]); + slink = devlinks; + next = strchr(slink, ' '); + while (next != NULL) { + next[0] = '\0'; + udev_device_add_devlink(udev_device, slink, 0); + slink = &next[1]; + next = strchr(slink, ' '); + } + if (slink[0] != '\0') + udev_device_add_devlink(udev_device, slink, 0); + } else if (strncmp(property, "DRIVER=", 7) == 0) { + udev_device_set_driver(udev_device, &property[7]); + } else if (strncmp(property, "ACTION=", 7) == 0) { + udev_device_set_action(udev_device, &property[7]); + } else if (strncmp(property, "MAJOR=", 6) == 0) { + udev_device->maj = strtoull(&property[6], NULL, 10); + } else if (strncmp(property, "MINOR=", 6) == 0) { + udev_device->min = strtoull(&property[6], NULL, 10); + } else if (strncmp(property, "DEVPATH_OLD=", 12) == 0) { + udev_device_set_devpath_old(udev_device, &property[12]); + } else if (strncmp(property, "SEQNUM=", 7) == 0) { + udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10)); + } else if (strncmp(property, "TIMEOUT=", 8) == 0) { + udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10)); + } else { + udev_device_add_property_from_string(udev_device, property); + } +} + +int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device) +{ + if (udev_device->maj > 0) + udev_device_set_devnum(udev_device, makedev(udev_device->maj, udev_device->min)); + udev_device->maj = 0; + udev_device->min = 0; + + if (udev_device->devpath == NULL || udev_device->subsystem == NULL) + return -EINVAL; + return 0; +} + +/** + * udev_device_get_property_value: + * @udev_device: udev device + * @key: property name + * + * Returns: the value of a device property, or #NULL if there is no such property. + **/ +const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) +{ + struct udev_list_entry *list_entry; + + if (udev_device == NULL) + return NULL; + if (key == NULL) + return NULL; + + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + return udev_list_entry_get_value(list_entry); +} + int udev_device_read_db(struct udev_device *udev_device) { struct stat stats; @@ -451,6 +577,42 @@ found: return udev_device_new_from_syspath(udev, path_full); } +/** + * udev_device_new_from_environment + * @udev: udev library context + * + * Create new udev device, and fill in information from the + * current process environment. This only works reliable if + * the process is called from a udev rule. It is usually used + * for tools executed from IMPORT= rules. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ +struct udev_device *udev_device_new_from_environment(struct udev *udev) +{ + int i; + struct udev_device *udev_device; + + udev_device = udev_device_new(udev); + if (udev_device == NULL) + return NULL; + udev_device_set_info_loaded(udev_device); + + for (i = 0; environ[i] != NULL; i++) + udev_device_add_property_from_string_parse(udev_device, environ[i]); + + if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { + info(udev, "missing values, invalid device\n"); + udev_device_unref(udev_device); + udev_device = NULL; + } + + return udev_device; +} + static struct udev_device *device_new_from_parent(struct udev_device *udev_device) { struct udev_device *udev_device_parent = NULL; @@ -1072,58 +1234,6 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink return 0; } -struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) -{ - udev_device->envp_uptodate = 0; - if (value == NULL) { - struct udev_list_entry *list_entry; - - list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); - if (list_entry != NULL) - udev_list_entry_delete(list_entry); - return NULL; - } - return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); -} - -struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) -{ - char name[UTIL_LINE_SIZE]; - char *val; - - util_strscpy(name, sizeof(name), property); - val = strchr(name, '='); - if (val == NULL) - return NULL; - val[0] = '\0'; - val = &val[1]; - if (val[0] == '\0') - val = NULL; - return udev_device_add_property(udev_device, name, val); -} - -/** - * udev_device_get_property_value: - * @udev_device: udev device - * @key: property name - * - * Returns: the value of a device property, or #NULL if there is no such property. - **/ -const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) -{ - struct udev_list_entry *list_entry; - - if (udev_device == NULL) - return NULL; - if (key == NULL) - return NULL; - - list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); - return udev_list_entry_get_value(list_entry); -} - #define ENVP_SIZE 128 #define MONITOR_BUF_SIZE 4096 static int update_envp_monitor_buf(struct udev_device *udev_device) diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 96c153fbd7..97e52c42db 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -497,11 +497,6 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito ssize_t buflen; ssize_t bufpos; struct udev_monitor_netlink_header *nlh; - int devpath_set = 0; - int subsystem_set = 0; - int action_set = 0; - int maj = 0; - int min = 0; retry: if (udev_monitor == NULL) @@ -589,6 +584,7 @@ retry: udev_device = udev_device_new(udev_monitor->udev); if (udev_device == NULL) return NULL; + udev_device_set_info_loaded(udev_device); while (bufpos < buflen) { char *key; @@ -599,60 +595,11 @@ retry: if (keylen == 0) break; bufpos += keylen + 1; - - if (strncmp(key, "DEVPATH=", 8) == 0) { - char path[UTIL_PATH_SIZE]; - - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev_monitor->udev), &key[8], NULL); - udev_device_set_syspath(udev_device, path); - devpath_set = 1; - } else if (strncmp(key, "SUBSYSTEM=", 10) == 0) { - udev_device_set_subsystem(udev_device, &key[10]); - subsystem_set = 1; - } else if (strncmp(key, "DEVTYPE=", 8) == 0) { - udev_device_set_devtype(udev_device, &key[8]); - } else if (strncmp(key, "DEVNAME=", 8) == 0) { - if (key[8] == '/') - udev_device_set_devnode(udev_device, &key[8]); - else - udev_device_set_knodename(udev_device, &key[8]); - } else if (strncmp(key, "DEVLINKS=", 9) == 0) { - char devlinks[UTIL_PATH_SIZE]; - char *slink; - char *next; - - util_strscpy(devlinks, sizeof(devlinks), &key[9]); - slink = devlinks; - next = strchr(slink, ' '); - while (next != NULL) { - next[0] = '\0'; - udev_device_add_devlink(udev_device, slink, 0); - slink = &next[1]; - next = strchr(slink, ' '); - } - if (slink[0] != '\0') - udev_device_add_devlink(udev_device, slink, 0); - } else if (strncmp(key, "DRIVER=", 7) == 0) { - udev_device_set_driver(udev_device, &key[7]); - } else if (strncmp(key, "ACTION=", 7) == 0) { - udev_device_set_action(udev_device, &key[7]); - action_set = 1; - } else if (strncmp(key, "MAJOR=", 6) == 0) { - maj = strtoull(&key[6], NULL, 10); - } else if (strncmp(key, "MINOR=", 6) == 0) { - min = strtoull(&key[6], NULL, 10); - } else if (strncmp(key, "DEVPATH_OLD=", 12) == 0) { - udev_device_set_devpath_old(udev_device, &key[12]); - } else if (strncmp(key, "SEQNUM=", 7) == 0) { - udev_device_set_seqnum(udev_device, strtoull(&key[7], NULL, 10)); - } else if (strncmp(key, "TIMEOUT=", 8) == 0) { - udev_device_set_timeout(udev_device, strtoull(&key[8], NULL, 10)); - } else { - udev_device_add_property_from_string(udev_device, key); - } + udev_device_add_property_from_string_parse(udev_device, key); } - if (!devpath_set || !subsystem_set || !action_set) { - info(udev_monitor->udev, "missing values, skip\n"); + + if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { + info(udev_monitor->udev, "missing values, invalid device\n"); udev_device_unref(udev_device); return NULL; } @@ -673,9 +620,6 @@ retry: return NULL; } - if (maj > 0) - udev_device_set_devnum(udev_device, makedev(maj, min)); - udev_device_set_info_loaded(udev_device); return udev_device; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 5ee0c58be8..3f2861f519 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -71,7 +71,8 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique); void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); -struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property); +void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property); +int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device); char **udev_device_get_properties_envp(struct udev_device *udev_device); ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); int udev_device_read_db(struct udev_device *udev_device); diff --git a/libudev/libudev.h b/libudev/libudev.h index 9576ad49ca..750664f43c 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -75,6 +75,7 @@ struct udev *udev_device_get_udev(struct udev_device *udev_device); struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); +struct udev_device *udev_device_new_from_environment(struct udev *udev); /* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */ struct udev_device *udev_device_get_parent(struct udev_device *udev_device); struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, -- cgit v1.2.3-54-g00ecf From 23325a66ccf3a2f90a4f5d1702f60408187de28a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Mar 2010 09:57:44 +0100 Subject: add LGPL COPYING to libudev and GUdev --- extras/gudev/COPYING | 504 +++++++++++++++++++++++++++++++++++++++++++++++++++ libudev/COPYING | 504 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1008 insertions(+) create mode 100644 extras/gudev/COPYING create mode 100644 libudev/COPYING diff --git a/extras/gudev/COPYING b/extras/gudev/COPYING new file mode 100644 index 0000000000..8add30ad59 --- /dev/null +++ b/extras/gudev/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/libudev/COPYING b/libudev/COPYING new file mode 100644 index 0000000000..8add30ad59 --- /dev/null +++ b/libudev/COPYING @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + -- cgit v1.2.3-54-g00ecf From 38a3cde11bc77af49a96245b8a8a0f2b583a344c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 18 Mar 2010 11:14:32 +0100 Subject: cdrom_id: open non-mounted optical media with O_EXCL This should prevent confusing drives during CD burning sessions. Based on a patch from Harald Hoyer. --- extras/cdrom_id/cdrom_id.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 2380b158a0..e485768de4 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -112,6 +112,30 @@ static unsigned long long int cd_media_session_last_offset; #define ASC(errcode) (((errcode) >> 8) & 0xFF) #define ASCQ(errcode) ((errcode) & 0xFF) +static int is_mounted(const char *device) +{ + struct stat statbuf; + FILE *fp; + int maj, min; + int mounted = 0; + + if (stat(device, &statbuf) < 0) + return -ENODEV; + + fp = fopen("/proc/self/mountinfo", "r"); + if (fp == NULL) + return -ENOSYS; + while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { + printf("got %u %u\n", maj, min); + if (makedev(maj, min) == statbuf.st_rdev) { + mounted = 1; + break; + } + } + fclose(fp); + return mounted; +} + static void info_scsi_cmd_err(struct udev *udev, char *cmd, int err) { if (err == -1) { @@ -568,7 +592,7 @@ int main(int argc, char *argv[]) goto exit; } - fd = open(node, O_RDONLY | O_NONBLOCK); + fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); if (fd < 0) { info(udev, "unable to open '%s'\n", node); fprintf(stderr, "unable to open '%s'\n", node); -- cgit v1.2.3-54-g00ecf From 4dd9b291354e76f34b0d6d7b5c3b28d03a624418 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Thu, 18 Mar 2010 17:13:59 -0700 Subject: modeswitch: morph into tool that only switches Mobile Action cables Remove option modeswitching code; use usb_modeswitch already, people. --- Makefile.am | 27 +- extras/mobile-action-modeswitch/.gitignore | 1 + .../61-mobile-action.rules | 15 + extras/mobile-action-modeswitch/ma8280p_us.c | 462 +++++++++++++++++++++ extras/mobile-action-modeswitch/ma8280p_us.h | 24 ++ .../mobile-action-modeswitch.c | 262 ++++++++++++ extras/mobile-action-modeswitch/utils.c | 83 ++++ extras/mobile-action-modeswitch/utils.h | 32 ++ extras/modem-modeswitch/.gitignore | 1 - extras/modem-modeswitch/61-mobile-action.rules | 15 - .../61-option-modem-modeswitch.rules | 44 -- extras/modem-modeswitch/ma8280p_us.c | 462 --------------------- extras/modem-modeswitch/ma8280p_us.h | 24 -- extras/modem-modeswitch/modem-modeswitch.c | 266 ------------ extras/modem-modeswitch/option.c | 131 ------ extras/modem-modeswitch/option.h | 29 -- extras/modem-modeswitch/utils.c | 83 ---- extras/modem-modeswitch/utils.h | 32 -- 18 files changed, 891 insertions(+), 1102 deletions(-) create mode 100644 extras/mobile-action-modeswitch/.gitignore create mode 100644 extras/mobile-action-modeswitch/61-mobile-action.rules create mode 100644 extras/mobile-action-modeswitch/ma8280p_us.c create mode 100644 extras/mobile-action-modeswitch/ma8280p_us.h create mode 100644 extras/mobile-action-modeswitch/mobile-action-modeswitch.c create mode 100644 extras/mobile-action-modeswitch/utils.c create mode 100644 extras/mobile-action-modeswitch/utils.h delete mode 100644 extras/modem-modeswitch/.gitignore delete mode 100644 extras/modem-modeswitch/61-mobile-action.rules delete mode 100644 extras/modem-modeswitch/61-option-modem-modeswitch.rules delete mode 100644 extras/modem-modeswitch/ma8280p_us.c delete mode 100644 extras/modem-modeswitch/ma8280p_us.h delete mode 100644 extras/modem-modeswitch/modem-modeswitch.c delete mode 100644 extras/modem-modeswitch/option.c delete mode 100644 extras/modem-modeswitch/option.h delete mode 100644 extras/modem-modeswitch/utils.c delete mode 100644 extras/modem-modeswitch/utils.h diff --git a/Makefile.am b/Makefile.am index 99a0133b3a..68a68d9166 100644 --- a/Makefile.am +++ b/Makefile.am @@ -448,24 +448,21 @@ extras_usb_db_pci_db_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/usb-db/pci-db # ------------------------------------------------------------------------------ -# modem-modeswitch - magic config switch for 3G modems -# ------------------------------------------------------------------------------ -extras_modem_modeswitch_modem_modeswitch_SOURCES =\ - extras/modem-modeswitch/modem-modeswitch.c \ - extras/modem-modeswitch/utils.c \ - extras/modem-modeswitch/utils.h \ - extras/modem-modeswitch/ma8280p_us.c \ - extras/modem-modeswitch/ma8280p_us.h \ - extras/modem-modeswitch/option.c \ - extras/modem-modeswitch/option.h -extras_modem_modeswitch_modem_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -extras_modem_modeswitch_modem_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) +# mobile-action-modeswitch - switch Mobile Action cables into serial mode +# ------------------------------------------------------------------------------ +extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES =\ + extras/mobile-action-modeswitch/mobile-action-modeswitch.c \ + extras/mobile-action-modeswitch/utils.c \ + extras/mobile-action-modeswitch/utils.h \ + extras/mobile-action-modeswitch/ma8280p_us.c \ + extras/mobile-action-modeswitch/ma8280p_us.h +extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) +extras_mobile_action_modeswitch_mobile_action_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) dist_udevrules_DATA += \ - extras/modem-modeswitch/61-option-modem-modeswitch.rules \ - extras/modem-modeswitch/61-mobile-action.rules + extras/mobile-action-modeswitch/61-mobile-action.rules -libexec_PROGRAMS += extras/modem-modeswitch/modem-modeswitch +libexec_PROGRAMS += extras/mobile-action-modeswitch/mobile-action-modeswitch # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys diff --git a/extras/mobile-action-modeswitch/.gitignore b/extras/mobile-action-modeswitch/.gitignore new file mode 100644 index 0000000000..0c1ff9f86c --- /dev/null +++ b/extras/mobile-action-modeswitch/.gitignore @@ -0,0 +1 @@ +modem-modeswitch diff --git a/extras/mobile-action-modeswitch/61-mobile-action.rules b/extras/mobile-action-modeswitch/61-mobile-action.rules new file mode 100644 index 0000000000..0af27a5cd4 --- /dev/null +++ b/extras/mobile-action-modeswitch/61-mobile-action.rules @@ -0,0 +1,15 @@ +ACTION!="add", GOTO="mobile_action_end" + +# ATTENTION: DO NOT USE THIS FILE FOR ANYTHING EXCEPT +# MOBILE ACTION CABLES. DO NOT USE IT FOR 3G DEVICES! + +SUBSYSTEM=="usb", ATTR{bDeviceClass}=="00|ff", ATTR{bDeviceSubClass}=="00|ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" +GOTO="mobile_action_end" + +LABEL="mobile_action_switch" + +# Mobile Action cables like the 8280p and 8230p +ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="mobile-action-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" + +LABEL="mobile_action_end" + diff --git a/extras/mobile-action-modeswitch/ma8280p_us.c b/extras/mobile-action-modeswitch/ma8280p_us.c new file mode 100644 index 0000000000..d7cf4f4b3f --- /dev/null +++ b/extras/mobile-action-modeswitch/ma8280p_us.c @@ -0,0 +1,462 @@ +/* http://www.natox.be/ma8280p/ + * http://www.leopold.dk/~martin/ma-8230p.html + * http://figvam.blogspot.com/2007/01/mobile-action-8730p-usb-cable-and-linux.html + */ + +/* + * + * Code by davy hollevoet. This is simply an adaptation of code + * generated by usbsnoop2libusb. (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) + * + * This code is released under both the GPL version 2 and BSD licenses. + * Either license may be used. + * + * GPLv2 + * ******** + * 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; either version 2 + * of the License, or (at your option) any later version. + * + * 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. + * + * In addition: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote + * products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * BSD + * ****** + * Copyright (c) 1998, Regents of the University of California + * All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the University of California, Berkeley nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* This file is (mostly) generated with usbsnoop2libusb.pl from a usbsnoop log file. */ +/* Latest version of the script should be in http://iki.fi/lindi/usb/usbsnoop2libusb.pl */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utils.h" +#include "ma8280p_us.h" + +static void msleep(long msec) +{ + struct timespec duration = { 0, msec * 1000 * 1000 }; + + nanosleep(&duration, NULL); +} + +int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) +{ + int ret = 1; + char *buf = NULL; + + buf = malloc (65535); + if (!buf) { + error ("%s: not enough memory", dev->filename, ret); + return -1; + } + + usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); + msleep(6); + usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); + msleep(6); + usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); + msleep(10); + ret = usb_release_interface(devh, 0); + if (ret != 0) + debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); + usb_set_configuration(devh, 0x0000001); + ret = usb_claim_interface(devh, 0); + if (ret != 0) + debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); + //usb_set_altinterface(devh, 0); + //msleep(33); + usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); + msleep(5); + memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); + usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); + msleep(4); + memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); + usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); + msleep(4); + + msleep(4); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(6); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(1); + //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped + msleep(4); + memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + msleep(3); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(1); + memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + msleep(7); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(1); + memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + msleep(7); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(2); + //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped + msleep(4); + memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + msleep(2); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(1); + memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + msleep(7); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(1); + memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + msleep(7); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(8); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(1); + //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped + msleep(4); + memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + msleep(3); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + msleep(1); + //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped + msleep(4); + memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); + usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); + msleep(3); + usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); + + if (buf) + free (buf); + return 0; +} diff --git a/extras/mobile-action-modeswitch/ma8280p_us.h b/extras/mobile-action-modeswitch/ma8280p_us.h new file mode 100644 index 0000000000..bf0e304401 --- /dev/null +++ b/extras/mobile-action-modeswitch/ma8280p_us.h @@ -0,0 +1,24 @@ +/* + * Modem mode switcher + * + * Copyright (C) 2009 Dan Williams + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#ifndef __MA8280P_H__ +#define __MA8280P_H__ + +#include + +int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev); + +#endif /* __MA8280P_H__ */ diff --git a/extras/mobile-action-modeswitch/mobile-action-modeswitch.c b/extras/mobile-action-modeswitch/mobile-action-modeswitch.c new file mode 100644 index 0000000000..36d7d81a11 --- /dev/null +++ b/extras/mobile-action-modeswitch/mobile-action-modeswitch.c @@ -0,0 +1,262 @@ +/* + * Mobile action cable mode switcher + * + * Copyright (C) 2008 - 2010 Dan Williams + * Copyright (C) 2008 Peter Henn + * + * Heavily based on the 'ozerocdoff' tool by Peter Henn. + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "utils.h" + +#include "ma8280p_us.h" + +struct usb_dev_handle *handle = NULL; + +typedef struct usb_device * (*FindFunc) (int vid, int pid); +typedef int (*SwitchFunc) (struct usb_dev_handle *dh, struct usb_device *dev); + +typedef enum { + ST_UNKNOWN = 0, + ST_MA8280P +} SwitchType; + +typedef struct SwitchEntry { + SwitchType st; + const char *clopt; + FindFunc find_func; + SwitchFunc switch_func; +} SwitchEntry; + +static SwitchEntry switch_types[] = { + { ST_MA8280P, "mobile-action-8280p", NULL, ma8280p_switch }, + { ST_UNKNOWN, NULL, NULL } +}; + +static struct usb_device * +generic_find (int vid, int pid) +{ + struct usb_bus *bus; + struct usb_device *dev; + + for (bus = usb_get_busses(); bus; bus = bus->next) { + for (dev = bus->devices; dev; dev = dev->next) { + if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { + debug ("Found device '%s'", dev->filename); + return dev; + } + } + } + return NULL; +} + +static void +release_usb_device (int param) +{ + usb_release_interface (handle, 0); + usb_close (handle); +} + +static void +print_usage (void) +{ + printf ("Usage: mobile-action-modeswitch [-hdq] [-l ] -v -p -t \n" + " -h, --help show this help message\n" + " -v, --vendor target USB vendor ID\n" + " -p, --product target USB product ID\n" + " -t, --type type of switch to attempt, varies by device:\n" + " mobile-action-8280p - For Mobile Action 8xxxP USB cables\n" + " -l, --log log output to a file\n" + " -q, --quiet don't print anything to stdout\n" + " -d, --debug display debugging messages\n\n" + "Examples:\n" + " mobile-action-modeswitch -v 0x0df7 -p 0x8000 -t mobile-action-8280p\n"); +} + +static SwitchEntry * +parse_type (const char *s) +{ + SwitchEntry *entry = &switch_types[0]; + + while (entry->clopt) { + if (!strcmp (entry->clopt, s)) + return entry; + entry++; + } + + return NULL; +} + +static void +do_exit (int val) +{ + log_shutdown (); + exit (val); +} + +int main(int argc, char **argv) +{ + static struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "vendor", required_argument, NULL, 'v' }, + { "product", required_argument, NULL, 'p' }, + { "type", required_argument, NULL, 't' }, + { "log", required_argument, NULL, 'l' }, + { "debug", no_argument, NULL, 'd' }, + { "quiet", no_argument, NULL, 'q' }, + { NULL, 0, NULL, 0} + }; + + struct usb_device *dev; + int vid = 0, pid = 0; + const char *logpath = NULL; + char buffer[256]; + int ret, quiet = 0, debug = 0; + SwitchEntry *sentry = NULL; + + while (1) { + int option; + + option = getopt_long(argc, argv, "hv:p:l:t:dq", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'v': + vid = strtol (optarg, NULL, 0); + break; + case 'p': + pid = strtol (optarg, NULL, 0); + break; + case 't': + sentry = parse_type (optarg); + if (!sentry) { + error ("unknown switch type '%s'", optarg); + print_usage (); + exit (1); + } + break; + case 'l': + logpath = optarg; + break; + case 'q': + quiet = 1; + break; + case 'd': + debug = 1; + break; + case 'h': + default: + print_usage (); + exit (1); + } + } + + if (log_startup (logpath, debug, quiet)) { + fprintf (stderr, "Couldn't open/create logfile %s", logpath); + exit (2); + } + + if (!sentry) { + if (!quiet) + print_usage (); + else + error ("missing device switch type."); + do_exit (3); + } + + if (!vid || !pid) { + if (!quiet) + print_usage (); + else + error ("missing vendor and device IDs."); + do_exit (3); + } + + usb_init(); + + if (usb_find_busses() < 0) { + error ("no USB busses found."); + do_exit (4); + } + + if (usb_find_devices() < 0) { + error ("no USB devices found."); + do_exit (4); + } + + if (sentry->find_func) + dev = (*sentry->find_func) (vid, pid); + else + dev = generic_find (vid, pid); + if (dev == NULL) { + error ("no device found."); + do_exit (5); + } + + handle = usb_open (dev); + if (handle == NULL) { + error ("%s: could not access the device.", + dev->filename); + do_exit (6); + } + + /* detach running default driver */ + signal (SIGTERM, release_usb_device); + ret = usb_get_driver_np (handle, 0, buffer, sizeof (buffer)); + if (ret == 0) { + debug ("%s: found already attached driver '%s'", dev->filename, buffer); + + ret = usb_detach_kernel_driver_np (handle, 0); + if (ret != 0) { + debug ("%s: error: unable to detach current driver.", dev->filename); + usb_close (handle); + do_exit (7); + } + } + + ret = usb_claim_interface (handle, 0); + if (ret != 0) { + debug ("%s: couldn't claim device's USB interface: %d.", + dev->filename, ret); + usb_close (handle); + do_exit (8); + } + + ret = (*sentry->switch_func) (handle, dev); + if (ret < 0) { + debug ("%s: failed to switch device to serial mode.", dev->filename); + usb_release_interface (handle, 0); + usb_close (handle); + do_exit(9); + } + + usb_release_interface (handle, 0); + + ret = usb_close (handle); + if (ret < 0) + debug ("%s: failed to close the device.", dev->filename); + + do_exit (0); + return 0; +} diff --git a/extras/mobile-action-modeswitch/utils.c b/extras/mobile-action-modeswitch/utils.c new file mode 100644 index 0000000000..37d0df4d65 --- /dev/null +++ b/extras/mobile-action-modeswitch/utils.c @@ -0,0 +1,83 @@ +/* + * Modem mode switcher + * + * Copyright (C) 2009 Dan Williams + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include + +#include "utils.h" + +static int debug_on = 0; +static int quiet = 0; +FILE *logfile = NULL; + +void +do_log (int level, const char *fmt, ...) +{ + va_list args; + char buffer[1024]; + char tag = 'L'; + + if (level >= LOG_DBG && !debug_on) + return; + + va_start (args, fmt); + vsnprintf (buffer, sizeof (buffer), fmt, args); + va_end (args); + + if (level == LOG_ERR) + tag = 'E'; + else if (level == LOG_MSG) + tag = 'L'; + else if (level == LOG_DBG) + tag = 'D'; + + if (logfile) + fprintf (logfile, "%c: %s\n", tag, buffer); + if (!quiet) + fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer); +} + +int +log_startup (const char *path, int do_debug, int be_quiet) +{ + time_t t; + + quiet = be_quiet; + debug_on = do_debug; + + if (!path) + return 0; + + logfile = fopen (path, "a+"); + if (!logfile) + return 1; + + t = time (NULL); + message ("\n**** Started: %s\n", ctime (&t)); + return 0; +} + +void +log_shutdown (void) +{ + if (logfile) + fclose (logfile); +} + diff --git a/extras/mobile-action-modeswitch/utils.h b/extras/mobile-action-modeswitch/utils.h new file mode 100644 index 0000000000..1ef557a892 --- /dev/null +++ b/extras/mobile-action-modeswitch/utils.h @@ -0,0 +1,32 @@ +/* + * Modem mode switcher + * + * Copyright (C) 2009 Dan Williams + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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: + */ + +#ifndef __UTILS_H__ +#define __UTILS_H__ + +#define LOG_ERR 0 +#define LOG_MSG 1 +#define LOG_DBG 2 + +#define message(fmt, args...) do_log (LOG_MSG, fmt, ##args); +#define error(fmt, args...) do_log (LOG_ERR, fmt, ##args); +#define debug(fmt, args...) do_log (LOG_DBG, fmt, ##args); + +void do_log (int level, const char *fmt, ...); +int log_startup (const char *path, int do_debug, int be_quiet); +void log_shutdown (void); + +#endif /* __UTILS_H__ */ diff --git a/extras/modem-modeswitch/.gitignore b/extras/modem-modeswitch/.gitignore deleted file mode 100644 index 0c1ff9f86c..0000000000 --- a/extras/modem-modeswitch/.gitignore +++ /dev/null @@ -1 +0,0 @@ -modem-modeswitch diff --git a/extras/modem-modeswitch/61-mobile-action.rules b/extras/modem-modeswitch/61-mobile-action.rules deleted file mode 100644 index 29d460d53d..0000000000 --- a/extras/modem-modeswitch/61-mobile-action.rules +++ /dev/null @@ -1,15 +0,0 @@ -ACTION!="add", GOTO="mobile_action_end" - -SUBSYSTEM=="usb", ATTR{bDeviceClass}=="00|ff", ATTR{bDeviceSubClass}=="00|ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" -GOTO="mobile_action_end" - -LABEL="mobile_action_switch" -ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" - -LABEL="mobile_action_end" - -# modem-modeswitch does not work with these devices, the fake CD-ROM needs to be ejected - -# ZTE MF6xx -ACTION=="add", ENV{ID_CDROM}=="1", ENV{ID_VENDOR_ID}=="19d2", ENV{ID_MODEL_ID}=="2000", RUN+="/usr/bin/eject %k" - diff --git a/extras/modem-modeswitch/61-option-modem-modeswitch.rules b/extras/modem-modeswitch/61-option-modem-modeswitch.rules deleted file mode 100644 index 053733efb3..0000000000 --- a/extras/modem-modeswitch/61-option-modem-modeswitch.rules +++ /dev/null @@ -1,44 +0,0 @@ -# NOTE: only for devices manufactured by Option NV -# DO NOT add devices that are not manufactured by Option NV - -ACTION!="add", GOTO="option_zerocd_end" - -SUBSYSTEM=="usb", ATTR{bDeviceClass}!="ff", ENV{DEVTYPE}=="usb_device", GOTO="option_zerocd_disable" -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", GOTO="option_zerocd_disable" -GOTO="option_zerocd_end" - -LABEL="option_zerocd_disable" -ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="1000", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6711", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6711", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6731", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6751", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6771", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6791", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6811", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6911", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6951", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="6971", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7011", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7051", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7071", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7111", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7211", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7251", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7271", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7311", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="c031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="d031", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="d033", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7301", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7361", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7401", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7501", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7601", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" -ATTRS{idVendor}=="0af0", ATTRS{idProduct}=="7901", RUN+="modem-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t option-zerocd" - -# NOTE: only for devices manufactured by Option NV -# DO NOT add devices that are not manufactured by Option NV - -LABEL="option_zerocd_end" diff --git a/extras/modem-modeswitch/ma8280p_us.c b/extras/modem-modeswitch/ma8280p_us.c deleted file mode 100644 index d7cf4f4b3f..0000000000 --- a/extras/modem-modeswitch/ma8280p_us.c +++ /dev/null @@ -1,462 +0,0 @@ -/* http://www.natox.be/ma8280p/ - * http://www.leopold.dk/~martin/ma-8230p.html - * http://figvam.blogspot.com/2007/01/mobile-action-8730p-usb-cable-and-linux.html - */ - -/* - * - * Code by davy hollevoet. This is simply an adaptation of code - * generated by usbsnoop2libusb. (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) - * - * This code is released under both the GPL version 2 and BSD licenses. - * Either license may be used. - * - * GPLv2 - * ******** - * 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; either version 2 - * of the License, or (at your option) any later version. - * - * 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. - * - * In addition: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * BSD - * ****** - * Copyright (c) 1998, Regents of the University of California - * All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the University of California, Berkeley nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* This file is (mostly) generated with usbsnoop2libusb.pl from a usbsnoop log file. */ -/* Latest version of the script should be in http://iki.fi/lindi/usb/usbsnoop2libusb.pl */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "utils.h" -#include "ma8280p_us.h" - -static void msleep(long msec) -{ - struct timespec duration = { 0, msec * 1000 * 1000 }; - - nanosleep(&duration, NULL); -} - -int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) -{ - int ret = 1; - char *buf = NULL; - - buf = malloc (65535); - if (!buf) { - error ("%s: not enough memory", dev->filename, ret); - return -1; - } - - usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); - msleep(6); - usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); - msleep(6); - usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); - msleep(10); - ret = usb_release_interface(devh, 0); - if (ret != 0) - debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); - usb_set_configuration(devh, 0x0000001); - ret = usb_claim_interface(devh, 0); - if (ret != 0) - debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); - //usb_set_altinterface(devh, 0); - //msleep(33); - usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - msleep(5); - memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); - usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - msleep(4); - memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); - usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - msleep(4); - - msleep(4); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(6); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(3); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(2); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(2); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(3); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(3); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - - if (buf) - free (buf); - return 0; -} diff --git a/extras/modem-modeswitch/ma8280p_us.h b/extras/modem-modeswitch/ma8280p_us.h deleted file mode 100644 index bf0e304401..0000000000 --- a/extras/modem-modeswitch/ma8280p_us.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2009 Dan Williams - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#ifndef __MA8280P_H__ -#define __MA8280P_H__ - -#include - -int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev); - -#endif /* __MA8280P_H__ */ diff --git a/extras/modem-modeswitch/modem-modeswitch.c b/extras/modem-modeswitch/modem-modeswitch.c deleted file mode 100644 index a60ce7a41c..0000000000 --- a/extras/modem-modeswitch/modem-modeswitch.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2008 Dan Williams - * Copyright (C) 2008 Peter Henn - * - * Heavily based on the 'ozerocdoff' tool by Peter Henn. - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "utils.h" - -#include "ma8280p_us.h" -#include "option.h" - -struct usb_dev_handle *handle = NULL; - -typedef struct usb_device * (*FindFunc) (int vid, int pid); -typedef int (*SwitchFunc) (struct usb_dev_handle *dh, struct usb_device *dev); - -typedef enum { - ST_UNKNOWN = 0, - ST_OPTION_ZEROCD, - ST_MA8280P -} SwitchType; - -typedef struct SwitchEntry { - SwitchType st; - const char *clopt; - FindFunc find_func; - SwitchFunc switch_func; -} SwitchEntry; - -static SwitchEntry switch_types[] = { - { ST_OPTION_ZEROCD, "option-zerocd", option_zerocd_find, option_zerocd_switch }, - { ST_MA8280P, "mobile-action-8280p", NULL, ma8280p_switch }, - { ST_UNKNOWN, NULL, NULL } -}; - -static struct usb_device * -generic_find (int vid, int pid) -{ - struct usb_bus *bus; - struct usb_device *dev; - - for (bus = usb_get_busses(); bus; bus = bus->next) { - for (dev = bus->devices; dev; dev = dev->next) { - if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { - debug ("Found device '%s'", dev->filename); - return dev; - } - } - } - return NULL; -} - -static void -release_usb_device (int param) -{ - usb_release_interface (handle, 0); - usb_close (handle); -} - -static void -print_usage (void) -{ - printf ("Usage: modem-modeswitch [-hdq] [-l ] -v -p -t \n" - " -h, --help show this help message\n" - " -v, --vendor target USB vendor ID\n" - " -p, --product target USB product ID\n" - " -t, --type type of switch to attempt, varies by device:\n" - " option-zerocd - For many newer Option N.V. devices\n" - " mobile-action-8280p - For Mobile Action 8xxxP USB cables\n" - " -l, --log log output to a file\n" - " -q, --quiet don't print anything to stdout\n" - " -d, --debug display debugging messages\n\n" - "Examples:\n" - " modem-modeswitch -v 0x0af0 -p 0xc031 -t option-zerocd\n"); -} - -static SwitchEntry * -parse_type (const char *s) -{ - SwitchEntry *entry = &switch_types[0]; - - while (entry->clopt) { - if (!strcmp (entry->clopt, s)) - return entry; - entry++; - } - - return NULL; -} - -static void -do_exit (int val) -{ - log_shutdown (); - exit (val); -} - -int main(int argc, char **argv) -{ - static struct option options[] = { - { "help", no_argument, NULL, 'h' }, - { "vendor", required_argument, NULL, 'v' }, - { "product", required_argument, NULL, 'p' }, - { "type", required_argument, NULL, 't' }, - { "log", required_argument, NULL, 'l' }, - { "debug", no_argument, NULL, 'd' }, - { "quiet", no_argument, NULL, 'q' }, - { NULL, 0, NULL, 0} - }; - - struct usb_device *dev; - int vid = 0, pid = 0; - const char *logpath = NULL; - char buffer[256]; - int ret, quiet = 0, debug = 0; - SwitchEntry *sentry = NULL; - - while (1) { - int option; - - option = getopt_long(argc, argv, "hv:p:l:t:dq", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'v': - vid = strtol (optarg, NULL, 0); - break; - case 'p': - pid = strtol (optarg, NULL, 0); - break; - case 't': - sentry = parse_type (optarg); - if (!sentry) { - error ("unknown switch type '%s'", optarg); - print_usage (); - exit (1); - } - break; - case 'l': - logpath = optarg; - break; - case 'q': - quiet = 1; - break; - case 'd': - debug = 1; - break; - case 'h': - default: - print_usage (); - exit (1); - } - } - - if (log_startup (logpath, debug, quiet)) { - fprintf (stderr, "Couldn't open/create logfile %s", logpath); - exit (2); - } - - if (!sentry) { - if (!quiet) - print_usage (); - else - error ("missing device switch type."); - do_exit (3); - } - - if (!vid || !pid) { - if (!quiet) - print_usage (); - else - error ("missing vendor and device IDs."); - do_exit (3); - } - - usb_init(); - - if (usb_find_busses() < 0) { - error ("no USB busses found."); - do_exit (4); - } - - if (usb_find_devices() < 0) { - error ("no USB devices found."); - do_exit (4); - } - - if (sentry->find_func) - dev = (*sentry->find_func) (vid, pid); - else - dev = generic_find (vid, pid); - if (dev == NULL) { - error ("no device found."); - do_exit (5); - } - - handle = usb_open (dev); - if (handle == NULL) { - error ("%s: could not access the device.", - dev->filename); - do_exit (6); - } - - /* detach running default driver */ - signal (SIGTERM, release_usb_device); - ret = usb_get_driver_np (handle, 0, buffer, sizeof (buffer)); - if (ret == 0) { - debug ("%s: found already attached driver '%s'", dev->filename, buffer); - - ret = usb_detach_kernel_driver_np (handle, 0); - if (ret != 0) { - debug ("%s: error: unable to detach current driver.", dev->filename); - usb_close (handle); - do_exit (7); - } - } - - ret = usb_claim_interface (handle, 0); - if (ret != 0) { - debug ("%s: couldn't claim device's USB interface: %d.", - dev->filename, ret); - usb_close (handle); - do_exit (8); - } - - ret = (*sentry->switch_func) (handle, dev); - if (ret < 0) { - debug ("%s: failed to switch device to modem mode.", dev->filename); - usb_release_interface (handle, 0); - usb_close (handle); - do_exit(9); - } - - usb_release_interface (handle, 0); - - ret = usb_close (handle); - if (ret < 0) - debug ("%s: failed to close the device.", dev->filename); - - do_exit (0); - return 0; -} diff --git a/extras/modem-modeswitch/option.c b/extras/modem-modeswitch/option.c deleted file mode 100644 index 5b299fd1bf..0000000000 --- a/extras/modem-modeswitch/option.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2008 Dan Williams - * Copyright (C) 2008 Peter Henn - * - * Heavily based on the 'ozerocdoff' tool by Peter Henn. - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#include - -#include "utils.h" -#include "option.h" - -/* Borrowed from /usr/include/linux/usb/ch9.h */ -#define USB_ENDPOINT_XFERTYPE_MASK 0x03 /* in bmAttributes */ -#define USB_ENDPOINT_XFER_BULK 2 -#define USB_ENDPOINT_DIR_MASK 0x80 -#define USB_DIR_OUT 0 /* to device */ -#define USB_DIR_IN 0x80 /* to host */ - -struct usb_device * -option_zerocd_find (int vid, int pid) -{ - struct usb_bus *bus; - struct usb_device *dev; - - for (bus = usb_get_busses(); bus; bus = bus->next) { - for (dev = bus->devices; dev; dev = dev->next) { - if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { - debug ("Found mass storage device:"); - debug (" Endpoints: %d", dev->config[0].interface[0].altsetting[0].bNumEndpoints); - debug (" Class: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceClass); - debug (" SubClass: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceSubClass); - debug (" Protocol: 0x%X", dev->config[0].interface[0].altsetting[0].bInterfaceProtocol); - - if ( (dev->config[0].interface[0].altsetting[0].bNumEndpoints == 2) - && (dev->config[0].interface[0].altsetting[0].bInterfaceClass == 0x08) - && (dev->config[0].interface[0].altsetting[0].bInterfaceSubClass == 0x06) - && (dev->config[0].interface[0].altsetting[0].bInterfaceProtocol == 0x50) ) { - debug ("Found modem mass storage device '%s'", dev->filename); - return dev; - } - } - } - } - return NULL; -} - -static int -find_endpoints (struct usb_device *dev, int *in_ep, int *out_ep) -{ - int i; - - for (i = 0; i < dev->config[0].interface[0].altsetting[0].bNumEndpoints; i++) { - struct usb_endpoint_descriptor *ep = &(dev->config[0].interface[0].altsetting[0].endpoint[i]); - - if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK) { - unsigned int direction = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK; - - if (!*out_ep && (direction == USB_DIR_OUT)) - *out_ep = ep->bEndpointAddress; - else if (!*in_ep && (direction == USB_DIR_IN)) - *in_ep = ep->bEndpointAddress; - } - - if (*in_ep && *out_ep) - return 0; - } - - return -1; -} - -int -option_zerocd_switch (struct usb_dev_handle *dh, struct usb_device *dev) -{ - const char const rezero_cbw[] = { - 0x55, 0x53, 0x42, 0x43, /* bulk command signature (LE) */ - 0x78, 0x56, 0x34, 0x12, /* bulk command host tag */ - 0x01, 0x00, 0x00, 0x00, /* bulk command data transfer length (LE) */ - 0x80, /* flags: direction data-in */ - 0x00, /* LUN */ - 0x06, /* SCSI command length */ - 0x01, /* SCSI command: REZERO */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* filler */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - - int ret = -1, ep_in = 0, ep_out = 0; - char buffer[256]; - - /* Find the device's bulk in and out endpoints */ - if (find_endpoints (dev, &ep_in, &ep_out) < 0) { - debug ("%s: couldn't find correct USB endpoints.", dev->filename); - goto out; - } - - usb_clear_halt (dh, ep_out); - ret = usb_set_altinterface (dh, 0); - if (ret != 0) { - debug ("%s: couldn't set device alternate interface.", dev->filename); - goto out; - } - - /* Let the mass storage device settle */ - sleep (1); - - /* Send the modeswitch command */ - ret = usb_bulk_write (dh, ep_out, (char *) rezero_cbw, sizeof (rezero_cbw), 1000); - if (ret < 0) - return ret; - - debug ("%s: REZERO command sent.", dev->filename); - - /* Some devices need to be read from */ - ret = usb_bulk_read (dh, ep_in, buffer, sizeof (buffer), 1000); - -out: - return ret; -} - diff --git a/extras/modem-modeswitch/option.h b/extras/modem-modeswitch/option.h deleted file mode 100644 index e00dabf082..0000000000 --- a/extras/modem-modeswitch/option.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2008 Dan Williams - * Copyright (C) 2008 Peter Henn - * - * Heavily based on the 'ozerocdoff' tool by Peter Henn. - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#ifndef __OPTION_H__ -#define __OPTION_H__ - -#include - -struct usb_device *option_zerocd_find (int vid, int pid); - -int option_zerocd_switch (struct usb_dev_handle *dh, struct usb_device *dev); - -#endif /* __OPTION_H__ */ diff --git a/extras/modem-modeswitch/utils.c b/extras/modem-modeswitch/utils.c deleted file mode 100644 index 37d0df4d65..0000000000 --- a/extras/modem-modeswitch/utils.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2009 Dan Williams - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#include -#include -#include -#include -#include -#include - -#include "utils.h" - -static int debug_on = 0; -static int quiet = 0; -FILE *logfile = NULL; - -void -do_log (int level, const char *fmt, ...) -{ - va_list args; - char buffer[1024]; - char tag = 'L'; - - if (level >= LOG_DBG && !debug_on) - return; - - va_start (args, fmt); - vsnprintf (buffer, sizeof (buffer), fmt, args); - va_end (args); - - if (level == LOG_ERR) - tag = 'E'; - else if (level == LOG_MSG) - tag = 'L'; - else if (level == LOG_DBG) - tag = 'D'; - - if (logfile) - fprintf (logfile, "%c: %s\n", tag, buffer); - if (!quiet) - fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer); -} - -int -log_startup (const char *path, int do_debug, int be_quiet) -{ - time_t t; - - quiet = be_quiet; - debug_on = do_debug; - - if (!path) - return 0; - - logfile = fopen (path, "a+"); - if (!logfile) - return 1; - - t = time (NULL); - message ("\n**** Started: %s\n", ctime (&t)); - return 0; -} - -void -log_shutdown (void) -{ - if (logfile) - fclose (logfile); -} - diff --git a/extras/modem-modeswitch/utils.h b/extras/modem-modeswitch/utils.h deleted file mode 100644 index 1ef557a892..0000000000 --- a/extras/modem-modeswitch/utils.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2009 Dan Williams - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#ifndef __UTILS_H__ -#define __UTILS_H__ - -#define LOG_ERR 0 -#define LOG_MSG 1 -#define LOG_DBG 2 - -#define message(fmt, args...) do_log (LOG_MSG, fmt, ##args); -#define error(fmt, args...) do_log (LOG_ERR, fmt, ##args); -#define debug(fmt, args...) do_log (LOG_DBG, fmt, ##args); - -void do_log (int level, const char *fmt, ...); -int log_startup (const char *path, int do_debug, int be_quiet); -void log_shutdown (void); - -#endif /* __UTILS_H__ */ -- cgit v1.2.3-54-g00ecf From 00e43e357ea709d8c1def0aed13192abbf9ac193 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Mon, 22 Mar 2010 10:59:46 +0100 Subject: rules: virtio - fix is to check if the 'name' attribute is present Fix provided by Harald Hoyer. Signed-off-by: Amit Shah --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index da1535f92b..e8116a372f 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -18,7 +18,7 @@ KERNEL=="mwave", GROUP="dialout" KERNEL=="hvc*|hvsi*", GROUP="dialout" # virtio serial / console ports -KERNEL=="vport*", SYMLINK+="virtio-ports/$attr{name}" +KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" -- cgit v1.2.3-54-g00ecf From 5b6172b1d9b5d582d05ea89985efd0ea7a0c8ad7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 24 Mar 2010 17:44:39 +0100 Subject: keymap: Add Acer TravelMate 6593G and Acer Aspire 1640 https://launchpad.net/bugs/536914 --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 65b0d6eb0d..b3b08ae084 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -78,6 +78,7 @@ ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" -- cgit v1.2.3-54-g00ecf From 43d08246dbb3a01e88062d5315194ee889e52dd4 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 24 Mar 2010 18:56:20 +0100 Subject: keymap: Fix another key for Acer TravelMate 6593 https://launchpad.net/bugs/536914 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index b3b08ae084..dd58453a15 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -78,7 +78,7 @@ ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" -- cgit v1.2.3-54-g00ecf From dbba7e4029e2eb8157232e6b5ddd9ee0f68b51b5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 25 Mar 2010 16:45:15 +0100 Subject: libudev: update documentation --- libudev/docs/libudev-docs.xml | 2 +- libudev/libudev-device.c | 14 ++++++-------- libudev/libudev.c | 14 +++++++------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/libudev/docs/libudev-docs.xml b/libudev/docs/libudev-docs.xml index b0372818c6..f470916700 100644 --- a/libudev/docs/libudev-docs.xml +++ b/libudev/docs/libudev-docs.xml @@ -9,7 +9,7 @@ libudev Reference Manual for libudev version &version; - 2009 + 2009-2010 Kay Sievers <kay.sievers@vrfy.org> diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index fe4588015c..410f75b300 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -463,10 +463,9 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * * @devnum: device major/minor number * * Create new udev device, and fill in information from the sys - * device and the udev database entry. The device is looked up - * by its major/minor number. Character and block device numbers - * are not unique across the two types, they do not share the same - * range of numbers. + * device and the udev database entry. The device is looked-up + * by its major/minor number and type. Character and block device + * numbers are not unique across the two types. * * The initial refcount is 1, and needs to be decremented to * release the resources of the udev device. @@ -497,10 +496,9 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de * @subsystem: the subsystem of the device * @sysname: the name of the device * - * Create new udev device, and fill in information from the sys - * device and the udev database entry. The device is looked up - * by the subsystem and name string of the device, like "mem", - * "zero", or "block", "sda". + * Create new udev device, and fill in information from the sys device + * and the udev database entry. The device is looked up by the subsystem + * and name string of the device, like "mem" / "zero", or "block" / "sda". * * The initial refcount is 1, and needs to be decremented to * release the resources of the udev device. diff --git a/libudev/libudev.c b/libudev/libudev.c index 411e9aec8b..0ae5a9115a 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2009 Kay Sievers + * Copyright (C) 2008-2010 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -71,7 +71,7 @@ static void log_stderr(struct udev *udev, * @udev: udev library context * * Retrieve stored data pointer from library context. This might be useful - * to access from callbacks. + * to access from callbacks like a custom logging function. * * Returns: stored userdata **/ @@ -321,10 +321,10 @@ void udev_set_log_fn(struct udev *udev, * udev_get_log_priority: * @udev: udev library context * - * The initial syslog priority is read from the udev config file + * The initial logging priority is read from the udev config file * at startup. * - * Returns: the current syslog priority + * Returns: the current logging priority **/ int udev_get_log_priority(struct udev *udev) { @@ -334,10 +334,10 @@ int udev_get_log_priority(struct udev *udev) /** * udev_set_log_priority: * @udev: udev library context - * @priority: the new syslog priority + * @priority: the new logging priority * - * Set the current syslog priority. The value controls which messages - * are send to syslog. + * Set the current logging priority. The value controls which messages + * are logged. **/ void udev_set_log_priority(struct udev *udev, int priority) { -- cgit v1.2.3-54-g00ecf From 233a922112408c7ed49bd72e73be228e231d46ba Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Wed, 24 Mar 2010 20:14:23 -0500 Subject: Fix Keymapping for upcoming Dell Laptops This patch fixes it so that new upcoming Dell machines will work correctly if users presses the touchpad toggle key. Currently 0xD8 is being mapped to sleep. Though this is only done by the Latitude XT* laptops. Many upcoming Laptops from Dell are mapping this key to "toogle touchpad off" .. giving the OS notification that it has just turned off the touchpad. Though their is an issue in that if this key is mapped the hardware first toogles .. then the software tries to do the samething after, if they fall out of sync ... no more touchpad. So leave out mapping these keys for now. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 1 + extras/keymap/keymaps/dell | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index dd58453a15..af39c21b0e 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -54,6 +54,7 @@ LABEL="keyboard_vendorcheck" ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 1011", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Latitude XT*", RUN+="keymap $name 0xD8 screenlock" ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell index 5ff44d6b38..84e5b4e2de 100644 --- a/extras/keymap/keymaps/dell +++ b/extras/keymap/keymaps/dell @@ -23,5 +23,4 @@ 0x9B switchvideomode # Display Toggle button 0xA2 playpause # Front panel play/pause 0xA4 stopcd # Front panel stop -0xD8 screenlock # FIXME: Tablet lock button 0xED media # MediaDirect button -- cgit v1.2.3-54-g00ecf From e22aa83ba0b09796d02ebe831a4a66ab7d9f5c1e Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Mon, 5 Apr 2010 18:45:34 -0500 Subject: Add new Dell touchpad keycode After working very closely with Dell. They have now completely changed the way they have implemented there touchpad hotkey for upcoming machines. It now only generates a single keycode (0xD9). It nolonger does anything in hardware, nor does it generate more then this keycode. This patch properly maps this keycode. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/keymaps/dell | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell index 84e5b4e2de..f90a4fd01f 100644 --- a/extras/keymap/keymaps/dell +++ b/extras/keymap/keymaps/dell @@ -24,3 +24,4 @@ 0xA2 playpause # Front panel play/pause 0xA4 stopcd # Front panel stop 0xED media # MediaDirect button +0xD9 f22 # touchpad toggle -- cgit v1.2.3-54-g00ecf From 5fa8992c9c2e756aefe84a41f00c7a2555e8d975 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Mon, 5 Apr 2010 18:45:35 -0500 Subject: Revert special casing 0xD8 to latitude XT only Now that Dell has changed the functionality of upcoming machines with touchpad toggle to only use keycode 0xD9 .. and not 0xD8 & 0xD9. It seems best to add this back to the general map of Dell buttons. Just incase a machine in the future uses this later. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 1 - extras/keymap/keymaps/dell | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index af39c21b0e..dd58453a15 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -54,7 +54,6 @@ LABEL="keyboard_vendorcheck" ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 1011", RUN+="keymap $name 0x84 wlan" -ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Latitude XT*", RUN+="keymap $name 0xD8 screenlock" ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell index f90a4fd01f..6443b4bebc 100644 --- a/extras/keymap/keymaps/dell +++ b/extras/keymap/keymaps/dell @@ -24,4 +24,5 @@ 0xA2 playpause # Front panel play/pause 0xA4 stopcd # Front panel stop 0xED media # MediaDirect button +0xD8 screenlock # FIXME: Tablet lock button 0xD9 f22 # touchpad toggle -- cgit v1.2.3-54-g00ecf From f8ede05d7ad5286039319bcb188e86b9117551e2 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Tue, 6 Apr 2010 12:59:12 -0500 Subject: Fix Dell Studio 1558 volume keys not releasing This patch fixes the Dell Studio 1558 to give a key release when a volume key is pressed. This is the same as the 1557. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 28639a5932..f0e1ab82e7 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -21,7 +21,7 @@ ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" -ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" +ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u", RUN+="keyboard-force-release.sh $devpath fujitsu-amilo-si1848" -- cgit v1.2.3-54-g00ecf From 6de84dee053a74c95f2200d6d94cfeb61516bc40 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Tue, 6 Apr 2010 16:08:21 -0500 Subject: Add support for another Dell touchpad toggle key There is another keycode that some Dell machines that are about to ship, or shipping are using for touchpad toggle. That code is 0x9E. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/keymaps/dell | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell index 6443b4bebc..1a2e433396 100644 --- a/extras/keymap/keymaps/dell +++ b/extras/keymap/keymaps/dell @@ -21,6 +21,7 @@ 0x99 nextsong # Front panel next song 0x9A setup # Tablet tools button 0x9B switchvideomode # Display Toggle button +0x9E f22 #touchpad toggle 0xA2 playpause # Front panel play/pause 0xA4 stopcd # Front panel stop 0xED media # MediaDirect button -- cgit v1.2.3-54-g00ecf From 09a5b335b5505adb4bbc79802ceee3b1816864e8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Apr 2010 09:16:47 +0200 Subject: extras: mobile-action-modeswitch - update gitignore --- extras/mobile-action-modeswitch/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/mobile-action-modeswitch/.gitignore b/extras/mobile-action-modeswitch/.gitignore index 0c1ff9f86c..16c8000dfd 100644 --- a/extras/mobile-action-modeswitch/.gitignore +++ b/extras/mobile-action-modeswitch/.gitignore @@ -1 +1 @@ -modem-modeswitch +mobile-action-modeswitch -- cgit v1.2.3-54-g00ecf From 1c8dc990dc20efbd6cd8e56a57c0fa567c2d6fc8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Apr 2010 09:22:30 +0200 Subject: scsi_id: add rand() in retry loop --- extras/scsi_id/scsi_serial.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 0c9d9c3095..8752e14971 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -863,21 +863,21 @@ int scsi_get_serial(struct udev *udev, { unsigned char page0[SCSI_INQ_BUFF_LEN]; int fd = -1; - int cnt = 10; + int cnt; int ind; int retval; memset(dev_scsi->serial, 0, len); dbg(udev, "opening %s\n", devname); - while (--cnt) { - const struct timespec duration = { 0, 500 * 1000 * 1000 }; + srand((unsigned int)getpid()); + for (cnt = 20; cnt > 0; cnt--) { + struct timespec duration; fd = open(devname, O_RDONLY | O_NONBLOCK); - if (fd >= 0) - break; - info(udev, "%s: cannot open %s: %s\n", dev_scsi->kernel, devname, strerror(errno)); - if (errno != EBUSY) + if (fd >= 0 || errno != EBUSY) break; + duration.tv_sec = 0; + duration.tv_nsec = (200 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); nanosleep(&duration, NULL); } if (fd < 0) -- cgit v1.2.3-54-g00ecf From 36a07a8c34a4cff5ad2bbb6e0fdfed49e8191661 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 7 Apr 2010 09:23:46 +0200 Subject: cdrom_id: remove debugging code --- extras/cdrom_id/cdrom_id.c | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index e485768de4..036ef284bf 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -126,7 +126,6 @@ static int is_mounted(const char *device) if (fp == NULL) return -ENOSYS; while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { - printf("got %u %u\n", maj, min); if (makedev(maj, min) == statbuf.st_rdev) { mounted = 1; break; -- cgit v1.2.3-54-g00ecf From cccfffbe04c01be12fb42cb12f3f7aa5e2a22dd4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Apr 2010 09:24:25 +0200 Subject: cdrom_id: retry to open the device, if EBUSY We might fight about the device with polling processes, or other users who probe the device. Retry a few times if the other one goes away in the meantime. Based on a patch from Harald Hoyer. --- extras/cdrom_id/cdrom_id.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 036ef284bf..7c9f8cc73e 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -591,7 +592,22 @@ int main(int argc, char *argv[]) goto exit; } - fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); + if (is_mounted(node)) { + fd = open(node, O_RDONLY|O_NONBLOCK); + } else { + int cnt; + struct timespec duration; + + srand((unsigned int)getpid()); + for (cnt = 40; cnt > 0; cnt--) { + fd = open(node, O_RDONLY|O_NONBLOCK|O_EXCL); + if (fd >= 0 || errno != EBUSY) + break; + duration.tv_sec = 0; + duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); + nanosleep(&duration, NULL); + } + } if (fd < 0) { info(udev, "unable to open '%s'\n", node); fprintf(stderr, "unable to open '%s'\n", node); -- cgit v1.2.3-54-g00ecf From d45c8c8b01c99180f15e24b22f7cf81eaf3cdd1b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Apr 2010 11:32:22 +0200 Subject: cdrom_id: check mount state in retry loop Based on a patch from Harald Hoyer. --- extras/cdrom_id/cdrom_id.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 7c9f8cc73e..894a890574 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -547,6 +547,7 @@ int main(int argc, char *argv[]) const char *node = NULL; int export = 0; int fd = -1; + int cnt; int rc = 0; udev = udev_new(); @@ -592,21 +593,16 @@ int main(int argc, char *argv[]) goto exit; } - if (is_mounted(node)) { - fd = open(node, O_RDONLY|O_NONBLOCK); - } else { - int cnt; + srand((unsigned int)getpid()); + for (cnt = 20; cnt > 0; cnt--) { struct timespec duration; - srand((unsigned int)getpid()); - for (cnt = 40; cnt > 0; cnt--) { - fd = open(node, O_RDONLY|O_NONBLOCK|O_EXCL); - if (fd >= 0 || errno != EBUSY) - break; - duration.tv_sec = 0; - duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); - nanosleep(&duration, NULL); - } + fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); + if (fd >= 0 || errno != EBUSY) + break; + duration.tv_sec = 0; + duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); + nanosleep(&duration, NULL); } if (fd < 0) { info(udev, "unable to open '%s'\n", node); -- cgit v1.2.3-54-g00ecf From 5c5ebde711c4560ae0560e87c33fe477b5add354 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 01:12:23 +0200 Subject: cdrom_id: always set ID_CDROM regardless if we can run cdrom_id --- extras/cdrom_id/60-cdrom_id.rules | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index 132a68049d..811c4aa530 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -1,5 +1,11 @@ # do not edit this file, it will be overwritten on update -# import optical drive properties -ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", \ - KERNEL=="sr[0-9]*|xvd*", IMPORT{program}="cdrom_id --export $tempnode" +ACTION!="add|change", GOTO="cdrom_end" +SUBSYSTEM!="block", GOTO="cdrom_end" +KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" +ENV{DEVTYPE}!="disk", GOTO="cdrom_end" + +ENV{ID_CDROM}="1" +IMPORT{program}="cdrom_id --export $tempnode" + +LABEL="cdrom_end" -- cgit v1.2.3-54-g00ecf From a971fb4d58aee946e151b315453fdd1b18331402 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 10:45:27 +0200 Subject: rules: delete outdated packagees rules --- rules/packages/40-infiniband.rules | 9 --------- rules/packages/40-isdn.rules | 4 ---- rules/packages/40-zaptel.rules | 7 ------- rules/packages/64-device-mapper.rules | 4 ---- rules/packages/64-md-raid.rules | 36 ----------------------------------- rules/suse/64-device-mapper.rules | 2 -- 6 files changed, 62 deletions(-) delete mode 100644 rules/packages/40-infiniband.rules delete mode 100644 rules/packages/40-isdn.rules delete mode 100644 rules/packages/40-zaptel.rules delete mode 100644 rules/packages/64-device-mapper.rules delete mode 100644 rules/packages/64-md-raid.rules diff --git a/rules/packages/40-infiniband.rules b/rules/packages/40-infiniband.rules deleted file mode 100644 index e2e47480a9..0000000000 --- a/rules/packages/40-infiniband.rules +++ /dev/null @@ -1,9 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="umad[0-9]*", NAME="infiniband/%k" -KERNEL=="issm[0-9]*", NAME="infiniband/%k" -KERNEL=="ucm[0-9]*", NAME="infiniband/%k", MODE="0666" -KERNEL=="uverbs[0-9]*", NAME="infiniband/%k", MODE="0666" -KERNEL=="uat", NAME="infiniband/%k", MODE="0666" -KERNEL=="ucma", NAME="infiniband/%k", MODE="0666" -KERNEL=="rdma_cm", NAME="infiniband/%k", MODE="0666" diff --git a/rules/packages/40-isdn.rules b/rules/packages/40-isdn.rules deleted file mode 100644 index 1a31cb6c98..0000000000 --- a/rules/packages/40-isdn.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM=="capi", KERNEL=="capi", NAME="capi20", GROUP="dialout" -SUBSYSTEM=="tty", KERNEL=="capi[0-9]*", NAME="capi/%n" diff --git a/rules/packages/40-zaptel.rules b/rules/packages/40-zaptel.rules deleted file mode 100644 index cbd8b8abe0..0000000000 --- a/rules/packages/40-zaptel.rules +++ /dev/null @@ -1,7 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="zap[0-9]*", NAME="zap/%n", GROUP="dialout" -KERNEL=="zapchannel", NAME="zap/channel", GROUP="dialout" -KERNEL=="zapctl", NAME="zap/ctl", GROUP="dialout" -KERNEL=="zappseudo", NAME="zap/pseudo", GROUP="dialout" -KERNEL=="zaptimer", NAME="zap/timer", GROUP="dialout" diff --git a/rules/packages/64-device-mapper.rules b/rules/packages/64-device-mapper.rules deleted file mode 100644 index 8154ef3702..0000000000 --- a/rules/packages/64-device-mapper.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="device-mapper", NAME="mapper/control" - diff --git a/rules/packages/64-md-raid.rules b/rules/packages/64-md-raid.rules deleted file mode 100644 index 6ba93b661e..0000000000 --- a/rules/packages/64-md-raid.rules +++ /dev/null @@ -1,36 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM!="block", GOTO="md_end" -ACTION!="add|change", GOTO="md_end" - -# import data from a raid member and activate it -#ENV{ID_FS_TYPE}=="linux_raid_member", IMPORT{program}="/sbin/mdadm --examine --export $tempnode", RUN+="/sbin/mdadm --incremental $env{DEVNAME}" -# import data from a raid set -KERNEL!="md*", GOTO="md_end" - -# partitions have no md/{array_state,metadata_version} -ENV{DEVTYPE}=="partition", GOTO="md_ignore_state" - -# container devices have a metadata version of e.g. 'external:ddf' and -# never leave state 'inactive' -ATTR{md/metadata_version}=="external:[A-Za-z]*", ATTR{md/array_state}=="inactive", GOTO="md_ignore_state" -TEST!="md/array_state", GOTO="md_end" -ATTR{md/array_state}=="|clear|inactive", GOTO="md_end" -LABEL="md_ignore_state" - -IMPORT{program}="/sbin/mdadm --detail --export $tempnode" -ENV{DEVTYPE}=="disk", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}", OPTIONS+="string_escape=replace" -ENV{DEVTYPE}=="disk", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}" -ENV{DEVTYPE}=="disk", ENV{MD_DEVNAME}=="?*", SYMLINK+="md/$env{MD_DEVNAME}" -ENV{DEVTYPE}=="partition", ENV{MD_NAME}=="?*", SYMLINK+="disk/by-id/md-name-$env{MD_NAME}-part%n", OPTIONS+="string_escape=replace" -ENV{DEVTYPE}=="partition", ENV{MD_UUID}=="?*", SYMLINK+="disk/by-id/md-uuid-$env{MD_UUID}-part%n" -ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[^0-9]", SYMLINK+="md/$env{MD_DEVNAME}%n" -ENV{DEVTYPE}=="partition", ENV{MD_DEVNAME}=="*[0-9]", SYMLINK+="md/$env{MD_DEVNAME}p%n" - -IMPORT{program}="/sbin/blkid -o udev -p $tempnode" -OPTIONS+="link_priority=100" -OPTIONS+="watch" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="md_end" diff --git a/rules/suse/64-device-mapper.rules b/rules/suse/64-device-mapper.rules index 36ac7566d3..34e3307569 100644 --- a/rules/suse/64-device-mapper.rules +++ b/rules/suse/64-device-mapper.rules @@ -1,7 +1,5 @@ # do not edit this file, it will be overwritten on update -KERNEL=="device-mapper", NAME="mapper/control" - KERNEL!="dm-*", GOTO="device_mapper_end" ACTION!="add|change", GOTO="device_mapper_end" -- cgit v1.2.3-54-g00ecf From 421fbc71c7e951dac900eabd445dfe577158b9c3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 10:50:59 +0200 Subject: rules: we do not have static devices which are renamed --- rules/rules.d/50-udev-default.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index e8116a372f..a5f08233ed 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -115,4 +115,3 @@ KERNEL=="rrom[0-9]*", MODE="0400" # do not delete static device nodes ACTION=="remove", NAME=="", TEST=="/lib/udev/devices/%k", OPTIONS+="ignore_remove" -ACTION=="remove", NAME=="?*", TEST=="/lib/udev/devices/$name", OPTIONS+="ignore_remove" -- cgit v1.2.3-54-g00ecf From 0ec5b5e1429307fa7573aaa9b8f25fbd9b1d71d5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 15:51:16 +0200 Subject: unify/cleanup event handling --- udev/udev-event.c | 231 ++++++++++++++++++++++-------------------------------- udev/udev-node.c | 24 +++--- udev/udev.h | 3 +- 3 files changed, 111 insertions(+), 147 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 986c119fbb..c3a8281b44 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2009 Kay Sievers + * Copyright (C) 2003-2010 Kay Sievers * * 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 @@ -541,167 +541,124 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) udev_device_get_subsystem(dev), udev_device_get_sysname(dev)); } - /* add device node */ - if (major(udev_device_get_devnum(dev)) != 0 && - (strcmp(udev_device_get_action(dev), "add") == 0 || strcmp(udev_device_get_action(dev), "change") == 0)) { - char filename[UTIL_PATH_SIZE]; - struct udev_device *dev_old; - int delete_kdevnode = 0; - - dbg(event->udev, "device node add '%s'\n", udev_device_get_devpath(dev)); - - /* read old database entry */ - dev_old = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); - if (dev_old != NULL) { - udev_device_read_db(dev_old); - udev_device_set_info_loaded(dev_old); + if (strcmp(udev_device_get_action(dev), "remove") == 0) { + udev_device_read_db(dev); + udev_device_set_info_loaded(dev); + udev_device_delete_db(dev); - /* disable watch during event processing */ - udev_watch_end(event->udev, dev_old); - } + if (major(udev_device_get_devnum(dev)) != 0) + udev_watch_end(event->udev, dev); udev_rules_apply_to_event(rules, event); - if (event->tmp_node != NULL) { - dbg(event->udev, "cleanup temporary device node\n"); - util_unlink_secure(event->udev, event->tmp_node); - free(event->tmp_node); - event->tmp_node = NULL; - } - - if (event->name != NULL && event->name[0] == '\0') { - info(event->udev, "device node creation suppressed\n"); - delete_kdevnode = 1; - goto exit_add; - } - - /* if rule given name disagrees with kernel node name, delete kernel node */ - if (event->name != NULL && udev_device_get_knodename(dev) != NULL) { - if (strcmp(event->name, udev_device_get_knodename(dev)) != 0) - delete_kdevnode = 1; - } - - /* no rule, use kernel provided name */ - if (event->name == NULL) { - if (udev_device_get_knodename(dev) != NULL) { - event->name = strdup(udev_device_get_knodename(dev)); - info(event->udev, "no node name set, will use kernel supplied name '%s'\n", event->name); - } else { - event->name = strdup(udev_device_get_sysname(event->dev)); - info(event->udev, "no node name set, will use device name '%s'\n", event->name); - } - } - /* something went wrong */ - if (event->name == NULL) { - err(event->udev, "no node name for '%s'\n", udev_device_get_sysname(event->dev)); - goto exit_add; - } - - /* set device node name */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", event->name, NULL); - udev_device_set_devnode(dev, filename); - - /* write current database entry */ - udev_device_update_db(dev); + if (major(udev_device_get_devnum(dev)) != 0) + err = udev_node_remove(dev); + } else { + event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); + if (event->dev_db != NULL) { + udev_device_read_db(event->dev_db); + udev_device_set_info_loaded(event->dev_db); - /* remove/update possible left-over symlinks from old database entry */ - if (dev_old != NULL) - udev_node_update_old_links(dev, dev_old); - - /* create new node and symlinks */ - err = udev_node_add(dev, event->mode, event->uid, event->gid); -exit_add: - if (delete_kdevnode && udev_device_get_knodename(dev) != NULL) { - struct stat stats; - - util_strscpyl(filename, sizeof(filename), - udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); - if (stat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) { - unlink(filename); - util_delete_path(event->udev, filename); - info(event->udev, "removed kernel created node '%s'\n", filename); - } + /* disable watch during event processing */ + if (major(udev_device_get_devnum(dev)) != 0) + udev_watch_end(event->udev, event->dev_db); } - udev_device_unref(dev_old); - goto exit; - } - - /* add netif */ - if (strcmp(udev_device_get_subsystem(dev), "net") == 0 && strcmp(udev_device_get_action(dev), "add") == 0) { - dbg(event->udev, "netif add '%s'\n", udev_device_get_devpath(dev)); - udev_device_delete_db(dev); udev_rules_apply_to_event(rules, event); - if (event->name == NULL) - goto exit; - /* look if we want to change the name of the netif */ - if (strcmp(event->name, udev_device_get_sysname(dev)) != 0) { + /* rename a new network interface, if needed */ + if (strcmp(udev_device_get_subsystem(dev), "net") == 0 && strcmp(udev_device_get_action(dev), "add") == 0 && + event->name != NULL && strcmp(event->name, udev_device_get_sysname(dev)) != 0) { char syspath[UTIL_PATH_SIZE]; char *pos; err = rename_netif(event); - if (err != 0) - goto exit; - info(event->udev, "renamed netif to '%s'\n", event->name); - - /* remember old name */ - udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); - - /* now change the devpath, because the kernel device name has changed */ - util_strscpy(syspath, sizeof(syspath), udev_device_get_syspath(dev)); - pos = strrchr(syspath, '/'); - if (pos != NULL) { - pos++; - util_strscpy(pos, sizeof(syspath) - (pos - syspath), event->name); - udev_device_set_syspath(event->dev, syspath); - udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); - info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); + if (err == 0) { + info(event->udev, "renamed netif to '%s'\n", event->name); + + /* delete stale db file */ + udev_device_delete_db(dev); + + /* remember old name */ + udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); + + /* now change the devpath, because the kernel device name has changed */ + util_strscpy(syspath, sizeof(syspath), udev_device_get_syspath(dev)); + pos = strrchr(syspath, '/'); + if (pos != NULL) { + pos++; + util_strscpy(pos, sizeof(syspath) - (pos - syspath), event->name); + udev_device_set_syspath(event->dev, syspath); + udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); + info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); + } } } - udev_device_update_db(dev); - goto exit; - } - /* remove device node */ - if (major(udev_device_get_devnum(dev)) != 0 && strcmp(udev_device_get_action(dev), "remove") == 0) { - /* import database entry and delete it */ - udev_device_read_db(dev); - udev_device_set_info_loaded(dev); - udev_device_delete_db(dev); + if (major(udev_device_get_devnum(dev)) != 0) { + char filename[UTIL_PATH_SIZE]; - /* remove watch */ - udev_watch_end(event->udev, dev); + if (event->tmp_node != NULL) { + info(event->udev, "cleanup temporary device node\n"); + util_unlink_secure(event->udev, event->tmp_node); + free(event->tmp_node); + event->tmp_node = NULL; + } - if (udev_device_get_devnode(dev) == NULL) { - char devnode[UTIL_PATH_SIZE]; + /* no rule, use kernel provided name */ + if (event->name == NULL) { + if (udev_device_get_knodename(dev) != NULL) { + event->name = strdup(udev_device_get_knodename(dev)); + info(event->udev, "no node name set, will use kernel supplied name '%s'\n", event->name); + } else { + event->name = strdup(udev_device_get_sysname(event->dev)); + info(event->udev, "no node name set, will use device name '%s'\n", event->name); + } + } + + if (event->name == NULL) { + /* things went wrong */ + udev_device_delete_db(dev); + udev_device_unref(event->dev_db); + err = -ENOMEM; + goto out; + } - info(event->udev, "'%s' not found in database, using kernel name '%s'\n", - udev_device_get_syspath(dev), udev_device_get_knodename(dev)); - util_strscpyl(devnode, sizeof(devnode), - udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); - udev_device_set_devnode(dev, devnode); + /* set device node name */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", event->name, NULL); + udev_device_set_devnode(dev, filename); } - udev_rules_apply_to_event(rules, event); + udev_device_update_db(dev); - if (udev_device_get_ignore_remove(dev)) { - info(event->udev, "ignore_remove for '%s'\n", udev_device_get_devnode(dev)); - goto exit; + if (major(udev_device_get_devnum(dev)) != 0) { + /* remove/update possible left-over symlinks from old database entry */ + if (event->dev_db != NULL) + udev_node_update_old_links(dev, event->dev_db); + + if (event->name[0] != '\0') + err = udev_node_add(dev, event->mode, event->uid, event->gid); + else + info(event->udev, "device node creation suppressed\n"); + + /* remove kernel-created node, if needed */ + if (udev_device_get_knodename(dev) != NULL && strcmp(event->name, udev_device_get_knodename(dev)) != 0) { + struct stat stats; + char filename[UTIL_PATH_SIZE]; + + info(event->udev, "remove kernel created node '%s'\n", udev_device_get_knodename(dev)); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); + if (stat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) { + util_unlink_secure(event->udev, filename); + util_delete_path(event->udev, filename); + } + } } - err = udev_node_remove(dev); - goto exit; + udev_device_unref(event->dev_db); + event->dev_db = NULL; } - - /* default devices */ - udev_rules_apply_to_event(rules, event); - - if (strcmp(udev_device_get_action(dev), "remove") != 0) - udev_device_update_db(dev); - else - udev_device_delete_db(dev); -exit: +out: return err; } diff --git a/udev/udev-node.c b/udev/udev-node.c index 3aee15b584..3b4eb5f00b 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2009 Kay Sievers + * Copyright (C) 2003-2010 Kay Sievers * * 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 @@ -416,7 +416,6 @@ int udev_node_remove(struct udev_device *dev) const char *devnode; char partitionname[UTIL_PATH_SIZE]; struct stat stats; - struct udev_device *dev_check; int err = 0; int num; @@ -436,15 +435,21 @@ int udev_node_remove(struct udev_device *dev) return -1; } - dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); - if (dev_check != NULL && stats.st_rdev == udev_device_get_devnum(dev_check)) { - /* do not remove device node if the same sys-device is re-created in the meantime */ - info(udev, "keeping device node of existing device'%s'\n", devnode); + if (udev_device_get_ignore_remove(dev)) { + info(udev, "ignore_remove for '%s'\n", udev_device_get_devnode(dev)); } else { - info(udev, "removing device node '%s'\n", devnode); - err = util_unlink_secure(udev, devnode); + struct udev_device *dev_check; + + dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); + if (dev_check != NULL && stats.st_rdev == udev_device_get_devnum(dev_check)) { + /* do not remove device node if the same sys-device is re-created in the meantime */ + info(udev, "keeping device node of existing device'%s'\n", devnode); + } else { + info(udev, "removing device node '%s'\n", devnode); + err = util_unlink_secure(udev, devnode); + } + udev_device_unref(dev_check); } - udev_device_unref(dev_check); num = udev_device_get_num_fake_partitions(dev); if (num > 0) { @@ -459,6 +464,7 @@ int udev_node_remove(struct udev_device *dev) util_unlink_secure(udev, partitionname); } } + util_delete_path(udev, devnode); return err; } diff --git a/udev/udev.h b/udev/udev.h index 555eae6311..2b9bbecc8e 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -1,6 +1,6 @@ /* * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2008 Kay Sievers + * Copyright (C) 2003-2010 Kay Sievers * * 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 @@ -35,6 +35,7 @@ struct udev_event { struct udev *udev; struct udev_device *dev; struct udev_device *dev_parent; + struct udev_device *dev_db; char *name; char *tmp_node; char *program_result; -- cgit v1.2.3-54-g00ecf From 5539f624e18e948e4e3a1f0d9f5d25de9c8fd8b8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 15:58:05 +0200 Subject: allow IMPORT{db}="KEY" --- udev/udev-rules.c | 26 +++++++++++++++++++++++++- udev/udev.xml | 8 ++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 60daad520a..c4a2724032 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2009 Kay Sievers + * Copyright (C) 2003-2010 Kay Sievers * Copyright (C) 2008 Alan Jenkins * * This program is free software: you can redistribute it and/or modify @@ -141,6 +141,7 @@ enum token_type { TK_M_PROGRAM, /* val */ TK_M_IMPORT_FILE, /* val */ TK_M_IMPORT_PROG, /* val */ + TK_M_IMPORT_DB, /* val */ TK_M_IMPORT_PARENT, /* val */ TK_M_RESULT, /* val */ TK_M_MAX, @@ -271,6 +272,7 @@ static const char *token_str(enum token_type type) [TK_M_PROGRAM] = "M PROGRAM", [TK_M_IMPORT_FILE] = "M IMPORT_FILE", [TK_M_IMPORT_PROG] = "M IMPORT_PROG", + [TK_M_IMPORT_DB] = "M IMPORT_DB", [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", [TK_M_RESULT] = "M RESULT", [TK_M_MAX] = "M MAX", @@ -337,6 +339,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_M_PROGRAM: case TK_M_IMPORT_FILE: case TK_M_IMPORT_PROG: + case TK_M_IMPORT_DB: case TK_M_IMPORT_PARENT: case TK_M_RESULT: case TK_A_NAME: @@ -1001,6 +1004,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_M_PROGRAM: case TK_M_IMPORT_FILE: case TK_M_IMPORT_PROG: + case TK_M_IMPORT_DB: case TK_M_IMPORT_PARENT: case TK_M_RESULT: case TK_A_OWNER: @@ -1379,6 +1383,9 @@ static int add_rule(struct udev_rules *rules, char *line, } else if (attr != NULL && strstr(attr, "file")) { dbg(rules->udev, "IMPORT will be included as file\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); + } else if (attr != NULL && strstr(attr, "db")) { + dbg(rules->udev, "IMPORT will include db values\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_DB, op, value, NULL); } else if (attr != NULL && strstr(attr, "parent")) { dbg(rules->udev, "IMPORT will include the parent values\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); @@ -2288,6 +2295,23 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event goto nomatch; break; } + case TK_M_IMPORT_DB: + { + const char *key = &rules->buf[cur->key.value_off]; + const char *value; + + value = udev_device_get_property_value(event->dev_db, key); + if (value != NULL) { + struct udev_list_entry *entry; + + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_flags(entry, 1); + } else { + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } + break; + } case TK_M_IMPORT_PARENT: { char import[UTIL_PATH_SIZE]; diff --git a/udev/udev.xml b/udev/udev.xml index b6c5933419..175cdbec6b 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -398,6 +398,14 @@ environment key format. + + + + Import a single property specified as the assigned value from the + current device database. This works only if the database is already populated + by an earlier event. + + -- cgit v1.2.3-54-g00ecf From 86dc9133f88e8690aa89ccb5a240ff915b1fb69f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 16:10:05 +0200 Subject: usb-db: remove double '/' --- extras/usb-db/usb-db.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/extras/usb-db/usb-db.c b/extras/usb-db/usb-db.c index db1f843c1a..fe563c2e75 100644 --- a/extras/usb-db/usb-db.c +++ b/extras/usb-db/usb-db.c @@ -1,5 +1,3 @@ -/*-*- linux-c -*-*/ - /* * Copyright (C) 2009 Lennart Poettering * @@ -223,7 +221,7 @@ int main(int argc, char*argv[]) { if (!(udev = udev_new())) goto finish; - if (asprintf(&sp, "%s/%s", udev_get_sys_path(udev), argv[1]) < 0) { + if (asprintf(&sp, "%s%s", udev_get_sys_path(udev), argv[1]) < 0) { fprintf(stderr, "Failed to allocate sysfs path.\n"); goto finish; } -- cgit v1.2.3-54-g00ecf From 4b06c409350d26af5e6ace0f368d01b80d75438e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 16:52:41 +0200 Subject: replace "add|change" with "!remove" --- extras/cdrom_id/60-cdrom_id.rules | 2 +- extras/edd_id/61-persistent-storage-edd.rules | 2 +- extras/fstab_import/79-fstab_import.rules | 2 +- extras/hid2hci/70-hid2hci.rules | 2 +- extras/keymap/95-keyboard-force-release.rules | 2 +- extras/keymap/95-keymap.rules | 2 +- extras/udev-acl/70-acl.rules | 2 +- extras/udev-acl/udev-acl.c | 6 ++---- extras/v4l_id/60-persistent-v4l.rules | 2 +- rules/rules.d/60-persistent-alsa.rules | 2 +- rules/rules.d/60-persistent-input.rules | 2 +- rules/rules.d/60-persistent-serial.rules | 2 +- rules/rules.d/60-persistent-storage-tape.rules | 2 +- rules/rules.d/60-persistent-storage.rules | 2 +- rules/rules.d/75-net-description.rules | 2 +- rules/rules.d/75-tty-description.rules | 2 +- rules/suse/64-device-mapper.rules | 2 +- udev/udev-rules.c | 5 ++--- udev/udevd.c | 2 +- 19 files changed, 21 insertions(+), 24 deletions(-) diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index 811c4aa530..16b3af9e92 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add|change", GOTO="cdrom_end" +ACTION=="remove", GOTO="cdrom_end" SUBSYSTEM!="block", GOTO="cdrom_end" KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" ENV{DEVTYPE}!="disk", GOTO="cdrom_end" diff --git a/extras/edd_id/61-persistent-storage-edd.rules b/extras/edd_id/61-persistent-storage-edd.rules index 54ae0865e4..1ab1be347e 100644 --- a/extras/edd_id/61-persistent-storage-edd.rules +++ b/extras/edd_id/61-persistent-storage-edd.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add|change", GOTO="persistent_storage_edd_end" +ACTION=="remove", GOTO="persistent_storage_edd_end" SUBSYSTEM!="block", GOTO="persistent_storage_edd_end" KERNEL!="sd*|hd*|cciss*", GOTO="persistent_storage_edd_end" diff --git a/extras/fstab_import/79-fstab_import.rules b/extras/fstab_import/79-fstab_import.rules index 2adfe04c73..2ded7d3d9f 100644 --- a/extras/fstab_import/79-fstab_import.rules +++ b/extras/fstab_import/79-fstab_import.rules @@ -1,2 +1,2 @@ -ACTION=="add|change", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem|other", IMPORT="fstab_import $name $links mapper/$env{DM_NAME}" +ACTION!="remove", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem|other", IMPORT="fstab_import $name $links mapper/$env{DM_NAME}" diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index 01ff30d417..0687c8aa78 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add|change", GOTO="hid2hci_end" +ACTION=="remove", GOTO="hid2hci_end" SUBSYSTEM!="usb", GOTO="hid2hci_end" # Variety of Dell Bluetooth devices - match on a mouse device that is diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index f0e1ab82e7..b973614c85 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -11,7 +11,7 @@ # /lib/udev/keymap -i /dev/input/eventX # on a Linux vt to find out. -ACTION!="add|change", GOTO="force_release_end" +ACTION=="remove", GOTO="force_release_end" SUBSYSTEM!="serio", GOTO="force_release_end" KERNEL!="serio*", GOTO="force_release_end" DRIVER!="atkbd", GOTO="force_release_end" diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index dd58453a15..2f41cb4742 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -5,7 +5,7 @@ # a file name (in /lib/udev/keymaps), which has to contain scancode/keyname # pairs. -ACTION!="add|change", GOTO="keyboard_end" +ACTION=="remove", GOTO="keyboard_end" SUBSYSTEM!="input", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index fde265693c..5b00bf82c7 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -4,7 +4,7 @@ # udev-acl of this udev release and may be replaced at any time. ENV{MAJOR}=="", GOTO="acl_end" -ACTION!="add|change", GOTO="acl_apply" +ACTION=="remove", GOTO="acl_apply" # PTP/MTP protocol devices, cameras, portable media players SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="", ENV{DEVTYPE}=="usb_device", IMPORT{program}="usb_id --export %p" diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index c070fccd17..ce515902e0 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -353,12 +353,10 @@ int main (int argc, char* argv[]) switch (option) { case 'a': - if (strcmp(optarg, "add") == 0 || strcmp(optarg, "change") == 0) - action = ACTION_ADD; - else if (strcmp(optarg, "remove") == 0) + if (strcmp(optarg, "remove") == 0) action = ACTION_REMOVE; else - goto out; + action = ACTION_ADD; break; case 'D': device = optarg; diff --git a/extras/v4l_id/60-persistent-v4l.rules b/extras/v4l_id/60-persistent-v4l.rules index a342a71949..b6e1313a31 100644 --- a/extras/v4l_id/60-persistent-v4l.rules +++ b/extras/v4l_id/60-persistent-v4l.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add|change", GOTO="persistent_v4l_end" +ACTION=="remove", GOTO="persistent_v4l_end" SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" ENV{MAJOR}=="", GOTO="persistent_v4l_end" diff --git a/rules/rules.d/60-persistent-alsa.rules b/rules/rules.d/60-persistent-alsa.rules index a5206fdbb1..39a365221e 100644 --- a/rules/rules.d/60-persistent-alsa.rules +++ b/rules/rules.d/60-persistent-alsa.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add|change", GOTO="persistent_alsa_end" +ACTION=="remove", GOTO="persistent_alsa_end" SUBSYSTEM!="sound", GOTO="persistent_alsa_end" KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end" diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index 1ea4431d29..634c4dbeaf 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add|change", GOTO="persistent_input_end" +ACTION=="remove", GOTO="persistent_input_end" SUBSYSTEM!="input", GOTO="persistent_input_end" KERNEL=="input[0-9]*", GOTO="persistent_input_end" diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules index 351b3856fd..3e1a56550a 100644 --- a/rules/rules.d/60-persistent-serial.rules +++ b/rules/rules.d/60-persistent-serial.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add|change", GOTO="persistent_serial_end" +ACTION=="remove", GOTO="persistent_serial_end" SUBSYSTEM!="tty", GOTO="persistent_serial_end" KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="persistent_serial_end" diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index 968528d845..833ef94daa 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -2,7 +2,7 @@ # persistent storage links: /dev/tape/{by-id,by-path} -ACTION!="add|change", GOTO="persistent_storage_tape_end" +ACTION=="remove", GOTO="persistent_storage_tape_end" # type 8 devices are "Medium Changers" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 89041a950b..d9f8003cde 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -6,7 +6,7 @@ # forward scsi device event to corresponding block device ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" -ACTION!="add|change", GOTO="persistent_storage_end" +ACTION=="remove", GOTO="persistent_storage_end" SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices diff --git a/rules/rules.d/75-net-description.rules b/rules/rules.d/75-net-description.rules index 1c4c401d3b..490fcced1e 100644 --- a/rules/rules.d/75-net-description.rules +++ b/rules/rules.d/75-net-description.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add|change", GOTO="net_end" +ACTION=="remove", GOTO="net_end" SUBSYSTEM!="net", GOTO="net_end" SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" diff --git a/rules/rules.d/75-tty-description.rules b/rules/rules.d/75-tty-description.rules index ac868adc0a..c2980cfb69 100644 --- a/rules/rules.d/75-tty-description.rules +++ b/rules/rules.d/75-tty-description.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add|change", GOTO="tty_end" +ACTION=="remove", GOTO="tty_end" SUBSYSTEM!="tty", GOTO="tty_end" SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" diff --git a/rules/suse/64-device-mapper.rules b/rules/suse/64-device-mapper.rules index 34e3307569..12cae35da8 100644 --- a/rules/suse/64-device-mapper.rules +++ b/rules/suse/64-device-mapper.rules @@ -1,7 +1,7 @@ # do not edit this file, it will be overwritten on update KERNEL!="dm-*", GOTO="device_mapper_end" -ACTION!="add|change", GOTO="device_mapper_end" +ACTION=="remove", GOTO="device_mapper_end" IMPORT{program}="/sbin/dmsetup export -j%M -m%m" ENV{DM_NAME}!="?*", GOTO="device_mapper_end" diff --git a/udev/udev-rules.c b/udev/udev-rules.c index c4a2724032..0361f689d5 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2055,13 +2055,12 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event struct token *cur; struct token *rule; enum escape_type esc = ESCAPE_UNSET; - int can_set_name; + bool can_set_name; if (rules->tokens == NULL) return -1; - can_set_name = ((strcmp(udev_device_get_action(event->dev), "add") == 0 || - strcmp(udev_device_get_action(event->dev), "change") == 0) && + can_set_name = ((strcmp(udev_device_get_action(event->dev), "remove") != 0) && (major(udev_device_get_devnum(event->dev)) > 0 || strcmp(udev_device_get_subsystem(event->dev), "net") == 0)); diff --git a/udev/udevd.c b/udev/udevd.c index fe3352ceb5..c27b4cd6aa 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -168,7 +168,7 @@ static void event_queue_delete(struct event *event) udev_list_node_remove(&event->node); /* mark as failed, if "add" event returns non-zero */ - if (event->exitcode != 0 && strcmp(udev_device_get_action(event->dev), "add") == 0) + if (event->exitcode != 0 && strcmp(udev_device_get_action(event->dev), "remove") != 0) udev_queue_export_device_failed(udev_queue_export, event->dev); else udev_queue_export_device_finished(udev_queue_export, event->dev); -- cgit v1.2.3-54-g00ecf From 5c4c389bba6cf986a8dd743b43017c2f60604cca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 17:00:16 +0200 Subject: update NEWS --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index a4d46d7b0c..687bcdfba1 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ udev 152 ======== Bugfixes. +All "add|change" matches are replaced by "!remove" in the rules and +in the udev logic. All types of events will update possible symlinks +and permissions, only "remove" is handled special now. + +The modem mode switch extra was removed and the external usb_modeswitch +program should be used instead. + New and fixed keymaps. udev 151 -- cgit v1.2.3-54-g00ecf From 3ba7e651ad36e4f37d9bfffadb638bc2ef784217 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 17:13:37 +0200 Subject: log info only if we actually delete the node --- udev/udev-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index c3a8281b44..26939e75db 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -646,9 +646,9 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) struct stat stats; char filename[UTIL_PATH_SIZE]; - info(event->udev, "remove kernel created node '%s'\n", udev_device_get_knodename(dev)); util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); if (stat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) { + info(event->udev, "remove kernel created node '%s'\n", udev_device_get_knodename(dev)); util_unlink_secure(event->udev, filename); util_delete_path(event->udev, filename); } -- cgit v1.2.3-54-g00ecf From 236fae6cf1a619a92174efdf84cd7d91e7d4348d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Apr 2010 17:56:32 +0200 Subject: udevadm: trigger - switch default action from "add" to "change" --- NEWS | 3 +++ udev/udevadm-trigger.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 687bcdfba1..c5fbbe165d 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ udev 152 ======== Bugfixes. +"udevadm trigger" default to "change" events now, instead of "add" +events. + All "add|change" matches are replaced by "!remove" in the rules and in the udev logic. All types of events will update possible symlinks and permissions, only "remove" is handled special now. diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index dbcaee3dbd..03aa53437f 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -110,7 +110,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) TYPE_SUBSYSTEMS, TYPE_FAILED, } device_type = TYPE_DEVICES; - const char *action = "add"; + const char *action = "change"; struct udev_enumerate *udev_enumerate; int rc = 0; @@ -184,7 +184,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) " subsystems sys subsystems and drivers\n" " failed trigger only the events which have been\n" " marked as failed during a previous run\n" - " --action= event action value, default is \"add\"\n" + " --action= event action value, default is \"change\"\n" " --subsystem-match= trigger devices from a matching subsystem\n" " --subsystem-nomatch= exclude devices from a matching subsystem\n" " --attr-match=]> trigger devices with a matching attribute\n" -- cgit v1.2.3-54-g00ecf From 1f084fe5811ce251d516a8022f8c7c27d0ef1f53 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 13 Apr 2010 08:52:48 +0200 Subject: remove "all_partitions" option We can not predict the major/minor of non-existing devices: $ grep . /sys/class/block/sd*/dev /sys/class/block/sda1/dev:259:524288 /sys/class/block/sda2/dev:259:262144 /sys/class/block/sda3/dev:259:786432 /sys/class/block/sda4/dev:259:131072 /sys/class/block/sda/dev:259:0 /sys/class/block/sdb/dev:259:655360 /sys/class/block/sdc/dev:259:393216 If this functionality is still needed for some broken hardware, it needs to be solved with a tool not part of the udev package. Because such option is unreliable and unsafe to use. --- NEWS | 7 ++++++- libudev/libudev-device-private.c | 4 ---- libudev/libudev-device.c | 17 ---------------- libudev/libudev-private.h | 2 -- test/udev-test.pl | 43 ---------------------------------------- udev/udev-node.c | 35 -------------------------------- udev/udev-rules.c | 23 --------------------- udev/udev.xml | 8 -------- udev/udevadm-info.c | 4 ---- 9 files changed, 6 insertions(+), 137 deletions(-) diff --git a/NEWS b/NEWS index c5fbbe165d..c422eaa8e3 100644 --- a/NEWS +++ b/NEWS @@ -2,9 +2,14 @@ udev 152 ======== Bugfixes. -"udevadm trigger" default to "change" events now, instead of "add" +"udevadm trigger" defaults to "change" events now, instead of "add" events. +The option "all_partitons" was removed from udev. This should not be +needed for usual hardware. Udev can not safely make assumptions +about non-exixting partition major/minor numbers, and therefore no +longer provide such an unreliable and unsafe option. + All "add|change" matches are replaced by "!remove" in the rules and in the udev logic. All types of events will update possible symlinks and permissions, only "remove" is handled special now. diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 1bcf441237..19c20b2cc8 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -41,8 +41,6 @@ int udev_device_update_db(struct udev_device *udev_device) udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) if (udev_list_entry_get_flags(list_entry)) goto file; - if (udev_device_get_num_fake_partitions(udev_device) != 0) - goto file; if (udev_device_get_ignore_remove(udev_device)) goto file; if (udev_device_get_devlink_priority(udev_device) != 0) @@ -95,8 +93,6 @@ file: fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); if (udev_device_get_event_timeout(udev_device) >= 0) fprintf(f, "T:%i\n", udev_device_get_event_timeout(udev_device)); - if (udev_device_get_num_fake_partitions(udev_device) != 0) - fprintf(f, "A:%i\n", udev_device_get_num_fake_partitions(udev_device)); if (udev_device_get_ignore_remove(udev_device)) fprintf(f, "R:%i\n", udev_device_get_ignore_remove(udev_device)); if (udev_device_get_watch_handle(udev_device) >= 0) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 410f75b300..75cc61c5fc 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -63,7 +63,6 @@ struct udev_device { unsigned long long int seqnum; int event_timeout; int timeout; - int num_fake_partitions; int devlink_priority; int refcount; dev_t devnum; @@ -284,9 +283,6 @@ int udev_device_read_db(struct udev_device *udev_device) case 'T': udev_device_set_event_timeout(udev_device, atoi(val)); break; - case 'A': - udev_device_set_num_fake_partitions(udev_device, atoi(val)); - break; case 'R': udev_device_set_ignore_remove(udev_device, atoi(val)); break; @@ -1425,19 +1421,6 @@ int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) return 0; } -int udev_device_get_num_fake_partitions(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->num_fake_partitions; -} - -int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num) -{ - udev_device->num_fake_partitions = num; - return 0; -} - int udev_device_get_devlink_priority(struct udev_device *udev_device) { if (!udev_device->info_loaded) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 3f2861f519..bf9e923b6d 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -93,8 +93,6 @@ int udev_device_get_event_timeout(struct udev_device *udev_device); int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout); int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); -int udev_device_get_num_fake_partitions(struct udev_device *udev_device); -int udev_device_set_num_fake_partitions(struct udev_device *udev_device, int num); int udev_device_get_devlink_priority(struct udev_device *udev_device); int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); int udev_device_get_ignore_remove(struct udev_device *udev_device); diff --git a/test/udev-test.pl b/test/udev-test.pl index aeca9486f7..4633d6be25 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -490,16 +490,6 @@ EOF SUBSYSTEMS=="usb", PROGRAM=="/bin/echo -n usb-%b", SYMLINK+="%c" SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n scsi-%b", SYMLINK+="%c" SUBSYSTEMS=="foo", PROGRAM=="/bin/echo -n foo-%b", SYMLINK+="%c" -EOF - }, - { - desc => "create all possible partitions", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda15" , - exp_majorminor => "8:15", - rules => < "link4", rules => < "all_partitions, option-only rule", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node6", - exp_rem_error => "yes", - rules => < "all_partitions, option-only rule (fail on partition)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "node6", - exp_add_error => "yes", - rules => < "yes", rules => < "ignore remove event test (with all partitions)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda14", - exp_rem_error => "yes", - option => "clean", - rules => < 0) { - info(udev, "creating device partition nodes '%s[1-%i]'\n", udev_device_get_devnode(dev), num); - for (i = 1; i <= num; i++) { - char partitionname[UTIL_PATH_SIZE]; - dev_t part_devnum; - - snprintf(partitionname, sizeof(partitionname), "%s%d", - udev_device_get_devnode(dev), i); - partitionname[sizeof(partitionname)-1] = '\0'; - part_devnum = makedev(major(udev_device_get_devnum(dev)), - minor(udev_device_get_devnum(dev)) + i); - udev_node_mknod(dev, partitionname, part_devnum, mode, uid, gid); - } - } - /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { if (udev_list_entry_get_flags(list_entry)) @@ -414,10 +395,8 @@ int udev_node_remove(struct udev_device *dev) struct udev *udev = udev_device_get_udev(dev); struct udev_list_entry *list_entry; const char *devnode; - char partitionname[UTIL_PATH_SIZE]; struct stat stats; int err = 0; - int num; /* remove/update symlinks, remove symlinks from name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) @@ -451,20 +430,6 @@ int udev_node_remove(struct udev_device *dev) udev_device_unref(dev_check); } - num = udev_device_get_num_fake_partitions(dev); - if (num > 0) { - int i; - - info(udev, "removing all_partitions '%s[1-%i]'\n", devnode, num); - if (num > 255) - return -1; - for (i = 1; i <= num; i++) { - snprintf(partitionname, sizeof(partitionname), "%s%d", devnode, i); - partitionname[sizeof(partitionname)-1] = '\0'; - util_unlink_secure(udev, partitionname); - } - } - util_delete_path(udev, devnode); return err; } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 0361f689d5..a4a86b664a 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -196,7 +196,6 @@ struct token { mode_t mode; uid_t uid; gid_t gid; - int num_fake_part; int devlink_prio; int event_timeout; int watch; @@ -371,9 +370,6 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_INOTIFY_WATCH: dbg(rules->udev, "%s %u\n", token_str(type), token->key.watch); break; - case TK_A_NUM_FAKE_PART: - dbg(rules->udev, "%s %u\n", token_str(type), token->key.num_fake_part); - break; case TK_A_DEVLINK_PRIO: dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.devlink_prio); break; @@ -1469,12 +1465,6 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); attr = get_key_attribute(rules->udev, key + sizeof("NAME")-1); if (attr != NULL) { - if (strstr(attr, "all_partitions") != NULL) { - int num = DEFAULT_FAKE_PARTITIONS_COUNT; - - dbg(rules->udev, "creation of partition nodes requested\n"); - rule_add_key(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num); - } if (strstr(attr, "ignore_remove") != NULL) { dbg(rules->udev, "remove event should be ignored\n"); rule_add_key(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); @@ -1576,12 +1566,6 @@ static int add_rule(struct udev_rules *rules, char *line, else if (strncmp(pos, "replace", strlen("replace")) == 0) rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, 0, NULL, NULL); } - if (strstr(value, "all_partitions") != NULL) { - int num = DEFAULT_FAKE_PARTITIONS_COUNT; - - rule_add_key(&rule_tmp, TK_A_NUM_FAKE_PART, 0, NULL, &num); - dbg(rules->udev, "creation of partition nodes requested\n"); - } pos = strstr(value, "nowatch"); if (pos != NULL) { const int off = 0; @@ -2331,13 +2315,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_STRING_ESCAPE_REPLACE: esc = ESCAPE_REPLACE; break; - case TK_A_NUM_FAKE_PART: - if (strcmp(udev_device_get_subsystem(event->dev), "block") != 0) - break; - if (udev_device_get_sysnum(event->dev) != NULL) - break; - udev_device_set_num_fake_partitions(event->dev, cur->key.num_fake_part); - break; case TK_A_INOTIFY_WATCH: event->inotify_watch = cur->key.watch; break; diff --git a/udev/udev.xml b/udev/udev.xml index 175cdbec6b..9275e0f79f 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -449,14 +449,6 @@ priorities overwrite existing symlinks of other devices. The default is 0. - - - - Create the device nodes for all available partitions of a block device. - This may be useful for removable media devices where media changes are not - detected. - - diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 47114092d7..c57620feef 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -142,10 +142,6 @@ static void print_record(struct udev_device *device) if (i != 0) printf("L: %i\n", i); - i = udev_device_get_num_fake_partitions(device); - if (i != 0) - printf("A: %u\n", i); - i = udev_device_get_ignore_remove(device); if (i != 0) printf("R: %u\n", i); -- cgit v1.2.3-54-g00ecf From 816e6bf0fb0849d03696a4b4ec2334e35e819425 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 13 Apr 2010 10:49:24 +0200 Subject: cdrom_id: Fix uninitialized variables In cases where cdrom_id does not go through the entire code path and one of the probing functions returns -1 or exits early, the remaining variables were never initialized. This caused effects like "phantom" audio CDs on empty drives, or bogus data like ID_CDROM_MEDIA_TRACK_COUNT=22528. Initialize the variables right away to avoid that. Bug-Ubuntu: https://launchpad.net/bugs/559723 --- extras/cdrom_id/cdrom_id.c | 98 +++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 894a890574..db3867c774 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -56,57 +56,57 @@ static void log_fn(struct udev *udev, int priority, } /* device info */ -static unsigned int cd_cd_rom; -static unsigned int cd_cd_r; -static unsigned int cd_cd_rw; -static unsigned int cd_dvd_rom; -static unsigned int cd_dvd_r; -static unsigned int cd_dvd_rw; -static unsigned int cd_dvd_ram; -static unsigned int cd_dvd_plus_r; -static unsigned int cd_dvd_plus_rw; -static unsigned int cd_dvd_plus_r_dl; -static unsigned int cd_dvd_plus_rw_dl; -static unsigned int cd_bd; -static unsigned int cd_bd_r; -static unsigned int cd_bd_re; -static unsigned int cd_hddvd; -static unsigned int cd_hddvd_r; -static unsigned int cd_hddvd_rw; -static unsigned int cd_mo; -static unsigned int cd_mrw; -static unsigned int cd_mrw_w; +static unsigned int cd_cd_rom = 0; +static unsigned int cd_cd_r = 0; +static unsigned int cd_cd_rw = 0; +static unsigned int cd_dvd_rom = 0; +static unsigned int cd_dvd_r = 0; +static unsigned int cd_dvd_rw = 0; +static unsigned int cd_dvd_ram = 0; +static unsigned int cd_dvd_plus_r = 0; +static unsigned int cd_dvd_plus_rw = 0; +static unsigned int cd_dvd_plus_r_dl = 0; +static unsigned int cd_dvd_plus_rw_dl = 0; +static unsigned int cd_bd = 0; +static unsigned int cd_bd_r = 0; +static unsigned int cd_bd_re = 0; +static unsigned int cd_hddvd = 0; +static unsigned int cd_hddvd_r = 0; +static unsigned int cd_hddvd_rw = 0; +static unsigned int cd_mo = 0; +static unsigned int cd_mrw = 0; +static unsigned int cd_mrw_w = 0; /* media info */ -static unsigned int cd_media; -static unsigned int cd_media_cd_rom; -static unsigned int cd_media_cd_r; -static unsigned int cd_media_cd_rw; -static unsigned int cd_media_dvd_rom; -static unsigned int cd_media_dvd_r; -static unsigned int cd_media_dvd_rw; -static unsigned int cd_media_dvd_ram; -static unsigned int cd_media_dvd_plus_r; -static unsigned int cd_media_dvd_plus_rw; -static unsigned int cd_media_dvd_plus_r_dl; -static unsigned int cd_media_dvd_plus_rw_dl; -static unsigned int cd_media_bd; -static unsigned int cd_media_bd_r; -static unsigned int cd_media_bd_re; -static unsigned int cd_media_hddvd; -static unsigned int cd_media_hddvd_r; -static unsigned int cd_media_hddvd_rw; -static unsigned int cd_media_mo; -static unsigned int cd_media_mrw; -static unsigned int cd_media_mrw_w; - -static const char *cd_media_state; -static unsigned int cd_media_session_next; -static unsigned int cd_media_session_count; -static unsigned int cd_media_track_count; -static unsigned int cd_media_track_count_data; -static unsigned int cd_media_track_count_audio; -static unsigned long long int cd_media_session_last_offset; +static unsigned int cd_media = 0; +static unsigned int cd_media_cd_rom = 0; +static unsigned int cd_media_cd_r = 0; +static unsigned int cd_media_cd_rw = 0; +static unsigned int cd_media_dvd_rom = 0; +static unsigned int cd_media_dvd_r = 0; +static unsigned int cd_media_dvd_rw = 0; +static unsigned int cd_media_dvd_ram = 0; +static unsigned int cd_media_dvd_plus_r = 0; +static unsigned int cd_media_dvd_plus_rw = 0; +static unsigned int cd_media_dvd_plus_r_dl = 0; +static unsigned int cd_media_dvd_plus_rw_dl = 0; +static unsigned int cd_media_bd = 0; +static unsigned int cd_media_bd_r = 0; +static unsigned int cd_media_bd_re = 0; +static unsigned int cd_media_hddvd = 0; +static unsigned int cd_media_hddvd_r = 0; +static unsigned int cd_media_hddvd_rw = 0; +static unsigned int cd_media_mo = 0; +static unsigned int cd_media_mrw = 0; +static unsigned int cd_media_mrw_w = 0; + +static const char *cd_media_state = NULL; +static unsigned int cd_media_session_next = 0; +static unsigned int cd_media_session_count = 0; +static unsigned int cd_media_track_count = 0; +static unsigned int cd_media_track_count_data = 0; +static unsigned int cd_media_track_count_audio = 0; +static unsigned long long int cd_media_session_last_offset = 0; #define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) #define SK(errcode) (((errcode) >> 16) & 0xF) -- cgit v1.2.3-54-g00ecf From 06ba47d8336c6d017a67d11f480341db07b9bc4b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 13 Apr 2010 12:12:08 +0200 Subject: rules: call modprobe on all events but "remove" --- rules/rules.d/50-udev-default.rules | 3 --- rules/rules.d/80-drivers.rules | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index a5f08233ed..7e09ea19bb 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -112,6 +112,3 @@ SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" KERNEL=="rrom[0-9]*", MODE="0400" - -# do not delete static device nodes -ACTION=="remove", NAME=="", TEST=="/lib/udev/devices/%k", OPTIONS+="ignore_remove" diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index d0485e13c4..86eb9187a9 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -ACTION!="add", GOTO="drivers_end" +ACTION=="remove", GOTO="drivers_end" DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -b $env{MODALIAS}" SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -b tifm_sd" -- cgit v1.2.3-54-g00ecf From a89d342dfb45b54e29381af9dbc495bbb2b057af Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 13 Apr 2010 12:45:38 +0200 Subject: remove "ignore_remove" option --- NEWS | 6 ++++++ libudev/libudev-device-private.c | 4 ---- libudev/libudev-device.c | 17 ----------------- libudev/libudev-private.h | 2 -- test/udev-test.pl | 10 ---------- udev/udev-node.c | 38 ++++++++++++++++++++++---------------- udev/udev-rules.c | 14 -------------- udev/udev.xml | 7 ------- udev/udevadm-info.c | 4 ---- 9 files changed, 28 insertions(+), 74 deletions(-) diff --git a/NEWS b/NEWS index c422eaa8e3..ea5c19d7f7 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,12 @@ needed for usual hardware. Udev can not safely make assumptions about non-exixting partition major/minor numbers, and therefore no longer provide such an unreliable and unsafe option. +The option "ignore_remove" was removed from udev. With devtmpfs +udev passed control over device nodes to the kernel. This option +should no longer be needed, or can not work as advertised. Neither +udev nor the kernel will remove device nodes which are copied from +the /lib/udev/devices/ directory. + All "add|change" matches are replaced by "!remove" in the rules and in the udev logic. All types of events will update possible symlinks and permissions, only "remove" is handled special now. diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 19c20b2cc8..5e4381ec27 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -41,8 +41,6 @@ int udev_device_update_db(struct udev_device *udev_device) udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) if (udev_list_entry_get_flags(list_entry)) goto file; - if (udev_device_get_ignore_remove(udev_device)) - goto file; if (udev_device_get_devlink_priority(udev_device) != 0) goto file; if (udev_device_get_event_timeout(udev_device) >= 0) @@ -93,8 +91,6 @@ file: fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); if (udev_device_get_event_timeout(udev_device) >= 0) fprintf(f, "T:%i\n", udev_device_get_event_timeout(udev_device)); - if (udev_device_get_ignore_remove(udev_device)) - fprintf(f, "R:%i\n", udev_device_get_ignore_remove(udev_device)); if (udev_device_get_watch_handle(udev_device) >= 0) fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 75cc61c5fc..b3b6a63114 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -75,7 +75,6 @@ struct udev_device { unsigned int envp_uptodate:1; unsigned int driver_set:1; unsigned int info_loaded:1; - unsigned int ignore_remove:1; }; struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) @@ -283,9 +282,6 @@ int udev_device_read_db(struct udev_device *udev_device) case 'T': udev_device_set_event_timeout(udev_device, atoi(val)); break; - case 'R': - udev_device_set_ignore_remove(udev_device, atoi(val)); - break; case 'E': udev_device_add_property_from_string(udev_device, val); break; @@ -1434,19 +1430,6 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) return 0; } -int udev_device_get_ignore_remove(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - device_load_info(udev_device); - return udev_device->ignore_remove; -} - -int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore) -{ - udev_device->ignore_remove = ignore; - return 0; -} - int udev_device_get_watch_handle(struct udev_device *udev_device) { if (!udev_device->info_loaded) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index bf9e923b6d..8dc469ec9b 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -95,8 +95,6 @@ int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); int udev_device_get_devlink_priority(struct udev_device *udev_device); int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); -int udev_device_get_ignore_remove(struct udev_device *udev_device); -int udev_device_set_ignore_remove(struct udev_device *udev_device, int ignore); int udev_device_get_watch_handle(struct udev_device *udev_device); int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); void udev_device_set_info_loaded(struct udev_device *device); diff --git a/test/udev-test.pl b/test/udev-test.pl index 4633d6be25..a4d3a728f7 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -975,16 +975,6 @@ EOF exp_name => "link4", rules => < "ignore remove event test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_rem_error => "yes", - rules => <udev, "NAME=\"%%k\" is superfluous and breaks " "kernel supplied names, please remove it from %s:%u\n", filename, lineno); rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); - attr = get_key_attribute(rules->udev, key + sizeof("NAME")-1); - if (attr != NULL) { - if (strstr(attr, "ignore_remove") != NULL) { - dbg(rules->udev, "remove event should be ignored\n"); - rule_add_key(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); - } - } } rule_tmp.rule.rule.flags = 1; continue; @@ -1540,10 +1533,6 @@ static int add_rule(struct udev_rules *rules, char *line, if (strcmp(key, "OPTIONS") == 0) { const char *pos; - if (strstr(value, "ignore_remove") != NULL) { - dbg(rules->udev, "remove event should be ignored\n"); - rule_add_key(&rule_tmp, TK_A_IGNORE_REMOVE, 0, NULL, NULL); - } pos = strstr(value, "link_priority="); if (pos != NULL) { int prio = atoi(&pos[strlen("link_priority=")]); @@ -2501,9 +2490,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_EVENT_TIMEOUT: udev_device_set_event_timeout(event->dev, cur->key.event_timeout); break; - case TK_A_IGNORE_REMOVE: - udev_device_set_ignore_remove(event->dev, 1); - break; case TK_A_ATTR: { const char *key_name = &rules->buf[cur->key.attr_off]; diff --git a/udev/udev.xml b/udev/udev.xml index 9275e0f79f..dce953dbce 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -435,13 +435,6 @@ Rule and device options: - - - - Do not remove the device node when the device goes away. This may be - useful as a workaround for broken device drivers. - - diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index c57620feef..5f6209af2a 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -142,10 +142,6 @@ static void print_record(struct udev_device *device) if (i != 0) printf("L: %i\n", i); - i = udev_device_get_ignore_remove(device); - if (i != 0) - printf("R: %u\n", i); - i = udev_device_get_watch_handle(device); if (i >= 0) printf("W: %u\n", i); -- cgit v1.2.3-54-g00ecf From 2b861dc92757b9a3214c2b8e9d8b1c3f3c162391 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 13 Apr 2010 15:25:48 +0200 Subject: cdrom_id: Fix uninitialized buffers Commit 5c6954f is actually a no-op, since static variables are already zero'ed by default anyway (but we keep it for clarity). The real difference was that a build with -O0 wor while a build with -O2 didn't. Turns out that some ioctls do not actually touch the result buffer in some cases, so we need to zero the result buffers to avoid interpreting random da as CD properties. https://launchpad.net/bugs/559723 https://launchpad.net/bugs/561585 --- extras/cdrom_id/cdrom_id.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index db3867c774..b6797cd317 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -237,6 +237,7 @@ static int cd_inquiry(struct udev *udev, int fd) { unsigned char inq[128]; int err; + memset (inq, 0, sizeof (inq)); scsi_cmd_set(udev, &sc, 0, 0x12); scsi_cmd_set(udev, &sc, 4, 36); scsi_cmd_set(udev, &sc, 5, 0); @@ -265,6 +266,7 @@ static int cd_profiles(struct udev *udev, int fd) unsigned int i; int err; + memset (header, 0, sizeof (header)); scsi_cmd_set(udev, &sc, 0, 0x46); scsi_cmd_set(udev, &sc, 1, 0); scsi_cmd_set(udev, &sc, 8, sizeof(header)); @@ -282,6 +284,7 @@ static int cd_profiles(struct udev *udev, int fd) return -1; } + memset (profiles, 0, sizeof (profiles)); scsi_cmd_set(udev, &sc, 0, 0x46); scsi_cmd_set(udev, &sc, 1, 1); scsi_cmd_set(udev, &sc, 6, len >> 16); @@ -440,6 +443,7 @@ static int cd_media_info(struct udev *udev, int fd) }; int err; + memset (header, 0, sizeof (header)); scsi_cmd_set(udev, &sc, 0, 0x51); scsi_cmd_set(udev, &sc, 8, sizeof(header)); scsi_cmd_set(udev, &sc, 9, 0); @@ -472,6 +476,7 @@ static int cd_media_toc(struct udev *udev, int fd) unsigned char *p; int err; + memset (header, 0, sizeof (header)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, 1); scsi_cmd_set(udev, &sc, 8, sizeof(header)); @@ -493,6 +498,7 @@ static int cd_media_toc(struct udev *udev, int fd) if (len < 8) return 0; + memset (toc, 0, sizeof (toc)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ scsi_cmd_set(udev, &sc, 7, len >> 8); @@ -520,6 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd) cd_media_track_count_audio++; } + memset (header, 0, sizeof (header)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ scsi_cmd_set(udev, &sc, 8, 12); -- cgit v1.2.3-54-g00ecf From c1b7f60deac0bc0e87a139648d57085512fd9e62 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Apr 2010 17:00:57 +0200 Subject: update NEWS --- NEWS | 12 +++++++----- extras/cdrom_id/cdrom_id.c | 18 +++++++++--------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index ea5c19d7f7..0c9e45b9ab 100644 --- a/NEWS +++ b/NEWS @@ -2,17 +2,19 @@ udev 152 ======== Bugfixes. -"udevadm trigger" defaults to "change" events now, instead of "add" -events. +"udevadm trigger" defaults to "change" events now instead of "add" +events. The "udev boot script" might need to add "--action=add" to +the trigger command if not already there, in case the initial coldplug +events are expected as "add" events. The option "all_partitons" was removed from udev. This should not be needed for usual hardware. Udev can not safely make assumptions about non-exixting partition major/minor numbers, and therefore no -longer provide such an unreliable and unsafe option. +longer provide this unreliable and unsafe option. The option "ignore_remove" was removed from udev. With devtmpfs udev passed control over device nodes to the kernel. This option -should no longer be needed, or can not work as advertised. Neither +should not be needed, or can not work as advertised. Neither udev nor the kernel will remove device nodes which are copied from the /lib/udev/devices/ directory. @@ -20,7 +22,7 @@ All "add|change" matches are replaced by "!remove" in the rules and in the udev logic. All types of events will update possible symlinks and permissions, only "remove" is handled special now. -The modem mode switch extra was removed and the external usb_modeswitch +The modem modeswitch extra was removed and the external usb_modeswitch program should be used instead. New and fixed keymaps. diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index b6797cd317..afb481d1a8 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -1,7 +1,7 @@ /* * cdrom_id - optical drive and media information prober * - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2010 Kay Sievers * * 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 @@ -157,7 +157,7 @@ struct scsi_cmd { static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, int arg) { if (i == 0) { - memset(cmd, 0x00, sizeof(struct scsi_cmd)); + memset(cmd, 0, sizeof(struct scsi_cmd)); cmd->cgc.quiet = 1; cmd->cgc.sense = &cmd->_sense.s; memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); @@ -237,7 +237,7 @@ static int cd_inquiry(struct udev *udev, int fd) { unsigned char inq[128]; int err; - memset (inq, 0, sizeof (inq)); + memset(inq, 0, sizeof(inq)); scsi_cmd_set(udev, &sc, 0, 0x12); scsi_cmd_set(udev, &sc, 4, 36); scsi_cmd_set(udev, &sc, 5, 0); @@ -266,7 +266,7 @@ static int cd_profiles(struct udev *udev, int fd) unsigned int i; int err; - memset (header, 0, sizeof (header)); + memset(header, 0, sizeof(header)); scsi_cmd_set(udev, &sc, 0, 0x46); scsi_cmd_set(udev, &sc, 1, 0); scsi_cmd_set(udev, &sc, 8, sizeof(header)); @@ -284,7 +284,7 @@ static int cd_profiles(struct udev *udev, int fd) return -1; } - memset (profiles, 0, sizeof (profiles)); + memset(profiles, 0, sizeof(profiles)); scsi_cmd_set(udev, &sc, 0, 0x46); scsi_cmd_set(udev, &sc, 1, 1); scsi_cmd_set(udev, &sc, 6, len >> 16); @@ -443,7 +443,7 @@ static int cd_media_info(struct udev *udev, int fd) }; int err; - memset (header, 0, sizeof (header)); + memset(header, 0, sizeof(header)); scsi_cmd_set(udev, &sc, 0, 0x51); scsi_cmd_set(udev, &sc, 8, sizeof(header)); scsi_cmd_set(udev, &sc, 9, 0); @@ -476,7 +476,7 @@ static int cd_media_toc(struct udev *udev, int fd) unsigned char *p; int err; - memset (header, 0, sizeof (header)); + memset(header, 0, sizeof(header)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, 1); scsi_cmd_set(udev, &sc, 8, sizeof(header)); @@ -498,7 +498,7 @@ static int cd_media_toc(struct udev *udev, int fd) if (len < 8) return 0; - memset (toc, 0, sizeof (toc)); + memset(toc, 0, sizeof(toc)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ scsi_cmd_set(udev, &sc, 7, len >> 8); @@ -526,7 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd) cd_media_track_count_audio++; } - memset (header, 0, sizeof (header)); + memset(header, 0, sizeof (header)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ scsi_cmd_set(udev, &sc, 8, 12); -- cgit v1.2.3-54-g00ecf From 0413a47ebfcd46ae43cb56ad508b2484bc97ff14 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Apr 2010 20:07:07 +0200 Subject: cdrom_id: rework feature/profiles buffer parsing --- extras/cdrom_id/cdrom_id.c | 156 ++++++++++++++++++++++++++------------------- 1 file changed, 91 insertions(+), 65 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index afb481d1a8..3f9ca4c228 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -154,19 +154,22 @@ struct scsi_cmd { struct sg_io_hdr sg_io; }; -static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, int arg) +static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd, unsigned char *buf, size_t bufsize) +{ + memset(cmd, 0x00, sizeof(struct scsi_cmd)); + memset(buf, 0x00, bufsize); + cmd->cgc.quiet = 1; + cmd->cgc.sense = &cmd->_sense.s; + memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); + cmd->sg_io.interface_id = 'S'; + cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); + cmd->sg_io.cmdp = cmd->cgc.cmd; + cmd->sg_io.sbp = cmd->_sense.u; + cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; +} + +static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg) { - if (i == 0) { - memset(cmd, 0, sizeof(struct scsi_cmd)); - cmd->cgc.quiet = 1; - cmd->cgc.sense = &cmd->_sense.s; - memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); - cmd->sg_io.interface_id = 'S'; - cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); - cmd->sg_io.cmdp = cmd->cgc.cmd; - cmd->sg_io.sbp = cmd->_sense.u; - cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; - } cmd->sg_io.cmd_len = i + 1; cmd->cgc.cmd[i] = arg; } @@ -237,7 +240,7 @@ static int cd_inquiry(struct udev *udev, int fd) { unsigned char inq[128]; int err; - memset(inq, 0, sizeof(inq)); + scsi_cmd_init(udev, &sc, inq, sizeof(inq)); scsi_cmd_set(udev, &sc, 0, 0x12); scsi_cmd_set(udev, &sc, 4, 36); scsi_cmd_set(udev, &sc, 5, 0); @@ -256,109 +259,132 @@ static int cd_inquiry(struct udev *udev, int fd) { return 0; } -static int cd_profiles(struct udev *udev, int fd) +static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) { - struct scsi_cmd sc; - unsigned char header[8]; - unsigned char profiles[512]; - unsigned int cur_profile; - unsigned int len; unsigned int i; - int err; - - memset(header, 0, sizeof(header)); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 1, 0); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err < 0)) { - info_scsi_cmd_err(udev, "GET CONFIGURATION", err); - return -1; - } - len = 4 + (header[0] << 24 | header[1] << 16 | header[2] << 8 | header[3]); - info(udev, "GET CONFIGURATION: number of profiles %i\n", len); - if (len > sizeof(profiles)) { - info(udev, "invalid number of profiles\n"); - return -1; - } - - memset(profiles, 0, sizeof(profiles)); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 1, 1); - scsi_cmd_set(udev, &sc, 6, len >> 16); - scsi_cmd_set(udev, &sc, 7, len >> 8); - scsi_cmd_set(udev, &sc, 8, len); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, profiles, len); - if ((err < 0)) { - info_scsi_cmd_err(udev, "GET CONFIGURATION", err); - return -1; - } - - /* device profiles */ - for (i = 12; i < profiles[11]; i += 4) { - unsigned int profile = (profiles[i] << 8 | profiles[i + 1]); - if (profile == 0) - continue; - info(udev, "profile 0x%02x\n", profile); + for (i = 0; i+4 <= size; i += 4) { + int profile; + profile = profiles[i] << 8 | profiles[i+1]; switch (profile) { case 0x03: case 0x04: case 0x05: + info(udev, "profile 0x%02x mo\n", profile); cd_mo = 1; - break; + break; case 0x10: + info(udev, "profile 0x%02x dvd_rom\n", profile); cd_dvd_rom = 1; break; case 0x12: + info(udev, "profile 0x%02x dvd_ram\n", profile); cd_dvd_ram = 1; break; case 0x13: case 0x14: + info(udev, "profile 0x%02x dvd_rw\n", profile); cd_dvd_rw = 1; break; case 0x1B: + info(udev, "profile 0x%02x dvd_plus_r\n", profile); cd_dvd_plus_r = 1; break; case 0x1A: + info(udev, "profile 0x%02x dvd_plus_rw\n", profile); cd_dvd_plus_rw = 1; break; case 0x2A: + info(udev, "profile 0x%02x dvd_plus_rw_dl\n", profile); cd_dvd_plus_rw_dl = 1; break; case 0x2B: + info(udev, "profile 0x%02x dvd_plus_r_dl\n", profile); cd_dvd_plus_r_dl = 1; break; case 0x40: cd_bd = 1; + info(udev, "profile 0x%02x bd\n", profile); break; case 0x41: case 0x42: cd_bd_r = 1; + info(udev, "profile 0x%02x bd_r\n", profile); break; case 0x43: cd_bd_re = 1; + info(udev, "profile 0x%02x bd_re\n", profile); break; case 0x50: cd_hddvd = 1; + info(udev, "profile 0x%02x hddvd\n", profile); break; case 0x51: cd_hddvd_r = 1; + info(udev, "profile 0x%02x hddvd_r\n", profile); break; case 0x52: cd_hddvd_rw = 1; + info(udev, "profile 0x%02x hddvd_rw\n", profile); + break; + default: + info(udev, "profile 0x%02x \n", profile); + break; + } + } + return 0; +} + +static int cd_profiles(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char features[65530]; + unsigned int cur_profile = 0; + unsigned int len; + unsigned int i; + int err; + + scsi_cmd_init(udev, &sc, features, sizeof(features)); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 7, (sizeof(features) >> 8) & 0xff); + scsi_cmd_set(udev, &sc, 8, sizeof(features) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features)); + if ((err < 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + return -1; + } + + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; + info(udev, "GET CONFIGURATION: size of features buffer %i\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); + len = sizeof(features); + } + + /* device features */ + for (i = 8; i+4 < len; i += (4 + features[i+3])) { + unsigned int feature; + + feature = features[i] << 8 | features[i+1]; + + switch (feature) { + case 0x00: + info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); + feature_profiles(udev, &features[i]+4, features[i+3]); + + /* set current profile, if we got a profiles section */ + cur_profile = features[6] << 8 | features[7]; + info(udev, "current profile 0x%02x\n", cur_profile); break; default: + info(udev, "GET CONFIGURATION: feature %i , with %i bytes\n", feature, features[i+3]); break; } } - /* current media profile */ - cur_profile = header[6] << 8 | header[7]; - info(udev, "current profile 0x%02x\n", cur_profile); if (cur_profile == 0) { info(udev, "no current profile, assuming no media\n"); return -1; @@ -443,7 +469,7 @@ static int cd_media_info(struct udev *udev, int fd) }; int err; - memset(header, 0, sizeof(header)); + scsi_cmd_init(udev, &sc, header, sizeof(header)); scsi_cmd_set(udev, &sc, 0, 0x51); scsi_cmd_set(udev, &sc, 8, sizeof(header)); scsi_cmd_set(udev, &sc, 9, 0); @@ -476,7 +502,7 @@ static int cd_media_toc(struct udev *udev, int fd) unsigned char *p; int err; - memset(header, 0, sizeof(header)); + scsi_cmd_init(udev, &sc, header, sizeof(header)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, 1); scsi_cmd_set(udev, &sc, 8, sizeof(header)); @@ -498,7 +524,7 @@ static int cd_media_toc(struct udev *udev, int fd) if (len < 8) return 0; - memset(toc, 0, sizeof(toc)); + scsi_cmd_init(udev, &sc, toc, sizeof(toc)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ scsi_cmd_set(udev, &sc, 7, len >> 8); @@ -526,7 +552,7 @@ static int cd_media_toc(struct udev *udev, int fd) cd_media_track_count_audio++; } - memset(header, 0, sizeof (header)); + scsi_cmd_init(udev, &sc, header, sizeof(header)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ scsi_cmd_set(udev, &sc, 8, 12); -- cgit v1.2.3-54-g00ecf From 2e9df1981833e1e029b7ce6c12a44dffb6aad0cb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Apr 2010 20:48:04 +0200 Subject: cdrom_id: print more debug messages --- extras/cdrom_id/cdrom_id.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 3f9ca4c228..d9b6fbded3 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -374,10 +374,6 @@ static int cd_profiles(struct udev *udev, int fd) case 0x00: info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); feature_profiles(udev, &features[i]+4, features[i+3]); - - /* set current profile, if we got a profiles section */ - cur_profile = features[6] << 8 | features[7]; - info(udev, "current profile 0x%02x\n", cur_profile); break; default: info(udev, "GET CONFIGURATION: feature %i , with %i bytes\n", feature, features[i+3]); @@ -385,7 +381,10 @@ static int cd_profiles(struct udev *udev, int fd) } } - if (cur_profile == 0) { + cur_profile = features[6] << 8 | features[7]; + if (cur_profile > 0) { + info(udev, "current profile 0x%02x\n", cur_profile); + } else { info(udev, "no current profile, assuming no media\n"); return -1; } @@ -396,62 +395,81 @@ static int cd_profiles(struct udev *udev, int fd) case 0x03: case 0x04: case 0x05: + info(udev, "profile 0x%02x \n", cur_profile); cd_media_mo = 1; break; case 0x08: + info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); cd_media_cd_rom = 1; break; case 0x09: + info(udev, "profile 0x%02x media_cd_r\n", cur_profile); cd_media_cd_r = 1; break; case 0x0a: + info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); cd_media_cd_rw = 1; break; case 0x10: + info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); cd_media_dvd_rom = 1; break; case 0x11: + info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); cd_media_dvd_r = 1; break; case 0x12: + info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); cd_media_dvd_ram = 1; break; case 0x13: case 0x14: + info(udev, "profile 0x%02x media_dvd_rw\n", cur_profile); cd_media_dvd_rw = 1; break; case 0x1B: + info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); cd_media_dvd_plus_r = 1; break; case 0x1A: + info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); cd_media_dvd_plus_rw = 1; break; case 0x2A: + info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); cd_media_dvd_plus_rw_dl = 1; break; case 0x2B: + info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); cd_media_dvd_plus_r_dl = 1; break; case 0x40: + info(udev, "profile 0x%02x media_bd\n", cur_profile); cd_media_bd = 1; break; case 0x41: case 0x42: + info(udev, "profile 0x%02x media_bd_r\n", cur_profile); cd_media_bd_r = 1; break; case 0x43: + info(udev, "profile 0x%02x media_bd_re\n", cur_profile); cd_media_bd_re = 1; break; case 0x50: + info(udev, "profile 0x%02x media_hddvd\n", cur_profile); cd_media_hddvd = 1; break; case 0x51: + info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); cd_media_hddvd_r = 1; break; case 0x52: + info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); cd_media_hddvd_rw = 1; break; default: + info(udev, "profile 0x%02x \n", cur_profile); break; } return 0; -- cgit v1.2.3-54-g00ecf From 140647ad1aec50e2f657e7838e893a87404ff83a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Apr 2010 21:18:21 +0200 Subject: cdrom_id: debug - print feature values in hex --- extras/cdrom_id/cdrom_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index d9b6fbded3..b2c107b038 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -376,7 +376,7 @@ static int cd_profiles(struct udev *udev, int fd) feature_profiles(udev, &features[i]+4, features[i+3]); break; default: - info(udev, "GET CONFIGURATION: feature %i , with %i bytes\n", feature, features[i+3]); + info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); break; } } -- cgit v1.2.3-54-g00ecf From a60b077a465b19af2efd9bf0cb5f0f67117be780 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Apr 2010 21:22:38 +0200 Subject: cdrom_id: debug - print feature values in hex --- extras/cdrom_id/cdrom_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index b2c107b038..16b1260276 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -357,7 +357,7 @@ static int cd_profiles(struct udev *udev, int fd) } len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; - info(udev, "GET CONFIGURATION: size of features buffer %i\n", len); + info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); if (len > sizeof(features)) { info(udev, "can not get features in a single query, truncating\n"); -- cgit v1.2.3-54-g00ecf From 58e178894bfc040834e1270c6fe9b9fdef513550 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 15 Apr 2010 08:56:48 +0200 Subject: cdrom_id: Do not ignore errors from scsi_cmd_run() scsi_cmd_run() can return positive error messages if we have CHECK_CONDITION set and get the error code from the SCSI command result. So check the result for non-zero, not for being negative. This should fix another cause for "phantom" media in empty CD-ROM drives. Thanks to Mike Brudevold for spotting this! https://launchpad.net/bugs/562978 --- extras/cdrom_id/cdrom_id.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 16b1260276..37212e9794 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -245,7 +245,7 @@ static int cd_inquiry(struct udev *udev, int fd) { scsi_cmd_set(udev, &sc, 4, 36); scsi_cmd_set(udev, &sc, 5, 0); err = scsi_cmd_run(udev, &sc, fd, inq, 36); - if ((err < 0)) { + if ((err != 0)) { info_scsi_cmd_err(udev, "INQUIRY", err); return -1; } @@ -351,7 +351,7 @@ static int cd_profiles(struct udev *udev, int fd) scsi_cmd_set(udev, &sc, 8, sizeof(features) & 0xff); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features)); - if ((err < 0)) { + if ((err != 0)) { info_scsi_cmd_err(udev, "GET CONFIGURATION", err); return -1; } @@ -492,7 +492,7 @@ static int cd_media_info(struct udev *udev, int fd) scsi_cmd_set(udev, &sc, 8, sizeof(header)); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err < 0)) { + if ((err != 0)) { info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); return -1; }; @@ -526,7 +526,7 @@ static int cd_media_toc(struct udev *udev, int fd) scsi_cmd_set(udev, &sc, 8, sizeof(header)); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err < 0)) { + if ((err != 0)) { info_scsi_cmd_err(udev, "READ TOC", err); return -1; } @@ -549,7 +549,7 @@ static int cd_media_toc(struct udev *udev, int fd) scsi_cmd_set(udev, &sc, 8, len); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, toc, len); - if ((err < 0)) { + if ((err != 0)) { info_scsi_cmd_err(udev, "READ TOC (tracks)", err); return -1; } @@ -576,7 +576,7 @@ static int cd_media_toc(struct udev *udev, int fd) scsi_cmd_set(udev, &sc, 8, 12); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err < 0)) { + if ((err != 0)) { info_scsi_cmd_err(udev, "READ TOC (multi session)", err); return -1; } -- cgit v1.2.3-54-g00ecf From 30e3b1a0d3a3ec76f16736470dc656744848d941 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 15 Apr 2010 21:25:57 +0200 Subject: cdrom_id: Swap media state and TOC info probing Blank CDs do not have a TOC, thus will fail cd_media_toc() (at least with the "Do not ignore errors from scsi_cmd_run()" fix). Thus probe the media state first, so that we can properly detect blank media. --- extras/cdrom_id/cdrom_id.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 37212e9794..722b8f8f45 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -681,14 +681,14 @@ int main(int argc, char *argv[]) if (cd_profiles(udev, fd) < 0) goto print; - /* get session/track info */ - if (cd_media_toc(udev, fd) < 0) - goto print; - /* get writable media state */ if (cd_media_info(udev, fd) < 0) goto print; + /* get session/track info */ + if (cd_media_toc(udev, fd) < 0) + goto print; + print: printf("ID_CDROM=1\n"); if (cd_cd_rom) -- cgit v1.2.3-54-g00ecf From b3ad0c3c6fce3c04a2f3070200001d6566d1b322 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Thu, 15 Apr 2010 21:35:51 +0200 Subject: configure.ac - fix typo in --with-pci-ids-path option --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d53dd12a6c..492fa02242 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,7 @@ if test "x$enable_extras" = xyes; then AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) AC_ARG_WITH(pci-ids-path, - AS_HELP_STRING([--pci-ids-path=DIR], [Path to pci.ids file]), + AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file]), [PCI_DATABASE=${withval}], [if test -n "$pciids" ; then PCI_DATABASE="$pciids" -- cgit v1.2.3-54-g00ecf From 7c07740ce7b0941844b15573449a730283d5bba5 Mon Sep 17 00:00:00 2001 From: Mike Brudevold Date: Thu, 15 Apr 2010 19:55:50 -0500 Subject: cdrom_id: add missing profiles to feature_profiles Signed-off-by: Mike Brudevold --- extras/cdrom_id/cdrom_id.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 722b8f8f45..da2785ee3f 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -274,6 +274,18 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si info(udev, "profile 0x%02x mo\n", profile); cd_mo = 1; break; + case 0x08: + info(udev, "profile 0x%02x cd_rom\n", profile); + cd_cd_rom = 1; + break; + case 0x09: + info(udev, "profile 0x%02x cd_r\n", profile); + cd_cd_r = 1; + break; + case 0x0A: + info(udev, "profile 0x%02x cd_rw\n", profile); + cd_cd_rw = 1; + break; case 0x10: info(udev, "profile 0x%02x dvd_rom\n", profile); cd_dvd_rom = 1; -- cgit v1.2.3-54-g00ecf From bc913ce47821ed030437ec9b25507b5dd52b59cb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 17 Apr 2010 19:31:44 +0200 Subject: cdrom_id: set ID_CDROM_MEDIA=1 only for known media On Sat, Apr 17, 2010 at 18:26, Mike Brudevold wrote: > My CD-RW drive experiences a problem in that it automatically closes > after opening if there is media in the drive. This only happens if > there was media in the drive when it was last closed (an empty drive > stays open). ... > cd_profiles: current profile 0x02 > cd_profiles: profile 0x02 ... Do not pretend to have a media, when we receive a profile like 0x02, which just means "Removable disk". Thanks to Mike Brudevold for the initial patch. --- extras/cdrom_id/cdrom_id.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index da2785ee3f..935f117c4d 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -401,83 +401,99 @@ static int cd_profiles(struct udev *udev, int fd) return -1; } - cd_media = 1; - switch (cur_profile) { case 0x03: case 0x04: case 0x05: info(udev, "profile 0x%02x \n", cur_profile); + cd_media = 1; cd_media_mo = 1; break; case 0x08: info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); + cd_media = 1; cd_media_cd_rom = 1; break; case 0x09: info(udev, "profile 0x%02x media_cd_r\n", cur_profile); + cd_media = 1; cd_media_cd_r = 1; break; case 0x0a: info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); + cd_media = 1; cd_media_cd_rw = 1; break; case 0x10: info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); + cd_media = 1; cd_media_dvd_rom = 1; break; case 0x11: info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); + cd_media = 1; cd_media_dvd_r = 1; break; case 0x12: info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); + cd_media = 1; cd_media_dvd_ram = 1; break; case 0x13: case 0x14: info(udev, "profile 0x%02x media_dvd_rw\n", cur_profile); + cd_media = 1; cd_media_dvd_rw = 1; break; case 0x1B: info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); + cd_media = 1; cd_media_dvd_plus_r = 1; break; case 0x1A: info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); + cd_media = 1; cd_media_dvd_plus_rw = 1; break; case 0x2A: info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); + cd_media = 1; cd_media_dvd_plus_rw_dl = 1; break; case 0x2B: info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); + cd_media = 1; cd_media_dvd_plus_r_dl = 1; break; case 0x40: info(udev, "profile 0x%02x media_bd\n", cur_profile); + cd_media = 1; cd_media_bd = 1; break; case 0x41: case 0x42: info(udev, "profile 0x%02x media_bd_r\n", cur_profile); + cd_media = 1; cd_media_bd_r = 1; break; case 0x43: info(udev, "profile 0x%02x media_bd_re\n", cur_profile); + cd_media = 1; cd_media_bd_re = 1; break; case 0x50: info(udev, "profile 0x%02x media_hddvd\n", cur_profile); + cd_media = 1; cd_media_hddvd = 1; break; case 0x51: info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); + cd_media = 1; cd_media_hddvd_r = 1; break; case 0x52: info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); + cd_media = 1; cd_media_hddvd_rw = 1; break; default: @@ -501,7 +517,7 @@ static int cd_media_info(struct udev *udev, int fd) scsi_cmd_init(udev, &sc, header, sizeof(header)); scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err != 0)) { @@ -509,10 +525,11 @@ static int cd_media_info(struct udev *udev, int fd) return -1; }; + cd_media = 1; info(udev, "disk type %02x\n", header[8]); /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ - if (!cd_media_cd_rom && (header[2] & 3) < 4) + if (!cd_media_cd_rom) cd_media_state = media_status[header[2] & 3]; if ((header[2] & 3) != 2) @@ -535,7 +552,7 @@ static int cd_media_toc(struct udev *udev, int fd) scsi_cmd_init(udev, &sc, header, sizeof(header)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, 1); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err != 0)) { @@ -557,8 +574,8 @@ static int cd_media_toc(struct udev *udev, int fd) scsi_cmd_init(udev, &sc, toc, sizeof(toc)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ - scsi_cmd_set(udev, &sc, 7, len >> 8); - scsi_cmd_set(udev, &sc, 8, len); + scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); + scsi_cmd_set(udev, &sc, 8, len & 0xff); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, toc, len); if ((err != 0)) { @@ -585,7 +602,7 @@ static int cd_media_toc(struct udev *udev, int fd) scsi_cmd_init(udev, &sc, header, sizeof(header)); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ - scsi_cmd_set(udev, &sc, 8, 12); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err != 0)) { -- cgit v1.2.3-54-g00ecf From db57bdda04e20667f510262d045c2af6fe335931 Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Mon, 19 Apr 2010 08:48:34 +0200 Subject: keymap: Unite laptop models needing common volume-key release quirk Many laptop models need the same volume-key release quirk. Currently, two models have identical force-release-maps/ keymap files (dell-studio-1557 and fujitsu-amilo-si1848) and two more need to be added (Mitac and Coolbox QBook). This replaces the identical force-release-maps files with one 'common-volume-keys' file to make adding new models easier. There is no obvious DMI commonality between the models needing the quirk (i.e. they do not all share the same BIOS), so it will remain necessary to scan for each model separately in 95-keyboard-force-release.rules. https://launchpad.net/bugs/565459 Signed-off-by: Martin Pitt --- Makefile.am | 3 +-- extras/keymap/95-keyboard-force-release.rules | 4 ++-- extras/keymap/force-release-maps/common-volume-keys | 3 +++ extras/keymap/force-release-maps/dell-studio-1557 | 3 --- extras/keymap/force-release-maps/fujitsu-amilo-si1848 | 3 --- 5 files changed, 6 insertions(+), 10 deletions(-) create mode 100644 extras/keymap/force-release-maps/common-volume-keys delete mode 100755 extras/keymap/force-release-maps/dell-studio-1557 delete mode 100644 extras/keymap/force-release-maps/fujitsu-amilo-si1848 diff --git a/Makefile.am b/Makefile.am index 68a68d9166..076db8c9e7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -540,8 +540,7 @@ dist_udevkeymap_DATA = \ udevkeymapforcereldir = $(libexecdir)/keymaps/force-release dist_udevkeymapforcerel_DATA = \ extras/keymap/force-release-maps/samsung-other \ - extras/keymap/force-release-maps/fujitsu-amilo-si1848 \ - extras/keymap/force-release-maps/dell-studio-1557 + extras/keymap/force-release-maps/common-volume-keys extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h mkdir -p extras/keymap diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index b973614c85..b75d6d2e5b 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -21,8 +21,8 @@ ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" -ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath dell-studio-1557" +ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u", RUN+="keyboard-force-release.sh $devpath fujitsu-amilo-si1848" +ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u", RUN+="keyboard-force-release.sh $devpath common-volume-keys" LABEL="force_release_end" diff --git a/extras/keymap/force-release-maps/common-volume-keys b/extras/keymap/force-release-maps/common-volume-keys new file mode 100644 index 0000000000..3a7654d735 --- /dev/null +++ b/extras/keymap/force-release-maps/common-volume-keys @@ -0,0 +1,3 @@ +0xa0 #mute +0xae #volume down +0xb0 #volume up diff --git a/extras/keymap/force-release-maps/dell-studio-1557 b/extras/keymap/force-release-maps/dell-studio-1557 deleted file mode 100755 index 171867316d..0000000000 --- a/extras/keymap/force-release-maps/dell-studio-1557 +++ /dev/null @@ -1,3 +0,0 @@ -0xa0 #mute -0xae #volume up -0xb0 #volume down diff --git a/extras/keymap/force-release-maps/fujitsu-amilo-si1848 b/extras/keymap/force-release-maps/fujitsu-amilo-si1848 deleted file mode 100644 index 171867316d..0000000000 --- a/extras/keymap/force-release-maps/fujitsu-amilo-si1848 +++ /dev/null @@ -1,3 +0,0 @@ -0xa0 #mute -0xae #volume up -0xb0 #volume down -- cgit v1.2.3-54-g00ecf From af3f56ff71e9ed4b98dcaa797795f3ff5d3be0cf Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Mon, 19 Apr 2010 08:54:04 +0200 Subject: keymap: Add force-release quirk for Coolbox QBook 270-02 https://launchpad.net/bugs/420473 Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index b75d6d2e5b..4fd925f553 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -25,4 +25,6 @@ ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 15 ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="FOXCONN", ATTR{[dmi/id]product_name}=="QBOOK", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From 23c455b887e039183a1b2d78305df7b9f1cdad73 Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Mon, 19 Apr 2010 08:56:45 +0200 Subject: keymap: Add force-release quirk for Mitac 8050QDA https://launchpad.net/bugs/374884 Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 4fd925f553..c9edacf476 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -27,4 +27,6 @@ ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u ENV{DMI_VENDOR}=="FOXCONN", ATTR{[dmi/id]product_name}=="QBOOK", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From db123fe9f001fe76f5f582478c2ca2e792cfd95b Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 19 Apr 2010 12:46:07 +0200 Subject: doc: document the WAIT_FOR timeout --- udev/udev.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index dce953dbce..d3fa76a9d8 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -426,7 +426,8 @@ - Wait for a file to become available. + Wait for a file to become available or until a 10 + seconds timeout expires. @@ -461,7 +462,7 @@ Watch the device node with inotify, when closed after being opened for - writing, a change uevent will be synthesised. + writing, a change uevent will be synthesised. -- cgit v1.2.3-54-g00ecf From 8b56bada9a9d9a73af06d27634e53648be0cc612 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 19 Apr 2010 15:10:34 +0200 Subject: Revert "Fix switching Logitech bluetooth adapters into hci mode." This reverts commit 2b463cb050cbf77d9c6b51e0f5a9d89bf7eb1bc3. --- extras/hid2hci/70-hid2hci.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index 0687c8aa78..72e70a0465 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -10,8 +10,8 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" -# Logitech devices -KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ +# Logitech devices (hidraw) +KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ RUN+="hid2hci --method=logitech-hid --devpath=%p" ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" -- cgit v1.2.3-54-g00ecf From 9355f324e11c4b9ffdbfe2eaf73891ba01b80a0e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 19 Apr 2010 18:55:10 +0200 Subject: add O_NOFOLLOW when creating files in link stack --- udev/udev-node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 34de268464..2a2c2cf0b4 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -323,7 +323,7 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) err = util_create_path(udev, filename); if (err != 0 && err != -ENOENT) break; - fd = open(filename, O_WRONLY|O_CREAT, 0444); + fd = open(filename, O_WRONLY|O_CREAT|O_NOFOLLOW, 0444); if (fd >= 0) close(fd); else -- cgit v1.2.3-54-g00ecf From 6252f9e732c827defdac38e2eccab0657492d9c9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 19 Apr 2010 18:57:28 +0200 Subject: delete only device nodes, not symlinks when deleting a devtmpfs node http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=550152 --- udev/udev-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 26939e75db..b2e1baee1f 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -647,7 +647,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) char filename[UTIL_PATH_SIZE]; util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); - if (stat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) { + if (lstat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) { info(event->udev, "remove kernel created node '%s'\n", udev_device_get_knodename(dev)); util_unlink_secure(event->udev, filename); util_delete_path(event->udev, filename); -- cgit v1.2.3-54-g00ecf From d5a4ca9dfe235ed410c684e4e7499984a55f3b05 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Fri, 16 Apr 2010 00:21:02 +0400 Subject: hid2hci: include linux/types.h for __u32 --- extras/hid2hci/hid2hci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c index 0d0a022d52..839c4fbce7 100644 --- a/extras/hid2hci/hid2hci.c +++ b/extras/hid2hci/hid2hci.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include -- cgit v1.2.3-54-g00ecf From 4101ce14b3f6646f3468f6a489d87d057aab7163 Mon Sep 17 00:00:00 2001 From: "Yury G. Kudryashov" Date: Fri, 16 Apr 2010 09:38:32 +0400 Subject: configure.ac: ddd --with-firmware-path option In NixOS we need to use non-standard firmware path: we have no /lib. --- Makefile.am | 1 + configure.ac | 21 +++++++++++++++++++++ extras/firmware/firmware.c | 5 +---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 076db8c9e7..7403949cf3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -194,6 +194,7 @@ dist_udevrules_DATA += \ # ------------------------------------------------------------------------------ extras_firmware_firmware_SOURCES = extras/firmware/firmware.c extras_firmware_firmware_LDADD = libudev/libudev-private.la +extras_firmware_firmware_CPPFLAGS = $(AM_CPPFLAGS) -DFIRMWARE_PATH="$(FIRMWARE_PATH)" dist_udevrules_DATA += extras/firmware/50-firmware.rules libexec_PROGRAMS = extras/firmware/firmware diff --git a/configure.ac b/configure.ac index 492fa02242..cce70d1178 100644 --- a/configure.ac +++ b/configure.ac @@ -82,6 +82,26 @@ if test "x$enable_extras" = xyes; then fi]) AC_SUBST(PCI_DATABASE) + AC_ARG_WITH(firmware-path, + AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], + [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), + [], + [with_firmware_path="/lib/fimware/updates:/lib/fimware"] + ) + OLD_IFS=$IFS + IFS=: + for i in $with_firmware_path + do + if test "x${FIRMWARE_PATH}" = "x" + then + FIRMWARE_PATH="\\\"${i}/\\\"" + else + FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\"" + fi + done + IFS=$OLD_IFS + AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH]) + AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) fi @@ -144,6 +164,7 @@ AC_MSG_RESULT([ usb.ids: ${USB_DATABASE} pci.ids: ${PCI_DATABASE} + firmware path: ${FIRMWARE_PATH} xsltproc: ${XSLTPROC} gperf: ${GPERF} diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c index 92f0918c6f..76593bad30 100644 --- a/extras/firmware/firmware.c +++ b/extras/firmware/firmware.c @@ -79,10 +79,7 @@ int main(int argc, char **argv) { "help", no_argument, NULL, 'h' }, {} }; - static const char *searchpath[] = { - "/lib/firmware/updates/", - "/lib/firmware/" - }; + static const char *searchpath[] = { FIRMWARE_PATH }; char fwencpath[UTIL_PATH_SIZE]; char misspath[UTIL_PATH_SIZE]; char loadpath[UTIL_PATH_SIZE]; -- cgit v1.2.3-54-g00ecf From 85f22036fc0e7667188c0ace5082236b1cbeff94 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 20 Apr 2010 07:29:51 +0200 Subject: doc: add section about how *not* to rename device nodes Thanks to Mario 'BitKoenig' Holbe . --- udev/udev.xml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index d3fa76a9d8..192a6f1238 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -297,8 +297,13 @@ - The name of the node to be created, or the name the network interface - should be renamed to. + The name, a network interface should be renamed to, or the name + a device node should be named. Usually the kernel provides the defined + node name, or even creates and removes the node before udev receives + any event. Changing the node name from the kernel's default may result + in unexpected behavior and is not supported. Udev is only expected to + handle device node permissions and to create additional symlinks, which + do not conflict with the kernel device node names. @@ -306,9 +311,16 @@ The name of a symlink targeting the node. Every matching rule will add - this value to the list of symlinks to be created along with the device node. + this value to the list of symlinks to be created along with the device node. Multiple symlinks may be specified by separating the names by the space - character. + character. In case multiple devices claim the same name, the link will + always point to the device with the highest link_priority. If the current device + goes away, the links will be re-evaluated and the device with the next highest + link_priority will own the link. If no link_priority is specified, the order + of the devices, and which of them will own the link, is undefined. Claiming + the same name for a node and links may result in unexpected behavior and is + not supported. + -- cgit v1.2.3-54-g00ecf From f1c4a0e19fca80bcc81aaba4003e29ab934b5487 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 20 Apr 2010 07:32:40 +0200 Subject: release 152 --- ChangeLog | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 2 +- 2 files changed, 122 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d07f7d2c4b..f8b2942632 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,124 @@ +Summary of changes from v151 to v152 +============================================ + +Adrian Bunk (1): + udev needs automake 1.10 + +Amit Shah (2): + Fix virtio-ports rule to use $attr instead of $ATTR + rules: virtio - fix is to check if the 'name' attribute is present + +Andy Whitcroft (2): + keymap: Add Samsung Q210/P210 force-release quirk + keymap: Add Fujitsu Amilo 1848+u force-release quirk + +Dan Williams (1): + modeswitch: morph into tool that only switches Mobile Action cables + +David Zeuthen (3): + Decrease buffer size when advancing past NUL byte + Use UTIL_LINE_SIZE, not UTIL_PATH_SIZE to truncate properties + Increase UTIL_LINE_SIZE from 2048 to 16384 + +Harald Hoyer (1): + cdrom_id: remove debugging code + +Jerone Young (6): + Force key release for volume keys on Dell Studio 1557 + Fix Keymapping for upcoming Dell Laptops + Add new Dell touchpad keycode + Revert special casing 0xD8 to latitude XT only + Fix Dell Studio 1558 volume keys not releasing + Add support for another Dell touchpad toggle key + +Kamal Mostafa (3): + keymap: Unite laptop models needing common volume-key release quirk + keymap: Add force-release quirk for Coolbox QBook 270-02 + keymap: Add force-release quirk for Mitac 8050QDA + +Kay Sievers (43): + libudev: bump minor version + udevadm: fix untested and broken commit to set buffer size + configure.ac: version bump + udev-acl: no not encourage use of ACL_MANAGE outside of rules file + replace utimes() with utimensat() + libbudev-private: rename udev_list_entry_get_flag() + udevadm: monitor - use / as separator in --subsystem-match=subsystem[/devtype] + use major:minor as entries in symlink stack instead of devpath + use major:minor as entries in watch directory + libudev: docs - .gitignore backup files + firmware: fix possible segfault when firmware device goes away while loading + do not reset SELinux context when the node was not touched + libudev: add udev_device_new_from_environment() + add LGPL COPYING to libudev and GUdev + cdrom_id: open non-mounted optical media with O_EXCL + libudev: update documentation + extras: mobile-action-modeswitch - update gitignore + scsi_id: add rand() in retry loop + cdrom_id: retry to open the device, if EBUSY + cdrom_id: check mount state in retry loop + cdrom_id: always set ID_CDROM regardless if we can run cdrom_id + rules: delete outdated packagees rules + rules: we do not have static devices which are renamed + unify/cleanup event handling + allow IMPORT{db}="KEY" + usb-db: remove double '/' + replace "add|change" with "!remove" + update NEWS + log info only if we actually delete the node + udevadm: trigger - switch default action from "add" to "change" + remove "all_partitions" option + rules: call modprobe on all events but "remove" + remove "ignore_remove" option + update NEWS + cdrom_id: rework feature/profiles buffer parsing + cdrom_id: print more debug messages + cdrom_id: debug - print feature values in hex + cdrom_id: debug - print feature values in hex + cdrom_id: set ID_CDROM_MEDIA=1 only for known media + Revert "Fix switching Logitech bluetooth adapters into hci mode." + add O_NOFOLLOW when creating files in link stack + delete only device nodes, not symlinks when deleting a devtmpfs node + doc: add section about how *not* to rename device nodes + +Marco d'Itri (3): + rules: input - create by-path/ links for pci devices + Fix switching Logitech bluetooth adapters into hci mode. + doc: document the WAIT_FOR timeout + +Martin Pitt (12): + keymap: Add Dell Inspiron 1011 (Mini 10) + Fix brightness keys on MSI Wind U-100 + keymap: Fix LG X110 + keymap: Add Toshiba Satellite M30X + udev-acl: Correctly handle ENV{ACL_MANAGE}==0 + input_id: Fix linking + keymap: Add Acer TravelMate 6593G and Acer Aspire 1640 + keymap: Fix another key for Acer TravelMate 6593 + cdrom_id: Fix uninitialized variables + cdrom_id: Fix uninitialized buffers + cdrom_id: Do not ignore errors from scsi_cmd_run() + cdrom_id: Swap media state and TOC info probing + +Mike Brudevold (1): + cdrom_id: add missing profiles to feature_profiles + +Robert Hooker (1): + keymap: Add support for Gateway AOA110/AOA150 clones. + +Scott James Remnant (2): + libudev: export udev_monitor_set_receive_buffer_size() + udevadm monitor: increase netlink buffer size + +Thomas Bächler (1): + firmware: fix error reporting on missing firmware files + +Yury G. Kudryashov (3): + configure.ac - fix typo in --with-pci-ids-path option + hid2hci: include linux/types.h for __u32 + configure.ac: ddd --with-firmware-path option + + Summary of changes from v150 to v151 ============================================ diff --git a/NEWS b/NEWS index 0c9e45b9ab..fdc73c4f19 100644 --- a/NEWS +++ b/NEWS @@ -9,7 +9,7 @@ events are expected as "add" events. The option "all_partitons" was removed from udev. This should not be needed for usual hardware. Udev can not safely make assumptions -about non-exixting partition major/minor numbers, and therefore no +about non-existing partition major/minor numbers, and therefore no longer provide this unreliable and unsafe option. The option "ignore_remove" was removed from udev. With devtmpfs -- cgit v1.2.3-54-g00ecf From 451dd74d9a9d90a29cb005313c1d0e4bab0744c2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 20 Apr 2010 09:39:24 +0200 Subject: configure.ac: version bump --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index fdc73c4f19..feb47dad1f 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +udev 153 +======== + udev 152 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index cce70d1178..c8e54946ba 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [152], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [153], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 901e80dc593967c5d5e810390722461760177ff8 Mon Sep 17 00:00:00 2001 From: Robby Workman Date: Wed, 21 Apr 2010 04:07:21 -0500 Subject: configure.ac: fix broken firmware search path in configure.ac Correct a silly typo: s/fimware/firmware/ --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c8e54946ba..4fcdbcd276 100644 --- a/configure.ac +++ b/configure.ac @@ -86,7 +86,7 @@ if test "x$enable_extras" = xyes; then AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), [], - [with_firmware_path="/lib/fimware/updates:/lib/fimware"] + [with_firmware_path="/lib/firmware/updates:/lib/firmware"] ) OLD_IFS=$IFS IFS=: -- cgit v1.2.3-54-g00ecf From 1efde3bcef093da3b4e00243f5939e805ca736e2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Apr 2010 08:31:55 +0200 Subject: release 153 --- ChangeLog | 10 ++++++++++ NEWS | 1 + 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index f8b2942632..0a1475f551 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Summary of changes from v152 to v153 +============================================ + +Kay Sievers (1): + configure.ac: version bump + +Robby Workman (1): + configure.ac: fix broken firmware search path in configure.ac + + Summary of changes from v151 to v152 ============================================ diff --git a/NEWS b/NEWS index feb47dad1f..87d5343f6d 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ udev 153 ======== +Fix broken firmware loader search path. udev 152 ======== -- cgit v1.2.3-54-g00ecf From c51d2f2746a54c8418965f22d1882b1ac3a18ed8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Apr 2010 08:50:59 +0200 Subject: configure.ac: version bump --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 87d5343f6d..f3163ecd7e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +udev 154 +======== + udev 153 ======== Fix broken firmware loader search path. diff --git a/configure.ac b/configure.ac index 4fcdbcd276..d4d29c47f7 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [153], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [154], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From e925018786d85fb3aed3b62a0a89309f9a7d5e4f Mon Sep 17 00:00:00 2001 From: Mathias Nyman Date: Wed, 21 Apr 2010 13:52:52 +0300 Subject: remove buffer-overrun risk in readlink call readlink does not write a nul character to the end of the string it returns. Therefore ask for one fewer character than the buffer size so there's always room for an extra \0. Signed-off-by: Mathias Nyman Signed-off-by: Phil Carmody Signed-off-by: Martin Pitt --- udev/udev-node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 2a2c2cf0b4..ceb1d52ea7 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -163,7 +163,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) int len; dbg(udev, "found existing symlink '%s'\n", slink); - len = readlink(slink, buf, sizeof(buf)); + len = readlink(slink, buf, sizeof(buf) - 1); if (len > 0) { buf[len] = '\0'; if (strcmp(target, buf) == 0) { -- cgit v1.2.3-54-g00ecf From 60067cc75ac7dd583beea584f87f2f6d3358f3c1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Apr 2010 14:44:33 +0200 Subject: more readlink buffer size handling --- libudev/libudev-device.c | 27 ++++++++++++++------------- libudev/libudev-queue.c | 2 +- udev/udev-node.c | 4 ++-- udev/udev-watch.c | 4 ++-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index b3b6a63114..400354539b 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -222,12 +222,11 @@ int udev_device_read_db(struct udev_device *udev_device) char *next; target_len = readlink(filename, target, sizeof(target)); - if (target_len > 0) - target[target_len] = '\0'; - else { - dbg(udev_device->udev, "error reading db link %s: %m\n", filename); + if (target_len <= 0 || target_len == sizeof(target)) { + info(udev_device->udev, "error reading db link %s: %m\n", filename); return -1; } + target[target_len] = '\0'; next = strchr(target, ' '); if (next != NULL) { @@ -1095,16 +1094,18 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const goto out; len = readlink(path, target, sizeof(target)); - if (len > 0) { - target[len] = '\0'; - pos = strrchr(target, '/'); - if (pos != NULL) { - pos = &pos[1]; - dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0); - val = udev_list_entry_get_value(list_entry); - } + if (len <= 0 || len == sizeof(target)) + goto out; + target[len] = '\0'; + + pos = strrchr(target, '/'); + if (pos != NULL) { + pos = &pos[1]; + dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0); + val = udev_list_entry_get_value(list_entry); } + goto out; } diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index f06c9e8a7a..5a4a3dc095 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -488,7 +488,7 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev s = syspath; l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); len = readlinkat(dirfd(dir), dent->d_name, s, l); - if (len < 0 || (size_t)len >= l) + if (len <= 0 || (size_t)len == l) continue; s[len] = '\0'; dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); diff --git a/udev/udev-node.c b/udev/udev-node.c index ceb1d52ea7..5c1b04b86c 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -163,8 +163,8 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) int len; dbg(udev, "found existing symlink '%s'\n", slink); - len = readlink(slink, buf, sizeof(buf) - 1); - if (len > 0) { + len = readlink(slink, buf, sizeof(buf)); + if (len > 0 && len < (int)sizeof(buf)) { buf[len] = '\0'; if (strcmp(target, buf) == 0) { info(udev, "preserve already existing symlink '%s' to '%s'\n", diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 7135d9f472..5fa60101c4 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -81,7 +81,7 @@ void udev_watch_restore(struct udev *udev) s = device; l = util_strpcpy(&s, sizeof(device), udev_get_sys_path(udev)); len = readlinkat(dirfd(dir), ent->d_name, s, l); - if (len <= 0 || len >= (ssize_t)l) + if (len <= 0 || len == (ssize_t)l) goto unlink; s[len] = '\0'; @@ -173,7 +173,7 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd) s = majmin; l = util_strpcpy(&s, sizeof(majmin), udev_get_sys_path(udev)); len = readlink(filename, s, l); - if (len < 0 || (size_t)len >= l) + if (len <= 0 || (size_t)len == l) return NULL; s[len] = '\0'; -- cgit v1.2.3-54-g00ecf From e9906fec711192761f27468244d3012041bcb0ee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Apr 2010 15:11:57 +0200 Subject: remove left-over from ignore_remove and all_partitions --- udev/udev-rules.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 4f18acaa78..f5d23b45b4 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -149,7 +149,6 @@ enum token_type { TK_A_STRING_ESCAPE_NONE, TK_A_STRING_ESCAPE_REPLACE, TK_A_INOTIFY_WATCH, /* int */ - TK_A_NUM_FAKE_PART, /* int */ TK_A_DEVLINK_PRIO, /* int */ TK_A_OWNER, /* val */ TK_A_GROUP, /* val */ @@ -161,7 +160,6 @@ enum token_type { TK_A_NAME, /* val */ TK_A_DEVLINK, /* val */ TK_A_EVENT_TIMEOUT, /* int */ - TK_A_IGNORE_REMOVE, TK_A_ATTR, /* val, attr */ TK_A_RUN, /* val, bool */ TK_A_GOTO, /* size_t */ @@ -279,7 +277,6 @@ static const char *token_str(enum token_type type) [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", - [TK_A_NUM_FAKE_PART] = "A NUM_FAKE_PART", [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", [TK_A_OWNER] = "A OWNER", [TK_A_GROUP] = "A GROUP", @@ -291,7 +288,6 @@ static const char *token_str(enum token_type type) [TK_A_NAME] = "A NAME", [TK_A_DEVLINK] = "A DEVLINK", [TK_A_EVENT_TIMEOUT] = "A EVENT_TIMEOUT", - [TK_A_IGNORE_REMOVE] = "A IGNORE_REMOVE", [TK_A_ATTR] = "A ATTR", [TK_A_RUN] = "A RUN", [TK_A_GOTO] = "A GOTO", @@ -360,9 +356,6 @@ static void dump_token(struct udev_rules *rules, struct token *token) break; case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: - case TK_A_IGNORE_REMOVE: - dbg(rules->udev, "%s\n", token_str(type)); - break; case TK_M_TEST: dbg(rules->udev, "%s %s '%s'(%s) %#o\n", token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode); @@ -1030,14 +1023,11 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, break; case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: - case TK_A_IGNORE_REMOVE: - break; case TK_A_RUN: token->key.value_off = add_string(rule_tmp->rules, value); token->key.fail_on_error = *(int *)data; break; case TK_A_INOTIFY_WATCH: - case TK_A_NUM_FAKE_PART: case TK_A_DEVLINK_PRIO: token->key.devlink_prio = *(int *)data; break; -- cgit v1.2.3-54-g00ecf From 5d69a34caffd595d918dd859a5b079f95d250064 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Apr 2010 15:43:05 +0200 Subject: fix previous commit --- udev/udev-rules.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index f5d23b45b4..6eb8350343 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -356,6 +356,8 @@ static void dump_token(struct udev_rules *rules, struct token *token) break; case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: + dbg(rules->udev, "%s\n", token_str(type)); + break; case TK_M_TEST: dbg(rules->udev, "%s %s '%s'(%s) %#o\n", token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode); @@ -1023,6 +1025,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, break; case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: + break; case TK_A_RUN: token->key.value_off = add_string(rule_tmp->rules, value); token->key.fail_on_error = *(int *)data; -- cgit v1.2.3-54-g00ecf From d05137cca5f92a102a0bdd55e42de9852a739913 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Wed, 21 Apr 2010 12:19:37 -0500 Subject: Fix volume keys not releasing for Pegatron platform Pegatron has a new platform coming out being sold by many small manufacturers. This platform has volume keys that are not sending a key release. This patch ensures those keys send release. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index c9edacf476..011b2e347a 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -29,4 +29,6 @@ ENV{DMI_VENDOR}=="FOXCONN", ATTR{[dmi/id]product_name}=="QBOOK", RUN+="keyboard- ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From e7964b93e826274d0e92d58e458decb49e502bf5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Apr 2010 06:23:16 +0200 Subject: udevadm: info --export-db -- remove watch handle export --- udev/udevadm-info.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 5f6209af2a..b395ad93b6 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -142,10 +142,6 @@ static void print_record(struct udev_device *device) if (i != 0) printf("L: %i\n", i); - i = udev_device_get_watch_handle(device); - if (i >= 0) - printf("W: %u\n", i); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { len = strlen(udev_get_dev_path(udev_device_get_udev(device))); printf("S: %s\n", &udev_list_entry_get_name(list_entry)[len+1]); -- cgit v1.2.3-54-g00ecf From 28460195c2ae90892bf556aff2b80705a8f37795 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Apr 2010 18:12:36 +0200 Subject: add TAG= to improve event filtering and device enumeration --- Makefile.am | 4 +- libudev/docs/libudev-sections.txt | 2 + libudev/exported_symbols | 1 + libudev/libudev-device-private.c | 46 +++++++- libudev/libudev-device.c | 159 ++++++++++++++++++++------- libudev/libudev-enumerate.c | 197 ++++++++++++++++++++++------------ libudev/libudev-monitor.c | 218 +++++++++++++++++++++++++++----------- libudev/libudev-private.h | 8 +- libudev/libudev-util.c | 75 +++++++++++-- libudev/libudev.h | 4 +- udev/udev-event.c | 1 - udev/udev-rules.c | 14 +++ udev/udev.xml | 13 +++ udev/udevadm-monitor.c | 17 ++- udev/udevadm-trigger.c | 7 +- udev/udevadm.xml | 13 +++ 16 files changed, 595 insertions(+), 184 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7403949cf3..9d3fefd702 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,9 +28,9 @@ CLEANFILES = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=7 +LIBUDEV_CURRENT=8 LIBUDEV_REVISION=0 -LIBUDEV_AGE=7 +LIBUDEV_AGE=8 SUBDIRS += libudev/docs diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index ca781fff23..3f8c107a1f 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -68,6 +68,7 @@ udev_monitor_enable_receiving udev_monitor_get_fd udev_monitor_receive_device udev_monitor_filter_add_match_subsystem_devtype +udev_monitor_filter_add_match_tag udev_monitor_filter_update udev_monitor_filter_remove
            @@ -85,6 +86,7 @@ udev_enumerate_add_nomatch_subsystem udev_enumerate_add_match_sysattr udev_enumerate_add_nomatch_sysattr udev_enumerate_add_match_property +udev_enumerate_add_match_tag udev_enumerate_add_match_sysname udev_enumerate_add_syspath udev_enumerate_scan_devices diff --git a/libudev/exported_symbols b/libudev/exported_symbols index 61486c6f48..c0ca4b9c6d 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -60,6 +60,7 @@ udev_monitor_get_udev udev_monitor_get_fd udev_monitor_receive_device udev_monitor_filter_add_match_subsystem_devtype +udev_monitor_filter_add_match_tag udev_monitor_filter_update udev_monitor_filter_remove udev_queue_new diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 5e4381ec27..13f1ebf883 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2010 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,37 @@ #include "libudev.h" #include "libudev-private.h" +static int udev_device_tag_index(struct udev_device *udev_device, bool add) +{ + struct udev *udev = udev_device_get_udev(udev_device); + struct udev_list_entry *list_entry; + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) { + char filename[UTIL_PATH_SIZE]; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", + udev_list_entry_get_name(list_entry), "/", + udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); + + if (add) { + util_create_path(udev, filename); + symlink(udev_device_get_devpath(udev_device), filename); + if (udev_device_get_sysname_old(udev_device) != NULL) { + char filename_old[UTIL_PATH_SIZE]; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", + udev_list_entry_get_name(list_entry), + udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL); + unlink(filename_old); + } + } else { + unlink(filename); + util_delete_path(udev, filename); + } + } + return 0; +} + int udev_device_update_db(struct udev_device *udev_device) { struct udev *udev = udev_device_get_udev(udev_device); @@ -41,6 +73,8 @@ int udev_device_update_db(struct udev_device *udev_device) udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) if (udev_list_entry_get_flags(list_entry)) goto file; + if (udev_device_get_tags_list_entry(udev_device) != NULL) + goto file; if (udev_device_get_devlink_priority(udev_device) != 0) goto file; if (udev_device_get_event_timeout(udev_device) >= 0) @@ -80,7 +114,7 @@ file: if (f == NULL) { err(udev, "unable to create temporary db file '%s': %m\n", filename_tmp); return -1; - } + } if (udev_device_get_devnode(udev_device) != NULL) { fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); @@ -100,10 +134,13 @@ file: udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); } + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + fprintf(f, "G:%s\n", udev_list_entry_get_name(list_entry)); fclose(f); rename(filename_tmp, filename); info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); out: + udev_device_tag_index(udev_device, true); return 0; } @@ -112,6 +149,7 @@ int udev_device_delete_db(struct udev_device *udev_device) struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; + udev_device_tag_index(udev_device, false); util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); unlink(filename); @@ -124,9 +162,13 @@ int udev_device_rename_db(struct udev_device *udev_device) char filename_old[UTIL_PATH_SIZE]; char filename[UTIL_PATH_SIZE]; + if (strcmp(udev_device_get_sysname(udev_device), udev_device_get_sysname_old(udev_device)) == 0) + return 0; + util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/db/", udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL); util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); + udev_device_tag_index(udev_device, true); return rename(filename_old, filename); } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 400354539b..478fdcb92d 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -60,6 +60,7 @@ struct udev_device { struct udev_list_node devlinks_list; struct udev_list_node properties_list; struct udev_list_node sysattr_list; + struct udev_list_node tags_list; unsigned long long int seqnum; int event_timeout; int timeout; @@ -68,18 +69,21 @@ struct udev_device { dev_t devnum; int watch_handle; int maj, min; - unsigned int parent_set:1; - unsigned int subsystem_set:1; - unsigned int devtype_set:1; - unsigned int devlinks_uptodate:1; - unsigned int envp_uptodate:1; - unsigned int driver_set:1; - unsigned int info_loaded:1; + bool parent_set; + bool subsystem_set; + bool devtype_set; + bool devlinks_uptodate; + bool envp_uptodate; + bool tags_uptodate; + bool driver_set; + bool info_loaded; + bool db_loaded; + bool uevent_loaded; }; struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { - udev_device->envp_uptodate = 0; + udev_device->envp_uptodate = false; if (value == NULL) { struct udev_list_entry *list_entry; @@ -149,6 +153,26 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, } if (slink[0] != '\0') udev_device_add_devlink(udev_device, slink, 0); + } else if (strncmp(property, "TAGS=", 5) == 0) { + char tags[UTIL_PATH_SIZE]; + char *next; + + util_strscpy(tags, sizeof(tags), &property[5]); + next = strchr(tags, ':'); + if (next != NULL) { + next++; + while (next[0] != '\0') { + char *tag; + + tag = next; + next = strchr(tag, ':'); + if (next == NULL) + break; + next[0] = '\0'; + next++; + udev_device_add_tag(udev_device, tag); + } + } } else if (strncmp(property, "DRIVER=", 7) == 0) { udev_device_set_driver(udev_device, &property[7]); } else if (strncmp(property, "ACTION=", 7) == 0) { @@ -208,6 +232,9 @@ int udev_device_read_db(struct udev_device *udev_device) char line[UTIL_LINE_SIZE]; FILE *f; + if (udev_device->db_loaded) + return 0; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/.udev/db/", udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); @@ -284,6 +311,9 @@ int udev_device_read_db(struct udev_device *udev_device) case 'E': udev_device_add_property_from_string(udev_device, val); break; + case 'G': + udev_device_add_tag(udev_device, val); + break; case 'W': udev_device_set_watch_handle(udev_device, atoi(val)); break; @@ -292,6 +322,7 @@ int udev_device_read_db(struct udev_device *udev_device) fclose(f); info(udev_device->udev, "device %p filled with db file data\n", udev_device); + udev_device->db_loaded = true; return 0; } @@ -303,6 +334,9 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) int maj = 0; int min = 0; + if (udev_device->uevent_loaded) + return 0; + util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL); f = fopen(filename, "r"); if (f == NULL) @@ -329,21 +363,14 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) } udev_device->devnum = makedev(maj, min); - fclose(f); + udev_device->uevent_loaded = true; return 0; } -static void device_load_info(struct udev_device *device) -{ - device->info_loaded = 1; - udev_device_read_uevent_file(device); - udev_device_read_db(device); -} - void udev_device_set_info_loaded(struct udev_device *device) { - device->info_loaded = 1; + device->info_loaded = true; } struct udev_device *udev_device_new(struct udev *udev) @@ -362,6 +389,7 @@ struct udev_device *udev_device_new(struct udev *udev) udev_list_init(&udev_device->devlinks_list); udev_list_init(&udev_device->properties_list); udev_list_init(&udev_device->sysattr_list); + udev_list_init(&udev_device->tags_list); udev_device->event_timeout = -1; udev_device->watch_handle = -1; /* copy global properties */ @@ -420,7 +448,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * util_strscpy(path, sizeof(path), syspath); util_resolve_sys_link(udev, path, sizeof(path)); - if (strncmp(&syspath[len], "/devices/", 9) == 0) { + if (strncmp(&path[len], "/devices/", 9) == 0) { char file[UTIL_PATH_SIZE]; /* all "devices" require a "uevent" file */ @@ -648,7 +676,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) if (udev_device == NULL) return NULL; if (!udev_device->parent_set) { - udev_device->parent_set = 1; + udev_device->parent_set = true; udev_device->parent_device = device_new_from_parent(udev_device); } if (udev_device->parent_device != NULL) @@ -758,12 +786,13 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->devtype); udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); udev_list_cleanup_entries(udev_device->udev, &udev_device->properties_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->tags_list); free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); free(udev_device->sysname_old); free(udev_device->knodename); - udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); free(udev_device->envp); free(udev_device->monitor_buf); dbg(udev_device->udev, "udev_device: %p released\n", udev_device); @@ -842,7 +871,7 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_read_db(udev_device); return udev_device->devnode; } @@ -862,7 +891,7 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) if (udev_device == NULL) return NULL; if (!udev_device->subsystem_set) { - udev_device->subsystem_set = 1; + udev_device->subsystem_set = true; /* read "subsystem" link */ if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { udev_device_set_subsystem(udev_device, subsystem); @@ -900,9 +929,8 @@ const char *udev_device_get_devtype(struct udev_device *udev_device) if (udev_device == NULL) return NULL; if (!udev_device->devtype_set) { - udev_device->devtype_set = 1; - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); + udev_device->devtype_set = true; + udev_device_read_uevent_file(udev_device); } return udev_device->devtype; } @@ -925,13 +953,13 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device * if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_read_db(udev_device); return udev_list_get_entry(&udev_device->devlinks_list); } void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) { - udev_device->devlinks_uptodate = 0; + udev_device->devlinks_uptodate = false; udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); } @@ -951,13 +979,15 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device { if (udev_device == NULL) return NULL; - if (!udev_device->info_loaded) - device_load_info(udev_device); + if (!udev_device->info_loaded) { + udev_device_read_uevent_file(udev_device); + udev_device_read_db(udev_device); + } if (!udev_device->devlinks_uptodate) { char symlinks[UTIL_PATH_SIZE]; struct udev_list_entry *list_entry; - udev_device->devlinks_uptodate = 1; + udev_device->devlinks_uptodate = true; list_entry = udev_device_get_devlinks_list_entry(udev_device); if (list_entry != NULL) { char *s; @@ -970,6 +1000,21 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device udev_device_add_property(udev_device, "DEVLINKS", symlinks); } } + if (!udev_device->tags_uptodate) { + udev_device->tags_uptodate = true; + if (udev_device_get_tags_list_entry(udev_device) != NULL) { + char tags[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + char *s; + size_t l; + + s = tags; + l = util_strpcpyl(&s, sizeof(tags), ":", NULL); + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), ":", NULL); + udev_device_add_property(udev_device, "TAGS", tags); + } + } return udev_list_get_entry(&udev_device->properties_list); } @@ -986,7 +1031,7 @@ const char *udev_device_get_driver(struct udev_device *udev_device) if (udev_device == NULL) return NULL; if (!udev_device->driver_set) { - udev_device->driver_set = 1; + udev_device->driver_set = true; if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) > 0) udev_device->driver = strdup(driver); } @@ -1004,7 +1049,7 @@ dev_t udev_device_get_devnum(struct udev_device *udev_device) if (udev_device == NULL) return makedev(0, 0); if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_read_uevent_file(udev_device); return udev_device->devnum; } @@ -1184,7 +1229,7 @@ int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsy udev_device->subsystem = strdup(subsystem); if (udev_device->subsystem == NULL) return -ENOMEM; - udev_device->subsystem_set = 1; + udev_device->subsystem_set = true; udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); return 0; } @@ -1195,7 +1240,7 @@ int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype udev_device->devtype = strdup(devtype); if (udev_device->devtype == NULL) return -ENOMEM; - udev_device->devtype_set = 1; + udev_device->devtype_set = true; udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); return 0; } @@ -1216,7 +1261,7 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink { struct udev_list_entry *list_entry; - udev_device->devlinks_uptodate = 0; + udev_device->devlinks_uptodate = false; list_entry = udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, 1, 0); if (list_entry == NULL) return -ENOMEM; @@ -1225,6 +1270,40 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink return 0; } +int udev_device_add_tag(struct udev_device *udev_device, const char *tag) +{ + if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) + return -EINVAL; + udev_device->tags_uptodate = false; + if (udev_list_entry_add(udev_device->udev, &udev_device->tags_list, tag, NULL, 1, 0) != NULL) + return 0; + return -ENOMEM; +} + +void udev_device_cleanup_tags_list(struct udev_device *udev_device) +{ + udev_device->tags_uptodate = false; + udev_list_cleanup_entries(udev_device->udev, &udev_device->tags_list); +} + +struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) +{ + return udev_list_get_entry(&udev_device->tags_list); +} + +int udev_device_has_tag(struct udev_device *udev_device, const char *tag) +{ + struct udev_list_entry *list_entry; + + if (!udev_device->info_loaded) + udev_device_read_db(udev_device); + list_entry = udev_device_get_tags_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, tag); + if (list_entry != NULL) + return 1; + return 0; +} + #define ENVP_SIZE 128 #define MONITOR_BUF_SIZE 4096 static int update_envp_monitor_buf(struct udev_device *udev_device) @@ -1273,7 +1352,7 @@ static int update_envp_monitor_buf(struct udev_device *udev_device) } udev_device->envp[i] = NULL; udev_device->monitor_buf_len = s - udev_device->monitor_buf; - udev_device->envp_uptodate = 1; + udev_device->envp_uptodate = true; dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", i, udev_device->monitor_buf_len); return 0; @@ -1312,7 +1391,7 @@ int udev_device_set_driver(struct udev_device *udev_device, const char *driver) udev_device->driver = strdup(driver); if (udev_device->driver == NULL) return -ENOMEM; - udev_device->driver_set = 1; + udev_device->driver_set = true; udev_device_add_property(udev_device, "DRIVER", udev_device->driver); return 0; } @@ -1385,7 +1464,7 @@ int udev_device_set_timeout(struct udev_device *udev_device, int timeout) int udev_device_get_event_timeout(struct udev_device *udev_device) { if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_read_db(udev_device); return udev_device->event_timeout; } @@ -1421,7 +1500,7 @@ int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) int udev_device_get_devlink_priority(struct udev_device *udev_device) { if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_read_db(udev_device); return udev_device->devlink_priority; } @@ -1434,7 +1513,7 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) int udev_device_get_watch_handle(struct udev_device *udev_device) { if (!udev_device->info_loaded) - device_load_info(udev_device); + udev_device_read_db(udev_device); return udev_device->watch_handle; } diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 9a61a61f0d..da831449dc 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2008-2010 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -51,6 +51,7 @@ struct udev_enumerate { struct udev_list_node subsystem_nomatch_list; struct udev_list_node sysname_match_list; struct udev_list_node properties_match_list; + struct udev_list_node tags_match_list; struct udev_list_node devices_list; struct syspath *devices; unsigned int devices_cur; @@ -79,6 +80,7 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) udev_list_init(&udev_enumerate->subsystem_nomatch_list); udev_list_init(&udev_enumerate->sysname_match_list); udev_list_init(&udev_enumerate->properties_match_list); + udev_list_init(&udev_enumerate->tags_match_list); udev_list_init(&udev_enumerate->devices_list); return udev_enumerate; } @@ -121,6 +123,7 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysname_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->properties_match_list); + udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->tags_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); for (i = 0; i < udev_enumerate->devices_cur; i++) free(udev_enumerate->devices[i].syspath); @@ -191,7 +194,7 @@ static int syspath_cmp(const void *p1, const void *p2) } /* For devices that should be moved to the absolute end of the list */ -static int devices_delay_end(struct udev *udev, const char *syspath) +static bool devices_delay_end(struct udev *udev, const char *syspath) { static const char *delay_device_list[] = { "/block/md", @@ -205,10 +208,10 @@ static int devices_delay_end(struct udev *udev, const char *syspath) for (i = 0; delay_device_list[i] != NULL; i++) { if (strstr(&syspath[len], delay_device_list[i]) != NULL) { dbg(udev, "delaying: %s\n", syspath); - return 1; + return true; } } - return 0; + return false; } /* For devices that should just be moved a little bit later, just @@ -394,16 +397,12 @@ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, co return 0; } -static int match_sysattr_value(struct udev *udev, const char *syspath, const char *sysattr, const char *match_val) +static int match_sysattr_value(struct udev_device *dev, const char *sysattr, const char *match_val) { - struct udev_device *device; const char *val = NULL; bool match = false; - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) - return -EINVAL; - val = udev_device_get_sysattr_value(device, sysattr); + val = udev_device_get_sysattr_value(dev, sysattr); if (val == NULL) goto exit; if (match_val == NULL) { @@ -415,7 +414,6 @@ static int match_sysattr_value(struct udev *udev, const char *syspath, const cha goto exit; } exit: - udev_device_unref(device); return match; } @@ -439,6 +437,25 @@ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, con return 0; } +/** + * udev_enumerate_add_match_tag: + * @udev_enumerate: context + * @tag: filter for a tag of the device to include in the list + * + * Returns: 0 on success, otherwise a negative error value. + */ +int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (tag == NULL) + return 0; + if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), + &udev_enumerate->tags_match_list, tag, NULL, 1, 0) == NULL) + return -ENOMEM; + return 0; +} + /** * udev_enumerate_add_match_sysname: * @udev_enumerate: context @@ -458,46 +475,37 @@ int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, cons return 0; } -static int match_sysattr(struct udev_enumerate *udev_enumerate, const char *syspath) +static bool match_sysattr(struct udev_enumerate *udev_enumerate, struct udev_device *dev) { - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); struct udev_list_entry *list_entry; /* skip list */ udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_nomatch_list)) { - if (match_sysattr_value(udev, syspath, - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry))) - return 0; + if (match_sysattr_value(dev, udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return false; } /* include list */ if (udev_list_get_entry(&udev_enumerate->sysattr_match_list) != NULL) { udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_match_list)) { /* anything that does not match, will make it FALSE */ - if (!match_sysattr_value(udev, syspath, - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry))) - return 0; + if (!match_sysattr_value(dev, udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return false; } - return 1; + return true; } - return 1; + return true; } -static int match_property(struct udev_enumerate *udev_enumerate, const char *syspath) +static bool match_property(struct udev_enumerate *udev_enumerate, struct udev_device *dev) { - struct udev_device *dev; struct udev_list_entry *list_entry; - int match = false; + bool match = false; /* no match always matches */ if (udev_list_get_entry(&udev_enumerate->properties_match_list) == NULL) - return 1; - - /* no device does not match */ - dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); - if (dev == NULL) - return 0; + return true; /* loop over matches */ udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) { @@ -525,23 +533,38 @@ static int match_property(struct udev_enumerate *udev_enumerate, const char *sys } } out: - udev_device_unref(dev); return match; } -static int match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) +static bool match_tag(struct udev_enumerate *udev_enumerate, struct udev_device *dev) +{ + struct udev_list_entry *list_entry; + + /* no match always matches */ + if (udev_list_get_entry(&udev_enumerate->tags_match_list) == NULL) + return true; + + /* loop over matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) + if (!udev_device_has_tag(dev, udev_list_entry_get_name(list_entry))) + return false; + + return true; +} + +static bool match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) { struct udev_list_entry *list_entry; if (udev_list_get_entry(&udev_enumerate->sysname_match_list) == NULL) - return 1; + return true; udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysname_match_list)) { if (fnmatch(udev_list_entry_get_name(list_entry), sysname, 0) != 0) continue; - return 1; + return true; } - return 0; + return false; } static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, @@ -562,54 +585,53 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, util_strpcpyl(&s, l, "/", subdir2, NULL); dir = opendir(path); if (dir == NULL) - return -1; + return -ENOENT; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char syspath[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; + struct udev_device *dev; if (dent->d_name[0] == '.') continue; + if (!match_sysname(udev_enumerate, dent->d_name)) continue; util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); - if (!match_property(udev_enumerate, syspath)) - continue; - if (lstat(syspath, &statbuf) != 0) - continue; - if (S_ISREG(statbuf.st_mode)) + dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (dev == NULL) continue; - if (S_ISLNK(statbuf.st_mode)) - util_resolve_sys_link(udev, syspath, sizeof(syspath)); - util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); - if (stat(filename, &statbuf) != 0) - continue; - if (!match_sysattr(udev_enumerate, syspath)) - continue; - syspath_add(udev_enumerate, syspath); + if (!match_tag(udev_enumerate, dev)) + goto nomatch; + if (!match_property(udev_enumerate, dev)) + goto nomatch; + if (!match_sysattr(udev_enumerate, dev)) + goto nomatch; + + syspath_add(udev_enumerate, udev_device_get_syspath(dev)); +nomatch: + udev_device_unref(dev); } closedir(dir); return 0; } -static int match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { struct udev_list_entry *list_entry; udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) - return 0; + return false; } if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) { if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) - return 1; + return true; } - return 0; + return false; } - return 1; + return true; } static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir, const char *subsystem) @@ -675,17 +697,59 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) if (udev_enumerate == NULL) return -EINVAL; - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); - if (stat(base, &statbuf) == 0) { - /* we have /subsystem/, forget all the old stuff */ - dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "subsystem", "devices", NULL); + + if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) { + struct udev_list_entry *list_entry; + + /* scan only tagged devices, use tags reverse-index, instead of searching all devices in /sys */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) { + DIR *dir; + struct dirent *dent; + char path[UTIL_PATH_SIZE]; + + util_strscpyl(path, sizeof(path), udev_get_dev_path(udev), "/.udev/tags/", + udev_list_entry_get_name(list_entry), NULL); + dir = opendir(path); + if (dir == NULL) + continue; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct udev_device *dev; + char syspath[UTIL_PATH_SIZE]; + char *s; + size_t l; + ssize_t len; + + if (dent->d_name[0] == '.') + continue; + + s = syspath; + l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev), NULL); + len = readlinkat(dirfd(dir), dent->d_name, s, l); + if (len <= 0 || (size_t)len == l) + continue; + s[len] = '\0'; + + dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (dev == NULL) + continue; + syspath_add(udev_enumerate, udev_device_get_syspath(dev)); + udev_device_unref(dev); + } + } } else { + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); + if (stat(base, &statbuf) == 0) { + /* we have /subsystem/, forget all the old stuff */ + dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); + scan_dir(udev_enumerate, "subsystem", "devices", NULL); + } else { dbg(udev, "searching '/bus/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "bus", "devices", NULL); - dbg(udev, "searching '/class/*' dir\n"); - scan_dir(udev_enumerate, "class", NULL, NULL); + scan_dir(udev_enumerate, "bus", "devices", NULL); + dbg(udev, "searching '/class/*' dir\n"); + scan_dir(udev_enumerate, "class", NULL, NULL); + } } + return 0; } @@ -704,6 +768,7 @@ int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) if (udev_enumerate == NULL) return -EINVAL; + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); if (stat(base, &statbuf) == 0) subsysdir = "subsystem"; diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 97e52c42db..24e8aead26 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2009 Kay Sievers + * Copyright (C) 2008-2010 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -49,6 +49,7 @@ struct udev_monitor { struct sockaddr_un sun; socklen_t addrlen; struct udev_list_node filter_subsystem_list; + struct udev_list_node filter_tag_list; }; enum udev_monitor_netlink_group { @@ -57,25 +58,28 @@ enum udev_monitor_netlink_group { UDEV_MONITOR_UDEV, }; -#define UDEV_MONITOR_MAGIC 0xcafe1dea +#define UDEV_MONITOR_MAGIC 0xfeedcafe struct udev_monitor_netlink_header { - /* udev version text */ - char version[16]; + /* "libudev" prefix to distinguish libudev and kernel messages */ + char prefix[8]; /* * magic to protect against daemon <-> library message format mismatch * used in the kernel from socket filter rules; needs to be stored in network order */ unsigned int magic; - /* properties buffer */ - unsigned short properties_off; - unsigned short properties_len; + /* total length of header structure known to the sender */ + unsigned int header_size; + /* properties string buffer */ + unsigned int properties_off; + unsigned int properties_len; /* - * hashes of some common device properties strings to filter with socket filters in - * the client used in the kernel from socket filter rules; needs to be stored in - * network order + * hashes of primary device properties strings, to let libudev subscribers + * use in-kernel socket filters; values need to be stored in network order */ - unsigned int filter_subsystem; - unsigned int filter_devtype; + unsigned int filter_subsystem_hash; + unsigned int filter_devtype_hash; + unsigned int filter_tag_bloom_hi; + unsigned int filter_tag_bloom_lo; }; static struct udev_monitor *udev_monitor_new(struct udev *udev) @@ -88,6 +92,7 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) udev_monitor->refcount = 1; udev_monitor->udev = udev; udev_list_init(&udev_monitor->filter_subsystem_list); + udev_list_init(&udev_monitor->filter_tag_list); return udev_monitor; } @@ -247,13 +252,14 @@ static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, */ int udev_monitor_filter_update(struct udev_monitor *udev_monitor) { - static struct sock_filter ins[256]; - static struct sock_fprog filter; + struct sock_filter ins[512]; + struct sock_fprog filter; unsigned int i; struct udev_list_entry *list_entry; int err; - if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL && + udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) return 0; memset(ins, 0x00, sizeof(ins)); @@ -266,35 +272,74 @@ int udev_monitor_filter_update(struct udev_monitor *udev_monitor) /* wrong magic, pass packet */ bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); - /* add all subsystem match values */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { - unsigned int hash; - - /* load filter_subsystem value in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem)); - hash = util_string_hash32(udev_list_entry_get_name(list_entry)); - if (udev_list_entry_get_value(list_entry) == NULL) { - /* jump if subsystem does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); - } else { - /* jump if subsystem does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3); - - /* load filter_devtype value in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_devtype)); - /* jump if value does not match */ - hash = util_string_hash32(udev_list_entry_get_value(list_entry)); - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); + if (udev_list_get_entry(&udev_monitor->filter_tag_list) != NULL) { + int tag_matches; + + /* count tag matches, to calculate end of tag match block */ + tag_matches = 0; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) + tag_matches++; + + /* add all tags matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { + uint64_t tag_bloom_bits = util_string_bloom64(udev_list_entry_get_name(list_entry)); + uint32_t tag_bloom_hi = tag_bloom_bits >> 32; + uint32_t tag_bloom_lo = tag_bloom_bits & 0xffffffff; + + /* load device bloom bits in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_hi)); + /* clear bits (tag bits & bloom bits) */ + bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_hi); + /* jump to next tag if it does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_hi, 0, 3); + + /* load device bloom bits in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_lo)); + /* clear bits (tag bits & bloom bits) */ + bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_lo); + /* jump behind end of tag match block if tag matches */ + tag_matches--; + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_lo, 1 + (tag_matches * 6), 0); } - /* matched, pass packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + /* nothing matched, drop packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); + } - if (i+1 >= ARRAY_SIZE(ins)) - return -1; + /* add all subsystem matches */ + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { + unsigned int hash = util_string_hash32(udev_list_entry_get_name(list_entry)); + + /* load device subsystem value in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem_hash)); + if (udev_list_entry_get_value(list_entry) == NULL) { + /* jump if subsystem does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); + } else { + /* jump if subsystem does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3); + + /* load device devtype value in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_devtype_hash)); + /* jump if value does not match */ + hash = util_string_hash32(udev_list_entry_get_value(list_entry)); + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); + } + + /* matched, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + + if (i+1 >= ARRAY_SIZE(ins)) + return -1; + } + + /* nothing matched, drop packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); } - /* nothing matched, drop packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); + + /* matched, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); /* install filter */ filter.len = i; @@ -406,6 +451,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) if (udev_monitor->sock >= 0) close(udev_monitor->sock); udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); + udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_tag_list); dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); free(udev_monitor); } @@ -445,8 +491,7 @@ static int passes_filter(struct udev_monitor *udev_monitor, struct udev_device * struct udev_list_entry *list_entry; if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) - return 1; - + goto tag; udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { const char *subsys = udev_list_entry_get_name(list_entry); const char *dsubsys = udev_device_get_subsystem(udev_device); @@ -458,11 +503,22 @@ static int passes_filter(struct udev_monitor *udev_monitor, struct udev_device * devtype = udev_list_entry_get_value(list_entry); if (devtype == NULL) - return 1; + goto tag; ddevtype = udev_device_get_devtype(udev_device); if (ddevtype == NULL) continue; if (strcmp(ddevtype, devtype) == 0) + goto tag; + } + return 0; + +tag: + if (udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) + return 1; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { + const char *tag = udev_list_entry_get_name(list_entry); + + if (udev_device_has_tag(udev_device, tag)) return 1; } return 0; @@ -556,13 +612,11 @@ retry: return NULL; } - if (strncmp(buf, "udev-", 5) == 0) { + if (memcmp(buf, "libudev", 8) == 0) { /* udev message needs proper version magic */ nlh = (struct udev_monitor_netlink_header *) buf; if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) return NULL; - if (nlh->properties_off < sizeof(struct udev_monitor_netlink_header)) - return NULL; if (nlh->properties_off+32 > buflen) return NULL; bufpos = nlh->properties_off; @@ -626,17 +680,17 @@ retry: int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_monitor *destination, struct udev_device *udev_device) { - struct msghdr smsg; - struct iovec iov[2]; const char *buf; ssize_t blen; ssize_t count; blen = udev_device_get_properties_monitor_buf(udev_device, &buf); if (blen < 32) - return -1; + return -EINVAL; if (udev_monitor->sun.sun_family != 0) { + struct msghdr smsg; + struct iovec iov[2]; const char *action; char header[2048]; char *s; @@ -660,23 +714,41 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, smsg.msg_iovlen = 2; smsg.msg_name = &udev_monitor->sun; smsg.msg_namelen = udev_monitor->addrlen; - } else if (udev_monitor->snl.nl_family != 0) { + count = sendmsg(udev_monitor->sock, &smsg, 0); + info(udev_monitor->udev, "passed %zi bytes to socket monitor %p\n", count, udev_monitor); + return count; + } + + if (udev_monitor->snl.nl_family != 0) { + struct msghdr smsg; + struct iovec iov[2]; const char *val; struct udev_monitor_netlink_header nlh; - + struct udev_list_entry *list_entry; + uint64_t tag_bloom_bits; /* add versioned header */ memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header)); - util_strscpy(nlh.version, sizeof(nlh.version), "udev-" VERSION); + memcpy(nlh.prefix, "libudev", 8); nlh.magic = htonl(UDEV_MONITOR_MAGIC); + nlh.header_size = sizeof(struct udev_monitor_netlink_header); val = udev_device_get_subsystem(udev_device); - nlh.filter_subsystem = htonl(util_string_hash32(val)); + nlh.filter_subsystem_hash = htonl(util_string_hash32(val)); val = udev_device_get_devtype(udev_device); if (val != NULL) - nlh.filter_devtype = htonl(util_string_hash32(val)); + nlh.filter_devtype_hash = htonl(util_string_hash32(val)); iov[0].iov_base = &nlh; iov[0].iov_len = sizeof(struct udev_monitor_netlink_header); + /* add tag bloom filter */ + tag_bloom_bits = 0; + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + tag_bloom_bits |= util_string_bloom64(udev_list_entry_get_name(list_entry)); + if (tag_bloom_bits > 0) { + nlh.filter_tag_bloom_hi = htonl(tag_bloom_bits >> 32); + nlh.filter_tag_bloom_lo = htonl(tag_bloom_bits & 0xffffffff); + } + /* add properties list */ nlh.properties_off = iov[0].iov_len; nlh.properties_len = blen; @@ -697,13 +769,12 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, else smsg.msg_name = &udev_monitor->snl_destination; smsg.msg_namelen = sizeof(struct sockaddr_nl); - } else { - return -1; + count = sendmsg(udev_monitor->sock, &smsg, 0); + info(udev_monitor->udev, "passed %zi bytes to netlink monitor %p\n", count, udev_monitor); + return count; } - count = sendmsg(udev_monitor->sock, &smsg, 0); - info(udev_monitor->udev, "passed %zi bytes to monitor %p\n", count, udev_monitor); - return count; + return -EINVAL; } /** @@ -712,6 +783,9 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, * @subsystem: the subsystem value to match the incoming devices against * @devtype: the devtype value to match the incoming devices against * + * This filer is efficiently executed inside the kernel, and libudev subscribers + * will usually not be woken up for devices which do not match. + * * The filter must be installed before the monitor is switched to listening mode. * * Returns: 0 on success, otherwise a negative error value. @@ -721,13 +795,37 @@ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_mo if (udev_monitor == NULL) return -EINVAL; if (subsystem == NULL) - return 0; + return -EINVAL; if (udev_list_entry_add(udev_monitor->udev, &udev_monitor->filter_subsystem_list, subsystem, devtype, 0, 0) == NULL) return -ENOMEM; return 0; } +/** + * udev_monitor_filter_add_match_tag: + * @udev_monitor: the monitor + * @tag: the name of a tag + * + * This filer is efficiently executed inside the kernel, and libudev subscribers + * will usually not be woken up for devices which do not match. + * + * The filter must be installed before the monitor is switched to listening mode. + * + * Returns: 0 on success, otherwise a negative error value. + */ +int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag) +{ + if (udev_monitor == NULL) + return -EINVAL; + if (tag == NULL) + return -EINVAL; + if (udev_list_entry_add(udev_monitor->udev, + &udev_monitor->filter_tag_list, tag, NULL, 0, 0) == NULL) + return -ENOMEM; + return 0; +} + /** * udev_monitor_filter_remove: * @udev_monitor: monitor diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 8dc469ec9b..548f4adbef 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -14,6 +14,8 @@ #include #include +#include +#include #include "libudev.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) @@ -84,7 +86,8 @@ const char *udev_device_get_sysname_old(struct udev_device *udev_device); int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); const char *udev_device_get_knodename(struct udev_device *udev_device); int udev_device_add_tag(struct udev_device *udev_device, const char *tag); -struct udev_list_entry *udev_device_get_tag_list_entry(struct udev_device *udev_device); +void udev_device_cleanup_tags_list(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device); int udev_device_has_tag(struct udev_device *udev_device, const char *tag); int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename); int udev_device_get_timeout(struct udev_device *udev_device); @@ -203,7 +206,8 @@ size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute_ int udev_util_replace_whitespace(const char *str, char *to, size_t len); int udev_util_replace_chars(char *str, const char *white); int udev_util_encode_string(const char *str, char *str_enc, size_t len); -unsigned int util_string_hash32(const char *str); +unsigned int util_string_hash32(const char *key); +uint64_t util_string_bloom64(const char *str); /* libudev-util-private.c */ int util_create_path(struct udev *udev, const char *path); diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index c0209f9cc6..3a67b0cd5d 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -481,15 +481,74 @@ err: return -1; } +/* + * http://sites.google.com/site/murmurhash/ + * + * All code is released to the public domain. For business purposes, + * Murmurhash is under the MIT license. + * + */ +static unsigned int murmur_hash2(const char *key, int len, unsigned int seed) +{ + /* + * 'm' and 'r' are mixing constants generated offline. + * They're not really 'magic', they just happen to work well. + */ + const unsigned int m = 0x5bd1e995; + const int r = 24; + + /* initialize the hash to a 'random' value */ + unsigned int h = seed ^ len; + + /* mix 4 bytes at a time into the hash */ + const unsigned char * data = (const unsigned char *)key; + + while(len >= 4) { + unsigned int k = *(unsigned int *)data; + + k *= m; + k ^= k >> r; + k *= m; + h *= m; + h ^= k; + + data += 4; + len -= 4; + } + + /* handle the last few bytes of the input array */ + switch(len) { + case 3: + h ^= data[2] << 16; + case 2: + h ^= data[1] << 8; + case 1: + h ^= data[0]; + h *= m; + }; + + /* do a few final mixes of the hash to ensure the last few bytes are well-incorporated */ + h ^= h >> 13; + h *= m; + h ^= h >> 15; + + return h; +} + unsigned int util_string_hash32(const char *str) { - unsigned int hash = 0; + return murmur_hash2(str, strlen(str), 0); +} - while (str[0] != '\0') { - hash += str[0] << 4; - hash += str[0] >> 4; - hash *= 11; - str++; - } - return hash; +/* get a bunch of bit numbers out of the hash, and set the bits in our bit field */ +uint64_t util_string_bloom64(const char *str) +{ + uint64_t bits = 0; + unsigned int hash = util_string_hash32(str); + + bits |= 1LLU << (hash & 63); + bits |= 1LLU << ((hash >> 6) & 63); + bits |= 1LLU << ((hash >> 12) & 63); + bits |= 1LLU << ((hash >> 18) & 63); + return bits; } diff --git a/libudev/libudev.h b/libudev/libudev.h index 750664f43c..3b73fbd61b 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2009 Kay Sievers + * Copyright (C) 2008-2010 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -118,6 +118,7 @@ struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monito /* in-kernel socket filters to select messages that get delivered to a listener */ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype); +int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag); int udev_monitor_filter_update(struct udev_monitor *udev_monitor); int udev_monitor_filter_remove(struct udev_monitor *udev_monitor); @@ -138,6 +139,7 @@ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, cons int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname); +int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag); int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); /* run enumeration with active filters */ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); diff --git a/udev/udev-event.c b/udev/udev-event.c index b2e1baee1f..212ccc7950 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -543,7 +543,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (strcmp(udev_device_get_action(dev), "remove") == 0) { udev_device_read_db(dev); - udev_device_set_info_loaded(dev); udev_device_delete_db(dev); if (major(udev_device_get_devnum(dev)) != 0) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 6eb8350343..b5016d0bc3 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -157,6 +157,7 @@ enum token_type { TK_A_GROUP_ID, /* gid_t */ TK_A_MODE_ID, /* mode_t */ TK_A_ENV, /* val, attr */ + TK_A_TAG, /* val */ TK_A_NAME, /* val */ TK_A_DEVLINK, /* val */ TK_A_EVENT_TIMEOUT, /* int */ @@ -285,6 +286,7 @@ static const char *token_str(enum token_type type) [TK_A_GROUP_ID] = "A GROUP_ID", [TK_A_MODE_ID] = "A MODE_ID", [TK_A_ENV] = "A ENV", + [TK_A_TAG] = "A ENV", [TK_A_NAME] = "A NAME", [TK_A_DEVLINK] = "A DEVLINK", [TK_A_EVENT_TIMEOUT] = "A EVENT_TIMEOUT", @@ -354,6 +356,9 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", token_str(type), operation_str(op), attr, value, string_glob_str(glob)); break; + case TK_A_TAG: + dbg(rules->udev, "%s %s '%s'\n", token_str(type), operation_str(op), value); + break; case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: dbg(rules->udev, "%s\n", token_str(type)); @@ -1003,6 +1008,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_MODE: case TK_A_NAME: case TK_A_GOTO: + case TK_A_TAG: token->key.value_off = add_string(rule_tmp->rules, value); break; case TK_M_ENV: @@ -1350,6 +1356,11 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } + if (strcmp(key, "TAG") == 0) { + rule_add_key(&rule_tmp, TK_A_TAG, op, value, NULL); + continue; + } + if (strcmp(key, "PROGRAM") == 0) { rule_add_key(&rule_tmp, TK_M_PROGRAM, op, value, NULL); continue; @@ -2408,6 +2419,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event } break; } + case TK_A_TAG: + udev_device_add_tag(event->dev, &rules->buf[cur->key.value_off]); + break; case TK_A_NAME: { const char *name = &rules->buf[cur->key.value_off]; diff --git a/udev/udev.xml b/udev/udev.xml index 192a6f1238..842fd5d52a 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -348,6 +348,19 @@ + + + + Attach a tag to a device. This is used to filter events for users + of libudev's monitor functionality, or to enumerate a group of tagged + devices. The implementation can only work efficiently if only a few + tags are attached to a device. It is only meant to be used in + contexts with specific device filter requirements, and not as a + general-purpose flag. Excessive use might result in inefficient event + handling. + + + diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index d136c6070a..fb650846bc 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -73,6 +73,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) int print_kernel = 0; int print_udev = 0; struct udev_list_node subsystem_match_list; + struct udev_list_node tag_match_list; struct udev_monitor *udev_monitor = NULL; struct udev_monitor *kernel_monitor = NULL; fd_set readfds; @@ -84,13 +85,15 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) { "kernel", no_argument, NULL, 'k' }, { "udev", no_argument, NULL, 'u' }, { "subsystem-match", required_argument, NULL, 's' }, + { "tag-match", required_argument, NULL, 't' }, { "help", no_argument, NULL, 'h' }, {} }; udev_list_init(&subsystem_match_list); + udev_list_init(&tag_match_list); while (1) { - option = getopt_long(argc, argv, "epkus:h", options, NULL); + option = getopt_long(argc, argv, "pekus:t:h", options, NULL); if (option == -1) break; @@ -119,12 +122,16 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) udev_list_entry_add(udev, &subsystem_match_list, subsys, devtype, 0, 0); break; } + case 't': + udev_list_entry_add(udev, &tag_match_list, optarg, NULL, 0, 0); + break; case 'h': printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" " --property print the event properties\n" " --kernel print kernel uevents\n" " --udev print udev events\n" " --subsystem-match= filter events by subsystem\n" + " --tag-match= filter events by tag\n" " --help\n\n"); default: goto out; @@ -168,6 +175,13 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys); } + udev_list_entry_foreach(entry, udev_list_get_entry(&tag_match_list)) { + const char *tag = udev_list_entry_get_name(entry); + + if (udev_monitor_filter_add_match_tag(udev_monitor, tag) < 0) + fprintf(stderr, "error: unable to apply tag filter '%s'\n", tag); + } + if (udev_monitor_enable_receiving(udev_monitor) < 0) { fprintf(stderr, "error: unable to subscribe to udev events\n"); rc = 2; @@ -244,5 +258,6 @@ out: udev_monitor_unref(udev_monitor); udev_monitor_unref(kernel_monitor); udev_list_cleanup_entries(udev, &subsystem_match_list); + udev_list_cleanup_entries(udev, &tag_match_list); return rc; } diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 03aa53437f..3cb07dda9a 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -101,6 +101,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { "attr-match", required_argument, NULL, 'a' }, { "attr-nomatch", required_argument, NULL, 'A' }, { "property-match", required_argument, NULL, 'p' }, + { "tag-match", required_argument, NULL, 'g' }, { "sysname-match", required_argument, NULL, 'y' }, { "help", no_argument, NULL, 'h' }, {} @@ -127,7 +128,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) const char *val; char buf[UTIL_PATH_SIZE]; - option = getopt_long(argc, argv, "vnFo:t:hcp:s:S:a:A:y:", options, NULL); + option = getopt_long(argc, argv, "vng:o:t:hcp:s:S:a:A:y:", options, NULL); if (option == -1) break; @@ -172,6 +173,9 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) key = keyval(optarg, &val, buf, sizeof(buf)); udev_enumerate_add_match_property(udev_enumerate, key, val); break; + case 'g': + udev_enumerate_add_match_tag(udev_enumerate, optarg); + break; case 'y': udev_enumerate_add_match_sysname(udev_enumerate, optarg); break; @@ -190,6 +194,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) " --attr-match=]> trigger devices with a matching attribute\n" " --attr-nomatch=]> exclude devices with a matching attribute\n" " --property-match== trigger devices with a matching property\n" + " --tag-match== trigger devices with a matching property\n" " --sysname-match= trigger devices with a matching name\n" " --help\n\n"); goto exit; diff --git a/udev/udevadm.xml b/udev/udevadm.xml index fa1742bada..73e6f110a6 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -216,6 +216,13 @@ specified multiple times and supports shell style pattern matching. + + + + Trigger events for devices with a matching tag. This option can be + specified multiple times. + + @@ -355,6 +362,12 @@ Filter events by subsystem[/devtype]. Only udev events with a matching subsystem value will pass. + + + + Filter events by property. Only udev events with a given tag attached will pass. + + -- cgit v1.2.3-54-g00ecf From 3f896a2abd76972eafe636cac4110608b6d3ff2f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Apr 2010 18:33:24 +0200 Subject: all to match against a given TAG== --- udev/udev-rules.c | 24 +++++++++++++++++++++++- udev/udev.xml | 7 +++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index b5016d0bc3..5965723919 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -125,6 +125,7 @@ enum token_type { TK_M_DEVLINK, /* val */ TK_M_NAME, /* val */ TK_M_ENV, /* val, attr */ + TK_M_TAG, /* val */ TK_M_SUBSYSTEM, /* val */ TK_M_DRIVER, /* val */ TK_M_WAITFOR, /* val */ @@ -254,6 +255,7 @@ static const char *token_str(enum token_type type) [TK_M_DEVLINK] = "M DEVLINK", [TK_M_NAME] = "M NAME", [TK_M_ENV] = "M ENV", + [TK_M_TAG] = "M TAG", [TK_M_SUBSYSTEM] = "M SUBSYSTEM", [TK_M_DRIVER] = "M DRIVER", [TK_M_WAITFOR] = "M WAITFOR", @@ -356,6 +358,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", token_str(type), operation_str(op), attr, value, string_glob_str(glob)); break; + case TK_M_TAG: case TK_A_TAG: dbg(rules->udev, "%s %s '%s'\n", token_str(type), operation_str(op), value); break; @@ -1008,6 +1011,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_MODE: case TK_A_NAME: case TK_A_GOTO: + case TK_M_TAG: case TK_A_TAG: token->key.value_off = add_string(rule_tmp->rules, value); break; @@ -1357,7 +1361,10 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcmp(key, "TAG") == 0) { - rule_add_key(&rule_tmp, TK_A_TAG, op, value, NULL); + if (op < OP_MATCH_MAX) + rule_add_key(&rule_tmp, TK_M_TAG, op, value, NULL); + else + rule_add_key(&rule_tmp, TK_A_TAG, op, value, NULL); continue; } @@ -2104,6 +2111,21 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event goto nomatch; break; } + case TK_M_TAG: + { + struct udev_list_entry *list_entry; + bool match = false; + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) { + if (strcmp(&rules->buf[cur->key.value_off], udev_list_entry_get_name(list_entry)) == 0) { + match = true; + break; + } + } + if (!match && (cur->key.op != OP_NOMATCH)) + goto nomatch; + break; + } case TK_M_SUBSYSTEM: if (match_key(rules, cur, udev_device_get_subsystem(event->dev)) != 0) goto nomatch; diff --git a/udev/udev.xml b/udev/udev.xml index 842fd5d52a..d2277c93d0 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -237,6 +237,13 @@ + + + + Match against a device tag. + + + -- cgit v1.2.3-54-g00ecf From f24362441f6165544888d8d97d63ff881e78f13f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Apr 2010 18:33:49 +0200 Subject: udev-acl: use a tag instead of a property to mark devices --- extras/udev-acl/70-acl.rules | 48 ++++++++++++++++++++++---------------------- extras/udev-acl/udev-acl.c | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 5b00bf82c7..cf6b0eaf7d 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -8,70 +8,70 @@ ACTION=="remove", GOTO="acl_apply" # PTP/MTP protocol devices, cameras, portable media players SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="", ENV{DEVTYPE}=="usb_device", IMPORT{program}="usb_id --export %p" -SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG="udev-acl" # digicams with proprietary protocol -ENV{ID_GPHOTO2}=="*?", ENV{ACL_MANAGE}="1" +ENV{ID_GPHOTO2}=="*?", TAG="udev-acl" # SCSI scanners -KERNEL=="sg[0-9]*", ATTRS{type}=="6", ENV{ACL_MANAGE}="1" -KERNEL=="sg[0-9]*", ATTRS{type}=="3", ATTRS{vendor}=="HP|EPSON|Epson", ENV{ACL_MANAGE}="1" +KERNEL=="sg[0-9]*", ATTRS{type}=="6", TAG="udev-acl" +KERNEL=="sg[0-9]*", ATTRS{type}=="3", ATTRS{vendor}=="HP|EPSON|Epson", TAG="udev-acl" # USB scanners -ENV{libsane_matched}=="yes", ENV{ACL_MANAGE}="1" +ENV{libsane_matched}=="yes", TAG="udev-acl" # HPLIP devices (necessary for ink level check and HP tool maintenance) -ENV{ID_HPLIP}=="1", ENV{ACL_MANAGE}="1" +ENV{ID_HPLIP}=="1", TAG="udev-acl" # optical drives -SUBSYSTEM=="block", ENV{ID_CDROM}=="1", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG="udev-acl" # sound devices -SUBSYSTEM=="sound", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="sound", TAG="udev-acl" # sound jack-sense -SUBSYSTEM=="input", SUBSYSTEMS=="sound", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="input", SUBSYSTEMS=="sound", TAG="udev-acl" # webcams, frame grabber, TV cards -SUBSYSTEM=="video4linux", ENV{ACL_MANAGE}="1" -SUBSYSTEM=="dvb", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="video4linux", TAG="udev-acl" +SUBSYSTEM=="dvb", TAG="udev-acl" # IIDC devices: industrial cameras and some webcams -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG="udev-acl" # AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG="udev-acl" # old style firewire devices -KERNEL=="dv1394-[0-9]*", ENV{ACL_MANAGE}="1" -KERNEL=="video1394-[0-9]*", ENV{ACL_MANAGE}="1" +KERNEL=="dv1394-[0-9]*", TAG="udev-acl" +KERNEL=="video1394-[0-9]*", TAG="udev-acl" # fingerprint readers -SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="2016", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="2016", TAG="udev-acl" # GPS devices # Garmin GPSMap 60 -SUBSYSTEM=="usb", ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="usb", ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", TAG="udev-acl" # DRI video devices -SUBSYSTEM=="drm", KERNEL=="card*", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="drm", KERNEL=="card*", TAG="udev-acl" # KVM -SUBSYSTEM=="misc", KERNEL=="kvm", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="misc", KERNEL=="kvm", TAG="udev-acl" # smart-card readers -ENV{ID_SMARTCARD_READER}=="*?", ENV{ACL_MANAGE}="1" +ENV{ID_SMARTCARD_READER}=="*?", TAG="udev-acl" # joysticks -SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG="udev-acl" # smart phones -SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", ENV{ACL_MANAGE}="1" +SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", TAG="udev-acl" # color measurement devices -ENV{COLOR_MEASUREMENT_DEVICE}=="*?", ENV{ACL_MANAGE}="1" +ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG="udev-acl" # apply ACL for all locally logged in users -LABEL="acl_apply", ENV{ACL_MANAGE}=="1", TEST=="/var/run/ConsoleKit/database", \ +LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" LABEL="acl_end" diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index ce515902e0..ff04ec6bed 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -289,7 +289,7 @@ static void apply_acl_to_devices(uid_t uid, int add) /* iterate over all devices tagged with ACL_SET */ udev = udev_new(); enumerate = udev_enumerate_new(udev); - udev_enumerate_add_match_property(enumerate, "ACL_MANAGE", "1"); + udev_enumerate_add_match_tag(enumerate, "udev-acl"); udev_enumerate_scan_devices(enumerate); udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { struct udev_device *device; -- cgit v1.2.3-54-g00ecf From bfd88b1d7b689ce86a2b04f62ac5a2b23b0aef84 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Apr 2010 18:50:43 +0200 Subject: fix logic on-demand loading logic for db and uevent --- libudev/libudev-device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 478fdcb92d..3f441d0999 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -284,6 +284,8 @@ int udev_device_read_db(struct udev_device *udev_device) dbg(udev_device->udev, "error reading db file %s: %m\n", filename); return -1; } + udev_device->db_loaded = true; + while (fgets(line, sizeof(line), f)) { ssize_t len; const char *val; @@ -322,7 +324,6 @@ int udev_device_read_db(struct udev_device *udev_device) fclose(f); info(udev_device->udev, "device %p filled with db file data\n", udev_device); - udev_device->db_loaded = true; return 0; } @@ -341,6 +342,7 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) f = fopen(filename, "r"); if (f == NULL) return -1; + udev_device->uevent_loaded = true; while (fgets(line, sizeof(line), f)) { char *pos; @@ -364,7 +366,6 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) udev_device->devnum = makedev(maj, min); fclose(f); - udev_device->uevent_loaded = true; return 0; } -- cgit v1.2.3-54-g00ecf From 1dbfbfbea6d80971fba6bb57469b5c437a8980d6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Apr 2010 19:03:11 +0200 Subject: use the usual TAG+=, TAG= logic --- extras/udev-acl/70-acl.rules | 48 ++++++++++++++++++++++---------------------- udev/udev-rules.c | 2 ++ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index cf6b0eaf7d..8300ec26d4 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -1,6 +1,6 @@ # do not edit this file, it will be overwritten on update -# Do not use ACL_MANAGE outside of this file. This variable is private to +# Do not use TAG+="udev-acl" outside of this file. This variable is private to # udev-acl of this udev release and may be replaced at any time. ENV{MAJOR}=="", GOTO="acl_end" @@ -8,67 +8,67 @@ ACTION=="remove", GOTO="acl_apply" # PTP/MTP protocol devices, cameras, portable media players SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="", ENV{DEVTYPE}=="usb_device", IMPORT{program}="usb_id --export %p" -SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG="udev-acl" +SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="udev-acl" # digicams with proprietary protocol -ENV{ID_GPHOTO2}=="*?", TAG="udev-acl" +ENV{ID_GPHOTO2}=="*?", TAG+="udev-acl" # SCSI scanners -KERNEL=="sg[0-9]*", ATTRS{type}=="6", TAG="udev-acl" -KERNEL=="sg[0-9]*", ATTRS{type}=="3", ATTRS{vendor}=="HP|EPSON|Epson", TAG="udev-acl" +KERNEL=="sg[0-9]*", ATTRS{type}=="6", TAG+="udev-acl" +KERNEL=="sg[0-9]*", ATTRS{type}=="3", ATTRS{vendor}=="HP|EPSON|Epson", TAG+="udev-acl" # USB scanners -ENV{libsane_matched}=="yes", TAG="udev-acl" +ENV{libsane_matched}=="yes", TAG+="udev-acl" # HPLIP devices (necessary for ink level check and HP tool maintenance) -ENV{ID_HPLIP}=="1", TAG="udev-acl" +ENV{ID_HPLIP}=="1", TAG+="udev-acl" # optical drives -SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG="udev-acl" +SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" # sound devices -SUBSYSTEM=="sound", TAG="udev-acl" +SUBSYSTEM=="sound", TAG+="udev-acl" # sound jack-sense -SUBSYSTEM=="input", SUBSYSTEMS=="sound", TAG="udev-acl" +SUBSYSTEM=="input", SUBSYSTEMS=="sound", TAG+="udev-acl" # webcams, frame grabber, TV cards -SUBSYSTEM=="video4linux", TAG="udev-acl" -SUBSYSTEM=="dvb", TAG="udev-acl" +SUBSYSTEM=="video4linux", TAG+="udev-acl" +SUBSYSTEM=="dvb", TAG+="udev-acl" # IIDC devices: industrial cameras and some webcams -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG="udev-acl" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG+="udev-acl" # AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG="udev-acl" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="udev-acl" # old style firewire devices -KERNEL=="dv1394-[0-9]*", TAG="udev-acl" -KERNEL=="video1394-[0-9]*", TAG="udev-acl" +KERNEL=="dv1394-[0-9]*", TAG+="udev-acl" +KERNEL=="video1394-[0-9]*", TAG+="udev-acl" # fingerprint readers -SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="2016", TAG="udev-acl" +SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="2016", TAG+="udev-acl" # GPS devices # Garmin GPSMap 60 -SUBSYSTEM=="usb", ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", TAG="udev-acl" +SUBSYSTEM=="usb", ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", TAG+="udev-acl" # DRI video devices -SUBSYSTEM=="drm", KERNEL=="card*", TAG="udev-acl" +SUBSYSTEM=="drm", KERNEL=="card*", TAG+="udev-acl" # KVM -SUBSYSTEM=="misc", KERNEL=="kvm", TAG="udev-acl" +SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="udev-acl" # smart-card readers -ENV{ID_SMARTCARD_READER}=="*?", TAG="udev-acl" +ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" # joysticks -SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG="udev-acl" +SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" # smart phones -SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", TAG="udev-acl" +SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", TAG+="udev-acl" # color measurement devices -ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG="udev-acl" +ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="udev-acl" # apply ACL for all locally logged in users LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 5965723919..6f3335b8c8 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2442,6 +2442,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; } case TK_A_TAG: + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_device_cleanup_tags_list(event->dev); udev_device_add_tag(event->dev, &rules->buf[cur->key.value_off]); break; case TK_A_NAME: -- cgit v1.2.3-54-g00ecf From c1dbe11dc336f9faf02073a66fe30a12bd438e23 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Apr 2010 09:01:56 +0200 Subject: delete old tags when configuration changes --- libudev/libudev-device-private.c | 67 ++++++++++++++++++++++++++-------------- libudev/libudev-private.h | 1 + udev/udev-event.c | 4 +++ 3 files changed, 49 insertions(+), 23 deletions(-) diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 13f1ebf883..7e5fcbc293 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -22,34 +22,58 @@ #include "libudev.h" #include "libudev-private.h" -static int udev_device_tag_index(struct udev_device *udev_device, bool add) +static void udev_device_tag(struct udev_device *dev, const char *tag, bool add) { - struct udev *udev = udev_device_get_udev(udev_device); - struct udev_list_entry *list_entry; + struct udev *udev = udev_device_get_udev(dev); + char filename[UTIL_PATH_SIZE]; - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) { - char filename[UTIL_PATH_SIZE]; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", tag, "/", + udev_device_get_subsystem(dev), ":", udev_device_get_sysname(dev), NULL); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", - udev_list_entry_get_name(list_entry), "/", - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); + if (add) { + util_create_path(udev, filename); + symlink(udev_device_get_devpath(dev), filename); + /* possibly cleanup old entries after a device renaming */ + if (udev_device_get_sysname_old(dev) != NULL) { + char filename_old[UTIL_PATH_SIZE]; - if (add) { - util_create_path(udev, filename); - symlink(udev_device_get_devpath(udev_device), filename); - if (udev_device_get_sysname_old(udev_device) != NULL) { - char filename_old[UTIL_PATH_SIZE]; + util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/tags/", tag, "/", + udev_device_get_subsystem(dev), ":", udev_device_get_sysname_old(dev), NULL); + unlink(filename_old); + } + } else { + unlink(filename); + } +} - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", - udev_list_entry_get_name(list_entry), - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL); - unlink(filename_old); +int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add) +{ + struct udev_list_entry *list_entry; + bool found; + + if (add) { + /* delete possible left-over tags */ + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev_old)) { + const char *tag_old = udev_list_entry_get_name(list_entry); + struct udev_list_entry *list_entry_current; + + found = false; + udev_list_entry_foreach(list_entry_current, udev_device_get_tags_list_entry(dev)) { + const char *tag = udev_list_entry_get_name(list_entry_current); + + if (strcmp(tag, tag_old) == 0) { + found = true; + break; + } } - } else { - unlink(filename); - util_delete_path(udev, filename); + if (!found) + udev_device_tag(dev_old, tag_old, false); } } + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev)) + udev_device_tag(dev, udev_list_entry_get_name(list_entry), add); + return 0; } @@ -140,7 +164,6 @@ file: rename(filename_tmp, filename); info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); out: - udev_device_tag_index(udev_device, true); return 0; } @@ -149,7 +172,6 @@ int udev_device_delete_db(struct udev_device *udev_device) struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; - udev_device_tag_index(udev_device, false); util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); unlink(filename); @@ -169,6 +191,5 @@ int udev_device_rename_db(struct udev_device *udev_device) udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL); util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); - udev_device_tag_index(udev_device, true); return rename(filename_old, filename); } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 548f4adbef..3f38a326f1 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -106,6 +106,7 @@ void udev_device_set_info_loaded(struct udev_device *device); int udev_device_update_db(struct udev_device *udev_device); int udev_device_delete_db(struct udev_device *udev_device); int udev_device_rename_db(struct udev_device *udev_device); +int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add); /* libudev-monitor.c - netlink/unix socket communication */ int udev_monitor_disconnect(struct udev_monitor *udev_monitor); diff --git a/udev/udev-event.c b/udev/udev-event.c index 212ccc7950..2d8becd86a 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -544,6 +544,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (strcmp(udev_device_get_action(dev), "remove") == 0) { udev_device_read_db(dev); udev_device_delete_db(dev); + udev_device_tag_index(dev, NULL, false); if (major(udev_device_get_devnum(dev)) != 0) udev_watch_end(event->udev, dev); @@ -577,6 +578,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) /* delete stale db file */ udev_device_delete_db(dev); + udev_device_tag_index(dev, NULL, false); /* remember old name */ udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); @@ -618,6 +620,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (event->name == NULL) { /* things went wrong */ udev_device_delete_db(dev); + udev_device_tag_index(dev, NULL, false); udev_device_unref(event->dev_db); err = -ENOMEM; goto out; @@ -629,6 +632,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) } udev_device_update_db(dev); + udev_device_tag_index(dev, event->dev_db, true); if (major(udev_device_get_devnum(dev)) != 0) { /* remove/update possible left-over symlinks from old database entry */ -- cgit v1.2.3-54-g00ecf From 65f099c721fa568350f8ac019e3a99fda1966082 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Apr 2010 09:22:42 +0200 Subject: libudev: accept NULL in udev_device_get_tags_list_entry() --- libudev/libudev-device-private.c | 2 +- libudev/libudev-device.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 7e5fcbc293..8c8ac244be 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -51,7 +51,7 @@ int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, struct udev_list_entry *list_entry; bool found; - if (add) { + if (add && dev_old != NULL) { /* delete possible left-over tags */ udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev_old)) { const char *tag_old = udev_list_entry_get_name(list_entry); diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 3f441d0999..a6a1ecb4e9 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1289,6 +1289,8 @@ void udev_device_cleanup_tags_list(struct udev_device *udev_device) struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) { + if (udev_device == NULL) + return NULL; return udev_list_get_entry(&udev_device->tags_list); } -- cgit v1.2.3-54-g00ecf From 2a34f9c31e17f4a6c4fc99a369f56e843a063390 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Apr 2010 10:46:00 +0200 Subject: export tag functions --- libudev/exported_symbols | 1 + 1 file changed, 1 insertion(+) diff --git a/libudev/exported_symbols b/libudev/exported_symbols index c0ca4b9c6d..d2c458e7f6 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -46,6 +46,7 @@ udev_enumerate_add_nomatch_subsystem udev_enumerate_add_match_sysattr udev_enumerate_add_nomatch_sysattr udev_enumerate_add_match_property +udev_enumerate_add_match_tag udev_enumerate_add_match_sysname udev_enumerate_scan_devices udev_enumerate_scan_subsystems -- cgit v1.2.3-54-g00ecf From 2793f4e34bdf4f1a46d0263f7dbdb8fcffe78e32 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Apr 2010 16:05:38 +0200 Subject: export udev_device_get_tags_list_entry() --- libudev/exported_symbols | 1 + libudev/libudev-private.h | 1 - libudev/libudev.h | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libudev/exported_symbols b/libudev/exported_symbols index d2c458e7f6..935e361db5 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -30,6 +30,7 @@ udev_device_get_subsystem udev_device_get_devtype udev_device_get_devlinks_list_entry udev_device_get_properties_list_entry +udev_device_get_tags_list_entry udev_device_get_property_value udev_device_get_action udev_device_get_driver diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 3f38a326f1..7132357ac2 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -87,7 +87,6 @@ int udev_device_set_devpath_old(struct udev_device *udev_device, const char *dev const char *udev_device_get_knodename(struct udev_device *udev_device); int udev_device_add_tag(struct udev_device *udev_device, const char *tag); void udev_device_cleanup_tags_list(struct udev_device *udev_device); -struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device); int udev_device_has_tag(struct udev_device *udev_device, const char *tag); int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename); int udev_device_get_timeout(struct udev_device *udev_device); diff --git a/libudev/libudev.h b/libudev/libudev.h index 3b73fbd61b..5bc42df5be 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -90,6 +90,7 @@ const char *udev_device_get_sysnum(struct udev_device *udev_device); const char *udev_device_get_devnode(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device); const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key); const char *udev_device_get_driver(struct udev_device *udev_device); dev_t udev_device_get_devnum(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From 0c6a3f48357ed4a49c2c49c43f669f930d628382 Mon Sep 17 00:00:00 2001 From: Robby Workman Date: Sat, 24 Apr 2010 21:38:37 +0200 Subject: configure.ac: move firmware-path setting out of extras section --- configure.ac | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index d4d29c47f7..4fe8c3cad4 100644 --- a/configure.ac +++ b/configure.ac @@ -46,6 +46,24 @@ if test "x$enable_logging" = "xyes"; then AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) fi +AC_ARG_WITH(firmware-path, + AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], + [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), + [], [with_firmware_path="/lib/firmware/updates:/lib/firmware"] + ) +OLD_IFS=$IFS +IFS=: +for i in $with_firmware_path +do + if test "x${FIRMWARE_PATH}" = "x"; then + FIRMWARE_PATH="\\\"${i}/\\\"" + else + FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\"" + fi +done +IFS=$OLD_IFS +AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH]) + AC_ARG_ENABLE([extras], AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]), [], [enable_extras=yes]) @@ -82,26 +100,6 @@ if test "x$enable_extras" = xyes; then fi]) AC_SUBST(PCI_DATABASE) - AC_ARG_WITH(firmware-path, - AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], - [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), - [], - [with_firmware_path="/lib/firmware/updates:/lib/firmware"] - ) - OLD_IFS=$IFS - IFS=: - for i in $with_firmware_path - do - if test "x${FIRMWARE_PATH}" = "x" - then - FIRMWARE_PATH="\\\"${i}/\\\"" - else - FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\"" - fi - done - IFS=$OLD_IFS - AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH]) - AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) fi -- cgit v1.2.3-54-g00ecf From ad3d4198439f06cab8a2a65190ad501b803666a1 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 26 Apr 2010 08:28:36 +0200 Subject: keymap: Fix Bluetooth key on Acer TravelMate 4720 https://launchpad.net/bugs/569815 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 2f41cb4742..a27bc6d979 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -77,7 +77,7 @@ ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" -- cgit v1.2.3-54-g00ecf From 665ee17def2caa6811ae032ae68ebf8239a18cf8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 26 Apr 2010 12:21:16 +0200 Subject: udevd: always try to find an idle worker instead of forking a new one We special-handle events with a TIMEOUT= set, so they don't get queued or wait for parent events to finish, to make sure we can handle them as fast as possible. With this change we first try to find an idle worker process before forking a new one. --- udev/udevd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index c27b4cd6aa..7712543734 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -360,7 +360,7 @@ static void worker_new(struct event *event) } } -static void event_run(struct event *event) +static void event_run(struct event *event, bool force) { struct udev_list_node *loop; @@ -385,7 +385,7 @@ static void event_run(struct event *event) return; } - if (childs >= max_childs) { + if (!force && childs >= max_childs) { info(event->udev, "maximum number (%i) of childs reached\n", childs); return; } @@ -420,7 +420,7 @@ static void event_queue_insert(struct udev_device *dev) /* run all events with a timeout set immediately */ if (udev_device_get_timeout(dev) > 0) { - worker_new(event); + event_run(event, true); return; } } @@ -552,7 +552,7 @@ static void events_start(struct udev *udev) continue; } - event_run(event); + event_run(event, false); } } -- cgit v1.2.3-54-g00ecf From c0b19a171794d92b68414a91c3bc804e22528142 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 27 Apr 2010 12:25:59 +0200 Subject: Makefile.am: add LGPL COPYING file to EXTRA_DIST Signed-off-by: Martin Pitt --- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 9d3fefd702..8d13f19382 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,7 +69,7 @@ endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libudev/libudev.pc -EXTRA_DIST += libudev/exported_symbols +EXTRA_DIST += libudev/exported_symbols libudev/COPYING # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed libudev-install-move-hook: if test "$(libdir)" != "$(rootlib_execdir)"; then \ @@ -351,6 +351,7 @@ extras_gudev_libgudev_1_0_la_LDFLAGS = \ -export-symbols-regex '^g_udev_.*' EXTRA_DIST += \ + extras/gudev/COPYING \ extras/gudev/gudevmarshal.list \ extras/gudev/gudevenumtypes.h.template \ extras/gudev/gudevenumtypes.c.template -- cgit v1.2.3-54-g00ecf From c00b776880142a17de001e5df4f27283c9f0d279 Mon Sep 17 00:00:00 2001 From: Michael Thayer Date: Sat, 1 May 2010 17:28:08 +0200 Subject: fix device node deletion Signed-off-by: Michael Thayer --- udev/udev-node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 5c1b04b86c..780cd707c7 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -428,7 +428,7 @@ int udev_node_remove(struct udev_device *dev) } util_strscpyl(filename, sizeof(filename), LIBEXECDIR "/devices", &devnode[strlen(udev_get_dev_path(udev))], NULL); - if (stat(filename, &stats) == 0 || stats.st_rdev == udev_device_get_devnum(dev)) { + if (stat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) { info(udev, "static device entry found '%s', skip removal\n", devnode); goto out; } -- cgit v1.2.3-54-g00ecf From 7d5fb93976cabb66314cfc1ac35c23272b0954e3 Mon Sep 17 00:00:00 2001 From: Matthias Schwarzott Date: Mon, 3 May 2010 13:19:36 +0200 Subject: rules: Gentoo - remove old devfs compat rules --- rules/gentoo/40-gentoo.rules | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rules/gentoo/40-gentoo.rules b/rules/gentoo/40-gentoo.rules index 4751b51bce..91a754597b 100644 --- a/rules/gentoo/40-gentoo.rules +++ b/rules/gentoo/40-gentoo.rules @@ -1,11 +1,5 @@ # do not edit this file, it will be overwritten on update -# old devfs path, removing this could break systems -# Bug 195839 -KERNEL=="md[0-9]*", SYMLINK+="md/%n" -KERNEL=="loop[0-9]*", SYMLINK+="loop/%n" -KERNEL=="ram[0-9]*", SYMLINK+="rd/%n" - # keep devices after driver unload KERNEL=="ppp", OPTIONS+="ignore_remove" KERNEL=="tun", OPTIONS+="ignore_remove" -- cgit v1.2.3-54-g00ecf From c7cdd8b2d28ff56211ac9ce54805f5568ffa7346 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 3 May 2010 18:08:51 +0200 Subject: remove unused parameter from udev_node_mknod() --- udev/udev-event.c | 2 +- udev/udev-node.c | 7 +++---- udev/udev.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 2d8becd86a..1e7a2ea34c 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -380,7 +380,7 @@ subst: minor(udev_device_get_devnum(dev))); if (event->tmp_node == NULL) break; - udev_node_mknod(dev, event->tmp_node, makedev(0, 0), 0600, 0, 0); + udev_node_mknod(dev, event->tmp_node, 0600, 0, 0); l = util_strpcpy(&s, l, event->tmp_node); break; } diff --git a/udev/udev-node.c b/udev/udev-node.c index 780cd707c7..d55700d70f 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -33,14 +33,13 @@ #define TMP_FILE_EXT ".udev-tmp" -int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid) +int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); + dev_t devnum = udev_device_get_devnum(dev); struct stat stats; int err = 0; - if (major(devnum) == 0) - devnum = udev_device_get_devnum(dev); if (strcmp(udev_device_get_subsystem(dev), "block") == 0) mode |= S_IFBLK; @@ -373,7 +372,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)), mode, uid, gid); - if (udev_node_mknod(dev, NULL, makedev(0,0), mode, uid, gid) != 0) { + if (udev_node_mknod(dev, NULL, mode, uid, gid) != 0) { err = -1; goto exit; } diff --git a/udev/udev.h b/udev/udev.h index 2b9bbecc8e..b1b65c5617 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -81,7 +81,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev); struct udev_device *udev_watch_lookup(struct udev *udev, int wd); /* udev-node.c */ -int udev_node_mknod(struct udev_device *dev, const char *file, dev_t devnum, mode_t mode, uid_t uid, gid_t gid); +int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid); int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); int udev_node_remove(struct udev_device *dev); void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); -- cgit v1.2.3-54-g00ecf From 6d80a7e83f55c7319d1cb9b0a9910a005b2f4103 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 3 May 2010 18:09:25 +0200 Subject: remove debug output during rules parsing --- udev/udev-rules.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 6f3335b8c8..eb73221fa9 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1468,9 +1468,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (op < OP_MATCH_MAX) { rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL); } else { - if (value[0] == '\0') - info(rules->udev, "name empty, node creation suppressed\n"); - else if (strcmp(value, "%k") == 0) + if (strcmp(value, "%k") == 0) err(rules->udev, "NAME=\"%%k\" is superfluous and breaks " "kernel supplied names, please remove it from %s:%u\n", filename, lineno); rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); -- cgit v1.2.3-54-g00ecf From 2d01980f1afbde8aabd175a5d866a8eeccc29208 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 27 Apr 2010 12:26:00 +0200 Subject: cdrom_id: only mark sr[0-9]* as ID_CDROM we cannot be sure for xvd* --- extras/cdrom_id/60-cdrom_id.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index 16b3af9e92..b3109f1d01 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -5,7 +5,7 @@ SUBSYSTEM!="block", GOTO="cdrom_end" KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" ENV{DEVTYPE}!="disk", GOTO="cdrom_end" -ENV{ID_CDROM}="1" +KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" IMPORT{program}="cdrom_id --export $tempnode" LABEL="cdrom_end" -- cgit v1.2.3-54-g00ecf From 75cb1ac51ea0176926c749bd0f22c19ce8b20e5f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 May 2010 11:14:50 +0200 Subject: warn when renaming kernel-provided nodes instead of adding symlinks --- NEWS | 11 +++++++ test/udev-test.pl | 11 ------- udev/udev-event.c | 27 +++++------------ udev/udev-rules.c | 10 ++++-- udev/udev.xml | 91 ++++++++++++++++++++++++++++--------------------------- 5 files changed, 72 insertions(+), 78 deletions(-) diff --git a/NEWS b/NEWS index f3163ecd7e..d4e8477cfb 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,16 @@ udev 154 ======== +Bugfixes. + +Udev now gradually starts to pass control over the primary device nodes +and their names to the kernel, and will in the end only manage the +permissions of the node, and possibly create additional symlinks. +As a first step NAME="" will be ignored, and NAME= setings with names +other than the kernel provided name will result in a logged warning. +Kernels that don't provide device names, or devtmpfs is not used, will +still work as they did before, but it is strongly recommended to use +only the same names for the primary device node as the recent kernel +provides for all devices. udev 153 ======== diff --git a/test/udev-test.pl b/test/udev-test.pl index a4d3a728f7..24e62b4d66 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1263,17 +1263,6 @@ EOF KERNEL=="ttyACM[0-9]*", SYMLINK+="one" KERNEL=="ttyACM[0-9]*", SYMLINK+="two" KERNEL=="ttyACM[0-9]*", SYMLINK="three" -EOF - }, - { - desc => "test empty NAME", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "", - not_exp_name => "ttyACM0", - exp_add_error => "yes", - rules => <name == NULL) { - /* things went wrong */ + if (event->name == NULL || event->name[0] == '\0') { udev_device_delete_db(dev); udev_device_tag_index(dev, NULL, false); udev_device_unref(event->dev_db); err = -ENOMEM; + err(event->udev, "no node name, something went wrong, ignoring\n"); goto out; } + if (udev_device_get_knodename(dev) != NULL && strcmp(udev_device_get_knodename(dev), event->name) != 0) + err(event->udev, "kernel-provided name '%s' and NAME= '%s' disagree, " + "please use SYMLINK+= or change the kernel to provide the proper name\n", + udev_device_get_knodename(dev), event->name); + /* set device node name */ util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", event->name, NULL); udev_device_set_devnode(dev, filename); @@ -639,23 +644,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (event->dev_db != NULL) udev_node_update_old_links(dev, event->dev_db); - if (event->name[0] != '\0') - err = udev_node_add(dev, event->mode, event->uid, event->gid); - else - info(event->udev, "device node creation suppressed\n"); - - /* remove kernel-created node, if needed */ - if (udev_device_get_knodename(dev) != NULL && strcmp(event->name, udev_device_get_knodename(dev)) != 0) { - struct stat stats; - char filename[UTIL_PATH_SIZE]; - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); - if (lstat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) { - info(event->udev, "remove kernel created node '%s'\n", udev_device_get_knodename(dev)); - util_unlink_secure(event->udev, filename); - util_delete_path(event->udev, filename); - } - } + err = udev_node_add(dev, event->mode, event->uid, event->gid); } udev_device_unref(event->dev_db); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index eb73221fa9..59fdb71853 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1468,9 +1468,13 @@ static int add_rule(struct udev_rules *rules, char *line, if (op < OP_MATCH_MAX) { rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL); } else { - if (strcmp(value, "%k") == 0) - err(rules->udev, "NAME=\"%%k\" is superfluous and breaks " - "kernel supplied names, please remove it from %s:%u\n", filename, lineno); + if (strcmp(value, "%k") == 0) { + err(rules->udev, "NAME=\"%%k\" is ignored because it breaks kernel supplied names, " + "please remove it from %s:%u\n", filename, lineno); + continue; + } + if (value[0] == '\0') + continue; rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); } rule_tmp.rule.rule.flags = 1; diff --git a/udev/udev.xml b/udev/udev.xml index d2277c93d0..678023c373 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -18,23 +18,28 @@ udev - dynamic device management + Linux dynamic device management DESCRIPTION - udev provides a dynamic device directory containing only the files for - actually present devices. It creates or removes device node files in the - /dev directory, or it renames network interfaces. - - Usually udev runs as udevd - 8 and receives uevents directly from the - kernel if a device is added or removed from the system. - - If udev receives a device event, it matches its configured rules - against the available device attributes provided in sysfs to identify the device. - Rules that match may provide additional device information or specify a device - node name and multiple symlink names and instruct udev to run additional programs - as part of the device event handling. + udev supplies the system software with device events, manages permissions + of device nodes and may create additional symlinks in the /dev + directory, or renames network interfaces. The kernel usually just assigns unpredictable + device names based on the order of discovery. Meaningful symlinks or network device + names provide a way to reliably identify devices based on their properties or + current configuration. + + The udev daemon udevd + 8 receives device uevents directly from + the kernel whenever a device is added or removed from the system, or it changes its + state. When udev receives a device event, it matches its configured set of rules + against various device attributes to identify the device. Rules that match, may + provide additional device information to be stored in the udev database, or information + to be used to create meaningful symlink names. + + All device information udev processes, is stored in the udev database and + sent out to possible event subscribers. Access to all stored data and the event + sources are provided by the library libudev. CONFIGURATION @@ -84,9 +89,9 @@ If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. - A matching rule may specify the name of the device node, add a symlink - pointing to the node, or run a specified program as part of the event handling. - If no matching rule is found, the default device node name is used. + A matching rule may rename a network interface, add symlinks + pointing to the device node, or run a specified program as part of + the event handling. A rule consists of a list of one or more key value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid @@ -304,13 +309,17 @@ - The name, a network interface should be renamed to, or the name - a device node should be named. Usually the kernel provides the defined - node name, or even creates and removes the node before udev receives - any event. Changing the node name from the kernel's default may result - in unexpected behavior and is not supported. Udev is only expected to - handle device node permissions and to create additional symlinks, which - do not conflict with the kernel device node names. + The name, a network interface should be renamed to. Or as + a temporary workaraound, the name a device node should be named. + Usually the kernel provides the defined node name, or even creates + and removes the node before udev even receives any event. Changing + the node name from the kernel's default creates inconsistencies + and is not supported. If the kernel and NAME specify different names, + an error will be logged. Udev is only expected to handle device node + permissions and to create additional symlinks, not to change + kernel-provided device node names. Instead of renaming a device node, + SYMLINK should be used. Symlink names must never conflict with + device node names, it will result in unpredictable behavior. @@ -318,15 +327,15 @@ The name of a symlink targeting the node. Every matching rule will add - this value to the list of symlinks to be created along with the device node. - Multiple symlinks may be specified by separating the names by the space - character. In case multiple devices claim the same name, the link will - always point to the device with the highest link_priority. If the current device - goes away, the links will be re-evaluated and the device with the next highest - link_priority will own the link. If no link_priority is specified, the order - of the devices, and which of them will own the link, is undefined. Claiming - the same name for a node and links may result in unexpected behavior and is - not supported. + this value to the list of symlinks to be created. Multiple symlinks may be + specified by separating the names by the space character. In case multiple + devices claim the same name, the link will always point to the device with + the highest link_priority. If the current device goes away, the links will + be re-evaluated and the device with the next highest link_priority will own + the link. If no link_priority is specified, the order of the devices, and + which one of them will own the link, is undefined. Claiming the same name for + a symlink, which is or might be used for a device node, may result in + unexpected behavior and is not supported. @@ -379,18 +388,10 @@ is specified, and the executed program returns non-zero, the event will be marked as failed for a possible later handling. - If no path is given, the program must be in - /lib/udev, otherwise the full path must be - specified. - If the specified string starts with - , all current event - values will be passed to the specified socket, as a message in the same - format the kernel sends an uevent. If the first character of the specified path - is an @ character, an abstract namespace socket is used, instead of an existing - socket file. - Program name and arguments are separated with spaces. To - include spaces in an argument, use single quotes. Please note - that this does not run through a shell. + If no absolute path is given, the program is expected to live in + /lib/udev, otherwise the absolute path must be + specified. Program name and arguments are separated by spaces. Single quotes + can be used to specify arguments with spaces. -- cgit v1.2.3-54-g00ecf From 2f71757d1c6169328fe1f316e0972391cbb1e8f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 May 2010 15:37:56 +0200 Subject: man: udevadm trigger - the default is "change" not "add" --- udev/udevadm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 73e6f110a6..44e286bba6 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -149,7 +149,7 @@ udevadm trigger <optional>options</optional> - Request device events from the kernel. Usually used to replay events at system coldplug time. + Request device events from the kernel. Primarily used to replay events at system coldplug time. @@ -174,7 +174,7 @@ - Type of event to be triggered. The default value is add. + Type of event to be triggered. The default value is change. -- cgit v1.2.3-54-g00ecf From 417ec5a850a7a6ed07d27aea57969343900e7971 Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Thu, 6 May 2010 10:06:43 +0800 Subject: keymap: Add keymap and force-release quirk for Samsung N128 http://bugs.meego.com/show_bug.cgi?id=1530 Signed-off-by: Yin Kangkai Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 2 +- extras/keymap/95-keymap.rules | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 011b2e347a..7c334ce609 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index a27bc6d979..8c00ba1143 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -110,7 +110,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N130*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" -- cgit v1.2.3-54-g00ecf From 5a2cfd1599aa1300e26c2de22b1158c626bc0139 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 May 2010 22:56:36 +0200 Subject: update README regarding kernel version and default rules --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 6e09b3a52d..2b5fc37d81 100644 --- a/README +++ b/README @@ -7,7 +7,7 @@ does not recommend to replace a distro's udev installation with the upstream version. The upstream udev project's set of default rules may require a most recent -kernel release to work properly. +kernel release to work properly. This is currently version 2.6.31. Tools and rules shipped by udev are not public API and may change at any time. Never call any private tool in /lib/udev from any external application, it might -- cgit v1.2.3-54-g00ecf From d0d7b8d08539579b4dfee0ff9d0a0457720c7eb5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 May 2010 22:57:20 +0200 Subject: add info message when empty NAME is given --- udev/udev-rules.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 59fdb71853..b58ea8c680 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1469,12 +1469,15 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL); } else { if (strcmp(value, "%k") == 0) { - err(rules->udev, "NAME=\"%%k\" is ignored because it breaks kernel supplied names, " + err(rules->udev, "NAME=\"%%k\" is ignored, because it breaks kernel supplied names, " "please remove it from %s:%u\n", filename, lineno); continue; } - if (value[0] == '\0') + if (value[0] == '\0') { + info(rules->udev, "NAME=\"\" is ignored, because udev will not delete any device nodes, " + "please remove it from %s:%u\n", filename, lineno); continue; + } rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); } rule_tmp.rule.rule.flags = 1; -- cgit v1.2.3-54-g00ecf From f712894dd4c2a2d8e374de133b7ed854e203fa96 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 7 May 2010 23:04:42 +0200 Subject: libudev: add documentation for recently added functions --- libudev/docs/libudev-sections.txt | 2 ++ libudev/libudev-device.c | 11 +++++++++++ libudev/libudev-monitor.c | 10 ++++++++++ 3 files changed, 23 insertions(+) diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 3f8c107a1f..63c0ee2e98 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -47,6 +47,7 @@ udev_device_get_sysnum udev_device_get_devnode udev_device_get_devlinks_list_entry udev_device_get_properties_list_entry +udev_device_get_tags_list_entry udev_device_get_property_value udev_device_get_driver udev_device_get_devnum @@ -65,6 +66,7 @@ udev_monitor_get_udev udev_monitor_new_from_netlink udev_monitor_new_from_socket udev_monitor_enable_receiving +udev_monitor_set_receive_buffer_size udev_monitor_get_fd udev_monitor_receive_device udev_monitor_filter_add_match_subsystem_devtype diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index a6a1ecb4e9..7e6b7f1ce7 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1287,6 +1287,17 @@ void udev_device_cleanup_tags_list(struct udev_device *udev_device) udev_list_cleanup_entries(udev_device->udev, &udev_device->tags_list); } +/** + * udev_device_get_tags_list_entry: + * @udev_device: udev device + * + * Retrieve the list of tags attached to the udev device. The next + * list entry can be retrieved with udev_list_entry_next(), + * which returns #NULL if no more entries exist. The tag string + * can be retrieved from the list entry by udev_list_get_name(). + * + * Returns: the first entry of the tag list + **/ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) { if (udev_device == NULL) diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 24e8aead26..b3e5d5f348 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -400,6 +400,16 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) return 0; } +/** + * udev_monitor_set_receive_buffer_size: + * @udev_monitor: the monitor which should receive events + * @size: the size in bytes + * + * Set the size of the kernel socket buffer. This call needs the + * appropriate privileges to succeed. + * + * Returns: 0 on success, otherwise -1 on error. + */ int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) { if (udev_monitor == NULL) -- cgit v1.2.3-54-g00ecf From 422449339aebde83a45108b015f4e02b59b5c2c0 Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Fri, 7 May 2010 15:05:21 +0800 Subject: keymap: Add keymap quirk of WebCam key for MSI netbooks. I've verified that this patch fixes MSI U100, N014, U135 http://bugs.meego.com/show_bug.cgi?id=1741 Signed-off-by: Yin Kangkai Signed-off-by: Martin Pitt --- extras/keymap/keymaps/micro-star | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/keymaps/micro-star b/extras/keymap/keymaps/micro-star index 0469434030..0de5ae6d18 100644 --- a/extras/keymap/keymaps/micro-star +++ b/extras/keymap/keymaps/micro-star @@ -6,6 +6,7 @@ 0xE2 bluetooth # satellite dish2 0xE4 f22 # Fn-F3 Touchpad disable 0xEC email # envelope button +0xEE camera # Fn-F6 camera disable 0xF6 wlan # satellite dish1 0xF7 brightnessdown # Fn-F4 0xF8 brightnessup # Fn-F5 -- cgit v1.2.3-54-g00ecf From 79e1912b918eadb01cc969f7e08f6be0c47a5cbe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 11 May 2010 22:59:09 +0200 Subject: udevd: reload config only for *.rules files --- udev/udevd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 7712543734..77a14df7b0 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -685,14 +685,21 @@ static int handle_inotify(struct udev *udev) ev = (struct inotify_event *)(buf + pos); if (ev->len) { - dbg(udev, "inotify event: %x for %s\n", ev->mask, ev->name); + const char *s; + + info(udev, "inotify event: %x for %s\n", ev->mask, ev->name); + s = strstr(ev->name, ".rules"); + if (s == NULL) + continue; + if (strlen(s) != strlen(".rules")) + continue; reload_config = true; continue; } dev = udev_watch_lookup(udev, ev->wd); if (dev != NULL) { - dbg(udev, "inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev)); + info(udev, "inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev)); if (ev->mask & IN_CLOSE_WRITE) { char filename[UTIL_PATH_SIZE]; int fd; -- cgit v1.2.3-54-g00ecf From 1ecfdba0ddfb09a7e5c463466a2c0b1e9176c458 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 11 May 2010 23:02:47 +0200 Subject: release 154 --- ChangeLog | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0a1475f551..4c43d90835 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,58 @@ +Summary of changes from v153 to v154 +============================================ + +Harald Hoyer (2): + Makefile.am: add LGPL COPYING file to EXTRA_DIST + cdrom_id: only mark sr[0-9]* as ID_CDROM + +Jerone Young (1): + Fix volume keys not releasing for Pegatron platform + +Kay Sievers (23): + configure.ac: version bump + more readlink buffer size handling + remove left-over from ignore_remove and all_partitions + fix previous commit + udevadm: info --export-db -- remove watch handle export + add TAG= to improve event filtering and device enumeration + all to match against a given TAG== + udev-acl: use a tag instead of a property to mark devices + fix logic on-demand loading logic for db and uevent + use the usual TAG+=, TAG= logic + delete old tags when configuration changes + libudev: accept NULL in udev_device_get_tags_list_entry() + export tag functions + export udev_device_get_tags_list_entry() + udevd: always try to find an idle worker instead of forking a new one + remove unused parameter from udev_node_mknod() + remove debug output during rules parsing + warn when renaming kernel-provided nodes instead of adding symlinks + man: udevadm trigger - the default is "change" not "add" + update README regarding kernel version and default rules + add info message when empty NAME is given + libudev: add documentation for recently added functions + udevd: reload config only for *.rules files + +Martin Pitt (1): + keymap: Fix Bluetooth key on Acer TravelMate 4720 + +Mathias Nyman (1): + remove buffer-overrun risk in readlink call + +Matthias Schwarzott (1): + rules: Gentoo - remove old devfs compat rules + +Michael Thayer (1): + fix device node deletion + +Robby Workman (1): + configure.ac: move firmware-path setting out of extras section + +Yin Kangkai (2): + keymap: Add keymap and force-release quirk for Samsung N128 + keymap: Add keymap quirk of WebCam key for MSI netbooks. + + Summary of changes from v152 to v153 ============================================ -- cgit v1.2.3-54-g00ecf From e85f5ec15f1c0a820cc81b422c2fa157d9805896 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 12 May 2010 08:46:56 +0200 Subject: reset process priority before executing RUN+= http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=581235 --- libudev/libudev-private.h | 2 +- libudev/libudev-util-private.c | 4 +++- udev/udev-event.c | 2 +- udev/udev-rules.c | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 7132357ac2..3758c5b1b4 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -217,7 +217,7 @@ uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); int util_run_program(struct udev *udev, const char *command, char **envp, char *result, size_t ressize, size_t *reslen, - const sigset_t *sigmask); + const sigset_t *sigmask, bool reset_prio); int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index c05c157575..8c535125a8 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -254,7 +254,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, int util_run_program(struct udev *udev, const char *command, char **envp, char *result, size_t ressize, size_t *reslen, - const sigset_t *sigmask) + const sigset_t *sigmask, bool reset_prio) { int status; int outpipe[2] = {-1, -1}; @@ -349,6 +349,8 @@ int util_run_program(struct udev *udev, const char *command, char **envp, if (sigmask) sigprocmask(SIG_SETMASK, sigmask, NULL); + if (reset_prio) + setpriority(PRIO_PROCESS, 0, 0); execve(argv[0], argv, envp); if (errno == ENOENT || errno == ENOTDIR) { diff --git a/udev/udev-event.c b/udev/udev-event.c index 1be3f74ea3..bcd0a8f13d 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -677,7 +677,7 @@ int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); - if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask) != 0) { + if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask, true) != 0) { if (udev_list_entry_get_flags(list_entry)) err = -1; } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index b58ea8c680..8fc804a3c2 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -747,7 +747,7 @@ static int import_program_into_properties(struct udev_device *dev, const char *p char *line; envp = udev_device_get_properties_envp(dev); - if (util_run_program(udev, program, envp, result, sizeof(result), &reslen, NULL) != 0) + if (util_run_program(udev, program, envp, result, sizeof(result), &reslen, NULL, false) != 0) return -1; line = result; @@ -2255,7 +2255,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event program, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL, NULL) != 0) { + if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL, NULL, false) != 0) { if (cur->key.op != OP_NOMATCH) goto nomatch; } else { -- cgit v1.2.3-54-g00ecf From bf0323a34fa038fd3ff6b0ff34c0dbfb812de4bf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 12 May 2010 08:49:43 +0200 Subject: configure.ac: version bump --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index d4e8477cfb..1778d56b40 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +udev 155 +======== + udev 154 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 4fe8c3cad4..816769f111 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [154], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [155], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 12d73e9587a8d9a3ab6415183e4e6762315aa85a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 May 2010 14:49:20 +0200 Subject: rules: SUSE - delete device-mapper rules --- rules/suse/64-device-mapper.rules | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 rules/suse/64-device-mapper.rules diff --git a/rules/suse/64-device-mapper.rules b/rules/suse/64-device-mapper.rules deleted file mode 100644 index 12cae35da8..0000000000 --- a/rules/suse/64-device-mapper.rules +++ /dev/null @@ -1,22 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL!="dm-*", GOTO="device_mapper_end" -ACTION=="remove", GOTO="device_mapper_end" - -IMPORT{program}="/sbin/dmsetup export -j%M -m%m" -ENV{DM_NAME}!="?*", GOTO="device_mapper_end" - -SYMLINK+="disk/by-id/dm-name-$env{DM_NAME}", OPTIONS+="string_escape=replace" -ENV{DM_UUID}=="?*", SYMLINK+="disk/by-id/dm-uuid-$env{DM_UUID}", OPTIONS+="string_escape=replace" - -ENV{DM_STATE}=="SUSPENDED", GOTO="device_mapper_end" -ENV{DM_TARGET_TYPES}=="|*error*", GOTO="device_mapper_end" - -IMPORT{program}="/sbin/blkid -o udev -p $tempnode" -OPTIONS+="link_priority=-100" -OPTIONS+="watch" -ENV{DM_TARGET_TYPES}=="*snapshot-origin*", OPTIONS+="link_priority=-90" -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -LABEL="device_mapper_end" -- cgit v1.2.3-54-g00ecf From 0c5c48040ac0f4c97f73fb3ac5493cc2d84a963b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 14 May 2010 14:52:18 +0200 Subject: libudev: add O_CLOEXEC --- Makefile.am | 2 +- libudev/libudev-device.c | 6 +++--- libudev/libudev-queue.c | 4 ++-- libudev/libudev.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 8d13f19382..09cb560111 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ CLEANFILES = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=8 -LIBUDEV_REVISION=0 +LIBUDEV_REVISION=1 LIBUDEV_AGE=8 SUBDIRS += libudev/docs diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 7e6b7f1ce7..5811490a34 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -279,7 +279,7 @@ int udev_device_read_db(struct udev_device *udev_device) return 0; } - f = fopen(filename, "r"); + f = fopen(filename, "re"); if (f == NULL) { dbg(udev_device->udev, "error reading db file %s: %m\n", filename); return -1; @@ -339,7 +339,7 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) return 0; util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL); - f = fopen(filename, "r"); + f = fopen(filename, "re"); if (f == NULL) return -1; udev_device->uevent_loaded = true; @@ -1164,7 +1164,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const goto out; /* read attribute value */ - fd = open(path, O_RDONLY); + fd = open(path, O_RDONLY|O_CLOEXEC); if (fd < 0) { dbg(udev_device->udev, "attribute '%s' can not be opened\n", path); goto out; diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index 5a4a3dc095..f3cb5ab498 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -131,7 +131,7 @@ unsigned long long int udev_get_kernel_seqnum(struct udev *udev) ssize_t len; util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); - fd = open(filename, O_RDONLY); + fd = open(filename, O_RDONLY|O_CLOEXEC); if (fd < 0) return 0; len = read(fd, buf, sizeof(buf)); @@ -215,7 +215,7 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i FILE *queue_file; util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/queue.bin", NULL); - queue_file = fopen(filename, "r"); + queue_file = fopen(filename, "re"); if (queue_file == NULL) return NULL; diff --git a/libudev/libudev.c b/libudev/libudev.c index 0ae5a9115a..cd418709f0 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -146,7 +146,7 @@ struct udev *udev_new(void) } if (config_file == NULL) goto err; - f = fopen(config_file, "r"); + f = fopen(config_file, "re"); if (f != NULL) { char line[UTIL_LINE_SIZE]; int line_nr = 0; -- cgit v1.2.3-54-g00ecf From c1332ae89866f243f4817dc4d3bdd7f11d3f9a9a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 May 2010 06:24:45 +0200 Subject: use default mode of 0600 for nodes if gid == 0 --- udev/udev-event.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index bcd0a8f13d..ad6db83aea 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -41,7 +41,6 @@ struct udev_event *udev_event_new(struct udev_device *dev) event->dev = dev; event->udev = udev_device_get_udev(dev); udev_list_init(&event->run_list); - event->mode = 0660; dbg(event->udev, "allocated event %p\n", event); return event; } @@ -644,6 +643,12 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (event->dev_db != NULL) udev_node_update_old_links(dev, event->dev_db); + if (event->mode == 0) { + if (event->gid > 0) + event->mode = 0660; + else + event->mode = 0600; + } err = udev_node_add(dev, event->mode, event->uid, event->gid); } -- cgit v1.2.3-54-g00ecf From cb9a0eeeab56c402dbbab79f3c1be985139ccfd9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 May 2010 09:04:26 +0200 Subject: udevd: create standard symlinks and handle /lib/udev/devices --- libudev/libudev-private.h | 3 + libudev/libudev-selinux-private.c | 28 ++++++- udev/udevd.c | 149 ++++++++++++++++++++++++++++++++------ 3 files changed, 156 insertions(+), 24 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 3758c5b1b4..fa9722360b 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -227,12 +227,15 @@ static inline void udev_selinux_init(struct udev *udev) {} static inline void udev_selinux_exit(struct udev *udev) {} static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} +static inline void udev_selinux_setfscreateconat(struct udev *udev, int dirfd, const char *file, unsigned int mode) {} static inline void udev_selinux_resetfscreatecon(struct udev *udev) {} #else void udev_selinux_init(struct udev *udev); void udev_selinux_exit(struct udev *udev); void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); +void udev_selinux_setfscreateconat(struct udev *udev, int dirfd, const char *file, unsigned int mode); void udev_selinux_resetfscreatecon(struct udev *udev); #endif + #endif diff --git a/libudev/libudev-selinux-private.c b/libudev/libudev-selinux-private.c index 84f8b6a63f..2d4463d864 100644 --- a/libudev/libudev-selinux-private.c +++ b/libudev/libudev-selinux-private.c @@ -53,7 +53,7 @@ void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int if (matchpathcon(file, mode, &scontext) < 0) { err(udev, "matchpathcon(%s) failed\n", file); return; - } + } if (lsetfilecon(file, scontext) < 0) err(udev, "setfilecon %s failed: %m\n", file); freecon(scontext); @@ -65,6 +65,7 @@ void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned i if (!selinux_enabled) return; + if (matchpathcon(file, mode, &scontext) < 0) { err(udev, "matchpathcon(%s) failed\n", file); return; @@ -81,3 +82,28 @@ void udev_selinux_resetfscreatecon(struct udev *udev) if (setfscreatecon(selinux_prev_scontext) < 0) err(udev, "setfscreatecon failed: %m\n"); } + +void udev_selinux_setfscreateconat(struct udev *udev, int dirfd, const char *file, unsigned int mode) +{ + char filename[UTIL_PATH_SIZE]; + + if (!selinux_enabled) + return; + + /* resolve relative filename */ + if (file[0] != '/') { + char procfd[UTIL_PATH_SIZE]; + char target[UTIL_PATH_SIZE]; + ssize_t len; + + snprintf(procfd, sizeof(procfd), "/proc/%u/fd/%u", getpid(), dirfd); + len = readlink(procfd, target, sizeof(target)); + if (len <= 0 || len == sizeof(target)) + return; + target[len] = '\0'; + + util_strscpyl(filename, sizeof(filename), target, "/", file, NULL); + file = filename; + } + udev_selinux_setfscreatecon(udev, file, mode); +} diff --git a/udev/udevd.c b/udev/udevd.c index 77a14df7b0..1bde8f4a74 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -449,29 +449,6 @@ static void worker_kill(struct udev *udev, int retain) } } -static int mem_size_mb(void) -{ - FILE *f; - char buf[4096]; - long int memsize = -1; - - f = fopen("/proc/meminfo", "r"); - if (f == NULL) - return -1; - - while (fgets(buf, sizeof(buf), f) != NULL) { - long int value; - - if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { - memsize = value / 1024; - break; - } - } - - fclose(f); - return memsize; -} - /* lookup event for identical, parent, child device */ static bool is_devpath_busy(struct event *event) { @@ -768,6 +745,130 @@ static void handle_signal(struct udev *udev, int signo) } } +static int copy_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) +{ + struct dirent *dent; + + for (dent = readdir(dir_from); dent != NULL; dent = readdir(dir_from)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + if (fstatat(dirfd(dir_from), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) + continue; + + if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { + udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, stats.st_mode & 0777); + if (mknodat(dirfd(dir_to), dent->d_name, stats.st_mode, stats.st_rdev) == 0) { + fchmodat(dirfd(dir_to), dent->d_name, stats.st_mode & 0777, 0); + fchownat(dirfd(dir_to), dent->d_name, stats.st_uid, stats.st_gid, 0); + } else { + utimensat(dirfd(dir_to), dent->d_name, NULL, 0); + } + udev_selinux_resetfscreatecon(udev); + } else if (S_ISLNK(stats.st_mode)) { + char target[UTIL_PATH_SIZE]; + ssize_t len; + + len = readlinkat(dirfd(dir_from), dent->d_name, target, sizeof(target)); + if (len <= 0 || len == (ssize_t)sizeof(target)) + continue; + target[len] = '\0'; + udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFLNK); + if (symlinkat(target, dirfd(dir_to), dent->d_name) < 0 && errno == EEXIST) + utimensat(dirfd(dir_to), dent->d_name, NULL, AT_SYMLINK_NOFOLLOW); + udev_selinux_resetfscreatecon(udev); + } else if (S_ISDIR(stats.st_mode)) { + DIR *dir2_from, *dir2_to; + + if (maxdepth == 0) + continue; + + udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFDIR|0755); + mkdirat(dirfd(dir_to), dent->d_name, 0755); + udev_selinux_resetfscreatecon(udev); + + dir2_to = fdopendir(openat(dirfd(dir_to), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2_to == NULL) + continue; + + dir2_from = fdopendir(openat(dirfd(dir_from), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2_from == NULL) { + closedir(dir2_to); + continue; + } + + copy_dir(udev, dir2_from, dir2_to, maxdepth-1); + + closedir(dir2_to); + closedir(dir2_from); + } + } + + return 0; +} + +static void prepare_dev(struct udev *udev) +{ + struct stdlinks { + const char *link; + const char *target; + }; + static const struct stdlinks stdlinks[] = { + { "core", "/proc/kcore" }, + { "fd", "/proc/fd" }, + { "stdin", "/proc/self/fd/0" }, + { "stdout", "/proc/self/fd/1" }, + { "stderr", "/proc/self/fd/2" }, + }; + unsigned int i; + DIR *dir_from, *dir_to; + + dir_to = opendir(udev_get_dev_path(udev)); + if (dir_to == NULL) + return; + + /* create standard symlinks to /proc */ + for (i = 0; i < ARRAY_SIZE(stdlinks); i++) { + udev_selinux_setfscreateconat(udev, dirfd(dir_to), stdlinks[i].link, S_IFLNK); + if (symlinkat(stdlinks[i].target, dirfd(dir_to), stdlinks[i].link) < 0 && errno == EEXIST) + utimensat(dirfd(dir_to), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); + udev_selinux_resetfscreatecon(udev); + } + + /* copy content from /lib/udev/devices to /dev */ + dir_from = opendir(LIBEXECDIR "/devices"); + if (dir_from != NULL) { + copy_dir(udev, dir_from, dir_to, 8); + closedir(dir_from); + } + + closedir(dir_to); +} + +static int mem_size_mb(void) +{ + FILE *f; + char buf[4096]; + long int memsize = -1; + + f = fopen("/proc/meminfo", "r"); + if (f == NULL) + return -1; + + while (fgets(buf, sizeof(buf), f) != NULL) { + long int value; + + if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { + memsize = value / 1024; + break; + } + } + + fclose(f); + return memsize; +} + int main(int argc, char *argv[]) { struct udev *udev; @@ -858,6 +959,8 @@ int main(int argc, char *argv[]) if (write(STDERR_FILENO, 0, 0) < 0) dup2(fd, STDERR_FILENO); + prepare_dev(udev); + /* init control socket, bind() ensures, that only one udevd instance is running */ udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); if (udev_ctrl == NULL) { -- cgit v1.2.3-54-g00ecf From 41c69b0ff0471a04ba0dcb9829ced2ffa0c43cb5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 May 2010 09:19:01 +0200 Subject: update NEWS README --- NEWS | 6 ++++++ README | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 1778d56b40..8b506952f3 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,11 @@ udev 155 ======== +Bugfixes. + +Now, on startup, udevd itself copies the content of /lib/udev/devices +to /dev. Also the standard symlinks like /dev/std{in,out,err}, /dev/core, +/dev/fd are created. + udev 154 ======== diff --git a/README b/README index 2b5fc37d81..78787469cc 100644 --- a/README +++ b/README @@ -62,11 +62,6 @@ Setup: works on an empty 'tmpfs' filesystem, but some static device nodes like /dev/null, /dev/console, /dev/kmsg are needed to be able to start udev itself. - - The content of /lib/udev/devices directory which contains static content like - symlinks and directories, which are always expected to be in /dev, should - be copied over to the mounted /dev directory: - cp -axT --remove-destination /lib/udev/devices /dev - - The udev daemon should be started to handle device events sent by the kernel. During bootup, the kernel can be asked to send events for all already existing devices, to apply the configuration to these devices. This is usually done by: -- cgit v1.2.3-54-g00ecf From f2291cd07f24d2e1b7c3295ea6570f64b935ba55 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 May 2010 14:51:18 +0200 Subject: fix tests and allow MODE=000 --- test/udev-test.pl | 10 +++++----- udev/udev-event.c | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/test/udev-test.pl b/test/udev-test.pl index 24e62b4d66..6a0ea826fc 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -610,7 +610,7 @@ EOF subsys => "tty", devpath => "/devices/virtual/tty/tty33", exp_name => "tty33", - exp_perms => "0:0:0660", + exp_perms => "0:0:0600", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", - exp_perms => "5000::0660", + exp_perms => "5000::0600", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", - exp_perms => "nobody::0660", + exp_perms => "nobody::0600", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", - exp_perms => "0:0:0660", + exp_perms => "0:0:0600", exp_rem_error => "yes", rules => < "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda-8741C4G-end", - exp_perms => "0:0:0660", + exp_perms => "0:0:0600", rules => <mode = 0600; event->dev = dev; event->udev = udev_device_get_udev(dev); udev_list_init(&event->run_list); @@ -643,12 +644,10 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (event->dev_db != NULL) udev_node_update_old_links(dev, event->dev_db); - if (event->mode == 0) { - if (event->gid > 0) - event->mode = 0660; - else - event->mode = 0600; - } + /* change default 0600 to 0660 if a group is assigned */ + if (event->mode == 0600 && event->gid > 0) + event->mode = 0660; + err = udev_node_add(dev, event->mode, event->uid, event->gid); } -- cgit v1.2.3-54-g00ecf From 761dfddcc027d0a4be881d779cc2f62edafbb2eb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 May 2010 17:09:04 +0200 Subject: create static nodes provided by kernel modules to allow module autoloading --- rules/rules.d/50-udev-default.rules | 8 +- udev/udev-node.c | 25 +++---- udev/udev-rules.c | 141 +++++++++++++++++++++++++++++------- udev/udev.h | 15 ++-- udev/udevd.c | 115 ++++++++++++++++++++++++----- 5 files changed, 232 insertions(+), 72 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 7e09ea19bb..d4da4b14a2 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -8,12 +8,10 @@ KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" KERNEL=="ptmx", GROUP="tty", MODE="0666" KERNEL=="tty", GROUP="tty", MODE="0666" KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" -KERNEL=="console", MODE="0600" KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty" # serial KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout" -KERNEL=="ppp", MODE="0600" KERNEL=="mwave", GROUP="dialout" KERNEL=="hvc*|hvsi*", GROUP="dialout" @@ -36,7 +34,7 @@ KERNEL=="vtx*|vbi*", GROUP="video" KERNEL=="winradio*", GROUP="video" # graphics -KERNEL=="agpgart", MODE="0600", GROUP="video" +KERNEL=="agpgart", GROUP="video" KERNEL=="pmu", GROUP="video" KERNEL=="nvidia*|nvidiactl*", GROUP="video" SUBSYSTEM=="graphics", GROUP="video" @@ -100,14 +98,14 @@ SUBSYSTEM=="aoe", GROUP="disk", MODE="0220" SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" # network -KERNEL=="tun", MODE="0666" +KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" KERNEL=="rfkill", MODE="0644" # CPU KERNEL=="cpu[0-9]*", MODE="0444" # miscellaneous -KERNEL=="fuse", MODE="0666" +KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse" SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" diff --git a/udev/udev-node.c b/udev/udev-node.c index d55700d70f..8339eb732f 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -72,22 +72,22 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ err = mknod(file_tmp, mode, devnum); udev_selinux_resetfscreatecon(udev); if (err != 0) { - err(udev, "mknod(%s, %#o, %u, %u) failed: %m\n", - file_tmp, mode, major(devnum), minor(devnum)); + err(udev, "mknod '%s' %u:%u %#o failed: %m\n", + file_tmp, major(devnum), minor(devnum), mode); goto exit; } err = rename(file_tmp, file); if (err != 0) { - err(udev, "rename(%s, %s) failed: %m\n", file_tmp, file); + err(udev, "rename '%s' '%s' failed: %m\n", file_tmp, file); unlink(file_tmp); goto exit; } - info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); + info(udev, "set permissions '%s' %#o uid=%u gid=%u\n", file, mode, uid, gid); chmod(file, mode); chown(file, uid, gid); } } else { - info(udev, "mknod(%s, %#o, (%u,%u))\n", file, mode, major(devnum), minor(devnum)); + info(udev, "mknod '%s' %u:%u %#o\n", file, major(devnum), minor(devnum), mode); do { err = util_create_path(udev, file); if (err != 0 && err != -ENOENT) @@ -99,8 +99,8 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ udev_selinux_resetfscreatecon(udev); } while (err == -ENOENT); if (err != 0) - err(udev, "mknod(%s, %#o, (%u,%u) failed: %m\n", file, mode, major(devnum), minor(devnum)); - info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); + err(udev, "mknod '%s' %u:%u %#o' failed: %m\n", file, major(devnum), minor(devnum), mode); + info(udev, "set permissions '%s' %#o uid=%u gid=%u\n", file, mode, uid, gid); chmod(file, mode); chown(file, uid, gid); } @@ -204,12 +204,12 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) udev_selinux_resetfscreatecon(udev); } while (err == -ENOENT); if (err != 0) { - err(udev, "symlink(%s, %s) failed: %m\n", target, slink_tmp); + err(udev, "symlink '%s' '%s' failed: %m\n", target, slink_tmp); goto exit; } err = rename(slink_tmp, slink); if (err != 0) { - err(udev, "rename(%s, %s) failed: %m\n", slink_tmp, slink); + err(udev, "rename '%s' '%s' failed: %m\n", slink_tmp, slink); unlink(slink_tmp); } exit: @@ -396,7 +396,6 @@ int udev_node_remove(struct udev_device *dev) const char *devnode; struct stat stats; struct udev_device *dev_check; - char filename[UTIL_PATH_SIZE]; int err = 0; /* remove/update symlinks, remove symlinks from name index */ @@ -426,12 +425,6 @@ int udev_node_remove(struct udev_device *dev) goto out; } - util_strscpyl(filename, sizeof(filename), LIBEXECDIR "/devices", &devnode[strlen(udev_get_dev_path(udev))], NULL); - if (stat(filename, &stats) == 0 && stats.st_rdev == udev_device_get_devnum(dev)) { - info(udev, "static device entry found '%s', skip removal\n", devnode); - goto out; - } - info(udev, "removing device node '%s'\n", devnode); err = util_unlink_secure(udev, devnode); util_delete_path(udev, devnode); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 8fc804a3c2..5dcd760c55 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -157,6 +157,7 @@ enum token_type { TK_A_OWNER_ID, /* uid_t */ TK_A_GROUP_ID, /* gid_t */ TK_A_MODE_ID, /* mode_t */ + TK_A_STATIC_NODE, /* val */ TK_A_ENV, /* val, attr */ TK_A_TAG, /* val */ TK_A_NAME, /* val */ @@ -172,10 +173,12 @@ enum token_type { /* we try to pack stuff in a way that we take only 12 bytes per token */ struct token { union { - unsigned char type; /* same as in rule and key */ + unsigned char type; /* same in rule and key */ struct { enum token_type type:8; - unsigned int flags:8; + bool can_set_name:1; + bool has_static_node:1; + unsigned int unused:6; unsigned short token_count; unsigned int label_off; unsigned short filename_off; @@ -286,6 +289,7 @@ static const char *token_str(enum token_type type) [TK_A_MODE] = "A MODE", [TK_A_OWNER_ID] = "A OWNER_ID", [TK_A_GROUP_ID] = "A GROUP_ID", + [TK_A_STATIC_NODE] = "A STATIC_NODE", [TK_A_MODE_ID] = "A MODE_ID", [TK_A_ENV] = "A ENV", [TK_A_TAG] = "A ENV", @@ -374,7 +378,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "%s %u\n", token_str(type), token->key.watch); break; case TK_A_DEVLINK_PRIO: - dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.devlink_prio); + dbg(rules->udev, "%s %u\n", token_str(type), token->key.devlink_prio); break; case TK_A_OWNER_ID: dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.uid); @@ -385,8 +389,11 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_MODE_ID: dbg(rules->udev, "%s %s %#o\n", token_str(type), operation_str(op), token->key.mode); break; + case TK_A_STATIC_NODE: + dbg(rules->udev, "%s '%s'\n", token_str(type), value); + break; case TK_A_EVENT_TIMEOUT: - dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.event_timeout); + dbg(rules->udev, "%s %u\n", token_str(type), token->key.event_timeout); break; case TK_A_GOTO: dbg(rules->udev, "%s '%s' %u\n", token_str(type), value, token->key.rule_goto); @@ -834,7 +841,7 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) static int attr_subst_subdir(char *attr, size_t len) { - int found = 0; + bool found = false; if (strstr(attr, "/*/")) { char *pos; @@ -859,7 +866,7 @@ static int attr_subst_subdir(char *attr, size_t len) continue; util_strscpyl(attr, len, dirname, "/", dent->d_name, tail, NULL); if (stat(attr, &stats) == 0) { - found = 1; + found = true; break; } } @@ -1053,6 +1060,9 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_MODE_ID: token->key.mode = *(mode_t *)data; break; + case TK_A_STATIC_NODE: + token->key.value_off = add_string(rule_tmp->rules, value); + break; case TK_A_EVENT_TIMEOUT: token->key.event_timeout = *(int *)data; break; @@ -1480,7 +1490,7 @@ static int add_rule(struct udev_rules *rules, char *line, } rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); } - rule_tmp.rule.rule.flags = 1; + rule_tmp.rule.rule.can_set_name = true; continue; } @@ -1495,7 +1505,7 @@ static int add_rule(struct udev_rules *rules, char *line, flag = 1; rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, &flag); } - rule_tmp.rule.rule.flags = 1; + rule_tmp.rule.rule.can_set_name = true; continue; } @@ -1512,7 +1522,7 @@ static int add_rule(struct udev_rules *rules, char *line, } else if (rules->resolve_names >= 0) { rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL); } - rule_tmp.rule.rule.flags = 1; + rule_tmp.rule.rule.can_set_name = true; continue; } @@ -1529,7 +1539,7 @@ static int add_rule(struct udev_rules *rules, char *line, } else if (rules->resolve_names >= 0) { rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL); } - rule_tmp.rule.rule.flags = 1; + rule_tmp.rule.rule.can_set_name = true; continue; } @@ -1542,7 +1552,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_MODE_ID, op, NULL, &mode); else rule_add_key(&rule_tmp, TK_A_MODE, op, value, NULL); - rule_tmp.rule.rule.flags = 1; + rule_tmp.rule.rule.can_set_name = true; continue; } @@ -1586,6 +1596,11 @@ static int add_rule(struct udev_rules *rules, char *line, dbg(rules->udev, "inotify watch of device requested\n"); } } + pos = strstr(value, "static_node="); + if (pos != NULL) { + rule_add_key(&rule_tmp, TK_A_STATIC_NODE, 0, &pos[strlen("static_node=")], NULL); + rule_tmp.rule.rule.has_static_node = true; + } continue; } err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); @@ -1907,7 +1922,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * { char *key_value = &rules->buf[token->key.value_off]; char *pos; - int match = 0; + bool match = false; if (val == NULL) val = ""; @@ -2056,14 +2071,14 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* loop through token list, match, run actions or forward to next rule */ cur = &rules->tokens[0]; rule = cur; - while (1) { + for (;;) { dump_token(rules, cur); switch (cur->type) { case TK_RULE: /* current rule */ rule = cur; /* possibly skip rules which want to set NAME, SYMLINK, OWNER, GROUP, MODE */ - if (!can_set_name && rule->rule.flags) + if (!can_set_name && rule->rule.can_set_name) goto nomatch; esc = ESCAPE_UNSET; break; @@ -2083,14 +2098,14 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event { size_t devlen = strlen(udev_get_dev_path(event->udev))+1; struct udev_list_entry *list_entry; - int match = 0; + bool match = false; udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { const char *devlink; devlink = &udev_list_entry_get_name(list_entry)[devlen]; if (match_key(rules, cur, devlink) == 0) { - match = 1; + match = true; break; } } @@ -2348,7 +2363,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->owner_final) break; if (cur->key.op == OP_ASSIGN_FINAL) - event->owner_final = 1; + event->owner_final = true; udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); event->uid = util_lookup_user(event->udev, owner); info(event->udev, "OWNER %u %s:%u\n", @@ -2364,7 +2379,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->group_final) break; if (cur->key.op == OP_ASSIGN_FINAL) - event->group_final = 1; + event->group_final = true; udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); event->gid = util_lookup_group(event->udev, group); info(event->udev, "GROUP %u %s:%u\n", @@ -2381,12 +2396,12 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->mode_final) break; if (cur->key.op == OP_ASSIGN_FINAL) - event->mode_final = 1; + event->mode_final = true; udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode, sizeof(mode)); event->mode = strtol(mode, &endptr, 8); if (endptr[0] != '\0') { - err(event->udev, "invalide mode '%s' set default mode 0660\n", mode); - event->mode = 0660; + err(event->udev, "invalide mode '%s' set default mode 0600\n", mode); + event->mode = 0600; } info(event->udev, "MODE %#o %s:%u\n", event->mode, @@ -2398,7 +2413,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->owner_final) break; if (cur->key.op == OP_ASSIGN_FINAL) - event->owner_final = 1; + event->owner_final = true; event->uid = cur->key.uid; info(event->udev, "OWNER %u %s:%u\n", event->uid, @@ -2409,7 +2424,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->group_final) break; if (cur->key.op == OP_ASSIGN_FINAL) - event->group_final = 1; + event->group_final = true; event->gid = cur->key.gid; info(event->udev, "GROUP %u %s:%u\n", event->gid, @@ -2420,13 +2435,15 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->mode_final) break; if (cur->key.op == OP_ASSIGN_FINAL) - event->mode_final = 1; + event->mode_final = true; event->mode = cur->key.mode; info(event->udev, "MODE %#o %s:%u\n", event->mode, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); break; + case TK_A_STATIC_NODE: + break; case TK_A_ENV: { const char *name = &rules->buf[cur->key.attr_off]; @@ -2460,7 +2477,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (event->name_final) break; if (cur->key.op == OP_ASSIGN_FINAL) - event->name_final = 1; + event->name_final = true; udev_event_apply_format(event, name, name_str, sizeof(name_str)); if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { count = udev_util_replace_chars(name_str, "/"); @@ -2487,7 +2504,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (major(udev_device_get_devnum(event->dev)) == 0) break; if (cur->key.op == OP_ASSIGN_FINAL) - event->devlink_final = 1; + event->devlink_final = true; if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) udev_device_cleanup_devlinks_list(event->dev); @@ -2592,3 +2609,75 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event (unsigned int) (cur - rules->tokens)); } } + +void udev_rules_apply_static_dev_perms(struct udev_rules *rules) +{ + struct token *cur; + struct token *rule; + uid_t uid = 0; + gid_t gid = 0; + mode_t mode = 0; + + if (rules->tokens == NULL) + return; + + cur = &rules->tokens[0]; + rule = cur; + for (;;) { + switch (cur->type) { + case TK_RULE: + /* current rule */ + rule = cur; + + /* skip rules without a static_node tag */ + if (!rule->rule.has_static_node) + goto next; + + uid = 0; + gid = 0; + mode = 0; + break; + case TK_A_OWNER_ID: + uid = cur->key.uid; + break; + case TK_A_GROUP_ID: + gid = cur->key.gid; + break; + case TK_A_MODE_ID: + mode = cur->key.mode; + break; + case TK_A_STATIC_NODE: { + char filename[UTIL_PATH_SIZE]; + struct stat stats; + /* we assure, that the permissions tokens are sorted before the static token */ + if (mode == 0 && uid == 0 && gid == 0) + goto next; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(rules->udev), "/", + &rules->buf[cur->key.value_off], NULL); + if (stat(filename, &stats) != 0) + goto next; + if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) + goto next; + if (mode != 0 && mode != (stats.st_mode & 0777)) { + chmod(filename, mode); + info(rules->udev, "chmod '%s' %#o\n", filename, mode); + } + if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) { + chown(filename, uid, gid); + info(rules->udev, "chown '%s' %u %u\n", filename, uid, gid); + } + utimensat(AT_FDCWD, filename, NULL, 0); + break; + } + case TK_END: + return; + } + + cur++; + continue; +next: + /* fast-forward to next rule */ + cur = rule + rule->rule.token_count; + continue; + } +} diff --git a/udev/udev.h b/udev/udev.h index b1b65c5617..4150c16af7 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -43,13 +43,13 @@ struct udev_event { uid_t uid; gid_t gid; struct udev_list_node run_list; - unsigned int group_final:1; - unsigned int owner_final:1; - unsigned int mode_final:1; - unsigned int name_final:1; - unsigned int devlink_final:1; - unsigned int run_final:1; - unsigned int inotify_watch:1; + bool group_final; + bool owner_final; + bool mode_final; + bool name_final; + bool devlink_final; + bool run_final; + bool inotify_watch; }; struct udev_watch { @@ -63,6 +63,7 @@ struct udev_rules; struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); void udev_rules_unref(struct udev_rules *rules); int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event); +void udev_rules_apply_static_dev_perms(struct udev_rules *rules); /* udev-event.c */ struct udev_event *udev_event_new(struct udev_device *dev); diff --git a/udev/udevd.c b/udev/udevd.c index 1bde8f4a74..ab24885309 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -41,6 +41,7 @@ #include #include #include +#include #include "udev.h" @@ -745,6 +746,72 @@ static void handle_signal(struct udev *udev, int signo) } } +static void static_dev_create_from_modules(struct udev *udev) +{ + struct utsname kernel; + char modules[UTIL_PATH_SIZE]; + char buf[4096]; + FILE *f; + + uname(&kernel); + util_strscpyl(modules, sizeof(modules), "/lib/modules/", kernel.release, "/modules.devname", NULL); + f = fopen(modules, "r"); + if (f == NULL) + return; + + while (fgets(buf, sizeof(buf), f) != NULL) { + char *s; + const char *modname; + const char *devname; + const char *devno; + int maj, min; + char type; + mode_t mode; + char filename[UTIL_PATH_SIZE]; + + if (buf[0] == '#') + continue; + + modname = buf; + s = strchr(modname, ' '); + if (s == NULL) + continue; + s[0] = '\0'; + + devname = &s[1]; + s = strchr(devname, ' '); + if (s == NULL) + continue; + s[0] = '\0'; + + devno = &s[1]; + s = strchr(devno, ' '); + if (s == NULL) + s = strchr(devno, '\n'); + if (s != NULL) + s[0] = '\0'; + if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3) + continue; + + if (type == 'c') + mode = 0600 | S_IFCHR; + else if (type == 'b') + mode = 0600 | S_IFBLK; + else + continue; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/", devname, NULL); + util_create_path(udev, filename); + udev_selinux_setfscreatecon(udev, filename, mode); + info(udev, "mknod '%s' %c%u:%u\n", filename, type, maj, min); + if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST) + utimensat(AT_FDCWD, filename, NULL, 0); + udev_selinux_resetfscreatecon(udev); + } + + fclose(f); +} + static int copy_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) { struct dirent *dent; @@ -808,7 +875,7 @@ static int copy_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) return 0; } -static void prepare_dev(struct udev *udev) +static void static_dev_create_links(struct udev *udev, DIR *dir) { struct stdlinks { const char *link; @@ -822,28 +889,38 @@ static void prepare_dev(struct udev *udev) { "stderr", "/proc/self/fd/2" }, }; unsigned int i; - DIR *dir_from, *dir_to; - dir_to = opendir(udev_get_dev_path(udev)); - if (dir_to == NULL) - return; - - /* create standard symlinks to /proc */ for (i = 0; i < ARRAY_SIZE(stdlinks); i++) { - udev_selinux_setfscreateconat(udev, dirfd(dir_to), stdlinks[i].link, S_IFLNK); - if (symlinkat(stdlinks[i].target, dirfd(dir_to), stdlinks[i].link) < 0 && errno == EEXIST) - utimensat(dirfd(dir_to), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); + udev_selinux_setfscreateconat(udev, dirfd(dir), stdlinks[i].link, S_IFLNK); + if (symlinkat(stdlinks[i].target, dirfd(dir), stdlinks[i].link) < 0 && errno == EEXIST) + utimensat(dirfd(dir), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); udev_selinux_resetfscreatecon(udev); } +} + +static void static_dev_create_from_devices(struct udev *udev, DIR *dir) +{ + DIR *dir_from; - /* copy content from /lib/udev/devices to /dev */ dir_from = opendir(LIBEXECDIR "/devices"); - if (dir_from != NULL) { - copy_dir(udev, dir_from, dir_to, 8); - closedir(dir_from); - } + if (dir_from == NULL) + return; + copy_dir(udev, dir_from, dir, 8); + closedir(dir_from); +} + +static void static_dev_create(struct udev *udev) +{ + DIR *dir; - closedir(dir_to); + dir = opendir(udev_get_dev_path(udev)); + if (dir == NULL) + return; + + static_dev_create_links(udev, dir); + static_dev_create_from_devices(udev, dir); + + closedir(dir); } static int mem_size_mb(void) @@ -959,8 +1036,6 @@ int main(int argc, char *argv[]) if (write(STDERR_FILENO, 0, 0) < 0) dup2(fd, STDERR_FILENO); - prepare_dev(udev); - /* init control socket, bind() ensures, that only one udevd instance is running */ udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); if (udev_ctrl == NULL) { @@ -1118,6 +1193,10 @@ int main(int argc, char *argv[]) max_childs = strtoul(value, NULL, 10); info(udev, "initialize max_childs to %u\n", max_childs); + static_dev_create(udev); + static_dev_create_from_modules(udev); + udev_rules_apply_static_dev_perms(rules); + udev_list_init(&event_list); udev_list_init(&worker_list); -- cgit v1.2.3-54-g00ecf From c2d5139bfc67e0604e91e49081568fe9e13bd365 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 May 2010 18:45:38 +0200 Subject: update NEWS --- NEWS | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 8b506952f3..97db7761e5 100644 --- a/NEWS +++ b/NEWS @@ -2,10 +2,18 @@ udev 155 ======== Bugfixes. -Now, on startup, udevd itself copies the content of /lib/udev/devices -to /dev. Also the standard symlinks like /dev/std{in,out,err}, /dev/core, -/dev/fd are created. - +Now the udev daemon itself, does on startup: + - copy the content of /lib/udev/devices to /dev + - create the standard symlinks like /dev/std{in,out,err}, + /dev/core, /dev/fd, ... + - use static node information provided by kernel modules + and creates these nodes to allow module on-demand loading + - possibly apply permissions to all ststic nodes from udev + rules which are annotated to match a static node + +The default mode for a device node is 0600 now to match the kernel +created devtmpfs defaults. If GROUP= is specified and no MODE= is +given the default will be 0660. udev 154 ======== -- cgit v1.2.3-54-g00ecf From 63749b1a5fc68a44024dc6a4299b04a1f5d437e8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 24 May 2010 17:00:15 +0200 Subject: man: directly use 'refentry' And make Lennart happy! :) --- Makefile.am | 2 +- udev/udev.xml | 1342 +++++++++++++++++++++++++++--------------------------- udev/udevadm.xml | 802 ++++++++++++++++---------------- udev/udevd.xml | 210 +++++---- 4 files changed, 1172 insertions(+), 1184 deletions(-) diff --git a/Makefile.am b/Makefile.am index 09cb560111..8406a6bc31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -156,7 +156,7 @@ EXTRA_DIST += \ udev/udevd.xml %.7 %.8 : %.xml - $(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< + $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< # ------------------------------------------------------------------------------ # udev tests diff --git a/udev/udev.xml b/udev/udev.xml index 678023c373..adf531b372 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -1,677 +1,673 @@ - + -
            -
            + + udev - - - udev - udev - - - - udev - 7 - - - - udev - Linux dynamic device management - - - DESCRIPTION - udev supplies the system software with device events, manages permissions - of device nodes and may create additional symlinks in the /dev - directory, or renames network interfaces. The kernel usually just assigns unpredictable - device names based on the order of discovery. Meaningful symlinks or network device - names provide a way to reliably identify devices based on their properties or - current configuration. - - The udev daemon udevd - 8 receives device uevents directly from - the kernel whenever a device is added or removed from the system, or it changes its - state. When udev receives a device event, it matches its configured set of rules - against various device attributes to identify the device. Rules that match, may - provide additional device information to be stored in the udev database, or information - to be used to create meaningful symlink names. - - All device information udev processes, is stored in the udev database and - sent out to possible event subscribers. Access to all stored data and the event - sources are provided by the library libudev. - - - CONFIGURATION - udev configuration files are placed in /etc/udev/ - and /lib/udev/. All empty lines, or lines beginning with - '#' will be ignored. - - Configuration file - udev expects its main configuration file at /etc/udev/udev.conf. - It consists of a set of variables allowing the user to override default udev values. - The following variables can be set: - - - - - Specifies where to place the device nodes in the filesystem. - The default value is /dev. - - - - - - - The logging priority. Valid values are the numerical syslog priorities - or their textual representations: , - and . - - - - - - Rules files - The udev rules are read from the files located in the - default rules directory /lib/udev/rules.d/, - the custom rules directory /etc/udev/rules.d/ - and the temporary rules directory /dev/.udev/rules.d/. - All rule files are sorted and processed in lexical order, regardless - in which of these directories they live. - - Rule files are required to have a unique name, duplicate file names - are ignored. Files in /etc/udev/rules.d/ have precedence - over files with the same name in /lib/udev/rules.d/. This - can be used to ignore a default rules file if needed. - - Every line in the rules file contains at least one key value pair. - There are two kind of keys, match and assignment keys. - If all match keys are matching against its value, the rule gets applied and the - assign keys get the specified value assigned. - - A matching rule may rename a network interface, add symlinks - pointing to the device node, or run a specified program as part of - the event handling. - - A rule consists of a list of one or more key value pairs separated by - a comma. Each key has a distinct operation, depending on the used operator. Valid - operators are: - - - - - Compare for equality. - - - - - - - Compare for inequality. - - - - - - - Assign a value to a key. Keys that represent a list, are reset - and only this single value is assigned. - - - - - - - Add the value to a key that holds a list of entries. - - - - - - - Assign a value to a key finally; disallow any later changes, - which may be used to prevent changes by any later rules. - - - - - The following key names can be used to match against device properties. - Some of the keys also match against properties of the parent devices in sysfs, - not only the device that has generated the event. If multiple keys that match - a parent device are specified in a single rule, all these keys must match at - one and the same parent device. - - - - - Match the name of the event action. - - - - - - - Match the devpath of the event device. - - - - - - - Match the name of the event device. - - - - - - - Match the name of the node or network interface. It can - be used once the NAME key has been set in one of the preceding - rules. - - - - - - - Match the name of a symlink targeting the node. It can - be used once a SYMLINK key has been set in one of the preceding - rules. There may be multiple symlinks; only one needs to match. - - - - - - - - Match the subsystem of the event device. - - - - - - Match the driver name of the event device. Only set for devices - which are bound to a driver at the time the event is generated. - - - - - - Match sysfs attribute values of the event device. Trailing - whitespace in the attribute values is ignored, if the specified match - value does not contain trailing whitespace itself. - - - - - - - - Search the devpath upwards for a matching device name. - - - - - - - Search the devpath upwards for a matching device subsystem name. - - - - - - - Search the devpath upwards for a matching device driver name. - - - - - - - Search the devpath upwards for a device with matching sysfs attribute values. - If multiple matches are specified, all of them - must match on the same device. Trailing whitespace in the attribute values is ignored, - if the specified match value does not contain trailing whitespace itself. - - - - - - - Match against a device property value. - - - - - - - Match against a device tag. - - - - - - - Test the existence of a file. An octal mode mask can be specified - if needed. - - - - - - - Execute a program. The key is true, if the program returns - successfully. The device properties are made available to the - executed program in the environment. The program's output printed to - stdout, is available in the RESULT key. - - - - - - - Match the returned string of the last PROGRAM call. This key can - be used in the same or in any later rule after a PROGRAM call. - - - - - Most of the fields support a shell style pattern matching. The following - pattern characters are supported: - - - - - Matches zero, or any number of characters. - - - - - - Matches any single character. - - - - - - Matches any single character specified within the brackets. For - example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. - Ranges are also supported within this match with the '-' character. - For example, to match on the range of all digits, the pattern [0-9] would - be used. If the first character following the '[' is a '!', any characters - not enclosed are matched. - - - - - The following keys can get values assigned: - - - - - The name, a network interface should be renamed to. Or as - a temporary workaraound, the name a device node should be named. - Usually the kernel provides the defined node name, or even creates - and removes the node before udev even receives any event. Changing - the node name from the kernel's default creates inconsistencies - and is not supported. If the kernel and NAME specify different names, - an error will be logged. Udev is only expected to handle device node - permissions and to create additional symlinks, not to change - kernel-provided device node names. Instead of renaming a device node, - SYMLINK should be used. Symlink names must never conflict with - device node names, it will result in unpredictable behavior. - - - - - - - The name of a symlink targeting the node. Every matching rule will add - this value to the list of symlinks to be created. Multiple symlinks may be - specified by separating the names by the space character. In case multiple - devices claim the same name, the link will always point to the device with - the highest link_priority. If the current device goes away, the links will - be re-evaluated and the device with the next highest link_priority will own - the link. If no link_priority is specified, the order of the devices, and - which one of them will own the link, is undefined. Claiming the same name for - a symlink, which is or might be used for a device node, may result in - unexpected behavior and is not supported. - - - - - - - - The permissions for the device node. Every specified value overwrites - the compiled-in default value. - - - - - - - The value that should be written to a sysfs attribute of the - event device. - - - - - - - Set a device property value. Property names with a leading '.' - are not stored in the database or exported to external tool or events. - - - - - - - Attach a tag to a device. This is used to filter events for users - of libudev's monitor functionality, or to enumerate a group of tagged - devices. The implementation can only work efficiently if only a few - tags are attached to a device. It is only meant to be used in - contexts with specific device filter requirements, and not as a - general-purpose flag. Excessive use might result in inefficient event - handling. - - - - - - - Add a program to the list of programs to be executed for a specific - device. This can only be used for very short running tasks. Running an - event process for a long period of time may block all further events for - this or a dependent device. Long running tasks need to be immediately - detached from the event process itself. If the option - is - specified, and the executed program returns non-zero, the event will be - marked as failed for a possible later handling. - If no absolute path is given, the program is expected to live in - /lib/udev, otherwise the absolute path must be - specified. Program name and arguments are separated by spaces. Single quotes - can be used to specify arguments with spaces. - - - - - - - Named label where a GOTO can jump to. - - - - - - - Jumps to the next LABEL with a matching name - - - - - - - Import a set of variables as device properties, - depending on type: - - - - - Execute an external program specified as the assigned value and - import its output, which must be in environment key - format. Path specification, command/argument separation, - and quoting work like in . - - - - - - Import a text file specified as the assigned value, which must be in - environment key format. - - - - - - Import a single property specified as the assigned value from the - current device database. This works only if the database is already populated - by an earlier event. - - - - - - Import the stored keys from the parent device by reading - the database entry of the parent device. The value assigned to - is used as a filter of key names - to import (with the same shell-style pattern matching used for - comparisons). - - - - If no option is given, udev will choose between - and based on the executable bit of the file - permissions. - - - - - - - Wait for a file to become available or until a 10 - seconds timeout expires. - - - - - - - Rule and device options: - - - - - Specify the priority of the created symlinks. Devices with higher - priorities overwrite existing symlinks of other devices. The default is 0. - - - - - - Number of seconds an event will wait for operations to finish, before it - will terminate itself. - - - - - - Usually control and other possibly unsafe characters are replaced - in strings used for device naming. The mode of replacement can be specified - with this option. - - - - - - Watch the device node with inotify, when closed after being opened for - writing, a change uevent will be synthesised. - - - - - - - - The , , , - , , and - fields support simple printf-like string substitutions. The - format chars gets applied after all rules have been processed, right before the program - is executed. It allows the use of device properties set by earlier matching - rules. For all other fields, substitutions are applied while the individual rule is - being processed. The available substitutions are: - - - , - - The kernel name for this device. - - - - - , - - The kernel number for this device. For example, 'sda3' has - kernel number of '3' - - - - - , - - The devpath of the device. - - - - - , - - The name of the device matched while searching the devpath upwards for - , , and . - - - - - - - - The driver name of the device matched while searching the devpath upwards for - , , and . - - - - - - , - - The value of a sysfs attribute found at the device, where - all keys of the rule have matched. If the matching device does not have - such an attribute, follow the chain of parent devices and use the value - of the first attribute that matches. - If the attribute is a symlink, the last element of the symlink target is - returned as the value. - - - - - , - - A device property value. - - - - - , - - The kernel major number for the device. - - - - - , - - The kernel minor number for the device. - - - - - , - - The string returned by the external program requested with PROGRAM. - A single part of the string, separated by a space character may be selected - by specifying the part number as an attribute: . - If the number is followed by the '+' char this part plus all remaining parts - of the result string are substituted: - - - - - , - - The node name of the parent device. - - - - - - - The current name of the device node. If not changed by a rule, it is the - name of the kernel device. - - - - - - - The current list of symlinks, separated by a space character. The value is - only set if an earlier rule assigned a value, or during a remove events. - - - - - , - - The udev_root value. - - - - - , - - The sysfs mount point. - - - - - , - - The name of a created temporary device node to provide access to - the device from a external program before the real node is created. - - - - - - - The '%' character itself. - - - - - - - The '$' character itself. - - - - - - - AUTHOR - Written by Greg Kroah-Hartman greg@kroah.com and - Kay Sievers kay.sievers@vrfy.org. With much help from - Dan Stekloff and many others. - - - - SEE ALSO - - udevd8 - , - - udevadm8 - - - -
            -
            + udev + + + + udev + 7 + + + + udev + Linux dynamic device management + + + Description + udev supplies the system software with device events, manages permissions + of device nodes and may create additional symlinks in the /dev + directory, or renames network interfaces. The kernel usually just assigns unpredictable + device names based on the order of discovery. Meaningful symlinks or network device + names provide a way to reliably identify devices based on their properties or + current configuration. + + The udev daemon udevd + 8 receives device uevents directly from + the kernel whenever a device is added or removed from the system, or it changes its + state. When udev receives a device event, it matches its configured set of rules + against various device attributes to identify the device. Rules that match, may + provide additional device information to be stored in the udev database, or information + to be used to create meaningful symlink names. + + All device information udev processes, is stored in the udev database and + sent out to possible event subscribers. Access to all stored data and the event + sources are provided by the library libudev. + + + Configuration + udev configuration files are placed in /etc/udev/ + and /lib/udev/. All empty lines, or lines beginning with + '#' will be ignored. + + Configuration file + udev expects its main configuration file at /etc/udev/udev.conf. + It consists of a set of variables allowing the user to override default udev values. + The following variables can be set: + + + + + Specifies where to place the device nodes in the filesystem. + The default value is /dev. + + + + + + + The logging priority. Valid values are the numerical syslog priorities + or their textual representations: , + and . + + + + + + Rules files + The udev rules are read from the files located in the + default rules directory /lib/udev/rules.d/, + the custom rules directory /etc/udev/rules.d/ + and the temporary rules directory /dev/.udev/rules.d/. + All rule files are sorted and processed in lexical order, regardless + in which of these directories they live. + + Rule files are required to have a unique name, duplicate file names + are ignored. Files in /etc/udev/rules.d/ have precedence + over files with the same name in /lib/udev/rules.d/. This + can be used to ignore a default rules file if needed. + + Every line in the rules file contains at least one key value pair. + There are two kind of keys, match and assignment keys. + If all match keys are matching against its value, the rule gets applied and the + assign keys get the specified value assigned. + + A matching rule may rename a network interface, add symlinks + pointing to the device node, or run a specified program as part of + the event handling. + + A rule consists of a list of one or more key value pairs separated by + a comma. Each key has a distinct operation, depending on the used operator. Valid + operators are: + + + + + Compare for equality. + + + + + + + Compare for inequality. + + + + + + + Assign a value to a key. Keys that represent a list, are reset + and only this single value is assigned. + + + + + + + Add the value to a key that holds a list of entries. + + + + + + + Assign a value to a key finally; disallow any later changes, + which may be used to prevent changes by any later rules. + + + + + The following key names can be used to match against device properties. + Some of the keys also match against properties of the parent devices in sysfs, + not only the device that has generated the event. If multiple keys that match + a parent device are specified in a single rule, all these keys must match at + one and the same parent device. + + + + + Match the name of the event action. + + + + + + + Match the devpath of the event device. + + + + + + + Match the name of the event device. + + + + + + + Match the name of the node or network interface. It can + be used once the NAME key has been set in one of the preceding + rules. + + + + + + + Match the name of a symlink targeting the node. It can + be used once a SYMLINK key has been set in one of the preceding + rules. There may be multiple symlinks; only one needs to match. + + + + + + + + Match the subsystem of the event device. + + + + + + Match the driver name of the event device. Only set for devices + which are bound to a driver at the time the event is generated. + + + + + + Match sysfs attribute values of the event device. Trailing + whitespace in the attribute values is ignored, if the specified match + value does not contain trailing whitespace itself. + + + + + + + + Search the devpath upwards for a matching device name. + + + + + + + Search the devpath upwards for a matching device subsystem name. + + + + + + + Search the devpath upwards for a matching device driver name. + + + + + + + Search the devpath upwards for a device with matching sysfs attribute values. + If multiple matches are specified, all of them + must match on the same device. Trailing whitespace in the attribute values is ignored, + if the specified match value does not contain trailing whitespace itself. + + + + + + + Match against a device property value. + + + + + + + Match against a device tag. + + + + + + + Test the existence of a file. An octal mode mask can be specified + if needed. + + + + + + + Execute a program. The key is true, if the program returns + successfully. The device properties are made available to the + executed program in the environment. The program's output printed to + stdout, is available in the RESULT key. + + + + + + + Match the returned string of the last PROGRAM call. This key can + be used in the same or in any later rule after a PROGRAM call. + + + + + Most of the fields support a shell style pattern matching. The following + pattern characters are supported: + + + + + Matches zero, or any number of characters. + + + + + + Matches any single character. + + + + + + Matches any single character specified within the brackets. For + example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. + Ranges are also supported within this match with the '-' character. + For example, to match on the range of all digits, the pattern [0-9] would + be used. If the first character following the '[' is a '!', any characters + not enclosed are matched. + + + + + The following keys can get values assigned: + + + + + The name, a network interface should be renamed to. Or as + a temporary workaraound, the name a device node should be named. + Usually the kernel provides the defined node name, or even creates + and removes the node before udev even receives any event. Changing + the node name from the kernel's default creates inconsistencies + and is not supported. If the kernel and NAME specify different names, + an error will be logged. Udev is only expected to handle device node + permissions and to create additional symlinks, not to change + kernel-provided device node names. Instead of renaming a device node, + SYMLINK should be used. Symlink names must never conflict with + device node names, it will result in unpredictable behavior. + + + + + + + The name of a symlink targeting the node. Every matching rule will add + this value to the list of symlinks to be created. Multiple symlinks may be + specified by separating the names by the space character. In case multiple + devices claim the same name, the link will always point to the device with + the highest link_priority. If the current device goes away, the links will + be re-evaluated and the device with the next highest link_priority will own + the link. If no link_priority is specified, the order of the devices, and + which one of them will own the link, is undefined. Claiming the same name for + a symlink, which is or might be used for a device node, may result in + unexpected behavior and is not supported. + + + + + + + + The permissions for the device node. Every specified value overwrites + the compiled-in default value. + + + + + + + The value that should be written to a sysfs attribute of the + event device. + + + + + + + Set a device property value. Property names with a leading '.' + are not stored in the database or exported to external tool or events. + + + + + + + Attach a tag to a device. This is used to filter events for users + of libudev's monitor functionality, or to enumerate a group of tagged + devices. The implementation can only work efficiently if only a few + tags are attached to a device. It is only meant to be used in + contexts with specific device filter requirements, and not as a + general-purpose flag. Excessive use might result in inefficient event + handling. + + + + + + + Add a program to the list of programs to be executed for a specific + device. This can only be used for very short running tasks. Running an + event process for a long period of time may block all further events for + this or a dependent device. Long running tasks need to be immediately + detached from the event process itself. If the option + is + specified, and the executed program returns non-zero, the event will be + marked as failed for a possible later handling. + If no absolute path is given, the program is expected to live in + /lib/udev, otherwise the absolute path must be + specified. Program name and arguments are separated by spaces. Single quotes + can be used to specify arguments with spaces. + + + + + + + Named label where a GOTO can jump to. + + + + + + + Jumps to the next LABEL with a matching name + + + + + + + Import a set of variables as device properties, + depending on type: + + + + + Execute an external program specified as the assigned value and + import its output, which must be in environment key + format. Path specification, command/argument separation, + and quoting work like in . + + + + + + Import a text file specified as the assigned value, which must be in + environment key format. + + + + + + Import a single property specified as the assigned value from the + current device database. This works only if the database is already populated + by an earlier event. + + + + + + Import the stored keys from the parent device by reading + the database entry of the parent device. The value assigned to + is used as a filter of key names + to import (with the same shell-style pattern matching used for + comparisons). + + + + If no option is given, udev will choose between + and based on the executable bit of the file + permissions. + + + + + + + Wait for a file to become available or until a 10 + seconds timeout expires. + + + + + + + Rule and device options: + + + + + Specify the priority of the created symlinks. Devices with higher + priorities overwrite existing symlinks of other devices. The default is 0. + + + + + + Number of seconds an event will wait for operations to finish, before it + will terminate itself. + + + + + + Usually control and other possibly unsafe characters are replaced + in strings used for device naming. The mode of replacement can be specified + with this option. + + + + + + Watch the device node with inotify, when closed after being opened for + writing, a change uevent will be synthesised. + + + + + + + + The , , , + , , and + fields support simple printf-like string substitutions. The + format chars gets applied after all rules have been processed, right before the program + is executed. It allows the use of device properties set by earlier matching + rules. For all other fields, substitutions are applied while the individual rule is + being processed. The available substitutions are: + + + , + + The kernel name for this device. + + + + + , + + The kernel number for this device. For example, 'sda3' has + kernel number of '3' + + + + + , + + The devpath of the device. + + + + + , + + The name of the device matched while searching the devpath upwards for + , , and . + + + + + + + + The driver name of the device matched while searching the devpath upwards for + , , and . + + + + + + , + + The value of a sysfs attribute found at the device, where + all keys of the rule have matched. If the matching device does not have + such an attribute, follow the chain of parent devices and use the value + of the first attribute that matches. + If the attribute is a symlink, the last element of the symlink target is + returned as the value. + + + + + , + + A device property value. + + + + + , + + The kernel major number for the device. + + + + + , + + The kernel minor number for the device. + + + + + , + + The string returned by the external program requested with PROGRAM. + A single part of the string, separated by a space character may be selected + by specifying the part number as an attribute: . + If the number is followed by the '+' char this part plus all remaining parts + of the result string are substituted: + + + + + , + + The node name of the parent device. + + + + + + + The current name of the device node. If not changed by a rule, it is the + name of the kernel device. + + + + + + + The current list of symlinks, separated by a space character. The value is + only set if an earlier rule assigned a value, or during a remove events. + + + + + , + + The udev_root value. + + + + + , + + The sysfs mount point. + + + + + , + + The name of a created temporary device node to provide access to + the device from a external program before the real node is created. + + + + + + + The '%' character itself. + + + + + + + The '$' character itself. + + + + + + + Author + Written by Greg Kroah-Hartman greg@kroah.com and + Kay Sievers kay.sievers@vrfy.org. With much help from + Dan Stekloff and many others. + + + + See Also + + udevd8 + , + + udevadm8 + + + diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 44e286bba6..9a063f4290 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -1,420 +1,416 @@ - + -
            -
            + + udevadm - - - udevadm - udev - + udev + - - udevadm - 8 - - + + udevadm + 8 + + - - udevadmudev management tool - + + udevadmudev management tool + - - - udevadm - - - - - - udevadm info options - - - udevadm trigger options - - - udevadm settle options - - - udevadm control command - - - udevadm monitor options - - - udevadm test options devpath - - + + + udevadm + + + + + + udevadm info options + + + udevadm trigger options + + + udevadm settle options + + + udevadm control command + + + udevadm monitor options + + + udevadm test options devpath + + - DESCRIPTION - udevadm expects a command and command specific options. It - controls the runtime behavior of udev, requests kernel events, - manages the event queue, and provides simple debugging mechanisms. - + Description + udevadm expects a command and command specific options. It + controls the runtime behavior of udev, requests kernel events, + manages the event queue, and provides simple debugging mechanisms. + - OPTIONS - - - - - Print debug messages to stderr. - - - - - - Print version number. - - - - - - Print help text. - - - + OPTIONS + + + + + Print debug messages to stderr. + + + + + + Print version number. + + + + + + Print help text. + + + - udevadm info <replaceable>options</replaceable> - Queries the udev database for device information - stored in the udev database. It can also query the properties - of a device from its sysfs representation to help creating udev - rules that match this device. - - - - - Query the database for specified type of device data. It needs the - or to identify the specified - device. Valid queries are: - name, symlink, path, - property, all. - - - - - - The devpath of the device to query. - - - - - - The name of the device node or a symlink to query - - - - - - The udev root directory: /dev. If used in conjunction - with a name or symlink query, the - query returns the absolute path including the root directory. - - - - - - Print all sysfs properties of the specified device that can be used - in udev rules to match the specified device. It prints all devices - along the chain, up to the root of sysfs that can be used in udev rules. - - - - - - Print major/minor numbers of the underlying device, where the file - lives on. - - - - - - Export the content of the udev database. - - - - - - Print version. - - - - - - Print help text. - - - - + udevadm info <replaceable>options</replaceable> + Queries the udev database for device information + stored in the udev database. It can also query the properties + of a device from its sysfs representation to help creating udev + rules that match this device. + + + + + Query the database for specified type of device data. It needs the + or to identify the specified + device. Valid queries are: + name, symlink, path, + property, all. + + + + + + The devpath of the device to query. + + + + + + The name of the device node or a symlink to query + + + + + + The udev root directory: /dev. If used in conjunction + with a name or symlink query, the + query returns the absolute path including the root directory. + + + + + + Print all sysfs properties of the specified device that can be used + in udev rules to match the specified device. It prints all devices + along the chain, up to the root of sysfs that can be used in udev rules. + + + + + + Print major/minor numbers of the underlying device, where the file + lives on. + + + + + + Export the content of the udev database. + + + + + + Print version. + + + + + + Print help text. + + + + - udevadm trigger <optional>options</optional> - Request device events from the kernel. Primarily used to replay events at system coldplug time. - - - - - Print the list of devices which will be triggered. - - - - - - Do not actually trigger the event. - - - - - - Trigger a specific type of devices. Valid types are: - devices, subsystems, failed. - The default value is devices. - - - - - - Type of event to be triggered. The default value is change. - - - - - - Trigger events for devices which belong to a matching subsystem. This option - can be specified multiple times and supports shell style pattern matching. - - - - - - Do not trigger events for devices which belong to a matching subsystem. This option - can be specified multiple times and supports shell style pattern matching. - - - - - - Trigger events for devices with a matching sysfs attribute. If a value is specified - along with the attribute name, the content of the attribute is matched against the given - value using shell style pattern matching. If no value is specified, the existence of the - sysfs attribute is checked. This option can be specified multiple times. - - - - - - Do not trigger events for devices with a matching sysfs attribute. If a value is - specified along with the attribute name, the content of the attribute is matched against - the given value using shell style pattern matching. If no value is specified, the existence - of the sysfs attribute is checked. This option can be specified multiple times. - - - - - - Trigger events for devices with a matching property value. This option can be - specified multiple times and supports shell style pattern matching. - - - - - - Trigger events for devices with a matching tag. This option can be - specified multiple times. - - - - - - Trigger events for devices with a matching sys device name. This option can be - specified multiple times and supports shell style pattern matching. - - - - + udevadm trigger <optional>options</optional> + Request device events from the kernel. Primarily used to replay events at system coldplug time. + + + + + Print the list of devices which will be triggered. + + + + + + Do not actually trigger the event. + + + + + + Trigger a specific type of devices. Valid types are: + devices, subsystems, failed. + The default value is devices. + + + + + + Type of event to be triggered. The default value is change. + + + + + + Trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Do not trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Trigger events for devices with a matching sysfs attribute. If a value is specified + along with the attribute name, the content of the attribute is matched against the given + value using shell style pattern matching. If no value is specified, the existence of the + sysfs attribute is checked. This option can be specified multiple times. + + + + + + Do not trigger events for devices with a matching sysfs attribute. If a value is + specified along with the attribute name, the content of the attribute is matched against + the given value using shell style pattern matching. If no value is specified, the existence + of the sysfs attribute is checked. This option can be specified multiple times. + + + + + + Trigger events for devices with a matching property value. This option can be + specified multiple times and supports shell style pattern matching. + + + + + + Trigger events for devices with a matching tag. This option can be + specified multiple times. + + + + + + Trigger events for devices with a matching sys device name. This option can be + specified multiple times and supports shell style pattern matching. + + + + - udevadm settle <optional>options</optional> - Watches the udev event queue, and exits if all current events are handled. - - - - - Maximum number of seconds to wait for the event queue to become empty. - The default value is 180 seconds. A value of 0 will check if the queue is empty - and always return immediately. - - - - - - Wait only for events after the given sequence number. - - - - - - Wait only for events before the given sequence number. - - - - - - Stop waiting if file exists. - - - - - - Do not print any output, like the remaining queue entries when reaching the timeout. - - - - - - Print help text. - - - - + udevadm settle <optional>options</optional> + Watches the udev event queue, and exits if all current events are handled. + + + + + Maximum number of seconds to wait for the event queue to become empty. + The default value is 180 seconds. A value of 0 will check if the queue is empty + and always return immediately. + + + + + + Wait only for events after the given sequence number. + + + + + + Wait only for events before the given sequence number. + + + + + + Stop waiting if file exists. + + + + + + Do not print any output, like the remaining queue entries when reaching the timeout. + + + + + + Print help text. + + + + - udevadm control <replaceable>command</replaceable> - Modify the internal state of the running udev daemon. - - - - - Set the internal log level of udevd. Valid values are the numerical - syslog priorities or their textual representations: , - and . - - - - - - Signal udevd to stop executing new events. Incoming events - will be queued. - - - - - - Signal udevd to enable the execution of events. - - - - - - Signal udevd to reload the rules files. - The udev daemon detects changes automatically, this option is - usually not needed. Reloading rules does not apply any changes - to already existing devices. - - - - - - Set a global property for all events. - - - - value - - Set the maximum number of events, udevd will handle at the - same time. - - - - - - Print help text. - - - - + udevadm control <replaceable>command</replaceable> + Modify the internal state of the running udev daemon. + + + + + Set the internal log level of udevd. Valid values are the numerical + syslog priorities or their textual representations: , + and . + + + + + + Signal udevd to stop executing new events. Incoming events + will be queued. + + + + + + Signal udevd to enable the execution of events. + + + + + + Signal udevd to reload the rules files. + The udev daemon detects changes automatically, this option is + usually not needed. Reloading rules does not apply any changes + to already existing devices. + + + + + + Set a global property for all events. + + + + value + + Set the maximum number of events, udevd will handle at the + same time. + + + + + + Print help text. + + + + - udevadm monitor <optional>options</optional> - Listens to the kernel uevents and events sent out by a udev rule - and prints the devpath of the event to the console. It can be used to analyze the - event timing, by comparing the timestamps of the kernel uevent and the udev event. - - - - - - Print the kernel uevents. - - - - - - Print the udev event after the rule processing. - - - - - - Also print the properties of the event. - - - - - - Filter events by subsystem[/devtype]. Only udev events with a matching subsystem value will pass. - - - - - - Filter events by property. Only udev events with a given tag attached will pass. - - - - - - Print help text. - - - - + udevadm monitor <optional>options</optional> + Listens to the kernel uevents and events sent out by a udev rule + and prints the devpath of the event to the console. It can be used to analyze the + event timing, by comparing the timestamps of the kernel uevent and the udev event. + + + + + + Print the kernel uevents. + + + + + + Print the udev event after the rule processing. + + + + + + Also print the properties of the event. + + + + + + Filter events by subsystem[/devtype]. Only udev events with a matching subsystem value will pass. + + + + + + Filter events by property. Only udev events with a given tag attached will pass. + + + + + + Print help text. + + + + - udevadm test <optional>options</optional> <replaceable>devpath</replaceable> - Simulate a udev event run for the given device, and print debug output. - - - - - The action string. - - - - - - The subsystem string. - - - - - - Print help text. - - - - - + udevadm test <optional>options</optional> <replaceable>devpath</replaceable> + Simulate a udev event run for the given device, and print debug output. + + + + + The action string. + + + + + + The subsystem string. + + + + + + Print help text. + + + + + - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - + Author + Written by Kay Sievers kay.sievers@vrfy.org. + - - SEE ALSO - - udev7 - - - udevd8 - - - -
            -
            + + See Also + + udev7 + + + udevd8 + + + diff --git a/udev/udevd.xml b/udev/udevd.xml index 5368f28144..1f81f06535 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -1,119 +1,115 @@ - + -
            -
            + + udevd - - - udevd - udev - + udev + - - udevd - 8 - - + + udevd + 8 + + - - udevdevent managing daemon - + + udevdevent managing daemon + - - - udevd - - - - - - - - + + + udevd + + + + + + + + - DESCRIPTION - udevd listens to kernel uevents and passes the incoming events to - udev. It ensures the correct event order and takes care, that events for child - devices are delayed until the parent event has finished the device handling. - The behavior of the running daemon can be changed with - udevadm control. - + Description + udevd listens to kernel uevents and passes the incoming events to + udev. It ensures the correct event order and takes care, that events for child + devices are delayed until the parent event has finished the device handling. + The behavior of the running daemon can be changed with + udevadm control. + - OPTIONS - - - - - Detach and run in the background. - - - - - - Run all events completely serialized. This may be useful if udev triggers - actions or loads kernel modules which cause problems and a slow but continuous - operation is needed, where no events are processed in parallel. - - - - - - - Print debug messages to stderr. - - - - - - Specify when udevd should resolve names of users and groups. - When set to (the default) names will be - resolved when the rules are parsed. When set to - names will be resolved for every event. - When set to names will never be resolved - and all devices will be owned by root. - - - - - - Print version number. - - - - - - Print help text. - - - - + Options + + + + + Detach and run in the background. + + + + + + Run all events completely serialized. This may be useful if udev triggers + actions or loads kernel modules which cause problems and a slow but continuous + operation is needed, where no events are processed in parallel. + + + + + + + Print debug messages to stderr. + + + + + + Specify when udevd should resolve names of users and groups. + When set to (the default) names will be + resolved when the rules are parsed. When set to + names will be resolved for every event. + When set to names will never be resolved + and all devices will be owned by root. + + + + + + Print version number. + + + + + + Print help text. + + + + - ENVIRONMENT - - - - - Overrides the syslog priority specified in the config file. - - - - + Environment + + + + + Overrides the syslog priority specified in the config file. + + + + - AUTHOR - Written by Kay Sievers kay.sievers@vrfy.org. - + Author + Written by Kay Sievers kay.sievers@vrfy.org. + - - SEE ALSO - - udev7 - , - - udevadm8 - - - -
            -
            + + See Also + + udev7 + , + + udevadm8 + + + -- cgit v1.2.3-54-g00ecf From c79ee67d918d50abc06eb1e9ffef82f0e604f5ee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 24 May 2010 17:01:53 +0200 Subject: release 155 --- ChangeLog | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4c43d90835..d539caf7fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +Summary of changes from v154 to v155 +============================================ + +Kay Sievers (11): + reset process priority before executing RUN+= + configure.ac: version bump + rules: SUSE - delete device-mapper rules + libudev: add O_CLOEXEC + use default mode of 0600 for nodes if gid == 0 + udevd: create standard symlinks and handle /lib/udev/devices + update NEWS README + fix tests and allow MODE=000 + create static nodes provided by kernel modules to allow module autoloading + update NEWS + man: directly use 'refentry' + + Summary of changes from v153 to v154 ============================================ -- cgit v1.2.3-54-g00ecf From c22b0d4ad1181f61b6d27f071ecdf1ba3d418d55 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 May 2010 06:56:14 +0200 Subject: configure.ac: version bump --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 97db7761e5..cd67c76040 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +======== +Bugfixes. + udev 155 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 816769f111..d82fb1b77c 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [155], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [156], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 4bfa5cf5c3b6f3f6464c79e65463c120c595ac93 Mon Sep 17 00:00:00 2001 From: Bryan Kadzban Date: Tue, 25 May 2010 06:56:37 +0200 Subject: udevd: fix typo /proc/fd -> /proc/self/fd --- udev/udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index ab24885309..802153b295 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -883,7 +883,7 @@ static void static_dev_create_links(struct udev *udev, DIR *dir) }; static const struct stdlinks stdlinks[] = { { "core", "/proc/kcore" }, - { "fd", "/proc/fd" }, + { "fd", "/proc/self/fd" }, { "stdin", "/proc/self/fd/0" }, { "stdout", "/proc/self/fd/1" }, { "stderr", "/proc/self/fd/2" }, -- cgit v1.2.3-54-g00ecf From 898e5d4ca5f8b1a7b56bcaf4710656ba798f2264 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 May 2010 09:47:04 +0200 Subject: cdrom_id: do not export ID_CDROM_MEDIA_SESSION_LAST_OFFSET= for single session media --- extras/cdrom_id/cdrom_id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 935f117c4d..2bea2e4b0c 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -810,14 +810,14 @@ print: printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); if (cd_media_session_count > 0) printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); + if (cd_media_session_count > 1 && cd_media_session_last_offset > 0) + printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); if (cd_media_track_count > 0) printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); if (cd_media_track_count_audio > 0) printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); if (cd_media_track_count_data > 0) printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); - if (cd_media_session_last_offset > 0) - printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); exit: if (fd >= 0) close(fd); -- cgit v1.2.3-54-g00ecf From 484e1b2d11b9b89418589d885a625e647881933b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 May 2010 09:54:14 +0200 Subject: rules: optical drives - use ID_CDROM_MEDIA_TRACK_COUNT_DATA We should not access non-data optical media, ans skip things like blkid. It will cause errors for some drives. https://bugzilla.kernel.org/show_bug.cgi?id=15757 --- rules/rules.d/60-persistent-storage.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index d9f8003cde..1f46041283 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -52,9 +52,9 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" # probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" # single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{ID_CDROM_MEDIA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" +KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" # probe filesystem metadata of disks KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" -- cgit v1.2.3-54-g00ecf From e0d9c042f8678f150dc778eb5ac0ac039f8706fa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 May 2010 12:17:43 +0200 Subject: libudev: fix udev_queue_get_seqnum_sequence_is_finished() with empty queue file We an empty or garbage-collected queue file, we might not have a record for the first sequence we wait for, and therefore must not wait for it. --- Makefile.am | 2 +- libudev/libudev-queue.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 8406a6bc31..21cd46d751 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ CLEANFILES = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=8 -LIBUDEV_REVISION=1 +LIBUDEV_REVISION=2 LIBUDEV_AGE=8 SUBDIRS += libudev/docs diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index f3cb5ab498..d305db6578 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -299,7 +299,7 @@ int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) if (queue_file == NULL) return 1; - while (1) { + for (;;) { unsigned long long int seqnum; ssize_t devpath_len; @@ -348,7 +348,7 @@ out: int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end) { - unsigned long long int seqnum = 0; + unsigned long long int seqnum; ssize_t devpath_len; int unfinished; FILE *queue_file; @@ -368,20 +368,33 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, fclose(queue_file); return -EOVERFLOW; } - unfinished = (end - start) + 1; - while (unfinished > 0) { + /* + * we might start with 0, and handle the initial seqnum + * only when we find an entry in the queue file + **/ + unfinished = end - start; + + do { if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) break; devpath_len = udev_queue_skip_devpath(queue_file); if (devpath_len < 0) break; + /* + * we might start with an empty or re-build queue file, where + * the initial seqnum is not recorded as finished + */ + if (start == seqnum && devpath_len > 0) + unfinished++; + if (devpath_len == 0) { if (seqnum >= start && seqnum <= end) unfinished--; } - } + } while (unfinished > 0); + fclose(queue_file); return (unfinished == 0); -- cgit v1.2.3-54-g00ecf From e925b633408dcf9e254b94bf99aa4f2634f1bf0d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 May 2010 12:21:25 +0200 Subject: release 156 --- ChangeLog | 13 +++++++++++++ NEWS | 1 + 2 files changed, 14 insertions(+) diff --git a/ChangeLog b/ChangeLog index d539caf7fe..79b663dafa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Summary of changes from v155 to v156 +============================================ + +Bryan Kadzban (1): + udevd: fix typo /proc/fd -> /proc/self/fd + +Kay Sievers (4): + configure.ac: version bump + cdrom_id: do not export ID_CDROM_MEDIA_SESSION_LAST_OFFSET= for single session media + rules: optical drives - use ID_CDROM_MEDIA_TRACK_COUNT_DATA + libudev: fix udev_queue_get_seqnum_sequence_is_finished() with empty queue file + + Summary of changes from v154 to v155 ============================================ diff --git a/NEWS b/NEWS index cd67c76040..ace91b1844 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,4 @@ +udev 156 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 6edb57c0e490c8261920b44d2e33df54ce9586e1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 May 2010 12:37:24 +0200 Subject: configure.ac: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ace91b1844..bf044c2d99 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 157 +======== +Bugfixes. + udev 156 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index d82fb1b77c..81233bf29b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [156], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [157], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From a4555e40d227aee00ceb578ee269e7f90513a558 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 May 2010 15:08:01 +0200 Subject: Makefile.am: silent build mkdir --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 21cd46d751..44730e6aab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -545,7 +545,7 @@ dist_udevkeymapforcerel_DATA = \ extras/keymap/force-release-maps/common-volume-keys extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h - mkdir -p extras/keymap + $(AM_V_at)mkdir -p extras/keymap $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt -- cgit v1.2.3-54-g00ecf From 557b005fdab8442b9435393d032b231546fcce90 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 May 2010 15:10:21 +0200 Subject: rules: mount fuse control filesystem --- rules/rules.d/50-udev-default.rules | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index d4da4b14a2..667c3e8ef2 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -104,8 +104,9 @@ KERNEL=="rfkill", MODE="0644" # CPU KERNEL=="cpu[0-9]*", MODE="0444" -# miscellaneous -KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse" +KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse" \ + RUN+="/bin/mount -t fusectl fusectl /sys/fs/fuse/connections" + SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" -- cgit v1.2.3-54-g00ecf From d80f8ffd1a182fe7fff9816e8a4efc09e877964b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 May 2010 15:11:02 +0200 Subject: fix compilation with --enable-debug --- udev/udev-rules.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 5dcd760c55..00b88d968c 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -321,11 +321,10 @@ static void dump_token(struct udev_rules *rules, struct token *token) const char *tk_ptr = (char *)token; unsigned int idx = (tk_ptr - tks_ptr) / sizeof(struct token); - dbg(rules->udev, "* RULE %s:%u, token: %u, count: %u, label: '%s', flags: 0x%02x\n", + dbg(rules->udev, "* RULE %s:%u, token: %u, count: %u, label: '%s'\n", &rules->buf[token->rule.filename_off], token->rule.filename_line, idx, token->rule.token_count, - &rules->buf[token->rule.label_off], - token->rule.flags); + &rules->buf[token->rule.label_off]); break; } case TK_M_ACTION: -- cgit v1.2.3-54-g00ecf From abbc1c17a0cd0c6f5d00f9d2cd3bf19901ccb6f8 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 27 May 2010 11:37:29 +0200 Subject: 40-redhat.rules: removed file --- rules/redhat/40-redhat.rules | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 rules/redhat/40-redhat.rules diff --git a/rules/redhat/40-redhat.rules b/rules/redhat/40-redhat.rules deleted file mode 100644 index 47ce9e503d..0000000000 --- a/rules/redhat/40-redhat.rules +++ /dev/null @@ -1,27 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="hd*[!0-9]", SUBSYSTEMS=="ide", ATTRS{media}=="floppy", SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove" -KERNEL=="hd*[0-9]", ATTRS{media}=="floppy", ATTRS{removable}=="1", SYMLINK+="floppy-%k", OPTIONS+="ignore_remove" - -KERNEL=="fw*", PROGRAM="fw_unit_symlinks.sh %k %n", SYMLINK+="$result" - -ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="3|6", SYMLINK+="scanner scanner-%k", MODE="0660" - -ACTION=="add", KERNEL=="sg[0-9]*", BUS=="scsi", ATTRS{type}=="8", SYMLINK+="changer changer-%k", MODE="0660", GROUP="disk" - -BUS=="usb", KERNEL=="sd*", ATTRS{bInterfaceClass}=="08", ATTRS{bInterfaceSubClass}=="04", GROUP="floppy", MODE="0660", SYMLINK+="floppy floppy-%k" - -KERNEL=="fd[0-9]*", SYMLINK+="floppy floppy-%k" - -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="0|7|14", \ - RUN+="/sbin/modprobe sd_mod" -ACTION=="add", SUBSYSTEM=="scsi_device", ATTRS{type}=="[45]", \ - RUN+="/sbin/modprobe sr_mod" - -KERNEL=="vcs", OWNER="vcsa", GROUP="tty" -KERNEL=="vcs[0-9]*", OWNER="vcsa", GROUP="tty" -KERNEL=="vcsa", OWNER="vcsa", GROUP="tty" -KERNEL=="vcsa[0-9]*", OWNER="vcsa", GROUP="tty" -KERNEL=="vcc/*", OWNER="vcsa", GROUP="tty" - -KERNEL=="event*", ATTRS{idVendor}=="03f0", ATTRS{interface}=="Virtual Mouse", ATTRS{bInterfaceProtocol}=="02", SYMLINK+="input/hp_ilo_mouse" -- cgit v1.2.3-54-g00ecf From 88cbfb09ee5510277503ff1830ecc3aa6c380b00 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 May 2010 15:11:00 +0200 Subject: while (1) -> for (;;) --- libudev/libudev-queue.c | 4 ++-- libudev/libudev-util-private.c | 2 +- libudev/test-libudev.c | 4 ++-- udev/udev-event.c | 2 +- udev/udev-rules.c | 10 +++++----- udev/udevadm-control.c | 2 +- udev/udevadm-info.c | 2 +- udev/udevadm-monitor.c | 2 +- udev/udevadm-settle.c | 4 ++-- udev/udevadm-test.c | 2 +- udev/udevadm-trigger.c | 2 +- udev/udevadm.c | 2 +- udev/udevd.c | 6 +++--- 13 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index d305db6578..be8804bdd0 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -243,7 +243,7 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) if (queue_file == NULL) return 0; - while (1) { + for (;;) { unsigned long long int seqnum; ssize_t devpath_len; @@ -435,7 +435,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev if (queue_file == NULL) return NULL; - while (1) { + for (;;) { char syspath[UTIL_PATH_SIZE]; char *s; size_t l; diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 8c535125a8..7d28b23b38 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -84,7 +84,7 @@ int util_delete_path(struct udev *udev, const char *path) if (pos == p || pos == NULL) return 0; - while (1) { + for (;;) { *pos = '\0'; pos = strrchr(p, '/'); diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index 34b3de86f1..3eb34494df 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -242,7 +242,7 @@ static int test_monitor(struct udev *udev) fd = udev_monitor_get_fd(udev_monitor); FD_ZERO(&readfds); - while (1) { + for (;;) { struct udev_device *device; int fdcount; @@ -422,7 +422,7 @@ int main(int argc, char *argv[]) udev_set_log_fn(udev, log_fn); printf("set log: %p\n", log_fn); - while (1) { + for (;;) { int option; option = getopt_long(argc, argv, "+dhV", options, NULL); diff --git a/udev/udev-event.c b/udev/udev-event.c index 9c2ce1d388..44e24313f5 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -111,7 +111,7 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char * s = dest; l = size; - while (1) { + for (;;) { enum subst_type type = SUBST_UNKNOWN; char attrbuf[UTIL_PATH_SIZE]; char *attr = NULL; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 00b88d968c..11948cacce 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -894,7 +894,7 @@ static int get_key(struct udev *udev, char **line, char **key, enum operation_ty return -1; *key = linepos; - while (1) { + for (;;) { linepos++; if (linepos[0] == '\0') return -1; @@ -1180,7 +1180,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_tmp.rule.rule.filename_line = lineno; linepos = line; - while (1) { + for (;;) { char *key; char *value; enum operation_type op; @@ -1707,7 +1707,7 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis return -1; } - while (1) { + for (;;) { struct dirent *dent; dent = readdir(dir); @@ -1940,7 +1940,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * split = &rules->buf[token->key.value_off]; len = strlen(val); - while (1) { + for (;;) { const char *next; next = strchr(split, '|'); @@ -2182,7 +2182,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* loop over parents */ event->dev_parent = event->dev; - while (1) { + for (;;) { struct token *key; dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 0fd69b9a0a..4303aeb5a8 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -66,7 +66,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) if (uctrl == NULL) return 2; - while (1) { + for (;;) { int option; int i; char *endp; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index b395ad93b6..14baa6accb 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -238,7 +238,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) QUERY_ALL, } query = QUERY_NONE; - while (1) { + for (;;) { int option; struct stat statbuf; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index fb650846bc..85252bb7d9 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -92,7 +92,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) udev_list_init(&subsystem_match_list); udev_list_init(&tag_match_list); - while (1) { + for (;;) { option = getopt_long(argc, argv, "pekus:t:h", options, NULL); if (option == -1) break; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 4f422f9092..1423cec6dc 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -84,7 +84,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) sigaddset(&mask, SIGALRM); sigprocmask(SIG_UNBLOCK, &mask, NULL); - while (1) { + for (;;) { int option; int seconds; @@ -181,7 +181,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } } - while (1) { + for (;;) { struct stat statbuf; const struct timespec duration = { 0 , 1000 * 1000 * 1000 / LOOP_PER_SECOND }; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 894620073a..4db70c49dd 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -50,7 +50,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) info(udev, "version %s\n", VERSION); - while (1) { + for (;;) { int option; option = getopt_long(argc, argv, "a:s:fh", options, NULL); diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 3cb07dda9a..481e9cf163 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -122,7 +122,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) goto exit; } - while (1) { + for (;;) { int option; const char *key; const char *val; diff --git a/udev/udevadm.c b/udev/udevadm.c index 21b7f616c3..19b89ad05c 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) udev_set_log_fn(udev, log_fn); udev_selinux_init(udev); - while (1) { + for (;;) { int option; option = getopt_long(argc, argv, "+dhV", options, NULL); diff --git a/udev/udevd.c b/udev/udevd.c index 802153b295..b48a91391d 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -536,7 +536,7 @@ static void events_start(struct udev *udev) static void worker_returned(void) { - while (1) { + for (;;) { struct worker_message msg; ssize_t size; struct udev_list_node *loop; @@ -709,7 +709,7 @@ static void handle_signal(struct udev *udev, int signo) udev_exit = true; break; case SIGCHLD: - while (1) { + for (;;) { pid_t pid; int status; struct udev_list_node *loop, *tmp; @@ -975,7 +975,7 @@ int main(int argc, char *argv[]) info(udev, "version %s\n", VERSION); udev_selinux_init(udev); - while (1) { + for (;;) { int option; option = getopt_long(argc, argv, "dDthV", options, NULL); -- cgit v1.2.3-54-g00ecf From 87d55ff672d78ebf8afc755e88beeeb1bdf3ac5e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 May 2010 17:27:56 +0200 Subject: childs -> children --- libudev/libudev-ctrl.c | 11 +++++------ libudev/libudev-private.h | 4 ++-- libudev/libudev-util-private.c | 2 +- udev/udevadm-control.c | 6 +++--- udev/udevadm.xml | 2 +- udev/udevd.c | 36 ++++++++++++++++++------------------ 6 files changed, 30 insertions(+), 31 deletions(-) diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c index e47b2b66dc..af59c36826 100644 --- a/libudev/libudev-ctrl.c +++ b/libudev/libudev-ctrl.c @@ -32,8 +32,7 @@ enum udev_ctrl_msg_type { UDEV_CTRL_START_EXEC_QUEUE, UDEV_CTRL_RELOAD_RULES, UDEV_CTRL_SET_ENV, - UDEV_CTRL_SET_MAX_CHILDS, - UDEV_CTRL_SET_MAX_CHILDS_RUNNING, + UDEV_CTRL_SET_CHILDREN_MAX, UDEV_CTRL_SETTLE, }; @@ -185,9 +184,9 @@ int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key) return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key); } -int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count) +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count) { - return ctrl_send(uctrl, UDEV_CTRL_SET_MAX_CHILDS, count, NULL); + return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL); } int udev_ctrl_send_settle(struct udev_ctrl *uctrl) @@ -306,9 +305,9 @@ const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) return NULL; } -int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg) +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_MAX_CHILDS) + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) return ctrl_msg->ctrl_msg_wire.intval; return -1; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index fa9722360b..fa408f6ae6 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -127,7 +127,7 @@ int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl); int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl); int udev_ctrl_send_settle(struct udev_ctrl *uctrl); int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key); -int udev_ctrl_send_set_max_childs(struct udev_ctrl *uctrl, int count); +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count); struct udev_ctrl_msg; struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl); struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl); @@ -139,7 +139,7 @@ int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg); const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_set_max_childs(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); /* libudev-list.c */ struct udev_list_node { diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 7d28b23b38..2f9f4a74c3 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -454,7 +454,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp, if (errpipe[READ_END] > 0) close(errpipe[READ_END]); - /* return the childs stdout string */ + /* return the child's stdout string */ if (result) { result[respos] = '\0'; dbg(udev, "result='%s'\n", result); diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 4303aeb5a8..1f8008ab9e 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -35,7 +35,7 @@ static void print_help(void) " --start-exec-queue execute events, flush queue\n" " --reload-rules reloads the rules files\n" " --property== set a global property for all events\n" - " --max-childs= maximum number of childs\n" + " --children-max= maximum number of children\n" " --help print this help text\n\n"); } @@ -52,7 +52,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) { "reload-rules", no_argument, NULL, 'R' }, { "property", required_argument, NULL, 'p' }, { "env", required_argument, NULL, 'p' }, - { "max-childs", required_argument, NULL, 'm' }, + { "children-max", required_argument, NULL, 'm' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -121,7 +121,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) fprintf(stderr, "invalid number '%s'\n", optarg); goto exit; } - if (udev_ctrl_send_set_max_childs(uctrl, i) < 0) + if (udev_ctrl_send_set_children_max(uctrl, i) < 0) rc = 2; else rc = 0; diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 9a063f4290..223140e7a7 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -315,7 +315,7 @@
            - value + value Set the maximum number of events, udevd will handle at the same time. diff --git a/udev/udevd.c b/udev/udevd.c index b48a91391d..5e74f6e013 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -78,8 +78,8 @@ static int worker_watch[2]; static pid_t settle_pid; static bool stop_exec_queue; static bool reload_config; -static int max_childs; -static int childs; +static int children; +static int children_max; static sigset_t orig_sigmask; static struct udev_list_node event_list; static struct udev_list_node worker_list; @@ -205,7 +205,7 @@ static void worker_unref(struct worker *worker) udev_list_node_remove(&worker->node); udev_monitor_unref(worker->monitor); - childs--; + children--; info(worker->udev, "worker [%u] cleaned up\n", worker->pid); free(worker); } @@ -355,7 +355,7 @@ static void worker_new(struct event *event) worker->event = event; event->state = EVENT_RUNNING; udev_list_node_append(&worker->node, &worker_list); - childs++; + children++; info(event->udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); break; } @@ -386,8 +386,8 @@ static void event_run(struct event *event, bool force) return; } - if (!force && childs >= max_childs) { - info(event->udev, "maximum number (%i) of childs reached\n", childs); + if (!force && children >= children_max) { + info(event->udev, "maximum number (%i) of children reached\n", children); return; } @@ -431,10 +431,10 @@ static void worker_kill(struct udev *udev, int retain) struct udev_list_node *loop; int max; - if (childs <= retain) + if (children <= retain) return; - max = childs - retain; + max = children - retain; udev_list_node_foreach(loop, &worker_list) { struct worker *worker = node_to_worker(loop); @@ -625,10 +625,10 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) worker_kill(udev, 0); } - i = udev_ctrl_get_set_max_childs(ctrl_msg); + i = udev_ctrl_get_set_children_max(ctrl_msg); if (i >= 0) { - info(udev, "udevd message (SET_MAX_CHILDS) received, max_childs=%i\n", i); - max_childs = i; + info(udev, "udevd message (SET_MAX_CHILDREN) received, children_max=%i\n", i); + children_max = i; } settle_pid = udev_ctrl_get_settle(ctrl_msg); @@ -1177,21 +1177,21 @@ int main(int argc, char *argv[]) /* in trace mode run one event after the other */ if (debug_trace) { - max_childs = 1; + children_max = 1; } else { int memsize = mem_size_mb(); if (memsize > 0) - max_childs = 128 + (memsize / 8); + children_max = 128 + (memsize / 8); else - max_childs = 128; + children_max = 128; } /* possibly overwrite maximum limit of executed events */ - value = getenv("UDEVD_MAX_CHILDS"); + value = getenv("UDEVD_MAX_CHILDREN"); if (value) - max_childs = strtoul(value, NULL, 10); - info(udev, "initialize max_childs to %u\n", max_childs); + children_max = strtoul(value, NULL, 10); + info(udev, "initialize children_max to %u\n", children_max); static_dev_create(udev); static_dev_create_from_modules(udev); @@ -1205,7 +1205,7 @@ int main(int argc, char *argv[]) int timeout; /* set timeout to kill idle workers */ - if (udev_list_is_empty(&event_list) && childs > 2) + if (udev_list_is_empty(&event_list) && children > 2) timeout = 3 * 1000; else timeout = -1; -- cgit v1.2.3-54-g00ecf From 337d10278380ba3605f0e1e730c542ca20a817fe Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 May 2010 17:41:51 +0200 Subject: udevd: replace --debug-trace with --children-max --- udev/udevd.c | 43 ++++++++++++++++++++----------------------- udev/udevd.xml | 8 +++----- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 5e74f6e013..189ab007a4 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -69,7 +69,6 @@ static void log_fn(struct udev *udev, int priority, } } -static bool debug_trace; static struct udev_rules *rules; static struct udev_queue_export *udev_queue_export; static struct udev_ctrl *udev_ctrl; @@ -952,16 +951,15 @@ int main(int argc, char *argv[]) int fd; FILE *f; sigset_t mask; - const char *value; int daemonize = false; int resolve_names = 1; static const struct option options[] = { { "daemon", no_argument, NULL, 'd' }, - { "debug-trace", no_argument, NULL, 't' }, { "debug", no_argument, NULL, 'D' }, + { "children-max", required_argument, NULL, 'c' }, + { "resolve-names", required_argument, NULL, 'N' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, - { "resolve-names", required_argument, NULL, 'N' }, {} }; int rc = 1; @@ -986,8 +984,8 @@ int main(int argc, char *argv[]) case 'd': daemonize = true; break; - case 't': - debug_trace = true; + case 'c': + children_max = strtoul(optarg, NULL, 10); break; case 'D': debug = true; @@ -1008,7 +1006,7 @@ int main(int argc, char *argv[]) } break; case 'h': - printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] " + printf("Usage: udevd [--help] [--daemon] [--children-max] [--debug] " "[--resolve-names=early|late|never] [--version]\n"); goto exit; case 'V': @@ -1151,7 +1149,7 @@ int main(int argc, char *argv[]) } /* redirect std{out,err} */ - if (!debug && !debug_trace) { + if (!debug) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); @@ -1175,23 +1173,22 @@ int main(int argc, char *argv[]) close(fd); } - /* in trace mode run one event after the other */ - if (debug_trace) { - children_max = 1; - } else { - int memsize = mem_size_mb(); + if (children_max <= 0) { + const char *value = getenv("UDEVD_CHILDREN_MAX"); - if (memsize > 0) - children_max = 128 + (memsize / 8); - else - children_max = 128; - } + if (value) { + children_max = strtoul(value, NULL, 10); + } else { + int memsize = mem_size_mb(); - /* possibly overwrite maximum limit of executed events */ - value = getenv("UDEVD_MAX_CHILDREN"); - if (value) - children_max = strtoul(value, NULL, 10); - info(udev, "initialize children_max to %u\n", children_max); + /* set value depending on the amount of RAM */ + if (memsize > 0) + children_max = 128 + (memsize / 8); + else + children_max = 128; + } + } + info(udev, "set children_max to %u\n", children_max); static_dev_create(udev); static_dev_create_from_modules(udev); diff --git a/udev/udevd.xml b/udev/udevd.xml index 1f81f06535..8e7755a6ff 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -23,7 +23,7 @@ udevd - + @@ -48,11 +48,9 @@ - + - Run all events completely serialized. This may be useful if udev triggers - actions or loads kernel modules which cause problems and a slow but continuous - operation is needed, where no events are processed in parallel. + Limit the number of parallel executed events. -- cgit v1.2.3-54-g00ecf From d4c1467f8527b9b1b7e716347cf6f101542343dd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 May 2010 17:45:58 +0200 Subject: udevd: fix comments --- udev/udevd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 189ab007a4..79a269ada0 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1023,7 +1023,7 @@ int main(int argc, char *argv[]) goto exit; } - /* make sure std{in,out,err} fd's are in a sane state */ + /* make sure std{in,out,err} fds are in a sane state */ fd = open("/dev/null", O_RDWR); if (fd < 0) { fprintf(stderr, "cannot open /dev/null\n"); @@ -1034,7 +1034,6 @@ int main(int argc, char *argv[]) if (write(STDERR_FILENO, 0, 0) < 0) dup2(fd, STDERR_FILENO); - /* init control socket, bind() ensures, that only one udevd instance is running */ udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); if (udev_ctrl == NULL) { fprintf(stderr, "error initializing control socket"); @@ -1148,7 +1147,6 @@ int main(int argc, char *argv[]) fclose(f); } - /* redirect std{out,err} */ if (!debug) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); @@ -1157,7 +1155,7 @@ int main(int argc, char *argv[]) if (fd > STDERR_FILENO) close(fd); - /* set scheduling priority for the daemon */ + /* set scheduling priority for the main daemon process */ setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); chdir("/"); -- cgit v1.2.3-54-g00ecf From 7bf44da99c0526bc46beff451353ca15ff7ce1bd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 27 May 2010 18:52:09 +0200 Subject: rules: add -v to modprobe calls to be able see what will be loaded --- rules/rules.d/80-drivers.rules | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index 86eb9187a9..04a86bdbc1 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -2,12 +2,12 @@ ACTION=="remove", GOTO="drivers_end" -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -b $env{MODALIAS}" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -b tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -b tifm_ms" -SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -b --all ms_block mspro_block" -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -b i2o_block" -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe -b sg" -SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -b ppdev" +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -bv $env{MODALIAS}" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -bv tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -bv tifm_ms" +SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -bv --all ms_block mspro_block" +SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -bv i2o_block" +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe -bv sg" +SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -bv ppdev" LABEL="drivers_end" -- cgit v1.2.3-54-g00ecf From c830e98d6a8e43b1b5cc8470aa750960989778bc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 May 2010 12:07:27 +0200 Subject: udevd: read debug settings from kernel commandline --- libudev/libudev-util.c | 6 ++-- udev/udev-event.c | 4 +++ udev/udev.h | 1 + udev/udevd.c | 78 +++++++++++++++++++++++++++++++++++++++----------- 4 files changed, 69 insertions(+), 20 deletions(-) diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index 3a67b0cd5d..030b78cd22 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -87,13 +87,13 @@ int util_log_priority(const char *priority) int prio; prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0') + if (endptr[0] == '\0' || isspace(endptr[0])) return prio; if (strncmp(priority, "err", 3) == 0) return LOG_ERR; - if (strcmp(priority, "info") == 0) + if (strncmp(priority, "info", 4) == 0) return LOG_INFO; - if (strcmp(priority, "debug") == 0) + if (strncmp(priority, "debug", 5) == 0) return LOG_DEBUG; return 0; } diff --git a/udev/udev-event.c b/udev/udev-event.c index 44e24313f5..7591d5e314 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -681,6 +681,10 @@ int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); + if (event->exec_delay > 0) { + info(event->udev, "delay execution of '%s'\n", program); + sleep(event->exec_delay); + } if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask, true) != 0) { if (udev_list_entry_get_flags(list_entry)) err = -1; diff --git a/udev/udev.h b/udev/udev.h index 4150c16af7..23b720a468 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -43,6 +43,7 @@ struct udev_event { uid_t uid; gid_t gid; struct udev_list_node run_list; + int exec_delay; bool group_final; bool owner_final; bool mode_final; diff --git a/udev/udevd.c b/udev/udevd.c index 79a269ada0..612f04d1b9 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -79,6 +79,7 @@ static bool stop_exec_queue; static bool reload_config; static int children; static int children_max; +static int exec_delay; static sigset_t orig_sigmask; static struct udev_list_node event_list; static struct udev_list_node worker_list; @@ -285,6 +286,9 @@ static void worker_new(struct event *event) /* set timeout to prevent hanging processes */ alarm(UDEV_EVENT_TIMEOUT); + if (exec_delay > 0) + udev_event->exec_delay = exec_delay; + /* apply rules, create node, symlinks */ err = udev_event_execute_rules(udev_event, rules); @@ -386,7 +390,8 @@ static void event_run(struct event *event, bool force) } if (!force && children >= children_max) { - info(event->udev, "maximum number (%i) of children reached\n", children); + if (children_max > 1) + info(event->udev, "maximum number (%i) of children reached\n", children); return; } @@ -957,6 +962,7 @@ int main(int argc, char *argv[]) { "daemon", no_argument, NULL, 'd' }, { "debug", no_argument, NULL, 'D' }, { "children-max", required_argument, NULL, 'c' }, + { "exec-delay", required_argument, NULL, 'e' }, { "resolve-names", required_argument, NULL, 'N' }, { "help", no_argument, NULL, 'h' }, { "version", no_argument, NULL, 'V' }, @@ -976,7 +982,7 @@ int main(int argc, char *argv[]) for (;;) { int option; - option = getopt_long(argc, argv, "dDthV", options, NULL); + option = getopt_long(argc, argv, "cdeDthV", options, NULL); if (option == -1) break; @@ -985,7 +991,10 @@ int main(int argc, char *argv[]) daemonize = true; break; case 'c': - children_max = strtoul(optarg, NULL, 10); + children_max = strtoul(optarg, NULL, 0); + break; + case 'e': + exec_delay = strtoul(optarg, NULL, 0); break; case 'D': debug = true; @@ -1006,8 +1015,15 @@ int main(int argc, char *argv[]) } break; case 'h': - printf("Usage: udevd [--help] [--daemon] [--children-max] [--debug] " - "[--resolve-names=early|late|never] [--version]\n"); + printf("Usage: udevd OPTIONS\n" + " --daemon\n" + " --debug\n" + " --children-max=\n" + " --exec-delay=\n" + " --resolve-names=early|late|never\n" + " --version\n" + " --help\n" + "\n"); goto exit; case 'V': printf("%s\n", VERSION); @@ -1023,6 +1039,40 @@ int main(int argc, char *argv[]) goto exit; } + /* + * read the kernel commandline, in case we need to get into debug mode + * udev.log-priority= syslog priority + * udev.children-max= events are fully serialized if set to 1 + * + */ + f = fopen("/proc/cmdline", "r"); + if (f != NULL) { + char cmdline[4096]; + + if (fgets(cmdline, sizeof(cmdline), f) != NULL) { + char *pos; + + pos = strstr(cmdline, "udev.log-priority="); + if (pos != NULL) { + pos += strlen("udev.log-priority="); + udev_set_log_priority(udev, util_log_priority(pos)); + } + + pos = strstr(cmdline, "udev.children-max="); + if (pos != NULL) { + pos += strlen("udev.children-max="); + children_max = strtoul(pos, NULL, 0); + } + + pos = strstr(cmdline, "udev.exec-delay="); + if (pos != NULL) { + pos += strlen("udev.exec-delay="); + exec_delay = strtoul(pos, NULL, 0); + } + } + fclose(f); + } + /* make sure std{in,out,err} fds are in a sane state */ fd = open("/dev/null", O_RDWR); if (fd < 0) { @@ -1172,19 +1222,13 @@ int main(int argc, char *argv[]) } if (children_max <= 0) { - const char *value = getenv("UDEVD_CHILDREN_MAX"); + int memsize = mem_size_mb(); - if (value) { - children_max = strtoul(value, NULL, 10); - } else { - int memsize = mem_size_mb(); - - /* set value depending on the amount of RAM */ - if (memsize > 0) - children_max = 128 + (memsize / 8); - else - children_max = 128; - } + /* set value depending on the amount of RAM */ + if (memsize > 0) + children_max = 128 + (memsize / 8); + else + children_max = 128; } info(udev, "set children_max to %u\n", children_max); -- cgit v1.2.3-54-g00ecf From 0604fc0f7f5b5baca1e84e4ba31bb2b241883c84 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 May 2010 12:17:42 +0200 Subject: update NEWS --- NEWS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NEWS b/NEWS index bf044c2d99..3aa5a430c7 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,16 @@ udev 157 ======== Bugfixes. +The option --debug-trace and the environemnt variable UDEVD_MAX_CHILDS= +was removed from udevd. + +Udevd now parses the kernel commandline for the following variables: + udev.log-priority= + udev.children-max= + udev.exec-delay= +to help debuging coldplug setups where the loading of a kernel +module crashes the system. + udev 156 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From e5e3f0ca642f3b2a1dcb7359fd2cf7fb6927a072 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 May 2010 13:59:23 +0200 Subject: rules: delete pilot rules and remove redhat directory --- Makefile.am | 1 - rules/packages/40-pilot-links.rules | 4 ---- 2 files changed, 5 deletions(-) delete mode 100644 rules/packages/40-pilot-links.rules diff --git a/Makefile.am b/Makefile.am index 44730e6aab..b0eeaf1224 100644 --- a/Makefile.am +++ b/Makefile.am @@ -94,7 +94,6 @@ install-data-local: EXTRA_DIST += \ rules/packages \ - rules/redhat \ rules/suse \ rules/gentoo diff --git a/rules/packages/40-pilot-links.rules b/rules/packages/40-pilot-links.rules deleted file mode 100644 index 1242fff102..0000000000 --- a/rules/packages/40-pilot-links.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="ttyUSB*", ATTRS{product}=="[Hh]andspring*Treo*|[Hh]andspring*Visor*|[Pp]alm*Handheld*", SYMLINK+="pilot" - -- cgit v1.2.3-54-g00ecf From 9fa68615bb0315501625c6cde3f3077257c740e7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 28 May 2010 15:11:36 +0200 Subject: man: add static device nodes and udevd debug options --- udev/udev.xml | 10 ++++++++++ udev/udevd.xml | 32 ++++++++++++++++++++++---------- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index adf531b372..c517766f97 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -489,6 +489,16 @@ with this option.
            + + + + Apply the permissions specified in this rule to a static device node with + the specified name. Static device nodes might be provided by kernel modules, + or copied from /lib/udev/devices. These nodes might not have + a corresponding kernel device at the time udevd is started, and allow to trigger + automatic kernel module on-demand loading. + + diff --git a/udev/udevd.xml b/udev/udevd.xml index 8e7755a6ff..02a6543235 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -23,19 +23,23 @@ udevd - - + + + Description - udevd listens to kernel uevents and passes the incoming events to - udev. It ensures the correct event order and takes care, that events for child - devices are delayed until the parent event has finished the device handling. - The behavior of the running daemon can be changed with + udevd listens to kernel uevents and executes the instructions specified + in rules. On startup the content of the directory + /lib/udev/devices is copied to /dev. + If kernel modules specify static device nodes, these nodes are created + even wihtout a corresponding kernel device, to allow on-demand loading of kernel + modules. Matching permissions specified in udev rules are applied to these + static device nodes. The behavior of the running daemon can be changed with udevadm control. @@ -48,20 +52,28 @@ - + + + Print debug messages to stderr. + + + + Limit the number of parallel executed events. - + - Print debug messages to stderr. + Number of seconds to delay the execution of RUN instructions. + This might be useful when debugging system crashes during coldplug + cause by loading non-working kernel modules. - + Specify when udevd should resolve names of users and groups. When set to (the default) names will be -- cgit v1.2.3-54-g00ecf From 7afe4ccd1e75dccb5e321ec740238705db22dbd0 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Fri, 28 May 2010 15:30:19 -0500 Subject: Fix wlan key on Inspirion 1210 This fixed wlan key on Inspirion 1210 machines. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 8c00ba1143..c321fbbef4 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -53,7 +53,7 @@ GOTO="keyboard_end" LABEL="keyboard_vendorcheck" ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" -ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 1011", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 1011|Inspiron 1210", RUN+="keymap $name 0x84 wlan" ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" -- cgit v1.2.3-54-g00ecf From 8f7f1a2b521b91e94437423886fe542c690adb27 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 May 2010 22:23:48 +0200 Subject: man: add kernel command line parameters --- udev/udevd.xml | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/udev/udevd.xml b/udev/udevd.xml index 02a6543235..f6cd9864d1 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -60,8 +60,7 @@ - Limit the number of parallel executed events. - + Limit the number of parallel executed events. @@ -101,9 +100,34 @@ Environment - + UDEV_LOG= - Overrides the syslog priority specified in the config file. + Set the logging priority. + + + + + + Kernel command line + + + udev.log-priority= + + Set the logging priority. + + + + udev.children-max= + + Limit the number of parallel executed events. + + + + udev.exec-delay= + + Number of seconds to delay the execution of RUN instructions. + This might be useful when debugging system crashes during coldplug + cause by loading non-working kernel modules. @@ -117,8 +141,7 @@ See Also udev7 - , - + , udevadm8 -- cgit v1.2.3-54-g00ecf From b130944f994846536d01813820b3db0347a90d78 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 29 May 2010 22:51:55 +0200 Subject: man: udevd - update intro --- udev/udevd.xml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/udev/udevd.xml b/udev/udevd.xml index f6cd9864d1..de06a6173f 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -33,13 +33,16 @@ Description - udevd listens to kernel uevents and executes the instructions specified - in rules. On startup the content of the directory - /lib/udev/devices is copied to /dev. - If kernel modules specify static device nodes, these nodes are created - even wihtout a corresponding kernel device, to allow on-demand loading of kernel - modules. Matching permissions specified in udev rules are applied to these - static device nodes. The behavior of the running daemon can be changed with + udevd listens to kernel uevents. For every event, udevd executes matching + instructions specified in udev rules. See + udev7 + . + On startup the content of the directory /lib/udev/devices + is copied to /dev. If kernel modules specify static device + nodes, these nodes are created even wihtout a corresponding kernel device, to + allow on-demand loading of kernel modules. Matching permissions specified in udev + rules are applied to these static device nodes. + The behavior of the running daemon can be changed with udevadm control. -- cgit v1.2.3-54-g00ecf From 66dfef36e042f167fc1cb2c768e8b08fda739a90 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 May 2010 14:52:03 +0200 Subject: rules: rename packages -> arch --- rules/arch/40-ia64.rules | 4 ++++ rules/arch/40-ppc.rules | 6 ++++++ rules/arch/40-s390.rules | 4 ++++ rules/packages/40-ia64.rules | 4 ---- rules/packages/40-ppc.rules | 6 ------ rules/packages/40-s390.rules | 4 ---- 6 files changed, 14 insertions(+), 14 deletions(-) create mode 100644 rules/arch/40-ia64.rules create mode 100644 rules/arch/40-ppc.rules create mode 100644 rules/arch/40-s390.rules delete mode 100644 rules/packages/40-ia64.rules delete mode 100644 rules/packages/40-ppc.rules delete mode 100644 rules/packages/40-s390.rules diff --git a/rules/arch/40-ia64.rules b/rules/arch/40-ia64.rules new file mode 100644 index 0000000000..5846f88b1b --- /dev/null +++ b/rules/arch/40-ia64.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="sgi_*", MODE="0666" + diff --git a/rules/arch/40-ppc.rules b/rules/arch/40-ppc.rules new file mode 100644 index 0000000000..90c15f0598 --- /dev/null +++ b/rules/arch/40-ppc.rules @@ -0,0 +1,6 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="iseries/ibmsis*", GROUP="disk" +KERNEL=="iseries/nvt*", GROUP="disk" +KERNEL=="iseries/vt*", GROUP="disk" +KERNEL=="iseries/vtty*, GROUP="dialout" diff --git a/rules/arch/40-s390.rules b/rules/arch/40-s390.rules new file mode 100644 index 0000000000..43035dbe60 --- /dev/null +++ b/rules/arch/40-s390.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="z90crypt", MODE="0666" + diff --git a/rules/packages/40-ia64.rules b/rules/packages/40-ia64.rules deleted file mode 100644 index 5846f88b1b..0000000000 --- a/rules/packages/40-ia64.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="sgi_*", MODE="0666" - diff --git a/rules/packages/40-ppc.rules b/rules/packages/40-ppc.rules deleted file mode 100644 index 90c15f0598..0000000000 --- a/rules/packages/40-ppc.rules +++ /dev/null @@ -1,6 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="iseries/ibmsis*", GROUP="disk" -KERNEL=="iseries/nvt*", GROUP="disk" -KERNEL=="iseries/vt*", GROUP="disk" -KERNEL=="iseries/vtty*, GROUP="dialout" diff --git a/rules/packages/40-s390.rules b/rules/packages/40-s390.rules deleted file mode 100644 index 43035dbe60..0000000000 --- a/rules/packages/40-s390.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="z90crypt", MODE="0666" - -- cgit v1.2.3-54-g00ecf From 52934a60c447ae78873b07a01b7fa25e60c86fe4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 May 2010 14:57:06 +0200 Subject: rules: SUSE - move last distro rule to package --- NEWS | 3 +++ rules/suse/79-kms.rules | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 rules/suse/79-kms.rules diff --git a/NEWS b/NEWS index 3aa5a430c7..1e92f468e1 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ Udevd now parses the kernel commandline for the following variables: to help debuging coldplug setups where the loading of a kernel module crashes the system. +The subdirectory in the source tree rules/packages has been renamed to +rules/arch, anc contains only architecture specific rules now. + udev 156 ======== Bugfixes. diff --git a/rules/suse/79-kms.rules b/rules/suse/79-kms.rules deleted file mode 100644 index 653d1f371d..0000000000 --- a/rules/suse/79-kms.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="add", SUBSYSTEM=="pci", ATTR{class}=="0x030000", ENV{MODALIAS}="" - -- cgit v1.2.3-54-g00ecf From ada635b8600952c1cbf2be98c7111da14012d488 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 May 2010 15:03:41 +0200 Subject: rules: add misc/30-kernel-compat.rules --- rules/misc/30-kernel-compat.rules | 100 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 rules/misc/30-kernel-compat.rules diff --git a/rules/misc/30-kernel-compat.rules b/rules/misc/30-kernel-compat.rules new file mode 100644 index 0000000000..af5696f86f --- /dev/null +++ b/rules/misc/30-kernel-compat.rules @@ -0,0 +1,100 @@ +# do not edit this file, it will be overwritten on update + +# Rules to support older kernels, which migth miss functionality needed +# for the recent udev version. +# +# This file is used and maintained by Gentoo. + +ACTION=="remove", GOTO="kernel_compat_end" + +# +# sysfs timing rules +# + +# needed for kernels <2.6.30 +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", WAIT_FOR_SYSFS="descriptors" + +# +# naming device rules +# + +# dvb device naming +# needed for kernels <2.6.29-rc1 +SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" + +# naming rules for kernels <2.6.31 + +# alsa names +KERNEL=="controlC[0-9]*", NAME="snd/%k" +KERNEL=="hwC[D0-9]*", NAME="snd/%k" +KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" +KERNEL=="midiC[D0-9]*", NAME="snd/%k" +KERNEL=="timer", NAME="snd/%k" +KERNEL=="seq", NAME="snd/%k" + +KERNEL=="mwave", NAME="modems/mwave" + +KERNEL=="mouse*|mice|event*", NAME="input/%k" +KERNEL=="ts[0-9]*|uinput", NAME="input/%k" +KERNEL=="js[0-9]*", NAME="input/%k" + +KERNEL=="card[0-9]*", NAME="dri/%k" + +SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}" + +# libusb device nodes +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" + +# printer +SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k" + +# block +KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" +KERNEL=="pktcdvd", NAME="pktcdvd/control" + +KERNEL=="rawctl", NAME="raw/rawctl" +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k" +SUBSYSTEM=="bsg", NAME="bsg/%k" +SUBSYSTEM=="aoe", NAME="etherd/%k" + +# network +KERNEL=="tun", NAME="net/%k" + +# CPU +KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" +KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" +KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" + +# miscellaneous +KERNEL=="auer[0-9]*", NAME="usb/%k" +KERNEL=="hw_random", NAME="hwrng" +KERNEL=="sxctl", NAME="specialix_sxctl" +KERNEL=="rioctl", NAME="specialix_rioctl" +KERNEL=="iowarrior[0-9]*", NAME="usb/%k" +KERNEL=="hiddev[0-9]*", NAME="usb/%k" +KERNEL=="legousbtower[0-9]*", NAME="usb/%k" +KERNEL=="dabusb[0-9]*", NAME="usb/%k" +KERNEL=="usbdpfp[0-9]*", NAME="usb/%k" +KERNEL=="cpad[0-9]*", NAME="usb/%k" + +# end of naming rules for kernel <2.6.31 + + +# +# module loading rules +# +ACTION!="add", GOTO="kernel_compat_end" + +# No need for more code, as MODALIAS is present +ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" + +# needed for kernel <2.6.30-rc1 +SUBSYSTEM=="scsi", ATTR{type}=="8", RUN+="/sbin/modprobe -b ch" +SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" + +# needed for kernel <2.6.27-rc5 +# acpi will do on newer kernels +SUBSYSTEM=="pnp", DRIVER!="?*", \ + RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" + +LABEL="kernel_compat_end" -- cgit v1.2.3-54-g00ecf From 860a404ddc89ad4bab04955b484954f6bb56448f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 May 2010 15:13:48 +0200 Subject: make: mkdir /lib/udev/devices/ --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index b0eeaf1224..f491900077 100644 --- a/Makefile.am +++ b/Makefile.am @@ -91,6 +91,7 @@ UNINSTALL_EXEC_HOOKS = libudev-uninstall-move-hook # ------------------------------------------------------------------------------ install-data-local: -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d + -mkdir -p $(DESTDIR)$(libexecdir)/devices EXTRA_DIST += \ rules/packages \ -- cgit v1.2.3-54-g00ecf From d43099830bca103cb016dc6446ffb2074573fcf8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 May 2010 15:16:53 +0200 Subject: make: fix rules/ subdir names --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index f491900077..caca2555ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -94,8 +94,8 @@ install-data-local: -mkdir -p $(DESTDIR)$(libexecdir)/devices EXTRA_DIST += \ - rules/packages \ - rules/suse \ + rules/arch \ + rules/misc \ rules/gentoo udevrulesdir = $(libexecdir)/rules.d -- cgit v1.2.3-54-g00ecf From a07c29ca194e3cb1cb4296f76a06d92a97a117f1 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Sun, 30 May 2010 11:39:28 -0500 Subject: Fix wlan key on Inspiron 910 This fixes the wlan key on Inspiron 910. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index c321fbbef4..79490daae6 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -53,7 +53,7 @@ GOTO="keyboard_end" LABEL="keyboard_vendorcheck" ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" -ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 1011|Inspiron 1210", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1011|Inspiron 1210", RUN+="keymap $name 0x84 wlan" ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" -- cgit v1.2.3-54-g00ecf From 1182b9470f61ca00fb600f9af0c148f1e6c04355 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 30 May 2010 23:42:11 +0200 Subject: udevd: set umask before creating files/directories --- udev/udevd.c | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 612f04d1b9..6dd59ae697 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1033,12 +1033,6 @@ int main(int argc, char *argv[]) } } - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - err(udev, "root privileges required\n"); - goto exit; - } - /* * read the kernel commandline, in case we need to get into debug mode * udev.log-priority= syslog priority @@ -1073,7 +1067,17 @@ int main(int argc, char *argv[]) fclose(f); } - /* make sure std{in,out,err} fds are in a sane state */ + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); + err(udev, "root privileges required\n"); + goto exit; + } + + /* set umask before creating any file/directory */ + chdir("/"); + umask(022); + + /* before opening new files, make sure std{in,out,err} fds are in a sane state */ fd = open("/dev/null", O_RDWR); if (fd < 0) { fprintf(stderr, "cannot open /dev/null\n"); @@ -1174,6 +1178,14 @@ int main(int argc, char *argv[]) goto exit; } + if (!debug) { + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + } + if (fd > STDERR_FILENO) + close(fd); + if (daemonize) { pid_t pid; @@ -1191,27 +1203,17 @@ int main(int argc, char *argv[]) } } + /* set scheduling priority for the main daemon process */ + setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); + + setsid(); + f = fopen("/dev/kmsg", "w"); if (f != NULL) { fprintf(f, "<6>udev: starting version " VERSION "\n"); fclose(f); } - if (!debug) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - } - if (fd > STDERR_FILENO) - close(fd); - - /* set scheduling priority for the main daemon process */ - setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); - - chdir("/"); - umask(022); - setsid(); - /* OOM_DISABLE == -17 */ fd = open("/proc/self/oom_adj", O_RDWR); if (fd < 0) { -- cgit v1.2.3-54-g00ecf From c4f6dcc4a5c774c4c5c60c7024d59081deecc7f8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 31 May 2010 01:13:03 +0200 Subject: add IMPORT{cmdline} --- udev/udev-rules.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ udev/udev.xml | 7 +++++++ 2 files changed, 55 insertions(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 11948cacce..0676c51dfe 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -143,6 +143,7 @@ enum token_type { TK_M_IMPORT_FILE, /* val */ TK_M_IMPORT_PROG, /* val */ TK_M_IMPORT_DB, /* val */ + TK_M_IMPORT_CMDLINE, /* val */ TK_M_IMPORT_PARENT, /* val */ TK_M_RESULT, /* val */ TK_M_MAX, @@ -276,6 +277,7 @@ static const char *token_str(enum token_type type) [TK_M_IMPORT_FILE] = "M IMPORT_FILE", [TK_M_IMPORT_PROG] = "M IMPORT_PROG", [TK_M_IMPORT_DB] = "M IMPORT_DB", + [TK_M_IMPORT_CMDLINE] = "M IMPORT_CMDLINE", [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", [TK_M_RESULT] = "M RESULT", [TK_M_MAX] = "M MAX", @@ -342,6 +344,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_M_IMPORT_FILE: case TK_M_IMPORT_PROG: case TK_M_IMPORT_DB: + case TK_M_IMPORT_CMDLINE: case TK_M_IMPORT_PARENT: case TK_M_RESULT: case TK_A_NAME: @@ -1010,6 +1013,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_M_IMPORT_FILE: case TK_M_IMPORT_PROG: case TK_M_IMPORT_DB: + case TK_M_IMPORT_CMDLINE: case TK_M_IMPORT_PARENT: case TK_M_RESULT: case TK_A_OWNER: @@ -1402,6 +1406,9 @@ static int add_rule(struct udev_rules *rules, char *line, } else if (attr != NULL && strstr(attr, "db")) { dbg(rules->udev, "IMPORT will include db values\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_DB, op, value, NULL); + } else if (attr != NULL && strstr(attr, "cmdline")) { + dbg(rules->udev, "IMPORT will include db values\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_CMDLINE, op, value, NULL); } else if (attr != NULL && strstr(attr, "parent")) { dbg(rules->udev, "IMPORT will include the parent values\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); @@ -2329,6 +2336,47 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event } break; } + case TK_M_IMPORT_CMDLINE: + { + FILE *f; + bool imported = false; + + f = fopen("/proc/cmdline", "r"); + if (f != NULL) { + char cmdline[4096]; + + if (fgets(cmdline, sizeof(cmdline), f) != NULL) { + const char *key = &rules->buf[cur->key.value_off]; + char *pos; + + pos = strstr(cmdline, key); + if (pos != NULL) { + struct udev_list_entry *entry; + + pos += strlen(key); + if (pos[0] == '\0' || isspace(pos[0])) { + /* we import simple flags as 'FLAG=1' */ + entry = udev_device_add_property(event->dev, key, "1"); + udev_list_entry_set_flags(entry, 1); + imported = true; + } else if (pos[0] == '=') { + const char *value = &pos[1]; + + while (pos[0] != '\0' && !isspace(pos[0])) + pos++; + pos[0] = '\0'; + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_flags(entry, 1); + imported = true; + } + } + } + fclose(f); + } + if (!imported && cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } case TK_M_IMPORT_PARENT: { char import[UTIL_PATH_SIZE]; diff --git a/udev/udev.xml b/udev/udev.xml index c517766f97..b971fadea6 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -437,6 +437,13 @@ by an earlier event. + + + + Import a single property from the kernel commandline. For simple flags + the value of the property will be set to '1'. + + -- cgit v1.2.3-54-g00ecf From 7d2b68b7345deb10e4a002b8327dae8ae943c1a6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 31 May 2010 11:04:42 +0200 Subject: IMPORT{cmdline}: start at first char after '=' --- udev/udev-rules.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 0676c51dfe..230916a92e 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2360,8 +2360,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event udev_list_entry_set_flags(entry, 1); imported = true; } else if (pos[0] == '=') { - const char *value = &pos[1]; + const char *value; + pos++; + value = pos; while (pos[0] != '\0' && !isspace(pos[0])) pos++; pos[0] = '\0'; -- cgit v1.2.3-54-g00ecf From a7d29d15095a7977c02fa3a6bb1efe627dcdd2f4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 31 May 2010 11:18:52 +0200 Subject: libudev: doc - fix typo --- libudev/libudev-queue.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index be8804bdd0..163e6229fe 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -28,9 +28,9 @@ * SECTION:libudev-queue * @short_description: access to currently active events * - * The udev daemon processes event asynchronously. All events which do not have - * interdependencies are run in parallel. This exports the current state of the - * event processing queue, and the currently event sequence numbers from the kernel + * The udev daemon processes events asynchronously. All events which do not have + * interdependencies run in parallel. This exports the current state of the + * event processing queue, and the current event sequence numbers from the kernel * and the udev daemon. */ -- cgit v1.2.3-54-g00ecf From 873f34556d4f66a038a9e91b58bae826c1beac84 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 31 May 2010 11:19:31 +0200 Subject: update NEWS --- NEWS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1e92f468e1..0c5781250c 100644 --- a/NEWS +++ b/NEWS @@ -5,7 +5,7 @@ Bugfixes. The option --debug-trace and the environemnt variable UDEVD_MAX_CHILDS= was removed from udevd. -Udevd now parses the kernel commandline for the following variables: +Udevd now checks the kernel commandline for the following variables: udev.log-priority= udev.children-max= udev.exec-delay= -- cgit v1.2.3-54-g00ecf From ca3fe48dc322af223c2b6e68c8818739d0121198 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Wed, 2 Jun 2010 01:27:31 -0500 Subject: Fix wlan key on Inspiron 1010 & 1110 This fixes wlan key on Inspirion 1010 & 1110. This patch depends on previous patches sent. The issue with all of these is that they were all Dell mini & it wasn't noticed till recent that they all did not follow the standard that the rest of Dell machines follow. Also to note while this fixes the wlan key sending the proper key press, work is still needed at the kernel level for complete support. This is the last patch all the Dell minis have been verified to all have this issue, and are now covered. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 79490daae6..8ed2b592d8 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -53,7 +53,7 @@ GOTO="keyboard_end" LABEL="keyboard_vendorcheck" ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" -ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1011|Inspiron 1210", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1010|Inspiron 1011|Inspiron 1012|Inspiron 1110|Inspiron 1210", RUN+="keymap $name 0x84 wlan" ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" -- cgit v1.2.3-54-g00ecf From ab6e9d3dde47214b00a55a8ee1f7bfae0ec3af65 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Jun 2010 13:49:47 +0200 Subject: release 157 --- ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/ChangeLog b/ChangeLog index 79b663dafa..2b7747fe5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Summary of changes from v156 to v157 +============================================ + +Harald Hoyer (1): + 40-redhat.rules: removed file + +Jerone Young (3): + Fix wlan key on Inspirion 1210 + Fix wlan key on Inspiron 910 + Fix wlan key on Inspiron 1010 & 1110 + +Kay Sievers (25): + configure.ac: version bump + Makefile.am: silent build mkdir + rules: mount fuse control filesystem + fix compilation with --enable-debug + while (1) -> for (;;) + childs -> children + udevd: replace --debug-trace with --children-max + udevd: fix comments + rules: add -v to modprobe calls to be able see what will be loaded + udevd: read debug settings from kernel commandline + update NEWS + rules: delete pilot rules and remove redhat directory + man: add static device nodes and udevd debug options + man: add kernel command line parameters + man: udevd - update intro + rules: rename packages -> arch + rules: SUSE - move last distro rule to package + rules: add misc/30-kernel-compat.rules + make: mkdir /lib/udev/devices/ + make: fix rules/ subdir names + udevd: set umask before creating files/directories + add IMPORT{cmdline} + IMPORT{cmdline}: start at first char after '=' + libudev: doc - fix typo + update NEWS + + Summary of changes from v155 to v156 ============================================ -- cgit v1.2.3-54-g00ecf From 76e6bc280809f91c2660cbeba41e8ed6b2cbd02c Mon Sep 17 00:00:00 2001 From: Paul Bender Date: Wed, 2 Jun 2010 17:35:44 +0200 Subject: configure.ac: fix cross compilation "Be aware that, like most Autoconf macros, they test a feature of the host machine, and therefore, they die when cross-compiling" --- configure.ac | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 81233bf29b..df8a95b3bb 100644 --- a/configure.ac +++ b/configure.ac @@ -87,17 +87,21 @@ if test "x$enable_extras" = xyes; then PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) - AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) - AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) - AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) + if test "x$cross_compiling" = "xno" ; then + AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) + AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) + AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) + fi AC_ARG_WITH(pci-ids-path, - AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file]), + [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], [PCI_DATABASE=${withval}], [if test -n "$pciids" ; then PCI_DATABASE="$pciids" else AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) fi]) + AC_MSG_CHECKING([for PCI database location]) + AC_MSG_RESULT([$PCI_DATABASE]) AC_SUBST(PCI_DATABASE) AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) -- cgit v1.2.3-54-g00ecf From 94aa758d0c4c3d01d70e2480db63224250a47d89 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Jun 2010 20:31:51 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 0c5781250c..2ba32b0926 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 158 +======== +Bugfixes. + udev 157 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index df8a95b3bb..7e9b1f8a58 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [157], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [158], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 727b12d6500f6e08c4ae2ad2ce75281f03d0ffcb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Jun 2010 10:30:36 +0200 Subject: libudev: fix fd leak in udev_enumerate_scan_devices() when tags are searched Thanks to Lennart for finding this. --- Makefile.am | 2 +- libudev/libudev-enumerate.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index caca2555ff..bafe4c7fac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ CLEANFILES = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=8 -LIBUDEV_REVISION=2 +LIBUDEV_REVISION=3 LIBUDEV_AGE=8 SUBDIRS += libudev/docs diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index da831449dc..f13e56f2f7 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -735,6 +735,7 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) syspath_add(udev_enumerate, udev_device_get_syspath(dev)); udev_device_unref(dev); } + closedir(dir); } } else { util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); -- cgit v1.2.3-54-g00ecf From ba854cf8c32a85e9415debdb8d2a7292ddb3c452 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 11 Jun 2010 15:14:55 +0200 Subject: Fix hid2hci rules harder Commit 2b463cb0 changed the rules to match against hiddev* for all devices in an attempt to fix Debian #567237/LP #444420. However, this caused regressions with other devices (e. g. LP #550288) and thus was reverted in commit 8b56ba. Now use hidraw* for the devices where it's confirmed that they only work with that, and hiddev* for the others. https://launchpad.net/bugs/444420 --- extras/hid2hci/70-hid2hci.rules | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index 72e70a0465..c5528f023b 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -11,7 +11,9 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" # Logitech devices (hidraw) -KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345abce]|c71[34bc]", \ +KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345bce]|c71[34bc]", \ + RUN+="hid2hci --method=logitech-hid --devpath=%p" +KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70a", \ RUN+="hid2hci --method=logitech-hid --devpath=%p" ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" -- cgit v1.2.3-54-g00ecf From 6a7b5ec7712ea53fd756b07036e23ac0d751cec4 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sat, 12 Jun 2010 23:52:52 +0200 Subject: add Vala vapi for gudev-1.0 Add gudev-1.0.vapi. This is based on the output of vapigen --library gudev-1.0 GUdev-1.0.gir with fixes to array/list semantics and include file names. --- Makefile.am | 8 ++- extras/gudev/gudev-1.0.vapi | 118 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 extras/gudev/gudev-1.0.vapi diff --git a/Makefile.am b/Makefile.am index bafe4c7fac..010cc714e0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -350,11 +350,17 @@ extras_gudev_libgudev_1_0_la_LDFLAGS = \ -export-dynamic -no-undefined \ -export-symbols-regex '^g_udev_.*' +gudev-install-hook: + install -D -m 644 $(top_srcdir)/extras/gudev/gudev-1.0.vapi $(DESTDIR)$(prefix)/share/vala/vapi/gudev-1.0.vapi + +INSTALL_EXEC_HOOKS += gudev-install-hook + EXTRA_DIST += \ extras/gudev/COPYING \ extras/gudev/gudevmarshal.list \ extras/gudev/gudevenumtypes.h.template \ - extras/gudev/gudevenumtypes.c.template + extras/gudev/gudevenumtypes.c.template \ + extras/gudev/gudev-1.0.vapi extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ diff --git a/extras/gudev/gudev-1.0.vapi b/extras/gudev/gudev-1.0.vapi new file mode 100644 index 0000000000..93a07a5671 --- /dev/null +++ b/extras/gudev/gudev-1.0.vapi @@ -0,0 +1,118 @@ +/* gudev-1.0.vapi + * + * (C) 2010 Martin Pitt + * Based on vapigen output, with fixes to array/list semantics and + * include file names. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + */ + +[CCode (cprefix = "GUdev", lower_case_cprefix = "g_udev_")] +namespace GUdev { + [CCode (cheader_filename = "gudev/gudev.h")] + public class Client : GLib.Object { + public weak GLib.Object parent; + public GUdev.ClientPrivate priv; + [CCode (has_construct_function = false)] + public Client ([CCode (array_length = false, array_null_terminated = true)] string[]? subsystems); + [CCode (cname = "g_udev_client_query_by_device_file")] + public GUdev.Device query_by_device_file (string device_file); + [CCode (cname = "g_udev_client_query_by_device_number")] + public GUdev.Device query_by_device_number (GUdev.DeviceType type, GUdev.DeviceNumber number); + [CCode (cname = "g_udev_client_query_by_subsystem")] + public GLib.List query_by_subsystem (string? subsystem); + [CCode (cname = "g_udev_client_query_by_subsystem_and_name")] + public GUdev.Device query_by_subsystem_and_name (string subsystem, string name); + [CCode (cname = "g_udev_client_query_by_sysfs_path")] + public GUdev.Device query_by_sysfs_path (string sysfs_path); + public signal void uevent (string action, GUdev.Device device); + } + [CCode (cheader_filename = "gudev/gudev.h")] + public class Device : GLib.Object { + public weak GLib.Object parent; + public GUdev.DevicePrivate priv; + [CCode (cname = "g_udev_device_get_action")] + public unowned string get_action (); + [CCode (cname = "g_udev_device_get_device_file")] + public unowned string get_device_file (); + [CCode (cname = "g_udev_device_get_device_file_symlinks", array_length = false, array_null_terminated = true)] + public unowned string[] get_device_file_symlinks (); + [CCode (cname = "g_udev_device_get_device_number")] + public GUdev.DeviceNumber get_device_number (); + [CCode (cname = "g_udev_device_get_device_type")] + public GUdev.DeviceType get_device_type (); + [CCode (cname = "g_udev_device_get_devtype")] + public unowned string get_devtype (); + [CCode (cname = "g_udev_device_get_driver")] + public unowned string get_driver (); + [CCode (cname = "g_udev_device_get_name")] + public unowned string get_name (); + [CCode (cname = "g_udev_device_get_number")] + public unowned string get_number (); + [CCode (cname = "g_udev_device_get_parent")] + public GUdev.Device get_parent (); + [CCode (cname = "g_udev_device_get_parent_with_subsystem")] + public GUdev.Device get_parent_with_subsystem (string subsystem, string? devtype); + [CCode (cname = "g_udev_device_get_property")] + public unowned string get_property (string key); + [CCode (cname = "g_udev_device_get_property_as_boolean")] + public bool get_property_as_boolean (string key); + [CCode (cname = "g_udev_device_get_property_as_double")] + public double get_property_as_double (string key); + [CCode (cname = "g_udev_device_get_property_as_int")] + public int get_property_as_int (string key); + [CCode (cname = "g_udev_device_get_property_as_strv", array_length = false, array_null_terminated = true)] + public unowned string[] get_property_as_strv (string key); + [CCode (cname = "g_udev_device_get_property_as_uint64")] + public uint64 get_property_as_uint64 (string key); + [CCode (cname = "g_udev_device_get_property_keys", array_length = false, array_null_terminated = true)] + public unowned string[] get_property_keys (); + [CCode (cname = "g_udev_device_get_seqnum")] + public uint64 get_seqnum (); + [CCode (cname = "g_udev_device_get_subsystem")] + public unowned string get_subsystem (); + [CCode (cname = "g_udev_device_get_sysfs_attr")] + public unowned string get_sysfs_attr (string name); + [CCode (cname = "g_udev_device_get_sysfs_attr_as_boolean")] + public bool get_sysfs_attr_as_boolean (string name); + [CCode (cname = "g_udev_device_get_sysfs_attr_as_double")] + public double get_sysfs_attr_as_double (string name); + [CCode (cname = "g_udev_device_get_sysfs_attr_as_int")] + public int get_sysfs_attr_as_int (string name); + [CCode (cname = "g_udev_device_get_sysfs_attr_as_strv", array_length = false, array_null_terminated = true)] + public unowned string[] get_sysfs_attr_as_strv (string name); + [CCode (cname = "g_udev_device_get_sysfs_attr_as_uint64")] + public uint64 get_sysfs_attr_as_uint64 (string name); + [CCode (cname = "g_udev_device_get_sysfs_path")] + public unowned string get_sysfs_path (); + [CCode (cname = "g_udev_device_has_property")] + public bool has_property (string key); + } + [CCode (type_id = "GUDEV_TYPE_CLIENT_PRIVATE", cheader_filename = "gudev/gudev.h")] + public struct ClientPrivate { + } + [CCode (cheader_filename = "gudev/gudev.h")] + [SimpleType] + [IntegerType (rank = 0)] + public struct DeviceNumber : uint64 { + } + [CCode (type_id = "GUDEV_TYPE_DEVICE_PRIVATE", cheader_filename = "gudev/gudev.h")] + public struct DevicePrivate { + } + [CCode (cprefix = "G_UDEV_DEVICE_TYPE_", cheader_filename = "gudev/gudev.h")] + public enum DeviceType { + NONE, + BLOCK, + CHAR + } + [CCode (cheader_filename = "gudev/gudev.h")] + public const int GUDEV_INSIDE_GUDEV_H; +} -- cgit v1.2.3-54-g00ecf From dcaa863948238e7ad6916f0100cf83fb83b0c1c3 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 13 Jun 2010 10:08:22 +0200 Subject: Revert "add Vala vapi for gudev-1.0" Argh, recent vala already ships with a gudev vapi. This reverts commit 6a7b5ec7712ea53fd756b07036e23ac0d751cec4. --- Makefile.am | 8 +-- extras/gudev/gudev-1.0.vapi | 118 -------------------------------------------- 2 files changed, 1 insertion(+), 125 deletions(-) delete mode 100644 extras/gudev/gudev-1.0.vapi diff --git a/Makefile.am b/Makefile.am index 010cc714e0..bafe4c7fac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -350,17 +350,11 @@ extras_gudev_libgudev_1_0_la_LDFLAGS = \ -export-dynamic -no-undefined \ -export-symbols-regex '^g_udev_.*' -gudev-install-hook: - install -D -m 644 $(top_srcdir)/extras/gudev/gudev-1.0.vapi $(DESTDIR)$(prefix)/share/vala/vapi/gudev-1.0.vapi - -INSTALL_EXEC_HOOKS += gudev-install-hook - EXTRA_DIST += \ extras/gudev/COPYING \ extras/gudev/gudevmarshal.list \ extras/gudev/gudevenumtypes.h.template \ - extras/gudev/gudevenumtypes.c.template \ - extras/gudev/gudev-1.0.vapi + extras/gudev/gudevenumtypes.c.template extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ diff --git a/extras/gudev/gudev-1.0.vapi b/extras/gudev/gudev-1.0.vapi deleted file mode 100644 index 93a07a5671..0000000000 --- a/extras/gudev/gudev-1.0.vapi +++ /dev/null @@ -1,118 +0,0 @@ -/* gudev-1.0.vapi - * - * (C) 2010 Martin Pitt - * Based on vapigen output, with fixes to array/list semantics and - * include file names. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - */ - -[CCode (cprefix = "GUdev", lower_case_cprefix = "g_udev_")] -namespace GUdev { - [CCode (cheader_filename = "gudev/gudev.h")] - public class Client : GLib.Object { - public weak GLib.Object parent; - public GUdev.ClientPrivate priv; - [CCode (has_construct_function = false)] - public Client ([CCode (array_length = false, array_null_terminated = true)] string[]? subsystems); - [CCode (cname = "g_udev_client_query_by_device_file")] - public GUdev.Device query_by_device_file (string device_file); - [CCode (cname = "g_udev_client_query_by_device_number")] - public GUdev.Device query_by_device_number (GUdev.DeviceType type, GUdev.DeviceNumber number); - [CCode (cname = "g_udev_client_query_by_subsystem")] - public GLib.List query_by_subsystem (string? subsystem); - [CCode (cname = "g_udev_client_query_by_subsystem_and_name")] - public GUdev.Device query_by_subsystem_and_name (string subsystem, string name); - [CCode (cname = "g_udev_client_query_by_sysfs_path")] - public GUdev.Device query_by_sysfs_path (string sysfs_path); - public signal void uevent (string action, GUdev.Device device); - } - [CCode (cheader_filename = "gudev/gudev.h")] - public class Device : GLib.Object { - public weak GLib.Object parent; - public GUdev.DevicePrivate priv; - [CCode (cname = "g_udev_device_get_action")] - public unowned string get_action (); - [CCode (cname = "g_udev_device_get_device_file")] - public unowned string get_device_file (); - [CCode (cname = "g_udev_device_get_device_file_symlinks", array_length = false, array_null_terminated = true)] - public unowned string[] get_device_file_symlinks (); - [CCode (cname = "g_udev_device_get_device_number")] - public GUdev.DeviceNumber get_device_number (); - [CCode (cname = "g_udev_device_get_device_type")] - public GUdev.DeviceType get_device_type (); - [CCode (cname = "g_udev_device_get_devtype")] - public unowned string get_devtype (); - [CCode (cname = "g_udev_device_get_driver")] - public unowned string get_driver (); - [CCode (cname = "g_udev_device_get_name")] - public unowned string get_name (); - [CCode (cname = "g_udev_device_get_number")] - public unowned string get_number (); - [CCode (cname = "g_udev_device_get_parent")] - public GUdev.Device get_parent (); - [CCode (cname = "g_udev_device_get_parent_with_subsystem")] - public GUdev.Device get_parent_with_subsystem (string subsystem, string? devtype); - [CCode (cname = "g_udev_device_get_property")] - public unowned string get_property (string key); - [CCode (cname = "g_udev_device_get_property_as_boolean")] - public bool get_property_as_boolean (string key); - [CCode (cname = "g_udev_device_get_property_as_double")] - public double get_property_as_double (string key); - [CCode (cname = "g_udev_device_get_property_as_int")] - public int get_property_as_int (string key); - [CCode (cname = "g_udev_device_get_property_as_strv", array_length = false, array_null_terminated = true)] - public unowned string[] get_property_as_strv (string key); - [CCode (cname = "g_udev_device_get_property_as_uint64")] - public uint64 get_property_as_uint64 (string key); - [CCode (cname = "g_udev_device_get_property_keys", array_length = false, array_null_terminated = true)] - public unowned string[] get_property_keys (); - [CCode (cname = "g_udev_device_get_seqnum")] - public uint64 get_seqnum (); - [CCode (cname = "g_udev_device_get_subsystem")] - public unowned string get_subsystem (); - [CCode (cname = "g_udev_device_get_sysfs_attr")] - public unowned string get_sysfs_attr (string name); - [CCode (cname = "g_udev_device_get_sysfs_attr_as_boolean")] - public bool get_sysfs_attr_as_boolean (string name); - [CCode (cname = "g_udev_device_get_sysfs_attr_as_double")] - public double get_sysfs_attr_as_double (string name); - [CCode (cname = "g_udev_device_get_sysfs_attr_as_int")] - public int get_sysfs_attr_as_int (string name); - [CCode (cname = "g_udev_device_get_sysfs_attr_as_strv", array_length = false, array_null_terminated = true)] - public unowned string[] get_sysfs_attr_as_strv (string name); - [CCode (cname = "g_udev_device_get_sysfs_attr_as_uint64")] - public uint64 get_sysfs_attr_as_uint64 (string name); - [CCode (cname = "g_udev_device_get_sysfs_path")] - public unowned string get_sysfs_path (); - [CCode (cname = "g_udev_device_has_property")] - public bool has_property (string key); - } - [CCode (type_id = "GUDEV_TYPE_CLIENT_PRIVATE", cheader_filename = "gudev/gudev.h")] - public struct ClientPrivate { - } - [CCode (cheader_filename = "gudev/gudev.h")] - [SimpleType] - [IntegerType (rank = 0)] - public struct DeviceNumber : uint64 { - } - [CCode (type_id = "GUDEV_TYPE_DEVICE_PRIVATE", cheader_filename = "gudev/gudev.h")] - public struct DevicePrivate { - } - [CCode (cprefix = "G_UDEV_DEVICE_TYPE_", cheader_filename = "gudev/gudev.h")] - public enum DeviceType { - NONE, - BLOCK, - CHAR - } - [CCode (cheader_filename = "gudev/gudev.h")] - public const int GUDEV_INSIDE_GUDEV_H; -} -- cgit v1.2.3-54-g00ecf From 2da64971fd6756eba4806e8abb4b42fff4675054 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 17 Jun 2010 13:19:50 +0200 Subject: Fix usb printer rule for multiple USB interfaces Commit f61e72d89 failed to match for the case where an USB printer has multiple interfaces, such as ID_USB_INTERFACES=:ffffff:070102: Thanks to Pablo Mazzini for spotting this! --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 667c3e8ef2..10cfbd6157 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -68,7 +68,7 @@ KERNEL=="irlpt[0-9]*", GROUP="lp" # hplip and cups 1.4+ use raw USB devices, so permissions should be similar to # the ones from the old usblp kernel module SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}==":0701*:", GROUP="lp", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701*:", GROUP="lp", MODE="0664" # block SUBSYSTEM=="block", GROUP="disk" -- cgit v1.2.3-54-g00ecf From a65aa40f8a96504bdcabd6a66a24f5756413bbc2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 17 Jun 2010 21:50:58 +0200 Subject: udevd: in case we don't daemonize, send READY message to /sbin/init --- udev/udevd.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/udev/udevd.c b/udev/udevd.c index 6dd59ae697..e38c601649 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -950,6 +951,81 @@ static int mem_size_mb(void) return memsize; } +static int init_notify(const char *state) +{ + int fd = -1, r; + struct msghdr msghdr; + struct iovec iovec; + struct ucred *ucred; + union { + struct sockaddr sa; + struct sockaddr_un un; + } sockaddr; + union { + struct cmsghdr cmsghdr; + uint8_t buf[CMSG_SPACE(sizeof(struct ucred))]; + } control; + const char *e; + + if (!(e = getenv("NOTIFY_SOCKET"))) { + r = 0; + goto finish; + } + + /* Must be an abstract socket, or an absolute path */ + if ((e[0] != '@' && e[0] != '/') || e[1] == 0) { + r = -EINVAL; + goto finish; + } + + if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) { + r = -errno; + goto finish; + } + + memset(&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sa.sa_family = AF_UNIX; + strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path)); + + if (sockaddr.un.sun_path[0] == '@') + sockaddr.un.sun_path[0] = 0; + + memset(&iovec, 0, sizeof(iovec)); + iovec.iov_base = (char*) state; + iovec.iov_len = strlen(state); + + memset(&control, 0, sizeof(control)); + control.cmsghdr.cmsg_level = SOL_SOCKET; + control.cmsghdr.cmsg_type = SCM_CREDENTIALS; + control.cmsghdr.cmsg_len = CMSG_LEN(sizeof(struct ucred)); + + ucred = (struct ucred*) CMSG_DATA(&control.cmsghdr); + ucred->pid = getpid(); + ucred->uid = getuid(); + ucred->gid = getgid(); + + memset(&msghdr, 0, sizeof(msghdr)); + msghdr.msg_name = &sockaddr; + msghdr.msg_namelen = sizeof(struct sockaddr_un); + msghdr.msg_iov = &iovec; + msghdr.msg_iovlen = 1; + msghdr.msg_control = &control; + msghdr.msg_controllen = control.cmsghdr.cmsg_len; + + if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { + r = -errno; + goto finish; + } + + r = 0; + +finish: + if (fd >= 0) + close(fd); + + return r; +} + int main(int argc, char *argv[]) { struct udev *udev; @@ -1201,6 +1277,8 @@ int main(int argc, char *argv[]) rc = 0; goto exit; } + } else { + init_notify("READY=1"); } /* set scheduling priority for the main daemon process */ -- cgit v1.2.3-54-g00ecf From bc6788184011fc05bfd3c59f0252d90ac0263c33 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Jun 2010 10:06:10 +0200 Subject: delete last distro specific rules --- rules/gentoo/30-kernel-compat.rules | 95 ------------------------------------- rules/gentoo/40-gentoo.rules | 19 -------- rules/gentoo/90-network.rules | 8 ---- 3 files changed, 122 deletions(-) delete mode 100644 rules/gentoo/30-kernel-compat.rules delete mode 100644 rules/gentoo/40-gentoo.rules delete mode 100644 rules/gentoo/90-network.rules diff --git a/rules/gentoo/30-kernel-compat.rules b/rules/gentoo/30-kernel-compat.rules deleted file mode 100644 index 213e218d93..0000000000 --- a/rules/gentoo/30-kernel-compat.rules +++ /dev/null @@ -1,95 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add|change", GOTO="kernel_compat_end" - -# -# sysfs timing rules -# - -# needed for kernels <2.6.30 -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", WAIT_FOR_SYSFS="descriptors" - -# -# naming device rules -# - -# dvb device naming -# needed for kernels <2.6.29-rc1 -SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" - -# naming rules for kernels <2.6.31 - -# alsa names -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -KERNEL=="mwave", NAME="modems/mwave" - -KERNEL=="mouse*|mice|event*", NAME="input/%k" -KERNEL=="ts[0-9]*|uinput", NAME="input/%k" -KERNEL=="js[0-9]*", NAME="input/%k" - -KERNEL=="card[0-9]*", NAME="dri/%k" - -SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}" - -# libusb device nodes -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" - -# printer -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k" - -# block -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" -KERNEL=="pktcdvd", NAME="pktcdvd/control" - -KERNEL=="rawctl", NAME="raw/rawctl" -SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k" -SUBSYSTEM=="bsg", NAME="bsg/%k" -SUBSYSTEM=="aoe", NAME="etherd/%k" - -# network -KERNEL=="tun", NAME="net/%k" - -# CPU -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" - -# miscellaneous -KERNEL=="auer[0-9]*", NAME="usb/%k" -KERNEL=="hw_random", NAME="hwrng" -KERNEL=="sxctl", NAME="specialix_sxctl" -KERNEL=="rioctl", NAME="specialix_rioctl" -KERNEL=="iowarrior[0-9]*", NAME="usb/%k" -KERNEL=="hiddev[0-9]*", NAME="usb/%k" -KERNEL=="legousbtower[0-9]*", NAME="usb/%k" -KERNEL=="dabusb[0-9]*", NAME="usb/%k" -KERNEL=="usbdpfp[0-9]*", NAME="usb/%k" -KERNEL=="cpad[0-9]*", NAME="usb/%k" - -# end of naming rules for kernel <2.6.31 - - -# -# module loading rules -# -ACTION!="add", GOTO="kernel_compat_end" - -# No need for more code, as MODALIAS is present -ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" - -# needed for kernel <2.6.30-rc1 -SUBSYSTEM=="scsi", ATTR{type}=="8", RUN+="/sbin/modprobe -b ch" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" - -# needed for kernel <2.6.27-rc5 -# acpi will do on newer kernels -SUBSYSTEM=="pnp", DRIVER!="?*", \ - RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" - -LABEL="kernel_compat_end" diff --git a/rules/gentoo/40-gentoo.rules b/rules/gentoo/40-gentoo.rules deleted file mode 100644 index 91a754597b..0000000000 --- a/rules/gentoo/40-gentoo.rules +++ /dev/null @@ -1,19 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# keep devices after driver unload -KERNEL=="ppp", OPTIONS+="ignore_remove" -KERNEL=="tun", OPTIONS+="ignore_remove" - - -# setting permissions -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb" - -# dialout devices -KERNEL=="ippp*|isdn*|dcbri*|rfcomm*|ttyACM[0-9]*|pilot", GROUP="dialout" - -# sound devices (oss) -SUBSYSTEM=="snd", GROUP="audio" - -# Sony Vaio Jogdial sonypi device -KERNEL=="sonypi", MODE="0666" - diff --git a/rules/gentoo/90-network.rules b/rules/gentoo/90-network.rules deleted file mode 100644 index 50903af157..0000000000 --- a/rules/gentoo/90-network.rules +++ /dev/null @@ -1,8 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# /etc/udev/rules/90-network.rules: triggering network init-scripts - -# Activate our network if we can -SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start" -SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop" - -- cgit v1.2.3-54-g00ecf From eb2de7acdb741c8a67511c4c458efa93835e18a7 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 21 Jun 2010 14:04:43 +0200 Subject: extras/keymap: add Samsung N210 to keymap rules https://bugzilla.redhat.com/show_bug.cgi?id=606302 Thanks to John Floyd! --- extras/keymap/95-keyboard-force-release.rules | 2 +- extras/keymap/95-keymap.rules | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 7c334ce609..36d569aea8 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*N210*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 8ed2b592d8..26666a9f55 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -110,7 +110,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*N210*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" -- cgit v1.2.3-54-g00ecf From e0f83fbe865345c7fe85ee622bc3fe3f50f68212 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 21 Jun 2010 16:55:16 +0200 Subject: remove a few comments in file headers --- extras/ata_id/ata_id.c | 3 +-- extras/scsi_id/scsi_id.c | 7 +------ extras/scsi_id/scsi_id.h | 7 +------ extras/scsi_id/scsi_serial.c | 7 +------ 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 25c7710127..bf1debe028 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -1,5 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * +/* * ata_id - reads product/serial number from ATA drives * * Copyright (C) 2005-2008 Kay Sievers diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 5c40658556..d7dfe3ebeb 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -1,9 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * scsi_id.c - * - * Main section of the scsi_id program - * +/* * Copyright (C) IBM Corp. 2003 * Copyright (C) SUSE Linux Products GmbH, 2006 * diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 3b8b236368..ff5b70d17b 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -1,9 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * scsi_id.h - * - * General defines and such for scsi_id - * +/* * Copyright (C) IBM Corp. 2003 * * This program is free software; you can redistribute it and/or modify it diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 8752e14971..22456b7732 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -1,9 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * scsi_serial.c - * - * Code related to requesting and getting an id from a scsi device - * +/* * Copyright (C) IBM Corp. 2003 * * Author: -- cgit v1.2.3-54-g00ecf From 674c3412bb5c921e611ad1289e21e9e3b4df9bf7 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Wed, 23 Jun 2010 22:20:29 +0200 Subject: mtd_probe: add autodetection for xD cards commit 2599cabd36770785a13bf884049d649d385fd80c Author: Maxim Levitsky Date: Fri Jun 18 02:08:48 2010 +0300 Add autodetection for xD/smartmedia cards This can easily be extended for other types of FTL Signed-off-by: Maxim Levitsky --- Makefile.am | 15 ++++++ extras/mtd_probe/75-probe_mtd.rules | 10 ++++ extras/mtd_probe/mtd_probe.c | 54 ++++++++++++++++++++ extras/mtd_probe/mtd_probe.h | 51 +++++++++++++++++++ extras/mtd_probe/probe_smartmedia.c | 99 +++++++++++++++++++++++++++++++++++++ 5 files changed, 229 insertions(+) create mode 100644 extras/mtd_probe/75-probe_mtd.rules create mode 100644 extras/mtd_probe/mtd_probe.c create mode 100644 extras/mtd_probe/mtd_probe.h create mode 100644 extras/mtd_probe/probe_smartmedia.c diff --git a/Makefile.am b/Makefile.am index bafe4c7fac..5e9234a699 100644 --- a/Makefile.am +++ b/Makefile.am @@ -466,6 +466,21 @@ dist_udevrules_DATA += \ libexec_PROGRAMS += extras/mobile-action-modeswitch/mobile-action-modeswitch +# ------------------------------------------------------------------------------ +# mtd_probe - autoloads FTL module for mtd devices +# ------------------------------------------------------------------------------ +extras_mtd_probe_mtd_probe_SOURCES = \ + extras/mtd_probe/mtd_probe.c \ + extras/mtd_probe/mtd_probe.h \ + extras/mtd_probe/probe_smartmedia.c + +extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) + +dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules + +libexec_PROGRAMS += extras/mtd_probe/mtd_probe + + # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ diff --git a/extras/mtd_probe/75-probe_mtd.rules b/extras/mtd_probe/75-probe_mtd.rules new file mode 100644 index 0000000000..1d1b398175 --- /dev/null +++ b/extras/mtd_probe/75-probe_mtd.rules @@ -0,0 +1,10 @@ +#probe mtd devices for FTL + +ACTION!="add", GOTO="mtd_probe_end" + +KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" +KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN+="/sbin/modprobe sm_ftl" + + +LABEL="mtd_probe_end" + diff --git a/extras/mtd_probe/mtd_probe.c b/extras/mtd_probe/mtd_probe.c new file mode 100644 index 0000000000..d335b0628a --- /dev/null +++ b/extras/mtd_probe/mtd_probe.c @@ -0,0 +1,54 @@ +/* + * mtd_probe.c + * This file is part of mtd_probe + * + * Copyright (C) 2010 - Maxim Levitsky + * + * mtd_probe 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; either version 2 of the License, or + * (at your option) any later version. + * + * mtd_probe 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 mtd_probe; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ +#include "mtd_probe.h" +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) { + + if (argc != 2) { + printf("usage: mtd_probe /dev/mtd[n]\n"); + return 1; + } + + int mtd_fd = open(argv[1], O_RDONLY); + if (mtd_fd == -1) { + perror("open"); + exit(-1); + } + + mtd_info_t mtd_info; + int error = ioctl(mtd_fd, MEMGETINFO, &mtd_info); + if (error == -1) { + perror("ioctl"); + exit(-1); + } + + probe_smart_media(mtd_fd, &mtd_info); + return -1; +} diff --git a/extras/mtd_probe/mtd_probe.h b/extras/mtd_probe/mtd_probe.h new file mode 100644 index 0000000000..845a7a13d9 --- /dev/null +++ b/extras/mtd_probe/mtd_probe.h @@ -0,0 +1,51 @@ +/* + * mtd_probe.h + * This file is part of mtd_probe + * + * Copyright (C) 2010 - Maxim Levitsky + * + * mtd_probe 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; either version 2 of the License, or + * (at your option) any later version. + * + * mtd_probe 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 mtd_probe; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ +#include + +/* Full oob structure as written on the flash */ +struct sm_oob { + uint32_t reserved; + uint8_t data_status; + uint8_t block_status; + uint8_t lba_copy1[2]; + uint8_t ecc2[3]; + uint8_t lba_copy2[2]; + uint8_t ecc1[3]; +} __attribute__((packed)); + + +/* one sector is always 512 bytes, but it can consist of two nand pages */ +#define SM_SECTOR_SIZE 512 + +/* oob area is also 16 bytes, but might be from two pages */ +#define SM_OOB_SIZE 16 + +/* This is maximum zone size, and all devices that have more that one zone + have this size */ +#define SM_MAX_ZONE_SIZE 1024 + +/* support for small page nand */ +#define SM_SMALL_PAGE 256 +#define SM_SMALL_OOB_SIZE 8 + + +void probe_smart_media(int mtd_fd, mtd_info_t *info); diff --git a/extras/mtd_probe/probe_smartmedia.c b/extras/mtd_probe/probe_smartmedia.c new file mode 100644 index 0000000000..ab6edea4b1 --- /dev/null +++ b/extras/mtd_probe/probe_smartmedia.c @@ -0,0 +1,99 @@ +/* + * probe_smartmedia.c + * This file is part of mtd_probe + * + * Copyright (C) 2010 - Maxim Levitsky + * + * mtd_probe 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; either version 2 of the License, or + * (at your option) any later version. + * + * mtd_probe 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 mtd_probe; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include "mtd_probe.h" + +static const uint8_t cis_signature[] = { + 0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20 +}; + + +void probe_smart_media(int mtd_fd, mtd_info_t* info) { + + char* cis_buffer = malloc(SM_SECTOR_SIZE); + if (!cis_buffer) + return; + + if (info->type != MTD_NANDFLASH) + goto exit; + + int sector_size = info->writesize; + int block_size = info->erasesize; + int size_in_megs = info->size / (1024 * 1024); + int spare_count; + + + if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE) + goto exit; + + switch(size_in_megs) { + case 1: + case 2: + spare_count = 6; + break; + case 4: + spare_count = 12; + break; + default: + spare_count = 24; + break; + } + + + int offset; + int cis_found = 0; + + for (offset = 0 ; offset < block_size * spare_count ; + offset += sector_size) { + + lseek(mtd_fd, SEEK_SET, offset); + if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){ + cis_found = 1; + break; + } + } + + if (!cis_found) + goto exit; + + if (memcmp(cis_buffer, cis_signature, sizeof(cis_signature)) != 0 && + (memcmp(cis_buffer + SM_SMALL_PAGE, cis_signature, + sizeof(cis_signature)) != 0)) + goto exit; + + printf("MTD_FTL=smartmedia\n"); + free(cis_buffer); + exit(0); +exit: + free(cis_buffer); + return; +} -- cgit v1.2.3-54-g00ecf From 5f307a98fadcded368bbe8f95c445d0cc152a93e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Jun 2010 22:29:58 +0200 Subject: mtd_probe: add needed include, modprobe blacklist flag, and change some whitespace --- extras/mtd_probe/75-probe_mtd.rules | 6 ++---- extras/mtd_probe/mtd_probe.c | 9 +++------ extras/mtd_probe/mtd_probe.h | 4 +--- extras/mtd_probe/probe_smartmedia.c | 10 ++++------ 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/extras/mtd_probe/75-probe_mtd.rules b/extras/mtd_probe/75-probe_mtd.rules index 1d1b398175..184fda58a9 100644 --- a/extras/mtd_probe/75-probe_mtd.rules +++ b/extras/mtd_probe/75-probe_mtd.rules @@ -1,10 +1,8 @@ -#probe mtd devices for FTL +# do not edit this file, it will be overwritten on update ACTION!="add", GOTO="mtd_probe_end" KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" -KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN+="/sbin/modprobe sm_ftl" - +KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN+="/sbin/modprobe -bv sm_ftl" LABEL="mtd_probe_end" - diff --git a/extras/mtd_probe/mtd_probe.c b/extras/mtd_probe/mtd_probe.c index d335b0628a..e45867ffa9 100644 --- a/extras/mtd_probe/mtd_probe.c +++ b/extras/mtd_probe/mtd_probe.c @@ -1,7 +1,4 @@ /* - * mtd_probe.c - * This file is part of mtd_probe - * * Copyright (C) 2010 - Maxim Levitsky * * mtd_probe is free software; you can redistribute it and/or modify @@ -16,7 +13,7 @@ * * You should have received a copy of the GNU General Public License * along with mtd_probe; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ #include "mtd_probe.h" @@ -29,8 +26,8 @@ #include #include -int main(int argc, char** argv) { - +int main(int argc, char** argv) +{ if (argc != 2) { printf("usage: mtd_probe /dev/mtd[n]\n"); return 1; diff --git a/extras/mtd_probe/mtd_probe.h b/extras/mtd_probe/mtd_probe.h index 845a7a13d9..30396d07f6 100644 --- a/extras/mtd_probe/mtd_probe.h +++ b/extras/mtd_probe/mtd_probe.h @@ -1,7 +1,4 @@ /* - * mtd_probe.h - * This file is part of mtd_probe - * * Copyright (C) 2010 - Maxim Levitsky * * mtd_probe is free software; you can redistribute it and/or modify @@ -19,6 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ + #include /* Full oob structure as written on the flash */ diff --git a/extras/mtd_probe/probe_smartmedia.c b/extras/mtd_probe/probe_smartmedia.c index ab6edea4b1..78841f05da 100644 --- a/extras/mtd_probe/probe_smartmedia.c +++ b/extras/mtd_probe/probe_smartmedia.c @@ -1,7 +1,4 @@ /* - * probe_smartmedia.c - * This file is part of mtd_probe - * * Copyright (C) 2010 - Maxim Levitsky * * mtd_probe is free software; you can redistribute it and/or modify @@ -23,7 +20,7 @@ #include #include #include - +#include #include #include #include @@ -37,9 +34,10 @@ static const uint8_t cis_signature[] = { }; -void probe_smart_media(int mtd_fd, mtd_info_t* info) { - +void probe_smart_media(int mtd_fd, mtd_info_t* info) +{ char* cis_buffer = malloc(SM_SECTOR_SIZE); + if (!cis_buffer) return; -- cgit v1.2.3-54-g00ecf From 492da5ef53a094caecdd425319ab8c463e84ce9b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Jun 2010 09:35:39 +0200 Subject: rules: remove unused subdir --- Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 5e9234a699..1916770a01 100644 --- a/Makefile.am +++ b/Makefile.am @@ -95,8 +95,7 @@ install-data-local: EXTRA_DIST += \ rules/arch \ - rules/misc \ - rules/gentoo + rules/misc udevrulesdir = $(libexecdir)/rules.d dist_udevrules_DATA = \ -- cgit v1.2.3-54-g00ecf From b93e0709497e37a5fb023b8b3c5c47a425123193 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Jun 2010 09:38:31 +0200 Subject: release 158 --- ChangeLog | 28 ++++++++++++++++++++++++++++ NEWS | 5 +++++ 2 files changed, 33 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2b7747fe5f..aefb51a6b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +Summary of changes from v157 to v158 +============================================ + +Harald Hoyer (1): + extras/keymap: add Samsung N210 to keymap rules + +Kay Sievers (7): + version bump + libudev: fix fd leak in udev_enumerate_scan_devices() when tags are searched + udevd: in case we don't daemonize, send READY message to /sbin/init + delete last distro specific rules + remove a few comments in file headers + mtd_probe: add needed include, modprobe blacklist flag, and change some whitespace + rules: remove unused subdir + +Martin Pitt (4): + Fix hid2hci rules harder + add Vala vapi for gudev-1.0 + Revert "add Vala vapi for gudev-1.0" + Fix usb printer rule for multiple USB interfaces + +Maxim Levitsky (1): + mtd_probe: add autodetection for xD cards + +Paul Bender (1): + configure.ac: fix cross compilation + + Summary of changes from v156 to v157 ============================================ diff --git a/NEWS b/NEWS index 2ba32b0926..002ecbae74 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,11 @@ udev 158 ======== Bugfixes. +All distribution specific rules are removed from the udev source tree, +most of them are no longer needed. The Gentoo rules which allow to support +older kernel versions, which are not covered by the default rules anymore +has moved to rules/misc/30-kernel-compat.rules. + udev 157 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From cbcb846a4c9c9b8215a3f484d70e3cefde5ba226 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 24 Jun 2010 10:17:15 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 002ecbae74..88dc34da39 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 159 +======== +Bugfixes. + udev 158 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 7e9b1f8a58..4bac653b5d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [158], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [159], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 43fefbf6f1c528947a77643582bcc34cf3538b2d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Jun 2010 01:31:57 +0200 Subject: add systemd service files --- init/udev-retry.service | 13 +++++++++++++ init/udev-settle.service | 13 +++++++++++++ init/udev.service | 15 +++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 init/udev-retry.service create mode 100644 init/udev-settle.service create mode 100644 init/udev.service diff --git a/init/udev-retry.service b/init/udev-retry.service new file mode 100644 index 0000000000..07928751a5 --- /dev/null +++ b/init/udev-retry.service @@ -0,0 +1,13 @@ +[Unit] +Description=re-trigger failed events after filesystems are available +After=local-fs.target + +[Service] +Type=finish +ValidNoProcess=yes +ExecStart=/sbin/udevadm trigger --type=failed + +[Install] +WantedBy=sysinit.target +Also=udev.service +Also=udev-settle.service diff --git a/init/udev-settle.service b/init/udev-settle.service new file mode 100644 index 0000000000..3c73a96d9f --- /dev/null +++ b/init/udev-settle.service @@ -0,0 +1,13 @@ +[Unit] +Description=wait until full initialization +After=udev.service + +[Service] +Type=finish +ValidNoProcess=yes +ExecStart=/sbin/udevadm settle + +[Install] +WantedBy=sysinit.target +Also=udev.service +Also=udev-retry.service diff --git a/init/udev.service b/init/udev.service new file mode 100644 index 0000000000..f6824a2002 --- /dev/null +++ b/init/udev.service @@ -0,0 +1,15 @@ +[Unit] +Description=/dev and kernel device manager +Before=sysinit.target + +[Service] +Type=notify +ExecStart=/sbin/udevd +ExecStartPost=/sbin/udevadm trigger --type=subsystems --action=add +ExecStartPost=/sbin/udevadm trigger --type=devices --action=add + +[Install] +WantedBy=sysinit.target +Also=udev-settle.service +Also=udev-retry.service + -- cgit v1.2.3-54-g00ecf From 08b4c88353b48302ae94088b55b2066ad01c63f8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Jun 2010 10:30:55 +0200 Subject: make: pre-process and install systemd service files when needed --- Makefile.am | 7 +++++++ configure.ac | 16 +++++++++++++--- extras/mtd_probe/.gitignore | 1 + init/.gitignore | 1 + init/udev-retry.service | 13 ------------- init/udev-retry.service.in | 13 +++++++++++++ init/udev-settle.service | 13 ------------- init/udev-settle.service.in | 13 +++++++++++++ init/udev.service | 15 --------------- init/udev.service.in | 15 +++++++++++++++ 10 files changed, 63 insertions(+), 44 deletions(-) create mode 100644 extras/mtd_probe/.gitignore create mode 100644 init/.gitignore delete mode 100644 init/udev-retry.service create mode 100644 init/udev-retry.service.in delete mode 100644 init/udev-settle.service create mode 100644 init/udev-settle.service.in delete mode 100644 init/udev.service create mode 100644 init/udev.service.in diff --git a/Makefile.am b/Makefile.am index 1916770a01..198c06c86c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -114,6 +114,13 @@ dist_udevconf_DATA = udev.conf sharepkgconfigdir = $(datadir)/pkgconfig sharepkgconfig_DATA = udev/udev.pc +if WITH_SYSTEMD +systemdsystemunit_DATA = \ + init/udev.service \ + init/udev-settle.service \ + init/udev-retry.service +endif + sbin_PROGRAMS = \ udev/udevd \ udev/udevadm diff --git a/configure.ac b/configure.ac index 4bac653b5d..255ee18b16 100644 --- a/configure.ac +++ b/configure.ac @@ -49,8 +49,7 @@ fi AC_ARG_WITH(firmware-path, AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), - [], [with_firmware_path="/lib/firmware/updates:/lib/firmware"] - ) + [], [with_firmware_path="/lib/firmware/updates:/lib/firmware"]) OLD_IFS=$IFS IFS=: for i in $with_firmware_path @@ -64,6 +63,12 @@ done IFS=$OLD_IFS AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH]) +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) +AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) +AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir"]) + AC_ARG_ENABLE([extras], AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]), [], [enable_extras=yes]) @@ -126,10 +131,13 @@ AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile + udev/udev.pc + init/udev.service + init/udev-settle.service + init/udev-retry.service libudev/libudev.pc libudev/docs/Makefile libudev/docs/version.xml - udev/udev.pc extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml @@ -153,6 +161,8 @@ AC_MSG_RESULT([ include_prefix: ${INCLUDE_PREFIX} + systemdsystemunitdir: ${systemdsystemunitdir} + logging: ${enable_logging} debug: ${enable_debug} selinux: ${with_selinux} diff --git a/extras/mtd_probe/.gitignore b/extras/mtd_probe/.gitignore new file mode 100644 index 0000000000..82b8ab501f --- /dev/null +++ b/extras/mtd_probe/.gitignore @@ -0,0 +1 @@ +mtd_probe diff --git a/init/.gitignore b/init/.gitignore new file mode 100644 index 0000000000..904e445e72 --- /dev/null +++ b/init/.gitignore @@ -0,0 +1 @@ +udev*.service diff --git a/init/udev-retry.service b/init/udev-retry.service deleted file mode 100644 index 07928751a5..0000000000 --- a/init/udev-retry.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=re-trigger failed events after filesystems are available -After=local-fs.target - -[Service] -Type=finish -ValidNoProcess=yes -ExecStart=/sbin/udevadm trigger --type=failed - -[Install] -WantedBy=sysinit.target -Also=udev.service -Also=udev-settle.service diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in new file mode 100644 index 0000000000..b7d5320777 --- /dev/null +++ b/init/udev-retry.service.in @@ -0,0 +1,13 @@ +[Unit] +Description=re-trigger failed events after filesystems are available +After=local-fs.target + +[Service] +Type=finish +ValidNoProcess=yes +ExecStart=@sbindir@/udevadm trigger --type=failed + +[Install] +WantedBy=sysinit.target +Also=udev.service +Also=udev-settle.service diff --git a/init/udev-settle.service b/init/udev-settle.service deleted file mode 100644 index 3c73a96d9f..0000000000 --- a/init/udev-settle.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=wait until full initialization -After=udev.service - -[Service] -Type=finish -ValidNoProcess=yes -ExecStart=/sbin/udevadm settle - -[Install] -WantedBy=sysinit.target -Also=udev.service -Also=udev-retry.service diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in new file mode 100644 index 0000000000..d13beae6c2 --- /dev/null +++ b/init/udev-settle.service.in @@ -0,0 +1,13 @@ +[Unit] +Description=wait until full initialization +After=udev.service + +[Service] +Type=finish +ValidNoProcess=yes +ExecStart=@sbindir@/udevadm settle + +[Install] +WantedBy=sysinit.target +Also=udev.service +Also=udev-retry.service diff --git a/init/udev.service b/init/udev.service deleted file mode 100644 index f6824a2002..0000000000 --- a/init/udev.service +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=/dev and kernel device manager -Before=sysinit.target - -[Service] -Type=notify -ExecStart=/sbin/udevd -ExecStartPost=/sbin/udevadm trigger --type=subsystems --action=add -ExecStartPost=/sbin/udevadm trigger --type=devices --action=add - -[Install] -WantedBy=sysinit.target -Also=udev-settle.service -Also=udev-retry.service - diff --git a/init/udev.service.in b/init/udev.service.in new file mode 100644 index 0000000000..a54626df50 --- /dev/null +++ b/init/udev.service.in @@ -0,0 +1,15 @@ +[Unit] +Description=/dev and kernel device manager +Before=sysinit.target + +[Service] +Type=notify +ExecStart=@sbindir@/udevd +ExecStartPost=@sbindir@/udevadm trigger --type=subsystems --action=add +ExecStartPost=@sbindir@/udevadm trigger --type=devices --action=add + +[Install] +WantedBy=sysinit.target +Also=udev-settle.service +Also=udev-retry.service + -- cgit v1.2.3-54-g00ecf From f0565500f499cbc5503edebcacd98f305099df86 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Jun 2010 10:42:33 +0200 Subject: make: fix 'make distcheck' udev-159.tar.gz --- Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 198c06c86c..8515e1458e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,7 +21,8 @@ AM_LDFLAGS = \ -Wl,--as-needed DISTCHECK_CONFIGURE_FLAGS = \ - --enable-gtk-doc + --enable-gtk-doc \ + --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) CLEANFILES = -- cgit v1.2.3-54-g00ecf From 8b5651bb009bf892b3a5537c5f36b8891f238aa4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Jun 2010 11:39:21 +0200 Subject: switch a few left-over from GPLv2 to GPLv2 or later --- extras/edd_id/edd_id.c | 15 ++++++++++++--- extras/floppy/create_floppy_devices.c | 20 +++++++++++++------- extras/rule_generator/rule_generator.functions | 20 +++++++++++++++++--- extras/rule_generator/write_cd_rules | 17 +++++++++++++---- extras/rule_generator/write_net_rules | 25 +++++++++++++++++-------- extras/scsi_id/scsi_id.c | 16 +++++++++++----- extras/scsi_id/scsi_id.h | 15 ++++++++++++--- extras/scsi_id/scsi_serial.c | 18 +++++++++++++----- extras/usb_id/usb_id.c | 18 +++++++++++++----- 9 files changed, 121 insertions(+), 43 deletions(-) diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c index 15295ed31f..ac4da07611 100644 --- a/extras/edd_id/edd_id.c +++ b/extras/edd_id/edd_id.c @@ -4,9 +4,18 @@ * Copyright (C) 2005 John Hull * Copyright (C) 2005 Kay Sievers * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #ifndef _GNU_SOURCE diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c index 2fc05cc494..47724f8b04 100644 --- a/extras/floppy/create_floppy_devices.c +++ b/extras/floppy/create_floppy_devices.c @@ -1,17 +1,23 @@ /* - * create_floppy_devices - * * Create all possible floppy device based on the CMOS type. * Based upon code from drivers/block/floppy.c * * Copyright(C) 2005, SUSE Linux Products GmbH * - * Author: - * Hannes Reinecke + * Author: Hannes Reinecke + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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. * - * 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. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index b972091615..e2060a2ece 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -1,8 +1,22 @@ # functions used by the udev rule generator + +# Copyright (C) 2006 Marco d'Itri + +# 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, either version 2 of the License, or +# (at your option) any later version. + +# 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, see . + +PATH='/sbin:/bin' # -# 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. PATH='/sbin:/bin' diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules index 0d16fe6eff..00382ada2f 100644 --- a/extras/rule_generator/write_cd_rules +++ b/extras/rule_generator/write_cd_rules @@ -4,12 +4,21 @@ # # It adds symlinks for optical drives based on the device class determined # by cdrom_id and used ID_PATH to identify the device. -# + # (C) 2006 Marco d'Itri # -# 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 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, either version 2 of the License, or +# (at your option) any later version. + +# 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, see . # debug, if UDEV_LOG= if [ -n "$UDEV_LOG" ]; then diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index cb346757cc..644fbcecba 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -1,12 +1,5 @@ #!/bin/sh -e -# -# Copyright (C) 2006 Marco d'Itri -# Copyright (C) 2007 Kay Sievers -# -# 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 script is run to create persistent network device naming rules # based on properties of the device. # If the interface needs to be renamed, INTERFACE_NEW= will be printed @@ -22,6 +15,22 @@ # INTERFACE_NAME requested name supplied by external tool # INTERFACE_NEW new interface name returned by rule writer +# Copyright (C) 2006 Marco d'Itri +# Copyright (C) 2007 Kay Sievers +# +# 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, either version 2 of the License, or +# (at your option) any later version. +# +# 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, see . + # debug, if UDEV_LOG= if [ -n "$UDEV_LOG" ]; then if [ "$UDEV_LOG" -ge 7 ]; then diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index d7dfe3ebeb..3811ea542d 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -2,12 +2,18 @@ * Copyright (C) IBM Corp. 2003 * Copyright (C) SUSE Linux Products GmbH, 2006 * - * Author: - * Patrick Mansfield + * 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, either version 2 of the License, or + * (at your option) any later version. * - * 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, see . */ #include diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index ff5b70d17b..4475eaccd1 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -1,9 +1,18 @@ /* * Copyright (C) IBM Corp. 2003 * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #define MAX_PATH_LEN 512 diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 22456b7732..dd5e1fdbf8 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -1,12 +1,20 @@ /* * Copyright (C) IBM Corp. 2003 * - * Author: - * Patrick Mansfield + * Author: Patrick Mansfield * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #include diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 42ccddff35..fabd09283d 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -3,12 +3,20 @@ * * Copyright (c) 2005 SUSE Linux Products GmbH, Germany * - * Author: - * Hannes Reinecke + * Author: Hannes Reinecke * - * 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 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . */ #include -- cgit v1.2.3-54-g00ecf From 310f2896eb04b4aa2fe5241f7cf0590852adb2fe Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Sun, 27 Jun 2010 22:35:44 -0500 Subject: Fix stuck volume key presses for Toshiba Satellite U300 & U305models This patch fixes stuck volume keys for Toshiba Satellite models U300 & U305. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 36d569aea8..db8a3b3d52 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -31,4 +31,6 @@ ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-forc ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite U300|Satellite Pro U300|Satellite U305", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From 8741f2defaf26aafe5ee0fd29954cfdf84ee519c Mon Sep 17 00:00:00 2001 From: Ryan Harper Date: Fri, 25 Jun 2010 08:59:22 -0500 Subject: Add virtio-blk support to path_id This patch adds a case handling path_id invoked on a virtio-blk device. Currently path_id walks the parent path to virtio-pci but doesn't know that it's the end of the path and exits without building the path (providing no output resulting in no disk/by-path symlinks to virtio-blk devices). This patch handles the virtio-pci path and updates the path accordingly. /lib/udev/path_id --debug /block/vda udev_device_new_from_syspath: device 0x2300120 has devpath '/devices/virtio-pci/virtio1/block/vda' udev_device_new_from_syspath: device 0x2300380 has devpath '/devices/virtio-pci/virtio1' udev_device_new_from_syspath: device 0x2300670 has devpath '/devices/virtio-pci' ID_PATH=virtio-pci-virtio1 And with the current persistent-storage rules generates: % ls -al /dev/disk/by-path | grep vda lrwxrwxrwx. 1 root root 9 Jun 1 22:09 virtio-pci-virtio1 -> ../../vda Signed-off-by: Ryan Harper --- extras/path_id/path_id.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index dcee37881f..c19bfd0f8d 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -448,6 +448,9 @@ int main(int argc, char **argv) } else if (strcmp(subsys, "xen") == 0) { path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "xen"); + } else if (strcmp(subsys, "virtio") == 0) { + path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "virtio"); } parent = udev_device_get_parent(parent); -- cgit v1.2.3-54-g00ecf From 2d000ed9d85eb6dd8a535e5d5e8f7a5ef52bd794 Mon Sep 17 00:00:00 2001 From: Ryan Harper Date: Fri, 25 Jun 2010 08:59:23 -0500 Subject: Add virtio-blk by-id rules based on 'serial' attribute Using virtio-blk serial attributes add rules to extract drive serial numbers and generate by-id links for the block device and partitions. With these rules added, we now see the following symlinks in disk/by-id % ls -al /dev/disk/by-id | grep vdb lrwxrwxrwx. 1 root root 9 Jun 1 22:09 virtio-QM00001 -> ../../vda lrwxrwxrwx. 1 root root 10 Jun 1 22:09 virtio-QM00001-part1 -> ../../vda1 Signed-off-by: Ryan Harper --- rules/rules.d/60-persistent-storage.rules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 1f46041283..6449e077ac 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -18,6 +18,10 @@ TEST=="whole_disk", GOTO="persistent_storage_end" # for partitions import parent information ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" +# virtio-blk +KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" +KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" + # USB devices use their own serial number KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" # ATA devices with their own "ata" kernel subsystem -- cgit v1.2.3-54-g00ecf From 86a62b0cf285b3eb9d953c6224cce30d811bc1b0 Mon Sep 17 00:00:00 2001 From: Michael Meeks Date: Tue, 29 Jun 2010 09:49:31 +0100 Subject: gudev: respect possibly given LD_LIBRARY_PATH michael@linux-iwk5:/opt/hgnome/src/udev> make V=1 make --no-print-directory all-recursive Making all in . PKG_CONFIG_PATH=./data:$PKG_CONFIG_PATH \ LD_LIBRARY_PATH=./extras/gudev \ /opt/hgnome/bin/g-ir-scanner -v \ --namespace GUdev \ .. ./extras/gudev/gudevdevice.c /opt/hgnome/bin/python: error while loading shared libraries: libpython2.5.so.1.0: cannot open shared object file: No such file or directory make[2]: *** [extras/gudev/GUdev-1.0.gir] Error 127 --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 8515e1458e..33ab56a624 100644 --- a/Makefile.am +++ b/Makefile.am @@ -381,7 +381,7 @@ extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gud if ENABLE_INTROSPECTION extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ - LD_LIBRARY_PATH=$(top_builddir)/extras/gudev \ + LD_LIBRARY_PATH=$(top_builddir)/extras/gudev:$$LD_LIBRARY_PATH \ $(G_IR_SCANNER) -v \ --namespace GUdev \ --nsversion=1.0 \ -- cgit v1.2.3-54-g00ecf From 8bc376a37393cd466d91be17bf3a208a0ad1eeac Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Thu, 1 Apr 2010 14:22:32 -0400 Subject: keymap: Add support for IBM-branded USB devices These seem to use a different layout to the Lenovo-branded devices Signed-off-by: Martin Pitt --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 1 + extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint | 7 +++++++ 3 files changed, 9 insertions(+) create mode 100644 extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint diff --git a/Makefile.am b/Makefile.am index 33ab56a624..940cb95e0a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -534,6 +534,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/hewlett-packard-presario-2100 \ extras/keymap/keymaps/hewlett-packard-tablet \ extras/keymap/keymaps/hewlett-packard-tx2 \ + extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint \ extras/keymap/keymaps/inventec-symphony_6.0_7.0 \ extras/keymap/keymaps/lenovo-3000 \ extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 26666a9f55..517c87c4ac 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -22,6 +22,7 @@ LABEL="keyboard_usbcheck" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" +ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" GOTO="keyboard_end" diff --git a/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint b/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint new file mode 100644 index 0000000000..027e50bf88 --- /dev/null +++ b/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint @@ -0,0 +1,7 @@ +0x900f0 screenlock +0x900f1 wlan +0x900f2 switchvideomode +0x900f3 suspend +0x900f4 brightnessup +0x900f5 brightnessdown +0x900f8 zoom -- cgit v1.2.3-54-g00ecf From 29c1a0d4603d53537a5713a5adc8dc953c1ea672 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 4 Jul 2010 04:16:14 +0200 Subject: systemd: update service files for newly introduced DefaultDependencies= option This new option has been introduced very recently in systemd and needs to be unset for udev, since udev is supposed to be run on early boot. --- init/udev-retry.service.in | 2 ++ init/udev-settle.service.in | 1 + init/udev.service.in | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in index b7d5320777..1c272324af 100644 --- a/init/udev-retry.service.in +++ b/init/udev-retry.service.in @@ -1,6 +1,8 @@ [Unit] Description=re-trigger failed events after filesystems are available +DefaultDependencies=no After=local-fs.target +After=udev.service [Service] Type=finish diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index d13beae6c2..be6acd2000 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -1,5 +1,6 @@ [Unit] Description=wait until full initialization +DefaultDependencies=no After=udev.service [Service] diff --git a/init/udev.service.in b/init/udev.service.in index a54626df50..4d08d5c223 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -1,5 +1,6 @@ [Unit] Description=/dev and kernel device manager +DefaultDependencies=no Before=sysinit.target [Service] @@ -12,4 +13,3 @@ ExecStartPost=@sbindir@/udevadm trigger --type=devices --action=add WantedBy=sysinit.target Also=udev-settle.service Also=udev-retry.service - -- cgit v1.2.3-54-g00ecf From 0fade61274497b874a7446fdd35bb7e1f5856f08 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 5 Jul 2010 09:35:36 +0200 Subject: keymap: Add Logitech Cordless Wave Pro https://launchpad.net/bugs/592371 --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 3 +++ extras/keymap/keymaps/logitech-wave-pro-cordless | 12 ++++++++++++ 3 files changed, 16 insertions(+) create mode 100644 extras/keymap/keymaps/logitech-wave-pro-cordless diff --git a/Makefile.am b/Makefile.am index 940cb95e0a..3406c3a97f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -543,6 +543,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/lg-x110 \ extras/keymap/keymaps/logitech-wave \ extras/keymap/keymaps/logitech-wave-cordless \ + extras/keymap/keymaps/logitech-wave-pro-cordless \ extras/keymap/keymaps/maxdata-pro_7000 \ extras/keymap/keymaps/medion-fid2060 \ extras/keymap/keymaps/medionnb-a555 \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 517c87c4ac..4ae5bde20d 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -21,6 +21,9 @@ LABEL="keyboard_usbcheck" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" +# Logitech Cordless Wave Pro looks slightly weird; some hotkeys are coming through the mouse interface +ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c529", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" + ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" diff --git a/extras/keymap/keymaps/logitech-wave-pro-cordless b/extras/keymap/keymaps/logitech-wave-pro-cordless new file mode 100644 index 0000000000..e7aa02206c --- /dev/null +++ b/extras/keymap/keymaps/logitech-wave-pro-cordless @@ -0,0 +1,12 @@ +0xC01B6 camera +0xC0183 media +0xC0184 wordprocessor +0xC0186 spreadsheet +0xC018E calendar +0xC0223 homepage +0xC01BC messenger +0xC018A mail +0xC0221 search +0xC00B8 ejectcd +0xC022D zoomin +0xC022E zoomout -- cgit v1.2.3-54-g00ecf From f9b58c359081dbd7c5009a5a8178459edb97f7e7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Jul 2010 06:49:29 +0200 Subject: release 159 --- ChangeLog | 30 ++++++++++++++++++++++++++++++ NEWS | 4 ++++ 2 files changed, 34 insertions(+) diff --git a/ChangeLog b/ChangeLog index aefb51a6b2..810ebd5264 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +Summary of changes from v158 to v159 +============================================ + +Jerone Young (1): + Fix stuck volume key presses for Toshiba Satellite U300 & U305models + +Kay Sievers (5): + version bump + add systemd service files + make: pre-process and install systemd service files when needed + make: fix 'make distcheck' + switch a few left-over from GPLv2 to GPLv2 or later + +Lennart Poettering (1): + systemd: update service files for newly introduced DefaultDependencies= option + +Martin Pitt (1): + keymap: Add Logitech Cordless Wave Pro + +Matthew Garrett (1): + keymap: Add support for IBM-branded USB devices + +Michael Meeks (1): + gudev: respect possibly given LD_LIBRARY_PATH + +Ryan Harper (2): + Add virtio-blk support to path_id + Add virtio-blk by-id rules based on 'serial' attribute + + Summary of changes from v157 to v158 ============================================ diff --git a/NEWS b/NEWS index 88dc34da39..502b5a8caf 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ udev 159 ======== Bugfixes. +New and fixed keymaps. + +Install systemd service files if applicable. + udev 158 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From db46deec4590f3cf5ff957d02ec980a61585df3f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Jul 2010 07:13:20 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 502b5a8caf..a73838411c 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 160 +======== +Bugfixes. + udev 159 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 255ee18b16..b9b1b0b636 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [159], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [160], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 4766b1058e77c807d0d42d8a2444186e66b9285f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Jul 2010 09:54:21 +0200 Subject: rules: tape - remove WAIT_FOR instruction and don't export BSG_DEV --- rules/rules.d/60-persistent-storage-tape.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index 833ef94daa..338da5fc63 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -11,8 +11,8 @@ SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{BSG_DEV}="$root/bsg/$id" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", WAIT_FOR="$env{BSG_DEV}", IMPORT="scsi_id --whitelisted --export --device=$env{BSG_DEV}", ENV{ID_BUS}="scsi" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{.BSG_DEV}="$root/bsg/$id" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT="scsi_id --whitelisted --export --device=$env{.BSG_DEV}", ENV{ID_BUS}="scsi" KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" -- cgit v1.2.3-54-g00ecf From 847b4f84c671e98f29f22d8e3e0d70a231d71a7b Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 7 Jul 2010 10:57:09 +0200 Subject: 60-persistent-storage-tape: s/path_id.sh/path_id/ --- rules/rules.d/60-persistent-storage-tape.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index 338da5fc63..d9df35ade5 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -17,7 +17,7 @@ KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$en KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" # by-path (parent device path) -KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id.sh %p" +KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p" KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" -- cgit v1.2.3-54-g00ecf From 3b529da42586aa430bb0d03800b19dd45552eae1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Jul 2010 11:35:40 +0200 Subject: allow final assignment for OPTIONS:="nowatch" A final assignemnt operator will disable any device watching by inotify, and any possible later rules setting "watch" again will be ignored. --- udev/udev-rules.c | 18 +++++++++++------- udev/udev.h | 3 ++- udev/udev.xml | 6 ++++++ 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 230916a92e..6d32e73017 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1569,42 +1569,42 @@ static int add_rule(struct udev_rules *rules, char *line, if (pos != NULL) { int prio = atoi(&pos[strlen("link_priority=")]); - rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, 0, NULL, &prio); + rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); dbg(rules->udev, "link priority=%i\n", prio); } pos = strstr(value, "event_timeout="); if (pos != NULL) { int tout = atoi(&pos[strlen("event_timeout=")]); - rule_add_key(&rule_tmp, TK_A_EVENT_TIMEOUT, 0, NULL, &tout); + rule_add_key(&rule_tmp, TK_A_EVENT_TIMEOUT, op, NULL, &tout); dbg(rules->udev, "event timeout=%i\n", tout); } pos = strstr(value, "string_escape="); if (pos != NULL) { pos = &pos[strlen("string_escape=")]; if (strncmp(pos, "none", strlen("none")) == 0) - rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_NONE, 0, NULL, NULL); + rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_NONE, op, NULL, NULL); else if (strncmp(pos, "replace", strlen("replace")) == 0) - rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, 0, NULL, NULL); + rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, op, NULL, NULL); } pos = strstr(value, "nowatch"); if (pos != NULL) { const int off = 0; - rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, 0, NULL, &off); + rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &off); dbg(rules->udev, "inotify watch of device disabled\n"); } else { pos = strstr(value, "watch"); if (pos != NULL) { const int on = 1; - rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, 0, NULL, &on); + rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &on); dbg(rules->udev, "inotify watch of device requested\n"); } } pos = strstr(value, "static_node="); if (pos != NULL) { - rule_add_key(&rule_tmp, TK_A_STATIC_NODE, 0, &pos[strlen("static_node=")], NULL); + rule_add_key(&rule_tmp, TK_A_STATIC_NODE, op, &pos[strlen("static_node=")], NULL); rule_tmp.rule.rule.has_static_node = true; } continue; @@ -2400,6 +2400,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event esc = ESCAPE_REPLACE; break; case TK_A_INOTIFY_WATCH: + if (event->inotify_watch_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->inotify_watch_final = true; event->inotify_watch = cur->key.watch; break; case TK_A_DEVLINK_PRIO: diff --git a/udev/udev.h b/udev/udev.h index 23b720a468..6833e60d61 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -44,13 +44,14 @@ struct udev_event { gid_t gid; struct udev_list_node run_list; int exec_delay; + bool inotify_watch; + bool inotify_watch_final; bool group_final; bool owner_final; bool mode_final; bool name_final; bool devlink_final; bool run_final; - bool inotify_watch; }; struct udev_watch { diff --git a/udev/udev.xml b/udev/udev.xml index b971fadea6..20c394c28b 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -513,6 +513,12 @@ writing, a change uevent will be synthesised. + + + + Disable the watching of a device node with inotify. + +
            -- cgit v1.2.3-54-g00ecf From fc799aa6b60595e85b9c8eac4566a90cf83fe6a0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Jul 2010 23:17:11 +0200 Subject: keymap: Find alternate Lenovo module Newer Lenovos apparently have a lower case "extra buttons" module, cover this as well. Sent by Quentin Denis via private mail. --- extras/keymap/findkeyboards | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards index acff534056..5a22649ec9 100755 --- a/extras/keymap/findkeyboards +++ b/extras/keymap/findkeyboards @@ -34,6 +34,8 @@ keyboard_devices() { # modules module=`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons'` module="$module +`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons'`" + module="$module `udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys'`" for m in $module; do evdev=`ls -d $m/event* 2>/dev/null` -- cgit v1.2.3-54-g00ecf From c3b3a979ee6cd4ea19f6ca333ce778925aa8c9a5 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 7 Jul 2010 23:18:19 +0200 Subject: keymap: Add Lenovo ThinkPad SL Series extra buttons Sent by Quentin Denis via private mail. --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 4ae5bde20d..6e37067c5e 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -41,6 +41,7 @@ ENV{DMI_VENDOR}=="", GOTO="keyboard_end" ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-lenovo" +ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="Lenovo ThinkPad SL Series extra buttons", RUN+="keymap $name 0x0E bluetooth" ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" -- cgit v1.2.3-54-g00ecf From 0c7377880974e6eadac7a3ae9e35d339546dde0d Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 8 Jul 2010 11:36:01 +0200 Subject: 60-persistent-storage-tape.rules: make own by-path symlink for nst tapes --- rules/rules.d/60-persistent-storage-tape.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index d9df35ade5..6ccd6e51e2 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -19,6 +19,6 @@ KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$en # by-path (parent device path) KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p" KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst" LABEL="persistent_storage_tape_end" -- cgit v1.2.3-54-g00ecf From 4d32b441369bc3bff0b7ca5401077603b1977c0f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 8 Jul 2010 15:02:48 +0200 Subject: systemd: make service files readable by GKeyFile --- init/udev-retry.service.in | 6 ++---- init/udev-settle.service.in | 3 +-- init/udev.service.in | 6 ++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in index 1c272324af..76678999f4 100644 --- a/init/udev-retry.service.in +++ b/init/udev-retry.service.in @@ -1,8 +1,7 @@ [Unit] Description=re-trigger failed events after filesystems are available DefaultDependencies=no -After=local-fs.target -After=udev.service +After=local-fs.target udev.service [Service] Type=finish @@ -11,5 +10,4 @@ ExecStart=@sbindir@/udevadm trigger --type=failed [Install] WantedBy=sysinit.target -Also=udev.service -Also=udev-settle.service +Also=udev.service udev-settle.service diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index be6acd2000..0594d72020 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -10,5 +10,4 @@ ExecStart=@sbindir@/udevadm settle [Install] WantedBy=sysinit.target -Also=udev.service -Also=udev-retry.service +Also=udev.service udev-retry.service diff --git a/init/udev.service.in b/init/udev.service.in index 4d08d5c223..e95cb476b7 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -6,10 +6,8 @@ Before=sysinit.target [Service] Type=notify ExecStart=@sbindir@/udevd -ExecStartPost=@sbindir@/udevadm trigger --type=subsystems --action=add -ExecStartPost=@sbindir@/udevadm trigger --type=devices --action=add +ExecStartPost=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add [Install] WantedBy=sysinit.target -Also=udev-settle.service -Also=udev-retry.service +Also=udev-settle.service udev-retry.service -- cgit v1.2.3-54-g00ecf From 35df38c36a65bd0a9fd108f7e10ea6a593d5cdd7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 11 Jul 2010 23:57:11 +0200 Subject: udevd: init_notify() fix abstract namespace name handling --- udev/udevd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index e38c601649..873634fe45 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1006,7 +1006,9 @@ static int init_notify(const char *state) memset(&msghdr, 0, sizeof(msghdr)); msghdr.msg_name = &sockaddr; - msghdr.msg_namelen = sizeof(struct sockaddr_un); + msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e); + if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) + msghdr.msg_namelen = sizeof(struct sockaddr_un); msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; msghdr.msg_control = &control; -- cgit v1.2.3-54-g00ecf From 885a09a9e1b7d928977140ae52f4c201e624ae81 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 11 Jul 2010 23:58:24 +0200 Subject: release 160 --- ChangeLog | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index 810ebd5264..4bdc05d011 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Summary of changes from v159 to v160 +============================================ + +Harald Hoyer (2): + 60-persistent-storage-tape: s/path_id.sh/path_id/ + 60-persistent-storage-tape.rules: make own by-path symlink for nst tapes + +Kay Sievers (4): + version bump + rules: tape - remove WAIT_FOR instruction and don't export BSG_DEV + allow final assignment for OPTIONS:="nowatch" + udevd: init_notify() fix abstract namespace name handling + +Lennart Poettering (1): + systemd: make service files readable by GKeyFile + +Martin Pitt (2): + keymap: Find alternate Lenovo module + keymap: Add Lenovo ThinkPad SL Series extra buttons + + Summary of changes from v158 to v159 ============================================ -- cgit v1.2.3-54-g00ecf From 3f42314fb6fc9589516aef47ebcdd86b1cd89888 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Jul 2010 00:10:16 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index a73838411c..af8d082dd8 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 161 +======== +Bugfixes. + udev 160 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index b9b1b0b636..4e9c49e426 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [160], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [161], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 1bbc1a9cb0d65c1326e18170f3b445047cb1ea80 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sun, 11 Jul 2010 12:32:12 +0200 Subject: rules: add more FireWire IDs: Point Grey IIDC; AV/C + vendor unique 1. IIDC cameras from Point Grey use the vendor OUI as Specifier_ID instead of the 1394 TA's OUI but are otherwise fully compliant to the IIDC spec. Their device files should be accessible like those of any other IIDC cameras. 2. Originally, the Software_Version of devices that implement FCP (IEC 61883-1 Function Control Protocol) was meant to be a bitmap of all command sets that an FCP capable unit supports. Bitmap flags are defined for AV/C, CAL, EHS, HAVi, and vendor unique command sets. Software_Version was revised to be a simple identifier instead, and devices that support several command sets were meant to instantiate one unit directory for each command set. Still, some devices with the flags for AV/C and vendor unique command sets combined were released (but apparently no devices with any other flag combinations). These rare but existing AV/C + vendor unique devices need to be accessible just like plain AV/C devices. Side notes: - Many AV/C devices make use of the Vendor Dependent AV/C command, but this is unrelated to vendor unique FCP command sets. - Here are all standardized FireWire protocol identifiers that I know of, listed as Specifier_ID:Software_Version | specifier | protocol. 0x00005e:0x000001 | IANA | IPv4 over 1394 (RFC 2734) 0x00005e:0x000002 | IANA | IPv6 over 1394 (RFC 3146) 0x00609e:0x010483 | INCITS | SBP-2 (or SCSI command sets over SBP-3) 0x00609e:0x0105bb | INCITS | AV/C over SBP-3 0x00a02d:0x010001 | 1394 TA | AV/C (over FCP) 0x00a02d:0x010002 | 1394 TA | CAL 0x00a02d:0x010004 | 1394 TA | EHS 0x00a02d:0x010008 | 1394 TA | HAVi 0x00a02d:0x014000 | 1394 TA | Vendor Unique 0x00a02d:0x014001 | 1394 TA | Vendor Unique and AV/C (over FCP) 0x00a02d:0x000100 | 1394 TA | IIDC 1.04 0x00a02d:0x000101 | 1394 TA | IIDC 1.20 0x00a02d:0x000102 | 1394 TA | IIDC 1.30 0x00a02d:0x0A6BE2 | 1394 TA | DPP 1.0 0x00a02d:0x4B661F | 1394 TA | IICP 1.0 For now we are only interested in udev rules for AV/C and IIDC. Reported-by: Damien Douxchamps (Point Grey IIDC ID) Reported-by: Clemens Ladisch (AV/C + vendor unique ID) Signed-off-by: Stefan Richter --- rules/rules.d/50-udev-default.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 10cfbd6157..3c0f747eff 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -49,7 +49,9 @@ SUBSYSTEM=="dvb", GROUP="video" # FireWire (firewire-core driver: IIDC devices, AV/C devices) SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="video" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" # FireWire (deprecated dv1394 and video1394 drivers) KERNEL=="dv1394-[0-9]*", NAME="dv1394/%n", GROUP="video" -- cgit v1.2.3-54-g00ecf From 9de4a43a899dd03dd10ebc156be85ecdd33ce62a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Jul 2010 11:04:17 +0200 Subject: rules: remove firewire rules for deprecated drivers --- rules/rules.d/50-udev-default.rules | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 3c0f747eff..9f98809a8f 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -53,10 +53,6 @@ SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" -# FireWire (deprecated dv1394 and video1394 drivers) -KERNEL=="dv1394-[0-9]*", NAME="dv1394/%n", GROUP="video" -KERNEL=="video1394-[0-9]*", NAME="video1394/%n", GROUP="video" - # libusb device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" -- cgit v1.2.3-54-g00ecf From 2ffb33bdece1ef75886dc8d50490050c8a4b53bd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 15 Jul 2010 11:38:14 +0200 Subject: udev-acl: update firewire matches to recent rule changes --- extras/udev-acl/70-acl.rules | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 8300ec26d4..493a43a15b 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -37,12 +37,10 @@ SUBSYSTEM=="dvb", TAG+="udev-acl" # IIDC devices: industrial cameras and some webcams SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG+="udev-acl" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", TAG+="udev-acl" # AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="udev-acl" - -# old style firewire devices -KERNEL=="dv1394-[0-9]*", TAG+="udev-acl" -KERNEL=="video1394-[0-9]*", TAG+="udev-acl" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", TAG+="udev-acl" # fingerprint readers SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="2016", TAG+="udev-acl" -- cgit v1.2.3-54-g00ecf From 85c3d3b032b4c9a743a9c46eeede469eb999fb54 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Thu, 15 Jul 2010 22:01:24 -0500 Subject: Fix volume keys not releasing on Mivvy G310 keymap: add My Mivvy G310 Fixes volume keys not sending key release on My Mivvy G310 laptop. Signed-off-by: Jerone Young Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index db8a3b3d52..cb1fe78cd4 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -33,4 +33,6 @@ ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RU ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite U300|Satellite Pro U300|Satellite U305", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From a466c239a98045767c3aa7dfbf95306f36b9bf48 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 19 Jul 2010 10:37:41 +0200 Subject: hid2hci: fix Logitech diNovo, MX5500 and other keyboards --- extras/hid2hci/70-hid2hci.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index c5528f023b..43515511f1 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -11,9 +11,9 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" # Logitech devices (hidraw) -KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[345bce]|c71[34bc]", \ +KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[35e]|c71[34]", \ RUN+="hid2hci --method=logitech-hid --devpath=%p" -KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70a", \ +KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[4abc]|c71[bc]", \ RUN+="hid2hci --method=logitech-hid --devpath=%p" ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" -- cgit v1.2.3-54-g00ecf From 9b6c6b56123670050b1dc5eb69ea1a9638bedd39 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Mon, 19 Jul 2010 10:56:37 +0200 Subject: log an error when a message from the wrong version of udevadm is ignored --- libudev/libudev-monitor.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index b3e5d5f348..a3789c4d13 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -625,8 +625,11 @@ retry: if (memcmp(buf, "libudev", 8) == 0) { /* udev message needs proper version magic */ nlh = (struct udev_monitor_netlink_header *) buf; - if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) + if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) { + err(udev_monitor->udev, "ignored a message from an invalid release of udevadm (%x != %x)\n", + nlh->magic, htonl(UDEV_MONITOR_MAGIC)); return NULL; + } if (nlh->properties_off+32 > buflen) return NULL; bufpos = nlh->properties_off; -- cgit v1.2.3-54-g00ecf From 2ec30504d628a445b892c697745b9886b42227e1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 19 Jul 2010 14:08:21 +0200 Subject: libudev: bump minor so version after adding symbols --- Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3406c3a97f..e80d43abe5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,9 +29,9 @@ CLEANFILES = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=8 -LIBUDEV_REVISION=3 -LIBUDEV_AGE=8 +LIBUDEV_CURRENT=9 +LIBUDEV_REVISION=0 +LIBUDEV_AGE=9 SUBDIRS += libudev/docs -- cgit v1.2.3-54-g00ecf From efb27d646590660c766796fc314a291bdcd2b3e1 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Fri, 23 Jul 2010 12:08:31 +0200 Subject: hid2hci: fix for Logitech diNovo Edge keyboard --- extras/hid2hci/70-hid2hci.rules | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules index 43515511f1..3b36629d4b 100644 --- a/extras/hid2hci/70-hid2hci.rules +++ b/extras/hid2hci/70-hid2hci.rules @@ -10,10 +10,10 @@ ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProt ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" -# Logitech devices (hidraw) -KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[35e]|c71[34]", \ +# Logitech devices +KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[35e]", \ RUN+="hid2hci --method=logitech-hid --devpath=%p" -KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[4abc]|c71[bc]", \ +KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[4abc]|c71[34bc]", \ RUN+="hid2hci --method=logitech-hid --devpath=%p" ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" -- cgit v1.2.3-54-g00ecf From 163c0365ffbd9321d686e8c301c36ea50c98df2f Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Wed, 28 Jul 2010 06:56:13 +0200 Subject: udevadm: fix short options in getopt() --- udev/udevadm-control.c | 2 +- udev/udevadm-info.c | 2 +- udev/udevadm-trigger.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 1f8008ab9e..8b90829211 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -71,7 +71,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) int i; char *endp; - option = getopt_long(argc, argv, "l:sSRp:m:M:h", options, NULL); + option = getopt_long(argc, argv, "l:sSRp:m:h", options, NULL); if (option == -1) break; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 14baa6accb..9bd60c7243 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -242,7 +242,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) int option; struct stat statbuf; - option = getopt_long(argc, argv, "aed:n:p:q:rxPVh", options, NULL); + option = getopt_long(argc, argv, "aed:n:p:q:rxP:Vh", options, NULL); if (option == -1) break; diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 481e9cf163..c32e0b4e2f 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -128,7 +128,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) const char *val; char buf[UTIL_PATH_SIZE]; - option = getopt_long(argc, argv, "vng:o:t:hcp:s:S:a:A:y:", options, NULL); + option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:", options, NULL); if (option == -1) break; -- cgit v1.2.3-54-g00ecf From c9fbbd6ea2f92e037cdaba6b7116d3b3e904696a Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 1 Aug 2010 21:59:58 +0200 Subject: keymap: Generalize Samsung keymaps Fortunato Ventre (voRia) reports a lot more Samsung models which need the "samsung-other" keymap. Instead of eternally playing catchup, apply it to all Samsung models for now, and keep the two known special cases. https://launchpad.net/bugs/554066 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 6e37067c5e..13b557111c 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -115,7 +115,7 @@ ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*NC10*|*NC20*|*N128*|*N130*|*N210*|*SP55S*|*SQ45S70S*|*SX60P*|*SX22S*|*SX30S*|*R59P/R60P/R61P*|*SR70S/SR71S*|*Q210*|*Q310*|*X05*|*P560*|*R560*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-other" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" -- cgit v1.2.3-54-g00ecf From 5047f82de4d3b973281993516441a35cebcf1294 Mon Sep 17 00:00:00 2001 From: Fortunato Ventre Date: Sun, 1 Aug 2010 22:03:30 +0200 Subject: keymap: Add force-release quirks for a lot more Samsung models https://launchpad.net/bugs/554066 --- extras/keymap/95-keyboard-force-release.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index cb1fe78cd4..bd6b75ffcc 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*N128*|*N130*|*N140*|*N210*|*SR70S/SR71S*|*Q210/P210*", RUN+="keyboard-force-release.sh $devpath samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*E252*|*N120*|*N128*|*N130*|*N140*|*N148/N208*|*N150*|*N150/N210/N220*|*N220*|*N308*|*N310*|*N510*|*NB30*|*NC10/N110*|*ND10*|*Q210/P210*|*R410P*|*R425/R525*|*R428/P428*|*R460*|*R463*|*R468/R418*|*R480/R431/R481*|*R509*|*R518*|*R519/R719*|*R520/R522/R620*|*R528/R728*|*R530/R730*|*R530/R730/P590*|*R560*|*R580*|*R580/R590*|*R59/R60/R61*|*R59P/R60P/R61P*|*R710*|*R720*|*R780/R778*|*SR58P*|*SR700*|*SR70S/SR71S*|*SX22S*|*X118*|*X120*|*X460*", RUN+="keyboard-force-release.sh $devpath samsung-other" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -- cgit v1.2.3-54-g00ecf From 1851332c08e3f70ee172bbe5b153789da5df2df5 Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Mon, 2 Aug 2010 18:31:18 +0800 Subject: udevd: fix some memory leaks in error path Signed-off-by: Yin Kangkai --- udev/udev-rules.c | 15 ++++++++++++--- udev/udevd.c | 4 +++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 6d32e73017..4b81a50a8e 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1761,13 +1761,18 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) /* init token array and string buffer */ rules->tokens = malloc(PREALLOC_TOKEN * sizeof(struct token)); - if (rules->tokens == NULL) + if (rules->tokens == NULL) { + free(rules); return NULL; + } rules->token_max = PREALLOC_TOKEN; rules->buf = malloc(PREALLOC_STRBUF); - if (rules->buf == NULL) + if (rules->buf == NULL) { + free(rules->tokens); + free(rules); return NULL; + } rules->buf_max = PREALLOC_STRBUF; /* offset 0 is always '\0' */ rules->buf[0] = '\0'; @@ -1776,8 +1781,12 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); rules->trie_nodes = malloc(PREALLOC_TRIE * sizeof(struct trie_node)); - if (rules->trie_nodes == NULL) + if (rules->trie_nodes == NULL) { + free(rules->buf); + free(rules->tokens); + free(rules); return NULL; + } rules->trie_nodes_max = PREALLOC_TRIE; /* offset 0 is the trie root, with an empty string */ memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); diff --git a/udev/udevd.c b/udev/udevd.c index 873634fe45..fbc237143c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -227,8 +227,10 @@ static void worker_new(struct event *event) udev_monitor_enable_receiving(worker_monitor); worker = calloc(1, sizeof(struct worker)); - if (worker == NULL) + if (worker == NULL) { + udev_monitor_unref(worker_monitor); return; + } /* worker + event reference */ worker->refcount = 2; worker->udev = event->udev; -- cgit v1.2.3-54-g00ecf From 27f4528b9a6587cab2d916fad735dd93eb7563b0 Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Tue, 3 Aug 2010 08:10:26 +0200 Subject: malloc()+memset() -> calloc() --- udev/udev-rules.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 4b81a50a8e..52f121c29a 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1751,10 +1751,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) struct udev_list_entry *file_loop, *file_tmp; struct token end_token; - rules = malloc(sizeof(struct udev_rules)); + rules = calloc(1, sizeof(struct udev_rules)); if (rules == NULL) return NULL; - memset(rules, 0x00, sizeof(struct udev_rules)); rules->udev = udev; rules->resolve_names = resolve_names; udev_list_init(&file_list); -- cgit v1.2.3-54-g00ecf From 4ab3c463d418c74275eb8170a87c8cf75e47d973 Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Tue, 3 Aug 2010 08:11:43 +0200 Subject: udevd: fix short options in getopt() --- udev/udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index fbc237143c..2808117824 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1062,7 +1062,7 @@ int main(int argc, char *argv[]) for (;;) { int option; - option = getopt_long(argc, argv, "cdeDthV", options, NULL); + option = getopt_long(argc, argv, "c:deDthV", options, NULL); if (option == -1) break; -- cgit v1.2.3-54-g00ecf From 8e5a620b17c08b0b6277236203ee559b7dadd1d4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 3 Aug 2010 12:13:53 +0200 Subject: call util_delete_path() only when we actually deleted stuff --- libudev/libudev-util-private.c | 17 ++++++----------- udev/udev-node.c | 11 ++++++----- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 2f9f4a74c3..6b68b6a366 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -74,7 +74,7 @@ int util_delete_path(struct udev *udev, const char *path) { char p[UTIL_PATH_SIZE]; char *pos; - int retval; + int err = 0; if (path[0] == '/') while(path[1] == '/') @@ -92,19 +92,14 @@ int util_delete_path(struct udev *udev, const char *path) if ((pos == p) || (pos == NULL)) break; - /* remove if empty */ - retval = rmdir(p); - if (errno == ENOENT) - retval = 0; - if (retval) { - if (errno == ENOTEMPTY) - return 0; - err(udev, "rmdir(%s) failed: %m\n", p); + err = rmdir(p); + if (err < 0) { + if (errno == ENOENT) + err = 0; break; } - dbg(udev, "removed '%s'\n", p); } - return 0; + return err; } /* Reset permissions on the device node, before unlinking it to make sure, diff --git a/udev/udev-node.c b/udev/udev-node.c index 8339eb732f..228b3ebee4 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -298,15 +298,15 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) if (!add) { dbg(udev, "removing index: '%s'\n", filename); - unlink(filename); - util_delete_path(udev, filename); + if (unlink(filename) == 0) + rmdir(dirname); } target = link_find_prioritized(dev, add, dirname, buf, sizeof(buf)); if (target == NULL) { info(udev, "no reference left, remove '%s'\n", slink); - unlink(slink); - util_delete_path(udev, slink); + if (unlink(slink) == 0) + util_delete_path(udev, slink); } else { info(udev, "creating link '%s' to '%s'\n", slink, target); node_symlink(udev, target, slink); @@ -427,7 +427,8 @@ int udev_node_remove(struct udev_device *dev) info(udev, "removing device node '%s'\n", devnode); err = util_unlink_secure(udev, devnode); - util_delete_path(udev, devnode); + if (err == 0) + util_delete_path(udev, devnode); out: return err; } -- cgit v1.2.3-54-g00ecf From 939cc18afc49ee8479572c14c7fa777646fd4add Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 3 Aug 2010 15:09:46 +0200 Subject: udev-acl: properly handle CK change events for root user mschmidt@redhat.com writes: > since root is treated specially, it does not do anything! > udev-acl may want to prevent removing ACLs from root, but > it must not stop the ACLs being granted to the user of the > new session. https://bugzilla.redhat.com/show_bug.cgi?id=608712 --- extras/udev-acl/udev-acl.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index ff04ec6bed..f2b50051c1 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -224,14 +224,10 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con if (s == NULL) return -1; u = strtoul(s, NULL, 10); - if (u == 0) - return 0; s = getenv("CK_SEAT_SESSION_USER_UID"); if (s == NULL) return -1; u2 = strtoul(s, NULL, 10); - if (u2 == 0) - return 0; s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); s2 = getenv("CK_SEAT_SESSION_IS_LOCAL"); @@ -263,12 +259,11 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con a = ACTION_ADD; u = u2; } - break; case ACTION_NONE: break; default: - g_assert_not_reached (); + g_assert_not_reached(); break; } -- cgit v1.2.3-54-g00ecf From 9ac90ae153accdfcb56c24c5748690933ad219b2 Mon Sep 17 00:00:00 2001 From: Michal Schmidt Date: Wed, 4 Aug 2010 11:53:25 +0200 Subject: udev-acl: really fix ACL assignment in CK events The previous fix for udev-acl was incomplete. The ACL were not properly assigned to the new user when switching from root's session because of the test for 'uid != 0'. Centralize the special handling of root to a single place (in set_facl). https://bugzilla.redhat.com/show_bug.cgi?id=608712 --- extras/udev-acl/udev-acl.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index f2b50051c1..31e9991a51 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -12,20 +12,18 @@ * General Public License for more details: */ -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include #include #include -#include #include -#include +#include #include +#include +#include +#include +#include +#include static int debug; @@ -45,6 +43,10 @@ static int set_facl(const char* filename, uid_t uid, int add) acl_permset_t permset; int ret; + /* don't touch ACLs for root */ + if (uid == 0) + return 0; + /* read current record */ acl = acl_get_file(filename, ACL_TYPE_ACCESS); if (!acl) @@ -190,8 +192,6 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con if (s == NULL) return -1; u = strtoul(s, NULL, 10); - if (u == 0) - return 0; s = getenv("CK_SEAT_SESSION_IS_LOCAL"); if (s == NULL) @@ -205,8 +205,6 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con if (s == NULL) return -1; u = strtoul(s, NULL, 10); - if (u == 0) - return 0; s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); if (s == NULL) @@ -331,6 +329,7 @@ int main (int argc, char* argv[]) }; int action = -1; const char *device = NULL; + bool uid_given = false; uid_t uid = 0; uid_t uid2 = 0; const char* remove_session_id = NULL; @@ -357,6 +356,7 @@ int main (int argc, char* argv[]) device = optarg; break; case 'u': + uid_given = true; uid = strtoul(optarg, NULL, 10); break; case 'd': @@ -369,8 +369,9 @@ int main (int argc, char* argv[]) } } - if (action < 0 && device == NULL && uid == 0) - consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action); + if (action < 0 && device == NULL && !uid_given) + if (!consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action)) + uid_given = true; if (action < 0) { fprintf(stderr, "missing action\n\n"); @@ -378,13 +379,13 @@ int main (int argc, char* argv[]) goto out; } - if (device != NULL && uid != 0) { + if (device != NULL && uid_given) { fprintf(stderr, "only one option, --device=DEVICEFILE or --user=UID expected\n\n"); rc = 3; goto out; } - if (uid != 0) { + if (uid_given) { switch (action) { case ACTION_ADD: /* Add ACL for given uid to all matching devices. */ -- cgit v1.2.3-54-g00ecf From 232f180397d5786d332c6dc5c08b9c01c1772979 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 Aug 2010 18:55:57 +0200 Subject: udev-acl: remove specific device matches from the rules file We should do only do classes of devices, not individual pieces of hardware. There is no way for us to manage this in the long term, and it needs to be thought through what we want here, but it surely isn't a list of smartphones in the udev source tarball installed on all systems. --- extras/udev-acl/70-acl.rules | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 493a43a15b..25e3f609f1 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -42,14 +42,6 @@ SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", TAG+="udev-acl" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="udev-acl" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", TAG+="udev-acl" -# fingerprint readers -SUBSYSTEM=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="2016", TAG+="udev-acl" - -# GPS devices - # Garmin GPSMap 60 -SUBSYSTEM=="usb", ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", TAG+="udev-acl" - - # DRI video devices SUBSYSTEM=="drm", KERNEL=="card*", TAG+="udev-acl" @@ -62,9 +54,6 @@ ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" # joysticks SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" -# smart phones -SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0c02", TAG+="udev-acl" - # color measurement devices ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="udev-acl" -- cgit v1.2.3-54-g00ecf From 1ef6c9e9f0f405d1fed403c13c57a233a484bed7 Mon Sep 17 00:00:00 2001 From: Jan Drzewiecki Date: Sun, 8 Aug 2010 17:47:08 +0200 Subject: cdrom_id: Fix detection of reblanked DVD+RW and DVD-RAM Once formatted, DVD+RW and DVD-RAM discs are always reported "complete" by the drive. Check the if the Volume Descriptor or Volume Descriptor Anchor sectors are empty, and if so, set the status to blank. If the disc is unformatted the blank status is maintained and no reads are issued. If the disc is formatted and read command fails, the status remains set to complete to avoid accidental blanking. Bug-Ubuntu: https://launchpad.net/bugs/581925 Signed-off-by: Martin Pitt --- extras/cdrom_id/cdrom_id.c | 105 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 2bea2e4b0c..9c4f6f31b4 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -532,6 +532,111 @@ static int cd_media_info(struct udev *udev, int fd) if (!cd_media_cd_rom) cd_media_state = media_status[header[2] & 3]; + /* DVD+RW discs once formatted are always "complete", DVD-RAM are + * "other" or "complete" if the disc is write protected; we need to + * check the contents if it is blank */ + if ((cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { + unsigned char buffer[17 * 2048]; + unsigned char result, len; + int block, offset; + + if (cd_media_dvd_ram) { + /* a write protected dvd-ram may report "complete" status */ + + unsigned char dvdstruct[8]; + unsigned char format[12]; + + scsi_cmd_init(udev, &sc, dvdstruct, sizeof(dvdstruct)); + scsi_cmd_set(udev, &sc, 0, 0xAD); + scsi_cmd_set(udev, &sc, 7, 0xC0); + scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); + scsi_cmd_set(udev, &sc, 11, 0); + err = scsi_cmd_run(udev, &sc, fd, dvdstruct, sizeof(dvdstruct)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DVD STRUCTURE", err); + return -1; + } + if (dvdstruct[4] & 0x02) { + cd_media_state = media_status[2]; + info(udev, "write-protected DVD-RAM media inserted\n"); + goto determined; + } + + /* let's make sure we don't try to read unformatted media */ + scsi_cmd_init(udev, &sc, format, sizeof(format)); + scsi_cmd_set(udev, &sc, 0, 0x23); + scsi_cmd_set(udev, &sc, 8, sizeof(format)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, format, sizeof(format)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DVD FORMAT CAPACITIES", err); + return -1; + } + + len = format[3]; + if (len & 7 || len < 16) { + info(udev, "invalid format capacities length\n"); + return -1; + } + + switch(format[8] & 3) { + case 1: + info(udev, "unformatted DVD-RAM media inserted\n"); + /* This means that last format was interrupted + * or failed, blank dvd-ram discs are factory + * formatted. Take no action here as it takes + * quite a while to reformat a dvd-ram and it's + * not automatically started */ + goto determined; + + case 2: + info(udev, "formatted DVD-RAM media inserted\n"); + break; + + case 3: + cd_media = 0; //return no media + info(udev, "format capacities returned no media\n"); + return -1; + } + } + + /* Take a closer look at formatted media (unformatted DVD+RW + * has "blank" status", DVD-RAM was examined earlier) and check + * for ISO and UDF PVDs or a fs superblock presence and do it + * in one ioctl (we need just sectors 0 and 16) */ + scsi_cmd_init(udev, &sc, buffer, sizeof(buffer)); + scsi_cmd_set(udev, &sc, 0, 0x28); + scsi_cmd_set(udev, &sc, 5, 0); + scsi_cmd_set(udev, &sc, 8, 17); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err); + return -1; + } + + /* if any non-zero data is found in sector 16 (iso and udf) or + * eventually 0 (fat32 boot sector, ext2 superblock, etc), disc + * is assumed non-blank */ + result = 0; + + for (block = 32768; block >= 0 && !result; block -= 32768) { + offset = block; + while (offset < (block + 2048) && !result) { + result = buffer [offset]; + offset++; + } + } + + if (!result) { + cd_media_state = media_status[0]; + info(udev, "no data in blocks 0 or 16, assuming blank\n"); + } else { + info(udev, "data in blocks 0 or 16, assuming complete\n"); + } + } + +determined: if ((header[2] & 3) != 2) cd_media_session_next = header[10] << 8 | header[5]; cd_media_session_count = header[9] << 8 | header[4]; -- cgit v1.2.3-54-g00ecf From d83dfabe0d75d0c5dd322f05abc1f04d2ca5be6c Mon Sep 17 00:00:00 2001 From: Jan Drzewiecki Date: Sun, 8 Aug 2010 17:57:47 +0200 Subject: cdrom_id: Handle pre-MMC2 drives Those do not yet support the 0x46 "GET CONFIGURATION" support. If we have those, fall back to the 0x51 "READ DISC INFORMATION" call. This can only differentiate between CD-RW and CD-R, but first that's better than a complete detection failure, and second, those old drives likely don't support more modern media in the first place. https://launchpad.net/bugs/502143 Signed-off-by: Martin Pitt --- extras/cdrom_id/cdrom_id.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 9c4f6f31b4..6500206228 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -348,6 +348,41 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si return 0; } +static int cd_profiles_old_mmc(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + int err; + + unsigned char header[32]; + + scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); + info(udev, "no current profile, assuming no media\n"); + return -1; + }; + + cd_media = 1; + + if (header[2] & 16) { + cd_media_cd_rw = 1; + info(udev, "profile 0x0a media_cd_rw\n"); + } + else if ((header[2] & 3) < 2 && cd_cd_r) { + cd_media_cd_r = 1; + info(udev, "profile 0x09 media_cd_r\n"); + } + else { + cd_media_cd_rom = 1; + info(udev, "profile 0x08 media_cd_rom\n"); + } + return 0; +} + static int cd_profiles(struct udev *udev, int fd) { struct scsi_cmd sc; @@ -365,6 +400,12 @@ static int cd_profiles(struct udev *udev, int fd) err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features)); if ((err != 0)) { info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ + if (SK(err) == 0x5 && ASC(err) == 0x20) { + info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n"); + info(udev, "trying to work around the problem\n"); + return cd_profiles_old_mmc(udev, fd); + } return -1; } -- cgit v1.2.3-54-g00ecf From a6b03c09617354d729cedada9e63dc2a595c0c62 Mon Sep 17 00:00:00 2001 From: Jan Drzewiecki Date: Sun, 8 Aug 2010 19:19:07 +0200 Subject: cdrom_id: Also apply format check to DVD-RW Extend the DVD+RW/DVD-RAM check in commit 1ef6c9e to also cover DVD-RW, since in "restricted overwrite" mode they behave similar to DVD+RW. Signed-off-by: Martin Pitt --- extras/cdrom_id/cdrom_id.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 6500206228..0ec79e677b 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -573,10 +573,10 @@ static int cd_media_info(struct udev *udev, int fd) if (!cd_media_cd_rom) cd_media_state = media_status[header[2] & 3]; - /* DVD+RW discs once formatted are always "complete", DVD-RAM are - * "other" or "complete" if the disc is write protected; we need to - * check the contents if it is blank */ - if ((cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { + /* DVD+RW discs (and DVD-RW in restricted mode) once formatted are + * always "complete", DVD-RAM are "other" or "complete" if the disc is + * write protected; we need to check the contents if it is blank */ + if ((cd_media_dvd_rw || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { unsigned char buffer[17 * 2048]; unsigned char result, len; int block, offset; -- cgit v1.2.3-54-g00ecf From 45b1d780b960f3bcad84ae8a2702cdcf43b3e5cb Mon Sep 17 00:00:00 2001 From: Jan Drzewiecki Date: Sun, 8 Aug 2010 19:22:13 +0200 Subject: cdrom_id: No "next session" for "other" media state "other" is known to apply to DVD-RAMs, where sessions can't be appended. Signed-off-by: Martin Pitt --- extras/cdrom_id/cdrom_id.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 0ec79e677b..fd7d482f89 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -678,7 +678,8 @@ static int cd_media_info(struct udev *udev, int fd) } determined: - if ((header[2] & 3) != 2) + /* "other" is e. g. DVD-RAM, can't append sessions there either */ + if ((header[2] & 3) < 2) cd_media_session_next = header[10] << 8 | header[5]; cd_media_session_count = header[9] << 8 | header[4]; cd_media_track_count = header[11] << 8 | header[6]; -- cgit v1.2.3-54-g00ecf From 40929a0222bbc82459c6418b03d51790ca65d74b Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Thu, 5 Aug 2010 11:47:48 +0800 Subject: udevd: fix unref'ing of device in error path Signed-off-by: Yin Kangkai Signed-off-by: Martin Pitt --- udev/udevd.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 2808117824..6dc97955d6 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -402,13 +402,13 @@ static void event_run(struct event *event, bool force) worker_new(event); } -static void event_queue_insert(struct udev_device *dev) +static int event_queue_insert(struct udev_device *dev) { struct event *event; event = calloc(1, sizeof(struct event)); if (event == NULL) - return; + return -1; event->udev = udev_device_get_udev(dev); event->dev = dev; @@ -429,8 +429,10 @@ static void event_queue_insert(struct udev_device *dev) /* run all events with a timeout set immediately */ if (udev_device_get_timeout(dev) > 0) { event_run(event, true); - return; + return 0; } + + return 0; } static void worker_kill(struct udev *udev, int retain) @@ -1351,9 +1353,8 @@ int main(int argc, char *argv[]) dev = udev_monitor_receive_device(monitor); if (dev != NULL) - event_queue_insert(dev); - else - udev_device_unref(dev); + if (event_queue_insert(dev) < 0) + udev_device_unref(dev); } /* start new events */ -- cgit v1.2.3-54-g00ecf From 08f11597f2618d46b23f0e747a41a0ee960bcf1b Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Thu, 5 Aug 2010 16:17:00 +0800 Subject: udevd: create static device links only when the target exists For example, not all systems have PROC_KCORE enabled. Avoid a broken symbolic link in those cases. Signed-off-by: Yin Kangkai Signed-off-by: Martin Pitt --- udev/udevd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 6dc97955d6..61b76f5c3e 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -900,10 +900,14 @@ static void static_dev_create_links(struct udev *udev, DIR *dir) unsigned int i; for (i = 0; i < ARRAY_SIZE(stdlinks); i++) { - udev_selinux_setfscreateconat(udev, dirfd(dir), stdlinks[i].link, S_IFLNK); - if (symlinkat(stdlinks[i].target, dirfd(dir), stdlinks[i].link) < 0 && errno == EEXIST) - utimensat(dirfd(dir), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); - udev_selinux_resetfscreatecon(udev); + struct stat sb; + + if (stat(stdlinks[i].target, &sb) == 0) { + udev_selinux_setfscreateconat(udev, dirfd(dir), stdlinks[i].link, S_IFLNK); + if (symlinkat(stdlinks[i].target, dirfd(dir), stdlinks[i].link) < 0 && errno == EEXIST) + utimensat(dirfd(dir), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); + udev_selinux_resetfscreatecon(udev); + } } } -- cgit v1.2.3-54-g00ecf From ae8011a084fec398bd6e94694a5d6aca15b3c7a9 Mon Sep 17 00:00:00 2001 From: Yin Kangkai Date: Fri, 6 Aug 2010 15:08:51 +0800 Subject: udev: fix compile warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CC udev/udevd.o In file included from udev/udev.h:27, from udev/udevd.c:47: ./libudev/libudev-private.h: In function ‘udev_selinux_setfscreateconat’: ./libudev/libudev-private.h:230: warning: declaration of ‘dirfd’ shadows a global declaration /usr/include/dirent.h:224: warning: shadowed declaration is here Signed-off-by: Yin Kangkai Signed-off-by: Martin Pitt --- libudev/libudev-private.h | 4 ++-- libudev/libudev-selinux-private.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index fa408f6ae6..475f992ba7 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -227,14 +227,14 @@ static inline void udev_selinux_init(struct udev *udev) {} static inline void udev_selinux_exit(struct udev *udev) {} static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} -static inline void udev_selinux_setfscreateconat(struct udev *udev, int dirfd, const char *file, unsigned int mode) {} +static inline void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode) {} static inline void udev_selinux_resetfscreatecon(struct udev *udev) {} #else void udev_selinux_init(struct udev *udev); void udev_selinux_exit(struct udev *udev); void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); -void udev_selinux_setfscreateconat(struct udev *udev, int dirfd, const char *file, unsigned int mode); +void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode); void udev_selinux_resetfscreatecon(struct udev *udev); #endif diff --git a/libudev/libudev-selinux-private.c b/libudev/libudev-selinux-private.c index 2d4463d864..be68aa1c2b 100644 --- a/libudev/libudev-selinux-private.c +++ b/libudev/libudev-selinux-private.c @@ -83,7 +83,7 @@ void udev_selinux_resetfscreatecon(struct udev *udev) err(udev, "setfscreatecon failed: %m\n"); } -void udev_selinux_setfscreateconat(struct udev *udev, int dirfd, const char *file, unsigned int mode) +void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode) { char filename[UTIL_PATH_SIZE]; -- cgit v1.2.3-54-g00ecf From 2d57b4f8ec53e834317518bde34cf849dabab8c4 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 9 Aug 2010 11:41:18 +0100 Subject: udev-acl: add DDC_DEVICE to the types that are managed DDC_DEVICEs are control points for high-end monitors such as the HP DreamColor. The DDC/CI interface allows userspace applications to upload custom colorspaces and interact with the display without using the monitor hardware controls. --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 25e3f609f1..6ec04ee455 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -57,6 +57,9 @@ SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" # color measurement devices ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="udev-acl" +# DDC/CI device, usually high-end monitors such as the DreamColor +ENV{DDC_DEVICE}=="*?", TAG+="udev-acl" + # apply ACL for all locally logged in users LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" -- cgit v1.2.3-54-g00ecf From c11f89b61a7872f640a15292a21c43504ce664da Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Aug 2010 08:07:28 +0200 Subject: fix broken "compile warning fix" --- libudev/libudev-selinux-private.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-selinux-private.c b/libudev/libudev-selinux-private.c index be68aa1c2b..cb06a280f7 100644 --- a/libudev/libudev-selinux-private.c +++ b/libudev/libudev-selinux-private.c @@ -96,7 +96,7 @@ void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, char target[UTIL_PATH_SIZE]; ssize_t len; - snprintf(procfd, sizeof(procfd), "/proc/%u/fd/%u", getpid(), dirfd); + snprintf(procfd, sizeof(procfd), "/proc/%u/fd/%u", getpid(), dfd); len = readlink(procfd, target, sizeof(target)); if (len <= 0 || len == sizeof(target)) return; -- cgit v1.2.3-54-g00ecf From 09c03103028011935044bbade29a602925898f27 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 10 Aug 2010 16:41:24 +0200 Subject: udev-event.c: rename interface to -, if taken e.g. if eth0 should be eth3 and eth3 is waiting to be renamed, eth0 was renamed to eth0_rename. The kernel would take eth0 as the name for a new interface and this new eth0 could also become eth0_rename, if the target name is also taken. To prevent this name clash, the interfaces are now renamed to - and the rename is logged. --- udev/udev-event.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 7591d5e314..7785ad892c 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -465,6 +465,7 @@ static int rename_netif(struct udev_event *event) int sk; struct ifreq ifr; int err; + char *newdup; info(event->udev, "changing net interface name from '%s' to '%s'\n", udev_device_get_sysname(dev), event->name); @@ -492,13 +493,16 @@ static int rename_netif(struct udev_event *event) } /* free our own name, another process may wait for us */ - util_strscpyl(ifr.ifr_newname, IFNAMSIZ, udev_device_get_sysname(dev), "_rename", NULL); + newdup = strdup(ifr.ifr_newname); + util_strscpyl(ifr.ifr_newname, IFNAMSIZ, udev_device_get_sysname(dev), "-", newdup, NULL); + free(newdup); err = ioctl(sk, SIOCSIFNAME, &ifr); if (err != 0) { err(event->udev, "error changing netif name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); goto exit; } + rename_netif_kernel_log(ifr); /* wait 90 seconds for our target to become available */ util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); -- cgit v1.2.3-54-g00ecf From ef5304bc8ddda1917143e96bc3addeb5a09588c6 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Tue, 10 Aug 2010 16:48:37 +0200 Subject: rule_generator/write_net_rules: prevent interface to be named "eth" find_next_available() would return "eth" instead of "eth0" --- extras/rule_generator/write_net_rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules index 644fbcecba..437979241f 100644 --- a/extras/rule_generator/write_net_rules +++ b/extras/rule_generator/write_net_rules @@ -128,6 +128,8 @@ else # if a rule using the current name already exists, find a new name if interface_name_taken; then INTERFACE="$basename$(find_next_available "$basename[0-9]*")" + # prevent INTERFACE from being "eth" instead of "eth0" + [ "$INTERFACE" = "${INTERFACE%%[ \[\]0-9]*}" ] && INTERFACE=${INTERFACE}0 echo "INTERFACE_NEW=$INTERFACE" fi fi -- cgit v1.2.3-54-g00ecf From cf2205a1986222fdc0238190f5742f54d943cd23 Mon Sep 17 00:00:00 2001 From: Jan Drzewiecki Date: Tue, 10 Aug 2010 23:37:14 +0200 Subject: cdrom_id: Fix state for fresh DVD-RW Fresh DVD-RW in restricted overwite mode reports itself as "appendable"; change it to "blank" to make it consistent with what gets reported after blanking, and what userspace expects. For the exotic case where some uses multi-track recording on a DVD-RW in sequential mode, we need to tell apart sequential and restricted overwrite modes, so keep separate states for them internally. Signed-off-by: Martin Pitt --- extras/cdrom_id/cdrom_id.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index fd7d482f89..338b3782cb 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -85,6 +85,8 @@ static unsigned int cd_media_cd_rw = 0; static unsigned int cd_media_dvd_rom = 0; static unsigned int cd_media_dvd_r = 0; static unsigned int cd_media_dvd_rw = 0; +static unsigned int cd_media_dvd_rw_ro = 0; /* restricted overwrite mode */ +static unsigned int cd_media_dvd_rw_seq = 0; /* sequential mode */ static unsigned int cd_media_dvd_ram = 0; static unsigned int cd_media_dvd_plus_r = 0; static unsigned int cd_media_dvd_plus_rw = 0; @@ -295,9 +297,14 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si cd_dvd_ram = 1; break; case 0x13: + info(udev, "profile 0x%02x media_dvd_rw\n", profile); + cd_media_dvd_rw = 1; + cd_media_dvd_rw_ro = 1; + break; case 0x14: info(udev, "profile 0x%02x dvd_rw\n", profile); cd_dvd_rw = 1; + cd_media_dvd_rw_seq = 1; break; case 0x1B: info(udev, "profile 0x%02x dvd_plus_r\n", profile); @@ -573,10 +580,16 @@ static int cd_media_info(struct udev *udev, int fd) if (!cd_media_cd_rom) cd_media_state = media_status[header[2] & 3]; + /* fresh DVD-RW in restricted overwite mode reports itself as + * "appendable"; change it to "blank" to make it consistent with what + * gets reported after blanking, and what userspace expects */ + if (cd_media_dvd_rw_ro && (header[2] & 3) == 1) + cd_media_state = media_status[0]; + /* DVD+RW discs (and DVD-RW in restricted mode) once formatted are * always "complete", DVD-RAM are "other" or "complete" if the disc is * write protected; we need to check the contents if it is blank */ - if ((cd_media_dvd_rw || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { + if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { unsigned char buffer[17 * 2048]; unsigned char result, len; int block, offset; -- cgit v1.2.3-54-g00ecf From ce9a42bec40330d0a0c83d21f07177cb2d08f1ac Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 11 Aug 2010 14:29:49 +0200 Subject: always log error when renaming a network interface fails --- udev/udev-event.c | 83 +++++++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 43 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 7785ad892c..1ecf82423f 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -464,8 +464,8 @@ static int rename_netif(struct udev_event *event) struct udev_device *dev = event->dev; int sk; struct ifreq ifr; + int loop; int err; - char *newdup; info(event->udev, "changing net interface name from '%s' to '%s'\n", udev_device_get_sysname(dev), event->name); @@ -473,61 +473,58 @@ static int rename_netif(struct udev_event *event) sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { err(event->udev, "error opening socket: %m\n"); - return -1; + return -errno; } memset(&ifr, 0x00, sizeof(struct ifreq)); util_strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev)); util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err == 0) + if (err == 0) { rename_netif_kernel_log(ifr); - else { - int loop; - - /* see if the destination interface name already exists */ - if (errno != EEXIST) { - err(event->udev, "error changing netif name %s to %s: %m\n", - ifr.ifr_name, ifr.ifr_newname); - goto exit; - } + goto out; + } - /* free our own name, another process may wait for us */ - newdup = strdup(ifr.ifr_newname); - util_strscpyl(ifr.ifr_newname, IFNAMSIZ, udev_device_get_sysname(dev), "-", newdup, NULL); - free(newdup); - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err != 0) { - err(event->udev, "error changing netif name %s to %s: %m\n", - ifr.ifr_name, ifr.ifr_newname); - goto exit; - } - rename_netif_kernel_log(ifr); + /* keep trying if the destination interface name already exists */ + err = -errno; + if (err != -EEXIST) + goto out; - /* wait 90 seconds for our target to become available */ - util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); - util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); - loop = 90 * 20; - while (loop--) { - const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; + /* free our own name, another process may wait for us */ + util_strscpyl(ifr.ifr_newname, IFNAMSIZ, udev_device_get_sysname(dev), "-", event->name, NULL); + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err < 0) { + err = -errno; + goto out; + } - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err == 0) { - rename_netif_kernel_log(ifr); - break; - } + /* log temporary name */ + rename_netif_kernel_log(ifr); - if (errno != EEXIST) { - err(event->udev, "error changing net interface name %s to %s: %m\n", - ifr.ifr_name, ifr.ifr_newname); - break; - } - dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", - event->name, (90 * 20) - loop); - nanosleep(&duration, NULL); + /* wait a maximum of 90 seconds for our target to become available */ + util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); + util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); + loop = 90 * 20; + while (loop--) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; + + dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", + event->name, (90 * 20) - loop); + nanosleep(&duration, NULL); + + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err == 0) { + rename_netif_kernel_log(ifr); + break; } + err = -errno; + if (err != -EEXIST) + break; } -exit: + +out: + if (err < 0) + err(event->udev, "error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); close(sk); return err; } -- cgit v1.2.3-54-g00ecf From ebd189621f4b7e0034ea7a7067199bc9a0f28145 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 11 Aug 2010 14:34:32 +0200 Subject: do not rename the database on device rename Harald Hoyer discovered some incorrect behavior while debugging problems with network interface renaming: Udev events might be queued for devices which are renamed. A new device registered the same time may claime the old name and create a database entry for it. The current rename logic would move over this databse entry to the wrong device. --- Makefile.am | 2 +- libudev/libudev-device-private.c | 16 ---------------- libudev/libudev-private.h | 1 - libudev/libudev-queue-private.c | 11 ----------- udev/udev-event.c | 8 -------- 5 files changed, 1 insertion(+), 37 deletions(-) diff --git a/Makefile.am b/Makefile.am index e80d43abe5..c16b2594d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,7 +30,7 @@ CLEANFILES = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=9 -LIBUDEV_REVISION=0 +LIBUDEV_REVISION=1 LIBUDEV_AGE=9 SUBDIRS += libudev/docs diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 8c8ac244be..a4b2fb0169 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -177,19 +177,3 @@ int udev_device_delete_db(struct udev_device *udev_device) unlink(filename); return 0; } - -int udev_device_rename_db(struct udev_device *udev_device) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename_old[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - - if (strcmp(udev_device_get_sysname(udev_device), udev_device_get_sysname_old(udev_device)) == 0) - return 0; - - util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/db/", - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); - return rename(filename_old, filename); -} diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 475f992ba7..7ed4afc42c 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -104,7 +104,6 @@ void udev_device_set_info_loaded(struct udev_device *device); /* libudev-device-private.c */ int udev_device_update_db(struct udev_device *udev_device); int udev_device_delete_db(struct udev_device *udev_device); -int udev_device_rename_db(struct udev_device *udev_device); int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add); /* libudev-monitor.c - netlink/unix socket communication */ diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 6109837f7e..06dc2f5e0e 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -423,17 +423,6 @@ static void update_failed(struct udev_queue_export *udev_queue_export, break; case DEVICE_FINISHED: - if (udev_device_get_sysname_old(udev_device) != NULL && - strcmp(udev_device_get_sysname_old(udev_device), udev_device_get_sysname(udev_device)) != 0) { - /* "move" event - rename failed file to current name, do not delete failed */ - char filename_old[UTIL_PATH_SIZE]; - - util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/failed/", - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname_old(udev_device), NULL); - if (rename(filename_old, filename) == 0) - info(udev, "renamed devpath, moved failed state of '%s' to %s'\n", - udev_device_get_devpath_old(udev_device), udev_device_get_devpath(udev_device)); - } break; } diff --git a/udev/udev-event.c b/udev/udev-event.c index 1ecf82423f..9b5326bf22 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -534,14 +534,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) struct udev_device *dev = event->dev; int err = 0; - if (udev_device_get_sysname_old(dev) != NULL && - strcmp(udev_device_get_sysname_old(dev), udev_device_get_sysname(dev)) != 0) { - udev_device_rename_db(dev); - info(event->udev, "moved database from '%s:%s' to '%s:%s'\n", - udev_device_get_subsystem(dev), udev_device_get_sysname_old(dev), - udev_device_get_subsystem(dev), udev_device_get_sysname(dev)); - } - if (strcmp(udev_device_get_action(dev), "remove") == 0) { udev_device_read_db(dev); udev_device_delete_db(dev); -- cgit v1.2.3-54-g00ecf From 36b6aca5c108e30af9742b79eff46272be771f82 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 11 Aug 2010 15:04:05 +0200 Subject: cdrom_id: whitespace fix --- extras/cdrom_id/cdrom_id.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 338b3782cb..5086bfa64f 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -378,14 +378,12 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd) if (header[2] & 16) { cd_media_cd_rw = 1; info(udev, "profile 0x0a media_cd_rw\n"); - } - else if ((header[2] & 3) < 2 && cd_cd_r) { + } else if ((header[2] & 3) < 2 && cd_cd_r) { cd_media_cd_r = 1; info(udev, "profile 0x09 media_cd_r\n"); - } - else { - cd_media_cd_rom = 1; - info(udev, "profile 0x08 media_cd_rom\n"); + } else { + cd_media_cd_rom = 1; + info(udev, "profile 0x08 media_cd_rom\n"); } return 0; } -- cgit v1.2.3-54-g00ecf From 1b3b6c2df7d84b620e1168ea4dfe96cca5ec5f8e Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Wed, 11 Aug 2010 15:20:31 +0200 Subject: cdrom_id: READ TOC before READ DISC INFORMATION fixes qemu --- extras/cdrom_id/cdrom_id.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 5086bfa64f..889b2342e8 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -868,14 +868,14 @@ int main(int argc, char *argv[]) if (cd_profiles(udev, fd) < 0) goto print; - /* get writable media state */ - if (cd_media_info(udev, fd) < 0) - goto print; - /* get session/track info */ if (cd_media_toc(udev, fd) < 0) goto print; + /* get writable media state */ + if (cd_media_info(udev, fd) < 0) + goto print; + print: printf("ID_CDROM=1\n"); if (cd_cd_rom) -- cgit v1.2.3-54-g00ecf From 4f7f02b7bab1acfab87b824b91f5a848cbf835e7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 11 Aug 2010 15:38:48 +0200 Subject: cdrom_id: do not bail out when we can not read the TOC like for empty CDRW --- extras/cdrom_id/cdrom_id.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 889b2342e8..83e95d5812 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -869,12 +869,10 @@ int main(int argc, char *argv[]) goto print; /* get session/track info */ - if (cd_media_toc(udev, fd) < 0) - goto print; + cd_media_toc(udev, fd); /* get writable media state */ - if (cd_media_info(udev, fd) < 0) - goto print; + cd_media_info(udev, fd); print: printf("ID_CDROM=1\n"); -- cgit v1.2.3-54-g00ecf From 8a5b0ff5efab04a95492a75e8f048e2ec0a3d427 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 11 Aug 2010 15:43:17 +0200 Subject: release 161 --- ChangeLog | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4bdc05d011..683a1defb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,65 @@ +Summary of changes from v160 to v161 +============================================ + +Fortunato Ventre (1): + keymap: Add force-release quirks for a lot more Samsung models + +Harald Hoyer (3): + udev-event.c: rename interface to -, if taken + rule_generator/write_net_rules: prevent interface to be named "eth" + cdrom_id: READ TOC before READ DISC INFORMATION fixes qemu + +Jan Drzewiecki (5): + cdrom_id: Fix detection of reblanked DVD+RW and DVD-RAM + cdrom_id: Handle pre-MMC2 drives + cdrom_id: Also apply format check to DVD-RW + cdrom_id: No "next session" for "other" media state + cdrom_id: Fix state for fresh DVD-RW + +Jerone Young (1): + Fix volume keys not releasing on Mivvy G310 + +Kay Sievers (12): + version bump + rules: remove firewire rules for deprecated drivers + udev-acl: update firewire matches to recent rule changes + libudev: bump minor so version after adding symbols + call util_delete_path() only when we actually deleted stuff + udev-acl: properly handle CK change events for root user + udev-acl: remove specific device matches from the rules file + fix broken "compile warning fix" + always log error when renaming a network interface fails + do not rename the database on device rename + cdrom_id: whitespace fix + cdrom_id: do not bail out when we can not read the TOC like for empty CDRW + +Marco d'Itri (3): + hid2hci: fix Logitech diNovo, MX5500 and other keyboards + log an error when a message from the wrong version of udevadm is ignored + hid2hci: fix for Logitech diNovo Edge keyboard + +Martin Pitt (1): + keymap: Generalize Samsung keymaps + +Michal Schmidt (1): + udev-acl: really fix ACL assignment in CK events + +Richard Hughes (1): + udev-acl: add DDC_DEVICE to the types that are managed + +Stefan Richter (1): + rules: add more FireWire IDs: Point Grey IIDC; AV/C + vendor unique + +Yin Kangkai (7): + udevadm: fix short options in getopt() + udevd: fix some memory leaks in error path + malloc()+memset() -> calloc() + udevd: fix short options in getopt() + udevd: fix unref'ing of device in error path + udevd: create static device links only when the target exists + udev: fix compile warning + + Summary of changes from v159 to v160 ============================================ -- cgit v1.2.3-54-g00ecf From 24af530a543c70ac59fdd244377d648ef77a0e21 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 12 Aug 2010 07:10:12 +0200 Subject: cdrom_id: Add media status debugging Show which media status the hardware originally reports, since we mangle it in some cases. --- extras/cdrom_id/cdrom_id.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 83e95d5812..d59991c6b5 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -573,6 +573,7 @@ static int cd_media_info(struct udev *udev, int fd) cd_media = 1; info(udev, "disk type %02x\n", header[8]); + info(udev, "hardware reported media status: %s\n", media_status[header[2] & 3]); /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ if (!cd_media_cd_rom) -- cgit v1.2.3-54-g00ecf From 9cd075e35b8f660c75b0d72d4bea496fd6459f29 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 12 Aug 2010 17:04:55 +0100 Subject: Add keymap for Lenovo IdeaPad S10-3 Tested on S10-3, but presumably applicable to all IdeaPads. Signed-off-by: Martin Pitt --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 2 ++ extras/keymap/keymaps/lenovo-ideapad | 7 +++++++ 3 files changed, 10 insertions(+) create mode 100644 extras/keymap/keymaps/lenovo-ideapad diff --git a/Makefile.am b/Makefile.am index c16b2594d4..77df6ab767 100644 --- a/Makefile.am +++ b/Makefile.am @@ -537,6 +537,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint \ extras/keymap/keymaps/inventec-symphony_6.0_7.0 \ extras/keymap/keymaps/lenovo-3000 \ + extras/keymap/keymaps/lenovo-ideapad \ extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 13b557111c..2241422775 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -65,6 +65,8 @@ ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+=" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x6_tablet" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X200 Tablet*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x200_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" diff --git a/extras/keymap/keymaps/lenovo-ideapad b/extras/keymap/keymaps/lenovo-ideapad new file mode 100644 index 0000000000..d5f25671a5 --- /dev/null +++ b/extras/keymap/keymaps/lenovo-ideapad @@ -0,0 +1,7 @@ +# Key codes observed on S10-3, assumed valid on other IdeaPad models +0x81 rfkill # does nothing in BIOS +0x83 display_off # BIOS toggles screen state +0xB9 brightnessup # does nothing in BIOS +0xBA brightnessdown # does nothing in BIOS +0xF1 camera # BIOS toggles camera power +0xf2 unknown # trackpad enable/disable (does nothing in BIOS) -- cgit v1.2.3-54-g00ecf From b367a1c9d8a0f565effcdb45f86a365be1c8b622 Mon Sep 17 00:00:00 2001 From: Jan Drzewiecki Date: Fri, 13 Aug 2010 07:24:29 +0200 Subject: cdrom_id: Drop MEDIA_SESSION_NEXT for DVD-RW-RO Commit cf2205a fixed the media status for fresh DVD-RW in restricted overwrite mode, but missed a detail: We should not report the ID_CDROM_MEDIA_SESSION_NEXT property either, since in that mode you can never append tracks/sessions; this just works in sequential mode. Signed-off-by: Martin Pitt --- extras/cdrom_id/cdrom_id.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index d59991c6b5..f9d6e0bc24 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -690,8 +690,9 @@ static int cd_media_info(struct udev *udev, int fd) } determined: - /* "other" is e. g. DVD-RAM, can't append sessions there either */ - if ((header[2] & 3) < 2) + /* "other" is e. g. DVD-RAM, can't append sessions there; DVDs in + * restricted overwrite mode can never append, only in sequential mode */ + if ((header[2] & 3) < 2 && !cd_media_dvd_rw_ro) cd_media_session_next = header[10] << 8 | header[5]; cd_media_session_count = header[9] << 8 | header[4]; cd_media_track_count = header[11] << 8 | header[6]; -- cgit v1.2.3-54-g00ecf From 68bc0d7963a22967cc00244c4fad96fb45870712 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 17 Aug 2010 09:37:57 +0200 Subject: init: update systemd service files --- init/udev-retry.service.in | 4 ++-- init/udev-settle.service.in | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in index 76678999f4..d8ed8a8baa 100644 --- a/init/udev-retry.service.in +++ b/init/udev-retry.service.in @@ -4,9 +4,9 @@ DefaultDependencies=no After=local-fs.target udev.service [Service] -Type=finish +Type=oneshot ValidNoProcess=yes -ExecStart=@sbindir@/udevadm trigger --type=failed +ExecStart=@sbindir@/udevadm trigger --type=failed --action=add [Install] WantedBy=sysinit.target diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index 0594d72020..4db61f2f10 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -4,7 +4,7 @@ DefaultDependencies=no After=udev.service [Service] -Type=finish +Type=oneshot ValidNoProcess=yes ExecStart=@sbindir@/udevadm settle -- cgit v1.2.3-54-g00ecf From bd078c90b97c73ba5fe7475947e6ecd20e2eb048 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 17 Aug 2010 18:53:57 +0200 Subject: init: update systemd service files --- init/udev-retry.service.in | 1 - init/udev-settle.service.in | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in index d8ed8a8baa..7a0819ce17 100644 --- a/init/udev-retry.service.in +++ b/init/udev-retry.service.in @@ -5,7 +5,6 @@ After=local-fs.target udev.service [Service] Type=oneshot -ValidNoProcess=yes ExecStart=@sbindir@/udevadm trigger --type=failed --action=add [Install] diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index 4db61f2f10..4cb33aad35 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -5,7 +5,7 @@ After=udev.service [Service] Type=oneshot -ValidNoProcess=yes +RemainAfterExit=yes ExecStart=@sbindir@/udevadm settle [Install] -- cgit v1.2.3-54-g00ecf From 3bd7b89dc40c4a0440ee5fce2ea907971bfcfb10 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Wed, 18 Aug 2010 13:35:25 +0200 Subject: udev-acl: do not mistake all SCSI "processor" devices for scanner Both rules can be removed since now libsane sets libsane_matched also for SCSI scanners. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=589751 --- extras/udev-acl/70-acl.rules | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 6ec04ee455..c7134bc5bd 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -13,11 +13,7 @@ SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="udev-acl" # digicams with proprietary protocol ENV{ID_GPHOTO2}=="*?", TAG+="udev-acl" -# SCSI scanners -KERNEL=="sg[0-9]*", ATTRS{type}=="6", TAG+="udev-acl" -KERNEL=="sg[0-9]*", ATTRS{type}=="3", ATTRS{vendor}=="HP|EPSON|Epson", TAG+="udev-acl" - -# USB scanners +# SCSI and USB scanners ENV{libsane_matched}=="yes", TAG+="udev-acl" # HPLIP devices (necessary for ink level check and HP tool maintenance) -- cgit v1.2.3-54-g00ecf From d15b727ef1375c665057c0fa278b2ea3778b8d3d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 19 Aug 2010 08:48:44 +0200 Subject: init: add 'udev -' to description in systemd service files --- init/udev-retry.service.in | 2 +- init/udev-settle.service.in | 2 +- init/udev.service.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in index 7a0819ce17..a6612da1fd 100644 --- a/init/udev-retry.service.in +++ b/init/udev-retry.service.in @@ -1,5 +1,5 @@ [Unit] -Description=re-trigger failed events after filesystems are available +Description=udev - re-trigger failed events after filesystems are available DefaultDependencies=no After=local-fs.target udev.service diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index 4cb33aad35..578a24f1ec 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -1,5 +1,5 @@ [Unit] -Description=wait until full initialization +Description=udev - wait until full initialization DefaultDependencies=no After=udev.service diff --git a/init/udev.service.in b/init/udev.service.in index e95cb476b7..5a63b77680 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -1,5 +1,5 @@ [Unit] -Description=/dev and kernel device manager +Description=udev - /dev and kernel device manager DefaultDependencies=no Before=sysinit.target -- cgit v1.2.3-54-g00ecf From c25bfbfb1b20781698ff3c8cbc884a9e190052ee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 19 Aug 2010 08:49:43 +0200 Subject: udevd: add pid to kmsg logs --- udev/udev-event.c | 4 ++-- udev/udevd.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 9b5326bf22..ae523f83c5 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -454,8 +454,8 @@ static void rename_netif_kernel_log(struct ifreq ifr) return; } - fprintf(f, "<6>udev: renamed network interface %s to %s\n", - ifr.ifr_name, ifr.ifr_newname); + fprintf(f, "<6>udev[%u]: renamed network interface %s to %s\n", + getpid(), ifr.ifr_name, ifr.ifr_newname); fclose(f); } diff --git a/udev/udevd.c b/udev/udevd.c index 61b76f5c3e..ad2ca3b4d2 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1298,7 +1298,7 @@ int main(int argc, char *argv[]) f = fopen("/dev/kmsg", "w"); if (f != NULL) { - fprintf(f, "<6>udev: starting version " VERSION "\n"); + fprintf(f, "<6>udev[%u]: starting version " VERSION "\n", getpid()); fclose(f); } -- cgit v1.2.3-54-g00ecf From 4c9b12a7aa57e43e568b78da9cbed4138b1292df Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 19 Aug 2010 18:02:20 +0200 Subject: init: edit systemd service descriptions --- init/udev-retry.service.in | 2 +- init/udev-settle.service.in | 2 +- init/udev.service.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in index a6612da1fd..ab8241b85e 100644 --- a/init/udev-retry.service.in +++ b/init/udev-retry.service.in @@ -1,5 +1,5 @@ [Unit] -Description=udev - re-trigger failed events after filesystems are available +Description=udev Retry Failed Events DefaultDependencies=no After=local-fs.target udev.service diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index 578a24f1ec..d58ea9c27d 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -1,5 +1,5 @@ [Unit] -Description=udev - wait until full initialization +Description=udev Wait for Complete Device Initialization DefaultDependencies=no After=udev.service diff --git a/init/udev.service.in b/init/udev.service.in index 5a63b77680..b07f4db6bd 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -1,5 +1,5 @@ [Unit] -Description=udev - /dev and kernel device manager +Description=udev Kernel Device Manager DefaultDependencies=no Before=sysinit.target -- cgit v1.2.3-54-g00ecf From f7b877ec498486a446c3f9239fe1aad62b79baf8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 19 Aug 2010 18:03:04 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index af8d082dd8..3d690d29b7 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 162 +======== +Bugfixes. + udev 161 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 4e9c49e426..0a18bb67fb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [161], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [162], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 6593e8961afbe0b74d5a67c545a991c7733e88df Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 20 Aug 2010 12:19:23 +0200 Subject: udev(7): Point out required extension, and remove some confusion Rules files must end in .rules. Also drop the redundant and confusing sentence about "file names must be unique". What is really meant is explained in a better way in the paragraph above. https://launchpad.net/bugs/616108 --- udev/udev.xml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 20c394c28b..336b203bec 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -75,12 +75,13 @@ the custom rules directory /etc/udev/rules.d/ and the temporary rules directory /dev/.udev/rules.d/. All rule files are sorted and processed in lexical order, regardless - in which of these directories they live. + in which of these directories they live. Files in + /etc/udev/rules.d/ have precedence over files with + the same name in /lib/udev/rules.d/. This can be + used to ignore a default rules file if needed. - Rule files are required to have a unique name, duplicate file names - are ignored. Files in /etc/udev/rules.d/ have precedence - over files with the same name in /lib/udev/rules.d/. This - can be used to ignore a default rules file if needed. + Rule files must end in .rules, other extensions + are ignored. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. -- cgit v1.2.3-54-g00ecf From acf865b68e1a5c78677537b373b6e082c287fc27 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 22 Aug 2010 11:00:34 +0200 Subject: keymap: Add Onkyo PC Thanks to Pau Oliva! https://launchpad.net/bugs/612529 --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 2 ++ extras/keymap/keymaps/onkyo | 14 ++++++++++++++ 3 files changed, 17 insertions(+) create mode 100644 extras/keymap/keymaps/onkyo diff --git a/Makefile.am b/Makefile.am index 77df6ab767..512de34a31 100644 --- a/Makefile.am +++ b/Makefile.am @@ -555,6 +555,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/module-sony \ extras/keymap/keymaps/module-sony-old \ extras/keymap/keymaps/olpc-xo \ + extras/keymap/keymaps/onkyo \ extras/keymap/keymaps/oqo-model2 \ extras/keymap/keymaps/samsung-other \ extras/keymap/keymaps/samsung-sq1us \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 2241422775..e9d5721309 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -127,6 +127,8 @@ ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite M30X", RUN+=" ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" +ENV{DMI_VENDOR}=="ONKYO CORPORATION", ATTR{[dmi/id]product_name}=="ONKYOPC", RUN+="keymap $name onkyo" + ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name 0x81 prog1" diff --git a/extras/keymap/keymaps/onkyo b/extras/keymap/keymaps/onkyo new file mode 100644 index 0000000000..7dd80a1fb0 --- /dev/null +++ b/extras/keymap/keymaps/onkyo @@ -0,0 +1,14 @@ +0xA0 mute # Fn+D +0xAE volumedown # Fn+F +0xB0 volumeup # Fn+G +0xDF sleep # Fn+W +0xE0 bluetooth # Fn+H +0xE2 cyclewindows # Fn+Esc +0xEE battery # Fn+Q +0xF0 media # Fn+R +0xF5 switchvideomode # Fn+E +0xF6 camera # Fn+T +0xF7 f22 # Fn+Y (touchpad toggle) +0xF8 brightnessup # Fn+S +0xF9 brightnessdown # Fn+A +0xFB wlan # Fn+J -- cgit v1.2.3-54-g00ecf From 92cffb0bd18bd8fd245666a519ad0e54dc537031 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 23 Aug 2010 10:47:28 +0200 Subject: keymap: Add HP G60 https://launchpad.net/bugs/554944 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index e9d5721309..5656de9aab 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -72,7 +72,7 @@ ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keymap $name hewlett-packard-pavilion" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*|*2230s*", RUN+="keymap $name hewlett-packard-compaq_elitebook" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*", RUN+="keymap $name hewlett-packard-2510p_2530p" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keymap $name hewlett-packard-2510p_2530p" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" # HP Pavillion dv6315ea has empty DMI_VENDOR -- cgit v1.2.3-54-g00ecf From 13f90be7a33353fdbcd4a389630a05c608bdf2a4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Aug 2010 16:26:54 +0200 Subject: udevd: remove unneeded credential passing from init_notify() --- udev/udevd.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index ad2ca3b4d2..374a4e0bc8 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -964,15 +964,10 @@ static int init_notify(const char *state) int fd = -1, r; struct msghdr msghdr; struct iovec iovec; - struct ucred *ucred; union { struct sockaddr sa; struct sockaddr_un un; } sockaddr; - union { - struct cmsghdr cmsghdr; - uint8_t buf[CMSG_SPACE(sizeof(struct ucred))]; - } control; const char *e; if (!(e = getenv("NOTIFY_SOCKET"))) { @@ -1002,16 +997,6 @@ static int init_notify(const char *state) iovec.iov_base = (char*) state; iovec.iov_len = strlen(state); - memset(&control, 0, sizeof(control)); - control.cmsghdr.cmsg_level = SOL_SOCKET; - control.cmsghdr.cmsg_type = SCM_CREDENTIALS; - control.cmsghdr.cmsg_len = CMSG_LEN(sizeof(struct ucred)); - - ucred = (struct ucred*) CMSG_DATA(&control.cmsghdr); - ucred->pid = getpid(); - ucred->uid = getuid(); - ucred->gid = getgid(); - memset(&msghdr, 0, sizeof(msghdr)); msghdr.msg_name = &sockaddr; msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e); @@ -1019,8 +1004,6 @@ static int init_notify(const char *state) msghdr.msg_namelen = sizeof(struct sockaddr_un); msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - msghdr.msg_control = &control; - msghdr.msg_controllen = control.cmsghdr.cmsg_len; if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { r = -errno; -- cgit v1.2.3-54-g00ecf From c61eea9459045c2c9032a0c98234985a371fac58 Mon Sep 17 00:00:00 2001 From: Luca Tettamanti Date: Mon, 23 Aug 2010 14:35:37 +0200 Subject: Add support for oom_score_adj /proc//oom_adj has been deprecated (kernel v2.6.36) due to the rework of the badness heuristic; oom_score_adj is the replacement. Keep a fallback to the old interface for compatibility with older kernels. See http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=a63d83f427fbce97a6cea0db2e64b0eb8435cd10 Signed-off-by: Martin Pitt --- udev/udevd.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 374a4e0bc8..0ec3c3d4ec 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1285,12 +1285,19 @@ int main(int argc, char *argv[]) fclose(f); } - /* OOM_DISABLE == -17 */ - fd = open("/proc/self/oom_adj", O_RDWR); + fd = open("/proc/self/oom_score_adj", O_RDWR); if (fd < 0) { - err(udev, "error disabling OOM: %m\n"); + /* Fallback to old interface */ + fd = open("/proc/self/oom_adj", O_RDWR); + if (fd < 0) { + err(udev, "error disabling OOM: %m\n"); + } else { + /* OOM_DISABLE == -17 */ + write(fd, "-17", 3); + close(fd); + } } else { - write(fd, "-17", 3); + write(fd, "-1000", 5); close(fd); } -- cgit v1.2.3-54-g00ecf From 38b5ccbcf7f3643ea8180a8186cfe3e5fa9cb983 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 25 Aug 2010 17:02:51 +0200 Subject: keymap: Fix Sony VAIO VGN-SZ2HP/B Reportedly this needs the module-sony keymap, not the -old one. https://launchpad.net/bugs/613578 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 5656de9aab..cb066bd0b9 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -46,7 +46,7 @@ ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" # Older Vaios have some different keys -ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*|*VGN-SZ2HP_B*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" +ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" # # The following rules belong to standard i8042 AT keyboard with high key codes. -- cgit v1.2.3-54-g00ecf From 83184d008ba23724fd30996440534c0633a0d0aa Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 27 Aug 2010 16:54:52 +0200 Subject: udev(7) manpage: Fix description of $attr Fix the manpage to describe the real behaviour of $attr: It doesn't search all parent devices any more, just the one selected by KERNELS etc. https://launchpad.net/bugs/348513 --- udev/udev.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 336b203bec..6085dfff24 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -578,8 +578,9 @@ The value of a sysfs attribute found at the device, where all keys of the rule have matched. If the matching device does not have - such an attribute, follow the chain of parent devices and use the value - of the first attribute that matches. + such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or + ATTRS test selected a parent device, use the attribute from that + parent device. If the attribute is a symlink, the last element of the symlink target is returned as the value. -- cgit v1.2.3-54-g00ecf From e4dcdc4ab232bcbbe61a2026c16e647d9302cdd2 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 27 Aug 2010 18:12:59 +0200 Subject: gudev: fix crash if netlink is not available gudev_client_new() assumes that priv->monitor is never NULL, but this happens on older kernels. Let's not crash client programs because of that. https://launchpad.net/bugs/581527 --- extras/gudev/gudevclient.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/extras/gudev/gudevclient.c b/extras/gudev/gudevclient.c index fa31f70bf5..f5f7a198db 100644 --- a/extras/gudev/gudevclient.c +++ b/extras/gudev/gudevclient.c @@ -93,6 +93,8 @@ monitor_event (GIOChannel *source, GUdevDevice *device; struct udev_device *udevice; + if (client->priv->monitor == NULL) + goto out; udevice = udev_monitor_receive_device (client->priv->monitor); if (udevice == NULL) goto out; @@ -216,17 +218,21 @@ g_udev_client_constructed (GObject *object) *s = '\0'; } - udev_monitor_filter_add_match_subsystem_devtype (client->priv->monitor, subsystem, devtype); + if (client->priv->monitor != NULL) + udev_monitor_filter_add_match_subsystem_devtype (client->priv->monitor, subsystem, devtype); g_free (subsystem); } /* listen to events, and buffer them */ - udev_monitor_enable_receiving (client->priv->monitor); - - channel = g_io_channel_unix_new (udev_monitor_get_fd (client->priv->monitor)); - client->priv->watch_id = g_io_add_watch (channel, G_IO_IN, monitor_event, client); - g_io_channel_unref (channel); + if (client->priv->monitor != NULL) + { + udev_monitor_enable_receiving (client->priv->monitor); + channel = g_io_channel_unix_new (udev_monitor_get_fd (client->priv->monitor)); + client->priv->watch_id = g_io_add_watch (channel, G_IO_IN, monitor_event, client); + g_io_channel_unref (channel); + } else + client->priv->watch_id = NULL; } if (G_OBJECT_CLASS (g_udev_client_parent_class)->constructed != NULL) -- cgit v1.2.3-54-g00ecf From d17c065e28fa4baac90b02b4913c7ef32d54f3c7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 27 Aug 2010 18:48:53 +0200 Subject: keymap: Fix Acer TravelMate 4720 The previous change just fixed the Bluetooth key, but Screen Lock and Browser also need to be changed. https://launchpad.net/bugs/569815 --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index cb066bd0b9..913b38007a 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -85,6 +85,7 @@ ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*4720*", RUN+="keymap $name 0xB2 www 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" -- cgit v1.2.3-54-g00ecf From 2458db3edd8d66827b34978ff471dff8f879e9ab Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 30 Aug 2010 15:33:26 +0200 Subject: cdrom_id: Fix DVD-RW media detection Commit cf2205a19 applied the "restricted overwrite" vs. "sequential" DVD-RW test to feature_profiles() (which reads the drive capabilities), which caused every DVD medium to be detected as ID_CDROM_MEDIA_DVD_RW. Now apply it to cd_profiles() instead, to just check the current profile. --- extras/cdrom_id/cdrom_id.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index f9d6e0bc24..8480d7b334 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -297,14 +297,9 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si cd_dvd_ram = 1; break; case 0x13: - info(udev, "profile 0x%02x media_dvd_rw\n", profile); - cd_media_dvd_rw = 1; - cd_media_dvd_rw_ro = 1; - break; case 0x14: info(udev, "profile 0x%02x dvd_rw\n", profile); cd_dvd_rw = 1; - cd_media_dvd_rw_seq = 1; break; case 0x1B: info(udev, "profile 0x%02x dvd_plus_r\n", profile); @@ -486,10 +481,16 @@ static int cd_profiles(struct udev *udev, int fd) cd_media_dvd_ram = 1; break; case 0x13: + info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_ro = 1; + break; case 0x14: - info(udev, "profile 0x%02x media_dvd_rw\n", cur_profile); + info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); cd_media = 1; cd_media_dvd_rw = 1; + cd_media_dvd_rw_seq = 1; break; case 0x1B: info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); -- cgit v1.2.3-54-g00ecf From 5e267ea5a36de0b2a9a8965ca93dd45bbd6b1a8b Mon Sep 17 00:00:00 2001 From: Jan Drzewiecki Date: Tue, 31 Aug 2010 00:37:28 +0200 Subject: cdrom_id: Fix DVD blank detection for sloppy firmware Reportedly, many CD drive firmwares will only consider the MSB in a READ command, thus if we request 17 blocks to be read, we'll actually only get 16 in many cases, and thus miss out the interesting sector #17. This would lead to falsely considering nonempty DVDs as blank. Fetch 32 blocks now, which should work everywhere. Signed-off-by: Martin Pitt --- extras/cdrom_id/cdrom_id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 8480d7b334..0153af6633 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -590,7 +590,7 @@ static int cd_media_info(struct udev *udev, int fd) * always "complete", DVD-RAM are "other" or "complete" if the disc is * write protected; we need to check the contents if it is blank */ if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { - unsigned char buffer[17 * 2048]; + unsigned char buffer[32 * 2048]; unsigned char result, len; int block, offset; @@ -661,7 +661,7 @@ static int cd_media_info(struct udev *udev, int fd) scsi_cmd_init(udev, &sc, buffer, sizeof(buffer)); scsi_cmd_set(udev, &sc, 0, 0x28); scsi_cmd_set(udev, &sc, 5, 0); - scsi_cmd_set(udev, &sc, 8, 17); + scsi_cmd_set(udev, &sc, 8, 32); scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); if ((err != 0)) { -- cgit v1.2.3-54-g00ecf From 326c5fc3ea684825629eccaf33a548759162a539 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 31 Aug 2010 21:29:21 +0200 Subject: set SELinux context on 'add' but not on 'change' events --- udev/udev-node.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 228b3ebee4..c8113f10b0 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -56,10 +56,17 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); chmod(file, mode); chown(file, uid, gid); - udev_selinux_lsetfilecon(udev, file, mode); } else { info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); } + /* + * Set initial selinux file context only on add events. + * We set the proper context on bootup (triger) or for newly + * added devices, but we don't change it later, in case + * something else has set a custom context in the meantime. + */ + if (strcmp(udev_device_get_action(dev), "add") == 0) + udev_selinux_lsetfilecon(udev, file, mode); /* always update timestamp when we re-use the node, like on media change events */ utimensat(AT_FDCWD, file, NULL, 0); } else { -- cgit v1.2.3-54-g00ecf From af29bf0966994bc233282148f519e12ea29e1c5a Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Tue, 31 Aug 2010 21:44:34 +0200 Subject: do not create persistent name rules for KVM network interfaces The virtual interfaces created by KVM are stable, 54:52:00 is the MAC-48 range of KVM. --- extras/rule_generator/75-persistent-net-generator.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index a9dfdce7a5..8119d0ea2f 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -29,6 +29,9 @@ ENV{MATCHADDR}="$attr{address}" # match interface type ENV{MATCHIFTYPE}="$attr{type}" +# ignore KVM virtual interfaces +ENV{MATCHADDR}=="54:52:00:*", GOTO="persistent_net_generator_end" + # These vendors are known to violate the local MAC address assignment scheme # Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom ENV{MATCHADDR}=="02:07:01:*", GOTO="globally_administered_whitelist" -- cgit v1.2.3-54-g00ecf From c03180194cb62cda286efcc1563391a1408394ff Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 2 Sep 2010 08:32:43 +0200 Subject: Fix KVM MAC address range KVM uses 52:54:00:* MACs: http://git.savannah.gnu.org/cgit/qemu.git/tree/net.c#n796 --- extras/rule_generator/75-persistent-net-generator.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 8119d0ea2f..566fbfa3e7 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -30,7 +30,7 @@ ENV{MATCHADDR}="$attr{address}" ENV{MATCHIFTYPE}="$attr{type}" # ignore KVM virtual interfaces -ENV{MATCHADDR}=="54:52:00:*", GOTO="persistent_net_generator_end" +ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" # These vendors are known to violate the local MAC address assignment scheme # Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom -- cgit v1.2.3-54-g00ecf From d4de0a0321b471e9dd8c32f1f3266b0b466457c7 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 2 Sep 2010 08:39:12 +0200 Subject: do not create persistent name rules for VMWare network interfaces Not generating persistent MAC address rules will significantly ease cloning of VMs. The kernel reliably sorts eth* enumeration by bus number, so as long as you only have cards from one vendor (or more precisely, drivers), the enumeration will be stable. Having cards from different vendors is very unlikely in VMs. KVM was already covered in the previous commit, this is the equivalent blacklist for VMWare: http://www.coffer.com/mac_find/?string=005056 http://www.coffer.com/mac_find/?string=000c29 https://launchpad.net/bugs/341006 --- extras/rule_generator/75-persistent-net-generator.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 566fbfa3e7..f150e55208 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -31,6 +31,8 @@ ENV{MATCHIFTYPE}="$attr{type}" # ignore KVM virtual interfaces ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" +# ignore VMWare virtual interfaces +ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" # These vendors are known to violate the local MAC address assignment scheme # Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom -- cgit v1.2.3-54-g00ecf From 620343ddd674da8ef79ba55061c4bba83cd2d84b Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Thu, 26 Aug 2010 19:10:03 -0700 Subject: Don't install systemd scripts with --without-systemdsystemunitdir Currently, the scripts get installed to /no/ if that option is specified. Signed-off-by: Martin Pitt --- configure.ac | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 0a18bb67fb..31c5b1848a 100644 --- a/configure.ac +++ b/configure.ac @@ -66,8 +66,10 @@ AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH]) AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) -AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) -AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir"]) +if test "x$with_systemdsystemunitdir" != xno; then + AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) +fi +AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) AC_ARG_ENABLE([extras], AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]), -- cgit v1.2.3-54-g00ecf From 634afac119bbe6bc21719ae3daa45805b1cf3334 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 2 Sep 2010 11:11:32 +0200 Subject: Add alternative KVM MAC address blacklist Reportedly, older KVM/Qemu instances indeed do use 54:52:00:*, so add this as an alternative. --- extras/rule_generator/75-persistent-net-generator.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index f150e55208..2df16740e7 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -30,7 +30,7 @@ ENV{MATCHADDR}="$attr{address}" ENV{MATCHIFTYPE}="$attr{type}" # ignore KVM virtual interfaces -ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" +ENV{MATCHADDR}=="52:54:00:*|54:52:00:*", GOTO="persistent_net_generator_end" # ignore VMWare virtual interfaces ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" -- cgit v1.2.3-54-g00ecf From 8937f371fb0033b0713fc1bbb1df19481b981f6b Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Fri, 3 Sep 2010 10:53:26 +0200 Subject: ChangeLog fix In v141 -> v142 entry, there's a note about udevd creating /dev/{null,kmsg,console}. It was added in commit 540f46698dd5a3b, but shortly after that removed in a00bdfa16b9bac7 before v142 release. Signed-off-by: Michal Soltys --- ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 683a1defb9..01e9a79ecb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1024,7 +1024,6 @@ Kay Sievers (46): test-libudev: update monitor source TODO: add packet filter update NEWS - udevd: at startup create /dev/null, /dev/console, /dev/kmsg cdrom_id: add and use ID_CDROM_MEDIA to decide if we run vol_id libudev: monitor - add client socket filter for subsystem value udevadm: monitor - print error if we can not bind to socket -- cgit v1.2.3-54-g00ecf From a04879b5643e9100b3c34c5c4ea9b44c5eec3e92 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Sep 2010 13:30:57 +0200 Subject: systemd: enable all udev services unconditionally --- Makefile.am | 25 +++++++++++++++++++++---- init/udev-retry.service.in | 5 +---- init/udev-settle.service.in | 4 ---- init/udev.service.in | 4 ---- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index 512de34a31..44cf002188 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,11 @@ DISTCHECK_CONFIGURE_FLAGS = \ CLEANFILES = +INSTALL_EXEC_HOOKS = +INSTALL_DATA_HOOKS = +UNINSTALL_EXEC_HOOKS = +DISTCHECK_HOOKS = + # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ @@ -84,16 +89,18 @@ libudev-install-move-hook: libudev-uninstall-move-hook: rm -f $(DESTDIR)$(rootlib_execdir)/libudev.so* -INSTALL_EXEC_HOOKS = libudev-install-move-hook -UNINSTALL_EXEC_HOOKS = libudev-uninstall-move-hook +INSTALL_EXEC_HOOKS += libudev-install-move-hook +UNINSTALL_EXEC_HOOKS += libudev-uninstall-move-hook # ------------------------------------------------------------------------------ # main udev # ------------------------------------------------------------------------------ -install-data-local: +udev-confdirs: -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d -mkdir -p $(DESTDIR)$(libexecdir)/devices +INSTALL_DATA_HOOKS += udev-confdirs + EXTRA_DIST += \ rules/arch \ rules/misc @@ -120,6 +127,14 @@ systemdsystemunit_DATA = \ init/udev.service \ init/udev-settle.service \ init/udev-retry.service + +systemd-install-hook: + mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants + ln -sf ../udev.service $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/udev.service + ln -sf ../udev-settle.service $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/udev-settle.service + ln -sf ../udev-retry.service $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/udev-retry.service + +INSTALL_DATA_HOOKS += systemd-install-hook endif sbin_PROGRAMS = \ @@ -585,7 +600,7 @@ extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile keymaps-distcheck-hook: extras/keymap/keys.txt $(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^ -DISTCHECK_HOOKS = keymaps-distcheck-hook +DISTCHECK_HOOKS += keymaps-distcheck-hook endif # ENABLE_EXTRAS @@ -607,6 +622,8 @@ EXTRA_DIST += $(TESTS) install-exec-hook: $(INSTALL_EXEC_HOOKS) +install-data-hook: $(INSTALL_DATA_HOOKS) + uninstall-hook: $(UNINSTALL_EXEC_HOOKS) distcheck-hook: $(DISTCHECK_HOOKS) diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in index ab8241b85e..222714e897 100644 --- a/init/udev-retry.service.in +++ b/init/udev-retry.service.in @@ -5,8 +5,5 @@ After=local-fs.target udev.service [Service] Type=oneshot +RemainAfterExit=yes ExecStart=@sbindir@/udevadm trigger --type=failed --action=add - -[Install] -WantedBy=sysinit.target -Also=udev.service udev-settle.service diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index d58ea9c27d..7550aaebd5 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -7,7 +7,3 @@ After=udev.service Type=oneshot RemainAfterExit=yes ExecStart=@sbindir@/udevadm settle - -[Install] -WantedBy=sysinit.target -Also=udev.service udev-retry.service diff --git a/init/udev.service.in b/init/udev.service.in index b07f4db6bd..4e5488f3a5 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -7,7 +7,3 @@ Before=sysinit.target Type=notify ExecStart=@sbindir@/udevd ExecStartPost=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add - -[Install] -WantedBy=sysinit.target -Also=udev-settle.service udev-retry.service -- cgit v1.2.3-54-g00ecf From f74310b4a0318fc68d1d5f53b565d24cff7881d2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Sep 2010 14:08:14 +0200 Subject: Revert "Add alternative KVM MAC address blacklist" This reverts commit 634afac119bbe6bc21719ae3daa45805b1cf3334. 54:52:00 was just a bug in libvirt, and that's better fixed locally, and we should not carry it in udev rules. --- extras/rule_generator/75-persistent-net-generator.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 2df16740e7..f150e55208 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -30,7 +30,7 @@ ENV{MATCHADDR}="$attr{address}" ENV{MATCHIFTYPE}="$attr{type}" # ignore KVM virtual interfaces -ENV{MATCHADDR}=="52:54:00:*|54:52:00:*", GOTO="persistent_net_generator_end" +ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" # ignore VMWare virtual interfaces ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" -- cgit v1.2.3-54-g00ecf From e7638c038b7e71619396cd69d61a64f29f64e638 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Sep 2010 15:07:03 +0200 Subject: release 162 --- ChangeLog | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 7 +++++++ 2 files changed, 57 insertions(+) diff --git a/ChangeLog b/ChangeLog index 01e9a79ecb..3dd0bd9a94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,53 @@ +Summary of changes from v161 to v162 +============================================ + +David Woodhouse (1): + Add keymap for Lenovo IdeaPad S10-3 + +Jan Drzewiecki (2): + cdrom_id: Drop MEDIA_SESSION_NEXT for DVD-RW-RO + cdrom_id: Fix DVD blank detection for sloppy firmware + +Kay Sievers (10): + init: update systemd service files + init: update systemd service files + init: add 'udev -' to description in systemd service files + udevd: add pid to kmsg logs + init: edit systemd service descriptions + version bump + udevd: remove unneeded credential passing from init_notify() + set SELinux context on 'add' but not on 'change' events + systemd: enable all udev services unconditionally + Revert "Add alternative KVM MAC address blacklist" + +Luca Tettamanti (1): + Add support for oom_score_adj + +Marco d'Itri (2): + udev-acl: do not mistake all SCSI "processor" devices for scanner + do not create persistent name rules for KVM network interfaces + +Martin Pitt (12): + cdrom_id: Add media status debugging + udev(7): Point out required extension, and remove some confusion + keymap: Add Onkyo PC + keymap: Add HP G60 + keymap: Fix Sony VAIO VGN-SZ2HP/B + udev(7) manpage: Fix description of $attr + gudev: fix crash if netlink is not available + keymap: Fix Acer TravelMate 4720 + cdrom_id: Fix DVD-RW media detection + Fix KVM MAC address range + do not create persistent name rules for VMWare network interfaces + Add alternative KVM MAC address blacklist + +Michael Forney (1): + Don't install systemd scripts with --without-systemdsystemunitdir + +Michal Soltys (1): + ChangeLog fix + + Summary of changes from v160 to v161 ============================================ diff --git a/NEWS b/NEWS index 3d690d29b7..3e1a38469f 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,13 @@ udev 162 ======== Bugfixes. +Persistent network naming rules are disabled inside of Qemu/KVM now. + +New and updated keymaps. + +Udev gets unconditionally enabled on systemd installations now. There +is no longer the need to to run 'systemctl enable udev.service'. + udev 161 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 397e0169bb6c8f811d8aa117e8f34858caa8b56b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Sep 2010 15:14:36 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 3e1a38469f..31b00d25dd 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 163 +======== +Bugfixes. + udev 162 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 31c5b1848a..810be67bee 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [162], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [163], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From db11b20e416ff390339631b34aac559c8915c68d Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Mon, 6 Sep 2010 11:00:22 +0200 Subject: scsi_id: export target port group For ALUA support it's useful to have the target port group number of a device. Signed-off-by: Hannes Reinecke --- extras/scsi_id/scsi.h | 5 +++++ extras/scsi_id/scsi_id.c | 3 +++ extras/scsi_id/scsi_id.h | 3 +++ extras/scsi_id/scsi_serial.c | 44 +++++++++++++++++++++++++++++--------------- 4 files changed, 40 insertions(+), 15 deletions(-) diff --git a/extras/scsi_id/scsi.h b/extras/scsi_id/scsi.h index f5aa686f71..8e9ce406b7 100644 --- a/extras/scsi_id/scsi.h +++ b/extras/scsi_id/scsi.h @@ -54,6 +54,11 @@ struct scsi_ioctl_command { #define SCSI_ID_T10_VENDOR 1 #define SCSI_ID_EUI_64 2 #define SCSI_ID_NAA 3 +#define SCSI_ID_RELPORT 4 +#define SCSI_ID_TGTGROUP 5 +#define SCSI_ID_LUNGROUP 6 +#define SCSI_ID_MD5 7 +#define SCSI_ID_NAME 8 /* * Supported NAA values. These fit in 4 bits, so the "don't care" value diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 3811ea542d..6c8826568f 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -575,6 +575,9 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn); } } + if (dev_scsi.tgpt_group[0] != '\0') { + printf("ID_TARGET_PORT=%s\n", dev_scsi.tgpt_group); + } if (dev_scsi.unit_serial_number[0] != '\0') { printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); } diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h index 4475eaccd1..f6c269fc59 100644 --- a/extras/scsi_id/scsi_id.h +++ b/extras/scsi_id/scsi_id.h @@ -53,6 +53,9 @@ struct scsi_id_device { /* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */ char wwn_vendor_extension[17]; + + /* NULs if not set - otherwise decimal number */ + char tgpt_group[8]; }; extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index dd5e1fdbf8..6f5da37f78 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -48,6 +48,7 @@ * is normally one or some small number of descriptors. */ static const struct scsi_id_search_values id_search_list[] = { + { SCSI_ID_TGTGROUP, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_BINARY }, { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_ASCII }, { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_BINARY }, @@ -485,16 +486,20 @@ static int check_fill_0x83_id(struct udev *udev, struct scsi_id_device *dev_scsi, unsigned char *page_83, const struct scsi_id_search_values - *id_search, char *serial, char *serial_short, int max_len, - char *wwn, - char *wwn_vendor_extension) + *id_search, char *serial, char *serial_short, + int max_len, char *wwn, + char *wwn_vendor_extension, char *tgpt_group) { int i, j, s, len; /* * ASSOCIATION must be with the device (value 0) + * or with the target port for SCSI_ID_TGTPORT */ - if ((page_83[1] & 0x30) != 0) + if (page_83[1] & 0x30 == 0x10) + if (id_search->id_type != SCSI_ID_TGTGROUP) + return 1; + else if ((page_83[1] & 0x30) != 0) return 1; if ((page_83[1] & 0x0f) != id_search->id_type) @@ -536,6 +541,14 @@ static int check_fill_0x83_id(struct udev *udev, return 1; } + if (id_search->id_type == SCSI_ID_TGTGROUP && tgpt_group != NULL) { + unsigned int group; + + group = ((unsigned int)page_83[6] << 8) | page_83[7]; + sprintf(tgpt_group,"%x", group); + return 1; + } + serial[0] = hex_str[id_search->id_type]; /* @@ -572,12 +585,13 @@ static int check_fill_0x83_id(struct udev *udev, strcpy(serial_short, &serial[s]); - if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { - strncpy(wwn, &serial[s], 16); + if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { + strncpy(wwn, &serial[s], 16); if (wwn_vendor_extension != NULL) { strncpy(wwn_vendor_extension, &serial[s + 16], 16); } - } + } + return 0; } @@ -609,14 +623,14 @@ static int check_fill_0x83_prespc3(struct udev *udev, static int do_scsi_page83_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, int fd, char *serial, char *serial_short, int len, - char *unit_serial_number, char *wwn, - char *wwn_vendor_extension) + char *unit_serial_number, char *wwn, + char *wwn_vendor_extension, char *tgpt_group) { int retval; unsigned int id_ind, j; unsigned char page_83[SCSI_INQ_BUFF_LEN]; - /* also pick up the page 80 serial number */ + /* also pick up the page 80 serial number */ do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN); memset(page_83, 0, SCSI_INQ_BUFF_LEN); @@ -680,8 +694,8 @@ static int do_scsi_page83_inquiry(struct udev *udev, dev_scsi, &page_83[j], &id_search_list[id_ind], serial, serial_short, len, - wwn, - wwn_vendor_extension); + wwn, wwn_vendor_extension, + tgpt_group); dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, id_search_list[id_ind].id_type, id_search_list[id_ind].naa_type, @@ -895,7 +909,7 @@ int scsi_get_serial(struct udev *udev, goto completed; } } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { retval = 1; goto completed; } else { @@ -911,7 +925,7 @@ int scsi_get_serial(struct udev *udev, * conform to pre-SPC3 expectations. */ if (retval == 2) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension)) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { retval = 1; goto completed; } else { @@ -951,7 +965,7 @@ int scsi_get_serial(struct udev *udev, for (ind = 4; ind <= page0[3] + 3; ind++) if (page0[ind] == PAGE_83) if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension)) { + dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { /* * Success */ -- cgit v1.2.3-54-g00ecf From cff2f9a3c854fa13067477c797ba926ebcf7dede Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Sep 2010 08:24:12 +0200 Subject: scsi_id: fix compiler warnings --- extras/scsi_id/scsi_serial.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 6f5da37f78..516a6f16c5 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -496,11 +496,12 @@ static int check_fill_0x83_id(struct udev *udev, * ASSOCIATION must be with the device (value 0) * or with the target port for SCSI_ID_TGTPORT */ - if (page_83[1] & 0x30 == 0x10) + if ((page_83[1] & 0x30) == 0x10) { if (id_search->id_type != SCSI_ID_TGTGROUP) return 1; - else if ((page_83[1] & 0x30) != 0) + } else if ((page_83[1] & 0x30) != 0) { return 1; + } if ((page_83[1] & 0x0f) != id_search->id_type) return 1; -- cgit v1.2.3-54-g00ecf From cbdf255e255adc0f30b40be296fbbf2f3cd2be80 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 7 Sep 2010 11:01:23 -0400 Subject: gudev: Deliver ::uevent signal in the thread-default main loop ... that the GUdevClient object was constructed in. This change makes GUdev follow the GLib guidelines and, more importantly, makes it possible to actually use the library in a multi-threaded application. Prior to this patch, signals were emitted in the thread that ran the "default" main loop. Signed-off-by: David Zeuthen --- extras/gudev/gudevclient.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/extras/gudev/gudevclient.c b/extras/gudev/gudevclient.c index f5f7a198db..e829ca314b 100644 --- a/extras/gudev/gudevclient.c +++ b/extras/gudev/gudevclient.c @@ -1,6 +1,6 @@ /* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- * - * Copyright (C) 2008 David Zeuthen + * Copyright (C) 2008-2010 David Zeuthen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -59,7 +59,7 @@ struct _GUdevClientPrivate { - guint watch_id; + GSource *watch_source; struct udev *udev; struct udev_monitor *monitor; @@ -117,10 +117,10 @@ g_udev_client_finalize (GObject *object) { GUdevClient *client = G_UDEV_CLIENT (object); - if (client->priv->watch_id != 0) + if (client->priv->watch_source != NULL) { - g_source_remove (client->priv->watch_id); - client->priv->watch_id = 0; + g_source_destroy (client->priv->watch_source); + client->priv->watch_source = NULL; } if (client->priv->monitor != NULL) @@ -229,10 +229,16 @@ g_udev_client_constructed (GObject *object) { udev_monitor_enable_receiving (client->priv->monitor); channel = g_io_channel_unix_new (udev_monitor_get_fd (client->priv->monitor)); - client->priv->watch_id = g_io_add_watch (channel, G_IO_IN, monitor_event, client); + client->priv->watch_source = g_io_create_watch (channel, G_IO_IN); g_io_channel_unref (channel); - } else - client->priv->watch_id = NULL; + g_source_set_callback (client->priv->watch_source, (GSourceFunc) monitor_event, client, NULL); + g_source_attach (client->priv->watch_source, g_main_context_get_thread_default ()); + g_source_unref (client->priv->watch_source); + } + else + { + client->priv->watch_source = NULL; + } } if (G_OBJECT_CLASS (g_udev_client_parent_class)->constructed != NULL) @@ -280,6 +286,10 @@ g_udev_client_class_init (GUdevClientClass *klass) * @device: Details about the #GUdevDevice the event is for. * * Emitted when @client receives an uevent. + * + * This signal is emitted in the + * thread-default main loop + * of the thread that @client was created in. */ signals[UEVENT_SIGNAL] = g_signal_new ("uevent", G_TYPE_FROM_CLASS (klass), @@ -310,7 +320,9 @@ g_udev_client_init (GUdevClient *client) * * Constructs a #GUdevClient object that can be used to query * information about devices. Connect to the #GUdevClient::uevent - * signal to listen for uevents. + * signal to listen for uevents. Note that signals are emitted in the + * thread-default main loop + * of the thread that you call this constructor from. * * Returns: A new #GUdevClient object. Free with g_object_unref(). */ -- cgit v1.2.3-54-g00ecf From 645d40d00457e417c5741268a91fc61a5e5a8ce9 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 7 Sep 2010 11:11:11 -0400 Subject: Bump required GLib version to 2.22 This is needed for g_main_context_get_thread_default(). Signed-off-by: David Zeuthen --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 810be67bee..733741d447 100644 --- a/configure.ac +++ b/configure.ac @@ -80,7 +80,7 @@ if test "x$enable_extras" = xyes; then AC_MSG_ERROR([gperf is needed]) fi - PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.7.0 gobject-2.0 >= 2.7.0]) + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) AC_SUBST([GLIB_CFLAGS]) AC_SUBST([GLIB_LIBS]) -- cgit v1.2.3-54-g00ecf From 2f5e49cd87c7d9e09e36e65812ec2be050dfb81b Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 14 Sep 2010 18:21:13 +0200 Subject: keymap: Add Lenovo Y550 https://launchpad.net/bugs/543065 --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 913b38007a..9bc3cb6224 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -67,6 +67,7 @@ ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{ ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X200 Tablet*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x200_tablet" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" +ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" -- cgit v1.2.3-54-g00ecf From daef8ae33c13941172c8198b4fc4dd0faebdf6cd Mon Sep 17 00:00:00 2001 From: Torsten Schoenfeld Date: Mon, 20 Sep 2010 10:25:55 +0200 Subject: gudev: add a few annotations that newer gobject-introspection versions demand --- extras/gudev/gudevclient.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extras/gudev/gudevclient.c b/extras/gudev/gudevclient.c index e829ca314b..9ebd8f8d8f 100644 --- a/extras/gudev/gudevclient.c +++ b/extras/gudev/gudevclient.c @@ -316,7 +316,7 @@ g_udev_client_init (GUdevClient *client) /** * g_udev_client_new: - * @subsystems: (allow-none): A %NULL terminated string array of subsystems to listen for uevents on, %NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the #GUdevClient:subsystems property for details on this parameter. + * @subsystems: (array zero-terminated=1) (element-type utf8) (transfer none) (allow-none): A %NULL terminated string array of subsystems to listen for uevents on, %NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the #GUdevClient:subsystems property for details on this parameter. * * Constructs a #GUdevClient object that can be used to query * information about devices. Connect to the #GUdevClient::uevent @@ -339,7 +339,7 @@ g_udev_client_new (const gchar * const *subsystems) * * Gets all devices belonging to @subsystem. * - * Returns: (element-type GUdevDevice): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. + * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. */ GList * g_udev_client_query_by_subsystem (GUdevClient *client, @@ -392,7 +392,7 @@ g_udev_client_query_by_subsystem (GUdevClient *client, * * Looks up a device for a type and device number. * - * Returns: A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_device_number (GUdevClient *client, @@ -424,7 +424,7 @@ g_udev_client_query_by_device_number (GUdevClient *client, * * Looks up a device for a device file. * - * Returns: A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_device_file (GUdevClient *client, @@ -460,7 +460,7 @@ g_udev_client_query_by_device_file (GUdevClient *client, * * Looks up a device for a sysfs path. * - * Returns: A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_sysfs_path (GUdevClient *client, @@ -492,7 +492,7 @@ g_udev_client_query_by_sysfs_path (GUdevClient *client, * * Looks up a device for a subsystem and name. * - * Returns: A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_subsystem_and_name (GUdevClient *client, -- cgit v1.2.3-54-g00ecf From 1079014420da2e9f7e8db7cd2d892d8f8f8cedb0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 21 Sep 2010 12:12:01 +0200 Subject: Clarify WAIT_FOR documentation The path is relative to the sysfs device, so this provides an easy way to wait for an attribute to appear. --- udev/udev.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 6085dfff24..682cc3f959 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -466,7 +466,8 @@ Wait for a file to become available or until a 10 - seconds timeout expires. + seconds timeout expires. The path is relative to the sysfs device, + i. e. if no path is specified this waits for an attribute to appear. -- cgit v1.2.3-54-g00ecf From c112a41a43ccede3b22bf242bcf8da455ca57c98 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 21 Sep 2010 12:14:50 +0200 Subject: fix various syntax errors in rules --- rules/arch/40-ppc.rules | 2 +- rules/misc/30-kernel-compat.rules | 2 +- rules/rules.d/50-udev-default.rules | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rules/arch/40-ppc.rules b/rules/arch/40-ppc.rules index 90c15f0598..a310d63993 100644 --- a/rules/arch/40-ppc.rules +++ b/rules/arch/40-ppc.rules @@ -3,4 +3,4 @@ KERNEL=="iseries/ibmsis*", GROUP="disk" KERNEL=="iseries/nvt*", GROUP="disk" KERNEL=="iseries/vt*", GROUP="disk" -KERNEL=="iseries/vtty*, GROUP="dialout" +KERNEL=="iseries/vtty*", GROUP="dialout" diff --git a/rules/misc/30-kernel-compat.rules b/rules/misc/30-kernel-compat.rules index af5696f86f..2c545dcca5 100644 --- a/rules/misc/30-kernel-compat.rules +++ b/rules/misc/30-kernel-compat.rules @@ -12,7 +12,7 @@ ACTION=="remove", GOTO="kernel_compat_end" # # needed for kernels <2.6.30 -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", WAIT_FOR_SYSFS="descriptors" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", WAIT_FOR="descriptors" # # naming device rules diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 9f98809a8f..160527988c 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -102,7 +102,7 @@ KERNEL=="rfkill", MODE="0644" # CPU KERNEL=="cpu[0-9]*", MODE="0444" -KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse" \ +KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse", \ RUN+="/bin/mount -t fusectl fusectl /sys/fs/fuse/connections" SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" -- cgit v1.2.3-54-g00ecf From b2ad12eb0291832134bf3757f98abfeeec2fb166 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 21 Sep 2010 12:45:52 +0200 Subject: Add automatic rules syntax check Add test/rule-syntax-check.py, a script for checking the syntax of all udev rules files passed as command line arguments. Add a wrapper test/rules-test.sh which calls rule-syntax-check.py on all udev rules that we ship, but does nothing if Python is not available. Integrate this into make check/distcheck. --- Makefile.am | 3 ++- test/rule-syntax-check.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++ test/rules-test.sh | 17 +++++++++++++ 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100755 test/rule-syntax-check.py create mode 100755 test/rules-test.sh diff --git a/Makefile.am b/Makefile.am index 44cf002188..f1243963da 100644 --- a/Makefile.am +++ b/Makefile.am @@ -183,7 +183,7 @@ EXTRA_DIST += \ # ------------------------------------------------------------------------------ # udev tests # ------------------------------------------------------------------------------ -TESTS = test/udev-test.pl +TESTS = test/udev-test.pl test/rules-test.sh check_PROGRAMS = \ libudev/test-libudev \ @@ -619,6 +619,7 @@ CLEANFILES += \ $(BUILT_SOURCES) EXTRA_DIST += $(TESTS) +EXTRA_DIST += test/rule-syntax-check.py install-exec-hook: $(INSTALL_EXEC_HOOKS) diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py new file mode 100755 index 0000000000..6cb021518d --- /dev/null +++ b/test/rule-syntax-check.py @@ -0,0 +1,64 @@ +#!/usr/bin/python +# Simple udev rules syntax checker +# +# (C) 2010 Canonical Ltd. +# Author: Martin Pitt +# +# 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; either version 2 of the License, or +# (at your option) any later version. +# +# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + +import re +import sys + +if len(sys.argv) < 2: + print >> sys.stderr, 'Usage: %s [...]' % sys.argv[0] + sys.exit(2) + +no_args_tests = re.compile('(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$') +args_tests = re.compile('(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$') +no_args_assign = re.compile('(NAME|SYMLINK|SYMLINK{unique}|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|RUN{ignore_error}|LABEL|GOTO|WAIT_FOR|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$') +args_assign = re.compile('(ATTR|ENV|IMPORT){([a-zA-Z0-9/_.*%-]+)}\s*=\s*"([^"]*)"$') + +result = 0 +buffer = '' +for path in sys.argv[1:]: + lineno = 0 + for line in open(path): + lineno += 1 + + # handle line continuation + if line.endswith('\\\n'): + buffer += line[:-2] + continue + else: + line = buffer + line + buffer = '' + + # filter out comments and empty lines + line = line.strip() + if not line or line.startswith('#'): + continue + + for clause in line.split(','): + clause = clause.strip() + if not (no_args_tests.match(clause) or args_tests.match(clause) or + no_args_assign.match(clause) or args_assign.match(clause)): + + print 'Invalid line %s:%i: %s' % (path, lineno, line) + print ' clause:', clause + print + result = 1 + break + +sys.exit(result) diff --git a/test/rules-test.sh b/test/rules-test.sh new file mode 100755 index 0000000000..9d5a07c19e --- /dev/null +++ b/test/rules-test.sh @@ -0,0 +1,17 @@ +#!/bin/sh +# Call the udev rule syntax checker on all rules that we ship +# +# (C) 2010 Canonical Ltd. +# Author: Martin Pitt + +set -e + +[ -n "$srcdir" ] || srcdir=`dirname $0`/.. + +# skip if we don't have python +type python >/dev/null 2>&1 || { + echo "$0: No python installed, skipping udev rule syntax check" + exit 0 +} + +$srcdir/test/rule-syntax-check.py `find $srcdir/rules -type f` -- cgit v1.2.3-54-g00ecf From e17f9c3cd589ee50ba74976d11a5804ca2562472 Mon Sep 17 00:00:00 2001 From: "Lee, Chun-Yi" Date: Sat, 25 Sep 2010 16:50:27 +0800 Subject: keymap: Add alternate MSI vendor name Add new vendor name "Micro-Star International" in 95-keymap.rules. Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 9bc3cb6224..eda006e13e 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -109,6 +109,7 @@ ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keyma ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" ENV{DMI_VENDOR}=="MICRO-STAR*", RUN+="keymap $name micro-star" +ENV{DMI_VENDOR}=="Micro-Star International", RUN+="keymap $name micro-star" # some MSI models generate ACPI/input events on the LNXVIDEO input devices, # plus some extra synthesized ones on atkbd as an echo of actually changing the -- cgit v1.2.3-54-g00ecf From 0bd77e2acd0dc58c6eba16bb3c4c01865d090855 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 29 Sep 2010 00:48:35 +0200 Subject: systemd: hook into basic.target instead of sysinit.target --- Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index f1243963da..39971be038 100644 --- a/Makefile.am +++ b/Makefile.am @@ -129,10 +129,10 @@ systemdsystemunit_DATA = \ init/udev-retry.service systemd-install-hook: - mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants - ln -sf ../udev.service $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/udev.service - ln -sf ../udev-settle.service $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/udev-settle.service - ln -sf ../udev-retry.service $(DESTDIR)$(systemdsystemunitdir)/sysinit.target.wants/udev-retry.service + mkdir -p $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants + ln -sf ../udev.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev.service + ln -sf ../udev-settle.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-settle.service + ln -sf ../udev-retry.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-retry.service INSTALL_DATA_HOOKS += systemd-install-hook endif -- cgit v1.2.3-54-g00ecf From ea88774a922c734afd751a59d8102bfa4806a1a6 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 5 Oct 2010 14:34:55 +0200 Subject: cdrom_id: Try reading the medium if all MMC commands fail Reportedly, some "when I'm grown up I want to be a CD drive" fake USB CD sticks like the IronKey neither support the SCSI "GET CONFIGURATION" nor the older (pre-MMC2) "READ DISC INFORMATION" command. In that case, check if we can read data from the drive, and assume that we have a CD-ROM medium if it succeeds. --- extras/cdrom_id/cdrom_id.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 0153af6633..f65f04f9dc 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -350,6 +350,34 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si return 0; } +static int cd_profiles_broken_mmc(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char buffer[16 * 2048]; + int err; + + /* we land here if both the standard and the old MMC commands failed; + * this might happen on broken wanna-be-CD USB drives like the IronKey. + * As a last resort, try to read data to see whether it has a medium. + */ + scsi_cmd_init(udev, &sc, buffer, sizeof(buffer)); + scsi_cmd_set(udev, &sc, 0, 0x28); + scsi_cmd_set(udev, &sc, 5, 0); + scsi_cmd_set(udev, &sc, 8, 16); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); + if ((err != 0)) { + info(udev, "READ DATA failed, assuming no medium\n"); + return -1; + } + + /* that's all we can claim if we can read data */ + info(udev, "READ DATA succeeded, assuming CD-ROM medium\n"); + cd_media = 1; + cd_media_cd_rom = 1; + return 0; +} + static int cd_profiles_old_mmc(struct udev *udev, int fd) { struct scsi_cmd sc; @@ -364,8 +392,8 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd) err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err != 0)) { info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - info(udev, "no current profile, assuming no media\n"); - return -1; + info(udev, "no current profile, probing readability of medium\n"); + return cd_profiles_broken_mmc(udev, fd); }; cd_media = 1; -- cgit v1.2.3-54-g00ecf From 13e0fca5dff286921a8df0cd737e6e1224e53275 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 5 Oct 2010 14:57:04 +0200 Subject: Revert "cdrom_id: Try reading the medium if all MMC commands fail" Turns out we can do this much simpler by assuming that cd_media_compat() works, which seems to be the case for the IronKey. This reverts commit ea88774a922c734afd751a59d8102bfa4806a1a6. --- extras/cdrom_id/cdrom_id.c | 32 ++------------------------------ 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index f65f04f9dc..0153af6633 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -350,34 +350,6 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si return 0; } -static int cd_profiles_broken_mmc(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - unsigned char buffer[16 * 2048]; - int err; - - /* we land here if both the standard and the old MMC commands failed; - * this might happen on broken wanna-be-CD USB drives like the IronKey. - * As a last resort, try to read data to see whether it has a medium. - */ - scsi_cmd_init(udev, &sc, buffer, sizeof(buffer)); - scsi_cmd_set(udev, &sc, 0, 0x28); - scsi_cmd_set(udev, &sc, 5, 0); - scsi_cmd_set(udev, &sc, 8, 16); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); - if ((err != 0)) { - info(udev, "READ DATA failed, assuming no medium\n"); - return -1; - } - - /* that's all we can claim if we can read data */ - info(udev, "READ DATA succeeded, assuming CD-ROM medium\n"); - cd_media = 1; - cd_media_cd_rom = 1; - return 0; -} - static int cd_profiles_old_mmc(struct udev *udev, int fd) { struct scsi_cmd sc; @@ -392,8 +364,8 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd) err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err != 0)) { info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - info(udev, "no current profile, probing readability of medium\n"); - return cd_profiles_broken_mmc(udev, fd); + info(udev, "no current profile, assuming no media\n"); + return -1; }; cd_media = 1; -- cgit v1.2.3-54-g00ecf From 678df8a461c7573bf423a39be383bc7b70d943df Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 5 Oct 2010 14:59:51 +0200 Subject: cdrom_id: Fall back to CDROM_DRIVE_STATUS if all MMC commands fail Reportedly, some "when I'm grown up I want to be a CD drive" fake USB CD sticks like the IronKey neither support the SCSI "GET CONFIGURATION" nor the older (pre-MMC2) "READ DISC INFORMATION" command. In that case, check if cd_media_compat() detected that there is a disc present, and assume that we have a CD-ROM medium. --- extras/cdrom_id/cdrom_id.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 0153af6633..e7a3e40a85 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -364,8 +364,14 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd) err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); if ((err != 0)) { info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - info(udev, "no current profile, assuming no media\n"); - return -1; + if (cd_media == 1) { + info(udev, "no current profile, but disc is present; assuming CD-ROM\n"); + cd_media_cd_rom = 1; + return 0; + } else { + info(udev, "no current profile, assuming no media\n"); + return -1; + } }; cd_media = 1; -- cgit v1.2.3-54-g00ecf From 1ebd2a5620c93ef4698485d392c19ded675412d2 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 5 Oct 2010 17:56:19 +0200 Subject: cdrom_id: Don't read beyond "last track" in TOC Read the first and last track from the TOC header, and do not go beyond that stated number of tracks when reading the TOC. Otherwise we interpret random data which leads to bogus tracks. (Reported on an IronKey, which reported 1 data track, and 4 audio tracks which weren't actually present.) --- extras/cdrom_id/cdrom_id.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index e7a3e40a85..1b43fe43ae 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -712,7 +712,7 @@ static int cd_media_toc(struct udev *udev, int fd) struct scsi_cmd sc; unsigned char header[12]; unsigned char toc[2048]; - unsigned int len, i; + unsigned int len, i, num_tracks; unsigned char *p; int err; @@ -728,11 +728,13 @@ static int cd_media_toc(struct udev *udev, int fd) } len = (header[0] << 8 | header[1]) + 2; - info(udev, "READ TOC: len: %d\n", len); + info(udev, "READ TOC: len: %d, start track: %d, end track: %d\n", len, header[2], header[3]); if (len > sizeof(toc)) return -1; if (len < 2) return -1; + /* 2: first track, 3: last track */ + num_tracks = header[3] - header[2] + 1; /* empty media has no tracks */ if (len < 8) @@ -750,7 +752,10 @@ static int cd_media_toc(struct udev *udev, int fd) return -1; } - for (p = toc+4, i = 4; i < len-8; i += 8, p += 8) { + /* Take care to not iterate beyond the last valid track as specified in + * the TOC, but also avoid going beyond the TOC length, just in case + * the last track number is invalidly large */ + for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) { unsigned int block; unsigned int is_data_track; -- cgit v1.2.3-54-g00ecf From d8b9a5c12b1ba238ed8165d11c498a3bd9f13f9f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Oct 2010 10:49:13 +0200 Subject: systemd: sort before basic.target --- init/udev-retry.service.in | 1 + init/udev-settle.service.in | 1 + init/udev.service.in | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in index 222714e897..9be0dfc76d 100644 --- a/init/udev-retry.service.in +++ b/init/udev-retry.service.in @@ -2,6 +2,7 @@ Description=udev Retry Failed Events DefaultDependencies=no After=local-fs.target udev.service +Before=basic.target [Service] Type=oneshot diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index 7550aaebd5..c5d7e96cb3 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -2,6 +2,7 @@ Description=udev Wait for Complete Device Initialization DefaultDependencies=no After=udev.service +Before=basic.target [Service] Type=oneshot diff --git a/init/udev.service.in b/init/udev.service.in index 4e5488f3a5..908c8e9acc 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -1,7 +1,7 @@ [Unit] Description=udev Kernel Device Manager DefaultDependencies=no -Before=sysinit.target +Before=basic.target [Service] Type=notify -- cgit v1.2.3-54-g00ecf From 392ef7a28a7003a11f5e1e56617551ff5b9eabf9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Oct 2010 14:59:11 +0200 Subject: udevd: add sd-daemon.c --- Makefile.am | 4 +- udev/sd-daemon.c | 436 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ udev/sd-daemon.h | 265 +++++++++++++++++++++++++++++++++ udev/udevd.c | 63 +------- 4 files changed, 706 insertions(+), 62 deletions(-) create mode 100644 udev/sd-daemon.c create mode 100644 udev/sd-daemon.h diff --git a/Makefile.am b/Makefile.am index 39971be038..3d9773b658 100644 --- a/Makefile.am +++ b/Makefile.am @@ -150,7 +150,9 @@ udev_common_sources =\ udev_udevd_SOURCES = \ $(udev_common_sources) \ - udev/udevd.c + udev/udevd.c \ + udev/sd-daemon.h \ + udev/sd-daemon.c udev_udevd_LDADD = libudev/libudev-private.la udev_udevadm_SOURCES = \ diff --git a/udev/sd-daemon.c b/udev/sd-daemon.c new file mode 100644 index 0000000000..e12fb0483a --- /dev/null +++ b/udev/sd-daemon.c @@ -0,0 +1,436 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + Copyright 2010 Lennart Poettering + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +***/ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sd-daemon.h" + +int sd_listen_fds(int unset_environment) { + +#if defined(DISABLE_SYSTEMD) || !defined(__linux__) + return 0; +#else + int r, fd; + const char *e; + char *p = NULL; + unsigned long l; + + if (!(e = getenv("LISTEN_PID"))) { + r = 0; + goto finish; + } + + errno = 0; + l = strtoul(e, &p, 10); + + if (errno != 0) { + r = -errno; + goto finish; + } + + if (!p || *p || l <= 0) { + r = -EINVAL; + goto finish; + } + + /* Is this for us? */ + if (getpid() != (pid_t) l) { + r = 0; + goto finish; + } + + if (!(e = getenv("LISTEN_FDS"))) { + r = 0; + goto finish; + } + + errno = 0; + l = strtoul(e, &p, 10); + + if (errno != 0) { + r = -errno; + goto finish; + } + + if (!p || *p) { + r = -EINVAL; + goto finish; + } + + for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) { + int flags; + + if ((flags = fcntl(fd, F_GETFD)) < 0) { + r = -errno; + goto finish; + } + + if (flags & FD_CLOEXEC) + continue; + + if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) { + r = -errno; + goto finish; + } + } + + r = (int) l; + +finish: + if (unset_environment) { + unsetenv("LISTEN_PID"); + unsetenv("LISTEN_FDS"); + } + + return r; +#endif +} + +int sd_is_fifo(int fd, const char *path) { + struct stat st_fd; + + if (fd < 0) + return -EINVAL; + + memset(&st_fd, 0, sizeof(st_fd)); + if (fstat(fd, &st_fd) < 0) + return -errno; + + if (!S_ISFIFO(st_fd.st_mode)) + return 0; + + if (path) { + struct stat st_path; + + memset(&st_path, 0, sizeof(st_path)); + if (stat(path, &st_path) < 0) { + + if (errno == ENOENT || errno == ENOTDIR) + return 0; + + return -errno; + } + + return + st_path.st_dev == st_fd.st_dev && + st_path.st_ino == st_fd.st_ino; + } + + return 1; +} + +static int sd_is_socket_internal(int fd, int type, int listening) { + struct stat st_fd; + + if (fd < 0 || type < 0) + return -EINVAL; + + if (fstat(fd, &st_fd) < 0) + return -errno; + + if (!S_ISSOCK(st_fd.st_mode)) + return 0; + + if (type != 0) { + int other_type = 0; + socklen_t l = sizeof(other_type); + + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0) + return -errno; + + if (l != sizeof(other_type)) + return -EINVAL; + + if (other_type != type) + return 0; + } + + if (listening >= 0) { + int accepting = 0; + socklen_t l = sizeof(accepting); + + if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0) + return -errno; + + if (l != sizeof(accepting)) + return -EINVAL; + + if (!accepting != !listening) + return 0; + } + + return 1; +} + +union sockaddr_union { + struct sockaddr sa; + struct sockaddr_in in4; + struct sockaddr_in6 in6; + struct sockaddr_un un; + struct sockaddr_storage storage; +}; + +int sd_is_socket(int fd, int family, int type, int listening) { + int r; + + if (family < 0) + return -EINVAL; + + if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) + return r; + + if (family > 0) { + union sockaddr_union sockaddr; + socklen_t l; + + memset(&sockaddr, 0, sizeof(sockaddr)); + l = sizeof(sockaddr); + + if (getsockname(fd, &sockaddr.sa, &l) < 0) + return -errno; + + if (l < offsetof(struct sockaddr_un, sun_path)) + return -EINVAL; + + return sockaddr.sa.sa_family == family; + } + + return 1; +} + +int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { + union sockaddr_union sockaddr; + socklen_t l; + int r; + + if (family != 0 && family != AF_INET && family != AF_INET6) + return -EINVAL; + + if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) + return r; + + memset(&sockaddr, 0, sizeof(sockaddr)); + l = sizeof(sockaddr); + + if (getsockname(fd, &sockaddr.sa, &l) < 0) + return -errno; + + if (l < offsetof(struct sockaddr_un, sun_path)) + return -EINVAL; + + if (sockaddr.sa.sa_family != AF_INET && + sockaddr.sa.sa_family != AF_INET6) + return 0; + + if (family > 0) + if (sockaddr.sa.sa_family != family) + return 0; + + if (port > 0) { + if (sockaddr.sa.sa_family == AF_INET) { + if (l < sizeof(struct sockaddr_in)) + return -EINVAL; + + return htons(port) == sockaddr.in4.sin_port; + } else { + if (l < sizeof(struct sockaddr_in6)) + return -EINVAL; + + return htons(port) == sockaddr.in6.sin6_port; + } + } + + return 1; +} + +int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { + union sockaddr_union sockaddr; + socklen_t l; + int r; + + if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) + return r; + + memset(&sockaddr, 0, sizeof(sockaddr)); + l = sizeof(sockaddr); + + if (getsockname(fd, &sockaddr.sa, &l) < 0) + return -errno; + + if (l < offsetof(struct sockaddr_un, sun_path)) + return -EINVAL; + + if (sockaddr.sa.sa_family != AF_UNIX) + return 0; + + if (path) { + if (length <= 0) + length = strlen(path); + + if (length <= 0) + /* Unnamed socket */ + return l == offsetof(struct sockaddr_un, sun_path); + + if (path[0]) + /* Normal path socket */ + return + (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) && + memcmp(path, sockaddr.un.sun_path, length+1) == 0; + else + /* Abstract namespace socket */ + return + (l == offsetof(struct sockaddr_un, sun_path) + length) && + memcmp(path, sockaddr.un.sun_path, length) == 0; + } + + return 1; +} + +int sd_notify(int unset_environment, const char *state) { +#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) + return 0; +#else + int fd = -1, r; + struct msghdr msghdr; + struct iovec iovec; + union sockaddr_union sockaddr; + const char *e; + + if (!state) { + r = -EINVAL; + goto finish; + } + + if (!(e = getenv("NOTIFY_SOCKET"))) + return 0; + + /* Must be an abstract socket, or an absolute path */ + if ((e[0] != '@' && e[0] != '/') || e[1] == 0) { + r = -EINVAL; + goto finish; + } + + if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) { + r = -errno; + goto finish; + } + + memset(&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sa.sa_family = AF_UNIX; + strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path)); + + if (sockaddr.un.sun_path[0] == '@') + sockaddr.un.sun_path[0] = 0; + + memset(&iovec, 0, sizeof(iovec)); + iovec.iov_base = (char*) state; + iovec.iov_len = strlen(state); + + memset(&msghdr, 0, sizeof(msghdr)); + msghdr.msg_name = &sockaddr; + msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e); + + if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) + msghdr.msg_namelen = sizeof(struct sockaddr_un); + + msghdr.msg_iov = &iovec; + msghdr.msg_iovlen = 1; + + if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { + r = -errno; + goto finish; + } + + r = 1; + +finish: + if (unset_environment) + unsetenv("NOTIFY_SOCKET"); + + if (fd >= 0) + close(fd); + + return r; +#endif +} + +int sd_notifyf(int unset_environment, const char *format, ...) { +#if defined(DISABLE_SYSTEMD) || !defined(__linux__) + return 0; +#else + va_list ap; + char *p = NULL; + int r; + + va_start(ap, format); + r = vasprintf(&p, format, ap); + va_end(ap); + + if (r < 0 || !p) + return -ENOMEM; + + r = sd_notify(unset_environment, p); + free(p); + + return r; +#endif +} + +int sd_booted(void) { +#if defined(DISABLE_SYSTEMD) || !defined(__linux__) + return 0; +#else + + struct stat a, b; + + /* We simply test whether the systemd cgroup hierarchy is + * mounted */ + + if (lstat("/sys/fs/cgroup", &a) < 0) + return 0; + + if (lstat("/sys/fs/cgroup/systemd", &b) < 0) + return 0; + + return a.st_dev != b.st_dev; +#endif +} diff --git a/udev/sd-daemon.h b/udev/sd-daemon.h new file mode 100644 index 0000000000..fdf3cc0354 --- /dev/null +++ b/udev/sd-daemon.h @@ -0,0 +1,265 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#ifndef foosddaemonhfoo +#define foosddaemonhfoo + +/*** + Copyright 2010 Lennart Poettering + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +***/ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + Reference implementation of a few systemd related interfaces for + writing daemons. These interfaces are trivial to implement. To + simplify porting we provide this reference implementation. + Applications are welcome to reimplement the algorithms described + here if they do not want to include these two source files. + + The following functionality is provided: + + - Support for logging with log levels on stderr + - File descriptor passing for socket-based activation + - Daemon startup and status notification + - Detection of systemd boots + + You may compile this with -DDISABLE_SYSTEMD to disable systemd + support. This makes all those calls NOPs that are directly related to + systemd (i.e. only sd_is_xxx() will stay useful). + + Since this is drop-in code we don't want any of our symbols to be + exported in any case. Hence we declare hidden visibility for all of + them. + + You may find an up-to-date version of these source files online: + + http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h + http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c + + This should compile on non-Linux systems, too, but with the + exception of the sd_is_xxx() calls all functions will become NOPs. + + See sd-daemon(7) for more information. +*/ + +#ifndef _sd_printf_attr_ +#if __GNUC__ >= 4 +#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b))) +#else +#define _sd_printf_attr_(a,b) +#endif +#endif + +#ifndef _sd_hidden_ +#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS) +#define _sd_hidden_ __attribute__ ((visibility("hidden"))) +#else +#define _sd_hidden_ +#endif +#endif + +/* + Log levels for usage on stderr: + + fprintf(stderr, SD_NOTICE "Hello World!\n"); + + This is similar to printk() usage in the kernel. +*/ +#define SD_EMERG "<0>" /* system is unusable */ +#define SD_ALERT "<1>" /* action must be taken immediately */ +#define SD_CRIT "<2>" /* critical conditions */ +#define SD_ERR "<3>" /* error conditions */ +#define SD_WARNING "<4>" /* warning conditions */ +#define SD_NOTICE "<5>" /* normal but significant condition */ +#define SD_INFO "<6>" /* informational */ +#define SD_DEBUG "<7>" /* debug-level messages */ + +/* The first passed file descriptor is fd 3 */ +#define SD_LISTEN_FDS_START 3 + +/* + Returns how many file descriptors have been passed, or a negative + errno code on failure. Optionally, removes the $LISTEN_FDS and + $LISTEN_PID file descriptors from the environment (recommended, but + problematic in threaded environments). If r is the return value of + this function you'll find the file descriptors passed as fds + SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative + errno style error code on failure. This function call ensures that + the FD_CLOEXEC flag is set for the passed file descriptors, to make + sure they are not passed on to child processes. If FD_CLOEXEC shall + not be set, the caller needs to unset it after this call for all file + descriptors that are used. + + See sd_listen_fds(3) for more information. +*/ +int sd_listen_fds(int unset_environment) _sd_hidden_; + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a FIFO in the file system stored under the + specified path, 0 otherwise. If path is NULL a path name check will + not be done and the call only verifies if the file descriptor + refers to a FIFO. Returns a negative errno style error code on + failure. + + See sd_is_fifo(3) for more information. +*/ +int sd_is_fifo(int fd, const char *path) _sd_hidden_; + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a socket of the specified family (AF_INET, + ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If + family is 0 a socket family check will not be done. If type is 0 a + socket type check will not be done and the call only verifies if + the file descriptor refers to a socket. If listening is > 0 it is + verified that the socket is in listening mode. (i.e. listen() has + been called) If listening is == 0 it is verified that the socket is + not in listening mode. If listening is < 0 no listening mode check + is done. Returns a negative errno style error code on failure. + + See sd_is_socket(3) for more information. +*/ +int sd_is_socket(int fd, int family, int type, int listening) _sd_hidden_; + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is an Internet socket, of the specified family + (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM, + SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version + check is not done. If type is 0 a socket type check will not be + done. If port is 0 a socket port check will not be done. The + listening flag is used the same way as in sd_is_socket(). Returns a + negative errno style error code on failure. + + See sd_is_socket_inet(3) for more information. +*/ +int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) _sd_hidden_; + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is an AF_UNIX socket of the specified type + (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0 + a socket type check will not be done. If path is NULL a socket path + check will not be done. For normal AF_UNIX sockets set length to + 0. For abstract namespace sockets set length to the length of the + socket name (including the initial 0 byte), and pass the full + socket path in path (including the initial 0 byte). The listening + flag is used the same way as in sd_is_socket(). Returns a negative + errno style error code on failure. + + See sd_is_socket_unix(3) for more information. +*/ +int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) _sd_hidden_; + +/* + Informs systemd about changed daemon state. This takes a number of + newline separated environment-style variable assignments in a + string. The following variables are known: + + READY=1 Tells systemd that daemon startup is finished (only + relevant for services of Type=notify). The passed + argument is a boolean "1" or "0". Since there is + little value in signalling non-readiness the only + value daemons should send is "READY=1". + + STATUS=... Passes a single-line status string back to systemd + that describes the daemon state. This is free-from + and can be used for various purposes: general state + feedback, fsck-like programs could pass completion + percentages and failing programs could pass a human + readable error message. Example: "STATUS=Completed + 66% of file system check..." + + ERRNO=... If a daemon fails, the errno-style error code, + formatted as string. Example: "ERRNO=2" for ENOENT. + + BUSERROR=... If a daemon fails, the D-Bus error-style error + code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut" + + MAINPID=... The main pid of a daemon, in case systemd did not + fork off the process itself. Example: "MAINPID=4711" + + Daemons can choose to send additional variables. However, it is + recommened to prefix variable names not listed above with X_. + + Returns a negative errno-style error code on failure. Returns > 0 + if systemd could be notified, 0 if it couldn't possibly because + systemd is not running. + + Example: When a daemon finished starting up, it could issue this + call to notify systemd about it: + + sd_notify(0, "READY=1"); + + See sd_notifyf() for more complete examples. + + See sd_notify(3) for more information. +*/ +int sd_notify(int unset_environment, const char *state) _sd_hidden_; + +/* + Similar to sd_notify() but takes a format string. + + Example 1: A daemon could send the following after initialization: + + sd_notifyf(0, "READY=1\n" + "STATUS=Processing requests...\n" + "MAINPID=%lu", + (unsigned long) getpid()); + + Example 2: A daemon could send the following shortly before + exiting, on failure: + + sd_notifyf(0, "STATUS=Failed to start up: %s\n" + "ERRNO=%i", + strerror(errno), + errno); + + See sd_notifyf(3) for more information. +*/ +int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3) _sd_hidden_; + +/* + Returns > 0 if the system was booted with systemd. Returns < 0 on + error. Returns 0 if the system was not booted with systemd. Note + that all of the functions above handle non-systemd boots just + fine. You should NOT protect them with a call to this function. Also + note that this function checks whether the system, not the user + session is controlled by systemd. However the functions above work + for both session and system services. + + See sd_booted(3) for more information. +*/ +int sd_booted(void) _sd_hidden_; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/udev/udevd.c b/udev/udevd.c index 0ec3c3d4ec..2efab5b39d 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -45,6 +45,7 @@ #include #include "udev.h" +#include "sd-daemon.h" #define UDEVD_PRIORITY -4 #define UDEV_PRIORITY -2 @@ -959,66 +960,6 @@ static int mem_size_mb(void) return memsize; } -static int init_notify(const char *state) -{ - int fd = -1, r; - struct msghdr msghdr; - struct iovec iovec; - union { - struct sockaddr sa; - struct sockaddr_un un; - } sockaddr; - const char *e; - - if (!(e = getenv("NOTIFY_SOCKET"))) { - r = 0; - goto finish; - } - - /* Must be an abstract socket, or an absolute path */ - if ((e[0] != '@' && e[0] != '/') || e[1] == 0) { - r = -EINVAL; - goto finish; - } - - if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) { - r = -errno; - goto finish; - } - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sa.sa_family = AF_UNIX; - strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path)); - - if (sockaddr.un.sun_path[0] == '@') - sockaddr.un.sun_path[0] = 0; - - memset(&iovec, 0, sizeof(iovec)); - iovec.iov_base = (char*) state; - iovec.iov_len = strlen(state); - - memset(&msghdr, 0, sizeof(msghdr)); - msghdr.msg_name = &sockaddr; - msghdr.msg_namelen = sizeof(sa_family_t) + strlen(e); - if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) - msghdr.msg_namelen = sizeof(struct sockaddr_un); - msghdr.msg_iov = &iovec; - msghdr.msg_iovlen = 1; - - if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { - r = -errno; - goto finish; - } - - r = 0; - -finish: - if (fd >= 0) - close(fd); - - return r; -} - int main(int argc, char *argv[]) { struct udev *udev; @@ -1271,7 +1212,7 @@ int main(int argc, char *argv[]) goto exit; } } else { - init_notify("READY=1"); + sd_notify(1, "READY=1"); } /* set scheduling priority for the main daemon process */ -- cgit v1.2.3-54-g00ecf From d7628fbfcd04727cfd229c0a8a2f084b8c531ab6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Oct 2010 15:07:48 +0200 Subject: release 163 --- ChangeLog | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3dd0bd9a94..c71e907df1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,37 @@ +Summary of changes from v162 to v163 +============================================ + +David Zeuthen (2): + gudev: Deliver ::uevent signal in the thread-default main loop + Bump required GLib version to 2.22 + +Hannes Reinecke (1): + scsi_id: export target port group + +Kay Sievers (5): + version bump + scsi_id: fix compiler warnings + systemd: hook into basic.target instead of sysinit.target + systemd: sort before basic.target + udevd: add sd-daemon.c + +Lee, Chun-Yi (1): + keymap: Add alternate MSI vendor name + +Martin Pitt (8): + keymap: Add Lenovo Y550 + Clarify WAIT_FOR documentation + fix various syntax errors in rules + Add automatic rules syntax check + cdrom_id: Try reading the medium if all MMC commands fail + Revert "cdrom_id: Try reading the medium if all MMC commands fail" + cdrom_id: Fall back to CDROM_DRIVE_STATUS if all MMC commands fail + cdrom_id: Don't read beyond "last track" in TOC + +Torsten Schoenfeld (1): + gudev: add a few annotations that newer gobject-introspection versions demand + + Summary of changes from v161 to v162 ============================================ -- cgit v1.2.3-54-g00ecf From d7cd2b16110c806128747ee245aaa883dd52039d Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 7 Oct 2010 17:02:21 +0200 Subject: cdrom_id: request the drive profile features with a dynamic length Some drives don't like huge feature buffers, so we query twice. First run for the current profile and to get the length. Second time we query the whole profile feature set. --- extras/cdrom_id/cdrom_id.c | 81 ++++++++++++++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 28 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 1b43fe43ae..ec001cde71 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -398,12 +398,12 @@ static int cd_profiles(struct udev *udev, int fd) unsigned int i; int err; + /* First query the current profile */ scsi_cmd_init(udev, &sc, features, sizeof(features)); scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 7, (sizeof(features) >> 8) & 0xff); - scsi_cmd_set(udev, &sc, 8, sizeof(features) & 0xff); + scsi_cmd_set(udev, &sc, 8, 8); scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, features, sizeof(features)); + err = scsi_cmd_run(udev, &sc, fd, features, 8); if ((err != 0)) { info_scsi_cmd_err(udev, "GET CONFIGURATION", err); /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ @@ -415,31 +415,6 @@ static int cd_profiles(struct udev *udev, int fd) return -1; } - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; - info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); - - if (len > sizeof(features)) { - info(udev, "can not get features in a single query, truncating\n"); - len = sizeof(features); - } - - /* device features */ - for (i = 8; i+4 < len; i += (4 + features[i+3])) { - unsigned int feature; - - feature = features[i] << 8 | features[i+1]; - - switch (feature) { - case 0x00: - info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); - feature_profiles(udev, &features[i]+4, features[i+3]); - break; - default: - info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); - break; - } - } - cur_profile = features[6] << 8 | features[7]; if (cur_profile > 0) { info(udev, "current profile 0x%02x\n", cur_profile); @@ -553,6 +528,56 @@ static int cd_profiles(struct udev *udev, int fd) info(udev, "profile 0x%02x \n", cur_profile); break; } + + + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; + info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); + len = sizeof(features); + } else if (len <= 8) { + len = sizeof(features); + } + + /* Now get the full feature buffer */ + scsi_cmd_init(udev, &sc, features, len); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff); + scsi_cmd_set(udev, &sc, 8, len & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, features, len); + if ((err != 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + return -1; + } + + /* parse the length once more, in case the drive decided to have other features suddenly :) */ + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; + info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); + len = sizeof(features); + } + + /* device features */ + for (i = 8; i+4 < len; i += (4 + features[i+3])) { + unsigned int feature; + + feature = features[i] << 8 | features[i+1]; + + switch (feature) { + case 0x00: + info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); + feature_profiles(udev, &features[i]+4, features[i+3]); + break; + default: + info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); + break; + } + } + return 0; } -- cgit v1.2.3-54-g00ecf From 18f5c802dfd958d9ac52924454eefba182d9ddfb Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Mon, 11 Oct 2010 12:01:04 -0400 Subject: Install libgudev-1.0.so in prefix / instead of prefix /usr This is to match where libudev.so is installed and it works because all dependent libraries are already installed in / instead of /usr on most distros: $ ldd /usr/lib64/libgudev-1.0.so linux-vdso.so.1 => (0x00007fff44dff000) libudev.so.0 => /lib64/libudev.so.0 (0x0000003bf2600000) libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x0000003fb5200000) libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x0000003fb4e00000) libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003d5b000000) librt.so.1 => /lib64/librt.so.1 (0x0000003d5b800000) libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x0000003fb4a00000) libc.so.6 => /lib64/libc.so.6 (0x0000003d5ac00000) /lib64/ld-linux-x86-64.so.2 (0x0000003d5a800000) With this change it is possible to write libgudev applications that can be installed in /bin or /sbin and can run without /usr being mounted. This is needed for e.g. udisks, NetworkManager and other subsystem-specific daemons. Signed-off-by: David Zeuthen --- Makefile.am | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Makefile.am b/Makefile.am index 3d9773b658..093a10e058 100644 --- a/Makefile.am +++ b/Makefile.am @@ -433,6 +433,22 @@ typelibs_DATA = extras/gudev/GUdev-1.0.typelib CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # ENABLE_INTROSPECTION +# move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed +libgudev-install-move-hook: + if test "$(libdir)" != "$(rootlib_execdir)"; then \ + mkdir -p $(DESTDIR)$(rootlib_execdir) && \ + so_img_name=$$(readlink $(DESTDIR)$(libdir)/libgudev-1.0.so) && \ + so_img_rel_target_prefix=$$(echo $(libdir) | sed 's,\(^/\|\)[^/][^/]*,..,g') && \ + ln -sf $$so_img_rel_target_prefix$(rootlib_execdir)/$$so_img_name $(DESTDIR)$(libdir)/libgudev-1.0.so && \ + mv $(DESTDIR)$(libdir)/libgudev-1.0.so.* $(DESTDIR)$(rootlib_execdir); \ + fi + +libgudev-uninstall-move-hook: + rm -f $(DESTDIR)$(rootlib_execdir)/libgudev-1.0.so* + +INSTALL_EXEC_HOOKS += libgudev-install-move-hook +UNINSTALL_EXEC_HOOKS += libgudev-uninstall-move-hook + # ------------------------------------------------------------------------------ # Bluetooth HID devices with special magic to switch the device # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From 457c67e7c1bc971c64e56dd11aaf697d2f9a1c76 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Oct 2010 15:34:20 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 31b00d25dd..ef0358714a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 164 +======== +Bugfixes. + udev 163 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 733741d447..9f8e377bac 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [163], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [164], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From fc416258f346cd20cf822705bd0a50de82569a63 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Oct 2010 13:03:27 +0200 Subject: udevd: do not wrongly delay events for devices with swapped names Renaming network devices might delay events for the other device, which has the same devpath in the meantime as the original event. Causing a delay until the timout of the event is reached. Look at the ifindex/devnum of the devices to check if they are really the same devices. --- Makefile.am | 2 +- libudev/libudev-device.c | 16 ++++++++++++++++ libudev/libudev-private.h | 2 ++ udev/udevd.c | 11 +++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 093a10e058..fd13005f35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ DISTCHECK_HOOKS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=9 -LIBUDEV_REVISION=1 +LIBUDEV_REVISION=2 LIBUDEV_AGE=9 SUBDIRS += libudev/docs diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 5811490a34..e5f8cc3e46 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -67,6 +67,7 @@ struct udev_device { int devlink_priority; int refcount; dev_t devnum; + int ifindex; int watch_handle; int maj, min; bool parent_set; @@ -187,6 +188,8 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10)); } else if (strncmp(property, "TIMEOUT=", 8) == 0) { udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10)); + } else if (strncmp(property, "IFINDEX=", 8) == 0) { + udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10)); } else { udev_device_add_property_from_string(udev_device, property); } @@ -358,6 +361,8 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) maj = strtoull(&line[6], NULL, 10); else if (strncmp(line, "MINOR=", 6) == 0) min = strtoull(&line[6], NULL, 10); + else if (strncmp(line, "IFINDEX=", 8) == 0) + udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); else if (strncmp(line, "DEVNAME=", 8) == 0) udev_device_set_knodename(udev_device, &line[8]); @@ -1536,3 +1541,14 @@ int udev_device_set_watch_handle(struct udev_device *udev_device, int handle) udev_device->watch_handle = handle; return 0; } + +int udev_device_get_ifindex(struct udev_device *udev_device) +{ + return udev_device->ifindex; +} + +int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) +{ + udev_device->ifindex = ifindex; + return 0; +} diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 7ed4afc42c..c9ed46211c 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -99,6 +99,8 @@ int udev_device_get_devlink_priority(struct udev_device *udev_device); int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); int udev_device_get_watch_handle(struct udev_device *udev_device); int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); +int udev_device_get_ifindex(struct udev_device *udev_device); +int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex); void udev_device_set_info_loaded(struct udev_device *device); /* libudev-device-private.c */ diff --git a/udev/udevd.c b/udev/udevd.c index 2efab5b39d..21dde824ee 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -123,6 +123,7 @@ struct event { const char *devpath_old; dev_t devnum; bool is_block; + int ifindex; }; static struct event *node_to_event(struct udev_list_node *node) @@ -419,6 +420,7 @@ static int event_queue_insert(struct udev_device *dev) event->devpath_old = udev_device_get_devpath_old(dev); event->devnum = udev_device_get_devnum(dev); event->is_block = (strcmp("block", udev_device_get_subsystem(dev)) == 0); + event->ifindex = udev_device_get_ifindex(dev); udev_queue_export_device_queued(udev_queue_export, dev); info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev), @@ -486,6 +488,10 @@ static bool is_devpath_busy(struct event *event) if (major(event->devnum) != 0 && event->devnum == loop_event->devnum && event->is_block == loop_event->is_block) return true; + /* check network device ifindex */ + if (event->ifindex != 0 && event->ifindex == loop_event->ifindex) + return true; + /* check our old name */ if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) { event->delaying_seqnum = loop_event->seqnum; @@ -501,6 +507,11 @@ static bool is_devpath_busy(struct event *event) /* identical device event found */ if (loop_event->devpath_len == event->devpath_len) { + /* devices names might have changed/swapped in the meantime */ + if (major(event->devnum) != 0 && (event->devnum != loop_event->devnum || event->is_block != loop_event->is_block)) + continue; + if (event->ifindex != 0 && event->ifindex != loop_event->ifindex) + continue; event->delaying_seqnum = loop_event->seqnum; return true; } -- cgit v1.2.3-54-g00ecf From 60d19551d8b532338a6f309f9186a5163121c9fe Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 13 Oct 2010 18:08:41 +0200 Subject: keymap: Apply force-release rules to all Samsung models. The force-release list for Samsung is already an ultralong monster, and reportedly still incomplete (see https://launchpad.net/bugs/574250). Give up and instead apply the force-release quirk to all Samsung models. The worst that can happen is that autorepeat behaves a bit weird, but that's much better than a complete freeze after each keypress. --- extras/keymap/95-keyboard-force-release.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index bd6b75ffcc..befce3ca5b 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -19,7 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*E252*|*N120*|*N128*|*N130*|*N140*|*N148/N208*|*N150*|*N150/N210/N220*|*N220*|*N308*|*N310*|*N510*|*NB30*|*NC10/N110*|*ND10*|*Q210/P210*|*R410P*|*R425/R525*|*R428/P428*|*R460*|*R463*|*R468/R418*|*R480/R431/R481*|*R509*|*R518*|*R519/R719*|*R520/R522/R620*|*R528/R728*|*R530/R730*|*R530/R730/P590*|*R560*|*R580*|*R580/R590*|*R59/R60/R61*|*R59P/R60P/R61P*|*R710*|*R720*|*R780/R778*|*SR58P*|*SR700*|*SR70S/SR71S*|*SX22S*|*X118*|*X120*|*X460*", RUN+="keyboard-force-release.sh $devpath samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.sh $devpath samsung-other" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -- cgit v1.2.3-54-g00ecf From 1c2311c5568ddc6c3010afc02e5894e9b22a1c51 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 18 Oct 2010 12:50:20 +0200 Subject: return proper error code in rename_netif() kay: can you look at rename_netif()? it returns -errno in a place, but I think that it may by changed by err() (at least) Md: yeah, that doesn't look correct --- udev/udev-event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index ae523f83c5..064873531b 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -472,8 +472,9 @@ static int rename_netif(struct udev_event *event) sk = socket(PF_INET, SOCK_DGRAM, 0); if (sk < 0) { + err = -errno; err(event->udev, "error opening socket: %m\n"); - return -errno; + return err; } memset(&ifr, 0x00, sizeof(struct ifreq)); -- cgit v1.2.3-54-g00ecf From a74beafdcc05595cc0c07f75f51fe74057a61f28 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 22 Oct 2010 12:52:45 +0200 Subject: keymap: Add Toshiba Satellite U500 https://launchpad.net/bugs/271706 --- extras/keymap/95-keyboard-force-release.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index befce3ca5b..562dc8db53 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -31,7 +31,7 @@ ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-forc ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite U300|Satellite Pro U300|Satellite U305", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite U300|Satellite Pro U300|Satellite U305|SATELLITE U500", RUN+="keyboard-force-release.sh $devpath common-volume-keys" ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -- cgit v1.2.3-54-g00ecf From cdb1d7608a2e2ba708a890eeab6e5e99409a1953 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 22 Oct 2010 13:50:55 +0200 Subject: libudev: return kernel provided devnode when asked before we handled any rules --- Makefile.am | 2 +- libudev/libudev-device.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index fd13005f35..4dbdfd97e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ DISTCHECK_HOOKS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=9 -LIBUDEV_REVISION=2 +LIBUDEV_REVISION=3 LIBUDEV_AGE=9 SUBDIRS += libudev/docs diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index e5f8cc3e46..9b5d79ff4b 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -876,8 +876,19 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; - if (!udev_device->info_loaded) + if (!udev_device->info_loaded) { + udev_device_read_uevent_file(udev_device); udev_device_read_db(udev_device); + } + + /* we might get called before we handled an event and have a db, use the kernel-provided name */ + if (udev_device->devnode == NULL && udev_device_get_knodename(udev_device) != NULL) { + if (asprintf(&udev_device->devnode, "%s/%s", + udev_get_dev_path(udev_device->udev), udev_device_get_knodename(udev_device)) < 0) + return NULL; + return udev_device->devnode; + } + return udev_device->devnode; } -- cgit v1.2.3-54-g00ecf From 9bc26156e085a46e6c4dd48d20443186ae14abca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 23 Oct 2010 15:13:57 +0200 Subject: release 164 --- ChangeLog | 20 ++++++++++++++++++++ NEWS | 2 ++ 2 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index c71e907df1..bcb8390bba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Summary of changes from v163 to v164 +============================================ + +David Zeuthen (1): + Install libgudev-1.0.so in prefix / instead of prefix /usr + +Harald Hoyer (1): + cdrom_id: request the drive profile features with a dynamic length + +Kay Sievers (4): + version bump + udevd: do not wrongly delay events for devices with swapped names + return proper error code in rename_netif() + libudev: return kernel provided devnode when asked before we handled any rules + +Martin Pitt (2): + keymap: Apply force-release rules to all Samsung models. + keymap: Add Toshiba Satellite U500 + + Summary of changes from v162 to v163 ============================================ diff --git a/NEWS b/NEWS index ef0358714a..7d735131c9 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ udev 164 ======== Bugfixes. +GUdev moved from /usr to /. + udev 163 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From be9c0d574004cc6aabf457a6e1e45adb71cb6aec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 23 Oct 2010 15:35:35 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 7d735131c9..017c2d5857 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 165 +======== +Bugfixes. + udev 164 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 9f8e377bac..e82b9b8e99 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [164], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [165], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 2f151e0fbf354261e3a7f68fd28a032ace6978f8 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 25 Oct 2010 22:01:03 -0400 Subject: keymap: Add Sony Vaio VGN71 https://launchpad.net/bugs/625770 --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 4 ++++ extras/keymap/keymaps/module-sony-vgn | 5 +++++ 3 files changed, 10 insertions(+) create mode 100644 extras/keymap/keymaps/module-sony-vgn diff --git a/Makefile.am b/Makefile.am index 4dbdfd97e3..3a95046c5b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -587,6 +587,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/module-lenovo \ extras/keymap/keymaps/module-sony \ extras/keymap/keymaps/module-sony-old \ + extras/keymap/keymaps/module-sony-vgn \ extras/keymap/keymaps/olpc-xo \ extras/keymap/keymaps/onkyo \ extras/keymap/keymaps/oqo-model2 \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index eda006e13e..c059ef0648 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -48,6 +48,10 @@ ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+ # Older Vaios have some different keys ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" +# Some Sony VGN models have yet another one +ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="VGN-AR71MR", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-vgn" + + # # The following rules belong to standard i8042 AT keyboard with high key codes. # diff --git a/extras/keymap/keymaps/module-sony-vgn b/extras/keymap/keymaps/module-sony-vgn new file mode 100644 index 0000000000..d8a9443a7d --- /dev/null +++ b/extras/keymap/keymaps/module-sony-vgn @@ -0,0 +1,5 @@ +0x00 brightnessdown # Fn+F5 +0x10 brightnessup # Fn+F6 +0x11 switchvideomode # Fn+F7 +0x12 zoom # Fn+F10 +0x15 suspend # Fn+F12 -- cgit v1.2.3-54-g00ecf From 81956ed1dcdaf02f8d0fc114421e264d5589fe39 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 25 Oct 2010 22:11:37 -0400 Subject: keymap: Add some more Sony Vaio VGN-* models https://launchpad.net/bugs/627890 --- extras/keymap/95-keymap.rules | 2 +- extras/keymap/keymaps/module-sony-vgn | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index c059ef0648..053838d803 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -49,7 +49,7 @@ ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+ ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" # Some Sony VGN models have yet another one -ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="VGN-AR71MR", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-vgn" +ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="VGN-AR71*|VGN-FW*|VGN-Z21*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-vgn" # diff --git a/extras/keymap/keymaps/module-sony-vgn b/extras/keymap/keymaps/module-sony-vgn index d8a9443a7d..c8ba001516 100644 --- a/extras/keymap/keymaps/module-sony-vgn +++ b/extras/keymap/keymaps/module-sony-vgn @@ -1,5 +1,8 @@ 0x00 brightnessdown # Fn+F5 0x10 brightnessup # Fn+F6 0x11 switchvideomode # Fn+F7 -0x12 zoom # Fn+F10 +0x12 zoomout +0x14 zoomin 0x15 suspend # Fn+F12 +0x17 prog1 +0x20 media -- cgit v1.2.3-54-g00ecf From d43e5e5b5a2e27fb75a6e19cca457ca40ad160e4 Mon Sep 17 00:00:00 2001 From: Jan Drzewiecki Date: Tue, 26 Oct 2010 12:10:57 -0400 Subject: cdrom_id: Fix media state for unreadable DVDs If the disc is unreadable and reading of the first 32 blocks fails set the cd_media status to 0 (not present). This will prevent udev from executing blkid next that tries to determine fs on the disc and which in this case may seem to hang forever locking the drive. Signed-off-by: Martin Pitt --- extras/cdrom_id/cdrom_id.c | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index ec001cde71..f0e1cbbc42 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -696,6 +696,7 @@ static int cd_media_info(struct udev *udev, int fd) scsi_cmd_set(udev, &sc, 9, 0); err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); if ((err != 0)) { + cd_media = 0; info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err); return -1; } -- cgit v1.2.3-54-g00ecf From 6992637e3165d433353c996aad16c8d141b00845 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Sat, 30 Oct 2010 11:44:06 -0400 Subject: ata_id: Support SG_IO version 4 interface This makes it possible to use /dev/bsg/* nodes for ata_id: # /lib/udev/ata_id --export /dev/bsg/0\:0\:0\:0 ID_ATA=1 ID_TYPE=disk ID_BUS=ata ID_MODEL=INTEL_SSDSA2MH080G1GC ID_MODEL_ENC=INTEL\x20SSDSA2MH080G1GC\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 ID_REVISION=045C8802 [...] This means that our cd-rom detection as per commit http://git.kernel.org/?p=linux/hotplug/udev.git;a=commit;h=160b069c25690bfb0c785994c7c3710289179107 needs to be reworked since we can't just use the CDROM_GET_CAPABILITY ioctl on a /dev/bsg node (which is a character device). We do this by just sending the SCSI INQUIRY command and checking the type (CD-ROM's are all type 0x05 and disks are type 0x00) before we issue the ATA IDENTIFY command through the SCSI command ATA PASS_THROUGH (12). (Yes, it's a bit perverse how we have to tunnel our ATA commands through a SCSI command but that's how Linux currently work.) We still support for SG_IO version 3 (we fail back if version 4 fails with EINVAL) because testing reveals that some drivers (such as mpt2sas) still only support version 3 on the block nodes. Signed-off-by: David Zeuthen --- extras/ata_id/ata_id.c | 291 +++++++++++++++++++++++++++++++------------------ 1 file changed, 184 insertions(+), 107 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index bf1debe028..41544e922e 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -3,7 +3,7 @@ * * Copyright (C) 2005-2008 Kay Sievers * Copyright (C) 2009 Lennart Poettering - * Copyright (C) 2009 David Zeuthen + * Copyright (C) 2009-2010 David Zeuthen * * 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 @@ -39,85 +39,166 @@ #include #include #include +#include #include #include "libudev.h" #include "libudev-private.h" -#define COMMAND_TIMEOUT 2000 +#define COMMAND_TIMEOUT_MSEC (30 * 1000) -/* Sends a SCSI command block */ -static int sg_io(int fd, int direction, - const void *cdb, size_t cdb_len, - void *data, size_t data_len, - void *sense, size_t sense_len) +static int disk_scsi_inquiry_command(int fd, + void *buf, + size_t buf_len) { + struct sg_io_v4 io_v4; + uint8_t cdb[12]; + uint8_t sense[32]; + int ret; - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = cdb_len; - io_hdr.dxferp = data; - io_hdr.dxfer_len = data_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sense_len; - io_hdr.dxfer_direction = direction; - io_hdr.timeout = COMMAND_TIMEOUT; - return ioctl(fd, SG_IO, &io_hdr); + /* + * INQUIRY, see SPC-4 section 6.4 + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0x12; /* OPERATION CODE: INQUIRY */ + cdb[3] = (buf_len >> 8); /* ALLOCATION LENGTH */ + cdb[4] = (buf_len & 0xff); + + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + + /* even if the ioctl succeeds, we need to check the return value */ + if (!(io_hdr.status == 0 && + io_hdr.host_status == 0 && + io_hdr.driver_status == 0)) { + errno = EIO; + ret = -1; + goto out; + } + } else { + goto out; + } + } + + /* even if the ioctl succeeds, we need to check the return value */ + if (!(io_v4.device_status == 0 && + io_v4.transport_status == 0 && + io_v4.driver_status == 0)) { + errno = EIO; + ret = -1; + goto out; + } + + out: + return ret; } -static int disk_command(int fd, int command, int direction, void *cmd_data, - void *data, size_t *len) +static int disk_identify_command(int fd, + void *buf, + size_t buf_len) { - uint8_t *bytes = cmd_data; + struct sg_io_v4 io_v4; uint8_t cdb[12]; uint8_t sense[32]; uint8_t *desc = sense+8; int ret; /* - * ATA Pass-Through 12 byte command, as described in "T10 04-262r8 - * ATA Command Pass-Through": - * http://www.t10.org/ftp/t10/document.04/04-262r8.pdf + * ATA Pass-Through 12 byte command, as described in + * + * T10 04-262r8 ATA Command Pass-Through + * + * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf */ memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0xa1; /* OPERATION CODE: 12 byte pass through */ - if (direction == SG_DXFER_NONE) { - cdb[1] = 3 << 1; /* PROTOCOL: Non-Data */ - cdb[2] = 0x20; /* OFF_LINE=0, CK_COND=1, T_DIR=0, BYT_BLOK=0, T_LENGTH=0 */ - } else if (direction == SG_DXFER_FROM_DEV) { - cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ - cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ - } else if (direction == SG_DXFER_TO_DEV) { - cdb[1] = 5 << 1; /* PROTOCOL: PIO Data-Out */ - cdb[2] = 0x26; /* OFF_LINE=0, CK_COND=1, T_DIR=0, BYT_BLOK=1, T_LENGTH=2 */ - } - cdb[3] = bytes[1]; /* FEATURES */ - cdb[4] = bytes[3]; /* SECTORS */ - cdb[5] = bytes[9]; /* LBA LOW */ - cdb[6] = bytes[8]; /* LBA MID */ - cdb[7] = bytes[7]; /* LBA HIGH */ - cdb[8] = bytes[10] & 0x4F; /* SELECT */ - cdb[9] = (uint8_t) command; + cdb[0] = 0xa1; /* OPERATION CODE: 12 byte pass through */ + cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ + cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ + cdb[3] = 0; /* FEATURES */ + cdb[4] = 1; /* SECTORS */ + cdb[5] = 0; /* LBA LOW */ + cdb[6] = 0; /* LBA MID */ + cdb[7] = 0; /* LBA HIGH */ + cdb[8] = 0 & 0x4F; /* SELECT */ + cdb[9] = 0xEC; /* Command: ATA IDENTIFY DEVICE */; memset(sense, 0, sizeof(sense)); - if ((ret = sg_io(fd, direction, cdb, sizeof(cdb), data, len ? *len : 0, sense, sizeof(sense))) < 0) - return ret; - if (sense[0] != 0x72 || desc[0] != 0x9 || desc[1] != 0x0c) { + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + } else { + goto out; + } + } + + if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { errno = EIO; - return -1; + ret = -1; + goto out; } - memset(bytes, 0, 12); - bytes[1] = desc[3]; /* FEATURES */ - bytes[2] = desc[4]; /* STATUS */ - bytes[3] = desc[5]; /* SECTORS */ - bytes[9] = desc[7]; /* LBA LOW */ - bytes[8] = desc[9]; /* LBA MID */ - bytes[7] = desc[11]; /* LBA HIGH */ - bytes[10] = desc[12]; /* SELECT */ - bytes[11] = desc[13]; /* ERROR */ + out: return ret; } @@ -187,78 +268,74 @@ static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offs * otherwise non-zero with errno set. */ static int disk_identify (struct udev *udev, - int fd, - uint8_t out_identify[512]) + int fd, + uint8_t out_identify[512]) { int ret; - uint64_t size; - struct stat st; - uint16_t cmd[6]; - size_t len = 512; - const uint8_t *p; + uint8_t inquiry_buf[36]; + int peripheral_device_type; + int all_nul_bytes; + int n; assert (out_identify != NULL); - /* init results */ ret = -1; memset (out_identify, '\0', 512); - if ((ret = fstat(fd, &st)) < 0) - goto fail; - - if (!S_ISBLK(st.st_mode)) { - errno = ENODEV; - goto fail; - } - - /* - * do not confuse optical drive firmware with ATA commands - * some drives are reported to blank CD-RWs + /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device + * we could accidentally blank media. This is because MMC's BLANK + * command has the same op-code (0x61). + * + * To prevent this from happening we bail out if the device + * isn't a Direct Access Block Device, e.g. SCSI type 0x00 + * (CD/DVD devices are type 0x05). So we send a SCSI INQUIRY + * command first... libata is handling this via its SCSI + * emulation layer. + * + * This also ensures that we're actually dealing with a device + * that understands SCSI commands. + * + * (Yes, it is a bit perverse that we're tunneling the ATA + * command through SCSI and relying on the ATA driver + * emulating SCSI well-enough...) + * + * (See commit 160b069c25690bfb0c785994c7c3710289179107 for + * the original bug-fix and see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635 + * for the original bug-report.) */ - if (ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0) { - errno = EIO; - ret = -1; - goto fail; - } - - /* So, it's a block device. Let's make sure the ioctls work */ - if ((ret = ioctl(fd, BLKGETSIZE64, &size)) < 0) - goto fail; + ret = disk_scsi_inquiry_command (fd, inquiry_buf, sizeof (inquiry_buf)); + if (ret != 0) + goto out; - if (size <= 0 || size == (uint64_t) -1) { + /* SPC-4, section 6.4.2: Standard INQUIRY data */ + peripheral_device_type = inquiry_buf[0] & 0x1f; + if (peripheral_device_type != 0x00) { + ret = -1; errno = EIO; - goto fail; + goto out; } - memset(cmd, 0, sizeof(cmd)); - cmd[1] = htons(1); - ret = disk_command(fd, - 0xEC, /* IDENTIFY DEVICE command */ - SG_DXFER_FROM_DEV, cmd, - out_identify, &len); + /* OK, now issue the IDENTIFY DEVICE command */ + ret = disk_identify_command(fd, out_identify, 512); if (ret != 0) - goto fail; + goto out; - if (len != 512) { - errno = EIO; - goto fail; - } - - /* Check if IDENTIFY data is all NULs */ - for (p = out_identify; p < (const uint8_t*) out_identify + len; p++) { - if (*p) { - p = NULL; + /* Check if IDENTIFY data is all NUL bytes - if so, bail */ + all_nul_bytes = 1; + for (n = 0; n < 512; n++) { + if (out_identify[n] != '\0') { + all_nul_bytes = 0; break; } } - if (p) { + if (all_nul_bytes) { + ret = -1; errno = EIO; - goto fail; + goto out; } - ret = 0; -fail: +out: return ret; } -- cgit v1.2.3-54-g00ecf From 2938220037862b7698df091a1e5cd45f44132d73 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Sat, 30 Oct 2010 12:30:19 -0400 Subject: Run scsi_id and ata_id on the scsi_device object In a multi-initiator setup, the HBA may very well export a SCSI device for a device that another initiator has already logged into. But since another initiator has already logged in, the kernel will not create a block device. Note that this is also the case for some RAID HBAs - for example, the LSI 1068 series cards will export a SCSI device for a disk that is in use by the HBAs RAID engine (no block device will be created here). Running scsi_id and ata_id on the actual SCSI device means that we can inquire the capabilities of the device. For example, we can check whether ID_ATA_FEATURE_SET_SMART and ID_ATA_FEATURE_SET_SMART_ENABLED is set and, if so, periodically poll the SMART status of the disk. Even when other initiators has claimed the disk and if the disk is in use by the RAID engine of the HBA. Note that we run scsi_id and ata_id on /dev/bsg/* nodes - this is safe to do because the scsi core guarantees that the bsg device has been created before the actual add uevent for the scsi_device is emitted. Since the block device is a direct child of the scsi_device we can avoid running scsi_id and ata_id again by simply importing the resulting ID_* properties from the parent. Signed-off-by: David Zeuthen --- rules/rules.d/60-persistent-storage.rules | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 6449e077ac..d3f2f73495 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -6,7 +6,16 @@ # forward scsi device event to corresponding block device ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" +# from this point on, we don't care about remove envets +# ACTION=="remove", GOTO="persistent_storage_end" + +# run scsi_id and ata_id on the actual SCSI device +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", ATTR{vendor}=="ATA", IMPORT{program}="ata_id --export $root/bsg/$kernel" +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export --device $root/bsg/$kernel" + +# from this point on, only care about block devices +# SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices @@ -22,6 +31,9 @@ ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" +# import ata_id/scsi_id data from the scsi_device captured above, if available +SUBSYSTEMS=="scsi", IMPORT{parent}="ID_*" + # USB devices use their own serial number KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" # ATA devices with their own "ata" kernel subsystem -- cgit v1.2.3-54-g00ecf From 560de575148b7efda3b34a7f7073abd483c5f08e Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Thu, 4 Nov 2010 08:55:58 -0400 Subject: Use ata_id, not scsi_id, on ATAPI devices The major benefit here, is that we get the ATAPI device serial number. With SCSI ID we didn't get this since it's not part of the SCSI INQUIRY command. Specifically this means that we get symlinks to empty optical drives, e.g. /dev/disk/by-id/ata-VBOX_CD-ROM_VB2-01700376 which we didn't get earlier. So this is a major win. Also make ata_id work on CD-ROM devices when using /dev/bsg nodes so this works on both the scsi_device as well as the block device. We do this, basically, by issuing the ATA IDENTIFY PACKET DEVICE command instead of the ATA IDENTIFY command. We also use 16-byte pass-through ATA passthrough instead of 12-byte passthrough to avoid clashing with the MMC BLANK command. This means that we get this output # udevadm info -q all -p /sys/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 P: /devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 E: UDEV_LOG=3 E: DEVPATH=/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 E: DEVTYPE=scsi_device E: DRIVER=sr E: MODALIAS=scsi:t-0x05 E: SUBSYSTEM=scsi E: ID_ATA=1 E: ID_TYPE=cd E: ID_BUS=ata E: ID_MODEL=VBOX_CD-ROM E: ID_MODEL_ENC=VBOX\x20CD-ROM\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x 20\x20\x20\x20\x20\x20\x20 E: ID_REVISION=1.0 E: ID_SERIAL=VBOX_CD-ROM_VB2-01700376 E: ID_SERIAL_SHORT=VB2-01700376 instead of just # udevadm info -q all -p /sys/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 P: /devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 E: UDEV_LOG=3 E: DEVPATH=/devices/pci0000:00/0000:00:01.1/host3/target3:0:0/3:0:0:0 E: DEVTYPE=scsi_device E: DRIVER=sr E: MODALIAS=scsi:t-0x05 E: SUBSYSTEM=scsi E: ID_SCSI=1 E: ID_VENDOR=VBOX E: ID_VENDOR_ENC=VBOX\x20\x20\x20\x20 E: ID_MODEL=CD-ROM E: ID_MODEL_ENC=CD-ROM\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20 E: ID_REVISION=1.0 E: ID_TYPE=cd Signed-off-by: David Zeuthen --- extras/ata_id/ata_id.c | 122 +++++++++++++++++++++++++++--- rules/rules.d/60-persistent-storage.rules | 4 + 2 files changed, 114 insertions(+), 12 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 41544e922e..92387e5077 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -202,6 +202,89 @@ static int disk_identify_command(int fd, return ret; } +static int disk_identify_packet_device_command(int fd, + void *buf, + size_t buf_len) +{ + struct sg_io_v4 io_v4; + uint8_t cdb[16]; + uint8_t sense[32]; + uint8_t *desc = sense+8; + int ret; + + /* + * ATA Pass-Through 16 byte command, as described in + * + * T10 04-262r8 ATA Command Pass-Through + * + * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0x85; /* OPERATION CODE: 16 byte pass through */ + cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ + cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ + cdb[3] = 0; /* FEATURES */ + cdb[4] = 0; /* FEATURES */ + cdb[5] = 0; /* SECTORS */ + cdb[6] = 1; /* SECTORS */ + cdb[7] = 0; /* LBA LOW */ + cdb[8] = 0; /* LBA LOW */ + cdb[9] = 0; /* LBA MID */ + cdb[10] = 0; /* LBA MID */ + cdb[11] = 0; /* LBA HIGH */ + cdb[12] = 0; /* LBA HIGH */ + cdb[13] = 0; /* DEVICE */ + cdb[14] = 0xA1; /* Command: ATA IDENTIFY PACKET DEVICE */; + cdb[15] = 0; /* CONTROL */ + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + } else { + goto out; + } + } + + if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { + errno = EIO; + ret = -1; + goto out; + } + + out: + return ret; +} + /** * disk_identify_get_string: * @identify: A block of IDENTIFY data @@ -256,31 +339,36 @@ static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offs * @udev: The libudev context. * @fd: File descriptor for the block device. * @out_identify: Return location for IDENTIFY data. + * @out_is_packet_device: Return location for whether returned data is from a IDENTIFY PACKET DEVICE. * - * Sends the IDENTIFY DEVICE command to the device represented by - * @fd. If successful, then the result will be copied into - * @out_identify. + * Sends the IDENTIFY DEVICE or IDENTIFY PACKET DEVICE command to the + * device represented by @fd. If successful, then the result will be + * copied into @out_identify and @out_is_packet_device. * * This routine is based on code from libatasmart, Copyright 2008 * Lennart Poettering, LGPL v2.1. * - * Returns: 0 if the IDENTIFY data was successfully obtained, - * otherwise non-zero with errno set. + * Returns: 0 if the data was successfully obtained, otherwise + * non-zero with errno set. */ static int disk_identify (struct udev *udev, int fd, - uint8_t out_identify[512]) + uint8_t out_identify[512], + int *out_is_packet_device) { int ret; uint8_t inquiry_buf[36]; int peripheral_device_type; int all_nul_bytes; int n; + int is_packet_device; assert (out_identify != NULL); + /* init results */ ret = -1; memset (out_identify, '\0', 512); + is_packet_device = 0; /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device * we could accidentally blank media. This is because MMC's BLANK @@ -309,6 +397,12 @@ static int disk_identify (struct udev *udev, /* SPC-4, section 6.4.2: Standard INQUIRY data */ peripheral_device_type = inquiry_buf[0] & 0x1f; + if (peripheral_device_type == 0x05) + { + is_packet_device = 1; + ret = disk_identify_packet_device_command(fd, out_identify, 512); + goto check_nul_bytes; + } if (peripheral_device_type != 0x00) { ret = -1; errno = EIO; @@ -320,6 +414,7 @@ static int disk_identify (struct udev *udev, if (ret != 0) goto out; + check_nul_bytes: /* Check if IDENTIFY data is all NUL bytes - if so, bail */ all_nul_bytes = 1; for (n = 0; n < 512; n++) { @@ -336,6 +431,8 @@ static int disk_identify (struct udev *udev, } out: + if (out_is_packet_device != NULL) + *out_is_packet_device = is_packet_device; return ret; } @@ -350,7 +447,7 @@ int main(int argc, char *argv[]) { struct udev *udev; struct hd_driveid id; - uint8_t identify[512]; + uint8_t identify[512]; char model[41]; char model_enc[256]; char serial[21]; @@ -358,8 +455,9 @@ int main(int argc, char *argv[]) const char *node = NULL; int export = 0; int fd; - uint16_t word; + uint16_t word; int rc = 0; + int is_packet_device = 0; static const struct option options[] = { { "export", no_argument, NULL, 'x' }, { "help", no_argument, NULL, 'h' }, @@ -408,7 +506,7 @@ int main(int argc, char *argv[]) goto exit; } - if (disk_identify(udev, fd, identify) == 0) { + if (disk_identify(udev, fd, identify, &is_packet_device) == 0) { /* * fix up only the fields from the IDENTIFY data that we are going to * use and copy it into the hd_driveid struct for convenience @@ -416,7 +514,7 @@ int main(int argc, char *argv[]) disk_identify_fixup_string (identify, 10, 20); /* serial */ disk_identify_fixup_string (identify, 23, 6); /* fwrev */ disk_identify_fixup_string (identify, 27, 40); /* model */ - disk_identify_fixup_uint16 (identify, 0); /* configuration */ + disk_identify_fixup_uint16 (identify, 0); /* configuration */ disk_identify_fixup_uint16 (identify, 75); /* queue depth */ disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ disk_identify_fixup_uint16 (identify, 82); /* command set supported */ @@ -457,8 +555,8 @@ int main(int argc, char *argv[]) udev_util_replace_chars(revision, NULL); if (export) { - /* Set this to convey the disk speaks the ATA protocol */ - printf("ID_ATA=1\n"); + /* Set this to convey the disk speaks the ATA protocol */ + printf("ID_ATA=1\n"); if ((id.config >> 8) & 0x80) { /* This is an ATAPI device */ diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index d3f2f73495..8baabc2cf9 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -12,6 +12,8 @@ ACTION=="remove", GOTO="persistent_storage_end" # run scsi_id and ata_id on the actual SCSI device SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", ATTR{vendor}=="ATA", IMPORT{program}="ata_id --export $root/bsg/$kernel" +# ATA/ATAPI devices is of type 0x05 and vendor is usually not ATA +SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", ATTR{type}=="5", IMPORT{program}="ata_id --export $root/bsg/$kernel" SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export --device $root/bsg/$kernel" # from this point on, only care about block devices @@ -40,6 +42,8 @@ KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" # ATA devices using the "scsi" subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" +# ATA/ATAPI devices using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", IMPORT{program}="ata_id --export $tempnode" # scsi devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" -- cgit v1.2.3-54-g00ecf From ecfad20871e855d9e54d3a528cf9219ce5c93626 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 1 Nov 2010 16:29:09 +0000 Subject: keymap: Add force release for HP touchpad off Force the touchpad off/on keys getting released, as they usually only send a "repeat". https://bugzilla.redhat.com/show_bug.cgi?id=623239 Signed-off-by: Martin Pitt --- Makefile.am | 1 + extras/keymap/95-keyboard-force-release.rules | 5 +++++ extras/keymap/force-release-maps/hp-other | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 extras/keymap/force-release-maps/hp-other diff --git a/Makefile.am b/Makefile.am index 3a95046c5b..032eb287a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -601,6 +601,7 @@ dist_udevkeymap_DATA = \ udevkeymapforcereldir = $(libexecdir)/keymaps/force-release dist_udevkeymapforcerel_DATA = \ + extras/keymap/force-release-maps/hp-other \ extras/keymap/force-release-maps/samsung-other \ extras/keymap/force-release-maps/common-volume-keys diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 562dc8db53..6f7c0fddf5 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -35,4 +35,9 @@ ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite U300|Satellit ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +# These are all the HP laptops that setup a touchpad toggle key +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keyboard-force-release.sh $devpath hp-other" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keyboard-force-release.sh $devpath hp-other" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keyboard-force-release.sh $devpath hp-other" + LABEL="force_release_end" diff --git a/extras/keymap/force-release-maps/hp-other b/extras/keymap/force-release-maps/hp-other new file mode 100644 index 0000000000..6621370095 --- /dev/null +++ b/extras/keymap/force-release-maps/hp-other @@ -0,0 +1,3 @@ +# list of scancodes (hex or decimal), optional comment +0xd8 # Touchpad off +0xd9 # Touchpad on -- cgit v1.2.3-54-g00ecf From a1ca5f60e0770299c5c5f21bd371f5823802412b Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 4 Nov 2010 23:58:56 +0000 Subject: extras/keymap: Make touchpad buttons consistent We'll need to standardise on the Touchpad related keys in udev, kernel, and X.org. I selected F21 for XF86TouchpadToggle, F22 for XF86TouchpadOn and F23 for XF86TouchpadOff. See: https://bugs.freedesktop.org/show_bug.cgi?id=31333 Signed-off-by: Martin Pitt --- extras/keymap/keymaps/acer | 2 +- extras/keymap/keymaps/dell | 4 ++-- extras/keymap/keymaps/everex-xt5000 | 2 +- extras/keymap/keymaps/hewlett-packard-2510p_2530p | 4 ++-- extras/keymap/keymaps/hewlett-packard-pavilion | 4 ++-- extras/keymap/keymaps/hewlett-packard-tx2 | 2 +- extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint | 2 +- extras/keymap/keymaps/lg-x110 | 4 ++-- extras/keymap/keymaps/micro-star | 2 +- extras/keymap/keymaps/module-lenovo | 2 +- extras/keymap/keymaps/onkyo | 2 +- extras/keymap/keymaps/samsung-other | 2 +- extras/keymap/keymaps/samsung-sx20s | 4 ++-- extras/keymap/keymaps/toshiba-satellite_a110 | 4 ++-- extras/keymap/keymaps/toshiba-satellite_m30x | 4 ++-- extras/keymap/keymaps/zepto-znote | 2 +- 16 files changed, 23 insertions(+), 23 deletions(-) diff --git a/extras/keymap/keymaps/acer b/extras/keymap/keymaps/acer index 6abe39cdb2..4e7c297dea 100644 --- a/extras/keymap/keymaps/acer +++ b/extras/keymap/keymaps/acer @@ -14,7 +14,7 @@ 0xEE brightnessup # Fn+Right 0xEF brightnessdown # Fn+Left 0xF1 f22 # Fn+F7 Touchpad toggle (off-to-on) -0xF2 f22 # Fn+F7 Touchpad toggle (on-to-off) +0xF2 f23 # Fn+F7 Touchpad toggle (on-to-off) 0xF3 prog2 # "P2" programmable button 0xF4 prog1 # "P1" programmable button 0xF5 presentation diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell index 1a2e433396..fbbb9035b1 100644 --- a/extras/keymap/keymaps/dell +++ b/extras/keymap/keymaps/dell @@ -21,9 +21,9 @@ 0x99 nextsong # Front panel next song 0x9A setup # Tablet tools button 0x9B switchvideomode # Display Toggle button -0x9E f22 #touchpad toggle +0x9E f21 #touchpad toggle 0xA2 playpause # Front panel play/pause 0xA4 stopcd # Front panel stop 0xED media # MediaDirect button 0xD8 screenlock # FIXME: Tablet lock button -0xD9 f22 # touchpad toggle +0xD9 f21 # touchpad toggle diff --git a/extras/keymap/keymaps/everex-xt5000 b/extras/keymap/keymaps/everex-xt5000 index 53bdd7af24..4823a832f5 100644 --- a/extras/keymap/keymaps/everex-xt5000 +++ b/extras/keymap/keymaps/everex-xt5000 @@ -1,5 +1,5 @@ 0x5C media -0x65 f22 # Fn+F5 Touchpad toggle +0x65 f21 # Fn+F5 Touchpad toggle 0x67 prog3 # Fan Speed Control button 0x6F brightnessup 0x7F brightnessdown diff --git a/extras/keymap/keymaps/hewlett-packard-2510p_2530p b/extras/keymap/keymaps/hewlett-packard-2510p_2530p index 2bc70c2064..41ad2e9b5a 100644 --- a/extras/keymap/keymaps/hewlett-packard-2510p_2530p +++ b/extras/keymap/keymaps/hewlett-packard-2510p_2530p @@ -1,2 +1,2 @@ -0xD8 f22 # touchpad off -0xD9 f23 # touchpad on +0xD8 f23 # touchpad off +0xD9 f22 # touchpad on diff --git a/extras/keymap/keymaps/hewlett-packard-pavilion b/extras/keymap/keymaps/hewlett-packard-pavilion index a55d2b7048..3d3cefc8e6 100644 --- a/extras/keymap/keymaps/hewlett-packard-pavilion +++ b/extras/keymap/keymaps/hewlett-packard-pavilion @@ -1,3 +1,3 @@ 0x88 media # FIXME: quick play -0xD8 f22 # touchpad off -0xD9 f23 # touchpad on +0xD8 f23 # touchpad off +0xD9 f22 # touchpad on diff --git a/extras/keymap/keymaps/hewlett-packard-tx2 b/extras/keymap/keymaps/hewlett-packard-tx2 index 206c004dd0..36a690fcf6 100644 --- a/extras/keymap/keymaps/hewlett-packard-tx2 +++ b/extras/keymap/keymaps/hewlett-packard-tx2 @@ -1,3 +1,3 @@ 0xC2 media -0xD8 f22 # Toggle touchpad button on tx2 (OFF) +0xD8 f23 # Toggle touchpad button on tx2 (OFF) 0xD9 f22 # Toggle touchpad button on tx2 (ON) diff --git a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint index 7612f79b0c..bc9147085b 100644 --- a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint +++ b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint @@ -2,7 +2,7 @@ 0x90013 battery # Fn+F3 0x90014 wlan # Fn+F5 0x90016 switchvideomode # Fn+F7 -0x90017 f22 # Fn+F8 touchpadtoggle +0x90017 f21 # Fn+F8 touchpadtoggle 0x90019 suspend # Fn+F12 0x9001A brightnessup # Fn+Home 0x9001B brightnessdown # Fn+End diff --git a/extras/keymap/keymaps/lg-x110 b/extras/keymap/keymaps/lg-x110 index a61cf3d21e..ba08cba3fe 100644 --- a/extras/keymap/keymaps/lg-x110 +++ b/extras/keymap/keymaps/lg-x110 @@ -6,7 +6,7 @@ 0xB3 suspend # Fn-F12 0xDF sleep # Fn-F4 # 0xE2 bluetooth # satellite dish2 -0xE4 f22 # Fn-F5 Touchpad disable +0xE4 f21 # Fn-F5 Touchpad disable 0xF6 wlan # Fn-F6 0xF7 reserved # brightnessdown # Fn-Down -0xF8 reserved # brightnessup # Fn-Up \ No newline at end of file +0xF8 reserved # brightnessup # Fn-Up diff --git a/extras/keymap/keymaps/micro-star b/extras/keymap/keymaps/micro-star index 0de5ae6d18..4a438698ed 100644 --- a/extras/keymap/keymaps/micro-star +++ b/extras/keymap/keymaps/micro-star @@ -4,7 +4,7 @@ 0xB2 www # e button 0xDF sleep # Fn-F12 0xE2 bluetooth # satellite dish2 -0xE4 f22 # Fn-F3 Touchpad disable +0xE4 f21 # Fn-F3 Touchpad disable 0xEC email # envelope button 0xEE camera # Fn-F6 camera disable 0xF6 wlan # satellite dish1 diff --git a/extras/keymap/keymaps/module-lenovo b/extras/keymap/keymaps/module-lenovo index 7c597bd851..9cb74b28de 100644 --- a/extras/keymap/keymaps/module-lenovo +++ b/extras/keymap/keymaps/module-lenovo @@ -3,7 +3,7 @@ 0x3 sleep # Fn+F4 0x4 wlan # Fn+F5 0x6 switchvideomode # Fn+F7 -0x7 f22 # Fn+F8 touchpadtoggle +0x7 f21 # Fn+F8 touchpadtoggle 0x8 f24 # Fn+F9 undock 0xB suspend # Fn+F12 0xF brightnessup # Fn+Home diff --git a/extras/keymap/keymaps/onkyo b/extras/keymap/keymaps/onkyo index 7dd80a1fb0..ee864ade4d 100644 --- a/extras/keymap/keymaps/onkyo +++ b/extras/keymap/keymaps/onkyo @@ -8,7 +8,7 @@ 0xF0 media # Fn+R 0xF5 switchvideomode # Fn+E 0xF6 camera # Fn+T -0xF7 f22 # Fn+Y (touchpad toggle) +0xF7 f21 # Fn+Y (touchpad toggle) 0xF8 brightnessup # Fn+S 0xF9 brightnessdown # Fn+A 0xFB wlan # Fn+J diff --git a/extras/keymap/keymaps/samsung-other b/extras/keymap/keymaps/samsung-other index 6a0928c4b3..3ac0c2f10c 100644 --- a/extras/keymap/keymaps/samsung-other +++ b/extras/keymap/keymaps/samsung-other @@ -11,4 +11,4 @@ 0xB3 prog3 # Fn+F8 switch power mode (battery/dynamic/performance) 0xB4 wlan # Fn+F9 (X60P) 0xF7 f22 # Fn+F10 Touchpad on -0xF9 f22 # Fn+F10 Touchpad off +0xF9 f23 # Fn+F10 Touchpad off diff --git a/extras/keymap/keymaps/samsung-sx20s b/extras/keymap/keymaps/samsung-sx20s index daf7d3ea54..9d954ee415 100644 --- a/extras/keymap/keymaps/samsung-sx20s +++ b/extras/keymap/keymaps/samsung-sx20s @@ -1,4 +1,4 @@ 0x74 mute 0x75 mute -0x77 f21 # FIXME: Touchpad on -0x79 f21 # FIXME: Touchpad off +0x77 f22 # Touchpad on +0x79 f23 # Touchpad off diff --git a/extras/keymap/keymaps/toshiba-satellite_a110 b/extras/keymap/keymaps/toshiba-satellite_a110 index 0f2aaec420..1429409351 100644 --- a/extras/keymap/keymaps/toshiba-satellite_a110 +++ b/extras/keymap/keymaps/toshiba-satellite_a110 @@ -1,8 +1,8 @@ 0x92 stop 0x93 www 0x94 media -0x9E f21 # FIXME: Touchpad on -0x9F f21 # FIXME: Touchpad off +0x9E f22 # Touchpad on +0x9F f23 # Touchpad off 0xB9 nextsong 0xD9 brightnessup 0xEE screenlock diff --git a/extras/keymap/keymaps/toshiba-satellite_m30x b/extras/keymap/keymaps/toshiba-satellite_m30x index cf6d912be5..9280ae0c5f 100644 --- a/extras/keymap/keymaps/toshiba-satellite_m30x +++ b/extras/keymap/keymaps/toshiba-satellite_m30x @@ -2,6 +2,6 @@ 0xd9 brightnessup 0xee screenlock 0x93 media -0x9e prog1 #touchpad_enable -0x9f prog2 #touchpad_disable +0x9e f22 #touchpad_enable +0x9f f23 #touchpad_disable diff --git a/extras/keymap/keymaps/zepto-znote b/extras/keymap/keymaps/zepto-znote index e07651621c..cf72fda47b 100644 --- a/extras/keymap/keymaps/zepto-znote +++ b/extras/keymap/keymaps/zepto-znote @@ -1,7 +1,7 @@ 0x93 switchvideomode # Fn+F3 Toggle Video Output 0x95 brightnessdown # Fn+F4 Brightness Down 0x91 brightnessup # Fn+F5 Brightness Up -0xA5 f22 # Fn+F6 Disable Touchpad +0xA5 f23 # Fn+F6 Disable Touchpad 0xA6 f22 # Fn+F6 Enable Touchpad 0xA7 bluetooth # Fn+F10 Enable Bluetooth 0XA9 bluetooth # Fn+F10 Disable Bluetooth -- cgit v1.2.3-54-g00ecf From b8015eea2d0546deb363edc28aba813c1277d806 Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Wed, 10 Nov 2010 01:29:50 +0100 Subject: man: udev - workaraound -> workaround --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 682cc3f959..3ef4103325 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -309,7 +309,7 @@ The name, a network interface should be renamed to. Or as - a temporary workaraound, the name a device node should be named. + a temporary workaround, the name a device node should be named. Usually the kernel provides the defined node name, or even creates and removes the node before udev even receives any event. Changing the node name from the kernel's default creates inconsistencies -- cgit v1.2.3-54-g00ecf From 851dd4ddc5aeb1ee517145d9e3334c2017595321 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 12 Nov 2010 14:39:14 +0100 Subject: udev-rules.c: change import property buffer to 16384 bytes import_program_into_properties() should have the same line length as import_file_into_properties() see also https://bugzilla.redhat.com/show_bug.cgi?id=652318 --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 52f121c29a..ab7b6aedb9 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -751,7 +751,7 @@ static int import_program_into_properties(struct udev_device *dev, const char *p { struct udev *udev = udev_device_get_udev(dev); char **envp; - char result[4096]; + char result[UTIL_LINE_SIZE]; size_t reslen; char *line; -- cgit v1.2.3-54-g00ecf From d69207c3f20f0af2a5e510515ae5473f4fe54476 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Fri, 12 Nov 2010 15:44:34 +0100 Subject: 70-acl.rules: add ACLs for ID_PDA devices --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index c7134bc5bd..66375de9f6 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -47,6 +47,9 @@ SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="udev-acl" # smart-card readers ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" +# PDA devices +ENV{ID_PDA}=="*?", TAG+="udev-acl" + # joysticks SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" -- cgit v1.2.3-54-g00ecf From 0e6546c11f2ec1ed2c5af3f2cdb2a6b507952782 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 22 Nov 2010 10:49:12 +0100 Subject: Add ACL for media player USB devices Originally we added an ACL for some particular mobile phone product IDs to enable users to run e. g. the Android SDK as non-root. This was removed in 232f180 as we don't want to maintain product/vendor ID lists in udev. However, we already know from media-player-info that devices like this are media players. There is little reason to deny user access to those, so add back a generic rule which adds an ACL to media player raw USB devices. https://launchpad.net/bugs/316215 --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 66375de9f6..e3ff31c22e 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -59,6 +59,9 @@ ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="udev-acl" # DDC/CI device, usually high-end monitors such as the DreamColor ENV{DDC_DEVICE}=="*?", TAG+="udev-acl" +# media player raw devices (for user-mode drivers, Android SDK, etc.) +SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="udev-acl" + # apply ACL for all locally logged in users LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" -- cgit v1.2.3-54-g00ecf From 1a6ab670304dc8d8cdebc1d273076dc661dbafc5 Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Mon, 22 Nov 2010 13:55:20 +0100 Subject: udevd: create static nodes before /dev/null is needed --- udev/udevd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 21dde824ee..aa2e3657f0 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1098,6 +1098,10 @@ int main(int argc, char *argv[]) chdir("/"); umask(022); + /* create standard links, copy static nodes, create nodes from modules */ + static_dev_create(udev); + static_dev_create_from_modules(udev); + /* before opening new files, make sure std{in,out,err} fds are in a sane state */ fd = open("/dev/null", O_RDWR); if (fd < 0) { @@ -1264,8 +1268,6 @@ int main(int argc, char *argv[]) } info(udev, "set children_max to %u\n", children_max); - static_dev_create(udev); - static_dev_create_from_modules(udev); udev_rules_apply_static_dev_perms(rules); udev_list_init(&event_list); -- cgit v1.2.3-54-g00ecf From 01675fbbe867623e639fa94bce42a8b294fab5f8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 24 Nov 2010 12:00:31 +0100 Subject: rules: 78-sound-card - remove specific hardware matches, they do not belong here --- rules/rules.d/78-sound-card.rules | 7 ------- 1 file changed, 7 deletions(-) diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules index 0f0cf64d7c..7b821d4723 100644 --- a/rules/rules.d/78-sound-card.rules +++ b/rules/rules.d/78-sound-card.rules @@ -63,13 +63,6 @@ ATTR{pcmC%nD0p/pcm_class}=="modem", ENV{SOUND_CLASS}="modem", GOTO="sound_end" # Identify cards on the internal PCI bus as internal SUBSYSTEMS=="pci", DEVPATH=="*/0000:00:??.?/sound/*", ENV{SOUND_FORM_FACTOR}="internal", GOTO="sound_end" -# Recognize good old WinTV cards and those based on saa7134 as TV cards -SUBSYSTEMS=="pci", DRIVERS=="Bt87x", ENV{SOUND_FORM_FACTOR}="tv", GOTO="sound_end" -SUBSYSTEMS=="pci", DRIVERS=="saa7134", ENV{SOUND_FORM_FACTOR}="tv", GOTO="sound_end" - -# Hmm, do we really want this database here? -SUBSYSTEMS=="usb", ATTRS{idVendor}=="0471", ATTRS{idProduct}=="0311", ENV{SOUND_FORM_FACTOR}="webcam", GOTO="sound_end" - # Devices that also support Image/Video interfaces are most likely webcams SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACES}=="*:0e????:*", ENV{SOUND_FORM_FACTOR}="webcam", GOTO="sound_end" -- cgit v1.2.3-54-g00ecf From 2b15b26dfa13a4906abb728b8f4dc1bd80046042 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 24 Nov 2010 12:05:21 +0100 Subject: rules: drop OSS audio rule --- rules/rules.d/50-udev-default.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 160527988c..c4eb9276ad 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -42,7 +42,6 @@ SUBSYSTEM=="drm", GROUP="video" # sound SUBSYSTEM=="sound", GROUP="audio" -KERNEL=="mixer0", SYMLINK+="mixer" # DVB (video) SUBSYSTEM=="dvb", GROUP="video" -- cgit v1.2.3-54-g00ecf From 046d09f3221fc20fe92bb58805d6655ced79e060 Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Fri, 26 Nov 2010 14:08:28 +0100 Subject: keymap: Add release quirks for two Zepto Znote models and AMILO Xi 2428 Signed-off-by: Martin Pitt --- extras/keymap/95-keyboard-force-release.rules | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 6f7c0fddf5..84489f4d39 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -23,7 +23,7 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.s ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u|AMILO Xi 2428", RUN+="keyboard-force-release.sh $devpath common-volume-keys" ENV{DMI_VENDOR}=="FOXCONN", ATTR{[dmi/id]product_name}=="QBOOK", RUN+="keyboard-force-release.sh $devpath common-volume-keys" @@ -40,4 +40,8 @@ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keyboard-force-release.sh $devpath hp-other" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keyboard-force-release.sh $devpath hp-other" +ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote 6615WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="6625WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From 53c5ceff0880279014b7c417d73322f6a266c551 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Fri, 26 Nov 2010 15:31:42 +0100 Subject: Add ACLs for FFADO supported sound cards https://launchpad.net/bugs/681755 Signed-off-by: Martin Pitt --- extras/udev-acl/70-acl.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index e3ff31c22e..785b00f8ab 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -26,6 +26,8 @@ SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" SUBSYSTEM=="sound", TAG+="udev-acl" # sound jack-sense SUBSYSTEM=="input", SUBSYSTEMS=="sound", TAG+="udev-acl" +# ffado is an userspace driver for firewire sound cards +SUBSYSTEM=="firewire", ENV{ID_FFADO}=="1", TAG+="udev-acl" # webcams, frame grabber, TV cards SUBSYSTEM=="video4linux", TAG+="udev-acl" -- cgit v1.2.3-54-g00ecf From 5113029acbfd8c58ea3b86bb65e75de8a9db5434 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 29 Nov 2010 12:01:58 +0100 Subject: rules: drop alsa jack-plug input devices --- extras/udev-acl/70-acl.rules | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 785b00f8ab..0717d25d09 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -24,8 +24,7 @@ SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" # sound devices SUBSYSTEM=="sound", TAG+="udev-acl" -# sound jack-sense -SUBSYSTEM=="input", SUBSYSTEMS=="sound", TAG+="udev-acl" + # ffado is an userspace driver for firewire sound cards SUBSYSTEM=="firewire", ENV{ID_FFADO}=="1", TAG+="udev-acl" -- cgit v1.2.3-54-g00ecf From 310f99d33595afdc1962611a913c429785f9ad40 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 30 Nov 2010 11:48:08 +0100 Subject: rules: revert bsg use until the event ordering problem is sorted out The bsg devices node are created after the LUN, so we fail in the hotplug case, but succeed at coldplug, and create inconsistent data that way. The bsg device event order will need to be sorted out, by changing the kernel. --- rules/rules.d/60-persistent-storage.rules | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 8baabc2cf9..062049cd1d 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -6,18 +6,7 @@ # forward scsi device event to corresponding block device ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" -# from this point on, we don't care about remove envets -# ACTION=="remove", GOTO="persistent_storage_end" - -# run scsi_id and ata_id on the actual SCSI device -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", ATTR{vendor}=="ATA", IMPORT{program}="ata_id --export $root/bsg/$kernel" -# ATA/ATAPI devices is of type 0x05 and vendor is usually not ATA -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", ATTR{type}=="5", IMPORT{program}="ata_id --export $root/bsg/$kernel" -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export --device $root/bsg/$kernel" - -# from this point on, only care about block devices -# SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices @@ -33,9 +22,6 @@ ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" -# import ata_id/scsi_id data from the scsi_device captured above, if available -SUBSYSTEMS=="scsi", IMPORT{parent}="ID_*" - # USB devices use their own serial number KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" # ATA devices with their own "ata" kernel subsystem -- cgit v1.2.3-54-g00ecf From a2f8d214310b5b8d76169ce5a517afb3f74072c0 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 8 Dec 2010 16:21:02 +0100 Subject: keymap: Fix struck Touchpad key on Dell Latitude E series https://launchpad.net/bugs/686662 --- Makefile.am | 1 + extras/keymap/95-keyboard-force-release.rules | 2 +- extras/keymap/force-release-maps/dell-touchpad | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 extras/keymap/force-release-maps/dell-touchpad diff --git a/Makefile.am b/Makefile.am index 032eb287a6..891440cf73 100644 --- a/Makefile.am +++ b/Makefile.am @@ -601,6 +601,7 @@ dist_udevkeymap_DATA = \ udevkeymapforcereldir = $(libexecdir)/keymaps/force-release dist_udevkeymapforcerel_DATA = \ + extras/keymap/force-release-maps/dell-touchpad \ extras/keymap/force-release-maps/hp-other \ extras/keymap/force-release-maps/samsung-other \ extras/keymap/force-release-maps/common-volume-keys diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 84489f4d39..ff2d8fc998 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -18,10 +18,10 @@ DRIVER!="atkbd", GOTO="force_release_end" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" - ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.sh $devpath samsung-other" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*", RUN+="keyboard-force-release.sh $devpath dell-touchpad" ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u|AMILO Xi 2428", RUN+="keyboard-force-release.sh $devpath common-volume-keys" diff --git a/extras/keymap/force-release-maps/dell-touchpad b/extras/keymap/force-release-maps/dell-touchpad new file mode 100644 index 0000000000..18e9bdee66 --- /dev/null +++ b/extras/keymap/force-release-maps/dell-touchpad @@ -0,0 +1 @@ +0x9E -- cgit v1.2.3-54-g00ecf From 329239f506df62df931a063a752dbbb4da0ebb5c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 8 Dec 2010 18:41:42 +0100 Subject: keymap: Fix struck Touchpad key on Dell Precision M series https://launchpad.net/bugs/686662 --- extras/keymap/95-keyboard-force-release.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index ff2d8fc998..8d5f83a983 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -21,7 +21,7 @@ ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.sh $devpath samsung-other" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*", RUN+="keyboard-force-release.sh $devpath dell-touchpad" +ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*|Precision M*", RUN+="keyboard-force-release.sh $devpath dell-touchpad" ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u|AMILO Xi 2428", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -- cgit v1.2.3-54-g00ecf From 8ba13ec1cd00b86001b4344aec11ae0a64395f7b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 9 Dec 2010 21:08:19 +0100 Subject: libudev: do not overwrite path with readlink() call --- libudev/libudev-util.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index 030b78cd22..6c309afd05 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -26,15 +26,16 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) { char path[UTIL_PATH_SIZE]; + char target[UTIL_PATH_SIZE]; ssize_t len; const char *pos; util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL); - len = readlink(path, path, sizeof(path)); - if (len <= 0 || len == (ssize_t)sizeof(path)) + len = readlink(path, target, sizeof(target)); + if (len <= 0 || len == (ssize_t)sizeof(target)) return -1; - path[len] = '\0'; - pos = strrchr(path, '/'); + target[len] = '\0'; + pos = strrchr(target, '/'); if (pos == NULL) return -1; pos = &pos[1]; -- cgit v1.2.3-54-g00ecf From 88163971b93260474bf2dd3195dc4e72098584ba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 9 Dec 2010 21:10:30 +0100 Subject: udevadm: info - honor --export and --export-prefix for property query The output will always be quoted: $ udevadm info --export --export-prefix=MY_ --query=property --name=sda MY_UDEV_LOG='3' MY_DEVPATH='/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda' MY_MAJOR='259' MY_MINOR='0' MY_DEVNAME='sda' MY_DEVTYPE='disk' MY_SUBSYSTEM='block' --- udev/udevadm-info.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 9bd60c7243..b3b31ebafe 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -154,7 +154,7 @@ static void print_record(struct udev_device *device) printf("\n"); } -static int stat_device(const char *name, int export, const char *prefix) +static int stat_device(const char *name, bool export, const char *prefix) { struct stat statbuf; @@ -198,8 +198,8 @@ static int export_devices(struct udev *udev) int udevadm_info(struct udev *udev, int argc, char *argv[]) { struct udev_device *device = NULL; - int root = 0; - int export = 0; + bool root = 0; + bool export = 0; const char *export_prefix = NULL; char path[UTIL_PATH_SIZE]; char name[UTIL_PATH_SIZE]; @@ -324,7 +324,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case 'r': if (action == ACTION_NONE) action = ACTION_ROOT; - root = 1; + root = true; break; case 'd': action = ACTION_DEVICE_ID_FILE; @@ -337,7 +337,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) export_devices(udev); goto exit; case 'x': - export = 1; + export = true; break; case 'P': export_prefix = optarg; @@ -417,7 +417,17 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case QUERY_PROPERTY: list_entry = udev_device_get_properties_list_entry(device); while (list_entry != NULL) { - printf("%s=%s\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + if (export) { + const char *prefix = export_prefix; + + if (prefix == NULL) + prefix = ""; + printf("%s%s='%s'\n", prefix, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } else { + printf("%s=%s\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + } list_entry = udev_list_entry_get_next(list_entry); } break; -- cgit v1.2.3-54-g00ecf From dc1791a9e6b59bd070a5f9c01b2214a1f8d69a82 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 9 Dec 2010 22:45:13 +0100 Subject: udevadm: info - honor --export, --export-prefix= --- udev/udevadm.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 223140e7a7..cefd7763af 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -118,6 +118,18 @@ along the chain, up to the root of sysfs that can be used in udev rules. + + + + Print output as key/value pairs. Values are enclosed in single quotes. + + + + + + Add a prefix to the key name of exported values. + + -- cgit v1.2.3-54-g00ecf From 4281da1fa6fda10c15bee984825fc607a8385004 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 10 Dec 2010 01:13:35 +0100 Subject: udevd: use dev_t or netif ifindex as database key We need to preserve the database of network interfaces while we rename them. Use the kernel's numbers wherever possible, instead of the device names. Fix wrong database filenames which contain a '/', translated from '!' in the kernel name. Fix segfault for kobject pathes where the subsystem can not be determined from sysfs. --- Makefile.am | 2 +- libudev/libudev-device-private.c | 29 ++++++++++--------- libudev/libudev-device.c | 51 +++++++++++++++++++++++++++++++-- libudev/libudev-private.h | 1 + udev/udev-event.c | 3 ++ udev/udev-node.c | 6 ++-- udev/udev-watch.c | 6 +--- udev/udevadm-info.c | 61 ++++++++++++++++++++++++++++++++++++++++ udev/udevadm.xml | 9 ++++++ 9 files changed, 142 insertions(+), 26 deletions(-) diff --git a/Makefile.am b/Makefile.am index 891440cf73..9fe4a3ac51 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ DISTCHECK_HOOKS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=9 -LIBUDEV_REVISION=3 +LIBUDEV_REVISION=4 LIBUDEV_AGE=9 SUBDIRS += libudev/docs diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index a4b2fb0169..63f947e16b 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -24,23 +24,18 @@ static void udev_device_tag(struct udev_device *dev, const char *tag, bool add) { + const char *id; struct udev *udev = udev_device_get_udev(dev); char filename[UTIL_PATH_SIZE]; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", tag, "/", - udev_device_get_subsystem(dev), ":", udev_device_get_sysname(dev), NULL); + id = udev_device_get_id_filename(dev); + if (id == NULL) + return; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", tag, "/", id, NULL); if (add) { util_create_path(udev, filename); symlink(udev_device_get_devpath(dev), filename); - /* possibly cleanup old entries after a device renaming */ - if (udev_device_get_sysname_old(dev) != NULL) { - char filename_old[UTIL_PATH_SIZE]; - - util_strscpyl(filename_old, sizeof(filename_old), udev_get_dev_path(udev), "/.udev/tags/", tag, "/", - udev_device_get_subsystem(dev), ":", udev_device_get_sysname_old(dev), NULL); - unlink(filename_old); - } } else { unlink(filename); } @@ -79,6 +74,7 @@ int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, int udev_device_update_db(struct udev_device *udev_device) { + const char *id; struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; char filename_tmp[UTIL_PATH_SIZE]; @@ -90,8 +86,10 @@ int udev_device_update_db(struct udev_device *udev_device) struct udev_list_entry *list_entry; int ret; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", id, NULL); util_strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) @@ -169,11 +167,14 @@ out: int udev_device_delete_db(struct udev_device *udev_device) { + const char *id; struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", id, NULL); unlink(filename); return 0; } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 9b5d79ff4b..d87b0c6c8a 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -54,6 +54,7 @@ struct udev_device { char *devpath_old; char *sysname_old; char *knodename; + char *id_filename; char **envp; char *monitor_buf; size_t monitor_buf_len; @@ -230,6 +231,7 @@ const char *udev_device_get_property_value(struct udev_device *udev_device, cons int udev_device_read_db(struct udev_device *udev_device) { + const char *id; struct stat stats; char filename[UTIL_PATH_SIZE]; char line[UTIL_LINE_SIZE]; @@ -238,8 +240,10 @@ int udev_device_read_db(struct udev_device *udev_device) if (udev_device->db_loaded) return 0; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/.udev/db/", - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/.udev/db/", id, NULL); if (lstat(filename, &stats) != 0) { dbg(udev_device->udev, "no db file to read %s: %m\n", filename); @@ -799,6 +803,7 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->devpath_old); free(udev_device->sysname_old); free(udev_device->knodename); + free(udev_device->id_filename); free(udev_device->envp); free(udev_device->monitor_buf); dbg(udev_device->udev, "udev_device: %p released\n", udev_device); @@ -1287,6 +1292,40 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink return 0; } +const char *udev_device_get_id_filename(struct udev_device *udev_device) +{ + if (udev_device->id_filename == NULL) { + if (udev_device_get_subsystem(udev_device) == NULL) + return NULL; + + if (major(udev_device_get_devnum(udev_device)) > 0) { + /* use dev_t -- b259:131072, c254:0 */ + if (asprintf(&udev_device->id_filename, "%c%u:%u", + strcmp(udev_device_get_subsystem(udev_device), "block") == 0 ? 'b' : 'c', + major(udev_device_get_devnum(udev_device)), + minor(udev_device_get_devnum(udev_device))) < 0) + udev_device->id_filename = NULL; + } else if (strcmp(udev_device_get_subsystem(udev_device), "net") == 0) { + /* use netdev ifindex -- n3 */ + if (asprintf(&udev_device->id_filename, "n%u", udev_device_get_ifindex(udev_device)) < 0) + udev_device->id_filename = NULL; + } else { + /* + * use $subsys:$syname -- pci:0000:00:1f.2 + * sysname() has '!' translated, get it from devpath + */ + const char *sysname; + sysname = strrchr(udev_device->devpath, '/'); + if (sysname == NULL) + return NULL; + sysname = &sysname[1]; + if (asprintf(&udev_device->id_filename, "+%s:%s", udev_device_get_subsystem(udev_device), sysname) < 0) + udev_device->id_filename = NULL; + } + } + return udev_device->id_filename; +} + int udev_device_add_tag(struct udev_device *udev_device, const char *tag) { if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) @@ -1500,7 +1539,11 @@ int udev_device_get_event_timeout(struct udev_device *udev_device) int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout) { + char num[32]; + udev_device->event_timeout = event_timeout; + snprintf(num, sizeof(num), "%u", event_timeout); + udev_device_add_property(udev_device, "TIMEOUT", num); return 0; } @@ -1560,6 +1603,10 @@ int udev_device_get_ifindex(struct udev_device *udev_device) int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) { + char num[32]; + udev_device->ifindex = ifindex; + snprintf(num, sizeof(num), "%u", ifindex); + udev_device_add_property(udev_device, "IFINDEX", num); return 0; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index c9ed46211c..d09a9a52a8 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -85,6 +85,7 @@ const char *udev_device_get_devpath_old(struct udev_device *udev_device); const char *udev_device_get_sysname_old(struct udev_device *udev_device); int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); const char *udev_device_get_knodename(struct udev_device *udev_device); +const char *udev_device_get_id_filename(struct udev_device *udev_device); int udev_device_add_tag(struct udev_device *udev_device, const char *tag); void udev_device_cleanup_tags_list(struct udev_device *udev_device); int udev_device_has_tag(struct udev_device *udev_device, const char *tag); diff --git a/udev/udev-event.c b/udev/udev-event.c index 064873531b..f41f06b16a 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -535,6 +535,9 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) struct udev_device *dev = event->dev; int err = 0; + if (udev_device_get_subsystem(dev) == NULL) + return -1; + if (strcmp(udev_device_get_action(dev), "remove") == 0) { udev_device_read_db(dev); udev_device_delete_db(dev); diff --git a/udev/udev-node.c b/udev/udev-node.c index c8113f10b0..92634427f9 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -298,10 +298,8 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); - snprintf(dirname, sizeof(dirname), "%s/.udev/links/%s", udev_get_dev_path(udev), name_enc); - snprintf(filename, sizeof(filename), "%s/%c%u:%u", dirname, - strcmp(udev_device_get_subsystem(dev), "block") == 0 ? 'b' : 'c', - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + util_strscpyl(dirname, sizeof(dirname), udev_get_dev_path(udev), "/.udev/links/", name_enc, NULL); + util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); if (!add) { dbg(udev, "removing index: '%s'\n", filename); diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 5fa60101c4..9e1b8d8553 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -109,7 +109,6 @@ unlink: void udev_watch_begin(struct udev *udev, struct udev_device *dev) { char filename[UTIL_PATH_SIZE]; - char majmin[UTIL_PATH_SIZE]; int wd; if (inotify_fd < 0) @@ -123,13 +122,10 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) return; } - snprintf(majmin, sizeof(majmin), "%c%i:%i", - strcmp(udev_device_get_subsystem(dev), "block") == 0 ? 'b' : 'c', - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); util_create_path(udev, filename); unlink(filename); - symlink(majmin, filename); + symlink(udev_device_get_id_filename(dev), filename); udev_device_set_watch_handle(dev, wd); } diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index b3b31ebafe..7206f4fcf6 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -195,6 +195,60 @@ static int export_devices(struct udev *udev) return 0; } +static int convert_db(struct udev *udev) +{ + struct udev_enumerate *udev_enumerate; + struct udev_list_entry *list_entry; + + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_devices(udev_enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + if (device != NULL) { + const char *id; + struct stat statbuf; + char to[UTIL_PATH_SIZE]; + char devpath[UTIL_PATH_SIZE]; + char from[UTIL_PATH_SIZE]; + + id = udev_device_get_id_filename(device); + if (id == NULL) + goto next; + util_strscpyl(to, sizeof(to), udev_get_dev_path(udev), "/.udev/db/", id, NULL); + + /* do not overwrite a new database file */ + if (lstat(to, &statbuf) == 0) + goto next; + + /* find old database with $subsys:$sysname */ + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), + "/.udev/db/", udev_device_get_subsystem(device), ":", + udev_device_get_sysname(device), NULL); + if (lstat(from, &statbuf) == 0) { + rename(from, to); + goto next; + } + + /* find old database with the encoded devpath */ + util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), + "/.udev/db/", devpath, NULL); + if (lstat(from, &statbuf) == 0) { + rename(from, to); + goto next; + } +next: + udev_device_unref(device); + } + } + udev_enumerate_unref(udev_enumerate); + return 0; +} + int udevadm_info(struct udev *udev, int argc, char *argv[]) { struct udev_device *device = NULL; @@ -212,6 +266,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) { "query", required_argument, NULL, 'q' }, { "attribute-walk", no_argument, NULL, 'a' }, { "export-db", no_argument, NULL, 'e' }, + { "convert-db", no_argument, NULL, 'C' }, { "root", no_argument, NULL, 'r' }, { "device-id-of-file", required_argument, NULL, 'd' }, { "export", no_argument, NULL, 'x' }, @@ -336,6 +391,9 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case 'e': export_devices(udev); goto exit; + case 'C': + convert_db(udev); + goto exit; case 'x': export = true; break; @@ -359,7 +417,10 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) " --attribute-walk print all key matches while walking along the chain\n" " of parent devices\n" " --device-id-of-file= print major:minor of device containing this file\n" + " --export export key/value pairs\n" + " --export-prefix export the key name with a prefix\n" " --export-db export the content of the udev database\n" + " --convert-db convert older version of database without a reboot\n" " --help\n\n"); goto exit; default: diff --git a/udev/udevadm.xml b/udev/udevadm.xml index cefd7763af..00f299fb73 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -143,6 +143,15 @@ Export the content of the udev database. + + + + Convert the database of an earlier udev version to the current format. This + is only useful on udev version upgrades, where the content of the old database might + be needed for the running system, and it is not sufficient for it, to be re-created + with the next bootup. + + -- cgit v1.2.3-54-g00ecf From 2713e6ab0abfc47a54ccbae26be22471aef46b24 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 10 Dec 2010 13:27:03 +0100 Subject: udevd: always create /dev/{char,block}/$major:$minor --- rules/rules.d/50-udev-default.rules | 3 --- udev/udev-node.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index c4eb9276ad..cd745effe0 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -1,8 +1,5 @@ # do not edit this file, it will be overwritten on update -SUBSYSTEM=="block", SYMLINK{unique}+="block/%M:%m" -SUBSYSTEM!="block", SYMLINK{unique}+="char/%M:%m" - KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" KERNEL=="ptmx", GROUP="tty", MODE="0666" diff --git a/udev/udev-node.c b/udev/udev-node.c index 92634427f9..70488c420b 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -369,6 +369,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); + char filename[UTIL_PATH_SIZE]; struct udev_list_entry *list_entry; int err = 0; @@ -382,6 +383,13 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) goto exit; } + /* always add /dev/{block,char}/$major:$minor */ + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(udev), + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + node_symlink(udev, udev_device_get_devnode(dev), filename); + /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { if (udev_list_entry_get_flags(list_entry)) @@ -401,6 +409,7 @@ int udev_node_remove(struct udev_device *dev) const char *devnode; struct stat stats; struct udev_device *dev_check; + char filename[UTIL_PATH_SIZE]; int err = 0; /* remove/update symlinks, remove symlinks from name index */ @@ -434,6 +443,13 @@ int udev_node_remove(struct udev_device *dev) err = util_unlink_secure(udev, devnode); if (err == 0) util_delete_path(udev, devnode); + + /* remove /dev/{block,char}/$major:$minor */ + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(udev), + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + unlink(filename); out: return err; } -- cgit v1.2.3-54-g00ecf From 24d1076696ebe6696a8b8df414ab265aa6fc89c2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 11 Dec 2010 14:00:46 +0100 Subject: udevd: simplify udev database and fix DEVNAME handling --- libudev/libudev-device-private.c | 119 +++++++++++++++++---------------------- libudev/libudev-device.c | 68 +++++----------------- udev/udev-node.c | 2 +- udev/udevadm-info.c | 34 ++++++----- 4 files changed, 87 insertions(+), 136 deletions(-) diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 63f947e16b..bf93834c10 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -72,96 +72,83 @@ int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, return 0; } +static bool device_has_info(struct udev_device *udev_device) +{ + struct udev_list_entry *list_entry; + + if (udev_device_get_devlinks_list_entry(udev_device) != NULL) + return true; + if (udev_device_get_devlink_priority(udev_device) != 0) + return true; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) + if (udev_list_entry_get_flags(list_entry)) + return true; + if (udev_device_get_tags_list_entry(udev_device) != NULL) + return true; + if (udev_device_get_watch_handle(udev_device) >= 0) + return true; + return false; +} + int udev_device_update_db(struct udev_device *udev_device) { + bool has_info; const char *id; struct udev *udev = udev_device_get_udev(udev_device); char filename[UTIL_PATH_SIZE]; char filename_tmp[UTIL_PATH_SIZE]; FILE *f; - char target[232]; /* on 64bit, tmpfs inlines up to 239 bytes */ size_t devlen = strlen(udev_get_dev_path(udev))+1; - char *s; - size_t l; - struct udev_list_entry *list_entry; - int ret; id = udev_device_get_id_filename(udev_device); if (id == NULL) return -1; + + has_info = device_has_info(udev_device); util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", id, NULL); - util_strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL); - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_flags(list_entry)) - goto file; - if (udev_device_get_tags_list_entry(udev_device) != NULL) - goto file; - if (udev_device_get_devlink_priority(udev_device) != 0) - goto file; - if (udev_device_get_event_timeout(udev_device) >= 0) - goto file; - if (udev_device_get_watch_handle(udev_device) >= 0) - goto file; - if (udev_device_get_devnode(udev_device) == NULL) - goto out; - - /* - * if we have only the node and symlinks to store, try not to waste - * tmpfs memory -- store values, if they fit, in a symlink target - */ - s = target; - l = util_strpcpy(&s, sizeof(target), &udev_device_get_devnode(udev_device)[devlen]); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) { - l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); - if (l == 0) { - info(udev, "size of links too large, create file\n"); - goto file; - } + /* do not store anything for otherwise empty devices */ + if (!has_info && udev_device_get_devnode(udev_device) == NULL) { + unlink(filename); + return 0; } - udev_selinux_setfscreatecon(udev, filename_tmp, S_IFLNK); - util_create_path(udev, filename_tmp); - ret = symlink(target, filename_tmp); - udev_selinux_resetfscreatecon(udev); - if (ret != 0) - goto file; - ret = rename(filename_tmp, filename); - if (ret != 0) - goto file; - info(udev, "created db link (%s)\n", target); - goto out; -file: + + /* write a database file */ + util_strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL); util_create_path(udev, filename_tmp); - f = fopen(filename_tmp, "w"); + f = fopen(filename_tmp, "we"); if (f == NULL) { err(udev, "unable to create temporary db file '%s': %m\n", filename_tmp); return -1; } - if (udev_device_get_devnode(udev_device) != NULL) { - fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) - fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); - } - if (udev_device_get_devlink_priority(udev_device) != 0) - fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); - if (udev_device_get_event_timeout(udev_device) >= 0) - fprintf(f, "T:%i\n", udev_device_get_event_timeout(udev_device)); - if (udev_device_get_watch_handle(udev_device) >= 0) - fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - if (!udev_list_entry_get_flags(list_entry)) - continue; - fprintf(f, "E:%s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); + if (has_info) { + struct udev_list_entry *list_entry; + + if (udev_device_get_devnode(udev_device) != NULL) { + fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) + fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + } + if (udev_device_get_devlink_priority(udev_device) != 0) + fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); + if (udev_device_get_watch_handle(udev_device) >= 0) + fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + if (!udev_list_entry_get_flags(list_entry)) + continue; + fprintf(f, "E:%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + fprintf(f, "G:%s\n", udev_list_entry_get_name(list_entry)); } - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) - fprintf(f, "G:%s\n", udev_list_entry_get_name(list_entry)); + fclose(f); rename(filename_tmp, filename); - info(udev, "created db file for '%s' in '%s'\n", udev_device_get_devpath(udev_device), filename); -out: + info(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty", + filename, udev_device_get_devpath(udev_device)); return 0; } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index d87b0c6c8a..ac206a0e16 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -232,70 +232,28 @@ const char *udev_device_get_property_value(struct udev_device *udev_device, cons int udev_device_read_db(struct udev_device *udev_device) { const char *id; - struct stat stats; char filename[UTIL_PATH_SIZE]; char line[UTIL_LINE_SIZE]; FILE *f; if (udev_device->db_loaded) return 0; + udev_device->db_loaded = true; id = udev_device_get_id_filename(udev_device); if (id == NULL) return -1; util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/.udev/db/", id, NULL); - - if (lstat(filename, &stats) != 0) { - dbg(udev_device->udev, "no db file to read %s: %m\n", filename); - return -1; - } - if ((stats.st_mode & S_IFMT) == S_IFLNK) { - char target[UTIL_PATH_SIZE]; - char devnode[UTIL_PATH_SIZE]; - int target_len; - char *next; - - target_len = readlink(filename, target, sizeof(target)); - if (target_len <= 0 || target_len == sizeof(target)) { - info(udev_device->udev, "error reading db link %s: %m\n", filename); - return -1; - } - target[target_len] = '\0'; - - next = strchr(target, ' '); - if (next != NULL) { - next[0] = '\0'; - next = &next[1]; - } - util_strscpyl(devnode, sizeof(devnode), udev_get_dev_path(udev_device->udev), "/", target, NULL); - udev_device_set_devnode(udev_device, devnode); - while (next != NULL) { - char devlink[UTIL_PATH_SIZE]; - const char *lnk; - - lnk = next; - next = strchr(next, ' '); - if (next != NULL) { - next[0] = '\0'; - next = &next[1]; - } - util_strscpyl(devlink, sizeof(devlink), udev_get_dev_path(udev_device->udev), "/", lnk, NULL); - udev_device_add_devlink(udev_device, devlink, 0); - } - info(udev_device->udev, "device %p filled with db symlink data '%s'\n", udev_device, udev_device->devnode); - return 0; - } - f = fopen(filename, "re"); if (f == NULL) { - dbg(udev_device->udev, "error reading db file %s: %m\n", filename); + info(udev_device->udev, "no db file to read %s: %m\n", filename); return -1; } - udev_device->db_loaded = true; while (fgets(line, sizeof(line), f)) { ssize_t len; const char *val; + struct udev_list_entry *entry; len = strlen(line); if (len < 4) @@ -314,11 +272,9 @@ int udev_device_read_db(struct udev_device *udev_device) case 'L': udev_device_set_devlink_priority(udev_device, atoi(val)); break; - case 'T': - udev_device_set_event_timeout(udev_device, atoi(val)); - break; case 'E': - udev_device_add_property_from_string(udev_device, val); + entry = udev_device_add_property_from_string(udev_device, val); + udev_list_entry_set_flags(entry, 1); break; case 'G': udev_device_add_tag(udev_device, val); @@ -888,9 +844,11 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) /* we might get called before we handled an event and have a db, use the kernel-provided name */ if (udev_device->devnode == NULL && udev_device_get_knodename(udev_device) != NULL) { - if (asprintf(&udev_device->devnode, "%s/%s", - udev_get_dev_path(udev_device->udev), udev_device_get_knodename(udev_device)) < 0) - return NULL; + char filename[UTIL_NAME_SIZE]; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", + udev_device_get_knodename(udev_device), NULL); + udev_device_set_devnode(udev_device, filename); return udev_device->devnode; } @@ -1271,8 +1229,6 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode { free(udev_device->devnode); udev_device->devnode = strdup(devnode); - if (devnode == NULL) - return 0; if (udev_device->devnode == NULL) return -ENOMEM; udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); @@ -1516,7 +1472,9 @@ int udev_device_set_knodename(struct udev_device *udev_device, const char *knode udev_device->knodename = strdup(knodename); if (udev_device->knodename == NULL) return -ENOMEM; - udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename); + /* do not overwrite the udev property with the kernel property */ + if (udev_device->devnode == NULL) + udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename); return 0; } diff --git a/udev/udev-node.c b/udev/udev-node.c index 70488c420b..a9ffa988b1 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -327,7 +327,7 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) err = util_create_path(udev, filename); if (err != 0 && err != -ENOENT) break; - fd = open(filename, O_WRONLY|O_CREAT|O_NOFOLLOW, 0444); + fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); if (fd >= 0) close(fd); else diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 7206f4fcf6..4510f4aa90 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -210,38 +210,44 @@ static int convert_db(struct udev *udev) device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); if (device != NULL) { const char *id; - struct stat statbuf; + struct stat stats; char to[UTIL_PATH_SIZE]; char devpath[UTIL_PATH_SIZE]; char from[UTIL_PATH_SIZE]; id = udev_device_get_id_filename(device); - if (id == NULL) - goto next; + if (id == NULL) { + udev_device_unref(device); + continue; + } util_strscpyl(to, sizeof(to), udev_get_dev_path(udev), "/.udev/db/", id, NULL); - /* do not overwrite a new database file */ - if (lstat(to, &statbuf) == 0) - goto next; - /* find old database with $subsys:$sysname */ util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", udev_device_get_subsystem(device), ":", udev_device_get_sysname(device), NULL); - if (lstat(from, &statbuf) == 0) { - rename(from, to); - goto next; + if (lstat(from, &stats) == 0) { + if (lstat(to, &stats) == 0) + unlink(from); + else + rename(from, to); } /* find old database with the encoded devpath */ util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", devpath, NULL); - if (lstat(from, &statbuf) == 0) { - rename(from, to); - goto next; + if (lstat(from, &stats) == 0) { + if (lstat(to, &stats) == 0) + unlink(from); + else + rename(from, to); } -next: + + /* read the old database, and write out a new one */ + udev_device_read_db(device); + udev_device_update_db(device); + udev_device_unref(device); } } -- cgit v1.2.3-54-g00ecf From cad40a5fe75d876af22f68b688494b9cd98cc899 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 12 Dec 2010 20:07:15 +0100 Subject: udevd: switch to common id_filename functions --- libudev/libudev-device-private.c | 6 +++++- libudev/libudev-device.c | 26 ++++++++++++++++++++++++++ libudev/libudev-enumerate.c | 13 +------------ libudev/libudev-private.h | 1 + udev/udev-node.c | 14 ++++---------- udev/udev-watch.c | 14 ++------------ 6 files changed, 39 insertions(+), 35 deletions(-) diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index bf93834c10..430e3e64d4 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -34,8 +34,12 @@ static void udev_device_tag(struct udev_device *dev, const char *tag, bool add) util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", tag, "/", id, NULL); if (add) { + int fd; + util_create_path(udev, filename); - symlink(udev_device_get_devpath(dev), filename); + fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); + if (fd >= 0) + close(fd); } else { unlink(filename); } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index ac206a0e16..8698d98e1c 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -475,6 +475,32 @@ struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, de return udev_device_new_from_syspath(udev, path); } +struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id) +{ + char type; + int maj, min; + char subsys[UTIL_PATH_SIZE]; + char *sysname; + + switch(id[0]) { + case 'b': + case 'c': + if (sscanf(id, "%c%i:%i", &type, &maj, &min) != 3) + return NULL; + return udev_device_new_from_devnum(udev, type, makedev(maj, min)); + case '+': + util_strscpy(subsys, sizeof(subsys), &id[1]); + sysname = strchr(subsys, ':'); + if (sysname == NULL) + return NULL; + sysname[0] = '\0'; + sysname = &sysname[1]; + return udev_device_new_from_subsystem_sysname(udev, subsys, sysname); + default: + return NULL; + } +} + /** * udev_device_new_from_subsystem_sysname: * @udev: udev library context diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index f13e56f2f7..363d445f90 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -714,22 +714,11 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) continue; for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { struct udev_device *dev; - char syspath[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; if (dent->d_name[0] == '.') continue; - s = syspath; - l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev), NULL); - len = readlinkat(dirfd(dir), dent->d_name, s, l); - if (len <= 0 || (size_t)len == l) - continue; - s[len] = '\0'; - - dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); if (dev == NULL) continue; syspath_add(udev_enumerate, udev_device_get_syspath(dev)); diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index d09a9a52a8..2b638ce06e 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -66,6 +66,7 @@ struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); /* libudev-device.c */ struct udev_device *udev_device_new(struct udev *udev); +struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id); int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype); diff --git a/udev/udev-node.c b/udev/udev-node.c index a9ffa988b1..0ceb1d5110 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -243,26 +243,20 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons for (;;) { struct udev_device *dev_db; struct dirent *dent; - int maj, min; - char type, type2; - dev_t devnum; dent = readdir(dir); if (dent == NULL || dent->d_name[0] == '\0') break; if (dent->d_name[0] == '.') continue; - if (sscanf(dent->d_name, "%c%i:%i", &type, &maj, &min) != 3) - continue; - info(udev, "found '%c%i:%i' claiming '%s'\n", type, maj, min, stackdir); - devnum = makedev(maj, min); + + info(udev, "found '%s' claiming '%s'\n", dent->d_name, stackdir); /* did we find ourself? */ - type2 = strcmp(udev_device_get_subsystem(dev), "block") == 0 ? 'b' : 'c'; - if (udev_device_get_devnum(dev) == devnum && type == type2) + if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0) continue; - dev_db = udev_device_new_from_devnum(udev, type, devnum); + dev_db = udev_device_new_from_id_filename(udev, dent->d_name); if (dev_db != NULL) { const char *devnode; diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 9e1b8d8553..f51a10dcab 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -72,8 +72,6 @@ void udev_watch_restore(struct udev *udev) size_t l; ssize_t len; struct udev_device *dev; - int maj, min; - char type; if (ent->d_name[0] == '.') continue; @@ -85,9 +83,7 @@ void udev_watch_restore(struct udev *udev) goto unlink; s[len] = '\0'; - if (sscanf(s, "%c%i:%i", &type, &maj, &min) != 3) - goto unlink; - dev = udev_device_new_from_devnum(udev, type, makedev(maj, min)); + dev = udev_device_new_from_id_filename(udev, s); if (dev == NULL) goto unlink; @@ -158,9 +154,6 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd) char *s; size_t l; ssize_t len; - int maj, min; - char type; - dev_t devnum; if (inotify_fd < 0 || wd < 0) return NULL; @@ -173,8 +166,5 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd) return NULL; s[len] = '\0'; - if (sscanf(s, "%c%i:%i", &type, &maj, &min) != 3) - return NULL; - devnum = makedev(maj, min); - return udev_device_new_from_devnum(udev, type, devnum); + return udev_device_new_from_id_filename(udev, s); } -- cgit v1.2.3-54-g00ecf From 14996e80d4b002dbbef9721b936fe29155375fb1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Dec 2010 02:30:36 +0100 Subject: udevd: write full database file for (unsupported) renamed device nodes --- libudev/libudev-device-private.c | 5 ++++- .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent | 1 + .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 430e3e64d4..406d8704f5 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -89,6 +89,9 @@ static bool device_has_info(struct udev_device *udev_device) return true; if (udev_device_get_tags_list_entry(udev_device) != NULL) return true; + if (udev_device_get_knodename(udev_device) != NULL) + if (strcmp(udev_device_get_devnode(udev_device), udev_device_get_knodename(udev_device)) != 0) + return true; if (udev_device_get_watch_handle(udev_device) >= 0) return true; return false; @@ -102,7 +105,6 @@ int udev_device_update_db(struct udev_device *udev_device) char filename[UTIL_PATH_SIZE]; char filename_tmp[UTIL_PATH_SIZE]; FILE *f; - size_t devlen = strlen(udev_get_dev_path(udev))+1; id = udev_device_get_id_filename(udev_device); if (id == NULL) @@ -127,6 +129,7 @@ int udev_device_update_db(struct udev_device *udev_device) } if (has_info) { + size_t devlen = strlen(udev_get_dev_path(udev))+1; struct udev_list_entry *list_entry; if (udev_device_get_devnode(udev_device) != NULL) { diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent index d3e19784f7..c70ff22ad4 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent @@ -1,3 +1,4 @@ MAJOR=8 MINOR=1 DEVTYPE=partition +DEVNAME=sda1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent index c3945d4e0a..af0df2f298 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent @@ -1,3 +1,4 @@ MAJOR=8 MINOR=0 DEVTYPE=disk +DEVNAME=sda -- cgit v1.2.3-54-g00ecf From ff0e1f4e5d897a0ddbf365e920c0e28a6657abaa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Dec 2010 11:27:02 +0100 Subject: check ifindex > 0 instead of subsystem == "net" --- libudev/libudev-device.c | 4 +++- udev/udev-event.c | 2 +- udev/udev-rules.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 8698d98e1c..8b0cccd533 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1287,7 +1287,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device) major(udev_device_get_devnum(udev_device)), minor(udev_device_get_devnum(udev_device))) < 0) udev_device->id_filename = NULL; - } else if (strcmp(udev_device_get_subsystem(udev_device), "net") == 0) { + } else if (udev_device_get_ifindex(udev_device) > 0) { /* use netdev ifindex -- n3 */ if (asprintf(&udev_device->id_filename, "n%u", udev_device_get_ifindex(udev_device)) < 0) udev_device->id_filename = NULL; @@ -1582,6 +1582,8 @@ int udev_device_set_watch_handle(struct udev_device *udev_device, int handle) int udev_device_get_ifindex(struct udev_device *udev_device) { + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); return udev_device->ifindex; } diff --git a/udev/udev-event.c b/udev/udev-event.c index f41f06b16a..02a1767b1f 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -564,7 +564,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) udev_rules_apply_to_event(rules, event); /* rename a new network interface, if needed */ - if (strcmp(udev_device_get_subsystem(dev), "net") == 0 && strcmp(udev_device_get_action(dev), "add") == 0 && + if (udev_device_get_ifindex(dev) > 0 && strcmp(udev_device_get_action(dev), "add") == 0 && event->name != NULL && strcmp(event->name, udev_device_get_sysname(dev)) != 0) { char syspath[UTIL_PATH_SIZE]; char *pos; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index ab7b6aedb9..6b473c4c2e 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2080,7 +2080,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event can_set_name = ((strcmp(udev_device_get_action(event->dev), "remove") != 0) && (major(udev_device_get_devnum(event->dev)) > 0 || - strcmp(udev_device_get_subsystem(event->dev), "net") == 0)); + udev_device_get_ifindex(event->dev) > 0)); /* loop through token list, match, run actions or forward to next rule */ cur = &rules->tokens[0]; -- cgit v1.2.3-54-g00ecf From 48a0170b111b55e961be769d2cc4890511bcd991 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Dec 2010 14:18:32 +0100 Subject: libudev: enumerate - allow to filter-out not-already-initialized devices --- Makefile.am | 6 +++--- libudev/docs/libudev-sections.txt | 2 ++ libudev/exported_symbols | 2 ++ libudev/libudev-device-private.c | 4 +++- libudev/libudev-device.c | 27 +++++++++++++++++++++++++ libudev/libudev-enumerate.c | 42 +++++++++++++++++++++++++++++++++++++++ libudev/libudev-private.h | 1 + libudev/libudev.h | 2 ++ libudev/test-libudev.c | 1 + udev/udev-event.c | 9 ++++----- 10 files changed, 87 insertions(+), 9 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9fe4a3ac51..2e0edd0b14 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,9 +34,9 @@ DISTCHECK_HOOKS = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=9 -LIBUDEV_REVISION=4 -LIBUDEV_AGE=9 +LIBUDEV_CURRENT=10 +LIBUDEV_REVISION=0 +LIBUDEV_AGE=10 SUBDIRS += libudev/docs diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 63c0ee2e98..05647768fb 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -45,6 +45,7 @@ udev_device_get_syspath udev_device_get_sysname udev_device_get_sysnum udev_device_get_devnode +udev_device_get_is_initialized udev_device_get_devlinks_list_entry udev_device_get_properties_list_entry udev_device_get_tags_list_entry @@ -89,6 +90,7 @@ udev_enumerate_add_match_sysattr udev_enumerate_add_nomatch_sysattr udev_enumerate_add_match_property udev_enumerate_add_match_tag +udev_enumerate_add_match_is_initialized udev_enumerate_add_match_sysname udev_enumerate_add_syspath udev_enumerate_scan_devices diff --git a/libudev/exported_symbols b/libudev/exported_symbols index 935e361db5..9e77fb1be1 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -28,6 +28,7 @@ udev_device_get_sysname udev_device_get_sysnum udev_device_get_subsystem udev_device_get_devtype +udev_device_get_is_initialized udev_device_get_devlinks_list_entry udev_device_get_properties_list_entry udev_device_get_tags_list_entry @@ -48,6 +49,7 @@ udev_enumerate_add_match_sysattr udev_enumerate_add_nomatch_sysattr udev_enumerate_add_match_property udev_enumerate_add_match_tag +udev_enumerate_add_match_is_initialized udev_enumerate_add_match_sysname udev_enumerate_scan_devices udev_enumerate_scan_subsystems diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 406d8704f5..d1df45ee74 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -114,7 +114,9 @@ int udev_device_update_db(struct udev_device *udev_device) util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", id, NULL); /* do not store anything for otherwise empty devices */ - if (!has_info && udev_device_get_devnode(udev_device) == NULL) { + if (!has_info && + major(udev_device_get_devnum(udev_device)) == 0 && + udev_device_get_ifindex(udev_device) == 0) { unlink(filename); return 0; } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 8b0cccd533..66f806316f 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -81,6 +81,7 @@ struct udev_device { bool info_loaded; bool db_loaded; bool uevent_loaded; + bool is_initialized; }; struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) @@ -249,6 +250,7 @@ int udev_device_read_db(struct udev_device *udev_device) info(udev_device->udev, "no db file to read %s: %m\n", filename); return -1; } + udev_device->is_initialized = true; while (fgets(line, sizeof(line), f)) { ssize_t len; @@ -1308,6 +1310,31 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device) return udev_device->id_filename; } +/** + * udev_device_get_is_initialized: + * @udev_device: udev device + * + * Check if udev has already handled the device and has set up + * device node permissions and context, or has renamed a network + * device. + * + * For now, this is only implemented for devices with a device node + * or network interfaces. All other devices return 1 here. + * + * Returns: 1 if the device is set up. 0 otherwise. + **/ +int udev_device_get_is_initialized(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_db(udev_device); + return udev_device->is_initialized; +} + +void udev_device_set_is_initialized(struct udev_device *udev_device) +{ + udev_device->is_initialized = true; +} + int udev_device_add_tag(struct udev_device *udev_device, const char *tag) { if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 363d445f90..e46bc087fa 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -57,6 +57,7 @@ struct udev_enumerate { unsigned int devices_cur; unsigned int devices_max; bool devices_uptodate:1; + bool match_is_initialized; }; /** @@ -456,6 +457,32 @@ int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const ch return 0; } +/** + * udev_enumerate_add_match_is_initialized: + * @udev_enumerate: context + * + * Match only devices which udev has set up already. This makes + * sure, that the device node permissions and context are properly set + * and that network devices are fully renamed. + * + * Usually, devices which are found in the kernel but not already + * handled by udev, have still pending events. Services should subscribe + * to monitor events and wait for these devices to become ready, instead + * of using uninitialized devices. + * + * For now, this will not affect devices which do not have a device node + * and are not network interfaces. + * + * Returns: 0 on success, otherwise a negative error value. + */ +int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return -EINVAL; + udev_enumerate->match_is_initialized = true; + return 0; +} + /** * udev_enumerate_add_match_sysname: * @udev_enumerate: context @@ -601,6 +628,21 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, if (dev == NULL) continue; + if (udev_enumerate->match_is_initialized) { + /* + * All devices with a device node or network interfaces + * possibly need udev to adjust the device node permission + * or context, or rename the interface before it can be + * reliably used from other processes. + * + * For now, we can only check these types of devices, we + * might not store a database, and have no way to find out + * for all other types of devices. + */ + if (!udev_device_get_is_initialized(dev) && + (major(udev_device_get_devnum(dev)) > 0 || udev_device_get_ifindex(dev) > 0)) + goto nomatch; + } if (!match_tag(udev_enumerate, dev)) goto nomatch; if (!match_property(udev_enumerate, dev)) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 2b638ce06e..f7b4f90519 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -87,6 +87,7 @@ const char *udev_device_get_sysname_old(struct udev_device *udev_device); int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); const char *udev_device_get_knodename(struct udev_device *udev_device); const char *udev_device_get_id_filename(struct udev_device *udev_device); +void udev_device_set_is_initialized(struct udev_device *udev_device); int udev_device_add_tag(struct udev_device *udev_device, const char *tag); void udev_device_cleanup_tags_list(struct udev_device *udev_device); int udev_device_has_tag(struct udev_device *udev_device, const char *tag); diff --git a/libudev/libudev.h b/libudev/libudev.h index 5bc42df5be..087991caf4 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -88,6 +88,7 @@ const char *udev_device_get_syspath(struct udev_device *udev_device); const char *udev_device_get_sysname(struct udev_device *udev_device); const char *udev_device_get_sysnum(struct udev_device *udev_device); const char *udev_device_get_devnode(struct udev_device *udev_device); +int udev_device_get_is_initialized(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device); @@ -141,6 +142,7 @@ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, co int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname); int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag); +int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate); int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); /* run enumeration with active filters */ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index 3eb34494df..f8eb8e5d5a 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -354,6 +354,7 @@ static int test_enumerate(struct udev *udev, const char *subsystem) if (udev_enumerate == NULL) return -1; udev_enumerate_add_match_subsystem(udev_enumerate,"block"); + udev_enumerate_add_match_is_initialized(udev_enumerate); udev_enumerate_scan_devices(udev_enumerate); test_enumerate_print_list(udev_enumerate); udev_enumerate_unref(udev_enumerate); diff --git a/udev/udev-event.c b/udev/udev-event.c index 02a1767b1f..4d38c5b893 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -631,12 +631,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) /* set device node name */ util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", event->name, NULL); udev_device_set_devnode(dev, filename); - } - - udev_device_update_db(dev); - udev_device_tag_index(dev, event->dev_db, true); - if (major(udev_device_get_devnum(dev)) != 0) { /* remove/update possible left-over symlinks from old database entry */ if (event->dev_db != NULL) udev_node_update_old_links(dev, event->dev_db); @@ -648,6 +643,10 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) err = udev_node_add(dev, event->mode, event->uid, event->gid); } + udev_device_update_db(dev); + udev_device_tag_index(dev, event->dev_db, true); + udev_device_set_is_initialized(dev); + udev_device_unref(event->dev_db); event->dev_db = NULL; } -- cgit v1.2.3-54-g00ecf From 0976fd063e1e488e388ec922fcd4dbed5b8da938 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 14 Dec 2010 12:37:40 -0500 Subject: Add GUdevEnumerator type and Device.get_tags() method Also add JS example to check the added API works. Signed-off-by: David Zeuthen --- Makefile.am | 9 +- extras/gudev/docs/Makefile.am | 2 +- extras/gudev/docs/gudev-docs.xml | 9 + extras/gudev/docs/gudev-sections.txt | 26 +++ extras/gudev/docs/gudev.types | 1 + extras/gudev/gudev.h | 1 + extras/gudev/gudevclient.c | 16 +- extras/gudev/gudevdevice.c | 36 +++ extras/gudev/gudevdevice.h | 1 + extras/gudev/gudevenumerator.c | 431 +++++++++++++++++++++++++++++++++++ extras/gudev/gudevenumerator.h | 108 +++++++++ extras/gudev/gudevprivate.h | 2 + extras/gudev/gudevtypes.h | 1 + extras/gudev/seed-example-enum.js | 36 +++ 14 files changed, 671 insertions(+), 8 deletions(-) create mode 100644 extras/gudev/gudevenumerator.c create mode 100644 extras/gudev/gudevenumerator.h create mode 100755 extras/gudev/seed-example-enum.js diff --git a/Makefile.am b/Makefile.am index 2e0edd0b14..601246a9c9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -334,7 +334,8 @@ libgudev_include_HEADERS = \ extras/gudev/gudevenumtypes.h \ extras/gudev/gudevtypes.h \ extras/gudev/gudevclient.h \ - extras/gudev/gudevdevice.h + extras/gudev/gudevdevice.h \ + extras/gudev/gudevenumerator.h lib_LTLIBRARIES += extras/gudev/libgudev-1.0.la pkgconfig_DATA += extras/gudev/gudev-1.0.pc @@ -348,6 +349,8 @@ extras_gudev_libgudev_1_0_la_SOURCES = \ extras/gudev/gudevclient.c \ extras/gudev/gudevdevice.h \ extras/gudev/gudevdevice.c \ + extras/gudev/gudevenumerator.h \ + extras/gudev/gudevenumerator.c \ extras/gudev/gudevprivate.h dist_extras_gudev_libgudev_1_0_la_SOURCES = \ @@ -418,8 +421,10 @@ extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefil $(or $(wildcard $(top_builddir)/extras/gudev/gudevenumtypes.h),$(top_srcdir)/extras/gudev/gudevenumtypes.h) \ $(top_srcdir)/extras/gudev/gudevclient.h \ $(top_srcdir)/extras/gudev/gudevdevice.h \ + $(top_srcdir)/extras/gudev/gudevenumerator.h \ $(top_srcdir)/extras/gudev/gudevclient.c \ - $(top_srcdir)/extras/gudev/gudevdevice.c + $(top_srcdir)/extras/gudev/gudevdevice.c \ + $(top_srcdir)/extras/gudev/gudevenumerator.c extras/gudev/GUdev-1.0.typelib: extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) $(AM_V_GEN)g-ir-compiler $< -o $@ diff --git a/extras/gudev/docs/Makefile.am b/extras/gudev/docs/Makefile.am index 3da6fc7196..5507434d5f 100644 --- a/extras/gudev/docs/Makefile.am +++ b/extras/gudev/docs/Makefile.am @@ -32,7 +32,7 @@ SCAN_OPTIONS= # Extra options to supply to gtkdoc-mkdb. # e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml -MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=g_udev # Extra options to supply to gtkdoc-mktmpl # e.g. MKTMPL_OPTIONS=--only-section-tmpl diff --git a/extras/gudev/docs/gudev-docs.xml b/extras/gudev/docs/gudev-docs.xml index bb5f560402..fefae409d2 100644 --- a/extras/gudev/docs/gudev-docs.xml +++ b/extras/gudev/docs/gudev-docs.xml @@ -75,6 +75,7 @@ + @@ -84,5 +85,13 @@ Index + + Index of deprecated symbols + + + + Index of new symbols in 165 + + diff --git a/extras/gudev/docs/gudev-sections.txt b/extras/gudev/docs/gudev-sections.txt index faa6a8d79d..15f1bb8d04 100644 --- a/extras/gudev/docs/gudev-sections.txt +++ b/extras/gudev/docs/gudev-sections.txt @@ -40,6 +40,7 @@ g_udev_device_get_device_file g_udev_device_get_device_file_symlinks g_udev_device_get_parent g_udev_device_get_parent_with_subsystem +g_udev_device_get_tags g_udev_device_get_property_keys g_udev_device_has_property g_udev_device_get_property @@ -64,3 +65,28 @@ G_UDEV_IS_DEVICE_CLASS G_UDEV_DEVICE_GET_CLASS
            +
            +gudevenumerator +GUdevEnumerator +GUdevEnumerator +GUdevEnumeratorClass +g_udev_enumerator_new +g_udev_enumerator_add_match_subsystem +g_udev_enumerator_add_nomatch_subsystem +g_udev_enumerator_add_match_sysfs_attr +g_udev_enumerator_add_nomatch_sysfs_attr +g_udev_enumerator_add_match_property +g_udev_enumerator_add_match_name +g_udev_enumerator_add_match_tag +g_udev_enumerator_add_match_is_initialized +g_udev_enumerator_add_sysfs_path +g_udev_enumerator_execute + +G_UDEV_ENUMERATOR +G_UDEV_IS_ENUMERATOR +G_UDEV_TYPE_ENUMERATOR +g_udev_enumerator_get_type +G_UDEV_ENUMERATOR_CLASS +G_UDEV_IS_ENUMERATOR_CLASS +G_UDEV_ENUMERATOR_GET_CLASS +
            diff --git a/extras/gudev/docs/gudev.types b/extras/gudev/docs/gudev.types index be090b1481..a89857a04d 100644 --- a/extras/gudev/docs/gudev.types +++ b/extras/gudev/docs/gudev.types @@ -1,3 +1,4 @@ g_udev_device_type_get_type g_udev_device_get_type g_udev_client_get_type +g_udev_enumerator_get_type diff --git a/extras/gudev/gudev.h b/extras/gudev/gudev.h index c3167f238c..a313460817 100644 --- a/extras/gudev/gudev.h +++ b/extras/gudev/gudev.h @@ -27,6 +27,7 @@ #include #include #include +#include #undef _GUDEV_INSIDE_GUDEV_H #endif /* __G_UDEV_H__ */ diff --git a/extras/gudev/gudevclient.c b/extras/gudev/gudevclient.c index 9ebd8f8d8f..853454b6f0 100644 --- a/extras/gudev/gudevclient.c +++ b/extras/gudev/gudevclient.c @@ -47,12 +47,13 @@ * memory) and as such there are no asynchronous versions of the * provided methods. * - * To get information about a device, use + * To get #GUdevDevice objects, use * g_udev_client_query_by_subsystem(), * g_udev_client_query_by_device_number(), * g_udev_client_query_by_device_file(), - * g_udev_client_query_by_sysfs_path() or - * g_udev_client_query_by_subsystem_and_name(). + * g_udev_client_query_by_sysfs_path(), + * g_udev_client_query_by_subsystem_and_name() + * or the #GUdevEnumerator type. * * To listen to uevents, connect to the #GUdevClient::uevent signal. */ @@ -459,8 +460,6 @@ g_udev_client_query_by_device_file (GUdevClient *client, * @sysfs_path: A sysfs path. * * Looks up a device for a sysfs path. - * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_sysfs_path (GUdevClient *client, @@ -518,3 +517,10 @@ g_udev_client_query_by_subsystem_and_name (GUdevClient *client, return device; } +struct udev * +_g_udev_client_get_udev (GUdevClient *client) +{ + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + return client->priv->udev; +} + diff --git a/extras/gudev/gudevdevice.c b/extras/gudev/gudevdevice.c index 76f2d7e5f8..4c41849bb1 100644 --- a/extras/gudev/gudevdevice.c +++ b/extras/gudev/gudevdevice.c @@ -86,6 +86,7 @@ struct _GUdevDevicePrivate /* computed ondemand and cached */ gchar **device_file_symlinks; gchar **property_keys; + gchar **tags; GHashTable *prop_strvs; GHashTable *sysfs_attr_strvs; }; @@ -99,6 +100,7 @@ g_udev_device_finalize (GObject *object) g_strfreev (device->priv->device_file_symlinks); g_strfreev (device->priv->property_keys); + g_strfreev (device->priv->tags); if (device->priv->udevice != NULL) udev_device_unref (device->priv->udevice); @@ -889,3 +891,37 @@ g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, out: return (const gchar* const *) result; } + +/** + * g_udev_device_get_tags: + * @device: A #GUdevDevice. + * + * Gets all tags for @device. + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of tags. This array is owned by @device and should not be freed by the caller. + * + * Since: 165 + */ +const gchar* const * +g_udev_device_get_tags (GUdevDevice *device) +{ + struct udev_list_entry *l; + GPtrArray *p; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + if (device->priv->tags != NULL) + goto out; + + p = g_ptr_array_new (); + for (l = udev_device_get_tags_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) + { + g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); + } + g_ptr_array_add (p, NULL); + device->priv->tags = (gchar **) g_ptr_array_free (p, FALSE); + + out: + return (const gchar * const *) device->priv->tags; +} + diff --git a/extras/gudev/gudevdevice.h b/extras/gudev/gudevdevice.h index 0ed3cf5364..ffd064d8ab 100644 --- a/extras/gudev/gudevdevice.h +++ b/extras/gudev/gudevdevice.h @@ -120,6 +120,7 @@ gboolean g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *devic const gchar *name); const gchar* const *g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, const gchar *name); +const gchar* const *g_udev_device_get_tags (GUdevDevice *device); G_END_DECLS diff --git a/extras/gudev/gudevenumerator.c b/extras/gudev/gudevenumerator.c new file mode 100644 index 0000000000..db09074625 --- /dev/null +++ b/extras/gudev/gudevenumerator.c @@ -0,0 +1,431 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008-2010 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "gudevclient.h" +#include "gudevenumerator.h" +#include "gudevdevice.h" +#include "gudevmarshal.h" +#include "gudevprivate.h" + +/** + * SECTION:gudevenumerator + * @short_description: Lookup and sort devices + * + * #GUdevEnumerator is used to lookup and sort devices. + * + * Since: 165 + */ + +struct _GUdevEnumeratorPrivate +{ + GUdevClient *client; + struct udev_enumerate *e; +}; + +enum +{ + PROP_0, + PROP_CLIENT, +}; + +G_DEFINE_TYPE (GUdevEnumerator, g_udev_enumerator, G_TYPE_OBJECT) + +/* ---------------------------------------------------------------------------------------------------- */ + +static void +g_udev_enumerator_finalize (GObject *object) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + if (enumerator->priv->client != NULL) + { + g_object_unref (enumerator->priv->client); + enumerator->priv->client = NULL; + } + + if (enumerator->priv->e != NULL) + { + udev_enumerate_unref (enumerator->priv->e); + enumerator->priv->e = NULL; + } + + if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize != NULL) + G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize (object); +} + +static void +g_udev_enumerator_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + switch (prop_id) + { + case PROP_CLIENT: + if (enumerator->priv->client != NULL) + g_object_unref (enumerator->priv->client); + enumerator->priv->client = g_value_dup_object (value); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_enumerator_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + switch (prop_id) + { + case PROP_CLIENT: + g_value_set_object (value, enumerator->priv->client); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_enumerator_constructed (GObject *object) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + g_assert (G_UDEV_IS_CLIENT (enumerator->priv->client)); + + enumerator->priv->e = udev_enumerate_new (_g_udev_client_get_udev (enumerator->priv->client)); + + if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed != NULL) + G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed (object); +} + +static void +g_udev_enumerator_class_init (GUdevEnumeratorClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->finalize = g_udev_enumerator_finalize; + gobject_class->set_property = g_udev_enumerator_set_property; + gobject_class->get_property = g_udev_enumerator_get_property; + gobject_class->constructed = g_udev_enumerator_constructed; + + /** + * GUdevEnumerator:client: + * + * The #GUdevClient to enumerate devices from. + * + * Since: 165 + */ + g_object_class_install_property (gobject_class, + PROP_CLIENT, + g_param_spec_object ("client", + "The client to enumerate devices from", + "The client to enumerate devices from", + G_UDEV_TYPE_CLIENT, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE)); + + g_type_class_add_private (klass, sizeof (GUdevEnumeratorPrivate)); +} + +static void +g_udev_enumerator_init (GUdevEnumerator *enumerator) +{ + enumerator->priv = G_TYPE_INSTANCE_GET_PRIVATE (enumerator, + G_UDEV_TYPE_ENUMERATOR, + GUdevEnumeratorPrivate); +} + +/** + * g_udev_enumerator_new: + * @client: A #GUdevClient to enumerate devices from. + * + * Constructs a #GUdevEnumerator object that can be used to enumerate + * and sort devices. Use the add_match_*() and add_nomatch_*() methods + * and execute the query to get a list of devices with + * g_udev_enumerator_execute(). + * + * Returns: A new #GUdevEnumerator object. Free with g_object_unref(). + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_new (GUdevClient *client) +{ + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + return G_UDEV_ENUMERATOR (g_object_new (G_UDEV_TYPE_ENUMERATOR, "client", client, NULL)); +} + + +/** + * g_udev_enumerator_add_match_subsystem: + * @enumerator: A #GUdevEnumerator. + * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. + * + * All returned devices will match the given @subsystem. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + udev_enumerate_add_match_subsystem (enumerator->priv->e, subsystem); + return enumerator; +} + +/** + * g_udev_enumerator_add_nomatch_subsystem: + * @enumerator: A #GUdevEnumerator. + * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. + * + * All returned devices will not match the given @subsystem. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + udev_enumerate_add_nomatch_subsystem (enumerator->priv->e, subsystem); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_sysfs_attr: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for sysfs attribute key. + * @value: Wildcard filter for sysfs attribute value. + * + * All returned devices will have a sysfs attribute matching the given @name and @value. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (value != NULL, NULL); + udev_enumerate_add_match_sysattr (enumerator->priv->e, name, value); + return enumerator; +} + +/** + * g_udev_enumerator_add_nomatch_sysfs_attr: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for sysfs attribute key. + * @value: Wildcard filter for sysfs attribute value. + * + * All returned devices will not have a sysfs attribute matching the given @name and @value. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (value != NULL, NULL); + udev_enumerate_add_nomatch_sysattr (enumerator->priv->e, name, value); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_property: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for property name. + * @value: Wildcard filter for property value. + * + * All returned devices will have a property matching the given @name and @value. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (value != NULL, NULL); + udev_enumerate_add_match_property (enumerator->priv->e, name, value); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_name: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for kernel name e.g. "sda*". + * + * All returned devices will match the given @name. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, + const gchar *name) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + udev_enumerate_add_match_sysname (enumerator->priv->e, name); + return enumerator; +} + +/** + * g_udev_enumerator_add_sysfs_path: + * @enumerator: A #GUdevEnumerator. + * @sysfs_path: A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda" + * + * Add a device to the list of devices, to retrieve it back sorted in dependency order. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, + const gchar *sysfs_path) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (sysfs_path != NULL, NULL); + udev_enumerate_add_syspath (enumerator->priv->e, sysfs_path); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_tag: + * @enumerator: A #GUdevEnumerator. + * @tag: A udev tag e.g. "udev-acl". + * + * All returned devices will match the given @tag. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, + const gchar *tag) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (tag != NULL, NULL); + udev_enumerate_add_match_tag (enumerator->priv->e, tag); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_is_initialized: + * @enumerator: A #GUdevEnumerator. + * + * All returned devices will be initialized. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + udev_enumerate_add_match_is_initialized (enumerator->priv->e); + return enumerator; +} + +/** + * g_udev_enumerator_execute: + * @enumerator: A #GUdevEnumerator. + * + * Executes the query in @enumerator. + * + * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. + * + * Since: 165 + */ +GList * +g_udev_enumerator_execute (GUdevEnumerator *enumerator) +{ + GList *ret; + struct udev_list_entry *l, *devices; + + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + + ret = NULL; + + /* retrieve the list */ + udev_enumerate_scan_devices (enumerator->priv->e); + + devices = udev_enumerate_get_list_entry (enumerator->priv->e); + for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) + { + struct udev_device *udevice; + GUdevDevice *device; + + udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerator->priv->e), + udev_list_entry_get_name (l)); + if (udevice == NULL) + continue; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + ret = g_list_prepend (ret, device); + } + + ret = g_list_reverse (ret); + + return ret; +} diff --git a/extras/gudev/gudevenumerator.h b/extras/gudev/gudevenumerator.h new file mode 100644 index 0000000000..ed54dbfc66 --- /dev/null +++ b/extras/gudev/gudevenumerator.h @@ -0,0 +1,108 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008-2010 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_ENUMERATOR_H__ +#define __G_UDEV_ENUMERATOR_H__ + +#include + +G_BEGIN_DECLS + +#define G_UDEV_TYPE_ENUMERATOR (g_udev_enumerator_get_type ()) +#define G_UDEV_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumerator)) +#define G_UDEV_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) +#define G_UDEV_IS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_ENUMERATOR)) +#define G_UDEV_IS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_ENUMERATOR)) +#define G_UDEV_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) + +typedef struct _GUdevEnumeratorClass GUdevEnumeratorClass; +typedef struct _GUdevEnumeratorPrivate GUdevEnumeratorPrivate; + +/** + * GUdevEnumerator: + * @parent: Parent instance. + * + * The #GUdevEnumerator struct is opaque and should not be accessed directly. + * + * Since: 165 + */ +struct _GUdevEnumerator +{ + GObject parent; + + /*< private >*/ + GUdevEnumeratorPrivate *priv; +}; + +/** + * GUdevEnumeratorClass: + * @parent_class: Parent class. + * + * Class structure for #GUdevEnumerator. + * + * Since: 165 + */ +struct _GUdevEnumeratorClass +{ + GObjectClass parent_class; + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); + void (*reserved7) (void); + void (*reserved8) (void); +}; + +GType g_udev_enumerator_get_type (void) G_GNUC_CONST; +GUdevEnumerator *g_udev_enumerator_new (GUdevClient *client); +GUdevEnumerator *g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem); +GUdevEnumerator *g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem); +GUdevEnumerator *g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value); +GUdevEnumerator *g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value); +GUdevEnumerator *g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value); +GUdevEnumerator *g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, + const gchar *name); +GUdevEnumerator *g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, + const gchar *tag); +GUdevEnumerator *g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator); +GUdevEnumerator *g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, + const gchar *sysfs_path); +GList *g_udev_enumerator_execute (GUdevEnumerator *enumerator); + +G_END_DECLS + +#endif /* __G_UDEV_ENUMERATOR_H__ */ diff --git a/extras/gudev/gudevprivate.h b/extras/gudev/gudevprivate.h index 4fd498797a..8866f52b88 100644 --- a/extras/gudev/gudevprivate.h +++ b/extras/gudev/gudevprivate.h @@ -34,6 +34,8 @@ G_BEGIN_DECLS GUdevDevice * _g_udev_device_new (struct udev_device *udevice); +struct udev *_g_udev_client_get_udev (GUdevClient *client); + G_END_DECLS #endif /* __G_UDEV_PRIVATE_H__ */ diff --git a/extras/gudev/gudevtypes.h b/extras/gudev/gudevtypes.h index b95cf97529..888482783d 100644 --- a/extras/gudev/gudevtypes.h +++ b/extras/gudev/gudevtypes.h @@ -32,6 +32,7 @@ G_BEGIN_DECLS typedef struct _GUdevClient GUdevClient; typedef struct _GUdevDevice GUdevDevice; +typedef struct _GUdevEnumerator GUdevEnumerator; /** * GUdevDeviceNumber: diff --git a/extras/gudev/seed-example-enum.js b/extras/gudev/seed-example-enum.js new file mode 100755 index 0000000000..2aa80362ea --- /dev/null +++ b/extras/gudev/seed-example-enum.js @@ -0,0 +1,36 @@ +#!/usr/bin/env seed + +const GLib = imports.gi.GLib; +const GUdev = imports.gi.GUdev; + +function print_device(device) { + print(" subsystem: " + device.get_subsystem()); + print(" devtype: " + device.get_devtype()); + print(" name: " + device.get_name()); + print(" number: " + device.get_number()); + print(" sysfs_path: " + device.get_sysfs_path()); + print(" driver: " + device.get_driver()); + print(" action: " + device.get_action()); + print(" seqnum: " + device.get_seqnum()); + print(" device type: " + device.get_device_type()); + print(" device number: " + device.get_device_number()); + print(" device file: " + device.get_device_file()); + print(" device file symlinks: " + device.get_device_file_symlinks()); + print(" tags: " + device.get_tags()); + var keys = device.get_property_keys(); + for (var n = 0; n < keys.length; n++) { + print(" " + keys[n] + "=" + device.get_property(keys[n])); + } +} + +var client = new GUdev.Client({subsystems: []}); +var enumerator = new GUdev.Enumerator({client: client}); +enumerator.add_match_subsystem('b*') + +var devices = enumerator.execute(); + +for (var n=0; n < devices.length; n++) { + var device = devices[n]; + print_device(device); + print(""); +} -- cgit v1.2.3-54-g00ecf From ab17a7ef55b2c3278839302cf3ba5d214d2b2b7d Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 14 Dec 2010 12:50:04 -0500 Subject: Add g_udev_device_get_is_initialized() method Also nuke the "Index of deprecated symbols" since we have no deprecated symbols just yet. Signed-off-by: David Zeuthen --- extras/gudev/docs/gudev-docs.xml | 4 ---- extras/gudev/docs/gudev-sections.txt | 1 + extras/gudev/gudevdevice.c | 16 ++++++++++++++++ extras/gudev/gudevdevice.h | 1 + extras/gudev/seed-example-enum.js | 1 + 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/extras/gudev/docs/gudev-docs.xml b/extras/gudev/docs/gudev-docs.xml index fefae409d2..3a93b21720 100644 --- a/extras/gudev/docs/gudev-docs.xml +++ b/extras/gudev/docs/gudev-docs.xml @@ -85,10 +85,6 @@ Index - - Index of deprecated symbols - - Index of new symbols in 165 diff --git a/extras/gudev/docs/gudev-sections.txt b/extras/gudev/docs/gudev-sections.txt index 15f1bb8d04..4119ae4920 100644 --- a/extras/gudev/docs/gudev-sections.txt +++ b/extras/gudev/docs/gudev-sections.txt @@ -41,6 +41,7 @@ g_udev_device_get_device_file_symlinks g_udev_device_get_parent g_udev_device_get_parent_with_subsystem g_udev_device_get_tags +g_udev_device_get_is_initialized g_udev_device_get_property_keys g_udev_device_has_property g_udev_device_get_property diff --git a/extras/gudev/gudevdevice.c b/extras/gudev/gudevdevice.c index 4c41849bb1..8909178e4b 100644 --- a/extras/gudev/gudevdevice.c +++ b/extras/gudev/gudevdevice.c @@ -925,3 +925,19 @@ g_udev_device_get_tags (GUdevDevice *device) return (const gchar * const *) device->priv->tags; } +/** + * g_udev_device_get_is_initialized: + * @device: A #GUdevDevice. + * + * Gets whether @device has been initalized. + * + * Returns: Whether @device has been initialized. + * + * Since: 165 + */ +gboolean +g_udev_device_get_is_initialized (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + return udev_device_get_is_initialized (device->priv->udevice); +} diff --git a/extras/gudev/gudevdevice.h b/extras/gudev/gudevdevice.h index ffd064d8ab..1ca2b48a04 100644 --- a/extras/gudev/gudevdevice.h +++ b/extras/gudev/gudevdevice.h @@ -76,6 +76,7 @@ struct _GUdevDeviceClass }; GType g_udev_device_get_type (void) G_GNUC_CONST; +gboolean g_udev_device_get_is_initialized (GUdevDevice *device); const gchar *g_udev_device_get_subsystem (GUdevDevice *device); const gchar *g_udev_device_get_devtype (GUdevDevice *device); const gchar *g_udev_device_get_name (GUdevDevice *device); diff --git a/extras/gudev/seed-example-enum.js b/extras/gudev/seed-example-enum.js index 2aa80362ea..32200a42f9 100755 --- a/extras/gudev/seed-example-enum.js +++ b/extras/gudev/seed-example-enum.js @@ -4,6 +4,7 @@ const GLib = imports.gi.GLib; const GUdev = imports.gi.GUdev; function print_device(device) { + print(" initialized: " + device.get_is_initialized()); print(" subsystem: " + device.get_subsystem()); print(" devtype: " + device.get_devtype()); print(" name: " + device.get_name()); -- cgit v1.2.3-54-g00ecf From 93a724d3f8afc4b6fe5c7c9642c79df724324ed3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Dec 2010 21:26:12 +0100 Subject: libudev: fix renamed device nodes detection logic --- libudev/libudev-device-private.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index d1df45ee74..36824a7478 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -78,6 +78,7 @@ int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, static bool device_has_info(struct udev_device *udev_device) { + struct udev *udev = udev_device_get_udev(udev_device); struct udev_list_entry *list_entry; if (udev_device_get_devlinks_list_entry(udev_device) != NULL) @@ -89,9 +90,12 @@ static bool device_has_info(struct udev_device *udev_device) return true; if (udev_device_get_tags_list_entry(udev_device) != NULL) return true; - if (udev_device_get_knodename(udev_device) != NULL) - if (strcmp(udev_device_get_devnode(udev_device), udev_device_get_knodename(udev_device)) != 0) + if (udev_device_get_devnode(udev_device) != NULL && udev_device_get_knodename(udev_device) != NULL) { + size_t devlen = strlen(udev_get_dev_path(udev))+1; + + if (strcmp(&udev_device_get_devnode(udev_device)[devlen], udev_device_get_knodename(udev_device)) != 0) return true; + } if (udev_device_get_watch_handle(udev_device) >= 0) return true; return false; -- cgit v1.2.3-54-g00ecf From 9c6a11b1c6c68dabfd28b72d361da0e1930c7321 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Dec 2010 08:57:46 +0100 Subject: libudev: record and export "age" of device record --- configure.ac | 2 ++ libudev/docs/libudev-sections.txt | 1 + libudev/exported_symbols | 1 + libudev/libudev-device-private.c | 2 ++ libudev/libudev-device.c | 44 ++++++++++++++++++++++++++++++++++++++- libudev/libudev-private.h | 3 +++ libudev/libudev-util.c | 13 ++++++++++++ libudev/libudev.h | 1 + libudev/libudev.pc.in | 2 +- udev/udev-event.c | 7 +++++++ 10 files changed, 74 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index e82b9b8e99..7fda8bba47 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,8 @@ GTK_DOC_CHECK(1.10) AC_PREFIX_DEFAULT([/usr]) AC_PATH_PROG([XSLTPROC], [xsltproc]) +AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not found])]) + AC_ARG_WITH([rootlibdir], AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), [], [with_rootlibdir=$libdir]) diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 05647768fb..7db9c1bba9 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -55,6 +55,7 @@ udev_device_get_devnum udev_device_get_action udev_device_get_sysattr_value udev_device_get_seqnum +udev_device_get_usec_since_initialized
            diff --git a/libudev/exported_symbols b/libudev/exported_symbols index 9e77fb1be1..2e6a9b7dc0 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -37,6 +37,7 @@ udev_device_get_action udev_device_get_driver udev_device_get_devnum udev_device_get_seqnum +udev_device_get_usec_since_initialized udev_device_get_sysattr_value udev_enumerate_new udev_enumerate_ref diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 36824a7478..3afa82e04f 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -147,6 +147,8 @@ int udev_device_update_db(struct udev_device *udev_device) fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); if (udev_device_get_watch_handle(udev_device) >= 0) fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); + if (udev_device_get_usec_initialized(udev_device) > 0) + fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device)); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { if (!udev_list_entry_get_flags(list_entry)) continue; diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 66f806316f..16bee19dff 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -63,6 +63,7 @@ struct udev_device { struct udev_list_node sysattr_list; struct udev_list_node tags_list; unsigned long long int seqnum; + unsigned long long int usec_initialized; int event_timeout; int timeout; int devlink_priority; @@ -284,6 +285,9 @@ int udev_device_read_db(struct udev_device *udev_device) case 'W': udev_device_set_watch_handle(udev_device, atoi(val)); break; + case 'I': + udev_device_set_usec_initialized(udev_device, strtoull(val, NULL, 10)); + break; } } fclose(f); @@ -1094,6 +1098,44 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) return udev_device->seqnum; } +/** + * udev_device_get_usec_since_initialized: + * @udev_device: udev device + * + * Return the number of microseconds passed since udev set up the + * device for the first time. + * + * This is only implemented for devices with need to store properties + * in the udev database. All other devices return 0 here. + * + * Returns: the number of microseconds since the device was first seen. + **/ +unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device) +{ + unsigned long long now; + + if (udev_device == NULL) + return 0; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device); + if (udev_device->usec_initialized == 0) + return 0; + now = usec_monotonic(); + if (now == 0) + return 0; + return now - udev_device->usec_initialized; +} + +unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device) +{ + return udev_device->usec_initialized; +} + +void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized) +{ + udev_device->usec_initialized = usec_initialized; +} + /** * udev_device_get_sysattr_value: * @udev_device: udev device @@ -1318,7 +1360,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device) * device node permissions and context, or has renamed a network * device. * - * For now, this is only implemented for devices with a device node + * This is only implemented for devices with a device node * or network interfaces. All other devices return 1 here. * * Returns: 1 if the device is set up. 0 otherwise. diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index f7b4f90519..f95be53df7 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -98,6 +98,8 @@ int udev_device_get_event_timeout(struct udev_device *udev_device); int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout); int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); +unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device); +void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized); int udev_device_get_devlink_priority(struct udev_device *udev_device); int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); int udev_device_get_watch_handle(struct udev_device *udev_device); @@ -224,6 +226,7 @@ int util_run_program(struct udev *udev, const char *command, char **envp, const sigset_t *sigmask, bool reset_prio); int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); +unsigned long long usec_monotonic(void); /* libudev-selinux-private.c */ #ifndef WITH_SELINUX diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index 6c309afd05..51dd017467 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include "libudev.h" @@ -553,3 +554,15 @@ uint64_t util_string_bloom64(const char *str) bits |= 1LLU << ((hash >> 18) & 63); return bits; } + +#define USEC_PER_SEC 1000000ULL +#define NSEC_PER_USEC 1000ULL +unsigned long long usec_monotonic(void) +{ + struct timespec ts; + + if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) + return 0; + return (unsigned long long) ts.tv_sec * USEC_PER_SEC + + (unsigned long long) ts.tv_nsec / NSEC_PER_USEC; +} diff --git a/libudev/libudev.h b/libudev/libudev.h index 087991caf4..0abd7c8b0e 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -97,6 +97,7 @@ const char *udev_device_get_driver(struct udev_device *udev_device); dev_t udev_device_get_devnum(struct udev_device *udev_device); const char *udev_device_get_action(struct udev_device *udev_device); unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); +unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device); const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); /* diff --git a/libudev/libudev.pc.in b/libudev/libudev.pc.in index 677d53a97e..f75794ceb8 100644 --- a/libudev/libudev.pc.in +++ b/libudev/libudev.pc.in @@ -6,6 +6,6 @@ includedir=@prefix@/include Name: libudev Description: Library to access udev device information Version: @VERSION@ -Libs: -L${libdir} -ludev +Libs: -L${libdir} -ludev -lrt Libs.private: Cflags: -I${includedir} diff --git a/udev/udev-event.c b/udev/udev-event.c index 4d38c5b893..100a79c1e8 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -643,6 +643,13 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) err = udev_node_add(dev, event->mode, event->uid, event->gid); } + /* preserve old, or get new initialization timestamp */ + if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0) + udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db)); + else + udev_device_set_usec_initialized(event->dev, usec_monotonic()); + + /* (re)write database file */ udev_device_update_db(dev); udev_device_tag_index(dev, event->dev_db, true); udev_device_set_is_initialized(dev); -- cgit v1.2.3-54-g00ecf From 2363d33e10f1c0bf5d1240355d0bb2d90bae88e6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 15 Dec 2010 09:06:05 +0100 Subject: gudev: bump minor version --- Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 601246a9c9..0ee691c753 100644 --- a/Makefile.am +++ b/Makefile.am @@ -321,9 +321,9 @@ dist_udevrules_DATA += \ # ------------------------------------------------------------------------------ # GUdev - libudev gobject interface # ------------------------------------------------------------------------------ -LIBGUDEV_CURRENT=0 -LIBGUDEV_REVISION=1 -LIBGUDEV_AGE=0 +LIBGUDEV_CURRENT=1 +LIBGUDEV_REVISION=0 +LIBGUDEV_AGE=1 SUBDIRS += extras/gudev/docs -- cgit v1.2.3-54-g00ecf From d4c2307cc28aa7c887dcb5b0052469425e5af881 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 15 Dec 2010 10:46:34 -0500 Subject: gudev: Add Device.get_usec_since_initialized Signed-off-by: David Zeuthen --- extras/gudev/docs/gudev-sections.txt | 1 + extras/gudev/gudevdevice.c | 21 +++++++++++++++++++++ extras/gudev/gudevdevice.h | 1 + extras/gudev/seed-example-enum.js | 29 +++++++++++++++-------------- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/extras/gudev/docs/gudev-sections.txt b/extras/gudev/docs/gudev-sections.txt index 4119ae4920..181870fb5a 100644 --- a/extras/gudev/docs/gudev-sections.txt +++ b/extras/gudev/docs/gudev-sections.txt @@ -42,6 +42,7 @@ g_udev_device_get_parent g_udev_device_get_parent_with_subsystem g_udev_device_get_tags g_udev_device_get_is_initialized +g_udev_device_get_usec_since_initialized g_udev_device_get_property_keys g_udev_device_has_property g_udev_device_get_property diff --git a/extras/gudev/gudevdevice.c b/extras/gudev/gudevdevice.c index 8909178e4b..6f30d12d07 100644 --- a/extras/gudev/gudevdevice.c +++ b/extras/gudev/gudevdevice.c @@ -941,3 +941,24 @@ g_udev_device_get_is_initialized (GUdevDevice *device) g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); return udev_device_get_is_initialized (device->priv->udevice); } + +/** + * g_udev_device_get_usec_since_initialized: + * @device: A #GUdevDevice. + * + * Gets number of micro-seconds since @device was initialized. + * + * This only works for devices with properties in the udev + * database. All other devices return 0. + * + * Returns: Number of micro-seconds since @device was initialized or 0 if unknown. + * + * Since: 165 + */ +guint64 +g_udev_device_get_usec_since_initialized (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_usec_since_initialized (device->priv->udevice); +} + diff --git a/extras/gudev/gudevdevice.h b/extras/gudev/gudevdevice.h index 1ca2b48a04..ab22371ded 100644 --- a/extras/gudev/gudevdevice.h +++ b/extras/gudev/gudevdevice.h @@ -77,6 +77,7 @@ struct _GUdevDeviceClass GType g_udev_device_get_type (void) G_GNUC_CONST; gboolean g_udev_device_get_is_initialized (GUdevDevice *device); +guint64 g_udev_device_get_usec_since_initialized (GUdevDevice *device); const gchar *g_udev_device_get_subsystem (GUdevDevice *device); const gchar *g_udev_device_get_devtype (GUdevDevice *device); const gchar *g_udev_device_get_name (GUdevDevice *device); diff --git a/extras/gudev/seed-example-enum.js b/extras/gudev/seed-example-enum.js index 32200a42f9..66206ad806 100755 --- a/extras/gudev/seed-example-enum.js +++ b/extras/gudev/seed-example-enum.js @@ -4,20 +4,21 @@ const GLib = imports.gi.GLib; const GUdev = imports.gi.GUdev; function print_device(device) { - print(" initialized: " + device.get_is_initialized()); - print(" subsystem: " + device.get_subsystem()); - print(" devtype: " + device.get_devtype()); - print(" name: " + device.get_name()); - print(" number: " + device.get_number()); - print(" sysfs_path: " + device.get_sysfs_path()); - print(" driver: " + device.get_driver()); - print(" action: " + device.get_action()); - print(" seqnum: " + device.get_seqnum()); - print(" device type: " + device.get_device_type()); - print(" device number: " + device.get_device_number()); - print(" device file: " + device.get_device_file()); - print(" device file symlinks: " + device.get_device_file_symlinks()); - print(" tags: " + device.get_tags()); + print(" initialized: " + device.get_is_initialized()); + print(" usec since initialized: " + device.get_usec_since_initialized()); + print(" subsystem: " + device.get_subsystem()); + print(" devtype: " + device.get_devtype()); + print(" name: " + device.get_name()); + print(" number: " + device.get_number()); + print(" sysfs_path: " + device.get_sysfs_path()); + print(" driver: " + device.get_driver()); + print(" action: " + device.get_action()); + print(" seqnum: " + device.get_seqnum()); + print(" device type: " + device.get_device_type()); + print(" device number: " + device.get_device_number()); + print(" device file: " + device.get_device_file()); + print(" device file symlinks: " + device.get_device_file_symlinks()); + print(" tags: " + device.get_tags()); var keys = device.get_property_keys(); for (var n = 0; n < keys.length; n++) { print(" " + keys[n] + "=" + device.get_property(keys[n])); -- cgit v1.2.3-54-g00ecf From b4dd18ae52d079800f019fdf43f3dc36d9a92988 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Dec 2010 10:12:22 +0100 Subject: update NEWS --- NEWS | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/NEWS b/NEWS index 017c2d5857..cd9af80daf 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,36 @@ udev 165 ======== Bugfixes. +The udev database has changed, After installation of a new udev +version, 'udevadm info --convert-db' should be called, to let the new +udev/libudev version read the already stored data. + +udevadm now supports quoting of property values, and prefixing of +key names: + $ udevadm info --export --export-prefix=MY_ --query=property -n sda + MY_MAJOR='259' + MY_MINOR='0' + MY_DEVNAME='/dev/sda' + MY_DEVTYPE='disk' + ... + +libudev now supports: + udev_device_get_is_initialized() + udev_enumerate_add_match_is_initialized() +to be able to skip devices the kernel has created , but udev has +not already handled. + +libudev now supports: + udev_device_get_usec_since_initialized() +to retrieve the "age" of a udev device record. + +GUdev supports a more generic GUdevEnumerator class, udev TAG +handling, device initialization and timestamp now. + +The counterpart of /sys/dev/{char,block}/$major:$minor, +/dev/{char,block}/$major:$minor symlinks are now unconditionally +created, even when no rule files exist. + udev 164 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From f3f86e483a9e7629d5a16b4abf9f06980d221e16 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Dec 2010 13:17:02 +0100 Subject: release 165 --- ChangeLog | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 2 ++ 2 files changed, 65 insertions(+) diff --git a/ChangeLog b/ChangeLog index bcb8390bba..6132e5c765 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,66 @@ +Summary of changes from v164 to v165 +============================================ + +Andy Whitcroft (1): + keymap: Add release quirks for two Zepto Znote models and AMILO Xi 2428 + +Bastien Nocera (2): + keymap: Add force release for HP touchpad off + extras/keymap: Make touchpad buttons consistent + +David Henningsson (1): + Add ACLs for FFADO supported sound cards + +David Zeuthen (6): + ata_id: Support SG_IO version 4 interface + Run scsi_id and ata_id on the scsi_device object + Use ata_id, not scsi_id, on ATAPI devices + Add GUdevEnumerator type and Device.get_tags() method + Add g_udev_device_get_is_initialized() method + gudev: Add Device.get_usec_since_initialized + +Harald Hoyer (2): + udev-rules.c: change import property buffer to 16384 bytes + 70-acl.rules: add ACLs for ID_PDA devices + +Jakub Wilk (1): + man: udev - workaraound -> workaround + +Jan Drzewiecki (1): + cdrom_id: Fix media state for unreadable DVDs + +Kay Sievers (19): + version bump + rules: 78-sound-card - remove specific hardware matches, they do not belong here + rules: drop OSS audio rule + rules: drop alsa jack-plug input devices + rules: revert bsg use until the event ordering problem is sorted out + libudev: do not overwrite path with readlink() call + udevadm: info - honor --export and --export-prefix for property query + udevadm: info - honor --export, --export-prefix= + udevd: use dev_t or netif ifindex as database key + udevd: always create /dev/{char,block}/$major:$minor + udevd: simplify udev database and fix DEVNAME handling + udevd: switch to common id_filename functions + udevd: write full database file for (unsupported) renamed device nodes + check ifindex > 0 instead of subsystem == "net" + libudev: enumerate - allow to filter-out not-already-initialized devices + libudev: fix renamed device nodes detection logic + libudev: record and export "age" of device record + gudev: bump minor version + update NEWS + +Martin Pitt (5): + keymap: Add Sony Vaio VGN71 + keymap: Add some more Sony Vaio VGN-* models + Add ACL for media player USB devices + keymap: Fix struck Touchpad key on Dell Latitude E series + keymap: Fix struck Touchpad key on Dell Precision M series + +Michal Soltys (1): + udevd: create static nodes before /dev/null is needed + + Summary of changes from v163 to v164 ============================================ diff --git a/NEWS b/NEWS index cd9af80daf..8f579f35f7 100644 --- a/NEWS +++ b/NEWS @@ -32,6 +32,8 @@ The counterpart of /sys/dev/{char,block}/$major:$minor, /dev/{char,block}/$major:$minor symlinks are now unconditionally created, even when no rule files exist. +New and updated keymaps. + udev 164 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From 0e6a2e7d3c1a41505a45c12e3ba9a75c07fbcaf4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 16 Dec 2010 13:37:45 +0100 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8f579f35f7..57054f7ec1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 166 +======== +Bugfixes. + udev 165 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 7fda8bba47..9d35cfced0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [165], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [166], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From e99cc72398d1d5057cc6d1e4c065799f8daaf29e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 26 Dec 2010 16:01:13 +0100 Subject: man: generate html pages for www.kernel.org http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/ --- Makefile.am | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 0ee691c753..2e3fe39425 100644 --- a/Makefile.am +++ b/Makefile.am @@ -174,14 +174,22 @@ dist_man_MANS = \ udev/udevadm.8 \ udev/udevd.8 +dist_noinst_DATA = \ + udev/udev.html \ + udev/udevadm.html \ + udev/udevd.html + EXTRA_DIST += \ udev/udev.xml \ udev/udevadm.xml \ udev/udevd.xml -%.7 %.8 : %.xml +udev/%.7 udev/%.8 : udev/%.xml $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< +udev/%.html : udev/%.xml + $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $< + # ------------------------------------------------------------------------------ # udev tests # ------------------------------------------------------------------------------ @@ -685,5 +693,6 @@ git-release: git prune doc-sync: + rsync -av udev/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ rsync -av --delete extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/gudev/ -- cgit v1.2.3-54-g00ecf From 0d8b6be5f5238360d2d8e220d6da280f842c5358 Mon Sep 17 00:00:00 2001 From: Chris Bagwell Date: Sat, 1 Jan 2011 15:44:38 -0600 Subject: Remap Eee PC touchpad toggle key to F21 used by X Currently, Eee PC have a hotkey that generates KEY_F13 but this will soon change to KEY_TOUCHPAD_TOOGLE. Both cases do not work well with X. X has defined F21 for the purpose of touchpad toggle and other udev keymaps align with this meaning. Patch aligns Eee PC hotkey drivers with F21. Tested on Eee PC 1005PE using both eeepc-wmi and eeepc-laptop driver (with acpi_osi="!Windows 2009"). Signed-off-by: Chris Bagwell Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 053838d803..9059a8c41e 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -44,6 +44,8 @@ ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Butt ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="Lenovo ThinkPad SL Series extra buttons", RUN+="keymap $name 0x0E bluetooth" ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys", RUN+="keymap $name 0x6B f21" +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC Hotkey Driver", RUN+="keymap $name 0x37 f21" # Older Vaios have some different keys ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" -- cgit v1.2.3-54-g00ecf From 378380397c085c3c8858d3d7017b106f36577117 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 4 Jan 2011 18:32:07 +0100 Subject: man: fix typo Found by: Minh Ha-Duong. --- udev/udevd.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevd.xml b/udev/udevd.xml index de06a6173f..d335e2ec88 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -39,7 +39,7 @@ . On startup the content of the directory /lib/udev/devices is copied to /dev. If kernel modules specify static device - nodes, these nodes are created even wihtout a corresponding kernel device, to + nodes, these nodes are created even without a corresponding kernel device, to allow on-demand loading of kernel modules. Matching permissions specified in udev rules are applied to these static device nodes. The behavior of the running daemon can be changed with -- cgit v1.2.3-54-g00ecf From df6b2cf5731a542b7b3198e057393975dd17da6e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 7 Jan 2011 12:09:45 +0100 Subject: keymap: Add Acer TravelMate C310 Thanks to Dieter Herrmann for the report! --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 9059a8c41e..107ea41a25 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -90,7 +90,7 @@ ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C300*", RUN+="keymap $name acer-travelmate_c300" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C3[01]0*", RUN+="keymap $name acer-travelmate_c300" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*4720*", RUN+="keymap $name 0xB2 www 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" -- cgit v1.2.3-54-g00ecf From e302c4b33dfc7c8dbc64c32fd41f00dab1ae7f11 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 7 Jan 2011 12:12:57 +0100 Subject: keymap: Update README.keymap.txt Drop orig-map.txt requirement, we don't really use it in practice. Also ask for sending stuff to the mailing list instead of Launchpad. --- extras/keymap/README.keymap.txt | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt index 9c2d5dc16a..79d9971b1d 100644 --- a/extras/keymap/README.keymap.txt +++ b/extras/keymap/README.keymap.txt @@ -51,11 +51,7 @@ for inclusion you need to do the following steps: In the following commands, the name will be written as "input/eventX" (replace X with the appropriate number). - 2. Dump current mapping: - - sudo /lib/udev/keymap input/eventX > /tmp/orig-map.txt - - 3. Find broken scan codes: + 2. Find broken scan codes: sudo /lib/udev/keymap -i input/eventX @@ -80,18 +76,16 @@ for inclusion you need to do the following steps: this case as well, as it can be worked around in /lib/udev/keymaps/95-keyboard-force-release.rules . - 4. Find out your system vendor and product: + 3. Find out your system vendor and product: cat /sys/class/dmi/id/sys_vendor cat /sys/class/dmi/id/product_name - 5. Generate a device dump with "udevadm info --export-db > /tmp/udev-db.txt". - - 6. Send the system vendor/product names, the key mapping from step 3, - /tmp/orig-map.txt from step 2, and /tmp/udev-db.txt from step 5 - to the bug tracker, so that they can be included in the next release: + 4. Generate a device dump with "udevadm info --export-db > /tmp/udev-db.txt". - https://bugs.launchpad.net/udev/+bugs + 6. Send the system vendor/product names, the key mapping from step 2, + and /tmp/udev-db.txt from step 4 to the linux-hotplug@vger.kernel.org mailing + list, so that they can be included in the next release. For local testing, copy your map file to /lib/udev/keymaps/ with an appropriate name, and add an appropriate udev rule to /lib/udev/rules.d/95-keymap.rules: -- cgit v1.2.3-54-g00ecf From 9b444cb29a4b3b90ad86ba85f878c100e5d543d9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 13 Jan 2011 10:10:27 -0600 Subject: keymap: Add Lenovo ThinkPad X201 tablet https://launchpad.net/bugs/702426 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 107ea41a25..339d16cf41 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -70,7 +70,7 @@ ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+=" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x6_tablet" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X200 Tablet*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x200_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X20* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x200_tablet" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" -- cgit v1.2.3-54-g00ecf From 45019c0e88d76c9568f581582cdb985bb9393354 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 16 Jan 2011 19:25:04 +0100 Subject: keymap: Move reading of event in separate function --- extras/keymap/keymap.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 3f01d1953e..2d68e7f0c2 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -256,6 +256,24 @@ static const char* default_keymap_path(const char* path) return path; } +/* read one event; return 1 if valid */ +static int read_event(int fd, struct input_event* ev) +{ + int ret; + ret = read(fd, ev, sizeof(struct input_event)); + + if (ret < 0) { + perror("read"); + return 0; + } + if (ret != sizeof(struct input_event)) { + fprintf(stderr, "did not get enough data for event struct, aborting\n"); + return 0; + } + + return 1; +} + static void print_key(struct input_event *event) { static int cur_scancode = 0; @@ -280,28 +298,17 @@ static void print_key(struct input_event *event) static void interactive(int fd) { struct input_event ev; - int run = 1; /* grab input device */ ioctl(fd, EVIOCGRAB, 1); puts("Press ESC to finish"); - while (run) { - switch (read(fd, &ev, sizeof(ev))) { - case -1: - perror("read"); - run = 0; - break; - case 0: - run = 0; - break; - default: - print_key(&ev); - /* stop on Escape key release */ - if (ev.type == EV_KEY && ev.code == KEY_ESC && ev.value == 0) - run = 0; + while (read_event(fd, &ev)) { + print_key(&ev); + + /* stop on Escape key release */ + if (ev.type == EV_KEY && ev.code == KEY_ESC && ev.value == 0) break; - } } /* release input device */ -- cgit v1.2.3-54-g00ecf From 90f182c3d69a4451bb1ea6f79d8d7fe4895cdf89 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 16 Jan 2011 21:10:03 +0100 Subject: keymap: More robust state machine Some drivers, like thinkpad_acpi, do not send a scan code at all (for known keys), and some send the key code first, then the scan code. Implement a better state machine which acceps them in any order and wait until a SYN event. If the driver does not send SYN events, keymap will also handle this and print out that fact. Thanks to Seth Forshee for pointing out how this really works! https://launchpad.net/bugs/702407 --- extras/keymap/keymap.c | 85 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 2d68e7f0c2..ed6b69d5f1 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -274,41 +275,87 @@ static int read_event(int fd, struct input_event* ev) return 1; } -static void print_key(struct input_event *event) +static void print_key(uint32_t scancode, uint16_t keycode, int has_scan, int has_key) { - static int cur_scancode = 0; const char *keyname; - /* save scan code for next EV_KEY event */ - if (event->type == EV_MSC && event->code == MSC_SCAN) - cur_scancode = event->value; + /* ignore key release events */ + if (has_key == 1) + return; - /* key press */ - if (event->type == EV_KEY && event->value) { - keyname = key_names[event->code]; - if (keyname != NULL) - printf("scan code: 0x%02X key code: %s\n", cur_scancode, - format_keyname(key_names[event->code])); - else - printf("scan code: 0x%02X key code: %03X\n", cur_scancode, - event->code); + if (has_key == 0 && has_scan != 0) { + fprintf(stderr, "got scan code event 0x%02X without a key code event\n", + scancode); + return; } + + if (has_scan != 0) + printf("scan code: 0x%02X ", scancode); + else + printf("(no scan code received) "); + + keyname = key_names[keycode]; + if (keyname != NULL) + printf("key code: %s\n", format_keyname(keyname)); + else + printf("key code: %03X\n", keycode); } static void interactive(int fd) { struct input_event ev; + uint32_t last_scan = 0; + uint16_t last_key = 0; + int has_scan; /* boolean */ + int has_key; /* 0: none, 1: release, 2: press */ /* grab input device */ ioctl(fd, EVIOCGRAB, 1); - puts("Press ESC to finish"); + + has_scan = has_key = 0; while (read_event(fd, &ev)) { - print_key(&ev); + /* Drivers usually send the scan code first, then the key code, + * then a SYN. Some drivers (like thinkpad_acpi) send the key + * code first, and some drivers might not send SYN events, so + * keep a robust state machine which can deal with any of those + */ + + if (ev.type == EV_MSC && ev.code == MSC_SCAN) { + if (has_scan) { + fputs("driver did not send SYN event in between key events; previous event:\n", + stderr); + print_key(last_scan, last_key, has_scan, has_key); + has_key = 0; + } + + last_scan = ev.value; + has_scan = 1; + /*printf("--- got scan %u; has scan %i key %i\n", last_scan, has_scan, has_key); */ + } + else if (ev.type == EV_KEY) { + if (has_key) { + fputs("driver did not send SYN event in between key events; previous event:\n", + stderr); + print_key(last_scan, last_key, has_scan, has_key); + has_scan = 0; + } + + last_key = ev.code; + has_key = 1 + ev.value; + /*printf("--- got key %hu; has scan %i key %i\n", last_key, has_scan, has_key);*/ + + /* Stop on ESC */ + if (ev.code == KEY_ESC && ev.value == 0) + break; + } + else if (ev.type == EV_SYN) { + /*printf("--- got SYN; has scan %i key %i\n", has_scan, has_key);*/ + print_key(last_scan, last_key, has_scan, has_key); + + has_scan = has_key = 0; + } - /* stop on Escape key release */ - if (ev.type == EV_KEY && ev.code == KEY_ESC && ev.value == 0) - break; } /* release input device */ -- cgit v1.2.3-54-g00ecf From 2514465f6a4ab61617482f068e475b945438c1f1 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 16 Jan 2011 21:12:32 +0100 Subject: keymap: Explain how to end the program Pressing Escape will only actually work if keymap is currently examining the primary keyboard. For other devices the user needs to press Control-C instead. --- extras/keymap/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index ed6b69d5f1..719c30e600 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -311,7 +311,7 @@ static void interactive(int fd) /* grab input device */ ioctl(fd, EVIOCGRAB, 1); - puts("Press ESC to finish"); + puts("Press ESC to finish, or Control-C if this device is not your primary keyboard"); has_scan = has_key = 0; while (read_event(fd, &ev)) { -- cgit v1.2.3-54-g00ecf From 4e54f5334e130dc8f627c96ef2179ff4262b7791 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Tue, 25 Jan 2011 15:51:07 +0100 Subject: extras: add rules for qemu guests These patches enable usb autosuspend for the qemu emulated HID devices. This reduces the cpu load for idle guests with a hid device attached because the linux kernel will suspend the usb bus then and qemu can stop running a 1000 Hz to emulate the (active) UHCI controller. Signed-off-by: Gerd Hoffmann --- Makefile.am | 5 +++++ extras/qemu/42-qemu-usb.rules | 13 +++++++++++++ rules/misc/30-kernel-compat.rules | 5 +++++ 3 files changed, 23 insertions(+) create mode 100644 extras/qemu/42-qemu-usb.rules diff --git a/Makefile.am b/Makefile.am index 2e3fe39425..b2300ce778 100644 --- a/Makefile.am +++ b/Makefile.am @@ -317,6 +317,11 @@ extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules +# ------------------------------------------------------------------------------ +# qemu -- qemu/kvm guest tweaks +# ------------------------------------------------------------------------------ +dist_udevrules_DATA += extras/qemu/99-qemu-usb.rules + if ENABLE_EXTRAS # ------------------------------------------------------------------------------ # conditional extras (need glib, libusb, libacl, ...) diff --git a/extras/qemu/42-qemu-usb.rules b/extras/qemu/42-qemu-usb.rules new file mode 100644 index 0000000000..4fd53c7477 --- /dev/null +++ b/extras/qemu/42-qemu-usb.rules @@ -0,0 +1,13 @@ +# +# Enable autosuspend for qemu emulated usb hid devices. +# +# Note that there are buggy qemu versions which advertise remote +# wakeup support but don't actually implement it correctly. This +# is the reason why we need a match for the serial number here. +# The serial number "42" is used to tag the implementations where +# remote wakeup is working. +# + +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +CTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" diff --git a/rules/misc/30-kernel-compat.rules b/rules/misc/30-kernel-compat.rules index 2c545dcca5..2a6a97c5f3 100644 --- a/rules/misc/30-kernel-compat.rules +++ b/rules/misc/30-kernel-compat.rules @@ -97,4 +97,9 @@ SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" SUBSYSTEM=="pnp", DRIVER!="?*", \ RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" +# see extras/qemu/42-qemu-usb.rules, version for 2.6.32 + older. +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" + LABEL="kernel_compat_end" -- cgit v1.2.3-54-g00ecf From 06bd02c5633666ceccd14557c721a39b2a68f240 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Jan 2011 16:12:44 +0100 Subject: make: fix qemu rules file name --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index b2300ce778..0e49b6be29 100644 --- a/Makefile.am +++ b/Makefile.am @@ -320,7 +320,7 @@ dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules # ------------------------------------------------------------------------------ # qemu -- qemu/kvm guest tweaks # ------------------------------------------------------------------------------ -dist_udevrules_DATA += extras/qemu/99-qemu-usb.rules +dist_udevrules_DATA += extras/qemu/42-qemu-usb.rules if ENABLE_EXTRAS # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From b6910d225116f68bafe2d8e2b860527493f5fdc2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 25 Jan 2011 21:46:12 +0100 Subject: extras: qemu - fix typo --- extras/qemu/42-qemu-usb.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/qemu/42-qemu-usb.rules b/extras/qemu/42-qemu-usb.rules index 4fd53c7477..a4e3864714 100644 --- a/extras/qemu/42-qemu-usb.rules +++ b/extras/qemu/42-qemu-usb.rules @@ -10,4 +10,4 @@ ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -CTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -- cgit v1.2.3-54-g00ecf From 54453a95102ddc3fcb88dbcf5713710db94a5ab5 Mon Sep 17 00:00:00 2001 From: Jürgen Kaiser Date: Wed, 9 Feb 2011 17:10:32 +0100 Subject: keymap: Add Acer Aspire 8930 http://bugs.debian.org/612512 Signed-off-by: Martin Pitt --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 1 + extras/keymap/keymaps/acer-aspire_8930 | 6 ++++++ 3 files changed, 8 insertions(+) create mode 100644 extras/keymap/keymaps/acer-aspire_8930 diff --git a/Makefile.am b/Makefile.am index 0e49b6be29..df426f72a4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -565,6 +565,7 @@ udevkeymapdir = $(libexecdir)/keymaps dist_udevkeymap_DATA = \ extras/keymap/keymaps/acer \ extras/keymap/keymaps/acer-aspire_5720 \ + extras/keymap/keymaps/acer-aspire_8930 \ extras/keymap/keymaps/acer-aspire_5920g \ extras/keymap/keymaps/acer-aspire_6920 \ extras/keymap/keymaps/acer-travelmate_c300 \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 339d16cf41..dd511d5cf0 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -97,6 +97,7 @@ ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 16 ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 8930", RUN+="keymap $name acer-aspire_8930" ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" diff --git a/extras/keymap/keymaps/acer-aspire_8930 b/extras/keymap/keymaps/acer-aspire_8930 new file mode 100644 index 0000000000..ffe9f372f7 --- /dev/null +++ b/extras/keymap/keymaps/acer-aspire_8930 @@ -0,0 +1,6 @@ +0xCA prog3 # key 'HOLD' on cine dash media console +0x83 rewind +0x89 fastforward +0x92 media # key 'ARCADE' on cine dash media console +0x9E back + -- cgit v1.2.3-54-g00ecf From 46df5b1baeb806f840d44fe06e0d71e335a5aebf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Feb 2011 12:49:19 +0100 Subject: ata_id: do not print empty serial numbers to avoid unwanted trailing '_' --- extras/ata_id/ata_id.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 92387e5077..594cfb2017 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -584,8 +584,12 @@ int main(int argc, char *argv[]) printf("ID_MODEL=%s\n", model); printf("ID_MODEL_ENC=%s\n", model_enc); printf("ID_REVISION=%s\n", revision); - printf("ID_SERIAL=%s_%s\n", model, serial); - printf("ID_SERIAL_SHORT=%s\n", serial); + if (serial[0] != '\0') { + printf("ID_SERIAL=%s_%s\n", model, serial); + printf("ID_SERIAL_SHORT=%s\n", serial); + } else { + printf("ID_SERIAL=%s\n", model); + } if (id.command_set_1 & (1<<5)) { printf ("ID_ATA_WRITE_CACHE=1\n"); -- cgit v1.2.3-54-g00ecf From 50863e4a233efedb1ef45dc36aaddbf8fe207a93 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 9 Feb 2011 12:55:14 +0100 Subject: update gitignore --- udev/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/.gitignore b/udev/.gitignore index 97248fa319..73f746cb7d 100644 --- a/udev/.gitignore +++ b/udev/.gitignore @@ -2,4 +2,5 @@ udevd udevadm test-udev *.[78] +*.html udev.pc -- cgit v1.2.3-54-g00ecf From 0028a9224f18dd2c6baadcc8f488a12efa04d061 Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 9 Feb 2011 16:32:43 -0500 Subject: keymap: Remove wlan from Dell The Dell rfkill key is handled by hardware and the dell-laptop driver catches the i8042 event in order to update the rfkill state. Sending wlan to userspace will just result in userspace trying to revert the change the hardware has just made. Signed-off-by: Matthew Garrett Signed-off-by: Martin Pitt --- extras/keymap/keymaps/dell | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell index fbbb9035b1..4f907b3eef 100644 --- a/extras/keymap/keymaps/dell +++ b/extras/keymap/keymaps/dell @@ -5,7 +5,7 @@ 0x85 brightnessdown # Fn+Down arrow Brightness Down 0x86 brightnessup # Fn+Up arrow Brightness Up 0x87 battery # Fn+F3 battery icon -0x88 wlan # Fn+F2 Turn On/Off Wireless +0x88 unknown # Fn+F2 Turn On/Off Wireless - handled in hardware 0x89 ejectclosecd # Fn+F10 Eject CD 0x8A suspend # Fn+F1 hibernate 0x8B switchvideomode # Fn+F8 CRT/LCD (high keycode: "displaytoggle") -- cgit v1.2.3-54-g00ecf From 0852794347827d3135882c1496a233407ba0ed2a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Feb 2011 09:07:06 +0100 Subject: release 166 --- ChangeLog | 33 +++++++++++++++++++++++++++++++++ NEWS | 2 ++ 2 files changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6132e5c765..1b8caab43b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +Summary of changes from v165 to v166 +============================================ + +Chris Bagwell (1): + Remap Eee PC touchpad toggle key to F21 used by X + +Gerd Hoffmann (1): + extras: add rules for qemu guests + +Jürgen Kaiser (1): + keymap: Add Acer Aspire 8930 + +Kay Sievers (7): + version bump + man: generate html pages for www.kernel.org + man: fix typo + make: fix qemu rules file name + extras: qemu - fix typo + ata_id: do not print empty serial numbers to avoid unwanted trailing '_' + update gitignore + +Martin Pitt (6): + keymap: Add Acer TravelMate C310 + keymap: Update README.keymap.txt + keymap: Add Lenovo ThinkPad X201 tablet + keymap: Move reading of event in separate function + keymap: More robust state machine + keymap: Explain how to end the program + +Matthew Garrett (1): + keymap: Remove wlan from Dell + + Summary of changes from v164 to v165 ============================================ diff --git a/NEWS b/NEWS index 57054f7ec1..1797910c7b 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,8 @@ udev 166 ======== Bugfixes. +New and updated keymaps. + udev 165 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From f22f103661954524287aaef99378e4060fdb1ebd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 10 Feb 2011 09:23:45 +0100 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 1797910c7b..b5008dbf28 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 167 +======== +Bugfixes. + udev 166 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 9d35cfced0..b5754f2ac2 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [166], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [167], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 5e9eb156c003dc7f8f92287bfad0251d6c5d0ef9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 15 Feb 2011 13:06:18 +0100 Subject: 60-persistent-input.rules: Support multiple interfaces Create /dev/input/by-id symlinks containing the USB interface number so that each interface in a multi-interface USB input device gets its own symlink. Thanks to a7x ! https://launchpad.net/bugs/626449 --- rules/rules.d/60-persistent-input.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index 634c4dbeaf..685e57e15b 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -21,7 +21,9 @@ ENV{.INPUT_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" # by-id links KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{.INPUT_CLASS}" +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-$env{.INPUT_CLASS}" KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{.INPUT_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-event-$env{.INPUT_CLASS}" # allow empty class for USB devices, by appending the interface number SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \ SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" -- cgit v1.2.3-54-g00ecf From 0c0b3f97cad4c34140dda3aa85a9bc74badb4b16 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 15 Feb 2011 14:20:21 +0100 Subject: Only build v4l_id if V4L1 header file is available --- Makefile.am | 2 ++ configure.ac | 3 +++ 2 files changed, 5 insertions(+) diff --git a/Makefile.am b/Makefile.am index df426f72a4..b87741802f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -312,10 +312,12 @@ libexec_PROGRAMS += extras/usb_id/usb_id # ------------------------------------------------------------------------------ # v4l_id - video4linux capabilities # ------------------------------------------------------------------------------ +if HAVE_V4L1 extras_v4l_id_v4l_id_SOURCES = extras/v4l_id/v4l_id.c extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules +endif # ------------------------------------------------------------------------------ # qemu -- qemu/kvm guest tweaks diff --git a/configure.ac b/configure.ac index 9d35cfced0..2ceba56191 100644 --- a/configure.ac +++ b/configure.ac @@ -115,6 +115,9 @@ if test "x$enable_extras" = xyes; then AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) + + AC_CHECK_HEADER([linux/videodev.h], [have_videodev_h=yes], []) + AM_CONDITIONAL(HAVE_V4L1, [test "x$have_videodev_h" = "xyes"]) fi AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) -- cgit v1.2.3-54-g00ecf From 32567f8c95290a8819c0bc7d57849b8abfba9554 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 15 Feb 2011 15:39:42 +0100 Subject: 60-persistent-input.rules: Do not create duplicate links Commit 5e9eb156c added new symlinks for multi-interface USB input devices. However, we do not actually need the one for interface number "00", as we already have the symlink without the interface number. --- rules/rules.d/60-persistent-input.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index 685e57e15b..db0eda79e8 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -21,9 +21,9 @@ ENV{.INPUT_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" # by-id links KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{.INPUT_CLASS}" -KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-$env{.INPUT_CLASS}" +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", ATTRS{bInterfaceNumber}!="00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-$env{.INPUT_CLASS}" KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{.INPUT_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-event-$env{.INPUT_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", ATTRS{bInterfaceNumber}!="00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-event-$env{.INPUT_CLASS}" # allow empty class for USB devices, by appending the interface number SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \ SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" -- cgit v1.2.3-54-g00ecf From c283cd6c598b38a6e1bb1ffd7372b9c550e45233 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 15 Feb 2011 16:31:49 +0100 Subject: Fix building with --disable-extras We always need to define automake conditionals, otherwise configure fails with --disable-extras. --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 2ceba56191..c7885b0162 100644 --- a/configure.ac +++ b/configure.ac @@ -115,12 +115,12 @@ if test "x$enable_extras" = xyes; then AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) - - AC_CHECK_HEADER([linux/videodev.h], [have_videodev_h=yes], []) - AM_CONDITIONAL(HAVE_V4L1, [test "x$have_videodev_h" = "xyes"]) fi AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) +AC_CHECK_HEADER([linux/videodev.h], [have_videodev_h=yes], []) +AM_CONDITIONAL(HAVE_V4L1, [test "x$have_videodev_h" = "xyes"]) + AC_ARG_ENABLE([introspection], AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), [], [enable_introspection=yes]) -- cgit v1.2.3-54-g00ecf From 905818f5961446ac32d1b2d165185fffddc4915a Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 15 Feb 2011 16:37:26 +0100 Subject: Do not build extras with --disable-extras --- Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.am b/Makefile.am index b87741802f..eb8f6d197d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -221,6 +221,7 @@ dist_udevrules_DATA += \ extras/rule_generator/75-cd-aliases-generator.rules \ extras/rule_generator/75-persistent-net-generator.rules +if ENABLE_EXTRAS # ------------------------------------------------------------------------------ # firmware - firmware loading # ------------------------------------------------------------------------------ @@ -319,6 +320,8 @@ libexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules endif +endif # ENABLE_EXTRAS + # ------------------------------------------------------------------------------ # qemu -- qemu/kvm guest tweaks # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From 4ace8a43ac2cbbd4d6f5c29fc461c3caa8f8545b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Feb 2011 17:24:32 +0100 Subject: v4l_id: kill the v4l1 ioctl Recent kernels do not have v4l1 anymore. --- extras/v4l_id/v4l_id.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/extras/v4l_id/v4l_id.c b/extras/v4l_id/v4l_id.c index d530a6d391..f3fc648b39 100644 --- a/extras/v4l_id/v4l_id.c +++ b/extras/v4l_id/v4l_id.c @@ -28,7 +28,6 @@ #include #include #include -#include #include int main (int argc, char *argv[]) @@ -82,19 +81,6 @@ int main (int argc, char *argv[]) if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0) printf("radio:"); printf("\n"); - } else if (ioctl (fd, VIDIOCGCAP, &v1cap) == 0) { - printf("ID_V4L_VERSION=1\n"); - printf("ID_V4L_PRODUCT=%s\n", v1cap.name); - printf("ID_V4L_CAPABILITIES=:"); - if ((v1cap.type & VID_TYPE_CAPTURE) > 0) - printf("capture:"); - if ((v1cap.type & VID_TYPE_OVERLAY) > 0) - printf("video_overlay:"); - if (v1cap.audios > 0) - printf("audio:"); - if ((v1cap.type & VID_TYPE_TUNER) > 0) - printf("tuner:"); - printf("\n"); } close (fd); -- cgit v1.2.3-54-g00ecf From 89284ddac413d376fc3b56f742daaf1b9bc85bba Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Feb 2011 17:27:29 +0100 Subject: v4l_id: remove left-over variable --- extras/v4l_id/v4l_id.c | 1 - 1 file changed, 1 deletion(-) diff --git a/extras/v4l_id/v4l_id.c b/extras/v4l_id/v4l_id.c index f3fc648b39..21cb3285ad 100644 --- a/extras/v4l_id/v4l_id.c +++ b/extras/v4l_id/v4l_id.c @@ -38,7 +38,6 @@ int main (int argc, char *argv[]) }; int fd; char *device; - struct video_capability v1cap; struct v4l2_capability v2cap; while (1) { -- cgit v1.2.3-54-g00ecf From f3f70f8d9ef6a901bf1bdff10008d76e72bb6692 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 15 Feb 2011 17:33:05 +0100 Subject: v4l_id: Drop videodev.h check again It only uses v4l2 now. --- Makefile.am | 2 -- configure.ac | 3 --- 2 files changed, 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index eb8f6d197d..a0967ab207 100644 --- a/Makefile.am +++ b/Makefile.am @@ -313,12 +313,10 @@ libexec_PROGRAMS += extras/usb_id/usb_id # ------------------------------------------------------------------------------ # v4l_id - video4linux capabilities # ------------------------------------------------------------------------------ -if HAVE_V4L1 extras_v4l_id_v4l_id_SOURCES = extras/v4l_id/v4l_id.c extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules -endif endif # ENABLE_EXTRAS diff --git a/configure.ac b/configure.ac index caeb741319..b5754f2ac2 100644 --- a/configure.ac +++ b/configure.ac @@ -118,9 +118,6 @@ if test "x$enable_extras" = xyes; then fi AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) -AC_CHECK_HEADER([linux/videodev.h], [have_videodev_h=yes], []) -AM_CONDITIONAL(HAVE_V4L1, [test "x$have_videodev_h" = "xyes"]) - AC_ARG_ENABLE([introspection], AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), [], [enable_introspection=yes]) -- cgit v1.2.3-54-g00ecf From c54b43e2c233e724f840c4f6a0a81bdd549e40bb Mon Sep 17 00:00:00 2001 From: Kei Tokunaga Date: Tue, 15 Feb 2011 18:59:24 +0900 Subject: udevadm: enumerate - update prev pointer properly When I tried to boot a system with 256 disks x 4 paths with device-mapper, udevadm trigger (--type=devices) that was called from start_udev ended up dumping a core due to a segmentation fault. In udev_enumerate_get_list_entry(), if it finds the devices that should be delayed, it calls syspath_add(). If realloc() in syspath_add() allocates the required memory at a different memory address, referring prev->len afterward causes the segmentation fault. Signed-off-by: Kei Tokunaga --- libudev/libudev-enumerate.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index e46bc087fa..9694797d35 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -274,6 +274,9 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude /* skip to be delayed devices, and add them to the end of the list */ if (devices_delay_end(udev_enumerate->udev, entry->syspath)) { syspath_add(udev_enumerate, entry->syspath); + /* need to update prev here for the case realloc() gives + a different address */ + prev = &udev_enumerate->devices[i]; continue; } -- cgit v1.2.3-54-g00ecf From 0c19cc73da6cfab32214e8622b17d87be00e7d4e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Feb 2011 22:27:33 +0100 Subject: update some comments --- libudev/libudev-enumerate.c | 3 +-- udev/udevadm-control.c | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 9694797d35..128813c7d6 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -274,8 +274,7 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude /* skip to be delayed devices, and add them to the end of the list */ if (devices_delay_end(udev_enumerate->udev, entry->syspath)) { syspath_add(udev_enumerate, entry->syspath); - /* need to update prev here for the case realloc() gives - a different address */ + /* need to update prev here for the case realloc() gives a different address */ prev = &udev_enumerate->devices[i]; continue; } diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 8b90829211..0447804c95 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -44,7 +44,6 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) struct udev_ctrl *uctrl = NULL; int rc = 1; - /* compat values with '_' will be removed in a future release */ static const struct option options[] = { { "log-priority", required_argument, NULL, 'l' }, { "stop-exec-queue", no_argument, NULL, 's' }, -- cgit v1.2.3-54-g00ecf From 7ae8a463bef9e071d2ce7706783171aafab28f2e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Sun, 20 Feb 2011 17:58:55 +0100 Subject: keymap: Fix Acer Aspire 5920G media key From downstream bug: "In Windows this button launch Acer Arcade or Acer Arcade Deluxe application - it's media center like XBMC." https://launchpad.net/bugs/637695 --- extras/keymap/keymaps/acer-aspire_5920g | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/keymaps/acer-aspire_5920g b/extras/keymap/keymaps/acer-aspire_5920g index 0e628bc1b3..655cc33db4 100644 --- a/extras/keymap/keymaps/acer-aspire_5920g +++ b/extras/keymap/keymaps/acer-aspire_5920g @@ -1,4 +1,4 @@ 0x8A media 0xB2 www -0x92 prog2 +0x92 media 0xD9 bluetooth # (toggle) on-to-off -- cgit v1.2.3-54-g00ecf From 551b143e13fe5386326a417c53d0a64d49266263 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 24 Feb 2011 16:57:05 +0100 Subject: cdrom_id: cd_media_toc() extend toc size to 65536 Seems like an iDRAC reports a lot of toc entries. "For cd_media_toc() will have to be modified to handle larger tables right now it has an "unsigned char toc[2048]" but the toc can be up to 65536 bytes long . I got a TOC length of 4610 bytes, causing cd_media_toc() to fail." https://bugzilla.redhat.com/show_bug.cgi?id=660367 Signed-off-by: Martin Pitt --- extras/cdrom_id/cdrom_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index f0e1cbbc42..4a58a49030 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -737,7 +737,7 @@ static int cd_media_toc(struct udev *udev, int fd) { struct scsi_cmd sc; unsigned char header[12]; - unsigned char toc[2048]; + unsigned char toc[65536]; unsigned int len, i, num_tracks; unsigned char *p; int err; -- cgit v1.2.3-54-g00ecf From 30c2b6f10fba3171036bdfd4b6873ebb0e89233f Mon Sep 17 00:00:00 2001 From: "Lee, Chun-Yi" Date: Tue, 1 Mar 2011 19:16:45 +0800 Subject: Remap Acer WMI touchpad toggle key to F21 used by X Currently, Acer WMI driver generates KEY_F22 but this will soon change to KEY_TOUCHPAD_TOOGLE. X has defined F21 for the purpose of touchpad toggle and other udev keymaps align with this meaning. Patch aligns Acer WMI hotkey drivers with F21. Tested on Acer TravelMate 8572 notebook using acer-wmi driver. Cc: Carlos Corbacho Cc: Matthew Garrett Cc: Dmitry Torokhov Cc: Corentin Chary Signed-off-by: Lee, Chun-Yi Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index dd511d5cf0..7f849d3027 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -46,6 +46,7 @@ ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys", RUN+="keymap $name 0x6B f21" ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC Hotkey Driver", RUN+="keymap $name 0x37 f21" +ENV{DMI_VENDOR}=="Acer*", KERNELS=="input*", ATTRS{name}=="Acer WMI hotkeys", RUN+="keymap $name 0x82 f21" # Older Vaios have some different keys ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" -- cgit v1.2.3-54-g00ecf From f180ad259f1480a3d58106e38eb760f79600e0e1 Mon Sep 17 00:00:00 2001 From: Thomas Egerer Date: Fri, 4 Mar 2011 17:06:41 +0100 Subject: libudev: allow to get list of all available sysfs attrs for a device Signed-off-by: Thomas Egerer --- libudev/exported_symbols | 1 + libudev/libudev-device.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++ libudev/libudev.h | 1 + 3 files changed, 83 insertions(+) diff --git a/libudev/exported_symbols b/libudev/exported_symbols index 2e6a9b7dc0..500e981586 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -32,6 +32,7 @@ udev_device_get_is_initialized udev_device_get_devlinks_list_entry udev_device_get_properties_list_entry udev_device_get_tags_list_entry +udev_device_get_sysattr_list_entry udev_device_get_property_value udev_device_get_action udev_device_get_driver diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 16bee19dff..af0bc2e5a3 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -61,6 +61,7 @@ struct udev_device { struct udev_list_node devlinks_list; struct udev_list_node properties_list; struct udev_list_node sysattr_list; + struct udev_list_node available_sysattr_list; struct udev_list_node tags_list; unsigned long long int seqnum; unsigned long long int usec_initialized; @@ -83,6 +84,7 @@ struct udev_device { bool db_loaded; bool uevent_loaded; bool is_initialized; + bool sysattrs_cached; }; struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) @@ -361,6 +363,7 @@ struct udev_device *udev_device_new(struct udev *udev) udev_list_init(&udev_device->devlinks_list); udev_list_init(&udev_device->properties_list); udev_list_init(&udev_device->sysattr_list); + udev_list_init(&udev_device->available_sysattr_list); udev_list_init(&udev_device->tags_list); udev_device->event_timeout = -1; udev_device->watch_handle = -1; @@ -785,6 +788,7 @@ void udev_device_unref(struct udev_device *udev_device) udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); udev_list_cleanup_entries(udev_device->udev, &udev_device->properties_list); udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->available_sysattr_list); udev_list_cleanup_entries(udev_device->udev, &udev_device->tags_list); free(udev_device->action); free(udev_device->driver); @@ -1235,6 +1239,83 @@ out: return val; } +static int udev_device_cache_sysattrs(struct udev_device *udev_device) +{ + struct dirent *entry; + DIR *dir; + int num = 0; + + if (udev_device == NULL) + return -1; + /* caching already done? */ + if (udev_device->sysattrs_cached) + return 0; + + dir = opendir(udev_device_get_syspath(udev_device)); + if (!dir) { + dbg(udev_device->udev, "sysfs dir '%s' can not be opened\n", + udev_device_get_syspath(udev_device)); + return -1; + } + + while (NULL != (entry = readdir(dir))) { + char path[UTIL_PATH_SIZE]; + struct stat statbuf; + + /* only handle symlinks and regular files */ + if (DT_LNK != entry->d_type && DT_REG != entry->d_type) + continue; + + util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), + "/", entry->d_name, NULL); + if (0 != lstat(path, &statbuf)) + continue; + + if (0 == (statbuf.st_mode & S_IRUSR)) + continue; + + if (DT_LNK == entry->d_type) { + if (strcmp(entry->d_name, "driver") != 0 && + strcmp(entry->d_name, "subsystem") != 0 && + strcmp(entry->d_name, "module") != 0) + continue; + } + udev_list_entry_add(udev_device->udev, + &udev_device->available_sysattr_list, entry->d_name, + DT_LNK == entry->d_type ? "s" : "r", 0, 0); + ++num; + } + + dbg(udev_device->udev, "found %d sysattrs for '%s'\n", num, + udev_device_get_syspath(udev_device)); + udev_device->sysattrs_cached = true; + + return num; +} + +/** + * udev_device_get_sysattr_list_entry: + * @udev_device: udev device + * + * Retrieve the list of available sysattrs, with value being empty; + * This is to be able to read all available sysfs attributes for a particular + * device without the necessity to access sysfs from outside libudev. + * + * Returns: the first entry of the property list + **/ +struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device) +{ + /* perform initial caching of sysattr list */ + if (!udev_device->sysattrs_cached) { + int ret; + ret = udev_device_cache_sysattrs(udev_device); + if (0 > ret) + return NULL; + } + + return udev_list_get_entry(&udev_device->available_sysattr_list); +} + int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) { const char *pos; diff --git a/libudev/libudev.h b/libudev/libudev.h index 0abd7c8b0e..892530b773 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -92,6 +92,7 @@ int udev_device_get_is_initialized(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device); const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key); const char *udev_device_get_driver(struct udev_device *udev_device); dev_t udev_device_get_devnum(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From 95ce1875d79162324a5eb67f6a0ffbbdd5d29921 Mon Sep 17 00:00:00 2001 From: Thomas Egerer Date: Fri, 4 Mar 2011 17:06:43 +0100 Subject: libudev: use sysfs attr ilist interface for attribute walk Signed-off-by: Thomas Egerer --- libudev/docs/libudev-sections.txt | 1 + udev/udevadm-info.c | 72 +++++++++++++++++---------------------- 2 files changed, 33 insertions(+), 40 deletions(-) diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 7db9c1bba9..918344d941 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -54,6 +54,7 @@ udev_device_get_driver udev_device_get_devnum udev_device_get_action udev_device_get_sysattr_value +udev_device_get_sysattr_list_entry udev_device_get_seqnum udev_device_get_usec_since_initialized
            diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 4510f4aa90..f60ad2c450 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -33,47 +33,39 @@ static void print_all_attributes(struct udev_device *device, const char *key) { - struct udev *udev = udev_device_get_udev(device); - DIR *dir; - struct dirent *dent; - - dir = opendir(udev_device_get_syspath(device)); - if (dir != NULL) { - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat statbuf; - const char *value; - size_t len; - - if (dent->d_name[0] == '.') - continue; - - if (strcmp(dent->d_name, "uevent") == 0) - continue; - if (strcmp(dent->d_name, "dev") == 0) - continue; - - if (fstatat(dirfd(dir), dent->d_name, &statbuf, AT_SYMLINK_NOFOLLOW) != 0) - continue; - if (S_ISLNK(statbuf.st_mode)) - continue; - - value = udev_device_get_sysattr_value(device, dent->d_name); - if (value == NULL) - continue; - dbg(udev, "attr '%s'='%s'\n", dent->d_name, value); - - /* skip nonprintable attributes */ - len = strlen(value); - while (len > 0 && isprint(value[len-1])) - len--; - if (len > 0) { - dbg(udev, "attribute value of '%s' non-printable, skip\n", dent->d_name); - continue; - } - - printf(" %s{%s}==\"%s\"\n", key, dent->d_name, value); + struct udev_list_entry *sysattr; + + udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { + const char *name; + const char *value; + size_t len; + + /* skip symlinks */ + if (0 == strcmp("s", udev_list_entry_get_value(sysattr))) + continue; + + name = udev_list_entry_get_name(sysattr); + if (strcmp(name, "uevent") == 0) + continue; + if (strcmp(name, "dev") == 0) + continue; + + value = udev_device_get_sysattr_value(device, name); + if (value == NULL) + continue; + dbg(udev_device_get_udev(device), "attr '%s'='%s'\n", name, value); + + /* skip nonprintable attributes */ + len = strlen(value); + while (len > 0 && isprint(value[len-1])) + len--; + if (len > 0) { + dbg(udev_device_get_udev(device), + "attribute value of '%s' non-printable, skip\n", name); + continue; } - closedir(dir); + + printf(" %s{%s}==\"%s\"\n", key, name, value); } printf("\n"); } -- cgit v1.2.3-54-g00ecf From d53a3878d2e21cbaa0dec1c6b397ebac7057b090 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 4 Mar 2011 22:56:54 +0100 Subject: test-libudev: add short options --- libudev/test-libudev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index f8eb8e5d5a..5ff8663b90 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -426,7 +426,7 @@ int main(int argc, char *argv[]) for (;;) { int option; - option = getopt_long(argc, argv, "+dhV", options, NULL); + option = getopt_long(argc, argv, "+p:s:dhV", options, NULL); if (option == -1) break; -- cgit v1.2.3-54-g00ecf From 20bee04c19e49a0cef3bd7dfec9028270c46172b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 4 Mar 2011 23:00:52 +0100 Subject: libudev: udev_device_get_sysattr_list_entry() update --- libudev/libudev-device.c | 65 ++++++++++++++++++++---------------------------- udev/udevadm-info.c | 33 ++++++++++++++++-------- 2 files changed, 50 insertions(+), 48 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index af0bc2e5a3..8b8507c3a4 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -60,8 +60,8 @@ struct udev_device { size_t monitor_buf_len; struct udev_list_node devlinks_list; struct udev_list_node properties_list; + struct udev_list_node sysattr_value_list; struct udev_list_node sysattr_list; - struct udev_list_node available_sysattr_list; struct udev_list_node tags_list; unsigned long long int seqnum; unsigned long long int usec_initialized; @@ -84,7 +84,7 @@ struct udev_device { bool db_loaded; bool uevent_loaded; bool is_initialized; - bool sysattrs_cached; + bool sysattr_list_read; }; struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) @@ -362,8 +362,8 @@ struct udev_device *udev_device_new(struct udev *udev) udev_device->udev = udev; udev_list_init(&udev_device->devlinks_list); udev_list_init(&udev_device->properties_list); + udev_list_init(&udev_device->sysattr_value_list); udev_list_init(&udev_device->sysattr_list); - udev_list_init(&udev_device->available_sysattr_list); udev_list_init(&udev_device->tags_list); udev_device->event_timeout = -1; udev_device->watch_handle = -1; @@ -787,8 +787,8 @@ void udev_device_unref(struct udev_device *udev_device) free(udev_device->devtype); udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); udev_list_cleanup_entries(udev_device->udev, &udev_device->properties_list); + udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_value_list); udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); - udev_list_cleanup_entries(udev_device->udev, &udev_device->available_sysattr_list); udev_list_cleanup_entries(udev_device->udev, &udev_device->tags_list); free(udev_device->action); free(udev_device->driver); @@ -1166,7 +1166,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const return NULL; /* look for possibly already cached result */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_list)) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_value_list)) { if (strcmp(udev_list_entry_get_name(list_entry), sysattr) == 0) { dbg(udev_device->udev, "got '%s' (%s) from cache\n", sysattr, udev_list_entry_get_value(list_entry)); @@ -1177,7 +1177,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); if (lstat(path, &statbuf) != 0) { dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); - udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, NULL, 0, 0); + udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, NULL, 0, 0); goto out; } @@ -1201,7 +1201,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const if (pos != NULL) { pos = &pos[1]; dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, pos, 0, 0); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, pos, 0, 0); val = udev_list_entry_get_value(list_entry); } @@ -1233,22 +1233,21 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const value[size] = '\0'; util_remove_trailing_chars(value, '\n'); dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, sysattr, value, 0, 0); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, value, 0, 0); val = udev_list_entry_get_value(list_entry); out: return val; } -static int udev_device_cache_sysattrs(struct udev_device *udev_device) +static int udev_device_sysattr_list_read(struct udev_device *udev_device) { - struct dirent *entry; + struct dirent *dent; DIR *dir; int num = 0; if (udev_device == NULL) return -1; - /* caching already done? */ - if (udev_device->sysattrs_cached) + if (udev_device->sysattr_list_read) return 0; dir = opendir(udev_device_get_syspath(udev_device)); @@ -1258,37 +1257,28 @@ static int udev_device_cache_sysattrs(struct udev_device *udev_device) return -1; } - while (NULL != (entry = readdir(dir))) { + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { char path[UTIL_PATH_SIZE]; struct stat statbuf; /* only handle symlinks and regular files */ - if (DT_LNK != entry->d_type && DT_REG != entry->d_type) + if (dent->d_type != DT_LNK && dent->d_type != DT_REG) continue; - util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), - "/", entry->d_name, NULL); - if (0 != lstat(path, &statbuf)) + util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", dent->d_name, NULL); + if (lstat(path, &statbuf) != 0) continue; - - if (0 == (statbuf.st_mode & S_IRUSR)) + if ((statbuf.st_mode & S_IRUSR) == 0) continue; - if (DT_LNK == entry->d_type) { - if (strcmp(entry->d_name, "driver") != 0 && - strcmp(entry->d_name, "subsystem") != 0 && - strcmp(entry->d_name, "module") != 0) - continue; - } - udev_list_entry_add(udev_device->udev, - &udev_device->available_sysattr_list, entry->d_name, - DT_LNK == entry->d_type ? "s" : "r", 0, 0); - ++num; + udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, + dent->d_name, NULL, 0, 0); + num++; } - dbg(udev_device->udev, "found %d sysattrs for '%s'\n", num, - udev_device_get_syspath(udev_device)); - udev_device->sysattrs_cached = true; + closedir(dir); + dbg(udev_device->udev, "found %d sysattrs for '%s'\n", num, udev_device_get_syspath(udev_device)); + udev_device->sysattr_list_read = true; return num; } @@ -1298,22 +1288,21 @@ static int udev_device_cache_sysattrs(struct udev_device *udev_device) * @udev_device: udev device * * Retrieve the list of available sysattrs, with value being empty; - * This is to be able to read all available sysfs attributes for a particular - * device without the necessity to access sysfs from outside libudev. + * This just return all available sysfs attributes for a particular + * device without reading their values. * * Returns: the first entry of the property list **/ struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device) { - /* perform initial caching of sysattr list */ - if (!udev_device->sysattrs_cached) { + if (!udev_device->sysattr_list_read) { int ret; - ret = udev_device_cache_sysattrs(udev_device); + ret = udev_device_sysattr_list_read(udev_device); if (0 > ret) return NULL; } - return udev_list_get_entry(&udev_device->available_sysattr_list); + return udev_list_get_entry(&udev_device->sysattr_list); } int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index f60ad2c450..a231fd8d0b 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -31,37 +31,50 @@ #include "udev.h" +static bool skip_attribute(const char *name) +{ + char *skip[] = { + "uevent", + "dev", + "modalias", + "resource", + "driver", + "subsystem", + "module", + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(skip); i++) + if (strcmp(name, skip[i]) == 0) + return true; + return false; +} + static void print_all_attributes(struct udev_device *device, const char *key) { struct udev_list_entry *sysattr; udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { + struct udev *udev = udev_device_get_udev(device); const char *name; const char *value; size_t len; - /* skip symlinks */ - if (0 == strcmp("s", udev_list_entry_get_value(sysattr))) - continue; - name = udev_list_entry_get_name(sysattr); - if (strcmp(name, "uevent") == 0) - continue; - if (strcmp(name, "dev") == 0) + if (skip_attribute(name)) continue; value = udev_device_get_sysattr_value(device, name); if (value == NULL) continue; - dbg(udev_device_get_udev(device), "attr '%s'='%s'\n", name, value); + dbg(udev, "attr '%s'='%s'\n", name, value); /* skip nonprintable attributes */ len = strlen(value); while (len > 0 && isprint(value[len-1])) len--; if (len > 0) { - dbg(udev_device_get_udev(device), - "attribute value of '%s' non-printable, skip\n", name); + dbg(udev, "attribute value of '%s' non-printable, skip\n", name); continue; } -- cgit v1.2.3-54-g00ecf From 3e0a2c9a50d799fb623694de2f821f46ec01e2ae Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Mar 2011 06:26:39 +0100 Subject: libudev: resolve ifindex in udev_device_new_from_id_filename() --- libudev/libudev-device.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 8b8507c3a4..c78cf9b7a0 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -19,7 +19,11 @@ #include #include #include +#include #include +#include +#include +#include #include "libudev.h" #include "libudev-private.h" @@ -497,6 +501,35 @@ struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id if (sscanf(id, "%c%i:%i", &type, &maj, &min) != 3) return NULL; return udev_device_new_from_devnum(udev, type, makedev(maj, min)); + case 'n': { + int sk; + struct ifreq ifr; + struct udev_device *dev; + int ifindex; + + ifindex = strtoul(&id[1], NULL, 10); + if (ifindex <= 0) + return NULL; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) + return NULL; + memset(&ifr, 0x00, sizeof(struct ifreq)); + ifr.ifr_ifindex = ifindex; + if (ioctl(sk, SIOCGIFNAME, &ifr) != 0) { + close(sk); + return NULL; + } + close(sk); + + dev = udev_device_new_from_subsystem_sysname(udev, "net", ifr.ifr_name); + if (dev == NULL) + return NULL; + if (udev_device_get_ifindex(dev) == ifindex) + return dev; + udev_device_unref(dev); + return NULL; + } case '+': util_strscpy(subsys, sizeof(subsys), &id[1]); sysname = strchr(subsys, ':'); -- cgit v1.2.3-54-g00ecf From 218e47ae0fcacd767d0469ff1f069fadf3dffe28 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 5 Mar 2011 06:27:31 +0100 Subject: libudev: bump minor version --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index a0967ab207..62c3bdbd97 100644 --- a/Makefile.am +++ b/Makefile.am @@ -34,9 +34,9 @@ DISTCHECK_HOOKS = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=10 +LIBUDEV_CURRENT=11 LIBUDEV_REVISION=0 -LIBUDEV_AGE=10 +LIBUDEV_AGE=11 SUBDIRS += libudev/docs -- cgit v1.2.3-54-g00ecf From 37d3d6abdec495769d4c92f3ba1b4c1b1936a831 Mon Sep 17 00:00:00 2001 From: Andrey Borzenkov Date: Sun, 6 Mar 2011 12:01:22 +0300 Subject: udev-acl: add /dev/sgX nodes for CD-ROM Current wine is using /dev/sgX to access CD-ROM devices. Since distributions switched to using ACL instead of group membership to control device access, wine is not able to access them. Add ACL to device nodes that already get GROUP="cdrom". Ref: https://qa.mandriva.com/show_bug.cgi?id=62114 Signed-off-by: Andrey Borzenkov --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 0717d25d09..b0015b61d8 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -63,6 +63,9 @@ ENV{DDC_DEVICE}=="*?", TAG+="udev-acl" # media player raw devices (for user-mode drivers, Android SDK, etc.) SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="udev-acl" +# /dev/sgX nodes for CD-ROM drives +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="udev-acl" + # apply ACL for all locally logged in users LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" -- cgit v1.2.3-54-g00ecf From 71e65e8683b00b72a6bce33f0e2a3f6d1ac9f7b8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Mar 2011 16:10:50 +0100 Subject: udev-acl: move sg rule to optical drive rule --- extras/udev-acl/70-acl.rules | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index b0015b61d8..dd5a7ab135 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -21,6 +21,7 @@ ENV{ID_HPLIP}=="1", TAG+="udev-acl" # optical drives SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="udev-acl" # sound devices SUBSYSTEM=="sound", TAG+="udev-acl" @@ -63,9 +64,6 @@ ENV{DDC_DEVICE}=="*?", TAG+="udev-acl" # media player raw devices (for user-mode drivers, Android SDK, etc.) SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="udev-acl" -# /dev/sgX nodes for CD-ROM drives -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="udev-acl" - # apply ACL for all locally logged in users LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" -- cgit v1.2.3-54-g00ecf From 74e8a45ed414c25064bb2a1ffd0f27f5bd5280a6 Mon Sep 17 00:00:00 2001 From: Thomas Egerer Date: Tue, 8 Mar 2011 09:57:17 +0100 Subject: udevadm: info - make attribute array static and const --- udev/udevadm-info.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index a231fd8d0b..187e74d50e 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -33,7 +33,7 @@ static bool skip_attribute(const char *name) { - char *skip[] = { + static const char const *skip[] = { "uevent", "dev", "modalias", -- cgit v1.2.3-54-g00ecf From 52d54f237d8b5380b0573242702606bf2ec5b7ab Mon Sep 17 00:00:00 2001 From: "Lee, Chun-Yi" Date: Thu, 10 Mar 2011 10:17:12 +0800 Subject: Remap MSI Laptop touchpad on/off key to F22 and F23 MSI Laptop driver will query the real touchpad state then emit KEY_TOUCHPAD_ON/OFF key. Currently, X has defined F22 for touchpad on and F23 for touchpad off. This patch aligns MSI Laptop driver's key with F22 and F23. Tested on MSI U160 netbook using msi-laptop driver. Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 7f849d3027..0c3ae38d71 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -47,6 +47,7 @@ ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+ ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys", RUN+="keymap $name 0x6B f21" ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC Hotkey Driver", RUN+="keymap $name 0x37 f21" ENV{DMI_VENDOR}=="Acer*", KERNELS=="input*", ATTRS{name}=="Acer WMI hotkeys", RUN+="keymap $name 0x82 f21" +ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", KERNELS=="input*", ATTRS{name}=="MSI Laptop hotkeys", RUN+="keymap $name 0x213 f22 0x214 f23" # Older Vaios have some different keys ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" -- cgit v1.2.3-54-g00ecf From 5f59fa0900a5c127ce1a25d8ba3176f166662f96 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 15 Mar 2011 17:26:08 +0100 Subject: move /dev/.udev/ to /dev/.run/udev/ and convert old udev database at udevd startup --- Makefile.am | 2 +- NEWS | 12 +++++ extras/collect/collect.c | 2 +- extras/firmware/firmware.c | 2 +- libudev/libudev-device-private.c | 6 +-- libudev/libudev-device.c | 46 +++++++++++-------- libudev/libudev-enumerate.c | 2 +- libudev/libudev-private.h | 2 +- libudev/libudev-queue-private.c | 10 ++-- libudev/libudev-queue.c | 4 +- udev/udev-event.c | 4 +- udev/udev-node.c | 2 +- udev/udev-rules.c | 2 +- udev/udev-watch.c | 10 ++-- udev/udev.xml | 2 +- udev/udevadm-info.c | 65 -------------------------- udev/udevadm.xml | 9 ---- udev/udevd.c | 98 +++++++++++++++++++++++++++++++++++++++- 18 files changed, 160 insertions(+), 120 deletions(-) diff --git a/Makefile.am b/Makefile.am index 62c3bdbd97..15d1636fd6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ DISTCHECK_HOOKS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=11 -LIBUDEV_REVISION=0 +LIBUDEV_REVISION=1 LIBUDEV_AGE=11 SUBDIRS += libudev/docs diff --git a/NEWS b/NEWS index b5008dbf28..fcb6c75dcf 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,18 @@ udev 167 ======== Bugfixes. +The udev runtime data moved from /dev/.udev/ to /dev/.run/udev/. +On new systems the tmpfs mountpoint /var/run/ will have an +"early-boot alias" /dev/.run/ where udev and a couple of other +early-boot tools will put their runtime data. +On systems with LVM used, packagers must make sure, that the +initramfs creates the /dev/.run/ mountpoint for udev to store +the data, so that the real root will not overmount it, which +would make it invisible. + +The command 'udevadm info --convert-db' is gone. The udev daemon +itself, at startup, converts any old database version if necessary. + udev 166 ======== Bugfixes. diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 0069dea0df..b5670516b4 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -34,7 +34,7 @@ #include "libudev.h" #include "libudev-private.h" -#define TMPFILE "/dev/.udev/collect" +#define TMPFILE "/dev/.run/udev/collect" #define BUFSIZE 16 #define UDEV_ALARM_TIMEOUT 180 diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c index 76593bad30..f7d21df6d0 100644 --- a/extras/firmware/firmware.c +++ b/extras/firmware/firmware.c @@ -147,7 +147,7 @@ int main(int argc, char **argv) } util_path_encode(firmware, fwencpath, sizeof(fwencpath)); - util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.udev/firmware-missing/", fwencpath, NULL); + util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.run/udev/firmware-missing/", fwencpath, NULL); util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); if (fwfile == NULL) { diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 3afa82e04f..7683f09857 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -31,7 +31,7 @@ static void udev_device_tag(struct udev_device *dev, const char *tag, bool add) id = udev_device_get_id_filename(dev); if (id == NULL) return; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/tags/", tag, "/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/tags/", tag, "/", id, NULL); if (add) { int fd; @@ -115,7 +115,7 @@ int udev_device_update_db(struct udev_device *udev_device) return -1; has_info = device_has_info(udev_device); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/db3/", id, NULL); /* do not store anything for otherwise empty devices */ if (!has_info && @@ -176,7 +176,7 @@ int udev_device_delete_db(struct udev_device *udev_device) id = udev_device_get_id_filename(udev_device); if (id == NULL) return -1; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/db3/", id, NULL); unlink(filename); return 0; } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index c78cf9b7a0..dd0224ae4b 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -237,24 +237,30 @@ const char *udev_device_get_property_value(struct udev_device *udev_device, cons return udev_list_entry_get_value(list_entry); } -int udev_device_read_db(struct udev_device *udev_device) +int udev_device_read_db(struct udev_device *udev_device, const char *dbfile) { - const char *id; char filename[UTIL_PATH_SIZE]; char line[UTIL_LINE_SIZE]; FILE *f; - if (udev_device->db_loaded) - return 0; - udev_device->db_loaded = true; + /* providing a database file will always force-load it */ + if (dbfile == NULL) { + const char *id; - id = udev_device_get_id_filename(udev_device); - if (id == NULL) - return -1; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/.udev/db/", id, NULL); - f = fopen(filename, "re"); + if (udev_device->db_loaded) + return 0; + udev_device->db_loaded = true; + + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/.run/udev/db3/", id, NULL); + dbfile = filename; + } + + f = fopen(dbfile, "re"); if (f == NULL) { - info(udev_device->udev, "no db file to read %s: %m\n", filename); + info(udev_device->udev, "no db file to read %s: %m\n", dbfile); return -1; } udev_device->is_initialized = true; @@ -908,7 +914,7 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) return NULL; if (!udev_device->info_loaded) { udev_device_read_uevent_file(udev_device); - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); } /* we might get called before we handled an event and have a db, use the kernel-provided name */ @@ -1002,7 +1008,7 @@ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device * if (udev_device == NULL) return NULL; if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); return udev_list_get_entry(&udev_device->devlinks_list); } @@ -1030,7 +1036,7 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device return NULL; if (!udev_device->info_loaded) { udev_device_read_uevent_file(udev_device); - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); } if (!udev_device->devlinks_uptodate) { char symlinks[UTIL_PATH_SIZE]; @@ -1154,7 +1160,7 @@ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device if (udev_device == NULL) return 0; if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); if (udev_device->usec_initialized == 0) return 0; now = usec_monotonic(); @@ -1471,7 +1477,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device) int udev_device_get_is_initialized(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); return udev_device->is_initialized; } @@ -1519,7 +1525,7 @@ int udev_device_has_tag(struct udev_device *udev_device, const char *tag) struct udev_list_entry *list_entry; if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); list_entry = udev_device_get_tags_list_entry(udev_device); list_entry = udev_list_entry_get_by_name(list_entry, tag); if (list_entry != NULL) @@ -1689,7 +1695,7 @@ int udev_device_set_timeout(struct udev_device *udev_device, int timeout) int udev_device_get_event_timeout(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); return udev_device->event_timeout; } @@ -1729,7 +1735,7 @@ int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) int udev_device_get_devlink_priority(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); return udev_device->devlink_priority; } @@ -1742,7 +1748,7 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) int udev_device_get_watch_handle(struct udev_device *udev_device) { if (!udev_device->info_loaded) - udev_device_read_db(udev_device); + udev_device_read_db(udev_device, NULL); return udev_device->watch_handle; } diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 128813c7d6..d3dd5c963f 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -751,7 +751,7 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) struct dirent *dent; char path[UTIL_PATH_SIZE]; - util_strscpyl(path, sizeof(path), udev_get_dev_path(udev), "/.udev/tags/", + util_strscpyl(path, sizeof(path), udev_get_dev_path(udev), "/.run/udev/tags/", udev_list_entry_get_name(list_entry), NULL); dir = opendir(path); if (dir == NULL) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index f95be53df7..0fe6f4a6bf 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -78,7 +78,7 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device); char **udev_device_get_properties_envp(struct udev_device *udev_device); ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); -int udev_device_read_db(struct udev_device *udev_device); +int udev_device_read_db(struct udev_device *udev_device, const char *dbfile); int udev_device_read_uevent_file(struct udev_device *udev_device); int udev_device_set_action(struct udev_device *udev_device, const char *action); int udev_device_set_driver(struct udev_device *udev_device, const char *driver); diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 06dc2f5e0e..9b02daf0a4 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -103,10 +103,10 @@ void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) { char filename[UTIL_PATH_SIZE]; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.run/udev/queue.tmp", NULL); unlink(filename); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.run/udev/queue.bin", NULL); unlink(filename); } @@ -221,7 +221,7 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) } /* create new queue file */ - util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.tmp", NULL); + util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_dev_path(udev_queue_export->udev), "/.run/udev/queue.tmp", NULL); new_queue_file = fopen(filename_tmp, "w+"); if (new_queue_file == NULL) goto error; @@ -255,7 +255,7 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) goto error; /* rename the new file on top of the old one */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.udev/queue.bin", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.run/udev/queue.bin", NULL); if (rename(filename_tmp, filename) != 0) goto error; @@ -401,7 +401,7 @@ static void update_failed(struct udev_queue_export *udev_queue_export, return; /* location of failed file */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/failed/", + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/failed/", udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); switch (state) { diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index 163e6229fe..6f743d2061 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -214,7 +214,7 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i char filename[UTIL_PATH_SIZE]; FILE *queue_file; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.udev/queue.bin", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.run/udev/queue.bin", NULL); queue_file = fopen(filename, "re"); if (queue_file == NULL) return NULL; @@ -484,7 +484,7 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev if (udev_queue == NULL) return NULL; udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); - util_strscpyl(path, sizeof(path), udev_get_dev_path(udev_queue->udev), "/.udev/failed", NULL); + util_strscpyl(path, sizeof(path), udev_get_dev_path(udev_queue->udev), "/.run/udev/failed", NULL); dir = opendir(path); if (dir == NULL) return NULL; diff --git a/udev/udev-event.c b/udev/udev-event.c index 100a79c1e8..137ba36776 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -539,7 +539,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) return -1; if (strcmp(udev_device_get_action(dev), "remove") == 0) { - udev_device_read_db(dev); + udev_device_read_db(dev, NULL); udev_device_delete_db(dev); udev_device_tag_index(dev, NULL, false); @@ -553,7 +553,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) } else { event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); if (event->dev_db != NULL) { - udev_device_read_db(event->dev_db); + udev_device_read_db(event->dev_db, NULL); udev_device_set_info_loaded(event->dev_db); /* disable watch during event processing */ diff --git a/udev/udev-node.c b/udev/udev-node.c index 0ceb1d5110..aaa2e32e65 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -292,7 +292,7 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); - util_strscpyl(dirname, sizeof(dirname), udev_get_dev_path(udev), "/.udev/links/", name_enc, NULL); + util_strscpyl(dirname, sizeof(dirname), udev_get_dev_path(udev), "/.run/udev/links/", name_enc, NULL); util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); if (!add) { diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 6b473c4c2e..4a5b8debca 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1803,7 +1803,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); /* read dynamic/temporary rules */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/rules.d", NULL); udev_list_init(&sort_list); add_matching_files(udev, &sort_list, filename, ".rules"); diff --git a/udev/udev-watch.c b/udev/udev-watch.c index f51a10dcab..47dca4c6e6 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -54,8 +54,8 @@ void udev_watch_restore(struct udev *udev) if (inotify_fd < 0) return; - util_strscpyl(oldname, sizeof(oldname), udev_get_dev_path(udev), "/.udev/watch.old", NULL); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/watch", NULL); + util_strscpyl(oldname, sizeof(oldname), udev_get_dev_path(udev), "/.run/udev/watch.old", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/watch", NULL); if (rename(filename, oldname) == 0) { DIR *dir; struct dirent *ent; @@ -118,7 +118,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) return; } - snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); + snprintf(filename, sizeof(filename), "%s/.run/udev/watch/%d", udev_get_dev_path(udev), wd); util_create_path(udev, filename); unlink(filename); symlink(udev_device_get_id_filename(dev), filename); @@ -141,7 +141,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev) info(udev, "removing watch on '%s'\n", udev_device_get_devnode(dev)); inotify_rm_watch(inotify_fd, wd); - snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); + snprintf(filename, sizeof(filename), "%s/.run/udev/watch/%d", udev_get_dev_path(udev), wd); unlink(filename); udev_device_set_watch_handle(dev, -1); @@ -158,7 +158,7 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd) if (inotify_fd < 0 || wd < 0) return NULL; - snprintf(filename, sizeof(filename), "%s/.udev/watch/%d", udev_get_dev_path(udev), wd); + snprintf(filename, sizeof(filename), "%s/.run/udev/watch/%d", udev_get_dev_path(udev), wd); s = majmin; l = util_strpcpy(&s, sizeof(majmin), udev_get_sys_path(udev)); len = readlink(filename, s, l); diff --git a/udev/udev.xml b/udev/udev.xml index 3ef4103325..452abc5c0d 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -73,7 +73,7 @@ The udev rules are read from the files located in the default rules directory /lib/udev/rules.d/, the custom rules directory /etc/udev/rules.d/ - and the temporary rules directory /dev/.udev/rules.d/. + and the temporary rules directory /var/run/udev/rules.d/. All rule files are sorted and processed in lexical order, regardless in which of these directories they live. Files in /etc/udev/rules.d/ have precedence over files with diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 187e74d50e..33d113c5b1 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -200,66 +200,6 @@ static int export_devices(struct udev *udev) return 0; } -static int convert_db(struct udev *udev) -{ - struct udev_enumerate *udev_enumerate; - struct udev_list_entry *list_entry; - - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_devices(udev_enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device != NULL) { - const char *id; - struct stat stats; - char to[UTIL_PATH_SIZE]; - char devpath[UTIL_PATH_SIZE]; - char from[UTIL_PATH_SIZE]; - - id = udev_device_get_id_filename(device); - if (id == NULL) { - udev_device_unref(device); - continue; - } - util_strscpyl(to, sizeof(to), udev_get_dev_path(udev), "/.udev/db/", id, NULL); - - /* find old database with $subsys:$sysname */ - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), - "/.udev/db/", udev_device_get_subsystem(device), ":", - udev_device_get_sysname(device), NULL); - if (lstat(from, &stats) == 0) { - if (lstat(to, &stats) == 0) - unlink(from); - else - rename(from, to); - } - - /* find old database with the encoded devpath */ - util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), - "/.udev/db/", devpath, NULL); - if (lstat(from, &stats) == 0) { - if (lstat(to, &stats) == 0) - unlink(from); - else - rename(from, to); - } - - /* read the old database, and write out a new one */ - udev_device_read_db(device); - udev_device_update_db(device); - - udev_device_unref(device); - } - } - udev_enumerate_unref(udev_enumerate); - return 0; -} - int udevadm_info(struct udev *udev, int argc, char *argv[]) { struct udev_device *device = NULL; @@ -277,7 +217,6 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) { "query", required_argument, NULL, 'q' }, { "attribute-walk", no_argument, NULL, 'a' }, { "export-db", no_argument, NULL, 'e' }, - { "convert-db", no_argument, NULL, 'C' }, { "root", no_argument, NULL, 'r' }, { "device-id-of-file", required_argument, NULL, 'd' }, { "export", no_argument, NULL, 'x' }, @@ -402,9 +341,6 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case 'e': export_devices(udev); goto exit; - case 'C': - convert_db(udev); - goto exit; case 'x': export = true; break; @@ -431,7 +367,6 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) " --export export key/value pairs\n" " --export-prefix export the key name with a prefix\n" " --export-db export the content of the udev database\n" - " --convert-db convert older version of database without a reboot\n" " --help\n\n"); goto exit; default: diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 00f299fb73..cefd7763af 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -143,15 +143,6 @@ Export the content of the udev database. - - - - Convert the database of an earlier udev version to the current format. This - is only useful on udev version upgrades, where the content of the old database might - be needed for the running system, and it is not sufficient for it, to be re-created - with the next bootup. - - diff --git a/udev/udevd.c b/udev/udevd.c index aa2e3657f0..fe0e3c3929 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -971,6 +971,99 @@ static int mem_size_mb(void) return memsize; } +static int convert_db(struct udev *udev) +{ + char filename[UTIL_PATH_SIZE]; + FILE *f; + struct udev_enumerate *udev_enumerate; + struct udev_list_entry *list_entry; + + /* current database */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/db3", NULL); + if (access(filename, F_OK) >= 0) + return 0; + + /* make sure we do not get here again */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/db3/", NULL); + util_create_path(udev, filename); + + /* old database */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db", NULL); + if (access(filename, F_OK) < 0) + return 0; + + f = fopen("/dev/kmsg", "w"); + if (f != NULL) { + fprintf(f, "<6>udev[%u]: converting old udev database\n", getpid()); + fclose(f); + } + + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_devices(udev_enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + + /* try to find the old database for devices without a current one */ + if (udev_device_read_db(device, NULL) < 0) { + bool have_db; + const char *id; + struct stat stats; + char devpath[UTIL_PATH_SIZE]; + char from[UTIL_PATH_SIZE]; + + have_db = false; + + /* find database in old location */ + id = udev_device_get_id_filename(device); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", id, NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* find old database with $subsys:$sysname name */ + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), + "/.udev/db/", udev_device_get_subsystem(device), ":", + udev_device_get_sysname(device), NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* find old database with the encoded devpath name */ + util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), + "/.udev/db/", devpath, NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* write out new database */ + if (have_db) + udev_device_update_db(device); + } + udev_device_unref(device); + } + udev_enumerate_unref(udev_enumerate); + return 0; +} + int main(int argc, char *argv[]) { struct udev *udev; @@ -1159,7 +1252,7 @@ int main(int argc, char *argv[]) IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/rules.d", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/rules.d", NULL); if (stat(filename, &statbuf) != 0) { util_create_path(udev, filename); udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); @@ -1203,6 +1296,9 @@ int main(int argc, char *argv[]) goto exit; } + /* if needed, convert old database from earlier udev version */ + convert_db(udev); + if (!debug) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); -- cgit v1.2.3-54-g00ecf From 98ab6a377285d5943563cfa397e8b350e43878ec Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 15 Mar 2011 12:05:00 -0400 Subject: cdrom_id: Don't ignore profiles when there is no media available Just because the GET CONFIGURATION MMC-2 command returns the current profile as 0 does not mean that we can ignore the profiles describing the capabilities of the drive - it only means that there currently is no recognized media in the drive. Therefore, do process the returned profiles even when cur_profile is 0. This fixes a bug where only ID_CDROM=1 ID_CDROM_CD_R=1 ID_CDROM_CD_RW=1 ID_CDROM_DVD=1 ID_CDROM_DVD_R=1 ID_CDROM_DVD_RAM=1 was returned when there is no media in the drive instead of ID_CDROM=1 ID_CDROM_CD=1 ID_CDROM_CD_R=1 ID_CDROM_CD_RW=1 ID_CDROM_DVD=1 ID_CDROM_DVD_R=1 ID_CDROM_DVD_RW=1 ID_CDROM_DVD_RAM=1 ID_CDROM_DVD_PLUS_R=1 ID_CDROM_DVD_PLUS_RW=1 ID_CDROM_DVD_PLUS_R_DL=1 ID_CDROM_BD=1 ID_CDROM_BD_R=1 ID_CDROM_BD_RE=1 ID_CDROM_HDDVD=1 as is returned now. Signed-off-by: David Zeuthen --- extras/cdrom_id/cdrom_id.c | 237 ++++++++++++++++++++++++--------------------- 1 file changed, 124 insertions(+), 113 deletions(-) diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 4a58a49030..b2f897e3b5 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -261,6 +261,115 @@ static int cd_inquiry(struct udev *udev, int fd) { return 0; } +static void feature_profile_media(struct udev *udev, int cur_profile) +{ + switch (cur_profile) { + case 0x03: + case 0x04: + case 0x05: + info(udev, "profile 0x%02x \n", cur_profile); + cd_media = 1; + cd_media_mo = 1; + break; + case 0x08: + info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); + cd_media = 1; + cd_media_cd_rom = 1; + break; + case 0x09: + info(udev, "profile 0x%02x media_cd_r\n", cur_profile); + cd_media = 1; + cd_media_cd_r = 1; + break; + case 0x0a: + info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); + cd_media = 1; + cd_media_cd_rw = 1; + break; + case 0x10: + info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rom = 1; + break; + case 0x11: + info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_r = 1; + break; + case 0x12: + info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); + cd_media = 1; + cd_media_dvd_ram = 1; + break; + case 0x13: + info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_ro = 1; + break; + case 0x14: + info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_seq = 1; + break; + case 0x1B: + info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r = 1; + break; + case 0x1A: + info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw = 1; + break; + case 0x2A: + info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw_dl = 1; + break; + case 0x2B: + info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r_dl = 1; + break; + case 0x40: + info(udev, "profile 0x%02x media_bd\n", cur_profile); + cd_media = 1; + cd_media_bd = 1; + break; + case 0x41: + case 0x42: + info(udev, "profile 0x%02x media_bd_r\n", cur_profile); + cd_media = 1; + cd_media_bd_r = 1; + break; + case 0x43: + info(udev, "profile 0x%02x media_bd_re\n", cur_profile); + cd_media = 1; + cd_media_bd_re = 1; + break; + case 0x50: + info(udev, "profile 0x%02x media_hddvd\n", cur_profile); + cd_media = 1; + cd_media_hddvd = 1; + break; + case 0x51: + info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); + cd_media = 1; + cd_media_hddvd_r = 1; + break; + case 0x52: + info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); + cd_media = 1; + cd_media_hddvd_rw = 1; + break; + default: + info(udev, "profile 0x%02x \n", cur_profile); + break; + } +} + static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) { unsigned int i; @@ -350,6 +459,7 @@ static int feature_profiles(struct udev *udev, const unsigned char *profiles, si return 0; } +/* returns 0 if media was detected */ static int cd_profiles_old_mmc(struct udev *udev, int fd) { struct scsi_cmd sc; @@ -389,6 +499,7 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd) return 0; } +/* returns 0 if media was detected */ static int cd_profiles(struct udev *udev, int fd) { struct scsi_cmd sc; @@ -397,6 +508,9 @@ static int cd_profiles(struct udev *udev, int fd) unsigned int len; unsigned int i; int err; + int ret; + + ret = -1; /* First query the current profile */ scsi_cmd_init(udev, &sc, features, sizeof(features)); @@ -410,126 +524,20 @@ static int cd_profiles(struct udev *udev, int fd) if (SK(err) == 0x5 && ASC(err) == 0x20) { info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n"); info(udev, "trying to work around the problem\n"); - return cd_profiles_old_mmc(udev, fd); + ret = cd_profiles_old_mmc(udev, fd); } - return -1; + goto out; } cur_profile = features[6] << 8 | features[7]; if (cur_profile > 0) { info(udev, "current profile 0x%02x\n", cur_profile); + feature_profile_media (udev, cur_profile); + ret = 0; /* we have media */ } else { info(udev, "no current profile, assuming no media\n"); - return -1; } - switch (cur_profile) { - case 0x03: - case 0x04: - case 0x05: - info(udev, "profile 0x%02x \n", cur_profile); - cd_media = 1; - cd_media_mo = 1; - break; - case 0x08: - info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); - cd_media = 1; - cd_media_cd_rom = 1; - break; - case 0x09: - info(udev, "profile 0x%02x media_cd_r\n", cur_profile); - cd_media = 1; - cd_media_cd_r = 1; - break; - case 0x0a: - info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); - cd_media = 1; - cd_media_cd_rw = 1; - break; - case 0x10: - info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rom = 1; - break; - case 0x11: - info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_r = 1; - break; - case 0x12: - info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); - cd_media = 1; - cd_media_dvd_ram = 1; - break; - case 0x13: - info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_ro = 1; - break; - case 0x14: - info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_seq = 1; - break; - case 0x1B: - info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r = 1; - break; - case 0x1A: - info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw = 1; - break; - case 0x2A: - info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw_dl = 1; - break; - case 0x2B: - info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r_dl = 1; - break; - case 0x40: - info(udev, "profile 0x%02x media_bd\n", cur_profile); - cd_media = 1; - cd_media_bd = 1; - break; - case 0x41: - case 0x42: - info(udev, "profile 0x%02x media_bd_r\n", cur_profile); - cd_media = 1; - cd_media_bd_r = 1; - break; - case 0x43: - info(udev, "profile 0x%02x media_bd_re\n", cur_profile); - cd_media = 1; - cd_media_bd_re = 1; - break; - case 0x50: - info(udev, "profile 0x%02x media_hddvd\n", cur_profile); - cd_media = 1; - cd_media_hddvd = 1; - break; - case 0x51: - info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); - cd_media = 1; - cd_media_hddvd_r = 1; - break; - case 0x52: - info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); - cd_media = 1; - cd_media_hddvd_rw = 1; - break; - default: - info(udev, "profile 0x%02x \n", cur_profile); - break; - } - - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); @@ -577,8 +585,8 @@ static int cd_profiles(struct udev *udev, int fd) break; } } - - return 0; +out: + return ret; } static int cd_media_info(struct udev *udev, int fd) @@ -905,9 +913,12 @@ int main(int argc, char *argv[]) goto print; /* read drive and possibly current profile */ - if (cd_profiles(udev, fd) < 0) + if (cd_profiles(udev, fd) != 0) goto print; + /* at this point we are guaranteed to have media in the + * drive - find out more about it */ + /* get session/track info */ cd_media_toc(udev, fd); -- cgit v1.2.3-54-g00ecf From e68b4c2857942257268134cf7028b80f5a6a8103 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Mar 2011 18:58:03 +0100 Subject: NEWS: clarify /dev/.run/ requirements --- NEWS | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index fcb6c75dcf..8da1cd9ed2 100644 --- a/NEWS +++ b/NEWS @@ -3,13 +3,15 @@ udev 167 Bugfixes. The udev runtime data moved from /dev/.udev/ to /dev/.run/udev/. -On new systems the tmpfs mountpoint /var/run/ will have an -"early-boot alias" /dev/.run/ where udev and a couple of other -early-boot tools will put their runtime data. -On systems with LVM used, packagers must make sure, that the -initramfs creates the /dev/.run/ mountpoint for udev to store -the data, so that the real root will not overmount it, which -would make it invisible. +On systemd systems the tmpfs mountpoint /var/run/ will have a +permanent "early-boot alias" /dev/.run/, where udev and a couple +of other early-boot tools will put their runtime data. + +On systemd systems with LVM used, packagers must make sure, that +the systemd and initramfs version match. The initramfs needs to +create the /dev/.run/ mountpoint for udev to store the data, so +that systemd will not overmount it, which would make the udev +data from initramfs invisible. The command 'udevadm info --convert-db' is gone. The udev daemon itself, at startup, converts any old database version if necessary. -- cgit v1.2.3-54-g00ecf From 5e199245f2d2fd03c2586a7f1140300b073a4abe Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 17 Mar 2011 20:36:20 +0100 Subject: udev-acl/70-acl.rules: tag ID_REMOTE_CONTROL with acl Used by "concordance" to access Logitech Harmony programmable remote controls. http://www.phildev.net/concordance/ --- extras/udev-acl/70-acl.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index dd5a7ab135..037349dabd 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -52,6 +52,9 @@ ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" # PDA devices ENV{ID_PDA}=="*?", TAG+="udev-acl" +# Programmable remote control +ENV{ID_REMOTE_CONTROL}=="1", TAG+="udev-acl" + # joysticks SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" -- cgit v1.2.3-54-g00ecf From 7a86845ba10782da3052506095cd591c1fc6cf96 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 18 Mar 2011 13:32:55 +0100 Subject: input_id: Consistently use tabs for indentation --- extras/input_id/input_id.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 602c90d0c4..85664ab479 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -43,32 +43,32 @@ * @param bitmask: Output array; must have max_size elements */ static void get_cap_mask (struct udev_device *dev, const char* attr, - unsigned long *bitmask, size_t max_size) + unsigned long *bitmask, size_t max_size) { char text[4096]; - int i; + int i; char* word; unsigned long val; snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(dev, attr)); - memset (bitmask, 0, max_size); + memset (bitmask, 0, max_size); i = 0; - while ((word = strrchr(text, ' ')) != NULL) { - val = strtoul (word+1, NULL, 16); - bitmask[i] = val; + while ((word = strrchr(text, ' ')) != NULL) { + val = strtoul (word+1, NULL, 16); + bitmask[i] = val; *word = '\0'; ++i; - } + } val = strtoul (text, NULL, 16); bitmask[i] = val; } /* pointer devices */ static void test_pointers (const unsigned long* bitmask_ev, - const unsigned long* bitmask_abs, - const unsigned long* bitmask_key, - const unsigned long* bitmask_rel) + const unsigned long* bitmask_abs, + const unsigned long* bitmask_key, + const unsigned long* bitmask_rel) { int is_mouse = 0; int is_touchpad = 0; @@ -77,7 +77,7 @@ static void test_pointers (const unsigned long* bitmask_ev, return; if (test_bit (EV_ABS, bitmask_ev) && - test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { + test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) puts("ID_INPUT_TABLET=1"); else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) @@ -107,15 +107,15 @@ static void test_pointers (const unsigned long* bitmask_ev, /* key like devices */ static void test_key (const unsigned long* bitmask_ev, - const unsigned long* bitmask_key) + const unsigned long* bitmask_key) { unsigned i; unsigned long acc; unsigned long mask; /* do we have any KEY_* capability? */ - if (!test_bit (EV_KEY, bitmask_ev)) - return; + if (!test_bit (EV_KEY, bitmask_ev)) + return; acc = 0; for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) @@ -139,7 +139,7 @@ int main (int argc, char** argv) unsigned long bitmask_ev[NBITS(EV_MAX)]; unsigned long bitmask_abs[NBITS(ABS_MAX)]; unsigned long bitmask_key[NBITS(KEY_MAX)]; - unsigned long bitmask_rel[NBITS(REL_MAX)]; + unsigned long bitmask_rel[NBITS(REL_MAX)]; if (argc != 2) { fprintf(stderr, "Usage: %s \n", argv[0]); -- cgit v1.2.3-54-g00ecf From 941c40bdc47d1fdee651558dd0e162cd8d674fab Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 18 Mar 2011 13:42:02 +0100 Subject: input_id: Add some debugging output If $DEBUG is set, output the capability bitmaps to stderr. --- extras/input_id/input_id.c | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 85664ab479..20191599d1 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -36,23 +36,28 @@ #define LONG(x) ((x)/BITS_PER_LONG) #define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) +static int debug = 0; +#define DBG(format, args...) { if (debug) fprintf(stderr, format, ##args); } + /* * Read a capability attribute and return bitmask. * @param dev udev_device * @param attr sysfs attribute name (e. g. "capabilities/key") - * @param bitmask: Output array; must have max_size elements + * @param bitmask: Output array which has a sizeof of bitmask_size */ static void get_cap_mask (struct udev_device *dev, const char* attr, - unsigned long *bitmask, size_t max_size) + unsigned long *bitmask, size_t bitmask_size) { char text[4096]; - int i; + unsigned i; char* word; unsigned long val; snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(dev, attr)); - memset (bitmask, 0, max_size); + DBG("%s raw kernel attribute: %s\n", attr, text); + + memset (bitmask, 0, bitmask_size); i = 0; while ((word = strrchr(text, ' ')) != NULL) { val = strtoul (word+1, NULL, 16); @@ -62,6 +67,18 @@ static void get_cap_mask (struct udev_device *dev, const char* attr, } val = strtoul (text, NULL, 16); bitmask[i] = val; + + if (debug) { + /* printf pattern with the right unsigned long number of hex chars */ + snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2*sizeof(unsigned long)); + DBG("%s decoded bit map:\n", attr); + val = bitmask_size/sizeof (unsigned long); + /* skip over leading zeros */ + while (bitmask[val-1] == 0 && val > 0) + --val; + for (i = 0; i < val; ++i) + DBG(text, i * BITS_PER_LONG, bitmask[i]); + } } /* pointer devices */ @@ -110,17 +127,22 @@ static void test_key (const unsigned long* bitmask_ev, const unsigned long* bitmask_key) { unsigned i; - unsigned long acc; + unsigned long found; unsigned long mask; /* do we have any KEY_* capability? */ - if (!test_bit (EV_KEY, bitmask_ev)) + if (!test_bit (EV_KEY, bitmask_ev)) { + DBG("test_key: no EV_KEY capability\n"); return; + } - acc = 0; - for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) - acc |= bitmask_key[i]; - if (acc > 0) + /* only consider KEY_* here, not BTN_* */ + found = 0; + for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) { + found |= bitmask_key[i]; + DBG("test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); + } + if (found > 0) puts("ID_INPUT_KEY=1"); /* the first 32 bits are ESC, numbers, and Q to D; if we have all of @@ -146,6 +168,9 @@ int main (int argc, char** argv) exit(1); } + if (getenv ("DEBUG")) + debug = 1; + /* get the device */ udev = udev_new(); if (udev == NULL) -- cgit v1.2.3-54-g00ecf From 88149f668ea7ac23c61f6d1982db4f4517da763c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 18 Mar 2011 13:56:32 +0100 Subject: input_id: Avoid memory overflow with too long capability masks Joey Lee reported a problem on an MSI laptop which reports a too long capabilities/key: E: EV==3 E: KEY==180000 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 This is longer than KEY_MAX and thus caused a memory overflow. Guard against this now and just ignore the excess blocks. --- extras/input_id/input_id.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 20191599d1..b2d4a6770a 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -61,12 +61,18 @@ static void get_cap_mask (struct udev_device *dev, const char* attr, i = 0; while ((word = strrchr(text, ' ')) != NULL) { val = strtoul (word+1, NULL, 16); - bitmask[i] = val; + if (i < bitmask_size/sizeof(unsigned long)) + bitmask[i] = val; + else + DBG("Ignoring %s block %lX which is larger than maximum size\n", attr, val); *word = '\0'; ++i; } val = strtoul (text, NULL, 16); - bitmask[i] = val; + if (i < bitmask_size/sizeof(unsigned long)) + bitmask[i] = val; + else + DBG("Ignoring %s block %lX which is larger than maximum size\n", attr, val); if (debug) { /* printf pattern with the right unsigned long number of hex chars */ -- cgit v1.2.3-54-g00ecf From 792479aca54d266430c900f90557ea8d0da2c125 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 18 Mar 2011 14:45:42 +0100 Subject: input_id: Cover key devices which only have KEY_* > 255 We previously only tested the "key" capabilities for keys between 0 and 255 to determine ID_INPUT_KEY. If there are none, also check for keys in the upper block (KEY_OK/0x160 to KEY_TOUCHPAD_OFF/0x214). --- extras/input_id/input_id.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index b2d4a6770a..588ff8992a 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -148,6 +148,17 @@ static void test_key (const unsigned long* bitmask_ev, found |= bitmask_key[i]; DBG("test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); } + /* If there are no keys in the lower block, check the higher block */ + if (!found) { + for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) { + if (test_bit (i, bitmask_key)) { + DBG("test_key: Found key %x in high block\n", i); + found = 1; + break; + } + } + } + if (found > 0) puts("ID_INPUT_KEY=1"); -- cgit v1.2.3-54-g00ecf From 1d8296d6ed0274d70b576e9dbcb22496a87e9161 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Fri, 18 Mar 2011 16:18:17 +0100 Subject: input_id: Rewrite debug logging to use standard udev info() --- extras/input_id/input_id.c | 91 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 70 insertions(+), 21 deletions(-) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 588ff8992a..6df9ae423a 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -22,11 +22,13 @@ #include #include #include +#include #include #include #include #include "libudev.h" +#include "libudev-private.h" /* we must use this kernel-compatible implementation */ #define BITS_PER_LONG (sizeof(unsigned long) * 8) @@ -37,7 +39,18 @@ #define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) static int debug = 0; -#define DBG(format, args...) { if (debug) fprintf(stderr, format, ##args); } + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } +} /* * Read a capability attribute and return bitmask. @@ -55,7 +68,7 @@ static void get_cap_mask (struct udev_device *dev, const char* attr, snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(dev, attr)); - DBG("%s raw kernel attribute: %s\n", attr, text); + info(udev_device_get_udev(dev), "%s raw kernel attribute: %s\n", attr, text); memset (bitmask, 0, bitmask_size); i = 0; @@ -64,7 +77,7 @@ static void get_cap_mask (struct udev_device *dev, const char* attr, if (i < bitmask_size/sizeof(unsigned long)) bitmask[i] = val; else - DBG("Ignoring %s block %lX which is larger than maximum size\n", attr, val); + info(udev_device_get_udev(dev), "Ignoring %s block %lX which is larger than maximum size\n", attr, val); *word = '\0'; ++i; } @@ -72,18 +85,18 @@ static void get_cap_mask (struct udev_device *dev, const char* attr, if (i < bitmask_size/sizeof(unsigned long)) bitmask[i] = val; else - DBG("Ignoring %s block %lX which is larger than maximum size\n", attr, val); + info(udev_device_get_udev(dev), "Ignoring %s block %lX which is larger than maximum size\n", attr, val); if (debug) { /* printf pattern with the right unsigned long number of hex chars */ snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2*sizeof(unsigned long)); - DBG("%s decoded bit map:\n", attr); + info(udev_device_get_udev(dev), "%s decoded bit map:\n", attr); val = bitmask_size/sizeof (unsigned long); /* skip over leading zeros */ while (bitmask[val-1] == 0 && val > 0) --val; for (i = 0; i < val; ++i) - DBG(text, i * BITS_PER_LONG, bitmask[i]); + info(udev_device_get_udev(dev), text, i * BITS_PER_LONG, bitmask[i]); } } @@ -129,7 +142,8 @@ static void test_pointers (const unsigned long* bitmask_ev, } /* key like devices */ -static void test_key (const unsigned long* bitmask_ev, +static void test_key (struct udev *udev, + const unsigned long* bitmask_ev, const unsigned long* bitmask_key) { unsigned i; @@ -138,7 +152,7 @@ static void test_key (const unsigned long* bitmask_ev, /* do we have any KEY_* capability? */ if (!test_bit (EV_KEY, bitmask_ev)) { - DBG("test_key: no EV_KEY capability\n"); + info(udev, "test_key: no EV_KEY capability\n"); return; } @@ -146,13 +160,13 @@ static void test_key (const unsigned long* bitmask_ev, found = 0; for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) { found |= bitmask_key[i]; - DBG("test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); + info(udev, "test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); } /* If there are no keys in the lower block, check the higher block */ if (!found) { for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) { if (test_bit (i, bitmask_key)) { - DBG("test_key: Found key %x in high block\n", i); + info(udev, "test_key: Found key %x in high block\n", i); found = 1; break; } @@ -169,31 +183,66 @@ static void test_key (const unsigned long* bitmask_ev, puts("ID_INPUT_KEYBOARD=1"); } +static void help () +{ + printf("Usage: input_id [options] \n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); +} + int main (int argc, char** argv) { struct udev *udev; struct udev_device *dev; + static const struct option options[] = { + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + char devpath[PATH_MAX]; unsigned long bitmask_ev[NBITS(EV_MAX)]; unsigned long bitmask_abs[NBITS(ABS_MAX)]; unsigned long bitmask_key[NBITS(KEY_MAX)]; unsigned long bitmask_rel[NBITS(REL_MAX)]; - if (argc != 2) { - fprintf(stderr, "Usage: %s \n", argv[0]); - exit(1); - } - - if (getenv ("DEBUG")) - debug = 1; - - /* get the device */ udev = udev_new(); if (udev == NULL) return 1; - snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[1]); + udev_log_init("input_id"); + udev_set_log_fn(udev, log_fn); + + /* CLI argument parsing */ + while (1) { + int option; + + option = getopt_long(argc, argv, "dxh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + help(); + exit(0); + default: + exit(1); + } + } + + if (argv[optind] == NULL) { + help(); + exit(1); + } + + /* get the device */ + snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); dev = udev_device_new_from_syspath(udev, devpath); if (dev == NULL) { fprintf(stderr, "unable to access '%s'\n", devpath); @@ -220,7 +269,7 @@ int main (int argc, char** argv) test_pointers(bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel); - test_key(bitmask_ev, bitmask_key); + test_key(udev, bitmask_ev, bitmask_key); return 0; } -- cgit v1.2.3-54-g00ecf From 7a959f1b07370d97682b748f911fbea814ce4555 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 19 Mar 2011 17:04:56 +0100 Subject: input_id: silent gcc warnings --- autogen.sh | 2 +- extras/input_id/input_id.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/autogen.sh b/autogen.sh index d35e9459ec..f659fca525 100755 --- a/autogen.sh +++ b/autogen.sh @@ -8,7 +8,7 @@ MYCFLAGS="-g -Wall \ -Wnested-externs -Wpointer-arith \ -Wpointer-arith -Wsign-compare -Wchar-subscripts \ -Wstrict-prototypes -Wshadow \ --Wformat=2 -Wtype-limits" +-Wformat-security -Wtype-limits" case "$CFLAGS" in *-O[0-9]*) diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 6df9ae423a..5965d848da 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -61,14 +61,14 @@ static void log_fn(struct udev *udev, int priority, static void get_cap_mask (struct udev_device *dev, const char* attr, unsigned long *bitmask, size_t bitmask_size) { + struct udev *udev = udev_device_get_udev(dev); char text[4096]; unsigned i; char* word; unsigned long val; snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(dev, attr)); - - info(udev_device_get_udev(dev), "%s raw kernel attribute: %s\n", attr, text); + info(udev, "%s raw kernel attribute: %s\n", attr, text); memset (bitmask, 0, bitmask_size); i = 0; @@ -77,33 +77,33 @@ static void get_cap_mask (struct udev_device *dev, const char* attr, if (i < bitmask_size/sizeof(unsigned long)) bitmask[i] = val; else - info(udev_device_get_udev(dev), "Ignoring %s block %lX which is larger than maximum size\n", attr, val); + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); *word = '\0'; ++i; } val = strtoul (text, NULL, 16); - if (i < bitmask_size/sizeof(unsigned long)) + if (i < bitmask_size / sizeof(unsigned long)) bitmask[i] = val; else - info(udev_device_get_udev(dev), "Ignoring %s block %lX which is larger than maximum size\n", attr, val); + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); if (debug) { /* printf pattern with the right unsigned long number of hex chars */ - snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2*sizeof(unsigned long)); - info(udev_device_get_udev(dev), "%s decoded bit map:\n", attr); - val = bitmask_size/sizeof (unsigned long); + snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long)); + info(udev, "%s decoded bit map:\n", attr); + val = bitmask_size / sizeof (unsigned long); /* skip over leading zeros */ while (bitmask[val-1] == 0 && val > 0) - --val; + --val; for (i = 0; i < val; ++i) - info(udev_device_get_udev(dev), text, i * BITS_PER_LONG, bitmask[i]); + info(udev, text, i * BITS_PER_LONG, bitmask[i]); } } /* pointer devices */ static void test_pointers (const unsigned long* bitmask_ev, - const unsigned long* bitmask_abs, - const unsigned long* bitmask_key, + const unsigned long* bitmask_abs, + const unsigned long* bitmask_key, const unsigned long* bitmask_rel) { int is_mouse = 0; @@ -183,7 +183,7 @@ static void test_key (struct udev *udev, puts("ID_INPUT_KEYBOARD=1"); } -static void help () +static void help(void) { printf("Usage: input_id [options] \n" " --debug debug to stderr\n" -- cgit v1.2.3-54-g00ecf From 21c53d918af47cca6f410159e5dfbee8a2d9d631 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 19 Mar 2011 18:11:12 +0100 Subject: fstab_import: disable build --- Makefile.am | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 15d1636fd6..228f51328d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -283,14 +283,6 @@ extras_path_id_path_id_SOURCES = extras/path_id/path_id.c extras_path_id_path_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/path_id/path_id -# ------------------------------------------------------------------------------ -# fstab_import - import /etc/fstab entry for block device -# ------------------------------------------------------------------------------ -extras_fstab_import_fstab_import_SOURCES = extras/fstab_import/fstab_import.c -extras_fstab_import_fstab_import_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/fstab_import/fstab_import -dist_udevrules_DATA += extras/fstab_import/79-fstab_import.rules - # ------------------------------------------------------------------------------ # scsi_id - SCSI inquiry to get various serial numbers # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From baf2b4eb0b5963962f6f4804d4688ace5ff29620 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 19 Mar 2011 18:13:01 +0100 Subject: systemd: remove deprecated udev-retry.service --- Makefile.am | 3 +-- init/udev-retry.service.in | 10 ---------- 2 files changed, 1 insertion(+), 12 deletions(-) delete mode 100644 init/udev-retry.service.in diff --git a/Makefile.am b/Makefile.am index 228f51328d..40f13e790e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -125,8 +125,7 @@ sharepkgconfig_DATA = udev/udev.pc if WITH_SYSTEMD systemdsystemunit_DATA = \ init/udev.service \ - init/udev-settle.service \ - init/udev-retry.service + init/udev-settle.service systemd-install-hook: mkdir -p $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants diff --git a/init/udev-retry.service.in b/init/udev-retry.service.in deleted file mode 100644 index 9be0dfc76d..0000000000 --- a/init/udev-retry.service.in +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=udev Retry Failed Events -DefaultDependencies=no -After=local-fs.target udev.service -Before=basic.target - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=@sbindir@/udevadm trigger --type=failed --action=add -- cgit v1.2.3-54-g00ecf From 180bac9db8c729202d367d0c39f8af3d54f8dd09 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 19 Mar 2011 18:28:57 +0100 Subject: fstab_import: remove from configure --- configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.ac b/configure.ac index b5754f2ac2..4ba5e32f30 100644 --- a/configure.ac +++ b/configure.ac @@ -138,7 +138,6 @@ AC_CONFIG_FILES([ udev/udev.pc init/udev.service init/udev-settle.service - init/udev-retry.service libudev/libudev.pc libudev/docs/Makefile libudev/docs/version.xml -- cgit v1.2.3-54-g00ecf From b7822bc4986a5396af7621a6a03e163142d86277 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Mar 2011 01:34:29 +0100 Subject: update sd-daemon.[ch] --- udev/sd-daemon.c | 6 +++--- udev/sd-daemon.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/udev/sd-daemon.c b/udev/sd-daemon.c index e12fb0483a..6d1eebff07 100644 --- a/udev/sd-daemon.c +++ b/udev/sd-daemon.c @@ -228,7 +228,7 @@ int sd_is_socket(int fd, int family, int type, int listening) { if (getsockname(fd, &sockaddr.sa, &l) < 0) return -errno; - if (l < offsetof(struct sockaddr_un, sun_path)) + if (l < sizeof(sa_family_t)) return -EINVAL; return sockaddr.sa.sa_family == family; @@ -254,7 +254,7 @@ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port if (getsockname(fd, &sockaddr.sa, &l) < 0) return -errno; - if (l < offsetof(struct sockaddr_un, sun_path)) + if (l < sizeof(sa_family_t)) return -EINVAL; if (sockaddr.sa.sa_family != AF_INET && @@ -296,7 +296,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t if (getsockname(fd, &sockaddr.sa, &l) < 0) return -errno; - if (l < offsetof(struct sockaddr_un, sun_path)) + if (l < sizeof(sa_family_t)) return -EINVAL; if (sockaddr.sa.sa_family != AF_UNIX) diff --git a/udev/sd-daemon.h b/udev/sd-daemon.h index fdf3cc0354..4b853a15be 100644 --- a/udev/sd-daemon.h +++ b/udev/sd-daemon.h @@ -185,7 +185,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t READY=1 Tells systemd that daemon startup is finished (only relevant for services of Type=notify). The passed argument is a boolean "1" or "0". Since there is - little value in signalling non-readiness the only + little value in signaling non-readiness the only value daemons should send is "READY=1". STATUS=... Passes a single-line status string back to systemd @@ -206,7 +206,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t fork off the process itself. Example: "MAINPID=4711" Daemons can choose to send additional variables. However, it is - recommened to prefix variable names not listed above with X_. + recommended to prefix variable names not listed above with X_. Returns a negative errno-style error code on failure. Returns > 0 if systemd could be notified, 0 if it couldn't possibly because @@ -252,7 +252,7 @@ int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_( fine. You should NOT protect them with a call to this function. Also note that this function checks whether the system, not the user session is controlled by systemd. However the functions above work - for both session and system services. + for both user and system services. See sd_booted(3) for more information. */ -- cgit v1.2.3-54-g00ecf From cf3b3fbcd5c43bdc5e7e15189c71b62a36a1cf03 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Mar 2011 01:41:25 +0100 Subject: udevd: use facility == LOG_DAEMON when writing to /dev/kmsg Syslog wants to distinguish the sorce of messages. We should indicate that this is a userspace message (LOG_DAEMON) and not a kernel message (LOG_KERNEL). --- TODO | 8 ++++---- udev/udev-event.c | 2 +- udev/udevd.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 029b70e1b7..f40c8cfddd 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ + - bind control socket in systemd - o get rid of "scan all devices to find myself" libusb interface - if it can not be fixed, drop libusb entirely and add a simple - wrapper around the Linux usb ioctls we need - o remove deprecated BUS=, SYSFS{}=, ID= keys + - kill --failed + + - remove deprecated BUS=, SYSFS{}=, ID= keys diff --git a/udev/udev-event.c b/udev/udev-event.c index 137ba36776..63a8b3aa83 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -454,7 +454,7 @@ static void rename_netif_kernel_log(struct ifreq ifr) return; } - fprintf(f, "<6>udev[%u]: renamed network interface %s to %s\n", + fprintf(f, "<30>udev[%u]: renamed network interface %s to %s\n", getpid(), ifr.ifr_name, ifr.ifr_newname); fclose(f); } diff --git a/udev/udevd.c b/udev/udevd.c index fe0e3c3929..2a42dfa765 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -994,7 +994,7 @@ static int convert_db(struct udev *udev) f = fopen("/dev/kmsg", "w"); if (f != NULL) { - fprintf(f, "<6>udev[%u]: converting old udev database\n", getpid()); + fprintf(f, "<30>udev[%u]: converting old udev database\n", getpid()); fclose(f); } @@ -1333,7 +1333,7 @@ int main(int argc, char *argv[]) f = fopen("/dev/kmsg", "w"); if (f != NULL) { - fprintf(f, "<6>udev[%u]: starting version " VERSION "\n", getpid()); + fprintf(f, "<30>udev[%u]: starting version " VERSION "\n", getpid()); fclose(f); } -- cgit v1.2.3-54-g00ecf From 3c6ee190277f9d4bf39269fdb167f9c430633c9b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Mar 2011 01:45:21 +0100 Subject: udevd: initialize fds, for proper close() on exit --- udev/udevd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 2a42dfa765..03cd2cbcee 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -75,7 +75,7 @@ static struct udev_rules *rules; static struct udev_queue_export *udev_queue_export; static struct udev_ctrl *udev_ctrl; static struct udev_monitor *monitor; -static int worker_watch[2]; +static int worker_watch[2] = { -1, -1 }; static pid_t settle_pid; static bool stop_exec_queue; static bool reload_config; @@ -97,11 +97,11 @@ enum poll_fd { }; static struct pollfd pfd[] = { - [FD_NETLINK] = { .events = POLLIN }, - [FD_WORKER] = { .events = POLLIN }, - [FD_SIGNAL] = { .events = POLLIN }, - [FD_INOTIFY] = { .events = POLLIN }, - [FD_CONTROL] = { .events = POLLIN }, + [FD_NETLINK] = { .events = POLLIN, .fd = -1 }, + [FD_WORKER] = { .events = POLLIN, .fd = -1 }, + [FD_SIGNAL] = { .events = POLLIN, .fd = -1 }, + [FD_INOTIFY] = { .events = POLLIN, .fd = -1 }, + [FD_CONTROL] = { .events = POLLIN, .fd = -1 }, }; enum event_state { -- cgit v1.2.3-54-g00ecf From 4ec9c3e79771aa95586390cecff4218cc8938160 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Mar 2011 02:31:09 +0100 Subject: use /run/udev/ if possible and fall back to /dev/.udev/ --- NEWS | 25 ++++-- extras/collect/collect.c | 19 ++-- extras/firmware/firmware.c | 2 +- extras/rule_generator/rule_generator.functions | 8 +- libudev/libudev-device-private.c | 6 +- libudev/libudev-device.c | 2 +- libudev/libudev-enumerate.c | 2 +- libudev/libudev-private.h | 3 + libudev/libudev-queue-private.c | 10 +-- libudev/libudev-queue.c | 4 +- libudev/libudev.c | 120 ++++++++++++++++++------- test/udev-test.pl | 1 + udev/udev-node.c | 2 +- udev/udev-rules.c | 2 +- udev/udev-watch.c | 10 +-- udev/udev.xml | 2 +- udev/udevadm-info.c | 6 +- udev/udevadm.c | 2 + udev/udevadm.xml | 6 ++ udev/udevd.c | 32 +++++-- 20 files changed, 186 insertions(+), 78 deletions(-) diff --git a/NEWS b/NEWS index 8da1cd9ed2..63826003e7 100644 --- a/NEWS +++ b/NEWS @@ -2,20 +2,27 @@ udev 167 ======== Bugfixes. -The udev runtime data moved from /dev/.udev/ to /dev/.run/udev/. -On systemd systems the tmpfs mountpoint /var/run/ will have a -permanent "early-boot alias" /dev/.run/, where udev and a couple -of other early-boot tools will put their runtime data. +The udev runtime data moved from /dev/.udev/ to /run/udev/. The +/run mountpoint is supposed to be a tmpfs mounted during early boot, +available and writable to for all tools at any time during bootup, +it replaces /var/run/, which should become a symlink some day. -On systemd systems with LVM used, packagers must make sure, that -the systemd and initramfs version match. The initramfs needs to -create the /dev/.run/ mountpoint for udev to store the data, so -that systemd will not overmount it, which would make the udev -data from initramfs invisible. +If /run does not exist, or is not writable, udev will fall back using +/dev/.udev/. + +On systemd systems with initramfs and LVM used, packagers must +make sure, that the systemd and initramfs versions match. The initramfs +needs to create the /run/ mountpoint for udev to store the data, and +mount this tmpfs to /run in the rootfs, so the that the udev database +is preserved for the udev version started in the rootfs. The command 'udevadm info --convert-db' is gone. The udev daemon itself, at startup, converts any old database version if necessary. +The fstab_import callout is no longer built or installed. Udev +should not be used to mount, does not watch changes to fstab, and +should not mirror fstab values in the udev database. + udev 166 ======== Bugfixes. diff --git a/extras/collect/collect.c b/extras/collect/collect.c index b5670516b4..17b3df372f 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -34,7 +34,6 @@ #include "libudev.h" #include "libudev-private.h" -#define TMPFILE "/dev/.run/udev/collect" #define BUFSIZE 16 #define UDEV_ALARM_TIMEOUT 180 @@ -338,6 +337,7 @@ static void everybody(void) int main(int argc, char **argv) { + struct udev *udev; static const struct option options[] = { { "add", no_argument, NULL, 'a' }, { "remove", no_argument, NULL, 'r' }, @@ -349,8 +349,15 @@ int main(int argc, char **argv) char *checkpoint, *us; int fd; int i; - int ret = 0; + int ret = EXIT_SUCCESS; int prune = 0; + char tmpdir[UTIL_PATH_SIZE]; + + udev = udev_new(); + if (udev == NULL) { + ret = EXIT_FAILURE; + goto exit; + } while (1) { int option; @@ -398,7 +405,8 @@ int main(int argc, char **argv) if (debug) fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); - fd = prepare(TMPFILE, checkpoint); + util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL); + fd = prepare(tmpdir, checkpoint); if (fd < 0) { ret = 3; goto out; @@ -454,11 +462,12 @@ int main(int argc, char **argv) lockf(fd, F_ULOCK, 0); close(fd); - out: +out: if (debug) everybody(); if (ret >= 0) printf("COLLECT_%s=%d\n", checkpoint, ret); - exit: +exit: + udev_unref(udev); return ret; } diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c index f7d21df6d0..81998201b2 100644 --- a/extras/firmware/firmware.c +++ b/extras/firmware/firmware.c @@ -147,7 +147,7 @@ int main(int argc, char **argv) } util_path_encode(firmware, fwencpath, sizeof(fwencpath)); - util_strscpyl(misspath, sizeof(misspath), udev_get_dev_path(udev), "/.run/udev/firmware-missing/", fwencpath, NULL); + util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL); util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); if (fwfile == NULL) { diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index e2060a2ece..4bec27a1b7 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -48,9 +48,10 @@ writeable() { # Create a lock file for the current rules file. lock_rules_file() { - [ -e /dev/.udev/ ] || return 0 + RUNDIR=$(udevadm info --run) + [ -e "$RUNDIR" ] || return 0 - RULES_LOCK="/dev/.udev/.lock-${RULES_FILE##*/}" + RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}" retry=30 while ! mkdir $RULES_LOCK 2> /dev/null; do @@ -71,7 +72,8 @@ unlock_rules_file() { # Choose the real rules file if it is writeable or a temporary file if not. # Both files should be checked later when looking for existing rules. choose_rules_file() { - local tmp_rules_file="/dev/.udev/tmp-rules--${RULES_FILE##*/}" + RUNDIR=$(udevadm info --run) + local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}" [ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1 if writeable ${RULES_FILE%/*}; then diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 7683f09857..6d72d328bd 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -31,7 +31,7 @@ static void udev_device_tag(struct udev_device *dev, const char *tag, bool add) id = udev_device_get_id_filename(dev); if (id == NULL) return; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/tags/", tag, "/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags/", tag, "/", id, NULL); if (add) { int fd; @@ -115,7 +115,7 @@ int udev_device_update_db(struct udev_device *udev_device) return -1; has_info = device_has_info(udev_device); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/db3/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); /* do not store anything for otherwise empty devices */ if (!has_info && @@ -176,7 +176,7 @@ int udev_device_delete_db(struct udev_device *udev_device) id = udev_device_get_id_filename(udev_device); if (id == NULL) return -1; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/db3/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); unlink(filename); return 0; } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index dd0224ae4b..ccd4a70677 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -254,7 +254,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile) id = udev_device_get_id_filename(udev_device); if (id == NULL) return -1; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/.run/udev/db3/", id, NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_device->udev), "/data/", id, NULL); dbfile = filename; } diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index d3dd5c963f..6870bb6115 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -751,7 +751,7 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) struct dirent *dent; char path[UTIL_PATH_SIZE]; - util_strscpyl(path, sizeof(path), udev_get_dev_path(udev), "/.run/udev/tags/", + util_strscpyl(path, sizeof(path), udev_get_run_path(udev), "/tags/", udev_list_entry_get_name(list_entry), NULL); dir = opendir(path); if (dir == NULL) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 0fe6f4a6bf..bd317933ba 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -61,6 +61,9 @@ void udev_log(struct udev *udev, const char *format, ...) __attribute__((format(printf, 6, 7))); const char *udev_get_rules_path(struct udev *udev); +const char *udev_get_run_config_path(struct udev *udev); +const char *udev_get_run_path(struct udev *udev); +const char *udev_set_run_path(struct udev *udev, const char *path); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 9b02daf0a4..a714572361 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -103,10 +103,10 @@ void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) { char filename[UTIL_PATH_SIZE]; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.run/udev/queue.tmp", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); unlink(filename); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.run/udev/queue.bin", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); unlink(filename); } @@ -221,7 +221,7 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) } /* create new queue file */ - util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_dev_path(udev_queue_export->udev), "/.run/udev/queue.tmp", NULL); + util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); new_queue_file = fopen(filename_tmp, "w+"); if (new_queue_file == NULL) goto error; @@ -255,7 +255,7 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) goto error; /* rename the new file on top of the old one */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue_export->udev), "/.run/udev/queue.bin", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); if (rename(filename_tmp, filename) != 0) goto error; @@ -401,7 +401,7 @@ static void update_failed(struct udev_queue_export *udev_queue_export, return; /* location of failed file */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/failed/", + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/failed/", udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); switch (state) { diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index 6f743d2061..75c5b2425e 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -214,7 +214,7 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i char filename[UTIL_PATH_SIZE]; FILE *queue_file; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_queue->udev), "/.run/udev/queue.bin", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue->udev), "/queue.bin", NULL); queue_file = fopen(filename, "re"); if (queue_file == NULL) return NULL; @@ -484,7 +484,7 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev if (udev_queue == NULL) return NULL; udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); - util_strscpyl(path, sizeof(path), udev_get_dev_path(udev_queue->udev), "/.run/udev/failed", NULL); + util_strscpyl(path, sizeof(path), udev_get_run_path(udev_queue->udev), "/failed", NULL); dir = opendir(path); if (dir == NULL) return NULL; diff --git a/libudev/libudev.c b/libudev/libudev.c index cd418709f0..d96934fba8 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -43,6 +43,8 @@ struct udev { char *sys_path; char *dev_path; char *rules_path; + char *run_config_path; + char *run_path; struct udev_list_node properties_list; int log_priority; }; @@ -96,6 +98,14 @@ void udev_set_userdata(struct udev *udev, void *userdata) udev->userdata = userdata; } +static char *set_value(char **s, const char *v) +{ + free(*s); + *s = strdup(v); + util_remove_trailing_chars(*s, '/'); + return *s; +} + /** * udev_new: * @@ -111,7 +121,7 @@ struct udev *udev_new(void) { struct udev *udev; const char *env; - char *config_file; + char *config_file = NULL; FILE *f; udev = calloc(1, sizeof(struct udev)); @@ -121,31 +131,21 @@ struct udev *udev_new(void) udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; udev_list_init(&udev->properties_list); - udev->dev_path = strdup("/dev"); - udev->sys_path = strdup("/sys"); - config_file = strdup(SYSCONFDIR "/udev/udev.conf"); - if (udev->dev_path == NULL || - udev->sys_path == NULL || - config_file == NULL) - goto err; - - /* settings by environment and config file */ - env = getenv("SYSFS_PATH"); - if (env != NULL) { - free(udev->sys_path); - udev->sys_path = strdup(env); - util_remove_trailing_chars(udev->sys_path, '/'); - udev_add_property(udev, "SYSFS_PATH", udev->sys_path); - } + /* custom config file */ env = getenv("UDEV_CONFIG_FILE"); if (env != NULL) { - free(config_file); - config_file = strdup(env); - util_remove_trailing_chars(config_file, '/'); + udev_add_property(udev, "UDEV_CONFIG_FILE", udev->dev_path); + if (set_value(&config_file, env) == NULL) + goto err; } + + /* default config file */ + if (config_file == NULL) + config_file = strdup(SYSCONFDIR "/udev/udev.conf"); if (config_file == NULL) goto err; + f = fopen(config_file, "re"); if (f != NULL) { char line[UTIL_LINE_SIZE]; @@ -214,40 +214,57 @@ struct udev *udev_new(void) continue; } if (strcmp(key, "udev_root") == 0) { - free(udev->dev_path); - udev->dev_path = strdup(val); - util_remove_trailing_chars(udev->dev_path, '/'); + set_value(&udev->dev_path, val); + continue; + } + if (strcmp(key, "udev_run") == 0) { + set_value(&udev->run_config_path, val); continue; } if (strcmp(key, "udev_rules") == 0) { - free(udev->rules_path); - udev->rules_path = strdup(val); - util_remove_trailing_chars(udev->rules_path, '/'); + set_value(&udev->rules_path, val); continue; } } fclose(f); } + /* environment overwrites config */ + env = getenv("UDEV_LOG"); + if (env != NULL) + udev_set_log_priority(udev, util_log_priority(env)); + env = getenv("UDEV_ROOT"); if (env != NULL) { - free(udev->dev_path); - udev->dev_path = strdup(env); - util_remove_trailing_chars(udev->dev_path, '/'); + set_value(&udev->dev_path, env); udev_add_property(udev, "UDEV_ROOT", udev->dev_path); } - env = getenv("UDEV_LOG"); - if (env != NULL) - udev_set_log_priority(udev, util_log_priority(env)); + env = getenv("SYSFS_PATH"); + if (env != NULL) { + set_value(&udev->sys_path, env); + udev_add_property(udev, "SYSFS_PATH", udev->sys_path); + } + + /* set defaults */ + if (udev->dev_path == NULL) + if (set_value(&udev->dev_path, "/dev") == NULL) + goto err; + + if (udev->sys_path == NULL) + if (set_value(&udev->sys_path, "/sys") == NULL) + goto err; + + if (udev->run_config_path == NULL) + if (set_value(&udev->run_config_path, "/run/udev") == NULL) + goto err; - if (udev->dev_path == NULL || udev->sys_path == NULL) - goto err; dbg(udev, "context %p created\n", udev); dbg(udev, "log_priority=%d\n", udev->log_priority); dbg(udev, "config_file='%s'\n", config_file); dbg(udev, "dev_path='%s'\n", udev->dev_path); dbg(udev, "sys_path='%s'\n", udev->sys_path); + dbg(udev, "run_path='%s'\n", udev->run_config_path); if (udev->rules_path != NULL) dbg(udev, "rules_path='%s'\n", udev->rules_path); free(config_file); @@ -294,6 +311,8 @@ void udev_unref(struct udev *udev) free(udev->dev_path); free(udev->sys_path); free(udev->rules_path); + free(udev->run_path); + free(udev->run_config_path); dbg(udev, "context %p released\n", udev); free(udev); } @@ -387,6 +406,39 @@ const char *udev_get_dev_path(struct udev *udev) return udev->dev_path; } +const char *udev_get_run_config_path(struct udev *udev) +{ + return udev->run_config_path; +} + +const char *udev_get_run_path(struct udev *udev) +{ + if (udev->run_path != NULL) + return udev->run_path; + + /* check if configured path exists */ + if (access(udev->run_config_path, F_OK) < 0) { + char filename[UTIL_PATH_SIZE]; + + /* fall back to /dev/.udev if that exists */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev", NULL); + if (access(filename, F_OK) >= 0) + if (set_value(&udev->run_path, filename) != NULL) + return udev->run_path; + } + + /* use default path */ + set_value(&udev->run_path, udev->run_config_path); + if (udev->run_path == NULL) + return udev->run_config_path; + return udev->run_path; +} + +const char *udev_set_run_path(struct udev *udev, const char *path) +{ + return set_value(&udev->run_path, path); +} + struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) { if (value == NULL) { diff --git a/test/udev-test.pl b/test/udev-test.pl index 6a0ea826fc..4103cf0bff 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1732,6 +1732,7 @@ make_udev_root(); # create config file open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; print CONF "udev_root=\"$udev_root\"\n"; +print CONF "udev_run=\"$udev_root/.udev\"\n"; print CONF "udev_rules=\"$PWD\"\n"; print CONF "udev_log=\"err\"\n"; close CONF; diff --git a/udev/udev-node.c b/udev/udev-node.c index aaa2e32e65..ab4e932288 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -292,7 +292,7 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); - util_strscpyl(dirname, sizeof(dirname), udev_get_dev_path(udev), "/.run/udev/links/", name_enc, NULL); + util_strscpyl(dirname, sizeof(dirname), udev_get_run_path(udev), "/links/", name_enc, NULL); util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); if (!add) { diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 4a5b8debca..221865c9dc 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1803,7 +1803,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); /* read dynamic/temporary rules */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/rules.d", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL); udev_list_init(&sort_list); add_matching_files(udev, &sort_list, filename, ".rules"); diff --git a/udev/udev-watch.c b/udev/udev-watch.c index 47dca4c6e6..0ec8bfd627 100644 --- a/udev/udev-watch.c +++ b/udev/udev-watch.c @@ -54,8 +54,8 @@ void udev_watch_restore(struct udev *udev) if (inotify_fd < 0) return; - util_strscpyl(oldname, sizeof(oldname), udev_get_dev_path(udev), "/.run/udev/watch.old", NULL); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/watch", NULL); + util_strscpyl(oldname, sizeof(oldname), udev_get_run_path(udev), "/watch.old", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); if (rename(filename, oldname) == 0) { DIR *dir; struct dirent *ent; @@ -118,7 +118,7 @@ void udev_watch_begin(struct udev *udev, struct udev_device *dev) return; } - snprintf(filename, sizeof(filename), "%s/.run/udev/watch/%d", udev_get_dev_path(udev), wd); + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); util_create_path(udev, filename); unlink(filename); symlink(udev_device_get_id_filename(dev), filename); @@ -141,7 +141,7 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev) info(udev, "removing watch on '%s'\n", udev_device_get_devnode(dev)); inotify_rm_watch(inotify_fd, wd); - snprintf(filename, sizeof(filename), "%s/.run/udev/watch/%d", udev_get_dev_path(udev), wd); + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); unlink(filename); udev_device_set_watch_handle(dev, -1); @@ -158,7 +158,7 @@ struct udev_device *udev_watch_lookup(struct udev *udev, int wd) if (inotify_fd < 0 || wd < 0) return NULL; - snprintf(filename, sizeof(filename), "%s/.run/udev/watch/%d", udev_get_dev_path(udev), wd); + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); s = majmin; l = util_strpcpy(&s, sizeof(majmin), udev_get_sys_path(udev)); len = readlink(filename, s, l); diff --git a/udev/udev.xml b/udev/udev.xml index 452abc5c0d..deb3429698 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -73,7 +73,7 @@ The udev rules are read from the files located in the default rules directory /lib/udev/rules.d/, the custom rules directory /etc/udev/rules.d/ - and the temporary rules directory /var/run/udev/rules.d/. + and the temporary rules directory /run/udev/rules.d/. All rule files are sorted and processed in lexical order, regardless in which of these directories they live. Files in /etc/udev/rules.d/ have precedence over files with diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 33d113c5b1..9357f67208 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -218,6 +218,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) { "attribute-walk", no_argument, NULL, 'a' }, { "export-db", no_argument, NULL, 'e' }, { "root", no_argument, NULL, 'r' }, + { "run", no_argument, NULL, 'R' }, { "device-id-of-file", required_argument, NULL, 'd' }, { "export", no_argument, NULL, 'x' }, { "export-prefix", required_argument, NULL, 'P' }, @@ -247,7 +248,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) int option; struct stat statbuf; - option = getopt_long(argc, argv, "aed:n:p:q:rxP:Vh", options, NULL); + option = getopt_long(argc, argv, "aed:n:p:q:rxP:RVh", options, NULL); if (option == -1) break; @@ -331,6 +332,9 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) action = ACTION_ROOT; root = true; break; + case 'R': + printf("%s\n", udev_get_run_path(udev)); + goto exit; case 'd': action = ACTION_DEVICE_ID_FILE; util_strscpy(name, sizeof(name), optarg); diff --git a/udev/udevadm.c b/udev/udevadm.c index 19b89ad05c..336d723705 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -171,6 +171,8 @@ int main(int argc, char *argv[]) } command = argv[optind]; + info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); + if (command != NULL) for (i = 0; cmds[i].cmd != NULL; i++) { if (strcmp(cmds[i].name, command) == 0) { diff --git a/udev/udevadm.xml b/udev/udevadm.xml index cefd7763af..be8f886fc8 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -110,6 +110,12 @@ query returns the absolute path including the root directory. + + + + The udev runtime directory: /run/udev. + + diff --git a/udev/udevd.c b/udev/udevd.c index 03cd2cbcee..ef82f72d05 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -979,13 +979,15 @@ static int convert_db(struct udev *udev) struct udev_list_entry *list_entry; /* current database */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/db3", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); if (access(filename, F_OK) >= 0) return 0; /* make sure we do not get here again */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/db3/", NULL); util_create_path(udev, filename); + udev_selinux_setfscreatecon(udev, udev_get_run_path(udev), S_IFDIR|0755); + mkdir(filename, 0755); + udev_selinux_resetfscreatecon(udev); /* old database */ util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db", NULL); @@ -1044,8 +1046,7 @@ static int convert_db(struct udev *udev) /* find old database with the encoded devpath name */ util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), - "/.udev/db/", devpath, NULL); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", devpath, NULL); if (lstat(from, &stats) == 0) { if (!have_db) { udev_device_read_db(device, from); @@ -1093,6 +1094,27 @@ int main(int argc, char *argv[]) info(udev, "version %s\n", VERSION); udev_selinux_init(udev); + /* make sure, that our runtime dir exists and is writable */ + if (utimensat(AT_FDCWD, udev_get_run_config_path(udev), NULL, 0) < 0) { + /* try to create our own subdirectory, do not create parent directories */ + udev_selinux_setfscreatecon(udev, udev_get_run_config_path(udev), S_IFDIR|0755); + mkdir(udev_get_run_config_path(udev), 0755); + udev_selinux_resetfscreatecon(udev); + + if (utimensat(AT_FDCWD, udev_get_run_config_path(udev), NULL, 0) >= 0) { + /* directory seems writable now */ + udev_set_run_path(udev, udev_get_run_config_path(udev)); + } else { + /* fall back to /dev/.udev */ + char filename[UTIL_PATH_SIZE]; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev", NULL); + if (udev_set_run_path(udev, filename) == NULL) + goto exit; + } + } + info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); + for (;;) { int option; @@ -1252,7 +1274,7 @@ int main(int argc, char *argv[]) IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.run/udev/rules.d", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL); if (stat(filename, &statbuf) != 0) { util_create_path(udev, filename); udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); -- cgit v1.2.3-54-g00ecf From a31d76b18675a0bf213fdd16242b4268c9ff48e0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Mar 2011 12:11:38 +0100 Subject: rules: run ata_id only on SPC-3 or later optical drives --- rules/rules.d/60-persistent-storage.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 062049cd1d..6a9abdd369 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -28,8 +28,8 @@ KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" # ATA devices using the "scsi" subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" -# ATA/ATAPI devices using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", IMPORT{program}="ata_id --export $tempnode" +# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $tempnode" # scsi devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" -- cgit v1.2.3-54-g00ecf From fc1de713f5b754fb38876b5b797e18f812727f0a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Mar 2011 16:40:23 +0100 Subject: systemd: bind udev control socket in systemd and split udev.service We should bind the udev socket from systemd, so we are sure that the abstract namespace socket is always bound by a root process and there is never a window during an update where an untrusted process can steal our socket. Also split the udev.service file, so that the daemon can be updated/restarted without triggering any coldplug events. --- Makefile.am | 8 +++++++- configure.ac | 1 + init/udev-trigger.service.in | 11 +++++++++++ init/udev.service.in | 5 +++-- init/udev.socket | 5 +++++ libudev/libudev-ctrl.c | 39 +++++++++++++++++++++++++++++++-------- libudev/libudev-private.h | 1 + udev/udevd.c | 14 +++++++++----- 8 files changed, 68 insertions(+), 16 deletions(-) create mode 100644 init/udev-trigger.service.in create mode 100644 init/udev.socket diff --git a/Makefile.am b/Makefile.am index 40f13e790e..7ad9a242b7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -124,14 +124,20 @@ sharepkgconfig_DATA = udev/udev.pc if WITH_SYSTEMD systemdsystemunit_DATA = \ + init/udev.socket \ init/udev.service \ + init/udev-trigger.service \ init/udev-settle.service +EXTRA_DIST += init/udev.socket + systemd-install-hook: + mkdir -p $(DESTDIR)$(systemdsystemunitdir)/socket.target.wants + ln -sf ../udev.socket $(DESTDIR)$(systemdsystemunitdir)/socket.target.wants/udev.socket mkdir -p $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants ln -sf ../udev.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev.service + ln -sf ../udev-trigger.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-trigger.service ln -sf ../udev-settle.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-settle.service - ln -sf ../udev-retry.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-retry.service INSTALL_DATA_HOOKS += systemd-install-hook endif diff --git a/configure.ac b/configure.ac index 4ba5e32f30..1775fb072b 100644 --- a/configure.ac +++ b/configure.ac @@ -137,6 +137,7 @@ AC_CONFIG_FILES([ Makefile udev/udev.pc init/udev.service + init/udev-trigger.service init/udev-settle.service libudev/libudev.pc libudev/docs/Makefile diff --git a/init/udev-trigger.service.in b/init/udev-trigger.service.in new file mode 100644 index 0000000000..0ede3171ea --- /dev/null +++ b/init/udev-trigger.service.in @@ -0,0 +1,11 @@ +[Unit] +Description=udev Coldplug all Devices +Requires=udev.service +After=udev.service +Before=basic.target +DefaultDependencies=no + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add diff --git a/init/udev.service.in b/init/udev.service.in index 908c8e9acc..c02a4b4d85 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -1,9 +1,10 @@ [Unit] Description=udev Kernel Device Manager -DefaultDependencies=no +Requires=udev.socket +After=udev.socket Before=basic.target +DefaultDependencies=no [Service] Type=notify ExecStart=@sbindir@/udevd -ExecStartPost=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add diff --git a/init/udev.socket b/init/udev.socket new file mode 100644 index 0000000000..324ab47093 --- /dev/null +++ b/init/udev.socket @@ -0,0 +1,5 @@ +[Unit] +Description=udev Kernel Device Manager Socket + +[Socket] +ListenDatagram=@/org/kernel/udev/udevd diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c index af59c36826..63bf539197 100644 --- a/libudev/libudev-ctrl.c +++ b/libudev/libudev-ctrl.c @@ -61,7 +61,7 @@ struct udev_ctrl { socklen_t addrlen; }; -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) +static struct udev_ctrl *udev_ctrl_new(struct udev *udev) { struct udev_ctrl *uctrl; @@ -70,6 +70,16 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke return NULL; uctrl->refcount = 1; uctrl->udev = udev; + return uctrl; +} + +struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) +{ + struct udev_ctrl *uctrl; + + uctrl = udev_ctrl_new(udev); + if (uctrl == NULL) + return NULL; uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); if (uctrl->sock < 0) { @@ -84,6 +94,17 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke /* translate leading '@' to abstract namespace */ if (uctrl->saddr.sun_path[0] == '@') uctrl->saddr.sun_path[0] = '\0'; + return uctrl; +} + +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) +{ + struct udev_ctrl *uctrl; + + uctrl = udev_ctrl_new(udev); + if (uctrl == NULL) + return NULL; + uctrl->sock = fd; return uctrl; } @@ -91,16 +112,18 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) { int err; - const int feature_on = 1; - - err= bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err < 0) { - err(uctrl->udev, "bind failed: %m\n"); - return err; + const int on = 1; + + if (uctrl->addrlen > 0) { + err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err < 0) { + err(uctrl->udev, "bind failed: %m\n"); + return err; + } } /* enable receiving of the sender credentials */ - setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &feature_on, sizeof(feature_on)); + setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); return 0; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index bd317933ba..10612560f9 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -125,6 +125,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, /* libudev-ctrl.c - daemon runtime setup */ struct udev_ctrl; struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd); int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); void udev_ctrl_unref(struct udev_ctrl *uctrl); diff --git a/udev/udevd.c b/udev/udevd.c index ef82f72d05..1871474ff9 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1228,16 +1228,20 @@ int main(int argc, char *argv[]) if (write(STDERR_FILENO, 0, 0) < 0) dup2(fd, STDERR_FILENO); - udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); + /* udevadm control socket */ + if (sd_listen_fds(true) == 1 && sd_is_socket(SD_LISTEN_FDS_START, AF_LOCAL, SOCK_DGRAM, -1)) + udev_ctrl = udev_ctrl_new_from_fd(udev, SD_LISTEN_FDS_START); + else + udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); if (udev_ctrl == NULL) { - fprintf(stderr, "error initializing control socket"); - err(udev, "error initializing udevd socket"); + fprintf(stderr, "error initializing udev control socket"); + err(udev, "error initializing udev control socket"); rc = 1; goto exit; } if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { - fprintf(stderr, "error binding control socket, seems udevd is already running\n"); - err(udev, "error binding control socket, seems udevd is already running\n"); + fprintf(stderr, "error binding udev control socket\n"); + err(udev, "error binding udev control socket\n"); rc = 1; goto exit; } -- cgit v1.2.3-54-g00ecf From 079f5697c1f00f01c2ef310c97c659444910371f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Mar 2011 20:35:19 +0100 Subject: systemd: use sockets.target not socket.target --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7ad9a242b7..d8ce4b3f15 100644 --- a/Makefile.am +++ b/Makefile.am @@ -132,8 +132,8 @@ systemdsystemunit_DATA = \ EXTRA_DIST += init/udev.socket systemd-install-hook: - mkdir -p $(DESTDIR)$(systemdsystemunitdir)/socket.target.wants - ln -sf ../udev.socket $(DESTDIR)$(systemdsystemunitdir)/socket.target.wants/udev.socket + mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants + ln -sf ../udev.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/udev.socket mkdir -p $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants ln -sf ../udev.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev.service ln -sf ../udev-trigger.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-trigger.service -- cgit v1.2.3-54-g00ecf From 864fde8a087c0edbc0ee3aca83f9289fc32cfcee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 23 Mar 2011 23:56:15 +0100 Subject: man: remove trigger --type=failed handling --- TODO | 2 +- udev/udev.xml | 5 +---- udev/udevadm.xml | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index f40c8cfddd..964ffe9cbb 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ - bind control socket in systemd - - kill --failed + - remove deprecated trigger --type=failed logic - remove deprecated BUS=, SYSFS{}=, ID= keys diff --git a/udev/udev.xml b/udev/udev.xml index deb3429698..ae9179826a 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -383,10 +383,7 @@ device. This can only be used for very short running tasks. Running an event process for a long period of time may block all further events for this or a dependent device. Long running tasks need to be immediately - detached from the event process itself. If the option - is - specified, and the executed program returns non-zero, the event will be - marked as failed for a possible later handling. + detached from the event process itself. If no absolute path is given, the program is expected to live in /lib/udev, otherwise the absolute path must be specified. Program name and arguments are separated by spaces. Single quotes diff --git a/udev/udevadm.xml b/udev/udevadm.xml index be8f886fc8..7a682a68ef 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -183,7 +183,7 @@ Trigger a specific type of devices. Valid types are: - devices, subsystems, failed. + devices, subsystems. The default value is devices. -- cgit v1.2.3-54-g00ecf From 641842bce295ec17cca52d34cfaa6765e097bb18 Mon Sep 17 00:00:00 2001 From: Seth Forshee Date: Thu, 24 Mar 2011 16:33:54 +0100 Subject: keymap: continue reading keymap after invalid scancodes Reading of keymaps is aborted when EINVAL is returned from EVIOCGETKEYCODE. Scan codes are not always continuous ranges of values starting at 0, so this can result in not getting the full keymap for a device. Instead, continue processing if EINVAL is returned. --- extras/keymap/keymap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 719c30e600..eabd1e44d8 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -141,8 +141,9 @@ static int dump_table(int fd) { int keycode; if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { - if (keycode != -2) - r = -1; + if (keycode == -2) + continue; + r = -1; break; } -- cgit v1.2.3-54-g00ecf From 6e0768d2906887d6cf78a7f073c0c5343e49442b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Mar 2011 15:43:01 +0100 Subject: libudev: export udev_get_run_path() --- libudev/exported_symbols | 1 + libudev/libudev-private.h | 1 - libudev/libudev.h | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libudev/exported_symbols b/libudev/exported_symbols index 500e981586..4089ec377c 100644 --- a/libudev/exported_symbols +++ b/libudev/exported_symbols @@ -8,6 +8,7 @@ udev_get_userdata udev_set_userdata udev_get_sys_path udev_get_dev_path +udev_get_run_path udev_list_entry_get_next udev_list_entry_get_by_name udev_list_entry_get_name diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 10612560f9..7078b0ff3c 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -62,7 +62,6 @@ void udev_log(struct udev *udev, __attribute__((format(printf, 6, 7))); const char *udev_get_rules_path(struct udev *udev); const char *udev_get_run_config_path(struct udev *udev); -const char *udev_get_run_path(struct udev *udev); const char *udev_set_run_path(struct udev *udev, const char *path); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); diff --git a/libudev/libudev.h b/libudev/libudev.h index 892530b773..021ef9e8c0 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -38,6 +38,7 @@ int udev_get_log_priority(struct udev *udev); void udev_set_log_priority(struct udev *udev, int priority); const char *udev_get_sys_path(struct udev *udev); const char *udev_get_dev_path(struct udev *udev); +const char *udev_get_run_path(struct udev *udev); void *udev_get_userdata(struct udev *udev); void udev_set_userdata(struct udev *udev, void *userdata); -- cgit v1.2.3-54-g00ecf From 672ff71911f2a42e6af030c3ef8830f51439b0d0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 25 Mar 2011 17:58:30 +0100 Subject: libudev: docs - add udev_get_run_path() --- libudev/docs/libudev-sections.txt | 1 + libudev/libudev.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 918344d941..2560a08e1f 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -10,6 +10,7 @@ udev_get_log_priority udev_set_log_priority udev_get_sys_path udev_get_dev_path +udev_get_run_path udev_get_userdata udev_set_userdata
            diff --git a/libudev/libudev.c b/libudev/libudev.c index d96934fba8..edc24e2fca 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -411,6 +411,14 @@ const char *udev_get_run_config_path(struct udev *udev) return udev->run_config_path; } +/** + * udev_get_run_path: + * @udev: udev library context + * + * Retrieve the udev runtime directory path. The default is "/run/udev". + * + * Returns: the runtime directory path + **/ const char *udev_get_run_path(struct udev *udev) { if (udev->run_path != NULL) -- cgit v1.2.3-54-g00ecf From b4155660f2b60006816de5966d2b1859dc57ff6a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 28 Mar 2011 14:34:05 +0200 Subject: libudev: make valgrind happy Warning: noted but unhandled ioctl 0x641e with no size/direction hints Syscall param socketcall.setsockopt(optval) points to uninitialised byte(s) at 0x6A30BAA: setsockopt (syscall-template.S:82) by 0x4E36E1C: udev_monitor_filter_update (libudev-monitor.c:347) by 0x4E36ED8: udev_monitor_enable_receiving (libudev-monitor.c:373) by 0x8A9E68E: I830ScreenInit (intel_driver.c:838) by 0x42EE9E: AddScreen (dispatch.c:3890) by 0x471561: InitOutput (xf86Init.c:738) by 0x422C18: main (main.c:205) Location 0x7ff0000c2 is 2 bytes inside local var "filter" declared at libudev-monitor.c:256, in frame #1 of thread 1 Uninitialised value was created by a stack allocation at 0x4E30860: ??? (in /lib64/libudev.so.0.10.0) Thanks to Zdenek Kabelac. --- libudev/libudev-monitor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index a3789c4d13..c97f6faa65 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -342,6 +342,7 @@ int udev_monitor_filter_update(struct udev_monitor *udev_monitor) bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); /* install filter */ + memset(&filter, 0x00, sizeof(filter)); filter.len = i; filter.filter = ins; err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); -- cgit v1.2.3-54-g00ecf From ce440d1c1bcd9ac05a34bd987bc68744270214d7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 29 Mar 2011 01:14:53 +0200 Subject: systemd: do not enable udev-settle.service by default This barrier service is usually not enabled by default. If enabled, it acts as a barrier for basic.target -- so all later services will wait for udev completely finishing its coldplug run. It might be enabled just unconditionally, or pulled-in on-demand by broken or non-hotplug-aware services that assume a fully populated /dev at startup. --- Makefile.am | 1 - NEWS | 7 +++++++ init/udev-settle.service.in | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index d8ce4b3f15..df70bf73be 100644 --- a/Makefile.am +++ b/Makefile.am @@ -137,7 +137,6 @@ systemd-install-hook: mkdir -p $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants ln -sf ../udev.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev.service ln -sf ../udev-trigger.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-trigger.service - ln -sf ../udev-settle.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-settle.service INSTALL_DATA_HOOKS += systemd-install-hook endif diff --git a/NEWS b/NEWS index 63826003e7..b86e0bcca0 100644 --- a/NEWS +++ b/NEWS @@ -19,6 +19,13 @@ is preserved for the udev version started in the rootfs. The command 'udevadm info --convert-db' is gone. The udev daemon itself, at startup, converts any old database version if necessary. +The systemd services files have been reorganized. The udev control +socket is bound by systemd and passed to the started udev daemon. +The udev-settle.service is no longer active by default. Services which +can not handle hotplug setups properly need to actively pull it in to +act like a barrier for basic.target. Alternatively the settle service +can be unconditionally 'systemctl'enabled to work-around such services. + The fstab_import callout is no longer built or installed. Udev should not be used to mount, does not watch changes to fstab, and should not mirror fstab values in the udev database. diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index c5d7e96cb3..be06a39352 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -1,3 +1,11 @@ +# This barrier service is usually not enabled by default. If enabled, +# it acts as a barrier for basic.target -- so all later services will +# wait for udev completely finishing its coldplug run. +# +# It might be enabled just unconditionally, or pulled-in on-demand by +# broken or non-hotplug-aware services that assume a fully populated +# /dev at startup. + [Unit] Description=udev Wait for Complete Device Initialization DefaultDependencies=no @@ -8,3 +16,6 @@ Before=basic.target Type=oneshot RemainAfterExit=yes ExecStart=@sbindir@/udevadm settle + +[Install] +WantedBy=basic.target -- cgit v1.2.3-54-g00ecf From 7ce99fece5e6d0f5696d5e0e93818da76d0ed7cc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 29 Mar 2011 17:59:29 +0200 Subject: systemd: udev.socket - disable implicit dependencies Set hostname to . Found ordering cycle on sysinit.target/start Walked on cycle path to systemd-tmpfiles-setup.service/start Walked on cycle path to local-fs.target/start Walked on cycle path to fedora-storage-init.service/start Walked on cycle path to fedora-wait-storage.service/start Walked on cycle path to udev-settle.service/start Walked on cycle path to udev.service/start Walked on cycle path to udev.socket/start Walked on cycle path to sysinit.target/start Breaking ordering cycle by deleting job systemd-tmpfiles-setup.service/start --- init/udev.socket | 1 + 1 file changed, 1 insertion(+) diff --git a/init/udev.socket b/init/udev.socket index 324ab47093..18a154fc82 100644 --- a/init/udev.socket +++ b/init/udev.socket @@ -1,5 +1,6 @@ [Unit] Description=udev Kernel Device Manager Socket +DefaultDependencies=no [Socket] ListenDatagram=@/org/kernel/udev/udevd -- cgit v1.2.3-54-g00ecf From 30b0fee9be553fbbb5bf1f0d1bd6eae34fdc4fc3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Mar 2011 15:58:14 +0200 Subject: release 167 --- ChangeLog | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 8 +++---- 2 files changed, 78 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1b8caab43b..d62ecbd76e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,77 @@ +Summary of changes from v166 to v167 +============================================ + +Andrey Borzenkov (1): + udev-acl: add /dev/sgX nodes for CD-ROM + +David Zeuthen (1): + cdrom_id: Don't ignore profiles when there is no media available + +Harald Hoyer (2): + cdrom_id: cd_media_toc() extend toc size to 65536 + udev-acl/70-acl.rules: tag ID_REMOTE_CONTROL with acl + +Kay Sievers (29): + version bump + Merge branch 'master' of git+ssh://master.kernel.org/pub/scm/linux/hotplug/udev + v4l_id: kill the v4l1 ioctl + v4l_id: remove left-over variable + update some comments + test-libudev: add short options + libudev: udev_device_get_sysattr_list_entry() update + libudev: resolve ifindex in udev_device_new_from_id_filename() + libudev: bump minor version + udev-acl: move sg rule to optical drive rule + move /dev/.udev/ to /dev/.run/udev/ and convert old udev database at udevd startup + NEWS: clarify /dev/.run/ requirements + input_id: silent gcc warnings + fstab_import: disable build + systemd: remove deprecated udev-retry.service + fstab_import: remove from configure + update sd-daemon.[ch] + udevd: use facility == LOG_DAEMON when writing to /dev/kmsg + udevd: initialize fds, for proper close() on exit + use /run/udev/ if possible and fall back to /dev/.udev/ + rules: run ata_id only on SPC-3 or later optical drives + systemd: bind udev control socket in systemd and split udev.service + systemd: use sockets.target not socket.target + man: remove trigger --type=failed handling + libudev: export udev_get_run_path() + libudev: docs - add udev_get_run_path() + libudev: make valgrind happy + systemd: do not enable udev-settle.service by default + systemd: udev.socket - disable implicit dependencies + +Kei Tokunaga (1): + udevadm: enumerate - update prev pointer properly + +Lee, Chun-Yi (2): + Remap Acer WMI touchpad toggle key to F21 used by X + Remap MSI Laptop touchpad on/off key to F22 and F23 + +Martin Pitt (12): + 60-persistent-input.rules: Support multiple interfaces + Only build v4l_id if V4L1 header file is available + 60-persistent-input.rules: Do not create duplicate links + Fix building with --disable-extras + Do not build extras with --disable-extras + v4l_id: Drop videodev.h check again + keymap: Fix Acer Aspire 5920G media key + input_id: Consistently use tabs for indentation + input_id: Add some debugging output + input_id: Avoid memory overflow with too long capability masks + input_id: Cover key devices which only have KEY_* > 255 + input_id: Rewrite debug logging to use standard udev info() + +Seth Forshee (1): + keymap: continue reading keymap after invalid scancodes + +Thomas Egerer (3): + libudev: allow to get list of all available sysfs attrs for a device + libudev: use sysfs attr ilist interface for attribute walk + udevadm: info - make attribute array static and const + + Summary of changes from v165 to v166 ============================================ diff --git a/NEWS b/NEWS index b86e0bcca0..fedacccfa8 100644 --- a/NEWS +++ b/NEWS @@ -12,7 +12,7 @@ If /run does not exist, or is not writable, udev will fall back using On systemd systems with initramfs and LVM used, packagers must make sure, that the systemd and initramfs versions match. The initramfs -needs to create the /run/ mountpoint for udev to store the data, and +needs to create the /run mountpoint for udev to store the data, and mount this tmpfs to /run in the rootfs, so the that the udev database is preserved for the udev version started in the rootfs. @@ -22,9 +22,9 @@ itself, at startup, converts any old database version if necessary. The systemd services files have been reorganized. The udev control socket is bound by systemd and passed to the started udev daemon. The udev-settle.service is no longer active by default. Services which -can not handle hotplug setups properly need to actively pull it in to -act like a barrier for basic.target. Alternatively the settle service -can be unconditionally 'systemctl'enabled to work-around such services. +can not handle hotplug setups properly need to actively pull it in, to +act like a barrier. Alternatively the settle service can be unconditionally +'systemctl'enabled, and act like a barrier for basic.target. The fstab_import callout is no longer built or installed. Udev should not be used to mount, does not watch changes to fstab, and -- cgit v1.2.3-54-g00ecf From a138cd07145519f30226e06d41b0a11b50864658 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Mar 2011 16:03:56 +0200 Subject: version bump --- NEWS | 4 ++++ configure.ac | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index fedacccfa8..f45957b62d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 168 +======== +Bugfixes. + udev 167 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 1775fb072b..cb7585e58b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [167], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [168], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 42b9482ab2da64b4c2f254c227c0efaf83988a84 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 30 Mar 2011 08:11:03 -0400 Subject: Run ata_id on non-removable USB devices If a USB device is marked as removable, it is often a SATA/PATA disk in an enclosure (note that flash card readers and usb storage sticks are always marked as removable). In this case, try running ata_id (which sends ATA commands wrapped in SCSI ATA PASS THROUGH commands) to get information about the disk. If this fails, just fall back to running usb_id since it could be the device isn't an ATA device at all or the device doesn't have a SAT layer. This extra information is nice to have as it indicates if it is suitable to send e.g. SMART commands to the disk, whether the disk supports power management and so on. Additionally, the VPD and serial number returned by ata_id is usually more accurate as it stems from the disk itself instead of the enclosure. Note that udisks has been doing this for a while KERNEL=="sd*[!0-9]", ATTR{removable}=="0", ENV{ID_BUS}=="usb", ENV{DEVTYPE}=="disk", IMPORT{program}="udisks-probe-ata-smart $tempnode" so this change shouldn't be too disruptive (udisks-probe-ata-smart also sends ATA commands via the ATA PASS THROUGH command). Signed-off-by: David Zeuthen --- rules/rules.d/60-persistent-storage.rules | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 6a9abdd369..12fabeff0e 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -22,14 +22,18 @@ ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" -# USB devices use their own serial number -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" # ATA devices with their own "ata" kernel subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" # ATA devices using the "scsi" subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" # ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $tempnode" + +# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $tempnode" +# Otherwise fall back to using usb_id for USB devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" + # scsi devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" -- cgit v1.2.3-54-g00ecf From daf32d32172e19e78754999b41c27b45e3629326 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 31 Mar 2011 13:15:47 +0200 Subject: systemd: let settle depend on trigger, do not block basic with trigger --- init/udev-settle.service.in | 15 +++++++++------ init/udev-trigger.service.in | 1 - 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index be06a39352..bda8626b2d 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -1,15 +1,18 @@ -# This barrier service is usually not enabled by default. If enabled, -# it acts as a barrier for basic.target -- so all later services will +# This service is usually not enabled by default. If enabled, it +# acts as a barrier for basic.target -- so all later services will # wait for udev completely finishing its coldplug run. # -# It might be enabled just unconditionally, or pulled-in on-demand by -# broken or non-hotplug-aware services that assume a fully populated -# /dev at startup. +# If needed, to work around broken or non-hotplug-aware services, +# it might be enabled unconditionally, or pulled-in on-demand by +# the services that assume a fully populated /dev at startup. It +# should not be used or pulled-in ever on systems without such +# legacy services running. [Unit] Description=udev Wait for Complete Device Initialization DefaultDependencies=no -After=udev.service +Requires=udev.service +After=udev-trigger.service Before=basic.target [Service] diff --git a/init/udev-trigger.service.in b/init/udev-trigger.service.in index 0ede3171ea..745974a7ab 100644 --- a/init/udev-trigger.service.in +++ b/init/udev-trigger.service.in @@ -2,7 +2,6 @@ Description=udev Coldplug all Devices Requires=udev.service After=udev.service -Before=basic.target DefaultDependencies=no [Service] -- cgit v1.2.3-54-g00ecf From ff4a035a8aaba6a7b5b85c4b348886d72c42e84c Mon Sep 17 00:00:00 2001 From: "Lee, Chun-Yi" Date: Thu, 31 Mar 2011 18:01:05 +0800 Subject: Add rule for Acer Aspire One ZG8 to use acer-aspire_5720 keymap Acer Aspire One ZG8's bluetooth HW key emit 0xD9 scancode, it must map to KEY_BLUETOOTH like Acer Aspire 5720. So, add rule for Acer Aspire One ZG8 use acer-aspire_5720 keymap. Tested on Acer Aspire One ZG8 netbook. Signed-off-by: Lee, Chun-Yi Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 0c3ae38d71..44d50642ed 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -100,6 +100,7 @@ ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keyma ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 8930", RUN+="keymap $name acer-aspire_8930" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_serial}=="ZG8*", RUN+="keymap $name acer-aspire_5720" ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" -- cgit v1.2.3-54-g00ecf From 6ee9b2cb8cf023253853f1c80e707598685b11f3 Mon Sep 17 00:00:00 2001 From: Thomas Egerer Date: Thu, 31 Mar 2011 17:25:31 +0200 Subject: udevd: add 'N:' to optstring in getopt_long --- udev/udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index 1871474ff9..a8b339fa1f 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1118,7 +1118,7 @@ int main(int argc, char *argv[]) for (;;) { int option; - option = getopt_long(argc, argv, "c:deDthV", options, NULL); + option = getopt_long(argc, argv, "c:deDtN:hV", options, NULL); if (option == -1) break; -- cgit v1.2.3-54-g00ecf From 9bb54267a1483e8f3b2de352c7be433f625e5606 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 31 Mar 2011 19:23:19 +0200 Subject: Revert "Do not build extras with --disable-extras" This reverts commit 905818f5961446ac32d1b2d165185fffddc4915a. We do want to build some extras, just not the ones with extra dependencies. Thanks to Juergen Daubert for pointing this out. --- Makefile.am | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index df70bf73be..2c20f46c6d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -225,7 +225,6 @@ dist_udevrules_DATA += \ extras/rule_generator/75-cd-aliases-generator.rules \ extras/rule_generator/75-persistent-net-generator.rules -if ENABLE_EXTRAS # ------------------------------------------------------------------------------ # firmware - firmware loading # ------------------------------------------------------------------------------ @@ -314,8 +313,6 @@ extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules -endif # ENABLE_EXTRAS - # ------------------------------------------------------------------------------ # qemu -- qemu/kvm guest tweaks # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From 55eb500cc5465babf1fd773dbcceeb90eeefd997 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 4 Apr 2011 11:47:54 +0200 Subject: Avoid spinning up CD on pressing eject button When the CD tray door is locked and the hardware eject button is pressed, newer kernels (2.6.38+) will send out a change event with a DISK_EJECT_REQUEST==1 property. Do not run cdrom_id and blkid in this case, as the media state and contents does not change, and this only needlessly spins up the drive again right before ejection. --- extras/cdrom_id/60-cdrom_id.rules | 3 +++ rules/rules.d/60-persistent-storage.rules | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index b3109f1d01..aedf6f0558 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -5,6 +5,9 @@ SUBSYSTEM!="block", GOTO="cdrom_end" KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" ENV{DEVTYPE}!="disk", GOTO="cdrom_end" +# this is only a button press event +ENV{DISK_EJECT_REQUEST}=="?*", GOTO="cdrom_end" + KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" IMPORT{program}="cdrom_id --export $tempnode" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 12fabeff0e..05a405f64b 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -62,9 +62,9 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" # probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" # single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" # probe filesystem metadata of disks KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" -- cgit v1.2.3-54-g00ecf From 5e0ec43fc40e3e6dd0e44a7d617846879e1dac9e Mon Sep 17 00:00:00 2001 From: Seth Forshee Date: Tue, 5 Apr 2011 11:43:00 -0500 Subject: keymap: Support Dell Latitude XT2 tablet-mode navigation keys The XT2 has a rocker (up/down/enter) and back button on the side in tablet mode, none of which work currently. Add entries for these keys. There is some overlap here with scan codes used in other Dell models, so these buttons are put in a new file specific to this model. Signed-off-by: Seth Forshee Signed-off-by: Martin Pitt --- Makefile.am | 1 + extras/keymap/95-keymap.rules | 1 + extras/keymap/keymaps/dell-latitude-xt2 | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 extras/keymap/keymaps/dell-latitude-xt2 diff --git a/Makefile.am b/Makefile.am index 2c20f46c6d..4244089822 100644 --- a/Makefile.am +++ b/Makefile.am @@ -568,6 +568,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/asus \ extras/keymap/keymaps/compaq-e_evo \ extras/keymap/keymaps/dell \ + extras/keymap/keymaps/dell-latitude-xt2 \ extras/keymap/keymaps/everex-xt5000 \ extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 44d50642ed..350f111504 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -67,6 +67,7 @@ LABEL="keyboard_vendorcheck" ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1010|Inspiron 1011|Inspiron 1012|Inspiron 1110|Inspiron 1210", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Latitude XT2", RUN+="keymap $name dell-latitude-xt2" ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" diff --git a/extras/keymap/keymaps/dell-latitude-xt2 b/extras/keymap/keymaps/dell-latitude-xt2 new file mode 100644 index 0000000000..39872f559d --- /dev/null +++ b/extras/keymap/keymaps/dell-latitude-xt2 @@ -0,0 +1,4 @@ +0x9B up # tablet rocker up +0x9E enter # tablet rocker press +0x9F back # tablet back +0xA3 down # tablet rocker down -- cgit v1.2.3-54-g00ecf From 51f43b53293c4cc64c2a55598491c6cbf27b6bd5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Apr 2011 01:03:49 +0200 Subject: selinux: do not label files in runtime dir Do not label any files in the udev runtime directory, but only nodes, links and directories below /dev. In case the runtime directory falls back to /dev/.udev, label this directory once at udevd startup, but never anything below it. --- libudev/libudev-private.h | 1 + libudev/libudev-queue-private.c | 2 -- libudev/libudev-util-private.c | 18 +++++++++++++++--- udev/udev-node.c | 6 +++--- udev/udevd.c | 18 ++++++++---------- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 7078b0ff3c..8495f9aaee 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -220,6 +220,7 @@ uint64_t util_string_bloom64(const char *str); /* libudev-util-private.c */ int util_create_path(struct udev *udev, const char *path); +int util_create_path_selinux(struct udev *udev, const char *path); int util_delete_path(struct udev *udev, const char *path); int util_unlink_secure(struct udev *udev, const char *filename); uid_t util_lookup_user(struct udev *udev, const char *user); diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index a714572361..2f1afecb29 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -409,9 +409,7 @@ static void update_failed(struct udev_queue_export *udev_queue_export, /* record event in the failed directory */ udev_queue_export->failed_count++; util_create_path(udev, filename); - udev_selinux_setfscreatecon(udev, filename, S_IFLNK); symlink(udev_device_get_devpath(udev_device), filename); - udev_selinux_resetfscreatecon(udev); break; case DEVICE_QUEUED: diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 6b68b6a366..19f979eeab 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -25,7 +25,7 @@ #include "libudev.h" #include "libudev-private.h" -int util_create_path(struct udev *udev, const char *path) +static int create_path(struct udev *udev, const char *path, bool selinux) { char p[UTIL_PATH_SIZE]; char *pos; @@ -55,7 +55,8 @@ int util_create_path(struct udev *udev, const char *path) return err; dbg(udev, "mkdir '%s'\n", p); - udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); + if (selinux) + udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); err = mkdir(p, 0755); if (err != 0) { err = -errno; @@ -66,10 +67,21 @@ int util_create_path(struct udev *udev, const char *path) err = -ENOTDIR; } } - udev_selinux_resetfscreatecon(udev); + if (selinux) + udev_selinux_resetfscreatecon(udev); return err; } +int util_create_path(struct udev *udev, const char *path) +{ + return create_path(udev, path, false); +} + +int util_create_path_selinux(struct udev *udev, const char *path) +{ + return create_path(udev, path, true); +} + int util_delete_path(struct udev *udev, const char *path) { char p[UTIL_PATH_SIZE]; diff --git a/udev/udev-node.c b/udev/udev-node.c index ab4e932288..5e791ffb6c 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -96,7 +96,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ } else { info(udev, "mknod '%s' %u:%u %#o\n", file, major(devnum), minor(devnum), mode); do { - err = util_create_path(udev, file); + err = util_create_path_selinux(udev, file); if (err != 0 && err != -ENOENT) break; udev_selinux_setfscreatecon(udev, file, mode); @@ -184,7 +184,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) } else { info(udev, "creating symlink '%s' to '%s'\n", slink, target); do { - err = util_create_path(udev, slink); + err = util_create_path_selinux(udev, slink); if (err != 0 && err != -ENOENT) break; udev_selinux_setfscreatecon(udev, slink, S_IFLNK); @@ -201,7 +201,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); unlink(slink_tmp); do { - err = util_create_path(udev, slink_tmp); + err = util_create_path_selinux(udev, slink_tmp); if (err != 0 && err != -ENOENT) break; udev_selinux_setfscreatecon(udev, slink_tmp, S_IFLNK); diff --git a/udev/udevd.c b/udev/udevd.c index a8b339fa1f..df5c1995bc 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -822,7 +822,7 @@ static void static_dev_create_from_modules(struct udev *udev) continue; util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/", devname, NULL); - util_create_path(udev, filename); + util_create_path_selinux(udev, filename); udev_selinux_setfscreatecon(udev, filename, mode); info(udev, "mknod '%s' %c%u:%u\n", filename, type, maj, min); if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST) @@ -833,7 +833,7 @@ static void static_dev_create_from_modules(struct udev *udev) fclose(f); } -static int copy_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) +static int copy_dev_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) { struct dirent *dent; @@ -886,7 +886,7 @@ static int copy_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) continue; } - copy_dir(udev, dir2_from, dir2_to, maxdepth-1); + copy_dev_dir(udev, dir2_from, dir2_to, maxdepth-1); closedir(dir2_to); closedir(dir2_from); @@ -930,7 +930,7 @@ static void static_dev_create_from_devices(struct udev *udev, DIR *dir) dir_from = opendir(LIBEXECDIR "/devices"); if (dir_from == NULL) return; - copy_dir(udev, dir_from, dir, 8); + copy_dev_dir(udev, dir_from, dir, 8); closedir(dir_from); } @@ -985,9 +985,7 @@ static int convert_db(struct udev *udev) /* make sure we do not get here again */ util_create_path(udev, filename); - udev_selinux_setfscreatecon(udev, udev_get_run_path(udev), S_IFDIR|0755); mkdir(filename, 0755); - udev_selinux_resetfscreatecon(udev); /* old database */ util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db", NULL); @@ -1097,9 +1095,7 @@ int main(int argc, char *argv[]) /* make sure, that our runtime dir exists and is writable */ if (utimensat(AT_FDCWD, udev_get_run_config_path(udev), NULL, 0) < 0) { /* try to create our own subdirectory, do not create parent directories */ - udev_selinux_setfscreatecon(udev, udev_get_run_config_path(udev), S_IFDIR|0755); mkdir(udev_get_run_config_path(udev), 0755); - udev_selinux_resetfscreatecon(udev); if (utimensat(AT_FDCWD, udev_get_run_config_path(udev), NULL, 0) >= 0) { /* directory seems writable now */ @@ -1111,8 +1107,12 @@ int main(int argc, char *argv[]) util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev", NULL); if (udev_set_run_path(udev, filename) == NULL) goto exit; + mkdir(udev_get_run_path(udev), 0755); } } + /* relabel runtime dir only if it resides below /dev */ + if (strncmp(udev_get_run_path(udev), udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) == 0) + udev_selinux_lsetfilecon(udev, udev_get_run_path(udev), 0755); info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); for (;;) { @@ -1281,9 +1281,7 @@ int main(int argc, char *argv[]) util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL); if (stat(filename, &statbuf) != 0) { util_create_path(udev, filename); - udev_selinux_setfscreatecon(udev, filename, S_IFDIR|0755); mkdir(filename, 0755); - udev_selinux_resetfscreatecon(udev); } inotify_add_watch(pfd[FD_INOTIFY].fd, filename, IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); -- cgit v1.2.3-54-g00ecf From 960250952193db522b8ced336bf998bd7e8e4a31 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Apr 2011 03:08:16 +0200 Subject: selinux: firmware - do not label files in runtime dir --- extras/firmware/firmware.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c index 81998201b2..f2df76c8c5 100644 --- a/extras/firmware/firmware.c +++ b/extras/firmware/firmware.c @@ -159,11 +159,9 @@ int main(int argc, char **argv) err = util_create_path(udev, misspath); if (err != 0 && err != -ENOENT) break; - udev_selinux_setfscreatecon(udev, misspath, S_IFLNK); err = symlink(devpath, misspath); if (err != 0) err = -errno; - udev_selinux_resetfscreatecon(udev); } while (err == -ENOENT); rc = 2; set_loading(udev, loadpath, "-1"); -- cgit v1.2.3-54-g00ecf From a2ddee73920673aae645ab7fde322251a249024f Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 15:54:04 +0000 Subject: Docs: README: `to replace' -> `replacing' Signed-off-by: Michael Witten --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 78787469cc..92a23724c1 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ udev - Linux userspace device management Integrating udev in the system has complex dependencies and may differ from distribution to distribution. A system may not be able to boot up or work reliably without a properly installed udev version. The upstream udev project -does not recommend to replace a distro's udev installation with the upstream +does not recommend replacing a distro's udev installation with the upstream version. The upstream udev project's set of default rules may require a most recent -- cgit v1.2.3-54-g00ecf From 9698e70c1feae3d4807e4b5c6b53cbc459313f12 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 15:55:18 +0000 Subject: Docs: README: `,' -> `;' Signed-off-by: Michael Witten --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 92a23724c1..b4c65468c7 100644 --- a/README +++ b/README @@ -10,7 +10,7 @@ The upstream udev project's set of default rules may require a most recent kernel release to work properly. This is currently version 2.6.31. Tools and rules shipped by udev are not public API and may change at any time. -Never call any private tool in /lib/udev from any external application, it might +Never call any private tool in /lib/udev from any external application; it might just go away in the next release. Access to udev information is only offered by udevadm and libudev. Tools and rules in /lib/udev, and the entire content of the /dev/.udev directory is private to udev and does change whenever needed. @@ -70,7 +70,7 @@ Setup: - Restarting the daemon does never apply any rules to existing devices. - - New/changed rule files are picked up automatically, there is no daemon + - New/changed rule files are picked up automatically; there is no daemon restart or signal needed. Operation: @@ -80,7 +80,7 @@ Operation: - All kernel events are matched against a set of specified rules, which possibly hook into the event processing and load required kernel modules to setup devices. For all devices the kernel exports a major/minor - number, if needed, udev will create a device node with the default kernel + number; if needed, udev will create a device node with the default kernel name. If specified, udev applies permissions/ownership to the device node, creates additional symlinks pointing to the node, and executes programs to handle the device. -- cgit v1.2.3-54-g00ecf From 600b2584566a44b8a57f546f5ce27f5b1cce21d6 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 15:56:16 +0000 Subject: Docs: README: Clean up a sentence Signed-off-by: Michael Witten --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index b4c65468c7..1eecf9d847 100644 --- a/README +++ b/README @@ -12,8 +12,8 @@ kernel release to work properly. This is currently version 2.6.31. Tools and rules shipped by udev are not public API and may change at any time. Never call any private tool in /lib/udev from any external application; it might just go away in the next release. Access to udev information is only offered -by udevadm and libudev. Tools and rules in /lib/udev, and the entire content of -the /dev/.udev directory is private to udev and does change whenever needed. +by udevadm and libudev. Tools and rules in /lib/udev and the entire contents of +the /dev/.udev directory are private to udev and do change whenever needed. Requirements: - Version 2.6.27 of the Linux kernel with sysfs, procfs, signalfd, inotify, -- cgit v1.2.3-54-g00ecf From 3fe44a296abbac8a3df667861a7c111e95b54ca4 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 15:59:01 +0000 Subject: Docs: README: Use present tense Signed-off-by: Michael Witten --- README | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README b/README index 1eecf9d847..04e722f3d6 100644 --- a/README +++ b/README @@ -31,7 +31,7 @@ Requirements: CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes) CONFIG_BLK_DEV_BSG=y (SCSI devices) - - Udev will not work with the CONFIG_SYSFS_DEPRECATED* option. + - Udev does not work with the CONFIG_SYSFS_DEPRECATED* option. - Unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, but it is not supported. @@ -57,8 +57,8 @@ Requirements: Setup: - At bootup, the /dev directory should get the 'devtmpfs' filesystem - mounted. Udev will manage permissions and ownership of the kernel-created - device nodes, and possibly create additional symlinks. If needed, udev also + mounted. Udev manages the permissions and ownership of the kernel-created + device nodes, and udev possibly creates additional symlinks. If needed, udev also works on an empty 'tmpfs' filesystem, but some static device nodes like /dev/null, /dev/console, /dev/kmsg are needed to be able to start udev itself. @@ -80,7 +80,7 @@ Operation: - All kernel events are matched against a set of specified rules, which possibly hook into the event processing and load required kernel modules to setup devices. For all devices the kernel exports a major/minor - number; if needed, udev will create a device node with the default kernel + number; if needed, udev creates a device node with the default kernel name. If specified, udev applies permissions/ownership to the device node, creates additional symlinks pointing to the node, and executes programs to handle the device. -- cgit v1.2.3-54-g00ecf From bde1af68b61f0f36127de09eee5a5051ae5c9167 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:00:01 +0000 Subject: Docs: README: Add missing `and' Signed-off-by: Michael Witten --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 04e722f3d6..5cac0213ad 100644 --- a/README +++ b/README @@ -41,18 +41,18 @@ Requirements: unusable because the kernel may create too many processes in parallel so that the system runs out-of-memory. - - The proc filesystem must be mounted on /proc, the sysfs filesystem must + - The proc filesystem must be mounted on /proc, and the sysfs filesystem must be mounted at /sys. No other locations are supported by a standard udev installation. - The system must have the following group names resolvable at udev startup: - disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, kmem. + disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, and kmem. Especially in LDAP setups, it is required, that getgrnam() is able to resolve these group names with only the rootfs mounted, and while no network is available. - To build all 'udev extras', libacl, libglib2, libusb, usbutils, pciutils, - gperf are needed. These dependencies can be disabled with the + and gperf are needed. These dependencies can be disabled with the --disable-extras configure option. Setup: -- cgit v1.2.3-54-g00ecf From 47d9121c9a6a6d4d3415e6a012ebbb3256440a65 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:01:18 +0000 Subject: Docs: README: Remove commas and use subjective mood Signed-off-by: Michael Witten --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index 5cac0213ad..6aabf69f8a 100644 --- a/README +++ b/README @@ -47,8 +47,8 @@ Requirements: - The system must have the following group names resolvable at udev startup: disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, and kmem. - Especially in LDAP setups, it is required, that getgrnam() is able to resolve - these group names with only the rootfs mounted, and while no network is + Especially in LDAP setups, it is required that getgrnam() be able to resolve + these group names with only the rootfs mounted and while no network is available. - To build all 'udev extras', libacl, libglib2, libusb, usbutils, pciutils, -- cgit v1.2.3-54-g00ecf From 1224944f61d88d7e09010c808b117ce102c61ef9 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:04:38 +0000 Subject: Docs: README: Clean up `udev extras' requirements Signed-off-by: Michael Witten --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 6aabf69f8a..10a937a76e 100644 --- a/README +++ b/README @@ -51,9 +51,9 @@ Requirements: these group names with only the rootfs mounted and while no network is available. - - To build all 'udev extras', libacl, libglib2, libusb, usbutils, pciutils, - and gperf are needed. These dependencies can be disabled with the - --disable-extras configure option. + - The 'udev extras' has the following dependencies: + libacl, libglib2, libusb, usbutils, pciutils, and gperf. + These dependencies can be disabled with the --disable-extras configure option. Setup: - At bootup, the /dev directory should get the 'devtmpfs' filesystem -- cgit v1.2.3-54-g00ecf From e62c9c72cdb4ff920c71679f230cde9736570ee7 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:14:48 +0000 Subject: Docs: README: Clarify configuration of existing devices Signed-off-by: Michael Witten --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 10a937a76e..8d4ecbd5cc 100644 --- a/README +++ b/README @@ -64,7 +64,7 @@ Setup: - The udev daemon should be started to handle device events sent by the kernel. During bootup, the kernel can be asked to send events for all already existing - devices, to apply the configuration to these devices. This is usually done by: + devices so that they too can be configured by udev. This is usually done by: /sbin/udevadm trigger --type=subsystems /sbin/udevadm trigger --type=devices -- cgit v1.2.3-54-g00ecf From cb936a3961f37ccb8eef0c505b8fffa6711c57be Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:15:39 +0000 Subject: Docs: README: `does never apply' -> `never applies' Signed-off-by: Michael Witten --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 8d4ecbd5cc..7f0399e711 100644 --- a/README +++ b/README @@ -68,7 +68,7 @@ Setup: /sbin/udevadm trigger --type=subsystems /sbin/udevadm trigger --type=devices - - Restarting the daemon does never apply any rules to existing devices. + - Restarting the daemon never applies any rules to existing devices. - New/changed rule files are picked up automatically; there is no daemon restart or signal needed. -- cgit v1.2.3-54-g00ecf From fd752623faf6a3a4f2ac17e1a9d24f589119084d Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:18:32 +0000 Subject: Docs: README: Flip sentence structure to improve wording Signed-off-by: Michael Witten --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index 7f0399e711..350a22b45f 100644 --- a/README +++ b/README @@ -74,8 +74,8 @@ Setup: restart or signal needed. Operation: - - Udev creates/removes device nodes in /dev, based on events the kernel - sends out on device creation/removal. + - Based on events the kernel sends out on device creation/removal, udev + creates/removes device nodes in the /dev directory. - All kernel events are matched against a set of specified rules, which possibly hook into the event processing and load required kernel -- cgit v1.2.3-54-g00ecf From 00ecb6745b4021a9cae6056132dc5be3cfcc26b5 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:19:46 +0000 Subject: Docs: README: `set up' is the verb; `setup' is a noun Signed-off-by: Michael Witten --- README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README b/README index 350a22b45f..476ee2ec6e 100644 --- a/README +++ b/README @@ -79,7 +79,7 @@ Operation: - All kernel events are matched against a set of specified rules, which possibly hook into the event processing and load required kernel - modules to setup devices. For all devices the kernel exports a major/minor + modules to set up devices. For all devices the kernel exports a major/minor number; if needed, udev creates a device node with the default kernel name. If specified, udev applies permissions/ownership to the device node, creates additional symlinks pointing to the node, and executes -- cgit v1.2.3-54-g00ecf From 49500e9b0db05a630e2baa37443c5f2facf359ad Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:20:18 +0000 Subject: Docs: README: Add a comma to offset the modifier Signed-off-by: Michael Witten --- README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README b/README index 476ee2ec6e..4520f3dbe3 100644 --- a/README +++ b/README @@ -79,7 +79,7 @@ Operation: - All kernel events are matched against a set of specified rules, which possibly hook into the event processing and load required kernel - modules to set up devices. For all devices the kernel exports a major/minor + modules to set up devices. For all devices, the kernel exports a major/minor number; if needed, udev creates a device node with the default kernel name. If specified, udev applies permissions/ownership to the device node, creates additional symlinks pointing to the node, and executes @@ -90,7 +90,7 @@ Operation: http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/ http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/ -For more details about udev and udev rules see the udev(7) man page. +For more details about udev and udev rules, see the udev(7) man page. Please direct any comment/question to the linux-hotplug mailing list at: linux-hotplug@vger.kernel.org -- cgit v1.2.3-54-g00ecf From 0e4fa2abfefd6fd955e8cada7caf2733dabc529e Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:37:31 +0000 Subject: Docs: udev.xml: Offset daemon name with commas Signed-off-by: Michael Witten --- udev/udev.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index ae9179826a..41d9790053 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -27,8 +27,8 @@ names provide a way to reliably identify devices based on their properties or current configuration. - The udev daemon udevd - 8 receives device uevents directly from + The udev daemon, udevd + 8, receives device uevents directly from the kernel whenever a device is added or removed from the system, or it changes its state. When udev receives a device event, it matches its configured set of rules against various device attributes to identify the device. Rules that match, may -- cgit v1.2.3-54-g00ecf From 0e846301f4439b2d3b8120efe9bdd647a9c3c758 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:39:17 +0000 Subject: Docs: udev.xml: Remove commas (and unnecessary repetition) Signed-off-by: Michael Witten --- udev/udev.xml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 41d9790053..c2d3f15446 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -31,18 +31,18 @@ 8, receives device uevents directly from the kernel whenever a device is added or removed from the system, or it changes its state. When udev receives a device event, it matches its configured set of rules - against various device attributes to identify the device. Rules that match, may - provide additional device information to be stored in the udev database, or information + against various device attributes to identify the device. Rules that match may + provide additional device information to be stored in the udev database or to be used to create meaningful symlink names. - All device information udev processes, is stored in the udev database and + All device information udev processes is stored in the udev database and sent out to possible event subscribers. Access to all stored data and the event sources are provided by the library libudev. Configuration udev configuration files are placed in /etc/udev/ - and /lib/udev/. All empty lines, or lines beginning with + and /lib/udev/. All empty lines or lines beginning with '#' will be ignored. Configuration file @@ -113,7 +113,7 @@ - Assign a value to a key. Keys that represent a list, are reset + Assign a value to a key. Keys that represent a list are reset and only this single value is assigned. @@ -483,7 +483,7 @@ - Number of seconds an event will wait for operations to finish, before it + Number of seconds an event will wait for operations to finish before it will terminate itself. @@ -499,10 +499,10 @@ Apply the permissions specified in this rule to a static device node with - the specified name. Static device nodes might be provided by kernel modules, + the specified name. Static device nodes might be provided by kernel modules or copied from /lib/udev/devices. These nodes might not have - a corresponding kernel device at the time udevd is started, and allow to trigger - automatic kernel module on-demand loading. + a corresponding kernel device at the time udevd is started; they can trigger + automatic kernel module loading. @@ -574,7 +574,7 @@ , - The value of a sysfs attribute found at the device, where + The value of a sysfs attribute found at the device where all keys of the rule have matched. If the matching device does not have such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or ATTRS test selected a parent device, use the attribute from that -- cgit v1.2.3-54-g00ecf From 17fd0f60f2735cbe1bb79ba55fed55291dd61fd2 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:41:14 +0000 Subject: Docs: udev.xml: `are' -> `is'; the subject is `Access' Signed-off-by: Michael Witten --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index c2d3f15446..2fc72ca91a 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -37,7 +37,7 @@ All device information udev processes is stored in the udev database and sent out to possible event subscribers. Access to all stored data and the event - sources are provided by the library libudev. + sources is provided by the library libudev. Configuration -- cgit v1.2.3-54-g00ecf From 933b56237d1de2927d4d27a007a56b9bfeb61738 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 16:50:42 +0000 Subject: Docs: udev.xml: Use present tense Signed-off-by: Michael Witten --- udev/udev.xml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 2fc72ca91a..c18d009b74 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -43,7 +43,7 @@ Configuration udev configuration files are placed in /etc/udev/ and /lib/udev/. All empty lines or lines beginning with - '#' will be ignored. + '#' are ignored. Configuration file udev expects its main configuration file at /etc/udev/udev.conf. @@ -314,25 +314,25 @@ and removes the node before udev even receives any event. Changing the node name from the kernel's default creates inconsistencies and is not supported. If the kernel and NAME specify different names, - an error will be logged. Udev is only expected to handle device node + an error is logged. Udev is only expected to handle device node permissions and to create additional symlinks, not to change kernel-provided device node names. Instead of renaming a device node, SYMLINK should be used. Symlink names must never conflict with - device node names, it will result in unpredictable behavior. + device node names, it results in unpredictable behavior. - The name of a symlink targeting the node. Every matching rule will add + The name of a symlink targeting the node. Every matching rule adds this value to the list of symlinks to be created. Multiple symlinks may be specified by separating the names by the space character. In case multiple - devices claim the same name, the link will always point to the device with - the highest link_priority. If the current device goes away, the links will - be re-evaluated and the device with the next highest link_priority will own + devices claim the same name, the link always points to the device with + the highest link_priority. If the current device goes away, the links are + re-evaluated and the device with the next highest link_priority becomes the owner of the link. If no link_priority is specified, the order of the devices, and - which one of them will own the link, is undefined. Claiming the same name for + which one of them owns the link, is undefined. Claiming the same name for a symlink, which is or might be used for a device node, may result in unexpected behavior and is not supported. @@ -439,7 +439,7 @@ Import a single property from the kernel commandline. For simple flags - the value of the property will be set to '1'. + the value of the property is set to '1'. @@ -453,7 +453,7 @@ - If no option is given, udev will choose between + If no option is given, udev chooses between and based on the executable bit of the file permissions. @@ -483,8 +483,8 @@ - Number of seconds an event will wait for operations to finish before it - will terminate itself. + Number of seconds an event waits for operations to finish before + giving up and terminating itself. @@ -509,7 +509,7 @@ Watch the device node with inotify, when closed after being opened for - writing, a change uevent will be synthesised. + writing, a change uevent is synthesised. -- cgit v1.2.3-54-g00ecf From d4a7bf2583f004e23452ca84ce2e11b7be819529 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 17:25:05 +0000 Subject: Docs: udev.xml: Clarification through proper wording Signed-off-by: Michael Witten --- udev/udev.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index c18d009b74..3bf7ee8ec5 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -74,10 +74,10 @@ default rules directory /lib/udev/rules.d/, the custom rules directory /etc/udev/rules.d/ and the temporary rules directory /run/udev/rules.d/. - All rule files are sorted and processed in lexical order, regardless - in which of these directories they live. Files in - /etc/udev/rules.d/ have precedence over files with - the same name in /lib/udev/rules.d/. This can be + All rule files are collectively sorted and processed in lexical order, + regardless of the directories in which they live. However, files in + /etc/udev/rules.d/ take precedence over files with + the same name in /lib/udev/rules.d/; this can be used to ignore a default rules file if needed. Rule files must end in .rules, other extensions -- cgit v1.2.3-54-g00ecf From c3cba32f18fc73e94975692fa1e68f1db2acf4fc Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 17:28:58 +0000 Subject: Docs: udev.xml: `,' -> `;' Signed-off-by: Michael Witten --- udev/udev.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 3bf7ee8ec5..d777570eb8 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -80,8 +80,8 @@ the same name in /lib/udev/rules.d/; this can be used to ignore a default rules file if needed. - Rule files must end in .rules, other extensions - are ignored. + Rule files must have the extension .rules; other + extensions are ignored. Every line in the rules file contains at least one key value pair. There are two kind of keys, match and assignment keys. @@ -508,7 +508,7 @@ - Watch the device node with inotify, when closed after being opened for + Watch the device node with inotify; when closed after being opened for writing, a change uevent is synthesised. -- cgit v1.2.3-54-g00ecf From feedf8f3ee3773b93a293c821c2b36ea7808b059 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:08:15 +0000 Subject: Docs: udev.xml: `key value' -> `key-value' Signed-off-by: Michael Witten --- udev/udev.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index d777570eb8..fcd2fe512f 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -83,7 +83,7 @@ Rule files must have the extension .rules; other extensions are ignored. - Every line in the rules file contains at least one key value pair. + Every line in the rules file contains at least one key-value pair. There are two kind of keys, match and assignment keys. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. @@ -92,7 +92,7 @@ pointing to the device node, or run a specified program as part of the event handling. - A rule consists of a list of one or more key value pairs separated by + A rule consists of a list of one or more key-value pairs separated by a comma. Each key has a distinct operation, depending on the used operator. Valid operators are: -- cgit v1.2.3-54-g00ecf From 57c0409fcebbfc34e386cc48425f44c364d378ff Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:13:37 +0000 Subject: Docs: udev.xml: `,' -> `:' Signed-off-by: Michael Witten --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index fcd2fe512f..e012bf8182 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -84,7 +84,7 @@ extensions are ignored. Every line in the rules file contains at least one key-value pair. - There are two kind of keys, match and assignment keys. + There are two kind of keys: match and assignment. If all match keys are matching against its value, the rule gets applied and the assign keys get the specified value assigned. -- cgit v1.2.3-54-g00ecf From b834042f05a821f29e3d7cdb4d9262a9b7cdfc4d Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:15:25 +0000 Subject: Docs: udev.xml: Use `assignment' consistently Signed-off-by: Michael Witten --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index e012bf8182..475ded701d 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -86,7 +86,7 @@ Every line in the rules file contains at least one key-value pair. There are two kind of keys: match and assignment. If all match keys are matching against its value, the rule gets applied and the - assign keys get the specified value assigned. + assignment keys get the specified value assigned. A matching rule may rename a network interface, add symlinks pointing to the device node, or run a specified program as part of -- cgit v1.2.3-54-g00ecf From 55f5037ce819432e39f82f7634b35262104672f9 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:23:46 +0000 Subject: Docs: udev.xml: `comma-separated' is a better description Signed-off-by: Michael Witten --- udev/udev.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 475ded701d..8224311221 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -92,8 +92,8 @@ pointing to the device node, or run a specified program as part of the event handling. - A rule consists of a list of one or more key-value pairs separated by - a comma. Each key has a distinct operation, depending on the used operator. Valid + A rule consists of a comma-separated list of one or more key-value pairs. + Each key has a distinct operation, depending on the used operator. Valid operators are: -- cgit v1.2.3-54-g00ecf From 2bf11540cff14a3acbf834505ad84c866336755e Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:26:51 +0000 Subject: Docs: udev.xml: Remove unnecessary repitition Signed-off-by: Michael Witten --- udev/udev.xml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 8224311221..668ce551e2 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -128,8 +128,7 @@ - Assign a value to a key finally; disallow any later changes, - which may be used to prevent changes by any later rules. + Assign a value to a key finally; disallow any later changes. -- cgit v1.2.3-54-g00ecf From 2e7f69ebbffdddf2933a2f350a8e973bfa08a880 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:30:04 +0000 Subject: Docs: udev.xml: Add a few more words for context Signed-off-by: Michael Witten --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 668ce551e2..74917e1547 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -188,7 +188,7 @@ - Match the driver name of the event device. Only set for devices + Match the driver name of the event device. Only set this key for devices which are bound to a driver at the time the event is generated. -- cgit v1.2.3-54-g00ecf From 65e039c2e2ec53b90aff1b949c3fc59fe1a8c02a Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:31:20 +0000 Subject: Docs: udev.xml: Use `unless' for clarity Signed-off-by: Michael Witten --- udev/udev.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 74917e1547..3b1b4f83de 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -196,8 +196,8 @@ Match sysfs attribute values of the event device. Trailing - whitespace in the attribute values is ignored, if the specified match - value does not contain trailing whitespace itself. + whitespace in the attribute values is ignored unless the specified match + value itself contains trailing whitespace. @@ -228,8 +228,8 @@ Search the devpath upwards for a device with matching sysfs attribute values. If multiple matches are specified, all of them - must match on the same device. Trailing whitespace in the attribute values is ignored, - if the specified match value does not contain trailing whitespace itself. + must match on the same device. Trailing whitespace in the attribute values is ignored + unless the specified match value itself contains trailing whitespace. -- cgit v1.2.3-54-g00ecf From 2e9820e374b3f849cc120b10ab2db6053ce03dc2 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:39:33 +0000 Subject: Docs: udev.xml: Clarify PROGRAM key Signed-off-by: Michael Witten --- udev/udev.xml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 3b1b4f83de..c9083446ed 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -258,10 +258,11 @@ - Execute a program. The key is true, if the program returns + Execute a program to determine whether there + is a match; the key is true if the program returns successfully. The device properties are made available to the - executed program in the environment. The program's output printed to - stdout, is available in the RESULT key. + executed program in the environment. The program's stdout + is available in the RESULT key. -- cgit v1.2.3-54-g00ecf From 401e59e9aefdda48d037e8d5026c2c8e1edec96e Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:40:34 +0000 Subject: Docs: udev.xml: `a shell style' -> `shell-style' Signed-off-by: Michael Witten --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index c9083446ed..78b538bd4a 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -275,7 +275,7 @@ - Most of the fields support a shell style pattern matching. The following + Most of the fields support shell-style pattern matching. The following pattern characters are supported: -- cgit v1.2.3-54-g00ecf From 954e9c52d1b28c4e2607dd98c62c8424e46f8549 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:41:32 +0000 Subject: Docs: udev.xml: Clean `*' description Signed-off-by: Michael Witten --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 78b538bd4a..40ccd541a0 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -281,7 +281,7 @@ - Matches zero, or any number of characters. + Matches zero or more characters. -- cgit v1.2.3-54-g00ecf From 2c47027b31f7af9b7b25348f2baba77bba586b61 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 21:45:16 +0000 Subject: Docs: udev.xml: Clean character range description Signed-off-by: Michael Witten --- udev/udev.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 40ccd541a0..77053b7700 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -295,8 +295,8 @@ Matches any single character specified within the brackets. For example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. - Ranges are also supported within this match with the '-' character. - For example, to match on the range of all digits, the pattern [0-9] would + Ranges are also supported via the '-' character. + For example, to match on the range of all digits, the pattern [0-9] could be used. If the first character following the '[' is a '!', any characters not enclosed are matched. -- cgit v1.2.3-54-g00ecf From ac1ba8e487b12e15c12e64ac78023b9dfbc0a30e Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 23:17:39 +0000 Subject: Docs: udev.xml: Clean up description of NAME assignment key Signed-off-by: Michael Witten --- udev/udev.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 77053b7700..225ad5ce3f 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -308,17 +308,17 @@ - The name, a network interface should be renamed to. Or as - a temporary workaround, the name a device node should be named. - Usually the kernel provides the defined node name, or even creates + What a network interface should be named. + Also, as a temporary workaround, this is what a device node + should be named; usually the kernel provides the defined node name or creates and removes the node before udev even receives any event. Changing the node name from the kernel's default creates inconsistencies and is not supported. If the kernel and NAME specify different names, - an error is logged. Udev is only expected to handle device node + an error is logged. udev is only expected to handle device node permissions and to create additional symlinks, not to change kernel-provided device node names. Instead of renaming a device node, - SYMLINK should be used. Symlink names must never conflict with - device node names, it results in unpredictable behavior. + SYMLINK should be used. However, symlink names must never conflict with + device node names, as that would result in unpredictable behavior. -- cgit v1.2.3-54-g00ecf From 9f38b806d273e19c4fcb71fdcbaa9c61839b2a51 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 23:21:51 +0000 Subject: Docs: udev.xml: Clean up description of SYMLINK assignment key Signed-off-by: Michael Witten --- udev/udev.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 225ad5ce3f..dc277c8918 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -331,10 +331,10 @@ devices claim the same name, the link always points to the device with the highest link_priority. If the current device goes away, the links are re-evaluated and the device with the next highest link_priority becomes the owner of - the link. If no link_priority is specified, the order of the devices, and - which one of them owns the link, is undefined. Claiming the same name for - a symlink, which is or might be used for a device node, may result in - unexpected behavior and is not supported. + the link. If no link_priority is specified, the order of the devices (and + which one of them owns the link) is undefined. Also, symlink names must + never conflict with the kernel's default device node names, as that would + result in unpredictable behavior. -- cgit v1.2.3-54-g00ecf From ed9c5fb721b45a647c4c629ca2b6a242a111e769 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 23:24:03 +0000 Subject: Docs: udev.xml: Clean up description of ENV assignment key Signed-off-by: Michael Witten --- udev/udev.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index dc277c8918..b10096544b 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -359,7 +359,8 @@ Set a device property value. Property names with a leading '.' - are not stored in the database or exported to external tool or events. + are neither stored in the database nor exported to events or + external tools (run by, say, the PROGRAM match key). -- cgit v1.2.3-54-g00ecf From 1d14abe61ff7f22f861fb2bbe06f0fdd64ac4c03 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 23:32:09 +0000 Subject: Docs: udev.xml: Clean up description of RUN assignment key Signed-off-by: Michael Witten --- udev/udev.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index b10096544b..f2e629a823 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -386,9 +386,11 @@ this or a dependent device. Long running tasks need to be immediately detached from the event process itself. If no absolute path is given, the program is expected to live in - /lib/udev, otherwise the absolute path must be - specified. Program name and arguments are separated by spaces. Single quotes - can be used to specify arguments with spaces. + the directory provided at compile-time to configure via --libexecdir + (this is usually /lib/udev), otherwise the absolute + path must be specified. The program name and following arguments are + separated by spaces. Single quotes can be used to specify arguments with + spaces. -- cgit v1.2.3-54-g00ecf From c24dfc80c6dded0184ecc3d9479c970b5a70e4e4 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 23:32:52 +0000 Subject: Docs: udev.xml: Clean up description of LABEL assignment key Signed-off-by: Michael Witten --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index f2e629a823..517d650ad8 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -397,7 +397,7 @@ - Named label where a GOTO can jump to. + A named label to which a GOTO may jump. -- cgit v1.2.3-54-g00ecf From 2f16de298f3b77a1973d9f5ac4af110a61cb8f27 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Fri, 8 Apr 2011 23:34:52 +0000 Subject: Docs: udev.xml: Add missing `.' Signed-off-by: Michael Witten --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 517d650ad8..336311c577 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -404,7 +404,7 @@ - Jumps to the next LABEL with a matching name + Jumps to the next LABEL with a matching name. -- cgit v1.2.3-54-g00ecf From b6a49cd681ac3ffd0702a79741fb482db85b5a36 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 00:56:21 +0000 Subject: Docs: udev.xml: `which' -> `content of which' --- udev/udev.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 336311c577..b9884e521c 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -426,8 +426,8 @@ - Import a text file specified as the assigned value, which must be in - environment key format. + Import a text file specified as the assigned value, the content + of which must be in environment key format. -- cgit v1.2.3-54-g00ecf From ad9c70a8364e1792cb8d2536d2acf0a821b266fe Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 00:57:39 +0000 Subject: Docs: udev.xml: `commandline' -> `command line' --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index b9884e521c..66eeea4e31 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -441,7 +441,7 @@ - Import a single property from the kernel commandline. For simple flags + Import a single property from the kernel command line. For simple flags the value of the property is set to '1'. -- cgit v1.2.3-54-g00ecf From 793681cb55f22137016e4a01e7bec6f846297f34 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 01:00:57 +0000 Subject: Docs: udev.xml: Clean up WAIT_FOR description --- udev/udev.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 66eeea4e31..f472d9a7b8 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -465,9 +465,9 @@ - Wait for a file to become available or until a 10 - seconds timeout expires. The path is relative to the sysfs device, - i. e. if no path is specified this waits for an attribute to appear. + Wait for a file to become available or until a timeout of + 10 seconds expires. The path is relative to the sysfs device; + if no path is specified, this waits for an attribute to appear. -- cgit v1.2.3-54-g00ecf From 0fbda083a2977fe1809467913cc198bbdb681041 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 01:07:35 +0000 Subject: Docs: udev.xml: `a' -> `the' --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index f472d9a7b8..48980577c0 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -501,7 +501,7 @@ - Apply the permissions specified in this rule to a static device node with + Apply the permissions specified in this rule to the static device node with the specified name. Static device nodes might be provided by kernel modules or copied from /lib/udev/devices. These nodes might not have a corresponding kernel device at the time udevd is started; they can trigger -- cgit v1.2.3-54-g00ecf From 57e804843b42676246f14cea149299189abb8d18 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 01:12:52 +0000 Subject: Docs: udev.xml: Clean up introduction to substitutions. For one thing, they are not at all like printf conversion specifications. --- udev/udev.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 48980577c0..57f13e07b0 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -528,10 +528,10 @@ The , , , , , and - fields support simple printf-like string substitutions. The - format chars gets applied after all rules have been processed, right before the program - is executed. It allows the use of device properties set by earlier matching - rules. For all other fields, substitutions are applied while the individual rule is + fields support simple string substitutions. The + substitutions are performed after all rules have been processed, right before the program + is executed, allowing for the use of device properties set by earlier matching + rules. For all other fields, substitutions are performed while the individual rule is being processed. The available substitutions are: -- cgit v1.2.3-54-g00ecf From f2db23cd0d07a2c7992b8fb59497a8355bb16108 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 01:29:37 +0000 Subject: Docs: udev.xml: Use normal sentence structure --- udev/udev.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 57f13e07b0..8cace1a1c6 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -580,8 +580,8 @@ The value of a sysfs attribute found at the device where all keys of the rule have matched. If the matching device does not have such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or - ATTRS test selected a parent device, use the attribute from that - parent device. + ATTRS test selected a parent device, then the attribute from that + parent device is used. If the attribute is a symlink, the last element of the symlink target is returned as the value. -- cgit v1.2.3-54-g00ecf From f61501b0f872b02951fba76ae4c6a079da042ed7 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 01:30:25 +0000 Subject: Docs: udev.xml: Actually make a separate paragraph --- udev/udev.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 8cace1a1c6..6f32f2164f 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -581,8 +581,8 @@ all keys of the rule have matched. If the matching device does not have such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or ATTRS test selected a parent device, then the attribute from that - parent device is used. - If the attribute is a symlink, the last element of the symlink target is + parent device is used. + If the attribute is a symlink, the last element of the symlink target is returned as the value. -- cgit v1.2.3-54-g00ecf From 21188522ae018e7c819271dd9213c3fdd81925c1 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 03:43:16 +0000 Subject: Docs: udev.xml: Add comma --- udev/udev.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 6f32f2164f..04e98e8963 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -612,9 +612,9 @@ , The string returned by the external program requested with PROGRAM. - A single part of the string, separated by a space character may be selected + A single part of the string, separated by a space character, may be selected by specifying the part number as an attribute: . - If the number is followed by the '+' char this part plus all remaining parts + If the number is followed by the '+' char, this part plus all remaining parts of the result string are substituted: -- cgit v1.2.3-54-g00ecf From 509c02f16086bfce87943071daaa62fe34557641 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 03:44:43 +0000 Subject: Docs: udev.xml: `char' -> `character' --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 04e98e8963..0d6b4ef3ae 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -614,7 +614,7 @@ The string returned by the external program requested with PROGRAM. A single part of the string, separated by a space character, may be selected by specifying the part number as an attribute: . - If the number is followed by the '+' char, this part plus all remaining parts + If the number is followed by the '+' character, this part plus all remaining parts of the result string are substituted: -- cgit v1.2.3-54-g00ecf From e8b5e4e590aa8802db2f8c20e022ef06ee2d00ba Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 03:50:11 +0000 Subject: Docs: udev.xml: `comma-separated' is a better description --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 0d6b4ef3ae..263c3cfee1 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -637,7 +637,7 @@ - The current list of symlinks, separated by a space character. The value is + A space-separated list of the current symlinks. The value is only set if an earlier rule assigned a value, or during a remove events. -- cgit v1.2.3-54-g00ecf From 2d74bc75792bdd993e6298cf253541624001517c Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 03:50:42 +0000 Subject: Docs: udev.xml: Clarify through a change in word ordering --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 263c3cfee1..8521424206 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -638,7 +638,7 @@ A space-separated list of the current symlinks. The value is - only set if an earlier rule assigned a value, or during a remove events. + only set during a remove event or if an earlier rule assigned a value. -- cgit v1.2.3-54-g00ecf From d0878effb94b9375185e9f590e1708b3664b8ab3 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 03:51:43 +0000 Subject: Docs: udev.xml: Improved word order --- udev/udev.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev.xml b/udev/udev.xml index 8521424206..9b40cbb03e 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -659,7 +659,7 @@ , - The name of a created temporary device node to provide access to + The name of a temporary device node created to provide access to the device from a external program before the real node is created. -- cgit v1.2.3-54-g00ecf From 620da34de221f70df7c61d3cdefef46bf56dac25 Mon Sep 17 00:00:00 2001 From: Michael Witten Date: Mon, 11 Apr 2011 04:16:31 +0000 Subject: Docs: udev.xml: Fix dangling modifier --- udev/udev.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index 9b40cbb03e..8a4212fd54 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -511,8 +511,8 @@ - Watch the device node with inotify; when closed after being opened for - writing, a change uevent is synthesised. + Watch the device node with inotify; when the node is closed after being opened for + writing, a change uevent is synthesized. -- cgit v1.2.3-54-g00ecf From ff2c503df091e6e4e9ab48cdb6df6ec8b7b525d0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Apr 2011 01:17:09 +0200 Subject: udevadm: control - add --exit --- TODO | 4 +- init/udev.socket | 2 +- libudev/libudev-ctrl.c | 199 +++++++++++++++++++------ libudev/libudev-private.h | 30 ++-- udev/udevadm-control.c | 59 +++++--- udev/udevadm-settle.c | 21 +-- udev/udevadm.xml | 12 ++ udev/udevd.c | 371 +++++++++++++++++++++++++++++++--------------- 8 files changed, 484 insertions(+), 214 deletions(-) diff --git a/TODO b/TODO index 964ffe9cbb..65f7058ae5 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,6 @@ - - bind control socket in systemd + - use inotify() in settle + + - do not write age/configured in initramfs - remove deprecated trigger --type=failed logic diff --git a/init/udev.socket b/init/udev.socket index 18a154fc82..81296306ac 100644 --- a/init/udev.socket +++ b/init/udev.socket @@ -3,4 +3,4 @@ Description=udev Kernel Device Manager Socket DefaultDependencies=no [Socket] -ListenDatagram=@/org/kernel/udev/udevd +ListenSequentialPacket=@/org/kernel/udev/udevd diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c index 63bf539197..cea1b7f55b 100644 --- a/libudev/libudev-ctrl.c +++ b/libudev/libudev-ctrl.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -33,7 +34,8 @@ enum udev_ctrl_msg_type { UDEV_CTRL_RELOAD_RULES, UDEV_CTRL_SET_ENV, UDEV_CTRL_SET_CHILDREN_MAX, - UDEV_CTRL_SETTLE, + UDEV_CTRL_PING, + UDEV_CTRL_EXIT, }; struct udev_ctrl_msg_wire { @@ -48,9 +50,8 @@ struct udev_ctrl_msg_wire { struct udev_ctrl_msg { int refcount; - struct udev_ctrl *uctrl; + struct udev_ctrl_connection *conn; struct udev_ctrl_msg_wire ctrl_msg_wire; - pid_t pid; }; struct udev_ctrl { @@ -59,6 +60,13 @@ struct udev_ctrl { int sock; struct sockaddr_un saddr; socklen_t addrlen; + bool connected; +}; + +struct udev_ctrl_connection { + int refcount; + struct udev_ctrl *uctrl; + int sock; }; static struct udev_ctrl *udev_ctrl_new(struct udev *udev) @@ -81,7 +89,7 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke if (uctrl == NULL) return NULL; - uctrl->sock = socket(AF_LOCAL, SOCK_DGRAM, 0); + uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET, 0); if (uctrl->sock < 0) { err(udev, "error getting socket: %m\n"); udev_ctrl_unref(uctrl); @@ -112,18 +120,21 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) { int err; - const int on = 1; if (uctrl->addrlen > 0) { err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); if (err < 0) { + err = -errno; err(uctrl->udev, "bind failed: %m\n"); return err; } + err = listen(uctrl->sock, 0); + if (err < 0) { + err = -errno; + err(uctrl->udev, "listen failed: %m\n"); + return err; + } } - - /* enable receiving of the sender credentials */ - setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); return 0; } @@ -140,16 +151,17 @@ struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) return uctrl; } -void udev_ctrl_unref(struct udev_ctrl *uctrl) +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) { if (uctrl == NULL) - return; + return NULL; uctrl->refcount--; if (uctrl->refcount > 0) - return; + return uctrl; if (uctrl->sock >= 0) close(uctrl->sock); free(uctrl); + return NULL; } int udev_ctrl_get_fd(struct udev_ctrl *uctrl) @@ -159,10 +171,55 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl) return uctrl->sock; } -static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf) +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) +{ + struct udev_ctrl_connection *conn; + const int on = 1; + + conn = calloc(1, sizeof(struct udev_ctrl_connection)); + if (conn == NULL) + return NULL; + conn->refcount = 1; + conn->uctrl = uctrl; + + conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC); + if (conn->sock < 0) { + free(conn); + return NULL; + } + + /* enable receiving of the sender credentials */ + setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + udev_ctrl_ref(uctrl); + return conn; +} + +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) +{ + if (conn == NULL) + return NULL; + conn->refcount++; + return conn; +} + +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) +{ + if (conn == NULL) + return NULL; + conn->refcount--; + if (conn->refcount > 0) + return conn; + if (conn->sock >= 0) + close(conn->sock); + udev_ctrl_unref(conn->uctrl); + free(conn); + return NULL; +} + +static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) { struct udev_ctrl_msg_wire ctrl_msg_wire; - int err; + int err = 0; memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); strcpy(ctrl_msg_wire.version, "udev-" VERSION); @@ -174,51 +231,89 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int else ctrl_msg_wire.intval = intval; - err = sendto(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0, - (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err == -1) { - err(uctrl->udev, "error sending message: %m\n"); + if (!uctrl->connected) { + if (connect(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen) < 0) { + err = -errno; + goto out; + } + uctrl->connected = true; + } + if (send(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0) < 0) { + err = -errno; + goto out; } + + /* wait for peer message handling or disconnect */ + for (;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = uctrl->sock; + pfd[0].events = POLLIN; + r = poll(pfd, 1, timeout * 1000); + if (r < 0) { + if (errno == EINTR) + continue; + err = -errno; + break; + } + + if (r > 0 && pfd[0].revents & POLLERR) { + err = -EIO; + break; + } + + if (r == 0) + err = -ETIMEDOUT; + break; + } +out: return err; } -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority) +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); +} + +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL); + return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); } -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl) +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL); + return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); } -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl) +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL); + return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL, timeout); } -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl) +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL); + return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); } -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key) +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key); + return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); } -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count) +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL); + return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); } -int udev_ctrl_send_settle(struct udev_ctrl *uctrl) +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_SETTLE, 0, NULL); + return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); } -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) { + struct udev *udev = conn->uctrl->udev; struct udev_ctrl_msg *uctrl_msg; ssize_t size; struct msghdr smsg; @@ -231,7 +326,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) if (uctrl_msg == NULL) return NULL; uctrl_msg->refcount = 1; - uctrl_msg->uctrl = uctrl; + uctrl_msg->conn = conn; iov.iov_base = &uctrl_msg->ctrl_msg_wire; iov.iov_len = sizeof(struct udev_ctrl_msg_wire); @@ -242,32 +337,31 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl) smsg.msg_control = cred_msg; smsg.msg_controllen = sizeof(cred_msg); - size = recvmsg(uctrl->sock, &smsg, 0); + size = recvmsg(conn->sock, &smsg, 0); if (size < 0) { - err(uctrl->udev, "unable to receive user udevd message: %m\n"); + err(udev, "unable to receive user udevd message: %m\n"); goto err; } cmsg = CMSG_FIRSTHDR(&smsg); cred = (struct ucred *) CMSG_DATA(cmsg); if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err(uctrl->udev, "no sender credentials received, message ignored\n"); + err(udev, "no sender credentials received, message ignored\n"); goto err; } if (cred->uid != 0) { - err(uctrl->udev, "sender uid=%i, message ignored\n", cred->uid); + err(udev, "sender uid=%i, message ignored\n", cred->uid); goto err; } - uctrl_msg->pid = cred->pid; - if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { - err(uctrl->udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); + err(udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); goto err; } - dbg(uctrl->udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); + dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); + udev_ctrl_connection_ref(conn); return uctrl_msg; err: udev_ctrl_msg_unref(uctrl_msg); @@ -282,15 +376,17 @@ struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) return ctrl_msg; } -void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) { if (ctrl_msg == NULL) - return; + return NULL; ctrl_msg->refcount--; if (ctrl_msg->refcount > 0) - return; - dbg(ctrl_msg->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + return ctrl_msg; + dbg(ctrl_msg->conn->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + udev_ctrl_connection_unref(ctrl_msg->conn); free(ctrl_msg); + return NULL; } int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) @@ -335,9 +431,16 @@ int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) return -1; } -pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg) +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SETTLE) - return ctrl_msg->pid; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) + return 1; + return -1; +} + +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) + return 1; return -1; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 8495f9aaee..f6137b5dc7 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -127,26 +127,31 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd); int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); -void udev_ctrl_unref(struct udev_ctrl *uctrl); +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); int udev_ctrl_get_fd(struct udev_ctrl *uctrl); -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority); -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl); -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl); -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl); -int udev_ctrl_send_settle(struct udev_ctrl *uctrl); -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key); -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count); +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout); +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout); +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout); +struct udev_ctrl_connection; +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl); +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn); +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn); struct udev_ctrl_msg; -struct udev_ctrl_msg *udev_ctrl_msg(struct udev_ctrl *uctrl); -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl *uctrl); +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn); struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); -void udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); -pid_t udev_ctrl_get_settle(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg); const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); @@ -154,6 +159,7 @@ int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); struct udev_list_node { struct udev_list_node *next, *prev; }; +#define UDEV_LIST(list) struct udev_list_node list = { &(list), &(list) } void udev_list_init(struct udev_list_node *list); int udev_list_is_empty(struct udev_list_node *list); void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list); diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 0447804c95..69da86563d 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -30,21 +30,25 @@ static void print_help(void) { printf("Usage: udevadm control COMMAND\n" + " --exit instruct the daemon to cleanup and exit\n" " --log-priority= set the udev log level for the daemon\n" " --stop-exec-queue keep udevd from executing events, queue only\n" " --start-exec-queue execute events, flush queue\n" " --reload-rules reloads the rules files\n" " --property== set a global property for all events\n" " --children-max= maximum number of children\n" + " --timeout= maximum time to block for a reply\n" " --help print this help text\n\n"); } int udevadm_control(struct udev *udev, int argc, char *argv[]) { struct udev_ctrl *uctrl = NULL; + int timeout = 60; int rc = 1; static const struct option options[] = { + { "exit", no_argument, NULL, 'e' }, { "log-priority", required_argument, NULL, 'l' }, { "stop-exec-queue", no_argument, NULL, 's' }, { "start-exec-queue", no_argument, NULL, 'S' }, @@ -52,6 +56,7 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) { "property", required_argument, NULL, 'p' }, { "env", required_argument, NULL, 'p' }, { "children-max", required_argument, NULL, 'm' }, + { "timeout", required_argument, NULL, 't' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -67,39 +72,46 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) for (;;) { int option; - int i; - char *endp; - option = getopt_long(argc, argv, "l:sSRp:m:h", options, NULL); + option = getopt_long(argc, argv, "el:sSRp:m:h", options, NULL); if (option == -1) break; switch (option) { - case 'l': + case 'e': + if (udev_ctrl_send_exit(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'l': { + int i; + i = util_log_priority(optarg); if (i < 0) { fprintf(stderr, "invalid number '%s'\n", optarg); - goto exit; + goto out; } - if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg)) < 0) + if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg), timeout) < 0) rc = 2; else rc = 0; break; + } case 's': - if (udev_ctrl_send_stop_exec_queue(uctrl) < 0) + if (udev_ctrl_send_stop_exec_queue(uctrl, timeout) < 0) rc = 2; else rc = 0; break; case 'S': - if (udev_ctrl_send_start_exec_queue(uctrl) < 0) + if (udev_ctrl_send_start_exec_queue(uctrl, timeout) < 0) rc = 2; else rc = 0; break; case 'R': - if (udev_ctrl_send_reload_rules(uctrl) < 0) + if (udev_ctrl_send_reload_rules(uctrl, timeout) < 0) rc = 2; else rc = 0; @@ -107,34 +119,45 @@ int udevadm_control(struct udev *udev, int argc, char *argv[]) case 'p': if (strchr(optarg, '=') == NULL) { fprintf(stderr, "expect = instead of '%s'\n", optarg); - goto exit; + goto out; } - if (udev_ctrl_send_set_env(uctrl, optarg) < 0) + if (udev_ctrl_send_set_env(uctrl, optarg, timeout) < 0) rc = 2; else rc = 0; break; - case 'm': + case 'm': { + char *endp; + int i; + i = strtoul(optarg, &endp, 0); if (endp[0] != '\0' || i < 1) { fprintf(stderr, "invalid number '%s'\n", optarg); - goto exit; + goto out; } - if (udev_ctrl_send_set_children_max(uctrl, i) < 0) + if (udev_ctrl_send_set_children_max(uctrl, i, timeout) < 0) rc = 2; else rc = 0; break; + } + case 't': { + int seconds; + + seconds = atoi(optarg); + if (seconds >= 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); + break; + } case 'h': print_help(); rc = 0; break; } } - - if (rc == 1) - err(udev, "unrecognized command\n"); -exit: +out: udev_ctrl_unref(uctrl); return rc; } diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 1423cec6dc..b7852ff60a 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -44,8 +44,6 @@ static void sig_handler(int signum) switch (signum) { case SIGALRM: is_timeout = 1; - case SIGUSR1: - ; } } @@ -78,9 +76,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) sigemptyset (&act.sa_mask); act.sa_flags = 0; sigaction(SIGALRM, &act, NULL); - sigaction(SIGUSR1, &act, NULL); sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); sigaddset(&mask, SIGALRM); sigprocmask(SIG_UNBLOCK, &mask, NULL); @@ -168,15 +164,12 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); if (uctrl != NULL) { - sigset_t oldmask; - - sigemptyset(&mask); - sigaddset(&mask, SIGUSR1); - sigaddset(&mask, SIGALRM); - sigprocmask(SIG_BLOCK, &mask, &oldmask); - if (udev_ctrl_send_settle(uctrl) > 0) - sigsuspend(&oldmask); - sigprocmask(SIG_SETMASK, &oldmask, NULL); + if (udev_ctrl_send_ping(uctrl, timeout) < 0) { + info(udev, "no connection to daemon\n"); + udev_ctrl_unref(uctrl); + rc = 0; + goto out; + } udev_ctrl_unref(uctrl); } } @@ -223,7 +216,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) udev_list_entry_get_value(list_entry)); } } - +out: udev_queue_unref(udev_queue); return rc; } diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 7a682a68ef..04c3d0b963 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -296,6 +296,12 @@ udevadm control <replaceable>command</replaceable> Modify the internal state of the running udev daemon. + + + + Signal and wait for udevd to exit. + + @@ -339,6 +345,12 @@ same time. + + seconds + + The maximum number seonds to wait for a reply from udevd. + + diff --git a/udev/udevd.c b/udev/udevd.c index df5c1995bc..c785b20757 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2009 Kay Sievers + * Copyright (C) 2004-2011 Kay Sievers * Copyright (C) 2004 Chris Friesen * Copyright (C) 2009 Canonical Ltd. * Copyright (C) 2009 Scott James Remnant @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include @@ -76,34 +76,20 @@ static struct udev_queue_export *udev_queue_export; static struct udev_ctrl *udev_ctrl; static struct udev_monitor *monitor; static int worker_watch[2] = { -1, -1 }; -static pid_t settle_pid; +static int fd_signal = -1; +static int fd_ep = -1; +static int fd_inotify = -1; static bool stop_exec_queue; static bool reload_config; static int children; static int children_max; static int exec_delay; static sigset_t orig_sigmask; -static struct udev_list_node event_list; -static struct udev_list_node worker_list; +static UDEV_LIST(event_list); +static UDEV_LIST(worker_list); static bool udev_exit; static volatile sig_atomic_t worker_exit; -enum poll_fd { - FD_CONTROL, - FD_NETLINK, - FD_INOTIFY, - FD_SIGNAL, - FD_WORKER, -}; - -static struct pollfd pfd[] = { - [FD_NETLINK] = { .events = POLLIN, .fd = -1 }, - [FD_WORKER] = { .events = POLLIN, .fd = -1 }, - [FD_SIGNAL] = { .events = POLLIN, .fd = -1 }, - [FD_INOTIFY] = { .events = POLLIN, .fd = -1 }, - [FD_CONTROL] = { .events = POLLIN, .fd = -1 }, -}; - enum event_state { EVENT_UNDEF, EVENT_QUEUED, @@ -135,6 +121,8 @@ static struct event *node_to_event(struct udev_list_node *node) return (struct event *)event; } +static void event_queue_cleanup(struct udev *udev, enum event_state type); + enum worker_state { WORKER_UNDEF, WORKER_RUNNING, @@ -167,17 +155,18 @@ static struct worker *node_to_worker(struct udev_list_node *node) return (struct worker *)worker; } -static void event_queue_delete(struct event *event) +static void event_queue_delete(struct event *event, bool export) { udev_list_node_remove(&event->node); - /* mark as failed, if "add" event returns non-zero */ - if (event->exitcode != 0 && strcmp(udev_device_get_action(event->dev), "remove") != 0) - udev_queue_export_device_failed(udev_queue_export, event->dev); - else - udev_queue_export_device_finished(udev_queue_export, event->dev); - - info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); + if (export) { + /* mark as failed, if "add" event returns non-zero */ + if (event->exitcode != 0 && strcmp(udev_device_get_action(event->dev), "remove") != 0) + udev_queue_export_device_failed(udev_queue_export, event->dev); + else + udev_queue_export_device_finished(udev_queue_export, event->dev); + info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); + } udev_device_unref(event->dev); free(event); } @@ -200,28 +189,44 @@ static struct worker *worker_ref(struct worker *worker) return worker; } +static void worker_cleanup(struct worker *worker) +{ + udev_list_node_remove(&worker->node); + udev_monitor_unref(worker->monitor); + children--; + free(worker); +} + static void worker_unref(struct worker *worker) { worker->refcount--; if (worker->refcount > 0) return; - - udev_list_node_remove(&worker->node); - udev_monitor_unref(worker->monitor); - children--; info(worker->udev, "worker [%u] cleaned up\n", worker->pid); - free(worker); + worker_cleanup(worker); +} + +static void worker_list_cleanup(struct udev *udev) +{ + struct udev_list_node *loop, *tmp; + + udev_list_node_foreach_safe(loop, tmp, &worker_list) { + struct worker *worker = node_to_worker(loop); + + worker_cleanup(worker); + } } static void worker_new(struct event *event) { + struct udev *udev = event->udev; struct worker *worker; struct udev_monitor *worker_monitor; pid_t pid; struct sigaction act; /* listen for new events */ - worker_monitor = udev_monitor_new_from_netlink(event->udev, NULL); + worker_monitor = udev_monitor_new_from_netlink(udev, NULL); if (worker_monitor == NULL) return; /* allow the main daemon netlink address to send devices to the worker */ @@ -235,7 +240,7 @@ static void worker_new(struct event *event) } /* worker + event reference */ worker->refcount = 2; - worker->udev = event->udev; + worker->udev = udev; pid = fork(); switch (pid) { @@ -247,10 +252,18 @@ static void worker_new(struct event *event) .events = POLLIN, }; + /* move initial device from queue */ + dev = event->dev; + event->dev = NULL; + + free(worker); + worker_list_cleanup(udev); + event_queue_cleanup(udev, EVENT_UNDEF); udev_queue_export_unref(udev_queue_export); udev_monitor_unref(monitor); udev_ctrl_unref(udev_ctrl); - close(pfd[FD_SIGNAL].fd); + close(fd_signal); + close(fd_ep); close(worker_watch[READ_END]); udev_log_close(); udev_log_init("udevd-work"); @@ -274,16 +287,13 @@ static void worker_new(struct event *event) /* request TERM signal if parent exits */ prctl(PR_SET_PDEATHSIG, SIGTERM); - /* initial device */ - dev = event->dev; - do { struct udev_event *udev_event; struct worker_message msg = {}; int err; int failed = 0; - info(event->udev, "seq %llu running\n", udev_device_get_seqnum(dev)); + info(udev, "seq %llu running\n", udev_device_get_seqnum(dev)); udev_event = udev_event_new(dev); if (udev_event == NULL) _exit(3); @@ -308,7 +318,7 @@ static void worker_new(struct event *event) /* apply/restore inotify watch */ if (err == 0 && udev_event->inotify_watch) { - udev_watch_begin(udev_event->udev, dev); + udev_watch_begin(udev, dev); udev_device_update_db(dev); } @@ -323,7 +333,7 @@ static void worker_new(struct event *event) msg.pid = getpid(); send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); - info(event->udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); + info(udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); udev_event_unref(udev_event); udev_device_unref(dev); dev = NULL; @@ -344,15 +354,19 @@ static void worker_new(struct event *event) } } while (dev != NULL); + close(fd_inotify); + close(worker_watch[WRITE_END]); + udev_rules_unref(rules); udev_monitor_unref(worker_monitor); + udev_unref(udev); udev_log_close(); - exit(0); + exit(EXIT_SUCCESS); } case -1: udev_monitor_unref(worker_monitor); event->state = EVENT_QUEUED; free(worker); - err(event->udev, "fork of child failed: %m\n"); + err(udev, "fork of child failed: %m\n"); break; default: /* close monitor, but keep address around */ @@ -364,7 +378,7 @@ static void worker_new(struct event *event) event->state = EVENT_RUNNING; udev_list_node_append(&worker->node, &worker_list); children++; - info(event->udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); + info(udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); break; } } @@ -535,7 +549,7 @@ static bool is_devpath_busy(struct event *event) return false; } -static void events_start(struct udev *udev) +static void event_queue_start(struct udev *udev) { struct udev_list_node *loop; @@ -555,14 +569,28 @@ static void events_start(struct udev *udev) } } -static void worker_returned(void) +static void event_queue_cleanup(struct udev *udev, enum event_state match_type) +{ + struct udev_list_node *loop, *tmp; + + udev_list_node_foreach_safe(loop, tmp, &event_list) { + struct event *event = node_to_event(loop); + + if (match_type != EVENT_UNDEF && match_type != event->state) + continue; + + event_queue_delete(event, false); + } +} + +static void worker_returned(int fd_worker) { for (;;) { struct worker_message msg; ssize_t size; struct udev_list_node *loop; - size = recv(pfd[FD_WORKER].fd, &msg, sizeof(struct worker_message), MSG_DONTWAIT); + size = recv(fd_worker, &msg, sizeof(struct worker_message), MSG_DONTWAIT); if (size != sizeof(struct worker_message)) break; @@ -575,7 +603,7 @@ static void worker_returned(void) /* worker returned */ worker->event->exitcode = msg.exitcode; - event_queue_delete(worker->event); + event_queue_delete(worker->event, true); worker->event = NULL; if (worker->state != WORKER_KILLED) worker->state = WORKER_IDLE; @@ -586,16 +614,21 @@ static void worker_returned(void) } /* receive the udevd message from userspace */ -static void handle_ctrl_msg(struct udev_ctrl *uctrl) +static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) { struct udev *udev = udev_ctrl_get_udev(uctrl); - struct udev_ctrl_msg *ctrl_msg; + struct udev_ctrl_connection *ctrl_conn; + struct udev_ctrl_msg *ctrl_msg = NULL; const char *str; int i; - ctrl_msg = udev_ctrl_receive_msg(uctrl); + ctrl_conn = udev_ctrl_get_connection(uctrl); + if (ctrl_conn == NULL) + goto out; + + ctrl_msg = udev_ctrl_receive_msg(ctrl_conn); if (ctrl_msg == NULL) - return; + goto out; i = udev_ctrl_get_set_log_level(ctrl_msg); if (i >= 0) { @@ -652,13 +685,18 @@ static void handle_ctrl_msg(struct udev_ctrl *uctrl) children_max = i; } - settle_pid = udev_ctrl_get_settle(ctrl_msg); - if (settle_pid > 0) { - info(udev, "udevd message (SETTLE) received\n"); - kill(settle_pid, SIGUSR1); - settle_pid = 0; + if (udev_ctrl_get_ping(ctrl_msg) > 0) + info(udev, "udevd message (SYNC) received\n"); + + if (udev_ctrl_get_exit(ctrl_msg) > 0) { + info(udev, "udevd message (EXIT) received\n"); + udev_exit = true; + /* keep reference to block the client until we exit */ + udev_ctrl_connection_ref(ctrl_conn); } +out: udev_ctrl_msg_unref(ctrl_msg); + return udev_ctrl_connection_unref(ctrl_conn); } /* read inotify messages */ @@ -668,7 +706,7 @@ static int handle_inotify(struct udev *udev) char *buf; struct inotify_event *ev; - if ((ioctl(pfd[FD_INOTIFY].fd, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) + if ((ioctl(fd_inotify, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) return 0; buf = malloc(nbytes); @@ -677,7 +715,7 @@ static int handle_inotify(struct udev *udev) return -1; } - nbytes = read(pfd[FD_INOTIFY].fd, buf, nbytes); + nbytes = read(fd_inotify, buf, nbytes); for (pos = 0; pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) { struct udev_device *dev; @@ -751,7 +789,7 @@ static void handle_signal(struct udev *udev, int signo) if (worker->event != NULL) { err(udev, "worker [%u] failed while handling '%s'\n", pid, worker->event->devpath); worker->event->exitcode = -32; - event_queue_delete(worker->event); + event_queue_delete(worker->event, true); /* drop reference from running event */ worker_unref(worker); } @@ -1081,6 +1119,11 @@ int main(int argc, char *argv[]) { "version", no_argument, NULL, 'V' }, {} }; + int fd_ctrl = -1; + int fd_netlink = -1; + int fd_worker = -1; + struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker; + struct udev_ctrl_connection *ctrl_conn = NULL; int rc = 1; udev = udev_new(); @@ -1229,7 +1272,7 @@ int main(int argc, char *argv[]) dup2(fd, STDERR_FILENO); /* udevadm control socket */ - if (sd_listen_fds(true) == 1 && sd_is_socket(SD_LISTEN_FDS_START, AF_LOCAL, SOCK_DGRAM, -1)) + if (sd_listen_fds(true) == 1 && sd_is_socket(SD_LISTEN_FDS_START, AF_LOCAL, SOCK_SEQPACKET, -1)) udev_ctrl = udev_ctrl_new_from_fd(udev, SD_LISTEN_FDS_START); else udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); @@ -1245,7 +1288,7 @@ int main(int argc, char *argv[]) rc = 1; goto exit; } - pfd[FD_CONTROL].fd = udev_ctrl_get_fd(udev_ctrl); + fd_ctrl = udev_ctrl_get_fd(udev_ctrl); monitor = udev_monitor_new_from_netlink(udev, "kernel"); if (monitor == NULL || udev_monitor_enable_receiving(monitor) < 0) { @@ -1255,10 +1298,29 @@ int main(int argc, char *argv[]) goto exit; } udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); - pfd[FD_NETLINK].fd = udev_monitor_get_fd(monitor); + fd_netlink = udev_monitor_get_fd(monitor); - pfd[FD_INOTIFY].fd = udev_watch_init(udev); - if (pfd[FD_INOTIFY].fd < 0) { + if (daemonize) { + pid_t pid; + + pid = fork(); + switch (pid) { + case 0: + break; + case -1: + err(udev, "fork of daemon failed: %m\n"); + rc = 4; + goto exit; + default: + rc = 0; + goto exit; + } + } else { + sd_notify(1, "READY=1"); + } + + fd_inotify = udev_watch_init(udev); + if (fd_inotify < 0) { fprintf(stderr, "error initializing inotify\n"); err(udev, "error initializing inotify\n"); rc = 4; @@ -1266,15 +1328,15 @@ int main(int argc, char *argv[]) } if (udev_get_rules_path(udev) != NULL) { - inotify_add_watch(pfd[FD_INOTIFY].fd, udev_get_rules_path(udev), + inotify_add_watch(fd_inotify, udev_get_rules_path(udev), IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } else { char filename[UTIL_PATH_SIZE]; struct stat statbuf; - inotify_add_watch(pfd[FD_INOTIFY].fd, LIBEXECDIR "/rules.d", + inotify_add_watch(fd_inotify, LIBEXECDIR "/rules.d", IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - inotify_add_watch(pfd[FD_INOTIFY].fd, SYSCONFDIR "/udev/rules.d", + inotify_add_watch(fd_inotify, SYSCONFDIR "/udev/rules.d", IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); /* watch dynamic rules directory */ @@ -1283,7 +1345,7 @@ int main(int argc, char *argv[]) util_create_path(udev, filename); mkdir(filename, 0755); } - inotify_add_watch(pfd[FD_INOTIFY].fd, filename, + inotify_add_watch(fd_inotify, filename, IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); } udev_watch_restore(udev); @@ -1291,8 +1353,8 @@ int main(int argc, char *argv[]) /* block and listen to all signals on signalfd */ sigfillset(&mask); sigprocmask(SIG_SETMASK, &mask, &orig_sigmask); - pfd[FD_SIGNAL].fd = signalfd(-1, &mask, 0); - if (pfd[FD_SIGNAL].fd < 0) { + fd_signal = signalfd(-1, &mask, SFD_CLOEXEC); + if (fd_signal < 0) { fprintf(stderr, "error getting signalfd\n"); err(udev, "error getting signalfd\n"); rc = 5; @@ -1306,7 +1368,7 @@ int main(int argc, char *argv[]) rc = 6; goto exit; } - pfd[FD_WORKER].fd = worker_watch[READ_END]; + fd_worker = worker_watch[READ_END]; rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { @@ -1320,6 +1382,35 @@ int main(int argc, char *argv[]) goto exit; } + memset(&ep_ctrl, 0, sizeof(struct epoll_event)); + ep_ctrl.events = EPOLLIN; + ep_ctrl.data.fd = fd_ctrl; + memset(&ep_inotify, 0, sizeof(struct epoll_event)); + ep_inotify.events = EPOLLIN; + ep_inotify.data.fd = fd_inotify; + memset(&ep_signal, 0, sizeof(struct epoll_event)); + ep_signal.events = EPOLLIN; + ep_signal.data.fd = fd_signal; + memset(&ep_netlink, 0, sizeof(struct epoll_event)); + ep_netlink.events = EPOLLIN; + ep_netlink.data.fd = fd_netlink; + memset(&ep_worker, 0, sizeof(struct epoll_event)); + ep_worker.events = EPOLLIN; + ep_worker.data.fd = fd_worker; + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto exit; + } + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_ctrl, &ep_ctrl) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_inotify, &ep_inotify) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_netlink, &ep_netlink) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_worker, &ep_worker) < 0) { + err(udev, "fail to add fds to epoll: %m\n"); + goto exit; + } + /* if needed, convert old database from earlier udev version */ convert_db(udev); @@ -1331,25 +1422,6 @@ int main(int argc, char *argv[]) if (fd > STDERR_FILENO) close(fd); - if (daemonize) { - pid_t pid; - - pid = fork(); - switch (pid) { - case 0: - break; - case -1: - err(udev, "fork of daemon failed: %m\n"); - rc = 4; - goto exit; - default: - rc = 0; - goto exit; - } - } else { - sd_notify(1, "READY=1"); - } - /* set scheduling priority for the main daemon process */ setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); @@ -1393,30 +1465,79 @@ int main(int argc, char *argv[]) udev_list_init(&event_list); udev_list_init(&worker_list); - while (!udev_exit) { + for (;;) { + struct epoll_event ev[8]; int fdcount; int timeout; + bool is_worker, is_signal, is_inotify, is_netlink, is_ctrl; + int i; + + if (udev_exit) { + /* close sources of new events and discard buffered events */ + if (fd_ctrl >= 0) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_ctrl, NULL); + fd_ctrl = -1; + } + if (monitor != NULL) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_netlink, NULL); + udev_monitor_unref(monitor); + monitor = NULL; + } + if (fd_inotify >= 0) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_inotify, NULL); + close(fd_inotify); + fd_inotify = -1; + } - /* set timeout to kill idle workers */ - if (udev_list_is_empty(&event_list) && children > 2) + /* discard queued events and kill workers */ + event_queue_cleanup(udev, EVENT_QUEUED); + worker_kill(udev, 0); + + /* exit after all has cleaned up */ + if (udev_list_is_empty(&event_list) && udev_list_is_empty(&worker_list)) + break; + + /* timeout at exit for workers to finish */ + timeout = 60 * 1000; + } else if (udev_list_is_empty(&event_list) && children > 2) { + /* set timeout to kill idle workers */ timeout = 3 * 1000; - else + } else { timeout = -1; - /* wait for events */ - fdcount = poll(pfd, ARRAY_SIZE(pfd), timeout); + } + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); if (fdcount < 0) continue; - /* timeout - kill idle workers */ - if (fdcount == 0) + if (fdcount == 0) { + if (udev_exit) { + info(udev, "timeout, giving up waiting for workers to finish\n"); + break; + } + + /* timeout - kill idle workers */ worker_kill(udev, 2); + } + + is_worker = is_signal = is_inotify = is_netlink = is_ctrl = false; + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_worker && ev[i].events & EPOLLIN) + is_worker = true; + else if (ev[i].data.fd == fd_netlink && ev[i].events & EPOLLIN) + is_netlink = true; + else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) + is_signal = true; + else if (ev[i].data.fd == fd_inotify && ev[i].events & EPOLLIN) + is_inotify = true; + else if (ev[i].data.fd == fd_ctrl && ev[i].events & EPOLLIN) + is_ctrl = true; + } /* event has finished */ - if (pfd[FD_WORKER].revents & POLLIN) - worker_returned(); + if (is_worker) + worker_returned(fd_worker); - /* get kernel uevent */ - if (pfd[FD_NETLINK].revents & POLLIN) { + if (is_netlink) { struct udev_device *dev; dev = udev_monitor_receive_device(monitor); @@ -1426,32 +1547,37 @@ int main(int argc, char *argv[]) } /* start new events */ - if (!udev_list_is_empty(&event_list) && !stop_exec_queue) - events_start(udev); + if (!udev_list_is_empty(&event_list) && !udev_exit && !stop_exec_queue) + event_queue_start(udev); - /* get signal */ - if (pfd[FD_SIGNAL].revents & POLLIN) { + if (is_signal) { struct signalfd_siginfo fdsi; ssize_t size; - size = read(pfd[FD_SIGNAL].fd, &fdsi, sizeof(struct signalfd_siginfo)); + size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); if (size == sizeof(struct signalfd_siginfo)) handle_signal(udev, fdsi.ssi_signo); } + /* we are shutting down, the events below are not handled anymore */ + if (udev_exit) + continue; + /* device node and rules directory inotify watch */ - if (pfd[FD_INOTIFY].revents & POLLIN) + if (is_inotify) handle_inotify(udev); /* - * get control message - * * This needs to be after the inotify handling, to make sure, - * that the settle signal is send back after the possibly generated + * that the ping is send back after the possibly generated * "change" events by the inotify device node watch. + * + * A single time we may receive a client connection which we need to + * keep open to block the client. It will be closed right before we + * exit. */ - if (pfd[FD_CONTROL].revents & POLLIN) - handle_ctrl_msg(udev_ctrl); + if (is_ctrl) + ctrl_conn = handle_ctrl_msg(udev_ctrl); /* rules changed, set by inotify or a HUP signal */ if (reload_config) { @@ -1470,16 +1596,21 @@ int main(int argc, char *argv[]) udev_queue_export_cleanup(udev_queue_export); rc = 0; exit: - udev_queue_export_unref(udev_queue_export); + if (fd_ep >= 0) + close(fd_ep); + worker_list_cleanup(udev); + event_queue_cleanup(udev, EVENT_UNDEF); udev_rules_unref(rules); - udev_ctrl_unref(udev_ctrl); - if (pfd[FD_SIGNAL].fd >= 0) - close(pfd[FD_SIGNAL].fd); + if (fd_signal >= 0) + close(fd_signal); if (worker_watch[READ_END] >= 0) close(worker_watch[READ_END]); if (worker_watch[WRITE_END] >= 0) close(worker_watch[WRITE_END]); udev_monitor_unref(monitor); + udev_queue_export_unref(udev_queue_export); + udev_ctrl_connection_unref(ctrl_conn); + udev_ctrl_unref(udev_ctrl); udev_selinux_exit(udev); udev_unref(udev); udev_log_close(); -- cgit v1.2.3-54-g00ecf From e48e2912023b5600d291904b0f7b0017387e8cb2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Apr 2011 01:47:56 +0200 Subject: trivial cleanups --- extras/ata_id/ata_id.c | 2 -- extras/firmware/firmware.c | 4 +--- extras/hid2hci/hid2hci.c | 4 +--- extras/path_id/path_id.c | 2 -- extras/udev-acl/udev-acl.c | 1 - extras/usb_id/usb_id.c | 2 -- libudev/libudev-util-private.c | 4 ++-- udev/udevadm-monitor.c | 1 - udev/udevd.c | 8 +++++--- 9 files changed, 9 insertions(+), 19 deletions(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 594cfb2017..cb4a1a1f07 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -486,8 +486,6 @@ int main(int argc, char *argv[]) printf("Usage: ata_id [--export] [--help] \n" " --export print values as environment keys\n" " --help print this help text\n\n"); - default: - rc = 1; goto exit; } } diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c index f2df76c8c5..36ce79054c 100644 --- a/extras/firmware/firmware.c +++ b/extras/firmware/firmware.c @@ -43,7 +43,7 @@ static bool set_loading(struct udev *udev, char *loadpath, const char *state) static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) { char *buf; - FILE *fsource, *ftarget; + FILE *fsource = NULL, *ftarget = NULL; bool ret = false; buf = malloc(size); @@ -112,8 +112,6 @@ int main(int argc, char **argv) break; case 'h': printf("Usage: firmware --firmware= --devpath= [--help]\n\n"); - default: - rc = 1; goto exit; } } diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c index 839c4fbce7..98e60d9ac1 100644 --- a/extras/hid2hci/hid2hci.c +++ b/extras/hid2hci/hid2hci.c @@ -243,7 +243,7 @@ int main(int argc, char *argv[]) for (;;) { int option; - option = getopt_long(argc, argv, "m:p:M:qh", options, NULL); + option = getopt_long(argc, argv, "m:p:M:h", options, NULL); if (option == -1) break; @@ -277,8 +277,6 @@ int main(int argc, char *argv[]) break; case 'h': usage(NULL); - default: - exit(1); } } diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index c19bfd0f8d..db13eeba27 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -388,8 +388,6 @@ int main(int argc, char **argv) printf("Usage: path_id [--debug] [--help] \n" " --debug print debug information\n" " --help print this help text\n\n"); - default: - rc = 1; goto exit; } } diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index 31e9991a51..2dd3e6cac9 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -364,7 +364,6 @@ int main (int argc, char* argv[]) break; case 'h': printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n"); - default: goto out; } } diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index fabd09283d..3a7a0ffd49 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -503,8 +503,6 @@ int main(int argc, char **argv) " --num-info use numerical values\n" " --export print values as environment keys\n" " --help print this help text\n\n"); - default: - retval = 1; goto exit; } } diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 19f979eeab..073f7e2df8 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -134,7 +134,7 @@ int util_unlink_secure(struct udev *udev, const char *filename) uid_t util_lookup_user(struct udev *udev, const char *user) { char *endptr; - int buflen = sysconf(_SC_GETPW_R_SIZE_MAX); + size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); char buf[buflen]; struct passwd pwbuf; struct passwd *pw; @@ -159,7 +159,7 @@ uid_t util_lookup_user(struct udev *udev, const char *user) gid_t util_lookup_group(struct udev *udev, const char *group) { char *endptr; - int buflen = sysconf(_SC_GETGR_R_SIZE_MAX); + size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX); char *buf; struct group grbuf; struct group *gr; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 85252bb7d9..a587e8cc0f 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -133,7 +133,6 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) " --subsystem-match= filter events by subsystem\n" " --tag-match= filter events by tag\n" " --help\n\n"); - default: goto out; } } diff --git a/udev/udevd.c b/udev/udevd.c index c785b20757..8610c6c062 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -744,9 +744,11 @@ static int handle_inotify(struct udev *udev) info(udev, "device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev)); util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); fd = open(filename, O_WRONLY); - if (fd < 0 || write(fd, "change", 6) < 0) - info(udev, "error writing uevent: %m\n"); - close(fd); + if (fd >= 0) { + if (write(fd, "change", 6) < 0) + info(udev, "error writing uevent: %m\n"); + close(fd); + } } if (ev->mask & IN_IGNORED) udev_watch_end(udev, dev); -- cgit v1.2.3-54-g00ecf From 2903820a62de1085f6b5def0fb622070805dd90b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Apr 2011 15:01:00 +0200 Subject: udevd: log warning if /run is not writable --- udev/udevd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev/udevd.c b/udev/udevd.c index 8610c6c062..051e8fe527 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1153,6 +1153,8 @@ int main(int argc, char *argv[]) if (udev_set_run_path(udev, filename) == NULL) goto exit; mkdir(udev_get_run_path(udev), 0755); + err(udev, "error: runtime directory '%s' not writable, for now falling back to '%s'", + udev_get_run_config_path(udev), udev_get_run_path(udev)); } } /* relabel runtime dir only if it resides below /dev */ -- cgit v1.2.3-54-g00ecf From 80707e9ad67068cd6f6407b64b16482e478cf567 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Apr 2011 18:21:47 +0200 Subject: libudev: ctrl - fix refcounting in connection handling --- libudev/libudev-ctrl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c index cea1b7f55b..2d2dd3a0be 100644 --- a/libudev/libudev-ctrl.c +++ b/libudev/libudev-ctrl.c @@ -327,16 +327,15 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) return NULL; uctrl_msg->refcount = 1; uctrl_msg->conn = conn; + udev_ctrl_connection_ref(conn); iov.iov_base = &uctrl_msg->ctrl_msg_wire; iov.iov_len = sizeof(struct udev_ctrl_msg_wire); - memset(&smsg, 0x00, sizeof(struct msghdr)); smsg.msg_iov = &iov; smsg.msg_iovlen = 1; smsg.msg_control = cred_msg; smsg.msg_controllen = sizeof(cred_msg); - size = recvmsg(conn->sock, &smsg, 0); if (size < 0) { err(udev, "unable to receive user udevd message: %m\n"); @@ -361,7 +360,6 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) } dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); - udev_ctrl_connection_ref(conn); return uctrl_msg; err: udev_ctrl_msg_unref(uctrl_msg); -- cgit v1.2.3-54-g00ecf From a3eca08b19711bf6322e639ca2b2c81d91896a67 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Apr 2011 18:44:28 +0200 Subject: udevadm: settle - watch queue file --- TODO | 2 -- udev/udevadm-settle.c | 35 +++++++++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index 65f7058ae5..773fe7f380 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - - use inotify() in settle - - do not write age/configured in initramfs - remove deprecated trigger --type=failed logic diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index b7852ff60a..38cb4f4968 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -29,14 +29,13 @@ #include #include #include +#include +#include #include #include #include "udev.h" -#define DEFAULT_TIMEOUT 180 -#define LOOP_PER_SECOND 20 - static volatile sig_atomic_t is_timeout; static void sig_handler(int signum) @@ -62,7 +61,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) unsigned long long end = 0; int quiet = 0; const char *exists = NULL; - int timeout = DEFAULT_TIMEOUT; + int timeout = 180; + struct pollfd pfd[1]; struct sigaction act; sigset_t mask; struct udev_queue *udev_queue = NULL; @@ -174,9 +174,21 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } } + pfd[0].events = POLLIN; + pfd[0].fd = inotify_init1(IN_CLOEXEC); + if (pfd[0].fd < 0) { + err(udev, "inotify_init failed: %m\n"); + } else { + if (inotify_add_watch(pfd[0].fd, udev_get_run_path(udev), IN_CLOSE_WRITE) < 0) { + err(udev, "watching '%s' failed\n", udev_get_run_path(udev)); + close(pfd[0].fd); + pfd[0].fd = -1; + } + } + for (;;) { struct stat statbuf; - const struct timespec duration = { 0 , 1000 * 1000 * 1000 / LOOP_PER_SECOND }; + const struct timespec duration = { 1 , 0 }; if (exists != NULL && stat(exists, &statbuf) == 0) { rc = 0; @@ -200,7 +212,16 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (is_timeout) break; - nanosleep(&duration, NULL); + if (pfd[0].fd >= 0) { + /* wake up once every second, or whenever the queue file gets gets closed */ + if (poll(pfd, 1, 1000) > 0 && pfd[0].revents & POLLIN) { + char buf[sizeof(struct inotify_event) + PATH_MAX]; + + read(pfd[0].fd, buf, sizeof(buf)); + } + } else { + nanosleep(&duration, NULL); + } } /* if we reached the timeout, print the list of remaining events */ @@ -217,6 +238,8 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } } out: + if (pfd[0].fd >= 0) + close(pfd[0].fd); udev_queue_unref(udev_queue); return rc; } -- cgit v1.2.3-54-g00ecf From 09913ced8c6c081840c27a9f2ae4d430045a7c68 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Apr 2011 18:46:02 +0200 Subject: libudev: bump revision --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 4244089822..5ddf83acab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ DISTCHECK_HOOKS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=11 -LIBUDEV_REVISION=1 +LIBUDEV_REVISION=2 LIBUDEV_AGE=11 SUBDIRS += libudev/docs -- cgit v1.2.3-54-g00ecf From 9ead662791b5e59a95b6c5a9351d661cb61d76bb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Apr 2011 22:33:01 +0200 Subject: udevadm: info --cleanup-db Most of the udev database from initramfs should be deleted before starting udev in the real root. udevadm: info --cleanup-db deletes all database entries in /run/udev. Events that processed IMPORT{db}, or mark devices explicitely as persistent, will be excluded. --- NEWS | 6 +++ TODO | 2 - libudev/libudev-device-private.c | 7 ++++ libudev/libudev-device.c | 11 ++++++ libudev/libudev-private.h | 2 + udev/udev-rules.c | 19 ++++++++++ udev/udevadm-info.c | 82 +++++++++++++++++++++++++++++++++++++++- udev/udevadm.xml | 6 +++ 8 files changed, 132 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index f45957b62d..6647fd4c24 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,12 @@ udev 168 ======== Bugfixes. +warning if /run is not writable. + +udevadm control --exit + +udevadm info --cleanup-db + udev 167 ======== Bugfixes. diff --git a/TODO b/TODO index 773fe7f380..6906aa89d1 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - - do not write age/configured in initramfs - - remove deprecated trigger --type=failed logic - remove deprecated BUS=, SYSFS{}=, ID= keys diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index 6d72d328bd..ee9e297cea 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -134,6 +134,13 @@ int udev_device_update_db(struct udev_device *udev_device) return -1; } + /* + * set 'sticky' bit to indicate that we should not clean the + * database when we transition from initramfs to the real root + */ + if (udev_device_get_db_persist(udev_device)) + fchmod(fileno(f), 01644); + if (has_info) { size_t devlen = strlen(udev_get_dev_path(udev))+1; struct udev_list_entry *list_entry; diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index ccd4a70677..a141dadf0a 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -89,6 +89,7 @@ struct udev_device { bool uevent_loaded; bool is_initialized; bool sysattr_list_read; + bool db_persist; }; struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) @@ -1774,3 +1775,13 @@ int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) udev_device_add_property(udev_device, "IFINDEX", num); return 0; } + +bool udev_device_get_db_persist(struct udev_device *udev_device) +{ + return udev_device->db_persist; +} + +void udev_device_set_db_persist(struct udev_device *udev_device) +{ + udev_device->db_persist = true; +} diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index f6137b5dc7..c57a89873c 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -109,6 +109,8 @@ int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); int udev_device_get_ifindex(struct udev_device *udev_device); int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex); void udev_device_set_info_loaded(struct udev_device *device); +bool udev_device_get_db_persist(struct udev_device *udev_device); +void udev_device_set_db_persist(struct udev_device *udev_device); /* libudev-device-private.c */ int udev_device_update_db(struct udev_device *udev_device); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 221865c9dc..805f449f22 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -150,6 +150,7 @@ enum token_type { TK_A_STRING_ESCAPE_NONE, TK_A_STRING_ESCAPE_REPLACE, + TK_A_DB_PERSIST, TK_A_INOTIFY_WATCH, /* int */ TK_A_DEVLINK_PRIO, /* int */ TK_A_OWNER, /* val */ @@ -284,6 +285,7 @@ static const char *token_str(enum token_type type) [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", + [TK_A_DB_PERSIST] = "A DB_PERSIST", [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", [TK_A_OWNER] = "A OWNER", @@ -370,6 +372,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) break; case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_DB_PERSIST: dbg(rules->udev, "%s\n", token_str(type)); break; case TK_M_TEST: @@ -1045,6 +1048,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, break; case TK_A_STRING_ESCAPE_NONE: case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_DB_PERSIST: break; case TK_A_RUN: token->key.value_off = add_string(rule_tmp->rules, value); @@ -1572,6 +1576,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); dbg(rules->udev, "link priority=%i\n", prio); } + pos = strstr(value, "event_timeout="); if (pos != NULL) { int tout = atoi(&pos[strlen("event_timeout=")]); @@ -1579,6 +1584,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_EVENT_TIMEOUT, op, NULL, &tout); dbg(rules->udev, "event timeout=%i\n", tout); } + pos = strstr(value, "string_escape="); if (pos != NULL) { pos = &pos[strlen("string_escape=")]; @@ -1587,6 +1593,11 @@ static int add_rule(struct udev_rules *rules, char *line, else if (strncmp(pos, "replace", strlen("replace")) == 0) rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, op, NULL, NULL); } + + pos = strstr(value, "db_persist="); + if (pos != NULL) + rule_add_key(&rule_tmp, TK_A_DB_PERSIST, op, NULL, NULL); + pos = strstr(value, "nowatch"); if (pos != NULL) { const int off = 0; @@ -1602,11 +1613,13 @@ static int add_rule(struct udev_rules *rules, char *line, dbg(rules->udev, "inotify watch of device requested\n"); } } + pos = strstr(value, "static_node="); if (pos != NULL) { rule_add_key(&rule_tmp, TK_A_STATIC_NODE, op, &pos[strlen("static_node=")], NULL); rule_tmp.rule.rule.has_static_node = true; } + continue; } err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); @@ -2332,6 +2345,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event const char *key = &rules->buf[cur->key.value_off]; const char *value; + /* implicitely mark database as persistent across initramfs transition */ + udev_device_set_db_persist(event->dev); + value = udev_device_get_property_value(event->dev_db, key); if (value != NULL) { struct udev_list_entry *entry; @@ -2407,6 +2423,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_STRING_ESCAPE_REPLACE: esc = ESCAPE_REPLACE; break; + case TK_A_DB_PERSIST: + udev_device_set_db_persist(event->dev); + break; case TK_A_INOTIFY_WATCH: if (event->inotify_watch_final) break; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 9357f67208..87c1c32314 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -200,6 +200,81 @@ static int export_devices(struct udev *udev) return 0; } +static void cleanup_dir(DIR *dir, mode_t mask, int depth) +{ + struct dirent *dent; + + if (depth <= 0) + return; + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + if (fstatat(dirfd(dir), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) + continue; + if ((stats.st_mode & mask) != 0) + continue; + if (S_ISDIR(stats.st_mode)) { + DIR *dir2; + + dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2 != NULL) { + cleanup_dir(dir2, mask, depth-1); + closedir(dir2); + } + unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR); + } else { + unlinkat(dirfd(dir), dent->d_name, 0); + } + } +} + +static void cleanup_db(struct udev *udev) +{ + char filename[UTIL_PATH_SIZE]; + DIR *dir; + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/queue.bin", NULL); + unlink(filename); + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, S_ISVTX, 1); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/links", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 2); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 2); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 1); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/firmware-missing", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 1); + closedir(dir); + } +} + int udevadm_info(struct udev *udev, int argc, char *argv[]) { struct udev_device *device = NULL; @@ -216,6 +291,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) { "path", required_argument, NULL, 'p' }, { "query", required_argument, NULL, 'q' }, { "attribute-walk", no_argument, NULL, 'a' }, + { "cleanup-db", no_argument, NULL, 'c' }, { "export-db", no_argument, NULL, 'e' }, { "root", no_argument, NULL, 'r' }, { "run", no_argument, NULL, 'R' }, @@ -248,7 +324,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) int option; struct stat statbuf; - option = getopt_long(argc, argv, "aed:n:p:q:rxP:RVh", options, NULL); + option = getopt_long(argc, argv, "aced:n:p:q:rxP:RVh", options, NULL); if (option == -1) break; @@ -345,6 +421,9 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) case 'e': export_devices(udev); goto exit; + case 'c': + cleanup_db(udev); + goto exit; case 'x': export = true; break; @@ -371,6 +450,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) " --export export key/value pairs\n" " --export-prefix export the key name with a prefix\n" " --export-db export the content of the udev database\n" + " --cleanup-db cleanup the udev database\n" " --help\n\n"); goto exit; default: diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 04c3d0b963..7860efe967 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -149,6 +149,12 @@ Export the content of the udev database. + + + + Cleanup the udev database. + + -- cgit v1.2.3-54-g00ecf From 02bf3e13e00157c23f77a89a35cb3e51543d336e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 Apr 2011 12:25:19 +0200 Subject: udevd: do not nice processes --- libudev/libudev-private.h | 2 +- libudev/libudev-util-private.c | 4 +--- udev/udev-event.c | 2 +- udev/udev-rules.c | 4 ++-- udev/udevd.c | 7 ------- 5 files changed, 5 insertions(+), 14 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index c57a89873c..e82ca1d753 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -235,7 +235,7 @@ uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); int util_run_program(struct udev *udev, const char *command, char **envp, char *result, size_t ressize, size_t *reslen, - const sigset_t *sigmask, bool reset_prio); + const sigset_t *sigmask); int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); unsigned long long usec_monotonic(void); diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 073f7e2df8..c7ad20eb74 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -261,7 +261,7 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, int util_run_program(struct udev *udev, const char *command, char **envp, char *result, size_t ressize, size_t *reslen, - const sigset_t *sigmask, bool reset_prio) + const sigset_t *sigmask) { int status; int outpipe[2] = {-1, -1}; @@ -356,8 +356,6 @@ int util_run_program(struct udev *udev, const char *command, char **envp, if (sigmask) sigprocmask(SIG_SETMASK, sigmask, NULL); - if (reset_prio) - setpriority(PRIO_PROCESS, 0, 0); execve(argv[0], argv, envp); if (errno == ENOENT || errno == ENOTDIR) { diff --git a/udev/udev-event.c b/udev/udev-event.c index 63a8b3aa83..60d06aa084 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -688,7 +688,7 @@ int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) info(event->udev, "delay execution of '%s'\n", program); sleep(event->exec_delay); } - if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask, true) != 0) { + if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask) != 0) { if (udev_list_entry_get_flags(list_entry)) err = -1; } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 805f449f22..bef5abab5e 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -759,7 +759,7 @@ static int import_program_into_properties(struct udev_device *dev, const char *p char *line; envp = udev_device_get_properties_envp(dev); - if (util_run_program(udev, program, envp, result, sizeof(result), &reslen, NULL, false) != 0) + if (util_run_program(udev, program, envp, result, sizeof(result), &reslen, NULL) != 0) return -1; line = result; @@ -2297,7 +2297,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event program, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL, NULL, false) != 0) { + if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL, NULL) != 0) { if (cur->key.op != OP_NOMATCH) goto nomatch; } else { diff --git a/udev/udevd.c b/udev/udevd.c index 051e8fe527..244780ab57 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -47,9 +47,6 @@ #include "udev.h" #include "sd-daemon.h" -#define UDEVD_PRIORITY -4 -#define UDEV_PRIORITY -2 - static bool debug; static void log_fn(struct udev *udev, int priority, @@ -267,7 +264,6 @@ static void worker_new(struct event *event) close(worker_watch[READ_END]); udev_log_close(); udev_log_init("udevd-work"); - setpriority(PRIO_PROCESS, 0, UDEV_PRIORITY); /* set signal handlers */ memset(&act, 0x00, sizeof(act)); @@ -1426,9 +1422,6 @@ int main(int argc, char *argv[]) if (fd > STDERR_FILENO) close(fd); - /* set scheduling priority for the main daemon process */ - setpriority(PRIO_PROCESS, 0, UDEVD_PRIORITY); - setsid(); f = fopen("/dev/kmsg", "w"); -- cgit v1.2.3-54-g00ecf From d3990a576a35119c919222337cda511c316fab9c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 Apr 2011 12:42:59 +0200 Subject: "db_persist=" -> "db_persist" --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index bef5abab5e..80a8354d52 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1594,7 +1594,7 @@ static int add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, op, NULL, NULL); } - pos = strstr(value, "db_persist="); + pos = strstr(value, "db_persist"); if (pos != NULL) rule_add_key(&rule_tmp, TK_A_DB_PERSIST, op, NULL, NULL); -- cgit v1.2.3-54-g00ecf From 8b4631362f29c8b9ae8d95fd731661a5434fa2f2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 Apr 2011 14:43:22 +0200 Subject: udevd: move OOM disable into --daemon option --- udev/udevd.c | 93 +++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 52 insertions(+), 41 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 244780ab57..dbb1e16004 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1102,7 +1102,6 @@ static int convert_db(struct udev *udev) int main(int argc, char *argv[]) { struct udev *udev; - int fd; FILE *f; sigset_t mask; int daemonize = false; @@ -1261,15 +1260,22 @@ int main(int argc, char *argv[]) static_dev_create_from_modules(udev); /* before opening new files, make sure std{in,out,err} fds are in a sane state */ - fd = open("/dev/null", O_RDWR); - if (fd < 0) { - fprintf(stderr, "cannot open /dev/null\n"); - err(udev, "cannot open /dev/null\n"); + if (daemonize) { + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + if (write(STDOUT_FILENO, 0, 0) < 0) + dup2(fd, STDOUT_FILENO); + if (write(STDERR_FILENO, 0, 0) < 0) + dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) + close(fd); + } else { + fprintf(stderr, "cannot open /dev/null\n"); + err(udev, "cannot open /dev/null\n"); + } } - if (write(STDOUT_FILENO, 0, 0) < 0) - dup2(fd, STDOUT_FILENO); - if (write(STDERR_FILENO, 0, 0) < 0) - dup2(fd, STDERR_FILENO); /* udevadm control socket */ if (sd_listen_fds(true) == 1 && sd_is_socket(SD_LISTEN_FDS_START, AF_LOCAL, SOCK_SEQPACKET, -1)) @@ -1302,6 +1308,7 @@ int main(int argc, char *argv[]) if (daemonize) { pid_t pid; + int fd; pid = fork(); switch (pid) { @@ -1315,10 +1322,46 @@ int main(int argc, char *argv[]) rc = 0; goto exit; } + + setsid(); + + fd = open("/proc/self/oom_score_adj", O_RDWR); + if (fd < 0) { + /* Fallback to old interface */ + fd = open("/proc/self/oom_adj", O_RDWR); + if (fd < 0) { + err(udev, "error disabling OOM: %m\n"); + } else { + /* OOM_DISABLE == -17 */ + write(fd, "-17", 3); + close(fd); + } + } else { + write(fd, "-1000", 5); + close(fd); + } } else { sd_notify(1, "READY=1"); } + f = fopen("/dev/kmsg", "w"); + if (f != NULL) { + fprintf(f, "<30>udev[%u]: starting version " VERSION "\n", getpid()); + fclose(f); + } + + if (!debug) { + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + close(fd); + } + } + fd_inotify = udev_watch_init(udev); if (fd_inotify < 0) { fprintf(stderr, "error initializing inotify\n"); @@ -1414,38 +1457,6 @@ int main(int argc, char *argv[]) /* if needed, convert old database from earlier udev version */ convert_db(udev); - if (!debug) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - } - if (fd > STDERR_FILENO) - close(fd); - - setsid(); - - f = fopen("/dev/kmsg", "w"); - if (f != NULL) { - fprintf(f, "<30>udev[%u]: starting version " VERSION "\n", getpid()); - fclose(f); - } - - fd = open("/proc/self/oom_score_adj", O_RDWR); - if (fd < 0) { - /* Fallback to old interface */ - fd = open("/proc/self/oom_adj", O_RDWR); - if (fd < 0) { - err(udev, "error disabling OOM: %m\n"); - } else { - /* OOM_DISABLE == -17 */ - write(fd, "-17", 3); - close(fd); - } - } else { - write(fd, "-1000", 5); - close(fd); - } - if (children_max <= 0) { int memsize = mem_size_mb(); -- cgit v1.2.3-54-g00ecf From 2b4f9e67c79339fd417cb49d0198233caaa076fd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 Apr 2011 14:44:21 +0200 Subject: systemd: add OOMScoreAdjust=-1000 --- init/udev.service.in | 1 + 1 file changed, 1 insertion(+) diff --git a/init/udev.service.in b/init/udev.service.in index c02a4b4d85..345aa3f25b 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -7,4 +7,5 @@ DefaultDependencies=no [Service] Type=notify +OOMScoreAdjust=-1000 ExecStart=@sbindir@/udevd -- cgit v1.2.3-54-g00ecf From 7f2d3a3fc805d6a02a35ac3743139e3ea3a1ce73 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 Apr 2011 14:44:56 +0200 Subject: require explicit "db_persist" to exclude device info from --db-cleanup --- udev/udev-rules.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 80a8354d52..84513328e7 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2345,9 +2345,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event const char *key = &rules->buf[cur->key.value_off]; const char *value; - /* implicitely mark database as persistent across initramfs transition */ - udev_device_set_db_persist(event->dev); - value = udev_device_get_property_value(event->dev_db, key); if (value != NULL) { struct udev_list_entry *entry; -- cgit v1.2.3-54-g00ecf From 7459bcdc8d12fdb217efd4a27a509f9f87ec7b1e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 Apr 2011 23:46:44 +0200 Subject: udevd: get netlink socket from systemd --- init/udev.service.in | 1 + init/udev.socket | 1 + libudev/libudev-ctrl.c | 34 ++++++++-------- libudev/libudev-monitor.c | 91 ++++++++++++++++++++++++++----------------- libudev/libudev-private.h | 3 +- udev/udevd.c | 98 +++++++++++++++++++++++++++++++++++++++-------- 6 files changed, 158 insertions(+), 70 deletions(-) diff --git a/init/udev.service.in b/init/udev.service.in index 345aa3f25b..117f5c8fd5 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -8,4 +8,5 @@ DefaultDependencies=no [Service] Type=notify OOMScoreAdjust=-1000 +Restart=on-failure ExecStart=@sbindir@/udevd diff --git a/init/udev.socket b/init/udev.socket index 81296306ac..12557be307 100644 --- a/init/udev.socket +++ b/init/udev.socket @@ -4,3 +4,4 @@ DefaultDependencies=no [Socket] ListenSequentialPacket=@/org/kernel/udev/udevd +ListenNetlink=kobject-uevent 1 diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c index 2d2dd3a0be..7fa2d1d535 100644 --- a/libudev/libudev-ctrl.c +++ b/libudev/libudev-ctrl.c @@ -60,6 +60,7 @@ struct udev_ctrl { int sock; struct sockaddr_un saddr; socklen_t addrlen; + bool bound; bool connected; }; @@ -81,7 +82,7 @@ static struct udev_ctrl *udev_ctrl_new(struct udev *udev) return uctrl; } -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) +struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *socket_path, int fd) { struct udev_ctrl *uctrl; @@ -89,11 +90,16 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke if (uctrl == NULL) return NULL; - uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET, 0); - if (uctrl->sock < 0) { - err(udev, "error getting socket: %m\n"); - udev_ctrl_unref(uctrl); - return NULL; + if (fd < 0) { + uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_CLOEXEC, 0); + if (uctrl->sock < 0) { + err(udev, "error getting socket: %m\n"); + udev_ctrl_unref(uctrl); + return NULL; + } + } else { + uctrl->bound = true; + uctrl->sock = fd; } uctrl->saddr.sun_family = AF_LOCAL; @@ -105,35 +111,31 @@ struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socke return uctrl; } -struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) +struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) { - struct udev_ctrl *uctrl; - - uctrl = udev_ctrl_new(udev); - if (uctrl == NULL) - return NULL; - uctrl->sock = fd; - - return uctrl; + return udev_ctrl_new_from_socket_fd(udev, socket_path, -1); } int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) { int err; - if (uctrl->addrlen > 0) { + if (!uctrl->bound) { err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); if (err < 0) { err = -errno; err(uctrl->udev, "bind failed: %m\n"); return err; } + err = listen(uctrl->sock, 0); if (err < 0) { err = -errno; err(uctrl->udev, "listen failed: %m\n"); return err; } + + uctrl->bound = true; } return 0; } diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index c97f6faa65..5d9e155722 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -50,6 +50,7 @@ struct udev_monitor { socklen_t addrlen; struct udev_list_node filter_subsystem_list; struct udev_list_node filter_tag_list; + bool bound; }; enum udev_monitor_netlink_group { @@ -155,32 +156,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char return udev_monitor; } -/** - * udev_monitor_new_from_netlink: - * @udev: udev library context - * @name: name of event source - * - * Create new udev monitor and connect to a specified event - * source. Valid sources identifiers are "udev" and "kernel". - * - * Applications should usually not connect directly to the - * "kernel" events, because the devices might not be useable - * at that time, before udev has configured them, and created - * device nodes. - * - * Accessing devices at the same time as udev, might result - * in unpredictable behavior. - * - * The "udev" events are sent out after udev has finished its - * event processing, all rules have been processed, and needed - * device nodes are created. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev monitor. - * - * Returns: a new udev monitor, or #NULL, in case of an error - **/ -struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) +struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd) { struct udev_monitor *udev_monitor; unsigned int group; @@ -201,11 +177,16 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char if (udev_monitor == NULL) return NULL; - udev_monitor->sock = socket(PF_NETLINK, SOCK_DGRAM|SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT); - if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %m\n"); - free(udev_monitor); - return NULL; + if (fd < 0) { + udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT); + if (udev_monitor->sock == -1) { + err(udev, "error getting socket: %m\n"); + free(udev_monitor); + return NULL; + } + } else { + udev_monitor->bound = true; + udev_monitor->sock = fd; } udev_monitor->snl.nl_family = AF_NETLINK; @@ -219,6 +200,36 @@ struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char return udev_monitor; } +/** + * udev_monitor_new_from_netlink: + * @udev: udev library context + * @name: name of event source + * + * Create new udev monitor and connect to a specified event + * source. Valid sources identifiers are "udev" and "kernel". + * + * Applications should usually not connect directly to the + * "kernel" events, because the devices might not be useable + * at that time, before udev has configured them, and created + * device nodes. + * + * Accessing devices at the same time as udev, might result + * in unpredictable behavior. + * + * The "udev" events are sent out after udev has finished its + * event processing, all rules have been processed, and needed + * device nodes are created. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev monitor. + * + * Returns: a new udev monitor, or #NULL, in case of an error + **/ +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) +{ + return udev_monitor_new_from_netlink_fd(udev, name, -1); +} + static inline void bpf_stmt(struct sock_filter *inss, unsigned int *i, unsigned short code, unsigned int data) { @@ -364,16 +375,24 @@ int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct */ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) { - int err; + int err = 0; const int on = 1; if (udev_monitor->sun.sun_family != 0) { - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); + if (!udev_monitor->bound) { + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); + if (err == 0) + udev_monitor->bound = true; + } } else if (udev_monitor->snl.nl_family != 0) { udev_monitor_filter_update(udev_monitor); - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); + if (!udev_monitor->bound) { + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); + if (err == 0) + udev_monitor->bound = true; + } if (err == 0) { struct sockaddr_nl snl; socklen_t addrlen; diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index e82ca1d753..63eb0704d6 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -122,11 +122,12 @@ int udev_monitor_disconnect(struct udev_monitor *udev_monitor); int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_monitor *destination, struct udev_device *udev_device); +struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd); /* libudev-ctrl.c - daemon runtime setup */ struct udev_ctrl; struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); -struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd); +struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *socket_path, int fd); int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); diff --git a/udev/udevd.c b/udev/udevd.c index dbb1e16004..b30a27bf71 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1099,6 +1099,42 @@ static int convert_db(struct udev *udev) return 0; } +static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) +{ + int ctrl = -1, netlink = -1; + int fd, n; + + n = sd_listen_fds(true); + if (n <= 0) + return -1; + + for (fd = SD_LISTEN_FDS_START; fd < n + SD_LISTEN_FDS_START; fd++) { + if (sd_is_socket(fd, AF_LOCAL, SOCK_SEQPACKET, -1)) { + if (ctrl >= 0) + return -1; + ctrl = fd; + continue; + } + + if (sd_is_socket(fd, AF_NETLINK, SOCK_RAW, -1)) { + if (netlink >= 0) + return -1; + netlink = fd; + continue; + } + + return -1; + } + + if (ctrl < 0 || netlink < 0) + return -1; + + info(udev, "ctrl=%i netlink=%i\n", ctrl, netlink); + *rctrl = ctrl; + *rnetlink = netlink; + return 0; +} + int main(int argc, char *argv[]) { struct udev *udev; @@ -1277,34 +1313,57 @@ int main(int argc, char *argv[]) } } - /* udevadm control socket */ - if (sd_listen_fds(true) == 1 && sd_is_socket(SD_LISTEN_FDS_START, AF_LOCAL, SOCK_SEQPACKET, -1)) - udev_ctrl = udev_ctrl_new_from_fd(udev, SD_LISTEN_FDS_START); - else + if (systemd_fds(udev, &fd_ctrl, &fd_netlink) >= 0) { + /* get control and netlink socket from from systemd */ + udev_ctrl = udev_ctrl_new_from_socket_fd(udev, UDEV_CTRL_SOCK_PATH, fd_ctrl); + if (udev_ctrl == NULL) { + err(udev, "error taking over udev control socket"); + rc = 1; + goto exit; + } + + monitor = udev_monitor_new_from_netlink_fd(udev, "kernel", fd_netlink); + if (monitor == NULL) { + err(udev, "error taking over netlink socket\n"); + rc = 3; + goto exit; + } + } else { + /* open control and netlink socket */ udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); - if (udev_ctrl == NULL) { - fprintf(stderr, "error initializing udev control socket"); - err(udev, "error initializing udev control socket"); - rc = 1; + if (udev_ctrl == NULL) { + fprintf(stderr, "error initializing udev control socket"); + err(udev, "error initializing udev control socket"); + rc = 1; + goto exit; + } + fd_ctrl = udev_ctrl_get_fd(udev_ctrl); + + monitor = udev_monitor_new_from_netlink(udev, "kernel"); + if (monitor == NULL) { + fprintf(stderr, "error initializing netlink socket\n"); + err(udev, "error initializing netlink socket\n"); + rc = 3; + goto exit; + } + fd_netlink = udev_monitor_get_fd(monitor); + } + + if (udev_monitor_enable_receiving(monitor) < 0) { + fprintf(stderr, "error binding netlink socket\n"); + err(udev, "error binding netlink socket\n"); + rc = 3; goto exit; } + if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { fprintf(stderr, "error binding udev control socket\n"); err(udev, "error binding udev control socket\n"); rc = 1; goto exit; } - fd_ctrl = udev_ctrl_get_fd(udev_ctrl); - monitor = udev_monitor_new_from_netlink(udev, "kernel"); - if (monitor == NULL || udev_monitor_enable_receiving(monitor) < 0) { - fprintf(stderr, "error initializing netlink socket\n"); - err(udev, "error initializing netlink socket\n"); - rc = 3; - goto exit; - } udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); - fd_netlink = udev_monitor_get_fd(monitor); if (daemonize) { pid_t pid; @@ -1428,18 +1487,23 @@ int main(int argc, char *argv[]) memset(&ep_ctrl, 0, sizeof(struct epoll_event)); ep_ctrl.events = EPOLLIN; ep_ctrl.data.fd = fd_ctrl; + memset(&ep_inotify, 0, sizeof(struct epoll_event)); ep_inotify.events = EPOLLIN; ep_inotify.data.fd = fd_inotify; + memset(&ep_signal, 0, sizeof(struct epoll_event)); ep_signal.events = EPOLLIN; ep_signal.data.fd = fd_signal; + memset(&ep_netlink, 0, sizeof(struct epoll_event)); ep_netlink.events = EPOLLIN; ep_netlink.data.fd = fd_netlink; + memset(&ep_worker, 0, sizeof(struct epoll_event)); ep_worker.events = EPOLLIN; ep_worker.data.fd = fd_worker; + fd_ep = epoll_create1(EPOLL_CLOEXEC); if (fd_ep < 0) { err(udev, "error creating epoll fd: %m\n"); -- cgit v1.2.3-54-g00ecf From 135f3e8d0b4b4968908421b677c9ef2ba860b71d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 15 Apr 2011 00:19:45 +0200 Subject: fix more warnings --- NEWS | 3 +++ extras/keymap/keymap.c | 4 ++-- extras/path_id/path_id.c | 4 +--- extras/scsi_id/scsi_id.c | 1 + extras/scsi_id/scsi_serial.c | 12 +++++------- extras/udev-acl/udev-acl.c | 5 ----- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/NEWS b/NEWS index 6647fd4c24..ccbaa46cd9 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,9 @@ udevadm control --exit udevadm info --cleanup-db +systemd netlink socket activation +requires systemd 25 + udev 167 ======== Bugfixes. diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index eabd1e44d8..597a53b467 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -192,8 +192,7 @@ static int merge_table(int fd, const char *filename) { f = fopen(filename, "r"); if (!f) { perror(filename); - r = -1; - goto fail; + return -1; } while (!feof(f)) { @@ -243,6 +242,7 @@ static int merge_table(int fd, const char *filename) { scancode, new_keycode, old_keycode); } fail: + fclose(f); return r; } diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index db13eeba27..518ec8b386 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -137,15 +137,13 @@ static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char ** /* find iscsi session */ transportdev = parent; - while (1) { + for (;;) { transportdev = udev_device_get_parent(transportdev); if (transportdev == NULL) return NULL; if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0) break; } - if (transportdev == NULL) - return NULL; /* find iscsi session device */ sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev)); diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index 6c8826568f..c14d411841 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -199,6 +199,7 @@ static int get_file_options(struct udev *udev, */ buffer = malloc(MAX_BUFFER_LEN); if (!buffer) { + fclose(fd); err(udev, "can't allocate memory\n"); return -1; } diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c index 516a6f16c5..5cde9a54a0 100644 --- a/extras/scsi_id/scsi_serial.c +++ b/extras/scsi_id/scsi_serial.c @@ -141,13 +141,13 @@ static int sg_err_category_new(struct udev *udev, } return SG_ERR_CAT_SENSE; } - if (!host_status) { + if (host_status) { if ((host_status == DID_NO_CONNECT) || (host_status == DID_BUS_BUSY) || (host_status == DID_TIME_OUT)) return SG_ERR_CAT_TIMEOUT; } - if (!driver_status) { + if (driver_status) { if (driver_status == DRIVER_TIMEOUT) return SG_ERR_CAT_TIMEOUT; } @@ -322,8 +322,10 @@ static int scsi_inquiry(struct udev *udev, { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; unsigned char sense[SENSE_BUFF_LEN]; void *io_buf; - int retval; + struct sg_io_v4 io_v4; + struct sg_io_hdr io_hdr; int retry = 3; /* rather random */ + int retval; if (buflen > SCSI_INQ_BUFF_LEN) { info(udev, "buflen %d too long\n", buflen); @@ -334,8 +336,6 @@ resend: dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); if (dev_scsi->use_sg == 4) { - struct sg_io_v4 io_v4; - memset(&io_v4, 0, sizeof(struct sg_io_v4)); io_v4.guard = 'Q'; io_v4.protocol = BSG_PROTOCOL_SCSI; @@ -348,8 +348,6 @@ resend: io_v4.din_xferp = (uintptr_t)buf; io_buf = (void *)&io_v4; } else { - struct sg_io_hdr io_hdr; - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); io_hdr.interface_id = 'S'; io_hdr.cmd_len = sizeof(inq_cmd); diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index 2dd3e6cac9..35bad76034 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -258,11 +258,6 @@ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, con u = u2; } break; - case ACTION_NONE: - break; - default: - g_assert_not_reached(); - break; } *remove_session_id = old_session; -- cgit v1.2.3-54-g00ecf From fdf52f5e2a6c67bf5a709845b2b10621083f849a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 15 Apr 2011 01:14:10 +0200 Subject: libudev: ctrl, monitor - use SOCK_NONBLOCK --- NEWS | 1 + libudev/libudev-ctrl.c | 2 +- libudev/libudev-monitor.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index ccbaa46cd9..afec73c3e5 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ udevadm control --exit udevadm info --cleanup-db systemd netlink socket activation +stop socket or mask on rpm update requires systemd 25 udev 167 diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c index 7fa2d1d535..a2133fff1c 100644 --- a/libudev/libudev-ctrl.c +++ b/libudev/libudev-ctrl.c @@ -91,7 +91,7 @@ struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *so return NULL; if (fd < 0) { - uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_CLOEXEC, 0); + uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); if (uctrl->sock < 0) { err(udev, "error getting socket: %m\n"); udev_ctrl_unref(uctrl); diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 5d9e155722..d890b4b142 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -145,7 +145,7 @@ struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; } - udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0); + udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); if (udev_monitor->sock == -1) { err(udev, "error getting socket: %m\n"); free(udev_monitor); -- cgit v1.2.3-54-g00ecf From 29df09edd0e6b1c5c70f12f2a04dcd0c8da003d0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 15 Apr 2011 01:43:27 +0200 Subject: systemd: socket -> sockets --- init/udev.socket | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/udev.socket b/init/udev.socket index 12557be307..f45a1a6fc9 100644 --- a/init/udev.socket +++ b/init/udev.socket @@ -1,5 +1,5 @@ [Unit] -Description=udev Kernel Device Manager Socket +Description=udev Kernel Device Manager Sockets DefaultDependencies=no [Socket] -- cgit v1.2.3-54-g00ecf From 578cd5101d55ac1b6ac05e0e2ea7107633aa45f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 15 Apr 2011 11:58:17 +0200 Subject: udevadm: monitor - use epoll --- TODO | 3 ++ udev/udevadm-monitor.c | 100 +++++++++++++++++++++++++++++++------------------ 2 files changed, 67 insertions(+), 36 deletions(-) diff --git a/TODO b/TODO index 6906aa89d1..c096133131 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,6 @@ + - get rid of select() + - use signalfd instead of ppoll() + - remove deprecated trigger --type=failed logic - remove deprecated BUS=, SYSFS{}=, ID= keys diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index a587e8cc0f..8fe9e0527c 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -27,18 +27,18 @@ #include #include #include -#include +#include #include #include #include "udev.h" -static int udev_exit; +static bool udev_exit; static void sig_handler(int signum) { if (signum == SIGINT || signum == SIGTERM) - udev_exit = 1; + udev_exit = true; } static void print_device(struct udev_device *device, const char *source, int prop) @@ -69,14 +69,16 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) struct sigaction act; sigset_t mask; int option; - int prop = 0; - int print_kernel = 0; - int print_udev = 0; + bool prop = false; + bool print_kernel = false; + bool print_udev = false; struct udev_list_node subsystem_match_list; struct udev_list_node tag_match_list; struct udev_monitor *udev_monitor = NULL; struct udev_monitor *kernel_monitor = NULL; - fd_set readfds; + int fd_ep = -1; + int fd_kernel = -1, fd_udev = -1; + struct epoll_event ep_kernel, ep_udev; int rc = 0; static const struct option options[] = { @@ -92,6 +94,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) udev_list_init(&subsystem_match_list); udev_list_init(&tag_match_list); + for (;;) { option = getopt_long(argc, argv, "pekus:t:h", options, NULL); if (option == -1) @@ -100,13 +103,13 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) switch (option) { case 'p': case 'e': - prop = 1; + prop = true; break; case 'k': - print_kernel = 1; + print_kernel = true; break; case 'u': - print_udev = 1; + print_udev = true; break; case 's': { @@ -138,8 +141,8 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) } if (!print_kernel && !print_udev) { - print_kernel = 1; - print_udev =1; + print_kernel = true; + print_udev = true; } /* set signal handlers */ @@ -154,6 +157,12 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) sigaddset(&mask, SIGTERM); sigprocmask(SIG_UNBLOCK, &mask, NULL); + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto out; + } + printf("monitor will print the received events for:\n"); if (print_udev) { struct udev_list_entry *entry; @@ -165,6 +174,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) goto out; } udev_monitor_set_receive_buffer_size(udev_monitor, 128*1024*1024); + fd_udev = udev_monitor_get_fd(udev_monitor); udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { const char *subsys = udev_list_entry_get_name(entry); @@ -186,8 +196,18 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) rc = 2; goto out; } + + memset(&ep_udev, 0, sizeof(struct epoll_event)); + ep_udev.events = EPOLLIN; + ep_udev.data.fd = fd_udev; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + printf("UDEV - the event which udev sends out after rule processing\n"); } + if (print_kernel) { struct udev_list_entry *entry; @@ -198,6 +218,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) goto out; } udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); + fd_kernel = udev_monitor_get_fd(kernel_monitor); udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { const char *subsys = udev_list_entry_get_name(entry); @@ -211,49 +232,56 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) rc = 4; goto out; } + + memset(&ep_kernel, 0, sizeof(struct epoll_event)); + ep_kernel.events = EPOLLIN; + ep_kernel.data.fd = fd_kernel; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + printf("KERNEL - the kernel uevent\n"); } printf("\n"); while (!udev_exit) { int fdcount; + struct epoll_event ev[4]; + int i; - FD_ZERO(&readfds); - if (kernel_monitor != NULL) - FD_SET(udev_monitor_get_fd(kernel_monitor), &readfds); - if (udev_monitor != NULL) - FD_SET(udev_monitor_get_fd(udev_monitor), &readfds); - - fdcount = select(MAX(udev_monitor_get_fd(kernel_monitor), udev_monitor_get_fd(udev_monitor))+1, - &readfds, NULL, NULL, NULL); + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); if (fdcount < 0) { if (errno != EINTR) fprintf(stderr, "error receiving uevent message: %m\n"); continue; } - if ((kernel_monitor != NULL) && FD_ISSET(udev_monitor_get_fd(kernel_monitor), &readfds)) { - struct udev_device *device; + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_kernel && ev[i].events & EPOLLIN) { + struct udev_device *device; - device = udev_monitor_receive_device(kernel_monitor); - if (device == NULL) - continue; - print_device(device, "KERNEL", prop); - udev_device_unref(device); - } + device = udev_monitor_receive_device(kernel_monitor); + if (device == NULL) + continue; + print_device(device, "KERNEL", prop); + udev_device_unref(device); + } - if ((udev_monitor != NULL) && FD_ISSET(udev_monitor_get_fd(udev_monitor), &readfds)) { - struct udev_device *device; + if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { + struct udev_device *device; - device = udev_monitor_receive_device(udev_monitor); - if (device == NULL) - continue; - print_device(device, "UDEV", prop); - udev_device_unref(device); + device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) + continue; + print_device(device, "UDEV", prop); + udev_device_unref(device); + } } } - out: + if (fd_ep >= 0) + close(fd_ep); udev_monitor_unref(udev_monitor); udev_monitor_unref(kernel_monitor); udev_list_cleanup_entries(udev, &subsystem_match_list); -- cgit v1.2.3-54-g00ecf From f2fd4d2723a082288f1bd2a1d647c4897732dfd8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 15 Apr 2011 12:18:06 +0200 Subject: libudev: test - use epoll --- libudev/test-libudev.c | 82 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 27 deletions(-) diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index 5ff8663b90..9dc86bd918 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -18,10 +18,12 @@ #include #include #include -#include +#include #include "libudev.h" +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) @@ -220,55 +222,81 @@ static int test_enumerate_print_list(struct udev_enumerate *enumerate) static int test_monitor(struct udev *udev) { struct udev_monitor *udev_monitor; - fd_set readfds; - int fd; + int fd_ep; + int fd_udev = -1; + struct epoll_event ep_udev, ep_stdin; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + printf("error creating epoll fd: %m\n"); + goto out; + } udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); if (udev_monitor == NULL) { printf("no socket\n"); - return -1; + goto out; } + fd_udev = udev_monitor_get_fd(udev_monitor); + if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "block", NULL) < 0 || udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL) < 0 || udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device") < 0) { printf("filter failed\n"); - return -1; + goto out; } + if (udev_monitor_enable_receiving(udev_monitor) < 0) { printf("bind failed\n"); - return -1; + goto out; } - fd = udev_monitor_get_fd(udev_monitor); - FD_ZERO(&readfds); + memset(&ep_udev, 0, sizeof(struct epoll_event)); + ep_udev.events = EPOLLIN; + ep_udev.data.fd = fd_udev; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { + printf("fail to add fd to epoll: %m\n"); + goto out; + } + + memset(&ep_stdin, 0, sizeof(struct epoll_event)); + ep_stdin.events = EPOLLIN; + ep_stdin.data.fd = STDIN_FILENO; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, STDIN_FILENO, &ep_stdin) < 0) { + printf("fail to add fd to epoll: %m\n"); + goto out; + } for (;;) { - struct udev_device *device; int fdcount; - - FD_SET(STDIN_FILENO, &readfds); - FD_SET(fd, &readfds); + struct epoll_event ev[4]; + struct udev_device *device; + int i; printf("waiting for events from udev, press ENTER to exit\n"); - fdcount = select(fd+1, &readfds, NULL, NULL, NULL); - printf("select fd count: %i\n", fdcount); - - if (FD_ISSET(fd, &readfds)) { - device = udev_monitor_receive_device(udev_monitor); - if (device == NULL) { - printf("no device from socket\n"); - continue; + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + printf("epoll fd count: %i\n", fdcount); + + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { + device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) { + printf("no device from socket\n"); + continue; + } + print_device(device); + udev_device_unref(device); } - print_device(device); - udev_device_unref(device); - } - if (FD_ISSET(STDIN_FILENO, &readfds)) { - printf("exiting loop\n"); - break; + if (ev[i].data.fd == STDIN_FILENO && ev[i].events & EPOLLIN) { + printf("exiting loop\n"); + goto out; + } } } - +out: + if (fd_ep >= 0) + close(fd_ep); udev_monitor_unref(udev_monitor); return 0; } -- cgit v1.2.3-54-g00ecf From 372b9bffa7197b345df35f75a577195a19b72eff Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 17 Apr 2011 22:09:08 +0200 Subject: udevadm: test - use printf() instead of info() for non-debug output --- udev/udevadm-test.c | 6 +++--- udev/udevadm.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 4db70c49dd..4137ce91fa 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -114,17 +114,17 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) err = udev_event_execute_rules(event, rules); if (udev_device_get_event_timeout(dev) >= 0) - info(udev, "custom event timeout: %i\n", udev_device_get_event_timeout(dev)); + printf("custom event timeout: %i\n", udev_device_get_event_timeout(dev)); udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) - info(udev, "%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); + printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); if (err == 0) udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); - info(udev, "run: '%s'\n", program); + printf("run: '%s'\n", program); } udev_event_unref(event); udev_device_unref(dev); diff --git a/udev/udevadm.c b/udev/udevadm.c index 336d723705..2a29158917 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -25,7 +25,7 @@ #include "udev.h" -static int debug; +static bool debug; static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, @@ -101,7 +101,7 @@ static const struct command cmds[] = { .name = "test", .cmd = udevadm_test, .help = "simulation run", - .debug = 1, + .debug = true, }, { .name = "version", @@ -117,7 +117,7 @@ static const struct command cmds[] = { static int run_command(struct udev *udev, const struct command *cmd, int argc, char *argv[]) { if (cmd->debug) { - debug = 1; + debug = true; if (udev_get_log_priority(udev) < LOG_INFO) udev_set_log_priority(udev, LOG_INFO); } @@ -155,7 +155,7 @@ int main(int argc, char *argv[]) switch (option) { case 'd': - debug = 1; + debug = true; if (udev_get_log_priority(udev) < LOG_INFO) udev_set_log_priority(udev, LOG_INFO); break; -- cgit v1.2.3-54-g00ecf From 13052c02851b1dfb81c584eee141b83f80c98e0e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 17 Apr 2011 22:10:18 +0200 Subject: use 'else if' in epoll event array loop --- libudev/test-libudev.c | 4 +--- udev/udevadm-monitor.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index 9dc86bd918..4192ba14b2 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -286,9 +286,7 @@ static int test_monitor(struct udev *udev) } print_device(device); udev_device_unref(device); - } - - if (ev[i].data.fd == STDIN_FILENO && ev[i].events & EPOLLIN) { + } else if (ev[i].data.fd == STDIN_FILENO && ev[i].events & EPOLLIN) { printf("exiting loop\n"); goto out; } diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 8fe9e0527c..e1bb6fe18e 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -266,9 +266,7 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) continue; print_device(device, "KERNEL", prop); udev_device_unref(device); - } - - if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { + } else if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { struct udev_device *device; device = udev_monitor_receive_device(udev_monitor); -- cgit v1.2.3-54-g00ecf From 1d843b7d689043aa597b97e0e1e6c66bd71b049d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 18 Apr 2011 02:13:40 +0200 Subject: libudev: run_program() - select() -> epoll --- libudev/libudev-util-private.c | 335 ++++++++++++++++++++++++----------------- 1 file changed, 201 insertions(+), 134 deletions(-) diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index c7ad20eb74..87b9edbc71 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include @@ -259,6 +261,169 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, return 0; } +static int run_program_exec(struct udev *udev, int fd_stdout, int fd_stderr, + char *const argv[], char **envp, const sigset_t *sigmask) +{ + int err; + int fd; + + /* discard child output or connect to pipe */ + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + if (fd_stdout < 0) + dup2(fd, STDOUT_FILENO); + if (fd_stderr < 0) + dup2(fd, STDERR_FILENO); + close(fd); + } else { + err(udev, "open /dev/null failed: %m\n"); + } + + /* connect pipes to std{out,err} */ + if (fd_stdout >= 0) { + dup2(fd_stdout, STDOUT_FILENO); + close(fd_stdout); + } + if (fd_stderr >= 0) { + dup2(fd_stderr, STDERR_FILENO); + close(fd_stderr); + } + + /* terminate child in case parent goes away */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + + /* restore original udev sigmask before exec */ + if (sigmask) + sigprocmask(SIG_SETMASK, sigmask, NULL); + + execve(argv[0], argv, envp); + + /* exec failed */ + err = -errno; + if (err == -ENOENT || err == -ENOTDIR) { + /* may be on a filesystem which is not mounted right now */ + info(udev, "program '%s' not found\n", argv[0]); + } else { + /* other problems */ + err(udev, "exec of program '%s' failed\n", argv[0]); + } + return err; +} + +static int run_program_read(struct udev *udev, int fd_stdout, int fd_stderr, + char *const argv[], char *result, size_t ressize, size_t *reslen) +{ + size_t respos = 0; + int fd_ep = -1; + struct epoll_event ep_outpipe; + struct epoll_event ep_errpipe; + int err = 0; + + /* read from child if requested */ + if (fd_stdout < 0 && fd_stderr < 0) + return 0; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err = -errno; + err(udev, "error creating epoll fd: %m\n"); + goto out; + } + + if (fd_stdout >= 0) { + memset(&ep_outpipe, 0, sizeof(struct epoll_event)); + ep_outpipe.events = EPOLLIN; + ep_outpipe.data.ptr = &fd_stdout; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + if (fd_stderr >= 0) { + memset(&ep_errpipe, 0, sizeof(struct epoll_event)); + ep_errpipe.events = EPOLLIN; + ep_errpipe.data.ptr = &fd_stderr; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + /* read child output */ + while (fd_stdout >= 0 || fd_stderr >= 0) { + int fdcount; + struct epoll_event ev[4]; + int i; + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err(udev, "failed to poll: %m\n"); + err = -errno; + goto out; + } + + for (i = 0; i < fdcount; i++) { + int *fd = (int *)ev[i].data.ptr; + + if (ev[i].events & EPOLLIN) { + ssize_t count; + char buf[4096]; + + count = read(*fd, buf, sizeof(buf)-1); + if (count <= 0) + continue; + buf[count] = '\0'; + + /* store stdout result */ + if (result != NULL && *fd == fd_stdout) { + if (respos + count < ressize) { + memcpy(&result[respos], buf, count); + respos += count; + } else { + err(udev, "ressize %zd too short\n", ressize); + err = -ENOBUFS; + } + } + + /* log debug output only if we watch stderr */ + if (fd_stderr >= 0) { + char *pos; + char *line; + + pos = buf; + while ((line = strsep(&pos, "\n"))) { + if (pos != NULL || line[0] != '\0') + info(udev, "'%s'(%s) '%s'\n", argv[0], *fd == fd_stdout ? "out" : "err" , line); + } + } + } else if (ev[i].events & EPOLLHUP) { + if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) { + err = -errno; + err(udev, "failed to remove fd from epoll: %m\n"); + goto out; + } + *fd = -1; + } + } + } + + /* return the child's stdout string */ + if (result != NULL) { + result[respos] = '\0'; + dbg(udev, "result='%s'\n", result); + if (reslen != NULL) + *reslen = respos; + } +out: + if (fd_ep >= 0) + close(fd_ep); + return err; +} + int util_run_program(struct udev *udev, const char *command, char **envp, char *result, size_t ressize, size_t *reslen, const sigset_t *sigmask) @@ -270,7 +435,6 @@ int util_run_program(struct udev *udev, const char *command, char **envp, char arg[UTIL_PATH_SIZE]; char program[UTIL_PATH_SIZE]; char *argv[((sizeof(arg) + 1) / 2) + 1]; - int devnull; int i; int err = 0; @@ -305,17 +469,19 @@ int util_run_program(struct udev *udev, const char *command, char **envp, argv[1] = NULL; } - /* prepare pipes from child to parent */ + /* pipes from child to parent */ if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(outpipe) != 0) { + if (pipe2(outpipe, O_NONBLOCK) != 0) { + err = -errno; err(udev, "pipe failed: %m\n"); - return -1; + goto out; } } if (udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe(errpipe) != 0) { + if (pipe2(errpipe, O_NONBLOCK) != 0) { + err = -errno; err(udev, "pipe failed: %m\n"); - return -1; + goto out; } } @@ -328,145 +494,36 @@ int util_run_program(struct udev *udev, const char *command, char **envp, pid = fork(); switch(pid) { case 0: - /* child closes parent ends of pipes */ - if (outpipe[READ_END] > 0) + /* child closes parent's ends of pipes */ + if (outpipe[READ_END] >= 0) { close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* discard child output or connect to pipe */ - devnull = open("/dev/null", O_RDWR); - if (devnull > 0) { - dup2(devnull, STDIN_FILENO); - if (outpipe[WRITE_END] < 0) - dup2(devnull, STDOUT_FILENO); - if (errpipe[WRITE_END] < 0) - dup2(devnull, STDERR_FILENO); - close(devnull); - } else - err(udev, "open /dev/null failed: %m\n"); - if (outpipe[WRITE_END] > 0) { - dup2(outpipe[WRITE_END], STDOUT_FILENO); - close(outpipe[WRITE_END]); + outpipe[READ_END] = -1; } - if (errpipe[WRITE_END] > 0) { - dup2(errpipe[WRITE_END], STDERR_FILENO); - close(errpipe[WRITE_END]); + if (errpipe[READ_END] >= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; } - if (sigmask) - sigprocmask(SIG_SETMASK, sigmask, NULL); + err = run_program_exec(udev, outpipe[WRITE_END], errpipe[WRITE_END], argv, envp, sigmask); - execve(argv[0], argv, envp); - if (errno == ENOENT || errno == ENOTDIR) { - /* may be on a filesystem which is not mounted right now */ - info(udev, "program '%s' not found\n", argv[0]); - } else { - /* other problems */ - err(udev, "exec of program '%s' failed\n", argv[0]); - } _exit(1); case -1: err(udev, "fork of '%s' failed: %m\n", argv[0]); - return -1; + err = -1; + goto out; default: - /* read from child if requested */ - if (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - ssize_t count; - size_t respos = 0; - - /* parent closes child ends of pipes */ - if (outpipe[WRITE_END] > 0) - close(outpipe[WRITE_END]); - if (errpipe[WRITE_END] > 0) - close(errpipe[WRITE_END]); - - /* read child output */ - while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) { - int fdcount; - fd_set readfds; - - FD_ZERO(&readfds); - if (outpipe[READ_END] > 0) - FD_SET(outpipe[READ_END], &readfds); - if (errpipe[READ_END] > 0) - FD_SET(errpipe[READ_END], &readfds); - fdcount = select(MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err = -1; - break; - } - - /* get stdout */ - if (outpipe[READ_END] > 0 && FD_ISSET(outpipe[READ_END], &readfds)) { - char inbuf[1024]; - char *pos; - char *line; - - count = read(outpipe[READ_END], inbuf, sizeof(inbuf)-1); - if (count <= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - if (count < 0) { - err(udev, "stdin read failed: %m\n"); - err = -1; - } - continue; - } - inbuf[count] = '\0'; - - /* store result for rule processing */ - if (result) { - if (respos + count < ressize) { - memcpy(&result[respos], inbuf, count); - respos += count; - } else { - err(udev, "ressize %ld too short\n", (long)ressize); - err = -1; - } - } - pos = inbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stdout) '%s'\n", argv[0], line); - } + /* parent closed child's ends of pipes */ + if (outpipe[WRITE_END] >= 0) { + close(outpipe[WRITE_END]); + outpipe[WRITE_END] = -1; + } + if (errpipe[WRITE_END] >= 0) { + close(errpipe[WRITE_END]); + errpipe[WRITE_END] = -1; + } - /* get stderr */ - if (errpipe[READ_END] > 0 && FD_ISSET(errpipe[READ_END], &readfds)) { - char errbuf[1024]; - char *pos; - char *line; + err = run_program_read(udev, outpipe[READ_END], errpipe[READ_END], argv, result, ressize, reslen); - count = read(errpipe[READ_END], errbuf, sizeof(errbuf)-1); - if (count <= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - if (count < 0) - err(udev, "stderr read failed: %m\n"); - continue; - } - errbuf[count] = '\0'; - pos = errbuf; - while ((line = strsep(&pos, "\n"))) - if (pos || line[0] != '\0') - info(udev, "'%s' (stderr) '%s'\n", argv[0], line); - } - } - if (outpipe[READ_END] > 0) - close(outpipe[READ_END]); - if (errpipe[READ_END] > 0) - close(errpipe[READ_END]); - - /* return the child's stdout string */ - if (result) { - result[respos] = '\0'; - dbg(udev, "result='%s'\n", result); - if (reslen) - *reslen = respos; - } - } waitpid(pid, &status, 0); if (WIFEXITED(status)) { info(udev, "'%s' returned with exitcode %i\n", command, WEXITSTATUS(status)); @@ -477,5 +534,15 @@ int util_run_program(struct udev *udev, const char *command, char **envp, err = -1; } } + +out: + if (outpipe[READ_END] >= 0) + close(outpipe[READ_END]); + if (outpipe[WRITE_END] >= 0) + close(outpipe[WRITE_END]); + if (errpipe[READ_END] >= 0) + close(errpipe[READ_END]); + if (errpipe[WRITE_END] >= 0) + close(errpipe[WRITE_END]); return err; } -- cgit v1.2.3-54-g00ecf From 82063a88d1fbcceade7e0475ebef2fc69fa5fa87 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 18 Apr 2011 02:14:24 +0200 Subject: udevd: ppoll() -> epoll + signalfd --- TODO | 2 - udev/udevd.c | 128 +++++++++++++++++++++++++++++++++++------------------------ 2 files changed, 76 insertions(+), 54 deletions(-) diff --git a/TODO b/TODO index c096133131..80d5086010 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - - get rid of select() - - use signalfd instead of ppoll() - remove deprecated trigger --type=failed logic diff --git a/udev/udevd.c b/udev/udevd.c index b30a27bf71..f730cab484 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -85,7 +85,6 @@ static sigset_t orig_sigmask; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); static bool udev_exit; -static volatile sig_atomic_t worker_exit; enum event_state { EVENT_UNDEF, @@ -168,18 +167,6 @@ static void event_queue_delete(struct event *event, bool export) free(event); } -static void event_sig_handler(int signum) -{ - switch (signum) { - case SIGALRM: - _exit(1); - break; - case SIGTERM: - worker_exit = true; - break; - } -} - static struct worker *worker_ref(struct worker *worker) { worker->refcount++; @@ -220,7 +207,6 @@ static void worker_new(struct event *event) struct worker *worker; struct udev_monitor *worker_monitor; pid_t pid; - struct sigaction act; /* listen for new events */ worker_monitor = udev_monitor_new_from_netlink(udev, NULL); @@ -242,12 +228,11 @@ static void worker_new(struct event *event) pid = fork(); switch (pid) { case 0: { - sigset_t sigmask; - struct udev_device *dev; - struct pollfd pmon = { - .fd = udev_monitor_get_fd(worker_monitor), - .events = POLLIN, - }; + struct udev_device *dev = NULL; + int fd_monitor; + struct epoll_event ep_signal, ep_monitor; + sigset_t mask; + int rc = EXIT_SUCCESS; /* move initial device from queue */ dev = event->dev; @@ -265,25 +250,41 @@ static void worker_new(struct event *event) udev_log_close(); udev_log_init("udevd-work"); - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = event_sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGTERM, &act, NULL); - sigaction(SIGALRM, &act, NULL); - - /* unblock SIGALRM */ - sigfillset(&sigmask); - sigdelset(&sigmask, SIGALRM); - sigprocmask(SIG_SETMASK, &sigmask, NULL); - /* SIGTERM is unblocked in ppoll() */ - sigdelset(&sigmask, SIGTERM); + sigfillset(&mask); + fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (fd_signal < 0) { + err(udev, "error creating signalfd %m\n"); + rc = 2; + goto out; + } + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + rc = 3; + goto out; + } + + memset(&ep_signal, 0, sizeof(struct epoll_event)); + ep_signal.events = EPOLLIN; + ep_signal.data.fd = fd_signal; + + fd_monitor = udev_monitor_get_fd(worker_monitor); + memset(&ep_monitor, 0, sizeof(struct epoll_event)); + ep_monitor.events = EPOLLIN; + ep_monitor.data.fd = fd_monitor; + + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_monitor, &ep_monitor) < 0) { + err(udev, "fail to add fds to epoll: %m\n"); + rc = 4; + goto out; + } /* request TERM signal if parent exits */ prctl(PR_SET_PDEATHSIG, SIGTERM); - do { + for (;;) { struct udev_event *udev_event; struct worker_message msg = {}; int err; @@ -291,8 +292,10 @@ static void worker_new(struct event *event) info(udev, "seq %llu running\n", udev_device_get_seqnum(dev)); udev_event = udev_event_new(dev); - if (udev_event == NULL) - _exit(3); + if (udev_event == NULL) { + rc = 5; + goto out; + } /* set timeout to prevent hanging processes */ alarm(UDEV_EVENT_TIMEOUT); @@ -334,29 +337,50 @@ static void worker_new(struct event *event) udev_device_unref(dev); dev = NULL; - /* wait for more device messages or signal from udevd */ - while (!worker_exit) { + /* wait for more device messages from main udevd, or term signal */ + while (dev == NULL) { + struct epoll_event ev[4]; int fdcount; + int i; - fdcount = ppoll(&pmon, 1, NULL, &sigmask); + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); if (fdcount < 0) continue; - if (pmon.revents & POLLIN) { - dev = udev_monitor_receive_device(worker_monitor); - if (dev != NULL) - break; + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_monitor && ev[i].events & EPOLLIN) { + dev = udev_monitor_receive_device(worker_monitor); + } else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) { + struct signalfd_siginfo fdsi; + ssize_t size; + + size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size != sizeof(struct signalfd_siginfo)) + continue; + switch (fdsi.ssi_signo) { + case SIGTERM: + goto out; + case SIGALRM: + rc = EXIT_FAILURE; + goto out; + } + } } } - } while (dev != NULL); - + } +out: + udev_device_unref(dev); + if (fd_signal >= 0) + close(fd_signal); + if (fd_ep >= 0) + close(fd_ep); close(fd_inotify); close(worker_watch[WRITE_END]); udev_rules_unref(rules); udev_monitor_unref(worker_monitor); udev_unref(udev); udev_log_close(); - exit(EXIT_SUCCESS); + exit(rc); } case -1: udev_monitor_unref(worker_monitor); @@ -1455,18 +1479,18 @@ int main(int argc, char *argv[]) /* block and listen to all signals on signalfd */ sigfillset(&mask); sigprocmask(SIG_SETMASK, &mask, &orig_sigmask); - fd_signal = signalfd(-1, &mask, SFD_CLOEXEC); + fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); if (fd_signal < 0) { - fprintf(stderr, "error getting signalfd\n"); - err(udev, "error getting signalfd\n"); + fprintf(stderr, "error creating signalfd\n"); + err(udev, "error creating signalfd\n"); rc = 5; goto exit; } /* unnamed socket from workers to the main daemon */ if (socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, worker_watch) < 0) { - fprintf(stderr, "error getting socketpair\n"); - err(udev, "error getting socketpair\n"); + fprintf(stderr, "error creating socketpair\n"); + err(udev, "error creating socketpair\n"); rc = 6; goto exit; } -- cgit v1.2.3-54-g00ecf From c641e4a02d43a22d7a4ddbc865dfe733a08b6535 Mon Sep 17 00:00:00 2001 From: Leonid Antonenkov Date: Mon, 18 Apr 2011 05:11:53 +0200 Subject: rule-generator: net - ignore Hyper-V virtual interfaces --- extras/rule_generator/75-persistent-net-generator.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index f150e55208..539807c861 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -33,6 +33,8 @@ ENV{MATCHIFTYPE}="$attr{type}" ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" # ignore VMWare virtual interfaces ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" +# ignore Hyper-V virtual interfaces +ENV{MATCHADDR}=="00:15:5d:*", GOTO="persistent_net_generator_end" # These vendors are known to violate the local MAC address assignment scheme # Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom -- cgit v1.2.3-54-g00ecf From 131c9e9240dfd4a54cf18a1c115554110eb02226 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 18 Apr 2011 13:34:42 +0200 Subject: keymap: Another ID for Logitech Wave keyboard http://bugs.debian.org/623153 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 350f111504..9fb90048e8 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -22,7 +22,7 @@ LABEL="keyboard_usbcheck" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" # Logitech Cordless Wave Pro looks slightly weird; some hotkeys are coming through the mouse interface -ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c529", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" +ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c52[9b]", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" -- cgit v1.2.3-54-g00ecf From 2181d30a342dd9fb168b7077ae5095849e328689 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Apr 2011 01:53:03 +0200 Subject: timeout handling without alarm() --- NEWS | 2 + TODO | 7 + libudev/libudev-device.c | 21 +-- libudev/libudev-private.h | 7 +- libudev/libudev-util-private.c | 289 ------------------------------ libudev/libudev-util.c | 2 +- udev/test-udev.c | 61 ++----- udev/udev-event.c | 391 ++++++++++++++++++++++++++++++++++++++++- udev/udev-rules.c | 36 ++-- udev/udev.h | 16 +- udev/udevadm-test.c | 63 +++++-- udev/udevd.c | 41 +++-- 12 files changed, 519 insertions(+), 417 deletions(-) diff --git a/NEWS b/NEWS index afec73c3e5..27be44c5a8 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,8 @@ systemd netlink socket activation stop socket or mask on rpm update requires systemd 25 +hard event timeout now. hanging programs will be killed + udev 167 ======== Bugfixes. diff --git a/TODO b/TODO index 80d5086010..34907d70d9 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,10 @@ + - kill alarm() + + - empty rules files and link to /dev/null are ok + + - rename netif with ifindex not devname + + - kill tabs? - remove deprecated trigger --type=failed logic diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index a141dadf0a..0ef7260de2 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -69,7 +69,6 @@ struct udev_device { struct udev_list_node tags_list; unsigned long long int seqnum; unsigned long long int usec_initialized; - int event_timeout; int timeout; int devlink_priority; int refcount; @@ -376,7 +375,7 @@ struct udev_device *udev_device_new(struct udev *udev) udev_list_init(&udev_device->sysattr_value_list); udev_list_init(&udev_device->sysattr_list); udev_list_init(&udev_device->tags_list); - udev_device->event_timeout = -1; + udev_device->timeout = -1; udev_device->watch_handle = -1; /* copy global properties */ udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) @@ -1164,7 +1163,7 @@ unsigned long long int udev_device_get_usec_since_initialized(struct udev_device udev_device_read_db(udev_device, NULL); if (udev_device->usec_initialized == 0) return 0; - now = usec_monotonic(); + now = now_usec(); if (now == 0) return 0; return now - udev_device->usec_initialized; @@ -1689,23 +1688,11 @@ int udev_device_get_timeout(struct udev_device *udev_device) } int udev_device_set_timeout(struct udev_device *udev_device, int timeout) -{ - udev_device->timeout = timeout; - return 0; -} -int udev_device_get_event_timeout(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_device->event_timeout; -} - -int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout) { char num[32]; - udev_device->event_timeout = event_timeout; - snprintf(num, sizeof(num), "%u", event_timeout); + udev_device->timeout = timeout; + snprintf(num, sizeof(num), "%u", timeout); udev_device_add_property(udev_device, "TIMEOUT", num); return 0; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 63eb0704d6..c47bbce2d6 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -96,8 +96,6 @@ int udev_device_has_tag(struct udev_device *udev_device, const char *tag); int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename); int udev_device_get_timeout(struct udev_device *udev_device); int udev_device_set_timeout(struct udev_device *udev_device, int timeout); -int udev_device_get_event_timeout(struct udev_device *udev_device); -int udev_device_set_event_timeout(struct udev_device *udev_device, int event_timeout); int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device); @@ -234,12 +232,9 @@ int util_delete_path(struct udev *udev, const char *path); int util_unlink_secure(struct udev *udev, const char *filename); uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); -int util_run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen, - const sigset_t *sigmask); int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); -unsigned long long usec_monotonic(void); +unsigned long long now_usec(void); /* libudev-selinux-private.c */ #ifndef WITH_SELINUX diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 87b9edbc71..2d7f8dc758 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -19,9 +19,6 @@ #include #include #include -#include -#include -#include #include #include "libudev.h" @@ -260,289 +257,3 @@ int util_resolve_subsys_kernel(struct udev *udev, const char *string, udev_device_unref(dev); return 0; } - -static int run_program_exec(struct udev *udev, int fd_stdout, int fd_stderr, - char *const argv[], char **envp, const sigset_t *sigmask) -{ - int err; - int fd; - - /* discard child output or connect to pipe */ - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDIN_FILENO); - if (fd_stdout < 0) - dup2(fd, STDOUT_FILENO); - if (fd_stderr < 0) - dup2(fd, STDERR_FILENO); - close(fd); - } else { - err(udev, "open /dev/null failed: %m\n"); - } - - /* connect pipes to std{out,err} */ - if (fd_stdout >= 0) { - dup2(fd_stdout, STDOUT_FILENO); - close(fd_stdout); - } - if (fd_stderr >= 0) { - dup2(fd_stderr, STDERR_FILENO); - close(fd_stderr); - } - - /* terminate child in case parent goes away */ - prctl(PR_SET_PDEATHSIG, SIGTERM); - - /* restore original udev sigmask before exec */ - if (sigmask) - sigprocmask(SIG_SETMASK, sigmask, NULL); - - execve(argv[0], argv, envp); - - /* exec failed */ - err = -errno; - if (err == -ENOENT || err == -ENOTDIR) { - /* may be on a filesystem which is not mounted right now */ - info(udev, "program '%s' not found\n", argv[0]); - } else { - /* other problems */ - err(udev, "exec of program '%s' failed\n", argv[0]); - } - return err; -} - -static int run_program_read(struct udev *udev, int fd_stdout, int fd_stderr, - char *const argv[], char *result, size_t ressize, size_t *reslen) -{ - size_t respos = 0; - int fd_ep = -1; - struct epoll_event ep_outpipe; - struct epoll_event ep_errpipe; - int err = 0; - - /* read from child if requested */ - if (fd_stdout < 0 && fd_stderr < 0) - return 0; - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - err = -errno; - err(udev, "error creating epoll fd: %m\n"); - goto out; - } - - if (fd_stdout >= 0) { - memset(&ep_outpipe, 0, sizeof(struct epoll_event)); - ep_outpipe.events = EPOLLIN; - ep_outpipe.data.ptr = &fd_stdout; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - } - - if (fd_stderr >= 0) { - memset(&ep_errpipe, 0, sizeof(struct epoll_event)); - ep_errpipe.events = EPOLLIN; - ep_errpipe.data.ptr = &fd_stderr; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - } - - /* read child output */ - while (fd_stdout >= 0 || fd_stderr >= 0) { - int fdcount; - struct epoll_event ev[4]; - int i; - - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err(udev, "failed to poll: %m\n"); - err = -errno; - goto out; - } - - for (i = 0; i < fdcount; i++) { - int *fd = (int *)ev[i].data.ptr; - - if (ev[i].events & EPOLLIN) { - ssize_t count; - char buf[4096]; - - count = read(*fd, buf, sizeof(buf)-1); - if (count <= 0) - continue; - buf[count] = '\0'; - - /* store stdout result */ - if (result != NULL && *fd == fd_stdout) { - if (respos + count < ressize) { - memcpy(&result[respos], buf, count); - respos += count; - } else { - err(udev, "ressize %zd too short\n", ressize); - err = -ENOBUFS; - } - } - - /* log debug output only if we watch stderr */ - if (fd_stderr >= 0) { - char *pos; - char *line; - - pos = buf; - while ((line = strsep(&pos, "\n"))) { - if (pos != NULL || line[0] != '\0') - info(udev, "'%s'(%s) '%s'\n", argv[0], *fd == fd_stdout ? "out" : "err" , line); - } - } - } else if (ev[i].events & EPOLLHUP) { - if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) { - err = -errno; - err(udev, "failed to remove fd from epoll: %m\n"); - goto out; - } - *fd = -1; - } - } - } - - /* return the child's stdout string */ - if (result != NULL) { - result[respos] = '\0'; - dbg(udev, "result='%s'\n", result); - if (reslen != NULL) - *reslen = respos; - } -out: - if (fd_ep >= 0) - close(fd_ep); - return err; -} - -int util_run_program(struct udev *udev, const char *command, char **envp, - char *result, size_t ressize, size_t *reslen, - const sigset_t *sigmask) -{ - int status; - int outpipe[2] = {-1, -1}; - int errpipe[2] = {-1, -1}; - pid_t pid; - char arg[UTIL_PATH_SIZE]; - char program[UTIL_PATH_SIZE]; - char *argv[((sizeof(arg) + 1) / 2) + 1]; - int i; - int err = 0; - - info(udev, "'%s' started\n", command); - - /* build argv from command */ - util_strscpy(arg, sizeof(arg), command); - i = 0; - if (strchr(arg, ' ') != NULL) { - char *pos = arg; - - while (pos != NULL && pos[0] != '\0') { - if (pos[0] == '\'') { - /* do not separate quotes */ - pos++; - argv[i] = strsep(&pos, "\'"); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } - dbg(udev, "arg[%i] '%s'\n", i, argv[i]); - i++; - } - argv[i] = NULL; - } else { - argv[0] = arg; - argv[1] = NULL; - } - - /* pipes from child to parent */ - if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe2(outpipe, O_NONBLOCK) != 0) { - err = -errno; - err(udev, "pipe failed: %m\n"); - goto out; - } - } - if (udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe2(errpipe, O_NONBLOCK) != 0) { - err = -errno; - err(udev, "pipe failed: %m\n"); - goto out; - } - } - - /* allow programs in /lib/udev/ to be called without the path */ - if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), LIBEXECDIR "/", argv[0], NULL); - argv[0] = program; - } - - pid = fork(); - switch(pid) { - case 0: - /* child closes parent's ends of pipes */ - if (outpipe[READ_END] >= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - } - if (errpipe[READ_END] >= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - } - - err = run_program_exec(udev, outpipe[WRITE_END], errpipe[WRITE_END], argv, envp, sigmask); - - _exit(1); - case -1: - err(udev, "fork of '%s' failed: %m\n", argv[0]); - err = -1; - goto out; - default: - /* parent closed child's ends of pipes */ - if (outpipe[WRITE_END] >= 0) { - close(outpipe[WRITE_END]); - outpipe[WRITE_END] = -1; - } - if (errpipe[WRITE_END] >= 0) { - close(errpipe[WRITE_END]); - errpipe[WRITE_END] = -1; - } - - err = run_program_read(udev, outpipe[READ_END], errpipe[READ_END], argv, result, ressize, reslen); - - waitpid(pid, &status, 0); - if (WIFEXITED(status)) { - info(udev, "'%s' returned with exitcode %i\n", command, WEXITSTATUS(status)); - if (WEXITSTATUS(status) != 0) - err = -1; - } else { - err(udev, "'%s' unexpected exit with status 0x%04x\n", command, status); - err = -1; - } - } - -out: - if (outpipe[READ_END] >= 0) - close(outpipe[READ_END]); - if (outpipe[WRITE_END] >= 0) - close(outpipe[WRITE_END]); - if (errpipe[READ_END] >= 0) - close(errpipe[READ_END]); - if (errpipe[WRITE_END] >= 0) - close(errpipe[WRITE_END]); - return err; -} diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index 51dd017467..48eea0b898 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -557,7 +557,7 @@ uint64_t util_string_bloom64(const char *str) #define USEC_PER_SEC 1000000ULL #define NSEC_PER_USEC 1000ULL -unsigned long long usec_monotonic(void) +unsigned long long now_usec(void) { struct timespec ts; diff --git a/udev/test-udev.c b/udev/test-udev.c index 28c833a9e5..07716897b4 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -23,36 +23,24 @@ #include #include #include -#include #include #include #include +#include #include "udev.h" -static void sig_handler(int signum) -{ - switch (signum) { - case SIGALRM: - _exit(1); - case SIGINT: - case SIGTERM: - _exit(20 + signum); - } -} - int main(int argc, char *argv[]) { struct udev *udev; - struct udev_event *event; - struct udev_device *dev; - struct udev_rules *rules; + struct udev_event *event = NULL; + struct udev_device *dev = NULL; + struct udev_rules *rules = NULL; char syspath[UTIL_PATH_SIZE]; const char *devpath; const char *action; const char *subsystem; - struct sigaction act; - sigset_t mask; + sigset_t mask, sigmask_orig; int err = -EINVAL; udev = udev_new(); @@ -61,22 +49,7 @@ int main(int argc, char *argv[]) info(udev, "version %s\n", VERSION); udev_selinux_init(udev); - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigemptyset(&mask); - sigaddset(&mask, SIGALRM); - sigaddset(&mask, SIGINT); - sigaddset(&mask, SIGTERM); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - - /* trigger timeout to prevent hanging processes */ - alarm(UDEV_EVENT_TIMEOUT); + sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); action = getenv("ACTION"); devpath = getenv("DEVPATH"); @@ -84,7 +57,7 @@ int main(int argc, char *argv[]) if (action == NULL || subsystem == NULL || devpath == NULL) { err(udev, "action, subsystem or devpath missing\n"); - goto exit; + goto out; } rules = udev_rules_new(udev, 1); @@ -93,7 +66,7 @@ int main(int argc, char *argv[]) dev = udev_device_new_from_syspath(udev, syspath); if (dev == NULL) { info(udev, "unknown device '%s'\n", devpath); - goto fail; + goto out; } /* skip reading of db, but read kernel parameters */ @@ -102,20 +75,24 @@ int main(int argc, char *argv[]) udev_device_set_action(dev, action); event = udev_event_new(dev); - err = udev_event_execute_rules(event, rules); - /* rules may change/disable the timeout */ - if (udev_device_get_event_timeout(dev) >= 0) - alarm(udev_device_get_event_timeout(dev)); + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (event->fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + goto out; + } + err = udev_event_execute_rules(event, rules, &sigmask_orig); if (err == 0) udev_event_execute_run(event, NULL); - +out: + if (event != NULL && event->fd_signal >= 0) + close(event->fd_signal); udev_event_unref(event); udev_device_unref(dev); -fail: udev_rules_unref(rules); -exit: udev_selinux_exit(udev); udev_unref(udev); if (err != 0) diff --git a/udev/udev-event.c b/udev/udev-event.c index 60d06aa084..66bf62a246 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -26,7 +26,12 @@ #include #include #include +#include +#include +#include +#include #include +#include #include #include "udev.h" @@ -42,6 +47,9 @@ struct udev_event *udev_event_new(struct udev_device *dev) event->dev = dev; event->udev = udev_device_get_udev(dev); udev_list_init(&event->run_list); + event->fd_signal = -1; + event->birth_usec = now_usec(); + event->timeout_usec = UDEV_EVENT_TIMEOUT_SEC * 1000 * 1000; dbg(event->udev, "allocated event %p\n", event); return event; } @@ -439,6 +447,374 @@ out: return l; } +static int spawn_exec(struct udev_event *event, + const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask, + int fd_stdout, int fd_stderr) +{ + struct udev *udev = event->udev; + int err; + int fd; + + /* discard child output or connect to pipe */ + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + if (fd_stdout < 0) + dup2(fd, STDOUT_FILENO); + if (fd_stderr < 0) + dup2(fd, STDERR_FILENO); + close(fd); + } else { + err(udev, "open /dev/null failed: %m\n"); + } + + /* connect pipes to std{out,err} */ + if (fd_stdout >= 0) { + dup2(fd_stdout, STDOUT_FILENO); + close(fd_stdout); + } + if (fd_stderr >= 0) { + dup2(fd_stderr, STDERR_FILENO); + close(fd_stderr); + } + + /* terminate child in case parent goes away */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + + /* restore original udev sigmask before exec */ + if (sigmask) + sigprocmask(SIG_SETMASK, sigmask, NULL); + + execve(argv[0], argv, envp); + + /* exec failed */ + err = -errno; + err(udev, "exec of program '%s' failed\n", cmd); + return err; +} + +static int spawn_read(struct udev_event *event, + const char *cmd, + int fd_stdout, int fd_stderr, + char *result, size_t ressize) +{ + struct udev *udev = event->udev; + size_t respos = 0; + int fd_ep = -1; + struct epoll_event ep_outpipe, ep_errpipe; + int err = 0; + + /* read from child if requested */ + if (fd_stdout < 0 && fd_stderr < 0) + return 0; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err = -errno; + err(udev, "error creating epoll fd: %m\n"); + goto out; + } + + if (fd_stdout >= 0) { + memset(&ep_outpipe, 0, sizeof(struct epoll_event)); + ep_outpipe.events = EPOLLIN; + ep_outpipe.data.ptr = &fd_stdout; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + if (fd_stderr >= 0) { + memset(&ep_errpipe, 0, sizeof(struct epoll_event)); + ep_errpipe.events = EPOLLIN; + ep_errpipe.data.ptr = &fd_stderr; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + /* read child output */ + while (fd_stdout >= 0 || fd_stderr >= 0) { + int timeout; + int fdcount; + struct epoll_event ev[4]; + int i; + + if (event->timeout_usec > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - event->birth_usec; + if (age_usec >= event->timeout_usec) { + err = -ETIMEDOUT; + err(udev, "timeout '%s'\n", cmd); + goto out; + } + timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + } else { + timeout = -1; + } + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } + if (fdcount == 0) { + err = -ETIMEDOUT; + err(udev, "timeout '%s'\n", cmd); + goto out; + } + + for (i = 0; i < fdcount; i++) { + int *fd = (int *)ev[i].data.ptr; + + if (ev[i].events & EPOLLIN) { + ssize_t count; + char buf[4096]; + + count = read(*fd, buf, sizeof(buf)-1); + if (count <= 0) + continue; + buf[count] = '\0'; + + /* store stdout result */ + if (result != NULL && *fd == fd_stdout) { + if (respos + count < ressize) { + memcpy(&result[respos], buf, count); + respos += count; + } else { + err(udev, "'%s' ressize %zd too short\n", cmd, ressize); + err = -ENOBUFS; + } + } + + /* log debug output only if we watch stderr */ + if (fd_stderr >= 0) { + char *pos; + char *line; + + pos = buf; + while ((line = strsep(&pos, "\n"))) { + if (pos != NULL || line[0] != '\0') + info(udev, "'%s'(%s) '%s'\n", cmd, *fd == fd_stdout ? "out" : "err" , line); + } + } + } else if (ev[i].events & EPOLLHUP) { + if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) { + err = -errno; + err(udev, "failed to remove fd from epoll: %m\n"); + goto out; + } + *fd = -1; + } + } + } + + /* return the child's stdout string */ + if (result != NULL) { + result[respos] = '\0'; + dbg(udev, "result='%s'\n", result); + } +out: + if (fd_ep >= 0) + close(fd_ep); + return err; +} + +static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) +{ + struct udev *udev = event->udev; + struct pollfd pfd[1]; + int err = 0; + + pfd[0].events = POLLIN; + pfd[0].fd = event->fd_signal; + + while (pid > 0) { + int timeout; + int fdcount; + + if (event->timeout_usec > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - event->birth_usec; + if (age_usec >= event->timeout_usec) + timeout = 1000; + else + timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + } else { + timeout = -1; + } + + fdcount = poll(pfd, 1, timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } + if (fdcount == 0) { + err(udev, "timeout: killing '%s'[%u]\n", cmd, pid); + kill(pid, SIGKILL); + } + + if (pfd[0].revents & POLLIN) { + struct signalfd_siginfo fdsi; + int status; + ssize_t size; + + size = read(event->fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size != sizeof(struct signalfd_siginfo)) + continue; + + switch (fdsi.ssi_signo) { + case SIGTERM: + event->sigterm = true; + break; + case SIGCHLD: + if (waitpid(pid, &status, WNOHANG) < 0) + break; + if (WIFEXITED(status)) { + info(udev, "'%s'[%u] returned with exitcode %i\n", cmd, pid, WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + err = -1; + } else { + err(udev, "'%s'[%u] unexpected exit with status 0x%04x\n", cmd, pid, status); + err = -1; + } + pid = 0; + break; + } + } + } +out: + return err; +} + +int udev_event_spawn(struct udev_event *event, + const char *cmd, char **envp, const sigset_t *sigmask, + char *result, size_t ressize) +{ + struct udev *udev = event->udev; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[UTIL_PATH_SIZE]; + char program[UTIL_PATH_SIZE]; + char *argv[((sizeof(arg) + 1) / 2) + 1]; + int i; + int err = 0; + + /* build argv from command */ + util_strscpy(arg, sizeof(arg), cmd); + i = 0; + if (strchr(arg, ' ') != NULL) { + char *pos = arg; + + while (pos != NULL && pos[0] != '\0') { + if (pos[0] == '\'') { + /* do not separate quotes */ + pos++; + argv[i] = strsep(&pos, "\'"); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } + dbg(udev, "arg[%i] '%s'\n", i, argv[i]); + i++; + } + argv[i] = NULL; + } else { + argv[0] = arg; + argv[1] = NULL; + } + + /* pipes from child to parent */ + if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe2(outpipe, O_NONBLOCK) != 0) { + err = -errno; + err(udev, "pipe failed: %m\n"); + goto out; + } + } + if (udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe2(errpipe, O_NONBLOCK) != 0) { + err = -errno; + err(udev, "pipe failed: %m\n"); + goto out; + } + } + + /* allow programs in /lib/udev/ to be called without the path */ + if (argv[0][0] != '/') { + util_strscpyl(program, sizeof(program), LIBEXECDIR "/", argv[0], NULL); + argv[0] = program; + } + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent's ends of pipes */ + if (outpipe[READ_END] >= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + } + if (errpipe[READ_END] >= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + } + + info(udev, "starting '%s'\n", cmd); + + err = spawn_exec(event, cmd, argv, envp, sigmask, + outpipe[WRITE_END], errpipe[WRITE_END]); + + _exit(2 ); + case -1: + err(udev, "fork of '%s' failed: %m\n", cmd); + err = -1; + goto out; + default: + /* parent closed child's ends of pipes */ + if (outpipe[WRITE_END] >= 0) { + close(outpipe[WRITE_END]); + outpipe[WRITE_END] = -1; + } + if (errpipe[WRITE_END] >= 0) { + close(errpipe[WRITE_END]); + errpipe[WRITE_END] = -1; + } + + err = spawn_read(event, cmd, + outpipe[READ_END], errpipe[READ_END], + result, ressize); + + err = spawn_wait(event, cmd, pid); + } + +out: + if (outpipe[READ_END] >= 0) + close(outpipe[READ_END]); + if (outpipe[WRITE_END] >= 0) + close(outpipe[WRITE_END]); + if (errpipe[READ_END] >= 0) + close(errpipe[READ_END]); + if (errpipe[WRITE_END] >= 0) + close(errpipe[WRITE_END]); + return err; +} + static void rename_netif_kernel_log(struct ifreq ifr) { int klog; @@ -530,7 +906,7 @@ out: return err; } -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) +int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) { struct udev_device *dev = event->dev; int err = 0; @@ -546,7 +922,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (major(udev_device_get_devnum(dev)) != 0) udev_watch_end(event->udev, dev); - udev_rules_apply_to_event(rules, event); + udev_rules_apply_to_event(rules, event, sigmask); if (major(udev_device_get_devnum(dev)) != 0) err = udev_node_remove(dev); @@ -561,7 +937,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) udev_watch_end(event->udev, event->dev_db); } - udev_rules_apply_to_event(rules, event); + udev_rules_apply_to_event(rules, event, sigmask); /* rename a new network interface, if needed */ if (udev_device_get_ifindex(dev) > 0 && strcmp(udev_device_get_action(dev), "add") == 0 && @@ -647,7 +1023,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules) if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0) udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db)); else - udev_device_set_usec_initialized(event->dev, usec_monotonic()); + udev_device_set_usec_initialized(event->dev, now_usec()); /* (re)write database file */ udev_device_update_db(dev); @@ -682,13 +1058,14 @@ int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) char program[UTIL_PATH_SIZE]; char **envp; - udev_event_apply_format(event, cmd, program, sizeof(program)); - envp = udev_device_get_properties_envp(event->dev); if (event->exec_delay > 0) { info(event->udev, "delay execution of '%s'\n", program); sleep(event->exec_delay); } - if (util_run_program(event->udev, program, envp, NULL, 0, NULL, sigmask) != 0) { + + udev_event_apply_format(event, cmd, program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + if (udev_event_spawn(event, program, envp, sigmask, NULL, 0) < 0) { if (udev_list_entry_get_flags(list_entry)) err = -1; } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 84513328e7..a786bfb14f 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -139,6 +139,7 @@ enum token_type { TK_M_PARENTS_MAX, TK_M_TEST, /* val, mode_t */ + TK_M_EVENT_TIMEOUT, /* int */ TK_M_PROGRAM, /* val */ TK_M_IMPORT_FILE, /* val */ TK_M_IMPORT_PROG, /* val */ @@ -164,7 +165,6 @@ enum token_type { TK_A_TAG, /* val */ TK_A_NAME, /* val */ TK_A_DEVLINK, /* val */ - TK_A_EVENT_TIMEOUT, /* int */ TK_A_ATTR, /* val, attr */ TK_A_RUN, /* val, bool */ TK_A_GOTO, /* size_t */ @@ -274,6 +274,7 @@ static const char *token_str(enum token_type type) [TK_M_PARENTS_MAX] = "M PARENTS_MAX", [TK_M_TEST] = "M TEST", + [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", [TK_M_PROGRAM] = "M PROGRAM", [TK_M_IMPORT_FILE] = "M IMPORT_FILE", [TK_M_IMPORT_PROG] = "M IMPORT_PROG", @@ -299,7 +300,6 @@ static const char *token_str(enum token_type type) [TK_A_TAG] = "A ENV", [TK_A_NAME] = "A NAME", [TK_A_DEVLINK] = "A DEVLINK", - [TK_A_EVENT_TIMEOUT] = "A EVENT_TIMEOUT", [TK_A_ATTR] = "A ATTR", [TK_A_RUN] = "A RUN", [TK_A_GOTO] = "A GOTO", @@ -397,7 +397,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_A_STATIC_NODE: dbg(rules->udev, "%s '%s'\n", token_str(type), value); break; - case TK_A_EVENT_TIMEOUT: + case TK_M_EVENT_TIMEOUT: dbg(rules->udev, "%s %u\n", token_str(type), token->key.event_timeout); break; case TK_A_GOTO: @@ -750,17 +750,18 @@ static int import_file_into_properties(struct udev_device *dev, const char *file return 0; } -static int import_program_into_properties(struct udev_device *dev, const char *program) +static int import_program_into_properties(struct udev_event *event, const char *program, const sigset_t *sigmask) { - struct udev *udev = udev_device_get_udev(dev); + struct udev_device *dev = event->dev; char **envp; char result[UTIL_LINE_SIZE]; - size_t reslen; char *line; + int err; envp = udev_device_get_properties_envp(dev); - if (util_run_program(udev, program, envp, result, sizeof(result), &reslen, NULL) != 0) - return -1; + err = udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)); + if (err < 0) + return err; line = result; while (line != NULL) { @@ -1070,7 +1071,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_STATIC_NODE: token->key.value_off = add_string(rule_tmp->rules, value); break; - case TK_A_EVENT_TIMEOUT: + case TK_M_EVENT_TIMEOUT: token->key.event_timeout = *(int *)data; break; case TK_RULE: @@ -1581,7 +1582,7 @@ static int add_rule(struct udev_rules *rules, char *line, if (pos != NULL) { int tout = atoi(&pos[strlen("event_timeout=")]); - rule_add_key(&rule_tmp, TK_A_EVENT_TIMEOUT, op, NULL, &tout); + rule_add_key(&rule_tmp, TK_M_EVENT_TIMEOUT, op, NULL, &tout); dbg(rules->udev, "event timeout=%i\n", tout); } @@ -2081,7 +2082,7 @@ enum escape_type { ESCAPE_REPLACE, }; -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event) +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask) { struct token *cur; struct token *rule; @@ -2283,6 +2284,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event goto nomatch; break; } + case TK_M_EVENT_TIMEOUT: + info(event->udev, "OPTIONS event_timeout=%u\n", cur->key.event_timeout); + event->timeout_usec = cur->key.event_timeout * 1000 * 1000; + break; case TK_M_PROGRAM: { char program[UTIL_PATH_SIZE]; @@ -2297,7 +2302,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event program, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - if (util_run_program(event->udev, program, envp, result, sizeof(result), NULL, NULL) != 0) { + + if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { if (cur->key.op != OP_NOMATCH) goto nomatch; } else { @@ -2335,7 +2341,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event import, &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - if (import_program_into_properties(event->dev, import) != 0) + + if (import_program_into_properties(event, import, sigmask) != 0) if (cur->key.op != OP_NOMATCH) goto nomatch; break; @@ -2617,9 +2624,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event } } break; - case TK_A_EVENT_TIMEOUT: - udev_device_set_event_timeout(event->dev, cur->key.event_timeout); - break; case TK_A_ATTR: { const char *key_name = &rules->buf[cur->key.attr_off]; diff --git a/udev/udev.h b/udev/udev.h index 6833e60d61..0baca1fa43 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -26,8 +26,7 @@ #include "libudev.h" #include "libudev-private.h" -#define DEFAULT_FAKE_PARTITIONS_COUNT 15 -#define UDEV_EVENT_TIMEOUT 180 +#define UDEV_EVENT_TIMEOUT_SEC 120 #define UDEV_CTRL_SOCK_PATH "@/org/kernel/udev/udevd" @@ -44,6 +43,10 @@ struct udev_event { gid_t gid; struct udev_list_node run_list; int exec_delay; + unsigned long long birth_usec; + unsigned long long timeout_usec; + int fd_signal; + bool sigterm; bool inotify_watch; bool inotify_watch_final; bool group_final; @@ -64,17 +67,20 @@ struct udev_watch { struct udev_rules; struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); void udev_rules_unref(struct udev_rules *rules); -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event); +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask); void udev_rules_apply_static_dev_perms(struct udev_rules *rules); /* udev-event.c */ struct udev_event *udev_event_new(struct udev_device *dev); void udev_event_unref(struct udev_event *event); -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules); -int udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size); int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, char *result, size_t maxsize, int read_value); +int udev_event_spawn(struct udev_event *event, + const char *cmd, char **envp, const sigset_t *sigmask, + char *result, size_t ressize); +int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); +int udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); /* udev-watch.c */ int udev_watch_init(struct udev *udev); diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index 4137ce91fa..bb7a0fd8a1 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -27,23 +27,27 @@ #include #include #include +#include #include "udev.h" int udevadm_test(struct udev *udev, int argc, char *argv[]) { + int resolve_names = 1; char filename[UTIL_PATH_SIZE]; const char *action = "add"; const char *syspath = NULL; - struct udev_event *event; - struct udev_device *dev; + struct udev_event *event = NULL; + struct udev_device *dev = NULL; struct udev_rules *rules = NULL; struct udev_list_entry *entry; + sigset_t mask, sigmask_orig; int err; int rc = 0; static const struct option options[] = { { "action", required_argument, NULL, 'a' }, + { "resolve-names", required_argument, NULL, 'N' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -53,7 +57,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) for (;;) { int option; - option = getopt_long(argc, argv, "a:s:fh", options, NULL); + option = getopt_long(argc, argv, "a:s:N:fh", options, NULL); if (option == -1) break; @@ -62,21 +66,34 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) case 'a': action = optarg; break; + case 'N': + if (strcmp (optarg, "early") == 0) { + resolve_names = 1; + } else if (strcmp (optarg, "late") == 0) { + resolve_names = 0; + } else if (strcmp (optarg, "never") == 0) { + resolve_names = -1; + } else { + fprintf(stderr, "resolve-names must be early, late or never\n"); + err(udev, "resolve-names must be early, late or never\n"); + exit(EXIT_FAILURE); + } + break; case 'h': printf("Usage: udevadm test OPTIONS \n" " --action= set action string\n" " --help\n\n"); - exit(0); + exit(EXIT_SUCCESS); default: - exit(1); + exit(EXIT_FAILURE); } } syspath = argv[optind]; if (syspath == NULL) { fprintf(stderr, "syspath parameter missing\n"); - rc = 1; - goto exit; + rc = 2; + goto out; } printf("This program is for debugging only, it does not run any program,\n" @@ -84,11 +101,13 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) "some values may be different, or not available at a simulation run.\n" "\n"); - rules = udev_rules_new(udev, 1); + sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); + + rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { fprintf(stderr, "error reading rules\n"); - rc = 1; - goto exit; + rc = 3; + goto out; } /* add /sys if needed */ @@ -101,8 +120,8 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) dev = udev_device_new_from_syspath(udev, filename); if (dev == NULL) { fprintf(stderr, "unable to open device '%s'\n", filename); - rc = 2; - goto exit; + rc = 4; + goto out; } /* skip reading of db, but read kernel parameters */ @@ -111,24 +130,34 @@ int udevadm_test(struct udev *udev, int argc, char *argv[]) udev_device_set_action(dev, action); event = udev_event_new(dev); - err = udev_event_execute_rules(event, rules); - if (udev_device_get_event_timeout(dev) >= 0) - printf("custom event timeout: %i\n", udev_device_get_event_timeout(dev)); + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (event->fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + rc = 5; + goto out; + } + + err = udev_event_execute_rules(event, rules, &sigmask_orig); udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); - if (err == 0) + if (err == 0) { udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { char program[UTIL_PATH_SIZE]; udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); printf("run: '%s'\n", program); } + } +out: + if (event != NULL && event->fd_signal >= 0) + close(event->fd_signal); udev_event_unref(event); udev_device_unref(dev); -exit: udev_rules_unref(rules); return rc; } diff --git a/udev/udevd.c b/udev/udevd.c index f730cab484..414f0dbbb5 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -81,7 +81,7 @@ static bool reload_config; static int children; static int children_max; static int exec_delay; -static sigset_t orig_sigmask; +static sigset_t sigmask_orig; static UDEV_LIST(event_list); static UDEV_LIST(worker_list); static bool udev_exit; @@ -286,9 +286,9 @@ static void worker_new(struct event *event) for (;;) { struct udev_event *udev_event; - struct worker_message msg = {}; - int err; + struct worker_message msg; int failed = 0; + int err; info(udev, "seq %llu running\n", udev_device_get_seqnum(dev)); udev_event = udev_event_new(dev); @@ -297,23 +297,17 @@ static void worker_new(struct event *event) goto out; } - /* set timeout to prevent hanging processes */ - alarm(UDEV_EVENT_TIMEOUT); + /* needed for SIGCHLD/SIGTERM in spawn() */ + udev_event->fd_signal = fd_signal; if (exec_delay > 0) udev_event->exec_delay = exec_delay; /* apply rules, create node, symlinks */ - err = udev_event_execute_rules(udev_event, rules); - - /* rules may change/disable the timeout */ - if (udev_device_get_event_timeout(dev) >= 0) - alarm(udev_device_get_event_timeout(dev)); + err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); if (err == 0) - failed = udev_event_execute_run(udev_event, &orig_sigmask); - - alarm(0); + failed = udev_event_execute_run(udev_event, &sigmask_orig); /* apply/restore inotify watch */ if (err == 0 && udev_event->inotify_watch) { @@ -325,6 +319,7 @@ static void worker_new(struct event *event) udev_monitor_send_device(worker_monitor, NULL, dev); /* send udevd the result of the event execution */ + memset(&msg, 0, sizeof(struct worker_message)); if (err != 0) msg.exitcode = err; else if (failed != 0) @@ -333,10 +328,17 @@ static void worker_new(struct event *event) send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); info(udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); - udev_event_unref(udev_event); + udev_device_unref(dev); dev = NULL; + if (udev_event->sigterm) { + udev_event_unref(udev_event); + goto out; + } + + udev_event_unref(udev_event); + /* wait for more device messages from main udevd, or term signal */ while (dev == NULL) { struct epoll_event ev[4]; @@ -344,8 +346,13 @@ static void worker_new(struct event *event) int i; fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); - if (fdcount < 0) - continue; + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } for (i = 0; i < fdcount; i++) { if (ev[i].data.fd == fd_monitor && ev[i].events & EPOLLIN) { @@ -1478,7 +1485,7 @@ int main(int argc, char *argv[]) /* block and listen to all signals on signalfd */ sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, &orig_sigmask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); if (fd_signal < 0) { fprintf(stderr, "error creating signalfd\n"); -- cgit v1.2.3-54-g00ecf From ead7c62ab7641e150c6d668f939c102a6771ce60 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Apr 2011 02:18:22 +0200 Subject: udevadm: settle - kill alarm() --- TODO | 2 -- udev/udev-event.c | 2 +- udev/udev.h | 2 -- udev/udevadm-settle.c | 76 ++++++++++++++++++--------------------------------- 4 files changed, 27 insertions(+), 55 deletions(-) diff --git a/TODO b/TODO index 34907d70d9..6bcec816c8 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - - kill alarm() - - empty rules files and link to /dev/null are ok - rename netif with ifindex not devname diff --git a/udev/udev-event.c b/udev/udev-event.c index 66bf62a246..e583cec292 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -49,7 +49,7 @@ struct udev_event *udev_event_new(struct udev_device *dev) udev_list_init(&event->run_list); event->fd_signal = -1; event->birth_usec = now_usec(); - event->timeout_usec = UDEV_EVENT_TIMEOUT_SEC * 1000 * 1000; + event->timeout_usec = 120 * 1000 * 1000; dbg(event->udev, "allocated event %p\n", event); return event; } diff --git a/udev/udev.h b/udev/udev.h index 0baca1fa43..16a029e486 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -26,8 +26,6 @@ #include "libudev.h" #include "libudev-private.h" -#define UDEV_EVENT_TIMEOUT_SEC 120 - #define UDEV_CTRL_SOCK_PATH "@/org/kernel/udev/udevd" struct udev_event { diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 38cb4f4968..afd4af5f4b 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -36,16 +36,6 @@ #include "udev.h" -static volatile sig_atomic_t is_timeout; - -static void sig_handler(int signum) -{ - switch (signum) { - case SIGALRM: - is_timeout = 1; - } -} - int udevadm_settle(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { @@ -57,29 +47,18 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) { "help", no_argument, NULL, 'h' }, {} }; + unsigned long long start_usec = now_usec(); unsigned long long start = 0; unsigned long long end = 0; int quiet = 0; const char *exists = NULL; - int timeout = 180; + unsigned int timeout = 180; struct pollfd pfd[1]; - struct sigaction act; - sigset_t mask; struct udev_queue *udev_queue = NULL; - int rc = 1; + int rc = EXIT_FAILURE; dbg(udev, "version %s\n", VERSION); - /* set signal handlers */ - memset(&act, 0x00, sizeof(act)); - act.sa_handler = sig_handler; - sigemptyset (&act.sa_mask); - act.sa_flags = 0; - sigaction(SIGALRM, &act, NULL); - sigemptyset(&mask); - sigaddset(&mask, SIGALRM); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - for (;;) { int option; int seconds; @@ -121,11 +100,6 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } } - if (timeout > 0) - alarm(timeout); - else - is_timeout = 1; - udev_queue = udev_queue_new(udev); if (udev_queue == NULL) exit(2); @@ -167,7 +141,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (udev_ctrl_send_ping(uctrl, timeout) < 0) { info(udev, "no connection to daemon\n"); udev_ctrl_unref(uctrl); - rc = 0; + rc = EXIT_SUCCESS; goto out; } udev_ctrl_unref(uctrl); @@ -188,30 +162,26 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) for (;;) { struct stat statbuf; - const struct timespec duration = { 1 , 0 }; if (exists != NULL && stat(exists, &statbuf) == 0) { - rc = 0; + rc = EXIT_SUCCESS; break; } if (start > 0) { /* if asked for, wait for a specific sequence of events */ if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) { - rc = 0; + rc = EXIT_SUCCESS; break; } } else { /* exit if queue is empty */ if (udev_queue_get_queue_is_empty(udev_queue)) { - rc = 0; + rc = EXIT_SUCCESS; break; } } - if (is_timeout) - break; - if (pfd[0].fd >= 0) { /* wake up once every second, or whenever the queue file gets gets closed */ if (poll(pfd, 1, 1000) > 0 && pfd[0].revents & POLLIN) { @@ -220,21 +190,27 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) read(pfd[0].fd, buf, sizeof(buf)); } } else { - nanosleep(&duration, NULL); + sleep(1); } - } - /* if we reached the timeout, print the list of remaining events */ - if (is_timeout) { - struct udev_list_entry *list_entry; - - if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) { - info(udev, "timeout waiting for udev queue\n"); - printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf(" %s (%s)\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); + if (timeout > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - start_usec; + if (age_usec / (1000 * 1000) >= timeout) { + struct udev_list_entry *list_entry; + + if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) { + info(udev, "timeout waiting for udev queue\n"); + printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf(" %s (%s)\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + + break; + } } } out: -- cgit v1.2.3-54-g00ecf From 5e8176e1569de2469321f63aee1765e51bc5ded0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Apr 2011 17:30:30 +0200 Subject: udevd: netif rename - use ifindex for temporary name --- TODO | 2 -- udev/udev-event.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/TODO b/TODO index 6bcec816c8..0ecc9c1506 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,5 @@ - empty rules files and link to /dev/null are ok - - rename netif with ifindex not devname - - kill tabs? - remove deprecated trigger --type=failed logic diff --git a/udev/udev-event.c b/udev/udev-event.c index e583cec292..dfd5c37857 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -868,7 +868,7 @@ static int rename_netif(struct udev_event *event) goto out; /* free our own name, another process may wait for us */ - util_strscpyl(ifr.ifr_newname, IFNAMSIZ, udev_device_get_sysname(dev), "-", event->name, NULL); + snprintf(ifr.ifr_newname, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev)); err = ioctl(sk, SIOCSIFNAME, &ifr); if (err < 0) { err = -errno; -- cgit v1.2.3-54-g00ecf From dff107dc1a12538d351798d43191ae5d07d3c6d6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Apr 2011 17:39:44 +0200 Subject: udevd: always use udevd[] log prefix --- udev/udev-event.c | 2 +- udev/udevd.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index dfd5c37857..a8dfff48bf 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -830,7 +830,7 @@ static void rename_netif_kernel_log(struct ifreq ifr) return; } - fprintf(f, "<30>udev[%u]: renamed network interface %s to %s\n", + fprintf(f, "<30>udevd[%u]: renamed network interface %s to %s\n", getpid(), ifr.ifr_name, ifr.ifr_newname); fclose(f); } diff --git a/udev/udevd.c b/udev/udevd.c index 414f0dbbb5..b8513e11fe 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -247,8 +247,6 @@ static void worker_new(struct event *event) close(fd_signal); close(fd_ep); close(worker_watch[READ_END]); - udev_log_close(); - udev_log_init("udevd-work"); sigfillset(&mask); fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); @@ -1061,7 +1059,7 @@ static int convert_db(struct udev *udev) f = fopen("/dev/kmsg", "w"); if (f != NULL) { - fprintf(f, "<30>udev[%u]: converting old udev database\n", getpid()); + fprintf(f, "<30>udevd[%u]: converting old udev database\n", getpid()); fclose(f); } @@ -1436,7 +1434,7 @@ int main(int argc, char *argv[]) f = fopen("/dev/kmsg", "w"); if (f != NULL) { - fprintf(f, "<30>udev[%u]: starting version " VERSION "\n", getpid()); + fprintf(f, "<30>udevd[%u]: starting version " VERSION "\n", getpid()); fclose(f); } -- cgit v1.2.3-54-g00ecf From a178e7fe90c5f9a4f9f196575102ab6812bb5973 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Apr 2011 17:58:58 +0200 Subject: udevd: rules files - accept empty or /dev/null links --- TODO | 2 -- udev/udev-rules.c | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 0ecc9c1506..54b0fe5286 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - - empty rules files and link to /dev/null are ok - - kill tabs? - remove deprecated trigger --type=failed logic diff --git a/udev/udev-rules.c b/udev/udev-rules.c index a786bfb14f..d38c9ff4ff 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1760,7 +1760,6 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { struct udev_rules *rules; - struct stat statbuf; struct udev_list_node file_list; struct udev_list_entry *file_loop, *file_tmp; struct token end_token; @@ -1877,11 +1876,21 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { const char *filename = udev_list_entry_get_name(file_loop); unsigned int filename_off = udev_list_entry_get_flags(file_loop); + struct stat st; - if (stat(filename, &statbuf) == 0 && statbuf.st_size > 0) - parse_file(rules, filename, filename_off); - else - err(udev, "can not read '%s'\n", filename); + if (stat(filename, &st) != 0) { + err(udev, "can not find '%s': %m\n", filename); + continue; + } + if (S_ISREG(st.st_mode) && st.st_size <= 0) { + info(udev, "ignore empty '%s'\n", filename); + continue; + } + if (S_ISCHR(st.st_mode)) { + info(udev, "ignore masked '%s'\n", filename); + continue; + } + parse_file(rules, filename, filename_off); udev_list_entry_delete(file_loop); } -- cgit v1.2.3-54-g00ecf From c7be212dbd21bca5ec041697109c63c6277d5425 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Apr 2011 18:36:01 +0200 Subject: udevd: log signal number when spawned processes fail --- udev/udev-event.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udev/udev-event.c b/udev/udev-event.c index a8dfff48bf..ef21ce8f6b 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -684,6 +684,9 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) info(udev, "'%s'[%u] returned with exitcode %i\n", cmd, pid, WEXITSTATUS(status)); if (WEXITSTATUS(status) != 0) err = -1; + } else if (WIFSIGNALED(status)) { + err(udev, "'%s'[%u] terminated by signal %i\n", cmd, pid, WTERMSIG(status)); + err = -1; } else { err(udev, "'%s'[%u] unexpected exit with status 0x%04x\n", cmd, pid, status); err = -1; -- cgit v1.2.3-54-g00ecf From 00f34bc435f51decab266f2e9a7be223df15c87e Mon Sep 17 00:00:00 2001 From: Michael Reed Date: Wed, 20 Apr 2011 20:25:16 +0200 Subject: path_id: rework SAS device handling Lun numbers < 256 are displayed as "lun-x". Lun numbers >= 256 use the lun number format previously used in fibre channel by-path links, 0xabcd012300000000. This lun numbering scheme is implemented for sas, fibre channel, iscsi. I want it to be clearly understood that this patch changes the /dev/disk/by-path names for fc devices. Here is an example of the change: Old: pci-0000:0c:00.1-fc-0x204700a0b81130aa:0x00fa000000000000 New: pci-0000:0c:00.1-fc-0x204700a0b81130aa-lun-250 --- extras/path_id/path_id.c | 63 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 5 deletions(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 518ec8b386..62d26d8c4d 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -75,6 +75,21 @@ static int path_prepend(char **path, const char *fmt, ...) return 0; } +/* +** Linux only supports 32 bit luns. +** See drivers/scsi/scsi_scan.c::scsilun_to_int() for more details. +*/ +static int format_lun_number(struct udev_device *dev, char **path) +{ + unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10); + + /* address method 0, peripheral device addressing with bus id of zero */ + if (lun < 256) + return path_prepend(path, "lun-%d", lun); + /* handle all other lun addressing methods by using a variant of the original lun format */ + return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff); +} + static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) { struct udev_device *parent = dev; @@ -97,7 +112,7 @@ static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, struct udev_device *targetdev; struct udev_device *fcdev = NULL; const char *port; - unsigned int lun; + char *lun = NULL;; targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); if (targetdev == NULL) @@ -112,8 +127,10 @@ static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, goto out; } - lun = strtoul(udev_device_get_sysnum(parent), NULL, 10); - path_prepend(path, "fc-%s:0x%04x%04x00000000", port, lun & 0xffff, (lun >> 16) & 0xffff); + format_lun_number(parent, &lun); + path_prepend(path, "fc-%s-%s", port, lun); + if (lun) + free(lun); out: udev_device_unref(fcdev); return parent; @@ -121,7 +138,39 @@ out: static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) { - return NULL; + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *targetdev; + struct udev_device *target_parent; + struct udev_device *sasdev; + const char *sas_address; + char *lun = NULL; + + targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); + if (targetdev == NULL) + return NULL; + + target_parent = udev_device_get_parent(targetdev); + if (target_parent == NULL) + return NULL; + + sasdev = udev_device_new_from_subsystem_sysname(udev, "sas_device", + udev_device_get_sysname(target_parent)); + if (sasdev == NULL) + return NULL; + + sas_address = udev_device_get_sysattr_value(sasdev, "sas_address"); + if (sas_address == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "sas-%s-%s", sas_address, lun); + if (lun) + free(lun); +out: + udev_device_unref(sasdev); + return parent; } static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) @@ -134,6 +183,7 @@ static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char ** struct udev_device *conndev = NULL; const char *addr; const char *port; + char *lun = NULL; /* find iscsi session */ transportdev = parent; @@ -172,7 +222,10 @@ static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char ** goto out; } - path_prepend(path, "ip-%s:%s-iscsi-%s-lun-%s", addr, port, target, udev_device_get_sysnum(parent)); + format_lun_number(parent, &lun); + path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun); + if (lun) + free(lun); out: udev_device_unref(sessiondev); udev_device_unref(conndev); -- cgit v1.2.3-54-g00ecf From 86d8ed2628ba3b60323a576cc4d2c86ba15779cf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Apr 2011 01:13:28 +0200 Subject: systemd: Reqires= -> Wants=udev.socket --- init/udev.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/udev.service.in b/init/udev.service.in index 117f5c8fd5..e85974a575 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -1,6 +1,6 @@ [Unit] Description=udev Kernel Device Manager -Requires=udev.socket +Wants=udev.socket After=udev.socket Before=basic.target DefaultDependencies=no -- cgit v1.2.3-54-g00ecf From b466e9ab3951207a3c0c8d2ba6167be1eac1e41a Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 21 Apr 2011 10:06:12 +0200 Subject: udevd: clarify worker exit status --- udev/udevd.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index b8513e11fe..0e73f81069 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -812,7 +812,16 @@ static void handle_signal(struct udev *udev, int signo) info(udev, "worker [%u] exit\n", pid); if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - err(udev, "worker [%u] unexpectedly returned with status 0x%04x\n", pid, status); + if (WEXITSTATUS(status)) + err(udev, "worker [%u] unexpectedly returned with status %d\n", pid, WEXITSTATUS(status)); + else if (WIFSIGNALED(status)) + err(udev, "worker [%u] killed by signal %d (%s)\n", pid, + WTERMSIG(status), strsignal(WTERMSIG(status))); + else if (WIFSTOPPED(status)) + err(udev, "worker [%u] unexpectedly stopped\n", pid); + else if (WIFCONTINUED(status)) + err(udev, "worker [%u] continued\n", pid); + if (worker->event != NULL) { err(udev, "worker [%u] failed while handling '%s'\n", pid, worker->event->devpath); worker->event->exitcode = -32; -- cgit v1.2.3-54-g00ecf From a95f038521d31e0158fc4115651d035e7482e1a2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 21 Apr 2011 14:05:34 +0200 Subject: udevd, udev-event: sync waitpid() error handling --- NEWS | 3 ++- udev/udev-event.c | 14 ++++++++++---- udev/udevd.c | 31 ++++++++++++++++++------------- 3 files changed, 30 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 27be44c5a8..89b5b9c39a 100644 --- a/NEWS +++ b/NEWS @@ -2,11 +2,12 @@ udev 168 ======== Bugfixes. -warning if /run is not writable. +warning if /run is not writable udevadm control --exit udevadm info --cleanup-db +if used, OPTIONS+="db_persist" needed for LVM systemd netlink socket activation stop socket or mask on rpm update diff --git a/udev/udev-event.c b/udev/udev-event.c index ef21ce8f6b..4af3e08f60 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -660,7 +660,7 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) goto out; } if (fdcount == 0) { - err(udev, "timeout: killing '%s'[%u]\n", cmd, pid); + err(udev, "timeout: killing '%s' [%u]\n", cmd, pid); kill(pid, SIGKILL); } @@ -681,14 +681,20 @@ static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) if (waitpid(pid, &status, WNOHANG) < 0) break; if (WIFEXITED(status)) { - info(udev, "'%s'[%u] returned with exitcode %i\n", cmd, pid, WEXITSTATUS(status)); + info(udev, "'%s' [%u] exit with return code %i\n", cmd, pid, WEXITSTATUS(status)); if (WEXITSTATUS(status) != 0) err = -1; } else if (WIFSIGNALED(status)) { - err(udev, "'%s'[%u] terminated by signal %i\n", cmd, pid, WTERMSIG(status)); + err(udev, "'%s' [%u] terminated by signal %i (%s)\n", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status))); + err = -1; + } else if (WIFSTOPPED(status)) { + err(udev, "'%s' [%u] stopped\n", cmd, pid); + err = -1; + } else if (WIFCONTINUED(status)) { + err(udev, "'%s' [%u] continued\n", cmd, pid); err = -1; } else { - err(udev, "'%s'[%u] unexpected exit with status 0x%04x\n", cmd, pid, status); + err(udev, "'%s' [%u] exit with status 0x%04x\n", cmd, pid, status); err = -1; } pid = 0; diff --git a/udev/udevd.c b/udev/udevd.c index 0e73f81069..be4b071ebb 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -809,24 +809,29 @@ static void handle_signal(struct udev *udev, int signo) if (worker->pid != pid) continue; - info(udev, "worker [%u] exit\n", pid); - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - if (WEXITSTATUS(status)) - err(udev, "worker [%u] unexpectedly returned with status %d\n", pid, WEXITSTATUS(status)); - else if (WIFSIGNALED(status)) - err(udev, "worker [%u] killed by signal %d (%s)\n", pid, - WTERMSIG(status), strsignal(WTERMSIG(status))); - else if (WIFSTOPPED(status)) - err(udev, "worker [%u] unexpectedly stopped\n", pid); - else if (WIFCONTINUED(status)) - err(udev, "worker [%u] continued\n", pid); + if (WIFEXITED(status)) { + if (WEXITSTATUS(status) != 0) + err(udev, "worker [%u] exit with return code %i\n", pid, WEXITSTATUS(status)); + } else if (WIFSIGNALED(status)) { + err(udev, "worker [%u] terminated by signal %i (%s)\n", + pid, WTERMSIG(status), strsignal(WTERMSIG(status))); + } else if (WIFSTOPPED(status)) { + err(udev, "worker [%u] stopped\n", pid); + } else if (WIFCONTINUED(status)) { + err(udev, "worker [%u] continued\n", pid); + } else { + err(udev, "worker [%u] exit with status 0x%04x\n", pid, status); + } + + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { if (worker->event != NULL) { - err(udev, "worker [%u] failed while handling '%s'\n", pid, worker->event->devpath); + err(udev, "worker [%u] failed while handling '%s'\n", + pid, worker->event->devpath); worker->event->exitcode = -32; event_queue_delete(worker->event, true); - /* drop reference from running event */ + /* drop reference taken for state 'running' */ worker_unref(worker); } } -- cgit v1.2.3-54-g00ecf From c1810751a2963dce5d52261273d65f06bf832792 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 22 Apr 2011 18:29:05 +0200 Subject: release 168 --- ChangeLog | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 40 +++++++++++++++++++++---------- TODO | 2 ++ 3 files changed, 111 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index d62ecbd76e..ed80c4e43c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,84 @@ +Summary of changes from v167 to v168 +============================================ + +David Zeuthen (1): + Run ata_id on non-removable USB devices + +Harald Hoyer (1): + udevd: clarify worker exit status + +Kay Sievers (35): + version bump + systemd: let settle depend on trigger, do not block basic with trigger + selinux: do not label files in runtime dir + selinux: firmware - do not label files in runtime dir + udevadm: control - add --exit + trivial cleanups + udevd: log warning if /run is not writable + libudev: ctrl - fix refcounting in connection handling + udevadm: settle - watch queue file + libudev: bump revision + udevadm: info --cleanup-db + udevd: do not nice processes + "db_persist=" -> "db_persist" + udevd: move OOM disable into --daemon option + systemd: add OOMScoreAdjust=-1000 + require explicit "db_persist" to exclude device info from --db-cleanup + udevd: get netlink socket from systemd + fix more warnings + libudev: ctrl, monitor - use SOCK_NONBLOCK + systemd: socket -> sockets + udevadm: monitor - use epoll + libudev: test - use epoll + udevadm: test - use printf() instead of info() for non-debug output + use 'else if' in epoll event array loop + libudev: run_program() - select() -> epoll + udevd: ppoll() -> epoll + signalfd + Merge branch 'docs/README' of git://github.com/mfwitten/udev + timeout handling without alarm() + udevadm: settle - kill alarm() + udevd: netif rename - use ifindex for temporary name + udevd: always use udevd[] log prefix + udevd: rules files - accept empty or /dev/null links + udevd: log signal number when spawned processes fail + systemd: Reqires= -> Wants=udev.socket + udevd, udev-event: sync waitpid() error handling + +Lee, Chun-Yi (1): + Add rule for Acer Aspire One ZG8 to use acer-aspire_5720 keymap + +Leonid Antonenkov (1): + rule-generator: net - ignore Hyper-V virtual interfaces + +Martin Pitt (3): + Revert "Do not build extras with --disable-extras" + Avoid spinning up CD on pressing eject button + keymap: Another ID for Logitech Wave keyboard + +Michael Reed (1): + path_id: rework SAS device handling + +Michael Witten (12): + Docs: README: `to replace' -> `replacing' + Docs: README: `,' -> `;' + Docs: README: Clean up a sentence + Docs: README: Use present tense + Docs: README: Add missing `and' + Docs: README: Remove commas and use subjective mood + Docs: README: Clean up `udev extras' requirements + Docs: README: Clarify configuration of existing devices + Docs: README: `does never apply' -> `never applies' + Docs: README: Flip sentence structure to improve wording + Docs: README: `set up' is the verb; `setup' is a noun + Docs: README: Add a comma to offset the modifier + +Seth Forshee (1): + keymap: Support Dell Latitude XT2 tablet-mode navigation keys + +Thomas Egerer (1): + udevd: add 'N:' to optstring in getopt_long + + Summary of changes from v166 to v167 ============================================ diff --git a/NEWS b/NEWS index 89b5b9c39a..1d2bc43e25 100644 --- a/NEWS +++ b/NEWS @@ -2,18 +2,34 @@ udev 168 ======== Bugfixes. -warning if /run is not writable - -udevadm control --exit - -udevadm info --cleanup-db -if used, OPTIONS+="db_persist" needed for LVM - -systemd netlink socket activation -stop socket or mask on rpm update -requires systemd 25 - -hard event timeout now. hanging programs will be killed +Udev logs a warning now if /run is not writable at udevd +startup. It will still fall back to /dev/.udev, but this is +now considered a bug. + +The running udev daemon can now cleanly shut down with: + udevadm control --exit + +Udev in initramfs should clean the state of the udev database +with: udevadm info --cleanup-db which will remove all state left +behind from events/rules in initramfs. If initramfs uses +--cleanup-db and device-mapper/LVM, the rules in initramfs need +to add OPTIONS+="db_persist" for all dm devices. This will +prevent removal of the udev database for these devices. + +Spawned programs by PROGRAM/IMPORT/RUN now have a hard timeout of +120 seconds per process. If that timeout is reached the spawned +process will be killed. The event timeout can be overwritten with +udev rules. + +If systemd is used, udev gets now activated by netlink data. +Systemd will bind the netlink socket which will buffer all data. +If needed, such setup allows a seemless update of the udev daemon, +where no event can be lost during a udevd update/restart. +Packages need to make sure to: systemctl stop udev.socket udev.service +or 'mask' udev.service during the upgrade to prevent any unwanted +auto-spawning of udevd. +This version of udev conflicts with systemd version below 25. The +unchanged service files will not wirk correctly. udev 167 ======== diff --git a/TODO b/TODO index 54b0fe5286..069f1ac9b7 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ + - db_persist -> lvm.git + - kill tabs? - remove deprecated trigger --type=failed logic -- cgit v1.2.3-54-g00ecf From c7c32e9c9835a0bdaee931f33ac0fc86a1e4c415 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 23 Apr 2011 23:33:11 +0200 Subject: simplify rules file overwrite logic The udev list already provides all we need, if we use the basename as the key, and request sorting and uniqueness. --- udev/udev-rules.c | 90 ++++++++++++++++--------------------------------------- 1 file changed, 25 insertions(+), 65 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index d38c9ff4ff..2ae30d81f6 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1719,6 +1719,7 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix) { DIR *dir; + struct dirent *dent; char filename[UTIL_PATH_SIZE]; dbg(udev, "open directory '%s'\n", dirname); @@ -1728,13 +1729,7 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis return -1; } - for (;;) { - struct dirent *dent; - - dent = readdir(dir); - if (dent == NULL || dent->d_name[0] == '\0') - break; - + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { if (dent->d_name[0] == '.') continue; @@ -1750,7 +1745,12 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis } util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL); dbg(udev, "put file '%s' into list\n", filename); - udev_list_entry_add(udev, file_list, filename, NULL, 1, 1); + /* + * the basename is the key, the filename the value + * identical basenames from different directories overwrite each other + * entries are sorted after basename + */ + udev_list_entry_add(udev, file_list, dent->d_name, filename, 1, 1); } closedir(dir); @@ -1761,7 +1761,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { struct udev_rules *rules; struct udev_list_node file_list; - struct udev_list_entry *file_loop, *file_tmp; + struct udev_list_entry *file_loop; struct token end_token; rules = calloc(1, sizeof(struct udev_rules)); @@ -1804,66 +1804,26 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); rules->trie_nodes_cur = 1; - if (udev_get_rules_path(udev) != NULL) { - /* custom rules location for testing */ - add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); - } else { - char filename[PATH_MAX]; - struct udev_list_node sort_list; - struct udev_list_entry *sort_loop, *sort_tmp; + if (udev_get_rules_path(udev) == NULL) { + char filename[UTIL_PATH_SIZE]; - /* read user/custom rules */ + /* /lib/udev -- default/package rules */ + add_matching_files(udev, &file_list, LIBEXECDIR "/rules.d", ".rules"); + + /* /etc/udev -- system-specific/user/admin rules */ add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); - /* read dynamic/temporary rules */ + /* /run/udev -- throw-away/temporary rules */ util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL); - udev_list_init(&sort_list); - add_matching_files(udev, &sort_list, filename, ".rules"); - - /* read default rules */ - add_matching_files(udev, &sort_list, LIBEXECDIR "/rules.d", ".rules"); - - /* sort all rules files by basename into list of files */ - udev_list_entry_foreach_safe(sort_loop, sort_tmp, udev_list_get_entry(&sort_list)) { - const char *sort_name = udev_list_entry_get_name(sort_loop); - const char *sort_base = strrchr(sort_name, '/'); - - if (sort_base == NULL) - continue; - /* sort entry into existing list */ - udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { - const char *file_name = udev_list_entry_get_name(file_loop); - const char *file_base = strrchr(file_name, '/'); - - if (file_base == NULL) - continue; - if (strcmp(file_base, sort_base) == 0) { - info(udev, "rule file basename '%s' already added, ignoring '%s'\n", - file_name, sort_name); - udev_list_entry_delete(sort_loop); - sort_loop = NULL; - break; - } - if (strcmp(file_base, sort_base) > 0) { - /* found later file, insert before */ - udev_list_entry_remove(sort_loop); - udev_list_entry_insert_before(sort_loop, file_loop); - sort_loop = NULL; - break; - } - } - /* current file already handled */ - if (sort_loop == NULL) - continue; - /* no later file, append to end of list */ - udev_list_entry_remove(sort_loop); - udev_list_entry_append(sort_loop, &file_list); - } + add_matching_files(udev, &file_list, filename, ".rules"); + } else { + /* custom rules files location for testing */ + add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); } /* add all filenames to the string buffer */ udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { - const char *filename = udev_list_entry_get_name(file_loop); + const char *filename = udev_list_entry_get_value(file_loop); unsigned int filename_off; filename_off = add_string(rules, filename); @@ -1872,9 +1832,9 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) udev_list_entry_set_flags(file_loop, filename_off); } - /* parse list of files */ - udev_list_entry_foreach_safe(file_loop, file_tmp, udev_list_get_entry(&file_list)) { - const char *filename = udev_list_entry_get_name(file_loop); + /* parse all rules files */ + udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { + const char *filename = udev_list_entry_get_value(file_loop); unsigned int filename_off = udev_list_entry_get_flags(file_loop); struct stat st; @@ -1891,8 +1851,8 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) continue; } parse_file(rules, filename, filename_off); - udev_list_entry_delete(file_loop); } + udev_list_cleanup_entries(udev, &file_list); memset(&end_token, 0x00, sizeof(struct token)); end_token.type = TK_END; -- cgit v1.2.3-54-g00ecf From 8958da13c72024c4eaa2996b86fce2959e452db4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 24 Apr 2011 00:22:23 +0200 Subject: libudev: list - use bit flags for 'sort' and 'unique' --- Makefile.am | 2 +- libudev/libudev-device-private.c | 4 ++-- libudev/libudev-device.c | 18 +++++++++--------- libudev/libudev-enumerate.c | 22 +++++++++++----------- libudev/libudev-list.c | 23 ++++++++++++++--------- libudev/libudev-monitor.c | 4 ++-- libudev/libudev-private.h | 12 ++++++++---- libudev/libudev-queue.c | 4 ++-- libudev/libudev.c | 2 +- udev/udev-event.c | 2 +- udev/udev-node.c | 2 +- udev/udev-rules.c | 22 +++++++++++----------- udev/udevadm-monitor.c | 4 ++-- 13 files changed, 65 insertions(+), 56 deletions(-) diff --git a/Makefile.am b/Makefile.am index 5ddf83acab..2aff45e2a9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,7 +35,7 @@ DISTCHECK_HOOKS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=11 -LIBUDEV_REVISION=2 +LIBUDEV_REVISION=3 LIBUDEV_AGE=11 SUBDIRS += libudev/docs diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index ee9e297cea..b78b6c9553 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -86,7 +86,7 @@ static bool device_has_info(struct udev_device *udev_device) if (udev_device_get_devlink_priority(udev_device) != 0) return true; udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_flags(list_entry)) + if (udev_list_entry_get_num(list_entry)) return true; if (udev_device_get_tags_list_entry(udev_device) != NULL) return true; @@ -157,7 +157,7 @@ int udev_device_update_db(struct udev_device *udev_device) if (udev_device_get_usec_initialized(udev_device) > 0) fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device)); udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - if (!udev_list_entry_get_flags(list_entry)) + if (!udev_list_entry_get_num(list_entry)) continue; fprintf(f, "E:%s=%s\n", udev_list_entry_get_name(list_entry), diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 0ef7260de2..ffde21ad57 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -103,7 +103,7 @@ struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device udev_list_entry_delete(list_entry); return NULL; } - return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, 1, 0); + return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, UDEV_LIST_UNIQUE); } static struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) @@ -289,7 +289,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile) break; case 'E': entry = udev_device_add_property_from_string(udev_device, val); - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); break; case 'G': udev_device_add_tag(udev_device, val); @@ -1216,7 +1216,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); if (lstat(path, &statbuf) != 0) { dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); - udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, NULL, 0, 0); + udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, NULL, 0); goto out; } @@ -1240,7 +1240,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const if (pos != NULL) { pos = &pos[1]; dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, pos, 0, 0); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, pos, 0); val = udev_list_entry_get_value(list_entry); } @@ -1272,7 +1272,7 @@ const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const value[size] = '\0'; util_remove_trailing_chars(value, '\n'); dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, value, 0, 0); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, value, 0); val = udev_list_entry_get_value(list_entry); out: return val; @@ -1311,7 +1311,7 @@ static int udev_device_sysattr_list_read(struct udev_device *udev_device) continue; udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, - dent->d_name, NULL, 0, 0); + dent->d_name, NULL, 0); num++; } @@ -1419,11 +1419,11 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink struct udev_list_entry *list_entry; udev_device->devlinks_uptodate = false; - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, 1, 0); + list_entry = udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, UDEV_LIST_UNIQUE); if (list_entry == NULL) return -ENOMEM; if (unique) - udev_list_entry_set_flags(list_entry, 1); + udev_list_entry_set_num(list_entry, true); return 0; } @@ -1491,7 +1491,7 @@ int udev_device_add_tag(struct udev_device *udev_device, const char *tag) if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) return -EINVAL; udev_device->tags_uptodate = false; - if (udev_list_entry_add(udev_device->udev, &udev_device->tags_list, tag, NULL, 1, 0) != NULL) + if (udev_list_entry_add(udev_device->udev, &udev_device->tags_list, tag, NULL, UDEV_LIST_UNIQUE) != NULL) return 0; return -ENOMEM; } diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 6870bb6115..018d89cc04 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -295,24 +295,24 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) { udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - move_later->syspath, NULL, 0, 0); + move_later->syspath, NULL, 0); move_later = NULL; } udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - entry->syspath, NULL, 0, 0); + entry->syspath, NULL, 0); } if (move_later) udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - move_later->syspath, NULL, 0, 0); + move_later->syspath, NULL, 0); /* add and cleanup delayed devices from end of list */ for (i = max; i < udev_enumerate->devices_cur; i++) { struct syspath *entry = &udev_enumerate->devices[i]; udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - entry->syspath, NULL, 0, 0); + entry->syspath, NULL, 0); free(entry->syspath); } udev_enumerate->devices_cur = max; @@ -336,7 +336,7 @@ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, co if (subsystem == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_match_list, subsystem, NULL, 1, 0) == NULL) + &udev_enumerate->subsystem_match_list, subsystem, NULL, UDEV_LIST_UNIQUE) == NULL) return -ENOMEM; return 0; } @@ -355,7 +355,7 @@ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, if (subsystem == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_nomatch_list, subsystem, NULL, 1, 0) == NULL) + &udev_enumerate->subsystem_nomatch_list, subsystem, NULL, UDEV_LIST_UNIQUE) == NULL) return -ENOMEM; return 0; } @@ -375,7 +375,7 @@ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, cons if (sysattr == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_match_list, sysattr, value, 0, 0) == NULL) + &udev_enumerate->sysattr_match_list, sysattr, value, 0) == NULL) return -ENOMEM; return 0; } @@ -395,7 +395,7 @@ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, co if (sysattr == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_nomatch_list, sysattr, value, 0, 0) == NULL) + &udev_enumerate->sysattr_nomatch_list, sysattr, value, 0) == NULL) return -ENOMEM; return 0; } @@ -435,7 +435,7 @@ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, con if (property == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->properties_match_list, property, value, 0, 0) == NULL) + &udev_enumerate->properties_match_list, property, value, 0) == NULL) return -ENOMEM; return 0; } @@ -454,7 +454,7 @@ int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const ch if (tag == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->tags_match_list, tag, NULL, 1, 0) == NULL) + &udev_enumerate->tags_match_list, tag, NULL, UDEV_LIST_UNIQUE) == NULL) return -ENOMEM; return 0; } @@ -499,7 +499,7 @@ int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, cons if (sysname == NULL) return 0; if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysname_match_list, sysname, NULL, 1, 0) == NULL) + &udev_enumerate->sysname_match_list, sysname, NULL, UDEV_LIST_UNIQUE) == NULL) return -ENOMEM; return 0; } diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c index b5e96458cc..29453ac251 100644 --- a/libudev/libudev-list.c +++ b/libudev/libudev-list.c @@ -38,10 +38,10 @@ struct udev_list_entry { struct udev_list_node *list; char *name; char *value; - unsigned int flags; + int num; }; -/* list head point to itself if empty */ +/* the list's head points to itself if empty */ void udev_list_init(struct udev_list_node *list) { list->next = list; @@ -114,12 +114,12 @@ void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, const char *name, const char *value, - int unique, int sort) + unsigned int flags) { struct udev_list_entry *entry_loop = NULL; struct udev_list_entry *entry_new; - if (unique) + if (flags & UDEV_LIST_UNIQUE) { udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { if (strcmp(entry_loop->name, name) == 0) { dbg(udev, "'%s' is already in the list\n", name); @@ -136,12 +136,14 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_ return entry_loop; } } + } - if (sort) + if (flags & UDEV_LIST_SORT) { udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { if (strcmp(entry_loop->name, name) > 0) break; } + } entry_new = malloc(sizeof(struct udev_list_entry)); if (entry_new == NULL) @@ -153,6 +155,7 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_ free(entry_new); return NULL; } + if (value != NULL) { entry_new->value = strdup(value); if (entry_new->value == NULL) { @@ -161,10 +164,12 @@ struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_ return NULL; } } + if (entry_loop != NULL) udev_list_entry_insert_before(entry_new, entry_loop); else udev_list_entry_append(entry_new, list); + dbg(udev, "'%s=%s' added\n", entry_new->name, entry_new->value); return entry_new; } @@ -258,16 +263,16 @@ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) return list_entry->value; } -unsigned int udev_list_entry_get_flags(struct udev_list_entry *list_entry) +int udev_list_entry_get_num(struct udev_list_entry *list_entry) { if (list_entry == NULL) return -EINVAL; - return list_entry->flags; + return list_entry->num; } -void udev_list_entry_set_flags(struct udev_list_entry *list_entry, unsigned int flags) +void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num) { if (list_entry == NULL) return; - list_entry->flags = flags; + list_entry->num = num; } diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index d890b4b142..5917b9e497 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -830,7 +830,7 @@ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_mo if (subsystem == NULL) return -EINVAL; if (udev_list_entry_add(udev_monitor->udev, - &udev_monitor->filter_subsystem_list, subsystem, devtype, 0, 0) == NULL) + &udev_monitor->filter_subsystem_list, subsystem, devtype, 0) == NULL) return -ENOMEM; return 0; } @@ -854,7 +854,7 @@ int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const c if (tag == NULL) return -EINVAL; if (udev_list_entry_add(udev_monitor->udev, - &udev_monitor->filter_tag_list, tag, NULL, 0, 0) == NULL) + &udev_monitor->filter_tag_list, tag, NULL, 0) == NULL) return -ENOMEM; return 0; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index c47bbce2d6..dbe7fd17fc 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -157,6 +157,11 @@ const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); /* libudev-list.c */ +enum udev_list_flags { + UDEV_LIST_NONE = 0, + UDEV_LIST_UNIQUE = 1, + UDEV_LIST_SORT = 1 << 1, +}; struct udev_list_node { struct udev_list_node *next, *prev; }; @@ -174,16 +179,15 @@ void udev_list_node_remove(struct udev_list_node *entry); node != list; \ node = tmp, tmp = (tmp)->next) struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, - const char *name, const char *value, - int unique, int sort); + const char *name, const char *value, unsigned int flags); void udev_list_entry_delete(struct udev_list_entry *entry); void udev_list_entry_remove(struct udev_list_entry *entry); void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry); void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list); void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list); struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); -unsigned int udev_list_entry_get_flags(struct udev_list_entry *list_entry); -void udev_list_entry_set_flags(struct udev_list_entry *list_entry, unsigned int flags); +int udev_list_entry_get_num(struct udev_list_entry *list_entry); +void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num); #define udev_list_entry_foreach_safe(entry, tmp, first) \ for (entry = first, tmp = udev_list_entry_get_next(entry); \ entry != NULL; \ diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index 75c5b2425e..ead05c5184 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -454,7 +454,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev break; if (len > 0) { - udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, seqnum_str, 0, 0); + udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, seqnum_str, 0); } else { udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { @@ -508,7 +508,7 @@ struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); if (stat(filename, &statbuf) != 0) continue; - udev_list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0, 0); + udev_list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0); } closedir(dir); return udev_list_get_entry(&udev_queue->failed_list); diff --git a/libudev/libudev.c b/libudev/libudev.c index edc24e2fca..6b5c5e9f84 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -458,7 +458,7 @@ struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, co udev_list_entry_delete(list_entry); return NULL; } - return udev_list_entry_add(udev, &udev->properties_list, key, value, 1, 0); + return udev_list_entry_add(udev, &udev->properties_list, key, value, UDEV_LIST_UNIQUE); } struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) diff --git a/udev/udev-event.c b/udev/udev-event.c index 4af3e08f60..e5683cfc2a 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -1075,7 +1075,7 @@ int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) udev_event_apply_format(event, cmd, program, sizeof(program)); envp = udev_device_get_properties_envp(event->dev); if (udev_event_spawn(event, program, envp, sigmask, NULL, 0) < 0) { - if (udev_list_entry_get_flags(list_entry)) + if (udev_list_entry_get_num(list_entry)) err = -1; } } diff --git a/udev/udev-node.c b/udev/udev-node.c index 5e791ffb6c..dc7d9c365a 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -386,7 +386,7 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) /* create/update symlinks, add symlinks to name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - if (udev_list_entry_get_flags(list_entry)) + if (udev_list_entry_get_num(list_entry)) /* simple unmanaged link name */ node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry)); else diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 2ae30d81f6..892d8f27a7 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -731,7 +731,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) entry = udev_device_add_property(dev, key, val); /* store in db, skip private keys */ if (key[0] != '.') - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); } return 0; } @@ -800,7 +800,7 @@ static int import_parent_into_properties(struct udev_device *dev, const char *fi entry = udev_device_add_property(dev, key, val); /* store in db, skip private keys */ if (key[0] != '.') - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); } } return 0; @@ -1750,7 +1750,7 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis * identical basenames from different directories overwrite each other * entries are sorted after basename */ - udev_list_entry_add(udev, file_list, dent->d_name, filename, 1, 1); + udev_list_entry_add(udev, file_list, dent->d_name, filename, UDEV_LIST_UNIQUE|UDEV_LIST_SORT); } closedir(dir); @@ -1829,13 +1829,13 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) filename_off = add_string(rules, filename); /* the offset in the rule is limited to unsigned short */ if (filename_off < USHRT_MAX) - udev_list_entry_set_flags(file_loop, filename_off); + udev_list_entry_set_num(file_loop, filename_off); } /* parse all rules files */ udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { const char *filename = udev_list_entry_get_value(file_loop); - unsigned int filename_off = udev_list_entry_get_flags(file_loop); + unsigned int filename_off = udev_list_entry_get_num(file_loop); struct stat st; if (stat(filename, &st) != 0) { @@ -2326,7 +2326,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event struct udev_list_entry *entry; entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); } else { if (cur->key.op != OP_NOMATCH) goto nomatch; @@ -2354,7 +2354,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (pos[0] == '\0' || isspace(pos[0])) { /* we import simple flags as 'FLAG=1' */ entry = udev_device_add_property(event->dev, key, "1"); - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); imported = true; } else if (pos[0] == '=') { const char *value; @@ -2365,7 +2365,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event pos++; pos[0] = '\0'; entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); imported = true; } } @@ -2510,7 +2510,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event entry = udev_device_add_property(event->dev, name, temp_value); /* store in db, skip private keys */ if (name[0] != '.') - udev_list_entry_set_flags(entry, 1); + udev_list_entry_set_num(entry, true); } else { udev_device_add_property(event->dev, name, NULL); } @@ -2629,9 +2629,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event &rules->buf[rule->rule.filename_off], rule->rule.filename_line); list_entry = udev_list_entry_add(event->udev, &event->run_list, - &rules->buf[cur->key.value_off], NULL, 1, 0); + &rules->buf[cur->key.value_off], NULL, UDEV_LIST_UNIQUE); if (cur->key.fail_on_error) - udev_list_entry_set_flags(list_entry, 1); + udev_list_entry_set_num(list_entry, true); break; } case TK_A_GOTO: diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index e1bb6fe18e..f3a72cf17e 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -122,11 +122,11 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) devtype[0] = '\0'; devtype++; } - udev_list_entry_add(udev, &subsystem_match_list, subsys, devtype, 0, 0); + udev_list_entry_add(udev, &subsystem_match_list, subsys, devtype, 0); break; } case 't': - udev_list_entry_add(udev, &tag_match_list, optarg, NULL, 0, 0); + udev_list_entry_add(udev, &tag_match_list, optarg, NULL, 0); break; case 'h': printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" -- cgit v1.2.3-54-g00ecf From f6577968a2f86aade8fff503a53fa52a7245251a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 24 Apr 2011 00:36:22 +0200 Subject: libudev: queue - _unref() should return the object --- libudev/libudev-private.h | 2 +- libudev/libudev-queue-private.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index dbe7fd17fc..2fcfe4131c 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -201,7 +201,7 @@ ssize_t udev_queue_skip_devpath(FILE *queue_file); /* libudev-queue-private.c */ struct udev_queue_export *udev_queue_export_new(struct udev *udev); -void udev_queue_export_unref(struct udev_queue_export *udev_queue_export); +struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev_queue_export); void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 2f1afecb29..a799be062a 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -90,13 +90,14 @@ struct udev_queue_export *udev_queue_export_new(struct udev *udev) return udev_queue_export; } -void udev_queue_export_unref(struct udev_queue_export *udev_queue_export) +struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev_queue_export) { if (udev_queue_export == NULL) - return; + return NULL; if (udev_queue_export->queue_file != NULL) fclose(udev_queue_export->queue_file); free(udev_queue_export); + return NULL; } void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) -- cgit v1.2.3-54-g00ecf From 88d307f64e31ff8e76f85b6b3deacbd9ac3c083d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 26 Apr 2011 23:04:44 +0200 Subject: remove dead fstab_import files --- extras/fstab_import/.gitignore | 1 - extras/fstab_import/79-fstab_import.rules | 2 - extras/fstab_import/fstab_import.c | 203 ------------------------------ 3 files changed, 206 deletions(-) delete mode 100644 extras/fstab_import/.gitignore delete mode 100644 extras/fstab_import/79-fstab_import.rules delete mode 100644 extras/fstab_import/fstab_import.c diff --git a/extras/fstab_import/.gitignore b/extras/fstab_import/.gitignore deleted file mode 100644 index c9ec5b801c..0000000000 --- a/extras/fstab_import/.gitignore +++ /dev/null @@ -1 +0,0 @@ -fstab_import diff --git a/extras/fstab_import/79-fstab_import.rules b/extras/fstab_import/79-fstab_import.rules deleted file mode 100644 index 2ded7d3d9f..0000000000 --- a/extras/fstab_import/79-fstab_import.rules +++ /dev/null @@ -1,2 +0,0 @@ -ACTION!="remove", SUBSYSTEM=="block", ENV{ID_FS_USAGE}=="filesystem|other", IMPORT="fstab_import $name $links mapper/$env{DM_NAME}" - diff --git a/extras/fstab_import/fstab_import.c b/extras/fstab_import/fstab_import.c deleted file mode 100644 index c66bffb25c..0000000000 --- a/extras/fstab_import/fstab_import.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * find matching entry in fstab and export it - * - * Copyright (C) 2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static int debug; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -static int matches_device_list(struct udev *udev, char **devices, const char *name) -{ - int i; - - for (i = 0; devices[i] != NULL; i++) { - info(udev, "compare '%s' == '%s'\n", name, devices[i]); - if (strcmp(devices[i], name) == 0) - return 1; - } - return 0; -} - -static void print_fstab_entry(struct udev *udev, struct mntent *mnt) -{ - printf("FSTAB_NAME=%s\n", mnt->mnt_fsname); - printf("FSTAB_DIR=%s\n", mnt->mnt_dir); - printf("FSTAB_TYPE=%s\n", mnt->mnt_type); - printf("FSTAB_OPTS=%s\n", mnt->mnt_opts); - printf("FSTAB_FREQ=%d\n", mnt->mnt_freq); - printf("FSTAB_PASSNO=%d\n", mnt->mnt_passno); -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - static const struct option options[] = { - { "export", no_argument, NULL, 'x' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - char **devices; - FILE *fp; - struct mntent *mnt; - int rc = 1; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("fstab_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "dxh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("Usage: fstab_id [OPTIONS] name [...]\n" - " --export print environment keys\n" - " --debug debug to stderr\n" - " --help print this help text\n\n"); - goto exit; - case 'x': - break; - default: - rc = 2; - goto exit; - } - } - - devices = &argv[optind]; - if (devices[0] == NULL) { - fprintf(stderr, "error: missing device(s) to match\n"); - rc = 3; - goto exit; - } - - fp = setmntent ("/etc/fstab", "r"); - if (fp == NULL) { - fprintf(stderr, "error: opening fstab: %s\n", strerror(errno)); - rc = 4; - goto exit; - } - - while (1) { - mnt = getmntent(fp); - if (mnt == NULL) - break; - - info(udev, "found '%s'@'%s'\n", mnt->mnt_fsname, mnt->mnt_dir); - - /* skip root device */ - if (strcmp(mnt->mnt_dir, "/") == 0) - continue; - - /* match LABEL */ - if (strncmp(mnt->mnt_fsname, "LABEL=", 6) == 0) { - const char *label; - char str[256]; - - label = &mnt->mnt_fsname[6]; - if (label[0] == '"' || label[0] == '\'') { - char *pos; - - util_strscpy(str, sizeof(str), &label[1]); - pos = strrchr(str, label[0]); - if (pos == NULL) - continue; - pos[0] = '\0'; - label = str; - } - if (matches_device_list(udev, devices, label)) { - print_fstab_entry(udev, mnt); - rc = 0; - break; - } - continue; - } - - /* match UUID */ - if (strncmp(mnt->mnt_fsname, "UUID=", 5) == 0) { - const char *uuid; - char str[256]; - - uuid = &mnt->mnt_fsname[5]; - if (uuid[0] == '"' || uuid[0] == '\'') { - char *pos; - - util_strscpy(str, sizeof(str), &uuid[1]); - pos = strrchr(str, uuid[0]); - if (pos == NULL) - continue; - pos[0] = '\0'; - uuid = str; - } - if (matches_device_list(udev, devices, uuid)) { - print_fstab_entry(udev, mnt); - rc = 0; - break; - } - continue; - } - - /* only devices */ - if (strncmp(mnt->mnt_fsname, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) - continue; - - if (matches_device_list(udev, devices, &mnt->mnt_fsname[strlen(udev_get_dev_path(udev))+1])) { - print_fstab_entry(udev, mnt); - rc = 0; - break; - } - } - endmntent(fp); - -exit: - udev_unref(udev); - udev_log_close(); - return rc; -} -- cgit v1.2.3-54-g00ecf From f2f3b8807297cd2dc8737758cfa083aaa861404e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 27 Apr 2011 01:10:04 +0200 Subject: hid2hci: prepare move to bluez package --- Makefile.am | 6 +++--- extras/hid2hci/hid2hci.c | 14 ++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2aff45e2a9..5beec94344 100644 --- a/Makefile.am +++ b/Makefile.am @@ -524,9 +524,9 @@ libexec_PROGRAMS += extras/mobile-action-modeswitch/mobile-action-modeswitch # mtd_probe - autoloads FTL module for mtd devices # ------------------------------------------------------------------------------ extras_mtd_probe_mtd_probe_SOURCES = \ - extras/mtd_probe/mtd_probe.c \ - extras/mtd_probe/mtd_probe.h \ - extras/mtd_probe/probe_smartmedia.c + extras/mtd_probe/mtd_probe.c \ + extras/mtd_probe/mtd_probe.h \ + extras/mtd_probe/probe_smartmedia.c extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c index 98e60d9ac1..559c6f77b1 100644 --- a/extras/hid2hci/hid2hci.c +++ b/extras/hid2hci/hid2hci.c @@ -2,9 +2,9 @@ * hid2hci : switch the radio on devices that support * it from HID to HCI and back * - * Copyright (C) 2003-2009 Marcel Holtmann + * Copyright (C) 2003-2010 Marcel Holtmann * Copyright (C) 2008-2009 Mario Limonciello - * Copyright (C) 2009 Kay Sievers + * Copyright (C) 2009-2011 Kay Sievers * * 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 @@ -33,7 +33,6 @@ #include #include "libudev.h" -#include "libudev-private.h" enum mode { HCI = 0, @@ -152,9 +151,8 @@ static int usb_switch_dell(struct usb_dev_handle *dev, enum mode mode) } /* - * The braindead libusb needs to scan and open all devices, just to - * to find the device we already have. This needs to be fixed in libusb - * or it will be ripped out and we carry our own code. + * libusb needs to scan and open all devices, just to to find the + * device we already have. This should be fixed in libusb. */ static struct usb_device *usb_device_open_from_udev(struct udev_device *usb_dev) { @@ -233,7 +231,7 @@ int main(int argc, char *argv[]) } method = METHOD_UNDEF; struct udev *udev; struct udev_device *udev_dev = NULL; - char syspath[UTIL_PATH_SIZE]; + char syspath[PATH_MAX]; int (*usb_switch)(struct usb_dev_handle *dev, enum mode mode) = NULL; enum mode mode = HCI; const char *devpath = NULL; @@ -289,7 +287,7 @@ int main(int argc, char *argv[]) if (udev == NULL) goto exit; - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); + snprintf(syspath, sizeof(syspath), "%s/%s", udev_get_sys_path(udev), devpath); udev_dev = udev_device_new_from_syspath(udev, syspath); if (udev_dev == NULL) { fprintf(stderr, "error: could not find '%s'\n", devpath); -- cgit v1.2.3-54-g00ecf From d2f4a3464dacf56f50c3ab4fa42353efd33ce22b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 28 Apr 2011 00:04:17 +0200 Subject: set event timeout to 60 sec and settle timeout to 120 --- init/udev-settle.service.in | 1 + udev/udev-event.c | 2 +- udev/udevadm-settle.c | 2 +- udev/udevadm.xml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index bda8626b2d..d7d6f782cb 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -17,6 +17,7 @@ Before=basic.target [Service] Type=oneshot +TimeoutSec=180 RemainAfterExit=yes ExecStart=@sbindir@/udevadm settle diff --git a/udev/udev-event.c b/udev/udev-event.c index e5683cfc2a..8b7362cc10 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -49,7 +49,7 @@ struct udev_event *udev_event_new(struct udev_device *dev) udev_list_init(&event->run_list); event->fd_signal = -1; event->birth_usec = now_usec(); - event->timeout_usec = 120 * 1000 * 1000; + event->timeout_usec = 60 * 1000 * 1000; dbg(event->udev, "allocated event %p\n", event); return event; } diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index afd4af5f4b..9492abd401 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -52,7 +52,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) unsigned long long end = 0; int quiet = 0; const char *exists = NULL; - unsigned int timeout = 180; + unsigned int timeout = 120; struct pollfd pfd[1]; struct udev_queue *udev_queue = NULL; int rc = EXIT_FAILURE; diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 7860efe967..b5fb971f3b 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -262,7 +262,7 @@ Maximum number of seconds to wait for the event queue to become empty. - The default value is 180 seconds. A value of 0 will check if the queue is empty + The default value is 120 seconds. A value of 0 will check if the queue is empty and always return immediately. -- cgit v1.2.3-54-g00ecf From 829f6902fe09d2eb1cff459fa5e26ed53f98ebc8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 28 Apr 2011 14:58:06 +0200 Subject: udevd: improve error message in case exec() fails --- udev/udev-event.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 8b7362cc10..4c51ed58e5 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -489,7 +489,7 @@ static int spawn_exec(struct udev_event *event, /* exec failed */ err = -errno; - err(udev, "exec of program '%s' failed\n", cmd); + err(udev, "failed to execute '%s' '%s': %m\n", argv[0], cmd); return err; } -- cgit v1.2.3-54-g00ecf From d5d6a7f3040992f853eb23eb1bafac3b77891c2d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Apr 2011 14:27:11 +0200 Subject: configure: allow to enable/disable extras individually - remove gobject introspection switch - disable hid2hci by default (moved to bluez) - disable action-modeswitch by default (will move to usb_modeswitch) - disable edd_id by default (problems with disk signatures) - disable legacy floppy by default (no more nasty device node hacks by default) --- INSTALL | 28 ++++++-- Makefile.am | 220 +++++++++++++++++++++++++++++------------------------------ README | 7 +- configure.ac | 152 +++++++++++++++++++++++++++++++---------- 4 files changed, 251 insertions(+), 156 deletions(-) diff --git a/INSTALL b/INSTALL index 02ad55fe47..09dc3f7d24 100644 --- a/INSTALL +++ b/INSTALL @@ -27,9 +27,24 @@ All options: --with-selinux Link against SELinux libraries to set the expected context for created files. - --disable-extras - Disable the build of all extras which have larger external - dependencies like glib, libacl, libusb, ... + --disable-rule_generator + Disable persistent network, cdrom naming support. + --disable-hwdb + Disable hardware database support + --disable-udev_acl + Disable local user acl permissions support. + --disable-gudev + Disable Gobject libudev support. + --disable-keymap + Disable keymap fixup support. + --enable-floppy + Enable legacy floppy support. + --enable-edd + Enable disk edd support. + --enable-hid2hci + Enable bluetooth hid to hci switch. + --enable-action_modeswitch + Enable action modeswitch support. The options used in a RPM spec file usually look like: %configure \ @@ -47,13 +62,12 @@ other location will break other packages, who rightfully expect the /lib/udev/ directory, to install their rule helper and udev rule files. -It is recommended to use the /lib/udev/devices/ directory to place +It is possible to use the /lib/udev/devices/ directory to place device nodes, directories and symlinks, which are copied to /dev/ at every bootup. That way, nodes for devices which can not be detected automatically, or are activated on-demand by opening the pre-existing device node, will be available. -Default udev rules and persistent device naming rules are required +Default udev rules and persistent device naming rules may be required by other software that depends on the data udev collects from the -devices, and should therefore be installed by default with every udev -installation. +devices. diff --git a/Makefile.am b/Makefile.am index 5beec94344..9db127038c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -25,11 +25,12 @@ DISTCHECK_CONFIGURE_FLAGS = \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) CLEANFILES = - +BUILT_SOURCES = INSTALL_EXEC_HOOKS = INSTALL_DATA_HOOKS = UNINSTALL_EXEC_HOOKS = DISTCHECK_HOOKS = +dist_libexec_SCRIPTS = # ------------------------------------------------------------------------------ # libudev @@ -211,20 +212,6 @@ udev_test_udev_SOURCES = \ udev/test-udev.c udev_test_udev_LDADD = libudev/libudev-private.la -# ------------------------------------------------------------------------------ -# rule_generator - persistent network and optical device rule generator -# ------------------------------------------------------------------------------ -dist_libexec_SCRIPTS = \ - extras/rule_generator/write_cd_rules \ - extras/rule_generator/write_net_rules - -udevhomedir = $(libexecdir) -dist_udevhome_DATA = extras/rule_generator/rule_generator.functions - -dist_udevrules_DATA += \ - extras/rule_generator/75-cd-aliases-generator.rules \ - extras/rule_generator/75-persistent-net-generator.rules - # ------------------------------------------------------------------------------ # firmware - firmware loading # ------------------------------------------------------------------------------ @@ -256,22 +243,6 @@ extras_collect_collect_SOURCES = extras/collect/collect.c extras_collect_collect_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/collect/collect -# ------------------------------------------------------------------------------ -# edd_id - BIOS EDD block device match -# ------------------------------------------------------------------------------ -extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c -extras_edd_id_edd_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/edd_id/edd_id -dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules - -# ------------------------------------------------------------------------------ -# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) -# ------------------------------------------------------------------------------ -extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c -extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/floppy/create_floppy_devices -dist_udevrules_DATA += extras/floppy/60-floppy.rules - # ------------------------------------------------------------------------------ # input_id - import input device class # ------------------------------------------------------------------------------ @@ -313,20 +284,75 @@ extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules +# ------------------------------------------------------------------------------ +# mtd_probe - autoloads FTL module for mtd devices +# ------------------------------------------------------------------------------ +extras_mtd_probe_mtd_probe_SOURCES = \ + extras/mtd_probe/mtd_probe.c \ + extras/mtd_probe/mtd_probe.h \ + extras/mtd_probe/probe_smartmedia.c +extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules +libexec_PROGRAMS += extras/mtd_probe/mtd_probe + # ------------------------------------------------------------------------------ # qemu -- qemu/kvm guest tweaks # ------------------------------------------------------------------------------ dist_udevrules_DATA += extras/qemu/42-qemu-usb.rules -if ENABLE_EXTRAS +if ENABLE_RULE_GENERATOR # ------------------------------------------------------------------------------ -# conditional extras (need glib, libusb, libacl, ...) +# rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ +dist_libexec_SCRIPTS += \ + extras/rule_generator/write_cd_rules \ + extras/rule_generator/write_net_rules + +udevhomedir = $(libexecdir) +dist_udevhome_DATA = extras/rule_generator/rule_generator.functions + +dist_udevrules_DATA += \ + extras/rule_generator/75-cd-aliases-generator.rules \ + extras/rule_generator/75-persistent-net-generator.rules +endif + +if ENABLE_HWDB +# ------------------------------------------------------------------------------ +# usb/pci-db - read vendor/device string database +# ------------------------------------------------------------------------------ +extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c +extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB +extras_usb_db_usb_db_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/usb-db/usb-db dist_udevrules_DATA += \ rules/rules.d/75-net-description.rules \ rules/rules.d/75-tty-description.rules \ rules/rules.d/78-sound-card.rules +extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c +extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI +extras_usb_db_pci_db_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/usb-db/pci-db +endif + +if ENABLE_UDEV_ACL +# ------------------------------------------------------------------------------ +# udev_acl - apply ACLs for users with local forground sessions +# ------------------------------------------------------------------------------ +extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c +extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) +extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) +dist_udevrules_DATA += extras/udev-acl/70-acl.rules +libexec_PROGRAMS += extras/udev-acl/udev-acl + +udevacl-install-hook: + mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d + ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck + +INSTALL_EXEC_HOOKS += udevacl-install-hook +endif + +if ENABLE_GUDEV # ------------------------------------------------------------------------------ # GUdev - libudev gobject interface # ------------------------------------------------------------------------------ @@ -367,7 +393,7 @@ dist_extras_gudev_libgudev_1_0_la_SOURCES = \ extras/gudev/gudevmarshal.c \ extras/gudev/gudevenumtypes.h \ extras/gudev/gudevenumtypes.c -BUILT_SOURCES = $(dist_extras_gudev_libgudev_1_0_la_SOURCES) +BUILT_SOURCES += $(dist_extras_gudev_libgudev_1_0_la_SOURCES) extras_gudev_libgudev_1_0_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ @@ -407,7 +433,6 @@ extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gud $(AM_V_GEN)glib-mkenums --template $^ > \ $@.tmp && mv $@.tmp $@ -if ENABLE_INTROSPECTION extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ LD_LIBRARY_PATH=$(top_builddir)/extras/gudev:$$LD_LIBRARY_PATH \ @@ -445,7 +470,6 @@ typelibsdir = $(GIRTYPELIBDIR) typelibs_DATA = extras/gudev/GUdev-1.0.typelib CLEANFILES += $(gir_DATA) $(typelibs_DATA) -endif # ENABLE_INTROSPECTION # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed libgudev-install-move-hook: @@ -462,79 +486,9 @@ libgudev-uninstall-move-hook: INSTALL_EXEC_HOOKS += libgudev-install-move-hook UNINSTALL_EXEC_HOOKS += libgudev-uninstall-move-hook +endif -# ------------------------------------------------------------------------------ -# Bluetooth HID devices with special magic to switch the device -# ------------------------------------------------------------------------------ -extras_hid2hci_hid2hci_SOURCES = extras/hid2hci/hid2hci.c -extras_hid2hci_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -extras_hid2hci_hid2hci_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) -dist_udevrules_DATA += extras/hid2hci/70-hid2hci.rules -libexec_PROGRAMS += extras/hid2hci/hid2hci - -# ------------------------------------------------------------------------------ -# udev_acl - apply ACLs for users with local forground sessions -# ------------------------------------------------------------------------------ -extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c -extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) -extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) -dist_udevrules_DATA += extras/udev-acl/70-acl.rules -libexec_PROGRAMS += extras/udev-acl/udev-acl - -udevacl-install-hook: - mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d - ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck - -INSTALL_EXEC_HOOKS += udevacl-install-hook - -# ------------------------------------------------------------------------------ -# usb-db - read USB vendor/device string database -# ------------------------------------------------------------------------------ -extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c -extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB -extras_usb_db_usb_db_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/usb-db/usb-db - -# ------------------------------------------------------------------------------ -# pci-db - read PCI vendor/device string database -# ------------------------------------------------------------------------------ -extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c -extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI -extras_usb_db_pci_db_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/usb-db/pci-db - -# ------------------------------------------------------------------------------ -# mobile-action-modeswitch - switch Mobile Action cables into serial mode -# ------------------------------------------------------------------------------ -extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES =\ - extras/mobile-action-modeswitch/mobile-action-modeswitch.c \ - extras/mobile-action-modeswitch/utils.c \ - extras/mobile-action-modeswitch/utils.h \ - extras/mobile-action-modeswitch/ma8280p_us.c \ - extras/mobile-action-modeswitch/ma8280p_us.h -extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -extras_mobile_action_modeswitch_mobile_action_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) - -dist_udevrules_DATA += \ - extras/mobile-action-modeswitch/61-mobile-action.rules - -libexec_PROGRAMS += extras/mobile-action-modeswitch/mobile-action-modeswitch - -# ------------------------------------------------------------------------------ -# mtd_probe - autoloads FTL module for mtd devices -# ------------------------------------------------------------------------------ -extras_mtd_probe_mtd_probe_SOURCES = \ - extras/mtd_probe/mtd_probe.c \ - extras/mtd_probe/mtd_probe.h \ - extras/mtd_probe/probe_smartmedia.c - -extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) - -dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules - -libexec_PROGRAMS += extras/mtd_probe/mtd_probe - - +if ENABLE_KEYMAP # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ @@ -552,7 +506,6 @@ libexec_PROGRAMS += extras/keymap/keymap dist_libexec_SCRIPTS += extras/keymap/findkeyboards dist_libexec_SCRIPTS += extras/keymap/keyboard-force-release.sh dist_doc_DATA = extras/keymap/README.keymap.txt - CLEANFILES += \ extras/keymap/keys.txt \ extras/keymap/keys-from-name.gperf @@ -638,8 +591,55 @@ extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile keymaps-distcheck-hook: extras/keymap/keys.txt $(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^ DISTCHECK_HOOKS += keymaps-distcheck-hook +endif + +if ENABLE_FLOPPY +# ------------------------------------------------------------------------------ +# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) +# ------------------------------------------------------------------------------ +extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c +extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/floppy/create_floppy_devices +dist_udevrules_DATA += extras/floppy/60-floppy.rules +endif + +if ENABLE_EDD +# ------------------------------------------------------------------------------ +# edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data +# ------------------------------------------------------------------------------ +extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c +extras_edd_id_edd_id_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/edd_id/edd_id +dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules +endif + +if ENABLE_HID2HCI +# ------------------------------------------------------------------------------ +# Bluetooth HID devices with special magic to switch the device +# ------------------------------------------------------------------------------ +extras_hid2hci_hid2hci_SOURCES = extras/hid2hci/hid2hci.c +extras_hid2hci_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) +extras_hid2hci_hid2hci_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) +dist_udevrules_DATA += extras/hid2hci/70-hid2hci.rules +libexec_PROGRAMS += extras/hid2hci/hid2hci +endif -endif # ENABLE_EXTRAS +if ENABLE_ACTION_MODESWITCH +# ------------------------------------------------------------------------------ +# mobile-action-modeswitch - switch Mobile Action cables into serial mode +# ------------------------------------------------------------------------------ +extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES =\ + extras/mobile-action-modeswitch/mobile-action-modeswitch.c \ + extras/mobile-action-modeswitch/utils.c \ + extras/mobile-action-modeswitch/utils.h \ + extras/mobile-action-modeswitch/ma8280p_us.c \ + extras/mobile-action-modeswitch/ma8280p_us.h +extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) +extras_mobile_action_modeswitch_mobile_action_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) +dist_udevrules_DATA += \ + extras/mobile-action-modeswitch/61-mobile-action.rules +libexec_PROGRAMS += extras/mobile-action-modeswitch/mobile-action-modeswitch +endif # ------------------------------------------------------------------------------ # install, uninstall, clean hooks diff --git a/README b/README index 4520f3dbe3..34d1267430 100644 --- a/README +++ b/README @@ -51,9 +51,9 @@ Requirements: these group names with only the rootfs mounted and while no network is available. - - The 'udev extras' has the following dependencies: + - Some udev extras have external dependencies like: libacl, libglib2, libusb, usbutils, pciutils, and gperf. - These dependencies can be disabled with the --disable-extras configure option. + All these extras can be disabled with configure options. Setup: - At bootup, the /dev directory should get the 'devtmpfs' filesystem @@ -90,7 +90,8 @@ Operation: http://www.kernel.org/pub/linux/utils/kernel/hotplug/libudev/ http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/ -For more details about udev and udev rules, see the udev(7) man page. +For more details about udev and udev rules, see the udev man pages: + http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/ Please direct any comment/question to the linux-hotplug mailing list at: linux-hotplug@vger.kernel.org diff --git a/configure.ac b/configure.ac index cb7585e58b..d5585b3c4a 100644 --- a/configure.ac +++ b/configure.ac @@ -54,8 +54,7 @@ AC_ARG_WITH(firmware-path, [], [with_firmware_path="/lib/firmware/updates:/lib/firmware"]) OLD_IFS=$IFS IFS=: -for i in $with_firmware_path -do +for i in $with_firmware_path; do if test "x${FIRMWARE_PATH}" = "x"; then FIRMWARE_PATH="\\\"${i}/\\\"" else @@ -69,38 +68,34 @@ AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) if test "x$with_systemdsystemunitdir" != xno; then - AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) + AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) fi AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) -AC_ARG_ENABLE([extras], - AS_HELP_STRING([--disable-extras], [disable extras with external dependencies]), - [], [enable_extras=yes]) -if test "x$enable_extras" = xyes; then - AC_PATH_PROG([GPERF], [gperf]) - if test -z "$GPERF"; then - AC_MSG_ERROR([gperf is needed]) - fi - - PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) - AC_SUBST([GLIB_CFLAGS]) - AC_SUBST([GLIB_LIBS]) - - AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) - AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) - - PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12) - AC_SUBST(LIBUSB_CFLAGS) - AC_SUBST(LIBUSB_LIBS) - - PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) - AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) +# ------------------------------------------------------------------------------ +# rule_generator - persistent network and optical device rule generator +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([hwdb], + AS_HELP_STRING([--disable-rule_generator], [disable persistent network, cdrom support]), + [], [enable_rule_generator=yes]) +AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_genarator" = xyes]) +# ------------------------------------------------------------------------------ +# usb/pci-db - read vendor/device string database +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([hwdb], + AS_HELP_STRING([--disable-hwdb], [disable hardware database support]), + [], [enable_hwdb=yes]) +if test "x$enable_hwdb" = xyes; then if test "x$cross_compiling" = "xno" ; then AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) fi + + PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) + AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) + AC_ARG_WITH(pci-ids-path, [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], [PCI_DATABASE=${withval}], @@ -112,25 +107,103 @@ if test "x$enable_extras" = xyes; then AC_MSG_CHECKING([for PCI database location]) AC_MSG_RESULT([$PCI_DATABASE]) AC_SUBST(PCI_DATABASE) +fi +AM_CONDITIONAL([ENABLE_HWDB], [test "x$enable_hwdb" = xyes]) - AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) - AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) +# ------------------------------------------------------------------------------ +# udev_acl - apply ACLs for users with local forground sessions +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([udev_acl], + AS_HELP_STRING([--disable-udev_acl], [disable local user acl permissions support]), + [], [enable_udev_acl=yes]) +if test "x$enable_udev_acl" = xyes; then + AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) + AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) + + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) + AC_SUBST([GLIB_CFLAGS]) + AC_SUBST([GLIB_LIBS]) fi -AM_CONDITIONAL([ENABLE_EXTRAS], [test "x$enable_extras" = xyes]) +AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = xyes]) + +# ------------------------------------------------------------------------------ +# GUdev - libudev gobject interface +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([gudev], + AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support]), + [], [enable_gudev=yes]) +if test "x$enable_gudev" = xyes; then + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) + AC_SUBST([GLIB_CFLAGS]) + AC_SUBST([GLIB_LIBS]) -AC_ARG_ENABLE([introspection], - AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), - [], [enable_introspection=yes]) -if test "x$enable_introspection" = xyes; then PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) - AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) fi -AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) +AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = xyes]) + +# ------------------------------------------------------------------------------ +# keymap - map custom hardware's multimedia keys +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([keymap], + AS_HELP_STRING([--disable-keymap], [disable keymap fixup support]), + [], [enable_keymap=yes]) +if test "x$enable_keymap" = xyes; then + AC_PATH_PROG([GPERF], [gperf]) + if test -z "$GPERF"; then + AC_MSG_ERROR([gperf is needed]) + fi + + AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) + AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) +fi +AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = xyes]) + +# ------------------------------------------------------------------------------ +# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([floppy], + AS_HELP_STRING([--enable-floppy], [enable legacy floppy support]), + [], [enable_floppy=no]) +AM_CONDITIONAL([ENABLE_FLOPPY], [test "x$enable_floppy" = xyes]) + +# ------------------------------------------------------------------------------ +# edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([edd], + AS_HELP_STRING([--enable-edd], [enable disk edd support]), + [], [enable_edd=no]) +AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = xyes]) + +# ------------------------------------------------------------------------------ +# Bluetooth HID devices with special magic to switch the device +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([hid2hci], + AS_HELP_STRING([--enable-hid2hci], [enable bluetooth hid to hci switch]), + [], [enable_hid2hci=no]) +if test "x$enable_hid2hci" = xyes; then + PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12) + AC_SUBST(LIBUSB_CFLAGS) + AC_SUBST(LIBUSB_LIBS) +fi +AM_CONDITIONAL([ENABLE_HID2HCI], [test "x$enable_hid2hci" = xyes]) + +# ------------------------------------------------------------------------------ +# mobile-action-modeswitch - switch Mobile Action cables into serial mode +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([ACTION_MODESWITCH], + AS_HELP_STRING([--enable-action_modeswitch], [enable action modeswitch support]), + [], [enable_action_modeswitch=no]) +if test "x$enable_action_modeswitch" = xyes; then + PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12) + AC_SUBST(LIBUSB_CFLAGS) + AC_SUBST(LIBUSB_LIBS) +fi +AM_CONDITIONAL([ENABLE_ACTION_MODESWITCH], [test "x$enable_action_modeswitch" = xyes]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ @@ -175,8 +248,15 @@ AC_MSG_RESULT([ cflags: ${CFLAGS} ldflags: ${LDFLAGS} - extras: ${enable_extras} - gintrospection: ${enable_introspection} + rule_generator: ${enable_rule_generator} + hwdb: ${enable_hwdb} + udev_acl: ${enable_udev_acl} + gudev: ${enable_gudev} + keymap: ${enable_keymap} + floppy: ${enable_floppy} + edd: ${enable_edd} + hid2hci: ${enable_hid2hci} + action_modeswitch: ${enable_action_modeswitch} usb.ids: ${USB_DATABASE} pci.ids: ${PCI_DATABASE} -- cgit v1.2.3-54-g00ecf From 07f1d2860e8ee393abaaead75a6ab3af0f10efbb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Apr 2011 14:31:53 +0200 Subject: delete hid2hci which moved to the bluez tree --- INSTALL | 2 - Makefile.am | 11 -- configure.ac | 14 -- extras/hid2hci/.gitignore | 1 - extras/hid2hci/70-hid2hci.rules | 30 ---- extras/hid2hci/hid2hci.c | 346 ---------------------------------------- 6 files changed, 404 deletions(-) delete mode 100644 extras/hid2hci/.gitignore delete mode 100644 extras/hid2hci/70-hid2hci.rules delete mode 100644 extras/hid2hci/hid2hci.c diff --git a/INSTALL b/INSTALL index 09dc3f7d24..2ea4ba50cb 100644 --- a/INSTALL +++ b/INSTALL @@ -41,8 +41,6 @@ All options: Enable legacy floppy support. --enable-edd Enable disk edd support. - --enable-hid2hci - Enable bluetooth hid to hci switch. --enable-action_modeswitch Enable action modeswitch support. diff --git a/Makefile.am b/Makefile.am index 9db127038c..63bd2bf329 100644 --- a/Makefile.am +++ b/Makefile.am @@ -613,17 +613,6 @@ libexec_PROGRAMS += extras/edd_id/edd_id dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules endif -if ENABLE_HID2HCI -# ------------------------------------------------------------------------------ -# Bluetooth HID devices with special magic to switch the device -# ------------------------------------------------------------------------------ -extras_hid2hci_hid2hci_SOURCES = extras/hid2hci/hid2hci.c -extras_hid2hci_hid2hci_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -extras_hid2hci_hid2hci_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) -dist_udevrules_DATA += extras/hid2hci/70-hid2hci.rules -libexec_PROGRAMS += extras/hid2hci/hid2hci -endif - if ENABLE_ACTION_MODESWITCH # ------------------------------------------------------------------------------ # mobile-action-modeswitch - switch Mobile Action cables into serial mode diff --git a/configure.ac b/configure.ac index d5585b3c4a..a2a042ba60 100644 --- a/configure.ac +++ b/configure.ac @@ -179,19 +179,6 @@ AC_ARG_ENABLE([edd], [], [enable_edd=no]) AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = xyes]) -# ------------------------------------------------------------------------------ -# Bluetooth HID devices with special magic to switch the device -# ------------------------------------------------------------------------------ -AC_ARG_ENABLE([hid2hci], - AS_HELP_STRING([--enable-hid2hci], [enable bluetooth hid to hci switch]), - [], [enable_hid2hci=no]) -if test "x$enable_hid2hci" = xyes; then - PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12) - AC_SUBST(LIBUSB_CFLAGS) - AC_SUBST(LIBUSB_LIBS) -fi -AM_CONDITIONAL([ENABLE_HID2HCI], [test "x$enable_hid2hci" = xyes]) - # ------------------------------------------------------------------------------ # mobile-action-modeswitch - switch Mobile Action cables into serial mode # ------------------------------------------------------------------------------ @@ -255,7 +242,6 @@ AC_MSG_RESULT([ keymap: ${enable_keymap} floppy: ${enable_floppy} edd: ${enable_edd} - hid2hci: ${enable_hid2hci} action_modeswitch: ${enable_action_modeswitch} usb.ids: ${USB_DATABASE} diff --git a/extras/hid2hci/.gitignore b/extras/hid2hci/.gitignore deleted file mode 100644 index efd972905a..0000000000 --- a/extras/hid2hci/.gitignore +++ /dev/null @@ -1 +0,0 @@ -hid2hci diff --git a/extras/hid2hci/70-hid2hci.rules b/extras/hid2hci/70-hid2hci.rules deleted file mode 100644 index 3b36629d4b..0000000000 --- a/extras/hid2hci/70-hid2hci.rules +++ /dev/null @@ -1,30 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="hid2hci_end" -SUBSYSTEM!="usb", GOTO="hid2hci_end" - -# Variety of Dell Bluetooth devices - match on a mouse device that is -# self powered and where a HID report needs to be sent to switch modes -# Known supported devices: 413c:8154, 413c:8158, 413c:8162 -ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="01", ATTR{bInterfaceProtocol}=="02", \ - ATTRS{bDeviceClass}=="00", ATTRS{idVendor}=="413c", ATTRS{bmAttributes}=="e0", \ - RUN+="hid2hci --method=dell --devpath=%p", ENV{HID2HCI_SWITCH}="1" - -# Logitech devices -KERNEL=="hiddev*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[35e]", \ - RUN+="hid2hci --method=logitech-hid --devpath=%p" -KERNEL=="hidraw*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c70[4abc]|c71[34bc]", \ - RUN+="hid2hci --method=logitech-hid --devpath=%p" - -ENV{DEVTYPE}!="usb_device", GOTO="hid2hci_end" - -# When a Dell device recovers from S3, the mouse child needs to be repoked -# Unfortunately the only event seen is the BT device disappearing, so the mouse -# device needs to be chased down on the USB bus. -ATTR{bDeviceClass}=="e0", ATTR{bDeviceSubClass}=="01", ATTR{bDeviceProtocol}=="01", ATTR{idVendor}=="413c", \ - ENV{REMOVE_CMD}="/sbin/udevadm trigger --action=change --subsystem-match=usb --property-match=HID2HCI_SWITCH=1" - -# CSR devices -ATTR{idVendor}=="0a12|0458|05ac", ATTR{idProduct}=="1000", RUN+="hid2hci --method=csr --devpath=%p" - -LABEL="hid2hci_end" diff --git a/extras/hid2hci/hid2hci.c b/extras/hid2hci/hid2hci.c deleted file mode 100644 index 559c6f77b1..0000000000 --- a/extras/hid2hci/hid2hci.c +++ /dev/null @@ -1,346 +0,0 @@ -/* - * hid2hci : switch the radio on devices that support - * it from HID to HCI and back - * - * Copyright (C) 2003-2010 Marcel Holtmann - * Copyright (C) 2008-2009 Mario Limonciello - * Copyright (C) 2009-2011 Kay Sievers - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" - -enum mode { - HCI = 0, - HID = 1, -}; - -static int usb_switch_csr(struct usb_dev_handle *dev, enum mode mode) -{ - int err; - - err = usb_control_msg(dev, - USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, - 0, mode, 0, NULL, 0, 10000); - if (err == 0) { - err = -1; - errno = EALREADY; - } else { - if (errno == ETIMEDOUT) - err = 0; - } - return err; -} - -static int hid_logitech_send_report(int fd, const char *buf, size_t size) -{ - struct hiddev_report_info rinfo; - struct hiddev_usage_ref uref; - unsigned int i; - int err; - - for (i = 0; i < size; i++) { - memset(&uref, 0, sizeof(uref)); - uref.report_type = HID_REPORT_TYPE_OUTPUT; - uref.report_id = 0x10; - uref.field_index = 0; - uref.usage_index = i; - uref.usage_code = 0xff000001; - uref.value = buf[i] & 0x000000ff; - err = ioctl(fd, HIDIOCSUSAGE, &uref); - if (err < 0) - return err; - } - - memset(&rinfo, 0, sizeof(rinfo)); - rinfo.report_type = HID_REPORT_TYPE_OUTPUT; - rinfo.report_id = 0x10; - rinfo.num_fields = 1; - err = ioctl(fd, HIDIOCSREPORT, &rinfo); - - return err; -} - -static int hid_switch_logitech(const char *filename) -{ - char rep1[] = { 0xff, 0x80, 0x80, 0x01, 0x00, 0x00 }; - char rep2[] = { 0xff, 0x80, 0x00, 0x00, 0x30, 0x00 }; - char rep3[] = { 0xff, 0x81, 0x80, 0x00, 0x00, 0x00 }; - int fd; - int err = -1; - - fd = open(filename, O_RDWR); - if (fd < 0) - return err; - - err = ioctl(fd, HIDIOCINITREPORT, 0); - if (err < 0) - goto out; - - err = hid_logitech_send_report(fd, rep1, sizeof(rep1)); - if (err < 0) - goto out; - - err = hid_logitech_send_report(fd, rep2, sizeof(rep2)); - if (err < 0) - goto out; - - err = hid_logitech_send_report(fd, rep3, sizeof(rep3)); -out: - close(fd); - return err; -} - -static int usb_switch_dell(struct usb_dev_handle *dev, enum mode mode) -{ - char report[] = { 0x7f, 0x00, 0x00, 0x00 }; - int err; - - switch (mode) { - case HCI: - report[1] = 0x13; - break; - case HID: - report[1] = 0x14; - break; - } - - /* Don't need to check return, as might not be in use */ - usb_detach_kernel_driver_np(dev, 0); - - if (usb_claim_interface(dev, 0) < 0) - return -EIO; - - err = usb_control_msg(dev, - USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, - USB_REQ_SET_CONFIGURATION, 0x7f | (0x03 << 8), 0, - report, sizeof(report), 5000); - - if (err == 0) { - err = -1; - errno = EALREADY; - } else { - if (errno == ETIMEDOUT) - err = 0; - } - return err; -} - -/* - * libusb needs to scan and open all devices, just to to find the - * device we already have. This should be fixed in libusb. - */ -static struct usb_device *usb_device_open_from_udev(struct udev_device *usb_dev) -{ - struct usb_bus *bus; - const char *str; - int busnum; - int devnum; - - str = udev_device_get_sysattr_value(usb_dev, "busnum"); - if (str == NULL) - return NULL; - busnum = strtol(str, NULL, 0); - - str = udev_device_get_sysattr_value(usb_dev, "devnum"); - if (str == NULL) - return NULL; - devnum = strtol(str, NULL, 0); - - usb_init(); - usb_find_busses(); - usb_find_devices(); - - for (bus = usb_get_busses(); bus; bus = bus->next) { - struct usb_device *dev; - - if (strtol(bus->dirname, NULL, 10) != busnum) - continue; - - for (dev = bus->devices; dev; dev = dev->next) { - if (dev->devnum == devnum) - return dev; - } - } - - return NULL; -} - -static struct usb_dev_handle *find_device(struct udev_device *udev_dev) -{ - struct usb_device *dev; - - dev = usb_device_open_from_udev(udev_dev); - if (dev == NULL) - return NULL; - return usb_open(dev); -} - -static void usage(const char *error) -{ - if (error) - fprintf(stderr,"\n%s\n", error); - else - printf("hid2hci - Bluetooth HID to HCI mode switching utility\n\n"); - - printf("Usage: hid2hci [options]\n" - " --mode= mode to switch to [hid|hci] (default hci)\n" - " --devpath= sys device path\n" - " --method= method to use to switch [csr|logitech-hid|dell]\n" - " --help\n\n"); -} - -int main(int argc, char *argv[]) -{ - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - { "mode", required_argument, NULL, 'm' }, - { "devpath", required_argument, NULL, 'p' }, - { "method", required_argument, NULL, 'M' }, - { } - }; - enum method { - METHOD_UNDEF, - METHOD_CSR, - METHOD_LOGITECH_HID, - METHOD_DELL, - } method = METHOD_UNDEF; - struct udev *udev; - struct udev_device *udev_dev = NULL; - char syspath[PATH_MAX]; - int (*usb_switch)(struct usb_dev_handle *dev, enum mode mode) = NULL; - enum mode mode = HCI; - const char *devpath = NULL; - int err = -1; - int rc = 1; - - for (;;) { - int option; - - option = getopt_long(argc, argv, "m:p:M:h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'm': - if (!strcmp(optarg, "hid")) { - mode = HID; - } else if (!strcmp(optarg, "hci")) { - mode = HCI; - } else { - usage("error: undefined radio mode\n"); - exit(1); - } - break; - case 'p': - devpath = optarg; - break; - case 'M': - if (!strcmp(optarg, "csr")) { - method = METHOD_CSR; - usb_switch = usb_switch_csr; - } else if (!strcmp(optarg, "logitech-hid")) { - method = METHOD_LOGITECH_HID; - } else if (!strcmp(optarg, "dell")) { - method = METHOD_DELL; - usb_switch = usb_switch_dell; - } else { - usage("error: undefined switching method\n"); - exit(1); - } - break; - case 'h': - usage(NULL); - } - } - - if (!devpath || method == METHOD_UNDEF) { - usage("error: --devpath= and --method= must be defined\n"); - exit(1); - } - - udev = udev_new(); - if (udev == NULL) - goto exit; - - snprintf(syspath, sizeof(syspath), "%s/%s", udev_get_sys_path(udev), devpath); - udev_dev = udev_device_new_from_syspath(udev, syspath); - if (udev_dev == NULL) { - fprintf(stderr, "error: could not find '%s'\n", devpath); - goto exit; - } - - switch (method) { - case METHOD_CSR: - case METHOD_DELL: { - struct udev_device *dev; - struct usb_dev_handle *handle; - const char *type; - - /* get the parent usb_device if needed */ - dev = udev_dev; - type = udev_device_get_devtype(dev); - if (type == NULL || strcmp(type, "usb_device") != 0) { - dev = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_device"); - if (dev == NULL) { - fprintf(stderr, "error: could not find usb_device for '%s'\n", devpath); - goto exit; - } - } - - handle = find_device(dev); - if (handle == NULL) { - fprintf(stderr, "error: unable to handle '%s'\n", - udev_device_get_syspath(dev)); - goto exit; - } - err = usb_switch(handle, mode); - break; - } - case METHOD_LOGITECH_HID: { - const char *device; - - device = udev_device_get_devnode(udev_dev); - if (device == NULL) { - fprintf(stderr, "error: could not find hiddev device node\n"); - goto exit; - } - err = hid_switch_logitech(device); - break; - } - default: - break; - } - - if (err < 0) - fprintf(stderr, "error: switching device '%s' failed.\n", - udev_device_get_syspath(udev_dev)); -exit: - udev_device_unref(udev_dev); - udev_unref(udev); - return rc; -} -- cgit v1.2.3-54-g00ecf From 09d38845dabf70e1af1c26f4e36e7390251919b0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 29 Apr 2011 21:16:53 +0200 Subject: update TODO/NEWS --- NEWS | 10 ++++++++++ TODO | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/NEWS b/NEWS index 1d2bc43e25..184ab5eec8 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,13 @@ +udev 169 +======== +Bugfixes. + +The hid2hci tool move to the bluez package and was removed. + +Many of the extras can be -enabled/--disabled during configure +now. The --disable-extras option was removed. To check the +current options, the usual './configure --help' prints them. + udev 168 ======== Bugfixes. diff --git a/TODO b/TODO index 069f1ac9b7..261924956a 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,13 @@ + - read settle_timout from udev.conf + - db_persist -> lvm.git + - rules_generator: + - no longer rename netif in kernel namespace + - do not create rules on-the-fly, require explicit + configuration + - drop persistent optical names + - kill tabs? - remove deprecated trigger --type=failed logic -- cgit v1.2.3-54-g00ecf From 67a77c8bf299f6264f001677becd056316ebce2f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 May 2011 18:58:58 +0200 Subject: bump requirement to Linux kernel 2.6.32 and ARM 2.6.36 --- README | 17 +++++--- rules/misc/30-kernel-compat.rules | 92 +-------------------------------------- 2 files changed, 13 insertions(+), 96 deletions(-) diff --git a/README b/README index 34d1267430..c2271e9334 100644 --- a/README +++ b/README @@ -7,7 +7,7 @@ does not recommend replacing a distro's udev installation with the upstream version. The upstream udev project's set of default rules may require a most recent -kernel release to work properly. This is currently version 2.6.31. +kernel release to work properly. This is currently version 2.6.32. Tools and rules shipped by udev are not public API and may change at any time. Never call any private tool in /lib/udev from any external application; it might @@ -16,8 +16,13 @@ by udevadm and libudev. Tools and rules in /lib/udev and the entire contents of the /dev/.udev directory are private to udev and do change whenever needed. Requirements: - - Version 2.6.27 of the Linux kernel with sysfs, procfs, signalfd, inotify, - unix domain sockets, networking and hotplug enabled: + - Version 2.6.32 of the Linux kernel with sysfs, procfs, signalfd, inotify, + unix domain sockets, networking and hotplug enabled + + - ARM needs kernel version 2.6.36 or this patch: + http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=21d93e2e29722d7832f61cc56d73fb + + - These options are needed: CONFIG_HOTPLUG=y CONFIG_UEVENT_HELPER_PATH="" CONFIG_NET=y @@ -25,9 +30,11 @@ Requirements: CONFIG_SYSFS=y CONFIG_SYSFS_DEPRECATED*=n CONFIG_PROC_FS=y - CONFIG_TMPFS=y CONFIG_INOTIFY_USER=y CONFIG_SIGNALFD=y + + - These options might be needed: + CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes) CONFIG_BLK_DEV_BSG=y (SCSI devices) @@ -45,7 +52,7 @@ Requirements: be mounted at /sys. No other locations are supported by a standard udev installation. - - The system must have the following group names resolvable at udev startup: + - The default rule sset requires the following group names resolvable at udev startup: disk, cdrom, floppy, tape, audio, video, lp, tty, dialout, and kmem. Especially in LDAP setups, it is required that getgrnam() be able to resolve these group names with only the rootfs mounted and while no network is diff --git a/rules/misc/30-kernel-compat.rules b/rules/misc/30-kernel-compat.rules index 2a6a97c5f3..7240f9b234 100644 --- a/rules/misc/30-kernel-compat.rules +++ b/rules/misc/30-kernel-compat.rules @@ -1,102 +1,12 @@ # do not edit this file, it will be overwritten on update # Rules to support older kernels, which migth miss functionality needed -# for the recent udev version. +# for the recent udev rules. # # This file is used and maintained by Gentoo. -ACTION=="remove", GOTO="kernel_compat_end" - -# -# sysfs timing rules -# - -# needed for kernels <2.6.30 -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", WAIT_FOR="descriptors" - -# -# naming device rules -# - -# dvb device naming -# needed for kernels <2.6.29-rc1 -SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="", PROGRAM="/bin/sh -c 'K=%k; K=$${K#dvb}; printf dvb/adapter%%i/%%s $${K%%%%.*} $${K#*.}'", NAME="%c", GROUP="video" - -# naming rules for kernels <2.6.31 - -# alsa names -KERNEL=="controlC[0-9]*", NAME="snd/%k" -KERNEL=="hwC[D0-9]*", NAME="snd/%k" -KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k" -KERNEL=="midiC[D0-9]*", NAME="snd/%k" -KERNEL=="timer", NAME="snd/%k" -KERNEL=="seq", NAME="snd/%k" - -KERNEL=="mwave", NAME="modems/mwave" - -KERNEL=="mouse*|mice|event*", NAME="input/%k" -KERNEL=="ts[0-9]*|uinput", NAME="input/%k" -KERNEL=="js[0-9]*", NAME="input/%k" - -KERNEL=="card[0-9]*", NAME="dri/%k" - -SUBSYSTEM=="dvb", ENV{DVB_ADAPTER_NUM}=="?*", NAME="dvb/adapter$env{DVB_ADAPTER_NUM}/$env{DVB_DEVICE_TYPE}$env{DVB_DEVICE_NUM}" - -# libusb device nodes -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", NAME="bus/usb/$env{BUSNUM}/$env{DEVNUM}" - -# printer -SUBSYSTEM=="usb", KERNEL=="lp*", NAME="usb/%k" - -# block -KERNEL=="pktcdvd[0-9]*", NAME="pktcdvd/%k" -KERNEL=="pktcdvd", NAME="pktcdvd/control" - -KERNEL=="rawctl", NAME="raw/rawctl" -SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k" -SUBSYSTEM=="bsg", NAME="bsg/%k" -SUBSYSTEM=="aoe", NAME="etherd/%k" - -# network -KERNEL=="tun", NAME="net/%k" - -# CPU -KERNEL=="cpu[0-9]*", NAME="cpu/%n/cpuid" -KERNEL=="msr[0-9]*", NAME="cpu/%n/msr" -KERNEL=="microcode", NAME="cpu/microcode", MODE="0600" - -# miscellaneous -KERNEL=="auer[0-9]*", NAME="usb/%k" -KERNEL=="hw_random", NAME="hwrng" -KERNEL=="sxctl", NAME="specialix_sxctl" -KERNEL=="rioctl", NAME="specialix_rioctl" -KERNEL=="iowarrior[0-9]*", NAME="usb/%k" -KERNEL=="hiddev[0-9]*", NAME="usb/%k" -KERNEL=="legousbtower[0-9]*", NAME="usb/%k" -KERNEL=="dabusb[0-9]*", NAME="usb/%k" -KERNEL=="usbdpfp[0-9]*", NAME="usb/%k" -KERNEL=="cpad[0-9]*", NAME="usb/%k" - -# end of naming rules for kernel <2.6.31 - - -# -# module loading rules -# ACTION!="add", GOTO="kernel_compat_end" -# No need for more code, as MODALIAS is present -ENV{MODALIAS}=="?*", GOTO="kernel_compat_end" - -# needed for kernel <2.6.30-rc1 -SUBSYSTEM=="scsi", ATTR{type}=="8", RUN+="/sbin/modprobe -b ch" -SUBSYSTEM=="mmc", RUN+="/sbin/modprobe -b mmc_block" - -# needed for kernel <2.6.27-rc5 -# acpi will do on newer kernels -SUBSYSTEM=="pnp", DRIVER!="?*", \ - RUN{ignore_error}+="/bin/sh -c '/sbin/modprobe -a $$(while read id; do echo pnp:d$$id; done < /sys$devpath/id)'" - # see extras/qemu/42-qemu-usb.rules, version for 2.6.32 + older. ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" -- cgit v1.2.3-54-g00ecf From 1547687a83334b056fdf06ed0c5676e948eafb30 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 May 2011 19:17:09 +0200 Subject: libudev: ctrl - log accept4() errors --- libudev/libudev-ctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c index a2133fff1c..61e0243383 100644 --- a/libudev/libudev-ctrl.c +++ b/libudev/libudev-ctrl.c @@ -184,8 +184,10 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) conn->refcount = 1; conn->uctrl = uctrl; - conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC); + conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); if (conn->sock < 0) { + if (errno != EINTR) + err(uctrl->udev, "unable to receive ctrl connection: %m\n"); free(conn); return NULL; } -- cgit v1.2.3-54-g00ecf From ab7863f7d74ca1952b6173d2d04ab89f95253fb5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 May 2011 19:47:12 +0200 Subject: update NEWS --- NEWS | 4 ++++ README | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 184ab5eec8..c00c48ed07 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,10 @@ udev 169 ======== Bugfixes. +We require at least Linux kernel 2.6.32 now. Some platforms might +require a later kernel that supports accept4(), or need to backport +the accept4() syscall wiring. + The hid2hci tool move to the bluez package and was removed. Many of the extras can be -enabled/--disabled during configure diff --git a/README b/README index c2271e9334..f856370685 100644 --- a/README +++ b/README @@ -19,8 +19,8 @@ Requirements: - Version 2.6.32 of the Linux kernel with sysfs, procfs, signalfd, inotify, unix domain sockets, networking and hotplug enabled - - ARM needs kernel version 2.6.36 or this patch: - http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=21d93e2e29722d7832f61cc56d73fb + - Some architectures might need a later kernel, that supports accept4(), + or need to backport the accept4() syscall wiring in the kernel. - These options are needed: CONFIG_HOTPLUG=y -- cgit v1.2.3-54-g00ecf From 16efbde01ada6869c41426af673550bb7ddbebf8 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Tue, 10 May 2011 13:40:39 +0200 Subject: configure: reintroduce introspection flags to fix crosscompilation --- Makefile.am | 2 ++ configure.ac | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/Makefile.am b/Makefile.am index 63bd2bf329..651a15455c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -433,6 +433,7 @@ extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gud $(AM_V_GEN)glib-mkenums --template $^ > \ $@.tmp && mv $@.tmp $@ +if ENABLE_INTROSPECTION extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ LD_LIBRARY_PATH=$(top_builddir)/extras/gudev:$$LD_LIBRARY_PATH \ @@ -470,6 +471,7 @@ typelibsdir = $(GIRTYPELIBDIR) typelibs_DATA = extras/gudev/GUdev-1.0.typelib CLEANFILES += $(gir_DATA) $(typelibs_DATA) +endif # ENABLE_INTROSPECTION # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed libgudev-install-move-hook: diff --git a/configure.ac b/configure.ac index a2a042ba60..357806a0f4 100644 --- a/configure.ac +++ b/configure.ac @@ -136,14 +136,22 @@ if test "x$enable_gudev" = xyes; then PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) AC_SUBST([GLIB_CFLAGS]) AC_SUBST([GLIB_LIBS]) +fi +AC_ARG_ENABLE([introspection], + AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), + [], [enable_introspection=yes]) +if test "x$enable_introspection" = xyes; then PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) + AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) fi +AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) + AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = xyes]) # ------------------------------------------------------------------------------ @@ -235,6 +243,7 @@ AC_MSG_RESULT([ cflags: ${CFLAGS} ldflags: ${LDFLAGS} + gintrospection: ${enable_introspection} rule_generator: ${enable_rule_generator} hwdb: ${enable_hwdb} udev_acl: ${enable_udev_acl} -- cgit v1.2.3-54-g00ecf From 2906cbbae4d97291c1cfc456cf132726fffd8fc0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 May 2011 14:58:49 +0200 Subject: update INSTALL, NEWS, configure comment, queue doc --- INSTALL | 2 ++ NEWS | 2 +- configure.ac | 2 +- libudev/libudev-queue.c | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/INSTALL b/INSTALL index 2ea4ba50cb..7341272e68 100644 --- a/INSTALL +++ b/INSTALL @@ -35,6 +35,8 @@ All options: Disable local user acl permissions support. --disable-gudev Disable Gobject libudev support. + --disable-introspection + Disable Gobject introspection support. --disable-keymap Disable keymap fixup support. --enable-floppy diff --git a/NEWS b/NEWS index c00c48ed07..16a41a9bbb 100644 --- a/NEWS +++ b/NEWS @@ -8,7 +8,7 @@ the accept4() syscall wiring. The hid2hci tool move to the bluez package and was removed. -Many of the extras can be -enabled/--disabled during configure +Many of the extras can be --enabled/--disabled during configure now. The --disable-extras option was removed. To check the current options, the usual './configure --help' prints them. diff --git a/configure.ac b/configure.ac index 357806a0f4..22e0835919 100644 --- a/configure.ac +++ b/configure.ac @@ -243,11 +243,11 @@ AC_MSG_RESULT([ cflags: ${CFLAGS} ldflags: ${LDFLAGS} - gintrospection: ${enable_introspection} rule_generator: ${enable_rule_generator} hwdb: ${enable_hwdb} udev_acl: ${enable_udev_acl} gudev: ${enable_gudev} + gintrospection: ${enable_introspection} keymap: ${enable_keymap} floppy: ${enable_floppy} edd: ${enable_edd} diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index ead05c5184..be6409d02a 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -343,7 +343,7 @@ out: * @start: first event sequence number * @end: last event sequence number * - * Returns: if any of the sequence numbers in the given range is currently active. + * Returns: a flag indicating if any of the sequence numbers in the given range is currently active. **/ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end) @@ -405,7 +405,7 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, * @udev_queue: udev queue context * @seqnum: sequence number * - * Returns: a flag indicating if the given sequence number is handled. + * Returns: a flag indicating if the given sequence number is currently active. **/ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) { -- cgit v1.2.3-54-g00ecf From df2ee940d8852b63756e015cfb755e6454dd4f1b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 May 2011 13:15:41 +0200 Subject: update TODO --- TODO | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/TODO b/TODO index 261924956a..7416c6f670 100644 --- a/TODO +++ b/TODO @@ -1,15 +1,19 @@ - - read settle_timout from udev.conf + - support kernel-supplied DEVMODE= - - db_persist -> lvm.git + - /run/udev/control socket - - rules_generator: - - no longer rename netif in kernel namespace - - do not create rules on-the-fly, require explicit - configuration - - drop persistent optical names + - read settle_timout from udev.conf - - kill tabs? + - db_persist -> lvm.git? - - remove deprecated trigger --type=failed logic + - rules_generator: + - no longer rename netif in kernel namespace + - do not create rules on-the-fly, require explicit + configuration + - drop persistent optical names - - remove deprecated BUS=, SYSFS{}=, ID= keys + - kill tabs? + + - remove deprecated trigger --type=failed logic + + - remove deprecated BUS=, SYSFS{}=, ID= keys -- cgit v1.2.3-54-g00ecf From 2738ec2cf721db0c0deac2ba0abdc73cf7739e9f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 May 2011 13:17:48 +0200 Subject: udevd: create queue file before daemonizing to reliably block 'settle' --- udev/udevd.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index be4b071ebb..258d7870eb 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1408,6 +1408,13 @@ int main(int argc, char *argv[]) udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); + /* create queue file before signalling 'ready', to make sure we block 'settle' */ + udev_queue_export = udev_queue_export_new(udev); + if (udev_queue_export == NULL) { + err(udev, "error creating queue file\n"); + goto exit; + } + if (daemonize) { pid_t pid; int fd; @@ -1421,8 +1428,8 @@ int main(int argc, char *argv[]) rc = 4; goto exit; default: - rc = 0; - goto exit; + rc = EXIT_SUCCESS; + goto exit_keep_queue; } setsid(); @@ -1521,12 +1528,6 @@ int main(int argc, char *argv[]) goto exit; } - udev_queue_export = udev_queue_export_new(udev); - if (udev_queue_export == NULL) { - err(udev, "error creating queue file\n"); - goto exit; - } - memset(&ep_ctrl, 0, sizeof(struct epoll_event)); ep_ctrl.events = EPOLLIN; ep_ctrl.data.fd = fd_ctrl; @@ -1708,9 +1709,10 @@ int main(int argc, char *argv[]) } } - udev_queue_export_cleanup(udev_queue_export); - rc = 0; + rc = EXIT_SUCCESS; exit: + udev_queue_export_cleanup(udev_queue_export); +exit_keep_queue: if (fd_ep >= 0) close(fd_ep); worker_list_cleanup(udev); -- cgit v1.2.3-54-g00ecf From f0fa13d7f7fdb8fb064c55a23c5c461b12f009b2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 May 2011 13:18:28 +0200 Subject: udevd: remove left-over SIGALRM --- udev/udevd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index 258d7870eb..e7384e19a2 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -365,9 +365,6 @@ static void worker_new(struct event *event) switch (fdsi.ssi_signo) { case SIGTERM: goto out; - case SIGALRM: - rc = EXIT_FAILURE; - goto out; } } } -- cgit v1.2.3-54-g00ecf From 079de714754b1e058f57220281e7f901d4c826d6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 May 2011 16:24:08 +0200 Subject: gudev: silent gtk-doc warnings --- extras/gudev/docs/gudev-docs.xml | 2 +- extras/gudev/docs/gudev-sections.txt | 19 +++++++++++++++++++ extras/gudev/gudevclient.c | 2 ++ extras/gudev/gudevclient.h | 1 - extras/gudev/gudevdevice.h | 1 - extras/gudev/gudevenumerator.h | 1 - 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/extras/gudev/docs/gudev-docs.xml b/extras/gudev/docs/gudev-docs.xml index 3a93b21720..65fdfff8e5 100644 --- a/extras/gudev/docs/gudev-docs.xml +++ b/extras/gudev/docs/gudev-docs.xml @@ -29,7 +29,7 @@ - 2009 + 2011 The GUDev Authors diff --git a/extras/gudev/docs/gudev-sections.txt b/extras/gudev/docs/gudev-sections.txt index 181870fb5a..213e1a7465 100644 --- a/extras/gudev/docs/gudev-sections.txt +++ b/extras/gudev/docs/gudev-sections.txt @@ -19,6 +19,8 @@ g_udev_client_get_type G_UDEV_CLIENT_CLASS G_UDEV_IS_CLIENT_CLASS G_UDEV_CLIENT_GET_CLASS + +GUdevClientPrivate
            @@ -65,6 +67,8 @@ g_udev_device_get_type G_UDEV_DEVICE_CLASS G_UDEV_IS_DEVICE_CLASS G_UDEV_DEVICE_GET_CLASS + +GUdevDevicePrivate
            @@ -91,4 +95,19 @@ g_udev_enumerator_get_type G_UDEV_ENUMERATOR_CLASS G_UDEV_IS_ENUMERATOR_CLASS G_UDEV_ENUMERATOR_GET_CLASS + +GUdevEnumeratorPrivate +
            + +
            +gudevmarshal + +g_udev_marshal_VOID__STRING_OBJECT +
            + +
            +gudevenumtypes + +G_TYPE_UDEV_DEVICE_TYPE +g_udev_device_type_get_type
            diff --git a/extras/gudev/gudevclient.c b/extras/gudev/gudevclient.c index 853454b6f0..97b951adcd 100644 --- a/extras/gudev/gudevclient.c +++ b/extras/gudev/gudevclient.c @@ -460,6 +460,8 @@ g_udev_client_query_by_device_file (GUdevClient *client, * @sysfs_path: A sysfs path. * * Looks up a device for a sysfs path. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_sysfs_path (GUdevClient *client, diff --git a/extras/gudev/gudevclient.h b/extras/gudev/gudevclient.h index 6e365c6d35..b425d03d48 100644 --- a/extras/gudev/gudevclient.h +++ b/extras/gudev/gudevclient.h @@ -41,7 +41,6 @@ typedef struct _GUdevClientPrivate GUdevClientPrivate; /** * GUdevClient: - * @parent: Parent instance. * * The #GUdevClient struct is opaque and should not be accessed directly. */ diff --git a/extras/gudev/gudevdevice.h b/extras/gudev/gudevdevice.h index ab22371ded..d4873bad0f 100644 --- a/extras/gudev/gudevdevice.h +++ b/extras/gudev/gudevdevice.h @@ -41,7 +41,6 @@ typedef struct _GUdevDevicePrivate GUdevDevicePrivate; /** * GUdevDevice: - * @parent: Parent instance. * * The #GUdevDevice struct is opaque and should not be accessed directly. */ diff --git a/extras/gudev/gudevenumerator.h b/extras/gudev/gudevenumerator.h index ed54dbfc66..3fddccf573 100644 --- a/extras/gudev/gudevenumerator.h +++ b/extras/gudev/gudevenumerator.h @@ -41,7 +41,6 @@ typedef struct _GUdevEnumeratorPrivate GUdevEnumeratorPrivate; /** * GUdevEnumerator: - * @parent: Parent instance. * * The #GUdevEnumerator struct is opaque and should not be accessed directly. * -- cgit v1.2.3-54-g00ecf From 85e172c9bd223e08f31b466f86df3cca2b517216 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 May 2011 18:11:50 +0200 Subject: cdrom_id: remove unused --export switch to silent gcc --- extras/cdrom_id/60-cdrom_id.rules | 2 +- extras/cdrom_id/cdrom_id.c | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index aedf6f0558..1ad1d0cc23 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -9,6 +9,6 @@ ENV{DEVTYPE}!="disk", GOTO="cdrom_end" ENV{DISK_EJECT_REQUEST}=="?*", GOTO="cdrom_end" KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" -IMPORT{program}="cdrom_id --export $tempnode" +IMPORT{program}="cdrom_id $tempnode" LABEL="cdrom_end" diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index b2f897e3b5..7908f6d19a 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -825,13 +825,11 @@ int main(int argc, char *argv[]) { struct udev *udev; static const struct option options[] = { - { "export", no_argument, NULL, 'x' }, { "debug", no_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, {} }; const char *node = NULL; - int export = 0; int fd = -1; int cnt; int rc = 0; @@ -846,7 +844,7 @@ int main(int argc, char *argv[]) while (1) { int option; - option = getopt_long(argc, argv, "dxh", options, NULL); + option = getopt_long(argc, argv, "dh", options, NULL); if (option == -1) break; @@ -856,12 +854,8 @@ int main(int argc, char *argv[]) if (udev_get_log_priority(udev) < LOG_INFO) udev_set_log_priority(udev, LOG_INFO); break; - case 'x': - export = 1; - break; case 'h': printf("Usage: cdrom_id [options] \n" - " --export export key/value pairs\n" " --debug debug to stderr\n" " --help print this help text\n\n"); goto exit; -- cgit v1.2.3-54-g00ecf From 4b718be86db37a37c83793ca410e8d9968e615f2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 May 2011 19:13:42 +0200 Subject: libudev: queue - always rebuild queue file when nothing is queued anymore --- Makefile.am | 2 +- libudev/libudev-queue-private.c | 17 +++++++++-------- udev/udevadm-settle.c | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/Makefile.am b/Makefile.am index 651a15455c..0a340aa391 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,7 +36,7 @@ dist_libexec_SCRIPTS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=11 -LIBUDEV_REVISION=3 +LIBUDEV_REVISION=4 LIBUDEV_AGE=11 SUBDIRS += libudev/docs diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index a799be062a..0dcf9b0020 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -164,7 +164,7 @@ static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_e devpaths->devpaths_size = range + 1; /* read all records and populate the table */ - while(1) { + for (;;) { if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) break; n = seqnum - udev_queue_export->seqnum_max; @@ -303,8 +303,10 @@ static int write_queue_record(struct udev_queue_export *udev_queue_export, len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) goto write_error; - if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) - goto write_error; + if (len > 0) { + if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) + goto write_error; + } /* *must* flush output; caller may fork */ if (fflush(udev_queue_export->queue_file) != 0) @@ -342,6 +344,7 @@ static int update_queue(struct udev_queue_export *udev_queue_export, int bytes; int err; + /* FINISHED records have a zero length devpath */ if (state == DEVICE_QUEUED) { devpath = udev_device_get_devpath(udev_device); devpath_len = strlen(devpath); @@ -353,12 +356,9 @@ static int update_queue(struct udev_queue_export *udev_queue_export, return -1; } - /* when the queue file grows too large, garbage-collect and rebuild it */ - bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); - /* if we're removing the last event from the queue, that's the best time to rebuild it */ - if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1 && bytes > 2048) { - /* because we don't need to read the old queue file */ + if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1) { + /* we don't need to read the old queue file */ fclose(udev_queue_export->queue_file); udev_queue_export->queue_file = NULL; rebuild_queue_file(udev_queue_export); @@ -366,6 +366,7 @@ static int update_queue(struct udev_queue_export *udev_queue_export, } /* try to rebuild the queue files before they grow larger than one page. */ + bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) rebuild_queue_file(udev_queue_export); diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 9492abd401..b717ae60de 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -153,7 +153,7 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (pfd[0].fd < 0) { err(udev, "inotify_init failed: %m\n"); } else { - if (inotify_add_watch(pfd[0].fd, udev_get_run_path(udev), IN_CLOSE_WRITE) < 0) { + if (inotify_add_watch(pfd[0].fd, udev_get_run_path(udev), IN_MOVED_TO) < 0) { err(udev, "watching '%s' failed\n", udev_get_run_path(udev)); close(pfd[0].fd); pfd[0].fd = -1; -- cgit v1.2.3-54-g00ecf From 3cf1a8e36ed0d9bb9b000adf36dd347e8d988478 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 May 2011 22:04:02 +0200 Subject: libudev: device - use DEVMODE from kernel as the default mode --- TODO | 2 -- libudev/libudev-device.c | 22 ++++++++++++++++++++++ libudev/libudev-private.h | 2 ++ libudev/test-libudev.c | 2 +- test/udev-test.pl | 2 +- udev/udev-event.c | 16 ++++++++++++---- udev/udev-rules.c | 18 +++++++++++------- udev/udev.h | 1 + 8 files changed, 50 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index 7416c6f670..2d43162095 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - - support kernel-supplied DEVMODE= - - /run/udev/control socket - read settle_timout from udev.conf diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index ffde21ad57..d57a9eb597 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -51,6 +51,7 @@ struct udev_device { char *sysname; const char *sysnum; char *devnode; + mode_t devnode_mode; char *subsystem; char *devtype; char *driver; @@ -199,6 +200,8 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10)); } else if (strncmp(property, "IFINDEX=", 8) == 0) { udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10)); + } else if (strncmp(property, "DEVMODE=", 8) == 0) { + udev_device_set_devnode_mode(udev_device, strtoul(&property[8], NULL, 8)); } else { udev_device_add_property_from_string(udev_device, property); } @@ -343,6 +346,8 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); else if (strncmp(line, "DEVNAME=", 8) == 0) udev_device_set_knodename(udev_device, &line[8]); + else if (strncmp(line, "DEVMODE=", 8) == 0) + udev_device->devnode_mode = strtoul(&line[8], NULL, 8); udev_device_add_property_from_string(udev_device, line); } @@ -930,6 +935,13 @@ const char *udev_device_get_devnode(struct udev_device *udev_device) return udev_device->devnode; } +mode_t udev_device_get_devnode_mode(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnode_mode; +} + /** * udev_device_get_subsystem: * @udev_device: udev device @@ -1414,6 +1426,16 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode return 0; } +int udev_device_set_devnode_mode(struct udev_device *udev_device, mode_t mode) +{ + char num[32]; + + udev_device->devnode_mode = mode; + snprintf(num, sizeof(num), "%#o", mode); + udev_device_add_property(udev_device, "DEVMODE", num); + return 0; +} + int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique) { struct udev_list_entry *list_entry; diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 2fcfe4131c..39b46dde31 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -69,6 +69,8 @@ struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); /* libudev-device.c */ struct udev_device *udev_device_new(struct udev *udev); struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id); +mode_t udev_device_get_devnode_mode(struct udev_device *udev_device); +int udev_device_set_devnode_mode(struct udev_device *udev_device, mode_t mode); int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype); diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index 4192ba14b2..966a406507 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -221,7 +221,7 @@ static int test_enumerate_print_list(struct udev_enumerate *enumerate) static int test_monitor(struct udev *udev) { - struct udev_monitor *udev_monitor; + struct udev_monitor *udev_monitor = NULL; int fd_ep; int fd_udev = -1; struct epoll_event ep_udev, ep_stdin; diff --git a/test/udev-test.pl b/test/udev-test.pl index 4103cf0bff..4322da5ecd 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1487,7 +1487,7 @@ EOF subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", - exp_perms => "0:0:0600", + exp_perms => "0:0:0440", exp_rem_error => "yes", rules => <mode = 0600; event->dev = dev; event->udev = udev_device_get_udev(dev); udev_list_init(&event->run_list); @@ -1021,9 +1020,18 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, if (event->dev_db != NULL) udev_node_update_old_links(dev, event->dev_db); - /* change default 0600 to 0660 if a group is assigned */ - if (event->mode == 0600 && event->gid > 0) - event->mode = 0660; + if (!event->mode_set) { + if (udev_device_get_devnode_mode(dev) > 0) { + /* kernel supplied value */ + event->mode = udev_device_get_devnode_mode(dev); + } else if (event->gid > 0) { + /* default 0660 if a group is assigned */ + event->mode = 0660; + } else { + /* default 0600 */ + event->mode = 0600; + } + } err = udev_node_add(dev, event->mode, event->uid, event->gid); } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 892d8f27a7..63123e083a 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2443,19 +2443,22 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event } case TK_A_MODE: { - char mode[UTIL_NAME_SIZE]; + char mode_str[UTIL_NAME_SIZE]; + mode_t mode; char *endptr; if (event->mode_final) break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->mode_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode, sizeof(mode)); - event->mode = strtol(mode, &endptr, 8); + udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode_str, sizeof(mode_str)); + mode = strtol(mode_str, &endptr, 8); if (endptr[0] != '\0') { - err(event->udev, "invalide mode '%s' set default mode 0600\n", mode); - event->mode = 0600; + err(event->udev, "ignoring invalid mode '%s'\n", mode_str); + break; } + if (cur->key.op == OP_ASSIGN_FINAL) + event->mode_final = true; + event->mode_set = true; + event->mode = mode; info(event->udev, "MODE %#o %s:%u\n", event->mode, &rules->buf[rule->rule.filename_off], @@ -2489,6 +2492,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; if (cur->key.op == OP_ASSIGN_FINAL) event->mode_final = true; + event->mode_set = true; event->mode = cur->key.mode; info(event->udev, "MODE %#o %s:%u\n", event->mode, diff --git a/udev/udev.h b/udev/udev.h index 16a029e486..88c32ec203 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -49,6 +49,7 @@ struct udev_event { bool inotify_watch_final; bool group_final; bool owner_final; + bool mode_set; bool mode_final; bool name_final; bool devlink_final; -- cgit v1.2.3-54-g00ecf From 12f79fb0b9c919787d8a7d4307895d3d6b4b029b Mon Sep 17 00:00:00 2001 From: Nix Date: Mon, 16 May 2011 22:51:38 +0200 Subject: libudev: queue - accept NULL passed into udev_queue_export_cleanup() --- libudev/libudev-queue-private.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 0dcf9b0020..6e13d8a3d9 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -104,9 +104,10 @@ void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) { char filename[UTIL_PATH_SIZE]; + if (udev_queue_export == NULL) + return; util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); unlink(filename); - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); unlink(filename); } -- cgit v1.2.3-54-g00ecf From bc71e44dbe17c0efba792616d44a882fe371d70e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 17 May 2011 20:28:30 +0200 Subject: update TODO --- TODO | 4 ---- 1 file changed, 4 deletions(-) diff --git a/TODO b/TODO index 2d43162095..0ccdcc11d7 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,5 @@ - /run/udev/control socket - - read settle_timout from udev.conf - - - db_persist -> lvm.git? - - rules_generator: - no longer rename netif in kernel namespace - do not create rules on-the-fly, require explicit -- cgit v1.2.3-54-g00ecf From f34939e79b77c324f4c294429d01f69387d24e2e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 18 May 2011 04:01:17 +0200 Subject: udate TODO, NEWS, INSTALL --- INSTALL | 2 +- NEWS | 13 +++++++------ TODO | 4 ++++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/INSTALL b/INSTALL index 7341272e68..5d3087e438 100644 --- a/INSTALL +++ b/INSTALL @@ -23,7 +23,7 @@ All options: --disable-logging Disable all logging and compile-out all log strings. This is not recommended, as it makes it almost impossible to debug - udev in the running system. + udev on the running system. --with-selinux Link against SELinux libraries to set the expected context for created files. diff --git a/NEWS b/NEWS index 16a41a9bbb..a39f7d1cc1 100644 --- a/NEWS +++ b/NEWS @@ -3,14 +3,15 @@ udev 169 Bugfixes. We require at least Linux kernel 2.6.32 now. Some platforms might -require a later kernel that supports accept4(), or need to backport -the accept4() syscall wiring. +require a later kernel that supports accept4() and similar, or +need to backport the trivial syscall wiring to the older kernels. -The hid2hci tool move to the bluez package and was removed. +The hid2hci tool moved to the bluez package and was removed. -Many of the extras can be --enabled/--disabled during configure -now. The --disable-extras option was removed. To check the -current options, the usual './configure --help' prints them. +Many of the extras can be --enable/--disabled at ./configure +time. The --disable-extras option was removed. Some extras have +been disabled by default. The current options and their defaults +can be checked with './configure --help'. udev 168 ======== diff --git a/TODO b/TODO index 0ccdcc11d7..c5dee4a7cb 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,8 @@ + - delete mobile-action-modeswitch + (moved to usb_modeswitch) + - /run/udev/control socket + (add ConditionVirtualization=!pidns) - rules_generator: - no longer rename netif in kernel namespace -- cgit v1.2.3-54-g00ecf From f0ed90b7678045759ffa2a44d2b4cac96968b077 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 18 May 2011 18:29:24 +0200 Subject: build: use --gc-sections, -fvisibility=hidden After: # ls -l /sbin/udevadm /sbin/udevd /lib/udev/*_id -rwxr-xr-x 1 root root 22984 May 18 18:19 /lib/udev/ata_id -rwxr-xr-x 1 root root 31208 May 18 18:19 /lib/udev/cdrom_id -rwxr-xr-x 1 root root 27128 May 18 18:19 /lib/udev/input_id -rwxr-xr-x 1 root root 31272 May 18 18:19 /lib/udev/path_id -rwxr-xr-x 1 root root 31896 May 18 18:19 /lib/udev/scsi_id -rwxr-xr-x 1 root root 35456 May 18 18:19 /lib/udev/usb_id -rwxr-xr-x 1 root root 6416 May 18 18:19 /lib/udev/v4l_id -rwxr-xr-x 1 root root 130320 May 18 18:19 /sbin/udevadm -rwxr-xr-x 1 root root 134648 May 18 18:19 /sbin/udevd Before: # ls -l /sbin/udevadm /sbin/udevd /lib/udev/*_id -rwxr-xr-x 1 root root 27208 May 18 18:22 /lib/udev/ata_id -rwxr-xr-x 1 root root 35456 May 18 18:22 /lib/udev/cdrom_id -rwxr-xr-x 1 root root 39584 May 18 18:22 /lib/udev/input_id -rwxr-xr-x 1 root root 39600 May 18 18:22 /lib/udev/path_id -rwxr-xr-x 1 root root 36056 May 18 18:22 /lib/udev/scsi_id -rwxr-xr-x 1 root root 43712 May 18 18:22 /lib/udev/usb_id -rwxr-xr-x 1 root root 6504 May 18 18:22 /lib/udev/v4l_id -rwxr-xr-x 1 root root 142656 May 18 18:22 /sbin/udevadm -rwxr-xr-x 1 root root 142888 May 18 18:22 /sbin/udevd --- Makefile.am | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0a340aa391..1b0d6a3797 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,13 @@ AM_CPPFLAGS = \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DLIBEXECDIR=\""$(libexecdir)"\" +AM_CFLAGS = \ + -fvisibility=hidden \ + -ffunction-sections \ + -fdata-sections + AM_LDFLAGS = \ + -Wl,--gc-sections \ -Wl,--as-needed DISTCHECK_CONFIGURE_FLAGS = \ @@ -54,6 +60,9 @@ libudev_libudev_la_SOURCES =\ libudev/libudev-monitor.c \ libudev/libudev-queue.c +libudev_libudev_la_CFLAGS = \ + -fvisibility=default + libudev_libudev_la_LDFLAGS = \ -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \ -export-symbols $(top_srcdir)/libudev/exported_symbols @@ -404,7 +413,11 @@ extras_gudev_libgudev_1_0_la_CPPFLAGS = \ -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ -D_GUDEV_COMPILATION \ -DG_LOG_DOMAIN=\"GUdev\" -extras_gudev_libgudev_1_0_la_CFLAGS = $(GLIB_CFLAGS) + +extras_gudev_libgudev_1_0_la_CFLAGS = \ + -fvisibility=default \ + $(GLIB_CFLAGS) + extras_gudev_libgudev_1_0_la_LIBADD = libudev/libudev.la $(GLIB_LIBS) extras_gudev_libgudev_1_0_la_LDFLAGS = \ @@ -434,20 +447,20 @@ extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gud $@.tmp && mv $@.tmp $@ if ENABLE_INTROSPECTION -extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) Makefile.am - $(AM_V_GEN)PKG_CONFIG_PATH=$(top_builddir)/data:$$PKG_CONFIG_PATH \ - LD_LIBRARY_PATH=$(top_builddir)/extras/gudev:$$LD_LIBRARY_PATH \ - $(G_IR_SCANNER) -v \ +extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) + $(AM_V_GEN)$(G_IR_SCANNER) -v \ + --warn-all \ --namespace GUdev \ --nsversion=1.0 \ --include=GObject-2.0 \ --library=gudev-1.0 \ - --library-path=extras/gudev \ + --library-path=$(top_builddir)/libudev \ + --library-path=$(top_builddir)/extras/gudev \ --output $@ \ --pkg=glib-2.0 \ --pkg=gobject-2.0 \ - -I$(top_builddir)/extras \ -I$(top_srcdir)/extras \ + -I$(top_builddir)/extras \ -D_GUDEV_COMPILATION \ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ $(top_srcdir)/extras/gudev/gudev.h \ -- cgit v1.2.3-54-g00ecf From bd8e0e387d844bd5b7d8c29ca2871c824c0fc146 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 18 May 2011 18:58:04 +0200 Subject: udevadm: settle: wake up more often if --seq-start= or --exit-if-exists= is used --- udev/udevadm-settle.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index b717ae60de..053a3bba33 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -183,8 +183,15 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) } if (pfd[0].fd >= 0) { - /* wake up once every second, or whenever the queue file gets gets closed */ - if (poll(pfd, 1, 1000) > 0 && pfd[0].revents & POLLIN) { + int delay; + + /* wake up after delay, or immediately after the queue is rebuilt */ + + if (exists != NULL || start > 0) + delay = 100; + else + delay = 1000; + if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) { char buf[sizeof(struct inotify_event) + PATH_MAX]; read(pfd[0].fd, buf, sizeof(buf)); -- cgit v1.2.3-54-g00ecf From 2661ff211706bc689617924e446a0d4c3f210da9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 18 May 2011 19:05:06 +0200 Subject: release 169 --- ChangeLog | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 2 +- udev/udevadm-settle.c | 3 +- 3 files changed, 78 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed80c4e43c..7b5ff364fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,79 @@ +Summary of changes from v168 to v169 +============================================ + +Kay Sievers (26): + simplify rules file overwrite logic + libudev: list - use bit flags for 'sort' and 'unique' + libudev: queue - _unref() should return the object + remove dead fstab_import files + hid2hci: prepare move to bluez package + set event timeout to 60 sec and settle timeout to 120 + udevd: improve error message in case exec() fails + configure: allow to enable/disable extras individually + delete hid2hci which moved to the bluez tree + update TODO/NEWS + bump requirement to Linux kernel 2.6.32 and ARM 2.6.36 + libudev: ctrl - log accept4() errors + update NEWS + update INSTALL, NEWS, configure comment, queue doc + update TODO + udevd: create queue file before daemonizing to reliably block 'settle' + udevd: remove left-over SIGALRM + gudev: silent gtk-doc warnings + cdrom_id: remove unused --export switch to silent gcc + libudev: queue - always rebuild queue file when nothing is queued anymore + libudev: device - use DEVMODE from kernel as the default mode + update TODO + Merge branch 'docs/udev.xml' of git://github.com/mfwitten/udev + udate TODO, NEWS, INSTALL + build: use --gc-sections, -fvisibility=hidden + udevadm: settle: wake up more often if --seq-start= or --exit-if-exists= is used + +Koen Kooi (1): + configure: reintroduce introspection flags to fix crosscompilation + +Michael Witten (36): + Docs: udev.xml: Offset daemon name with commas + Docs: udev.xml: Remove commas (and unnecessary repetition) + Docs: udev.xml: `are' -> `is'; the subject is `Access' + Docs: udev.xml: Use present tense + Docs: udev.xml: Clarification through proper wording + Docs: udev.xml: `,' -> `;' + Docs: udev.xml: `key value' -> `key-value' + Docs: udev.xml: `,' -> `:' + Docs: udev.xml: Use `assignment' consistently + Docs: udev.xml: `comma-separated' is a better description + Docs: udev.xml: Remove unnecessary repitition + Docs: udev.xml: Add a few more words for context + Docs: udev.xml: Use `unless' for clarity + Docs: udev.xml: Clarify PROGRAM key + Docs: udev.xml: `a shell style' -> `shell-style' + Docs: udev.xml: Clean `*' description + Docs: udev.xml: Clean character range description + Docs: udev.xml: Clean up description of NAME assignment key + Docs: udev.xml: Clean up description of SYMLINK assignment key + Docs: udev.xml: Clean up description of ENV assignment key + Docs: udev.xml: Clean up description of RUN assignment key + Docs: udev.xml: Clean up description of LABEL assignment key + Docs: udev.xml: Add missing `.' + Docs: udev.xml: `which' -> `content of which' + Docs: udev.xml: `commandline' -> `command line' + Docs: udev.xml: Clean up WAIT_FOR description + Docs: udev.xml: `a' -> `the' + Docs: udev.xml: Clean up introduction to substitutions. + Docs: udev.xml: Use normal sentence structure + Docs: udev.xml: Actually make a separate paragraph + Docs: udev.xml: Add comma + Docs: udev.xml: `char' -> `character' + Docs: udev.xml: `comma-separated' is a better description + Docs: udev.xml: Clarify through a change in word ordering + Docs: udev.xml: Improved word order + Docs: udev.xml: Fix dangling modifier + +Nix (1): + libudev: queue - accept NULL passed into udev_queue_export_cleanup() + + Summary of changes from v167 to v168 ============================================ diff --git a/configure.ac b/configure.ac index 22e0835919..d9947efb76 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [168], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [169], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 053a3bba33..b17ba806d0 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -185,12 +185,11 @@ int udevadm_settle(struct udev *udev, int argc, char *argv[]) if (pfd[0].fd >= 0) { int delay; - /* wake up after delay, or immediately after the queue is rebuilt */ - if (exists != NULL || start > 0) delay = 100; else delay = 1000; + /* wake up after delay, or immediately after the queue is rebuilt */ if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) { char buf[sizeof(struct inotify_event) + PATH_MAX]; -- cgit v1.2.3-54-g00ecf From e93244f792a8c551429592c6bd06928d0cab46e7 Mon Sep 17 00:00:00 2001 From: Michal Soltys Date: Thu, 19 May 2011 13:35:17 +0200 Subject: configure.ac: fixes for rule_generator and modeswitch --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index d9947efb76..3a2d927a2d 100644 --- a/configure.ac +++ b/configure.ac @@ -75,10 +75,10 @@ AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_sy # ------------------------------------------------------------------------------ # rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ -AC_ARG_ENABLE([hwdb], +AC_ARG_ENABLE([rule_generator], AS_HELP_STRING([--disable-rule_generator], [disable persistent network, cdrom support]), [], [enable_rule_generator=yes]) -AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_genarator" = xyes]) +AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = xyes]) # ------------------------------------------------------------------------------ # usb/pci-db - read vendor/device string database @@ -190,7 +190,7 @@ AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = xyes]) # ------------------------------------------------------------------------------ # mobile-action-modeswitch - switch Mobile Action cables into serial mode # ------------------------------------------------------------------------------ -AC_ARG_ENABLE([ACTION_MODESWITCH], +AC_ARG_ENABLE([action_modeswitch], AS_HELP_STRING([--enable-action_modeswitch], [enable action modeswitch support]), [], [enable_action_modeswitch=no]) if test "x$enable_action_modeswitch" = xyes; then -- cgit v1.2.3-54-g00ecf From 2c64f5898ccf7c2dfc330c6b21540d6080d37659 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 19 May 2011 22:57:46 +0200 Subject: libudev: ctrl - properly wait for incoming message after connect --- libudev/libudev-ctrl.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c index 61e0243383..e0ec2fa3d7 100644 --- a/libudev/libudev-ctrl.c +++ b/libudev/libudev-ctrl.c @@ -176,6 +176,8 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl) struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) { struct udev_ctrl_connection *conn; + struct ucred ucred; + socklen_t slen; const int on = 1; conn = calloc(1, sizeof(struct udev_ctrl_connection)); @@ -188,14 +190,29 @@ struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) if (conn->sock < 0) { if (errno != EINTR) err(uctrl->udev, "unable to receive ctrl connection: %m\n"); - free(conn); - return NULL; + goto err; + } + + /* check peer credential of connection */ + slen = sizeof(ucred); + if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) { + err(uctrl->udev, "unable to receive credentials of ctrl connection: %m\n"); + goto err; + } + if (ucred.uid > 0) { + err(uctrl->udev, "sender uid=%i, message ignored\n", ucred.uid); + goto err; } - /* enable receiving of the sender credentials */ + /* enable receiving of the sender credentials in the messages */ setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); udev_ctrl_ref(uctrl); return conn; +err: + if (conn->sock >= 0) + close(conn->sock); + free(conn); + return NULL; } struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) @@ -333,6 +350,32 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) uctrl_msg->conn = conn; udev_ctrl_connection_ref(conn); + /* wait for the incoming message */ + for(;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = conn->sock; + pfd[0].events = POLLIN; + + r = poll(pfd, 1, 10000); + if (r < 0) { + if (errno == EINTR) + continue; + goto err; + } else if (r == 0) { + err(udev, "timeout waiting for ctrl message\n"); + goto err; + } else { + if (!(pfd[0].revents & POLLIN)) { + err(udev, "ctrl connection error: %m\n"); + goto err; + } + } + + break; + } + iov.iov_base = &uctrl_msg->ctrl_msg_wire; iov.iov_len = sizeof(struct udev_ctrl_msg_wire); memset(&smsg, 0x00, sizeof(struct msghdr)); @@ -342,7 +385,7 @@ struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) smsg.msg_controllen = sizeof(cred_msg); size = recvmsg(conn->sock, &smsg, 0); if (size < 0) { - err(udev, "unable to receive user udevd message: %m\n"); + err(udev, "unable to receive ctrl message: %m\n"); goto err; } cmsg = CMSG_FIRSTHDR(&smsg); -- cgit v1.2.3-54-g00ecf From e5fd444fee244a3a15fc4ab59f662a341e985565 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 19 May 2011 23:15:46 +0200 Subject: release 170 --- ChangeLog | 10 ++++++++++ NEWS | 6 ++++++ configure.ac | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7b5ff364fc..a0b364f9d8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Summary of changes from v169 to v170 +============================================ + +Kay Sievers (1): + libudev: ctrl - properly wait for incoming message after connect + +Michal Soltys (1): + configure.ac: fixes for rule_generator and modeswitch + + Summary of changes from v168 to v169 ============================================ diff --git a/NEWS b/NEWS index a39f7d1cc1..0dc85ecb51 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +udev 170 +======== +Fix bug in control message handling, which can lead to a failing +udevadm control --exit. Thanks to Jürg Billeter for help tracking +it down. + udev 169 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 3a2d927a2d..3646f9327d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [169], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [170], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 666fcf03bceea8e8dd6c4510220036d1b949b814 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 May 2011 14:41:10 +0200 Subject: libudev: export symbols explicitely and individually from C code not from separate file or prefix match --- Makefile.am | 10 ++---- TODO | 2 ++ libudev/exported_symbols | 84 --------------------------------------------- libudev/libudev-device.c | 56 +++++++++++++++--------------- libudev/libudev-enumerate.c | 32 ++++++++--------- libudev/libudev-list.c | 8 ++--- libudev/libudev-monitor.c | 26 +++++++------- libudev/libudev-private.h | 2 ++ libudev/libudev-queue.c | 24 ++++++------- libudev/libudev.c | 22 ++++++------ 10 files changed, 91 insertions(+), 175 deletions(-) delete mode 100644 libudev/exported_symbols diff --git a/Makefile.am b/Makefile.am index 1b0d6a3797..1537d56ebe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,7 +42,7 @@ dist_libexec_SCRIPTS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=11 -LIBUDEV_REVISION=4 +LIBUDEV_REVISION=5 LIBUDEV_AGE=11 SUBDIRS += libudev/docs @@ -60,12 +60,8 @@ libudev_libudev_la_SOURCES =\ libudev/libudev-monitor.c \ libudev/libudev-queue.c -libudev_libudev_la_CFLAGS = \ - -fvisibility=default - libudev_libudev_la_LDFLAGS = \ - -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) \ - -export-symbols $(top_srcdir)/libudev/exported_symbols + -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) noinst_LTLIBRARIES = \ libudev/libudev-private.la @@ -85,7 +81,7 @@ endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libudev/libudev.pc -EXTRA_DIST += libudev/exported_symbols libudev/COPYING +EXTRA_DIST += libudev/COPYING # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed libudev-install-move-hook: if test "$(libdir)" != "$(rootlib_execdir)"; then \ diff --git a/TODO b/TODO index c5dee4a7cb..3b583fd00f 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ + - make private functions in libudev-device.c static + - delete mobile-action-modeswitch (moved to usb_modeswitch) diff --git a/libudev/exported_symbols b/libudev/exported_symbols deleted file mode 100644 index 4089ec377c..0000000000 --- a/libudev/exported_symbols +++ /dev/null @@ -1,84 +0,0 @@ -udev_new -udev_ref -udev_unref -udev_set_log_fn -udev_get_log_priority -udev_set_log_priority -udev_get_userdata -udev_set_userdata -udev_get_sys_path -udev_get_dev_path -udev_get_run_path -udev_list_entry_get_next -udev_list_entry_get_by_name -udev_list_entry_get_name -udev_list_entry_get_value -udev_device_new_from_syspath -udev_device_new_from_devnum -udev_device_new_from_subsystem_sysname -udev_device_new_from_environment -udev_device_get_parent -udev_device_get_parent_with_subsystem_devtype -udev_device_ref -udev_device_unref -udev_device_get_udev -udev_device_get_syspath -udev_device_get_devpath -udev_device_get_devnode -udev_device_get_sysname -udev_device_get_sysnum -udev_device_get_subsystem -udev_device_get_devtype -udev_device_get_is_initialized -udev_device_get_devlinks_list_entry -udev_device_get_properties_list_entry -udev_device_get_tags_list_entry -udev_device_get_sysattr_list_entry -udev_device_get_property_value -udev_device_get_action -udev_device_get_driver -udev_device_get_devnum -udev_device_get_seqnum -udev_device_get_usec_since_initialized -udev_device_get_sysattr_value -udev_enumerate_new -udev_enumerate_ref -udev_enumerate_unref -udev_enumerate_get_udev -udev_enumerate_get_list_entry -udev_enumerate_add_match_subsystem -udev_enumerate_add_nomatch_subsystem -udev_enumerate_add_match_sysattr -udev_enumerate_add_nomatch_sysattr -udev_enumerate_add_match_property -udev_enumerate_add_match_tag -udev_enumerate_add_match_is_initialized -udev_enumerate_add_match_sysname -udev_enumerate_scan_devices -udev_enumerate_scan_subsystems -udev_enumerate_add_syspath -udev_monitor_new_from_socket -udev_monitor_new_from_netlink -udev_monitor_set_receive_buffer_size -udev_monitor_enable_receiving -udev_monitor_ref -udev_monitor_unref -udev_monitor_get_udev -udev_monitor_get_fd -udev_monitor_receive_device -udev_monitor_filter_add_match_subsystem_devtype -udev_monitor_filter_add_match_tag -udev_monitor_filter_update -udev_monitor_filter_remove -udev_queue_new -udev_queue_ref -udev_queue_unref -udev_queue_get_udev -udev_queue_get_kernel_seqnum -udev_queue_get_udev_seqnum -udev_queue_get_udev_is_active -udev_queue_get_queue_is_empty -udev_queue_get_seqnum_is_finished -udev_queue_get_seqnum_sequence_is_finished -udev_queue_get_queued_list_entry -udev_queue_get_failed_list_entry diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index d57a9eb597..47cabea984 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -226,7 +226,7 @@ int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_d * * Returns: the value of a device property, or #NULL if there is no such property. **/ -const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) +UDEV_EXPORT const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) { struct udev_list_entry *list_entry; @@ -405,7 +405,7 @@ struct udev_device *udev_device_new(struct udev *udev) * * Returns: a new udev device, or #NULL, if it does not exist **/ -struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) +UDEV_EXPORT struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) { size_t len; const char *subdir; @@ -481,7 +481,7 @@ struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char * * * Returns: a new udev device, or #NULL, if it does not exist **/ -struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) +UDEV_EXPORT struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) { char path[UTIL_PATH_SIZE]; const char *type_str; @@ -569,7 +569,7 @@ struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id * * Returns: a new udev device, or #NULL, if it does not exist **/ -struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) +UDEV_EXPORT struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) { char path_full[UTIL_PATH_SIZE]; char *path; @@ -653,7 +653,7 @@ found: * * Returns: a new udev device, or #NULL, if it does not exist **/ -struct udev_device *udev_device_new_from_environment(struct udev *udev) +UDEV_EXPORT struct udev_device *udev_device_new_from_environment(struct udev *udev) { int i; struct udev_device *udev_device; @@ -716,7 +716,7 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic * * Returns: a new udev device, or #NULL, if it no parent exist. **/ -struct udev_device *udev_device_get_parent(struct udev_device *udev_device) +UDEV_EXPORT struct udev_device *udev_device_get_parent(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -751,7 +751,7 @@ struct udev_device *udev_device_get_parent(struct udev_device *udev_device) * * Returns: a new udev device, or #NULL if no matching parent exists. **/ -struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) +UDEV_EXPORT struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) { struct udev_device *parent; @@ -784,7 +784,7 @@ struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_de * * Returns: the udev library context **/ -struct udev *udev_device_get_udev(struct udev_device *udev_device) +UDEV_EXPORT struct udev *udev_device_get_udev(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -799,7 +799,7 @@ struct udev *udev_device_get_udev(struct udev_device *udev_device) * * Returns: the passed udev device **/ -struct udev_device *udev_device_ref(struct udev_device *udev_device) +UDEV_EXPORT struct udev_device *udev_device_ref(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -815,7 +815,7 @@ struct udev_device *udev_device_ref(struct udev_device *udev_device) * the resources of the device will be released. * **/ -void udev_device_unref(struct udev_device *udev_device) +UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device) { if (udev_device == NULL) return; @@ -855,7 +855,7 @@ void udev_device_unref(struct udev_device *udev_device) * * Returns: the devpath of the udev device **/ -const char *udev_device_get_devpath(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_devpath(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -871,7 +871,7 @@ const char *udev_device_get_devpath(struct udev_device *udev_device) * * Returns: the sys path of the udev device **/ -const char *udev_device_get_syspath(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_syspath(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -884,7 +884,7 @@ const char *udev_device_get_syspath(struct udev_device *udev_device) * * Returns: the sys name of the device device **/ -const char *udev_device_get_sysname(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_sysname(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -897,7 +897,7 @@ const char *udev_device_get_sysname(struct udev_device *udev_device) * * Returns: the trailing number of of the device name **/ -const char *udev_device_get_sysnum(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_sysnum(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -913,7 +913,7 @@ const char *udev_device_get_sysnum(struct udev_device *udev_device) * * Returns: the device node file name of the udev device, or #NULL if no device node exists **/ -const char *udev_device_get_devnode(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_devnode(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -951,7 +951,7 @@ mode_t udev_device_get_devnode_mode(struct udev_device *udev_device) * * Returns: the subsystem name of the udev device, or #NULL if it can not be determined **/ -const char *udev_device_get_subsystem(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_subsystem(struct udev_device *udev_device) { char subsystem[UTIL_NAME_SIZE]; @@ -991,7 +991,7 @@ const char *udev_device_get_subsystem(struct udev_device *udev_device) * * Returns: the devtype name of the udev device, or #NULL if it can not be determined **/ -const char *udev_device_get_devtype(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_devtype(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -1015,7 +1015,7 @@ const char *udev_device_get_devtype(struct udev_device *udev_device) * * Returns: the first entry of the device node link list **/ -struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) +UDEV_EXPORT struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -1042,7 +1042,7 @@ void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) * * Returns: the first entry of the property list **/ -struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) +UDEV_EXPORT struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -1091,7 +1091,7 @@ struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device * * Returns: the driver string, or #NULL if there is no driver attached. **/ -const char *udev_device_get_driver(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_driver(struct udev_device *udev_device) { char driver[UTIL_NAME_SIZE]; @@ -1111,7 +1111,7 @@ const char *udev_device_get_driver(struct udev_device *udev_device) * * Returns: the device major/minor number. **/ -dev_t udev_device_get_devnum(struct udev_device *udev_device) +UDEV_EXPORT dev_t udev_device_get_devnum(struct udev_device *udev_device) { if (udev_device == NULL) return makedev(0, 0); @@ -1130,7 +1130,7 @@ dev_t udev_device_get_devnum(struct udev_device *udev_device) * * Returns: the kernel action value, or #NULL if there is no action value available. **/ -const char *udev_device_get_action(struct udev_device *udev_device) +UDEV_EXPORT const char *udev_device_get_action(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; @@ -1146,7 +1146,7 @@ const char *udev_device_get_action(struct udev_device *udev_device) * * Returns: the kernel event sequence number, or 0 if there is no sequence number available. **/ -unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) +UDEV_EXPORT unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) { if (udev_device == NULL) return 0; @@ -1165,7 +1165,7 @@ unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) * * Returns: the number of microseconds since the device was first seen. **/ -unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device) +UDEV_EXPORT unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device) { unsigned long long now; @@ -1201,7 +1201,7 @@ void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned * * Returns: the content of a sys attribute file, or #NULL if there is no sys attribute value. **/ -const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) +UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) { struct udev_list_entry *list_entry; char path[UTIL_PATH_SIZE]; @@ -1344,7 +1344,7 @@ static int udev_device_sysattr_list_read(struct udev_device *udev_device) * * Returns: the first entry of the property list **/ -struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device) +UDEV_EXPORT struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device) { if (!udev_device->sysattr_list_read) { int ret; @@ -1496,7 +1496,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device) * * Returns: 1 if the device is set up. 0 otherwise. **/ -int udev_device_get_is_initialized(struct udev_device *udev_device) +UDEV_EXPORT int udev_device_get_is_initialized(struct udev_device *udev_device) { if (!udev_device->info_loaded) udev_device_read_db(udev_device, NULL); @@ -1535,7 +1535,7 @@ void udev_device_cleanup_tags_list(struct udev_device *udev_device) * * Returns: the first entry of the tag list **/ -struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) +UDEV_EXPORT struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 018d89cc04..12de24e244 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -66,7 +66,7 @@ struct udev_enumerate { * * Returns: an enumeration context **/ -struct udev_enumerate *udev_enumerate_new(struct udev *udev) +UDEV_EXPORT struct udev_enumerate *udev_enumerate_new(struct udev *udev) { struct udev_enumerate *udev_enumerate; @@ -94,7 +94,7 @@ struct udev_enumerate *udev_enumerate_new(struct udev *udev) * * Returns: the passed enumeration context **/ -struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return NULL; @@ -109,7 +109,7 @@ struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) * Drop a reference of an enumeration context. If the refcount reaches zero, * all resources of the enumeration context will be released. **/ -void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) { unsigned int i; @@ -138,7 +138,7 @@ void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) * * Returns: the udev library context. */ -struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return NULL; @@ -247,7 +247,7 @@ static size_t devices_delay_later(struct udev *udev, const char *syspath) * * Returns: the first entry of the sorted list of device paths. */ -struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return NULL; @@ -329,7 +329,7 @@ struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *ude * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +UDEV_EXPORT int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { if (udev_enumerate == NULL) return -EINVAL; @@ -348,7 +348,7 @@ int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, co * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +UDEV_EXPORT int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { if (udev_enumerate == NULL) return -EINVAL; @@ -368,7 +368,7 @@ int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) +UDEV_EXPORT int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) return -EINVAL; @@ -388,7 +388,7 @@ int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, cons * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) +UDEV_EXPORT int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { if (udev_enumerate == NULL) return -EINVAL; @@ -428,7 +428,7 @@ exit: * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) +UDEV_EXPORT int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) { if (udev_enumerate == NULL) return -EINVAL; @@ -447,7 +447,7 @@ int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, con * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) +UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) { if (udev_enumerate == NULL) return -EINVAL; @@ -477,7 +477,7 @@ int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const ch * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate) { if (udev_enumerate == NULL) return -EINVAL; @@ -492,7 +492,7 @@ int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerat * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) +UDEV_EXPORT int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) { if (udev_enumerate == NULL) return -EINVAL; @@ -710,7 +710,7 @@ static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, * * Returns: 0 on success, otherwise a negative error value. */ -int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) +UDEV_EXPORT int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) { struct udev_device *udev_device; @@ -733,7 +733,7 @@ int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char * * Returns: 0 on success, otherwise a negative error value. **/ -int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); char base[UTIL_PATH_SIZE]; @@ -793,7 +793,7 @@ int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) * * Returns: 0 on success, otherwise a negative error value. **/ -int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) +UDEV_EXPORT int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); char base[UTIL_PATH_SIZE]; diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c index 29453ac251..e828a4e4c6 100644 --- a/libudev/libudev-list.c +++ b/libudev/libudev-list.c @@ -204,7 +204,7 @@ struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) * * Returns: the next entry from the list, #NULL is no more entries are found. */ -struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) +UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) { struct udev_list_node *next; @@ -224,7 +224,7 @@ struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_en * * Returns: the entry where @name matched, #NULL if no matching entry is found. */ -struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) +UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) { struct udev_list_entry *entry; @@ -243,7 +243,7 @@ struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list * * Returns: the name string of this entry. */ -const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) +UDEV_EXPORT const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) { if (list_entry == NULL) return NULL; @@ -256,7 +256,7 @@ const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) * * Returns: the value string of this entry. */ -const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) +UDEV_EXPORT const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) { if (list_entry == NULL) return NULL; diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 5917b9e497..ec76698836 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -117,7 +117,7 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) * * Returns: a new udev monitor, or #NULL, in case of an error **/ -struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) +UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) { struct udev_monitor *udev_monitor; struct stat statbuf; @@ -225,7 +225,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c * * Returns: a new udev monitor, or #NULL, in case of an error **/ -struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) +UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) { return udev_monitor_new_from_netlink_fd(udev, name, -1); } @@ -261,7 +261,7 @@ static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_filter_update(struct udev_monitor *udev_monitor) +UDEV_EXPORT int udev_monitor_filter_update(struct udev_monitor *udev_monitor) { struct sock_filter ins[512]; struct sock_fprog filter; @@ -373,7 +373,7 @@ int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) +UDEV_EXPORT int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) { int err = 0; const int on = 1; @@ -430,7 +430,7 @@ int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) * * Returns: 0 on success, otherwise -1 on error. */ -int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) +UDEV_EXPORT int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) { if (udev_monitor == NULL) return -1; @@ -454,7 +454,7 @@ int udev_monitor_disconnect(struct udev_monitor *udev_monitor) * * Returns: the passed udev monitor **/ -struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) +UDEV_EXPORT struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) return NULL; @@ -471,7 +471,7 @@ struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) * will be released. * **/ -void udev_monitor_unref(struct udev_monitor *udev_monitor) +UDEV_EXPORT void udev_monitor_unref(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) return; @@ -494,7 +494,7 @@ void udev_monitor_unref(struct udev_monitor *udev_monitor) * * Returns: the udev library context **/ -struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) +UDEV_EXPORT struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) return NULL; @@ -509,7 +509,7 @@ struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) * * Returns: the socket file descriptor **/ -int udev_monitor_get_fd(struct udev_monitor *udev_monitor) +UDEV_EXPORT int udev_monitor_get_fd(struct udev_monitor *udev_monitor) { if (udev_monitor == NULL) return -1; @@ -570,7 +570,7 @@ tag: * * Returns: a new udev device, or #NULL, in case of an error **/ -struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) +UDEV_EXPORT struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) { struct udev_device *udev_device; struct msghdr smsg; @@ -823,7 +823,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) +UDEV_EXPORT int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) { if (udev_monitor == NULL) return -EINVAL; @@ -847,7 +847,7 @@ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_mo * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag) +UDEV_EXPORT int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag) { if (udev_monitor == NULL) return -EINVAL; @@ -867,7 +867,7 @@ int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const c * * Returns: 0 on success, otherwise a negative error value. */ -int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) +UDEV_EXPORT int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) { static struct sock_fprog filter = { 0, NULL }; diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 39b46dde31..9703fb5875 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -45,6 +45,8 @@ udev_log_null(struct udev *udev, const char *format, ...) {} # define err(udev, arg...) udev_log_null(udev, ## arg) #endif +#define UDEV_EXPORT __attribute__ ((visibility("default"))) + static inline void udev_log_init(const char *program_name) { openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index be6409d02a..73e7fb23aa 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -55,7 +55,7 @@ struct udev_queue { * * Returns: the udev queue context, or #NULL on error. **/ -struct udev_queue *udev_queue_new(struct udev *udev) +UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev) { struct udev_queue *udev_queue; @@ -80,7 +80,7 @@ struct udev_queue *udev_queue_new(struct udev *udev) * * Returns: the same udev queue context. **/ -struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) +UDEV_EXPORT struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) { if (udev_queue == NULL) return NULL; @@ -95,7 +95,7 @@ struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) * Drop a reference of a udev queue context. If the refcount reaches zero, * the resources of the queue context will be released. **/ -void udev_queue_unref(struct udev_queue *udev_queue) +UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue) { if (udev_queue == NULL) return; @@ -115,7 +115,7 @@ void udev_queue_unref(struct udev_queue *udev_queue) * * Returns: the udev library context. **/ -struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) +UDEV_EXPORT struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) { if (udev_queue == NULL) return NULL; @@ -149,7 +149,7 @@ unsigned long long int udev_get_kernel_seqnum(struct udev *udev) * * Returns: the current kernel event sequence number. **/ -unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) +UDEV_EXPORT unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) { unsigned long long int seqnum; @@ -234,7 +234,7 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i * * Returns: the last known udev event sequence number. **/ -unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) +UDEV_EXPORT unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) { unsigned long long int seqnum_udev; FILE *queue_file; @@ -266,7 +266,7 @@ unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) * * Returns: a flag indicating if udev is active. **/ -int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) +UDEV_EXPORT int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) { unsigned long long int seqnum_start; FILE *queue_file; @@ -285,7 +285,7 @@ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) * * Returns: a flag indicating if udev is currently handling events. **/ -int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) +UDEV_EXPORT int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) { unsigned long long int seqnum_kernel; unsigned long long int seqnum_udev = 0; @@ -345,7 +345,7 @@ out: * * Returns: a flag indicating if any of the sequence numbers in the given range is currently active. **/ -int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, +UDEV_EXPORT int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end) { unsigned long long int seqnum; @@ -407,7 +407,7 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, * * Returns: a flag indicating if the given sequence number is currently active. **/ -int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) +UDEV_EXPORT int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) { if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) return 0; @@ -422,7 +422,7 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo * * Returns: the first entry of the list of queued events. **/ -struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) +UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) { unsigned long long int seqnum; FILE *queue_file; @@ -475,7 +475,7 @@ struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev * * Returns: the first entry of the list of recorded failed events. **/ -struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) +UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) { char path[UTIL_PATH_SIZE]; DIR *dir; diff --git a/libudev/libudev.c b/libudev/libudev.c index 6b5c5e9f84..ad8c914e84 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -77,7 +77,7 @@ static void log_stderr(struct udev *udev, * * Returns: stored userdata **/ -void *udev_get_userdata(struct udev *udev) +UDEV_EXPORT void *udev_get_userdata(struct udev *udev) { if (udev == NULL) return NULL; @@ -91,7 +91,7 @@ void *udev_get_userdata(struct udev *udev) * * Store custom @userdata in the library context. **/ -void udev_set_userdata(struct udev *udev, void *userdata) +UDEV_EXPORT void udev_set_userdata(struct udev *udev, void *userdata) { if (udev == NULL) return; @@ -117,7 +117,7 @@ static char *set_value(char **s, const char *v) * * Returns: a new udev library context **/ -struct udev *udev_new(void) +UDEV_EXPORT struct udev *udev_new(void) { struct udev *udev; const char *env; @@ -284,7 +284,7 @@ err: * * Returns: the passed udev library context **/ -struct udev *udev_ref(struct udev *udev) +UDEV_EXPORT struct udev *udev_ref(struct udev *udev) { if (udev == NULL) return NULL; @@ -300,7 +300,7 @@ struct udev *udev_ref(struct udev *udev) * reaches zero, the resources of the context will be released. * **/ -void udev_unref(struct udev *udev) +UDEV_EXPORT void udev_unref(struct udev *udev) { if (udev == NULL) return; @@ -327,7 +327,7 @@ void udev_unref(struct udev *udev) * into the users' logging functionality. * **/ -void udev_set_log_fn(struct udev *udev, +UDEV_EXPORT void udev_set_log_fn(struct udev *udev, void (*log_fn)(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args)) @@ -345,7 +345,7 @@ void udev_set_log_fn(struct udev *udev, * * Returns: the current logging priority **/ -int udev_get_log_priority(struct udev *udev) +UDEV_EXPORT int udev_get_log_priority(struct udev *udev) { return udev->log_priority; } @@ -358,7 +358,7 @@ int udev_get_log_priority(struct udev *udev) * Set the current logging priority. The value controls which messages * are logged. **/ -void udev_set_log_priority(struct udev *udev, int priority) +UDEV_EXPORT void udev_set_log_priority(struct udev *udev, int priority) { char num[32]; @@ -382,7 +382,7 @@ const char *udev_get_rules_path(struct udev *udev) * * Returns: the sys mount point **/ -const char *udev_get_sys_path(struct udev *udev) +UDEV_EXPORT const char *udev_get_sys_path(struct udev *udev) { if (udev == NULL) return NULL; @@ -399,7 +399,7 @@ const char *udev_get_sys_path(struct udev *udev) * * Returns: the device directory path **/ -const char *udev_get_dev_path(struct udev *udev) +UDEV_EXPORT const char *udev_get_dev_path(struct udev *udev) { if (udev == NULL) return NULL; @@ -419,7 +419,7 @@ const char *udev_get_run_config_path(struct udev *udev) * * Returns: the runtime directory path **/ -const char *udev_get_run_path(struct udev *udev) +UDEV_EXPORT const char *udev_get_run_path(struct udev *udev) { if (udev->run_path != NULL) return udev->run_path; -- cgit v1.2.3-54-g00ecf From 905555dc839517cd1854eb663662466a2dccf0bd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 May 2011 15:36:27 +0200 Subject: libudev: device - make a bunch of symbols static --- libudev/libudev-device.c | 529 ++++++++++++++++++++++------------------------ libudev/libudev-private.h | 11 - 2 files changed, 254 insertions(+), 286 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 47cabea984..8289acf3a9 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -57,7 +57,6 @@ struct udev_device { char *driver; char *action; char *devpath_old; - char *sysname_old; char *knodename; char *id_filename; char **envp; @@ -92,6 +91,260 @@ struct udev_device { bool db_persist; }; +/** + * udev_device_get_devnum: + * @udev_device: udev device + * + * This is only valid if the device was received through a monitor. Devices read from + * sys do not have a sequence number. + * + * Returns: the kernel event sequence number, or 0 if there is no sequence number available. + **/ +UDEV_EXPORT unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return 0; + return udev_device->seqnum; +} + +static int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) +{ + char num[32]; + + udev_device->seqnum = seqnum; + snprintf(num, sizeof(num), "%llu", seqnum); + udev_device_add_property(udev_device, "SEQNUM", num); + return 0; +} + +int udev_device_get_ifindex(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->ifindex; +} + +static int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) +{ + char num[32]; + + udev_device->ifindex = ifindex; + snprintf(num, sizeof(num), "%u", ifindex); + udev_device_add_property(udev_device, "IFINDEX", num); + return 0; +} + +/** + * udev_device_get_devnum: + * @udev_device: udev device + * + * Returns: the device major/minor number. + **/ +UDEV_EXPORT dev_t udev_device_get_devnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return makedev(0, 0); + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnum; +} + +static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) +{ + char num[32]; + + udev_device->devnum = devnum; + + snprintf(num, sizeof(num), "%u", major(devnum)); + udev_device_add_property(udev_device, "MAJOR", num); + snprintf(num, sizeof(num), "%u", minor(devnum)); + udev_device_add_property(udev_device, "MINOR", num); + return 0; +} + +int udev_device_get_timeout(struct udev_device *udev_device) +{ + return udev_device->timeout; +} + +static int udev_device_set_timeout(struct udev_device *udev_device, int timeout) +{ + char num[32]; + + udev_device->timeout = timeout; + snprintf(num, sizeof(num), "%u", timeout); + udev_device_add_property(udev_device, "TIMEOUT", num); + return 0; +} + +const char *udev_device_get_knodename(struct udev_device *udev_device) +{ + return udev_device->knodename; +} + +static int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename) +{ + free(udev_device->knodename); + udev_device->knodename = strdup(knodename); + if (udev_device->knodename == NULL) + return -ENOMEM; + /* do not overwrite the udev property with the kernel property */ + if (udev_device->devnode == NULL) + udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename); + return 0; +} + +const char *udev_device_get_devpath_old(struct udev_device *udev_device) +{ + return udev_device->devpath_old; +} + +static int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) +{ + const char *pos; + + free(udev_device->devpath_old); + udev_device->devpath_old = strdup(devpath_old); + if (udev_device->devpath_old == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); + + pos = strrchr(udev_device->devpath_old, '/'); + if (pos == NULL) + return -EINVAL; + return 0; +} + +/** + * udev_device_get_driver: + * @udev_device: udev device + * + * Returns: the driver string, or #NULL if there is no driver attached. + **/ +UDEV_EXPORT const char *udev_device_get_driver(struct udev_device *udev_device) +{ + char driver[UTIL_NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (!udev_device->driver_set) { + udev_device->driver_set = true; + if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) > 0) + udev_device->driver = strdup(driver); + } + return udev_device->driver; +} + +static int udev_device_set_driver(struct udev_device *udev_device, const char *driver) +{ + free(udev_device->driver); + udev_device->driver = strdup(driver); + if (udev_device->driver == NULL) + return -ENOMEM; + udev_device->driver_set = true; + udev_device_add_property(udev_device, "DRIVER", udev_device->driver); + return 0; +} + +/** + * udev_device_get_devtype: + * @udev_device: udev device + * + * Retrieve the devtype string of the udev device. + * + * Returns: the devtype name of the udev device, or #NULL if it can not be determined + **/ +UDEV_EXPORT const char *udev_device_get_devtype(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->devtype_set) { + udev_device->devtype_set = true; + udev_device_read_uevent_file(udev_device); + } + return udev_device->devtype; +} + +static int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) +{ + free(udev_device->devtype); + udev_device->devtype = strdup(devtype); + if (udev_device->devtype == NULL) + return -ENOMEM; + udev_device->devtype_set = true; + udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); + return 0; +} + +static int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) +{ + free(udev_device->subsystem); + udev_device->subsystem = strdup(subsystem); + if (udev_device->subsystem == NULL) + return -ENOMEM; + udev_device->subsystem_set = true; + udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); + return 0; +} + +/** + * udev_device_get_subsystem: + * @udev_device: udev device + * + * Retrieve the subsystem string of the udev device. The string does not + * contain any "/". + * + * Returns: the subsystem name of the udev device, or #NULL if it can not be determined + **/ +UDEV_EXPORT const char *udev_device_get_subsystem(struct udev_device *udev_device) +{ + char subsystem[UTIL_NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (!udev_device->subsystem_set) { + udev_device->subsystem_set = true; + /* read "subsystem" link */ + if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { + udev_device_set_subsystem(udev_device, subsystem); + return udev_device->subsystem; + } + /* implicit names */ + if (strncmp(udev_device->devpath, "/module/", 8) == 0) { + udev_device_set_subsystem(udev_device, "module"); + return udev_device->subsystem; + } + if (strstr(udev_device->devpath, "/drivers/") != NULL) { + udev_device_set_subsystem(udev_device, "drivers"); + return udev_device->subsystem; + } + if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || + strncmp(udev_device->devpath, "/class/", 7) == 0 || + strncmp(udev_device->devpath, "/bus/", 5) == 0) { + udev_device_set_subsystem(udev_device, "subsystem"); + return udev_device->subsystem; + } + } + return udev_device->subsystem; +} + +mode_t udev_device_get_devnode_mode(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnode_mode; +} + +static int udev_device_set_devnode_mode(struct udev_device *udev_device, mode_t mode) +{ + char num[32]; + + udev_device->devnode_mode = mode; + snprintf(num, sizeof(num), "%#o", mode); + udev_device_add_property(udev_device, "DEVMODE", num); + return 0; +} + struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { udev_device->envp_uptodate = false; @@ -837,7 +1090,6 @@ UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device) free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); - free(udev_device->sysname_old); free(udev_device->knodename); free(udev_device->id_filename); free(udev_device->envp); @@ -935,73 +1187,6 @@ UDEV_EXPORT const char *udev_device_get_devnode(struct udev_device *udev_device) return udev_device->devnode; } -mode_t udev_device_get_devnode_mode(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->devnode_mode; -} - -/** - * udev_device_get_subsystem: - * @udev_device: udev device - * - * Retrieve the subsystem string of the udev device. The string does not - * contain any "/". - * - * Returns: the subsystem name of the udev device, or #NULL if it can not be determined - **/ -UDEV_EXPORT const char *udev_device_get_subsystem(struct udev_device *udev_device) -{ - char subsystem[UTIL_NAME_SIZE]; - - if (udev_device == NULL) - return NULL; - if (!udev_device->subsystem_set) { - udev_device->subsystem_set = true; - /* read "subsystem" link */ - if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { - udev_device_set_subsystem(udev_device, subsystem); - return udev_device->subsystem; - } - /* implicit names */ - if (strncmp(udev_device->devpath, "/module/", 8) == 0) { - udev_device_set_subsystem(udev_device, "module"); - return udev_device->subsystem; - } - if (strstr(udev_device->devpath, "/drivers/") != NULL) { - udev_device_set_subsystem(udev_device, "drivers"); - return udev_device->subsystem; - } - if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || - strncmp(udev_device->devpath, "/class/", 7) == 0 || - strncmp(udev_device->devpath, "/bus/", 5) == 0) { - udev_device_set_subsystem(udev_device, "subsystem"); - return udev_device->subsystem; - } - } - return udev_device->subsystem; -} - -/** - * udev_device_get_devtype: - * @udev_device: udev device - * - * Retrieve the devtype string of the udev device. - * - * Returns: the devtype name of the udev device, or #NULL if it can not be determined - **/ -UDEV_EXPORT const char *udev_device_get_devtype(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->devtype_set) { - udev_device->devtype_set = true; - udev_device_read_uevent_file(udev_device); - } - return udev_device->devtype; -} - /** * udev_device_get_devlinks_list_entry: * @udev_device: udev device @@ -1085,41 +1270,6 @@ UDEV_EXPORT struct udev_list_entry *udev_device_get_properties_list_entry(struct return udev_list_get_entry(&udev_device->properties_list); } -/** - * udev_device_get_driver: - * @udev_device: udev device - * - * Returns: the driver string, or #NULL if there is no driver attached. - **/ -UDEV_EXPORT const char *udev_device_get_driver(struct udev_device *udev_device) -{ - char driver[UTIL_NAME_SIZE]; - - if (udev_device == NULL) - return NULL; - if (!udev_device->driver_set) { - udev_device->driver_set = true; - if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) > 0) - udev_device->driver = strdup(driver); - } - return udev_device->driver; -} - -/** - * udev_device_get_devnum: - * @udev_device: udev device - * - * Returns: the device major/minor number. - **/ -UDEV_EXPORT dev_t udev_device_get_devnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return makedev(0, 0); - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->devnum; -} - /** * udev_device_get_action: * @udev_device: udev device @@ -1137,22 +1287,6 @@ UDEV_EXPORT const char *udev_device_get_action(struct udev_device *udev_device) return udev_device->action; } -/** - * udev_device_get_devnum: - * @udev_device: udev device - * - * This is only valid if the device was received through a monitor. Devices read from - * sys do not have a sequence number. - * - * Returns: the kernel event sequence number, or 0 if there is no sequence number available. - **/ -UDEV_EXPORT unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return 0; - return udev_device->seqnum; -} - /** * udev_device_get_usec_since_initialized: * @udev_device: udev device @@ -1394,28 +1528,6 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath return 0; } -int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) -{ - free(udev_device->subsystem); - udev_device->subsystem = strdup(subsystem); - if (udev_device->subsystem == NULL) - return -ENOMEM; - udev_device->subsystem_set = true; - udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); - return 0; -} - -int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) -{ - free(udev_device->devtype); - udev_device->devtype = strdup(devtype); - if (udev_device->devtype == NULL) - return -ENOMEM; - udev_device->devtype_set = true; - udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); - return 0; -} - int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) { free(udev_device->devnode); @@ -1426,16 +1538,6 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode return 0; } -int udev_device_set_devnode_mode(struct udev_device *udev_device, mode_t mode) -{ - char num[32]; - - udev_device->devnode_mode = mode; - snprintf(num, sizeof(num), "%#o", mode); - udev_device_add_property(udev_device, "DEVMODE", num); - return 0; -} - int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique) { struct udev_list_entry *list_entry; @@ -1636,112 +1738,6 @@ int udev_device_set_action(struct udev_device *udev_device, const char *action) return 0; } -int udev_device_set_driver(struct udev_device *udev_device, const char *driver) -{ - free(udev_device->driver); - udev_device->driver = strdup(driver); - if (udev_device->driver == NULL) - return -ENOMEM; - udev_device->driver_set = true; - udev_device_add_property(udev_device, "DRIVER", udev_device->driver); - return 0; -} - -const char *udev_device_get_devpath_old(struct udev_device *udev_device) -{ - return udev_device->devpath_old; -} - -int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) -{ - const char *pos; - size_t len; - - free(udev_device->devpath_old); - udev_device->devpath_old = strdup(devpath_old); - if (udev_device->devpath_old == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); - - pos = strrchr(udev_device->devpath_old, '/'); - if (pos == NULL) - return -EINVAL; - udev_device->sysname_old = strdup(&pos[1]); - if (udev_device->sysname_old == NULL) - return -ENOMEM; - - /* some devices have '!' in their name, change that to '/' */ - len = 0; - while (udev_device->sysname_old[len] != '\0') { - if (udev_device->sysname_old[len] == '!') - udev_device->sysname_old[len] = '/'; - len++; - } - return 0; -} - -const char *udev_device_get_sysname_old(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->sysname_old; -} - -const char *udev_device_get_knodename(struct udev_device *udev_device) -{ - return udev_device->knodename; -} - -int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename) -{ - free(udev_device->knodename); - udev_device->knodename = strdup(knodename); - if (udev_device->knodename == NULL) - return -ENOMEM; - /* do not overwrite the udev property with the kernel property */ - if (udev_device->devnode == NULL) - udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename); - return 0; -} - -int udev_device_get_timeout(struct udev_device *udev_device) -{ - return udev_device->timeout; -} - -int udev_device_set_timeout(struct udev_device *udev_device, int timeout) -{ - char num[32]; - - udev_device->timeout = timeout; - snprintf(num, sizeof(num), "%u", timeout); - udev_device_add_property(udev_device, "TIMEOUT", num); - return 0; -} - -int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) -{ - char num[32]; - - udev_device->seqnum = seqnum; - snprintf(num, sizeof(num), "%llu", seqnum); - udev_device_add_property(udev_device, "SEQNUM", num); - return 0; -} - -int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) -{ - char num[32]; - - udev_device->devnum = devnum; - - snprintf(num, sizeof(num), "%u", major(devnum)); - udev_device_add_property(udev_device, "MAJOR", num); - snprintf(num, sizeof(num), "%u", minor(devnum)); - udev_device_add_property(udev_device, "MINOR", num); - return 0; -} - int udev_device_get_devlink_priority(struct udev_device *udev_device) { if (!udev_device->info_loaded) @@ -1768,23 +1764,6 @@ int udev_device_set_watch_handle(struct udev_device *udev_device, int handle) return 0; } -int udev_device_get_ifindex(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->ifindex; -} - -int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) -{ - char num[32]; - - udev_device->ifindex = ifindex; - snprintf(num, sizeof(num), "%u", ifindex); - udev_device_add_property(udev_device, "IFINDEX", num); - return 0; -} - bool udev_device_get_db_persist(struct udev_device *udev_device) { return udev_device->db_persist; diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 9703fb5875..315ca3d700 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -72,10 +72,7 @@ struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); struct udev_device *udev_device_new(struct udev *udev); struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id); mode_t udev_device_get_devnode_mode(struct udev_device *udev_device); -int udev_device_set_devnode_mode(struct udev_device *udev_device, mode_t mode); int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); -int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem); -int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype); int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique); void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); @@ -87,21 +84,14 @@ ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, int udev_device_read_db(struct udev_device *udev_device, const char *dbfile); int udev_device_read_uevent_file(struct udev_device *udev_device); int udev_device_set_action(struct udev_device *udev_device, const char *action); -int udev_device_set_driver(struct udev_device *udev_device, const char *driver); const char *udev_device_get_devpath_old(struct udev_device *udev_device); -const char *udev_device_get_sysname_old(struct udev_device *udev_device); -int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old); const char *udev_device_get_knodename(struct udev_device *udev_device); const char *udev_device_get_id_filename(struct udev_device *udev_device); void udev_device_set_is_initialized(struct udev_device *udev_device); int udev_device_add_tag(struct udev_device *udev_device, const char *tag); void udev_device_cleanup_tags_list(struct udev_device *udev_device); int udev_device_has_tag(struct udev_device *udev_device, const char *tag); -int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename); int udev_device_get_timeout(struct udev_device *udev_device); -int udev_device_set_timeout(struct udev_device *udev_device, int timeout); -int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum); -int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum); unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device); void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized); int udev_device_get_devlink_priority(struct udev_device *udev_device); @@ -109,7 +99,6 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); int udev_device_get_watch_handle(struct udev_device *udev_device); int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); int udev_device_get_ifindex(struct udev_device *udev_device); -int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex); void udev_device_set_info_loaded(struct udev_device *device); bool udev_device_get_db_persist(struct udev_device *udev_device); void udev_device_set_db_persist(struct udev_device *udev_device); -- cgit v1.2.3-54-g00ecf From a50a665988418178b632ea1443faab841bc21c75 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 May 2011 17:04:21 +0200 Subject: systemd: Replace Requires= with Wants=, run trigger in parallel --- init/udev-settle.service.in | 2 +- init/udev-trigger.service.in | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in index d7d6f782cb..f5f5958934 100644 --- a/init/udev-settle.service.in +++ b/init/udev-settle.service.in @@ -11,7 +11,7 @@ [Unit] Description=udev Wait for Complete Device Initialization DefaultDependencies=no -Requires=udev.service +Wants=udev.service After=udev-trigger.service Before=basic.target diff --git a/init/udev-trigger.service.in b/init/udev-trigger.service.in index 745974a7ab..cce09514bd 100644 --- a/init/udev-trigger.service.in +++ b/init/udev-trigger.service.in @@ -1,7 +1,6 @@ [Unit] Description=udev Coldplug all Devices -Requires=udev.service -After=udev.service +Wants=udev.service DefaultDependencies=no [Service] -- cgit v1.2.3-54-g00ecf From 583c89629b4ed91fbefb7a7b679171ec2ff922b5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 May 2011 17:08:06 +0200 Subject: systemd: sort trigger after socket --- TODO | 2 -- init/udev-trigger.service.in | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/TODO b/TODO index 3b583fd00f..c5dee4a7cb 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - - make private functions in libudev-device.c static - - delete mobile-action-modeswitch (moved to usb_modeswitch) diff --git a/init/udev-trigger.service.in b/init/udev-trigger.service.in index cce09514bd..8c48ec5906 100644 --- a/init/udev-trigger.service.in +++ b/init/udev-trigger.service.in @@ -1,6 +1,7 @@ [Unit] Description=udev Coldplug all Devices Wants=udev.service +After=udev.socket DefaultDependencies=no [Service] -- cgit v1.2.3-54-g00ecf From 96c6ecee7d214aa930a53ac6e8adc93df23f46bf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 May 2011 17:44:28 +0200 Subject: systemd: trigger - run after udev.service (for now) With the systemd socket buffer we could run trigger in parallel with the udev daemon startup, but we need to teach systemd to have a socket buffer of 128MB. Revert that for now until we are ready ... --- init/udev-trigger.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/udev-trigger.service.in b/init/udev-trigger.service.in index 8c48ec5906..817f7935e7 100644 --- a/init/udev-trigger.service.in +++ b/init/udev-trigger.service.in @@ -1,7 +1,7 @@ [Unit] Description=udev Coldplug all Devices Wants=udev.service -After=udev.socket +After=udev.service DefaultDependencies=no [Service] -- cgit v1.2.3-54-g00ecf From 44e20040f874862848f38636998d7c70e0685f4a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 May 2011 18:54:41 +0200 Subject: systemd: set socket buffer size to 128 MB like udev has --- init/udev.socket | 1 + 1 file changed, 1 insertion(+) diff --git a/init/udev.socket b/init/udev.socket index f45a1a6fc9..07fb01c057 100644 --- a/init/udev.socket +++ b/init/udev.socket @@ -3,5 +3,6 @@ Description=udev Kernel Device Manager Sockets DefaultDependencies=no [Socket] +ReceiveBuffer=134217728 ListenSequentialPacket=@/org/kernel/udev/udevd ListenNetlink=kobject-uevent 1 -- cgit v1.2.3-54-g00ecf From c205bac060536c12b5d0a768714ffacb035bef32 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 20 May 2011 19:01:21 +0200 Subject: update TODO --- TODO | 3 +++ 1 file changed, 3 insertions(+) diff --git a/TODO b/TODO index c5dee4a7cb..81f4950cf9 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,6 @@ + - revert: systemd: trigger - run after udev.service (for now) + after systemd has a new release we can depend on + - delete mobile-action-modeswitch (moved to usb_modeswitch) -- cgit v1.2.3-54-g00ecf From f085af8111a5c68b237ceee2cd988f296313ae4e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 22 May 2011 00:55:32 +0200 Subject: update TODO --- TODO | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 81f4950cf9..43e2b98ebd 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,6 @@ - - revert: systemd: trigger - run after udev.service (for now) + - add TAGS=="foo" match + + - revert: "systemd: trigger - run after udev.service (for now)" after systemd has a new release we can depend on - delete mobile-action-modeswitch @@ -7,11 +9,13 @@ - /run/udev/control socket (add ConditionVirtualization=!pidns) - - rules_generator: - - no longer rename netif in kernel namespace - - do not create rules on-the-fly, require explicit - configuration + - kill rules_generator: + - no longer rename netifs in kernel namespace - drop persistent optical names + - do not create rules on-the-fly, require explicit configuration + for netifs and optical drives + - properly document what system management needs to put + into rules files - kill tabs? -- cgit v1.2.3-54-g00ecf From bda2674f22b58bd32802b2057a05efada6155bae Mon Sep 17 00:00:00 2001 From: Scott James Remnant Date: Fri, 20 May 2011 14:06:29 -0700 Subject: configure: allow usb.ids location to be specified We already allow the pci.ids location to be specified, so add a patch doing the same for usb.ids. Please don't make me explain why this is necessary, it will only make you cry. Signed-off-by: Scott James Remnant Signed-off-by: Kay Sievers Acked-by: Greg Kroah-Hartman --- configure.ac | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 3646f9327d..cfdb3bf816 100644 --- a/configure.ac +++ b/configure.ac @@ -93,8 +93,18 @@ if test "x$enable_hwdb" = xyes; then AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) fi - PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) - AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) + AC_ARG_WITH(usb-ids-path, + [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])], + [USB_DATABASE=${withval}], + [if test -n "$usbids" ; then + USB_DATABASE="$usbids" + else + PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) + AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) + fi]) + AC_MSG_CHECKING([for USB database location]) + AC_MSG_RESULT([$USB_DATABASE]) + AC_SUBST(USB_DATABASE) AC_ARG_WITH(pci-ids-path, [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], -- cgit v1.2.3-54-g00ecf From 13d83b88b600c24ada4ec78232f508ce7f8f3ca5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 May 2011 22:37:02 +0200 Subject: libudev: monitor - use SOCK_NONBLOCK --- libudev/libudev-monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index ec76698836..85ab23bdd4 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -178,7 +178,7 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c return NULL; if (fd < 0) { - udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT); + udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT); if (udev_monitor->sock == -1) { err(udev, "error getting socket: %m\n"); free(udev_monitor); -- cgit v1.2.3-54-g00ecf From 5a6583ecb4f3ee398be52c5d6ae3633f8a55b98b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 May 2011 00:56:48 +0200 Subject: systemd: split socket file --- Makefile.am | 10 +++++++--- init/udev.service.in | 5 +++-- init/udev.socket | 8 -------- 3 files changed, 10 insertions(+), 13 deletions(-) delete mode 100644 init/udev.socket diff --git a/Makefile.am b/Makefile.am index 1537d56ebe..16127b722e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -130,16 +130,20 @@ sharepkgconfig_DATA = udev/udev.pc if WITH_SYSTEMD systemdsystemunit_DATA = \ - init/udev.socket \ + init/udev-control.socket \ + init/udev-kernel.socket \ init/udev.service \ init/udev-trigger.service \ init/udev-settle.service -EXTRA_DIST += init/udev.socket +EXTRA_DIST += \ + init/udev-control.socket \ + init/udev-kernel.socket systemd-install-hook: mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants - ln -sf ../udev.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/udev.socket + ln -sf ../udev-control.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/udev-control.socket + ln -sf ../udev-kernel.socket $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants/udev-kernel.socket mkdir -p $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants ln -sf ../udev.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev.service ln -sf ../udev-trigger.service $(DESTDIR)$(systemdsystemunitdir)/basic.target.wants/udev-trigger.service diff --git a/init/udev.service.in b/init/udev.service.in index e85974a575..3692fb317e 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -1,12 +1,13 @@ [Unit] Description=udev Kernel Device Manager -Wants=udev.socket -After=udev.socket +Wants=udev-control.socket udev-kernel.socket +After=udev-control.socket udev-kernel.socket Before=basic.target DefaultDependencies=no [Service] Type=notify OOMScoreAdjust=-1000 +Sockets=udev-control.socket udev-kernel.socket Restart=on-failure ExecStart=@sbindir@/udevd diff --git a/init/udev.socket b/init/udev.socket deleted file mode 100644 index 07fb01c057..0000000000 --- a/init/udev.socket +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=udev Kernel Device Manager Sockets -DefaultDependencies=no - -[Socket] -ReceiveBuffer=134217728 -ListenSequentialPacket=@/org/kernel/udev/udevd -ListenNetlink=kobject-uevent 1 -- cgit v1.2.3-54-g00ecf From e52e0846fcfec4b7992c09124447f00af8dbf139 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 May 2011 13:30:16 +0200 Subject: systemd: add missing socket files --- init/udev-control.socket | 7 +++++++ init/udev-kernel.socket | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 init/udev-control.socket create mode 100644 init/udev-kernel.socket diff --git a/init/udev-control.socket b/init/udev-control.socket new file mode 100644 index 0000000000..9a3537a37d --- /dev/null +++ b/init/udev-control.socket @@ -0,0 +1,7 @@ +[Unit] +Description=udev Control Socket +DefaultDependencies=no + +[Socket] +Service=udev.service +ListenSequentialPacket=@/org/kernel/udev/udevd diff --git a/init/udev-kernel.socket b/init/udev-kernel.socket new file mode 100644 index 0000000000..e4de14a33e --- /dev/null +++ b/init/udev-kernel.socket @@ -0,0 +1,8 @@ +[Unit] +Description=udev Kernel Socket +DefaultDependencies=no + +[Socket] +Service=udev.service +ReceiveBuffer=134217728 +ListenNetlink=kobject-uevent 1 -- cgit v1.2.3-54-g00ecf From 38932b9fbac17969721289f2101e9bd1af272112 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 May 2011 20:07:34 +0200 Subject: rules: fix whitespace --- udev/udev-rules.c | 814 ++++++++++++++++++++++++++---------------------------- 1 file changed, 397 insertions(+), 417 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 63123e083a..c24da0c497 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2091,58 +2091,55 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (match_key(rules, cur, udev_device_get_sysname(event->dev)) != 0) goto nomatch; break; - case TK_M_DEVLINK: - { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - struct udev_list_entry *list_entry; - bool match = false; - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { - const char *devlink; - - devlink = &udev_list_entry_get_name(list_entry)[devlen]; - if (match_key(rules, cur, devlink) == 0) { - match = true; - break; - } + case TK_M_DEVLINK: { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; + bool match = false; + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { + const char *devlink; + + devlink = &udev_list_entry_get_name(list_entry)[devlen]; + if (match_key(rules, cur, devlink) == 0) { + match = true; + break; } - if (!match) - goto nomatch; - break; } + if (!match) + goto nomatch; + break; + } case TK_M_NAME: if (match_key(rules, cur, event->name) != 0) goto nomatch; break; - case TK_M_ENV: - { - const char *key_name = &rules->buf[cur->key.attr_off]; - const char *value; - - value = udev_device_get_property_value(event->dev, key_name); - if (value == NULL) { - dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); - value = ""; - } - if (match_key(rules, cur, value)) - goto nomatch; - break; + case TK_M_ENV: { + const char *key_name = &rules->buf[cur->key.attr_off]; + const char *value; + + value = udev_device_get_property_value(event->dev, key_name); + if (value == NULL) { + dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); + value = ""; } - case TK_M_TAG: - { - struct udev_list_entry *list_entry; - bool match = false; - - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) { - if (strcmp(&rules->buf[cur->key.value_off], udev_list_entry_get_name(list_entry)) == 0) { - match = true; - break; - } + if (match_key(rules, cur, value)) + goto nomatch; + break; + } + case TK_M_TAG: { + struct udev_list_entry *list_entry; + bool match = false; + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) { + if (strcmp(&rules->buf[cur->key.value_off], udev_list_entry_get_name(list_entry)) == 0) { + match = true; + break; } - if (!match && (cur->key.op != OP_NOMATCH)) - goto nomatch; - break; } + if (!match && (cur->key.op != OP_NOMATCH)) + goto nomatch; + break; + } case TK_M_SUBSYSTEM: if (match_key(rules, cur, udev_device_get_subsystem(event->dev)) != 0) goto nomatch; @@ -2151,17 +2148,16 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (match_key(rules, cur, udev_device_get_driver(event->dev)) != 0) goto nomatch; break; - case TK_M_WAITFOR: - { - char filename[UTIL_PATH_SIZE]; - int found; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); - found = (wait_for_file(event->dev, filename, 10) == 0); - if (!found && (cur->key.op != OP_NOMATCH)) - goto nomatch; - break; - } + case TK_M_WAITFOR: { + char filename[UTIL_PATH_SIZE]; + int found; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); + found = (wait_for_file(event->dev, filename, 10) == 0); + if (!found && (cur->key.op != OP_NOMATCH)) + goto nomatch; + break; + } case TK_M_ATTR: if (match_attr(rules, event->dev, event, cur) != 0) goto nomatch; @@ -2169,223 +2165,215 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_M_KERNELS: case TK_M_SUBSYSTEMS: case TK_M_DRIVERS: - case TK_M_ATTRS: - { - struct token *next; - - /* get whole sequence of parent matches */ - next = cur; - while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX) - next++; + case TK_M_ATTRS: { + struct token *next; - /* loop over parents */ - event->dev_parent = event->dev; - for (;;) { - struct token *key; - - dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); - /* loop over sequence of parent match keys */ - for (key = cur; key < next; key++ ) { - dump_token(rules, key); - switch(key->type) { - case TK_M_KERNELS: - if (match_key(rules, key, udev_device_get_sysname(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_SUBSYSTEMS: - if (match_key(rules, key, udev_device_get_subsystem(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_DRIVERS: - if (match_key(rules, key, udev_device_get_driver(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_ATTRS: - if (match_attr(rules, event->dev_parent, event, key) != 0) - goto try_parent; - break; - default: - goto nomatch; - } - dbg(event->udev, "parent key matched\n"); - } - dbg(event->udev, "all parent keys matched\n"); - /* all keys matched */ - break; + /* get whole sequence of parent matches */ + next = cur; + while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX) + next++; - try_parent: - event->dev_parent = udev_device_get_parent(event->dev_parent); - if (event->dev_parent == NULL) + /* loop over parents */ + event->dev_parent = event->dev; + for (;;) { + struct token *key; + + dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); + /* loop over sequence of parent match keys */ + for (key = cur; key < next; key++ ) { + dump_token(rules, key); + switch(key->type) { + case TK_M_KERNELS: + if (match_key(rules, key, udev_device_get_sysname(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_SUBSYSTEMS: + if (match_key(rules, key, udev_device_get_subsystem(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_DRIVERS: + if (match_key(rules, key, udev_device_get_driver(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_ATTRS: + if (match_attr(rules, event->dev_parent, event, key) != 0) + goto try_parent; + break; + default: goto nomatch; + } + dbg(event->udev, "parent key matched\n"); } - /* move behind our sequence of parent match keys */ - cur = next; - continue; + dbg(event->udev, "all parent keys matched\n"); + /* all keys matched */ + break; + + try_parent: + event->dev_parent = udev_device_get_parent(event->dev_parent); + if (event->dev_parent == NULL) + goto nomatch; } - case TK_M_TEST: - { - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; - int match; + /* move behind our sequence of parent match keys */ + cur = next; + continue; + } + case TK_M_TEST: { + char filename[UTIL_PATH_SIZE]; + struct stat statbuf; + int match; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); - if (util_resolve_subsys_kernel(event->udev, filename, filename, sizeof(filename), 0) != 0) { - if (filename[0] != '/') { - char tmp[UTIL_PATH_SIZE]; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); + if (util_resolve_subsys_kernel(event->udev, filename, filename, sizeof(filename), 0) != 0) { + if (filename[0] != '/') { + char tmp[UTIL_PATH_SIZE]; - util_strscpy(tmp, sizeof(tmp), filename); - util_strscpyl(filename, sizeof(filename), - udev_device_get_syspath(event->dev), "/", tmp, NULL); - } - } - attr_subst_subdir(filename, sizeof(filename)); - - match = (stat(filename, &statbuf) == 0); - dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); - if (match && cur->key.mode > 0) { - match = ((statbuf.st_mode & cur->key.mode) > 0); - dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, - match ? "matches" : "does not match", cur->key.mode); + util_strscpy(tmp, sizeof(tmp), filename); + util_strscpyl(filename, sizeof(filename), + udev_device_get_syspath(event->dev), "/", tmp, NULL); } - if (match && cur->key.op == OP_NOMATCH) - goto nomatch; - if (!match && cur->key.op == OP_MATCH) - goto nomatch; - break; } + attr_subst_subdir(filename, sizeof(filename)); + + match = (stat(filename, &statbuf) == 0); + dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + if (match && cur->key.mode > 0) { + match = ((statbuf.st_mode & cur->key.mode) > 0); + dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + match ? "matches" : "does not match", cur->key.mode); + } + if (match && cur->key.op == OP_NOMATCH) + goto nomatch; + if (!match && cur->key.op == OP_MATCH) + goto nomatch; + break; + } case TK_M_EVENT_TIMEOUT: info(event->udev, "OPTIONS event_timeout=%u\n", cur->key.event_timeout); event->timeout_usec = cur->key.event_timeout * 1000 * 1000; break; - case TK_M_PROGRAM: - { - char program[UTIL_PATH_SIZE]; - char **envp; - char result[UTIL_PATH_SIZE]; - - free(event->program_result); - event->program_result = NULL; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], program, sizeof(program)); - envp = udev_device_get_properties_envp(event->dev); - info(event->udev, "PROGRAM '%s' %s:%u\n", - program, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - - if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } else { - int count; + case TK_M_PROGRAM: { + char program[UTIL_PATH_SIZE]; + char **envp; + char result[UTIL_PATH_SIZE]; + + free(event->program_result); + event->program_result = NULL; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + info(event->udev, "PROGRAM '%s' %s:%u\n", + program, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); - util_remove_trailing_chars(result, '\n'); - if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = udev_util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - } - event->program_result = strdup(result); - dbg(event->udev, "storing result '%s'\n", event->program_result); - if (cur->key.op == OP_NOMATCH) - goto nomatch; + if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } else { + int count; + + util_remove_trailing_chars(result, '\n'); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = udev_util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); } - break; + event->program_result = strdup(result); + dbg(event->udev, "storing result '%s'\n", event->program_result); + if (cur->key.op == OP_NOMATCH) + goto nomatch; } - case TK_M_IMPORT_FILE: - { - char import[UTIL_PATH_SIZE]; + break; + } + case TK_M_IMPORT_FILE: { + char import[UTIL_PATH_SIZE]; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - if (import_file_into_properties(event->dev, import) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_IMPORT_PROG: - { - char import[UTIL_PATH_SIZE]; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - info(event->udev, "IMPORT '%s' %s:%u\n", - import, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - - if (import_program_into_properties(event, import, sigmask) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_IMPORT_DB: - { - const char *key = &rules->buf[cur->key.value_off]; - const char *value; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + if (import_file_into_properties(event->dev, import) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PROG: { + char import[UTIL_PATH_SIZE]; - value = udev_device_get_property_value(event->dev_db, key); - if (value != NULL) { - struct udev_list_entry *entry; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + info(event->udev, "IMPORT '%s' %s:%u\n", + import, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); - entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_num(entry, true); - } else { - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } - break; - } - case TK_M_IMPORT_CMDLINE: - { - FILE *f; - bool imported = false; - - f = fopen("/proc/cmdline", "r"); - if (f != NULL) { - char cmdline[4096]; - - if (fgets(cmdline, sizeof(cmdline), f) != NULL) { - const char *key = &rules->buf[cur->key.value_off]; - char *pos; - - pos = strstr(cmdline, key); - if (pos != NULL) { - struct udev_list_entry *entry; - - pos += strlen(key); - if (pos[0] == '\0' || isspace(pos[0])) { - /* we import simple flags as 'FLAG=1' */ - entry = udev_device_add_property(event->dev, key, "1"); - udev_list_entry_set_num(entry, true); - imported = true; - } else if (pos[0] == '=') { - const char *value; + if (import_program_into_properties(event, import, sigmask) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_DB: { + const char *key = &rules->buf[cur->key.value_off]; + const char *value; + + value = udev_device_get_property_value(event->dev_db, key); + if (value != NULL) { + struct udev_list_entry *entry; + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_num(entry, true); + } else { + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_CMDLINE: { + FILE *f; + bool imported = false; + + f = fopen("/proc/cmdline", "r"); + if (f != NULL) { + char cmdline[4096]; + + if (fgets(cmdline, sizeof(cmdline), f) != NULL) { + const char *key = &rules->buf[cur->key.value_off]; + char *pos; + + pos = strstr(cmdline, key); + if (pos != NULL) { + struct udev_list_entry *entry; + + pos += strlen(key); + if (pos[0] == '\0' || isspace(pos[0])) { + /* we import simple flags as 'FLAG=1' */ + entry = udev_device_add_property(event->dev, key, "1"); + udev_list_entry_set_num(entry, true); + imported = true; + } else if (pos[0] == '=') { + const char *value; + + pos++; + value = pos; + while (pos[0] != '\0' && !isspace(pos[0])) pos++; - value = pos; - while (pos[0] != '\0' && !isspace(pos[0])) - pos++; - pos[0] = '\0'; - entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_num(entry, true); - imported = true; - } + pos[0] = '\0'; + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_num(entry, true); + imported = true; } } - fclose(f); } - if (!imported && cur->key.op != OP_NOMATCH) - goto nomatch; - break; + fclose(f); } - case TK_M_IMPORT_PARENT: - { - char import[UTIL_PATH_SIZE]; + if (!imported && cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PARENT: { + char import[UTIL_PATH_SIZE]; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - if (import_parent_into_properties(event->dev, import) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + if (import_parent_into_properties(event->dev, import) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } case TK_M_RESULT: if (match_key(rules, cur, event->program_result) != 0) goto nomatch; @@ -2409,62 +2397,59 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_A_DEVLINK_PRIO: udev_device_set_devlink_priority(event->dev, cur->key.devlink_prio); break; - case TK_A_OWNER: - { - char owner[UTIL_NAME_SIZE]; + case TK_A_OWNER: { + char owner[UTIL_NAME_SIZE]; - if (event->owner_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->owner_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); - event->uid = util_lookup_user(event->udev, owner); - info(event->udev, "OWNER %u %s:%u\n", - event->uid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); + if (event->owner_final) break; - } - case TK_A_GROUP: - { - char group[UTIL_NAME_SIZE]; + if (cur->key.op == OP_ASSIGN_FINAL) + event->owner_final = true; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); + event->uid = util_lookup_user(event->udev, owner); + info(event->udev, "OWNER %u %s:%u\n", + event->uid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_GROUP: { + char group[UTIL_NAME_SIZE]; - if (event->group_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->group_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); - event->gid = util_lookup_group(event->udev, group); - info(event->udev, "GROUP %u %s:%u\n", - event->gid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); + if (event->group_final) break; - } - case TK_A_MODE: - { - char mode_str[UTIL_NAME_SIZE]; - mode_t mode; - char *endptr; + if (cur->key.op == OP_ASSIGN_FINAL) + event->group_final = true; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); + event->gid = util_lookup_group(event->udev, group); + info(event->udev, "GROUP %u %s:%u\n", + event->gid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_MODE: { + char mode_str[UTIL_NAME_SIZE]; + mode_t mode; + char *endptr; - if (event->mode_final) - break; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode_str, sizeof(mode_str)); - mode = strtol(mode_str, &endptr, 8); - if (endptr[0] != '\0') { - err(event->udev, "ignoring invalid mode '%s'\n", mode_str); - break; - } - if (cur->key.op == OP_ASSIGN_FINAL) - event->mode_final = true; - event->mode_set = true; - event->mode = mode; - info(event->udev, "MODE %#o %s:%u\n", - event->mode, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); + if (event->mode_final) + break; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode_str, sizeof(mode_str)); + mode = strtol(mode_str, &endptr, 8); + if (endptr[0] != '\0') { + err(event->udev, "ignoring invalid mode '%s'\n", mode_str); break; } + if (cur->key.op == OP_ASSIGN_FINAL) + event->mode_final = true; + event->mode_set = true; + event->mode = mode; + info(event->udev, "MODE %#o %s:%u\n", + event->mode, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } case TK_A_OWNER_ID: if (event->owner_final) break; @@ -2501,143 +2486,138 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; case TK_A_STATIC_NODE: break; - case TK_A_ENV: - { - const char *name = &rules->buf[cur->key.attr_off]; - char *value = &rules->buf[cur->key.value_off]; - - if (value[0] != '\0') { - char temp_value[UTIL_NAME_SIZE]; - struct udev_list_entry *entry; - - udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); - entry = udev_device_add_property(event->dev, name, temp_value); - /* store in db, skip private keys */ - if (name[0] != '.') - udev_list_entry_set_num(entry, true); - } else { - udev_device_add_property(event->dev, name, NULL); - } - break; + case TK_A_ENV: { + const char *name = &rules->buf[cur->key.attr_off]; + char *value = &rules->buf[cur->key.value_off]; + + if (value[0] != '\0') { + char temp_value[UTIL_NAME_SIZE]; + struct udev_list_entry *entry; + + udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); + entry = udev_device_add_property(event->dev, name, temp_value); + /* store in db, skip private keys */ + if (name[0] != '.') + udev_list_entry_set_num(entry, true); + } else { + udev_device_add_property(event->dev, name, NULL); } + break; + } case TK_A_TAG: if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) udev_device_cleanup_tags_list(event->dev); udev_device_add_tag(event->dev, &rules->buf[cur->key.value_off]); break; - case TK_A_NAME: - { - const char *name = &rules->buf[cur->key.value_off]; - char name_str[UTIL_PATH_SIZE]; - int count; + case TK_A_NAME: { + const char *name = &rules->buf[cur->key.value_off]; + char name_str[UTIL_PATH_SIZE]; + int count; - if (event->name_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->name_final = true; - udev_event_apply_format(event, name, name_str, sizeof(name_str)); - if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = udev_util_replace_chars(name_str, "/"); - if (count > 0) - info(event->udev, "%i character(s) replaced\n", count); - } - free(event->name); - event->name = strdup(name_str); - info(event->udev, "NAME '%s' %s:%u\n", - event->name, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); + if (event->name_final) break; - } - case TK_A_DEVLINK: - { - char temp[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - char *pos, *next; - int count = 0; - - if (event->devlink_final) - break; - if (major(udev_device_get_devnum(event->dev)) == 0) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->devlink_final = true; - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_device_cleanup_devlinks_list(event->dev); - - /* allow multiple symlinks separated by spaces */ - udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); - if (esc == ESCAPE_UNSET) - count = udev_util_replace_chars(temp, "/ "); - else if (esc == ESCAPE_REPLACE) - count = udev_util_replace_chars(temp, "/"); + if (cur->key.op == OP_ASSIGN_FINAL) + event->name_final = true; + udev_event_apply_format(event, name, name_str, sizeof(name_str)); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = udev_util_replace_chars(name_str, "/"); if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); - pos = temp; - while (isspace(pos[0])) - pos++; - next = strchr(pos, ' '); - while (next != NULL) { - next[0] = '\0'; - info(event->udev, "LINK '%s' %s:%u\n", pos, - &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); - while (isspace(next[1])) - next++; - pos = &next[1]; - next = strchr(pos, ' '); - } - if (pos[0] != '\0') { - info(event->udev, "LINK '%s' %s:%u\n", pos, - &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); - } + info(event->udev, "%i character(s) replaced\n", count); } + free(event->name); + event->name = strdup(name_str); + info(event->udev, "NAME '%s' %s:%u\n", + event->name, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); break; - case TK_A_ATTR: - { - const char *key_name = &rules->buf[cur->key.attr_off]; - char attr[UTIL_PATH_SIZE]; - char value[UTIL_NAME_SIZE]; - FILE *f; - - if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) - util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); - attr_subst_subdir(attr, sizeof(attr)); - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], value, sizeof(value)); - info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - f = fopen(attr, "w"); - if (f != NULL) { - if (fprintf(f, "%s", value) <= 0) - err(event->udev, "error writing ATTR{%s}: %m\n", attr); - fclose(f); - } else { - err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); - } + } + case TK_A_DEVLINK: { + char temp[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char *pos, *next; + int count = 0; + + if (event->devlink_final) break; - } - case TK_A_RUN: - { - struct udev_list_entry *list_entry; - - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_list_cleanup_entries(event->udev, &event->run_list); - info(event->udev, "RUN '%s' %s:%u\n", - &rules->buf[cur->key.value_off], - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - list_entry = udev_list_entry_add(event->udev, &event->run_list, - &rules->buf[cur->key.value_off], NULL, UDEV_LIST_UNIQUE); - if (cur->key.fail_on_error) - udev_list_entry_set_num(list_entry, true); + if (major(udev_device_get_devnum(event->dev)) == 0) break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->devlink_final = true; + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_device_cleanup_devlinks_list(event->dev); + + /* allow multiple symlinks separated by spaces */ + udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); + if (esc == ESCAPE_UNSET) + count = udev_util_replace_chars(temp, "/ "); + else if (esc == ESCAPE_REPLACE) + count = udev_util_replace_chars(temp, "/"); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); + pos = temp; + while (isspace(pos[0])) + pos++; + next = strchr(pos, ' '); + while (next != NULL) { + next[0] = '\0'; + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); + while (isspace(next[1])) + next++; + pos = &next[1]; + next = strchr(pos, ' '); } + if (pos[0] != '\0') { + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); + } + break; + } + case TK_A_ATTR: { + const char *key_name = &rules->buf[cur->key.attr_off]; + char attr[UTIL_PATH_SIZE]; + char value[UTIL_NAME_SIZE]; + FILE *f; + + if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) + util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); + attr_subst_subdir(attr, sizeof(attr)); + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], value, sizeof(value)); + info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + f = fopen(attr, "w"); + if (f != NULL) { + if (fprintf(f, "%s", value) <= 0) + err(event->udev, "error writing ATTR{%s}: %m\n", attr); + fclose(f); + } else { + err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); + } + break; + } + case TK_A_RUN: { + struct udev_list_entry *list_entry; + + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_list_cleanup_entries(event->udev, &event->run_list); + info(event->udev, "RUN '%s' %s:%u\n", + &rules->buf[cur->key.value_off], + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + list_entry = udev_list_entry_add(event->udev, &event->run_list, + &rules->buf[cur->key.value_off], NULL, UDEV_LIST_UNIQUE); + if (cur->key.fail_on_error) + udev_list_entry_set_num(list_entry, true); + break; + } case TK_A_GOTO: if (cur->key.rule_goto == 0) break; -- cgit v1.2.3-54-g00ecf From 7df0ed83c113e4744786e7804d398d9d34b43281 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 May 2011 21:08:52 +0200 Subject: rules: implement TAGS== match --- NEWS | 8 ++++++++ TODO | 5 ----- udev/udev-rules.c | 26 ++++++++++++++++++++++++-- udev/udev.xml | 7 +++++++ 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 0dc85ecb51..c9ac6188d9 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +udev 171 +======== +!!! revert: "systemd: trigger - run after udev.service (for now)" + +The systemd service files require systemd version 28. The systemd +socket activation make it possible now to start 'udevd' and 'udevadm +trigger' in parallel. + udev 170 ======== Fix bug in control message handling, which can lead to a failing diff --git a/TODO b/TODO index 43e2b98ebd..ab7a5e85c9 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,3 @@ - - add TAGS=="foo" match - - - revert: "systemd: trigger - run after udev.service (for now)" - after systemd has a new release we can depend on - - delete mobile-action-modeswitch (moved to usb_modeswitch) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index c24da0c497..a77e1e223f 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -136,6 +136,7 @@ enum token_type { TK_M_SUBSYSTEMS, /* val */ TK_M_DRIVERS, /* val */ TK_M_ATTRS, /* val, attr */ + TK_M_TAGS, /* val */ TK_M_PARENTS_MAX, TK_M_TEST, /* val, mode_t */ @@ -271,6 +272,7 @@ static const char *token_str(enum token_type type) [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", [TK_M_DRIVERS] = "M DRIVERS", [TK_M_ATTRS] = "M ATTRS", + [TK_M_TAGS] = "M TAGS", [TK_M_PARENTS_MAX] = "M PARENTS_MAX", [TK_M_TEST] = "M TEST", @@ -342,6 +344,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) case TK_M_KERNELS: case TK_M_SUBSYSTEMS: case TK_M_DRIVERS: + case TK_M_TAGS: case TK_M_PROGRAM: case TK_M_IMPORT_FILE: case TK_M_IMPORT_PROG: @@ -1013,6 +1016,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_M_KERNELS: case TK_M_SUBSYSTEMS: case TK_M_DRIVERS: + case TK_M_TAGS: case TK_M_PROGRAM: case TK_M_IMPORT_FILE: case TK_M_IMPORT_PROG: @@ -1342,6 +1346,15 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } + if (strcmp(key, "TAGS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid TAGS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_TAGS, op, value, NULL); + continue; + } + if (strncmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { if (!sysfs_warn) { sysfs_warn = true; @@ -2165,7 +2178,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event case TK_M_KERNELS: case TK_M_SUBSYSTEMS: case TK_M_DRIVERS: - case TK_M_ATTRS: { + case TK_M_ATTRS: + case TK_M_TAGS: { struct token *next; /* get whole sequence of parent matches */ @@ -2199,13 +2213,21 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (match_attr(rules, event->dev_parent, event, key) != 0) goto try_parent; break; + case TK_M_TAGS: { + bool match = udev_device_has_tag(event->dev_parent, &rules->buf[cur->key.value_off]); + + if (match && key->key.op == OP_NOMATCH) + goto try_parent; + if (!match && key->key.op == OP_MATCH) + goto try_parent; + break; + } default: goto nomatch; } dbg(event->udev, "parent key matched\n"); } dbg(event->udev, "all parent keys matched\n"); - /* all keys matched */ break; try_parent: diff --git a/udev/udev.xml b/udev/udev.xml index 8a4212fd54..abbfee7ad1 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -233,6 +233,13 @@ + + + + Search the devpath upwards for a device with matching tag. + + + -- cgit v1.2.3-54-g00ecf From 19e47d97256390e4f42c5a4c96e26536d4d33e3e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 May 2011 02:15:43 +0200 Subject: libudev: enumerate - do not ignore other matches when add_match_tag() is used --- libudev/libudev-enumerate.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 12de24e244..6e51726f08 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -765,7 +765,18 @@ UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerat dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); if (dev == NULL) continue; + + if (!match_subsystem(udev_enumerate, udev_device_get_subsystem(dev))) + goto nomatch; + if (!match_sysname(udev_enumerate, udev_device_get_sysname(dev))) + goto nomatch; + if (!match_property(udev_enumerate, dev)) + goto nomatch; + if (!match_sysattr(udev_enumerate, dev)) + goto nomatch; + syspath_add(udev_enumerate, udev_device_get_syspath(dev)); +nomatch: udev_device_unref(dev); } closedir(dir); -- cgit v1.2.3-54-g00ecf From 1eb037a7bf22b6e4f3a778d0fbbe16675b6df712 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 May 2011 14:46:12 +0200 Subject: rules: support substitutions in TAG= --- udev/udev-rules.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index a77e1e223f..48395e7887 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2526,11 +2526,15 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event } break; } - case TK_A_TAG: + case TK_A_TAG: { + char tag[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], tag, sizeof(tag)); if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) udev_device_cleanup_tags_list(event->dev); - udev_device_add_tag(event->dev, &rules->buf[cur->key.value_off]); + udev_device_add_tag(event->dev, tag); break; + } case TK_A_NAME: { const char *name = &rules->buf[cur->key.value_off]; char name_str[UTIL_PATH_SIZE]; -- cgit v1.2.3-54-g00ecf From 3821339d2d0f515313b31f0b7e9bd158626e2bec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 May 2011 17:39:32 +0200 Subject: path_id: allow to be asked about usb_devices not only usb_interfaces --- extras/path_id/path_id.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 62d26d8c4d..683f78d26e 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -355,7 +355,9 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path) const char *port; devtype = udev_device_get_devtype(parent); - if (devtype == NULL || strcmp(devtype, "usb_interface") != 0) + if (devtype == NULL) + return parent; + if (strcmp(devtype, "usb_interface") != 0 && strcmp(devtype, "usb_device") != 0) return parent; str = udev_device_get_sysname(parent); -- cgit v1.2.3-54-g00ecf From f4c80a526410a697283dd9e30516295990a69c79 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 May 2011 21:45:49 +0200 Subject: systemd: run udev.service and udev-trigger.service in parallel --- NEWS | 2 +- init/udev-trigger.service.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index c9ac6188d9..301e725269 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ udev 171 ======== -!!! revert: "systemd: trigger - run after udev.service (for now)" +Bugfixes. The systemd service files require systemd version 28. The systemd socket activation make it possible now to start 'udevd' and 'udevadm diff --git a/init/udev-trigger.service.in b/init/udev-trigger.service.in index 817f7935e7..6d416c2b39 100644 --- a/init/udev-trigger.service.in +++ b/init/udev-trigger.service.in @@ -1,7 +1,7 @@ [Unit] Description=udev Coldplug all Devices Wants=udev.service -After=udev.service +After=udev-kernel.socket udev-control.socket DefaultDependencies=no [Service] -- cgit v1.2.3-54-g00ecf From 4c748b05a3bd0c36245e71b24dc45e2884f80376 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 27 May 2011 01:46:08 +0200 Subject: release 171 --- ChangeLog | 26 ++++++++++++++++++++++++++ configure.ac | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a0b364f9d8..138474c36f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +Summary of changes from v170 to v171 +============================================ + +Kay Sievers (17): + libudev: export symbols explicitely and individually from C code not from separate file or prefix match + libudev: device - make a bunch of symbols static + systemd: Replace Requires= with Wants=, run trigger in parallel + systemd: sort trigger after socket + systemd: trigger - run after udev.service (for now) + systemd: set socket buffer size to 128 MB like udev has + update TODO + update TODO + libudev: monitor - use SOCK_NONBLOCK + systemd: split socket file + systemd: add missing socket files + rules: fix whitespace + rules: implement TAGS== match + libudev: enumerate - do not ignore other matches when add_match_tag() is used + rules: support substitutions in TAG= + path_id: allow to be asked about usb_devices not only usb_interfaces + systemd: run udev.service and udev-trigger.service in parallel + +Scott James Remnant (1): + configure: allow usb.ids location to be specified + + Summary of changes from v169 to v170 ============================================ diff --git a/configure.ac b/configure.ac index cfdb3bf816..d8388883d5 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([udev], [170], [linux-hotplug@vger.kernel.org]) +AC_INIT([udev], [171], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) -- cgit v1.2.3-54-g00ecf From 3e227830ad6494700e18ae03297e8fb833ff26bf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 27 May 2011 02:50:29 +0200 Subject: rules: apply 'audio' group of the static snd/{seq,timer} nodes --- rules/rules.d/50-udev-default.rules | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index cd745effe0..cacb533db8 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -38,7 +38,8 @@ SUBSYSTEM=="graphics", GROUP="video" SUBSYSTEM=="drm", GROUP="video" # sound -SUBSYSTEM=="sound", GROUP="audio" +SUBSYSTEM=="sound", GROUP="audio", \ + OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer" # DVB (video) SUBSYSTEM=="dvb", GROUP="video" -- cgit v1.2.3-54-g00ecf From ea69e8217b4ddb9b054b2d3bf18260e71102646f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 30 May 2011 02:06:12 +0200 Subject: Makefile: add tar-sync --- Makefile.am | 3 +++ TODO | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Makefile.am b/Makefile.am index 16127b722e..998a385944 100644 --- a/Makefile.am +++ b/Makefile.am @@ -699,6 +699,9 @@ git-release: git gc git prune +tar-sync: + scp udev-$(VERSION).gz master.kernel.org:/pub/linux/utils/kernel/hotplug/ + doc-sync: rsync -av udev/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ diff --git a/TODO b/TODO index ab7a5e85c9..96cb83a176 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ + - libudev: return errno or set errno + - delete mobile-action-modeswitch (moved to usb_modeswitch) -- cgit v1.2.3-54-g00ecf From c112873b5bc9ebbae39c32f502bc6211f33546cc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 30 May 2011 02:12:02 +0200 Subject: rules: static_node - use 0660 if group is given to get the cigar >> On Tue, May 24, 2011 at 15:33, Tom Gundersen wrote: > > Close, but no cigar. Looks like the static nodes are not assigned > permissions 0660 even if a gid is set (the nodes have perms 0600). > > Cheers, > > Tom --- udev/udev-rules.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 48395e7887..56a258d8ad 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2709,8 +2709,9 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules) case TK_A_STATIC_NODE: { char filename[UTIL_PATH_SIZE]; struct stat stats; + /* we assure, that the permissions tokens are sorted before the static token */ - if (mode == 0 && uid == 0 && gid == 0) + if (uid == 0 && gid == 0) goto next; util_strscpyl(filename, sizeof(filename), udev_get_dev_path(rules->udev), "/", &rules->buf[cur->key.value_off], NULL); @@ -2718,14 +2719,19 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules) goto next; if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) goto next; - if (mode != 0 && mode != (stats.st_mode & 0777)) { + + if (mode == 0 && gid > 0) + mode = 0660; + if (mode != (stats.st_mode & 0777)) { chmod(filename, mode); info(rules->udev, "chmod '%s' %#o\n", filename, mode); } + if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) { chown(filename, uid, gid); info(rules->udev, "chown '%s' %u %u\n", filename, uid, gid); } + utimensat(AT_FDCWD, filename, NULL, 0); break; } -- cgit v1.2.3-54-g00ecf From be903bf9c48b41bdfcff205efa5fc593b7174e86 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 31 May 2011 02:18:33 +0200 Subject: rule-syntax-check.py: use print() --- test/rule-syntax-check.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py index 6cb021518d..a94a965a48 100755 --- a/test/rule-syntax-check.py +++ b/test/rule-syntax-check.py @@ -55,9 +55,9 @@ for path in sys.argv[1:]: if not (no_args_tests.match(clause) or args_tests.match(clause) or no_args_assign.match(clause) or args_assign.match(clause)): - print 'Invalid line %s:%i: %s' % (path, lineno, line) - print ' clause:', clause - print + print('Invalid line %s:%i: %s' % (path, lineno, line)) + print(' clause:', clause) + print() result = 1 break -- cgit v1.2.3-54-g00ecf From 6cadb40abf964141fe8c956dd6808f4885321eb6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 3 Jun 2011 14:38:43 +0200 Subject: make: use 'git tag' --- Makefile.am | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 998a385944..af9f8435f6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -695,9 +695,12 @@ git-release: head -1 ChangeLog | grep -q "to v$(VERSION)" head -1 NEWS | grep -q "udev $(VERSION)" git commit -a -m "release $(VERSION)" - cat .git/refs/heads/master > .git/refs/tags/$(VERSION) - git gc - git prune + git tag $(VERSION) + git gc --prune=0 + +git-sync: + git push + git push --tags $(VERSION) tar-sync: scp udev-$(VERSION).gz master.kernel.org:/pub/linux/utils/kernel/hotplug/ -- cgit v1.2.3-54-g00ecf From 24569e24dc94a7cffb8031eb0055e8d06cbdcb72 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 6 Jun 2011 18:44:09 +0200 Subject: accelerometer: add orientation property --- Makefile.am | 8 + extras/accelerometer/.gitignore | 1 + extras/accelerometer/61-accelerometer.rules | 3 + extras/accelerometer/accelerometer.c | 339 ++++++++++++++++++++++++++++ extras/input_id/input_id.c | 8 +- 5 files changed, 358 insertions(+), 1 deletion(-) create mode 100644 extras/accelerometer/.gitignore create mode 100644 extras/accelerometer/61-accelerometer.rules create mode 100644 extras/accelerometer/accelerometer.c diff --git a/Makefile.am b/Makefile.am index af9f8435f6..2ce9eb564b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -304,6 +304,14 @@ extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules libexec_PROGRAMS += extras/mtd_probe/mtd_probe +# ------------------------------------------------------------------------------ +# accelerometer - updates device orientation +# ------------------------------------------------------------------------------ +extras_accelerometer_accelerometer_SOURCES = extras/accelerometer/accelerometer.c +extras_accelerometer_accelerometer_LDADD = libudev/libudev-private.la -lm +libexec_PROGRAMS += extras/accelerometer/accelerometer +dist_udevrules_DATA += extras/accelerometer/61-accelerometer.rules + # ------------------------------------------------------------------------------ # qemu -- qemu/kvm guest tweaks # ------------------------------------------------------------------------------ diff --git a/extras/accelerometer/.gitignore b/extras/accelerometer/.gitignore new file mode 100644 index 0000000000..dddc2204d4 --- /dev/null +++ b/extras/accelerometer/.gitignore @@ -0,0 +1 @@ +accelerometer diff --git a/extras/accelerometer/61-accelerometer.rules b/extras/accelerometer/61-accelerometer.rules new file mode 100644 index 0000000000..a6a2bfd088 --- /dev/null +++ b/extras/accelerometer/61-accelerometer.rules @@ -0,0 +1,3 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="input", ACTION!="remove", ENV{ID_INPUT_ACCELEROMETER}=="1", IMPORT{program}="accelerometer %p" diff --git a/extras/accelerometer/accelerometer.c b/extras/accelerometer/accelerometer.c new file mode 100644 index 0000000000..e06bf190e5 --- /dev/null +++ b/extras/accelerometer/accelerometer.c @@ -0,0 +1,339 @@ +/* + * accelerometer - exports device orientation through property + * + * Copyright (C) 2011 Red Hat, Inc. + * Author: Bastien Nocera + * + * orientation_calc() from the sensorfw package: + * Copyright (C) 2009-2010 Nokia Corporation + * Authors: + * Üstün Ergenoglu + * Timo Rongas + * Lihan Guo + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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 keymap; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/* we must use this kernel-compatible implementation */ +#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<> OFF(bit)) & 1) + +static int debug = 0; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } +} + +typedef enum { + ORIENTATION_UNDEFINED, + ORIENTATION_NORMAL, + ORIENTATION_BOTTOM_UP, + ORIENTATION_LEFT_UP, + ORIENTATION_RIGHT_UP +} OrientationUp; + +static const char *orientations[] = { + "undefined", + "normal", + "bottom-up", + "left-up", + "right-up", + NULL +}; + +#define ORIENTATION_UP_UP ORIENTATION_NORMAL + +#define DEFAULT_THRESHOLD 250 +#define RADIANS_TO_DEGREES 180.0/M_PI +#define SAME_AXIS_LIMIT 5 + +#define THRESHOLD_LANDSCAPE 25 +#define THRESHOLD_PORTRAIT 20 + +static const char * +orientation_to_string (OrientationUp o) +{ + return orientations[o]; +} + +static OrientationUp +string_to_orientation (const char *orientation) +{ + int i; + + if (orientation == NULL) + return ORIENTATION_UNDEFINED; + for (i = 0; orientations[i] != NULL; i++) { + if (strcmp (orientation, orientations[i]) == 0) + return i; + } + return ORIENTATION_UNDEFINED; +} + +static OrientationUp +orientation_calc (OrientationUp prev, + int x, int y, int z) +{ + int rotation; + OrientationUp ret = prev; + + /* Portrait check */ + rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_PORTRAIT) { + ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP; + + /* Some threshold to switching between portrait modes */ + if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + + } else { + /* Landscape check */ + rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_LANDSCAPE) { + ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL; + + /* Some threshold to switching between landscape modes */ + if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + } + } + + return ret; +} + +static OrientationUp +get_prev_orientation(struct udev_device *dev) +{ + const char *value; + + value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); + if (value == NULL) + return ORIENTATION_UNDEFINED; + return string_to_orientation(value); +} + +#define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = 1; } } + +/* accelerometers */ +static void test_orientation(struct udev *udev, + struct udev_device *dev, + const char *devpath) +{ + OrientationUp old, new; + int fd, r; + struct input_event ev[64]; + int got_syn = 0; + int got_x, got_y, got_z; + int x = 0, y = 0, z = 0; + char text[64]; + + old = get_prev_orientation(dev); + + if ((fd = open(devpath, O_RDONLY)) < 0) + return; + + got_x = got_y = got_z = 0; + + while (1) { + int i; + + r = read(fd, ev, sizeof(struct input_event) * 64); + + if (r < (int) sizeof(struct input_event)) + return; + + for (i = 0; i < r / (int) sizeof(struct input_event); i++) { + if (got_syn == 1) { + if (ev[i].type == EV_ABS) { + SET_AXIS(x, ABS_X); + SET_AXIS(y, ABS_Y); + SET_AXIS(z, ABS_Z); + } + } + if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) { + got_syn = 1; + } + if (got_x && got_y && got_z) + goto read_dev; + } + } + +read_dev: + close(fd); + + if (!got_x || !got_y || !got_z) + return; + + new = orientation_calc(old, x, y, z); + snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new)); + puts(text); +} + +static void help(void) +{ + printf("Usage: accelerometer [options] \n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); +} + +int main (int argc, char** argv) +{ + struct udev *udev; + struct udev_device *dev; + + static const struct option options[] = { + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + char devpath[PATH_MAX]; + char *devnode; + const char *id_path; + struct udev_enumerate *enumerate; + struct udev_list_entry *list_entry; + + udev = udev_new(); + if (udev == NULL) + return 1; + + udev_log_init("input_id"); + udev_set_log_fn(udev, log_fn); + + /* CLI argument parsing */ + while (1) { + int option; + + option = getopt_long(argc, argv, "dxh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + help(); + exit(0); + default: + exit(1); + } + } + + if (argv[optind] == NULL) { + help(); + exit(1); + } + + /* get the device */ + snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); + dev = udev_device_new_from_syspath(udev, devpath); + if (dev == NULL) { + fprintf(stderr, "unable to access '%s'\n", devpath); + return 1; + } + + id_path = udev_device_get_property_value(dev, "ID_PATH"); + if (id_path == NULL) { + fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath); + return 0; + } + + /* Get the children devices and find the devnode + * FIXME: use udev_enumerate_add_match_children() instead + * when it's available */ + devnode = NULL; + enumerate = udev_enumerate_new(udev); + udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path); + udev_enumerate_add_match_subsystem(enumerate, "input"); + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + const char *node; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + /* Already found it */ + if (devnode != NULL) { + udev_device_unref(device); + continue; + } + + node = udev_device_get_devnode(device); + if (node == NULL) { + udev_device_unref(device); + continue; + } + /* Use the event sub-device */ + if (strstr(node, "/event") == NULL) { + udev_device_unref(device); + continue; + } + + devnode = strdup(node); + udev_device_unref(device); + } + + if (devnode == NULL) { + fprintf(stderr, "unable to get device node for '%s'\n", devpath); + return 0; + } + + info(udev, "Opening accelerometer device %s\n", devnode); + test_orientation(udev, dev, devnode); + free(devnode); + + return 0; +} diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index 5965d848da..ba53df01b0 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -109,8 +109,14 @@ static void test_pointers (const unsigned long* bitmask_ev, int is_mouse = 0; int is_touchpad = 0; - if (!test_bit (EV_KEY, bitmask_ev)) + if (!test_bit (EV_KEY, bitmask_ev)) { + if (test_bit (EV_ABS, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && + test_bit (ABS_Y, bitmask_abs) && + test_bit (ABS_Z, bitmask_abs)) + puts("ID_INPUT_ACCELEROMETER=1"); return; + } if (test_bit (EV_ABS, bitmask_ev) && test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { -- cgit v1.2.3-54-g00ecf From eb042a2c92fb857294e1380ff232a7633a2d3725 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 6 Jun 2011 18:46:23 +0200 Subject: rules: run input_id for main input devices too --- rules/rules.d/60-persistent-input.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index db0eda79e8..cd1de4e671 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -2,7 +2,6 @@ ACTION=="remove", GOTO="persistent_input_end" SUBSYSTEM!="input", GOTO="persistent_input_end" -KERNEL=="input[0-9]*", GOTO="persistent_input_end" ENV{ID_INPUT}=="", IMPORT{program}="input_id %p" SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{program}="usb_id --export %p" -- cgit v1.2.3-54-g00ecf From ac5c41ab70b1975d880ba86ece6f49bbc6bac44a Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 6 Jun 2011 18:50:13 +0200 Subject: udev-acl: fix memleak --- extras/udev-acl/udev-acl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c index 35bad76034..41e2536e03 100644 --- a/extras/udev-acl/udev-acl.c +++ b/extras/udev-acl/udev-acl.c @@ -288,8 +288,10 @@ static void apply_acl_to_devices(uid_t uid, int add) if (device == NULL) continue; node = udev_device_get_devnode(device); - if (node == NULL) + if (node == NULL) { + udev_device_unref(device); continue; + } set_facl(node, uid, add); udev_device_unref(device); } -- cgit v1.2.3-54-g00ecf From 7236c6c40a730d053141d9fe797dc65dc2ecd1f1 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Mon, 6 Jun 2011 20:05:20 +0200 Subject: accelerometer: add documentation --- extras/accelerometer/accelerometer.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/extras/accelerometer/accelerometer.c b/extras/accelerometer/accelerometer.c index e06bf190e5..59c2a4ece3 100644 --- a/extras/accelerometer/accelerometer.c +++ b/extras/accelerometer/accelerometer.c @@ -1,10 +1,28 @@ /* * accelerometer - exports device orientation through property * + * When an "change" event is received on an accelerometer, + * open its device node, and from the value, as well as the previous + * value of the property, calculate the device's new orientation, + * and export it as ID_INPUT_ACCELEROMETER_ORIENTATION. + * + * Possible values are: + * undefined + * * normal + * * bottom-up + * * left-up + * * right-up + * + * The property will be persistent across sessions, and the new + * orientations can be deducted from the previous one (it allows + * for a threshold for switching between opposite ends of the + * orientation). + * * Copyright (C) 2011 Red Hat, Inc. - * Author: Bastien Nocera + * Author: + * Bastien Nocera * - * orientation_calc() from the sensorfw package: + * orientation_calc() from the sensorfw package * Copyright (C) 2009-2010 Nokia Corporation * Authors: * Üstün Ergenoglu -- cgit v1.2.3-54-g00ecf From 812bfef52fd6a9f5d6dffb1ad790252e672689c5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 6 Jun 2011 20:10:35 +0200 Subject: update TODO --- TODO | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 96cb83a176..26f3d69759 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,19 @@ - - libudev: return errno or set errno + - detect uevent loops !!! + + - udev_enumerate_add_match_subsystem(enum, "input"); + udev_enumerate_add_match_sysname(enum, "event*"); + udev_enumerate_add_match_children(input_dev); + udev_enumerate_scan_devices(enum); + + - monitor: use clock MONOTONIC + + - libudev: return proper errno or set errno + + - move ctrl.c from libudev/ to udev/ + + - move: + udevd -> --libexecdir + udevadm -> --bindir - delete mobile-action-modeswitch (moved to usb_modeswitch) -- cgit v1.2.3-54-g00ecf From 761e089b0db38d3a8297142496156e2bd5f802c1 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 6 Jun 2011 13:30:31 -0400 Subject: ata_id: show the error message when HDIO_GET_IDENTITY fails Show an error message so that it's possible to determine why the HDIO_GET_IDENTITY ioctl has failed. --- extras/ata_id/ata_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index cb4a1a1f07..1e93fde4bf 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -535,7 +535,7 @@ int main(int argc, char *argv[]) info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); rc = 2; } else { - err(udev, "HDIO_GET_IDENTITY failed for '%s'\n", node); + err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); rc = 3; } goto close; -- cgit v1.2.3-54-g00ecf From 310aba9bca6f971d496936a53c6c7199b2ed0d7d Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 9 Jun 2011 06:54:45 +0200 Subject: keymap: Add Microsoft Natural Keyboard http://bugs.debian.org/629647 --- extras/keymap/95-keymap.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 9fb90048e8..ee12a87467 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -27,6 +27,8 @@ ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c52[9b]", ATTRS{name}=="Logitech U ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" +ENV{ID_VENDOR}=="Microsoft", ENV{ID_MODEL_ID}=="00db", RUN+="keymap $name 0xc022d zoomin 0xc022e zoomout" + GOTO="keyboard_end" # -- cgit v1.2.3-54-g00ecf From cbdb9c39f611c8ce410cf8da5db21eb3dfb10b34 Mon Sep 17 00:00:00 2001 From: "Lee, Chun-Yi" Date: Fri, 10 Jun 2011 14:45:12 +0800 Subject: Support more MSI notebook by using asterisk on dmi vendor name MSI machines have some different vendor name, and the refix on those vendor name are "MICRO-STAR" or "Micro-Star". So, merge the original two rules to one, and use asterisk on dmi vendor name for support more MSI machines. Tested on MSI U270 netbook. Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index ee12a87467..fcabe85be4 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -121,8 +121,7 @@ ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" -ENV{DMI_VENDOR}=="MICRO-STAR*", RUN+="keymap $name micro-star" -ENV{DMI_VENDOR}=="Micro-Star International", RUN+="keymap $name micro-star" +ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", RUN+="keymap $name micro-star" # some MSI models generate ACPI/input events on the LNXVIDEO input devices, # plus some extra synthesized ones on atkbd as an echo of actually changing the -- cgit v1.2.3-54-g00ecf From 5671bdefd179f860011a2c28f1d6215c20f086c1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 10 Jun 2011 16:20:11 +0200 Subject: configure: add AC_CONFIG_AUX_DIR, AC_CONFIG_SRCDIR --- configure.ac | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/configure.ac b/configure.ac index d8388883d5..be3052cb73 100644 --- a/configure.ac +++ b/configure.ac @@ -1,11 +1,17 @@ -AC_INIT([udev], [171], [linux-hotplug@vger.kernel.org]) AC_PREREQ(2.60) -AM_INIT_AUTOMAKE([check-news foreign 1.10 dist-bzip2 subdir-objects]) -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) +AC_INIT([udev], + [171], + [linux-hotplug@vger.kernel.org], + [udev], + [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) +AC_CONFIG_SRCDIR([udev/udevd.c]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax dist-bzip2 subdir-objects]) AC_DISABLE_STATIC AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) +AM_SILENT_RULES([yes]) LT_INIT AC_PROG_AWK GTK_DOC_CHECK(1.10) @@ -131,8 +137,6 @@ if test "x$enable_udev_acl" = xyes; then AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) - AC_SUBST([GLIB_CFLAGS]) - AC_SUBST([GLIB_LIBS]) fi AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = xyes]) @@ -144,13 +148,11 @@ AC_ARG_ENABLE([gudev], [], [enable_gudev=yes]) if test "x$enable_gudev" = xyes; then PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) - AC_SUBST([GLIB_CFLAGS]) - AC_SUBST([GLIB_LIBS]) fi AC_ARG_ENABLE([introspection], - AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), - [], [enable_introspection=yes]) + AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), + [], [enable_introspection=yes]) if test "x$enable_introspection" = xyes; then PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) @@ -205,8 +207,6 @@ AC_ARG_ENABLE([action_modeswitch], [], [enable_action_modeswitch=no]) if test "x$enable_action_modeswitch" = xyes; then PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12) - AC_SUBST(LIBUSB_CFLAGS) - AC_SUBST(LIBUSB_LIBS) fi AM_CONDITIONAL([ENABLE_ACTION_MODESWITCH], [test "x$enable_action_modeswitch" = xyes]) -- cgit v1.2.3-54-g00ecf From 7dc39c9cada5ada1f6dae55d50e25f0d8923d302 Mon Sep 17 00:00:00 2001 From: Marco d'Itri Date: Sat, 11 Jun 2011 04:42:44 +0200 Subject: Add missing commas to 95-keymap.rules Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index fcabe85be4..98db471815 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -74,8 +74,8 @@ ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Latitude XT2", RUN+="keym ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x6_tablet" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X20* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet" RUN+="keymap $name lenovo-thinkpad_x200_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x6_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X20* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x200_tablet" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" -- cgit v1.2.3-54-g00ecf From 693b6344e193f5aeca21df5f1c98fd32148006ac Mon Sep 17 00:00:00 2001 From: "Keshav P.R" Date: Sat, 11 Jun 2011 13:35:53 +0200 Subject: rules: support for gpt partition uuid/label --- rules/rules.d/60-persistent-storage.rules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 05a405f64b..0a21d85459 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -80,4 +80,8 @@ ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" +# by-partlabel/by-partuuid links (partition metadata) +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}" +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" + LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From b20fd3cb3423676a86f12189126b012d2297d5f7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Jun 2011 20:54:47 +0200 Subject: cdrom_id: add tray lock and eject handling --- extras/cdrom_id/60-cdrom_id.rules | 12 ++-- extras/cdrom_id/cdrom_id.c | 124 +++++++++++++++++++++++++++++--------- 2 files changed, 105 insertions(+), 31 deletions(-) diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index 1ad1d0cc23..896af34825 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -5,10 +5,14 @@ SUBSYSTEM!="block", GOTO="cdrom_end" KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" ENV{DEVTYPE}!="disk", GOTO="cdrom_end" -# this is only a button press event -ENV{DISK_EJECT_REQUEST}=="?*", GOTO="cdrom_end" - +# unconditionally tag device as CDROM KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" -IMPORT{program}="cdrom_id $tempnode" + +# media eject button pressed +ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $tempnode", GOTO="cdrom_end" + +# import device and media properties and lock tray to +# enable the receiving of media eject button events +IMPORT{program}="cdrom_id --lock-media $tempnode" LABEL="cdrom_end" diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c index 7908f6d19a..664a00d2c7 100644 --- a/extras/cdrom_id/cdrom_id.c +++ b/extras/cdrom_id/cdrom_id.c @@ -41,7 +41,7 @@ #include "libudev.h" #include "libudev-private.h" -static int debug; +static bool debug; static void log_fn(struct udev *udev, int priority, const char *file, int line, const char *fn, @@ -156,13 +156,11 @@ struct scsi_cmd { struct sg_io_hdr sg_io; }; -static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd, unsigned char *buf, size_t bufsize) +static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd) { memset(cmd, 0x00, sizeof(struct scsi_cmd)); - memset(buf, 0x00, bufsize); cmd->cgc.quiet = 1; cmd->cgc.sense = &cmd->_sense.s; - memset(&cmd->sg_io, 0, sizeof(cmd->sg_io)); cmd->sg_io.interface_id = 'S'; cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); cmd->sg_io.cmdp = cmd->cgc.cmd; @@ -182,9 +180,13 @@ static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigne { int ret = 0; - cmd->sg_io.dxferp = buf; - cmd->sg_io.dxfer_len = bufsize; - cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + if (bufsize > 0) { + cmd->sg_io.dxferp = buf; + cmd->sg_io.dxfer_len = bufsize; + cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + } else { + cmd->sg_io.dxfer_direction = SG_DXFER_NONE; + } if (ioctl(fd, SG_IO, &cmd->sg_io)) return -1; @@ -200,6 +202,39 @@ static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigne return ret; } +static int media_lock(struct udev *udev, int fd, bool lock) +{ + int err; + + /* disable the kernel's lock logic */ + err = ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK); + if (err < 0) + info(udev, "CDROM_CLEAR_OPTIONS, CDO_LOCK failed\n"); + + err = ioctl(fd, CDROM_LOCKDOOR, lock ? 1 : 0); + if (err < 0) + info(udev, "CDROM_LOCKDOOR failed\n"); + + return err; +} + +static int media_eject(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x1b); + scsi_cmd_set(udev, &sc, 4, 0x02); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, NULL, 0); + if ((err != 0)) { + info_scsi_cmd_err(udev, "START_STOP_UNIT", err); + return -1; + } + return 0; +} + static int cd_capability_compat(struct udev *udev, int fd) { int capability; @@ -237,12 +272,13 @@ static int cd_media_compat(struct udev *udev, int fd) return 0; } -static int cd_inquiry(struct udev *udev, int fd) { +static int cd_inquiry(struct udev *udev, int fd) +{ struct scsi_cmd sc; unsigned char inq[128]; int err; - scsi_cmd_init(udev, &sc, inq, sizeof(inq)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x12); scsi_cmd_set(udev, &sc, 4, 36); scsi_cmd_set(udev, &sc, 5, 0); @@ -467,7 +503,7 @@ static int cd_profiles_old_mmc(struct udev *udev, int fd) unsigned char header[32]; - scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x51); scsi_cmd_set(udev, &sc, 8, sizeof(header)); scsi_cmd_set(udev, &sc, 9, 0); @@ -513,7 +549,7 @@ static int cd_profiles(struct udev *udev, int fd) ret = -1; /* First query the current profile */ - scsi_cmd_init(udev, &sc, features, sizeof(features)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x46); scsi_cmd_set(udev, &sc, 8, 8); scsi_cmd_set(udev, &sc, 9, 0); @@ -549,7 +585,7 @@ static int cd_profiles(struct udev *udev, int fd) } /* Now get the full feature buffer */ - scsi_cmd_init(udev, &sc, features, len); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x46); scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff); scsi_cmd_set(udev, &sc, 8, len & 0xff); @@ -601,7 +637,7 @@ static int cd_media_info(struct udev *udev, int fd) }; int err; - scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x51); scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); scsi_cmd_set(udev, &sc, 9, 0); @@ -639,7 +675,7 @@ static int cd_media_info(struct udev *udev, int fd) unsigned char dvdstruct[8]; unsigned char format[12]; - scsi_cmd_init(udev, &sc, dvdstruct, sizeof(dvdstruct)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0xAD); scsi_cmd_set(udev, &sc, 7, 0xC0); scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); @@ -656,7 +692,7 @@ static int cd_media_info(struct udev *udev, int fd) } /* let's make sure we don't try to read unformatted media */ - scsi_cmd_init(udev, &sc, format, sizeof(format)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x23); scsi_cmd_set(udev, &sc, 8, sizeof(format)); scsi_cmd_set(udev, &sc, 9, 0); @@ -697,7 +733,7 @@ static int cd_media_info(struct udev *udev, int fd) * has "blank" status", DVD-RAM was examined earlier) and check * for ISO and UDF PVDs or a fs superblock presence and do it * in one ioctl (we need just sectors 0 and 16) */ - scsi_cmd_init(udev, &sc, buffer, sizeof(buffer)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x28); scsi_cmd_set(udev, &sc, 5, 0); scsi_cmd_set(udev, &sc, 8, 32); @@ -750,7 +786,7 @@ static int cd_media_toc(struct udev *udev, int fd) unsigned char *p; int err; - scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, 1); scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); @@ -774,7 +810,7 @@ static int cd_media_toc(struct udev *udev, int fd) if (len < 8) return 0; - scsi_cmd_init(udev, &sc, toc, sizeof(toc)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); @@ -805,7 +841,7 @@ static int cd_media_toc(struct udev *udev, int fd) cd_media_track_count_audio++; } - scsi_cmd_init(udev, &sc, header, sizeof(header)); + scsi_cmd_init(udev, &sc); scsi_cmd_set(udev, &sc, 0, 0x43); scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ scsi_cmd_set(udev, &sc, 8, sizeof(header)); @@ -825,10 +861,16 @@ int main(int argc, char *argv[]) { struct udev *udev; static const struct option options[] = { + { "lock-media", no_argument, NULL, 'l' }, + { "unlock-media", no_argument, NULL, 'u' }, + { "eject-media", no_argument, NULL, 'e' }, { "debug", no_argument, NULL, 'd' }, { "help", no_argument, NULL, 'h' }, {} }; + bool eject = false; + bool lock = false; + bool unlock = false; const char *node = NULL; int fd = -1; int cnt; @@ -844,18 +886,30 @@ int main(int argc, char *argv[]) while (1) { int option; - option = getopt_long(argc, argv, "dh", options, NULL); + option = getopt_long(argc, argv, "deluh", options, NULL); if (option == -1) break; switch (option) { + case 'l': + lock = true; + break; + case 'u': + unlock = true; + break; + case 'e': + eject = true; + break; case 'd': - debug = 1; + debug = true; if (udev_get_log_priority(udev) < LOG_INFO) udev_set_log_priority(udev, LOG_INFO); break; case 'h': printf("Usage: cdrom_id [options] \n" + " --lock-media lock the media (to enable eject request events)\n" + " --unlock-media unlock the media\n" + " --eject-media eject the media\n" " --debug debug to stderr\n" " --help print this help text\n\n"); goto exit; @@ -904,14 +958,13 @@ int main(int argc, char *argv[]) /* check if drive talks MMC */ if (cd_inquiry(udev, fd) < 0) - goto print; + goto work; /* read drive and possibly current profile */ if (cd_profiles(udev, fd) != 0) - goto print; + goto work; - /* at this point we are guaranteed to have media in the - * drive - find out more about it */ + /* at this point we are guaranteed to have media in the drive - find out more about it */ /* get session/track info */ cd_media_toc(udev, fd); @@ -919,7 +972,25 @@ int main(int argc, char *argv[]) /* get writable media state */ cd_media_info(udev, fd); -print: +work: + /* lock the media, so we enable eject button events */ + if (lock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (lock)\n"); + media_lock(udev, fd, true); + } + + if (unlock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + } + + if (eject) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + info(udev, "START_STOP_UNIT (eject)\n"); + media_eject(udev, fd); + } + printf("ID_CDROM=1\n"); if (cd_cd_rom) printf("ID_CDROM_CD=1\n"); @@ -1026,4 +1097,3 @@ exit: udev_log_close(); return rc; } - -- cgit v1.2.3-54-g00ecf From c5a41da94916815ac14d950a0547bffc4411f7af Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Jun 2011 21:01:33 +0200 Subject: rules: enable in-kernel media-presence polling --- rules/rules.d/60-persistent-storage.rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 0a21d85459..537e1e04b2 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -69,7 +69,10 @@ KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DAT # probe filesystem metadata of disks KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" -# watch for future changes +# enable in-kernel media-presence polling +SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}="2000" + +# watch metadata changes by tools closing the device after writing KERNEL!="sr*", OPTIONS+="watch" # by-label/by-uuid links (filesystem metadata) -- cgit v1.2.3-54-g00ecf From f59e9fbb189933c5c10eb3610c4685f1c67e8b35 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Jun 2011 21:02:05 +0200 Subject: update TODO --- TODO | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TODO b/TODO index 26f3d69759..f8045468c9 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,7 @@ - detect uevent loops !!! + - use 'udevd:' in logs + - udev_enumerate_add_match_subsystem(enum, "input"); udev_enumerate_add_match_sysname(enum, "event*"); udev_enumerate_add_match_children(input_dev); -- cgit v1.2.3-54-g00ecf From 6297c2d4e48068685ac810d631291daf75a95ec7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Jun 2011 22:38:39 +0200 Subject: delete mobile-action-modeswitch which has moved to usb_modeswitch --- INSTALL | 2 - Makefile.am | 17 - TODO | 3 - configure.ac | 12 - extras/mobile-action-modeswitch/.gitignore | 1 - .../61-mobile-action.rules | 15 - extras/mobile-action-modeswitch/ma8280p_us.c | 462 --------------------- extras/mobile-action-modeswitch/ma8280p_us.h | 24 -- .../mobile-action-modeswitch.c | 262 ------------ extras/mobile-action-modeswitch/utils.c | 83 ---- extras/mobile-action-modeswitch/utils.h | 32 -- 11 files changed, 913 deletions(-) delete mode 100644 extras/mobile-action-modeswitch/.gitignore delete mode 100644 extras/mobile-action-modeswitch/61-mobile-action.rules delete mode 100644 extras/mobile-action-modeswitch/ma8280p_us.c delete mode 100644 extras/mobile-action-modeswitch/ma8280p_us.h delete mode 100644 extras/mobile-action-modeswitch/mobile-action-modeswitch.c delete mode 100644 extras/mobile-action-modeswitch/utils.c delete mode 100644 extras/mobile-action-modeswitch/utils.h diff --git a/INSTALL b/INSTALL index 5d3087e438..aeabcb9dfc 100644 --- a/INSTALL +++ b/INSTALL @@ -43,8 +43,6 @@ All options: Enable legacy floppy support. --enable-edd Enable disk edd support. - --enable-action_modeswitch - Enable action modeswitch support. The options used in a RPM spec file usually look like: %configure \ diff --git a/Makefile.am b/Makefile.am index 2ce9eb564b..3ea96df90f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -636,23 +636,6 @@ libexec_PROGRAMS += extras/edd_id/edd_id dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules endif -if ENABLE_ACTION_MODESWITCH -# ------------------------------------------------------------------------------ -# mobile-action-modeswitch - switch Mobile Action cables into serial mode -# ------------------------------------------------------------------------------ -extras_mobile_action_modeswitch_mobile_action_modeswitch_SOURCES =\ - extras/mobile-action-modeswitch/mobile-action-modeswitch.c \ - extras/mobile-action-modeswitch/utils.c \ - extras/mobile-action-modeswitch/utils.h \ - extras/mobile-action-modeswitch/ma8280p_us.c \ - extras/mobile-action-modeswitch/ma8280p_us.h -extras_mobile_action_modeswitch_mobile_action_modeswitch_CPPFLAGS = $(AM_CPPFLAGS) $(LIBUSB_CFLAGS) -extras_mobile_action_modeswitch_mobile_action_modeswitch_LDADD = libudev/libudev-private.la $(LIBUSB_LIBS) -dist_udevrules_DATA += \ - extras/mobile-action-modeswitch/61-mobile-action.rules -libexec_PROGRAMS += extras/mobile-action-modeswitch/mobile-action-modeswitch -endif - # ------------------------------------------------------------------------------ # install, uninstall, clean hooks # ------------------------------------------------------------------------------ diff --git a/TODO b/TODO index f8045468c9..4e1d723136 100644 --- a/TODO +++ b/TODO @@ -17,9 +17,6 @@ udevd -> --libexecdir udevadm -> --bindir - - delete mobile-action-modeswitch - (moved to usb_modeswitch) - - /run/udev/control socket (add ConditionVirtualization=!pidns) diff --git a/configure.ac b/configure.ac index be3052cb73..975e5fbfdb 100644 --- a/configure.ac +++ b/configure.ac @@ -199,17 +199,6 @@ AC_ARG_ENABLE([edd], [], [enable_edd=no]) AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = xyes]) -# ------------------------------------------------------------------------------ -# mobile-action-modeswitch - switch Mobile Action cables into serial mode -# ------------------------------------------------------------------------------ -AC_ARG_ENABLE([action_modeswitch], - AS_HELP_STRING([--enable-action_modeswitch], [enable action modeswitch support]), - [], [enable_action_modeswitch=no]) -if test "x$enable_action_modeswitch" = xyes; then - PKG_CHECK_MODULES(LIBUSB, libusb >= 0.1.12) -fi -AM_CONDITIONAL([ENABLE_ACTION_MODESWITCH], [test "x$enable_action_modeswitch" = xyes]) - AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile @@ -261,7 +250,6 @@ AC_MSG_RESULT([ keymap: ${enable_keymap} floppy: ${enable_floppy} edd: ${enable_edd} - action_modeswitch: ${enable_action_modeswitch} usb.ids: ${USB_DATABASE} pci.ids: ${PCI_DATABASE} diff --git a/extras/mobile-action-modeswitch/.gitignore b/extras/mobile-action-modeswitch/.gitignore deleted file mode 100644 index 16c8000dfd..0000000000 --- a/extras/mobile-action-modeswitch/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mobile-action-modeswitch diff --git a/extras/mobile-action-modeswitch/61-mobile-action.rules b/extras/mobile-action-modeswitch/61-mobile-action.rules deleted file mode 100644 index 0af27a5cd4..0000000000 --- a/extras/mobile-action-modeswitch/61-mobile-action.rules +++ /dev/null @@ -1,15 +0,0 @@ -ACTION!="add", GOTO="mobile_action_end" - -# ATTENTION: DO NOT USE THIS FILE FOR ANYTHING EXCEPT -# MOBILE ACTION CABLES. DO NOT USE IT FOR 3G DEVICES! - -SUBSYSTEM=="usb", ATTR{bDeviceClass}=="00|ff", ATTR{bDeviceSubClass}=="00|ff", ENV{DEVTYPE}=="usb_device", GOTO="mobile_action_switch" -GOTO="mobile_action_end" - -LABEL="mobile_action_switch" - -# Mobile Action cables like the 8280p and 8230p -ATTRS{idVendor}=="0df7", ATTRS{idProduct}=="0800", RUN+="mobile-action-modeswitch -v 0x%s{idVendor} -p 0x%s{idProduct} -t mobile-action-8280p" - -LABEL="mobile_action_end" - diff --git a/extras/mobile-action-modeswitch/ma8280p_us.c b/extras/mobile-action-modeswitch/ma8280p_us.c deleted file mode 100644 index d7cf4f4b3f..0000000000 --- a/extras/mobile-action-modeswitch/ma8280p_us.c +++ /dev/null @@ -1,462 +0,0 @@ -/* http://www.natox.be/ma8280p/ - * http://www.leopold.dk/~martin/ma-8230p.html - * http://figvam.blogspot.com/2007/01/mobile-action-8730p-usb-cable-and-linux.html - */ - -/* - * - * Code by davy hollevoet. This is simply an adaptation of code - * generated by usbsnoop2libusb. (http://iki.fi/lindi/usb/usbsnoop2libusb.pl) - * - * This code is released under both the GPL version 2 and BSD licenses. - * Either license may be used. - * - * GPLv2 - * ******** - * 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; either version 2 - * of the License, or (at your option) any later version. - * - * 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. - * - * In addition: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * BSD - * ****** - * Copyright (c) 1998, Regents of the University of California - * All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the University of California, Berkeley nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -/* This file is (mostly) generated with usbsnoop2libusb.pl from a usbsnoop log file. */ -/* Latest version of the script should be in http://iki.fi/lindi/usb/usbsnoop2libusb.pl */ -#include -#include -#include -#include -#include -#include -#include -#include - -#include "utils.h" -#include "ma8280p_us.h" - -static void msleep(long msec) -{ - struct timespec duration = { 0, msec * 1000 * 1000 }; - - nanosleep(&duration, NULL); -} - -int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev) -{ - int ret = 1; - char *buf = NULL; - - buf = malloc (65535); - if (!buf) { - error ("%s: not enough memory", dev->filename, ret); - return -1; - } - - usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); - msleep(6); - usb_get_descriptor(devh, 0x0000001, 0x0000000, buf, 0x0000012); - msleep(6); - usb_get_descriptor(devh, 0x0000002, 0x0000000, buf, 0x0000400); - msleep(10); - ret = usb_release_interface(devh, 0); - if (ret != 0) - debug ("%s: failed to release interface before set_configuration: %d", dev->filename, ret); - usb_set_configuration(devh, 0x0000001); - ret = usb_claim_interface(devh, 0); - if (ret != 0) - debug ("%s: claim after set_configuration failed with error %d", dev->filename, ret); - //usb_set_altinterface(devh, 0); - //msleep(33); - usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE + USB_ENDPOINT_IN, 0x0000001, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - msleep(5); - memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); - usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - msleep(4); - memcpy(buf, "\xb0\x04\x00\x00\x02\x90\x26\x86", 0x0000008); - usb_control_msg(devh, USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x0000009, 0x0000300, 0x0000000, buf, 0x0000008, 1000); - msleep(4); - - msleep(4); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(6); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(3); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(2); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x37\x01\xfe\xdb\xc1\x33\x1f\x83", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(2); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x37\x0e\xb5\x9d\x3b\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - memcpy(buf, "\x34\x87\xba\x0d\xfc\x8a\x91\x51", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(7); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(8); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x33\x04\xfe\x00\xf4\x6c\x1f\xf0", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(3); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - msleep(1); - //URB_FUNCTION_GET_STATUS_FROM_ENDPOINT skipped - msleep(4); - memcpy(buf, "\x32\x07\xfe\xf0\x29\xb9\x3a\xf0", 0x0000008); - usb_interrupt_write(devh, 0x00000002, buf, 0x0000008, 1000); - msleep(3); - usb_interrupt_read(devh, 0x00000081, buf, 0x0000008, 1000); - - if (buf) - free (buf); - return 0; -} diff --git a/extras/mobile-action-modeswitch/ma8280p_us.h b/extras/mobile-action-modeswitch/ma8280p_us.h deleted file mode 100644 index bf0e304401..0000000000 --- a/extras/mobile-action-modeswitch/ma8280p_us.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2009 Dan Williams - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#ifndef __MA8280P_H__ -#define __MA8280P_H__ - -#include - -int ma8280p_switch (struct usb_dev_handle *devh, struct usb_device *dev); - -#endif /* __MA8280P_H__ */ diff --git a/extras/mobile-action-modeswitch/mobile-action-modeswitch.c b/extras/mobile-action-modeswitch/mobile-action-modeswitch.c deleted file mode 100644 index 36d7d81a11..0000000000 --- a/extras/mobile-action-modeswitch/mobile-action-modeswitch.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Mobile action cable mode switcher - * - * Copyright (C) 2008 - 2010 Dan Williams - * Copyright (C) 2008 Peter Henn - * - * Heavily based on the 'ozerocdoff' tool by Peter Henn. - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "utils.h" - -#include "ma8280p_us.h" - -struct usb_dev_handle *handle = NULL; - -typedef struct usb_device * (*FindFunc) (int vid, int pid); -typedef int (*SwitchFunc) (struct usb_dev_handle *dh, struct usb_device *dev); - -typedef enum { - ST_UNKNOWN = 0, - ST_MA8280P -} SwitchType; - -typedef struct SwitchEntry { - SwitchType st; - const char *clopt; - FindFunc find_func; - SwitchFunc switch_func; -} SwitchEntry; - -static SwitchEntry switch_types[] = { - { ST_MA8280P, "mobile-action-8280p", NULL, ma8280p_switch }, - { ST_UNKNOWN, NULL, NULL } -}; - -static struct usb_device * -generic_find (int vid, int pid) -{ - struct usb_bus *bus; - struct usb_device *dev; - - for (bus = usb_get_busses(); bus; bus = bus->next) { - for (dev = bus->devices; dev; dev = dev->next) { - if (dev->descriptor.idVendor == vid && dev->descriptor.idProduct == pid) { - debug ("Found device '%s'", dev->filename); - return dev; - } - } - } - return NULL; -} - -static void -release_usb_device (int param) -{ - usb_release_interface (handle, 0); - usb_close (handle); -} - -static void -print_usage (void) -{ - printf ("Usage: mobile-action-modeswitch [-hdq] [-l ] -v -p -t \n" - " -h, --help show this help message\n" - " -v, --vendor target USB vendor ID\n" - " -p, --product target USB product ID\n" - " -t, --type type of switch to attempt, varies by device:\n" - " mobile-action-8280p - For Mobile Action 8xxxP USB cables\n" - " -l, --log log output to a file\n" - " -q, --quiet don't print anything to stdout\n" - " -d, --debug display debugging messages\n\n" - "Examples:\n" - " mobile-action-modeswitch -v 0x0df7 -p 0x8000 -t mobile-action-8280p\n"); -} - -static SwitchEntry * -parse_type (const char *s) -{ - SwitchEntry *entry = &switch_types[0]; - - while (entry->clopt) { - if (!strcmp (entry->clopt, s)) - return entry; - entry++; - } - - return NULL; -} - -static void -do_exit (int val) -{ - log_shutdown (); - exit (val); -} - -int main(int argc, char **argv) -{ - static struct option options[] = { - { "help", no_argument, NULL, 'h' }, - { "vendor", required_argument, NULL, 'v' }, - { "product", required_argument, NULL, 'p' }, - { "type", required_argument, NULL, 't' }, - { "log", required_argument, NULL, 'l' }, - { "debug", no_argument, NULL, 'd' }, - { "quiet", no_argument, NULL, 'q' }, - { NULL, 0, NULL, 0} - }; - - struct usb_device *dev; - int vid = 0, pid = 0; - const char *logpath = NULL; - char buffer[256]; - int ret, quiet = 0, debug = 0; - SwitchEntry *sentry = NULL; - - while (1) { - int option; - - option = getopt_long(argc, argv, "hv:p:l:t:dq", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'v': - vid = strtol (optarg, NULL, 0); - break; - case 'p': - pid = strtol (optarg, NULL, 0); - break; - case 't': - sentry = parse_type (optarg); - if (!sentry) { - error ("unknown switch type '%s'", optarg); - print_usage (); - exit (1); - } - break; - case 'l': - logpath = optarg; - break; - case 'q': - quiet = 1; - break; - case 'd': - debug = 1; - break; - case 'h': - default: - print_usage (); - exit (1); - } - } - - if (log_startup (logpath, debug, quiet)) { - fprintf (stderr, "Couldn't open/create logfile %s", logpath); - exit (2); - } - - if (!sentry) { - if (!quiet) - print_usage (); - else - error ("missing device switch type."); - do_exit (3); - } - - if (!vid || !pid) { - if (!quiet) - print_usage (); - else - error ("missing vendor and device IDs."); - do_exit (3); - } - - usb_init(); - - if (usb_find_busses() < 0) { - error ("no USB busses found."); - do_exit (4); - } - - if (usb_find_devices() < 0) { - error ("no USB devices found."); - do_exit (4); - } - - if (sentry->find_func) - dev = (*sentry->find_func) (vid, pid); - else - dev = generic_find (vid, pid); - if (dev == NULL) { - error ("no device found."); - do_exit (5); - } - - handle = usb_open (dev); - if (handle == NULL) { - error ("%s: could not access the device.", - dev->filename); - do_exit (6); - } - - /* detach running default driver */ - signal (SIGTERM, release_usb_device); - ret = usb_get_driver_np (handle, 0, buffer, sizeof (buffer)); - if (ret == 0) { - debug ("%s: found already attached driver '%s'", dev->filename, buffer); - - ret = usb_detach_kernel_driver_np (handle, 0); - if (ret != 0) { - debug ("%s: error: unable to detach current driver.", dev->filename); - usb_close (handle); - do_exit (7); - } - } - - ret = usb_claim_interface (handle, 0); - if (ret != 0) { - debug ("%s: couldn't claim device's USB interface: %d.", - dev->filename, ret); - usb_close (handle); - do_exit (8); - } - - ret = (*sentry->switch_func) (handle, dev); - if (ret < 0) { - debug ("%s: failed to switch device to serial mode.", dev->filename); - usb_release_interface (handle, 0); - usb_close (handle); - do_exit(9); - } - - usb_release_interface (handle, 0); - - ret = usb_close (handle); - if (ret < 0) - debug ("%s: failed to close the device.", dev->filename); - - do_exit (0); - return 0; -} diff --git a/extras/mobile-action-modeswitch/utils.c b/extras/mobile-action-modeswitch/utils.c deleted file mode 100644 index 37d0df4d65..0000000000 --- a/extras/mobile-action-modeswitch/utils.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2009 Dan Williams - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#include -#include -#include -#include -#include -#include - -#include "utils.h" - -static int debug_on = 0; -static int quiet = 0; -FILE *logfile = NULL; - -void -do_log (int level, const char *fmt, ...) -{ - va_list args; - char buffer[1024]; - char tag = 'L'; - - if (level >= LOG_DBG && !debug_on) - return; - - va_start (args, fmt); - vsnprintf (buffer, sizeof (buffer), fmt, args); - va_end (args); - - if (level == LOG_ERR) - tag = 'E'; - else if (level == LOG_MSG) - tag = 'L'; - else if (level == LOG_DBG) - tag = 'D'; - - if (logfile) - fprintf (logfile, "%c: %s\n", tag, buffer); - if (!quiet) - fprintf ((level == LOG_ERR) ? stderr : stdout, "%c: %s\n", tag, buffer); -} - -int -log_startup (const char *path, int do_debug, int be_quiet) -{ - time_t t; - - quiet = be_quiet; - debug_on = do_debug; - - if (!path) - return 0; - - logfile = fopen (path, "a+"); - if (!logfile) - return 1; - - t = time (NULL); - message ("\n**** Started: %s\n", ctime (&t)); - return 0; -} - -void -log_shutdown (void) -{ - if (logfile) - fclose (logfile); -} - diff --git a/extras/mobile-action-modeswitch/utils.h b/extras/mobile-action-modeswitch/utils.h deleted file mode 100644 index 1ef557a892..0000000000 --- a/extras/mobile-action-modeswitch/utils.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Modem mode switcher - * - * Copyright (C) 2009 Dan Williams - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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: - */ - -#ifndef __UTILS_H__ -#define __UTILS_H__ - -#define LOG_ERR 0 -#define LOG_MSG 1 -#define LOG_DBG 2 - -#define message(fmt, args...) do_log (LOG_MSG, fmt, ##args); -#define error(fmt, args...) do_log (LOG_ERR, fmt, ##args); -#define debug(fmt, args...) do_log (LOG_DBG, fmt, ##args); - -void do_log (int level, const char *fmt, ...); -int log_startup (const char *path, int do_debug, int be_quiet); -void log_shutdown (void); - -#endif /* __UTILS_H__ */ -- cgit v1.2.3-54-g00ecf From 325293609392d0feba7a31ca9ed0940c8509c2ea Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Jun 2011 22:50:55 +0200 Subject: libudev: enumerate - scan /sys/module --- Makefile.am | 2 +- libudev/libudev-enumerate.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3ea96df90f..0ca351c82d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,7 +42,7 @@ dist_libexec_SCRIPTS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=11 -LIBUDEV_REVISION=5 +LIBUDEV_REVISION=6 LIBUDEV_AGE=11 SUBDIRS += libudev/docs diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 6e51726f08..0b028bab84 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -814,15 +814,25 @@ UDEV_EXPORT int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enume if (udev_enumerate == NULL) return -EINVAL; + /* all kernel modules */ + if (match_subsystem(udev_enumerate, "module")) { + dbg(udev, "searching '%s/modules/*' dir\n", subsysdir); + scan_dir_and_add_devices(udev_enumerate, "module", NULL, NULL); + } + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); if (stat(base, &statbuf) == 0) subsysdir = "subsystem"; else subsysdir = "bus"; + + /* all subsystems (only buses support coldplug) */ if (match_subsystem(udev_enumerate, "subsystem")) { dbg(udev, "searching '%s/*' dir\n", subsysdir); scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); } + + /* all subsystem drivers */ if (match_subsystem(udev_enumerate, "drivers")) { dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); -- cgit v1.2.3-54-g00ecf From ffb187faf9892d0075878b37748373250f29e74b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 18 Jun 2011 23:05:20 +0200 Subject: rules: move polling rule above 'block' match --- rules/rules.d/60-persistent-storage.rules | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 537e1e04b2..5c12cb72d4 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -7,6 +7,10 @@ ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" ACTION=="remove", GOTO="persistent_storage_end" + +# enable in-kernel media-presence polling +ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}="2000" + SUBSYSTEM!="block", GOTO="persistent_storage_end" # skip rules for inappropriate block devices @@ -69,9 +73,6 @@ KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DAT # probe filesystem metadata of disks KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" -# enable in-kernel media-presence polling -SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}="2000" - # watch metadata changes by tools closing the device after writing KERNEL!="sr*", OPTIONS+="watch" -- cgit v1.2.3-54-g00ecf From b25651b61eac63406d5fc0544b474efe26f8b7ab Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 21 Jun 2011 19:03:00 +0200 Subject: keymap: Add force-release quirk for Hannspree SN10. Thanks to Paolo Gherpelli ! --- extras/keymap/95-keyboard-force-release.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 8d5f83a983..b0771b1d0a 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -44,4 +44,6 @@ ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote 6615WD", RUN+="keyb ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="6625WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="HANNspree", ATTR{[dmi/id]product_name}=="SN10E100", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From 50579295272b744208519037c6931d1e6569e6f0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Jun 2011 00:15:39 +0200 Subject: libudev: monitor - update doc --- libudev/libudev-monitor.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 85ab23bdd4..31dd66827c 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -37,7 +37,7 @@ /** * udev_monitor: * - * Opaque object handling one event source. + * Opaque object handling an event source. */ struct udev_monitor { struct udev *udev; @@ -102,7 +102,12 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) * @udev: udev library context * @socket_path: unix socket path * - * Create new udev monitor and connect to a specified socket. The + * This function should not be used in any new application. The + * kernel's netlink socket multiplexes messages to all interested + * clients. Creating custom sockets from udev to applications + * should be avoided. + * + * Create a new udev monitor and connect to a specified socket. The * path to a socket either points to an existing socket file, or if * the socket path starts with a '@' character, an abstract namespace * socket will be used. @@ -211,14 +216,11 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c * Applications should usually not connect directly to the * "kernel" events, because the devices might not be useable * at that time, before udev has configured them, and created - * device nodes. - * - * Accessing devices at the same time as udev, might result - * in unpredictable behavior. - * - * The "udev" events are sent out after udev has finished its - * event processing, all rules have been processed, and needed - * device nodes are created. + * device nodes. Accessing devices at the same time as udev, + * might result in unpredictable behavior. The "udev" events + * are sent out after udev has finished its event processing, + * all rules have been processed, and needed device nodes are + * created. * * The initial refcount is 1, and needs to be decremented to * release the resources of the udev monitor. @@ -257,7 +259,8 @@ static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, * udev_monitor_filter_update: * @udev_monitor: monitor * - * Update the installed filter. This might only be needed, if the filter was removed or changed. + * Update the installed socket filter. This is only needed, + * if the filter was removed or changed. * * Returns: 0 on success, otherwise a negative error value. */ @@ -561,9 +564,7 @@ tag: * Receive data from the udev monitor socket, allocate a new udev * device, fill in the received data, and return the device. * - * Only socket connections with uid=0 are accepted. The caller - * needs to make sure that there is data to read from the socket. - * The call will block until the socket becomes readable. + * Only socket connections with uid=0 are accepted. * * The initial refcount is 1, and needs to be decremented to * release the resources of the udev device. @@ -816,7 +817,7 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, * @subsystem: the subsystem value to match the incoming devices against * @devtype: the devtype value to match the incoming devices against * - * This filer is efficiently executed inside the kernel, and libudev subscribers + * This filter is efficiently executed inside the kernel, and libudev subscribers * will usually not be woken up for devices which do not match. * * The filter must be installed before the monitor is switched to listening mode. @@ -840,7 +841,7 @@ UDEV_EXPORT int udev_monitor_filter_add_match_subsystem_devtype(struct udev_moni * @udev_monitor: the monitor * @tag: the name of a tag * - * This filer is efficiently executed inside the kernel, and libudev subscribers + * This filter is efficiently executed inside the kernel, and libudev subscribers * will usually not be woken up for devices which do not match. * * The filter must be installed before the monitor is switched to listening mode. -- cgit v1.2.3-54-g00ecf From 15328d84d29a5080a49096aee4689ef50c8c2b9e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Jun 2011 00:16:22 +0200 Subject: rules: set polling value only if it is disabled --- rules/rules.d/60-persistent-storage.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 5c12cb72d4..5c2689b885 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -9,7 +9,7 @@ ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ACTION=="remove", GOTO="persistent_storage_end" # enable in-kernel media-presence polling -ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}="2000" +ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000" SUBSYSTEM!="block", GOTO="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From 2bbafbfd4f18ab68702ee514f806ff5b917821c5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 28 Jun 2011 20:57:05 +0200 Subject: libudev: device - fix udev_device_get_tags_list_entry() to always load database --- TODO | 2 +- libudev/libudev-device.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 4e1d723136..3ae387440f 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ - - detect uevent loops !!! + - remove RUN+="socket:" - use 'udevd:' in logs diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 8289acf3a9..1ac0760f9e 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1641,6 +1641,8 @@ UDEV_EXPORT struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_ { if (udev_device == NULL) return NULL; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); return udev_list_get_entry(&udev_device->tags_list); } -- cgit v1.2.3-54-g00ecf From daa42554ea1f3bc861805a753d2dd07c1c5db743 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 30 Jun 2011 09:04:01 +0100 Subject: keymap: Add slight name variations of Toshiba Satellites https://bugzilla.redhat.com/show_bug.cgi?id=444440 --- extras/keymap/95-keyboard-force-release.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index b0771b1d0a..448db56d1c 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -31,7 +31,7 @@ ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-forc ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite U300|Satellite Pro U300|Satellite U305|SATELLITE U500", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite [uU]300*|Satellite Pro [uU]300*|Satellite [uU]305*|SATELLITE [uU]500*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -- cgit v1.2.3-54-g00ecf From e261c5f619e059e96e1ef9977fa1665cd8223541 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 30 Jun 2011 15:17:09 +0200 Subject: udevadm-*.c: return != 0, if unknown option given --- udev/udevadm-info.c | 1 + udev/udevadm-monitor.c | 3 +++ udev/udevadm-trigger.c | 1 + 3 files changed, 5 insertions(+) diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 87c1c32314..a6387d07ae 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -454,6 +454,7 @@ int udevadm_info(struct udev *udev, int argc, char *argv[]) " --help\n\n"); goto exit; default: + rc = 1; goto exit; } } diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index f3a72cf17e..fd1b8ced85 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -138,6 +138,9 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) " --help\n\n"); goto out; } + default: + rc = 1; + goto out; } if (!print_kernel && !print_udev) { diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index c32e0b4e2f..d31b4fbd8d 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -199,6 +199,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) " --help\n\n"); goto exit; default: + rc = 1; goto exit; } } -- cgit v1.2.3-54-g00ecf From d971228752cb6f2993f6609c9a07d49037d36806 Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Thu, 30 Jun 2011 15:19:38 +0200 Subject: udev/udevadm-monitor.c: fixed misplaced brace --- udev/udevadm-monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index fd1b8ced85..0852fe301b 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -137,10 +137,10 @@ int udevadm_monitor(struct udev *udev, int argc, char *argv[]) " --tag-match= filter events by tag\n" " --help\n\n"); goto out; - } default: rc = 1; goto out; + } } if (!print_kernel && !print_udev) { -- cgit v1.2.3-54-g00ecf From f2a2983604fa6876fc297c9156b7ad0f04a482e8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 5 Jul 2011 03:09:43 +0200 Subject: rules: remove redundant MODE="0664" from lp rules --- extras/udev-acl/70-acl.rules | 1 - rules/rules.d/50-udev-default.rules | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules index 037349dabd..5dc5ed0bfc 100644 --- a/extras/udev-acl/70-acl.rules +++ b/extras/udev-acl/70-acl.rules @@ -7,7 +7,6 @@ ENV{MAJOR}=="", GOTO="acl_end" ACTION=="remove", GOTO="acl_apply" # PTP/MTP protocol devices, cameras, portable media players -SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="", ENV{DEVTYPE}=="usb_device", IMPORT{program}="usb_id --export %p" SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="udev-acl" # digicams with proprietary protocol diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index cacb533db8..865d95f41e 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -52,6 +52,7 @@ SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" # libusb device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" # printer KERNEL=="parport[0-9]*", GROUP="lp" @@ -60,10 +61,7 @@ SUBSYSTEM=="ppdev", GROUP="lp" SUBSYSTEM=="usb", KERNEL=="lp*", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" -# hplip and cups 1.4+ use raw USB devices, so permissions should be similar to -# the ones from the old usblp kernel module -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701*:", GROUP="lp", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701*:", GROUP="lp" # block SUBSYSTEM=="block", GROUP="disk" -- cgit v1.2.3-54-g00ecf From 665a754d03aa21a6ff58066abe125569a4bc32c2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 5 Jul 2011 05:37:13 +0200 Subject: rules: fix wrong wildcard match, we always need a ':*' at the end --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 865d95f41e..32f9eba016 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -61,7 +61,7 @@ SUBSYSTEM=="ppdev", GROUP="lp" SUBSYSTEM=="usb", KERNEL=="lp*", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701*:", GROUP="lp" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="lp" # block SUBSYSTEM=="block", GROUP="disk" -- cgit v1.2.3-54-g00ecf From 5433b7320ee15e360fa2a60a3cdba9f17d51ec48 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Jul 2011 17:01:11 +0200 Subject: libudev: device - export udev_device_has_tag() --- Makefile.am | 6 +++--- libudev/libudev-device.c | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0ca351c82d..37840c34b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,9 +41,9 @@ dist_libexec_SCRIPTS = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=11 -LIBUDEV_REVISION=6 -LIBUDEV_AGE=11 +LIBUDEV_CURRENT=12 +LIBUDEV_REVISION=0 +LIBUDEV_AGE=12 SUBDIRS += libudev/docs diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 1ac0760f9e..1d4cb704c2 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1646,17 +1646,18 @@ UDEV_EXPORT struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_ return udev_list_get_entry(&udev_device->tags_list); } -int udev_device_has_tag(struct udev_device *udev_device, const char *tag) +UDEV_EXPORT int udev_device_has_tag(struct udev_device *udev_device, const char *tag) { struct udev_list_entry *list_entry; + if (udev_device == NULL) + return NULL; if (!udev_device->info_loaded) udev_device_read_db(udev_device, NULL); list_entry = udev_device_get_tags_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, tag); - if (list_entry != NULL) - return 1; - return 0; + if (udev_list_entry_get_by_name(list_entry, tag) != NULL) + return true; + return false; } #define ENVP_SIZE 128 -- cgit v1.2.3-54-g00ecf From 8992abf5528fe332ca041f6c7d03df820406feb4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 6 Jul 2011 20:36:47 +0200 Subject: path_id: add missing '-' to tape suffix --- extras/path_id/path_id.c | 53 ++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 683f78d26e..9e77b8a7cc 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -50,29 +50,29 @@ static void log_fn(struct udev *udev, int priority, static int path_prepend(char **path, const char *fmt, ...) { va_list va; - char *old; char *pre; - int err; - - old = *path; + int err = 0; va_start(va, fmt); err = vasprintf(&pre, fmt, va); va_end(va); if (err < 0) - return err; + goto out; - if (old != NULL) { - err = asprintf(path, "%s-%s", pre, old); - if (err < 0) - return err; + if (*path != NULL) { + char *new; + + err = asprintf(&new, "%s-%s", pre, *path); free(pre); + if (err < 0) + goto out; + free(*path); + *path = new; } else { *path = pre; } - - free(old); - return 0; +out: + return err; } /* @@ -337,15 +337,19 @@ out: return parent; } -static void handle_scsi_tape(struct udev_device *dev, char **suffix) +static void handle_scsi_tape(struct udev_device *dev, char **path) { const char *name; + /* must be the last device in the syspath */ + if (*path != NULL) + return; + name = udev_device_get_sysname(dev); if (strncmp(name, "nst", 3) == 0 && strchr("lma", name[3]) != NULL) - asprintf(suffix, "nst%c", name[3]); + path_prepend(path, "nst%c", name[3]); else if (strncmp(name, "st", 2) == 0 && strchr("lma", name[2]) != NULL) - asprintf(suffix, "st%c", name[2]); + path_prepend(path, "st%c", name[2]); } static struct udev_device *handle_usb(struct udev_device *parent, char **path) @@ -413,9 +417,8 @@ int main(int argc, char **argv) struct udev_device *parent; char syspath[UTIL_PATH_SIZE]; const char *devpath; - char *path; - char *path_suffix; - int rc = 1; + char *path = NULL; + int rc = EXIT_FAILURE; udev = udev_new(); if (udev == NULL) @@ -460,9 +463,6 @@ int main(int argc, char **argv) goto exit; } - path = NULL; - path_suffix = NULL; - /* S390 ccw bus */ parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); if (parent != NULL) { @@ -480,7 +480,7 @@ int main(int argc, char **argv) if (subsys == NULL) { ; } else if (strcmp(subsys, "scsi_tape") == 0) { - handle_scsi_tape(parent, &path_suffix); + handle_scsi_tape(parent, &path); } else if (strcmp(subsys, "scsi") == 0) { parent = handle_scsi(parent, &path); } else if (strcmp(subsys, "cciss") == 0) { @@ -508,14 +508,9 @@ int main(int argc, char **argv) } out: if (path != NULL) { - if (path_suffix != NULL) { - printf("ID_PATH=%s%s\n", path, path_suffix); - free(path_suffix); - } else { - printf("ID_PATH=%s\n", path); - } + printf("ID_PATH=%s\n", path); free(path); - rc = 0; + rc = EXIT_SUCCESS; } udev_device_unref(dev); -- cgit v1.2.3-54-g00ecf From 91f329fcd0baafd21ceb178cfbae0235f5abbcb0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2011 19:59:03 +0200 Subject: path_id: add ID_PATH_TAG= to be used in udev tags --- extras/path_id/path_id.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 9e77b8a7cc..98f0e40089 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -508,7 +508,37 @@ int main(int argc, char **argv) } out: if (path != NULL) { + char tag[UTIL_NAME_SIZE]; + size_t i; + const char *p; + + /* compose valid udev tag name */ + for (p = path, i = 0; *p; p++) { + if ((*p >= '0' && *p <= '9') || + (*p >= 'A' && *p <= 'Z') || + (*p >= 'a' && *p <= 'z') || + *p == '-') { + tag[i++] = *p; + continue; + } + + /* skip all leading '_' */ + if (i == 0) + continue; + + /* avoid second '_' */ + if (tag[i-1] == '_') + continue; + + tag[i++] = '_'; + } + /* strip trailing '_' */ + while (i > 0 && tag[i-1] == '_') + i--; + tag[i] = '\0'; + printf("ID_PATH=%s\n", path); + printf("ID_PATH_TAG=%s\n", tag); free(path); rc = EXIT_SUCCESS; } -- cgit v1.2.3-54-g00ecf From 705a165d4d7cea43cec11eaaaaf51b16806edf68 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2011 20:02:41 +0200 Subject: enforce valid TAG+= names --- udev/udev-rules.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 56a258d8ad..d16c1f9454 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2528,10 +2528,20 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event } case TK_A_TAG: { char tag[UTIL_PATH_SIZE]; + const char *p; udev_event_apply_format(event, &rules->buf[cur->key.value_off], tag, sizeof(tag)); if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) udev_device_cleanup_tags_list(event->dev); + for (p = tag; *p != '\0'; p++) { + if ((*p >= 'a' && *p <= 'z') || + (*p >= 'A' && *p <= 'Z') || + (*p >= '0' && *p <= '9') || + *p == '-' || *p == '_') + continue; + err(event->udev, "ignoring invalid tag name '%s'\n", tag); + break; + } udev_device_add_tag(event->dev, tag); break; } -- cgit v1.2.3-54-g00ecf From d21781c4576e161ada21447e4d85d82b86b381b4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2011 20:06:45 +0200 Subject: update TODO --- TODO | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 3ae387440f..70892a3ac1 100644 --- a/TODO +++ b/TODO @@ -1,14 +1,14 @@ - - remove RUN+="socket:" - - - use 'udevd:' in logs - - udev_enumerate_add_match_subsystem(enum, "input"); udev_enumerate_add_match_sysname(enum, "event*"); udev_enumerate_add_match_children(input_dev); udev_enumerate_scan_devices(enum); + - test (now fixed) /dev/tape/ links + - monitor: use clock MONOTONIC + - remove RUN+="socket:" + - libudev: return proper errno or set errno - move ctrl.c from libudev/ to udev/ -- cgit v1.2.3-54-g00ecf From b59c22a7587201d24087567e2eb93ab78c74187a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 7 Jul 2011 21:31:50 +0200 Subject: libudev: device - add udev_device_has_tag() to libudev.h and gtk-doc --- libudev/docs/libudev-sections.txt | 1 + libudev/libudev-device.c | 2 +- libudev/libudev-private.h | 1 - libudev/libudev.h | 1 + 4 files changed, 3 insertions(+), 2 deletions(-) diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 2560a08e1f..6ccd025438 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -58,6 +58,7 @@ udev_device_get_sysattr_value udev_device_get_sysattr_list_entry udev_device_get_seqnum udev_device_get_usec_since_initialized +udev_device_has_tag
            diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 1d4cb704c2..025527bb8a 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1651,7 +1651,7 @@ UDEV_EXPORT int udev_device_has_tag(struct udev_device *udev_device, const char struct udev_list_entry *list_entry; if (udev_device == NULL) - return NULL; + return false; if (!udev_device->info_loaded) udev_device_read_db(udev_device, NULL); list_entry = udev_device_get_tags_list_entry(udev_device); diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 315ca3d700..9ef1408ac1 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -90,7 +90,6 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device); void udev_device_set_is_initialized(struct udev_device *udev_device); int udev_device_add_tag(struct udev_device *udev_device, const char *tag); void udev_device_cleanup_tags_list(struct udev_device *udev_device); -int udev_device_has_tag(struct udev_device *udev_device, const char *tag); int udev_device_get_timeout(struct udev_device *udev_device); unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device); void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized); diff --git a/libudev/libudev.h b/libudev/libudev.h index 021ef9e8c0..1d4a4ae520 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -101,6 +101,7 @@ const char *udev_device_get_action(struct udev_device *udev_device); unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device); const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); +int udev_device_has_tag(struct udev_device *udev_device, const char *tag); /* * udev_monitor -- cgit v1.2.3-54-g00ecf From b05211fa3e19608f96db53f388959ab57f88c566 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Jul 2011 00:42:35 +0200 Subject: libudev: enumerate - add udev_enumerate_add_match_parent() --- libudev/docs/libudev-sections.txt | 1 + libudev/libudev-enumerate.c | 212 ++++++++++++++++++++++++++++---------- libudev/libudev.h | 1 + udev/udevadm-trigger.c | 25 ++++- udev/udevadm.xml | 6 ++ 5 files changed, 190 insertions(+), 55 deletions(-) diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 6ccd025438..4cd383b4f8 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -94,6 +94,7 @@ udev_enumerate_add_match_sysattr udev_enumerate_add_nomatch_sysattr udev_enumerate_add_match_property udev_enumerate_add_match_tag +udev_enumerate_add_match_parent udev_enumerate_add_match_is_initialized udev_enumerate_add_match_sysname udev_enumerate_add_syspath diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 0b028bab84..320ab66647 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -52,6 +52,7 @@ struct udev_enumerate { struct udev_list_node sysname_match_list; struct udev_list_node properties_match_list; struct udev_list_node tags_match_list; + struct udev_device *parent_match; struct udev_list_node devices_list; struct syspath *devices; unsigned int devices_cur; @@ -125,6 +126,7 @@ UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysname_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->properties_match_list); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->tags_match_list); + udev_device_unref(udev_enumerate->parent_match); udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); for (i = 0; i < udev_enumerate->devices_cur; i++) free(udev_enumerate->devices[i].syspath); @@ -459,6 +461,30 @@ UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumera return 0; } +/** + * udev_enumerate_add_match_parent: + * @udev_enumerate: context + * @parent: filter for the parent device + * + * Return only the children of a given device. + * + * A reference for the device is held until the udev_enumerate context + * is cleaned up. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (parent == NULL) + return 0; + if (udev_enumerate->parent_match != NULL) + udev_device_unref(udev_enumerate->parent_match); + udev_enumerate->parent_match = udev_device_ref(parent); + return 0; +} + /** * udev_enumerate_add_match_is_initialized: * @udev_enumerate: context @@ -581,6 +607,17 @@ static bool match_tag(struct udev_enumerate *udev_enumerate, struct udev_device return true; } +static bool match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *dev) +{ + const char *parent; + + if (udev_enumerate->parent_match == NULL) + return true; + + parent = udev_device_get_devpath(udev_enumerate->parent_match); + return strncmp(parent, udev_device_get_devpath(dev), strlen(parent)) == 0; +} + static bool match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) { struct udev_list_entry *list_entry; @@ -645,6 +682,8 @@ static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, (major(udev_device_get_devnum(dev)) > 0 || udev_device_get_ifindex(dev) > 0)) goto nomatch; } + if (!match_parent(udev_enumerate, dev)) + goto nomatch; if (!match_tag(udev_enumerate, dev)) goto nomatch; if (!match_property(udev_enumerate, dev)) @@ -727,77 +766,142 @@ UDEV_EXPORT int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate return 0; } -/** - * udev_enumerate_scan_devices: - * @udev_enumerate: udev enumeration context - * - * Returns: 0 on success, otherwise a negative error value. - **/ -UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) +static int scan_devices_tags(struct udev_enumerate *udev_enumerate) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char base[UTIL_PATH_SIZE]; - struct stat statbuf; - - if (udev_enumerate == NULL) - return -EINVAL; + struct udev_list_entry *list_entry; - if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) { - struct udev_list_entry *list_entry; + /* scan only tagged devices, use tags reverse-index, instead of searching all devices in /sys */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) { + DIR *dir; + struct dirent *dent; + char path[UTIL_PATH_SIZE]; - /* scan only tagged devices, use tags reverse-index, instead of searching all devices in /sys */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) { - DIR *dir; - struct dirent *dent; - char path[UTIL_PATH_SIZE]; + util_strscpyl(path, sizeof(path), udev_get_run_path(udev), "/tags/", + udev_list_entry_get_name(list_entry), NULL); + dir = opendir(path); + if (dir == NULL) + continue; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct udev_device *dev; - util_strscpyl(path, sizeof(path), udev_get_run_path(udev), "/tags/", - udev_list_entry_get_name(list_entry), NULL); - dir = opendir(path); - if (dir == NULL) + if (dent->d_name[0] == '.') continue; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct udev_device *dev; - - if (dent->d_name[0] == '.') - continue; - dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); - if (dev == NULL) - continue; + dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); + if (dev == NULL) + continue; - if (!match_subsystem(udev_enumerate, udev_device_get_subsystem(dev))) - goto nomatch; - if (!match_sysname(udev_enumerate, udev_device_get_sysname(dev))) - goto nomatch; - if (!match_property(udev_enumerate, dev)) - goto nomatch; - if (!match_sysattr(udev_enumerate, dev)) - goto nomatch; + if (!match_subsystem(udev_enumerate, udev_device_get_subsystem(dev))) + goto nomatch; + if (!match_sysname(udev_enumerate, udev_device_get_sysname(dev))) + goto nomatch; + if (!match_parent(udev_enumerate, dev)) + goto nomatch; + if (!match_property(udev_enumerate, dev)) + goto nomatch; + if (!match_sysattr(udev_enumerate, dev)) + goto nomatch; - syspath_add(udev_enumerate, udev_device_get_syspath(dev)); + syspath_add(udev_enumerate, udev_device_get_syspath(dev)); nomatch: - udev_device_unref(dev); - } - closedir(dir); + udev_device_unref(dev); } + closedir(dir); + } + return 0; +} + +static int parent_add_child(struct udev_enumerate *enumerate, const char *path) +{ + struct udev_device *dev; + + dev = udev_device_new_from_syspath(enumerate->udev, path); + if (dev == NULL) + return -ENODEV; + + if (!match_subsystem(enumerate, udev_device_get_subsystem(dev))) + return 0; + if (!match_sysname(enumerate, udev_device_get_sysname(dev))) + return 0; + if (!match_property(enumerate, dev)) + return 0; + if (!match_sysattr(enumerate, dev)) + return 0; + + syspath_add(enumerate, udev_device_get_syspath(dev)); + udev_device_unref(dev); + return 1; +} + +static int parent_crawl_children(struct udev_enumerate *enumerate, const char *path, int maxdepth) +{ + DIR *d; + struct dirent *dent; + + d = opendir(path); + if (d == NULL) + return -errno; + + for (dent = readdir(d); dent != NULL; dent = readdir(d)) { + char *child; + + if (dent->d_name[0] == '.') + continue; + if (dent->d_type != DT_DIR) + continue; + if (asprintf(&child, "%s/%s", path, dent->d_name) < 0) + continue; + parent_add_child(enumerate, child); + if (maxdepth > 0) + parent_crawl_children(enumerate, child, maxdepth-1); + free(child); + } + + closedir(d); + return 0; +} + +static int scan_devices_all(struct udev_enumerate *udev_enumerate) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char base[UTIL_PATH_SIZE]; + struct stat statbuf; + + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); + if (stat(base, &statbuf) == 0) { + /* we have /subsystem/, forget all the old stuff */ + dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); + scan_dir(udev_enumerate, "subsystem", "devices", NULL); } else { - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); - if (stat(base, &statbuf) == 0) { - /* we have /subsystem/, forget all the old stuff */ - dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "subsystem", "devices", NULL); - } else { dbg(udev, "searching '/bus/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "bus", "devices", NULL); - dbg(udev, "searching '/class/*' dir\n"); - scan_dir(udev_enumerate, "class", NULL, NULL); - } + scan_dir(udev_enumerate, "bus", "devices", NULL); + dbg(udev, "searching '/class/*' dir\n"); + scan_dir(udev_enumerate, "class", NULL, NULL); } - return 0; } +/** + * udev_enumerate_scan_devices: + * @udev_enumerate: udev enumeration context + * + * Returns: 0 on success, otherwise a negative error value. + **/ +UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return -EINVAL; + + if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) + return scan_devices_tags(udev_enumerate); + + if (udev_enumerate->parent_match != NULL) + return parent_crawl_children(udev_enumerate, udev_device_get_syspath(udev_enumerate->parent_match), 256); + + return scan_devices_all(udev_enumerate); +} + /** * udev_enumerate_scan_subsystems: * @udev_enumerate: udev enumeration context diff --git a/libudev/libudev.h b/libudev/libudev.h index 1d4a4ae520..d8eb7dff77 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -146,6 +146,7 @@ int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, co int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname); int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag); +int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent); int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate); int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); /* run enumeration with active filters */ diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index d31b4fbd8d..3b53be5646 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -103,6 +103,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) { "property-match", required_argument, NULL, 'p' }, { "tag-match", required_argument, NULL, 'g' }, { "sysname-match", required_argument, NULL, 'y' }, + { "parent-match", required_argument, NULL, 'b' }, { "help", no_argument, NULL, 'h' }, {} }; @@ -128,7 +129,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) const char *val; char buf[UTIL_PATH_SIZE]; - option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:", options, NULL); + option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:b:", options, NULL); if (option == -1) break; @@ -179,6 +180,27 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) case 'y': udev_enumerate_add_match_sysname(udev_enumerate, optarg); break; + case 'b': { + char path[UTIL_PATH_SIZE]; + struct udev_device *dev; + + /* add sys dir if needed */ + if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); + else + util_strscpy(path, sizeof(path), optarg); + util_remove_trailing_chars(path, '/'); + dev = udev_device_new_from_syspath(udev, path); + if (dev == NULL) { + err(udev, "unable to open the device '%s'\n", optarg); + rc = 2; + goto exit; + } + udev_enumerate_add_match_parent(udev_enumerate, dev); + /* drop reference immediately, enumerate pins the device as long as needed */ + udev_device_unref(dev); + break; + } case 'h': printf("Usage: udevadm trigger OPTIONS\n" " --verbose print the list of devices while running\n" @@ -196,6 +218,7 @@ int udevadm_trigger(struct udev *udev, int argc, char *argv[]) " --property-match== trigger devices with a matching property\n" " --tag-match== trigger devices with a matching property\n" " --sysname-match= trigger devices with a matching name\n" + " --parent-match= trigger devices with that parent device\n" " --help\n\n"); goto exit; default: diff --git a/udev/udevadm.xml b/udev/udevadm.xml index b5fb971f3b..a106093569 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -252,6 +252,12 @@ specified multiple times and supports shell style pattern matching. + + + + Trigger events for all children of a given device. + + -- cgit v1.2.3-54-g00ecf From 6ed03d1e2c1e2e300dda7a7cf4a5ffe10ef18356 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Jul 2011 00:57:58 +0200 Subject: libudev: enumerate - include parent device itself with match_parent() --- libudev/libudev-enumerate.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 320ab66647..399bbdaf46 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -862,6 +862,15 @@ static int parent_crawl_children(struct udev_enumerate *enumerate, const char *p return 0; } +static int scan_devices_children(struct udev_enumerate *enumerate) +{ + const char *path; + + path = udev_device_get_syspath(enumerate->parent_match); + parent_add_child(enumerate, path); + return parent_crawl_children(enumerate, path, 256); +} + static int scan_devices_all(struct udev_enumerate *udev_enumerate) { struct udev *udev = udev_enumerate_get_udev(udev_enumerate); @@ -893,12 +902,15 @@ UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerat if (udev_enumerate == NULL) return -EINVAL; + /* efficiently lookup tags only, we maintain a reverse-index */ if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) return scan_devices_tags(udev_enumerate); + /* walk the subtree of one parent device only */ if (udev_enumerate->parent_match != NULL) - return parent_crawl_children(udev_enumerate, udev_device_get_syspath(udev_enumerate->parent_match), 256); + return scan_devices_children(udev_enumerate); + /* scan devices of all subsystems */ return scan_devices_all(udev_enumerate); } -- cgit v1.2.3-54-g00ecf From a07e011434b2b218b2c77c0fa4fcfb001dec4b7f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 8 Jul 2011 02:09:40 +0200 Subject: libudev: enumerate - clarify documentation --- TODO | 5 +---- libudev/libudev-enumerate.c | 5 +++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 70892a3ac1..13a27799fa 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,4 @@ - - udev_enumerate_add_match_subsystem(enum, "input"); - udev_enumerate_add_match_sysname(enum, "event*"); - udev_enumerate_add_match_children(input_dev); - udev_enumerate_scan_devices(enum); + - udev_enumerate_remove_matches() - test (now fixed) /dev/tape/ links diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index 399bbdaf46..b332ecdae1 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -464,9 +464,10 @@ UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumera /** * udev_enumerate_add_match_parent: * @udev_enumerate: context - * @parent: filter for the parent device + * @parent: parent device where to start searching * - * Return only the children of a given device. + * Return the devices on the subtree of one given device. The parent + * itself is included in the list. * * A reference for the device is held until the udev_enumerate context * is cleaned up. -- cgit v1.2.3-54-g00ecf From 0438d54ed901154d9ee9ef875ef82e442a7c4947 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 10 Jul 2011 05:32:15 +0200 Subject: path_id: recognize ACPI parent devices We need to tag the power input button for multi-seat. --- extras/path_id/path_id.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 98f0e40089..928aa6737f 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -496,6 +496,9 @@ int main(int argc, char **argv) } else if (strcmp(subsys, "platform") == 0) { path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "platform"); + } else if (strcmp(subsys, "acpi") == 0) { + path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "acpi"); } else if (strcmp(subsys, "xen") == 0) { path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "xen"); -- cgit v1.2.3-54-g00ecf From ce60b80f87a0365565722d2a523b7defc3abdec3 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 10 Jul 2011 16:43:34 +0200 Subject: rules: input - call path_id for ACPI devices --- rules/rules.d/60-persistent-input.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index cd1de4e671..7230e4b312 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -28,7 +28,7 @@ SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", A SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" # by-path -SUBSYSTEMS=="pci|usb|platform", IMPORT{program}="path_id %p" +SUBSYSTEMS=="pci|usb|platform|acpi", IMPORT{program}="path_id %p" ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{.INPUT_CLASS}" ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{.INPUT_CLASS}" # allow empty class for platform and usb devices; platform supports only a single interface that way -- cgit v1.2.3-54-g00ecf From 2315e570706285216a130eb1a67402284344b85f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Jul 2011 01:03:14 +0200 Subject: udevadm: monitor - use uptime to match the kernel's timestamp --- TODO | 2 -- udev/udevadm-monitor.c | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 13a27799fa..01fb0e1fc7 100644 --- a/TODO +++ b/TODO @@ -2,8 +2,6 @@ - test (now fixed) /dev/tape/ links - - monitor: use clock MONOTONIC - - remove RUN+="socket:" - libudev: return proper errno or set errno diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 0852fe301b..9b8bf4eccf 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -43,13 +44,12 @@ static void sig_handler(int signum) static void print_device(struct udev_device *device, const char *source, int prop) { - struct timeval tv; - struct timezone tz; + struct timespec ts; - gettimeofday(&tv, &tz); + clock_gettime(CLOCK_MONOTONIC, &ts); printf("%-6s[%llu.%06u] %-8s %s (%s)\n", source, - (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec, + (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, udev_device_get_action(device), udev_device_get_devpath(device), udev_device_get_subsystem(device)); -- cgit v1.2.3-54-g00ecf From c15d02e57093dc5ced3808c9020c25511f332eb2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Jul 2011 01:16:32 +0200 Subject: libudev: ctrl - move code to udev directory --- Makefile.am | 4 +- TODO | 12 +- libudev/libudev-ctrl.c | 491 ---------------------------------------------- libudev/libudev-private.h | 34 ---- udev/udev-ctrl.c | 490 +++++++++++++++++++++++++++++++++++++++++++++ udev/udev.h | 34 ++++ 6 files changed, 531 insertions(+), 534 deletions(-) delete mode 100644 libudev/libudev-ctrl.c create mode 100644 udev/udev-ctrl.c diff --git a/Makefile.am b/Makefile.am index 37840c34b9..0b670d5340 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,7 +68,6 @@ noinst_LTLIBRARIES = \ libudev_libudev_private_la_SOURCES =\ $(libudev_libudev_la_SOURCES) \ - libudev/libudev-ctrl.c \ libudev/libudev-util-private.c \ libudev/libudev-device-private.c \ libudev/libudev-queue-private.c @@ -160,7 +159,8 @@ udev_common_sources =\ udev/udev-event.c \ udev/udev-watch.c \ udev/udev-node.c \ - udev/udev-rules.c + udev/udev-rules.c \ + udev/udev-ctrl.c udev_udevd_SOURCES = \ $(udev_common_sources) \ diff --git a/TODO b/TODO index 01fb0e1fc7..7106d9c81e 100644 --- a/TODO +++ b/TODO @@ -2,19 +2,15 @@ - test (now fixed) /dev/tape/ links - - remove RUN+="socket:" - - libudev: return proper errno or set errno - - move ctrl.c from libudev/ to udev/ + - /run/udev/control socket + (add ConditionVirtualization=!pidns) - move: udevd -> --libexecdir udevadm -> --bindir - - /run/udev/control socket - (add ConditionVirtualization=!pidns) - - kill rules_generator: - no longer rename netifs in kernel namespace - drop persistent optical names @@ -23,8 +19,10 @@ - properly document what system management needs to put into rules files - - kill tabs? + - remove RUN+="socket:" - remove deprecated trigger --type=failed logic - remove deprecated BUS=, SYSFS{}=, ID= keys + + - kill tabs? diff --git a/libudev/libudev-ctrl.c b/libudev/libudev-ctrl.c deleted file mode 100644 index e0ec2fa3d7..0000000000 --- a/libudev/libudev-ctrl.c +++ /dev/null @@ -1,491 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/* wire protocol magic must match */ -#define UDEV_CTRL_MAGIC 0xdead1dea - -enum udev_ctrl_msg_type { - UDEV_CTRL_UNKNOWN, - UDEV_CTRL_SET_LOG_LEVEL, - UDEV_CTRL_STOP_EXEC_QUEUE, - UDEV_CTRL_START_EXEC_QUEUE, - UDEV_CTRL_RELOAD_RULES, - UDEV_CTRL_SET_ENV, - UDEV_CTRL_SET_CHILDREN_MAX, - UDEV_CTRL_PING, - UDEV_CTRL_EXIT, -}; - -struct udev_ctrl_msg_wire { - char version[16]; - unsigned int magic; - enum udev_ctrl_msg_type type; - union { - int intval; - char buf[256]; - }; -}; - -struct udev_ctrl_msg { - int refcount; - struct udev_ctrl_connection *conn; - struct udev_ctrl_msg_wire ctrl_msg_wire; -}; - -struct udev_ctrl { - int refcount; - struct udev *udev; - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; - bool bound; - bool connected; -}; - -struct udev_ctrl_connection { - int refcount; - struct udev_ctrl *uctrl; - int sock; -}; - -static struct udev_ctrl *udev_ctrl_new(struct udev *udev) -{ - struct udev_ctrl *uctrl; - - uctrl = calloc(1, sizeof(struct udev_ctrl)); - if (uctrl == NULL) - return NULL; - uctrl->refcount = 1; - uctrl->udev = udev; - return uctrl; -} - -struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *socket_path, int fd) -{ - struct udev_ctrl *uctrl; - - uctrl = udev_ctrl_new(udev); - if (uctrl == NULL) - return NULL; - - if (fd < 0) { - uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); - if (uctrl->sock < 0) { - err(udev, "error getting socket: %m\n"); - udev_ctrl_unref(uctrl); - return NULL; - } - } else { - uctrl->bound = true; - uctrl->sock = fd; - } - - uctrl->saddr.sun_family = AF_LOCAL; - strcpy(uctrl->saddr.sun_path, socket_path); - uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); - /* translate leading '@' to abstract namespace */ - if (uctrl->saddr.sun_path[0] == '@') - uctrl->saddr.sun_path[0] = '\0'; - return uctrl; -} - -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) -{ - return udev_ctrl_new_from_socket_fd(udev, socket_path, -1); -} - -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) -{ - int err; - - if (!uctrl->bound) { - err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err < 0) { - err = -errno; - err(uctrl->udev, "bind failed: %m\n"); - return err; - } - - err = listen(uctrl->sock, 0); - if (err < 0) { - err = -errno; - err(uctrl->udev, "listen failed: %m\n"); - return err; - } - - uctrl->bound = true; - } - return 0; -} - -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) -{ - return uctrl->udev; -} - -struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return NULL; - uctrl->refcount++; - return uctrl; -} - -struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return NULL; - uctrl->refcount--; - if (uctrl->refcount > 0) - return uctrl; - if (uctrl->sock >= 0) - close(uctrl->sock); - free(uctrl); - return NULL; -} - -int udev_ctrl_get_fd(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return -1; - return uctrl->sock; -} - -struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) -{ - struct udev_ctrl_connection *conn; - struct ucred ucred; - socklen_t slen; - const int on = 1; - - conn = calloc(1, sizeof(struct udev_ctrl_connection)); - if (conn == NULL) - return NULL; - conn->refcount = 1; - conn->uctrl = uctrl; - - conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); - if (conn->sock < 0) { - if (errno != EINTR) - err(uctrl->udev, "unable to receive ctrl connection: %m\n"); - goto err; - } - - /* check peer credential of connection */ - slen = sizeof(ucred); - if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) { - err(uctrl->udev, "unable to receive credentials of ctrl connection: %m\n"); - goto err; - } - if (ucred.uid > 0) { - err(uctrl->udev, "sender uid=%i, message ignored\n", ucred.uid); - goto err; - } - - /* enable receiving of the sender credentials in the messages */ - setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - udev_ctrl_ref(uctrl); - return conn; -err: - if (conn->sock >= 0) - close(conn->sock); - free(conn); - return NULL; -} - -struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) -{ - if (conn == NULL) - return NULL; - conn->refcount++; - return conn; -} - -struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) -{ - if (conn == NULL) - return NULL; - conn->refcount--; - if (conn->refcount > 0) - return conn; - if (conn->sock >= 0) - close(conn->sock); - udev_ctrl_unref(conn->uctrl); - free(conn); - return NULL; -} - -static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) -{ - struct udev_ctrl_msg_wire ctrl_msg_wire; - int err = 0; - - memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); - strcpy(ctrl_msg_wire.version, "udev-" VERSION); - ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; - ctrl_msg_wire.type = type; - - if (buf != NULL) - util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); - else - ctrl_msg_wire.intval = intval; - - if (!uctrl->connected) { - if (connect(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen) < 0) { - err = -errno; - goto out; - } - uctrl->connected = true; - } - if (send(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0) < 0) { - err = -errno; - goto out; - } - - /* wait for peer message handling or disconnect */ - for (;;) { - struct pollfd pfd[1]; - int r; - - pfd[0].fd = uctrl->sock; - pfd[0].events = POLLIN; - r = poll(pfd, 1, timeout * 1000); - if (r < 0) { - if (errno == EINTR) - continue; - err = -errno; - break; - } - - if (r > 0 && pfd[0].revents & POLLERR) { - err = -EIO; - break; - } - - if (r == 0) - err = -ETIMEDOUT; - break; - } -out: - return err; -} - -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); -} - -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); -} - -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); -} - -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL, timeout); -} - -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); -} - -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); -} - -int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); -} - -int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); -} - -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) -{ - struct udev *udev = conn->uctrl->udev; - struct udev_ctrl_msg *uctrl_msg; - ssize_t size; - struct msghdr smsg; - struct cmsghdr *cmsg; - struct iovec iov; - struct ucred *cred; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - - uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); - if (uctrl_msg == NULL) - return NULL; - uctrl_msg->refcount = 1; - uctrl_msg->conn = conn; - udev_ctrl_connection_ref(conn); - - /* wait for the incoming message */ - for(;;) { - struct pollfd pfd[1]; - int r; - - pfd[0].fd = conn->sock; - pfd[0].events = POLLIN; - - r = poll(pfd, 1, 10000); - if (r < 0) { - if (errno == EINTR) - continue; - goto err; - } else if (r == 0) { - err(udev, "timeout waiting for ctrl message\n"); - goto err; - } else { - if (!(pfd[0].revents & POLLIN)) { - err(udev, "ctrl connection error: %m\n"); - goto err; - } - } - - break; - } - - iov.iov_base = &uctrl_msg->ctrl_msg_wire; - iov.iov_len = sizeof(struct udev_ctrl_msg_wire); - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - size = recvmsg(conn->sock, &smsg, 0); - if (size < 0) { - err(udev, "unable to receive ctrl message: %m\n"); - goto err; - } - cmsg = CMSG_FIRSTHDR(&smsg); - cred = (struct ucred *) CMSG_DATA(cmsg); - - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err(udev, "no sender credentials received, message ignored\n"); - goto err; - } - - if (cred->uid != 0) { - err(udev, "sender uid=%i, message ignored\n", cred->uid); - goto err; - } - - if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { - err(udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); - goto err; - } - - dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); - return uctrl_msg; -err: - udev_ctrl_msg_unref(uctrl_msg); - return NULL; -} - -struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg == NULL) - return NULL; - ctrl_msg->refcount++; - return ctrl_msg; -} - -struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg == NULL) - return NULL; - ctrl_msg->refcount--; - if (ctrl_msg->refcount > 0) - return ctrl_msg; - dbg(ctrl_msg->conn->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); - udev_ctrl_connection_unref(ctrl_msg->conn); - free(ctrl_msg); - return NULL; -} - -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; -} - -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) - return 1; - return -1; -} - -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) - return 1; - return -1; -} - -int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD_RULES) - return 1; - return -1; -} - -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) - return ctrl_msg->ctrl_msg_wire.buf; - return NULL; -} - -int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; -} - -int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) - return 1; - return -1; -} - -int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) - return 1; - return -1; -} diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 9ef1408ac1..0c17c45744 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -114,40 +114,6 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_monitor *destination, struct udev_device *udev_device); struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd); -/* libudev-ctrl.c - daemon runtime setup */ -struct udev_ctrl; -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); -struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *socket_path, int fd); -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); -struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); -struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); -int udev_ctrl_get_fd(struct udev_ctrl *uctrl); -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout); -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout); -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout); -struct udev_ctrl_connection; -struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl); -struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn); -struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn); -struct udev_ctrl_msg; -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn); -struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); -struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg); -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); - /* libudev-list.c */ enum udev_list_flags { UDEV_LIST_NONE = 0, diff --git a/udev/udev-ctrl.c b/udev/udev-ctrl.c new file mode 100644 index 0000000000..85e656248b --- /dev/null +++ b/udev/udev-ctrl.c @@ -0,0 +1,490 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +/* wire protocol magic must match */ +#define UDEV_CTRL_MAGIC 0xdead1dea + +enum udev_ctrl_msg_type { + UDEV_CTRL_UNKNOWN, + UDEV_CTRL_SET_LOG_LEVEL, + UDEV_CTRL_STOP_EXEC_QUEUE, + UDEV_CTRL_START_EXEC_QUEUE, + UDEV_CTRL_RELOAD_RULES, + UDEV_CTRL_SET_ENV, + UDEV_CTRL_SET_CHILDREN_MAX, + UDEV_CTRL_PING, + UDEV_CTRL_EXIT, +}; + +struct udev_ctrl_msg_wire { + char version[16]; + unsigned int magic; + enum udev_ctrl_msg_type type; + union { + int intval; + char buf[256]; + }; +}; + +struct udev_ctrl_msg { + int refcount; + struct udev_ctrl_connection *conn; + struct udev_ctrl_msg_wire ctrl_msg_wire; +}; + +struct udev_ctrl { + int refcount; + struct udev *udev; + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; + bool bound; + bool connected; +}; + +struct udev_ctrl_connection { + int refcount; + struct udev_ctrl *uctrl; + int sock; +}; + +static struct udev_ctrl *udev_ctrl_new(struct udev *udev) +{ + struct udev_ctrl *uctrl; + + uctrl = calloc(1, sizeof(struct udev_ctrl)); + if (uctrl == NULL) + return NULL; + uctrl->refcount = 1; + uctrl->udev = udev; + return uctrl; +} + +struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *socket_path, int fd) +{ + struct udev_ctrl *uctrl; + + uctrl = udev_ctrl_new(udev); + if (uctrl == NULL) + return NULL; + + if (fd < 0) { + uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); + if (uctrl->sock < 0) { + err(udev, "error getting socket: %m\n"); + udev_ctrl_unref(uctrl); + return NULL; + } + } else { + uctrl->bound = true; + uctrl->sock = fd; + } + + uctrl->saddr.sun_family = AF_LOCAL; + strcpy(uctrl->saddr.sun_path, socket_path); + uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); + /* translate leading '@' to abstract namespace */ + if (uctrl->saddr.sun_path[0] == '@') + uctrl->saddr.sun_path[0] = '\0'; + return uctrl; +} + +struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) +{ + return udev_ctrl_new_from_socket_fd(udev, socket_path, -1); +} + +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) +{ + int err; + + if (!uctrl->bound) { + err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err < 0) { + err = -errno; + err(uctrl->udev, "bind failed: %m\n"); + return err; + } + + err = listen(uctrl->sock, 0); + if (err < 0) { + err = -errno; + err(uctrl->udev, "listen failed: %m\n"); + return err; + } + + uctrl->bound = true; + } + return 0; +} + +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) +{ + return uctrl->udev; +} + +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return NULL; + uctrl->refcount++; + return uctrl; +} + +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return NULL; + uctrl->refcount--; + if (uctrl->refcount > 0) + return uctrl; + if (uctrl->sock >= 0) + close(uctrl->sock); + free(uctrl); + return NULL; +} + +int udev_ctrl_get_fd(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return -1; + return uctrl->sock; +} + +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) +{ + struct udev_ctrl_connection *conn; + struct ucred ucred; + socklen_t slen; + const int on = 1; + + conn = calloc(1, sizeof(struct udev_ctrl_connection)); + if (conn == NULL) + return NULL; + conn->refcount = 1; + conn->uctrl = uctrl; + + conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); + if (conn->sock < 0) { + if (errno != EINTR) + err(uctrl->udev, "unable to receive ctrl connection: %m\n"); + goto err; + } + + /* check peer credential of connection */ + slen = sizeof(ucred); + if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) { + err(uctrl->udev, "unable to receive credentials of ctrl connection: %m\n"); + goto err; + } + if (ucred.uid > 0) { + err(uctrl->udev, "sender uid=%i, message ignored\n", ucred.uid); + goto err; + } + + /* enable receiving of the sender credentials in the messages */ + setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + udev_ctrl_ref(uctrl); + return conn; +err: + if (conn->sock >= 0) + close(conn->sock); + free(conn); + return NULL; +} + +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) +{ + if (conn == NULL) + return NULL; + conn->refcount++; + return conn; +} + +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) +{ + if (conn == NULL) + return NULL; + conn->refcount--; + if (conn->refcount > 0) + return conn; + if (conn->sock >= 0) + close(conn->sock); + udev_ctrl_unref(conn->uctrl); + free(conn); + return NULL; +} + +static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) +{ + struct udev_ctrl_msg_wire ctrl_msg_wire; + int err = 0; + + memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); + strcpy(ctrl_msg_wire.version, "udev-" VERSION); + ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; + ctrl_msg_wire.type = type; + + if (buf != NULL) + util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); + else + ctrl_msg_wire.intval = intval; + + if (!uctrl->connected) { + if (connect(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen) < 0) { + err = -errno; + goto out; + } + uctrl->connected = true; + } + if (send(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0) < 0) { + err = -errno; + goto out; + } + + /* wait for peer message handling or disconnect */ + for (;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = uctrl->sock; + pfd[0].events = POLLIN; + r = poll(pfd, 1, timeout * 1000); + if (r < 0) { + if (errno == EINTR) + continue; + err = -errno; + break; + } + + if (r > 0 && pfd[0].revents & POLLERR) { + err = -EIO; + break; + } + + if (r == 0) + err = -ETIMEDOUT; + break; + } +out: + return err; +} + +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); +} + +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); +} + +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); +} + +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL, timeout); +} + +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); +} + +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); +} + +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); +} + +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); +} + +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) +{ + struct udev *udev = conn->uctrl->udev; + struct udev_ctrl_msg *uctrl_msg; + ssize_t size; + struct msghdr smsg; + struct cmsghdr *cmsg; + struct iovec iov; + struct ucred *cred; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + + uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); + if (uctrl_msg == NULL) + return NULL; + uctrl_msg->refcount = 1; + uctrl_msg->conn = conn; + udev_ctrl_connection_ref(conn); + + /* wait for the incoming message */ + for(;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = conn->sock; + pfd[0].events = POLLIN; + + r = poll(pfd, 1, 10000); + if (r < 0) { + if (errno == EINTR) + continue; + goto err; + } else if (r == 0) { + err(udev, "timeout waiting for ctrl message\n"); + goto err; + } else { + if (!(pfd[0].revents & POLLIN)) { + err(udev, "ctrl connection error: %m\n"); + goto err; + } + } + + break; + } + + iov.iov_base = &uctrl_msg->ctrl_msg_wire; + iov.iov_len = sizeof(struct udev_ctrl_msg_wire); + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + size = recvmsg(conn->sock, &smsg, 0); + if (size < 0) { + err(udev, "unable to receive ctrl message: %m\n"); + goto err; + } + cmsg = CMSG_FIRSTHDR(&smsg); + cred = (struct ucred *) CMSG_DATA(cmsg); + + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + err(udev, "no sender credentials received, message ignored\n"); + goto err; + } + + if (cred->uid != 0) { + err(udev, "sender uid=%i, message ignored\n", cred->uid); + goto err; + } + + if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { + err(udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); + goto err; + } + + dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); + return uctrl_msg; +err: + udev_ctrl_msg_unref(uctrl_msg); + return NULL; +} + +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount++; + return ctrl_msg; +} + +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount--; + if (ctrl_msg->refcount > 0) + return ctrl_msg; + dbg(ctrl_msg->conn->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + udev_ctrl_connection_unref(ctrl_msg->conn); + free(ctrl_msg); + return NULL; +} + +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; +} + +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD_RULES) + return 1; + return -1; +} + +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) + return ctrl_msg->ctrl_msg_wire.buf; + return NULL; +} + +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; +} + +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) + return 1; + return -1; +} + +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) + return 1; + return -1; +} diff --git a/udev/udev.h b/udev/udev.h index 88c32ec203..0a693e4608 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -94,6 +94,40 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); int udev_node_remove(struct udev_device *dev); void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); +/* udev-ctrl.c */ +struct udev_ctrl; +struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); +struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *socket_path, int fd); +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); +int udev_ctrl_get_fd(struct udev_ctrl *uctrl); +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout); +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout); +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout); +struct udev_ctrl_connection; +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl); +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn); +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn); +struct udev_ctrl_msg; +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn); +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg); +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); + /* udevadm commands */ int udevadm_monitor(struct udev *udev, int argc, char *argv[]); int udevadm_info(struct udev *udev, int argc, char *argv[]); -- cgit v1.2.3-54-g00ecf From 39b3b6ea8529a1302f23c24e67246b0e587ba993 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Jul 2011 01:22:20 +0200 Subject: update sd-daemon.[ch] --- udev/sd-daemon.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++----- udev/sd-daemon.h | 44 +++++++++++++++--------- 2 files changed, 120 insertions(+), 24 deletions(-) diff --git a/udev/sd-daemon.c b/udev/sd-daemon.c index 6d1eebff07..a2ec74cceb 100644 --- a/udev/sd-daemon.c +++ b/udev/sd-daemon.c @@ -41,10 +41,21 @@ #include #include #include +#include + +#if defined(__linux__) +#include +#endif #include "sd-daemon.h" -int sd_listen_fds(int unset_environment) { +#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS) +#define _sd_hidden_ __attribute__ ((visibility("hidden"))) +#else +#define _sd_hidden_ +#endif + +_sd_hidden_ int sd_listen_fds(int unset_environment) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; @@ -125,7 +136,7 @@ finish: #endif } -int sd_is_fifo(int fd, const char *path) { +_sd_hidden_ int sd_is_fifo(int fd, const char *path) { struct stat st_fd; if (fd < 0) @@ -158,6 +169,42 @@ int sd_is_fifo(int fd, const char *path) { return 1; } +_sd_hidden_ int sd_is_special(int fd, const char *path) { + struct stat st_fd; + + if (fd < 0) + return -EINVAL; + + if (fstat(fd, &st_fd) < 0) + return -errno; + + if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode)) + return 0; + + if (path) { + struct stat st_path; + + if (stat(path, &st_path) < 0) { + + if (errno == ENOENT || errno == ENOTDIR) + return 0; + + return -errno; + } + + if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode)) + return + st_path.st_dev == st_fd.st_dev && + st_path.st_ino == st_fd.st_ino; + else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode)) + return st_path.st_rdev == st_fd.st_rdev; + else + return 0; + } + + return 1; +} + static int sd_is_socket_internal(int fd, int type, int listening) { struct stat st_fd; @@ -209,7 +256,7 @@ union sockaddr_union { struct sockaddr_storage storage; }; -int sd_is_socket(int fd, int family, int type, int listening) { +_sd_hidden_ int sd_is_socket(int fd, int family, int type, int listening) { int r; if (family < 0) @@ -237,7 +284,7 @@ int sd_is_socket(int fd, int family, int type, int listening) { return 1; } -int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { +_sd_hidden_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { union sockaddr_union sockaddr; socklen_t l; int r; @@ -282,7 +329,7 @@ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port return 1; } -int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { +_sd_hidden_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { union sockaddr_union sockaddr; socklen_t l; int r; @@ -325,7 +372,44 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t return 1; } -int sd_notify(int unset_environment, const char *state) { +_sd_hidden_ int sd_is_mq(int fd, const char *path) { +#if !defined(__linux__) + return 0; +#else + struct mq_attr attr; + + if (fd < 0) + return -EINVAL; + + if (mq_getattr(fd, &attr) < 0) + return -errno; + + if (path) { + char fpath[PATH_MAX]; + struct stat a, b; + + if (path[0] != '/') + return -EINVAL; + + if (fstat(fd, &a) < 0) + return -errno; + + strncpy(stpcpy(fpath, "/dev/mqueue"), path, sizeof(fpath) - 12); + fpath[sizeof(fpath)-1] = 0; + + if (stat(fpath, &b) < 0) + return -errno; + + if (a.st_dev != b.st_dev || + a.st_ino != b.st_ino) + return 0; + } + + return 1; +#endif +} + +_sd_hidden_ int sd_notify(int unset_environment, const char *state) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) return 0; #else @@ -393,7 +477,7 @@ finish: #endif } -int sd_notifyf(int unset_environment, const char *format, ...) { +_sd_hidden_ int sd_notifyf(int unset_environment, const char *format, ...) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; #else @@ -415,7 +499,7 @@ int sd_notifyf(int unset_environment, const char *format, ...) { #endif } -int sd_booted(void) { +_sd_hidden_ int sd_booted(void) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; #else diff --git a/udev/sd-daemon.h b/udev/sd-daemon.h index 4b853a15be..46dc7fd7e5 100644 --- a/udev/sd-daemon.h +++ b/udev/sd-daemon.h @@ -75,14 +75,6 @@ extern "C" { #endif #endif -#ifndef _sd_hidden_ -#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS) -#define _sd_hidden_ __attribute__ ((visibility("hidden"))) -#else -#define _sd_hidden_ -#endif -#endif - /* Log levels for usage on stderr: @@ -117,7 +109,7 @@ extern "C" { See sd_listen_fds(3) for more information. */ -int sd_listen_fds(int unset_environment) _sd_hidden_; +int sd_listen_fds(int unset_environment); /* Helper call for identifying a passed file descriptor. Returns 1 if @@ -129,7 +121,19 @@ int sd_listen_fds(int unset_environment) _sd_hidden_; See sd_is_fifo(3) for more information. */ -int sd_is_fifo(int fd, const char *path) _sd_hidden_; +int sd_is_fifo(int fd, const char *path); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a special character device on the file + system stored under the specified path, 0 otherwise. + If path is NULL a path name check will not be done and the call + only verifies if the file descriptor refers to a special character. + Returns a negative errno style error code on failure. + + See sd_is_special(3) for more information. +*/ +int sd_is_special(int fd, const char *path); /* Helper call for identifying a passed file descriptor. Returns 1 if @@ -145,7 +149,7 @@ int sd_is_fifo(int fd, const char *path) _sd_hidden_; See sd_is_socket(3) for more information. */ -int sd_is_socket(int fd, int family, int type, int listening) _sd_hidden_; +int sd_is_socket(int fd, int family, int type, int listening); /* Helper call for identifying a passed file descriptor. Returns 1 if @@ -159,7 +163,7 @@ int sd_is_socket(int fd, int family, int type, int listening) _sd_hidden_; See sd_is_socket_inet(3) for more information. */ -int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) _sd_hidden_; +int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port); /* Helper call for identifying a passed file descriptor. Returns 1 if @@ -175,7 +179,15 @@ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port See sd_is_socket_unix(3) for more information. */ -int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) _sd_hidden_; +int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a POSIX Message Queue of the specified name, + 0 otherwise. If path is NULL a message queue name check is not + done. Returns a negative errno style error code on failure. +*/ +int sd_is_mq(int fd, const char *path); /* Informs systemd about changed daemon state. This takes a number of @@ -221,7 +233,7 @@ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t See sd_notify(3) for more information. */ -int sd_notify(int unset_environment, const char *state) _sd_hidden_; +int sd_notify(int unset_environment, const char *state); /* Similar to sd_notify() but takes a format string. @@ -243,7 +255,7 @@ int sd_notify(int unset_environment, const char *state) _sd_hidden_; See sd_notifyf(3) for more information. */ -int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3) _sd_hidden_; +int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3); /* Returns > 0 if the system was booted with systemd. Returns < 0 on @@ -256,7 +268,7 @@ int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_( See sd_booted(3) for more information. */ -int sd_booted(void) _sd_hidden_; +int sd_booted(void); #ifdef __cplusplus } -- cgit v1.2.3-54-g00ecf From a6148db0ffb22e71986ce09a5a86105478ae1c91 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Jul 2011 02:00:13 +0200 Subject: release 172 --- ChangeLog | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 16 +++++++++++++++ TODO | 16 +++++++-------- configure.ac | 2 +- 4 files changed, 90 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 138474c36f..0d40475866 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,68 @@ +Summary of changes from v171 to v172 +============================================ + +Bastien Nocera (3): + accelerometer: add orientation property + udev-acl: fix memleak + accelerometer: add documentation + +Harald Hoyer (2): + udevadm-*.c: return != 0, if unknown option given + udev/udevadm-monitor.c: fixed misplaced brace + +Kay Sievers (33): + rules: apply 'audio' group of the static snd/{seq,timer} nodes + Makefile: add tar-sync + rules: static_node - use 0660 if group is given to get the cigar + rule-syntax-check.py: use print() + make: use 'git tag' + rules: run input_id for main input devices too + update TODO + configure: add AC_CONFIG_AUX_DIR, AC_CONFIG_SRCDIR + cdrom_id: add tray lock and eject handling + rules: enable in-kernel media-presence polling + update TODO + delete mobile-action-modeswitch which has moved to usb_modeswitch + libudev: enumerate - scan /sys/module + rules: move polling rule above 'block' match + libudev: monitor - update doc + rules: set polling value only if it is disabled + libudev: device - fix udev_device_get_tags_list_entry() to always load database + rules: remove redundant MODE="0664" from lp rules + rules: fix wrong wildcard match, we always need a ':*' at the end + libudev: device - export udev_device_has_tag() + path_id: add missing '-' to tape suffix + path_id: add ID_PATH_TAG= to be used in udev tags + enforce valid TAG+= names + update TODO + libudev: device - add udev_device_has_tag() to libudev.h and gtk-doc + libudev: enumerate - add udev_enumerate_add_match_parent() + libudev: enumerate - include parent device itself with match_parent() + libudev: enumerate - clarify documentation + path_id: recognize ACPI parent devices + rules: input - call path_id for ACPI devices + udevadm: monitor - use uptime to match the kernel's timestamp + libudev: ctrl - move code to udev directory + update sd-daemon.[ch] + +Keshav P.R (1): + rules: support for gpt partition uuid/label + +Lee, Chun-Yi (1): + Support more MSI notebook by using asterisk on dmi vendor name + +Marco d'Itri (1): + Add missing commas to 95-keymap.rules + +Martin Pitt (3): + keymap: Add Microsoft Natural Keyboard + keymap: Add force-release quirk for Hannspree SN10. + keymap: Add slight name variations of Toshiba Satellites + +Peter Jones (1): + ata_id: show the error message when HDIO_GET_IDENTITY fails + + Summary of changes from v170 to v171 ============================================ diff --git a/NEWS b/NEWS index 301e725269..75e6aa0b5e 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,19 @@ +udev 172 +======== +Bugfixes. + +Udev now enables kernel media-presence polling if available. Part +of udisks optical drive tray-handling moved to cdrom_id: The tray +is locked as soon as a media is detected to enable the receiving +of media-eject-request events. Media-eject-request events will +eject the media. + +Libudev enumerate is now able to enumerate a subtree of a given +device. + +The mobile-action-modeswitch modeswitch tool was deleted. The +functionality is provided by usb_modeswitch now. + udev 171 ======== Bugfixes. diff --git a/TODO b/TODO index 7106d9c81e..6612be9722 100644 --- a/TODO +++ b/TODO @@ -1,15 +1,11 @@ - - udev_enumerate_remove_matches() - - test (now fixed) /dev/tape/ links - - libudev: return proper errno or set errno - - /run/udev/control socket (add ConditionVirtualization=!pidns) - - move: - udevd -> --libexecdir - udevadm -> --bindir + - move udevd -> --libexecdir + + - allow path_id, usb_id, usb_db, pci_db as built-in? - kill rules_generator: - no longer rename netifs in kernel namespace @@ -19,10 +15,14 @@ - properly document what system management needs to put into rules files - - remove RUN+="socket:" + - move udevadm -> --bindir - remove deprecated trigger --type=failed logic - remove deprecated BUS=, SYSFS{}=, ID= keys + - remove RUN+="socket:" + - kill tabs? + + - libudev: return proper errno or set errno diff --git a/configure.ac b/configure.ac index 975e5fbfdb..7bdb229043 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [171], + [172], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From 18b53db8401592fb7c21f2bbd442bc2fb0f27f0b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Jul 2011 22:54:04 +0200 Subject: make: fix 'make tar-sync' --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 0b670d5340..40cea85709 100644 --- a/Makefile.am +++ b/Makefile.am @@ -694,7 +694,7 @@ git-sync: git push --tags $(VERSION) tar-sync: - scp udev-$(VERSION).gz master.kernel.org:/pub/linux/utils/kernel/hotplug/ + scp udev-$(VERSION).tar.gz master.kernel.org:/pub/linux/utils/kernel/hotplug/ doc-sync: rsync -av udev/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ -- cgit v1.2.3-54-g00ecf From 29bbefe42883a660c6769f042e7bafdf151d720b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Jul 2011 22:56:07 +0200 Subject: udevd: use 'uptime' in debug timestamp --- udev/udevd.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/udev/udevd.c b/udev/udevd.c index e7384e19a2..968b41667e 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -55,13 +55,12 @@ static void log_fn(struct udev *udev, int priority, { if (debug) { char buf[1024]; - struct timeval tv; - struct timezone tz; + struct timespec ts; vsnprintf(buf, sizeof(buf), format, args); - gettimeofday(&tv, &tz); + clock_gettime(CLOCK_MONOTONIC, &ts); fprintf(stderr, "%llu.%06u [%u] %s: %s", - (unsigned long long) tv.tv_sec, (unsigned int) tv.tv_usec, + (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, (int) getpid(), fn, buf); } else { vsyslog(priority, format, args); -- cgit v1.2.3-54-g00ecf From 36acdbcc776822624103eff7c80a9468317918ac Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 11 Jul 2011 22:56:37 +0200 Subject: udevd: fix (recently) broken static node permission setting Many thanks to Tom Gundersen for identifying the issue. --- udev/udev-rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index d16c1f9454..7db0767303 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2721,7 +2721,7 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules) struct stat stats; /* we assure, that the permissions tokens are sorted before the static token */ - if (uid == 0 && gid == 0) + if (mode == 0 && uid == 0 && gid == 0) goto next; util_strscpyl(filename, sizeof(filename), udev_get_dev_path(rules->udev), "/", &rules->buf[cur->key.value_off], NULL); -- cgit v1.2.3-54-g00ecf From f11eeccc12cf5917f0687dce96c0993f3eab9c9e Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 12 Jul 2011 08:29:05 +0200 Subject: gudev: Ship JavaScript examples --- Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 40cea85709..8cfdbc80cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -437,7 +437,10 @@ EXTRA_DIST += \ extras/gudev/COPYING \ extras/gudev/gudevmarshal.list \ extras/gudev/gudevenumtypes.h.template \ - extras/gudev/gudevenumtypes.c.template + extras/gudev/gudevenumtypes.c.template \ + extras/gudev/gjs-example.js \ + extras/gudev/seed-example-enum.js \ + extras/gudev/seed-example.js extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ -- cgit v1.2.3-54-g00ecf From b5d9178f0e0e5e2e51df74b40636144eca362209 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 12 Jul 2011 08:32:46 +0200 Subject: scsi_id: Ship README --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 8cfdbc80cc..0599bb24cf 100644 --- a/Makefile.am +++ b/Makefile.am @@ -277,6 +277,7 @@ extras_scsi_id_scsi_id_SOURCES =\ extras_scsi_id_scsi_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/scsi_id/scsi_id dist_man_MANS += extras/scsi_id/scsi_id.8 +EXTRA_DIST += extras/scsi_id/README # ------------------------------------------------------------------------------ # usb_id - USB device property import -- cgit v1.2.3-54-g00ecf From fdf0856f234458f6066479e07fb46e0928137794 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 12 Jul 2011 14:10:12 +0200 Subject: Remove obsolete extras/scsi_id/scsi_id.config We have not shipped it anyway, and is not necessary any more these days. --- extras/scsi_id/scsi_id.config | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 extras/scsi_id/scsi_id.config diff --git a/extras/scsi_id/scsi_id.config b/extras/scsi_id/scsi_id.config deleted file mode 100644 index d2a10a5f7b..0000000000 --- a/extras/scsi_id/scsi_id.config +++ /dev/null @@ -1,17 +0,0 @@ -# -# scsi_id configuration -# -# lower or upper case has no effect on the left side. Quotes (") are -# required for spaces in values. Model is the same as the SCSI -# INQUIRY product identification field. Per the SCSI INQUIRY, the vendor -# is limited to 8 bytes, model to 16 bytes. -# -# The first matching line found is used. Short matches match longer ones, -# if you do not want such a match space fill the extra bytes. If no model -# is specified, only the vendor string need match. -# -# options= -# vendor=string[,model=string],options= - -# some libata drives require vpd page 0x80 -vendor="ATA",options=-p 0x80 -- cgit v1.2.3-54-g00ecf From b3ca87a04a6bc32d852774211b35313ec8a09da1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 13 Jul 2011 02:49:34 +0200 Subject: rules: mount fuse filesystem only 'add' --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 32f9eba016..f5b181dcc0 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -97,7 +97,7 @@ KERNEL=="rfkill", MODE="0644" # CPU KERNEL=="cpu[0-9]*", MODE="0444" -KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse", \ +KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse", \ RUN+="/bin/mount -t fusectl fusectl /sys/fs/fuse/connections" SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" -- cgit v1.2.3-54-g00ecf From 1985c76e48753c200b5a15630b00245c3f60775b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 Jul 2011 01:53:23 +0200 Subject: udevadm: move udevadm command descriptions into their files --- udev/udev.h | 18 ++++++--- udev/udevadm-control.c | 8 +++- udev/udevadm-info.c | 8 +++- udev/udevadm-monitor.c | 8 +++- udev/udevadm-settle.c | 8 +++- udev/udevadm-test.c | 9 ++++- udev/udevadm-trigger.c | 8 +++- udev/udevadm.c | 101 +++++++++++++++++-------------------------------- 8 files changed, 90 insertions(+), 78 deletions(-) diff --git a/udev/udev.h b/udev/udev.h index 0a693e4608..0c73b502cb 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -129,10 +129,16 @@ const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); /* udevadm commands */ -int udevadm_monitor(struct udev *udev, int argc, char *argv[]); -int udevadm_info(struct udev *udev, int argc, char *argv[]); -int udevadm_control(struct udev *udev, int argc, char *argv[]); -int udevadm_trigger(struct udev *udev, int argc, char *argv[]); -int udevadm_settle(struct udev *udev, int argc, char *argv[]); -int udevadm_test(struct udev *udev, int argc, char *argv[]); +struct udevadm_cmd { + const char *name; + int (*cmd)(struct udev *udev, int argc, char *argv[]); + const char *help; + int debug; +}; +extern const struct udevadm_cmd udevadm_monitor; +extern const struct udevadm_cmd udevadm_info; +extern const struct udevadm_cmd udevadm_control; +extern const struct udevadm_cmd udevadm_trigger; +extern const struct udevadm_cmd udevadm_settle; +extern const struct udevadm_cmd udevadm_test; #endif diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 69da86563d..b500d75a4e 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -41,7 +41,7 @@ static void print_help(void) " --help print this help text\n\n"); } -int udevadm_control(struct udev *udev, int argc, char *argv[]) +static int adm_control(struct udev *udev, int argc, char *argv[]) { struct udev_ctrl *uctrl = NULL; int timeout = 60; @@ -161,3 +161,9 @@ out: udev_ctrl_unref(uctrl); return rc; } + +const struct udevadm_cmd udevadm_control = { + .name = "control", + .cmd = adm_control, + .help = "control the udev daemon", +}; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index a6387d07ae..4053436fe6 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -275,7 +275,7 @@ static void cleanup_db(struct udev *udev) } } -int udevadm_info(struct udev *udev, int argc, char *argv[]) +static int uinfo(struct udev *udev, int argc, char *argv[]) { struct udev_device *device = NULL; bool root = 0; @@ -556,3 +556,9 @@ exit: udev_device_unref(device); return rc; } + +const struct udevadm_cmd udevadm_info = { + .name = "info", + .cmd = uinfo, + .help = "query sysfs or the udev database", +}; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 9b8bf4eccf..7ea7aa0f70 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -64,7 +64,7 @@ static void print_device(struct udev_device *device, const char *source, int pro } } -int udevadm_monitor(struct udev *udev, int argc, char *argv[]) +static int adm_monitor(struct udev *udev, int argc, char *argv[]) { struct sigaction act; sigset_t mask; @@ -289,3 +289,9 @@ out: udev_list_cleanup_entries(udev, &tag_match_list); return rc; } + +const struct udevadm_cmd udevadm_monitor = { + .name = "monitor", + .cmd = adm_monitor, + .help = "listen to kernel and udev events", +}; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index b17ba806d0..d40c8c8d5e 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -36,7 +36,7 @@ #include "udev.h" -int udevadm_settle(struct udev *udev, int argc, char *argv[]) +static int adm_settle(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { { "seq-start", required_argument, NULL, 's' }, @@ -225,3 +225,9 @@ out: udev_queue_unref(udev_queue); return rc; } + +const struct udevadm_cmd udevadm_settle = { + .name = "settle", + .cmd = adm_settle, + .help = "wait for the event queue to finish", +}; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index bb7a0fd8a1..c2c377c3d7 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -31,7 +31,7 @@ #include "udev.h" -int udevadm_test(struct udev *udev, int argc, char *argv[]) +static int adm_test(struct udev *udev, int argc, char *argv[]) { int resolve_names = 1; char filename[UTIL_PATH_SIZE]; @@ -161,3 +161,10 @@ out: udev_rules_unref(rules); return rc; } + +const struct udevadm_cmd udevadm_test = { + .name = "test", + .cmd = adm_test, + .help = "simulation run", + .debug = true, +}; diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 3b53be5646..610cf5e9c1 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -89,7 +89,7 @@ static const char *keyval(const char *str, const char **val, char *buf, size_t s return buf; } -int udevadm_trigger(struct udev *udev, int argc, char *argv[]) +static int adm_trigger(struct udev *udev, int argc, char *argv[]) { static const struct option options[] = { { "verbose", no_argument, NULL, 'v' }, @@ -247,3 +247,9 @@ exit: udev_enumerate_unref(udev_enumerate); return rc; } + +const struct udevadm_cmd udevadm_trigger = { + .name = "trigger", + .cmd = adm_trigger, + .help = "request events from the kernel", +}; diff --git a/udev/udevadm.c b/udev/udevadm.c index 2a29158917..d3810e73e0 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -44,77 +44,46 @@ static void log_fn(struct udev *udev, int priority, } } -struct command { - const char *name; - int (*cmd)(struct udev *udev, int argc, char *argv[]); - const char *help; - int debug; -}; - -static const struct command cmds[]; - -static int version(struct udev *udev, int argc, char *argv[]) +static int adm_version(struct udev *udev, int argc, char *argv[]) { printf("%s\n", VERSION); return 0; } +static const struct udevadm_cmd udevadm_version = { + .name = "version", + .cmd = adm_version, +}; + +static int adm_help(struct udev *udev, int argc, char *argv[]); +static const struct udevadm_cmd udevadm_help = { + .name = "help", + .cmd = adm_help, +}; + +static const struct udevadm_cmd *udevadm_cmds[] = { + &udevadm_info, + &udevadm_trigger, + &udevadm_settle, + &udevadm_control, + &udevadm_monitor, + &udevadm_test, + &udevadm_version, + &udevadm_help, +}; -static int help(struct udev *udev, int argc, char *argv[]) +static int adm_help(struct udev *udev, int argc, char *argv[]) { - const struct command *cmd; + unsigned int i; printf("Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); - for (cmd = cmds; cmd->name != NULL; cmd++) - if (cmd->help != NULL) - printf(" %-12s %s\n", cmd->name, cmd->help); + for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) + if (udevadm_cmds[i]->help != NULL) + printf(" %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help); printf("\n"); return 0; } -static const struct command cmds[] = { - { - .name = "info", - .cmd = udevadm_info, - .help = "query sysfs or the udev database", - }, - { - .name = "trigger", - .cmd = udevadm_trigger, - .help = "request events from the kernel", - }, - { - .name = "settle", - .cmd = udevadm_settle, - .help = "wait for the event queue to finish", - }, - { - .name = "control", - .cmd = udevadm_control, - .help = "control the udev daemon", - }, - { - .name = "monitor", - .cmd = udevadm_monitor, - .help = "listen to kernel and udev events", - }, - { - .name = "test", - .cmd = udevadm_test, - .help = "simulation run", - .debug = true, - }, - { - .name = "version", - .cmd = version, - }, - { - .name = "help", - .cmd = help, - }, - {} -}; - -static int run_command(struct udev *udev, const struct command *cmd, int argc, char *argv[]) +static int run_command(struct udev *udev, const struct udevadm_cmd *cmd, int argc, char *argv[]) { if (cmd->debug) { debug = true; @@ -135,7 +104,7 @@ int main(int argc, char *argv[]) {} }; const char *command; - int i; + unsigned int i; int rc = 1; udev = udev_new(); @@ -160,10 +129,10 @@ int main(int argc, char *argv[]) udev_set_log_priority(udev, LOG_INFO); break; case 'h': - rc = help(udev, argc, argv); + rc = adm_help(udev, argc, argv); goto out; case 'V': - rc = version(udev, argc, argv); + rc = adm_version(udev, argc, argv); goto out; default: goto out; @@ -174,18 +143,18 @@ int main(int argc, char *argv[]) info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); if (command != NULL) - for (i = 0; cmds[i].cmd != NULL; i++) { - if (strcmp(cmds[i].name, command) == 0) { + for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) { + if (strcmp(udevadm_cmds[i]->name, command) == 0) { argc -= optind; argv += optind; optind = 0; - rc = run_command(udev, &cmds[i], argc, argv); + rc = run_command(udev, udevadm_cmds[i], argc, argv); goto out; } } fprintf(stderr, "missing or unknown command\n\n"); - help(udev, argc, argv); + adm_help(udev, argc, argv); rc = 2; out: udev_selinux_exit(udev); -- cgit v1.2.3-54-g00ecf From c874e22e0da6f87aa72ade635f11421e6ecb6e48 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 14 Jul 2011 02:02:35 +0200 Subject: udev-acl: skip ACLs when systemd is running, disable by default --- Makefile.am | 2 +- configure.ac | 28 +++++++-------- extras/udev-acl/70-acl.rules | 73 ------------------------------------- extras/udev-acl/70-udev-acl.rules | 76 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 91 insertions(+), 88 deletions(-) delete mode 100644 extras/udev-acl/70-acl.rules create mode 100644 extras/udev-acl/70-udev-acl.rules diff --git a/Makefile.am b/Makefile.am index 0599bb24cf..d2e9b855fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -360,7 +360,7 @@ if ENABLE_UDEV_ACL extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) -dist_udevrules_DATA += extras/udev-acl/70-acl.rules +dist_udevrules_DATA += extras/udev-acl/70-udev-acl.rules libexec_PROGRAMS += extras/udev-acl/udev-acl udevacl-install-hook: diff --git a/configure.ac b/configure.ac index 7bdb229043..d1327ab5d2 100644 --- a/configure.ac +++ b/configure.ac @@ -126,20 +126,6 @@ if test "x$enable_hwdb" = xyes; then fi AM_CONDITIONAL([ENABLE_HWDB], [test "x$enable_hwdb" = xyes]) -# ------------------------------------------------------------------------------ -# udev_acl - apply ACLs for users with local forground sessions -# ------------------------------------------------------------------------------ -AC_ARG_ENABLE([udev_acl], - AS_HELP_STRING([--disable-udev_acl], [disable local user acl permissions support]), - [], [enable_udev_acl=yes]) -if test "x$enable_udev_acl" = xyes; then - AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) - AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) - - PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) -fi -AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = xyes]) - # ------------------------------------------------------------------------------ # GUdev - libudev gobject interface # ------------------------------------------------------------------------------ @@ -183,6 +169,20 @@ if test "x$enable_keymap" = xyes; then fi AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = xyes]) +# ------------------------------------------------------------------------------ +# udev_acl - apply ACLs for users with local forground sessions +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([udev_acl], + AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support]), + [], [enable_udev_acl=no]) +if test "x$enable_udev_acl" = xyes; then + AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) + AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) + + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) +fi +AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = xyes]) + # ------------------------------------------------------------------------------ # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) # ------------------------------------------------------------------------------ diff --git a/extras/udev-acl/70-acl.rules b/extras/udev-acl/70-acl.rules deleted file mode 100644 index 5dc5ed0bfc..0000000000 --- a/extras/udev-acl/70-acl.rules +++ /dev/null @@ -1,73 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# Do not use TAG+="udev-acl" outside of this file. This variable is private to -# udev-acl of this udev release and may be replaced at any time. - -ENV{MAJOR}=="", GOTO="acl_end" -ACTION=="remove", GOTO="acl_apply" - -# PTP/MTP protocol devices, cameras, portable media players -SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="udev-acl" - -# digicams with proprietary protocol -ENV{ID_GPHOTO2}=="*?", TAG+="udev-acl" - -# SCSI and USB scanners -ENV{libsane_matched}=="yes", TAG+="udev-acl" - -# HPLIP devices (necessary for ink level check and HP tool maintenance) -ENV{ID_HPLIP}=="1", TAG+="udev-acl" - -# optical drives -SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="udev-acl" - -# sound devices -SUBSYSTEM=="sound", TAG+="udev-acl" - -# ffado is an userspace driver for firewire sound cards -SUBSYSTEM=="firewire", ENV{ID_FFADO}=="1", TAG+="udev-acl" - -# webcams, frame grabber, TV cards -SUBSYSTEM=="video4linux", TAG+="udev-acl" -SUBSYSTEM=="dvb", TAG+="udev-acl" - -# IIDC devices: industrial cameras and some webcams -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG+="udev-acl" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", TAG+="udev-acl" -# AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="udev-acl" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", TAG+="udev-acl" - -# DRI video devices -SUBSYSTEM=="drm", KERNEL=="card*", TAG+="udev-acl" - -# KVM -SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="udev-acl" - -# smart-card readers -ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" - -# PDA devices -ENV{ID_PDA}=="*?", TAG+="udev-acl" - -# Programmable remote control -ENV{ID_REMOTE_CONTROL}=="1", TAG+="udev-acl" - -# joysticks -SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" - -# color measurement devices -ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="udev-acl" - -# DDC/CI device, usually high-end monitors such as the DreamColor -ENV{DDC_DEVICE}=="*?", TAG+="udev-acl" - -# media player raw devices (for user-mode drivers, Android SDK, etc.) -SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="udev-acl" - -# apply ACL for all locally logged in users -LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ - RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" - -LABEL="acl_end" diff --git a/extras/udev-acl/70-udev-acl.rules b/extras/udev-acl/70-udev-acl.rules new file mode 100644 index 0000000000..2dac283101 --- /dev/null +++ b/extras/udev-acl/70-udev-acl.rules @@ -0,0 +1,76 @@ +# do not edit this file, it will be overwritten on update + +# Do not use TAG+="udev-acl" outside of this file. This variable is private to +# udev-acl of this udev release and may be replaced at any time. + +ENV{MAJOR}=="", GOTO="acl_end" +ACTION=="remove", GOTO="acl_apply" + +# systemd replaces udev-acl entirely, skip if active +TEST=="/sys/fs/cgroup/systemd", TAG=="uaccess", GOTO="acl_end" + +# PTP/MTP protocol devices, cameras, portable media players +SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="udev-acl" + +# digicams with proprietary protocol +ENV{ID_GPHOTO2}=="*?", TAG+="udev-acl" + +# SCSI and USB scanners +ENV{libsane_matched}=="yes", TAG+="udev-acl" + +# HPLIP devices (necessary for ink level check and HP tool maintenance) +ENV{ID_HPLIP}=="1", TAG+="udev-acl" + +# optical drives +SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="udev-acl" + +# sound devices +SUBSYSTEM=="sound", TAG+="udev-acl" + +# ffado is an userspace driver for firewire sound cards +SUBSYSTEM=="firewire", ENV{ID_FFADO}=="1", TAG+="udev-acl" + +# webcams, frame grabber, TV cards +SUBSYSTEM=="video4linux", TAG+="udev-acl" +SUBSYSTEM=="dvb", TAG+="udev-acl" + +# IIDC devices: industrial cameras and some webcams +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG+="udev-acl" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", TAG+="udev-acl" +# AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="udev-acl" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", TAG+="udev-acl" + +# DRI video devices +SUBSYSTEM=="drm", KERNEL=="card*", TAG+="udev-acl" + +# KVM +SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="udev-acl" + +# smart-card readers +ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" + +# PDA devices +ENV{ID_PDA}=="*?", TAG+="udev-acl" + +# Programmable remote control +ENV{ID_REMOTE_CONTROL}=="1", TAG+="udev-acl" + +# joysticks +SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" + +# color measurement devices +ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="udev-acl" + +# DDC/CI device, usually high-end monitors such as the DreamColor +ENV{DDC_DEVICE}=="*?", TAG+="udev-acl" + +# media player raw devices (for user-mode drivers, Android SDK, etc.) +SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="udev-acl" + +# apply ACL for all locally logged in users +LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ + RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" + +LABEL="acl_end" -- cgit v1.2.3-54-g00ecf From 52dd9ef2efd3b0392fed505fe4af7c18cb7daa35 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 15 Jul 2011 02:18:50 +0200 Subject: do not delete database when renaming netif, the db name does not change anymore --- udev/udev-event.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 832abbbfce..a4141e9c4b 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -957,10 +957,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, if (err == 0) { info(event->udev, "renamed netif to '%s'\n", event->name); - /* delete stale db file */ - udev_device_delete_db(dev); - udev_device_tag_index(dev, NULL, false); - /* remember old name */ udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); -- cgit v1.2.3-54-g00ecf From ace6bfa72525089790b773ab0178e6d1a129357f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 18 Jul 2011 21:19:00 +0200 Subject: do not allow kernel properties to be set by udev rules --- udev/udev-rules.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 7db0767303..89d98248a1 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1385,6 +1385,26 @@ static int add_rule(struct udev_rules *rules, char *line, if (rule_add_key(&rule_tmp, TK_M_ENV, op, value, attr) != 0) goto invalid; } else { + static const char *blacklist[] = { + "ACTION", + "SUBSYSTEM", + "DEVTYPE", + "MAJOR", + "MINOR", + "DRIVER", + "IFINDEX", + "DEVNAME", + "DEVLINKS", + "DEVPATH", + "TAGS", + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(blacklist); i++) + if (strcmp(attr, blacklist[i]) == 0) { + err(rules->udev, "invalid ENV attribute, '%s' can not be set %s:%u\n", attr, filename, lineno); + continue; + } if (rule_add_key(&rule_tmp, TK_A_ENV, op, value, attr) != 0) goto invalid; } -- cgit v1.2.3-54-g00ecf From 4fb270171d96e55c851e1493b18dfee1b3a4139e Mon Sep 17 00:00:00 2001 From: Allin Cottrell Date: Tue, 19 Jul 2011 21:16:22 +0200 Subject: configure: allow to disable mtd_probe --- Makefile.am | 25 ++++++++++++++----------- configure.ac | 8 ++++++++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am index d2e9b855fe..e20694f75f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -294,17 +294,6 @@ extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules -# ------------------------------------------------------------------------------ -# mtd_probe - autoloads FTL module for mtd devices -# ------------------------------------------------------------------------------ -extras_mtd_probe_mtd_probe_SOURCES = \ - extras/mtd_probe/mtd_probe.c \ - extras/mtd_probe/mtd_probe.h \ - extras/mtd_probe/probe_smartmedia.c -extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) -dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules -libexec_PROGRAMS += extras/mtd_probe/mtd_probe - # ------------------------------------------------------------------------------ # accelerometer - updates device orientation # ------------------------------------------------------------------------------ @@ -334,6 +323,20 @@ dist_udevrules_DATA += \ extras/rule_generator/75-persistent-net-generator.rules endif +if ENABLE_MTD_PROBE +# ------------------------------------------------------------------------------ +# mtd_probe - autoloads FTL module for mtd devices +# ------------------------------------------------------------------------------ +extras_mtd_probe_mtd_probe_SOURCES = \ + extras/mtd_probe/mtd_probe.c \ + extras/mtd_probe/mtd_probe.h \ + extras/mtd_probe/probe_smartmedia.c +extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules +libexec_PROGRAMS += extras/mtd_probe/mtd_probe + +endif + if ENABLE_HWDB # ------------------------------------------------------------------------------ # usb/pci-db - read vendor/device string database diff --git a/configure.ac b/configure.ac index d1327ab5d2..fe9684611b 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,14 @@ AC_ARG_ENABLE([rule_generator], [], [enable_rule_generator=yes]) AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = xyes]) +# ------------------------------------------------------------------------------ +# mtd_probe - autoloads FTL module for mtd devices +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([mtd_probe], + AS_HELP_STRING([--disable-mtd_probe], [disable MTD support]), + [], [enable_mtd_probe=yes]) +AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = xyes]) + # ------------------------------------------------------------------------------ # usb/pci-db - read vendor/device string database # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From e3c14a7ff3931e4c09711966e3a82fd8f98e568a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 19 Jul 2011 21:17:05 +0200 Subject: configure: reorder options --- INSTALL | 36 ---------------- Makefile.am | 131 +++++++++++++++++++++++++++++------------------------------ README | 2 +- TODO | 4 ++ configure.ac | 106 +++++++++++++++++++++++------------------------ 5 files changed, 121 insertions(+), 158 deletions(-) diff --git a/INSTALL b/INSTALL index aeabcb9dfc..943a8a467a 100644 --- a/INSTALL +++ b/INSTALL @@ -8,42 +8,6 @@ Usual options for udev installed in the root filesystem are: --libexecdir=/lib/udev \ --with-selinux -All options: - --prefix= - Usually /usr, prefix for man pages, include files. - --sysconfdir= - Usually /etc. - --sbindir= - Usually /sbin, the place for udevd and udevadm. - --libexecdir= - Usually /lib/udev, the udev private directory. - --enable-debug - Compile-in verbose debug messages. Usually not needed, - it increases the size of the binaries. - --disable-logging - Disable all logging and compile-out all log strings. This - is not recommended, as it makes it almost impossible to debug - udev on the running system. - --with-selinux - Link against SELinux libraries to set the expected context - for created files. - --disable-rule_generator - Disable persistent network, cdrom naming support. - --disable-hwdb - Disable hardware database support - --disable-udev_acl - Disable local user acl permissions support. - --disable-gudev - Disable Gobject libudev support. - --disable-introspection - Disable Gobject introspection support. - --disable-keymap - Disable keymap fixup support. - --enable-floppy - Enable legacy floppy support. - --enable-edd - Enable disk edd support. - The options used in a RPM spec file usually look like: %configure \ --prefix=%{_prefix} \ diff --git a/Makefile.am b/Makefile.am index e20694f75f..a0c007a3b0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -307,72 +307,6 @@ dist_udevrules_DATA += extras/accelerometer/61-accelerometer.rules # ------------------------------------------------------------------------------ dist_udevrules_DATA += extras/qemu/42-qemu-usb.rules -if ENABLE_RULE_GENERATOR -# ------------------------------------------------------------------------------ -# rule_generator - persistent network and optical device rule generator -# ------------------------------------------------------------------------------ -dist_libexec_SCRIPTS += \ - extras/rule_generator/write_cd_rules \ - extras/rule_generator/write_net_rules - -udevhomedir = $(libexecdir) -dist_udevhome_DATA = extras/rule_generator/rule_generator.functions - -dist_udevrules_DATA += \ - extras/rule_generator/75-cd-aliases-generator.rules \ - extras/rule_generator/75-persistent-net-generator.rules -endif - -if ENABLE_MTD_PROBE -# ------------------------------------------------------------------------------ -# mtd_probe - autoloads FTL module for mtd devices -# ------------------------------------------------------------------------------ -extras_mtd_probe_mtd_probe_SOURCES = \ - extras/mtd_probe/mtd_probe.c \ - extras/mtd_probe/mtd_probe.h \ - extras/mtd_probe/probe_smartmedia.c -extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) -dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules -libexec_PROGRAMS += extras/mtd_probe/mtd_probe - -endif - -if ENABLE_HWDB -# ------------------------------------------------------------------------------ -# usb/pci-db - read vendor/device string database -# ------------------------------------------------------------------------------ -extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c -extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB -extras_usb_db_usb_db_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/usb-db/usb-db -dist_udevrules_DATA += \ - rules/rules.d/75-net-description.rules \ - rules/rules.d/75-tty-description.rules \ - rules/rules.d/78-sound-card.rules - -extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c -extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI -extras_usb_db_pci_db_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/usb-db/pci-db -endif - -if ENABLE_UDEV_ACL -# ------------------------------------------------------------------------------ -# udev_acl - apply ACLs for users with local forground sessions -# ------------------------------------------------------------------------------ -extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c -extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) -extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) -dist_udevrules_DATA += extras/udev-acl/70-udev-acl.rules -libexec_PROGRAMS += extras/udev-acl/udev-acl - -udevacl-install-hook: - mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d - ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck - -INSTALL_EXEC_HOOKS += udevacl-install-hook -endif - if ENABLE_GUDEV # ------------------------------------------------------------------------------ # GUdev - libudev gobject interface @@ -518,6 +452,25 @@ INSTALL_EXEC_HOOKS += libgudev-install-move-hook UNINSTALL_EXEC_HOOKS += libgudev-uninstall-move-hook endif +if ENABLE_HWDB +# ------------------------------------------------------------------------------ +# usb/pci-db - read vendor/device string database +# ------------------------------------------------------------------------------ +extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c +extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB +extras_usb_db_usb_db_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/usb-db/usb-db +dist_udevrules_DATA += \ + rules/rules.d/75-net-description.rules \ + rules/rules.d/75-tty-description.rules \ + rules/rules.d/78-sound-card.rules + +extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c +extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI +extras_usb_db_pci_db_LDADD = libudev/libudev-private.la +libexec_PROGRAMS += extras/usb-db/pci-db +endif + if ENABLE_KEYMAP # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys @@ -623,6 +576,52 @@ keymaps-distcheck-hook: extras/keymap/keys.txt DISTCHECK_HOOKS += keymaps-distcheck-hook endif +if ENABLE_MTD_PROBE +# ------------------------------------------------------------------------------ +# mtd_probe - autoloads FTL module for mtd devices +# ------------------------------------------------------------------------------ +extras_mtd_probe_mtd_probe_SOURCES = \ + extras/mtd_probe/mtd_probe.c \ + extras/mtd_probe/mtd_probe.h \ + extras/mtd_probe/probe_smartmedia.c +extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules +libexec_PROGRAMS += extras/mtd_probe/mtd_probe +endif + +if ENABLE_RULE_GENERATOR +# ------------------------------------------------------------------------------ +# rule_generator - persistent network and optical device rule generator +# ------------------------------------------------------------------------------ +dist_libexec_SCRIPTS += \ + extras/rule_generator/write_cd_rules \ + extras/rule_generator/write_net_rules + +udevhomedir = $(libexecdir) +dist_udevhome_DATA = extras/rule_generator/rule_generator.functions + +dist_udevrules_DATA += \ + extras/rule_generator/75-cd-aliases-generator.rules \ + extras/rule_generator/75-persistent-net-generator.rules +endif + +if ENABLE_UDEV_ACL +# ------------------------------------------------------------------------------ +# udev_acl - apply ACLs for users with local forground sessions +# ------------------------------------------------------------------------------ +extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c +extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) +extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) +dist_udevrules_DATA += extras/udev-acl/70-udev-acl.rules +libexec_PROGRAMS += extras/udev-acl/udev-acl + +udevacl-install-hook: + mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d + ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck + +INSTALL_EXEC_HOOKS += udevacl-install-hook +endif + if ENABLE_FLOPPY # ------------------------------------------------------------------------------ # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) diff --git a/README b/README index f856370685..148217d16a 100644 --- a/README +++ b/README @@ -16,7 +16,7 @@ by udevadm and libudev. Tools and rules in /lib/udev and the entire contents of the /dev/.udev directory are private to udev and do change whenever needed. Requirements: - - Version 2.6.32 of the Linux kernel with sysfs, procfs, signalfd, inotify, + - Version 2.6.34 of the Linux kernel with sysfs, procfs, signalfd, inotify, unix domain sockets, networking and hotplug enabled - Some architectures might need a later kernel, that supports accept4(), diff --git a/TODO b/TODO index 6612be9722..2da73a0b61 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,7 @@ + - bluetooth input + + - have a $attrs{} ? + - test (now fixed) /dev/tape/ links - /run/udev/control socket diff --git a/configure.ac b/configure.ac index fe9684611b..dd071a9c0d 100644 --- a/configure.ac +++ b/configure.ac @@ -79,20 +79,30 @@ fi AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) # ------------------------------------------------------------------------------ -# rule_generator - persistent network and optical device rule generator +# GUdev - libudev gobject interface # ------------------------------------------------------------------------------ -AC_ARG_ENABLE([rule_generator], - AS_HELP_STRING([--disable-rule_generator], [disable persistent network, cdrom support]), - [], [enable_rule_generator=yes]) -AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = xyes]) +AC_ARG_ENABLE([gudev], + AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support]), + [], [enable_gudev=yes]) +if test "x$enable_gudev" = xyes; then + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) +fi -# ------------------------------------------------------------------------------ -# mtd_probe - autoloads FTL module for mtd devices -# ------------------------------------------------------------------------------ -AC_ARG_ENABLE([mtd_probe], - AS_HELP_STRING([--disable-mtd_probe], [disable MTD support]), - [], [enable_mtd_probe=yes]) -AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = xyes]) +AC_ARG_ENABLE([introspection], + AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), + [], [enable_introspection=yes]) +if test "x$enable_introspection" = xyes; then + PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) + AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) + AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) + AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) + AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) + AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) + AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) +fi +AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) + +AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = xyes]) # ------------------------------------------------------------------------------ # usb/pci-db - read vendor/device string database @@ -134,32 +144,6 @@ if test "x$enable_hwdb" = xyes; then fi AM_CONDITIONAL([ENABLE_HWDB], [test "x$enable_hwdb" = xyes]) -# ------------------------------------------------------------------------------ -# GUdev - libudev gobject interface -# ------------------------------------------------------------------------------ -AC_ARG_ENABLE([gudev], - AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support]), - [], [enable_gudev=yes]) -if test "x$enable_gudev" = xyes; then - PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) -fi - -AC_ARG_ENABLE([introspection], - AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), - [], [enable_introspection=yes]) -if test "x$enable_introspection" = xyes; then - PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) - AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) - AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) - AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) - AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) - AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) - AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) -fi -AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) - -AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = xyes]) - # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ @@ -177,6 +161,22 @@ if test "x$enable_keymap" = xyes; then fi AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = xyes]) +# ------------------------------------------------------------------------------ +# mtd_probe - autoloads FTL module for mtd devices +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([mtd_probe], + AS_HELP_STRING([--disable-mtd_probe], [disable MTD support]), + [], [enable_mtd_probe=yes]) +AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = xyes]) + +# ------------------------------------------------------------------------------ +# rule_generator - persistent network and optical device rule generator +# ------------------------------------------------------------------------------ +AC_ARG_ENABLE([rule_generator], + AS_HELP_STRING([--disable-rule_generator], [disable persistent network, cdrom support]), + [], [enable_rule_generator=yes]) +AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = xyes]) + # ------------------------------------------------------------------------------ # udev_acl - apply ACLs for users with local forground sessions # ------------------------------------------------------------------------------ @@ -233,36 +233,32 @@ AC_MSG_RESULT([ libdir: ${libdir} rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} - datarootdir: ${datarootdir} mandir: ${mandir} includedir: ${includedir} - include_prefix: ${INCLUDE_PREFIX} - systemdsystemunitdir: ${systemdsystemunitdir} - - logging: ${enable_logging} - debug: ${enable_debug} - selinux: ${with_selinux} + firmware path: ${FIRMWARE_PATH} compiler: ${CC} cflags: ${CFLAGS} ldflags: ${LDFLAGS} + xsltproc: ${XSLTPROC} + gperf: ${GPERF} + + logging: ${enable_logging} + debug: ${enable_debug} + selinux: ${with_selinux} - rule_generator: ${enable_rule_generator} - hwdb: ${enable_hwdb} - udev_acl: ${enable_udev_acl} gudev: ${enable_gudev} gintrospection: ${enable_introspection} keymap: ${enable_keymap} + hwdb: ${enable_hwdb} + usb.ids: ${USB_DATABASE} + pci.ids: ${PCI_DATABASE} + mtd_probe: ${enable_mtd_probe} + rule_generator: ${enable_rule_generator} + udev_acl: ${enable_udev_acl} floppy: ${enable_floppy} edd: ${enable_edd} - - usb.ids: ${USB_DATABASE} - pci.ids: ${PCI_DATABASE} - firmware path: ${FIRMWARE_PATH} - - xsltproc: ${XSLTPROC} - gperf: ${GPERF} ]) -- cgit v1.2.3-54-g00ecf From c49df20758e0f22778cfc93b598f2929f4c86272 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Jul 2011 00:05:38 +0200 Subject: rules: input - do not create (broken) links for bluetooth devices --- rules/rules.d/60-persistent-input.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index 7230e4b312..65a6381fad 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -2,6 +2,7 @@ ACTION=="remove", GOTO="persistent_input_end" SUBSYSTEM!="input", GOTO="persistent_input_end" +SUBSYSTEMS=="bluetooth", GOTO="persistent_input_end" ENV{ID_INPUT}=="", IMPORT{program}="input_id %p" SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{program}="usb_id --export %p" -- cgit v1.2.3-54-g00ecf From edb0d9d8d7a45609c01e6683ad235a5908ce7d4e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Jul 2011 00:20:00 +0200 Subject: rules: serial - do not export ID_PORT, use ID_USB_INTERFACE_NUM --- rules/rules.d/60-persistent-serial.rules | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules index 3e1a56550a..90816be679 100644 --- a/rules/rules.d/60-persistent-serial.rules +++ b/rules/rules.d/60-persistent-serial.rules @@ -4,17 +4,17 @@ ACTION=="remove", GOTO="persistent_serial_end" SUBSYSTEM!="tty", GOTO="persistent_serial_end" KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="persistent_serial_end" -SUBSYSTEMS=="usb-serial", ENV{ID_PORT}="$attr{port_number}" +SUBSYSTEMS=="usb-serial", ENV{.ID_PORT}="$attr{port_number}" IMPORT="path_id %p" -ENV{ID_PATH}=="?*", ENV{ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}" -ENV{ID_PATH}=="?*", ENV{ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{ID_PORT}" +ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}" +ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{.ID_PORT}" IMPORT="usb_id --export %p" ENV{ID_SERIAL}=="", GOTO="persistent_serial_end" -SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}" -ENV{ID_IFACE}=="", GOTO="persistent_serial_end" -ENV{ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}" -ENV{ID_PORT}=="?*", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_IFACE}-port$env{ID_PORT}" +SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACE_NUM}="$attr{bInterfaceNumber}" +ENV{ID_USB_INTERFACE_NUM}=="", GOTO="persistent_serial_end" +ENV{.ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}" +ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}-port$env{.ID_PORT}" LABEL="persistent_serial_end" -- cgit v1.2.3-54-g00ecf From 2ba5c37829c657a1bce3f3775fbaaf2131c1070b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Jul 2011 00:21:07 +0200 Subject: rules: sound - instead of ID_IFACE use standard ID_USB_INTERFACE_NUM --- rules/rules.d/60-persistent-alsa.rules | 5 ++--- rules/rules.d/78-sound-card.rules | 6 ++---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/rules/rules.d/60-persistent-alsa.rules b/rules/rules.d/60-persistent-alsa.rules index 39a365221e..748c1bae59 100644 --- a/rules/rules.d/60-persistent-alsa.rules +++ b/rules/rules.d/60-persistent-alsa.rules @@ -5,9 +5,8 @@ SUBSYSTEM!="sound", GOTO="persistent_alsa_end" KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end" SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" -SUBSYSTEMS=="usb", ENV{ID_IFACE}="$attr{bInterfaceNumber}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" ENV{ID_PATH}=="", IMPORT{program}="path_id %p" ENV{ID_PATH}=="?*", SYMLINK+="snd/by-path/$env{ID_PATH}" diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules index 7b821d4723..1c36aeb432 100644 --- a/rules/rules.d/78-sound-card.rules +++ b/rules/rules.d/78-sound-card.rules @@ -39,8 +39,6 @@ ENV{SOUND_INITIALIZED}="1" SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" SUBSYSTEMS=="usb", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" -SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" -SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}!="", ENV{ID_IFACE}="$attr{bInterfaceNumber}" SUBSYSTEMS=="usb", GOTO="skip_pci" SUBSYSTEMS=="pci", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="pci-db %p" @@ -48,8 +46,8 @@ SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_ LABEL="skip_pci" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_IFACE}-$attr{id}" -ENV{ID_SERIAL}=="?*", ENV{ID_IFACE}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$attr{id}" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}-$attr{id}" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$attr{id}" ENV{ID_PATH}=="", IMPORT{program}="path_id %p/controlC%n" -- cgit v1.2.3-54-g00ecf From 4da9fcb366b32f4c50464ce76099379722ab9c9f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 20 Jul 2011 00:39:58 +0200 Subject: keymap: do not run usb_id for bluetooth devices --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 98db471815..39d2322020 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -8,6 +8,7 @@ ACTION=="remove", GOTO="keyboard_end" SUBSYSTEM!="input", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" +SUBSYSTEMS=="bluetooth", GOTO="keyboard_end" SUBSYSTEMS=="usb", ENV{ID_VENDOR}=="", IMPORT{program}="usb_id --export %p" SUBSYSTEMS=="usb", GOTO="keyboard_usbcheck" -- cgit v1.2.3-54-g00ecf From 2614261e4dcbf0f5e342a274694a243e9f644dc1 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 20 Jul 2011 12:49:40 +0200 Subject: keymap: Only run on key devices Skip event devices which don't have ID_INPUT_KEY set, to avoid running the long list of rules more than necessary. Note that we don't limit ourselves to ID_INPUT_KEYBOARD, as we might want to fix extra buttons on e. g. fancy mouses or tablet screens, too. --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 39d2322020..6f1b99555e 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -6,8 +6,8 @@ # pairs. ACTION=="remove", GOTO="keyboard_end" -SUBSYSTEM!="input", GOTO="keyboard_end" KERNEL!="event*", GOTO="keyboard_end" +ENV{ID_INPUT_KEY}=="", GOTO="keyboard_end" SUBSYSTEMS=="bluetooth", GOTO="keyboard_end" SUBSYSTEMS=="usb", ENV{ID_VENDOR}=="", IMPORT{program}="usb_id --export %p" -- cgit v1.2.3-54-g00ecf From 05b74d8563116dc962e852c5a40f5ee7dc1503a4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Jul 2011 23:01:28 +0200 Subject: udevadm: trigger --type=failed - log deprecation warning --- udev/udevadm-trigger.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index 610cf5e9c1..d94c9568d1 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -229,6 +229,7 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) switch (device_type) { case TYPE_FAILED: + err(udev, "--type=failed is deprecated and will be removed from a future udev release.\n"); scan_failed(udev_enumerate); exec_list(udev_enumerate, action); goto exit; -- cgit v1.2.3-54-g00ecf From 2dd7eed2eb4f0282c5afbddf777f6c313842890e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Jul 2011 23:16:43 +0200 Subject: udevd: debug - put timestamp in [] --- udev/udevd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index 968b41667e..2fa2a6a48a 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -59,7 +59,7 @@ static void log_fn(struct udev *udev, int priority, vsnprintf(buf, sizeof(buf), format, args); clock_gettime(CLOCK_MONOTONIC, &ts); - fprintf(stderr, "%llu.%06u [%u] %s: %s", + fprintf(stderr, "[%llu.%06u] [%u] %s: %s", (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, (int) getpid(), fn, buf); } else { -- cgit v1.2.3-54-g00ecf From ad667dff51711fed763a23283d973486de3cd6b5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 30 Jul 2011 23:31:54 +0200 Subject: release 173 --- ChangeLog | 30 ++++++++++++++++++++++++++++++ NEWS | 9 +++++++++ configure.ac | 2 +- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0d40475866..ea833c0265 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,33 @@ +Summary of changes from v172 to v173 +============================================ + +Allin Cottrell (1): + configure: allow to disable mtd_probe + +Kay Sievers (15): + make: fix 'make tar-sync' + udevd: use 'uptime' in debug timestamp + udevd: fix (recently) broken static node permission setting + rules: mount fuse filesystem only 'add' + udevadm: move udevadm command descriptions into their files + udev-acl: skip ACLs when systemd is running, disable by default + do not delete database when renaming netif, the db name does not change anymore + do not allow kernel properties to be set by udev rules + configure: reorder options + rules: input - do not create (broken) links for bluetooth devices + rules: serial - do not export ID_PORT, use ID_USB_INTERFACE_NUM + rules: sound - instead of ID_IFACE use standard ID_USB_INTERFACE_NUM + keymap: do not run usb_id for bluetooth devices + udevadm: trigger --type=failed - log deprecation warning + udevd: debug - put timestamp in [] + +Martin Pitt (4): + gudev: Ship JavaScript examples + scsi_id: Ship README + Remove obsolete extras/scsi_id/scsi_id.config + keymap: Only run on key devices + + Summary of changes from v171 to v172 ============================================ diff --git a/NEWS b/NEWS index 75e6aa0b5e..aa424b0730 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +udev 173 +======== +Bugfixes. + +The udev-acl extra is no longer enabled by default now. To enable it, +--enable-udev_acl needs to be given at ./configure time. On systemd +systems, the udev-acl rules prevent it from running as the functionality +has moved to systemd. + udev 172 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index dd071a9c0d..bc8e6fbac4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [172], + [173], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From ce0119d98af6d8306f0877bd30adda945d1a3621 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 31 Jul 2011 02:59:25 +0200 Subject: gtk-doc: delete empty files --- extras/gudev/docs/gudev-overrides.txt | 0 libudev/docs/libudev-overrides.txt | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 extras/gudev/docs/gudev-overrides.txt delete mode 100644 libudev/docs/libudev-overrides.txt diff --git a/extras/gudev/docs/gudev-overrides.txt b/extras/gudev/docs/gudev-overrides.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libudev/docs/libudev-overrides.txt b/libudev/docs/libudev-overrides.txt deleted file mode 100644 index e69de29bb2..0000000000 -- cgit v1.2.3-54-g00ecf From 869c9031608f0796bb4363d5de5db058fe96fedd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Aug 2011 22:59:58 +0200 Subject: libudev: list - use binary search for list lookup --- Makefile.am | 2 +- TODO | 2 +- extras/collect/collect.c | 2 +- libudev/libudev-device.c | 63 +++++++------- libudev/libudev-enumerate.c | 83 ++++++++---------- libudev/libudev-list.c | 199 ++++++++++++++++++++++++++++---------------- libudev/libudev-monitor.c | 22 +++-- libudev/libudev-private.h | 28 ++++--- libudev/libudev-queue.c | 20 ++--- libudev/libudev.c | 10 +-- udev/udev-event.c | 7 +- udev/udev-rules.c | 15 ++-- udev/udev.h | 2 +- udev/udevadm-monitor.c | 16 ++-- udev/udevd.c | 10 +-- 15 files changed, 263 insertions(+), 218 deletions(-) diff --git a/Makefile.am b/Makefile.am index a0c007a3b0..7686ca74e1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,7 +42,7 @@ dist_libexec_SCRIPTS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=12 -LIBUDEV_REVISION=0 +LIBUDEV_REVISION=1 LIBUDEV_AGE=12 SUBDIRS += libudev/docs diff --git a/TODO b/TODO index 2da73a0b61..85e4d9b239 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ - - bluetooth input + - sticky bit for 'dead' pre-created devnodes - have a $attrs{} ? diff --git a/extras/collect/collect.c b/extras/collect/collect.c index 17b3df372f..f78f3b778e 100644 --- a/extras/collect/collect.c +++ b/extras/collect/collect.c @@ -400,7 +400,7 @@ int main(int argc, char **argv) goto exit; } - udev_list_init(&bunch); + udev_list_node_init(&bunch); if (debug) fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 025527bb8a..76354dc7a7 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -62,11 +62,11 @@ struct udev_device { char **envp; char *monitor_buf; size_t monitor_buf_len; - struct udev_list_node devlinks_list; - struct udev_list_node properties_list; - struct udev_list_node sysattr_value_list; - struct udev_list_node sysattr_list; - struct udev_list_node tags_list; + struct udev_list devlinks_list; + struct udev_list properties_list; + struct udev_list sysattr_value_list; + struct udev_list sysattr_list; + struct udev_list tags_list; unsigned long long int seqnum; unsigned long long int usec_initialized; int timeout; @@ -357,7 +357,7 @@ struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device udev_list_entry_delete(list_entry); return NULL; } - return udev_list_entry_add(udev_device->udev, &udev_device->properties_list, key, value, UDEV_LIST_UNIQUE); + return udev_list_entry_add(&udev_device->properties_list, key, value); } static struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) @@ -489,7 +489,7 @@ UDEV_EXPORT const char *udev_device_get_property_value(struct udev_device *udev_ return NULL; list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); + list_entry = udev_list_entry_get_by_name(list_entry, key); return udev_list_entry_get_value(list_entry); } @@ -628,11 +628,11 @@ struct udev_device *udev_device_new(struct udev *udev) return NULL; udev_device->refcount = 1; udev_device->udev = udev; - udev_list_init(&udev_device->devlinks_list); - udev_list_init(&udev_device->properties_list); - udev_list_init(&udev_device->sysattr_value_list); - udev_list_init(&udev_device->sysattr_list); - udev_list_init(&udev_device->tags_list); + udev_list_init(udev, &udev_device->devlinks_list, true); + udev_list_init(udev, &udev_device->properties_list, true); + udev_list_init(udev, &udev_device->sysattr_value_list, true); + udev_list_init(udev, &udev_device->sysattr_list, false); + udev_list_init(udev, &udev_device->tags_list, true); udev_device->timeout = -1; udev_device->watch_handle = -1; /* copy global properties */ @@ -1082,11 +1082,11 @@ UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device) free(udev_device->devnode); free(udev_device->subsystem); free(udev_device->devtype); - udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); - udev_list_cleanup_entries(udev_device->udev, &udev_device->properties_list); - udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_value_list); - udev_list_cleanup_entries(udev_device->udev, &udev_device->sysattr_list); - udev_list_cleanup_entries(udev_device->udev, &udev_device->tags_list); + udev_list_cleanup(&udev_device->devlinks_list); + udev_list_cleanup(&udev_device->properties_list); + udev_list_cleanup(&udev_device->sysattr_value_list); + udev_list_cleanup(&udev_device->sysattr_list); + udev_list_cleanup(&udev_device->tags_list); free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); @@ -1212,7 +1212,7 @@ UDEV_EXPORT struct udev_list_entry *udev_device_get_devlinks_list_entry(struct u void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) { udev_device->devlinks_uptodate = false; - udev_list_cleanup_entries(udev_device->udev, &udev_device->devlinks_list); + udev_list_cleanup(&udev_device->devlinks_list); } /** @@ -1351,18 +1351,18 @@ UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_d return NULL; /* look for possibly already cached result */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_device->sysattr_value_list)) { - if (strcmp(udev_list_entry_get_name(list_entry), sysattr) == 0) { - dbg(udev_device->udev, "got '%s' (%s) from cache\n", - sysattr, udev_list_entry_get_value(list_entry)); - return udev_list_entry_get_value(list_entry); - } + list_entry = udev_list_get_entry(&udev_device->sysattr_value_list); + list_entry = udev_list_entry_get_by_name(list_entry, sysattr); + if (list_entry != NULL) { + dbg(udev_device->udev, "got '%s' (%s) from cache\n", + sysattr, udev_list_entry_get_value(list_entry)); + return udev_list_entry_get_value(list_entry); } util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); if (lstat(path, &statbuf) != 0) { dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); - udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, NULL, 0); + udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, NULL); goto out; } @@ -1386,7 +1386,7 @@ UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_d if (pos != NULL) { pos = &pos[1]; dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, pos, 0); + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, pos); val = udev_list_entry_get_value(list_entry); } @@ -1418,7 +1418,7 @@ UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_d value[size] = '\0'; util_remove_trailing_chars(value, '\n'); dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->sysattr_value_list, sysattr, value, 0); + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); val = udev_list_entry_get_value(list_entry); out: return val; @@ -1456,8 +1456,7 @@ static int udev_device_sysattr_list_read(struct udev_device *udev_device) if ((statbuf.st_mode & S_IRUSR) == 0) continue; - udev_list_entry_add(udev_device->udev, &udev_device->sysattr_list, - dent->d_name, NULL, 0); + udev_list_entry_add(&udev_device->sysattr_list, dent->d_name, NULL); num++; } @@ -1543,7 +1542,7 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink struct udev_list_entry *list_entry; udev_device->devlinks_uptodate = false; - list_entry = udev_list_entry_add(udev_device->udev, &udev_device->devlinks_list, devlink, NULL, UDEV_LIST_UNIQUE); + list_entry = udev_list_entry_add(&udev_device->devlinks_list, devlink, NULL); if (list_entry == NULL) return -ENOMEM; if (unique) @@ -1615,7 +1614,7 @@ int udev_device_add_tag(struct udev_device *udev_device, const char *tag) if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) return -EINVAL; udev_device->tags_uptodate = false; - if (udev_list_entry_add(udev_device->udev, &udev_device->tags_list, tag, NULL, UDEV_LIST_UNIQUE) != NULL) + if (udev_list_entry_add(&udev_device->tags_list, tag, NULL) != NULL) return 0; return -ENOMEM; } @@ -1623,7 +1622,7 @@ int udev_device_add_tag(struct udev_device *udev_device, const char *tag) void udev_device_cleanup_tags_list(struct udev_device *udev_device) { udev_device->tags_uptodate = false; - udev_list_cleanup_entries(udev_device->udev, &udev_device->tags_list); + udev_list_cleanup(&udev_device->tags_list); } /** diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c index b332ecdae1..f14d5c8f57 100644 --- a/libudev/libudev-enumerate.c +++ b/libudev/libudev-enumerate.c @@ -45,15 +45,15 @@ struct syspath { struct udev_enumerate { struct udev *udev; int refcount; - struct udev_list_node sysattr_match_list; - struct udev_list_node sysattr_nomatch_list; - struct udev_list_node subsystem_match_list; - struct udev_list_node subsystem_nomatch_list; - struct udev_list_node sysname_match_list; - struct udev_list_node properties_match_list; - struct udev_list_node tags_match_list; + struct udev_list sysattr_match_list; + struct udev_list sysattr_nomatch_list; + struct udev_list subsystem_match_list; + struct udev_list subsystem_nomatch_list; + struct udev_list sysname_match_list; + struct udev_list properties_match_list; + struct udev_list tags_match_list; struct udev_device *parent_match; - struct udev_list_node devices_list; + struct udev_list devices_list; struct syspath *devices; unsigned int devices_cur; unsigned int devices_max; @@ -76,14 +76,14 @@ UDEV_EXPORT struct udev_enumerate *udev_enumerate_new(struct udev *udev) return NULL; udev_enumerate->refcount = 1; udev_enumerate->udev = udev; - udev_list_init(&udev_enumerate->sysattr_match_list); - udev_list_init(&udev_enumerate->sysattr_nomatch_list); - udev_list_init(&udev_enumerate->subsystem_match_list); - udev_list_init(&udev_enumerate->subsystem_nomatch_list); - udev_list_init(&udev_enumerate->sysname_match_list); - udev_list_init(&udev_enumerate->properties_match_list); - udev_list_init(&udev_enumerate->tags_match_list); - udev_list_init(&udev_enumerate->devices_list); + udev_list_init(udev, &udev_enumerate->sysattr_match_list, false); + udev_list_init(udev, &udev_enumerate->sysattr_nomatch_list, false); + udev_list_init(udev, &udev_enumerate->subsystem_match_list, true); + udev_list_init(udev, &udev_enumerate->subsystem_nomatch_list, true); + udev_list_init(udev, &udev_enumerate->sysname_match_list, true); + udev_list_init(udev, &udev_enumerate->properties_match_list, false); + udev_list_init(udev, &udev_enumerate->tags_match_list, true); + udev_list_init(udev, &udev_enumerate->devices_list, false); return udev_enumerate; } @@ -119,15 +119,15 @@ UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) udev_enumerate->refcount--; if (udev_enumerate->refcount > 0) return; - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysattr_nomatch_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->subsystem_nomatch_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->sysname_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->properties_match_list); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->tags_match_list); + udev_list_cleanup(&udev_enumerate->sysattr_match_list); + udev_list_cleanup(&udev_enumerate->sysattr_nomatch_list); + udev_list_cleanup(&udev_enumerate->subsystem_match_list); + udev_list_cleanup(&udev_enumerate->subsystem_nomatch_list); + udev_list_cleanup(&udev_enumerate->sysname_match_list); + udev_list_cleanup(&udev_enumerate->properties_match_list); + udev_list_cleanup(&udev_enumerate->tags_match_list); udev_device_unref(udev_enumerate->parent_match); - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); + udev_list_cleanup(&udev_enumerate->devices_list); for (i = 0; i < udev_enumerate->devices_cur; i++) free(udev_enumerate->devices[i].syspath); free(udev_enumerate->devices); @@ -259,7 +259,7 @@ UDEV_EXPORT struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_en struct syspath *prev = NULL, *move_later = NULL; size_t move_later_prefix = 0; - udev_list_cleanup_entries(udev_enumerate->udev, &udev_enumerate->devices_list); + udev_list_cleanup(&udev_enumerate->devices_list); qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); max = udev_enumerate->devices_cur; @@ -296,25 +296,21 @@ UDEV_EXPORT struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_en if (move_later && strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) { - udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - move_later->syspath, NULL, 0); + udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); move_later = NULL; } - udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - entry->syspath, NULL, 0); + udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); } if (move_later) - udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - move_later->syspath, NULL, 0); + udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); /* add and cleanup delayed devices from end of list */ for (i = max; i < udev_enumerate->devices_cur; i++) { struct syspath *entry = &udev_enumerate->devices[i]; - udev_list_entry_add(udev_enumerate->udev, &udev_enumerate->devices_list, - entry->syspath, NULL, 0); + udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); free(entry->syspath); } udev_enumerate->devices_cur = max; @@ -337,8 +333,7 @@ UDEV_EXPORT int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_e return -EINVAL; if (subsystem == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_match_list, subsystem, NULL, UDEV_LIST_UNIQUE) == NULL) + if (udev_list_entry_add(&udev_enumerate->subsystem_match_list, subsystem, NULL) == NULL) return -ENOMEM; return 0; } @@ -356,8 +351,7 @@ UDEV_EXPORT int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev return -EINVAL; if (subsystem == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->subsystem_nomatch_list, subsystem, NULL, UDEV_LIST_UNIQUE) == NULL) + if (udev_list_entry_add(&udev_enumerate->subsystem_nomatch_list, subsystem, NULL) == NULL) return -ENOMEM; return 0; } @@ -376,8 +370,7 @@ UDEV_EXPORT int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enu return -EINVAL; if (sysattr == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_match_list, sysattr, value, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->sysattr_match_list, sysattr, value) == NULL) return -ENOMEM; return 0; } @@ -396,8 +389,7 @@ UDEV_EXPORT int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_e return -EINVAL; if (sysattr == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysattr_nomatch_list, sysattr, value, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->sysattr_nomatch_list, sysattr, value) == NULL) return -ENOMEM; return 0; } @@ -436,8 +428,7 @@ UDEV_EXPORT int udev_enumerate_add_match_property(struct udev_enumerate *udev_en return -EINVAL; if (property == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->properties_match_list, property, value, 0) == NULL) + if (udev_list_entry_add(&udev_enumerate->properties_match_list, property, value) == NULL) return -ENOMEM; return 0; } @@ -455,8 +446,7 @@ UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumera return -EINVAL; if (tag == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->tags_match_list, tag, NULL, UDEV_LIST_UNIQUE) == NULL) + if (udev_list_entry_add(&udev_enumerate->tags_match_list, tag, NULL) == NULL) return -ENOMEM; return 0; } @@ -525,8 +515,7 @@ UDEV_EXPORT int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enu return -EINVAL; if (sysname == NULL) return 0; - if (udev_list_entry_add(udev_enumerate_get_udev(udev_enumerate), - &udev_enumerate->sysname_match_list, sysname, NULL, UDEV_LIST_UNIQUE) == NULL) + if (udev_list_entry_add(&udev_enumerate->sysname_match_list, sysname, NULL) == NULL) return -ENOMEM; return 0; } diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c index e828a4e4c6..295ee682bc 100644 --- a/libudev/libudev-list.c +++ b/libudev/libudev-list.c @@ -34,21 +34,20 @@ */ struct udev_list_entry { struct udev_list_node node; - struct udev *udev; - struct udev_list_node *list; + struct udev_list *list; char *name; char *value; int num; }; /* the list's head points to itself if empty */ -void udev_list_init(struct udev_list_node *list) +void udev_list_node_init(struct udev_list_node *list) { list->next = list; list->prev = list; } -int udev_list_is_empty(struct udev_list_node *list) +int udev_list_node_is_empty(struct udev_list_node *list) { return list->next == list; } @@ -90,19 +89,20 @@ static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) return (struct udev_list_entry *)list; } -/* insert entry into a list as the last element */ -void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list) +void udev_list_init(struct udev *udev, struct udev_list *list, bool unique) { - /* inserting before the list head make the node the last node in the list */ - udev_list_node_insert_between(&new->node, list->prev, list); - new->list = list; + memset(list, 0x00, sizeof(struct udev_list)); + list->udev = udev; + list->unique = unique; + udev_list_node_init(&list->node); } -/* remove entry from a list */ -void udev_list_entry_remove(struct udev_list_entry *entry) +/* insert entry into a list as the last element */ +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) { - udev_list_node_remove(&entry->node); - entry->list = NULL; + /* inserting before the list head make the node the last node in the list */ + udev_list_node_insert_between(&new->node, list->node.prev, &list->node); + new->list = list; } /* insert entry into a list, before a given existing entry */ @@ -112,90 +112,144 @@ void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list new->list = entry->list; } -struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, - const char *name, const char *value, - unsigned int flags) +/* binary search in sorted array */ +static int list_search(struct udev_list *list, const char *name) { - struct udev_list_entry *entry_loop = NULL; - struct udev_list_entry *entry_new; - - if (flags & UDEV_LIST_UNIQUE) { - udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { - if (strcmp(entry_loop->name, name) == 0) { - dbg(udev, "'%s' is already in the list\n", name); - free(entry_loop->value); - if (value == NULL) { - entry_loop->value = NULL; - dbg(udev, "'%s' value unset\n", name); - return entry_loop; - } - entry_loop->value = strdup(value); - if (entry_loop->value == NULL) - return NULL; - dbg(udev, "'%s' value replaced with '%s'\n", name, value); - return entry_loop; - } - } + unsigned int first, last; + + first = 0; + last = list->entries_cur; + while (first < last) { + unsigned int i; + int cmp; + + i = (first + last)/2; + cmp = strcmp(name, list->entries[i]->name); + if (cmp < 0) + last = i; + else if (cmp > 0) + first = i+1; + else + return i; } - if (flags & UDEV_LIST_SORT) { - udev_list_entry_foreach(entry_loop, udev_list_get_entry(list)) { - if (strcmp(entry_loop->name, name) > 0) - break; + /* not found, return negative insertion-index+1 */ + return -(first+1); +} + +struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value) +{ + struct udev_list_entry *entry; + int i = 0; + + if (list->unique) { + /* lookup existing name or insertion-index */ + i = list_search(list, name); + if (i >= 0) { + entry = list->entries[i]; + + dbg(list->udev, "'%s' is already in the list\n", name); + free(entry->value); + if (value == NULL) { + entry->value = NULL; + dbg(list->udev, "'%s' value unset\n", name); + return entry; + } + entry->value = strdup(value); + if (entry->value == NULL) + return NULL; + dbg(list->udev, "'%s' value replaced with '%s'\n", name, value); + return entry; } } - entry_new = malloc(sizeof(struct udev_list_entry)); - if (entry_new == NULL) + /* add new name */ + entry = calloc(1, sizeof(struct udev_list_entry)); + if (entry == NULL) return NULL; - memset(entry_new, 0x00, sizeof(struct udev_list_entry)); - entry_new->udev = udev; - entry_new->name = strdup(name); - if (entry_new->name == NULL) { - free(entry_new); + entry->name = strdup(name); + if (entry->name == NULL) { + free(entry); return NULL; } - if (value != NULL) { - entry_new->value = strdup(value); - if (entry_new->value == NULL) { - free(entry_new->name); - free(entry_new); + entry->value = strdup(value); + if (entry->value == NULL) { + free(entry->name); + free(entry); return NULL; } } + udev_list_entry_append(entry, list); + + if (list->unique) { + /* allocate or enlarge sorted array if needed */ + if (list->entries_cur >= list->entries_max) { + unsigned int add; + + add = list->entries_max; + if (add < 1) + add = 64; + list->entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *)); + if (list->entries == NULL) { + free(entry->name); + free(entry->value); + return NULL; + } + list->entries_max += add; + } - if (entry_loop != NULL) - udev_list_entry_insert_before(entry_new, entry_loop); - else - udev_list_entry_append(entry_new, list); + /* insert into sorted array */ + i = (-i)-1; + memmove(&list->entries[i+1], &list->entries[i], + (list->entries_cur - i) * sizeof(struct udev_list_entry *)); + list->entries[i] = entry; + list->entries_cur++; + } - dbg(udev, "'%s=%s' added\n", entry_new->name, entry_new->value); - return entry_new; + dbg(list->udev, "'%s=%s' added\n", entry->name, entry->value); + return entry; } void udev_list_entry_delete(struct udev_list_entry *entry) { + if (entry->list->entries != NULL) { + int i; + struct udev_list *list = entry->list; + + /* remove entry from sorted array */ + i = list_search(list, entry->name); + if (i >= 0) { + memmove(&list->entries[i], &list->entries[i+1], + ((list->entries_cur-1) - i) * sizeof(struct udev_list_entry *)); + list->entries_cur--; + } + } + udev_list_node_remove(&entry->node); free(entry->name); free(entry->value); free(entry); } -void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *list) +void udev_list_cleanup(struct udev_list *list) { struct udev_list_entry *entry_loop; struct udev_list_entry *entry_tmp; + free(list->entries); + list->entries = NULL; + list->entries_cur = 0; + list->entries_max = 0; udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) udev_list_entry_delete(entry_loop); } -struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list) +struct udev_list_entry *udev_list_get_entry(struct udev_list *list) { - if (udev_list_is_empty(list)) + if (udev_list_node_is_empty(&list->node)) return NULL; - return list_node_to_entry(list->next); + return list_node_to_entry(list->node.next); } /** @@ -212,7 +266,7 @@ UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_next(struct udev_list_en return NULL; next = list_entry->node.next; /* empty list or no more entries */ - if (next == list_entry->list) + if (next == &list_entry->list->node) return NULL; return list_node_to_entry(next); } @@ -226,15 +280,18 @@ UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_next(struct udev_list_en */ UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) { - struct udev_list_entry *entry; + int i; - udev_list_entry_foreach(entry, list_entry) { - if (strcmp(udev_list_entry_get_name(entry), name) == 0) { - dbg(entry->udev, "found '%s=%s'\n", entry->name, entry->value); - return entry; - } - } - return NULL; + if (list_entry == NULL) + return NULL; + + if (!list_entry->list->unique) + return NULL; + + i = list_search(list_entry->list, name); + if (i < 0) + return NULL; + return list_entry->list->entries[i]; } /** diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c index 31dd66827c..f2f39f9582 100644 --- a/libudev/libudev-monitor.c +++ b/libudev/libudev-monitor.c @@ -48,8 +48,8 @@ struct udev_monitor { struct sockaddr_nl snl_destination; struct sockaddr_un sun; socklen_t addrlen; - struct udev_list_node filter_subsystem_list; - struct udev_list_node filter_tag_list; + struct udev_list filter_subsystem_list; + struct udev_list filter_tag_list; bool bound; }; @@ -92,8 +92,8 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) return NULL; udev_monitor->refcount = 1; udev_monitor->udev = udev; - udev_list_init(&udev_monitor->filter_subsystem_list); - udev_list_init(&udev_monitor->filter_tag_list); + udev_list_init(udev, &udev_monitor->filter_subsystem_list, false); + udev_list_init(udev, &udev_monitor->filter_tag_list, true); return udev_monitor; } @@ -483,8 +483,8 @@ UDEV_EXPORT void udev_monitor_unref(struct udev_monitor *udev_monitor) return; if (udev_monitor->sock >= 0) close(udev_monitor->sock); - udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); - udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_tag_list); + udev_list_cleanup(&udev_monitor->filter_subsystem_list); + udev_list_cleanup(&udev_monitor->filter_tag_list); dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); free(udev_monitor); } @@ -647,7 +647,7 @@ retry: /* udev message needs proper version magic */ nlh = (struct udev_monitor_netlink_header *) buf; if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) { - err(udev_monitor->udev, "ignored a message from an invalid release of udevadm (%x != %x)\n", + err(udev_monitor->udev, "unrecognized message signature (%x != %x)\n", nlh->magic, htonl(UDEV_MONITOR_MAGIC)); return NULL; } @@ -830,8 +830,7 @@ UDEV_EXPORT int udev_monitor_filter_add_match_subsystem_devtype(struct udev_moni return -EINVAL; if (subsystem == NULL) return -EINVAL; - if (udev_list_entry_add(udev_monitor->udev, - &udev_monitor->filter_subsystem_list, subsystem, devtype, 0) == NULL) + if (udev_list_entry_add(&udev_monitor->filter_subsystem_list, subsystem, devtype) == NULL) return -ENOMEM; return 0; } @@ -854,8 +853,7 @@ UDEV_EXPORT int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_moni return -EINVAL; if (tag == NULL) return -EINVAL; - if (udev_list_entry_add(udev_monitor->udev, - &udev_monitor->filter_tag_list, tag, NULL, 0) == NULL) + if (udev_list_entry_add(&udev_monitor->filter_tag_list, tag, NULL) == NULL) return -ENOMEM; return 0; } @@ -872,6 +870,6 @@ UDEV_EXPORT int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) { static struct sock_fprog filter = { 0, NULL }; - udev_list_cleanup_entries(udev_monitor->udev, &udev_monitor->filter_subsystem_list); + udev_list_cleanup(&udev_monitor->filter_subsystem_list); return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 0c17c45744..157575c1ff 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -115,17 +115,20 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd); /* libudev-list.c */ -enum udev_list_flags { - UDEV_LIST_NONE = 0, - UDEV_LIST_UNIQUE = 1, - UDEV_LIST_SORT = 1 << 1, -}; struct udev_list_node { struct udev_list_node *next, *prev; }; +struct udev_list { + struct udev *udev; + struct udev_list_node node; + struct udev_list_entry **entries; + unsigned int entries_cur; + unsigned int entries_max; + bool unique; +}; #define UDEV_LIST(list) struct udev_list_node list = { &(list), &(list) } -void udev_list_init(struct udev_list_node *list); -int udev_list_is_empty(struct udev_list_node *list); +void udev_list_node_init(struct udev_list_node *list); +int udev_list_node_is_empty(struct udev_list_node *list); void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list); void udev_list_node_remove(struct udev_list_node *entry); #define udev_list_node_foreach(node, list) \ @@ -136,14 +139,13 @@ void udev_list_node_remove(struct udev_list_node *entry); for (node = (list)->next, tmp = (node)->next; \ node != list; \ node = tmp, tmp = (tmp)->next) -struct udev_list_entry *udev_list_entry_add(struct udev *udev, struct udev_list_node *list, - const char *name, const char *value, unsigned int flags); +void udev_list_init(struct udev *udev, struct udev_list *list, bool unique); +void udev_list_cleanup(struct udev_list *list); +struct udev_list_entry *udev_list_get_entry(struct udev_list *list); +struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value); void udev_list_entry_delete(struct udev_list_entry *entry); -void udev_list_entry_remove(struct udev_list_entry *entry); void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry); -void udev_list_entry_append(struct udev_list_entry *new, struct udev_list_node *list); -void udev_list_cleanup_entries(struct udev *udev, struct udev_list_node *name_list); -struct udev_list_entry *udev_list_get_entry(struct udev_list_node *list); +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list); int udev_list_entry_get_num(struct udev_list_entry *list_entry); void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num); #define udev_list_entry_foreach_safe(entry, tmp, first) \ diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index 73e7fb23aa..744696df2b 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -42,8 +42,8 @@ struct udev_queue { struct udev *udev; int refcount; - struct udev_list_node queue_list; - struct udev_list_node failed_list; + struct udev_list queue_list; + struct udev_list failed_list; }; /** @@ -67,8 +67,8 @@ UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev) return NULL; udev_queue->refcount = 1; udev_queue->udev = udev; - udev_list_init(&udev_queue->queue_list); - udev_list_init(&udev_queue->failed_list); + udev_list_init(udev, &udev_queue->queue_list, false); + udev_list_init(udev, &udev_queue->failed_list, false); return udev_queue; } @@ -102,8 +102,8 @@ UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue) udev_queue->refcount--; if (udev_queue->refcount > 0) return; - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); + udev_list_cleanup(&udev_queue->queue_list); + udev_list_cleanup(&udev_queue->failed_list); free(udev_queue); } @@ -429,7 +429,7 @@ UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev if (udev_queue == NULL) return NULL; - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->queue_list); + udev_list_cleanup(&udev_queue->queue_list); queue_file = open_queue_file(udev_queue, &seqnum); if (queue_file == NULL) @@ -454,7 +454,7 @@ UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev break; if (len > 0) { - udev_list_entry_add(udev_queue->udev, &udev_queue->queue_list, syspath, seqnum_str, 0); + udev_list_entry_add(&udev_queue->queue_list, syspath, seqnum_str); } else { udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { @@ -483,7 +483,7 @@ UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev if (udev_queue == NULL) return NULL; - udev_list_cleanup_entries(udev_queue->udev, &udev_queue->failed_list); + udev_list_cleanup(&udev_queue->failed_list); util_strscpyl(path, sizeof(path), udev_get_run_path(udev_queue->udev), "/failed", NULL); dir = opendir(path); if (dir == NULL) @@ -508,7 +508,7 @@ UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); if (stat(filename, &statbuf) != 0) continue; - udev_list_entry_add(udev_queue->udev, &udev_queue->failed_list, syspath, NULL, 0); + udev_list_entry_add(&udev_queue->failed_list, syspath, NULL); } closedir(dir); return udev_list_get_entry(&udev_queue->failed_list); diff --git a/libudev/libudev.c b/libudev/libudev.c index ad8c914e84..165c36984e 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -45,7 +45,7 @@ struct udev { char *rules_path; char *run_config_path; char *run_path; - struct udev_list_node properties_list; + struct udev_list properties_list; int log_priority; }; @@ -130,14 +130,14 @@ UDEV_EXPORT struct udev *udev_new(void) udev->refcount = 1; udev->log_fn = log_stderr; udev->log_priority = LOG_ERR; - udev_list_init(&udev->properties_list); + udev_list_init(udev, &udev->properties_list, true); /* custom config file */ env = getenv("UDEV_CONFIG_FILE"); if (env != NULL) { - udev_add_property(udev, "UDEV_CONFIG_FILE", udev->dev_path); if (set_value(&config_file, env) == NULL) goto err; + udev_add_property(udev, "UDEV_CONFIG_FILE", config_file); } /* default config file */ @@ -307,7 +307,7 @@ UDEV_EXPORT void udev_unref(struct udev *udev) udev->refcount--; if (udev->refcount > 0) return; - udev_list_cleanup_entries(udev, &udev->properties_list); + udev_list_cleanup(&udev->properties_list); free(udev->dev_path); free(udev->sys_path); free(udev->rules_path); @@ -458,7 +458,7 @@ struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, co udev_list_entry_delete(list_entry); return NULL; } - return udev_list_entry_add(udev, &udev->properties_list, key, value, UDEV_LIST_UNIQUE); + return udev_list_entry_add(&udev->properties_list, key, value); } struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) diff --git a/udev/udev-event.c b/udev/udev-event.c index a4141e9c4b..823768a3e2 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -38,14 +38,15 @@ struct udev_event *udev_event_new(struct udev_device *dev) { + struct udev *udev = udev_device_get_udev(dev); struct udev_event *event; event = calloc(1, sizeof(struct udev_event)); if (event == NULL) return NULL; event->dev = dev; - event->udev = udev_device_get_udev(dev); - udev_list_init(&event->run_list); + event->udev = udev; + udev_list_init(udev, &event->run_list, false); event->fd_signal = -1; event->birth_usec = now_usec(); event->timeout_usec = 60 * 1000 * 1000; @@ -57,7 +58,7 @@ void udev_event_unref(struct udev_event *event) { if (event == NULL) return; - udev_list_cleanup_entries(event->udev, &event->run_list); + udev_list_cleanup(&event->run_list); free(event->tmp_node); free(event->program_result); free(event->name); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 89d98248a1..f345e8977d 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1749,7 +1749,7 @@ static int parse_file(struct udev_rules *rules, const char *filename, unsigned s return 0; } -static int add_matching_files(struct udev *udev, struct udev_list_node *file_list, const char *dirname, const char *suffix) +static int add_matching_files(struct udev *udev, struct udev_list *file_list, const char *dirname, const char *suffix) { DIR *dir; struct dirent *dent; @@ -1783,7 +1783,7 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis * identical basenames from different directories overwrite each other * entries are sorted after basename */ - udev_list_entry_add(udev, file_list, dent->d_name, filename, UDEV_LIST_UNIQUE|UDEV_LIST_SORT); + udev_list_entry_add(file_list, dent->d_name, filename); } closedir(dir); @@ -1793,7 +1793,7 @@ static int add_matching_files(struct udev *udev, struct udev_list_node *file_lis struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { struct udev_rules *rules; - struct udev_list_node file_list; + struct udev_list file_list; struct udev_list_entry *file_loop; struct token end_token; @@ -1802,7 +1802,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) return NULL; rules->udev = udev; rules->resolve_names = resolve_names; - udev_list_init(&file_list); + udev_list_init(udev, &file_list, true); /* init token array and string buffer */ rules->tokens = malloc(PREALLOC_TOKEN * sizeof(struct token)); @@ -1885,7 +1885,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) } parse_file(rules, filename, filename_off); } - udev_list_cleanup_entries(udev, &file_list); + udev_list_cleanup(&file_list); memset(&end_token, 0x00, sizeof(struct token)); end_token.type = TK_END; @@ -2663,13 +2663,12 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event struct udev_list_entry *list_entry; if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_list_cleanup_entries(event->udev, &event->run_list); + udev_list_cleanup(&event->run_list); info(event->udev, "RUN '%s' %s:%u\n", &rules->buf[cur->key.value_off], &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - list_entry = udev_list_entry_add(event->udev, &event->run_list, - &rules->buf[cur->key.value_off], NULL, UDEV_LIST_UNIQUE); + list_entry = udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL); if (cur->key.fail_on_error) udev_list_entry_set_num(list_entry, true); break; diff --git a/udev/udev.h b/udev/udev.h index 0c73b502cb..c1e2814504 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -39,7 +39,7 @@ struct udev_event { mode_t mode; uid_t uid; gid_t gid; - struct udev_list_node run_list; + struct udev_list run_list; int exec_delay; unsigned long long birth_usec; unsigned long long timeout_usec; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c index 7ea7aa0f70..64913dbd55 100644 --- a/udev/udevadm-monitor.c +++ b/udev/udevadm-monitor.c @@ -72,8 +72,8 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) bool prop = false; bool print_kernel = false; bool print_udev = false; - struct udev_list_node subsystem_match_list; - struct udev_list_node tag_match_list; + struct udev_list subsystem_match_list; + struct udev_list tag_match_list; struct udev_monitor *udev_monitor = NULL; struct udev_monitor *kernel_monitor = NULL; int fd_ep = -1; @@ -92,8 +92,8 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) {} }; - udev_list_init(&subsystem_match_list); - udev_list_init(&tag_match_list); + udev_list_init(udev, &subsystem_match_list, true); + udev_list_init(udev, &tag_match_list, true); for (;;) { option = getopt_long(argc, argv, "pekus:t:h", options, NULL); @@ -122,11 +122,11 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) devtype[0] = '\0'; devtype++; } - udev_list_entry_add(udev, &subsystem_match_list, subsys, devtype, 0); + udev_list_entry_add(&subsystem_match_list, subsys, devtype); break; } case 't': - udev_list_entry_add(udev, &tag_match_list, optarg, NULL, 0); + udev_list_entry_add(&tag_match_list, optarg, NULL); break; case 'h': printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" @@ -285,8 +285,8 @@ out: close(fd_ep); udev_monitor_unref(udev_monitor); udev_monitor_unref(kernel_monitor); - udev_list_cleanup_entries(udev, &subsystem_match_list); - udev_list_cleanup_entries(udev, &tag_match_list); + udev_list_cleanup(&subsystem_match_list); + udev_list_cleanup(&tag_match_list); return rc; } diff --git a/udev/udevd.c b/udev/udevd.c index 2fa2a6a48a..1220deaaa6 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1574,8 +1574,8 @@ int main(int argc, char *argv[]) udev_rules_apply_static_dev_perms(rules); - udev_list_init(&event_list); - udev_list_init(&worker_list); + udev_list_node_init(&event_list); + udev_list_node_init(&worker_list); for (;;) { struct epoll_event ev[8]; @@ -1606,12 +1606,12 @@ int main(int argc, char *argv[]) worker_kill(udev, 0); /* exit after all has cleaned up */ - if (udev_list_is_empty(&event_list) && udev_list_is_empty(&worker_list)) + if (udev_list_node_is_empty(&event_list) && udev_list_node_is_empty(&worker_list)) break; /* timeout at exit for workers to finish */ timeout = 60 * 1000; - } else if (udev_list_is_empty(&event_list) && children > 2) { + } else if (udev_list_node_is_empty(&event_list) && children > 2) { /* set timeout to kill idle workers */ timeout = 3 * 1000; } else { @@ -1659,7 +1659,7 @@ int main(int argc, char *argv[]) } /* start new events */ - if (!udev_list_is_empty(&event_list) && !udev_exit && !stop_exec_queue) + if (!udev_list_node_is_empty(&event_list) && !udev_exit && !stop_exec_queue) event_queue_start(udev); if (is_signal) { -- cgit v1.2.3-54-g00ecf From 617746e09795575c6258dd075ee7f0a44ce61e1e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 4 Aug 2011 23:25:03 +0200 Subject: rules: move input_id to default rules MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Tue, Aug 2, 2011 at 10:56, Thomas Bächler wrote: > Commit c49df20758e0f22778cfc93b598f2929f4c86272 prevented udev from > creating broken symlinks for bluetooth hid devices. Unfortunately, > it also removed the ID_INPUT=1 and ID_INPUT_{KEY,MOUSE}=1 properties > from those devices. Xorg relies on these properties for cold- and > hotplugging of input devices. --- rules/rules.d/50-udev-default.rules | 3 ++- rules/rules.d/60-persistent-input.rules | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index f5b181dcc0..30267fee63 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -20,6 +20,7 @@ KERNEL=="null|zero|full|random|urandom", MODE="0666" KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" # input +SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{program}="input_id %p" KERNEL=="mouse*|mice|event*", MODE="0640" KERNEL=="ts[0-9]*|uinput", MODE="0640" KERNEL=="js[0-9]*", MODE="0644" @@ -50,7 +51,7 @@ SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" -# libusb device nodes +# 'libusb' device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index 65a6381fad..e7611f5706 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -4,7 +4,6 @@ ACTION=="remove", GOTO="persistent_input_end" SUBSYSTEM!="input", GOTO="persistent_input_end" SUBSYSTEMS=="bluetooth", GOTO="persistent_input_end" -ENV{ID_INPUT}=="", IMPORT{program}="input_id %p" SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{program}="usb_id --export %p" # determine class name for persistent symlinks -- cgit v1.2.3-54-g00ecf From d7867b31836173d1a943ecb1cab6484536126411 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 5 Aug 2011 02:00:30 +0200 Subject: implement path_id, usb_id, input_id as built-in command --- Makefile.am | 32 +- NEWS | 8 + TODO | 2 + extras/gudev/docs/.gitignore | 1 + extras/input_id/.gitignore | 1 - extras/input_id/input_id | Bin 0 -> 135746 bytes extras/input_id/input_id.c | 281 ------------ extras/keymap/95-keymap.rules | 2 +- extras/path_id/.gitignore | 1 - extras/path_id/path_id | Bin 0 -> 151405 bytes extras/path_id/path_id.c | 554 ------------------------ extras/usb_id/.gitignore | 1 - extras/usb_id/usb_id | Bin 0 -> 155307 bytes extras/usb_id/usb_id.c | 576 ------------------------- extras/v4l_id/60-persistent-v4l.rules | 4 +- libudev/docs/.gitignore | 1 + libudev/docs/libudev-overrides.txt | 0 rules/rules.d/50-udev-default.rules | 4 +- rules/rules.d/60-persistent-alsa.rules | 4 +- rules/rules.d/60-persistent-input.rules | 4 +- rules/rules.d/60-persistent-serial.rules | 4 +- rules/rules.d/60-persistent-storage-tape.rules | 9 +- rules/rules.d/60-persistent-storage.rules | 4 +- rules/rules.d/75-net-description.rules | 2 +- rules/rules.d/75-tty-description.rules | 2 +- rules/rules.d/78-sound-card.rules | 4 +- test/udev-test.pl | 14 +- udev/udev-builtin-input_id.c | 218 ++++++++++ udev/udev-builtin-path_id.c | 486 +++++++++++++++++++++ udev/udev-builtin-usb_id.c | 482 +++++++++++++++++++++ udev/udev-builtin.c | 76 ++++ udev/udev-rules.c | 99 +++-- udev/udev.h | 25 ++ udev/udev.xml | 3 - udev/udevadm-test-builtin.c | 123 ++++++ udev/udevadm-test.c | 2 +- udev/udevadm.c | 5 +- udev/udevadm.xml | 15 + 38 files changed, 1555 insertions(+), 1494 deletions(-) delete mode 100644 extras/input_id/.gitignore create mode 100755 extras/input_id/input_id delete mode 100644 extras/path_id/.gitignore create mode 100755 extras/path_id/path_id delete mode 100644 extras/usb_id/.gitignore create mode 100755 extras/usb_id/usb_id create mode 100644 libudev/docs/libudev-overrides.txt create mode 100644 udev/udev-builtin-input_id.c create mode 100644 udev/udev-builtin-path_id.c create mode 100644 udev/udev-builtin-usb_id.c create mode 100644 udev/udev-builtin.c create mode 100644 udev/udevadm-test-builtin.c diff --git a/Makefile.am b/Makefile.am index 7686ca74e1..563b09b97b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -160,7 +160,11 @@ udev_common_sources =\ udev/udev-watch.c \ udev/udev-node.c \ udev/udev-rules.c \ - udev/udev-ctrl.c + udev/udev-ctrl.c \ + udev/udev-builtin.c \ + udev/udev-builtin-path_id.c \ + udev/udev-builtin-usb_id.c \ + udev/udev-builtin-input_id.c udev_udevd_SOURCES = \ $(udev_common_sources) \ @@ -174,10 +178,11 @@ udev_udevadm_SOURCES = \ udev/udevadm.c \ udev/udevadm-info.c \ udev/udevadm-control.c \ - udev/udevadm-test.c \ udev/udevadm-monitor.c \ udev/udevadm-settle.c \ - udev/udevadm-trigger.c + udev/udevadm-trigger.c \ + udev/udevadm-test.c \ + udev/udevadm-test-builtin.c udev_udevadm_LDADD = libudev/libudev-private.la # ------------------------------------------------------------------------------ @@ -252,20 +257,6 @@ extras_collect_collect_SOURCES = extras/collect/collect.c extras_collect_collect_LDADD = libudev/libudev-private.la libexec_PROGRAMS += extras/collect/collect -# ------------------------------------------------------------------------------ -# input_id - import input device class -# ------------------------------------------------------------------------------ -extras_input_id_input_id_SOURCES = extras/input_id/input_id.c -extras_input_id_input_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/input_id/input_id - -# ------------------------------------------------------------------------------ -# path_id - compose identifier of persistent elements of the parent buses -# ------------------------------------------------------------------------------ -extras_path_id_path_id_SOURCES = extras/path_id/path_id.c -extras_path_id_path_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/path_id/path_id - # ------------------------------------------------------------------------------ # scsi_id - SCSI inquiry to get various serial numbers # ------------------------------------------------------------------------------ @@ -279,13 +270,6 @@ libexec_PROGRAMS += extras/scsi_id/scsi_id dist_man_MANS += extras/scsi_id/scsi_id.8 EXTRA_DIST += extras/scsi_id/README -# ------------------------------------------------------------------------------ -# usb_id - USB device property import -# ------------------------------------------------------------------------------ -extras_usb_id_usb_id_SOURCES = extras/usb_id/usb_id.c -extras_usb_id_usb_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/usb_id/usb_id - # ------------------------------------------------------------------------------ # v4l_id - video4linux capabilities # ------------------------------------------------------------------------------ diff --git a/NEWS b/NEWS index aa424b0730..1799c401ae 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +udev 174 +======== +Bugfixes. + +The path_id, usb_id, input_id tools are built-in commands now +and the stand-alone tools do not exist anymore. For testing, +the commands can be run with 'udevadm test-builtin '. + udev 173 ======== Bugfixes. diff --git a/TODO b/TODO index 85e4d9b239..e83deb4aa1 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,8 @@ - test (now fixed) /dev/tape/ links + - warn about fallback of IMPORT{program} for built-in commands + - /run/udev/control socket (add ConditionVirtualization=!pidns) diff --git a/extras/gudev/docs/.gitignore b/extras/gudev/docs/.gitignore index a68789bd13..a24184ac83 100644 --- a/extras/gudev/docs/.gitignore +++ b/extras/gudev/docs/.gitignore @@ -1,3 +1,4 @@ +gudev-overrides.txt gudev-decl-list.txt gudev-decl.txt gudev-undeclared.txt diff --git a/extras/input_id/.gitignore b/extras/input_id/.gitignore deleted file mode 100644 index 4f33cba4ad..0000000000 --- a/extras/input_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -input_id diff --git a/extras/input_id/input_id b/extras/input_id/input_id new file mode 100755 index 0000000000..e215aad729 Binary files /dev/null and b/extras/input_id/input_id differ diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c index ba53df01b0..e69de29bb2 100644 --- a/extras/input_id/input_id.c +++ b/extras/input_id/input_id.c @@ -1,281 +0,0 @@ -/* - * input_id - input device classification - * - * Copyright (C) 2009 Martin Pitt - * Portions Copyright (C) 2004 David Zeuthen, - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 keymap; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/* we must use this kernel-compatible implementation */ -#define BITS_PER_LONG (sizeof(unsigned long) * 8) -#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) -#define OFF(x) ((x)%BITS_PER_LONG) -#define BIT(x) (1UL<> OFF(bit)) & 1) - -static int debug = 0; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -/* - * Read a capability attribute and return bitmask. - * @param dev udev_device - * @param attr sysfs attribute name (e. g. "capabilities/key") - * @param bitmask: Output array which has a sizeof of bitmask_size - */ -static void get_cap_mask (struct udev_device *dev, const char* attr, - unsigned long *bitmask, size_t bitmask_size) -{ - struct udev *udev = udev_device_get_udev(dev); - char text[4096]; - unsigned i; - char* word; - unsigned long val; - - snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(dev, attr)); - info(udev, "%s raw kernel attribute: %s\n", attr, text); - - memset (bitmask, 0, bitmask_size); - i = 0; - while ((word = strrchr(text, ' ')) != NULL) { - val = strtoul (word+1, NULL, 16); - if (i < bitmask_size/sizeof(unsigned long)) - bitmask[i] = val; - else - info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); - *word = '\0'; - ++i; - } - val = strtoul (text, NULL, 16); - if (i < bitmask_size / sizeof(unsigned long)) - bitmask[i] = val; - else - info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); - - if (debug) { - /* printf pattern with the right unsigned long number of hex chars */ - snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long)); - info(udev, "%s decoded bit map:\n", attr); - val = bitmask_size / sizeof (unsigned long); - /* skip over leading zeros */ - while (bitmask[val-1] == 0 && val > 0) - --val; - for (i = 0; i < val; ++i) - info(udev, text, i * BITS_PER_LONG, bitmask[i]); - } -} - -/* pointer devices */ -static void test_pointers (const unsigned long* bitmask_ev, - const unsigned long* bitmask_abs, - const unsigned long* bitmask_key, - const unsigned long* bitmask_rel) -{ - int is_mouse = 0; - int is_touchpad = 0; - - if (!test_bit (EV_KEY, bitmask_ev)) { - if (test_bit (EV_ABS, bitmask_ev) && - test_bit (ABS_X, bitmask_abs) && - test_bit (ABS_Y, bitmask_abs) && - test_bit (ABS_Z, bitmask_abs)) - puts("ID_INPUT_ACCELEROMETER=1"); - return; - } - - if (test_bit (EV_ABS, bitmask_ev) && - test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { - if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) - puts("ID_INPUT_TABLET=1"); - else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) - is_touchpad = 1; - else if (test_bit (BTN_TRIGGER, bitmask_key) || - test_bit (BTN_A, bitmask_key) || - test_bit (BTN_1, bitmask_key)) - puts("ID_INPUT_JOYSTICK=1"); - else if (test_bit (BTN_MOUSE, bitmask_key)) - /* This path is taken by VMware's USB mouse, which has - * absolute axes, but no touch/pressure button. */ - is_mouse = 1; - else if (test_bit (BTN_TOUCH, bitmask_key)) - puts("ID_INPUT_TOUCHSCREEN=1"); - } - - if (test_bit (EV_REL, bitmask_ev) && - test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && - test_bit (BTN_MOUSE, bitmask_key)) - is_mouse = 1; - - if (is_mouse) - puts("ID_INPUT_MOUSE=1"); - if (is_touchpad) - puts("ID_INPUT_TOUCHPAD=1"); -} - -/* key like devices */ -static void test_key (struct udev *udev, - const unsigned long* bitmask_ev, - const unsigned long* bitmask_key) -{ - unsigned i; - unsigned long found; - unsigned long mask; - - /* do we have any KEY_* capability? */ - if (!test_bit (EV_KEY, bitmask_ev)) { - info(udev, "test_key: no EV_KEY capability\n"); - return; - } - - /* only consider KEY_* here, not BTN_* */ - found = 0; - for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) { - found |= bitmask_key[i]; - info(udev, "test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); - } - /* If there are no keys in the lower block, check the higher block */ - if (!found) { - for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) { - if (test_bit (i, bitmask_key)) { - info(udev, "test_key: Found key %x in high block\n", i); - found = 1; - break; - } - } - } - - if (found > 0) - puts("ID_INPUT_KEY=1"); - - /* the first 32 bits are ESC, numbers, and Q to D; if we have all of - * those, consider it a full keyboard; do not test KEY_RESERVED, though */ - mask = 0xFFFFFFFE; - if ((bitmask_key[0] & mask) == mask) - puts("ID_INPUT_KEYBOARD=1"); -} - -static void help(void) -{ - printf("Usage: input_id [options] \n" - " --debug debug to stderr\n" - " --help print this help text\n\n"); -} - -int main (int argc, char** argv) -{ - struct udev *udev; - struct udev_device *dev; - - static const struct option options[] = { - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - char devpath[PATH_MAX]; - unsigned long bitmask_ev[NBITS(EV_MAX)]; - unsigned long bitmask_abs[NBITS(ABS_MAX)]; - unsigned long bitmask_key[NBITS(KEY_MAX)]; - unsigned long bitmask_rel[NBITS(REL_MAX)]; - - udev = udev_new(); - if (udev == NULL) - return 1; - - udev_log_init("input_id"); - udev_set_log_fn(udev, log_fn); - - /* CLI argument parsing */ - while (1) { - int option; - - option = getopt_long(argc, argv, "dxh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - help(); - exit(0); - default: - exit(1); - } - } - - if (argv[optind] == NULL) { - help(); - exit(1); - } - - /* get the device */ - snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); - dev = udev_device_new_from_syspath(udev, devpath); - if (dev == NULL) { - fprintf(stderr, "unable to access '%s'\n", devpath); - return 1; - } - - /* walk up the parental chain until we find the real input device; the - * argument is very likely a subdevice of this, like eventN */ - while (dev != NULL && udev_device_get_sysattr_value(dev, "capabilities/ev") == NULL) - dev = udev_device_get_parent_with_subsystem_devtype(dev, "input", NULL); - - /* not an "input" class device */ - if (dev == NULL) - return 0; - - /* Use this as a flag that input devices were detected, so that this - * program doesn't need to be called more than once per device */ - puts("ID_INPUT=1"); - - get_cap_mask (dev, "capabilities/ev", bitmask_ev, sizeof (bitmask_ev)); - get_cap_mask (dev, "capabilities/abs", bitmask_abs, sizeof (bitmask_abs)); - get_cap_mask (dev, "capabilities/rel", bitmask_rel, sizeof (bitmask_rel)); - get_cap_mask (dev, "capabilities/key", bitmask_key, sizeof (bitmask_key)); - - test_pointers(bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel); - - test_key(udev, bitmask_ev, bitmask_key); - - return 0; -} diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 6f1b99555e..0d9b771e2e 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -10,7 +10,7 @@ KERNEL!="event*", GOTO="keyboard_end" ENV{ID_INPUT_KEY}=="", GOTO="keyboard_end" SUBSYSTEMS=="bluetooth", GOTO="keyboard_end" -SUBSYSTEMS=="usb", ENV{ID_VENDOR}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" SUBSYSTEMS=="usb", GOTO="keyboard_usbcheck" GOTO="keyboard_modulecheck" diff --git a/extras/path_id/.gitignore b/extras/path_id/.gitignore deleted file mode 100644 index 6fd2f89761..0000000000 --- a/extras/path_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -path_id diff --git a/extras/path_id/path_id b/extras/path_id/path_id new file mode 100755 index 0000000000..567d508f1d Binary files /dev/null and b/extras/path_id/path_id differ diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c index 928aa6737f..e69de29bb2 100644 --- a/extras/path_id/path_id.c +++ b/extras/path_id/path_id.c @@ -1,554 +0,0 @@ -/* - * compose persistent device path - * - * Copyright (C) 2009 Kay Sievers - * - * Logic based on Hannes Reinecke's shell script. - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static int debug; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn != NULL ? fn : file); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -static int path_prepend(char **path, const char *fmt, ...) -{ - va_list va; - char *pre; - int err = 0; - - va_start(va, fmt); - err = vasprintf(&pre, fmt, va); - va_end(va); - if (err < 0) - goto out; - - if (*path != NULL) { - char *new; - - err = asprintf(&new, "%s-%s", pre, *path); - free(pre); - if (err < 0) - goto out; - free(*path); - *path = new; - } else { - *path = pre; - } -out: - return err; -} - -/* -** Linux only supports 32 bit luns. -** See drivers/scsi/scsi_scan.c::scsilun_to_int() for more details. -*/ -static int format_lun_number(struct udev_device *dev, char **path) -{ - unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10); - - /* address method 0, peripheral device addressing with bus id of zero */ - if (lun < 256) - return path_prepend(path, "lun-%d", lun); - /* handle all other lun addressing methods by using a variant of the original lun format */ - return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff); -} - -static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) -{ - struct udev_device *parent = dev; - - while (parent != NULL) { - const char *subsystem; - - subsystem = udev_device_get_subsystem(parent); - if (subsystem == NULL || strcmp(subsystem, subsys) != 0) - break; - dev = parent; - parent = udev_device_get_parent(parent); - } - return dev; -} - -static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) -{ - struct udev *udev = udev_device_get_udev(parent); - struct udev_device *targetdev; - struct udev_device *fcdev = NULL; - const char *port; - char *lun = NULL;; - - targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); - if (targetdev == NULL) - return NULL; - - fcdev = udev_device_new_from_subsystem_sysname(udev, "fc_transport", udev_device_get_sysname(targetdev)); - if (fcdev == NULL) - return NULL; - port = udev_device_get_sysattr_value(fcdev, "port_name"); - if (port == NULL) { - parent = NULL; - goto out; - } - - format_lun_number(parent, &lun); - path_prepend(path, "fc-%s-%s", port, lun); - if (lun) - free(lun); -out: - udev_device_unref(fcdev); - return parent; -} - -static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) -{ - struct udev *udev = udev_device_get_udev(parent); - struct udev_device *targetdev; - struct udev_device *target_parent; - struct udev_device *sasdev; - const char *sas_address; - char *lun = NULL; - - targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); - if (targetdev == NULL) - return NULL; - - target_parent = udev_device_get_parent(targetdev); - if (target_parent == NULL) - return NULL; - - sasdev = udev_device_new_from_subsystem_sysname(udev, "sas_device", - udev_device_get_sysname(target_parent)); - if (sasdev == NULL) - return NULL; - - sas_address = udev_device_get_sysattr_value(sasdev, "sas_address"); - if (sas_address == NULL) { - parent = NULL; - goto out; - } - - format_lun_number(parent, &lun); - path_prepend(path, "sas-%s-%s", sas_address, lun); - if (lun) - free(lun); -out: - udev_device_unref(sasdev); - return parent; -} - -static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) -{ - struct udev *udev = udev_device_get_udev(parent); - struct udev_device *transportdev; - struct udev_device *sessiondev = NULL; - const char *target; - char *connname; - struct udev_device *conndev = NULL; - const char *addr; - const char *port; - char *lun = NULL; - - /* find iscsi session */ - transportdev = parent; - for (;;) { - transportdev = udev_device_get_parent(transportdev); - if (transportdev == NULL) - return NULL; - if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0) - break; - } - - /* find iscsi session device */ - sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev)); - if (sessiondev == NULL) - return NULL; - target = udev_device_get_sysattr_value(sessiondev, "targetname"); - if (target == NULL) { - parent = NULL; - goto out; - } - - if (asprintf(&connname, "connection%s:0", udev_device_get_sysnum(transportdev)) < 0) { - parent = NULL; - goto out; - } - conndev = udev_device_new_from_subsystem_sysname(udev, "iscsi_connection", connname); - free(connname); - if (conndev == NULL) { - parent = NULL; - goto out; - } - addr = udev_device_get_sysattr_value(conndev, "persistent_address"); - port = udev_device_get_sysattr_value(conndev, "persistent_port"); - if (addr == NULL || port == NULL) { - parent = NULL; - goto out; - } - - format_lun_number(parent, &lun); - path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun); - if (lun) - free(lun); -out: - udev_device_unref(sessiondev); - udev_device_unref(conndev); - return parent; -} - -static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path) -{ - struct udev_device *hostdev; - int host, bus, target, lun; - const char *name; - char *base; - char *pos; - DIR *dir; - struct dirent *dent; - int basenum; - - hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host"); - if (hostdev == NULL) - return NULL; - - name = udev_device_get_sysname(parent); - if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) - return NULL; - - /* rebase host offset to get the local relative number */ - basenum = -1; - base = strdup(udev_device_get_syspath(hostdev)); - if (base == NULL) - return NULL; - pos = strrchr(base, '/'); - if (pos == NULL) { - parent = NULL; - goto out; - } - pos[0] = '\0'; - dir = opendir(base); - if (dir == NULL) { - parent = NULL; - goto out; - } - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char *rest; - int i; - - if (dent->d_name[0] == '.') - continue; - if (dent->d_type != DT_DIR && dent->d_type != DT_LNK) - continue; - if (strncmp(dent->d_name, "host", 4) != 0) - continue; - i = strtoul(&dent->d_name[4], &rest, 10); - if (rest[0] != '\0') - continue; - if (basenum == -1 || i < basenum) - basenum = i; - } - closedir(dir); - if (basenum == -1) { - parent = NULL; - goto out; - } - host -= basenum; - - path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun); -out: - free(base); - return hostdev; -} - -static struct udev_device *handle_scsi(struct udev_device *parent, char **path) -{ - const char *devtype; - const char *name; - const char *id; - - devtype = udev_device_get_devtype(parent); - if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) - return parent; - - /* firewire */ - id = udev_device_get_sysattr_value(parent, "ieee1394_id"); - if (id != NULL) { - parent = skip_subsystem(parent, "scsi"); - path_prepend(path, "ieee1394-0x%s", id); - goto out; - } - - /* lousy scsi sysfs does not have a "subsystem" for the transport */ - name = udev_device_get_syspath(parent); - - if (strstr(name, "/rport-") != NULL) { - parent = handle_scsi_fibre_channel(parent, path); - goto out; - } - - if (strstr(name, "/end_device-") != NULL) { - parent = handle_scsi_sas(parent, path); - goto out; - } - - if (strstr(name, "/session") != NULL) { - parent = handle_scsi_iscsi(parent, path); - goto out; - } - - parent = handle_scsi_default(parent, path); -out: - return parent; -} - -static void handle_scsi_tape(struct udev_device *dev, char **path) -{ - const char *name; - - /* must be the last device in the syspath */ - if (*path != NULL) - return; - - name = udev_device_get_sysname(dev); - if (strncmp(name, "nst", 3) == 0 && strchr("lma", name[3]) != NULL) - path_prepend(path, "nst%c", name[3]); - else if (strncmp(name, "st", 2) == 0 && strchr("lma", name[2]) != NULL) - path_prepend(path, "st%c", name[2]); -} - -static struct udev_device *handle_usb(struct udev_device *parent, char **path) -{ - const char *devtype; - const char *str; - const char *port; - - devtype = udev_device_get_devtype(parent); - if (devtype == NULL) - return parent; - if (strcmp(devtype, "usb_interface") != 0 && strcmp(devtype, "usb_device") != 0) - return parent; - - str = udev_device_get_sysname(parent); - port = strchr(str, '-'); - if (port == NULL) - return parent; - port++; - - parent = skip_subsystem(parent, "usb"); - path_prepend(path, "usb-0:%s", port); - return parent; -} - -static struct udev_device *handle_cciss(struct udev_device *parent, char **path) -{ - return NULL; -} - -static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) -{ - struct udev_device *scsi_dev; - - scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); - if (scsi_dev != NULL) { - const char *wwpn; - const char *lun; - const char *hba_id; - - hba_id = udev_device_get_sysattr_value(scsi_dev, "hba_id"); - wwpn = udev_device_get_sysattr_value(scsi_dev, "wwpn"); - lun = udev_device_get_sysattr_value(scsi_dev, "fcp_lun"); - if (hba_id != NULL && lun != NULL && wwpn != NULL) { - path_prepend(path, "ccw-%s-zfcp-%s:%s", hba_id, wwpn, lun); - goto out; - } - } - - path_prepend(path, "ccw-%s", udev_device_get_sysname(parent)); -out: - parent = skip_subsystem(parent, "ccw"); - return parent; -} - -int main(int argc, char **argv) -{ - static const struct option options[] = { - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - struct udev *udev; - struct udev_device *dev; - struct udev_device *parent; - char syspath[UTIL_PATH_SIZE]; - const char *devpath; - char *path = NULL; - int rc = EXIT_FAILURE; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("path_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "dh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("Usage: path_id [--debug] [--help] \n" - " --debug print debug information\n" - " --help print this help text\n\n"); - goto exit; - } - } - - devpath = argv[optind]; - if (devpath == NULL) { - fprintf(stderr, "No device specified\n"); - rc = 2; - goto exit; - } - - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - dev = udev_device_new_from_syspath(udev, syspath); - if (dev == NULL) { - fprintf(stderr, "unable to access '%s'\n", devpath); - rc = 3; - goto exit; - } - - /* S390 ccw bus */ - parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); - if (parent != NULL) { - handle_ccw(parent, dev, &path); - goto out; - } - - /* walk up the chain of devices and compose path */ - parent = dev; - while (parent != NULL) { - const char *subsys; - - subsys = udev_device_get_subsystem(parent); - - if (subsys == NULL) { - ; - } else if (strcmp(subsys, "scsi_tape") == 0) { - handle_scsi_tape(parent, &path); - } else if (strcmp(subsys, "scsi") == 0) { - parent = handle_scsi(parent, &path); - } else if (strcmp(subsys, "cciss") == 0) { - handle_cciss(parent, &path); - } else if (strcmp(subsys, "usb") == 0) { - parent = handle_usb(parent, &path); - } else if (strcmp(subsys, "serio") == 0) { - path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); - parent = skip_subsystem(parent, "serio"); - } else if (strcmp(subsys, "pci") == 0) { - path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "pci"); - } else if (strcmp(subsys, "platform") == 0) { - path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "platform"); - } else if (strcmp(subsys, "acpi") == 0) { - path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "acpi"); - } else if (strcmp(subsys, "xen") == 0) { - path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "xen"); - } else if (strcmp(subsys, "virtio") == 0) { - path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "virtio"); - } - - parent = udev_device_get_parent(parent); - } -out: - if (path != NULL) { - char tag[UTIL_NAME_SIZE]; - size_t i; - const char *p; - - /* compose valid udev tag name */ - for (p = path, i = 0; *p; p++) { - if ((*p >= '0' && *p <= '9') || - (*p >= 'A' && *p <= 'Z') || - (*p >= 'a' && *p <= 'z') || - *p == '-') { - tag[i++] = *p; - continue; - } - - /* skip all leading '_' */ - if (i == 0) - continue; - - /* avoid second '_' */ - if (tag[i-1] == '_') - continue; - - tag[i++] = '_'; - } - /* strip trailing '_' */ - while (i > 0 && tag[i-1] == '_') - i--; - tag[i] = '\0'; - - printf("ID_PATH=%s\n", path); - printf("ID_PATH_TAG=%s\n", tag); - free(path); - rc = EXIT_SUCCESS; - } - - udev_device_unref(dev); -exit: - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/extras/usb_id/.gitignore b/extras/usb_id/.gitignore deleted file mode 100644 index 309b59fc3a..0000000000 --- a/extras/usb_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -usb_id diff --git a/extras/usb_id/usb_id b/extras/usb_id/usb_id new file mode 100755 index 0000000000..903702e876 Binary files /dev/null and b/extras/usb_id/usb_id differ diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c index 3a7a0ffd49..e69de29bb2 100644 --- a/extras/usb_id/usb_id.c +++ b/extras/usb_id/usb_id.c @@ -1,576 +0,0 @@ -/* - * usb_id - identify an USB device - * - * Copyright (c) 2005 SUSE Linux Products GmbH, Germany - * - * Author: Hannes Reinecke - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -int debug; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn != NULL ? fn : file); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -static char vendor_str[64]; -static char vendor_str_enc[256]; -static const char *vendor_id = ""; -static char model_str[64]; -static char model_str_enc[256]; -static const char *product_id = ""; -static char serial_str[UTIL_NAME_SIZE]; -static char packed_if_str[UTIL_NAME_SIZE]; -static char revision_str[64]; -static char type_str[64]; -static char instance_str[64]; -static const char *ifnum; -static const char *driver; - -static int use_usb_info; -static int use_num_info; - -static void set_usb_iftype(char *to, int if_class_num, size_t len) -{ - char *type = "generic"; - - switch (if_class_num) { - case 1: - type = "audio"; - break; - case 2: /* CDC-Control */ - break; - case 3: - type = "hid"; - break; - case 5: /* Physical */ - break; - case 6: - type = "media"; - break; - case 7: - type = "printer"; - break; - case 8: - type = "storage"; - break; - case 9: - type = "hub"; - break; - case 0x0a: /* CDC-Data */ - break; - case 0x0b: /* Chip/Smart Card */ - break; - case 0x0d: /* Content Security */ - break; - case 0x0e: - type = "video"; - break; - case 0xdc: /* Diagnostic Device */ - break; - case 0xe0: /* Wireless Controller */ - break; - case 0xfe: /* Application-specific */ - break; - case 0xff: /* Vendor-specific */ - break; - default: - break; - } - strncpy(to, type, len); - to[len-1] = '\0'; -} - -static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len) -{ - int type_num = 0; - char *eptr; - char *type = "generic"; - - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 2: - type = "atapi"; - break; - case 3: - type = "tape"; - break; - case 4: /* UFI */ - case 5: /* SFF-8070i */ - type = "floppy"; - break; - case 1: /* RBC devices */ - type = "rbc"; - break; - case 6: /* Transparent SPC-2 devices */ - type = "scsi"; - break; - default: - break; - } - } - util_strscpy(to, len, type); - return type_num; -} - -static void set_scsi_type(char *to, const char *from, size_t len) -{ - int type_num; - char *eptr; - char *type = "generic"; - - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 0: - case 0xe: - type = "disk"; - break; - case 1: - type = "tape"; - break; - case 4: - case 7: - case 0xf: - type = "optical"; - break; - case 5: - type = "cd"; - break; - default: - break; - } - } - util_strscpy(to, len, type); -} - -#define USB_DT_DEVICE 0x01 -#define USB_DT_INTERFACE 0x04 - -static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len) -{ - char *filename = NULL; - int fd; - ssize_t size; - unsigned char buf[18 + 65535]; - unsigned int pos, strpos; - struct usb_interface_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int8_t bInterfaceNumber; - u_int8_t bAlternateSetting; - u_int8_t bNumEndpoints; - u_int8_t bInterfaceClass; - u_int8_t bInterfaceSubClass; - u_int8_t bInterfaceProtocol; - u_int8_t iInterface; - } __attribute__((packed)); - int err = 0; - - if (asprintf(&filename, "%s/descriptors", udev_device_get_syspath(dev)) < 0) { - err = -1; - goto out; - } - fd = open(filename, O_RDONLY); - if (fd < 0) { - fprintf(stderr, "error opening USB device 'descriptors' file\n"); - err = -1; - goto out; - } - size = read(fd, buf, sizeof(buf)); - close(fd); - if (size < 18 || size == sizeof(buf)) { - err = -1; - goto out; - } - - pos = 0; - strpos = 0; - while (pos < sizeof(buf) && strpos+7 < len) { - struct usb_interface_descriptor *desc; - char if_str[8]; - - desc = (struct usb_interface_descriptor *) &buf[pos]; - if (desc->bLength < 3) - break; - pos += desc->bLength; - - if (desc->bDescriptorType != USB_DT_INTERFACE) - continue; - - if (snprintf(if_str, 8, "%02x%02x%02x:", - desc->bInterfaceClass, - desc->bInterfaceSubClass, - desc->bInterfaceProtocol) != 7) - continue; - - if (strstr(ifs_str, if_str) != NULL) - continue; - - memcpy(&ifs_str[strpos], if_str, 8), - strpos += 7; - } -out: - free(filename); - return err; -} - -/* - * A unique USB identification is generated like this: - * - * 1.) Get the USB device type from InterfaceClass and InterfaceSubClass - * 2.) If the device type is 'Mass-Storage/SPC-2' or 'Mass-Storage/RBC' - * use the SCSI vendor and model as USB-Vendor and USB-model. - * 3.) Otherwise use the USB manufacturer and product as - * USB-Vendor and USB-model. Any non-printable characters - * in those strings will be skipped; a slash '/' will be converted - * into a full stop '.'. - * 4.) If that fails, too, we will use idVendor and idProduct - * as USB-Vendor and USB-model. - * 5.) The USB identification is the USB-vendor and USB-model - * string concatenated with an underscore '_'. - * 6.) If the device supplies a serial number, this number - * is concatenated with the identification with an underscore '_'. - */ -static int usb_id(struct udev_device *dev) -{ - struct udev *udev = udev_device_get_udev(dev); - struct udev_device *dev_interface = NULL; - struct udev_device *dev_usb = NULL; - const char *if_class, *if_subclass; - int if_class_num; - int protocol = 0; - - dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); - - /* shortcut, if we are called directly for a "usb_device" type */ - if (udev_device_get_devtype(dev) != NULL && strcmp(udev_device_get_devtype(dev), "usb_device") == 0) { - dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str)); - dev_usb = dev; - goto fallback; - } - - /* usb interface directory */ - dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface"); - if (dev_interface == NULL) { - info(udev, "unable to access usb_interface device of '%s'\n", - udev_device_get_syspath(dev)); - return 1; - } - - ifnum = udev_device_get_sysattr_value(dev_interface, "bInterfaceNumber"); - driver = udev_device_get_sysattr_value(dev_interface, "driver"); - - if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass"); - if (!if_class) { - info(udev, "%s: cannot get bInterfaceClass attribute\n", - udev_device_get_sysname(dev)); - return 1; - } - - if_class_num = strtoul(if_class, NULL, 16); - if (if_class_num == 8) { - /* mass storage */ - if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass"); - if (if_subclass != NULL) - protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); - } else { - set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1); - } - - info(udev, "%s: if_class %d protocol %d\n", - udev_device_get_syspath(dev_interface), if_class_num, protocol); - - /* usb device directory */ - dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", "usb_device"); - if (!dev_usb) { - info(udev, "unable to find parent 'usb' device of '%s'\n", - udev_device_get_syspath(dev)); - return 1; - } - - /* all interfaces of the device in a single string */ - dev_if_packed_info(dev_usb, packed_if_str, sizeof(packed_if_str)); - - /* mass storage : SCSI or ATAPI */ - if ((protocol == 6 || protocol == 2) && !use_usb_info) { - struct udev_device *dev_scsi; - const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; - int host, bus, target, lun; - - /* get scsi device */ - dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); - if (dev_scsi == NULL) { - info(udev, "unable to find parent 'scsi' device of '%s'\n", - udev_device_get_syspath(dev)); - goto fallback; - } - if (sscanf(udev_device_get_sysname(dev_scsi), "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { - info(udev, "invalid scsi device '%s'\n", udev_device_get_sysname(dev_scsi)); - goto fallback; - } - - /* Generic SPC-2 device */ - scsi_vendor = udev_device_get_sysattr_value(dev_scsi, "vendor"); - if (!scsi_vendor) { - info(udev, "%s: cannot get SCSI vendor attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - udev_util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); - udev_util_replace_chars(vendor_str, NULL); - - scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); - if (!scsi_model) { - info(udev, "%s: cannot get SCSI model attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc)); - udev_util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); - udev_util_replace_chars(model_str, NULL); - - scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); - if (!scsi_type) { - info(udev, "%s: cannot get SCSI type attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); - - scsi_rev = udev_device_get_sysattr_value(dev_scsi, "rev"); - if (!scsi_rev) { - info(udev, "%s: cannot get SCSI revision attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - udev_util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); - udev_util_replace_chars(revision_str, NULL); - - /* - * some broken devices have the same identifiers - * for all luns, export the target:lun number - */ - sprintf(instance_str, "%d:%d", target, lun); - } - -fallback: - vendor_id = udev_device_get_sysattr_value(dev_usb, "idVendor"); - product_id = udev_device_get_sysattr_value(dev_usb, "idProduct"); - - /* fallback to USB vendor & device */ - if (vendor_str[0] == '\0') { - const char *usb_vendor = NULL; - - if (!use_num_info) - usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); - - if (!usb_vendor) - usb_vendor = vendor_id; - - if (!usb_vendor) { - info(udev, "No USB vendor information available\n"); - return 1; - } - udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - udev_util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); - udev_util_replace_chars(vendor_str, NULL); - } - - if (model_str[0] == '\0') { - const char *usb_model = NULL; - - if (!use_num_info) - usb_model = udev_device_get_sysattr_value(dev_usb, "product"); - - if (!usb_model) - usb_model = product_id; - - if (!usb_model) { - dbg(udev, "No USB model information available\n"); - return 1; - } - udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); - udev_util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); - udev_util_replace_chars(model_str, NULL); - } - - if (revision_str[0] == '\0') { - const char *usb_rev; - - usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); - if (usb_rev) { - udev_util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); - udev_util_replace_chars(revision_str, NULL); - } - } - - if (serial_str[0] == '\0') { - const char *usb_serial; - - usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); - if (usb_serial) { - udev_util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); - udev_util_replace_chars(serial_str, NULL); - } - } - return 0; -} - -int main(int argc, char **argv) -{ - static const struct option options[] = { - { "usb-info", no_argument, NULL, 'u' }, - { "num-info", no_argument, NULL, 'n' }, - { "export", no_argument, NULL, 'x' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - struct udev *udev; - struct udev_device *dev = NULL; - static int export; - int retval = 0; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("usb_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "dnuxh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'n': - use_num_info = 1; - use_usb_info = 1; - break; - case 'u': - use_usb_info = 1; - break; - case 'x': - export = 1; - break; - case 'h': - printf("Usage: usb_id [--usb-info] [--num-info] [--export] [--help] []\n" - " --usb-info use usb strings instead\n" - " --num-info use numerical values\n" - " --export print values as environment keys\n" - " --help print this help text\n\n"); - goto exit; - } - } - - dev = udev_device_new_from_environment(udev); - if (dev == NULL) { - char syspath[UTIL_PATH_SIZE]; - const char *devpath; - - devpath = argv[optind]; - if (devpath == NULL) { - fprintf(stderr, "missing device\n"); - retval = 1; - goto exit; - } - - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - dev = udev_device_new_from_syspath(udev, syspath); - if (dev == NULL) { - err(udev, "unable to access '%s'\n", devpath); - retval = 1; - goto exit; - return 1; - } - } - - retval = usb_id(dev); - if (retval == 0) { - char serial[256]; - size_t l; - char *s; - - s = serial; - l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); - if (serial_str[0] != '\0') - l = util_strpcpyl(&s, l, "_", serial_str, NULL); - if (instance_str[0] != '\0') - util_strpcpyl(&s, l, "-", instance_str, NULL); - - if (export) { - printf("ID_VENDOR=%s\n", vendor_str); - printf("ID_VENDOR_ENC=%s\n", vendor_str_enc); - printf("ID_VENDOR_ID=%s\n", vendor_id); - printf("ID_MODEL=%s\n", model_str); - printf("ID_MODEL_ENC=%s\n", model_str_enc); - printf("ID_MODEL_ID=%s\n", product_id); - printf("ID_REVISION=%s\n", revision_str); - printf("ID_SERIAL=%s\n", serial); - if (serial_str[0] != '\0') - printf("ID_SERIAL_SHORT=%s\n", serial_str); - if (type_str[0] != '\0') - printf("ID_TYPE=%s\n", type_str); - if (instance_str[0] != '\0') - printf("ID_INSTANCE=%s\n", instance_str); - printf("ID_BUS=usb\n"); - if (packed_if_str[0] != '\0') - printf("ID_USB_INTERFACES=:%s\n", packed_if_str); - if (ifnum != NULL) - printf("ID_USB_INTERFACE_NUM=%s\n", ifnum); - if (driver != NULL) - printf("ID_USB_DRIVER=%s\n", driver); - } else - printf("%s\n", serial); - } - -exit: - udev_device_unref(dev); - udev_unref(udev); - udev_log_close(); - return retval; -} diff --git a/extras/v4l_id/60-persistent-v4l.rules b/extras/v4l_id/60-persistent-v4l.rules index b6e1313a31..edfd844753 100644 --- a/extras/v4l_id/60-persistent-v4l.rules +++ b/extras/v4l_id/60-persistent-v4l.rules @@ -6,14 +6,14 @@ ENV{MAJOR}=="", GOTO="persistent_v4l_end" IMPORT{program}="v4l_id $tempnode" -SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" # check for valid "index" number TEST!="index", GOTO="persistent_v4l_end" ATTR{index}!="?*", GOTO="persistent_v4l_end" -IMPORT{program}="path_id %p" +IMPORT{builtin}="path_id" ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" diff --git a/libudev/docs/.gitignore b/libudev/docs/.gitignore index 6fe7fd15d0..286f244fa2 100644 --- a/libudev/docs/.gitignore +++ b/libudev/docs/.gitignore @@ -1,3 +1,4 @@ +libudev-overrides.txt html/ tmpl/ xml/ diff --git a/libudev/docs/libudev-overrides.txt b/libudev/docs/libudev-overrides.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 30267fee63..7c4046284e 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -20,7 +20,7 @@ KERNEL=="null|zero|full|random|urandom", MODE="0666" KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" # input -SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{program}="input_id %p" +SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id" KERNEL=="mouse*|mice|event*", MODE="0640" KERNEL=="ts[0-9]*|uinput", MODE="0640" KERNEL=="js[0-9]*", MODE="0644" @@ -53,7 +53,7 @@ SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" # 'libusb' device nodes SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id" # printer KERNEL=="parport[0-9]*", GROUP="lp" diff --git a/rules/rules.d/60-persistent-alsa.rules b/rules/rules.d/60-persistent-alsa.rules index 748c1bae59..8154e2dbb5 100644 --- a/rules/rules.d/60-persistent-alsa.rules +++ b/rules/rules.d/60-persistent-alsa.rules @@ -4,11 +4,11 @@ ACTION=="remove", GOTO="persistent_alsa_end" SUBSYSTEM!="sound", GOTO="persistent_alsa_end" KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end" -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}" ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -ENV{ID_PATH}=="", IMPORT{program}="path_id %p" +IMPORT{builtin}="path_id" ENV{ID_PATH}=="?*", SYMLINK+="snd/by-path/$env{ID_PATH}" LABEL="persistent_alsa_end" diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules index e7611f5706..fb798ddb05 100644 --- a/rules/rules.d/60-persistent-input.rules +++ b/rules/rules.d/60-persistent-input.rules @@ -4,7 +4,7 @@ ACTION=="remove", GOTO="persistent_input_end" SUBSYSTEM!="input", GOTO="persistent_input_end" SUBSYSTEMS=="bluetooth", GOTO="persistent_input_end" -SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{builtin}="usb_id" # determine class name for persistent symlinks ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd" @@ -28,7 +28,7 @@ SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", A SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" # by-path -SUBSYSTEMS=="pci|usb|platform|acpi", IMPORT{program}="path_id %p" +SUBSYSTEMS=="pci|usb|platform|acpi", IMPORT{builtin}="path_id" ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{.INPUT_CLASS}" ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{.INPUT_CLASS}" # allow empty class for platform and usb devices; platform supports only a single interface that way diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules index 90816be679..2948200c53 100644 --- a/rules/rules.d/60-persistent-serial.rules +++ b/rules/rules.d/60-persistent-serial.rules @@ -6,11 +6,11 @@ KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="persistent_serial_end" SUBSYSTEMS=="usb-serial", ENV{.ID_PORT}="$attr{port_number}" -IMPORT="path_id %p" +IMPORT{builtin}="path_id" ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}" ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{.ID_PORT}" -IMPORT="usb_id --export %p" +IMPORT{builtin}="usb_id" ENV{ID_SERIAL}=="", GOTO="persistent_serial_end" SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACE_NUM}="$attr{bInterfaceNumber}" ENV{ID_USB_INTERFACE_NUM}=="", GOTO="persistent_serial_end" diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index 6ccd6e51e2..b1a64cee12 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -5,19 +5,20 @@ ACTION=="remove", GOTO="persistent_storage_tape_end" # type 8 devices are "Medium Changers" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", \ + SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{.BSG_DEV}="$root/bsg/$id" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT="scsi_id --whitelisted --export --device=$env{.BSG_DEV}", ENV{ID_BUS}="scsi" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export --device=$env{.BSG_DEV}", ENV{ID_BUS}="scsi" KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" # by-path (parent device path) -KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{program}="path_id %p" +KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{builtin}="path_id" KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 5c2689b885..894b50ba8e 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -36,7 +36,7 @@ KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}== # Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $tempnode" # Otherwise fall back to using usb_id for USB devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{program}="usb_id --export %p" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" # scsi devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" @@ -58,7 +58,7 @@ KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}= KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" # by-path (parent device path) -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT{program}="path_id %p" +ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" diff --git a/rules/rules.d/75-net-description.rules b/rules/rules.d/75-net-description.rules index 490fcced1e..0ffce2c348 100644 --- a/rules/rules.d/75-net-description.rules +++ b/rules/rules.d/75-net-description.rules @@ -3,7 +3,7 @@ ACTION=="remove", GOTO="net_end" SUBSYSTEM!="net", GOTO="net_end" -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" SUBSYSTEMS=="usb", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" SUBSYSTEMS=="usb", GOTO="net_end" diff --git a/rules/rules.d/75-tty-description.rules b/rules/rules.d/75-tty-description.rules index c2980cfb69..b67c857dfd 100644 --- a/rules/rules.d/75-tty-description.rules +++ b/rules/rules.d/75-tty-description.rules @@ -3,7 +3,7 @@ ACTION=="remove", GOTO="tty_end" SUBSYSTEM!="tty", GOTO="tty_end" -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" SUBSYSTEMS=="usb", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" SUBSYSTEMS=="usb", GOTO="tty_end" diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules index 1c36aeb432..e3a13b598d 100644 --- a/rules/rules.d/78-sound-card.rules +++ b/rules/rules.d/78-sound-card.rules @@ -37,7 +37,7 @@ KERNEL!="card*", GOTO="sound_end" ENV{SOUND_INITIALIZED}="1" -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{program}="usb_id --export %p" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" SUBSYSTEMS=="usb", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" SUBSYSTEMS=="usb", GOTO="skip_pci" @@ -49,7 +49,7 @@ LABEL="skip_pci" ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}-$attr{id}" ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$attr{id}" -ENV{ID_PATH}=="", IMPORT{program}="path_id %p/controlC%n" +IMPORT{builtin}="path_id" # The values used here for $SOUND_FORM_FACTOR and $SOUND_CLASS should be kept # in sync with those defined for PulseAudio's src/pulse/proplist.h diff --git a/test/udev-test.pl b/test/udev-test.pl index 4322da5ecd..b7592efcbd 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -292,7 +292,7 @@ EOF devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node12345678", rules => < "parent", option => "keep", rules => < "builtin path_id", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0", + rules => < + * Portions Copyright (C) 2004 David Zeuthen, + * Copyright (C) 2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +/* we must use this kernel-compatible implementation */ +#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<> OFF(bit)) & 1) + +/* + * Read a capability attribute and return bitmask. + * @param dev udev_device + * @param attr sysfs attribute name (e. g. "capabilities/key") + * @param bitmask: Output array which has a sizeof of bitmask_size + */ +static void get_cap_mask(struct udev_device *dev, + struct udev_device *pdev, const char* attr, + unsigned long *bitmask, size_t bitmask_size, + bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + char text[4096]; + unsigned i; + char* word; + unsigned long val; + + snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(pdev, attr)); + info(udev, "%s raw kernel attribute: %s\n", attr, text); + + memset (bitmask, 0, bitmask_size); + i = 0; + while ((word = strrchr(text, ' ')) != NULL) { + val = strtoul (word+1, NULL, 16); + if (i < bitmask_size/sizeof(unsigned long)) + bitmask[i] = val; + else + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); + *word = '\0'; + ++i; + } + val = strtoul (text, NULL, 16); + if (i < bitmask_size / sizeof(unsigned long)) + bitmask[i] = val; + else + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); + + if (test) { + /* printf pattern with the right unsigned long number of hex chars */ + snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long)); + info(udev, "%s decoded bit map:\n", attr); + val = bitmask_size / sizeof (unsigned long); + /* skip over leading zeros */ + while (bitmask[val-1] == 0 && val > 0) + --val; + for (i = 0; i < val; ++i) + info(udev, text, i * BITS_PER_LONG, bitmask[i]); + } +} + +/* pointer devices */ +static void test_pointers (struct udev_device *dev, + const unsigned long* bitmask_ev, + const unsigned long* bitmask_abs, + const unsigned long* bitmask_key, + const unsigned long* bitmask_rel, + bool test) +{ + int is_mouse = 0; + int is_touchpad = 0; + + if (!test_bit (EV_KEY, bitmask_ev)) { + if (test_bit (EV_ABS, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && + test_bit (ABS_Y, bitmask_abs) && + test_bit (ABS_Z, bitmask_abs)) + udev_builtin_add_property(dev, test, "ID_INPUT_ACCELEROMETER", "1"); + return; + } + + if (test_bit (EV_ABS, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { + if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_TABLET", "1"); + else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) + is_touchpad = 1; + else if (test_bit (BTN_TRIGGER, bitmask_key) || + test_bit (BTN_A, bitmask_key) || + test_bit (BTN_1, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_JOYSTICK", "1"); + else if (test_bit (BTN_MOUSE, bitmask_key)) + /* This path is taken by VMware's USB mouse, which has + * absolute axes, but no touch/pressure button. */ + is_mouse = 1; + else if (test_bit (BTN_TOUCH, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHSCREEN", "1"); + } + + if (test_bit (EV_REL, bitmask_ev) && + test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && + test_bit (BTN_MOUSE, bitmask_key)) + is_mouse = 1; + + if (is_mouse) + udev_builtin_add_property(dev, test, "ID_INPUT_MOUSE", "1"); + if (is_touchpad) + udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHPAD", "1"); +} + +/* key like devices */ +static void test_key (struct udev_device *dev, + const unsigned long* bitmask_ev, + const unsigned long* bitmask_key, + bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + unsigned i; + unsigned long found; + unsigned long mask; + + /* do we have any KEY_* capability? */ + if (!test_bit (EV_KEY, bitmask_ev)) { + info(udev, "test_key: no EV_KEY capability\n"); + return; + } + + /* only consider KEY_* here, not BTN_* */ + found = 0; + for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) { + found |= bitmask_key[i]; + info(udev, "test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); + } + /* If there are no keys in the lower block, check the higher block */ + if (!found) { + for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) { + if (test_bit (i, bitmask_key)) { + info(udev, "test_key: Found key %x in high block\n", i); + found = 1; + break; + } + } + } + + if (found > 0) + udev_builtin_add_property(dev, test, "ID_INPUT_KEY", "1"); + + /* the first 32 bits are ESC, numbers, and Q to D; if we have all of + * those, consider it a full keyboard; do not test KEY_RESERVED, though */ + mask = 0xFFFFFFFE; + if ((bitmask_key[0] & mask) == mask) + udev_builtin_add_property(dev, test, "ID_INPUT_KEYBOARD", "1"); +} + +static int builtin_input_id(struct udev_device *dev, bool test) +{ + struct udev_device *pdev; + unsigned long bitmask_ev[NBITS(EV_MAX)]; + unsigned long bitmask_abs[NBITS(ABS_MAX)]; + unsigned long bitmask_key[NBITS(KEY_MAX)]; + unsigned long bitmask_rel[NBITS(REL_MAX)]; + + /* walk up the parental chain until we find the real input device; the + * argument is very likely a subdevice of this, like eventN */ + pdev = dev; + while (pdev != NULL && udev_device_get_sysattr_value(pdev, "capabilities/ev") == NULL) + pdev = udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); + + /* not an "input" class device */ + if (pdev == NULL) + return EXIT_SUCCESS; + + /* Use this as a flag that input devices were detected, so that this + * program doesn't need to be called more than once per device */ + udev_builtin_add_property(dev, test, "ID_INPUT", "1"); + get_cap_mask(dev, pdev, "capabilities/ev", bitmask_ev, sizeof(bitmask_ev), test); + get_cap_mask(dev, pdev, "capabilities/abs", bitmask_abs, sizeof(bitmask_abs), test); + get_cap_mask(dev, pdev, "capabilities/rel", bitmask_rel, sizeof(bitmask_rel), test); + get_cap_mask(dev, pdev, "capabilities/key", bitmask_key, sizeof(bitmask_key), test); + test_pointers(dev, bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel, test); + test_key(dev, bitmask_ev, bitmask_key, test); + return EXIT_SUCCESS; +} + +const struct udev_builtin udev_builtin_input_id = { + .name = "input_id", + .cmd = builtin_input_id, + .help = "input device properties", +}; diff --git a/udev/udev-builtin-path_id.c b/udev/udev-builtin-path_id.c new file mode 100644 index 0000000000..61c50d77bd --- /dev/null +++ b/udev/udev-builtin-path_id.c @@ -0,0 +1,486 @@ +/* + * compose persistent device path + * + * Copyright (C) 2009-2011 Kay Sievers + * + * Logic based on Hannes Reinecke's shell script. + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int path_prepend(char **path, const char *fmt, ...) +{ + va_list va; + char *pre; + int err = 0; + + va_start(va, fmt); + err = vasprintf(&pre, fmt, va); + va_end(va); + if (err < 0) + goto out; + + if (*path != NULL) { + char *new; + + err = asprintf(&new, "%s-%s", pre, *path); + free(pre); + if (err < 0) + goto out; + free(*path); + *path = new; + } else { + *path = pre; + } +out: + return err; +} + +/* +** Linux only supports 32 bit luns. +** See drivers/scsi/scsi_scan.c::scsilun_to_int() for more details. +*/ +static int format_lun_number(struct udev_device *dev, char **path) +{ + unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10); + + /* address method 0, peripheral device addressing with bus id of zero */ + if (lun < 256) + return path_prepend(path, "lun-%d", lun); + /* handle all other lun addressing methods by using a variant of the original lun format */ + return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff); +} + +static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) +{ + struct udev_device *parent = dev; + + while (parent != NULL) { + const char *subsystem; + + subsystem = udev_device_get_subsystem(parent); + if (subsystem == NULL || strcmp(subsystem, subsys) != 0) + break; + dev = parent; + parent = udev_device_get_parent(parent); + } + return dev; +} + +static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) +{ + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *targetdev; + struct udev_device *fcdev = NULL; + const char *port; + char *lun = NULL;; + + targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); + if (targetdev == NULL) + return NULL; + + fcdev = udev_device_new_from_subsystem_sysname(udev, "fc_transport", udev_device_get_sysname(targetdev)); + if (fcdev == NULL) + return NULL; + port = udev_device_get_sysattr_value(fcdev, "port_name"); + if (port == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "fc-%s-%s", port, lun); + if (lun) + free(lun); +out: + udev_device_unref(fcdev); + return parent; +} + +static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) +{ + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *targetdev; + struct udev_device *target_parent; + struct udev_device *sasdev; + const char *sas_address; + char *lun = NULL; + + targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); + if (targetdev == NULL) + return NULL; + + target_parent = udev_device_get_parent(targetdev); + if (target_parent == NULL) + return NULL; + + sasdev = udev_device_new_from_subsystem_sysname(udev, "sas_device", + udev_device_get_sysname(target_parent)); + if (sasdev == NULL) + return NULL; + + sas_address = udev_device_get_sysattr_value(sasdev, "sas_address"); + if (sas_address == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "sas-%s-%s", sas_address, lun); + if (lun) + free(lun); +out: + udev_device_unref(sasdev); + return parent; +} + +static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) +{ + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *transportdev; + struct udev_device *sessiondev = NULL; + const char *target; + char *connname; + struct udev_device *conndev = NULL; + const char *addr; + const char *port; + char *lun = NULL; + + /* find iscsi session */ + transportdev = parent; + for (;;) { + transportdev = udev_device_get_parent(transportdev); + if (transportdev == NULL) + return NULL; + if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0) + break; + } + + /* find iscsi session device */ + sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev)); + if (sessiondev == NULL) + return NULL; + target = udev_device_get_sysattr_value(sessiondev, "targetname"); + if (target == NULL) { + parent = NULL; + goto out; + } + + if (asprintf(&connname, "connection%s:0", udev_device_get_sysnum(transportdev)) < 0) { + parent = NULL; + goto out; + } + conndev = udev_device_new_from_subsystem_sysname(udev, "iscsi_connection", connname); + free(connname); + if (conndev == NULL) { + parent = NULL; + goto out; + } + addr = udev_device_get_sysattr_value(conndev, "persistent_address"); + port = udev_device_get_sysattr_value(conndev, "persistent_port"); + if (addr == NULL || port == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun); + if (lun) + free(lun); +out: + udev_device_unref(sessiondev); + udev_device_unref(conndev); + return parent; +} + +static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path) +{ + struct udev_device *hostdev; + int host, bus, target, lun; + const char *name; + char *base; + char *pos; + DIR *dir; + struct dirent *dent; + int basenum; + + hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host"); + if (hostdev == NULL) + return NULL; + + name = udev_device_get_sysname(parent); + if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) + return NULL; + + /* rebase host offset to get the local relative number */ + basenum = -1; + base = strdup(udev_device_get_syspath(hostdev)); + if (base == NULL) + return NULL; + pos = strrchr(base, '/'); + if (pos == NULL) { + parent = NULL; + goto out; + } + pos[0] = '\0'; + dir = opendir(base); + if (dir == NULL) { + parent = NULL; + goto out; + } + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char *rest; + int i; + + if (dent->d_name[0] == '.') + continue; + if (dent->d_type != DT_DIR && dent->d_type != DT_LNK) + continue; + if (strncmp(dent->d_name, "host", 4) != 0) + continue; + i = strtoul(&dent->d_name[4], &rest, 10); + if (rest[0] != '\0') + continue; + if (basenum == -1 || i < basenum) + basenum = i; + } + closedir(dir); + if (basenum == -1) { + parent = NULL; + goto out; + } + host -= basenum; + + path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun); +out: + free(base); + return hostdev; +} + +static struct udev_device *handle_scsi(struct udev_device *parent, char **path) +{ + const char *devtype; + const char *name; + const char *id; + + devtype = udev_device_get_devtype(parent); + if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) + return parent; + + /* firewire */ + id = udev_device_get_sysattr_value(parent, "ieee1394_id"); + if (id != NULL) { + parent = skip_subsystem(parent, "scsi"); + path_prepend(path, "ieee1394-0x%s", id); + goto out; + } + + /* lousy scsi sysfs does not have a "subsystem" for the transport */ + name = udev_device_get_syspath(parent); + + if (strstr(name, "/rport-") != NULL) { + parent = handle_scsi_fibre_channel(parent, path); + goto out; + } + + if (strstr(name, "/end_device-") != NULL) { + parent = handle_scsi_sas(parent, path); + goto out; + } + + if (strstr(name, "/session") != NULL) { + parent = handle_scsi_iscsi(parent, path); + goto out; + } + + parent = handle_scsi_default(parent, path); +out: + return parent; +} + +static void handle_scsi_tape(struct udev_device *dev, char **path) +{ + const char *name; + + /* must be the last device in the syspath */ + if (*path != NULL) + return; + + name = udev_device_get_sysname(dev); + if (strncmp(name, "nst", 3) == 0 && strchr("lma", name[3]) != NULL) + path_prepend(path, "nst%c", name[3]); + else if (strncmp(name, "st", 2) == 0 && strchr("lma", name[2]) != NULL) + path_prepend(path, "st%c", name[2]); +} + +static struct udev_device *handle_usb(struct udev_device *parent, char **path) +{ + const char *devtype; + const char *str; + const char *port; + + devtype = udev_device_get_devtype(parent); + if (devtype == NULL) + return parent; + if (strcmp(devtype, "usb_interface") != 0 && strcmp(devtype, "usb_device") != 0) + return parent; + + str = udev_device_get_sysname(parent); + port = strchr(str, '-'); + if (port == NULL) + return parent; + port++; + + parent = skip_subsystem(parent, "usb"); + path_prepend(path, "usb-0:%s", port); + return parent; +} + +static struct udev_device *handle_cciss(struct udev_device *parent, char **path) +{ + return NULL; +} + +static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) +{ + struct udev_device *scsi_dev; + + scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); + if (scsi_dev != NULL) { + const char *wwpn; + const char *lun; + const char *hba_id; + + hba_id = udev_device_get_sysattr_value(scsi_dev, "hba_id"); + wwpn = udev_device_get_sysattr_value(scsi_dev, "wwpn"); + lun = udev_device_get_sysattr_value(scsi_dev, "fcp_lun"); + if (hba_id != NULL && lun != NULL && wwpn != NULL) { + path_prepend(path, "ccw-%s-zfcp-%s:%s", hba_id, wwpn, lun); + goto out; + } + } + + path_prepend(path, "ccw-%s", udev_device_get_sysname(parent)); +out: + parent = skip_subsystem(parent, "ccw"); + return parent; +} + +static int builtin_path_id(struct udev_device *dev, bool test) +{ + struct udev_device *parent; + char *path = NULL; + + /* S390 ccw bus */ + parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); + if (parent != NULL) { + handle_ccw(parent, dev, &path); + goto out; + } + + /* walk up the chain of devices and compose path */ + parent = dev; + while (parent != NULL) { + const char *subsys; + + subsys = udev_device_get_subsystem(parent); + if (subsys == NULL) { + ; + } else if (strcmp(subsys, "scsi_tape") == 0) { + handle_scsi_tape(parent, &path); + } else if (strcmp(subsys, "scsi") == 0) { + parent = handle_scsi(parent, &path); + } else if (strcmp(subsys, "cciss") == 0) { + handle_cciss(parent, &path); + } else if (strcmp(subsys, "usb") == 0) { + parent = handle_usb(parent, &path); + } else if (strcmp(subsys, "serio") == 0) { + path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); + parent = skip_subsystem(parent, "serio"); + } else if (strcmp(subsys, "pci") == 0) { + path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "pci"); + } else if (strcmp(subsys, "platform") == 0) { + path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "platform"); + } else if (strcmp(subsys, "acpi") == 0) { + path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "acpi"); + } else if (strcmp(subsys, "xen") == 0) { + path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "xen"); + } else if (strcmp(subsys, "virtio") == 0) { + path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "virtio"); + } + + parent = udev_device_get_parent(parent); + } +out: + if (path != NULL) { + char tag[UTIL_NAME_SIZE]; + size_t i; + const char *p; + + /* compose valid udev tag name */ + for (p = path, i = 0; *p; p++) { + if ((*p >= '0' && *p <= '9') || + (*p >= 'A' && *p <= 'Z') || + (*p >= 'a' && *p <= 'z') || + *p == '-') { + tag[i++] = *p; + continue; + } + + /* skip all leading '_' */ + if (i == 0) + continue; + + /* avoid second '_' */ + if (tag[i-1] == '_') + continue; + + tag[i++] = '_'; + } + /* strip trailing '_' */ + while (i > 0 && tag[i-1] == '_') + i--; + tag[i] = '\0'; + + udev_builtin_add_property(dev, test, "ID_PATH", path); + udev_builtin_add_property(dev, test, "ID_PATH_TAG", tag); + free(path); + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} + +const struct udev_builtin udev_builtin_path_id = { + .name = "path_id", + .cmd = builtin_path_id, + .help = "compose persistent device path", +}; diff --git a/udev/udev-builtin-usb_id.c b/udev/udev-builtin-usb_id.c new file mode 100644 index 0000000000..95368ecf22 --- /dev/null +++ b/udev/udev-builtin-usb_id.c @@ -0,0 +1,482 @@ +/* + * USB device properties and persistent device path + * + * Copyright (c) 2005 SUSE Linux Products GmbH, Germany + * Author: Hannes Reinecke + * + * Copyright (C) 2005-2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static char vendor_str[64]; +static char vendor_str_enc[256]; +static const char *vendor_id = ""; +static char model_str[64]; +static char model_str_enc[256]; +static const char *product_id = ""; +static char serial_str[UTIL_NAME_SIZE]; +static char packed_if_str[UTIL_NAME_SIZE]; +static char revision_str[64]; +static char type_str[64]; +static char instance_str[64]; +static const char *ifnum; +static const char *driver; + +static void set_usb_iftype(char *to, int if_class_num, size_t len) +{ + char *type = "generic"; + + switch (if_class_num) { + case 1: + type = "audio"; + break; + case 2: /* CDC-Control */ + break; + case 3: + type = "hid"; + break; + case 5: /* Physical */ + break; + case 6: + type = "media"; + break; + case 7: + type = "printer"; + break; + case 8: + type = "storage"; + break; + case 9: + type = "hub"; + break; + case 0x0a: /* CDC-Data */ + break; + case 0x0b: /* Chip/Smart Card */ + break; + case 0x0d: /* Content Security */ + break; + case 0x0e: + type = "video"; + break; + case 0xdc: /* Diagnostic Device */ + break; + case 0xe0: /* Wireless Controller */ + break; + case 0xfe: /* Application-specific */ + break; + case 0xff: /* Vendor-specific */ + break; + default: + break; + } + strncpy(to, type, len); + to[len-1] = '\0'; +} + +static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len) +{ + int type_num = 0; + char *eptr; + char *type = "generic"; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 2: + type = "atapi"; + break; + case 3: + type = "tape"; + break; + case 4: /* UFI */ + case 5: /* SFF-8070i */ + type = "floppy"; + break; + case 1: /* RBC devices */ + type = "rbc"; + break; + case 6: /* Transparent SPC-2 devices */ + type = "scsi"; + break; + default: + break; + } + } + util_strscpy(to, len, type); + return type_num; +} + +static void set_scsi_type(char *to, const char *from, size_t len) +{ + int type_num; + char *eptr; + char *type = "generic"; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 0: + case 0xe: + type = "disk"; + break; + case 1: + type = "tape"; + break; + case 4: + case 7: + case 0xf: + type = "optical"; + break; + case 5: + type = "cd"; + break; + default: + break; + } + } + util_strscpy(to, len, type); +} + +#define USB_DT_DEVICE 0x01 +#define USB_DT_INTERFACE 0x04 + +static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len) +{ + char *filename = NULL; + int fd; + ssize_t size; + unsigned char buf[18 + 65535]; + unsigned int pos, strpos; + struct usb_interface_descriptor { + u_int8_t bLength; + u_int8_t bDescriptorType; + u_int8_t bInterfaceNumber; + u_int8_t bAlternateSetting; + u_int8_t bNumEndpoints; + u_int8_t bInterfaceClass; + u_int8_t bInterfaceSubClass; + u_int8_t bInterfaceProtocol; + u_int8_t iInterface; + } __attribute__((packed)); + int err = 0; + + if (asprintf(&filename, "%s/descriptors", udev_device_get_syspath(dev)) < 0) { + err = -1; + goto out; + } + fd = open(filename, O_RDONLY|O_CLOEXEC); + if (fd < 0) { + fprintf(stderr, "error opening USB device 'descriptors' file\n"); + err = -1; + goto out; + } + size = read(fd, buf, sizeof(buf)); + close(fd); + if (size < 18 || size == sizeof(buf)) { + err = -1; + goto out; + } + + pos = 0; + strpos = 0; + ifs_str[0] = '\0'; + while (pos < sizeof(buf) && strpos+7 < len-2) { + struct usb_interface_descriptor *desc; + char if_str[8]; + + desc = (struct usb_interface_descriptor *) &buf[pos]; + if (desc->bLength < 3) + break; + pos += desc->bLength; + + if (desc->bDescriptorType != USB_DT_INTERFACE) + continue; + + if (snprintf(if_str, 8, ":%02x%02x%02x", + desc->bInterfaceClass, + desc->bInterfaceSubClass, + desc->bInterfaceProtocol) != 7) + continue; + + if (strstr(ifs_str, if_str) != NULL) + continue; + + memcpy(&ifs_str[strpos], if_str, 8), + strpos += 7; + } + if (strpos > 0) { + ifs_str[strpos++] = ':'; + ifs_str[strpos++] = '\0'; + } +out: + free(filename); + return err; +} + +/* + * A unique USB identification is generated like this: + * + * 1.) Get the USB device type from InterfaceClass and InterfaceSubClass + * 2.) If the device type is 'Mass-Storage/SPC-2' or 'Mass-Storage/RBC' + * use the SCSI vendor and model as USB-Vendor and USB-model. + * 3.) Otherwise use the USB manufacturer and product as + * USB-Vendor and USB-model. Any non-printable characters + * in those strings will be skipped; a slash '/' will be converted + * into a full stop '.'. + * 4.) If that fails, too, we will use idVendor and idProduct + * as USB-Vendor and USB-model. + * 5.) The USB identification is the USB-vendor and USB-model + * string concatenated with an underscore '_'. + * 6.) If the device supplies a serial number, this number + * is concatenated with the identification with an underscore '_'. + */ +static int usb_id(struct udev_device *dev) +{ + struct udev *udev = udev_device_get_udev(dev); + struct udev_device *dev_interface = NULL; + struct udev_device *dev_usb = NULL; + const char *if_class, *if_subclass; + int if_class_num; + int protocol = 0; + + dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); + + /* shortcut, if we are called directly for a "usb_device" type */ + if (udev_device_get_devtype(dev) != NULL && strcmp(udev_device_get_devtype(dev), "usb_device") == 0) { + dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str)); + dev_usb = dev; + goto fallback; + } + + /* usb interface directory */ + dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface"); + if (dev_interface == NULL) { + info(udev, "unable to access usb_interface device of '%s'\n", + udev_device_get_syspath(dev)); + return 1; + } + + ifnum = udev_device_get_sysattr_value(dev_interface, "bInterfaceNumber"); + driver = udev_device_get_sysattr_value(dev_interface, "driver"); + + if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass"); + if (!if_class) { + info(udev, "%s: cannot get bInterfaceClass attribute\n", + udev_device_get_sysname(dev)); + return 1; + } + + if_class_num = strtoul(if_class, NULL, 16); + if (if_class_num == 8) { + /* mass storage */ + if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass"); + if (if_subclass != NULL) + protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); + } else { + set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1); + } + + info(udev, "%s: if_class %d protocol %d\n", + udev_device_get_syspath(dev_interface), if_class_num, protocol); + + /* usb device directory */ + dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", "usb_device"); + if (!dev_usb) { + info(udev, "unable to find parent 'usb' device of '%s'\n", + udev_device_get_syspath(dev)); + return 1; + } + + /* all interfaces of the device in a single string */ + dev_if_packed_info(dev_usb, packed_if_str, sizeof(packed_if_str)); + + /* mass storage : SCSI or ATAPI */ + if ((protocol == 6 || protocol == 2)) { + struct udev_device *dev_scsi; + const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; + int host, bus, target, lun; + + /* get scsi device */ + dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); + if (dev_scsi == NULL) { + info(udev, "unable to find parent 'scsi' device of '%s'\n", + udev_device_get_syspath(dev)); + goto fallback; + } + if (sscanf(udev_device_get_sysname(dev_scsi), "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { + info(udev, "invalid scsi device '%s'\n", udev_device_get_sysname(dev_scsi)); + goto fallback; + } + + /* Generic SPC-2 device */ + scsi_vendor = udev_device_get_sysattr_value(dev_scsi, "vendor"); + if (!scsi_vendor) { + info(udev, "%s: cannot get SCSI vendor attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); + udev_util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); + udev_util_replace_chars(vendor_str, NULL); + + scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); + if (!scsi_model) { + info(udev, "%s: cannot get SCSI model attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc)); + udev_util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); + udev_util_replace_chars(model_str, NULL); + + scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); + if (!scsi_type) { + info(udev, "%s: cannot get SCSI type attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); + + scsi_rev = udev_device_get_sysattr_value(dev_scsi, "rev"); + if (!scsi_rev) { + info(udev, "%s: cannot get SCSI revision attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + udev_util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); + udev_util_replace_chars(revision_str, NULL); + + /* + * some broken devices have the same identifiers + * for all luns, export the target:lun number + */ + sprintf(instance_str, "%d:%d", target, lun); + } + +fallback: + vendor_id = udev_device_get_sysattr_value(dev_usb, "idVendor"); + product_id = udev_device_get_sysattr_value(dev_usb, "idProduct"); + + /* fallback to USB vendor & device */ + if (vendor_str[0] == '\0') { + const char *usb_vendor = NULL; + + usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); + if (!usb_vendor) + usb_vendor = vendor_id; + if (!usb_vendor) { + info(udev, "No USB vendor information available\n"); + return 1; + } + udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); + udev_util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); + udev_util_replace_chars(vendor_str, NULL); + } + + if (model_str[0] == '\0') { + const char *usb_model = NULL; + + usb_model = udev_device_get_sysattr_value(dev_usb, "product"); + if (!usb_model) + usb_model = product_id; + if (!usb_model) { + dbg(udev, "No USB model information available\n"); + return 1; + } + udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); + udev_util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); + udev_util_replace_chars(model_str, NULL); + } + + if (revision_str[0] == '\0') { + const char *usb_rev; + + usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); + if (usb_rev) { + udev_util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); + udev_util_replace_chars(revision_str, NULL); + } + } + + if (serial_str[0] == '\0') { + const char *usb_serial; + + usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); + if (usb_serial) { + udev_util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); + udev_util_replace_chars(serial_str, NULL); + } + } + return 0; +} + +static int builtin_usb_id(struct udev_device *dev, bool test) +{ + char serial[256]; + size_t l; + char *s; + int err; + + err = usb_id(dev); + if (err) + return EXIT_FAILURE; + + s = serial; + l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); + if (serial_str[0] != '\0') + l = util_strpcpyl(&s, l, "_", serial_str, NULL); + if (instance_str[0] != '\0') + util_strpcpyl(&s, l, "-", instance_str, NULL); + + udev_builtin_add_property(dev, test, "ID_VENDOR", vendor_str); + udev_builtin_add_property(dev, test, "ID_VENDOR_ENC", vendor_str_enc); + udev_builtin_add_property(dev, test, "ID_VENDOR_ID", vendor_id); + udev_builtin_add_property(dev, test, "ID_MODEL", model_str); + udev_builtin_add_property(dev, test, "ID_MODEL_ENC", model_str_enc); + udev_builtin_add_property(dev, test, "ID_MODEL_ID", product_id); + udev_builtin_add_property(dev, test, "ID_REVISION", revision_str); + udev_builtin_add_property(dev, test, "ID_SERIAL", serial); + if (serial_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_SERIAL_SHORT", serial_str); + if (type_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_TYPE", type_str); + if (instance_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_INSTANCE", instance_str); + udev_builtin_add_property(dev, test, "ID_BUS", "usb"); + if (packed_if_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_USB_INTERFACES", packed_if_str); + if (ifnum != NULL) + udev_builtin_add_property(dev, test, "ID_USB_INTERFACE_NUM", ifnum); + if (driver != NULL) + udev_builtin_add_property(dev, test, "ID_USB_DRIVER", driver); + return EXIT_SUCCESS; +} + +const struct udev_builtin udev_builtin_usb_id = { + .name = "usb_id", + .cmd = builtin_usb_id, + .help = "usb device properties", +}; diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c new file mode 100644 index 0000000000..eeec6e990d --- /dev/null +++ b/udev/udev-builtin.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007-2009 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static const struct udev_builtin *builtins[] = { + [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, + [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, + [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, +}; + +int udev_builtin_list(struct udev *udev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + fprintf(stderr, " %-12s %s\n", builtins[i]->name, builtins[i]->help); + return 0; +} + +const char *udev_builtin_name(enum udev_builtin_cmd cmd) +{ + return builtins[cmd]->name; +} + +enum udev_builtin_cmd udev_builtin_lookup(const char *name) +{ + enum udev_builtin_cmd i; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (strcmp(builtins[i]->name, name) == 0) + return i; + return UDEV_BUILTIN_MAX; +} + +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, bool test) +{ + return builtins[cmd]->cmd(dev, test); +} + +int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...) +{ + struct udev_list_entry *entry; + + entry = udev_device_add_property(dev, key, val); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_num(entry, true); + + info(udev_device_get_udev(dev), "%s=%s\n", key, val); + if (test) + printf("%s=%s\n", key, val); + return 0; +} diff --git a/udev/udev-rules.c b/udev/udev-rules.c index f345e8977d..742d88b3d5 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -144,6 +144,7 @@ enum token_type { TK_M_PROGRAM, /* val */ TK_M_IMPORT_FILE, /* val */ TK_M_IMPORT_PROG, /* val */ + TK_M_IMPORT_BUILTIN, /* val */ TK_M_IMPORT_DB, /* val */ TK_M_IMPORT_CMDLINE, /* val */ TK_M_IMPORT_PARENT, /* val */ @@ -205,6 +206,7 @@ struct token { int devlink_prio; int event_timeout; int watch; + enum udev_builtin_cmd builtin_cmd; }; } key; }; @@ -280,6 +282,7 @@ static const char *token_str(enum token_type type) [TK_M_PROGRAM] = "M PROGRAM", [TK_M_IMPORT_FILE] = "M IMPORT_FILE", [TK_M_IMPORT_PROG] = "M IMPORT_PROG", + [TK_M_IMPORT_BUILTIN] = "M IMPORT_BUILTIN", [TK_M_IMPORT_DB] = "M IMPORT_DB", [TK_M_IMPORT_CMDLINE] = "M IMPORT_CMDLINE", [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", @@ -361,6 +364,9 @@ static void dump_token(struct udev_rules *rules, struct token *token) dbg(rules->udev, "%s %s '%s'(%s)\n", token_str(type), operation_str(op), value, string_glob_str(glob)); break; + case TK_M_IMPORT_BUILTIN: + dbg(rules->udev, "%s %i\n", token_str(type), token->key.builtin_cmd); + break; case TK_M_ATTR: case TK_M_ATTRS: case TK_M_ENV: @@ -1033,6 +1039,9 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, case TK_A_TAG: token->key.value_off = add_string(rule_tmp->rules, value); break; + case TK_M_IMPORT_BUILTIN: + token->key.builtin_cmd = *(enum udev_builtin_cmd *)data; + break; case TK_M_ENV: case TK_M_ATTR: case TK_M_ATTRS: @@ -1435,43 +1444,50 @@ static int add_rule(struct udev_rules *rules, char *line, if (strncmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1); - if (attr != NULL && strstr(attr, "program")) { + if (attr == NULL) { + err(rules->udev, "IMPORT{} type missing, ignoring IMPORT %s:%u\n", filename, lineno); + continue; + } + if (strstr(attr, "program")) { + /* find known built-in command */ + if (value[0] != '/') { + char file[UTIL_PATH_SIZE]; + char *pos; + enum udev_builtin_cmd cmd; + + util_strscpy(file, sizeof(file), value); + pos = strchr(file, ' '); + if (pos) + pos[0] = '\0'; + cmd = udev_builtin_lookup(file); + if (cmd < UDEV_BUILTIN_MAX) { + info(rules->udev, "IMPORT found builtin '%s', replacing %s:%u\n", file, filename, lineno); + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, NULL, &cmd); + continue; + } + } dbg(rules->udev, "IMPORT will be executed\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); - } else if (attr != NULL && strstr(attr, "file")) { + } else if (strstr(attr, "builtin")) { + enum udev_builtin_cmd cmd = udev_builtin_lookup(value); + + dbg(rules->udev, "IMPORT execute builtin\n"); + if (cmd < UDEV_BUILTIN_MAX) + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, NULL, &cmd); + else + err(rules->udev, "IMPORT{builtin}: '%s' unknown %s:%u\n", value, filename, lineno); + } else if (strstr(attr, "file")) { dbg(rules->udev, "IMPORT will be included as file\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); - } else if (attr != NULL && strstr(attr, "db")) { + } else if (strstr(attr, "db")) { dbg(rules->udev, "IMPORT will include db values\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_DB, op, value, NULL); - } else if (attr != NULL && strstr(attr, "cmdline")) { + } else if (strstr(attr, "cmdline")) { dbg(rules->udev, "IMPORT will include db values\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_CMDLINE, op, value, NULL); - } else if (attr != NULL && strstr(attr, "parent")) { + } else if (strstr(attr, "parent")) { dbg(rules->udev, "IMPORT will include the parent values\n"); rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); - } else { - /* figure it out if it is executable */ - char file[UTIL_PATH_SIZE]; - char *pos; - struct stat statbuf; - - /* allow programs in /lib/udev called without the path */ - if (value[0] != '/') - util_strscpyl(file, sizeof(file), LIBEXECDIR "/", value, NULL); - else - util_strscpy(file, sizeof(file), value); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - dbg(rules->udev, "IMPORT auto mode for '%s'\n", file); - if (stat(file, &statbuf) == 0 && (statbuf.st_mode & S_IXUSR)) { - dbg(rules->udev, "IMPORT will be executed (autotype)\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); - } else { - dbg(rules->udev, "IMPORT will be included as file (autotype)\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); - } } continue; } @@ -2349,6 +2365,35 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event goto nomatch; break; } + case TK_M_IMPORT_BUILTIN: { + /* check if we ran already */ + if (event->builtin_run & (1 << cur->key.builtin_cmd)) { + info(event->udev, "IMPORT builtin skip '%s' %s:%u\n", + udev_builtin_name(cur->key.builtin_cmd), + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + /* return the result from earlier run */ + if (event->builtin_ret & (1 << cur->key.builtin_cmd)) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + /* mark as ran */ + event->builtin_run |= (1 << cur->key.builtin_cmd); + info(event->udev, "IMPORT builtin '%s' %s:%u\n", + udev_builtin_name(cur->key.builtin_cmd), + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + if (udev_builtin_run(event->dev, cur->key.builtin_cmd, false) != 0) { + /* remember failure */ + info(rules->udev, "IMPORT builtin '%s' returned non-zero\n", + udev_builtin_name(cur->key.builtin_cmd)); + event->builtin_ret |= (1 << cur->key.builtin_cmd); + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } + break; + } case TK_M_IMPORT_DB: { const char *key = &rules->buf[cur->key.value_off]; const char *value; diff --git a/udev/udev.h b/udev/udev.h index c1e2814504..1f9650fc42 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -44,6 +44,8 @@ struct udev_event { unsigned long long birth_usec; unsigned long long timeout_usec; int fd_signal; + unsigned int builtin_run; + unsigned int builtin_ret; bool sigterm; bool inotify_watch; bool inotify_watch_final; @@ -141,4 +143,27 @@ extern const struct udevadm_cmd udevadm_control; extern const struct udevadm_cmd udevadm_trigger; extern const struct udevadm_cmd udevadm_settle; extern const struct udevadm_cmd udevadm_test; +extern const struct udevadm_cmd udevadm_test_builtin; + +/* built-in commands */ +enum udev_builtin_cmd { + UDEV_BUILTIN_PATH_ID, + UDEV_BUILTIN_USB_ID, + UDEV_BUILTIN_INPUT_ID, + UDEV_BUILTIN_MODALIAS_MATCH, + UDEV_BUILTIN_MAX +}; +struct udev_builtin { + const char *name; + int (*cmd)(struct udev_device *dev, bool test); + const char *help; +}; +extern const struct udev_builtin udev_builtin_path_id; +extern const struct udev_builtin udev_builtin_usb_id; +extern const struct udev_builtin udev_builtin_input_id; +enum udev_builtin_cmd udev_builtin_lookup(const char *name); +const char *udev_builtin_name(enum udev_builtin_cmd cmd); +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, bool test); +int udev_builtin_list(struct udev *udev); +int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...); #endif diff --git a/udev/udev.xml b/udev/udev.xml index abbfee7ad1..a785348551 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -463,9 +463,6 @@ - If no option is given, udev chooses between - and based on the executable bit of the file - permissions. diff --git a/udev/udevadm-test-builtin.c b/udev/udevadm-test-builtin.c new file mode 100644 index 0000000000..a2be77683a --- /dev/null +++ b/udev/udevadm-test-builtin.c @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static void help(struct udev *udev) +{ + fprintf(stderr, "\n"); + fprintf(stderr, "Usage: udevadm builtin [--help] \n"); + udev_builtin_list(udev); + fprintf(stderr, "\n"); +} + +static int adm_builtin(struct udev *udev, int argc, char *argv[]) +{ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + {} + }; + char *command = NULL; + char *syspath = NULL; + char filename[UTIL_PATH_SIZE]; + struct udev_device *dev = NULL; + enum udev_builtin_cmd cmd; + int rc = EXIT_SUCCESS; + + dbg(udev, "version %s\n", VERSION); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + help(udev); + goto out; + } + } + command = argv[optind++]; + if (command == NULL) { + fprintf(stderr, "command missing\n"); + help(udev); + rc = 2; + goto out; + } + + syspath = argv[optind++]; + if (syspath == NULL) { + fprintf(stderr, "syspath missing\n\n"); + rc = 3; + goto out; + } + + /* add /sys if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); + else + util_strscpy(filename, sizeof(filename), syspath); + util_remove_trailing_chars(filename, '/'); + + dev = udev_device_new_from_syspath(udev, filename); + if (dev == NULL) { + fprintf(stderr, "unable to open device '%s'\n\n", filename); + rc = 4; + goto out; + } + + cmd = udev_builtin_lookup(command); + if (cmd >= UDEV_BUILTIN_MAX) { + fprintf(stderr, "unknown command '%s'\n", command); + help(udev); + rc = 5; + goto out; + } + + if (udev_builtin_run(dev, cmd, true) < 0) { + fprintf(stderr, "error executing '%s'\n\n", command); + rc = 6; + } +out: + udev_device_unref(dev); + return rc; +} + +const struct udevadm_cmd udevadm_test_builtin = { + .name = "test-builtin", + .cmd = adm_builtin, + .help = "test a built-in command", +}; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index c2c377c3d7..e807fc05a6 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -165,6 +165,6 @@ out: const struct udevadm_cmd udevadm_test = { .name = "test", .cmd = adm_test, - .help = "simulation run", + .help = "test an event run", .debug = true, }; diff --git a/udev/udevadm.c b/udev/udevadm.c index d3810e73e0..178981eb3e 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -67,6 +67,7 @@ static const struct udevadm_cmd *udevadm_cmds[] = { &udevadm_control, &udevadm_monitor, &udevadm_test, + &udevadm_test_builtin, &udevadm_version, &udevadm_help, }; @@ -75,11 +76,11 @@ static int adm_help(struct udev *udev, int argc, char *argv[]) { unsigned int i; - printf("Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); + fprintf(stderr, "Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) if (udevadm_cmds[i]->help != NULL) printf(" %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help); - printf("\n"); + fprintf(stderr, "\n"); return 0; } diff --git a/udev/udevadm.xml b/udev/udevadm.xml index a106093569..2fdbb42b2b 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -44,6 +44,9 @@ udevadm test options devpath + + udevadm test-builtin options command devpath + Description @@ -440,6 +443,18 @@ + + udevadm test-builtin <optional>options</optional> <replaceable>command</replaceable> <replaceable>devpath</replaceable> + Run a built-in command for the given device, and print debug output. + + + + + Print help text. + + + + Author -- cgit v1.2.3-54-g00ecf From 2a30eaa452ad614c1957735fef47a7bc200db9cd Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 8 Aug 2011 11:00:59 +0200 Subject: keymap: Update Acer Aspire 5920g https://launchpad.net/bugs/637695 --- extras/keymap/keymaps/acer-aspire_5920g | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extras/keymap/keymaps/acer-aspire_5920g b/extras/keymap/keymaps/acer-aspire_5920g index 655cc33db4..633c4e854c 100644 --- a/extras/keymap/keymaps/acer-aspire_5920g +++ b/extras/keymap/keymaps/acer-aspire_5920g @@ -1,4 +1,5 @@ 0x8A media -0xB2 www 0x92 media +0xA6 setup +0xB2 www 0xD9 bluetooth # (toggle) on-to-off -- cgit v1.2.3-54-g00ecf From 79449642ebcb6170adb8d6391518e328a07d9552 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 11 Aug 2011 20:33:17 +0200 Subject: do not remove static nodes on module unload --- udev/udev-event.c | 4 ++++ udev/udev-node.c | 5 +++++ udev/udev-rules.c | 14 ++++++++++---- udev/udev.h | 1 + udev/udevd.c | 5 +++-- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 823768a3e2..391fce81c3 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -1030,6 +1030,10 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, } } + /* set sticky bit, so we do not remove the node on module unload */ + if (event->static_node) + event->mode |= 01000; + err = udev_node_add(dev, event->mode, event->uid, event->gid); } diff --git a/udev/udev-node.c b/udev/udev-node.c index dc7d9c365a..6fbe250b85 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -425,6 +425,11 @@ int udev_node_remove(struct udev_device *dev) goto out; } + if (stats.st_mode & 01000) { + info(udev, "device node '%s' has sticky bit set, skip removal\n", devnode); + goto out; + } + dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); if (dev_check != NULL) { /* do not remove device node if the same sys-device is re-created in the meantime */ diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 742d88b3d5..6bf2726e1e 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2572,6 +2572,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event rule->rule.filename_line); break; case TK_A_STATIC_NODE: + event->static_node = true; break; case TK_A_ENV: { const char *name = &rules->buf[cur->key.attr_off]; @@ -2793,10 +2794,15 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules) goto next; if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) goto next; - - if (mode == 0 && gid > 0) - mode = 0660; - if (mode != (stats.st_mode & 0777)) { + if (mode == 0) { + if (gid > 0) + mode = 0660; + else + mode = 0600; + } + /* set sticky bit, so we do not remove the node on module unload */ + mode |= 01000; + if (mode != (stats.st_mode & 01777)) { chmod(filename, mode); info(rules->udev, "chmod '%s' %#o\n", filename, mode); } diff --git a/udev/udev.h b/udev/udev.h index 1f9650fc42..5aaf117a9c 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -53,6 +53,7 @@ struct udev_event { bool owner_final; bool mode_set; bool mode_final; + bool static_node; bool name_final; bool devlink_final; bool run_final; diff --git a/udev/udevd.c b/udev/udevd.c index 1220deaaa6..f1a31e7afb 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -889,10 +889,11 @@ static void static_dev_create_from_modules(struct udev *udev) if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3) continue; + /* set sticky bit, so we do not remove the node on module unload */ if (type == 'c') - mode = 0600 | S_IFCHR; + mode = 01600|S_IFCHR; else if (type == 'b') - mode = 0600 | S_IFBLK; + mode = 01600|S_IFBLK; else continue; -- cgit v1.2.3-54-g00ecf From d132be4d58e0564eab41d724738e75e52813fa68 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 12 Aug 2011 14:05:19 +0200 Subject: rules: remove legacy rules for cdrom and usb printer --- rules/rules.d/50-udev-default.rules | 2 -- 1 file changed, 2 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 7c4046284e..684cda9b58 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -59,7 +59,6 @@ SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id" KERNEL=="parport[0-9]*", GROUP="lp" SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" SUBSYSTEM=="ppdev", GROUP="lp" -SUBSYSTEM=="usb", KERNEL=="lp*", SYMLINK+="usb%k", GROUP="lp" KERNEL=="lp[0-9]*", GROUP="lp" KERNEL=="irlpt[0-9]*", GROUP="lp" SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="lp" @@ -71,7 +70,6 @@ SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy" # cdrom -SUBSYSTEM=="block", KERNEL=="sr[0-9]*", SYMLINK+="scd%n", GROUP="cdrom" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd", GROUP="cdrom" -- cgit v1.2.3-54-g00ecf From 38f6aefc47799f6ba313621661ecef833a01e0d9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 12 Aug 2011 14:05:54 +0200 Subject: update TODO --- TODO | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index e83deb4aa1..3e013c99be 100644 --- a/TODO +++ b/TODO @@ -1,25 +1,13 @@ - - sticky bit for 'dead' pre-created devnodes - - - have a $attrs{} ? - - test (now fixed) /dev/tape/ links - - warn about fallback of IMPORT{program} for built-in commands - - /run/udev/control socket (add ConditionVirtualization=!pidns) - move udevd -> --libexecdir - - allow path_id, usb_id, usb_db, pci_db as built-in? + - have a $attrs{} ? - - kill rules_generator: - - no longer rename netifs in kernel namespace - - drop persistent optical names - - do not create rules on-the-fly, require explicit configuration - for netifs and optical drives - - properly document what system management needs to put - into rules files + - kill rules_generator - move udevadm -> --bindir @@ -27,8 +15,10 @@ - remove deprecated BUS=, SYSFS{}=, ID= keys - - remove RUN+="socket:" - - kill tabs? - - libudev: return proper errno or set errno + - warn about RUN+="socket:" + + - libudev.so.1 with symbol versioning: + - return object with *_unref() + - udev_monitor_from_socket() -- cgit v1.2.3-54-g00ecf From b3e44c5291f60c0d70af941514ab58c8d31f14a7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 14 Aug 2011 19:04:16 +0200 Subject: preserve 'sticky bit' on 'add/change' events --- udev/udev-node.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 6fbe250b85..71488c93ad 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -52,7 +52,9 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ if (lstat(file, &stats) == 0) { if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) { info(udev, "preserve file '%s', because it has correct dev_t\n", file); - if (stats.st_mode != mode || stats.st_uid != uid || stats.st_gid != gid) { + if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { + /* preserve 'sticky' bit, if already set */ + mode |= stats.st_mode & 01000; info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); chmod(file, mode); chown(file, uid, gid); -- cgit v1.2.3-54-g00ecf From ac03072310d66f36da3d2a2f97df8c06095fc47e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 16 Aug 2011 16:21:42 +0200 Subject: make: allow to pass ${ACLOCAL_FLAGS} --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 563b09b97b..534756903e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ SUBDIRS = . EXTRA_DIST = autogen.sh -ACLOCAL_AMFLAGS = -I m4 +ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} AM_MAKEFLAGS = --no-print-directory -- cgit v1.2.3-54-g00ecf From cdfdc85fb5728c844460c67641bea7197e104b12 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Aug 2011 21:03:05 +0200 Subject: libudev: util_get_sys_(subsystem,driver}() -> util_get_sys_core_link_value() --- libudev/libudev-device.c | 4 ++-- libudev/libudev-private.h | 3 +-- libudev/libudev-util.c | 12 +----------- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 76354dc7a7..273e5cb59c 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -229,7 +229,7 @@ UDEV_EXPORT const char *udev_device_get_driver(struct udev_device *udev_device) return NULL; if (!udev_device->driver_set) { udev_device->driver_set = true; - if (util_get_sys_driver(udev_device->udev, udev_device->syspath, driver, sizeof(driver)) > 0) + if (util_get_sys_core_link_value(udev_device->udev, "driver", udev_device->syspath, driver, sizeof(driver)) > 0) udev_device->driver = strdup(driver); } return udev_device->driver; @@ -305,7 +305,7 @@ UDEV_EXPORT const char *udev_device_get_subsystem(struct udev_device *udev_devic if (!udev_device->subsystem_set) { udev_device->subsystem_set = true; /* read "subsystem" link */ - if (util_get_sys_subsystem(udev_device->udev, udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { + if (util_get_sys_core_link_value(udev_device->udev, "subsystem", udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { udev_device_set_subsystem(udev_device, subsystem); return udev_device->subsystem; } diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 157575c1ff..2873b4d2c7 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -172,8 +172,7 @@ int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, #define UTIL_NAME_SIZE 512 #define UTIL_LINE_SIZE 16384 #define UDEV_ALLOWED_CHARS_INPUT "/ $%?," -ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size); -ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size); +ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size); int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); int util_log_priority(const char *priority); size_t util_path_encode(const char *src, char *dest, size_t size); diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index 48eea0b898..a600b0a881 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -24,7 +24,7 @@ #include "libudev.h" #include "libudev-private.h" -static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) +ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) { char path[UTIL_PATH_SIZE]; char target[UTIL_PATH_SIZE]; @@ -44,16 +44,6 @@ static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *sy return util_strscpy(value, size, pos); } -ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size) -{ - return get_sys_link(udev, "subsystem", syspath, subsystem, size); -} - -ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size) -{ - return get_sys_link(udev, "driver", syspath, driver, size); -} - int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) { char link_target[UTIL_PATH_SIZE]; -- cgit v1.2.3-54-g00ecf From a20a57a7bfbc6edd7602c135ca78f3e56878badb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Aug 2011 21:05:18 +0200 Subject: export USEC_INITIALIZED= and take timestamp on message receive time --- libudev/libudev-device.c | 6 ++++++ udev/udev-event.c | 2 +- udev/udevd.c | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 273e5cb59c..064ffad9bf 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -437,6 +437,8 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, udev_device_add_tag(udev_device, tag); } } + } else if (strncmp(property, "USEC_INITIALIZED=", 19) == 0) { + udev_device_set_usec_initialized(udev_device, strtoull(&property[19], NULL, 10)); } else if (strncmp(property, "DRIVER=", 7) == 0) { udev_device_set_driver(udev_device, &property[7]); } else if (strncmp(property, "ACTION=", 7) == 0) { @@ -1322,7 +1324,11 @@ unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_dev void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized) { + char num[32]; + udev_device->usec_initialized = usec_initialized; + snprintf(num, sizeof(num), "%llu", usec_initialized); + udev_device_add_property(udev_device, "USEC_INITIALIZED", num); } /** diff --git a/udev/udev-event.c b/udev/udev-event.c index 391fce81c3..3c1a3e7aa7 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -1040,7 +1040,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, /* preserve old, or get new initialization timestamp */ if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0) udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db)); - else + else if (udev_device_get_usec_initialized(event->dev) == 0) udev_device_set_usec_initialized(event->dev, now_usec()); /* (re)write database file */ diff --git a/udev/udevd.c b/udev/udevd.c index f1a31e7afb..325ad034c2 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1655,6 +1655,7 @@ int main(int argc, char *argv[]) dev = udev_monitor_receive_device(monitor); if (dev != NULL) + udev_device_set_usec_initialized(dev, now_usec()); if (event_queue_insert(dev) < 0) udev_device_unref(dev); } -- cgit v1.2.3-54-g00ecf From 2fdaa983a958822d79821c1afe51e22e7a3e00ff Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 17 Aug 2011 21:07:09 +0200 Subject: libudev: udev_device_get_sysattr_value() return syspath of custom links --- libudev/libudev-device.c | 39 ++++++++++++++++++++++----------------- udev/udevadm-info.c | 6 +++++- 2 files changed, 27 insertions(+), 18 deletions(-) diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 064ffad9bf..991398c76d 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -1373,27 +1373,32 @@ UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_d } if (S_ISLNK(statbuf.st_mode)) { - char target[UTIL_NAME_SIZE]; - int len; - char *pos; - - /* some core links return the last element of the target path */ - if (strcmp(sysattr, "driver") != 0 && - strcmp(sysattr, "subsystem") != 0 && - strcmp(sysattr, "module") != 0) - goto out; + struct udev_device *dev; - len = readlink(path, target, sizeof(target)); - if (len <= 0 || len == sizeof(target)) + /* + * Some core links return only the last element of the target path, + * these are just values, the paths should not be exposed. + */ + if (strcmp(sysattr, "driver") == 0 || + strcmp(sysattr, "subsystem") == 0 || + strcmp(sysattr, "module") == 0) { + if (util_get_sys_core_link_value(udev_device->udev, sysattr, + udev_device->syspath, value, sizeof(value)) < 0) + return NULL; + dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, value); + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); + val = udev_list_entry_get_value(list_entry); goto out; - target[len] = '\0'; + } - pos = strrchr(target, '/'); - if (pos != NULL) { - pos = &pos[1]; - dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, pos); - list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, pos); + /* resolve link to a device and return its syspath */ + util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL); + dev = udev_device_new_from_syspath(udev_device->udev, path); + if (dev != NULL) { + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, + udev_device_get_syspath(dev)); val = udev_list_entry_get_value(list_entry); + udev_device_unref(dev); } goto out; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c index 4053436fe6..f7e7e86b6a 100644 --- a/udev/udevadm-info.c +++ b/udev/udevadm-info.c @@ -52,10 +52,10 @@ static bool skip_attribute(const char *name) static void print_all_attributes(struct udev_device *device, const char *key) { + struct udev *udev = udev_device_get_udev(device); struct udev_list_entry *sysattr; udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { - struct udev *udev = udev_device_get_udev(device); const char *name; const char *value; size_t len; @@ -69,6 +69,10 @@ static void print_all_attributes(struct udev_device *device, const char *key) continue; dbg(udev, "attr '%s'='%s'\n", name, value); + /* skip any values that look like a path */ + if (value[0] == '/') + continue; + /* skip nonprintable attributes */ len = strlen(value); while (len > 0 && isprint(value[len-1])) -- cgit v1.2.3-54-g00ecf From 3c00bc177ce4820db4fc6bdada02b9c21386ed41 Mon Sep 17 00:00:00 2001 From: Thomas Hood Date: Mon, 22 Aug 2011 06:29:50 +0200 Subject: keymap: Support keymap overrides in /etc/udev/keymaps Prefer reading keymaps from /etc/udev/keymaps/ so that it's easy to just locally fix a key or two by copying the existing keymap file from /lib/udev/keymaps/. This works similarly to udev rules. http://bugs.debian.org/556045 --- extras/keymap/keymap.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index 597a53b467..fadd7a31d2 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -184,16 +184,9 @@ static void set_key(int fd, const char* scancode_str, const char* keyname) scancode, k->id); } -static int merge_table(int fd, const char *filename) { +static int merge_table(int fd, FILE *f) { int r = 0; int line = 0; - FILE* f; - - f = fopen(filename, "r"); - if (!f) { - perror(filename); - return -1; - } while (!feof(f)) { char s[256], *p; @@ -246,17 +239,6 @@ fail: return r; } -static const char* default_keymap_path(const char* path) -{ - static char result[PATH_MAX]; - - /* If keymap file is given without a path, assume udev directory; must end with '/' * */ - if (!strchr(path, '/')) { - snprintf(result, sizeof(result), "%s%s", LIBEXECDIR "/keymaps/", path); - return result; - } - return path; -} /* read one event; return 1 if valid */ static int read_event(int fd, struct input_event* ev) @@ -424,7 +406,31 @@ int main(int argc, char **argv) /* two arguments (device, mapfile): set map file */ if (argc == optind+2) { - merge_table(fd, default_keymap_path(argv[optind+1])); + const char *filearg = argv[optind+1]; + if (strchr(filearg, '/')) { + /* Keymap file argument is a path */ + FILE *f = fopen(filearg, "r"); + if (f) + merge_table(fd, f); + else + perror(filearg); + } else { + /* Keymap file argument is a filename */ + /* Open override file if present, otherwise default file */ + char keymap_path[PATH_MAX]; + snprintf(keymap_path, sizeof(keymap_path), "%s%s", SYSCONFDIR "/udev/keymaps/", filearg); + FILE *f = fopen(keymap_path, "r"); + if (f) { + merge_table(fd, f); + } else { + snprintf(keymap_path, sizeof(keymap_path), "%s%s", LIBEXECDIR "/keymaps/", filearg); + f = fopen(keymap_path, "r"); + if (f) + merge_table(fd, f); + else + perror(keymap_path); + } + } return 0; } -- cgit v1.2.3-54-g00ecf From 6e3b1694a4dea049591af1f089adce327bf6a542 Mon Sep 17 00:00:00 2001 From: Thomas Hood Date: Mon, 22 Aug 2011 06:34:36 +0200 Subject: keymap: Support for microphone mute button on ThinkPad X220 et al On a ThinkPad X220 there is a microphone mute button which generates ACPI event "ibm/hotkey HKEY 00000080 0000101b". As there is no key like "micmute", map it to prog2. --- extras/keymap/keymaps/module-lenovo | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/keymaps/module-lenovo b/extras/keymap/keymaps/module-lenovo index 9cb74b28de..81b8feae0b 100644 --- a/extras/keymap/keymaps/module-lenovo +++ b/extras/keymap/keymaps/module-lenovo @@ -14,3 +14,4 @@ 0x15 volumedown 0x16 mute 0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") +0x1A prog2 # Microphone mute -- cgit v1.2.3-54-g00ecf From 00fc377e7a6b1997db346c8de51cbf05cad48376 Mon Sep 17 00:00:00 2001 From: Paul Fox Date: Mon, 22 Aug 2011 06:39:06 +0200 Subject: keymap: update the OLPC keymap for correct function key behavior New mappings were needed when the mechanical keyboard was introduced, and GNOME was made a peer to the sugar desktop. see http://lists.laptop.org/pipermail/devel/2010-July/029384.html --- extras/keymap/keymaps/olpc-xo | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/extras/keymap/keymaps/olpc-xo b/extras/keymap/keymaps/olpc-xo index 7fe06629d3..34434a121d 100644 --- a/extras/keymap/keymaps/olpc-xo +++ b/extras/keymap/keymaps/olpc-xo @@ -2,18 +2,32 @@ 0x81 fn_esc 0xF9 camera 0xF8 sound # Fn-CAMERA = Mic -0xBB fn_f1 -0xBC fn_f2 -0xBD fn_f3 -0xBE fn_f4 -0xBF fn_f5 -0xC0 fn_f6 -0xC1 fn_f7 -0xC2 fn_f8 -0xC3 fn_f9 -0xC4 fn_f10 -0xD7 fn_f11 -0xD8 fn_f12 + + +# Function key mappings, as per +# http://dev.laptop.org/ticket/10213#comment:20 +# +# Unmodified F1-F8 produce F1-F8, so no remap necessary. +# Unmodified F9-F12 control brightness and volume. +0x43 brightnessdown +0x44 brightnessup +0x57 volumedown +0x58 volumeup + +# fn-modified fkeys all produce the unmodified version of the key. +0xBB f1 +0xBC f2 +0xBD f3 +0xBE f4 +0xBF f5 +0xC0 f6 +0xC1 f7 +0xC2 f8 +0xC3 f9 +0xC4 f10 +0xD7 f11 +0xD8 f12 + # Using F13-F21 for the .5 F keys right now. 0xF7 f13 -- cgit v1.2.3-54-g00ecf From 1484205c47cf395fe21e0dac249b8534d03c3fe2 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Mon, 22 Aug 2011 06:42:28 +0200 Subject: keymap: add Genius SlimStar 320 This keyboard have 16 "multimedia" keys plus a "4-way turbo scroll pad" which is essentially a round up/down/left/right button. Unfortunately most of these keys emit non-standard scancodes in a range 495-508 which does not make any sense. I tried to remap those to the best of my knowledge. Note the keyboard comes up as two event devices, second one is multimedia keys, so I ended up adding ENV{ID_USB_INTERFACE_NUM}=="01" to avoid unnecessary initialization of the "main" keyboard. --- extras/keymap/95-keymap.rules | 1 + extras/keymap/keymaps/genius-slimstar-320 | 35 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 extras/keymap/keymaps/genius-slimstar-320 diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 0d9b771e2e..0742787ed1 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -20,6 +20,7 @@ GOTO="keyboard_modulecheck" LABEL="keyboard_usbcheck" +ENV{ID_VENDOR}=="Genius", ENV{ID_MODEL_ID}=="0708", ENV{ID_USB_INTERFACE_NUM}=="01", RUN+="keymap $name genius-slimstar-320" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" # Logitech Cordless Wave Pro looks slightly weird; some hotkeys are coming through the mouse interface diff --git a/extras/keymap/keymaps/genius-slimstar-320 b/extras/keymap/keymaps/genius-slimstar-320 new file mode 100644 index 0000000000..d0a3656dd8 --- /dev/null +++ b/extras/keymap/keymaps/genius-slimstar-320 @@ -0,0 +1,35 @@ +# Genius SlimStar 320 +# +# Only buttons which are not properly mapped yet are configured below + +# "Scroll wheel", a circular up/down/left/right button. Aimed for scolling, +# but since there are no scrollleft/scrollright, let's map to back/forward. +0x900f0 scrollup +0x900f1 scrolldown +0x900f3 back +0x900f2 forward + +# Multimedia buttons, left side (from left to right) +# [W] +0x900f5 wordprocessor +# [Ex] +0x900f6 spreadsheet +# [P] +0x900f4 presentation +# Other five (calculator, playpause, stop, mute and eject) are OK + +# Right side, from left to right +# [e] +0xc0223 www +# "man" +0x900f7 chat +# "Y" +0x900fb prog1 +# [X] +0x900f8 close +# "picture" +0x900f9 graphicseditor +# "two windows" +0x900fd scale +# "lock" +0x900fc screenlock -- cgit v1.2.3-54-g00ecf From c99b72121fb965920652ea5e7a1d7f962385626b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 28 Aug 2011 22:41:46 +0200 Subject: libudev: list - properly sort linked list not only the index it seems that udev-git is b0rked while tag '173' works fine for me the rule in question is: also, with >173 persistent-net rules seem to get constantly recreated for same devices mgorny: logic bug. we only sort the keys in an index, but we don't care about the index when reading the list, which doesn't work too well for the rules file list where we depend on the order --- libudev/libudev-list.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c index 295ee682bc..f74a88ca49 100644 --- a/libudev/libudev-list.c +++ b/libudev/libudev-list.c @@ -180,7 +180,6 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char * return NULL; } } - udev_list_entry_append(entry, list); if (list->unique) { /* allocate or enlarge sorted array if needed */ @@ -199,12 +198,22 @@ struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char * list->entries_max += add; } - /* insert into sorted array */ + /* the negative i returned the insertion index */ i = (-i)-1; + + /* insert into sorted list */ + if ((unsigned int)i < list->entries_cur) + udev_list_entry_insert_before(entry, list->entries[i]); + else + udev_list_entry_append(entry, list); + + /* insert into sorted array */ memmove(&list->entries[i+1], &list->entries[i], (list->entries_cur - i) * sizeof(struct udev_list_entry *)); list->entries[i] = entry; list->entries_cur++; + } else { + udev_list_entry_append(entry, list); } dbg(list->udev, "'%s=%s' added\n", entry->name, entry->value); -- cgit v1.2.3-54-g00ecf From 4fd394c34b1950ba897ef9ce92b14d2fe2a8dba8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 1 Sep 2011 21:14:54 +0200 Subject: mknod: do not complain about existing node --- udev/udev-node.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index 71488c93ad..f19dc4d900 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -107,7 +107,7 @@ int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_ err = -errno; udev_selinux_resetfscreatecon(udev); } while (err == -ENOENT); - if (err != 0) + if (err != 0 && err != -EEXIST) err(udev, "mknod '%s' %u:%u %#o' failed: %m\n", file, major(devnum), minor(devnum), mode); info(udev, "set permissions '%s' %#o uid=%u gid=%u\n", file, mode, uid, gid); chmod(file, mode); -- cgit v1.2.3-54-g00ecf From b93b46e4b70ee6e7c95f8589bd1da93e3d17d44d Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Wed, 31 Aug 2011 10:00:11 -0400 Subject: ata_id: Check for Compact Flash card Automounters may need information like this to e.g. allow unprivileged applications to mount filesystems from a CF card but not from other ATA devices. See https://bugzilla.redhat.com/show_bug.cgi?id=734191 Signed-off-by: David Zeuthen --- extras/ata_id/ata_id.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index 1e93fde4bf..cadadfc27f 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -448,6 +448,7 @@ int main(int argc, char *argv[]) struct udev *udev; struct hd_driveid id; uint8_t identify[512]; + uint16_t *identify_words; char model[41]; char model_enc[256]; char serial[21]; @@ -541,6 +542,7 @@ int main(int argc, char *argv[]) goto close; } } + identify_words = (uint16_t *) identify; memcpy (model, id.model, 40); model[40] = '\0'; @@ -700,6 +702,15 @@ int main(int argc, char *argv[]) /* ATA devices have no vendor extension */ printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn); } + + /* from Linux's include/linux/ata.h */ + if (identify_words[0] == 0x848a || identify_words[0] == 0x844a) { + printf("ID_ATA_CFA=1\n"); + } else { + if ((identify_words[83] & 0xc004) == 0x4004) { + printf("ID_ATA_CFA=1\n"); + } + } } else { if (serial[0] != '\0') printf("%s_%s\n", model, serial); -- cgit v1.2.3-54-g00ecf From afb9771b41be95e90b2f8a5cc235d708cf743ed1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Sep 2011 17:58:13 +0200 Subject: update README --- README | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README b/README index 148217d16a..5a8d4cc0b3 100644 --- a/README +++ b/README @@ -13,7 +13,7 @@ Tools and rules shipped by udev are not public API and may change at any time. Never call any private tool in /lib/udev from any external application; it might just go away in the next release. Access to udev information is only offered by udevadm and libudev. Tools and rules in /lib/udev and the entire contents of -the /dev/.udev directory are private to udev and do change whenever needed. +the /run/udev directory are private to udev and do change whenever needed. Requirements: - Version 2.6.34 of the Linux kernel with sysfs, procfs, signalfd, inotify, @@ -59,21 +59,21 @@ Requirements: available. - Some udev extras have external dependencies like: - libacl, libglib2, libusb, usbutils, pciutils, and gperf. + libacl, libglib2, usbutils, pciutils, and gperf. All these extras can be disabled with configure options. Setup: - At bootup, the /dev directory should get the 'devtmpfs' filesystem mounted. Udev manages the permissions and ownership of the kernel-created device nodes, and udev possibly creates additional symlinks. If needed, udev also - works on an empty 'tmpfs' filesystem, but some static device nodes like - /dev/null, /dev/console, /dev/kmsg are needed to be able to start udev itself. + works on an empty 'tmpfs' filesystem, but some device nodes like + /dev/null, /dev/console, /dev/kmsg should be created before udevd is started. - The udev daemon should be started to handle device events sent by the kernel. - During bootup, the kernel can be asked to send events for all already existing - devices so that they too can be configured by udev. This is usually done by: - /sbin/udevadm trigger --type=subsystems - /sbin/udevadm trigger --type=devices + During bootup, the events for already existing devices can be replayed, so + that they are configured by udev. This is usually done by: + /sbin/udevadm trigger --action=add --type=subsystems + /sbin/udevadm trigger --action=add --type=devices - Restarting the daemon never applies any rules to existing devices. @@ -82,13 +82,13 @@ Setup: Operation: - Based on events the kernel sends out on device creation/removal, udev - creates/removes device nodes in the /dev directory. + creates/removes device nodes and symlinks in the /dev directory. - All kernel events are matched against a set of specified rules, which possibly hook into the event processing and load required kernel modules to set up devices. For all devices, the kernel exports a major/minor number; if needed, udev creates a device node with the default kernel - name. If specified, udev applies permissions/ownership to the device + device name. If specified, udev applies permissions/ownership to the device node, creates additional symlinks pointing to the node, and executes programs to handle the device. -- cgit v1.2.3-54-g00ecf From a3321f687bfb0448d7001d593b369a9f9c644f13 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 26 Sep 2011 21:36:32 +0200 Subject: libudev: fix typo in documentation --- Makefile.am | 2 +- libudev/libudev-device.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 534756903e..37bd2d69dc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,7 +42,7 @@ dist_libexec_SCRIPTS = # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=12 -LIBUDEV_REVISION=1 +LIBUDEV_REVISION=2 LIBUDEV_AGE=12 SUBDIRS += libudev/docs diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 991398c76d..1024b46803 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -92,7 +92,7 @@ struct udev_device { }; /** - * udev_device_get_devnum: + * udev_device_get_seqnum: * @udev_device: udev device * * This is only valid if the device was received through a monitor. Devices read from -- cgit v1.2.3-54-g00ecf From fe9e1a0d4e324bde74a1bf85117ab57176092a26 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 26 Sep 2011 21:37:23 +0200 Subject: rules: fuse: do not mount fusectl from udev rules All mounting is done by systemd now. Non-systemd systems need to ship their own rules if they want fusefs be auto-mounted. --- rules/rules.d/50-udev-default.rules | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 684cda9b58..b31ac42ab7 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -96,8 +96,7 @@ KERNEL=="rfkill", MODE="0644" # CPU KERNEL=="cpu[0-9]*", MODE="0444" -KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse", \ - RUN+="/bin/mount -t fusectl fusectl /sys/fs/fuse/connections" +KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse" SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" KERNEL=="mmtimer", MODE="0644" -- cgit v1.2.3-54-g00ecf From d800e8688a34bc848977999ce77fb40cba17df9e Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Mon, 3 Oct 2011 13:48:43 +0200 Subject: udevadm: settle - return failure if unknown option is given Signed-off-by: Petr Uzel --- udev/udevadm-settle.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index d40c8c8d5e..9f409b61b8 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -96,7 +96,9 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) " --exit-if-exists= stop waiting if file exists\n" " --quiet do not print list after timeout\n" " --help\n\n"); - exit(0); + exit(EXIT_SUCCESS); + default: + exit(EXIT_FAILURE); } } -- cgit v1.2.3-54-g00ecf From 046d1bf731ad17c8da4163204ed2bb5cb4253978 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 3 Oct 2011 14:00:42 +0200 Subject: keymap: add genius keymap to Makefile --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index 37bd2d69dc..d15c6d01b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -496,6 +496,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/fujitsu-amilo_si_1520 \ extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ + extras/keymap/keymaps/genius-slimstar-320 \ extras/keymap/keymaps/hewlett-packard \ extras/keymap/keymaps/hewlett-packard-2510p_2530p \ extras/keymap/keymaps/hewlett-packard-compaq_elitebook \ -- cgit v1.2.3-54-g00ecf From fd736f3991453e352cafb31580fc9f203627e84a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 3 Oct 2011 14:01:33 +0200 Subject: update NEWS --- NEWS | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NEWS b/NEWS index 1799c401ae..e32bbf7a6a 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,11 @@ The path_id, usb_id, input_id tools are built-in commands now and the stand-alone tools do not exist anymore. For testing, the commands can be run with 'udevadm test-builtin '. +The fusectl filesystem is no longer mounted directly from udev. +Systemd systems will take care of mounting fusectl and configfs +now. Non-systemd systems need to ship their own rule if they +need these filesystems auto-mounted. + udev 173 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From a13d90aec63db6b3d3b90da41b5274fd81ab790e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 5 Oct 2011 14:57:21 +0200 Subject: usb_id: can't use global variables when used as built-in --- udev/udev-builtin-usb_id.c | 65 +++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/udev/udev-builtin-usb_id.c b/udev/udev-builtin-usb_id.c index 95368ecf22..1585b107a0 100644 --- a/udev/udev-builtin-usb_id.c +++ b/udev/udev-builtin-usb_id.c @@ -31,20 +31,6 @@ #include "udev.h" -static char vendor_str[64]; -static char vendor_str_enc[256]; -static const char *vendor_id = ""; -static char model_str[64]; -static char model_str_enc[256]; -static const char *product_id = ""; -static char serial_str[UTIL_NAME_SIZE]; -static char packed_if_str[UTIL_NAME_SIZE]; -static char revision_str[64]; -static char type_str[64]; -static char instance_str[64]; -static const char *ifnum; -static const char *driver; - static void set_usb_iftype(char *to, int if_class_num, size_t len) { char *type = "generic"; @@ -253,14 +239,39 @@ out: * 6.) If the device supplies a serial number, this number * is concatenated with the identification with an underscore '_'. */ -static int usb_id(struct udev_device *dev) +static int builtin_usb_id(struct udev_device *dev, bool test) { + char vendor_str[64]; + char vendor_str_enc[256]; + const char *vendor_id; + char model_str[64]; + char model_str_enc[256]; + const char *product_id; + char serial_str[UTIL_NAME_SIZE]; + char packed_if_str[UTIL_NAME_SIZE]; + char revision_str[64]; + char type_str[64]; + char instance_str[64]; + const char *ifnum = NULL; + const char *driver = NULL; + char serial[256]; + struct udev *udev = udev_device_get_udev(dev); struct udev_device *dev_interface = NULL; struct udev_device *dev_usb = NULL; const char *if_class, *if_subclass; int if_class_num; int protocol = 0; + size_t l; + char *s; + + vendor_str[0] = '\0'; + model_str[0] = '\0'; + serial_str[0] = '\0'; + packed_if_str[0] = '\0'; + revision_str[0] = '\0'; + type_str[0] = '\0'; + instance_str[0] = '\0'; dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); @@ -276,7 +287,7 @@ static int usb_id(struct udev_device *dev) if (dev_interface == NULL) { info(udev, "unable to access usb_interface device of '%s'\n", udev_device_get_syspath(dev)); - return 1; + return EXIT_FAILURE; } ifnum = udev_device_get_sysattr_value(dev_interface, "bInterfaceNumber"); @@ -286,7 +297,7 @@ static int usb_id(struct udev_device *dev) if (!if_class) { info(udev, "%s: cannot get bInterfaceClass attribute\n", udev_device_get_sysname(dev)); - return 1; + return EXIT_FAILURE; } if_class_num = strtoul(if_class, NULL, 16); @@ -307,7 +318,7 @@ static int usb_id(struct udev_device *dev) if (!dev_usb) { info(udev, "unable to find parent 'usb' device of '%s'\n", udev_device_get_syspath(dev)); - return 1; + return EXIT_FAILURE; } /* all interfaces of the device in a single string */ @@ -389,7 +400,7 @@ fallback: usb_vendor = vendor_id; if (!usb_vendor) { info(udev, "No USB vendor information available\n"); - return 1; + return EXIT_FAILURE; } udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); udev_util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); @@ -404,7 +415,7 @@ fallback: usb_model = product_id; if (!usb_model) { dbg(udev, "No USB model information available\n"); - return 1; + return EXIT_FAILURE; } udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); udev_util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); @@ -430,24 +441,12 @@ fallback: udev_util_replace_chars(serial_str, NULL); } } - return 0; -} - -static int builtin_usb_id(struct udev_device *dev, bool test) -{ - char serial[256]; - size_t l; - char *s; - int err; - - err = usb_id(dev); - if (err) - return EXIT_FAILURE; s = serial; l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); if (serial_str[0] != '\0') l = util_strpcpyl(&s, l, "_", serial_str, NULL); + if (instance_str[0] != '\0') util_strpcpyl(&s, l, "-", instance_str, NULL); -- cgit v1.2.3-54-g00ecf From 289a1821a4a7636ce42a6c7adc3a9bb49421a5ea Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Oct 2011 00:45:06 +0200 Subject: remove 'udevadm trigger --type=failed' and SYSFS, ID, BUS keys --- NEWS | 5 +++ TODO | 6 ++-- libudev/docs/libudev-sections.txt | 1 - libudev/libudev-private.h | 1 - libudev/libudev-queue-private.c | 45 ------------------------- libudev/libudev-queue.c | 47 ++------------------------ libudev/libudev.h | 1 - libudev/test-libudev.c | 4 --- test/udev-test.pl | 2 +- udev/udev-rules.c | 70 ++------------------------------------- udev/udevadm-trigger.c | 24 -------------- udev/udevd.c | 11 ++---- 12 files changed, 16 insertions(+), 201 deletions(-) diff --git a/NEWS b/NEWS index e32bbf7a6a..abb0ee922f 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,11 @@ Systemd systems will take care of mounting fusectl and configfs now. Non-systemd systems need to ship their own rule if they need these filesystems auto-mounted. +The long deprecated keys: SYSFS, ID, BUS have been removed. + +The support for 'udevadm trigger --type=failed, and the +RUN{fail_event_on_error} attribute was removed. + udev 173 ======== Bugfixes. diff --git a/TODO b/TODO index 3e013c99be..65894ba820 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ + - validate the two hex chars in replace_chars \x + - test (now fixed) /dev/tape/ links - /run/udev/control socket @@ -11,10 +13,6 @@ - move udevadm -> --bindir - - remove deprecated trigger --type=failed logic - - - remove deprecated BUS=, SYSFS{}=, ID= keys - - kill tabs? - warn about RUN+="socket:" diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index 4cd383b4f8..a686c4558e 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -116,7 +116,6 @@ udev_queue_get_queue_is_empty udev_queue_get_seqnum_is_finished udev_queue_get_seqnum_sequence_is_finished udev_queue_get_queued_list_entry -udev_queue_get_failed_list_entry udev_queue_get_kernel_seqnum udev_queue_get_udev_seqnum
            diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 2873b4d2c7..1bcd2e3236 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -165,7 +165,6 @@ struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); -int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); /* libudev-util.c */ #define UTIL_PATH_SIZE 1024 diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c index 6e13d8a3d9..e0a7b53b81 100644 --- a/libudev/libudev-queue-private.c +++ b/libudev/libudev-queue-private.c @@ -56,7 +56,6 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); struct udev_queue_export { struct udev *udev; - int failed_count; /* number of failed events exported */ int queued_count; /* number of unfinished events exported in queue file */ FILE *queue_file; unsigned long long int seqnum_max; /* earliest sequence number in queue file */ @@ -328,7 +327,6 @@ write_error: enum device_state { DEVICE_QUEUED, DEVICE_FINISHED, - DEVICE_FAILED, }; static inline size_t queue_record_size(size_t devpath_len) @@ -394,47 +392,9 @@ static int update_queue(struct udev_queue_export *udev_queue_export, return err; } -static void update_failed(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - - if (state != DEVICE_FAILED && udev_queue_export->failed_count == 0) - return; - - /* location of failed file */ - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/failed/", - udev_device_get_subsystem(udev_device), ":", udev_device_get_sysname(udev_device), NULL); - - switch (state) { - case DEVICE_FAILED: - /* record event in the failed directory */ - udev_queue_export->failed_count++; - util_create_path(udev, filename); - symlink(udev_device_get_devpath(udev_device), filename); - break; - - case DEVICE_QUEUED: - /* delete failed file */ - if (unlink(filename) == 0) { - util_delete_path(udev, filename); - udev_queue_export->failed_count--; - } - break; - - case DEVICE_FINISHED: - break; - } - - return; -} - static int update(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device, enum device_state state) { - update_failed(udev_queue_export, udev_device, state); - if (update_queue(udev_queue_export, udev_device, state) != 0) return -1; @@ -450,8 +410,3 @@ int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_expor { return update(udev_queue_export, udev_device, DEVICE_FINISHED); } - -int udev_queue_export_device_failed(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_FAILED); -} diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c index 744696df2b..3d46b67d19 100644 --- a/libudev/libudev-queue.c +++ b/libudev/libudev-queue.c @@ -43,7 +43,6 @@ struct udev_queue { struct udev *udev; int refcount; struct udev_list queue_list; - struct udev_list failed_list; }; /** @@ -68,7 +67,6 @@ UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev) udev_queue->refcount = 1; udev_queue->udev = udev; udev_list_init(udev, &udev_queue->queue_list, false); - udev_list_init(udev, &udev_queue->failed_list, false); return udev_queue; } @@ -103,7 +101,6 @@ UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue) if (udev_queue->refcount > 0) return; udev_list_cleanup(&udev_queue->queue_list); - udev_list_cleanup(&udev_queue->failed_list); free(udev_queue); } @@ -469,47 +466,9 @@ UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev return udev_list_get_entry(&udev_queue->queue_list); } -/** - * udev_queue_get_failed_list_entry: - * @udev_queue: udev queue context - * - * Returns: the first entry of the list of recorded failed events. - **/ +struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) { - char path[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - if (udev_queue == NULL) - return NULL; - udev_list_cleanup(&udev_queue->failed_list); - util_strscpyl(path, sizeof(path), udev_get_run_path(udev_queue->udev), "/failed", NULL); - dir = opendir(path); - if (dir == NULL) - return NULL; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char filename[UTIL_PATH_SIZE]; - char syspath[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - struct stat statbuf; - - if (dent->d_name[0] == '.') - continue; - s = syspath; - l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); - len = readlinkat(dirfd(dir), dent->d_name, s, l); - if (len <= 0 || (size_t)len == l) - continue; - s[len] = '\0'; - dbg(udev_queue->udev, "found '%s' [%s]\n", syspath, dent->d_name); - util_strscpyl(filename, sizeof(filename), syspath, "/uevent", NULL); - if (stat(filename, &statbuf) != 0) - continue; - udev_list_entry_add(&udev_queue->failed_list, syspath, NULL); - } - closedir(dir); - return udev_list_get_entry(&udev_queue->failed_list); + errno = ENOSYS; + return NULL; } diff --git a/libudev/libudev.h b/libudev/libudev.h index d8eb7dff77..47b56bb17a 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -173,7 +173,6 @@ int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned lo int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end); struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); -struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); #ifdef __cplusplus } /* extern "C" */ diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c index 966a406507..c325f8eef5 100644 --- a/libudev/test-libudev.c +++ b/libudev/test-libudev.c @@ -323,10 +323,6 @@ static int test_queue(struct udev *udev) udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); printf("\n"); - printf("get failed list\n"); - udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) - printf("failed: '%s'\n", udev_list_entry_get_name(list_entry)); - printf("\n"); list_entry = udev_queue_get_queued_list_entry(udev_queue); if (list_entry != NULL) { diff --git a/test/udev-test.pl b/test/udev-test.pl index b7592efcbd..f93859c78c 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -14,7 +14,7 @@ # After creation and removal the result is checked against the # expected value and the result is printed. # -# Copyright (C) 2004-2008 Kay Sievers +# Copyright (C) 2004-2011 Kay Sievers # Copyright (C) 2004 Leann Ogasawara use warnings; diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 6bf2726e1e..84033243c2 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -198,7 +198,6 @@ struct token { union { unsigned int attr_off; int devlink_unique; - int fail_on_error; unsigned int rule_goto; mode_t mode; uid_t uid; @@ -1066,7 +1065,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, break; case TK_A_RUN: token->key.value_off = add_string(rule_tmp->rules, value); - token->key.fail_on_error = *(int *)data; break; case TK_A_INOTIFY_WATCH: case TK_A_DEVLINK_PRIO: @@ -1191,9 +1189,6 @@ static int add_rule(struct udev_rules *rules, char *line, char *linepos; char *attr; struct rule_tmp rule_tmp; - bool bus_warn = false; - bool sysfs_warn = false; - bool id_warn = false; memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); rule_tmp.rules = rules; @@ -1287,21 +1282,6 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcmp(key, "ID") == 0) { - if (!id_warn) { - id_warn = true; - err(rules->udev, "ID= will be removed in a future udev version, " - "please use KERNEL= to match the event device, or KERNELS= " - "to match a parent device, in %s:%u\n", filename, lineno); - } - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid KERNELS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL); - continue; - } - if (strcmp(key, "SUBSYSTEMS") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid SUBSYSTEMS operation\n"); @@ -1311,21 +1291,6 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strcmp(key, "BUS") == 0) { - if (!bus_warn) { - bus_warn = true; - err(rules->udev, "BUS= will be removed in a future udev version, " - "please use SUBSYSTEM= to match the event device, or SUBSYSTEMS= " - "to match a parent device, in %s:%u\n", filename, lineno); - } - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid SUBSYSTEMS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); - continue; - } - if (strcmp(key, "DRIVERS") == 0) { if (op > OP_MATCH_MAX) { err(rules->udev, "invalid DRIVERS operation\n"); @@ -1364,26 +1329,6 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncmp(key, "SYSFS{", sizeof("SYSFS{")-1) == 0) { - if (!sysfs_warn) { - sysfs_warn = true; - err(rules->udev, "SYSFS{}= will be removed in a future udev version, " - "please use ATTR{}= to match the event device, or ATTRS{}= " - "to match a parent device, in %s:%u\n", filename, lineno); - } - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid ATTRS operation\n"); - goto invalid; - } - attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTRS attribute\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr); - continue; - } - if (strncmp(key, "ENV{", sizeof("ENV{")-1) == 0) { attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1); if (attr == NULL) { @@ -1509,13 +1454,8 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } - if (strncmp(key, "RUN", sizeof("RUN")-1) == 0) { - int flag = 0; - - attr = get_key_attribute(rules->udev, key + sizeof("RUN")-1); - if (attr != NULL && strstr(attr, "fail_event_on_error")) - flag = 1; - rule_add_key(&rule_tmp, TK_A_RUN, op, value, &flag); + if (strcmp(key, "RUN") == 0) { + rule_add_key(&rule_tmp, TK_A_RUN, op, value, NULL); continue; } @@ -2706,17 +2646,13 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; } case TK_A_RUN: { - struct udev_list_entry *list_entry; - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) udev_list_cleanup(&event->run_list); info(event->udev, "RUN '%s' %s:%u\n", &rules->buf[cur->key.value_off], &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - list_entry = udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL); - if (cur->key.fail_on_error) - udev_list_entry_set_num(list_entry, true); + udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL); break; } case TK_A_GOTO: diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c index d94c9568d1..2cee2297d4 100644 --- a/udev/udevadm-trigger.c +++ b/udev/udevadm-trigger.c @@ -61,20 +61,6 @@ static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) } } -static int scan_failed(struct udev_enumerate *udev_enumerate) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - struct udev_queue *udev_queue; - struct udev_list_entry *list_entry; - - udev_queue = udev_queue_new(udev); - if (udev_queue == NULL) - return -1; - udev_list_entry_foreach(list_entry, udev_queue_get_failed_list_entry(udev_queue)) - udev_enumerate_add_syspath(udev_enumerate, udev_list_entry_get_name(list_entry)); - return 0; -} - static const char *keyval(const char *str, const char **val, char *buf, size_t size) { char *pos; @@ -110,7 +96,6 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) enum { TYPE_DEVICES, TYPE_SUBSYSTEMS, - TYPE_FAILED, } device_type = TYPE_DEVICES; const char *action = "change"; struct udev_enumerate *udev_enumerate; @@ -145,8 +130,6 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) device_type = TYPE_DEVICES; } else if (strcmp(optarg, "subsystems") == 0) { device_type = TYPE_SUBSYSTEMS; - } else if (strcmp(optarg, "failed") == 0) { - device_type = TYPE_FAILED; } else { err(udev, "unknown type --type=%s\n", optarg); rc = 2; @@ -208,8 +191,6 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) " --type= type of events to trigger\n" " devices sys devices (default)\n" " subsystems sys subsystems and drivers\n" - " failed trigger only the events which have been\n" - " marked as failed during a previous run\n" " --action= event action value, default is \"change\"\n" " --subsystem-match= trigger devices from a matching subsystem\n" " --subsystem-nomatch= exclude devices from a matching subsystem\n" @@ -228,11 +209,6 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) } switch (device_type) { - case TYPE_FAILED: - err(udev, "--type=failed is deprecated and will be removed from a future udev release.\n"); - scan_failed(udev_enumerate); - exec_list(udev_enumerate, action); - goto exit; case TYPE_SUBSYSTEMS: udev_enumerate_scan_subsystems(udev_enumerate); exec_list(udev_enumerate, action); diff --git a/udev/udevd.c b/udev/udevd.c index 325ad034c2..77aec9d2ae 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -155,11 +155,7 @@ static void event_queue_delete(struct event *event, bool export) udev_list_node_remove(&event->node); if (export) { - /* mark as failed, if "add" event returns non-zero */ - if (event->exitcode != 0 && strcmp(udev_device_get_action(event->dev), "remove") != 0) - udev_queue_export_device_failed(udev_queue_export, event->dev); - else - udev_queue_export_device_finished(udev_queue_export, event->dev); + udev_queue_export_device_finished(udev_queue_export, event->dev); info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); } udev_device_unref(event->dev); @@ -284,7 +280,6 @@ static void worker_new(struct event *event) for (;;) { struct udev_event *udev_event; struct worker_message msg; - int failed = 0; int err; info(udev, "seq %llu running\n", udev_device_get_seqnum(dev)); @@ -304,7 +299,7 @@ static void worker_new(struct event *event) err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); if (err == 0) - failed = udev_event_execute_run(udev_event, &sigmask_orig); + udev_event_execute_run(udev_event, &sigmask_orig); /* apply/restore inotify watch */ if (err == 0 && udev_event->inotify_watch) { @@ -319,8 +314,6 @@ static void worker_new(struct event *event) memset(&msg, 0, sizeof(struct worker_message)); if (err != 0) msg.exitcode = err; - else if (failed != 0) - msg.exitcode = failed; msg.pid = getpid(); send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); -- cgit v1.2.3-54-g00ecf From 0bbe8838e75bf97792d61b33f8592a32f1fc8bd4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Oct 2011 01:10:59 +0200 Subject: libudev: export udev_util_encode_string() --- Makefile.am | 6 +++--- extras/ata_id/ata_id.c | 12 ++++++------ extras/scsi_id/scsi_id.c | 24 ++++++++++++------------ libudev/docs/libudev-docs.xml | 3 ++- libudev/docs/libudev-sections.txt | 5 +++++ libudev/libudev-private.h | 5 ++--- libudev/libudev-util.c | 17 +++++++++++------ libudev/libudev.h | 10 +++++++++- udev/udev-builtin-usb_id.c | 28 ++++++++++++++-------------- udev/udev-event.c | 2 +- udev/udev-rules.c | 8 ++++---- 11 files changed, 69 insertions(+), 51 deletions(-) diff --git a/Makefile.am b/Makefile.am index d15c6d01b2..d8b1889c22 100644 --- a/Makefile.am +++ b/Makefile.am @@ -41,9 +41,9 @@ dist_libexec_SCRIPTS = # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=12 -LIBUDEV_REVISION=2 -LIBUDEV_AGE=12 +LIBUDEV_CURRENT=13 +LIBUDEV_REVISION=0 +LIBUDEV_AGE=13 SUBDIRS += libudev/docs diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index cadadfc27f..e38a7d1aa5 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -547,12 +547,12 @@ int main(int argc, char *argv[]) memcpy (model, id.model, 40); model[40] = '\0'; udev_util_encode_string(model, model_enc, sizeof(model_enc)); - udev_util_replace_whitespace((char *) id.model, model, 40); - udev_util_replace_chars(model, NULL); - udev_util_replace_whitespace((char *) id.serial_no, serial, 20); - udev_util_replace_chars(serial, NULL); - udev_util_replace_whitespace((char *) id.fw_rev, revision, 8); - udev_util_replace_chars(revision, NULL); + util_replace_whitespace((char *) id.model, model, 40); + util_replace_chars(model, NULL); + util_replace_whitespace((char *) id.serial_no, serial, 20); + util_replace_chars(serial, NULL); + util_replace_whitespace((char *) id.fw_rev, revision, 8); + util_replace_chars(revision, NULL); if (export) { /* Set this to convey the disk speaks the ATA protocol */ diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c index c14d411841..26b92e3fcd 100644 --- a/extras/scsi_id/scsi_id.c +++ b/extras/scsi_id/scsi_id.c @@ -510,13 +510,13 @@ static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, co udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); - udev_util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); - udev_util_replace_chars(vendor_str, NULL); - udev_util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); - udev_util_replace_chars(model_str, NULL); + util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); + util_replace_chars(vendor_str, NULL); + util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); + util_replace_chars(model_str, NULL); set_type(dev_scsi->type, type_str, sizeof(type_str)); - udev_util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); - udev_util_replace_chars(revision_str, NULL); + util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); + util_replace_chars(revision_str, NULL); return 0; } @@ -560,11 +560,11 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) printf("ID_REVISION=%s\n", revision_str); printf("ID_TYPE=%s\n", type_str); if (dev_scsi.serial[0] != '\0') { - udev_util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - udev_util_replace_chars(serial_str, NULL); + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); printf("ID_SERIAL=%s\n", serial_str); - udev_util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); - udev_util_replace_chars(serial_str, NULL); + util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); printf("ID_SERIAL_SHORT=%s\n", serial_str); } if (dev_scsi.wwn[0] != '\0') { @@ -593,8 +593,8 @@ static int scsi_id(struct udev *udev, char *maj_min_dev) if (reformat_serial) { char serial_str[MAX_SERIAL_LEN]; - udev_util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - udev_util_replace_chars(serial_str, NULL); + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); printf("%s\n", serial_str); goto out; } diff --git a/libudev/docs/libudev-docs.xml b/libudev/docs/libudev-docs.xml index f470916700..b7feb45529 100644 --- a/libudev/docs/libudev-docs.xml +++ b/libudev/docs/libudev-docs.xml @@ -9,7 +9,7 @@ libudev Reference Manual for libudev version &version; - 2009-2010 + 2009-2011 Kay Sievers <kay.sievers@vrfy.org> @@ -22,6 +22,7 @@ + diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt index a686c4558e..15c3e934b5 100644 --- a/libudev/docs/libudev-sections.txt +++ b/libudev/docs/libudev-sections.txt @@ -120,3 +120,8 @@ udev_queue_get_kernel_seqnum udev_queue_get_udev_seqnum
            +
            +libudev-util +udev_util +udev_util_encode_string +
            diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index 1bcd2e3236..ffc82cbc6d 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -181,9 +181,8 @@ size_t util_strpcpy(char **dest, size_t size, const char *src); size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__((sentinel)); size_t util_strscpy(char *dest, size_t size, const char *src); size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__((sentinel)); -int udev_util_replace_whitespace(const char *str, char *to, size_t len); -int udev_util_replace_chars(char *str, const char *white); -int udev_util_encode_string(const char *str, char *str_enc, size_t len); +int util_replace_whitespace(const char *str, char *to, size_t len); +int util_replace_chars(char *str, const char *white); unsigned int util_string_hash32(const char *key); uint64_t util_string_bloom64(const char *str); diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index a600b0a881..e08349e0fa 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2009 Kay Sievers + * Copyright (C) 2008-2011 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,6 +24,11 @@ #include "libudev.h" #include "libudev-private.h" +/** + * SECTION:libudev-util + * @short_description: utils + */ + ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) { char path[UTIL_PATH_SIZE]; @@ -342,7 +347,7 @@ static int utf8_encoded_valid_unichar(const char *str) return len; } -int udev_util_replace_whitespace(const char *str, char *to, size_t len) +int util_replace_whitespace(const char *str, char *to, size_t len) { size_t i, j; @@ -382,7 +387,7 @@ static int is_whitelisted(char c, const char *white) } /* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ -int udev_util_replace_chars(char *str, const char *white) +int util_replace_chars(char *str, const char *white) { size_t i = 0; int replaced = 0; @@ -425,18 +430,18 @@ int udev_util_replace_chars(char *str, const char *white) } /** - * util_encode_string: + * udev_util_encode_string: * @str: input string to be encoded * @str_enc: output string to store the encoded input string * @len: maximum size of the output string, which may be * four times as long as the input string * * Encode all potentially unsafe characters of a string to the - * corresponding hex value prefixed by '\x'. + * corresponding 2 char hex value prefixed by '\x'. * * Returns: 0 if the entire string was copied, non-zero otherwise. **/ -int udev_util_encode_string(const char *str, char *str_enc, size_t len) +UDEV_EXPORT int udev_util_encode_string(const char *str, char *str_enc, size_t len) { size_t i, j; diff --git a/libudev/libudev.h b/libudev/libudev.h index 47b56bb17a..497f752fca 100644 --- a/libudev/libudev.h +++ b/libudev/libudev.h @@ -1,7 +1,7 @@ /* * libudev - interface to udev device information * - * Copyright (C) 2008-2010 Kay Sievers + * Copyright (C) 2008-2011 Kay Sievers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -174,6 +174,14 @@ int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, unsigned long long int start, unsigned long long int end); struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); +/* + * udev_util + * + * udev specific utilities + */ +int udev_util_encode_string(const char *str, char *str_enc, size_t len); + + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/udev/udev-builtin-usb_id.c b/udev/udev-builtin-usb_id.c index 1585b107a0..587c21667b 100644 --- a/udev/udev-builtin-usb_id.c +++ b/udev/udev-builtin-usb_id.c @@ -350,8 +350,8 @@ static int builtin_usb_id(struct udev_device *dev, bool test) goto fallback; } udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - udev_util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); - udev_util_replace_chars(vendor_str, NULL); + util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); + util_replace_chars(vendor_str, NULL); scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); if (!scsi_model) { @@ -360,8 +360,8 @@ static int builtin_usb_id(struct udev_device *dev, bool test) goto fallback; } udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc)); - udev_util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); - udev_util_replace_chars(model_str, NULL); + util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); + util_replace_chars(model_str, NULL); scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); if (!scsi_type) { @@ -377,8 +377,8 @@ static int builtin_usb_id(struct udev_device *dev, bool test) udev_device_get_sysname(dev_scsi)); goto fallback; } - udev_util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); - udev_util_replace_chars(revision_str, NULL); + util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); + util_replace_chars(revision_str, NULL); /* * some broken devices have the same identifiers @@ -403,8 +403,8 @@ fallback: return EXIT_FAILURE; } udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - udev_util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); - udev_util_replace_chars(vendor_str, NULL); + util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); + util_replace_chars(vendor_str, NULL); } if (model_str[0] == '\0') { @@ -418,8 +418,8 @@ fallback: return EXIT_FAILURE; } udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); - udev_util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); - udev_util_replace_chars(model_str, NULL); + util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); + util_replace_chars(model_str, NULL); } if (revision_str[0] == '\0') { @@ -427,8 +427,8 @@ fallback: usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); if (usb_rev) { - udev_util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); - udev_util_replace_chars(revision_str, NULL); + util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); + util_replace_chars(revision_str, NULL); } } @@ -437,8 +437,8 @@ fallback: usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); if (usb_serial) { - udev_util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); - udev_util_replace_chars(serial_str, NULL); + util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); + util_replace_chars(serial_str, NULL); } } diff --git a/udev/udev-event.c b/udev/udev-event.c index 3c1a3e7aa7..7db7513247 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -318,7 +318,7 @@ subst: len = strlen(vbuf); while (len > 0 && isspace(vbuf[--len])) vbuf[len] = '\0'; - count = udev_util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); + count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); if (count > 0) info(event->udev, "%i character(s) replaced\n" , count); l = util_strpcpy(&s, l, vbuf); diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 84033243c2..75636d9bd6 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2271,7 +2271,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event util_remove_trailing_chars(result, '\n'); if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = udev_util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); + count = util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); if (count > 0) info(event->udev, "%i character(s) replaced\n" , count); } @@ -2562,7 +2562,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event event->name_final = true; udev_event_apply_format(event, name, name_str, sizeof(name_str)); if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = udev_util_replace_chars(name_str, "/"); + count = util_replace_chars(name_str, "/"); if (count > 0) info(event->udev, "%i character(s) replaced\n", count); } @@ -2592,9 +2592,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* allow multiple symlinks separated by spaces */ udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); if (esc == ESCAPE_UNSET) - count = udev_util_replace_chars(temp, "/ "); + count = util_replace_chars(temp, "/ "); else if (esc == ESCAPE_REPLACE) - count = udev_util_replace_chars(temp, "/"); + count = util_replace_chars(temp, "/"); if (count > 0) info(event->udev, "%i character(s) replaced\n" , count); dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); -- cgit v1.2.3-54-g00ecf From 8ac5e7ebf2b362186efc0d6a560ba3247d083354 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Oct 2011 01:30:55 +0200 Subject: update TODO --- TODO | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 65894ba820..3dcaf4ca85 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - - validate the two hex chars in replace_chars \x - - test (now fixed) /dev/tape/ links - /run/udev/control socket @@ -17,6 +15,8 @@ - warn about RUN+="socket:" - - libudev.so.1 with symbol versioning: + - libudev.so.1 + - symbol versioning: - return object with *_unref() - udev_monitor_from_socket() + - udev_queue_get_failed_list_entry() -- cgit v1.2.3-54-g00ecf From 7eff39bcf3fd5c1e441bd14902268b111c82797d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Oct 2011 01:40:44 +0200 Subject: systemd: no not start udev in a container --- init/udev.service.in | 1 + 1 file changed, 1 insertion(+) diff --git a/init/udev.service.in b/init/udev.service.in index 3692fb317e..4107b6a93e 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -4,6 +4,7 @@ Wants=udev-control.socket udev-kernel.socket After=udev-control.socket udev-kernel.socket Before=basic.target DefaultDependencies=no +ConditionVirtualization=!container [Service] Type=notify -- cgit v1.2.3-54-g00ecf From ee9bf6bda9a3367295ca56842bb29bf197d90f48 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Oct 2011 01:49:36 +0200 Subject: systemd: no not start udev in a container --- init/udev-control.socket | 1 + init/udev-kernel.socket | 1 + 2 files changed, 2 insertions(+) diff --git a/init/udev-control.socket b/init/udev-control.socket index 9a3537a37d..8f3106130b 100644 --- a/init/udev-control.socket +++ b/init/udev-control.socket @@ -1,6 +1,7 @@ [Unit] Description=udev Control Socket DefaultDependencies=no +ConditionVirtualization=!container [Socket] Service=udev.service diff --git a/init/udev-kernel.socket b/init/udev-kernel.socket index e4de14a33e..b6d1c88c18 100644 --- a/init/udev-kernel.socket +++ b/init/udev-kernel.socket @@ -1,6 +1,7 @@ [Unit] Description=udev Kernel Socket DefaultDependencies=no +ConditionVirtualization=!container [Socket] Service=udev.service -- cgit v1.2.3-54-g00ecf From f42ee4838d5390e3033f2e71b5a26e033c7b02b8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Oct 2011 03:11:33 +0200 Subject: delete left-over files in extras/ --- extras/input_id/input_id | Bin 135746 -> 0 bytes extras/input_id/input_id.c | 0 extras/path_id/path_id | Bin 151405 -> 0 bytes extras/path_id/path_id.c | 0 extras/usb_id/usb_id | Bin 155307 -> 0 bytes extras/usb_id/usb_id.c | 0 6 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 extras/input_id/input_id delete mode 100644 extras/input_id/input_id.c delete mode 100755 extras/path_id/path_id delete mode 100644 extras/path_id/path_id.c delete mode 100755 extras/usb_id/usb_id delete mode 100644 extras/usb_id/usb_id.c diff --git a/extras/input_id/input_id b/extras/input_id/input_id deleted file mode 100755 index e215aad729..0000000000 Binary files a/extras/input_id/input_id and /dev/null differ diff --git a/extras/input_id/input_id.c b/extras/input_id/input_id.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/extras/path_id/path_id b/extras/path_id/path_id deleted file mode 100755 index 567d508f1d..0000000000 Binary files a/extras/path_id/path_id and /dev/null differ diff --git a/extras/path_id/path_id.c b/extras/path_id/path_id.c deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/extras/usb_id/usb_id b/extras/usb_id/usb_id deleted file mode 100755 index 903702e876..0000000000 Binary files a/extras/usb_id/usb_id and /dev/null differ diff --git a/extras/usb_id/usb_id.c b/extras/usb_id/usb_id.c deleted file mode 100644 index e69de29bb2..0000000000 -- cgit v1.2.3-54-g00ecf From dd2247464f56f0cffe92250bb107e97477effbc2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 6 Oct 2011 03:14:50 +0200 Subject: systemd: update drop-in sd-daemon files --- udev/sd-daemon.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/udev/sd-daemon.c b/udev/sd-daemon.c index a2ec74cceb..e68b70875c 100644 --- a/udev/sd-daemon.c +++ b/udev/sd-daemon.c @@ -49,13 +49,19 @@ #include "sd-daemon.h" -#if (__GNUC__ >= 4) && !defined(SD_EXPORT_SYMBOLS) -#define _sd_hidden_ __attribute__ ((visibility("hidden"))) +#if (__GNUC__ >= 4) +#ifdef SD_EXPORT_SYMBOLS +/* Export symbols */ +#define _sd_export_ __attribute__ ((visibility("default"))) #else -#define _sd_hidden_ +/* Don't export the symbols */ +#define _sd_export_ __attribute__ ((visibility("hidden"))) +#endif +#else +#define _sd_export_ #endif -_sd_hidden_ int sd_listen_fds(int unset_environment) { +_sd_export_ int sd_listen_fds(int unset_environment) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; @@ -136,7 +142,7 @@ finish: #endif } -_sd_hidden_ int sd_is_fifo(int fd, const char *path) { +_sd_export_ int sd_is_fifo(int fd, const char *path) { struct stat st_fd; if (fd < 0) @@ -169,7 +175,7 @@ _sd_hidden_ int sd_is_fifo(int fd, const char *path) { return 1; } -_sd_hidden_ int sd_is_special(int fd, const char *path) { +_sd_export_ int sd_is_special(int fd, const char *path) { struct stat st_fd; if (fd < 0) @@ -256,7 +262,7 @@ union sockaddr_union { struct sockaddr_storage storage; }; -_sd_hidden_ int sd_is_socket(int fd, int family, int type, int listening) { +_sd_export_ int sd_is_socket(int fd, int family, int type, int listening) { int r; if (family < 0) @@ -284,7 +290,7 @@ _sd_hidden_ int sd_is_socket(int fd, int family, int type, int listening) { return 1; } -_sd_hidden_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { +_sd_export_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { union sockaddr_union sockaddr; socklen_t l; int r; @@ -329,7 +335,7 @@ _sd_hidden_ int sd_is_socket_inet(int fd, int family, int type, int listening, u return 1; } -_sd_hidden_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { +_sd_export_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { union sockaddr_union sockaddr; socklen_t l; int r; @@ -372,7 +378,7 @@ _sd_hidden_ int sd_is_socket_unix(int fd, int type, int listening, const char *p return 1; } -_sd_hidden_ int sd_is_mq(int fd, const char *path) { +_sd_export_ int sd_is_mq(int fd, const char *path) { #if !defined(__linux__) return 0; #else @@ -409,7 +415,7 @@ _sd_hidden_ int sd_is_mq(int fd, const char *path) { #endif } -_sd_hidden_ int sd_notify(int unset_environment, const char *state) { +_sd_export_ int sd_notify(int unset_environment, const char *state) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) return 0; #else @@ -477,7 +483,7 @@ finish: #endif } -_sd_hidden_ int sd_notifyf(int unset_environment, const char *format, ...) { +_sd_export_ int sd_notifyf(int unset_environment, const char *format, ...) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; #else @@ -499,7 +505,7 @@ _sd_hidden_ int sd_notifyf(int unset_environment, const char *format, ...) { #endif } -_sd_hidden_ int sd_booted(void) { +_sd_export_ int sd_booted(void) { #if defined(DISABLE_SYSTEMD) || !defined(__linux__) return 0; #else -- cgit v1.2.3-54-g00ecf From 7944a13a2b8516d5fa354703789f5988cb4299b6 Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Sat, 8 Oct 2011 02:14:09 -0700 Subject: udevd: exit - process events before signals in worker When a worker receives both a signal and a udev event in the same epoll_wait run, the event must be processed first because the udev parent considers the event already dispatched. If we process the signal first and exit, udevd times out after 60 seconds waiting for a response from an already-dead worker. Ref: https://bugs.launchpad.net/bugs/818177 Signed-off-by: Steve Langasek --- udev/udevd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/udevd.c b/udev/udevd.c index 77aec9d2ae..b65b53f7ed 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -347,6 +347,7 @@ static void worker_new(struct event *event) for (i = 0; i < fdcount; i++) { if (ev[i].data.fd == fd_monitor && ev[i].events & EPOLLIN) { dev = udev_monitor_receive_device(worker_monitor); + break; } else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) { struct signalfd_siginfo fdsi; ssize_t size; -- cgit v1.2.3-54-g00ecf From 5cc4112e6d326436dab7476ccc17588d42bf782f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 9 Oct 2011 22:52:03 +0200 Subject: udevadm: control - use /run/udev/control socket instead of abstract namespace one --- TODO | 3 --- init/udev-control.socket | 2 +- udev/udev-ctrl.c | 31 ++++++++++++++----------------- udev/udev.h | 6 ++---- udev/udevadm-control.c | 7 ++++++- udev/udevadm-settle.c | 2 +- udev/udevd.c | 4 ++-- 7 files changed, 26 insertions(+), 29 deletions(-) diff --git a/TODO b/TODO index 3dcaf4ca85..1d26f451b0 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,5 @@ - test (now fixed) /dev/tape/ links - - /run/udev/control socket - (add ConditionVirtualization=!pidns) - - move udevd -> --libexecdir - have a $attrs{} ? diff --git a/init/udev-control.socket b/init/udev-control.socket index 8f3106130b..ea21803f77 100644 --- a/init/udev-control.socket +++ b/init/udev-control.socket @@ -5,4 +5,4 @@ ConditionVirtualization=!container [Socket] Service=udev.service -ListenSequentialPacket=@/org/kernel/udev/udevd +ListenSequentialPacket=/run/udev/control diff --git a/udev/udev-ctrl.c b/udev/udev-ctrl.c index 85e656248b..43484cc838 100644 --- a/udev/udev-ctrl.c +++ b/udev/udev-ctrl.c @@ -60,6 +60,7 @@ struct udev_ctrl { struct sockaddr_un saddr; socklen_t addrlen; bool bound; + bool cleanup_socket; bool connected; }; @@ -69,7 +70,7 @@ struct udev_ctrl_connection { int sock; }; -static struct udev_ctrl *udev_ctrl_new(struct udev *udev) +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) { struct udev_ctrl *uctrl; @@ -78,16 +79,6 @@ static struct udev_ctrl *udev_ctrl_new(struct udev *udev) return NULL; uctrl->refcount = 1; uctrl->udev = udev; - return uctrl; -} - -struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *socket_path, int fd) -{ - struct udev_ctrl *uctrl; - - uctrl = udev_ctrl_new(udev); - if (uctrl == NULL) - return NULL; if (fd < 0) { uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); @@ -102,17 +93,15 @@ struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *so } uctrl->saddr.sun_family = AF_LOCAL; - strcpy(uctrl->saddr.sun_path, socket_path); + util_strscpyl(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), + udev_get_run_path(udev), "/control", NULL); uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); - /* translate leading '@' to abstract namespace */ - if (uctrl->saddr.sun_path[0] == '@') - uctrl->saddr.sun_path[0] = '\0'; return uctrl; } -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path) +struct udev_ctrl *udev_ctrl_new(struct udev *udev) { - return udev_ctrl_new_from_socket_fd(udev, socket_path, -1); + return udev_ctrl_new_from_fd(udev, -1); } int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) @@ -121,6 +110,11 @@ int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) if (!uctrl->bound) { err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err < 0 && errno == EADDRINUSE) { + unlink(uctrl->saddr.sun_path); + err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + } + if (err < 0) { err = -errno; err(uctrl->udev, "bind failed: %m\n"); @@ -135,6 +129,7 @@ int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) } uctrl->bound = true; + uctrl->cleanup_socket = true; } return 0; } @@ -161,6 +156,8 @@ struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) return uctrl; if (uctrl->sock >= 0) close(uctrl->sock); + if (uctrl->cleanup_socket) + unlink(uctrl->saddr.sun_path); free(uctrl); return NULL; } diff --git a/udev/udev.h b/udev/udev.h index 5aaf117a9c..402c738aee 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -26,8 +26,6 @@ #include "libudev.h" #include "libudev-private.h" -#define UDEV_CTRL_SOCK_PATH "@/org/kernel/udev/udevd" - struct udev_event { struct udev *udev; struct udev_device *dev; @@ -99,8 +97,8 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev /* udev-ctrl.c */ struct udev_ctrl; -struct udev_ctrl *udev_ctrl_new_from_socket(struct udev *udev, const char *socket_path); -struct udev_ctrl *udev_ctrl_new_from_socket_fd(struct udev *udev, const char *socket_path, int fd); +struct udev_ctrl *udev_ctrl_new(struct udev *udev); +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd); int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index b500d75a4e..130a71b3d0 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -66,7 +66,7 @@ static int adm_control(struct udev *udev, int argc, char *argv[]) return 1; } - uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); + uctrl = udev_ctrl_new(udev); if (uctrl == NULL) return 2; @@ -157,6 +157,11 @@ static int adm_control(struct udev *udev, int argc, char *argv[]) break; } } + + if (argv[optind] != NULL) + fprintf(stderr, "unknown option\n"); + else if (optind == 1) + fprintf(stderr, "missing option\n"); out: udev_ctrl_unref(uctrl); return rc; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c index 9f409b61b8..a59d7c39e5 100644 --- a/udev/udevadm-settle.c +++ b/udev/udevadm-settle.c @@ -138,7 +138,7 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) if (getuid() == 0) { struct udev_ctrl *uctrl; - uctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); + uctrl = udev_ctrl_new(udev); if (uctrl != NULL) { if (udev_ctrl_send_ping(uctrl, timeout) < 0) { info(udev, "no connection to daemon\n"); diff --git a/udev/udevd.c b/udev/udevd.c index b65b53f7ed..fdb3e42002 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1349,7 +1349,7 @@ int main(int argc, char *argv[]) if (systemd_fds(udev, &fd_ctrl, &fd_netlink) >= 0) { /* get control and netlink socket from from systemd */ - udev_ctrl = udev_ctrl_new_from_socket_fd(udev, UDEV_CTRL_SOCK_PATH, fd_ctrl); + udev_ctrl = udev_ctrl_new_from_fd(udev, fd_ctrl); if (udev_ctrl == NULL) { err(udev, "error taking over udev control socket"); rc = 1; @@ -1364,7 +1364,7 @@ int main(int argc, char *argv[]) } } else { /* open control and netlink socket */ - udev_ctrl = udev_ctrl_new_from_socket(udev, UDEV_CTRL_SOCK_PATH); + udev_ctrl = udev_ctrl_new(udev); if (udev_ctrl == NULL) { fprintf(stderr, "error initializing udev control socket"); err(udev, "error initializing udev control socket"); -- cgit v1.2.3-54-g00ecf From 1f5a5100f3bdfdaf9ef71b29931574b678ff0d82 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 10 Oct 2011 00:38:56 +0200 Subject: udevd: control - no not delete socket file when --daemon is used --- udev/udev-ctrl.c | 9 +++++++-- udev/udev.h | 1 + udev/udevd.c | 5 +++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/udev/udev-ctrl.c b/udev/udev-ctrl.c index 43484cc838..4bca807b69 100644 --- a/udev/udev-ctrl.c +++ b/udev/udev-ctrl.c @@ -156,12 +156,17 @@ struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) return uctrl; if (uctrl->sock >= 0) close(uctrl->sock); - if (uctrl->cleanup_socket) - unlink(uctrl->saddr.sun_path); free(uctrl); return NULL; } +int udev_ctrl_cleanup(struct udev_ctrl *uctrl) +{ + if (uctrl->cleanup_socket) + unlink(uctrl->saddr.sun_path); + return 0; +} + int udev_ctrl_get_fd(struct udev_ctrl *uctrl) { if (uctrl == NULL) diff --git a/udev/udev.h b/udev/udev.h index 402c738aee..eaba4ed341 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -102,6 +102,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd); int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); +int udev_ctrl_cleanup(struct udev_ctrl *uctrl); struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); int udev_ctrl_get_fd(struct udev_ctrl *uctrl); int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout); diff --git a/udev/udevd.c b/udev/udevd.c index fdb3e42002..60edea98e1 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1420,7 +1420,7 @@ int main(int argc, char *argv[]) goto exit; default: rc = EXIT_SUCCESS; - goto exit_keep_queue; + goto exit_daemonize; } setsid(); @@ -1704,7 +1704,8 @@ int main(int argc, char *argv[]) rc = EXIT_SUCCESS; exit: udev_queue_export_cleanup(udev_queue_export); -exit_keep_queue: + udev_ctrl_cleanup(udev_ctrl); +exit_daemonize: if (fd_ep >= 0) close(fd_ep); worker_list_cleanup(udev); -- cgit v1.2.3-54-g00ecf From 29282732bd7d78d90713ee56f8bac71777362ef2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 10 Oct 2011 02:30:42 +0200 Subject: udev_ctrl_cleanup()- accept NULL as argument --- udev/udev-ctrl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev/udev-ctrl.c b/udev/udev-ctrl.c index 4bca807b69..e4348c314d 100644 --- a/udev/udev-ctrl.c +++ b/udev/udev-ctrl.c @@ -162,6 +162,8 @@ struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) int udev_ctrl_cleanup(struct udev_ctrl *uctrl) { + if (uctrl == NULL) + return 0; if (uctrl->cleanup_socket) unlink(uctrl->saddr.sun_path); return 0; @@ -170,7 +172,7 @@ int udev_ctrl_cleanup(struct udev_ctrl *uctrl) int udev_ctrl_get_fd(struct udev_ctrl *uctrl) { if (uctrl == NULL) - return -1; + return -EINVAL; return uctrl->sock; } -- cgit v1.2.3-54-g00ecf From c61e36b1b49cc8bafd3f93a12a952d01658ff75e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 10 Oct 2011 14:49:18 +0200 Subject: update NEWS --- NEWS | 5 ++++- TODO | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index abb0ee922f..2f96d09168 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -udev 174 +udev 173+ ======== Bugfixes. @@ -16,6 +16,9 @@ The long deprecated keys: SYSFS, ID, BUS have been removed. The support for 'udevadm trigger --type=failed, and the RUN{fail_event_on_error} attribute was removed. +The udev control socket is now created in /run/udev/control +and no longer as an abstract namespace one. + udev 173 ======== Bugfixes. diff --git a/TODO b/TODO index 1d26f451b0..6e33f428f2 100644 --- a/TODO +++ b/TODO @@ -1,19 +1,19 @@ - test (now fixed) /dev/tape/ links - move udevd -> --libexecdir + - move udevadm -> --bindir - have a $attrs{} ? - kill rules_generator - - move udevadm -> --bindir - - kill tabs? - - warn about RUN+="socket:" + - deprecate and warn about RUN+="socket:" - libudev.so.1 - - symbol versioning: + - symbol versioning - return object with *_unref() - udev_monitor_from_socket() - udev_queue_get_failed_list_entry() + -- cgit v1.2.3-54-g00ecf From d964a4bfde57ad1b05d105edd5d078e1aac45da6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 10 Oct 2011 20:27:20 +0200 Subject: udevd: install into /lib/udev instead of /sbin --- Makefile.am | 6 ++++-- NEWS | 14 ++++++++++---- TODO | 1 - init/udev.service.in | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index d8b1889c22..0cc45e6ff4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -151,9 +151,11 @@ INSTALL_DATA_HOOKS += systemd-install-hook endif sbin_PROGRAMS = \ - udev/udevd \ udev/udevadm +libexec_PROGRAMS = \ + udev/udevd + udev_common_sources =\ udev/udev.h \ udev/udev-event.c \ @@ -233,7 +235,7 @@ extras_firmware_firmware_SOURCES = extras/firmware/firmware.c extras_firmware_firmware_LDADD = libudev/libudev-private.la extras_firmware_firmware_CPPFLAGS = $(AM_CPPFLAGS) -DFIRMWARE_PATH="$(FIRMWARE_PATH)" dist_udevrules_DATA += extras/firmware/50-firmware.rules -libexec_PROGRAMS = extras/firmware/firmware +libexec_PROGRAMS += extras/firmware/firmware # ------------------------------------------------------------------------------ # ata_id - ATA identify diff --git a/NEWS b/NEWS index 2f96d09168..2649ac550d 100644 --- a/NEWS +++ b/NEWS @@ -2,16 +2,22 @@ udev 173+ ======== Bugfixes. -The path_id, usb_id, input_id tools are built-in commands now -and the stand-alone tools do not exist anymore. For testing, -the commands can be run with 'udevadm test-builtin '. +The udev daemon moved to /lib/udev/udevd. Non-systemd init systems +and non-dracut initramfs image generators need to change the init +scripts. Alternatively the udev build needs to move udevd back to +/sbin or create a symlink in /sbin, which is not done by default. + +The path_id, usb_id, input_id tools are built-in commands now and +the stand-alone tools do not exist anymore. Static lists of file in +initramfs generators need to be updated. For testing, the commands +can still be executed standalone with 'udevadm test-builtin '. The fusectl filesystem is no longer mounted directly from udev. Systemd systems will take care of mounting fusectl and configfs now. Non-systemd systems need to ship their own rule if they need these filesystems auto-mounted. -The long deprecated keys: SYSFS, ID, BUS have been removed. +The long deprecated keys: SYSFS=, ID=, BUS= have been removed. The support for 'udevadm trigger --type=failed, and the RUN{fail_event_on_error} attribute was removed. diff --git a/TODO b/TODO index 6e33f428f2..96d5b68123 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,5 @@ - test (now fixed) /dev/tape/ links - - move udevd -> --libexecdir - move udevadm -> --bindir - have a $attrs{} ? diff --git a/init/udev.service.in b/init/udev.service.in index 4107b6a93e..0a3f62869f 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -11,4 +11,4 @@ Type=notify OOMScoreAdjust=-1000 Sockets=udev-control.socket udev-kernel.socket Restart=on-failure -ExecStart=@sbindir@/udevd +ExecStart=@libexecdir@/udevd -- cgit v1.2.3-54-g00ecf From 54da62909f1a4c91d7f603b504cf170ebb57220e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 11 Oct 2011 13:25:44 +0200 Subject: udevd: add missing braces David: uh, don't you need curly braces in the udevd.c part at the bottom? --- udev/udevd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udev/udevd.c b/udev/udevd.c index 60edea98e1..05d4b2d66b 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1648,10 +1648,11 @@ int main(int argc, char *argv[]) struct udev_device *dev; dev = udev_monitor_receive_device(monitor); - if (dev != NULL) + if (dev != NULL) { udev_device_set_usec_initialized(dev, now_usec()); if (event_queue_insert(dev) < 0) udev_device_unref(dev); + } } /* start new events */ -- cgit v1.2.3-54-g00ecf From 9371e6f3e04b03692c23e392fdf005a08ccf1edb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 12 Oct 2011 02:02:16 +0200 Subject: systemd: use ConditionCapability=CAP_MKNOD instead of ConditionVirtualization=!container --- init/udev-control.socket | 2 +- init/udev-kernel.socket | 2 +- init/udev.service.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/init/udev-control.socket b/init/udev-control.socket index ea21803f77..858ddffd38 100644 --- a/init/udev-control.socket +++ b/init/udev-control.socket @@ -1,7 +1,7 @@ [Unit] Description=udev Control Socket DefaultDependencies=no -ConditionVirtualization=!container +ConditionCapability=CAP_MKNOD [Socket] Service=udev.service diff --git a/init/udev-kernel.socket b/init/udev-kernel.socket index b6d1c88c18..1c5545378e 100644 --- a/init/udev-kernel.socket +++ b/init/udev-kernel.socket @@ -1,7 +1,7 @@ [Unit] Description=udev Kernel Socket DefaultDependencies=no -ConditionVirtualization=!container +ConditionCapability=CAP_MKNOD [Socket] Service=udev.service diff --git a/init/udev.service.in b/init/udev.service.in index 0a3f62869f..000721810b 100644 --- a/init/udev.service.in +++ b/init/udev.service.in @@ -4,7 +4,7 @@ Wants=udev-control.socket udev-kernel.socket After=udev-control.socket udev-kernel.socket Before=basic.target DefaultDependencies=no -ConditionVirtualization=!container +ConditionCapability=CAP_MKNOD [Service] Type=notify -- cgit v1.2.3-54-g00ecf From 6ac6c3a04ca47df501ba29e4f20337719ad0a776 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Wed, 12 Oct 2011 22:31:20 -0500 Subject: Add mic mute keycode support for Lenovo Thinkpad USB keyboard This patch adds mic mute keycode support for the Lenovo Thinkpad USB keyboard. Support for this keycode was introduced upstream, and will be defined in upcoming 3.1 Linux Kernel input.h header: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=33009557bd Signed-off-by: Martin Pitt --- extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint index bc9147085b..3e94547270 100644 --- a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint +++ b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint @@ -10,4 +10,4 @@ 0x90011 prog1 # Thinkvantage button 0x90015 camera # Fn+F6 headset/camera VoIP key ?? -# 0x90010 # Microphone mute button ?? +0x90010 micmute # Microphone mute button -- cgit v1.2.3-54-g00ecf From 09637f743414e2c36d6c5b032d77d76dbeb86b31 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 19 Oct 2011 20:42:10 +0200 Subject: rules: do not load sg module --- rules/rules.d/80-drivers.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules index 04a86bdbc1..cf89735d62 100644 --- a/rules/rules.d/80-drivers.rules +++ b/rules/rules.d/80-drivers.rules @@ -7,7 +7,6 @@ SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -bv tifm_sd" SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -bv tifm_ms" SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -bv --all ms_block mspro_block" SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -bv i2o_block" -SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST!="[module/sg]", RUN+="/sbin/modprobe -bv sg" SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -bv ppdev" LABEL="drivers_end" -- cgit v1.2.3-54-g00ecf From b3eccdce81d18ec36c6ea95ac161002fc33d1810 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 19 Oct 2011 20:49:35 +0200 Subject: release 174 --- ChangeLog | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 8 ++++++- configure.ac | 6 +++--- 3 files changed, 78 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ea833c0265..ed5bb13cef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,71 @@ +Summary of changes from v173 to v174 +============================================ + +David Zeuthen (1): + ata_id: Check for Compact Flash card + +Jerone Young (1): + Add mic mute keycode support for Lenovo Thinkpad USB keyboard + +Kay Sievers (34): + gtk-doc: delete empty files + libudev: list - use binary search for list lookup + rules: move input_id to default rules + implement path_id, usb_id, input_id as built-in command + do not remove static nodes on module unload + rules: remove legacy rules for cdrom and usb printer + update TODO + preserve 'sticky bit' on 'add/change' events + libudev: util_get_sys_(subsystem,driver}() -> util_get_sys_core_link_value() + export USEC_INITIALIZED= and take timestamp on message receive time + libudev: udev_device_get_sysattr_value() return syspath of custom links + libudev: list - properly sort linked list not only the index + mknod: do not complain about existing node + update README + libudev: fix typo in documentation + rules: fuse: do not mount fusectl from udev rules + keymap: add genius keymap to Makefile + update NEWS + usb_id: can't use global variables when used as built-in + remove 'udevadm trigger --type=failed' and SYSFS, ID, BUS keys + libudev: export udev_util_encode_string() + update TODO + systemd: no not start udev in a container + systemd: no not start udev in a container + delete left-over files in extras/ + systemd: update drop-in sd-daemon files + udevadm: control - use /run/udev/control socket instead of abstract namespace one + udevd: control - no not delete socket file when --daemon is used + udev_ctrl_cleanup()- accept NULL as argument + update NEWS + udevd: install into /lib/udev instead of /sbin + udevd: add missing braces + systemd: use ConditionCapability=CAP_MKNOD instead of ConditionVirtualization=!container + rules: do not load sg module + +Kir Kolyshkin (1): + keymap: add Genius SlimStar 320 + +Martin Pitt (1): + keymap: Update Acer Aspire 5920g + +Matthias Clasen (1): + make: allow to pass ${ACLOCAL_FLAGS} + +Paul Fox (1): + keymap: update the OLPC keymap for correct function key behavior + +Petr Uzel (1): + udevadm: settle - return failure if unknown option is given + +Steve Langasek (1): + udevd: exit - process events before signals in worker + +Thomas Hood (2): + keymap: Support keymap overrides in /etc/udev/keymaps + keymap: Support for microphone mute button on ThinkPad X220 et al + + Summary of changes from v172 to v173 ============================================ diff --git a/NEWS b/NEWS index 2649ac550d..f4ad9f0074 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -udev 173+ +udev 174 ======== Bugfixes. @@ -25,6 +25,12 @@ RUN{fail_event_on_error} attribute was removed. The udev control socket is now created in /run/udev/control and no longer as an abstract namespace one. +The rules to create persistent network interface and cdrom link +rules automatically in /etc/udev/rules.d/ have been disabled by +default. Explicit configuration will be required for these use +cases, udev will no longer try to write any persistent system +configuration from a device hotplug path. + udev 173 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index bc8e6fbac4..a12c0141fb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [173], + [174], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) @@ -173,8 +173,8 @@ AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = xyes]) # rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ AC_ARG_ENABLE([rule_generator], - AS_HELP_STRING([--disable-rule_generator], [disable persistent network, cdrom support]), - [], [enable_rule_generator=yes]) + AS_HELP_STRING([--enable-rule_generator], [enable persistent network + cdrom links support]), + [], [enable_rule_generator=no]) AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = xyes]) # ------------------------------------------------------------------------------ -- cgit v1.2.3-54-g00ecf From af9cfc11909b3c33f86f495fc0a48e53fdabb32d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 20 Oct 2011 00:01:02 +0200 Subject: make: add gpg signing bits --- Makefile.am | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 0cc45e6ff4..a67e2f34fa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -679,9 +679,14 @@ git-release: head -1 ChangeLog | grep -q "to v$(VERSION)" head -1 NEWS | grep -q "udev $(VERSION)" git commit -a -m "release $(VERSION)" - git tag $(VERSION) + git tag -m "udev $(VERSION)" -s $(VERSION) git gc --prune=0 +tar: + make distcheck + gpg --armor --detach-sign udev-$(VERSION).tar.gz + gpg --armor --detach-sign udev-$(VERSION).tar.bz2 + git-sync: git push git push --tags $(VERSION) -- cgit v1.2.3-54-g00ecf From 95691487363ef213fec6975219c87d29415a2479 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 22 Oct 2011 20:50:23 +0200 Subject: ignore entire rules line if unknown keys are used --- udev/udev-rules.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 75636d9bd6..f540a5ae7b 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1612,7 +1612,9 @@ static int add_rule(struct udev_rules *rules, char *line, continue; } + err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); + goto invalid; } /* add rule token */ -- cgit v1.2.3-54-g00ecf From 7796af6ae601f5bb83fbbc70f3302c9a0a50ef88 Mon Sep 17 00:00:00 2001 From: Jerone Young Date: Tue, 25 Oct 2011 00:22:30 -0500 Subject: keymap: Fix micmute remap for Lenovo Thinkpads Linux Kernel 3.1 now has proper support for a mic mute button: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=33009557bd Signed-off-by: Martin Pitt --- extras/keymap/keymaps/module-lenovo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/keymaps/module-lenovo b/extras/keymap/keymaps/module-lenovo index 81b8feae0b..8e38883091 100644 --- a/extras/keymap/keymaps/module-lenovo +++ b/extras/keymap/keymaps/module-lenovo @@ -14,4 +14,4 @@ 0x15 volumedown 0x16 mute 0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") -0x1A prog2 # Microphone mute +0x1A micmute # Microphone mute -- cgit v1.2.3-54-g00ecf From 3aa3be179fd7eea792e5dfe71e0b2c9723c8a9b2 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Oct 2011 07:38:06 +0200 Subject: check-keymaps.sh: Allow running separately Provide default arguments for SRCDIR and KEYLIST, so that you can just run this from the root of the source tree, separately from make distcheck. --- extras/keymap/check-keymaps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh index c92246a2cd..df18c3f488 100755 --- a/extras/keymap/check-keymaps.sh +++ b/extras/keymap/check-keymaps.sh @@ -3,8 +3,8 @@ # check that all key names in keymaps/* are known in # and that all key maps listed in the rules are valid and present in # Makefile.am -SRCDIR=$1 -KEYLIST=$2 +SRCDIR=${1:-.} +KEYLIST=${2:-extras/keymap/keys.txt} KEYMAPS_DIR=$SRCDIR/extras/keymap/keymaps #extras/keymap/keymaps RULES=$SRCDIR/extras/keymap/95-keymap.rules -- cgit v1.2.3-54-g00ecf From 8ab7a9be03441db21d459cbb9c08400377c3556d Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Oct 2011 11:03:21 +0200 Subject: extras/keymap/findkeyboards: Filter out non-event devices This avoids running udevadm info --query=name against a non-existing devnode, which aborts the script early. --- extras/keymap/findkeyboards | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards index 5a22649ec9..fd64301da6 100755 --- a/extras/keymap/findkeyboards +++ b/extras/keymap/findkeyboards @@ -21,6 +21,11 @@ keyboard_devices() { for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do walk=`udevadm info --attribute-walk --path=$dev` env=`udevadm info --query=env --path=$dev` + # filter out non-event devices, such as the parent input devices which + # have no devnode + if ! echo "$env" | grep -q '^DEVNAME='; then + continue + fi if echo "$walk" | grep -q 'DRIVERS=="atkbd"'; then echo -n 'AT keyboard: ' elif echo "$env" | grep -q '^ID_USB_DRIVER=usbhid'; then -- cgit v1.2.3-54-g00ecf From 6882949d7a43932b80faa962d019d37fafcf044a Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Oct 2011 11:11:15 +0200 Subject: findkeyboards: Consistently use spaces instead of tabs --- extras/keymap/findkeyboards | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards index fd64301da6..5d636de3af 100755 --- a/extras/keymap/findkeyboards +++ b/extras/keymap/findkeyboards @@ -20,7 +20,7 @@ keyboard_devices() { # standard AT keyboard for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do walk=`udevadm info --attribute-walk --path=$dev` - env=`udevadm info --query=env --path=$dev` + env=`udevadm info --query=env --path=$dev` # filter out non-event devices, such as the parent input devices which # have no devnode if ! echo "$env" | grep -q '^DEVNAME='; then @@ -28,12 +28,12 @@ keyboard_devices() { fi if echo "$walk" | grep -q 'DRIVERS=="atkbd"'; then echo -n 'AT keyboard: ' - elif echo "$env" | grep -q '^ID_USB_DRIVER=usbhid'; then + elif echo "$env" | grep -q '^ID_USB_DRIVER=usbhid'; then echo -n 'USB keyboard: ' - else - echo -n 'Unknown type: ' + else + echo -n 'Unknown type: ' fi - udevadm info --query=name --path=$dev + udevadm info --query=name --path=$dev done # modules @@ -43,11 +43,11 @@ keyboard_devices() { module="$module `udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys'`" for m in $module; do - evdev=`ls -d $m/event* 2>/dev/null` - if [ -e "$evdev/dev" ]; then - echo -n 'module: ' - udevadm info --query=name --path=$evdev - fi + evdev=`ls -d $m/event* 2>/dev/null` + if [ -e "$evdev/dev" ]; then + echo -n 'module: ' + udevadm info --query=name --path=$evdev + fi done } -- cgit v1.2.3-54-g00ecf From 23afb57f299c6017648f7701e2130ae50057394b Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Oct 2011 14:30:26 +0200 Subject: keymap: Fix stuck keys on GIGABYTE i1520M MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks Lukáš Mojžíš! https://launchpad.net/bugs/770680 --- extras/keymap/95-keyboard-force-release.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 448db56d1c..eb6b8144cb 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -46,4 +46,6 @@ ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]prod ENV{DMI_VENDOR}=="HANNspree", ATTR{[dmi/id]product_name}=="SN10E100", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="GIGABYTE", ATTR{[dmi/id]product_name}=="i1520M", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From 6415f8973241c6d854067f488f8419f0251c0336 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Oct 2011 15:06:08 +0200 Subject: keymap: More Asus module variants https://launchpad.net/bugs/795694 --- extras/keymap/95-keymap.rules | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 0742787ed1..0f5088804b 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -43,13 +43,15 @@ LABEL="keyboard_modulecheck" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" ENV{DMI_VENDOR}=="", GOTO="keyboard_end" -ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-lenovo" ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="Lenovo ThinkPad SL Series extra buttons", RUN+="keymap $name 0x0E bluetooth" + ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" -ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" -ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys", RUN+="keymap $name 0x6B f21" +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys|Asus Laptop Support|Asus*WMI*", RUN+="keymap $name 0x6B f21" ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC Hotkey Driver", RUN+="keymap $name 0x37 f21" + +ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" +ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" ENV{DMI_VENDOR}=="Acer*", KERNELS=="input*", ATTRS{name}=="Acer WMI hotkeys", RUN+="keymap $name 0x82 f21" ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", KERNELS=="input*", ATTRS{name}=="MSI Laptop hotkeys", RUN+="keymap $name 0x213 f22 0x214 f23" -- cgit v1.2.3-54-g00ecf From b3ffede4d902ae3e365f30afae4e0e98b85791c9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Oct 2011 15:10:19 +0200 Subject: keymap: Fix "internet" key on HP G62 https://launchpad.net/bugs/763525 --- extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 0f5088804b..f88a748bba 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -91,6 +91,7 @@ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*Elit ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keymap $name hewlett-packard-2510p_2530p" ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www" # HP Pavillion dv6315ea has empty DMI_VENDOR ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play -- cgit v1.2.3-54-g00ecf From 18ba17618962fe57162ae5ac3d45a7c591c7cc75 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Oct 2011 15:14:03 +0200 Subject: keymap: Fix bluetooth key on Acer TravelMate 7720 https://launchpad.net/bugs/696671 --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index f88a748bba..7c2f88cab9 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -101,7 +101,7 @@ ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C3[01]0*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|TravelMate*7720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*4720*", RUN+="keymap $name 0xB2 www 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" -- cgit v1.2.3-54-g00ecf From 092a53bb92165e189b2c14ab5e21481a85b23475 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 26 Oct 2011 15:32:57 +0200 Subject: keymap: Fix stuck keys on BenQ nScreen https://launchpad.net/bugs/606599 --- extras/keymap/95-keyboard-force-release.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index eb6b8144cb..63cf67fb59 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -48,4 +48,6 @@ ENV{DMI_VENDOR}=="HANNspree", ATTR{[dmi/id]product_name}=="SN10E100", RUN+="keyb ENV{DMI_VENDOR}=="GIGABYTE", ATTR{[dmi/id]product_name}=="i1520M", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="BenQ", ATTR{[dmi/id]product_name}=="*nScreen*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + LABEL="force_release_end" -- cgit v1.2.3-54-g00ecf From 39649a8b3a1e7121a622dd3d01c0beb6b3da9b0b Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Sat, 29 Oct 2011 12:16:43 -0400 Subject: gudev: Use strtoul to parse unsigned 64-bit integers Otherwise it will return 0x7fffffffffffffff instead of 0x8000000000000004 for e.g. this property ID_PART_ENTRY_FLAGS=0x8000000000000004 Signed-off-by: David Zeuthen --- extras/gudev/gudevdevice.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/gudev/gudevdevice.c b/extras/gudev/gudevdevice.c index 6f30d12d07..e77b34bd50 100644 --- a/extras/gudev/gudevdevice.c +++ b/extras/gudev/gudevdevice.c @@ -538,7 +538,7 @@ out: * @key: Name of property. * * Look up the value for @key on @device and convert it to an unsigned - * 64-bit integer using strtoll(). + * 64-bit integer using strtoul(). * * Returns: The value for @key or 0 if @key doesn't exist or isn't a * #guint64. @@ -558,7 +558,7 @@ g_udev_device_get_property_as_uint64 (GUdevDevice *device, if (s == NULL) goto out; - result = strtoll (s, NULL, 0); + result = strtoul (s, NULL, 0); out: return result; } @@ -756,7 +756,7 @@ out: * @name: Name of the sysfs attribute. * * Look up the sysfs attribute with @name on @device and convert it to an unsigned - * 64-bit integer using strtoll(). + * 64-bit integer using strtoul(). * * Returns: The value of the sysfs attribute or 0 if there is no such * attribute. @@ -776,7 +776,7 @@ g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, if (s == NULL) goto out; - result = strtoll (s, NULL, 0); + result = strtoul (s, NULL, 0); out: return result; } -- cgit v1.2.3-54-g00ecf From 45197c02a5274f291b79346a7bb294096e6ee512 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Mon, 31 Oct 2011 16:38:14 -0400 Subject: gudev: Use g_ascii_strtoull() instead of strtoul() This ensures that we get the same behavior on both 32- and 64-bit. Pointed out on the mailing list: http://permalink.gmane.org/gmane.linux.hotplug.devel/17145 Signed-off-by: David Zeuthen --- extras/gudev/gudevdevice.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/gudev/gudevdevice.c b/extras/gudev/gudevdevice.c index e77b34bd50..38d602c42a 100644 --- a/extras/gudev/gudevdevice.c +++ b/extras/gudev/gudevdevice.c @@ -538,7 +538,7 @@ out: * @key: Name of property. * * Look up the value for @key on @device and convert it to an unsigned - * 64-bit integer using strtoul(). + * 64-bit integer using g_ascii_strtoull(). * * Returns: The value for @key or 0 if @key doesn't exist or isn't a * #guint64. @@ -558,7 +558,7 @@ g_udev_device_get_property_as_uint64 (GUdevDevice *device, if (s == NULL) goto out; - result = strtoul (s, NULL, 0); + result = g_ascii_strtoull (s, NULL, 0); out: return result; } @@ -756,7 +756,7 @@ out: * @name: Name of the sysfs attribute. * * Look up the sysfs attribute with @name on @device and convert it to an unsigned - * 64-bit integer using strtoul(). + * 64-bit integer using g_ascii_strtoull(). * * Returns: The value of the sysfs attribute or 0 if there is no such * attribute. @@ -776,7 +776,7 @@ g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, if (s == NULL) goto out; - result = strtoul (s, NULL, 0); + result = g_ascii_strtoull (s, NULL, 0); out: return result; } -- cgit v1.2.3-54-g00ecf From dbfb57058683ae054bf910815072851f52e69a20 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 1 Nov 2011 13:33:33 +0100 Subject: do not skip /dev/{disk,char}/M:m removal when the device node is already gone --- udev/udev-node.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/udev/udev-node.c b/udev/udev-node.c index f19dc4d900..44d3686db6 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -416,20 +416,19 @@ int udev_node_remove(struct udev_device *dev) if (devnode == NULL) goto out; - if (stat(devnode, &stats) != 0) { - info(udev, "device node '%s' not found\n", devnode); - goto out; - } - - if (stats.st_rdev != udev_device_get_devnum(dev)) { - info(udev, "device node '%s' points to a different device, skip removal\n", devnode); - err = -1; - goto out; - } + if (stat(devnode, &stats) == 0) { + if (stats.st_rdev != udev_device_get_devnum(dev)) { + info(udev, "device node '%s' points to a different device, skip removal\n", devnode); + err = -1; + goto out; + } - if (stats.st_mode & 01000) { - info(udev, "device node '%s' has sticky bit set, skip removal\n", devnode); - goto out; + if (stats.st_mode & 01000) { + info(udev, "device node '%s' has sticky bit set, skip removal\n", devnode); + goto out; + } + } else { + info(udev, "device node '%s' not found\n", devnode); } dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); -- cgit v1.2.3-54-g00ecf From 6dd19db57c672995aa814d3f9cfd1df9d5b723ef Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 2 Nov 2011 00:07:59 +0100 Subject: replace AC_DISABLE_STATIC with LT_INIT([disable-static]) --- TODO | 2 ++ configure.ac | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/TODO b/TODO index 96d5b68123..1fd8eb2618 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ + - trigger --subsystem-match=usb/usb_device + - test (now fixed) /dev/tape/ links - move udevadm -> --bindir diff --git a/configure.ac b/configure.ac index a12c0141fb..d155709b52 100644 --- a/configure.ac +++ b/configure.ac @@ -7,12 +7,11 @@ AC_INIT([udev], AC_CONFIG_SRCDIR([udev/udevd.c]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax dist-bzip2 subdir-objects]) -AC_DISABLE_STATIC AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) AM_SILENT_RULES([yes]) -LT_INIT +LT_INIT([disable-static]) AC_PROG_AWK GTK_DOC_CHECK(1.10) AC_PREFIX_DEFAULT([/usr]) -- cgit v1.2.3-54-g00ecf From 6a90a5124a5e500fa522ad22e1527bc47d9b4c3d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 4 Nov 2011 15:16:35 +0100 Subject: make: tweak some autofoo according to Flameeyes' recommendations for libabc --- Makefile.am | 1 + autogen.sh | 3 +- configure.ac | 83 +++++++++++++++++++++++---------------------------- libudev/libudev.pc.in | 4 +-- 4 files changed, 41 insertions(+), 50 deletions(-) diff --git a/Makefile.am b/Makefile.am index a67e2f34fa..340b2e1ce4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,6 +61,7 @@ libudev_libudev_la_SOURCES =\ libudev/libudev-queue.c libudev_libudev_la_LDFLAGS = \ + $(AM_LDFLAGS) \ -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) noinst_LTLIBRARIES = \ diff --git a/autogen.sh b/autogen.sh index f659fca525..b6ffee7297 100755 --- a/autogen.sh +++ b/autogen.sh @@ -31,5 +31,4 @@ args="--prefix=/usr \ --with-selinux \ --enable-gtk-doc" -export CFLAGS="$CFLAGS $MYCFLAGS" -./configure $args $@ +./configure $args CFLAGS="${CFLAGS} ${MYCFLAGS}" $@ diff --git a/configure.ac b/configure.ac index d155709b52..511d3b8e36 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ AC_SUBST([rootlib_execdir], [$with_rootlibdir]) AC_ARG_WITH([selinux], AS_HELP_STRING([--with-selinux], [enable SELinux support]), [], [with_selinux=no]) -if test "x$with_selinux" = xyes; then +AS_IF([test "x$with_selinux" = "xyes"], [ LIBS_save=$LIBS AC_CHECK_LIB(selinux, getprevcon, [], @@ -35,23 +35,19 @@ if test "x$with_selinux" = xyes; then LIBS=$LIBS_save SELINUX_LIBS="-lselinux -lsepol" AC_DEFINE(WITH_SELINUX, [1] ,[SELinux support.]) -fi +]) AC_SUBST([SELINUX_LIBS]) -AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = xyes]) +AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = "xyes"]) AC_ARG_ENABLE([debug], - AS_HELP_STRING([--enable-debug], [enable debug messages]), + AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), [], [enable_debug=no]) -if test "x$enable_debug" = "xyes"; then - AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) -fi +AS_IF([test "x$enable_debug" = "xyes"], [ AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) ]) AC_ARG_ENABLE([logging], - AS_HELP_STRING([--disable-logging], [disable system logging]), + AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]), [], enable_logging=yes) -if test "x$enable_logging" = "xyes"; then - AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) -fi +AS_IF([test "x$enable_logging" = "xyes"], [ AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) ]) AC_ARG_WITH(firmware-path, AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], @@ -72,25 +68,21 @@ AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH]) AC_ARG_WITH([systemdsystemunitdir], AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) -if test "x$with_systemdsystemunitdir" != xno; then - AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) -fi -AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) +AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) ]) +AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ]) # ------------------------------------------------------------------------------ # GUdev - libudev gobject interface # ------------------------------------------------------------------------------ AC_ARG_ENABLE([gudev], - AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support]), + AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]), [], [enable_gudev=yes]) -if test "x$enable_gudev" = xyes; then - PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) -fi +AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ]) AC_ARG_ENABLE([introspection], - AS_HELP_STRING([--disable-introspection], [disable GObject introspection]), + AS_HELP_STRING([--disable-introspection], [disable GObject introspection @<:@default=enabled@:>@]), [], [enable_introspection=yes]) -if test "x$enable_introspection" = xyes; then +AS_IF([test "x$enable_introspection" = "xyes"], [ PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) @@ -98,18 +90,17 @@ if test "x$enable_introspection" = xyes; then AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) -fi -AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = xyes]) - -AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = xyes]) +]) +AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = "xyes"]) +AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"]) # ------------------------------------------------------------------------------ # usb/pci-db - read vendor/device string database # ------------------------------------------------------------------------------ AC_ARG_ENABLE([hwdb], - AS_HELP_STRING([--disable-hwdb], [disable hardware database support]), + AS_HELP_STRING([--disable-hwdb], [disable hardware database support @<:@default=enabled@:>@]), [], [enable_hwdb=yes]) -if test "x$enable_hwdb" = xyes; then +AS_IF([test "x$enable_hwdb" = "xyes"], [ if test "x$cross_compiling" = "xno" ; then AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) @@ -140,16 +131,16 @@ if test "x$enable_hwdb" = xyes; then AC_MSG_CHECKING([for PCI database location]) AC_MSG_RESULT([$PCI_DATABASE]) AC_SUBST(PCI_DATABASE) -fi -AM_CONDITIONAL([ENABLE_HWDB], [test "x$enable_hwdb" = xyes]) +]) +AM_CONDITIONAL([ENABLE_HWDB], [test "x$enable_hwdb" = "xyes"]) # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ AC_ARG_ENABLE([keymap], - AS_HELP_STRING([--disable-keymap], [disable keymap fixup support]), + AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]), [], [enable_keymap=yes]) -if test "x$enable_keymap" = xyes; then +AS_IF([test "x$enable_keymap" = "xyes"], [ AC_PATH_PROG([GPERF], [gperf]) if test -z "$GPERF"; then AC_MSG_ERROR([gperf is needed]) @@ -157,54 +148,54 @@ if test "x$enable_keymap" = xyes; then AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) -fi -AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = xyes]) +]) +AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = "xyes"]) # ------------------------------------------------------------------------------ # mtd_probe - autoloads FTL module for mtd devices # ------------------------------------------------------------------------------ AC_ARG_ENABLE([mtd_probe], - AS_HELP_STRING([--disable-mtd_probe], [disable MTD support]), + AS_HELP_STRING([--disable-mtd_probe], [disable MTD support @<:@default=enabled@:>@]), [], [enable_mtd_probe=yes]) -AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = xyes]) +AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = "xyes"]) # ------------------------------------------------------------------------------ # rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ AC_ARG_ENABLE([rule_generator], - AS_HELP_STRING([--enable-rule_generator], [enable persistent network + cdrom links support]), + AS_HELP_STRING([--enable-rule_generator], [enable persistent network + cdrom links support @<:@default=disabled@:>@]), [], [enable_rule_generator=no]) -AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = xyes]) +AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = "xyes"]) # ------------------------------------------------------------------------------ # udev_acl - apply ACLs for users with local forground sessions # ------------------------------------------------------------------------------ AC_ARG_ENABLE([udev_acl], - AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support]), + AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support @<:@default=disabled@:>@]), [], [enable_udev_acl=no]) -if test "x$enable_udev_acl" = xyes; then +AS_IF([test "x$enable_udev_acl" = "xyes"], [ AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) -fi -AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = xyes]) +]) +AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = "xyes"]) # ------------------------------------------------------------------------------ # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) # ------------------------------------------------------------------------------ AC_ARG_ENABLE([floppy], - AS_HELP_STRING([--enable-floppy], [enable legacy floppy support]), + AS_HELP_STRING([--enable-floppy], [enable legacy floppy support @<:@default=disabled@:>@]), [], [enable_floppy=no]) -AM_CONDITIONAL([ENABLE_FLOPPY], [test "x$enable_floppy" = xyes]) +AM_CONDITIONAL([ENABLE_FLOPPY], [test "x$enable_floppy" = "xyes"]) # ------------------------------------------------------------------------------ # edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data # ------------------------------------------------------------------------------ AC_ARG_ENABLE([edd], - AS_HELP_STRING([--enable-edd], [enable disk edd support]), + AS_HELP_STRING([--enable-edd], [enable disk edd support @<:@default=disabled@:>@]), [], [enable_edd=no]) -AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = xyes]) +AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = "xyes"]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ @@ -223,7 +214,7 @@ AC_CONFIG_FILES([ AC_OUTPUT AC_MSG_RESULT([ - udev $VERSION + $PACKAGE $VERSION ======== prefix: ${prefix} diff --git a/libudev/libudev.pc.in b/libudev/libudev.pc.in index f75794ceb8..93c8366480 100644 --- a/libudev/libudev.pc.in +++ b/libudev/libudev.pc.in @@ -1,7 +1,7 @@ prefix=@prefix@ -exec_prefix=@prefix@ +exec_prefix=@exec_prefix@ libdir=@libdir@ -includedir=@prefix@/include +includedir=@includedir@ Name: libudev Description: Library to access udev device information -- cgit v1.2.3-54-g00ecf From 5101923ff965cf35af7897e4dda378a1607f8f69 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 6 Nov 2011 23:30:31 +0100 Subject: rules: restore rule to set cdrom group for optical drives On Sun, Nov 6, 2011 at 21:45, William Hubbs wrote: > someone on gentoo just reported to me that the following rule has been > deleted from udev-174, which is leaving his optical devices in the > standard "disk" group. He does not want to add his users to this group. --- rules/rules.d/50-udev-default.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index b31ac42ab7..3ef6783037 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -70,6 +70,7 @@ SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy" # cdrom +SUBSYSTEM=="block", KERNEL=="sr[0-9]*". GROUP="cdrom" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd", GROUP="cdrom" -- cgit v1.2.3-54-g00ecf From 7b9cebf082719251f628832dadeb8178d7b904ba Mon Sep 17 00:00:00 2001 From: Harald Hoyer Date: Mon, 7 Nov 2011 14:54:47 +0100 Subject: extras/keymap/findkeyboards: beautify shell code and get rid of grep - save some extra forks and grep with shell code instead of calling grep - use $() instead of backticks (improves readability and addes nesting capabilities) Signed-off-by: Harald Hoyer Signed-off-by: Martin Pitt --- extras/keymap/findkeyboards | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards index 5d636de3af..537d163132 100755 --- a/extras/keymap/findkeyboards +++ b/extras/keymap/findkeyboards @@ -14,6 +14,20 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. +# returns OK if $1 contains $2 +strstr() { + [ "${1#*$2*}" != "$1" ] +} + +# returns OK if $1 contains $2 at the beginning +str_starts() { + [ "${1#$2*}" != "$1" ] +} + +str_line_starts() { + while read a; do str_starts "$a" "$1" && return 0;done + return 1; +} # print a list of input devices which are keyboard-like keyboard_devices() { @@ -23,12 +37,12 @@ keyboard_devices() { env=`udevadm info --query=env --path=$dev` # filter out non-event devices, such as the parent input devices which # have no devnode - if ! echo "$env" | grep -q '^DEVNAME='; then + if ! echo "$env" | str_line_starts 'DEVNAME='; then continue fi - if echo "$walk" | grep -q 'DRIVERS=="atkbd"'; then + if strstr "$walk" 'DRIVERS=="atkbd"'; then echo -n 'AT keyboard: ' - elif echo "$env" | grep -q '^ID_USB_DRIVER=usbhid'; then + elif echo "$env" | str_line_starts 'ID_USB_DRIVER=usbhid'; then echo -n 'USB keyboard: ' else echo -n 'Unknown type: ' @@ -37,17 +51,18 @@ keyboard_devices() { done # modules - module=`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons'` + module=$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons') module="$module -`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons'`" +$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons')" module="$module -`udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys'`" +$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys')" for m in $module; do - evdev=`ls -d $m/event* 2>/dev/null` - if [ -e "$evdev/dev" ]; then - echo -n 'module: ' - udevadm info --query=name --path=$evdev - fi + for evdev in $m/event*/dev; do + if [ -e "$evdev" ]; then + echo -n 'module: ' + udevadm info --query=name --path=${evdev%%/dev} + fi + done done } -- cgit v1.2.3-54-g00ecf From eabac232a51b8d8dc2f6897018968bfe96d2912d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2011 23:21:29 +0100 Subject: rules: fix typo --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 3ef6783037..c47cdeceb1 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -70,7 +70,7 @@ SUBSYSTEM=="block", GROUP="disk" SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy" # cdrom -SUBSYSTEM=="block", KERNEL=="sr[0-9]*". GROUP="cdrom" +SUBSYSTEM=="block", KERNEL=="sr[0-9]*", GROUP="cdrom" SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" KERNEL=="pktcdvd", GROUP="cdrom" -- cgit v1.2.3-54-g00ecf From 6f410b81aa6d588b03ae795c9b76468591ef7efa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 7 Nov 2011 23:28:10 +0100 Subject: release 175 --- ChangeLog | 33 +++++++++++++++++++++++++++++++++ Makefile.am | 2 +- NEWS | 4 ++++ configure.ac | 2 +- 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed5bb13cef..0110f3e939 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +Summary of changes from v174 to v175 +============================================ + +David Zeuthen (2): + gudev: Use strtoul to parse unsigned 64-bit integers + gudev: Use g_ascii_strtoull() instead of strtoul() + +Harald Hoyer (1): + extras/keymap/findkeyboards: beautify shell code and get rid of grep + +Jerone Young (1): + keymap: Fix micmute remap for Lenovo Thinkpads + +Kay Sievers (7): + make: add gpg signing bits + ignore entire rules line if unknown keys are used + do not skip /dev/{disk,char}/M:m removal when the device node is already gone + replace AC_DISABLE_STATIC with LT_INIT([disable-static]) + make: tweak some autofoo according to Flameeyes' recommendations for libabc + rules: restore rule to set cdrom group for optical drives + rules: fix typo + +Martin Pitt (8): + check-keymaps.sh: Allow running separately + extras/keymap/findkeyboards: Filter out non-event devices + findkeyboards: Consistently use spaces instead of tabs + keymap: Fix stuck keys on GIGABYTE i1520M + keymap: More Asus module variants + keymap: Fix "internet" key on HP G62 + keymap: Fix bluetooth key on Acer TravelMate 7720 + keymap: Fix stuck keys on BenQ nScreen + + Summary of changes from v173 to v174 ============================================ diff --git a/Makefile.am b/Makefile.am index 340b2e1ce4..7a3539507a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -299,7 +299,7 @@ if ENABLE_GUDEV # GUdev - libudev gobject interface # ------------------------------------------------------------------------------ LIBGUDEV_CURRENT=1 -LIBGUDEV_REVISION=0 +LIBGUDEV_REVISION=1 LIBGUDEV_AGE=1 SUBDIRS += extras/gudev/docs diff --git a/NEWS b/NEWS index f4ad9f0074..d0590e07ac 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 175 +======== +Bugfixes. + udev 174 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 511d3b8e36..e387fac22f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [174], + [175], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From 842ee61c43ad722412f9b5658619b6e81c1fe33c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 8 Nov 2011 21:59:27 +0100 Subject: libudev: print log_fn address instead of ctx when setting logging function Patch from Jiri Pirko for libabc. --- libudev/libudev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libudev/libudev.c b/libudev/libudev.c index 165c36984e..3b3a8e9af5 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -333,7 +333,7 @@ UDEV_EXPORT void udev_set_log_fn(struct udev *udev, const char *format, va_list args)) { udev->log_fn = log_fn; - info(udev, "custom logging function %p registered\n", udev); + info(udev, "custom logging function %p registered\n", log_fn); } /** -- cgit v1.2.3-54-g00ecf From 59ae8d015a4b611187031983c4d1529050318c09 Mon Sep 17 00:00:00 2001 From: Sjoerd Simons Date: Fri, 18 Nov 2011 21:37:53 +0000 Subject: keymap: Add Lenovo Thinkpad X220 Tablet The Lenovo Thinkpad X220 Tablet has similar buttons as the previous generations (circular arrow and rotate screen) Signed-off-by: Sjoerd Simons Signed-off-by: Martin Pitt --- extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 7c2f88cab9..248c58f09c 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -79,7 +79,7 @@ ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+=" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x6_tablet" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X20* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x200_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X2[02]* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x200_tablet" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" -- cgit v1.2.3-54-g00ecf From d35f72041885f4bb2c531dd3a5a765b276e365e9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 22 Nov 2011 01:15:55 +0100 Subject: do not ship autogen.sh in the tarball --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 7a3539507a..77edaf3bbc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ SUBDIRS = . -EXTRA_DIST = autogen.sh +EXTRA_DIST = ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} -- cgit v1.2.3-54-g00ecf From 1021e6dfcc339728d83bfa5a3e8cd73bb37dbcef Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 22 Nov 2011 23:51:17 +0100 Subject: man: clarify 'config file stack' --- udev/udev.xml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/udev/udev.xml b/udev/udev.xml index a785348551..ab82012cee 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -71,14 +71,18 @@ Rules files The udev rules are read from the files located in the - default rules directory /lib/udev/rules.d/, - the custom rules directory /etc/udev/rules.d/ - and the temporary rules directory /run/udev/rules.d/. - All rule files are collectively sorted and processed in lexical order, - regardless of the directories in which they live. However, files in - /etc/udev/rules.d/ take precedence over files with - the same name in /lib/udev/rules.d/; this can be - used to ignore a default rules file if needed. + system rules directory /lib/udev/rules.d/, + the local administration directory /etc/udev/rules.d/ + and the volatile runtime directory /run/udev/rules.d/. + All rules files are collectively sorted and processed in lexical order, + regardless of the directories in which they live. However, files with + identical file names replace each other. Files in /run + have the highest priority, files in /etc take precedence + over files with the same name in /lib. This can be + used to overwrite a system rules file if needed; a symlink in + /etc with the same name as a rules file in + /lib, pointing to /dev/null, + disables the rules file entirely. Rule files must have the extension .rules; other extensions are ignored. -- cgit v1.2.3-54-g00ecf From 7156ac005bdcae789c0033d0c6e3b57f1f764a1c Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Tue, 29 Nov 2011 19:06:49 +0100 Subject: 75-persistent-net-generator.rules: Add Xen Xen devices are not always caught by the SUBSYSTEMS=="xen" clause, so explictly add their registered MAC prefix: http://www.coffer.com/mac_find/?string=00%3A16%3A3E https://launchpad.net/bugs/897789 --- extras/rule_generator/75-persistent-net-generator.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules index 539807c861..aab579cde9 100644 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ b/extras/rule_generator/75-persistent-net-generator.rules @@ -61,6 +61,8 @@ ENV{MATCHADDR}=="52:54:4c:*", GOTO="globally_administered_whitelist" ENV{MATCHADDR}=="52:54:ab:*", GOTO="globally_administered_whitelist" # Kingston Technologies ENV{MATCHADDR}=="e2:0c:0f:*", GOTO="globally_administered_whitelist" +# Xensource +ENV{MATCHADDR}=="00:16:3e:*", GOTO="globally_administered_whitelist" # match interface dev_id ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}" -- cgit v1.2.3-54-g00ecf From 48b14aa053b5a7c76a47ff560a4115ad41666290 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Nov 2011 15:12:34 +0100 Subject: rename 'init' directory to 'systemd' --- Makefile.am | 14 +++++++------- configure.ac | 6 +++--- init/.gitignore | 1 - init/udev-control.socket | 8 -------- init/udev-kernel.socket | 9 --------- init/udev-settle.service.in | 25 ------------------------- init/udev-trigger.service.in | 10 ---------- init/udev.service.in | 14 -------------- systemd/.gitignore | 1 + systemd/udev-control.socket | 8 ++++++++ systemd/udev-kernel.socket | 9 +++++++++ systemd/udev-settle.service.in | 25 +++++++++++++++++++++++++ systemd/udev-trigger.service.in | 10 ++++++++++ systemd/udev.service.in | 14 ++++++++++++++ 14 files changed, 77 insertions(+), 77 deletions(-) delete mode 100644 init/.gitignore delete mode 100644 init/udev-control.socket delete mode 100644 init/udev-kernel.socket delete mode 100644 init/udev-settle.service.in delete mode 100644 init/udev-trigger.service.in delete mode 100644 init/udev.service.in create mode 100644 systemd/.gitignore create mode 100644 systemd/udev-control.socket create mode 100644 systemd/udev-kernel.socket create mode 100644 systemd/udev-settle.service.in create mode 100644 systemd/udev-trigger.service.in create mode 100644 systemd/udev.service.in diff --git a/Makefile.am b/Makefile.am index 77edaf3bbc..6a900b0a2b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -130,15 +130,15 @@ sharepkgconfig_DATA = udev/udev.pc if WITH_SYSTEMD systemdsystemunit_DATA = \ - init/udev-control.socket \ - init/udev-kernel.socket \ - init/udev.service \ - init/udev-trigger.service \ - init/udev-settle.service + systemd/udev-control.socket \ + systemd/udev-kernel.socket \ + systemd/udev.service \ + systemd/udev-trigger.service \ + systemd/udev-settle.service EXTRA_DIST += \ - init/udev-control.socket \ - init/udev-kernel.socket + systemd/udev-control.socket \ + systemd/udev-kernel.socket systemd-install-hook: mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants diff --git a/configure.ac b/configure.ac index e387fac22f..2d90b5448f 100644 --- a/configure.ac +++ b/configure.ac @@ -201,9 +201,9 @@ AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile udev/udev.pc - init/udev.service - init/udev-trigger.service - init/udev-settle.service + systemd/udev.service + systemd/udev-trigger.service + systemd/udev-settle.service libudev/libudev.pc libudev/docs/Makefile libudev/docs/version.xml diff --git a/init/.gitignore b/init/.gitignore deleted file mode 100644 index 904e445e72..0000000000 --- a/init/.gitignore +++ /dev/null @@ -1 +0,0 @@ -udev*.service diff --git a/init/udev-control.socket b/init/udev-control.socket deleted file mode 100644 index 858ddffd38..0000000000 --- a/init/udev-control.socket +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=udev Control Socket -DefaultDependencies=no -ConditionCapability=CAP_MKNOD - -[Socket] -Service=udev.service -ListenSequentialPacket=/run/udev/control diff --git a/init/udev-kernel.socket b/init/udev-kernel.socket deleted file mode 100644 index 1c5545378e..0000000000 --- a/init/udev-kernel.socket +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=udev Kernel Socket -DefaultDependencies=no -ConditionCapability=CAP_MKNOD - -[Socket] -Service=udev.service -ReceiveBuffer=134217728 -ListenNetlink=kobject-uevent 1 diff --git a/init/udev-settle.service.in b/init/udev-settle.service.in deleted file mode 100644 index f5f5958934..0000000000 --- a/init/udev-settle.service.in +++ /dev/null @@ -1,25 +0,0 @@ -# This service is usually not enabled by default. If enabled, it -# acts as a barrier for basic.target -- so all later services will -# wait for udev completely finishing its coldplug run. -# -# If needed, to work around broken or non-hotplug-aware services, -# it might be enabled unconditionally, or pulled-in on-demand by -# the services that assume a fully populated /dev at startup. It -# should not be used or pulled-in ever on systems without such -# legacy services running. - -[Unit] -Description=udev Wait for Complete Device Initialization -DefaultDependencies=no -Wants=udev.service -After=udev-trigger.service -Before=basic.target - -[Service] -Type=oneshot -TimeoutSec=180 -RemainAfterExit=yes -ExecStart=@sbindir@/udevadm settle - -[Install] -WantedBy=basic.target diff --git a/init/udev-trigger.service.in b/init/udev-trigger.service.in deleted file mode 100644 index 6d416c2b39..0000000000 --- a/init/udev-trigger.service.in +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=udev Coldplug all Devices -Wants=udev.service -After=udev-kernel.socket udev-control.socket -DefaultDependencies=no - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add diff --git a/init/udev.service.in b/init/udev.service.in deleted file mode 100644 index 000721810b..0000000000 --- a/init/udev.service.in +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=udev Kernel Device Manager -Wants=udev-control.socket udev-kernel.socket -After=udev-control.socket udev-kernel.socket -Before=basic.target -DefaultDependencies=no -ConditionCapability=CAP_MKNOD - -[Service] -Type=notify -OOMScoreAdjust=-1000 -Sockets=udev-control.socket udev-kernel.socket -Restart=on-failure -ExecStart=@libexecdir@/udevd diff --git a/systemd/.gitignore b/systemd/.gitignore new file mode 100644 index 0000000000..904e445e72 --- /dev/null +++ b/systemd/.gitignore @@ -0,0 +1 @@ +udev*.service diff --git a/systemd/udev-control.socket b/systemd/udev-control.socket new file mode 100644 index 0000000000..858ddffd38 --- /dev/null +++ b/systemd/udev-control.socket @@ -0,0 +1,8 @@ +[Unit] +Description=udev Control Socket +DefaultDependencies=no +ConditionCapability=CAP_MKNOD + +[Socket] +Service=udev.service +ListenSequentialPacket=/run/udev/control diff --git a/systemd/udev-kernel.socket b/systemd/udev-kernel.socket new file mode 100644 index 0000000000..1c5545378e --- /dev/null +++ b/systemd/udev-kernel.socket @@ -0,0 +1,9 @@ +[Unit] +Description=udev Kernel Socket +DefaultDependencies=no +ConditionCapability=CAP_MKNOD + +[Socket] +Service=udev.service +ReceiveBuffer=134217728 +ListenNetlink=kobject-uevent 1 diff --git a/systemd/udev-settle.service.in b/systemd/udev-settle.service.in new file mode 100644 index 0000000000..f5f5958934 --- /dev/null +++ b/systemd/udev-settle.service.in @@ -0,0 +1,25 @@ +# This service is usually not enabled by default. If enabled, it +# acts as a barrier for basic.target -- so all later services will +# wait for udev completely finishing its coldplug run. +# +# If needed, to work around broken or non-hotplug-aware services, +# it might be enabled unconditionally, or pulled-in on-demand by +# the services that assume a fully populated /dev at startup. It +# should not be used or pulled-in ever on systems without such +# legacy services running. + +[Unit] +Description=udev Wait for Complete Device Initialization +DefaultDependencies=no +Wants=udev.service +After=udev-trigger.service +Before=basic.target + +[Service] +Type=oneshot +TimeoutSec=180 +RemainAfterExit=yes +ExecStart=@sbindir@/udevadm settle + +[Install] +WantedBy=basic.target diff --git a/systemd/udev-trigger.service.in b/systemd/udev-trigger.service.in new file mode 100644 index 0000000000..6d416c2b39 --- /dev/null +++ b/systemd/udev-trigger.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=udev Coldplug all Devices +Wants=udev.service +After=udev-kernel.socket udev-control.socket +DefaultDependencies=no + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add diff --git a/systemd/udev.service.in b/systemd/udev.service.in new file mode 100644 index 0000000000..000721810b --- /dev/null +++ b/systemd/udev.service.in @@ -0,0 +1,14 @@ +[Unit] +Description=udev Kernel Device Manager +Wants=udev-control.socket udev-kernel.socket +After=udev-control.socket udev-kernel.socket +Before=basic.target +DefaultDependencies=no +ConditionCapability=CAP_MKNOD + +[Service] +Type=notify +OOMScoreAdjust=-1000 +Sockets=udev-control.socket udev-kernel.socket +Restart=on-failure +ExecStart=@libexecdir@/udevd -- cgit v1.2.3-54-g00ecf From c096407caaf1f3c03bb816e195eebb886662b03a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 30 Nov 2011 15:21:01 +0100 Subject: systemd: use PassCred=yes --- NEWS | 5 +++++ systemd/udev-control.socket | 2 ++ systemd/udev-kernel.socket | 1 + 3 files changed, 8 insertions(+) diff --git a/NEWS b/NEWS index d0590e07ac..344f21df72 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +udev 176 +======== +The systemd socket files use PassCred=yes, which requires systemd +version 38. + udev 175 ======== Bugfixes. diff --git a/systemd/udev-control.socket b/systemd/udev-control.socket index 858ddffd38..af7ef9a1d7 100644 --- a/systemd/udev-control.socket +++ b/systemd/udev-control.socket @@ -6,3 +6,5 @@ ConditionCapability=CAP_MKNOD [Socket] Service=udev.service ListenSequentialPacket=/run/udev/control +SocketMode=0600 +PassCred=yes diff --git a/systemd/udev-kernel.socket b/systemd/udev-kernel.socket index 1c5545378e..4a8f599840 100644 --- a/systemd/udev-kernel.socket +++ b/systemd/udev-kernel.socket @@ -7,3 +7,4 @@ ConditionCapability=CAP_MKNOD Service=udev.service ReceiveBuffer=134217728 ListenNetlink=kobject-uevent 1 +PassCred=yes -- cgit v1.2.3-54-g00ecf From 12a362be5c1982f80dbfb75bda070208a2c99cdf Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 1 Dec 2011 12:17:22 +0100 Subject: use libexecdir, bindir, sbindir, switch to /usr/lib/udev in documentation --- INSTALL | 37 +++++++---- Makefile.am | 8 ++- NEWS | 4 ++ README | 12 ++-- TODO | 4 ++ autogen.sh | 7 +- configure.ac | 7 +- extras/keymap/.gitignore | 2 +- extras/keymap/95-keyboard-force-release.rules | 4 +- extras/keymap/95-keymap.rules | 2 +- extras/keymap/README.keymap.txt | 12 ++-- extras/keymap/keyboard-force-release.sh | 22 ------- extras/keymap/keyboard-force-release.sh.in | 22 +++++++ extras/mtd_probe/.gitignore | 1 + extras/mtd_probe/75-probe_mtd.rules | 8 --- extras/mtd_probe/75-probe_mtd.rules.in | 8 +++ extras/rule_generator/rule_generator.functions | 5 +- extras/scsi_id/.gitignore | 1 + extras/scsi_id/scsi_id.8 | 4 +- rules/.gitignore | 2 + rules/rules.d/60-persistent-storage.rules | 91 -------------------------- rules/rules.d/60-persistent-storage.rules.in | 91 ++++++++++++++++++++++++++ rules/rules.d/80-drivers.rules | 12 ---- rules/rules.d/80-drivers.rules.in | 12 ++++ systemd/udev-settle.service.in | 2 +- systemd/udev-trigger.service.in | 2 +- test/udev-test.pl | 2 +- udev/udev-event.c | 2 +- udev/udev-rules.c | 6 +- udev/udev.xml | 14 ++-- udev/udevd.xml | 2 +- 31 files changed, 219 insertions(+), 189 deletions(-) delete mode 100644 extras/keymap/keyboard-force-release.sh create mode 100644 extras/keymap/keyboard-force-release.sh.in delete mode 100644 extras/mtd_probe/75-probe_mtd.rules create mode 100644 extras/mtd_probe/75-probe_mtd.rules.in create mode 100644 rules/.gitignore delete mode 100644 rules/rules.d/60-persistent-storage.rules create mode 100644 rules/rules.d/60-persistent-storage.rules.in delete mode 100644 rules/rules.d/80-drivers.rules create mode 100644 rules/rules.d/80-drivers.rules.in diff --git a/INSTALL b/INSTALL index 943a8a467a..8ad69a43ad 100644 --- a/INSTALL +++ b/INSTALL @@ -1,30 +1,43 @@ -Usual options for udev installed in the root filesystem are: - ./configure \ +The options used used usually look like: + %configure \ --prefix=/usr \ --sysconfdir=/etc \ - --sbindir=/sbin \ + --bindir=/usr/bin \ + --sbindir=/usr/sbin \ --libdir=/usr/lib64 \ - --with-rootlibdir=/lib64 \ - --libexecdir=/lib/udev \ + --libexecdir=/usr/lib/udev \ + --with-systemdsystemunitdir=/usr/lib/systemd/system \ --with-selinux -The options used in a RPM spec file usually look like: +The options used in a RPM spec file look like: %configure \ --prefix=%{_prefix} \ --sysconfdir=%{_sysconfdir} \ - --sbindir=/sbin \ + --bindir=%{_bindir} \ + --sbindir=%{_sbindir} \ --libdir=%{_libdir} \ - --with-rootlibdir=/%{_lib} \ - --libexecdir=/lib/udev \ + --libexecdir=%{_prefix}/lib/udev \ + --with-systemdsystemunitdir=%{_prefix}/lib/systemd/system \ --with-selinux +The options to install udev in the rootfs instead of /usr, +and udevadm in /sbin: + --bindir=/sbin + --sbindir=/sbin + --libexecdir=/lib/udev + --with-systemdsystemunitdir=/lib/systemd/system + --with-rootlibdir=/lib64 + +Some tools expect udevadm in 'sbin'. A symlink to udevadm in 'bin' +needs to be manually created if needed. + The defined location for scripts and binaries which are called -from rules is /lib/udev/ on all systems and architectures. Any +from rules is /usr/lib/udev/ on all systems and architectures. Any other location will break other packages, who rightfully expect -the /lib/udev/ directory, to install their rule helper and udev +the /usr/lib/udev/ directory, to install their rule helper and udev rule files. -It is possible to use the /lib/udev/devices/ directory to place +It is possible to use the /usr/lib/udev/devices/ directory to place device nodes, directories and symlinks, which are copied to /dev/ at every bootup. That way, nodes for devices which can not be detected automatically, or are activated on-demand by opening the diff --git a/Makefile.am b/Makefile.am index 6a900b0a2b..acad5eca18 100644 --- a/Makefile.am +++ b/Makefile.am @@ -114,14 +114,16 @@ EXTRA_DIST += \ udevrulesdir = $(libexecdir)/rules.d dist_udevrules_DATA = \ rules/rules.d/50-udev-default.rules \ - rules/rules.d/60-persistent-storage.rules \ rules/rules.d/60-persistent-storage-tape.rules \ rules/rules.d/60-persistent-serial.rules \ rules/rules.d/60-persistent-input.rules \ rules/rules.d/60-persistent-alsa.rules \ - rules/rules.d/80-drivers.rules \ rules/rules.d/95-udev-late.rules +udevrules_DATA = \ + rules/rules.d/60-persistent-storage.rules \ + rules/rules.d/80-drivers.rules + udevconfdir = $(sysconfdir)/udev dist_udevconf_DATA = udev.conf @@ -151,7 +153,7 @@ systemd-install-hook: INSTALL_DATA_HOOKS += systemd-install-hook endif -sbin_PROGRAMS = \ +bin_PROGRAMS = \ udev/udevadm libexec_PROGRAMS = \ diff --git a/NEWS b/NEWS index 344f21df72..99d94e29ea 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ udev 176 ======== +The udevadm tool moved from 'sbin' to 'bin'. Some tools expect +udevadm in 'sbin'. A symlink to udevadm in 'bin' needs to be +manually created if needed. + The systemd socket files use PassCred=yes, which requires systemd version 38. diff --git a/README b/README index 5a8d4cc0b3..0d25b84fad 100644 --- a/README +++ b/README @@ -10,10 +10,10 @@ The upstream udev project's set of default rules may require a most recent kernel release to work properly. This is currently version 2.6.32. Tools and rules shipped by udev are not public API and may change at any time. -Never call any private tool in /lib/udev from any external application; it might -just go away in the next release. Access to udev information is only offered -by udevadm and libudev. Tools and rules in /lib/udev and the entire contents of -the /run/udev directory are private to udev and do change whenever needed. +Never call any private tool in /usr/lib/udev from any external application; it +might just go away in the next release. Access to udev information is only offered +by udevadm and libudev. Tools and rules in /usr/lib/udev and the entire contents +of the /run/udev directory are private to udev and do change whenever needed. Requirements: - Version 2.6.34 of the Linux kernel with sysfs, procfs, signalfd, inotify, @@ -72,8 +72,8 @@ Setup: - The udev daemon should be started to handle device events sent by the kernel. During bootup, the events for already existing devices can be replayed, so that they are configured by udev. This is usually done by: - /sbin/udevadm trigger --action=add --type=subsystems - /sbin/udevadm trigger --action=add --type=devices + udevadm trigger --action=add --type=subsystems + udevadm trigger --action=add --type=devices - Restarting the daemon never applies any rules to existing devices. diff --git a/TODO b/TODO index 1fd8eb2618..661709aad8 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,7 @@ + - move cc opts from autogen to configure.ac + + - move /lib/udev/devices/ to tmpfiles + - trigger --subsystem-match=usb/usb_device - test (now fixed) /dev/tape/ links diff --git a/autogen.sh b/autogen.sh index b6ffee7297..ba95669426 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,10 +24,11 @@ libdir() { args="--prefix=/usr \ --sysconfdir=/etc \ ---sbindir=/sbin \ +--bindir=/usr/bin \ +--sbindir=/usr/sbin \ --libdir=$(libdir /usr/lib) \ ---with-rootlibdir=$(libdir /lib) \ ---libexecdir=/lib/udev \ +--libexecdir=/usr/lib/udev \ +--with-systemdsystemunitdir=/usr/lib/systemd/system --with-selinux \ --enable-gtk-doc" diff --git a/configure.ac b/configure.ac index 2d90b5448f..df8d76d28c 100644 --- a/configure.ac +++ b/configure.ac @@ -200,6 +200,9 @@ AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = "xyes"]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile + extras/mtd_probe/75-probe_mtd.rules + rules/rules.d/80-drivers.rules + rules/rules.d/60-persistent-storage.rules udev/udev.pc systemd/udev.service systemd/udev-trigger.service @@ -210,6 +213,7 @@ AC_CONFIG_FILES([ extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml + extras/keymap/keyboard-force-release.sh ]) AC_OUTPUT @@ -219,7 +223,8 @@ AC_MSG_RESULT([ prefix: ${prefix} sysconfdir: ${sysconfdir} - sbindir: ${sbindir} + bindir: ${bindir} + sbindir: ${bindir} libdir: ${libdir} rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} diff --git a/extras/keymap/.gitignore b/extras/keymap/.gitignore index f2c4c8dca6..01d62e2b6e 100644 --- a/extras/keymap/.gitignore +++ b/extras/keymap/.gitignore @@ -1,6 +1,6 @@ +keyboard-force-release.sh keymap keys-from-name.gperf keys-from-name.h keys-to-name.h keys.txt - diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules index 63cf67fb59..79a1bc1cc4 100644 --- a/extras/keymap/95-keyboard-force-release.rules +++ b/extras/keymap/95-keyboard-force-release.rules @@ -5,10 +5,10 @@ # The atkbd driver has a quirk handler for generating synthetic # release events, which can be configured via sysfs since 2.6.32. # Simply add a file with a list of scancodes for your laptop model -# in /lib/udev/keymaps, and add a rule here. +# in /usr/lib/udev/keymaps, and add a rule here. # If the hotkeys also need a keymap assignment you can copy the # scancodes from the keymap file, otherwise you can run -# /lib/udev/keymap -i /dev/input/eventX +# /usr/lib/udev/keymap -i /dev/input/eventX # on a Linux vt to find out. ACTION=="remove", GOTO="force_release_end" diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules index 248c58f09c..1ec18b7f55 100644 --- a/extras/keymap/95-keymap.rules +++ b/extras/keymap/95-keymap.rules @@ -2,7 +2,7 @@ # # Key map overrides can be specified by either giving scancode/keyname pairs # directly as keymap arguments (if there are just one or two to change), or as -# a file name (in /lib/udev/keymaps), which has to contain scancode/keyname +# a file name (in /usr/lib/udev/keymaps), which has to contain scancode/keyname # pairs. ACTION=="remove", GOTO="keyboard_end" diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt index 79d9971b1d..acdc00283a 100644 --- a/extras/keymap/README.keymap.txt +++ b/extras/keymap/README.keymap.txt @@ -44,7 +44,7 @@ for inclusion you need to do the following steps: 1. Find the keyboard device. - Run /lib/udev/findkeyboards. This should always give you an "AT + Run /usr/lib/udev/findkeyboards. This should always give you an "AT keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and Acers) have multimedia/function keys on a separate input device instead of the primary keyboard. The keyboard device should have a name like "input/event3". @@ -53,7 +53,7 @@ for inclusion you need to do the following steps: 2. Find broken scan codes: - sudo /lib/udev/keymap -i input/eventX + sudo /usr/lib/udev/keymap -i input/eventX Press all multimedia/function keys and check if the key name that gets printed out is plausible. If it is unknown or wrong, write down the scan code (looks @@ -67,14 +67,14 @@ for inclusion you need to do the following steps: 0x1E www # Fn+F2 web browser Repeat that for all other keys. Write the resulting list into a file. Look at - /lib/udev/keymaps/ for existing key map files and make sure that you use the + /usr/lib/udev/keymaps/ for existing key map files and make sure that you use the same structure. If the key only ever works once and then your keyboard (or the entire desktop) gets stuck for a long time, then it is likely that the BIOS fails to send a corresponding "key release" event after the key press event. Please note down this case as well, as it can be worked around in - /lib/udev/keymaps/95-keyboard-force-release.rules . + /usr/lib/udev/keymaps/95-keyboard-force-release.rules . 3. Find out your system vendor and product: @@ -87,8 +87,8 @@ for inclusion you need to do the following steps: and /tmp/udev-db.txt from step 4 to the linux-hotplug@vger.kernel.org mailing list, so that they can be included in the next release. -For local testing, copy your map file to /lib/udev/keymaps/ with an appropriate -name, and add an appropriate udev rule to /lib/udev/rules.d/95-keymap.rules: +For local testing, copy your map file to /usr/lib/udev/keymaps/ with an appropriate +name, and add an appropriate udev rule to /usr/lib/udev/rules.d/95-keymap.rules: * If you selected an "AT keyboard", add the rule to the section after 'LABEL="keyboard_vendorcheck"'. diff --git a/extras/keymap/keyboard-force-release.sh b/extras/keymap/keyboard-force-release.sh deleted file mode 100644 index b157ac310d..0000000000 --- a/extras/keymap/keyboard-force-release.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -e -# read list of scancodes, convert hex to decimal and -# append to the atkbd force_release sysfs attribute -# $1 sysfs devpath for serioX -# $2 file with scancode list (hex or dec) - -case "$2" in - /*) scf="$2" ;; - *) scf="/lib/udev/keymaps/force-release/$2" ;; -esac - -read attr <"/sys/$1/force_release" -while read scancode dummy; do - case "$scancode" in - \#*) ;; - *) - scancode=$(($scancode)) - attr="$attr${attr:+,}$scancode" - ;; - esac -done <"$scf" -echo "$attr" >"/sys/$1/force_release" diff --git a/extras/keymap/keyboard-force-release.sh.in b/extras/keymap/keyboard-force-release.sh.in new file mode 100644 index 0000000000..05dd5da2e0 --- /dev/null +++ b/extras/keymap/keyboard-force-release.sh.in @@ -0,0 +1,22 @@ +#!/bin/sh -e +# read list of scancodes, convert hex to decimal and +# append to the atkbd force_release sysfs attribute +# $1 sysfs devpath for serioX +# $2 file with scancode list (hex or dec) + +case "$2" in + /*) scf="$2" ;; + *) scf="@libexecdir@/keymaps/force-release/$2" ;; +esac + +read attr <"/sys/$1/force_release" +while read scancode dummy; do + case "$scancode" in + \#*) ;; + *) + scancode=$(($scancode)) + attr="$attr${attr:+,}$scancode" + ;; + esac +done <"$scf" +echo "$attr" >"/sys/$1/force_release" diff --git a/extras/mtd_probe/.gitignore b/extras/mtd_probe/.gitignore index 82b8ab501f..70d3e8310e 100644 --- a/extras/mtd_probe/.gitignore +++ b/extras/mtd_probe/.gitignore @@ -1 +1,2 @@ mtd_probe +75-probe_mtd.rules diff --git a/extras/mtd_probe/75-probe_mtd.rules b/extras/mtd_probe/75-probe_mtd.rules deleted file mode 100644 index 184fda58a9..0000000000 --- a/extras/mtd_probe/75-probe_mtd.rules +++ /dev/null @@ -1,8 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="mtd_probe_end" - -KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" -KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN+="/sbin/modprobe -bv sm_ftl" - -LABEL="mtd_probe_end" diff --git a/extras/mtd_probe/75-probe_mtd.rules.in b/extras/mtd_probe/75-probe_mtd.rules.in new file mode 100644 index 0000000000..2e28d37fa3 --- /dev/null +++ b/extras/mtd_probe/75-probe_mtd.rules.in @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="mtd_probe_end" + +KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" +KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN+="@sbindir@/modprobe -bv sm_ftl" + +LABEL="mtd_probe_end" diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions index 4bec27a1b7..0f1b73850e 100644 --- a/extras/rule_generator/rule_generator.functions +++ b/extras/rule_generator/rule_generator.functions @@ -15,10 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -PATH='/sbin:/bin' -# - -PATH='/sbin:/bin' +PATH='/usr/bin:/bin:/usr/sbin:/sbin' # Read a single line from file $1 in the $DEVPATH directory. # The function must not return an error even if the file does not exist. diff --git a/extras/scsi_id/.gitignore b/extras/scsi_id/.gitignore index 8372f68193..10e9ae743c 100644 --- a/extras/scsi_id/.gitignore +++ b/extras/scsi_id/.gitignore @@ -1,2 +1,3 @@ scsi_id +scsi_id.8 scsi_id_version.h diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 index 0221b98831..8f83f39020 100644 --- a/extras/scsi_id/scsi_id.8 +++ b/extras/scsi_id/scsi_id.8 @@ -33,7 +33,7 @@ by page 0x80. For example: .sp .nf -# /lib/udev/scsi_id \-\-page=0x80 \-\-whitelisted \-\-device=/dev/sda +# /usr/lib/udev/scsi_id \-\-page=0x80 \-\-whitelisted \-\-device=/dev/sda SIBM 3542 1T05078453 .fi .P @@ -45,7 +45,7 @@ identifier starts with the NAA value of 6): .sp .nf -# /lib/udev/scsi_id \-\-page=0x83 \-\-whitelisted \-\-device=/dev/sda +# /usr/lib/udev/scsi_id \-\-page=0x83 \-\-whitelisted \-\-device=/dev/sda 3600a0b80000b174b000000d63efc5c8c .fi .P diff --git a/rules/.gitignore b/rules/.gitignore new file mode 100644 index 0000000000..7240bd79d6 --- /dev/null +++ b/rules/.gitignore @@ -0,0 +1,2 @@ +rules.d/60-persistent-storage.rules +rules.d/80-drivers.rules diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules deleted file mode 100644 index 894b50ba8e..0000000000 --- a/rules/rules.d/60-persistent-storage.rules +++ /dev/null @@ -1,91 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -# forward scsi device event to corresponding block device -ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" - -ACTION=="remove", GOTO="persistent_storage_end" - -# enable in-kernel media-presence polling -ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000" - -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# skip rules for inappropriate block devices -KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end" - -# ignore partitions that span the entire disk -TEST=="whole_disk", GOTO="persistent_storage_end" - -# for partitions import parent information -ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" - -# virtio-blk -KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" -KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" - -# ATA devices with their own "ata" kernel subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" -# ATA devices using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" -# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $tempnode" - -# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $tempnode" -# Otherwise fall back to using usb_id for USB devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" - -# scsi devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" -KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" -KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# firewire -KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" -KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" - -# scsi compat links for ATA devices -KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d$tempnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" -KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" - -KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" - -# by-path (parent device path) -ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" -ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# skip unpartitioned removable media devices from drivers which do not send "change" events -ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" - -# probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="/sbin/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" -# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="/sbin/blkid -o udev -p -u noraid $tempnode" - -# probe filesystem metadata of disks -KERNEL!="sr*", IMPORT{program}="/sbin/blkid -o udev -p $tempnode" - -# watch metadata changes by tools closing the device after writing -KERNEL!="sr*", OPTIONS+="watch" - -# by-label/by-uuid links (filesystem metadata) -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -# by-id (World Wide Name) -ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" -ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" - -# by-partlabel/by-partuuid links (partition metadata) -ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}" -ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" - -LABEL="persistent_storage_end" diff --git a/rules/rules.d/60-persistent-storage.rules.in b/rules/rules.d/60-persistent-storage.rules.in new file mode 100644 index 0000000000..47185386cd --- /dev/null +++ b/rules/rules.d/60-persistent-storage.rules.in @@ -0,0 +1,91 @@ +# do not edit this file, it will be overwritten on update + +# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +# forward scsi device event to corresponding block device +ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" + +ACTION=="remove", GOTO="persistent_storage_end" + +# enable in-kernel media-presence polling +ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000" + +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# skip rules for inappropriate block devices +KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end" + +# ignore partitions that span the entire disk +TEST=="whole_disk", GOTO="persistent_storage_end" + +# for partitions import parent information +ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" + +# virtio-blk +KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" +KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" + +# ATA devices with their own "ata" kernel subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" +# ATA devices using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" +# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $tempnode" + +# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $tempnode" +# Otherwise fall back to using usb_id for USB devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" + +# scsi devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" +KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# firewire +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" +KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" + +# scsi compat links for ATA devices +KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d$tempnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" +KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" + +KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" +KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + +# by-path (parent device path) +ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" +ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# skip unpartitioned removable media devices from drivers which do not send "change" events +ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" + +# probe filesystem metadata of optical drives which have a media inserted +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="@sbindir@/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="@sbindir@/blkid -o udev -p -u noraid $tempnode" + +# probe filesystem metadata of disks +KERNEL!="sr*", IMPORT{program}="@sbindir@/blkid -o udev -p $tempnode" + +# watch metadata changes by tools closing the device after writing +KERNEL!="sr*", OPTIONS+="watch" + +# by-label/by-uuid links (filesystem metadata) +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +# by-id (World Wide Name) +ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" +ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" + +# by-partlabel/by-partuuid links (partition metadata) +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}" +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" + +LABEL="persistent_storage_end" diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules deleted file mode 100644 index cf89735d62..0000000000 --- a/rules/rules.d/80-drivers.rules +++ /dev/null @@ -1,12 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="drivers_end" - -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe -bv $env{MODALIAS}" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="/sbin/modprobe -bv tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="/sbin/modprobe -bv tifm_ms" -SUBSYSTEM=="memstick", RUN+="/sbin/modprobe -bv --all ms_block mspro_block" -SUBSYSTEM=="i2o", RUN+="/sbin/modprobe -bv i2o_block" -SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="/sbin/modprobe -bv ppdev" - -LABEL="drivers_end" diff --git a/rules/rules.d/80-drivers.rules.in b/rules/rules.d/80-drivers.rules.in new file mode 100644 index 0000000000..96161357eb --- /dev/null +++ b/rules/rules.d/80-drivers.rules.in @@ -0,0 +1,12 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="drivers_end" + +DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="@sbindir@/modprobe -bv $env{MODALIAS}" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="@sbindir@/modprobe -bv tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="@sbindir@/modprobe -bv tifm_ms" +SUBSYSTEM=="memstick", RUN+="@sbindir/modprobe -bv --all ms_block mspro_block" +SUBSYSTEM=="i2o", RUN+="@sbindir@/modprobe -bv i2o_block" +SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="@sbindir@/modprobe -bv ppdev" + +LABEL="drivers_end" diff --git a/systemd/udev-settle.service.in b/systemd/udev-settle.service.in index f5f5958934..b0a4964f76 100644 --- a/systemd/udev-settle.service.in +++ b/systemd/udev-settle.service.in @@ -19,7 +19,7 @@ Before=basic.target Type=oneshot TimeoutSec=180 RemainAfterExit=yes -ExecStart=@sbindir@/udevadm settle +ExecStart=@bindir@/udevadm settle [Install] WantedBy=basic.target diff --git a/systemd/udev-trigger.service.in b/systemd/udev-trigger.service.in index 6d416c2b39..cd81945c88 100644 --- a/systemd/udev-trigger.service.in +++ b/systemd/udev-trigger.service.in @@ -7,4 +7,4 @@ DefaultDependencies=no [Service] Type=oneshot RemainAfterExit=yes -ExecStart=@sbindir@/udevadm trigger --type=subsystems --action=add ; @sbindir@/udevadm trigger --type=devices --action=add +ExecStart=@bindir@/udevadm trigger --type=subsystems --action=add ; @bindir@/udevadm trigger --type=devices --action=add diff --git a/test/udev-test.pl b/test/udev-test.pl index f93859c78c..c2dc70ef48 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1158,7 +1158,7 @@ EOF devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "sane", rules => < Configuration - udev configuration files are placed in /etc/udev/ - and /lib/udev/. All empty lines or lines beginning with + udev configuration files are placed in /etc/udev + and /usr/lib/udev. All empty lines or lines beginning with '#' are ignored. Configuration file @@ -71,9 +71,9 @@ Rules files The udev rules are read from the files located in the - system rules directory /lib/udev/rules.d/, - the local administration directory /etc/udev/rules.d/ - and the volatile runtime directory /run/udev/rules.d/. + system rules directory /usr/lib/udev/rules.d, + the local administration directory /etc/udev/rules.d + and the volatile runtime directory /run/udev/rules.d. All rules files are collectively sorted and processed in lexical order, regardless of the directories in which they live. However, files with identical file names replace each other. Files in /run @@ -398,7 +398,7 @@ detached from the event process itself. If no absolute path is given, the program is expected to live in the directory provided at compile-time to configure via --libexecdir - (this is usually /lib/udev), otherwise the absolute + (this is usually /usr/lib/udev), otherwise the absolute path must be specified. The program name and following arguments are separated by spaces. Single quotes can be used to specify arguments with spaces. @@ -511,7 +511,7 @@ Apply the permissions specified in this rule to the static device node with the specified name. Static device nodes might be provided by kernel modules - or copied from /lib/udev/devices. These nodes might not have + or copied from /usr/lib/udev/devices. These nodes might not have a corresponding kernel device at the time udevd is started; they can trigger automatic kernel module loading. diff --git a/udev/udevd.xml b/udev/udevd.xml index d335e2ec88..c516eb9793 100644 --- a/udev/udevd.xml +++ b/udev/udevd.xml @@ -37,7 +37,7 @@ instructions specified in udev rules. See udev7 . - On startup the content of the directory /lib/udev/devices + On startup the content of the directory /usr/lib/udev/devices is copied to /dev. If kernel modules specify static device nodes, these nodes are created even without a corresponding kernel device, to allow on-demand loading of kernel modules. Matching permissions specified in udev -- cgit v1.2.3-54-g00ecf From 1f7d0a68eae73f78c08b884a4440df6dfe96f252 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Dec 2011 23:29:48 +0100 Subject: configure: fix typo kay: btw you've got sbindir: ${bindir} in configure check result printing I think that's a typo oh --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index df8d76d28c..de5a6d33ae 100644 --- a/configure.ac +++ b/configure.ac @@ -224,7 +224,7 @@ AC_MSG_RESULT([ prefix: ${prefix} sysconfdir: ${sysconfdir} bindir: ${bindir} - sbindir: ${bindir} + sbindir: ${sbindir} libdir: ${libdir} rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} -- cgit v1.2.3-54-g00ecf From 636c7a44d5143fdca298cb9087a529aa1d71c431 Mon Sep 17 00:00:00 2001 From: Ville Skyttä Date: Tue, 20 Dec 2011 23:50:01 +0100 Subject: man: spelling fix --- udev/udevadm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 2fdbb42b2b..09c22c44b1 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -363,7 +363,7 @@ seconds - The maximum number seonds to wait for a reply from udevd. + The maximum number seconds to wait for a reply from udevd. -- cgit v1.2.3-54-g00ecf From 28e490c945e16f9d2dce7cff9967ed5d11b23f93 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Dec 2011 15:27:27 +0100 Subject: make: do not (mis-)use the config file generator, create .xz tarball --- Makefile.am | 103 +++++++++++++++++++++++++++++--------- configure.ac | 14 ++---- rules/rules.d/80-drivers.rules.in | 2 +- 3 files changed, 83 insertions(+), 36 deletions(-) diff --git a/Makefile.am b/Makefile.am index acad5eca18..178685ea22 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,8 +5,6 @@ SUBDIRS = . -EXTRA_DIST = - ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} AM_MAKEFLAGS = --no-print-directory @@ -30,14 +28,40 @@ DISTCHECK_CONFIGURE_FLAGS = \ --enable-gtk-doc \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) -CLEANFILES = BUILT_SOURCES = +EXTRA_DIST = +CLEANFILES = INSTALL_EXEC_HOOKS = INSTALL_DATA_HOOKS = UNINSTALL_EXEC_HOOKS = DISTCHECK_HOOKS = +libexec_SCRIPTS = dist_libexec_SCRIPTS = +SED_PROCESS = \ +$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ + -e 's,@VERSION\@,$(VERSION),g' \ + -e 's,@prefix\@,$(prefix),g' \ + -e 's,@exec_prefix\@,$(exec_prefix),g' \ + -e 's,@libdir\@,$(libdir),g' \ + -e 's,@includedir\@,$(includedir),g' \ + -e 's,@bindir\@,$(bindir),g' \ + -e 's,@sbindir\@,$(sbindir),g' \ + -e 's,@libexecdir\@,$(libexecdir),g' \ + < $< > $@ || rm $@ + +%.pc: %.pc.in Makefile + $(SED_PROCESS) + +%.rules: %.rules.in Makefile + $(SED_PROCESS) + +%.service: %.service.in + $(SED_PROCESS) + +%.sh: %.sh.in + $(SED_PROCESS) + # ------------------------------------------------------------------------------ # libudev # ------------------------------------------------------------------------------ @@ -80,6 +104,8 @@ endif pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libudev/libudev.pc +EXTRA_DIST += libudev/libudev.pc.in +CLEANFILES += libudev/libudev.pc EXTRA_DIST += libudev/COPYING # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed @@ -124,23 +150,41 @@ udevrules_DATA = \ rules/rules.d/60-persistent-storage.rules \ rules/rules.d/80-drivers.rules +EXTRA_DIST += \ + rules/rules.d/80-drivers.rules.in \ + rules/rules.d/60-persistent-storage.rules.in + +CLEANFILES += \ + rules/rules.d/80-drivers.rules \ + rules/rules.d/60-persistent-storage.rules + udevconfdir = $(sysconfdir)/udev dist_udevconf_DATA = udev.conf sharepkgconfigdir = $(datadir)/pkgconfig sharepkgconfig_DATA = udev/udev.pc +EXTRA_DIST += udev/udev.pc.in +CLEANFILES += udev/udev.pc if WITH_SYSTEMD -systemdsystemunit_DATA = \ +dist_systemdsystemunit_DATA = \ systemd/udev-control.socket \ - systemd/udev-kernel.socket \ + systemd/udev-kernel.socket + +systemdsystemunit_DATA = \ systemd/udev.service \ systemd/udev-trigger.service \ systemd/udev-settle.service EXTRA_DIST += \ - systemd/udev-control.socket \ - systemd/udev-kernel.socket + systemd/udev.service.in \ + systemd/udev-trigger.service.in \ + systemd/udev-settle.service.in + +CLEANFILES += \ + systemd/udev.service \ + systemd/udev-trigger.service \ + systemd/udev-settle.service systemd-install-hook: mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants @@ -317,7 +361,10 @@ libgudev_include_HEADERS = \ extras/gudev/gudevenumerator.h lib_LTLIBRARIES += extras/gudev/libgudev-1.0.la + pkgconfig_DATA += extras/gudev/gudev-1.0.pc +EXTRA_DIST += extras/gudev/gudev-1.0.pc.in +CLEANFILES += extras/gudev/gudev-1.0.pc extras_gudev_libgudev_1_0_la_SOURCES = \ extras/gudev/gudevenums.h \ @@ -332,12 +379,12 @@ extras_gudev_libgudev_1_0_la_SOURCES = \ extras/gudev/gudevenumerator.c \ extras/gudev/gudevprivate.h -dist_extras_gudev_libgudev_1_0_la_SOURCES = \ +nodist_extras_gudev_libgudev_1_0_la_SOURCES = \ extras/gudev/gudevmarshal.h \ extras/gudev/gudevmarshal.c \ extras/gudev/gudevenumtypes.h \ extras/gudev/gudevenumtypes.c -BUILT_SOURCES += $(dist_extras_gudev_libgudev_1_0_la_SOURCES) +BUILT_SOURCES += $(nodist_extras_gudev_libgudev_1_0_la_SOURCES) extras_gudev_libgudev_1_0_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ @@ -471,16 +518,24 @@ nodist_extras_keymap_keymap_SOURCES = \ extras/keymap/keys-to-name.h BUILT_SOURCES += $(nodist_extras_keymap_keymap_SOURCES) -EXTRA_DIST += extras/keymap/check-keymaps.sh -dist_udevrules_DATA += extras/keymap/95-keymap.rules -dist_udevrules_DATA += extras/keymap/95-keyboard-force-release.rules libexec_PROGRAMS += extras/keymap/keymap -dist_libexec_SCRIPTS += extras/keymap/findkeyboards -dist_libexec_SCRIPTS += extras/keymap/keyboard-force-release.sh dist_doc_DATA = extras/keymap/README.keymap.txt + +dist_udevrules_DATA += \ + extras/keymap/95-keymap.rules \ + extras/keymap/95-keyboard-force-release.rules + +dist_libexec_SCRIPTS += extras/keymap/findkeyboards +libexec_SCRIPTS += extras/keymap/keyboard-force-release.sh + +EXTRA_DIST += \ + extras/keymap/check-keymaps.sh \ + extras/keymap/keyboard-force-release.sh.in + CLEANFILES += \ extras/keymap/keys.txt \ - extras/keymap/keys-from-name.gperf + extras/keymap/keys-from-name.gperf \ + extras/keymap/keyboard-force-release.sh udevkeymapdir = $(libexecdir)/keymaps dist_udevkeymap_DATA = \ @@ -575,8 +630,10 @@ extras_mtd_probe_mtd_probe_SOURCES = \ extras/mtd_probe/mtd_probe.h \ extras/mtd_probe/probe_smartmedia.c extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) -dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules +udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules libexec_PROGRAMS += extras/mtd_probe/mtd_probe +EXTRA_DIST += extras/mtd_probe/75-probe_mtd.rules.in +CLEANFILES += extras/mtd_probe/75-probe_mtd.rules endif if ENABLE_RULE_GENERATOR @@ -641,14 +698,13 @@ clean-local: distclean-local: rm -rf autom4te.cache +EXTRA_DIST += \ + $(TESTS) \ + test/rule-syntax-check.py + CLEANFILES += \ - udev-$(VERSION).tar.gz \ - udev-$(VERSION).tar.bz2 \ $(BUILT_SOURCES) -EXTRA_DIST += $(TESTS) -EXTRA_DIST += test/rule-syntax-check.py - install-exec-hook: $(INSTALL_EXEC_HOOKS) install-data-hook: $(INSTALL_DATA_HOOKS) @@ -687,15 +743,14 @@ git-release: tar: make distcheck - gpg --armor --detach-sign udev-$(VERSION).tar.gz - gpg --armor --detach-sign udev-$(VERSION).tar.bz2 + gpg --armor --detach-sign udev-$(VERSION).tar.xz git-sync: git push git push --tags $(VERSION) tar-sync: - scp udev-$(VERSION).tar.gz master.kernel.org:/pub/linux/utils/kernel/hotplug/ + scp udev-$(VERSION).tar.xz master.kernel.org:/pub/linux/utils/kernel/hotplug/ doc-sync: rsync -av udev/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ diff --git a/configure.ac b/configure.ac index de5a6d33ae..863aad86d4 100644 --- a/configure.ac +++ b/configure.ac @@ -6,13 +6,15 @@ AC_INIT([udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) AC_CONFIG_SRCDIR([udev/udevd.c]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax dist-bzip2 subdir-objects]) +AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax dist-xz subdir-objects]) AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) AM_SILENT_RULES([yes]) LT_INIT([disable-static]) AC_PROG_AWK +AC_PROG_SED +AC_PROG_MKDIR_P GTK_DOC_CHECK(1.10) AC_PREFIX_DEFAULT([/usr]) AC_PATH_PROG([XSLTPROC], [xsltproc]) @@ -200,20 +202,10 @@ AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = "xyes"]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile - extras/mtd_probe/75-probe_mtd.rules - rules/rules.d/80-drivers.rules - rules/rules.d/60-persistent-storage.rules - udev/udev.pc - systemd/udev.service - systemd/udev-trigger.service - systemd/udev-settle.service - libudev/libudev.pc libudev/docs/Makefile libudev/docs/version.xml - extras/gudev/gudev-1.0.pc extras/gudev/docs/Makefile extras/gudev/docs/version.xml - extras/keymap/keyboard-force-release.sh ]) AC_OUTPUT diff --git a/rules/rules.d/80-drivers.rules.in b/rules/rules.d/80-drivers.rules.in index 96161357eb..04e30f5b04 100644 --- a/rules/rules.d/80-drivers.rules.in +++ b/rules/rules.d/80-drivers.rules.in @@ -5,7 +5,7 @@ ACTION=="remove", GOTO="drivers_end" DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="@sbindir@/modprobe -bv $env{MODALIAS}" SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="@sbindir@/modprobe -bv tifm_sd" SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="@sbindir@/modprobe -bv tifm_ms" -SUBSYSTEM=="memstick", RUN+="@sbindir/modprobe -bv --all ms_block mspro_block" +SUBSYSTEM=="memstick", RUN+="@sbindir@/modprobe -bv --all ms_block mspro_block" SUBSYSTEM=="i2o", RUN+="@sbindir@/modprobe -bv i2o_block" SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="@sbindir@/modprobe -bv ppdev" -- cgit v1.2.3-54-g00ecf From f18f225cf1eac9b61849f10f387bc3628332d738 Mon Sep 17 00:00:00 2001 From: Luis Felipe Strano Moraes Date: Wed, 21 Dec 2011 11:47:51 -0800 Subject: Switch spawn_read to void and remove useless stores there. The return value was never used and even if errors were found inside spawn_wait should still be called. --- udev/udev-event.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/udev/udev-event.c b/udev/udev-event.c index 1ea39967fc..c978e847b7 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -493,7 +493,7 @@ static int spawn_exec(struct udev_event *event, return err; } -static int spawn_read(struct udev_event *event, +static void spawn_read(struct udev_event *event, const char *cmd, int fd_stdout, int fd_stderr, char *result, size_t ressize) @@ -502,15 +502,13 @@ static int spawn_read(struct udev_event *event, size_t respos = 0; int fd_ep = -1; struct epoll_event ep_outpipe, ep_errpipe; - int err = 0; /* read from child if requested */ if (fd_stdout < 0 && fd_stderr < 0) - return 0; + return; fd_ep = epoll_create1(EPOLL_CLOEXEC); if (fd_ep < 0) { - err = -errno; err(udev, "error creating epoll fd: %m\n"); goto out; } @@ -547,7 +545,6 @@ static int spawn_read(struct udev_event *event, age_usec = now_usec() - event->birth_usec; if (age_usec >= event->timeout_usec) { - err = -ETIMEDOUT; err(udev, "timeout '%s'\n", cmd); goto out; } @@ -560,12 +557,10 @@ static int spawn_read(struct udev_event *event, if (fdcount < 0) { if (errno == EINTR) continue; - err = -errno; err(udev, "failed to poll: %m\n"); goto out; } if (fdcount == 0) { - err = -ETIMEDOUT; err(udev, "timeout '%s'\n", cmd); goto out; } @@ -589,7 +584,6 @@ static int spawn_read(struct udev_event *event, respos += count; } else { err(udev, "'%s' ressize %zd too short\n", cmd, ressize); - err = -ENOBUFS; } } @@ -606,7 +600,6 @@ static int spawn_read(struct udev_event *event, } } else if (ev[i].events & EPOLLHUP) { if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) { - err = -errno; err(udev, "failed to remove fd from epoll: %m\n"); goto out; } @@ -623,7 +616,6 @@ static int spawn_read(struct udev_event *event, out: if (fd_ep >= 0) close(fd_ep); - return err; } static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) @@ -805,9 +797,9 @@ int udev_event_spawn(struct udev_event *event, errpipe[WRITE_END] = -1; } - err = spawn_read(event, cmd, - outpipe[READ_END], errpipe[READ_END], - result, ressize); + spawn_read(event, cmd, + outpipe[READ_END], errpipe[READ_END], + result, ressize); err = spawn_wait(event, cmd, pid); } -- cgit v1.2.3-54-g00ecf From 81dadce58f80edae4dc45ba55a2c41cb0f26570b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Dec 2011 22:30:48 +0100 Subject: prepare builtins for blkid and kmod --- Makefile.am | 19 ++++- configure.ac | 2 + udev/udev-builtin-blkid.c | 171 +++++++++++++++++++++++++++++++++++++++++++ udev/udev-builtin-input_id.c | 2 +- udev/udev-builtin-kmod.c | 42 +++++++++++ udev/udev-builtin-path_id.c | 3 +- udev/udev-builtin-usb_id.c | 3 +- udev/udev-builtin.c | 19 ++++- udev/udev-rules.c | 48 ++++++------ udev/udev.h | 13 +++- udev/udevadm-test-builtin.c | 2 +- 11 files changed, 285 insertions(+), 39 deletions(-) create mode 100644 udev/udev-builtin-blkid.c create mode 100644 udev/udev-builtin-kmod.c diff --git a/Makefile.am b/Makefile.am index 178685ea22..3ac85b95cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -203,7 +203,7 @@ bin_PROGRAMS = \ libexec_PROGRAMS = \ udev/udevd -udev_common_sources =\ +udev_common_sources = \ udev/udev.h \ udev/udev-event.c \ udev/udev-watch.c \ @@ -213,14 +213,24 @@ udev_common_sources =\ udev/udev-builtin.c \ udev/udev-builtin-path_id.c \ udev/udev-builtin-usb_id.c \ - udev/udev-builtin-input_id.c + udev/udev-builtin-input_id.c \ + udev/udev-builtin-blkid.c \ + udev/udev-builtin-kmod.c + +udev_common_CFLAGS = \ + $(BLKID_CFLAGS) + +udev_common_LDADD = \ + libudev/libudev-private.la \ + $(BLKID_LIBS) udev_udevd_SOURCES = \ $(udev_common_sources) \ udev/udevd.c \ udev/sd-daemon.h \ udev/sd-daemon.c -udev_udevd_LDADD = libudev/libudev-private.la +udev_udevd_CFLAGS = $(udev_common_CFLAGS) +udev_udevd_LDADD = $(udev_common_LDADD) udev_udevadm_SOURCES = \ $(udev_common_sources) \ @@ -232,7 +242,8 @@ udev_udevadm_SOURCES = \ udev/udevadm-trigger.c \ udev/udevadm-test.c \ udev/udevadm-test-builtin.c -udev_udevadm_LDADD = libudev/libudev-private.la +udev_udevadm_CFLAGS = $(udev_common_CFLAGS) +udev_udevadm_LDADD = $(udev_common_LDADD) # ------------------------------------------------------------------------------ # udev man pages diff --git a/configure.ac b/configure.ac index 863aad86d4..86389fc410 100644 --- a/configure.ac +++ b/configure.ac @@ -73,6 +73,8 @@ AC_ARG_WITH([systemdsystemunitdir], AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) ]) AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ]) +PKG_CHECK_MODULES(BLKID, blkid >= 2.20) + # ------------------------------------------------------------------------------ # GUdev - libudev gobject interface # ------------------------------------------------------------------------------ diff --git a/udev/udev-builtin-blkid.c b/udev/udev-builtin-blkid.c new file mode 100644 index 0000000000..a787bf2f6c --- /dev/null +++ b/udev/udev-builtin-blkid.c @@ -0,0 +1,171 @@ +/* + * probe disks for filesystems and partitions + * + * Copyright (C) 2011 Kay Sievers + * Copyright (C) 2011 Karel Zak + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static void print_property(const char *name, const char *value) +{ + char enc[265], safe[256]; + size_t namelen = strlen(name); + + enc[0] = '\0'; + safe[0] = '\0'; + + if (!strcmp(name, "TYPE") || !strcmp(name, "VERSION")) { + blkid_encode_string(value, enc, sizeof(enc)); + printf("ID_FS_%s=%s\n", name, enc); + + } else if (!strcmp(name, "UUID") || + !strcmp(name, "LABEL") || + !strcmp(name, "UUID_SUB")) { + + blkid_safe_string(value, safe, sizeof(safe)); + printf("ID_FS_%s=%s\n", name, safe); + + blkid_encode_string(value, enc, sizeof(enc)); + printf("ID_FS_%s_ENC=%s\n", name, enc); + + } else if (!strcmp(name, "PTTYPE")) { + printf("ID_PART_TABLE_TYPE=%s\n", value); + + } else if (!strcmp(name, "PART_ENTRY_NAME") || + !strcmp(name, "PART_ENTRY_TYPE")) { + + blkid_encode_string(value, enc, sizeof(enc)); + printf("ID_%s=%s\n", name, enc); + + } else if (!strncmp(name, "PART_ENTRY_", 11)) + printf("ID_%s=%s\n", name, value); + + else if (namelen >= 15 && ( + !strcmp(name + (namelen - 12), "_SECTOR_SIZE") || + !strcmp(name + (namelen - 8), "_IO_SIZE") || + !strcmp(name, "ALIGNMENT_OFFSET"))) + printf("ID_IOLIMIT_%s=%s\n", name, value); + else + printf("ID_FS_%s=%s\n", name, value); +} + +static int probe_superblocks(blkid_probe pr) +{ + struct stat st; + int rc; + + if (fstat(blkid_probe_get_fd(pr), &st)) + return -1; + + blkid_probe_enable_partitions(pr, 1); + + if (!S_ISCHR(st.st_mode) && blkid_probe_get_size(pr) <= 1024 * 1440 && + blkid_probe_is_wholedisk(pr)) { + /* + * check if the small disk is partitioned, if yes then + * don't probe for filesystems. + */ + blkid_probe_enable_superblocks(pr, 0); + + rc = blkid_do_fullprobe(pr); + if (rc < 0) + return rc; /* -1 = error, 1 = nothing, 0 = succes */ + + if (blkid_probe_lookup_value(pr, "PTTYPE", NULL, NULL) == 0) + return 0; /* partition table detected */ + } + + blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); + blkid_probe_enable_superblocks(pr, 1); + + return blkid_do_safeprobe(pr); +} + +static int builtin_blkid(struct udev_device *dev, const char *command, bool test) +{ + char *device = "/dev/sda3"; + int64_t offset = 0; + //int noraid = 0; + int fd = -1; + blkid_probe pr; + const char *data; + const char *name; + int nvals; + int i; + size_t len; + int err = 0; + + //FIXME: read offset, read noraid + + pr = blkid_new_probe(); + if (!pr) { + err = -ENOMEM; + return EXIT_FAILURE; + } + + blkid_probe_set_superblocks_flags(pr, + BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | + BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE | + BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION); + + fd = open(device, O_RDONLY|O_CLOEXEC); + if (fd < 0) { + fprintf(stderr, "error: %s: %m\n", device); + goto out; + } + + err = blkid_probe_set_device(pr, fd, offset, 0); + if (err < 0) + goto out; + + err = probe_superblocks(pr); + if (err < 0) + goto out; + + nvals = blkid_probe_numof_values(pr); + for (i = 0; i < nvals; i++) { + if (blkid_probe_get_value(pr, i, &name, &data, &len)) + continue; + len = strnlen((char *) data, len); + print_property(name, (char *) data); + } + + blkid_free_probe(pr); +out: + if (fd > 0) + close(fd); + if (err < 0) + return EXIT_FAILURE; + return EXIT_SUCCESS; +} + +const struct udev_builtin udev_builtin_blkid = { + .name = "blkid", + .cmd = builtin_blkid, + .help = "filesystem and partition probing", + .run_once = false, +}; diff --git a/udev/udev-builtin-input_id.c b/udev/udev-builtin-input_id.c index 84ca0f75e4..420a872662 100644 --- a/udev/udev-builtin-input_id.c +++ b/udev/udev-builtin-input_id.c @@ -181,7 +181,7 @@ static void test_key (struct udev_device *dev, udev_builtin_add_property(dev, test, "ID_INPUT_KEYBOARD", "1"); } -static int builtin_input_id(struct udev_device *dev, bool test) +static int builtin_input_id(struct udev_device *dev, const char *command, bool test) { struct udev_device *pdev; unsigned long bitmask_ev[NBITS(EV_MAX)]; diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c new file mode 100644 index 0000000000..df057735d7 --- /dev/null +++ b/udev/udev-builtin-kmod.c @@ -0,0 +1,42 @@ +/* + * probe disks for filesystems and partitions + * + * Copyright (C) 2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int builtin_kmod(struct udev_device *dev, const char *command, bool test) +{ + printf("soon we load a module here: '%s'\n", command); + return EXIT_SUCCESS; +} + +const struct udev_builtin udev_builtin_kmod = { + .name = "kmod", + .cmd = builtin_kmod, + .help = "kernel module loader", + .run_once = false, +}; diff --git a/udev/udev-builtin-path_id.c b/udev/udev-builtin-path_id.c index 61c50d77bd..97a9ace5c1 100644 --- a/udev/udev-builtin-path_id.c +++ b/udev/udev-builtin-path_id.c @@ -390,7 +390,7 @@ out: return parent; } -static int builtin_path_id(struct udev_device *dev, bool test) +static int builtin_path_id(struct udev_device *dev, const char *command, bool test) { struct udev_device *parent; char *path = NULL; @@ -483,4 +483,5 @@ const struct udev_builtin udev_builtin_path_id = { .name = "path_id", .cmd = builtin_path_id, .help = "compose persistent device path", + .run_once = true, }; diff --git a/udev/udev-builtin-usb_id.c b/udev/udev-builtin-usb_id.c index 587c21667b..9a519179c8 100644 --- a/udev/udev-builtin-usb_id.c +++ b/udev/udev-builtin-usb_id.c @@ -239,7 +239,7 @@ out: * 6.) If the device supplies a serial number, this number * is concatenated with the identification with an underscore '_'. */ -static int builtin_usb_id(struct udev_device *dev, bool test) +static int builtin_usb_id(struct udev_device *dev, const char *command, bool test) { char vendor_str[64]; char vendor_str_enc[256]; @@ -478,4 +478,5 @@ const struct udev_builtin udev_builtin_usb_id = { .name = "usb_id", .cmd = builtin_usb_id, .help = "usb device properties", + .run_once = true, }; diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c index eeec6e990d..36821702c1 100644 --- a/udev/udev-builtin.c +++ b/udev/udev-builtin.c @@ -29,6 +29,8 @@ static const struct udev_builtin *builtins[] = { [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, + [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, + [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, }; int udev_builtin_list(struct udev *udev) @@ -45,19 +47,30 @@ const char *udev_builtin_name(enum udev_builtin_cmd cmd) return builtins[cmd]->name; } -enum udev_builtin_cmd udev_builtin_lookup(const char *name) +bool udev_builtin_run_once(enum udev_builtin_cmd cmd) { + return builtins[cmd]->run_once; +} + +enum udev_builtin_cmd udev_builtin_lookup(const char *command) +{ + char name[UTIL_PATH_SIZE]; enum udev_builtin_cmd i; + char *pos; + util_strscpy(name, sizeof(name), command); + pos = strchr(name, ' '); + if (pos) + pos[0] = '\0'; for (i = 0; i < ARRAY_SIZE(builtins); i++) if (strcmp(builtins[i]->name, name) == 0) return i; return UDEV_BUILTIN_MAX; } -int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, bool test) +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) { - return builtins[cmd]->cmd(dev, test); + return builtins[cmd]->cmd(dev, command, test); } int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index f3e248eb4f..0de44054b7 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -364,7 +364,7 @@ static void dump_token(struct udev_rules *rules, struct token *token) token_str(type), operation_str(op), value, string_glob_str(glob)); break; case TK_M_IMPORT_BUILTIN: - dbg(rules->udev, "%s %i\n", token_str(type), token->key.builtin_cmd); + dbg(rules->udev, "%s %i '%s'\n", token_str(type), token->key.builtin_cmd, value); break; case TK_M_ATTR: case TK_M_ATTRS: @@ -1039,6 +1039,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, token->key.value_off = add_string(rule_tmp->rules, value); break; case TK_M_IMPORT_BUILTIN: + token->key.value_off = add_string(rule_tmp->rules, value); token->key.builtin_cmd = *(enum udev_builtin_cmd *)data; break; case TK_M_ENV: @@ -1396,18 +1397,13 @@ static int add_rule(struct udev_rules *rules, char *line, if (strstr(attr, "program")) { /* find known built-in command */ if (value[0] != '/') { - char file[UTIL_PATH_SIZE]; - char *pos; enum udev_builtin_cmd cmd; - util_strscpy(file, sizeof(file), value); - pos = strchr(file, ' '); - if (pos) - pos[0] = '\0'; - cmd = udev_builtin_lookup(file); + cmd = udev_builtin_lookup(value); if (cmd < UDEV_BUILTIN_MAX) { - info(rules->udev, "IMPORT found builtin '%s', replacing %s:%u\n", file, filename, lineno); - rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, NULL, &cmd); + info(rules->udev, "IMPORT found builtin '%s', replacing %s:%u\n", + value, filename, lineno); + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); continue; } } @@ -1418,7 +1414,7 @@ static int add_rule(struct udev_rules *rules, char *line, dbg(rules->udev, "IMPORT execute builtin\n"); if (cmd < UDEV_BUILTIN_MAX) - rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, NULL, &cmd); + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); else err(rules->udev, "IMPORT{builtin}: '%s' unknown %s:%u\n", value, filename, lineno); } else if (strstr(attr, "file")) { @@ -2308,25 +2304,29 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; } case TK_M_IMPORT_BUILTIN: { - /* check if we ran already */ - if (event->builtin_run & (1 << cur->key.builtin_cmd)) { - info(event->udev, "IMPORT builtin skip '%s' %s:%u\n", - udev_builtin_name(cur->key.builtin_cmd), - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - /* return the result from earlier run */ - if (event->builtin_ret & (1 << cur->key.builtin_cmd)) + const char *command = &rules->buf[cur->key.value_off]; + + if (udev_builtin_run_once(cur->key.builtin_cmd)) { + /* check if we ran already */ + if (event->builtin_run & (1 << cur->key.builtin_cmd)) { + info(event->udev, "IMPORT builtin skip '%s' %s:%u\n", + udev_builtin_name(cur->key.builtin_cmd), + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + /* return the result from earlier run */ + if (event->builtin_ret & (1 << cur->key.builtin_cmd)) if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; + goto nomatch; + break; + } + /* mark as ran */ + event->builtin_run |= (1 << cur->key.builtin_cmd); } - /* mark as ran */ - event->builtin_run |= (1 << cur->key.builtin_cmd); info(event->udev, "IMPORT builtin '%s' %s:%u\n", udev_builtin_name(cur->key.builtin_cmd), &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - if (udev_builtin_run(event->dev, cur->key.builtin_cmd, false) != 0) { + if (udev_builtin_run(event->dev, cur->key.builtin_cmd, command, false) != 0) { /* remember failure */ info(rules->udev, "IMPORT builtin '%s' returned non-zero\n", udev_builtin_name(cur->key.builtin_cmd)); diff --git a/udev/udev.h b/udev/udev.h index eaba4ed341..0a3d7c4506 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -150,20 +150,25 @@ enum udev_builtin_cmd { UDEV_BUILTIN_PATH_ID, UDEV_BUILTIN_USB_ID, UDEV_BUILTIN_INPUT_ID, - UDEV_BUILTIN_MODALIAS_MATCH, + UDEV_BUILTIN_BLKID, + UDEV_BUILTIN_KMOD, UDEV_BUILTIN_MAX }; struct udev_builtin { const char *name; - int (*cmd)(struct udev_device *dev, bool test); + int (*cmd)(struct udev_device *dev, const char *command, bool test); const char *help; + bool run_once; }; extern const struct udev_builtin udev_builtin_path_id; extern const struct udev_builtin udev_builtin_usb_id; extern const struct udev_builtin udev_builtin_input_id; -enum udev_builtin_cmd udev_builtin_lookup(const char *name); +extern const struct udev_builtin udev_builtin_blkid; +extern const struct udev_builtin udev_builtin_kmod; +enum udev_builtin_cmd udev_builtin_lookup(const char *command); const char *udev_builtin_name(enum udev_builtin_cmd cmd); -int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, bool test); +bool udev_builtin_run_once(enum udev_builtin_cmd cmd); +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test); int udev_builtin_list(struct udev *udev); int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...); #endif diff --git a/udev/udevadm-test-builtin.c b/udev/udevadm-test-builtin.c index a2be77683a..f8af8992d0 100644 --- a/udev/udevadm-test-builtin.c +++ b/udev/udevadm-test-builtin.c @@ -107,7 +107,7 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) goto out; } - if (udev_builtin_run(dev, cmd, true) < 0) { + if (udev_builtin_run(dev, cmd, command, true) < 0) { fprintf(stderr, "error executing '%s'\n\n", command); rc = 6; } -- cgit v1.2.3-54-g00ecf From aa29418a13dc1e1eedca702663e733cc8d9f9859 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Dec 2011 23:10:56 +0100 Subject: add builtin load/unload initializers --- udev/udev-builtin-kmod.c | 21 ++++++++++++++++++++- udev/udev-builtin.c | 20 ++++++++++++++++++++ udev/udev.h | 4 ++++ udev/udevadm-test-builtin.c | 3 +++ udev/udevadm-test.c | 3 +++ udev/udevd.c | 3 +++ 6 files changed, 53 insertions(+), 1 deletion(-) diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index df057735d7..90f9c564ed 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -1,5 +1,5 @@ /* - * probe disks for filesystems and partitions + * load kernel modules * * Copyright (C) 2011 Kay Sievers * @@ -28,15 +28,34 @@ #include "udev.h" +static char *kmod; + static int builtin_kmod(struct udev_device *dev, const char *command, bool test) { printf("soon we load a module here: '%s'\n", command); + printf("test: %s\n", kmod); return EXIT_SUCCESS; } +static int builtin_kmod_load(struct udev *udev) +{ + printf("load module index\n"); + asprintf(&kmod, "pid: %u\n", getpid()); + return 0; +} + +static int builtin_kmod_unload(struct udev *udev) +{ + printf("unload module index\n"); + free(kmod); + return 0; +} + const struct udev_builtin udev_builtin_kmod = { .name = "kmod", .cmd = builtin_kmod, + .load = builtin_kmod_load, + .unload = builtin_kmod_unload, .help = "kernel module loader", .run_once = false, }; diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c index 36821702c1..9f21727699 100644 --- a/udev/udev-builtin.c +++ b/udev/udev-builtin.c @@ -33,6 +33,26 @@ static const struct udev_builtin *builtins[] = { [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, }; +int udev_builtin_load(struct udev *udev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (builtins[i]->load) + builtins[i]->load(udev); + return 0; +} + +int udev_builtin_unload(struct udev *udev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (builtins[i]->unload) + builtins[i]->unload(udev); + return 0; +} + int udev_builtin_list(struct udev *udev) { unsigned int i; diff --git a/udev/udev.h b/udev/udev.h index 0a3d7c4506..a07c525a89 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -158,6 +158,8 @@ struct udev_builtin { const char *name; int (*cmd)(struct udev_device *dev, const char *command, bool test); const char *help; + int (*load)(struct udev *udev); + int (*unload)(struct udev *udev); bool run_once; }; extern const struct udev_builtin udev_builtin_path_id; @@ -165,6 +167,8 @@ extern const struct udev_builtin udev_builtin_usb_id; extern const struct udev_builtin udev_builtin_input_id; extern const struct udev_builtin udev_builtin_blkid; extern const struct udev_builtin udev_builtin_kmod; +int udev_builtin_load(struct udev *udev); +int udev_builtin_unload(struct udev *udev); enum udev_builtin_cmd udev_builtin_lookup(const char *command); const char *udev_builtin_name(enum udev_builtin_cmd cmd); bool udev_builtin_run_once(enum udev_builtin_cmd cmd); diff --git a/udev/udevadm-test-builtin.c b/udev/udevadm-test-builtin.c index f8af8992d0..18f04bf888 100644 --- a/udev/udevadm-test-builtin.c +++ b/udev/udevadm-test-builtin.c @@ -99,6 +99,8 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) goto out; } + udev_builtin_load(udev); + cmd = udev_builtin_lookup(command); if (cmd >= UDEV_BUILTIN_MAX) { fprintf(stderr, "unknown command '%s'\n", command); @@ -113,6 +115,7 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) } out: udev_device_unref(dev); + udev_builtin_unload(udev); return rc; } diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index e807fc05a6..a7c6226a56 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -103,6 +103,8 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); + udev_builtin_load(udev); + rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { fprintf(stderr, "error reading rules\n"); @@ -159,6 +161,7 @@ out: udev_event_unref(event); udev_device_unref(dev); udev_rules_unref(rules); + udev_builtin_unload(udev); return rc; } diff --git a/udev/udevd.c b/udev/udevd.c index 05d4b2d66b..d1f7cd8909 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1513,6 +1513,8 @@ int main(int argc, char *argv[]) } fd_worker = worker_watch[READ_END]; + udev_builtin_load(udev); + rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { err(udev, "error reading rules\n"); @@ -1712,6 +1714,7 @@ exit_daemonize: worker_list_cleanup(udev); event_queue_cleanup(udev, EVENT_UNDEF); udev_rules_unref(rules); + udev_builtin_unload(udev); if (fd_signal >= 0) close(fd_signal); if (worker_watch[READ_END] >= 0) -- cgit v1.2.3-54-g00ecf From db634679ad58b3205910c969ac5359b1d6f625ad Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 22 Dec 2011 16:12:30 -0500 Subject: [PATCH[ udev: ata_id: Fix length of INQUIRY command SCSI INQUIRY commands are 6 bytes long, not 12 bytes. --- extras/ata_id/ata_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c index e38a7d1aa5..64df86c23a 100644 --- a/extras/ata_id/ata_id.c +++ b/extras/ata_id/ata_id.c @@ -52,7 +52,7 @@ static int disk_scsi_inquiry_command(int fd, size_t buf_len) { struct sg_io_v4 io_v4; - uint8_t cdb[12]; + uint8_t cdb[6]; uint8_t sense[32]; int ret; -- cgit v1.2.3-54-g00ecf From e216e514cf0c3bc6352f43fa3a7ffad221200bca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 02:02:44 +0100 Subject: build argv[] for builtin commands --- Makefile.am | 3 +- test/rules-test.sh | 2 +- udev/udev-builtin-blkid.c | 4 +-- udev/udev-builtin-input_id.c | 2 +- udev/udev-builtin-kmod.c | 17 ++++++++---- udev/udev-builtin-path_id.c | 2 +- udev/udev-builtin-usb_id.c | 2 +- udev/udev-builtin.c | 8 +++++- udev/udev-event.c | 66 +++++++++++++++++++++++++------------------- udev/udev.h | 3 +- udev/udevadm-test-builtin.c | 21 +++++++------- 11 files changed, 77 insertions(+), 53 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3ac85b95cc..eb9ee93135 100644 --- a/Makefile.am +++ b/Makefile.am @@ -284,7 +284,8 @@ libudev_test_libudev_LDADD = libudev/libudev.la udev_test_udev_SOURCES = \ $(udev_common_sources) \ udev/test-udev.c -udev_test_udev_LDADD = libudev/libudev-private.la +udev_test_udev_CFLAGS = $(udev_common_CFLAGS) +udev_test_udev_LDADD = $(udev_common_LDADD) # ------------------------------------------------------------------------------ # firmware - firmware loading diff --git a/test/rules-test.sh b/test/rules-test.sh index 9d5a07c19e..b98b69aba8 100755 --- a/test/rules-test.sh +++ b/test/rules-test.sh @@ -14,4 +14,4 @@ type python >/dev/null 2>&1 || { exit 0 } -$srcdir/test/rule-syntax-check.py `find $srcdir/rules -type f` +$srcdir/test/rule-syntax-check.py `find $srcdir/rules -name '*.rules'` diff --git a/udev/udev-builtin-blkid.c b/udev/udev-builtin-blkid.c index a787bf2f6c..04ad6a444d 100644 --- a/udev/udev-builtin-blkid.c +++ b/udev/udev-builtin-blkid.c @@ -105,7 +105,7 @@ static int probe_superblocks(blkid_probe pr) return blkid_do_safeprobe(pr); } -static int builtin_blkid(struct udev_device *dev, const char *command, bool test) +static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) { char *device = "/dev/sda3"; int64_t offset = 0; @@ -167,5 +167,5 @@ const struct udev_builtin udev_builtin_blkid = { .name = "blkid", .cmd = builtin_blkid, .help = "filesystem and partition probing", - .run_once = false, + .run_once = true, }; diff --git a/udev/udev-builtin-input_id.c b/udev/udev-builtin-input_id.c index 420a872662..4ef060d899 100644 --- a/udev/udev-builtin-input_id.c +++ b/udev/udev-builtin-input_id.c @@ -181,7 +181,7 @@ static void test_key (struct udev_device *dev, udev_builtin_add_property(dev, test, "ID_INPUT_KEYBOARD", "1"); } -static int builtin_input_id(struct udev_device *dev, const char *command, bool test) +static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev_device *pdev; unsigned long bitmask_ev[NBITS(EV_MAX)]; diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 90f9c564ed..4e8ec653fe 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -30,23 +30,30 @@ static char *kmod; -static int builtin_kmod(struct udev_device *dev, const char *command, bool test) +static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { - printf("soon we load a module here: '%s'\n", command); + struct udev *udev = udev_device_get_udev(dev); + + if (argc < 3) { + err(udev, "missing command + argument\n"); + return EXIT_FAILURE; + } + + printf("soon we '%s' the module '%s' (%i) here\n", argv[1], argv[2], argc); printf("test: %s\n", kmod); return EXIT_SUCCESS; } static int builtin_kmod_load(struct udev *udev) { - printf("load module index\n"); - asprintf(&kmod, "pid: %u\n", getpid()); + info(udev, "load module index\n"); + asprintf(&kmod, "pid: %u", getpid()); return 0; } static int builtin_kmod_unload(struct udev *udev) { - printf("unload module index\n"); + info(udev, "unload module index\n"); free(kmod); return 0; } diff --git a/udev/udev-builtin-path_id.c b/udev/udev-builtin-path_id.c index 97a9ace5c1..18af12f29a 100644 --- a/udev/udev-builtin-path_id.c +++ b/udev/udev-builtin-path_id.c @@ -390,7 +390,7 @@ out: return parent; } -static int builtin_path_id(struct udev_device *dev, const char *command, bool test) +static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev_device *parent; char *path = NULL; diff --git a/udev/udev-builtin-usb_id.c b/udev/udev-builtin-usb_id.c index 9a519179c8..21c3c03d8a 100644 --- a/udev/udev-builtin-usb_id.c +++ b/udev/udev-builtin-usb_id.c @@ -239,7 +239,7 @@ out: * 6.) If the device supplies a serial number, this number * is concatenated with the identification with an underscore '_'. */ -static int builtin_usb_id(struct udev_device *dev, const char *command, bool test) +static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool test) { char vendor_str[64]; char vendor_str_enc[256]; diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c index 9f21727699..f17b04f67e 100644 --- a/udev/udev-builtin.c +++ b/udev/udev-builtin.c @@ -90,7 +90,13 @@ enum udev_builtin_cmd udev_builtin_lookup(const char *command) int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) { - return builtins[cmd]->cmd(dev, command, test); + char arg[UTIL_PATH_SIZE]; + int argc; + char *argv[128]; + + util_strscpy(arg, sizeof(arg), command); + udev_build_argv(udev_device_get_udev(dev), arg, &argc, argv); + return builtins[cmd]->cmd(dev, argc, argv, test); } int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...) diff --git a/udev/udev-event.c b/udev/udev-event.c index c978e847b7..e10d48e13b 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -698,6 +698,41 @@ out: return err; } +int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]) +{ + int i = 0; + char *pos; + + if (strchr(cmd, ' ') == NULL) { + argv[i++] = cmd; + goto out; + } + + pos = cmd; + while (pos != NULL && pos[0] != '\0') { + if (pos[0] == '\'') { + /* do not separate quotes */ + pos++; + argv[i] = strsep(&pos, "\'"); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } + dbg(udev, "argv[%i] '%s'\n", i, argv[i]); + i++; + } +out: + argv[i] = NULL; + if (argc) + *argc = i; + return 0; +} + int udev_event_spawn(struct udev_event *event, const char *cmd, char **envp, const sigset_t *sigmask, char *result, size_t ressize) @@ -707,39 +742,12 @@ int udev_event_spawn(struct udev_event *event, int errpipe[2] = {-1, -1}; pid_t pid; char arg[UTIL_PATH_SIZE]; + char *argv[128]; char program[UTIL_PATH_SIZE]; - char *argv[((sizeof(arg) + 1) / 2) + 1]; - int i; int err = 0; - /* build argv from command */ util_strscpy(arg, sizeof(arg), cmd); - i = 0; - if (strchr(arg, ' ') != NULL) { - char *pos = arg; - - while (pos != NULL && pos[0] != '\0') { - if (pos[0] == '\'') { - /* do not separate quotes */ - pos++; - argv[i] = strsep(&pos, "\'"); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } - dbg(udev, "arg[%i] '%s'\n", i, argv[i]); - i++; - } - argv[i] = NULL; - } else { - argv[0] = arg; - argv[1] = NULL; - } + udev_build_argv(event->udev, arg, NULL, argv); /* pipes from child to parent */ if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { diff --git a/udev/udev.h b/udev/udev.h index a07c525a89..d5445e84e6 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -81,6 +81,7 @@ int udev_event_spawn(struct udev_event *event, char *result, size_t ressize); int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); int udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); +int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); /* udev-watch.c */ int udev_watch_init(struct udev *udev); @@ -156,7 +157,7 @@ enum udev_builtin_cmd { }; struct udev_builtin { const char *name; - int (*cmd)(struct udev_device *dev, const char *command, bool test); + int (*cmd)(struct udev_device *dev, int argc, char *argv[], bool test); const char *help; int (*load)(struct udev *udev); int (*unload)(struct udev *udev); diff --git a/udev/udevadm-test-builtin.c b/udev/udevadm-test-builtin.c index 18f04bf888..ea1bcbcb07 100644 --- a/udev/udevadm-test-builtin.c +++ b/udev/udevadm-test-builtin.c @@ -70,6 +70,7 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) goto out; } } + command = argv[optind++]; if (command == NULL) { fprintf(stderr, "command missing\n"); @@ -85,6 +86,16 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) goto out; } + udev_builtin_load(udev); + + cmd = udev_builtin_lookup(command); + if (cmd >= UDEV_BUILTIN_MAX) { + fprintf(stderr, "unknown command '%s'\n", command); + help(udev); + rc = 5; + goto out; + } + /* add /sys if needed */ if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); @@ -99,16 +110,6 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) goto out; } - udev_builtin_load(udev); - - cmd = udev_builtin_lookup(command); - if (cmd >= UDEV_BUILTIN_MAX) { - fprintf(stderr, "unknown command '%s'\n", command); - help(udev); - rc = 5; - goto out; - } - if (udev_builtin_run(dev, cmd, command, true) < 0) { fprintf(stderr, "error executing '%s'\n\n", command); rc = 6; -- cgit v1.2.3-54-g00ecf From c38a141b1f66ef48f8e4f71e26d1861de63bd151 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 03:16:56 +0100 Subject: update blkid builtin --- udev/udev-builtin-blkid.c | 105 ++++++++++++++++++++++++++++++---------------- udev/udev-builtin.c | 3 +- udev/udev.h | 2 +- 3 files changed, 72 insertions(+), 38 deletions(-) diff --git a/udev/udev-builtin-blkid.c b/udev/udev-builtin-blkid.c index 04ad6a444d..3187ab0b02 100644 --- a/udev/udev-builtin-blkid.c +++ b/udev/udev-builtin-blkid.c @@ -25,52 +25,57 @@ #include #include #include +#include #include #include #include "udev.h" -static void print_property(const char *name, const char *value) +static void print_property(struct udev_device *dev, bool test, const char *name, const char *value) { - char enc[265], safe[256]; - size_t namelen = strlen(name); + char s[265]; - enc[0] = '\0'; - safe[0] = '\0'; + s[0] = '\0'; - if (!strcmp(name, "TYPE") || !strcmp(name, "VERSION")) { - blkid_encode_string(value, enc, sizeof(enc)); - printf("ID_FS_%s=%s\n", name, enc); + if (!strcmp(name, "TYPE")) { + udev_builtin_add_property(dev, test, "ID_FS_TYPE", value); - } else if (!strcmp(name, "UUID") || - !strcmp(name, "LABEL") || - !strcmp(name, "UUID_SUB")) { + } else if (!strcmp(name, "VERSION")) { + udev_builtin_add_property(dev, test, "ID_FS_VERSION", value); - blkid_safe_string(value, safe, sizeof(safe)); - printf("ID_FS_%s=%s\n", name, safe); + } else if (!strcmp(name, "UUID")) { + blkid_safe_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID", s); + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID_ENC", s); - blkid_encode_string(value, enc, sizeof(enc)); - printf("ID_FS_%s_ENC=%s\n", name, enc); + } else if (!strcmp(name, "UUID_SUB")) { + blkid_safe_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB", s); + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB_ENC", s); - } else if (!strcmp(name, "PTTYPE")) { - printf("ID_PART_TABLE_TYPE=%s\n", value); + } else if (!strcmp(name, "LABEL")) { + blkid_safe_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_LABEL", s); + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_LABEL_ENC", s); - } else if (!strcmp(name, "PART_ENTRY_NAME") || - !strcmp(name, "PART_ENTRY_TYPE")) { + } else if (!strcmp(name, "PTTYPE")) { + udev_builtin_add_property(dev, test, "ID_PART_TABLE_TYPE", value); - blkid_encode_string(value, enc, sizeof(enc)); - printf("ID_%s=%s\n", name, enc); + } else if (!strcmp(name, "PART_ENTRY_NAME")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "PART_ENTRY_NAME", s); - } else if (!strncmp(name, "PART_ENTRY_", 11)) - printf("ID_%s=%s\n", name, value); + } else if (!strcmp(name, "PART_ENTRY_TYPE")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "PART_ENTRY_TYPE", s); - else if (namelen >= 15 && ( - !strcmp(name + (namelen - 12), "_SECTOR_SIZE") || - !strcmp(name + (namelen - 8), "_IO_SIZE") || - !strcmp(name, "ALIGNMENT_OFFSET"))) - printf("ID_IOLIMIT_%s=%s\n", name, value); - else - printf("ID_FS_%s=%s\n", name, value); + } else if (!strncmp(name, "PART_ENTRY_", 11)) { + util_strscpyl(s, sizeof(s), "ID_", name, NULL); + udev_builtin_add_property(dev, test, name, value); + } } static int probe_superblocks(blkid_probe pr) @@ -107,9 +112,9 @@ static int probe_superblocks(blkid_probe pr) static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) { - char *device = "/dev/sda3"; + struct udev *udev = udev_device_get_udev(dev); int64_t offset = 0; - //int noraid = 0; + bool noraid = false; int fd = -1; blkid_probe pr; const char *data; @@ -119,7 +124,28 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t size_t len; int err = 0; - //FIXME: read offset, read noraid + static const struct option options[] = { + { "offset", optional_argument, NULL, 'o' }, + { "noraid", no_argument, NULL, 'R' }, + {} + }; + + for (;;) { + int option; + + option = getopt_long(argc, argv, "oR", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'o': + offset = strtoull(optarg, NULL, 0); + break; + case 'R': + noraid = true; + break; + } + } pr = blkid_new_probe(); if (!pr) { @@ -132,9 +158,12 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE | BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION); - fd = open(device, O_RDONLY|O_CLOEXEC); + if (noraid) + blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID); + + fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC); if (fd < 0) { - fprintf(stderr, "error: %s: %m\n", device); + fprintf(stderr, "error: %s: %m\n", udev_device_get_devnode(dev)); goto out; } @@ -142,6 +171,10 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t if (err < 0) goto out; + info(udev, "probe %s %sraid offset=%llu", + udev_device_get_devnode(dev), + noraid ? "no" : "", (unsigned long long) offset); + err = probe_superblocks(pr); if (err < 0) goto out; @@ -151,7 +184,7 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t if (blkid_probe_get_value(pr, i, &name, &data, &len)) continue; len = strnlen((char *) data, len); - print_property(name, (char *) data); + print_property(dev, test, name, (char *) data); } blkid_free_probe(pr); diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c index f17b04f67e..6dfd006710 100644 --- a/udev/udev-builtin.c +++ b/udev/udev-builtin.c @@ -94,12 +94,13 @@ int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const c int argc; char *argv[128]; + optind = 0; util_strscpy(arg, sizeof(arg), command); udev_build_argv(udev_device_get_udev(dev), arg, &argc, argv); return builtins[cmd]->cmd(dev, argc, argv, test); } -int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...) +int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val) { struct udev_list_entry *entry; diff --git a/udev/udev.h b/udev/udev.h index d5445e84e6..aafa15cd31 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -175,5 +175,5 @@ const char *udev_builtin_name(enum udev_builtin_cmd cmd); bool udev_builtin_run_once(enum udev_builtin_cmd cmd); int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test); int udev_builtin_list(struct udev *udev); -int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val, ...); +int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val); #endif -- cgit v1.2.3-54-g00ecf From 7c2dee4a4d7f1b264031daaee786a8fe429884e1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 03:21:53 +0100 Subject: rules: switch to built-in blkid --- rules/rules.d/60-persistent-storage.rules.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules.in b/rules/rules.d/60-persistent-storage.rules.in index 47185386cd..9b340334f4 100644 --- a/rules/rules.d/60-persistent-storage.rules.in +++ b/rules/rules.d/60-persistent-storage.rules.in @@ -66,12 +66,14 @@ ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PA ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" # probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", IMPORT{program}="@sbindir@/blkid -o udev -p -u noraid -O $env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET} $tempnode" +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \ + IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}" # single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", IMPORT{program}="@sbindir@/blkid -o udev -p -u noraid $tempnode" +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \ + IMPORT{builtin}="blkid --noraid" # probe filesystem metadata of disks -KERNEL!="sr*", IMPORT{program}="@sbindir@/blkid -o udev -p $tempnode" +KERNEL!="sr*", IMPORT{builtin}="blkid" # watch metadata changes by tools closing the device after writing KERNEL!="sr*", OPTIONS+="watch" -- cgit v1.2.3-54-g00ecf From 009cc08c7b85bc6d69145a4b1efd7be534da1b45 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 03:23:37 +0100 Subject: rules: do not preprocess 60-persistent-storage.rules --- Makefile.am | 8 +-- rules/.gitignore | 1 - rules/rules.d/60-persistent-storage.rules | 93 ++++++++++++++++++++++++++++ rules/rules.d/60-persistent-storage.rules.in | 93 ---------------------------- 4 files changed, 96 insertions(+), 99 deletions(-) create mode 100644 rules/rules.d/60-persistent-storage.rules delete mode 100644 rules/rules.d/60-persistent-storage.rules.in diff --git a/Makefile.am b/Makefile.am index eb9ee93135..0064631e44 100644 --- a/Makefile.am +++ b/Makefile.am @@ -144,19 +144,17 @@ dist_udevrules_DATA = \ rules/rules.d/60-persistent-serial.rules \ rules/rules.d/60-persistent-input.rules \ rules/rules.d/60-persistent-alsa.rules \ + rules/rules.d/60-persistent-storage.rules \ rules/rules.d/95-udev-late.rules udevrules_DATA = \ - rules/rules.d/60-persistent-storage.rules \ rules/rules.d/80-drivers.rules EXTRA_DIST += \ - rules/rules.d/80-drivers.rules.in \ - rules/rules.d/60-persistent-storage.rules.in + rules/rules.d/80-drivers.rules.in CLEANFILES += \ - rules/rules.d/80-drivers.rules \ - rules/rules.d/60-persistent-storage.rules + rules/rules.d/80-drivers.rules udevconfdir = $(sysconfdir)/udev dist_udevconf_DATA = udev.conf diff --git a/rules/.gitignore b/rules/.gitignore index 7240bd79d6..16f9c2daa8 100644 --- a/rules/.gitignore +++ b/rules/.gitignore @@ -1,2 +1 @@ -rules.d/60-persistent-storage.rules rules.d/80-drivers.rules diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules new file mode 100644 index 0000000000..9b340334f4 --- /dev/null +++ b/rules/rules.d/60-persistent-storage.rules @@ -0,0 +1,93 @@ +# do not edit this file, it will be overwritten on update + +# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +# forward scsi device event to corresponding block device +ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" + +ACTION=="remove", GOTO="persistent_storage_end" + +# enable in-kernel media-presence polling +ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000" + +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# skip rules for inappropriate block devices +KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end" + +# ignore partitions that span the entire disk +TEST=="whole_disk", GOTO="persistent_storage_end" + +# for partitions import parent information +ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" + +# virtio-blk +KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" +KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" + +# ATA devices with their own "ata" kernel subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" +# ATA devices using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" +# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $tempnode" + +# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $tempnode" +# Otherwise fall back to using usb_id for USB devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" + +# scsi devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" +KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# firewire +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" +KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" + +# scsi compat links for ATA devices +KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d$tempnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" +KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" + +KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" +KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + +# by-path (parent device path) +ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" +ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# skip unpartitioned removable media devices from drivers which do not send "change" events +ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" + +# probe filesystem metadata of optical drives which have a media inserted +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \ + IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}" +# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \ + IMPORT{builtin}="blkid --noraid" + +# probe filesystem metadata of disks +KERNEL!="sr*", IMPORT{builtin}="blkid" + +# watch metadata changes by tools closing the device after writing +KERNEL!="sr*", OPTIONS+="watch" + +# by-label/by-uuid links (filesystem metadata) +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +# by-id (World Wide Name) +ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" +ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" + +# by-partlabel/by-partuuid links (partition metadata) +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}" +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" + +LABEL="persistent_storage_end" diff --git a/rules/rules.d/60-persistent-storage.rules.in b/rules/rules.d/60-persistent-storage.rules.in deleted file mode 100644 index 9b340334f4..0000000000 --- a/rules/rules.d/60-persistent-storage.rules.in +++ /dev/null @@ -1,93 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -# forward scsi device event to corresponding block device -ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" - -ACTION=="remove", GOTO="persistent_storage_end" - -# enable in-kernel media-presence polling -ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000" - -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# skip rules for inappropriate block devices -KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end" - -# ignore partitions that span the entire disk -TEST=="whole_disk", GOTO="persistent_storage_end" - -# for partitions import parent information -ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" - -# virtio-blk -KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" -KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" - -# ATA devices with their own "ata" kernel subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" -# ATA devices using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" -# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $tempnode" - -# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $tempnode" -# Otherwise fall back to using usb_id for USB devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" - -# scsi devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" -KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" -KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# firewire -KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" -KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" - -# scsi compat links for ATA devices -KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d$tempnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" -KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" - -KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" - -# by-path (parent device path) -ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" -ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# skip unpartitioned removable media devices from drivers which do not send "change" events -ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" - -# probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \ - IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}" -# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \ - IMPORT{builtin}="blkid --noraid" - -# probe filesystem metadata of disks -KERNEL!="sr*", IMPORT{builtin}="blkid" - -# watch metadata changes by tools closing the device after writing -KERNEL!="sr*", OPTIONS+="watch" - -# by-label/by-uuid links (filesystem metadata) -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -# by-id (World Wide Name) -ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" -ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" - -# by-partlabel/by-partuuid links (partition metadata) -ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}" -ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" - -LABEL="persistent_storage_end" -- cgit v1.2.3-54-g00ecf From 95de03a7a20e02f06d2bbe8350f1b5e89af02790 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 03:30:02 +0100 Subject: buildsys: disable tar.gz --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 86389fc410..f0d5d04076 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ AC_INIT([udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) AC_CONFIG_SRCDIR([udev/udevd.c]) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax dist-xz subdir-objects]) +AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects]) AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_CONFIG_MACRO_DIR([m4]) -- cgit v1.2.3-54-g00ecf From c7f9693c149d2179d7922cae3e9930381a3a1d11 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 03:40:31 +0100 Subject: builtin: blkid - add missing newline --- autogen.sh | 9 +++++---- udev/udev-builtin-blkid.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/autogen.sh b/autogen.sh index ba95669426..ceb7e65018 100755 --- a/autogen.sh +++ b/autogen.sh @@ -24,11 +24,12 @@ libdir() { args="--prefix=/usr \ --sysconfdir=/etc \ ---bindir=/usr/bin \ ---sbindir=/usr/sbin \ +--bindir=/sbin \ +--sbindir=/sbin \ --libdir=$(libdir /usr/lib) \ ---libexecdir=/usr/lib/udev \ ---with-systemdsystemunitdir=/usr/lib/systemd/system +--with-rootlibdir=$(libdir /lib) \ +--libexecdir=/lib/udev \ +--with-systemdsystemunitdir=/lib/systemd/system --with-selinux \ --enable-gtk-doc" diff --git a/udev/udev-builtin-blkid.c b/udev/udev-builtin-blkid.c index 3187ab0b02..78fdf3c7c7 100644 --- a/udev/udev-builtin-blkid.c +++ b/udev/udev-builtin-blkid.c @@ -171,7 +171,7 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t if (err < 0) goto out; - info(udev, "probe %s %sraid offset=%llu", + info(udev, "probe %s %sraid offset=%llu\n", udev_device_get_devnode(dev), noraid ? "no" : "", (unsigned long long) offset); -- cgit v1.2.3-54-g00ecf From e5d8ce91bedf4af89111ac9499d6bdc91b475f0d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 04:06:34 +0100 Subject: builtin: blkid - add missing ID_FS_USAGE --- udev/udev-builtin-blkid.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udev/udev-builtin-blkid.c b/udev/udev-builtin-blkid.c index 78fdf3c7c7..0260c440e2 100644 --- a/udev/udev-builtin-blkid.c +++ b/udev/udev-builtin-blkid.c @@ -40,6 +40,9 @@ static void print_property(struct udev_device *dev, bool test, const char *name, if (!strcmp(name, "TYPE")) { udev_builtin_add_property(dev, test, "ID_FS_TYPE", value); + } else if (!strcmp(name, "USAGE")) { + udev_builtin_add_property(dev, test, "ID_FS_USAGE", value); + } else if (!strcmp(name, "VERSION")) { udev_builtin_add_property(dev, test, "ID_FS_VERSION", value); -- cgit v1.2.3-54-g00ecf From 06316d9f1a91b4d3efdb7402e72498cb3deb1806 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 04:50:33 +0100 Subject: builtin: kmod - switch modprobe to builtin --- INSTALL | 3 --- autogen.sh | 1 - configure.ac | 1 - extras/mtd_probe/75-probe_mtd.rules.in | 2 +- rules/rules.d/80-drivers.rules.in | 12 ++++++------ udev/udev-builtin-kmod.c | 28 ++++++++++++++++++++++------ 6 files changed, 29 insertions(+), 18 deletions(-) diff --git a/INSTALL b/INSTALL index 8ad69a43ad..29620005b2 100644 --- a/INSTALL +++ b/INSTALL @@ -3,7 +3,6 @@ The options used used usually look like: --prefix=/usr \ --sysconfdir=/etc \ --bindir=/usr/bin \ - --sbindir=/usr/sbin \ --libdir=/usr/lib64 \ --libexecdir=/usr/lib/udev \ --with-systemdsystemunitdir=/usr/lib/systemd/system \ @@ -14,7 +13,6 @@ The options used in a RPM spec file look like: --prefix=%{_prefix} \ --sysconfdir=%{_sysconfdir} \ --bindir=%{_bindir} \ - --sbindir=%{_sbindir} \ --libdir=%{_libdir} \ --libexecdir=%{_prefix}/lib/udev \ --with-systemdsystemunitdir=%{_prefix}/lib/systemd/system \ @@ -23,7 +21,6 @@ The options used in a RPM spec file look like: The options to install udev in the rootfs instead of /usr, and udevadm in /sbin: --bindir=/sbin - --sbindir=/sbin --libexecdir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system --with-rootlibdir=/lib64 diff --git a/autogen.sh b/autogen.sh index ceb7e65018..e7bd9c2a1c 100755 --- a/autogen.sh +++ b/autogen.sh @@ -25,7 +25,6 @@ libdir() { args="--prefix=/usr \ --sysconfdir=/etc \ --bindir=/sbin \ ---sbindir=/sbin \ --libdir=$(libdir /usr/lib) \ --with-rootlibdir=$(libdir /lib) \ --libexecdir=/lib/udev \ diff --git a/configure.ac b/configure.ac index f0d5d04076..abfcb361dd 100644 --- a/configure.ac +++ b/configure.ac @@ -218,7 +218,6 @@ AC_MSG_RESULT([ prefix: ${prefix} sysconfdir: ${sysconfdir} bindir: ${bindir} - sbindir: ${sbindir} libdir: ${libdir} rootlibdir: ${rootlib_execdir} libexecdir: ${libexecdir} diff --git a/extras/mtd_probe/75-probe_mtd.rules.in b/extras/mtd_probe/75-probe_mtd.rules.in index 2e28d37fa3..6b0c1c27e6 100644 --- a/extras/mtd_probe/75-probe_mtd.rules.in +++ b/extras/mtd_probe/75-probe_mtd.rules.in @@ -3,6 +3,6 @@ ACTION!="add", GOTO="mtd_probe_end" KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" -KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", RUN+="@sbindir@/modprobe -bv sm_ftl" +KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl" LABEL="mtd_probe_end" diff --git a/rules/rules.d/80-drivers.rules.in b/rules/rules.d/80-drivers.rules.in index 04e30f5b04..38ebfeb0e6 100644 --- a/rules/rules.d/80-drivers.rules.in +++ b/rules/rules.d/80-drivers.rules.in @@ -2,11 +2,11 @@ ACTION=="remove", GOTO="drivers_end" -DRIVER!="?*", ENV{MODALIAS}=="?*", RUN+="@sbindir@/modprobe -bv $env{MODALIAS}" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", RUN+="@sbindir@/modprobe -bv tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", RUN+="@sbindir@/modprobe -bv tifm_ms" -SUBSYSTEM=="memstick", RUN+="@sbindir@/modprobe -bv --all ms_block mspro_block" -SUBSYSTEM=="i2o", RUN+="@sbindir@/modprobe -bv i2o_block" -SUBSYSTEM=="module", KERNEL=="parport_pc", RUN+="@sbindir@/modprobe -bv ppdev" +DRIVER!="?*", ENV{MODALIAS}=="?*", IMPORT{builtin}="kmod load $env{MODALIAS}" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", IMPORT{builtin}="kmod load tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", IMPORT{builtin}="kmod load tifm_ms" +SUBSYSTEM=="memstick", IMPORT{builtin}="kmod load ms_block mspro_block" +SUBSYSTEM=="i2o", IMPORT{builtin}="kmod load i2o_block" +SUBSYSTEM=="module", KERNEL=="parport_pc", IMPORT{builtin}="kmod load ppdev" LABEL="drivers_end" diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 4e8ec653fe..a84f08cf93 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -25,36 +25,52 @@ #include #include #include +#include #include "udev.h" -static char *kmod; - static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); + pid_t pid; + char *m[5]; if (argc < 3) { err(udev, "missing command + argument\n"); return EXIT_FAILURE; } - printf("soon we '%s' the module '%s' (%i) here\n", argv[1], argv[2], argc); - printf("test: %s\n", kmod); + err(udev, "'%s' the module '%s' (%i)\n", argv[1], argv[2], argc); + + m[0] = "/sbin/modprobe"; + m[1] = "-bv"; + m[1] = argv[2]; + m[2] = argv[3]; + m[3] = NULL; + + pid = fork(); + switch(pid) { + case 0: + execv(m[0], m); + _exit(1); + case -1: + return EXIT_FAILURE; + default: + waitpid(pid, NULL, 0); + } + return EXIT_SUCCESS; } static int builtin_kmod_load(struct udev *udev) { info(udev, "load module index\n"); - asprintf(&kmod, "pid: %u", getpid()); return 0; } static int builtin_kmod_unload(struct udev *udev) { info(udev, "unload module index\n"); - free(kmod); return 0; } -- cgit v1.2.3-54-g00ecf From 4a9460f15a8ff198d6a9c249bdd63572509e23bb Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 04:54:08 +0100 Subject: rules: do not preprocess 80-drivers.rules + 75-probe_mtd.rules --- Makefile.am | 14 ++------------ extras/mtd_probe/.gitignore | 1 - extras/mtd_probe/75-probe_mtd.rules | 8 ++++++++ extras/mtd_probe/75-probe_mtd.rules.in | 8 -------- rules/.gitignore | 1 - rules/rules.d/80-drivers.rules | 12 ++++++++++++ rules/rules.d/80-drivers.rules.in | 12 ------------ 7 files changed, 22 insertions(+), 34 deletions(-) create mode 100644 extras/mtd_probe/75-probe_mtd.rules delete mode 100644 extras/mtd_probe/75-probe_mtd.rules.in delete mode 100644 rules/.gitignore create mode 100644 rules/rules.d/80-drivers.rules delete mode 100644 rules/rules.d/80-drivers.rules.in diff --git a/Makefile.am b/Makefile.am index 0064631e44..3e7996fdd9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -145,17 +145,9 @@ dist_udevrules_DATA = \ rules/rules.d/60-persistent-input.rules \ rules/rules.d/60-persistent-alsa.rules \ rules/rules.d/60-persistent-storage.rules \ + rules/rules.d/80-drivers.rules \ rules/rules.d/95-udev-late.rules -udevrules_DATA = \ - rules/rules.d/80-drivers.rules - -EXTRA_DIST += \ - rules/rules.d/80-drivers.rules.in - -CLEANFILES += \ - rules/rules.d/80-drivers.rules - udevconfdir = $(sysconfdir)/udev dist_udevconf_DATA = udev.conf @@ -640,10 +632,8 @@ extras_mtd_probe_mtd_probe_SOURCES = \ extras/mtd_probe/mtd_probe.h \ extras/mtd_probe/probe_smartmedia.c extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) -udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules +dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules libexec_PROGRAMS += extras/mtd_probe/mtd_probe -EXTRA_DIST += extras/mtd_probe/75-probe_mtd.rules.in -CLEANFILES += extras/mtd_probe/75-probe_mtd.rules endif if ENABLE_RULE_GENERATOR diff --git a/extras/mtd_probe/.gitignore b/extras/mtd_probe/.gitignore index 70d3e8310e..82b8ab501f 100644 --- a/extras/mtd_probe/.gitignore +++ b/extras/mtd_probe/.gitignore @@ -1,2 +1 @@ mtd_probe -75-probe_mtd.rules diff --git a/extras/mtd_probe/75-probe_mtd.rules b/extras/mtd_probe/75-probe_mtd.rules new file mode 100644 index 0000000000..6b0c1c27e6 --- /dev/null +++ b/extras/mtd_probe/75-probe_mtd.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="mtd_probe_end" + +KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" +KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl" + +LABEL="mtd_probe_end" diff --git a/extras/mtd_probe/75-probe_mtd.rules.in b/extras/mtd_probe/75-probe_mtd.rules.in deleted file mode 100644 index 6b0c1c27e6..0000000000 --- a/extras/mtd_probe/75-probe_mtd.rules.in +++ /dev/null @@ -1,8 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="mtd_probe_end" - -KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" -KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl" - -LABEL="mtd_probe_end" diff --git a/rules/.gitignore b/rules/.gitignore deleted file mode 100644 index 16f9c2daa8..0000000000 --- a/rules/.gitignore +++ /dev/null @@ -1 +0,0 @@ -rules.d/80-drivers.rules diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules new file mode 100644 index 0000000000..38ebfeb0e6 --- /dev/null +++ b/rules/rules.d/80-drivers.rules @@ -0,0 +1,12 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="drivers_end" + +DRIVER!="?*", ENV{MODALIAS}=="?*", IMPORT{builtin}="kmod load $env{MODALIAS}" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", IMPORT{builtin}="kmod load tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", IMPORT{builtin}="kmod load tifm_ms" +SUBSYSTEM=="memstick", IMPORT{builtin}="kmod load ms_block mspro_block" +SUBSYSTEM=="i2o", IMPORT{builtin}="kmod load i2o_block" +SUBSYSTEM=="module", KERNEL=="parport_pc", IMPORT{builtin}="kmod load ppdev" + +LABEL="drivers_end" diff --git a/rules/rules.d/80-drivers.rules.in b/rules/rules.d/80-drivers.rules.in deleted file mode 100644 index 38ebfeb0e6..0000000000 --- a/rules/rules.d/80-drivers.rules.in +++ /dev/null @@ -1,12 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="drivers_end" - -DRIVER!="?*", ENV{MODALIAS}=="?*", IMPORT{builtin}="kmod load $env{MODALIAS}" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", IMPORT{builtin}="kmod load tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", IMPORT{builtin}="kmod load tifm_ms" -SUBSYSTEM=="memstick", IMPORT{builtin}="kmod load ms_block mspro_block" -SUBSYSTEM=="i2o", IMPORT{builtin}="kmod load i2o_block" -SUBSYSTEM=="module", KERNEL=="parport_pc", IMPORT{builtin}="kmod load ppdev" - -LABEL="drivers_end" -- cgit v1.2.3-54-g00ecf From 0e2856a268f3cb460b964b5088af2526a27c2423 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 05:12:34 +0100 Subject: builtin: apply format string --- udev/udev-rules.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 0de44054b7..4226d0b4e0 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2304,7 +2304,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event break; } case TK_M_IMPORT_BUILTIN: { - const char *command = &rules->buf[cur->key.value_off]; + char command[UTIL_PATH_SIZE]; if (udev_builtin_run_once(cur->key.builtin_cmd)) { /* check if we ran already */ @@ -2322,10 +2322,13 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* mark as ran */ event->builtin_run |= (1 << cur->key.builtin_cmd); } + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], command, sizeof(command)); info(event->udev, "IMPORT builtin '%s' %s:%u\n", udev_builtin_name(cur->key.builtin_cmd), &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + if (udev_builtin_run(event->dev, cur->key.builtin_cmd, command, false) != 0) { /* remember failure */ info(rules->udev, "IMPORT builtin '%s' returned non-zero\n", -- cgit v1.2.3-54-g00ecf From c2e63452dda721bb7f127adefdfe444153a9bdca Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 05:18:43 +0100 Subject: remove last sbindir use --- Makefile.am | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 3e7996fdd9..3fa7aed30a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,7 +46,6 @@ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ -e 's,@libdir\@,$(libdir),g' \ -e 's,@includedir\@,$(includedir),g' \ -e 's,@bindir\@,$(bindir),g' \ - -e 's,@sbindir\@,$(sbindir),g' \ -e 's,@libexecdir\@,$(libexecdir),g' \ < $< > $@ || rm $@ -- cgit v1.2.3-54-g00ecf From 749f464f9169acc5f0aa25c7ce5428353ebbe664 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 13:37:48 +0100 Subject: update NEWS --- NEWS | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 99d94e29ea..6178739d18 100644 --- a/NEWS +++ b/NEWS @@ -1,12 +1,22 @@ -udev 176 +udev 175 ======== -The udevadm tool moved from 'sbin' to 'bin'. Some tools expect +The default install location moved from /lib/udev to /usr/lib/udev +to support systems without the / vs. /usr split. --libbexecdir= +can still be configured to install things to the rootfs. + +The udevadm tool moved from /sbin to /usr/bin. Some tools expect udevadm in 'sbin'. A symlink to udevadm in 'bin' needs to be -manually created if needed. +manually created if needed. Alternatively --bindir=/sbin installs +udevadm in /sbin. The systemd socket files use PassCred=yes, which requires systemd version 38. +The blkid tool is no longer called from udev rules. Udev links directly +to libblkid now. + +The udev build system only creates a .xz tarball now. + udev 175 ======== Bugfixes. -- cgit v1.2.3-54-g00ecf From f71a55810f09fc010b44689aa00823a745ff83c6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 13:38:46 +0100 Subject: autogen.sh: moce CFLAGS from to configure.ac; print common ./configure options --- Makefile.am | 7 +++++-- autogen.sh | 25 ++++++++----------------- configure.ac | 8 ++++++++ 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3fa7aed30a..47ed3ccc48 100644 --- a/Makefile.am +++ b/Makefile.am @@ -16,6 +16,7 @@ AM_CPPFLAGS = \ -DLIBEXECDIR=\""$(libexecdir)"\" AM_CFLAGS = \ + ${my_CFLAGS} \ -fvisibility=hidden \ -ffunction-sections \ -fdata-sections @@ -207,11 +208,13 @@ udev_common_sources = \ udev/udev-builtin-kmod.c udev_common_CFLAGS = \ - $(BLKID_CFLAGS) + $(BLKID_CFLAGS) \ + $(KMOD_CFLAGS) udev_common_LDADD = \ libudev/libudev-private.la \ - $(BLKID_LIBS) + $(BLKID_LIBS) \ + $(BLKID_KMOD) udev_udevd_SOURCES = \ $(udev_common_sources) \ diff --git a/autogen.sh b/autogen.sh index e7bd9c2a1c..50923f0ab3 100755 --- a/autogen.sh +++ b/autogen.sh @@ -3,21 +3,6 @@ gtkdocize autoreconf --install --symlink -MYCFLAGS="-g -Wall \ --Wmissing-declarations -Wmissing-prototypes \ --Wnested-externs -Wpointer-arith \ --Wpointer-arith -Wsign-compare -Wchar-subscripts \ --Wstrict-prototypes -Wshadow \ --Wformat-security -Wtype-limits" - -case "$CFLAGS" in - *-O[0-9]*) - ;; - *) - MYCFLAGS="$MYCFLAGS -O2" - ;; -esac - libdir() { echo $(cd $1/$(gcc -print-multi-os-directory); pwd) } @@ -28,8 +13,14 @@ args="--prefix=/usr \ --libdir=$(libdir /usr/lib) \ --with-rootlibdir=$(libdir /lib) \ --libexecdir=/lib/udev \ ---with-systemdsystemunitdir=/lib/systemd/system +--with-systemdsystemunitdir=/lib/systemd/system \ --with-selinux \ --enable-gtk-doc" -./configure $args CFLAGS="${CFLAGS} ${MYCFLAGS}" $@ +echo +echo "---------------------------------------------------------------------" +echo "Initialized udev build system. For a common configuration please run:" +echo "---------------------------------------------------------------------" +echo +echo "# ./configure $args" +echo diff --git a/configure.ac b/configure.ac index abfcb361dd..b8595664b6 100644 --- a/configure.ac +++ b/configure.ac @@ -201,6 +201,14 @@ AC_ARG_ENABLE([edd], [], [enable_edd=no]) AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = "xyes"]) +my_CFLAGS="-Wall \ +-Wmissing-declarations -Wmissing-prototypes \ +-Wnested-externs -Wpointer-arith \ +-Wpointer-arith -Wsign-compare -Wchar-subscripts \ +-Wstrict-prototypes -Wshadow \ +-Wformat-security -Wtype-limits" +AC_SUBST([my_CFLAGS]) + AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile -- cgit v1.2.3-54-g00ecf From b45ce692de0372957f41a74ba274cec2661487be Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 18:19:18 +0100 Subject: builtin: kmod - link against libkmod --- Makefile.am | 2 +- configure.ac | 4 +- udev/udev-builtin-kmod.c | 318 ++++++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 302 insertions(+), 22 deletions(-) diff --git a/Makefile.am b/Makefile.am index 47ed3ccc48..8c4ea4b0fb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -214,7 +214,7 @@ udev_common_CFLAGS = \ udev_common_LDADD = \ libudev/libudev-private.la \ $(BLKID_LIBS) \ - $(BLKID_KMOD) + $(KMOD_LIBS) udev_udevd_SOURCES = \ $(udev_common_sources) \ diff --git a/configure.ac b/configure.ac index b8595664b6..723c0cbc0f 100644 --- a/configure.ac +++ b/configure.ac @@ -20,6 +20,8 @@ AC_PREFIX_DEFAULT([/usr]) AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not found])]) +PKG_CHECK_MODULES(BLKID, blkid >= 2.20) +PKG_CHECK_MODULES(KMOD, libkmod >= 2) AC_ARG_WITH([rootlibdir], AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), @@ -73,8 +75,6 @@ AC_ARG_WITH([systemdsystemunitdir], AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) ]) AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ]) -PKG_CHECK_MODULES(BLKID, blkid >= 2.20) - # ------------------------------------------------------------------------------ # GUdev - libudev gobject interface # ------------------------------------------------------------------------------ diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index a84f08cf93..831f46ebc0 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -26,37 +26,311 @@ #include #include #include +#include #include "udev.h" +static struct kmod_ctx *ctx; + +static int command_do(struct kmod_module *module, const char *type, const char *command, const char *cmdline_opts) +{ + const char *modname = kmod_module_get_name(module); + char *p, *cmd = NULL; + size_t cmdlen, cmdline_opts_len, varlen; + int ret = 0; + + if (cmdline_opts == NULL) + cmdline_opts = ""; + cmdline_opts_len = strlen(cmdline_opts); + + cmd = strdup(command); + if (cmd == NULL) + return -ENOMEM; + cmdlen = strlen(cmd); + varlen = sizeof("$CMDLINE_OPTS") - 1; + while ((p = strstr(cmd, "$CMDLINE_OPTS")) != NULL) { + size_t prefixlen = p - cmd; + size_t suffixlen = cmdlen - prefixlen - varlen; + size_t slen = cmdlen - varlen + cmdline_opts_len; + char *suffix = p + varlen; + char *s = malloc(slen + 1); + if (s == NULL) { + free(cmd); + return -ENOMEM; + } + memcpy(s, cmd, p - cmd); + memcpy(s + prefixlen, cmdline_opts, cmdline_opts_len); + memcpy(s + prefixlen + cmdline_opts_len, suffix, suffixlen); + s[slen] = '\0'; + + free(cmd); + cmd = s; + cmdlen = slen; + } + + setenv("MODPROBE_MODULE", modname, 1); + ret = system(cmd); + unsetenv("MODPROBE_MODULE"); + if (ret == -1 || WEXITSTATUS(ret)) { + //LOG("Error running %s command for %s\n", type, modname); + if (ret != -1) + ret = -WEXITSTATUS(ret); + } + +end: + free(cmd); + return ret; +} + +static int insmod_do_dependencies(struct kmod_module *parent); +static int insmod_do_soft_dependencies(struct kmod_module *mod, struct kmod_list *deps); + +static int insmod_do_deps_list(struct kmod_module *parent, struct kmod_list *deps, unsigned stop_on_errors) +{ + struct kmod_list *d; + int err = 0; + + kmod_list_foreach(d, deps) { + struct kmod_module *dm = kmod_module_get_module(d); + struct kmod_list *pre = NULL, *post = NULL; + const char *cmd, *opts, *dmname = kmod_module_get_name(dm); + int state; + int r; + + r = insmod_do_dependencies(dm); + if (r < 0) { + //WRN("could not insert dependencies of '%s': %s\n", dmname, strerror(-r)); + goto dep_error; + } + + r = kmod_module_get_softdeps(dm, &pre, &post); + if (r < 0) { + //WRN("could not get softdeps of '%s': %s\n", dmname, strerror(-r)); + goto dep_done; + } + + r = insmod_do_soft_dependencies(dm, pre); + if (r < 0) { + //WRN("could not insert pre softdeps of '%s': %s\n", dmname, strerror(-r)); + goto dep_error; + } + + state = kmod_module_get_initstate(dm); + if (state == KMOD_MODULE_LIVE || + state == KMOD_MODULE_COMING || + state == KMOD_MODULE_BUILTIN) + goto dep_done; + + cmd = kmod_module_get_install_commands(dm); + if (cmd) { + r = command_do(dm, "install", cmd, NULL); + if (r < 0) { + //WRN("failed to execute install command of '%s':" " %s\n", dmname, strerror(-r)); + goto dep_error; + } else + goto dep_done; + } + + opts = kmod_module_get_options(dm); + + r = kmod_module_insert_module(dm, 0, opts); + if (r < 0) { + //WRN("could not insert '%s': %s\n", dmname, strerror(-r)); + goto dep_error; + } + + dep_done: + r = insmod_do_soft_dependencies(dm, post); + if (r < 0) { + //WRN("could not insert post softdeps of '%s': %s\n", dmname, strerror(-r)); + goto dep_error; + } + + kmod_module_unref_list(pre); + kmod_module_unref_list(post); + kmod_module_unref(dm); + continue; + + dep_error: + err = r; + kmod_module_unref_list(pre); + kmod_module_unref_list(post); + kmod_module_unref(dm); + if (stop_on_errors) + break; + else + continue; + } + + return err; +} + +static int insmod_do_soft_dependencies(struct kmod_module *mod, struct kmod_list *deps) +{ + return insmod_do_deps_list(mod, deps, 0); +} + +static int insmod_do_dependencies(struct kmod_module *parent) +{ + struct kmod_list *deps = kmod_module_get_dependencies(parent); + int err = insmod_do_deps_list(parent, deps, 1); + kmod_module_unref_list(deps); + return err; +} + +static int insmod_do(struct kmod_module *mod, const char *extra_opts) +{ + const char *modname = kmod_module_get_name(mod); + const char *conf_opts = kmod_module_get_options(mod); + struct kmod_list *pre = NULL, *post = NULL; + char *opts = NULL; + const char *cmd; + int state; + int err; + + err = kmod_module_get_softdeps(mod, &pre, &post); + if (err < 0) { + //WRN("could not get softdeps of '%s': %s\n", modname, strerror(-err)); + return err; + } + + err = insmod_do_soft_dependencies(mod, pre); + if (err < 0) { + //WRN("could not insert pre softdeps of '%s': %s\n", modname, strerror(-err)); + goto error; + } + + cmd = kmod_module_get_install_commands(mod); + if (cmd != NULL) { + err = command_do(mod, "install", cmd, extra_opts); + goto done; + } + + state = kmod_module_get_initstate(mod); + if (state == KMOD_MODULE_BUILTIN || state == KMOD_MODULE_LIVE) + return 0; + + /* + * At this point it's not possible to be a install/remove command + * anymore. So if we can't get module's path, it's because it was + * really intended to be a module and it doesn't exist + */ + if (kmod_module_get_path(mod) == NULL) { + //LOG("Module %s not found.\n", modname); + return -ENOENT; + } + + err = insmod_do_dependencies(mod); + if (err < 0) + return err; + + if (conf_opts || extra_opts) { + if (conf_opts == NULL) + opts = strdup(extra_opts); + else if (extra_opts == NULL) + opts = strdup(conf_opts); + else if (asprintf(&opts, "%s %s", conf_opts, extra_opts) < 0) + opts = NULL; + + if (opts == NULL) { + err = -ENOMEM; + goto error; + } + } + + err = kmod_module_insert_module(mod, 0, opts); + if (err == -EEXIST) + err = 0; + +done: + err = insmod_do_soft_dependencies(mod, post); + if (err < 0) { + //WRN("could not insert post softdeps of '%s': %s\n", modname, strerror(-err)); + goto error; + } + +error: + kmod_module_unref_list(pre); + kmod_module_unref_list(post); + free(opts); + return err; +} + +static int insmod_path(struct kmod_ctx *ctx, const char *path, const char *extra_options) +{ + struct kmod_module *mod; + int err; + + err = kmod_module_new_from_path(ctx, path, &mod); + if (err < 0) { + //LOG("Module %s not found.\n", path); + return err; + } + err = insmod_do(mod, extra_options); + kmod_module_unref(mod); + return err; +} + +static int insmod_alias(struct kmod_ctx *ctx, const char *alias, const char *extra_options) +{ + struct kmod_list *l, *list = NULL; + struct kmod_list *filtered = NULL; + int err; + + err = kmod_module_new_from_lookup(ctx, alias, &list); + if (err < 0) + return err; + + if (list == NULL) { + //LOG("Module %s not found.\n", alias); + return err; + } + + err = kmod_module_get_filtered_blacklist(ctx, list, &filtered); + kmod_module_unref_list(list); + if (err < 0) { + //LOG("Could not filter alias list!\n"); + return err; + } + list = filtered; + + kmod_list_foreach(l, list) { + struct kmod_module *mod = kmod_module_get_module(l); + err = insmod_do(mod, extra_options); + kmod_module_unref(mod); + if (err < 0) + break; + } + + kmod_module_unref_list(list); + return err; +} + +static int insmod(struct kmod_ctx *ctx, const char *name, const char *extra_options) +{ + struct stat st; + if (stat(name, &st) == 0) + return insmod_path(ctx, name, extra_options); + else + return insmod_alias(ctx, name, extra_options); +} + static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); - pid_t pid; - char *m[5]; + int i; + + if (!ctx) + return EXIT_FAILURE; if (argc < 3) { err(udev, "missing command + argument\n"); return EXIT_FAILURE; } - err(udev, "'%s' the module '%s' (%i)\n", argv[1], argv[2], argc); - - m[0] = "/sbin/modprobe"; - m[1] = "-bv"; - m[1] = argv[2]; - m[2] = argv[3]; - m[3] = NULL; - - pid = fork(); - switch(pid) { - case 0: - execv(m[0], m); - _exit(1); - case -1: - return EXIT_FAILURE; - default: - waitpid(pid, NULL, 0); + for (i = 2; argv[i]; i++) { + info(udev, "%s '%s'\n", argv[1], argv[i]); + insmod(ctx, argv[i], NULL); } return EXIT_SUCCESS; @@ -64,12 +338,18 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te static int builtin_kmod_load(struct udev *udev) { + kmod_unref(ctx); + ctx = kmod_new(NULL, NULL); + if (!ctx) + return -ENOMEM; + info(udev, "load module index\n"); return 0; } static int builtin_kmod_unload(struct udev *udev) { + kmod_unref(ctx); info(udev, "unload module index\n"); return 0; } -- cgit v1.2.3-54-g00ecf From b2ddca8a21e83c52dcbcf538bb61cd470b6fd999 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 23 Dec 2011 18:30:29 +0100 Subject: add copyright --- udev/udev-builtin-kmod.c | 1 + 1 file changed, 1 insertion(+) diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 831f46ebc0..41de2ebc37 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -2,6 +2,7 @@ * load kernel modules * * Copyright (C) 2011 Kay Sievers + * Copyright (C) 2011 ProFUSION embedded systems * * 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 -- cgit v1.2.3-54-g00ecf From f775ccfcf2fadfc1224405b676a8b64d2a19f3ad Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 24 Dec 2011 03:51:05 +0100 Subject: builtin: kmod - reload index when rules are reloaded --- udev/udev-builtin-kmod.c | 2 +- udev/udevd.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 41de2ebc37..10afcd5db0 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -350,7 +350,7 @@ static int builtin_kmod_load(struct udev *udev) static int builtin_kmod_unload(struct udev *udev) { - kmod_unref(ctx); + ctx = kmod_unref(ctx); info(udev, "unload module index\n"); return 0; } diff --git a/udev/udevd.c b/udev/udevd.c index d1f7cd8909..a5ef24417d 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1701,6 +1701,9 @@ int main(int argc, char *argv[]) rules = rules_new; } reload_config = 0; + + udev_builtin_unload(udev); + udev_builtin_load(udev); } } -- cgit v1.2.3-54-g00ecf From 779f4de1b93b77f84527d9916a1af462fc2579a1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 24 Dec 2011 17:58:52 +0100 Subject: builtin: rename load()/unload() to init()/exit() --- udev/udev-builtin-kmod.c | 10 +++++----- udev/udev-builtin.c | 12 ++++++------ udev/udev.h | 4 ++-- udev/udevadm-test-builtin.c | 4 ++-- udev/udevadm-test.c | 4 ++-- udev/udevd.c | 8 ++++---- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 10afcd5db0..8e7a50a020 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -2,7 +2,7 @@ * load kernel modules * * Copyright (C) 2011 Kay Sievers - * Copyright (C) 2011 ProFUSION embedded systems + * Copyright (C) 2011 ProFUSION embedded systems * * 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 @@ -337,7 +337,7 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te return EXIT_SUCCESS; } -static int builtin_kmod_load(struct udev *udev) +static int builtin_kmod_init(struct udev *udev) { kmod_unref(ctx); ctx = kmod_new(NULL, NULL); @@ -348,7 +348,7 @@ static int builtin_kmod_load(struct udev *udev) return 0; } -static int builtin_kmod_unload(struct udev *udev) +static int builtin_kmod_exit(struct udev *udev) { ctx = kmod_unref(ctx); info(udev, "unload module index\n"); @@ -358,8 +358,8 @@ static int builtin_kmod_unload(struct udev *udev) const struct udev_builtin udev_builtin_kmod = { .name = "kmod", .cmd = builtin_kmod, - .load = builtin_kmod_load, - .unload = builtin_kmod_unload, + .init = builtin_kmod_init, + .exit = builtin_kmod_exit, .help = "kernel module loader", .run_once = false, }; diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c index 6dfd006710..baf09b91b9 100644 --- a/udev/udev-builtin.c +++ b/udev/udev-builtin.c @@ -33,23 +33,23 @@ static const struct udev_builtin *builtins[] = { [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, }; -int udev_builtin_load(struct udev *udev) +int udev_builtin_init(struct udev *udev) { unsigned int i; for (i = 0; i < ARRAY_SIZE(builtins); i++) - if (builtins[i]->load) - builtins[i]->load(udev); + if (builtins[i]->init) + builtins[i]->init(udev); return 0; } -int udev_builtin_unload(struct udev *udev) +int udev_builtin_exit(struct udev *udev) { unsigned int i; for (i = 0; i < ARRAY_SIZE(builtins); i++) - if (builtins[i]->unload) - builtins[i]->unload(udev); + if (builtins[i]->exit) + builtins[i]->exit(udev); return 0; } diff --git a/udev/udev.h b/udev/udev.h index aafa15cd31..430958a457 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -159,8 +159,8 @@ struct udev_builtin { const char *name; int (*cmd)(struct udev_device *dev, int argc, char *argv[], bool test); const char *help; - int (*load)(struct udev *udev); - int (*unload)(struct udev *udev); + int (*init)(struct udev *udev); + int (*exit)(struct udev *udev); bool run_once; }; extern const struct udev_builtin udev_builtin_path_id; diff --git a/udev/udevadm-test-builtin.c b/udev/udevadm-test-builtin.c index ea1bcbcb07..66043c76d6 100644 --- a/udev/udevadm-test-builtin.c +++ b/udev/udevadm-test-builtin.c @@ -86,7 +86,7 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) goto out; } - udev_builtin_load(udev); + udev_builtin_init(udev); cmd = udev_builtin_lookup(command); if (cmd >= UDEV_BUILTIN_MAX) { @@ -116,7 +116,7 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) } out: udev_device_unref(dev); - udev_builtin_unload(udev); + udev_builtin_exit(udev); return rc; } diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c index a7c6226a56..851500527f 100644 --- a/udev/udevadm-test.c +++ b/udev/udevadm-test.c @@ -103,7 +103,7 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); - udev_builtin_load(udev); + udev_builtin_init(udev); rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { @@ -161,7 +161,7 @@ out: udev_event_unref(event); udev_device_unref(dev); udev_rules_unref(rules); - udev_builtin_unload(udev); + udev_builtin_exit(udev); return rc; } diff --git a/udev/udevd.c b/udev/udevd.c index a5ef24417d..3a39b6a50a 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1513,7 +1513,7 @@ int main(int argc, char *argv[]) } fd_worker = worker_watch[READ_END]; - udev_builtin_load(udev); + udev_builtin_init(udev); rules = udev_rules_new(udev, resolve_names); if (rules == NULL) { @@ -1702,8 +1702,8 @@ int main(int argc, char *argv[]) } reload_config = 0; - udev_builtin_unload(udev); - udev_builtin_load(udev); + udev_builtin_exit(udev); + udev_builtin_init(udev); } } @@ -1717,7 +1717,7 @@ exit_daemonize: worker_list_cleanup(udev); event_queue_cleanup(udev, EVENT_UNDEF); udev_rules_unref(rules); - udev_builtin_unload(udev); + udev_builtin_exit(udev); if (fd_signal >= 0) close(fd_signal); if (worker_watch[READ_END] >= 0) -- cgit v1.2.3-54-g00ecf From 7c85d636e646a5c2021d1daaab10282f340e0134 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Dec 2011 16:37:15 +0100 Subject: invalidate rules and kmod index with 'udevadm control --reload' - rename --reload-rules to --reload - invalidate rules and databases only, delay parsing to the next event - enable debug output for test-builtin --- udev/udev-builtin-kmod.c | 19 ++++++++++++++----- udev/udev-ctrl.c | 10 +++++----- udev/udev-rules.c | 5 +++-- udev/udev.h | 6 +++--- udev/udevadm-control.c | 9 +++++---- udev/udevadm-test-builtin.c | 1 + udev/udevadm.xml | 9 ++++----- udev/udevd.c | 34 +++++++++++++++------------------- 8 files changed, 50 insertions(+), 43 deletions(-) diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 8e7a50a020..6f3e2589c2 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -321,11 +321,17 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te struct udev *udev = udev_device_get_udev(dev); int i; - if (!ctx) - return EXIT_FAILURE; + if (!ctx) { + ctx = kmod_new(NULL, NULL); + if (!ctx) + return -ENOMEM; - if (argc < 3) { - err(udev, "missing command + argument\n"); + info(udev, "load module index\n"); + kmod_load_resources(ctx); + } + + if (argc < 3 || strcmp(argv[1], "load")) { + err(udev, "expect: %s load \n", argv[0]); return EXIT_FAILURE; } @@ -339,12 +345,15 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te static int builtin_kmod_init(struct udev *udev) { - kmod_unref(ctx); + if (ctx) + return 0; + ctx = kmod_new(NULL, NULL); if (!ctx) return -ENOMEM; info(udev, "load module index\n"); + kmod_load_resources(ctx); return 0; } diff --git a/udev/udev-ctrl.c b/udev/udev-ctrl.c index e4348c314d..fab1108de0 100644 --- a/udev/udev-ctrl.c +++ b/udev/udev-ctrl.c @@ -30,7 +30,7 @@ enum udev_ctrl_msg_type { UDEV_CTRL_SET_LOG_LEVEL, UDEV_CTRL_STOP_EXEC_QUEUE, UDEV_CTRL_START_EXEC_QUEUE, - UDEV_CTRL_RELOAD_RULES, + UDEV_CTRL_RELOAD, UDEV_CTRL_SET_ENV, UDEV_CTRL_SET_CHILDREN_MAX, UDEV_CTRL_PING, @@ -310,9 +310,9 @@ int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); } -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout) +int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_RELOAD_RULES, 0, NULL, timeout); + return ctrl_send(uctrl, UDEV_CTRL_RELOAD, 0, NULL, timeout); } int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) @@ -458,9 +458,9 @@ int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) return -1; } -int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg) +int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD_RULES) + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD) return 1; return -1; } diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 4226d0b4e0..aa750219da 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1890,16 +1890,17 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) return rules; } -void udev_rules_unref(struct udev_rules *rules) +struct udev_rules *udev_rules_unref(struct udev_rules *rules) { if (rules == NULL) - return; + return NULL; free(rules->tokens); free(rules->buf); free(rules->trie_nodes); free(rules->uids); free(rules->gids); free(rules); + return NULL; } static int match_key(struct udev_rules *rules, struct token *token, const char *val) diff --git a/udev/udev.h b/udev/udev.h index 430958a457..7bd2228a6b 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -66,7 +66,7 @@ struct udev_watch { /* udev-rules.c */ struct udev_rules; struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); -void udev_rules_unref(struct udev_rules *rules); +struct udev_rules *udev_rules_unref(struct udev_rules *rules); int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask); void udev_rules_apply_static_dev_perms(struct udev_rules *rules); @@ -109,7 +109,7 @@ int udev_ctrl_get_fd(struct udev_ctrl *uctrl); int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout); int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout); int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_reload_rules(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout); int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout); int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout); int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout); @@ -125,7 +125,7 @@ struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_reload_rules(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg); const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c index 130a71b3d0..dd1d5d783f 100644 --- a/udev/udevadm-control.c +++ b/udev/udevadm-control.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2008 Kay Sievers + * Copyright (C) 2005-2011 Kay Sievers * * 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 @@ -32,9 +32,9 @@ static void print_help(void) printf("Usage: udevadm control COMMAND\n" " --exit instruct the daemon to cleanup and exit\n" " --log-priority= set the udev log level for the daemon\n" - " --stop-exec-queue keep udevd from executing events, queue only\n" + " --stop-exec-queue do not execute events, queue only\n" " --start-exec-queue execute events, flush queue\n" - " --reload-rules reloads the rules files\n" + " --reload reload rules and databases\n" " --property== set a global property for all events\n" " --children-max= maximum number of children\n" " --timeout= maximum time to block for a reply\n" @@ -52,6 +52,7 @@ static int adm_control(struct udev *udev, int argc, char *argv[]) { "log-priority", required_argument, NULL, 'l' }, { "stop-exec-queue", no_argument, NULL, 's' }, { "start-exec-queue", no_argument, NULL, 'S' }, + { "reload", no_argument, NULL, 'R' }, { "reload-rules", no_argument, NULL, 'R' }, { "property", required_argument, NULL, 'p' }, { "env", required_argument, NULL, 'p' }, @@ -111,7 +112,7 @@ static int adm_control(struct udev *udev, int argc, char *argv[]) rc = 0; break; case 'R': - if (udev_ctrl_send_reload_rules(uctrl, timeout) < 0) + if (udev_ctrl_send_reload(uctrl, timeout) < 0) rc = 2; else rc = 0; diff --git a/udev/udevadm-test-builtin.c b/udev/udevadm-test-builtin.c index 66043c76d6..253fcd0c8f 100644 --- a/udev/udevadm-test-builtin.c +++ b/udev/udevadm-test-builtin.c @@ -124,4 +124,5 @@ const struct udevadm_cmd udevadm_test_builtin = { .name = "test-builtin", .cmd = adm_builtin, .help = "test a built-in command", + .debug = true, }; diff --git a/udev/udevadm.xml b/udev/udevadm.xml index 09c22c44b1..455ce80ca9 100644 --- a/udev/udevadm.xml +++ b/udev/udevadm.xml @@ -339,12 +339,11 @@ - + - Signal udevd to reload the rules files. - The udev daemon detects changes automatically, this option is - usually not needed. Reloading rules does not apply any changes - to already existing devices. + Signal udevd to reload the rules files and other databases like the kernel + module index. Reloading rules and databases does not apply any changes to already + existing devices; the new configuration will only be applied to new events. diff --git a/udev/udevd.c b/udev/udevd.c index 3a39b6a50a..299f5d3f59 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -76,7 +76,7 @@ static int fd_signal = -1; static int fd_ep = -1; static int fd_inotify = -1; static bool stop_exec_queue; -static bool reload_config; +static bool reload; static int children; static int children_max; static int exec_delay; @@ -662,9 +662,9 @@ static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) stop_exec_queue = false; } - if (udev_ctrl_get_reload_rules(ctrl_msg) > 0) { - info(udev, "udevd message (RELOAD_RULES) received\n"); - reload_config = true; + if (udev_ctrl_get_reload(ctrl_msg) > 0) { + info(udev, "udevd message (RELOAD) received\n"); + reload = true; } str = udev_ctrl_get_set_env(ctrl_msg); @@ -745,7 +745,7 @@ static int handle_inotify(struct udev *udev) continue; if (strlen(s) != strlen(".rules")) continue; - reload_config = true; + reload = true; continue; } @@ -831,7 +831,7 @@ static void handle_signal(struct udev *udev, int signo) } break; case SIGHUP: - reload_config = true; + reload = true; break; } } @@ -1658,8 +1658,12 @@ int main(int argc, char *argv[]) } /* start new events */ - if (!udev_list_node_is_empty(&event_list) && !udev_exit && !stop_exec_queue) - event_queue_start(udev); + if (!udev_list_node_is_empty(&event_list) && !udev_exit && !stop_exec_queue) { + if (rules == NULL) + rules = udev_rules_new(udev, resolve_names); + if (rules != NULL) + event_queue_start(udev); + } if (is_signal) { struct signalfd_siginfo fdsi; @@ -1691,19 +1695,11 @@ int main(int argc, char *argv[]) ctrl_conn = handle_ctrl_msg(udev_ctrl); /* rules changed, set by inotify or a HUP signal */ - if (reload_config) { - struct udev_rules *rules_new; - + if (reload) { worker_kill(udev, 0); - rules_new = udev_rules_new(udev, resolve_names); - if (rules_new != NULL) { - udev_rules_unref(rules); - rules = rules_new; - } - reload_config = 0; - + rules = udev_rules_unref(rules); udev_builtin_exit(udev); - udev_builtin_init(udev); + reload = 0; } } -- cgit v1.2.3-54-g00ecf From d1c13ddcb3497e0c6a37cd9bd117b74ef010bc15 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Dec 2011 16:52:53 +0100 Subject: update NEWS --- NEWS | 26 ++++++++++++++++---------- TODO | 9 +++------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/NEWS b/NEWS index 6178739d18..f51b811f0d 100644 --- a/NEWS +++ b/NEWS @@ -1,20 +1,26 @@ udev 175 ======== -The default install location moved from /lib/udev to /usr/lib/udev -to support systems without the / vs. /usr split. --libbexecdir= -can still be configured to install things to the rootfs. +The default install location moved from /lib/udev to /usr/lib/udev, +to support systems without the / vs. /usr split. --libexecdir= +can still be configured to install things to /lib/udev. -The udevadm tool moved from /sbin to /usr/bin. Some tools expect -udevadm in 'sbin'. A symlink to udevadm in 'bin' needs to be -manually created if needed. Alternatively --bindir=/sbin installs -udevadm in /sbin. +The default install location of the 'udevadm' tool moved from 'sbin' +to /usr/bin. --bindir= can still be configured to install it in +/sbin. Some tools expect udevadm in 'sbin'. A symlink to udevadm +in /usr/bin needs to be manually created if needed. + +Kernel modules are now loaded directly by linking udev to 'libkmod'. +The /sbin/modprobe tool is no longer executed by udev. + +The /sbin/blkid tool is no longer executed from udev rules. Udev links +directly to libblkid now. + +The 'udevadm control --reload-rules' option has been renamed to '--reload'. +It reloads the kernel module configuration. The systemd socket files use PassCred=yes, which requires systemd version 38. -The blkid tool is no longer called from udev rules. Udev links directly -to libblkid now. - The udev build system only creates a .xz tarball now. udev 175 diff --git a/TODO b/TODO index 661709aad8..32a6b5553b 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ - - move cc opts from autogen to configure.ac + - remove TIMEOUT= handling - move /lib/udev/devices/ to tmpfiles @@ -6,14 +6,12 @@ - test (now fixed) /dev/tape/ links - - move udevadm -> --bindir - - - have a $attrs{} ? - - kill rules_generator - kill tabs? + - have a $attrs{} ? + - deprecate and warn about RUN+="socket:" - libudev.so.1 @@ -21,4 +19,3 @@ - return object with *_unref() - udev_monitor_from_socket() - udev_queue_get_failed_list_entry() - -- cgit v1.2.3-54-g00ecf From 57f4ef67aa4e517e4ee1b79360169f5544f72379 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Dec 2011 17:58:30 +0100 Subject: builtin: firmware - move 'firmware' tool to builtins --- Makefile.am | 25 +++-- NEWS | 5 + extras/firmware/.gitignore | 1 - extras/firmware/50-firmware.rules | 4 - extras/firmware/firmware.c | 192 ------------------------------------ rules/rules.d/50-udev-default.rules | 2 + udev/udev-builtin-kmod.c | 2 +- udev/udev-builtin.c | 7 +- udev/udev.h | 14 +-- 9 files changed, 32 insertions(+), 220 deletions(-) delete mode 100644 extras/firmware/.gitignore delete mode 100644 extras/firmware/50-firmware.rules delete mode 100644 extras/firmware/firmware.c diff --git a/Makefile.am b/Makefile.am index 8c4ea4b0fb..769a6f5001 100644 --- a/Makefile.am +++ b/Makefile.am @@ -201,11 +201,12 @@ udev_common_sources = \ udev/udev-rules.c \ udev/udev-ctrl.c \ udev/udev-builtin.c \ - udev/udev-builtin-path_id.c \ - udev/udev-builtin-usb_id.c \ - udev/udev-builtin-input_id.c \ udev/udev-builtin-blkid.c \ - udev/udev-builtin-kmod.c + udev/udev-builtin-firmware.c \ + udev/udev-builtin-input_id.c \ + udev/udev-builtin-kmod.c \ + udev/udev-builtin-path_id.c \ + udev/udev-builtin-usb_id.c udev_common_CFLAGS = \ $(BLKID_CFLAGS) \ @@ -216,6 +217,10 @@ udev_common_LDADD = \ $(BLKID_LIBS) \ $(KMOD_LIBS) +udev_common_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -DFIRMWARE_PATH="$(FIRMWARE_PATH)" + udev_udevd_SOURCES = \ $(udev_common_sources) \ udev/udevd.c \ @@ -223,6 +228,7 @@ udev_udevd_SOURCES = \ udev/sd-daemon.c udev_udevd_CFLAGS = $(udev_common_CFLAGS) udev_udevd_LDADD = $(udev_common_LDADD) +udev_udevd_CPPFLAGS = $(udev_common_CPPFLAGS) udev_udevadm_SOURCES = \ $(udev_common_sources) \ @@ -236,6 +242,7 @@ udev_udevadm_SOURCES = \ udev/udevadm-test-builtin.c udev_udevadm_CFLAGS = $(udev_common_CFLAGS) udev_udevadm_LDADD = $(udev_common_LDADD) +udev_udevadm_CPPFLAGS = $(udev_common_CPPFLAGS) # ------------------------------------------------------------------------------ # udev man pages @@ -278,15 +285,7 @@ udev_test_udev_SOURCES = \ udev/test-udev.c udev_test_udev_CFLAGS = $(udev_common_CFLAGS) udev_test_udev_LDADD = $(udev_common_LDADD) - -# ------------------------------------------------------------------------------ -# firmware - firmware loading -# ------------------------------------------------------------------------------ -extras_firmware_firmware_SOURCES = extras/firmware/firmware.c -extras_firmware_firmware_LDADD = libudev/libudev-private.la -extras_firmware_firmware_CPPFLAGS = $(AM_CPPFLAGS) -DFIRMWARE_PATH="$(FIRMWARE_PATH)" -dist_udevrules_DATA += extras/firmware/50-firmware.rules -libexec_PROGRAMS += extras/firmware/firmware +udev_test_udev_CPPFLAGS = $(udev_common_CPPFLAGS) # ------------------------------------------------------------------------------ # ata_id - ATA identify diff --git a/NEWS b/NEWS index f51b811f0d..11b3883155 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,11 @@ The /sbin/modprobe tool is no longer executed by udev. The /sbin/blkid tool is no longer executed from udev rules. Udev links directly to libblkid now. +Firmware is loaded natively by udev now, the external firmware loading +binary is no longer used. + +All built-in tools can be listed and tested with 'udevadm test-builtin'. + The 'udevadm control --reload-rules' option has been renamed to '--reload'. It reloads the kernel module configuration. diff --git a/extras/firmware/.gitignore b/extras/firmware/.gitignore deleted file mode 100644 index 2b8800bd46..0000000000 --- a/extras/firmware/.gitignore +++ /dev/null @@ -1 +0,0 @@ -firmware diff --git a/extras/firmware/50-firmware.rules b/extras/firmware/50-firmware.rules deleted file mode 100644 index a193adbced..0000000000 --- a/extras/firmware/50-firmware.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# firmware-class requests, copies files into the kernel -SUBSYSTEM=="firmware", ACTION=="add", RUN+="firmware --firmware=$env{FIRMWARE} --devpath=$env{DEVPATH}" diff --git a/extras/firmware/firmware.c b/extras/firmware/firmware.c deleted file mode 100644 index 36ce79054c..0000000000 --- a/extras/firmware/firmware.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - * firmware - Load firmware device - * - * Copyright (C) 2009 Piter Punk - * Copyright (C) 2009 Kay Sievers - * - * 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; either version 2 of the - * License, or (at your option) any later version. - * - * 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:* - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "libudev-private.h" - -static bool set_loading(struct udev *udev, char *loadpath, const char *state) -{ - FILE *ldfile; - - ldfile = fopen(loadpath, "w"); - if (ldfile == NULL) { - err(udev, "error: can not open '%s'\n", loadpath); - return false; - }; - fprintf(ldfile, "%s\n", state); - fclose(ldfile); - return true; -} - -static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) -{ - char *buf; - FILE *fsource = NULL, *ftarget = NULL; - bool ret = false; - - buf = malloc(size); - if (buf == NULL) { - err(udev,"No memory available to load firmware file"); - return false; - } - - fsource = fopen(source, "r"); - if (fsource == NULL) - goto exit; - ftarget = fopen(target, "w"); - if (ftarget == NULL) - goto exit; - if (fread(buf, size, 1, fsource) != 1) - goto exit; - if (fwrite(buf, size, 1, ftarget) == 1) - ret = true; -exit: - if (ftarget != NULL) - fclose(ftarget); - if (fsource != NULL) - fclose(fsource); - free(buf); - return ret; -} - -int main(int argc, char **argv) -{ - static const struct option options[] = { - { "firmware", required_argument, NULL, 'f' }, - { "devpath", required_argument, NULL, 'p' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - static const char *searchpath[] = { FIRMWARE_PATH }; - char fwencpath[UTIL_PATH_SIZE]; - char misspath[UTIL_PATH_SIZE]; - char loadpath[UTIL_PATH_SIZE]; - char datapath[UTIL_PATH_SIZE]; - char fwpath[UTIL_PATH_SIZE]; - char *devpath = NULL; - char *firmware = NULL; - FILE *fwfile; - struct utsname kernel; - struct stat statbuf; - struct udev *udev = NULL; - unsigned int i; - int rc = 0; - - udev_log_init("firmware"); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "f:p:h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'f': - firmware = optarg; - break; - case 'p': - devpath = optarg; - break; - case 'h': - printf("Usage: firmware --firmware= --devpath= [--help]\n\n"); - goto exit; - } - } - - if (devpath == NULL || firmware == NULL) { - fprintf(stderr, "firmware or devpath parameter missing\n\n"); - rc = 1; - goto exit; - } - - udev = udev_new(); - if (udev == NULL) { - rc = 1; - goto exit; - }; - - /* lookup firmware file */ - uname(&kernel); - for (i = 0; i < ARRAY_SIZE(searchpath); i++) { - util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); - dbg(udev, "trying %s\n", fwpath); - fwfile = fopen(fwpath, "r"); - if (fwfile != NULL) - break; - - util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); - dbg(udev, "trying %s\n", fwpath); - fwfile = fopen(fwpath, "r"); - if (fwfile != NULL) - break; - } - - util_path_encode(firmware, fwencpath, sizeof(fwencpath)); - util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL); - util_strscpyl(loadpath, sizeof(loadpath), udev_get_sys_path(udev), devpath, "/loading", NULL); - - if (fwfile == NULL) { - int err; - - /* This link indicates the missing firmware file and the associated device */ - info(udev, "did not find firmware file '%s'\n", firmware); - do { - err = util_create_path(udev, misspath); - if (err != 0 && err != -ENOENT) - break; - err = symlink(devpath, misspath); - if (err != 0) - err = -errno; - } while (err == -ENOENT); - rc = 2; - set_loading(udev, loadpath, "-1"); - goto exit; - } - - if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { - rc = 3; - goto exit; - } - if (unlink(misspath) == 0) - util_delete_path(udev, misspath); - - if (!set_loading(udev, loadpath, "1")) - goto exit; - - util_strscpyl(datapath, sizeof(datapath), udev_get_sys_path(udev), devpath, "/data", NULL); - if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { - err(udev, "error sending firmware '%s' to device\n", firmware); - set_loading(udev, loadpath, "-1"); - rc = 4; - goto exit; - }; - - set_loading(udev, loadpath, "0"); -exit: - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index c47cdeceb1..353e31d8b9 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -103,3 +103,5 @@ SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" KERNEL=="rrom[0-9]*", MODE="0400" + +SUBSYSTEM=="firmware", ACTION=="add", IMPORT{builtin}="firmware" diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 6f3e2589c2..e6c4d95109 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -336,7 +336,7 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te } for (i = 2; argv[i]; i++) { - info(udev, "%s '%s'\n", argv[1], argv[i]); + info(udev, "execute '%s' '%s'\n", argv[1], argv[i]); insmod(ctx, argv[i], NULL); } diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c index baf09b91b9..cf62d57e23 100644 --- a/udev/udev-builtin.c +++ b/udev/udev-builtin.c @@ -26,11 +26,12 @@ #include "udev.h" static const struct udev_builtin *builtins[] = { - [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, - [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, - [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, + [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, + [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, + [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, + [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, }; int udev_builtin_init(struct udev *udev) diff --git a/udev/udev.h b/udev/udev.h index 7bd2228a6b..3327031e87 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -148,11 +148,12 @@ extern const struct udevadm_cmd udevadm_test_builtin; /* built-in commands */ enum udev_builtin_cmd { - UDEV_BUILTIN_PATH_ID, - UDEV_BUILTIN_USB_ID, - UDEV_BUILTIN_INPUT_ID, UDEV_BUILTIN_BLKID, + UDEV_BUILTIN_FIRMWARE, + UDEV_BUILTIN_INPUT_ID, UDEV_BUILTIN_KMOD, + UDEV_BUILTIN_PATH_ID, + UDEV_BUILTIN_USB_ID, UDEV_BUILTIN_MAX }; struct udev_builtin { @@ -163,11 +164,12 @@ struct udev_builtin { int (*exit)(struct udev *udev); bool run_once; }; -extern const struct udev_builtin udev_builtin_path_id; -extern const struct udev_builtin udev_builtin_usb_id; -extern const struct udev_builtin udev_builtin_input_id; extern const struct udev_builtin udev_builtin_blkid; +extern const struct udev_builtin udev_builtin_firmware; +extern const struct udev_builtin udev_builtin_input_id; extern const struct udev_builtin udev_builtin_kmod; +extern const struct udev_builtin udev_builtin_path_id; +extern const struct udev_builtin udev_builtin_usb_id; int udev_builtin_load(struct udev *udev); int udev_builtin_unload(struct udev *udev); enum udev_builtin_cmd udev_builtin_lookup(const char *command); -- cgit v1.2.3-54-g00ecf From 85eaf38c3b2fd70a8b01b72bbdb936c0a5944b3c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Dec 2011 18:10:07 +0100 Subject: builtin: firmware - add missing file --- udev/udev-builtin-firmware.c | 168 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 udev/udev-builtin-firmware.c diff --git a/udev/udev-builtin-firmware.c b/udev/udev-builtin-firmware.c new file mode 100644 index 0000000000..d7921a2693 --- /dev/null +++ b/udev/udev-builtin-firmware.c @@ -0,0 +1,168 @@ +/* + * firmware - Kernel firmware loader + * + * Copyright (C) 2009 Piter Punk + * Copyright (C) 2009-2011 Kay Sievers + * + * 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; either version 2 of the + * License, or (at your option) any later version. + * + * 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:* + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static bool set_loading(struct udev *udev, char *loadpath, const char *state) +{ + FILE *ldfile; + + ldfile = fopen(loadpath, "we"); + if (ldfile == NULL) { + err(udev, "error: can not open '%s'\n", loadpath); + return false; + }; + fprintf(ldfile, "%s\n", state); + fclose(ldfile); + return true; +} + +static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) +{ + char *buf; + FILE *fsource = NULL, *ftarget = NULL; + bool ret = false; + + buf = malloc(size); + if (buf == NULL) { + err(udev,"No memory available to load firmware file"); + return false; + } + + info(udev, "writing '%s' (%zi) to '%s'\n", source, size, target); + + fsource = fopen(source, "re"); + if (fsource == NULL) + goto exit; + ftarget = fopen(target, "we"); + if (ftarget == NULL) + goto exit; + if (fread(buf, size, 1, fsource) != 1) + goto exit; + if (fwrite(buf, size, 1, ftarget) == 1) + ret = true; +exit: + if (ftarget != NULL) + fclose(ftarget); + if (fsource != NULL) + fclose(fsource); + free(buf); + return ret; +} + +static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + static const char *searchpath[] = { FIRMWARE_PATH }; + char fwencpath[UTIL_PATH_SIZE]; + char misspath[UTIL_PATH_SIZE]; + char loadpath[UTIL_PATH_SIZE]; + char datapath[UTIL_PATH_SIZE]; + char fwpath[UTIL_PATH_SIZE]; + const char *firmware; + FILE *fwfile; + struct utsname kernel; + struct stat statbuf; + unsigned int i; + int rc = EXIT_SUCCESS; + + firmware = udev_device_get_property_value(dev, "FIRMWARE"); + if (firmware == NULL) { + err(udev, "firmware parameter missing\n\n"); + rc = EXIT_FAILURE; + goto exit; + } + + /* lookup firmware file */ + uname(&kernel); + for (i = 0; i < ARRAY_SIZE(searchpath); i++) { + util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); + dbg(udev, "trying %s\n", fwpath); + fwfile = fopen(fwpath, "re"); + if (fwfile != NULL) + break; + + util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); + dbg(udev, "trying %s\n", fwpath); + fwfile = fopen(fwpath, "re"); + if (fwfile != NULL) + break; + } + + util_path_encode(firmware, fwencpath, sizeof(fwencpath)); + util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL); + util_strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); + + if (fwfile == NULL) { + int err; + + /* This link indicates the missing firmware file and the associated device */ + info(udev, "did not find firmware file '%s'\n", firmware); + do { + err = util_create_path(udev, misspath); + if (err != 0 && err != -ENOENT) + break; + err = symlink(udev_device_get_devpath(dev), misspath); + if (err != 0) + err = -errno; + } while (err == -ENOENT); + rc = EXIT_FAILURE; + set_loading(udev, loadpath, "-1"); + goto exit; + } + + if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { + rc = EXIT_FAILURE; + goto exit; + } + if (unlink(misspath) == 0) + util_delete_path(udev, misspath); + + if (!set_loading(udev, loadpath, "1")) + goto exit; + + util_strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); + if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { + err(udev, "error sending firmware '%s' to device\n", firmware); + set_loading(udev, loadpath, "-1"); + rc = EXIT_FAILURE; + goto exit; + }; + + set_loading(udev, loadpath, "0"); +exit: + if (fwfile) + fclose(fwfile); + return rc; +} + +const struct udev_builtin udev_builtin_firmware = { + .name = "firmware", + .cmd = builtin_firmware, + .help = "kernel firmware loader", + .run_once = true, +}; -- cgit v1.2.3-54-g00ecf From 80df994cc22eb7f98187df9bc2281c7fd7b96af7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Dec 2011 18:59:42 +0100 Subject: builtin: kmod - hook up udev main logging to libkmod --- udev/udev-builtin-kmod.c | 8 ++++++++ udev/udev.h | 35 ++++++++++++++++++++--------------- udev/udevadm.c | 4 ++-- udev/udevd.c | 4 ++-- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index e6c4d95109..f5b41b1ab4 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -316,6 +316,12 @@ static int insmod(struct kmod_ctx *ctx, const char *name, const char *extra_opti return insmod_alias(ctx, name, extra_options); } +static void udev_kmod_log(void *data, int priority, const char *file, int line, + const char *fn, const char *format, va_list args) +{ + udev_main_log(data, priority, file, line, fn, format, args); +} + static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); @@ -327,6 +333,7 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te return -ENOMEM; info(udev, "load module index\n"); + kmod_set_log_fn(ctx, udev_kmod_log, udev); kmod_load_resources(ctx); } @@ -353,6 +360,7 @@ static int builtin_kmod_init(struct udev *udev) return -ENOMEM; info(udev, "load module index\n"); + kmod_set_log_fn(ctx, udev_kmod_log, udev); kmod_load_resources(ctx); return 0; } diff --git a/udev/udev.h b/udev/udev.h index 3327031e87..46dafd68e3 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -131,21 +131,6 @@ int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg); const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); -/* udevadm commands */ -struct udevadm_cmd { - const char *name; - int (*cmd)(struct udev *udev, int argc, char *argv[]); - const char *help; - int debug; -}; -extern const struct udevadm_cmd udevadm_monitor; -extern const struct udevadm_cmd udevadm_info; -extern const struct udevadm_cmd udevadm_control; -extern const struct udevadm_cmd udevadm_trigger; -extern const struct udevadm_cmd udevadm_settle; -extern const struct udevadm_cmd udevadm_test; -extern const struct udevadm_cmd udevadm_test_builtin; - /* built-in commands */ enum udev_builtin_cmd { UDEV_BUILTIN_BLKID, @@ -178,4 +163,24 @@ bool udev_builtin_run_once(enum udev_builtin_cmd cmd); int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test); int udev_builtin_list(struct udev *udev); int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val); + +/* udev logging */ +void udev_main_log(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args); + +/* udevadm commands */ +struct udevadm_cmd { + const char *name; + int (*cmd)(struct udev *udev, int argc, char *argv[]); + const char *help; + int debug; +}; +extern const struct udevadm_cmd udevadm_info; +extern const struct udevadm_cmd udevadm_trigger; +extern const struct udevadm_cmd udevadm_settle; +extern const struct udevadm_cmd udevadm_control; +extern const struct udevadm_cmd udevadm_monitor; +extern const struct udevadm_cmd udevadm_test; +extern const struct udevadm_cmd udevadm_test_builtin; #endif diff --git a/udev/udevadm.c b/udev/udevadm.c index 178981eb3e..5410f00c02 100644 --- a/udev/udevadm.c +++ b/udev/udevadm.c @@ -27,7 +27,7 @@ static bool debug; -static void log_fn(struct udev *udev, int priority, +void udev_main_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) { @@ -113,7 +113,7 @@ int main(int argc, char *argv[]) goto out; udev_log_init("udevadm"); - udev_set_log_fn(udev, log_fn); + udev_set_log_fn(udev, udev_main_log); udev_selinux_init(udev); for (;;) { diff --git a/udev/udevd.c b/udev/udevd.c index 299f5d3f59..37eb4ba4b1 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -49,7 +49,7 @@ static bool debug; -static void log_fn(struct udev *udev, int priority, +void udev_main_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) { @@ -1198,7 +1198,7 @@ int main(int argc, char *argv[]) goto exit; udev_log_init("udevd"); - udev_set_log_fn(udev, log_fn); + udev_set_log_fn(udev, udev_main_log); info(udev, "version %s\n", VERSION); udev_selinux_init(udev); -- cgit v1.2.3-54-g00ecf From dd8a93e0d8d4db1810e8d0bc438c19c97876b810 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Dec 2011 20:41:52 +0100 Subject: make: introduce --with-rootprefix= --- INSTALL | 23 +- Makefile.am | 22 +- NEWS | 22 +- autogen.sh | 8 +- configure.ac | 8 +- extras/keymap/check-keymaps.sh | 2 +- extras/keymap/findkeyboards | 4 +- extras/keymap/keyboard-force-release.sh.in | 2 +- test/.gitignore | 2 + test/rules-test.sh | 2 +- test/udev-test.pl | 1791 ---------------------------- test/udev-test.pl.in | 1791 ++++++++++++++++++++++++++++ udev/test-udev.c | 4 + 13 files changed, 1857 insertions(+), 1824 deletions(-) mode change 100644 => 100755 extras/keymap/keyboard-force-release.sh.in create mode 100644 test/.gitignore delete mode 100755 test/udev-test.pl create mode 100755 test/udev-test.pl.in diff --git a/INSTALL b/INSTALL index 29620005b2..5fa900b190 100644 --- a/INSTALL +++ b/INSTALL @@ -20,26 +20,25 @@ The options used in a RPM spec file look like: The options to install udev in the rootfs instead of /usr, and udevadm in /sbin: - --bindir=/sbin - --libexecdir=/lib/udev - --with-systemdsystemunitdir=/lib/systemd/system - --with-rootlibdir=/lib64 + --prefix=%{_prefix} \ + --with-rootprefix= \ + --sysconfdir=%{_sysconfdir} \ + --bindir=/sbin \ + --libdir=%{_libdir} \ + --with-rootlibdir=/lib64 \ + --libexecdir=/lib/udev \ + --with-systemdsystemunitdir=/lib/systemd/system \ + --with-selinux Some tools expect udevadm in 'sbin'. A symlink to udevadm in 'bin' needs to be manually created if needed. The defined location for scripts and binaries which are called -from rules is /usr/lib/udev/ on all systems and architectures. Any +from rules is (/usr)/lib/udev/ on all systems and architectures. Any other location will break other packages, who rightfully expect -the /usr/lib/udev/ directory, to install their rule helper and udev +the (/usr)/lib/udev/ directory, to install their rule helper and udev rule files. -It is possible to use the /usr/lib/udev/devices/ directory to place -device nodes, directories and symlinks, which are copied to /dev/ -at every bootup. That way, nodes for devices which can not be -detected automatically, or are activated on-demand by opening the -pre-existing device node, will be available. - Default udev rules and persistent device naming rules may be required by other software that depends on the data udev collects from the devices. diff --git a/Makefile.am b/Makefile.am index 769a6f5001..a7f29676a2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -40,9 +40,10 @@ libexec_SCRIPTS = dist_libexec_SCRIPTS = SED_PROCESS = \ -$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ + $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ -e 's,@VERSION\@,$(VERSION),g' \ -e 's,@prefix\@,$(prefix),g' \ + -e 's,@rootprefix\@,$(rootprefix),g' \ -e 's,@exec_prefix\@,$(exec_prefix),g' \ -e 's,@libdir\@,$(libdir),g' \ -e 's,@includedir\@,$(includedir),g' \ @@ -56,11 +57,16 @@ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ %.rules: %.rules.in Makefile $(SED_PROCESS) -%.service: %.service.in +%.service: %.service.in Makefile $(SED_PROCESS) -%.sh: %.sh.in +%.sh: %.sh.in Makefile $(SED_PROCESS) + $(AM_V_GEN)chmod +x $@ + +%.pl: %.pl.in Makefile + $(SED_PROCESS) + $(AM_V_GEN)chmod +x $@ # ------------------------------------------------------------------------------ # libudev @@ -271,7 +277,15 @@ udev/%.html : udev/%.xml # ------------------------------------------------------------------------------ # udev tests # ------------------------------------------------------------------------------ -TESTS = test/udev-test.pl test/rules-test.sh +TESTS = \ + test/udev-test.pl \ + test/rules-test.sh + +EXTRA_DIST += \ + test/udev-test.pl.in + +CLEANFILES += \ + test/udev-test.pl check_PROGRAMS = \ libudev/test-libudev \ diff --git a/NEWS b/NEWS index 11b3883155..b87d372141 100644 --- a/NEWS +++ b/NEWS @@ -1,22 +1,24 @@ udev 175 ======== -The default install location moved from /lib/udev to /usr/lib/udev, -to support systems without the / vs. /usr split. --libexecdir= -can still be configured to install things to /lib/udev. +The default configure options have changed, packages need to be adapted +otherwise udev will be installed in /usr. Example configuration options +are in INSTALL. + +The default prefix moved from / to /usr to support installations without +the historic / vs. /usr split. The default install location of the 'udevadm' tool moved from 'sbin' -to /usr/bin. --bindir= can still be configured to install it in -/sbin. Some tools expect udevadm in 'sbin'. A symlink to udevadm -in /usr/bin needs to be manually created if needed. +to /usr/bin. Some tools expect udevadm in 'sbin'. A symlink to udevadm +needs to be manually created if needed. Kernel modules are now loaded directly by linking udev to 'libkmod'. -The /sbin/modprobe tool is no longer executed by udev. +The 'modprobe' tool is no longer executed by udev. -The /sbin/blkid tool is no longer executed from udev rules. Udev links +The 'blkid' tool is no longer executed from udev rules. Udev links directly to libblkid now. -Firmware is loaded natively by udev now, the external firmware loading -binary is no longer used. +Firmware is loaded natively by udev now, the external 'firmware' binary +is no longer used. All built-in tools can be listed and tested with 'udevadm test-builtin'. diff --git a/autogen.sh b/autogen.sh index 50923f0ab3..683c498025 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,6 @@ -#!/bin/sh -e +#!/usr/bin/env sh + +set -e gtkdocize autoreconf --install --symlink @@ -7,7 +9,9 @@ libdir() { echo $(cd $1/$(gcc -print-multi-os-directory); pwd) } -args="--prefix=/usr \ +args="\ +--prefix=/usr \ +--with-rootprefix= \ --sysconfdir=/etc \ --bindir=/sbin \ --libdir=$(libdir /usr/lib) \ diff --git a/configure.ac b/configure.ac index 723c0cbc0f..a9ba74c1f6 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,11 @@ AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not fo PKG_CHECK_MODULES(BLKID, blkid >= 2.20) PKG_CHECK_MODULES(KMOD, libkmod >= 2) +AC_ARG_WITH([rootprefix], + AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), + [], [with_rootprefix=$prefix]) +AC_SUBST([rootprefix], [$with_rootprefix]) + AC_ARG_WITH([rootlibdir], AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), [], [with_rootlibdir=$libdir]) @@ -56,7 +61,7 @@ AS_IF([test "x$enable_logging" = "xyes"], [ AC_DEFINE(ENABLE_LOGGING, [1], [Syst AC_ARG_WITH(firmware-path, AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), - [], [with_firmware_path="/lib/firmware/updates:/lib/firmware"]) + [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"]) OLD_IFS=$IFS IFS=: for i in $with_firmware_path; do @@ -224,6 +229,7 @@ AC_MSG_RESULT([ ======== prefix: ${prefix} + rootprefix: ${rootprefix} sysconfdir: ${sysconfdir} bindir: ${bindir} libdir: ${libdir} diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh index df18c3f488..350a857171 100755 --- a/extras/keymap/check-keymaps.sh +++ b/extras/keymap/check-keymaps.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # check that all key names in keymaps/* are known in # and that all key maps listed in the rules are valid and present in diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards index 537d163132..eba3737a96 100755 --- a/extras/keymap/findkeyboards +++ b/extras/keymap/findkeyboards @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/usr/bin/env sh # Find "real" keyboard devices and print their device path. # Author: Martin Pitt # @@ -14,6 +14,8 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. +set -e + # returns OK if $1 contains $2 strstr() { [ "${1#*$2*}" != "$1" ] diff --git a/extras/keymap/keyboard-force-release.sh.in b/extras/keymap/keyboard-force-release.sh.in old mode 100644 new mode 100755 index 05dd5da2e0..ce91a154b8 --- a/extras/keymap/keyboard-force-release.sh.in +++ b/extras/keymap/keyboard-force-release.sh.in @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!@rootprefix@/bin/sh -e # read list of scancodes, convert hex to decimal and # append to the atkbd force_release sysfs attribute # $1 sysfs devpath for serioX diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000000..8d662eaf4d --- /dev/null +++ b/test/.gitignore @@ -0,0 +1,2 @@ +udev-test.pl + diff --git a/test/rules-test.sh b/test/rules-test.sh index b98b69aba8..511f05d9ee 100755 --- a/test/rules-test.sh +++ b/test/rules-test.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env sh # Call the udev rule syntax checker on all rules that we ship # # (C) 2010 Canonical Ltd. diff --git a/test/udev-test.pl b/test/udev-test.pl deleted file mode 100755 index c2dc70ef48..0000000000 --- a/test/udev-test.pl +++ /dev/null @@ -1,1791 +0,0 @@ -#!/usr/bin/perl - -# udev test -# -# Provides automated testing of the udev binary. -# The whole test is self contained in this file, except the matching sysfs tree. -# Simply extend the @tests array, to add a new test variant. -# -# Every test is driven by its own temporary config file. -# This program prepares the environment, creates the config and calls udev. -# -# udev parses the rules, looks at the provided sysfs and -# first creates and then removes the device node. -# After creation and removal the result is checked against the -# expected value and the result is printed. -# -# Copyright (C) 2004-2011 Kay Sievers -# Copyright (C) 2004 Leann Ogasawara - -use warnings; -use strict; - -my $PWD = $ENV{PWD}; -my $sysfs = "test/sys/"; -my $udev_bin = "udev/test-udev"; -my $valgrind = 0; -my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; -my $udev_root = "udev-root/"; -my $udev_conf = "udev-test.conf"; -my $udev_rules = "udev-test.rules"; - -my @tests = ( - { - desc => "no rules", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda" , - exp_rem_error => "yes", - rules => < "label test of scsi disc", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , - rules => < "label test of scsi disc", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , - rules => < "label test of scsi disc", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , - rules => < "label test of scsi partition", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of pattern match", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of multiple sysfs files", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of max sysfs files (skip invalid rule)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "catch device by *", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by * - take 2", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by ?", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by character class", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "replace kernel name", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle comment lines in config file (and replace kernel name)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle comment lines in config file with whitespace (and replace kernel name)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle whitespace only lines (and replace kernel name)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "whitespace" , - rules => < "Handle empty lines in config file (and replace kernel name)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle backslashed multi lines in config file (and replace kernel name)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "preserve backslashes, if they are not for a newline", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "aaa", - rules => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "subdirectory handling", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "sub/direct/ory/modem" , - rules => < "parent device name match of scsi partition", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "first_disk5" , - rules => < "test substitution chars", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , - rules => < "import of shell-value file", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "subdir/err/node" , - rules => < "import of shell-value returned from program", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node12345678", - rules => < "sustitution of sysfs value (%s{file})", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "disk-ATA-sda" , - rules => < "program result substitution", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "special-device-5" , - not_exp_name => "not" , - rules => < "program result substitution (newline removal)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "newline_removed" , - rules => < "program result substitution", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "test-0:0:0:0" , - rules => < "program with lots of arguments", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo9" , - rules => < "program with subshell", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "bar9" , - rules => < "program arguments combined with apostrophes", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo7" , - rules => < "characters before the %c{N} substitution", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "my-foo9" , - rules => < "substitute the second to last argument", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "my-foo8" , - rules => < "test substitution by variable name", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", - rules => < "test substitution by variable name 2", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", - rules => < "test substitution by variable name 3", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "850:0:0:05" , - rules => < "test substitution by variable name 4", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "855" , - rules => < "test substitution by variable name 5", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "8550:0:0:0" , - rules => < "non matching SUBSYSTEMS for device with no parent", - subsys => "tty", - devpath => "/devices/virtual/tty/console", - exp_name => "TTY", - rules => < "non matching SUBSYSTEMS", - subsys => "tty", - devpath => "/devices/virtual/tty/console", - exp_name => "TTY" , - rules => < "ATTRS match", - subsys => "tty", - devpath => "/devices/virtual/tty/console", - exp_name => "foo" , - rules => < "ATTR (empty file)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "empty" , - rules => < "ATTR (non-existent file)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "non-existent" , - rules => < "program and bus type match", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0" , - rules => < "sysfs parent hierarchy", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "name test with ! in the name", - subsys => "block", - devpath => "/devices/virtual/block/fake!blockdev0", - exp_name => "is/a/fake/blockdev0" , - rules => < "name test with ! in the name, but no matching rule", - subsys => "block", - devpath => "/devices/virtual/block/fake!blockdev0", - exp_name => "fake/blockdev0" , - exp_rem_error => "yes", - rules => < "KERNELS rule", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS wildcard all", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS wildcard partial", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS wildcard partial 2", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "substitute attr with link target value (first match)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "driver-is-sd", - rules => < "substitute attr with link target value (currently selected device)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "driver-is-ahci", - rules => < "ignore ATTRS attribute whitespace", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ignored", - rules => < "do not ignore ATTRS attribute whitespace", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "matched-with-space", - rules => < "permissions USER=bad GROUP=name", - subsys => "tty", - devpath => "/devices/virtual/tty/tty33", - exp_name => "tty33", - exp_perms => "0:0:0600", - rules => < "permissions OWNER=5000", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "5000::0600", - rules => < "permissions GROUP=100", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => ":100:0660", - rules => < "textual user id", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "nobody::0600", - rules => < "textual group id", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => ":daemon:0660", - rules => < "textual user/group id", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "root:mail:0660", - rules => < "permissions MODE=0777", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "::0777", - rules => < "permissions OWNER=5000 GROUP=100 MODE=0777", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "5000:100:0777", - rules => < "permissions OWNER to 5000", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "5000::", - rules => < "permissions GROUP to 100", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => ":100:0660", - rules => < "permissions MODE to 0060", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "::0060", - rules => < "permissions OWNER, GROUP, MODE", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "5000:100:0777", - rules => < "permissions only rule", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "5000:100:0777", - rules => < "multiple permissions only rule", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "3000:4000:0777", - rules => < "permissions only rule with override at SYMLINK+ rule", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "3000:8000:0777", - rules => < "major/minor number test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_majorminor => "8:0", - rules => < "big major number test", - subsys => "misc", - devpath => "/devices/virtual/misc/misc-fake1", - exp_name => "node", - exp_majorminor => "4095:1", - rules => < "big major and big minor number test", - subsys => "misc", - devpath => "/devices/virtual/misc/misc-fake89999", - exp_name => "node", - exp_majorminor => "4095:89999", - rules => < "multiple symlinks with format char", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "symlink2-ttyACM0", - rules => < "multiple symlinks with a lot of s p a c e s", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "one", - not_exp_name => " ", - rules => < "symlink creation (same directory)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem0", - rules => < "symlink creation (relative link forward)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", - exp_name => "1/2/symlink" , - exp_target => "a/b/node", - exp_rem_error => "yes", - rules => < "symlink creation (relative link back and forward)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", - exp_name => "1/2/c/d/symlink" , - exp_target => "../../a/b/node", - exp_rem_error => "yes", - rules => < "multiple symlinks", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "second-0" , - rules => < "symlink name '.'", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => ".", - exp_add_error => "yes", - exp_rem_error => "yes", - rules => < "symlink node to itself", - subsys => "tty", - devpath => "/devices/virtual/tty/tty0", - exp_name => "link", - exp_add_error => "yes", - exp_rem_error => "yes", - option => "clean", - rules => < "symlink %n substitution", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "symlink0", - rules => < "symlink %k substitution", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "symlink-ttyACM0", - rules => < "symlink %M:%m substitution", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "major-166:0", - rules => < "symlink %b substitution", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "symlink-0:0:0:0", - exp_target => "node", - rules => < "symlink %c substitution", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "test", - rules => < "symlink %c{N} substitution", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "test", - rules => < "symlink %c{N+} substitution", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "this", - rules => < "symlink only rule with %c{N+}", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "test", - rules => < "symlink %s{filename} substitution", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "166:0", - rules => < "program result substitution (numbered part of)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "link1", - rules => < "program result substitution (numbered part of+)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "link4", - rules => < "SUBSYSTEM match test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - rules => < "DRIVERS match test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - rules => < "temporary node creation test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - rules => < "parent node name substitution test sequence 1/2 (keep)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "main_device", - option => "keep", - exp_rem_error => "yes", - rules => < "parent node name substitution test sequence 2/2 (clean)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "main_device-part-1", - option => "clean", - rules => < "udev_root substitution", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "start-udev-root-end", - rules => < "last_rule option", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "last", - rules => < "negation KERNEL!=", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "match", - rules => < "negation SUBSYSTEM!=", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "not-anything", - rules => < "negation PROGRAM!= exit code", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "nonzero-program", - rules => < "test for whitespace between the operator", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test (assign)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test (assign 2 times)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test (assign2)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "part", - rules => < "untrusted string sanitize", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "sane", - rules => < "untrusted string sanitize (don't replace utf8)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "uber", - rules => < "untrusted string sanitize (replace invalid utf8)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "replaced", - rules => < "read sysfs value from parent device", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "serial-354172020305000", - rules => < "match against empty key string", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - rules => < "check ACTION value", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - rules => < "test RUN key remove", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "testsymlink2", - exp_target => "ok2", - rules => < "final assignment", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - exp_perms => "root:tty:0640", - rules => < "final assignment 2", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - exp_perms => "root:tty:0640", - rules => < "env substitution", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node-add-me", - rules => < "reset list to current value", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "three", - not_exp_name => "two", - rules => < "test empty SYMLINK+ (empty override)", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - not_exp_name => "wrong", - rules => < "test multi matches", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches 2", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches 3", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches 4", - subsys => "tty", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "IMPORT parent test sequence 1/2 (keep)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "parent", - option => "keep", - rules => < "IMPORT parent test sequence 2/2 (keep)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "parentenv-parent_right", - option => "clean", - rules => < "GOTO test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "right", - rules => < "GOTO label does not exist", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "right", - rules => < "SYMLINK+ compare test", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "right", - not_exp_name => "wrong", - rules => < "invalid key operation", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "yes", - rules => < "operator chars in attribute", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "yes", - rules => < "overlong comment line", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "yes", - rules => < "magic subsys/kernel lookup", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "00:16:41:e2:8d:ff", - rules => < "TEST absolute path", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "there", - rules => < "TEST subsys/kernel lookup", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "yes", - rules => < "TEST relative path", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "relative", - rules => < "TEST wildcard substitution (find queue/nr_requests)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "found-subdir", - rules => < "TEST MODE=0000", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - exp_perms => "0:0:0000", - exp_rem_error => "yes", - rules => < "TEST PROGRAM feeds OWNER, GROUP, MODE", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - exp_perms => "5000:100:0400", - exp_rem_error => "yes", - rules => < "TEST PROGRAM feeds MODE with overflow", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - exp_perms => "0:0:0440", - exp_rem_error => "yes", - rules => < "magic [subsys/sysname] attribute substitution", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda-8741C4G-end", - exp_perms => "0:0:0600", - rules => < "builtin path_id", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0", - rules => <$udev_rules" || die "unable to create rules file: $udev_rules"; - print CONF $$rules; - close CONF; - - $ENV{ACTION} = $action; - $ENV{SUBSYSTEM} = $subsys; - if ($valgrind > 0) { - system("$udev_bin_valgrind"); - } else { - system("$udev_bin"); - } -} - -my $error = 0; - -sub permissions_test { - my($rules, $uid, $gid, $mode) = @_; - - my $wrong = 0; - my $userid; - my $groupid; - - $rules->{exp_perms} =~ m/^(.*):(.*):(.*)$/; - if ($1 ne "") { - if (defined(getpwnam($1))) { - $userid = int(getpwnam($1)); - } else { - $userid = $1; - } - if ($uid != $userid) { $wrong = 1; } - } - if ($2 ne "") { - if (defined(getgrnam($2))) { - $groupid = int(getgrnam($2)); - } else { - $groupid = $2; - } - if ($gid != $groupid) { $wrong = 1; } - } - if ($3 ne "") { - if (($mode & 07777) != oct($3)) { $wrong = 1; }; - } - if ($wrong == 0) { - print "permissions: ok\n"; - } else { - printf " expected permissions are: %s:%s:%#o\n", $1, $2, oct($3); - printf " created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; - print "permissions: error\n"; - $error++; - sleep(1); - } -} - -sub major_minor_test { - my($rules, $rdev) = @_; - - my $major = ($rdev >> 8) & 0xfff; - my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); - my $wrong = 0; - - $rules->{exp_majorminor} =~ m/^(.*):(.*)$/; - if ($1 ne "") { - if ($major != $1) { $wrong = 1; }; - } - if ($2 ne "") { - if ($minor != $2) { $wrong = 1; }; - } - if ($wrong == 0) { - print "major:minor: ok\n"; - } else { - printf " expected major:minor is: %i:%i\n", $1, $2; - printf " created major:minor is : %i:%i\n", $major, $minor; - print "major:minor: error\n"; - $error++; - sleep(1); - } -} - -sub symlink_test { - my ($rules) = @_; - - my $output = `ls -l $PWD/$udev_root$rules->{exp_name}`; - - if ($output =~ m/(.*)-> (.*)/) { - if ($2 eq $rules->{exp_target}) { - print "symlink: ok\n"; - } else { - print " expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n"; - print " created symlink from: \'$rules->{exp_name}\' to \'$2\'\n"; - print "symlink: error"; - if ($rules->{exp_add_error}) { - print " as expected\n"; - } else { - print "\n"; - $error++; - sleep(1); - } - } - } else { - print " expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n"; - print "symlink: not created"; - if ($rules->{exp_add_error}) { - print " as expected\n"; - } else { - print "\n"; - $error++; - sleep(1); - } - } -} - -sub make_udev_root { - system("rm -rf $udev_root"); - mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; - # setting group and mode of udev_root ensures the tests work - # even if the parent directory has setgid bit enabled. - chown (0, 0, $udev_root) || die "unable to chown $udev_root\n"; - chmod (0755, $udev_root) || die "unable to chmod $udev_root\n"; -} - -sub run_test { - my ($rules, $number) = @_; - - print "TEST $number: $rules->{desc}\n"; - - if ($rules->{exp_target}) { - print "device \'$rules->{devpath}\' expecting link '$rules->{exp_name}' to node \'$rules->{exp_target}\'\n"; - } else { - print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; - } - - - udev("add", $rules->{subsys}, $rules->{devpath}, \$rules->{rules}); - if (defined($rules->{not_exp_name})) { - if ((-e "$PWD/$udev_root$rules->{not_exp_name}") || - (-l "$PWD/$udev_root$rules->{not_exp_name}")) { - print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; - $error++; - sleep(1); - } - } - - if ((-e "$PWD/$udev_root$rules->{exp_name}") || - (-l "$PWD/$udev_root$rules->{exp_name}")) { - - my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, - $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$rules->{exp_name}"); - - if (defined($rules->{exp_perms})) { - permissions_test($rules, $uid, $gid, $mode); - } - if (defined($rules->{exp_majorminor})) { - major_minor_test($rules, $rdev); - } - if (defined($rules->{exp_target})) { - symlink_test($rules); - } - print "add: ok\n"; - } else { - print "add: error"; - if ($rules->{exp_add_error}) { - print " as expected\n"; - } else { - print "\n"; - system("tree $udev_root"); - print "\n"; - $error++; - sleep(1); - } - } - - if (defined($rules->{option}) && $rules->{option} eq "keep") { - print "\n\n"; - return; - } - - udev("remove", $rules->{subsys}, $rules->{devpath}, \$rules->{rules}); - if ((-e "$PWD/$udev_root$rules->{exp_name}") || - (-l "$PWD/$udev_root$rules->{exp_name}")) { - print "remove: error"; - if ($rules->{exp_rem_error}) { - print " as expected\n"; - } else { - print "\n"; - system("tree $udev_root"); - print "\n"; - $error++; - sleep(1); - } - } else { - print "remove: ok\n"; - } - - print "\n"; - - if (defined($rules->{option}) && $rules->{option} eq "clean") { - make_udev_root (); - } - -} - -# only run if we have root permissions -# due to mknod restrictions -if (!($<==0)) { - print "Must have root permissions to run properly.\n"; - exit; -} - -# prepare -make_udev_root(); - -# create config file -open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; -print CONF "udev_root=\"$udev_root\"\n"; -print CONF "udev_run=\"$udev_root/.udev\"\n"; -print CONF "udev_rules=\"$PWD\"\n"; -print CONF "udev_log=\"err\"\n"; -close CONF; - -my $test_num = 1; -my @list; - -foreach my $arg (@ARGV) { - if ($arg =~ m/--valgrind/) { - $valgrind = 1; - printf("using valgrind\n"); - } else { - push(@list, $arg); - } -} - -if ($list[0]) { - foreach my $arg (@list) { - if (defined($tests[$arg-1]->{desc})) { - print "udev-test will run test number $arg:\n\n"; - run_test($tests[$arg-1], $arg); - } else { - print "test does not exist.\n"; - } - } -} else { - # test all - print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; - - foreach my $rules (@tests) { - run_test($rules, $test_num); - $test_num++; - } -} - -print "$error errors occured\n\n"; - -# cleanup -system("rm -rf $udev_root"); -unlink($udev_rules); -unlink($udev_conf); - -if ($error > 0) { - exit(1); -} -exit(0); diff --git a/test/udev-test.pl.in b/test/udev-test.pl.in new file mode 100755 index 0000000000..0befc7b530 --- /dev/null +++ b/test/udev-test.pl.in @@ -0,0 +1,1791 @@ +#!/usr/bin/perl + +# udev test +# +# Provides automated testing of the udev binary. +# The whole test is self contained in this file, except the matching sysfs tree. +# Simply extend the @tests array, to add a new test variant. +# +# Every test is driven by its own temporary config file. +# This program prepares the environment, creates the config and calls udev. +# +# udev parses the rules, looks at the provided sysfs and +# first creates and then removes the device node. +# After creation and removal the result is checked against the +# expected value and the result is printed. +# +# Copyright (C) 2004-2011 Kay Sievers +# Copyright (C) 2004 Leann Ogasawara + +use warnings; +use strict; + +my $PWD = $ENV{PWD}; +my $sysfs = "test/sys/"; +my $udev_bin = "udev/test-udev"; +my $valgrind = 0; +my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; +my $udev_root = "udev-root/"; +my $udev_conf = "udev-test.conf"; +my $udev_rules = "udev-test.rules"; + +my @tests = ( + { + desc => "no rules", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda" , + exp_rem_error => "yes", + rules => < "label test of scsi disc", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi disc", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi disc", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi partition", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "label test of pattern match", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "label test of multiple sysfs files", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "label test of max sysfs files (skip invalid rule)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "catch device by *", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "catch device by * - take 2", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "catch device by ?", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "catch device by character class", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "replace kernel name", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle comment lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle comment lines in config file with whitespace (and replace kernel name)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle whitespace only lines (and replace kernel name)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "whitespace" , + rules => < "Handle empty lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle backslashed multi lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "preserve backslashes, if they are not for a newline", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "aaa", + rules => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "subdirectory handling", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "sub/direct/ory/modem" , + rules => < "parent device name match of scsi partition", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "first_disk5" , + rules => < "test substitution chars", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , + rules => < "import of shell-value file", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "subdir/err/node" , + rules => < "import of shell-value returned from program", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node12345678", + rules => < "sustitution of sysfs value (%s{file})", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "disk-ATA-sda" , + rules => < "program result substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "special-device-5" , + not_exp_name => "not" , + rules => < "program result substitution (newline removal)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "newline_removed" , + rules => < "program result substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "test-0:0:0:0" , + rules => < "program with lots of arguments", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "foo9" , + rules => < "program with subshell", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "bar9" , + rules => < "program arguments combined with apostrophes", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "foo7" , + rules => < "characters before the %c{N} substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "my-foo9" , + rules => < "substitute the second to last argument", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "my-foo8" , + rules => < "test substitution by variable name", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", + rules => < "test substitution by variable name 2", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", + rules => < "test substitution by variable name 3", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "850:0:0:05" , + rules => < "test substitution by variable name 4", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "855" , + rules => < "test substitution by variable name 5", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "8550:0:0:0" , + rules => < "non matching SUBSYSTEMS for device with no parent", + subsys => "tty", + devpath => "/devices/virtual/tty/console", + exp_name => "TTY", + rules => < "non matching SUBSYSTEMS", + subsys => "tty", + devpath => "/devices/virtual/tty/console", + exp_name => "TTY" , + rules => < "ATTRS match", + subsys => "tty", + devpath => "/devices/virtual/tty/console", + exp_name => "foo" , + rules => < "ATTR (empty file)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "empty" , + rules => < "ATTR (non-existent file)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "non-existent" , + rules => < "program and bus type match", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0" , + rules => < "sysfs parent hierarchy", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "name test with ! in the name", + subsys => "block", + devpath => "/devices/virtual/block/fake!blockdev0", + exp_name => "is/a/fake/blockdev0" , + rules => < "name test with ! in the name, but no matching rule", + subsys => "block", + devpath => "/devices/virtual/block/fake!blockdev0", + exp_name => "fake/blockdev0" , + exp_rem_error => "yes", + rules => < "KERNELS rule", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "KERNELS wildcard all", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "KERNELS wildcard partial", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "KERNELS wildcard partial 2", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "substitute attr with link target value (first match)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "driver-is-sd", + rules => < "substitute attr with link target value (currently selected device)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "driver-is-ahci", + rules => < "ignore ATTRS attribute whitespace", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ignored", + rules => < "do not ignore ATTRS attribute whitespace", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "matched-with-space", + rules => < "permissions USER=bad GROUP=name", + subsys => "tty", + devpath => "/devices/virtual/tty/tty33", + exp_name => "tty33", + exp_perms => "0:0:0600", + rules => < "permissions OWNER=5000", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "5000::0600", + rules => < "permissions GROUP=100", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => ":100:0660", + rules => < "textual user id", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "nobody::0600", + rules => < "textual group id", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => ":daemon:0660", + rules => < "textual user/group id", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "root:mail:0660", + rules => < "permissions MODE=0777", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "::0777", + rules => < "permissions OWNER=5000 GROUP=100 MODE=0777", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "5000:100:0777", + rules => < "permissions OWNER to 5000", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "5000::", + rules => < "permissions GROUP to 100", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => ":100:0660", + rules => < "permissions MODE to 0060", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "::0060", + rules => < "permissions OWNER, GROUP, MODE", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "5000:100:0777", + rules => < "permissions only rule", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "5000:100:0777", + rules => < "multiple permissions only rule", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "3000:4000:0777", + rules => < "permissions only rule with override at SYMLINK+ rule", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "3000:8000:0777", + rules => < "major/minor number test", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_majorminor => "8:0", + rules => < "big major number test", + subsys => "misc", + devpath => "/devices/virtual/misc/misc-fake1", + exp_name => "node", + exp_majorminor => "4095:1", + rules => < "big major and big minor number test", + subsys => "misc", + devpath => "/devices/virtual/misc/misc-fake89999", + exp_name => "node", + exp_majorminor => "4095:89999", + rules => < "multiple symlinks with format char", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "symlink2-ttyACM0", + rules => < "multiple symlinks with a lot of s p a c e s", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "one", + not_exp_name => " ", + rules => < "symlink creation (same directory)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem0", + rules => < "symlink creation (relative link forward)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", + exp_name => "1/2/symlink" , + exp_target => "a/b/node", + exp_rem_error => "yes", + rules => < "symlink creation (relative link back and forward)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", + exp_name => "1/2/c/d/symlink" , + exp_target => "../../a/b/node", + exp_rem_error => "yes", + rules => < "multiple symlinks", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "second-0" , + rules => < "symlink name '.'", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => ".", + exp_add_error => "yes", + exp_rem_error => "yes", + rules => < "symlink node to itself", + subsys => "tty", + devpath => "/devices/virtual/tty/tty0", + exp_name => "link", + exp_add_error => "yes", + exp_rem_error => "yes", + option => "clean", + rules => < "symlink %n substitution", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "symlink0", + rules => < "symlink %k substitution", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "symlink-ttyACM0", + rules => < "symlink %M:%m substitution", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "major-166:0", + rules => < "symlink %b substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "symlink-0:0:0:0", + exp_target => "node", + rules => < "symlink %c substitution", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "test", + rules => < "symlink %c{N} substitution", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "test", + rules => < "symlink %c{N+} substitution", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "this", + rules => < "symlink only rule with %c{N+}", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "test", + rules => < "symlink %s{filename} substitution", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "166:0", + rules => < "program result substitution (numbered part of)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "link1", + rules => < "program result substitution (numbered part of+)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "link4", + rules => < "SUBSYSTEM match test", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + rules => < "DRIVERS match test", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + rules => < "temporary node creation test", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + rules => < "parent node name substitution test sequence 1/2 (keep)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "main_device", + option => "keep", + exp_rem_error => "yes", + rules => < "parent node name substitution test sequence 2/2 (clean)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "main_device-part-1", + option => "clean", + rules => < "udev_root substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "start-udev-root-end", + rules => < "last_rule option", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "last", + rules => < "negation KERNEL!=", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "match", + rules => < "negation SUBSYSTEM!=", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "not-anything", + rules => < "negation PROGRAM!= exit code", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "nonzero-program", + rules => < "test for whitespace between the operator", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign 2 times)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign2)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "part", + rules => < "untrusted string sanitize", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "sane", + rules => < "untrusted string sanitize (don't replace utf8)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "uber", + rules => < "untrusted string sanitize (replace invalid utf8)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "replaced", + rules => < "read sysfs value from parent device", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "serial-354172020305000", + rules => < "match against empty key string", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + rules => < "check ACTION value", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + rules => < "test RUN key remove", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "testsymlink2", + exp_target => "ok2", + rules => < "final assignment", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + exp_perms => "root:tty:0640", + rules => < "final assignment 2", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + exp_perms => "root:tty:0640", + rules => < "env substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node-add-me", + rules => < "reset list to current value", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "three", + not_exp_name => "two", + rules => < "test empty SYMLINK+ (empty override)", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + not_exp_name => "wrong", + rules => < "test multi matches", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 2", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 3", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 4", + subsys => "tty", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "IMPORT parent test sequence 1/2 (keep)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "parent", + option => "keep", + rules => < "IMPORT parent test sequence 2/2 (keep)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "parentenv-parent_right", + option => "clean", + rules => < "GOTO test", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + rules => < "GOTO label does not exist", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + rules => < "SYMLINK+ compare test", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + not_exp_name => "wrong", + rules => < "invalid key operation", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "yes", + rules => < "operator chars in attribute", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "yes", + rules => < "overlong comment line", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "yes", + rules => < "magic subsys/kernel lookup", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "00:16:41:e2:8d:ff", + rules => < "TEST absolute path", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "there", + rules => < "TEST subsys/kernel lookup", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "yes", + rules => < "TEST relative path", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "relative", + rules => < "TEST wildcard substitution (find queue/nr_requests)", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "found-subdir", + rules => < "TEST MODE=0000", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda", + exp_perms => "0:0:0000", + exp_rem_error => "yes", + rules => < "TEST PROGRAM feeds OWNER, GROUP, MODE", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda", + exp_perms => "5000:100:0400", + exp_rem_error => "yes", + rules => < "TEST PROGRAM feeds MODE with overflow", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda", + exp_perms => "0:0:0440", + exp_rem_error => "yes", + rules => < "magic [subsys/sysname] attribute substitution", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda-8741C4G-end", + exp_perms => "0:0:0600", + rules => < "builtin path_id", + subsys => "block", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0", + rules => <$udev_rules" || die "unable to create rules file: $udev_rules"; + print CONF $$rules; + close CONF; + + $ENV{ACTION} = $action; + $ENV{SUBSYSTEM} = $subsys; + if ($valgrind > 0) { + system("$udev_bin_valgrind"); + } else { + system("$udev_bin"); + } +} + +my $error = 0; + +sub permissions_test { + my($rules, $uid, $gid, $mode) = @_; + + my $wrong = 0; + my $userid; + my $groupid; + + $rules->{exp_perms} =~ m/^(.*):(.*):(.*)$/; + if ($1 ne "") { + if (defined(getpwnam($1))) { + $userid = int(getpwnam($1)); + } else { + $userid = $1; + } + if ($uid != $userid) { $wrong = 1; } + } + if ($2 ne "") { + if (defined(getgrnam($2))) { + $groupid = int(getgrnam($2)); + } else { + $groupid = $2; + } + if ($gid != $groupid) { $wrong = 1; } + } + if ($3 ne "") { + if (($mode & 07777) != oct($3)) { $wrong = 1; }; + } + if ($wrong == 0) { + print "permissions: ok\n"; + } else { + printf " expected permissions are: %s:%s:%#o\n", $1, $2, oct($3); + printf " created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; + print "permissions: error\n"; + $error++; + sleep(1); + } +} + +sub major_minor_test { + my($rules, $rdev) = @_; + + my $major = ($rdev >> 8) & 0xfff; + my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); + my $wrong = 0; + + $rules->{exp_majorminor} =~ m/^(.*):(.*)$/; + if ($1 ne "") { + if ($major != $1) { $wrong = 1; }; + } + if ($2 ne "") { + if ($minor != $2) { $wrong = 1; }; + } + if ($wrong == 0) { + print "major:minor: ok\n"; + } else { + printf " expected major:minor is: %i:%i\n", $1, $2; + printf " created major:minor is : %i:%i\n", $major, $minor; + print "major:minor: error\n"; + $error++; + sleep(1); + } +} + +sub symlink_test { + my ($rules) = @_; + + my $output = `ls -l $PWD/$udev_root$rules->{exp_name}`; + + if ($output =~ m/(.*)-> (.*)/) { + if ($2 eq $rules->{exp_target}) { + print "symlink: ok\n"; + } else { + print " expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n"; + print " created symlink from: \'$rules->{exp_name}\' to \'$2\'\n"; + print "symlink: error"; + if ($rules->{exp_add_error}) { + print " as expected\n"; + } else { + print "\n"; + $error++; + sleep(1); + } + } + } else { + print " expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n"; + print "symlink: not created"; + if ($rules->{exp_add_error}) { + print " as expected\n"; + } else { + print "\n"; + $error++; + sleep(1); + } + } +} + +sub make_udev_root { + system("rm -rf $udev_root"); + mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; + # setting group and mode of udev_root ensures the tests work + # even if the parent directory has setgid bit enabled. + chown (0, 0, $udev_root) || die "unable to chown $udev_root\n"; + chmod (0755, $udev_root) || die "unable to chmod $udev_root\n"; +} + +sub run_test { + my ($rules, $number) = @_; + + print "TEST $number: $rules->{desc}\n"; + + if ($rules->{exp_target}) { + print "device \'$rules->{devpath}\' expecting link '$rules->{exp_name}' to node \'$rules->{exp_target}\'\n"; + } else { + print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; + } + + + udev("add", $rules->{subsys}, $rules->{devpath}, \$rules->{rules}); + if (defined($rules->{not_exp_name})) { + if ((-e "$PWD/$udev_root$rules->{not_exp_name}") || + (-l "$PWD/$udev_root$rules->{not_exp_name}")) { + print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; + $error++; + sleep(1); + } + } + + if ((-e "$PWD/$udev_root$rules->{exp_name}") || + (-l "$PWD/$udev_root$rules->{exp_name}")) { + + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$rules->{exp_name}"); + + if (defined($rules->{exp_perms})) { + permissions_test($rules, $uid, $gid, $mode); + } + if (defined($rules->{exp_majorminor})) { + major_minor_test($rules, $rdev); + } + if (defined($rules->{exp_target})) { + symlink_test($rules); + } + print "add: ok\n"; + } else { + print "add: error"; + if ($rules->{exp_add_error}) { + print " as expected\n"; + } else { + print "\n"; + system("tree $udev_root"); + print "\n"; + $error++; + sleep(1); + } + } + + if (defined($rules->{option}) && $rules->{option} eq "keep") { + print "\n\n"; + return; + } + + udev("remove", $rules->{subsys}, $rules->{devpath}, \$rules->{rules}); + if ((-e "$PWD/$udev_root$rules->{exp_name}") || + (-l "$PWD/$udev_root$rules->{exp_name}")) { + print "remove: error"; + if ($rules->{exp_rem_error}) { + print " as expected\n"; + } else { + print "\n"; + system("tree $udev_root"); + print "\n"; + $error++; + sleep(1); + } + } else { + print "remove: ok\n"; + } + + print "\n"; + + if (defined($rules->{option}) && $rules->{option} eq "clean") { + make_udev_root (); + } + +} + +# only run if we have root permissions +# due to mknod restrictions +if (!($<==0)) { + print "Must have root permissions to run properly.\n"; + exit; +} + +# prepare +make_udev_root(); + +# create config file +open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; +print CONF "udev_root=\"$udev_root\"\n"; +print CONF "udev_run=\"$udev_root/.udev\"\n"; +print CONF "udev_rules=\"$PWD\"\n"; +print CONF "udev_log=\"err\"\n"; +close CONF; + +my $test_num = 1; +my @list; + +foreach my $arg (@ARGV) { + if ($arg =~ m/--valgrind/) { + $valgrind = 1; + printf("using valgrind\n"); + } else { + push(@list, $arg); + } +} + +if ($list[0]) { + foreach my $arg (@list) { + if (defined($tests[$arg-1]->{desc})) { + print "udev-test will run test number $arg:\n\n"; + run_test($tests[$arg-1], $arg); + } else { + print "test does not exist.\n"; + } + } +} else { + # test all + print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; + + foreach my $rules (@tests) { + run_test($rules, $test_num); + $test_num++; + } +} + +print "$error errors occured\n\n"; + +# cleanup +system("rm -rf $udev_root"); +unlink($udev_rules); +unlink($udev_conf); + +if ($error > 0) { + exit(1); +} +exit(0); diff --git a/udev/test-udev.c b/udev/test-udev.c index 07716897b4..8039459906 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -30,6 +30,10 @@ #include "udev.h" +void udev_main_log(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) {} + int main(int argc, char *argv[]) { struct udev *udev; -- cgit v1.2.3-54-g00ecf From d1aacc0fa997a9757adc923792a6c17753d05084 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 25 Dec 2011 20:48:16 +0100 Subject: update NEWS --- NEWS | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index b87d372141..c01841003c 100644 --- a/NEWS +++ b/NEWS @@ -1,18 +1,16 @@ udev 175 ======== -The default configure options have changed, packages need to be adapted -otherwise udev will be installed in /usr. Example configuration options -are in INSTALL. - -The default prefix moved from / to /usr to support installations without -the historic / vs. /usr split. +The default 'configure' install locations have changed. Packages for systems +with the historic / vs. /usr split need to be adapted, otherwise udev will +be installed in /usr and not work properly. Example configuration options are +in INSTALL. The default install location of the 'udevadm' tool moved from 'sbin' to /usr/bin. Some tools expect udevadm in 'sbin'. A symlink to udevadm needs to be manually created if needed. -Kernel modules are now loaded directly by linking udev to 'libkmod'. -The 'modprobe' tool is no longer executed by udev. +Kernel modules are now loaded directly by linking udev to 'libkmod'. The +'modprobe' tool is no longer executed by udev. The 'blkid' tool is no longer executed from udev rules. Udev links directly to libblkid now. -- cgit v1.2.3-54-g00ecf From 4f1795cca7060030461c8f3429e5a62f143f74a9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 27 Dec 2011 03:49:43 +0100 Subject: move rules dirs to udev context; replace inotify with time-controlled stat() --- NEWS | 3 ++ libudev/libudev-private.h | 5 +- libudev/libudev-util.c | 9 +++- libudev/libudev.c | 80 +++++++++++++++---------------- udev/udev-builtin-kmod.c | 14 +++++- udev/udev-builtin.c | 33 +++++++++---- udev/udev-rules.c | 19 ++------ udev/udev.h | 9 ++-- udev/udevd.c | 120 ++++++++++++++++++++-------------------------- 9 files changed, 146 insertions(+), 146 deletions(-) diff --git a/NEWS b/NEWS index c01841003c..b052257c33 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ udev 175 ======== +A writable /run directory (tmpfs) is required now for a fully functional +udev. + The default 'configure' install locations have changed. Packages for systems with the historic / vs. /usr split need to be adapted, otherwise udev will be installed in /usr and not work properly. Example configuration options are diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index ffc82cbc6d..fed5863988 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -62,9 +62,7 @@ void udev_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, ...) __attribute__((format(printf, 6, 7))); -const char *udev_get_rules_path(struct udev *udev); -const char *udev_get_run_config_path(struct udev *udev); -const char *udev_set_run_path(struct udev *udev, const char *path); +int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *ts_usec[]); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); @@ -195,6 +193,7 @@ uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); int util_resolve_subsys_kernel(struct udev *udev, const char *string, char *result, size_t maxsize, int read_value); +unsigned long long ts_usec(const struct timespec *ts); unsigned long long now_usec(void); /* libudev-selinux-private.c */ diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c index e08349e0fa..5369fe734e 100644 --- a/libudev/libudev-util.c +++ b/libudev/libudev-util.c @@ -552,12 +552,17 @@ uint64_t util_string_bloom64(const char *str) #define USEC_PER_SEC 1000000ULL #define NSEC_PER_USEC 1000ULL +unsigned long long ts_usec(const struct timespec *ts) +{ + return (unsigned long long) ts->tv_sec * USEC_PER_SEC + + (unsigned long long) ts->tv_nsec / NSEC_PER_USEC; +} + unsigned long long now_usec(void) { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) return 0; - return (unsigned long long) ts.tv_sec * USEC_PER_SEC + - (unsigned long long) ts.tv_nsec / NSEC_PER_USEC; + return ts_usec(&ts); } diff --git a/libudev/libudev.c b/libudev/libudev.c index 3b3a8e9af5..93f2d8f1b5 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "libudev.h" #include "libudev-private.h" @@ -42,8 +43,9 @@ struct udev { void *userdata; char *sys_path; char *dev_path; - char *rules_path; - char *run_config_path; + char *rules_path[4]; + unsigned long long rules_path_ts[4]; + int rules_path_count; char *run_path; struct udev_list properties_list; int log_priority; @@ -218,11 +220,12 @@ UDEV_EXPORT struct udev *udev_new(void) continue; } if (strcmp(key, "udev_run") == 0) { - set_value(&udev->run_config_path, val); + set_value(&udev->run_path, val); continue; } if (strcmp(key, "udev_rules") == 0) { - set_value(&udev->rules_path, val); + set_value(&udev->rules_path[0], val); + udev->rules_path_count = 1; continue; } } @@ -255,18 +258,35 @@ UDEV_EXPORT struct udev *udev_new(void) if (set_value(&udev->sys_path, "/sys") == NULL) goto err; - if (udev->run_config_path == NULL) - if (set_value(&udev->run_config_path, "/run/udev") == NULL) + if (udev->run_path == NULL) + if (set_value(&udev->run_path, "/run/udev") == NULL) + goto err; + + if (udev->rules_path[0] == NULL) { + /* /usr/lib/udev -- system rules */ + udev->rules_path[0] = strdup(LIBEXECDIR "/rules.d"); + if (!udev->rules_path[0]) + goto err; + + /* /etc/udev -- local administration rules */ + udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d"); + if (!udev->rules_path[1]) goto err; + /* /run/udev -- runtime rules */ + if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0) + goto err; + + udev->rules_path_count = 3; + } + dbg(udev, "context %p created\n", udev); dbg(udev, "log_priority=%d\n", udev->log_priority); dbg(udev, "config_file='%s'\n", config_file); dbg(udev, "dev_path='%s'\n", udev->dev_path); dbg(udev, "sys_path='%s'\n", udev->sys_path); - dbg(udev, "run_path='%s'\n", udev->run_config_path); - if (udev->rules_path != NULL) - dbg(udev, "rules_path='%s'\n", udev->rules_path); + dbg(udev, "run_path='%s'\n", udev->run_path); + dbg(udev, "rules_path='%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1], udev->rules_path[2]); free(config_file); return udev; err: @@ -310,9 +330,10 @@ UDEV_EXPORT void udev_unref(struct udev *udev) udev_list_cleanup(&udev->properties_list); free(udev->dev_path); free(udev->sys_path); - free(udev->rules_path); + free(udev->rules_path[0]); + free(udev->rules_path[1]); + free(udev->rules_path[2]); free(udev->run_path); - free(udev->run_config_path); dbg(udev, "context %p released\n", udev); free(udev); } @@ -367,9 +388,12 @@ UDEV_EXPORT void udev_set_log_priority(struct udev *udev, int priority) udev_add_property(udev, "UDEV_LOG", num); } -const char *udev_get_rules_path(struct udev *udev) +int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *stamp_usec[]) { - return udev->rules_path; + *path = udev->rules_path; + if (stamp_usec) + *stamp_usec = udev->rules_path_ts; + return udev->rules_path_count; } /** @@ -406,11 +430,6 @@ UDEV_EXPORT const char *udev_get_dev_path(struct udev *udev) return udev->dev_path; } -const char *udev_get_run_config_path(struct udev *udev) -{ - return udev->run_config_path; -} - /** * udev_get_run_path: * @udev: udev library context @@ -421,32 +440,11 @@ const char *udev_get_run_config_path(struct udev *udev) **/ UDEV_EXPORT const char *udev_get_run_path(struct udev *udev) { - if (udev->run_path != NULL) - return udev->run_path; - - /* check if configured path exists */ - if (access(udev->run_config_path, F_OK) < 0) { - char filename[UTIL_PATH_SIZE]; - - /* fall back to /dev/.udev if that exists */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev", NULL); - if (access(filename, F_OK) >= 0) - if (set_value(&udev->run_path, filename) != NULL) - return udev->run_path; - } - - /* use default path */ - set_value(&udev->run_path, udev->run_config_path); - if (udev->run_path == NULL) - return udev->run_config_path; + if (udev == NULL) + return NULL; return udev->run_path; } -const char *udev_set_run_path(struct udev *udev, const char *path) -{ - return set_value(&udev->run_path, path); -} - struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) { if (value == NULL) { diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index f5b41b1ab4..7f2faee261 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -322,6 +322,7 @@ static void udev_kmod_log(void *data, int priority, const char *file, int line, udev_main_log(data, priority, file, line, fn, format, args); } +/* needs to re-instantiate the context after a reload */ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { struct udev *udev = udev_device_get_udev(dev); @@ -350,6 +351,7 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te return EXIT_SUCCESS; } +/* called at udev startup */ static int builtin_kmod_init(struct udev *udev) { if (ctx) @@ -365,11 +367,18 @@ static int builtin_kmod_init(struct udev *udev) return 0; } -static int builtin_kmod_exit(struct udev *udev) +/* called on udev shutdown and reload request */ +static void builtin_kmod_exit(struct udev *udev) { ctx = kmod_unref(ctx); info(udev, "unload module index\n"); - return 0; +} + +/* called every couple of seconds during event activity; 'true' if config has changed */ +static bool builtin_kmod_validate(struct udev *udev) +{ + info(udev, "validate module index\n"); + return false; } const struct udev_builtin udev_builtin_kmod = { @@ -377,6 +386,7 @@ const struct udev_builtin udev_builtin_kmod = { .cmd = builtin_kmod, .init = builtin_kmod_init, .exit = builtin_kmod_exit, + .validate = builtin_kmod_validate, .help = "kernel module loader", .run_once = false, }; diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c index cf62d57e23..9804c50fae 100644 --- a/udev/udev-builtin.c +++ b/udev/udev-builtin.c @@ -37,30 +37,45 @@ static const struct udev_builtin *builtins[] = { int udev_builtin_init(struct udev *udev) { unsigned int i; - - for (i = 0; i < ARRAY_SIZE(builtins); i++) - if (builtins[i]->init) - builtins[i]->init(udev); - return 0; + int err; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) { + if (builtins[i]->init) { + err = builtins[i]->init(udev); + if (err < 0) + break; + } + } + return err; } -int udev_builtin_exit(struct udev *udev) +void udev_builtin_exit(struct udev *udev) { unsigned int i; for (i = 0; i < ARRAY_SIZE(builtins); i++) if (builtins[i]->exit) builtins[i]->exit(udev); - return 0; } -int udev_builtin_list(struct udev *udev) +bool udev_builtin_validate(struct udev *udev) +{ + unsigned int i; + bool change = false; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (builtins[i]->validate) + if (builtins[i]->validate(udev)) + change = true; + return change; +} + +void udev_builtin_list(struct udev *udev) { unsigned int i; for (i = 0; i < ARRAY_SIZE(builtins); i++) fprintf(stderr, " %-12s %s\n", builtins[i]->name, builtins[i]->help); - return 0; } const char *udev_builtin_name(enum udev_builtin_cmd cmd) diff --git a/udev/udev-rules.c b/udev/udev-rules.c index aa750219da..411b9d88eb 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -1750,6 +1750,7 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) struct udev_list file_list; struct udev_list_entry *file_loop; struct token end_token; + char **s; rules = calloc(1, sizeof(struct udev_rules)); if (rules == NULL) @@ -1791,22 +1792,8 @@ struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); rules->trie_nodes_cur = 1; - if (udev_get_rules_path(udev) == NULL) { - char filename[UTIL_PATH_SIZE]; - - /* /usr/lib/udev -- system rules */ - add_matching_files(udev, &file_list, LIBEXECDIR "/rules.d", ".rules"); - - /* /etc/udev -- local administration rules */ - add_matching_files(udev, &file_list, SYSCONFDIR "/udev/rules.d", ".rules"); - - /* /run/udev -- runtime rules */ - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL); - add_matching_files(udev, &file_list, filename, ".rules"); - } else { - /* custom rules files location for testing */ - add_matching_files(udev, &file_list, udev_get_rules_path(udev), ".rules"); - } + for (udev_get_rules_path(udev, &s, NULL); *s != NULL; s++) + add_matching_files(udev, &file_list, *s, ".rules"); /* add all filenames to the string buffer */ udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { diff --git a/udev/udev.h b/udev/udev.h index 46dafd68e3..a289f35c4d 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -146,7 +146,8 @@ struct udev_builtin { int (*cmd)(struct udev_device *dev, int argc, char *argv[], bool test); const char *help; int (*init)(struct udev *udev); - int (*exit)(struct udev *udev); + void (*exit)(struct udev *udev); + bool (*validate)(struct udev *udev); bool run_once; }; extern const struct udev_builtin udev_builtin_blkid; @@ -155,13 +156,13 @@ extern const struct udev_builtin udev_builtin_input_id; extern const struct udev_builtin udev_builtin_kmod; extern const struct udev_builtin udev_builtin_path_id; extern const struct udev_builtin udev_builtin_usb_id; -int udev_builtin_load(struct udev *udev); -int udev_builtin_unload(struct udev *udev); +int udev_builtin_init(struct udev *udev); +void udev_builtin_exit(struct udev *udev); enum udev_builtin_cmd udev_builtin_lookup(const char *command); const char *udev_builtin_name(enum udev_builtin_cmd cmd); bool udev_builtin_run_once(enum udev_builtin_cmd cmd); int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test); -int udev_builtin_list(struct udev *udev); +void udev_builtin_list(struct udev *udev); int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val); /* udev logging */ diff --git a/udev/udevd.c b/udev/udevd.c index 37eb4ba4b1..f810b9431c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -736,19 +736,6 @@ static int handle_inotify(struct udev *udev) struct udev_device *dev; ev = (struct inotify_event *)(buf + pos); - if (ev->len) { - const char *s; - - info(udev, "inotify event: %x for %s\n", ev->mask, ev->name); - s = strstr(ev->name, ".rules"); - if (s == NULL) - continue; - if (strlen(s) != strlen(".rules")) - continue; - reload = true; - continue; - } - dev = udev_watch_lookup(udev, ev->wd); if (dev != NULL) { info(udev, "inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev)); @@ -1169,6 +1156,36 @@ static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) return 0; } +static bool check_rules_timestamp(struct udev *udev) +{ + char **p; + unsigned long long *stamp_usec; + int i, n; + bool changed = false; + + n = udev_get_rules_path(udev, &p, &stamp_usec); + for (i = 0; i < n; i++) { + struct stat stats; + + if (stat(p[i], &stats) < 0) + continue; + + if (stamp_usec[i] == ts_usec(&stats.st_mtim)) + continue; + + /* first check */ + if (stamp_usec[i] != 0) { + info(udev, "reload - timestamp of '%s' changed\n", p[i]); + changed = true; + } + + /* update timestamp */ + stamp_usec[i] = ts_usec(&stats.st_mtim); + } + + return changed; +} + int main(int argc, char *argv[]) { struct udev *udev; @@ -1191,6 +1208,7 @@ int main(int argc, char *argv[]) int fd_worker = -1; struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker; struct udev_ctrl_connection *ctrl_conn = NULL; + char **s; int rc = 1; udev = udev_new(); @@ -1202,31 +1220,6 @@ int main(int argc, char *argv[]) info(udev, "version %s\n", VERSION); udev_selinux_init(udev); - /* make sure, that our runtime dir exists and is writable */ - if (utimensat(AT_FDCWD, udev_get_run_config_path(udev), NULL, 0) < 0) { - /* try to create our own subdirectory, do not create parent directories */ - mkdir(udev_get_run_config_path(udev), 0755); - - if (utimensat(AT_FDCWD, udev_get_run_config_path(udev), NULL, 0) >= 0) { - /* directory seems writable now */ - udev_set_run_path(udev, udev_get_run_config_path(udev)); - } else { - /* fall back to /dev/.udev */ - char filename[UTIL_PATH_SIZE]; - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev", NULL); - if (udev_set_run_path(udev, filename) == NULL) - goto exit; - mkdir(udev_get_run_path(udev), 0755); - err(udev, "error: runtime directory '%s' not writable, for now falling back to '%s'", - udev_get_run_config_path(udev), udev_get_run_path(udev)); - } - } - /* relabel runtime dir only if it resides below /dev */ - if (strncmp(udev_get_run_path(udev), udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) == 0) - udev_selinux_lsetfilecon(udev, udev_get_run_path(udev), 0755); - info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); - for (;;) { int option; @@ -1469,28 +1462,6 @@ int main(int argc, char *argv[]) rc = 4; goto exit; } - - if (udev_get_rules_path(udev) != NULL) { - inotify_add_watch(fd_inotify, udev_get_rules_path(udev), - IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - } else { - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; - - inotify_add_watch(fd_inotify, LIBEXECDIR "/rules.d", - IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - inotify_add_watch(fd_inotify, SYSCONFDIR "/udev/rules.d", - IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - - /* watch dynamic rules directory */ - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/rules.d", NULL); - if (stat(filename, &statbuf) != 0) { - util_create_path(udev, filename); - mkdir(filename, 0755); - } - inotify_add_watch(fd_inotify, filename, - IN_DELETE | IN_MOVE | IN_CLOSE_WRITE); - } udev_watch_restore(udev); /* block and listen to all signals on signalfd */ @@ -1575,6 +1546,7 @@ int main(int argc, char *argv[]) udev_list_node_init(&worker_list); for (;;) { + static unsigned long long last_usec; struct epoll_event ev[8]; int fdcount; int timeout; @@ -1642,6 +1614,24 @@ int main(int argc, char *argv[]) is_ctrl = true; } + /* check for changed config, every 3 seconds at most */ + if ((now_usec() - last_usec) > 3 * 1000 * 1000) { + if (check_rules_timestamp(udev)) + reload = true; + if (udev_builtin_validate(udev)) + reload = true; + + last_usec = now_usec(); + } + + /* reload requested, HUP signal received, rules changed, builtin changed */ + if (reload) { + worker_kill(udev, 0); + rules = udev_rules_unref(rules); + udev_builtin_exit(udev); + reload = 0; + } + /* event has finished */ if (is_worker) worker_returned(fd_worker); @@ -1678,7 +1668,7 @@ int main(int argc, char *argv[]) if (udev_exit) continue; - /* device node and rules directory inotify watch */ + /* device node watch */ if (is_inotify) handle_inotify(udev); @@ -1693,14 +1683,6 @@ int main(int argc, char *argv[]) */ if (is_ctrl) ctrl_conn = handle_ctrl_msg(udev_ctrl); - - /* rules changed, set by inotify or a HUP signal */ - if (reload) { - worker_kill(udev, 0); - rules = udev_rules_unref(rules); - udev_builtin_exit(udev); - reload = 0; - } } rc = EXIT_SUCCESS; -- cgit v1.2.3-54-g00ecf From 86a0d004c397d985505c5204fe1fbecb340f6076 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 27 Dec 2011 06:14:59 +0100 Subject: udevd: always create runtime dir kay: udev no longer makes /run/udev on its own? falconindy: added back! --- udev/udevd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/udev/udevd.c b/udev/udevd.c index f810b9431c..c1a4fcfa7c 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -1318,6 +1318,9 @@ int main(int argc, char *argv[]) chdir("/"); umask(022); + /* /run/udev */ + mkdir(udev_get_run_path(udev), 0755); + /* create standard links, copy static nodes, create nodes from modules */ static_dev_create(udev); static_dev_create_from_modules(udev); -- cgit v1.2.3-54-g00ecf From 3cf5266b029c1ec4522edc6b42d874d80407a246 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 27 Dec 2011 17:02:52 +0100 Subject: builtin: move usb-db, pci-db to builtins --- Makefile.am | 26 +--- configure.ac | 78 +++++----- extras/usb-db/.gitignore | 2 - extras/usb-db/usb-db.c | 264 --------------------------------- rules/rules.d/75-net-description.rules | 4 +- rules/rules.d/75-tty-description.rules | 4 +- rules/rules.d/78-sound-card.rules | 4 +- udev/udev-builtin-hwdb.c | 252 +++++++++++++++++++++++++++++++ udev/udev-builtin.c | 2 + udev/udev.h | 4 + 10 files changed, 305 insertions(+), 335 deletions(-) delete mode 100644 extras/usb-db/.gitignore delete mode 100644 extras/usb-db/usb-db.c create mode 100644 udev/udev-builtin-hwdb.c diff --git a/Makefile.am b/Makefile.am index a7f29676a2..d95a3619a9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -151,6 +151,9 @@ dist_udevrules_DATA = \ rules/rules.d/60-persistent-input.rules \ rules/rules.d/60-persistent-alsa.rules \ rules/rules.d/60-persistent-storage.rules \ + rules/rules.d/75-net-description.rules \ + rules/rules.d/75-tty-description.rules \ + rules/rules.d/78-sound-card.rules \ rules/rules.d/80-drivers.rules \ rules/rules.d/95-udev-late.rules @@ -209,6 +212,7 @@ udev_common_sources = \ udev/udev-builtin.c \ udev/udev-builtin-blkid.c \ udev/udev-builtin-firmware.c \ + udev/udev-builtin-hwdb.c \ udev/udev-builtin-input_id.c \ udev/udev-builtin-kmod.c \ udev/udev-builtin-path_id.c \ @@ -225,7 +229,8 @@ udev_common_LDADD = \ udev_common_CPPFLAGS = \ $(AM_CPPFLAGS) \ - -DFIRMWARE_PATH="$(FIRMWARE_PATH)" + -DFIRMWARE_PATH="$(FIRMWARE_PATH)" \ + -DUSB_DATABASE=\"$(USB_DATABASE)\" -DPCI_DATABASE=\"$(PCI_DATABASE)\" udev_udevd_SOURCES = \ $(udev_common_sources) \ @@ -505,25 +510,6 @@ INSTALL_EXEC_HOOKS += libgudev-install-move-hook UNINSTALL_EXEC_HOOKS += libgudev-uninstall-move-hook endif -if ENABLE_HWDB -# ------------------------------------------------------------------------------ -# usb/pci-db - read vendor/device string database -# ------------------------------------------------------------------------------ -extras_usb_db_usb_db_SOURCES = extras/usb-db/usb-db.c -extras_usb_db_usb_db_CPPFLAGS = $(AM_CPPFLAGS) -DUSB_DATABASE=\"$(USB_DATABASE)\" -DBUILD_FOR_USB -extras_usb_db_usb_db_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/usb-db/usb-db -dist_udevrules_DATA += \ - rules/rules.d/75-net-description.rules \ - rules/rules.d/75-tty-description.rules \ - rules/rules.d/78-sound-card.rules - -extras_usb_db_pci_db_SOURCES = extras/usb-db/usb-db.c -extras_usb_db_pci_db_CPPFLAGS = $(AM_CPPFLAGS) -DPCI_DATABASE=\"$(PCI_DATABASE)\" -DBUILD_FOR_PCI -extras_usb_db_pci_db_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/usb-db/pci-db -endif - if ENABLE_KEYMAP # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys diff --git a/configure.ac b/configure.ac index a9ba74c1f6..497a74fc0a 100644 --- a/configure.ac +++ b/configure.ac @@ -20,9 +20,42 @@ AC_PREFIX_DEFAULT([/usr]) AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not found])]) + PKG_CHECK_MODULES(BLKID, blkid >= 2.20) + PKG_CHECK_MODULES(KMOD, libkmod >= 2) +if test "x$cross_compiling" = "xno" ; then + AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) + AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) + AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) +fi + +AC_ARG_WITH(usb-ids-path, + [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])], + [USB_DATABASE=${withval}], + [if test -n "$usbids" ; then + USB_DATABASE="$usbids" + else + PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) + AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) + fi]) +AC_MSG_CHECKING([for USB database location]) +AC_MSG_RESULT([$USB_DATABASE]) +AC_SUBST(USB_DATABASE) + +AC_ARG_WITH(pci-ids-path, + [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], + [PCI_DATABASE=${withval}], + [if test -n "$pciids" ; then + PCI_DATABASE="$pciids" + else + AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) + fi]) +AC_MSG_CHECKING([for PCI database location]) +AC_MSG_RESULT([$PCI_DATABASE]) +AC_SUBST(PCI_DATABASE) + AC_ARG_WITH([rootprefix], AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), [], [with_rootprefix=$prefix]) @@ -103,46 +136,6 @@ AS_IF([test "x$enable_introspection" = "xyes"], [ AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = "xyes"]) AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"]) -# ------------------------------------------------------------------------------ -# usb/pci-db - read vendor/device string database -# ------------------------------------------------------------------------------ -AC_ARG_ENABLE([hwdb], - AS_HELP_STRING([--disable-hwdb], [disable hardware database support @<:@default=enabled@:>@]), - [], [enable_hwdb=yes]) -AS_IF([test "x$enable_hwdb" = "xyes"], [ - if test "x$cross_compiling" = "xno" ; then - AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) - AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) - AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) - fi - - AC_ARG_WITH(usb-ids-path, - [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])], - [USB_DATABASE=${withval}], - [if test -n "$usbids" ; then - USB_DATABASE="$usbids" - else - PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) - AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) - fi]) - AC_MSG_CHECKING([for USB database location]) - AC_MSG_RESULT([$USB_DATABASE]) - AC_SUBST(USB_DATABASE) - - AC_ARG_WITH(pci-ids-path, - [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], - [PCI_DATABASE=${withval}], - [if test -n "$pciids" ; then - PCI_DATABASE="$pciids" - else - AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) - fi]) - AC_MSG_CHECKING([for PCI database location]) - AC_MSG_RESULT([$PCI_DATABASE]) - AC_SUBST(PCI_DATABASE) -]) -AM_CONDITIONAL([ENABLE_HWDB], [test "x$enable_hwdb" = "xyes"]) - # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ @@ -241,6 +234,8 @@ AC_MSG_RESULT([ include_prefix: ${INCLUDE_PREFIX} systemdsystemunitdir: ${systemdsystemunitdir} firmware path: ${FIRMWARE_PATH} + usb.ids: ${USB_DATABASE} + pci.ids: ${PCI_DATABASE} compiler: ${CC} cflags: ${CFLAGS} @@ -255,9 +250,6 @@ AC_MSG_RESULT([ gudev: ${enable_gudev} gintrospection: ${enable_introspection} keymap: ${enable_keymap} - hwdb: ${enable_hwdb} - usb.ids: ${USB_DATABASE} - pci.ids: ${PCI_DATABASE} mtd_probe: ${enable_mtd_probe} rule_generator: ${enable_rule_generator} udev_acl: ${enable_udev_acl} diff --git a/extras/usb-db/.gitignore b/extras/usb-db/.gitignore deleted file mode 100644 index 861a8382a6..0000000000 --- a/extras/usb-db/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -usb-db -pci-db diff --git a/extras/usb-db/usb-db.c b/extras/usb-db/usb-db.c deleted file mode 100644 index fe563c2e75..0000000000 --- a/extras/usb-db/usb-db.c +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright (C) 2009 Lennart Poettering - * - * 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; either version 2 of the - * License, or (at your option) any later version. - * - * 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: - */ - -#include -#include -#include -#include -#include -#include - -#include - -#if defined(BUILD_FOR_USB) -# define DATABASE USB_DATABASE -# define SUBSYSTEM "usb" -# define DEVTYPE "usb_device" -# define VENDOR_ATTR "idVendor" -# define PRODUCT_ATTR "idProduct" -#elif defined(BUILD_FOR_PCI) -# define DATABASE PCI_DATABASE -# define SUBSYSTEM "pci" -# define DEVTYPE NULL -# define VENDOR_ATTR "vendor" -# define PRODUCT_ATTR "device" -#else -# error "Are you havin' a laugh?" -#endif - -static int get_id_attr( - struct udev_device *parent, - const char *name, - uint16_t *value) { - - const char *t; - unsigned u; - - if (!(t = udev_device_get_sysattr_value(parent, name))) { - fprintf(stderr, "%s lacks %s.\n", udev_device_get_syspath(parent), name); - return -1; - } - - if (!strncmp(t, "0x", 2)) - t += 2; - - if (sscanf(t, "%04x", &u) != 1 || u > 0xFFFFU) { - fprintf(stderr, "Failed to parse %s on %s.\n", name, udev_device_get_syspath(parent)); - return -1; - } - - *value = (uint16_t) u; - return 0; -} - -static int get_vid_pid( - struct udev_device *parent, - uint16_t *vid, - uint16_t *pid) { - - if (get_id_attr(parent, VENDOR_ATTR, vid) < 0) - return -1; - else if (*vid <= 0) { - fprintf(stderr, "Invalid vendor id.\n"); - return -1; - } - - if (get_id_attr(parent, PRODUCT_ATTR, pid) < 0) - return -1; - - return 0; -} - -static void rstrip(char *n) { - size_t i; - - for (i = strlen(n); i > 0 && isspace(n[i-1]); i--) - n[i-1] = 0; -} - -#define HEXCHARS "0123456789abcdefABCDEF" -#define WHITESPACE " \t\n\r" - -static int lookup_vid_pid( - uint16_t vid, - uint16_t pid, - char **vendor, - char **product) { - - FILE *f; - int ret = -1; - int found_vendor = 0; - char *line = NULL; - - *vendor = *product = NULL; - - if (!(f = fopen(DATABASE, "r"))) { - fprintf(stderr, "Failed to open database file "DATABASE": %s\n", strerror(errno)); - return -1; - } - - for (;;) { - size_t n; - - if (line) { - free(line); - line = NULL; - } - - if (getline(&line, &n, f) < 0) - break; - - rstrip(line); - - if (line[0] == '#' || line[0] == 0) - continue; - - if (strspn(line, HEXCHARS) == 4) { - unsigned u; - - if (found_vendor) - break; - - if (sscanf(line, "%04x", &u) == 1 && u == vid) { - char *t; - - t = line+4; - t += strspn(t, WHITESPACE); - - if (!(*vendor = strdup(t))) { - fprintf(stderr, "Out of memory.\n"); - goto finish; - } - - found_vendor = 1; - } - - continue; - } - - if (found_vendor && line[0] == '\t' && strspn(line+1, HEXCHARS) == 4) { - unsigned u; - - if (sscanf(line+1, "%04x", &u) == 1 && u == pid) { - char *t; - - t = line+5; - t += strspn(t, WHITESPACE); - - if (!(*product = strdup(t))) { - fprintf(stderr, "Out of memory.\n"); - goto finish; - } - - break; - } - } - } - - ret = 0; - -finish: - free(line); - fclose(f); - - if (ret < 0) { - free(*product); - free(*vendor); - - *product = *vendor = NULL; - } - - return ret; -} - -static struct udev_device *find_device(struct udev_device *dev, const char *subsys, const char *devtype) -{ - const char *str; - - str = udev_device_get_subsystem(dev); - if (str == NULL) - goto try_parent; - if (strcmp(str, subsys) != 0) - goto try_parent; - - if (devtype != NULL) { - str = udev_device_get_devtype(dev); - if (str == NULL) - goto try_parent; - if (strcmp(str, devtype) != 0) - goto try_parent; - } - return dev; -try_parent: - return udev_device_get_parent_with_subsystem_devtype(dev, SUBSYSTEM, DEVTYPE); -} - -int main(int argc, char*argv[]) { - - struct udev *udev = NULL; - int ret = 1; - char *sp; - struct udev_device *dev = NULL, *parent = NULL; - uint16_t vid = 0, pid = 0; - char *vendor = NULL, *product = NULL; - - if (argc < 2) { - fprintf(stderr, "Need to pass sysfs path.\n"); - goto finish; - } - - if (!(udev = udev_new())) - goto finish; - - if (asprintf(&sp, "%s%s", udev_get_sys_path(udev), argv[1]) < 0) { - fprintf(stderr, "Failed to allocate sysfs path.\n"); - goto finish; - } - - dev = udev_device_new_from_syspath(udev, sp); - free(sp); - - if (!dev) { - fprintf(stderr, "Failed to access %s.\n", argv[1]); - goto finish; - } - - parent = find_device(dev, SUBSYSTEM, DEVTYPE); - if (!parent) { - fprintf(stderr, "Failed to find device.\n"); - goto finish; - } - - if (get_vid_pid(parent, &vid, &pid) < 0) - goto finish; - - if (lookup_vid_pid(vid, pid, &vendor, &product) < 0) - goto finish; - - if (vendor) - printf("ID_VENDOR_FROM_DATABASE=%s\n", vendor); - - if (product) - printf("ID_MODEL_FROM_DATABASE=%s\n", product); - - ret = 0; - -finish: - udev_device_unref(dev); - udev_unref(udev); - free(vendor); - free(product); - - return ret; -} diff --git a/rules/rules.d/75-net-description.rules b/rules/rules.d/75-net-description.rules index 0ffce2c348..ce57d48e86 100644 --- a/rules/rules.d/75-net-description.rules +++ b/rules/rules.d/75-net-description.rules @@ -4,11 +4,11 @@ ACTION=="remove", GOTO="net_end" SUBSYSTEM!="net", GOTO="net_end" SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" -SUBSYSTEMS=="usb", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" SUBSYSTEMS=="usb", GOTO="net_end" -SUBSYSTEMS=="pci", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="pci-db %p" +SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" LABEL="net_end" diff --git a/rules/rules.d/75-tty-description.rules b/rules/rules.d/75-tty-description.rules index b67c857dfd..2e63e140cb 100644 --- a/rules/rules.d/75-tty-description.rules +++ b/rules/rules.d/75-tty-description.rules @@ -4,11 +4,11 @@ ACTION=="remove", GOTO="tty_end" SUBSYSTEM!="tty", GOTO="tty_end" SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" -SUBSYSTEMS=="usb", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" SUBSYSTEMS=="usb", GOTO="tty_end" -SUBSYSTEMS=="pci", ENV{ID_MODEL_FROM_DATABASE}=="", IMPORT{program}="pci-db %p" +SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" LABEL="tty_end" diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules index e3a13b598d..cca88f1ec3 100644 --- a/rules/rules.d/78-sound-card.rules +++ b/rules/rules.d/78-sound-card.rules @@ -38,10 +38,10 @@ KERNEL!="card*", GOTO="sound_end" ENV{SOUND_INITIALIZED}="1" SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" -SUBSYSTEMS=="usb", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="usb-db %p" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" SUBSYSTEMS=="usb", GOTO="skip_pci" -SUBSYSTEMS=="pci", ENV{ID_VENDOR_FROM_DATABASE}=="", IMPORT{program}="pci-db %p" +SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" LABEL="skip_pci" diff --git a/udev/udev-builtin-hwdb.c b/udev/udev-builtin-hwdb.c new file mode 100644 index 0000000000..e38c6b9d26 --- /dev/null +++ b/udev/udev-builtin-hwdb.c @@ -0,0 +1,252 @@ +/* + * usb-db, pci-db - lookup vendor/product database + * + * Copyright (C) 2009 Lennart Poettering + * Copyright (C) 2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int get_id_attr( + struct udev_device *parent, + const char *name, + uint16_t *value) { + + const char *t; + unsigned u; + + if (!(t = udev_device_get_sysattr_value(parent, name))) { + fprintf(stderr, "%s lacks %s.\n", udev_device_get_syspath(parent), name); + return -1; + } + + if (!strncmp(t, "0x", 2)) + t += 2; + + if (sscanf(t, "%04x", &u) != 1 || u > 0xFFFFU) { + fprintf(stderr, "Failed to parse %s on %s.\n", name, udev_device_get_syspath(parent)); + return -1; + } + + *value = (uint16_t) u; + return 0; +} + +static int get_vid_pid( + struct udev_device *parent, + const char *vendor_attr, + const char *product_attr, + uint16_t *vid, + uint16_t *pid) { + + if (get_id_attr(parent, vendor_attr, vid) < 0) + return -1; + else if (*vid <= 0) { + fprintf(stderr, "Invalid vendor id.\n"); + return -1; + } + + if (get_id_attr(parent, product_attr, pid) < 0) + return -1; + + return 0; +} + +static void rstrip(char *n) { + size_t i; + + for (i = strlen(n); i > 0 && isspace(n[i-1]); i--) + n[i-1] = 0; +} + +#define HEXCHARS "0123456789abcdefABCDEF" +#define WHITESPACE " \t\n\r" +static int lookup_vid_pid(const char *database, + uint16_t vid, uint16_t pid, + char **vendor, char **product) +{ + + FILE *f; + int ret = -1; + int found_vendor = 0; + char *line = NULL; + + *vendor = *product = NULL; + + if (!(f = fopen(database, "rme"))) { + fprintf(stderr, "Failed to open database file '%s': %s\n", database, strerror(errno)); + return -1; + } + + for (;;) { + size_t n; + + if (line) { + free(line); + line = NULL; + } + + if (getline(&line, &n, f) < 0) + break; + + rstrip(line); + + if (line[0] == '#' || line[0] == 0) + continue; + + if (strspn(line, HEXCHARS) == 4) { + unsigned u; + + if (found_vendor) + break; + + if (sscanf(line, "%04x", &u) == 1 && u == vid) { + char *t; + + t = line+4; + t += strspn(t, WHITESPACE); + + if (!(*vendor = strdup(t))) { + fprintf(stderr, "Out of memory.\n"); + goto finish; + } + + found_vendor = 1; + } + + continue; + } + + if (found_vendor && line[0] == '\t' && strspn(line+1, HEXCHARS) == 4) { + unsigned u; + + if (sscanf(line+1, "%04x", &u) == 1 && u == pid) { + char *t; + + t = line+5; + t += strspn(t, WHITESPACE); + + if (!(*product = strdup(t))) { + fprintf(stderr, "Out of memory.\n"); + goto finish; + } + + break; + } + } + } + + ret = 0; + +finish: + free(line); + fclose(f); + + if (ret < 0) { + free(*product); + free(*vendor); + + *product = *vendor = NULL; + } + + return ret; +} + +static struct udev_device *find_device(struct udev_device *dev, const char *subsys, const char *devtype) +{ + const char *str; + + str = udev_device_get_subsystem(dev); + if (str == NULL) + goto try_parent; + if (strcmp(str, subsys) != 0) + goto try_parent; + + if (devtype != NULL) { + str = udev_device_get_devtype(dev); + if (str == NULL) + goto try_parent; + if (strcmp(str, devtype) != 0) + goto try_parent; + } + return dev; +try_parent: + return udev_device_get_parent_with_subsystem_devtype(dev, subsys, devtype); +} + + +static int builtin_db(struct udev_device *dev, bool test, + const char *database, + const char *vendor_attr, const char *product_attr, + const char *subsys, const char *devtype) +{ + struct udev_device *parent; + uint16_t vid = 0, pid = 0; + char *vendor = NULL, *product = NULL; + + parent = find_device(dev, subsys, devtype); + if (!parent) { + fprintf(stderr, "Failed to find device.\n"); + goto finish; + } + + if (get_vid_pid(parent, vendor_attr, product_attr, &vid, &pid) < 0) + goto finish; + + if (lookup_vid_pid(database, vid, pid, &vendor, &product) < 0) + goto finish; + + if (vendor) + udev_builtin_add_property(dev, test, "ID_VENDOR_FROM_DATABASE", vendor); + if (product) + udev_builtin_add_property(dev, test, "ID_MODEL_FROM_DATABASE", product); + +finish: + free(vendor); + free(product); + return 0; +} + +static int builtin_usb_db(struct udev_device *dev, int argc, char *argv[], bool test) +{ + return builtin_db(dev, test, USB_DATABASE, "idVendor", "idProduct", "usb", "usb_device"); +} + +static int builtin_pci_db(struct udev_device *dev, int argc, char *argv[], bool test) +{ + return builtin_db(dev, test, PCI_DATABASE, "vendor", "device", "pci", NULL); +} + +const struct udev_builtin udev_builtin_usb_db = { + .name = "usb-db", + .cmd = builtin_usb_db, + .help = "USB vendor/product database", + .run_once = true, +}; + +const struct udev_builtin udev_builtin_pci_db = { + .name = "pci-db", + .cmd = builtin_pci_db, + .help = "PCI vendor/product database", + .run_once = true, +}; diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c index 9804c50fae..8beac8a678 100644 --- a/udev/udev-builtin.c +++ b/udev/udev-builtin.c @@ -31,6 +31,8 @@ static const struct udev_builtin *builtins[] = { [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, + [UDEV_BUILTIN_PCI_DB] = &udev_builtin_pci_db, + [UDEV_BUILTIN_USB_DB] = &udev_builtin_usb_db, [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, }; diff --git a/udev/udev.h b/udev/udev.h index a289f35c4d..4f2886c69c 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -138,6 +138,8 @@ enum udev_builtin_cmd { UDEV_BUILTIN_INPUT_ID, UDEV_BUILTIN_KMOD, UDEV_BUILTIN_PATH_ID, + UDEV_BUILTIN_PCI_DB, + UDEV_BUILTIN_USB_DB, UDEV_BUILTIN_USB_ID, UDEV_BUILTIN_MAX }; @@ -155,6 +157,8 @@ extern const struct udev_builtin udev_builtin_firmware; extern const struct udev_builtin udev_builtin_input_id; extern const struct udev_builtin udev_builtin_kmod; extern const struct udev_builtin udev_builtin_path_id; +extern const struct udev_builtin udev_builtin_pci_db; +extern const struct udev_builtin udev_builtin_usb_db; extern const struct udev_builtin udev_builtin_usb_id; int udev_builtin_init(struct udev *udev); void udev_builtin_exit(struct udev *udev); -- cgit v1.2.3-54-g00ecf From fe6784cfd49f864211bddd1ef161125122c1fb18 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 27 Dec 2011 20:17:39 +0100 Subject: builtin: kmod - switch to kmod_module_probe_insert_module() --- udev/udev-builtin-kmod.c | 284 +++-------------------------------------------- 1 file changed, 18 insertions(+), 266 deletions(-) diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index 7f2faee261..a5c76fc214 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -33,289 +33,41 @@ static struct kmod_ctx *ctx; -static int command_do(struct kmod_module *module, const char *type, const char *command, const char *cmdline_opts) +static int load_module(struct udev *udev, const char *alias) { - const char *modname = kmod_module_get_name(module); - char *p, *cmd = NULL; - size_t cmdlen, cmdline_opts_len, varlen; - int ret = 0; - - if (cmdline_opts == NULL) - cmdline_opts = ""; - cmdline_opts_len = strlen(cmdline_opts); - - cmd = strdup(command); - if (cmd == NULL) - return -ENOMEM; - cmdlen = strlen(cmd); - varlen = sizeof("$CMDLINE_OPTS") - 1; - while ((p = strstr(cmd, "$CMDLINE_OPTS")) != NULL) { - size_t prefixlen = p - cmd; - size_t suffixlen = cmdlen - prefixlen - varlen; - size_t slen = cmdlen - varlen + cmdline_opts_len; - char *suffix = p + varlen; - char *s = malloc(slen + 1); - if (s == NULL) { - free(cmd); - return -ENOMEM; - } - memcpy(s, cmd, p - cmd); - memcpy(s + prefixlen, cmdline_opts, cmdline_opts_len); - memcpy(s + prefixlen + cmdline_opts_len, suffix, suffixlen); - s[slen] = '\0'; - - free(cmd); - cmd = s; - cmdlen = slen; - } - - setenv("MODPROBE_MODULE", modname, 1); - ret = system(cmd); - unsetenv("MODPROBE_MODULE"); - if (ret == -1 || WEXITSTATUS(ret)) { - //LOG("Error running %s command for %s\n", type, modname); - if (ret != -1) - ret = -WEXITSTATUS(ret); - } - -end: - free(cmd); - return ret; -} - -static int insmod_do_dependencies(struct kmod_module *parent); -static int insmod_do_soft_dependencies(struct kmod_module *mod, struct kmod_list *deps); - -static int insmod_do_deps_list(struct kmod_module *parent, struct kmod_list *deps, unsigned stop_on_errors) -{ - struct kmod_list *d; - int err = 0; - - kmod_list_foreach(d, deps) { - struct kmod_module *dm = kmod_module_get_module(d); - struct kmod_list *pre = NULL, *post = NULL; - const char *cmd, *opts, *dmname = kmod_module_get_name(dm); - int state; - int r; - - r = insmod_do_dependencies(dm); - if (r < 0) { - //WRN("could not insert dependencies of '%s': %s\n", dmname, strerror(-r)); - goto dep_error; - } - - r = kmod_module_get_softdeps(dm, &pre, &post); - if (r < 0) { - //WRN("could not get softdeps of '%s': %s\n", dmname, strerror(-r)); - goto dep_done; - } - - r = insmod_do_soft_dependencies(dm, pre); - if (r < 0) { - //WRN("could not insert pre softdeps of '%s': %s\n", dmname, strerror(-r)); - goto dep_error; - } - - state = kmod_module_get_initstate(dm); - if (state == KMOD_MODULE_LIVE || - state == KMOD_MODULE_COMING || - state == KMOD_MODULE_BUILTIN) - goto dep_done; - - cmd = kmod_module_get_install_commands(dm); - if (cmd) { - r = command_do(dm, "install", cmd, NULL); - if (r < 0) { - //WRN("failed to execute install command of '%s':" " %s\n", dmname, strerror(-r)); - goto dep_error; - } else - goto dep_done; - } - - opts = kmod_module_get_options(dm); - - r = kmod_module_insert_module(dm, 0, opts); - if (r < 0) { - //WRN("could not insert '%s': %s\n", dmname, strerror(-r)); - goto dep_error; - } - - dep_done: - r = insmod_do_soft_dependencies(dm, post); - if (r < 0) { - //WRN("could not insert post softdeps of '%s': %s\n", dmname, strerror(-r)); - goto dep_error; - } - - kmod_module_unref_list(pre); - kmod_module_unref_list(post); - kmod_module_unref(dm); - continue; - - dep_error: - err = r; - kmod_module_unref_list(pre); - kmod_module_unref_list(post); - kmod_module_unref(dm); - if (stop_on_errors) - break; - else - continue; - } - - return err; -} - -static int insmod_do_soft_dependencies(struct kmod_module *mod, struct kmod_list *deps) -{ - return insmod_do_deps_list(mod, deps, 0); -} - -static int insmod_do_dependencies(struct kmod_module *parent) -{ - struct kmod_list *deps = kmod_module_get_dependencies(parent); - int err = insmod_do_deps_list(parent, deps, 1); - kmod_module_unref_list(deps); - return err; -} - -static int insmod_do(struct kmod_module *mod, const char *extra_opts) -{ - const char *modname = kmod_module_get_name(mod); - const char *conf_opts = kmod_module_get_options(mod); - struct kmod_list *pre = NULL, *post = NULL; - char *opts = NULL; - const char *cmd; - int state; - int err; - - err = kmod_module_get_softdeps(mod, &pre, &post); - if (err < 0) { - //WRN("could not get softdeps of '%s': %s\n", modname, strerror(-err)); - return err; - } - - err = insmod_do_soft_dependencies(mod, pre); - if (err < 0) { - //WRN("could not insert pre softdeps of '%s': %s\n", modname, strerror(-err)); - goto error; - } - - cmd = kmod_module_get_install_commands(mod); - if (cmd != NULL) { - err = command_do(mod, "install", cmd, extra_opts); - goto done; - } - - state = kmod_module_get_initstate(mod); - if (state == KMOD_MODULE_BUILTIN || state == KMOD_MODULE_LIVE) - return 0; - - /* - * At this point it's not possible to be a install/remove command - * anymore. So if we can't get module's path, it's because it was - * really intended to be a module and it doesn't exist - */ - if (kmod_module_get_path(mod) == NULL) { - //LOG("Module %s not found.\n", modname); - return -ENOENT; - } - - err = insmod_do_dependencies(mod); - if (err < 0) - return err; - - if (conf_opts || extra_opts) { - if (conf_opts == NULL) - opts = strdup(extra_opts); - else if (extra_opts == NULL) - opts = strdup(conf_opts); - else if (asprintf(&opts, "%s %s", conf_opts, extra_opts) < 0) - opts = NULL; - - if (opts == NULL) { - err = -ENOMEM; - goto error; - } - } - - err = kmod_module_insert_module(mod, 0, opts); - if (err == -EEXIST) - err = 0; - -done: - err = insmod_do_soft_dependencies(mod, post); - if (err < 0) { - //WRN("could not insert post softdeps of '%s': %s\n", modname, strerror(-err)); - goto error; - } - -error: - kmod_module_unref_list(pre); - kmod_module_unref_list(post); - free(opts); - return err; -} - -static int insmod_path(struct kmod_ctx *ctx, const char *path, const char *extra_options) -{ - struct kmod_module *mod; - int err; - - err = kmod_module_new_from_path(ctx, path, &mod); - if (err < 0) { - //LOG("Module %s not found.\n", path); - return err; - } - err = insmod_do(mod, extra_options); - kmod_module_unref(mod); - return err; -} - -static int insmod_alias(struct kmod_ctx *ctx, const char *alias, const char *extra_options) -{ - struct kmod_list *l, *list = NULL; - struct kmod_list *filtered = NULL; + struct kmod_list *list = NULL; + struct kmod_list *listb = NULL; + struct kmod_list *l; int err; err = kmod_module_new_from_lookup(ctx, alias, &list); if (err < 0) return err; - if (list == NULL) { - //LOG("Module %s not found.\n", alias); + err = kmod_module_get_filtered_blacklist(ctx, list, &listb); + if (err < 0) return err; - } - err = kmod_module_get_filtered_blacklist(ctx, list, &filtered); - kmod_module_unref_list(list); - if (err < 0) { - //LOG("Could not filter alias list!\n"); - return err; - } - list = filtered; + if (list == NULL) + info(udev, "no module matches '%s'\n", alias); - kmod_list_foreach(l, list) { + kmod_list_foreach(l, listb) { struct kmod_module *mod = kmod_module_get_module(l); - err = insmod_do(mod, extra_options); + + err = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL); + if (err >=0 ) + info(udev, "inserted '%s'\n", kmod_module_get_name(mod)); + else + info(udev, "failed to insert '%s'\n", kmod_module_get_name(mod)); + kmod_module_unref(mod); - if (err < 0) - break; } kmod_module_unref_list(list); + kmod_module_unref_list(listb); return err; } -static int insmod(struct kmod_ctx *ctx, const char *name, const char *extra_options) -{ - struct stat st; - if (stat(name, &st) == 0) - return insmod_path(ctx, name, extra_options); - else - return insmod_alias(ctx, name, extra_options); -} - static void udev_kmod_log(void *data, int priority, const char *file, int line, const char *fn, const char *format, va_list args) { @@ -345,7 +97,7 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te for (i = 2; argv[i]; i++) { info(udev, "execute '%s' '%s'\n", argv[1], argv[i]); - insmod(ctx, argv[i], NULL); + load_module(udev, argv[i]); } return EXIT_SUCCESS; -- cgit v1.2.3-54-g00ecf From 43d5c5f03645c4b842659f9b5bd0ae465e885e92 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 28 Dec 2011 01:06:55 +0100 Subject: udevd: remove TIMEOUT= handling http://thread.gmane.org/gmane.linux.hotplug.devel/17206/focus=17211 --- TODO | 2 -- libudev/libudev-device.c | 19 ------------------- libudev/libudev-private.h | 1 - udev/udevd.c | 7 ------- 4 files changed, 29 deletions(-) diff --git a/TODO b/TODO index 32a6b5553b..22a067a4e9 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,3 @@ - - remove TIMEOUT= handling - - move /lib/udev/devices/ to tmpfiles - trigger --subsystem-match=usb/usb_device diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 1024b46803..28df7a2a11 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -69,7 +69,6 @@ struct udev_device { struct udev_list tags_list; unsigned long long int seqnum; unsigned long long int usec_initialized; - int timeout; int devlink_priority; int refcount; dev_t devnum; @@ -162,21 +161,6 @@ static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) return 0; } -int udev_device_get_timeout(struct udev_device *udev_device) -{ - return udev_device->timeout; -} - -static int udev_device_set_timeout(struct udev_device *udev_device, int timeout) -{ - char num[32]; - - udev_device->timeout = timeout; - snprintf(num, sizeof(num), "%u", timeout); - udev_device_add_property(udev_device, "TIMEOUT", num); - return 0; -} - const char *udev_device_get_knodename(struct udev_device *udev_device) { return udev_device->knodename; @@ -451,8 +435,6 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, udev_device_set_devpath_old(udev_device, &property[12]); } else if (strncmp(property, "SEQNUM=", 7) == 0) { udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10)); - } else if (strncmp(property, "TIMEOUT=", 8) == 0) { - udev_device_set_timeout(udev_device, strtoull(&property[8], NULL, 10)); } else if (strncmp(property, "IFINDEX=", 8) == 0) { udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10)); } else if (strncmp(property, "DEVMODE=", 8) == 0) { @@ -635,7 +617,6 @@ struct udev_device *udev_device_new(struct udev *udev) udev_list_init(udev, &udev_device->sysattr_value_list, true); udev_list_init(udev, &udev_device->sysattr_list, false); udev_list_init(udev, &udev_device->tags_list, true); - udev_device->timeout = -1; udev_device->watch_handle = -1; /* copy global properties */ udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index fed5863988..b86f6a8378 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -88,7 +88,6 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device); void udev_device_set_is_initialized(struct udev_device *udev_device); int udev_device_add_tag(struct udev_device *udev_device, const char *tag); void udev_device_cleanup_tags_list(struct udev_device *udev_device); -int udev_device_get_timeout(struct udev_device *udev_device); unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device); void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized); int udev_device_get_devlink_priority(struct udev_device *udev_device); diff --git a/udev/udevd.c b/udev/udevd.c index c1a4fcfa7c..1e12eb38ac 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -457,13 +457,6 @@ static int event_queue_insert(struct udev_device *dev) event->state = EVENT_QUEUED; udev_list_node_append(&event->node, &event_list); - - /* run all events with a timeout set immediately */ - if (udev_device_get_timeout(dev) > 0) { - event_run(event, true); - return 0; - } - return 0; } -- cgit v1.2.3-54-g00ecf From 57c6f8ae5f52a6e8ffc66a54966346f733dded39 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 28 Dec 2011 19:03:43 +0100 Subject: update README --- README | 45 +++++++++++++++++++++------------------------ udev/udevd.c | 6 +++--- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/README b/README index 0d25b84fad..38459c6b22 100644 --- a/README +++ b/README @@ -7,7 +7,7 @@ does not recommend replacing a distro's udev installation with the upstream version. The upstream udev project's set of default rules may require a most recent -kernel release to work properly. This is currently version 2.6.32. +kernel release to work properly. Tools and rules shipped by udev are not public API and may change at any time. Never call any private tool in /usr/lib/udev from any external application; it @@ -22,26 +22,30 @@ Requirements: - Some architectures might need a later kernel, that supports accept4(), or need to backport the accept4() syscall wiring in the kernel. - - These options are needed: + - These options are required: + CONFIG_DEVTMPFS=y CONFIG_HOTPLUG=y - CONFIG_UEVENT_HELPER_PATH="" + CONFIG_INOTIFY_USER=y CONFIG_NET=y - CONFIG_UNIX=y - CONFIG_SYSFS=y - CONFIG_SYSFS_DEPRECATED*=n CONFIG_PROC_FS=y - CONFIG_INOTIFY_USER=y CONFIG_SIGNALFD=y + CONFIG_SYSFS=y + CONFIG_SYSFS_DEPRECATED*=n + CONFIG_UEVENT_HELPER_PATH="" - These options might be needed: - CONFIG_TMPFS=y - CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes) CONFIG_BLK_DEV_BSG=y (SCSI devices) + CONFIG_TMPFS_POSIX_ACL=y (user ACLs for device nodes) + + - The /dev directory needs the 'devtmpfs' filesystem mounted. + Udev only manages the permissions and ownership of the + kernel-provided device nodes, and possibly creates additional symlinks. - - Udev does not work with the CONFIG_SYSFS_DEPRECATED* option. + - Udev requires /run to be writable, which is usually done by mounting a + 'tmpfs' filesystem. - - Unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work, - but it is not supported. + - This version of udev does not work properly with the CONFIG_SYSFS_DEPRECATED* + option enabled. - The deprecated hotplug helper /sbin/hotplug should be disabled in the kernel configuration, it is not needed today, and may render the system @@ -59,26 +63,19 @@ Requirements: available. - Some udev extras have external dependencies like: - libacl, libglib2, usbutils, pciutils, and gperf. + libglib2, usbutils, pciutils, and gperf. All these extras can be disabled with configure options. Setup: - - At bootup, the /dev directory should get the 'devtmpfs' filesystem - mounted. Udev manages the permissions and ownership of the kernel-created - device nodes, and udev possibly creates additional symlinks. If needed, udev also - works on an empty 'tmpfs' filesystem, but some device nodes like - /dev/null, /dev/console, /dev/kmsg should be created before udevd is started. - - The udev daemon should be started to handle device events sent by the kernel. During bootup, the events for already existing devices can be replayed, so - that they are configured by udev. This is usually done by: - udevadm trigger --action=add --type=subsystems - udevadm trigger --action=add --type=devices + that they are configured by udev. The systemd service files contain the + needed commands to start the udev daemon and the coldplug sequence. - Restarting the daemon never applies any rules to existing devices. - - New/changed rule files are picked up automatically; there is no daemon - restart or signal needed. + - New/changed rule files are picked up automatically; there is usually no + daemon restart or signal needed. Operation: - Based on events the kernel sends out on device creation/removal, udev diff --git a/udev/udevd.c b/udev/udevd.c index 1e12eb38ac..63b4fd7ad2 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -398,7 +398,7 @@ out: } } -static void event_run(struct event *event, bool force) +static void event_run(struct event *event) { struct udev_list_node *loop; @@ -423,7 +423,7 @@ static void event_run(struct event *event, bool force) return; } - if (!force && children >= children_max) { + if (children >= children_max) { if (children_max > 1) info(event->udev, "maximum number (%i) of children reached\n", children); return; @@ -573,7 +573,7 @@ static void event_queue_start(struct udev *udev) continue; } - event_run(event, false); + event_run(event); } } -- cgit v1.2.3-54-g00ecf From eed0832780382298f5df26143a8271f9a4328a9f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 1 Jan 2012 04:00:16 +0100 Subject: systemd: rename PassCred= to PsssCredentials= --- systemd/udev-control.socket | 2 +- systemd/udev-kernel.socket | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/systemd/udev-control.socket b/systemd/udev-control.socket index af7ef9a1d7..f80f774427 100644 --- a/systemd/udev-control.socket +++ b/systemd/udev-control.socket @@ -7,4 +7,4 @@ ConditionCapability=CAP_MKNOD Service=udev.service ListenSequentialPacket=/run/udev/control SocketMode=0600 -PassCred=yes +PassCredentials=yes diff --git a/systemd/udev-kernel.socket b/systemd/udev-kernel.socket index 4a8f599840..23fa9d5e11 100644 --- a/systemd/udev-kernel.socket +++ b/systemd/udev-kernel.socket @@ -7,4 +7,4 @@ ConditionCapability=CAP_MKNOD Service=udev.service ReceiveBuffer=134217728 ListenNetlink=kobject-uevent 1 -PassCred=yes +PassCredentials=yes -- cgit v1.2.3-54-g00ecf From 220893b3cbdbf8932f95c44811b169a8f0d33939 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 1 Jan 2012 04:21:15 +0100 Subject: remove mknod() logic and rely on 'devtmpfs' --- NEWS | 6 +- extras/cdrom_id/60-cdrom_id.rules | 4 +- extras/edd_id/61-persistent-storage-edd.rules | 2 +- extras/mtd_probe/75-probe_mtd.rules | 2 +- extras/v4l_id/60-persistent-v4l.rules | 2 +- libudev/libudev-device-private.c | 24 +- libudev/libudev-device.c | 54 +--- libudev/libudev-private.h | 2 - libudev/libudev-util-private.c | 17 -- libudev/libudev.c | 20 +- rules/rules.d/60-persistent-storage-tape.rules | 2 +- rules/rules.d/60-persistent-storage.rules | 14 +- .../usb5/5-2/5-2:1.0/tty/ttyACM0/uevent | 2 +- .../target0:0:0/0:0:0:0/block/sda/sda5/uevent | 1 + .../devices/virtual/block/fake!blockdev0/uevent | 1 + test/sys/devices/virtual/misc/misc-fake1/uevent | 2 + .../sys/devices/virtual/misc/misc-fake89999/uevent | 1 + test/sys/devices/virtual/tty/console/uevent | 1 + test/sys/devices/virtual/tty/tty0/uevent | 1 + test/sys/devices/virtual/tty/tty33/uevent | 1 + test/udev-test.pl.in | 271 ++------------------- udev/test-udev.c | 36 ++- udev/udev-event.c | 102 +------- udev/udev-node.c | 176 ++++--------- udev/udev-rules.c | 5 - udev/udev.h | 3 - udev/udev.xml | 25 +- udev/udevd.c | 5 +- 28 files changed, 169 insertions(+), 613 deletions(-) diff --git a/NEWS b/NEWS index b052257c33..f65ae0d7b0 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ udev 175 ======== +The 'devtmpfs' filesystem is required now, udev will not create or delete +device nodes anymore, it only adjusts permissions and ownership of device +nodes and maintains additional symlinks. + A writable /run directory (tmpfs) is required now for a fully functional udev. @@ -26,7 +30,7 @@ All built-in tools can be listed and tested with 'udevadm test-builtin'. The 'udevadm control --reload-rules' option has been renamed to '--reload'. It reloads the kernel module configuration. -The systemd socket files use PassCred=yes, which requires systemd +The systemd socket files use PassCredentials=yes, which requires systemd version 38. The udev build system only creates a .xz tarball now. diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules index 896af34825..353f522b0b 100644 --- a/extras/cdrom_id/60-cdrom_id.rules +++ b/extras/cdrom_id/60-cdrom_id.rules @@ -9,10 +9,10 @@ ENV{DEVTYPE}!="disk", GOTO="cdrom_end" KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" # media eject button pressed -ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $tempnode", GOTO="cdrom_end" +ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end" # import device and media properties and lock tray to # enable the receiving of media eject button events -IMPORT{program}="cdrom_id --lock-media $tempnode" +IMPORT{program}="cdrom_id --lock-media $devnode" LABEL="cdrom_end" diff --git a/extras/edd_id/61-persistent-storage-edd.rules b/extras/edd_id/61-persistent-storage-edd.rules index 1ab1be347e..6b4fb8ecfe 100644 --- a/extras/edd_id/61-persistent-storage-edd.rules +++ b/extras/edd_id/61-persistent-storage-edd.rules @@ -5,7 +5,7 @@ SUBSYSTEM!="block", GOTO="persistent_storage_edd_end" KERNEL!="sd*|hd*|cciss*", GOTO="persistent_storage_edd_end" # BIOS Enhanced Disk Device -ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $tempnode" +ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $devnode" ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" diff --git a/extras/mtd_probe/75-probe_mtd.rules b/extras/mtd_probe/75-probe_mtd.rules index 6b0c1c27e6..c0e0839785 100644 --- a/extras/mtd_probe/75-probe_mtd.rules +++ b/extras/mtd_probe/75-probe_mtd.rules @@ -2,7 +2,7 @@ ACTION!="add", GOTO="mtd_probe_end" -KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $tempnode" +KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $devnode" KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl" LABEL="mtd_probe_end" diff --git a/extras/v4l_id/60-persistent-v4l.rules b/extras/v4l_id/60-persistent-v4l.rules index edfd844753..93c5ee8c27 100644 --- a/extras/v4l_id/60-persistent-v4l.rules +++ b/extras/v4l_id/60-persistent-v4l.rules @@ -4,7 +4,7 @@ ACTION=="remove", GOTO="persistent_v4l_end" SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" ENV{MAJOR}=="", GOTO="persistent_v4l_end" -IMPORT{program}="v4l_id $tempnode" +IMPORT{program}="v4l_id $devnode" SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c index b78b6c9553..0864919301 100644 --- a/libudev/libudev-device-private.c +++ b/libudev/libudev-device-private.c @@ -78,7 +78,6 @@ int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, static bool device_has_info(struct udev_device *udev_device) { - struct udev *udev = udev_device_get_udev(udev_device); struct udev_list_entry *list_entry; if (udev_device_get_devlinks_list_entry(udev_device) != NULL) @@ -90,12 +89,6 @@ static bool device_has_info(struct udev_device *udev_device) return true; if (udev_device_get_tags_list_entry(udev_device) != NULL) return true; - if (udev_device_get_devnode(udev_device) != NULL && udev_device_get_knodename(udev_device) != NULL) { - size_t devlen = strlen(udev_get_dev_path(udev))+1; - - if (strcmp(&udev_device_get_devnode(udev_device)[devlen], udev_device_get_knodename(udev_device)) != 0) - return true; - } if (udev_device_get_watch_handle(udev_device) >= 0) return true; return false; @@ -142,20 +135,22 @@ int udev_device_update_db(struct udev_device *udev_device) fchmod(fileno(f), 01644); if (has_info) { - size_t devlen = strlen(udev_get_dev_path(udev))+1; struct udev_list_entry *list_entry; - if (udev_device_get_devnode(udev_device) != NULL) { - fprintf(f, "N:%s\n", &udev_device_get_devnode(udev_device)[devlen]); + if (major(udev_device_get_devnum(udev_device)) > 0) { + size_t devlen = strlen(udev_get_dev_path(udev))+1; + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + if (udev_device_get_devlink_priority(udev_device) != 0) + fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); + if (udev_device_get_watch_handle(udev_device) >= 0) + fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); } - if (udev_device_get_devlink_priority(udev_device) != 0) - fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); - if (udev_device_get_watch_handle(udev_device) >= 0) - fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); + if (udev_device_get_usec_initialized(udev_device) > 0) fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { if (!udev_list_entry_get_num(list_entry)) continue; @@ -163,6 +158,7 @@ int udev_device_update_db(struct udev_device *udev_device) udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); } + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) fprintf(f, "G:%s\n", udev_list_entry_get_name(list_entry)); } diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c index 28df7a2a11..e5950bb4b1 100644 --- a/libudev/libudev-device.c +++ b/libudev/libudev-device.c @@ -57,7 +57,6 @@ struct udev_device { char *driver; char *action; char *devpath_old; - char *knodename; char *id_filename; char **envp; char *monitor_buf; @@ -161,23 +160,6 @@ static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) return 0; } -const char *udev_device_get_knodename(struct udev_device *udev_device) -{ - return udev_device->knodename; -} - -static int udev_device_set_knodename(struct udev_device *udev_device, const char *knodename) -{ - free(udev_device->knodename); - udev_device->knodename = strdup(knodename); - if (udev_device->knodename == NULL) - return -ENOMEM; - /* do not overwrite the udev property with the kernel property */ - if (udev_device->devnode == NULL) - udev_device_add_property(udev_device, "DEVNAME", udev_device->knodename); - return 0; -} - const char *udev_device_get_devpath_old(struct udev_device *udev_device) { return udev_device->devpath_old; @@ -381,10 +363,7 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, } else if (strncmp(property, "DEVTYPE=", 8) == 0) { udev_device_set_devtype(udev_device, &property[8]); } else if (strncmp(property, "DEVNAME=", 8) == 0) { - if (property[8] == '/') - udev_device_set_devnode(udev_device, &property[8]); - else - udev_device_set_knodename(udev_device, &property[8]); + udev_device_set_devnode(udev_device, &property[8]); } else if (strncmp(property, "DEVLINKS=", 9) == 0) { char devlinks[UTIL_PATH_SIZE]; char *slink; @@ -516,10 +495,6 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile) line[len-1] = '\0'; val = &line[2]; switch(line[0]) { - case 'N': - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); - udev_device_set_devnode(udev_device, filename); - break; case 'S': util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); udev_device_add_devlink(udev_device, filename, 0); @@ -582,7 +557,7 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) else if (strncmp(line, "IFINDEX=", 8) == 0) udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); else if (strncmp(line, "DEVNAME=", 8) == 0) - udev_device_set_knodename(udev_device, &line[8]); + udev_device_set_devnode(udev_device, &line[8]); else if (strncmp(line, "DEVMODE=", 8) == 0) udev_device->devnode_mode = strtoul(&line[8], NULL, 8); @@ -1073,7 +1048,6 @@ UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device) free(udev_device->action); free(udev_device->driver); free(udev_device->devpath_old); - free(udev_device->knodename); free(udev_device->id_filename); free(udev_device->envp); free(udev_device->monitor_buf); @@ -1152,21 +1126,10 @@ UDEV_EXPORT const char *udev_device_get_devnode(struct udev_device *udev_device) { if (udev_device == NULL) return NULL; - if (!udev_device->info_loaded) { - udev_device_read_uevent_file(udev_device); - udev_device_read_db(udev_device, NULL); - } - - /* we might get called before we handled an event and have a db, use the kernel-provided name */ - if (udev_device->devnode == NULL && udev_device_get_knodename(udev_device) != NULL) { - char filename[UTIL_NAME_SIZE]; - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", - udev_device_get_knodename(udev_device), NULL); - udev_device_set_devnode(udev_device, filename); + if (udev_device->devnode != NULL) return udev_device->devnode; - } - + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); return udev_device->devnode; } @@ -1522,7 +1485,12 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) { free(udev_device->devnode); - udev_device->devnode = strdup(devnode); + if (devnode[0] != '/') { + if (asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), devnode) < 0) + udev_device->devnode = NULL; + } else { + udev_device->devnode = strdup(devnode); + } if (udev_device->devnode == NULL) return -ENOMEM; udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h index b86f6a8378..83976698a9 100644 --- a/libudev/libudev-private.h +++ b/libudev/libudev-private.h @@ -83,7 +83,6 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile); int udev_device_read_uevent_file(struct udev_device *udev_device); int udev_device_set_action(struct udev_device *udev_device, const char *action); const char *udev_device_get_devpath_old(struct udev_device *udev_device); -const char *udev_device_get_knodename(struct udev_device *udev_device); const char *udev_device_get_id_filename(struct udev_device *udev_device); void udev_device_set_is_initialized(struct udev_device *udev_device); int udev_device_add_tag(struct udev_device *udev_device, const char *tag); @@ -187,7 +186,6 @@ uint64_t util_string_bloom64(const char *str); int util_create_path(struct udev *udev, const char *path); int util_create_path_selinux(struct udev *udev, const char *path); int util_delete_path(struct udev *udev, const char *path); -int util_unlink_secure(struct udev *udev, const char *filename); uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); int util_resolve_subsys_kernel(struct udev *udev, const char *string, diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c index 2d7f8dc758..015e6d5862 100644 --- a/libudev/libudev-util-private.c +++ b/libudev/libudev-util-private.c @@ -113,23 +113,6 @@ int util_delete_path(struct udev *udev, const char *path) return err; } -/* Reset permissions on the device node, before unlinking it to make sure, - * that permissions of possible hard links will be removed too. - */ -int util_unlink_secure(struct udev *udev, const char *filename) -{ - int err; - - chown(filename, 0, 0); - chmod(filename, 0000); - err = unlink(filename); - if (errno == ENOENT) - err = 0; - if (err) - err(udev, "unlink(%s) failed: %m\n", filename); - return err; -} - uid_t util_lookup_user(struct udev *udev, const char *user) { char *endptr; diff --git a/libudev/libudev.c b/libudev/libudev.c index 93f2d8f1b5..ca2ac5d030 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -223,6 +223,10 @@ UDEV_EXPORT struct udev *udev_new(void) set_value(&udev->run_path, val); continue; } + if (strcmp(key, "udev_sys") == 0) { + set_value(&udev->sys_path, val); + continue; + } if (strcmp(key, "udev_rules") == 0) { set_value(&udev->rules_path[0], val); udev->rules_path_count = 1; @@ -237,18 +241,6 @@ UDEV_EXPORT struct udev *udev_new(void) if (env != NULL) udev_set_log_priority(udev, util_log_priority(env)); - env = getenv("UDEV_ROOT"); - if (env != NULL) { - set_value(&udev->dev_path, env); - udev_add_property(udev, "UDEV_ROOT", udev->dev_path); - } - - env = getenv("SYSFS_PATH"); - if (env != NULL) { - set_value(&udev->sys_path, env); - udev_add_property(udev, "SYSFS_PATH", udev->sys_path); - } - /* set defaults */ if (udev->dev_path == NULL) if (set_value(&udev->dev_path, "/dev") == NULL) @@ -401,8 +393,8 @@ int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *st * @udev: udev library context * * Retrieve the sysfs mount point. The default is "/sys". For - * testing purposes, it can be overridden with the environment - * variable SYSFS_PATH. + * testing purposes, it can be overridden with udev_sys= + * in the udev configuration file. * * Returns: the sys mount point **/ diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules index b1a64cee12..f2eabd92a8 100644 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ b/rules/rules.d/60-persistent-storage-tape.rules @@ -5,7 +5,7 @@ ACTION=="remove", GOTO="persistent_storage_tape_end" # type 8 devices are "Medium Changers" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $tempnode", \ +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $devnode", \ SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index 9b340334f4..b7da8b8bc2 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -27,20 +27,20 @@ KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLIN KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" # ATA devices with their own "ata" kernel subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $devnode" # ATA devices using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode" # ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $devnode" # Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $tempnode" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $devnode" # Otherwise fall back to using usb_id for USB devices KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" # scsi devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="scsi" -KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $tempnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="scsi" +KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="cciss" KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" @@ -49,7 +49,7 @@ KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394 KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" # scsi compat links for ATA devices -KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d$tempnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" +KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d $devnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent index e6caaabf08..22f0302e2a 100644 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent +++ b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent @@ -1,3 +1,3 @@ -DEVNAME=ttyACM0 MAJOR=166 MINOR=0 +DEVNAME=ttyACM0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent index 8a871ced03..ab7569dc37 100644 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent +++ b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent @@ -1,3 +1,4 @@ MAJOR=8 MINOR=5 DEVTYPE=partition +DEVNAME=sda5 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/uevent b/test/sys/devices/virtual/block/fake!blockdev0/uevent index 70997d361b..6c472ca852 100644 --- a/test/sys/devices/virtual/block/fake!blockdev0/uevent +++ b/test/sys/devices/virtual/block/fake!blockdev0/uevent @@ -1,3 +1,4 @@ MAJOR=7 MINOR=0 DEVTYPE=disk +DEVNAME=fake/blockdev0 diff --git a/test/sys/devices/virtual/misc/misc-fake1/uevent b/test/sys/devices/virtual/misc/misc-fake1/uevent index 79caac10ef..67faa81eb2 100644 --- a/test/sys/devices/virtual/misc/misc-fake1/uevent +++ b/test/sys/devices/virtual/misc/misc-fake1/uevent @@ -1,2 +1,4 @@ MAJOR=4095 MINOR=1 +DEVNAME=misc-fake1 + diff --git a/test/sys/devices/virtual/misc/misc-fake89999/uevent b/test/sys/devices/virtual/misc/misc-fake89999/uevent index 10915df871..53bb34ad99 100644 --- a/test/sys/devices/virtual/misc/misc-fake89999/uevent +++ b/test/sys/devices/virtual/misc/misc-fake89999/uevent @@ -1,2 +1,3 @@ MAJOR=4095 MINOR=89999 +DEVNAME=misc-fake89999 diff --git a/test/sys/devices/virtual/tty/console/uevent b/test/sys/devices/virtual/tty/console/uevent index 0eaf8b9eb0..71aad75b12 100644 --- a/test/sys/devices/virtual/tty/console/uevent +++ b/test/sys/devices/virtual/tty/console/uevent @@ -1,2 +1,3 @@ MAJOR=5 MINOR=1 +DEVNAME=console diff --git a/test/sys/devices/virtual/tty/tty0/uevent b/test/sys/devices/virtual/tty/tty0/uevent index 11692def2c..f338919a3b 100644 --- a/test/sys/devices/virtual/tty/tty0/uevent +++ b/test/sys/devices/virtual/tty/tty0/uevent @@ -1,2 +1,3 @@ MAJOR=4 MINOR=0 +DEVNAME=tty0 diff --git a/test/sys/devices/virtual/tty/tty33/uevent b/test/sys/devices/virtual/tty/tty33/uevent index 70a8268494..737826b96b 100644 --- a/test/sys/devices/virtual/tty/tty33/uevent +++ b/test/sys/devices/virtual/tty/tty33/uevent @@ -1,2 +1,3 @@ MAJOR=4 MINOR=33 +DEVNAME=tty33 diff --git a/test/udev-test.pl.in b/test/udev-test.pl.in index 0befc7b530..05055013d5 100755 --- a/test/udev-test.pl.in +++ b/test/udev-test.pl.in @@ -25,14 +25,13 @@ my $sysfs = "test/sys/"; my $udev_bin = "udev/test-udev"; my $valgrind = 0; my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; -my $udev_root = "udev-root/"; +my $udev_root = "udev-root"; my $udev_conf = "udev-test.conf"; my $udev_rules = "udev-test.rules"; my @tests = ( { desc => "no rules", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda" , exp_rem_error => "yes", @@ -42,7 +41,6 @@ EOF }, { desc => "label test of scsi disc", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "label test of scsi disc", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "label test of scsi disc", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < "label test of scsi partition", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "label test of pattern match", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "label test of multiple sysfs files", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "label test of max sysfs files (skip invalid rule)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "boot_disk1" , rules => < "catch device by *", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "catch device by * - take 2", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "catch device by ?", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "catch device by character class", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem/0" , rules => < "replace kernel name", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "Handle comment lines in config file (and replace kernel name)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "Handle comment lines in config file with whitespace (and replace kernel name)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "Handle whitespace only lines (and replace kernel name)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "whitespace" , rules => < "Handle empty lines in config file (and replace kernel name)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "Handle backslashed multi lines in config file (and replace kernel name)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "preserve backslashes, if they are not for a newline", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "aaa", rules => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "subdirectory handling", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "sub/direct/ory/modem" , rules => < "parent device name match of scsi partition", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "first_disk5" , rules => < "test substitution chars", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , rules => < "import of shell-value file", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "subdir/err/node" , rules => < "import of shell-value returned from program", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node12345678", rules => < "sustitution of sysfs value (%s{file})", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "disk-ATA-sda" , rules => < "program result substitution", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "special-device-5" , not_exp_name => "not" , @@ -319,7 +292,6 @@ EOF }, { desc => "program result substitution (newline removal)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "newline_removed" , rules => < "program result substitution", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "test-0:0:0:0" , rules => < "program with lots of arguments", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo9" , rules => < "program with subshell", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "bar9" , rules => < "program arguments combined with apostrophes", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "foo7" , rules => < "characters before the %c{N} substitution", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo9" , rules => < "substitute the second to last argument", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "my-foo8" , rules => < "test substitution by variable name", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", rules => < "test substitution by variable name 2", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", rules => < "test substitution by variable name 3", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "850:0:0:05" , rules => < "test substitution by variable name 4", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "855" , rules => < "test substitution by variable name 5", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "8550:0:0:0" , rules => < "non matching SUBSYSTEMS for device with no parent", - subsys => "tty", devpath => "/devices/virtual/tty/console", exp_name => "TTY", rules => < "non matching SUBSYSTEMS", - subsys => "tty", devpath => "/devices/virtual/tty/console", exp_name => "TTY" , rules => < "ATTRS match", - subsys => "tty", devpath => "/devices/virtual/tty/console", exp_name => "foo" , rules => < "ATTR (empty file)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "empty" , rules => < "ATTR (non-existent file)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "non-existent" , rules => < "program and bus type match", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0" , rules => < "sysfs parent hierarchy", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem" , rules => < "name test with ! in the name", - subsys => "block", devpath => "/devices/virtual/block/fake!blockdev0", exp_name => "is/a/fake/blockdev0" , rules => < "name test with ! in the name, but no matching rule", - subsys => "block", devpath => "/devices/virtual/block/fake!blockdev0", exp_name => "fake/blockdev0" , exp_rem_error => "yes", @@ -524,7 +476,6 @@ EOF }, { desc => "KERNELS rule", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "KERNELS wildcard all", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "KERNELS wildcard partial", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "KERNELS wildcard partial 2", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "scsi-0:0:0:0", rules => < "substitute attr with link target value (first match)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "driver-is-sd", rules => < "substitute attr with link target value (currently selected device)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "driver-is-ahci", rules => < "ignore ATTRS attribute whitespace", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ignored", rules => < "do not ignore ATTRS attribute whitespace", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "matched-with-space", rules => < "permissions USER=bad GROUP=name", - subsys => "tty", devpath => "/devices/virtual/tty/tty33", exp_name => "tty33", exp_perms => "0:0:0600", @@ -617,7 +560,6 @@ EOF }, { desc => "permissions OWNER=5000", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "5000::0600", @@ -627,7 +569,6 @@ EOF }, { desc => "permissions GROUP=100", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => ":100:0660", @@ -637,7 +578,6 @@ EOF }, { desc => "textual user id", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "nobody::0600", @@ -647,7 +587,6 @@ EOF }, { desc => "textual group id", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => ":daemon:0660", @@ -657,7 +596,6 @@ EOF }, { desc => "textual user/group id", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "root:mail:0660", @@ -667,7 +605,6 @@ EOF }, { desc => "permissions MODE=0777", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "::0777", @@ -677,7 +614,6 @@ EOF }, { desc => "permissions OWNER=5000 GROUP=100 MODE=0777", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_perms => "5000:100:0777", @@ -687,7 +623,6 @@ EOF }, { desc => "permissions OWNER to 5000", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "5000::", @@ -697,7 +632,6 @@ EOF }, { desc => "permissions GROUP to 100", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => ":100:0660", @@ -707,7 +641,6 @@ EOF }, { desc => "permissions MODE to 0060", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "::0060", @@ -717,7 +650,6 @@ EOF }, { desc => "permissions OWNER, GROUP, MODE", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "5000:100:0777", @@ -727,7 +659,6 @@ EOF }, { desc => "permissions only rule", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "5000:100:0777", @@ -739,7 +670,6 @@ EOF }, { desc => "multiple permissions only rule", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "3000:4000:0777", @@ -753,7 +683,6 @@ EOF }, { desc => "permissions only rule with override at SYMLINK+ rule", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "ttyACM0", exp_perms => "3000:8000:0777", @@ -767,7 +696,6 @@ EOF }, { desc => "major/minor number test", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", exp_majorminor => "8:0", @@ -777,7 +705,6 @@ EOF }, { desc => "big major number test", - subsys => "misc", devpath => "/devices/virtual/misc/misc-fake1", exp_name => "node", exp_majorminor => "4095:1", @@ -787,7 +714,6 @@ EOF }, { desc => "big major and big minor number test", - subsys => "misc", devpath => "/devices/virtual/misc/misc-fake89999", exp_name => "node", exp_majorminor => "4095:89999", @@ -797,7 +723,6 @@ EOF }, { desc => "multiple symlinks with format char", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink2-ttyACM0", rules => < "multiple symlinks with a lot of s p a c e s", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "one", not_exp_name => " ", @@ -816,38 +740,14 @@ EOF }, { desc => "symlink creation (same directory)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "modem0", rules => < "symlink creation (relative link forward)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", - exp_name => "1/2/symlink" , - exp_target => "a/b/node", - exp_rem_error => "yes", - rules => < "symlink creation (relative link back and forward)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6", - exp_name => "1/2/c/d/symlink" , - exp_target => "../../a/b/node", - exp_rem_error => "yes", - rules => < "multiple symlinks", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "second-0" , rules => < "symlink name '.'", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => ".", exp_add_error => "yes", @@ -867,7 +766,6 @@ EOF }, { desc => "symlink node to itself", - subsys => "tty", devpath => "/devices/virtual/tty/tty0", exp_name => "link", exp_add_error => "yes", @@ -879,7 +777,6 @@ EOF }, { desc => "symlink %n substitution", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink0", rules => < "symlink %k substitution", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "symlink-ttyACM0", rules => < "symlink %M:%m substitution", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "major-166:0", rules => < "symlink %b substitution", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "symlink-0:0:0:0", - exp_target => "node", rules => < "symlink %c substitution", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", rules => < "symlink %c{N} substitution", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "test", rules => < "symlink %c{N+} substitution", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "this", rules => < "symlink only rule with %c{N+}", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "test", rules => < "symlink %s{filename} substitution", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "166:0", rules => < "program result substitution (numbered part of)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link1", rules => < "program result substitution (numbered part of+)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", exp_name => "link4", rules => < "SUBSYSTEM match test", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "DRIVERS match test", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "temporary node creation test", - subsys => "block", + desc => "devnode substitution test", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node", rules => < "parent node name substitution test sequence 1/2 (keep)", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "main_device", - option => "keep", - exp_rem_error => "yes", - rules => < "parent node name substitution test sequence 2/2 (clean)", - subsys => "block", + desc => "parent node name substitution test", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "main_device-part-1", - option => "clean", + exp_name => "sda-part-1", rules => < "udev_root substitution", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "start-udev-root-end", rules => < "last_rule option", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "last", rules => < "negation KERNEL!=", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "match", rules => < "negation SUBSYSTEM!=", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "not-anything", rules => < "negation PROGRAM!= exit code", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "nonzero-program", rules => < "test for whitespace between the operator", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test (assign)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test (assign 2 times)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "true", rules => < "ENV{} test (assign2)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "part", rules => < "untrusted string sanitize", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "sane", rules => < "untrusted string sanitize (don't replace utf8)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "uber", rules => < "untrusted string sanitize (replace invalid utf8)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "replaced", rules => < "read sysfs value from parent device", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "serial-354172020305000", rules => < "match against empty key string", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", rules => < "check ACTION value", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", rules => < "test RUN key remove", - subsys => "block", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "testsymlink2", - exp_target => "ok2", - rules => < "final assignment", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", exp_perms => "root:tty:0640", @@ -1234,7 +1075,6 @@ EOF }, { desc => "final assignment 2", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "ok", exp_perms => "root:tty:0640", @@ -1246,7 +1086,6 @@ EOF }, { desc => "env substitution", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "node-add-me", rules => < "reset list to current value", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "three", not_exp_name => "two", @@ -1267,7 +1105,6 @@ EOF }, { desc => "test empty SYMLINK+ (empty override)", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", not_exp_name => "wrong", @@ -1279,7 +1116,6 @@ EOF }, { desc => "test multi matches", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "test multi matches 2", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "test multi matches 3", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "test multi matches 4", - subsys => "tty", devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", exp_name => "right", rules => < "IMPORT parent test sequence 1/2 (keep)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "parent", option => "keep", @@ -1336,7 +1168,6 @@ EOF }, { desc => "IMPORT parent test sequence 2/2 (keep)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "parentenv-parent_right", option => "clean", @@ -1346,7 +1177,6 @@ EOF }, { desc => "GOTO test", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "right", rules => < "GOTO label does not exist", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "right", rules => < "SYMLINK+ compare test", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "right", not_exp_name => "wrong", @@ -1384,7 +1212,6 @@ EOF }, { desc => "invalid key operation", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "yes", rules => < "operator chars in attribute", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "yes", rules => < "overlong comment line", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", exp_name => "yes", rules => < "magic subsys/kernel lookup", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "00:16:41:e2:8d:ff", rules => < "TEST absolute path", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "there", rules => < "TEST subsys/kernel lookup", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "yes", rules => < "TEST relative path", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "relative", rules => < "TEST wildcard substitution (find queue/nr_requests)", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "found-subdir", rules => < "TEST MODE=0000", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "0:0:0000", @@ -1472,7 +1291,6 @@ EOF }, { desc => "TEST PROGRAM feeds OWNER, GROUP, MODE", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "5000:100:0400", @@ -1484,7 +1302,6 @@ EOF }, { desc => "TEST PROGRAM feeds MODE with overflow", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda", exp_perms => "0:0:0440", @@ -1496,7 +1313,6 @@ EOF }, { desc => "magic [subsys/sysname] attribute substitution", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "sda-8741C4G-end", exp_perms => "0:0:0600", @@ -1508,7 +1324,6 @@ EOF }, { desc => "builtin path_id", - subsys => "block", devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0", rules => <$udev_rules" || die "unable to create rules file: $udev_rules"; print CONF $$rules; close CONF; - $ENV{ACTION} = $action; - $ENV{SUBSYSTEM} = $subsys; if ($valgrind > 0) { - system("$udev_bin_valgrind"); + system("$udev_bin_valgrind $action $devpath"); } else { - system("$udev_bin"); + system("$udev_bin $action $devpath"); } } @@ -1606,39 +1416,6 @@ sub major_minor_test { } } -sub symlink_test { - my ($rules) = @_; - - my $output = `ls -l $PWD/$udev_root$rules->{exp_name}`; - - if ($output =~ m/(.*)-> (.*)/) { - if ($2 eq $rules->{exp_target}) { - print "symlink: ok\n"; - } else { - print " expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n"; - print " created symlink from: \'$rules->{exp_name}\' to \'$2\'\n"; - print "symlink: error"; - if ($rules->{exp_add_error}) { - print " as expected\n"; - } else { - print "\n"; - $error++; - sleep(1); - } - } - } else { - print " expected symlink from: \'$rules->{exp_name}\' to \'$rules->{exp_target}\'\n"; - print "symlink: not created"; - if ($rules->{exp_add_error}) { - print " as expected\n"; - } else { - print "\n"; - $error++; - sleep(1); - } - } -} - sub make_udev_root { system("rm -rf $udev_root"); mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; @@ -1652,29 +1429,23 @@ sub run_test { my ($rules, $number) = @_; print "TEST $number: $rules->{desc}\n"; + print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; - if ($rules->{exp_target}) { - print "device \'$rules->{devpath}\' expecting link '$rules->{exp_name}' to node \'$rules->{exp_target}\'\n"; - } else { - print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; - } - - - udev("add", $rules->{subsys}, $rules->{devpath}, \$rules->{rules}); + udev("add", $rules->{devpath}, \$rules->{rules}); if (defined($rules->{not_exp_name})) { - if ((-e "$PWD/$udev_root$rules->{not_exp_name}") || - (-l "$PWD/$udev_root$rules->{not_exp_name}")) { + if ((-e "$PWD/$udev_root/$rules->{not_exp_name}") || + (-l "$PWD/$udev_root/$rules->{not_exp_name}")) { print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; $error++; sleep(1); } } - if ((-e "$PWD/$udev_root$rules->{exp_name}") || - (-l "$PWD/$udev_root$rules->{exp_name}")) { + if ((-e "$PWD/$udev_root/$rules->{exp_name}") || + (-l "$PWD/$udev_root/$rules->{exp_name}")) { my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, - $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root$rules->{exp_name}"); + $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root/$rules->{exp_name}"); if (defined($rules->{exp_perms})) { permissions_test($rules, $uid, $gid, $mode); @@ -1682,9 +1453,6 @@ sub run_test { if (defined($rules->{exp_majorminor})) { major_minor_test($rules, $rdev); } - if (defined($rules->{exp_target})) { - symlink_test($rules); - } print "add: ok\n"; } else { print "add: error"; @@ -1704,9 +1472,9 @@ sub run_test { return; } - udev("remove", $rules->{subsys}, $rules->{devpath}, \$rules->{rules}); - if ((-e "$PWD/$udev_root$rules->{exp_name}") || - (-l "$PWD/$udev_root$rules->{exp_name}")) { + udev("remove", $rules->{devpath}, \$rules->{rules}); + if ((-e "$PWD/$udev_root/$rules->{exp_name}") || + (-l "$PWD/$udev_root/$rules->{exp_name}")) { print "remove: error"; if ($rules->{exp_rem_error}) { print " as expected\n"; @@ -1743,6 +1511,7 @@ make_udev_root(); open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; print CONF "udev_root=\"$udev_root\"\n"; print CONF "udev_run=\"$udev_root/.udev\"\n"; +print CONF "udev_sys=\"$sysfs\"\n"; print CONF "udev_rules=\"$PWD\"\n"; print CONF "udev_log=\"err\"\n"; close CONF; diff --git a/udev/test-udev.c b/udev/test-udev.c index 8039459906..8d5baf7f54 100644 --- a/udev/test-udev.c +++ b/udev/test-udev.c @@ -43,7 +43,6 @@ int main(int argc, char *argv[]) char syspath[UTIL_PATH_SIZE]; const char *devpath; const char *action; - const char *subsystem; sigset_t mask, sigmask_orig; int err = -EINVAL; @@ -55,12 +54,15 @@ int main(int argc, char *argv[]) sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); - action = getenv("ACTION"); - devpath = getenv("DEVPATH"); - subsystem = getenv("SUBSYSTEM"); + action = argv[1]; + if (action == NULL) { + err(udev, "action missing\n"); + goto out; + } - if (action == NULL || subsystem == NULL || devpath == NULL) { - err(udev, "action, subsystem or devpath missing\n"); + devpath = argv[2]; + if (devpath == NULL) { + err(udev, "devpath missing\n"); goto out; } @@ -73,10 +75,6 @@ int main(int argc, char *argv[]) goto out; } - /* skip reading of db, but read kernel parameters */ - udev_device_set_info_loaded(dev); - udev_device_read_uevent_file(dev); - udev_device_set_action(dev, action); event = udev_event_new(dev); @@ -88,6 +86,24 @@ int main(int argc, char *argv[]) goto out; } + /* do what devtmpfs usually provides us */ + if (udev_device_get_devnode(dev) != NULL) { + mode_t mode; + + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + mode |= S_IFBLK; + else + mode |= S_IFCHR; + + if (strcmp(action, "remove") != 0) { + util_create_path(udev, udev_device_get_devnode(dev)); + mknod(udev_device_get_devnode(dev), mode, udev_device_get_devnum(dev)); + } else { + unlink(udev_device_get_devnode(dev)); + util_delete_path(udev, udev_device_get_devnode(dev)); + } + } + err = udev_event_execute_rules(event, rules, &sigmask_orig); if (err == 0) udev_event_execute_run(event, NULL); diff --git a/udev/udev-event.c b/udev/udev-event.c index e10d48e13b..3801f23a6b 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -59,7 +59,6 @@ void udev_event_unref(struct udev_event *event) if (event == NULL) return; udev_list_cleanup(&event->run_list); - free(event->tmp_node); free(event->program_result); free(event->name); dbg(event->udev, "free event %p\n", event); @@ -71,7 +70,7 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char * struct udev_device *dev = event->dev; enum subst_type { SUBST_UNKNOWN, - SUBST_TEMP_NODE, + SUBST_DEVNODE, SUBST_ATTR, SUBST_ENV, SUBST_KERNEL, @@ -93,7 +92,8 @@ size_t udev_event_apply_format(struct udev_event *event, const char *src, char * char fmt; enum subst_type type; } map[] = { - { .name = "tempnode", .fmt = 'N', .type = SUBST_TEMP_NODE }, + { .name = "devnode", .fmt = 'N', .type = SUBST_DEVNODE }, + { .name = "tempnode", .fmt = 'N', .type = SUBST_DEVNODE }, { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, { .name = "env", .fmt = 'E', .type = SUBST_ENV }, @@ -332,7 +332,7 @@ subst: dev_parent = udev_device_get_parent(event->dev); if (dev_parent == NULL) break; - devnode = udev_device_get_devnode(dev_parent); + devnode = udev_device_get_devnode(dev_parent); if (devnode != NULL) { size_t devlen = strlen(udev_get_dev_path(event->udev))+1; @@ -342,56 +342,10 @@ subst: } break; } - case SUBST_TEMP_NODE: { - dev_t devnum; - struct stat statbuf; - char filename[UTIL_PATH_SIZE]; - const char *devtype; - - if (event->tmp_node != NULL) { - l = util_strpcpy(&s, l, event->tmp_node); - dbg(event->udev, "tempnode: return earlier created one\n"); - break; - } - devnum = udev_device_get_devnum(dev); - if (major(devnum) == 0) - break; - /* lookup kernel provided node */ - if (udev_device_get_knodename(dev) != NULL) { - util_strscpyl(filename, sizeof(filename), - udev_get_dev_path(event->udev), "/", udev_device_get_knodename(dev), NULL); - if (stat(filename, &statbuf) == 0 && statbuf.st_rdev == devnum) { - l = util_strpcpy(&s, l, filename); - dbg(event->udev, "tempnode: return kernel node\n"); - break; - } - } - /* lookup /dev/{char,block}/: */ - if (strcmp(udev_device_get_subsystem(dev), "block") == 0) - devtype = "block"; - else - devtype = "char"; - snprintf(filename, sizeof(filename), "%s/%s/%u:%u", - udev_get_dev_path(event->udev), devtype, - major(udev_device_get_devnum(dev)), - minor(udev_device_get_devnum(dev))); - if (stat(filename, &statbuf) == 0 && statbuf.st_rdev == devnum) { - l = util_strpcpy(&s, l, filename); - dbg(event->udev, "tempnode: return maj:min node\n"); - break; - } - /* create temporary node */ - dbg(event->udev, "tempnode: create temp node\n"); - asprintf(&event->tmp_node, "%s/.tmp-%s-%u:%u", - udev_get_dev_path(event->udev), devtype, - major(udev_device_get_devnum(dev)), - minor(udev_device_get_devnum(dev))); - if (event->tmp_node == NULL) - break; - udev_node_mknod(dev, event->tmp_node, 0600, 0, 0); - l = util_strpcpy(&s, l, event->tmp_node); + case SUBST_DEVNODE: + if (udev_device_get_devnode(dev) != NULL) + l = util_strpcpy(&s, l, udev_device_get_devnode(dev)); break; - } case SUBST_NAME: if (event->name != NULL) { l = util_strpcpy(&s, l, event->name); @@ -975,44 +929,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, } if (major(udev_device_get_devnum(dev)) != 0) { - char filename[UTIL_PATH_SIZE]; - - if (event->tmp_node != NULL) { - info(event->udev, "cleanup temporary device node\n"); - util_unlink_secure(event->udev, event->tmp_node); - free(event->tmp_node); - event->tmp_node = NULL; - } - - /* no rule, use kernel provided name */ - if (event->name == NULL) { - if (udev_device_get_knodename(dev) != NULL) { - event->name = strdup(udev_device_get_knodename(dev)); - info(event->udev, "no node name set, will use kernel supplied name '%s'\n", event->name); - } else { - event->name = strdup(udev_device_get_sysname(event->dev)); - info(event->udev, "no node name set, will use device name '%s'\n", event->name); - } - } - - if (event->name == NULL || event->name[0] == '\0') { - udev_device_delete_db(dev); - udev_device_tag_index(dev, NULL, false); - udev_device_unref(event->dev_db); - err = -ENOMEM; - err(event->udev, "no node name, something went wrong, ignoring\n"); - goto out; - } - - if (udev_device_get_knodename(dev) != NULL && strcmp(udev_device_get_knodename(dev), event->name) != 0) - err(event->udev, "kernel-provided name '%s' and NAME= '%s' disagree, " - "please use SYMLINK+= or change the kernel to provide the proper name\n", - udev_device_get_knodename(dev), event->name); - - /* set device node name */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", event->name, NULL); - udev_device_set_devnode(dev, filename); - /* remove/update possible left-over symlinks from old database entry */ if (event->dev_db != NULL) udev_node_update_old_links(dev, event->dev_db); @@ -1030,10 +946,6 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, } } - /* set sticky bit, so we do not remove the node on module unload */ - if (event->static_node) - event->mode |= 01000; - err = udev_node_add(dev, event->mode, event->uid, event->gid); } diff --git a/udev/udev-node.c b/udev/udev-node.c index 44d3686db6..31046bd713 100644 --- a/udev/udev-node.c +++ b/udev/udev-node.c @@ -33,90 +33,6 @@ #define TMP_FILE_EXT ".udev-tmp" -int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid) -{ - struct udev *udev = udev_device_get_udev(dev); - dev_t devnum = udev_device_get_devnum(dev); - struct stat stats; - int err = 0; - - - if (strcmp(udev_device_get_subsystem(dev), "block") == 0) - mode |= S_IFBLK; - else - mode |= S_IFCHR; - - if (file == NULL) - file = udev_device_get_devnode(dev); - - if (lstat(file, &stats) == 0) { - if (((stats.st_mode & S_IFMT) == (mode & S_IFMT)) && (stats.st_rdev == devnum)) { - info(udev, "preserve file '%s', because it has correct dev_t\n", file); - if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { - /* preserve 'sticky' bit, if already set */ - mode |= stats.st_mode & 01000; - info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); - chmod(file, mode); - chown(file, uid, gid); - } else { - info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", file, mode, uid, gid); - } - /* - * Set initial selinux file context only on add events. - * We set the proper context on bootup (triger) or for newly - * added devices, but we don't change it later, in case - * something else has set a custom context in the meantime. - */ - if (strcmp(udev_device_get_action(dev), "add") == 0) - udev_selinux_lsetfilecon(udev, file, mode); - /* always update timestamp when we re-use the node, like on media change events */ - utimensat(AT_FDCWD, file, NULL, 0); - } else { - char file_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; - - info(udev, "atomically replace existing file '%s'\n", file); - util_strscpyl(file_tmp, sizeof(file_tmp), file, TMP_FILE_EXT, NULL); - unlink(file_tmp); - udev_selinux_setfscreatecon(udev, file_tmp, mode); - err = mknod(file_tmp, mode, devnum); - udev_selinux_resetfscreatecon(udev); - if (err != 0) { - err(udev, "mknod '%s' %u:%u %#o failed: %m\n", - file_tmp, major(devnum), minor(devnum), mode); - goto exit; - } - err = rename(file_tmp, file); - if (err != 0) { - err(udev, "rename '%s' '%s' failed: %m\n", file_tmp, file); - unlink(file_tmp); - goto exit; - } - info(udev, "set permissions '%s' %#o uid=%u gid=%u\n", file, mode, uid, gid); - chmod(file, mode); - chown(file, uid, gid); - } - } else { - info(udev, "mknod '%s' %u:%u %#o\n", file, major(devnum), minor(devnum), mode); - do { - err = util_create_path_selinux(udev, file); - if (err != 0 && err != -ENOENT) - break; - udev_selinux_setfscreatecon(udev, file, mode); - err = mknod(file, mode, devnum); - if (err != 0) - err = -errno; - udev_selinux_resetfscreatecon(udev); - } while (err == -ENOENT); - if (err != 0 && err != -EEXIST) - err(udev, "mknod '%s' %u:%u %#o' failed: %m\n", file, major(devnum), minor(devnum), mode); - info(udev, "set permissions '%s' %#o uid=%u gid=%u\n", file, mode, uid, gid); - chmod(file, mode); - chown(file, uid, gid); - } -exit: - return err; -} - static int node_symlink(struct udev *udev, const char *node, const char *slink) { struct stat stats; @@ -362,6 +278,55 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev } } +static int node_fixup(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) +{ + struct udev *udev = udev_device_get_udev(dev); + const char *devnode = udev_device_get_devnode(dev); + dev_t devnum = udev_device_get_devnum(dev); + struct stat stats; + int err = 0; + + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + mode |= S_IFBLK; + else + mode |= S_IFCHR; + + if (lstat(devnode, &stats) != 0) { + err = -errno; + info(udev, "can not stat() node '%s' (%m)\n", devnode); + goto out; + } + + if (((stats.st_mode & S_IFMT) != (mode & S_IFMT)) || (stats.st_rdev != devnum)) { + err = -EEXIST; + info(udev, "found node '%s' with non-matching devnum %s, skip handling\n", + udev_device_get_devnode(dev), udev_device_get_id_filename(dev)); + goto out; + } + + if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { + info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); + chmod(devnode, mode); + chown(devnode, uid, gid); + } else { + info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); + } + + /* + * Set initial selinux file context only on add events. + * We set the proper context on bootup (triger) or for newly + * added devices, but we don't change it later, in case + * something else has set a custom context in the meantime. + */ + if (strcmp(udev_device_get_action(dev), "add") == 0) + udev_selinux_lsetfilecon(udev, devnode, mode); + + /* always update timestamp when we re-use the node, like on media change events */ + utimensat(AT_FDCWD, devnode, NULL, 0); +out: + return err; +} + int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); @@ -369,15 +334,12 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) struct udev_list_entry *list_entry; int err = 0; - info(udev, "creating device node '%s', devnum=%d:%d, mode=%#o, uid=%d, gid=%d\n", - udev_device_get_devnode(dev), - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev)), - mode, uid, gid); + info(udev, "handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d\n", + udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid); - if (udev_node_mknod(dev, NULL, mode, uid, gid) != 0) { - err = -1; + err = node_fixup(dev, mode, uid, gid); + if (err < 0) goto exit; - } /* always add /dev/{block,char}/$major:$minor */ snprintf(filename, sizeof(filename), "%s/%s/%u:%u", @@ -412,38 +374,6 @@ int udev_node_remove(struct udev_device *dev) udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) link_update(dev, udev_list_entry_get_name(list_entry), 0); - devnode = udev_device_get_devnode(dev); - if (devnode == NULL) - goto out; - - if (stat(devnode, &stats) == 0) { - if (stats.st_rdev != udev_device_get_devnum(dev)) { - info(udev, "device node '%s' points to a different device, skip removal\n", devnode); - err = -1; - goto out; - } - - if (stats.st_mode & 01000) { - info(udev, "device node '%s' has sticky bit set, skip removal\n", devnode); - goto out; - } - } else { - info(udev, "device node '%s' not found\n", devnode); - } - - dev_check = udev_device_new_from_syspath(udev, udev_device_get_syspath(dev)); - if (dev_check != NULL) { - /* do not remove device node if the same sys-device is re-created in the meantime */ - info(udev, "keeping device node of existing device'%s'\n", devnode); - udev_device_unref(dev_check); - goto out; - } - - info(udev, "removing device node '%s'\n", devnode); - err = util_unlink_secure(udev, devnode); - if (err == 0) - util_delete_path(udev, devnode); - /* remove /dev/{block,char}/$major:$minor */ snprintf(filename, sizeof(filename), "%s/%s/%u:%u", udev_get_dev_path(udev), diff --git a/udev/udev-rules.c b/udev/udev-rules.c index 411b9d88eb..7e79545124 100644 --- a/udev/udev-rules.c +++ b/udev/udev-rules.c @@ -2504,9 +2504,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event &rules->buf[rule->rule.filename_off], rule->rule.filename_line); break; - case TK_A_STATIC_NODE: - event->static_node = true; - break; case TK_A_ENV: { const char *name = &rules->buf[cur->key.attr_off]; char *value = &rules->buf[cur->key.value_off]; @@ -2729,8 +2726,6 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules) else mode = 0600; } - /* set sticky bit, so we do not remove the node on module unload */ - mode |= 01000; if (mode != (stats.st_mode & 01777)) { chmod(filename, mode); info(rules->udev, "chmod '%s' %#o\n", filename, mode); diff --git a/udev/udev.h b/udev/udev.h index 4f2886c69c..56b1652c74 100644 --- a/udev/udev.h +++ b/udev/udev.h @@ -32,7 +32,6 @@ struct udev_event { struct udev_device *dev_parent; struct udev_device *dev_db; char *name; - char *tmp_node; char *program_result; mode_t mode; uid_t uid; @@ -51,7 +50,6 @@ struct udev_event { bool owner_final; bool mode_set; bool mode_final; - bool static_node; bool name_final; bool devlink_final; bool run_final; @@ -91,7 +89,6 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev); struct udev_device *udev_watch_lookup(struct udev *udev, int wd); /* udev-node.c */ -int udev_node_mknod(struct udev_device *dev, const char *file, mode_t mode, uid_t uid, gid_t gid); int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); int udev_node_remove(struct udev_device *dev); void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); diff --git a/udev/udev.xml b/udev/udev.xml index 7b31173b21..fca0dad7bf 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -167,9 +167,8 @@ - Match the name of the node or network interface. It can - be used once the NAME key has been set in one of the preceding - rules. + Match the name of a network interface. It can be used once the + NAME key has been set in one of the preceding rules. @@ -319,17 +318,8 @@ - What a network interface should be named. - Also, as a temporary workaround, this is what a device node - should be named; usually the kernel provides the defined node name or creates - and removes the node before udev even receives any event. Changing - the node name from the kernel's default creates inconsistencies - and is not supported. If the kernel and NAME specify different names, - an error is logged. udev is only expected to handle device node - permissions and to create additional symlinks, not to change - kernel-provided device node names. Instead of renaming a device node, - SYMLINK should be used. However, symlink names must never conflict with - device node names, as that would result in unpredictable behavior. + The name to use for a network interface. The name of a device node + can not be changed by udev, only additional symlinks can be created. @@ -637,7 +627,7 @@ - The current name of the device node. If not changed by a rule, it is the + The current name of the device. If not changed by a rule, it is the name of the kernel device. @@ -665,10 +655,9 @@ - , + , - The name of a temporary device node created to provide access to - the device from a external program before the real node is created. + The name of the device node. diff --git a/udev/udevd.c b/udev/udevd.c index 63b4fd7ad2..6b561977dc 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -863,11 +863,10 @@ static void static_dev_create_from_modules(struct udev *udev) if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3) continue; - /* set sticky bit, so we do not remove the node on module unload */ if (type == 'c') - mode = 01600|S_IFCHR; + mode = S_IFCHR; else if (type == 'b') - mode = 01600|S_IFBLK; + mode = S_IFBLK; else continue; -- cgit v1.2.3-54-g00ecf From a8e49f591398ab3eae8c663a2764606b96f2a1a8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 2 Jan 2012 12:38:50 +0100 Subject: builtin: kmod - hook up kmod_validate_resources() --- udev/udev-builtin-kmod.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c index a5c76fc214..6719432c08 100644 --- a/udev/udev-builtin-kmod.c +++ b/udev/udev-builtin-kmod.c @@ -122,14 +122,16 @@ static int builtin_kmod_init(struct udev *udev) /* called on udev shutdown and reload request */ static void builtin_kmod_exit(struct udev *udev) { - ctx = kmod_unref(ctx); info(udev, "unload module index\n"); + ctx = kmod_unref(ctx); } /* called every couple of seconds during event activity; 'true' if config has changed */ static bool builtin_kmod_validate(struct udev *udev) { info(udev, "validate module index\n"); + if (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK) + return true; return false; } -- cgit v1.2.3-54-g00ecf From d876eea1c48384f66f18e28803187def44c481be Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 2 Jan 2012 16:00:57 -0500 Subject: hwdb: drop useless line freeing getline() takes care of extending the buffer as needed, so no point in constantly freeing it before every call. --- udev/udev-builtin-hwdb.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/udev/udev-builtin-hwdb.c b/udev/udev-builtin-hwdb.c index e38c6b9d26..b6af4b6fcf 100644 --- a/udev/udev-builtin-hwdb.c +++ b/udev/udev-builtin-hwdb.c @@ -101,11 +101,6 @@ static int lookup_vid_pid(const char *database, for (;;) { size_t n; - if (line) { - free(line); - line = NULL; - } - if (getline(&line, &n, f) < 0) break; -- cgit v1.2.3-54-g00ecf From 7abdf3e00c581207e1bf01bce20838c6cd61d4c4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 Jan 2012 04:17:13 +0100 Subject: build-sys: use use ${ac_default_prefix} --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 497a74fc0a..4fc75a434a 100644 --- a/configure.ac +++ b/configure.ac @@ -58,7 +58,7 @@ AC_SUBST(PCI_DATABASE) AC_ARG_WITH([rootprefix], AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), - [], [with_rootprefix=$prefix]) + [], [with_rootprefix=${ac_default_prefix}]) AC_SUBST([rootprefix], [$with_rootprefix]) AC_ARG_WITH([rootlibdir], -- cgit v1.2.3-54-g00ecf From 16ab1f22fc8aba4b526761df6246263d4df32343 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 Jan 2012 15:23:49 +0100 Subject: require kmod >= 3 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 4fc75a434a..bd154181e5 100644 --- a/configure.ac +++ b/configure.ac @@ -23,7 +23,7 @@ AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not fo PKG_CHECK_MODULES(BLKID, blkid >= 2.20) -PKG_CHECK_MODULES(KMOD, libkmod >= 2) +PKG_CHECK_MODULES(KMOD, libkmod >= 3) if test "x$cross_compiling" = "xno" ; then AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) -- cgit v1.2.3-54-g00ecf From 1495719024cae87fd42167ec77691ebb64ba20d7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 Jan 2012 19:13:41 +0100 Subject: build-sys: use --libexecdir=/usr/lib instead of /usr/lib/udev --- INSTALL | 6 ++-- Makefile.am | 55 +++++++++++++++--------------- NEWS | 3 ++ autogen.sh | 2 +- extras/keymap/keyboard-force-release.sh.in | 2 +- extras/keymap/keymap.c | 2 +- libudev/libudev.c | 2 +- systemd/udev.service.in | 2 +- udev/udev-event.c | 2 +- udev/udev.pc.in | 2 +- udev/udev.xml | 8 ++--- udev/udevd.c | 2 +- 12 files changed, 44 insertions(+), 44 deletions(-) diff --git a/INSTALL b/INSTALL index 5fa900b190..59abf7c92f 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ The options used used usually look like: --sysconfdir=/etc \ --bindir=/usr/bin \ --libdir=/usr/lib64 \ - --libexecdir=/usr/lib/udev \ + --libexecdir=/usr/lib \ --with-systemdsystemunitdir=/usr/lib/systemd/system \ --with-selinux @@ -14,7 +14,7 @@ The options used in a RPM spec file look like: --sysconfdir=%{_sysconfdir} \ --bindir=%{_bindir} \ --libdir=%{_libdir} \ - --libexecdir=%{_prefix}/lib/udev \ + --libexecdir=%{_prefix}/lib \ --with-systemdsystemunitdir=%{_prefix}/lib/systemd/system \ --with-selinux @@ -26,7 +26,7 @@ and udevadm in /sbin: --bindir=/sbin \ --libdir=%{_libdir} \ --with-rootlibdir=/lib64 \ - --libexecdir=/lib/udev \ + --libexecdir=/lib \ --with-systemdsystemunitdir=/lib/systemd/system \ --with-selinux diff --git a/Makefile.am b/Makefile.am index d95a3619a9..7abad22a61 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ -I$(top_srcdir)/libudev \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DLIBEXECDIR=\""$(libexecdir)"\" + -DPKGLIBEXECDIR=\""$(libexecdir)/udev"\" AM_CFLAGS = \ ${my_CFLAGS} \ @@ -36,8 +36,9 @@ INSTALL_EXEC_HOOKS = INSTALL_DATA_HOOKS = UNINSTALL_EXEC_HOOKS = DISTCHECK_HOOKS = -libexec_SCRIPTS = -dist_libexec_SCRIPTS = +pkglibexec_SCRIPTS = +dist_pkglibexec_SCRIPTS = +dist_pkglibexec_DATA = SED_PROCESS = \ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ @@ -48,7 +49,7 @@ SED_PROCESS = \ -e 's,@libdir\@,$(libdir),g' \ -e 's,@includedir\@,$(includedir),g' \ -e 's,@bindir\@,$(bindir),g' \ - -e 's,@libexecdir\@,$(libexecdir),g' \ + -e 's,@pkglibexecdir\@,$(libexecdir)/udev,g' \ < $< > $@ || rm $@ %.pc: %.pc.in Makefile @@ -135,7 +136,7 @@ UNINSTALL_EXEC_HOOKS += libudev-uninstall-move-hook # ------------------------------------------------------------------------------ udev-confdirs: -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d - -mkdir -p $(DESTDIR)$(libexecdir)/devices + -mkdir -p $(DESTDIR)$(libexecdir)/udev/devices INSTALL_DATA_HOOKS += udev-confdirs @@ -143,7 +144,7 @@ EXTRA_DIST += \ rules/arch \ rules/misc -udevrulesdir = $(libexecdir)/rules.d +udevrulesdir = $(libexecdir)/udev/rules.d dist_udevrules_DATA = \ rules/rules.d/50-udev-default.rules \ rules/rules.d/60-persistent-storage-tape.rules \ @@ -199,7 +200,7 @@ endif bin_PROGRAMS = \ udev/udevadm -libexec_PROGRAMS = \ +pkglibexec_PROGRAMS = \ udev/udevd udev_common_sources = \ @@ -311,14 +312,14 @@ udev_test_udev_CPPFLAGS = $(udev_common_CPPFLAGS) # ------------------------------------------------------------------------------ extras_ata_id_ata_id_SOURCES = extras/ata_id/ata_id.c extras_ata_id_ata_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/ata_id/ata_id +pkglibexec_PROGRAMS += extras/ata_id/ata_id # ------------------------------------------------------------------------------ # cdrom_id - optical drive/media capability # ------------------------------------------------------------------------------ extras_cdrom_id_cdrom_id_SOURCES = extras/cdrom_id/cdrom_id.c extras_cdrom_id_cdrom_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/cdrom_id/cdrom_id +pkglibexec_PROGRAMS += extras/cdrom_id/cdrom_id dist_udevrules_DATA += extras/cdrom_id/60-cdrom_id.rules # ------------------------------------------------------------------------------ @@ -326,7 +327,7 @@ dist_udevrules_DATA += extras/cdrom_id/60-cdrom_id.rules # ------------------------------------------------------------------------------ extras_collect_collect_SOURCES = extras/collect/collect.c extras_collect_collect_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/collect/collect +pkglibexec_PROGRAMS += extras/collect/collect # ------------------------------------------------------------------------------ # scsi_id - SCSI inquiry to get various serial numbers @@ -337,7 +338,7 @@ extras_scsi_id_scsi_id_SOURCES =\ extras/scsi_id/scsi.h \ extras/scsi_id/scsi_id.h extras_scsi_id_scsi_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/scsi_id/scsi_id +pkglibexec_PROGRAMS += extras/scsi_id/scsi_id dist_man_MANS += extras/scsi_id/scsi_id.8 EXTRA_DIST += extras/scsi_id/README @@ -346,7 +347,7 @@ EXTRA_DIST += extras/scsi_id/README # ------------------------------------------------------------------------------ extras_v4l_id_v4l_id_SOURCES = extras/v4l_id/v4l_id.c extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/v4l_id/v4l_id +pkglibexec_PROGRAMS += extras/v4l_id/v4l_id dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules # ------------------------------------------------------------------------------ @@ -354,7 +355,7 @@ dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules # ------------------------------------------------------------------------------ extras_accelerometer_accelerometer_SOURCES = extras/accelerometer/accelerometer.c extras_accelerometer_accelerometer_LDADD = libudev/libudev-private.la -lm -libexec_PROGRAMS += extras/accelerometer/accelerometer +pkglibexec_PROGRAMS += extras/accelerometer/accelerometer dist_udevrules_DATA += extras/accelerometer/61-accelerometer.rules # ------------------------------------------------------------------------------ @@ -521,15 +522,15 @@ nodist_extras_keymap_keymap_SOURCES = \ extras/keymap/keys-to-name.h BUILT_SOURCES += $(nodist_extras_keymap_keymap_SOURCES) -libexec_PROGRAMS += extras/keymap/keymap +pkglibexec_PROGRAMS += extras/keymap/keymap dist_doc_DATA = extras/keymap/README.keymap.txt dist_udevrules_DATA += \ extras/keymap/95-keymap.rules \ extras/keymap/95-keyboard-force-release.rules -dist_libexec_SCRIPTS += extras/keymap/findkeyboards -libexec_SCRIPTS += extras/keymap/keyboard-force-release.sh +dist_pkglibexec_SCRIPTS += extras/keymap/findkeyboards +pkglibexec_SCRIPTS += extras/keymap/keyboard-force-release.sh EXTRA_DIST += \ extras/keymap/check-keymaps.sh \ @@ -540,7 +541,7 @@ CLEANFILES += \ extras/keymap/keys-from-name.gperf \ extras/keymap/keyboard-force-release.sh -udevkeymapdir = $(libexecdir)/keymaps +udevkeymapdir = $(libexecdir)/udev/keymaps dist_udevkeymap_DATA = \ extras/keymap/keymaps/acer \ extras/keymap/keymaps/acer-aspire_5720 \ @@ -599,7 +600,7 @@ dist_udevkeymap_DATA = \ extras/keymap/keymaps/toshiba-satellite_m30x \ extras/keymap/keymaps/zepto-znote -udevkeymapforcereldir = $(libexecdir)/keymaps/force-release +udevkeymapforcereldir = $(libexecdir)/udev/keymaps/force-release dist_udevkeymapforcerel_DATA = \ extras/keymap/force-release-maps/dell-touchpad \ extras/keymap/force-release-maps/hp-other \ @@ -634,21 +635,19 @@ extras_mtd_probe_mtd_probe_SOURCES = \ extras/mtd_probe/probe_smartmedia.c extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules -libexec_PROGRAMS += extras/mtd_probe/mtd_probe +pkglibexec_PROGRAMS += extras/mtd_probe/mtd_probe endif if ENABLE_RULE_GENERATOR # ------------------------------------------------------------------------------ # rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ -dist_libexec_SCRIPTS += \ +dist_pkglibexec_SCRIPTS += \ extras/rule_generator/write_cd_rules \ extras/rule_generator/write_net_rules -udevhomedir = $(libexecdir) -dist_udevhome_DATA = extras/rule_generator/rule_generator.functions - -dist_udevrules_DATA += \ +pkglibexec_DATA = extras/rule_generator/rule_generator.functions +dist_pkglibexec_DATA += \ extras/rule_generator/75-cd-aliases-generator.rules \ extras/rule_generator/75-persistent-net-generator.rules endif @@ -661,11 +660,11 @@ extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) dist_udevrules_DATA += extras/udev-acl/70-udev-acl.rules -libexec_PROGRAMS += extras/udev-acl/udev-acl +pkglibexec_PROGRAMS += extras/udev-acl/udev-acl udevacl-install-hook: mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d - ln -sf $(libexecdir)/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck + ln -sf $(libexecdir)/udev/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck INSTALL_EXEC_HOOKS += udevacl-install-hook endif @@ -676,7 +675,7 @@ if ENABLE_FLOPPY # ------------------------------------------------------------------------------ extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/floppy/create_floppy_devices +pkglibexec_PROGRAMS += extras/floppy/create_floppy_devices dist_udevrules_DATA += extras/floppy/60-floppy.rules endif @@ -686,7 +685,7 @@ if ENABLE_EDD # ------------------------------------------------------------------------------ extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c extras_edd_id_edd_id_LDADD = libudev/libudev-private.la -libexec_PROGRAMS += extras/edd_id/edd_id +pkglibexec_PROGRAMS += extras/edd_id/edd_id dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules endif diff --git a/NEWS b/NEWS index f65ae0d7b0..1210ed5a73 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,9 @@ The default install location of the 'udevadm' tool moved from 'sbin' to /usr/bin. Some tools expect udevadm in 'sbin'. A symlink to udevadm needs to be manually created if needed. +The expected value of '--libexecdir' has changed and must no longer contain +the 'udev' directory. + Kernel modules are now loaded directly by linking udev to 'libkmod'. The 'modprobe' tool is no longer executed by udev. diff --git a/autogen.sh b/autogen.sh index 683c498025..fdbff66c48 100755 --- a/autogen.sh +++ b/autogen.sh @@ -16,7 +16,7 @@ args="\ --bindir=/sbin \ --libdir=$(libdir /usr/lib) \ --with-rootlibdir=$(libdir /lib) \ ---libexecdir=/lib/udev \ +--libexecdir=/lib \ --with-systemdsystemunitdir=/lib/systemd/system \ --with-selinux \ --enable-gtk-doc" diff --git a/extras/keymap/keyboard-force-release.sh.in b/extras/keymap/keyboard-force-release.sh.in index ce91a154b8..154be3d733 100755 --- a/extras/keymap/keyboard-force-release.sh.in +++ b/extras/keymap/keyboard-force-release.sh.in @@ -6,7 +6,7 @@ case "$2" in /*) scf="$2" ;; - *) scf="@libexecdir@/keymaps/force-release/$2" ;; + *) scf="@pkglibexecdir@/keymaps/force-release/$2" ;; esac read attr <"/sys/$1/force_release" diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c index fadd7a31d2..79fd0599a9 100644 --- a/extras/keymap/keymap.c +++ b/extras/keymap/keymap.c @@ -423,7 +423,7 @@ int main(int argc, char **argv) if (f) { merge_table(fd, f); } else { - snprintf(keymap_path, sizeof(keymap_path), "%s%s", LIBEXECDIR "/keymaps/", filearg); + snprintf(keymap_path, sizeof(keymap_path), "%s%s", PKGLIBEXECDIR "/keymaps/", filearg); f = fopen(keymap_path, "r"); if (f) merge_table(fd, f); diff --git a/libudev/libudev.c b/libudev/libudev.c index ca2ac5d030..f0f59e3a4d 100644 --- a/libudev/libudev.c +++ b/libudev/libudev.c @@ -256,7 +256,7 @@ UDEV_EXPORT struct udev *udev_new(void) if (udev->rules_path[0] == NULL) { /* /usr/lib/udev -- system rules */ - udev->rules_path[0] = strdup(LIBEXECDIR "/rules.d"); + udev->rules_path[0] = strdup(PKGLIBEXECDIR "/rules.d"); if (!udev->rules_path[0]) goto err; diff --git a/systemd/udev.service.in b/systemd/udev.service.in index 000721810b..c27eb1baf5 100644 --- a/systemd/udev.service.in +++ b/systemd/udev.service.in @@ -11,4 +11,4 @@ Type=notify OOMScoreAdjust=-1000 Sockets=udev-control.socket udev-kernel.socket Restart=on-failure -ExecStart=@libexecdir@/udevd +ExecStart=@pkglibexecdir@/udevd diff --git a/udev/udev-event.c b/udev/udev-event.c index 3801f23a6b..859d811bff 100644 --- a/udev/udev-event.c +++ b/udev/udev-event.c @@ -721,7 +721,7 @@ int udev_event_spawn(struct udev_event *event, /* allow programs in /usr/lib/udev/ to be called without the path */ if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), LIBEXECDIR "/", argv[0], NULL); + util_strscpyl(program, sizeof(program), PKGLIBEXECDIR "/", argv[0], NULL); argv[0] = program; } diff --git a/udev/udev.pc.in b/udev/udev.pc.in index 92a8b3ee17..0b04c02ef6 100644 --- a/udev/udev.pc.in +++ b/udev/udev.pc.in @@ -2,4 +2,4 @@ Name: udev Description: udev Version: @VERSION@ -udevdir=@libexecdir@ +udevdir=@pkglibexecdir@ diff --git a/udev/udev.xml b/udev/udev.xml index fca0dad7bf..79213b4bbe 100644 --- a/udev/udev.xml +++ b/udev/udev.xml @@ -387,11 +387,9 @@ this or a dependent device. Long running tasks need to be immediately detached from the event process itself. If no absolute path is given, the program is expected to live in - the directory provided at compile-time to configure via --libexecdir - (this is usually /usr/lib/udev), otherwise the absolute - path must be specified. The program name and following arguments are - separated by spaces. Single quotes can be used to specify arguments with - spaces. + /usr/lib/udev, otherwise the absolute path must be specified. The program + name and following arguments are separated by spaces. Single quotes can + be used to specify arguments with spaces. diff --git a/udev/udevd.c b/udev/udevd.c index 6b561977dc..196e63fd0d 100644 --- a/udev/udevd.c +++ b/udev/udevd.c @@ -976,7 +976,7 @@ static void static_dev_create_from_devices(struct udev *udev, DIR *dir) { DIR *dir_from; - dir_from = opendir(LIBEXECDIR "/devices"); + dir_from = opendir(PKGLIBEXECDIR "/devices"); if (dir_from == NULL) return; copy_dev_dir(udev, dir_from, dir, 8); -- cgit v1.2.3-54-g00ecf From 9fbe27d9d6dc6e4530ce904d35c74326e415e34e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 Jan 2012 19:22:03 +0100 Subject: autogen.sh: enable git pre-commit --- autogen.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autogen.sh b/autogen.sh index fdbff66c48..582a8a3af4 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,6 +2,12 @@ set -e +if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then + cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \ + chmod +x .git/hooks/pre-commit && \ + echo "Activated pre-commit hook." +fi + gtkdocize autoreconf --install --symlink -- cgit v1.2.3-54-g00ecf From ad29a9f14fa8b1932c0e418bfcf1c10ce6a35a33 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 5 Jan 2012 22:41:45 +0100 Subject: merge udev/, libudev/, systemd/ files in src/; move extras/ to src/ --- .gitignore | 4 + Makefile.am | 644 ++--- configure.ac | 10 +- extras/accelerometer/.gitignore | 1 - extras/accelerometer/61-accelerometer.rules | 3 - extras/accelerometer/accelerometer.c | 357 --- extras/ata_id/.gitignore | 1 - extras/ata_id/ata_id.c | 726 ------ extras/cdrom_id/.gitignore | 1 - extras/cdrom_id/60-cdrom_id.rules | 18 - extras/cdrom_id/cdrom_id.c | 1099 -------- extras/collect/.gitignore | 1 - extras/collect/collect.c | 473 ---- extras/edd_id/.gitignore | 1 - extras/edd_id/61-persistent-storage-edd.rules | 12 - extras/edd_id/edd_id.c | 196 -- extras/floppy/.gitignore | 1 - extras/floppy/60-floppy.rules | 4 - extras/floppy/create_floppy_devices.c | 177 -- extras/gudev/.gitignore | 9 - extras/gudev/COPYING | 504 ---- extras/gudev/docs/.gitignore | 17 - extras/gudev/docs/Makefile.am | 106 - extras/gudev/docs/gudev-docs.xml | 93 - extras/gudev/docs/gudev-sections.txt | 113 - extras/gudev/docs/gudev.types | 4 - extras/gudev/docs/version.xml.in | 1 - extras/gudev/gjs-example.js | 75 - extras/gudev/gudev-1.0.pc.in | 11 - extras/gudev/gudev.h | 33 - extras/gudev/gudevclient.c | 528 ---- extras/gudev/gudevclient.h | 100 - extras/gudev/gudevdevice.c | 964 ------- extras/gudev/gudevdevice.h | 128 - extras/gudev/gudevenumerator.c | 431 --- extras/gudev/gudevenumerator.h | 107 - extras/gudev/gudevenums.h | 49 - extras/gudev/gudevenumtypes.c.template | 39 - extras/gudev/gudevenumtypes.h.template | 24 - extras/gudev/gudevmarshal.list | 1 - extras/gudev/gudevprivate.h | 41 - extras/gudev/gudevtypes.h | 51 - extras/gudev/seed-example-enum.js | 38 - extras/gudev/seed-example.js | 72 - extras/keymap/.gitignore | 6 - extras/keymap/95-keyboard-force-release.rules | 53 - extras/keymap/95-keymap.rules | 164 -- extras/keymap/README.keymap.txt | 101 - extras/keymap/check-keymaps.sh | 38 - extras/keymap/findkeyboards | 71 - .../keymap/force-release-maps/common-volume-keys | 3 - extras/keymap/force-release-maps/dell-touchpad | 1 - extras/keymap/force-release-maps/hp-other | 3 - extras/keymap/force-release-maps/samsung-other | 10 - extras/keymap/keyboard-force-release.sh.in | 22 - extras/keymap/keymap.c | 447 ---- extras/keymap/keymaps/acer | 22 - extras/keymap/keymaps/acer-aspire_5720 | 5 - extras/keymap/keymaps/acer-aspire_5920g | 5 - extras/keymap/keymaps/acer-aspire_6920 | 5 - extras/keymap/keymaps/acer-aspire_8930 | 6 - extras/keymap/keymaps/acer-travelmate_c300 | 5 - extras/keymap/keymaps/asus | 3 - extras/keymap/keymaps/compaq-e_evo | 4 - extras/keymap/keymaps/dell | 29 - extras/keymap/keymaps/dell-latitude-xt2 | 4 - extras/keymap/keymaps/everex-xt5000 | 7 - extras/keymap/keymaps/fujitsu-amilo_pa_2548 | 3 - .../keymap/keymaps/fujitsu-amilo_pro_edition_v3505 | 4 - extras/keymap/keymaps/fujitsu-amilo_pro_v3205 | 2 - extras/keymap/keymaps/fujitsu-amilo_si_1520 | 6 - extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 | 4 - extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 | 2 - extras/keymap/keymaps/genius-slimstar-320 | 35 - extras/keymap/keymaps/hewlett-packard | 12 - extras/keymap/keymaps/hewlett-packard-2510p_2530p | 2 - .../keymaps/hewlett-packard-compaq_elitebook | 2 - extras/keymap/keymaps/hewlett-packard-pavilion | 3 - .../keymap/keymaps/hewlett-packard-presario-2100 | 3 - extras/keymap/keymaps/hewlett-packard-tablet | 6 - extras/keymap/keymaps/hewlett-packard-tx2 | 3 - .../keymaps/ibm-thinkpad-usb-keyboard-trackpoint | 7 - extras/keymap/keymaps/inventec-symphony_6.0_7.0 | 2 - extras/keymap/keymaps/lenovo-3000 | 5 - extras/keymap/keymaps/lenovo-ideapad | 7 - .../lenovo-thinkpad-usb-keyboard-trackpoint | 13 - extras/keymap/keymaps/lenovo-thinkpad_x200_tablet | 6 - extras/keymap/keymaps/lenovo-thinkpad_x6_tablet | 8 - extras/keymap/keymaps/lg-x110 | 12 - extras/keymap/keymaps/logitech-wave | 16 - extras/keymap/keymaps/logitech-wave-cordless | 15 - extras/keymap/keymaps/logitech-wave-pro-cordless | 12 - extras/keymap/keymaps/maxdata-pro_7000 | 9 - extras/keymap/keymaps/medion-fid2060 | 2 - extras/keymap/keymaps/medionnb-a555 | 4 - extras/keymap/keymaps/micro-star | 13 - extras/keymap/keymaps/module-asus-w3j | 11 - extras/keymap/keymaps/module-ibm | 16 - extras/keymap/keymaps/module-lenovo | 17 - extras/keymap/keymaps/module-sony | 8 - extras/keymap/keymaps/module-sony-old | 2 - extras/keymap/keymaps/module-sony-vgn | 8 - extras/keymap/keymaps/olpc-xo | 74 - extras/keymap/keymaps/onkyo | 14 - extras/keymap/keymaps/oqo-model2 | 5 - extras/keymap/keymaps/samsung-other | 14 - extras/keymap/keymaps/samsung-sq1us | 7 - extras/keymap/keymaps/samsung-sx20s | 4 - extras/keymap/keymaps/toshiba-satellite_a100 | 2 - extras/keymap/keymaps/toshiba-satellite_a110 | 10 - extras/keymap/keymaps/toshiba-satellite_m30x | 7 - extras/keymap/keymaps/zepto-znote | 11 - extras/mtd_probe/.gitignore | 1 - extras/mtd_probe/75-probe_mtd.rules | 8 - extras/mtd_probe/mtd_probe.c | 51 - extras/mtd_probe/mtd_probe.h | 49 - extras/mtd_probe/probe_smartmedia.c | 97 - extras/qemu/42-qemu-usb.rules | 13 - .../rule_generator/75-cd-aliases-generator.rules | 9 - .../75-persistent-net-generator.rules | 103 - extras/rule_generator/rule_generator.functions | 113 - extras/rule_generator/write_cd_rules | 127 - extras/rule_generator/write_net_rules | 141 - extras/scsi_id/.gitignore | 3 - extras/scsi_id/README | 4 - extras/scsi_id/scsi.h | 97 - extras/scsi_id/scsi_id.8 | 119 - extras/scsi_id/scsi_id.c | 657 ----- extras/scsi_id/scsi_id.h | 74 - extras/scsi_id/scsi_serial.c | 990 ------- extras/udev-acl/.gitignore | 1 - extras/udev-acl/70-udev-acl.rules | 76 - extras/udev-acl/udev-acl.c | 430 --- extras/v4l_id/.gitignore | 1 - extras/v4l_id/60-persistent-v4l.rules | 20 - extras/v4l_id/v4l_id.c | 87 - libudev/.gitignore | 4 - libudev/COPYING | 504 ---- libudev/docs/.gitignore | 18 - libudev/docs/Makefile.am | 99 - libudev/docs/libudev-docs.xml | 32 - libudev/docs/libudev-overrides.txt | 0 libudev/docs/libudev-sections.txt | 127 - libudev/docs/libudev.types | 0 libudev/docs/version.xml.in | 1 - libudev/libudev-device-private.c | 185 -- libudev/libudev-device.c | 1737 ------------ libudev/libudev-enumerate.c | 947 ------- libudev/libudev-list.c | 344 --- libudev/libudev-monitor.c | 875 ------- libudev/libudev-private.h | 213 -- libudev/libudev-queue-private.c | 412 --- libudev/libudev-queue.c | 474 ---- libudev/libudev-selinux-private.c | 109 - libudev/libudev-util-private.c | 242 -- libudev/libudev-util.c | 568 ---- libudev/libudev.c | 457 ---- libudev/libudev.h | 189 -- libudev/libudev.pc.in | 11 - libudev/test-libudev.c | 501 ---- src/.gitignore | 6 + src/COPYING | 502 ++++ src/docs/.gitignore | 17 + src/docs/Makefile.am | 99 + src/docs/libudev-docs.xml | 32 + src/docs/libudev-sections.txt | 127 + src/docs/libudev.types | 0 src/docs/version.xml.in | 1 + src/extras/accelerometer/.gitignore | 1 + src/extras/accelerometer/61-accelerometer.rules | 3 + src/extras/accelerometer/accelerometer.c | 357 +++ src/extras/ata_id/.gitignore | 1 + src/extras/ata_id/ata_id.c | 726 ++++++ src/extras/cdrom_id/.gitignore | 1 + src/extras/cdrom_id/60-cdrom_id.rules | 18 + src/extras/cdrom_id/cdrom_id.c | 1099 ++++++++ src/extras/collect/.gitignore | 1 + src/extras/collect/collect.c | 473 ++++ src/extras/edd_id/.gitignore | 1 + src/extras/edd_id/61-persistent-storage-edd.rules | 12 + src/extras/edd_id/edd_id.c | 196 ++ src/extras/floppy/.gitignore | 1 + src/extras/floppy/60-floppy.rules | 4 + src/extras/floppy/create_floppy_devices.c | 177 ++ src/extras/gudev/.gitignore | 9 + src/extras/gudev/COPYING | 502 ++++ src/extras/gudev/docs/.gitignore | 16 + src/extras/gudev/docs/Makefile.am | 106 + src/extras/gudev/docs/gudev-docs.xml | 93 + src/extras/gudev/docs/gudev-sections.txt | 113 + src/extras/gudev/docs/gudev.types | 4 + src/extras/gudev/docs/version.xml.in | 1 + src/extras/gudev/gjs-example.js | 75 + src/extras/gudev/gudev-1.0.pc.in | 11 + src/extras/gudev/gudev.h | 33 + src/extras/gudev/gudevclient.c | 527 ++++ src/extras/gudev/gudevclient.h | 100 + src/extras/gudev/gudevdevice.c | 963 +++++++ src/extras/gudev/gudevdevice.h | 128 + src/extras/gudev/gudevenumerator.c | 431 +++ src/extras/gudev/gudevenumerator.h | 107 + src/extras/gudev/gudevenums.h | 49 + src/extras/gudev/gudevenumtypes.c.template | 39 + src/extras/gudev/gudevenumtypes.h.template | 24 + src/extras/gudev/gudevmarshal.list | 1 + src/extras/gudev/gudevprivate.h | 41 + src/extras/gudev/gudevtypes.h | 51 + src/extras/gudev/seed-example-enum.js | 38 + src/extras/gudev/seed-example.js | 72 + src/extras/keymap/.gitignore | 6 + src/extras/keymap/95-keyboard-force-release.rules | 53 + src/extras/keymap/95-keymap.rules | 164 ++ src/extras/keymap/README.keymap.txt | 101 + src/extras/keymap/check-keymaps.sh | 38 + src/extras/keymap/findkeyboards | 71 + .../keymap/force-release-maps/common-volume-keys | 3 + src/extras/keymap/force-release-maps/dell-touchpad | 1 + src/extras/keymap/force-release-maps/hp-other | 3 + src/extras/keymap/force-release-maps/samsung-other | 10 + src/extras/keymap/keyboard-force-release.sh.in | 22 + src/extras/keymap/keymap.c | 447 ++++ src/extras/keymap/keymaps/acer | 22 + src/extras/keymap/keymaps/acer-aspire_5720 | 4 + src/extras/keymap/keymaps/acer-aspire_5920g | 5 + src/extras/keymap/keymaps/acer-aspire_6920 | 5 + src/extras/keymap/keymaps/acer-aspire_8930 | 5 + src/extras/keymap/keymaps/acer-travelmate_c300 | 5 + src/extras/keymap/keymaps/asus | 3 + src/extras/keymap/keymaps/compaq-e_evo | 4 + src/extras/keymap/keymaps/dell | 29 + src/extras/keymap/keymaps/dell-latitude-xt2 | 4 + src/extras/keymap/keymaps/everex-xt5000 | 7 + src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 | 3 + .../keymap/keymaps/fujitsu-amilo_pro_edition_v3505 | 4 + src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 | 2 + src/extras/keymap/keymaps/fujitsu-amilo_si_1520 | 6 + .../keymap/keymaps/fujitsu-esprimo_mobile_v5 | 4 + .../keymap/keymaps/fujitsu-esprimo_mobile_v6 | 2 + src/extras/keymap/keymaps/genius-slimstar-320 | 35 + src/extras/keymap/keymaps/hewlett-packard | 12 + .../keymap/keymaps/hewlett-packard-2510p_2530p | 2 + .../keymaps/hewlett-packard-compaq_elitebook | 2 + src/extras/keymap/keymaps/hewlett-packard-pavilion | 3 + .../keymap/keymaps/hewlett-packard-presario-2100 | 3 + src/extras/keymap/keymaps/hewlett-packard-tablet | 6 + src/extras/keymap/keymaps/hewlett-packard-tx2 | 3 + .../keymaps/ibm-thinkpad-usb-keyboard-trackpoint | 7 + .../keymap/keymaps/inventec-symphony_6.0_7.0 | 2 + src/extras/keymap/keymaps/lenovo-3000 | 5 + src/extras/keymap/keymaps/lenovo-ideapad | 7 + .../lenovo-thinkpad-usb-keyboard-trackpoint | 13 + .../keymap/keymaps/lenovo-thinkpad_x200_tablet | 6 + .../keymap/keymaps/lenovo-thinkpad_x6_tablet | 8 + src/extras/keymap/keymaps/lg-x110 | 12 + src/extras/keymap/keymaps/logitech-wave | 16 + src/extras/keymap/keymaps/logitech-wave-cordless | 15 + .../keymap/keymaps/logitech-wave-pro-cordless | 12 + src/extras/keymap/keymaps/maxdata-pro_7000 | 9 + src/extras/keymap/keymaps/medion-fid2060 | 2 + src/extras/keymap/keymaps/medionnb-a555 | 4 + src/extras/keymap/keymaps/micro-star | 13 + src/extras/keymap/keymaps/module-asus-w3j | 11 + src/extras/keymap/keymaps/module-ibm | 16 + src/extras/keymap/keymaps/module-lenovo | 17 + src/extras/keymap/keymaps/module-sony | 8 + src/extras/keymap/keymaps/module-sony-old | 2 + src/extras/keymap/keymaps/module-sony-vgn | 8 + src/extras/keymap/keymaps/olpc-xo | 74 + src/extras/keymap/keymaps/onkyo | 14 + src/extras/keymap/keymaps/oqo-model2 | 5 + src/extras/keymap/keymaps/samsung-other | 14 + src/extras/keymap/keymaps/samsung-sq1us | 7 + src/extras/keymap/keymaps/samsung-sx20s | 4 + src/extras/keymap/keymaps/toshiba-satellite_a100 | 2 + src/extras/keymap/keymaps/toshiba-satellite_a110 | 10 + src/extras/keymap/keymaps/toshiba-satellite_m30x | 6 + src/extras/keymap/keymaps/zepto-znote | 11 + src/extras/mtd_probe/.gitignore | 1 + src/extras/mtd_probe/75-probe_mtd.rules | 8 + src/extras/mtd_probe/mtd_probe.c | 51 + src/extras/mtd_probe/mtd_probe.h | 49 + src/extras/mtd_probe/probe_smartmedia.c | 97 + src/extras/qemu/42-qemu-usb.rules | 13 + .../rule_generator/75-cd-aliases-generator.rules | 9 + .../75-persistent-net-generator.rules | 102 + src/extras/rule_generator/rule_generator.functions | 113 + src/extras/rule_generator/write_cd_rules | 126 + src/extras/rule_generator/write_net_rules | 141 + src/extras/scsi_id/.gitignore | 3 + src/extras/scsi_id/README | 4 + src/extras/scsi_id/scsi.h | 97 + src/extras/scsi_id/scsi_id.8 | 119 + src/extras/scsi_id/scsi_id.c | 657 +++++ src/extras/scsi_id/scsi_id.h | 73 + src/extras/scsi_id/scsi_serial.c | 990 +++++++ src/extras/udev-acl/.gitignore | 1 + src/extras/udev-acl/70-udev-acl.rules | 76 + src/extras/udev-acl/udev-acl.c | 430 +++ src/extras/v4l_id/.gitignore | 1 + src/extras/v4l_id/60-persistent-v4l.rules | 20 + src/extras/v4l_id/v4l_id.c | 87 + src/libudev-device-private.c | 185 ++ src/libudev-device.c | 1737 ++++++++++++ src/libudev-enumerate.c | 947 +++++++ src/libudev-list.c | 344 +++ src/libudev-monitor.c | 875 +++++++ src/libudev-private.h | 213 ++ src/libudev-queue-private.c | 412 +++ src/libudev-queue.c | 474 ++++ src/libudev-selinux-private.c | 109 + src/libudev-util-private.c | 242 ++ src/libudev-util.c | 568 ++++ src/libudev.c | 457 ++++ src/libudev.h | 189 ++ src/libudev.pc.in | 11 + src/sd-daemon.c | 526 ++++ src/sd-daemon.h | 277 ++ src/test-libudev.c | 501 ++++ src/test-udev.c | 121 + src/udev-builtin-blkid.c | 207 ++ src/udev-builtin-firmware.c | 168 ++ src/udev-builtin-hwdb.c | 247 ++ src/udev-builtin-input_id.c | 218 ++ src/udev-builtin-kmod.c | 146 ++ src/udev-builtin-path_id.c | 487 ++++ src/udev-builtin-usb_id.c | 482 ++++ src/udev-builtin.c | 134 + src/udev-control.socket | 10 + src/udev-ctrl.c | 494 ++++ src/udev-event.c | 1005 +++++++ src/udev-kernel.socket | 10 + src/udev-node.c | 385 +++ src/udev-rules.c | 2753 ++++++++++++++++++++ src/udev-settle.service.in | 25 + src/udev-trigger.service.in | 10 + src/udev-watch.c | 170 ++ src/udev.conf | 4 + src/udev.h | 188 ++ src/udev.pc.in | 5 + src/udev.service.in | 14 + src/udev.xml | 694 +++++ src/udevadm-control.c | 175 ++ src/udevadm-info.c | 568 ++++ src/udevadm-monitor.c | 297 +++ src/udevadm-settle.c | 235 ++ src/udevadm-test-builtin.c | 128 + src/udevadm-test.c | 173 ++ src/udevadm-trigger.c | 232 ++ src/udevadm.c | 165 ++ src/udevadm.xml | 472 ++++ src/udevd.c | 1708 ++++++++++++ src/udevd.xml | 151 ++ systemd/.gitignore | 1 - systemd/udev-control.socket | 10 - systemd/udev-kernel.socket | 10 - systemd/udev-settle.service.in | 25 - systemd/udev-trigger.service.in | 10 - systemd/udev.service.in | 14 - test/udev-test.pl.in | 2 +- udev.conf | 4 - udev/.gitignore | 6 - udev/sd-daemon.c | 526 ---- udev/sd-daemon.h | 277 -- udev/test-udev.c | 121 - udev/udev-builtin-blkid.c | 207 -- udev/udev-builtin-firmware.c | 168 -- udev/udev-builtin-hwdb.c | 247 -- udev/udev-builtin-input_id.c | 218 -- udev/udev-builtin-kmod.c | 146 -- udev/udev-builtin-path_id.c | 487 ---- udev/udev-builtin-usb_id.c | 482 ---- udev/udev-builtin.c | 134 - udev/udev-ctrl.c | 494 ---- udev/udev-event.c | 1005 ------- udev/udev-node.c | 385 --- udev/udev-rules.c | 2753 -------------------- udev/udev-watch.c | 170 -- udev/udev.h | 188 -- udev/udev.pc.in | 5 - udev/udev.xml | 694 ----- udev/udevadm-control.c | 175 -- udev/udevadm-info.c | 568 ---- udev/udevadm-monitor.c | 297 --- udev/udevadm-settle.c | 235 -- udev/udevadm-test-builtin.c | 128 - udev/udevadm-test.c | 173 -- udev/udevadm-trigger.c | 232 -- udev/udevadm.c | 165 -- udev/udevadm.xml | 472 ---- udev/udevd.c | 1708 ------------ udev/udevd.xml | 151 -- 391 files changed, 32777 insertions(+), 32790 deletions(-) delete mode 100644 extras/accelerometer/.gitignore delete mode 100644 extras/accelerometer/61-accelerometer.rules delete mode 100644 extras/accelerometer/accelerometer.c delete mode 100644 extras/ata_id/.gitignore delete mode 100644 extras/ata_id/ata_id.c delete mode 100644 extras/cdrom_id/.gitignore delete mode 100644 extras/cdrom_id/60-cdrom_id.rules delete mode 100644 extras/cdrom_id/cdrom_id.c delete mode 100644 extras/collect/.gitignore delete mode 100644 extras/collect/collect.c delete mode 100644 extras/edd_id/.gitignore delete mode 100644 extras/edd_id/61-persistent-storage-edd.rules delete mode 100644 extras/edd_id/edd_id.c delete mode 100644 extras/floppy/.gitignore delete mode 100644 extras/floppy/60-floppy.rules delete mode 100644 extras/floppy/create_floppy_devices.c delete mode 100644 extras/gudev/.gitignore delete mode 100644 extras/gudev/COPYING delete mode 100644 extras/gudev/docs/.gitignore delete mode 100644 extras/gudev/docs/Makefile.am delete mode 100644 extras/gudev/docs/gudev-docs.xml delete mode 100644 extras/gudev/docs/gudev-sections.txt delete mode 100644 extras/gudev/docs/gudev.types delete mode 100644 extras/gudev/docs/version.xml.in delete mode 100755 extras/gudev/gjs-example.js delete mode 100644 extras/gudev/gudev-1.0.pc.in delete mode 100644 extras/gudev/gudev.h delete mode 100644 extras/gudev/gudevclient.c delete mode 100644 extras/gudev/gudevclient.h delete mode 100644 extras/gudev/gudevdevice.c delete mode 100644 extras/gudev/gudevdevice.h delete mode 100644 extras/gudev/gudevenumerator.c delete mode 100644 extras/gudev/gudevenumerator.h delete mode 100644 extras/gudev/gudevenums.h delete mode 100644 extras/gudev/gudevenumtypes.c.template delete mode 100644 extras/gudev/gudevenumtypes.h.template delete mode 100644 extras/gudev/gudevmarshal.list delete mode 100644 extras/gudev/gudevprivate.h delete mode 100644 extras/gudev/gudevtypes.h delete mode 100755 extras/gudev/seed-example-enum.js delete mode 100755 extras/gudev/seed-example.js delete mode 100644 extras/keymap/.gitignore delete mode 100644 extras/keymap/95-keyboard-force-release.rules delete mode 100644 extras/keymap/95-keymap.rules delete mode 100644 extras/keymap/README.keymap.txt delete mode 100755 extras/keymap/check-keymaps.sh delete mode 100755 extras/keymap/findkeyboards delete mode 100644 extras/keymap/force-release-maps/common-volume-keys delete mode 100644 extras/keymap/force-release-maps/dell-touchpad delete mode 100644 extras/keymap/force-release-maps/hp-other delete mode 100644 extras/keymap/force-release-maps/samsung-other delete mode 100755 extras/keymap/keyboard-force-release.sh.in delete mode 100644 extras/keymap/keymap.c delete mode 100644 extras/keymap/keymaps/acer delete mode 100644 extras/keymap/keymaps/acer-aspire_5720 delete mode 100644 extras/keymap/keymaps/acer-aspire_5920g delete mode 100644 extras/keymap/keymaps/acer-aspire_6920 delete mode 100644 extras/keymap/keymaps/acer-aspire_8930 delete mode 100644 extras/keymap/keymaps/acer-travelmate_c300 delete mode 100644 extras/keymap/keymaps/asus delete mode 100644 extras/keymap/keymaps/compaq-e_evo delete mode 100644 extras/keymap/keymaps/dell delete mode 100644 extras/keymap/keymaps/dell-latitude-xt2 delete mode 100644 extras/keymap/keymaps/everex-xt5000 delete mode 100644 extras/keymap/keymaps/fujitsu-amilo_pa_2548 delete mode 100644 extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 delete mode 100644 extras/keymap/keymaps/fujitsu-amilo_pro_v3205 delete mode 100644 extras/keymap/keymaps/fujitsu-amilo_si_1520 delete mode 100644 extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 delete mode 100644 extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 delete mode 100644 extras/keymap/keymaps/genius-slimstar-320 delete mode 100644 extras/keymap/keymaps/hewlett-packard delete mode 100644 extras/keymap/keymaps/hewlett-packard-2510p_2530p delete mode 100644 extras/keymap/keymaps/hewlett-packard-compaq_elitebook delete mode 100644 extras/keymap/keymaps/hewlett-packard-pavilion delete mode 100644 extras/keymap/keymaps/hewlett-packard-presario-2100 delete mode 100644 extras/keymap/keymaps/hewlett-packard-tablet delete mode 100644 extras/keymap/keymaps/hewlett-packard-tx2 delete mode 100644 extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint delete mode 100644 extras/keymap/keymaps/inventec-symphony_6.0_7.0 delete mode 100644 extras/keymap/keymaps/lenovo-3000 delete mode 100644 extras/keymap/keymaps/lenovo-ideapad delete mode 100644 extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint delete mode 100644 extras/keymap/keymaps/lenovo-thinkpad_x200_tablet delete mode 100644 extras/keymap/keymaps/lenovo-thinkpad_x6_tablet delete mode 100644 extras/keymap/keymaps/lg-x110 delete mode 100644 extras/keymap/keymaps/logitech-wave delete mode 100644 extras/keymap/keymaps/logitech-wave-cordless delete mode 100644 extras/keymap/keymaps/logitech-wave-pro-cordless delete mode 100644 extras/keymap/keymaps/maxdata-pro_7000 delete mode 100644 extras/keymap/keymaps/medion-fid2060 delete mode 100644 extras/keymap/keymaps/medionnb-a555 delete mode 100644 extras/keymap/keymaps/micro-star delete mode 100644 extras/keymap/keymaps/module-asus-w3j delete mode 100644 extras/keymap/keymaps/module-ibm delete mode 100644 extras/keymap/keymaps/module-lenovo delete mode 100644 extras/keymap/keymaps/module-sony delete mode 100644 extras/keymap/keymaps/module-sony-old delete mode 100644 extras/keymap/keymaps/module-sony-vgn delete mode 100644 extras/keymap/keymaps/olpc-xo delete mode 100644 extras/keymap/keymaps/onkyo delete mode 100644 extras/keymap/keymaps/oqo-model2 delete mode 100644 extras/keymap/keymaps/samsung-other delete mode 100644 extras/keymap/keymaps/samsung-sq1us delete mode 100644 extras/keymap/keymaps/samsung-sx20s delete mode 100644 extras/keymap/keymaps/toshiba-satellite_a100 delete mode 100644 extras/keymap/keymaps/toshiba-satellite_a110 delete mode 100644 extras/keymap/keymaps/toshiba-satellite_m30x delete mode 100644 extras/keymap/keymaps/zepto-znote delete mode 100644 extras/mtd_probe/.gitignore delete mode 100644 extras/mtd_probe/75-probe_mtd.rules delete mode 100644 extras/mtd_probe/mtd_probe.c delete mode 100644 extras/mtd_probe/mtd_probe.h delete mode 100644 extras/mtd_probe/probe_smartmedia.c delete mode 100644 extras/qemu/42-qemu-usb.rules delete mode 100644 extras/rule_generator/75-cd-aliases-generator.rules delete mode 100644 extras/rule_generator/75-persistent-net-generator.rules delete mode 100644 extras/rule_generator/rule_generator.functions delete mode 100644 extras/rule_generator/write_cd_rules delete mode 100644 extras/rule_generator/write_net_rules delete mode 100644 extras/scsi_id/.gitignore delete mode 100644 extras/scsi_id/README delete mode 100644 extras/scsi_id/scsi.h delete mode 100644 extras/scsi_id/scsi_id.8 delete mode 100644 extras/scsi_id/scsi_id.c delete mode 100644 extras/scsi_id/scsi_id.h delete mode 100644 extras/scsi_id/scsi_serial.c delete mode 100644 extras/udev-acl/.gitignore delete mode 100644 extras/udev-acl/70-udev-acl.rules delete mode 100644 extras/udev-acl/udev-acl.c delete mode 100644 extras/v4l_id/.gitignore delete mode 100644 extras/v4l_id/60-persistent-v4l.rules delete mode 100644 extras/v4l_id/v4l_id.c delete mode 100644 libudev/.gitignore delete mode 100644 libudev/COPYING delete mode 100644 libudev/docs/.gitignore delete mode 100644 libudev/docs/Makefile.am delete mode 100644 libudev/docs/libudev-docs.xml delete mode 100644 libudev/docs/libudev-overrides.txt delete mode 100644 libudev/docs/libudev-sections.txt delete mode 100644 libudev/docs/libudev.types delete mode 100644 libudev/docs/version.xml.in delete mode 100644 libudev/libudev-device-private.c delete mode 100644 libudev/libudev-device.c delete mode 100644 libudev/libudev-enumerate.c delete mode 100644 libudev/libudev-list.c delete mode 100644 libudev/libudev-monitor.c delete mode 100644 libudev/libudev-private.h delete mode 100644 libudev/libudev-queue-private.c delete mode 100644 libudev/libudev-queue.c delete mode 100644 libudev/libudev-selinux-private.c delete mode 100644 libudev/libudev-util-private.c delete mode 100644 libudev/libudev-util.c delete mode 100644 libudev/libudev.c delete mode 100644 libudev/libudev.h delete mode 100644 libudev/libudev.pc.in delete mode 100644 libudev/test-libudev.c create mode 100644 src/.gitignore create mode 100644 src/COPYING create mode 100644 src/docs/.gitignore create mode 100644 src/docs/Makefile.am create mode 100644 src/docs/libudev-docs.xml create mode 100644 src/docs/libudev-sections.txt create mode 100644 src/docs/libudev.types create mode 100644 src/docs/version.xml.in create mode 100644 src/extras/accelerometer/.gitignore create mode 100644 src/extras/accelerometer/61-accelerometer.rules create mode 100644 src/extras/accelerometer/accelerometer.c create mode 100644 src/extras/ata_id/.gitignore create mode 100644 src/extras/ata_id/ata_id.c create mode 100644 src/extras/cdrom_id/.gitignore create mode 100644 src/extras/cdrom_id/60-cdrom_id.rules create mode 100644 src/extras/cdrom_id/cdrom_id.c create mode 100644 src/extras/collect/.gitignore create mode 100644 src/extras/collect/collect.c create mode 100644 src/extras/edd_id/.gitignore create mode 100644 src/extras/edd_id/61-persistent-storage-edd.rules create mode 100644 src/extras/edd_id/edd_id.c create mode 100644 src/extras/floppy/.gitignore create mode 100644 src/extras/floppy/60-floppy.rules create mode 100644 src/extras/floppy/create_floppy_devices.c create mode 100644 src/extras/gudev/.gitignore create mode 100644 src/extras/gudev/COPYING create mode 100644 src/extras/gudev/docs/.gitignore create mode 100644 src/extras/gudev/docs/Makefile.am create mode 100644 src/extras/gudev/docs/gudev-docs.xml create mode 100644 src/extras/gudev/docs/gudev-sections.txt create mode 100644 src/extras/gudev/docs/gudev.types create mode 100644 src/extras/gudev/docs/version.xml.in create mode 100755 src/extras/gudev/gjs-example.js create mode 100644 src/extras/gudev/gudev-1.0.pc.in create mode 100644 src/extras/gudev/gudev.h create mode 100644 src/extras/gudev/gudevclient.c create mode 100644 src/extras/gudev/gudevclient.h create mode 100644 src/extras/gudev/gudevdevice.c create mode 100644 src/extras/gudev/gudevdevice.h create mode 100644 src/extras/gudev/gudevenumerator.c create mode 100644 src/extras/gudev/gudevenumerator.h create mode 100644 src/extras/gudev/gudevenums.h create mode 100644 src/extras/gudev/gudevenumtypes.c.template create mode 100644 src/extras/gudev/gudevenumtypes.h.template create mode 100644 src/extras/gudev/gudevmarshal.list create mode 100644 src/extras/gudev/gudevprivate.h create mode 100644 src/extras/gudev/gudevtypes.h create mode 100755 src/extras/gudev/seed-example-enum.js create mode 100755 src/extras/gudev/seed-example.js create mode 100644 src/extras/keymap/.gitignore create mode 100644 src/extras/keymap/95-keyboard-force-release.rules create mode 100644 src/extras/keymap/95-keymap.rules create mode 100644 src/extras/keymap/README.keymap.txt create mode 100755 src/extras/keymap/check-keymaps.sh create mode 100755 src/extras/keymap/findkeyboards create mode 100644 src/extras/keymap/force-release-maps/common-volume-keys create mode 100644 src/extras/keymap/force-release-maps/dell-touchpad create mode 100644 src/extras/keymap/force-release-maps/hp-other create mode 100644 src/extras/keymap/force-release-maps/samsung-other create mode 100755 src/extras/keymap/keyboard-force-release.sh.in create mode 100644 src/extras/keymap/keymap.c create mode 100644 src/extras/keymap/keymaps/acer create mode 100644 src/extras/keymap/keymaps/acer-aspire_5720 create mode 100644 src/extras/keymap/keymaps/acer-aspire_5920g create mode 100644 src/extras/keymap/keymaps/acer-aspire_6920 create mode 100644 src/extras/keymap/keymaps/acer-aspire_8930 create mode 100644 src/extras/keymap/keymaps/acer-travelmate_c300 create mode 100644 src/extras/keymap/keymaps/asus create mode 100644 src/extras/keymap/keymaps/compaq-e_evo create mode 100644 src/extras/keymap/keymaps/dell create mode 100644 src/extras/keymap/keymaps/dell-latitude-xt2 create mode 100644 src/extras/keymap/keymaps/everex-xt5000 create mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 create mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 create mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 create mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_si_1520 create mode 100644 src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 create mode 100644 src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 create mode 100644 src/extras/keymap/keymaps/genius-slimstar-320 create mode 100644 src/extras/keymap/keymaps/hewlett-packard create mode 100644 src/extras/keymap/keymaps/hewlett-packard-2510p_2530p create mode 100644 src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook create mode 100644 src/extras/keymap/keymaps/hewlett-packard-pavilion create mode 100644 src/extras/keymap/keymaps/hewlett-packard-presario-2100 create mode 100644 src/extras/keymap/keymaps/hewlett-packard-tablet create mode 100644 src/extras/keymap/keymaps/hewlett-packard-tx2 create mode 100644 src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint create mode 100644 src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 create mode 100644 src/extras/keymap/keymaps/lenovo-3000 create mode 100644 src/extras/keymap/keymaps/lenovo-ideapad create mode 100644 src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint create mode 100644 src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet create mode 100644 src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet create mode 100644 src/extras/keymap/keymaps/lg-x110 create mode 100644 src/extras/keymap/keymaps/logitech-wave create mode 100644 src/extras/keymap/keymaps/logitech-wave-cordless create mode 100644 src/extras/keymap/keymaps/logitech-wave-pro-cordless create mode 100644 src/extras/keymap/keymaps/maxdata-pro_7000 create mode 100644 src/extras/keymap/keymaps/medion-fid2060 create mode 100644 src/extras/keymap/keymaps/medionnb-a555 create mode 100644 src/extras/keymap/keymaps/micro-star create mode 100644 src/extras/keymap/keymaps/module-asus-w3j create mode 100644 src/extras/keymap/keymaps/module-ibm create mode 100644 src/extras/keymap/keymaps/module-lenovo create mode 100644 src/extras/keymap/keymaps/module-sony create mode 100644 src/extras/keymap/keymaps/module-sony-old create mode 100644 src/extras/keymap/keymaps/module-sony-vgn create mode 100644 src/extras/keymap/keymaps/olpc-xo create mode 100644 src/extras/keymap/keymaps/onkyo create mode 100644 src/extras/keymap/keymaps/oqo-model2 create mode 100644 src/extras/keymap/keymaps/samsung-other create mode 100644 src/extras/keymap/keymaps/samsung-sq1us create mode 100644 src/extras/keymap/keymaps/samsung-sx20s create mode 100644 src/extras/keymap/keymaps/toshiba-satellite_a100 create mode 100644 src/extras/keymap/keymaps/toshiba-satellite_a110 create mode 100644 src/extras/keymap/keymaps/toshiba-satellite_m30x create mode 100644 src/extras/keymap/keymaps/zepto-znote create mode 100644 src/extras/mtd_probe/.gitignore create mode 100644 src/extras/mtd_probe/75-probe_mtd.rules create mode 100644 src/extras/mtd_probe/mtd_probe.c create mode 100644 src/extras/mtd_probe/mtd_probe.h create mode 100644 src/extras/mtd_probe/probe_smartmedia.c create mode 100644 src/extras/qemu/42-qemu-usb.rules create mode 100644 src/extras/rule_generator/75-cd-aliases-generator.rules create mode 100644 src/extras/rule_generator/75-persistent-net-generator.rules create mode 100644 src/extras/rule_generator/rule_generator.functions create mode 100644 src/extras/rule_generator/write_cd_rules create mode 100644 src/extras/rule_generator/write_net_rules create mode 100644 src/extras/scsi_id/.gitignore create mode 100644 src/extras/scsi_id/README create mode 100644 src/extras/scsi_id/scsi.h create mode 100644 src/extras/scsi_id/scsi_id.8 create mode 100644 src/extras/scsi_id/scsi_id.c create mode 100644 src/extras/scsi_id/scsi_id.h create mode 100644 src/extras/scsi_id/scsi_serial.c create mode 100644 src/extras/udev-acl/.gitignore create mode 100644 src/extras/udev-acl/70-udev-acl.rules create mode 100644 src/extras/udev-acl/udev-acl.c create mode 100644 src/extras/v4l_id/.gitignore create mode 100644 src/extras/v4l_id/60-persistent-v4l.rules create mode 100644 src/extras/v4l_id/v4l_id.c create mode 100644 src/libudev-device-private.c create mode 100644 src/libudev-device.c create mode 100644 src/libudev-enumerate.c create mode 100644 src/libudev-list.c create mode 100644 src/libudev-monitor.c create mode 100644 src/libudev-private.h create mode 100644 src/libudev-queue-private.c create mode 100644 src/libudev-queue.c create mode 100644 src/libudev-selinux-private.c create mode 100644 src/libudev-util-private.c create mode 100644 src/libudev-util.c create mode 100644 src/libudev.c create mode 100644 src/libudev.h create mode 100644 src/libudev.pc.in create mode 100644 src/sd-daemon.c create mode 100644 src/sd-daemon.h create mode 100644 src/test-libudev.c create mode 100644 src/test-udev.c create mode 100644 src/udev-builtin-blkid.c create mode 100644 src/udev-builtin-firmware.c create mode 100644 src/udev-builtin-hwdb.c create mode 100644 src/udev-builtin-input_id.c create mode 100644 src/udev-builtin-kmod.c create mode 100644 src/udev-builtin-path_id.c create mode 100644 src/udev-builtin-usb_id.c create mode 100644 src/udev-builtin.c create mode 100644 src/udev-control.socket create mode 100644 src/udev-ctrl.c create mode 100644 src/udev-event.c create mode 100644 src/udev-kernel.socket create mode 100644 src/udev-node.c create mode 100644 src/udev-rules.c create mode 100644 src/udev-settle.service.in create mode 100644 src/udev-trigger.service.in create mode 100644 src/udev-watch.c create mode 100644 src/udev.conf create mode 100644 src/udev.h create mode 100644 src/udev.pc.in create mode 100644 src/udev.service.in create mode 100644 src/udev.xml create mode 100644 src/udevadm-control.c create mode 100644 src/udevadm-info.c create mode 100644 src/udevadm-monitor.c create mode 100644 src/udevadm-settle.c create mode 100644 src/udevadm-test-builtin.c create mode 100644 src/udevadm-test.c create mode 100644 src/udevadm-trigger.c create mode 100644 src/udevadm.c create mode 100644 src/udevadm.xml create mode 100644 src/udevd.c create mode 100644 src/udevd.xml delete mode 100644 systemd/.gitignore delete mode 100644 systemd/udev-control.socket delete mode 100644 systemd/udev-kernel.socket delete mode 100644 systemd/udev-settle.service.in delete mode 100644 systemd/udev-trigger.service.in delete mode 100644 systemd/udev.service.in delete mode 100644 udev.conf delete mode 100644 udev/.gitignore delete mode 100644 udev/sd-daemon.c delete mode 100644 udev/sd-daemon.h delete mode 100644 udev/test-udev.c delete mode 100644 udev/udev-builtin-blkid.c delete mode 100644 udev/udev-builtin-firmware.c delete mode 100644 udev/udev-builtin-hwdb.c delete mode 100644 udev/udev-builtin-input_id.c delete mode 100644 udev/udev-builtin-kmod.c delete mode 100644 udev/udev-builtin-path_id.c delete mode 100644 udev/udev-builtin-usb_id.c delete mode 100644 udev/udev-builtin.c delete mode 100644 udev/udev-ctrl.c delete mode 100644 udev/udev-event.c delete mode 100644 udev/udev-node.c delete mode 100644 udev/udev-rules.c delete mode 100644 udev/udev-watch.c delete mode 100644 udev/udev.h delete mode 100644 udev/udev.pc.in delete mode 100644 udev/udev.xml delete mode 100644 udev/udevadm-control.c delete mode 100644 udev/udevadm-info.c delete mode 100644 udev/udevadm-monitor.c delete mode 100644 udev/udevadm-settle.c delete mode 100644 udev/udevadm-test-builtin.c delete mode 100644 udev/udevadm-test.c delete mode 100644 udev/udevadm-trigger.c delete mode 100644 udev/udevadm.c delete mode 100644 udev/udevadm.xml delete mode 100644 udev/udevd.c delete mode 100644 udev/udevd.xml diff --git a/.gitignore b/.gitignore index 5a5c4a00b6..e80fd08c68 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,7 @@ stamp-h1 depcomp udev-test-install gtk-doc.make +udevd +udevadm +test-udev +test-libudev diff --git a/Makefile.am b/Makefile.am index 7abad22a61..4329291243 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ # ------------------------------------------------------------------------------ -# Copyright (C) 2008-2009 Kay Sievers +# Copyright (C) 2008-2012 Kay Sievers # Copyright (C) 2009 Diego Elio 'Flameeyes' Pettenò # ------------------------------------------------------------------------------ @@ -11,7 +11,7 @@ AM_MAKEFLAGS = --no-print-directory AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ - -I$(top_srcdir)/libudev \ + -I$(top_srcdir)/src \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DPKGLIBEXECDIR=\""$(libexecdir)/udev"\" @@ -36,9 +36,11 @@ INSTALL_EXEC_HOOKS = INSTALL_DATA_HOOKS = UNINSTALL_EXEC_HOOKS = DISTCHECK_HOOKS = -pkglibexec_SCRIPTS = -dist_pkglibexec_SCRIPTS = -dist_pkglibexec_DATA = + +udevhomedir = $(libexecdir)/udev +udevhome_SCRIPTS = +dist_udevhome_SCRIPTS = +dist_udevhome_DATA = SED_PROCESS = \ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ @@ -76,45 +78,45 @@ LIBUDEV_CURRENT=13 LIBUDEV_REVISION=0 LIBUDEV_AGE=13 -SUBDIRS += libudev/docs +SUBDIRS += src/docs -include_HEADERS = libudev/libudev.h -lib_LTLIBRARIES = libudev/libudev.la +include_HEADERS = src/libudev.h +lib_LTLIBRARIES = src/libudev.la -libudev_libudev_la_SOURCES =\ - libudev/libudev-private.h \ - libudev/libudev.c \ - libudev/libudev-list.c \ - libudev/libudev-util.c \ - libudev/libudev-device.c \ - libudev/libudev-enumerate.c \ - libudev/libudev-monitor.c \ - libudev/libudev-queue.c +src_libudev_la_SOURCES =\ + src/libudev-private.h \ + src/libudev.c \ + src/libudev-list.c \ + src/libudev-util.c \ + src/libudev-device.c \ + src/libudev-enumerate.c \ + src/libudev-monitor.c \ + src/libudev-queue.c -libudev_libudev_la_LDFLAGS = \ +src_libudev_la_LDFLAGS = \ $(AM_LDFLAGS) \ -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) noinst_LTLIBRARIES = \ - libudev/libudev-private.la + src/libudev-private.la -libudev_libudev_private_la_SOURCES =\ - $(libudev_libudev_la_SOURCES) \ - libudev/libudev-util-private.c \ - libudev/libudev-device-private.c \ - libudev/libudev-queue-private.c +src_libudev_private_la_SOURCES =\ + $(src_libudev_la_SOURCES) \ + src/libudev-util-private.c \ + src/libudev-device-private.c \ + src/libudev-queue-private.c if WITH_SELINUX -libudev_libudev_private_la_SOURCES += libudev/libudev-selinux-private.c -libudev_libudev_private_la_LIBADD = $(SELINUX_LIBS) +src_libudev_private_la_SOURCES += src/libudev-selinux-private.c +src_libudev_private_la_LIBADD = $(SELINUX_LIBS) endif pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libudev/libudev.pc -EXTRA_DIST += libudev/libudev.pc.in -CLEANFILES += libudev/libudev.pc +pkgconfig_DATA = src/libudev.pc +EXTRA_DIST += src/libudev.pc.in +CLEANFILES += src/libudev.pc -EXTRA_DIST += libudev/COPYING +EXTRA_DIST += src/COPYING # move lib from $(libdir) to $(rootlib_execdir) and update devel link, if needed libudev-install-move-hook: if test "$(libdir)" != "$(rootlib_execdir)"; then \ @@ -159,32 +161,32 @@ dist_udevrules_DATA = \ rules/rules.d/95-udev-late.rules udevconfdir = $(sysconfdir)/udev -dist_udevconf_DATA = udev.conf +dist_udevconf_DATA = src/udev.conf sharepkgconfigdir = $(datadir)/pkgconfig -sharepkgconfig_DATA = udev/udev.pc -EXTRA_DIST += udev/udev.pc.in -CLEANFILES += udev/udev.pc +sharepkgconfig_DATA = src/udev.pc +EXTRA_DIST += src/udev.pc.in +CLEANFILES += src/udev.pc if WITH_SYSTEMD dist_systemdsystemunit_DATA = \ - systemd/udev-control.socket \ - systemd/udev-kernel.socket + src/udev-control.socket \ + src/udev-kernel.socket systemdsystemunit_DATA = \ - systemd/udev.service \ - systemd/udev-trigger.service \ - systemd/udev-settle.service + src/udev.service \ + src/udev-trigger.service \ + src/udev-settle.service EXTRA_DIST += \ - systemd/udev.service.in \ - systemd/udev-trigger.service.in \ - systemd/udev-settle.service.in + src/udev.service.in \ + src/udev-trigger.service.in \ + src/udev-settle.service.in CLEANFILES += \ - systemd/udev.service \ - systemd/udev-trigger.service \ - systemd/udev-settle.service + src/udev.service \ + src/udev-trigger.service \ + src/udev-settle.service systemd-install-hook: mkdir -p $(DESTDIR)$(systemdsystemunitdir)/sockets.target.wants @@ -198,33 +200,33 @@ INSTALL_DATA_HOOKS += systemd-install-hook endif bin_PROGRAMS = \ - udev/udevadm + src/udevadm pkglibexec_PROGRAMS = \ - udev/udevd + src/udevd udev_common_sources = \ - udev/udev.h \ - udev/udev-event.c \ - udev/udev-watch.c \ - udev/udev-node.c \ - udev/udev-rules.c \ - udev/udev-ctrl.c \ - udev/udev-builtin.c \ - udev/udev-builtin-blkid.c \ - udev/udev-builtin-firmware.c \ - udev/udev-builtin-hwdb.c \ - udev/udev-builtin-input_id.c \ - udev/udev-builtin-kmod.c \ - udev/udev-builtin-path_id.c \ - udev/udev-builtin-usb_id.c + src/udev.h \ + src/udev-event.c \ + src/udev-watch.c \ + src/udev-node.c \ + src/udev-rules.c \ + src/udev-ctrl.c \ + src/udev-builtin.c \ + src/udev-builtin-blkid.c \ + src/udev-builtin-firmware.c \ + src/udev-builtin-hwdb.c \ + src/udev-builtin-input_id.c \ + src/udev-builtin-kmod.c \ + src/udev-builtin-path_id.c \ + src/udev-builtin-usb_id.c udev_common_CFLAGS = \ $(BLKID_CFLAGS) \ $(KMOD_CFLAGS) udev_common_LDADD = \ - libudev/libudev-private.la \ + src/libudev-private.la \ $(BLKID_LIBS) \ $(KMOD_LIBS) @@ -233,51 +235,51 @@ udev_common_CPPFLAGS = \ -DFIRMWARE_PATH="$(FIRMWARE_PATH)" \ -DUSB_DATABASE=\"$(USB_DATABASE)\" -DPCI_DATABASE=\"$(PCI_DATABASE)\" -udev_udevd_SOURCES = \ +src_udevd_SOURCES = \ $(udev_common_sources) \ - udev/udevd.c \ - udev/sd-daemon.h \ - udev/sd-daemon.c -udev_udevd_CFLAGS = $(udev_common_CFLAGS) -udev_udevd_LDADD = $(udev_common_LDADD) -udev_udevd_CPPFLAGS = $(udev_common_CPPFLAGS) - -udev_udevadm_SOURCES = \ + src/udevd.c \ + src/sd-daemon.h \ + src/sd-daemon.c +src_udevd_CFLAGS = $(udev_common_CFLAGS) +src_udevd_LDADD = $(udev_common_LDADD) +src_udevd_CPPFLAGS = $(udev_common_CPPFLAGS) + +src_udevadm_SOURCES = \ $(udev_common_sources) \ - udev/udevadm.c \ - udev/udevadm-info.c \ - udev/udevadm-control.c \ - udev/udevadm-monitor.c \ - udev/udevadm-settle.c \ - udev/udevadm-trigger.c \ - udev/udevadm-test.c \ - udev/udevadm-test-builtin.c -udev_udevadm_CFLAGS = $(udev_common_CFLAGS) -udev_udevadm_LDADD = $(udev_common_LDADD) -udev_udevadm_CPPFLAGS = $(udev_common_CPPFLAGS) + src/udevadm.c \ + src/udevadm-info.c \ + src/udevadm-control.c \ + src/udevadm-monitor.c \ + src/udevadm-settle.c \ + src/udevadm-trigger.c \ + src/udevadm-test.c \ + src/udevadm-test-builtin.c +src_udevadm_CFLAGS = $(udev_common_CFLAGS) +src_udevadm_LDADD = $(udev_common_LDADD) +src_udevadm_CPPFLAGS = $(udev_common_CPPFLAGS) # ------------------------------------------------------------------------------ # udev man pages # ------------------------------------------------------------------------------ dist_man_MANS = \ - udev/udev.7 \ - udev/udevadm.8 \ - udev/udevd.8 + src/udev.7 \ + src/udevadm.8 \ + src/udevd.8 dist_noinst_DATA = \ - udev/udev.html \ - udev/udevadm.html \ - udev/udevd.html + src/udev.html \ + src/udevadm.html \ + src/udevd.html EXTRA_DIST += \ - udev/udev.xml \ - udev/udevadm.xml \ - udev/udevd.xml + src/udev.xml \ + src/udevadm.xml \ + src/udevd.xml -udev/%.7 udev/%.8 : udev/%.xml +src/%.7 src/%.8 : src/%.xml $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< -udev/%.html : udev/%.xml +src/%.html : src/%.xml $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $< # ------------------------------------------------------------------------------ @@ -294,74 +296,74 @@ CLEANFILES += \ test/udev-test.pl check_PROGRAMS = \ - libudev/test-libudev \ - udev/test-udev + src/test-libudev \ + src/test-udev -libudev_test_libudev_SOURCES = libudev/test-libudev.c -libudev_test_libudev_LDADD = libudev/libudev.la +src_test_libudev_SOURCES = src/test-libudev.c +src_test_libudev_LDADD = src/libudev.la -udev_test_udev_SOURCES = \ +src_test_udev_SOURCES = \ $(udev_common_sources) \ - udev/test-udev.c -udev_test_udev_CFLAGS = $(udev_common_CFLAGS) -udev_test_udev_LDADD = $(udev_common_LDADD) -udev_test_udev_CPPFLAGS = $(udev_common_CPPFLAGS) + src/test-udev.c +src_test_udev_CFLAGS = $(udev_common_CFLAGS) +src_test_udev_LDADD = $(udev_common_LDADD) +src_test_udev_CPPFLAGS = $(udev_common_CPPFLAGS) # ------------------------------------------------------------------------------ # ata_id - ATA identify # ------------------------------------------------------------------------------ -extras_ata_id_ata_id_SOURCES = extras/ata_id/ata_id.c -extras_ata_id_ata_id_LDADD = libudev/libudev-private.la -pkglibexec_PROGRAMS += extras/ata_id/ata_id +src_extras_ata_id_ata_id_SOURCES = src/extras/ata_id/ata_id.c +src_extras_ata_id_ata_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/extras/ata_id/ata_id # ------------------------------------------------------------------------------ # cdrom_id - optical drive/media capability # ------------------------------------------------------------------------------ -extras_cdrom_id_cdrom_id_SOURCES = extras/cdrom_id/cdrom_id.c -extras_cdrom_id_cdrom_id_LDADD = libudev/libudev-private.la -pkglibexec_PROGRAMS += extras/cdrom_id/cdrom_id -dist_udevrules_DATA += extras/cdrom_id/60-cdrom_id.rules +src_extras_cdrom_id_cdrom_id_SOURCES = src/extras/cdrom_id/cdrom_id.c +src_extras_cdrom_id_cdrom_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/extras/cdrom_id/cdrom_id +dist_udevrules_DATA += src/extras/cdrom_id/60-cdrom_id.rules # ------------------------------------------------------------------------------ # collect - trigger action when a collection of devices appeared # ------------------------------------------------------------------------------ -extras_collect_collect_SOURCES = extras/collect/collect.c -extras_collect_collect_LDADD = libudev/libudev-private.la -pkglibexec_PROGRAMS += extras/collect/collect +src_extras_collect_collect_SOURCES = src/extras/collect/collect.c +src_extras_collect_collect_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/extras/collect/collect # ------------------------------------------------------------------------------ # scsi_id - SCSI inquiry to get various serial numbers # ------------------------------------------------------------------------------ -extras_scsi_id_scsi_id_SOURCES =\ - extras/scsi_id/scsi_id.c \ - extras/scsi_id/scsi_serial.c \ - extras/scsi_id/scsi.h \ - extras/scsi_id/scsi_id.h -extras_scsi_id_scsi_id_LDADD = libudev/libudev-private.la -pkglibexec_PROGRAMS += extras/scsi_id/scsi_id -dist_man_MANS += extras/scsi_id/scsi_id.8 -EXTRA_DIST += extras/scsi_id/README +src_extras_scsi_id_scsi_id_SOURCES =\ + src/extras/scsi_id/scsi_id.c \ + src/extras/scsi_id/scsi_serial.c \ + src/extras/scsi_id/scsi.h \ + src/extras/scsi_id/scsi_id.h +src_extras_scsi_id_scsi_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/extras/scsi_id/scsi_id +dist_man_MANS += src/extras/scsi_id/scsi_id.8 +EXTRA_DIST += src/extras/scsi_id/README # ------------------------------------------------------------------------------ # v4l_id - video4linux capabilities # ------------------------------------------------------------------------------ -extras_v4l_id_v4l_id_SOURCES = extras/v4l_id/v4l_id.c -extras_v4l_id_v4l_id_LDADD = libudev/libudev-private.la -pkglibexec_PROGRAMS += extras/v4l_id/v4l_id -dist_udevrules_DATA += extras/v4l_id/60-persistent-v4l.rules +src_extras_v4l_id_v4l_id_SOURCES = src/extras/v4l_id/v4l_id.c +src_extras_v4l_id_v4l_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/extras/v4l_id/v4l_id +dist_udevrules_DATA += src/extras/v4l_id/60-persistent-v4l.rules # ------------------------------------------------------------------------------ # accelerometer - updates device orientation # ------------------------------------------------------------------------------ -extras_accelerometer_accelerometer_SOURCES = extras/accelerometer/accelerometer.c -extras_accelerometer_accelerometer_LDADD = libudev/libudev-private.la -lm -pkglibexec_PROGRAMS += extras/accelerometer/accelerometer -dist_udevrules_DATA += extras/accelerometer/61-accelerometer.rules +src_extras_accelerometer_accelerometer_SOURCES = src/extras/accelerometer/accelerometer.c +src_extras_accelerometer_accelerometer_LDADD = src/libudev-private.la -lm +pkglibexec_PROGRAMS += src/extras/accelerometer/accelerometer +dist_udevrules_DATA += src/extras/accelerometer/61-accelerometer.rules # ------------------------------------------------------------------------------ # qemu -- qemu/kvm guest tweaks # ------------------------------------------------------------------------------ -dist_udevrules_DATA += extras/qemu/42-qemu-usb.rules +dist_udevrules_DATA += src/extras/qemu/42-qemu-usb.rules if ENABLE_GUDEV # ------------------------------------------------------------------------------ @@ -371,125 +373,125 @@ LIBGUDEV_CURRENT=1 LIBGUDEV_REVISION=1 LIBGUDEV_AGE=1 -SUBDIRS += extras/gudev/docs - -libgudev_includedir=$(includedir)/gudev-1.0/gudev -libgudev_include_HEADERS = \ - extras/gudev/gudev.h \ - extras/gudev/gudevenums.h \ - extras/gudev/gudevenumtypes.h \ - extras/gudev/gudevtypes.h \ - extras/gudev/gudevclient.h \ - extras/gudev/gudevdevice.h \ - extras/gudev/gudevenumerator.h - -lib_LTLIBRARIES += extras/gudev/libgudev-1.0.la - -pkgconfig_DATA += extras/gudev/gudev-1.0.pc -EXTRA_DIST += extras/gudev/gudev-1.0.pc.in -CLEANFILES += extras/gudev/gudev-1.0.pc - -extras_gudev_libgudev_1_0_la_SOURCES = \ - extras/gudev/gudevenums.h \ - extras/gudev/gudevenumtypes.h \ - extras/gudev/gudevenumtypes.h\ - extras/gudev/gudevtypes.h \ - extras/gudev/gudevclient.h \ - extras/gudev/gudevclient.c \ - extras/gudev/gudevdevice.h \ - extras/gudev/gudevdevice.c \ - extras/gudev/gudevenumerator.h \ - extras/gudev/gudevenumerator.c \ - extras/gudev/gudevprivate.h - -nodist_extras_gudev_libgudev_1_0_la_SOURCES = \ - extras/gudev/gudevmarshal.h \ - extras/gudev/gudevmarshal.c \ - extras/gudev/gudevenumtypes.h \ - extras/gudev/gudevenumtypes.c -BUILT_SOURCES += $(nodist_extras_gudev_libgudev_1_0_la_SOURCES) - -extras_gudev_libgudev_1_0_la_CPPFLAGS = \ +SUBDIRS += src/extras/gudev/docs + +src_extras_gudev_libgudev_includedir=$(includedir)/gudev-1.0/gudev +src_extras_gudev_libgudev_include_HEADERS = \ + src/extras/gudev/gudev.h \ + src/extras/gudev/gudevenums.h \ + src/extras/gudev/gudevenumtypes.h \ + src/extras/gudev/gudevtypes.h \ + src/extras/gudev/gudevclient.h \ + src/extras/gudev/gudevdevice.h \ + src/extras/gudev/gudevenumerator.h + +lib_LTLIBRARIES += src/extras/gudev/libgudev-1.0.la + +pkgconfig_DATA += src/extras/gudev/gudev-1.0.pc +EXTRA_DIST += src/extras/gudev/gudev-1.0.pc.in +CLEANFILES += src/extras/gudev/gudev-1.0.pc + +src_extras_gudev_libgudev_1_0_la_SOURCES = \ + src/extras/gudev/gudevenums.h \ + src/extras/gudev/gudevenumtypes.h \ + src/extras/gudev/gudevenumtypes.h\ + src/extras/gudev/gudevtypes.h \ + src/extras/gudev/gudevclient.h \ + src/extras/gudev/gudevclient.c \ + src/extras/gudev/gudevdevice.h \ + src/extras/gudev/gudevdevice.c \ + src/extras/gudev/gudevenumerator.h \ + src/extras/gudev/gudevenumerator.c \ + src/extras/gudev/gudevprivate.h + +nodist_src_extras_gudev_libgudev_1_0_la_SOURCES = \ + src/extras/gudev/gudevmarshal.h \ + src/extras/gudev/gudevmarshal.c \ + src/extras/gudev/gudevenumtypes.h \ + src/extras/gudev/gudevenumtypes.c +BUILT_SOURCES += $(nodist_src_extras_gudev_libgudev_1_0_la_SOURCES) + +src_extras_gudev_libgudev_1_0_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ - -I$(top_builddir)/extras \ - -I$(top_srcdir)/extras \ - -I$(top_builddir)/extras/gudev \ - -I$(top_srcdir)/extras/gudev \ + -I$(top_builddir)/src/extras \ + -I$(top_srcdir)/src/extras \ + -I$(top_builddir)/src/extras/gudev \ + -I$(top_srcdir)/src/extras/gudev \ -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ -D_GUDEV_COMPILATION \ -DG_LOG_DOMAIN=\"GUdev\" -extras_gudev_libgudev_1_0_la_CFLAGS = \ +src_extras_gudev_libgudev_1_0_la_CFLAGS = \ -fvisibility=default \ $(GLIB_CFLAGS) -extras_gudev_libgudev_1_0_la_LIBADD = libudev/libudev.la $(GLIB_LIBS) +src_extras_gudev_libgudev_1_0_la_LIBADD = src/libudev.la $(GLIB_LIBS) -extras_gudev_libgudev_1_0_la_LDFLAGS = \ +src_extras_gudev_libgudev_1_0_la_LDFLAGS = \ -version-info $(LIBGUDEV_CURRENT):$(LIBGUDEV_REVISION):$(LIBGUDEV_AGE) \ -export-dynamic -no-undefined \ -export-symbols-regex '^g_udev_.*' EXTRA_DIST += \ - extras/gudev/COPYING \ - extras/gudev/gudevmarshal.list \ - extras/gudev/gudevenumtypes.h.template \ - extras/gudev/gudevenumtypes.c.template \ - extras/gudev/gjs-example.js \ - extras/gudev/seed-example-enum.js \ - extras/gudev/seed-example.js - -extras/gudev/gudevmarshal.h: extras/gudev/gudevmarshal.list + src/extras/gudev/COPYING \ + src/extras/gudev/gudevmarshal.list \ + src/extras/gudev/gudevenumtypes.h.template \ + src/extras/gudev/gudevenumtypes.c.template \ + src/extras/gudev/gjs-example.js \ + src/extras/gudev/seed-example-enum.js \ + src/extras/gudev/seed-example.js + +src/extras/gudev/gudevmarshal.h: src/extras/gudev/gudevmarshal.list $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ -extras/gudev/gudevmarshal.c: extras/gudev/gudevmarshal.list +src/extras/gudev/gudevmarshal.c: src/extras/gudev/gudevmarshal.list $(AM_V_GEN)echo "#include \"gudevmarshal.h\"" > $@ && \ glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ -extras/gudev/gudevenumtypes.h: extras/gudev/gudevenumtypes.h.template extras/gudev/gudevenums.h +src/extras/gudev/gudevenumtypes.h: src/extras/gudev/gudevenumtypes.h.template src/extras/gudev/gudevenums.h $(AM_V_GEN)glib-mkenums --template $^ > \ $@.tmp && mv $@.tmp $@ -extras/gudev/gudevenumtypes.c: extras/gudev/gudevenumtypes.c.template extras/gudev/gudevenums.h +src/extras/gudev/gudevenumtypes.c: src/extras/gudev/gudevenumtypes.c.template src/extras/gudev/gudevenums.h $(AM_V_GEN)glib-mkenums --template $^ > \ $@.tmp && mv $@.tmp $@ if ENABLE_INTROSPECTION -extras/gudev/GUdev-1.0.gir: extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) +src/extras/gudev/GUdev-1.0.gir: src/extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) $(AM_V_GEN)$(G_IR_SCANNER) -v \ --warn-all \ --namespace GUdev \ --nsversion=1.0 \ --include=GObject-2.0 \ --library=gudev-1.0 \ - --library-path=$(top_builddir)/libudev \ - --library-path=$(top_builddir)/extras/gudev \ + --library-path=$(top_builddir)/src \ + --library-path=$(top_builddir)/src/extras/gudev \ --output $@ \ --pkg=glib-2.0 \ --pkg=gobject-2.0 \ - -I$(top_srcdir)/extras \ - -I$(top_builddir)/extras \ + -I$(top_srcdir)/src/extras \ + -I$(top_builddir)/src/extras \ -D_GUDEV_COMPILATION \ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ - $(top_srcdir)/extras/gudev/gudev.h \ - $(top_srcdir)/extras/gudev/gudevtypes.h \ - $(top_srcdir)/extras/gudev/gudevenums.h \ - $(or $(wildcard $(top_builddir)/extras/gudev/gudevenumtypes.h),$(top_srcdir)/extras/gudev/gudevenumtypes.h) \ - $(top_srcdir)/extras/gudev/gudevclient.h \ - $(top_srcdir)/extras/gudev/gudevdevice.h \ - $(top_srcdir)/extras/gudev/gudevenumerator.h \ - $(top_srcdir)/extras/gudev/gudevclient.c \ - $(top_srcdir)/extras/gudev/gudevdevice.c \ - $(top_srcdir)/extras/gudev/gudevenumerator.c - -extras/gudev/GUdev-1.0.typelib: extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) + $(top_srcdir)/src/extras/gudev/gudev.h \ + $(top_srcdir)/src/extras/gudev/gudevtypes.h \ + $(top_srcdir)/src/extras/gudev/gudevenums.h \ + $(or $(wildcard $(top_builddir)/src/extras/gudev/gudevenumtypes.h),$(top_srcdir)/src/extras/gudev/gudevenumtypes.h) \ + $(top_srcdir)/src/extras/gudev/gudevclient.h \ + $(top_srcdir)/src/extras/gudev/gudevdevice.h \ + $(top_srcdir)/src/extras/gudev/gudevenumerator.h \ + $(top_srcdir)/src/extras/gudev/gudevclient.c \ + $(top_srcdir)/src/extras/gudev/gudevdevice.c \ + $(top_srcdir)/src/extras/gudev/gudevenumerator.c + +src/extras/gudev/GUdev-1.0.typelib: src/extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) $(AM_V_GEN)g-ir-compiler $< -o $@ girdir = $(GIRDIR) -gir_DATA = extras/gudev/GUdev-1.0.gir +gir_DATA = src/extras/gudev/GUdev-1.0.gir typelibsdir = $(GIRTYPELIBDIR) -typelibs_DATA = extras/gudev/GUdev-1.0.typelib +typelibs_DATA = src/extras/gudev/GUdev-1.0.typelib CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # ENABLE_INTROSPECTION @@ -515,113 +517,113 @@ if ENABLE_KEYMAP # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ -extras_keymap_keymap_SOURCES = extras/keymap/keymap.c -extras_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I extras/keymap -nodist_extras_keymap_keymap_SOURCES = \ - extras/keymap/keys-from-name.h \ - extras/keymap/keys-to-name.h -BUILT_SOURCES += $(nodist_extras_keymap_keymap_SOURCES) +src_keymap_SOURCES = src/extras/keymap/keymap.c +src_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I src/extras/keymap +nodist_src_keymap_SOURCES = \ + src/extras/keymap/keys-from-name.h \ + src/extras/keymap/keys-to-name.h +BUILT_SOURCES += $(nodist_src_keymap_SOURCES) -pkglibexec_PROGRAMS += extras/keymap/keymap -dist_doc_DATA = extras/keymap/README.keymap.txt +pkglibexec_PROGRAMS += src/keymap +dist_doc_DATA = src/extras/keymap/README.keymap.txt dist_udevrules_DATA += \ - extras/keymap/95-keymap.rules \ - extras/keymap/95-keyboard-force-release.rules + src/extras/keymap/95-keymap.rules \ + src/extras/keymap/95-keyboard-force-release.rules -dist_pkglibexec_SCRIPTS += extras/keymap/findkeyboards -pkglibexec_SCRIPTS += extras/keymap/keyboard-force-release.sh +dist_udevhome_SCRIPTS += src/extras/keymap/findkeyboards +udevhome_SCRIPTS += src/extras/keymap/keyboard-force-release.sh EXTRA_DIST += \ - extras/keymap/check-keymaps.sh \ - extras/keymap/keyboard-force-release.sh.in + src/extras/keymap/check-keymaps.sh \ + src/extras/keymap/keyboard-force-release.sh.in CLEANFILES += \ - extras/keymap/keys.txt \ - extras/keymap/keys-from-name.gperf \ - extras/keymap/keyboard-force-release.sh + src/extras/keymap/keys.txt \ + src/extras/keymap/keys-from-name.gperf \ + src/extras/keymap/keyboard-force-release.sh udevkeymapdir = $(libexecdir)/udev/keymaps dist_udevkeymap_DATA = \ - extras/keymap/keymaps/acer \ - extras/keymap/keymaps/acer-aspire_5720 \ - extras/keymap/keymaps/acer-aspire_8930 \ - extras/keymap/keymaps/acer-aspire_5920g \ - extras/keymap/keymaps/acer-aspire_6920 \ - extras/keymap/keymaps/acer-travelmate_c300 \ - extras/keymap/keymaps/asus \ - extras/keymap/keymaps/compaq-e_evo \ - extras/keymap/keymaps/dell \ - extras/keymap/keymaps/dell-latitude-xt2 \ - extras/keymap/keymaps/everex-xt5000 \ - extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ - extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ - extras/keymap/keymaps/fujitsu-amilo_pro_v3205 \ - extras/keymap/keymaps/fujitsu-amilo_si_1520 \ - extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ - extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ - extras/keymap/keymaps/genius-slimstar-320 \ - extras/keymap/keymaps/hewlett-packard \ - extras/keymap/keymaps/hewlett-packard-2510p_2530p \ - extras/keymap/keymaps/hewlett-packard-compaq_elitebook \ - extras/keymap/keymaps/hewlett-packard-pavilion \ - extras/keymap/keymaps/hewlett-packard-presario-2100 \ - extras/keymap/keymaps/hewlett-packard-tablet \ - extras/keymap/keymaps/hewlett-packard-tx2 \ - extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint \ - extras/keymap/keymaps/inventec-symphony_6.0_7.0 \ - extras/keymap/keymaps/lenovo-3000 \ - extras/keymap/keymaps/lenovo-ideapad \ - extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ - extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ - extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ - extras/keymap/keymaps/lg-x110 \ - extras/keymap/keymaps/logitech-wave \ - extras/keymap/keymaps/logitech-wave-cordless \ - extras/keymap/keymaps/logitech-wave-pro-cordless \ - extras/keymap/keymaps/maxdata-pro_7000 \ - extras/keymap/keymaps/medion-fid2060 \ - extras/keymap/keymaps/medionnb-a555 \ - extras/keymap/keymaps/micro-star \ - extras/keymap/keymaps/module-asus-w3j \ - extras/keymap/keymaps/module-ibm \ - extras/keymap/keymaps/module-lenovo \ - extras/keymap/keymaps/module-sony \ - extras/keymap/keymaps/module-sony-old \ - extras/keymap/keymaps/module-sony-vgn \ - extras/keymap/keymaps/olpc-xo \ - extras/keymap/keymaps/onkyo \ - extras/keymap/keymaps/oqo-model2 \ - extras/keymap/keymaps/samsung-other \ - extras/keymap/keymaps/samsung-sq1us \ - extras/keymap/keymaps/samsung-sx20s \ - extras/keymap/keymaps/toshiba-satellite_a100 \ - extras/keymap/keymaps/toshiba-satellite_a110 \ - extras/keymap/keymaps/toshiba-satellite_m30x \ - extras/keymap/keymaps/zepto-znote + src/extras/keymap/keymaps/acer \ + src/extras/keymap/keymaps/acer-aspire_5720 \ + src/extras/keymap/keymaps/acer-aspire_8930 \ + src/extras/keymap/keymaps/acer-aspire_5920g \ + src/extras/keymap/keymaps/acer-aspire_6920 \ + src/extras/keymap/keymaps/acer-travelmate_c300 \ + src/extras/keymap/keymaps/asus \ + src/extras/keymap/keymaps/compaq-e_evo \ + src/extras/keymap/keymaps/dell \ + src/extras/keymap/keymaps/dell-latitude-xt2 \ + src/extras/keymap/keymaps/everex-xt5000 \ + src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ + src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ + src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 \ + src/extras/keymap/keymaps/fujitsu-amilo_si_1520 \ + src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ + src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ + src/extras/keymap/keymaps/genius-slimstar-320 \ + src/extras/keymap/keymaps/hewlett-packard \ + src/extras/keymap/keymaps/hewlett-packard-2510p_2530p \ + src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook \ + src/extras/keymap/keymaps/hewlett-packard-pavilion \ + src/extras/keymap/keymaps/hewlett-packard-presario-2100 \ + src/extras/keymap/keymaps/hewlett-packard-tablet \ + src/extras/keymap/keymaps/hewlett-packard-tx2 \ + src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint \ + src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 \ + src/extras/keymap/keymaps/lenovo-3000 \ + src/extras/keymap/keymaps/lenovo-ideapad \ + src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ + src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ + src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ + src/extras/keymap/keymaps/lg-x110 \ + src/extras/keymap/keymaps/logitech-wave \ + src/extras/keymap/keymaps/logitech-wave-cordless \ + src/extras/keymap/keymaps/logitech-wave-pro-cordless \ + src/extras/keymap/keymaps/maxdata-pro_7000 \ + src/extras/keymap/keymaps/medion-fid2060 \ + src/extras/keymap/keymaps/medionnb-a555 \ + src/extras/keymap/keymaps/micro-star \ + src/extras/keymap/keymaps/module-asus-w3j \ + src/extras/keymap/keymaps/module-ibm \ + src/extras/keymap/keymaps/module-lenovo \ + src/extras/keymap/keymaps/module-sony \ + src/extras/keymap/keymaps/module-sony-old \ + src/extras/keymap/keymaps/module-sony-vgn \ + src/extras/keymap/keymaps/olpc-xo \ + src/extras/keymap/keymaps/onkyo \ + src/extras/keymap/keymaps/oqo-model2 \ + src/extras/keymap/keymaps/samsung-other \ + src/extras/keymap/keymaps/samsung-sq1us \ + src/extras/keymap/keymaps/samsung-sx20s \ + src/extras/keymap/keymaps/toshiba-satellite_a100 \ + src/extras/keymap/keymaps/toshiba-satellite_a110 \ + src/extras/keymap/keymaps/toshiba-satellite_m30x \ + src/extras/keymap/keymaps/zepto-znote udevkeymapforcereldir = $(libexecdir)/udev/keymaps/force-release dist_udevkeymapforcerel_DATA = \ - extras/keymap/force-release-maps/dell-touchpad \ - extras/keymap/force-release-maps/hp-other \ - extras/keymap/force-release-maps/samsung-other \ - extras/keymap/force-release-maps/common-volume-keys + src/extras/keymap/force-release-maps/dell-touchpad \ + src/extras/keymap/force-release-maps/hp-other \ + src/extras/keymap/force-release-maps/samsung-other \ + src/extras/keymap/force-release-maps/common-volume-keys -extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h - $(AM_V_at)mkdir -p extras/keymap +src/extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h + $(AM_V_at)mkdir -p src/extras/keymap $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ -extras/keymap/keys-from-name.gperf: extras/keymap/keys.txt +src/extras/keymap/keys-from-name.gperf: src/extras/keymap/keys.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ -extras/keymap/keys-from-name.h: extras/keymap/keys-from-name.gperf Makefile +src/extras/keymap/keys-from-name.h: src/extras/keymap/keys-from-name.gperf Makefile $(AM_V_GEN)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ -extras/keymap/keys-to-name.h: extras/keymap/keys.txt Makefile +src/extras/keymap/keys-to-name.h: src/extras/keymap/keys.txt Makefile $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ -keymaps-distcheck-hook: extras/keymap/keys.txt - $(top_srcdir)/extras/keymap/check-keymaps.sh $(top_srcdir) $^ +keymaps-distcheck-hook: src/extras/keymap/keys.txt + $(top_srcdir)/src/extras/keymap/check-keymaps.sh $(top_srcdir) $^ DISTCHECK_HOOKS += keymaps-distcheck-hook endif @@ -629,38 +631,38 @@ if ENABLE_MTD_PROBE # ------------------------------------------------------------------------------ # mtd_probe - autoloads FTL module for mtd devices # ------------------------------------------------------------------------------ -extras_mtd_probe_mtd_probe_SOURCES = \ - extras/mtd_probe/mtd_probe.c \ - extras/mtd_probe/mtd_probe.h \ - extras/mtd_probe/probe_smartmedia.c -extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) -dist_udevrules_DATA += extras/mtd_probe/75-probe_mtd.rules -pkglibexec_PROGRAMS += extras/mtd_probe/mtd_probe +src_mtd_probe_SOURCES = \ + src/extras/mtd_probe/mtd_probe.c \ + src/extras/mtd_probe/mtd_probe.h \ + src/extras/mtd_probe/probe_smartmedia.c +src_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +dist_udevrules_DATA += src/extras/mtd_probe/75-probe_mtd.rules +pkglibexec_PROGRAMS += src/mtd_probe endif if ENABLE_RULE_GENERATOR # ------------------------------------------------------------------------------ # rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ -dist_pkglibexec_SCRIPTS += \ - extras/rule_generator/write_cd_rules \ - extras/rule_generator/write_net_rules +dist_udevhome_SCRIPTS += \ + src/extras/rule_generator/write_cd_rules \ + src/extras/rule_generator/write_net_rules -pkglibexec_DATA = extras/rule_generator/rule_generator.functions -dist_pkglibexec_DATA += \ - extras/rule_generator/75-cd-aliases-generator.rules \ - extras/rule_generator/75-persistent-net-generator.rules +udevhome_DATA = src/extras/rule_generator/rule_generator.functions +dist_udevhome_DATA = \ + src/extras/rule_generator/75-cd-aliases-generator.rules \ + src/extras/rule_generator/75-persistent-net-generator.rules endif if ENABLE_UDEV_ACL # ------------------------------------------------------------------------------ # udev_acl - apply ACLs for users with local forground sessions # ------------------------------------------------------------------------------ -extras_udev_acl_udev_acl_SOURCES = extras/udev-acl/udev-acl.c -extras_udev_acl_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) -extras_udev_acl_udev_acl_LDADD = libudev/libudev-private.la -lacl $(GLIB_LIBS) -dist_udevrules_DATA += extras/udev-acl/70-udev-acl.rules -pkglibexec_PROGRAMS += extras/udev-acl/udev-acl +src_udev_acl_SOURCES = src/extras/udev-acl/udev-acl.c +src_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) +src_udev_acl_LDADD = src/libudev-private.la -lacl $(GLIB_LIBS) +dist_udevrules_DATA += src/extras/udev-acl/70-udev-acl.rules +pkglibexec_PROGRAMS += src/udev-acl udevacl-install-hook: mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d @@ -673,20 +675,20 @@ if ENABLE_FLOPPY # ------------------------------------------------------------------------------ # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) # ------------------------------------------------------------------------------ -extras_floppy_create_floppy_devices_SOURCES = extras/floppy/create_floppy_devices.c -extras_floppy_create_floppy_devices_LDADD = libudev/libudev-private.la -pkglibexec_PROGRAMS += extras/floppy/create_floppy_devices -dist_udevrules_DATA += extras/floppy/60-floppy.rules +src_create_floppy_devices_SOURCES = src/extras/floppy/create_floppy_devices.c +src_create_floppy_devices_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/create_floppy_devices +dist_udevrules_DATA += src/extras/floppy/60-floppy.rules endif if ENABLE_EDD # ------------------------------------------------------------------------------ # edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data # ------------------------------------------------------------------------------ -extras_edd_id_edd_id_SOURCES = extras/edd_id/edd_id.c -extras_edd_id_edd_id_LDADD = libudev/libudev-private.la -pkglibexec_PROGRAMS += extras/edd_id/edd_id -dist_udevrules_DATA += extras/edd_id/61-persistent-storage-edd.rules +src_edd_id_SOURCES = src/extras/edd_id/edd_id.c +src_edd_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/edd_id +dist_udevrules_DATA += src/extras/edd_id/61-persistent-storage-edd.rules endif # ------------------------------------------------------------------------------ @@ -753,6 +755,6 @@ tar-sync: scp udev-$(VERSION).tar.xz master.kernel.org:/pub/linux/utils/kernel/hotplug/ doc-sync: - rsync -av udev/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ - rsync -av --delete libudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/libudev/ - rsync -av --delete extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/gudev/ + rsync -av src/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ + rsync -av --delete src/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/src/ + rsync -av --delete src/extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/gudev/ diff --git a/configure.ac b/configure.ac index bd154181e5..4ba9964cbd 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT([udev], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -AC_CONFIG_SRCDIR([udev/udevd.c]) +AC_CONFIG_SRCDIR([src/udevd.c]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects]) AC_USE_SYSTEM_EXTENSIONS @@ -210,10 +210,10 @@ AC_SUBST([my_CFLAGS]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ Makefile - libudev/docs/Makefile - libudev/docs/version.xml - extras/gudev/docs/Makefile - extras/gudev/docs/version.xml + src/docs/Makefile + src/docs/version.xml + src/extras/gudev/docs/Makefile + src/extras/gudev/docs/version.xml ]) AC_OUTPUT diff --git a/extras/accelerometer/.gitignore b/extras/accelerometer/.gitignore deleted file mode 100644 index dddc2204d4..0000000000 --- a/extras/accelerometer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -accelerometer diff --git a/extras/accelerometer/61-accelerometer.rules b/extras/accelerometer/61-accelerometer.rules deleted file mode 100644 index a6a2bfd088..0000000000 --- a/extras/accelerometer/61-accelerometer.rules +++ /dev/null @@ -1,3 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM=="input", ACTION!="remove", ENV{ID_INPUT_ACCELEROMETER}=="1", IMPORT{program}="accelerometer %p" diff --git a/extras/accelerometer/accelerometer.c b/extras/accelerometer/accelerometer.c deleted file mode 100644 index 59c2a4ece3..0000000000 --- a/extras/accelerometer/accelerometer.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * accelerometer - exports device orientation through property - * - * When an "change" event is received on an accelerometer, - * open its device node, and from the value, as well as the previous - * value of the property, calculate the device's new orientation, - * and export it as ID_INPUT_ACCELEROMETER_ORIENTATION. - * - * Possible values are: - * undefined - * * normal - * * bottom-up - * * left-up - * * right-up - * - * The property will be persistent across sessions, and the new - * orientations can be deducted from the previous one (it allows - * for a threshold for switching between opposite ends of the - * orientation). - * - * Copyright (C) 2011 Red Hat, Inc. - * Author: - * Bastien Nocera - * - * orientation_calc() from the sensorfw package - * Copyright (C) 2009-2010 Nokia Corporation - * Authors: - * Üstün Ergenoglu - * Timo Rongas - * Lihan Guo - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 keymap; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/* we must use this kernel-compatible implementation */ -#define BITS_PER_LONG (sizeof(unsigned long) * 8) -#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) -#define OFF(x) ((x)%BITS_PER_LONG) -#define BIT(x) (1UL<> OFF(bit)) & 1) - -static int debug = 0; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -typedef enum { - ORIENTATION_UNDEFINED, - ORIENTATION_NORMAL, - ORIENTATION_BOTTOM_UP, - ORIENTATION_LEFT_UP, - ORIENTATION_RIGHT_UP -} OrientationUp; - -static const char *orientations[] = { - "undefined", - "normal", - "bottom-up", - "left-up", - "right-up", - NULL -}; - -#define ORIENTATION_UP_UP ORIENTATION_NORMAL - -#define DEFAULT_THRESHOLD 250 -#define RADIANS_TO_DEGREES 180.0/M_PI -#define SAME_AXIS_LIMIT 5 - -#define THRESHOLD_LANDSCAPE 25 -#define THRESHOLD_PORTRAIT 20 - -static const char * -orientation_to_string (OrientationUp o) -{ - return orientations[o]; -} - -static OrientationUp -string_to_orientation (const char *orientation) -{ - int i; - - if (orientation == NULL) - return ORIENTATION_UNDEFINED; - for (i = 0; orientations[i] != NULL; i++) { - if (strcmp (orientation, orientations[i]) == 0) - return i; - } - return ORIENTATION_UNDEFINED; -} - -static OrientationUp -orientation_calc (OrientationUp prev, - int x, int y, int z) -{ - int rotation; - OrientationUp ret = prev; - - /* Portrait check */ - rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES); - - if (abs(rotation) > THRESHOLD_PORTRAIT) { - ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP; - - /* Some threshold to switching between portrait modes */ - if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) { - if (abs(rotation) < SAME_AXIS_LIMIT) { - ret = prev; - } - } - - } else { - /* Landscape check */ - rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES); - - if (abs(rotation) > THRESHOLD_LANDSCAPE) { - ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL; - - /* Some threshold to switching between landscape modes */ - if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) { - if (abs(rotation) < SAME_AXIS_LIMIT) { - ret = prev; - } - } - } - } - - return ret; -} - -static OrientationUp -get_prev_orientation(struct udev_device *dev) -{ - const char *value; - - value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); - if (value == NULL) - return ORIENTATION_UNDEFINED; - return string_to_orientation(value); -} - -#define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = 1; } } - -/* accelerometers */ -static void test_orientation(struct udev *udev, - struct udev_device *dev, - const char *devpath) -{ - OrientationUp old, new; - int fd, r; - struct input_event ev[64]; - int got_syn = 0; - int got_x, got_y, got_z; - int x = 0, y = 0, z = 0; - char text[64]; - - old = get_prev_orientation(dev); - - if ((fd = open(devpath, O_RDONLY)) < 0) - return; - - got_x = got_y = got_z = 0; - - while (1) { - int i; - - r = read(fd, ev, sizeof(struct input_event) * 64); - - if (r < (int) sizeof(struct input_event)) - return; - - for (i = 0; i < r / (int) sizeof(struct input_event); i++) { - if (got_syn == 1) { - if (ev[i].type == EV_ABS) { - SET_AXIS(x, ABS_X); - SET_AXIS(y, ABS_Y); - SET_AXIS(z, ABS_Z); - } - } - if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) { - got_syn = 1; - } - if (got_x && got_y && got_z) - goto read_dev; - } - } - -read_dev: - close(fd); - - if (!got_x || !got_y || !got_z) - return; - - new = orientation_calc(old, x, y, z); - snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new)); - puts(text); -} - -static void help(void) -{ - printf("Usage: accelerometer [options] \n" - " --debug debug to stderr\n" - " --help print this help text\n\n"); -} - -int main (int argc, char** argv) -{ - struct udev *udev; - struct udev_device *dev; - - static const struct option options[] = { - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - char devpath[PATH_MAX]; - char *devnode; - const char *id_path; - struct udev_enumerate *enumerate; - struct udev_list_entry *list_entry; - - udev = udev_new(); - if (udev == NULL) - return 1; - - udev_log_init("input_id"); - udev_set_log_fn(udev, log_fn); - - /* CLI argument parsing */ - while (1) { - int option; - - option = getopt_long(argc, argv, "dxh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - help(); - exit(0); - default: - exit(1); - } - } - - if (argv[optind] == NULL) { - help(); - exit(1); - } - - /* get the device */ - snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); - dev = udev_device_new_from_syspath(udev, devpath); - if (dev == NULL) { - fprintf(stderr, "unable to access '%s'\n", devpath); - return 1; - } - - id_path = udev_device_get_property_value(dev, "ID_PATH"); - if (id_path == NULL) { - fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath); - return 0; - } - - /* Get the children devices and find the devnode - * FIXME: use udev_enumerate_add_match_children() instead - * when it's available */ - devnode = NULL; - enumerate = udev_enumerate_new(udev); - udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path); - udev_enumerate_add_match_subsystem(enumerate, "input"); - udev_enumerate_scan_devices(enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; - const char *node; - - device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), - udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - /* Already found it */ - if (devnode != NULL) { - udev_device_unref(device); - continue; - } - - node = udev_device_get_devnode(device); - if (node == NULL) { - udev_device_unref(device); - continue; - } - /* Use the event sub-device */ - if (strstr(node, "/event") == NULL) { - udev_device_unref(device); - continue; - } - - devnode = strdup(node); - udev_device_unref(device); - } - - if (devnode == NULL) { - fprintf(stderr, "unable to get device node for '%s'\n", devpath); - return 0; - } - - info(udev, "Opening accelerometer device %s\n", devnode); - test_orientation(udev, dev, devnode); - free(devnode); - - return 0; -} diff --git a/extras/ata_id/.gitignore b/extras/ata_id/.gitignore deleted file mode 100644 index 77837266e6..0000000000 --- a/extras/ata_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ata_id diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c deleted file mode 100644 index 64df86c23a..0000000000 --- a/extras/ata_id/ata_id.c +++ /dev/null @@ -1,726 +0,0 @@ -/* - * ata_id - reads product/serial number from ATA drives - * - * Copyright (C) 2005-2008 Kay Sievers - * Copyright (C) 2009 Lennart Poettering - * Copyright (C) 2009-2010 David Zeuthen - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -#define COMMAND_TIMEOUT_MSEC (30 * 1000) - -static int disk_scsi_inquiry_command(int fd, - void *buf, - size_t buf_len) -{ - struct sg_io_v4 io_v4; - uint8_t cdb[6]; - uint8_t sense[32]; - int ret; - - /* - * INQUIRY, see SPC-4 section 6.4 - */ - memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0x12; /* OPERATION CODE: INQUIRY */ - cdb[3] = (buf_len >> 8); /* ALLOCATION LENGTH */ - cdb[4] = (buf_len & 0xff); - - memset(sense, 0, sizeof(sense)); - - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof (cdb); - io_v4.request = (uintptr_t) cdb; - io_v4.max_response_len = sizeof (sense); - io_v4.response = (uintptr_t) sense; - io_v4.din_xfer_len = buf_len; - io_v4.din_xferp = (uintptr_t) buf; - io_v4.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_v4); - if (ret != 0) { - /* could be that the driver doesn't do version 4, try version 3 */ - if (errno == EINVAL) { - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = sizeof (cdb); - io_hdr.dxferp = buf; - io_hdr.dxfer_len = buf_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sizeof (sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_hdr); - if (ret != 0) - goto out; - - /* even if the ioctl succeeds, we need to check the return value */ - if (!(io_hdr.status == 0 && - io_hdr.host_status == 0 && - io_hdr.driver_status == 0)) { - errno = EIO; - ret = -1; - goto out; - } - } else { - goto out; - } - } - - /* even if the ioctl succeeds, we need to check the return value */ - if (!(io_v4.device_status == 0 && - io_v4.transport_status == 0 && - io_v4.driver_status == 0)) { - errno = EIO; - ret = -1; - goto out; - } - - out: - return ret; -} - -static int disk_identify_command(int fd, - void *buf, - size_t buf_len) -{ - struct sg_io_v4 io_v4; - uint8_t cdb[12]; - uint8_t sense[32]; - uint8_t *desc = sense+8; - int ret; - - /* - * ATA Pass-Through 12 byte command, as described in - * - * T10 04-262r8 ATA Command Pass-Through - * - * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf - */ - memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0xa1; /* OPERATION CODE: 12 byte pass through */ - cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ - cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ - cdb[3] = 0; /* FEATURES */ - cdb[4] = 1; /* SECTORS */ - cdb[5] = 0; /* LBA LOW */ - cdb[6] = 0; /* LBA MID */ - cdb[7] = 0; /* LBA HIGH */ - cdb[8] = 0 & 0x4F; /* SELECT */ - cdb[9] = 0xEC; /* Command: ATA IDENTIFY DEVICE */; - memset(sense, 0, sizeof(sense)); - - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof (cdb); - io_v4.request = (uintptr_t) cdb; - io_v4.max_response_len = sizeof (sense); - io_v4.response = (uintptr_t) sense; - io_v4.din_xfer_len = buf_len; - io_v4.din_xferp = (uintptr_t) buf; - io_v4.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_v4); - if (ret != 0) { - /* could be that the driver doesn't do version 4, try version 3 */ - if (errno == EINVAL) { - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = sizeof (cdb); - io_hdr.dxferp = buf; - io_hdr.dxfer_len = buf_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sizeof (sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_hdr); - if (ret != 0) - goto out; - } else { - goto out; - } - } - - if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { - errno = EIO; - ret = -1; - goto out; - } - - out: - return ret; -} - -static int disk_identify_packet_device_command(int fd, - void *buf, - size_t buf_len) -{ - struct sg_io_v4 io_v4; - uint8_t cdb[16]; - uint8_t sense[32]; - uint8_t *desc = sense+8; - int ret; - - /* - * ATA Pass-Through 16 byte command, as described in - * - * T10 04-262r8 ATA Command Pass-Through - * - * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf - */ - memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0x85; /* OPERATION CODE: 16 byte pass through */ - cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ - cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ - cdb[3] = 0; /* FEATURES */ - cdb[4] = 0; /* FEATURES */ - cdb[5] = 0; /* SECTORS */ - cdb[6] = 1; /* SECTORS */ - cdb[7] = 0; /* LBA LOW */ - cdb[8] = 0; /* LBA LOW */ - cdb[9] = 0; /* LBA MID */ - cdb[10] = 0; /* LBA MID */ - cdb[11] = 0; /* LBA HIGH */ - cdb[12] = 0; /* LBA HIGH */ - cdb[13] = 0; /* DEVICE */ - cdb[14] = 0xA1; /* Command: ATA IDENTIFY PACKET DEVICE */; - cdb[15] = 0; /* CONTROL */ - memset(sense, 0, sizeof(sense)); - - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof (cdb); - io_v4.request = (uintptr_t) cdb; - io_v4.max_response_len = sizeof (sense); - io_v4.response = (uintptr_t) sense; - io_v4.din_xfer_len = buf_len; - io_v4.din_xferp = (uintptr_t) buf; - io_v4.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_v4); - if (ret != 0) { - /* could be that the driver doesn't do version 4, try version 3 */ - if (errno == EINVAL) { - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = sizeof (cdb); - io_hdr.dxferp = buf; - io_hdr.dxfer_len = buf_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sizeof (sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_hdr); - if (ret != 0) - goto out; - } else { - goto out; - } - } - - if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { - errno = EIO; - ret = -1; - goto out; - } - - out: - return ret; -} - -/** - * disk_identify_get_string: - * @identify: A block of IDENTIFY data - * @offset_words: Offset of the string to get, in words. - * @dest: Destination buffer for the string. - * @dest_len: Length of destination buffer, in bytes. - * - * Copies the ATA string from @identify located at @offset_words into @dest. - */ -static void disk_identify_get_string (uint8_t identify[512], - unsigned int offset_words, - char *dest, - size_t dest_len) -{ - unsigned int c1; - unsigned int c2; - - assert (identify != NULL); - assert (dest != NULL); - assert ((dest_len & 1) == 0); - - while (dest_len > 0) { - c1 = ((uint16_t *) identify)[offset_words] >> 8; - c2 = ((uint16_t *) identify)[offset_words] & 0xff; - *dest = c1; - dest++; - *dest = c2; - dest++; - offset_words++; - dest_len -= 2; - } -} - -static void disk_identify_fixup_string (uint8_t identify[512], - unsigned int offset_words, - size_t len) -{ - disk_identify_get_string(identify, offset_words, - (char *) identify + offset_words * 2, len); -} - -static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offset_words) -{ - uint16_t *p; - - p = (uint16_t *) identify; - p[offset_words] = le16toh (p[offset_words]); -} - -/** - * disk_identify: - * @udev: The libudev context. - * @fd: File descriptor for the block device. - * @out_identify: Return location for IDENTIFY data. - * @out_is_packet_device: Return location for whether returned data is from a IDENTIFY PACKET DEVICE. - * - * Sends the IDENTIFY DEVICE or IDENTIFY PACKET DEVICE command to the - * device represented by @fd. If successful, then the result will be - * copied into @out_identify and @out_is_packet_device. - * - * This routine is based on code from libatasmart, Copyright 2008 - * Lennart Poettering, LGPL v2.1. - * - * Returns: 0 if the data was successfully obtained, otherwise - * non-zero with errno set. - */ -static int disk_identify (struct udev *udev, - int fd, - uint8_t out_identify[512], - int *out_is_packet_device) -{ - int ret; - uint8_t inquiry_buf[36]; - int peripheral_device_type; - int all_nul_bytes; - int n; - int is_packet_device; - - assert (out_identify != NULL); - - /* init results */ - ret = -1; - memset (out_identify, '\0', 512); - is_packet_device = 0; - - /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device - * we could accidentally blank media. This is because MMC's BLANK - * command has the same op-code (0x61). - * - * To prevent this from happening we bail out if the device - * isn't a Direct Access Block Device, e.g. SCSI type 0x00 - * (CD/DVD devices are type 0x05). So we send a SCSI INQUIRY - * command first... libata is handling this via its SCSI - * emulation layer. - * - * This also ensures that we're actually dealing with a device - * that understands SCSI commands. - * - * (Yes, it is a bit perverse that we're tunneling the ATA - * command through SCSI and relying on the ATA driver - * emulating SCSI well-enough...) - * - * (See commit 160b069c25690bfb0c785994c7c3710289179107 for - * the original bug-fix and see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635 - * for the original bug-report.) - */ - ret = disk_scsi_inquiry_command (fd, inquiry_buf, sizeof (inquiry_buf)); - if (ret != 0) - goto out; - - /* SPC-4, section 6.4.2: Standard INQUIRY data */ - peripheral_device_type = inquiry_buf[0] & 0x1f; - if (peripheral_device_type == 0x05) - { - is_packet_device = 1; - ret = disk_identify_packet_device_command(fd, out_identify, 512); - goto check_nul_bytes; - } - if (peripheral_device_type != 0x00) { - ret = -1; - errno = EIO; - goto out; - } - - /* OK, now issue the IDENTIFY DEVICE command */ - ret = disk_identify_command(fd, out_identify, 512); - if (ret != 0) - goto out; - - check_nul_bytes: - /* Check if IDENTIFY data is all NUL bytes - if so, bail */ - all_nul_bytes = 1; - for (n = 0; n < 512; n++) { - if (out_identify[n] != '\0') { - all_nul_bytes = 0; - break; - } - } - - if (all_nul_bytes) { - ret = -1; - errno = EIO; - goto out; - } - -out: - if (out_is_packet_device != NULL) - *out_is_packet_device = is_packet_device; - return ret; -} - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - struct hd_driveid id; - uint8_t identify[512]; - uint16_t *identify_words; - char model[41]; - char model_enc[256]; - char serial[21]; - char revision[9]; - const char *node = NULL; - int export = 0; - int fd; - uint16_t word; - int rc = 0; - int is_packet_device = 0; - static const struct option options[] = { - { "export", no_argument, NULL, 'x' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("ata_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "xh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'x': - export = 1; - break; - case 'h': - printf("Usage: ata_id [--export] [--help] \n" - " --export print values as environment keys\n" - " --help print this help text\n\n"); - goto exit; - } - } - - node = argv[optind]; - if (node == NULL) { - err(udev, "no node specified\n"); - rc = 1; - goto exit; - } - - fd = open(node, O_RDONLY|O_NONBLOCK); - if (fd < 0) { - err(udev, "unable to open '%s'\n", node); - rc = 1; - goto exit; - } - - if (disk_identify(udev, fd, identify, &is_packet_device) == 0) { - /* - * fix up only the fields from the IDENTIFY data that we are going to - * use and copy it into the hd_driveid struct for convenience - */ - disk_identify_fixup_string (identify, 10, 20); /* serial */ - disk_identify_fixup_string (identify, 23, 6); /* fwrev */ - disk_identify_fixup_string (identify, 27, 40); /* model */ - disk_identify_fixup_uint16 (identify, 0); /* configuration */ - disk_identify_fixup_uint16 (identify, 75); /* queue depth */ - disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ - disk_identify_fixup_uint16 (identify, 82); /* command set supported */ - disk_identify_fixup_uint16 (identify, 83); /* command set supported */ - disk_identify_fixup_uint16 (identify, 84); /* command set supported */ - disk_identify_fixup_uint16 (identify, 85); /* command set supported */ - disk_identify_fixup_uint16 (identify, 86); /* command set supported */ - disk_identify_fixup_uint16 (identify, 87); /* command set supported */ - disk_identify_fixup_uint16 (identify, 89); /* time required for SECURITY ERASE UNIT */ - disk_identify_fixup_uint16 (identify, 90); /* time required for enhanced SECURITY ERASE UNIT */ - disk_identify_fixup_uint16 (identify, 91); /* current APM values */ - disk_identify_fixup_uint16 (identify, 94); /* current AAM value */ - disk_identify_fixup_uint16 (identify, 128); /* device lock function */ - disk_identify_fixup_uint16 (identify, 217); /* nominal media rotation rate */ - memcpy(&id, identify, sizeof id); - } else { - /* If this fails, then try HDIO_GET_IDENTITY */ - if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) { - if (errno == ENOTTY) { - info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); - rc = 2; - } else { - err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); - rc = 3; - } - goto close; - } - } - identify_words = (uint16_t *) identify; - - memcpy (model, id.model, 40); - model[40] = '\0'; - udev_util_encode_string(model, model_enc, sizeof(model_enc)); - util_replace_whitespace((char *) id.model, model, 40); - util_replace_chars(model, NULL); - util_replace_whitespace((char *) id.serial_no, serial, 20); - util_replace_chars(serial, NULL); - util_replace_whitespace((char *) id.fw_rev, revision, 8); - util_replace_chars(revision, NULL); - - if (export) { - /* Set this to convey the disk speaks the ATA protocol */ - printf("ID_ATA=1\n"); - - if ((id.config >> 8) & 0x80) { - /* This is an ATAPI device */ - switch ((id.config >> 8) & 0x1f) { - case 0: - printf("ID_TYPE=cd\n"); - break; - case 1: - printf("ID_TYPE=tape\n"); - break; - case 5: - printf("ID_TYPE=cd\n"); - break; - case 7: - printf("ID_TYPE=optical\n"); - break; - default: - printf("ID_TYPE=generic\n"); - break; - } - } else { - printf("ID_TYPE=disk\n"); - } - printf("ID_BUS=ata\n"); - printf("ID_MODEL=%s\n", model); - printf("ID_MODEL_ENC=%s\n", model_enc); - printf("ID_REVISION=%s\n", revision); - if (serial[0] != '\0') { - printf("ID_SERIAL=%s_%s\n", model, serial); - printf("ID_SERIAL_SHORT=%s\n", serial); - } else { - printf("ID_SERIAL=%s\n", model); - } - - if (id.command_set_1 & (1<<5)) { - printf ("ID_ATA_WRITE_CACHE=1\n"); - printf ("ID_ATA_WRITE_CACHE_ENABLED=%d\n", (id.cfs_enable_1 & (1<<5)) ? 1 : 0); - } - if (id.command_set_1 & (1<<10)) { - printf("ID_ATA_FEATURE_SET_HPA=1\n"); - printf("ID_ATA_FEATURE_SET_HPA_ENABLED=%d\n", (id.cfs_enable_1 & (1<<10)) ? 1 : 0); - - /* - * TODO: use the READ NATIVE MAX ADDRESS command to get the native max address - * so it is easy to check whether the protected area is in use. - */ - } - if (id.command_set_1 & (1<<3)) { - printf("ID_ATA_FEATURE_SET_PM=1\n"); - printf("ID_ATA_FEATURE_SET_PM_ENABLED=%d\n", (id.cfs_enable_1 & (1<<3)) ? 1 : 0); - } - if (id.command_set_1 & (1<<1)) { - printf("ID_ATA_FEATURE_SET_SECURITY=1\n"); - printf("ID_ATA_FEATURE_SET_SECURITY_ENABLED=%d\n", (id.cfs_enable_1 & (1<<1)) ? 1 : 0); - printf("ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=%d\n", id.trseuc * 2); - if ((id.cfs_enable_1 & (1<<1))) /* enabled */ { - if (id.dlf & (1<<8)) - printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=maximum\n"); - else - printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=high\n"); - } - if (id.dlf & (1<<5)) - printf("ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=%d\n", id.trsEuc * 2); - if (id.dlf & (1<<4)) - printf("ID_ATA_FEATURE_SET_SECURITY_EXPIRE=1\n"); - if (id.dlf & (1<<3)) - printf("ID_ATA_FEATURE_SET_SECURITY_FROZEN=1\n"); - if (id.dlf & (1<<2)) - printf("ID_ATA_FEATURE_SET_SECURITY_LOCKED=1\n"); - } - if (id.command_set_1 & (1<<0)) { - printf("ID_ATA_FEATURE_SET_SMART=1\n"); - printf("ID_ATA_FEATURE_SET_SMART_ENABLED=%d\n", (id.cfs_enable_1 & (1<<0)) ? 1 : 0); - } - if (id.command_set_2 & (1<<9)) { - printf("ID_ATA_FEATURE_SET_AAM=1\n"); - printf("ID_ATA_FEATURE_SET_AAM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<9)) ? 1 : 0); - printf("ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=%d\n", id.acoustic >> 8); - printf("ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=%d\n", id.acoustic & 0xff); - } - if (id.command_set_2 & (1<<5)) { - printf("ID_ATA_FEATURE_SET_PUIS=1\n"); - printf("ID_ATA_FEATURE_SET_PUIS_ENABLED=%d\n", (id.cfs_enable_2 & (1<<5)) ? 1 : 0); - } - if (id.command_set_2 & (1<<3)) { - printf("ID_ATA_FEATURE_SET_APM=1\n"); - printf("ID_ATA_FEATURE_SET_APM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<3)) ? 1 : 0); - if ((id.cfs_enable_2 & (1<<3))) - printf("ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=%d\n", id.CurAPMvalues & 0xff); - } - if (id.command_set_2 & (1<<0)) - printf("ID_ATA_DOWNLOAD_MICROCODE=1\n"); - - /* - * Word 76 indicates the capabilities of a SATA device. A PATA device shall set - * word 76 to 0000h or FFFFh. If word 76 is set to 0000h or FFFFh, then - * the device does not claim compliance with the Serial ATA specification and words - * 76 through 79 are not valid and shall be ignored. - */ - word = *((uint16_t *) identify + 76); - if (word != 0x0000 && word != 0xffff) { - printf("ID_ATA_SATA=1\n"); - /* - * If bit 2 of word 76 is set to one, then the device supports the Gen2 - * signaling rate of 3.0 Gb/s (see SATA 2.6). - * - * If bit 1 of word 76 is set to one, then the device supports the Gen1 - * signaling rate of 1.5 Gb/s (see SATA 2.6). - */ - if (word & (1<<2)) - printf("ID_ATA_SATA_SIGNAL_RATE_GEN2=1\n"); - if (word & (1<<1)) - printf("ID_ATA_SATA_SIGNAL_RATE_GEN1=1\n"); - } - - /* Word 217 indicates the nominal media rotation rate of the device */ - word = *((uint16_t *) identify + 217); - if (word != 0x0000) { - if (word == 0x0001) { - printf ("ID_ATA_ROTATION_RATE_RPM=0\n"); /* non-rotating e.g. SSD */ - } else if (word >= 0x0401 && word <= 0xfffe) { - printf ("ID_ATA_ROTATION_RATE_RPM=%d\n", word); - } - } - - /* - * Words 108-111 contain a mandatory World Wide Name (WWN) in the NAA IEEE Registered identifier - * format. Word 108 bits (15:12) shall contain 5h, indicating that the naming authority is IEEE. - * All other values are reserved. - */ - word = *((uint16_t *) identify + 108); - if ((word & 0xf000) == 0x5000) { - uint64_t wwwn; - - wwwn = *((uint16_t *) identify + 108); - wwwn <<= 16; - wwwn |= *((uint16_t *) identify + 109); - wwwn <<= 16; - wwwn |= *((uint16_t *) identify + 110); - wwwn <<= 16; - wwwn |= *((uint16_t *) identify + 111); - printf("ID_WWN=0x%llx\n", (unsigned long long int) wwwn); - /* ATA devices have no vendor extension */ - printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn); - } - - /* from Linux's include/linux/ata.h */ - if (identify_words[0] == 0x848a || identify_words[0] == 0x844a) { - printf("ID_ATA_CFA=1\n"); - } else { - if ((identify_words[83] & 0xc004) == 0x4004) { - printf("ID_ATA_CFA=1\n"); - } - } - } else { - if (serial[0] != '\0') - printf("%s_%s\n", model, serial); - else - printf("%s\n", model); - } -close: - close(fd); -exit: - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/extras/cdrom_id/.gitignore b/extras/cdrom_id/.gitignore deleted file mode 100644 index 7d817ea74e..0000000000 --- a/extras/cdrom_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cdrom_id diff --git a/extras/cdrom_id/60-cdrom_id.rules b/extras/cdrom_id/60-cdrom_id.rules deleted file mode 100644 index 353f522b0b..0000000000 --- a/extras/cdrom_id/60-cdrom_id.rules +++ /dev/null @@ -1,18 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="cdrom_end" -SUBSYSTEM!="block", GOTO="cdrom_end" -KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" -ENV{DEVTYPE}!="disk", GOTO="cdrom_end" - -# unconditionally tag device as CDROM -KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" - -# media eject button pressed -ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end" - -# import device and media properties and lock tray to -# enable the receiving of media eject button events -IMPORT{program}="cdrom_id --lock-media $devnode" - -LABEL="cdrom_end" diff --git a/extras/cdrom_id/cdrom_id.c b/extras/cdrom_id/cdrom_id.c deleted file mode 100644 index 664a00d2c7..0000000000 --- a/extras/cdrom_id/cdrom_id.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* - * cdrom_id - optical drive and media information prober - * - * Copyright (C) 2008-2010 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static bool debug; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -/* device info */ -static unsigned int cd_cd_rom = 0; -static unsigned int cd_cd_r = 0; -static unsigned int cd_cd_rw = 0; -static unsigned int cd_dvd_rom = 0; -static unsigned int cd_dvd_r = 0; -static unsigned int cd_dvd_rw = 0; -static unsigned int cd_dvd_ram = 0; -static unsigned int cd_dvd_plus_r = 0; -static unsigned int cd_dvd_plus_rw = 0; -static unsigned int cd_dvd_plus_r_dl = 0; -static unsigned int cd_dvd_plus_rw_dl = 0; -static unsigned int cd_bd = 0; -static unsigned int cd_bd_r = 0; -static unsigned int cd_bd_re = 0; -static unsigned int cd_hddvd = 0; -static unsigned int cd_hddvd_r = 0; -static unsigned int cd_hddvd_rw = 0; -static unsigned int cd_mo = 0; -static unsigned int cd_mrw = 0; -static unsigned int cd_mrw_w = 0; - -/* media info */ -static unsigned int cd_media = 0; -static unsigned int cd_media_cd_rom = 0; -static unsigned int cd_media_cd_r = 0; -static unsigned int cd_media_cd_rw = 0; -static unsigned int cd_media_dvd_rom = 0; -static unsigned int cd_media_dvd_r = 0; -static unsigned int cd_media_dvd_rw = 0; -static unsigned int cd_media_dvd_rw_ro = 0; /* restricted overwrite mode */ -static unsigned int cd_media_dvd_rw_seq = 0; /* sequential mode */ -static unsigned int cd_media_dvd_ram = 0; -static unsigned int cd_media_dvd_plus_r = 0; -static unsigned int cd_media_dvd_plus_rw = 0; -static unsigned int cd_media_dvd_plus_r_dl = 0; -static unsigned int cd_media_dvd_plus_rw_dl = 0; -static unsigned int cd_media_bd = 0; -static unsigned int cd_media_bd_r = 0; -static unsigned int cd_media_bd_re = 0; -static unsigned int cd_media_hddvd = 0; -static unsigned int cd_media_hddvd_r = 0; -static unsigned int cd_media_hddvd_rw = 0; -static unsigned int cd_media_mo = 0; -static unsigned int cd_media_mrw = 0; -static unsigned int cd_media_mrw_w = 0; - -static const char *cd_media_state = NULL; -static unsigned int cd_media_session_next = 0; -static unsigned int cd_media_session_count = 0; -static unsigned int cd_media_track_count = 0; -static unsigned int cd_media_track_count_data = 0; -static unsigned int cd_media_track_count_audio = 0; -static unsigned long long int cd_media_session_last_offset = 0; - -#define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) -#define SK(errcode) (((errcode) >> 16) & 0xF) -#define ASC(errcode) (((errcode) >> 8) & 0xFF) -#define ASCQ(errcode) ((errcode) & 0xFF) - -static int is_mounted(const char *device) -{ - struct stat statbuf; - FILE *fp; - int maj, min; - int mounted = 0; - - if (stat(device, &statbuf) < 0) - return -ENODEV; - - fp = fopen("/proc/self/mountinfo", "r"); - if (fp == NULL) - return -ENOSYS; - while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { - if (makedev(maj, min) == statbuf.st_rdev) { - mounted = 1; - break; - } - } - fclose(fp); - return mounted; -} - -static void info_scsi_cmd_err(struct udev *udev, char *cmd, int err) -{ - if (err == -1) { - info(udev, "%s failed\n", cmd); - return; - } - info(udev, "%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); -} - -struct scsi_cmd { - struct cdrom_generic_command cgc; - union { - struct request_sense s; - unsigned char u[18]; - } _sense; - struct sg_io_hdr sg_io; -}; - -static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd) -{ - memset(cmd, 0x00, sizeof(struct scsi_cmd)); - cmd->cgc.quiet = 1; - cmd->cgc.sense = &cmd->_sense.s; - cmd->sg_io.interface_id = 'S'; - cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); - cmd->sg_io.cmdp = cmd->cgc.cmd; - cmd->sg_io.sbp = cmd->_sense.u; - cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; -} - -static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg) -{ - cmd->sg_io.cmd_len = i + 1; - cmd->cgc.cmd[i] = arg; -} - -#define CHECK_CONDITION 0x01 - -static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize) -{ - int ret = 0; - - if (bufsize > 0) { - cmd->sg_io.dxferp = buf; - cmd->sg_io.dxfer_len = bufsize; - cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; - } else { - cmd->sg_io.dxfer_direction = SG_DXFER_NONE; - } - if (ioctl(fd, SG_IO, &cmd->sg_io)) - return -1; - - if ((cmd->sg_io.info & SG_INFO_OK_MASK) != SG_INFO_OK) { - errno = EIO; - ret = -1; - if (cmd->sg_io.masked_status & CHECK_CONDITION) { - ret = ERRCODE(cmd->_sense.u); - if (ret == 0) - ret = -1; - } - } - return ret; -} - -static int media_lock(struct udev *udev, int fd, bool lock) -{ - int err; - - /* disable the kernel's lock logic */ - err = ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK); - if (err < 0) - info(udev, "CDROM_CLEAR_OPTIONS, CDO_LOCK failed\n"); - - err = ioctl(fd, CDROM_LOCKDOOR, lock ? 1 : 0); - if (err < 0) - info(udev, "CDROM_LOCKDOOR failed\n"); - - return err; -} - -static int media_eject(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x1b); - scsi_cmd_set(udev, &sc, 4, 0x02); - scsi_cmd_set(udev, &sc, 5, 0); - err = scsi_cmd_run(udev, &sc, fd, NULL, 0); - if ((err != 0)) { - info_scsi_cmd_err(udev, "START_STOP_UNIT", err); - return -1; - } - return 0; -} - -static int cd_capability_compat(struct udev *udev, int fd) -{ - int capability; - - capability = ioctl(fd, CDROM_GET_CAPABILITY, NULL); - if (capability < 0) { - info(udev, "CDROM_GET_CAPABILITY failed\n"); - return -1; - } - - if (capability & CDC_CD_R) - cd_cd_r = 1; - if (capability & CDC_CD_RW) - cd_cd_rw = 1; - if (capability & CDC_DVD) - cd_dvd_rom = 1; - if (capability & CDC_DVD_R) - cd_dvd_r = 1; - if (capability & CDC_DVD_RAM) - cd_dvd_ram = 1; - if (capability & CDC_MRW) - cd_mrw = 1; - if (capability & CDC_MRW_W) - cd_mrw_w = 1; - return 0; -} - -static int cd_media_compat(struct udev *udev, int fd) -{ - if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) { - info(udev, "CDROM_DRIVE_STATUS != CDS_DISC_OK\n"); - return -1; - } - cd_media = 1; - return 0; -} - -static int cd_inquiry(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - unsigned char inq[128]; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x12); - scsi_cmd_set(udev, &sc, 4, 36); - scsi_cmd_set(udev, &sc, 5, 0); - err = scsi_cmd_run(udev, &sc, fd, inq, 36); - if ((err != 0)) { - info_scsi_cmd_err(udev, "INQUIRY", err); - return -1; - } - - if ((inq[0] & 0x1F) != 5) { - info(udev, "not an MMC unit\n"); - return -1; - } - - info(udev, "INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); - return 0; -} - -static void feature_profile_media(struct udev *udev, int cur_profile) -{ - switch (cur_profile) { - case 0x03: - case 0x04: - case 0x05: - info(udev, "profile 0x%02x \n", cur_profile); - cd_media = 1; - cd_media_mo = 1; - break; - case 0x08: - info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); - cd_media = 1; - cd_media_cd_rom = 1; - break; - case 0x09: - info(udev, "profile 0x%02x media_cd_r\n", cur_profile); - cd_media = 1; - cd_media_cd_r = 1; - break; - case 0x0a: - info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); - cd_media = 1; - cd_media_cd_rw = 1; - break; - case 0x10: - info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rom = 1; - break; - case 0x11: - info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_r = 1; - break; - case 0x12: - info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); - cd_media = 1; - cd_media_dvd_ram = 1; - break; - case 0x13: - info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_ro = 1; - break; - case 0x14: - info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_seq = 1; - break; - case 0x1B: - info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r = 1; - break; - case 0x1A: - info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw = 1; - break; - case 0x2A: - info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw_dl = 1; - break; - case 0x2B: - info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r_dl = 1; - break; - case 0x40: - info(udev, "profile 0x%02x media_bd\n", cur_profile); - cd_media = 1; - cd_media_bd = 1; - break; - case 0x41: - case 0x42: - info(udev, "profile 0x%02x media_bd_r\n", cur_profile); - cd_media = 1; - cd_media_bd_r = 1; - break; - case 0x43: - info(udev, "profile 0x%02x media_bd_re\n", cur_profile); - cd_media = 1; - cd_media_bd_re = 1; - break; - case 0x50: - info(udev, "profile 0x%02x media_hddvd\n", cur_profile); - cd_media = 1; - cd_media_hddvd = 1; - break; - case 0x51: - info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); - cd_media = 1; - cd_media_hddvd_r = 1; - break; - case 0x52: - info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); - cd_media = 1; - cd_media_hddvd_rw = 1; - break; - default: - info(udev, "profile 0x%02x \n", cur_profile); - break; - } -} - -static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) -{ - unsigned int i; - - for (i = 0; i+4 <= size; i += 4) { - int profile; - - profile = profiles[i] << 8 | profiles[i+1]; - switch (profile) { - case 0x03: - case 0x04: - case 0x05: - info(udev, "profile 0x%02x mo\n", profile); - cd_mo = 1; - break; - case 0x08: - info(udev, "profile 0x%02x cd_rom\n", profile); - cd_cd_rom = 1; - break; - case 0x09: - info(udev, "profile 0x%02x cd_r\n", profile); - cd_cd_r = 1; - break; - case 0x0A: - info(udev, "profile 0x%02x cd_rw\n", profile); - cd_cd_rw = 1; - break; - case 0x10: - info(udev, "profile 0x%02x dvd_rom\n", profile); - cd_dvd_rom = 1; - break; - case 0x12: - info(udev, "profile 0x%02x dvd_ram\n", profile); - cd_dvd_ram = 1; - break; - case 0x13: - case 0x14: - info(udev, "profile 0x%02x dvd_rw\n", profile); - cd_dvd_rw = 1; - break; - case 0x1B: - info(udev, "profile 0x%02x dvd_plus_r\n", profile); - cd_dvd_plus_r = 1; - break; - case 0x1A: - info(udev, "profile 0x%02x dvd_plus_rw\n", profile); - cd_dvd_plus_rw = 1; - break; - case 0x2A: - info(udev, "profile 0x%02x dvd_plus_rw_dl\n", profile); - cd_dvd_plus_rw_dl = 1; - break; - case 0x2B: - info(udev, "profile 0x%02x dvd_plus_r_dl\n", profile); - cd_dvd_plus_r_dl = 1; - break; - case 0x40: - cd_bd = 1; - info(udev, "profile 0x%02x bd\n", profile); - break; - case 0x41: - case 0x42: - cd_bd_r = 1; - info(udev, "profile 0x%02x bd_r\n", profile); - break; - case 0x43: - cd_bd_re = 1; - info(udev, "profile 0x%02x bd_re\n", profile); - break; - case 0x50: - cd_hddvd = 1; - info(udev, "profile 0x%02x hddvd\n", profile); - break; - case 0x51: - cd_hddvd_r = 1; - info(udev, "profile 0x%02x hddvd_r\n", profile); - break; - case 0x52: - cd_hddvd_rw = 1; - info(udev, "profile 0x%02x hddvd_rw\n", profile); - break; - default: - info(udev, "profile 0x%02x \n", profile); - break; - } - } - return 0; -} - -/* returns 0 if media was detected */ -static int cd_profiles_old_mmc(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - int err; - - unsigned char header[32]; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - if (cd_media == 1) { - info(udev, "no current profile, but disc is present; assuming CD-ROM\n"); - cd_media_cd_rom = 1; - return 0; - } else { - info(udev, "no current profile, assuming no media\n"); - return -1; - } - }; - - cd_media = 1; - - if (header[2] & 16) { - cd_media_cd_rw = 1; - info(udev, "profile 0x0a media_cd_rw\n"); - } else if ((header[2] & 3) < 2 && cd_cd_r) { - cd_media_cd_r = 1; - info(udev, "profile 0x09 media_cd_r\n"); - } else { - cd_media_cd_rom = 1; - info(udev, "profile 0x08 media_cd_rom\n"); - } - return 0; -} - -/* returns 0 if media was detected */ -static int cd_profiles(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - unsigned char features[65530]; - unsigned int cur_profile = 0; - unsigned int len; - unsigned int i; - int err; - int ret; - - ret = -1; - - /* First query the current profile */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 8, 8); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, features, 8); - if ((err != 0)) { - info_scsi_cmd_err(udev, "GET CONFIGURATION", err); - /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ - if (SK(err) == 0x5 && ASC(err) == 0x20) { - info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n"); - info(udev, "trying to work around the problem\n"); - ret = cd_profiles_old_mmc(udev, fd); - } - goto out; - } - - cur_profile = features[6] << 8 | features[7]; - if (cur_profile > 0) { - info(udev, "current profile 0x%02x\n", cur_profile); - feature_profile_media (udev, cur_profile); - ret = 0; /* we have media */ - } else { - info(udev, "no current profile, assuming no media\n"); - } - - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; - info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); - - if (len > sizeof(features)) { - info(udev, "can not get features in a single query, truncating\n"); - len = sizeof(features); - } else if (len <= 8) { - len = sizeof(features); - } - - /* Now get the full feature buffer */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff); - scsi_cmd_set(udev, &sc, 8, len & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, features, len); - if ((err != 0)) { - info_scsi_cmd_err(udev, "GET CONFIGURATION", err); - return -1; - } - - /* parse the length once more, in case the drive decided to have other features suddenly :) */ - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; - info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); - - if (len > sizeof(features)) { - info(udev, "can not get features in a single query, truncating\n"); - len = sizeof(features); - } - - /* device features */ - for (i = 8; i+4 < len; i += (4 + features[i+3])) { - unsigned int feature; - - feature = features[i] << 8 | features[i+1]; - - switch (feature) { - case 0x00: - info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); - feature_profiles(udev, &features[i]+4, features[i+3]); - break; - default: - info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); - break; - } - } -out: - return ret; -} - -static int cd_media_info(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - unsigned char header[32]; - static const char *media_status[] = { - "blank", - "appendable", - "complete", - "other" - }; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - return -1; - }; - - cd_media = 1; - info(udev, "disk type %02x\n", header[8]); - info(udev, "hardware reported media status: %s\n", media_status[header[2] & 3]); - - /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ - if (!cd_media_cd_rom) - cd_media_state = media_status[header[2] & 3]; - - /* fresh DVD-RW in restricted overwite mode reports itself as - * "appendable"; change it to "blank" to make it consistent with what - * gets reported after blanking, and what userspace expects */ - if (cd_media_dvd_rw_ro && (header[2] & 3) == 1) - cd_media_state = media_status[0]; - - /* DVD+RW discs (and DVD-RW in restricted mode) once formatted are - * always "complete", DVD-RAM are "other" or "complete" if the disc is - * write protected; we need to check the contents if it is blank */ - if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { - unsigned char buffer[32 * 2048]; - unsigned char result, len; - int block, offset; - - if (cd_media_dvd_ram) { - /* a write protected dvd-ram may report "complete" status */ - - unsigned char dvdstruct[8]; - unsigned char format[12]; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0xAD); - scsi_cmd_set(udev, &sc, 7, 0xC0); - scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); - scsi_cmd_set(udev, &sc, 11, 0); - err = scsi_cmd_run(udev, &sc, fd, dvdstruct, sizeof(dvdstruct)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DVD STRUCTURE", err); - return -1; - } - if (dvdstruct[4] & 0x02) { - cd_media_state = media_status[2]; - info(udev, "write-protected DVD-RAM media inserted\n"); - goto determined; - } - - /* let's make sure we don't try to read unformatted media */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x23); - scsi_cmd_set(udev, &sc, 8, sizeof(format)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, format, sizeof(format)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DVD FORMAT CAPACITIES", err); - return -1; - } - - len = format[3]; - if (len & 7 || len < 16) { - info(udev, "invalid format capacities length\n"); - return -1; - } - - switch(format[8] & 3) { - case 1: - info(udev, "unformatted DVD-RAM media inserted\n"); - /* This means that last format was interrupted - * or failed, blank dvd-ram discs are factory - * formatted. Take no action here as it takes - * quite a while to reformat a dvd-ram and it's - * not automatically started */ - goto determined; - - case 2: - info(udev, "formatted DVD-RAM media inserted\n"); - break; - - case 3: - cd_media = 0; //return no media - info(udev, "format capacities returned no media\n"); - return -1; - } - } - - /* Take a closer look at formatted media (unformatted DVD+RW - * has "blank" status", DVD-RAM was examined earlier) and check - * for ISO and UDF PVDs or a fs superblock presence and do it - * in one ioctl (we need just sectors 0 and 16) */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x28); - scsi_cmd_set(udev, &sc, 5, 0); - scsi_cmd_set(udev, &sc, 8, 32); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); - if ((err != 0)) { - cd_media = 0; - info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err); - return -1; - } - - /* if any non-zero data is found in sector 16 (iso and udf) or - * eventually 0 (fat32 boot sector, ext2 superblock, etc), disc - * is assumed non-blank */ - result = 0; - - for (block = 32768; block >= 0 && !result; block -= 32768) { - offset = block; - while (offset < (block + 2048) && !result) { - result = buffer [offset]; - offset++; - } - } - - if (!result) { - cd_media_state = media_status[0]; - info(udev, "no data in blocks 0 or 16, assuming blank\n"); - } else { - info(udev, "data in blocks 0 or 16, assuming complete\n"); - } - } - -determined: - /* "other" is e. g. DVD-RAM, can't append sessions there; DVDs in - * restricted overwrite mode can never append, only in sequential mode */ - if ((header[2] & 3) < 2 && !cd_media_dvd_rw_ro) - cd_media_session_next = header[10] << 8 | header[5]; - cd_media_session_count = header[9] << 8 | header[4]; - cd_media_track_count = header[11] << 8 | header[6]; - - return 0; -} - -static int cd_media_toc(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - unsigned char header[12]; - unsigned char toc[65536]; - unsigned int len, i, num_tracks; - unsigned char *p; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, 1); - scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC", err); - return -1; - } - - len = (header[0] << 8 | header[1]) + 2; - info(udev, "READ TOC: len: %d, start track: %d, end track: %d\n", len, header[2], header[3]); - if (len > sizeof(toc)) - return -1; - if (len < 2) - return -1; - /* 2: first track, 3: last track */ - num_tracks = header[3] - header[2] + 1; - - /* empty media has no tracks */ - if (len < 8) - return 0; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ - scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); - scsi_cmd_set(udev, &sc, 8, len & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, toc, len); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC (tracks)", err); - return -1; - } - - /* Take care to not iterate beyond the last valid track as specified in - * the TOC, but also avoid going beyond the TOC length, just in case - * the last track number is invalidly large */ - for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) { - unsigned int block; - unsigned int is_data_track; - - is_data_track = (p[1] & 0x04) != 0; - - block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; - info(udev, "track=%u info=0x%x(%s) start_block=%u\n", - p[2], p[1] & 0x0f, is_data_track ? "data":"audio", block); - - if (is_data_track) - cd_media_track_count_data++; - else - cd_media_track_count_audio++; - } - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC (multi session)", err); - return -1; - } - len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; - info(udev, "last track %u starts at block %u\n", header[4+2], len); - cd_media_session_last_offset = (unsigned long long int)len * 2048; - return 0; -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - static const struct option options[] = { - { "lock-media", no_argument, NULL, 'l' }, - { "unlock-media", no_argument, NULL, 'u' }, - { "eject-media", no_argument, NULL, 'e' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - bool eject = false; - bool lock = false; - bool unlock = false; - const char *node = NULL; - int fd = -1; - int cnt; - int rc = 0; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("cdrom_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "deluh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'l': - lock = true; - break; - case 'u': - unlock = true; - break; - case 'e': - eject = true; - break; - case 'd': - debug = true; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("Usage: cdrom_id [options] \n" - " --lock-media lock the media (to enable eject request events)\n" - " --unlock-media unlock the media\n" - " --eject-media eject the media\n" - " --debug debug to stderr\n" - " --help print this help text\n\n"); - goto exit; - default: - rc = 1; - goto exit; - } - } - - node = argv[optind]; - if (!node) { - err(udev, "no device\n"); - fprintf(stderr, "no device\n"); - rc = 1; - goto exit; - } - - srand((unsigned int)getpid()); - for (cnt = 20; cnt > 0; cnt--) { - struct timespec duration; - - fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); - if (fd >= 0 || errno != EBUSY) - break; - duration.tv_sec = 0; - duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); - nanosleep(&duration, NULL); - } - if (fd < 0) { - info(udev, "unable to open '%s'\n", node); - fprintf(stderr, "unable to open '%s'\n", node); - rc = 1; - goto exit; - } - info(udev, "probing: '%s'\n", node); - - /* same data as original cdrom_id */ - if (cd_capability_compat(udev, fd) < 0) { - rc = 1; - goto exit; - } - - /* check for media - don't bail if there's no media as we still need to - * to read profiles */ - cd_media_compat(udev, fd); - - /* check if drive talks MMC */ - if (cd_inquiry(udev, fd) < 0) - goto work; - - /* read drive and possibly current profile */ - if (cd_profiles(udev, fd) != 0) - goto work; - - /* at this point we are guaranteed to have media in the drive - find out more about it */ - - /* get session/track info */ - cd_media_toc(udev, fd); - - /* get writable media state */ - cd_media_info(udev, fd); - -work: - /* lock the media, so we enable eject button events */ - if (lock && cd_media) { - info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (lock)\n"); - media_lock(udev, fd, true); - } - - if (unlock && cd_media) { - info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); - media_lock(udev, fd, false); - } - - if (eject) { - info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); - media_lock(udev, fd, false); - info(udev, "START_STOP_UNIT (eject)\n"); - media_eject(udev, fd); - } - - printf("ID_CDROM=1\n"); - if (cd_cd_rom) - printf("ID_CDROM_CD=1\n"); - if (cd_cd_r) - printf("ID_CDROM_CD_R=1\n"); - if (cd_cd_rw) - printf("ID_CDROM_CD_RW=1\n"); - if (cd_dvd_rom) - printf("ID_CDROM_DVD=1\n"); - if (cd_dvd_r) - printf("ID_CDROM_DVD_R=1\n"); - if (cd_dvd_rw) - printf("ID_CDROM_DVD_RW=1\n"); - if (cd_dvd_ram) - printf("ID_CDROM_DVD_RAM=1\n"); - if (cd_dvd_plus_r) - printf("ID_CDROM_DVD_PLUS_R=1\n"); - if (cd_dvd_plus_rw) - printf("ID_CDROM_DVD_PLUS_RW=1\n"); - if (cd_dvd_plus_r_dl) - printf("ID_CDROM_DVD_PLUS_R_DL=1\n"); - if (cd_dvd_plus_rw_dl) - printf("ID_CDROM_DVD_PLUS_RW_DL=1\n"); - if (cd_bd) - printf("ID_CDROM_BD=1\n"); - if (cd_bd_r) - printf("ID_CDROM_BD_R=1\n"); - if (cd_bd_re) - printf("ID_CDROM_BD_RE=1\n"); - if (cd_hddvd) - printf("ID_CDROM_HDDVD=1\n"); - if (cd_hddvd_r) - printf("ID_CDROM_HDDVD_R=1\n"); - if (cd_hddvd_rw) - printf("ID_CDROM_HDDVD_RW=1\n"); - if (cd_mo) - printf("ID_CDROM_MO=1\n"); - if (cd_mrw) - printf("ID_CDROM_MRW=1\n"); - if (cd_mrw_w) - printf("ID_CDROM_MRW_W=1\n"); - - if (cd_media) - printf("ID_CDROM_MEDIA=1\n"); - if (cd_media_mo) - printf("ID_CDROM_MEDIA_MO=1\n"); - if (cd_media_mrw) - printf("ID_CDROM_MEDIA_MRW=1\n"); - if (cd_media_mrw_w) - printf("ID_CDROM_MEDIA_MRW_W=1\n"); - if (cd_media_cd_rom) - printf("ID_CDROM_MEDIA_CD=1\n"); - if (cd_media_cd_r) - printf("ID_CDROM_MEDIA_CD_R=1\n"); - if (cd_media_cd_rw) - printf("ID_CDROM_MEDIA_CD_RW=1\n"); - if (cd_media_dvd_rom) - printf("ID_CDROM_MEDIA_DVD=1\n"); - if (cd_media_dvd_r) - printf("ID_CDROM_MEDIA_DVD_R=1\n"); - if (cd_media_dvd_ram) - printf("ID_CDROM_MEDIA_DVD_RAM=1\n"); - if (cd_media_dvd_rw) - printf("ID_CDROM_MEDIA_DVD_RW=1\n"); - if (cd_media_dvd_plus_r) - printf("ID_CDROM_MEDIA_DVD_PLUS_R=1\n"); - if (cd_media_dvd_plus_rw) - printf("ID_CDROM_MEDIA_DVD_PLUS_RW=1\n"); - if (cd_media_dvd_plus_rw_dl) - printf("ID_CDROM_MEDIA_DVD_PLUS_RW_DL=1\n"); - if (cd_media_dvd_plus_r_dl) - printf("ID_CDROM_MEDIA_DVD_PLUS_R_DL=1\n"); - if (cd_media_bd) - printf("ID_CDROM_MEDIA_BD=1\n"); - if (cd_media_bd_r) - printf("ID_CDROM_MEDIA_BD_R=1\n"); - if (cd_media_bd_re) - printf("ID_CDROM_MEDIA_BD_RE=1\n"); - if (cd_media_hddvd) - printf("ID_CDROM_MEDIA_HDDVD=1\n"); - if (cd_media_hddvd_r) - printf("ID_CDROM_MEDIA_HDDVD_R=1\n"); - if (cd_media_hddvd_rw) - printf("ID_CDROM_MEDIA_HDDVD_RW=1\n"); - - if (cd_media_state != NULL) - printf("ID_CDROM_MEDIA_STATE=%s\n", cd_media_state); - if (cd_media_session_next > 0) - printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); - if (cd_media_session_count > 0) - printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); - if (cd_media_session_count > 1 && cd_media_session_last_offset > 0) - printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); - if (cd_media_track_count > 0) - printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); - if (cd_media_track_count_audio > 0) - printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); - if (cd_media_track_count_data > 0) - printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); -exit: - if (fd >= 0) - close(fd); - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/extras/collect/.gitignore b/extras/collect/.gitignore deleted file mode 100644 index c30ad6527c..0000000000 --- a/extras/collect/.gitignore +++ /dev/null @@ -1 +0,0 @@ -collect diff --git a/extras/collect/collect.c b/extras/collect/collect.c deleted file mode 100644 index f78f3b778e..0000000000 --- a/extras/collect/collect.c +++ /dev/null @@ -1,473 +0,0 @@ -/* - * Collect variables across events. - * - * usage: collect [--add|--remove] - * - * Adds ID to the list governed by . - * must be part of the ID list . - * If all IDs given by are listed (ie collect has been - * invoked for each ID in ) collect returns 0, the - * number of missing IDs otherwise. - * A negative number is returned on error. - * - * Copyright(C) 2007, Hannes Reinecke - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -#define BUFSIZE 16 -#define UDEV_ALARM_TIMEOUT 180 - -enum collect_state { - STATE_NONE, - STATE_OLD, - STATE_CONFIRMED, -}; - -struct _mate { - struct udev_list_node node; - char *name; - enum collect_state state; -}; - -static struct udev_list_node bunch; -static int debug; - -/* This can increase dynamically */ -static size_t bufsize = BUFSIZE; - -static struct _mate *node_to_mate(struct udev_list_node *node) -{ - char *mate; - - mate = (char *)node; - mate -= offsetof(struct _mate, node); - return (struct _mate *)mate; -} - -static void sig_alrm(int signo) -{ - exit(4); -} - -static void usage(void) -{ - printf("usage: collect [--add|--remove] [--debug] \n" - "\n" - " Adds ID to the list governed by .\n" - " must be part of the list .\n" - " If all IDs given by are listed (ie collect has been\n" - " invoked for each ID in ) collect returns 0, the\n" - " number of missing IDs otherwise.\n" - " On error a negative number is returned.\n" - "\n"); -} - -/* - * prepare - * - * Prepares the database file - */ -static int prepare(char *dir, char *filename) -{ - struct stat statbuf; - char buf[512]; - int fd; - - if (stat(dir, &statbuf) < 0) - mkdir(dir, 0700); - - sprintf(buf, "%s/%s", dir, filename); - - fd = open(buf,O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if (fd < 0) - fprintf(stderr, "Cannot open %s: %s\n", buf, strerror(errno)); - - if (lockf(fd,F_TLOCK,0) < 0) { - if (debug) - fprintf(stderr, "Lock taken, wait for %d seconds\n", UDEV_ALARM_TIMEOUT); - if (errno == EAGAIN || errno == EACCES) { - alarm(UDEV_ALARM_TIMEOUT); - lockf(fd, F_LOCK, 0); - if (debug) - fprintf(stderr, "Acquired lock on %s\n", buf); - } else { - if (debug) - fprintf(stderr, "Could not get lock on %s: %s\n", buf, strerror(errno)); - } - } - - return fd; -} - -/* - * Read checkpoint file - * - * Tricky reading this. We allocate a buffer twice as large - * as we're going to read. Then we read into the upper half - * of that buffer and start parsing. - * Once we do _not_ find end-of-work terminator (whitespace - * character) we move the upper half to the lower half, - * adjust the read pointer and read the next bit. - * Quite clever methinks :-) - * I should become a programmer ... - * - * Yes, one could have used fgets() for this. But then we'd - * have to use freopen etc which I found quite tedious. - */ -static int checkout(int fd) -{ - int len; - char *buf, *ptr, *word = NULL; - struct _mate *him; - - restart: - len = bufsize >> 1; - buf = calloc(1,bufsize + 1); - if (!buf) { - fprintf(stderr, "Out of memory\n"); - return -1; - } - memset(buf, ' ', bufsize); - ptr = buf + len; - while ((read(fd, buf + len, len)) > 0) { - while (ptr && *ptr) { - word = ptr; - ptr = strpbrk(word," \n\t\r"); - if (!ptr && word < (buf + len)) { - bufsize = bufsize << 1; - if (debug) - fprintf(stderr, "ID overflow, restarting with size %zi\n", bufsize); - free(buf); - lseek(fd, 0, SEEK_SET); - goto restart; - } - if (ptr) { - *ptr = '\0'; - ptr++; - if (!strlen(word)) - continue; - - if (debug) - fprintf(stderr, "Found word %s\n", word); - him = malloc(sizeof (struct _mate)); - him->name = strdup(word); - him->state = STATE_OLD; - udev_list_node_append(&him->node, &bunch); - word = NULL; - } - } - memcpy(buf, buf + len, len); - memset(buf + len, ' ', len); - - if (!ptr) - ptr = word; - if (!ptr) - break; - ptr -= len; - } - - free(buf); - return 0; -} - -/* - * invite - * - * Adds a new ID 'us' to the internal list, - * marks it as confirmed. - */ -static void invite(char *us) -{ - struct udev_list_node *him_node; - struct _mate *who = NULL; - - if (debug) - fprintf(stderr, "Adding ID '%s'\n", us); - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (!strcmp(him->name, us)) { - him->state = STATE_CONFIRMED; - who = him; - } - } - if (debug && !who) - fprintf(stderr, "ID '%s' not in database\n", us); - -} - -/* - * reject - * - * Marks the ID 'us' as invalid, - * causing it to be removed when the - * list is written out. - */ -static void reject(char *us) -{ - struct udev_list_node *him_node; - struct _mate *who = NULL; - - if (debug) - fprintf(stderr, "Removing ID '%s'\n", us); - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (!strcmp(him->name, us)) { - him->state = STATE_NONE; - who = him; - } - } - if (debug && !who) - fprintf(stderr, "ID '%s' not in database\n", us); -} - -/* - * kickout - * - * Remove all IDs in the internal list which are not part - * of the list passed via the commandline. - */ -static void kickout(void) -{ - struct udev_list_node *him_node; - struct udev_list_node *tmp; - - udev_list_node_foreach_safe(him_node, tmp, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (him->state == STATE_OLD) { - udev_list_node_remove(&him->node); - free(him->name); - free(him); - } - } -} - -/* - * missing - * - * Counts all missing IDs in the internal list. - */ -static int missing(int fd) -{ - char *buf; - int ret = 0; - struct udev_list_node *him_node; - - buf = malloc(bufsize); - if (!buf) - return -1; - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (him->state == STATE_NONE) { - ret++; - } else { - while (strlen(him->name)+1 >= bufsize) { - char *tmpbuf; - - bufsize = bufsize << 1; - tmpbuf = realloc(buf, bufsize); - if (!tmpbuf) { - free(buf); - return -1; - } - buf = tmpbuf; - } - snprintf(buf, strlen(him->name)+2, "%s ", him->name); - write(fd, buf, strlen(buf)); - } - } - - free(buf); - return ret; -} - -/* - * everybody - * - * Prints out the status of the internal list. - */ -static void everybody(void) -{ - struct udev_list_node *him_node; - const char *state = ""; - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - switch (him->state) { - case STATE_NONE: - state = "none"; - break; - case STATE_OLD: - state = "old"; - break; - case STATE_CONFIRMED: - state = "confirmed"; - break; - } - fprintf(stderr, "ID: %s=%s\n", him->name, state); - } -} - -int main(int argc, char **argv) -{ - struct udev *udev; - static const struct option options[] = { - { "add", no_argument, NULL, 'a' }, - { "remove", no_argument, NULL, 'r' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - int argi; - char *checkpoint, *us; - int fd; - int i; - int ret = EXIT_SUCCESS; - int prune = 0; - char tmpdir[UTIL_PATH_SIZE]; - - udev = udev_new(); - if (udev == NULL) { - ret = EXIT_FAILURE; - goto exit; - } - - while (1) { - int option; - - option = getopt_long(argc, argv, "ardh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'a': - prune = 0; - break; - case 'r': - prune = 1; - break; - case 'd': - debug = 1; - break; - case 'h': - usage(); - goto exit; - default: - ret = 1; - goto exit; - } - } - - argi = optind; - if (argi + 2 > argc) { - printf("Missing parameter(s)\n"); - ret = 1; - goto exit; - } - checkpoint = argv[argi++]; - us = argv[argi++]; - - if (signal(SIGALRM, sig_alrm) == SIG_ERR) { - fprintf(stderr, "Cannot set SIGALRM: %s\n", strerror(errno)); - ret = 2; - goto exit; - } - - udev_list_node_init(&bunch); - - if (debug) - fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); - - util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL); - fd = prepare(tmpdir, checkpoint); - if (fd < 0) { - ret = 3; - goto out; - } - - if (checkout(fd) < 0) { - ret = 2; - goto out; - } - - for (i = argi; i < argc; i++) { - struct udev_list_node *him_node; - struct _mate *who; - - who = NULL; - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (!strcmp(him->name, argv[i])) - who = him; - } - if (!who) { - struct _mate *him; - - if (debug) - fprintf(stderr, "ID %s: not in database\n", argv[i]); - him = malloc(sizeof (struct _mate)); - him->name = malloc(strlen(argv[i]) + 1); - strcpy(him->name, argv[i]); - him->state = STATE_NONE; - udev_list_node_append(&him->node, &bunch); - } else { - if (debug) - fprintf(stderr, "ID %s: found in database\n", argv[i]); - who->state = STATE_CONFIRMED; - } - } - - if (prune) - reject(us); - else - invite(us); - - if (debug) { - everybody(); - fprintf(stderr, "Prune lists\n"); - } - kickout(); - - lseek(fd, 0, SEEK_SET); - ftruncate(fd, 0); - ret = missing(fd); - - lockf(fd, F_ULOCK, 0); - close(fd); -out: - if (debug) - everybody(); - if (ret >= 0) - printf("COLLECT_%s=%d\n", checkpoint, ret); -exit: - udev_unref(udev); - return ret; -} diff --git a/extras/edd_id/.gitignore b/extras/edd_id/.gitignore deleted file mode 100644 index 14fb67c634..0000000000 --- a/extras/edd_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -edd_id diff --git a/extras/edd_id/61-persistent-storage-edd.rules b/extras/edd_id/61-persistent-storage-edd.rules deleted file mode 100644 index 6b4fb8ecfe..0000000000 --- a/extras/edd_id/61-persistent-storage-edd.rules +++ /dev/null @@ -1,12 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="persistent_storage_edd_end" -SUBSYSTEM!="block", GOTO="persistent_storage_edd_end" -KERNEL!="sd*|hd*|cciss*", GOTO="persistent_storage_edd_end" - -# BIOS Enhanced Disk Device -ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $devnode" -ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -LABEL="persistent_storage_edd_end" diff --git a/extras/edd_id/edd_id.c b/extras/edd_id/edd_id.c deleted file mode 100644 index ac4da07611..0000000000 --- a/extras/edd_id/edd_id.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * edd_id - naming of BIOS disk devices via EDD - * - * Copyright (C) 2005 John Hull - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - const char *node = NULL; - int i; - int export = 0; - uint32_t disk_id; - uint16_t mbr_valid; - struct dirent *dent; - int disk_fd; - int sysfs_fd; - DIR *dir = NULL; - int rc = 1; - char filename[UTIL_PATH_SIZE]; - char match[UTIL_PATH_SIZE]; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("edd_id"); - udev_set_log_fn(udev, log_fn); - - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; - - if (strcmp(arg, "--export") == 0) { - export = 1; - } else - node = arg; - } - if (node == NULL) { - err(udev, "no node specified\n"); - fprintf(stderr, "no node specified\n"); - goto exit; - } - - /* check for kernel support */ - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/firmware/edd", NULL); - dir = opendir(filename); - if (dir == NULL) { - info(udev, "no kernel EDD support\n"); - fprintf(stderr, "no kernel EDD support\n"); - rc = 2; - goto exit; - } - - disk_fd = open(node, O_RDONLY); - if (disk_fd < 0) { - info(udev, "unable to open '%s'\n", node); - fprintf(stderr, "unable to open '%s'\n", node); - rc = 3; - goto closedir; - } - - /* check for valid MBR signature */ - if (lseek(disk_fd, 510, SEEK_SET) < 0) { - info(udev, "seek to MBR validity failed '%s'\n", node); - rc = 4; - goto close; - } - if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { - info(udev, "read MBR validity failed '%s'\n", node); - rc = 5; - goto close; - } - if (mbr_valid != 0xAA55) { - fprintf(stderr, "no valid MBR signature '%s'\n", node); - info(udev, "no valid MBR signature '%s'\n", node); - rc=6; - goto close; - } - - /* read EDD signature */ - if (lseek(disk_fd, 440, SEEK_SET) < 0) { - info(udev, "seek to signature failed '%s'\n", node); - rc = 7; - goto close; - } - if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { - info(udev, "read signature failed '%s'\n", node); - rc = 8; - goto close; - } - /* all zero is invalid */ - info(udev, "read id 0x%08x from '%s'\n", disk_id, node); - if (disk_id == 0) { - fprintf(stderr, "no EDD signature '%s'\n", node); - info(udev, "'%s' signature is zero\n", node); - rc = 9; - goto close; - } - - /* lookup signature in sysfs to determine the name */ - match[0] = '\0'; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char sysfs_id_buf[256]; - uint32_t sysfs_id; - ssize_t size; - - if (dent->d_name[0] == '.') - continue; - - util_strscpyl(filename, sizeof(filename), dent->d_name, "/mbr_signature", NULL); - sysfs_fd = openat(dirfd(dir), filename, O_RDONLY); - if (sysfs_fd < 0) { - info(udev, "unable to open sysfs '%s'\n", filename); - continue; - } - - size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); - close(sysfs_fd); - if (size <= 0) { - info(udev, "read sysfs '%s' failed\n", filename); - continue; - } - sysfs_id_buf[size] = '\0'; - info(udev, "read '%s' from '%s'\n", sysfs_id_buf, filename); - sysfs_id = strtoul(sysfs_id_buf, NULL, 16); - - /* look for matching value, that appears only once */ - if (disk_id == sysfs_id) { - if (match[0] == '\0') { - /* store id */ - util_strscpy(match, sizeof(match), dent->d_name); - } else { - /* error, same signature for another device */ - info(udev, "'%s' does not have a unique signature\n", node); - fprintf(stderr, "'%s' does not have a unique signature\n", node); - rc = 10; - goto exit; - } - } - } - - if (match[0] != '\0') { - if (export) - printf("ID_EDD=%s\n", match); - else - printf("%s\n", match); - rc = 0; - } - -close: - close(disk_fd); -closedir: - closedir(dir); -exit: - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/extras/floppy/.gitignore b/extras/floppy/.gitignore deleted file mode 100644 index 939f625a4a..0000000000 --- a/extras/floppy/.gitignore +++ /dev/null @@ -1 +0,0 @@ -create_floppy_devices diff --git a/extras/floppy/60-floppy.rules b/extras/floppy/60-floppy.rules deleted file mode 100644 index 53e4a9e59a..0000000000 --- a/extras/floppy/60-floppy.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM=="block", KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", ENV{CMOS_TYPE}="$attr{cmos}", \ - RUN+="create_floppy_devices -c -t $env{CMOS_TYPE} -m %M -M 0660 -G floppy $root/%k" diff --git a/extras/floppy/create_floppy_devices.c b/extras/floppy/create_floppy_devices.c deleted file mode 100644 index 47724f8b04..0000000000 --- a/extras/floppy/create_floppy_devices.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Create all possible floppy device based on the CMOS type. - * Based upon code from drivers/block/floppy.c - * - * Copyright(C) 2005, SUSE Linux Products GmbH - * - * Author: Hannes Reinecke - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static char *table[] = { - "", "d360", "h1200", "u360", "u720", "h360", "h720", - "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410", - "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743", - "h880", "u1040", "u1120", "h1600", "u1760", "u1920", - "u3200", "u3520", "u3840", "u1840", "u800", "u1600", - NULL -}; - -static int t360[] = { 1, 0 }; -static int t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 }; -static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, 17, 21, 22, 30, 0 }; -static int *table_sup[] = { NULL, t360, t1200, t3in+5+8, t3in+5, t3in, t3in }; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -int main(int argc, char **argv) -{ - struct udev *udev; - char *dev; - char *devname; - char node[64]; - int type = 0, i, fdnum, c; - int major = 2, minor; - uid_t uid = 0; - gid_t gid = 0; - mode_t mode = 0660; - int create_nodes = 0; - int print_nodes = 0; - int is_err = 0; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("create_floppy_devices"); - udev_set_log_fn(udev, log_fn); - udev_selinux_init(udev); - - while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { - switch (c) { - case 'c': - create_nodes = 1; - break; - case 'd': - print_nodes = 1; - break; - case 'U': - uid = util_lookup_user(udev, optarg); - break; - case 'G': - gid = util_lookup_group(udev, optarg); - break; - case 'M': - mode = strtol(optarg, NULL, 0); - mode = mode & 0666; - break; - case 'm': - major = strtol(optarg, NULL, 0); - break; - case 't': - type = strtol(optarg, NULL, 0); - break; - default: - is_err++; - break; - } - } - - if (is_err || optind >= argc) { - printf("Usage: %s [OPTION] device\n" - " -c create\n" - " -d debug\n" - " -m Major number\n" - " -t floppy type number\n" - " -U device node user ownership\n" - " -G device node group owner\n" - " -M device node mode\n" - "\n", argv[0]); - return 1; - } - - dev = argv[optind]; - devname = strrchr(dev, '/'); - if (devname != NULL) - devname = &devname[1]; - else - devname = dev; - if (strncmp(devname, "fd", 2) != 0) { - fprintf(stderr,"Device '%s' is not a floppy device\n", dev); - return 1; - } - - fdnum = strtol(&devname[2], NULL, 10); - if (fdnum < 0 || fdnum > 7) { - fprintf(stderr,"Floppy device number %d out of range (0-7)\n", fdnum); - return 1; - } - if (fdnum > 3) - fdnum += 124; - - if (major < 1) { - fprintf(stderr,"Invalid major number %d\n", major); - return 1; - } - - if (type < 0 || type >= (int) ARRAY_SIZE(table_sup)) { - fprintf(stderr,"Invalid CMOS type %d\n", type); - return 1; - } - - if (type == 0) - return 0; - - i = 0; - while (table_sup[type][i]) { - sprintf(node, "%s%s", dev, table[table_sup[type][i]]); - minor = (table_sup[type][i] << 2) + fdnum; - if (print_nodes) - printf("%s b %.4o %d %d\n", node, mode, major, minor); - if (create_nodes) { - unlink(node); - udev_selinux_setfscreatecon(udev, node, S_IFBLK | mode); - mknod(node, S_IFBLK | mode, makedev(major,minor)); - udev_selinux_resetfscreatecon(udev); - chown(node, uid, gid); - chmod(node, S_IFBLK | mode); - } - i++; - } - - udev_selinux_exit(udev); - udev_unref(udev); - udev_log_close(); -exit: - return 0; -} diff --git a/extras/gudev/.gitignore b/extras/gudev/.gitignore deleted file mode 100644 index d20fa523e4..0000000000 --- a/extras/gudev/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -gtk-doc.make -docs/version.xml -gudev-1.0.pc -gudevenumtypes.c -gudevenumtypes.h -gudevmarshal.c -gudevmarshal.h -GUdev-1.0.gir -GUdev-1.0.typelib diff --git a/extras/gudev/COPYING b/extras/gudev/COPYING deleted file mode 100644 index 8add30ad59..0000000000 --- a/extras/gudev/COPYING +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/extras/gudev/docs/.gitignore b/extras/gudev/docs/.gitignore deleted file mode 100644 index a24184ac83..0000000000 --- a/extras/gudev/docs/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -gudev-overrides.txt -gudev-decl-list.txt -gudev-decl.txt -gudev-undeclared.txt -gudev-undocumented.txt -gudev-unused.txt -gudev.args -gudev.hierarchy -gudev.interfaces -gudev.prerequisites -gudev.signals -html.stamp -html/* -xml/* -tmpl/* -*.stamp - diff --git a/extras/gudev/docs/Makefile.am b/extras/gudev/docs/Makefile.am deleted file mode 100644 index 5507434d5f..0000000000 --- a/extras/gudev/docs/Makefile.am +++ /dev/null @@ -1,106 +0,0 @@ -## Process this file with automake to produce Makefile.in - -# We require automake 1.10 at least. -AUTOMAKE_OPTIONS = 1.10 - -# This is a blank Makefile.am for using gtk-doc. -# Copy this to your project's API docs directory and modify the variables to -# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples -# of using the various options. - -# The name of the module, e.g. 'glib'. -DOC_MODULE=gudev - -# Uncomment for versioned docs and specify the version of the module, e.g. '2'. -#DOC_MODULE_VERSION=2 - -# The top-level SGML file. You can change this if you want to. -DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml - -# The directory containing the source code. Relative to $(srcdir). -# gtk-doc will search all .c & .h files beneath here for inline comments -# documenting the functions and macros. -# e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR=.. - -# Extra options to pass to gtkdoc-scangobj. Not normally needed. -SCANGOBJ_OPTIONS= - -# Extra options to supply to gtkdoc-scan. -# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" -SCAN_OPTIONS= - -# Extra options to supply to gtkdoc-mkdb. -# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml -MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=g_udev - -# Extra options to supply to gtkdoc-mktmpl -# e.g. MKTMPL_OPTIONS=--only-section-tmpl -MKTMPL_OPTIONS= - -# Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS=--path=$(abs_srcdir) --path=$(abs_builddir) - -# Extra options to supply to gtkdoc-fixref. Not normally needed. -# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html -FIXXREF_OPTIONS= - -# Used for dependencies. The docs will be rebuilt if any of these change. -# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h -# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB=$(top_srcdir)/extras/gudev/*.h -CFILE_GLOB=$(top_srcdir)/extras/gudev/*.c - -# Extra header to include when scanning, which are not under DOC_SOURCE_DIR -# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h -EXTRA_HFILES= - -# Header files to ignore when scanning. Use base file name, no paths -# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES= - -# Images to copy into HTML directory. -# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png -HTML_IMAGES= - -# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). -# e.g. content_files=running.sgml building.sgml changes-2.0.sgml -content_files = version.xml - -# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded -# These files must be listed here *and* in content_files -# e.g. expand_content_files=running.sgml -expand_content_files= - -# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. -# Only needed if you are using gtkdoc-scangobj to dynamically query widget -# signals and properties. -# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) -# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -GTKDOC_CFLAGS = \ - $(DBUS_GLIB_CFLAGS) \ - $(GLIB_CFLAGS) \ - -I$(top_srcdir)/extras/gudev \ - -I$(top_builddir)/extras/gudev - -GTKDOC_LIBS = \ - $(GLIB_LIBS) \ - $(top_builddir)/extras/gudev/libgudev-1.0.la - -# This includes the standard gtk-doc make rules, copied by gtkdocize. -include $(top_srcdir)/gtk-doc.make - -# Other files to distribute -# e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST += version.xml.in - -# Files not to distribute -# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types -# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt -#DISTCLEANFILES += - -# Comment this out if you want your docs-status tested during 'make check' -if ENABLE_GTK_DOC -#TESTS_ENVIRONMENT = cd $(srcsrc) -#TESTS = $(GTKDOC_CHECK) -endif diff --git a/extras/gudev/docs/gudev-docs.xml b/extras/gudev/docs/gudev-docs.xml deleted file mode 100644 index 65fdfff8e5..0000000000 --- a/extras/gudev/docs/gudev-docs.xml +++ /dev/null @@ -1,93 +0,0 @@ - - -]> - - - GUDev Reference Manual - For GUdev version &version; - - - David - Zeuthen - -
            - davidz@redhat.com -
            -
            -
            - - Bastien - Nocera - -
            - hadess@hadess.net -
            -
            -
            -
            - - - 2011 - The GUDev Authors - - - - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free - Documentation License, Version 1.1 or any later - version published by the Free Software Foundation with no - Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. You may obtain a copy of the GNU Free - Documentation License from the Free Software - Foundation by visiting their Web site or by writing - to: - -
            - The Free Software Foundation, Inc., - 59 Temple Place - Suite 330, - Boston, MA 02111-1307, - USA -
            -
            - - - Many of the names used by companies to distinguish their - products and services are claimed as trademarks. Where those - names appear in any freedesktop.org documentation, and those - trademarks are made aware to the members of the - freedesktop.org Project, the names have been printed in caps - or initial caps. - -
            -
            - - - API Reference - - - This part presents the class and function reference for the - libgudev library. - - - - - - - - - Object Hierarchy - - - - Index - - - Index of new symbols in 165 - - - -
            diff --git a/extras/gudev/docs/gudev-sections.txt b/extras/gudev/docs/gudev-sections.txt deleted file mode 100644 index 213e1a7465..0000000000 --- a/extras/gudev/docs/gudev-sections.txt +++ /dev/null @@ -1,113 +0,0 @@ -
            -gudevclient -GUdevClient -GUdevClient -GUdevClientClass -GUdevDeviceType -GUdevDeviceNumber -g_udev_client_new -g_udev_client_query_by_subsystem -g_udev_client_query_by_device_number -g_udev_client_query_by_device_file -g_udev_client_query_by_sysfs_path -g_udev_client_query_by_subsystem_and_name - -G_UDEV_CLIENT -G_UDEV_IS_CLIENT -G_UDEV_TYPE_CLIENT -g_udev_client_get_type -G_UDEV_CLIENT_CLASS -G_UDEV_IS_CLIENT_CLASS -G_UDEV_CLIENT_GET_CLASS - -GUdevClientPrivate -
            - -
            -gudevdevice -GUdevDevice -GUdevDevice -GUdevDeviceClass -g_udev_device_get_subsystem -g_udev_device_get_devtype -g_udev_device_get_name -g_udev_device_get_number -g_udev_device_get_sysfs_path -g_udev_device_get_driver -g_udev_device_get_action -g_udev_device_get_seqnum -g_udev_device_get_device_type -g_udev_device_get_device_number -g_udev_device_get_device_file -g_udev_device_get_device_file_symlinks -g_udev_device_get_parent -g_udev_device_get_parent_with_subsystem -g_udev_device_get_tags -g_udev_device_get_is_initialized -g_udev_device_get_usec_since_initialized -g_udev_device_get_property_keys -g_udev_device_has_property -g_udev_device_get_property -g_udev_device_get_property_as_int -g_udev_device_get_property_as_uint64 -g_udev_device_get_property_as_double -g_udev_device_get_property_as_boolean -g_udev_device_get_property_as_strv -g_udev_device_get_sysfs_attr -g_udev_device_get_sysfs_attr_as_int -g_udev_device_get_sysfs_attr_as_uint64 -g_udev_device_get_sysfs_attr_as_double -g_udev_device_get_sysfs_attr_as_boolean -g_udev_device_get_sysfs_attr_as_strv - -G_UDEV_DEVICE -G_UDEV_IS_DEVICE -G_UDEV_TYPE_DEVICE -g_udev_device_get_type -G_UDEV_DEVICE_CLASS -G_UDEV_IS_DEVICE_CLASS -G_UDEV_DEVICE_GET_CLASS - -GUdevDevicePrivate -
            - -
            -gudevenumerator -GUdevEnumerator -GUdevEnumerator -GUdevEnumeratorClass -g_udev_enumerator_new -g_udev_enumerator_add_match_subsystem -g_udev_enumerator_add_nomatch_subsystem -g_udev_enumerator_add_match_sysfs_attr -g_udev_enumerator_add_nomatch_sysfs_attr -g_udev_enumerator_add_match_property -g_udev_enumerator_add_match_name -g_udev_enumerator_add_match_tag -g_udev_enumerator_add_match_is_initialized -g_udev_enumerator_add_sysfs_path -g_udev_enumerator_execute - -G_UDEV_ENUMERATOR -G_UDEV_IS_ENUMERATOR -G_UDEV_TYPE_ENUMERATOR -g_udev_enumerator_get_type -G_UDEV_ENUMERATOR_CLASS -G_UDEV_IS_ENUMERATOR_CLASS -G_UDEV_ENUMERATOR_GET_CLASS - -GUdevEnumeratorPrivate -
            - -
            -gudevmarshal - -g_udev_marshal_VOID__STRING_OBJECT -
            - -
            -gudevenumtypes - -G_TYPE_UDEV_DEVICE_TYPE -g_udev_device_type_get_type -
            diff --git a/extras/gudev/docs/gudev.types b/extras/gudev/docs/gudev.types deleted file mode 100644 index a89857a04d..0000000000 --- a/extras/gudev/docs/gudev.types +++ /dev/null @@ -1,4 +0,0 @@ -g_udev_device_type_get_type -g_udev_device_get_type -g_udev_client_get_type -g_udev_enumerator_get_type diff --git a/extras/gudev/docs/version.xml.in b/extras/gudev/docs/version.xml.in deleted file mode 100644 index d78bda9342..0000000000 --- a/extras/gudev/docs/version.xml.in +++ /dev/null @@ -1 +0,0 @@ -@VERSION@ diff --git a/extras/gudev/gjs-example.js b/extras/gudev/gjs-example.js deleted file mode 100755 index 5586fd6a61..0000000000 --- a/extras/gudev/gjs-example.js +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env gjs-console - -// This currently depends on the following patches to gjs -// -// http://bugzilla.gnome.org/show_bug.cgi?id=584558 -// http://bugzilla.gnome.org/show_bug.cgi?id=584560 -// http://bugzilla.gnome.org/show_bug.cgi?id=584568 - -const GUdev = imports.gi.GUdev; -const Mainloop = imports.mainloop; - -function print_device (device) { - print (" subsystem: " + device.get_subsystem ()); - print (" devtype: " + device.get_devtype ()); - print (" name: " + device.get_name ()); - print (" number: " + device.get_number ()); - print (" sysfs_path: " + device.get_sysfs_path ()); - print (" driver: " + device.get_driver ()); - print (" action: " + device.get_action ()); - print (" seqnum: " + device.get_seqnum ()); - print (" device type: " + device.get_device_type ()); - print (" device number: " + device.get_device_number ()); - print (" device file: " + device.get_device_file ()); - print (" device file symlinks: " + device.get_device_file_symlinks ()); - print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); - var keys = device.get_property_keys (); - for (var n = 0; n < keys.length; n++) { - print (" " + keys[n] + "=" + device.get_property (keys[n])); - } -} - -function on_uevent (client, action, device) { - print ("action " + action + " on device " + device.get_sysfs_path()); - print_device (device); - print (""); -} - -var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); -client.connect ("uevent", on_uevent); - -var block_devices = client.query_by_subsystem ("block"); -for (var n = 0; n < block_devices.length; n++) { - print ("block device: " + block_devices[n].get_device_file ()); -} - -var d; - -d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); -if (d == null) { - print ("query_by_device_number 0x810 -> null"); -} else { - print ("query_by_device_number 0x810 -> " + d.get_device_file ()); - var dd = d.get_parent_with_subsystem ("usb", null); - print_device (dd); - print ("--------------------------------------------------------------------------"); - while (d != null) { - print_device (d); - print (""); - d = d.get_parent (); - } -} - -d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); -print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); - -d = client.query_by_subsystem_and_name ("block", "sda2"); -print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); - -d = client.query_by_device_file ("/dev/sda"); -print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); - -d = client.query_by_device_file ("/dev/block/8:0"); -print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); - -Mainloop.run('udev-example'); diff --git a/extras/gudev/gudev-1.0.pc.in b/extras/gudev/gudev-1.0.pc.in deleted file mode 100644 index 058262d767..0000000000 --- a/extras/gudev/gudev-1.0.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gudev-1.0 -Description: GObject bindings for libudev -Version: @VERSION@ -Requires: glib-2.0, gobject-2.0 -Libs: -L${libdir} -lgudev-1.0 -Cflags: -I${includedir}/gudev-1.0 diff --git a/extras/gudev/gudev.h b/extras/gudev/gudev.h deleted file mode 100644 index a313460817..0000000000 --- a/extras/gudev/gudev.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __G_UDEV_H__ -#define __G_UDEV_H__ - -#define _GUDEV_INSIDE_GUDEV_H 1 -#include -#include -#include -#include -#include -#include -#undef _GUDEV_INSIDE_GUDEV_H - -#endif /* __G_UDEV_H__ */ diff --git a/extras/gudev/gudevclient.c b/extras/gudev/gudevclient.c deleted file mode 100644 index 97b951adcd..0000000000 --- a/extras/gudev/gudevclient.c +++ /dev/null @@ -1,528 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008-2010 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "gudevclient.h" -#include "gudevdevice.h" -#include "gudevmarshal.h" -#include "gudevprivate.h" - -/** - * SECTION:gudevclient - * @short_description: Query devices and listen to uevents - * - * #GUdevClient is used to query information about devices on a Linux - * system from the Linux kernel and the udev device - * manager. - * - * Device information is retrieved from the kernel (through the - * sysfs filesystem) and the udev daemon (through a - * tmpfs filesystem) and presented through - * #GUdevDevice objects. This means that no blocking IO ever happens - * (in both cases, we are essentially just reading data from kernel - * memory) and as such there are no asynchronous versions of the - * provided methods. - * - * To get #GUdevDevice objects, use - * g_udev_client_query_by_subsystem(), - * g_udev_client_query_by_device_number(), - * g_udev_client_query_by_device_file(), - * g_udev_client_query_by_sysfs_path(), - * g_udev_client_query_by_subsystem_and_name() - * or the #GUdevEnumerator type. - * - * To listen to uevents, connect to the #GUdevClient::uevent signal. - */ - -struct _GUdevClientPrivate -{ - GSource *watch_source; - struct udev *udev; - struct udev_monitor *monitor; - - gchar **subsystems; -}; - -enum -{ - PROP_0, - PROP_SUBSYSTEMS, -}; - -enum -{ - UEVENT_SIGNAL, - LAST_SIGNAL, -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -G_DEFINE_TYPE (GUdevClient, g_udev_client, G_TYPE_OBJECT) - -/* ---------------------------------------------------------------------------------------------------- */ - -static gboolean -monitor_event (GIOChannel *source, - GIOCondition condition, - gpointer data) -{ - GUdevClient *client = (GUdevClient *) data; - GUdevDevice *device; - struct udev_device *udevice; - - if (client->priv->monitor == NULL) - goto out; - udevice = udev_monitor_receive_device (client->priv->monitor); - if (udevice == NULL) - goto out; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - g_signal_emit (client, - signals[UEVENT_SIGNAL], - 0, - g_udev_device_get_action (device), - device); - g_object_unref (device); - - out: - return TRUE; -} - -static void -g_udev_client_finalize (GObject *object) -{ - GUdevClient *client = G_UDEV_CLIENT (object); - - if (client->priv->watch_source != NULL) - { - g_source_destroy (client->priv->watch_source); - client->priv->watch_source = NULL; - } - - if (client->priv->monitor != NULL) - { - udev_monitor_unref (client->priv->monitor); - client->priv->monitor = NULL; - } - - if (client->priv->udev != NULL) - { - udev_unref (client->priv->udev); - client->priv->udev = NULL; - } - - g_strfreev (client->priv->subsystems); - - if (G_OBJECT_CLASS (g_udev_client_parent_class)->finalize != NULL) - G_OBJECT_CLASS (g_udev_client_parent_class)->finalize (object); -} - -static void -g_udev_client_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GUdevClient *client = G_UDEV_CLIENT (object); - - switch (prop_id) - { - case PROP_SUBSYSTEMS: - if (client->priv->subsystems != NULL) - g_strfreev (client->priv->subsystems); - client->priv->subsystems = g_strdupv (g_value_get_boxed (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -g_udev_client_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GUdevClient *client = G_UDEV_CLIENT (object); - - switch (prop_id) - { - case PROP_SUBSYSTEMS: - g_value_set_boxed (value, client->priv->subsystems); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -g_udev_client_constructed (GObject *object) -{ - GUdevClient *client = G_UDEV_CLIENT (object); - GIOChannel *channel; - guint n; - - client->priv->udev = udev_new (); - - /* connect to event source */ - client->priv->monitor = udev_monitor_new_from_netlink (client->priv->udev, "udev"); - - //g_debug ("ss = %p", client->priv->subsystems); - - if (client->priv->subsystems != NULL) - { - /* install subsystem filters to only wake up for certain events */ - for (n = 0; client->priv->subsystems[n] != NULL; n++) - { - gchar *subsystem; - gchar *devtype; - gchar *s; - - subsystem = g_strdup (client->priv->subsystems[n]); - devtype = NULL; - - //g_debug ("s = '%s'", subsystem); - - s = strstr (subsystem, "/"); - if (s != NULL) - { - devtype = s + 1; - *s = '\0'; - } - - if (client->priv->monitor != NULL) - udev_monitor_filter_add_match_subsystem_devtype (client->priv->monitor, subsystem, devtype); - - g_free (subsystem); - } - - /* listen to events, and buffer them */ - if (client->priv->monitor != NULL) - { - udev_monitor_enable_receiving (client->priv->monitor); - channel = g_io_channel_unix_new (udev_monitor_get_fd (client->priv->monitor)); - client->priv->watch_source = g_io_create_watch (channel, G_IO_IN); - g_io_channel_unref (channel); - g_source_set_callback (client->priv->watch_source, (GSourceFunc) monitor_event, client, NULL); - g_source_attach (client->priv->watch_source, g_main_context_get_thread_default ()); - g_source_unref (client->priv->watch_source); - } - else - { - client->priv->watch_source = NULL; - } - } - - if (G_OBJECT_CLASS (g_udev_client_parent_class)->constructed != NULL) - G_OBJECT_CLASS (g_udev_client_parent_class)->constructed (object); -} - - -static void -g_udev_client_class_init (GUdevClientClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - - gobject_class->constructed = g_udev_client_constructed; - gobject_class->set_property = g_udev_client_set_property; - gobject_class->get_property = g_udev_client_get_property; - gobject_class->finalize = g_udev_client_finalize; - - /** - * GUdevClient:subsystems: - * - * The subsystems to listen for uevents on. - * - * To listen for only a specific DEVTYPE for a given SUBSYSTEM, use - * "subsystem/devtype". For example, to only listen for uevents - * where SUBSYSTEM is usb and DEVTYPE is usb_interface, use - * "usb/usb_interface". - * - * If this property is %NULL, then no events will be reported. If - * it's the empty array, events from all subsystems will be - * reported. - */ - g_object_class_install_property (gobject_class, - PROP_SUBSYSTEMS, - g_param_spec_boxed ("subsystems", - "The subsystems to listen for changes on", - "The subsystems to listen for changes on", - G_TYPE_STRV, - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_READWRITE)); - - /** - * GUdevClient::uevent: - * @client: The #GUdevClient receiving the event. - * @action: The action for the uevent e.g. "add", "remove", "change", "move", etc. - * @device: Details about the #GUdevDevice the event is for. - * - * Emitted when @client receives an uevent. - * - * This signal is emitted in the - * thread-default main loop - * of the thread that @client was created in. - */ - signals[UEVENT_SIGNAL] = g_signal_new ("uevent", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GUdevClientClass, uevent), - NULL, - NULL, - g_udev_marshal_VOID__STRING_OBJECT, - G_TYPE_NONE, - 2, - G_TYPE_STRING, - G_UDEV_TYPE_DEVICE); - - g_type_class_add_private (klass, sizeof (GUdevClientPrivate)); -} - -static void -g_udev_client_init (GUdevClient *client) -{ - client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, - G_UDEV_TYPE_CLIENT, - GUdevClientPrivate); -} - -/** - * g_udev_client_new: - * @subsystems: (array zero-terminated=1) (element-type utf8) (transfer none) (allow-none): A %NULL terminated string array of subsystems to listen for uevents on, %NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the #GUdevClient:subsystems property for details on this parameter. - * - * Constructs a #GUdevClient object that can be used to query - * information about devices. Connect to the #GUdevClient::uevent - * signal to listen for uevents. Note that signals are emitted in the - * thread-default main loop - * of the thread that you call this constructor from. - * - * Returns: A new #GUdevClient object. Free with g_object_unref(). - */ -GUdevClient * -g_udev_client_new (const gchar * const *subsystems) -{ - return G_UDEV_CLIENT (g_object_new (G_UDEV_TYPE_CLIENT, "subsystems", subsystems, NULL)); -} - -/** - * g_udev_client_query_by_subsystem: - * @client: A #GUdevClient. - * @subsystem: (allow-none): The subsystem to get devices for or %NULL to get all devices. - * - * Gets all devices belonging to @subsystem. - * - * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. - */ -GList * -g_udev_client_query_by_subsystem (GUdevClient *client, - const gchar *subsystem) -{ - struct udev_enumerate *enumerate; - struct udev_list_entry *l, *devices; - GList *ret; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - - ret = NULL; - - /* prepare a device scan */ - enumerate = udev_enumerate_new (client->priv->udev); - - /* filter for subsystem */ - if (subsystem != NULL) - udev_enumerate_add_match_subsystem (enumerate, subsystem); - /* retrieve the list */ - udev_enumerate_scan_devices (enumerate); - - /* add devices to the list */ - devices = udev_enumerate_get_list_entry (enumerate); - for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) - { - struct udev_device *udevice; - GUdevDevice *device; - - udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerate), - udev_list_entry_get_name (l)); - if (udevice == NULL) - continue; - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - ret = g_list_prepend (ret, device); - } - udev_enumerate_unref (enumerate); - - ret = g_list_reverse (ret); - - return ret; -} - -/** - * g_udev_client_query_by_device_number: - * @client: A #GUdevClient. - * @type: A value from the #GUdevDeviceType enumeration. - * @number: A device number. - * - * Looks up a device for a type and device number. - * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_client_query_by_device_number (GUdevClient *client, - GUdevDeviceType type, - GUdevDeviceNumber number) -{ - struct udev_device *udevice; - GUdevDevice *device; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - - device = NULL; - udevice = udev_device_new_from_devnum (client->priv->udev, type, number); - - if (udevice == NULL) - goto out; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - - out: - return device; -} - -/** - * g_udev_client_query_by_device_file: - * @client: A #GUdevClient. - * @device_file: A device file. - * - * Looks up a device for a device file. - * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_client_query_by_device_file (GUdevClient *client, - const gchar *device_file) -{ - struct stat stat_buf; - GUdevDevice *device; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - g_return_val_if_fail (device_file != NULL, NULL); - - device = NULL; - - if (stat (device_file, &stat_buf) != 0) - goto out; - - if (stat_buf.st_rdev == 0) - goto out; - - if (S_ISBLK (stat_buf.st_mode)) - device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_BLOCK, stat_buf.st_rdev); - else if (S_ISCHR (stat_buf.st_mode)) - device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_CHAR, stat_buf.st_rdev); - - out: - return device; -} - -/** - * g_udev_client_query_by_sysfs_path: - * @client: A #GUdevClient. - * @sysfs_path: A sysfs path. - * - * Looks up a device for a sysfs path. - * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_client_query_by_sysfs_path (GUdevClient *client, - const gchar *sysfs_path) -{ - struct udev_device *udevice; - GUdevDevice *device; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - g_return_val_if_fail (sysfs_path != NULL, NULL); - - device = NULL; - udevice = udev_device_new_from_syspath (client->priv->udev, sysfs_path); - if (udevice == NULL) - goto out; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - - out: - return device; -} - -/** - * g_udev_client_query_by_subsystem_and_name: - * @client: A #GUdevClient. - * @subsystem: A subsystem name. - * @name: The name of the device. - * - * Looks up a device for a subsystem and name. - * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_client_query_by_subsystem_and_name (GUdevClient *client, - const gchar *subsystem, - const gchar *name) -{ - struct udev_device *udevice; - GUdevDevice *device; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - g_return_val_if_fail (subsystem != NULL, NULL); - g_return_val_if_fail (name != NULL, NULL); - - device = NULL; - udevice = udev_device_new_from_subsystem_sysname (client->priv->udev, subsystem, name); - if (udevice == NULL) - goto out; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - - out: - return device; -} - -struct udev * -_g_udev_client_get_udev (GUdevClient *client) -{ - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - return client->priv->udev; -} - diff --git a/extras/gudev/gudevclient.h b/extras/gudev/gudevclient.h deleted file mode 100644 index b425d03d48..0000000000 --- a/extras/gudev/gudevclient.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_CLIENT_H__ -#define __G_UDEV_CLIENT_H__ - -#include - -G_BEGIN_DECLS - -#define G_UDEV_TYPE_CLIENT (g_udev_client_get_type ()) -#define G_UDEV_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_CLIENT, GUdevClient)) -#define G_UDEV_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_CLIENT, GUdevClientClass)) -#define G_UDEV_IS_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_CLIENT)) -#define G_UDEV_IS_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_CLIENT)) -#define G_UDEV_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_CLIENT, GUdevClientClass)) - -typedef struct _GUdevClientClass GUdevClientClass; -typedef struct _GUdevClientPrivate GUdevClientPrivate; - -/** - * GUdevClient: - * - * The #GUdevClient struct is opaque and should not be accessed directly. - */ -struct _GUdevClient -{ - GObject parent; - - /*< private >*/ - GUdevClientPrivate *priv; -}; - -/** - * GUdevClientClass: - * @parent_class: Parent class. - * @uevent: Signal class handler for the #GUdevClient::uevent signal. - * - * Class structure for #GUdevClient. - */ -struct _GUdevClientClass -{ - GObjectClass parent_class; - - /* signals */ - void (*uevent) (GUdevClient *client, - const gchar *action, - GUdevDevice *device); - - /*< private >*/ - /* Padding for future expansion */ - void (*reserved1) (void); - void (*reserved2) (void); - void (*reserved3) (void); - void (*reserved4) (void); - void (*reserved5) (void); - void (*reserved6) (void); - void (*reserved7) (void); - void (*reserved8) (void); -}; - -GType g_udev_client_get_type (void) G_GNUC_CONST; -GUdevClient *g_udev_client_new (const gchar* const *subsystems); -GList *g_udev_client_query_by_subsystem (GUdevClient *client, - const gchar *subsystem); -GUdevDevice *g_udev_client_query_by_device_number (GUdevClient *client, - GUdevDeviceType type, - GUdevDeviceNumber number); -GUdevDevice *g_udev_client_query_by_device_file (GUdevClient *client, - const gchar *device_file); -GUdevDevice *g_udev_client_query_by_sysfs_path (GUdevClient *client, - const gchar *sysfs_path); -GUdevDevice *g_udev_client_query_by_subsystem_and_name (GUdevClient *client, - const gchar *subsystem, - const gchar *name); - -G_END_DECLS - -#endif /* __G_UDEV_CLIENT_H__ */ diff --git a/extras/gudev/gudevdevice.c b/extras/gudev/gudevdevice.c deleted file mode 100644 index 38d602c42a..0000000000 --- a/extras/gudev/gudevdevice.c +++ /dev/null @@ -1,964 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "gudevdevice.h" -#include "gudevprivate.h" - -/** - * SECTION:gudevdevice - * @short_description: Get information about a device - * - * The #GUdevDevice class is used to get information about a specific - * device. Note that you cannot instantiate a #GUdevDevice object - * yourself. Instead you must use #GUdevClient to obtain #GUdevDevice - * objects. - * - * To get basic information about a device, use - * g_udev_device_get_subsystem(), g_udev_device_get_devtype(), - * g_udev_device_get_name(), g_udev_device_get_number(), - * g_udev_device_get_sysfs_path(), g_udev_device_get_driver(), - * g_udev_device_get_action(), g_udev_device_get_seqnum(), - * g_udev_device_get_device_type(), g_udev_device_get_device_number(), - * g_udev_device_get_device_file(), - * g_udev_device_get_device_file_symlinks(). - * - * To navigate the device tree, use g_udev_device_get_parent() and - * g_udev_device_get_parent_with_subsystem(). - * - * To access udev properties for the device, use - * g_udev_device_get_property_keys(), - * g_udev_device_has_property(), - * g_udev_device_get_property(), - * g_udev_device_get_property_as_int(), - * g_udev_device_get_property_as_uint64(), - * g_udev_device_get_property_as_double(), - * g_udev_device_get_property_as_boolean() and - * g_udev_device_get_property_as_strv(). - * - * To access sysfs attributes for the device, use - * g_udev_device_get_sysfs_attr(), - * g_udev_device_get_sysfs_attr_as_int(), - * g_udev_device_get_sysfs_attr_as_uint64(), - * g_udev_device_get_sysfs_attr_as_double(), - * g_udev_device_get_sysfs_attr_as_boolean() and - * g_udev_device_get_sysfs_attr_as_strv(). - * - * Note that all getters on #GUdevDevice are non-reffing – returned - * values are owned by the object, should not be freed and are only - * valid as long as the object is alive. - * - * By design, #GUdevDevice will not react to changes for a device – it - * only contains a snapshot of information when the #GUdevDevice - * object was created. To work with changes, you typically connect to - * the #GUdevClient::uevent signal on a #GUdevClient and get a new - * #GUdevDevice whenever an event happens. - */ - -struct _GUdevDevicePrivate -{ - struct udev_device *udevice; - - /* computed ondemand and cached */ - gchar **device_file_symlinks; - gchar **property_keys; - gchar **tags; - GHashTable *prop_strvs; - GHashTable *sysfs_attr_strvs; -}; - -G_DEFINE_TYPE (GUdevDevice, g_udev_device, G_TYPE_OBJECT) - -static void -g_udev_device_finalize (GObject *object) -{ - GUdevDevice *device = G_UDEV_DEVICE (object); - - g_strfreev (device->priv->device_file_symlinks); - g_strfreev (device->priv->property_keys); - g_strfreev (device->priv->tags); - - if (device->priv->udevice != NULL) - udev_device_unref (device->priv->udevice); - - if (device->priv->prop_strvs != NULL) - g_hash_table_unref (device->priv->prop_strvs); - - if (device->priv->sysfs_attr_strvs != NULL) - g_hash_table_unref (device->priv->sysfs_attr_strvs); - - if (G_OBJECT_CLASS (g_udev_device_parent_class)->finalize != NULL) - (* G_OBJECT_CLASS (g_udev_device_parent_class)->finalize) (object); -} - -static void -g_udev_device_class_init (GUdevDeviceClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - - gobject_class->finalize = g_udev_device_finalize; - - g_type_class_add_private (klass, sizeof (GUdevDevicePrivate)); -} - -static void -g_udev_device_init (GUdevDevice *device) -{ - device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device, - G_UDEV_TYPE_DEVICE, - GUdevDevicePrivate); -} - - -GUdevDevice * -_g_udev_device_new (struct udev_device *udevice) -{ - GUdevDevice *device; - - device = G_UDEV_DEVICE (g_object_new (G_UDEV_TYPE_DEVICE, NULL)); - device->priv->udevice = udev_device_ref (udevice); - - return device; -} - -/** - * g_udev_device_get_subsystem: - * @device: A #GUdevDevice. - * - * Gets the subsystem for @device. - * - * Returns: The subsystem for @device. - */ -const gchar * -g_udev_device_get_subsystem (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_subsystem (device->priv->udevice); -} - -/** - * g_udev_device_get_devtype: - * @device: A #GUdevDevice. - * - * Gets the device type for @device. - * - * Returns: The devtype for @device. - */ -const gchar * -g_udev_device_get_devtype (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_devtype (device->priv->udevice); -} - -/** - * g_udev_device_get_name: - * @device: A #GUdevDevice. - * - * Gets the name of @device, e.g. "sda3". - * - * Returns: The name of @device. - */ -const gchar * -g_udev_device_get_name (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_sysname (device->priv->udevice); -} - -/** - * g_udev_device_get_number: - * @device: A #GUdevDevice. - * - * Gets the number of @device, e.g. "3" if g_udev_device_get_name() returns "sda3". - * - * Returns: The number of @device. - */ -const gchar * -g_udev_device_get_number (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_sysnum (device->priv->udevice); -} - -/** - * g_udev_device_get_sysfs_path: - * @device: A #GUdevDevice. - * - * Gets the sysfs path for @device. - * - * Returns: The sysfs path for @device. - */ -const gchar * -g_udev_device_get_sysfs_path (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_syspath (device->priv->udevice); -} - -/** - * g_udev_device_get_driver: - * @device: A #GUdevDevice. - * - * Gets the name of the driver used for @device. - * - * Returns: The name of the driver for @device or %NULL if unknown. - */ -const gchar * -g_udev_device_get_driver (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_driver (device->priv->udevice); -} - -/** - * g_udev_device_get_action: - * @device: A #GUdevDevice. - * - * Gets the most recent action (e.g. "add", "remove", "change", etc.) for @device. - * - * Returns: An action string. - */ -const gchar * -g_udev_device_get_action (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_action (device->priv->udevice); -} - -/** - * g_udev_device_get_seqnum: - * @device: A #GUdevDevice. - * - * Gets the most recent sequence number for @device. - * - * Returns: A sequence number. - */ -guint64 -g_udev_device_get_seqnum (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - return udev_device_get_seqnum (device->priv->udevice); -} - -/** - * g_udev_device_get_device_type: - * @device: A #GUdevDevice. - * - * Gets the type of the device file, if any, for @device. - * - * Returns: The device number for @device or #G_UDEV_DEVICE_TYPE_NONE if the device does not have a device file. - */ -GUdevDeviceType -g_udev_device_get_device_type (GUdevDevice *device) -{ - struct stat stat_buf; - const gchar *device_file; - GUdevDeviceType type; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), G_UDEV_DEVICE_TYPE_NONE); - - type = G_UDEV_DEVICE_TYPE_NONE; - - /* TODO: would be better to have support for this in libudev... */ - - device_file = g_udev_device_get_device_file (device); - if (device_file == NULL) - goto out; - - if (stat (device_file, &stat_buf) != 0) - goto out; - - if (S_ISBLK (stat_buf.st_mode)) - type = G_UDEV_DEVICE_TYPE_BLOCK; - else if (S_ISCHR (stat_buf.st_mode)) - type = G_UDEV_DEVICE_TYPE_CHAR; - - out: - return type; -} - -/** - * g_udev_device_get_device_number: - * @device: A #GUdevDevice. - * - * Gets the device number, if any, for @device. - * - * Returns: The device number for @device or 0 if unknown. - */ -GUdevDeviceNumber -g_udev_device_get_device_number (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - return udev_device_get_devnum (device->priv->udevice); -} - -/** - * g_udev_device_get_device_file: - * @device: A #GUdevDevice. - * - * Gets the device file for @device. - * - * Returns: The device file for @device or %NULL if no device file - * exists. - */ -const gchar * -g_udev_device_get_device_file (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_devnode (device->priv->udevice); -} - -/** - * g_udev_device_get_device_file_symlinks: - * @device: A #GUdevDevice. - * - * Gets a list of symlinks (in /dev) that points to - * the device file for @device. - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of symlinks. This array is owned by @device and should not be freed by the caller. - */ -const gchar * const * -g_udev_device_get_device_file_symlinks (GUdevDevice *device) -{ - struct udev_list_entry *l; - GPtrArray *p; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - - if (device->priv->device_file_symlinks != NULL) - goto out; - - p = g_ptr_array_new (); - for (l = udev_device_get_devlinks_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) - { - g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); - } - g_ptr_array_add (p, NULL); - device->priv->device_file_symlinks = (gchar **) g_ptr_array_free (p, FALSE); - - out: - return (const gchar * const *) device->priv->device_file_symlinks; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -/** - * g_udev_device_get_parent: - * @device: A #GUdevDevice. - * - * Gets the immediate parent of @device, if any. - * - * Returns: A #GUdevDevice or %NULL if @device has no parent. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_device_get_parent (GUdevDevice *device) -{ - GUdevDevice *ret; - struct udev_device *udevice; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - - ret = NULL; - - udevice = udev_device_get_parent (device->priv->udevice); - if (udevice == NULL) - goto out; - - ret = _g_udev_device_new (udevice); - - out: - return ret; -} - -/** - * g_udev_device_get_parent_with_subsystem: - * @device: A #GUdevDevice. - * @subsystem: The subsystem of the parent to get. - * @devtype: (allow-none): The devtype of the parent to get or %NULL. - * - * Walks up the chain of parents of @device and returns the first - * device encountered where @subsystem and @devtype matches, if any. - * - * Returns: A #GUdevDevice or %NULL if @device has no parent with @subsystem and @devtype. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_device_get_parent_with_subsystem (GUdevDevice *device, - const gchar *subsystem, - const gchar *devtype) -{ - GUdevDevice *ret; - struct udev_device *udevice; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (subsystem != NULL, NULL); - - ret = NULL; - - udevice = udev_device_get_parent_with_subsystem_devtype (device->priv->udevice, - subsystem, - devtype); - if (udevice == NULL) - goto out; - - ret = _g_udev_device_new (udevice); - - out: - return ret; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -/** - * g_udev_device_get_property_keys: - * @device: A #GUdevDevice. - * - * Gets all keys for properties on @device. - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of property keys. This array is owned by @device and should not be freed by the caller. - */ -const gchar* const * -g_udev_device_get_property_keys (GUdevDevice *device) -{ - struct udev_list_entry *l; - GPtrArray *p; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - - if (device->priv->property_keys != NULL) - goto out; - - p = g_ptr_array_new (); - for (l = udev_device_get_properties_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) - { - g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); - } - g_ptr_array_add (p, NULL); - device->priv->property_keys = (gchar **) g_ptr_array_free (p, FALSE); - - out: - return (const gchar * const *) device->priv->property_keys; -} - - -/** - * g_udev_device_has_property: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Check if a the property with the given key exists. - * - * Returns: %TRUE only if the value for @key exist. - */ -gboolean -g_udev_device_has_property (GUdevDevice *device, - const gchar *key) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); - g_return_val_if_fail (key != NULL, FALSE); - return udev_device_get_property_value (device->priv->udevice, key) != NULL; -} - -/** - * g_udev_device_get_property: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device. - * - * Returns: The value for @key or %NULL if @key doesn't exist on @device. Do not free this string, it is owned by @device. - */ -const gchar * -g_udev_device_get_property (GUdevDevice *device, - const gchar *key) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (key != NULL, NULL); - return udev_device_get_property_value (device->priv->udevice, key); -} - -/** - * g_udev_device_get_property_as_int: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and convert it to an integer - * using strtol(). - * - * Returns: The value for @key or 0 if @key doesn't exist or - * isn't an integer. - */ -gint -g_udev_device_get_property_as_int (GUdevDevice *device, - const gchar *key) -{ - gint result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - g_return_val_if_fail (key != NULL, 0); - - result = 0; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - result = strtol (s, NULL, 0); -out: - return result; -} - -/** - * g_udev_device_get_property_as_uint64: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and convert it to an unsigned - * 64-bit integer using g_ascii_strtoull(). - * - * Returns: The value for @key or 0 if @key doesn't exist or isn't a - * #guint64. - */ -guint64 -g_udev_device_get_property_as_uint64 (GUdevDevice *device, - const gchar *key) -{ - guint64 result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - g_return_val_if_fail (key != NULL, 0); - - result = 0; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - result = g_ascii_strtoull (s, NULL, 0); -out: - return result; -} - -/** - * g_udev_device_get_property_as_double: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and convert it to a double - * precision floating point number using strtod(). - * - * Returns: The value for @key or 0.0 if @key doesn't exist or isn't a - * #gdouble. - */ -gdouble -g_udev_device_get_property_as_double (GUdevDevice *device, - const gchar *key) -{ - gdouble result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); - g_return_val_if_fail (key != NULL, 0.0); - - result = 0.0; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - result = strtod (s, NULL); -out: - return result; -} - -/** - * g_udev_device_get_property_as_boolean: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and convert it to an - * boolean. This is done by doing a case-insensitive string comparison - * on the string value against "1" and "true". - * - * Returns: The value for @key or %FALSE if @key doesn't exist or - * isn't a #gboolean. - */ -gboolean -g_udev_device_get_property_as_boolean (GUdevDevice *device, - const gchar *key) -{ - gboolean result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); - g_return_val_if_fail (key != NULL, FALSE); - - result = FALSE; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) - result = TRUE; - out: - return result; -} - -static gchar ** -split_at_whitespace (const gchar *s) -{ - gchar **result; - guint n; - guint m; - - result = g_strsplit_set (s, " \v\t\r\n", 0); - - /* remove empty strings, thanks GLib */ - for (n = 0; result[n] != NULL; n++) - { - if (strlen (result[n]) == 0) - { - g_free (result[n]); - for (m = n; result[m] != NULL; m++) - result[m] = result[m + 1]; - n--; - } - } - - return result; -} - -/** - * g_udev_device_get_property_as_strv: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and return the result of - * splitting it into non-empty tokens split at white space (only space - * (' '), form-feed ('\f'), newline ('\n'), carriage return ('\r'), - * horizontal tab ('\t'), and vertical tab ('\v') are considered; the - * locale is not taken into account). - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of @key on @device split into tokens or %NULL if @key doesn't exist. This array is owned by @device and should not be freed by the caller. - */ -const gchar* const * -g_udev_device_get_property_as_strv (GUdevDevice *device, - const gchar *key) -{ - gchar **result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (key != NULL, NULL); - - if (device->priv->prop_strvs != NULL) - { - result = g_hash_table_lookup (device->priv->prop_strvs, key); - if (result != NULL) - goto out; - } - - result = NULL; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - result = split_at_whitespace (s); - if (result == NULL) - goto out; - - if (device->priv->prop_strvs == NULL) - device->priv->prop_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); - g_hash_table_insert (device->priv->prop_strvs, g_strdup (key), result); - -out: - return (const gchar* const *) result; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -/** - * g_udev_device_get_sysfs_attr: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device. - * - * Returns: The value of the sysfs attribute or %NULL if there is no - * such attribute. Do not free this string, it is owned by @device. - */ -const gchar * -g_udev_device_get_sysfs_attr (GUdevDevice *device, - const gchar *name) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (name != NULL, NULL); - return udev_device_get_sysattr_value (device->priv->udevice, name); -} - -/** - * g_udev_device_get_sysfs_attr_as_int: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and convert it to an integer - * using strtol(). - * - * Returns: The value of the sysfs attribute or 0 if there is no such - * attribute. - */ -gint -g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, - const gchar *name) -{ - gint result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - g_return_val_if_fail (name != NULL, 0); - - result = 0; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - result = strtol (s, NULL, 0); -out: - return result; -} - -/** - * g_udev_device_get_sysfs_attr_as_uint64: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and convert it to an unsigned - * 64-bit integer using g_ascii_strtoull(). - * - * Returns: The value of the sysfs attribute or 0 if there is no such - * attribute. - */ -guint64 -g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, - const gchar *name) -{ - guint64 result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - g_return_val_if_fail (name != NULL, 0); - - result = 0; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - result = g_ascii_strtoull (s, NULL, 0); -out: - return result; -} - -/** - * g_udev_device_get_sysfs_attr_as_double: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and convert it to a double - * precision floating point number using strtod(). - * - * Returns: The value of the sysfs attribute or 0.0 if there is no such - * attribute. - */ -gdouble -g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, - const gchar *name) -{ - gdouble result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); - g_return_val_if_fail (name != NULL, 0.0); - - result = 0.0; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - result = strtod (s, NULL); -out: - return result; -} - -/** - * g_udev_device_get_sysfs_attr_as_boolean: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and convert it to an - * boolean. This is done by doing a case-insensitive string comparison - * on the string value against "1" and "true". - * - * Returns: The value of the sysfs attribute or %FALSE if there is no such - * attribute. - */ -gboolean -g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, - const gchar *name) -{ - gboolean result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); - g_return_val_if_fail (name != NULL, FALSE); - - result = FALSE; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) - result = TRUE; - out: - return result; -} - -/** - * g_udev_device_get_sysfs_attr_as_strv: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and return the result of - * splitting it into non-empty tokens split at white space (only space (' '), - * form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal - * tab ('\t'), and vertical tab ('\v') are considered; the locale is - * not taken into account). - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of the sysfs attribute split into tokens or %NULL if there is no such attribute. This array is owned by @device and should not be freed by the caller. - */ -const gchar * const * -g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, - const gchar *name) -{ - gchar **result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (name != NULL, NULL); - - if (device->priv->sysfs_attr_strvs != NULL) - { - result = g_hash_table_lookup (device->priv->sysfs_attr_strvs, name); - if (result != NULL) - goto out; - } - - result = NULL; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - result = split_at_whitespace (s); - if (result == NULL) - goto out; - - if (device->priv->sysfs_attr_strvs == NULL) - device->priv->sysfs_attr_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); - g_hash_table_insert (device->priv->sysfs_attr_strvs, g_strdup (name), result); - -out: - return (const gchar* const *) result; -} - -/** - * g_udev_device_get_tags: - * @device: A #GUdevDevice. - * - * Gets all tags for @device. - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of tags. This array is owned by @device and should not be freed by the caller. - * - * Since: 165 - */ -const gchar* const * -g_udev_device_get_tags (GUdevDevice *device) -{ - struct udev_list_entry *l; - GPtrArray *p; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - - if (device->priv->tags != NULL) - goto out; - - p = g_ptr_array_new (); - for (l = udev_device_get_tags_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) - { - g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); - } - g_ptr_array_add (p, NULL); - device->priv->tags = (gchar **) g_ptr_array_free (p, FALSE); - - out: - return (const gchar * const *) device->priv->tags; -} - -/** - * g_udev_device_get_is_initialized: - * @device: A #GUdevDevice. - * - * Gets whether @device has been initalized. - * - * Returns: Whether @device has been initialized. - * - * Since: 165 - */ -gboolean -g_udev_device_get_is_initialized (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); - return udev_device_get_is_initialized (device->priv->udevice); -} - -/** - * g_udev_device_get_usec_since_initialized: - * @device: A #GUdevDevice. - * - * Gets number of micro-seconds since @device was initialized. - * - * This only works for devices with properties in the udev - * database. All other devices return 0. - * - * Returns: Number of micro-seconds since @device was initialized or 0 if unknown. - * - * Since: 165 - */ -guint64 -g_udev_device_get_usec_since_initialized (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - return udev_device_get_usec_since_initialized (device->priv->udevice); -} - diff --git a/extras/gudev/gudevdevice.h b/extras/gudev/gudevdevice.h deleted file mode 100644 index d4873bad0f..0000000000 --- a/extras/gudev/gudevdevice.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_DEVICE_H__ -#define __G_UDEV_DEVICE_H__ - -#include - -G_BEGIN_DECLS - -#define G_UDEV_TYPE_DEVICE (g_udev_device_get_type ()) -#define G_UDEV_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_DEVICE, GUdevDevice)) -#define G_UDEV_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) -#define G_UDEV_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_DEVICE)) -#define G_UDEV_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_DEVICE)) -#define G_UDEV_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) - -typedef struct _GUdevDeviceClass GUdevDeviceClass; -typedef struct _GUdevDevicePrivate GUdevDevicePrivate; - -/** - * GUdevDevice: - * - * The #GUdevDevice struct is opaque and should not be accessed directly. - */ -struct _GUdevDevice -{ - GObject parent; - - /*< private >*/ - GUdevDevicePrivate *priv; -}; - -/** - * GUdevDeviceClass: - * @parent_class: Parent class. - * - * Class structure for #GUdevDevice. - */ -struct _GUdevDeviceClass -{ - GObjectClass parent_class; - - /*< private >*/ - /* Padding for future expansion */ - void (*reserved1) (void); - void (*reserved2) (void); - void (*reserved3) (void); - void (*reserved4) (void); - void (*reserved5) (void); - void (*reserved6) (void); - void (*reserved7) (void); - void (*reserved8) (void); -}; - -GType g_udev_device_get_type (void) G_GNUC_CONST; -gboolean g_udev_device_get_is_initialized (GUdevDevice *device); -guint64 g_udev_device_get_usec_since_initialized (GUdevDevice *device); -const gchar *g_udev_device_get_subsystem (GUdevDevice *device); -const gchar *g_udev_device_get_devtype (GUdevDevice *device); -const gchar *g_udev_device_get_name (GUdevDevice *device); -const gchar *g_udev_device_get_number (GUdevDevice *device); -const gchar *g_udev_device_get_sysfs_path (GUdevDevice *device); -const gchar *g_udev_device_get_driver (GUdevDevice *device); -const gchar *g_udev_device_get_action (GUdevDevice *device); -guint64 g_udev_device_get_seqnum (GUdevDevice *device); -GUdevDeviceType g_udev_device_get_device_type (GUdevDevice *device); -GUdevDeviceNumber g_udev_device_get_device_number (GUdevDevice *device); -const gchar *g_udev_device_get_device_file (GUdevDevice *device); -const gchar* const *g_udev_device_get_device_file_symlinks (GUdevDevice *device); -GUdevDevice *g_udev_device_get_parent (GUdevDevice *device); -GUdevDevice *g_udev_device_get_parent_with_subsystem (GUdevDevice *device, - const gchar *subsystem, - const gchar *devtype); -const gchar* const *g_udev_device_get_property_keys (GUdevDevice *device); -gboolean g_udev_device_has_property (GUdevDevice *device, - const gchar *key); -const gchar *g_udev_device_get_property (GUdevDevice *device, - const gchar *key); -gint g_udev_device_get_property_as_int (GUdevDevice *device, - const gchar *key); -guint64 g_udev_device_get_property_as_uint64 (GUdevDevice *device, - const gchar *key); -gdouble g_udev_device_get_property_as_double (GUdevDevice *device, - const gchar *key); -gboolean g_udev_device_get_property_as_boolean (GUdevDevice *device, - const gchar *key); -const gchar* const *g_udev_device_get_property_as_strv (GUdevDevice *device, - const gchar *key); - -const gchar *g_udev_device_get_sysfs_attr (GUdevDevice *device, - const gchar *name); -gint g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, - const gchar *name); -guint64 g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, - const gchar *name); -gdouble g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, - const gchar *name); -gboolean g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, - const gchar *name); -const gchar* const *g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, - const gchar *name); -const gchar* const *g_udev_device_get_tags (GUdevDevice *device); - -G_END_DECLS - -#endif /* __G_UDEV_DEVICE_H__ */ diff --git a/extras/gudev/gudevenumerator.c b/extras/gudev/gudevenumerator.c deleted file mode 100644 index db09074625..0000000000 --- a/extras/gudev/gudevenumerator.c +++ /dev/null @@ -1,431 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008-2010 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "gudevclient.h" -#include "gudevenumerator.h" -#include "gudevdevice.h" -#include "gudevmarshal.h" -#include "gudevprivate.h" - -/** - * SECTION:gudevenumerator - * @short_description: Lookup and sort devices - * - * #GUdevEnumerator is used to lookup and sort devices. - * - * Since: 165 - */ - -struct _GUdevEnumeratorPrivate -{ - GUdevClient *client; - struct udev_enumerate *e; -}; - -enum -{ - PROP_0, - PROP_CLIENT, -}; - -G_DEFINE_TYPE (GUdevEnumerator, g_udev_enumerator, G_TYPE_OBJECT) - -/* ---------------------------------------------------------------------------------------------------- */ - -static void -g_udev_enumerator_finalize (GObject *object) -{ - GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); - - if (enumerator->priv->client != NULL) - { - g_object_unref (enumerator->priv->client); - enumerator->priv->client = NULL; - } - - if (enumerator->priv->e != NULL) - { - udev_enumerate_unref (enumerator->priv->e); - enumerator->priv->e = NULL; - } - - if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize != NULL) - G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize (object); -} - -static void -g_udev_enumerator_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); - - switch (prop_id) - { - case PROP_CLIENT: - if (enumerator->priv->client != NULL) - g_object_unref (enumerator->priv->client); - enumerator->priv->client = g_value_dup_object (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -g_udev_enumerator_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); - - switch (prop_id) - { - case PROP_CLIENT: - g_value_set_object (value, enumerator->priv->client); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -g_udev_enumerator_constructed (GObject *object) -{ - GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); - - g_assert (G_UDEV_IS_CLIENT (enumerator->priv->client)); - - enumerator->priv->e = udev_enumerate_new (_g_udev_client_get_udev (enumerator->priv->client)); - - if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed != NULL) - G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed (object); -} - -static void -g_udev_enumerator_class_init (GUdevEnumeratorClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - - gobject_class->finalize = g_udev_enumerator_finalize; - gobject_class->set_property = g_udev_enumerator_set_property; - gobject_class->get_property = g_udev_enumerator_get_property; - gobject_class->constructed = g_udev_enumerator_constructed; - - /** - * GUdevEnumerator:client: - * - * The #GUdevClient to enumerate devices from. - * - * Since: 165 - */ - g_object_class_install_property (gobject_class, - PROP_CLIENT, - g_param_spec_object ("client", - "The client to enumerate devices from", - "The client to enumerate devices from", - G_UDEV_TYPE_CLIENT, - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_READWRITE)); - - g_type_class_add_private (klass, sizeof (GUdevEnumeratorPrivate)); -} - -static void -g_udev_enumerator_init (GUdevEnumerator *enumerator) -{ - enumerator->priv = G_TYPE_INSTANCE_GET_PRIVATE (enumerator, - G_UDEV_TYPE_ENUMERATOR, - GUdevEnumeratorPrivate); -} - -/** - * g_udev_enumerator_new: - * @client: A #GUdevClient to enumerate devices from. - * - * Constructs a #GUdevEnumerator object that can be used to enumerate - * and sort devices. Use the add_match_*() and add_nomatch_*() methods - * and execute the query to get a list of devices with - * g_udev_enumerator_execute(). - * - * Returns: A new #GUdevEnumerator object. Free with g_object_unref(). - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_new (GUdevClient *client) -{ - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - return G_UDEV_ENUMERATOR (g_object_new (G_UDEV_TYPE_ENUMERATOR, "client", client, NULL)); -} - - -/** - * g_udev_enumerator_add_match_subsystem: - * @enumerator: A #GUdevEnumerator. - * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. - * - * All returned devices will match the given @subsystem. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, - const gchar *subsystem) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (subsystem != NULL, NULL); - udev_enumerate_add_match_subsystem (enumerator->priv->e, subsystem); - return enumerator; -} - -/** - * g_udev_enumerator_add_nomatch_subsystem: - * @enumerator: A #GUdevEnumerator. - * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. - * - * All returned devices will not match the given @subsystem. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, - const gchar *subsystem) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (subsystem != NULL, NULL); - udev_enumerate_add_nomatch_subsystem (enumerator->priv->e, subsystem); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_sysfs_attr: - * @enumerator: A #GUdevEnumerator. - * @name: Wildcard filter for sysfs attribute key. - * @value: Wildcard filter for sysfs attribute value. - * - * All returned devices will have a sysfs attribute matching the given @name and @value. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (value != NULL, NULL); - udev_enumerate_add_match_sysattr (enumerator->priv->e, name, value); - return enumerator; -} - -/** - * g_udev_enumerator_add_nomatch_sysfs_attr: - * @enumerator: A #GUdevEnumerator. - * @name: Wildcard filter for sysfs attribute key. - * @value: Wildcard filter for sysfs attribute value. - * - * All returned devices will not have a sysfs attribute matching the given @name and @value. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (value != NULL, NULL); - udev_enumerate_add_nomatch_sysattr (enumerator->priv->e, name, value); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_property: - * @enumerator: A #GUdevEnumerator. - * @name: Wildcard filter for property name. - * @value: Wildcard filter for property value. - * - * All returned devices will have a property matching the given @name and @value. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (value != NULL, NULL); - udev_enumerate_add_match_property (enumerator->priv->e, name, value); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_name: - * @enumerator: A #GUdevEnumerator. - * @name: Wildcard filter for kernel name e.g. "sda*". - * - * All returned devices will match the given @name. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, - const gchar *name) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (name != NULL, NULL); - udev_enumerate_add_match_sysname (enumerator->priv->e, name); - return enumerator; -} - -/** - * g_udev_enumerator_add_sysfs_path: - * @enumerator: A #GUdevEnumerator. - * @sysfs_path: A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda" - * - * Add a device to the list of devices, to retrieve it back sorted in dependency order. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, - const gchar *sysfs_path) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (sysfs_path != NULL, NULL); - udev_enumerate_add_syspath (enumerator->priv->e, sysfs_path); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_tag: - * @enumerator: A #GUdevEnumerator. - * @tag: A udev tag e.g. "udev-acl". - * - * All returned devices will match the given @tag. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, - const gchar *tag) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (tag != NULL, NULL); - udev_enumerate_add_match_tag (enumerator->priv->e, tag); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_is_initialized: - * @enumerator: A #GUdevEnumerator. - * - * All returned devices will be initialized. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - udev_enumerate_add_match_is_initialized (enumerator->priv->e); - return enumerator; -} - -/** - * g_udev_enumerator_execute: - * @enumerator: A #GUdevEnumerator. - * - * Executes the query in @enumerator. - * - * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. - * - * Since: 165 - */ -GList * -g_udev_enumerator_execute (GUdevEnumerator *enumerator) -{ - GList *ret; - struct udev_list_entry *l, *devices; - - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - - ret = NULL; - - /* retrieve the list */ - udev_enumerate_scan_devices (enumerator->priv->e); - - devices = udev_enumerate_get_list_entry (enumerator->priv->e); - for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) - { - struct udev_device *udevice; - GUdevDevice *device; - - udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerator->priv->e), - udev_list_entry_get_name (l)); - if (udevice == NULL) - continue; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - ret = g_list_prepend (ret, device); - } - - ret = g_list_reverse (ret); - - return ret; -} diff --git a/extras/gudev/gudevenumerator.h b/extras/gudev/gudevenumerator.h deleted file mode 100644 index 3fddccf573..0000000000 --- a/extras/gudev/gudevenumerator.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008-2010 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_ENUMERATOR_H__ -#define __G_UDEV_ENUMERATOR_H__ - -#include - -G_BEGIN_DECLS - -#define G_UDEV_TYPE_ENUMERATOR (g_udev_enumerator_get_type ()) -#define G_UDEV_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumerator)) -#define G_UDEV_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) -#define G_UDEV_IS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_ENUMERATOR)) -#define G_UDEV_IS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_ENUMERATOR)) -#define G_UDEV_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) - -typedef struct _GUdevEnumeratorClass GUdevEnumeratorClass; -typedef struct _GUdevEnumeratorPrivate GUdevEnumeratorPrivate; - -/** - * GUdevEnumerator: - * - * The #GUdevEnumerator struct is opaque and should not be accessed directly. - * - * Since: 165 - */ -struct _GUdevEnumerator -{ - GObject parent; - - /*< private >*/ - GUdevEnumeratorPrivate *priv; -}; - -/** - * GUdevEnumeratorClass: - * @parent_class: Parent class. - * - * Class structure for #GUdevEnumerator. - * - * Since: 165 - */ -struct _GUdevEnumeratorClass -{ - GObjectClass parent_class; - - /*< private >*/ - /* Padding for future expansion */ - void (*reserved1) (void); - void (*reserved2) (void); - void (*reserved3) (void); - void (*reserved4) (void); - void (*reserved5) (void); - void (*reserved6) (void); - void (*reserved7) (void); - void (*reserved8) (void); -}; - -GType g_udev_enumerator_get_type (void) G_GNUC_CONST; -GUdevEnumerator *g_udev_enumerator_new (GUdevClient *client); -GUdevEnumerator *g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, - const gchar *subsystem); -GUdevEnumerator *g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, - const gchar *subsystem); -GUdevEnumerator *g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value); -GUdevEnumerator *g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value); -GUdevEnumerator *g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value); -GUdevEnumerator *g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, - const gchar *name); -GUdevEnumerator *g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, - const gchar *tag); -GUdevEnumerator *g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator); -GUdevEnumerator *g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, - const gchar *sysfs_path); -GList *g_udev_enumerator_execute (GUdevEnumerator *enumerator); - -G_END_DECLS - -#endif /* __G_UDEV_ENUMERATOR_H__ */ diff --git a/extras/gudev/gudevenums.h b/extras/gudev/gudevenums.h deleted file mode 100644 index c3a0aa8747..0000000000 --- a/extras/gudev/gudevenums.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_ENUMS_H__ -#define __G_UDEV_ENUMS_H__ - -#include - -G_BEGIN_DECLS - -/** - * GUdevDeviceType: - * @G_UDEV_DEVICE_TYPE_NONE: Device does not have a device file. - * @G_UDEV_DEVICE_TYPE_BLOCK: Device is a block device. - * @G_UDEV_DEVICE_TYPE_CHAR: Device is a character device. - * - * Enumeration used to specify a the type of a device. - */ -typedef enum -{ - G_UDEV_DEVICE_TYPE_NONE = 0, - G_UDEV_DEVICE_TYPE_BLOCK = 'b', - G_UDEV_DEVICE_TYPE_CHAR = 'c', -} GUdevDeviceType; - -G_END_DECLS - -#endif /* __G_UDEV_ENUMS_H__ */ diff --git a/extras/gudev/gudevenumtypes.c.template b/extras/gudev/gudevenumtypes.c.template deleted file mode 100644 index fc30b39e2e..0000000000 --- a/extras/gudev/gudevenumtypes.c.template +++ /dev/null @@ -1,39 +0,0 @@ -/*** BEGIN file-header ***/ -#include - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ -/*** END file-production ***/ - -/*** BEGIN value-header ***/ -GType -@enum_name@_get_type (void) -{ - static volatile gsize g_define_type_id__volatile = 0; - - if (g_once_init_enter (&g_define_type_id__volatile)) - { - static const G@Type@Value values[] = { -/*** END value-header ***/ - -/*** BEGIN value-production ***/ - { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, -/*** END value-production ***/ - -/*** BEGIN value-tail ***/ - { 0, NULL, NULL } - }; - GType g_define_type_id = - g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); - } - - return g_define_type_id__volatile; -} - -/*** END value-tail ***/ - -/*** BEGIN file-tail ***/ -/*** END file-tail ***/ diff --git a/extras/gudev/gudevenumtypes.h.template b/extras/gudev/gudevenumtypes.h.template deleted file mode 100644 index d0ab3393e6..0000000000 --- a/extras/gudev/gudevenumtypes.h.template +++ /dev/null @@ -1,24 +0,0 @@ -/*** BEGIN file-header ***/ -#ifndef __GUDEV_ENUM_TYPES_H__ -#define __GUDEV_ENUM_TYPES_H__ - -#include - -G_BEGIN_DECLS -/*** END file-header ***/ - -/*** BEGIN file-production ***/ - -/* enumerations from "@filename@" */ -/*** END file-production ***/ - -/*** BEGIN value-header ***/ -GType @enum_name@_get_type (void) G_GNUC_CONST; -#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) -/*** END value-header ***/ - -/*** BEGIN file-tail ***/ -G_END_DECLS - -#endif /* __GUDEV_ENUM_TYPES_H__ */ -/*** END file-tail ***/ diff --git a/extras/gudev/gudevmarshal.list b/extras/gudev/gudevmarshal.list deleted file mode 100644 index 7e665999e8..0000000000 --- a/extras/gudev/gudevmarshal.list +++ /dev/null @@ -1 +0,0 @@ -VOID:STRING,OBJECT diff --git a/extras/gudev/gudevprivate.h b/extras/gudev/gudevprivate.h deleted file mode 100644 index 8866f52b88..0000000000 --- a/extras/gudev/gudevprivate.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_PRIVATE_H__ -#define __G_UDEV_PRIVATE_H__ - -#include - -#include - -G_BEGIN_DECLS - -GUdevDevice * -_g_udev_device_new (struct udev_device *udevice); - -struct udev *_g_udev_client_get_udev (GUdevClient *client); - -G_END_DECLS - -#endif /* __G_UDEV_PRIVATE_H__ */ diff --git a/extras/gudev/gudevtypes.h b/extras/gudev/gudevtypes.h deleted file mode 100644 index 888482783d..0000000000 --- a/extras/gudev/gudevtypes.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_TYPES_H__ -#define __G_UDEV_TYPES_H__ - -#include -#include - -G_BEGIN_DECLS - -typedef struct _GUdevClient GUdevClient; -typedef struct _GUdevDevice GUdevDevice; -typedef struct _GUdevEnumerator GUdevEnumerator; - -/** - * GUdevDeviceNumber: - * - * Corresponds to the standard #dev_t type as defined by POSIX (Until - * bug 584517 is resolved this work-around is needed). - */ -#ifdef _GUDEV_WORK_AROUND_DEV_T_BUG -typedef guint64 GUdevDeviceNumber; /* __UQUAD_TYPE */ -#else -typedef dev_t GUdevDeviceNumber; -#endif - -G_END_DECLS - -#endif /* __G_UDEV_TYPES_H__ */ diff --git a/extras/gudev/seed-example-enum.js b/extras/gudev/seed-example-enum.js deleted file mode 100755 index 66206ad806..0000000000 --- a/extras/gudev/seed-example-enum.js +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env seed - -const GLib = imports.gi.GLib; -const GUdev = imports.gi.GUdev; - -function print_device(device) { - print(" initialized: " + device.get_is_initialized()); - print(" usec since initialized: " + device.get_usec_since_initialized()); - print(" subsystem: " + device.get_subsystem()); - print(" devtype: " + device.get_devtype()); - print(" name: " + device.get_name()); - print(" number: " + device.get_number()); - print(" sysfs_path: " + device.get_sysfs_path()); - print(" driver: " + device.get_driver()); - print(" action: " + device.get_action()); - print(" seqnum: " + device.get_seqnum()); - print(" device type: " + device.get_device_type()); - print(" device number: " + device.get_device_number()); - print(" device file: " + device.get_device_file()); - print(" device file symlinks: " + device.get_device_file_symlinks()); - print(" tags: " + device.get_tags()); - var keys = device.get_property_keys(); - for (var n = 0; n < keys.length; n++) { - print(" " + keys[n] + "=" + device.get_property(keys[n])); - } -} - -var client = new GUdev.Client({subsystems: []}); -var enumerator = new GUdev.Enumerator({client: client}); -enumerator.add_match_subsystem('b*') - -var devices = enumerator.execute(); - -for (var n=0; n < devices.length; n++) { - var device = devices[n]; - print_device(device); - print(""); -} diff --git a/extras/gudev/seed-example.js b/extras/gudev/seed-example.js deleted file mode 100755 index e2ac324d23..0000000000 --- a/extras/gudev/seed-example.js +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env seed - -// seed example - -const GLib = imports.gi.GLib; -const GUdev = imports.gi.GUdev; - -function print_device (device) { - print (" subsystem: " + device.get_subsystem ()); - print (" devtype: " + device.get_devtype ()); - print (" name: " + device.get_name ()); - print (" number: " + device.get_number ()); - print (" sysfs_path: " + device.get_sysfs_path ()); - print (" driver: " + device.get_driver ()); - print (" action: " + device.get_action ()); - print (" seqnum: " + device.get_seqnum ()); - print (" device type: " + device.get_device_type ()); - print (" device number: " + device.get_device_number ()); - print (" device file: " + device.get_device_file ()); - print (" device file symlinks: " + device.get_device_file_symlinks ()); - print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); - var keys = device.get_property_keys (); - for (var n = 0; n < keys.length; n++) { - print (" " + keys[n] + "=" + device.get_property (keys[n])); - } -} - -function on_uevent (client, action, device) { - print ("action " + action + " on device " + device.get_sysfs_path()); - print_device (device); - print (""); -} - -var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); -client.signal.connect ("uevent", on_uevent); - -var block_devices = client.query_by_subsystem ("block"); -for (var n = 0; n < block_devices.length; n++) { - print ("block device: " + block_devices[n].get_device_file ()); -} - -var d; - -d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); -if (d == null) { - print ("query_by_device_number 0x810 -> null"); -} else { - print ("query_by_device_number 0x810 -> " + d.get_device_file ()); - dd = d.get_parent_with_subsystem ("usb", null); - print_device (dd); - print ("--------------------------------------------------------------------------"); - while (d != null) { - print_device (d); - print (""); - d = d.get_parent (); - } -} - -d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); -print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); - -d = client.query_by_subsystem_and_name ("block", "sda2"); -print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); - -d = client.query_by_device_file ("/dev/sda"); -print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); - -d = client.query_by_device_file ("/dev/block/8:0"); -print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); - -var mainloop = GLib.main_loop_new (); -GLib.main_loop_run (mainloop); diff --git a/extras/keymap/.gitignore b/extras/keymap/.gitignore deleted file mode 100644 index 01d62e2b6e..0000000000 --- a/extras/keymap/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -keyboard-force-release.sh -keymap -keys-from-name.gperf -keys-from-name.h -keys-to-name.h -keys.txt diff --git a/extras/keymap/95-keyboard-force-release.rules b/extras/keymap/95-keyboard-force-release.rules deleted file mode 100644 index 79a1bc1cc4..0000000000 --- a/extras/keymap/95-keyboard-force-release.rules +++ /dev/null @@ -1,53 +0,0 @@ -# Set model specific atkbd force_release quirk -# -# Several laptops have hotkeys which don't generate release events, -# which can cause problems with software key repeat. -# The atkbd driver has a quirk handler for generating synthetic -# release events, which can be configured via sysfs since 2.6.32. -# Simply add a file with a list of scancodes for your laptop model -# in /usr/lib/udev/keymaps, and add a rule here. -# If the hotkeys also need a keymap assignment you can copy the -# scancodes from the keymap file, otherwise you can run -# /usr/lib/udev/keymap -i /dev/input/eventX -# on a Linux vt to find out. - -ACTION=="remove", GOTO="force_release_end" -SUBSYSTEM!="serio", GOTO="force_release_end" -KERNEL!="serio*", GOTO="force_release_end" -DRIVER!="atkbd", GOTO="force_release_end" - -ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" - -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.sh $devpath samsung-other" - -ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*|Precision M*", RUN+="keyboard-force-release.sh $devpath dell-touchpad" - -ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u|AMILO Xi 2428", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="FOXCONN", ATTR{[dmi/id]product_name}=="QBOOK", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite [uU]300*|Satellite Pro [uU]300*|Satellite [uU]305*|SATELLITE [uU]500*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -# These are all the HP laptops that setup a touchpad toggle key -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keyboard-force-release.sh $devpath hp-other" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keyboard-force-release.sh $devpath hp-other" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keyboard-force-release.sh $devpath hp-other" - -ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote 6615WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="6625WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="HANNspree", ATTR{[dmi/id]product_name}=="SN10E100", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="GIGABYTE", ATTR{[dmi/id]product_name}=="i1520M", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="BenQ", ATTR{[dmi/id]product_name}=="*nScreen*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -LABEL="force_release_end" diff --git a/extras/keymap/95-keymap.rules b/extras/keymap/95-keymap.rules deleted file mode 100644 index 1ec18b7f55..0000000000 --- a/extras/keymap/95-keymap.rules +++ /dev/null @@ -1,164 +0,0 @@ -# Set model specific hotkey keycodes. -# -# Key map overrides can be specified by either giving scancode/keyname pairs -# directly as keymap arguments (if there are just one or two to change), or as -# a file name (in /usr/lib/udev/keymaps), which has to contain scancode/keyname -# pairs. - -ACTION=="remove", GOTO="keyboard_end" -KERNEL!="event*", GOTO="keyboard_end" -ENV{ID_INPUT_KEY}=="", GOTO="keyboard_end" -SUBSYSTEMS=="bluetooth", GOTO="keyboard_end" - -SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" -SUBSYSTEMS=="usb", GOTO="keyboard_usbcheck" -GOTO="keyboard_modulecheck" - -# -# The following are external USB keyboards -# - -LABEL="keyboard_usbcheck" - -ENV{ID_VENDOR}=="Genius", ENV{ID_MODEL_ID}=="0708", ENV{ID_USB_INTERFACE_NUM}=="01", RUN+="keymap $name genius-slimstar-320" -ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" -ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" -# Logitech Cordless Wave Pro looks slightly weird; some hotkeys are coming through the mouse interface -ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c52[9b]", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" - -ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" -ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" - -ENV{ID_VENDOR}=="Microsoft", ENV{ID_MODEL_ID}=="00db", RUN+="keymap $name 0xc022d zoomin 0xc022e zoomout" - -GOTO="keyboard_end" - -# -# The following are exposed as separate input devices with low key codes, thus -# we need to check their input device product name -# - -LABEL="keyboard_modulecheck" - -ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="", GOTO="keyboard_end" - -ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-lenovo" -ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="Lenovo ThinkPad SL Series extra buttons", RUN+="keymap $name 0x0E bluetooth" - -ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" -ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys|Asus Laptop Support|Asus*WMI*", RUN+="keymap $name 0x6B f21" -ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC Hotkey Driver", RUN+="keymap $name 0x37 f21" - -ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" -ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" -ENV{DMI_VENDOR}=="Acer*", KERNELS=="input*", ATTRS{name}=="Acer WMI hotkeys", RUN+="keymap $name 0x82 f21" -ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", KERNELS=="input*", ATTRS{name}=="MSI Laptop hotkeys", RUN+="keymap $name 0x213 f22 0x214 f23" - -# Older Vaios have some different keys -ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" - -# Some Sony VGN models have yet another one -ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="VGN-AR71*|VGN-FW*|VGN-Z21*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-vgn" - - -# -# The following rules belong to standard i8042 AT keyboard with high key codes. -# - -DRIVERS=="atkbd", GOTO="keyboard_vendorcheck" -GOTO="keyboard_end" - -LABEL="keyboard_vendorcheck" - -ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" -ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1010|Inspiron 1011|Inspiron 1012|Inspiron 1110|Inspiron 1210", RUN+="keymap $name 0x84 wlan" -ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Latitude XT2", RUN+="keymap $name dell-latitude-xt2" - -ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" - -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x6_tablet" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X2[02]* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x200_tablet" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" -ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" - -ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keymap $name hewlett-packard-pavilion" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*|*2230s*", RUN+="keymap $name hewlett-packard-compaq_elitebook" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keymap $name hewlett-packard-2510p_2530p" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" -ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" -ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www" -# HP Pavillion dv6315ea has empty DMI_VENDOR -ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play - -# Gateway clone of Acer Aspire One AOA110/AOA150 -ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer" - -ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C3[01]0*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|TravelMate*7720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*4720*", RUN+="keymap $name 0xB2 www 0xEE screenlock" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 8930", RUN+="keymap $name acer-aspire_8930" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_serial}=="ZG8*", RUN+="keymap $name acer-aspire_5720" - -ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" - -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro V3205*", RUN+="keymap $name fujitsu-amilo_pro_v3205" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pa 2548*", RUN+="keymap $name fujitsu-amilo_pa_2548" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V5*", RUN+="keymap $name fujitsu-esprimo_mobile_v5" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V6*", RUN+="keymap $name fujitsu-esprimo_mobile_v6" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro Edition V3505*", RUN+="keymap $name fujitsu-amilo_pro_edition_v3505" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+="keymap $name fujitsu-amilo_si_1520" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="Amilo Li 1718", RUN+="keymap $name 0xD6 wlan" - -ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name lg-x110" - -ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" -ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" - -ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", RUN+="keymap $name micro-star" - -# some MSI models generate ACPI/input events on the LNXVIDEO input devices, -# plus some extra synthesized ones on atkbd as an echo of actually changing the -# brightness; so ignore those atkbd ones, to avoid loops -ENV{DMI_VENDOR}=="MICRO-STAR*", ATTR{[dmi/id]product_name}=="*U-100*|*U100*|*N033", RUN+="keymap $name 0xF7 reserved 0xF8 reserved" - -ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" - -ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" - -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-other" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" - -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite M30X", RUN+="keymap $name toshiba-satellite_m30x" - -ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" - -ENV{DMI_VENDOR}=="ONKYO CORPORATION", ATTR{[dmi/id]product_name}=="ONKYOPC", RUN+="keymap $name onkyo" - -ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" - -ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name 0x81 prog1" - -ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="62*|63*", RUN+="keymap $name zepto-znote" - -ENV{DMI_VENDOR}=="Everex", ATTR{[dmi/id]product_name}=="XT5000*", RUN+="keymap $name everex-xt5000" - -ENV{DMI_VENDOR}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name 0x84 wlan" - -ENV{DMI_VENDOR}=="OLPC", ATTR{[dmi/id]product_name}=="XO", RUN+="keymap $name olpc-xo" - -LABEL="keyboard_end" diff --git a/extras/keymap/README.keymap.txt b/extras/keymap/README.keymap.txt deleted file mode 100644 index acdc00283a..0000000000 --- a/extras/keymap/README.keymap.txt +++ /dev/null @@ -1,101 +0,0 @@ -= The udev keymap tool = - -== Introduction == - -This udev extension configures computer model specific key mappings. This is -particularly necessary for the non-standard extra keys found on many laptops, -such as "brightness up", "next song", "www browser", or "suspend". Often these -are accessed with the Fn key. - -Every key produces a "scan code", which is highly vendor/model specific for the -nonstandard keys. This tool maintains mappings for these scan codes to standard -"key codes", which denote the "meaning" of the key. The key codes are defined -in /usr/include/linux/input.h. - -If some of your keys on your keyboard are not working at all, or produce the -wrong effect, then a very likely cause of this is that the scan code -> key -code mapping is incorrect on your computer. - -== Structure == - -udev-keymap consists of the following parts: - - keymaps/*:: mappings of scan codes to key code names - - 95-keymap.rules:: udev rules for mapping system vendor/product names and - input module names to one of the keymaps above - - keymap:: manipulate an evdev input device: - * write a key map file into a device (used by udev rules) - * dump current scan → key code mapping - * interactively display scan and key codes of pressed keys - - findkeyboards:: display evdev input devices which belong to actual keyboards, - i. e. those suitable for the keymap program - - fdi2rules.py:: convert hal keymap FDIs into udev rules and key map files - (Please note that this is far from perfect, since the mapping between fdi and - udev rules is not straightforward, and impossible in some cases.) - -== Fixing broken keys == - -In order to make a broken key work on your system and send it back to upstream -for inclusion you need to do the following steps: - - 1. Find the keyboard device. - - Run /usr/lib/udev/findkeyboards. This should always give you an "AT - keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and - Acers) have multimedia/function keys on a separate input device instead of the - primary keyboard. The keyboard device should have a name like "input/event3". - In the following commands, the name will be written as "input/eventX" (replace - X with the appropriate number). - - 2. Find broken scan codes: - - sudo /usr/lib/udev/keymap -i input/eventX - - Press all multimedia/function keys and check if the key name that gets printed - out is plausible. If it is unknown or wrong, write down the scan code (looks - like "0x1E") and the intended functionality of this key. Look in - /usr/include/linux/input.h for an available KEY_XXXXX constant which most - closely approximates this functionality and write it down as the new key code. - - For example, you might press a key labeled "web browser" which currently - produces "unknown". Note down this: - - 0x1E www # Fn+F2 web browser - - Repeat that for all other keys. Write the resulting list into a file. Look at - /usr/lib/udev/keymaps/ for existing key map files and make sure that you use the - same structure. - - If the key only ever works once and then your keyboard (or the entire desktop) - gets stuck for a long time, then it is likely that the BIOS fails to send a - corresponding "key release" event after the key press event. Please note down - this case as well, as it can be worked around in - /usr/lib/udev/keymaps/95-keyboard-force-release.rules . - - 3. Find out your system vendor and product: - - cat /sys/class/dmi/id/sys_vendor - cat /sys/class/dmi/id/product_name - - 4. Generate a device dump with "udevadm info --export-db > /tmp/udev-db.txt". - - 6. Send the system vendor/product names, the key mapping from step 2, - and /tmp/udev-db.txt from step 4 to the linux-hotplug@vger.kernel.org mailing - list, so that they can be included in the next release. - -For local testing, copy your map file to /usr/lib/udev/keymaps/ with an appropriate -name, and add an appropriate udev rule to /usr/lib/udev/rules.d/95-keymap.rules: - - * If you selected an "AT keyboard", add the rule to the section after - 'LABEL="keyboard_vendorcheck"'. - - * If you selected a "module", add the rule to the top section where the - "ThinkPad Extra Buttons" are. - -== Author == - -keymap is written and maintained by Martin Pitt . diff --git a/extras/keymap/check-keymaps.sh b/extras/keymap/check-keymaps.sh deleted file mode 100755 index 350a857171..0000000000 --- a/extras/keymap/check-keymaps.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -# check that all key names in keymaps/* are known in -# and that all key maps listed in the rules are valid and present in -# Makefile.am -SRCDIR=${1:-.} -KEYLIST=${2:-extras/keymap/keys.txt} -KEYMAPS_DIR=$SRCDIR/extras/keymap/keymaps #extras/keymap/keymaps -RULES=$SRCDIR/extras/keymap/95-keymap.rules - -[ -e "$KEYLIST" ] || { - echo "need $KEYLIST please build first" >&2 - exit 1 -} - -missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) \ - <(grep -hv '^#' ${KEYMAPS_DIR}/*| awk '{print $2}' | sort -u)) -[ -z "$missing" ] || { - echo "ERROR: unknown key names in extras/keymap/keymaps/*:" >&2 - echo "$missing" >&2 - exit 1 -} - -# check that all maps referred to in $RULES exist -maps=$(sed -rn '/keymap \$name/ { s/^.*\$name ([^"[:space:]]+).*$/\1/; p }' $RULES) -for m in $maps; do - # ignore inline mappings - [ "$m" = "${m#0x}" ] || continue - - [ -e ${KEYMAPS_DIR}/$m ] || { - echo "ERROR: unknown map name in $RULES: $m" >&2 - exit 1 - } - grep -q "extras/keymap/keymaps/$m\>" $SRCDIR/Makefile.am || { - echo "ERROR: map file $m is not added to Makefile.am" >&2 - exit 1 - } -done diff --git a/extras/keymap/findkeyboards b/extras/keymap/findkeyboards deleted file mode 100755 index eba3737a96..0000000000 --- a/extras/keymap/findkeyboards +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env sh -# Find "real" keyboard devices and print their device path. -# Author: Martin Pitt -# -# Copyright (C) 2009, Canonical Ltd. -# -# 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; either version 2 of the License, or -# (at your option) any later version. -# -# 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. - -set -e - -# returns OK if $1 contains $2 -strstr() { - [ "${1#*$2*}" != "$1" ] -} - -# returns OK if $1 contains $2 at the beginning -str_starts() { - [ "${1#$2*}" != "$1" ] -} - -str_line_starts() { - while read a; do str_starts "$a" "$1" && return 0;done - return 1; -} - -# print a list of input devices which are keyboard-like -keyboard_devices() { - # standard AT keyboard - for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do - walk=`udevadm info --attribute-walk --path=$dev` - env=`udevadm info --query=env --path=$dev` - # filter out non-event devices, such as the parent input devices which - # have no devnode - if ! echo "$env" | str_line_starts 'DEVNAME='; then - continue - fi - if strstr "$walk" 'DRIVERS=="atkbd"'; then - echo -n 'AT keyboard: ' - elif echo "$env" | str_line_starts 'ID_USB_DRIVER=usbhid'; then - echo -n 'USB keyboard: ' - else - echo -n 'Unknown type: ' - fi - udevadm info --query=name --path=$dev - done - - # modules - module=$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons') - module="$module -$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons')" - module="$module -$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys')" - for m in $module; do - for evdev in $m/event*/dev; do - if [ -e "$evdev" ]; then - echo -n 'module: ' - udevadm info --query=name --path=${evdev%%/dev} - fi - done - done -} - -keyboard_devices diff --git a/extras/keymap/force-release-maps/common-volume-keys b/extras/keymap/force-release-maps/common-volume-keys deleted file mode 100644 index 3a7654d735..0000000000 --- a/extras/keymap/force-release-maps/common-volume-keys +++ /dev/null @@ -1,3 +0,0 @@ -0xa0 #mute -0xae #volume down -0xb0 #volume up diff --git a/extras/keymap/force-release-maps/dell-touchpad b/extras/keymap/force-release-maps/dell-touchpad deleted file mode 100644 index 18e9bdee66..0000000000 --- a/extras/keymap/force-release-maps/dell-touchpad +++ /dev/null @@ -1 +0,0 @@ -0x9E diff --git a/extras/keymap/force-release-maps/hp-other b/extras/keymap/force-release-maps/hp-other deleted file mode 100644 index 6621370095..0000000000 --- a/extras/keymap/force-release-maps/hp-other +++ /dev/null @@ -1,3 +0,0 @@ -# list of scancodes (hex or decimal), optional comment -0xd8 # Touchpad off -0xd9 # Touchpad on diff --git a/extras/keymap/force-release-maps/samsung-other b/extras/keymap/force-release-maps/samsung-other deleted file mode 100644 index c51123a0b6..0000000000 --- a/extras/keymap/force-release-maps/samsung-other +++ /dev/null @@ -1,10 +0,0 @@ -# list of scancodes (hex or decimal), optional comment -0x82 # Fn+F4 CRT/LCD -0x83 # Fn+F2 battery -0x84 # Fn+F5 backlight on/off -0x86 # Fn+F9 WLAN -0x88 # Fn-Up brightness up -0x89 # Fn-Down brightness down -0xB3 # Fn+F8 switch power mode (battery/dynamic/performance) -0xF7 # Fn+F10 Touchpad on -0xF9 # Fn+F10 Touchpad off diff --git a/extras/keymap/keyboard-force-release.sh.in b/extras/keymap/keyboard-force-release.sh.in deleted file mode 100755 index 154be3d733..0000000000 --- a/extras/keymap/keyboard-force-release.sh.in +++ /dev/null @@ -1,22 +0,0 @@ -#!@rootprefix@/bin/sh -e -# read list of scancodes, convert hex to decimal and -# append to the atkbd force_release sysfs attribute -# $1 sysfs devpath for serioX -# $2 file with scancode list (hex or dec) - -case "$2" in - /*) scf="$2" ;; - *) scf="@pkglibexecdir@/keymaps/force-release/$2" ;; -esac - -read attr <"/sys/$1/force_release" -while read scancode dummy; do - case "$scancode" in - \#*) ;; - *) - scancode=$(($scancode)) - attr="$attr${attr:+,}$scancode" - ;; - esac -done <"$scf" -echo "$attr" >"/sys/$1/force_release" diff --git a/extras/keymap/keymap.c b/extras/keymap/keymap.c deleted file mode 100644 index 79fd0599a9..0000000000 --- a/extras/keymap/keymap.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * keymap - dump keymap of an evdev device or set a new keymap from a file - * - * Based on keyfuzz by Lennart Poettering - * Adapted for udev-extras by Martin Pitt - * - * Copyright (C) 2006, Lennart Poettering - * Copyright (C) 2009, Canonical Ltd. - * - * keymap 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; either version 2 of the License, or - * (at your option) any later version. - * - * keymap 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 keymap; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -const struct key* lookup_key (const char *str, unsigned int len); - -#include "keys-from-name.h" -#include "keys-to-name.h" - -#define MAX_SCANCODES 1024 - -static int evdev_open(const char *dev) -{ - int fd; - char fn[PATH_MAX]; - - if (strncmp(dev, "/dev", 4) != 0) { - snprintf(fn, sizeof(fn), "/dev/%s", dev); - dev = fn; - } - - if ((fd = open(dev, O_RDWR)) < 0) { - fprintf(stderr, "error open('%s'): %m\n", dev); - return -1; - } - return fd; -} - -static int evdev_get_keycode(int fd, int scancode, int e) -{ - int codes[2]; - - codes[0] = scancode; - if (ioctl(fd, EVIOCGKEYCODE, codes) < 0) { - if (e && errno == EINVAL) { - return -2; - } else { - fprintf(stderr, "EVIOCGKEYCODE: %m\n"); - return -1; - } - } - return codes[1]; -} - -static int evdev_set_keycode(int fd, int scancode, int keycode) -{ - int codes[2]; - - codes[0] = scancode; - codes[1] = keycode; - - if (ioctl(fd, EVIOCSKEYCODE, codes) < 0) { - fprintf(stderr, "EVIOCSKEYCODE: %m\n"); - return -1; - } - return 0; -} - -static int evdev_driver_version(int fd, char *v, size_t l) -{ - int version; - - if (ioctl(fd, EVIOCGVERSION, &version)) { - fprintf(stderr, "EVIOCGVERSION: %m\n"); - return -1; - } - - snprintf(v, l, "%i.%i.%i.", version >> 16, (version >> 8) & 0xff, version & 0xff); - return 0; -} - -static int evdev_device_name(int fd, char *n, size_t l) -{ - if (ioctl(fd, EVIOCGNAME(l), n) < 0) { - fprintf(stderr, "EVIOCGNAME: %m\n"); - return -1; - } - return 0; -} - -/* Return a lower-case string with KEY_ prefix removed */ -static const char* format_keyname(const char* key) { - static char result[101]; - const char* s; - int len; - - for (s = key+4, len = 0; *s && len < 100; ++len, ++s) - result[len] = tolower(*s); - result[len] = '\0'; - return result; -} - -static int dump_table(int fd) { - char version[256], name[256]; - int scancode, r = -1; - - if (evdev_driver_version(fd, version, sizeof(version)) < 0) - goto fail; - - if (evdev_device_name(fd, name, sizeof(name)) < 0) - goto fail; - - printf("### evdev %s, driver '%s'\n", version, name); - - r = 0; - for (scancode = 0; scancode < MAX_SCANCODES; scancode++) { - int keycode; - - if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { - if (keycode == -2) - continue; - r = -1; - break; - } - - if (keycode < KEY_MAX && key_names[keycode]) - printf("0x%03x %s\n", scancode, format_keyname(key_names[keycode])); - else - printf("0x%03x 0x%03x\n", scancode, keycode); - } -fail: - return r; -} - -static void set_key(int fd, const char* scancode_str, const char* keyname) -{ - unsigned scancode; - char *endptr; - char t[105] = "KEY_UNKNOWN"; - const struct key *k; - - scancode = (unsigned) strtol(scancode_str, &endptr, 0); - if (*endptr != '\0') { - fprintf(stderr, "ERROR: Invalid scancode\n"); - exit(1); - } - - snprintf(t, sizeof(t), "KEY_%s", keyname); - - if (!(k = lookup_key(t, strlen(t)))) { - fprintf(stderr, "ERROR: Unknown key name '%s'\n", keyname); - exit(1); - } - - if (evdev_set_keycode(fd, scancode, k->id) < 0) - fprintf(stderr, "setting scancode 0x%2X to key code %i failed\n", - scancode, k->id); - else - printf("setting scancode 0x%2X to key code %i\n", - scancode, k->id); -} - -static int merge_table(int fd, FILE *f) { - int r = 0; - int line = 0; - - while (!feof(f)) { - char s[256], *p; - int scancode, new_keycode, old_keycode; - - if (!fgets(s, sizeof(s), f)) - break; - - line++; - p = s+strspn(s, "\t "); - if (*p == '#' || *p == '\n') - continue; - - if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) { - char t[105] = "KEY_UNKNOWN"; - const struct key *k; - - if (sscanf(p, "%i %100s", &scancode, t+4) != 2) { - fprintf(stderr, "WARNING: Parse failure at line %i, ignoring.\n", line); - r = -1; - continue; - } - - if (!(k = lookup_key(t, strlen(t)))) { - fprintf(stderr, "WARNING: Unknown key '%s' at line %i, ignoring.\n", t, line); - r = -1; - continue; - } - - new_keycode = k->id; - } - - - if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0) { - r = -1; - goto fail; - } - - if (evdev_set_keycode(fd, scancode, new_keycode) < 0) { - r = -1; - goto fail; - } - - if (new_keycode != old_keycode) - fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x (prior: 0x%02x)\n", - scancode, new_keycode, old_keycode); - } -fail: - fclose(f); - return r; -} - - -/* read one event; return 1 if valid */ -static int read_event(int fd, struct input_event* ev) -{ - int ret; - ret = read(fd, ev, sizeof(struct input_event)); - - if (ret < 0) { - perror("read"); - return 0; - } - if (ret != sizeof(struct input_event)) { - fprintf(stderr, "did not get enough data for event struct, aborting\n"); - return 0; - } - - return 1; -} - -static void print_key(uint32_t scancode, uint16_t keycode, int has_scan, int has_key) -{ - const char *keyname; - - /* ignore key release events */ - if (has_key == 1) - return; - - if (has_key == 0 && has_scan != 0) { - fprintf(stderr, "got scan code event 0x%02X without a key code event\n", - scancode); - return; - } - - if (has_scan != 0) - printf("scan code: 0x%02X ", scancode); - else - printf("(no scan code received) "); - - keyname = key_names[keycode]; - if (keyname != NULL) - printf("key code: %s\n", format_keyname(keyname)); - else - printf("key code: %03X\n", keycode); -} - -static void interactive(int fd) -{ - struct input_event ev; - uint32_t last_scan = 0; - uint16_t last_key = 0; - int has_scan; /* boolean */ - int has_key; /* 0: none, 1: release, 2: press */ - - /* grab input device */ - ioctl(fd, EVIOCGRAB, 1); - puts("Press ESC to finish, or Control-C if this device is not your primary keyboard"); - - has_scan = has_key = 0; - while (read_event(fd, &ev)) { - /* Drivers usually send the scan code first, then the key code, - * then a SYN. Some drivers (like thinkpad_acpi) send the key - * code first, and some drivers might not send SYN events, so - * keep a robust state machine which can deal with any of those - */ - - if (ev.type == EV_MSC && ev.code == MSC_SCAN) { - if (has_scan) { - fputs("driver did not send SYN event in between key events; previous event:\n", - stderr); - print_key(last_scan, last_key, has_scan, has_key); - has_key = 0; - } - - last_scan = ev.value; - has_scan = 1; - /*printf("--- got scan %u; has scan %i key %i\n", last_scan, has_scan, has_key); */ - } - else if (ev.type == EV_KEY) { - if (has_key) { - fputs("driver did not send SYN event in between key events; previous event:\n", - stderr); - print_key(last_scan, last_key, has_scan, has_key); - has_scan = 0; - } - - last_key = ev.code; - has_key = 1 + ev.value; - /*printf("--- got key %hu; has scan %i key %i\n", last_key, has_scan, has_key);*/ - - /* Stop on ESC */ - if (ev.code == KEY_ESC && ev.value == 0) - break; - } - else if (ev.type == EV_SYN) { - /*printf("--- got SYN; has scan %i key %i\n", has_scan, has_key);*/ - print_key(last_scan, last_key, has_scan, has_key); - - has_scan = has_key = 0; - } - - } - - /* release input device */ - ioctl(fd, EVIOCGRAB, 0); -} - -static void help(int error) -{ - const char* h = "Usage: keymap []\n" - " keymap scancode keyname [...]\n" - " keymap -i \n"; - if (error) { - fputs(h, stderr); - exit(2); - } else { - fputs(h, stdout); - exit(0); - } -} - -int main(int argc, char **argv) -{ - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - { "interactive", no_argument, NULL, 'i' }, - {} - }; - int fd = -1; - int opt_interactive = 0; - int i; - - while (1) { - int option; - - option = getopt_long(argc, argv, "hi", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'h': - help(0); - - case 'i': - opt_interactive = 1; - break; - default: - return 1; - } - } - - if (argc < optind+1) - help (1); - - if ((fd = evdev_open(argv[optind])) < 0) - return 3; - - /* one argument (device): dump or interactive */ - if (argc == optind+1) { - if (opt_interactive) - interactive(fd); - else - dump_table(fd); - return 0; - } - - /* two arguments (device, mapfile): set map file */ - if (argc == optind+2) { - const char *filearg = argv[optind+1]; - if (strchr(filearg, '/')) { - /* Keymap file argument is a path */ - FILE *f = fopen(filearg, "r"); - if (f) - merge_table(fd, f); - else - perror(filearg); - } else { - /* Keymap file argument is a filename */ - /* Open override file if present, otherwise default file */ - char keymap_path[PATH_MAX]; - snprintf(keymap_path, sizeof(keymap_path), "%s%s", SYSCONFDIR "/udev/keymaps/", filearg); - FILE *f = fopen(keymap_path, "r"); - if (f) { - merge_table(fd, f); - } else { - snprintf(keymap_path, sizeof(keymap_path), "%s%s", PKGLIBEXECDIR "/keymaps/", filearg); - f = fopen(keymap_path, "r"); - if (f) - merge_table(fd, f); - else - perror(keymap_path); - } - } - return 0; - } - - /* more arguments (device, scancode/keyname pairs): set keys directly */ - if ((argc - optind - 1) % 2 == 0) { - for (i = optind+1; i < argc; i += 2) - set_key(fd, argv[i], argv[i+1]); - return 0; - } - - /* invalid number of arguments */ - help(1); - return 1; /* not reached */ -} diff --git a/extras/keymap/keymaps/acer b/extras/keymap/keymaps/acer deleted file mode 100644 index 4e7c297dea..0000000000 --- a/extras/keymap/keymaps/acer +++ /dev/null @@ -1,22 +0,0 @@ -0xA5 help # Fn+F1 -0xA6 setup # Fn+F2 Acer eSettings -0xA7 battery # Fn+F3 Power Management -0xA9 switchvideomode # Fn+F5 -0xB3 euro -0xB4 dollar -0xCE brightnessup # Fn+Right -0xD4 bluetooth # (toggle) off-to-on -0xD5 wlan # (toggle) on-to-off -0xD6 wlan # (toggle) off-to-on -0xD7 bluetooth # (toggle) on-to-off -0xD8 bluetooth # (toggle) off-to-on -0xD9 brightnessup # Fn+Right -0xEE brightnessup # Fn+Right -0xEF brightnessdown # Fn+Left -0xF1 f22 # Fn+F7 Touchpad toggle (off-to-on) -0xF2 f23 # Fn+F7 Touchpad toggle (on-to-off) -0xF3 prog2 # "P2" programmable button -0xF4 prog1 # "P1" programmable button -0xF5 presentation -0xF8 fn -0xF9 f23 # Launch NTI shadow diff --git a/extras/keymap/keymaps/acer-aspire_5720 b/extras/keymap/keymaps/acer-aspire_5720 deleted file mode 100644 index b3515b772f..0000000000 --- a/extras/keymap/keymaps/acer-aspire_5720 +++ /dev/null @@ -1,5 +0,0 @@ -0x84 bluetooth # sent when bluetooth module missing, and key pressed -0x92 media # acer arcade -0xD4 bluetooth # bluetooth on -0xD9 bluetooth # bluetooth off - diff --git a/extras/keymap/keymaps/acer-aspire_5920g b/extras/keymap/keymaps/acer-aspire_5920g deleted file mode 100644 index 633c4e854c..0000000000 --- a/extras/keymap/keymaps/acer-aspire_5920g +++ /dev/null @@ -1,5 +0,0 @@ -0x8A media -0x92 media -0xA6 setup -0xB2 www -0xD9 bluetooth # (toggle) on-to-off diff --git a/extras/keymap/keymaps/acer-aspire_6920 b/extras/keymap/keymaps/acer-aspire_6920 deleted file mode 100644 index 699c954b4e..0000000000 --- a/extras/keymap/keymaps/acer-aspire_6920 +++ /dev/null @@ -1,5 +0,0 @@ -0xD9 bluetooth # (toggle) on-to-off -0x92 media -0x9E back -0x83 rewind -0x89 fastforward diff --git a/extras/keymap/keymaps/acer-aspire_8930 b/extras/keymap/keymaps/acer-aspire_8930 deleted file mode 100644 index ffe9f372f7..0000000000 --- a/extras/keymap/keymaps/acer-aspire_8930 +++ /dev/null @@ -1,6 +0,0 @@ -0xCA prog3 # key 'HOLD' on cine dash media console -0x83 rewind -0x89 fastforward -0x92 media # key 'ARCADE' on cine dash media console -0x9E back - diff --git a/extras/keymap/keymaps/acer-travelmate_c300 b/extras/keymap/keymaps/acer-travelmate_c300 deleted file mode 100644 index bfef4cf868..0000000000 --- a/extras/keymap/keymaps/acer-travelmate_c300 +++ /dev/null @@ -1,5 +0,0 @@ -0x67 f24 # FIXME: rotate screen -0x68 up -0x69 down -0x6B fn -0x6C screenlock # FIXME: lock tablet device/buttons diff --git a/extras/keymap/keymaps/asus b/extras/keymap/keymaps/asus deleted file mode 100644 index 2a5995f982..0000000000 --- a/extras/keymap/keymaps/asus +++ /dev/null @@ -1,3 +0,0 @@ -0xED volumeup -0xEE volumedown -0xEF mute diff --git a/extras/keymap/keymaps/compaq-e_evo b/extras/keymap/keymaps/compaq-e_evo deleted file mode 100644 index 5fbc573aa4..0000000000 --- a/extras/keymap/keymaps/compaq-e_evo +++ /dev/null @@ -1,4 +0,0 @@ -0xA3 www # I key -0x9A search -0x9E email -0x9F homepage diff --git a/extras/keymap/keymaps/dell b/extras/keymap/keymaps/dell deleted file mode 100644 index 4f907b3eef..0000000000 --- a/extras/keymap/keymaps/dell +++ /dev/null @@ -1,29 +0,0 @@ -0x81 playpause # Play/Pause -0x82 stopcd # Stop -0x83 previoussong # Previous song -0x84 nextsong # Next song -0x85 brightnessdown # Fn+Down arrow Brightness Down -0x86 brightnessup # Fn+Up arrow Brightness Up -0x87 battery # Fn+F3 battery icon -0x88 unknown # Fn+F2 Turn On/Off Wireless - handled in hardware -0x89 ejectclosecd # Fn+F10 Eject CD -0x8A suspend # Fn+F1 hibernate -0x8B switchvideomode # Fn+F8 CRT/LCD (high keycode: "displaytoggle") -0x8C f23 # Fn+Right arrow Auto Brightness -0x8F switchvideomode # Fn+F7 aspect ratio -0x90 previoussong # Front panel previous song -0x91 prog1 # Wifi Catcher (DELL Specific) -0x92 media # MediaDirect button (house icon) -0x93 f23 # FIXME Fn+Left arrow Auto Brightness -0x95 camera # Shutter button Takes a picture if optional camera available -0x97 email # Tablet email button -0x98 f21 # FIXME: Tablet screen rotatation -0x99 nextsong # Front panel next song -0x9A setup # Tablet tools button -0x9B switchvideomode # Display Toggle button -0x9E f21 #touchpad toggle -0xA2 playpause # Front panel play/pause -0xA4 stopcd # Front panel stop -0xED media # MediaDirect button -0xD8 screenlock # FIXME: Tablet lock button -0xD9 f21 # touchpad toggle diff --git a/extras/keymap/keymaps/dell-latitude-xt2 b/extras/keymap/keymaps/dell-latitude-xt2 deleted file mode 100644 index 39872f559d..0000000000 --- a/extras/keymap/keymaps/dell-latitude-xt2 +++ /dev/null @@ -1,4 +0,0 @@ -0x9B up # tablet rocker up -0x9E enter # tablet rocker press -0x9F back # tablet back -0xA3 down # tablet rocker down diff --git a/extras/keymap/keymaps/everex-xt5000 b/extras/keymap/keymaps/everex-xt5000 deleted file mode 100644 index 4823a832f5..0000000000 --- a/extras/keymap/keymaps/everex-xt5000 +++ /dev/null @@ -1,7 +0,0 @@ -0x5C media -0x65 f21 # Fn+F5 Touchpad toggle -0x67 prog3 # Fan Speed Control button -0x6F brightnessup -0x7F brightnessdown -0xB2 www -0xEC mail diff --git a/extras/keymap/keymaps/fujitsu-amilo_pa_2548 b/extras/keymap/keymaps/fujitsu-amilo_pa_2548 deleted file mode 100644 index f7b0c52444..0000000000 --- a/extras/keymap/keymaps/fujitsu-amilo_pa_2548 +++ /dev/null @@ -1,3 +0,0 @@ -0xE0 volumedown -0xE1 volumeup -0xE5 prog1 diff --git a/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 b/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 deleted file mode 100644 index d2e38cbb23..0000000000 --- a/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 +++ /dev/null @@ -1,4 +0,0 @@ -0xA5 help # Fn-F1 -0xA9 switchvideomode # Fn-F3 -0xD9 brightnessdown # Fn-F8 -0xE0 brightnessup # Fn-F9 diff --git a/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 b/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 deleted file mode 100644 index 43e3199d59..0000000000 --- a/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 +++ /dev/null @@ -1,2 +0,0 @@ -0xF4 f21 # FIXME: silent-mode decrease CPU/GPU clock -0xF7 switchvideomode # Fn+F3 diff --git a/extras/keymap/keymaps/fujitsu-amilo_si_1520 b/extras/keymap/keymaps/fujitsu-amilo_si_1520 deleted file mode 100644 index 1419bd9b5e..0000000000 --- a/extras/keymap/keymaps/fujitsu-amilo_si_1520 +++ /dev/null @@ -1,6 +0,0 @@ -0xE1 wlan -0xF3 wlan -0xEE brightnessdown -0xE0 brightnessup -0xE2 bluetooth -0xF7 video diff --git a/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 b/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 deleted file mode 100644 index d3d056b366..0000000000 --- a/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 +++ /dev/null @@ -1,4 +0,0 @@ -0xA9 switchvideomode -0xD9 brightnessdown -0xDF sleep -0xEF brightnessup diff --git a/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 b/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 deleted file mode 100644 index 52c70c50cb..0000000000 --- a/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 +++ /dev/null @@ -1,2 +0,0 @@ -0xCE brightnessup -0xEF brightnessdown diff --git a/extras/keymap/keymaps/genius-slimstar-320 b/extras/keymap/keymaps/genius-slimstar-320 deleted file mode 100644 index d0a3656dd8..0000000000 --- a/extras/keymap/keymaps/genius-slimstar-320 +++ /dev/null @@ -1,35 +0,0 @@ -# Genius SlimStar 320 -# -# Only buttons which are not properly mapped yet are configured below - -# "Scroll wheel", a circular up/down/left/right button. Aimed for scolling, -# but since there are no scrollleft/scrollright, let's map to back/forward. -0x900f0 scrollup -0x900f1 scrolldown -0x900f3 back -0x900f2 forward - -# Multimedia buttons, left side (from left to right) -# [W] -0x900f5 wordprocessor -# [Ex] -0x900f6 spreadsheet -# [P] -0x900f4 presentation -# Other five (calculator, playpause, stop, mute and eject) are OK - -# Right side, from left to right -# [e] -0xc0223 www -# "man" -0x900f7 chat -# "Y" -0x900fb prog1 -# [X] -0x900f8 close -# "picture" -0x900f9 graphicseditor -# "two windows" -0x900fd scale -# "lock" -0x900fc screenlock diff --git a/extras/keymap/keymaps/hewlett-packard b/extras/keymap/keymaps/hewlett-packard deleted file mode 100644 index 4461fa2ce5..0000000000 --- a/extras/keymap/keymaps/hewlett-packard +++ /dev/null @@ -1,12 +0,0 @@ -0x81 fn_esc -0x89 battery # FnF8 -0x8A screenlock # FnF6 -0x8B camera -0x8C media # music -0x8E dvd -0xB1 help -0xB3 f23 # FIXME: Auto brightness -0xD7 wlan -0x92 brightnessdown # FnF7 (FnF9 on 6730b) -0x97 brightnessup # FnF8 (FnF10 on 6730b) -0xEE switchvideomode # FnF4 diff --git a/extras/keymap/keymaps/hewlett-packard-2510p_2530p b/extras/keymap/keymaps/hewlett-packard-2510p_2530p deleted file mode 100644 index 41ad2e9b5a..0000000000 --- a/extras/keymap/keymaps/hewlett-packard-2510p_2530p +++ /dev/null @@ -1,2 +0,0 @@ -0xD8 f23 # touchpad off -0xD9 f22 # touchpad on diff --git a/extras/keymap/keymaps/hewlett-packard-compaq_elitebook b/extras/keymap/keymaps/hewlett-packard-compaq_elitebook deleted file mode 100644 index 42007c5483..0000000000 --- a/extras/keymap/keymaps/hewlett-packard-compaq_elitebook +++ /dev/null @@ -1,2 +0,0 @@ -0x88 presentation -0xD9 help # I key (high keycode: "info") diff --git a/extras/keymap/keymaps/hewlett-packard-pavilion b/extras/keymap/keymaps/hewlett-packard-pavilion deleted file mode 100644 index 3d3cefc8e6..0000000000 --- a/extras/keymap/keymaps/hewlett-packard-pavilion +++ /dev/null @@ -1,3 +0,0 @@ -0x88 media # FIXME: quick play -0xD8 f23 # touchpad off -0xD9 f22 # touchpad on diff --git a/extras/keymap/keymaps/hewlett-packard-presario-2100 b/extras/keymap/keymaps/hewlett-packard-presario-2100 deleted file mode 100644 index 1df39dcbd2..0000000000 --- a/extras/keymap/keymaps/hewlett-packard-presario-2100 +++ /dev/null @@ -1,3 +0,0 @@ -0xF0 help -0xF1 screenlock -0xF3 search diff --git a/extras/keymap/keymaps/hewlett-packard-tablet b/extras/keymap/keymaps/hewlett-packard-tablet deleted file mode 100644 index d19005ab90..0000000000 --- a/extras/keymap/keymaps/hewlett-packard-tablet +++ /dev/null @@ -1,6 +0,0 @@ -0x82 prog2 # Funny Key -0x83 prog1 # Q -0x84 tab -0x85 esc -0x86 pageup -0x87 pagedown diff --git a/extras/keymap/keymaps/hewlett-packard-tx2 b/extras/keymap/keymaps/hewlett-packard-tx2 deleted file mode 100644 index 36a690fcf6..0000000000 --- a/extras/keymap/keymaps/hewlett-packard-tx2 +++ /dev/null @@ -1,3 +0,0 @@ -0xC2 media -0xD8 f23 # Toggle touchpad button on tx2 (OFF) -0xD9 f22 # Toggle touchpad button on tx2 (ON) diff --git a/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint b/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint deleted file mode 100644 index 027e50bf88..0000000000 --- a/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint +++ /dev/null @@ -1,7 +0,0 @@ -0x900f0 screenlock -0x900f1 wlan -0x900f2 switchvideomode -0x900f3 suspend -0x900f4 brightnessup -0x900f5 brightnessdown -0x900f8 zoom diff --git a/extras/keymap/keymaps/inventec-symphony_6.0_7.0 b/extras/keymap/keymaps/inventec-symphony_6.0_7.0 deleted file mode 100644 index 4a8b4ba5a7..0000000000 --- a/extras/keymap/keymaps/inventec-symphony_6.0_7.0 +++ /dev/null @@ -1,2 +0,0 @@ -0xF3 prog2 -0xF4 prog1 diff --git a/extras/keymap/keymaps/lenovo-3000 b/extras/keymap/keymaps/lenovo-3000 deleted file mode 100644 index 5bd165654a..0000000000 --- a/extras/keymap/keymaps/lenovo-3000 +++ /dev/null @@ -1,5 +0,0 @@ -0x8B switchvideomode # Fn+F7 video -0x96 wlan # Fn+F5 wireless -0x97 sleep # Fn+F4 suspend -0x98 suspend # Fn+F12 hibernate -0xB4 prog1 # Lenovo Care diff --git a/extras/keymap/keymaps/lenovo-ideapad b/extras/keymap/keymaps/lenovo-ideapad deleted file mode 100644 index d5f25671a5..0000000000 --- a/extras/keymap/keymaps/lenovo-ideapad +++ /dev/null @@ -1,7 +0,0 @@ -# Key codes observed on S10-3, assumed valid on other IdeaPad models -0x81 rfkill # does nothing in BIOS -0x83 display_off # BIOS toggles screen state -0xB9 brightnessup # does nothing in BIOS -0xBA brightnessdown # does nothing in BIOS -0xF1 camera # BIOS toggles camera power -0xf2 unknown # trackpad enable/disable (does nothing in BIOS) diff --git a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint b/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint deleted file mode 100644 index 3e94547270..0000000000 --- a/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint +++ /dev/null @@ -1,13 +0,0 @@ -0x90012 screenlock # Fn+F2 -0x90013 battery # Fn+F3 -0x90014 wlan # Fn+F5 -0x90016 switchvideomode # Fn+F7 -0x90017 f21 # Fn+F8 touchpadtoggle -0x90019 suspend # Fn+F12 -0x9001A brightnessup # Fn+Home -0x9001B brightnessdown # Fn+End -0x9001D zoom # Fn+Space -0x90011 prog1 # Thinkvantage button - -0x90015 camera # Fn+F6 headset/camera VoIP key ?? -0x90010 micmute # Microphone mute button diff --git a/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet b/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet deleted file mode 100644 index 31ea3b2c70..0000000000 --- a/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet +++ /dev/null @@ -1,6 +0,0 @@ -0x5D menu -0x63 fn -0x66 screenlock -0x67 cyclewindows # bezel circular arrow -0x68 setup # bezel setup / menu -0x6c direction # rotate screen diff --git a/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet b/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet deleted file mode 100644 index 6fd16b5662..0000000000 --- a/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet +++ /dev/null @@ -1,8 +0,0 @@ -0x6C f21 # rotate -0x68 screenlock # screenlock -0x6B esc # escape -0x6D right # right on d-pad -0x6E left # left on d-pad -0x71 up # up on d-pad -0x6F down # down on d-pad -0x69 enter # enter on d-pad diff --git a/extras/keymap/keymaps/lg-x110 b/extras/keymap/keymaps/lg-x110 deleted file mode 100644 index ba08cba3fe..0000000000 --- a/extras/keymap/keymaps/lg-x110 +++ /dev/null @@ -1,12 +0,0 @@ -0xA0 mute # Fn-F9 -0xAE volumedown # Fn-Left -0xAF search # Fn-F3 -0xB0 volumeup # Fn-Right -0xB1 battery # Fn-F10 Info -0xB3 suspend # Fn-F12 -0xDF sleep # Fn-F4 -# 0xE2 bluetooth # satellite dish2 -0xE4 f21 # Fn-F5 Touchpad disable -0xF6 wlan # Fn-F6 -0xF7 reserved # brightnessdown # Fn-Down -0xF8 reserved # brightnessup # Fn-Up diff --git a/extras/keymap/keymaps/logitech-wave b/extras/keymap/keymaps/logitech-wave deleted file mode 100644 index caa5d5d310..0000000000 --- a/extras/keymap/keymaps/logitech-wave +++ /dev/null @@ -1,16 +0,0 @@ -0x9001C scale #expo -0x9001F zoomout #zoom out -0x90020 zoomin #zoom in -0x9003D prog1 #gadget -0x90005 camera #camera -0x90018 media #media center -0x90041 wordprocessor #fn+f1 (word) -0x90042 spreadsheet #fn+f2 (excel) -0x90043 calendar #fn+f3 (calendar) -0x90044 prog2 #fn+f4 (program a) -0x90045 prog3 #fn+f5 (program b) -0x90046 prog4 #fn+f6 (program c) -0x90048 messenger #fn+f8 (msn messenger) -0x9002D find #fn+f10 (search www) -0x9004B search #fn+f11 (search pc) -0x9004C ejectclosecd #fn+f12 (eject) diff --git a/extras/keymap/keymaps/logitech-wave-cordless b/extras/keymap/keymaps/logitech-wave-cordless deleted file mode 100644 index a10dad5e4d..0000000000 --- a/extras/keymap/keymaps/logitech-wave-cordless +++ /dev/null @@ -1,15 +0,0 @@ -0xD4 zoomin -0xCC zoomout -0xC0183 media -0xC1005 camera -0xC101F zoomout -0xC1020 zoomin -0xC1041 wordprocessor -0xC1042 spreadsheet -0xC1043 calendar -0xC1044 prog2 #fn+f4 (program a) -0xC1045 prog3 #fn+f5 (program b) -0xC1046 prog4 #fn+f6 (program c) -0xC1048 messenger -0xC104A find #fn+f10 (search www) -0xC104C ejectclosecd diff --git a/extras/keymap/keymaps/logitech-wave-pro-cordless b/extras/keymap/keymaps/logitech-wave-pro-cordless deleted file mode 100644 index e7aa02206c..0000000000 --- a/extras/keymap/keymaps/logitech-wave-pro-cordless +++ /dev/null @@ -1,12 +0,0 @@ -0xC01B6 camera -0xC0183 media -0xC0184 wordprocessor -0xC0186 spreadsheet -0xC018E calendar -0xC0223 homepage -0xC01BC messenger -0xC018A mail -0xC0221 search -0xC00B8 ejectcd -0xC022D zoomin -0xC022E zoomout diff --git a/extras/keymap/keymaps/maxdata-pro_7000 b/extras/keymap/keymaps/maxdata-pro_7000 deleted file mode 100644 index c0e4f77af4..0000000000 --- a/extras/keymap/keymaps/maxdata-pro_7000 +++ /dev/null @@ -1,9 +0,0 @@ -0x97 prog2 -0x9F prog1 -0xA0 mute # Fn-F5 -0x82 www -0xEC email -0xAE volumedown # Fn-Down -0xB0 volumeup # Fn-Up -0xDF suspend # Fn+F2 -0xF5 help diff --git a/extras/keymap/keymaps/medion-fid2060 b/extras/keymap/keymaps/medion-fid2060 deleted file mode 100644 index 5a76c76799..0000000000 --- a/extras/keymap/keymaps/medion-fid2060 +++ /dev/null @@ -1,2 +0,0 @@ -0x6B channeldown # Thottle Down -0x6D channelup # Thottle Up diff --git a/extras/keymap/keymaps/medionnb-a555 b/extras/keymap/keymaps/medionnb-a555 deleted file mode 100644 index c3b5dfa60b..0000000000 --- a/extras/keymap/keymaps/medionnb-a555 +++ /dev/null @@ -1,4 +0,0 @@ -0x63 www # N button -0x66 prog1 # link 1 button -0x67 email # envelope button -0x69 prog2 # link 2 button diff --git a/extras/keymap/keymaps/micro-star b/extras/keymap/keymaps/micro-star deleted file mode 100644 index 4a438698ed..0000000000 --- a/extras/keymap/keymaps/micro-star +++ /dev/null @@ -1,13 +0,0 @@ -0xA0 mute # Fn-F9 -0xAE volumedown # Fn-F7 -0xB0 volumeup # Fn-F8 -0xB2 www # e button -0xDF sleep # Fn-F12 -0xE2 bluetooth # satellite dish2 -0xE4 f21 # Fn-F3 Touchpad disable -0xEC email # envelope button -0xEE camera # Fn-F6 camera disable -0xF6 wlan # satellite dish1 -0xF7 brightnessdown # Fn-F4 -0xF8 brightnessup # Fn-F5 -0xF9 search diff --git a/extras/keymap/keymaps/module-asus-w3j b/extras/keymap/keymaps/module-asus-w3j deleted file mode 100644 index 773e0b3e82..0000000000 --- a/extras/keymap/keymaps/module-asus-w3j +++ /dev/null @@ -1,11 +0,0 @@ -0x41 nextsong -0x45 playpause -0x43 stopcd -0x40 previoussong -0x4C ejectclosecd -0x32 mute -0x31 volumedown -0x30 volumeup -0x5D wlan -0x7E bluetooth -0x8A media # high keycode: "tv" diff --git a/extras/keymap/keymaps/module-ibm b/extras/keymap/keymaps/module-ibm deleted file mode 100644 index a92dfa2506..0000000000 --- a/extras/keymap/keymaps/module-ibm +++ /dev/null @@ -1,16 +0,0 @@ -0x01 battery # Fn+F2 -0x02 screenlock # Fn+F3 -0x03 sleep # Fn+F4 -0x04 wlan # Fn+F5 -0x06 switchvideomode # Fn+F7 -0x07 zoom # Fn+F8 screen expand -0x08 f24 # Fn+F9 undock -0x0B suspend # Fn+F12 -0x0F brightnessup # Fn+Home -0x10 brightnessdown # Fn+End -0x11 kbdillumtoggle # Fn+PgUp - ThinkLight -0x13 zoom # Fn+Space -0x14 volumeup -0x15 volumedown -0x16 mute -0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") diff --git a/extras/keymap/keymaps/module-lenovo b/extras/keymap/keymaps/module-lenovo deleted file mode 100644 index 8e38883091..0000000000 --- a/extras/keymap/keymaps/module-lenovo +++ /dev/null @@ -1,17 +0,0 @@ -0x1 screenlock # Fn+F2 -0x2 battery # Fn+F3 -0x3 sleep # Fn+F4 -0x4 wlan # Fn+F5 -0x6 switchvideomode # Fn+F7 -0x7 f21 # Fn+F8 touchpadtoggle -0x8 f24 # Fn+F9 undock -0xB suspend # Fn+F12 -0xF brightnessup # Fn+Home -0x10 brightnessdown # Fn+End -0x11 kbdillumtoggle # Fn+PgUp - ThinkLight -0x13 zoom # Fn+Space -0x14 volumeup -0x15 volumedown -0x16 mute -0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") -0x1A micmute # Microphone mute diff --git a/extras/keymap/keymaps/module-sony b/extras/keymap/keymaps/module-sony deleted file mode 100644 index 7c000131d1..0000000000 --- a/extras/keymap/keymaps/module-sony +++ /dev/null @@ -1,8 +0,0 @@ -0x06 mute # Fn+F2 -0x07 volumedown # Fn+F3 -0x08 volumeup # Fn+F4 -0x09 brightnessdown # Fn+F5 -0x0A brightnessup # Fn+F6 -0x0B switchvideomode # Fn+F7 -0x0E zoom # Fn+F10 -0x10 suspend # Fn+F12 diff --git a/extras/keymap/keymaps/module-sony-old b/extras/keymap/keymaps/module-sony-old deleted file mode 100644 index 596a34258a..0000000000 --- a/extras/keymap/keymaps/module-sony-old +++ /dev/null @@ -1,2 +0,0 @@ -0x06 battery -0x07 mute diff --git a/extras/keymap/keymaps/module-sony-vgn b/extras/keymap/keymaps/module-sony-vgn deleted file mode 100644 index c8ba001516..0000000000 --- a/extras/keymap/keymaps/module-sony-vgn +++ /dev/null @@ -1,8 +0,0 @@ -0x00 brightnessdown # Fn+F5 -0x10 brightnessup # Fn+F6 -0x11 switchvideomode # Fn+F7 -0x12 zoomout -0x14 zoomin -0x15 suspend # Fn+F12 -0x17 prog1 -0x20 media diff --git a/extras/keymap/keymaps/olpc-xo b/extras/keymap/keymaps/olpc-xo deleted file mode 100644 index 34434a121d..0000000000 --- a/extras/keymap/keymaps/olpc-xo +++ /dev/null @@ -1,74 +0,0 @@ -0x59 fn -0x81 fn_esc -0xF9 camera -0xF8 sound # Fn-CAMERA = Mic - - -# Function key mappings, as per -# http://dev.laptop.org/ticket/10213#comment:20 -# -# Unmodified F1-F8 produce F1-F8, so no remap necessary. -# Unmodified F9-F12 control brightness and volume. -0x43 brightnessdown -0x44 brightnessup -0x57 volumedown -0x58 volumeup - -# fn-modified fkeys all produce the unmodified version of the key. -0xBB f1 -0xBC f2 -0xBD f3 -0xBE f4 -0xBF f5 -0xC0 f6 -0xC1 f7 -0xC2 f8 -0xC3 f9 -0xC4 f10 -0xD7 f11 -0xD8 f12 - - -# Using F13-F21 for the .5 F keys right now. -0xF7 f13 -0xF6 f14 -0xF5 f15 -0xF4 f16 -0xF3 f17 -0xF2 f18 -0xF1 f19 -0xF0 f20 -0xEF f21 - -0xEE chat -0xE4 chat # Just mapping Fn-Chat to Chat for now -0xDD menu # Frame -0xDA prog1 # Fn-Frame - -# The FN of some keys is other keys -0xD3 delete -0xD2 insert -0xC9 pageup -0xD1 pagedown -0xC7 home -0xCF end - -# Language key - don't ask what they are doing as KEY_HP -0x73 hp -0x7E hp - -0xDB leftmeta # left grab -0xDC rightmeta # right grab -0x85 rightmeta # Right grab releases on a different scancode -0xD6 kbdillumtoggle # Fn-space -0x69 switchvideomode # Brightness key - -# Game keys -0x65 kp8 # up -0x66 kp2 # down -0x67 kp4 # left -0x68 kp6 # right -0xE5 kp9 # pgup -0xE6 kp3 # pgdn -0xE7 kp7 # home -0xE8 kp1 # end diff --git a/extras/keymap/keymaps/onkyo b/extras/keymap/keymaps/onkyo deleted file mode 100644 index ee864ade4d..0000000000 --- a/extras/keymap/keymaps/onkyo +++ /dev/null @@ -1,14 +0,0 @@ -0xA0 mute # Fn+D -0xAE volumedown # Fn+F -0xB0 volumeup # Fn+G -0xDF sleep # Fn+W -0xE0 bluetooth # Fn+H -0xE2 cyclewindows # Fn+Esc -0xEE battery # Fn+Q -0xF0 media # Fn+R -0xF5 switchvideomode # Fn+E -0xF6 camera # Fn+T -0xF7 f21 # Fn+Y (touchpad toggle) -0xF8 brightnessup # Fn+S -0xF9 brightnessdown # Fn+A -0xFB wlan # Fn+J diff --git a/extras/keymap/keymaps/oqo-model2 b/extras/keymap/keymaps/oqo-model2 deleted file mode 100644 index b7f4851abe..0000000000 --- a/extras/keymap/keymaps/oqo-model2 +++ /dev/null @@ -1,5 +0,0 @@ -0x8E wlan -0xF0 switchvideomode -0xF1 mute -0xF2 volumedown -0xF3 volumeup diff --git a/extras/keymap/keymaps/samsung-other b/extras/keymap/keymaps/samsung-other deleted file mode 100644 index 3ac0c2f10c..0000000000 --- a/extras/keymap/keymaps/samsung-other +++ /dev/null @@ -1,14 +0,0 @@ -0x74 prog1 # User key -0x75 www -0x78 mail -0x82 switchvideomode # Fn+F4 CRT/LCD (high keycode: "displaytoggle") -0x83 battery # Fn+F2 -0x84 prog1 # Fn+F5 backlight on/off -0x86 wlan # Fn+F9 -0x88 brightnessup # Fn-Up -0x89 brightnessdown # Fn-Down -0xB1 prog2 # Fn+F7 run Samsung Magic Doctor (keypressed event is generated twice) -0xB3 prog3 # Fn+F8 switch power mode (battery/dynamic/performance) -0xB4 wlan # Fn+F9 (X60P) -0xF7 f22 # Fn+F10 Touchpad on -0xF9 f23 # Fn+F10 Touchpad off diff --git a/extras/keymap/keymaps/samsung-sq1us b/extras/keymap/keymaps/samsung-sq1us deleted file mode 100644 index 3e05199785..0000000000 --- a/extras/keymap/keymaps/samsung-sq1us +++ /dev/null @@ -1,7 +0,0 @@ -0xD4 menu -0xD8 f1 -0xD9 f10 -0xD6 f3 -0xD7 f9 -0xE4 f5 -0xEE f11 diff --git a/extras/keymap/keymaps/samsung-sx20s b/extras/keymap/keymaps/samsung-sx20s deleted file mode 100644 index 9d954ee415..0000000000 --- a/extras/keymap/keymaps/samsung-sx20s +++ /dev/null @@ -1,4 +0,0 @@ -0x74 mute -0x75 mute -0x77 f22 # Touchpad on -0x79 f23 # Touchpad off diff --git a/extras/keymap/keymaps/toshiba-satellite_a100 b/extras/keymap/keymaps/toshiba-satellite_a100 deleted file mode 100644 index 22007be71b..0000000000 --- a/extras/keymap/keymaps/toshiba-satellite_a100 +++ /dev/null @@ -1,2 +0,0 @@ -0xA4 stopcd -0xB2 www diff --git a/extras/keymap/keymaps/toshiba-satellite_a110 b/extras/keymap/keymaps/toshiba-satellite_a110 deleted file mode 100644 index 1429409351..0000000000 --- a/extras/keymap/keymaps/toshiba-satellite_a110 +++ /dev/null @@ -1,10 +0,0 @@ -0x92 stop -0x93 www -0x94 media -0x9E f22 # Touchpad on -0x9F f23 # Touchpad off -0xB9 nextsong -0xD9 brightnessup -0xEE screenlock -0xF4 previoussong -0xF7 playpause diff --git a/extras/keymap/keymaps/toshiba-satellite_m30x b/extras/keymap/keymaps/toshiba-satellite_m30x deleted file mode 100644 index 9280ae0c5f..0000000000 --- a/extras/keymap/keymaps/toshiba-satellite_m30x +++ /dev/null @@ -1,7 +0,0 @@ -0xef brightnessdown -0xd9 brightnessup -0xee screenlock -0x93 media -0x9e f22 #touchpad_enable -0x9f f23 #touchpad_disable - diff --git a/extras/keymap/keymaps/zepto-znote b/extras/keymap/keymaps/zepto-znote deleted file mode 100644 index cf72fda47b..0000000000 --- a/extras/keymap/keymaps/zepto-znote +++ /dev/null @@ -1,11 +0,0 @@ -0x93 switchvideomode # Fn+F3 Toggle Video Output -0x95 brightnessdown # Fn+F4 Brightness Down -0x91 brightnessup # Fn+F5 Brightness Up -0xA5 f23 # Fn+F6 Disable Touchpad -0xA6 f22 # Fn+F6 Enable Touchpad -0xA7 bluetooth # Fn+F10 Enable Bluetooth -0XA9 bluetooth # Fn+F10 Disable Bluetooth -0xF1 wlan # RF Switch Off -0xF2 wlan # RF Switch On -0xF4 prog1 # P1 Button -0xF3 prog2 # P2 Button diff --git a/extras/mtd_probe/.gitignore b/extras/mtd_probe/.gitignore deleted file mode 100644 index 82b8ab501f..0000000000 --- a/extras/mtd_probe/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mtd_probe diff --git a/extras/mtd_probe/75-probe_mtd.rules b/extras/mtd_probe/75-probe_mtd.rules deleted file mode 100644 index c0e0839785..0000000000 --- a/extras/mtd_probe/75-probe_mtd.rules +++ /dev/null @@ -1,8 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="mtd_probe_end" - -KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $devnode" -KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl" - -LABEL="mtd_probe_end" diff --git a/extras/mtd_probe/mtd_probe.c b/extras/mtd_probe/mtd_probe.c deleted file mode 100644 index e45867ffa9..0000000000 --- a/extras/mtd_probe/mtd_probe.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2010 - Maxim Levitsky - * - * mtd_probe 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; either version 2 of the License, or - * (at your option) any later version. - * - * mtd_probe 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 mtd_probe; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ -#include "mtd_probe.h" -#include -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char** argv) -{ - if (argc != 2) { - printf("usage: mtd_probe /dev/mtd[n]\n"); - return 1; - } - - int mtd_fd = open(argv[1], O_RDONLY); - if (mtd_fd == -1) { - perror("open"); - exit(-1); - } - - mtd_info_t mtd_info; - int error = ioctl(mtd_fd, MEMGETINFO, &mtd_info); - if (error == -1) { - perror("ioctl"); - exit(-1); - } - - probe_smart_media(mtd_fd, &mtd_info); - return -1; -} diff --git a/extras/mtd_probe/mtd_probe.h b/extras/mtd_probe/mtd_probe.h deleted file mode 100644 index 30396d07f6..0000000000 --- a/extras/mtd_probe/mtd_probe.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2010 - Maxim Levitsky - * - * mtd_probe 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; either version 2 of the License, or - * (at your option) any later version. - * - * mtd_probe 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 mtd_probe; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -#include - -/* Full oob structure as written on the flash */ -struct sm_oob { - uint32_t reserved; - uint8_t data_status; - uint8_t block_status; - uint8_t lba_copy1[2]; - uint8_t ecc2[3]; - uint8_t lba_copy2[2]; - uint8_t ecc1[3]; -} __attribute__((packed)); - - -/* one sector is always 512 bytes, but it can consist of two nand pages */ -#define SM_SECTOR_SIZE 512 - -/* oob area is also 16 bytes, but might be from two pages */ -#define SM_OOB_SIZE 16 - -/* This is maximum zone size, and all devices that have more that one zone - have this size */ -#define SM_MAX_ZONE_SIZE 1024 - -/* support for small page nand */ -#define SM_SMALL_PAGE 256 -#define SM_SMALL_OOB_SIZE 8 - - -void probe_smart_media(int mtd_fd, mtd_info_t *info); diff --git a/extras/mtd_probe/probe_smartmedia.c b/extras/mtd_probe/probe_smartmedia.c deleted file mode 100644 index 78841f05da..0000000000 --- a/extras/mtd_probe/probe_smartmedia.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2010 - Maxim Levitsky - * - * mtd_probe 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; either version 2 of the License, or - * (at your option) any later version. - * - * mtd_probe 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 mtd_probe; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mtd_probe.h" - -static const uint8_t cis_signature[] = { - 0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20 -}; - - -void probe_smart_media(int mtd_fd, mtd_info_t* info) -{ - char* cis_buffer = malloc(SM_SECTOR_SIZE); - - if (!cis_buffer) - return; - - if (info->type != MTD_NANDFLASH) - goto exit; - - int sector_size = info->writesize; - int block_size = info->erasesize; - int size_in_megs = info->size / (1024 * 1024); - int spare_count; - - - if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE) - goto exit; - - switch(size_in_megs) { - case 1: - case 2: - spare_count = 6; - break; - case 4: - spare_count = 12; - break; - default: - spare_count = 24; - break; - } - - - int offset; - int cis_found = 0; - - for (offset = 0 ; offset < block_size * spare_count ; - offset += sector_size) { - - lseek(mtd_fd, SEEK_SET, offset); - if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){ - cis_found = 1; - break; - } - } - - if (!cis_found) - goto exit; - - if (memcmp(cis_buffer, cis_signature, sizeof(cis_signature)) != 0 && - (memcmp(cis_buffer + SM_SMALL_PAGE, cis_signature, - sizeof(cis_signature)) != 0)) - goto exit; - - printf("MTD_FTL=smartmedia\n"); - free(cis_buffer); - exit(0); -exit: - free(cis_buffer); - return; -} diff --git a/extras/qemu/42-qemu-usb.rules b/extras/qemu/42-qemu-usb.rules deleted file mode 100644 index a4e3864714..0000000000 --- a/extras/qemu/42-qemu-usb.rules +++ /dev/null @@ -1,13 +0,0 @@ -# -# Enable autosuspend for qemu emulated usb hid devices. -# -# Note that there are buggy qemu versions which advertise remote -# wakeup support but don't actually implement it correctly. This -# is the reason why we need a match for the serial number here. -# The serial number "42" is used to tag the implementations where -# remote wakeup is working. -# - -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" diff --git a/extras/rule_generator/75-cd-aliases-generator.rules b/extras/rule_generator/75-cd-aliases-generator.rules deleted file mode 100644 index e6da0101d6..0000000000 --- a/extras/rule_generator/75-cd-aliases-generator.rules +++ /dev/null @@ -1,9 +0,0 @@ -# these rules generate rules for the /dev/{cdrom,dvd,...} symlinks - -# the "path" of usb/ieee1394 devices changes frequently, use "id" -ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", \ - PROGRAM="write_cd_rules by-id", SYMLINK+="%c", GOTO="persistent_cd_end" - -ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules", SYMLINK+="%c" - -LABEL="persistent_cd_end" diff --git a/extras/rule_generator/75-persistent-net-generator.rules b/extras/rule_generator/75-persistent-net-generator.rules deleted file mode 100644 index aab579cde9..0000000000 --- a/extras/rule_generator/75-persistent-net-generator.rules +++ /dev/null @@ -1,103 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# these rules generate rules for persistent network device naming -# -# variables used to communicate: -# MATCHADDR MAC address used for the match -# MATCHID bus_id used for the match -# MATCHDRV driver name used for the match -# MATCHIFTYPE interface type match -# COMMENT comment to add to the generated rule -# INTERFACE_NAME requested name supplied by external tool -# INTERFACE_NEW new interface name returned by rule writer - -ACTION!="add", GOTO="persistent_net_generator_end" -SUBSYSTEM!="net", GOTO="persistent_net_generator_end" - -# ignore the interface if a name has already been set -NAME=="?*", GOTO="persistent_net_generator_end" - -# device name whitelist -KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" - -# ignore Xen virtual interfaces -SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" - -# read MAC address -ENV{MATCHADDR}="$attr{address}" - -# match interface type -ENV{MATCHIFTYPE}="$attr{type}" - -# ignore KVM virtual interfaces -ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" -# ignore VMWare virtual interfaces -ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" -# ignore Hyper-V virtual interfaces -ENV{MATCHADDR}=="00:15:5d:*", GOTO="persistent_net_generator_end" - -# These vendors are known to violate the local MAC address assignment scheme -# Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom -ENV{MATCHADDR}=="02:07:01:*", GOTO="globally_administered_whitelist" -# 3Com -ENV{MATCHADDR}=="02:60:60:*", GOTO="globally_administered_whitelist" -# 3Com IBM PC; Imagen; Valid; Cisco; Apple -ENV{MATCHADDR}=="02:60:8c:*", GOTO="globally_administered_whitelist" -# Intel -ENV{MATCHADDR}=="02:a0:c9:*", GOTO="globally_administered_whitelist" -# Olivetti -ENV{MATCHADDR}=="02:aa:3c:*", GOTO="globally_administered_whitelist" -# CMC Masscomp; Silicon Graphics; Prime EXL -ENV{MATCHADDR}=="02:cf:1f:*", GOTO="globally_administered_whitelist" -# Prominet Corporation Gigabit Ethernet Switch -ENV{MATCHADDR}=="02:e0:3b:*", GOTO="globally_administered_whitelist" -# BTI (Bus-Tech, Inc.) IBM Mainframes -ENV{MATCHADDR}=="02:e6:d3:*", GOTO="globally_administered_whitelist" -# Realtek -ENV{MATCHADDR}=="52:54:00:*", GOTO="globally_administered_whitelist" -# Novell 2000 -ENV{MATCHADDR}=="52:54:4c:*", GOTO="globally_administered_whitelist" -# Realtec -ENV{MATCHADDR}=="52:54:ab:*", GOTO="globally_administered_whitelist" -# Kingston Technologies -ENV{MATCHADDR}=="e2:0c:0f:*", GOTO="globally_administered_whitelist" -# Xensource -ENV{MATCHADDR}=="00:16:3e:*", GOTO="globally_administered_whitelist" - -# match interface dev_id -ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}" - -# do not use "locally administered" MAC address -ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" - -# do not use empty address -ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" - -LABEL="globally_administered_whitelist" - -# build comment line for generated rule: -SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)" -SUBSYSTEMS=="usb", ATTRS{idVendor}=="?*", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)" -SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)" -SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" - -# ibmveth likes to use "locally administered" MAC addresses -DRIVERS=="ibmveth", ENV{MATCHADDR}="$attr{address}", ENV{COMMENT}="ibmveth ($id)" - -# S/390 uses id matches only, do not use MAC address match -SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID}="$id", ENV{MATCHDRV}="$driver", ENV{MATCHADDR}="" - -# see if we got enough data to create a rule -ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", GOTO="persistent_net_generator_end" - -# default comment -ENV{COMMENT}=="", ENV{COMMENT}="net device ($attr{driver})" - -# write rule -DRIVERS=="?*", IMPORT{program}="write_net_rules" - -# rename interface if needed -ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" - -LABEL="persistent_net_generator_end" - diff --git a/extras/rule_generator/rule_generator.functions b/extras/rule_generator/rule_generator.functions deleted file mode 100644 index 0f1b73850e..0000000000 --- a/extras/rule_generator/rule_generator.functions +++ /dev/null @@ -1,113 +0,0 @@ -# functions used by the udev rule generator - -# Copyright (C) 2006 Marco d'Itri - -# 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, either version 2 of the License, or -# (at your option) any later version. - -# 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, see . - -PATH='/usr/bin:/bin:/usr/sbin:/sbin' - -# Read a single line from file $1 in the $DEVPATH directory. -# The function must not return an error even if the file does not exist. -sysread() { - local file="$1" - [ -e "/sys$DEVPATH/$file" ] || return 0 - local value - read value < "/sys$DEVPATH/$file" || return 0 - echo "$value" -} - -sysreadlink() { - local file="$1" - [ -e "/sys$DEVPATH/$file" ] || return 0 - readlink -f /sys$DEVPATH/$file 2> /dev/null || true -} - -# Return true if a directory is writeable. -writeable() { - if ln -s test-link $1/.is-writeable 2> /dev/null; then - rm -f $1/.is-writeable - return 0 - else - return 1 - fi -} - -# Create a lock file for the current rules file. -lock_rules_file() { - RUNDIR=$(udevadm info --run) - [ -e "$RUNDIR" ] || return 0 - - RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}" - - retry=30 - while ! mkdir $RULES_LOCK 2> /dev/null; do - if [ $retry -eq 0 ]; then - echo "Cannot lock $RULES_FILE!" >&2 - exit 2 - fi - sleep 1 - retry=$(($retry - 1)) - done -} - -unlock_rules_file() { - [ "$RULES_LOCK" ] || return 0 - rmdir $RULES_LOCK || true -} - -# Choose the real rules file if it is writeable or a temporary file if not. -# Both files should be checked later when looking for existing rules. -choose_rules_file() { - RUNDIR=$(udevadm info --run) - local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}" - [ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1 - - if writeable ${RULES_FILE%/*}; then - RO_RULES_FILE='/dev/null' - else - RO_RULES_FILE=$RULES_FILE - RULES_FILE=$tmp_rules_file - fi -} - -# Return the name of the first free device. -raw_find_next_available() { - local links="$1" - - local basename=${links%%[ 0-9]*} - local max=-1 - for name in $links; do - local num=${name#$basename} - [ "$num" ] || num=0 - [ $num -gt $max ] && max=$num - done - - local max=$(($max + 1)) - # "name0" actually is just "name" - [ $max -eq 0 ] && return - echo "$max" -} - -# Find all rules matching a key (with action) and a pattern. -find_all_rules() { - local key="$1" - local linkre="$2" - local match="$3" - - local search='.*[[:space:],]'"$key"'"('"$linkre"')".*' - echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \ - $RO_RULES_FILE \ - $([ -e $RULES_FILE ] && echo $RULES_FILE) \ - 2>/dev/null) -} diff --git a/extras/rule_generator/write_cd_rules b/extras/rule_generator/write_cd_rules deleted file mode 100644 index 00382ada2f..0000000000 --- a/extras/rule_generator/write_cd_rules +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/sh -e - -# This script is run if an optical drive lacks a rule for persistent naming. -# -# It adds symlinks for optical drives based on the device class determined -# by cdrom_id and used ID_PATH to identify the device. - -# (C) 2006 Marco d'Itri -# -# 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, either version 2 of the License, or -# (at your option) any later version. - -# 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, see . - -# debug, if UDEV_LOG= -if [ -n "$UDEV_LOG" ]; then - if [ "$UDEV_LOG" -ge 7 ]; then - set -x - fi -fi - -RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" - -. /lib/udev/rule_generator.functions - -find_next_available() { - raw_find_next_available "$(find_all_rules 'SYMLINK\+=' "$1")" -} - -write_rule() { - local match="$1" - local link="$2" - local comment="$3" - - { - if [ "$PRINT_HEADER" ]; then - PRINT_HEADER= - echo "# This file was automatically generated by the $0" - echo "# program, run by the cd-aliases-generator.rules rules file." - echo "#" - echo "# You can modify it, as long as you keep each rule on a single" - echo "# line, and set the \$GENERATED variable." - echo "" - fi - - [ "$comment" ] && echo "# $comment" - echo "$match, SYMLINK+=\"$link\", ENV{GENERATED}=\"1\"" - } >> $RULES_FILE - SYMLINKS="$SYMLINKS $link" -} - -if [ -z "$DEVPATH" ]; then - echo "Missing \$DEVPATH." >&2 - exit 1 -fi -if [ -z "$ID_CDROM" ]; then - echo "$DEVPATH is not a CD reader." >&2 - exit 1 -fi - -if [ "$1" ]; then - METHOD="$1" -else - METHOD='by-path' -fi - -case "$METHOD" in - by-path) - if [ -z "$ID_PATH" ]; then - echo "$DEVPATH not supported by path_id. by-id may work." >&2 - exit 1 - fi - RULE="ENV{ID_PATH}==\"$ID_PATH\"" - ;; - - by-id) - if [ "$ID_SERIAL" ]; then - RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\"" - elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then - RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\"" - else - echo "$DEVPATH not supported by ata_id. by-path may work." >&2 - exit 1 - fi - ;; - - *) - echo "Invalid argument (must be either by-path or by-id)." >&2 - exit 1 - ;; -esac - -# Prevent concurrent processes from modifying the file at the same time. -lock_rules_file - -# Check if the rules file is writeable. -choose_rules_file - -link_num=$(find_next_available 'cdrom[0-9]*') - -match="SUBSYSTEM==\"block\", ENV{ID_CDROM}==\"?*\", $RULE" - -comment="$ID_MODEL ($ID_PATH)" - - write_rule "$match" "cdrom$link_num" "$comment" -[ "$ID_CDROM_CD_R" -o "$ID_CDROM_CD_RW" ] && \ - write_rule "$match" "cdrw$link_num" -[ "$ID_CDROM_DVD" ] && \ - write_rule "$match" "dvd$link_num" -[ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ] && \ - write_rule "$match" "dvdrw$link_num" -echo >> $RULES_FILE - -unlock_rules_file - -echo $SYMLINKS - -exit 0 - diff --git a/extras/rule_generator/write_net_rules b/extras/rule_generator/write_net_rules deleted file mode 100644 index 437979241f..0000000000 --- a/extras/rule_generator/write_net_rules +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/sh -e - -# This script is run to create persistent network device naming rules -# based on properties of the device. -# If the interface needs to be renamed, INTERFACE_NEW= will be printed -# on stdout to allow udev to IMPORT it. - -# variables used to communicate: -# MATCHADDR MAC address used for the match -# MATCHID bus_id used for the match -# MATCHDEVID dev_id used for the match -# MATCHDRV driver name used for the match -# MATCHIFTYPE interface type match -# COMMENT comment to add to the generated rule -# INTERFACE_NAME requested name supplied by external tool -# INTERFACE_NEW new interface name returned by rule writer - -# Copyright (C) 2006 Marco d'Itri -# Copyright (C) 2007 Kay Sievers -# -# 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, either version 2 of the License, or -# (at your option) any later version. -# -# 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, see . - -# debug, if UDEV_LOG= -if [ -n "$UDEV_LOG" ]; then - if [ "$UDEV_LOG" -ge 7 ]; then - set -x - fi -fi - -RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' - -. /lib/udev/rule_generator.functions - -interface_name_taken() { - local value="$(find_all_rules 'NAME=' $INTERFACE)" - if [ "$value" ]; then - return 0 - else - return 1 - fi -} - -find_next_available() { - raw_find_next_available "$(find_all_rules 'NAME=' "$1")" -} - -write_rule() { - local match="$1" - local name="$2" - local comment="$3" - - { - if [ "$PRINT_HEADER" ]; then - PRINT_HEADER= - echo "# This file was automatically generated by the $0" - echo "# program, run by the persistent-net-generator.rules rules file." - echo "#" - echo "# You can modify it, as long as you keep each rule on a single" - echo "# line, and change only the value of the NAME= key." - fi - - echo "" - [ "$comment" ] && echo "# $comment" - echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\"" - } >> $RULES_FILE -} - -if [ -z "$INTERFACE" ]; then - echo "missing \$INTERFACE" >&2 - exit 1 -fi - -# Prevent concurrent processes from modifying the file at the same time. -lock_rules_file - -# Check if the rules file is writeable. -choose_rules_file - -# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces -if [ "$MATCHADDR" ]; then - match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\"" -fi - -if [ "$MATCHDRV" ]; then - match="$match, DRIVERS==\"$MATCHDRV\"" -fi - -if [ "$MATCHDEVID" ]; then - match="$match, ATTR{dev_id}==\"$MATCHDEVID\"" -fi - -if [ "$MATCHID" ]; then - match="$match, KERNELS==\"$MATCHID\"" -fi - -if [ "$MATCHIFTYPE" ]; then - match="$match, ATTR{type}==\"$MATCHIFTYPE\"" -fi - -if [ -z "$match" ]; then - echo "missing valid match" >&2 - unlock_rules_file - exit 1 -fi - -basename=${INTERFACE%%[0-9]*} -match="$match, KERNEL==\"$basename*\"" - -if [ "$INTERFACE_NAME" ]; then - # external tools may request a custom name - COMMENT="$COMMENT (custom name provided by external tool)" - if [ "$INTERFACE_NAME" != "$INTERFACE" ]; then - INTERFACE=$INTERFACE_NAME; - echo "INTERFACE_NEW=$INTERFACE" - fi -else - # if a rule using the current name already exists, find a new name - if interface_name_taken; then - INTERFACE="$basename$(find_next_available "$basename[0-9]*")" - # prevent INTERFACE from being "eth" instead of "eth0" - [ "$INTERFACE" = "${INTERFACE%%[ \[\]0-9]*}" ] && INTERFACE=${INTERFACE}0 - echo "INTERFACE_NEW=$INTERFACE" - fi -fi - -write_rule "$match" "$INTERFACE" "$COMMENT" - -unlock_rules_file - -exit 0 diff --git a/extras/scsi_id/.gitignore b/extras/scsi_id/.gitignore deleted file mode 100644 index 10e9ae743c..0000000000 --- a/extras/scsi_id/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -scsi_id -scsi_id.8 -scsi_id_version.h diff --git a/extras/scsi_id/README b/extras/scsi_id/README deleted file mode 100644 index 9cfe73991c..0000000000 --- a/extras/scsi_id/README +++ /dev/null @@ -1,4 +0,0 @@ -scsi_id - generate a SCSI unique identifier for a given SCSI device - -Please send questions, comments or patches to or -. diff --git a/extras/scsi_id/scsi.h b/extras/scsi_id/scsi.h deleted file mode 100644 index 8e9ce406b7..0000000000 --- a/extras/scsi_id/scsi.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * scsi.h - * - * General scsi and linux scsi specific defines and structs. - * - * Copyright (C) IBM Corp. 2003 - * - * 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. - */ - -#include - -struct scsi_ioctl_command { - unsigned int inlen; /* excluding scsi command length */ - unsigned int outlen; - unsigned char data[1]; - /* on input, scsi command starts here then opt. data */ -}; - -/* - * Default 5 second timeout - */ -#define DEF_TIMEOUT 5000 - -#define SENSE_BUFF_LEN 32 - -/* - * The request buffer size passed to the SCSI INQUIRY commands, use 254, - * as this is a nice value for some devices, especially some of the usb - * mass storage devices. - */ -#define SCSI_INQ_BUFF_LEN 254 - -/* - * SCSI INQUIRY vendor and model (really product) lengths. - */ -#define VENDOR_LENGTH 8 -#define MODEL_LENGTH 16 - -#define INQUIRY_CMD 0x12 -#define INQUIRY_CMDLEN 6 - -/* - * INQUIRY VPD page 0x83 identifier descriptor related values. Reference the - * SCSI Primary Commands specification for details. - */ - -/* - * id type values of id descriptors. These are assumed to fit in 4 bits. - */ -#define SCSI_ID_VENDOR_SPECIFIC 0 -#define SCSI_ID_T10_VENDOR 1 -#define SCSI_ID_EUI_64 2 -#define SCSI_ID_NAA 3 -#define SCSI_ID_RELPORT 4 -#define SCSI_ID_TGTGROUP 5 -#define SCSI_ID_LUNGROUP 6 -#define SCSI_ID_MD5 7 -#define SCSI_ID_NAME 8 - -/* - * Supported NAA values. These fit in 4 bits, so the "don't care" value - * cannot conflict with real values. - */ -#define SCSI_ID_NAA_DONT_CARE 0xff -#define SCSI_ID_NAA_IEEE_REG 5 -#define SCSI_ID_NAA_IEEE_REG_EXTENDED 6 - -/* - * Supported Code Set values. - */ -#define SCSI_ID_BINARY 1 -#define SCSI_ID_ASCII 2 - -struct scsi_id_search_values { - u_char id_type; - u_char naa_type; - u_char code_set; -}; - -/* - * Following are the "true" SCSI status codes. Linux has traditionally - * used a 1 bit right and masked version of these. So now CHECK_CONDITION - * and friends (in ) are deprecated. - */ -#define SCSI_CHECK_CONDITION 0x2 -#define SCSI_CONDITION_MET 0x4 -#define SCSI_BUSY 0x8 -#define SCSI_IMMEDIATE 0x10 -#define SCSI_IMMEDIATE_CONDITION_MET 0x14 -#define SCSI_RESERVATION_CONFLICT 0x18 -#define SCSI_COMMAND_TERMINATED 0x22 -#define SCSI_TASK_SET_FULL 0x28 -#define SCSI_ACA_ACTIVE 0x30 -#define SCSI_TASK_ABORTED 0x40 diff --git a/extras/scsi_id/scsi_id.8 b/extras/scsi_id/scsi_id.8 deleted file mode 100644 index 8f83f39020..0000000000 --- a/extras/scsi_id/scsi_id.8 +++ /dev/null @@ -1,119 +0,0 @@ -.TH SCSI_ID 8 "December 2003" "" "Linux Administrator's Manual" -.SH NAME -scsi_id \- retrieve and generate a unique SCSI identifier -.SH SYNOPSIS -.BI scsi_id -[\fIoptions\fP] -.SH "DESCRIPTION" -.B scsi_id -queries a SCSI device via the SCSI INQUIRY vital product data (VPD) page 0x80 or -0x83 and uses the resulting data to generate a value that is unique across -all SCSI devices that properly support page 0x80 or page 0x83. - -If a result is generated it is sent to standard output, and the program -exits with a zero value. If no identifier is output, the program exits -with a non\-zero value. - -\fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP -that require a unique SCSI identifier. - -By default all devices are assumed black listed, the \fB\-\-whitelisted\fP option must -be specified on the command line or in the config file for any useful -behaviour. - -SCSI commands are sent directly to the device via the SG_IO ioctl -interface. - -In order to generate unique values for either page 0x80 or page 0x83, the -serial numbers or world wide names are prefixed as follows. - -Identifiers based on page 0x80 are prefixed by the character 'S', the SCSI -vendor, the SCSI product (model) and then the the serial number returned -by page 0x80. For example: - -.sp -.nf -# /usr/lib/udev/scsi_id \-\-page=0x80 \-\-whitelisted \-\-device=/dev/sda -SIBM 3542 1T05078453 -.fi -.P - -Identifiers based on page 0x83 are prefixed by the identifier type -followed by the page 0x83 identifier. For example, a device with a NAA -(Name Address Authority) type of 3 (also in this case the page 0x83 -identifier starts with the NAA value of 6): - -.sp -.nf -# /usr/lib/udev/scsi_id \-\-page=0x83 \-\-whitelisted \-\-device=/dev/sda -3600a0b80000b174b000000d63efc5c8c -.fi -.P - -.SH OPTIONS -.TP -.BI \-\-blacklisted -The default behaviour \- treat the device as black listed, and do nothing -unless a white listed device is found in the scsi_id config\-file. -.TP -.BI \-\-device=\| device\^ -Send SG_IO commands to \fBdevice\fP, such as \fB/dev/sdc\fP. -.TP -.BI \-\-config=\| config\-file -Read configuration and black/white list entries from -.B config\-file -rather than the default -.B /etc/scsi_id.config -file. -.TP -.BI \-\-whitelisted -Treat the device as white listed. The \fB\-\-whitelisted\fP option must be specified -on the command line or in the scsi_id configuration file for -.B scsi_id -to generate any output. -.TP -.BI \-\-page=\| 0x80 | 0x83 | pre-spc3-83 -Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83. -.sp -The default -behaviour is to query the available VPD pages, and use page 0x83 if found, -else page 0x80 if found, else nothing. -.sp -Page pre-spc3-83 should only be utilized for those scsi devices which -are not compliant with the SPC-2 or SPC-3 format for page 83. While this -option is used for older model 4, 5, and 6 EMC Symmetrix devices, its -use with SPC-2 or SPC-3 compliant devices will fallback to the page 83 -format supported by these devices. -.TP -.BI \-\-replace-whitespace -Reformat the output : replace all whitespaces by underscores. -.TP -.BI \-\-export -Export all data in KEY= format used to import in other programs. -.TP -.BI \-\-verbose -Generate verbose debugging output. -.TP -.BI \-\-version -Display version number and exit. -.RE - -.SH "FILES" -.nf -.ft B -.ft -.TP -\fI/etc/scsi_id.config\fP -Configuration of black/white list entries and per device options: -# one config per line, short match strings match longer strings -# vendor=string[,model=string],options= -vendor="ATA",options=-p 0x80 -.RE -.fi -.LP -.SH "SEE ALSO" -.BR udev (7) -.SH AUTHORS -Developed by Patrick Mansfield based on SCSI ID -source included in earlier linux 2.5 kernels, sg_utils source, and SCSI -specifications. diff --git a/extras/scsi_id/scsi_id.c b/extras/scsi_id/scsi_id.c deleted file mode 100644 index 26b92e3fcd..0000000000 --- a/extras/scsi_id/scsi_id.c +++ /dev/null @@ -1,657 +0,0 @@ -/* - * Copyright (C) IBM Corp. 2003 - * Copyright (C) SUSE Linux Products GmbH, 2006 - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" -#include "scsi_id.h" - -static const struct option options[] = { - { "device", required_argument, NULL, 'd' }, - { "config", required_argument, NULL, 'f' }, - { "page", required_argument, NULL, 'p' }, - { "blacklisted", no_argument, NULL, 'b' }, - { "whitelisted", no_argument, NULL, 'g' }, - { "replace-whitespace", no_argument, NULL, 'u' }, - { "sg-version", required_argument, NULL, 's' }, - { "verbose", no_argument, NULL, 'v' }, - { "version", no_argument, NULL, 'V' }, - { "export", no_argument, NULL, 'x' }, - { "help", no_argument, NULL, 'h' }, - {} -}; - -static const char short_options[] = "d:f:ghip:uvVx"; -static const char dev_short_options[] = "bgp:"; - -static int all_good; -static int dev_specified; -static char config_file[MAX_PATH_LEN] = SYSCONFDIR "/scsi_id.config"; -static enum page_code default_page_code; -static int sg_version = 4; -static int use_stderr; -static int debug; -static int reformat_serial; -static int export; -static char vendor_str[64]; -static char model_str[64]; -static char vendor_enc_str[256]; -static char model_enc_str[256]; -static char revision_str[16]; -static char type_str[16]; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -static void set_type(const char *from, char *to, size_t len) -{ - int type_num; - char *eptr; - char *type = "generic"; - - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 0: - type = "disk"; - break; - case 1: - type = "tape"; - break; - case 4: - type = "optical"; - break; - case 5: - type = "cd"; - break; - case 7: - type = "optical"; - break; - case 0xe: - type = "disk"; - break; - case 0xf: - type = "optical"; - break; - default: - break; - } - } - util_strscpy(to, len, type); -} - -/* - * get_value: - * - * buf points to an '=' followed by a quoted string ("foo") or a string ending - * with a space or ','. - * - * Return a pointer to the NUL terminated string, returns NULL if no - * matches. - */ -static char *get_value(char **buffer) -{ - static char *quote_string = "\"\n"; - static char *comma_string = ",\n"; - char *val; - char *end; - - if (**buffer == '"') { - /* - * skip leading quote, terminate when quote seen - */ - (*buffer)++; - end = quote_string; - } else { - end = comma_string; - } - val = strsep(buffer, end); - if (val && end == quote_string) - /* - * skip trailing quote - */ - (*buffer)++; - - while (isspace(**buffer)) - (*buffer)++; - - return val; -} - -static int argc_count(char *opts) -{ - int i = 0; - while (*opts != '\0') - if (*opts++ == ' ') - i++; - return i; -} - -/* - * get_file_options: - * - * If vendor == NULL, find a line in the config file with only "OPTIONS="; - * if vendor and model are set find the first OPTIONS line in the config - * file that matches. Set argc and argv to match the OPTIONS string. - * - * vendor and model can end in '\n'. - */ -static int get_file_options(struct udev *udev, - const char *vendor, const char *model, - int *argc, char ***newargv) -{ - char *buffer; - FILE *fd; - char *buf; - char *str1; - char *vendor_in, *model_in, *options_in; /* read in from file */ - int lineno; - int c; - int retval = 0; - - dbg(udev, "vendor='%s'; model='%s'\n", vendor, model); - fd = fopen(config_file, "r"); - if (fd == NULL) { - dbg(udev, "can't open %s\n", config_file); - if (errno == ENOENT) { - return 1; - } else { - err(udev, "can't open %s: %s\n", config_file, strerror(errno)); - return -1; - } - } - - /* - * Allocate a buffer rather than put it on the stack so we can - * keep it around to parse any options (any allocated newargv - * points into this buffer for its strings). - */ - buffer = malloc(MAX_BUFFER_LEN); - if (!buffer) { - fclose(fd); - err(udev, "can't allocate memory\n"); - return -1; - } - - *newargv = NULL; - lineno = 0; - while (1) { - vendor_in = model_in = options_in = NULL; - - buf = fgets(buffer, MAX_BUFFER_LEN, fd); - if (buf == NULL) - break; - lineno++; - if (buf[strlen(buffer) - 1] != '\n') { - err(udev, "Config file line %d too long\n", lineno); - break; - } - - while (isspace(*buf)) - buf++; - - /* blank or all whitespace line */ - if (*buf == '\0') - continue; - - /* comment line */ - if (*buf == '#') - continue; - - dbg(udev, "lineno %d: '%s'\n", lineno, buf); - str1 = strsep(&buf, "="); - if (str1 && strcasecmp(str1, "VENDOR") == 0) { - str1 = get_value(&buf); - if (!str1) { - retval = -1; - break; - } - vendor_in = str1; - - str1 = strsep(&buf, "="); - if (str1 && strcasecmp(str1, "MODEL") == 0) { - str1 = get_value(&buf); - if (!str1) { - retval = -1; - break; - } - model_in = str1; - str1 = strsep(&buf, "="); - } - } - - if (str1 && strcasecmp(str1, "OPTIONS") == 0) { - str1 = get_value(&buf); - if (!str1) { - retval = -1; - break; - } - options_in = str1; - } - dbg(udev, "config file line %d:\n" - " vendor '%s'; model '%s'; options '%s'\n", - lineno, vendor_in, model_in, options_in); - /* - * Only allow: [vendor=foo[,model=bar]]options=stuff - */ - if (!options_in || (!vendor_in && model_in)) { - err(udev, "Error parsing config file line %d '%s'\n", lineno, buffer); - retval = -1; - break; - } - if (vendor == NULL) { - if (vendor_in == NULL) { - dbg(udev, "matched global option\n"); - break; - } - } else if ((vendor_in && strncmp(vendor, vendor_in, - strlen(vendor_in)) == 0) && - (!model_in || (strncmp(model, model_in, - strlen(model_in)) == 0))) { - /* - * Matched vendor and optionally model. - * - * Note: a short vendor_in or model_in can - * give a partial match (that is FOO - * matches FOOBAR). - */ - dbg(udev, "matched vendor/model\n"); - break; - } else { - dbg(udev, "no match\n"); - } - } - - if (retval == 0) { - if (vendor_in != NULL || model_in != NULL || - options_in != NULL) { - /* - * Something matched. Allocate newargv, and store - * values found in options_in. - */ - strcpy(buffer, options_in); - c = argc_count(buffer) + 2; - *newargv = calloc(c, sizeof(**newargv)); - if (!*newargv) { - err(udev, "can't allocate memory\n"); - retval = -1; - } else { - *argc = c; - c = 0; - /* - * argv[0] at 0 is skipped by getopt, but - * store the buffer address there for - * later freeing - */ - (*newargv)[c] = buffer; - for (c = 1; c < *argc; c++) - (*newargv)[c] = strsep(&buffer, " \t"); - } - } else { - /* No matches */ - retval = 1; - } - } - if (retval != 0) - free(buffer); - fclose(fd); - return retval; -} - -static int set_options(struct udev *udev, - int argc, char **argv, const char *short_opts, - char *maj_min_dev) -{ - int option; - - /* - * optind is a global extern used by getopt. Since we can call - * set_options twice (once for command line, and once for config - * file) we have to reset this back to 1. - */ - optind = 1; - while (1) { - option = getopt_long(argc, argv, short_opts, options, NULL); - if (option == -1) - break; - - if (optarg) - dbg(udev, "option '%c' arg '%s'\n", option, optarg); - else - dbg(udev, "option '%c'\n", option); - - switch (option) { - case 'b': - all_good = 0; - break; - - case 'd': - dev_specified = 1; - util_strscpy(maj_min_dev, MAX_PATH_LEN, optarg); - break; - - case 'e': - use_stderr = 1; - break; - - case 'f': - util_strscpy(config_file, MAX_PATH_LEN, optarg); - break; - - case 'g': - all_good = 1; - break; - - case 'h': - printf("Usage: scsi_id OPTIONS \n" - " --device= device node for SG_IO commands\n" - " --config= location of config file\n" - " --page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\n" - " --sg-version=3|4 use SGv3 or SGv4\n" - " --blacklisted threat device as blacklisted\n" - " --whitelisted threat device as whitelisted\n" - " --replace-whitespace replace all whitespaces by underscores\n" - " --verbose verbose logging\n" - " --version print version\n" - " --export print values as environment keys\n" - " --help print this help text\n\n"); - exit(0); - - case 'p': - if (strcmp(optarg, "0x80") == 0) { - default_page_code = PAGE_80; - } else if (strcmp(optarg, "0x83") == 0) { - default_page_code = PAGE_83; - } else if (strcmp(optarg, "pre-spc3-83") == 0) { - default_page_code = PAGE_83_PRE_SPC3; - } else { - err(udev, "Unknown page code '%s'\n", optarg); - return -1; - } - break; - - case 's': - sg_version = atoi(optarg); - if (sg_version < 3 || sg_version > 4) { - err(udev, "Unknown SG version '%s'\n", optarg); - return -1; - } - break; - - case 'u': - reformat_serial = 1; - break; - - case 'x': - export = 1; - break; - - case 'v': - debug++; - break; - - case 'V': - printf("%s\n", VERSION); - exit(0); - break; - - default: - exit(1); - } - } - if (optind < argc && !dev_specified) { - dev_specified = 1; - util_strscpy(maj_min_dev, MAX_PATH_LEN, argv[optind]); - } - return 0; -} - -static int per_dev_options(struct udev *udev, - struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) -{ - int retval; - int newargc; - char **newargv = NULL; - int option; - - *good_bad = all_good; - *page_code = default_page_code; - - retval = get_file_options(udev, vendor_str, model_str, &newargc, &newargv); - - optind = 1; /* reset this global extern */ - while (retval == 0) { - option = getopt_long(newargc, newargv, dev_short_options, options, NULL); - if (option == -1) - break; - - if (optarg) - dbg(udev, "option '%c' arg '%s'\n", option, optarg); - else - dbg(udev, "option '%c'\n", option); - - switch (option) { - case 'b': - *good_bad = 0; - break; - - case 'g': - *good_bad = 1; - break; - - case 'p': - if (strcmp(optarg, "0x80") == 0) { - *page_code = PAGE_80; - } else if (strcmp(optarg, "0x83") == 0) { - *page_code = PAGE_83; - } else if (strcmp(optarg, "pre-spc3-83") == 0) { - *page_code = PAGE_83_PRE_SPC3; - } else { - err(udev, "Unknown page code '%s'\n", optarg); - retval = -1; - } - break; - - default: - err(udev, "Unknown or bad option '%c' (0x%x)\n", option, option); - retval = -1; - break; - } - } - - if (newargv) { - free(newargv[0]); - free(newargv); - } - return retval; -} - -static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, const char *path) -{ - int retval; - - dev_scsi->use_sg = sg_version; - - retval = scsi_std_inquiry(udev, dev_scsi, path); - if (retval) - return retval; - - udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); - udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); - - util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); - util_replace_chars(vendor_str, NULL); - util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); - util_replace_chars(model_str, NULL); - set_type(dev_scsi->type, type_str, sizeof(type_str)); - util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); - util_replace_chars(revision_str, NULL); - return 0; -} - -/* - * scsi_id: try to get an id, if one is found, printf it to stdout. - * returns a value passed to exit() - 0 if printed an id, else 1. - */ -static int scsi_id(struct udev *udev, char *maj_min_dev) -{ - struct scsi_id_device dev_scsi; - int good_dev; - int page_code; - int retval = 0; - - memset(&dev_scsi, 0x00, sizeof(struct scsi_id_device)); - - if (set_inq_values(udev, &dev_scsi, maj_min_dev) < 0) { - retval = 1; - goto out; - } - - /* get per device (vendor + model) options from the config file */ - per_dev_options(udev, &dev_scsi, &good_dev, &page_code); - dbg(udev, "per dev options: good %d; page code 0x%x\n", good_dev, page_code); - if (!good_dev) { - retval = 1; - goto out; - } - - /* read serial number from mode pages (no values for optical drives) */ - scsi_get_serial(udev, &dev_scsi, maj_min_dev, page_code, MAX_SERIAL_LEN); - - if (export) { - char serial_str[MAX_SERIAL_LEN]; - - printf("ID_SCSI=1\n"); - printf("ID_VENDOR=%s\n", vendor_str); - printf("ID_VENDOR_ENC=%s\n", vendor_enc_str); - printf("ID_MODEL=%s\n", model_str); - printf("ID_MODEL_ENC=%s\n", model_enc_str); - printf("ID_REVISION=%s\n", revision_str); - printf("ID_TYPE=%s\n", type_str); - if (dev_scsi.serial[0] != '\0') { - util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - util_replace_chars(serial_str, NULL); - printf("ID_SERIAL=%s\n", serial_str); - util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); - util_replace_chars(serial_str, NULL); - printf("ID_SERIAL_SHORT=%s\n", serial_str); - } - if (dev_scsi.wwn[0] != '\0') { - printf("ID_WWN=0x%s\n", dev_scsi.wwn); - if (dev_scsi.wwn_vendor_extension[0] != '\0') { - printf("ID_WWN_VENDOR_EXTENSION=0x%s\n", dev_scsi.wwn_vendor_extension); - printf("ID_WWN_WITH_EXTENSION=0x%s%s\n", dev_scsi.wwn, dev_scsi.wwn_vendor_extension); - } else { - printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn); - } - } - if (dev_scsi.tgpt_group[0] != '\0') { - printf("ID_TARGET_PORT=%s\n", dev_scsi.tgpt_group); - } - if (dev_scsi.unit_serial_number[0] != '\0') { - printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); - } - goto out; - } - - if (dev_scsi.serial[0] == '\0') { - retval = 1; - goto out; - } - - if (reformat_serial) { - char serial_str[MAX_SERIAL_LEN]; - - util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - util_replace_chars(serial_str, NULL); - printf("%s\n", serial_str); - goto out; - } - - printf("%s\n", dev_scsi.serial); -out: - return retval; -} - -int main(int argc, char **argv) -{ - struct udev *udev; - int retval = 0; - char maj_min_dev[MAX_PATH_LEN]; - int newargc; - char **newargv; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("scsi_id"); - udev_set_log_fn(udev, log_fn); - - /* - * Get config file options. - */ - newargv = NULL; - retval = get_file_options(udev, NULL, NULL, &newargc, &newargv); - if (retval < 0) { - retval = 1; - goto exit; - } - if (newargv && (retval == 0)) { - if (set_options(udev, newargc, newargv, short_options, maj_min_dev) < 0) { - retval = 2; - goto exit; - } - free(newargv); - } - - /* - * Get command line options (overriding any config file settings). - */ - if (set_options(udev, argc, argv, short_options, maj_min_dev) < 0) - exit(1); - - if (!dev_specified) { - err(udev, "no device specified\n"); - retval = 1; - goto exit; - } - - retval = scsi_id(udev, maj_min_dev); - -exit: - udev_unref(udev); - udev_log_close(); - return retval; -} diff --git a/extras/scsi_id/scsi_id.h b/extras/scsi_id/scsi_id.h deleted file mode 100644 index f6c269fc59..0000000000 --- a/extras/scsi_id/scsi_id.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) IBM Corp. 2003 - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#define MAX_PATH_LEN 512 - -/* - * MAX_ATTR_LEN: maximum length of the result of reading a sysfs - * attribute. - */ -#define MAX_ATTR_LEN 256 - -/* - * MAX_SERIAL_LEN: the maximum length of the serial number, including - * added prefixes such as vendor and product (model) strings. - */ -#define MAX_SERIAL_LEN 256 - -/* - * MAX_BUFFER_LEN: maximum buffer size and line length used while reading - * the config file. - */ -#define MAX_BUFFER_LEN 256 - -struct scsi_id_device { - char vendor[9]; - char model[17]; - char revision[5]; - char type[33]; - char kernel[64]; - char serial[MAX_SERIAL_LEN]; - char serial_short[MAX_SERIAL_LEN]; - int use_sg; - - /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */ - char unit_serial_number[MAX_SERIAL_LEN]; - - /* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */ - char wwn[17]; - - /* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */ - char wwn_vendor_extension[17]; - - /* NULs if not set - otherwise decimal number */ - char tgpt_group[8]; -}; - -extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); -extern int scsi_get_serial (struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname, - int page_code, int len); - -/* - * Page code values. - */ -enum page_code { - PAGE_83_PRE_SPC3 = -0x83, - PAGE_UNSPECIFIED = 0x00, - PAGE_80 = 0x80, - PAGE_83 = 0x83, -}; - diff --git a/extras/scsi_id/scsi_serial.c b/extras/scsi_id/scsi_serial.c deleted file mode 100644 index 5cde9a54a0..0000000000 --- a/extras/scsi_id/scsi_serial.c +++ /dev/null @@ -1,990 +0,0 @@ -/* - * Copyright (C) IBM Corp. 2003 - * - * Author: Patrick Mansfield - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" -#include "scsi.h" -#include "scsi_id.h" - -/* - * A priority based list of id, naa, and binary/ascii for the identifier - * descriptor in VPD page 0x83. - * - * Brute force search for a match starting with the first value in the - * following id_search_list. This is not a performance issue, since there - * is normally one or some small number of descriptors. - */ -static const struct scsi_id_search_values id_search_list[] = { - { SCSI_ID_TGTGROUP, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_ASCII }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_ASCII }, - /* - * Devices already exist using NAA values that are now marked - * reserved. These should not conflict with other values, or it is - * a bug in the device. As long as we find the IEEE extended one - * first, we really don't care what other ones are used. Using - * don't care here means that a device that returns multiple - * non-IEEE descriptors in a random order will get different - * names. - */ - { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, - { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, - { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, - { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, -}; - -static const char hex_str[]="0123456789abcdef"; - -/* - * Values returned in the result/status, only the ones used by the code - * are used here. - */ - -#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ -#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ -#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ -#define DRIVER_TIMEOUT 0x06 -#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ - -/* The following "category" function returns one of the following */ -#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ -#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ -#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ -#define SG_ERR_CAT_TIMEOUT 3 -#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ -#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ -#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ -#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ - -static int do_scsi_page80_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int max_len); - -static int sg_err_category_new(struct udev *udev, - int scsi_status, int msg_status, int - host_status, int driver_status, const - unsigned char *sense_buffer, int sb_len) -{ - scsi_status &= 0x7e; - - /* - * XXX change to return only two values - failed or OK. - */ - - if (!scsi_status && !host_status && !driver_status) - return SG_ERR_CAT_CLEAN; - - if ((scsi_status == SCSI_CHECK_CONDITION) || - (scsi_status == SCSI_COMMAND_TERMINATED) || - ((driver_status & 0xf) == DRIVER_SENSE)) { - if (sense_buffer && (sb_len > 2)) { - int sense_key; - unsigned char asc; - - if (sense_buffer[0] & 0x2) { - sense_key = sense_buffer[1] & 0xf; - asc = sense_buffer[2]; - } else { - sense_key = sense_buffer[2] & 0xf; - asc = (sb_len > 12) ? sense_buffer[12] : 0; - } - - if (sense_key == RECOVERED_ERROR) - return SG_ERR_CAT_RECOVERED; - else if (sense_key == UNIT_ATTENTION) { - if (0x28 == asc) - return SG_ERR_CAT_MEDIA_CHANGED; - if (0x29 == asc) - return SG_ERR_CAT_RESET; - } else if (sense_key == ILLEGAL_REQUEST) { - return SG_ERR_CAT_NOTSUPPORTED; - } - } - return SG_ERR_CAT_SENSE; - } - if (host_status) { - if ((host_status == DID_NO_CONNECT) || - (host_status == DID_BUS_BUSY) || - (host_status == DID_TIME_OUT)) - return SG_ERR_CAT_TIMEOUT; - } - if (driver_status) { - if (driver_status == DRIVER_TIMEOUT) - return SG_ERR_CAT_TIMEOUT; - } - return SG_ERR_CAT_OTHER; -} - -static int sg_err_category3(struct udev *udev, struct sg_io_hdr *hp) -{ - return sg_err_category_new(udev, - hp->status, hp->msg_status, - hp->host_status, hp->driver_status, - hp->sbp, hp->sb_len_wr); -} - -static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) -{ - return sg_err_category_new(udev, hp->device_status, 0, - hp->transport_status, hp->driver_status, - (unsigned char *)(uintptr_t)hp->response, - hp->response_len); -} - -static int scsi_dump_sense(struct udev *udev, - struct scsi_id_device *dev_scsi, - unsigned char *sense_buffer, int sb_len) -{ - int s; - int code; - int sense_class; - int sense_key; - int asc, ascq; -#ifdef DUMP_SENSE - char out_buffer[256]; - int i, j; -#endif - - /* - * Figure out and print the sense key, asc and ascq. - * - * If you want to suppress these for a particular drive model, add - * a black list entry in the scsi_id config file. - * - * XXX We probably need to: lookup the sense/asc/ascq in a retry - * table, and if found return 1 (after dumping the sense, asc, and - * ascq). So, if/when we get something like a power on/reset, - * we'll retry the command. - */ - - dbg(udev, "got check condition\n"); - - if (sb_len < 1) { - info(udev, "%s: sense buffer empty\n", dev_scsi->kernel); - return -1; - } - - sense_class = (sense_buffer[0] >> 4) & 0x07; - code = sense_buffer[0] & 0xf; - - if (sense_class == 7) { - /* - * extended sense data. - */ - s = sense_buffer[7] + 8; - if (sb_len < s) { - info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", - dev_scsi->kernel, sb_len, s - sb_len); - return -1; - } - if ((code == 0x0) || (code == 0x1)) { - sense_key = sense_buffer[2] & 0xf; - if (s < 14) { - /* - * Possible? - */ - info(udev, "%s: sense result too" " small %d bytes\n", - dev_scsi->kernel, s); - return -1; - } - asc = sense_buffer[12]; - ascq = sense_buffer[13]; - } else if ((code == 0x2) || (code == 0x3)) { - sense_key = sense_buffer[1] & 0xf; - asc = sense_buffer[2]; - ascq = sense_buffer[3]; - } else { - info(udev, "%s: invalid sense code 0x%x\n", - dev_scsi->kernel, code); - return -1; - } - info(udev, "%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", - dev_scsi->kernel, sense_key, asc, ascq); - } else { - if (sb_len < 4) { - info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", - dev_scsi->kernel, sb_len, 4 - sb_len); - return -1; - } - - if (sense_buffer[0] < 15) - info(udev, "%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); - else - info(udev, "%s: sense = %2x %2x\n", - dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); - info(udev, "%s: non-extended sense class %d code 0x%0x\n", - dev_scsi->kernel, sense_class, code); - - } - -#ifdef DUMP_SENSE - for (i = 0, j = 0; (i < s) && (j < 254); i++) { - dbg(udev, "i %d, j %d\n", i, j); - out_buffer[j++] = hex_str[(sense_buffer[i] & 0xf0) >> 4]; - out_buffer[j++] = hex_str[sense_buffer[i] & 0x0f]; - out_buffer[j++] = ' '; - } - out_buffer[j] = '\0'; - info(udev, "%s: sense dump:\n", dev_scsi->kernel); - info(udev, "%s: %s\n", dev_scsi->kernel, out_buffer); - -#endif - return -1; -} - -static int scsi_dump(struct udev *udev, - struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) -{ - if (!io->status && !io->host_status && !io->msg_status && - !io->driver_status) { - /* - * Impossible, should not be called. - */ - info(udev, "%s: called with no error\n", __FUNCTION__); - return -1; - } - - info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", - dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); - if (io->status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(udev, dev_scsi, io->sbp, io->sb_len_wr); - else - return -1; -} - -static int scsi_dump_v4(struct udev *udev, - struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) -{ - if (!io->device_status && !io->transport_status && - !io->driver_status) { - /* - * Impossible, should not be called. - */ - info(udev, "%s: called with no error\n", __FUNCTION__); - return -1; - } - - info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x\n", - dev_scsi->kernel, io->driver_status, io->transport_status, - io->device_status); - if (io->device_status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(udev, dev_scsi, (unsigned char *)(uintptr_t)io->response, - io->response_len); - else - return -1; -} - -static int scsi_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - unsigned char evpd, unsigned char page, - unsigned char *buf, unsigned int buflen) -{ - unsigned char inq_cmd[INQUIRY_CMDLEN] = - { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; - unsigned char sense[SENSE_BUFF_LEN]; - void *io_buf; - struct sg_io_v4 io_v4; - struct sg_io_hdr io_hdr; - int retry = 3; /* rather random */ - int retval; - - if (buflen > SCSI_INQ_BUFF_LEN) { - info(udev, "buflen %d too long\n", buflen); - return -1; - } - -resend: - dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); - - if (dev_scsi->use_sg == 4) { - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof(inq_cmd); - io_v4.request = (uintptr_t)inq_cmd; - io_v4.max_response_len = sizeof(sense); - io_v4.response = (uintptr_t)sense; - io_v4.din_xfer_len = buflen; - io_v4.din_xferp = (uintptr_t)buf; - io_buf = (void *)&io_v4; - } else { - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(inq_cmd); - io_hdr.mx_sb_len = sizeof(sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.dxfer_len = buflen; - io_hdr.dxferp = buf; - io_hdr.cmdp = inq_cmd; - io_hdr.sbp = sense; - io_hdr.timeout = DEF_TIMEOUT; - io_buf = (void *)&io_hdr; - } - - retval = ioctl(fd, SG_IO, io_buf); - if (retval < 0) { - if ((errno == EINVAL || errno == ENOSYS) && dev_scsi->use_sg == 4) { - dev_scsi->use_sg = 3; - goto resend; - } - info(udev, "%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); - goto error; - } - - if (dev_scsi->use_sg == 4) - retval = sg_err_category4(udev, io_buf); - else - retval = sg_err_category3(udev, io_buf); - - switch (retval) { - case SG_ERR_CAT_NOTSUPPORTED: - buf[1] = 0; - /* Fallthrough */ - case SG_ERR_CAT_CLEAN: - case SG_ERR_CAT_RECOVERED: - retval = 0; - break; - - default: - if (dev_scsi->use_sg == 4) - retval = scsi_dump_v4(udev, dev_scsi, io_buf); - else - retval = scsi_dump(udev, dev_scsi, io_buf); - } - - if (!retval) { - retval = buflen; - } else if (retval > 0) { - if (--retry > 0) { - dbg(udev, "%s: Retrying ...\n", dev_scsi->kernel); - goto resend; - } - retval = -1; - } - -error: - if (retval < 0) - info(udev, "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", - dev_scsi->kernel, evpd, page); - - return retval; -} - -/* Get list of supported EVPD pages */ -static int do_scsi_page0_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - unsigned char *buffer, unsigned int len) -{ - int retval; - - memset(buffer, 0, len); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, 0x0, buffer, len); - if (retval < 0) - return 1; - - if (buffer[1] != 0) { - info(udev, "%s: page 0 not available.\n", dev_scsi->kernel); - return 1; - } - if (buffer[3] > len) { - info(udev, "%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); - return 1; - } - - /* - * Following check is based on code once included in the 2.5.x - * kernel. - * - * Some ill behaved devices return the standard inquiry here - * rather than the evpd data, snoop the data to verify. - */ - if (buffer[3] > MODEL_LENGTH) { - /* - * If the vendor id appears in the page assume the page is - * invalid. - */ - if (!strncmp((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) { - info(udev, "%s: invalid page0 data\n", dev_scsi->kernel); - return 1; - } - } - return 0; -} - -/* - * The caller checks that serial is long enough to include the vendor + - * model. - */ -static int prepend_vendor_model(struct udev *udev, - struct scsi_id_device *dev_scsi, char *serial) -{ - int ind; - - strncpy(serial, dev_scsi->vendor, VENDOR_LENGTH); - strncat(serial, dev_scsi->model, MODEL_LENGTH); - ind = strlen(serial); - - /* - * This is not a complete check, since we are using strncat/cpy - * above, ind will never be too large. - */ - if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { - info(udev, "%s: expected length %d, got length %d\n", - dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); - return -1; - } - return ind; -} - -/** - * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill - * serial number. - **/ -static int check_fill_0x83_id(struct udev *udev, - struct scsi_id_device *dev_scsi, - unsigned char *page_83, - const struct scsi_id_search_values - *id_search, char *serial, char *serial_short, - int max_len, char *wwn, - char *wwn_vendor_extension, char *tgpt_group) -{ - int i, j, s, len; - - /* - * ASSOCIATION must be with the device (value 0) - * or with the target port for SCSI_ID_TGTPORT - */ - if ((page_83[1] & 0x30) == 0x10) { - if (id_search->id_type != SCSI_ID_TGTGROUP) - return 1; - } else if ((page_83[1] & 0x30) != 0) { - return 1; - } - - if ((page_83[1] & 0x0f) != id_search->id_type) - return 1; - - /* - * Possibly check NAA sub-type. - */ - if ((id_search->naa_type != SCSI_ID_NAA_DONT_CARE) && - (id_search->naa_type != (page_83[4] & 0xf0) >> 4)) - return 1; - - /* - * Check for matching code set - ASCII or BINARY. - */ - if ((page_83[0] & 0x0f) != id_search->code_set) - return 1; - - /* - * page_83[3]: identifier length - */ - len = page_83[3]; - if ((page_83[0] & 0x0f) != SCSI_ID_ASCII) - /* - * If not ASCII, use two bytes for each binary value. - */ - len *= 2; - - /* - * Add one byte for the NUL termination, and one for the id_type. - */ - len += 2; - if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) - len += VENDOR_LENGTH + MODEL_LENGTH; - - if (max_len < len) { - info(udev, "%s: length %d too short - need %d\n", - dev_scsi->kernel, max_len, len); - return 1; - } - - if (id_search->id_type == SCSI_ID_TGTGROUP && tgpt_group != NULL) { - unsigned int group; - - group = ((unsigned int)page_83[6] << 8) | page_83[7]; - sprintf(tgpt_group,"%x", group); - return 1; - } - - serial[0] = hex_str[id_search->id_type]; - - /* - * For SCSI_ID_VENDOR_SPECIFIC prepend the vendor and model before - * the id since it is not unique across all vendors and models, - * this differs from SCSI_ID_T10_VENDOR, where the vendor is - * included in the identifier. - */ - if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) - if (prepend_vendor_model(udev, dev_scsi, &serial[1]) < 0) { - dbg(udev, "prepend failed\n"); - return 1; - } - - i = 4; /* offset to the start of the identifier */ - s = j = strlen(serial); - if ((page_83[0] & 0x0f) == SCSI_ID_ASCII) { - /* - * ASCII descriptor. - */ - while (i < (4 + page_83[3])) - serial[j++] = page_83[i++]; - } else { - /* - * Binary descriptor, convert to ASCII, using two bytes of - * ASCII for each byte in the page_83. - */ - while (i < (4 + page_83[3])) { - serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; - serial[j++] = hex_str[page_83[i] & 0x0f]; - i++; - } - } - - strcpy(serial_short, &serial[s]); - - if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { - strncpy(wwn, &serial[s], 16); - if (wwn_vendor_extension != NULL) { - strncpy(wwn_vendor_extension, &serial[s + 16], 16); - } - } - - return 0; -} - -/* Extract the raw binary from VPD 0x83 pre-SPC devices */ -static int check_fill_0x83_prespc3(struct udev *udev, - struct scsi_id_device *dev_scsi, - unsigned char *page_83, - const struct scsi_id_search_values - *id_search, char *serial, char *serial_short, int max_len) -{ - int i, j; - - dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); - serial[0] = hex_str[id_search->id_type]; - /* serial has been memset to zero before */ - j = strlen(serial); /* j = 1; */ - - for (i = 0; (i < page_83[3]) && (j < max_len-3); ++i) { - serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; - serial[j++] = hex_str[ page_83[4+i] & 0x0f]; - } - serial[max_len-1] = 0; - strncpy(serial_short, serial, max_len-1); - return 0; -} - - -/* Get device identification VPD page */ -static int do_scsi_page83_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int len, - char *unit_serial_number, char *wwn, - char *wwn_vendor_extension, char *tgpt_group) -{ - int retval; - unsigned int id_ind, j; - unsigned char page_83[SCSI_INQ_BUFF_LEN]; - - /* also pick up the page 80 serial number */ - do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN); - - memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, - SCSI_INQ_BUFF_LEN); - if (retval < 0) - return 1; - - if (page_83[1] != PAGE_83) { - info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); - return 1; - } - - /* - * XXX Some devices (IBM 3542) return all spaces for an identifier if - * the LUN is not actually configured. This leads to identifiers of - * the form: "1 ". - */ - - /* - * Model 4, 5, and (some) model 6 EMC Symmetrix devices return - * a page 83 reply according to SCSI-2 format instead of SPC-2/3. - * - * The SCSI-2 page 83 format returns an IEEE WWN in binary - * encoded hexi-decimal in the 16 bytes following the initial - * 4-byte page 83 reply header. - * - * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part - * of an Identification descriptor. The 3rd byte of the first - * Identification descriptor is a reserved (BSZ) byte field. - * - * Reference the 7th byte of the page 83 reply to determine - * whether the reply is compliant with SCSI-2 or SPC-2/3 - * specifications. A zero value in the 7th byte indicates - * an SPC-2/3 conformant reply, (i.e., the reserved field of the - * first Identification descriptor). This byte will be non-zero - * for a SCSI-2 conformant page 83 reply from these EMC - * Symmetrix models since the 7th byte of the reply corresponds - * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, - * 0x006048. - */ - - if (page_83[6] != 0) - return check_fill_0x83_prespc3(udev, - dev_scsi, page_83, id_search_list, - serial, serial_short, len); - - /* - * Search for a match in the prioritized id_search_list - since WWN ids - * come first we can pick up the WWN in check_fill_0x83_id(). - */ - for (id_ind = 0; - id_ind < sizeof(id_search_list)/sizeof(id_search_list[0]); - id_ind++) { - /* - * Examine each descriptor returned. There is normally only - * one or a small number of descriptors. - */ - for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { - retval = check_fill_0x83_id(udev, - dev_scsi, &page_83[j], - &id_search_list[id_ind], - serial, serial_short, len, - wwn, wwn_vendor_extension, - tgpt_group); - dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, - id_search_list[id_ind].id_type, - id_search_list[id_ind].naa_type, - id_search_list[id_ind].code_set); - if (!retval) { - dbg(udev, " used\n"); - return retval; - } else if (retval < 0) { - dbg(udev, " failed\n"); - return retval; - } else { - dbg(udev, " not used\n"); - } - } - } - return 1; -} - -/* - * Get device identification VPD page for older SCSI-2 device which is not - * compliant with either SPC-2 or SPC-3 format. - * - * Return the hard coded error code value 2 if the page 83 reply is not - * conformant to the SCSI-2 format. - */ -static int do_scsi_page83_prespc3_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int len) -{ - int retval; - int i, j; - unsigned char page_83[SCSI_INQ_BUFF_LEN]; - - memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); - if (retval < 0) - return 1; - - if (page_83[1] != PAGE_83) { - info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); - return 1; - } - /* - * Model 4, 5, and (some) model 6 EMC Symmetrix devices return - * a page 83 reply according to SCSI-2 format instead of SPC-2/3. - * - * The SCSI-2 page 83 format returns an IEEE WWN in binary - * encoded hexi-decimal in the 16 bytes following the initial - * 4-byte page 83 reply header. - * - * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part - * of an Identification descriptor. The 3rd byte of the first - * Identification descriptor is a reserved (BSZ) byte field. - * - * Reference the 7th byte of the page 83 reply to determine - * whether the reply is compliant with SCSI-2 or SPC-2/3 - * specifications. A zero value in the 7th byte indicates - * an SPC-2/3 conformant reply, (i.e., the reserved field of the - * first Identification descriptor). This byte will be non-zero - * for a SCSI-2 conformant page 83 reply from these EMC - * Symmetrix models since the 7th byte of the reply corresponds - * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, - * 0x006048. - */ - if (page_83[6] == 0) - return 2; - - serial[0] = hex_str[id_search_list[0].id_type]; - /* - * The first four bytes contain data, not a descriptor. - */ - i = 4; - j = strlen(serial); - /* - * Binary descriptor, convert to ASCII, - * using two bytes of ASCII for each byte - * in the page_83. - */ - while (i < (page_83[3]+4)) { - serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; - serial[j++] = hex_str[page_83[i] & 0x0f]; - i++; - } - dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); - return 0; -} - -/* Get unit serial number VPD page */ -static int do_scsi_page80_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int max_len) -{ - int retval; - int ser_ind; - int i; - int len; - unsigned char buf[SCSI_INQ_BUFF_LEN]; - - memset(buf, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); - if (retval < 0) - return retval; - - if (buf[1] != PAGE_80) { - info(udev, "%s: Invalid page 0x80\n", dev_scsi->kernel); - return 1; - } - - len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; - if (max_len < len) { - info(udev, "%s: length %d too short - need %d\n", - dev_scsi->kernel, max_len, len); - return 1; - } - /* - * Prepend 'S' to avoid unlikely collision with page 0x83 vendor - * specific type where we prepend '0' + vendor + model. - */ - len = buf[3]; - if (serial != NULL) { - serial[0] = 'S'; - ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]); - if (ser_ind < 0) - return 1; - for (i = 4; i < len + 4; i++, ser_ind++) - serial[ser_ind] = buf[i]; - } - if (serial_short != NULL) { - memcpy(serial_short, &buf[4], len); - serial_short[len] = '\0'; - } - return 0; -} - -int scsi_std_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, const char *devname) -{ - int fd; - unsigned char buf[SCSI_INQ_BUFF_LEN]; - struct stat statbuf; - int err = 0; - - dbg(udev, "opening %s\n", devname); - fd = open(devname, O_RDONLY | O_NONBLOCK); - if (fd < 0) { - info(udev, "scsi_id: cannot open %s: %s\n", - devname, strerror(errno)); - return 1; - } - - if (fstat(fd, &statbuf) < 0) { - info(udev, "scsi_id: cannot stat %s: %s\n", - devname, strerror(errno)); - err = 2; - goto out; - } - sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev), - minor(statbuf.st_rdev)); - - memset(buf, 0, SCSI_INQ_BUFF_LEN); - err = scsi_inquiry(udev, dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); - if (err < 0) - goto out; - - err = 0; - memcpy(dev_scsi->vendor, buf + 8, 8); - dev_scsi->vendor[8] = '\0'; - memcpy(dev_scsi->model, buf + 16, 16); - dev_scsi->model[16] = '\0'; - memcpy(dev_scsi->revision, buf + 32, 4); - dev_scsi->revision[4] = '\0'; - sprintf(dev_scsi->type,"%x", buf[0] & 0x1f); - -out: - close(fd); - return err; -} - -int scsi_get_serial(struct udev *udev, - struct scsi_id_device *dev_scsi, const char *devname, - int page_code, int len) -{ - unsigned char page0[SCSI_INQ_BUFF_LEN]; - int fd = -1; - int cnt; - int ind; - int retval; - - memset(dev_scsi->serial, 0, len); - dbg(udev, "opening %s\n", devname); - srand((unsigned int)getpid()); - for (cnt = 20; cnt > 0; cnt--) { - struct timespec duration; - - fd = open(devname, O_RDONLY | O_NONBLOCK); - if (fd >= 0 || errno != EBUSY) - break; - duration.tv_sec = 0; - duration.tv_nsec = (200 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); - nanosleep(&duration, NULL); - } - if (fd < 0) - return 1; - - if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { - retval = 1; - goto completed; - } else { - retval = 0; - goto completed; - } - } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { - retval = 1; - goto completed; - } else { - retval = 0; - goto completed; - } - } else if (page_code == PAGE_83_PRE_SPC3) { - retval = do_scsi_page83_prespc3_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len); - if (retval) { - /* - * Fallback to servicing a SPC-2/3 compliant page 83 - * inquiry if the page 83 reply format does not - * conform to pre-SPC3 expectations. - */ - if (retval == 2) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { - retval = 1; - goto completed; - } else { - retval = 0; - goto completed; - } - } - else { - retval = 1; - goto completed; - } - } else { - retval = 0; - goto completed; - } - } else if (page_code != 0x00) { - info(udev, "%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); - return 1; - } - - /* - * Get page 0, the page of the pages. By default, try from best to - * worst of supported pages: 0x83 then 0x80. - */ - if (do_scsi_page0_inquiry(udev, dev_scsi, fd, page0, SCSI_INQ_BUFF_LEN)) { - /* - * Don't try anything else. Black list if a specific page - * should be used for this vendor+model, or maybe have an - * optional fall-back to page 0x80 or page 0x83. - */ - retval = 1; - goto completed; - } - - dbg(udev, "%s: Checking page0\n", dev_scsi->kernel); - - for (ind = 4; ind <= page0[3] + 3; ind++) - if (page0[ind] == PAGE_83) - if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { - /* - * Success - */ - retval = 0; - goto completed; - } - - for (ind = 4; ind <= page0[3] + 3; ind++) - if (page0[ind] == PAGE_80) - if (!do_scsi_page80_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, dev_scsi->serial_short, len)) { - /* - * Success - */ - retval = 0; - goto completed; - } - retval = 1; - -completed: - close(fd); - return retval; -} diff --git a/extras/udev-acl/.gitignore b/extras/udev-acl/.gitignore deleted file mode 100644 index 08891fed02..0000000000 --- a/extras/udev-acl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -udev-acl diff --git a/extras/udev-acl/70-udev-acl.rules b/extras/udev-acl/70-udev-acl.rules deleted file mode 100644 index 2dac283101..0000000000 --- a/extras/udev-acl/70-udev-acl.rules +++ /dev/null @@ -1,76 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# Do not use TAG+="udev-acl" outside of this file. This variable is private to -# udev-acl of this udev release and may be replaced at any time. - -ENV{MAJOR}=="", GOTO="acl_end" -ACTION=="remove", GOTO="acl_apply" - -# systemd replaces udev-acl entirely, skip if active -TEST=="/sys/fs/cgroup/systemd", TAG=="uaccess", GOTO="acl_end" - -# PTP/MTP protocol devices, cameras, portable media players -SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="udev-acl" - -# digicams with proprietary protocol -ENV{ID_GPHOTO2}=="*?", TAG+="udev-acl" - -# SCSI and USB scanners -ENV{libsane_matched}=="yes", TAG+="udev-acl" - -# HPLIP devices (necessary for ink level check and HP tool maintenance) -ENV{ID_HPLIP}=="1", TAG+="udev-acl" - -# optical drives -SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="udev-acl" - -# sound devices -SUBSYSTEM=="sound", TAG+="udev-acl" - -# ffado is an userspace driver for firewire sound cards -SUBSYSTEM=="firewire", ENV{ID_FFADO}=="1", TAG+="udev-acl" - -# webcams, frame grabber, TV cards -SUBSYSTEM=="video4linux", TAG+="udev-acl" -SUBSYSTEM=="dvb", TAG+="udev-acl" - -# IIDC devices: industrial cameras and some webcams -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG+="udev-acl" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", TAG+="udev-acl" -# AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="udev-acl" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", TAG+="udev-acl" - -# DRI video devices -SUBSYSTEM=="drm", KERNEL=="card*", TAG+="udev-acl" - -# KVM -SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="udev-acl" - -# smart-card readers -ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" - -# PDA devices -ENV{ID_PDA}=="*?", TAG+="udev-acl" - -# Programmable remote control -ENV{ID_REMOTE_CONTROL}=="1", TAG+="udev-acl" - -# joysticks -SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" - -# color measurement devices -ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="udev-acl" - -# DDC/CI device, usually high-end monitors such as the DreamColor -ENV{DDC_DEVICE}=="*?", TAG+="udev-acl" - -# media player raw devices (for user-mode drivers, Android SDK, etc.) -SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="udev-acl" - -# apply ACL for all locally logged in users -LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ - RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" - -LABEL="acl_end" diff --git a/extras/udev-acl/udev-acl.c b/extras/udev-acl/udev-acl.c deleted file mode 100644 index 41e2536e03..0000000000 --- a/extras/udev-acl/udev-acl.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright (C) 2009 Kay Sievers - * - * 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; either version 2 of the - * License, or (at your option) any later version. - * - * 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: - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int debug; - -enum{ - ACTION_NONE = 0, - ACTION_REMOVE, - ACTION_ADD, - ACTION_CHANGE -}; - -static int set_facl(const char* filename, uid_t uid, int add) -{ - int get; - acl_t acl; - acl_entry_t entry = NULL; - acl_entry_t e; - acl_permset_t permset; - int ret; - - /* don't touch ACLs for root */ - if (uid == 0) - return 0; - - /* read current record */ - acl = acl_get_file(filename, ACL_TYPE_ACCESS); - if (!acl) - return -1; - - /* locate ACL_USER entry for uid */ - get = acl_get_entry(acl, ACL_FIRST_ENTRY, &e); - while (get == 1) { - acl_tag_t t; - - acl_get_tag_type(e, &t); - if (t == ACL_USER) { - uid_t *u; - - u = (uid_t*)acl_get_qualifier(e); - if (u == NULL) { - ret = -1; - goto out; - } - if (*u == uid) { - entry = e; - acl_free(u); - break; - } - acl_free(u); - } - - get = acl_get_entry(acl, ACL_NEXT_ENTRY, &e); - } - - /* remove ACL_USER entry for uid */ - if (!add) { - if (entry == NULL) { - ret = 0; - goto out; - } - acl_delete_entry(acl, entry); - goto update; - } - - /* create ACL_USER entry for uid */ - if (entry == NULL) { - ret = acl_create_entry(&acl, &entry); - if (ret != 0) - goto out; - acl_set_tag_type(entry, ACL_USER); - acl_set_qualifier(entry, &uid); - } - - /* add permissions for uid */ - acl_get_permset(entry, &permset); - acl_add_perm(permset, ACL_READ|ACL_WRITE); -update: - /* update record */ - if (debug) - printf("%c%u %s\n", add ? '+' : '-', uid, filename); - acl_calc_mask(&acl); - ret = acl_set_file(filename, ACL_TYPE_ACCESS, acl); - if (ret != 0) - goto out; -out: - acl_free(acl); - return ret; -} - -/* check if a given uid is listed */ -static int uid_in_list(GSList *list, uid_t uid) -{ - GSList *l; - - for (l = list; l != NULL; l = g_slist_next(l)) - if (uid == GPOINTER_TO_UINT(l->data)) - return 1; - return 0; -} - -/* return list of current uids of local active sessions */ -static GSList *uids_with_local_active_session(const char *own_id) -{ - GSList *list = NULL; - GKeyFile *keyfile; - - keyfile = g_key_file_new(); - if (g_key_file_load_from_file(keyfile, "/var/run/ConsoleKit/database", 0, NULL)) { - gchar **groups; - - groups = g_key_file_get_groups(keyfile, NULL); - if (groups != NULL) { - int i; - - for (i = 0; groups[i] != NULL; i++) { - uid_t u; - - if (!g_str_has_prefix(groups[i], "Session ")) - continue; - if (own_id != NULL &&g_str_has_suffix(groups[i], own_id)) - continue; - if (!g_key_file_get_boolean(keyfile, groups[i], "is_local", NULL)) - continue; - if (!g_key_file_get_boolean(keyfile, groups[i], "is_active", NULL)) - continue; - u = g_key_file_get_integer(keyfile, groups[i], "uid", NULL); - if (u > 0 && !uid_in_list(list, u)) - list = g_slist_prepend(list, GUINT_TO_POINTER(u)); - } - g_strfreev(groups); - } - } - g_key_file_free(keyfile); - - return list; -} - -/* ConsoleKit calls us with special variables */ -static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, const char **remove_session_id, int *action) -{ - int a = ACTION_NONE; - uid_t u = 0; - uid_t u2 = 0; - const char *s; - const char *s2; - const char *old_session = NULL; - - if (ck_action == NULL || strcmp(ck_action, "seat_active_session_changed") != 0) - return -1; - - /* We can have one of: remove, add, change, no-change */ - s = getenv("CK_SEAT_OLD_SESSION_ID"); - s2 = getenv("CK_SEAT_SESSION_ID"); - if (s == NULL && s2 == NULL) { - return -1; - } else if (s2 == NULL) { - a = ACTION_REMOVE; - } else if (s == NULL) { - a = ACTION_ADD; - } else { - a = ACTION_CHANGE; - } - - switch (a) { - case ACTION_ADD: - s = getenv("CK_SEAT_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - - s = getenv("CK_SEAT_SESSION_IS_LOCAL"); - if (s == NULL) - return -1; - if (strcmp(s, "true") != 0) - return 0; - - break; - case ACTION_REMOVE: - s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - - s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); - if (s == NULL) - return -1; - if (strcmp(s, "true") != 0) - return 0; - - old_session = getenv("CK_SEAT_OLD_SESSION_ID"); - if (old_session == NULL) - return -1; - - break; - case ACTION_CHANGE: - s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - s = getenv("CK_SEAT_SESSION_USER_UID"); - if (s == NULL) - return -1; - u2 = strtoul(s, NULL, 10); - - s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); - s2 = getenv("CK_SEAT_SESSION_IS_LOCAL"); - if (s == NULL || s2 == NULL) - return -1; - /* don't process non-local session changes */ - if (strcmp(s, "true") != 0 && strcmp(s2, "true") != 0) - return 0; - - if (strcmp(s, "true") == 0 && strcmp(s, "true") == 0) { - /* process the change */ - if (u == u2) { - /* special case: we noop if we are - * changing between local sessions for - * the same uid */ - a = ACTION_NONE; - } - old_session = getenv("CK_SEAT_OLD_SESSION_ID"); - if (old_session == NULL) - return -1; - } else if (strcmp(s, "true") == 0) { - /* only process the removal */ - a = ACTION_REMOVE; - old_session = getenv("CK_SEAT_OLD_SESSION_ID"); - if (old_session == NULL) - return -1; - } else if (strcmp(s2, "true") == 0) { - /* only process the addition */ - a = ACTION_ADD; - u = u2; - } - break; - } - - *remove_session_id = old_session; - *uid = u; - *uid2 = u2; - *action = a; - return 0; -} - -/* add or remove a ACL for a given uid from all matching devices */ -static void apply_acl_to_devices(uid_t uid, int add) -{ - struct udev *udev; - struct udev_enumerate *enumerate; - struct udev_list_entry *list_entry; - - /* iterate over all devices tagged with ACL_SET */ - udev = udev_new(); - enumerate = udev_enumerate_new(udev); - udev_enumerate_add_match_tag(enumerate, "udev-acl"); - udev_enumerate_scan_devices(enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; - const char *node; - - device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), - udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - node = udev_device_get_devnode(device); - if (node == NULL) { - udev_device_unref(device); - continue; - } - set_facl(node, uid, add); - udev_device_unref(device); - } - udev_enumerate_unref(enumerate); - udev_unref(udev); -} - -static void -remove_uid (uid_t uid, const char *remove_session_id) -{ - /* - * Remove ACL for given uid from all matching devices - * when there is currently no local active session. - */ - GSList *list; - - list = uids_with_local_active_session(remove_session_id); - if (!uid_in_list(list, uid)) - apply_acl_to_devices(uid, 0); - g_slist_free(list); -} - -int main (int argc, char* argv[]) -{ - static const struct option options[] = { - { "action", required_argument, NULL, 'a' }, - { "device", required_argument, NULL, 'D' }, - { "user", required_argument, NULL, 'u' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - int action = -1; - const char *device = NULL; - bool uid_given = false; - uid_t uid = 0; - uid_t uid2 = 0; - const char* remove_session_id = NULL; - int rc = 0; - - /* valgrind is more important to us than a slice allocator */ - g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, 1); - - while (1) { - int option; - - option = getopt_long(argc, argv, "+a:D:u:dh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'a': - if (strcmp(optarg, "remove") == 0) - action = ACTION_REMOVE; - else - action = ACTION_ADD; - break; - case 'D': - device = optarg; - break; - case 'u': - uid_given = true; - uid = strtoul(optarg, NULL, 10); - break; - case 'd': - debug = 1; - break; - case 'h': - printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n"); - goto out; - } - } - - if (action < 0 && device == NULL && !uid_given) - if (!consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action)) - uid_given = true; - - if (action < 0) { - fprintf(stderr, "missing action\n\n"); - rc = 2; - goto out; - } - - if (device != NULL && uid_given) { - fprintf(stderr, "only one option, --device=DEVICEFILE or --user=UID expected\n\n"); - rc = 3; - goto out; - } - - if (uid_given) { - switch (action) { - case ACTION_ADD: - /* Add ACL for given uid to all matching devices. */ - apply_acl_to_devices(uid, 1); - break; - case ACTION_REMOVE: - remove_uid(uid, remove_session_id); - break; - case ACTION_CHANGE: - remove_uid(uid, remove_session_id); - apply_acl_to_devices(uid2, 1); - break; - case ACTION_NONE: - goto out; - break; - default: - g_assert_not_reached(); - break; - } - } else if (device != NULL) { - /* - * Add ACLs for all current session uids to a given device. - * - * Or remove ACLs for uids which do not have any current local - * active session. Remove is not really interesting, because in - * most cases the device node is removed anyway. - */ - GSList *list; - GSList *l; - - list = uids_with_local_active_session(NULL); - for (l = list; l != NULL; l = g_slist_next(l)) { - uid_t u; - - u = GPOINTER_TO_UINT(l->data); - if (action == ACTION_ADD || !uid_in_list(list, u)) - set_facl(device, u, action == ACTION_ADD); - } - g_slist_free(list); - } else { - fprintf(stderr, "--device=DEVICEFILE or --user=UID expected\n\n"); - rc = 3; - } -out: - return rc; -} diff --git a/extras/v4l_id/.gitignore b/extras/v4l_id/.gitignore deleted file mode 100644 index dffced9f08..0000000000 --- a/extras/v4l_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -v4l_id diff --git a/extras/v4l_id/60-persistent-v4l.rules b/extras/v4l_id/60-persistent-v4l.rules deleted file mode 100644 index 93c5ee8c27..0000000000 --- a/extras/v4l_id/60-persistent-v4l.rules +++ /dev/null @@ -1,20 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="persistent_v4l_end" -SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" -ENV{MAJOR}=="", GOTO="persistent_v4l_end" - -IMPORT{program}="v4l_id $devnode" - -SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" -KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" - -# check for valid "index" number -TEST!="index", GOTO="persistent_v4l_end" -ATTR{index}!="?*", GOTO="persistent_v4l_end" - -IMPORT{builtin}="path_id" -ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" -ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" - -LABEL="persistent_v4l_end" diff --git a/extras/v4l_id/v4l_id.c b/extras/v4l_id/v4l_id.c deleted file mode 100644 index 21cb3285ad..0000000000 --- a/extras/v4l_id/v4l_id.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2009 Kay Sievers - * Copyright (c) 2009 Filippo Argiolas - * - * 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; either version 2 of the - * License, or (at your option) any later version. - * - * 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: - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int main (int argc, char *argv[]) -{ - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - {} - }; - int fd; - char *device; - struct v4l2_capability v2cap; - - while (1) { - int option; - - option = getopt_long(argc, argv, "h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'h': - printf("Usage: v4l_id [--help] \n\n"); - return 0; - default: - return 1; - } - } - device = argv[optind]; - - if (device == NULL) - return 2; - fd = open (device, O_RDONLY); - if (fd < 0) - return 3; - - if (ioctl (fd, VIDIOC_QUERYCAP, &v2cap) == 0) { - printf("ID_V4L_VERSION=2\n"); - printf("ID_V4L_PRODUCT=%s\n", v2cap.card); - printf("ID_V4L_CAPABILITIES=:"); - if ((v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0) - printf("capture:"); - if ((v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) > 0) - printf("video_output:"); - if ((v2cap.capabilities & V4L2_CAP_VIDEO_OVERLAY) > 0) - printf("video_overlay:"); - if ((v2cap.capabilities & V4L2_CAP_AUDIO) > 0) - printf("audio:"); - if ((v2cap.capabilities & V4L2_CAP_TUNER) > 0) - printf("tuner:"); - if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0) - printf("radio:"); - printf("\n"); - } - - close (fd); - return 0; -} diff --git a/libudev/.gitignore b/libudev/.gitignore deleted file mode 100644 index 74a5f1d379..0000000000 --- a/libudev/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -test-libudev -libudev.pc -libudev.so* - diff --git a/libudev/COPYING b/libudev/COPYING deleted file mode 100644 index 8add30ad59..0000000000 --- a/libudev/COPYING +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/libudev/docs/.gitignore b/libudev/docs/.gitignore deleted file mode 100644 index 286f244fa2..0000000000 --- a/libudev/docs/.gitignore +++ /dev/null @@ -1,18 +0,0 @@ -libudev-overrides.txt -html/ -tmpl/ -xml/ -*.stamp -*.bak -version.xml -libudev-decl-list.txt -libudev-decl.txt -libudev-undeclared.txt -libudev-undocumented.txt -libudev-unused.txt -libudev.args -libudev.hierarchy -libudev.interfaces -libudev.prerequisites -libudev.signals - diff --git a/libudev/docs/Makefile.am b/libudev/docs/Makefile.am deleted file mode 100644 index 965902627f..0000000000 --- a/libudev/docs/Makefile.am +++ /dev/null @@ -1,99 +0,0 @@ -## Process this file with automake to produce Makefile.in - -# We require automake 1.10 at least. -AUTOMAKE_OPTIONS = 1.10 - -# This is a blank Makefile.am for using gtk-doc. -# Copy this to your project's API docs directory and modify the variables to -# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples -# of using the various options. - -# The name of the module, e.g. 'glib'. -DOC_MODULE=libudev - -# Uncomment for versioned docs and specify the version of the module, e.g. '2'. -#DOC_MODULE_VERSION=2 - -# The top-level SGML file. You can change this if you want to. -DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml - -# The directory containing the source code. Relative to $(srcdir). -# gtk-doc will search all .c & .h files beneath here for inline comments -# documenting the functions and macros. -# e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR=.. - -# Extra options to pass to gtkdoc-scangobj. Not normally needed. -SCANGOBJ_OPTIONS= - -# Extra options to supply to gtkdoc-scan. -# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" -SCAN_OPTIONS= - -# Extra options to supply to gtkdoc-mkdb. -# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml -MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space udev - -# Extra options to supply to gtkdoc-mktmpl -# e.g. MKTMPL_OPTIONS=--only-section-tmpl -MKTMPL_OPTIONS= - -# Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS=--path=$(abs_srcdir) --path=$(abs_builddir) - -# Extra options to supply to gtkdoc-fixref. Not normally needed. -# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html -FIXXREF_OPTIONS= - -# Used for dependencies. The docs will be rebuilt if any of these change. -# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h -# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB=$(top_srcdir)/libudev/libudev*.h -CFILE_GLOB=$(top_srcdir)/libudev/libudev*.c - -# Extra header to include when scanning, which are not under DOC_SOURCE_DIR -# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h -EXTRA_HFILES= - -# Header files to ignore when scanning. Use base file name, no paths -# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES= libudev-private.h - -# Images to copy into HTML directory. -# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png -HTML_IMAGES= - -# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). -# e.g. content_files=running.sgml building.sgml changes-2.0.sgml -content_files = version.xml - -# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded -# These files must be listed here *and* in content_files -# e.g. expand_content_files=running.sgml -expand_content_files= - -# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. -# Only needed if you are using gtkdoc-scangobj to dynamically query widget -# signals and properties. -# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) -# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -GTKDOC_CFLAGS= -GTKDOC_LIBS= - -# This includes the standard gtk-doc make rules, copied by gtkdocize. -include $(top_srcdir)/gtk-doc.make - -# Other files to distribute -# e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST += version.xml.in - -# Files not to distribute -# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types -# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt -#DISTCLEANFILES += - -# Comment this out if you want your docs-status tested during 'make check' -if ENABLE_GTK_DOC -#TESTS_ENVIRONMENT = cd $(srcsrc) -#TESTS = $(GTKDOC_CHECK) -endif diff --git a/libudev/docs/libudev-docs.xml b/libudev/docs/libudev-docs.xml deleted file mode 100644 index b7feb45529..0000000000 --- a/libudev/docs/libudev-docs.xml +++ /dev/null @@ -1,32 +0,0 @@ - - -]> - - - libudev Reference Manual - for libudev version &version; - - 2009-2011 - Kay Sievers <kay.sievers@vrfy.org> - - - - - libudev - - - - - - - - - - - API Index - - - diff --git a/libudev/docs/libudev-overrides.txt b/libudev/docs/libudev-overrides.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libudev/docs/libudev-sections.txt b/libudev/docs/libudev-sections.txt deleted file mode 100644 index 15c3e934b5..0000000000 --- a/libudev/docs/libudev-sections.txt +++ /dev/null @@ -1,127 +0,0 @@ -
            -libudev -udev -udev -udev_ref -udev_unref -udev_new -udev_set_log_fn -udev_get_log_priority -udev_set_log_priority -udev_get_sys_path -udev_get_dev_path -udev_get_run_path -udev_get_userdata -udev_set_userdata -
            - -
            -libudev-list -udev_list -udev_list_entry -udev_list_entry_get_next -udev_list_entry_get_by_name -udev_list_entry_get_name -udev_list_entry_get_value -udev_list_entry_foreach -
            - -
            -libudev-device -udev_device -udev_device -udev_device_ref -udev_device_unref -udev_device_get_udev -udev_device_new_from_syspath -udev_device_new_from_devnum -udev_device_new_from_subsystem_sysname -udev_device_new_from_environment -udev_device_get_parent -udev_device_get_parent_with_subsystem_devtype -udev_device_get_devpath -udev_device_get_subsystem -udev_device_get_devtype -udev_device_get_syspath -udev_device_get_sysname -udev_device_get_sysnum -udev_device_get_devnode -udev_device_get_is_initialized -udev_device_get_devlinks_list_entry -udev_device_get_properties_list_entry -udev_device_get_tags_list_entry -udev_device_get_property_value -udev_device_get_driver -udev_device_get_devnum -udev_device_get_action -udev_device_get_sysattr_value -udev_device_get_sysattr_list_entry -udev_device_get_seqnum -udev_device_get_usec_since_initialized -udev_device_has_tag -
            - -
            -libudev-monitor -udev_monitor -udev_monitor -udev_monitor_ref -udev_monitor_unref -udev_monitor_get_udev -udev_monitor_new_from_netlink -udev_monitor_new_from_socket -udev_monitor_enable_receiving -udev_monitor_set_receive_buffer_size -udev_monitor_get_fd -udev_monitor_receive_device -udev_monitor_filter_add_match_subsystem_devtype -udev_monitor_filter_add_match_tag -udev_monitor_filter_update -udev_monitor_filter_remove -
            - -
            -libudev-enumerate -udev_enumerate -udev_enumerate -udev_enumerate_ref -udev_enumerate_unref -udev_enumerate_get_udev -udev_enumerate_new -udev_enumerate_add_match_subsystem -udev_enumerate_add_nomatch_subsystem -udev_enumerate_add_match_sysattr -udev_enumerate_add_nomatch_sysattr -udev_enumerate_add_match_property -udev_enumerate_add_match_tag -udev_enumerate_add_match_parent -udev_enumerate_add_match_is_initialized -udev_enumerate_add_match_sysname -udev_enumerate_add_syspath -udev_enumerate_scan_devices -udev_enumerate_scan_subsystems -udev_enumerate_get_list_entry -
            - -
            -libudev-queue -udev_queue -udev_queue -udev_queue_ref -udev_queue_unref -udev_queue_get_udev -udev_queue_new -udev_queue_get_udev_is_active -udev_queue_get_queue_is_empty -udev_queue_get_seqnum_is_finished -udev_queue_get_seqnum_sequence_is_finished -udev_queue_get_queued_list_entry -udev_queue_get_kernel_seqnum -udev_queue_get_udev_seqnum -
            - -
            -libudev-util -udev_util -udev_util_encode_string -
            diff --git a/libudev/docs/libudev.types b/libudev/docs/libudev.types deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libudev/docs/version.xml.in b/libudev/docs/version.xml.in deleted file mode 100644 index d78bda9342..0000000000 --- a/libudev/docs/version.xml.in +++ /dev/null @@ -1 +0,0 @@ -@VERSION@ diff --git a/libudev/libudev-device-private.c b/libudev/libudev-device-private.c deleted file mode 100644 index 0864919301..0000000000 --- a/libudev/libudev-device-private.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2010 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static void udev_device_tag(struct udev_device *dev, const char *tag, bool add) -{ - const char *id; - struct udev *udev = udev_device_get_udev(dev); - char filename[UTIL_PATH_SIZE]; - - id = udev_device_get_id_filename(dev); - if (id == NULL) - return; - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags/", tag, "/", id, NULL); - - if (add) { - int fd; - - util_create_path(udev, filename); - fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); - if (fd >= 0) - close(fd); - } else { - unlink(filename); - } -} - -int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add) -{ - struct udev_list_entry *list_entry; - bool found; - - if (add && dev_old != NULL) { - /* delete possible left-over tags */ - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev_old)) { - const char *tag_old = udev_list_entry_get_name(list_entry); - struct udev_list_entry *list_entry_current; - - found = false; - udev_list_entry_foreach(list_entry_current, udev_device_get_tags_list_entry(dev)) { - const char *tag = udev_list_entry_get_name(list_entry_current); - - if (strcmp(tag, tag_old) == 0) { - found = true; - break; - } - } - if (!found) - udev_device_tag(dev_old, tag_old, false); - } - } - - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev)) - udev_device_tag(dev, udev_list_entry_get_name(list_entry), add); - - return 0; -} - -static bool device_has_info(struct udev_device *udev_device) -{ - struct udev_list_entry *list_entry; - - if (udev_device_get_devlinks_list_entry(udev_device) != NULL) - return true; - if (udev_device_get_devlink_priority(udev_device) != 0) - return true; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_num(list_entry)) - return true; - if (udev_device_get_tags_list_entry(udev_device) != NULL) - return true; - if (udev_device_get_watch_handle(udev_device) >= 0) - return true; - return false; -} - -int udev_device_update_db(struct udev_device *udev_device) -{ - bool has_info; - const char *id; - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - char filename_tmp[UTIL_PATH_SIZE]; - FILE *f; - - id = udev_device_get_id_filename(udev_device); - if (id == NULL) - return -1; - - has_info = device_has_info(udev_device); - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); - - /* do not store anything for otherwise empty devices */ - if (!has_info && - major(udev_device_get_devnum(udev_device)) == 0 && - udev_device_get_ifindex(udev_device) == 0) { - unlink(filename); - return 0; - } - - /* write a database file */ - util_strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL); - util_create_path(udev, filename_tmp); - f = fopen(filename_tmp, "we"); - if (f == NULL) { - err(udev, "unable to create temporary db file '%s': %m\n", filename_tmp); - return -1; - } - - /* - * set 'sticky' bit to indicate that we should not clean the - * database when we transition from initramfs to the real root - */ - if (udev_device_get_db_persist(udev_device)) - fchmod(fileno(f), 01644); - - if (has_info) { - struct udev_list_entry *list_entry; - - if (major(udev_device_get_devnum(udev_device)) > 0) { - size_t devlen = strlen(udev_get_dev_path(udev))+1; - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) - fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); - if (udev_device_get_devlink_priority(udev_device) != 0) - fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); - if (udev_device_get_watch_handle(udev_device) >= 0) - fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); - } - - if (udev_device_get_usec_initialized(udev_device) > 0) - fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device)); - - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - if (!udev_list_entry_get_num(list_entry)) - continue; - fprintf(f, "E:%s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - } - - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) - fprintf(f, "G:%s\n", udev_list_entry_get_name(list_entry)); - } - - fclose(f); - rename(filename_tmp, filename); - info(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty", - filename, udev_device_get_devpath(udev_device)); - return 0; -} - -int udev_device_delete_db(struct udev_device *udev_device) -{ - const char *id; - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - - id = udev_device_get_id_filename(udev_device); - if (id == NULL) - return -1; - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); - unlink(filename); - return 0; -} diff --git a/libudev/libudev-device.c b/libudev/libudev-device.c deleted file mode 100644 index e5950bb4b1..0000000000 --- a/libudev/libudev-device.c +++ /dev/null @@ -1,1737 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2010 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/** - * SECTION:libudev-device - * @short_description: kernel sys devices - * - * Representation of kernel sys devices. Devices are uniquely identified - * by their syspath, every device has exactly one path in the kernel sys - * filesystem. Devices usually belong to a kernel subsystem, and and have - * a unique name inside that subsystem. - */ - -/** - * udev_device: - * - * Opaque object representing one kernel sys device. - */ -struct udev_device { - struct udev *udev; - struct udev_device *parent_device; - char *syspath; - const char *devpath; - char *sysname; - const char *sysnum; - char *devnode; - mode_t devnode_mode; - char *subsystem; - char *devtype; - char *driver; - char *action; - char *devpath_old; - char *id_filename; - char **envp; - char *monitor_buf; - size_t monitor_buf_len; - struct udev_list devlinks_list; - struct udev_list properties_list; - struct udev_list sysattr_value_list; - struct udev_list sysattr_list; - struct udev_list tags_list; - unsigned long long int seqnum; - unsigned long long int usec_initialized; - int devlink_priority; - int refcount; - dev_t devnum; - int ifindex; - int watch_handle; - int maj, min; - bool parent_set; - bool subsystem_set; - bool devtype_set; - bool devlinks_uptodate; - bool envp_uptodate; - bool tags_uptodate; - bool driver_set; - bool info_loaded; - bool db_loaded; - bool uevent_loaded; - bool is_initialized; - bool sysattr_list_read; - bool db_persist; -}; - -/** - * udev_device_get_seqnum: - * @udev_device: udev device - * - * This is only valid if the device was received through a monitor. Devices read from - * sys do not have a sequence number. - * - * Returns: the kernel event sequence number, or 0 if there is no sequence number available. - **/ -UDEV_EXPORT unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return 0; - return udev_device->seqnum; -} - -static int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) -{ - char num[32]; - - udev_device->seqnum = seqnum; - snprintf(num, sizeof(num), "%llu", seqnum); - udev_device_add_property(udev_device, "SEQNUM", num); - return 0; -} - -int udev_device_get_ifindex(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->ifindex; -} - -static int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) -{ - char num[32]; - - udev_device->ifindex = ifindex; - snprintf(num, sizeof(num), "%u", ifindex); - udev_device_add_property(udev_device, "IFINDEX", num); - return 0; -} - -/** - * udev_device_get_devnum: - * @udev_device: udev device - * - * Returns: the device major/minor number. - **/ -UDEV_EXPORT dev_t udev_device_get_devnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return makedev(0, 0); - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->devnum; -} - -static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) -{ - char num[32]; - - udev_device->devnum = devnum; - - snprintf(num, sizeof(num), "%u", major(devnum)); - udev_device_add_property(udev_device, "MAJOR", num); - snprintf(num, sizeof(num), "%u", minor(devnum)); - udev_device_add_property(udev_device, "MINOR", num); - return 0; -} - -const char *udev_device_get_devpath_old(struct udev_device *udev_device) -{ - return udev_device->devpath_old; -} - -static int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) -{ - const char *pos; - - free(udev_device->devpath_old); - udev_device->devpath_old = strdup(devpath_old); - if (udev_device->devpath_old == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); - - pos = strrchr(udev_device->devpath_old, '/'); - if (pos == NULL) - return -EINVAL; - return 0; -} - -/** - * udev_device_get_driver: - * @udev_device: udev device - * - * Returns: the driver string, or #NULL if there is no driver attached. - **/ -UDEV_EXPORT const char *udev_device_get_driver(struct udev_device *udev_device) -{ - char driver[UTIL_NAME_SIZE]; - - if (udev_device == NULL) - return NULL; - if (!udev_device->driver_set) { - udev_device->driver_set = true; - if (util_get_sys_core_link_value(udev_device->udev, "driver", udev_device->syspath, driver, sizeof(driver)) > 0) - udev_device->driver = strdup(driver); - } - return udev_device->driver; -} - -static int udev_device_set_driver(struct udev_device *udev_device, const char *driver) -{ - free(udev_device->driver); - udev_device->driver = strdup(driver); - if (udev_device->driver == NULL) - return -ENOMEM; - udev_device->driver_set = true; - udev_device_add_property(udev_device, "DRIVER", udev_device->driver); - return 0; -} - -/** - * udev_device_get_devtype: - * @udev_device: udev device - * - * Retrieve the devtype string of the udev device. - * - * Returns: the devtype name of the udev device, or #NULL if it can not be determined - **/ -UDEV_EXPORT const char *udev_device_get_devtype(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->devtype_set) { - udev_device->devtype_set = true; - udev_device_read_uevent_file(udev_device); - } - return udev_device->devtype; -} - -static int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) -{ - free(udev_device->devtype); - udev_device->devtype = strdup(devtype); - if (udev_device->devtype == NULL) - return -ENOMEM; - udev_device->devtype_set = true; - udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); - return 0; -} - -static int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) -{ - free(udev_device->subsystem); - udev_device->subsystem = strdup(subsystem); - if (udev_device->subsystem == NULL) - return -ENOMEM; - udev_device->subsystem_set = true; - udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); - return 0; -} - -/** - * udev_device_get_subsystem: - * @udev_device: udev device - * - * Retrieve the subsystem string of the udev device. The string does not - * contain any "/". - * - * Returns: the subsystem name of the udev device, or #NULL if it can not be determined - **/ -UDEV_EXPORT const char *udev_device_get_subsystem(struct udev_device *udev_device) -{ - char subsystem[UTIL_NAME_SIZE]; - - if (udev_device == NULL) - return NULL; - if (!udev_device->subsystem_set) { - udev_device->subsystem_set = true; - /* read "subsystem" link */ - if (util_get_sys_core_link_value(udev_device->udev, "subsystem", udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { - udev_device_set_subsystem(udev_device, subsystem); - return udev_device->subsystem; - } - /* implicit names */ - if (strncmp(udev_device->devpath, "/module/", 8) == 0) { - udev_device_set_subsystem(udev_device, "module"); - return udev_device->subsystem; - } - if (strstr(udev_device->devpath, "/drivers/") != NULL) { - udev_device_set_subsystem(udev_device, "drivers"); - return udev_device->subsystem; - } - if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || - strncmp(udev_device->devpath, "/class/", 7) == 0 || - strncmp(udev_device->devpath, "/bus/", 5) == 0) { - udev_device_set_subsystem(udev_device, "subsystem"); - return udev_device->subsystem; - } - } - return udev_device->subsystem; -} - -mode_t udev_device_get_devnode_mode(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->devnode_mode; -} - -static int udev_device_set_devnode_mode(struct udev_device *udev_device, mode_t mode) -{ - char num[32]; - - udev_device->devnode_mode = mode; - snprintf(num, sizeof(num), "%#o", mode); - udev_device_add_property(udev_device, "DEVMODE", num); - return 0; -} - -struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) -{ - udev_device->envp_uptodate = false; - if (value == NULL) { - struct udev_list_entry *list_entry; - - list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); - if (list_entry != NULL) - udev_list_entry_delete(list_entry); - return NULL; - } - return udev_list_entry_add(&udev_device->properties_list, key, value); -} - -static struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) -{ - char name[UTIL_LINE_SIZE]; - char *val; - - util_strscpy(name, sizeof(name), property); - val = strchr(name, '='); - if (val == NULL) - return NULL; - val[0] = '\0'; - val = &val[1]; - if (val[0] == '\0') - val = NULL; - return udev_device_add_property(udev_device, name, val); -} - -/* - * parse property string, and if needed, update internal values accordingly - * - * udev_device_add_property_from_string_parse_finish() needs to be - * called after adding properties, and its return value checked - * - * udev_device_set_info_loaded() needs to be set, to avoid trying - * to use a device without a DEVPATH set - */ -void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property) -{ - if (strncmp(property, "DEVPATH=", 8) == 0) { - char path[UTIL_PATH_SIZE]; - - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev_device->udev), &property[8], NULL); - udev_device_set_syspath(udev_device, path); - } else if (strncmp(property, "SUBSYSTEM=", 10) == 0) { - udev_device_set_subsystem(udev_device, &property[10]); - } else if (strncmp(property, "DEVTYPE=", 8) == 0) { - udev_device_set_devtype(udev_device, &property[8]); - } else if (strncmp(property, "DEVNAME=", 8) == 0) { - udev_device_set_devnode(udev_device, &property[8]); - } else if (strncmp(property, "DEVLINKS=", 9) == 0) { - char devlinks[UTIL_PATH_SIZE]; - char *slink; - char *next; - - util_strscpy(devlinks, sizeof(devlinks), &property[9]); - slink = devlinks; - next = strchr(slink, ' '); - while (next != NULL) { - next[0] = '\0'; - udev_device_add_devlink(udev_device, slink, 0); - slink = &next[1]; - next = strchr(slink, ' '); - } - if (slink[0] != '\0') - udev_device_add_devlink(udev_device, slink, 0); - } else if (strncmp(property, "TAGS=", 5) == 0) { - char tags[UTIL_PATH_SIZE]; - char *next; - - util_strscpy(tags, sizeof(tags), &property[5]); - next = strchr(tags, ':'); - if (next != NULL) { - next++; - while (next[0] != '\0') { - char *tag; - - tag = next; - next = strchr(tag, ':'); - if (next == NULL) - break; - next[0] = '\0'; - next++; - udev_device_add_tag(udev_device, tag); - } - } - } else if (strncmp(property, "USEC_INITIALIZED=", 19) == 0) { - udev_device_set_usec_initialized(udev_device, strtoull(&property[19], NULL, 10)); - } else if (strncmp(property, "DRIVER=", 7) == 0) { - udev_device_set_driver(udev_device, &property[7]); - } else if (strncmp(property, "ACTION=", 7) == 0) { - udev_device_set_action(udev_device, &property[7]); - } else if (strncmp(property, "MAJOR=", 6) == 0) { - udev_device->maj = strtoull(&property[6], NULL, 10); - } else if (strncmp(property, "MINOR=", 6) == 0) { - udev_device->min = strtoull(&property[6], NULL, 10); - } else if (strncmp(property, "DEVPATH_OLD=", 12) == 0) { - udev_device_set_devpath_old(udev_device, &property[12]); - } else if (strncmp(property, "SEQNUM=", 7) == 0) { - udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10)); - } else if (strncmp(property, "IFINDEX=", 8) == 0) { - udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10)); - } else if (strncmp(property, "DEVMODE=", 8) == 0) { - udev_device_set_devnode_mode(udev_device, strtoul(&property[8], NULL, 8)); - } else { - udev_device_add_property_from_string(udev_device, property); - } -} - -int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device) -{ - if (udev_device->maj > 0) - udev_device_set_devnum(udev_device, makedev(udev_device->maj, udev_device->min)); - udev_device->maj = 0; - udev_device->min = 0; - - if (udev_device->devpath == NULL || udev_device->subsystem == NULL) - return -EINVAL; - return 0; -} - -/** - * udev_device_get_property_value: - * @udev_device: udev device - * @key: property name - * - * Returns: the value of a device property, or #NULL if there is no such property. - **/ -UDEV_EXPORT const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) -{ - struct udev_list_entry *list_entry; - - if (udev_device == NULL) - return NULL; - if (key == NULL) - return NULL; - - list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); - return udev_list_entry_get_value(list_entry); -} - -int udev_device_read_db(struct udev_device *udev_device, const char *dbfile) -{ - char filename[UTIL_PATH_SIZE]; - char line[UTIL_LINE_SIZE]; - FILE *f; - - /* providing a database file will always force-load it */ - if (dbfile == NULL) { - const char *id; - - if (udev_device->db_loaded) - return 0; - udev_device->db_loaded = true; - - id = udev_device_get_id_filename(udev_device); - if (id == NULL) - return -1; - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_device->udev), "/data/", id, NULL); - dbfile = filename; - } - - f = fopen(dbfile, "re"); - if (f == NULL) { - info(udev_device->udev, "no db file to read %s: %m\n", dbfile); - return -1; - } - udev_device->is_initialized = true; - - while (fgets(line, sizeof(line), f)) { - ssize_t len; - const char *val; - struct udev_list_entry *entry; - - len = strlen(line); - if (len < 4) - break; - line[len-1] = '\0'; - val = &line[2]; - switch(line[0]) { - case 'S': - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); - udev_device_add_devlink(udev_device, filename, 0); - break; - case 'L': - udev_device_set_devlink_priority(udev_device, atoi(val)); - break; - case 'E': - entry = udev_device_add_property_from_string(udev_device, val); - udev_list_entry_set_num(entry, true); - break; - case 'G': - udev_device_add_tag(udev_device, val); - break; - case 'W': - udev_device_set_watch_handle(udev_device, atoi(val)); - break; - case 'I': - udev_device_set_usec_initialized(udev_device, strtoull(val, NULL, 10)); - break; - } - } - fclose(f); - - info(udev_device->udev, "device %p filled with db file data\n", udev_device); - return 0; -} - -int udev_device_read_uevent_file(struct udev_device *udev_device) -{ - char filename[UTIL_PATH_SIZE]; - FILE *f; - char line[UTIL_LINE_SIZE]; - int maj = 0; - int min = 0; - - if (udev_device->uevent_loaded) - return 0; - - util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL); - f = fopen(filename, "re"); - if (f == NULL) - return -1; - udev_device->uevent_loaded = true; - - while (fgets(line, sizeof(line), f)) { - char *pos; - - pos = strchr(line, '\n'); - if (pos == NULL) - continue; - pos[0] = '\0'; - - if (strncmp(line, "DEVTYPE=", 8) == 0) - udev_device_set_devtype(udev_device, &line[8]); - else if (strncmp(line, "MAJOR=", 6) == 0) - maj = strtoull(&line[6], NULL, 10); - else if (strncmp(line, "MINOR=", 6) == 0) - min = strtoull(&line[6], NULL, 10); - else if (strncmp(line, "IFINDEX=", 8) == 0) - udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); - else if (strncmp(line, "DEVNAME=", 8) == 0) - udev_device_set_devnode(udev_device, &line[8]); - else if (strncmp(line, "DEVMODE=", 8) == 0) - udev_device->devnode_mode = strtoul(&line[8], NULL, 8); - - udev_device_add_property_from_string(udev_device, line); - } - - udev_device->devnum = makedev(maj, min); - fclose(f); - return 0; -} - -void udev_device_set_info_loaded(struct udev_device *device) -{ - device->info_loaded = true; -} - -struct udev_device *udev_device_new(struct udev *udev) -{ - struct udev_device *udev_device; - struct udev_list_entry *list_entry; - - if (udev == NULL) - return NULL; - - udev_device = calloc(1, sizeof(struct udev_device)); - if (udev_device == NULL) - return NULL; - udev_device->refcount = 1; - udev_device->udev = udev; - udev_list_init(udev, &udev_device->devlinks_list, true); - udev_list_init(udev, &udev_device->properties_list, true); - udev_list_init(udev, &udev_device->sysattr_value_list, true); - udev_list_init(udev, &udev_device->sysattr_list, false); - udev_list_init(udev, &udev_device->tags_list, true); - udev_device->watch_handle = -1; - /* copy global properties */ - udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) - udev_device_add_property(udev_device, - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - dbg(udev_device->udev, "udev_device: %p created\n", udev_device); - return udev_device; -} - -/** - * udev_device_new_from_syspath: - * @udev: udev library context - * @syspath: sys device path including sys directory - * - * Create new udev device, and fill in information from the sys - * device and the udev database entry. The syspath is the absolute - * path to the device, including the sys mount point. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev device. - * - * Returns: a new udev device, or #NULL, if it does not exist - **/ -UDEV_EXPORT struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) -{ - size_t len; - const char *subdir; - char path[UTIL_PATH_SIZE]; - char *pos; - struct stat statbuf; - struct udev_device *udev_device; - - if (udev == NULL) - return NULL; - if (syspath == NULL) - return NULL; - - /* path starts in sys */ - len = strlen(udev_get_sys_path(udev)); - if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) { - info(udev, "not in sys :%s\n", syspath); - return NULL; - } - - /* path is not a root directory */ - subdir = &syspath[len+1]; - pos = strrchr(subdir, '/'); - if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) { - dbg(udev, "not a subdir :%s\n", syspath); - return NULL; - } - - /* resolve possible symlink to real path */ - util_strscpy(path, sizeof(path), syspath); - util_resolve_sys_link(udev, path, sizeof(path)); - - if (strncmp(&path[len], "/devices/", 9) == 0) { - char file[UTIL_PATH_SIZE]; - - /* all "devices" require a "uevent" file */ - util_strscpyl(file, sizeof(file), path, "/uevent", NULL); - if (stat(file, &statbuf) != 0) { - dbg(udev, "not a device: %s\n", syspath); - return NULL; - } - } else { - /* everything else just needs to be a directory */ - if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) { - dbg(udev, "directory not found: %s\n", syspath); - return NULL; - } - } - - udev_device = udev_device_new(udev); - if (udev_device == NULL) - return NULL; - - udev_device_set_syspath(udev_device, path); - info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); - - return udev_device; -} - -/** - * udev_device_new_from_devnum: - * @udev: udev library context - * @type: char or block device - * @devnum: device major/minor number - * - * Create new udev device, and fill in information from the sys - * device and the udev database entry. The device is looked-up - * by its major/minor number and type. Character and block device - * numbers are not unique across the two types. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev device. - * - * Returns: a new udev device, or #NULL, if it does not exist - **/ -UDEV_EXPORT struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) -{ - char path[UTIL_PATH_SIZE]; - const char *type_str; - - if (type == 'b') - type_str = "block"; - else if (type == 'c') - type_str = "char"; - else - return NULL; - - /* use /sys/dev/{block,char}/: link */ - snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", - udev_get_sys_path(udev), type_str, major(devnum), minor(devnum)); - return udev_device_new_from_syspath(udev, path); -} - -struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id) -{ - char type; - int maj, min; - char subsys[UTIL_PATH_SIZE]; - char *sysname; - - switch(id[0]) { - case 'b': - case 'c': - if (sscanf(id, "%c%i:%i", &type, &maj, &min) != 3) - return NULL; - return udev_device_new_from_devnum(udev, type, makedev(maj, min)); - case 'n': { - int sk; - struct ifreq ifr; - struct udev_device *dev; - int ifindex; - - ifindex = strtoul(&id[1], NULL, 10); - if (ifindex <= 0) - return NULL; - - sk = socket(PF_INET, SOCK_DGRAM, 0); - if (sk < 0) - return NULL; - memset(&ifr, 0x00, sizeof(struct ifreq)); - ifr.ifr_ifindex = ifindex; - if (ioctl(sk, SIOCGIFNAME, &ifr) != 0) { - close(sk); - return NULL; - } - close(sk); - - dev = udev_device_new_from_subsystem_sysname(udev, "net", ifr.ifr_name); - if (dev == NULL) - return NULL; - if (udev_device_get_ifindex(dev) == ifindex) - return dev; - udev_device_unref(dev); - return NULL; - } - case '+': - util_strscpy(subsys, sizeof(subsys), &id[1]); - sysname = strchr(subsys, ':'); - if (sysname == NULL) - return NULL; - sysname[0] = '\0'; - sysname = &sysname[1]; - return udev_device_new_from_subsystem_sysname(udev, subsys, sysname); - default: - return NULL; - } -} - -/** - * udev_device_new_from_subsystem_sysname: - * @udev: udev library context - * @subsystem: the subsystem of the device - * @sysname: the name of the device - * - * Create new udev device, and fill in information from the sys device - * and the udev database entry. The device is looked up by the subsystem - * and name string of the device, like "mem" / "zero", or "block" / "sda". - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev device. - * - * Returns: a new udev device, or #NULL, if it does not exist - **/ -UDEV_EXPORT struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) -{ - char path_full[UTIL_PATH_SIZE]; - char *path; - size_t l; - struct stat statbuf; - - path = path_full; - l = util_strpcpyl(&path, sizeof(path_full), udev_get_sys_path(udev), NULL); - - if (strcmp(subsystem, "subsystem") == 0) { - util_strscpyl(path, l, "/subsystem/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/bus/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/class/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - } - - if (strcmp(subsystem, "module") == 0) { - util_strscpyl(path, l, "/module/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - } - - if (strcmp(subsystem, "drivers") == 0) { - char subsys[UTIL_NAME_SIZE]; - char *driver; - - util_strscpy(subsys, sizeof(subsys), sysname); - driver = strchr(subsys, ':'); - if (driver != NULL) { - driver[0] = '\0'; - driver = &driver[1]; - - util_strscpyl(path, l, "/subsystem/", subsys, "/drivers/", driver, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/bus/", subsys, "/drivers/", driver, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - } - goto out; - } - - util_strscpyl(path, l, "/subsystem/", subsystem, "/devices/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/bus/", subsystem, "/devices/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/class/", subsystem, "/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; -out: - return NULL; -found: - return udev_device_new_from_syspath(udev, path_full); -} - -/** - * udev_device_new_from_environment - * @udev: udev library context - * - * Create new udev device, and fill in information from the - * current process environment. This only works reliable if - * the process is called from a udev rule. It is usually used - * for tools executed from IMPORT= rules. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev device. - * - * Returns: a new udev device, or #NULL, if it does not exist - **/ -UDEV_EXPORT struct udev_device *udev_device_new_from_environment(struct udev *udev) -{ - int i; - struct udev_device *udev_device; - - udev_device = udev_device_new(udev); - if (udev_device == NULL) - return NULL; - udev_device_set_info_loaded(udev_device); - - for (i = 0; environ[i] != NULL; i++) - udev_device_add_property_from_string_parse(udev_device, environ[i]); - - if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { - info(udev, "missing values, invalid device\n"); - udev_device_unref(udev_device); - udev_device = NULL; - } - - return udev_device; -} - -static struct udev_device *device_new_from_parent(struct udev_device *udev_device) -{ - struct udev_device *udev_device_parent = NULL; - char path[UTIL_PATH_SIZE]; - const char *subdir; - - util_strscpy(path, sizeof(path), udev_device->syspath); - subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; - for (;;) { - char *pos; - - pos = strrchr(subdir, '/'); - if (pos == NULL || pos < &subdir[2]) - break; - pos[0] = '\0'; - udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); - if (udev_device_parent != NULL) - return udev_device_parent; - } - return NULL; -} - -/** - * udev_device_get_parent: - * @udev_device: the device to start searching from - * - * Find the next parent device, and fill in information from the sys - * device and the udev database entry. - * - * The returned the device is not referenced. It is attached to the - * child device, and will be cleaned up when the child device - * is cleaned up. - * - * It is not necessarily just the upper level directory, empty or not - * recognized sys directories are ignored. - * - * It can be called as many times as needed, without caring about - * references. - * - * Returns: a new udev device, or #NULL, if it no parent exist. - **/ -UDEV_EXPORT struct udev_device *udev_device_get_parent(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->parent_set) { - udev_device->parent_set = true; - udev_device->parent_device = device_new_from_parent(udev_device); - } - if (udev_device->parent_device != NULL) - dbg(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); - return udev_device->parent_device; -} - -/** - * udev_device_get_parent_with_subsystem_devtype: - * @udev_device: udev device to start searching from - * @subsystem: the subsystem of the device - * @devtype: the type (DEVTYPE) of the device - * - * Find the next parent device, with a matching subsystem and devtype - * value, and fill in information from the sys device and the udev - * database entry. - * - * If devtype is #NULL, only subsystem is checked, and any devtype will - * match. - * - * The returned the device is not referenced. It is attached to the - * child device, and will be cleaned up when the child device - * is cleaned up. - * - * It can be called as many times as needed, without caring about - * references. - * - * Returns: a new udev device, or #NULL if no matching parent exists. - **/ -UDEV_EXPORT struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) -{ - struct udev_device *parent; - - if (subsystem == NULL) - return NULL; - - parent = udev_device_get_parent(udev_device); - while (parent != NULL) { - const char *parent_subsystem; - const char *parent_devtype; - - parent_subsystem = udev_device_get_subsystem(parent); - if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) { - if (devtype == NULL) - break; - parent_devtype = udev_device_get_devtype(parent); - if (parent_devtype != NULL && strcmp(parent_devtype, devtype) == 0) - break; - } - parent = udev_device_get_parent(parent); - } - return parent; -} - -/** - * udev_device_get_udev: - * @udev_device: udev device - * - * Retrieve the udev library context the device was created with. - * - * Returns: the udev library context - **/ -UDEV_EXPORT struct udev *udev_device_get_udev(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->udev; -} - -/** - * udev_device_ref: - * @udev_device: udev device - * - * Take a reference of a udev device. - * - * Returns: the passed udev device - **/ -UDEV_EXPORT struct udev_device *udev_device_ref(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - udev_device->refcount++; - return udev_device; -} - -/** - * udev_device_unref: - * @udev_device: udev device - * - * Drop a reference of a udev device. If the refcount reaches zero, - * the resources of the device will be released. - * - **/ -UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return; - udev_device->refcount--; - if (udev_device->refcount > 0) - return; - if (udev_device->parent_device != NULL) - udev_device_unref(udev_device->parent_device); - free(udev_device->syspath); - free(udev_device->sysname); - free(udev_device->devnode); - free(udev_device->subsystem); - free(udev_device->devtype); - udev_list_cleanup(&udev_device->devlinks_list); - udev_list_cleanup(&udev_device->properties_list); - udev_list_cleanup(&udev_device->sysattr_value_list); - udev_list_cleanup(&udev_device->sysattr_list); - udev_list_cleanup(&udev_device->tags_list); - free(udev_device->action); - free(udev_device->driver); - free(udev_device->devpath_old); - free(udev_device->id_filename); - free(udev_device->envp); - free(udev_device->monitor_buf); - dbg(udev_device->udev, "udev_device: %p released\n", udev_device); - free(udev_device); -} - -/** - * udev_device_get_devpath: - * @udev_device: udev device - * - * Retrieve the kernel devpath value of the udev device. The path - * does not contain the sys mount point, and starts with a '/'. - * - * Returns: the devpath of the udev device - **/ -UDEV_EXPORT const char *udev_device_get_devpath(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->devpath; -} - -/** - * udev_device_get_syspath: - * @udev_device: udev device - * - * Retrieve the sys path of the udev device. The path is an - * absolute path and starts with the sys mount point. - * - * Returns: the sys path of the udev device - **/ -UDEV_EXPORT const char *udev_device_get_syspath(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->syspath; -} - -/** - * udev_device_get_sysname: - * @udev_device: udev device - * - * Returns: the sys name of the device device - **/ -UDEV_EXPORT const char *udev_device_get_sysname(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->sysname; -} - -/** - * udev_device_get_sysnum: - * @udev_device: udev device - * - * Returns: the trailing number of of the device name - **/ -UDEV_EXPORT const char *udev_device_get_sysnum(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->sysnum; -} - -/** - * udev_device_get_devnode: - * @udev_device: udev device - * - * Retrieve the device node file name belonging to the udev device. - * The path is an absolute path, and starts with the device directory. - * - * Returns: the device node file name of the udev device, or #NULL if no device node exists - **/ -UDEV_EXPORT const char *udev_device_get_devnode(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (udev_device->devnode != NULL) - return udev_device->devnode; - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->devnode; -} - -/** - * udev_device_get_devlinks_list_entry: - * @udev_device: udev device - * - * Retrieve the list of device links pointing to the device file of - * the udev device. The next list entry can be retrieved with - * udev_list_entry_next(), which returns #NULL if no more entries exist. - * The devlink path can be retrieved from the list entry by - * udev_list_entry_get_name(). The path is an absolute path, and starts with - * the device directory. - * - * Returns: the first entry of the device node link list - **/ -UDEV_EXPORT struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_list_get_entry(&udev_device->devlinks_list); -} - -void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) -{ - udev_device->devlinks_uptodate = false; - udev_list_cleanup(&udev_device->devlinks_list); -} - -/** - * udev_device_get_properties_list_entry: - * @udev_device: udev device - * - * Retrieve the list of key/value device properties of the udev - * device. The next list entry can be retrieved with udev_list_entry_next(), - * which returns #NULL if no more entries exist. The property name - * can be retrieved from the list entry by udev_list_get_name(), - * the property value by udev_list_get_value(). - * - * Returns: the first entry of the property list - **/ -UDEV_EXPORT struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->info_loaded) { - udev_device_read_uevent_file(udev_device); - udev_device_read_db(udev_device, NULL); - } - if (!udev_device->devlinks_uptodate) { - char symlinks[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - - udev_device->devlinks_uptodate = true; - list_entry = udev_device_get_devlinks_list_entry(udev_device); - if (list_entry != NULL) { - char *s; - size_t l; - - s = symlinks; - l = util_strpcpyl(&s, sizeof(symlinks), udev_list_entry_get_name(list_entry), NULL); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) - l = util_strpcpyl(&s, l, " ", udev_list_entry_get_name(list_entry), NULL); - udev_device_add_property(udev_device, "DEVLINKS", symlinks); - } - } - if (!udev_device->tags_uptodate) { - udev_device->tags_uptodate = true; - if (udev_device_get_tags_list_entry(udev_device) != NULL) { - char tags[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - char *s; - size_t l; - - s = tags; - l = util_strpcpyl(&s, sizeof(tags), ":", NULL); - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) - l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), ":", NULL); - udev_device_add_property(udev_device, "TAGS", tags); - } - } - return udev_list_get_entry(&udev_device->properties_list); -} - -/** - * udev_device_get_action: - * @udev_device: udev device - * - * This is only valid if the device was received through a monitor. Devices read from - * sys do not have an action string. Usual actions are: add, remove, change, online, - * offline. - * - * Returns: the kernel action value, or #NULL if there is no action value available. - **/ -UDEV_EXPORT const char *udev_device_get_action(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - return udev_device->action; -} - -/** - * udev_device_get_usec_since_initialized: - * @udev_device: udev device - * - * Return the number of microseconds passed since udev set up the - * device for the first time. - * - * This is only implemented for devices with need to store properties - * in the udev database. All other devices return 0 here. - * - * Returns: the number of microseconds since the device was first seen. - **/ -UDEV_EXPORT unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device) -{ - unsigned long long now; - - if (udev_device == NULL) - return 0; - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - if (udev_device->usec_initialized == 0) - return 0; - now = now_usec(); - if (now == 0) - return 0; - return now - udev_device->usec_initialized; -} - -unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device) -{ - return udev_device->usec_initialized; -} - -void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized) -{ - char num[32]; - - udev_device->usec_initialized = usec_initialized; - snprintf(num, sizeof(num), "%llu", usec_initialized); - udev_device_add_property(udev_device, "USEC_INITIALIZED", num); -} - -/** - * udev_device_get_sysattr_value: - * @udev_device: udev device - * @sysattr: attribute name - * - * The retrieved value is cached in the device. Repeated calls will return the same - * value and not open the attribute again. - * - * Returns: the content of a sys attribute file, or #NULL if there is no sys attribute value. - **/ -UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) -{ - struct udev_list_entry *list_entry; - char path[UTIL_PATH_SIZE]; - char value[4096]; - struct stat statbuf; - int fd; - ssize_t size; - const char *val = NULL; - - if (udev_device == NULL) - return NULL; - if (sysattr == NULL) - return NULL; - - /* look for possibly already cached result */ - list_entry = udev_list_get_entry(&udev_device->sysattr_value_list); - list_entry = udev_list_entry_get_by_name(list_entry, sysattr); - if (list_entry != NULL) { - dbg(udev_device->udev, "got '%s' (%s) from cache\n", - sysattr, udev_list_entry_get_value(list_entry)); - return udev_list_entry_get_value(list_entry); - } - - util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); - if (lstat(path, &statbuf) != 0) { - dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); - udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, NULL); - goto out; - } - - if (S_ISLNK(statbuf.st_mode)) { - struct udev_device *dev; - - /* - * Some core links return only the last element of the target path, - * these are just values, the paths should not be exposed. - */ - if (strcmp(sysattr, "driver") == 0 || - strcmp(sysattr, "subsystem") == 0 || - strcmp(sysattr, "module") == 0) { - if (util_get_sys_core_link_value(udev_device->udev, sysattr, - udev_device->syspath, value, sizeof(value)) < 0) - return NULL; - dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, value); - list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); - val = udev_list_entry_get_value(list_entry); - goto out; - } - - /* resolve link to a device and return its syspath */ - util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL); - dev = udev_device_new_from_syspath(udev_device->udev, path); - if (dev != NULL) { - list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, - udev_device_get_syspath(dev)); - val = udev_list_entry_get_value(list_entry); - udev_device_unref(dev); - } - - goto out; - } - - /* skip directories */ - if (S_ISDIR(statbuf.st_mode)) - goto out; - - /* skip non-readable files */ - if ((statbuf.st_mode & S_IRUSR) == 0) - goto out; - - /* read attribute value */ - fd = open(path, O_RDONLY|O_CLOEXEC); - if (fd < 0) { - dbg(udev_device->udev, "attribute '%s' can not be opened\n", path); - goto out; - } - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - if (size == sizeof(value)) - goto out; - - /* got a valid value, store it in cache and return it */ - value[size] = '\0'; - util_remove_trailing_chars(value, '\n'); - dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); - val = udev_list_entry_get_value(list_entry); -out: - return val; -} - -static int udev_device_sysattr_list_read(struct udev_device *udev_device) -{ - struct dirent *dent; - DIR *dir; - int num = 0; - - if (udev_device == NULL) - return -1; - if (udev_device->sysattr_list_read) - return 0; - - dir = opendir(udev_device_get_syspath(udev_device)); - if (!dir) { - dbg(udev_device->udev, "sysfs dir '%s' can not be opened\n", - udev_device_get_syspath(udev_device)); - return -1; - } - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char path[UTIL_PATH_SIZE]; - struct stat statbuf; - - /* only handle symlinks and regular files */ - if (dent->d_type != DT_LNK && dent->d_type != DT_REG) - continue; - - util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", dent->d_name, NULL); - if (lstat(path, &statbuf) != 0) - continue; - if ((statbuf.st_mode & S_IRUSR) == 0) - continue; - - udev_list_entry_add(&udev_device->sysattr_list, dent->d_name, NULL); - num++; - } - - closedir(dir); - dbg(udev_device->udev, "found %d sysattrs for '%s'\n", num, udev_device_get_syspath(udev_device)); - udev_device->sysattr_list_read = true; - - return num; -} - -/** - * udev_device_get_sysattr_list_entry: - * @udev_device: udev device - * - * Retrieve the list of available sysattrs, with value being empty; - * This just return all available sysfs attributes for a particular - * device without reading their values. - * - * Returns: the first entry of the property list - **/ -UDEV_EXPORT struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device) -{ - if (!udev_device->sysattr_list_read) { - int ret; - ret = udev_device_sysattr_list_read(udev_device); - if (0 > ret) - return NULL; - } - - return udev_list_get_entry(&udev_device->sysattr_list); -} - -int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) -{ - const char *pos; - size_t len; - - free(udev_device->syspath); - udev_device->syspath = strdup(syspath); - if (udev_device->syspath == NULL) - return -ENOMEM; - udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; - udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath); - - pos = strrchr(udev_device->syspath, '/'); - if (pos == NULL) - return -EINVAL; - udev_device->sysname = strdup(&pos[1]); - if (udev_device->sysname == NULL) - return -ENOMEM; - - /* some devices have '!' in their name, change that to '/' */ - len = 0; - while (udev_device->sysname[len] != '\0') { - if (udev_device->sysname[len] == '!') - udev_device->sysname[len] = '/'; - len++; - } - - /* trailing number */ - while (len > 0 && isdigit(udev_device->sysname[--len])) - udev_device->sysnum = &udev_device->sysname[len]; - - /* sysname is completely numeric */ - if (len == 0) - udev_device->sysnum = NULL; - - return 0; -} - -int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) -{ - free(udev_device->devnode); - if (devnode[0] != '/') { - if (asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), devnode) < 0) - udev_device->devnode = NULL; - } else { - udev_device->devnode = strdup(devnode); - } - if (udev_device->devnode == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); - return 0; -} - -int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique) -{ - struct udev_list_entry *list_entry; - - udev_device->devlinks_uptodate = false; - list_entry = udev_list_entry_add(&udev_device->devlinks_list, devlink, NULL); - if (list_entry == NULL) - return -ENOMEM; - if (unique) - udev_list_entry_set_num(list_entry, true); - return 0; -} - -const char *udev_device_get_id_filename(struct udev_device *udev_device) -{ - if (udev_device->id_filename == NULL) { - if (udev_device_get_subsystem(udev_device) == NULL) - return NULL; - - if (major(udev_device_get_devnum(udev_device)) > 0) { - /* use dev_t -- b259:131072, c254:0 */ - if (asprintf(&udev_device->id_filename, "%c%u:%u", - strcmp(udev_device_get_subsystem(udev_device), "block") == 0 ? 'b' : 'c', - major(udev_device_get_devnum(udev_device)), - minor(udev_device_get_devnum(udev_device))) < 0) - udev_device->id_filename = NULL; - } else if (udev_device_get_ifindex(udev_device) > 0) { - /* use netdev ifindex -- n3 */ - if (asprintf(&udev_device->id_filename, "n%u", udev_device_get_ifindex(udev_device)) < 0) - udev_device->id_filename = NULL; - } else { - /* - * use $subsys:$syname -- pci:0000:00:1f.2 - * sysname() has '!' translated, get it from devpath - */ - const char *sysname; - sysname = strrchr(udev_device->devpath, '/'); - if (sysname == NULL) - return NULL; - sysname = &sysname[1]; - if (asprintf(&udev_device->id_filename, "+%s:%s", udev_device_get_subsystem(udev_device), sysname) < 0) - udev_device->id_filename = NULL; - } - } - return udev_device->id_filename; -} - -/** - * udev_device_get_is_initialized: - * @udev_device: udev device - * - * Check if udev has already handled the device and has set up - * device node permissions and context, or has renamed a network - * device. - * - * This is only implemented for devices with a device node - * or network interfaces. All other devices return 1 here. - * - * Returns: 1 if the device is set up. 0 otherwise. - **/ -UDEV_EXPORT int udev_device_get_is_initialized(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_device->is_initialized; -} - -void udev_device_set_is_initialized(struct udev_device *udev_device) -{ - udev_device->is_initialized = true; -} - -int udev_device_add_tag(struct udev_device *udev_device, const char *tag) -{ - if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) - return -EINVAL; - udev_device->tags_uptodate = false; - if (udev_list_entry_add(&udev_device->tags_list, tag, NULL) != NULL) - return 0; - return -ENOMEM; -} - -void udev_device_cleanup_tags_list(struct udev_device *udev_device) -{ - udev_device->tags_uptodate = false; - udev_list_cleanup(&udev_device->tags_list); -} - -/** - * udev_device_get_tags_list_entry: - * @udev_device: udev device - * - * Retrieve the list of tags attached to the udev device. The next - * list entry can be retrieved with udev_list_entry_next(), - * which returns #NULL if no more entries exist. The tag string - * can be retrieved from the list entry by udev_list_get_name(). - * - * Returns: the first entry of the tag list - **/ -UDEV_EXPORT struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) -{ - if (udev_device == NULL) - return NULL; - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_list_get_entry(&udev_device->tags_list); -} - -UDEV_EXPORT int udev_device_has_tag(struct udev_device *udev_device, const char *tag) -{ - struct udev_list_entry *list_entry; - - if (udev_device == NULL) - return false; - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - list_entry = udev_device_get_tags_list_entry(udev_device); - if (udev_list_entry_get_by_name(list_entry, tag) != NULL) - return true; - return false; -} - -#define ENVP_SIZE 128 -#define MONITOR_BUF_SIZE 4096 -static int update_envp_monitor_buf(struct udev_device *udev_device) -{ - struct udev_list_entry *list_entry; - char *s; - size_t l; - unsigned int i; - - /* monitor buffer of property strings */ - free(udev_device->monitor_buf); - udev_device->monitor_buf_len = 0; - udev_device->monitor_buf = malloc(MONITOR_BUF_SIZE); - if (udev_device->monitor_buf == NULL) - return -ENOMEM; - - /* envp array, strings will point into monitor buffer */ - if (udev_device->envp == NULL) - udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); - if (udev_device->envp == NULL) - return -ENOMEM; - - i = 0; - s = udev_device->monitor_buf; - l = MONITOR_BUF_SIZE; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - const char *key; - - key = udev_list_entry_get_name(list_entry); - /* skip private variables */ - if (key[0] == '.') - continue; - - /* add string to envp array */ - udev_device->envp[i++] = s; - if (i+1 >= ENVP_SIZE) - return -EINVAL; - - /* add property string to monitor buffer */ - l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL); - if (l == 0) - return -EINVAL; - /* advance past the trailing '\0' that util_strpcpyl() guarantees */ - s++; - l--; - } - udev_device->envp[i] = NULL; - udev_device->monitor_buf_len = s - udev_device->monitor_buf; - udev_device->envp_uptodate = true; - dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", - i, udev_device->monitor_buf_len); - return 0; -} - -char **udev_device_get_properties_envp(struct udev_device *udev_device) -{ - if (!udev_device->envp_uptodate) - if (update_envp_monitor_buf(udev_device) != 0) - return NULL; - return udev_device->envp; -} - -ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf) -{ - if (!udev_device->envp_uptodate) - if (update_envp_monitor_buf(udev_device) != 0) - return -EINVAL; - *buf = udev_device->monitor_buf; - return udev_device->monitor_buf_len; -} - -int udev_device_set_action(struct udev_device *udev_device, const char *action) -{ - free(udev_device->action); - udev_device->action = strdup(action); - if (udev_device->action == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "ACTION", udev_device->action); - return 0; -} - -int udev_device_get_devlink_priority(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_device->devlink_priority; -} - -int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) -{ - udev_device->devlink_priority = prio; - return 0; -} - -int udev_device_get_watch_handle(struct udev_device *udev_device) -{ - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_device->watch_handle; -} - -int udev_device_set_watch_handle(struct udev_device *udev_device, int handle) -{ - udev_device->watch_handle = handle; - return 0; -} - -bool udev_device_get_db_persist(struct udev_device *udev_device) -{ - return udev_device->db_persist; -} - -void udev_device_set_db_persist(struct udev_device *udev_device) -{ - udev_device->db_persist = true; -} diff --git a/libudev/libudev-enumerate.c b/libudev/libudev-enumerate.c deleted file mode 100644 index f14d5c8f57..0000000000 --- a/libudev/libudev-enumerate.c +++ /dev/null @@ -1,947 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2010 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/** - * SECTION:libudev-enumerate - * @short_description: lookup and sort sys devices - * - * Lookup devices in the sys filesystem, filter devices by properties, - * and return a sorted list of devices. - */ - -struct syspath { - char *syspath; - size_t len; -}; - -/** - * udev_enumerate: - * - * Opaque object representing one device lookup/sort context. - */ -struct udev_enumerate { - struct udev *udev; - int refcount; - struct udev_list sysattr_match_list; - struct udev_list sysattr_nomatch_list; - struct udev_list subsystem_match_list; - struct udev_list subsystem_nomatch_list; - struct udev_list sysname_match_list; - struct udev_list properties_match_list; - struct udev_list tags_match_list; - struct udev_device *parent_match; - struct udev_list devices_list; - struct syspath *devices; - unsigned int devices_cur; - unsigned int devices_max; - bool devices_uptodate:1; - bool match_is_initialized; -}; - -/** - * udev_enumerate_new: - * @udev: udev library context - * - * Returns: an enumeration context - **/ -UDEV_EXPORT struct udev_enumerate *udev_enumerate_new(struct udev *udev) -{ - struct udev_enumerate *udev_enumerate; - - udev_enumerate = calloc(1, sizeof(struct udev_enumerate)); - if (udev_enumerate == NULL) - return NULL; - udev_enumerate->refcount = 1; - udev_enumerate->udev = udev; - udev_list_init(udev, &udev_enumerate->sysattr_match_list, false); - udev_list_init(udev, &udev_enumerate->sysattr_nomatch_list, false); - udev_list_init(udev, &udev_enumerate->subsystem_match_list, true); - udev_list_init(udev, &udev_enumerate->subsystem_nomatch_list, true); - udev_list_init(udev, &udev_enumerate->sysname_match_list, true); - udev_list_init(udev, &udev_enumerate->properties_match_list, false); - udev_list_init(udev, &udev_enumerate->tags_match_list, true); - udev_list_init(udev, &udev_enumerate->devices_list, false); - return udev_enumerate; -} - -/** - * udev_enumerate_ref: - * @udev_enumerate: context - * - * Take a reference of a enumeration context. - * - * Returns: the passed enumeration context - **/ -UDEV_EXPORT struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) -{ - if (udev_enumerate == NULL) - return NULL; - udev_enumerate->refcount++; - return udev_enumerate; -} - -/** - * udev_enumerate_unref: - * @udev_enumerate: context - * - * Drop a reference of an enumeration context. If the refcount reaches zero, - * all resources of the enumeration context will be released. - **/ -UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) -{ - unsigned int i; - - if (udev_enumerate == NULL) - return; - udev_enumerate->refcount--; - if (udev_enumerate->refcount > 0) - return; - udev_list_cleanup(&udev_enumerate->sysattr_match_list); - udev_list_cleanup(&udev_enumerate->sysattr_nomatch_list); - udev_list_cleanup(&udev_enumerate->subsystem_match_list); - udev_list_cleanup(&udev_enumerate->subsystem_nomatch_list); - udev_list_cleanup(&udev_enumerate->sysname_match_list); - udev_list_cleanup(&udev_enumerate->properties_match_list); - udev_list_cleanup(&udev_enumerate->tags_match_list); - udev_device_unref(udev_enumerate->parent_match); - udev_list_cleanup(&udev_enumerate->devices_list); - for (i = 0; i < udev_enumerate->devices_cur; i++) - free(udev_enumerate->devices[i].syspath); - free(udev_enumerate->devices); - free(udev_enumerate); -} - -/** - * udev_enumerate_get_udev: - * @udev_enumerate: context - * - * Returns: the udev library context. - */ -UDEV_EXPORT struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) -{ - if (udev_enumerate == NULL) - return NULL; - return udev_enumerate->udev; -} - -static int syspath_add(struct udev_enumerate *udev_enumerate, const char *syspath) -{ - char *path; - struct syspath *entry; - - /* double array size if needed */ - if (udev_enumerate->devices_cur >= udev_enumerate->devices_max) { - struct syspath *buf; - unsigned int add; - - add = udev_enumerate->devices_max; - if (add < 1024) - add = 1024; - buf = realloc(udev_enumerate->devices, (udev_enumerate->devices_max + add) * sizeof(struct syspath)); - if (buf == NULL) - return -ENOMEM; - udev_enumerate->devices = buf; - udev_enumerate->devices_max += add; - } - - path = strdup(syspath); - if (path == NULL) - return -ENOMEM; - entry = &udev_enumerate->devices[udev_enumerate->devices_cur]; - entry->syspath = path; - entry->len = strlen(path); - udev_enumerate->devices_cur++; - udev_enumerate->devices_uptodate = false; - return 0; -} - -static int syspath_cmp(const void *p1, const void *p2) -{ - const struct syspath *path1 = p1; - const struct syspath *path2 = p2; - size_t len; - int ret; - - len = MIN(path1->len, path2->len); - ret = memcmp(path1->syspath, path2->syspath, len); - if (ret == 0) { - if (path1->len < path2->len) - ret = -1; - else if (path1->len > path2->len) - ret = 1; - } - return ret; -} - -/* For devices that should be moved to the absolute end of the list */ -static bool devices_delay_end(struct udev *udev, const char *syspath) -{ - static const char *delay_device_list[] = { - "/block/md", - "/block/dm-", - NULL - }; - size_t len; - int i; - - len = strlen(udev_get_sys_path(udev)); - for (i = 0; delay_device_list[i] != NULL; i++) { - if (strstr(&syspath[len], delay_device_list[i]) != NULL) { - dbg(udev, "delaying: %s\n", syspath); - return true; - } - } - return false; -} - -/* For devices that should just be moved a little bit later, just - * before the point where some common path prefix changes. Returns the - * number of characters that make up that common prefix */ -static size_t devices_delay_later(struct udev *udev, const char *syspath) -{ - const char *c; - - /* For sound cards the control device must be enumerated last - * to make sure it's the final device node that gets ACLs - * applied. Applications rely on this fact and use ACL changes - * on the control node as an indicator that the ACL change of - * the entire sound card completed. The kernel makes this - * guarantee when creating those devices, and hence we should - * too when enumerating them. */ - - if ((c = strstr(syspath, "/sound/card"))) { - c += 11; - c += strcspn(c, "/"); - - if (strncmp(c, "/controlC", 9) == 0) - return c - syspath + 1; - } - - return 0; -} - -/** - * udev_enumerate_get_list_entry: - * @udev_enumerate: context - * - * Returns: the first entry of the sorted list of device paths. - */ -UDEV_EXPORT struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) -{ - if (udev_enumerate == NULL) - return NULL; - if (!udev_enumerate->devices_uptodate) { - unsigned int i; - unsigned int max; - struct syspath *prev = NULL, *move_later = NULL; - size_t move_later_prefix = 0; - - udev_list_cleanup(&udev_enumerate->devices_list); - qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); - - max = udev_enumerate->devices_cur; - for (i = 0; i < max; i++) { - struct syspath *entry = &udev_enumerate->devices[i]; - - /* skip duplicated entries */ - if (prev != NULL && - entry->len == prev->len && - memcmp(entry->syspath, prev->syspath, entry->len) == 0) - continue; - prev = entry; - - /* skip to be delayed devices, and add them to the end of the list */ - if (devices_delay_end(udev_enumerate->udev, entry->syspath)) { - syspath_add(udev_enumerate, entry->syspath); - /* need to update prev here for the case realloc() gives a different address */ - prev = &udev_enumerate->devices[i]; - continue; - } - - /* skip to be delayed devices, and move the to - * the point where the prefix changes. We can - * only move one item at a time. */ - if (!move_later) { - move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath); - - if (move_later_prefix > 0) { - move_later = entry; - continue; - } - } - - if (move_later && - strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) { - - udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); - move_later = NULL; - } - - udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); - } - - if (move_later) - udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); - - /* add and cleanup delayed devices from end of list */ - for (i = max; i < udev_enumerate->devices_cur; i++) { - struct syspath *entry = &udev_enumerate->devices[i]; - - udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); - free(entry->syspath); - } - udev_enumerate->devices_cur = max; - - udev_enumerate->devices_uptodate = true; - } - return udev_list_get_entry(&udev_enumerate->devices_list); -} - -/** - * udev_enumerate_add_match_subsystem: - * @udev_enumerate: context - * @subsystem: filter for a subsystem of the device to include in the list - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (subsystem == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->subsystem_match_list, subsystem, NULL) == NULL) - return -ENOMEM; - return 0; -} - -/** - * udev_enumerate_add_nomatch_subsystem: - * @udev_enumerate: context - * @subsystem: filter for a subsystem of the device to exclude from the list - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (subsystem == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->subsystem_nomatch_list, subsystem, NULL) == NULL) - return -ENOMEM; - return 0; -} - -/** - * udev_enumerate_add_match_sysattr: - * @udev_enumerate: context - * @sysattr: filter for a sys attribute at the device to include in the list - * @value: optional value of the sys attribute - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (sysattr == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->sysattr_match_list, sysattr, value) == NULL) - return -ENOMEM; - return 0; -} - -/** - * udev_enumerate_add_nomatch_sysattr: - * @udev_enumerate: context - * @sysattr: filter for a sys attribute at the device to exclude from the list - * @value: optional value of the sys attribute - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (sysattr == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->sysattr_nomatch_list, sysattr, value) == NULL) - return -ENOMEM; - return 0; -} - -static int match_sysattr_value(struct udev_device *dev, const char *sysattr, const char *match_val) -{ - const char *val = NULL; - bool match = false; - - val = udev_device_get_sysattr_value(dev, sysattr); - if (val == NULL) - goto exit; - if (match_val == NULL) { - match = true; - goto exit; - } - if (fnmatch(match_val, val, 0) == 0) { - match = true; - goto exit; - } -exit: - return match; -} - -/** - * udev_enumerate_add_match_property: - * @udev_enumerate: context - * @property: filter for a property of the device to include in the list - * @value: value of the property - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (property == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->properties_match_list, property, value) == NULL) - return -ENOMEM; - return 0; -} - -/** - * udev_enumerate_add_match_tag: - * @udev_enumerate: context - * @tag: filter for a tag of the device to include in the list - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (tag == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->tags_match_list, tag, NULL) == NULL) - return -ENOMEM; - return 0; -} - -/** - * udev_enumerate_add_match_parent: - * @udev_enumerate: context - * @parent: parent device where to start searching - * - * Return the devices on the subtree of one given device. The parent - * itself is included in the list. - * - * A reference for the device is held until the udev_enumerate context - * is cleaned up. - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (parent == NULL) - return 0; - if (udev_enumerate->parent_match != NULL) - udev_device_unref(udev_enumerate->parent_match); - udev_enumerate->parent_match = udev_device_ref(parent); - return 0; -} - -/** - * udev_enumerate_add_match_is_initialized: - * @udev_enumerate: context - * - * Match only devices which udev has set up already. This makes - * sure, that the device node permissions and context are properly set - * and that network devices are fully renamed. - * - * Usually, devices which are found in the kernel but not already - * handled by udev, have still pending events. Services should subscribe - * to monitor events and wait for these devices to become ready, instead - * of using uninitialized devices. - * - * For now, this will not affect devices which do not have a device node - * and are not network interfaces. - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate) -{ - if (udev_enumerate == NULL) - return -EINVAL; - udev_enumerate->match_is_initialized = true; - return 0; -} - -/** - * udev_enumerate_add_match_sysname: - * @udev_enumerate: context - * @sysname: filter for the name of the device to include in the list - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) -{ - if (udev_enumerate == NULL) - return -EINVAL; - if (sysname == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->sysname_match_list, sysname, NULL) == NULL) - return -ENOMEM; - return 0; -} - -static bool match_sysattr(struct udev_enumerate *udev_enumerate, struct udev_device *dev) -{ - struct udev_list_entry *list_entry; - - /* skip list */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_nomatch_list)) { - if (match_sysattr_value(dev, udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry))) - return false; - } - /* include list */ - if (udev_list_get_entry(&udev_enumerate->sysattr_match_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_match_list)) { - /* anything that does not match, will make it FALSE */ - if (!match_sysattr_value(dev, udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry))) - return false; - } - return true; - } - return true; -} - -static bool match_property(struct udev_enumerate *udev_enumerate, struct udev_device *dev) -{ - struct udev_list_entry *list_entry; - bool match = false; - - /* no match always matches */ - if (udev_list_get_entry(&udev_enumerate->properties_match_list) == NULL) - return true; - - /* loop over matches */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) { - const char *match_key = udev_list_entry_get_name(list_entry); - const char *match_value = udev_list_entry_get_value(list_entry); - struct udev_list_entry *property_entry; - - /* loop over device properties */ - udev_list_entry_foreach(property_entry, udev_device_get_properties_list_entry(dev)) { - const char *dev_key = udev_list_entry_get_name(property_entry); - const char *dev_value = udev_list_entry_get_value(property_entry); - - if (fnmatch(match_key, dev_key, 0) != 0) - continue; - if (match_value == NULL && dev_value == NULL) { - match = true; - goto out; - } - if (match_value == NULL || dev_value == NULL) - continue; - if (fnmatch(match_value, dev_value, 0) == 0) { - match = true; - goto out; - } - } - } -out: - return match; -} - -static bool match_tag(struct udev_enumerate *udev_enumerate, struct udev_device *dev) -{ - struct udev_list_entry *list_entry; - - /* no match always matches */ - if (udev_list_get_entry(&udev_enumerate->tags_match_list) == NULL) - return true; - - /* loop over matches */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) - if (!udev_device_has_tag(dev, udev_list_entry_get_name(list_entry))) - return false; - - return true; -} - -static bool match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *dev) -{ - const char *parent; - - if (udev_enumerate->parent_match == NULL) - return true; - - parent = udev_device_get_devpath(udev_enumerate->parent_match); - return strncmp(parent, udev_device_get_devpath(dev), strlen(parent)) == 0; -} - -static bool match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) -{ - struct udev_list_entry *list_entry; - - if (udev_list_get_entry(&udev_enumerate->sysname_match_list) == NULL) - return true; - - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysname_match_list)) { - if (fnmatch(udev_list_entry_get_name(list_entry), sysname, 0) != 0) - continue; - return true; - } - return false; -} - -static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, - const char *basedir, const char *subdir1, const char *subdir2) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char path[UTIL_PATH_SIZE]; - size_t l; - char *s; - DIR *dir; - struct dirent *dent; - - s = path; - l = util_strpcpyl(&s, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); - if (subdir1 != NULL) - l = util_strpcpyl(&s, l, "/", subdir1, NULL); - if (subdir2 != NULL) - util_strpcpyl(&s, l, "/", subdir2, NULL); - dir = opendir(path); - if (dir == NULL) - return -ENOENT; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char syspath[UTIL_PATH_SIZE]; - struct udev_device *dev; - - if (dent->d_name[0] == '.') - continue; - - if (!match_sysname(udev_enumerate, dent->d_name)) - continue; - - util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); - dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); - if (dev == NULL) - continue; - - if (udev_enumerate->match_is_initialized) { - /* - * All devices with a device node or network interfaces - * possibly need udev to adjust the device node permission - * or context, or rename the interface before it can be - * reliably used from other processes. - * - * For now, we can only check these types of devices, we - * might not store a database, and have no way to find out - * for all other types of devices. - */ - if (!udev_device_get_is_initialized(dev) && - (major(udev_device_get_devnum(dev)) > 0 || udev_device_get_ifindex(dev) > 0)) - goto nomatch; - } - if (!match_parent(udev_enumerate, dev)) - goto nomatch; - if (!match_tag(udev_enumerate, dev)) - goto nomatch; - if (!match_property(udev_enumerate, dev)) - goto nomatch; - if (!match_sysattr(udev_enumerate, dev)) - goto nomatch; - - syspath_add(udev_enumerate, udev_device_get_syspath(dev)); -nomatch: - udev_device_unref(dev); - } - closedir(dir); - return 0; -} - -static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) -{ - struct udev_list_entry *list_entry; - - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { - if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) - return false; - } - if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) { - if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) - return true; - } - return false; - } - return true; -} - -static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir, const char *subsystem) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - - char path[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; - - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); - dir = opendir(path); - if (dir == NULL) - return -1; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - if (dent->d_name[0] == '.') - continue; - if (!match_subsystem(udev_enumerate, subsystem != NULL ? subsystem : dent->d_name)) - continue; - scan_dir_and_add_devices(udev_enumerate, basedir, dent->d_name, subdir); - } - closedir(dir); - return 0; -} - -/** - * udev_enumerate_add_syspath: - * @udev_enumerate: context - * @syspath: path of a device - * - * Add a device to the list of devices, to retrieve it back sorted in dependency order. - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) -{ - struct udev_device *udev_device; - - if (udev_enumerate == NULL) - return -EINVAL; - if (syspath == NULL) - return 0; - /* resolve to real syspath */ - udev_device = udev_device_new_from_syspath(udev_enumerate->udev, syspath); - if (udev_device == NULL) - return -EINVAL; - syspath_add(udev_enumerate, udev_device_get_syspath(udev_device)); - udev_device_unref(udev_device); - return 0; -} - -static int scan_devices_tags(struct udev_enumerate *udev_enumerate) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - struct udev_list_entry *list_entry; - - /* scan only tagged devices, use tags reverse-index, instead of searching all devices in /sys */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) { - DIR *dir; - struct dirent *dent; - char path[UTIL_PATH_SIZE]; - - util_strscpyl(path, sizeof(path), udev_get_run_path(udev), "/tags/", - udev_list_entry_get_name(list_entry), NULL); - dir = opendir(path); - if (dir == NULL) - continue; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct udev_device *dev; - - if (dent->d_name[0] == '.') - continue; - - dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); - if (dev == NULL) - continue; - - if (!match_subsystem(udev_enumerate, udev_device_get_subsystem(dev))) - goto nomatch; - if (!match_sysname(udev_enumerate, udev_device_get_sysname(dev))) - goto nomatch; - if (!match_parent(udev_enumerate, dev)) - goto nomatch; - if (!match_property(udev_enumerate, dev)) - goto nomatch; - if (!match_sysattr(udev_enumerate, dev)) - goto nomatch; - - syspath_add(udev_enumerate, udev_device_get_syspath(dev)); -nomatch: - udev_device_unref(dev); - } - closedir(dir); - } - return 0; -} - -static int parent_add_child(struct udev_enumerate *enumerate, const char *path) -{ - struct udev_device *dev; - - dev = udev_device_new_from_syspath(enumerate->udev, path); - if (dev == NULL) - return -ENODEV; - - if (!match_subsystem(enumerate, udev_device_get_subsystem(dev))) - return 0; - if (!match_sysname(enumerate, udev_device_get_sysname(dev))) - return 0; - if (!match_property(enumerate, dev)) - return 0; - if (!match_sysattr(enumerate, dev)) - return 0; - - syspath_add(enumerate, udev_device_get_syspath(dev)); - udev_device_unref(dev); - return 1; -} - -static int parent_crawl_children(struct udev_enumerate *enumerate, const char *path, int maxdepth) -{ - DIR *d; - struct dirent *dent; - - d = opendir(path); - if (d == NULL) - return -errno; - - for (dent = readdir(d); dent != NULL; dent = readdir(d)) { - char *child; - - if (dent->d_name[0] == '.') - continue; - if (dent->d_type != DT_DIR) - continue; - if (asprintf(&child, "%s/%s", path, dent->d_name) < 0) - continue; - parent_add_child(enumerate, child); - if (maxdepth > 0) - parent_crawl_children(enumerate, child, maxdepth-1); - free(child); - } - - closedir(d); - return 0; -} - -static int scan_devices_children(struct udev_enumerate *enumerate) -{ - const char *path; - - path = udev_device_get_syspath(enumerate->parent_match); - parent_add_child(enumerate, path); - return parent_crawl_children(enumerate, path, 256); -} - -static int scan_devices_all(struct udev_enumerate *udev_enumerate) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char base[UTIL_PATH_SIZE]; - struct stat statbuf; - - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); - if (stat(base, &statbuf) == 0) { - /* we have /subsystem/, forget all the old stuff */ - dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "subsystem", "devices", NULL); - } else { - dbg(udev, "searching '/bus/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "bus", "devices", NULL); - dbg(udev, "searching '/class/*' dir\n"); - scan_dir(udev_enumerate, "class", NULL, NULL); - } - return 0; -} - -/** - * udev_enumerate_scan_devices: - * @udev_enumerate: udev enumeration context - * - * Returns: 0 on success, otherwise a negative error value. - **/ -UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) -{ - if (udev_enumerate == NULL) - return -EINVAL; - - /* efficiently lookup tags only, we maintain a reverse-index */ - if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) - return scan_devices_tags(udev_enumerate); - - /* walk the subtree of one parent device only */ - if (udev_enumerate->parent_match != NULL) - return scan_devices_children(udev_enumerate); - - /* scan devices of all subsystems */ - return scan_devices_all(udev_enumerate); -} - -/** - * udev_enumerate_scan_subsystems: - * @udev_enumerate: udev enumeration context - * - * Returns: 0 on success, otherwise a negative error value. - **/ -UDEV_EXPORT int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char base[UTIL_PATH_SIZE]; - struct stat statbuf; - const char *subsysdir; - - if (udev_enumerate == NULL) - return -EINVAL; - - /* all kernel modules */ - if (match_subsystem(udev_enumerate, "module")) { - dbg(udev, "searching '%s/modules/*' dir\n", subsysdir); - scan_dir_and_add_devices(udev_enumerate, "module", NULL, NULL); - } - - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); - if (stat(base, &statbuf) == 0) - subsysdir = "subsystem"; - else - subsysdir = "bus"; - - /* all subsystems (only buses support coldplug) */ - if (match_subsystem(udev_enumerate, "subsystem")) { - dbg(udev, "searching '%s/*' dir\n", subsysdir); - scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); - } - - /* all subsystem drivers */ - if (match_subsystem(udev_enumerate, "drivers")) { - dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); - scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); - } - return 0; -} diff --git a/libudev/libudev-list.c b/libudev/libudev-list.c deleted file mode 100644 index f74a88ca49..0000000000 --- a/libudev/libudev-list.c +++ /dev/null @@ -1,344 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/** - * SECTION:libudev-list - * @short_description: list operation - * - * Libudev list operations. - */ - -/** - * udev_list_entry: - * - * Opaque object representing one entry in a list. An entry contains - * contains a name, and optionally a value. - */ -struct udev_list_entry { - struct udev_list_node node; - struct udev_list *list; - char *name; - char *value; - int num; -}; - -/* the list's head points to itself if empty */ -void udev_list_node_init(struct udev_list_node *list) -{ - list->next = list; - list->prev = list; -} - -int udev_list_node_is_empty(struct udev_list_node *list) -{ - return list->next == list; -} - -static void udev_list_node_insert_between(struct udev_list_node *new, - struct udev_list_node *prev, - struct udev_list_node *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list) -{ - udev_list_node_insert_between(new, list->prev, list); -} - -void udev_list_node_remove(struct udev_list_node *entry) -{ - struct udev_list_node *prev = entry->prev; - struct udev_list_node *next = entry->next; - - next->prev = prev; - prev->next = next; - - entry->prev = NULL; - entry->next = NULL; -} - -/* return list entry which embeds this node */ -static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) -{ - char *list; - - list = (char *)node; - list -= offsetof(struct udev_list_entry, node); - return (struct udev_list_entry *)list; -} - -void udev_list_init(struct udev *udev, struct udev_list *list, bool unique) -{ - memset(list, 0x00, sizeof(struct udev_list)); - list->udev = udev; - list->unique = unique; - udev_list_node_init(&list->node); -} - -/* insert entry into a list as the last element */ -void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) -{ - /* inserting before the list head make the node the last node in the list */ - udev_list_node_insert_between(&new->node, list->node.prev, &list->node); - new->list = list; -} - -/* insert entry into a list, before a given existing entry */ -void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) -{ - udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node); - new->list = entry->list; -} - -/* binary search in sorted array */ -static int list_search(struct udev_list *list, const char *name) -{ - unsigned int first, last; - - first = 0; - last = list->entries_cur; - while (first < last) { - unsigned int i; - int cmp; - - i = (first + last)/2; - cmp = strcmp(name, list->entries[i]->name); - if (cmp < 0) - last = i; - else if (cmp > 0) - first = i+1; - else - return i; - } - - /* not found, return negative insertion-index+1 */ - return -(first+1); -} - -struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value) -{ - struct udev_list_entry *entry; - int i = 0; - - if (list->unique) { - /* lookup existing name or insertion-index */ - i = list_search(list, name); - if (i >= 0) { - entry = list->entries[i]; - - dbg(list->udev, "'%s' is already in the list\n", name); - free(entry->value); - if (value == NULL) { - entry->value = NULL; - dbg(list->udev, "'%s' value unset\n", name); - return entry; - } - entry->value = strdup(value); - if (entry->value == NULL) - return NULL; - dbg(list->udev, "'%s' value replaced with '%s'\n", name, value); - return entry; - } - } - - /* add new name */ - entry = calloc(1, sizeof(struct udev_list_entry)); - if (entry == NULL) - return NULL; - entry->name = strdup(name); - if (entry->name == NULL) { - free(entry); - return NULL; - } - if (value != NULL) { - entry->value = strdup(value); - if (entry->value == NULL) { - free(entry->name); - free(entry); - return NULL; - } - } - - if (list->unique) { - /* allocate or enlarge sorted array if needed */ - if (list->entries_cur >= list->entries_max) { - unsigned int add; - - add = list->entries_max; - if (add < 1) - add = 64; - list->entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *)); - if (list->entries == NULL) { - free(entry->name); - free(entry->value); - return NULL; - } - list->entries_max += add; - } - - /* the negative i returned the insertion index */ - i = (-i)-1; - - /* insert into sorted list */ - if ((unsigned int)i < list->entries_cur) - udev_list_entry_insert_before(entry, list->entries[i]); - else - udev_list_entry_append(entry, list); - - /* insert into sorted array */ - memmove(&list->entries[i+1], &list->entries[i], - (list->entries_cur - i) * sizeof(struct udev_list_entry *)); - list->entries[i] = entry; - list->entries_cur++; - } else { - udev_list_entry_append(entry, list); - } - - dbg(list->udev, "'%s=%s' added\n", entry->name, entry->value); - return entry; -} - -void udev_list_entry_delete(struct udev_list_entry *entry) -{ - if (entry->list->entries != NULL) { - int i; - struct udev_list *list = entry->list; - - /* remove entry from sorted array */ - i = list_search(list, entry->name); - if (i >= 0) { - memmove(&list->entries[i], &list->entries[i+1], - ((list->entries_cur-1) - i) * sizeof(struct udev_list_entry *)); - list->entries_cur--; - } - } - - udev_list_node_remove(&entry->node); - free(entry->name); - free(entry->value); - free(entry); -} - -void udev_list_cleanup(struct udev_list *list) -{ - struct udev_list_entry *entry_loop; - struct udev_list_entry *entry_tmp; - - free(list->entries); - list->entries = NULL; - list->entries_cur = 0; - list->entries_max = 0; - udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) - udev_list_entry_delete(entry_loop); -} - -struct udev_list_entry *udev_list_get_entry(struct udev_list *list) -{ - if (udev_list_node_is_empty(&list->node)) - return NULL; - return list_node_to_entry(list->node.next); -} - -/** - * udev_list_entry_get_next: - * @list_entry: current entry - * - * Returns: the next entry from the list, #NULL is no more entries are found. - */ -UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) -{ - struct udev_list_node *next; - - if (list_entry == NULL) - return NULL; - next = list_entry->node.next; - /* empty list or no more entries */ - if (next == &list_entry->list->node) - return NULL; - return list_node_to_entry(next); -} - -/** - * udev_list_entry_get_by_name: - * @list_entry: current entry - * @name: name string to match - * - * Returns: the entry where @name matched, #NULL if no matching entry is found. - */ -UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) -{ - int i; - - if (list_entry == NULL) - return NULL; - - if (!list_entry->list->unique) - return NULL; - - i = list_search(list_entry->list, name); - if (i < 0) - return NULL; - return list_entry->list->entries[i]; -} - -/** - * udev_list_entry_get_name: - * @list_entry: current entry - * - * Returns: the name string of this entry. - */ -UDEV_EXPORT const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) -{ - if (list_entry == NULL) - return NULL; - return list_entry->name; -} - -/** - * udev_list_entry_get_value: - * @list_entry: current entry - * - * Returns: the value string of this entry. - */ -UDEV_EXPORT const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) -{ - if (list_entry == NULL) - return NULL; - return list_entry->value; -} - -int udev_list_entry_get_num(struct udev_list_entry *list_entry) -{ - if (list_entry == NULL) - return -EINVAL; - return list_entry->num; -} - -void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num) -{ - if (list_entry == NULL) - return; - list_entry->num = num; -} diff --git a/libudev/libudev-monitor.c b/libudev/libudev-monitor.c deleted file mode 100644 index f2f39f9582..0000000000 --- a/libudev/libudev-monitor.c +++ /dev/null @@ -1,875 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2010 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/** - * SECTION:libudev-monitor - * @short_description: device event source - * - * Connects to a device event source. - */ - -/** - * udev_monitor: - * - * Opaque object handling an event source. - */ -struct udev_monitor { - struct udev *udev; - int refcount; - int sock; - struct sockaddr_nl snl; - struct sockaddr_nl snl_trusted_sender; - struct sockaddr_nl snl_destination; - struct sockaddr_un sun; - socklen_t addrlen; - struct udev_list filter_subsystem_list; - struct udev_list filter_tag_list; - bool bound; -}; - -enum udev_monitor_netlink_group { - UDEV_MONITOR_NONE, - UDEV_MONITOR_KERNEL, - UDEV_MONITOR_UDEV, -}; - -#define UDEV_MONITOR_MAGIC 0xfeedcafe -struct udev_monitor_netlink_header { - /* "libudev" prefix to distinguish libudev and kernel messages */ - char prefix[8]; - /* - * magic to protect against daemon <-> library message format mismatch - * used in the kernel from socket filter rules; needs to be stored in network order - */ - unsigned int magic; - /* total length of header structure known to the sender */ - unsigned int header_size; - /* properties string buffer */ - unsigned int properties_off; - unsigned int properties_len; - /* - * hashes of primary device properties strings, to let libudev subscribers - * use in-kernel socket filters; values need to be stored in network order - */ - unsigned int filter_subsystem_hash; - unsigned int filter_devtype_hash; - unsigned int filter_tag_bloom_hi; - unsigned int filter_tag_bloom_lo; -}; - -static struct udev_monitor *udev_monitor_new(struct udev *udev) -{ - struct udev_monitor *udev_monitor; - - udev_monitor = calloc(1, sizeof(struct udev_monitor)); - if (udev_monitor == NULL) - return NULL; - udev_monitor->refcount = 1; - udev_monitor->udev = udev; - udev_list_init(udev, &udev_monitor->filter_subsystem_list, false); - udev_list_init(udev, &udev_monitor->filter_tag_list, true); - return udev_monitor; -} - -/** - * udev_monitor_new_from_socket: - * @udev: udev library context - * @socket_path: unix socket path - * - * This function should not be used in any new application. The - * kernel's netlink socket multiplexes messages to all interested - * clients. Creating custom sockets from udev to applications - * should be avoided. - * - * Create a new udev monitor and connect to a specified socket. The - * path to a socket either points to an existing socket file, or if - * the socket path starts with a '@' character, an abstract namespace - * socket will be used. - * - * A socket file will not be created. If it does not already exist, - * it will fall-back and connect to an abstract namespace socket with - * the given path. The permissions adjustment of a socket file, as - * well as the later cleanup, needs to be done by the caller. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev monitor. - * - * Returns: a new udev monitor, or #NULL, in case of an error - **/ -UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) -{ - struct udev_monitor *udev_monitor; - struct stat statbuf; - - if (udev == NULL) - return NULL; - if (socket_path == NULL) - return NULL; - udev_monitor = udev_monitor_new(udev); - if (udev_monitor == NULL) - return NULL; - - udev_monitor->sun.sun_family = AF_LOCAL; - if (socket_path[0] == '@') { - /* translate leading '@' to abstract namespace */ - util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); - udev_monitor->sun.sun_path[0] = '\0'; - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); - } else if (stat(socket_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { - /* existing socket file */ - util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); - } else { - /* no socket file, assume abstract namespace socket */ - util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; - } - udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); - if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %m\n"); - free(udev_monitor); - return NULL; - } - - dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); - return udev_monitor; -} - -struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd) -{ - struct udev_monitor *udev_monitor; - unsigned int group; - - if (udev == NULL) - return NULL; - - if (name == NULL) - group = UDEV_MONITOR_NONE; - else if (strcmp(name, "udev") == 0) - group = UDEV_MONITOR_UDEV; - else if (strcmp(name, "kernel") == 0) - group = UDEV_MONITOR_KERNEL; - else - return NULL; - - udev_monitor = udev_monitor_new(udev); - if (udev_monitor == NULL) - return NULL; - - if (fd < 0) { - udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT); - if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %m\n"); - free(udev_monitor); - return NULL; - } - } else { - udev_monitor->bound = true; - udev_monitor->sock = fd; - } - - udev_monitor->snl.nl_family = AF_NETLINK; - udev_monitor->snl.nl_groups = group; - - /* default destination for sending */ - udev_monitor->snl_destination.nl_family = AF_NETLINK; - udev_monitor->snl_destination.nl_groups = UDEV_MONITOR_UDEV; - - dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT (%u)\n", udev_monitor, group); - return udev_monitor; -} - -/** - * udev_monitor_new_from_netlink: - * @udev: udev library context - * @name: name of event source - * - * Create new udev monitor and connect to a specified event - * source. Valid sources identifiers are "udev" and "kernel". - * - * Applications should usually not connect directly to the - * "kernel" events, because the devices might not be useable - * at that time, before udev has configured them, and created - * device nodes. Accessing devices at the same time as udev, - * might result in unpredictable behavior. The "udev" events - * are sent out after udev has finished its event processing, - * all rules have been processed, and needed device nodes are - * created. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev monitor. - * - * Returns: a new udev monitor, or #NULL, in case of an error - **/ -UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) -{ - return udev_monitor_new_from_netlink_fd(udev, name, -1); -} - -static inline void bpf_stmt(struct sock_filter *inss, unsigned int *i, - unsigned short code, unsigned int data) -{ - struct sock_filter *ins = &inss[*i]; - - ins->code = code; - ins->k = data; - (*i)++; -} - -static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, - unsigned short code, unsigned int data, - unsigned short jt, unsigned short jf) -{ - struct sock_filter *ins = &inss[*i]; - - ins->code = code; - ins->jt = jt; - ins->jf = jf; - ins->k = data; - (*i)++; -} - -/** - * udev_monitor_filter_update: - * @udev_monitor: monitor - * - * Update the installed socket filter. This is only needed, - * if the filter was removed or changed. - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_monitor_filter_update(struct udev_monitor *udev_monitor) -{ - struct sock_filter ins[512]; - struct sock_fprog filter; - unsigned int i; - struct udev_list_entry *list_entry; - int err; - - if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL && - udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) - return 0; - - memset(ins, 0x00, sizeof(ins)); - i = 0; - - /* load magic in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, magic)); - /* jump if magic matches */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, UDEV_MONITOR_MAGIC, 1, 0); - /* wrong magic, pass packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); - - if (udev_list_get_entry(&udev_monitor->filter_tag_list) != NULL) { - int tag_matches; - - /* count tag matches, to calculate end of tag match block */ - tag_matches = 0; - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) - tag_matches++; - - /* add all tags matches */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { - uint64_t tag_bloom_bits = util_string_bloom64(udev_list_entry_get_name(list_entry)); - uint32_t tag_bloom_hi = tag_bloom_bits >> 32; - uint32_t tag_bloom_lo = tag_bloom_bits & 0xffffffff; - - /* load device bloom bits in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_hi)); - /* clear bits (tag bits & bloom bits) */ - bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_hi); - /* jump to next tag if it does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_hi, 0, 3); - - /* load device bloom bits in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_lo)); - /* clear bits (tag bits & bloom bits) */ - bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_lo); - /* jump behind end of tag match block if tag matches */ - tag_matches--; - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_lo, 1 + (tag_matches * 6), 0); - } - - /* nothing matched, drop packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); - } - - /* add all subsystem matches */ - if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { - unsigned int hash = util_string_hash32(udev_list_entry_get_name(list_entry)); - - /* load device subsystem value in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem_hash)); - if (udev_list_entry_get_value(list_entry) == NULL) { - /* jump if subsystem does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); - } else { - /* jump if subsystem does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3); - - /* load device devtype value in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_devtype_hash)); - /* jump if value does not match */ - hash = util_string_hash32(udev_list_entry_get_value(list_entry)); - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); - } - - /* matched, pass packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); - - if (i+1 >= ARRAY_SIZE(ins)) - return -1; - } - - /* nothing matched, drop packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); - } - - /* matched, pass packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); - - /* install filter */ - memset(&filter, 0x00, sizeof(filter)); - filter.len = i; - filter.filter = ins; - err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); - return err; -} - -int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender) -{ - udev_monitor->snl_trusted_sender.nl_pid = sender->snl.nl_pid; - return 0; -} -/** - * udev_monitor_enable_receiving: - * @udev_monitor: the monitor which should receive events - * - * Binds the @udev_monitor socket to the event source. - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) -{ - int err = 0; - const int on = 1; - - if (udev_monitor->sun.sun_family != 0) { - if (!udev_monitor->bound) { - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); - if (err == 0) - udev_monitor->bound = true; - } - } else if (udev_monitor->snl.nl_family != 0) { - udev_monitor_filter_update(udev_monitor); - if (!udev_monitor->bound) { - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); - if (err == 0) - udev_monitor->bound = true; - } - if (err == 0) { - struct sockaddr_nl snl; - socklen_t addrlen; - - /* - * get the address the kernel has assigned us - * it is usually, but not necessarily the pid - */ - addrlen = sizeof(struct sockaddr_nl); - err = getsockname(udev_monitor->sock, (struct sockaddr *)&snl, &addrlen); - if (err == 0) - udev_monitor->snl.nl_pid = snl.nl_pid; - } - } else { - return -EINVAL; - } - - if (err < 0) { - err(udev_monitor->udev, "bind failed: %m\n"); - return err; - } - - /* enable receiving of sender credentials */ - setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - return 0; -} - -/** - * udev_monitor_set_receive_buffer_size: - * @udev_monitor: the monitor which should receive events - * @size: the size in bytes - * - * Set the size of the kernel socket buffer. This call needs the - * appropriate privileges to succeed. - * - * Returns: 0 on success, otherwise -1 on error. - */ -UDEV_EXPORT int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) -{ - if (udev_monitor == NULL) - return -1; - return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size)); -} - -int udev_monitor_disconnect(struct udev_monitor *udev_monitor) -{ - int err; - - err = close(udev_monitor->sock); - udev_monitor->sock = -1; - return err; -} - -/** - * udev_monitor_ref: - * @udev_monitor: udev monitor - * - * Take a reference of a udev monitor. - * - * Returns: the passed udev monitor - **/ -UDEV_EXPORT struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) -{ - if (udev_monitor == NULL) - return NULL; - udev_monitor->refcount++; - return udev_monitor; -} - -/** - * udev_monitor_unref: - * @udev_monitor: udev monitor - * - * Drop a reference of a udev monitor. If the refcount reaches zero, - * the bound socket will be closed, and the resources of the monitor - * will be released. - * - **/ -UDEV_EXPORT void udev_monitor_unref(struct udev_monitor *udev_monitor) -{ - if (udev_monitor == NULL) - return; - udev_monitor->refcount--; - if (udev_monitor->refcount > 0) - return; - if (udev_monitor->sock >= 0) - close(udev_monitor->sock); - udev_list_cleanup(&udev_monitor->filter_subsystem_list); - udev_list_cleanup(&udev_monitor->filter_tag_list); - dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); - free(udev_monitor); -} - -/** - * udev_monitor_get_udev: - * @udev_monitor: udev monitor - * - * Retrieve the udev library context the monitor was created with. - * - * Returns: the udev library context - **/ -UDEV_EXPORT struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) -{ - if (udev_monitor == NULL) - return NULL; - return udev_monitor->udev; -} - -/** - * udev_monitor_get_fd: - * @udev_monitor: udev monitor - * - * Retrieve the socket file descriptor associated with the monitor. - * - * Returns: the socket file descriptor - **/ -UDEV_EXPORT int udev_monitor_get_fd(struct udev_monitor *udev_monitor) -{ - if (udev_monitor == NULL) - return -1; - return udev_monitor->sock; -} - -static int passes_filter(struct udev_monitor *udev_monitor, struct udev_device *udev_device) -{ - struct udev_list_entry *list_entry; - - if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) - goto tag; - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { - const char *subsys = udev_list_entry_get_name(list_entry); - const char *dsubsys = udev_device_get_subsystem(udev_device); - const char *devtype; - const char *ddevtype; - - if (strcmp(dsubsys, subsys) != 0) - continue; - - devtype = udev_list_entry_get_value(list_entry); - if (devtype == NULL) - goto tag; - ddevtype = udev_device_get_devtype(udev_device); - if (ddevtype == NULL) - continue; - if (strcmp(ddevtype, devtype) == 0) - goto tag; - } - return 0; - -tag: - if (udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) - return 1; - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { - const char *tag = udev_list_entry_get_name(list_entry); - - if (udev_device_has_tag(udev_device, tag)) - return 1; - } - return 0; -} - -/** - * udev_monitor_receive_device: - * @udev_monitor: udev monitor - * - * Receive data from the udev monitor socket, allocate a new udev - * device, fill in the received data, and return the device. - * - * Only socket connections with uid=0 are accepted. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev device. - * - * Returns: a new udev device, or #NULL, in case of an error - **/ -UDEV_EXPORT struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) -{ - struct udev_device *udev_device; - struct msghdr smsg; - struct iovec iov; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - struct cmsghdr *cmsg; - struct sockaddr_nl snl; - struct ucred *cred; - char buf[8192]; - ssize_t buflen; - ssize_t bufpos; - struct udev_monitor_netlink_header *nlh; - -retry: - if (udev_monitor == NULL) - return NULL; - memset(buf, 0x00, sizeof(buf)); - iov.iov_base = &buf; - iov.iov_len = sizeof(buf); - memset (&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - - if (udev_monitor->snl.nl_family != 0) { - smsg.msg_name = &snl; - smsg.msg_namelen = sizeof(snl); - } - - buflen = recvmsg(udev_monitor->sock, &smsg, 0); - if (buflen < 0) { - if (errno != EINTR) - info(udev_monitor->udev, "unable to receive message\n"); - return NULL; - } - - if (buflen < 32 || (size_t)buflen >= sizeof(buf)) { - info(udev_monitor->udev, "invalid message length\n"); - return NULL; - } - - if (udev_monitor->snl.nl_family != 0) { - if (snl.nl_groups == 0) { - /* unicast message, check if we trust the sender */ - if (udev_monitor->snl_trusted_sender.nl_pid == 0 || - snl.nl_pid != udev_monitor->snl_trusted_sender.nl_pid) { - info(udev_monitor->udev, "unicast netlink message ignored\n"); - return NULL; - } - } else if (snl.nl_groups == UDEV_MONITOR_KERNEL) { - if (snl.nl_pid > 0) { - info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", - snl.nl_pid); - return NULL; - } - } - } - - cmsg = CMSG_FIRSTHDR(&smsg); - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - info(udev_monitor->udev, "no sender credentials received, message ignored\n"); - return NULL; - } - - cred = (struct ucred *)CMSG_DATA(cmsg); - if (cred->uid != 0) { - info(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid); - return NULL; - } - - if (memcmp(buf, "libudev", 8) == 0) { - /* udev message needs proper version magic */ - nlh = (struct udev_monitor_netlink_header *) buf; - if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) { - err(udev_monitor->udev, "unrecognized message signature (%x != %x)\n", - nlh->magic, htonl(UDEV_MONITOR_MAGIC)); - return NULL; - } - if (nlh->properties_off+32 > buflen) - return NULL; - bufpos = nlh->properties_off; - } else { - /* kernel message with header */ - bufpos = strlen(buf) + 1; - if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) { - info(udev_monitor->udev, "invalid message length\n"); - return NULL; - } - - /* check message header */ - if (strstr(buf, "@/") == NULL) { - info(udev_monitor->udev, "unrecognized message header\n"); - return NULL; - } - } - - udev_device = udev_device_new(udev_monitor->udev); - if (udev_device == NULL) - return NULL; - udev_device_set_info_loaded(udev_device); - - while (bufpos < buflen) { - char *key; - size_t keylen; - - key = &buf[bufpos]; - keylen = strlen(key); - if (keylen == 0) - break; - bufpos += keylen + 1; - udev_device_add_property_from_string_parse(udev_device, key); - } - - if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { - info(udev_monitor->udev, "missing values, invalid device\n"); - udev_device_unref(udev_device); - return NULL; - } - - /* skip device, if it does not pass the current filter */ - if (!passes_filter(udev_monitor, udev_device)) { - struct pollfd pfd[1]; - int rc; - - udev_device_unref(udev_device); - - /* if something is queued, get next device */ - pfd[0].fd = udev_monitor->sock; - pfd[0].events = POLLIN; - rc = poll(pfd, 1, 0); - if (rc > 0) - goto retry; - return NULL; - } - - return udev_device; -} - -int udev_monitor_send_device(struct udev_monitor *udev_monitor, - struct udev_monitor *destination, struct udev_device *udev_device) -{ - const char *buf; - ssize_t blen; - ssize_t count; - - blen = udev_device_get_properties_monitor_buf(udev_device, &buf); - if (blen < 32) - return -EINVAL; - - if (udev_monitor->sun.sun_family != 0) { - struct msghdr smsg; - struct iovec iov[2]; - const char *action; - char header[2048]; - char *s; - - /* header @ */ - action = udev_device_get_action(udev_device); - if (action == NULL) - return -EINVAL; - s = header; - if (util_strpcpyl(&s, sizeof(header), action, "@", udev_device_get_devpath(udev_device), NULL) == 0) - return -EINVAL; - iov[0].iov_base = header; - iov[0].iov_len = (s - header)+1; - - /* add properties list */ - iov[1].iov_base = (char *)buf; - iov[1].iov_len = blen; - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = iov; - smsg.msg_iovlen = 2; - smsg.msg_name = &udev_monitor->sun; - smsg.msg_namelen = udev_monitor->addrlen; - count = sendmsg(udev_monitor->sock, &smsg, 0); - info(udev_monitor->udev, "passed %zi bytes to socket monitor %p\n", count, udev_monitor); - return count; - } - - if (udev_monitor->snl.nl_family != 0) { - struct msghdr smsg; - struct iovec iov[2]; - const char *val; - struct udev_monitor_netlink_header nlh; - struct udev_list_entry *list_entry; - uint64_t tag_bloom_bits; - - /* add versioned header */ - memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header)); - memcpy(nlh.prefix, "libudev", 8); - nlh.magic = htonl(UDEV_MONITOR_MAGIC); - nlh.header_size = sizeof(struct udev_monitor_netlink_header); - val = udev_device_get_subsystem(udev_device); - nlh.filter_subsystem_hash = htonl(util_string_hash32(val)); - val = udev_device_get_devtype(udev_device); - if (val != NULL) - nlh.filter_devtype_hash = htonl(util_string_hash32(val)); - iov[0].iov_base = &nlh; - iov[0].iov_len = sizeof(struct udev_monitor_netlink_header); - - /* add tag bloom filter */ - tag_bloom_bits = 0; - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) - tag_bloom_bits |= util_string_bloom64(udev_list_entry_get_name(list_entry)); - if (tag_bloom_bits > 0) { - nlh.filter_tag_bloom_hi = htonl(tag_bloom_bits >> 32); - nlh.filter_tag_bloom_lo = htonl(tag_bloom_bits & 0xffffffff); - } - - /* add properties list */ - nlh.properties_off = iov[0].iov_len; - nlh.properties_len = blen; - iov[1].iov_base = (char *)buf; - iov[1].iov_len = blen; - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = iov; - smsg.msg_iovlen = 2; - /* - * Use custom address for target, or the default one. - * - * If we send to a multicast group, we will get - * ECONNREFUSED, which is expected. - */ - if (destination != NULL) - smsg.msg_name = &destination->snl; - else - smsg.msg_name = &udev_monitor->snl_destination; - smsg.msg_namelen = sizeof(struct sockaddr_nl); - count = sendmsg(udev_monitor->sock, &smsg, 0); - info(udev_monitor->udev, "passed %zi bytes to netlink monitor %p\n", count, udev_monitor); - return count; - } - - return -EINVAL; -} - -/** - * udev_monitor_filter_add_match_subsystem_devtype: - * @udev_monitor: the monitor - * @subsystem: the subsystem value to match the incoming devices against - * @devtype: the devtype value to match the incoming devices against - * - * This filter is efficiently executed inside the kernel, and libudev subscribers - * will usually not be woken up for devices which do not match. - * - * The filter must be installed before the monitor is switched to listening mode. - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) -{ - if (udev_monitor == NULL) - return -EINVAL; - if (subsystem == NULL) - return -EINVAL; - if (udev_list_entry_add(&udev_monitor->filter_subsystem_list, subsystem, devtype) == NULL) - return -ENOMEM; - return 0; -} - -/** - * udev_monitor_filter_add_match_tag: - * @udev_monitor: the monitor - * @tag: the name of a tag - * - * This filter is efficiently executed inside the kernel, and libudev subscribers - * will usually not be woken up for devices which do not match. - * - * The filter must be installed before the monitor is switched to listening mode. - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag) -{ - if (udev_monitor == NULL) - return -EINVAL; - if (tag == NULL) - return -EINVAL; - if (udev_list_entry_add(&udev_monitor->filter_tag_list, tag, NULL) == NULL) - return -ENOMEM; - return 0; -} - -/** - * udev_monitor_filter_remove: - * @udev_monitor: monitor - * - * Remove all filters from monitor. - * - * Returns: 0 on success, otherwise a negative error value. - */ -UDEV_EXPORT int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) -{ - static struct sock_fprog filter = { 0, NULL }; - - udev_list_cleanup(&udev_monitor->filter_subsystem_list); - return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); -} diff --git a/libudev/libudev-private.h b/libudev/libudev-private.h deleted file mode 100644 index 83976698a9..0000000000 --- a/libudev/libudev-private.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2010 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#ifndef _LIBUDEV_PRIVATE_H_ -#define _LIBUDEV_PRIVATE_H_ - -#include -#include -#include -#include -#include "libudev.h" - -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#define READ_END 0 -#define WRITE_END 1 - -static inline void __attribute__((always_inline, format(printf, 2, 3))) -udev_log_null(struct udev *udev, const char *format, ...) {} - -#define udev_log_cond(udev, prio, arg...) \ - do { \ - if (udev_get_log_priority(udev) >= prio) \ - udev_log(udev, prio, __FILE__, __LINE__, __FUNCTION__, ## arg); \ - } while (0) - -#ifdef ENABLE_LOGGING -# ifdef ENABLE_DEBUG -# define dbg(udev, arg...) udev_log_cond(udev, LOG_DEBUG, ## arg) -# else -# define dbg(udev, arg...) udev_log_null(udev, ## arg) -# endif -# define info(udev, arg...) udev_log_cond(udev, LOG_INFO, ## arg) -# define err(udev, arg...) udev_log_cond(udev, LOG_ERR, ## arg) -#else -# define dbg(udev, arg...) udev_log_null(udev, ## arg) -# define info(udev, arg...) udev_log_null(udev, ## arg) -# define err(udev, arg...) udev_log_null(udev, ## arg) -#endif - -#define UDEV_EXPORT __attribute__ ((visibility("default"))) - -static inline void udev_log_init(const char *program_name) -{ - openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); -} - -static inline void udev_log_close(void) -{ - closelog(); -} - -/* libudev.c */ -void udev_log(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, ...) - __attribute__((format(printf, 6, 7))); -int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *ts_usec[]); -struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); -struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); - -/* libudev-device.c */ -struct udev_device *udev_device_new(struct udev *udev); -struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id); -mode_t udev_device_get_devnode_mode(struct udev_device *udev_device); -int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); -int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); -int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique); -void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); -struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); -void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property); -int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device); -char **udev_device_get_properties_envp(struct udev_device *udev_device); -ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); -int udev_device_read_db(struct udev_device *udev_device, const char *dbfile); -int udev_device_read_uevent_file(struct udev_device *udev_device); -int udev_device_set_action(struct udev_device *udev_device, const char *action); -const char *udev_device_get_devpath_old(struct udev_device *udev_device); -const char *udev_device_get_id_filename(struct udev_device *udev_device); -void udev_device_set_is_initialized(struct udev_device *udev_device); -int udev_device_add_tag(struct udev_device *udev_device, const char *tag); -void udev_device_cleanup_tags_list(struct udev_device *udev_device); -unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device); -void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized); -int udev_device_get_devlink_priority(struct udev_device *udev_device); -int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); -int udev_device_get_watch_handle(struct udev_device *udev_device); -int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); -int udev_device_get_ifindex(struct udev_device *udev_device); -void udev_device_set_info_loaded(struct udev_device *device); -bool udev_device_get_db_persist(struct udev_device *udev_device); -void udev_device_set_db_persist(struct udev_device *udev_device); - -/* libudev-device-private.c */ -int udev_device_update_db(struct udev_device *udev_device); -int udev_device_delete_db(struct udev_device *udev_device); -int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add); - -/* libudev-monitor.c - netlink/unix socket communication */ -int udev_monitor_disconnect(struct udev_monitor *udev_monitor); -int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); -int udev_monitor_send_device(struct udev_monitor *udev_monitor, - struct udev_monitor *destination, struct udev_device *udev_device); -struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd); - -/* libudev-list.c */ -struct udev_list_node { - struct udev_list_node *next, *prev; -}; -struct udev_list { - struct udev *udev; - struct udev_list_node node; - struct udev_list_entry **entries; - unsigned int entries_cur; - unsigned int entries_max; - bool unique; -}; -#define UDEV_LIST(list) struct udev_list_node list = { &(list), &(list) } -void udev_list_node_init(struct udev_list_node *list); -int udev_list_node_is_empty(struct udev_list_node *list); -void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list); -void udev_list_node_remove(struct udev_list_node *entry); -#define udev_list_node_foreach(node, list) \ - for (node = (list)->next; \ - node != list; \ - node = (node)->next) -#define udev_list_node_foreach_safe(node, tmp, list) \ - for (node = (list)->next, tmp = (node)->next; \ - node != list; \ - node = tmp, tmp = (tmp)->next) -void udev_list_init(struct udev *udev, struct udev_list *list, bool unique); -void udev_list_cleanup(struct udev_list *list); -struct udev_list_entry *udev_list_get_entry(struct udev_list *list); -struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value); -void udev_list_entry_delete(struct udev_list_entry *entry); -void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry); -void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list); -int udev_list_entry_get_num(struct udev_list_entry *list_entry); -void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num); -#define udev_list_entry_foreach_safe(entry, tmp, first) \ - for (entry = first, tmp = udev_list_entry_get_next(entry); \ - entry != NULL; \ - entry = tmp, tmp = udev_list_entry_get_next(tmp)) - -/* libudev-queue.c */ -unsigned long long int udev_get_kernel_seqnum(struct udev *udev); -int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum); -ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size); -ssize_t udev_queue_skip_devpath(FILE *queue_file); - -/* libudev-queue-private.c */ -struct udev_queue_export *udev_queue_export_new(struct udev *udev); -struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev_queue_export); -void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); -int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); -int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); - -/* libudev-util.c */ -#define UTIL_PATH_SIZE 1024 -#define UTIL_NAME_SIZE 512 -#define UTIL_LINE_SIZE 16384 -#define UDEV_ALLOWED_CHARS_INPUT "/ $%?," -ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size); -int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); -int util_log_priority(const char *priority); -size_t util_path_encode(const char *src, char *dest, size_t size); -size_t util_path_decode(char *s); -void util_remove_trailing_chars(char *path, char c); -size_t util_strpcpy(char **dest, size_t size, const char *src); -size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__((sentinel)); -size_t util_strscpy(char *dest, size_t size, const char *src); -size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__((sentinel)); -int util_replace_whitespace(const char *str, char *to, size_t len); -int util_replace_chars(char *str, const char *white); -unsigned int util_string_hash32(const char *key); -uint64_t util_string_bloom64(const char *str); - -/* libudev-util-private.c */ -int util_create_path(struct udev *udev, const char *path); -int util_create_path_selinux(struct udev *udev, const char *path); -int util_delete_path(struct udev *udev, const char *path); -uid_t util_lookup_user(struct udev *udev, const char *user); -gid_t util_lookup_group(struct udev *udev, const char *group); -int util_resolve_subsys_kernel(struct udev *udev, const char *string, - char *result, size_t maxsize, int read_value); -unsigned long long ts_usec(const struct timespec *ts); -unsigned long long now_usec(void); - -/* libudev-selinux-private.c */ -#ifndef WITH_SELINUX -static inline void udev_selinux_init(struct udev *udev) {} -static inline void udev_selinux_exit(struct udev *udev) {} -static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} -static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} -static inline void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode) {} -static inline void udev_selinux_resetfscreatecon(struct udev *udev) {} -#else -void udev_selinux_init(struct udev *udev); -void udev_selinux_exit(struct udev *udev); -void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); -void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); -void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode); -void udev_selinux_resetfscreatecon(struct udev *udev); -#endif - -#endif diff --git a/libudev/libudev-queue-private.c b/libudev/libudev-queue-private.c deleted file mode 100644 index e0a7b53b81..0000000000 --- a/libudev/libudev-queue-private.c +++ /dev/null @@ -1,412 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * Copyright (C) 2009 Alan Jenkins - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -/* - * DISCLAIMER - The file format mentioned here is private to udev/libudev, - * and may be changed without notice. - * - * The udev event queue is exported as a binary log file. - * Each log record consists of a sequence number followed by the device path. - * - * When a new event is queued, its details are appended to the log. - * When the event finishes, a second record is appended to the log - * with the same sequence number but a devpath len of 0. - * - * Example: - * { 0x0000000000000001 } - * { 0x0000000000000001, 0x0019, "/devices/virtual/mem/null" }, - * { 0x0000000000000002, 0x001b, "/devices/virtual/mem/random" }, - * { 0x0000000000000001, 0x0000 }, - * { 0x0000000000000003, 0x0019, "/devices/virtual/mem/zero" }, - * - * Events 2 and 3 are still queued, but event 1 has finished. - * - * The queue does not grow indefinitely. It is periodically re-created - * to remove finished events. Atomic rename() makes this transparent to readers. - * - * The queue file starts with a single sequence number which specifies the - * minimum sequence number in the log that follows. Any events prior to this - * sequence number have already finished. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); - -struct udev_queue_export { - struct udev *udev; - int queued_count; /* number of unfinished events exported in queue file */ - FILE *queue_file; - unsigned long long int seqnum_max; /* earliest sequence number in queue file */ - unsigned long long int seqnum_min; /* latest sequence number in queue file */ - int waste_bytes; /* queue file bytes wasted on finished events */ -}; - -struct udev_queue_export *udev_queue_export_new(struct udev *udev) -{ - struct udev_queue_export *udev_queue_export; - unsigned long long int initial_seqnum; - - if (udev == NULL) - return NULL; - - udev_queue_export = calloc(1, sizeof(struct udev_queue_export)); - if (udev_queue_export == NULL) - return NULL; - udev_queue_export->udev = udev; - - initial_seqnum = udev_get_kernel_seqnum(udev); - udev_queue_export->seqnum_min = initial_seqnum; - udev_queue_export->seqnum_max = initial_seqnum; - - udev_queue_export_cleanup(udev_queue_export); - if (rebuild_queue_file(udev_queue_export) != 0) { - free(udev_queue_export); - return NULL; - } - - return udev_queue_export; -} - -struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev_queue_export) -{ - if (udev_queue_export == NULL) - return NULL; - if (udev_queue_export->queue_file != NULL) - fclose(udev_queue_export->queue_file); - free(udev_queue_export); - return NULL; -} - -void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) -{ - char filename[UTIL_PATH_SIZE]; - - if (udev_queue_export == NULL) - return; - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); - unlink(filename); - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); - unlink(filename); -} - -static int skip_to(FILE *file, long offset) -{ - long old_offset; - - /* fseek may drop buffered data, avoid it for small seeks */ - old_offset = ftell(file); - if (offset > old_offset && offset - old_offset <= BUFSIZ) { - size_t skip_bytes = offset - old_offset; - char buf[skip_bytes]; - - if (fread(buf, skip_bytes, 1, file) != skip_bytes) - return -1; - } - - return fseek(file, offset, SEEK_SET); -} - -struct queue_devpaths { - unsigned int devpaths_first; /* index of first queued event */ - unsigned int devpaths_size; - long devpaths[]; /* seqnum -> offset of devpath in queue file (or 0) */ -}; - -/* - * Returns a table mapping seqnum to devpath file offset for currently queued events. - * devpaths[i] represents the event with seqnum = i + udev_queue_export->seqnum_min. - */ -static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_export) -{ - struct queue_devpaths *devpaths; - unsigned long long int range; - long devpath_offset; - ssize_t devpath_len; - unsigned long long int seqnum; - unsigned long long int n; - unsigned int i; - - /* seek to the first event in the file */ - rewind(udev_queue_export->queue_file); - udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum); - - /* allocate the table */ - range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max; - if (range - 1 > INT_MAX) { - err(udev_queue_export->udev, "queue file overflow\n"); - return NULL; - } - devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); - if (devpaths == NULL) - return NULL; - devpaths->devpaths_size = range + 1; - - /* read all records and populate the table */ - for (;;) { - if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) - break; - n = seqnum - udev_queue_export->seqnum_max; - if (n >= devpaths->devpaths_size) - goto read_error; - - devpath_offset = ftell(udev_queue_export->queue_file); - devpath_len = udev_queue_skip_devpath(udev_queue_export->queue_file); - if (devpath_len < 0) - goto read_error; - - if (devpath_len > 0) - devpaths->devpaths[n] = devpath_offset; - else - devpaths->devpaths[n] = 0; - } - - /* find first queued event */ - for (i = 0; i < devpaths->devpaths_size; i++) { - if (devpaths->devpaths[i] != 0) - break; - } - devpaths->devpaths_first = i; - - return devpaths; - -read_error: - err(udev_queue_export->udev, "queue file corrupted\n"); - free(devpaths); - return NULL; -} - -static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) -{ - unsigned long long int seqnum; - struct queue_devpaths *devpaths = NULL; - char filename[UTIL_PATH_SIZE]; - char filename_tmp[UTIL_PATH_SIZE]; - FILE *new_queue_file = NULL; - unsigned int i; - - /* read old queue file */ - if (udev_queue_export->queue_file != NULL) { - dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n", - udev_queue_export->waste_bytes); - - devpaths = build_index(udev_queue_export); - if (devpaths != NULL) - udev_queue_export->seqnum_max += devpaths->devpaths_first; - } - if (devpaths == NULL) { - dbg(udev_queue_export->udev, "creating empty queue file\n"); - udev_queue_export->queued_count = 0; - udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; - } - - /* create new queue file */ - util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); - new_queue_file = fopen(filename_tmp, "w+"); - if (new_queue_file == NULL) - goto error; - seqnum = udev_queue_export->seqnum_max; - fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); - - /* copy unfinished events only to the new file */ - if (devpaths != NULL) { - for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { - char devpath[UTIL_PATH_SIZE]; - int err; - unsigned short devpath_len; - - if (devpaths->devpaths[i] != 0) - { - skip_to(udev_queue_export->queue_file, devpaths->devpaths[i]); - err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); - devpath_len = err; - - fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); - fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); - fwrite(devpath, 1, devpath_len, new_queue_file); - } - seqnum++; - } - free(devpaths); - devpaths = NULL; - } - fflush(new_queue_file); - if (ferror(new_queue_file)) - goto error; - - /* rename the new file on top of the old one */ - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); - if (rename(filename_tmp, filename) != 0) - goto error; - - if (udev_queue_export->queue_file != NULL) - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = new_queue_file; - udev_queue_export->waste_bytes = 0; - - return 0; - -error: - err(udev_queue_export->udev, "failed to create queue file: %m\n"); - udev_queue_export_cleanup(udev_queue_export); - - if (udev_queue_export->queue_file != NULL) { - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - } - if (new_queue_file != NULL) - fclose(new_queue_file); - - if (devpaths != NULL) - free(devpaths); - udev_queue_export->queued_count = 0; - udev_queue_export->waste_bytes = 0; - udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; - - return -1; -} - -static int write_queue_record(struct udev_queue_export *udev_queue_export, - unsigned long long int seqnum, const char *devpath, size_t devpath_len) -{ - unsigned short len; - - if (udev_queue_export->queue_file == NULL) { - dbg(udev_queue_export->udev, "can't record event: queue file not available\n"); - return -1; - } - - if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1) - goto write_error; - - len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; - if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) - goto write_error; - if (len > 0) { - if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) - goto write_error; - } - - /* *must* flush output; caller may fork */ - if (fflush(udev_queue_export->queue_file) != 0) - goto write_error; - - return 0; - -write_error: - /* if we failed half way through writing a record to a file, - we should not try to write any further records to it. */ - err(udev_queue_export->udev, "error writing to queue file: %m\n"); - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - - return -1; -} - -enum device_state { - DEVICE_QUEUED, - DEVICE_FINISHED, -}; - -static inline size_t queue_record_size(size_t devpath_len) -{ - return sizeof(unsigned long long int) + sizeof(unsigned short int) + devpath_len; -} - -static int update_queue(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - unsigned long long int seqnum = udev_device_get_seqnum(udev_device); - const char *devpath = NULL; - size_t devpath_len = 0; - int bytes; - int err; - - /* FINISHED records have a zero length devpath */ - if (state == DEVICE_QUEUED) { - devpath = udev_device_get_devpath(udev_device); - devpath_len = strlen(devpath); - } - - /* recover from an earlier failed rebuild */ - if (udev_queue_export->queue_file == NULL) { - if (rebuild_queue_file(udev_queue_export) != 0) - return -1; - } - - /* if we're removing the last event from the queue, that's the best time to rebuild it */ - if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1) { - /* we don't need to read the old queue file */ - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - rebuild_queue_file(udev_queue_export); - return 0; - } - - /* try to rebuild the queue files before they grow larger than one page. */ - bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); - if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) - rebuild_queue_file(udev_queue_export); - - /* don't record a finished event, if we already dropped the event in a failed rebuild */ - if (seqnum < udev_queue_export->seqnum_max) - return 0; - - /* now write to the queue */ - if (state == DEVICE_QUEUED) { - udev_queue_export->queued_count++; - udev_queue_export->seqnum_min = seqnum; - } else { - udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0); - udev_queue_export->queued_count--; - } - err = write_queue_record(udev_queue_export, seqnum, devpath, devpath_len); - - /* try to handle ENOSPC */ - if (err != 0 && udev_queue_export->queued_count == 0) { - udev_queue_export_cleanup(udev_queue_export); - err = rebuild_queue_file(udev_queue_export); - } - - return err; -} - -static int update(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) -{ - if (update_queue(udev_queue_export, udev_device, state) != 0) - return -1; - - return 0; -} - -int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_QUEUED); -} - -int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) -{ - return update(udev_queue_export, udev_device, DEVICE_FINISHED); -} diff --git a/libudev/libudev-queue.c b/libudev/libudev-queue.c deleted file mode 100644 index 3d46b67d19..0000000000 --- a/libudev/libudev-queue.c +++ /dev/null @@ -1,474 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * Copyright (C) 2009 Alan Jenkins - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/** - * SECTION:libudev-queue - * @short_description: access to currently active events - * - * The udev daemon processes events asynchronously. All events which do not have - * interdependencies run in parallel. This exports the current state of the - * event processing queue, and the current event sequence numbers from the kernel - * and the udev daemon. - */ - -/** - * udev_queue: - * - * Opaque object representing the current event queue in the udev daemon. - */ -struct udev_queue { - struct udev *udev; - int refcount; - struct udev_list queue_list; -}; - -/** - * udev_queue_new: - * @udev: udev library context - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev queue context. - * - * Returns: the udev queue context, or #NULL on error. - **/ -UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev) -{ - struct udev_queue *udev_queue; - - if (udev == NULL) - return NULL; - - udev_queue = calloc(1, sizeof(struct udev_queue)); - if (udev_queue == NULL) - return NULL; - udev_queue->refcount = 1; - udev_queue->udev = udev; - udev_list_init(udev, &udev_queue->queue_list, false); - return udev_queue; -} - -/** - * udev_queue_ref: - * @udev_queue: udev queue context - * - * Take a reference of a udev queue context. - * - * Returns: the same udev queue context. - **/ -UDEV_EXPORT struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) -{ - if (udev_queue == NULL) - return NULL; - udev_queue->refcount++; - return udev_queue; -} - -/** - * udev_queue_unref: - * @udev_queue: udev queue context - * - * Drop a reference of a udev queue context. If the refcount reaches zero, - * the resources of the queue context will be released. - **/ -UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue) -{ - if (udev_queue == NULL) - return; - udev_queue->refcount--; - if (udev_queue->refcount > 0) - return; - udev_list_cleanup(&udev_queue->queue_list); - free(udev_queue); -} - -/** - * udev_queue_get_udev: - * @udev_queue: udev queue context - * - * Retrieve the udev library context the queue context was created with. - * - * Returns: the udev library context. - **/ -UDEV_EXPORT struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) -{ - if (udev_queue == NULL) - return NULL; - return udev_queue->udev; -} - -unsigned long long int udev_get_kernel_seqnum(struct udev *udev) -{ - char filename[UTIL_PATH_SIZE]; - unsigned long long int seqnum; - int fd; - char buf[32]; - ssize_t len; - - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); - fd = open(filename, O_RDONLY|O_CLOEXEC); - if (fd < 0) - return 0; - len = read(fd, buf, sizeof(buf)); - close(fd); - if (len <= 2) - return 0; - buf[len-1] = '\0'; - seqnum = strtoull(buf, NULL, 10); - return seqnum; -} - -/** - * udev_queue_get_kernel_seqnum: - * @udev_queue: udev queue context - * - * Returns: the current kernel event sequence number. - **/ -UDEV_EXPORT unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum; - - if (udev_queue == NULL) - return -EINVAL; - - seqnum = udev_get_kernel_seqnum(udev_queue->udev); - dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); - return seqnum; -} - -int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum) -{ - if (fread(seqnum, sizeof(unsigned long long int), 1, queue_file) != 1) - return -1; - - return 0; -} - -ssize_t udev_queue_skip_devpath(FILE *queue_file) -{ - unsigned short int len; - - if (fread(&len, sizeof(unsigned short int), 1, queue_file) == 1) { - char devpath[len]; - - /* use fread to skip, fseek might drop buffered data */ - if (fread(devpath, 1, len, queue_file) == len) - return len; - } - - return -1; -} - -ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size) -{ - unsigned short int read_bytes = 0; - unsigned short int len; - - if (fread(&len, sizeof(unsigned short int), 1, queue_file) != 1) - return -1; - - read_bytes = (len < size - 1) ? len : size - 1; - if (fread(devpath, 1, read_bytes, queue_file) != read_bytes) - return -1; - devpath[read_bytes] = '\0'; - - /* if devpath was too long, skip unread characters */ - if (read_bytes != len) { - unsigned short int skip_bytes = len - read_bytes; - char buf[skip_bytes]; - - if (fread(buf, 1, skip_bytes, queue_file) != skip_bytes) - return -1; - } - - return read_bytes; -} - -static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long int *seqnum_start) -{ - char filename[UTIL_PATH_SIZE]; - FILE *queue_file; - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue->udev), "/queue.bin", NULL); - queue_file = fopen(filename, "re"); - if (queue_file == NULL) - return NULL; - - if (udev_queue_read_seqnum(queue_file, seqnum_start) < 0) { - err(udev_queue->udev, "corrupt queue file\n"); - fclose(queue_file); - return NULL; - } - - return queue_file; -} - -/** - * udev_queue_get_udev_seqnum: - * @udev_queue: udev queue context - * - * Returns: the last known udev event sequence number. - **/ -UDEV_EXPORT unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum_udev; - FILE *queue_file; - - queue_file = open_queue_file(udev_queue, &seqnum_udev); - if (queue_file == NULL) - return 0; - - for (;;) { - unsigned long long int seqnum; - ssize_t devpath_len; - - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - devpath_len = udev_queue_skip_devpath(queue_file); - if (devpath_len < 0) - break; - if (devpath_len > 0) - seqnum_udev = seqnum; - } - - fclose(queue_file); - return seqnum_udev; -} - -/** - * udev_queue_get_udev_is_active: - * @udev_queue: udev queue context - * - * Returns: a flag indicating if udev is active. - **/ -UDEV_EXPORT int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum_start; - FILE *queue_file; - - queue_file = open_queue_file(udev_queue, &seqnum_start); - if (queue_file == NULL) - return 0; - - fclose(queue_file); - return 1; -} - -/** - * udev_queue_get_queue_is_empty: - * @udev_queue: udev queue context - * - * Returns: a flag indicating if udev is currently handling events. - **/ -UDEV_EXPORT int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum_kernel; - unsigned long long int seqnum_udev = 0; - int queued = 0; - int is_empty = 0; - FILE *queue_file; - - if (udev_queue == NULL) - return -EINVAL; - queue_file = open_queue_file(udev_queue, &seqnum_udev); - if (queue_file == NULL) - return 1; - - for (;;) { - unsigned long long int seqnum; - ssize_t devpath_len; - - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - devpath_len = udev_queue_skip_devpath(queue_file); - if (devpath_len < 0) - break; - - if (devpath_len > 0) { - queued++; - seqnum_udev = seqnum; - } else { - queued--; - } - } - - if (queued > 0) { - dbg(udev_queue->udev, "queue is not empty\n"); - goto out; - } - - seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); - if (seqnum_udev < seqnum_kernel) { - dbg(udev_queue->udev, "queue is empty but kernel events still pending [%llu]<->[%llu]\n", - seqnum_kernel, seqnum_udev); - goto out; - } - - dbg(udev_queue->udev, "queue is empty\n"); - is_empty = 1; - -out: - fclose(queue_file); - return is_empty; -} - -/** - * udev_queue_get_seqnum_sequence_is_finished: - * @udev_queue: udev queue context - * @start: first event sequence number - * @end: last event sequence number - * - * Returns: a flag indicating if any of the sequence numbers in the given range is currently active. - **/ -UDEV_EXPORT int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, - unsigned long long int start, unsigned long long int end) -{ - unsigned long long int seqnum; - ssize_t devpath_len; - int unfinished; - FILE *queue_file; - - if (udev_queue == NULL) - return -EINVAL; - queue_file = open_queue_file(udev_queue, &seqnum); - if (queue_file == NULL) - return 1; - if (start < seqnum) - start = seqnum; - if (start > end) { - fclose(queue_file); - return 1; - } - if (end - start > INT_MAX - 1) { - fclose(queue_file); - return -EOVERFLOW; - } - - /* - * we might start with 0, and handle the initial seqnum - * only when we find an entry in the queue file - **/ - unfinished = end - start; - - do { - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - devpath_len = udev_queue_skip_devpath(queue_file); - if (devpath_len < 0) - break; - - /* - * we might start with an empty or re-build queue file, where - * the initial seqnum is not recorded as finished - */ - if (start == seqnum && devpath_len > 0) - unfinished++; - - if (devpath_len == 0) { - if (seqnum >= start && seqnum <= end) - unfinished--; - } - } while (unfinished > 0); - - fclose(queue_file); - - return (unfinished == 0); -} - -/** - * udev_queue_get_seqnum_is_finished: - * @udev_queue: udev queue context - * @seqnum: sequence number - * - * Returns: a flag indicating if the given sequence number is currently active. - **/ -UDEV_EXPORT int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) -{ - if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) - return 0; - - dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum); - return 1; -} - -/** - * udev_queue_get_queued_list_entry: - * @udev_queue: udev queue context - * - * Returns: the first entry of the list of queued events. - **/ -UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) -{ - unsigned long long int seqnum; - FILE *queue_file; - - if (udev_queue == NULL) - return NULL; - udev_list_cleanup(&udev_queue->queue_list); - - queue_file = open_queue_file(udev_queue, &seqnum); - if (queue_file == NULL) - return NULL; - - for (;;) { - char syspath[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - char seqnum_str[32]; - struct udev_list_entry *list_entry; - - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - snprintf(seqnum_str, sizeof(seqnum_str), "%llu", seqnum); - - s = syspath; - l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); - len = udev_queue_read_devpath(queue_file, s, l); - if (len < 0) - break; - - if (len > 0) { - udev_list_entry_add(&udev_queue->queue_list, syspath, seqnum_str); - } else { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { - if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { - udev_list_entry_delete(list_entry); - break; - } - } - } - } - fclose(queue_file); - - return udev_list_get_entry(&udev_queue->queue_list); -} - -struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); -UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) -{ - errno = ENOSYS; - return NULL; -} diff --git a/libudev/libudev-selinux-private.c b/libudev/libudev-selinux-private.c deleted file mode 100644 index cb06a280f7..0000000000 --- a/libudev/libudev-selinux-private.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static int selinux_enabled; -security_context_t selinux_prev_scontext; - -void udev_selinux_init(struct udev *udev) -{ - /* record the present security context */ - selinux_enabled = (is_selinux_enabled() > 0); - info(udev, "selinux=%i\n", selinux_enabled); - if (!selinux_enabled) - return; - matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); - if (getfscreatecon(&selinux_prev_scontext) < 0) { - err(udev, "getfscreatecon failed\n"); - selinux_prev_scontext = NULL; - } -} - -void udev_selinux_exit(struct udev *udev) -{ - if (!selinux_enabled) - return; - freecon(selinux_prev_scontext); - selinux_prev_scontext = NULL; -} - -void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) -{ - security_context_t scontext = NULL; - - if (!selinux_enabled) - return; - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (lsetfilecon(file, scontext) < 0) - err(udev, "setfilecon %s failed: %m\n", file); - freecon(scontext); -} - -void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) -{ - security_context_t scontext = NULL; - - if (!selinux_enabled) - return; - - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (setfscreatecon(scontext) < 0) - err(udev, "setfscreatecon %s failed: %m\n", file); - freecon(scontext); -} - -void udev_selinux_resetfscreatecon(struct udev *udev) -{ - if (!selinux_enabled) - return; - if (setfscreatecon(selinux_prev_scontext) < 0) - err(udev, "setfscreatecon failed: %m\n"); -} - -void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode) -{ - char filename[UTIL_PATH_SIZE]; - - if (!selinux_enabled) - return; - - /* resolve relative filename */ - if (file[0] != '/') { - char procfd[UTIL_PATH_SIZE]; - char target[UTIL_PATH_SIZE]; - ssize_t len; - - snprintf(procfd, sizeof(procfd), "/proc/%u/fd/%u", getpid(), dfd); - len = readlink(procfd, target, sizeof(target)); - if (len <= 0 || len == sizeof(target)) - return; - target[len] = '\0'; - - util_strscpyl(filename, sizeof(filename), target, "/", file, NULL); - file = filename; - } - udev_selinux_setfscreatecon(udev, file, mode); -} diff --git a/libudev/libudev-util-private.c b/libudev/libudev-util-private.c deleted file mode 100644 index 015e6d5862..0000000000 --- a/libudev/libudev-util-private.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2003-2009 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static int create_path(struct udev *udev, const char *path, bool selinux) -{ - char p[UTIL_PATH_SIZE]; - char *pos; - struct stat stats; - int err; - - util_strscpy(p, sizeof(p), path); - pos = strrchr(p, '/'); - if (pos == NULL) - return 0; - while (pos != p && pos[-1] == '/') - pos--; - if (pos == p) - return 0; - pos[0] = '\0'; - - dbg(udev, "stat '%s'\n", p); - if (stat(p, &stats) == 0) { - if ((stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - else - return -ENOTDIR; - } - - err = util_create_path(udev, p); - if (err != 0) - return err; - - dbg(udev, "mkdir '%s'\n", p); - if (selinux) - udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); - err = mkdir(p, 0755); - if (err != 0) { - err = -errno; - if (err == -EEXIST && stat(p, &stats) == 0) { - if ((stats.st_mode & S_IFMT) == S_IFDIR) - err = 0; - else - err = -ENOTDIR; - } - } - if (selinux) - udev_selinux_resetfscreatecon(udev); - return err; -} - -int util_create_path(struct udev *udev, const char *path) -{ - return create_path(udev, path, false); -} - -int util_create_path_selinux(struct udev *udev, const char *path) -{ - return create_path(udev, path, true); -} - -int util_delete_path(struct udev *udev, const char *path) -{ - char p[UTIL_PATH_SIZE]; - char *pos; - int err = 0; - - if (path[0] == '/') - while(path[1] == '/') - path++; - util_strscpy(p, sizeof(p), path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - for (;;) { - *pos = '\0'; - pos = strrchr(p, '/'); - - /* don't remove the last one */ - if ((pos == p) || (pos == NULL)) - break; - - err = rmdir(p); - if (err < 0) { - if (errno == ENOENT) - err = 0; - break; - } - } - return err; -} - -uid_t util_lookup_user(struct udev *udev, const char *user) -{ - char *endptr; - size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); - char buf[buflen]; - struct passwd pwbuf; - struct passwd *pw; - uid_t uid; - - if (strcmp(user, "root") == 0) - return 0; - uid = strtoul(user, &endptr, 10); - if (endptr[0] == '\0') - return uid; - - errno = getpwnam_r(user, &pwbuf, buf, buflen, &pw); - if (pw != NULL) - return pw->pw_uid; - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err(udev, "specified user '%s' unknown\n", user); - else - err(udev, "error resolving user '%s': %m\n", user); - return 0; -} - -gid_t util_lookup_group(struct udev *udev, const char *group) -{ - char *endptr; - size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX); - char *buf; - struct group grbuf; - struct group *gr; - gid_t gid = 0; - - if (strcmp(group, "root") == 0) - return 0; - gid = strtoul(group, &endptr, 10); - if (endptr[0] == '\0') - return gid; - buf = NULL; - gid = 0; - for (;;) { - char *newbuf; - - newbuf = realloc(buf, buflen); - if (!newbuf) - break; - buf = newbuf; - errno = getgrnam_r(group, &grbuf, buf, buflen, &gr); - if (gr != NULL) { - gid = gr->gr_gid; - } else if (errno == ERANGE) { - buflen *= 2; - continue; - } else if (errno == 0 || errno == ENOENT || errno == ESRCH) { - err(udev, "specified group '%s' unknown\n", group); - } else { - err(udev, "error resolving group '%s': %m\n", group); - } - break; - } - free(buf); - return gid; -} - -/* handle "[/]" format */ -int util_resolve_subsys_kernel(struct udev *udev, const char *string, - char *result, size_t maxsize, int read_value) -{ - char temp[UTIL_PATH_SIZE]; - char *subsys; - char *sysname; - struct udev_device *dev; - char *attr; - - if (string[0] != '[') - return -1; - - util_strscpy(temp, sizeof(temp), string); - - subsys = &temp[1]; - - sysname = strchr(subsys, '/'); - if (sysname == NULL) - return -1; - sysname[0] = '\0'; - sysname = &sysname[1]; - - attr = strchr(sysname, ']'); - if (attr == NULL) - return -1; - attr[0] = '\0'; - attr = &attr[1]; - if (attr[0] == '/') - attr = &attr[1]; - if (attr[0] == '\0') - attr = NULL; - - if (read_value && attr == NULL) - return -1; - - dev = udev_device_new_from_subsystem_sysname(udev, subsys, sysname); - if (dev == NULL) - return -1; - - if (read_value) { - const char *val; - - val = udev_device_get_sysattr_value(dev, attr); - if (val != NULL) - util_strscpy(result, maxsize, val); - else - result[0] = '\0'; - info(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); - } else { - size_t l; - char *s; - - s = result; - l = util_strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL); - if (attr != NULL) - util_strpcpyl(&s, l, "/", attr, NULL); - info(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); - } - udev_device_unref(dev); - return 0; -} diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c deleted file mode 100644 index 5369fe734e..0000000000 --- a/libudev/libudev-util.c +++ /dev/null @@ -1,568 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2011 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/** - * SECTION:libudev-util - * @short_description: utils - */ - -ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) -{ - char path[UTIL_PATH_SIZE]; - char target[UTIL_PATH_SIZE]; - ssize_t len; - const char *pos; - - util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL); - len = readlink(path, target, sizeof(target)); - if (len <= 0 || len == (ssize_t)sizeof(target)) - return -1; - target[len] = '\0'; - pos = strrchr(target, '/'); - if (pos == NULL) - return -1; - pos = &pos[1]; - dbg(udev, "resolved link to: '%s'\n", pos); - return util_strscpy(value, size, pos); -} - -int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) -{ - char link_target[UTIL_PATH_SIZE]; - - ssize_t len; - int i; - int back; - char *base; - - len = readlink(syspath, link_target, sizeof(link_target)); - if (len <= 0 || len == (ssize_t)sizeof(link_target)) - return -1; - link_target[len] = '\0'; - dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target); - - for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) - ; - dbg(udev, "base '%s', tail '%s', back %i\n", syspath, &link_target[back * 3], back); - for (i = 0; i <= back; i++) { - base = strrchr(syspath, '/'); - if (base == NULL) - return -1; - base[0] = '\0'; - } - dbg(udev, "after moving back '%s'\n", syspath); - util_strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL); - return 0; -} - -int util_log_priority(const char *priority) -{ - char *endptr; - int prio; - - prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0' || isspace(endptr[0])) - return prio; - if (strncmp(priority, "err", 3) == 0) - return LOG_ERR; - if (strncmp(priority, "info", 4) == 0) - return LOG_INFO; - if (strncmp(priority, "debug", 5) == 0) - return LOG_DEBUG; - return 0; -} - -size_t util_path_encode(const char *src, char *dest, size_t size) -{ - size_t i, j; - - for (i = 0, j = 0; src[i] != '\0'; i++) { - if (src[i] == '/') { - if (j+4 >= size) { - j = 0; - break; - } - memcpy(&dest[j], "\\x2f", 4); - j += 4; - } else if (src[i] == '\\') { - if (j+4 >= size) { - j = 0; - break; - } - memcpy(&dest[j], "\\x5c", 4); - j += 4; - } else { - if (j+1 >= size) { - j = 0; - break; - } - dest[j] = src[i]; - j++; - } - } - dest[j] = '\0'; - return j; -} - -size_t util_path_decode(char *s) -{ - size_t i, j; - - for (i = 0, j = 0; s[i] != '\0'; j++) { - if (memcmp(&s[i], "\\x2f", 4) == 0) { - s[j] = '/'; - i += 4; - } else if (memcmp(&s[i], "\\x5c", 4) == 0) { - s[j] = '\\'; - i += 4; - } else { - s[j] = s[i]; - i++; - } - } - s[j] = '\0'; - return j; -} - -void util_remove_trailing_chars(char *path, char c) -{ - size_t len; - - if (path == NULL) - return; - len = strlen(path); - while (len > 0 && path[len-1] == c) - path[--len] = '\0'; -} - -/* - * Concatenates strings. In any case, terminates in _all_ cases with '\0' - * and moves the @dest pointer forward to the added '\0'. Returns the - * remaining size, and 0 if the string was truncated. - */ -size_t util_strpcpy(char **dest, size_t size, const char *src) -{ - size_t len; - - len = strlen(src); - if (len >= size) { - if (size > 1) - *dest = mempcpy(*dest, src, size-1); - size = 0; - *dest[0] = '\0'; - } else { - if (len > 0) { - *dest = mempcpy(*dest, src, len); - size -= len; - } - *dest[0] = '\0'; - } - return size; -} - -/* concatenates list of strings, moves dest forward */ -size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) -{ - va_list va; - - va_start(va, src); - do { - size = util_strpcpy(dest, size, src); - src = va_arg(va, char *); - } while (src != NULL); - va_end(va); - - return size; -} - -/* copies string */ -size_t util_strscpy(char *dest, size_t size, const char *src) -{ - char *s; - - s = dest; - return util_strpcpy(&s, size, src); -} - -/* concatenates list of strings */ -size_t util_strscpyl(char *dest, size_t size, const char *src, ...) -{ - va_list va; - char *s; - - va_start(va, src); - s = dest; - do { - size = util_strpcpy(&s, size, src); - src = va_arg(va, char *); - } while (src != NULL); - va_end(va); - - return size; -} - -/* count of characters used to encode one unicode char */ -static int utf8_encoded_expected_len(const char *str) -{ - unsigned char c = (unsigned char)str[0]; - - if (c < 0x80) - return 1; - if ((c & 0xe0) == 0xc0) - return 2; - if ((c & 0xf0) == 0xe0) - return 3; - if ((c & 0xf8) == 0xf0) - return 4; - if ((c & 0xfc) == 0xf8) - return 5; - if ((c & 0xfe) == 0xfc) - return 6; - return 0; -} - -/* decode one unicode char */ -static int utf8_encoded_to_unichar(const char *str) -{ - int unichar; - int len; - int i; - - len = utf8_encoded_expected_len(str); - switch (len) { - case 1: - return (int)str[0]; - case 2: - unichar = str[0] & 0x1f; - break; - case 3: - unichar = (int)str[0] & 0x0f; - break; - case 4: - unichar = (int)str[0] & 0x07; - break; - case 5: - unichar = (int)str[0] & 0x03; - break; - case 6: - unichar = (int)str[0] & 0x01; - break; - default: - return -1; - } - - for (i = 1; i < len; i++) { - if (((int)str[i] & 0xc0) != 0x80) - return -1; - unichar <<= 6; - unichar |= (int)str[i] & 0x3f; - } - - return unichar; -} - -/* expected size used to encode one unicode char */ -static int utf8_unichar_to_encoded_len(int unichar) -{ - if (unichar < 0x80) - return 1; - if (unichar < 0x800) - return 2; - if (unichar < 0x10000) - return 3; - if (unichar < 0x200000) - return 4; - if (unichar < 0x4000000) - return 5; - return 6; -} - -/* check if unicode char has a valid numeric range */ -static int utf8_unichar_valid_range(int unichar) -{ - if (unichar > 0x10ffff) - return 0; - if ((unichar & 0xfffff800) == 0xd800) - return 0; - if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) - return 0; - if ((unichar & 0xffff) == 0xffff) - return 0; - return 1; -} - -/* validate one encoded unicode char and return its length */ -static int utf8_encoded_valid_unichar(const char *str) -{ - int len; - int unichar; - int i; - - len = utf8_encoded_expected_len(str); - if (len == 0) - return -1; - - /* ascii is valid */ - if (len == 1) - return 1; - - /* check if expected encoded chars are available */ - for (i = 0; i < len; i++) - if ((str[i] & 0x80) != 0x80) - return -1; - - unichar = utf8_encoded_to_unichar(str); - - /* check if encoded length matches encoded value */ - if (utf8_unichar_to_encoded_len(unichar) != len) - return -1; - - /* check if value has valid range */ - if (!utf8_unichar_valid_range(unichar)) - return -1; - - return len; -} - -int util_replace_whitespace(const char *str, char *to, size_t len) -{ - size_t i, j; - - /* strip trailing whitespace */ - len = strnlen(str, len); - while (len && isspace(str[len-1])) - len--; - - /* strip leading whitespace */ - i = 0; - while (isspace(str[i]) && (i < len)) - i++; - - j = 0; - while (i < len) { - /* substitute multiple whitespace with a single '_' */ - if (isspace(str[i])) { - while (isspace(str[i])) - i++; - to[j++] = '_'; - } - to[j++] = str[i++]; - } - to[j] = '\0'; - return 0; -} - -static int is_whitelisted(char c, const char *white) -{ - if ((c >= '0' && c <= '9') || - (c >= 'A' && c <= 'Z') || - (c >= 'a' && c <= 'z') || - strchr("#+-.:=@_", c) != NULL || - (white != NULL && strchr(white, c) != NULL)) - return 1; - return 0; -} - -/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ -int util_replace_chars(char *str, const char *white) -{ - size_t i = 0; - int replaced = 0; - - while (str[i] != '\0') { - int len; - - if (is_whitelisted(str[i], white)) { - i++; - continue; - } - - /* accept hex encoding */ - if (str[i] == '\\' && str[i+1] == 'x') { - i += 2; - continue; - } - - /* accept valid utf8 */ - len = utf8_encoded_valid_unichar(&str[i]); - if (len > 1) { - i += len; - continue; - } - - /* if space is allowed, replace whitespace with ordinary space */ - if (isspace(str[i]) && white != NULL && strchr(white, ' ') != NULL) { - str[i] = ' '; - i++; - replaced++; - continue; - } - - /* everything else is replaced with '_' */ - str[i] = '_'; - i++; - replaced++; - } - return replaced; -} - -/** - * udev_util_encode_string: - * @str: input string to be encoded - * @str_enc: output string to store the encoded input string - * @len: maximum size of the output string, which may be - * four times as long as the input string - * - * Encode all potentially unsafe characters of a string to the - * corresponding 2 char hex value prefixed by '\x'. - * - * Returns: 0 if the entire string was copied, non-zero otherwise. - **/ -UDEV_EXPORT int udev_util_encode_string(const char *str, char *str_enc, size_t len) -{ - size_t i, j; - - if (str == NULL || str_enc == NULL) - return -1; - - for (i = 0, j = 0; str[i] != '\0'; i++) { - int seqlen; - - seqlen = utf8_encoded_valid_unichar(&str[i]); - if (seqlen > 1) { - if (len-j < (size_t)seqlen) - goto err; - memcpy(&str_enc[j], &str[i], seqlen); - j += seqlen; - i += (seqlen-1); - } else if (str[i] == '\\' || !is_whitelisted(str[i], NULL)) { - if (len-j < 4) - goto err; - sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); - j += 4; - } else { - if (len-j < 1) - goto err; - str_enc[j] = str[i]; - j++; - } - } - if (len-j < 1) - goto err; - str_enc[j] = '\0'; - return 0; -err: - return -1; -} - -/* - * http://sites.google.com/site/murmurhash/ - * - * All code is released to the public domain. For business purposes, - * Murmurhash is under the MIT license. - * - */ -static unsigned int murmur_hash2(const char *key, int len, unsigned int seed) -{ - /* - * 'm' and 'r' are mixing constants generated offline. - * They're not really 'magic', they just happen to work well. - */ - const unsigned int m = 0x5bd1e995; - const int r = 24; - - /* initialize the hash to a 'random' value */ - unsigned int h = seed ^ len; - - /* mix 4 bytes at a time into the hash */ - const unsigned char * data = (const unsigned char *)key; - - while(len >= 4) { - unsigned int k = *(unsigned int *)data; - - k *= m; - k ^= k >> r; - k *= m; - h *= m; - h ^= k; - - data += 4; - len -= 4; - } - - /* handle the last few bytes of the input array */ - switch(len) { - case 3: - h ^= data[2] << 16; - case 2: - h ^= data[1] << 8; - case 1: - h ^= data[0]; - h *= m; - }; - - /* do a few final mixes of the hash to ensure the last few bytes are well-incorporated */ - h ^= h >> 13; - h *= m; - h ^= h >> 15; - - return h; -} - -unsigned int util_string_hash32(const char *str) -{ - return murmur_hash2(str, strlen(str), 0); -} - -/* get a bunch of bit numbers out of the hash, and set the bits in our bit field */ -uint64_t util_string_bloom64(const char *str) -{ - uint64_t bits = 0; - unsigned int hash = util_string_hash32(str); - - bits |= 1LLU << (hash & 63); - bits |= 1LLU << ((hash >> 6) & 63); - bits |= 1LLU << ((hash >> 12) & 63); - bits |= 1LLU << ((hash >> 18) & 63); - return bits; -} - -#define USEC_PER_SEC 1000000ULL -#define NSEC_PER_USEC 1000ULL -unsigned long long ts_usec(const struct timespec *ts) -{ - return (unsigned long long) ts->tv_sec * USEC_PER_SEC + - (unsigned long long) ts->tv_nsec / NSEC_PER_USEC; -} - -unsigned long long now_usec(void) -{ - struct timespec ts; - - if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) - return 0; - return ts_usec(&ts); -} diff --git a/libudev/libudev.c b/libudev/libudev.c deleted file mode 100644 index f0f59e3a4d..0000000000 --- a/libudev/libudev.c +++ /dev/null @@ -1,457 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2010 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/** - * SECTION:libudev - * @short_description: libudev context - * - * The context contains the default values read from the udev config file, - * and is passed to all library operations. - */ - -/** - * udev: - * - * Opaque object representing the library context. - */ -struct udev { - int refcount; - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args); - void *userdata; - char *sys_path; - char *dev_path; - char *rules_path[4]; - unsigned long long rules_path_ts[4]; - int rules_path_count; - char *run_path; - struct udev_list properties_list; - int log_priority; -}; - -void udev_log(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, ...) -{ - va_list args; - - va_start(args, format); - udev->log_fn(udev, priority, file, line, fn, format, args); - va_end(args); -} - -static void log_stderr(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args) -{ - fprintf(stderr, "libudev: %s: ", fn); - vfprintf(stderr, format, args); -} - -/** - * udev_get_userdata: - * @udev: udev library context - * - * Retrieve stored data pointer from library context. This might be useful - * to access from callbacks like a custom logging function. - * - * Returns: stored userdata - **/ -UDEV_EXPORT void *udev_get_userdata(struct udev *udev) -{ - if (udev == NULL) - return NULL; - return udev->userdata; -} - -/** - * udev_set_userdata: - * @udev: udev library context - * @userdata: data pointer - * - * Store custom @userdata in the library context. - **/ -UDEV_EXPORT void udev_set_userdata(struct udev *udev, void *userdata) -{ - if (udev == NULL) - return; - udev->userdata = userdata; -} - -static char *set_value(char **s, const char *v) -{ - free(*s); - *s = strdup(v); - util_remove_trailing_chars(*s, '/'); - return *s; -} - -/** - * udev_new: - * - * Create udev library context. This reads the udev configuration - * file, and fills in the default values. - * - * The initial refcount is 1, and needs to be decremented to - * release the resources of the udev library context. - * - * Returns: a new udev library context - **/ -UDEV_EXPORT struct udev *udev_new(void) -{ - struct udev *udev; - const char *env; - char *config_file = NULL; - FILE *f; - - udev = calloc(1, sizeof(struct udev)); - if (udev == NULL) - return NULL; - udev->refcount = 1; - udev->log_fn = log_stderr; - udev->log_priority = LOG_ERR; - udev_list_init(udev, &udev->properties_list, true); - - /* custom config file */ - env = getenv("UDEV_CONFIG_FILE"); - if (env != NULL) { - if (set_value(&config_file, env) == NULL) - goto err; - udev_add_property(udev, "UDEV_CONFIG_FILE", config_file); - } - - /* default config file */ - if (config_file == NULL) - config_file = strdup(SYSCONFDIR "/udev/udev.conf"); - if (config_file == NULL) - goto err; - - f = fopen(config_file, "re"); - if (f != NULL) { - char line[UTIL_LINE_SIZE]; - int line_nr = 0; - - while (fgets(line, sizeof(line), f)) { - size_t len; - char *key; - char *val; - - line_nr++; - - /* find key */ - key = line; - while (isspace(key[0])) - key++; - - /* comment or empty line */ - if (key[0] == '#' || key[0] == '\0') - continue; - - /* split key/value */ - val = strchr(key, '='); - if (val == NULL) { - err(udev, "missing = in '%s'[%i], skip line\n", config_file, line_nr); - continue; - } - val[0] = '\0'; - val++; - - /* find value */ - while (isspace(val[0])) - val++; - - /* terminate key */ - len = strlen(key); - if (len == 0) - continue; - while (isspace(key[len-1])) - len--; - key[len] = '\0'; - - /* terminate value */ - len = strlen(val); - if (len == 0) - continue; - while (isspace(val[len-1])) - len--; - val[len] = '\0'; - - if (len == 0) - continue; - - /* unquote */ - if (val[0] == '"' || val[0] == '\'') { - if (val[len-1] != val[0]) { - err(udev, "inconsistent quoting in '%s'[%i], skip line\n", config_file, line_nr); - continue; - } - val[len-1] = '\0'; - val++; - } - - if (strcmp(key, "udev_log") == 0) { - udev_set_log_priority(udev, util_log_priority(val)); - continue; - } - if (strcmp(key, "udev_root") == 0) { - set_value(&udev->dev_path, val); - continue; - } - if (strcmp(key, "udev_run") == 0) { - set_value(&udev->run_path, val); - continue; - } - if (strcmp(key, "udev_sys") == 0) { - set_value(&udev->sys_path, val); - continue; - } - if (strcmp(key, "udev_rules") == 0) { - set_value(&udev->rules_path[0], val); - udev->rules_path_count = 1; - continue; - } - } - fclose(f); - } - - /* environment overwrites config */ - env = getenv("UDEV_LOG"); - if (env != NULL) - udev_set_log_priority(udev, util_log_priority(env)); - - /* set defaults */ - if (udev->dev_path == NULL) - if (set_value(&udev->dev_path, "/dev") == NULL) - goto err; - - if (udev->sys_path == NULL) - if (set_value(&udev->sys_path, "/sys") == NULL) - goto err; - - if (udev->run_path == NULL) - if (set_value(&udev->run_path, "/run/udev") == NULL) - goto err; - - if (udev->rules_path[0] == NULL) { - /* /usr/lib/udev -- system rules */ - udev->rules_path[0] = strdup(PKGLIBEXECDIR "/rules.d"); - if (!udev->rules_path[0]) - goto err; - - /* /etc/udev -- local administration rules */ - udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d"); - if (!udev->rules_path[1]) - goto err; - - /* /run/udev -- runtime rules */ - if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0) - goto err; - - udev->rules_path_count = 3; - } - - dbg(udev, "context %p created\n", udev); - dbg(udev, "log_priority=%d\n", udev->log_priority); - dbg(udev, "config_file='%s'\n", config_file); - dbg(udev, "dev_path='%s'\n", udev->dev_path); - dbg(udev, "sys_path='%s'\n", udev->sys_path); - dbg(udev, "run_path='%s'\n", udev->run_path); - dbg(udev, "rules_path='%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1], udev->rules_path[2]); - free(config_file); - return udev; -err: - free(config_file); - err(udev, "context creation failed\n"); - udev_unref(udev); - return NULL; -} - -/** - * udev_ref: - * @udev: udev library context - * - * Take a reference of the udev library context. - * - * Returns: the passed udev library context - **/ -UDEV_EXPORT struct udev *udev_ref(struct udev *udev) -{ - if (udev == NULL) - return NULL; - udev->refcount++; - return udev; -} - -/** - * udev_unref: - * @udev: udev library context - * - * Drop a reference of the udev library context. If the refcount - * reaches zero, the resources of the context will be released. - * - **/ -UDEV_EXPORT void udev_unref(struct udev *udev) -{ - if (udev == NULL) - return; - udev->refcount--; - if (udev->refcount > 0) - return; - udev_list_cleanup(&udev->properties_list); - free(udev->dev_path); - free(udev->sys_path); - free(udev->rules_path[0]); - free(udev->rules_path[1]); - free(udev->rules_path[2]); - free(udev->run_path); - dbg(udev, "context %p released\n", udev); - free(udev); -} - -/** - * udev_set_log_fn: - * @udev: udev library context - * @log_fn: function to be called for logging messages - * - * The built-in logging writes to stderr. It can be - * overridden by a custom function, to plug log messages - * into the users' logging functionality. - * - **/ -UDEV_EXPORT void udev_set_log_fn(struct udev *udev, - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args)) -{ - udev->log_fn = log_fn; - info(udev, "custom logging function %p registered\n", log_fn); -} - -/** - * udev_get_log_priority: - * @udev: udev library context - * - * The initial logging priority is read from the udev config file - * at startup. - * - * Returns: the current logging priority - **/ -UDEV_EXPORT int udev_get_log_priority(struct udev *udev) -{ - return udev->log_priority; -} - -/** - * udev_set_log_priority: - * @udev: udev library context - * @priority: the new logging priority - * - * Set the current logging priority. The value controls which messages - * are logged. - **/ -UDEV_EXPORT void udev_set_log_priority(struct udev *udev, int priority) -{ - char num[32]; - - udev->log_priority = priority; - snprintf(num, sizeof(num), "%u", udev->log_priority); - udev_add_property(udev, "UDEV_LOG", num); -} - -int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *stamp_usec[]) -{ - *path = udev->rules_path; - if (stamp_usec) - *stamp_usec = udev->rules_path_ts; - return udev->rules_path_count; -} - -/** - * udev_get_sys_path: - * @udev: udev library context - * - * Retrieve the sysfs mount point. The default is "/sys". For - * testing purposes, it can be overridden with udev_sys= - * in the udev configuration file. - * - * Returns: the sys mount point - **/ -UDEV_EXPORT const char *udev_get_sys_path(struct udev *udev) -{ - if (udev == NULL) - return NULL; - return udev->sys_path; -} - -/** - * udev_get_dev_path: - * @udev: udev library context - * - * Retrieve the device directory path. The default value is "/dev", - * the actual value may be overridden in the udev configuration - * file. - * - * Returns: the device directory path - **/ -UDEV_EXPORT const char *udev_get_dev_path(struct udev *udev) -{ - if (udev == NULL) - return NULL; - return udev->dev_path; -} - -/** - * udev_get_run_path: - * @udev: udev library context - * - * Retrieve the udev runtime directory path. The default is "/run/udev". - * - * Returns: the runtime directory path - **/ -UDEV_EXPORT const char *udev_get_run_path(struct udev *udev) -{ - if (udev == NULL) - return NULL; - return udev->run_path; -} - -struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) -{ - if (value == NULL) { - struct udev_list_entry *list_entry; - - list_entry = udev_get_properties_list_entry(udev); - list_entry = udev_list_entry_get_by_name(list_entry, key); - if (list_entry != NULL) - udev_list_entry_delete(list_entry); - return NULL; - } - return udev_list_entry_add(&udev->properties_list, key, value); -} - -struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) -{ - return udev_list_get_entry(&udev->properties_list); -} diff --git a/libudev/libudev.h b/libudev/libudev.h deleted file mode 100644 index 497f752fca..0000000000 --- a/libudev/libudev.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008-2011 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#ifndef _LIBUDEV_H_ -#define _LIBUDEV_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * udev - library context - * - * reads the udev config and system environment - * allows custom logging - */ -struct udev; -struct udev *udev_ref(struct udev *udev); -void udev_unref(struct udev *udev); -struct udev *udev_new(void); -void udev_set_log_fn(struct udev *udev, - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args)); -int udev_get_log_priority(struct udev *udev); -void udev_set_log_priority(struct udev *udev, int priority); -const char *udev_get_sys_path(struct udev *udev); -const char *udev_get_dev_path(struct udev *udev); -const char *udev_get_run_path(struct udev *udev); -void *udev_get_userdata(struct udev *udev); -void udev_set_userdata(struct udev *udev, void *userdata); - -/* - * udev_list - * - * access to libudev generated lists - */ -struct udev_list_entry; -struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); -struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); -const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); -const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); -/** - * udev_list_entry_foreach: - * @list_entry: entry to store the current position - * @first_entry: first entry to start with - * - * Helper to iterate over all entries of a list. - */ -#define udev_list_entry_foreach(list_entry, first_entry) \ - for (list_entry = first_entry; \ - list_entry != NULL; \ - list_entry = udev_list_entry_get_next(list_entry)) - -/* - * udev_device - * - * access to sysfs/kernel devices - */ -struct udev_device; -struct udev_device *udev_device_ref(struct udev_device *udev_device); -void udev_device_unref(struct udev_device *udev_device); -struct udev *udev_device_get_udev(struct udev_device *udev_device); -struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); -struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); -struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); -struct udev_device *udev_device_new_from_environment(struct udev *udev); -/* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */ -struct udev_device *udev_device_get_parent(struct udev_device *udev_device); -struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, - const char *subsystem, const char *devtype); -/* retrieve device properties */ -const char *udev_device_get_devpath(struct udev_device *udev_device); -const char *udev_device_get_subsystem(struct udev_device *udev_device); -const char *udev_device_get_devtype(struct udev_device *udev_device); -const char *udev_device_get_syspath(struct udev_device *udev_device); -const char *udev_device_get_sysname(struct udev_device *udev_device); -const char *udev_device_get_sysnum(struct udev_device *udev_device); -const char *udev_device_get_devnode(struct udev_device *udev_device); -int udev_device_get_is_initialized(struct udev_device *udev_device); -struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); -struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); -struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device); -struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device); -const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key); -const char *udev_device_get_driver(struct udev_device *udev_device); -dev_t udev_device_get_devnum(struct udev_device *udev_device); -const char *udev_device_get_action(struct udev_device *udev_device); -unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); -unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device); -const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); -int udev_device_has_tag(struct udev_device *udev_device, const char *tag); - -/* - * udev_monitor - * - * access to kernel uevents and udev events - */ -struct udev_monitor; -struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); -void udev_monitor_unref(struct udev_monitor *udev_monitor); -struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); -/* kernel and udev generated events over netlink */ -struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); -/* custom socket (use netlink and filters instead) */ -struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); -/* bind socket */ -int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); -int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); -int udev_monitor_get_fd(struct udev_monitor *udev_monitor); -struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); -/* in-kernel socket filters to select messages that get delivered to a listener */ -int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, - const char *subsystem, const char *devtype); -int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag); -int udev_monitor_filter_update(struct udev_monitor *udev_monitor); -int udev_monitor_filter_remove(struct udev_monitor *udev_monitor); - -/* - * udev_enumerate - * - * search sysfs for specific devices and provide a sorted list - */ -struct udev_enumerate; -struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); -void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); -struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); -struct udev_enumerate *udev_enumerate_new(struct udev *udev); -/* device properties filter */ -int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); -int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); -int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); -int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); -int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); -int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname); -int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag); -int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent); -int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate); -int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); -/* run enumeration with active filters */ -int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); -int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); -/* return device list */ -struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); - -/* - * udev_queue - * - * access to the currently running udev events - */ -struct udev_queue; -struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue); -void udev_queue_unref(struct udev_queue *udev_queue); -struct udev *udev_queue_get_udev(struct udev_queue *udev_queue); -struct udev_queue *udev_queue_new(struct udev *udev); -unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue); -unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue); -int udev_queue_get_udev_is_active(struct udev_queue *udev_queue); -int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); -int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum); -int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, - unsigned long long int start, unsigned long long int end); -struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); - -/* - * udev_util - * - * udev specific utilities - */ -int udev_util_encode_string(const char *str, char *str_enc, size_t len); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/libudev/libudev.pc.in b/libudev/libudev.pc.in deleted file mode 100644 index 93c8366480..0000000000 --- a/libudev/libudev.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libudev -Description: Library to access udev device information -Version: @VERSION@ -Libs: -L${libdir} -ludev -lrt -Libs.private: -Cflags: -I${includedir} diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c deleted file mode 100644 index c325f8eef5..0000000000 --- a/libudev/test-libudev.c +++ /dev/null @@ -1,501 +0,0 @@ -/* - * test-libudev - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" - -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) - -static void log_fn(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args) -{ - printf("test-libudev: %s %s:%d ", fn, file, line); - vprintf(format, args); -} - -static void print_device(struct udev_device *device) -{ - const char *str; - dev_t devnum; - int count; - struct udev_list_entry *list_entry; - - printf("*** device: %p ***\n", device); - str = udev_device_get_action(device); - if (str != NULL) - printf("action: '%s'\n", str); - - str = udev_device_get_syspath(device); - printf("syspath: '%s'\n", str); - - str = udev_device_get_sysname(device); - printf("sysname: '%s'\n", str); - - str = udev_device_get_sysnum(device); - if (str != NULL) - printf("sysnum: '%s'\n", str); - - str = udev_device_get_devpath(device); - printf("devpath: '%s'\n", str); - - str = udev_device_get_subsystem(device); - if (str != NULL) - printf("subsystem: '%s'\n", str); - - str = udev_device_get_devtype(device); - if (str != NULL) - printf("devtype: '%s'\n", str); - - str = udev_device_get_driver(device); - if (str != NULL) - printf("driver: '%s'\n", str); - - str = udev_device_get_devnode(device); - if (str != NULL) - printf("devname: '%s'\n", str); - - devnum = udev_device_get_devnum(device); - if (major(devnum) > 0) - printf("devnum: %u:%u\n", major(devnum), minor(devnum)); - - count = 0; - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { - printf("link: '%s'\n", udev_list_entry_get_name(list_entry)); - count++; - } - if (count > 0) - printf("found %i links\n", count); - - count = 0; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) { - printf("property: '%s=%s'\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - count++; - } - if (count > 0) - printf("found %i properties\n", count); - - str = udev_device_get_property_value(device, "MAJOR"); - if (str != NULL) - printf("MAJOR: '%s'\n", str); - - str = udev_device_get_sysattr_value(device, "dev"); - if (str != NULL) - printf("attr{dev}: '%s'\n", str); - - printf("\n"); -} - -static int test_device(struct udev *udev, const char *syspath) -{ - struct udev_device *device; - - printf("looking at device: %s\n", syspath); - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) { - printf("no device found\n"); - return -1; - } - print_device(device); - udev_device_unref(device); - return 0; -} - -static int test_device_parents(struct udev *udev, const char *syspath) -{ - struct udev_device *device; - struct udev_device *device_parent; - - printf("looking at device: %s\n", syspath); - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) - return -1; - - printf("looking at parents\n"); - device_parent = device; - do { - print_device(device_parent); - device_parent = udev_device_get_parent(device_parent); - } while (device_parent != NULL); - - printf("looking at parents again\n"); - device_parent = device; - do { - print_device(device_parent); - device_parent = udev_device_get_parent(device_parent); - } while (device_parent != NULL); - udev_device_unref(device); - - return 0; -} - -static int test_device_devnum(struct udev *udev) -{ - dev_t devnum = makedev(1, 3); - struct udev_device *device; - - printf("looking up device: %u:%u\n", major(devnum), minor(devnum)); - device = udev_device_new_from_devnum(udev, 'c', devnum); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - return 0; -} - -static int test_device_subsys_name(struct udev *udev) -{ - struct udev_device *device; - - printf("looking up device: 'block':'sda'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "block", "sda"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - - printf("looking up device: 'subsystem':'pci'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "subsystem", "pci"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - - printf("looking up device: 'drivers':'scsi:sd'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "drivers", "scsi:sd"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - - printf("looking up device: 'module':'printk'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "module", "printk"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - return 0; -} - -static int test_enumerate_print_list(struct udev_enumerate *enumerate) -{ - struct udev_list_entry *list_entry; - int count = 0; - - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), - udev_list_entry_get_name(list_entry)); - if (device != NULL) { - printf("device: '%s' (%s)\n", - udev_device_get_syspath(device), - udev_device_get_subsystem(device)); - udev_device_unref(device); - count++; - } - } - printf("found %i devices\n\n", count); - return count; -} - -static int test_monitor(struct udev *udev) -{ - struct udev_monitor *udev_monitor = NULL; - int fd_ep; - int fd_udev = -1; - struct epoll_event ep_udev, ep_stdin; - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - printf("error creating epoll fd: %m\n"); - goto out; - } - - udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); - if (udev_monitor == NULL) { - printf("no socket\n"); - goto out; - } - fd_udev = udev_monitor_get_fd(udev_monitor); - - if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "block", NULL) < 0 || - udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL) < 0 || - udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device") < 0) { - printf("filter failed\n"); - goto out; - } - - if (udev_monitor_enable_receiving(udev_monitor) < 0) { - printf("bind failed\n"); - goto out; - } - - memset(&ep_udev, 0, sizeof(struct epoll_event)); - ep_udev.events = EPOLLIN; - ep_udev.data.fd = fd_udev; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { - printf("fail to add fd to epoll: %m\n"); - goto out; - } - - memset(&ep_stdin, 0, sizeof(struct epoll_event)); - ep_stdin.events = EPOLLIN; - ep_stdin.data.fd = STDIN_FILENO; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, STDIN_FILENO, &ep_stdin) < 0) { - printf("fail to add fd to epoll: %m\n"); - goto out; - } - - for (;;) { - int fdcount; - struct epoll_event ev[4]; - struct udev_device *device; - int i; - - printf("waiting for events from udev, press ENTER to exit\n"); - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); - printf("epoll fd count: %i\n", fdcount); - - for (i = 0; i < fdcount; i++) { - if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { - device = udev_monitor_receive_device(udev_monitor); - if (device == NULL) { - printf("no device from socket\n"); - continue; - } - print_device(device); - udev_device_unref(device); - } else if (ev[i].data.fd == STDIN_FILENO && ev[i].events & EPOLLIN) { - printf("exiting loop\n"); - goto out; - } - } - } -out: - if (fd_ep >= 0) - close(fd_ep); - udev_monitor_unref(udev_monitor); - return 0; -} - -static int test_queue(struct udev *udev) -{ - struct udev_queue *udev_queue; - unsigned long long int seqnum; - struct udev_list_entry *list_entry; - - udev_queue = udev_queue_new(udev); - if (udev_queue == NULL) - return -1; - seqnum = udev_queue_get_kernel_seqnum(udev_queue); - printf("seqnum kernel: %llu\n", seqnum); - seqnum = udev_queue_get_udev_seqnum(udev_queue); - printf("seqnum udev : %llu\n", seqnum); - - if (udev_queue_get_queue_is_empty(udev_queue)) - printf("queue is empty\n"); - printf("get queue list\n"); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - printf("\n"); - printf("get queue list again\n"); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - printf("\n"); - - list_entry = udev_queue_get_queued_list_entry(udev_queue); - if (list_entry != NULL) { - printf("event [%llu] is queued\n", seqnum); - seqnum = strtoull(udev_list_entry_get_value(list_entry), NULL, 10); - if (udev_queue_get_seqnum_is_finished(udev_queue, seqnum)) - printf("event [%llu] is not finished\n", seqnum); - else - printf("event [%llu] is finished\n", seqnum); - } - printf("\n"); - udev_queue_unref(udev_queue); - return 0; -} - -static int test_enumerate(struct udev *udev, const char *subsystem) -{ - struct udev_enumerate *udev_enumerate; - - printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'net' + duplicated scan + null + zero\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, "net"); - udev_enumerate_scan_devices(udev_enumerate); - udev_enumerate_scan_devices(udev_enumerate); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'block'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate,"block"); - udev_enumerate_add_match_is_initialized(udev_enumerate); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'not block'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'pci, mem, vc'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, "pci"); - udev_enumerate_add_match_subsystem(udev_enumerate, "mem"); - udev_enumerate_add_match_subsystem(udev_enumerate, "vc"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'subsystem'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_subsystems(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'property IF_FS_*=filesystem'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_property(udev_enumerate, "ID_FS*", "filesystem"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - return 0; -} - -int main(int argc, char *argv[]) -{ - struct udev *udev = NULL; - static const struct option options[] = { - { "syspath", required_argument, NULL, 'p' }, - { "subsystem", required_argument, NULL, 's' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - {} - }; - const char *syspath = "/devices/virtual/mem/null"; - const char *subsystem = NULL; - char path[1024]; - const char *str; - - udev = udev_new(); - printf("context: %p\n", udev); - if (udev == NULL) { - printf("no context\n"); - return 1; - } - udev_set_log_fn(udev, log_fn); - printf("set log: %p\n", log_fn); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "+p:s:dhV", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'p': - syspath = optarg; - break; - case 's': - subsystem = optarg; - break; - case 'd': - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("--debug --syspath= --subsystem= --help\n"); - goto out; - case 'V': - printf("%s\n", VERSION); - goto out; - default: - goto out; - } - } - - str = udev_get_sys_path(udev); - printf("sys_path: '%s'\n", str); - str = udev_get_dev_path(udev); - printf("dev_path: '%s'\n", str); - - /* add sys path if needed */ - if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { - snprintf(path, sizeof(path), "%s%s", udev_get_sys_path(udev), syspath); - syspath = path; - } - - test_device(udev, syspath); - test_device_devnum(udev); - test_device_subsys_name(udev); - test_device_parents(udev, syspath); - - test_enumerate(udev, subsystem); - - test_queue(udev); - - test_monitor(udev); -out: - udev_unref(udev); - return 0; -} diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000000..5da27a94dc --- /dev/null +++ b/src/.gitignore @@ -0,0 +1,6 @@ +*.[78] +*.html +udev.pc +libudev.pc +libudev.so* +udev*.service diff --git a/src/COPYING b/src/COPYING new file mode 100644 index 0000000000..0851b141d8 --- /dev/null +++ b/src/COPYING @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/src/docs/.gitignore b/src/docs/.gitignore new file mode 100644 index 0000000000..dca700a998 --- /dev/null +++ b/src/docs/.gitignore @@ -0,0 +1,17 @@ +libudev-overrides.txt +html/ +tmpl/ +xml/ +*.stamp +*.bak +version.xml +libudev-decl-list.txt +libudev-decl.txt +libudev-undeclared.txt +libudev-undocumented.txt +libudev-unused.txt +libudev.args +libudev.hierarchy +libudev.interfaces +libudev.prerequisites +libudev.signals diff --git a/src/docs/Makefile.am b/src/docs/Makefile.am new file mode 100644 index 0000000000..3b280d87a7 --- /dev/null +++ b/src/docs/Makefile.am @@ -0,0 +1,99 @@ +## Process this file with automake to produce Makefile.in + +# We require automake 1.10 at least. +AUTOMAKE_OPTIONS = 1.10 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=libudev + +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=2 + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=.. + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS= + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS= + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space udev + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-mkhtml +MKHTML_OPTIONS=--path=$(abs_srcdir) --path=$(abs_builddir) + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS= + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=$(top_srcdir)/src/libudev*.h +CFILE_GLOB=$(top_srcdir)/src/libudev*.c + +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h +EXTRA_HFILES= + +# Header files to ignore when scanning. Use base file name, no paths +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES= libudev-private.h + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES= + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = version.xml + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files= + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +GTKDOC_CFLAGS= +GTKDOC_LIBS= + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +include $(top_srcdir)/gtk-doc.make + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +EXTRA_DIST += version.xml.in + +# Files not to distribute +# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types +# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt +#DISTCLEANFILES += + +# Comment this out if you want your docs-status tested during 'make check' +if ENABLE_GTK_DOC +#TESTS_ENVIRONMENT = cd $(srcsrc) +#TESTS = $(GTKDOC_CHECK) +endif diff --git a/src/docs/libudev-docs.xml b/src/docs/libudev-docs.xml new file mode 100644 index 0000000000..b7feb45529 --- /dev/null +++ b/src/docs/libudev-docs.xml @@ -0,0 +1,32 @@ + + +]> + + + libudev Reference Manual + for libudev version &version; + + 2009-2011 + Kay Sievers <kay.sievers@vrfy.org> + + + + + libudev + + + + + + + + + + + API Index + + + diff --git a/src/docs/libudev-sections.txt b/src/docs/libudev-sections.txt new file mode 100644 index 0000000000..15c3e934b5 --- /dev/null +++ b/src/docs/libudev-sections.txt @@ -0,0 +1,127 @@ +
            +libudev +udev +udev +udev_ref +udev_unref +udev_new +udev_set_log_fn +udev_get_log_priority +udev_set_log_priority +udev_get_sys_path +udev_get_dev_path +udev_get_run_path +udev_get_userdata +udev_set_userdata +
            + +
            +libudev-list +udev_list +udev_list_entry +udev_list_entry_get_next +udev_list_entry_get_by_name +udev_list_entry_get_name +udev_list_entry_get_value +udev_list_entry_foreach +
            + +
            +libudev-device +udev_device +udev_device +udev_device_ref +udev_device_unref +udev_device_get_udev +udev_device_new_from_syspath +udev_device_new_from_devnum +udev_device_new_from_subsystem_sysname +udev_device_new_from_environment +udev_device_get_parent +udev_device_get_parent_with_subsystem_devtype +udev_device_get_devpath +udev_device_get_subsystem +udev_device_get_devtype +udev_device_get_syspath +udev_device_get_sysname +udev_device_get_sysnum +udev_device_get_devnode +udev_device_get_is_initialized +udev_device_get_devlinks_list_entry +udev_device_get_properties_list_entry +udev_device_get_tags_list_entry +udev_device_get_property_value +udev_device_get_driver +udev_device_get_devnum +udev_device_get_action +udev_device_get_sysattr_value +udev_device_get_sysattr_list_entry +udev_device_get_seqnum +udev_device_get_usec_since_initialized +udev_device_has_tag +
            + +
            +libudev-monitor +udev_monitor +udev_monitor +udev_monitor_ref +udev_monitor_unref +udev_monitor_get_udev +udev_monitor_new_from_netlink +udev_monitor_new_from_socket +udev_monitor_enable_receiving +udev_monitor_set_receive_buffer_size +udev_monitor_get_fd +udev_monitor_receive_device +udev_monitor_filter_add_match_subsystem_devtype +udev_monitor_filter_add_match_tag +udev_monitor_filter_update +udev_monitor_filter_remove +
            + +
            +libudev-enumerate +udev_enumerate +udev_enumerate +udev_enumerate_ref +udev_enumerate_unref +udev_enumerate_get_udev +udev_enumerate_new +udev_enumerate_add_match_subsystem +udev_enumerate_add_nomatch_subsystem +udev_enumerate_add_match_sysattr +udev_enumerate_add_nomatch_sysattr +udev_enumerate_add_match_property +udev_enumerate_add_match_tag +udev_enumerate_add_match_parent +udev_enumerate_add_match_is_initialized +udev_enumerate_add_match_sysname +udev_enumerate_add_syspath +udev_enumerate_scan_devices +udev_enumerate_scan_subsystems +udev_enumerate_get_list_entry +
            + +
            +libudev-queue +udev_queue +udev_queue +udev_queue_ref +udev_queue_unref +udev_queue_get_udev +udev_queue_new +udev_queue_get_udev_is_active +udev_queue_get_queue_is_empty +udev_queue_get_seqnum_is_finished +udev_queue_get_seqnum_sequence_is_finished +udev_queue_get_queued_list_entry +udev_queue_get_kernel_seqnum +udev_queue_get_udev_seqnum +
            + +
            +libudev-util +udev_util +udev_util_encode_string +
            diff --git a/src/docs/libudev.types b/src/docs/libudev.types new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/docs/version.xml.in b/src/docs/version.xml.in new file mode 100644 index 0000000000..d78bda9342 --- /dev/null +++ b/src/docs/version.xml.in @@ -0,0 +1 @@ +@VERSION@ diff --git a/src/extras/accelerometer/.gitignore b/src/extras/accelerometer/.gitignore new file mode 100644 index 0000000000..dddc2204d4 --- /dev/null +++ b/src/extras/accelerometer/.gitignore @@ -0,0 +1 @@ +accelerometer diff --git a/src/extras/accelerometer/61-accelerometer.rules b/src/extras/accelerometer/61-accelerometer.rules new file mode 100644 index 0000000000..a6a2bfd088 --- /dev/null +++ b/src/extras/accelerometer/61-accelerometer.rules @@ -0,0 +1,3 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="input", ACTION!="remove", ENV{ID_INPUT_ACCELEROMETER}=="1", IMPORT{program}="accelerometer %p" diff --git a/src/extras/accelerometer/accelerometer.c b/src/extras/accelerometer/accelerometer.c new file mode 100644 index 0000000000..59c2a4ece3 --- /dev/null +++ b/src/extras/accelerometer/accelerometer.c @@ -0,0 +1,357 @@ +/* + * accelerometer - exports device orientation through property + * + * When an "change" event is received on an accelerometer, + * open its device node, and from the value, as well as the previous + * value of the property, calculate the device's new orientation, + * and export it as ID_INPUT_ACCELEROMETER_ORIENTATION. + * + * Possible values are: + * undefined + * * normal + * * bottom-up + * * left-up + * * right-up + * + * The property will be persistent across sessions, and the new + * orientations can be deducted from the previous one (it allows + * for a threshold for switching between opposite ends of the + * orientation). + * + * Copyright (C) 2011 Red Hat, Inc. + * Author: + * Bastien Nocera + * + * orientation_calc() from the sensorfw package + * Copyright (C) 2009-2010 Nokia Corporation + * Authors: + * Üstün Ergenoglu + * Timo Rongas + * Lihan Guo + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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 keymap; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/* we must use this kernel-compatible implementation */ +#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<> OFF(bit)) & 1) + +static int debug = 0; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } +} + +typedef enum { + ORIENTATION_UNDEFINED, + ORIENTATION_NORMAL, + ORIENTATION_BOTTOM_UP, + ORIENTATION_LEFT_UP, + ORIENTATION_RIGHT_UP +} OrientationUp; + +static const char *orientations[] = { + "undefined", + "normal", + "bottom-up", + "left-up", + "right-up", + NULL +}; + +#define ORIENTATION_UP_UP ORIENTATION_NORMAL + +#define DEFAULT_THRESHOLD 250 +#define RADIANS_TO_DEGREES 180.0/M_PI +#define SAME_AXIS_LIMIT 5 + +#define THRESHOLD_LANDSCAPE 25 +#define THRESHOLD_PORTRAIT 20 + +static const char * +orientation_to_string (OrientationUp o) +{ + return orientations[o]; +} + +static OrientationUp +string_to_orientation (const char *orientation) +{ + int i; + + if (orientation == NULL) + return ORIENTATION_UNDEFINED; + for (i = 0; orientations[i] != NULL; i++) { + if (strcmp (orientation, orientations[i]) == 0) + return i; + } + return ORIENTATION_UNDEFINED; +} + +static OrientationUp +orientation_calc (OrientationUp prev, + int x, int y, int z) +{ + int rotation; + OrientationUp ret = prev; + + /* Portrait check */ + rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_PORTRAIT) { + ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP; + + /* Some threshold to switching between portrait modes */ + if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + + } else { + /* Landscape check */ + rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_LANDSCAPE) { + ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL; + + /* Some threshold to switching between landscape modes */ + if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + } + } + + return ret; +} + +static OrientationUp +get_prev_orientation(struct udev_device *dev) +{ + const char *value; + + value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); + if (value == NULL) + return ORIENTATION_UNDEFINED; + return string_to_orientation(value); +} + +#define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = 1; } } + +/* accelerometers */ +static void test_orientation(struct udev *udev, + struct udev_device *dev, + const char *devpath) +{ + OrientationUp old, new; + int fd, r; + struct input_event ev[64]; + int got_syn = 0; + int got_x, got_y, got_z; + int x = 0, y = 0, z = 0; + char text[64]; + + old = get_prev_orientation(dev); + + if ((fd = open(devpath, O_RDONLY)) < 0) + return; + + got_x = got_y = got_z = 0; + + while (1) { + int i; + + r = read(fd, ev, sizeof(struct input_event) * 64); + + if (r < (int) sizeof(struct input_event)) + return; + + for (i = 0; i < r / (int) sizeof(struct input_event); i++) { + if (got_syn == 1) { + if (ev[i].type == EV_ABS) { + SET_AXIS(x, ABS_X); + SET_AXIS(y, ABS_Y); + SET_AXIS(z, ABS_Z); + } + } + if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) { + got_syn = 1; + } + if (got_x && got_y && got_z) + goto read_dev; + } + } + +read_dev: + close(fd); + + if (!got_x || !got_y || !got_z) + return; + + new = orientation_calc(old, x, y, z); + snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new)); + puts(text); +} + +static void help(void) +{ + printf("Usage: accelerometer [options] \n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); +} + +int main (int argc, char** argv) +{ + struct udev *udev; + struct udev_device *dev; + + static const struct option options[] = { + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + char devpath[PATH_MAX]; + char *devnode; + const char *id_path; + struct udev_enumerate *enumerate; + struct udev_list_entry *list_entry; + + udev = udev_new(); + if (udev == NULL) + return 1; + + udev_log_init("input_id"); + udev_set_log_fn(udev, log_fn); + + /* CLI argument parsing */ + while (1) { + int option; + + option = getopt_long(argc, argv, "dxh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + help(); + exit(0); + default: + exit(1); + } + } + + if (argv[optind] == NULL) { + help(); + exit(1); + } + + /* get the device */ + snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); + dev = udev_device_new_from_syspath(udev, devpath); + if (dev == NULL) { + fprintf(stderr, "unable to access '%s'\n", devpath); + return 1; + } + + id_path = udev_device_get_property_value(dev, "ID_PATH"); + if (id_path == NULL) { + fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath); + return 0; + } + + /* Get the children devices and find the devnode + * FIXME: use udev_enumerate_add_match_children() instead + * when it's available */ + devnode = NULL; + enumerate = udev_enumerate_new(udev); + udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path); + udev_enumerate_add_match_subsystem(enumerate, "input"); + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + const char *node; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + /* Already found it */ + if (devnode != NULL) { + udev_device_unref(device); + continue; + } + + node = udev_device_get_devnode(device); + if (node == NULL) { + udev_device_unref(device); + continue; + } + /* Use the event sub-device */ + if (strstr(node, "/event") == NULL) { + udev_device_unref(device); + continue; + } + + devnode = strdup(node); + udev_device_unref(device); + } + + if (devnode == NULL) { + fprintf(stderr, "unable to get device node for '%s'\n", devpath); + return 0; + } + + info(udev, "Opening accelerometer device %s\n", devnode); + test_orientation(udev, dev, devnode); + free(devnode); + + return 0; +} diff --git a/src/extras/ata_id/.gitignore b/src/extras/ata_id/.gitignore new file mode 100644 index 0000000000..77837266e6 --- /dev/null +++ b/src/extras/ata_id/.gitignore @@ -0,0 +1 @@ +ata_id diff --git a/src/extras/ata_id/ata_id.c b/src/extras/ata_id/ata_id.c new file mode 100644 index 0000000000..64df86c23a --- /dev/null +++ b/src/extras/ata_id/ata_id.c @@ -0,0 +1,726 @@ +/* + * ata_id - reads product/serial number from ATA drives + * + * Copyright (C) 2005-2008 Kay Sievers + * Copyright (C) 2009 Lennart Poettering + * Copyright (C) 2009-2010 David Zeuthen + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +#define COMMAND_TIMEOUT_MSEC (30 * 1000) + +static int disk_scsi_inquiry_command(int fd, + void *buf, + size_t buf_len) +{ + struct sg_io_v4 io_v4; + uint8_t cdb[6]; + uint8_t sense[32]; + int ret; + + /* + * INQUIRY, see SPC-4 section 6.4 + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0x12; /* OPERATION CODE: INQUIRY */ + cdb[3] = (buf_len >> 8); /* ALLOCATION LENGTH */ + cdb[4] = (buf_len & 0xff); + + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + + /* even if the ioctl succeeds, we need to check the return value */ + if (!(io_hdr.status == 0 && + io_hdr.host_status == 0 && + io_hdr.driver_status == 0)) { + errno = EIO; + ret = -1; + goto out; + } + } else { + goto out; + } + } + + /* even if the ioctl succeeds, we need to check the return value */ + if (!(io_v4.device_status == 0 && + io_v4.transport_status == 0 && + io_v4.driver_status == 0)) { + errno = EIO; + ret = -1; + goto out; + } + + out: + return ret; +} + +static int disk_identify_command(int fd, + void *buf, + size_t buf_len) +{ + struct sg_io_v4 io_v4; + uint8_t cdb[12]; + uint8_t sense[32]; + uint8_t *desc = sense+8; + int ret; + + /* + * ATA Pass-Through 12 byte command, as described in + * + * T10 04-262r8 ATA Command Pass-Through + * + * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0xa1; /* OPERATION CODE: 12 byte pass through */ + cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ + cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ + cdb[3] = 0; /* FEATURES */ + cdb[4] = 1; /* SECTORS */ + cdb[5] = 0; /* LBA LOW */ + cdb[6] = 0; /* LBA MID */ + cdb[7] = 0; /* LBA HIGH */ + cdb[8] = 0 & 0x4F; /* SELECT */ + cdb[9] = 0xEC; /* Command: ATA IDENTIFY DEVICE */; + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + } else { + goto out; + } + } + + if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { + errno = EIO; + ret = -1; + goto out; + } + + out: + return ret; +} + +static int disk_identify_packet_device_command(int fd, + void *buf, + size_t buf_len) +{ + struct sg_io_v4 io_v4; + uint8_t cdb[16]; + uint8_t sense[32]; + uint8_t *desc = sense+8; + int ret; + + /* + * ATA Pass-Through 16 byte command, as described in + * + * T10 04-262r8 ATA Command Pass-Through + * + * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0x85; /* OPERATION CODE: 16 byte pass through */ + cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ + cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ + cdb[3] = 0; /* FEATURES */ + cdb[4] = 0; /* FEATURES */ + cdb[5] = 0; /* SECTORS */ + cdb[6] = 1; /* SECTORS */ + cdb[7] = 0; /* LBA LOW */ + cdb[8] = 0; /* LBA LOW */ + cdb[9] = 0; /* LBA MID */ + cdb[10] = 0; /* LBA MID */ + cdb[11] = 0; /* LBA HIGH */ + cdb[12] = 0; /* LBA HIGH */ + cdb[13] = 0; /* DEVICE */ + cdb[14] = 0xA1; /* Command: ATA IDENTIFY PACKET DEVICE */; + cdb[15] = 0; /* CONTROL */ + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + } else { + goto out; + } + } + + if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { + errno = EIO; + ret = -1; + goto out; + } + + out: + return ret; +} + +/** + * disk_identify_get_string: + * @identify: A block of IDENTIFY data + * @offset_words: Offset of the string to get, in words. + * @dest: Destination buffer for the string. + * @dest_len: Length of destination buffer, in bytes. + * + * Copies the ATA string from @identify located at @offset_words into @dest. + */ +static void disk_identify_get_string (uint8_t identify[512], + unsigned int offset_words, + char *dest, + size_t dest_len) +{ + unsigned int c1; + unsigned int c2; + + assert (identify != NULL); + assert (dest != NULL); + assert ((dest_len & 1) == 0); + + while (dest_len > 0) { + c1 = ((uint16_t *) identify)[offset_words] >> 8; + c2 = ((uint16_t *) identify)[offset_words] & 0xff; + *dest = c1; + dest++; + *dest = c2; + dest++; + offset_words++; + dest_len -= 2; + } +} + +static void disk_identify_fixup_string (uint8_t identify[512], + unsigned int offset_words, + size_t len) +{ + disk_identify_get_string(identify, offset_words, + (char *) identify + offset_words * 2, len); +} + +static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offset_words) +{ + uint16_t *p; + + p = (uint16_t *) identify; + p[offset_words] = le16toh (p[offset_words]); +} + +/** + * disk_identify: + * @udev: The libudev context. + * @fd: File descriptor for the block device. + * @out_identify: Return location for IDENTIFY data. + * @out_is_packet_device: Return location for whether returned data is from a IDENTIFY PACKET DEVICE. + * + * Sends the IDENTIFY DEVICE or IDENTIFY PACKET DEVICE command to the + * device represented by @fd. If successful, then the result will be + * copied into @out_identify and @out_is_packet_device. + * + * This routine is based on code from libatasmart, Copyright 2008 + * Lennart Poettering, LGPL v2.1. + * + * Returns: 0 if the data was successfully obtained, otherwise + * non-zero with errno set. + */ +static int disk_identify (struct udev *udev, + int fd, + uint8_t out_identify[512], + int *out_is_packet_device) +{ + int ret; + uint8_t inquiry_buf[36]; + int peripheral_device_type; + int all_nul_bytes; + int n; + int is_packet_device; + + assert (out_identify != NULL); + + /* init results */ + ret = -1; + memset (out_identify, '\0', 512); + is_packet_device = 0; + + /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device + * we could accidentally blank media. This is because MMC's BLANK + * command has the same op-code (0x61). + * + * To prevent this from happening we bail out if the device + * isn't a Direct Access Block Device, e.g. SCSI type 0x00 + * (CD/DVD devices are type 0x05). So we send a SCSI INQUIRY + * command first... libata is handling this via its SCSI + * emulation layer. + * + * This also ensures that we're actually dealing with a device + * that understands SCSI commands. + * + * (Yes, it is a bit perverse that we're tunneling the ATA + * command through SCSI and relying on the ATA driver + * emulating SCSI well-enough...) + * + * (See commit 160b069c25690bfb0c785994c7c3710289179107 for + * the original bug-fix and see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635 + * for the original bug-report.) + */ + ret = disk_scsi_inquiry_command (fd, inquiry_buf, sizeof (inquiry_buf)); + if (ret != 0) + goto out; + + /* SPC-4, section 6.4.2: Standard INQUIRY data */ + peripheral_device_type = inquiry_buf[0] & 0x1f; + if (peripheral_device_type == 0x05) + { + is_packet_device = 1; + ret = disk_identify_packet_device_command(fd, out_identify, 512); + goto check_nul_bytes; + } + if (peripheral_device_type != 0x00) { + ret = -1; + errno = EIO; + goto out; + } + + /* OK, now issue the IDENTIFY DEVICE command */ + ret = disk_identify_command(fd, out_identify, 512); + if (ret != 0) + goto out; + + check_nul_bytes: + /* Check if IDENTIFY data is all NUL bytes - if so, bail */ + all_nul_bytes = 1; + for (n = 0; n < 512; n++) { + if (out_identify[n] != '\0') { + all_nul_bytes = 0; + break; + } + } + + if (all_nul_bytes) { + ret = -1; + errno = EIO; + goto out; + } + +out: + if (out_is_packet_device != NULL) + *out_is_packet_device = is_packet_device; + return ret; +} + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + vsyslog(priority, format, args); +} + +int main(int argc, char *argv[]) +{ + struct udev *udev; + struct hd_driveid id; + uint8_t identify[512]; + uint16_t *identify_words; + char model[41]; + char model_enc[256]; + char serial[21]; + char revision[9]; + const char *node = NULL; + int export = 0; + int fd; + uint16_t word; + int rc = 0; + int is_packet_device = 0; + static const struct option options[] = { + { "export", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("ata_id"); + udev_set_log_fn(udev, log_fn); + + while (1) { + int option; + + option = getopt_long(argc, argv, "xh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'x': + export = 1; + break; + case 'h': + printf("Usage: ata_id [--export] [--help] \n" + " --export print values as environment keys\n" + " --help print this help text\n\n"); + goto exit; + } + } + + node = argv[optind]; + if (node == NULL) { + err(udev, "no node specified\n"); + rc = 1; + goto exit; + } + + fd = open(node, O_RDONLY|O_NONBLOCK); + if (fd < 0) { + err(udev, "unable to open '%s'\n", node); + rc = 1; + goto exit; + } + + if (disk_identify(udev, fd, identify, &is_packet_device) == 0) { + /* + * fix up only the fields from the IDENTIFY data that we are going to + * use and copy it into the hd_driveid struct for convenience + */ + disk_identify_fixup_string (identify, 10, 20); /* serial */ + disk_identify_fixup_string (identify, 23, 6); /* fwrev */ + disk_identify_fixup_string (identify, 27, 40); /* model */ + disk_identify_fixup_uint16 (identify, 0); /* configuration */ + disk_identify_fixup_uint16 (identify, 75); /* queue depth */ + disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ + disk_identify_fixup_uint16 (identify, 82); /* command set supported */ + disk_identify_fixup_uint16 (identify, 83); /* command set supported */ + disk_identify_fixup_uint16 (identify, 84); /* command set supported */ + disk_identify_fixup_uint16 (identify, 85); /* command set supported */ + disk_identify_fixup_uint16 (identify, 86); /* command set supported */ + disk_identify_fixup_uint16 (identify, 87); /* command set supported */ + disk_identify_fixup_uint16 (identify, 89); /* time required for SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 90); /* time required for enhanced SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 91); /* current APM values */ + disk_identify_fixup_uint16 (identify, 94); /* current AAM value */ + disk_identify_fixup_uint16 (identify, 128); /* device lock function */ + disk_identify_fixup_uint16 (identify, 217); /* nominal media rotation rate */ + memcpy(&id, identify, sizeof id); + } else { + /* If this fails, then try HDIO_GET_IDENTITY */ + if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) { + if (errno == ENOTTY) { + info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); + rc = 2; + } else { + err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); + rc = 3; + } + goto close; + } + } + identify_words = (uint16_t *) identify; + + memcpy (model, id.model, 40); + model[40] = '\0'; + udev_util_encode_string(model, model_enc, sizeof(model_enc)); + util_replace_whitespace((char *) id.model, model, 40); + util_replace_chars(model, NULL); + util_replace_whitespace((char *) id.serial_no, serial, 20); + util_replace_chars(serial, NULL); + util_replace_whitespace((char *) id.fw_rev, revision, 8); + util_replace_chars(revision, NULL); + + if (export) { + /* Set this to convey the disk speaks the ATA protocol */ + printf("ID_ATA=1\n"); + + if ((id.config >> 8) & 0x80) { + /* This is an ATAPI device */ + switch ((id.config >> 8) & 0x1f) { + case 0: + printf("ID_TYPE=cd\n"); + break; + case 1: + printf("ID_TYPE=tape\n"); + break; + case 5: + printf("ID_TYPE=cd\n"); + break; + case 7: + printf("ID_TYPE=optical\n"); + break; + default: + printf("ID_TYPE=generic\n"); + break; + } + } else { + printf("ID_TYPE=disk\n"); + } + printf("ID_BUS=ata\n"); + printf("ID_MODEL=%s\n", model); + printf("ID_MODEL_ENC=%s\n", model_enc); + printf("ID_REVISION=%s\n", revision); + if (serial[0] != '\0') { + printf("ID_SERIAL=%s_%s\n", model, serial); + printf("ID_SERIAL_SHORT=%s\n", serial); + } else { + printf("ID_SERIAL=%s\n", model); + } + + if (id.command_set_1 & (1<<5)) { + printf ("ID_ATA_WRITE_CACHE=1\n"); + printf ("ID_ATA_WRITE_CACHE_ENABLED=%d\n", (id.cfs_enable_1 & (1<<5)) ? 1 : 0); + } + if (id.command_set_1 & (1<<10)) { + printf("ID_ATA_FEATURE_SET_HPA=1\n"); + printf("ID_ATA_FEATURE_SET_HPA_ENABLED=%d\n", (id.cfs_enable_1 & (1<<10)) ? 1 : 0); + + /* + * TODO: use the READ NATIVE MAX ADDRESS command to get the native max address + * so it is easy to check whether the protected area is in use. + */ + } + if (id.command_set_1 & (1<<3)) { + printf("ID_ATA_FEATURE_SET_PM=1\n"); + printf("ID_ATA_FEATURE_SET_PM_ENABLED=%d\n", (id.cfs_enable_1 & (1<<3)) ? 1 : 0); + } + if (id.command_set_1 & (1<<1)) { + printf("ID_ATA_FEATURE_SET_SECURITY=1\n"); + printf("ID_ATA_FEATURE_SET_SECURITY_ENABLED=%d\n", (id.cfs_enable_1 & (1<<1)) ? 1 : 0); + printf("ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=%d\n", id.trseuc * 2); + if ((id.cfs_enable_1 & (1<<1))) /* enabled */ { + if (id.dlf & (1<<8)) + printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=maximum\n"); + else + printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=high\n"); + } + if (id.dlf & (1<<5)) + printf("ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=%d\n", id.trsEuc * 2); + if (id.dlf & (1<<4)) + printf("ID_ATA_FEATURE_SET_SECURITY_EXPIRE=1\n"); + if (id.dlf & (1<<3)) + printf("ID_ATA_FEATURE_SET_SECURITY_FROZEN=1\n"); + if (id.dlf & (1<<2)) + printf("ID_ATA_FEATURE_SET_SECURITY_LOCKED=1\n"); + } + if (id.command_set_1 & (1<<0)) { + printf("ID_ATA_FEATURE_SET_SMART=1\n"); + printf("ID_ATA_FEATURE_SET_SMART_ENABLED=%d\n", (id.cfs_enable_1 & (1<<0)) ? 1 : 0); + } + if (id.command_set_2 & (1<<9)) { + printf("ID_ATA_FEATURE_SET_AAM=1\n"); + printf("ID_ATA_FEATURE_SET_AAM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<9)) ? 1 : 0); + printf("ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=%d\n", id.acoustic >> 8); + printf("ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=%d\n", id.acoustic & 0xff); + } + if (id.command_set_2 & (1<<5)) { + printf("ID_ATA_FEATURE_SET_PUIS=1\n"); + printf("ID_ATA_FEATURE_SET_PUIS_ENABLED=%d\n", (id.cfs_enable_2 & (1<<5)) ? 1 : 0); + } + if (id.command_set_2 & (1<<3)) { + printf("ID_ATA_FEATURE_SET_APM=1\n"); + printf("ID_ATA_FEATURE_SET_APM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<3)) ? 1 : 0); + if ((id.cfs_enable_2 & (1<<3))) + printf("ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=%d\n", id.CurAPMvalues & 0xff); + } + if (id.command_set_2 & (1<<0)) + printf("ID_ATA_DOWNLOAD_MICROCODE=1\n"); + + /* + * Word 76 indicates the capabilities of a SATA device. A PATA device shall set + * word 76 to 0000h or FFFFh. If word 76 is set to 0000h or FFFFh, then + * the device does not claim compliance with the Serial ATA specification and words + * 76 through 79 are not valid and shall be ignored. + */ + word = *((uint16_t *) identify + 76); + if (word != 0x0000 && word != 0xffff) { + printf("ID_ATA_SATA=1\n"); + /* + * If bit 2 of word 76 is set to one, then the device supports the Gen2 + * signaling rate of 3.0 Gb/s (see SATA 2.6). + * + * If bit 1 of word 76 is set to one, then the device supports the Gen1 + * signaling rate of 1.5 Gb/s (see SATA 2.6). + */ + if (word & (1<<2)) + printf("ID_ATA_SATA_SIGNAL_RATE_GEN2=1\n"); + if (word & (1<<1)) + printf("ID_ATA_SATA_SIGNAL_RATE_GEN1=1\n"); + } + + /* Word 217 indicates the nominal media rotation rate of the device */ + word = *((uint16_t *) identify + 217); + if (word != 0x0000) { + if (word == 0x0001) { + printf ("ID_ATA_ROTATION_RATE_RPM=0\n"); /* non-rotating e.g. SSD */ + } else if (word >= 0x0401 && word <= 0xfffe) { + printf ("ID_ATA_ROTATION_RATE_RPM=%d\n", word); + } + } + + /* + * Words 108-111 contain a mandatory World Wide Name (WWN) in the NAA IEEE Registered identifier + * format. Word 108 bits (15:12) shall contain 5h, indicating that the naming authority is IEEE. + * All other values are reserved. + */ + word = *((uint16_t *) identify + 108); + if ((word & 0xf000) == 0x5000) { + uint64_t wwwn; + + wwwn = *((uint16_t *) identify + 108); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 109); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 110); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 111); + printf("ID_WWN=0x%llx\n", (unsigned long long int) wwwn); + /* ATA devices have no vendor extension */ + printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn); + } + + /* from Linux's include/linux/ata.h */ + if (identify_words[0] == 0x848a || identify_words[0] == 0x844a) { + printf("ID_ATA_CFA=1\n"); + } else { + if ((identify_words[83] & 0xc004) == 0x4004) { + printf("ID_ATA_CFA=1\n"); + } + } + } else { + if (serial[0] != '\0') + printf("%s_%s\n", model, serial); + else + printf("%s\n", model); + } +close: + close(fd); +exit: + udev_unref(udev); + udev_log_close(); + return rc; +} diff --git a/src/extras/cdrom_id/.gitignore b/src/extras/cdrom_id/.gitignore new file mode 100644 index 0000000000..7d817ea74e --- /dev/null +++ b/src/extras/cdrom_id/.gitignore @@ -0,0 +1 @@ +cdrom_id diff --git a/src/extras/cdrom_id/60-cdrom_id.rules b/src/extras/cdrom_id/60-cdrom_id.rules new file mode 100644 index 0000000000..353f522b0b --- /dev/null +++ b/src/extras/cdrom_id/60-cdrom_id.rules @@ -0,0 +1,18 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="cdrom_end" +SUBSYSTEM!="block", GOTO="cdrom_end" +KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" +ENV{DEVTYPE}!="disk", GOTO="cdrom_end" + +# unconditionally tag device as CDROM +KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" + +# media eject button pressed +ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end" + +# import device and media properties and lock tray to +# enable the receiving of media eject button events +IMPORT{program}="cdrom_id --lock-media $devnode" + +LABEL="cdrom_end" diff --git a/src/extras/cdrom_id/cdrom_id.c b/src/extras/cdrom_id/cdrom_id.c new file mode 100644 index 0000000000..664a00d2c7 --- /dev/null +++ b/src/extras/cdrom_id/cdrom_id.c @@ -0,0 +1,1099 @@ +/* + * cdrom_id - optical drive and media information prober + * + * Copyright (C) 2008-2010 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static bool debug; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } +} + +/* device info */ +static unsigned int cd_cd_rom = 0; +static unsigned int cd_cd_r = 0; +static unsigned int cd_cd_rw = 0; +static unsigned int cd_dvd_rom = 0; +static unsigned int cd_dvd_r = 0; +static unsigned int cd_dvd_rw = 0; +static unsigned int cd_dvd_ram = 0; +static unsigned int cd_dvd_plus_r = 0; +static unsigned int cd_dvd_plus_rw = 0; +static unsigned int cd_dvd_plus_r_dl = 0; +static unsigned int cd_dvd_plus_rw_dl = 0; +static unsigned int cd_bd = 0; +static unsigned int cd_bd_r = 0; +static unsigned int cd_bd_re = 0; +static unsigned int cd_hddvd = 0; +static unsigned int cd_hddvd_r = 0; +static unsigned int cd_hddvd_rw = 0; +static unsigned int cd_mo = 0; +static unsigned int cd_mrw = 0; +static unsigned int cd_mrw_w = 0; + +/* media info */ +static unsigned int cd_media = 0; +static unsigned int cd_media_cd_rom = 0; +static unsigned int cd_media_cd_r = 0; +static unsigned int cd_media_cd_rw = 0; +static unsigned int cd_media_dvd_rom = 0; +static unsigned int cd_media_dvd_r = 0; +static unsigned int cd_media_dvd_rw = 0; +static unsigned int cd_media_dvd_rw_ro = 0; /* restricted overwrite mode */ +static unsigned int cd_media_dvd_rw_seq = 0; /* sequential mode */ +static unsigned int cd_media_dvd_ram = 0; +static unsigned int cd_media_dvd_plus_r = 0; +static unsigned int cd_media_dvd_plus_rw = 0; +static unsigned int cd_media_dvd_plus_r_dl = 0; +static unsigned int cd_media_dvd_plus_rw_dl = 0; +static unsigned int cd_media_bd = 0; +static unsigned int cd_media_bd_r = 0; +static unsigned int cd_media_bd_re = 0; +static unsigned int cd_media_hddvd = 0; +static unsigned int cd_media_hddvd_r = 0; +static unsigned int cd_media_hddvd_rw = 0; +static unsigned int cd_media_mo = 0; +static unsigned int cd_media_mrw = 0; +static unsigned int cd_media_mrw_w = 0; + +static const char *cd_media_state = NULL; +static unsigned int cd_media_session_next = 0; +static unsigned int cd_media_session_count = 0; +static unsigned int cd_media_track_count = 0; +static unsigned int cd_media_track_count_data = 0; +static unsigned int cd_media_track_count_audio = 0; +static unsigned long long int cd_media_session_last_offset = 0; + +#define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) +#define SK(errcode) (((errcode) >> 16) & 0xF) +#define ASC(errcode) (((errcode) >> 8) & 0xFF) +#define ASCQ(errcode) ((errcode) & 0xFF) + +static int is_mounted(const char *device) +{ + struct stat statbuf; + FILE *fp; + int maj, min; + int mounted = 0; + + if (stat(device, &statbuf) < 0) + return -ENODEV; + + fp = fopen("/proc/self/mountinfo", "r"); + if (fp == NULL) + return -ENOSYS; + while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { + if (makedev(maj, min) == statbuf.st_rdev) { + mounted = 1; + break; + } + } + fclose(fp); + return mounted; +} + +static void info_scsi_cmd_err(struct udev *udev, char *cmd, int err) +{ + if (err == -1) { + info(udev, "%s failed\n", cmd); + return; + } + info(udev, "%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); +} + +struct scsi_cmd { + struct cdrom_generic_command cgc; + union { + struct request_sense s; + unsigned char u[18]; + } _sense; + struct sg_io_hdr sg_io; +}; + +static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd) +{ + memset(cmd, 0x00, sizeof(struct scsi_cmd)); + cmd->cgc.quiet = 1; + cmd->cgc.sense = &cmd->_sense.s; + cmd->sg_io.interface_id = 'S'; + cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); + cmd->sg_io.cmdp = cmd->cgc.cmd; + cmd->sg_io.sbp = cmd->_sense.u; + cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; +} + +static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg) +{ + cmd->sg_io.cmd_len = i + 1; + cmd->cgc.cmd[i] = arg; +} + +#define CHECK_CONDITION 0x01 + +static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize) +{ + int ret = 0; + + if (bufsize > 0) { + cmd->sg_io.dxferp = buf; + cmd->sg_io.dxfer_len = bufsize; + cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + } else { + cmd->sg_io.dxfer_direction = SG_DXFER_NONE; + } + if (ioctl(fd, SG_IO, &cmd->sg_io)) + return -1; + + if ((cmd->sg_io.info & SG_INFO_OK_MASK) != SG_INFO_OK) { + errno = EIO; + ret = -1; + if (cmd->sg_io.masked_status & CHECK_CONDITION) { + ret = ERRCODE(cmd->_sense.u); + if (ret == 0) + ret = -1; + } + } + return ret; +} + +static int media_lock(struct udev *udev, int fd, bool lock) +{ + int err; + + /* disable the kernel's lock logic */ + err = ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK); + if (err < 0) + info(udev, "CDROM_CLEAR_OPTIONS, CDO_LOCK failed\n"); + + err = ioctl(fd, CDROM_LOCKDOOR, lock ? 1 : 0); + if (err < 0) + info(udev, "CDROM_LOCKDOOR failed\n"); + + return err; +} + +static int media_eject(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x1b); + scsi_cmd_set(udev, &sc, 4, 0x02); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, NULL, 0); + if ((err != 0)) { + info_scsi_cmd_err(udev, "START_STOP_UNIT", err); + return -1; + } + return 0; +} + +static int cd_capability_compat(struct udev *udev, int fd) +{ + int capability; + + capability = ioctl(fd, CDROM_GET_CAPABILITY, NULL); + if (capability < 0) { + info(udev, "CDROM_GET_CAPABILITY failed\n"); + return -1; + } + + if (capability & CDC_CD_R) + cd_cd_r = 1; + if (capability & CDC_CD_RW) + cd_cd_rw = 1; + if (capability & CDC_DVD) + cd_dvd_rom = 1; + if (capability & CDC_DVD_R) + cd_dvd_r = 1; + if (capability & CDC_DVD_RAM) + cd_dvd_ram = 1; + if (capability & CDC_MRW) + cd_mrw = 1; + if (capability & CDC_MRW_W) + cd_mrw_w = 1; + return 0; +} + +static int cd_media_compat(struct udev *udev, int fd) +{ + if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) { + info(udev, "CDROM_DRIVE_STATUS != CDS_DISC_OK\n"); + return -1; + } + cd_media = 1; + return 0; +} + +static int cd_inquiry(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char inq[128]; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x12); + scsi_cmd_set(udev, &sc, 4, 36); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, inq, 36); + if ((err != 0)) { + info_scsi_cmd_err(udev, "INQUIRY", err); + return -1; + } + + if ((inq[0] & 0x1F) != 5) { + info(udev, "not an MMC unit\n"); + return -1; + } + + info(udev, "INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); + return 0; +} + +static void feature_profile_media(struct udev *udev, int cur_profile) +{ + switch (cur_profile) { + case 0x03: + case 0x04: + case 0x05: + info(udev, "profile 0x%02x \n", cur_profile); + cd_media = 1; + cd_media_mo = 1; + break; + case 0x08: + info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); + cd_media = 1; + cd_media_cd_rom = 1; + break; + case 0x09: + info(udev, "profile 0x%02x media_cd_r\n", cur_profile); + cd_media = 1; + cd_media_cd_r = 1; + break; + case 0x0a: + info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); + cd_media = 1; + cd_media_cd_rw = 1; + break; + case 0x10: + info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rom = 1; + break; + case 0x11: + info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_r = 1; + break; + case 0x12: + info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); + cd_media = 1; + cd_media_dvd_ram = 1; + break; + case 0x13: + info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_ro = 1; + break; + case 0x14: + info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_seq = 1; + break; + case 0x1B: + info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r = 1; + break; + case 0x1A: + info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw = 1; + break; + case 0x2A: + info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw_dl = 1; + break; + case 0x2B: + info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r_dl = 1; + break; + case 0x40: + info(udev, "profile 0x%02x media_bd\n", cur_profile); + cd_media = 1; + cd_media_bd = 1; + break; + case 0x41: + case 0x42: + info(udev, "profile 0x%02x media_bd_r\n", cur_profile); + cd_media = 1; + cd_media_bd_r = 1; + break; + case 0x43: + info(udev, "profile 0x%02x media_bd_re\n", cur_profile); + cd_media = 1; + cd_media_bd_re = 1; + break; + case 0x50: + info(udev, "profile 0x%02x media_hddvd\n", cur_profile); + cd_media = 1; + cd_media_hddvd = 1; + break; + case 0x51: + info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); + cd_media = 1; + cd_media_hddvd_r = 1; + break; + case 0x52: + info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); + cd_media = 1; + cd_media_hddvd_rw = 1; + break; + default: + info(udev, "profile 0x%02x \n", cur_profile); + break; + } +} + +static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) +{ + unsigned int i; + + for (i = 0; i+4 <= size; i += 4) { + int profile; + + profile = profiles[i] << 8 | profiles[i+1]; + switch (profile) { + case 0x03: + case 0x04: + case 0x05: + info(udev, "profile 0x%02x mo\n", profile); + cd_mo = 1; + break; + case 0x08: + info(udev, "profile 0x%02x cd_rom\n", profile); + cd_cd_rom = 1; + break; + case 0x09: + info(udev, "profile 0x%02x cd_r\n", profile); + cd_cd_r = 1; + break; + case 0x0A: + info(udev, "profile 0x%02x cd_rw\n", profile); + cd_cd_rw = 1; + break; + case 0x10: + info(udev, "profile 0x%02x dvd_rom\n", profile); + cd_dvd_rom = 1; + break; + case 0x12: + info(udev, "profile 0x%02x dvd_ram\n", profile); + cd_dvd_ram = 1; + break; + case 0x13: + case 0x14: + info(udev, "profile 0x%02x dvd_rw\n", profile); + cd_dvd_rw = 1; + break; + case 0x1B: + info(udev, "profile 0x%02x dvd_plus_r\n", profile); + cd_dvd_plus_r = 1; + break; + case 0x1A: + info(udev, "profile 0x%02x dvd_plus_rw\n", profile); + cd_dvd_plus_rw = 1; + break; + case 0x2A: + info(udev, "profile 0x%02x dvd_plus_rw_dl\n", profile); + cd_dvd_plus_rw_dl = 1; + break; + case 0x2B: + info(udev, "profile 0x%02x dvd_plus_r_dl\n", profile); + cd_dvd_plus_r_dl = 1; + break; + case 0x40: + cd_bd = 1; + info(udev, "profile 0x%02x bd\n", profile); + break; + case 0x41: + case 0x42: + cd_bd_r = 1; + info(udev, "profile 0x%02x bd_r\n", profile); + break; + case 0x43: + cd_bd_re = 1; + info(udev, "profile 0x%02x bd_re\n", profile); + break; + case 0x50: + cd_hddvd = 1; + info(udev, "profile 0x%02x hddvd\n", profile); + break; + case 0x51: + cd_hddvd_r = 1; + info(udev, "profile 0x%02x hddvd_r\n", profile); + break; + case 0x52: + cd_hddvd_rw = 1; + info(udev, "profile 0x%02x hddvd_rw\n", profile); + break; + default: + info(udev, "profile 0x%02x \n", profile); + break; + } + } + return 0; +} + +/* returns 0 if media was detected */ +static int cd_profiles_old_mmc(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + int err; + + unsigned char header[32]; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); + if (cd_media == 1) { + info(udev, "no current profile, but disc is present; assuming CD-ROM\n"); + cd_media_cd_rom = 1; + return 0; + } else { + info(udev, "no current profile, assuming no media\n"); + return -1; + } + }; + + cd_media = 1; + + if (header[2] & 16) { + cd_media_cd_rw = 1; + info(udev, "profile 0x0a media_cd_rw\n"); + } else if ((header[2] & 3) < 2 && cd_cd_r) { + cd_media_cd_r = 1; + info(udev, "profile 0x09 media_cd_r\n"); + } else { + cd_media_cd_rom = 1; + info(udev, "profile 0x08 media_cd_rom\n"); + } + return 0; +} + +/* returns 0 if media was detected */ +static int cd_profiles(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char features[65530]; + unsigned int cur_profile = 0; + unsigned int len; + unsigned int i; + int err; + int ret; + + ret = -1; + + /* First query the current profile */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 8, 8); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, features, 8); + if ((err != 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ + if (SK(err) == 0x5 && ASC(err) == 0x20) { + info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n"); + info(udev, "trying to work around the problem\n"); + ret = cd_profiles_old_mmc(udev, fd); + } + goto out; + } + + cur_profile = features[6] << 8 | features[7]; + if (cur_profile > 0) { + info(udev, "current profile 0x%02x\n", cur_profile); + feature_profile_media (udev, cur_profile); + ret = 0; /* we have media */ + } else { + info(udev, "no current profile, assuming no media\n"); + } + + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; + info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); + len = sizeof(features); + } else if (len <= 8) { + len = sizeof(features); + } + + /* Now get the full feature buffer */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff); + scsi_cmd_set(udev, &sc, 8, len & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, features, len); + if ((err != 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + return -1; + } + + /* parse the length once more, in case the drive decided to have other features suddenly :) */ + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; + info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); + len = sizeof(features); + } + + /* device features */ + for (i = 8; i+4 < len; i += (4 + features[i+3])) { + unsigned int feature; + + feature = features[i] << 8 | features[i+1]; + + switch (feature) { + case 0x00: + info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); + feature_profiles(udev, &features[i]+4, features[i+3]); + break; + default: + info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); + break; + } + } +out: + return ret; +} + +static int cd_media_info(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char header[32]; + static const char *media_status[] = { + "blank", + "appendable", + "complete", + "other" + }; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); + return -1; + }; + + cd_media = 1; + info(udev, "disk type %02x\n", header[8]); + info(udev, "hardware reported media status: %s\n", media_status[header[2] & 3]); + + /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ + if (!cd_media_cd_rom) + cd_media_state = media_status[header[2] & 3]; + + /* fresh DVD-RW in restricted overwite mode reports itself as + * "appendable"; change it to "blank" to make it consistent with what + * gets reported after blanking, and what userspace expects */ + if (cd_media_dvd_rw_ro && (header[2] & 3) == 1) + cd_media_state = media_status[0]; + + /* DVD+RW discs (and DVD-RW in restricted mode) once formatted are + * always "complete", DVD-RAM are "other" or "complete" if the disc is + * write protected; we need to check the contents if it is blank */ + if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { + unsigned char buffer[32 * 2048]; + unsigned char result, len; + int block, offset; + + if (cd_media_dvd_ram) { + /* a write protected dvd-ram may report "complete" status */ + + unsigned char dvdstruct[8]; + unsigned char format[12]; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0xAD); + scsi_cmd_set(udev, &sc, 7, 0xC0); + scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); + scsi_cmd_set(udev, &sc, 11, 0); + err = scsi_cmd_run(udev, &sc, fd, dvdstruct, sizeof(dvdstruct)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DVD STRUCTURE", err); + return -1; + } + if (dvdstruct[4] & 0x02) { + cd_media_state = media_status[2]; + info(udev, "write-protected DVD-RAM media inserted\n"); + goto determined; + } + + /* let's make sure we don't try to read unformatted media */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x23); + scsi_cmd_set(udev, &sc, 8, sizeof(format)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, format, sizeof(format)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DVD FORMAT CAPACITIES", err); + return -1; + } + + len = format[3]; + if (len & 7 || len < 16) { + info(udev, "invalid format capacities length\n"); + return -1; + } + + switch(format[8] & 3) { + case 1: + info(udev, "unformatted DVD-RAM media inserted\n"); + /* This means that last format was interrupted + * or failed, blank dvd-ram discs are factory + * formatted. Take no action here as it takes + * quite a while to reformat a dvd-ram and it's + * not automatically started */ + goto determined; + + case 2: + info(udev, "formatted DVD-RAM media inserted\n"); + break; + + case 3: + cd_media = 0; //return no media + info(udev, "format capacities returned no media\n"); + return -1; + } + } + + /* Take a closer look at formatted media (unformatted DVD+RW + * has "blank" status", DVD-RAM was examined earlier) and check + * for ISO and UDF PVDs or a fs superblock presence and do it + * in one ioctl (we need just sectors 0 and 16) */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x28); + scsi_cmd_set(udev, &sc, 5, 0); + scsi_cmd_set(udev, &sc, 8, 32); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); + if ((err != 0)) { + cd_media = 0; + info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err); + return -1; + } + + /* if any non-zero data is found in sector 16 (iso and udf) or + * eventually 0 (fat32 boot sector, ext2 superblock, etc), disc + * is assumed non-blank */ + result = 0; + + for (block = 32768; block >= 0 && !result; block -= 32768) { + offset = block; + while (offset < (block + 2048) && !result) { + result = buffer [offset]; + offset++; + } + } + + if (!result) { + cd_media_state = media_status[0]; + info(udev, "no data in blocks 0 or 16, assuming blank\n"); + } else { + info(udev, "data in blocks 0 or 16, assuming complete\n"); + } + } + +determined: + /* "other" is e. g. DVD-RAM, can't append sessions there; DVDs in + * restricted overwrite mode can never append, only in sequential mode */ + if ((header[2] & 3) < 2 && !cd_media_dvd_rw_ro) + cd_media_session_next = header[10] << 8 | header[5]; + cd_media_session_count = header[9] << 8 | header[4]; + cd_media_track_count = header[11] << 8 | header[6]; + + return 0; +} + +static int cd_media_toc(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char header[12]; + unsigned char toc[65536]; + unsigned int len, i, num_tracks; + unsigned char *p; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, 1); + scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC", err); + return -1; + } + + len = (header[0] << 8 | header[1]) + 2; + info(udev, "READ TOC: len: %d, start track: %d, end track: %d\n", len, header[2], header[3]); + if (len > sizeof(toc)) + return -1; + if (len < 2) + return -1; + /* 2: first track, 3: last track */ + num_tracks = header[3] - header[2] + 1; + + /* empty media has no tracks */ + if (len < 8) + return 0; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ + scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); + scsi_cmd_set(udev, &sc, 8, len & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, toc, len); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC (tracks)", err); + return -1; + } + + /* Take care to not iterate beyond the last valid track as specified in + * the TOC, but also avoid going beyond the TOC length, just in case + * the last track number is invalidly large */ + for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) { + unsigned int block; + unsigned int is_data_track; + + is_data_track = (p[1] & 0x04) != 0; + + block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; + info(udev, "track=%u info=0x%x(%s) start_block=%u\n", + p[2], p[1] & 0x0f, is_data_track ? "data":"audio", block); + + if (is_data_track) + cd_media_track_count_data++; + else + cd_media_track_count_audio++; + } + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC (multi session)", err); + return -1; + } + len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; + info(udev, "last track %u starts at block %u\n", header[4+2], len); + cd_media_session_last_offset = (unsigned long long int)len * 2048; + return 0; +} + +int main(int argc, char *argv[]) +{ + struct udev *udev; + static const struct option options[] = { + { "lock-media", no_argument, NULL, 'l' }, + { "unlock-media", no_argument, NULL, 'u' }, + { "eject-media", no_argument, NULL, 'e' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + bool eject = false; + bool lock = false; + bool unlock = false; + const char *node = NULL; + int fd = -1; + int cnt; + int rc = 0; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("cdrom_id"); + udev_set_log_fn(udev, log_fn); + + while (1) { + int option; + + option = getopt_long(argc, argv, "deluh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'l': + lock = true; + break; + case 'u': + unlock = true; + break; + case 'e': + eject = true; + break; + case 'd': + debug = true; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + printf("Usage: cdrom_id [options] \n" + " --lock-media lock the media (to enable eject request events)\n" + " --unlock-media unlock the media\n" + " --eject-media eject the media\n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); + goto exit; + default: + rc = 1; + goto exit; + } + } + + node = argv[optind]; + if (!node) { + err(udev, "no device\n"); + fprintf(stderr, "no device\n"); + rc = 1; + goto exit; + } + + srand((unsigned int)getpid()); + for (cnt = 20; cnt > 0; cnt--) { + struct timespec duration; + + fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); + if (fd >= 0 || errno != EBUSY) + break; + duration.tv_sec = 0; + duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); + nanosleep(&duration, NULL); + } + if (fd < 0) { + info(udev, "unable to open '%s'\n", node); + fprintf(stderr, "unable to open '%s'\n", node); + rc = 1; + goto exit; + } + info(udev, "probing: '%s'\n", node); + + /* same data as original cdrom_id */ + if (cd_capability_compat(udev, fd) < 0) { + rc = 1; + goto exit; + } + + /* check for media - don't bail if there's no media as we still need to + * to read profiles */ + cd_media_compat(udev, fd); + + /* check if drive talks MMC */ + if (cd_inquiry(udev, fd) < 0) + goto work; + + /* read drive and possibly current profile */ + if (cd_profiles(udev, fd) != 0) + goto work; + + /* at this point we are guaranteed to have media in the drive - find out more about it */ + + /* get session/track info */ + cd_media_toc(udev, fd); + + /* get writable media state */ + cd_media_info(udev, fd); + +work: + /* lock the media, so we enable eject button events */ + if (lock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (lock)\n"); + media_lock(udev, fd, true); + } + + if (unlock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + } + + if (eject) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + info(udev, "START_STOP_UNIT (eject)\n"); + media_eject(udev, fd); + } + + printf("ID_CDROM=1\n"); + if (cd_cd_rom) + printf("ID_CDROM_CD=1\n"); + if (cd_cd_r) + printf("ID_CDROM_CD_R=1\n"); + if (cd_cd_rw) + printf("ID_CDROM_CD_RW=1\n"); + if (cd_dvd_rom) + printf("ID_CDROM_DVD=1\n"); + if (cd_dvd_r) + printf("ID_CDROM_DVD_R=1\n"); + if (cd_dvd_rw) + printf("ID_CDROM_DVD_RW=1\n"); + if (cd_dvd_ram) + printf("ID_CDROM_DVD_RAM=1\n"); + if (cd_dvd_plus_r) + printf("ID_CDROM_DVD_PLUS_R=1\n"); + if (cd_dvd_plus_rw) + printf("ID_CDROM_DVD_PLUS_RW=1\n"); + if (cd_dvd_plus_r_dl) + printf("ID_CDROM_DVD_PLUS_R_DL=1\n"); + if (cd_dvd_plus_rw_dl) + printf("ID_CDROM_DVD_PLUS_RW_DL=1\n"); + if (cd_bd) + printf("ID_CDROM_BD=1\n"); + if (cd_bd_r) + printf("ID_CDROM_BD_R=1\n"); + if (cd_bd_re) + printf("ID_CDROM_BD_RE=1\n"); + if (cd_hddvd) + printf("ID_CDROM_HDDVD=1\n"); + if (cd_hddvd_r) + printf("ID_CDROM_HDDVD_R=1\n"); + if (cd_hddvd_rw) + printf("ID_CDROM_HDDVD_RW=1\n"); + if (cd_mo) + printf("ID_CDROM_MO=1\n"); + if (cd_mrw) + printf("ID_CDROM_MRW=1\n"); + if (cd_mrw_w) + printf("ID_CDROM_MRW_W=1\n"); + + if (cd_media) + printf("ID_CDROM_MEDIA=1\n"); + if (cd_media_mo) + printf("ID_CDROM_MEDIA_MO=1\n"); + if (cd_media_mrw) + printf("ID_CDROM_MEDIA_MRW=1\n"); + if (cd_media_mrw_w) + printf("ID_CDROM_MEDIA_MRW_W=1\n"); + if (cd_media_cd_rom) + printf("ID_CDROM_MEDIA_CD=1\n"); + if (cd_media_cd_r) + printf("ID_CDROM_MEDIA_CD_R=1\n"); + if (cd_media_cd_rw) + printf("ID_CDROM_MEDIA_CD_RW=1\n"); + if (cd_media_dvd_rom) + printf("ID_CDROM_MEDIA_DVD=1\n"); + if (cd_media_dvd_r) + printf("ID_CDROM_MEDIA_DVD_R=1\n"); + if (cd_media_dvd_ram) + printf("ID_CDROM_MEDIA_DVD_RAM=1\n"); + if (cd_media_dvd_rw) + printf("ID_CDROM_MEDIA_DVD_RW=1\n"); + if (cd_media_dvd_plus_r) + printf("ID_CDROM_MEDIA_DVD_PLUS_R=1\n"); + if (cd_media_dvd_plus_rw) + printf("ID_CDROM_MEDIA_DVD_PLUS_RW=1\n"); + if (cd_media_dvd_plus_rw_dl) + printf("ID_CDROM_MEDIA_DVD_PLUS_RW_DL=1\n"); + if (cd_media_dvd_plus_r_dl) + printf("ID_CDROM_MEDIA_DVD_PLUS_R_DL=1\n"); + if (cd_media_bd) + printf("ID_CDROM_MEDIA_BD=1\n"); + if (cd_media_bd_r) + printf("ID_CDROM_MEDIA_BD_R=1\n"); + if (cd_media_bd_re) + printf("ID_CDROM_MEDIA_BD_RE=1\n"); + if (cd_media_hddvd) + printf("ID_CDROM_MEDIA_HDDVD=1\n"); + if (cd_media_hddvd_r) + printf("ID_CDROM_MEDIA_HDDVD_R=1\n"); + if (cd_media_hddvd_rw) + printf("ID_CDROM_MEDIA_HDDVD_RW=1\n"); + + if (cd_media_state != NULL) + printf("ID_CDROM_MEDIA_STATE=%s\n", cd_media_state); + if (cd_media_session_next > 0) + printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); + if (cd_media_session_count > 0) + printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); + if (cd_media_session_count > 1 && cd_media_session_last_offset > 0) + printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); + if (cd_media_track_count > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); + if (cd_media_track_count_audio > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); + if (cd_media_track_count_data > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); +exit: + if (fd >= 0) + close(fd); + udev_unref(udev); + udev_log_close(); + return rc; +} diff --git a/src/extras/collect/.gitignore b/src/extras/collect/.gitignore new file mode 100644 index 0000000000..c30ad6527c --- /dev/null +++ b/src/extras/collect/.gitignore @@ -0,0 +1 @@ +collect diff --git a/src/extras/collect/collect.c b/src/extras/collect/collect.c new file mode 100644 index 0000000000..f78f3b778e --- /dev/null +++ b/src/extras/collect/collect.c @@ -0,0 +1,473 @@ +/* + * Collect variables across events. + * + * usage: collect [--add|--remove] + * + * Adds ID to the list governed by . + * must be part of the ID list . + * If all IDs given by are listed (ie collect has been + * invoked for each ID in ) collect returns 0, the + * number of missing IDs otherwise. + * A negative number is returned on error. + * + * Copyright(C) 2007, Hannes Reinecke + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +#define BUFSIZE 16 +#define UDEV_ALARM_TIMEOUT 180 + +enum collect_state { + STATE_NONE, + STATE_OLD, + STATE_CONFIRMED, +}; + +struct _mate { + struct udev_list_node node; + char *name; + enum collect_state state; +}; + +static struct udev_list_node bunch; +static int debug; + +/* This can increase dynamically */ +static size_t bufsize = BUFSIZE; + +static struct _mate *node_to_mate(struct udev_list_node *node) +{ + char *mate; + + mate = (char *)node; + mate -= offsetof(struct _mate, node); + return (struct _mate *)mate; +} + +static void sig_alrm(int signo) +{ + exit(4); +} + +static void usage(void) +{ + printf("usage: collect [--add|--remove] [--debug] \n" + "\n" + " Adds ID to the list governed by .\n" + " must be part of the list .\n" + " If all IDs given by are listed (ie collect has been\n" + " invoked for each ID in ) collect returns 0, the\n" + " number of missing IDs otherwise.\n" + " On error a negative number is returned.\n" + "\n"); +} + +/* + * prepare + * + * Prepares the database file + */ +static int prepare(char *dir, char *filename) +{ + struct stat statbuf; + char buf[512]; + int fd; + + if (stat(dir, &statbuf) < 0) + mkdir(dir, 0700); + + sprintf(buf, "%s/%s", dir, filename); + + fd = open(buf,O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); + if (fd < 0) + fprintf(stderr, "Cannot open %s: %s\n", buf, strerror(errno)); + + if (lockf(fd,F_TLOCK,0) < 0) { + if (debug) + fprintf(stderr, "Lock taken, wait for %d seconds\n", UDEV_ALARM_TIMEOUT); + if (errno == EAGAIN || errno == EACCES) { + alarm(UDEV_ALARM_TIMEOUT); + lockf(fd, F_LOCK, 0); + if (debug) + fprintf(stderr, "Acquired lock on %s\n", buf); + } else { + if (debug) + fprintf(stderr, "Could not get lock on %s: %s\n", buf, strerror(errno)); + } + } + + return fd; +} + +/* + * Read checkpoint file + * + * Tricky reading this. We allocate a buffer twice as large + * as we're going to read. Then we read into the upper half + * of that buffer and start parsing. + * Once we do _not_ find end-of-work terminator (whitespace + * character) we move the upper half to the lower half, + * adjust the read pointer and read the next bit. + * Quite clever methinks :-) + * I should become a programmer ... + * + * Yes, one could have used fgets() for this. But then we'd + * have to use freopen etc which I found quite tedious. + */ +static int checkout(int fd) +{ + int len; + char *buf, *ptr, *word = NULL; + struct _mate *him; + + restart: + len = bufsize >> 1; + buf = calloc(1,bufsize + 1); + if (!buf) { + fprintf(stderr, "Out of memory\n"); + return -1; + } + memset(buf, ' ', bufsize); + ptr = buf + len; + while ((read(fd, buf + len, len)) > 0) { + while (ptr && *ptr) { + word = ptr; + ptr = strpbrk(word," \n\t\r"); + if (!ptr && word < (buf + len)) { + bufsize = bufsize << 1; + if (debug) + fprintf(stderr, "ID overflow, restarting with size %zi\n", bufsize); + free(buf); + lseek(fd, 0, SEEK_SET); + goto restart; + } + if (ptr) { + *ptr = '\0'; + ptr++; + if (!strlen(word)) + continue; + + if (debug) + fprintf(stderr, "Found word %s\n", word); + him = malloc(sizeof (struct _mate)); + him->name = strdup(word); + him->state = STATE_OLD; + udev_list_node_append(&him->node, &bunch); + word = NULL; + } + } + memcpy(buf, buf + len, len); + memset(buf + len, ' ', len); + + if (!ptr) + ptr = word; + if (!ptr) + break; + ptr -= len; + } + + free(buf); + return 0; +} + +/* + * invite + * + * Adds a new ID 'us' to the internal list, + * marks it as confirmed. + */ +static void invite(char *us) +{ + struct udev_list_node *him_node; + struct _mate *who = NULL; + + if (debug) + fprintf(stderr, "Adding ID '%s'\n", us); + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (!strcmp(him->name, us)) { + him->state = STATE_CONFIRMED; + who = him; + } + } + if (debug && !who) + fprintf(stderr, "ID '%s' not in database\n", us); + +} + +/* + * reject + * + * Marks the ID 'us' as invalid, + * causing it to be removed when the + * list is written out. + */ +static void reject(char *us) +{ + struct udev_list_node *him_node; + struct _mate *who = NULL; + + if (debug) + fprintf(stderr, "Removing ID '%s'\n", us); + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (!strcmp(him->name, us)) { + him->state = STATE_NONE; + who = him; + } + } + if (debug && !who) + fprintf(stderr, "ID '%s' not in database\n", us); +} + +/* + * kickout + * + * Remove all IDs in the internal list which are not part + * of the list passed via the commandline. + */ +static void kickout(void) +{ + struct udev_list_node *him_node; + struct udev_list_node *tmp; + + udev_list_node_foreach_safe(him_node, tmp, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (him->state == STATE_OLD) { + udev_list_node_remove(&him->node); + free(him->name); + free(him); + } + } +} + +/* + * missing + * + * Counts all missing IDs in the internal list. + */ +static int missing(int fd) +{ + char *buf; + int ret = 0; + struct udev_list_node *him_node; + + buf = malloc(bufsize); + if (!buf) + return -1; + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (him->state == STATE_NONE) { + ret++; + } else { + while (strlen(him->name)+1 >= bufsize) { + char *tmpbuf; + + bufsize = bufsize << 1; + tmpbuf = realloc(buf, bufsize); + if (!tmpbuf) { + free(buf); + return -1; + } + buf = tmpbuf; + } + snprintf(buf, strlen(him->name)+2, "%s ", him->name); + write(fd, buf, strlen(buf)); + } + } + + free(buf); + return ret; +} + +/* + * everybody + * + * Prints out the status of the internal list. + */ +static void everybody(void) +{ + struct udev_list_node *him_node; + const char *state = ""; + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + switch (him->state) { + case STATE_NONE: + state = "none"; + break; + case STATE_OLD: + state = "old"; + break; + case STATE_CONFIRMED: + state = "confirmed"; + break; + } + fprintf(stderr, "ID: %s=%s\n", him->name, state); + } +} + +int main(int argc, char **argv) +{ + struct udev *udev; + static const struct option options[] = { + { "add", no_argument, NULL, 'a' }, + { "remove", no_argument, NULL, 'r' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + int argi; + char *checkpoint, *us; + int fd; + int i; + int ret = EXIT_SUCCESS; + int prune = 0; + char tmpdir[UTIL_PATH_SIZE]; + + udev = udev_new(); + if (udev == NULL) { + ret = EXIT_FAILURE; + goto exit; + } + + while (1) { + int option; + + option = getopt_long(argc, argv, "ardh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'a': + prune = 0; + break; + case 'r': + prune = 1; + break; + case 'd': + debug = 1; + break; + case 'h': + usage(); + goto exit; + default: + ret = 1; + goto exit; + } + } + + argi = optind; + if (argi + 2 > argc) { + printf("Missing parameter(s)\n"); + ret = 1; + goto exit; + } + checkpoint = argv[argi++]; + us = argv[argi++]; + + if (signal(SIGALRM, sig_alrm) == SIG_ERR) { + fprintf(stderr, "Cannot set SIGALRM: %s\n", strerror(errno)); + ret = 2; + goto exit; + } + + udev_list_node_init(&bunch); + + if (debug) + fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); + + util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL); + fd = prepare(tmpdir, checkpoint); + if (fd < 0) { + ret = 3; + goto out; + } + + if (checkout(fd) < 0) { + ret = 2; + goto out; + } + + for (i = argi; i < argc; i++) { + struct udev_list_node *him_node; + struct _mate *who; + + who = NULL; + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (!strcmp(him->name, argv[i])) + who = him; + } + if (!who) { + struct _mate *him; + + if (debug) + fprintf(stderr, "ID %s: not in database\n", argv[i]); + him = malloc(sizeof (struct _mate)); + him->name = malloc(strlen(argv[i]) + 1); + strcpy(him->name, argv[i]); + him->state = STATE_NONE; + udev_list_node_append(&him->node, &bunch); + } else { + if (debug) + fprintf(stderr, "ID %s: found in database\n", argv[i]); + who->state = STATE_CONFIRMED; + } + } + + if (prune) + reject(us); + else + invite(us); + + if (debug) { + everybody(); + fprintf(stderr, "Prune lists\n"); + } + kickout(); + + lseek(fd, 0, SEEK_SET); + ftruncate(fd, 0); + ret = missing(fd); + + lockf(fd, F_ULOCK, 0); + close(fd); +out: + if (debug) + everybody(); + if (ret >= 0) + printf("COLLECT_%s=%d\n", checkpoint, ret); +exit: + udev_unref(udev); + return ret; +} diff --git a/src/extras/edd_id/.gitignore b/src/extras/edd_id/.gitignore new file mode 100644 index 0000000000..14fb67c634 --- /dev/null +++ b/src/extras/edd_id/.gitignore @@ -0,0 +1 @@ +edd_id diff --git a/src/extras/edd_id/61-persistent-storage-edd.rules b/src/extras/edd_id/61-persistent-storage-edd.rules new file mode 100644 index 0000000000..6b4fb8ecfe --- /dev/null +++ b/src/extras/edd_id/61-persistent-storage-edd.rules @@ -0,0 +1,12 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="persistent_storage_edd_end" +SUBSYSTEM!="block", GOTO="persistent_storage_edd_end" +KERNEL!="sd*|hd*|cciss*", GOTO="persistent_storage_edd_end" + +# BIOS Enhanced Disk Device +ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $devnode" +ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +LABEL="persistent_storage_edd_end" diff --git a/src/extras/edd_id/edd_id.c b/src/extras/edd_id/edd_id.c new file mode 100644 index 0000000000..ac4da07611 --- /dev/null +++ b/src/extras/edd_id/edd_id.c @@ -0,0 +1,196 @@ +/* + * edd_id - naming of BIOS disk devices via EDD + * + * Copyright (C) 2005 John Hull + * Copyright (C) 2005 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + vsyslog(priority, format, args); +} + +int main(int argc, char *argv[]) +{ + struct udev *udev; + const char *node = NULL; + int i; + int export = 0; + uint32_t disk_id; + uint16_t mbr_valid; + struct dirent *dent; + int disk_fd; + int sysfs_fd; + DIR *dir = NULL; + int rc = 1; + char filename[UTIL_PATH_SIZE]; + char match[UTIL_PATH_SIZE]; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("edd_id"); + udev_set_log_fn(udev, log_fn); + + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--export") == 0) { + export = 1; + } else + node = arg; + } + if (node == NULL) { + err(udev, "no node specified\n"); + fprintf(stderr, "no node specified\n"); + goto exit; + } + + /* check for kernel support */ + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/firmware/edd", NULL); + dir = opendir(filename); + if (dir == NULL) { + info(udev, "no kernel EDD support\n"); + fprintf(stderr, "no kernel EDD support\n"); + rc = 2; + goto exit; + } + + disk_fd = open(node, O_RDONLY); + if (disk_fd < 0) { + info(udev, "unable to open '%s'\n", node); + fprintf(stderr, "unable to open '%s'\n", node); + rc = 3; + goto closedir; + } + + /* check for valid MBR signature */ + if (lseek(disk_fd, 510, SEEK_SET) < 0) { + info(udev, "seek to MBR validity failed '%s'\n", node); + rc = 4; + goto close; + } + if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { + info(udev, "read MBR validity failed '%s'\n", node); + rc = 5; + goto close; + } + if (mbr_valid != 0xAA55) { + fprintf(stderr, "no valid MBR signature '%s'\n", node); + info(udev, "no valid MBR signature '%s'\n", node); + rc=6; + goto close; + } + + /* read EDD signature */ + if (lseek(disk_fd, 440, SEEK_SET) < 0) { + info(udev, "seek to signature failed '%s'\n", node); + rc = 7; + goto close; + } + if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { + info(udev, "read signature failed '%s'\n", node); + rc = 8; + goto close; + } + /* all zero is invalid */ + info(udev, "read id 0x%08x from '%s'\n", disk_id, node); + if (disk_id == 0) { + fprintf(stderr, "no EDD signature '%s'\n", node); + info(udev, "'%s' signature is zero\n", node); + rc = 9; + goto close; + } + + /* lookup signature in sysfs to determine the name */ + match[0] = '\0'; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char sysfs_id_buf[256]; + uint32_t sysfs_id; + ssize_t size; + + if (dent->d_name[0] == '.') + continue; + + util_strscpyl(filename, sizeof(filename), dent->d_name, "/mbr_signature", NULL); + sysfs_fd = openat(dirfd(dir), filename, O_RDONLY); + if (sysfs_fd < 0) { + info(udev, "unable to open sysfs '%s'\n", filename); + continue; + } + + size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); + close(sysfs_fd); + if (size <= 0) { + info(udev, "read sysfs '%s' failed\n", filename); + continue; + } + sysfs_id_buf[size] = '\0'; + info(udev, "read '%s' from '%s'\n", sysfs_id_buf, filename); + sysfs_id = strtoul(sysfs_id_buf, NULL, 16); + + /* look for matching value, that appears only once */ + if (disk_id == sysfs_id) { + if (match[0] == '\0') { + /* store id */ + util_strscpy(match, sizeof(match), dent->d_name); + } else { + /* error, same signature for another device */ + info(udev, "'%s' does not have a unique signature\n", node); + fprintf(stderr, "'%s' does not have a unique signature\n", node); + rc = 10; + goto exit; + } + } + } + + if (match[0] != '\0') { + if (export) + printf("ID_EDD=%s\n", match); + else + printf("%s\n", match); + rc = 0; + } + +close: + close(disk_fd); +closedir: + closedir(dir); +exit: + udev_unref(udev); + udev_log_close(); + return rc; +} diff --git a/src/extras/floppy/.gitignore b/src/extras/floppy/.gitignore new file mode 100644 index 0000000000..939f625a4a --- /dev/null +++ b/src/extras/floppy/.gitignore @@ -0,0 +1 @@ +create_floppy_devices diff --git a/src/extras/floppy/60-floppy.rules b/src/extras/floppy/60-floppy.rules new file mode 100644 index 0000000000..53e4a9e59a --- /dev/null +++ b/src/extras/floppy/60-floppy.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="block", KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", ENV{CMOS_TYPE}="$attr{cmos}", \ + RUN+="create_floppy_devices -c -t $env{CMOS_TYPE} -m %M -M 0660 -G floppy $root/%k" diff --git a/src/extras/floppy/create_floppy_devices.c b/src/extras/floppy/create_floppy_devices.c new file mode 100644 index 0000000000..47724f8b04 --- /dev/null +++ b/src/extras/floppy/create_floppy_devices.c @@ -0,0 +1,177 @@ +/* + * Create all possible floppy device based on the CMOS type. + * Based upon code from drivers/block/floppy.c + * + * Copyright(C) 2005, SUSE Linux Products GmbH + * + * Author: Hannes Reinecke + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static char *table[] = { + "", "d360", "h1200", "u360", "u720", "h360", "h720", + "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410", + "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743", + "h880", "u1040", "u1120", "h1600", "u1760", "u1920", + "u3200", "u3520", "u3840", "u1840", "u800", "u1600", + NULL +}; + +static int t360[] = { 1, 0 }; +static int t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 }; +static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, 17, 21, 22, 30, 0 }; +static int *table_sup[] = { NULL, t360, t1200, t3in+5+8, t3in+5, t3in, t3in }; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + vsyslog(priority, format, args); +} + +int main(int argc, char **argv) +{ + struct udev *udev; + char *dev; + char *devname; + char node[64]; + int type = 0, i, fdnum, c; + int major = 2, minor; + uid_t uid = 0; + gid_t gid = 0; + mode_t mode = 0660; + int create_nodes = 0; + int print_nodes = 0; + int is_err = 0; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("create_floppy_devices"); + udev_set_log_fn(udev, log_fn); + udev_selinux_init(udev); + + while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { + switch (c) { + case 'c': + create_nodes = 1; + break; + case 'd': + print_nodes = 1; + break; + case 'U': + uid = util_lookup_user(udev, optarg); + break; + case 'G': + gid = util_lookup_group(udev, optarg); + break; + case 'M': + mode = strtol(optarg, NULL, 0); + mode = mode & 0666; + break; + case 'm': + major = strtol(optarg, NULL, 0); + break; + case 't': + type = strtol(optarg, NULL, 0); + break; + default: + is_err++; + break; + } + } + + if (is_err || optind >= argc) { + printf("Usage: %s [OPTION] device\n" + " -c create\n" + " -d debug\n" + " -m Major number\n" + " -t floppy type number\n" + " -U device node user ownership\n" + " -G device node group owner\n" + " -M device node mode\n" + "\n", argv[0]); + return 1; + } + + dev = argv[optind]; + devname = strrchr(dev, '/'); + if (devname != NULL) + devname = &devname[1]; + else + devname = dev; + if (strncmp(devname, "fd", 2) != 0) { + fprintf(stderr,"Device '%s' is not a floppy device\n", dev); + return 1; + } + + fdnum = strtol(&devname[2], NULL, 10); + if (fdnum < 0 || fdnum > 7) { + fprintf(stderr,"Floppy device number %d out of range (0-7)\n", fdnum); + return 1; + } + if (fdnum > 3) + fdnum += 124; + + if (major < 1) { + fprintf(stderr,"Invalid major number %d\n", major); + return 1; + } + + if (type < 0 || type >= (int) ARRAY_SIZE(table_sup)) { + fprintf(stderr,"Invalid CMOS type %d\n", type); + return 1; + } + + if (type == 0) + return 0; + + i = 0; + while (table_sup[type][i]) { + sprintf(node, "%s%s", dev, table[table_sup[type][i]]); + minor = (table_sup[type][i] << 2) + fdnum; + if (print_nodes) + printf("%s b %.4o %d %d\n", node, mode, major, minor); + if (create_nodes) { + unlink(node); + udev_selinux_setfscreatecon(udev, node, S_IFBLK | mode); + mknod(node, S_IFBLK | mode, makedev(major,minor)); + udev_selinux_resetfscreatecon(udev); + chown(node, uid, gid); + chmod(node, S_IFBLK | mode); + } + i++; + } + + udev_selinux_exit(udev); + udev_unref(udev); + udev_log_close(); +exit: + return 0; +} diff --git a/src/extras/gudev/.gitignore b/src/extras/gudev/.gitignore new file mode 100644 index 0000000000..d20fa523e4 --- /dev/null +++ b/src/extras/gudev/.gitignore @@ -0,0 +1,9 @@ +gtk-doc.make +docs/version.xml +gudev-1.0.pc +gudevenumtypes.c +gudevenumtypes.h +gudevmarshal.c +gudevmarshal.h +GUdev-1.0.gir +GUdev-1.0.typelib diff --git a/src/extras/gudev/COPYING b/src/extras/gudev/COPYING new file mode 100644 index 0000000000..47044a8c58 --- /dev/null +++ b/src/extras/gudev/COPYING @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/src/extras/gudev/docs/.gitignore b/src/extras/gudev/docs/.gitignore new file mode 100644 index 0000000000..8eada6d409 --- /dev/null +++ b/src/extras/gudev/docs/.gitignore @@ -0,0 +1,16 @@ +gudev-overrides.txt +gudev-decl-list.txt +gudev-decl.txt +gudev-undeclared.txt +gudev-undocumented.txt +gudev-unused.txt +gudev.args +gudev.hierarchy +gudev.interfaces +gudev.prerequisites +gudev.signals +html.stamp +html/* +xml/* +tmpl/* +*.stamp diff --git a/src/extras/gudev/docs/Makefile.am b/src/extras/gudev/docs/Makefile.am new file mode 100644 index 0000000000..d03fc65127 --- /dev/null +++ b/src/extras/gudev/docs/Makefile.am @@ -0,0 +1,106 @@ +## Process this file with automake to produce Makefile.in + +# We require automake 1.10 at least. +AUTOMAKE_OPTIONS = 1.10 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=gudev + +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=2 + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=.. + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS= + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS= + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=g_udev + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-mkhtml +MKHTML_OPTIONS=--path=$(abs_srcdir) --path=$(abs_builddir) + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS= + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=$(top_srcdir)/src/extras/gudev/*.h +CFILE_GLOB=$(top_srcdir)/src/extras/gudev/*.c + +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h +EXTRA_HFILES= + +# Header files to ignore when scanning. Use base file name, no paths +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES= + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES= + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = version.xml + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files= + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +GTKDOC_CFLAGS = \ + $(DBUS_GLIB_CFLAGS) \ + $(GLIB_CFLAGS) \ + -I$(top_srcdir)/src/extras/gudev \ + -I$(top_builddir)/src/extras/gudev + +GTKDOC_LIBS = \ + $(GLIB_LIBS) \ + $(top_builddir)/src/extras/gudev/libgudev-1.0.la + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +include $(top_srcdir)/gtk-doc.make + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +EXTRA_DIST += version.xml.in + +# Files not to distribute +# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types +# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt +#DISTCLEANFILES += + +# Comment this out if you want your docs-status tested during 'make check' +if ENABLE_GTK_DOC +#TESTS_ENVIRONMENT = cd $(srcsrc) +#TESTS = $(GTKDOC_CHECK) +endif diff --git a/src/extras/gudev/docs/gudev-docs.xml b/src/extras/gudev/docs/gudev-docs.xml new file mode 100644 index 0000000000..65fdfff8e5 --- /dev/null +++ b/src/extras/gudev/docs/gudev-docs.xml @@ -0,0 +1,93 @@ + + +]> + + + GUDev Reference Manual + For GUdev version &version; + + + David + Zeuthen + +
            + davidz@redhat.com +
            +
            +
            + + Bastien + Nocera + +
            + hadess@hadess.net +
            +
            +
            +
            + + + 2011 + The GUDev Authors + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
            + The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
            +
            + + + Many of the names used by companies to distinguish their + products and services are claimed as trademarks. Where those + names appear in any freedesktop.org documentation, and those + trademarks are made aware to the members of the + freedesktop.org Project, the names have been printed in caps + or initial caps. + +
            +
            + + + API Reference + + + This part presents the class and function reference for the + libgudev library. + + + + + + + + + Object Hierarchy + + + + Index + + + Index of new symbols in 165 + + + +
            diff --git a/src/extras/gudev/docs/gudev-sections.txt b/src/extras/gudev/docs/gudev-sections.txt new file mode 100644 index 0000000000..213e1a7465 --- /dev/null +++ b/src/extras/gudev/docs/gudev-sections.txt @@ -0,0 +1,113 @@ +
            +gudevclient +GUdevClient +GUdevClient +GUdevClientClass +GUdevDeviceType +GUdevDeviceNumber +g_udev_client_new +g_udev_client_query_by_subsystem +g_udev_client_query_by_device_number +g_udev_client_query_by_device_file +g_udev_client_query_by_sysfs_path +g_udev_client_query_by_subsystem_and_name + +G_UDEV_CLIENT +G_UDEV_IS_CLIENT +G_UDEV_TYPE_CLIENT +g_udev_client_get_type +G_UDEV_CLIENT_CLASS +G_UDEV_IS_CLIENT_CLASS +G_UDEV_CLIENT_GET_CLASS + +GUdevClientPrivate +
            + +
            +gudevdevice +GUdevDevice +GUdevDevice +GUdevDeviceClass +g_udev_device_get_subsystem +g_udev_device_get_devtype +g_udev_device_get_name +g_udev_device_get_number +g_udev_device_get_sysfs_path +g_udev_device_get_driver +g_udev_device_get_action +g_udev_device_get_seqnum +g_udev_device_get_device_type +g_udev_device_get_device_number +g_udev_device_get_device_file +g_udev_device_get_device_file_symlinks +g_udev_device_get_parent +g_udev_device_get_parent_with_subsystem +g_udev_device_get_tags +g_udev_device_get_is_initialized +g_udev_device_get_usec_since_initialized +g_udev_device_get_property_keys +g_udev_device_has_property +g_udev_device_get_property +g_udev_device_get_property_as_int +g_udev_device_get_property_as_uint64 +g_udev_device_get_property_as_double +g_udev_device_get_property_as_boolean +g_udev_device_get_property_as_strv +g_udev_device_get_sysfs_attr +g_udev_device_get_sysfs_attr_as_int +g_udev_device_get_sysfs_attr_as_uint64 +g_udev_device_get_sysfs_attr_as_double +g_udev_device_get_sysfs_attr_as_boolean +g_udev_device_get_sysfs_attr_as_strv + +G_UDEV_DEVICE +G_UDEV_IS_DEVICE +G_UDEV_TYPE_DEVICE +g_udev_device_get_type +G_UDEV_DEVICE_CLASS +G_UDEV_IS_DEVICE_CLASS +G_UDEV_DEVICE_GET_CLASS + +GUdevDevicePrivate +
            + +
            +gudevenumerator +GUdevEnumerator +GUdevEnumerator +GUdevEnumeratorClass +g_udev_enumerator_new +g_udev_enumerator_add_match_subsystem +g_udev_enumerator_add_nomatch_subsystem +g_udev_enumerator_add_match_sysfs_attr +g_udev_enumerator_add_nomatch_sysfs_attr +g_udev_enumerator_add_match_property +g_udev_enumerator_add_match_name +g_udev_enumerator_add_match_tag +g_udev_enumerator_add_match_is_initialized +g_udev_enumerator_add_sysfs_path +g_udev_enumerator_execute + +G_UDEV_ENUMERATOR +G_UDEV_IS_ENUMERATOR +G_UDEV_TYPE_ENUMERATOR +g_udev_enumerator_get_type +G_UDEV_ENUMERATOR_CLASS +G_UDEV_IS_ENUMERATOR_CLASS +G_UDEV_ENUMERATOR_GET_CLASS + +GUdevEnumeratorPrivate +
            + +
            +gudevmarshal + +g_udev_marshal_VOID__STRING_OBJECT +
            + +
            +gudevenumtypes + +G_TYPE_UDEV_DEVICE_TYPE +g_udev_device_type_get_type +
            diff --git a/src/extras/gudev/docs/gudev.types b/src/extras/gudev/docs/gudev.types new file mode 100644 index 0000000000..a89857a04d --- /dev/null +++ b/src/extras/gudev/docs/gudev.types @@ -0,0 +1,4 @@ +g_udev_device_type_get_type +g_udev_device_get_type +g_udev_client_get_type +g_udev_enumerator_get_type diff --git a/src/extras/gudev/docs/version.xml.in b/src/extras/gudev/docs/version.xml.in new file mode 100644 index 0000000000..d78bda9342 --- /dev/null +++ b/src/extras/gudev/docs/version.xml.in @@ -0,0 +1 @@ +@VERSION@ diff --git a/src/extras/gudev/gjs-example.js b/src/extras/gudev/gjs-example.js new file mode 100755 index 0000000000..5586fd6a61 --- /dev/null +++ b/src/extras/gudev/gjs-example.js @@ -0,0 +1,75 @@ +#!/usr/bin/env gjs-console + +// This currently depends on the following patches to gjs +// +// http://bugzilla.gnome.org/show_bug.cgi?id=584558 +// http://bugzilla.gnome.org/show_bug.cgi?id=584560 +// http://bugzilla.gnome.org/show_bug.cgi?id=584568 + +const GUdev = imports.gi.GUdev; +const Mainloop = imports.mainloop; + +function print_device (device) { + print (" subsystem: " + device.get_subsystem ()); + print (" devtype: " + device.get_devtype ()); + print (" name: " + device.get_name ()); + print (" number: " + device.get_number ()); + print (" sysfs_path: " + device.get_sysfs_path ()); + print (" driver: " + device.get_driver ()); + print (" action: " + device.get_action ()); + print (" seqnum: " + device.get_seqnum ()); + print (" device type: " + device.get_device_type ()); + print (" device number: " + device.get_device_number ()); + print (" device file: " + device.get_device_file ()); + print (" device file symlinks: " + device.get_device_file_symlinks ()); + print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); + var keys = device.get_property_keys (); + for (var n = 0; n < keys.length; n++) { + print (" " + keys[n] + "=" + device.get_property (keys[n])); + } +} + +function on_uevent (client, action, device) { + print ("action " + action + " on device " + device.get_sysfs_path()); + print_device (device); + print (""); +} + +var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); +client.connect ("uevent", on_uevent); + +var block_devices = client.query_by_subsystem ("block"); +for (var n = 0; n < block_devices.length; n++) { + print ("block device: " + block_devices[n].get_device_file ()); +} + +var d; + +d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); +if (d == null) { + print ("query_by_device_number 0x810 -> null"); +} else { + print ("query_by_device_number 0x810 -> " + d.get_device_file ()); + var dd = d.get_parent_with_subsystem ("usb", null); + print_device (dd); + print ("--------------------------------------------------------------------------"); + while (d != null) { + print_device (d); + print (""); + d = d.get_parent (); + } +} + +d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); +print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); + +d = client.query_by_subsystem_and_name ("block", "sda2"); +print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/sda"); +print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/block/8:0"); +print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); + +Mainloop.run('udev-example'); diff --git a/src/extras/gudev/gudev-1.0.pc.in b/src/extras/gudev/gudev-1.0.pc.in new file mode 100644 index 0000000000..058262d767 --- /dev/null +++ b/src/extras/gudev/gudev-1.0.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: gudev-1.0 +Description: GObject bindings for libudev +Version: @VERSION@ +Requires: glib-2.0, gobject-2.0 +Libs: -L${libdir} -lgudev-1.0 +Cflags: -I${includedir}/gudev-1.0 diff --git a/src/extras/gudev/gudev.h b/src/extras/gudev/gudev.h new file mode 100644 index 0000000000..a313460817 --- /dev/null +++ b/src/extras/gudev/gudev.h @@ -0,0 +1,33 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __G_UDEV_H__ +#define __G_UDEV_H__ + +#define _GUDEV_INSIDE_GUDEV_H 1 +#include +#include +#include +#include +#include +#include +#undef _GUDEV_INSIDE_GUDEV_H + +#endif /* __G_UDEV_H__ */ diff --git a/src/extras/gudev/gudevclient.c b/src/extras/gudev/gudevclient.c new file mode 100644 index 0000000000..a6465ad943 --- /dev/null +++ b/src/extras/gudev/gudevclient.c @@ -0,0 +1,527 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008-2010 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "gudevclient.h" +#include "gudevdevice.h" +#include "gudevmarshal.h" +#include "gudevprivate.h" + +/** + * SECTION:gudevclient + * @short_description: Query devices and listen to uevents + * + * #GUdevClient is used to query information about devices on a Linux + * system from the Linux kernel and the udev device + * manager. + * + * Device information is retrieved from the kernel (through the + * sysfs filesystem) and the udev daemon (through a + * tmpfs filesystem) and presented through + * #GUdevDevice objects. This means that no blocking IO ever happens + * (in both cases, we are essentially just reading data from kernel + * memory) and as such there are no asynchronous versions of the + * provided methods. + * + * To get #GUdevDevice objects, use + * g_udev_client_query_by_subsystem(), + * g_udev_client_query_by_device_number(), + * g_udev_client_query_by_device_file(), + * g_udev_client_query_by_sysfs_path(), + * g_udev_client_query_by_subsystem_and_name() + * or the #GUdevEnumerator type. + * + * To listen to uevents, connect to the #GUdevClient::uevent signal. + */ + +struct _GUdevClientPrivate +{ + GSource *watch_source; + struct udev *udev; + struct udev_monitor *monitor; + + gchar **subsystems; +}; + +enum +{ + PROP_0, + PROP_SUBSYSTEMS, +}; + +enum +{ + UEVENT_SIGNAL, + LAST_SIGNAL, +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + +G_DEFINE_TYPE (GUdevClient, g_udev_client, G_TYPE_OBJECT) + +/* ---------------------------------------------------------------------------------------------------- */ + +static gboolean +monitor_event (GIOChannel *source, + GIOCondition condition, + gpointer data) +{ + GUdevClient *client = (GUdevClient *) data; + GUdevDevice *device; + struct udev_device *udevice; + + if (client->priv->monitor == NULL) + goto out; + udevice = udev_monitor_receive_device (client->priv->monitor); + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + g_signal_emit (client, + signals[UEVENT_SIGNAL], + 0, + g_udev_device_get_action (device), + device); + g_object_unref (device); + + out: + return TRUE; +} + +static void +g_udev_client_finalize (GObject *object) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + + if (client->priv->watch_source != NULL) + { + g_source_destroy (client->priv->watch_source); + client->priv->watch_source = NULL; + } + + if (client->priv->monitor != NULL) + { + udev_monitor_unref (client->priv->monitor); + client->priv->monitor = NULL; + } + + if (client->priv->udev != NULL) + { + udev_unref (client->priv->udev); + client->priv->udev = NULL; + } + + g_strfreev (client->priv->subsystems); + + if (G_OBJECT_CLASS (g_udev_client_parent_class)->finalize != NULL) + G_OBJECT_CLASS (g_udev_client_parent_class)->finalize (object); +} + +static void +g_udev_client_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + + switch (prop_id) + { + case PROP_SUBSYSTEMS: + if (client->priv->subsystems != NULL) + g_strfreev (client->priv->subsystems); + client->priv->subsystems = g_strdupv (g_value_get_boxed (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_client_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + + switch (prop_id) + { + case PROP_SUBSYSTEMS: + g_value_set_boxed (value, client->priv->subsystems); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_client_constructed (GObject *object) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + GIOChannel *channel; + guint n; + + client->priv->udev = udev_new (); + + /* connect to event source */ + client->priv->monitor = udev_monitor_new_from_netlink (client->priv->udev, "udev"); + + //g_debug ("ss = %p", client->priv->subsystems); + + if (client->priv->subsystems != NULL) + { + /* install subsystem filters to only wake up for certain events */ + for (n = 0; client->priv->subsystems[n] != NULL; n++) + { + gchar *subsystem; + gchar *devtype; + gchar *s; + + subsystem = g_strdup (client->priv->subsystems[n]); + devtype = NULL; + + //g_debug ("s = '%s'", subsystem); + + s = strstr (subsystem, "/"); + if (s != NULL) + { + devtype = s + 1; + *s = '\0'; + } + + if (client->priv->monitor != NULL) + udev_monitor_filter_add_match_subsystem_devtype (client->priv->monitor, subsystem, devtype); + + g_free (subsystem); + } + + /* listen to events, and buffer them */ + if (client->priv->monitor != NULL) + { + udev_monitor_enable_receiving (client->priv->monitor); + channel = g_io_channel_unix_new (udev_monitor_get_fd (client->priv->monitor)); + client->priv->watch_source = g_io_create_watch (channel, G_IO_IN); + g_io_channel_unref (channel); + g_source_set_callback (client->priv->watch_source, (GSourceFunc) monitor_event, client, NULL); + g_source_attach (client->priv->watch_source, g_main_context_get_thread_default ()); + g_source_unref (client->priv->watch_source); + } + else + { + client->priv->watch_source = NULL; + } + } + + if (G_OBJECT_CLASS (g_udev_client_parent_class)->constructed != NULL) + G_OBJECT_CLASS (g_udev_client_parent_class)->constructed (object); +} + + +static void +g_udev_client_class_init (GUdevClientClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->constructed = g_udev_client_constructed; + gobject_class->set_property = g_udev_client_set_property; + gobject_class->get_property = g_udev_client_get_property; + gobject_class->finalize = g_udev_client_finalize; + + /** + * GUdevClient:subsystems: + * + * The subsystems to listen for uevents on. + * + * To listen for only a specific DEVTYPE for a given SUBSYSTEM, use + * "subsystem/devtype". For example, to only listen for uevents + * where SUBSYSTEM is usb and DEVTYPE is usb_interface, use + * "usb/usb_interface". + * + * If this property is %NULL, then no events will be reported. If + * it's the empty array, events from all subsystems will be + * reported. + */ + g_object_class_install_property (gobject_class, + PROP_SUBSYSTEMS, + g_param_spec_boxed ("subsystems", + "The subsystems to listen for changes on", + "The subsystems to listen for changes on", + G_TYPE_STRV, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE)); + + /** + * GUdevClient::uevent: + * @client: The #GUdevClient receiving the event. + * @action: The action for the uevent e.g. "add", "remove", "change", "move", etc. + * @device: Details about the #GUdevDevice the event is for. + * + * Emitted when @client receives an uevent. + * + * This signal is emitted in the + * thread-default main loop + * of the thread that @client was created in. + */ + signals[UEVENT_SIGNAL] = g_signal_new ("uevent", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GUdevClientClass, uevent), + NULL, + NULL, + g_udev_marshal_VOID__STRING_OBJECT, + G_TYPE_NONE, + 2, + G_TYPE_STRING, + G_UDEV_TYPE_DEVICE); + + g_type_class_add_private (klass, sizeof (GUdevClientPrivate)); +} + +static void +g_udev_client_init (GUdevClient *client) +{ + client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, + G_UDEV_TYPE_CLIENT, + GUdevClientPrivate); +} + +/** + * g_udev_client_new: + * @subsystems: (array zero-terminated=1) (element-type utf8) (transfer none) (allow-none): A %NULL terminated string array of subsystems to listen for uevents on, %NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the #GUdevClient:subsystems property for details on this parameter. + * + * Constructs a #GUdevClient object that can be used to query + * information about devices. Connect to the #GUdevClient::uevent + * signal to listen for uevents. Note that signals are emitted in the + * thread-default main loop + * of the thread that you call this constructor from. + * + * Returns: A new #GUdevClient object. Free with g_object_unref(). + */ +GUdevClient * +g_udev_client_new (const gchar * const *subsystems) +{ + return G_UDEV_CLIENT (g_object_new (G_UDEV_TYPE_CLIENT, "subsystems", subsystems, NULL)); +} + +/** + * g_udev_client_query_by_subsystem: + * @client: A #GUdevClient. + * @subsystem: (allow-none): The subsystem to get devices for or %NULL to get all devices. + * + * Gets all devices belonging to @subsystem. + * + * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. + */ +GList * +g_udev_client_query_by_subsystem (GUdevClient *client, + const gchar *subsystem) +{ + struct udev_enumerate *enumerate; + struct udev_list_entry *l, *devices; + GList *ret; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + + ret = NULL; + + /* prepare a device scan */ + enumerate = udev_enumerate_new (client->priv->udev); + + /* filter for subsystem */ + if (subsystem != NULL) + udev_enumerate_add_match_subsystem (enumerate, subsystem); + /* retrieve the list */ + udev_enumerate_scan_devices (enumerate); + + /* add devices to the list */ + devices = udev_enumerate_get_list_entry (enumerate); + for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) + { + struct udev_device *udevice; + GUdevDevice *device; + + udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerate), + udev_list_entry_get_name (l)); + if (udevice == NULL) + continue; + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + ret = g_list_prepend (ret, device); + } + udev_enumerate_unref (enumerate); + + ret = g_list_reverse (ret); + + return ret; +} + +/** + * g_udev_client_query_by_device_number: + * @client: A #GUdevClient. + * @type: A value from the #GUdevDeviceType enumeration. + * @number: A device number. + * + * Looks up a device for a type and device number. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_device_number (GUdevClient *client, + GUdevDeviceType type, + GUdevDeviceNumber number) +{ + struct udev_device *udevice; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + + device = NULL; + udevice = udev_device_new_from_devnum (client->priv->udev, type, number); + + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + + out: + return device; +} + +/** + * g_udev_client_query_by_device_file: + * @client: A #GUdevClient. + * @device_file: A device file. + * + * Looks up a device for a device file. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_device_file (GUdevClient *client, + const gchar *device_file) +{ + struct stat stat_buf; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + g_return_val_if_fail (device_file != NULL, NULL); + + device = NULL; + + if (stat (device_file, &stat_buf) != 0) + goto out; + + if (stat_buf.st_rdev == 0) + goto out; + + if (S_ISBLK (stat_buf.st_mode)) + device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_BLOCK, stat_buf.st_rdev); + else if (S_ISCHR (stat_buf.st_mode)) + device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_CHAR, stat_buf.st_rdev); + + out: + return device; +} + +/** + * g_udev_client_query_by_sysfs_path: + * @client: A #GUdevClient. + * @sysfs_path: A sysfs path. + * + * Looks up a device for a sysfs path. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_sysfs_path (GUdevClient *client, + const gchar *sysfs_path) +{ + struct udev_device *udevice; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + g_return_val_if_fail (sysfs_path != NULL, NULL); + + device = NULL; + udevice = udev_device_new_from_syspath (client->priv->udev, sysfs_path); + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + + out: + return device; +} + +/** + * g_udev_client_query_by_subsystem_and_name: + * @client: A #GUdevClient. + * @subsystem: A subsystem name. + * @name: The name of the device. + * + * Looks up a device for a subsystem and name. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_subsystem_and_name (GUdevClient *client, + const gchar *subsystem, + const gchar *name) +{ + struct udev_device *udevice; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + g_return_val_if_fail (name != NULL, NULL); + + device = NULL; + udevice = udev_device_new_from_subsystem_sysname (client->priv->udev, subsystem, name); + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + + out: + return device; +} + +struct udev * +_g_udev_client_get_udev (GUdevClient *client) +{ + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + return client->priv->udev; +} diff --git a/src/extras/gudev/gudevclient.h b/src/extras/gudev/gudevclient.h new file mode 100644 index 0000000000..b425d03d48 --- /dev/null +++ b/src/extras/gudev/gudevclient.h @@ -0,0 +1,100 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_CLIENT_H__ +#define __G_UDEV_CLIENT_H__ + +#include + +G_BEGIN_DECLS + +#define G_UDEV_TYPE_CLIENT (g_udev_client_get_type ()) +#define G_UDEV_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_CLIENT, GUdevClient)) +#define G_UDEV_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_CLIENT, GUdevClientClass)) +#define G_UDEV_IS_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_CLIENT)) +#define G_UDEV_IS_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_CLIENT)) +#define G_UDEV_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_CLIENT, GUdevClientClass)) + +typedef struct _GUdevClientClass GUdevClientClass; +typedef struct _GUdevClientPrivate GUdevClientPrivate; + +/** + * GUdevClient: + * + * The #GUdevClient struct is opaque and should not be accessed directly. + */ +struct _GUdevClient +{ + GObject parent; + + /*< private >*/ + GUdevClientPrivate *priv; +}; + +/** + * GUdevClientClass: + * @parent_class: Parent class. + * @uevent: Signal class handler for the #GUdevClient::uevent signal. + * + * Class structure for #GUdevClient. + */ +struct _GUdevClientClass +{ + GObjectClass parent_class; + + /* signals */ + void (*uevent) (GUdevClient *client, + const gchar *action, + GUdevDevice *device); + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); + void (*reserved7) (void); + void (*reserved8) (void); +}; + +GType g_udev_client_get_type (void) G_GNUC_CONST; +GUdevClient *g_udev_client_new (const gchar* const *subsystems); +GList *g_udev_client_query_by_subsystem (GUdevClient *client, + const gchar *subsystem); +GUdevDevice *g_udev_client_query_by_device_number (GUdevClient *client, + GUdevDeviceType type, + GUdevDeviceNumber number); +GUdevDevice *g_udev_client_query_by_device_file (GUdevClient *client, + const gchar *device_file); +GUdevDevice *g_udev_client_query_by_sysfs_path (GUdevClient *client, + const gchar *sysfs_path); +GUdevDevice *g_udev_client_query_by_subsystem_and_name (GUdevClient *client, + const gchar *subsystem, + const gchar *name); + +G_END_DECLS + +#endif /* __G_UDEV_CLIENT_H__ */ diff --git a/src/extras/gudev/gudevdevice.c b/src/extras/gudev/gudevdevice.c new file mode 100644 index 0000000000..0c3340ffeb --- /dev/null +++ b/src/extras/gudev/gudevdevice.c @@ -0,0 +1,963 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "gudevdevice.h" +#include "gudevprivate.h" + +/** + * SECTION:gudevdevice + * @short_description: Get information about a device + * + * The #GUdevDevice class is used to get information about a specific + * device. Note that you cannot instantiate a #GUdevDevice object + * yourself. Instead you must use #GUdevClient to obtain #GUdevDevice + * objects. + * + * To get basic information about a device, use + * g_udev_device_get_subsystem(), g_udev_device_get_devtype(), + * g_udev_device_get_name(), g_udev_device_get_number(), + * g_udev_device_get_sysfs_path(), g_udev_device_get_driver(), + * g_udev_device_get_action(), g_udev_device_get_seqnum(), + * g_udev_device_get_device_type(), g_udev_device_get_device_number(), + * g_udev_device_get_device_file(), + * g_udev_device_get_device_file_symlinks(). + * + * To navigate the device tree, use g_udev_device_get_parent() and + * g_udev_device_get_parent_with_subsystem(). + * + * To access udev properties for the device, use + * g_udev_device_get_property_keys(), + * g_udev_device_has_property(), + * g_udev_device_get_property(), + * g_udev_device_get_property_as_int(), + * g_udev_device_get_property_as_uint64(), + * g_udev_device_get_property_as_double(), + * g_udev_device_get_property_as_boolean() and + * g_udev_device_get_property_as_strv(). + * + * To access sysfs attributes for the device, use + * g_udev_device_get_sysfs_attr(), + * g_udev_device_get_sysfs_attr_as_int(), + * g_udev_device_get_sysfs_attr_as_uint64(), + * g_udev_device_get_sysfs_attr_as_double(), + * g_udev_device_get_sysfs_attr_as_boolean() and + * g_udev_device_get_sysfs_attr_as_strv(). + * + * Note that all getters on #GUdevDevice are non-reffing – returned + * values are owned by the object, should not be freed and are only + * valid as long as the object is alive. + * + * By design, #GUdevDevice will not react to changes for a device – it + * only contains a snapshot of information when the #GUdevDevice + * object was created. To work with changes, you typically connect to + * the #GUdevClient::uevent signal on a #GUdevClient and get a new + * #GUdevDevice whenever an event happens. + */ + +struct _GUdevDevicePrivate +{ + struct udev_device *udevice; + + /* computed ondemand and cached */ + gchar **device_file_symlinks; + gchar **property_keys; + gchar **tags; + GHashTable *prop_strvs; + GHashTable *sysfs_attr_strvs; +}; + +G_DEFINE_TYPE (GUdevDevice, g_udev_device, G_TYPE_OBJECT) + +static void +g_udev_device_finalize (GObject *object) +{ + GUdevDevice *device = G_UDEV_DEVICE (object); + + g_strfreev (device->priv->device_file_symlinks); + g_strfreev (device->priv->property_keys); + g_strfreev (device->priv->tags); + + if (device->priv->udevice != NULL) + udev_device_unref (device->priv->udevice); + + if (device->priv->prop_strvs != NULL) + g_hash_table_unref (device->priv->prop_strvs); + + if (device->priv->sysfs_attr_strvs != NULL) + g_hash_table_unref (device->priv->sysfs_attr_strvs); + + if (G_OBJECT_CLASS (g_udev_device_parent_class)->finalize != NULL) + (* G_OBJECT_CLASS (g_udev_device_parent_class)->finalize) (object); +} + +static void +g_udev_device_class_init (GUdevDeviceClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->finalize = g_udev_device_finalize; + + g_type_class_add_private (klass, sizeof (GUdevDevicePrivate)); +} + +static void +g_udev_device_init (GUdevDevice *device) +{ + device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device, + G_UDEV_TYPE_DEVICE, + GUdevDevicePrivate); +} + + +GUdevDevice * +_g_udev_device_new (struct udev_device *udevice) +{ + GUdevDevice *device; + + device = G_UDEV_DEVICE (g_object_new (G_UDEV_TYPE_DEVICE, NULL)); + device->priv->udevice = udev_device_ref (udevice); + + return device; +} + +/** + * g_udev_device_get_subsystem: + * @device: A #GUdevDevice. + * + * Gets the subsystem for @device. + * + * Returns: The subsystem for @device. + */ +const gchar * +g_udev_device_get_subsystem (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_subsystem (device->priv->udevice); +} + +/** + * g_udev_device_get_devtype: + * @device: A #GUdevDevice. + * + * Gets the device type for @device. + * + * Returns: The devtype for @device. + */ +const gchar * +g_udev_device_get_devtype (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_devtype (device->priv->udevice); +} + +/** + * g_udev_device_get_name: + * @device: A #GUdevDevice. + * + * Gets the name of @device, e.g. "sda3". + * + * Returns: The name of @device. + */ +const gchar * +g_udev_device_get_name (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_sysname (device->priv->udevice); +} + +/** + * g_udev_device_get_number: + * @device: A #GUdevDevice. + * + * Gets the number of @device, e.g. "3" if g_udev_device_get_name() returns "sda3". + * + * Returns: The number of @device. + */ +const gchar * +g_udev_device_get_number (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_sysnum (device->priv->udevice); +} + +/** + * g_udev_device_get_sysfs_path: + * @device: A #GUdevDevice. + * + * Gets the sysfs path for @device. + * + * Returns: The sysfs path for @device. + */ +const gchar * +g_udev_device_get_sysfs_path (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_syspath (device->priv->udevice); +} + +/** + * g_udev_device_get_driver: + * @device: A #GUdevDevice. + * + * Gets the name of the driver used for @device. + * + * Returns: The name of the driver for @device or %NULL if unknown. + */ +const gchar * +g_udev_device_get_driver (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_driver (device->priv->udevice); +} + +/** + * g_udev_device_get_action: + * @device: A #GUdevDevice. + * + * Gets the most recent action (e.g. "add", "remove", "change", etc.) for @device. + * + * Returns: An action string. + */ +const gchar * +g_udev_device_get_action (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_action (device->priv->udevice); +} + +/** + * g_udev_device_get_seqnum: + * @device: A #GUdevDevice. + * + * Gets the most recent sequence number for @device. + * + * Returns: A sequence number. + */ +guint64 +g_udev_device_get_seqnum (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_seqnum (device->priv->udevice); +} + +/** + * g_udev_device_get_device_type: + * @device: A #GUdevDevice. + * + * Gets the type of the device file, if any, for @device. + * + * Returns: The device number for @device or #G_UDEV_DEVICE_TYPE_NONE if the device does not have a device file. + */ +GUdevDeviceType +g_udev_device_get_device_type (GUdevDevice *device) +{ + struct stat stat_buf; + const gchar *device_file; + GUdevDeviceType type; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), G_UDEV_DEVICE_TYPE_NONE); + + type = G_UDEV_DEVICE_TYPE_NONE; + + /* TODO: would be better to have support for this in libudev... */ + + device_file = g_udev_device_get_device_file (device); + if (device_file == NULL) + goto out; + + if (stat (device_file, &stat_buf) != 0) + goto out; + + if (S_ISBLK (stat_buf.st_mode)) + type = G_UDEV_DEVICE_TYPE_BLOCK; + else if (S_ISCHR (stat_buf.st_mode)) + type = G_UDEV_DEVICE_TYPE_CHAR; + + out: + return type; +} + +/** + * g_udev_device_get_device_number: + * @device: A #GUdevDevice. + * + * Gets the device number, if any, for @device. + * + * Returns: The device number for @device or 0 if unknown. + */ +GUdevDeviceNumber +g_udev_device_get_device_number (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_devnum (device->priv->udevice); +} + +/** + * g_udev_device_get_device_file: + * @device: A #GUdevDevice. + * + * Gets the device file for @device. + * + * Returns: The device file for @device or %NULL if no device file + * exists. + */ +const gchar * +g_udev_device_get_device_file (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_devnode (device->priv->udevice); +} + +/** + * g_udev_device_get_device_file_symlinks: + * @device: A #GUdevDevice. + * + * Gets a list of symlinks (in /dev) that points to + * the device file for @device. + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of symlinks. This array is owned by @device and should not be freed by the caller. + */ +const gchar * const * +g_udev_device_get_device_file_symlinks (GUdevDevice *device) +{ + struct udev_list_entry *l; + GPtrArray *p; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + if (device->priv->device_file_symlinks != NULL) + goto out; + + p = g_ptr_array_new (); + for (l = udev_device_get_devlinks_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) + { + g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); + } + g_ptr_array_add (p, NULL); + device->priv->device_file_symlinks = (gchar **) g_ptr_array_free (p, FALSE); + + out: + return (const gchar * const *) device->priv->device_file_symlinks; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * g_udev_device_get_parent: + * @device: A #GUdevDevice. + * + * Gets the immediate parent of @device, if any. + * + * Returns: A #GUdevDevice or %NULL if @device has no parent. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_device_get_parent (GUdevDevice *device) +{ + GUdevDevice *ret; + struct udev_device *udevice; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + ret = NULL; + + udevice = udev_device_get_parent (device->priv->udevice); + if (udevice == NULL) + goto out; + + ret = _g_udev_device_new (udevice); + + out: + return ret; +} + +/** + * g_udev_device_get_parent_with_subsystem: + * @device: A #GUdevDevice. + * @subsystem: The subsystem of the parent to get. + * @devtype: (allow-none): The devtype of the parent to get or %NULL. + * + * Walks up the chain of parents of @device and returns the first + * device encountered where @subsystem and @devtype matches, if any. + * + * Returns: A #GUdevDevice or %NULL if @device has no parent with @subsystem and @devtype. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_device_get_parent_with_subsystem (GUdevDevice *device, + const gchar *subsystem, + const gchar *devtype) +{ + GUdevDevice *ret; + struct udev_device *udevice; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + + ret = NULL; + + udevice = udev_device_get_parent_with_subsystem_devtype (device->priv->udevice, + subsystem, + devtype); + if (udevice == NULL) + goto out; + + ret = _g_udev_device_new (udevice); + + out: + return ret; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * g_udev_device_get_property_keys: + * @device: A #GUdevDevice. + * + * Gets all keys for properties on @device. + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of property keys. This array is owned by @device and should not be freed by the caller. + */ +const gchar* const * +g_udev_device_get_property_keys (GUdevDevice *device) +{ + struct udev_list_entry *l; + GPtrArray *p; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + if (device->priv->property_keys != NULL) + goto out; + + p = g_ptr_array_new (); + for (l = udev_device_get_properties_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) + { + g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); + } + g_ptr_array_add (p, NULL); + device->priv->property_keys = (gchar **) g_ptr_array_free (p, FALSE); + + out: + return (const gchar * const *) device->priv->property_keys; +} + + +/** + * g_udev_device_has_property: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Check if a the property with the given key exists. + * + * Returns: %TRUE only if the value for @key exist. + */ +gboolean +g_udev_device_has_property (GUdevDevice *device, + const gchar *key) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + g_return_val_if_fail (key != NULL, FALSE); + return udev_device_get_property_value (device->priv->udevice, key) != NULL; +} + +/** + * g_udev_device_get_property: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device. + * + * Returns: The value for @key or %NULL if @key doesn't exist on @device. Do not free this string, it is owned by @device. + */ +const gchar * +g_udev_device_get_property (GUdevDevice *device, + const gchar *key) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (key != NULL, NULL); + return udev_device_get_property_value (device->priv->udevice, key); +} + +/** + * g_udev_device_get_property_as_int: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to an integer + * using strtol(). + * + * Returns: The value for @key or 0 if @key doesn't exist or + * isn't an integer. + */ +gint +g_udev_device_get_property_as_int (GUdevDevice *device, + const gchar *key) +{ + gint result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (key != NULL, 0); + + result = 0; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = strtol (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_property_as_uint64: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to an unsigned + * 64-bit integer using g_ascii_strtoull(). + * + * Returns: The value for @key or 0 if @key doesn't exist or isn't a + * #guint64. + */ +guint64 +g_udev_device_get_property_as_uint64 (GUdevDevice *device, + const gchar *key) +{ + guint64 result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (key != NULL, 0); + + result = 0; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = g_ascii_strtoull (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_property_as_double: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to a double + * precision floating point number using strtod(). + * + * Returns: The value for @key or 0.0 if @key doesn't exist or isn't a + * #gdouble. + */ +gdouble +g_udev_device_get_property_as_double (GUdevDevice *device, + const gchar *key) +{ + gdouble result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); + g_return_val_if_fail (key != NULL, 0.0); + + result = 0.0; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = strtod (s, NULL); +out: + return result; +} + +/** + * g_udev_device_get_property_as_boolean: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to an + * boolean. This is done by doing a case-insensitive string comparison + * on the string value against "1" and "true". + * + * Returns: The value for @key or %FALSE if @key doesn't exist or + * isn't a #gboolean. + */ +gboolean +g_udev_device_get_property_as_boolean (GUdevDevice *device, + const gchar *key) +{ + gboolean result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + g_return_val_if_fail (key != NULL, FALSE); + + result = FALSE; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) + result = TRUE; + out: + return result; +} + +static gchar ** +split_at_whitespace (const gchar *s) +{ + gchar **result; + guint n; + guint m; + + result = g_strsplit_set (s, " \v\t\r\n", 0); + + /* remove empty strings, thanks GLib */ + for (n = 0; result[n] != NULL; n++) + { + if (strlen (result[n]) == 0) + { + g_free (result[n]); + for (m = n; result[m] != NULL; m++) + result[m] = result[m + 1]; + n--; + } + } + + return result; +} + +/** + * g_udev_device_get_property_as_strv: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and return the result of + * splitting it into non-empty tokens split at white space (only space + * (' '), form-feed ('\f'), newline ('\n'), carriage return ('\r'), + * horizontal tab ('\t'), and vertical tab ('\v') are considered; the + * locale is not taken into account). + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of @key on @device split into tokens or %NULL if @key doesn't exist. This array is owned by @device and should not be freed by the caller. + */ +const gchar* const * +g_udev_device_get_property_as_strv (GUdevDevice *device, + const gchar *key) +{ + gchar **result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (key != NULL, NULL); + + if (device->priv->prop_strvs != NULL) + { + result = g_hash_table_lookup (device->priv->prop_strvs, key); + if (result != NULL) + goto out; + } + + result = NULL; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = split_at_whitespace (s); + if (result == NULL) + goto out; + + if (device->priv->prop_strvs == NULL) + device->priv->prop_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); + g_hash_table_insert (device->priv->prop_strvs, g_strdup (key), result); + +out: + return (const gchar* const *) result; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * g_udev_device_get_sysfs_attr: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device. + * + * Returns: The value of the sysfs attribute or %NULL if there is no + * such attribute. Do not free this string, it is owned by @device. + */ +const gchar * +g_udev_device_get_sysfs_attr (GUdevDevice *device, + const gchar *name) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (name != NULL, NULL); + return udev_device_get_sysattr_value (device->priv->udevice, name); +} + +/** + * g_udev_device_get_sysfs_attr_as_int: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to an integer + * using strtol(). + * + * Returns: The value of the sysfs attribute or 0 if there is no such + * attribute. + */ +gint +g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, + const gchar *name) +{ + gint result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (name != NULL, 0); + + result = 0; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = strtol (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_uint64: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to an unsigned + * 64-bit integer using g_ascii_strtoull(). + * + * Returns: The value of the sysfs attribute or 0 if there is no such + * attribute. + */ +guint64 +g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, + const gchar *name) +{ + guint64 result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (name != NULL, 0); + + result = 0; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = g_ascii_strtoull (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_double: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to a double + * precision floating point number using strtod(). + * + * Returns: The value of the sysfs attribute or 0.0 if there is no such + * attribute. + */ +gdouble +g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, + const gchar *name) +{ + gdouble result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); + g_return_val_if_fail (name != NULL, 0.0); + + result = 0.0; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = strtod (s, NULL); +out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_boolean: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to an + * boolean. This is done by doing a case-insensitive string comparison + * on the string value against "1" and "true". + * + * Returns: The value of the sysfs attribute or %FALSE if there is no such + * attribute. + */ +gboolean +g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, + const gchar *name) +{ + gboolean result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + g_return_val_if_fail (name != NULL, FALSE); + + result = FALSE; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) + result = TRUE; + out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_strv: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and return the result of + * splitting it into non-empty tokens split at white space (only space (' '), + * form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal + * tab ('\t'), and vertical tab ('\v') are considered; the locale is + * not taken into account). + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of the sysfs attribute split into tokens or %NULL if there is no such attribute. This array is owned by @device and should not be freed by the caller. + */ +const gchar * const * +g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, + const gchar *name) +{ + gchar **result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (name != NULL, NULL); + + if (device->priv->sysfs_attr_strvs != NULL) + { + result = g_hash_table_lookup (device->priv->sysfs_attr_strvs, name); + if (result != NULL) + goto out; + } + + result = NULL; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = split_at_whitespace (s); + if (result == NULL) + goto out; + + if (device->priv->sysfs_attr_strvs == NULL) + device->priv->sysfs_attr_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); + g_hash_table_insert (device->priv->sysfs_attr_strvs, g_strdup (name), result); + +out: + return (const gchar* const *) result; +} + +/** + * g_udev_device_get_tags: + * @device: A #GUdevDevice. + * + * Gets all tags for @device. + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of tags. This array is owned by @device and should not be freed by the caller. + * + * Since: 165 + */ +const gchar* const * +g_udev_device_get_tags (GUdevDevice *device) +{ + struct udev_list_entry *l; + GPtrArray *p; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + if (device->priv->tags != NULL) + goto out; + + p = g_ptr_array_new (); + for (l = udev_device_get_tags_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) + { + g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); + } + g_ptr_array_add (p, NULL); + device->priv->tags = (gchar **) g_ptr_array_free (p, FALSE); + + out: + return (const gchar * const *) device->priv->tags; +} + +/** + * g_udev_device_get_is_initialized: + * @device: A #GUdevDevice. + * + * Gets whether @device has been initalized. + * + * Returns: Whether @device has been initialized. + * + * Since: 165 + */ +gboolean +g_udev_device_get_is_initialized (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + return udev_device_get_is_initialized (device->priv->udevice); +} + +/** + * g_udev_device_get_usec_since_initialized: + * @device: A #GUdevDevice. + * + * Gets number of micro-seconds since @device was initialized. + * + * This only works for devices with properties in the udev + * database. All other devices return 0. + * + * Returns: Number of micro-seconds since @device was initialized or 0 if unknown. + * + * Since: 165 + */ +guint64 +g_udev_device_get_usec_since_initialized (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_usec_since_initialized (device->priv->udevice); +} diff --git a/src/extras/gudev/gudevdevice.h b/src/extras/gudev/gudevdevice.h new file mode 100644 index 0000000000..d4873bad0f --- /dev/null +++ b/src/extras/gudev/gudevdevice.h @@ -0,0 +1,128 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_DEVICE_H__ +#define __G_UDEV_DEVICE_H__ + +#include + +G_BEGIN_DECLS + +#define G_UDEV_TYPE_DEVICE (g_udev_device_get_type ()) +#define G_UDEV_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_DEVICE, GUdevDevice)) +#define G_UDEV_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) +#define G_UDEV_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_DEVICE)) +#define G_UDEV_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_DEVICE)) +#define G_UDEV_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) + +typedef struct _GUdevDeviceClass GUdevDeviceClass; +typedef struct _GUdevDevicePrivate GUdevDevicePrivate; + +/** + * GUdevDevice: + * + * The #GUdevDevice struct is opaque and should not be accessed directly. + */ +struct _GUdevDevice +{ + GObject parent; + + /*< private >*/ + GUdevDevicePrivate *priv; +}; + +/** + * GUdevDeviceClass: + * @parent_class: Parent class. + * + * Class structure for #GUdevDevice. + */ +struct _GUdevDeviceClass +{ + GObjectClass parent_class; + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); + void (*reserved7) (void); + void (*reserved8) (void); +}; + +GType g_udev_device_get_type (void) G_GNUC_CONST; +gboolean g_udev_device_get_is_initialized (GUdevDevice *device); +guint64 g_udev_device_get_usec_since_initialized (GUdevDevice *device); +const gchar *g_udev_device_get_subsystem (GUdevDevice *device); +const gchar *g_udev_device_get_devtype (GUdevDevice *device); +const gchar *g_udev_device_get_name (GUdevDevice *device); +const gchar *g_udev_device_get_number (GUdevDevice *device); +const gchar *g_udev_device_get_sysfs_path (GUdevDevice *device); +const gchar *g_udev_device_get_driver (GUdevDevice *device); +const gchar *g_udev_device_get_action (GUdevDevice *device); +guint64 g_udev_device_get_seqnum (GUdevDevice *device); +GUdevDeviceType g_udev_device_get_device_type (GUdevDevice *device); +GUdevDeviceNumber g_udev_device_get_device_number (GUdevDevice *device); +const gchar *g_udev_device_get_device_file (GUdevDevice *device); +const gchar* const *g_udev_device_get_device_file_symlinks (GUdevDevice *device); +GUdevDevice *g_udev_device_get_parent (GUdevDevice *device); +GUdevDevice *g_udev_device_get_parent_with_subsystem (GUdevDevice *device, + const gchar *subsystem, + const gchar *devtype); +const gchar* const *g_udev_device_get_property_keys (GUdevDevice *device); +gboolean g_udev_device_has_property (GUdevDevice *device, + const gchar *key); +const gchar *g_udev_device_get_property (GUdevDevice *device, + const gchar *key); +gint g_udev_device_get_property_as_int (GUdevDevice *device, + const gchar *key); +guint64 g_udev_device_get_property_as_uint64 (GUdevDevice *device, + const gchar *key); +gdouble g_udev_device_get_property_as_double (GUdevDevice *device, + const gchar *key); +gboolean g_udev_device_get_property_as_boolean (GUdevDevice *device, + const gchar *key); +const gchar* const *g_udev_device_get_property_as_strv (GUdevDevice *device, + const gchar *key); + +const gchar *g_udev_device_get_sysfs_attr (GUdevDevice *device, + const gchar *name); +gint g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, + const gchar *name); +guint64 g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, + const gchar *name); +gdouble g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, + const gchar *name); +gboolean g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, + const gchar *name); +const gchar* const *g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, + const gchar *name); +const gchar* const *g_udev_device_get_tags (GUdevDevice *device); + +G_END_DECLS + +#endif /* __G_UDEV_DEVICE_H__ */ diff --git a/src/extras/gudev/gudevenumerator.c b/src/extras/gudev/gudevenumerator.c new file mode 100644 index 0000000000..db09074625 --- /dev/null +++ b/src/extras/gudev/gudevenumerator.c @@ -0,0 +1,431 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008-2010 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "gudevclient.h" +#include "gudevenumerator.h" +#include "gudevdevice.h" +#include "gudevmarshal.h" +#include "gudevprivate.h" + +/** + * SECTION:gudevenumerator + * @short_description: Lookup and sort devices + * + * #GUdevEnumerator is used to lookup and sort devices. + * + * Since: 165 + */ + +struct _GUdevEnumeratorPrivate +{ + GUdevClient *client; + struct udev_enumerate *e; +}; + +enum +{ + PROP_0, + PROP_CLIENT, +}; + +G_DEFINE_TYPE (GUdevEnumerator, g_udev_enumerator, G_TYPE_OBJECT) + +/* ---------------------------------------------------------------------------------------------------- */ + +static void +g_udev_enumerator_finalize (GObject *object) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + if (enumerator->priv->client != NULL) + { + g_object_unref (enumerator->priv->client); + enumerator->priv->client = NULL; + } + + if (enumerator->priv->e != NULL) + { + udev_enumerate_unref (enumerator->priv->e); + enumerator->priv->e = NULL; + } + + if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize != NULL) + G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize (object); +} + +static void +g_udev_enumerator_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + switch (prop_id) + { + case PROP_CLIENT: + if (enumerator->priv->client != NULL) + g_object_unref (enumerator->priv->client); + enumerator->priv->client = g_value_dup_object (value); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_enumerator_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + switch (prop_id) + { + case PROP_CLIENT: + g_value_set_object (value, enumerator->priv->client); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_enumerator_constructed (GObject *object) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + g_assert (G_UDEV_IS_CLIENT (enumerator->priv->client)); + + enumerator->priv->e = udev_enumerate_new (_g_udev_client_get_udev (enumerator->priv->client)); + + if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed != NULL) + G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed (object); +} + +static void +g_udev_enumerator_class_init (GUdevEnumeratorClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->finalize = g_udev_enumerator_finalize; + gobject_class->set_property = g_udev_enumerator_set_property; + gobject_class->get_property = g_udev_enumerator_get_property; + gobject_class->constructed = g_udev_enumerator_constructed; + + /** + * GUdevEnumerator:client: + * + * The #GUdevClient to enumerate devices from. + * + * Since: 165 + */ + g_object_class_install_property (gobject_class, + PROP_CLIENT, + g_param_spec_object ("client", + "The client to enumerate devices from", + "The client to enumerate devices from", + G_UDEV_TYPE_CLIENT, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE)); + + g_type_class_add_private (klass, sizeof (GUdevEnumeratorPrivate)); +} + +static void +g_udev_enumerator_init (GUdevEnumerator *enumerator) +{ + enumerator->priv = G_TYPE_INSTANCE_GET_PRIVATE (enumerator, + G_UDEV_TYPE_ENUMERATOR, + GUdevEnumeratorPrivate); +} + +/** + * g_udev_enumerator_new: + * @client: A #GUdevClient to enumerate devices from. + * + * Constructs a #GUdevEnumerator object that can be used to enumerate + * and sort devices. Use the add_match_*() and add_nomatch_*() methods + * and execute the query to get a list of devices with + * g_udev_enumerator_execute(). + * + * Returns: A new #GUdevEnumerator object. Free with g_object_unref(). + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_new (GUdevClient *client) +{ + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + return G_UDEV_ENUMERATOR (g_object_new (G_UDEV_TYPE_ENUMERATOR, "client", client, NULL)); +} + + +/** + * g_udev_enumerator_add_match_subsystem: + * @enumerator: A #GUdevEnumerator. + * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. + * + * All returned devices will match the given @subsystem. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + udev_enumerate_add_match_subsystem (enumerator->priv->e, subsystem); + return enumerator; +} + +/** + * g_udev_enumerator_add_nomatch_subsystem: + * @enumerator: A #GUdevEnumerator. + * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. + * + * All returned devices will not match the given @subsystem. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + udev_enumerate_add_nomatch_subsystem (enumerator->priv->e, subsystem); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_sysfs_attr: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for sysfs attribute key. + * @value: Wildcard filter for sysfs attribute value. + * + * All returned devices will have a sysfs attribute matching the given @name and @value. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (value != NULL, NULL); + udev_enumerate_add_match_sysattr (enumerator->priv->e, name, value); + return enumerator; +} + +/** + * g_udev_enumerator_add_nomatch_sysfs_attr: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for sysfs attribute key. + * @value: Wildcard filter for sysfs attribute value. + * + * All returned devices will not have a sysfs attribute matching the given @name and @value. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (value != NULL, NULL); + udev_enumerate_add_nomatch_sysattr (enumerator->priv->e, name, value); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_property: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for property name. + * @value: Wildcard filter for property value. + * + * All returned devices will have a property matching the given @name and @value. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (value != NULL, NULL); + udev_enumerate_add_match_property (enumerator->priv->e, name, value); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_name: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for kernel name e.g. "sda*". + * + * All returned devices will match the given @name. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, + const gchar *name) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + udev_enumerate_add_match_sysname (enumerator->priv->e, name); + return enumerator; +} + +/** + * g_udev_enumerator_add_sysfs_path: + * @enumerator: A #GUdevEnumerator. + * @sysfs_path: A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda" + * + * Add a device to the list of devices, to retrieve it back sorted in dependency order. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, + const gchar *sysfs_path) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (sysfs_path != NULL, NULL); + udev_enumerate_add_syspath (enumerator->priv->e, sysfs_path); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_tag: + * @enumerator: A #GUdevEnumerator. + * @tag: A udev tag e.g. "udev-acl". + * + * All returned devices will match the given @tag. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, + const gchar *tag) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (tag != NULL, NULL); + udev_enumerate_add_match_tag (enumerator->priv->e, tag); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_is_initialized: + * @enumerator: A #GUdevEnumerator. + * + * All returned devices will be initialized. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + udev_enumerate_add_match_is_initialized (enumerator->priv->e); + return enumerator; +} + +/** + * g_udev_enumerator_execute: + * @enumerator: A #GUdevEnumerator. + * + * Executes the query in @enumerator. + * + * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. + * + * Since: 165 + */ +GList * +g_udev_enumerator_execute (GUdevEnumerator *enumerator) +{ + GList *ret; + struct udev_list_entry *l, *devices; + + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + + ret = NULL; + + /* retrieve the list */ + udev_enumerate_scan_devices (enumerator->priv->e); + + devices = udev_enumerate_get_list_entry (enumerator->priv->e); + for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) + { + struct udev_device *udevice; + GUdevDevice *device; + + udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerator->priv->e), + udev_list_entry_get_name (l)); + if (udevice == NULL) + continue; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + ret = g_list_prepend (ret, device); + } + + ret = g_list_reverse (ret); + + return ret; +} diff --git a/src/extras/gudev/gudevenumerator.h b/src/extras/gudev/gudevenumerator.h new file mode 100644 index 0000000000..3fddccf573 --- /dev/null +++ b/src/extras/gudev/gudevenumerator.h @@ -0,0 +1,107 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008-2010 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_ENUMERATOR_H__ +#define __G_UDEV_ENUMERATOR_H__ + +#include + +G_BEGIN_DECLS + +#define G_UDEV_TYPE_ENUMERATOR (g_udev_enumerator_get_type ()) +#define G_UDEV_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumerator)) +#define G_UDEV_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) +#define G_UDEV_IS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_ENUMERATOR)) +#define G_UDEV_IS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_ENUMERATOR)) +#define G_UDEV_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) + +typedef struct _GUdevEnumeratorClass GUdevEnumeratorClass; +typedef struct _GUdevEnumeratorPrivate GUdevEnumeratorPrivate; + +/** + * GUdevEnumerator: + * + * The #GUdevEnumerator struct is opaque and should not be accessed directly. + * + * Since: 165 + */ +struct _GUdevEnumerator +{ + GObject parent; + + /*< private >*/ + GUdevEnumeratorPrivate *priv; +}; + +/** + * GUdevEnumeratorClass: + * @parent_class: Parent class. + * + * Class structure for #GUdevEnumerator. + * + * Since: 165 + */ +struct _GUdevEnumeratorClass +{ + GObjectClass parent_class; + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); + void (*reserved7) (void); + void (*reserved8) (void); +}; + +GType g_udev_enumerator_get_type (void) G_GNUC_CONST; +GUdevEnumerator *g_udev_enumerator_new (GUdevClient *client); +GUdevEnumerator *g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem); +GUdevEnumerator *g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem); +GUdevEnumerator *g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value); +GUdevEnumerator *g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value); +GUdevEnumerator *g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value); +GUdevEnumerator *g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, + const gchar *name); +GUdevEnumerator *g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, + const gchar *tag); +GUdevEnumerator *g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator); +GUdevEnumerator *g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, + const gchar *sysfs_path); +GList *g_udev_enumerator_execute (GUdevEnumerator *enumerator); + +G_END_DECLS + +#endif /* __G_UDEV_ENUMERATOR_H__ */ diff --git a/src/extras/gudev/gudevenums.h b/src/extras/gudev/gudevenums.h new file mode 100644 index 0000000000..c3a0aa8747 --- /dev/null +++ b/src/extras/gudev/gudevenums.h @@ -0,0 +1,49 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_ENUMS_H__ +#define __G_UDEV_ENUMS_H__ + +#include + +G_BEGIN_DECLS + +/** + * GUdevDeviceType: + * @G_UDEV_DEVICE_TYPE_NONE: Device does not have a device file. + * @G_UDEV_DEVICE_TYPE_BLOCK: Device is a block device. + * @G_UDEV_DEVICE_TYPE_CHAR: Device is a character device. + * + * Enumeration used to specify a the type of a device. + */ +typedef enum +{ + G_UDEV_DEVICE_TYPE_NONE = 0, + G_UDEV_DEVICE_TYPE_BLOCK = 'b', + G_UDEV_DEVICE_TYPE_CHAR = 'c', +} GUdevDeviceType; + +G_END_DECLS + +#endif /* __G_UDEV_ENUMS_H__ */ diff --git a/src/extras/gudev/gudevenumtypes.c.template b/src/extras/gudev/gudevenumtypes.c.template new file mode 100644 index 0000000000..fc30b39e2e --- /dev/null +++ b/src/extras/gudev/gudevenumtypes.c.template @@ -0,0 +1,39 @@ +/*** BEGIN file-header ***/ +#include + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} + +/*** END value-tail ***/ + +/*** BEGIN file-tail ***/ +/*** END file-tail ***/ diff --git a/src/extras/gudev/gudevenumtypes.h.template b/src/extras/gudev/gudevenumtypes.h.template new file mode 100644 index 0000000000..d0ab3393e6 --- /dev/null +++ b/src/extras/gudev/gudevenumtypes.h.template @@ -0,0 +1,24 @@ +/*** BEGIN file-header ***/ +#ifndef __GUDEV_ENUM_TYPES_H__ +#define __GUDEV_ENUM_TYPES_H__ + +#include + +G_BEGIN_DECLS +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) +/*** END value-header ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __GUDEV_ENUM_TYPES_H__ */ +/*** END file-tail ***/ diff --git a/src/extras/gudev/gudevmarshal.list b/src/extras/gudev/gudevmarshal.list new file mode 100644 index 0000000000..7e665999e8 --- /dev/null +++ b/src/extras/gudev/gudevmarshal.list @@ -0,0 +1 @@ +VOID:STRING,OBJECT diff --git a/src/extras/gudev/gudevprivate.h b/src/extras/gudev/gudevprivate.h new file mode 100644 index 0000000000..8866f52b88 --- /dev/null +++ b/src/extras/gudev/gudevprivate.h @@ -0,0 +1,41 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_PRIVATE_H__ +#define __G_UDEV_PRIVATE_H__ + +#include + +#include + +G_BEGIN_DECLS + +GUdevDevice * +_g_udev_device_new (struct udev_device *udevice); + +struct udev *_g_udev_client_get_udev (GUdevClient *client); + +G_END_DECLS + +#endif /* __G_UDEV_PRIVATE_H__ */ diff --git a/src/extras/gudev/gudevtypes.h b/src/extras/gudev/gudevtypes.h new file mode 100644 index 0000000000..888482783d --- /dev/null +++ b/src/extras/gudev/gudevtypes.h @@ -0,0 +1,51 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_TYPES_H__ +#define __G_UDEV_TYPES_H__ + +#include +#include + +G_BEGIN_DECLS + +typedef struct _GUdevClient GUdevClient; +typedef struct _GUdevDevice GUdevDevice; +typedef struct _GUdevEnumerator GUdevEnumerator; + +/** + * GUdevDeviceNumber: + * + * Corresponds to the standard #dev_t type as defined by POSIX (Until + * bug 584517 is resolved this work-around is needed). + */ +#ifdef _GUDEV_WORK_AROUND_DEV_T_BUG +typedef guint64 GUdevDeviceNumber; /* __UQUAD_TYPE */ +#else +typedef dev_t GUdevDeviceNumber; +#endif + +G_END_DECLS + +#endif /* __G_UDEV_TYPES_H__ */ diff --git a/src/extras/gudev/seed-example-enum.js b/src/extras/gudev/seed-example-enum.js new file mode 100755 index 0000000000..66206ad806 --- /dev/null +++ b/src/extras/gudev/seed-example-enum.js @@ -0,0 +1,38 @@ +#!/usr/bin/env seed + +const GLib = imports.gi.GLib; +const GUdev = imports.gi.GUdev; + +function print_device(device) { + print(" initialized: " + device.get_is_initialized()); + print(" usec since initialized: " + device.get_usec_since_initialized()); + print(" subsystem: " + device.get_subsystem()); + print(" devtype: " + device.get_devtype()); + print(" name: " + device.get_name()); + print(" number: " + device.get_number()); + print(" sysfs_path: " + device.get_sysfs_path()); + print(" driver: " + device.get_driver()); + print(" action: " + device.get_action()); + print(" seqnum: " + device.get_seqnum()); + print(" device type: " + device.get_device_type()); + print(" device number: " + device.get_device_number()); + print(" device file: " + device.get_device_file()); + print(" device file symlinks: " + device.get_device_file_symlinks()); + print(" tags: " + device.get_tags()); + var keys = device.get_property_keys(); + for (var n = 0; n < keys.length; n++) { + print(" " + keys[n] + "=" + device.get_property(keys[n])); + } +} + +var client = new GUdev.Client({subsystems: []}); +var enumerator = new GUdev.Enumerator({client: client}); +enumerator.add_match_subsystem('b*') + +var devices = enumerator.execute(); + +for (var n=0; n < devices.length; n++) { + var device = devices[n]; + print_device(device); + print(""); +} diff --git a/src/extras/gudev/seed-example.js b/src/extras/gudev/seed-example.js new file mode 100755 index 0000000000..e2ac324d23 --- /dev/null +++ b/src/extras/gudev/seed-example.js @@ -0,0 +1,72 @@ +#!/usr/bin/env seed + +// seed example + +const GLib = imports.gi.GLib; +const GUdev = imports.gi.GUdev; + +function print_device (device) { + print (" subsystem: " + device.get_subsystem ()); + print (" devtype: " + device.get_devtype ()); + print (" name: " + device.get_name ()); + print (" number: " + device.get_number ()); + print (" sysfs_path: " + device.get_sysfs_path ()); + print (" driver: " + device.get_driver ()); + print (" action: " + device.get_action ()); + print (" seqnum: " + device.get_seqnum ()); + print (" device type: " + device.get_device_type ()); + print (" device number: " + device.get_device_number ()); + print (" device file: " + device.get_device_file ()); + print (" device file symlinks: " + device.get_device_file_symlinks ()); + print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); + var keys = device.get_property_keys (); + for (var n = 0; n < keys.length; n++) { + print (" " + keys[n] + "=" + device.get_property (keys[n])); + } +} + +function on_uevent (client, action, device) { + print ("action " + action + " on device " + device.get_sysfs_path()); + print_device (device); + print (""); +} + +var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); +client.signal.connect ("uevent", on_uevent); + +var block_devices = client.query_by_subsystem ("block"); +for (var n = 0; n < block_devices.length; n++) { + print ("block device: " + block_devices[n].get_device_file ()); +} + +var d; + +d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); +if (d == null) { + print ("query_by_device_number 0x810 -> null"); +} else { + print ("query_by_device_number 0x810 -> " + d.get_device_file ()); + dd = d.get_parent_with_subsystem ("usb", null); + print_device (dd); + print ("--------------------------------------------------------------------------"); + while (d != null) { + print_device (d); + print (""); + d = d.get_parent (); + } +} + +d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); +print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); + +d = client.query_by_subsystem_and_name ("block", "sda2"); +print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/sda"); +print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/block/8:0"); +print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); + +var mainloop = GLib.main_loop_new (); +GLib.main_loop_run (mainloop); diff --git a/src/extras/keymap/.gitignore b/src/extras/keymap/.gitignore new file mode 100644 index 0000000000..01d62e2b6e --- /dev/null +++ b/src/extras/keymap/.gitignore @@ -0,0 +1,6 @@ +keyboard-force-release.sh +keymap +keys-from-name.gperf +keys-from-name.h +keys-to-name.h +keys.txt diff --git a/src/extras/keymap/95-keyboard-force-release.rules b/src/extras/keymap/95-keyboard-force-release.rules new file mode 100644 index 0000000000..79a1bc1cc4 --- /dev/null +++ b/src/extras/keymap/95-keyboard-force-release.rules @@ -0,0 +1,53 @@ +# Set model specific atkbd force_release quirk +# +# Several laptops have hotkeys which don't generate release events, +# which can cause problems with software key repeat. +# The atkbd driver has a quirk handler for generating synthetic +# release events, which can be configured via sysfs since 2.6.32. +# Simply add a file with a list of scancodes for your laptop model +# in /usr/lib/udev/keymaps, and add a rule here. +# If the hotkeys also need a keymap assignment you can copy the +# scancodes from the keymap file, otherwise you can run +# /usr/lib/udev/keymap -i /dev/input/eventX +# on a Linux vt to find out. + +ACTION=="remove", GOTO="force_release_end" +SUBSYSTEM!="serio", GOTO="force_release_end" +KERNEL!="serio*", GOTO="force_release_end" +DRIVER!="atkbd", GOTO="force_release_end" + +ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" + +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.sh $devpath samsung-other" + +ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*|Precision M*", RUN+="keyboard-force-release.sh $devpath dell-touchpad" + +ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u|AMILO Xi 2428", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="FOXCONN", ATTR{[dmi/id]product_name}=="QBOOK", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite [uU]300*|Satellite Pro [uU]300*|Satellite [uU]305*|SATELLITE [uU]500*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +# These are all the HP laptops that setup a touchpad toggle key +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keyboard-force-release.sh $devpath hp-other" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keyboard-force-release.sh $devpath hp-other" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keyboard-force-release.sh $devpath hp-other" + +ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote 6615WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="6625WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="HANNspree", ATTR{[dmi/id]product_name}=="SN10E100", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="GIGABYTE", ATTR{[dmi/id]product_name}=="i1520M", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="BenQ", ATTR{[dmi/id]product_name}=="*nScreen*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +LABEL="force_release_end" diff --git a/src/extras/keymap/95-keymap.rules b/src/extras/keymap/95-keymap.rules new file mode 100644 index 0000000000..1ec18b7f55 --- /dev/null +++ b/src/extras/keymap/95-keymap.rules @@ -0,0 +1,164 @@ +# Set model specific hotkey keycodes. +# +# Key map overrides can be specified by either giving scancode/keyname pairs +# directly as keymap arguments (if there are just one or two to change), or as +# a file name (in /usr/lib/udev/keymaps), which has to contain scancode/keyname +# pairs. + +ACTION=="remove", GOTO="keyboard_end" +KERNEL!="event*", GOTO="keyboard_end" +ENV{ID_INPUT_KEY}=="", GOTO="keyboard_end" +SUBSYSTEMS=="bluetooth", GOTO="keyboard_end" + +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" +SUBSYSTEMS=="usb", GOTO="keyboard_usbcheck" +GOTO="keyboard_modulecheck" + +# +# The following are external USB keyboards +# + +LABEL="keyboard_usbcheck" + +ENV{ID_VENDOR}=="Genius", ENV{ID_MODEL_ID}=="0708", ENV{ID_USB_INTERFACE_NUM}=="01", RUN+="keymap $name genius-slimstar-320" +ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" +ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" +# Logitech Cordless Wave Pro looks slightly weird; some hotkeys are coming through the mouse interface +ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c52[9b]", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" + +ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" +ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" + +ENV{ID_VENDOR}=="Microsoft", ENV{ID_MODEL_ID}=="00db", RUN+="keymap $name 0xc022d zoomin 0xc022e zoomout" + +GOTO="keyboard_end" + +# +# The following are exposed as separate input devices with low key codes, thus +# we need to check their input device product name +# + +LABEL="keyboard_modulecheck" + +ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" +ENV{DMI_VENDOR}=="", GOTO="keyboard_end" + +ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-lenovo" +ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="Lenovo ThinkPad SL Series extra buttons", RUN+="keymap $name 0x0E bluetooth" + +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys|Asus Laptop Support|Asus*WMI*", RUN+="keymap $name 0x6B f21" +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC Hotkey Driver", RUN+="keymap $name 0x37 f21" + +ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" +ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" +ENV{DMI_VENDOR}=="Acer*", KERNELS=="input*", ATTRS{name}=="Acer WMI hotkeys", RUN+="keymap $name 0x82 f21" +ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", KERNELS=="input*", ATTRS{name}=="MSI Laptop hotkeys", RUN+="keymap $name 0x213 f22 0x214 f23" + +# Older Vaios have some different keys +ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" + +# Some Sony VGN models have yet another one +ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="VGN-AR71*|VGN-FW*|VGN-Z21*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-vgn" + + +# +# The following rules belong to standard i8042 AT keyboard with high key codes. +# + +DRIVERS=="atkbd", GOTO="keyboard_vendorcheck" +GOTO="keyboard_end" + +LABEL="keyboard_vendorcheck" + +ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1010|Inspiron 1011|Inspiron 1012|Inspiron 1110|Inspiron 1210", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Latitude XT2", RUN+="keymap $name dell-latitude-xt2" + +ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" + +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x6_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X2[02]* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x200_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" +ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" + +ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keymap $name hewlett-packard-pavilion" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*|*2230s*", RUN+="keymap $name hewlett-packard-compaq_elitebook" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keymap $name hewlett-packard-2510p_2530p" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www" +# HP Pavillion dv6315ea has empty DMI_VENDOR +ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play + +# Gateway clone of Acer Aspire One AOA110/AOA150 +ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer" + +ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C3[01]0*", RUN+="keymap $name acer-travelmate_c300" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|TravelMate*7720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*4720*", RUN+="keymap $name 0xB2 www 0xEE screenlock" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 8930", RUN+="keymap $name acer-aspire_8930" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_serial}=="ZG8*", RUN+="keymap $name acer-aspire_5720" + +ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" + +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro V3205*", RUN+="keymap $name fujitsu-amilo_pro_v3205" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pa 2548*", RUN+="keymap $name fujitsu-amilo_pa_2548" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V5*", RUN+="keymap $name fujitsu-esprimo_mobile_v5" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V6*", RUN+="keymap $name fujitsu-esprimo_mobile_v6" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro Edition V3505*", RUN+="keymap $name fujitsu-amilo_pro_edition_v3505" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+="keymap $name fujitsu-amilo_si_1520" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="Amilo Li 1718", RUN+="keymap $name 0xD6 wlan" + +ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name lg-x110" + +ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" +ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" + +ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", RUN+="keymap $name micro-star" + +# some MSI models generate ACPI/input events on the LNXVIDEO input devices, +# plus some extra synthesized ones on atkbd as an echo of actually changing the +# brightness; so ignore those atkbd ones, to avoid loops +ENV{DMI_VENDOR}=="MICRO-STAR*", ATTR{[dmi/id]product_name}=="*U-100*|*U100*|*N033", RUN+="keymap $name 0xF7 reserved 0xF8 reserved" + +ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" + +ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" + +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" + +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite M30X", RUN+="keymap $name toshiba-satellite_m30x" + +ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" + +ENV{DMI_VENDOR}=="ONKYO CORPORATION", ATTR{[dmi/id]product_name}=="ONKYOPC", RUN+="keymap $name onkyo" + +ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" + +ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name 0x81 prog1" + +ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="62*|63*", RUN+="keymap $name zepto-znote" + +ENV{DMI_VENDOR}=="Everex", ATTR{[dmi/id]product_name}=="XT5000*", RUN+="keymap $name everex-xt5000" + +ENV{DMI_VENDOR}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name 0x84 wlan" + +ENV{DMI_VENDOR}=="OLPC", ATTR{[dmi/id]product_name}=="XO", RUN+="keymap $name olpc-xo" + +LABEL="keyboard_end" diff --git a/src/extras/keymap/README.keymap.txt b/src/extras/keymap/README.keymap.txt new file mode 100644 index 0000000000..52d50ed2de --- /dev/null +++ b/src/extras/keymap/README.keymap.txt @@ -0,0 +1,101 @@ += The udev keymap tool = + +== Introduction == + +This udev extension configures computer model specific key mappings. This is +particularly necessary for the non-standard extra keys found on many laptops, +such as "brightness up", "next song", "www browser", or "suspend". Often these +are accessed with the Fn key. + +Every key produces a "scan code", which is highly vendor/model specific for the +nonstandard keys. This tool maintains mappings for these scan codes to standard +"key codes", which denote the "meaning" of the key. The key codes are defined +in /usr/include/linux/input.h. + +If some of your keys on your keyboard are not working at all, or produce the +wrong effect, then a very likely cause of this is that the scan code -> key +code mapping is incorrect on your computer. + +== Structure == + +udev-keymap consists of the following parts: + + keymaps/*:: mappings of scan codes to key code names + + 95-keymap.rules:: udev rules for mapping system vendor/product names and + input module names to one of the keymaps above + + keymap:: manipulate an evdev input device: + * write a key map file into a device (used by udev rules) + * dump current scan → key code mapping + * interactively display scan and key codes of pressed keys + + findkeyboards:: display evdev input devices which belong to actual keyboards, + i. e. those suitable for the keymap program + + fdi2rules.py:: convert hal keymap FDIs into udev rules and key map files + (Please note that this is far from perfect, since the mapping between fdi and + udev rules is not straightforward, and impossible in some cases.) + +== Fixing broken keys == + +In order to make a broken key work on your system and send it back to upstream +for inclusion you need to do the following steps: + + 1. Find the keyboard device. + + Run /usr/lib/udev/findkeyboards. This should always give you an "AT + keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and + Acers) have multimedia/function keys on a separate input device instead of the + primary keyboard. The keyboard device should have a name like "input/event3". + In the following commands, the name will be written as "input/eventX" (replace + X with the appropriate number). + + 2. Find broken scan codes: + + sudo /usr/lib/udev/keymap -i input/eventX + + Press all multimedia/function keys and check if the key name that gets printed + out is plausible. If it is unknown or wrong, write down the scan code (looks + like "0x1E") and the intended functionality of this key. Look in + /usr/include/linux/input.h for an available KEY_XXXXX constant which most + closely approximates this functionality and write it down as the new key code. + + For example, you might press a key labeled "web browser" which currently + produces "unknown". Note down this: + + 0x1E www # Fn+F2 web browser + + Repeat that for all other keys. Write the resulting list into a file. Look at + /usr/lib/udev/keymaps/ for existing key map files and make sure that you use the + same structure. + + If the key only ever works once and then your keyboard (or the entire desktop) + gets stuck for a long time, then it is likely that the BIOS fails to send a + corresponding "key release" event after the key press event. Please note down + this case as well, as it can be worked around in + /usr/lib/udev/keymaps/95-keyboard-force-release.rules . + + 3. Find out your system vendor and product: + + cat /sys/class/dmi/id/sys_vendor + cat /sys/class/dmi/id/product_name + + 4. Generate a device dump with "udevadm info --export-db > /tmp/udev-db.txt". + + 6. Send the system vendor/product names, the key mapping from step 2, + and /tmp/udev-db.txt from step 4 to the linux-hotplug@vger.kernel.org mailing + list, so that they can be included in the next release. + +For local testing, copy your map file to /usr/lib/udev/keymaps/ with an appropriate +name, and add an appropriate udev rule to /usr/lib/udev/rules.d/95-keymap.rules: + + * If you selected an "AT keyboard", add the rule to the section after + 'LABEL="keyboard_vendorcheck"'. + + * If you selected a "module", add the rule to the top section where the + "ThinkPad Extra Buttons" are. + +== Author == + +keymap is written and maintained by Martin Pitt . diff --git a/src/extras/keymap/check-keymaps.sh b/src/extras/keymap/check-keymaps.sh new file mode 100755 index 0000000000..ea77b69c24 --- /dev/null +++ b/src/extras/keymap/check-keymaps.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +# check that all key names in keymaps/* are known in +# and that all key maps listed in the rules are valid and present in +# Makefile.am +SRCDIR=${1:-.} +KEYLIST=${2:-src/extras/keymap/keys.txt} +KEYMAPS_DIR=$SRCDIR/src/extras/keymap/keymaps #extras/keymap/keymaps +RULES=$SRCDIR/src/extras/keymap/95-keymap.rules + +[ -e "$KEYLIST" ] || { + echo "need $KEYLIST please build first" >&2 + exit 1 +} + +missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) \ + <(grep -hv '^#' ${KEYMAPS_DIR}/*| awk '{print $2}' | sort -u)) +[ -z "$missing" ] || { + echo "ERROR: unknown key names in extras/keymap/keymaps/*:" >&2 + echo "$missing" >&2 + exit 1 +} + +# check that all maps referred to in $RULES exist +maps=$(sed -rn '/keymap \$name/ { s/^.*\$name ([^"[:space:]]+).*$/\1/; p }' $RULES) +for m in $maps; do + # ignore inline mappings + [ "$m" = "${m#0x}" ] || continue + + [ -e ${KEYMAPS_DIR}/$m ] || { + echo "ERROR: unknown map name in $RULES: $m" >&2 + exit 1 + } + grep -q "extras/keymap/keymaps/$m\>" $SRCDIR/Makefile.am || { + echo "ERROR: map file $m is not added to Makefile.am" >&2 + exit 1 + } +done diff --git a/src/extras/keymap/findkeyboards b/src/extras/keymap/findkeyboards new file mode 100755 index 0000000000..eba3737a96 --- /dev/null +++ b/src/extras/keymap/findkeyboards @@ -0,0 +1,71 @@ +#!/usr/bin/env sh +# Find "real" keyboard devices and print their device path. +# Author: Martin Pitt +# +# Copyright (C) 2009, Canonical Ltd. +# +# 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; either version 2 of the License, or +# (at your option) any later version. +# +# 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. + +set -e + +# returns OK if $1 contains $2 +strstr() { + [ "${1#*$2*}" != "$1" ] +} + +# returns OK if $1 contains $2 at the beginning +str_starts() { + [ "${1#$2*}" != "$1" ] +} + +str_line_starts() { + while read a; do str_starts "$a" "$1" && return 0;done + return 1; +} + +# print a list of input devices which are keyboard-like +keyboard_devices() { + # standard AT keyboard + for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do + walk=`udevadm info --attribute-walk --path=$dev` + env=`udevadm info --query=env --path=$dev` + # filter out non-event devices, such as the parent input devices which + # have no devnode + if ! echo "$env" | str_line_starts 'DEVNAME='; then + continue + fi + if strstr "$walk" 'DRIVERS=="atkbd"'; then + echo -n 'AT keyboard: ' + elif echo "$env" | str_line_starts 'ID_USB_DRIVER=usbhid'; then + echo -n 'USB keyboard: ' + else + echo -n 'Unknown type: ' + fi + udevadm info --query=name --path=$dev + done + + # modules + module=$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons') + module="$module +$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons')" + module="$module +$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys')" + for m in $module; do + for evdev in $m/event*/dev; do + if [ -e "$evdev" ]; then + echo -n 'module: ' + udevadm info --query=name --path=${evdev%%/dev} + fi + done + done +} + +keyboard_devices diff --git a/src/extras/keymap/force-release-maps/common-volume-keys b/src/extras/keymap/force-release-maps/common-volume-keys new file mode 100644 index 0000000000..3a7654d735 --- /dev/null +++ b/src/extras/keymap/force-release-maps/common-volume-keys @@ -0,0 +1,3 @@ +0xa0 #mute +0xae #volume down +0xb0 #volume up diff --git a/src/extras/keymap/force-release-maps/dell-touchpad b/src/extras/keymap/force-release-maps/dell-touchpad new file mode 100644 index 0000000000..18e9bdee66 --- /dev/null +++ b/src/extras/keymap/force-release-maps/dell-touchpad @@ -0,0 +1 @@ +0x9E diff --git a/src/extras/keymap/force-release-maps/hp-other b/src/extras/keymap/force-release-maps/hp-other new file mode 100644 index 0000000000..6621370095 --- /dev/null +++ b/src/extras/keymap/force-release-maps/hp-other @@ -0,0 +1,3 @@ +# list of scancodes (hex or decimal), optional comment +0xd8 # Touchpad off +0xd9 # Touchpad on diff --git a/src/extras/keymap/force-release-maps/samsung-other b/src/extras/keymap/force-release-maps/samsung-other new file mode 100644 index 0000000000..c51123a0b6 --- /dev/null +++ b/src/extras/keymap/force-release-maps/samsung-other @@ -0,0 +1,10 @@ +# list of scancodes (hex or decimal), optional comment +0x82 # Fn+F4 CRT/LCD +0x83 # Fn+F2 battery +0x84 # Fn+F5 backlight on/off +0x86 # Fn+F9 WLAN +0x88 # Fn-Up brightness up +0x89 # Fn-Down brightness down +0xB3 # Fn+F8 switch power mode (battery/dynamic/performance) +0xF7 # Fn+F10 Touchpad on +0xF9 # Fn+F10 Touchpad off diff --git a/src/extras/keymap/keyboard-force-release.sh.in b/src/extras/keymap/keyboard-force-release.sh.in new file mode 100755 index 0000000000..154be3d733 --- /dev/null +++ b/src/extras/keymap/keyboard-force-release.sh.in @@ -0,0 +1,22 @@ +#!@rootprefix@/bin/sh -e +# read list of scancodes, convert hex to decimal and +# append to the atkbd force_release sysfs attribute +# $1 sysfs devpath for serioX +# $2 file with scancode list (hex or dec) + +case "$2" in + /*) scf="$2" ;; + *) scf="@pkglibexecdir@/keymaps/force-release/$2" ;; +esac + +read attr <"/sys/$1/force_release" +while read scancode dummy; do + case "$scancode" in + \#*) ;; + *) + scancode=$(($scancode)) + attr="$attr${attr:+,}$scancode" + ;; + esac +done <"$scf" +echo "$attr" >"/sys/$1/force_release" diff --git a/src/extras/keymap/keymap.c b/src/extras/keymap/keymap.c new file mode 100644 index 0000000000..6bcfaefa18 --- /dev/null +++ b/src/extras/keymap/keymap.c @@ -0,0 +1,447 @@ +/* + * keymap - dump keymap of an evdev device or set a new keymap from a file + * + * Based on keyfuzz by Lennart Poettering + * Adapted for udev-extras by Martin Pitt + * + * Copyright (C) 2006, Lennart Poettering + * Copyright (C) 2009, Canonical Ltd. + * + * keymap 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; either version 2 of the License, or + * (at your option) any later version. + * + * keymap 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 keymap; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const struct key* lookup_key (const char *str, unsigned int len); + +#include "keys-from-name.h" +#include "keys-to-name.h" + +#define MAX_SCANCODES 1024 + +static int evdev_open(const char *dev) +{ + int fd; + char fn[PATH_MAX]; + + if (strncmp(dev, "/dev", 4) != 0) { + snprintf(fn, sizeof(fn), "/dev/%s", dev); + dev = fn; + } + + if ((fd = open(dev, O_RDWR)) < 0) { + fprintf(stderr, "error open('%s'): %m\n", dev); + return -1; + } + return fd; +} + +static int evdev_get_keycode(int fd, int scancode, int e) +{ + int codes[2]; + + codes[0] = scancode; + if (ioctl(fd, EVIOCGKEYCODE, codes) < 0) { + if (e && errno == EINVAL) { + return -2; + } else { + fprintf(stderr, "EVIOCGKEYCODE: %m\n"); + return -1; + } + } + return codes[1]; +} + +static int evdev_set_keycode(int fd, int scancode, int keycode) +{ + int codes[2]; + + codes[0] = scancode; + codes[1] = keycode; + + if (ioctl(fd, EVIOCSKEYCODE, codes) < 0) { + fprintf(stderr, "EVIOCSKEYCODE: %m\n"); + return -1; + } + return 0; +} + +static int evdev_driver_version(int fd, char *v, size_t l) +{ + int version; + + if (ioctl(fd, EVIOCGVERSION, &version)) { + fprintf(stderr, "EVIOCGVERSION: %m\n"); + return -1; + } + + snprintf(v, l, "%i.%i.%i.", version >> 16, (version >> 8) & 0xff, version & 0xff); + return 0; +} + +static int evdev_device_name(int fd, char *n, size_t l) +{ + if (ioctl(fd, EVIOCGNAME(l), n) < 0) { + fprintf(stderr, "EVIOCGNAME: %m\n"); + return -1; + } + return 0; +} + +/* Return a lower-case string with KEY_ prefix removed */ +static const char* format_keyname(const char* key) { + static char result[101]; + const char* s; + int len; + + for (s = key+4, len = 0; *s && len < 100; ++len, ++s) + result[len] = tolower(*s); + result[len] = '\0'; + return result; +} + +static int dump_table(int fd) { + char version[256], name[256]; + int scancode, r = -1; + + if (evdev_driver_version(fd, version, sizeof(version)) < 0) + goto fail; + + if (evdev_device_name(fd, name, sizeof(name)) < 0) + goto fail; + + printf("### evdev %s, driver '%s'\n", version, name); + + r = 0; + for (scancode = 0; scancode < MAX_SCANCODES; scancode++) { + int keycode; + + if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { + if (keycode == -2) + continue; + r = -1; + break; + } + + if (keycode < KEY_MAX && key_names[keycode]) + printf("0x%03x %s\n", scancode, format_keyname(key_names[keycode])); + else + printf("0x%03x 0x%03x\n", scancode, keycode); + } +fail: + return r; +} + +static void set_key(int fd, const char* scancode_str, const char* keyname) +{ + unsigned scancode; + char *endptr; + char t[105] = "KEY_UNKNOWN"; + const struct key *k; + + scancode = (unsigned) strtol(scancode_str, &endptr, 0); + if (*endptr != '\0') { + fprintf(stderr, "ERROR: Invalid scancode\n"); + exit(1); + } + + snprintf(t, sizeof(t), "KEY_%s", keyname); + + if (!(k = lookup_key(t, strlen(t)))) { + fprintf(stderr, "ERROR: Unknown key name '%s'\n", keyname); + exit(1); + } + + if (evdev_set_keycode(fd, scancode, k->id) < 0) + fprintf(stderr, "setting scancode 0x%2X to key code %i failed\n", + scancode, k->id); + else + printf("setting scancode 0x%2X to key code %i\n", + scancode, k->id); +} + +static int merge_table(int fd, FILE *f) { + int r = 0; + int line = 0; + + while (!feof(f)) { + char s[256], *p; + int scancode, new_keycode, old_keycode; + + if (!fgets(s, sizeof(s), f)) + break; + + line++; + p = s+strspn(s, "\t "); + if (*p == '#' || *p == '\n') + continue; + + if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) { + char t[105] = "KEY_UNKNOWN"; + const struct key *k; + + if (sscanf(p, "%i %100s", &scancode, t+4) != 2) { + fprintf(stderr, "WARNING: Parse failure at line %i, ignoring.\n", line); + r = -1; + continue; + } + + if (!(k = lookup_key(t, strlen(t)))) { + fprintf(stderr, "WARNING: Unknown key '%s' at line %i, ignoring.\n", t, line); + r = -1; + continue; + } + + new_keycode = k->id; + } + + + if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0) { + r = -1; + goto fail; + } + + if (evdev_set_keycode(fd, scancode, new_keycode) < 0) { + r = -1; + goto fail; + } + + if (new_keycode != old_keycode) + fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x (prior: 0x%02x)\n", + scancode, new_keycode, old_keycode); + } +fail: + fclose(f); + return r; +} + + +/* read one event; return 1 if valid */ +static int read_event(int fd, struct input_event* ev) +{ + int ret; + ret = read(fd, ev, sizeof(struct input_event)); + + if (ret < 0) { + perror("read"); + return 0; + } + if (ret != sizeof(struct input_event)) { + fprintf(stderr, "did not get enough data for event struct, aborting\n"); + return 0; + } + + return 1; +} + +static void print_key(uint32_t scancode, uint16_t keycode, int has_scan, int has_key) +{ + const char *keyname; + + /* ignore key release events */ + if (has_key == 1) + return; + + if (has_key == 0 && has_scan != 0) { + fprintf(stderr, "got scan code event 0x%02X without a key code event\n", + scancode); + return; + } + + if (has_scan != 0) + printf("scan code: 0x%02X ", scancode); + else + printf("(no scan code received) "); + + keyname = key_names[keycode]; + if (keyname != NULL) + printf("key code: %s\n", format_keyname(keyname)); + else + printf("key code: %03X\n", keycode); +} + +static void interactive(int fd) +{ + struct input_event ev; + uint32_t last_scan = 0; + uint16_t last_key = 0; + int has_scan; /* boolean */ + int has_key; /* 0: none, 1: release, 2: press */ + + /* grab input device */ + ioctl(fd, EVIOCGRAB, 1); + puts("Press ESC to finish, or Control-C if this device is not your primary keyboard"); + + has_scan = has_key = 0; + while (read_event(fd, &ev)) { + /* Drivers usually send the scan code first, then the key code, + * then a SYN. Some drivers (like thinkpad_acpi) send the key + * code first, and some drivers might not send SYN events, so + * keep a robust state machine which can deal with any of those + */ + + if (ev.type == EV_MSC && ev.code == MSC_SCAN) { + if (has_scan) { + fputs("driver did not send SYN event in between key events; previous event:\n", + stderr); + print_key(last_scan, last_key, has_scan, has_key); + has_key = 0; + } + + last_scan = ev.value; + has_scan = 1; + /*printf("--- got scan %u; has scan %i key %i\n", last_scan, has_scan, has_key); */ + } + else if (ev.type == EV_KEY) { + if (has_key) { + fputs("driver did not send SYN event in between key events; previous event:\n", + stderr); + print_key(last_scan, last_key, has_scan, has_key); + has_scan = 0; + } + + last_key = ev.code; + has_key = 1 + ev.value; + /*printf("--- got key %hu; has scan %i key %i\n", last_key, has_scan, has_key);*/ + + /* Stop on ESC */ + if (ev.code == KEY_ESC && ev.value == 0) + break; + } + else if (ev.type == EV_SYN) { + /*printf("--- got SYN; has scan %i key %i\n", has_scan, has_key);*/ + print_key(last_scan, last_key, has_scan, has_key); + + has_scan = has_key = 0; + } + + } + + /* release input device */ + ioctl(fd, EVIOCGRAB, 0); +} + +static void help(int error) +{ + const char* h = "Usage: keymap []\n" + " keymap scancode keyname [...]\n" + " keymap -i \n"; + if (error) { + fputs(h, stderr); + exit(2); + } else { + fputs(h, stdout); + exit(0); + } +} + +int main(int argc, char **argv) +{ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "interactive", no_argument, NULL, 'i' }, + {} + }; + int fd = -1; + int opt_interactive = 0; + int i; + + while (1) { + int option; + + option = getopt_long(argc, argv, "hi", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + help(0); + + case 'i': + opt_interactive = 1; + break; + default: + return 1; + } + } + + if (argc < optind+1) + help (1); + + if ((fd = evdev_open(argv[optind])) < 0) + return 3; + + /* one argument (device): dump or interactive */ + if (argc == optind+1) { + if (opt_interactive) + interactive(fd); + else + dump_table(fd); + return 0; + } + + /* two arguments (device, mapfile): set map file */ + if (argc == optind+2) { + const char *filearg = argv[optind+1]; + if (strchr(filearg, '/')) { + /* Keymap file argument is a path */ + FILE *f = fopen(filearg, "r"); + if (f) + merge_table(fd, f); + else + perror(filearg); + } else { + /* Keymap file argument is a filename */ + /* Open override file if present, otherwise default file */ + char keymap_path[PATH_MAX]; + snprintf(keymap_path, sizeof(keymap_path), "%s%s", SYSCONFDIR "/udev/keymaps/", filearg); + FILE *f = fopen(keymap_path, "r"); + if (f) { + merge_table(fd, f); + } else { + snprintf(keymap_path, sizeof(keymap_path), "%s%s", PKGLIBEXECDIR "/keymaps/", filearg); + f = fopen(keymap_path, "r"); + if (f) + merge_table(fd, f); + else + perror(keymap_path); + } + } + return 0; + } + + /* more arguments (device, scancode/keyname pairs): set keys directly */ + if ((argc - optind - 1) % 2 == 0) { + for (i = optind+1; i < argc; i += 2) + set_key(fd, argv[i], argv[i+1]); + return 0; + } + + /* invalid number of arguments */ + help(1); + return 1; /* not reached */ +} diff --git a/src/extras/keymap/keymaps/acer b/src/extras/keymap/keymaps/acer new file mode 100644 index 0000000000..4e7c297dea --- /dev/null +++ b/src/extras/keymap/keymaps/acer @@ -0,0 +1,22 @@ +0xA5 help # Fn+F1 +0xA6 setup # Fn+F2 Acer eSettings +0xA7 battery # Fn+F3 Power Management +0xA9 switchvideomode # Fn+F5 +0xB3 euro +0xB4 dollar +0xCE brightnessup # Fn+Right +0xD4 bluetooth # (toggle) off-to-on +0xD5 wlan # (toggle) on-to-off +0xD6 wlan # (toggle) off-to-on +0xD7 bluetooth # (toggle) on-to-off +0xD8 bluetooth # (toggle) off-to-on +0xD9 brightnessup # Fn+Right +0xEE brightnessup # Fn+Right +0xEF brightnessdown # Fn+Left +0xF1 f22 # Fn+F7 Touchpad toggle (off-to-on) +0xF2 f23 # Fn+F7 Touchpad toggle (on-to-off) +0xF3 prog2 # "P2" programmable button +0xF4 prog1 # "P1" programmable button +0xF5 presentation +0xF8 fn +0xF9 f23 # Launch NTI shadow diff --git a/src/extras/keymap/keymaps/acer-aspire_5720 b/src/extras/keymap/keymaps/acer-aspire_5720 new file mode 100644 index 0000000000..c4a8459367 --- /dev/null +++ b/src/extras/keymap/keymaps/acer-aspire_5720 @@ -0,0 +1,4 @@ +0x84 bluetooth # sent when bluetooth module missing, and key pressed +0x92 media # acer arcade +0xD4 bluetooth # bluetooth on +0xD9 bluetooth # bluetooth off diff --git a/src/extras/keymap/keymaps/acer-aspire_5920g b/src/extras/keymap/keymaps/acer-aspire_5920g new file mode 100644 index 0000000000..633c4e854c --- /dev/null +++ b/src/extras/keymap/keymaps/acer-aspire_5920g @@ -0,0 +1,5 @@ +0x8A media +0x92 media +0xA6 setup +0xB2 www +0xD9 bluetooth # (toggle) on-to-off diff --git a/src/extras/keymap/keymaps/acer-aspire_6920 b/src/extras/keymap/keymaps/acer-aspire_6920 new file mode 100644 index 0000000000..699c954b4e --- /dev/null +++ b/src/extras/keymap/keymaps/acer-aspire_6920 @@ -0,0 +1,5 @@ +0xD9 bluetooth # (toggle) on-to-off +0x92 media +0x9E back +0x83 rewind +0x89 fastforward diff --git a/src/extras/keymap/keymaps/acer-aspire_8930 b/src/extras/keymap/keymaps/acer-aspire_8930 new file mode 100644 index 0000000000..fb27bfb4f5 --- /dev/null +++ b/src/extras/keymap/keymaps/acer-aspire_8930 @@ -0,0 +1,5 @@ +0xCA prog3 # key 'HOLD' on cine dash media console +0x83 rewind +0x89 fastforward +0x92 media # key 'ARCADE' on cine dash media console +0x9E back diff --git a/src/extras/keymap/keymaps/acer-travelmate_c300 b/src/extras/keymap/keymaps/acer-travelmate_c300 new file mode 100644 index 0000000000..bfef4cf868 --- /dev/null +++ b/src/extras/keymap/keymaps/acer-travelmate_c300 @@ -0,0 +1,5 @@ +0x67 f24 # FIXME: rotate screen +0x68 up +0x69 down +0x6B fn +0x6C screenlock # FIXME: lock tablet device/buttons diff --git a/src/extras/keymap/keymaps/asus b/src/extras/keymap/keymaps/asus new file mode 100644 index 0000000000..2a5995f982 --- /dev/null +++ b/src/extras/keymap/keymaps/asus @@ -0,0 +1,3 @@ +0xED volumeup +0xEE volumedown +0xEF mute diff --git a/src/extras/keymap/keymaps/compaq-e_evo b/src/extras/keymap/keymaps/compaq-e_evo new file mode 100644 index 0000000000..5fbc573aa4 --- /dev/null +++ b/src/extras/keymap/keymaps/compaq-e_evo @@ -0,0 +1,4 @@ +0xA3 www # I key +0x9A search +0x9E email +0x9F homepage diff --git a/src/extras/keymap/keymaps/dell b/src/extras/keymap/keymaps/dell new file mode 100644 index 0000000000..4f907b3eef --- /dev/null +++ b/src/extras/keymap/keymaps/dell @@ -0,0 +1,29 @@ +0x81 playpause # Play/Pause +0x82 stopcd # Stop +0x83 previoussong # Previous song +0x84 nextsong # Next song +0x85 brightnessdown # Fn+Down arrow Brightness Down +0x86 brightnessup # Fn+Up arrow Brightness Up +0x87 battery # Fn+F3 battery icon +0x88 unknown # Fn+F2 Turn On/Off Wireless - handled in hardware +0x89 ejectclosecd # Fn+F10 Eject CD +0x8A suspend # Fn+F1 hibernate +0x8B switchvideomode # Fn+F8 CRT/LCD (high keycode: "displaytoggle") +0x8C f23 # Fn+Right arrow Auto Brightness +0x8F switchvideomode # Fn+F7 aspect ratio +0x90 previoussong # Front panel previous song +0x91 prog1 # Wifi Catcher (DELL Specific) +0x92 media # MediaDirect button (house icon) +0x93 f23 # FIXME Fn+Left arrow Auto Brightness +0x95 camera # Shutter button Takes a picture if optional camera available +0x97 email # Tablet email button +0x98 f21 # FIXME: Tablet screen rotatation +0x99 nextsong # Front panel next song +0x9A setup # Tablet tools button +0x9B switchvideomode # Display Toggle button +0x9E f21 #touchpad toggle +0xA2 playpause # Front panel play/pause +0xA4 stopcd # Front panel stop +0xED media # MediaDirect button +0xD8 screenlock # FIXME: Tablet lock button +0xD9 f21 # touchpad toggle diff --git a/src/extras/keymap/keymaps/dell-latitude-xt2 b/src/extras/keymap/keymaps/dell-latitude-xt2 new file mode 100644 index 0000000000..39872f559d --- /dev/null +++ b/src/extras/keymap/keymaps/dell-latitude-xt2 @@ -0,0 +1,4 @@ +0x9B up # tablet rocker up +0x9E enter # tablet rocker press +0x9F back # tablet back +0xA3 down # tablet rocker down diff --git a/src/extras/keymap/keymaps/everex-xt5000 b/src/extras/keymap/keymaps/everex-xt5000 new file mode 100644 index 0000000000..4823a832f5 --- /dev/null +++ b/src/extras/keymap/keymaps/everex-xt5000 @@ -0,0 +1,7 @@ +0x5C media +0x65 f21 # Fn+F5 Touchpad toggle +0x67 prog3 # Fan Speed Control button +0x6F brightnessup +0x7F brightnessdown +0xB2 www +0xEC mail diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 b/src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 new file mode 100644 index 0000000000..f7b0c52444 --- /dev/null +++ b/src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 @@ -0,0 +1,3 @@ +0xE0 volumedown +0xE1 volumeup +0xE5 prog1 diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 b/src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 new file mode 100644 index 0000000000..d2e38cbb23 --- /dev/null +++ b/src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 @@ -0,0 +1,4 @@ +0xA5 help # Fn-F1 +0xA9 switchvideomode # Fn-F3 +0xD9 brightnessdown # Fn-F8 +0xE0 brightnessup # Fn-F9 diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 b/src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 new file mode 100644 index 0000000000..43e3199d59 --- /dev/null +++ b/src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 @@ -0,0 +1,2 @@ +0xF4 f21 # FIXME: silent-mode decrease CPU/GPU clock +0xF7 switchvideomode # Fn+F3 diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_si_1520 b/src/extras/keymap/keymaps/fujitsu-amilo_si_1520 new file mode 100644 index 0000000000..1419bd9b5e --- /dev/null +++ b/src/extras/keymap/keymaps/fujitsu-amilo_si_1520 @@ -0,0 +1,6 @@ +0xE1 wlan +0xF3 wlan +0xEE brightnessdown +0xE0 brightnessup +0xE2 bluetooth +0xF7 video diff --git a/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 b/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 new file mode 100644 index 0000000000..d3d056b366 --- /dev/null +++ b/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 @@ -0,0 +1,4 @@ +0xA9 switchvideomode +0xD9 brightnessdown +0xDF sleep +0xEF brightnessup diff --git a/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 b/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 new file mode 100644 index 0000000000..52c70c50cb --- /dev/null +++ b/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 @@ -0,0 +1,2 @@ +0xCE brightnessup +0xEF brightnessdown diff --git a/src/extras/keymap/keymaps/genius-slimstar-320 b/src/extras/keymap/keymaps/genius-slimstar-320 new file mode 100644 index 0000000000..d0a3656dd8 --- /dev/null +++ b/src/extras/keymap/keymaps/genius-slimstar-320 @@ -0,0 +1,35 @@ +# Genius SlimStar 320 +# +# Only buttons which are not properly mapped yet are configured below + +# "Scroll wheel", a circular up/down/left/right button. Aimed for scolling, +# but since there are no scrollleft/scrollright, let's map to back/forward. +0x900f0 scrollup +0x900f1 scrolldown +0x900f3 back +0x900f2 forward + +# Multimedia buttons, left side (from left to right) +# [W] +0x900f5 wordprocessor +# [Ex] +0x900f6 spreadsheet +# [P] +0x900f4 presentation +# Other five (calculator, playpause, stop, mute and eject) are OK + +# Right side, from left to right +# [e] +0xc0223 www +# "man" +0x900f7 chat +# "Y" +0x900fb prog1 +# [X] +0x900f8 close +# "picture" +0x900f9 graphicseditor +# "two windows" +0x900fd scale +# "lock" +0x900fc screenlock diff --git a/src/extras/keymap/keymaps/hewlett-packard b/src/extras/keymap/keymaps/hewlett-packard new file mode 100644 index 0000000000..4461fa2ce5 --- /dev/null +++ b/src/extras/keymap/keymaps/hewlett-packard @@ -0,0 +1,12 @@ +0x81 fn_esc +0x89 battery # FnF8 +0x8A screenlock # FnF6 +0x8B camera +0x8C media # music +0x8E dvd +0xB1 help +0xB3 f23 # FIXME: Auto brightness +0xD7 wlan +0x92 brightnessdown # FnF7 (FnF9 on 6730b) +0x97 brightnessup # FnF8 (FnF10 on 6730b) +0xEE switchvideomode # FnF4 diff --git a/src/extras/keymap/keymaps/hewlett-packard-2510p_2530p b/src/extras/keymap/keymaps/hewlett-packard-2510p_2530p new file mode 100644 index 0000000000..41ad2e9b5a --- /dev/null +++ b/src/extras/keymap/keymaps/hewlett-packard-2510p_2530p @@ -0,0 +1,2 @@ +0xD8 f23 # touchpad off +0xD9 f22 # touchpad on diff --git a/src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook b/src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook new file mode 100644 index 0000000000..42007c5483 --- /dev/null +++ b/src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook @@ -0,0 +1,2 @@ +0x88 presentation +0xD9 help # I key (high keycode: "info") diff --git a/src/extras/keymap/keymaps/hewlett-packard-pavilion b/src/extras/keymap/keymaps/hewlett-packard-pavilion new file mode 100644 index 0000000000..3d3cefc8e6 --- /dev/null +++ b/src/extras/keymap/keymaps/hewlett-packard-pavilion @@ -0,0 +1,3 @@ +0x88 media # FIXME: quick play +0xD8 f23 # touchpad off +0xD9 f22 # touchpad on diff --git a/src/extras/keymap/keymaps/hewlett-packard-presario-2100 b/src/extras/keymap/keymaps/hewlett-packard-presario-2100 new file mode 100644 index 0000000000..1df39dcbd2 --- /dev/null +++ b/src/extras/keymap/keymaps/hewlett-packard-presario-2100 @@ -0,0 +1,3 @@ +0xF0 help +0xF1 screenlock +0xF3 search diff --git a/src/extras/keymap/keymaps/hewlett-packard-tablet b/src/extras/keymap/keymaps/hewlett-packard-tablet new file mode 100644 index 0000000000..d19005ab90 --- /dev/null +++ b/src/extras/keymap/keymaps/hewlett-packard-tablet @@ -0,0 +1,6 @@ +0x82 prog2 # Funny Key +0x83 prog1 # Q +0x84 tab +0x85 esc +0x86 pageup +0x87 pagedown diff --git a/src/extras/keymap/keymaps/hewlett-packard-tx2 b/src/extras/keymap/keymaps/hewlett-packard-tx2 new file mode 100644 index 0000000000..36a690fcf6 --- /dev/null +++ b/src/extras/keymap/keymaps/hewlett-packard-tx2 @@ -0,0 +1,3 @@ +0xC2 media +0xD8 f23 # Toggle touchpad button on tx2 (OFF) +0xD9 f22 # Toggle touchpad button on tx2 (ON) diff --git a/src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint b/src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint new file mode 100644 index 0000000000..027e50bf88 --- /dev/null +++ b/src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint @@ -0,0 +1,7 @@ +0x900f0 screenlock +0x900f1 wlan +0x900f2 switchvideomode +0x900f3 suspend +0x900f4 brightnessup +0x900f5 brightnessdown +0x900f8 zoom diff --git a/src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 b/src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 new file mode 100644 index 0000000000..4a8b4ba5a7 --- /dev/null +++ b/src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 @@ -0,0 +1,2 @@ +0xF3 prog2 +0xF4 prog1 diff --git a/src/extras/keymap/keymaps/lenovo-3000 b/src/extras/keymap/keymaps/lenovo-3000 new file mode 100644 index 0000000000..5bd165654a --- /dev/null +++ b/src/extras/keymap/keymaps/lenovo-3000 @@ -0,0 +1,5 @@ +0x8B switchvideomode # Fn+F7 video +0x96 wlan # Fn+F5 wireless +0x97 sleep # Fn+F4 suspend +0x98 suspend # Fn+F12 hibernate +0xB4 prog1 # Lenovo Care diff --git a/src/extras/keymap/keymaps/lenovo-ideapad b/src/extras/keymap/keymaps/lenovo-ideapad new file mode 100644 index 0000000000..d5f25671a5 --- /dev/null +++ b/src/extras/keymap/keymaps/lenovo-ideapad @@ -0,0 +1,7 @@ +# Key codes observed on S10-3, assumed valid on other IdeaPad models +0x81 rfkill # does nothing in BIOS +0x83 display_off # BIOS toggles screen state +0xB9 brightnessup # does nothing in BIOS +0xBA brightnessdown # does nothing in BIOS +0xF1 camera # BIOS toggles camera power +0xf2 unknown # trackpad enable/disable (does nothing in BIOS) diff --git a/src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint b/src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint new file mode 100644 index 0000000000..47e8846a68 --- /dev/null +++ b/src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint @@ -0,0 +1,13 @@ +0x90012 screenlock # Fn+F2 +0x90013 battery # Fn+F3 +0x90014 wlan # Fn+F5 +0x90016 switchvideomode # Fn+F7 +0x90017 f21 # Fn+F8 touchpadtoggle +0x90019 suspend # Fn+F12 +0x9001A brightnessup # Fn+Home +0x9001B brightnessdown # Fn+End +0x9001D zoom # Fn+Space +0x90011 prog1 # Thinkvantage button + +0x90015 camera # Fn+F6 headset/camera VoIP key ?? +0x90010 micmute # Microphone mute button diff --git a/src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet b/src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet new file mode 100644 index 0000000000..31ea3b2c70 --- /dev/null +++ b/src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet @@ -0,0 +1,6 @@ +0x5D menu +0x63 fn +0x66 screenlock +0x67 cyclewindows # bezel circular arrow +0x68 setup # bezel setup / menu +0x6c direction # rotate screen diff --git a/src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet b/src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet new file mode 100644 index 0000000000..6fd16b5662 --- /dev/null +++ b/src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet @@ -0,0 +1,8 @@ +0x6C f21 # rotate +0x68 screenlock # screenlock +0x6B esc # escape +0x6D right # right on d-pad +0x6E left # left on d-pad +0x71 up # up on d-pad +0x6F down # down on d-pad +0x69 enter # enter on d-pad diff --git a/src/extras/keymap/keymaps/lg-x110 b/src/extras/keymap/keymaps/lg-x110 new file mode 100644 index 0000000000..ba08cba3fe --- /dev/null +++ b/src/extras/keymap/keymaps/lg-x110 @@ -0,0 +1,12 @@ +0xA0 mute # Fn-F9 +0xAE volumedown # Fn-Left +0xAF search # Fn-F3 +0xB0 volumeup # Fn-Right +0xB1 battery # Fn-F10 Info +0xB3 suspend # Fn-F12 +0xDF sleep # Fn-F4 +# 0xE2 bluetooth # satellite dish2 +0xE4 f21 # Fn-F5 Touchpad disable +0xF6 wlan # Fn-F6 +0xF7 reserved # brightnessdown # Fn-Down +0xF8 reserved # brightnessup # Fn-Up diff --git a/src/extras/keymap/keymaps/logitech-wave b/src/extras/keymap/keymaps/logitech-wave new file mode 100644 index 0000000000..caa5d5d310 --- /dev/null +++ b/src/extras/keymap/keymaps/logitech-wave @@ -0,0 +1,16 @@ +0x9001C scale #expo +0x9001F zoomout #zoom out +0x90020 zoomin #zoom in +0x9003D prog1 #gadget +0x90005 camera #camera +0x90018 media #media center +0x90041 wordprocessor #fn+f1 (word) +0x90042 spreadsheet #fn+f2 (excel) +0x90043 calendar #fn+f3 (calendar) +0x90044 prog2 #fn+f4 (program a) +0x90045 prog3 #fn+f5 (program b) +0x90046 prog4 #fn+f6 (program c) +0x90048 messenger #fn+f8 (msn messenger) +0x9002D find #fn+f10 (search www) +0x9004B search #fn+f11 (search pc) +0x9004C ejectclosecd #fn+f12 (eject) diff --git a/src/extras/keymap/keymaps/logitech-wave-cordless b/src/extras/keymap/keymaps/logitech-wave-cordless new file mode 100644 index 0000000000..a10dad5e4d --- /dev/null +++ b/src/extras/keymap/keymaps/logitech-wave-cordless @@ -0,0 +1,15 @@ +0xD4 zoomin +0xCC zoomout +0xC0183 media +0xC1005 camera +0xC101F zoomout +0xC1020 zoomin +0xC1041 wordprocessor +0xC1042 spreadsheet +0xC1043 calendar +0xC1044 prog2 #fn+f4 (program a) +0xC1045 prog3 #fn+f5 (program b) +0xC1046 prog4 #fn+f6 (program c) +0xC1048 messenger +0xC104A find #fn+f10 (search www) +0xC104C ejectclosecd diff --git a/src/extras/keymap/keymaps/logitech-wave-pro-cordless b/src/extras/keymap/keymaps/logitech-wave-pro-cordless new file mode 100644 index 0000000000..e7aa02206c --- /dev/null +++ b/src/extras/keymap/keymaps/logitech-wave-pro-cordless @@ -0,0 +1,12 @@ +0xC01B6 camera +0xC0183 media +0xC0184 wordprocessor +0xC0186 spreadsheet +0xC018E calendar +0xC0223 homepage +0xC01BC messenger +0xC018A mail +0xC0221 search +0xC00B8 ejectcd +0xC022D zoomin +0xC022E zoomout diff --git a/src/extras/keymap/keymaps/maxdata-pro_7000 b/src/extras/keymap/keymaps/maxdata-pro_7000 new file mode 100644 index 0000000000..c0e4f77af4 --- /dev/null +++ b/src/extras/keymap/keymaps/maxdata-pro_7000 @@ -0,0 +1,9 @@ +0x97 prog2 +0x9F prog1 +0xA0 mute # Fn-F5 +0x82 www +0xEC email +0xAE volumedown # Fn-Down +0xB0 volumeup # Fn-Up +0xDF suspend # Fn+F2 +0xF5 help diff --git a/src/extras/keymap/keymaps/medion-fid2060 b/src/extras/keymap/keymaps/medion-fid2060 new file mode 100644 index 0000000000..5a76c76799 --- /dev/null +++ b/src/extras/keymap/keymaps/medion-fid2060 @@ -0,0 +1,2 @@ +0x6B channeldown # Thottle Down +0x6D channelup # Thottle Up diff --git a/src/extras/keymap/keymaps/medionnb-a555 b/src/extras/keymap/keymaps/medionnb-a555 new file mode 100644 index 0000000000..c3b5dfa60b --- /dev/null +++ b/src/extras/keymap/keymaps/medionnb-a555 @@ -0,0 +1,4 @@ +0x63 www # N button +0x66 prog1 # link 1 button +0x67 email # envelope button +0x69 prog2 # link 2 button diff --git a/src/extras/keymap/keymaps/micro-star b/src/extras/keymap/keymaps/micro-star new file mode 100644 index 0000000000..4a438698ed --- /dev/null +++ b/src/extras/keymap/keymaps/micro-star @@ -0,0 +1,13 @@ +0xA0 mute # Fn-F9 +0xAE volumedown # Fn-F7 +0xB0 volumeup # Fn-F8 +0xB2 www # e button +0xDF sleep # Fn-F12 +0xE2 bluetooth # satellite dish2 +0xE4 f21 # Fn-F3 Touchpad disable +0xEC email # envelope button +0xEE camera # Fn-F6 camera disable +0xF6 wlan # satellite dish1 +0xF7 brightnessdown # Fn-F4 +0xF8 brightnessup # Fn-F5 +0xF9 search diff --git a/src/extras/keymap/keymaps/module-asus-w3j b/src/extras/keymap/keymaps/module-asus-w3j new file mode 100644 index 0000000000..773e0b3e82 --- /dev/null +++ b/src/extras/keymap/keymaps/module-asus-w3j @@ -0,0 +1,11 @@ +0x41 nextsong +0x45 playpause +0x43 stopcd +0x40 previoussong +0x4C ejectclosecd +0x32 mute +0x31 volumedown +0x30 volumeup +0x5D wlan +0x7E bluetooth +0x8A media # high keycode: "tv" diff --git a/src/extras/keymap/keymaps/module-ibm b/src/extras/keymap/keymaps/module-ibm new file mode 100644 index 0000000000..a92dfa2506 --- /dev/null +++ b/src/extras/keymap/keymaps/module-ibm @@ -0,0 +1,16 @@ +0x01 battery # Fn+F2 +0x02 screenlock # Fn+F3 +0x03 sleep # Fn+F4 +0x04 wlan # Fn+F5 +0x06 switchvideomode # Fn+F7 +0x07 zoom # Fn+F8 screen expand +0x08 f24 # Fn+F9 undock +0x0B suspend # Fn+F12 +0x0F brightnessup # Fn+Home +0x10 brightnessdown # Fn+End +0x11 kbdillumtoggle # Fn+PgUp - ThinkLight +0x13 zoom # Fn+Space +0x14 volumeup +0x15 volumedown +0x16 mute +0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") diff --git a/src/extras/keymap/keymaps/module-lenovo b/src/extras/keymap/keymaps/module-lenovo new file mode 100644 index 0000000000..8e38883091 --- /dev/null +++ b/src/extras/keymap/keymaps/module-lenovo @@ -0,0 +1,17 @@ +0x1 screenlock # Fn+F2 +0x2 battery # Fn+F3 +0x3 sleep # Fn+F4 +0x4 wlan # Fn+F5 +0x6 switchvideomode # Fn+F7 +0x7 f21 # Fn+F8 touchpadtoggle +0x8 f24 # Fn+F9 undock +0xB suspend # Fn+F12 +0xF brightnessup # Fn+Home +0x10 brightnessdown # Fn+End +0x11 kbdillumtoggle # Fn+PgUp - ThinkLight +0x13 zoom # Fn+Space +0x14 volumeup +0x15 volumedown +0x16 mute +0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") +0x1A micmute # Microphone mute diff --git a/src/extras/keymap/keymaps/module-sony b/src/extras/keymap/keymaps/module-sony new file mode 100644 index 0000000000..7c000131d1 --- /dev/null +++ b/src/extras/keymap/keymaps/module-sony @@ -0,0 +1,8 @@ +0x06 mute # Fn+F2 +0x07 volumedown # Fn+F3 +0x08 volumeup # Fn+F4 +0x09 brightnessdown # Fn+F5 +0x0A brightnessup # Fn+F6 +0x0B switchvideomode # Fn+F7 +0x0E zoom # Fn+F10 +0x10 suspend # Fn+F12 diff --git a/src/extras/keymap/keymaps/module-sony-old b/src/extras/keymap/keymaps/module-sony-old new file mode 100644 index 0000000000..596a34258a --- /dev/null +++ b/src/extras/keymap/keymaps/module-sony-old @@ -0,0 +1,2 @@ +0x06 battery +0x07 mute diff --git a/src/extras/keymap/keymaps/module-sony-vgn b/src/extras/keymap/keymaps/module-sony-vgn new file mode 100644 index 0000000000..c8ba001516 --- /dev/null +++ b/src/extras/keymap/keymaps/module-sony-vgn @@ -0,0 +1,8 @@ +0x00 brightnessdown # Fn+F5 +0x10 brightnessup # Fn+F6 +0x11 switchvideomode # Fn+F7 +0x12 zoomout +0x14 zoomin +0x15 suspend # Fn+F12 +0x17 prog1 +0x20 media diff --git a/src/extras/keymap/keymaps/olpc-xo b/src/extras/keymap/keymaps/olpc-xo new file mode 100644 index 0000000000..34434a121d --- /dev/null +++ b/src/extras/keymap/keymaps/olpc-xo @@ -0,0 +1,74 @@ +0x59 fn +0x81 fn_esc +0xF9 camera +0xF8 sound # Fn-CAMERA = Mic + + +# Function key mappings, as per +# http://dev.laptop.org/ticket/10213#comment:20 +# +# Unmodified F1-F8 produce F1-F8, so no remap necessary. +# Unmodified F9-F12 control brightness and volume. +0x43 brightnessdown +0x44 brightnessup +0x57 volumedown +0x58 volumeup + +# fn-modified fkeys all produce the unmodified version of the key. +0xBB f1 +0xBC f2 +0xBD f3 +0xBE f4 +0xBF f5 +0xC0 f6 +0xC1 f7 +0xC2 f8 +0xC3 f9 +0xC4 f10 +0xD7 f11 +0xD8 f12 + + +# Using F13-F21 for the .5 F keys right now. +0xF7 f13 +0xF6 f14 +0xF5 f15 +0xF4 f16 +0xF3 f17 +0xF2 f18 +0xF1 f19 +0xF0 f20 +0xEF f21 + +0xEE chat +0xE4 chat # Just mapping Fn-Chat to Chat for now +0xDD menu # Frame +0xDA prog1 # Fn-Frame + +# The FN of some keys is other keys +0xD3 delete +0xD2 insert +0xC9 pageup +0xD1 pagedown +0xC7 home +0xCF end + +# Language key - don't ask what they are doing as KEY_HP +0x73 hp +0x7E hp + +0xDB leftmeta # left grab +0xDC rightmeta # right grab +0x85 rightmeta # Right grab releases on a different scancode +0xD6 kbdillumtoggle # Fn-space +0x69 switchvideomode # Brightness key + +# Game keys +0x65 kp8 # up +0x66 kp2 # down +0x67 kp4 # left +0x68 kp6 # right +0xE5 kp9 # pgup +0xE6 kp3 # pgdn +0xE7 kp7 # home +0xE8 kp1 # end diff --git a/src/extras/keymap/keymaps/onkyo b/src/extras/keymap/keymaps/onkyo new file mode 100644 index 0000000000..ee864ade4d --- /dev/null +++ b/src/extras/keymap/keymaps/onkyo @@ -0,0 +1,14 @@ +0xA0 mute # Fn+D +0xAE volumedown # Fn+F +0xB0 volumeup # Fn+G +0xDF sleep # Fn+W +0xE0 bluetooth # Fn+H +0xE2 cyclewindows # Fn+Esc +0xEE battery # Fn+Q +0xF0 media # Fn+R +0xF5 switchvideomode # Fn+E +0xF6 camera # Fn+T +0xF7 f21 # Fn+Y (touchpad toggle) +0xF8 brightnessup # Fn+S +0xF9 brightnessdown # Fn+A +0xFB wlan # Fn+J diff --git a/src/extras/keymap/keymaps/oqo-model2 b/src/extras/keymap/keymaps/oqo-model2 new file mode 100644 index 0000000000..b7f4851abe --- /dev/null +++ b/src/extras/keymap/keymaps/oqo-model2 @@ -0,0 +1,5 @@ +0x8E wlan +0xF0 switchvideomode +0xF1 mute +0xF2 volumedown +0xF3 volumeup diff --git a/src/extras/keymap/keymaps/samsung-other b/src/extras/keymap/keymaps/samsung-other new file mode 100644 index 0000000000..3ac0c2f10c --- /dev/null +++ b/src/extras/keymap/keymaps/samsung-other @@ -0,0 +1,14 @@ +0x74 prog1 # User key +0x75 www +0x78 mail +0x82 switchvideomode # Fn+F4 CRT/LCD (high keycode: "displaytoggle") +0x83 battery # Fn+F2 +0x84 prog1 # Fn+F5 backlight on/off +0x86 wlan # Fn+F9 +0x88 brightnessup # Fn-Up +0x89 brightnessdown # Fn-Down +0xB1 prog2 # Fn+F7 run Samsung Magic Doctor (keypressed event is generated twice) +0xB3 prog3 # Fn+F8 switch power mode (battery/dynamic/performance) +0xB4 wlan # Fn+F9 (X60P) +0xF7 f22 # Fn+F10 Touchpad on +0xF9 f23 # Fn+F10 Touchpad off diff --git a/src/extras/keymap/keymaps/samsung-sq1us b/src/extras/keymap/keymaps/samsung-sq1us new file mode 100644 index 0000000000..ea2141ef84 --- /dev/null +++ b/src/extras/keymap/keymaps/samsung-sq1us @@ -0,0 +1,7 @@ +0xD4 menu +0xD8 f1 +0xD9 f10 +0xD6 f3 +0xD7 f9 +0xE4 f5 +0xEE f11 diff --git a/src/extras/keymap/keymaps/samsung-sx20s b/src/extras/keymap/keymaps/samsung-sx20s new file mode 100644 index 0000000000..9d954ee415 --- /dev/null +++ b/src/extras/keymap/keymaps/samsung-sx20s @@ -0,0 +1,4 @@ +0x74 mute +0x75 mute +0x77 f22 # Touchpad on +0x79 f23 # Touchpad off diff --git a/src/extras/keymap/keymaps/toshiba-satellite_a100 b/src/extras/keymap/keymaps/toshiba-satellite_a100 new file mode 100644 index 0000000000..22007be71b --- /dev/null +++ b/src/extras/keymap/keymaps/toshiba-satellite_a100 @@ -0,0 +1,2 @@ +0xA4 stopcd +0xB2 www diff --git a/src/extras/keymap/keymaps/toshiba-satellite_a110 b/src/extras/keymap/keymaps/toshiba-satellite_a110 new file mode 100644 index 0000000000..1429409351 --- /dev/null +++ b/src/extras/keymap/keymaps/toshiba-satellite_a110 @@ -0,0 +1,10 @@ +0x92 stop +0x93 www +0x94 media +0x9E f22 # Touchpad on +0x9F f23 # Touchpad off +0xB9 nextsong +0xD9 brightnessup +0xEE screenlock +0xF4 previoussong +0xF7 playpause diff --git a/src/extras/keymap/keymaps/toshiba-satellite_m30x b/src/extras/keymap/keymaps/toshiba-satellite_m30x new file mode 100644 index 0000000000..ae8e34941b --- /dev/null +++ b/src/extras/keymap/keymaps/toshiba-satellite_m30x @@ -0,0 +1,6 @@ +0xef brightnessdown +0xd9 brightnessup +0xee screenlock +0x93 media +0x9e f22 #touchpad_enable +0x9f f23 #touchpad_disable diff --git a/src/extras/keymap/keymaps/zepto-znote b/src/extras/keymap/keymaps/zepto-znote new file mode 100644 index 0000000000..cf72fda47b --- /dev/null +++ b/src/extras/keymap/keymaps/zepto-znote @@ -0,0 +1,11 @@ +0x93 switchvideomode # Fn+F3 Toggle Video Output +0x95 brightnessdown # Fn+F4 Brightness Down +0x91 brightnessup # Fn+F5 Brightness Up +0xA5 f23 # Fn+F6 Disable Touchpad +0xA6 f22 # Fn+F6 Enable Touchpad +0xA7 bluetooth # Fn+F10 Enable Bluetooth +0XA9 bluetooth # Fn+F10 Disable Bluetooth +0xF1 wlan # RF Switch Off +0xF2 wlan # RF Switch On +0xF4 prog1 # P1 Button +0xF3 prog2 # P2 Button diff --git a/src/extras/mtd_probe/.gitignore b/src/extras/mtd_probe/.gitignore new file mode 100644 index 0000000000..82b8ab501f --- /dev/null +++ b/src/extras/mtd_probe/.gitignore @@ -0,0 +1 @@ +mtd_probe diff --git a/src/extras/mtd_probe/75-probe_mtd.rules b/src/extras/mtd_probe/75-probe_mtd.rules new file mode 100644 index 0000000000..c0e0839785 --- /dev/null +++ b/src/extras/mtd_probe/75-probe_mtd.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="mtd_probe_end" + +KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $devnode" +KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl" + +LABEL="mtd_probe_end" diff --git a/src/extras/mtd_probe/mtd_probe.c b/src/extras/mtd_probe/mtd_probe.c new file mode 100644 index 0000000000..e45867ffa9 --- /dev/null +++ b/src/extras/mtd_probe/mtd_probe.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 - Maxim Levitsky + * + * mtd_probe 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; either version 2 of the License, or + * (at your option) any later version. + * + * mtd_probe 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 mtd_probe; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ +#include "mtd_probe.h" +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + if (argc != 2) { + printf("usage: mtd_probe /dev/mtd[n]\n"); + return 1; + } + + int mtd_fd = open(argv[1], O_RDONLY); + if (mtd_fd == -1) { + perror("open"); + exit(-1); + } + + mtd_info_t mtd_info; + int error = ioctl(mtd_fd, MEMGETINFO, &mtd_info); + if (error == -1) { + perror("ioctl"); + exit(-1); + } + + probe_smart_media(mtd_fd, &mtd_info); + return -1; +} diff --git a/src/extras/mtd_probe/mtd_probe.h b/src/extras/mtd_probe/mtd_probe.h new file mode 100644 index 0000000000..20ecd4578e --- /dev/null +++ b/src/extras/mtd_probe/mtd_probe.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 - Maxim Levitsky + * + * mtd_probe 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; either version 2 of the License, or + * (at your option) any later version. + * + * mtd_probe 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 mtd_probe; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include + +/* Full oob structure as written on the flash */ +struct sm_oob { + uint32_t reserved; + uint8_t data_status; + uint8_t block_status; + uint8_t lba_copy1[2]; + uint8_t ecc2[3]; + uint8_t lba_copy2[2]; + uint8_t ecc1[3]; +} __attribute__((packed)); + + +/* one sector is always 512 bytes, but it can consist of two nand pages */ +#define SM_SECTOR_SIZE 512 + +/* oob area is also 16 bytes, but might be from two pages */ +#define SM_OOB_SIZE 16 + +/* This is maximum zone size, and all devices that have more that one zone + have this size */ +#define SM_MAX_ZONE_SIZE 1024 + +/* support for small page nand */ +#define SM_SMALL_PAGE 256 +#define SM_SMALL_OOB_SIZE 8 + + +void probe_smart_media(int mtd_fd, mtd_info_t *info); diff --git a/src/extras/mtd_probe/probe_smartmedia.c b/src/extras/mtd_probe/probe_smartmedia.c new file mode 100644 index 0000000000..49704e380a --- /dev/null +++ b/src/extras/mtd_probe/probe_smartmedia.c @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2010 - Maxim Levitsky + * + * mtd_probe 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; either version 2 of the License, or + * (at your option) any later version. + * + * mtd_probe 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 mtd_probe; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mtd_probe.h" + +static const uint8_t cis_signature[] = { + 0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20 +}; + + +void probe_smart_media(int mtd_fd, mtd_info_t* info) +{ + char* cis_buffer = malloc(SM_SECTOR_SIZE); + + if (!cis_buffer) + return; + + if (info->type != MTD_NANDFLASH) + goto exit; + + int sector_size = info->writesize; + int block_size = info->erasesize; + int size_in_megs = info->size / (1024 * 1024); + int spare_count; + + + if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE) + goto exit; + + switch(size_in_megs) { + case 1: + case 2: + spare_count = 6; + break; + case 4: + spare_count = 12; + break; + default: + spare_count = 24; + break; + } + + + int offset; + int cis_found = 0; + + for (offset = 0 ; offset < block_size * spare_count ; + offset += sector_size) { + + lseek(mtd_fd, SEEK_SET, offset); + if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){ + cis_found = 1; + break; + } + } + + if (!cis_found) + goto exit; + + if (memcmp(cis_buffer, cis_signature, sizeof(cis_signature)) != 0 && + (memcmp(cis_buffer + SM_SMALL_PAGE, cis_signature, + sizeof(cis_signature)) != 0)) + goto exit; + + printf("MTD_FTL=smartmedia\n"); + free(cis_buffer); + exit(0); +exit: + free(cis_buffer); + return; +} diff --git a/src/extras/qemu/42-qemu-usb.rules b/src/extras/qemu/42-qemu-usb.rules new file mode 100644 index 0000000000..a4e3864714 --- /dev/null +++ b/src/extras/qemu/42-qemu-usb.rules @@ -0,0 +1,13 @@ +# +# Enable autosuspend for qemu emulated usb hid devices. +# +# Note that there are buggy qemu versions which advertise remote +# wakeup support but don't actually implement it correctly. This +# is the reason why we need a match for the serial number here. +# The serial number "42" is used to tag the implementations where +# remote wakeup is working. +# + +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" diff --git a/src/extras/rule_generator/75-cd-aliases-generator.rules b/src/extras/rule_generator/75-cd-aliases-generator.rules new file mode 100644 index 0000000000..e6da0101d6 --- /dev/null +++ b/src/extras/rule_generator/75-cd-aliases-generator.rules @@ -0,0 +1,9 @@ +# these rules generate rules for the /dev/{cdrom,dvd,...} symlinks + +# the "path" of usb/ieee1394 devices changes frequently, use "id" +ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", \ + PROGRAM="write_cd_rules by-id", SYMLINK+="%c", GOTO="persistent_cd_end" + +ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules", SYMLINK+="%c" + +LABEL="persistent_cd_end" diff --git a/src/extras/rule_generator/75-persistent-net-generator.rules b/src/extras/rule_generator/75-persistent-net-generator.rules new file mode 100644 index 0000000000..4f80573478 --- /dev/null +++ b/src/extras/rule_generator/75-persistent-net-generator.rules @@ -0,0 +1,102 @@ +# do not edit this file, it will be overwritten on update + +# these rules generate rules for persistent network device naming +# +# variables used to communicate: +# MATCHADDR MAC address used for the match +# MATCHID bus_id used for the match +# MATCHDRV driver name used for the match +# MATCHIFTYPE interface type match +# COMMENT comment to add to the generated rule +# INTERFACE_NAME requested name supplied by external tool +# INTERFACE_NEW new interface name returned by rule writer + +ACTION!="add", GOTO="persistent_net_generator_end" +SUBSYSTEM!="net", GOTO="persistent_net_generator_end" + +# ignore the interface if a name has already been set +NAME=="?*", GOTO="persistent_net_generator_end" + +# device name whitelist +KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" + +# ignore Xen virtual interfaces +SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" + +# read MAC address +ENV{MATCHADDR}="$attr{address}" + +# match interface type +ENV{MATCHIFTYPE}="$attr{type}" + +# ignore KVM virtual interfaces +ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" +# ignore VMWare virtual interfaces +ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" +# ignore Hyper-V virtual interfaces +ENV{MATCHADDR}=="00:15:5d:*", GOTO="persistent_net_generator_end" + +# These vendors are known to violate the local MAC address assignment scheme +# Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom +ENV{MATCHADDR}=="02:07:01:*", GOTO="globally_administered_whitelist" +# 3Com +ENV{MATCHADDR}=="02:60:60:*", GOTO="globally_administered_whitelist" +# 3Com IBM PC; Imagen; Valid; Cisco; Apple +ENV{MATCHADDR}=="02:60:8c:*", GOTO="globally_administered_whitelist" +# Intel +ENV{MATCHADDR}=="02:a0:c9:*", GOTO="globally_administered_whitelist" +# Olivetti +ENV{MATCHADDR}=="02:aa:3c:*", GOTO="globally_administered_whitelist" +# CMC Masscomp; Silicon Graphics; Prime EXL +ENV{MATCHADDR}=="02:cf:1f:*", GOTO="globally_administered_whitelist" +# Prominet Corporation Gigabit Ethernet Switch +ENV{MATCHADDR}=="02:e0:3b:*", GOTO="globally_administered_whitelist" +# BTI (Bus-Tech, Inc.) IBM Mainframes +ENV{MATCHADDR}=="02:e6:d3:*", GOTO="globally_administered_whitelist" +# Realtek +ENV{MATCHADDR}=="52:54:00:*", GOTO="globally_administered_whitelist" +# Novell 2000 +ENV{MATCHADDR}=="52:54:4c:*", GOTO="globally_administered_whitelist" +# Realtec +ENV{MATCHADDR}=="52:54:ab:*", GOTO="globally_administered_whitelist" +# Kingston Technologies +ENV{MATCHADDR}=="e2:0c:0f:*", GOTO="globally_administered_whitelist" +# Xensource +ENV{MATCHADDR}=="00:16:3e:*", GOTO="globally_administered_whitelist" + +# match interface dev_id +ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}" + +# do not use "locally administered" MAC address +ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" + +# do not use empty address +ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" + +LABEL="globally_administered_whitelist" + +# build comment line for generated rule: +SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="?*", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)" +SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)" +SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" + +# ibmveth likes to use "locally administered" MAC addresses +DRIVERS=="ibmveth", ENV{MATCHADDR}="$attr{address}", ENV{COMMENT}="ibmveth ($id)" + +# S/390 uses id matches only, do not use MAC address match +SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID}="$id", ENV{MATCHDRV}="$driver", ENV{MATCHADDR}="" + +# see if we got enough data to create a rule +ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", GOTO="persistent_net_generator_end" + +# default comment +ENV{COMMENT}=="", ENV{COMMENT}="net device ($attr{driver})" + +# write rule +DRIVERS=="?*", IMPORT{program}="write_net_rules" + +# rename interface if needed +ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" + +LABEL="persistent_net_generator_end" diff --git a/src/extras/rule_generator/rule_generator.functions b/src/extras/rule_generator/rule_generator.functions new file mode 100644 index 0000000000..0f1b73850e --- /dev/null +++ b/src/extras/rule_generator/rule_generator.functions @@ -0,0 +1,113 @@ +# functions used by the udev rule generator + +# Copyright (C) 2006 Marco d'Itri + +# 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, either version 2 of the License, or +# (at your option) any later version. + +# 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, see . + +PATH='/usr/bin:/bin:/usr/sbin:/sbin' + +# Read a single line from file $1 in the $DEVPATH directory. +# The function must not return an error even if the file does not exist. +sysread() { + local file="$1" + [ -e "/sys$DEVPATH/$file" ] || return 0 + local value + read value < "/sys$DEVPATH/$file" || return 0 + echo "$value" +} + +sysreadlink() { + local file="$1" + [ -e "/sys$DEVPATH/$file" ] || return 0 + readlink -f /sys$DEVPATH/$file 2> /dev/null || true +} + +# Return true if a directory is writeable. +writeable() { + if ln -s test-link $1/.is-writeable 2> /dev/null; then + rm -f $1/.is-writeable + return 0 + else + return 1 + fi +} + +# Create a lock file for the current rules file. +lock_rules_file() { + RUNDIR=$(udevadm info --run) + [ -e "$RUNDIR" ] || return 0 + + RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}" + + retry=30 + while ! mkdir $RULES_LOCK 2> /dev/null; do + if [ $retry -eq 0 ]; then + echo "Cannot lock $RULES_FILE!" >&2 + exit 2 + fi + sleep 1 + retry=$(($retry - 1)) + done +} + +unlock_rules_file() { + [ "$RULES_LOCK" ] || return 0 + rmdir $RULES_LOCK || true +} + +# Choose the real rules file if it is writeable or a temporary file if not. +# Both files should be checked later when looking for existing rules. +choose_rules_file() { + RUNDIR=$(udevadm info --run) + local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}" + [ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1 + + if writeable ${RULES_FILE%/*}; then + RO_RULES_FILE='/dev/null' + else + RO_RULES_FILE=$RULES_FILE + RULES_FILE=$tmp_rules_file + fi +} + +# Return the name of the first free device. +raw_find_next_available() { + local links="$1" + + local basename=${links%%[ 0-9]*} + local max=-1 + for name in $links; do + local num=${name#$basename} + [ "$num" ] || num=0 + [ $num -gt $max ] && max=$num + done + + local max=$(($max + 1)) + # "name0" actually is just "name" + [ $max -eq 0 ] && return + echo "$max" +} + +# Find all rules matching a key (with action) and a pattern. +find_all_rules() { + local key="$1" + local linkre="$2" + local match="$3" + + local search='.*[[:space:],]'"$key"'"('"$linkre"')".*' + echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \ + $RO_RULES_FILE \ + $([ -e $RULES_FILE ] && echo $RULES_FILE) \ + 2>/dev/null) +} diff --git a/src/extras/rule_generator/write_cd_rules b/src/extras/rule_generator/write_cd_rules new file mode 100644 index 0000000000..3f93c7447a --- /dev/null +++ b/src/extras/rule_generator/write_cd_rules @@ -0,0 +1,126 @@ +#!/bin/sh -e + +# This script is run if an optical drive lacks a rule for persistent naming. +# +# It adds symlinks for optical drives based on the device class determined +# by cdrom_id and used ID_PATH to identify the device. + +# (C) 2006 Marco d'Itri +# +# 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, either version 2 of the License, or +# (at your option) any later version. + +# 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, see . + +# debug, if UDEV_LOG= +if [ -n "$UDEV_LOG" ]; then + if [ "$UDEV_LOG" -ge 7 ]; then + set -x + fi +fi + +RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" + +. /lib/udev/rule_generator.functions + +find_next_available() { + raw_find_next_available "$(find_all_rules 'SYMLINK\+=' "$1")" +} + +write_rule() { + local match="$1" + local link="$2" + local comment="$3" + + { + if [ "$PRINT_HEADER" ]; then + PRINT_HEADER= + echo "# This file was automatically generated by the $0" + echo "# program, run by the cd-aliases-generator.rules rules file." + echo "#" + echo "# You can modify it, as long as you keep each rule on a single" + echo "# line, and set the \$GENERATED variable." + echo "" + fi + + [ "$comment" ] && echo "# $comment" + echo "$match, SYMLINK+=\"$link\", ENV{GENERATED}=\"1\"" + } >> $RULES_FILE + SYMLINKS="$SYMLINKS $link" +} + +if [ -z "$DEVPATH" ]; then + echo "Missing \$DEVPATH." >&2 + exit 1 +fi +if [ -z "$ID_CDROM" ]; then + echo "$DEVPATH is not a CD reader." >&2 + exit 1 +fi + +if [ "$1" ]; then + METHOD="$1" +else + METHOD='by-path' +fi + +case "$METHOD" in + by-path) + if [ -z "$ID_PATH" ]; then + echo "$DEVPATH not supported by path_id. by-id may work." >&2 + exit 1 + fi + RULE="ENV{ID_PATH}==\"$ID_PATH\"" + ;; + + by-id) + if [ "$ID_SERIAL" ]; then + RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\"" + elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then + RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\"" + else + echo "$DEVPATH not supported by ata_id. by-path may work." >&2 + exit 1 + fi + ;; + + *) + echo "Invalid argument (must be either by-path or by-id)." >&2 + exit 1 + ;; +esac + +# Prevent concurrent processes from modifying the file at the same time. +lock_rules_file + +# Check if the rules file is writeable. +choose_rules_file + +link_num=$(find_next_available 'cdrom[0-9]*') + +match="SUBSYSTEM==\"block\", ENV{ID_CDROM}==\"?*\", $RULE" + +comment="$ID_MODEL ($ID_PATH)" + + write_rule "$match" "cdrom$link_num" "$comment" +[ "$ID_CDROM_CD_R" -o "$ID_CDROM_CD_RW" ] && \ + write_rule "$match" "cdrw$link_num" +[ "$ID_CDROM_DVD" ] && \ + write_rule "$match" "dvd$link_num" +[ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ] && \ + write_rule "$match" "dvdrw$link_num" +echo >> $RULES_FILE + +unlock_rules_file + +echo $SYMLINKS + +exit 0 diff --git a/src/extras/rule_generator/write_net_rules b/src/extras/rule_generator/write_net_rules new file mode 100644 index 0000000000..437979241f --- /dev/null +++ b/src/extras/rule_generator/write_net_rules @@ -0,0 +1,141 @@ +#!/bin/sh -e + +# This script is run to create persistent network device naming rules +# based on properties of the device. +# If the interface needs to be renamed, INTERFACE_NEW= will be printed +# on stdout to allow udev to IMPORT it. + +# variables used to communicate: +# MATCHADDR MAC address used for the match +# MATCHID bus_id used for the match +# MATCHDEVID dev_id used for the match +# MATCHDRV driver name used for the match +# MATCHIFTYPE interface type match +# COMMENT comment to add to the generated rule +# INTERFACE_NAME requested name supplied by external tool +# INTERFACE_NEW new interface name returned by rule writer + +# Copyright (C) 2006 Marco d'Itri +# Copyright (C) 2007 Kay Sievers +# +# 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, either version 2 of the License, or +# (at your option) any later version. +# +# 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, see . + +# debug, if UDEV_LOG= +if [ -n "$UDEV_LOG" ]; then + if [ "$UDEV_LOG" -ge 7 ]; then + set -x + fi +fi + +RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' + +. /lib/udev/rule_generator.functions + +interface_name_taken() { + local value="$(find_all_rules 'NAME=' $INTERFACE)" + if [ "$value" ]; then + return 0 + else + return 1 + fi +} + +find_next_available() { + raw_find_next_available "$(find_all_rules 'NAME=' "$1")" +} + +write_rule() { + local match="$1" + local name="$2" + local comment="$3" + + { + if [ "$PRINT_HEADER" ]; then + PRINT_HEADER= + echo "# This file was automatically generated by the $0" + echo "# program, run by the persistent-net-generator.rules rules file." + echo "#" + echo "# You can modify it, as long as you keep each rule on a single" + echo "# line, and change only the value of the NAME= key." + fi + + echo "" + [ "$comment" ] && echo "# $comment" + echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\"" + } >> $RULES_FILE +} + +if [ -z "$INTERFACE" ]; then + echo "missing \$INTERFACE" >&2 + exit 1 +fi + +# Prevent concurrent processes from modifying the file at the same time. +lock_rules_file + +# Check if the rules file is writeable. +choose_rules_file + +# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces +if [ "$MATCHADDR" ]; then + match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\"" +fi + +if [ "$MATCHDRV" ]; then + match="$match, DRIVERS==\"$MATCHDRV\"" +fi + +if [ "$MATCHDEVID" ]; then + match="$match, ATTR{dev_id}==\"$MATCHDEVID\"" +fi + +if [ "$MATCHID" ]; then + match="$match, KERNELS==\"$MATCHID\"" +fi + +if [ "$MATCHIFTYPE" ]; then + match="$match, ATTR{type}==\"$MATCHIFTYPE\"" +fi + +if [ -z "$match" ]; then + echo "missing valid match" >&2 + unlock_rules_file + exit 1 +fi + +basename=${INTERFACE%%[0-9]*} +match="$match, KERNEL==\"$basename*\"" + +if [ "$INTERFACE_NAME" ]; then + # external tools may request a custom name + COMMENT="$COMMENT (custom name provided by external tool)" + if [ "$INTERFACE_NAME" != "$INTERFACE" ]; then + INTERFACE=$INTERFACE_NAME; + echo "INTERFACE_NEW=$INTERFACE" + fi +else + # if a rule using the current name already exists, find a new name + if interface_name_taken; then + INTERFACE="$basename$(find_next_available "$basename[0-9]*")" + # prevent INTERFACE from being "eth" instead of "eth0" + [ "$INTERFACE" = "${INTERFACE%%[ \[\]0-9]*}" ] && INTERFACE=${INTERFACE}0 + echo "INTERFACE_NEW=$INTERFACE" + fi +fi + +write_rule "$match" "$INTERFACE" "$COMMENT" + +unlock_rules_file + +exit 0 diff --git a/src/extras/scsi_id/.gitignore b/src/extras/scsi_id/.gitignore new file mode 100644 index 0000000000..10e9ae743c --- /dev/null +++ b/src/extras/scsi_id/.gitignore @@ -0,0 +1,3 @@ +scsi_id +scsi_id.8 +scsi_id_version.h diff --git a/src/extras/scsi_id/README b/src/extras/scsi_id/README new file mode 100644 index 0000000000..9cfe73991c --- /dev/null +++ b/src/extras/scsi_id/README @@ -0,0 +1,4 @@ +scsi_id - generate a SCSI unique identifier for a given SCSI device + +Please send questions, comments or patches to or +. diff --git a/src/extras/scsi_id/scsi.h b/src/extras/scsi_id/scsi.h new file mode 100644 index 0000000000..8e9ce406b7 --- /dev/null +++ b/src/extras/scsi_id/scsi.h @@ -0,0 +1,97 @@ +/* + * scsi.h + * + * General scsi and linux scsi specific defines and structs. + * + * Copyright (C) IBM Corp. 2003 + * + * 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. + */ + +#include + +struct scsi_ioctl_command { + unsigned int inlen; /* excluding scsi command length */ + unsigned int outlen; + unsigned char data[1]; + /* on input, scsi command starts here then opt. data */ +}; + +/* + * Default 5 second timeout + */ +#define DEF_TIMEOUT 5000 + +#define SENSE_BUFF_LEN 32 + +/* + * The request buffer size passed to the SCSI INQUIRY commands, use 254, + * as this is a nice value for some devices, especially some of the usb + * mass storage devices. + */ +#define SCSI_INQ_BUFF_LEN 254 + +/* + * SCSI INQUIRY vendor and model (really product) lengths. + */ +#define VENDOR_LENGTH 8 +#define MODEL_LENGTH 16 + +#define INQUIRY_CMD 0x12 +#define INQUIRY_CMDLEN 6 + +/* + * INQUIRY VPD page 0x83 identifier descriptor related values. Reference the + * SCSI Primary Commands specification for details. + */ + +/* + * id type values of id descriptors. These are assumed to fit in 4 bits. + */ +#define SCSI_ID_VENDOR_SPECIFIC 0 +#define SCSI_ID_T10_VENDOR 1 +#define SCSI_ID_EUI_64 2 +#define SCSI_ID_NAA 3 +#define SCSI_ID_RELPORT 4 +#define SCSI_ID_TGTGROUP 5 +#define SCSI_ID_LUNGROUP 6 +#define SCSI_ID_MD5 7 +#define SCSI_ID_NAME 8 + +/* + * Supported NAA values. These fit in 4 bits, so the "don't care" value + * cannot conflict with real values. + */ +#define SCSI_ID_NAA_DONT_CARE 0xff +#define SCSI_ID_NAA_IEEE_REG 5 +#define SCSI_ID_NAA_IEEE_REG_EXTENDED 6 + +/* + * Supported Code Set values. + */ +#define SCSI_ID_BINARY 1 +#define SCSI_ID_ASCII 2 + +struct scsi_id_search_values { + u_char id_type; + u_char naa_type; + u_char code_set; +}; + +/* + * Following are the "true" SCSI status codes. Linux has traditionally + * used a 1 bit right and masked version of these. So now CHECK_CONDITION + * and friends (in ) are deprecated. + */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_CONDITION_MET 0x4 +#define SCSI_BUSY 0x8 +#define SCSI_IMMEDIATE 0x10 +#define SCSI_IMMEDIATE_CONDITION_MET 0x14 +#define SCSI_RESERVATION_CONFLICT 0x18 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SCSI_TASK_SET_FULL 0x28 +#define SCSI_ACA_ACTIVE 0x30 +#define SCSI_TASK_ABORTED 0x40 diff --git a/src/extras/scsi_id/scsi_id.8 b/src/extras/scsi_id/scsi_id.8 new file mode 100644 index 0000000000..0d4dba9149 --- /dev/null +++ b/src/extras/scsi_id/scsi_id.8 @@ -0,0 +1,119 @@ +.TH SCSI_ID 8 "December 2003" "" "Linux Administrator's Manual" +.SH NAME +scsi_id \- retrieve and generate a unique SCSI identifier +.SH SYNOPSIS +.BI scsi_id +[\fIoptions\fP] +.SH "DESCRIPTION" +.B scsi_id +queries a SCSI device via the SCSI INQUIRY vital product data (VPD) page 0x80 or +0x83 and uses the resulting data to generate a value that is unique across +all SCSI devices that properly support page 0x80 or page 0x83. + +If a result is generated it is sent to standard output, and the program +exits with a zero value. If no identifier is output, the program exits +with a non\-zero value. + +\fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP +that require a unique SCSI identifier. + +By default all devices are assumed black listed, the \fB\-\-whitelisted\fP option must +be specified on the command line or in the config file for any useful +behaviour. + +SCSI commands are sent directly to the device via the SG_IO ioctl +interface. + +In order to generate unique values for either page 0x80 or page 0x83, the +serial numbers or world wide names are prefixed as follows. + +Identifiers based on page 0x80 are prefixed by the character 'S', the SCSI +vendor, the SCSI product (model) and then the the serial number returned +by page 0x80. For example: + +.sp +.nf +# /usr/lib/udev/scsi_id \-\-page=0x80 \-\-whitelisted \-\-device=/dev/sda +SIBM 3542 1T05078453 +.fi +.P + +Identifiers based on page 0x83 are prefixed by the identifier type +followed by the page 0x83 identifier. For example, a device with a NAA +(Name Address Authority) type of 3 (also in this case the page 0x83 +identifier starts with the NAA value of 6): + +.sp +.nf +# /usr/lib/udev/scsi_id \-\-page=0x83 \-\-whitelisted \-\-device=/dev/sda +3600a0b80000b174b000000d63efc5c8c +.fi +.P + +.SH OPTIONS +.TP +.BI \-\-blacklisted +The default behaviour \- treat the device as black listed, and do nothing +unless a white listed device is found in the scsi_id config\-file. +.TP +.BI \-\-device=\| device\^ +Send SG_IO commands to \fBdevice\fP, such as \fB/dev/sdc\fP. +.TP +.BI \-\-config=\| config\-file +Read configuration and black/white list entries from +.B config\-file +rather than the default +.B /etc/scsi_id.config +file. +.TP +.BI \-\-whitelisted +Treat the device as white listed. The \fB\-\-whitelisted\fP option must be specified +on the command line or in the scsi_id configuration file for +.B scsi_id +to generate any output. +.TP +.BI \-\-page=\| 0x80 | 0x83 | pre-spc3-83 +Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83. +.sp +The default +behaviour is to query the available VPD pages, and use page 0x83 if found, +else page 0x80 if found, else nothing. +.sp +Page pre-spc3-83 should only be utilized for those scsi devices which +are not compliant with the SPC-2 or SPC-3 format for page 83. While this +option is used for older model 4, 5, and 6 EMC Symmetrix devices, its +use with SPC-2 or SPC-3 compliant devices will fallback to the page 83 +format supported by these devices. +.TP +.BI \-\-replace-whitespace +Reformat the output : replace all whitespaces by underscores. +.TP +.BI \-\-export +Export all data in KEY= format used to import in other programs. +.TP +.BI \-\-verbose +Generate verbose debugging output. +.TP +.BI \-\-version +Display version number and exit. +.RE + +.SH "FILES" +.nf +.ft B +.ft +.TP +\fI/etc/scsi_id.config\fP +Configuration of black/white list entries and per device options: +# one config per line, short match strings match longer strings +# vendor=string[,model=string],options= +vendor="ATA",options=-p 0x80 +.RE +.fi +.LP +.SH "SEE ALSO" +.BR udev (7) +.SH AUTHORS +Developed by Patrick Mansfield based on SCSI ID +source included in earlier linux 2.5 kernels, sg_utils source, and SCSI +specifications. diff --git a/src/extras/scsi_id/scsi_id.c b/src/extras/scsi_id/scsi_id.c new file mode 100644 index 0000000000..da81d083ce --- /dev/null +++ b/src/extras/scsi_id/scsi_id.c @@ -0,0 +1,657 @@ +/* + * Copyright (C) IBM Corp. 2003 + * Copyright (C) SUSE Linux Products GmbH, 2006 + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "scsi_id.h" + +static const struct option options[] = { + { "device", required_argument, NULL, 'd' }, + { "config", required_argument, NULL, 'f' }, + { "page", required_argument, NULL, 'p' }, + { "blacklisted", no_argument, NULL, 'b' }, + { "whitelisted", no_argument, NULL, 'g' }, + { "replace-whitespace", no_argument, NULL, 'u' }, + { "sg-version", required_argument, NULL, 's' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { "export", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, + {} +}; + +static const char short_options[] = "d:f:ghip:uvVx"; +static const char dev_short_options[] = "bgp:"; + +static int all_good; +static int dev_specified; +static char config_file[MAX_PATH_LEN] = SYSCONFDIR "/scsi_id.config"; +static enum page_code default_page_code; +static int sg_version = 4; +static int use_stderr; +static int debug; +static int reformat_serial; +static int export; +static char vendor_str[64]; +static char model_str[64]; +static char vendor_enc_str[256]; +static char model_enc_str[256]; +static char revision_str[16]; +static char type_str[16]; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + vsyslog(priority, format, args); +} + +static void set_type(const char *from, char *to, size_t len) +{ + int type_num; + char *eptr; + char *type = "generic"; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 0: + type = "disk"; + break; + case 1: + type = "tape"; + break; + case 4: + type = "optical"; + break; + case 5: + type = "cd"; + break; + case 7: + type = "optical"; + break; + case 0xe: + type = "disk"; + break; + case 0xf: + type = "optical"; + break; + default: + break; + } + } + util_strscpy(to, len, type); +} + +/* + * get_value: + * + * buf points to an '=' followed by a quoted string ("foo") or a string ending + * with a space or ','. + * + * Return a pointer to the NUL terminated string, returns NULL if no + * matches. + */ +static char *get_value(char **buffer) +{ + static char *quote_string = "\"\n"; + static char *comma_string = ",\n"; + char *val; + char *end; + + if (**buffer == '"') { + /* + * skip leading quote, terminate when quote seen + */ + (*buffer)++; + end = quote_string; + } else { + end = comma_string; + } + val = strsep(buffer, end); + if (val && end == quote_string) + /* + * skip trailing quote + */ + (*buffer)++; + + while (isspace(**buffer)) + (*buffer)++; + + return val; +} + +static int argc_count(char *opts) +{ + int i = 0; + while (*opts != '\0') + if (*opts++ == ' ') + i++; + return i; +} + +/* + * get_file_options: + * + * If vendor == NULL, find a line in the config file with only "OPTIONS="; + * if vendor and model are set find the first OPTIONS line in the config + * file that matches. Set argc and argv to match the OPTIONS string. + * + * vendor and model can end in '\n'. + */ +static int get_file_options(struct udev *udev, + const char *vendor, const char *model, + int *argc, char ***newargv) +{ + char *buffer; + FILE *fd; + char *buf; + char *str1; + char *vendor_in, *model_in, *options_in; /* read in from file */ + int lineno; + int c; + int retval = 0; + + dbg(udev, "vendor='%s'; model='%s'\n", vendor, model); + fd = fopen(config_file, "r"); + if (fd == NULL) { + dbg(udev, "can't open %s\n", config_file); + if (errno == ENOENT) { + return 1; + } else { + err(udev, "can't open %s: %s\n", config_file, strerror(errno)); + return -1; + } + } + + /* + * Allocate a buffer rather than put it on the stack so we can + * keep it around to parse any options (any allocated newargv + * points into this buffer for its strings). + */ + buffer = malloc(MAX_BUFFER_LEN); + if (!buffer) { + fclose(fd); + err(udev, "can't allocate memory\n"); + return -1; + } + + *newargv = NULL; + lineno = 0; + while (1) { + vendor_in = model_in = options_in = NULL; + + buf = fgets(buffer, MAX_BUFFER_LEN, fd); + if (buf == NULL) + break; + lineno++; + if (buf[strlen(buffer) - 1] != '\n') { + err(udev, "Config file line %d too long\n", lineno); + break; + } + + while (isspace(*buf)) + buf++; + + /* blank or all whitespace line */ + if (*buf == '\0') + continue; + + /* comment line */ + if (*buf == '#') + continue; + + dbg(udev, "lineno %d: '%s'\n", lineno, buf); + str1 = strsep(&buf, "="); + if (str1 && strcasecmp(str1, "VENDOR") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + vendor_in = str1; + + str1 = strsep(&buf, "="); + if (str1 && strcasecmp(str1, "MODEL") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + model_in = str1; + str1 = strsep(&buf, "="); + } + } + + if (str1 && strcasecmp(str1, "OPTIONS") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + options_in = str1; + } + dbg(udev, "config file line %d:\n" + " vendor '%s'; model '%s'; options '%s'\n", + lineno, vendor_in, model_in, options_in); + /* + * Only allow: [vendor=foo[,model=bar]]options=stuff + */ + if (!options_in || (!vendor_in && model_in)) { + err(udev, "Error parsing config file line %d '%s'\n", lineno, buffer); + retval = -1; + break; + } + if (vendor == NULL) { + if (vendor_in == NULL) { + dbg(udev, "matched global option\n"); + break; + } + } else if ((vendor_in && strncmp(vendor, vendor_in, + strlen(vendor_in)) == 0) && + (!model_in || (strncmp(model, model_in, + strlen(model_in)) == 0))) { + /* + * Matched vendor and optionally model. + * + * Note: a short vendor_in or model_in can + * give a partial match (that is FOO + * matches FOOBAR). + */ + dbg(udev, "matched vendor/model\n"); + break; + } else { + dbg(udev, "no match\n"); + } + } + + if (retval == 0) { + if (vendor_in != NULL || model_in != NULL || + options_in != NULL) { + /* + * Something matched. Allocate newargv, and store + * values found in options_in. + */ + strcpy(buffer, options_in); + c = argc_count(buffer) + 2; + *newargv = calloc(c, sizeof(**newargv)); + if (!*newargv) { + err(udev, "can't allocate memory\n"); + retval = -1; + } else { + *argc = c; + c = 0; + /* + * argv[0] at 0 is skipped by getopt, but + * store the buffer address there for + * later freeing + */ + (*newargv)[c] = buffer; + for (c = 1; c < *argc; c++) + (*newargv)[c] = strsep(&buffer, " \t"); + } + } else { + /* No matches */ + retval = 1; + } + } + if (retval != 0) + free(buffer); + fclose(fd); + return retval; +} + +static int set_options(struct udev *udev, + int argc, char **argv, const char *short_opts, + char *maj_min_dev) +{ + int option; + + /* + * optind is a global extern used by getopt. Since we can call + * set_options twice (once for command line, and once for config + * file) we have to reset this back to 1. + */ + optind = 1; + while (1) { + option = getopt_long(argc, argv, short_opts, options, NULL); + if (option == -1) + break; + + if (optarg) + dbg(udev, "option '%c' arg '%s'\n", option, optarg); + else + dbg(udev, "option '%c'\n", option); + + switch (option) { + case 'b': + all_good = 0; + break; + + case 'd': + dev_specified = 1; + util_strscpy(maj_min_dev, MAX_PATH_LEN, optarg); + break; + + case 'e': + use_stderr = 1; + break; + + case 'f': + util_strscpy(config_file, MAX_PATH_LEN, optarg); + break; + + case 'g': + all_good = 1; + break; + + case 'h': + printf("Usage: scsi_id OPTIONS \n" + " --device= device node for SG_IO commands\n" + " --config= location of config file\n" + " --page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\n" + " --sg-version=3|4 use SGv3 or SGv4\n" + " --blacklisted threat device as blacklisted\n" + " --whitelisted threat device as whitelisted\n" + " --replace-whitespace replace all whitespaces by underscores\n" + " --verbose verbose logging\n" + " --version print version\n" + " --export print values as environment keys\n" + " --help print this help text\n\n"); + exit(0); + + case 'p': + if (strcmp(optarg, "0x80") == 0) { + default_page_code = PAGE_80; + } else if (strcmp(optarg, "0x83") == 0) { + default_page_code = PAGE_83; + } else if (strcmp(optarg, "pre-spc3-83") == 0) { + default_page_code = PAGE_83_PRE_SPC3; + } else { + err(udev, "Unknown page code '%s'\n", optarg); + return -1; + } + break; + + case 's': + sg_version = atoi(optarg); + if (sg_version < 3 || sg_version > 4) { + err(udev, "Unknown SG version '%s'\n", optarg); + return -1; + } + break; + + case 'u': + reformat_serial = 1; + break; + + case 'x': + export = 1; + break; + + case 'v': + debug++; + break; + + case 'V': + printf("%s\n", VERSION); + exit(0); + break; + + default: + exit(1); + } + } + if (optind < argc && !dev_specified) { + dev_specified = 1; + util_strscpy(maj_min_dev, MAX_PATH_LEN, argv[optind]); + } + return 0; +} + +static int per_dev_options(struct udev *udev, + struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) +{ + int retval; + int newargc; + char **newargv = NULL; + int option; + + *good_bad = all_good; + *page_code = default_page_code; + + retval = get_file_options(udev, vendor_str, model_str, &newargc, &newargv); + + optind = 1; /* reset this global extern */ + while (retval == 0) { + option = getopt_long(newargc, newargv, dev_short_options, options, NULL); + if (option == -1) + break; + + if (optarg) + dbg(udev, "option '%c' arg '%s'\n", option, optarg); + else + dbg(udev, "option '%c'\n", option); + + switch (option) { + case 'b': + *good_bad = 0; + break; + + case 'g': + *good_bad = 1; + break; + + case 'p': + if (strcmp(optarg, "0x80") == 0) { + *page_code = PAGE_80; + } else if (strcmp(optarg, "0x83") == 0) { + *page_code = PAGE_83; + } else if (strcmp(optarg, "pre-spc3-83") == 0) { + *page_code = PAGE_83_PRE_SPC3; + } else { + err(udev, "Unknown page code '%s'\n", optarg); + retval = -1; + } + break; + + default: + err(udev, "Unknown or bad option '%c' (0x%x)\n", option, option); + retval = -1; + break; + } + } + + if (newargv) { + free(newargv[0]); + free(newargv); + } + return retval; +} + +static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, const char *path) +{ + int retval; + + dev_scsi->use_sg = sg_version; + + retval = scsi_std_inquiry(udev, dev_scsi, path); + if (retval) + return retval; + + udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); + udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); + + util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); + util_replace_chars(vendor_str, NULL); + util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); + util_replace_chars(model_str, NULL); + set_type(dev_scsi->type, type_str, sizeof(type_str)); + util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); + util_replace_chars(revision_str, NULL); + return 0; +} + +/* + * scsi_id: try to get an id, if one is found, printf it to stdout. + * returns a value passed to exit() - 0 if printed an id, else 1. + */ +static int scsi_id(struct udev *udev, char *maj_min_dev) +{ + struct scsi_id_device dev_scsi; + int good_dev; + int page_code; + int retval = 0; + + memset(&dev_scsi, 0x00, sizeof(struct scsi_id_device)); + + if (set_inq_values(udev, &dev_scsi, maj_min_dev) < 0) { + retval = 1; + goto out; + } + + /* get per device (vendor + model) options from the config file */ + per_dev_options(udev, &dev_scsi, &good_dev, &page_code); + dbg(udev, "per dev options: good %d; page code 0x%x\n", good_dev, page_code); + if (!good_dev) { + retval = 1; + goto out; + } + + /* read serial number from mode pages (no values for optical drives) */ + scsi_get_serial(udev, &dev_scsi, maj_min_dev, page_code, MAX_SERIAL_LEN); + + if (export) { + char serial_str[MAX_SERIAL_LEN]; + + printf("ID_SCSI=1\n"); + printf("ID_VENDOR=%s\n", vendor_str); + printf("ID_VENDOR_ENC=%s\n", vendor_enc_str); + printf("ID_MODEL=%s\n", model_str); + printf("ID_MODEL_ENC=%s\n", model_enc_str); + printf("ID_REVISION=%s\n", revision_str); + printf("ID_TYPE=%s\n", type_str); + if (dev_scsi.serial[0] != '\0') { + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("ID_SERIAL=%s\n", serial_str); + util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("ID_SERIAL_SHORT=%s\n", serial_str); + } + if (dev_scsi.wwn[0] != '\0') { + printf("ID_WWN=0x%s\n", dev_scsi.wwn); + if (dev_scsi.wwn_vendor_extension[0] != '\0') { + printf("ID_WWN_VENDOR_EXTENSION=0x%s\n", dev_scsi.wwn_vendor_extension); + printf("ID_WWN_WITH_EXTENSION=0x%s%s\n", dev_scsi.wwn, dev_scsi.wwn_vendor_extension); + } else { + printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn); + } + } + if (dev_scsi.tgpt_group[0] != '\0') { + printf("ID_TARGET_PORT=%s\n", dev_scsi.tgpt_group); + } + if (dev_scsi.unit_serial_number[0] != '\0') { + printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); + } + goto out; + } + + if (dev_scsi.serial[0] == '\0') { + retval = 1; + goto out; + } + + if (reformat_serial) { + char serial_str[MAX_SERIAL_LEN]; + + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("%s\n", serial_str); + goto out; + } + + printf("%s\n", dev_scsi.serial); +out: + return retval; +} + +int main(int argc, char **argv) +{ + struct udev *udev; + int retval = 0; + char maj_min_dev[MAX_PATH_LEN]; + int newargc; + char **newargv; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("scsi_id"); + udev_set_log_fn(udev, log_fn); + + /* + * Get config file options. + */ + newargv = NULL; + retval = get_file_options(udev, NULL, NULL, &newargc, &newargv); + if (retval < 0) { + retval = 1; + goto exit; + } + if (newargv && (retval == 0)) { + if (set_options(udev, newargc, newargv, short_options, maj_min_dev) < 0) { + retval = 2; + goto exit; + } + free(newargv); + } + + /* + * Get command line options (overriding any config file settings). + */ + if (set_options(udev, argc, argv, short_options, maj_min_dev) < 0) + exit(1); + + if (!dev_specified) { + err(udev, "no device specified\n"); + retval = 1; + goto exit; + } + + retval = scsi_id(udev, maj_min_dev); + +exit: + udev_unref(udev); + udev_log_close(); + return retval; +} diff --git a/src/extras/scsi_id/scsi_id.h b/src/extras/scsi_id/scsi_id.h new file mode 100644 index 0000000000..a28f5e073c --- /dev/null +++ b/src/extras/scsi_id/scsi_id.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) IBM Corp. 2003 + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#define MAX_PATH_LEN 512 + +/* + * MAX_ATTR_LEN: maximum length of the result of reading a sysfs + * attribute. + */ +#define MAX_ATTR_LEN 256 + +/* + * MAX_SERIAL_LEN: the maximum length of the serial number, including + * added prefixes such as vendor and product (model) strings. + */ +#define MAX_SERIAL_LEN 256 + +/* + * MAX_BUFFER_LEN: maximum buffer size and line length used while reading + * the config file. + */ +#define MAX_BUFFER_LEN 256 + +struct scsi_id_device { + char vendor[9]; + char model[17]; + char revision[5]; + char type[33]; + char kernel[64]; + char serial[MAX_SERIAL_LEN]; + char serial_short[MAX_SERIAL_LEN]; + int use_sg; + + /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */ + char unit_serial_number[MAX_SERIAL_LEN]; + + /* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */ + char wwn[17]; + + /* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */ + char wwn_vendor_extension[17]; + + /* NULs if not set - otherwise decimal number */ + char tgpt_group[8]; +}; + +extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); +extern int scsi_get_serial (struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname, + int page_code, int len); + +/* + * Page code values. + */ +enum page_code { + PAGE_83_PRE_SPC3 = -0x83, + PAGE_UNSPECIFIED = 0x00, + PAGE_80 = 0x80, + PAGE_83 = 0x83, +}; diff --git a/src/extras/scsi_id/scsi_serial.c b/src/extras/scsi_id/scsi_serial.c new file mode 100644 index 0000000000..61ec618e99 --- /dev/null +++ b/src/extras/scsi_id/scsi_serial.c @@ -0,0 +1,990 @@ +/* + * Copyright (C) IBM Corp. 2003 + * + * Author: Patrick Mansfield + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "scsi.h" +#include "scsi_id.h" + +/* + * A priority based list of id, naa, and binary/ascii for the identifier + * descriptor in VPD page 0x83. + * + * Brute force search for a match starting with the first value in the + * following id_search_list. This is not a performance issue, since there + * is normally one or some small number of descriptors. + */ +static const struct scsi_id_search_values id_search_list[] = { + { SCSI_ID_TGTGROUP, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_ASCII }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_ASCII }, + /* + * Devices already exist using NAA values that are now marked + * reserved. These should not conflict with other values, or it is + * a bug in the device. As long as we find the IEEE extended one + * first, we really don't care what other ones are used. Using + * don't care here means that a device that returns multiple + * non-IEEE descriptors in a random order will get different + * names. + */ + { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, +}; + +static const char hex_str[]="0123456789abcdef"; + +/* + * Values returned in the result/status, only the ones used by the code + * are used here. + */ + +#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ +#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ +#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ + +/* The following "category" function returns one of the following */ +#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ +#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ +#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ +#define SG_ERR_CAT_TIMEOUT 3 +#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ +#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ +#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ + +static int do_scsi_page80_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int max_len); + +static int sg_err_category_new(struct udev *udev, + int scsi_status, int msg_status, int + host_status, int driver_status, const + unsigned char *sense_buffer, int sb_len) +{ + scsi_status &= 0x7e; + + /* + * XXX change to return only two values - failed or OK. + */ + + if (!scsi_status && !host_status && !driver_status) + return SG_ERR_CAT_CLEAN; + + if ((scsi_status == SCSI_CHECK_CONDITION) || + (scsi_status == SCSI_COMMAND_TERMINATED) || + ((driver_status & 0xf) == DRIVER_SENSE)) { + if (sense_buffer && (sb_len > 2)) { + int sense_key; + unsigned char asc; + + if (sense_buffer[0] & 0x2) { + sense_key = sense_buffer[1] & 0xf; + asc = sense_buffer[2]; + } else { + sense_key = sense_buffer[2] & 0xf; + asc = (sb_len > 12) ? sense_buffer[12] : 0; + } + + if (sense_key == RECOVERED_ERROR) + return SG_ERR_CAT_RECOVERED; + else if (sense_key == UNIT_ATTENTION) { + if (0x28 == asc) + return SG_ERR_CAT_MEDIA_CHANGED; + if (0x29 == asc) + return SG_ERR_CAT_RESET; + } else if (sense_key == ILLEGAL_REQUEST) { + return SG_ERR_CAT_NOTSUPPORTED; + } + } + return SG_ERR_CAT_SENSE; + } + if (host_status) { + if ((host_status == DID_NO_CONNECT) || + (host_status == DID_BUS_BUSY) || + (host_status == DID_TIME_OUT)) + return SG_ERR_CAT_TIMEOUT; + } + if (driver_status) { + if (driver_status == DRIVER_TIMEOUT) + return SG_ERR_CAT_TIMEOUT; + } + return SG_ERR_CAT_OTHER; +} + +static int sg_err_category3(struct udev *udev, struct sg_io_hdr *hp) +{ + return sg_err_category_new(udev, + hp->status, hp->msg_status, + hp->host_status, hp->driver_status, + hp->sbp, hp->sb_len_wr); +} + +static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) +{ + return sg_err_category_new(udev, hp->device_status, 0, + hp->transport_status, hp->driver_status, + (unsigned char *)(uintptr_t)hp->response, + hp->response_len); +} + +static int scsi_dump_sense(struct udev *udev, + struct scsi_id_device *dev_scsi, + unsigned char *sense_buffer, int sb_len) +{ + int s; + int code; + int sense_class; + int sense_key; + int asc, ascq; +#ifdef DUMP_SENSE + char out_buffer[256]; + int i, j; +#endif + + /* + * Figure out and print the sense key, asc and ascq. + * + * If you want to suppress these for a particular drive model, add + * a black list entry in the scsi_id config file. + * + * XXX We probably need to: lookup the sense/asc/ascq in a retry + * table, and if found return 1 (after dumping the sense, asc, and + * ascq). So, if/when we get something like a power on/reset, + * we'll retry the command. + */ + + dbg(udev, "got check condition\n"); + + if (sb_len < 1) { + info(udev, "%s: sense buffer empty\n", dev_scsi->kernel); + return -1; + } + + sense_class = (sense_buffer[0] >> 4) & 0x07; + code = sense_buffer[0] & 0xf; + + if (sense_class == 7) { + /* + * extended sense data. + */ + s = sense_buffer[7] + 8; + if (sb_len < s) { + info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", + dev_scsi->kernel, sb_len, s - sb_len); + return -1; + } + if ((code == 0x0) || (code == 0x1)) { + sense_key = sense_buffer[2] & 0xf; + if (s < 14) { + /* + * Possible? + */ + info(udev, "%s: sense result too" " small %d bytes\n", + dev_scsi->kernel, s); + return -1; + } + asc = sense_buffer[12]; + ascq = sense_buffer[13]; + } else if ((code == 0x2) || (code == 0x3)) { + sense_key = sense_buffer[1] & 0xf; + asc = sense_buffer[2]; + ascq = sense_buffer[3]; + } else { + info(udev, "%s: invalid sense code 0x%x\n", + dev_scsi->kernel, code); + return -1; + } + info(udev, "%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", + dev_scsi->kernel, sense_key, asc, ascq); + } else { + if (sb_len < 4) { + info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", + dev_scsi->kernel, sb_len, 4 - sb_len); + return -1; + } + + if (sense_buffer[0] < 15) + info(udev, "%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); + else + info(udev, "%s: sense = %2x %2x\n", + dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); + info(udev, "%s: non-extended sense class %d code 0x%0x\n", + dev_scsi->kernel, sense_class, code); + + } + +#ifdef DUMP_SENSE + for (i = 0, j = 0; (i < s) && (j < 254); i++) { + dbg(udev, "i %d, j %d\n", i, j); + out_buffer[j++] = hex_str[(sense_buffer[i] & 0xf0) >> 4]; + out_buffer[j++] = hex_str[sense_buffer[i] & 0x0f]; + out_buffer[j++] = ' '; + } + out_buffer[j] = '\0'; + info(udev, "%s: sense dump:\n", dev_scsi->kernel); + info(udev, "%s: %s\n", dev_scsi->kernel, out_buffer); + +#endif + return -1; +} + +static int scsi_dump(struct udev *udev, + struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) +{ + if (!io->status && !io->host_status && !io->msg_status && + !io->driver_status) { + /* + * Impossible, should not be called. + */ + info(udev, "%s: called with no error\n", __FUNCTION__); + return -1; + } + + info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", + dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); + if (io->status == SCSI_CHECK_CONDITION) + return scsi_dump_sense(udev, dev_scsi, io->sbp, io->sb_len_wr); + else + return -1; +} + +static int scsi_dump_v4(struct udev *udev, + struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) +{ + if (!io->device_status && !io->transport_status && + !io->driver_status) { + /* + * Impossible, should not be called. + */ + info(udev, "%s: called with no error\n", __FUNCTION__); + return -1; + } + + info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x\n", + dev_scsi->kernel, io->driver_status, io->transport_status, + io->device_status); + if (io->device_status == SCSI_CHECK_CONDITION) + return scsi_dump_sense(udev, dev_scsi, (unsigned char *)(uintptr_t)io->response, + io->response_len); + else + return -1; +} + +static int scsi_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + unsigned char evpd, unsigned char page, + unsigned char *buf, unsigned int buflen) +{ + unsigned char inq_cmd[INQUIRY_CMDLEN] = + { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; + unsigned char sense[SENSE_BUFF_LEN]; + void *io_buf; + struct sg_io_v4 io_v4; + struct sg_io_hdr io_hdr; + int retry = 3; /* rather random */ + int retval; + + if (buflen > SCSI_INQ_BUFF_LEN) { + info(udev, "buflen %d too long\n", buflen); + return -1; + } + +resend: + dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); + + if (dev_scsi->use_sg == 4) { + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof(inq_cmd); + io_v4.request = (uintptr_t)inq_cmd; + io_v4.max_response_len = sizeof(sense); + io_v4.response = (uintptr_t)sense; + io_v4.din_xfer_len = buflen; + io_v4.din_xferp = (uintptr_t)buf; + io_buf = (void *)&io_v4; + } else { + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof(inq_cmd); + io_hdr.mx_sb_len = sizeof(sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = buflen; + io_hdr.dxferp = buf; + io_hdr.cmdp = inq_cmd; + io_hdr.sbp = sense; + io_hdr.timeout = DEF_TIMEOUT; + io_buf = (void *)&io_hdr; + } + + retval = ioctl(fd, SG_IO, io_buf); + if (retval < 0) { + if ((errno == EINVAL || errno == ENOSYS) && dev_scsi->use_sg == 4) { + dev_scsi->use_sg = 3; + goto resend; + } + info(udev, "%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); + goto error; + } + + if (dev_scsi->use_sg == 4) + retval = sg_err_category4(udev, io_buf); + else + retval = sg_err_category3(udev, io_buf); + + switch (retval) { + case SG_ERR_CAT_NOTSUPPORTED: + buf[1] = 0; + /* Fallthrough */ + case SG_ERR_CAT_CLEAN: + case SG_ERR_CAT_RECOVERED: + retval = 0; + break; + + default: + if (dev_scsi->use_sg == 4) + retval = scsi_dump_v4(udev, dev_scsi, io_buf); + else + retval = scsi_dump(udev, dev_scsi, io_buf); + } + + if (!retval) { + retval = buflen; + } else if (retval > 0) { + if (--retry > 0) { + dbg(udev, "%s: Retrying ...\n", dev_scsi->kernel); + goto resend; + } + retval = -1; + } + +error: + if (retval < 0) + info(udev, "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", + dev_scsi->kernel, evpd, page); + + return retval; +} + +/* Get list of supported EVPD pages */ +static int do_scsi_page0_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + unsigned char *buffer, unsigned int len) +{ + int retval; + + memset(buffer, 0, len); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, 0x0, buffer, len); + if (retval < 0) + return 1; + + if (buffer[1] != 0) { + info(udev, "%s: page 0 not available.\n", dev_scsi->kernel); + return 1; + } + if (buffer[3] > len) { + info(udev, "%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); + return 1; + } + + /* + * Following check is based on code once included in the 2.5.x + * kernel. + * + * Some ill behaved devices return the standard inquiry here + * rather than the evpd data, snoop the data to verify. + */ + if (buffer[3] > MODEL_LENGTH) { + /* + * If the vendor id appears in the page assume the page is + * invalid. + */ + if (!strncmp((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) { + info(udev, "%s: invalid page0 data\n", dev_scsi->kernel); + return 1; + } + } + return 0; +} + +/* + * The caller checks that serial is long enough to include the vendor + + * model. + */ +static int prepend_vendor_model(struct udev *udev, + struct scsi_id_device *dev_scsi, char *serial) +{ + int ind; + + strncpy(serial, dev_scsi->vendor, VENDOR_LENGTH); + strncat(serial, dev_scsi->model, MODEL_LENGTH); + ind = strlen(serial); + + /* + * This is not a complete check, since we are using strncat/cpy + * above, ind will never be too large. + */ + if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { + info(udev, "%s: expected length %d, got length %d\n", + dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); + return -1; + } + return ind; +} + +/** + * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill + * serial number. + **/ +static int check_fill_0x83_id(struct udev *udev, + struct scsi_id_device *dev_scsi, + unsigned char *page_83, + const struct scsi_id_search_values + *id_search, char *serial, char *serial_short, + int max_len, char *wwn, + char *wwn_vendor_extension, char *tgpt_group) +{ + int i, j, s, len; + + /* + * ASSOCIATION must be with the device (value 0) + * or with the target port for SCSI_ID_TGTPORT + */ + if ((page_83[1] & 0x30) == 0x10) { + if (id_search->id_type != SCSI_ID_TGTGROUP) + return 1; + } else if ((page_83[1] & 0x30) != 0) { + return 1; + } + + if ((page_83[1] & 0x0f) != id_search->id_type) + return 1; + + /* + * Possibly check NAA sub-type. + */ + if ((id_search->naa_type != SCSI_ID_NAA_DONT_CARE) && + (id_search->naa_type != (page_83[4] & 0xf0) >> 4)) + return 1; + + /* + * Check for matching code set - ASCII or BINARY. + */ + if ((page_83[0] & 0x0f) != id_search->code_set) + return 1; + + /* + * page_83[3]: identifier length + */ + len = page_83[3]; + if ((page_83[0] & 0x0f) != SCSI_ID_ASCII) + /* + * If not ASCII, use two bytes for each binary value. + */ + len *= 2; + + /* + * Add one byte for the NUL termination, and one for the id_type. + */ + len += 2; + if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) + len += VENDOR_LENGTH + MODEL_LENGTH; + + if (max_len < len) { + info(udev, "%s: length %d too short - need %d\n", + dev_scsi->kernel, max_len, len); + return 1; + } + + if (id_search->id_type == SCSI_ID_TGTGROUP && tgpt_group != NULL) { + unsigned int group; + + group = ((unsigned int)page_83[6] << 8) | page_83[7]; + sprintf(tgpt_group,"%x", group); + return 1; + } + + serial[0] = hex_str[id_search->id_type]; + + /* + * For SCSI_ID_VENDOR_SPECIFIC prepend the vendor and model before + * the id since it is not unique across all vendors and models, + * this differs from SCSI_ID_T10_VENDOR, where the vendor is + * included in the identifier. + */ + if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) + if (prepend_vendor_model(udev, dev_scsi, &serial[1]) < 0) { + dbg(udev, "prepend failed\n"); + return 1; + } + + i = 4; /* offset to the start of the identifier */ + s = j = strlen(serial); + if ((page_83[0] & 0x0f) == SCSI_ID_ASCII) { + /* + * ASCII descriptor. + */ + while (i < (4 + page_83[3])) + serial[j++] = page_83[i++]; + } else { + /* + * Binary descriptor, convert to ASCII, using two bytes of + * ASCII for each byte in the page_83. + */ + while (i < (4 + page_83[3])) { + serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; + serial[j++] = hex_str[page_83[i] & 0x0f]; + i++; + } + } + + strcpy(serial_short, &serial[s]); + + if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { + strncpy(wwn, &serial[s], 16); + if (wwn_vendor_extension != NULL) { + strncpy(wwn_vendor_extension, &serial[s + 16], 16); + } + } + + return 0; +} + +/* Extract the raw binary from VPD 0x83 pre-SPC devices */ +static int check_fill_0x83_prespc3(struct udev *udev, + struct scsi_id_device *dev_scsi, + unsigned char *page_83, + const struct scsi_id_search_values + *id_search, char *serial, char *serial_short, int max_len) +{ + int i, j; + + dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); + serial[0] = hex_str[id_search->id_type]; + /* serial has been memset to zero before */ + j = strlen(serial); /* j = 1; */ + + for (i = 0; (i < page_83[3]) && (j < max_len-3); ++i) { + serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; + serial[j++] = hex_str[ page_83[4+i] & 0x0f]; + } + serial[max_len-1] = 0; + strncpy(serial_short, serial, max_len-1); + return 0; +} + + +/* Get device identification VPD page */ +static int do_scsi_page83_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int len, + char *unit_serial_number, char *wwn, + char *wwn_vendor_extension, char *tgpt_group) +{ + int retval; + unsigned int id_ind, j; + unsigned char page_83[SCSI_INQ_BUFF_LEN]; + + /* also pick up the page 80 serial number */ + do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN); + + memset(page_83, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, + SCSI_INQ_BUFF_LEN); + if (retval < 0) + return 1; + + if (page_83[1] != PAGE_83) { + info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); + return 1; + } + + /* + * XXX Some devices (IBM 3542) return all spaces for an identifier if + * the LUN is not actually configured. This leads to identifiers of + * the form: "1 ". + */ + + /* + * Model 4, 5, and (some) model 6 EMC Symmetrix devices return + * a page 83 reply according to SCSI-2 format instead of SPC-2/3. + * + * The SCSI-2 page 83 format returns an IEEE WWN in binary + * encoded hexi-decimal in the 16 bytes following the initial + * 4-byte page 83 reply header. + * + * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part + * of an Identification descriptor. The 3rd byte of the first + * Identification descriptor is a reserved (BSZ) byte field. + * + * Reference the 7th byte of the page 83 reply to determine + * whether the reply is compliant with SCSI-2 or SPC-2/3 + * specifications. A zero value in the 7th byte indicates + * an SPC-2/3 conformant reply, (i.e., the reserved field of the + * first Identification descriptor). This byte will be non-zero + * for a SCSI-2 conformant page 83 reply from these EMC + * Symmetrix models since the 7th byte of the reply corresponds + * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, + * 0x006048. + */ + + if (page_83[6] != 0) + return check_fill_0x83_prespc3(udev, + dev_scsi, page_83, id_search_list, + serial, serial_short, len); + + /* + * Search for a match in the prioritized id_search_list - since WWN ids + * come first we can pick up the WWN in check_fill_0x83_id(). + */ + for (id_ind = 0; + id_ind < sizeof(id_search_list)/sizeof(id_search_list[0]); + id_ind++) { + /* + * Examine each descriptor returned. There is normally only + * one or a small number of descriptors. + */ + for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { + retval = check_fill_0x83_id(udev, + dev_scsi, &page_83[j], + &id_search_list[id_ind], + serial, serial_short, len, + wwn, wwn_vendor_extension, + tgpt_group); + dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, + id_search_list[id_ind].id_type, + id_search_list[id_ind].naa_type, + id_search_list[id_ind].code_set); + if (!retval) { + dbg(udev, " used\n"); + return retval; + } else if (retval < 0) { + dbg(udev, " failed\n"); + return retval; + } else { + dbg(udev, " not used\n"); + } + } + } + return 1; +} + +/* + * Get device identification VPD page for older SCSI-2 device which is not + * compliant with either SPC-2 or SPC-3 format. + * + * Return the hard coded error code value 2 if the page 83 reply is not + * conformant to the SCSI-2 format. + */ +static int do_scsi_page83_prespc3_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int len) +{ + int retval; + int i, j; + unsigned char page_83[SCSI_INQ_BUFF_LEN]; + + memset(page_83, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); + if (retval < 0) + return 1; + + if (page_83[1] != PAGE_83) { + info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); + return 1; + } + /* + * Model 4, 5, and (some) model 6 EMC Symmetrix devices return + * a page 83 reply according to SCSI-2 format instead of SPC-2/3. + * + * The SCSI-2 page 83 format returns an IEEE WWN in binary + * encoded hexi-decimal in the 16 bytes following the initial + * 4-byte page 83 reply header. + * + * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part + * of an Identification descriptor. The 3rd byte of the first + * Identification descriptor is a reserved (BSZ) byte field. + * + * Reference the 7th byte of the page 83 reply to determine + * whether the reply is compliant with SCSI-2 or SPC-2/3 + * specifications. A zero value in the 7th byte indicates + * an SPC-2/3 conformant reply, (i.e., the reserved field of the + * first Identification descriptor). This byte will be non-zero + * for a SCSI-2 conformant page 83 reply from these EMC + * Symmetrix models since the 7th byte of the reply corresponds + * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, + * 0x006048. + */ + if (page_83[6] == 0) + return 2; + + serial[0] = hex_str[id_search_list[0].id_type]; + /* + * The first four bytes contain data, not a descriptor. + */ + i = 4; + j = strlen(serial); + /* + * Binary descriptor, convert to ASCII, + * using two bytes of ASCII for each byte + * in the page_83. + */ + while (i < (page_83[3]+4)) { + serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; + serial[j++] = hex_str[page_83[i] & 0x0f]; + i++; + } + dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); + return 0; +} + +/* Get unit serial number VPD page */ +static int do_scsi_page80_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int max_len) +{ + int retval; + int ser_ind; + int i; + int len; + unsigned char buf[SCSI_INQ_BUFF_LEN]; + + memset(buf, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); + if (retval < 0) + return retval; + + if (buf[1] != PAGE_80) { + info(udev, "%s: Invalid page 0x80\n", dev_scsi->kernel); + return 1; + } + + len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; + if (max_len < len) { + info(udev, "%s: length %d too short - need %d\n", + dev_scsi->kernel, max_len, len); + return 1; + } + /* + * Prepend 'S' to avoid unlikely collision with page 0x83 vendor + * specific type where we prepend '0' + vendor + model. + */ + len = buf[3]; + if (serial != NULL) { + serial[0] = 'S'; + ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]); + if (ser_ind < 0) + return 1; + for (i = 4; i < len + 4; i++, ser_ind++) + serial[ser_ind] = buf[i]; + } + if (serial_short != NULL) { + memcpy(serial_short, &buf[4], len); + serial_short[len] = '\0'; + } + return 0; +} + +int scsi_std_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, const char *devname) +{ + int fd; + unsigned char buf[SCSI_INQ_BUFF_LEN]; + struct stat statbuf; + int err = 0; + + dbg(udev, "opening %s\n", devname); + fd = open(devname, O_RDONLY | O_NONBLOCK); + if (fd < 0) { + info(udev, "scsi_id: cannot open %s: %s\n", + devname, strerror(errno)); + return 1; + } + + if (fstat(fd, &statbuf) < 0) { + info(udev, "scsi_id: cannot stat %s: %s\n", + devname, strerror(errno)); + err = 2; + goto out; + } + sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev), + minor(statbuf.st_rdev)); + + memset(buf, 0, SCSI_INQ_BUFF_LEN); + err = scsi_inquiry(udev, dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); + if (err < 0) + goto out; + + err = 0; + memcpy(dev_scsi->vendor, buf + 8, 8); + dev_scsi->vendor[8] = '\0'; + memcpy(dev_scsi->model, buf + 16, 16); + dev_scsi->model[16] = '\0'; + memcpy(dev_scsi->revision, buf + 32, 4); + dev_scsi->revision[4] = '\0'; + sprintf(dev_scsi->type,"%x", buf[0] & 0x1f); + +out: + close(fd); + return err; +} + +int scsi_get_serial(struct udev *udev, + struct scsi_id_device *dev_scsi, const char *devname, + int page_code, int len) +{ + unsigned char page0[SCSI_INQ_BUFF_LEN]; + int fd = -1; + int cnt; + int ind; + int retval; + + memset(dev_scsi->serial, 0, len); + dbg(udev, "opening %s\n", devname); + srand((unsigned int)getpid()); + for (cnt = 20; cnt > 0; cnt--) { + struct timespec duration; + + fd = open(devname, O_RDONLY | O_NONBLOCK); + if (fd >= 0 || errno != EBUSY) + break; + duration.tv_sec = 0; + duration.tv_nsec = (200 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); + nanosleep(&duration, NULL); + } + if (fd < 0) + return 1; + + if (page_code == PAGE_80) { + if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } else if (page_code == PAGE_83) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } else if (page_code == PAGE_83_PRE_SPC3) { + retval = do_scsi_page83_prespc3_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len); + if (retval) { + /* + * Fallback to servicing a SPC-2/3 compliant page 83 + * inquiry if the page 83 reply format does not + * conform to pre-SPC3 expectations. + */ + if (retval == 2) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } + else { + retval = 1; + goto completed; + } + } else { + retval = 0; + goto completed; + } + } else if (page_code != 0x00) { + info(udev, "%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); + return 1; + } + + /* + * Get page 0, the page of the pages. By default, try from best to + * worst of supported pages: 0x83 then 0x80. + */ + if (do_scsi_page0_inquiry(udev, dev_scsi, fd, page0, SCSI_INQ_BUFF_LEN)) { + /* + * Don't try anything else. Black list if a specific page + * should be used for this vendor+model, or maybe have an + * optional fall-back to page 0x80 or page 0x83. + */ + retval = 1; + goto completed; + } + + dbg(udev, "%s: Checking page0\n", dev_scsi->kernel); + + for (ind = 4; ind <= page0[3] + 3; ind++) + if (page0[ind] == PAGE_83) + if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, + dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { + /* + * Success + */ + retval = 0; + goto completed; + } + + for (ind = 4; ind <= page0[3] + 3; ind++) + if (page0[ind] == PAGE_80) + if (!do_scsi_page80_inquiry(udev, dev_scsi, fd, + dev_scsi->serial, dev_scsi->serial_short, len)) { + /* + * Success + */ + retval = 0; + goto completed; + } + retval = 1; + +completed: + close(fd); + return retval; +} diff --git a/src/extras/udev-acl/.gitignore b/src/extras/udev-acl/.gitignore new file mode 100644 index 0000000000..08891fed02 --- /dev/null +++ b/src/extras/udev-acl/.gitignore @@ -0,0 +1 @@ +udev-acl diff --git a/src/extras/udev-acl/70-udev-acl.rules b/src/extras/udev-acl/70-udev-acl.rules new file mode 100644 index 0000000000..2dac283101 --- /dev/null +++ b/src/extras/udev-acl/70-udev-acl.rules @@ -0,0 +1,76 @@ +# do not edit this file, it will be overwritten on update + +# Do not use TAG+="udev-acl" outside of this file. This variable is private to +# udev-acl of this udev release and may be replaced at any time. + +ENV{MAJOR}=="", GOTO="acl_end" +ACTION=="remove", GOTO="acl_apply" + +# systemd replaces udev-acl entirely, skip if active +TEST=="/sys/fs/cgroup/systemd", TAG=="uaccess", GOTO="acl_end" + +# PTP/MTP protocol devices, cameras, portable media players +SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="udev-acl" + +# digicams with proprietary protocol +ENV{ID_GPHOTO2}=="*?", TAG+="udev-acl" + +# SCSI and USB scanners +ENV{libsane_matched}=="yes", TAG+="udev-acl" + +# HPLIP devices (necessary for ink level check and HP tool maintenance) +ENV{ID_HPLIP}=="1", TAG+="udev-acl" + +# optical drives +SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="udev-acl" + +# sound devices +SUBSYSTEM=="sound", TAG+="udev-acl" + +# ffado is an userspace driver for firewire sound cards +SUBSYSTEM=="firewire", ENV{ID_FFADO}=="1", TAG+="udev-acl" + +# webcams, frame grabber, TV cards +SUBSYSTEM=="video4linux", TAG+="udev-acl" +SUBSYSTEM=="dvb", TAG+="udev-acl" + +# IIDC devices: industrial cameras and some webcams +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG+="udev-acl" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", TAG+="udev-acl" +# AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="udev-acl" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", TAG+="udev-acl" + +# DRI video devices +SUBSYSTEM=="drm", KERNEL=="card*", TAG+="udev-acl" + +# KVM +SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="udev-acl" + +# smart-card readers +ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" + +# PDA devices +ENV{ID_PDA}=="*?", TAG+="udev-acl" + +# Programmable remote control +ENV{ID_REMOTE_CONTROL}=="1", TAG+="udev-acl" + +# joysticks +SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" + +# color measurement devices +ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="udev-acl" + +# DDC/CI device, usually high-end monitors such as the DreamColor +ENV{DDC_DEVICE}=="*?", TAG+="udev-acl" + +# media player raw devices (for user-mode drivers, Android SDK, etc.) +SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="udev-acl" + +# apply ACL for all locally logged in users +LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ + RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" + +LABEL="acl_end" diff --git a/src/extras/udev-acl/udev-acl.c b/src/extras/udev-acl/udev-acl.c new file mode 100644 index 0000000000..41e2536e03 --- /dev/null +++ b/src/extras/udev-acl/udev-acl.c @@ -0,0 +1,430 @@ +/* + * Copyright (C) 2009 Kay Sievers + * + * 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; either version 2 of the + * License, or (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int debug; + +enum{ + ACTION_NONE = 0, + ACTION_REMOVE, + ACTION_ADD, + ACTION_CHANGE +}; + +static int set_facl(const char* filename, uid_t uid, int add) +{ + int get; + acl_t acl; + acl_entry_t entry = NULL; + acl_entry_t e; + acl_permset_t permset; + int ret; + + /* don't touch ACLs for root */ + if (uid == 0) + return 0; + + /* read current record */ + acl = acl_get_file(filename, ACL_TYPE_ACCESS); + if (!acl) + return -1; + + /* locate ACL_USER entry for uid */ + get = acl_get_entry(acl, ACL_FIRST_ENTRY, &e); + while (get == 1) { + acl_tag_t t; + + acl_get_tag_type(e, &t); + if (t == ACL_USER) { + uid_t *u; + + u = (uid_t*)acl_get_qualifier(e); + if (u == NULL) { + ret = -1; + goto out; + } + if (*u == uid) { + entry = e; + acl_free(u); + break; + } + acl_free(u); + } + + get = acl_get_entry(acl, ACL_NEXT_ENTRY, &e); + } + + /* remove ACL_USER entry for uid */ + if (!add) { + if (entry == NULL) { + ret = 0; + goto out; + } + acl_delete_entry(acl, entry); + goto update; + } + + /* create ACL_USER entry for uid */ + if (entry == NULL) { + ret = acl_create_entry(&acl, &entry); + if (ret != 0) + goto out; + acl_set_tag_type(entry, ACL_USER); + acl_set_qualifier(entry, &uid); + } + + /* add permissions for uid */ + acl_get_permset(entry, &permset); + acl_add_perm(permset, ACL_READ|ACL_WRITE); +update: + /* update record */ + if (debug) + printf("%c%u %s\n", add ? '+' : '-', uid, filename); + acl_calc_mask(&acl); + ret = acl_set_file(filename, ACL_TYPE_ACCESS, acl); + if (ret != 0) + goto out; +out: + acl_free(acl); + return ret; +} + +/* check if a given uid is listed */ +static int uid_in_list(GSList *list, uid_t uid) +{ + GSList *l; + + for (l = list; l != NULL; l = g_slist_next(l)) + if (uid == GPOINTER_TO_UINT(l->data)) + return 1; + return 0; +} + +/* return list of current uids of local active sessions */ +static GSList *uids_with_local_active_session(const char *own_id) +{ + GSList *list = NULL; + GKeyFile *keyfile; + + keyfile = g_key_file_new(); + if (g_key_file_load_from_file(keyfile, "/var/run/ConsoleKit/database", 0, NULL)) { + gchar **groups; + + groups = g_key_file_get_groups(keyfile, NULL); + if (groups != NULL) { + int i; + + for (i = 0; groups[i] != NULL; i++) { + uid_t u; + + if (!g_str_has_prefix(groups[i], "Session ")) + continue; + if (own_id != NULL &&g_str_has_suffix(groups[i], own_id)) + continue; + if (!g_key_file_get_boolean(keyfile, groups[i], "is_local", NULL)) + continue; + if (!g_key_file_get_boolean(keyfile, groups[i], "is_active", NULL)) + continue; + u = g_key_file_get_integer(keyfile, groups[i], "uid", NULL); + if (u > 0 && !uid_in_list(list, u)) + list = g_slist_prepend(list, GUINT_TO_POINTER(u)); + } + g_strfreev(groups); + } + } + g_key_file_free(keyfile); + + return list; +} + +/* ConsoleKit calls us with special variables */ +static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, const char **remove_session_id, int *action) +{ + int a = ACTION_NONE; + uid_t u = 0; + uid_t u2 = 0; + const char *s; + const char *s2; + const char *old_session = NULL; + + if (ck_action == NULL || strcmp(ck_action, "seat_active_session_changed") != 0) + return -1; + + /* We can have one of: remove, add, change, no-change */ + s = getenv("CK_SEAT_OLD_SESSION_ID"); + s2 = getenv("CK_SEAT_SESSION_ID"); + if (s == NULL && s2 == NULL) { + return -1; + } else if (s2 == NULL) { + a = ACTION_REMOVE; + } else if (s == NULL) { + a = ACTION_ADD; + } else { + a = ACTION_CHANGE; + } + + switch (a) { + case ACTION_ADD: + s = getenv("CK_SEAT_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + + s = getenv("CK_SEAT_SESSION_IS_LOCAL"); + if (s == NULL) + return -1; + if (strcmp(s, "true") != 0) + return 0; + + break; + case ACTION_REMOVE: + s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + + s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); + if (s == NULL) + return -1; + if (strcmp(s, "true") != 0) + return 0; + + old_session = getenv("CK_SEAT_OLD_SESSION_ID"); + if (old_session == NULL) + return -1; + + break; + case ACTION_CHANGE: + s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + s = getenv("CK_SEAT_SESSION_USER_UID"); + if (s == NULL) + return -1; + u2 = strtoul(s, NULL, 10); + + s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); + s2 = getenv("CK_SEAT_SESSION_IS_LOCAL"); + if (s == NULL || s2 == NULL) + return -1; + /* don't process non-local session changes */ + if (strcmp(s, "true") != 0 && strcmp(s2, "true") != 0) + return 0; + + if (strcmp(s, "true") == 0 && strcmp(s, "true") == 0) { + /* process the change */ + if (u == u2) { + /* special case: we noop if we are + * changing between local sessions for + * the same uid */ + a = ACTION_NONE; + } + old_session = getenv("CK_SEAT_OLD_SESSION_ID"); + if (old_session == NULL) + return -1; + } else if (strcmp(s, "true") == 0) { + /* only process the removal */ + a = ACTION_REMOVE; + old_session = getenv("CK_SEAT_OLD_SESSION_ID"); + if (old_session == NULL) + return -1; + } else if (strcmp(s2, "true") == 0) { + /* only process the addition */ + a = ACTION_ADD; + u = u2; + } + break; + } + + *remove_session_id = old_session; + *uid = u; + *uid2 = u2; + *action = a; + return 0; +} + +/* add or remove a ACL for a given uid from all matching devices */ +static void apply_acl_to_devices(uid_t uid, int add) +{ + struct udev *udev; + struct udev_enumerate *enumerate; + struct udev_list_entry *list_entry; + + /* iterate over all devices tagged with ACL_SET */ + udev = udev_new(); + enumerate = udev_enumerate_new(udev); + udev_enumerate_add_match_tag(enumerate, "udev-acl"); + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + const char *node; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + node = udev_device_get_devnode(device); + if (node == NULL) { + udev_device_unref(device); + continue; + } + set_facl(node, uid, add); + udev_device_unref(device); + } + udev_enumerate_unref(enumerate); + udev_unref(udev); +} + +static void +remove_uid (uid_t uid, const char *remove_session_id) +{ + /* + * Remove ACL for given uid from all matching devices + * when there is currently no local active session. + */ + GSList *list; + + list = uids_with_local_active_session(remove_session_id); + if (!uid_in_list(list, uid)) + apply_acl_to_devices(uid, 0); + g_slist_free(list); +} + +int main (int argc, char* argv[]) +{ + static const struct option options[] = { + { "action", required_argument, NULL, 'a' }, + { "device", required_argument, NULL, 'D' }, + { "user", required_argument, NULL, 'u' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + int action = -1; + const char *device = NULL; + bool uid_given = false; + uid_t uid = 0; + uid_t uid2 = 0; + const char* remove_session_id = NULL; + int rc = 0; + + /* valgrind is more important to us than a slice allocator */ + g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, 1); + + while (1) { + int option; + + option = getopt_long(argc, argv, "+a:D:u:dh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'a': + if (strcmp(optarg, "remove") == 0) + action = ACTION_REMOVE; + else + action = ACTION_ADD; + break; + case 'D': + device = optarg; + break; + case 'u': + uid_given = true; + uid = strtoul(optarg, NULL, 10); + break; + case 'd': + debug = 1; + break; + case 'h': + printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n"); + goto out; + } + } + + if (action < 0 && device == NULL && !uid_given) + if (!consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action)) + uid_given = true; + + if (action < 0) { + fprintf(stderr, "missing action\n\n"); + rc = 2; + goto out; + } + + if (device != NULL && uid_given) { + fprintf(stderr, "only one option, --device=DEVICEFILE or --user=UID expected\n\n"); + rc = 3; + goto out; + } + + if (uid_given) { + switch (action) { + case ACTION_ADD: + /* Add ACL for given uid to all matching devices. */ + apply_acl_to_devices(uid, 1); + break; + case ACTION_REMOVE: + remove_uid(uid, remove_session_id); + break; + case ACTION_CHANGE: + remove_uid(uid, remove_session_id); + apply_acl_to_devices(uid2, 1); + break; + case ACTION_NONE: + goto out; + break; + default: + g_assert_not_reached(); + break; + } + } else if (device != NULL) { + /* + * Add ACLs for all current session uids to a given device. + * + * Or remove ACLs for uids which do not have any current local + * active session. Remove is not really interesting, because in + * most cases the device node is removed anyway. + */ + GSList *list; + GSList *l; + + list = uids_with_local_active_session(NULL); + for (l = list; l != NULL; l = g_slist_next(l)) { + uid_t u; + + u = GPOINTER_TO_UINT(l->data); + if (action == ACTION_ADD || !uid_in_list(list, u)) + set_facl(device, u, action == ACTION_ADD); + } + g_slist_free(list); + } else { + fprintf(stderr, "--device=DEVICEFILE or --user=UID expected\n\n"); + rc = 3; + } +out: + return rc; +} diff --git a/src/extras/v4l_id/.gitignore b/src/extras/v4l_id/.gitignore new file mode 100644 index 0000000000..dffced9f08 --- /dev/null +++ b/src/extras/v4l_id/.gitignore @@ -0,0 +1 @@ +v4l_id diff --git a/src/extras/v4l_id/60-persistent-v4l.rules b/src/extras/v4l_id/60-persistent-v4l.rules new file mode 100644 index 0000000000..93c5ee8c27 --- /dev/null +++ b/src/extras/v4l_id/60-persistent-v4l.rules @@ -0,0 +1,20 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="persistent_v4l_end" +SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" +ENV{MAJOR}=="", GOTO="persistent_v4l_end" + +IMPORT{program}="v4l_id $devnode" + +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" +KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" + +# check for valid "index" number +TEST!="index", GOTO="persistent_v4l_end" +ATTR{index}!="?*", GOTO="persistent_v4l_end" + +IMPORT{builtin}="path_id" +ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" +ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" + +LABEL="persistent_v4l_end" diff --git a/src/extras/v4l_id/v4l_id.c b/src/extras/v4l_id/v4l_id.c new file mode 100644 index 0000000000..21cb3285ad --- /dev/null +++ b/src/extras/v4l_id/v4l_id.c @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2009 Kay Sievers + * Copyright (c) 2009 Filippo Argiolas + * + * 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; either version 2 of the + * License, or (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + {} + }; + int fd; + char *device; + struct v4l2_capability v2cap; + + while (1) { + int option; + + option = getopt_long(argc, argv, "h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + printf("Usage: v4l_id [--help] \n\n"); + return 0; + default: + return 1; + } + } + device = argv[optind]; + + if (device == NULL) + return 2; + fd = open (device, O_RDONLY); + if (fd < 0) + return 3; + + if (ioctl (fd, VIDIOC_QUERYCAP, &v2cap) == 0) { + printf("ID_V4L_VERSION=2\n"); + printf("ID_V4L_PRODUCT=%s\n", v2cap.card); + printf("ID_V4L_CAPABILITIES=:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0) + printf("capture:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) > 0) + printf("video_output:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_OVERLAY) > 0) + printf("video_overlay:"); + if ((v2cap.capabilities & V4L2_CAP_AUDIO) > 0) + printf("audio:"); + if ((v2cap.capabilities & V4L2_CAP_TUNER) > 0) + printf("tuner:"); + if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0) + printf("radio:"); + printf("\n"); + } + + close (fd); + return 0; +} diff --git a/src/libudev-device-private.c b/src/libudev-device-private.c new file mode 100644 index 0000000000..487d39bb5b --- /dev/null +++ b/src/libudev-device-private.c @@ -0,0 +1,185 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2010 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static void udev_device_tag(struct udev_device *dev, const char *tag, bool add) +{ + const char *id; + struct udev *udev = udev_device_get_udev(dev); + char filename[UTIL_PATH_SIZE]; + + id = udev_device_get_id_filename(dev); + if (id == NULL) + return; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags/", tag, "/", id, NULL); + + if (add) { + int fd; + + util_create_path(udev, filename); + fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); + if (fd >= 0) + close(fd); + } else { + unlink(filename); + } +} + +int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add) +{ + struct udev_list_entry *list_entry; + bool found; + + if (add && dev_old != NULL) { + /* delete possible left-over tags */ + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev_old)) { + const char *tag_old = udev_list_entry_get_name(list_entry); + struct udev_list_entry *list_entry_current; + + found = false; + udev_list_entry_foreach(list_entry_current, udev_device_get_tags_list_entry(dev)) { + const char *tag = udev_list_entry_get_name(list_entry_current); + + if (strcmp(tag, tag_old) == 0) { + found = true; + break; + } + } + if (!found) + udev_device_tag(dev_old, tag_old, false); + } + } + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev)) + udev_device_tag(dev, udev_list_entry_get_name(list_entry), add); + + return 0; +} + +static bool device_has_info(struct udev_device *udev_device) +{ + struct udev_list_entry *list_entry; + + if (udev_device_get_devlinks_list_entry(udev_device) != NULL) + return true; + if (udev_device_get_devlink_priority(udev_device) != 0) + return true; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) + if (udev_list_entry_get_num(list_entry)) + return true; + if (udev_device_get_tags_list_entry(udev_device) != NULL) + return true; + if (udev_device_get_watch_handle(udev_device) >= 0) + return true; + return false; +} + +int udev_device_update_db(struct udev_device *udev_device) +{ + bool has_info; + const char *id; + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + char filename_tmp[UTIL_PATH_SIZE]; + FILE *f; + + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + + has_info = device_has_info(udev_device); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); + + /* do not store anything for otherwise empty devices */ + if (!has_info && + major(udev_device_get_devnum(udev_device)) == 0 && + udev_device_get_ifindex(udev_device) == 0) { + unlink(filename); + return 0; + } + + /* write a database file */ + util_strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL); + util_create_path(udev, filename_tmp); + f = fopen(filename_tmp, "we"); + if (f == NULL) { + err(udev, "unable to create temporary db file '%s': %m\n", filename_tmp); + return -1; + } + + /* + * set 'sticky' bit to indicate that we should not clean the + * database when we transition from initramfs to the real root + */ + if (udev_device_get_db_persist(udev_device)) + fchmod(fileno(f), 01644); + + if (has_info) { + struct udev_list_entry *list_entry; + + if (major(udev_device_get_devnum(udev_device)) > 0) { + size_t devlen = strlen(udev_get_dev_path(udev))+1; + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) + fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + if (udev_device_get_devlink_priority(udev_device) != 0) + fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); + if (udev_device_get_watch_handle(udev_device) >= 0) + fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); + } + + if (udev_device_get_usec_initialized(udev_device) > 0) + fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device)); + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + if (!udev_list_entry_get_num(list_entry)) + continue; + fprintf(f, "E:%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + fprintf(f, "G:%s\n", udev_list_entry_get_name(list_entry)); + } + + fclose(f); + rename(filename_tmp, filename); + info(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty", + filename, udev_device_get_devpath(udev_device)); + return 0; +} + +int udev_device_delete_db(struct udev_device *udev_device) +{ + const char *id; + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); + unlink(filename); + return 0; +} diff --git a/src/libudev-device.c b/src/libudev-device.c new file mode 100644 index 0000000000..e5950bb4b1 --- /dev/null +++ b/src/libudev-device.c @@ -0,0 +1,1737 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2010 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/** + * SECTION:libudev-device + * @short_description: kernel sys devices + * + * Representation of kernel sys devices. Devices are uniquely identified + * by their syspath, every device has exactly one path in the kernel sys + * filesystem. Devices usually belong to a kernel subsystem, and and have + * a unique name inside that subsystem. + */ + +/** + * udev_device: + * + * Opaque object representing one kernel sys device. + */ +struct udev_device { + struct udev *udev; + struct udev_device *parent_device; + char *syspath; + const char *devpath; + char *sysname; + const char *sysnum; + char *devnode; + mode_t devnode_mode; + char *subsystem; + char *devtype; + char *driver; + char *action; + char *devpath_old; + char *id_filename; + char **envp; + char *monitor_buf; + size_t monitor_buf_len; + struct udev_list devlinks_list; + struct udev_list properties_list; + struct udev_list sysattr_value_list; + struct udev_list sysattr_list; + struct udev_list tags_list; + unsigned long long int seqnum; + unsigned long long int usec_initialized; + int devlink_priority; + int refcount; + dev_t devnum; + int ifindex; + int watch_handle; + int maj, min; + bool parent_set; + bool subsystem_set; + bool devtype_set; + bool devlinks_uptodate; + bool envp_uptodate; + bool tags_uptodate; + bool driver_set; + bool info_loaded; + bool db_loaded; + bool uevent_loaded; + bool is_initialized; + bool sysattr_list_read; + bool db_persist; +}; + +/** + * udev_device_get_seqnum: + * @udev_device: udev device + * + * This is only valid if the device was received through a monitor. Devices read from + * sys do not have a sequence number. + * + * Returns: the kernel event sequence number, or 0 if there is no sequence number available. + **/ +UDEV_EXPORT unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return 0; + return udev_device->seqnum; +} + +static int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) +{ + char num[32]; + + udev_device->seqnum = seqnum; + snprintf(num, sizeof(num), "%llu", seqnum); + udev_device_add_property(udev_device, "SEQNUM", num); + return 0; +} + +int udev_device_get_ifindex(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->ifindex; +} + +static int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) +{ + char num[32]; + + udev_device->ifindex = ifindex; + snprintf(num, sizeof(num), "%u", ifindex); + udev_device_add_property(udev_device, "IFINDEX", num); + return 0; +} + +/** + * udev_device_get_devnum: + * @udev_device: udev device + * + * Returns: the device major/minor number. + **/ +UDEV_EXPORT dev_t udev_device_get_devnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return makedev(0, 0); + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnum; +} + +static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) +{ + char num[32]; + + udev_device->devnum = devnum; + + snprintf(num, sizeof(num), "%u", major(devnum)); + udev_device_add_property(udev_device, "MAJOR", num); + snprintf(num, sizeof(num), "%u", minor(devnum)); + udev_device_add_property(udev_device, "MINOR", num); + return 0; +} + +const char *udev_device_get_devpath_old(struct udev_device *udev_device) +{ + return udev_device->devpath_old; +} + +static int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) +{ + const char *pos; + + free(udev_device->devpath_old); + udev_device->devpath_old = strdup(devpath_old); + if (udev_device->devpath_old == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); + + pos = strrchr(udev_device->devpath_old, '/'); + if (pos == NULL) + return -EINVAL; + return 0; +} + +/** + * udev_device_get_driver: + * @udev_device: udev device + * + * Returns: the driver string, or #NULL if there is no driver attached. + **/ +UDEV_EXPORT const char *udev_device_get_driver(struct udev_device *udev_device) +{ + char driver[UTIL_NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (!udev_device->driver_set) { + udev_device->driver_set = true; + if (util_get_sys_core_link_value(udev_device->udev, "driver", udev_device->syspath, driver, sizeof(driver)) > 0) + udev_device->driver = strdup(driver); + } + return udev_device->driver; +} + +static int udev_device_set_driver(struct udev_device *udev_device, const char *driver) +{ + free(udev_device->driver); + udev_device->driver = strdup(driver); + if (udev_device->driver == NULL) + return -ENOMEM; + udev_device->driver_set = true; + udev_device_add_property(udev_device, "DRIVER", udev_device->driver); + return 0; +} + +/** + * udev_device_get_devtype: + * @udev_device: udev device + * + * Retrieve the devtype string of the udev device. + * + * Returns: the devtype name of the udev device, or #NULL if it can not be determined + **/ +UDEV_EXPORT const char *udev_device_get_devtype(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->devtype_set) { + udev_device->devtype_set = true; + udev_device_read_uevent_file(udev_device); + } + return udev_device->devtype; +} + +static int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) +{ + free(udev_device->devtype); + udev_device->devtype = strdup(devtype); + if (udev_device->devtype == NULL) + return -ENOMEM; + udev_device->devtype_set = true; + udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); + return 0; +} + +static int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) +{ + free(udev_device->subsystem); + udev_device->subsystem = strdup(subsystem); + if (udev_device->subsystem == NULL) + return -ENOMEM; + udev_device->subsystem_set = true; + udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); + return 0; +} + +/** + * udev_device_get_subsystem: + * @udev_device: udev device + * + * Retrieve the subsystem string of the udev device. The string does not + * contain any "/". + * + * Returns: the subsystem name of the udev device, or #NULL if it can not be determined + **/ +UDEV_EXPORT const char *udev_device_get_subsystem(struct udev_device *udev_device) +{ + char subsystem[UTIL_NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (!udev_device->subsystem_set) { + udev_device->subsystem_set = true; + /* read "subsystem" link */ + if (util_get_sys_core_link_value(udev_device->udev, "subsystem", udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { + udev_device_set_subsystem(udev_device, subsystem); + return udev_device->subsystem; + } + /* implicit names */ + if (strncmp(udev_device->devpath, "/module/", 8) == 0) { + udev_device_set_subsystem(udev_device, "module"); + return udev_device->subsystem; + } + if (strstr(udev_device->devpath, "/drivers/") != NULL) { + udev_device_set_subsystem(udev_device, "drivers"); + return udev_device->subsystem; + } + if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || + strncmp(udev_device->devpath, "/class/", 7) == 0 || + strncmp(udev_device->devpath, "/bus/", 5) == 0) { + udev_device_set_subsystem(udev_device, "subsystem"); + return udev_device->subsystem; + } + } + return udev_device->subsystem; +} + +mode_t udev_device_get_devnode_mode(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnode_mode; +} + +static int udev_device_set_devnode_mode(struct udev_device *udev_device, mode_t mode) +{ + char num[32]; + + udev_device->devnode_mode = mode; + snprintf(num, sizeof(num), "%#o", mode); + udev_device_add_property(udev_device, "DEVMODE", num); + return 0; +} + +struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) +{ + udev_device->envp_uptodate = false; + if (value == NULL) { + struct udev_list_entry *list_entry; + + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + if (list_entry != NULL) + udev_list_entry_delete(list_entry); + return NULL; + } + return udev_list_entry_add(&udev_device->properties_list, key, value); +} + +static struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) +{ + char name[UTIL_LINE_SIZE]; + char *val; + + util_strscpy(name, sizeof(name), property); + val = strchr(name, '='); + if (val == NULL) + return NULL; + val[0] = '\0'; + val = &val[1]; + if (val[0] == '\0') + val = NULL; + return udev_device_add_property(udev_device, name, val); +} + +/* + * parse property string, and if needed, update internal values accordingly + * + * udev_device_add_property_from_string_parse_finish() needs to be + * called after adding properties, and its return value checked + * + * udev_device_set_info_loaded() needs to be set, to avoid trying + * to use a device without a DEVPATH set + */ +void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property) +{ + if (strncmp(property, "DEVPATH=", 8) == 0) { + char path[UTIL_PATH_SIZE]; + + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev_device->udev), &property[8], NULL); + udev_device_set_syspath(udev_device, path); + } else if (strncmp(property, "SUBSYSTEM=", 10) == 0) { + udev_device_set_subsystem(udev_device, &property[10]); + } else if (strncmp(property, "DEVTYPE=", 8) == 0) { + udev_device_set_devtype(udev_device, &property[8]); + } else if (strncmp(property, "DEVNAME=", 8) == 0) { + udev_device_set_devnode(udev_device, &property[8]); + } else if (strncmp(property, "DEVLINKS=", 9) == 0) { + char devlinks[UTIL_PATH_SIZE]; + char *slink; + char *next; + + util_strscpy(devlinks, sizeof(devlinks), &property[9]); + slink = devlinks; + next = strchr(slink, ' '); + while (next != NULL) { + next[0] = '\0'; + udev_device_add_devlink(udev_device, slink, 0); + slink = &next[1]; + next = strchr(slink, ' '); + } + if (slink[0] != '\0') + udev_device_add_devlink(udev_device, slink, 0); + } else if (strncmp(property, "TAGS=", 5) == 0) { + char tags[UTIL_PATH_SIZE]; + char *next; + + util_strscpy(tags, sizeof(tags), &property[5]); + next = strchr(tags, ':'); + if (next != NULL) { + next++; + while (next[0] != '\0') { + char *tag; + + tag = next; + next = strchr(tag, ':'); + if (next == NULL) + break; + next[0] = '\0'; + next++; + udev_device_add_tag(udev_device, tag); + } + } + } else if (strncmp(property, "USEC_INITIALIZED=", 19) == 0) { + udev_device_set_usec_initialized(udev_device, strtoull(&property[19], NULL, 10)); + } else if (strncmp(property, "DRIVER=", 7) == 0) { + udev_device_set_driver(udev_device, &property[7]); + } else if (strncmp(property, "ACTION=", 7) == 0) { + udev_device_set_action(udev_device, &property[7]); + } else if (strncmp(property, "MAJOR=", 6) == 0) { + udev_device->maj = strtoull(&property[6], NULL, 10); + } else if (strncmp(property, "MINOR=", 6) == 0) { + udev_device->min = strtoull(&property[6], NULL, 10); + } else if (strncmp(property, "DEVPATH_OLD=", 12) == 0) { + udev_device_set_devpath_old(udev_device, &property[12]); + } else if (strncmp(property, "SEQNUM=", 7) == 0) { + udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10)); + } else if (strncmp(property, "IFINDEX=", 8) == 0) { + udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10)); + } else if (strncmp(property, "DEVMODE=", 8) == 0) { + udev_device_set_devnode_mode(udev_device, strtoul(&property[8], NULL, 8)); + } else { + udev_device_add_property_from_string(udev_device, property); + } +} + +int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device) +{ + if (udev_device->maj > 0) + udev_device_set_devnum(udev_device, makedev(udev_device->maj, udev_device->min)); + udev_device->maj = 0; + udev_device->min = 0; + + if (udev_device->devpath == NULL || udev_device->subsystem == NULL) + return -EINVAL; + return 0; +} + +/** + * udev_device_get_property_value: + * @udev_device: udev device + * @key: property name + * + * Returns: the value of a device property, or #NULL if there is no such property. + **/ +UDEV_EXPORT const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) +{ + struct udev_list_entry *list_entry; + + if (udev_device == NULL) + return NULL; + if (key == NULL) + return NULL; + + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + return udev_list_entry_get_value(list_entry); +} + +int udev_device_read_db(struct udev_device *udev_device, const char *dbfile) +{ + char filename[UTIL_PATH_SIZE]; + char line[UTIL_LINE_SIZE]; + FILE *f; + + /* providing a database file will always force-load it */ + if (dbfile == NULL) { + const char *id; + + if (udev_device->db_loaded) + return 0; + udev_device->db_loaded = true; + + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_device->udev), "/data/", id, NULL); + dbfile = filename; + } + + f = fopen(dbfile, "re"); + if (f == NULL) { + info(udev_device->udev, "no db file to read %s: %m\n", dbfile); + return -1; + } + udev_device->is_initialized = true; + + while (fgets(line, sizeof(line), f)) { + ssize_t len; + const char *val; + struct udev_list_entry *entry; + + len = strlen(line); + if (len < 4) + break; + line[len-1] = '\0'; + val = &line[2]; + switch(line[0]) { + case 'S': + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); + udev_device_add_devlink(udev_device, filename, 0); + break; + case 'L': + udev_device_set_devlink_priority(udev_device, atoi(val)); + break; + case 'E': + entry = udev_device_add_property_from_string(udev_device, val); + udev_list_entry_set_num(entry, true); + break; + case 'G': + udev_device_add_tag(udev_device, val); + break; + case 'W': + udev_device_set_watch_handle(udev_device, atoi(val)); + break; + case 'I': + udev_device_set_usec_initialized(udev_device, strtoull(val, NULL, 10)); + break; + } + } + fclose(f); + + info(udev_device->udev, "device %p filled with db file data\n", udev_device); + return 0; +} + +int udev_device_read_uevent_file(struct udev_device *udev_device) +{ + char filename[UTIL_PATH_SIZE]; + FILE *f; + char line[UTIL_LINE_SIZE]; + int maj = 0; + int min = 0; + + if (udev_device->uevent_loaded) + return 0; + + util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL); + f = fopen(filename, "re"); + if (f == NULL) + return -1; + udev_device->uevent_loaded = true; + + while (fgets(line, sizeof(line), f)) { + char *pos; + + pos = strchr(line, '\n'); + if (pos == NULL) + continue; + pos[0] = '\0'; + + if (strncmp(line, "DEVTYPE=", 8) == 0) + udev_device_set_devtype(udev_device, &line[8]); + else if (strncmp(line, "MAJOR=", 6) == 0) + maj = strtoull(&line[6], NULL, 10); + else if (strncmp(line, "MINOR=", 6) == 0) + min = strtoull(&line[6], NULL, 10); + else if (strncmp(line, "IFINDEX=", 8) == 0) + udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); + else if (strncmp(line, "DEVNAME=", 8) == 0) + udev_device_set_devnode(udev_device, &line[8]); + else if (strncmp(line, "DEVMODE=", 8) == 0) + udev_device->devnode_mode = strtoul(&line[8], NULL, 8); + + udev_device_add_property_from_string(udev_device, line); + } + + udev_device->devnum = makedev(maj, min); + fclose(f); + return 0; +} + +void udev_device_set_info_loaded(struct udev_device *device) +{ + device->info_loaded = true; +} + +struct udev_device *udev_device_new(struct udev *udev) +{ + struct udev_device *udev_device; + struct udev_list_entry *list_entry; + + if (udev == NULL) + return NULL; + + udev_device = calloc(1, sizeof(struct udev_device)); + if (udev_device == NULL) + return NULL; + udev_device->refcount = 1; + udev_device->udev = udev; + udev_list_init(udev, &udev_device->devlinks_list, true); + udev_list_init(udev, &udev_device->properties_list, true); + udev_list_init(udev, &udev_device->sysattr_value_list, true); + udev_list_init(udev, &udev_device->sysattr_list, false); + udev_list_init(udev, &udev_device->tags_list, true); + udev_device->watch_handle = -1; + /* copy global properties */ + udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) + udev_device_add_property(udev_device, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + dbg(udev_device->udev, "udev_device: %p created\n", udev_device); + return udev_device; +} + +/** + * udev_device_new_from_syspath: + * @udev: udev library context + * @syspath: sys device path including sys directory + * + * Create new udev device, and fill in information from the sys + * device and the udev database entry. The syspath is the absolute + * path to the device, including the sys mount point. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ +UDEV_EXPORT struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) +{ + size_t len; + const char *subdir; + char path[UTIL_PATH_SIZE]; + char *pos; + struct stat statbuf; + struct udev_device *udev_device; + + if (udev == NULL) + return NULL; + if (syspath == NULL) + return NULL; + + /* path starts in sys */ + len = strlen(udev_get_sys_path(udev)); + if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) { + info(udev, "not in sys :%s\n", syspath); + return NULL; + } + + /* path is not a root directory */ + subdir = &syspath[len+1]; + pos = strrchr(subdir, '/'); + if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) { + dbg(udev, "not a subdir :%s\n", syspath); + return NULL; + } + + /* resolve possible symlink to real path */ + util_strscpy(path, sizeof(path), syspath); + util_resolve_sys_link(udev, path, sizeof(path)); + + if (strncmp(&path[len], "/devices/", 9) == 0) { + char file[UTIL_PATH_SIZE]; + + /* all "devices" require a "uevent" file */ + util_strscpyl(file, sizeof(file), path, "/uevent", NULL); + if (stat(file, &statbuf) != 0) { + dbg(udev, "not a device: %s\n", syspath); + return NULL; + } + } else { + /* everything else just needs to be a directory */ + if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) { + dbg(udev, "directory not found: %s\n", syspath); + return NULL; + } + } + + udev_device = udev_device_new(udev); + if (udev_device == NULL) + return NULL; + + udev_device_set_syspath(udev_device, path); + info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); + + return udev_device; +} + +/** + * udev_device_new_from_devnum: + * @udev: udev library context + * @type: char or block device + * @devnum: device major/minor number + * + * Create new udev device, and fill in information from the sys + * device and the udev database entry. The device is looked-up + * by its major/minor number and type. Character and block device + * numbers are not unique across the two types. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ +UDEV_EXPORT struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) +{ + char path[UTIL_PATH_SIZE]; + const char *type_str; + + if (type == 'b') + type_str = "block"; + else if (type == 'c') + type_str = "char"; + else + return NULL; + + /* use /sys/dev/{block,char}/: link */ + snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", + udev_get_sys_path(udev), type_str, major(devnum), minor(devnum)); + return udev_device_new_from_syspath(udev, path); +} + +struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id) +{ + char type; + int maj, min; + char subsys[UTIL_PATH_SIZE]; + char *sysname; + + switch(id[0]) { + case 'b': + case 'c': + if (sscanf(id, "%c%i:%i", &type, &maj, &min) != 3) + return NULL; + return udev_device_new_from_devnum(udev, type, makedev(maj, min)); + case 'n': { + int sk; + struct ifreq ifr; + struct udev_device *dev; + int ifindex; + + ifindex = strtoul(&id[1], NULL, 10); + if (ifindex <= 0) + return NULL; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) + return NULL; + memset(&ifr, 0x00, sizeof(struct ifreq)); + ifr.ifr_ifindex = ifindex; + if (ioctl(sk, SIOCGIFNAME, &ifr) != 0) { + close(sk); + return NULL; + } + close(sk); + + dev = udev_device_new_from_subsystem_sysname(udev, "net", ifr.ifr_name); + if (dev == NULL) + return NULL; + if (udev_device_get_ifindex(dev) == ifindex) + return dev; + udev_device_unref(dev); + return NULL; + } + case '+': + util_strscpy(subsys, sizeof(subsys), &id[1]); + sysname = strchr(subsys, ':'); + if (sysname == NULL) + return NULL; + sysname[0] = '\0'; + sysname = &sysname[1]; + return udev_device_new_from_subsystem_sysname(udev, subsys, sysname); + default: + return NULL; + } +} + +/** + * udev_device_new_from_subsystem_sysname: + * @udev: udev library context + * @subsystem: the subsystem of the device + * @sysname: the name of the device + * + * Create new udev device, and fill in information from the sys device + * and the udev database entry. The device is looked up by the subsystem + * and name string of the device, like "mem" / "zero", or "block" / "sda". + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ +UDEV_EXPORT struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) +{ + char path_full[UTIL_PATH_SIZE]; + char *path; + size_t l; + struct stat statbuf; + + path = path_full; + l = util_strpcpyl(&path, sizeof(path_full), udev_get_sys_path(udev), NULL); + + if (strcmp(subsystem, "subsystem") == 0) { + util_strscpyl(path, l, "/subsystem/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/bus/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/class/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "module") == 0) { + util_strscpyl(path, l, "/module/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "drivers") == 0) { + char subsys[UTIL_NAME_SIZE]; + char *driver; + + util_strscpy(subsys, sizeof(subsys), sysname); + driver = strchr(subsys, ':'); + if (driver != NULL) { + driver[0] = '\0'; + driver = &driver[1]; + + util_strscpyl(path, l, "/subsystem/", subsys, "/drivers/", driver, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/bus/", subsys, "/drivers/", driver, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + } + goto out; + } + + util_strscpyl(path, l, "/subsystem/", subsystem, "/devices/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/bus/", subsystem, "/devices/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/class/", subsystem, "/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; +out: + return NULL; +found: + return udev_device_new_from_syspath(udev, path_full); +} + +/** + * udev_device_new_from_environment + * @udev: udev library context + * + * Create new udev device, and fill in information from the + * current process environment. This only works reliable if + * the process is called from a udev rule. It is usually used + * for tools executed from IMPORT= rules. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, if it does not exist + **/ +UDEV_EXPORT struct udev_device *udev_device_new_from_environment(struct udev *udev) +{ + int i; + struct udev_device *udev_device; + + udev_device = udev_device_new(udev); + if (udev_device == NULL) + return NULL; + udev_device_set_info_loaded(udev_device); + + for (i = 0; environ[i] != NULL; i++) + udev_device_add_property_from_string_parse(udev_device, environ[i]); + + if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { + info(udev, "missing values, invalid device\n"); + udev_device_unref(udev_device); + udev_device = NULL; + } + + return udev_device; +} + +static struct udev_device *device_new_from_parent(struct udev_device *udev_device) +{ + struct udev_device *udev_device_parent = NULL; + char path[UTIL_PATH_SIZE]; + const char *subdir; + + util_strscpy(path, sizeof(path), udev_device->syspath); + subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; + for (;;) { + char *pos; + + pos = strrchr(subdir, '/'); + if (pos == NULL || pos < &subdir[2]) + break; + pos[0] = '\0'; + udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); + if (udev_device_parent != NULL) + return udev_device_parent; + } + return NULL; +} + +/** + * udev_device_get_parent: + * @udev_device: the device to start searching from + * + * Find the next parent device, and fill in information from the sys + * device and the udev database entry. + * + * The returned the device is not referenced. It is attached to the + * child device, and will be cleaned up when the child device + * is cleaned up. + * + * It is not necessarily just the upper level directory, empty or not + * recognized sys directories are ignored. + * + * It can be called as many times as needed, without caring about + * references. + * + * Returns: a new udev device, or #NULL, if it no parent exist. + **/ +UDEV_EXPORT struct udev_device *udev_device_get_parent(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->parent_set) { + udev_device->parent_set = true; + udev_device->parent_device = device_new_from_parent(udev_device); + } + if (udev_device->parent_device != NULL) + dbg(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); + return udev_device->parent_device; +} + +/** + * udev_device_get_parent_with_subsystem_devtype: + * @udev_device: udev device to start searching from + * @subsystem: the subsystem of the device + * @devtype: the type (DEVTYPE) of the device + * + * Find the next parent device, with a matching subsystem and devtype + * value, and fill in information from the sys device and the udev + * database entry. + * + * If devtype is #NULL, only subsystem is checked, and any devtype will + * match. + * + * The returned the device is not referenced. It is attached to the + * child device, and will be cleaned up when the child device + * is cleaned up. + * + * It can be called as many times as needed, without caring about + * references. + * + * Returns: a new udev device, or #NULL if no matching parent exists. + **/ +UDEV_EXPORT struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) +{ + struct udev_device *parent; + + if (subsystem == NULL) + return NULL; + + parent = udev_device_get_parent(udev_device); + while (parent != NULL) { + const char *parent_subsystem; + const char *parent_devtype; + + parent_subsystem = udev_device_get_subsystem(parent); + if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) { + if (devtype == NULL) + break; + parent_devtype = udev_device_get_devtype(parent); + if (parent_devtype != NULL && strcmp(parent_devtype, devtype) == 0) + break; + } + parent = udev_device_get_parent(parent); + } + return parent; +} + +/** + * udev_device_get_udev: + * @udev_device: udev device + * + * Retrieve the udev library context the device was created with. + * + * Returns: the udev library context + **/ +UDEV_EXPORT struct udev *udev_device_get_udev(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->udev; +} + +/** + * udev_device_ref: + * @udev_device: udev device + * + * Take a reference of a udev device. + * + * Returns: the passed udev device + **/ +UDEV_EXPORT struct udev_device *udev_device_ref(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + udev_device->refcount++; + return udev_device; +} + +/** + * udev_device_unref: + * @udev_device: udev device + * + * Drop a reference of a udev device. If the refcount reaches zero, + * the resources of the device will be released. + * + **/ +UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return; + udev_device->refcount--; + if (udev_device->refcount > 0) + return; + if (udev_device->parent_device != NULL) + udev_device_unref(udev_device->parent_device); + free(udev_device->syspath); + free(udev_device->sysname); + free(udev_device->devnode); + free(udev_device->subsystem); + free(udev_device->devtype); + udev_list_cleanup(&udev_device->devlinks_list); + udev_list_cleanup(&udev_device->properties_list); + udev_list_cleanup(&udev_device->sysattr_value_list); + udev_list_cleanup(&udev_device->sysattr_list); + udev_list_cleanup(&udev_device->tags_list); + free(udev_device->action); + free(udev_device->driver); + free(udev_device->devpath_old); + free(udev_device->id_filename); + free(udev_device->envp); + free(udev_device->monitor_buf); + dbg(udev_device->udev, "udev_device: %p released\n", udev_device); + free(udev_device); +} + +/** + * udev_device_get_devpath: + * @udev_device: udev device + * + * Retrieve the kernel devpath value of the udev device. The path + * does not contain the sys mount point, and starts with a '/'. + * + * Returns: the devpath of the udev device + **/ +UDEV_EXPORT const char *udev_device_get_devpath(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->devpath; +} + +/** + * udev_device_get_syspath: + * @udev_device: udev device + * + * Retrieve the sys path of the udev device. The path is an + * absolute path and starts with the sys mount point. + * + * Returns: the sys path of the udev device + **/ +UDEV_EXPORT const char *udev_device_get_syspath(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->syspath; +} + +/** + * udev_device_get_sysname: + * @udev_device: udev device + * + * Returns: the sys name of the device device + **/ +UDEV_EXPORT const char *udev_device_get_sysname(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->sysname; +} + +/** + * udev_device_get_sysnum: + * @udev_device: udev device + * + * Returns: the trailing number of of the device name + **/ +UDEV_EXPORT const char *udev_device_get_sysnum(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->sysnum; +} + +/** + * udev_device_get_devnode: + * @udev_device: udev device + * + * Retrieve the device node file name belonging to the udev device. + * The path is an absolute path, and starts with the device directory. + * + * Returns: the device node file name of the udev device, or #NULL if no device node exists + **/ +UDEV_EXPORT const char *udev_device_get_devnode(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (udev_device->devnode != NULL) + return udev_device->devnode; + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnode; +} + +/** + * udev_device_get_devlinks_list_entry: + * @udev_device: udev device + * + * Retrieve the list of device links pointing to the device file of + * the udev device. The next list entry can be retrieved with + * udev_list_entry_next(), which returns #NULL if no more entries exist. + * The devlink path can be retrieved from the list entry by + * udev_list_entry_get_name(). The path is an absolute path, and starts with + * the device directory. + * + * Returns: the first entry of the device node link list + **/ +UDEV_EXPORT struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_list_get_entry(&udev_device->devlinks_list); +} + +void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) +{ + udev_device->devlinks_uptodate = false; + udev_list_cleanup(&udev_device->devlinks_list); +} + +/** + * udev_device_get_properties_list_entry: + * @udev_device: udev device + * + * Retrieve the list of key/value device properties of the udev + * device. The next list entry can be retrieved with udev_list_entry_next(), + * which returns #NULL if no more entries exist. The property name + * can be retrieved from the list entry by udev_list_get_name(), + * the property value by udev_list_get_value(). + * + * Returns: the first entry of the property list + **/ +UDEV_EXPORT struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) { + udev_device_read_uevent_file(udev_device); + udev_device_read_db(udev_device, NULL); + } + if (!udev_device->devlinks_uptodate) { + char symlinks[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + + udev_device->devlinks_uptodate = true; + list_entry = udev_device_get_devlinks_list_entry(udev_device); + if (list_entry != NULL) { + char *s; + size_t l; + + s = symlinks; + l = util_strpcpyl(&s, sizeof(symlinks), udev_list_entry_get_name(list_entry), NULL); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) + l = util_strpcpyl(&s, l, " ", udev_list_entry_get_name(list_entry), NULL); + udev_device_add_property(udev_device, "DEVLINKS", symlinks); + } + } + if (!udev_device->tags_uptodate) { + udev_device->tags_uptodate = true; + if (udev_device_get_tags_list_entry(udev_device) != NULL) { + char tags[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + char *s; + size_t l; + + s = tags; + l = util_strpcpyl(&s, sizeof(tags), ":", NULL); + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), ":", NULL); + udev_device_add_property(udev_device, "TAGS", tags); + } + } + return udev_list_get_entry(&udev_device->properties_list); +} + +/** + * udev_device_get_action: + * @udev_device: udev device + * + * This is only valid if the device was received through a monitor. Devices read from + * sys do not have an action string. Usual actions are: add, remove, change, online, + * offline. + * + * Returns: the kernel action value, or #NULL if there is no action value available. + **/ +UDEV_EXPORT const char *udev_device_get_action(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + return udev_device->action; +} + +/** + * udev_device_get_usec_since_initialized: + * @udev_device: udev device + * + * Return the number of microseconds passed since udev set up the + * device for the first time. + * + * This is only implemented for devices with need to store properties + * in the udev database. All other devices return 0 here. + * + * Returns: the number of microseconds since the device was first seen. + **/ +UDEV_EXPORT unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device) +{ + unsigned long long now; + + if (udev_device == NULL) + return 0; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + if (udev_device->usec_initialized == 0) + return 0; + now = now_usec(); + if (now == 0) + return 0; + return now - udev_device->usec_initialized; +} + +unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device) +{ + return udev_device->usec_initialized; +} + +void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized) +{ + char num[32]; + + udev_device->usec_initialized = usec_initialized; + snprintf(num, sizeof(num), "%llu", usec_initialized); + udev_device_add_property(udev_device, "USEC_INITIALIZED", num); +} + +/** + * udev_device_get_sysattr_value: + * @udev_device: udev device + * @sysattr: attribute name + * + * The retrieved value is cached in the device. Repeated calls will return the same + * value and not open the attribute again. + * + * Returns: the content of a sys attribute file, or #NULL if there is no sys attribute value. + **/ +UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) +{ + struct udev_list_entry *list_entry; + char path[UTIL_PATH_SIZE]; + char value[4096]; + struct stat statbuf; + int fd; + ssize_t size; + const char *val = NULL; + + if (udev_device == NULL) + return NULL; + if (sysattr == NULL) + return NULL; + + /* look for possibly already cached result */ + list_entry = udev_list_get_entry(&udev_device->sysattr_value_list); + list_entry = udev_list_entry_get_by_name(list_entry, sysattr); + if (list_entry != NULL) { + dbg(udev_device->udev, "got '%s' (%s) from cache\n", + sysattr, udev_list_entry_get_value(list_entry)); + return udev_list_entry_get_value(list_entry); + } + + util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); + if (lstat(path, &statbuf) != 0) { + dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); + udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, NULL); + goto out; + } + + if (S_ISLNK(statbuf.st_mode)) { + struct udev_device *dev; + + /* + * Some core links return only the last element of the target path, + * these are just values, the paths should not be exposed. + */ + if (strcmp(sysattr, "driver") == 0 || + strcmp(sysattr, "subsystem") == 0 || + strcmp(sysattr, "module") == 0) { + if (util_get_sys_core_link_value(udev_device->udev, sysattr, + udev_device->syspath, value, sizeof(value)) < 0) + return NULL; + dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, value); + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); + val = udev_list_entry_get_value(list_entry); + goto out; + } + + /* resolve link to a device and return its syspath */ + util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL); + dev = udev_device_new_from_syspath(udev_device->udev, path); + if (dev != NULL) { + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, + udev_device_get_syspath(dev)); + val = udev_list_entry_get_value(list_entry); + udev_device_unref(dev); + } + + goto out; + } + + /* skip directories */ + if (S_ISDIR(statbuf.st_mode)) + goto out; + + /* skip non-readable files */ + if ((statbuf.st_mode & S_IRUSR) == 0) + goto out; + + /* read attribute value */ + fd = open(path, O_RDONLY|O_CLOEXEC); + if (fd < 0) { + dbg(udev_device->udev, "attribute '%s' can not be opened\n", path); + goto out; + } + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + if (size == sizeof(value)) + goto out; + + /* got a valid value, store it in cache and return it */ + value[size] = '\0'; + util_remove_trailing_chars(value, '\n'); + dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); + val = udev_list_entry_get_value(list_entry); +out: + return val; +} + +static int udev_device_sysattr_list_read(struct udev_device *udev_device) +{ + struct dirent *dent; + DIR *dir; + int num = 0; + + if (udev_device == NULL) + return -1; + if (udev_device->sysattr_list_read) + return 0; + + dir = opendir(udev_device_get_syspath(udev_device)); + if (!dir) { + dbg(udev_device->udev, "sysfs dir '%s' can not be opened\n", + udev_device_get_syspath(udev_device)); + return -1; + } + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char path[UTIL_PATH_SIZE]; + struct stat statbuf; + + /* only handle symlinks and regular files */ + if (dent->d_type != DT_LNK && dent->d_type != DT_REG) + continue; + + util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", dent->d_name, NULL); + if (lstat(path, &statbuf) != 0) + continue; + if ((statbuf.st_mode & S_IRUSR) == 0) + continue; + + udev_list_entry_add(&udev_device->sysattr_list, dent->d_name, NULL); + num++; + } + + closedir(dir); + dbg(udev_device->udev, "found %d sysattrs for '%s'\n", num, udev_device_get_syspath(udev_device)); + udev_device->sysattr_list_read = true; + + return num; +} + +/** + * udev_device_get_sysattr_list_entry: + * @udev_device: udev device + * + * Retrieve the list of available sysattrs, with value being empty; + * This just return all available sysfs attributes for a particular + * device without reading their values. + * + * Returns: the first entry of the property list + **/ +UDEV_EXPORT struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device) +{ + if (!udev_device->sysattr_list_read) { + int ret; + ret = udev_device_sysattr_list_read(udev_device); + if (0 > ret) + return NULL; + } + + return udev_list_get_entry(&udev_device->sysattr_list); +} + +int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) +{ + const char *pos; + size_t len; + + free(udev_device->syspath); + udev_device->syspath = strdup(syspath); + if (udev_device->syspath == NULL) + return -ENOMEM; + udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; + udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath); + + pos = strrchr(udev_device->syspath, '/'); + if (pos == NULL) + return -EINVAL; + udev_device->sysname = strdup(&pos[1]); + if (udev_device->sysname == NULL) + return -ENOMEM; + + /* some devices have '!' in their name, change that to '/' */ + len = 0; + while (udev_device->sysname[len] != '\0') { + if (udev_device->sysname[len] == '!') + udev_device->sysname[len] = '/'; + len++; + } + + /* trailing number */ + while (len > 0 && isdigit(udev_device->sysname[--len])) + udev_device->sysnum = &udev_device->sysname[len]; + + /* sysname is completely numeric */ + if (len == 0) + udev_device->sysnum = NULL; + + return 0; +} + +int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) +{ + free(udev_device->devnode); + if (devnode[0] != '/') { + if (asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), devnode) < 0) + udev_device->devnode = NULL; + } else { + udev_device->devnode = strdup(devnode); + } + if (udev_device->devnode == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); + return 0; +} + +int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique) +{ + struct udev_list_entry *list_entry; + + udev_device->devlinks_uptodate = false; + list_entry = udev_list_entry_add(&udev_device->devlinks_list, devlink, NULL); + if (list_entry == NULL) + return -ENOMEM; + if (unique) + udev_list_entry_set_num(list_entry, true); + return 0; +} + +const char *udev_device_get_id_filename(struct udev_device *udev_device) +{ + if (udev_device->id_filename == NULL) { + if (udev_device_get_subsystem(udev_device) == NULL) + return NULL; + + if (major(udev_device_get_devnum(udev_device)) > 0) { + /* use dev_t -- b259:131072, c254:0 */ + if (asprintf(&udev_device->id_filename, "%c%u:%u", + strcmp(udev_device_get_subsystem(udev_device), "block") == 0 ? 'b' : 'c', + major(udev_device_get_devnum(udev_device)), + minor(udev_device_get_devnum(udev_device))) < 0) + udev_device->id_filename = NULL; + } else if (udev_device_get_ifindex(udev_device) > 0) { + /* use netdev ifindex -- n3 */ + if (asprintf(&udev_device->id_filename, "n%u", udev_device_get_ifindex(udev_device)) < 0) + udev_device->id_filename = NULL; + } else { + /* + * use $subsys:$syname -- pci:0000:00:1f.2 + * sysname() has '!' translated, get it from devpath + */ + const char *sysname; + sysname = strrchr(udev_device->devpath, '/'); + if (sysname == NULL) + return NULL; + sysname = &sysname[1]; + if (asprintf(&udev_device->id_filename, "+%s:%s", udev_device_get_subsystem(udev_device), sysname) < 0) + udev_device->id_filename = NULL; + } + } + return udev_device->id_filename; +} + +/** + * udev_device_get_is_initialized: + * @udev_device: udev device + * + * Check if udev has already handled the device and has set up + * device node permissions and context, or has renamed a network + * device. + * + * This is only implemented for devices with a device node + * or network interfaces. All other devices return 1 here. + * + * Returns: 1 if the device is set up. 0 otherwise. + **/ +UDEV_EXPORT int udev_device_get_is_initialized(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_device->is_initialized; +} + +void udev_device_set_is_initialized(struct udev_device *udev_device) +{ + udev_device->is_initialized = true; +} + +int udev_device_add_tag(struct udev_device *udev_device, const char *tag) +{ + if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) + return -EINVAL; + udev_device->tags_uptodate = false; + if (udev_list_entry_add(&udev_device->tags_list, tag, NULL) != NULL) + return 0; + return -ENOMEM; +} + +void udev_device_cleanup_tags_list(struct udev_device *udev_device) +{ + udev_device->tags_uptodate = false; + udev_list_cleanup(&udev_device->tags_list); +} + +/** + * udev_device_get_tags_list_entry: + * @udev_device: udev device + * + * Retrieve the list of tags attached to the udev device. The next + * list entry can be retrieved with udev_list_entry_next(), + * which returns #NULL if no more entries exist. The tag string + * can be retrieved from the list entry by udev_list_get_name(). + * + * Returns: the first entry of the tag list + **/ +UDEV_EXPORT struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) +{ + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_list_get_entry(&udev_device->tags_list); +} + +UDEV_EXPORT int udev_device_has_tag(struct udev_device *udev_device, const char *tag) +{ + struct udev_list_entry *list_entry; + + if (udev_device == NULL) + return false; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + list_entry = udev_device_get_tags_list_entry(udev_device); + if (udev_list_entry_get_by_name(list_entry, tag) != NULL) + return true; + return false; +} + +#define ENVP_SIZE 128 +#define MONITOR_BUF_SIZE 4096 +static int update_envp_monitor_buf(struct udev_device *udev_device) +{ + struct udev_list_entry *list_entry; + char *s; + size_t l; + unsigned int i; + + /* monitor buffer of property strings */ + free(udev_device->monitor_buf); + udev_device->monitor_buf_len = 0; + udev_device->monitor_buf = malloc(MONITOR_BUF_SIZE); + if (udev_device->monitor_buf == NULL) + return -ENOMEM; + + /* envp array, strings will point into monitor buffer */ + if (udev_device->envp == NULL) + udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); + if (udev_device->envp == NULL) + return -ENOMEM; + + i = 0; + s = udev_device->monitor_buf; + l = MONITOR_BUF_SIZE; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + const char *key; + + key = udev_list_entry_get_name(list_entry); + /* skip private variables */ + if (key[0] == '.') + continue; + + /* add string to envp array */ + udev_device->envp[i++] = s; + if (i+1 >= ENVP_SIZE) + return -EINVAL; + + /* add property string to monitor buffer */ + l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL); + if (l == 0) + return -EINVAL; + /* advance past the trailing '\0' that util_strpcpyl() guarantees */ + s++; + l--; + } + udev_device->envp[i] = NULL; + udev_device->monitor_buf_len = s - udev_device->monitor_buf; + udev_device->envp_uptodate = true; + dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", + i, udev_device->monitor_buf_len); + return 0; +} + +char **udev_device_get_properties_envp(struct udev_device *udev_device) +{ + if (!udev_device->envp_uptodate) + if (update_envp_monitor_buf(udev_device) != 0) + return NULL; + return udev_device->envp; +} + +ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf) +{ + if (!udev_device->envp_uptodate) + if (update_envp_monitor_buf(udev_device) != 0) + return -EINVAL; + *buf = udev_device->monitor_buf; + return udev_device->monitor_buf_len; +} + +int udev_device_set_action(struct udev_device *udev_device, const char *action) +{ + free(udev_device->action); + udev_device->action = strdup(action); + if (udev_device->action == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "ACTION", udev_device->action); + return 0; +} + +int udev_device_get_devlink_priority(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_device->devlink_priority; +} + +int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) +{ + udev_device->devlink_priority = prio; + return 0; +} + +int udev_device_get_watch_handle(struct udev_device *udev_device) +{ + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_device->watch_handle; +} + +int udev_device_set_watch_handle(struct udev_device *udev_device, int handle) +{ + udev_device->watch_handle = handle; + return 0; +} + +bool udev_device_get_db_persist(struct udev_device *udev_device) +{ + return udev_device->db_persist; +} + +void udev_device_set_db_persist(struct udev_device *udev_device) +{ + udev_device->db_persist = true; +} diff --git a/src/libudev-enumerate.c b/src/libudev-enumerate.c new file mode 100644 index 0000000000..f14d5c8f57 --- /dev/null +++ b/src/libudev-enumerate.c @@ -0,0 +1,947 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2010 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/** + * SECTION:libudev-enumerate + * @short_description: lookup and sort sys devices + * + * Lookup devices in the sys filesystem, filter devices by properties, + * and return a sorted list of devices. + */ + +struct syspath { + char *syspath; + size_t len; +}; + +/** + * udev_enumerate: + * + * Opaque object representing one device lookup/sort context. + */ +struct udev_enumerate { + struct udev *udev; + int refcount; + struct udev_list sysattr_match_list; + struct udev_list sysattr_nomatch_list; + struct udev_list subsystem_match_list; + struct udev_list subsystem_nomatch_list; + struct udev_list sysname_match_list; + struct udev_list properties_match_list; + struct udev_list tags_match_list; + struct udev_device *parent_match; + struct udev_list devices_list; + struct syspath *devices; + unsigned int devices_cur; + unsigned int devices_max; + bool devices_uptodate:1; + bool match_is_initialized; +}; + +/** + * udev_enumerate_new: + * @udev: udev library context + * + * Returns: an enumeration context + **/ +UDEV_EXPORT struct udev_enumerate *udev_enumerate_new(struct udev *udev) +{ + struct udev_enumerate *udev_enumerate; + + udev_enumerate = calloc(1, sizeof(struct udev_enumerate)); + if (udev_enumerate == NULL) + return NULL; + udev_enumerate->refcount = 1; + udev_enumerate->udev = udev; + udev_list_init(udev, &udev_enumerate->sysattr_match_list, false); + udev_list_init(udev, &udev_enumerate->sysattr_nomatch_list, false); + udev_list_init(udev, &udev_enumerate->subsystem_match_list, true); + udev_list_init(udev, &udev_enumerate->subsystem_nomatch_list, true); + udev_list_init(udev, &udev_enumerate->sysname_match_list, true); + udev_list_init(udev, &udev_enumerate->properties_match_list, false); + udev_list_init(udev, &udev_enumerate->tags_match_list, true); + udev_list_init(udev, &udev_enumerate->devices_list, false); + return udev_enumerate; +} + +/** + * udev_enumerate_ref: + * @udev_enumerate: context + * + * Take a reference of a enumeration context. + * + * Returns: the passed enumeration context + **/ +UDEV_EXPORT struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return NULL; + udev_enumerate->refcount++; + return udev_enumerate; +} + +/** + * udev_enumerate_unref: + * @udev_enumerate: context + * + * Drop a reference of an enumeration context. If the refcount reaches zero, + * all resources of the enumeration context will be released. + **/ +UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) +{ + unsigned int i; + + if (udev_enumerate == NULL) + return; + udev_enumerate->refcount--; + if (udev_enumerate->refcount > 0) + return; + udev_list_cleanup(&udev_enumerate->sysattr_match_list); + udev_list_cleanup(&udev_enumerate->sysattr_nomatch_list); + udev_list_cleanup(&udev_enumerate->subsystem_match_list); + udev_list_cleanup(&udev_enumerate->subsystem_nomatch_list); + udev_list_cleanup(&udev_enumerate->sysname_match_list); + udev_list_cleanup(&udev_enumerate->properties_match_list); + udev_list_cleanup(&udev_enumerate->tags_match_list); + udev_device_unref(udev_enumerate->parent_match); + udev_list_cleanup(&udev_enumerate->devices_list); + for (i = 0; i < udev_enumerate->devices_cur; i++) + free(udev_enumerate->devices[i].syspath); + free(udev_enumerate->devices); + free(udev_enumerate); +} + +/** + * udev_enumerate_get_udev: + * @udev_enumerate: context + * + * Returns: the udev library context. + */ +UDEV_EXPORT struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return NULL; + return udev_enumerate->udev; +} + +static int syspath_add(struct udev_enumerate *udev_enumerate, const char *syspath) +{ + char *path; + struct syspath *entry; + + /* double array size if needed */ + if (udev_enumerate->devices_cur >= udev_enumerate->devices_max) { + struct syspath *buf; + unsigned int add; + + add = udev_enumerate->devices_max; + if (add < 1024) + add = 1024; + buf = realloc(udev_enumerate->devices, (udev_enumerate->devices_max + add) * sizeof(struct syspath)); + if (buf == NULL) + return -ENOMEM; + udev_enumerate->devices = buf; + udev_enumerate->devices_max += add; + } + + path = strdup(syspath); + if (path == NULL) + return -ENOMEM; + entry = &udev_enumerate->devices[udev_enumerate->devices_cur]; + entry->syspath = path; + entry->len = strlen(path); + udev_enumerate->devices_cur++; + udev_enumerate->devices_uptodate = false; + return 0; +} + +static int syspath_cmp(const void *p1, const void *p2) +{ + const struct syspath *path1 = p1; + const struct syspath *path2 = p2; + size_t len; + int ret; + + len = MIN(path1->len, path2->len); + ret = memcmp(path1->syspath, path2->syspath, len); + if (ret == 0) { + if (path1->len < path2->len) + ret = -1; + else if (path1->len > path2->len) + ret = 1; + } + return ret; +} + +/* For devices that should be moved to the absolute end of the list */ +static bool devices_delay_end(struct udev *udev, const char *syspath) +{ + static const char *delay_device_list[] = { + "/block/md", + "/block/dm-", + NULL + }; + size_t len; + int i; + + len = strlen(udev_get_sys_path(udev)); + for (i = 0; delay_device_list[i] != NULL; i++) { + if (strstr(&syspath[len], delay_device_list[i]) != NULL) { + dbg(udev, "delaying: %s\n", syspath); + return true; + } + } + return false; +} + +/* For devices that should just be moved a little bit later, just + * before the point where some common path prefix changes. Returns the + * number of characters that make up that common prefix */ +static size_t devices_delay_later(struct udev *udev, const char *syspath) +{ + const char *c; + + /* For sound cards the control device must be enumerated last + * to make sure it's the final device node that gets ACLs + * applied. Applications rely on this fact and use ACL changes + * on the control node as an indicator that the ACL change of + * the entire sound card completed. The kernel makes this + * guarantee when creating those devices, and hence we should + * too when enumerating them. */ + + if ((c = strstr(syspath, "/sound/card"))) { + c += 11; + c += strcspn(c, "/"); + + if (strncmp(c, "/controlC", 9) == 0) + return c - syspath + 1; + } + + return 0; +} + +/** + * udev_enumerate_get_list_entry: + * @udev_enumerate: context + * + * Returns: the first entry of the sorted list of device paths. + */ +UDEV_EXPORT struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return NULL; + if (!udev_enumerate->devices_uptodate) { + unsigned int i; + unsigned int max; + struct syspath *prev = NULL, *move_later = NULL; + size_t move_later_prefix = 0; + + udev_list_cleanup(&udev_enumerate->devices_list); + qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); + + max = udev_enumerate->devices_cur; + for (i = 0; i < max; i++) { + struct syspath *entry = &udev_enumerate->devices[i]; + + /* skip duplicated entries */ + if (prev != NULL && + entry->len == prev->len && + memcmp(entry->syspath, prev->syspath, entry->len) == 0) + continue; + prev = entry; + + /* skip to be delayed devices, and add them to the end of the list */ + if (devices_delay_end(udev_enumerate->udev, entry->syspath)) { + syspath_add(udev_enumerate, entry->syspath); + /* need to update prev here for the case realloc() gives a different address */ + prev = &udev_enumerate->devices[i]; + continue; + } + + /* skip to be delayed devices, and move the to + * the point where the prefix changes. We can + * only move one item at a time. */ + if (!move_later) { + move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath); + + if (move_later_prefix > 0) { + move_later = entry; + continue; + } + } + + if (move_later && + strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) { + + udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); + move_later = NULL; + } + + udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); + } + + if (move_later) + udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); + + /* add and cleanup delayed devices from end of list */ + for (i = max; i < udev_enumerate->devices_cur; i++) { + struct syspath *entry = &udev_enumerate->devices[i]; + + udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); + free(entry->syspath); + } + udev_enumerate->devices_cur = max; + + udev_enumerate->devices_uptodate = true; + } + return udev_list_get_entry(&udev_enumerate->devices_list); +} + +/** + * udev_enumerate_add_match_subsystem: + * @udev_enumerate: context + * @subsystem: filter for a subsystem of the device to include in the list + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (subsystem == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->subsystem_match_list, subsystem, NULL) == NULL) + return -ENOMEM; + return 0; +} + +/** + * udev_enumerate_add_nomatch_subsystem: + * @udev_enumerate: context + * @subsystem: filter for a subsystem of the device to exclude from the list + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (subsystem == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->subsystem_nomatch_list, subsystem, NULL) == NULL) + return -ENOMEM; + return 0; +} + +/** + * udev_enumerate_add_match_sysattr: + * @udev_enumerate: context + * @sysattr: filter for a sys attribute at the device to include in the list + * @value: optional value of the sys attribute + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (sysattr == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->sysattr_match_list, sysattr, value) == NULL) + return -ENOMEM; + return 0; +} + +/** + * udev_enumerate_add_nomatch_sysattr: + * @udev_enumerate: context + * @sysattr: filter for a sys attribute at the device to exclude from the list + * @value: optional value of the sys attribute + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (sysattr == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->sysattr_nomatch_list, sysattr, value) == NULL) + return -ENOMEM; + return 0; +} + +static int match_sysattr_value(struct udev_device *dev, const char *sysattr, const char *match_val) +{ + const char *val = NULL; + bool match = false; + + val = udev_device_get_sysattr_value(dev, sysattr); + if (val == NULL) + goto exit; + if (match_val == NULL) { + match = true; + goto exit; + } + if (fnmatch(match_val, val, 0) == 0) { + match = true; + goto exit; + } +exit: + return match; +} + +/** + * udev_enumerate_add_match_property: + * @udev_enumerate: context + * @property: filter for a property of the device to include in the list + * @value: value of the property + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (property == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->properties_match_list, property, value) == NULL) + return -ENOMEM; + return 0; +} + +/** + * udev_enumerate_add_match_tag: + * @udev_enumerate: context + * @tag: filter for a tag of the device to include in the list + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (tag == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->tags_match_list, tag, NULL) == NULL) + return -ENOMEM; + return 0; +} + +/** + * udev_enumerate_add_match_parent: + * @udev_enumerate: context + * @parent: parent device where to start searching + * + * Return the devices on the subtree of one given device. The parent + * itself is included in the list. + * + * A reference for the device is held until the udev_enumerate context + * is cleaned up. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (parent == NULL) + return 0; + if (udev_enumerate->parent_match != NULL) + udev_device_unref(udev_enumerate->parent_match); + udev_enumerate->parent_match = udev_device_ref(parent); + return 0; +} + +/** + * udev_enumerate_add_match_is_initialized: + * @udev_enumerate: context + * + * Match only devices which udev has set up already. This makes + * sure, that the device node permissions and context are properly set + * and that network devices are fully renamed. + * + * Usually, devices which are found in the kernel but not already + * handled by udev, have still pending events. Services should subscribe + * to monitor events and wait for these devices to become ready, instead + * of using uninitialized devices. + * + * For now, this will not affect devices which do not have a device node + * and are not network interfaces. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return -EINVAL; + udev_enumerate->match_is_initialized = true; + return 0; +} + +/** + * udev_enumerate_add_match_sysname: + * @udev_enumerate: context + * @sysname: filter for the name of the device to include in the list + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) +{ + if (udev_enumerate == NULL) + return -EINVAL; + if (sysname == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->sysname_match_list, sysname, NULL) == NULL) + return -ENOMEM; + return 0; +} + +static bool match_sysattr(struct udev_enumerate *udev_enumerate, struct udev_device *dev) +{ + struct udev_list_entry *list_entry; + + /* skip list */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_nomatch_list)) { + if (match_sysattr_value(dev, udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return false; + } + /* include list */ + if (udev_list_get_entry(&udev_enumerate->sysattr_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_match_list)) { + /* anything that does not match, will make it FALSE */ + if (!match_sysattr_value(dev, udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return false; + } + return true; + } + return true; +} + +static bool match_property(struct udev_enumerate *udev_enumerate, struct udev_device *dev) +{ + struct udev_list_entry *list_entry; + bool match = false; + + /* no match always matches */ + if (udev_list_get_entry(&udev_enumerate->properties_match_list) == NULL) + return true; + + /* loop over matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) { + const char *match_key = udev_list_entry_get_name(list_entry); + const char *match_value = udev_list_entry_get_value(list_entry); + struct udev_list_entry *property_entry; + + /* loop over device properties */ + udev_list_entry_foreach(property_entry, udev_device_get_properties_list_entry(dev)) { + const char *dev_key = udev_list_entry_get_name(property_entry); + const char *dev_value = udev_list_entry_get_value(property_entry); + + if (fnmatch(match_key, dev_key, 0) != 0) + continue; + if (match_value == NULL && dev_value == NULL) { + match = true; + goto out; + } + if (match_value == NULL || dev_value == NULL) + continue; + if (fnmatch(match_value, dev_value, 0) == 0) { + match = true; + goto out; + } + } + } +out: + return match; +} + +static bool match_tag(struct udev_enumerate *udev_enumerate, struct udev_device *dev) +{ + struct udev_list_entry *list_entry; + + /* no match always matches */ + if (udev_list_get_entry(&udev_enumerate->tags_match_list) == NULL) + return true; + + /* loop over matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) + if (!udev_device_has_tag(dev, udev_list_entry_get_name(list_entry))) + return false; + + return true; +} + +static bool match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *dev) +{ + const char *parent; + + if (udev_enumerate->parent_match == NULL) + return true; + + parent = udev_device_get_devpath(udev_enumerate->parent_match); + return strncmp(parent, udev_device_get_devpath(dev), strlen(parent)) == 0; +} + +static bool match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) +{ + struct udev_list_entry *list_entry; + + if (udev_list_get_entry(&udev_enumerate->sysname_match_list) == NULL) + return true; + + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysname_match_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), sysname, 0) != 0) + continue; + return true; + } + return false; +} + +static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, + const char *basedir, const char *subdir1, const char *subdir2) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char path[UTIL_PATH_SIZE]; + size_t l; + char *s; + DIR *dir; + struct dirent *dent; + + s = path; + l = util_strpcpyl(&s, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); + if (subdir1 != NULL) + l = util_strpcpyl(&s, l, "/", subdir1, NULL); + if (subdir2 != NULL) + util_strpcpyl(&s, l, "/", subdir2, NULL); + dir = opendir(path); + if (dir == NULL) + return -ENOENT; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char syspath[UTIL_PATH_SIZE]; + struct udev_device *dev; + + if (dent->d_name[0] == '.') + continue; + + if (!match_sysname(udev_enumerate, dent->d_name)) + continue; + + util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); + dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (dev == NULL) + continue; + + if (udev_enumerate->match_is_initialized) { + /* + * All devices with a device node or network interfaces + * possibly need udev to adjust the device node permission + * or context, or rename the interface before it can be + * reliably used from other processes. + * + * For now, we can only check these types of devices, we + * might not store a database, and have no way to find out + * for all other types of devices. + */ + if (!udev_device_get_is_initialized(dev) && + (major(udev_device_get_devnum(dev)) > 0 || udev_device_get_ifindex(dev) > 0)) + goto nomatch; + } + if (!match_parent(udev_enumerate, dev)) + goto nomatch; + if (!match_tag(udev_enumerate, dev)) + goto nomatch; + if (!match_property(udev_enumerate, dev)) + goto nomatch; + if (!match_sysattr(udev_enumerate, dev)) + goto nomatch; + + syspath_add(udev_enumerate, udev_device_get_syspath(dev)); +nomatch: + udev_device_unref(dev); + } + closedir(dir); + return 0; +} + +static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) +{ + struct udev_list_entry *list_entry; + + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) + return false; + } + if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) + return true; + } + return false; + } + return true; +} + +static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir, const char *subsystem) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + + char path[UTIL_PATH_SIZE]; + DIR *dir; + struct dirent *dent; + + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + if (!match_subsystem(udev_enumerate, subsystem != NULL ? subsystem : dent->d_name)) + continue; + scan_dir_and_add_devices(udev_enumerate, basedir, dent->d_name, subdir); + } + closedir(dir); + return 0; +} + +/** + * udev_enumerate_add_syspath: + * @udev_enumerate: context + * @syspath: path of a device + * + * Add a device to the list of devices, to retrieve it back sorted in dependency order. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) +{ + struct udev_device *udev_device; + + if (udev_enumerate == NULL) + return -EINVAL; + if (syspath == NULL) + return 0; + /* resolve to real syspath */ + udev_device = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (udev_device == NULL) + return -EINVAL; + syspath_add(udev_enumerate, udev_device_get_syspath(udev_device)); + udev_device_unref(udev_device); + return 0; +} + +static int scan_devices_tags(struct udev_enumerate *udev_enumerate) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_list_entry *list_entry; + + /* scan only tagged devices, use tags reverse-index, instead of searching all devices in /sys */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) { + DIR *dir; + struct dirent *dent; + char path[UTIL_PATH_SIZE]; + + util_strscpyl(path, sizeof(path), udev_get_run_path(udev), "/tags/", + udev_list_entry_get_name(list_entry), NULL); + dir = opendir(path); + if (dir == NULL) + continue; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct udev_device *dev; + + if (dent->d_name[0] == '.') + continue; + + dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); + if (dev == NULL) + continue; + + if (!match_subsystem(udev_enumerate, udev_device_get_subsystem(dev))) + goto nomatch; + if (!match_sysname(udev_enumerate, udev_device_get_sysname(dev))) + goto nomatch; + if (!match_parent(udev_enumerate, dev)) + goto nomatch; + if (!match_property(udev_enumerate, dev)) + goto nomatch; + if (!match_sysattr(udev_enumerate, dev)) + goto nomatch; + + syspath_add(udev_enumerate, udev_device_get_syspath(dev)); +nomatch: + udev_device_unref(dev); + } + closedir(dir); + } + return 0; +} + +static int parent_add_child(struct udev_enumerate *enumerate, const char *path) +{ + struct udev_device *dev; + + dev = udev_device_new_from_syspath(enumerate->udev, path); + if (dev == NULL) + return -ENODEV; + + if (!match_subsystem(enumerate, udev_device_get_subsystem(dev))) + return 0; + if (!match_sysname(enumerate, udev_device_get_sysname(dev))) + return 0; + if (!match_property(enumerate, dev)) + return 0; + if (!match_sysattr(enumerate, dev)) + return 0; + + syspath_add(enumerate, udev_device_get_syspath(dev)); + udev_device_unref(dev); + return 1; +} + +static int parent_crawl_children(struct udev_enumerate *enumerate, const char *path, int maxdepth) +{ + DIR *d; + struct dirent *dent; + + d = opendir(path); + if (d == NULL) + return -errno; + + for (dent = readdir(d); dent != NULL; dent = readdir(d)) { + char *child; + + if (dent->d_name[0] == '.') + continue; + if (dent->d_type != DT_DIR) + continue; + if (asprintf(&child, "%s/%s", path, dent->d_name) < 0) + continue; + parent_add_child(enumerate, child); + if (maxdepth > 0) + parent_crawl_children(enumerate, child, maxdepth-1); + free(child); + } + + closedir(d); + return 0; +} + +static int scan_devices_children(struct udev_enumerate *enumerate) +{ + const char *path; + + path = udev_device_get_syspath(enumerate->parent_match); + parent_add_child(enumerate, path); + return parent_crawl_children(enumerate, path, 256); +} + +static int scan_devices_all(struct udev_enumerate *udev_enumerate) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char base[UTIL_PATH_SIZE]; + struct stat statbuf; + + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); + if (stat(base, &statbuf) == 0) { + /* we have /subsystem/, forget all the old stuff */ + dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); + scan_dir(udev_enumerate, "subsystem", "devices", NULL); + } else { + dbg(udev, "searching '/bus/*/devices/*' dir\n"); + scan_dir(udev_enumerate, "bus", "devices", NULL); + dbg(udev, "searching '/class/*' dir\n"); + scan_dir(udev_enumerate, "class", NULL, NULL); + } + return 0; +} + +/** + * udev_enumerate_scan_devices: + * @udev_enumerate: udev enumeration context + * + * Returns: 0 on success, otherwise a negative error value. + **/ +UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) +{ + if (udev_enumerate == NULL) + return -EINVAL; + + /* efficiently lookup tags only, we maintain a reverse-index */ + if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) + return scan_devices_tags(udev_enumerate); + + /* walk the subtree of one parent device only */ + if (udev_enumerate->parent_match != NULL) + return scan_devices_children(udev_enumerate); + + /* scan devices of all subsystems */ + return scan_devices_all(udev_enumerate); +} + +/** + * udev_enumerate_scan_subsystems: + * @udev_enumerate: udev enumeration context + * + * Returns: 0 on success, otherwise a negative error value. + **/ +UDEV_EXPORT int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char base[UTIL_PATH_SIZE]; + struct stat statbuf; + const char *subsysdir; + + if (udev_enumerate == NULL) + return -EINVAL; + + /* all kernel modules */ + if (match_subsystem(udev_enumerate, "module")) { + dbg(udev, "searching '%s/modules/*' dir\n", subsysdir); + scan_dir_and_add_devices(udev_enumerate, "module", NULL, NULL); + } + + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); + if (stat(base, &statbuf) == 0) + subsysdir = "subsystem"; + else + subsysdir = "bus"; + + /* all subsystems (only buses support coldplug) */ + if (match_subsystem(udev_enumerate, "subsystem")) { + dbg(udev, "searching '%s/*' dir\n", subsysdir); + scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); + } + + /* all subsystem drivers */ + if (match_subsystem(udev_enumerate, "drivers")) { + dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); + scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); + } + return 0; +} diff --git a/src/libudev-list.c b/src/libudev-list.c new file mode 100644 index 0000000000..f74a88ca49 --- /dev/null +++ b/src/libudev-list.c @@ -0,0 +1,344 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/** + * SECTION:libudev-list + * @short_description: list operation + * + * Libudev list operations. + */ + +/** + * udev_list_entry: + * + * Opaque object representing one entry in a list. An entry contains + * contains a name, and optionally a value. + */ +struct udev_list_entry { + struct udev_list_node node; + struct udev_list *list; + char *name; + char *value; + int num; +}; + +/* the list's head points to itself if empty */ +void udev_list_node_init(struct udev_list_node *list) +{ + list->next = list; + list->prev = list; +} + +int udev_list_node_is_empty(struct udev_list_node *list) +{ + return list->next == list; +} + +static void udev_list_node_insert_between(struct udev_list_node *new, + struct udev_list_node *prev, + struct udev_list_node *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list) +{ + udev_list_node_insert_between(new, list->prev, list); +} + +void udev_list_node_remove(struct udev_list_node *entry) +{ + struct udev_list_node *prev = entry->prev; + struct udev_list_node *next = entry->next; + + next->prev = prev; + prev->next = next; + + entry->prev = NULL; + entry->next = NULL; +} + +/* return list entry which embeds this node */ +static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) +{ + char *list; + + list = (char *)node; + list -= offsetof(struct udev_list_entry, node); + return (struct udev_list_entry *)list; +} + +void udev_list_init(struct udev *udev, struct udev_list *list, bool unique) +{ + memset(list, 0x00, sizeof(struct udev_list)); + list->udev = udev; + list->unique = unique; + udev_list_node_init(&list->node); +} + +/* insert entry into a list as the last element */ +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) +{ + /* inserting before the list head make the node the last node in the list */ + udev_list_node_insert_between(&new->node, list->node.prev, &list->node); + new->list = list; +} + +/* insert entry into a list, before a given existing entry */ +void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) +{ + udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node); + new->list = entry->list; +} + +/* binary search in sorted array */ +static int list_search(struct udev_list *list, const char *name) +{ + unsigned int first, last; + + first = 0; + last = list->entries_cur; + while (first < last) { + unsigned int i; + int cmp; + + i = (first + last)/2; + cmp = strcmp(name, list->entries[i]->name); + if (cmp < 0) + last = i; + else if (cmp > 0) + first = i+1; + else + return i; + } + + /* not found, return negative insertion-index+1 */ + return -(first+1); +} + +struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value) +{ + struct udev_list_entry *entry; + int i = 0; + + if (list->unique) { + /* lookup existing name or insertion-index */ + i = list_search(list, name); + if (i >= 0) { + entry = list->entries[i]; + + dbg(list->udev, "'%s' is already in the list\n", name); + free(entry->value); + if (value == NULL) { + entry->value = NULL; + dbg(list->udev, "'%s' value unset\n", name); + return entry; + } + entry->value = strdup(value); + if (entry->value == NULL) + return NULL; + dbg(list->udev, "'%s' value replaced with '%s'\n", name, value); + return entry; + } + } + + /* add new name */ + entry = calloc(1, sizeof(struct udev_list_entry)); + if (entry == NULL) + return NULL; + entry->name = strdup(name); + if (entry->name == NULL) { + free(entry); + return NULL; + } + if (value != NULL) { + entry->value = strdup(value); + if (entry->value == NULL) { + free(entry->name); + free(entry); + return NULL; + } + } + + if (list->unique) { + /* allocate or enlarge sorted array if needed */ + if (list->entries_cur >= list->entries_max) { + unsigned int add; + + add = list->entries_max; + if (add < 1) + add = 64; + list->entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *)); + if (list->entries == NULL) { + free(entry->name); + free(entry->value); + return NULL; + } + list->entries_max += add; + } + + /* the negative i returned the insertion index */ + i = (-i)-1; + + /* insert into sorted list */ + if ((unsigned int)i < list->entries_cur) + udev_list_entry_insert_before(entry, list->entries[i]); + else + udev_list_entry_append(entry, list); + + /* insert into sorted array */ + memmove(&list->entries[i+1], &list->entries[i], + (list->entries_cur - i) * sizeof(struct udev_list_entry *)); + list->entries[i] = entry; + list->entries_cur++; + } else { + udev_list_entry_append(entry, list); + } + + dbg(list->udev, "'%s=%s' added\n", entry->name, entry->value); + return entry; +} + +void udev_list_entry_delete(struct udev_list_entry *entry) +{ + if (entry->list->entries != NULL) { + int i; + struct udev_list *list = entry->list; + + /* remove entry from sorted array */ + i = list_search(list, entry->name); + if (i >= 0) { + memmove(&list->entries[i], &list->entries[i+1], + ((list->entries_cur-1) - i) * sizeof(struct udev_list_entry *)); + list->entries_cur--; + } + } + + udev_list_node_remove(&entry->node); + free(entry->name); + free(entry->value); + free(entry); +} + +void udev_list_cleanup(struct udev_list *list) +{ + struct udev_list_entry *entry_loop; + struct udev_list_entry *entry_tmp; + + free(list->entries); + list->entries = NULL; + list->entries_cur = 0; + list->entries_max = 0; + udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) + udev_list_entry_delete(entry_loop); +} + +struct udev_list_entry *udev_list_get_entry(struct udev_list *list) +{ + if (udev_list_node_is_empty(&list->node)) + return NULL; + return list_node_to_entry(list->node.next); +} + +/** + * udev_list_entry_get_next: + * @list_entry: current entry + * + * Returns: the next entry from the list, #NULL is no more entries are found. + */ +UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) +{ + struct udev_list_node *next; + + if (list_entry == NULL) + return NULL; + next = list_entry->node.next; + /* empty list or no more entries */ + if (next == &list_entry->list->node) + return NULL; + return list_node_to_entry(next); +} + +/** + * udev_list_entry_get_by_name: + * @list_entry: current entry + * @name: name string to match + * + * Returns: the entry where @name matched, #NULL if no matching entry is found. + */ +UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) +{ + int i; + + if (list_entry == NULL) + return NULL; + + if (!list_entry->list->unique) + return NULL; + + i = list_search(list_entry->list, name); + if (i < 0) + return NULL; + return list_entry->list->entries[i]; +} + +/** + * udev_list_entry_get_name: + * @list_entry: current entry + * + * Returns: the name string of this entry. + */ +UDEV_EXPORT const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) +{ + if (list_entry == NULL) + return NULL; + return list_entry->name; +} + +/** + * udev_list_entry_get_value: + * @list_entry: current entry + * + * Returns: the value string of this entry. + */ +UDEV_EXPORT const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) +{ + if (list_entry == NULL) + return NULL; + return list_entry->value; +} + +int udev_list_entry_get_num(struct udev_list_entry *list_entry) +{ + if (list_entry == NULL) + return -EINVAL; + return list_entry->num; +} + +void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num) +{ + if (list_entry == NULL) + return; + list_entry->num = num; +} diff --git a/src/libudev-monitor.c b/src/libudev-monitor.c new file mode 100644 index 0000000000..f2f39f9582 --- /dev/null +++ b/src/libudev-monitor.c @@ -0,0 +1,875 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2010 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/** + * SECTION:libudev-monitor + * @short_description: device event source + * + * Connects to a device event source. + */ + +/** + * udev_monitor: + * + * Opaque object handling an event source. + */ +struct udev_monitor { + struct udev *udev; + int refcount; + int sock; + struct sockaddr_nl snl; + struct sockaddr_nl snl_trusted_sender; + struct sockaddr_nl snl_destination; + struct sockaddr_un sun; + socklen_t addrlen; + struct udev_list filter_subsystem_list; + struct udev_list filter_tag_list; + bool bound; +}; + +enum udev_monitor_netlink_group { + UDEV_MONITOR_NONE, + UDEV_MONITOR_KERNEL, + UDEV_MONITOR_UDEV, +}; + +#define UDEV_MONITOR_MAGIC 0xfeedcafe +struct udev_monitor_netlink_header { + /* "libudev" prefix to distinguish libudev and kernel messages */ + char prefix[8]; + /* + * magic to protect against daemon <-> library message format mismatch + * used in the kernel from socket filter rules; needs to be stored in network order + */ + unsigned int magic; + /* total length of header structure known to the sender */ + unsigned int header_size; + /* properties string buffer */ + unsigned int properties_off; + unsigned int properties_len; + /* + * hashes of primary device properties strings, to let libudev subscribers + * use in-kernel socket filters; values need to be stored in network order + */ + unsigned int filter_subsystem_hash; + unsigned int filter_devtype_hash; + unsigned int filter_tag_bloom_hi; + unsigned int filter_tag_bloom_lo; +}; + +static struct udev_monitor *udev_monitor_new(struct udev *udev) +{ + struct udev_monitor *udev_monitor; + + udev_monitor = calloc(1, sizeof(struct udev_monitor)); + if (udev_monitor == NULL) + return NULL; + udev_monitor->refcount = 1; + udev_monitor->udev = udev; + udev_list_init(udev, &udev_monitor->filter_subsystem_list, false); + udev_list_init(udev, &udev_monitor->filter_tag_list, true); + return udev_monitor; +} + +/** + * udev_monitor_new_from_socket: + * @udev: udev library context + * @socket_path: unix socket path + * + * This function should not be used in any new application. The + * kernel's netlink socket multiplexes messages to all interested + * clients. Creating custom sockets from udev to applications + * should be avoided. + * + * Create a new udev monitor and connect to a specified socket. The + * path to a socket either points to an existing socket file, or if + * the socket path starts with a '@' character, an abstract namespace + * socket will be used. + * + * A socket file will not be created. If it does not already exist, + * it will fall-back and connect to an abstract namespace socket with + * the given path. The permissions adjustment of a socket file, as + * well as the later cleanup, needs to be done by the caller. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev monitor. + * + * Returns: a new udev monitor, or #NULL, in case of an error + **/ +UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) +{ + struct udev_monitor *udev_monitor; + struct stat statbuf; + + if (udev == NULL) + return NULL; + if (socket_path == NULL) + return NULL; + udev_monitor = udev_monitor_new(udev); + if (udev_monitor == NULL) + return NULL; + + udev_monitor->sun.sun_family = AF_LOCAL; + if (socket_path[0] == '@') { + /* translate leading '@' to abstract namespace */ + util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); + udev_monitor->sun.sun_path[0] = '\0'; + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); + } else if (stat(socket_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { + /* existing socket file */ + util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); + } else { + /* no socket file, assume abstract namespace socket */ + util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; + } + udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); + if (udev_monitor->sock == -1) { + err(udev, "error getting socket: %m\n"); + free(udev_monitor); + return NULL; + } + + dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); + return udev_monitor; +} + +struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd) +{ + struct udev_monitor *udev_monitor; + unsigned int group; + + if (udev == NULL) + return NULL; + + if (name == NULL) + group = UDEV_MONITOR_NONE; + else if (strcmp(name, "udev") == 0) + group = UDEV_MONITOR_UDEV; + else if (strcmp(name, "kernel") == 0) + group = UDEV_MONITOR_KERNEL; + else + return NULL; + + udev_monitor = udev_monitor_new(udev); + if (udev_monitor == NULL) + return NULL; + + if (fd < 0) { + udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT); + if (udev_monitor->sock == -1) { + err(udev, "error getting socket: %m\n"); + free(udev_monitor); + return NULL; + } + } else { + udev_monitor->bound = true; + udev_monitor->sock = fd; + } + + udev_monitor->snl.nl_family = AF_NETLINK; + udev_monitor->snl.nl_groups = group; + + /* default destination for sending */ + udev_monitor->snl_destination.nl_family = AF_NETLINK; + udev_monitor->snl_destination.nl_groups = UDEV_MONITOR_UDEV; + + dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT (%u)\n", udev_monitor, group); + return udev_monitor; +} + +/** + * udev_monitor_new_from_netlink: + * @udev: udev library context + * @name: name of event source + * + * Create new udev monitor and connect to a specified event + * source. Valid sources identifiers are "udev" and "kernel". + * + * Applications should usually not connect directly to the + * "kernel" events, because the devices might not be useable + * at that time, before udev has configured them, and created + * device nodes. Accessing devices at the same time as udev, + * might result in unpredictable behavior. The "udev" events + * are sent out after udev has finished its event processing, + * all rules have been processed, and needed device nodes are + * created. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev monitor. + * + * Returns: a new udev monitor, or #NULL, in case of an error + **/ +UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) +{ + return udev_monitor_new_from_netlink_fd(udev, name, -1); +} + +static inline void bpf_stmt(struct sock_filter *inss, unsigned int *i, + unsigned short code, unsigned int data) +{ + struct sock_filter *ins = &inss[*i]; + + ins->code = code; + ins->k = data; + (*i)++; +} + +static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, + unsigned short code, unsigned int data, + unsigned short jt, unsigned short jf) +{ + struct sock_filter *ins = &inss[*i]; + + ins->code = code; + ins->jt = jt; + ins->jf = jf; + ins->k = data; + (*i)++; +} + +/** + * udev_monitor_filter_update: + * @udev_monitor: monitor + * + * Update the installed socket filter. This is only needed, + * if the filter was removed or changed. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_monitor_filter_update(struct udev_monitor *udev_monitor) +{ + struct sock_filter ins[512]; + struct sock_fprog filter; + unsigned int i; + struct udev_list_entry *list_entry; + int err; + + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL && + udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) + return 0; + + memset(ins, 0x00, sizeof(ins)); + i = 0; + + /* load magic in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, magic)); + /* jump if magic matches */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, UDEV_MONITOR_MAGIC, 1, 0); + /* wrong magic, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + + if (udev_list_get_entry(&udev_monitor->filter_tag_list) != NULL) { + int tag_matches; + + /* count tag matches, to calculate end of tag match block */ + tag_matches = 0; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) + tag_matches++; + + /* add all tags matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { + uint64_t tag_bloom_bits = util_string_bloom64(udev_list_entry_get_name(list_entry)); + uint32_t tag_bloom_hi = tag_bloom_bits >> 32; + uint32_t tag_bloom_lo = tag_bloom_bits & 0xffffffff; + + /* load device bloom bits in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_hi)); + /* clear bits (tag bits & bloom bits) */ + bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_hi); + /* jump to next tag if it does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_hi, 0, 3); + + /* load device bloom bits in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_lo)); + /* clear bits (tag bits & bloom bits) */ + bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_lo); + /* jump behind end of tag match block if tag matches */ + tag_matches--; + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_lo, 1 + (tag_matches * 6), 0); + } + + /* nothing matched, drop packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); + } + + /* add all subsystem matches */ + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { + unsigned int hash = util_string_hash32(udev_list_entry_get_name(list_entry)); + + /* load device subsystem value in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem_hash)); + if (udev_list_entry_get_value(list_entry) == NULL) { + /* jump if subsystem does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); + } else { + /* jump if subsystem does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3); + + /* load device devtype value in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_devtype_hash)); + /* jump if value does not match */ + hash = util_string_hash32(udev_list_entry_get_value(list_entry)); + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); + } + + /* matched, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + + if (i+1 >= ARRAY_SIZE(ins)) + return -1; + } + + /* nothing matched, drop packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); + } + + /* matched, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + + /* install filter */ + memset(&filter, 0x00, sizeof(filter)); + filter.len = i; + filter.filter = ins; + err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); + return err; +} + +int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender) +{ + udev_monitor->snl_trusted_sender.nl_pid = sender->snl.nl_pid; + return 0; +} +/** + * udev_monitor_enable_receiving: + * @udev_monitor: the monitor which should receive events + * + * Binds the @udev_monitor socket to the event source. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) +{ + int err = 0; + const int on = 1; + + if (udev_monitor->sun.sun_family != 0) { + if (!udev_monitor->bound) { + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); + if (err == 0) + udev_monitor->bound = true; + } + } else if (udev_monitor->snl.nl_family != 0) { + udev_monitor_filter_update(udev_monitor); + if (!udev_monitor->bound) { + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); + if (err == 0) + udev_monitor->bound = true; + } + if (err == 0) { + struct sockaddr_nl snl; + socklen_t addrlen; + + /* + * get the address the kernel has assigned us + * it is usually, but not necessarily the pid + */ + addrlen = sizeof(struct sockaddr_nl); + err = getsockname(udev_monitor->sock, (struct sockaddr *)&snl, &addrlen); + if (err == 0) + udev_monitor->snl.nl_pid = snl.nl_pid; + } + } else { + return -EINVAL; + } + + if (err < 0) { + err(udev_monitor->udev, "bind failed: %m\n"); + return err; + } + + /* enable receiving of sender credentials */ + setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + return 0; +} + +/** + * udev_monitor_set_receive_buffer_size: + * @udev_monitor: the monitor which should receive events + * @size: the size in bytes + * + * Set the size of the kernel socket buffer. This call needs the + * appropriate privileges to succeed. + * + * Returns: 0 on success, otherwise -1 on error. + */ +UDEV_EXPORT int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) +{ + if (udev_monitor == NULL) + return -1; + return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size)); +} + +int udev_monitor_disconnect(struct udev_monitor *udev_monitor) +{ + int err; + + err = close(udev_monitor->sock); + udev_monitor->sock = -1; + return err; +} + +/** + * udev_monitor_ref: + * @udev_monitor: udev monitor + * + * Take a reference of a udev monitor. + * + * Returns: the passed udev monitor + **/ +UDEV_EXPORT struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return NULL; + udev_monitor->refcount++; + return udev_monitor; +} + +/** + * udev_monitor_unref: + * @udev_monitor: udev monitor + * + * Drop a reference of a udev monitor. If the refcount reaches zero, + * the bound socket will be closed, and the resources of the monitor + * will be released. + * + **/ +UDEV_EXPORT void udev_monitor_unref(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return; + udev_monitor->refcount--; + if (udev_monitor->refcount > 0) + return; + if (udev_monitor->sock >= 0) + close(udev_monitor->sock); + udev_list_cleanup(&udev_monitor->filter_subsystem_list); + udev_list_cleanup(&udev_monitor->filter_tag_list); + dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); + free(udev_monitor); +} + +/** + * udev_monitor_get_udev: + * @udev_monitor: udev monitor + * + * Retrieve the udev library context the monitor was created with. + * + * Returns: the udev library context + **/ +UDEV_EXPORT struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return NULL; + return udev_monitor->udev; +} + +/** + * udev_monitor_get_fd: + * @udev_monitor: udev monitor + * + * Retrieve the socket file descriptor associated with the monitor. + * + * Returns: the socket file descriptor + **/ +UDEV_EXPORT int udev_monitor_get_fd(struct udev_monitor *udev_monitor) +{ + if (udev_monitor == NULL) + return -1; + return udev_monitor->sock; +} + +static int passes_filter(struct udev_monitor *udev_monitor, struct udev_device *udev_device) +{ + struct udev_list_entry *list_entry; + + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) + goto tag; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { + const char *subsys = udev_list_entry_get_name(list_entry); + const char *dsubsys = udev_device_get_subsystem(udev_device); + const char *devtype; + const char *ddevtype; + + if (strcmp(dsubsys, subsys) != 0) + continue; + + devtype = udev_list_entry_get_value(list_entry); + if (devtype == NULL) + goto tag; + ddevtype = udev_device_get_devtype(udev_device); + if (ddevtype == NULL) + continue; + if (strcmp(ddevtype, devtype) == 0) + goto tag; + } + return 0; + +tag: + if (udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) + return 1; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { + const char *tag = udev_list_entry_get_name(list_entry); + + if (udev_device_has_tag(udev_device, tag)) + return 1; + } + return 0; +} + +/** + * udev_monitor_receive_device: + * @udev_monitor: udev monitor + * + * Receive data from the udev monitor socket, allocate a new udev + * device, fill in the received data, and return the device. + * + * Only socket connections with uid=0 are accepted. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev device. + * + * Returns: a new udev device, or #NULL, in case of an error + **/ +UDEV_EXPORT struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) +{ + struct udev_device *udev_device; + struct msghdr smsg; + struct iovec iov; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + struct cmsghdr *cmsg; + struct sockaddr_nl snl; + struct ucred *cred; + char buf[8192]; + ssize_t buflen; + ssize_t bufpos; + struct udev_monitor_netlink_header *nlh; + +retry: + if (udev_monitor == NULL) + return NULL; + memset(buf, 0x00, sizeof(buf)); + iov.iov_base = &buf; + iov.iov_len = sizeof(buf); + memset (&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + + if (udev_monitor->snl.nl_family != 0) { + smsg.msg_name = &snl; + smsg.msg_namelen = sizeof(snl); + } + + buflen = recvmsg(udev_monitor->sock, &smsg, 0); + if (buflen < 0) { + if (errno != EINTR) + info(udev_monitor->udev, "unable to receive message\n"); + return NULL; + } + + if (buflen < 32 || (size_t)buflen >= sizeof(buf)) { + info(udev_monitor->udev, "invalid message length\n"); + return NULL; + } + + if (udev_monitor->snl.nl_family != 0) { + if (snl.nl_groups == 0) { + /* unicast message, check if we trust the sender */ + if (udev_monitor->snl_trusted_sender.nl_pid == 0 || + snl.nl_pid != udev_monitor->snl_trusted_sender.nl_pid) { + info(udev_monitor->udev, "unicast netlink message ignored\n"); + return NULL; + } + } else if (snl.nl_groups == UDEV_MONITOR_KERNEL) { + if (snl.nl_pid > 0) { + info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", + snl.nl_pid); + return NULL; + } + } + } + + cmsg = CMSG_FIRSTHDR(&smsg); + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + info(udev_monitor->udev, "no sender credentials received, message ignored\n"); + return NULL; + } + + cred = (struct ucred *)CMSG_DATA(cmsg); + if (cred->uid != 0) { + info(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid); + return NULL; + } + + if (memcmp(buf, "libudev", 8) == 0) { + /* udev message needs proper version magic */ + nlh = (struct udev_monitor_netlink_header *) buf; + if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) { + err(udev_monitor->udev, "unrecognized message signature (%x != %x)\n", + nlh->magic, htonl(UDEV_MONITOR_MAGIC)); + return NULL; + } + if (nlh->properties_off+32 > buflen) + return NULL; + bufpos = nlh->properties_off; + } else { + /* kernel message with header */ + bufpos = strlen(buf) + 1; + if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) { + info(udev_monitor->udev, "invalid message length\n"); + return NULL; + } + + /* check message header */ + if (strstr(buf, "@/") == NULL) { + info(udev_monitor->udev, "unrecognized message header\n"); + return NULL; + } + } + + udev_device = udev_device_new(udev_monitor->udev); + if (udev_device == NULL) + return NULL; + udev_device_set_info_loaded(udev_device); + + while (bufpos < buflen) { + char *key; + size_t keylen; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + bufpos += keylen + 1; + udev_device_add_property_from_string_parse(udev_device, key); + } + + if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { + info(udev_monitor->udev, "missing values, invalid device\n"); + udev_device_unref(udev_device); + return NULL; + } + + /* skip device, if it does not pass the current filter */ + if (!passes_filter(udev_monitor, udev_device)) { + struct pollfd pfd[1]; + int rc; + + udev_device_unref(udev_device); + + /* if something is queued, get next device */ + pfd[0].fd = udev_monitor->sock; + pfd[0].events = POLLIN; + rc = poll(pfd, 1, 0); + if (rc > 0) + goto retry; + return NULL; + } + + return udev_device; +} + +int udev_monitor_send_device(struct udev_monitor *udev_monitor, + struct udev_monitor *destination, struct udev_device *udev_device) +{ + const char *buf; + ssize_t blen; + ssize_t count; + + blen = udev_device_get_properties_monitor_buf(udev_device, &buf); + if (blen < 32) + return -EINVAL; + + if (udev_monitor->sun.sun_family != 0) { + struct msghdr smsg; + struct iovec iov[2]; + const char *action; + char header[2048]; + char *s; + + /* header @ */ + action = udev_device_get_action(udev_device); + if (action == NULL) + return -EINVAL; + s = header; + if (util_strpcpyl(&s, sizeof(header), action, "@", udev_device_get_devpath(udev_device), NULL) == 0) + return -EINVAL; + iov[0].iov_base = header; + iov[0].iov_len = (s - header)+1; + + /* add properties list */ + iov[1].iov_base = (char *)buf; + iov[1].iov_len = blen; + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = iov; + smsg.msg_iovlen = 2; + smsg.msg_name = &udev_monitor->sun; + smsg.msg_namelen = udev_monitor->addrlen; + count = sendmsg(udev_monitor->sock, &smsg, 0); + info(udev_monitor->udev, "passed %zi bytes to socket monitor %p\n", count, udev_monitor); + return count; + } + + if (udev_monitor->snl.nl_family != 0) { + struct msghdr smsg; + struct iovec iov[2]; + const char *val; + struct udev_monitor_netlink_header nlh; + struct udev_list_entry *list_entry; + uint64_t tag_bloom_bits; + + /* add versioned header */ + memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header)); + memcpy(nlh.prefix, "libudev", 8); + nlh.magic = htonl(UDEV_MONITOR_MAGIC); + nlh.header_size = sizeof(struct udev_monitor_netlink_header); + val = udev_device_get_subsystem(udev_device); + nlh.filter_subsystem_hash = htonl(util_string_hash32(val)); + val = udev_device_get_devtype(udev_device); + if (val != NULL) + nlh.filter_devtype_hash = htonl(util_string_hash32(val)); + iov[0].iov_base = &nlh; + iov[0].iov_len = sizeof(struct udev_monitor_netlink_header); + + /* add tag bloom filter */ + tag_bloom_bits = 0; + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + tag_bloom_bits |= util_string_bloom64(udev_list_entry_get_name(list_entry)); + if (tag_bloom_bits > 0) { + nlh.filter_tag_bloom_hi = htonl(tag_bloom_bits >> 32); + nlh.filter_tag_bloom_lo = htonl(tag_bloom_bits & 0xffffffff); + } + + /* add properties list */ + nlh.properties_off = iov[0].iov_len; + nlh.properties_len = blen; + iov[1].iov_base = (char *)buf; + iov[1].iov_len = blen; + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = iov; + smsg.msg_iovlen = 2; + /* + * Use custom address for target, or the default one. + * + * If we send to a multicast group, we will get + * ECONNREFUSED, which is expected. + */ + if (destination != NULL) + smsg.msg_name = &destination->snl; + else + smsg.msg_name = &udev_monitor->snl_destination; + smsg.msg_namelen = sizeof(struct sockaddr_nl); + count = sendmsg(udev_monitor->sock, &smsg, 0); + info(udev_monitor->udev, "passed %zi bytes to netlink monitor %p\n", count, udev_monitor); + return count; + } + + return -EINVAL; +} + +/** + * udev_monitor_filter_add_match_subsystem_devtype: + * @udev_monitor: the monitor + * @subsystem: the subsystem value to match the incoming devices against + * @devtype: the devtype value to match the incoming devices against + * + * This filter is efficiently executed inside the kernel, and libudev subscribers + * will usually not be woken up for devices which do not match. + * + * The filter must be installed before the monitor is switched to listening mode. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) +{ + if (udev_monitor == NULL) + return -EINVAL; + if (subsystem == NULL) + return -EINVAL; + if (udev_list_entry_add(&udev_monitor->filter_subsystem_list, subsystem, devtype) == NULL) + return -ENOMEM; + return 0; +} + +/** + * udev_monitor_filter_add_match_tag: + * @udev_monitor: the monitor + * @tag: the name of a tag + * + * This filter is efficiently executed inside the kernel, and libudev subscribers + * will usually not be woken up for devices which do not match. + * + * The filter must be installed before the monitor is switched to listening mode. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag) +{ + if (udev_monitor == NULL) + return -EINVAL; + if (tag == NULL) + return -EINVAL; + if (udev_list_entry_add(&udev_monitor->filter_tag_list, tag, NULL) == NULL) + return -ENOMEM; + return 0; +} + +/** + * udev_monitor_filter_remove: + * @udev_monitor: monitor + * + * Remove all filters from monitor. + * + * Returns: 0 on success, otherwise a negative error value. + */ +UDEV_EXPORT int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) +{ + static struct sock_fprog filter = { 0, NULL }; + + udev_list_cleanup(&udev_monitor->filter_subsystem_list); + return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); +} diff --git a/src/libudev-private.h b/src/libudev-private.h new file mode 100644 index 0000000000..83976698a9 --- /dev/null +++ b/src/libudev-private.h @@ -0,0 +1,213 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2010 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#ifndef _LIBUDEV_PRIVATE_H_ +#define _LIBUDEV_PRIVATE_H_ + +#include +#include +#include +#include +#include "libudev.h" + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#define READ_END 0 +#define WRITE_END 1 + +static inline void __attribute__((always_inline, format(printf, 2, 3))) +udev_log_null(struct udev *udev, const char *format, ...) {} + +#define udev_log_cond(udev, prio, arg...) \ + do { \ + if (udev_get_log_priority(udev) >= prio) \ + udev_log(udev, prio, __FILE__, __LINE__, __FUNCTION__, ## arg); \ + } while (0) + +#ifdef ENABLE_LOGGING +# ifdef ENABLE_DEBUG +# define dbg(udev, arg...) udev_log_cond(udev, LOG_DEBUG, ## arg) +# else +# define dbg(udev, arg...) udev_log_null(udev, ## arg) +# endif +# define info(udev, arg...) udev_log_cond(udev, LOG_INFO, ## arg) +# define err(udev, arg...) udev_log_cond(udev, LOG_ERR, ## arg) +#else +# define dbg(udev, arg...) udev_log_null(udev, ## arg) +# define info(udev, arg...) udev_log_null(udev, ## arg) +# define err(udev, arg...) udev_log_null(udev, ## arg) +#endif + +#define UDEV_EXPORT __attribute__ ((visibility("default"))) + +static inline void udev_log_init(const char *program_name) +{ + openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); +} + +static inline void udev_log_close(void) +{ + closelog(); +} + +/* libudev.c */ +void udev_log(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, ...) + __attribute__((format(printf, 6, 7))); +int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *ts_usec[]); +struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); +struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); + +/* libudev-device.c */ +struct udev_device *udev_device_new(struct udev *udev); +struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id); +mode_t udev_device_get_devnode_mode(struct udev_device *udev_device); +int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath); +int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode); +int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique); +void udev_device_cleanup_devlinks_list(struct udev_device *udev_device); +struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value); +void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property); +int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device); +char **udev_device_get_properties_envp(struct udev_device *udev_device); +ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf); +int udev_device_read_db(struct udev_device *udev_device, const char *dbfile); +int udev_device_read_uevent_file(struct udev_device *udev_device); +int udev_device_set_action(struct udev_device *udev_device, const char *action); +const char *udev_device_get_devpath_old(struct udev_device *udev_device); +const char *udev_device_get_id_filename(struct udev_device *udev_device); +void udev_device_set_is_initialized(struct udev_device *udev_device); +int udev_device_add_tag(struct udev_device *udev_device, const char *tag); +void udev_device_cleanup_tags_list(struct udev_device *udev_device); +unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device); +void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized); +int udev_device_get_devlink_priority(struct udev_device *udev_device); +int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio); +int udev_device_get_watch_handle(struct udev_device *udev_device); +int udev_device_set_watch_handle(struct udev_device *udev_device, int handle); +int udev_device_get_ifindex(struct udev_device *udev_device); +void udev_device_set_info_loaded(struct udev_device *device); +bool udev_device_get_db_persist(struct udev_device *udev_device); +void udev_device_set_db_persist(struct udev_device *udev_device); + +/* libudev-device-private.c */ +int udev_device_update_db(struct udev_device *udev_device); +int udev_device_delete_db(struct udev_device *udev_device); +int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add); + +/* libudev-monitor.c - netlink/unix socket communication */ +int udev_monitor_disconnect(struct udev_monitor *udev_monitor); +int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); +int udev_monitor_send_device(struct udev_monitor *udev_monitor, + struct udev_monitor *destination, struct udev_device *udev_device); +struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd); + +/* libudev-list.c */ +struct udev_list_node { + struct udev_list_node *next, *prev; +}; +struct udev_list { + struct udev *udev; + struct udev_list_node node; + struct udev_list_entry **entries; + unsigned int entries_cur; + unsigned int entries_max; + bool unique; +}; +#define UDEV_LIST(list) struct udev_list_node list = { &(list), &(list) } +void udev_list_node_init(struct udev_list_node *list); +int udev_list_node_is_empty(struct udev_list_node *list); +void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list); +void udev_list_node_remove(struct udev_list_node *entry); +#define udev_list_node_foreach(node, list) \ + for (node = (list)->next; \ + node != list; \ + node = (node)->next) +#define udev_list_node_foreach_safe(node, tmp, list) \ + for (node = (list)->next, tmp = (node)->next; \ + node != list; \ + node = tmp, tmp = (tmp)->next) +void udev_list_init(struct udev *udev, struct udev_list *list, bool unique); +void udev_list_cleanup(struct udev_list *list); +struct udev_list_entry *udev_list_get_entry(struct udev_list *list); +struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value); +void udev_list_entry_delete(struct udev_list_entry *entry); +void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry); +void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list); +int udev_list_entry_get_num(struct udev_list_entry *list_entry); +void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num); +#define udev_list_entry_foreach_safe(entry, tmp, first) \ + for (entry = first, tmp = udev_list_entry_get_next(entry); \ + entry != NULL; \ + entry = tmp, tmp = udev_list_entry_get_next(tmp)) + +/* libudev-queue.c */ +unsigned long long int udev_get_kernel_seqnum(struct udev *udev); +int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum); +ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size); +ssize_t udev_queue_skip_devpath(FILE *queue_file); + +/* libudev-queue-private.c */ +struct udev_queue_export *udev_queue_export_new(struct udev *udev); +struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev_queue_export); +void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export); +int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); +int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); + +/* libudev-util.c */ +#define UTIL_PATH_SIZE 1024 +#define UTIL_NAME_SIZE 512 +#define UTIL_LINE_SIZE 16384 +#define UDEV_ALLOWED_CHARS_INPUT "/ $%?," +ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size); +int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); +int util_log_priority(const char *priority); +size_t util_path_encode(const char *src, char *dest, size_t size); +size_t util_path_decode(char *s); +void util_remove_trailing_chars(char *path, char c); +size_t util_strpcpy(char **dest, size_t size, const char *src); +size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) __attribute__((sentinel)); +size_t util_strscpy(char *dest, size_t size, const char *src); +size_t util_strscpyl(char *dest, size_t size, const char *src, ...) __attribute__((sentinel)); +int util_replace_whitespace(const char *str, char *to, size_t len); +int util_replace_chars(char *str, const char *white); +unsigned int util_string_hash32(const char *key); +uint64_t util_string_bloom64(const char *str); + +/* libudev-util-private.c */ +int util_create_path(struct udev *udev, const char *path); +int util_create_path_selinux(struct udev *udev, const char *path); +int util_delete_path(struct udev *udev, const char *path); +uid_t util_lookup_user(struct udev *udev, const char *user); +gid_t util_lookup_group(struct udev *udev, const char *group); +int util_resolve_subsys_kernel(struct udev *udev, const char *string, + char *result, size_t maxsize, int read_value); +unsigned long long ts_usec(const struct timespec *ts); +unsigned long long now_usec(void); + +/* libudev-selinux-private.c */ +#ifndef WITH_SELINUX +static inline void udev_selinux_init(struct udev *udev) {} +static inline void udev_selinux_exit(struct udev *udev) {} +static inline void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) {} +static inline void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) {} +static inline void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode) {} +static inline void udev_selinux_resetfscreatecon(struct udev *udev) {} +#else +void udev_selinux_init(struct udev *udev); +void udev_selinux_exit(struct udev *udev); +void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode); +void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode); +void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode); +void udev_selinux_resetfscreatecon(struct udev *udev); +#endif + +#endif diff --git a/src/libudev-queue-private.c b/src/libudev-queue-private.c new file mode 100644 index 0000000000..e0a7b53b81 --- /dev/null +++ b/src/libudev-queue-private.c @@ -0,0 +1,412 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2009 Alan Jenkins + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +/* + * DISCLAIMER - The file format mentioned here is private to udev/libudev, + * and may be changed without notice. + * + * The udev event queue is exported as a binary log file. + * Each log record consists of a sequence number followed by the device path. + * + * When a new event is queued, its details are appended to the log. + * When the event finishes, a second record is appended to the log + * with the same sequence number but a devpath len of 0. + * + * Example: + * { 0x0000000000000001 } + * { 0x0000000000000001, 0x0019, "/devices/virtual/mem/null" }, + * { 0x0000000000000002, 0x001b, "/devices/virtual/mem/random" }, + * { 0x0000000000000001, 0x0000 }, + * { 0x0000000000000003, 0x0019, "/devices/virtual/mem/zero" }, + * + * Events 2 and 3 are still queued, but event 1 has finished. + * + * The queue does not grow indefinitely. It is periodically re-created + * to remove finished events. Atomic rename() makes this transparent to readers. + * + * The queue file starts with a single sequence number which specifies the + * minimum sequence number in the log that follows. Any events prior to this + * sequence number have already finished. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); + +struct udev_queue_export { + struct udev *udev; + int queued_count; /* number of unfinished events exported in queue file */ + FILE *queue_file; + unsigned long long int seqnum_max; /* earliest sequence number in queue file */ + unsigned long long int seqnum_min; /* latest sequence number in queue file */ + int waste_bytes; /* queue file bytes wasted on finished events */ +}; + +struct udev_queue_export *udev_queue_export_new(struct udev *udev) +{ + struct udev_queue_export *udev_queue_export; + unsigned long long int initial_seqnum; + + if (udev == NULL) + return NULL; + + udev_queue_export = calloc(1, sizeof(struct udev_queue_export)); + if (udev_queue_export == NULL) + return NULL; + udev_queue_export->udev = udev; + + initial_seqnum = udev_get_kernel_seqnum(udev); + udev_queue_export->seqnum_min = initial_seqnum; + udev_queue_export->seqnum_max = initial_seqnum; + + udev_queue_export_cleanup(udev_queue_export); + if (rebuild_queue_file(udev_queue_export) != 0) { + free(udev_queue_export); + return NULL; + } + + return udev_queue_export; +} + +struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev_queue_export) +{ + if (udev_queue_export == NULL) + return NULL; + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + free(udev_queue_export); + return NULL; +} + +void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) +{ + char filename[UTIL_PATH_SIZE]; + + if (udev_queue_export == NULL) + return; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); + unlink(filename); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); + unlink(filename); +} + +static int skip_to(FILE *file, long offset) +{ + long old_offset; + + /* fseek may drop buffered data, avoid it for small seeks */ + old_offset = ftell(file); + if (offset > old_offset && offset - old_offset <= BUFSIZ) { + size_t skip_bytes = offset - old_offset; + char buf[skip_bytes]; + + if (fread(buf, skip_bytes, 1, file) != skip_bytes) + return -1; + } + + return fseek(file, offset, SEEK_SET); +} + +struct queue_devpaths { + unsigned int devpaths_first; /* index of first queued event */ + unsigned int devpaths_size; + long devpaths[]; /* seqnum -> offset of devpath in queue file (or 0) */ +}; + +/* + * Returns a table mapping seqnum to devpath file offset for currently queued events. + * devpaths[i] represents the event with seqnum = i + udev_queue_export->seqnum_min. + */ +static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_export) +{ + struct queue_devpaths *devpaths; + unsigned long long int range; + long devpath_offset; + ssize_t devpath_len; + unsigned long long int seqnum; + unsigned long long int n; + unsigned int i; + + /* seek to the first event in the file */ + rewind(udev_queue_export->queue_file); + udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum); + + /* allocate the table */ + range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max; + if (range - 1 > INT_MAX) { + err(udev_queue_export->udev, "queue file overflow\n"); + return NULL; + } + devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); + if (devpaths == NULL) + return NULL; + devpaths->devpaths_size = range + 1; + + /* read all records and populate the table */ + for (;;) { + if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) + break; + n = seqnum - udev_queue_export->seqnum_max; + if (n >= devpaths->devpaths_size) + goto read_error; + + devpath_offset = ftell(udev_queue_export->queue_file); + devpath_len = udev_queue_skip_devpath(udev_queue_export->queue_file); + if (devpath_len < 0) + goto read_error; + + if (devpath_len > 0) + devpaths->devpaths[n] = devpath_offset; + else + devpaths->devpaths[n] = 0; + } + + /* find first queued event */ + for (i = 0; i < devpaths->devpaths_size; i++) { + if (devpaths->devpaths[i] != 0) + break; + } + devpaths->devpaths_first = i; + + return devpaths; + +read_error: + err(udev_queue_export->udev, "queue file corrupted\n"); + free(devpaths); + return NULL; +} + +static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) +{ + unsigned long long int seqnum; + struct queue_devpaths *devpaths = NULL; + char filename[UTIL_PATH_SIZE]; + char filename_tmp[UTIL_PATH_SIZE]; + FILE *new_queue_file = NULL; + unsigned int i; + + /* read old queue file */ + if (udev_queue_export->queue_file != NULL) { + dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n", + udev_queue_export->waste_bytes); + + devpaths = build_index(udev_queue_export); + if (devpaths != NULL) + udev_queue_export->seqnum_max += devpaths->devpaths_first; + } + if (devpaths == NULL) { + dbg(udev_queue_export->udev, "creating empty queue file\n"); + udev_queue_export->queued_count = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + } + + /* create new queue file */ + util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); + new_queue_file = fopen(filename_tmp, "w+"); + if (new_queue_file == NULL) + goto error; + seqnum = udev_queue_export->seqnum_max; + fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); + + /* copy unfinished events only to the new file */ + if (devpaths != NULL) { + for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { + char devpath[UTIL_PATH_SIZE]; + int err; + unsigned short devpath_len; + + if (devpaths->devpaths[i] != 0) + { + skip_to(udev_queue_export->queue_file, devpaths->devpaths[i]); + err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); + devpath_len = err; + + fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); + fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); + fwrite(devpath, 1, devpath_len, new_queue_file); + } + seqnum++; + } + free(devpaths); + devpaths = NULL; + } + fflush(new_queue_file); + if (ferror(new_queue_file)) + goto error; + + /* rename the new file on top of the old one */ + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); + if (rename(filename_tmp, filename) != 0) + goto error; + + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = new_queue_file; + udev_queue_export->waste_bytes = 0; + + return 0; + +error: + err(udev_queue_export->udev, "failed to create queue file: %m\n"); + udev_queue_export_cleanup(udev_queue_export); + + if (udev_queue_export->queue_file != NULL) { + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + } + if (new_queue_file != NULL) + fclose(new_queue_file); + + if (devpaths != NULL) + free(devpaths); + udev_queue_export->queued_count = 0; + udev_queue_export->waste_bytes = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + + return -1; +} + +static int write_queue_record(struct udev_queue_export *udev_queue_export, + unsigned long long int seqnum, const char *devpath, size_t devpath_len) +{ + unsigned short len; + + if (udev_queue_export->queue_file == NULL) { + dbg(udev_queue_export->udev, "can't record event: queue file not available\n"); + return -1; + } + + if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1) + goto write_error; + + len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; + if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) + goto write_error; + if (len > 0) { + if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) + goto write_error; + } + + /* *must* flush output; caller may fork */ + if (fflush(udev_queue_export->queue_file) != 0) + goto write_error; + + return 0; + +write_error: + /* if we failed half way through writing a record to a file, + we should not try to write any further records to it. */ + err(udev_queue_export->udev, "error writing to queue file: %m\n"); + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + + return -1; +} + +enum device_state { + DEVICE_QUEUED, + DEVICE_FINISHED, +}; + +static inline size_t queue_record_size(size_t devpath_len) +{ + return sizeof(unsigned long long int) + sizeof(unsigned short int) + devpath_len; +} + +static int update_queue(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + unsigned long long int seqnum = udev_device_get_seqnum(udev_device); + const char *devpath = NULL; + size_t devpath_len = 0; + int bytes; + int err; + + /* FINISHED records have a zero length devpath */ + if (state == DEVICE_QUEUED) { + devpath = udev_device_get_devpath(udev_device); + devpath_len = strlen(devpath); + } + + /* recover from an earlier failed rebuild */ + if (udev_queue_export->queue_file == NULL) { + if (rebuild_queue_file(udev_queue_export) != 0) + return -1; + } + + /* if we're removing the last event from the queue, that's the best time to rebuild it */ + if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1) { + /* we don't need to read the old queue file */ + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + rebuild_queue_file(udev_queue_export); + return 0; + } + + /* try to rebuild the queue files before they grow larger than one page. */ + bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); + if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) + rebuild_queue_file(udev_queue_export); + + /* don't record a finished event, if we already dropped the event in a failed rebuild */ + if (seqnum < udev_queue_export->seqnum_max) + return 0; + + /* now write to the queue */ + if (state == DEVICE_QUEUED) { + udev_queue_export->queued_count++; + udev_queue_export->seqnum_min = seqnum; + } else { + udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0); + udev_queue_export->queued_count--; + } + err = write_queue_record(udev_queue_export, seqnum, devpath, devpath_len); + + /* try to handle ENOSPC */ + if (err != 0 && udev_queue_export->queued_count == 0) { + udev_queue_export_cleanup(udev_queue_export); + err = rebuild_queue_file(udev_queue_export); + } + + return err; +} + +static int update(struct udev_queue_export *udev_queue_export, + struct udev_device *udev_device, enum device_state state) +{ + if (update_queue(udev_queue_export, udev_device, state) != 0) + return -1; + + return 0; +} + +int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_QUEUED); +} + +int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) +{ + return update(udev_queue_export, udev_device, DEVICE_FINISHED); +} diff --git a/src/libudev-queue.c b/src/libudev-queue.c new file mode 100644 index 0000000000..3d46b67d19 --- /dev/null +++ b/src/libudev-queue.c @@ -0,0 +1,474 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * Copyright (C) 2009 Alan Jenkins + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/** + * SECTION:libudev-queue + * @short_description: access to currently active events + * + * The udev daemon processes events asynchronously. All events which do not have + * interdependencies run in parallel. This exports the current state of the + * event processing queue, and the current event sequence numbers from the kernel + * and the udev daemon. + */ + +/** + * udev_queue: + * + * Opaque object representing the current event queue in the udev daemon. + */ +struct udev_queue { + struct udev *udev; + int refcount; + struct udev_list queue_list; +}; + +/** + * udev_queue_new: + * @udev: udev library context + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev queue context. + * + * Returns: the udev queue context, or #NULL on error. + **/ +UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev) +{ + struct udev_queue *udev_queue; + + if (udev == NULL) + return NULL; + + udev_queue = calloc(1, sizeof(struct udev_queue)); + if (udev_queue == NULL) + return NULL; + udev_queue->refcount = 1; + udev_queue->udev = udev; + udev_list_init(udev, &udev_queue->queue_list, false); + return udev_queue; +} + +/** + * udev_queue_ref: + * @udev_queue: udev queue context + * + * Take a reference of a udev queue context. + * + * Returns: the same udev queue context. + **/ +UDEV_EXPORT struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) +{ + if (udev_queue == NULL) + return NULL; + udev_queue->refcount++; + return udev_queue; +} + +/** + * udev_queue_unref: + * @udev_queue: udev queue context + * + * Drop a reference of a udev queue context. If the refcount reaches zero, + * the resources of the queue context will be released. + **/ +UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue) +{ + if (udev_queue == NULL) + return; + udev_queue->refcount--; + if (udev_queue->refcount > 0) + return; + udev_list_cleanup(&udev_queue->queue_list); + free(udev_queue); +} + +/** + * udev_queue_get_udev: + * @udev_queue: udev queue context + * + * Retrieve the udev library context the queue context was created with. + * + * Returns: the udev library context. + **/ +UDEV_EXPORT struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) +{ + if (udev_queue == NULL) + return NULL; + return udev_queue->udev; +} + +unsigned long long int udev_get_kernel_seqnum(struct udev *udev) +{ + char filename[UTIL_PATH_SIZE]; + unsigned long long int seqnum; + int fd; + char buf[32]; + ssize_t len; + + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); + fd = open(filename, O_RDONLY|O_CLOEXEC); + if (fd < 0) + return 0; + len = read(fd, buf, sizeof(buf)); + close(fd); + if (len <= 2) + return 0; + buf[len-1] = '\0'; + seqnum = strtoull(buf, NULL, 10); + return seqnum; +} + +/** + * udev_queue_get_kernel_seqnum: + * @udev_queue: udev queue context + * + * Returns: the current kernel event sequence number. + **/ +UDEV_EXPORT unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum; + + if (udev_queue == NULL) + return -EINVAL; + + seqnum = udev_get_kernel_seqnum(udev_queue->udev); + dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); + return seqnum; +} + +int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum) +{ + if (fread(seqnum, sizeof(unsigned long long int), 1, queue_file) != 1) + return -1; + + return 0; +} + +ssize_t udev_queue_skip_devpath(FILE *queue_file) +{ + unsigned short int len; + + if (fread(&len, sizeof(unsigned short int), 1, queue_file) == 1) { + char devpath[len]; + + /* use fread to skip, fseek might drop buffered data */ + if (fread(devpath, 1, len, queue_file) == len) + return len; + } + + return -1; +} + +ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size) +{ + unsigned short int read_bytes = 0; + unsigned short int len; + + if (fread(&len, sizeof(unsigned short int), 1, queue_file) != 1) + return -1; + + read_bytes = (len < size - 1) ? len : size - 1; + if (fread(devpath, 1, read_bytes, queue_file) != read_bytes) + return -1; + devpath[read_bytes] = '\0'; + + /* if devpath was too long, skip unread characters */ + if (read_bytes != len) { + unsigned short int skip_bytes = len - read_bytes; + char buf[skip_bytes]; + + if (fread(buf, 1, skip_bytes, queue_file) != skip_bytes) + return -1; + } + + return read_bytes; +} + +static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long int *seqnum_start) +{ + char filename[UTIL_PATH_SIZE]; + FILE *queue_file; + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue->udev), "/queue.bin", NULL); + queue_file = fopen(filename, "re"); + if (queue_file == NULL) + return NULL; + + if (udev_queue_read_seqnum(queue_file, seqnum_start) < 0) { + err(udev_queue->udev, "corrupt queue file\n"); + fclose(queue_file); + return NULL; + } + + return queue_file; +} + +/** + * udev_queue_get_udev_seqnum: + * @udev_queue: udev queue context + * + * Returns: the last known udev event sequence number. + **/ +UDEV_EXPORT unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum_udev; + FILE *queue_file; + + queue_file = open_queue_file(udev_queue, &seqnum_udev); + if (queue_file == NULL) + return 0; + + for (;;) { + unsigned long long int seqnum; + ssize_t devpath_len; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + if (devpath_len > 0) + seqnum_udev = seqnum; + } + + fclose(queue_file); + return seqnum_udev; +} + +/** + * udev_queue_get_udev_is_active: + * @udev_queue: udev queue context + * + * Returns: a flag indicating if udev is active. + **/ +UDEV_EXPORT int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum_start; + FILE *queue_file; + + queue_file = open_queue_file(udev_queue, &seqnum_start); + if (queue_file == NULL) + return 0; + + fclose(queue_file); + return 1; +} + +/** + * udev_queue_get_queue_is_empty: + * @udev_queue: udev queue context + * + * Returns: a flag indicating if udev is currently handling events. + **/ +UDEV_EXPORT int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum_kernel; + unsigned long long int seqnum_udev = 0; + int queued = 0; + int is_empty = 0; + FILE *queue_file; + + if (udev_queue == NULL) + return -EINVAL; + queue_file = open_queue_file(udev_queue, &seqnum_udev); + if (queue_file == NULL) + return 1; + + for (;;) { + unsigned long long int seqnum; + ssize_t devpath_len; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + + if (devpath_len > 0) { + queued++; + seqnum_udev = seqnum; + } else { + queued--; + } + } + + if (queued > 0) { + dbg(udev_queue->udev, "queue is not empty\n"); + goto out; + } + + seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); + if (seqnum_udev < seqnum_kernel) { + dbg(udev_queue->udev, "queue is empty but kernel events still pending [%llu]<->[%llu]\n", + seqnum_kernel, seqnum_udev); + goto out; + } + + dbg(udev_queue->udev, "queue is empty\n"); + is_empty = 1; + +out: + fclose(queue_file); + return is_empty; +} + +/** + * udev_queue_get_seqnum_sequence_is_finished: + * @udev_queue: udev queue context + * @start: first event sequence number + * @end: last event sequence number + * + * Returns: a flag indicating if any of the sequence numbers in the given range is currently active. + **/ +UDEV_EXPORT int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, + unsigned long long int start, unsigned long long int end) +{ + unsigned long long int seqnum; + ssize_t devpath_len; + int unfinished; + FILE *queue_file; + + if (udev_queue == NULL) + return -EINVAL; + queue_file = open_queue_file(udev_queue, &seqnum); + if (queue_file == NULL) + return 1; + if (start < seqnum) + start = seqnum; + if (start > end) { + fclose(queue_file); + return 1; + } + if (end - start > INT_MAX - 1) { + fclose(queue_file); + return -EOVERFLOW; + } + + /* + * we might start with 0, and handle the initial seqnum + * only when we find an entry in the queue file + **/ + unfinished = end - start; + + do { + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + + /* + * we might start with an empty or re-build queue file, where + * the initial seqnum is not recorded as finished + */ + if (start == seqnum && devpath_len > 0) + unfinished++; + + if (devpath_len == 0) { + if (seqnum >= start && seqnum <= end) + unfinished--; + } + } while (unfinished > 0); + + fclose(queue_file); + + return (unfinished == 0); +} + +/** + * udev_queue_get_seqnum_is_finished: + * @udev_queue: udev queue context + * @seqnum: sequence number + * + * Returns: a flag indicating if the given sequence number is currently active. + **/ +UDEV_EXPORT int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) +{ + if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) + return 0; + + dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum); + return 1; +} + +/** + * udev_queue_get_queued_list_entry: + * @udev_queue: udev queue context + * + * Returns: the first entry of the list of queued events. + **/ +UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) +{ + unsigned long long int seqnum; + FILE *queue_file; + + if (udev_queue == NULL) + return NULL; + udev_list_cleanup(&udev_queue->queue_list); + + queue_file = open_queue_file(udev_queue, &seqnum); + if (queue_file == NULL) + return NULL; + + for (;;) { + char syspath[UTIL_PATH_SIZE]; + char *s; + size_t l; + ssize_t len; + char seqnum_str[32]; + struct udev_list_entry *list_entry; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + snprintf(seqnum_str, sizeof(seqnum_str), "%llu", seqnum); + + s = syspath; + l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); + len = udev_queue_read_devpath(queue_file, s, l); + if (len < 0) + break; + + if (len > 0) { + udev_list_entry_add(&udev_queue->queue_list, syspath, seqnum_str); + } else { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { + if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { + udev_list_entry_delete(list_entry); + break; + } + } + } + } + fclose(queue_file); + + return udev_list_get_entry(&udev_queue->queue_list); +} + +struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); +UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) +{ + errno = ENOSYS; + return NULL; +} diff --git a/src/libudev-selinux-private.c b/src/libudev-selinux-private.c new file mode 100644 index 0000000000..cb06a280f7 --- /dev/null +++ b/src/libudev-selinux-private.c @@ -0,0 +1,109 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static int selinux_enabled; +security_context_t selinux_prev_scontext; + +void udev_selinux_init(struct udev *udev) +{ + /* record the present security context */ + selinux_enabled = (is_selinux_enabled() > 0); + info(udev, "selinux=%i\n", selinux_enabled); + if (!selinux_enabled) + return; + matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); + if (getfscreatecon(&selinux_prev_scontext) < 0) { + err(udev, "getfscreatecon failed\n"); + selinux_prev_scontext = NULL; + } +} + +void udev_selinux_exit(struct udev *udev) +{ + if (!selinux_enabled) + return; + freecon(selinux_prev_scontext); + selinux_prev_scontext = NULL; +} + +void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) +{ + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (lsetfilecon(file, scontext) < 0) + err(udev, "setfilecon %s failed: %m\n", file); + freecon(scontext); +} + +void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) +{ + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (setfscreatecon(scontext) < 0) + err(udev, "setfscreatecon %s failed: %m\n", file); + freecon(scontext); +} + +void udev_selinux_resetfscreatecon(struct udev *udev) +{ + if (!selinux_enabled) + return; + if (setfscreatecon(selinux_prev_scontext) < 0) + err(udev, "setfscreatecon failed: %m\n"); +} + +void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode) +{ + char filename[UTIL_PATH_SIZE]; + + if (!selinux_enabled) + return; + + /* resolve relative filename */ + if (file[0] != '/') { + char procfd[UTIL_PATH_SIZE]; + char target[UTIL_PATH_SIZE]; + ssize_t len; + + snprintf(procfd, sizeof(procfd), "/proc/%u/fd/%u", getpid(), dfd); + len = readlink(procfd, target, sizeof(target)); + if (len <= 0 || len == sizeof(target)) + return; + target[len] = '\0'; + + util_strscpyl(filename, sizeof(filename), target, "/", file, NULL); + file = filename; + } + udev_selinux_setfscreatecon(udev, file, mode); +} diff --git a/src/libudev-util-private.c b/src/libudev-util-private.c new file mode 100644 index 0000000000..015e6d5862 --- /dev/null +++ b/src/libudev-util-private.c @@ -0,0 +1,242 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2003-2009 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static int create_path(struct udev *udev, const char *path, bool selinux) +{ + char p[UTIL_PATH_SIZE]; + char *pos; + struct stat stats; + int err; + + util_strscpy(p, sizeof(p), path); + pos = strrchr(p, '/'); + if (pos == NULL) + return 0; + while (pos != p && pos[-1] == '/') + pos--; + if (pos == p) + return 0; + pos[0] = '\0'; + + dbg(udev, "stat '%s'\n", p); + if (stat(p, &stats) == 0) { + if ((stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + else + return -ENOTDIR; + } + + err = util_create_path(udev, p); + if (err != 0) + return err; + + dbg(udev, "mkdir '%s'\n", p); + if (selinux) + udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); + err = mkdir(p, 0755); + if (err != 0) { + err = -errno; + if (err == -EEXIST && stat(p, &stats) == 0) { + if ((stats.st_mode & S_IFMT) == S_IFDIR) + err = 0; + else + err = -ENOTDIR; + } + } + if (selinux) + udev_selinux_resetfscreatecon(udev); + return err; +} + +int util_create_path(struct udev *udev, const char *path) +{ + return create_path(udev, path, false); +} + +int util_create_path_selinux(struct udev *udev, const char *path) +{ + return create_path(udev, path, true); +} + +int util_delete_path(struct udev *udev, const char *path) +{ + char p[UTIL_PATH_SIZE]; + char *pos; + int err = 0; + + if (path[0] == '/') + while(path[1] == '/') + path++; + util_strscpy(p, sizeof(p), path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + for (;;) { + *pos = '\0'; + pos = strrchr(p, '/'); + + /* don't remove the last one */ + if ((pos == p) || (pos == NULL)) + break; + + err = rmdir(p); + if (err < 0) { + if (errno == ENOENT) + err = 0; + break; + } + } + return err; +} + +uid_t util_lookup_user(struct udev *udev, const char *user) +{ + char *endptr; + size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char buf[buflen]; + struct passwd pwbuf; + struct passwd *pw; + uid_t uid; + + if (strcmp(user, "root") == 0) + return 0; + uid = strtoul(user, &endptr, 10); + if (endptr[0] == '\0') + return uid; + + errno = getpwnam_r(user, &pwbuf, buf, buflen, &pw); + if (pw != NULL) + return pw->pw_uid; + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err(udev, "specified user '%s' unknown\n", user); + else + err(udev, "error resolving user '%s': %m\n", user); + return 0; +} + +gid_t util_lookup_group(struct udev *udev, const char *group) +{ + char *endptr; + size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX); + char *buf; + struct group grbuf; + struct group *gr; + gid_t gid = 0; + + if (strcmp(group, "root") == 0) + return 0; + gid = strtoul(group, &endptr, 10); + if (endptr[0] == '\0') + return gid; + buf = NULL; + gid = 0; + for (;;) { + char *newbuf; + + newbuf = realloc(buf, buflen); + if (!newbuf) + break; + buf = newbuf; + errno = getgrnam_r(group, &grbuf, buf, buflen, &gr); + if (gr != NULL) { + gid = gr->gr_gid; + } else if (errno == ERANGE) { + buflen *= 2; + continue; + } else if (errno == 0 || errno == ENOENT || errno == ESRCH) { + err(udev, "specified group '%s' unknown\n", group); + } else { + err(udev, "error resolving group '%s': %m\n", group); + } + break; + } + free(buf); + return gid; +} + +/* handle "[/]" format */ +int util_resolve_subsys_kernel(struct udev *udev, const char *string, + char *result, size_t maxsize, int read_value) +{ + char temp[UTIL_PATH_SIZE]; + char *subsys; + char *sysname; + struct udev_device *dev; + char *attr; + + if (string[0] != '[') + return -1; + + util_strscpy(temp, sizeof(temp), string); + + subsys = &temp[1]; + + sysname = strchr(subsys, '/'); + if (sysname == NULL) + return -1; + sysname[0] = '\0'; + sysname = &sysname[1]; + + attr = strchr(sysname, ']'); + if (attr == NULL) + return -1; + attr[0] = '\0'; + attr = &attr[1]; + if (attr[0] == '/') + attr = &attr[1]; + if (attr[0] == '\0') + attr = NULL; + + if (read_value && attr == NULL) + return -1; + + dev = udev_device_new_from_subsystem_sysname(udev, subsys, sysname); + if (dev == NULL) + return -1; + + if (read_value) { + const char *val; + + val = udev_device_get_sysattr_value(dev, attr); + if (val != NULL) + util_strscpy(result, maxsize, val); + else + result[0] = '\0'; + info(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } else { + size_t l; + char *s; + + s = result; + l = util_strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL); + if (attr != NULL) + util_strpcpyl(&s, l, "/", attr, NULL); + info(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } + udev_device_unref(dev); + return 0; +} diff --git a/src/libudev-util.c b/src/libudev-util.c new file mode 100644 index 0000000000..559aa06dc6 --- /dev/null +++ b/src/libudev-util.c @@ -0,0 +1,568 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2011 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/** + * SECTION:libudev-util + * @short_description: utils + */ + +ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) +{ + char path[UTIL_PATH_SIZE]; + char target[UTIL_PATH_SIZE]; + ssize_t len; + const char *pos; + + util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL); + len = readlink(path, target, sizeof(target)); + if (len <= 0 || len == (ssize_t)sizeof(target)) + return -1; + target[len] = '\0'; + pos = strrchr(target, '/'); + if (pos == NULL) + return -1; + pos = &pos[1]; + dbg(udev, "resolved link to: '%s'\n", pos); + return util_strscpy(value, size, pos); +} + +int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) +{ + char link_target[UTIL_PATH_SIZE]; + + ssize_t len; + int i; + int back; + char *base; + + len = readlink(syspath, link_target, sizeof(link_target)); + if (len <= 0 || len == (ssize_t)sizeof(link_target)) + return -1; + link_target[len] = '\0'; + dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target); + + for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) + ; + dbg(udev, "base '%s', tail '%s', back %i\n", syspath, &link_target[back * 3], back); + for (i = 0; i <= back; i++) { + base = strrchr(syspath, '/'); + if (base == NULL) + return -1; + base[0] = '\0'; + } + dbg(udev, "after moving back '%s'\n", syspath); + util_strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL); + return 0; +} + +int util_log_priority(const char *priority) +{ + char *endptr; + int prio; + + prio = strtol(priority, &endptr, 10); + if (endptr[0] == '\0' || isspace(endptr[0])) + return prio; + if (strncmp(priority, "err", 3) == 0) + return LOG_ERR; + if (strncmp(priority, "info", 4) == 0) + return LOG_INFO; + if (strncmp(priority, "debug", 5) == 0) + return LOG_DEBUG; + return 0; +} + +size_t util_path_encode(const char *src, char *dest, size_t size) +{ + size_t i, j; + + for (i = 0, j = 0; src[i] != '\0'; i++) { + if (src[i] == '/') { + if (j+4 >= size) { + j = 0; + break; + } + memcpy(&dest[j], "\\x2f", 4); + j += 4; + } else if (src[i] == '\\') { + if (j+4 >= size) { + j = 0; + break; + } + memcpy(&dest[j], "\\x5c", 4); + j += 4; + } else { + if (j+1 >= size) { + j = 0; + break; + } + dest[j] = src[i]; + j++; + } + } + dest[j] = '\0'; + return j; +} + +size_t util_path_decode(char *s) +{ + size_t i, j; + + for (i = 0, j = 0; s[i] != '\0'; j++) { + if (memcmp(&s[i], "\\x2f", 4) == 0) { + s[j] = '/'; + i += 4; + } else if (memcmp(&s[i], "\\x5c", 4) == 0) { + s[j] = '\\'; + i += 4; + } else { + s[j] = s[i]; + i++; + } + } + s[j] = '\0'; + return j; +} + +void util_remove_trailing_chars(char *path, char c) +{ + size_t len; + + if (path == NULL) + return; + len = strlen(path); + while (len > 0 && path[len-1] == c) + path[--len] = '\0'; +} + +/* + * Concatenates strings. In any case, terminates in _all_ cases with '\0' + * and moves the @dest pointer forward to the added '\0'. Returns the + * remaining size, and 0 if the string was truncated. + */ +size_t util_strpcpy(char **dest, size_t size, const char *src) +{ + size_t len; + + len = strlen(src); + if (len >= size) { + if (size > 1) + *dest = mempcpy(*dest, src, size-1); + size = 0; + *dest[0] = '\0'; + } else { + if (len > 0) { + *dest = mempcpy(*dest, src, len); + size -= len; + } + *dest[0] = '\0'; + } + return size; +} + +/* concatenates list of strings, moves dest forward */ +size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) +{ + va_list va; + + va_start(va, src); + do { + size = util_strpcpy(dest, size, src); + src = va_arg(va, char *); + } while (src != NULL); + va_end(va); + + return size; +} + +/* copies string */ +size_t util_strscpy(char *dest, size_t size, const char *src) +{ + char *s; + + s = dest; + return util_strpcpy(&s, size, src); +} + +/* concatenates list of strings */ +size_t util_strscpyl(char *dest, size_t size, const char *src, ...) +{ + va_list va; + char *s; + + va_start(va, src); + s = dest; + do { + size = util_strpcpy(&s, size, src); + src = va_arg(va, char *); + } while (src != NULL); + va_end(va); + + return size; +} + +/* count of characters used to encode one unicode char */ +static int utf8_encoded_expected_len(const char *str) +{ + unsigned char c = (unsigned char)str[0]; + + if (c < 0x80) + return 1; + if ((c & 0xe0) == 0xc0) + return 2; + if ((c & 0xf0) == 0xe0) + return 3; + if ((c & 0xf8) == 0xf0) + return 4; + if ((c & 0xfc) == 0xf8) + return 5; + if ((c & 0xfe) == 0xfc) + return 6; + return 0; +} + +/* decode one unicode char */ +static int utf8_encoded_to_unichar(const char *str) +{ + int unichar; + int len; + int i; + + len = utf8_encoded_expected_len(str); + switch (len) { + case 1: + return (int)str[0]; + case 2: + unichar = str[0] & 0x1f; + break; + case 3: + unichar = (int)str[0] & 0x0f; + break; + case 4: + unichar = (int)str[0] & 0x07; + break; + case 5: + unichar = (int)str[0] & 0x03; + break; + case 6: + unichar = (int)str[0] & 0x01; + break; + default: + return -1; + } + + for (i = 1; i < len; i++) { + if (((int)str[i] & 0xc0) != 0x80) + return -1; + unichar <<= 6; + unichar |= (int)str[i] & 0x3f; + } + + return unichar; +} + +/* expected size used to encode one unicode char */ +static int utf8_unichar_to_encoded_len(int unichar) +{ + if (unichar < 0x80) + return 1; + if (unichar < 0x800) + return 2; + if (unichar < 0x10000) + return 3; + if (unichar < 0x200000) + return 4; + if (unichar < 0x4000000) + return 5; + return 6; +} + +/* check if unicode char has a valid numeric range */ +static int utf8_unichar_valid_range(int unichar) +{ + if (unichar > 0x10ffff) + return 0; + if ((unichar & 0xfffff800) == 0xd800) + return 0; + if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) + return 0; + if ((unichar & 0xffff) == 0xffff) + return 0; + return 1; +} + +/* validate one encoded unicode char and return its length */ +static int utf8_encoded_valid_unichar(const char *str) +{ + int len; + int unichar; + int i; + + len = utf8_encoded_expected_len(str); + if (len == 0) + return -1; + + /* ascii is valid */ + if (len == 1) + return 1; + + /* check if expected encoded chars are available */ + for (i = 0; i < len; i++) + if ((str[i] & 0x80) != 0x80) + return -1; + + unichar = utf8_encoded_to_unichar(str); + + /* check if encoded length matches encoded value */ + if (utf8_unichar_to_encoded_len(unichar) != len) + return -1; + + /* check if value has valid range */ + if (!utf8_unichar_valid_range(unichar)) + return -1; + + return len; +} + +int util_replace_whitespace(const char *str, char *to, size_t len) +{ + size_t i, j; + + /* strip trailing whitespace */ + len = strnlen(str, len); + while (len && isspace(str[len-1])) + len--; + + /* strip leading whitespace */ + i = 0; + while (isspace(str[i]) && (i < len)) + i++; + + j = 0; + while (i < len) { + /* substitute multiple whitespace with a single '_' */ + if (isspace(str[i])) { + while (isspace(str[i])) + i++; + to[j++] = '_'; + } + to[j++] = str[i++]; + } + to[j] = '\0'; + return 0; +} + +static int is_whitelisted(char c, const char *white) +{ + if ((c >= '0' && c <= '9') || + (c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') || + strchr("#+-.:=@_", c) != NULL || + (white != NULL && strchr(white, c) != NULL)) + return 1; + return 0; +} + +/* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ +int util_replace_chars(char *str, const char *white) +{ + size_t i = 0; + int replaced = 0; + + while (str[i] != '\0') { + int len; + + if (is_whitelisted(str[i], white)) { + i++; + continue; + } + + /* accept hex encoding */ + if (str[i] == '\\' && str[i+1] == 'x') { + i += 2; + continue; + } + + /* accept valid utf8 */ + len = utf8_encoded_valid_unichar(&str[i]); + if (len > 1) { + i += len; + continue; + } + + /* if space is allowed, replace whitespace with ordinary space */ + if (isspace(str[i]) && white != NULL && strchr(white, ' ') != NULL) { + str[i] = ' '; + i++; + replaced++; + continue; + } + + /* everything else is replaced with '_' */ + str[i] = '_'; + i++; + replaced++; + } + return replaced; +} + +/** + * udev_util_encode_string: + * @str: input string to be encoded + * @str_enc: output string to store the encoded input string + * @len: maximum size of the output string, which may be + * four times as long as the input string + * + * Encode all potentially unsafe characters of a string to the + * corresponding 2 char hex value prefixed by '\x'. + * + * Returns: 0 if the entire string was copied, non-zero otherwise. + **/ +UDEV_EXPORT int udev_util_encode_string(const char *str, char *str_enc, size_t len) +{ + size_t i, j; + + if (str == NULL || str_enc == NULL) + return -1; + + for (i = 0, j = 0; str[i] != '\0'; i++) { + int seqlen; + + seqlen = utf8_encoded_valid_unichar(&str[i]); + if (seqlen > 1) { + if (len-j < (size_t)seqlen) + goto err; + memcpy(&str_enc[j], &str[i], seqlen); + j += seqlen; + i += (seqlen-1); + } else if (str[i] == '\\' || !is_whitelisted(str[i], NULL)) { + if (len-j < 4) + goto err; + sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); + j += 4; + } else { + if (len-j < 1) + goto err; + str_enc[j] = str[i]; + j++; + } + } + if (len-j < 1) + goto err; + str_enc[j] = '\0'; + return 0; +err: + return -1; +} + +/* + * http://sites.google.com/site/murmurhash/ + * + * All code is released to the public domain. For business purposes, + * Murmurhash is under the MIT license. + * + */ +static unsigned int murmur_hash2(const char *key, int len, unsigned int seed) +{ + /* + * 'm' and 'r' are mixing constants generated offline. + * They're not really 'magic', they just happen to work well. + */ + const unsigned int m = 0x5bd1e995; + const int r = 24; + + /* initialize the hash to a 'random' value */ + unsigned int h = seed ^ len; + + /* mix 4 bytes at a time into the hash */ + const unsigned char * data = (const unsigned char *)key; + + while(len >= 4) { + unsigned int k = *(unsigned int *)data; + + k *= m; + k ^= k >> r; + k *= m; + h *= m; + h ^= k; + + data += 4; + len -= 4; + } + + /* handle the last few bytes of the input array */ + switch(len) { + case 3: + h ^= data[2] << 16; + case 2: + h ^= data[1] << 8; + case 1: + h ^= data[0]; + h *= m; + }; + + /* do a few final mixes of the hash to ensure the last few bytes are well-incorporated */ + h ^= h >> 13; + h *= m; + h ^= h >> 15; + + return h; +} + +unsigned int util_string_hash32(const char *str) +{ + return murmur_hash2(str, strlen(str), 0); +} + +/* get a bunch of bit numbers out of the hash, and set the bits in our bit field */ +uint64_t util_string_bloom64(const char *str) +{ + uint64_t bits = 0; + unsigned int hash = util_string_hash32(str); + + bits |= 1LLU << (hash & 63); + bits |= 1LLU << ((hash >> 6) & 63); + bits |= 1LLU << ((hash >> 12) & 63); + bits |= 1LLU << ((hash >> 18) & 63); + return bits; +} + +#define USEC_PER_SEC 1000000ULL +#define NSEC_PER_USEC 1000ULL +unsigned long long ts_usec(const struct timespec *ts) +{ + return (unsigned long long) ts->tv_sec * USEC_PER_SEC + + (unsigned long long) ts->tv_nsec / NSEC_PER_USEC; +} + +unsigned long long now_usec(void) +{ + struct timespec ts; + + if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) + return 0; + return ts_usec(&ts); +} diff --git a/src/libudev.c b/src/libudev.c new file mode 100644 index 0000000000..f0f59e3a4d --- /dev/null +++ b/src/libudev.c @@ -0,0 +1,457 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2010 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/** + * SECTION:libudev + * @short_description: libudev context + * + * The context contains the default values read from the udev config file, + * and is passed to all library operations. + */ + +/** + * udev: + * + * Opaque object representing the library context. + */ +struct udev { + int refcount; + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args); + void *userdata; + char *sys_path; + char *dev_path; + char *rules_path[4]; + unsigned long long rules_path_ts[4]; + int rules_path_count; + char *run_path; + struct udev_list properties_list; + int log_priority; +}; + +void udev_log(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, ...) +{ + va_list args; + + va_start(args, format); + udev->log_fn(udev, priority, file, line, fn, format, args); + va_end(args); +} + +static void log_stderr(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args) +{ + fprintf(stderr, "libudev: %s: ", fn); + vfprintf(stderr, format, args); +} + +/** + * udev_get_userdata: + * @udev: udev library context + * + * Retrieve stored data pointer from library context. This might be useful + * to access from callbacks like a custom logging function. + * + * Returns: stored userdata + **/ +UDEV_EXPORT void *udev_get_userdata(struct udev *udev) +{ + if (udev == NULL) + return NULL; + return udev->userdata; +} + +/** + * udev_set_userdata: + * @udev: udev library context + * @userdata: data pointer + * + * Store custom @userdata in the library context. + **/ +UDEV_EXPORT void udev_set_userdata(struct udev *udev, void *userdata) +{ + if (udev == NULL) + return; + udev->userdata = userdata; +} + +static char *set_value(char **s, const char *v) +{ + free(*s); + *s = strdup(v); + util_remove_trailing_chars(*s, '/'); + return *s; +} + +/** + * udev_new: + * + * Create udev library context. This reads the udev configuration + * file, and fills in the default values. + * + * The initial refcount is 1, and needs to be decremented to + * release the resources of the udev library context. + * + * Returns: a new udev library context + **/ +UDEV_EXPORT struct udev *udev_new(void) +{ + struct udev *udev; + const char *env; + char *config_file = NULL; + FILE *f; + + udev = calloc(1, sizeof(struct udev)); + if (udev == NULL) + return NULL; + udev->refcount = 1; + udev->log_fn = log_stderr; + udev->log_priority = LOG_ERR; + udev_list_init(udev, &udev->properties_list, true); + + /* custom config file */ + env = getenv("UDEV_CONFIG_FILE"); + if (env != NULL) { + if (set_value(&config_file, env) == NULL) + goto err; + udev_add_property(udev, "UDEV_CONFIG_FILE", config_file); + } + + /* default config file */ + if (config_file == NULL) + config_file = strdup(SYSCONFDIR "/udev/udev.conf"); + if (config_file == NULL) + goto err; + + f = fopen(config_file, "re"); + if (f != NULL) { + char line[UTIL_LINE_SIZE]; + int line_nr = 0; + + while (fgets(line, sizeof(line), f)) { + size_t len; + char *key; + char *val; + + line_nr++; + + /* find key */ + key = line; + while (isspace(key[0])) + key++; + + /* comment or empty line */ + if (key[0] == '#' || key[0] == '\0') + continue; + + /* split key/value */ + val = strchr(key, '='); + if (val == NULL) { + err(udev, "missing = in '%s'[%i], skip line\n", config_file, line_nr); + continue; + } + val[0] = '\0'; + val++; + + /* find value */ + while (isspace(val[0])) + val++; + + /* terminate key */ + len = strlen(key); + if (len == 0) + continue; + while (isspace(key[len-1])) + len--; + key[len] = '\0'; + + /* terminate value */ + len = strlen(val); + if (len == 0) + continue; + while (isspace(val[len-1])) + len--; + val[len] = '\0'; + + if (len == 0) + continue; + + /* unquote */ + if (val[0] == '"' || val[0] == '\'') { + if (val[len-1] != val[0]) { + err(udev, "inconsistent quoting in '%s'[%i], skip line\n", config_file, line_nr); + continue; + } + val[len-1] = '\0'; + val++; + } + + if (strcmp(key, "udev_log") == 0) { + udev_set_log_priority(udev, util_log_priority(val)); + continue; + } + if (strcmp(key, "udev_root") == 0) { + set_value(&udev->dev_path, val); + continue; + } + if (strcmp(key, "udev_run") == 0) { + set_value(&udev->run_path, val); + continue; + } + if (strcmp(key, "udev_sys") == 0) { + set_value(&udev->sys_path, val); + continue; + } + if (strcmp(key, "udev_rules") == 0) { + set_value(&udev->rules_path[0], val); + udev->rules_path_count = 1; + continue; + } + } + fclose(f); + } + + /* environment overwrites config */ + env = getenv("UDEV_LOG"); + if (env != NULL) + udev_set_log_priority(udev, util_log_priority(env)); + + /* set defaults */ + if (udev->dev_path == NULL) + if (set_value(&udev->dev_path, "/dev") == NULL) + goto err; + + if (udev->sys_path == NULL) + if (set_value(&udev->sys_path, "/sys") == NULL) + goto err; + + if (udev->run_path == NULL) + if (set_value(&udev->run_path, "/run/udev") == NULL) + goto err; + + if (udev->rules_path[0] == NULL) { + /* /usr/lib/udev -- system rules */ + udev->rules_path[0] = strdup(PKGLIBEXECDIR "/rules.d"); + if (!udev->rules_path[0]) + goto err; + + /* /etc/udev -- local administration rules */ + udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d"); + if (!udev->rules_path[1]) + goto err; + + /* /run/udev -- runtime rules */ + if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0) + goto err; + + udev->rules_path_count = 3; + } + + dbg(udev, "context %p created\n", udev); + dbg(udev, "log_priority=%d\n", udev->log_priority); + dbg(udev, "config_file='%s'\n", config_file); + dbg(udev, "dev_path='%s'\n", udev->dev_path); + dbg(udev, "sys_path='%s'\n", udev->sys_path); + dbg(udev, "run_path='%s'\n", udev->run_path); + dbg(udev, "rules_path='%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1], udev->rules_path[2]); + free(config_file); + return udev; +err: + free(config_file); + err(udev, "context creation failed\n"); + udev_unref(udev); + return NULL; +} + +/** + * udev_ref: + * @udev: udev library context + * + * Take a reference of the udev library context. + * + * Returns: the passed udev library context + **/ +UDEV_EXPORT struct udev *udev_ref(struct udev *udev) +{ + if (udev == NULL) + return NULL; + udev->refcount++; + return udev; +} + +/** + * udev_unref: + * @udev: udev library context + * + * Drop a reference of the udev library context. If the refcount + * reaches zero, the resources of the context will be released. + * + **/ +UDEV_EXPORT void udev_unref(struct udev *udev) +{ + if (udev == NULL) + return; + udev->refcount--; + if (udev->refcount > 0) + return; + udev_list_cleanup(&udev->properties_list); + free(udev->dev_path); + free(udev->sys_path); + free(udev->rules_path[0]); + free(udev->rules_path[1]); + free(udev->rules_path[2]); + free(udev->run_path); + dbg(udev, "context %p released\n", udev); + free(udev); +} + +/** + * udev_set_log_fn: + * @udev: udev library context + * @log_fn: function to be called for logging messages + * + * The built-in logging writes to stderr. It can be + * overridden by a custom function, to plug log messages + * into the users' logging functionality. + * + **/ +UDEV_EXPORT void udev_set_log_fn(struct udev *udev, + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args)) +{ + udev->log_fn = log_fn; + info(udev, "custom logging function %p registered\n", log_fn); +} + +/** + * udev_get_log_priority: + * @udev: udev library context + * + * The initial logging priority is read from the udev config file + * at startup. + * + * Returns: the current logging priority + **/ +UDEV_EXPORT int udev_get_log_priority(struct udev *udev) +{ + return udev->log_priority; +} + +/** + * udev_set_log_priority: + * @udev: udev library context + * @priority: the new logging priority + * + * Set the current logging priority. The value controls which messages + * are logged. + **/ +UDEV_EXPORT void udev_set_log_priority(struct udev *udev, int priority) +{ + char num[32]; + + udev->log_priority = priority; + snprintf(num, sizeof(num), "%u", udev->log_priority); + udev_add_property(udev, "UDEV_LOG", num); +} + +int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *stamp_usec[]) +{ + *path = udev->rules_path; + if (stamp_usec) + *stamp_usec = udev->rules_path_ts; + return udev->rules_path_count; +} + +/** + * udev_get_sys_path: + * @udev: udev library context + * + * Retrieve the sysfs mount point. The default is "/sys". For + * testing purposes, it can be overridden with udev_sys= + * in the udev configuration file. + * + * Returns: the sys mount point + **/ +UDEV_EXPORT const char *udev_get_sys_path(struct udev *udev) +{ + if (udev == NULL) + return NULL; + return udev->sys_path; +} + +/** + * udev_get_dev_path: + * @udev: udev library context + * + * Retrieve the device directory path. The default value is "/dev", + * the actual value may be overridden in the udev configuration + * file. + * + * Returns: the device directory path + **/ +UDEV_EXPORT const char *udev_get_dev_path(struct udev *udev) +{ + if (udev == NULL) + return NULL; + return udev->dev_path; +} + +/** + * udev_get_run_path: + * @udev: udev library context + * + * Retrieve the udev runtime directory path. The default is "/run/udev". + * + * Returns: the runtime directory path + **/ +UDEV_EXPORT const char *udev_get_run_path(struct udev *udev) +{ + if (udev == NULL) + return NULL; + return udev->run_path; +} + +struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) +{ + if (value == NULL) { + struct udev_list_entry *list_entry; + + list_entry = udev_get_properties_list_entry(udev); + list_entry = udev_list_entry_get_by_name(list_entry, key); + if (list_entry != NULL) + udev_list_entry_delete(list_entry); + return NULL; + } + return udev_list_entry_add(&udev->properties_list, key, value); +} + +struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) +{ + return udev_list_get_entry(&udev->properties_list); +} diff --git a/src/libudev.h b/src/libudev.h new file mode 100644 index 0000000000..28d7d0a388 --- /dev/null +++ b/src/libudev.h @@ -0,0 +1,189 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008-2011 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#ifndef _LIBUDEV_H_ +#define _LIBUDEV_H_ + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * udev - library context + * + * reads the udev config and system environment + * allows custom logging + */ +struct udev; +struct udev *udev_ref(struct udev *udev); +void udev_unref(struct udev *udev); +struct udev *udev_new(void); +void udev_set_log_fn(struct udev *udev, + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args)); +int udev_get_log_priority(struct udev *udev); +void udev_set_log_priority(struct udev *udev, int priority); +const char *udev_get_sys_path(struct udev *udev); +const char *udev_get_dev_path(struct udev *udev); +const char *udev_get_run_path(struct udev *udev); +void *udev_get_userdata(struct udev *udev); +void udev_set_userdata(struct udev *udev, void *userdata); + +/* + * udev_list + * + * access to libudev generated lists + */ +struct udev_list_entry; +struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry); +struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name); +const char *udev_list_entry_get_name(struct udev_list_entry *list_entry); +const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); +/** + * udev_list_entry_foreach: + * @list_entry: entry to store the current position + * @first_entry: first entry to start with + * + * Helper to iterate over all entries of a list. + */ +#define udev_list_entry_foreach(list_entry, first_entry) \ + for (list_entry = first_entry; \ + list_entry != NULL; \ + list_entry = udev_list_entry_get_next(list_entry)) + +/* + * udev_device + * + * access to sysfs/kernel devices + */ +struct udev_device; +struct udev_device *udev_device_ref(struct udev_device *udev_device); +void udev_device_unref(struct udev_device *udev_device); +struct udev *udev_device_get_udev(struct udev_device *udev_device); +struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath); +struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum); +struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname); +struct udev_device *udev_device_new_from_environment(struct udev *udev); +/* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */ +struct udev_device *udev_device_get_parent(struct udev_device *udev_device); +struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, + const char *subsystem, const char *devtype); +/* retrieve device properties */ +const char *udev_device_get_devpath(struct udev_device *udev_device); +const char *udev_device_get_subsystem(struct udev_device *udev_device); +const char *udev_device_get_devtype(struct udev_device *udev_device); +const char *udev_device_get_syspath(struct udev_device *udev_device); +const char *udev_device_get_sysname(struct udev_device *udev_device); +const char *udev_device_get_sysnum(struct udev_device *udev_device); +const char *udev_device_get_devnode(struct udev_device *udev_device); +int udev_device_get_is_initialized(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device); +struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device); +const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key); +const char *udev_device_get_driver(struct udev_device *udev_device); +dev_t udev_device_get_devnum(struct udev_device *udev_device); +const char *udev_device_get_action(struct udev_device *udev_device); +unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device); +unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device); +const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr); +int udev_device_has_tag(struct udev_device *udev_device, const char *tag); + +/* + * udev_monitor + * + * access to kernel uevents and udev events + */ +struct udev_monitor; +struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor); +void udev_monitor_unref(struct udev_monitor *udev_monitor); +struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor); +/* kernel and udev generated events over netlink */ +struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name); +/* custom socket (use netlink and filters instead) */ +struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path); +/* bind socket */ +int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor); +int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size); +int udev_monitor_get_fd(struct udev_monitor *udev_monitor); +struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); +/* in-kernel socket filters to select messages that get delivered to a listener */ +int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, + const char *subsystem, const char *devtype); +int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag); +int udev_monitor_filter_update(struct udev_monitor *udev_monitor); +int udev_monitor_filter_remove(struct udev_monitor *udev_monitor); + +/* + * udev_enumerate + * + * search sysfs for specific devices and provide a sorted list + */ +struct udev_enumerate; +struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate); +void udev_enumerate_unref(struct udev_enumerate *udev_enumerate); +struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate); +struct udev_enumerate *udev_enumerate_new(struct udev *udev); +/* device properties filter */ +int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); +int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem); +int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); +int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value); +int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value); +int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname); +int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag); +int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent); +int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate); +int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath); +/* run enumeration with active filters */ +int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate); +int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate); +/* return device list */ +struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate); + +/* + * udev_queue + * + * access to the currently running udev events + */ +struct udev_queue; +struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue); +void udev_queue_unref(struct udev_queue *udev_queue); +struct udev *udev_queue_get_udev(struct udev_queue *udev_queue); +struct udev_queue *udev_queue_new(struct udev *udev); +unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue); +unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue); +int udev_queue_get_udev_is_active(struct udev_queue *udev_queue); +int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); +int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum); +int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, + unsigned long long int start, unsigned long long int end); +struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); + +/* + * udev_util + * + * udev specific utilities + */ +int udev_util_encode_string(const char *str, char *str_enc, size_t len); + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif diff --git a/src/libudev.pc.in b/src/libudev.pc.in new file mode 100644 index 0000000000..c9a47fc9b8 --- /dev/null +++ b/src/libudev.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libudev +Description: Library to access udev device information +Version: @VERSION@ +Libs: -L${libdir} -ludev -lrt +Libs.private: +Cflags: -I${includedir} diff --git a/src/sd-daemon.c b/src/sd-daemon.c new file mode 100644 index 0000000000..e68b70875c --- /dev/null +++ b/src/sd-daemon.c @@ -0,0 +1,526 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** + Copyright 2010 Lennart Poettering + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +***/ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(__linux__) +#include +#endif + +#include "sd-daemon.h" + +#if (__GNUC__ >= 4) +#ifdef SD_EXPORT_SYMBOLS +/* Export symbols */ +#define _sd_export_ __attribute__ ((visibility("default"))) +#else +/* Don't export the symbols */ +#define _sd_export_ __attribute__ ((visibility("hidden"))) +#endif +#else +#define _sd_export_ +#endif + +_sd_export_ int sd_listen_fds(int unset_environment) { + +#if defined(DISABLE_SYSTEMD) || !defined(__linux__) + return 0; +#else + int r, fd; + const char *e; + char *p = NULL; + unsigned long l; + + if (!(e = getenv("LISTEN_PID"))) { + r = 0; + goto finish; + } + + errno = 0; + l = strtoul(e, &p, 10); + + if (errno != 0) { + r = -errno; + goto finish; + } + + if (!p || *p || l <= 0) { + r = -EINVAL; + goto finish; + } + + /* Is this for us? */ + if (getpid() != (pid_t) l) { + r = 0; + goto finish; + } + + if (!(e = getenv("LISTEN_FDS"))) { + r = 0; + goto finish; + } + + errno = 0; + l = strtoul(e, &p, 10); + + if (errno != 0) { + r = -errno; + goto finish; + } + + if (!p || *p) { + r = -EINVAL; + goto finish; + } + + for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) { + int flags; + + if ((flags = fcntl(fd, F_GETFD)) < 0) { + r = -errno; + goto finish; + } + + if (flags & FD_CLOEXEC) + continue; + + if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) { + r = -errno; + goto finish; + } + } + + r = (int) l; + +finish: + if (unset_environment) { + unsetenv("LISTEN_PID"); + unsetenv("LISTEN_FDS"); + } + + return r; +#endif +} + +_sd_export_ int sd_is_fifo(int fd, const char *path) { + struct stat st_fd; + + if (fd < 0) + return -EINVAL; + + memset(&st_fd, 0, sizeof(st_fd)); + if (fstat(fd, &st_fd) < 0) + return -errno; + + if (!S_ISFIFO(st_fd.st_mode)) + return 0; + + if (path) { + struct stat st_path; + + memset(&st_path, 0, sizeof(st_path)); + if (stat(path, &st_path) < 0) { + + if (errno == ENOENT || errno == ENOTDIR) + return 0; + + return -errno; + } + + return + st_path.st_dev == st_fd.st_dev && + st_path.st_ino == st_fd.st_ino; + } + + return 1; +} + +_sd_export_ int sd_is_special(int fd, const char *path) { + struct stat st_fd; + + if (fd < 0) + return -EINVAL; + + if (fstat(fd, &st_fd) < 0) + return -errno; + + if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode)) + return 0; + + if (path) { + struct stat st_path; + + if (stat(path, &st_path) < 0) { + + if (errno == ENOENT || errno == ENOTDIR) + return 0; + + return -errno; + } + + if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode)) + return + st_path.st_dev == st_fd.st_dev && + st_path.st_ino == st_fd.st_ino; + else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode)) + return st_path.st_rdev == st_fd.st_rdev; + else + return 0; + } + + return 1; +} + +static int sd_is_socket_internal(int fd, int type, int listening) { + struct stat st_fd; + + if (fd < 0 || type < 0) + return -EINVAL; + + if (fstat(fd, &st_fd) < 0) + return -errno; + + if (!S_ISSOCK(st_fd.st_mode)) + return 0; + + if (type != 0) { + int other_type = 0; + socklen_t l = sizeof(other_type); + + if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0) + return -errno; + + if (l != sizeof(other_type)) + return -EINVAL; + + if (other_type != type) + return 0; + } + + if (listening >= 0) { + int accepting = 0; + socklen_t l = sizeof(accepting); + + if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0) + return -errno; + + if (l != sizeof(accepting)) + return -EINVAL; + + if (!accepting != !listening) + return 0; + } + + return 1; +} + +union sockaddr_union { + struct sockaddr sa; + struct sockaddr_in in4; + struct sockaddr_in6 in6; + struct sockaddr_un un; + struct sockaddr_storage storage; +}; + +_sd_export_ int sd_is_socket(int fd, int family, int type, int listening) { + int r; + + if (family < 0) + return -EINVAL; + + if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) + return r; + + if (family > 0) { + union sockaddr_union sockaddr; + socklen_t l; + + memset(&sockaddr, 0, sizeof(sockaddr)); + l = sizeof(sockaddr); + + if (getsockname(fd, &sockaddr.sa, &l) < 0) + return -errno; + + if (l < sizeof(sa_family_t)) + return -EINVAL; + + return sockaddr.sa.sa_family == family; + } + + return 1; +} + +_sd_export_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { + union sockaddr_union sockaddr; + socklen_t l; + int r; + + if (family != 0 && family != AF_INET && family != AF_INET6) + return -EINVAL; + + if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) + return r; + + memset(&sockaddr, 0, sizeof(sockaddr)); + l = sizeof(sockaddr); + + if (getsockname(fd, &sockaddr.sa, &l) < 0) + return -errno; + + if (l < sizeof(sa_family_t)) + return -EINVAL; + + if (sockaddr.sa.sa_family != AF_INET && + sockaddr.sa.sa_family != AF_INET6) + return 0; + + if (family > 0) + if (sockaddr.sa.sa_family != family) + return 0; + + if (port > 0) { + if (sockaddr.sa.sa_family == AF_INET) { + if (l < sizeof(struct sockaddr_in)) + return -EINVAL; + + return htons(port) == sockaddr.in4.sin_port; + } else { + if (l < sizeof(struct sockaddr_in6)) + return -EINVAL; + + return htons(port) == sockaddr.in6.sin6_port; + } + } + + return 1; +} + +_sd_export_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { + union sockaddr_union sockaddr; + socklen_t l; + int r; + + if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) + return r; + + memset(&sockaddr, 0, sizeof(sockaddr)); + l = sizeof(sockaddr); + + if (getsockname(fd, &sockaddr.sa, &l) < 0) + return -errno; + + if (l < sizeof(sa_family_t)) + return -EINVAL; + + if (sockaddr.sa.sa_family != AF_UNIX) + return 0; + + if (path) { + if (length <= 0) + length = strlen(path); + + if (length <= 0) + /* Unnamed socket */ + return l == offsetof(struct sockaddr_un, sun_path); + + if (path[0]) + /* Normal path socket */ + return + (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) && + memcmp(path, sockaddr.un.sun_path, length+1) == 0; + else + /* Abstract namespace socket */ + return + (l == offsetof(struct sockaddr_un, sun_path) + length) && + memcmp(path, sockaddr.un.sun_path, length) == 0; + } + + return 1; +} + +_sd_export_ int sd_is_mq(int fd, const char *path) { +#if !defined(__linux__) + return 0; +#else + struct mq_attr attr; + + if (fd < 0) + return -EINVAL; + + if (mq_getattr(fd, &attr) < 0) + return -errno; + + if (path) { + char fpath[PATH_MAX]; + struct stat a, b; + + if (path[0] != '/') + return -EINVAL; + + if (fstat(fd, &a) < 0) + return -errno; + + strncpy(stpcpy(fpath, "/dev/mqueue"), path, sizeof(fpath) - 12); + fpath[sizeof(fpath)-1] = 0; + + if (stat(fpath, &b) < 0) + return -errno; + + if (a.st_dev != b.st_dev || + a.st_ino != b.st_ino) + return 0; + } + + return 1; +#endif +} + +_sd_export_ int sd_notify(int unset_environment, const char *state) { +#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) + return 0; +#else + int fd = -1, r; + struct msghdr msghdr; + struct iovec iovec; + union sockaddr_union sockaddr; + const char *e; + + if (!state) { + r = -EINVAL; + goto finish; + } + + if (!(e = getenv("NOTIFY_SOCKET"))) + return 0; + + /* Must be an abstract socket, or an absolute path */ + if ((e[0] != '@' && e[0] != '/') || e[1] == 0) { + r = -EINVAL; + goto finish; + } + + if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) { + r = -errno; + goto finish; + } + + memset(&sockaddr, 0, sizeof(sockaddr)); + sockaddr.sa.sa_family = AF_UNIX; + strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path)); + + if (sockaddr.un.sun_path[0] == '@') + sockaddr.un.sun_path[0] = 0; + + memset(&iovec, 0, sizeof(iovec)); + iovec.iov_base = (char*) state; + iovec.iov_len = strlen(state); + + memset(&msghdr, 0, sizeof(msghdr)); + msghdr.msg_name = &sockaddr; + msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e); + + if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) + msghdr.msg_namelen = sizeof(struct sockaddr_un); + + msghdr.msg_iov = &iovec; + msghdr.msg_iovlen = 1; + + if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { + r = -errno; + goto finish; + } + + r = 1; + +finish: + if (unset_environment) + unsetenv("NOTIFY_SOCKET"); + + if (fd >= 0) + close(fd); + + return r; +#endif +} + +_sd_export_ int sd_notifyf(int unset_environment, const char *format, ...) { +#if defined(DISABLE_SYSTEMD) || !defined(__linux__) + return 0; +#else + va_list ap; + char *p = NULL; + int r; + + va_start(ap, format); + r = vasprintf(&p, format, ap); + va_end(ap); + + if (r < 0 || !p) + return -ENOMEM; + + r = sd_notify(unset_environment, p); + free(p); + + return r; +#endif +} + +_sd_export_ int sd_booted(void) { +#if defined(DISABLE_SYSTEMD) || !defined(__linux__) + return 0; +#else + + struct stat a, b; + + /* We simply test whether the systemd cgroup hierarchy is + * mounted */ + + if (lstat("/sys/fs/cgroup", &a) < 0) + return 0; + + if (lstat("/sys/fs/cgroup/systemd", &b) < 0) + return 0; + + return a.st_dev != b.st_dev; +#endif +} diff --git a/src/sd-daemon.h b/src/sd-daemon.h new file mode 100644 index 0000000000..46dc7fd7e5 --- /dev/null +++ b/src/sd-daemon.h @@ -0,0 +1,277 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +#ifndef foosddaemonhfoo +#define foosddaemonhfoo + +/*** + Copyright 2010 Lennart Poettering + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +***/ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + Reference implementation of a few systemd related interfaces for + writing daemons. These interfaces are trivial to implement. To + simplify porting we provide this reference implementation. + Applications are welcome to reimplement the algorithms described + here if they do not want to include these two source files. + + The following functionality is provided: + + - Support for logging with log levels on stderr + - File descriptor passing for socket-based activation + - Daemon startup and status notification + - Detection of systemd boots + + You may compile this with -DDISABLE_SYSTEMD to disable systemd + support. This makes all those calls NOPs that are directly related to + systemd (i.e. only sd_is_xxx() will stay useful). + + Since this is drop-in code we don't want any of our symbols to be + exported in any case. Hence we declare hidden visibility for all of + them. + + You may find an up-to-date version of these source files online: + + http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h + http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c + + This should compile on non-Linux systems, too, but with the + exception of the sd_is_xxx() calls all functions will become NOPs. + + See sd-daemon(7) for more information. +*/ + +#ifndef _sd_printf_attr_ +#if __GNUC__ >= 4 +#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b))) +#else +#define _sd_printf_attr_(a,b) +#endif +#endif + +/* + Log levels for usage on stderr: + + fprintf(stderr, SD_NOTICE "Hello World!\n"); + + This is similar to printk() usage in the kernel. +*/ +#define SD_EMERG "<0>" /* system is unusable */ +#define SD_ALERT "<1>" /* action must be taken immediately */ +#define SD_CRIT "<2>" /* critical conditions */ +#define SD_ERR "<3>" /* error conditions */ +#define SD_WARNING "<4>" /* warning conditions */ +#define SD_NOTICE "<5>" /* normal but significant condition */ +#define SD_INFO "<6>" /* informational */ +#define SD_DEBUG "<7>" /* debug-level messages */ + +/* The first passed file descriptor is fd 3 */ +#define SD_LISTEN_FDS_START 3 + +/* + Returns how many file descriptors have been passed, or a negative + errno code on failure. Optionally, removes the $LISTEN_FDS and + $LISTEN_PID file descriptors from the environment (recommended, but + problematic in threaded environments). If r is the return value of + this function you'll find the file descriptors passed as fds + SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative + errno style error code on failure. This function call ensures that + the FD_CLOEXEC flag is set for the passed file descriptors, to make + sure they are not passed on to child processes. If FD_CLOEXEC shall + not be set, the caller needs to unset it after this call for all file + descriptors that are used. + + See sd_listen_fds(3) for more information. +*/ +int sd_listen_fds(int unset_environment); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a FIFO in the file system stored under the + specified path, 0 otherwise. If path is NULL a path name check will + not be done and the call only verifies if the file descriptor + refers to a FIFO. Returns a negative errno style error code on + failure. + + See sd_is_fifo(3) for more information. +*/ +int sd_is_fifo(int fd, const char *path); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a special character device on the file + system stored under the specified path, 0 otherwise. + If path is NULL a path name check will not be done and the call + only verifies if the file descriptor refers to a special character. + Returns a negative errno style error code on failure. + + See sd_is_special(3) for more information. +*/ +int sd_is_special(int fd, const char *path); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a socket of the specified family (AF_INET, + ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If + family is 0 a socket family check will not be done. If type is 0 a + socket type check will not be done and the call only verifies if + the file descriptor refers to a socket. If listening is > 0 it is + verified that the socket is in listening mode. (i.e. listen() has + been called) If listening is == 0 it is verified that the socket is + not in listening mode. If listening is < 0 no listening mode check + is done. Returns a negative errno style error code on failure. + + See sd_is_socket(3) for more information. +*/ +int sd_is_socket(int fd, int family, int type, int listening); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is an Internet socket, of the specified family + (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM, + SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version + check is not done. If type is 0 a socket type check will not be + done. If port is 0 a socket port check will not be done. The + listening flag is used the same way as in sd_is_socket(). Returns a + negative errno style error code on failure. + + See sd_is_socket_inet(3) for more information. +*/ +int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is an AF_UNIX socket of the specified type + (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0 + a socket type check will not be done. If path is NULL a socket path + check will not be done. For normal AF_UNIX sockets set length to + 0. For abstract namespace sockets set length to the length of the + socket name (including the initial 0 byte), and pass the full + socket path in path (including the initial 0 byte). The listening + flag is used the same way as in sd_is_socket(). Returns a negative + errno style error code on failure. + + See sd_is_socket_unix(3) for more information. +*/ +int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length); + +/* + Helper call for identifying a passed file descriptor. Returns 1 if + the file descriptor is a POSIX Message Queue of the specified name, + 0 otherwise. If path is NULL a message queue name check is not + done. Returns a negative errno style error code on failure. +*/ +int sd_is_mq(int fd, const char *path); + +/* + Informs systemd about changed daemon state. This takes a number of + newline separated environment-style variable assignments in a + string. The following variables are known: + + READY=1 Tells systemd that daemon startup is finished (only + relevant for services of Type=notify). The passed + argument is a boolean "1" or "0". Since there is + little value in signaling non-readiness the only + value daemons should send is "READY=1". + + STATUS=... Passes a single-line status string back to systemd + that describes the daemon state. This is free-from + and can be used for various purposes: general state + feedback, fsck-like programs could pass completion + percentages and failing programs could pass a human + readable error message. Example: "STATUS=Completed + 66% of file system check..." + + ERRNO=... If a daemon fails, the errno-style error code, + formatted as string. Example: "ERRNO=2" for ENOENT. + + BUSERROR=... If a daemon fails, the D-Bus error-style error + code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut" + + MAINPID=... The main pid of a daemon, in case systemd did not + fork off the process itself. Example: "MAINPID=4711" + + Daemons can choose to send additional variables. However, it is + recommended to prefix variable names not listed above with X_. + + Returns a negative errno-style error code on failure. Returns > 0 + if systemd could be notified, 0 if it couldn't possibly because + systemd is not running. + + Example: When a daemon finished starting up, it could issue this + call to notify systemd about it: + + sd_notify(0, "READY=1"); + + See sd_notifyf() for more complete examples. + + See sd_notify(3) for more information. +*/ +int sd_notify(int unset_environment, const char *state); + +/* + Similar to sd_notify() but takes a format string. + + Example 1: A daemon could send the following after initialization: + + sd_notifyf(0, "READY=1\n" + "STATUS=Processing requests...\n" + "MAINPID=%lu", + (unsigned long) getpid()); + + Example 2: A daemon could send the following shortly before + exiting, on failure: + + sd_notifyf(0, "STATUS=Failed to start up: %s\n" + "ERRNO=%i", + strerror(errno), + errno); + + See sd_notifyf(3) for more information. +*/ +int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3); + +/* + Returns > 0 if the system was booted with systemd. Returns < 0 on + error. Returns 0 if the system was not booted with systemd. Note + that all of the functions above handle non-systemd boots just + fine. You should NOT protect them with a call to this function. Also + note that this function checks whether the system, not the user + session is controlled by systemd. However the functions above work + for both user and system services. + + See sd_booted(3) for more information. +*/ +int sd_booted(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/test-libudev.c b/src/test-libudev.c new file mode 100644 index 0000000000..c325f8eef5 --- /dev/null +++ b/src/test-libudev.c @@ -0,0 +1,501 @@ +/* + * test-libudev + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" + +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + +static void log_fn(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args) +{ + printf("test-libudev: %s %s:%d ", fn, file, line); + vprintf(format, args); +} + +static void print_device(struct udev_device *device) +{ + const char *str; + dev_t devnum; + int count; + struct udev_list_entry *list_entry; + + printf("*** device: %p ***\n", device); + str = udev_device_get_action(device); + if (str != NULL) + printf("action: '%s'\n", str); + + str = udev_device_get_syspath(device); + printf("syspath: '%s'\n", str); + + str = udev_device_get_sysname(device); + printf("sysname: '%s'\n", str); + + str = udev_device_get_sysnum(device); + if (str != NULL) + printf("sysnum: '%s'\n", str); + + str = udev_device_get_devpath(device); + printf("devpath: '%s'\n", str); + + str = udev_device_get_subsystem(device); + if (str != NULL) + printf("subsystem: '%s'\n", str); + + str = udev_device_get_devtype(device); + if (str != NULL) + printf("devtype: '%s'\n", str); + + str = udev_device_get_driver(device); + if (str != NULL) + printf("driver: '%s'\n", str); + + str = udev_device_get_devnode(device); + if (str != NULL) + printf("devname: '%s'\n", str); + + devnum = udev_device_get_devnum(device); + if (major(devnum) > 0) + printf("devnum: %u:%u\n", major(devnum), minor(devnum)); + + count = 0; + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { + printf("link: '%s'\n", udev_list_entry_get_name(list_entry)); + count++; + } + if (count > 0) + printf("found %i links\n", count); + + count = 0; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) { + printf("property: '%s=%s'\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + count++; + } + if (count > 0) + printf("found %i properties\n", count); + + str = udev_device_get_property_value(device, "MAJOR"); + if (str != NULL) + printf("MAJOR: '%s'\n", str); + + str = udev_device_get_sysattr_value(device, "dev"); + if (str != NULL) + printf("attr{dev}: '%s'\n", str); + + printf("\n"); +} + +static int test_device(struct udev *udev, const char *syspath) +{ + struct udev_device *device; + + printf("looking at device: %s\n", syspath); + device = udev_device_new_from_syspath(udev, syspath); + if (device == NULL) { + printf("no device found\n"); + return -1; + } + print_device(device); + udev_device_unref(device); + return 0; +} + +static int test_device_parents(struct udev *udev, const char *syspath) +{ + struct udev_device *device; + struct udev_device *device_parent; + + printf("looking at device: %s\n", syspath); + device = udev_device_new_from_syspath(udev, syspath); + if (device == NULL) + return -1; + + printf("looking at parents\n"); + device_parent = device; + do { + print_device(device_parent); + device_parent = udev_device_get_parent(device_parent); + } while (device_parent != NULL); + + printf("looking at parents again\n"); + device_parent = device; + do { + print_device(device_parent); + device_parent = udev_device_get_parent(device_parent); + } while (device_parent != NULL); + udev_device_unref(device); + + return 0; +} + +static int test_device_devnum(struct udev *udev) +{ + dev_t devnum = makedev(1, 3); + struct udev_device *device; + + printf("looking up device: %u:%u\n", major(devnum), minor(devnum)); + device = udev_device_new_from_devnum(udev, 'c', devnum); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + return 0; +} + +static int test_device_subsys_name(struct udev *udev) +{ + struct udev_device *device; + + printf("looking up device: 'block':'sda'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "block", "sda"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'subsystem':'pci'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "subsystem", "pci"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'drivers':'scsi:sd'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "drivers", "scsi:sd"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'module':'printk'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "module", "printk"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + return 0; +} + +static int test_enumerate_print_list(struct udev_enumerate *enumerate) +{ + struct udev_list_entry *list_entry; + int count = 0; + + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device != NULL) { + printf("device: '%s' (%s)\n", + udev_device_get_syspath(device), + udev_device_get_subsystem(device)); + udev_device_unref(device); + count++; + } + } + printf("found %i devices\n\n", count); + return count; +} + +static int test_monitor(struct udev *udev) +{ + struct udev_monitor *udev_monitor = NULL; + int fd_ep; + int fd_udev = -1; + struct epoll_event ep_udev, ep_stdin; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + printf("error creating epoll fd: %m\n"); + goto out; + } + + udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); + if (udev_monitor == NULL) { + printf("no socket\n"); + goto out; + } + fd_udev = udev_monitor_get_fd(udev_monitor); + + if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "block", NULL) < 0 || + udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL) < 0 || + udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device") < 0) { + printf("filter failed\n"); + goto out; + } + + if (udev_monitor_enable_receiving(udev_monitor) < 0) { + printf("bind failed\n"); + goto out; + } + + memset(&ep_udev, 0, sizeof(struct epoll_event)); + ep_udev.events = EPOLLIN; + ep_udev.data.fd = fd_udev; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { + printf("fail to add fd to epoll: %m\n"); + goto out; + } + + memset(&ep_stdin, 0, sizeof(struct epoll_event)); + ep_stdin.events = EPOLLIN; + ep_stdin.data.fd = STDIN_FILENO; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, STDIN_FILENO, &ep_stdin) < 0) { + printf("fail to add fd to epoll: %m\n"); + goto out; + } + + for (;;) { + int fdcount; + struct epoll_event ev[4]; + struct udev_device *device; + int i; + + printf("waiting for events from udev, press ENTER to exit\n"); + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + printf("epoll fd count: %i\n", fdcount); + + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { + device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) { + printf("no device from socket\n"); + continue; + } + print_device(device); + udev_device_unref(device); + } else if (ev[i].data.fd == STDIN_FILENO && ev[i].events & EPOLLIN) { + printf("exiting loop\n"); + goto out; + } + } + } +out: + if (fd_ep >= 0) + close(fd_ep); + udev_monitor_unref(udev_monitor); + return 0; +} + +static int test_queue(struct udev *udev) +{ + struct udev_queue *udev_queue; + unsigned long long int seqnum; + struct udev_list_entry *list_entry; + + udev_queue = udev_queue_new(udev); + if (udev_queue == NULL) + return -1; + seqnum = udev_queue_get_kernel_seqnum(udev_queue); + printf("seqnum kernel: %llu\n", seqnum); + seqnum = udev_queue_get_udev_seqnum(udev_queue); + printf("seqnum udev : %llu\n", seqnum); + + if (udev_queue_get_queue_is_empty(udev_queue)) + printf("queue is empty\n"); + printf("get queue list\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + printf("\n"); + printf("get queue list again\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + printf("\n"); + + list_entry = udev_queue_get_queued_list_entry(udev_queue); + if (list_entry != NULL) { + printf("event [%llu] is queued\n", seqnum); + seqnum = strtoull(udev_list_entry_get_value(list_entry), NULL, 10); + if (udev_queue_get_seqnum_is_finished(udev_queue, seqnum)) + printf("event [%llu] is not finished\n", seqnum); + else + printf("event [%llu] is finished\n", seqnum); + } + printf("\n"); + udev_queue_unref(udev_queue); + return 0; +} + +static int test_enumerate(struct udev *udev, const char *subsystem) +{ + struct udev_enumerate *udev_enumerate; + + printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'net' + duplicated scan + null + zero\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, "net"); + udev_enumerate_scan_devices(udev_enumerate); + udev_enumerate_scan_devices(udev_enumerate); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'block'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate,"block"); + udev_enumerate_add_match_is_initialized(udev_enumerate); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'not block'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'pci, mem, vc'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, "pci"); + udev_enumerate_add_match_subsystem(udev_enumerate, "mem"); + udev_enumerate_add_match_subsystem(udev_enumerate, "vc"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'subsystem'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_subsystems(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'property IF_FS_*=filesystem'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_property(udev_enumerate, "ID_FS*", "filesystem"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + return 0; +} + +int main(int argc, char *argv[]) +{ + struct udev *udev = NULL; + static const struct option options[] = { + { "syspath", required_argument, NULL, 'p' }, + { "subsystem", required_argument, NULL, 's' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + {} + }; + const char *syspath = "/devices/virtual/mem/null"; + const char *subsystem = NULL; + char path[1024]; + const char *str; + + udev = udev_new(); + printf("context: %p\n", udev); + if (udev == NULL) { + printf("no context\n"); + return 1; + } + udev_set_log_fn(udev, log_fn); + printf("set log: %p\n", log_fn); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "+p:s:dhV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'p': + syspath = optarg; + break; + case 's': + subsystem = optarg; + break; + case 'd': + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + printf("--debug --syspath= --subsystem= --help\n"); + goto out; + case 'V': + printf("%s\n", VERSION); + goto out; + default: + goto out; + } + } + + str = udev_get_sys_path(udev); + printf("sys_path: '%s'\n", str); + str = udev_get_dev_path(udev); + printf("dev_path: '%s'\n", str); + + /* add sys path if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { + snprintf(path, sizeof(path), "%s%s", udev_get_sys_path(udev), syspath); + syspath = path; + } + + test_device(udev, syspath); + test_device_devnum(udev); + test_device_subsys_name(udev); + test_device_parents(udev, syspath); + + test_enumerate(udev, subsystem); + + test_queue(udev); + + test_monitor(udev); +out: + udev_unref(udev); + return 0; +} diff --git a/src/test-udev.c b/src/test-udev.c new file mode 100644 index 0000000000..8d5baf7f54 --- /dev/null +++ b/src/test-udev.c @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +void udev_main_log(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) {} + +int main(int argc, char *argv[]) +{ + struct udev *udev; + struct udev_event *event = NULL; + struct udev_device *dev = NULL; + struct udev_rules *rules = NULL; + char syspath[UTIL_PATH_SIZE]; + const char *devpath; + const char *action; + sigset_t mask, sigmask_orig; + int err = -EINVAL; + + udev = udev_new(); + if (udev == NULL) + exit(1); + info(udev, "version %s\n", VERSION); + udev_selinux_init(udev); + + sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); + + action = argv[1]; + if (action == NULL) { + err(udev, "action missing\n"); + goto out; + } + + devpath = argv[2]; + if (devpath == NULL) { + err(udev, "devpath missing\n"); + goto out; + } + + rules = udev_rules_new(udev, 1); + + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); + dev = udev_device_new_from_syspath(udev, syspath); + if (dev == NULL) { + info(udev, "unknown device '%s'\n", devpath); + goto out; + } + + udev_device_set_action(dev, action); + event = udev_event_new(dev); + + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (event->fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + goto out; + } + + /* do what devtmpfs usually provides us */ + if (udev_device_get_devnode(dev) != NULL) { + mode_t mode; + + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + mode |= S_IFBLK; + else + mode |= S_IFCHR; + + if (strcmp(action, "remove") != 0) { + util_create_path(udev, udev_device_get_devnode(dev)); + mknod(udev_device_get_devnode(dev), mode, udev_device_get_devnum(dev)); + } else { + unlink(udev_device_get_devnode(dev)); + util_delete_path(udev, udev_device_get_devnode(dev)); + } + } + + err = udev_event_execute_rules(event, rules, &sigmask_orig); + if (err == 0) + udev_event_execute_run(event, NULL); +out: + if (event != NULL && event->fd_signal >= 0) + close(event->fd_signal); + udev_event_unref(event); + udev_device_unref(dev); + udev_rules_unref(rules); + udev_selinux_exit(udev); + udev_unref(udev); + if (err != 0) + return 1; + return 0; +} diff --git a/src/udev-builtin-blkid.c b/src/udev-builtin-blkid.c new file mode 100644 index 0000000000..0260c440e2 --- /dev/null +++ b/src/udev-builtin-blkid.c @@ -0,0 +1,207 @@ +/* + * probe disks for filesystems and partitions + * + * Copyright (C) 2011 Kay Sievers + * Copyright (C) 2011 Karel Zak + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static void print_property(struct udev_device *dev, bool test, const char *name, const char *value) +{ + char s[265]; + + s[0] = '\0'; + + if (!strcmp(name, "TYPE")) { + udev_builtin_add_property(dev, test, "ID_FS_TYPE", value); + + } else if (!strcmp(name, "USAGE")) { + udev_builtin_add_property(dev, test, "ID_FS_USAGE", value); + + } else if (!strcmp(name, "VERSION")) { + udev_builtin_add_property(dev, test, "ID_FS_VERSION", value); + + } else if (!strcmp(name, "UUID")) { + blkid_safe_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID", s); + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID_ENC", s); + + } else if (!strcmp(name, "UUID_SUB")) { + blkid_safe_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB", s); + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB_ENC", s); + + } else if (!strcmp(name, "LABEL")) { + blkid_safe_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_LABEL", s); + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_LABEL_ENC", s); + + } else if (!strcmp(name, "PTTYPE")) { + udev_builtin_add_property(dev, test, "ID_PART_TABLE_TYPE", value); + + } else if (!strcmp(name, "PART_ENTRY_NAME")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "PART_ENTRY_NAME", s); + + } else if (!strcmp(name, "PART_ENTRY_TYPE")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "PART_ENTRY_TYPE", s); + + } else if (!strncmp(name, "PART_ENTRY_", 11)) { + util_strscpyl(s, sizeof(s), "ID_", name, NULL); + udev_builtin_add_property(dev, test, name, value); + } +} + +static int probe_superblocks(blkid_probe pr) +{ + struct stat st; + int rc; + + if (fstat(blkid_probe_get_fd(pr), &st)) + return -1; + + blkid_probe_enable_partitions(pr, 1); + + if (!S_ISCHR(st.st_mode) && blkid_probe_get_size(pr) <= 1024 * 1440 && + blkid_probe_is_wholedisk(pr)) { + /* + * check if the small disk is partitioned, if yes then + * don't probe for filesystems. + */ + blkid_probe_enable_superblocks(pr, 0); + + rc = blkid_do_fullprobe(pr); + if (rc < 0) + return rc; /* -1 = error, 1 = nothing, 0 = succes */ + + if (blkid_probe_lookup_value(pr, "PTTYPE", NULL, NULL) == 0) + return 0; /* partition table detected */ + } + + blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); + blkid_probe_enable_superblocks(pr, 1); + + return blkid_do_safeprobe(pr); +} + +static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + int64_t offset = 0; + bool noraid = false; + int fd = -1; + blkid_probe pr; + const char *data; + const char *name; + int nvals; + int i; + size_t len; + int err = 0; + + static const struct option options[] = { + { "offset", optional_argument, NULL, 'o' }, + { "noraid", no_argument, NULL, 'R' }, + {} + }; + + for (;;) { + int option; + + option = getopt_long(argc, argv, "oR", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'o': + offset = strtoull(optarg, NULL, 0); + break; + case 'R': + noraid = true; + break; + } + } + + pr = blkid_new_probe(); + if (!pr) { + err = -ENOMEM; + return EXIT_FAILURE; + } + + blkid_probe_set_superblocks_flags(pr, + BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | + BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE | + BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION); + + if (noraid) + blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID); + + fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC); + if (fd < 0) { + fprintf(stderr, "error: %s: %m\n", udev_device_get_devnode(dev)); + goto out; + } + + err = blkid_probe_set_device(pr, fd, offset, 0); + if (err < 0) + goto out; + + info(udev, "probe %s %sraid offset=%llu\n", + udev_device_get_devnode(dev), + noraid ? "no" : "", (unsigned long long) offset); + + err = probe_superblocks(pr); + if (err < 0) + goto out; + + nvals = blkid_probe_numof_values(pr); + for (i = 0; i < nvals; i++) { + if (blkid_probe_get_value(pr, i, &name, &data, &len)) + continue; + len = strnlen((char *) data, len); + print_property(dev, test, name, (char *) data); + } + + blkid_free_probe(pr); +out: + if (fd > 0) + close(fd); + if (err < 0) + return EXIT_FAILURE; + return EXIT_SUCCESS; +} + +const struct udev_builtin udev_builtin_blkid = { + .name = "blkid", + .cmd = builtin_blkid, + .help = "filesystem and partition probing", + .run_once = true, +}; diff --git a/src/udev-builtin-firmware.c b/src/udev-builtin-firmware.c new file mode 100644 index 0000000000..6d03085af7 --- /dev/null +++ b/src/udev-builtin-firmware.c @@ -0,0 +1,168 @@ +/* + * firmware - Kernel firmware loader + * + * Copyright (C) 2009 Piter Punk + * Copyright (C) 2009-2011 Kay Sievers + * + * 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; either version 2 of the + * License, or (at your option) any later version. + * + * 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:* + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static bool set_loading(struct udev *udev, char *loadpath, const char *state) +{ + FILE *ldfile; + + ldfile = fopen(loadpath, "we"); + if (ldfile == NULL) { + err(udev, "error: can not open '%s'\n", loadpath); + return false; + }; + fprintf(ldfile, "%s\n", state); + fclose(ldfile); + return true; +} + +static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) +{ + char *buf; + FILE *fsource = NULL, *ftarget = NULL; + bool ret = false; + + buf = malloc(size); + if (buf == NULL) { + err(udev,"No memory available to load firmware file"); + return false; + } + + info(udev, "writing '%s' (%zi) to '%s'\n", source, size, target); + + fsource = fopen(source, "re"); + if (fsource == NULL) + goto exit; + ftarget = fopen(target, "we"); + if (ftarget == NULL) + goto exit; + if (fread(buf, size, 1, fsource) != 1) + goto exit; + if (fwrite(buf, size, 1, ftarget) == 1) + ret = true; +exit: + if (ftarget != NULL) + fclose(ftarget); + if (fsource != NULL) + fclose(fsource); + free(buf); + return ret; +} + +static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + static const char *searchpath[] = { FIRMWARE_PATH }; + char fwencpath[UTIL_PATH_SIZE]; + char misspath[UTIL_PATH_SIZE]; + char loadpath[UTIL_PATH_SIZE]; + char datapath[UTIL_PATH_SIZE]; + char fwpath[UTIL_PATH_SIZE]; + const char *firmware; + FILE *fwfile; + struct utsname kernel; + struct stat statbuf; + unsigned int i; + int rc = EXIT_SUCCESS; + + firmware = udev_device_get_property_value(dev, "FIRMWARE"); + if (firmware == NULL) { + err(udev, "firmware parameter missing\n\n"); + rc = EXIT_FAILURE; + goto exit; + } + + /* lookup firmware file */ + uname(&kernel); + for (i = 0; i < ARRAY_SIZE(searchpath); i++) { + util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); + dbg(udev, "trying %s\n", fwpath); + fwfile = fopen(fwpath, "re"); + if (fwfile != NULL) + break; + + util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); + dbg(udev, "trying %s\n", fwpath); + fwfile = fopen(fwpath, "re"); + if (fwfile != NULL) + break; + } + + util_path_encode(firmware, fwencpath, sizeof(fwencpath)); + util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL); + util_strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); + + if (fwfile == NULL) { + int err; + + /* This link indicates the missing firmware file and the associated device */ + info(udev, "did not find firmware file '%s'\n", firmware); + do { + err = util_create_path(udev, misspath); + if (err != 0 && err != -ENOENT) + break; + err = symlink(udev_device_get_devpath(dev), misspath); + if (err != 0) + err = -errno; + } while (err == -ENOENT); + rc = EXIT_FAILURE; + set_loading(udev, loadpath, "-1"); + goto exit; + } + + if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { + rc = EXIT_FAILURE; + goto exit; + } + if (unlink(misspath) == 0) + util_delete_path(udev, misspath); + + if (!set_loading(udev, loadpath, "1")) + goto exit; + + util_strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); + if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { + err(udev, "error sending firmware '%s' to device\n", firmware); + set_loading(udev, loadpath, "-1"); + rc = EXIT_FAILURE; + goto exit; + }; + + set_loading(udev, loadpath, "0"); +exit: + if (fwfile) + fclose(fwfile); + return rc; +} + +const struct udev_builtin udev_builtin_firmware = { + .name = "firmware", + .cmd = builtin_firmware, + .help = "kernel firmware loader", + .run_once = true, +}; diff --git a/src/udev-builtin-hwdb.c b/src/udev-builtin-hwdb.c new file mode 100644 index 0000000000..b6af4b6fcf --- /dev/null +++ b/src/udev-builtin-hwdb.c @@ -0,0 +1,247 @@ +/* + * usb-db, pci-db - lookup vendor/product database + * + * Copyright (C) 2009 Lennart Poettering + * Copyright (C) 2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int get_id_attr( + struct udev_device *parent, + const char *name, + uint16_t *value) { + + const char *t; + unsigned u; + + if (!(t = udev_device_get_sysattr_value(parent, name))) { + fprintf(stderr, "%s lacks %s.\n", udev_device_get_syspath(parent), name); + return -1; + } + + if (!strncmp(t, "0x", 2)) + t += 2; + + if (sscanf(t, "%04x", &u) != 1 || u > 0xFFFFU) { + fprintf(stderr, "Failed to parse %s on %s.\n", name, udev_device_get_syspath(parent)); + return -1; + } + + *value = (uint16_t) u; + return 0; +} + +static int get_vid_pid( + struct udev_device *parent, + const char *vendor_attr, + const char *product_attr, + uint16_t *vid, + uint16_t *pid) { + + if (get_id_attr(parent, vendor_attr, vid) < 0) + return -1; + else if (*vid <= 0) { + fprintf(stderr, "Invalid vendor id.\n"); + return -1; + } + + if (get_id_attr(parent, product_attr, pid) < 0) + return -1; + + return 0; +} + +static void rstrip(char *n) { + size_t i; + + for (i = strlen(n); i > 0 && isspace(n[i-1]); i--) + n[i-1] = 0; +} + +#define HEXCHARS "0123456789abcdefABCDEF" +#define WHITESPACE " \t\n\r" +static int lookup_vid_pid(const char *database, + uint16_t vid, uint16_t pid, + char **vendor, char **product) +{ + + FILE *f; + int ret = -1; + int found_vendor = 0; + char *line = NULL; + + *vendor = *product = NULL; + + if (!(f = fopen(database, "rme"))) { + fprintf(stderr, "Failed to open database file '%s': %s\n", database, strerror(errno)); + return -1; + } + + for (;;) { + size_t n; + + if (getline(&line, &n, f) < 0) + break; + + rstrip(line); + + if (line[0] == '#' || line[0] == 0) + continue; + + if (strspn(line, HEXCHARS) == 4) { + unsigned u; + + if (found_vendor) + break; + + if (sscanf(line, "%04x", &u) == 1 && u == vid) { + char *t; + + t = line+4; + t += strspn(t, WHITESPACE); + + if (!(*vendor = strdup(t))) { + fprintf(stderr, "Out of memory.\n"); + goto finish; + } + + found_vendor = 1; + } + + continue; + } + + if (found_vendor && line[0] == '\t' && strspn(line+1, HEXCHARS) == 4) { + unsigned u; + + if (sscanf(line+1, "%04x", &u) == 1 && u == pid) { + char *t; + + t = line+5; + t += strspn(t, WHITESPACE); + + if (!(*product = strdup(t))) { + fprintf(stderr, "Out of memory.\n"); + goto finish; + } + + break; + } + } + } + + ret = 0; + +finish: + free(line); + fclose(f); + + if (ret < 0) { + free(*product); + free(*vendor); + + *product = *vendor = NULL; + } + + return ret; +} + +static struct udev_device *find_device(struct udev_device *dev, const char *subsys, const char *devtype) +{ + const char *str; + + str = udev_device_get_subsystem(dev); + if (str == NULL) + goto try_parent; + if (strcmp(str, subsys) != 0) + goto try_parent; + + if (devtype != NULL) { + str = udev_device_get_devtype(dev); + if (str == NULL) + goto try_parent; + if (strcmp(str, devtype) != 0) + goto try_parent; + } + return dev; +try_parent: + return udev_device_get_parent_with_subsystem_devtype(dev, subsys, devtype); +} + + +static int builtin_db(struct udev_device *dev, bool test, + const char *database, + const char *vendor_attr, const char *product_attr, + const char *subsys, const char *devtype) +{ + struct udev_device *parent; + uint16_t vid = 0, pid = 0; + char *vendor = NULL, *product = NULL; + + parent = find_device(dev, subsys, devtype); + if (!parent) { + fprintf(stderr, "Failed to find device.\n"); + goto finish; + } + + if (get_vid_pid(parent, vendor_attr, product_attr, &vid, &pid) < 0) + goto finish; + + if (lookup_vid_pid(database, vid, pid, &vendor, &product) < 0) + goto finish; + + if (vendor) + udev_builtin_add_property(dev, test, "ID_VENDOR_FROM_DATABASE", vendor); + if (product) + udev_builtin_add_property(dev, test, "ID_MODEL_FROM_DATABASE", product); + +finish: + free(vendor); + free(product); + return 0; +} + +static int builtin_usb_db(struct udev_device *dev, int argc, char *argv[], bool test) +{ + return builtin_db(dev, test, USB_DATABASE, "idVendor", "idProduct", "usb", "usb_device"); +} + +static int builtin_pci_db(struct udev_device *dev, int argc, char *argv[], bool test) +{ + return builtin_db(dev, test, PCI_DATABASE, "vendor", "device", "pci", NULL); +} + +const struct udev_builtin udev_builtin_usb_db = { + .name = "usb-db", + .cmd = builtin_usb_db, + .help = "USB vendor/product database", + .run_once = true, +}; + +const struct udev_builtin udev_builtin_pci_db = { + .name = "pci-db", + .cmd = builtin_pci_db, + .help = "PCI vendor/product database", + .run_once = true, +}; diff --git a/src/udev-builtin-input_id.c b/src/udev-builtin-input_id.c new file mode 100644 index 0000000000..c0c4270256 --- /dev/null +++ b/src/udev-builtin-input_id.c @@ -0,0 +1,218 @@ +/* + * compose persistent device path + * + * Copyright (C) 2009 Martin Pitt + * Portions Copyright (C) 2004 David Zeuthen, + * Copyright (C) 2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +/* we must use this kernel-compatible implementation */ +#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<> OFF(bit)) & 1) + +/* + * Read a capability attribute and return bitmask. + * @param dev udev_device + * @param attr sysfs attribute name (e. g. "capabilities/key") + * @param bitmask: Output array which has a sizeof of bitmask_size + */ +static void get_cap_mask(struct udev_device *dev, + struct udev_device *pdev, const char* attr, + unsigned long *bitmask, size_t bitmask_size, + bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + char text[4096]; + unsigned i; + char* word; + unsigned long val; + + snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(pdev, attr)); + info(udev, "%s raw kernel attribute: %s\n", attr, text); + + memset (bitmask, 0, bitmask_size); + i = 0; + while ((word = strrchr(text, ' ')) != NULL) { + val = strtoul (word+1, NULL, 16); + if (i < bitmask_size/sizeof(unsigned long)) + bitmask[i] = val; + else + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); + *word = '\0'; + ++i; + } + val = strtoul (text, NULL, 16); + if (i < bitmask_size / sizeof(unsigned long)) + bitmask[i] = val; + else + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); + + if (test) { + /* printf pattern with the right unsigned long number of hex chars */ + snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long)); + info(udev, "%s decoded bit map:\n", attr); + val = bitmask_size / sizeof (unsigned long); + /* skip over leading zeros */ + while (bitmask[val-1] == 0 && val > 0) + --val; + for (i = 0; i < val; ++i) + info(udev, text, i * BITS_PER_LONG, bitmask[i]); + } +} + +/* pointer devices */ +static void test_pointers (struct udev_device *dev, + const unsigned long* bitmask_ev, + const unsigned long* bitmask_abs, + const unsigned long* bitmask_key, + const unsigned long* bitmask_rel, + bool test) +{ + int is_mouse = 0; + int is_touchpad = 0; + + if (!test_bit (EV_KEY, bitmask_ev)) { + if (test_bit (EV_ABS, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && + test_bit (ABS_Y, bitmask_abs) && + test_bit (ABS_Z, bitmask_abs)) + udev_builtin_add_property(dev, test, "ID_INPUT_ACCELEROMETER", "1"); + return; + } + + if (test_bit (EV_ABS, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { + if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_TABLET", "1"); + else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) + is_touchpad = 1; + else if (test_bit (BTN_TRIGGER, bitmask_key) || + test_bit (BTN_A, bitmask_key) || + test_bit (BTN_1, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_JOYSTICK", "1"); + else if (test_bit (BTN_MOUSE, bitmask_key)) + /* This path is taken by VMware's USB mouse, which has + * absolute axes, but no touch/pressure button. */ + is_mouse = 1; + else if (test_bit (BTN_TOUCH, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHSCREEN", "1"); + } + + if (test_bit (EV_REL, bitmask_ev) && + test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && + test_bit (BTN_MOUSE, bitmask_key)) + is_mouse = 1; + + if (is_mouse) + udev_builtin_add_property(dev, test, "ID_INPUT_MOUSE", "1"); + if (is_touchpad) + udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHPAD", "1"); +} + +/* key like devices */ +static void test_key (struct udev_device *dev, + const unsigned long* bitmask_ev, + const unsigned long* bitmask_key, + bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + unsigned i; + unsigned long found; + unsigned long mask; + + /* do we have any KEY_* capability? */ + if (!test_bit (EV_KEY, bitmask_ev)) { + info(udev, "test_key: no EV_KEY capability\n"); + return; + } + + /* only consider KEY_* here, not BTN_* */ + found = 0; + for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) { + found |= bitmask_key[i]; + info(udev, "test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); + } + /* If there are no keys in the lower block, check the higher block */ + if (!found) { + for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) { + if (test_bit (i, bitmask_key)) { + info(udev, "test_key: Found key %x in high block\n", i); + found = 1; + break; + } + } + } + + if (found > 0) + udev_builtin_add_property(dev, test, "ID_INPUT_KEY", "1"); + + /* the first 32 bits are ESC, numbers, and Q to D; if we have all of + * those, consider it a full keyboard; do not test KEY_RESERVED, though */ + mask = 0xFFFFFFFE; + if ((bitmask_key[0] & mask) == mask) + udev_builtin_add_property(dev, test, "ID_INPUT_KEYBOARD", "1"); +} + +static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], bool test) +{ + struct udev_device *pdev; + unsigned long bitmask_ev[NBITS(EV_MAX)]; + unsigned long bitmask_abs[NBITS(ABS_MAX)]; + unsigned long bitmask_key[NBITS(KEY_MAX)]; + unsigned long bitmask_rel[NBITS(REL_MAX)]; + + /* walk up the parental chain until we find the real input device; the + * argument is very likely a subdevice of this, like eventN */ + pdev = dev; + while (pdev != NULL && udev_device_get_sysattr_value(pdev, "capabilities/ev") == NULL) + pdev = udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); + + /* not an "input" class device */ + if (pdev == NULL) + return EXIT_SUCCESS; + + /* Use this as a flag that input devices were detected, so that this + * program doesn't need to be called more than once per device */ + udev_builtin_add_property(dev, test, "ID_INPUT", "1"); + get_cap_mask(dev, pdev, "capabilities/ev", bitmask_ev, sizeof(bitmask_ev), test); + get_cap_mask(dev, pdev, "capabilities/abs", bitmask_abs, sizeof(bitmask_abs), test); + get_cap_mask(dev, pdev, "capabilities/rel", bitmask_rel, sizeof(bitmask_rel), test); + get_cap_mask(dev, pdev, "capabilities/key", bitmask_key, sizeof(bitmask_key), test); + test_pointers(dev, bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel, test); + test_key(dev, bitmask_ev, bitmask_key, test); + return EXIT_SUCCESS; +} + +const struct udev_builtin udev_builtin_input_id = { + .name = "input_id", + .cmd = builtin_input_id, + .help = "input device properties", +}; diff --git a/src/udev-builtin-kmod.c b/src/udev-builtin-kmod.c new file mode 100644 index 0000000000..6719432c08 --- /dev/null +++ b/src/udev-builtin-kmod.c @@ -0,0 +1,146 @@ +/* + * load kernel modules + * + * Copyright (C) 2011 Kay Sievers + * Copyright (C) 2011 ProFUSION embedded systems + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static struct kmod_ctx *ctx; + +static int load_module(struct udev *udev, const char *alias) +{ + struct kmod_list *list = NULL; + struct kmod_list *listb = NULL; + struct kmod_list *l; + int err; + + err = kmod_module_new_from_lookup(ctx, alias, &list); + if (err < 0) + return err; + + err = kmod_module_get_filtered_blacklist(ctx, list, &listb); + if (err < 0) + return err; + + if (list == NULL) + info(udev, "no module matches '%s'\n", alias); + + kmod_list_foreach(l, listb) { + struct kmod_module *mod = kmod_module_get_module(l); + + err = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL); + if (err >=0 ) + info(udev, "inserted '%s'\n", kmod_module_get_name(mod)); + else + info(udev, "failed to insert '%s'\n", kmod_module_get_name(mod)); + + kmod_module_unref(mod); + } + + kmod_module_unref_list(list); + kmod_module_unref_list(listb); + return err; +} + +static void udev_kmod_log(void *data, int priority, const char *file, int line, + const char *fn, const char *format, va_list args) +{ + udev_main_log(data, priority, file, line, fn, format, args); +} + +/* needs to re-instantiate the context after a reload */ +static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) +{ + struct udev *udev = udev_device_get_udev(dev); + int i; + + if (!ctx) { + ctx = kmod_new(NULL, NULL); + if (!ctx) + return -ENOMEM; + + info(udev, "load module index\n"); + kmod_set_log_fn(ctx, udev_kmod_log, udev); + kmod_load_resources(ctx); + } + + if (argc < 3 || strcmp(argv[1], "load")) { + err(udev, "expect: %s load \n", argv[0]); + return EXIT_FAILURE; + } + + for (i = 2; argv[i]; i++) { + info(udev, "execute '%s' '%s'\n", argv[1], argv[i]); + load_module(udev, argv[i]); + } + + return EXIT_SUCCESS; +} + +/* called at udev startup */ +static int builtin_kmod_init(struct udev *udev) +{ + if (ctx) + return 0; + + ctx = kmod_new(NULL, NULL); + if (!ctx) + return -ENOMEM; + + info(udev, "load module index\n"); + kmod_set_log_fn(ctx, udev_kmod_log, udev); + kmod_load_resources(ctx); + return 0; +} + +/* called on udev shutdown and reload request */ +static void builtin_kmod_exit(struct udev *udev) +{ + info(udev, "unload module index\n"); + ctx = kmod_unref(ctx); +} + +/* called every couple of seconds during event activity; 'true' if config has changed */ +static bool builtin_kmod_validate(struct udev *udev) +{ + info(udev, "validate module index\n"); + if (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK) + return true; + return false; +} + +const struct udev_builtin udev_builtin_kmod = { + .name = "kmod", + .cmd = builtin_kmod, + .init = builtin_kmod_init, + .exit = builtin_kmod_exit, + .validate = builtin_kmod_validate, + .help = "kernel module loader", + .run_once = false, +}; diff --git a/src/udev-builtin-path_id.c b/src/udev-builtin-path_id.c new file mode 100644 index 0000000000..049e89b277 --- /dev/null +++ b/src/udev-builtin-path_id.c @@ -0,0 +1,487 @@ +/* + * compose persistent device path + * + * Copyright (C) 2009-2011 Kay Sievers + * + * Logic based on Hannes Reinecke's shell script. + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int path_prepend(char **path, const char *fmt, ...) +{ + va_list va; + char *pre; + int err = 0; + + va_start(va, fmt); + err = vasprintf(&pre, fmt, va); + va_end(va); + if (err < 0) + goto out; + + if (*path != NULL) { + char *new; + + err = asprintf(&new, "%s-%s", pre, *path); + free(pre); + if (err < 0) + goto out; + free(*path); + *path = new; + } else { + *path = pre; + } +out: + return err; +} + +/* +** Linux only supports 32 bit luns. +** See drivers/scsi/scsi_scan.c::scsilun_to_int() for more details. +*/ +static int format_lun_number(struct udev_device *dev, char **path) +{ + unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10); + + /* address method 0, peripheral device addressing with bus id of zero */ + if (lun < 256) + return path_prepend(path, "lun-%d", lun); + /* handle all other lun addressing methods by using a variant of the original lun format */ + return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff); +} + +static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) +{ + struct udev_device *parent = dev; + + while (parent != NULL) { + const char *subsystem; + + subsystem = udev_device_get_subsystem(parent); + if (subsystem == NULL || strcmp(subsystem, subsys) != 0) + break; + dev = parent; + parent = udev_device_get_parent(parent); + } + return dev; +} + +static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) +{ + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *targetdev; + struct udev_device *fcdev = NULL; + const char *port; + char *lun = NULL;; + + targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); + if (targetdev == NULL) + return NULL; + + fcdev = udev_device_new_from_subsystem_sysname(udev, "fc_transport", udev_device_get_sysname(targetdev)); + if (fcdev == NULL) + return NULL; + port = udev_device_get_sysattr_value(fcdev, "port_name"); + if (port == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "fc-%s-%s", port, lun); + if (lun) + free(lun); +out: + udev_device_unref(fcdev); + return parent; +} + +static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) +{ + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *targetdev; + struct udev_device *target_parent; + struct udev_device *sasdev; + const char *sas_address; + char *lun = NULL; + + targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); + if (targetdev == NULL) + return NULL; + + target_parent = udev_device_get_parent(targetdev); + if (target_parent == NULL) + return NULL; + + sasdev = udev_device_new_from_subsystem_sysname(udev, "sas_device", + udev_device_get_sysname(target_parent)); + if (sasdev == NULL) + return NULL; + + sas_address = udev_device_get_sysattr_value(sasdev, "sas_address"); + if (sas_address == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "sas-%s-%s", sas_address, lun); + if (lun) + free(lun); +out: + udev_device_unref(sasdev); + return parent; +} + +static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) +{ + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *transportdev; + struct udev_device *sessiondev = NULL; + const char *target; + char *connname; + struct udev_device *conndev = NULL; + const char *addr; + const char *port; + char *lun = NULL; + + /* find iscsi session */ + transportdev = parent; + for (;;) { + transportdev = udev_device_get_parent(transportdev); + if (transportdev == NULL) + return NULL; + if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0) + break; + } + + /* find iscsi session device */ + sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev)); + if (sessiondev == NULL) + return NULL; + target = udev_device_get_sysattr_value(sessiondev, "targetname"); + if (target == NULL) { + parent = NULL; + goto out; + } + + if (asprintf(&connname, "connection%s:0", udev_device_get_sysnum(transportdev)) < 0) { + parent = NULL; + goto out; + } + conndev = udev_device_new_from_subsystem_sysname(udev, "iscsi_connection", connname); + free(connname); + if (conndev == NULL) { + parent = NULL; + goto out; + } + addr = udev_device_get_sysattr_value(conndev, "persistent_address"); + port = udev_device_get_sysattr_value(conndev, "persistent_port"); + if (addr == NULL || port == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun); + if (lun) + free(lun); +out: + udev_device_unref(sessiondev); + udev_device_unref(conndev); + return parent; +} + +static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path) +{ + struct udev_device *hostdev; + int host, bus, target, lun; + const char *name; + char *base; + char *pos; + DIR *dir; + struct dirent *dent; + int basenum; + + hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host"); + if (hostdev == NULL) + return NULL; + + name = udev_device_get_sysname(parent); + if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) + return NULL; + + /* rebase host offset to get the local relative number */ + basenum = -1; + base = strdup(udev_device_get_syspath(hostdev)); + if (base == NULL) + return NULL; + pos = strrchr(base, '/'); + if (pos == NULL) { + parent = NULL; + goto out; + } + pos[0] = '\0'; + dir = opendir(base); + if (dir == NULL) { + parent = NULL; + goto out; + } + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char *rest; + int i; + + if (dent->d_name[0] == '.') + continue; + if (dent->d_type != DT_DIR && dent->d_type != DT_LNK) + continue; + if (strncmp(dent->d_name, "host", 4) != 0) + continue; + i = strtoul(&dent->d_name[4], &rest, 10); + if (rest[0] != '\0') + continue; + if (basenum == -1 || i < basenum) + basenum = i; + } + closedir(dir); + if (basenum == -1) { + parent = NULL; + goto out; + } + host -= basenum; + + path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun); +out: + free(base); + return hostdev; +} + +static struct udev_device *handle_scsi(struct udev_device *parent, char **path) +{ + const char *devtype; + const char *name; + const char *id; + + devtype = udev_device_get_devtype(parent); + if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) + return parent; + + /* firewire */ + id = udev_device_get_sysattr_value(parent, "ieee1394_id"); + if (id != NULL) { + parent = skip_subsystem(parent, "scsi"); + path_prepend(path, "ieee1394-0x%s", id); + goto out; + } + + /* lousy scsi sysfs does not have a "subsystem" for the transport */ + name = udev_device_get_syspath(parent); + + if (strstr(name, "/rport-") != NULL) { + parent = handle_scsi_fibre_channel(parent, path); + goto out; + } + + if (strstr(name, "/end_device-") != NULL) { + parent = handle_scsi_sas(parent, path); + goto out; + } + + if (strstr(name, "/session") != NULL) { + parent = handle_scsi_iscsi(parent, path); + goto out; + } + + parent = handle_scsi_default(parent, path); +out: + return parent; +} + +static void handle_scsi_tape(struct udev_device *dev, char **path) +{ + const char *name; + + /* must be the last device in the syspath */ + if (*path != NULL) + return; + + name = udev_device_get_sysname(dev); + if (strncmp(name, "nst", 3) == 0 && strchr("lma", name[3]) != NULL) + path_prepend(path, "nst%c", name[3]); + else if (strncmp(name, "st", 2) == 0 && strchr("lma", name[2]) != NULL) + path_prepend(path, "st%c", name[2]); +} + +static struct udev_device *handle_usb(struct udev_device *parent, char **path) +{ + const char *devtype; + const char *str; + const char *port; + + devtype = udev_device_get_devtype(parent); + if (devtype == NULL) + return parent; + if (strcmp(devtype, "usb_interface") != 0 && strcmp(devtype, "usb_device") != 0) + return parent; + + str = udev_device_get_sysname(parent); + port = strchr(str, '-'); + if (port == NULL) + return parent; + port++; + + parent = skip_subsystem(parent, "usb"); + path_prepend(path, "usb-0:%s", port); + return parent; +} + +static struct udev_device *handle_cciss(struct udev_device *parent, char **path) +{ + return NULL; +} + +static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) +{ + struct udev_device *scsi_dev; + + scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); + if (scsi_dev != NULL) { + const char *wwpn; + const char *lun; + const char *hba_id; + + hba_id = udev_device_get_sysattr_value(scsi_dev, "hba_id"); + wwpn = udev_device_get_sysattr_value(scsi_dev, "wwpn"); + lun = udev_device_get_sysattr_value(scsi_dev, "fcp_lun"); + if (hba_id != NULL && lun != NULL && wwpn != NULL) { + path_prepend(path, "ccw-%s-zfcp-%s:%s", hba_id, wwpn, lun); + goto out; + } + } + + path_prepend(path, "ccw-%s", udev_device_get_sysname(parent)); +out: + parent = skip_subsystem(parent, "ccw"); + return parent; +} + +static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool test) +{ + struct udev_device *parent; + char *path = NULL; + + /* S390 ccw bus */ + parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); + if (parent != NULL) { + handle_ccw(parent, dev, &path); + goto out; + } + + /* walk up the chain of devices and compose path */ + parent = dev; + while (parent != NULL) { + const char *subsys; + + subsys = udev_device_get_subsystem(parent); + if (subsys == NULL) { + ; + } else if (strcmp(subsys, "scsi_tape") == 0) { + handle_scsi_tape(parent, &path); + } else if (strcmp(subsys, "scsi") == 0) { + parent = handle_scsi(parent, &path); + } else if (strcmp(subsys, "cciss") == 0) { + handle_cciss(parent, &path); + } else if (strcmp(subsys, "usb") == 0) { + parent = handle_usb(parent, &path); + } else if (strcmp(subsys, "serio") == 0) { + path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); + parent = skip_subsystem(parent, "serio"); + } else if (strcmp(subsys, "pci") == 0) { + path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "pci"); + } else if (strcmp(subsys, "platform") == 0) { + path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "platform"); + } else if (strcmp(subsys, "acpi") == 0) { + path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "acpi"); + } else if (strcmp(subsys, "xen") == 0) { + path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "xen"); + } else if (strcmp(subsys, "virtio") == 0) { + path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "virtio"); + } + + parent = udev_device_get_parent(parent); + } +out: + if (path != NULL) { + char tag[UTIL_NAME_SIZE]; + size_t i; + const char *p; + + /* compose valid udev tag name */ + for (p = path, i = 0; *p; p++) { + if ((*p >= '0' && *p <= '9') || + (*p >= 'A' && *p <= 'Z') || + (*p >= 'a' && *p <= 'z') || + *p == '-') { + tag[i++] = *p; + continue; + } + + /* skip all leading '_' */ + if (i == 0) + continue; + + /* avoid second '_' */ + if (tag[i-1] == '_') + continue; + + tag[i++] = '_'; + } + /* strip trailing '_' */ + while (i > 0 && tag[i-1] == '_') + i--; + tag[i] = '\0'; + + udev_builtin_add_property(dev, test, "ID_PATH", path); + udev_builtin_add_property(dev, test, "ID_PATH_TAG", tag); + free(path); + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} + +const struct udev_builtin udev_builtin_path_id = { + .name = "path_id", + .cmd = builtin_path_id, + .help = "compose persistent device path", + .run_once = true, +}; diff --git a/src/udev-builtin-usb_id.c b/src/udev-builtin-usb_id.c new file mode 100644 index 0000000000..21c3c03d8a --- /dev/null +++ b/src/udev-builtin-usb_id.c @@ -0,0 +1,482 @@ +/* + * USB device properties and persistent device path + * + * Copyright (c) 2005 SUSE Linux Products GmbH, Germany + * Author: Hannes Reinecke + * + * Copyright (C) 2005-2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static void set_usb_iftype(char *to, int if_class_num, size_t len) +{ + char *type = "generic"; + + switch (if_class_num) { + case 1: + type = "audio"; + break; + case 2: /* CDC-Control */ + break; + case 3: + type = "hid"; + break; + case 5: /* Physical */ + break; + case 6: + type = "media"; + break; + case 7: + type = "printer"; + break; + case 8: + type = "storage"; + break; + case 9: + type = "hub"; + break; + case 0x0a: /* CDC-Data */ + break; + case 0x0b: /* Chip/Smart Card */ + break; + case 0x0d: /* Content Security */ + break; + case 0x0e: + type = "video"; + break; + case 0xdc: /* Diagnostic Device */ + break; + case 0xe0: /* Wireless Controller */ + break; + case 0xfe: /* Application-specific */ + break; + case 0xff: /* Vendor-specific */ + break; + default: + break; + } + strncpy(to, type, len); + to[len-1] = '\0'; +} + +static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len) +{ + int type_num = 0; + char *eptr; + char *type = "generic"; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 2: + type = "atapi"; + break; + case 3: + type = "tape"; + break; + case 4: /* UFI */ + case 5: /* SFF-8070i */ + type = "floppy"; + break; + case 1: /* RBC devices */ + type = "rbc"; + break; + case 6: /* Transparent SPC-2 devices */ + type = "scsi"; + break; + default: + break; + } + } + util_strscpy(to, len, type); + return type_num; +} + +static void set_scsi_type(char *to, const char *from, size_t len) +{ + int type_num; + char *eptr; + char *type = "generic"; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 0: + case 0xe: + type = "disk"; + break; + case 1: + type = "tape"; + break; + case 4: + case 7: + case 0xf: + type = "optical"; + break; + case 5: + type = "cd"; + break; + default: + break; + } + } + util_strscpy(to, len, type); +} + +#define USB_DT_DEVICE 0x01 +#define USB_DT_INTERFACE 0x04 + +static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len) +{ + char *filename = NULL; + int fd; + ssize_t size; + unsigned char buf[18 + 65535]; + unsigned int pos, strpos; + struct usb_interface_descriptor { + u_int8_t bLength; + u_int8_t bDescriptorType; + u_int8_t bInterfaceNumber; + u_int8_t bAlternateSetting; + u_int8_t bNumEndpoints; + u_int8_t bInterfaceClass; + u_int8_t bInterfaceSubClass; + u_int8_t bInterfaceProtocol; + u_int8_t iInterface; + } __attribute__((packed)); + int err = 0; + + if (asprintf(&filename, "%s/descriptors", udev_device_get_syspath(dev)) < 0) { + err = -1; + goto out; + } + fd = open(filename, O_RDONLY|O_CLOEXEC); + if (fd < 0) { + fprintf(stderr, "error opening USB device 'descriptors' file\n"); + err = -1; + goto out; + } + size = read(fd, buf, sizeof(buf)); + close(fd); + if (size < 18 || size == sizeof(buf)) { + err = -1; + goto out; + } + + pos = 0; + strpos = 0; + ifs_str[0] = '\0'; + while (pos < sizeof(buf) && strpos+7 < len-2) { + struct usb_interface_descriptor *desc; + char if_str[8]; + + desc = (struct usb_interface_descriptor *) &buf[pos]; + if (desc->bLength < 3) + break; + pos += desc->bLength; + + if (desc->bDescriptorType != USB_DT_INTERFACE) + continue; + + if (snprintf(if_str, 8, ":%02x%02x%02x", + desc->bInterfaceClass, + desc->bInterfaceSubClass, + desc->bInterfaceProtocol) != 7) + continue; + + if (strstr(ifs_str, if_str) != NULL) + continue; + + memcpy(&ifs_str[strpos], if_str, 8), + strpos += 7; + } + if (strpos > 0) { + ifs_str[strpos++] = ':'; + ifs_str[strpos++] = '\0'; + } +out: + free(filename); + return err; +} + +/* + * A unique USB identification is generated like this: + * + * 1.) Get the USB device type from InterfaceClass and InterfaceSubClass + * 2.) If the device type is 'Mass-Storage/SPC-2' or 'Mass-Storage/RBC' + * use the SCSI vendor and model as USB-Vendor and USB-model. + * 3.) Otherwise use the USB manufacturer and product as + * USB-Vendor and USB-model. Any non-printable characters + * in those strings will be skipped; a slash '/' will be converted + * into a full stop '.'. + * 4.) If that fails, too, we will use idVendor and idProduct + * as USB-Vendor and USB-model. + * 5.) The USB identification is the USB-vendor and USB-model + * string concatenated with an underscore '_'. + * 6.) If the device supplies a serial number, this number + * is concatenated with the identification with an underscore '_'. + */ +static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool test) +{ + char vendor_str[64]; + char vendor_str_enc[256]; + const char *vendor_id; + char model_str[64]; + char model_str_enc[256]; + const char *product_id; + char serial_str[UTIL_NAME_SIZE]; + char packed_if_str[UTIL_NAME_SIZE]; + char revision_str[64]; + char type_str[64]; + char instance_str[64]; + const char *ifnum = NULL; + const char *driver = NULL; + char serial[256]; + + struct udev *udev = udev_device_get_udev(dev); + struct udev_device *dev_interface = NULL; + struct udev_device *dev_usb = NULL; + const char *if_class, *if_subclass; + int if_class_num; + int protocol = 0; + size_t l; + char *s; + + vendor_str[0] = '\0'; + model_str[0] = '\0'; + serial_str[0] = '\0'; + packed_if_str[0] = '\0'; + revision_str[0] = '\0'; + type_str[0] = '\0'; + instance_str[0] = '\0'; + + dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); + + /* shortcut, if we are called directly for a "usb_device" type */ + if (udev_device_get_devtype(dev) != NULL && strcmp(udev_device_get_devtype(dev), "usb_device") == 0) { + dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str)); + dev_usb = dev; + goto fallback; + } + + /* usb interface directory */ + dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface"); + if (dev_interface == NULL) { + info(udev, "unable to access usb_interface device of '%s'\n", + udev_device_get_syspath(dev)); + return EXIT_FAILURE; + } + + ifnum = udev_device_get_sysattr_value(dev_interface, "bInterfaceNumber"); + driver = udev_device_get_sysattr_value(dev_interface, "driver"); + + if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass"); + if (!if_class) { + info(udev, "%s: cannot get bInterfaceClass attribute\n", + udev_device_get_sysname(dev)); + return EXIT_FAILURE; + } + + if_class_num = strtoul(if_class, NULL, 16); + if (if_class_num == 8) { + /* mass storage */ + if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass"); + if (if_subclass != NULL) + protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); + } else { + set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1); + } + + info(udev, "%s: if_class %d protocol %d\n", + udev_device_get_syspath(dev_interface), if_class_num, protocol); + + /* usb device directory */ + dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", "usb_device"); + if (!dev_usb) { + info(udev, "unable to find parent 'usb' device of '%s'\n", + udev_device_get_syspath(dev)); + return EXIT_FAILURE; + } + + /* all interfaces of the device in a single string */ + dev_if_packed_info(dev_usb, packed_if_str, sizeof(packed_if_str)); + + /* mass storage : SCSI or ATAPI */ + if ((protocol == 6 || protocol == 2)) { + struct udev_device *dev_scsi; + const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; + int host, bus, target, lun; + + /* get scsi device */ + dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); + if (dev_scsi == NULL) { + info(udev, "unable to find parent 'scsi' device of '%s'\n", + udev_device_get_syspath(dev)); + goto fallback; + } + if (sscanf(udev_device_get_sysname(dev_scsi), "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { + info(udev, "invalid scsi device '%s'\n", udev_device_get_sysname(dev_scsi)); + goto fallback; + } + + /* Generic SPC-2 device */ + scsi_vendor = udev_device_get_sysattr_value(dev_scsi, "vendor"); + if (!scsi_vendor) { + info(udev, "%s: cannot get SCSI vendor attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); + util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); + util_replace_chars(vendor_str, NULL); + + scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); + if (!scsi_model) { + info(udev, "%s: cannot get SCSI model attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc)); + util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); + util_replace_chars(model_str, NULL); + + scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); + if (!scsi_type) { + info(udev, "%s: cannot get SCSI type attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); + + scsi_rev = udev_device_get_sysattr_value(dev_scsi, "rev"); + if (!scsi_rev) { + info(udev, "%s: cannot get SCSI revision attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); + util_replace_chars(revision_str, NULL); + + /* + * some broken devices have the same identifiers + * for all luns, export the target:lun number + */ + sprintf(instance_str, "%d:%d", target, lun); + } + +fallback: + vendor_id = udev_device_get_sysattr_value(dev_usb, "idVendor"); + product_id = udev_device_get_sysattr_value(dev_usb, "idProduct"); + + /* fallback to USB vendor & device */ + if (vendor_str[0] == '\0') { + const char *usb_vendor = NULL; + + usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); + if (!usb_vendor) + usb_vendor = vendor_id; + if (!usb_vendor) { + info(udev, "No USB vendor information available\n"); + return EXIT_FAILURE; + } + udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); + util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); + util_replace_chars(vendor_str, NULL); + } + + if (model_str[0] == '\0') { + const char *usb_model = NULL; + + usb_model = udev_device_get_sysattr_value(dev_usb, "product"); + if (!usb_model) + usb_model = product_id; + if (!usb_model) { + dbg(udev, "No USB model information available\n"); + return EXIT_FAILURE; + } + udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); + util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); + util_replace_chars(model_str, NULL); + } + + if (revision_str[0] == '\0') { + const char *usb_rev; + + usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); + if (usb_rev) { + util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); + util_replace_chars(revision_str, NULL); + } + } + + if (serial_str[0] == '\0') { + const char *usb_serial; + + usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); + if (usb_serial) { + util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); + util_replace_chars(serial_str, NULL); + } + } + + s = serial; + l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); + if (serial_str[0] != '\0') + l = util_strpcpyl(&s, l, "_", serial_str, NULL); + + if (instance_str[0] != '\0') + util_strpcpyl(&s, l, "-", instance_str, NULL); + + udev_builtin_add_property(dev, test, "ID_VENDOR", vendor_str); + udev_builtin_add_property(dev, test, "ID_VENDOR_ENC", vendor_str_enc); + udev_builtin_add_property(dev, test, "ID_VENDOR_ID", vendor_id); + udev_builtin_add_property(dev, test, "ID_MODEL", model_str); + udev_builtin_add_property(dev, test, "ID_MODEL_ENC", model_str_enc); + udev_builtin_add_property(dev, test, "ID_MODEL_ID", product_id); + udev_builtin_add_property(dev, test, "ID_REVISION", revision_str); + udev_builtin_add_property(dev, test, "ID_SERIAL", serial); + if (serial_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_SERIAL_SHORT", serial_str); + if (type_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_TYPE", type_str); + if (instance_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_INSTANCE", instance_str); + udev_builtin_add_property(dev, test, "ID_BUS", "usb"); + if (packed_if_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_USB_INTERFACES", packed_if_str); + if (ifnum != NULL) + udev_builtin_add_property(dev, test, "ID_USB_INTERFACE_NUM", ifnum); + if (driver != NULL) + udev_builtin_add_property(dev, test, "ID_USB_DRIVER", driver); + return EXIT_SUCCESS; +} + +const struct udev_builtin udev_builtin_usb_id = { + .name = "usb_id", + .cmd = builtin_usb_id, + .help = "usb device properties", + .run_once = true, +}; diff --git a/src/udev-builtin.c b/src/udev-builtin.c new file mode 100644 index 0000000000..8beac8a678 --- /dev/null +++ b/src/udev-builtin.c @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2007-2009 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static const struct udev_builtin *builtins[] = { + [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, + [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, + [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, + [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, + [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, + [UDEV_BUILTIN_PCI_DB] = &udev_builtin_pci_db, + [UDEV_BUILTIN_USB_DB] = &udev_builtin_usb_db, + [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, +}; + +int udev_builtin_init(struct udev *udev) +{ + unsigned int i; + int err; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) { + if (builtins[i]->init) { + err = builtins[i]->init(udev); + if (err < 0) + break; + } + } + return err; +} + +void udev_builtin_exit(struct udev *udev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (builtins[i]->exit) + builtins[i]->exit(udev); +} + +bool udev_builtin_validate(struct udev *udev) +{ + unsigned int i; + bool change = false; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (builtins[i]->validate) + if (builtins[i]->validate(udev)) + change = true; + return change; +} + +void udev_builtin_list(struct udev *udev) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + fprintf(stderr, " %-12s %s\n", builtins[i]->name, builtins[i]->help); +} + +const char *udev_builtin_name(enum udev_builtin_cmd cmd) +{ + return builtins[cmd]->name; +} + +bool udev_builtin_run_once(enum udev_builtin_cmd cmd) +{ + return builtins[cmd]->run_once; +} + +enum udev_builtin_cmd udev_builtin_lookup(const char *command) +{ + char name[UTIL_PATH_SIZE]; + enum udev_builtin_cmd i; + char *pos; + + util_strscpy(name, sizeof(name), command); + pos = strchr(name, ' '); + if (pos) + pos[0] = '\0'; + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (strcmp(builtins[i]->name, name) == 0) + return i; + return UDEV_BUILTIN_MAX; +} + +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) +{ + char arg[UTIL_PATH_SIZE]; + int argc; + char *argv[128]; + + optind = 0; + util_strscpy(arg, sizeof(arg), command); + udev_build_argv(udev_device_get_udev(dev), arg, &argc, argv); + return builtins[cmd]->cmd(dev, argc, argv, test); +} + +int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val) +{ + struct udev_list_entry *entry; + + entry = udev_device_add_property(dev, key, val); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_num(entry, true); + + info(udev_device_get_udev(dev), "%s=%s\n", key, val); + if (test) + printf("%s=%s\n", key, val); + return 0; +} diff --git a/src/udev-control.socket b/src/udev-control.socket new file mode 100644 index 0000000000..f80f774427 --- /dev/null +++ b/src/udev-control.socket @@ -0,0 +1,10 @@ +[Unit] +Description=udev Control Socket +DefaultDependencies=no +ConditionCapability=CAP_MKNOD + +[Socket] +Service=udev.service +ListenSequentialPacket=/run/udev/control +SocketMode=0600 +PassCredentials=yes diff --git a/src/udev-ctrl.c b/src/udev-ctrl.c new file mode 100644 index 0000000000..fab1108de0 --- /dev/null +++ b/src/udev-ctrl.c @@ -0,0 +1,494 @@ +/* + * libudev - interface to udev device information + * + * Copyright (C) 2008 Kay Sievers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +/* wire protocol magic must match */ +#define UDEV_CTRL_MAGIC 0xdead1dea + +enum udev_ctrl_msg_type { + UDEV_CTRL_UNKNOWN, + UDEV_CTRL_SET_LOG_LEVEL, + UDEV_CTRL_STOP_EXEC_QUEUE, + UDEV_CTRL_START_EXEC_QUEUE, + UDEV_CTRL_RELOAD, + UDEV_CTRL_SET_ENV, + UDEV_CTRL_SET_CHILDREN_MAX, + UDEV_CTRL_PING, + UDEV_CTRL_EXIT, +}; + +struct udev_ctrl_msg_wire { + char version[16]; + unsigned int magic; + enum udev_ctrl_msg_type type; + union { + int intval; + char buf[256]; + }; +}; + +struct udev_ctrl_msg { + int refcount; + struct udev_ctrl_connection *conn; + struct udev_ctrl_msg_wire ctrl_msg_wire; +}; + +struct udev_ctrl { + int refcount; + struct udev *udev; + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; + bool bound; + bool cleanup_socket; + bool connected; +}; + +struct udev_ctrl_connection { + int refcount; + struct udev_ctrl *uctrl; + int sock; +}; + +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) +{ + struct udev_ctrl *uctrl; + + uctrl = calloc(1, sizeof(struct udev_ctrl)); + if (uctrl == NULL) + return NULL; + uctrl->refcount = 1; + uctrl->udev = udev; + + if (fd < 0) { + uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); + if (uctrl->sock < 0) { + err(udev, "error getting socket: %m\n"); + udev_ctrl_unref(uctrl); + return NULL; + } + } else { + uctrl->bound = true; + uctrl->sock = fd; + } + + uctrl->saddr.sun_family = AF_LOCAL; + util_strscpyl(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), + udev_get_run_path(udev), "/control", NULL); + uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); + return uctrl; +} + +struct udev_ctrl *udev_ctrl_new(struct udev *udev) +{ + return udev_ctrl_new_from_fd(udev, -1); +} + +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) +{ + int err; + + if (!uctrl->bound) { + err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err < 0 && errno == EADDRINUSE) { + unlink(uctrl->saddr.sun_path); + err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + } + + if (err < 0) { + err = -errno; + err(uctrl->udev, "bind failed: %m\n"); + return err; + } + + err = listen(uctrl->sock, 0); + if (err < 0) { + err = -errno; + err(uctrl->udev, "listen failed: %m\n"); + return err; + } + + uctrl->bound = true; + uctrl->cleanup_socket = true; + } + return 0; +} + +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) +{ + return uctrl->udev; +} + +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return NULL; + uctrl->refcount++; + return uctrl; +} + +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return NULL; + uctrl->refcount--; + if (uctrl->refcount > 0) + return uctrl; + if (uctrl->sock >= 0) + close(uctrl->sock); + free(uctrl); + return NULL; +} + +int udev_ctrl_cleanup(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return 0; + if (uctrl->cleanup_socket) + unlink(uctrl->saddr.sun_path); + return 0; +} + +int udev_ctrl_get_fd(struct udev_ctrl *uctrl) +{ + if (uctrl == NULL) + return -EINVAL; + return uctrl->sock; +} + +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) +{ + struct udev_ctrl_connection *conn; + struct ucred ucred; + socklen_t slen; + const int on = 1; + + conn = calloc(1, sizeof(struct udev_ctrl_connection)); + if (conn == NULL) + return NULL; + conn->refcount = 1; + conn->uctrl = uctrl; + + conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); + if (conn->sock < 0) { + if (errno != EINTR) + err(uctrl->udev, "unable to receive ctrl connection: %m\n"); + goto err; + } + + /* check peer credential of connection */ + slen = sizeof(ucred); + if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) { + err(uctrl->udev, "unable to receive credentials of ctrl connection: %m\n"); + goto err; + } + if (ucred.uid > 0) { + err(uctrl->udev, "sender uid=%i, message ignored\n", ucred.uid); + goto err; + } + + /* enable receiving of the sender credentials in the messages */ + setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + udev_ctrl_ref(uctrl); + return conn; +err: + if (conn->sock >= 0) + close(conn->sock); + free(conn); + return NULL; +} + +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) +{ + if (conn == NULL) + return NULL; + conn->refcount++; + return conn; +} + +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) +{ + if (conn == NULL) + return NULL; + conn->refcount--; + if (conn->refcount > 0) + return conn; + if (conn->sock >= 0) + close(conn->sock); + udev_ctrl_unref(conn->uctrl); + free(conn); + return NULL; +} + +static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) +{ + struct udev_ctrl_msg_wire ctrl_msg_wire; + int err = 0; + + memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); + strcpy(ctrl_msg_wire.version, "udev-" VERSION); + ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; + ctrl_msg_wire.type = type; + + if (buf != NULL) + util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); + else + ctrl_msg_wire.intval = intval; + + if (!uctrl->connected) { + if (connect(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen) < 0) { + err = -errno; + goto out; + } + uctrl->connected = true; + } + if (send(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0) < 0) { + err = -errno; + goto out; + } + + /* wait for peer message handling or disconnect */ + for (;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = uctrl->sock; + pfd[0].events = POLLIN; + r = poll(pfd, 1, timeout * 1000); + if (r < 0) { + if (errno == EINTR) + continue; + err = -errno; + break; + } + + if (r > 0 && pfd[0].revents & POLLERR) { + err = -EIO; + break; + } + + if (r == 0) + err = -ETIMEDOUT; + break; + } +out: + return err; +} + +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); +} + +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); +} + +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); +} + +int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_RELOAD, 0, NULL, timeout); +} + +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); +} + +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); +} + +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); +} + +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) +{ + return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); +} + +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) +{ + struct udev *udev = conn->uctrl->udev; + struct udev_ctrl_msg *uctrl_msg; + ssize_t size; + struct msghdr smsg; + struct cmsghdr *cmsg; + struct iovec iov; + struct ucred *cred; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + + uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); + if (uctrl_msg == NULL) + return NULL; + uctrl_msg->refcount = 1; + uctrl_msg->conn = conn; + udev_ctrl_connection_ref(conn); + + /* wait for the incoming message */ + for(;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = conn->sock; + pfd[0].events = POLLIN; + + r = poll(pfd, 1, 10000); + if (r < 0) { + if (errno == EINTR) + continue; + goto err; + } else if (r == 0) { + err(udev, "timeout waiting for ctrl message\n"); + goto err; + } else { + if (!(pfd[0].revents & POLLIN)) { + err(udev, "ctrl connection error: %m\n"); + goto err; + } + } + + break; + } + + iov.iov_base = &uctrl_msg->ctrl_msg_wire; + iov.iov_len = sizeof(struct udev_ctrl_msg_wire); + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + size = recvmsg(conn->sock, &smsg, 0); + if (size < 0) { + err(udev, "unable to receive ctrl message: %m\n"); + goto err; + } + cmsg = CMSG_FIRSTHDR(&smsg); + cred = (struct ucred *) CMSG_DATA(cmsg); + + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + err(udev, "no sender credentials received, message ignored\n"); + goto err; + } + + if (cred->uid != 0) { + err(udev, "sender uid=%i, message ignored\n", cred->uid); + goto err; + } + + if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { + err(udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); + goto err; + } + + dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); + return uctrl_msg; +err: + udev_ctrl_msg_unref(uctrl_msg); + return NULL; +} + +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount++; + return ctrl_msg; +} + +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount--; + if (ctrl_msg->refcount > 0) + return ctrl_msg; + dbg(ctrl_msg->conn->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + udev_ctrl_connection_unref(ctrl_msg->conn); + free(ctrl_msg); + return NULL; +} + +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; +} + +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) + return 1; + return -1; +} + +int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD) + return 1; + return -1; +} + +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) + return ctrl_msg->ctrl_msg_wire.buf; + return NULL; +} + +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; +} + +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) + return 1; + return -1; +} + +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) +{ + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) + return 1; + return -1; +} diff --git a/src/udev-event.c b/src/udev-event.c new file mode 100644 index 0000000000..859d811bff --- /dev/null +++ b/src/udev-event.c @@ -0,0 +1,1005 @@ +/* + * Copyright (C) 2003-2010 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +struct udev_event *udev_event_new(struct udev_device *dev) +{ + struct udev *udev = udev_device_get_udev(dev); + struct udev_event *event; + + event = calloc(1, sizeof(struct udev_event)); + if (event == NULL) + return NULL; + event->dev = dev; + event->udev = udev; + udev_list_init(udev, &event->run_list, false); + event->fd_signal = -1; + event->birth_usec = now_usec(); + event->timeout_usec = 60 * 1000 * 1000; + dbg(event->udev, "allocated event %p\n", event); + return event; +} + +void udev_event_unref(struct udev_event *event) +{ + if (event == NULL) + return; + udev_list_cleanup(&event->run_list); + free(event->program_result); + free(event->name); + dbg(event->udev, "free event %p\n", event); + free(event); +} + +size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size) +{ + struct udev_device *dev = event->dev; + enum subst_type { + SUBST_UNKNOWN, + SUBST_DEVNODE, + SUBST_ATTR, + SUBST_ENV, + SUBST_KERNEL, + SUBST_KERNEL_NUMBER, + SUBST_DRIVER, + SUBST_DEVPATH, + SUBST_ID, + SUBST_MAJOR, + SUBST_MINOR, + SUBST_RESULT, + SUBST_PARENT, + SUBST_NAME, + SUBST_LINKS, + SUBST_ROOT, + SUBST_SYS, + }; + static const struct subst_map { + char *name; + char fmt; + enum subst_type type; + } map[] = { + { .name = "devnode", .fmt = 'N', .type = SUBST_DEVNODE }, + { .name = "tempnode", .fmt = 'N', .type = SUBST_DEVNODE }, + { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, + { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, + { .name = "env", .fmt = 'E', .type = SUBST_ENV }, + { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, + { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, + { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, + { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, + { .name = "id", .fmt = 'b', .type = SUBST_ID }, + { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, + { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, + { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, + { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, + { .name = "name", .fmt = 'D', .type = SUBST_NAME }, + { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, + { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, + { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, + }; + const char *from; + char *s; + size_t l; + + from = src; + s = dest; + l = size; + + for (;;) { + enum subst_type type = SUBST_UNKNOWN; + char attrbuf[UTIL_PATH_SIZE]; + char *attr = NULL; + + while (from[0] != '\0') { + if (from[0] == '$') { + /* substitute named variable */ + unsigned int i; + + if (from[1] == '$') { + from++; + goto copy; + } + + for (i = 0; i < ARRAY_SIZE(map); i++) { + if (strncmp(&from[1], map[i].name, strlen(map[i].name)) == 0) { + type = map[i].type; + from += strlen(map[i].name)+1; + dbg(event->udev, "will substitute format name '%s'\n", map[i].name); + goto subst; + } + } + } else if (from[0] == '%') { + /* substitute format char */ + unsigned int i; + + if (from[1] == '%') { + from++; + goto copy; + } + + for (i = 0; i < ARRAY_SIZE(map); i++) { + if (from[1] == map[i].fmt) { + type = map[i].type; + from += 2; + dbg(event->udev, "will substitute format char '%c'\n", map[i].fmt); + goto subst; + } + } + } +copy: + /* copy char */ + if (l == 0) + goto out; + s[0] = from[0]; + from++; + s++; + l--; + } + + goto out; +subst: + /* extract possible $format{attr} */ + if (from[0] == '{') { + unsigned int i; + + from++; + for (i = 0; from[i] != '}'; i++) { + if (from[i] == '\0') { + err(event->udev, "missing closing brace for format '%s'\n", src); + goto out; + } + } + if (i >= sizeof(attrbuf)) + goto out; + memcpy(attrbuf, from, i); + attrbuf[i] = '\0'; + from += i+1; + attr = attrbuf; + } else { + attr = NULL; + } + + switch (type) { + case SUBST_DEVPATH: + l = util_strpcpy(&s, l, udev_device_get_devpath(dev)); + dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); + break; + case SUBST_KERNEL: + l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); + dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); + break; + case SUBST_KERNEL_NUMBER: + if (udev_device_get_sysnum(dev) == NULL) + break; + l = util_strpcpy(&s, l, udev_device_get_sysnum(dev)); + dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); + break; + case SUBST_ID: + if (event->dev_parent == NULL) + break; + l = util_strpcpy(&s, l, udev_device_get_sysname(event->dev_parent)); + dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); + break; + case SUBST_DRIVER: { + const char *driver; + + if (event->dev_parent == NULL) + break; + + driver = udev_device_get_driver(event->dev_parent); + if (driver == NULL) + break; + l = util_strpcpy(&s, l, driver); + dbg(event->udev, "substitute driver '%s'\n", driver); + break; + } + case SUBST_MAJOR: { + char num[UTIL_PATH_SIZE]; + + sprintf(num, "%d", major(udev_device_get_devnum(dev))); + l = util_strpcpy(&s, l, num); + dbg(event->udev, "substitute major number '%s'\n", num); + break; + } + case SUBST_MINOR: { + char num[UTIL_PATH_SIZE]; + + sprintf(num, "%d", minor(udev_device_get_devnum(dev))); + l = util_strpcpy(&s, l, num); + dbg(event->udev, "substitute minor number '%s'\n", num); + break; + } + case SUBST_RESULT: { + char *rest; + int i; + + if (event->program_result == NULL) + break; + /* get part part of the result string */ + i = 0; + if (attr != NULL) + i = strtoul(attr, &rest, 10); + if (i > 0) { + char result[UTIL_PATH_SIZE]; + char tmp[UTIL_PATH_SIZE]; + char *cpos; + + dbg(event->udev, "request part #%d of result string\n", i); + util_strscpy(result, sizeof(result), event->program_result); + cpos = result; + while (--i) { + while (cpos[0] != '\0' && !isspace(cpos[0])) + cpos++; + while (isspace(cpos[0])) + cpos++; + } + if (i > 0) { + err(event->udev, "requested part of result string not found\n"); + break; + } + util_strscpy(tmp, sizeof(tmp), cpos); + /* %{2+}c copies the whole string from the second part on */ + if (rest[0] != '+') { + cpos = strchr(tmp, ' '); + if (cpos) + cpos[0] = '\0'; + } + l = util_strpcpy(&s, l, tmp); + dbg(event->udev, "substitute part of result string '%s'\n", tmp); + } else { + l = util_strpcpy(&s, l, event->program_result); + dbg(event->udev, "substitute result string '%s'\n", event->program_result); + } + break; + } + case SUBST_ATTR: { + const char *value = NULL; + char vbuf[UTIL_NAME_SIZE]; + size_t len; + int count; + + if (attr == NULL) { + err(event->udev, "missing file parameter for attr\n"); + break; + } + + /* try to read the value specified by "[dmi/id]product_name" */ + if (util_resolve_subsys_kernel(event->udev, attr, vbuf, sizeof(vbuf), 1) == 0) + value = vbuf; + + /* try to read the attribute the device */ + if (value == NULL) + value = udev_device_get_sysattr_value(event->dev, attr); + + /* try to read the attribute of the parent device, other matches have selected */ + if (value == NULL && event->dev_parent != NULL && event->dev_parent != event->dev) + value = udev_device_get_sysattr_value(event->dev_parent, attr); + + if (value == NULL) + break; + + /* strip trailing whitespace, and replace unwanted characters */ + if (value != vbuf) + util_strscpy(vbuf, sizeof(vbuf), value); + len = strlen(vbuf); + while (len > 0 && isspace(vbuf[--len])) + vbuf[len] = '\0'; + count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + l = util_strpcpy(&s, l, vbuf); + dbg(event->udev, "substitute sysfs value '%s'\n", vbuf); + break; + } + case SUBST_PARENT: { + struct udev_device *dev_parent; + const char *devnode; + + dev_parent = udev_device_get_parent(event->dev); + if (dev_parent == NULL) + break; + devnode = udev_device_get_devnode(dev_parent); + if (devnode != NULL) { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + + l = util_strpcpy(&s, l, &devnode[devlen]); + dbg(event->udev, "found parent '%s', got node name '%s'\n", + udev_device_get_syspath(dev_parent), &devnode[devlen]); + } + break; + } + case SUBST_DEVNODE: + if (udev_device_get_devnode(dev) != NULL) + l = util_strpcpy(&s, l, udev_device_get_devnode(dev)); + break; + case SUBST_NAME: + if (event->name != NULL) { + l = util_strpcpy(&s, l, event->name); + dbg(event->udev, "substitute name '%s'\n", event->name); + } else { + l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); + dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); + } + break; + case SUBST_LINKS: { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; + + list_entry = udev_device_get_devlinks_list_entry(dev); + if (list_entry == NULL) + break; + l = util_strpcpy(&s, l, &udev_list_entry_get_name(list_entry)[devlen]); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) + l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); + break; + } + case SUBST_ROOT: + l = util_strpcpy(&s, l, udev_get_dev_path(event->udev)); + dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); + break; + case SUBST_SYS: + l = util_strpcpy(&s, l, udev_get_sys_path(event->udev)); + dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); + break; + case SUBST_ENV: + if (attr == NULL) { + dbg(event->udev, "missing attribute\n"); + break; + } else { + const char *value; + + value = udev_device_get_property_value(event->dev, attr); + if (value == NULL) + break; + dbg(event->udev, "substitute env '%s=%s'\n", attr, value); + l = util_strpcpy(&s, l, value); + break; + } + default: + err(event->udev, "unknown substitution type=%i\n", type); + break; + } + } + +out: + s[0] = '\0'; + dbg(event->udev, "'%s' -> '%s' (%zu)\n", src, dest, l); + return l; +} + +static int spawn_exec(struct udev_event *event, + const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask, + int fd_stdout, int fd_stderr) +{ + struct udev *udev = event->udev; + int err; + int fd; + + /* discard child output or connect to pipe */ + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + if (fd_stdout < 0) + dup2(fd, STDOUT_FILENO); + if (fd_stderr < 0) + dup2(fd, STDERR_FILENO); + close(fd); + } else { + err(udev, "open /dev/null failed: %m\n"); + } + + /* connect pipes to std{out,err} */ + if (fd_stdout >= 0) { + dup2(fd_stdout, STDOUT_FILENO); + close(fd_stdout); + } + if (fd_stderr >= 0) { + dup2(fd_stderr, STDERR_FILENO); + close(fd_stderr); + } + + /* terminate child in case parent goes away */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + + /* restore original udev sigmask before exec */ + if (sigmask) + sigprocmask(SIG_SETMASK, sigmask, NULL); + + execve(argv[0], argv, envp); + + /* exec failed */ + err = -errno; + err(udev, "failed to execute '%s' '%s': %m\n", argv[0], cmd); + return err; +} + +static void spawn_read(struct udev_event *event, + const char *cmd, + int fd_stdout, int fd_stderr, + char *result, size_t ressize) +{ + struct udev *udev = event->udev; + size_t respos = 0; + int fd_ep = -1; + struct epoll_event ep_outpipe, ep_errpipe; + + /* read from child if requested */ + if (fd_stdout < 0 && fd_stderr < 0) + return; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto out; + } + + if (fd_stdout >= 0) { + memset(&ep_outpipe, 0, sizeof(struct epoll_event)); + ep_outpipe.events = EPOLLIN; + ep_outpipe.data.ptr = &fd_stdout; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + if (fd_stderr >= 0) { + memset(&ep_errpipe, 0, sizeof(struct epoll_event)); + ep_errpipe.events = EPOLLIN; + ep_errpipe.data.ptr = &fd_stderr; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + /* read child output */ + while (fd_stdout >= 0 || fd_stderr >= 0) { + int timeout; + int fdcount; + struct epoll_event ev[4]; + int i; + + if (event->timeout_usec > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - event->birth_usec; + if (age_usec >= event->timeout_usec) { + err(udev, "timeout '%s'\n", cmd); + goto out; + } + timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + } else { + timeout = -1; + } + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err(udev, "failed to poll: %m\n"); + goto out; + } + if (fdcount == 0) { + err(udev, "timeout '%s'\n", cmd); + goto out; + } + + for (i = 0; i < fdcount; i++) { + int *fd = (int *)ev[i].data.ptr; + + if (ev[i].events & EPOLLIN) { + ssize_t count; + char buf[4096]; + + count = read(*fd, buf, sizeof(buf)-1); + if (count <= 0) + continue; + buf[count] = '\0'; + + /* store stdout result */ + if (result != NULL && *fd == fd_stdout) { + if (respos + count < ressize) { + memcpy(&result[respos], buf, count); + respos += count; + } else { + err(udev, "'%s' ressize %zd too short\n", cmd, ressize); + } + } + + /* log debug output only if we watch stderr */ + if (fd_stderr >= 0) { + char *pos; + char *line; + + pos = buf; + while ((line = strsep(&pos, "\n"))) { + if (pos != NULL || line[0] != '\0') + info(udev, "'%s'(%s) '%s'\n", cmd, *fd == fd_stdout ? "out" : "err" , line); + } + } + } else if (ev[i].events & EPOLLHUP) { + if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) { + err(udev, "failed to remove fd from epoll: %m\n"); + goto out; + } + *fd = -1; + } + } + } + + /* return the child's stdout string */ + if (result != NULL) { + result[respos] = '\0'; + dbg(udev, "result='%s'\n", result); + } +out: + if (fd_ep >= 0) + close(fd_ep); +} + +static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) +{ + struct udev *udev = event->udev; + struct pollfd pfd[1]; + int err = 0; + + pfd[0].events = POLLIN; + pfd[0].fd = event->fd_signal; + + while (pid > 0) { + int timeout; + int fdcount; + + if (event->timeout_usec > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - event->birth_usec; + if (age_usec >= event->timeout_usec) + timeout = 1000; + else + timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + } else { + timeout = -1; + } + + fdcount = poll(pfd, 1, timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } + if (fdcount == 0) { + err(udev, "timeout: killing '%s' [%u]\n", cmd, pid); + kill(pid, SIGKILL); + } + + if (pfd[0].revents & POLLIN) { + struct signalfd_siginfo fdsi; + int status; + ssize_t size; + + size = read(event->fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size != sizeof(struct signalfd_siginfo)) + continue; + + switch (fdsi.ssi_signo) { + case SIGTERM: + event->sigterm = true; + break; + case SIGCHLD: + if (waitpid(pid, &status, WNOHANG) < 0) + break; + if (WIFEXITED(status)) { + info(udev, "'%s' [%u] exit with return code %i\n", cmd, pid, WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + err = -1; + } else if (WIFSIGNALED(status)) { + err(udev, "'%s' [%u] terminated by signal %i (%s)\n", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status))); + err = -1; + } else if (WIFSTOPPED(status)) { + err(udev, "'%s' [%u] stopped\n", cmd, pid); + err = -1; + } else if (WIFCONTINUED(status)) { + err(udev, "'%s' [%u] continued\n", cmd, pid); + err = -1; + } else { + err(udev, "'%s' [%u] exit with status 0x%04x\n", cmd, pid, status); + err = -1; + } + pid = 0; + break; + } + } + } +out: + return err; +} + +int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]) +{ + int i = 0; + char *pos; + + if (strchr(cmd, ' ') == NULL) { + argv[i++] = cmd; + goto out; + } + + pos = cmd; + while (pos != NULL && pos[0] != '\0') { + if (pos[0] == '\'') { + /* do not separate quotes */ + pos++; + argv[i] = strsep(&pos, "\'"); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } + dbg(udev, "argv[%i] '%s'\n", i, argv[i]); + i++; + } +out: + argv[i] = NULL; + if (argc) + *argc = i; + return 0; +} + +int udev_event_spawn(struct udev_event *event, + const char *cmd, char **envp, const sigset_t *sigmask, + char *result, size_t ressize) +{ + struct udev *udev = event->udev; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[UTIL_PATH_SIZE]; + char *argv[128]; + char program[UTIL_PATH_SIZE]; + int err = 0; + + util_strscpy(arg, sizeof(arg), cmd); + udev_build_argv(event->udev, arg, NULL, argv); + + /* pipes from child to parent */ + if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe2(outpipe, O_NONBLOCK) != 0) { + err = -errno; + err(udev, "pipe failed: %m\n"); + goto out; + } + } + if (udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe2(errpipe, O_NONBLOCK) != 0) { + err = -errno; + err(udev, "pipe failed: %m\n"); + goto out; + } + } + + /* allow programs in /usr/lib/udev/ to be called without the path */ + if (argv[0][0] != '/') { + util_strscpyl(program, sizeof(program), PKGLIBEXECDIR "/", argv[0], NULL); + argv[0] = program; + } + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent's ends of pipes */ + if (outpipe[READ_END] >= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + } + if (errpipe[READ_END] >= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + } + + info(udev, "starting '%s'\n", cmd); + + err = spawn_exec(event, cmd, argv, envp, sigmask, + outpipe[WRITE_END], errpipe[WRITE_END]); + + _exit(2 ); + case -1: + err(udev, "fork of '%s' failed: %m\n", cmd); + err = -1; + goto out; + default: + /* parent closed child's ends of pipes */ + if (outpipe[WRITE_END] >= 0) { + close(outpipe[WRITE_END]); + outpipe[WRITE_END] = -1; + } + if (errpipe[WRITE_END] >= 0) { + close(errpipe[WRITE_END]); + errpipe[WRITE_END] = -1; + } + + spawn_read(event, cmd, + outpipe[READ_END], errpipe[READ_END], + result, ressize); + + err = spawn_wait(event, cmd, pid); + } + +out: + if (outpipe[READ_END] >= 0) + close(outpipe[READ_END]); + if (outpipe[WRITE_END] >= 0) + close(outpipe[WRITE_END]); + if (errpipe[READ_END] >= 0) + close(errpipe[READ_END]); + if (errpipe[WRITE_END] >= 0) + close(errpipe[WRITE_END]); + return err; +} + +static void rename_netif_kernel_log(struct ifreq ifr) +{ + int klog; + FILE *f; + + klog = open("/dev/kmsg", O_WRONLY); + if (klog < 0) + return; + + f = fdopen(klog, "w"); + if (f == NULL) { + close(klog); + return; + } + + fprintf(f, "<30>udevd[%u]: renamed network interface %s to %s\n", + getpid(), ifr.ifr_name, ifr.ifr_newname); + fclose(f); +} + +static int rename_netif(struct udev_event *event) +{ + struct udev_device *dev = event->dev; + int sk; + struct ifreq ifr; + int loop; + int err; + + info(event->udev, "changing net interface name from '%s' to '%s'\n", + udev_device_get_sysname(dev), event->name); + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) { + err = -errno; + err(event->udev, "error opening socket: %m\n"); + return err; + } + + memset(&ifr, 0x00, sizeof(struct ifreq)); + util_strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev)); + util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err == 0) { + rename_netif_kernel_log(ifr); + goto out; + } + + /* keep trying if the destination interface name already exists */ + err = -errno; + if (err != -EEXIST) + goto out; + + /* free our own name, another process may wait for us */ + snprintf(ifr.ifr_newname, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev)); + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err < 0) { + err = -errno; + goto out; + } + + /* log temporary name */ + rename_netif_kernel_log(ifr); + + /* wait a maximum of 90 seconds for our target to become available */ + util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); + util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); + loop = 90 * 20; + while (loop--) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; + + dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", + event->name, (90 * 20) - loop); + nanosleep(&duration, NULL); + + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err == 0) { + rename_netif_kernel_log(ifr); + break; + } + err = -errno; + if (err != -EEXIST) + break; + } + +out: + if (err < 0) + err(event->udev, "error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); + close(sk); + return err; +} + +int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) +{ + struct udev_device *dev = event->dev; + int err = 0; + + if (udev_device_get_subsystem(dev) == NULL) + return -1; + + if (strcmp(udev_device_get_action(dev), "remove") == 0) { + udev_device_read_db(dev, NULL); + udev_device_delete_db(dev); + udev_device_tag_index(dev, NULL, false); + + if (major(udev_device_get_devnum(dev)) != 0) + udev_watch_end(event->udev, dev); + + udev_rules_apply_to_event(rules, event, sigmask); + + if (major(udev_device_get_devnum(dev)) != 0) + err = udev_node_remove(dev); + } else { + event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); + if (event->dev_db != NULL) { + udev_device_read_db(event->dev_db, NULL); + udev_device_set_info_loaded(event->dev_db); + + /* disable watch during event processing */ + if (major(udev_device_get_devnum(dev)) != 0) + udev_watch_end(event->udev, event->dev_db); + } + + udev_rules_apply_to_event(rules, event, sigmask); + + /* rename a new network interface, if needed */ + if (udev_device_get_ifindex(dev) > 0 && strcmp(udev_device_get_action(dev), "add") == 0 && + event->name != NULL && strcmp(event->name, udev_device_get_sysname(dev)) != 0) { + char syspath[UTIL_PATH_SIZE]; + char *pos; + + err = rename_netif(event); + if (err == 0) { + info(event->udev, "renamed netif to '%s'\n", event->name); + + /* remember old name */ + udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); + + /* now change the devpath, because the kernel device name has changed */ + util_strscpy(syspath, sizeof(syspath), udev_device_get_syspath(dev)); + pos = strrchr(syspath, '/'); + if (pos != NULL) { + pos++; + util_strscpy(pos, sizeof(syspath) - (pos - syspath), event->name); + udev_device_set_syspath(event->dev, syspath); + udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); + info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); + } + } + } + + if (major(udev_device_get_devnum(dev)) != 0) { + /* remove/update possible left-over symlinks from old database entry */ + if (event->dev_db != NULL) + udev_node_update_old_links(dev, event->dev_db); + + if (!event->mode_set) { + if (udev_device_get_devnode_mode(dev) > 0) { + /* kernel supplied value */ + event->mode = udev_device_get_devnode_mode(dev); + } else if (event->gid > 0) { + /* default 0660 if a group is assigned */ + event->mode = 0660; + } else { + /* default 0600 */ + event->mode = 0600; + } + } + + err = udev_node_add(dev, event->mode, event->uid, event->gid); + } + + /* preserve old, or get new initialization timestamp */ + if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0) + udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db)); + else if (udev_device_get_usec_initialized(event->dev) == 0) + udev_device_set_usec_initialized(event->dev, now_usec()); + + /* (re)write database file */ + udev_device_update_db(dev); + udev_device_tag_index(dev, event->dev_db, true); + udev_device_set_is_initialized(dev); + + udev_device_unref(event->dev_db); + event->dev_db = NULL; + } +out: + return err; +} + +int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) +{ + struct udev_list_entry *list_entry; + int err = 0; + + dbg(event->udev, "executing run list\n"); + udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { + const char *cmd = udev_list_entry_get_name(list_entry); + + if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { + struct udev_monitor *monitor; + + monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); + if (monitor == NULL) + continue; + udev_monitor_send_device(monitor, NULL, event->dev); + udev_monitor_unref(monitor); + } else { + char program[UTIL_PATH_SIZE]; + char **envp; + + if (event->exec_delay > 0) { + info(event->udev, "delay execution of '%s'\n", program); + sleep(event->exec_delay); + } + + udev_event_apply_format(event, cmd, program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + if (udev_event_spawn(event, program, envp, sigmask, NULL, 0) < 0) { + if (udev_list_entry_get_num(list_entry)) + err = -1; + } + } + } + return err; +} diff --git a/src/udev-kernel.socket b/src/udev-kernel.socket new file mode 100644 index 0000000000..23fa9d5e11 --- /dev/null +++ b/src/udev-kernel.socket @@ -0,0 +1,10 @@ +[Unit] +Description=udev Kernel Socket +DefaultDependencies=no +ConditionCapability=CAP_MKNOD + +[Socket] +Service=udev.service +ReceiveBuffer=134217728 +ListenNetlink=kobject-uevent 1 +PassCredentials=yes diff --git a/src/udev-node.c b/src/udev-node.c new file mode 100644 index 0000000000..31046bd713 --- /dev/null +++ b/src/udev-node.c @@ -0,0 +1,385 @@ +/* + * Copyright (C) 2003-2010 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +#define TMP_FILE_EXT ".udev-tmp" + +static int node_symlink(struct udev *udev, const char *node, const char *slink) +{ + struct stat stats; + char target[UTIL_PATH_SIZE]; + char *s; + size_t l; + char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; + int i = 0; + int tail = 0; + int err = 0; + + /* use relative link */ + target[0] = '\0'; + while (node[i] && (node[i] == slink[i])) { + if (node[i] == '/') + tail = i+1; + i++; + } + s = target; + l = sizeof(target); + while (slink[i] != '\0') { + if (slink[i] == '/') + l = util_strpcpy(&s, l, "../"); + i++; + } + l = util_strscpy(s, l, &node[tail]); + if (l == 0) { + err = -EINVAL; + goto exit; + } + + /* preserve link with correct target, do not replace node of other device */ + if (lstat(slink, &stats) == 0) { + if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { + struct stat stats2; + + info(udev, "found existing node instead of symlink '%s'\n", slink); + if (lstat(node, &stats2) == 0) { + if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && + stats.st_rdev == stats2.st_rdev && stats.st_ino != stats2.st_ino) { + info(udev, "replace device node '%s' with symlink to our node '%s'\n", + slink, node); + } else { + err(udev, "device node '%s' already exists, " + "link to '%s' will not overwrite it\n", + slink, node); + goto exit; + } + } + } else if (S_ISLNK(stats.st_mode)) { + char buf[UTIL_PATH_SIZE]; + int len; + + dbg(udev, "found existing symlink '%s'\n", slink); + len = readlink(slink, buf, sizeof(buf)); + if (len > 0 && len < (int)sizeof(buf)) { + buf[len] = '\0'; + if (strcmp(target, buf) == 0) { + info(udev, "preserve already existing symlink '%s' to '%s'\n", + slink, target); + udev_selinux_lsetfilecon(udev, slink, S_IFLNK); + utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); + goto exit; + } + } + } + } else { + info(udev, "creating symlink '%s' to '%s'\n", slink, target); + do { + err = util_create_path_selinux(udev, slink); + if (err != 0 && err != -ENOENT) + break; + udev_selinux_setfscreatecon(udev, slink, S_IFLNK); + err = symlink(target, slink); + if (err != 0) + err = -errno; + udev_selinux_resetfscreatecon(udev); + } while (err == -ENOENT); + if (err == 0) + goto exit; + } + + info(udev, "atomically replace '%s'\n", slink); + util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); + unlink(slink_tmp); + do { + err = util_create_path_selinux(udev, slink_tmp); + if (err != 0 && err != -ENOENT) + break; + udev_selinux_setfscreatecon(udev, slink_tmp, S_IFLNK); + err = symlink(target, slink_tmp); + if (err != 0) + err = -errno; + udev_selinux_resetfscreatecon(udev); + } while (err == -ENOENT); + if (err != 0) { + err(udev, "symlink '%s' '%s' failed: %m\n", target, slink_tmp); + goto exit; + } + err = rename(slink_tmp, slink); + if (err != 0) { + err(udev, "rename '%s' '%s' failed: %m\n", slink_tmp, slink); + unlink(slink_tmp); + } +exit: + return err; +} + +/* find device node of device with highest priority */ +static const char *link_find_prioritized(struct udev_device *dev, bool add, const char *stackdir, char *buf, size_t bufsize) +{ + struct udev *udev = udev_device_get_udev(dev); + DIR *dir; + int priority = 0; + const char *target = NULL; + + if (add) { + priority = udev_device_get_devlink_priority(dev); + util_strscpy(buf, bufsize, udev_device_get_devnode(dev)); + target = buf; + } + + dir = opendir(stackdir); + if (dir == NULL) + return target; + for (;;) { + struct udev_device *dev_db; + struct dirent *dent; + + dent = readdir(dir); + if (dent == NULL || dent->d_name[0] == '\0') + break; + if (dent->d_name[0] == '.') + continue; + + info(udev, "found '%s' claiming '%s'\n", dent->d_name, stackdir); + + /* did we find ourself? */ + if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0) + continue; + + dev_db = udev_device_new_from_id_filename(udev, dent->d_name); + if (dev_db != NULL) { + const char *devnode; + + devnode = udev_device_get_devnode(dev_db); + if (devnode != NULL) { + dbg(udev, "compare priority of '%s'(%i) > '%s'(%i)\n", target, priority, + udev_device_get_devnode(dev_db), udev_device_get_devlink_priority(dev_db)); + if (target == NULL || udev_device_get_devlink_priority(dev_db) > priority) { + info(udev, "'%s' claims priority %i for '%s'\n", + udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir); + priority = udev_device_get_devlink_priority(dev_db); + util_strscpy(buf, bufsize, devnode); + target = buf; + } + } + udev_device_unref(dev_db); + } + } + closedir(dir); + return target; +} + +/* manage "stack of names" with possibly specified device priorities */ +static void link_update(struct udev_device *dev, const char *slink, bool add) +{ + struct udev *udev = udev_device_get_udev(dev); + char name_enc[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE * 2]; + char dirname[UTIL_PATH_SIZE]; + const char *target; + char buf[UTIL_PATH_SIZE]; + + dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); + + util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); + util_strscpyl(dirname, sizeof(dirname), udev_get_run_path(udev), "/links/", name_enc, NULL); + util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); + + if (!add) { + dbg(udev, "removing index: '%s'\n", filename); + if (unlink(filename) == 0) + rmdir(dirname); + } + + target = link_find_prioritized(dev, add, dirname, buf, sizeof(buf)); + if (target == NULL) { + info(udev, "no reference left, remove '%s'\n", slink); + if (unlink(slink) == 0) + util_delete_path(udev, slink); + } else { + info(udev, "creating link '%s' to '%s'\n", slink, target); + node_symlink(udev, target, slink); + } + + if (add) { + int err; + + dbg(udev, "creating index: '%s'\n", filename); + do { + int fd; + + err = util_create_path(udev, filename); + if (err != 0 && err != -ENOENT) + break; + fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); + if (fd >= 0) + close(fd); + else + err = -errno; + } while (err == -ENOENT); + } +} + +void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old) +{ + struct udev *udev = udev_device_get_udev(dev); + struct udev_list_entry *list_entry; + + /* update possible left-over symlinks */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { + const char *name = udev_list_entry_get_name(list_entry); + struct udev_list_entry *list_entry_current; + int found; + + /* check if old link name still belongs to this device */ + found = 0; + udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { + const char *name_current = udev_list_entry_get_name(list_entry_current); + + if (strcmp(name, name_current) == 0) { + found = 1; + break; + } + } + if (found) + continue; + + info(udev, "update old name, '%s' no longer belonging to '%s'\n", + name, udev_device_get_devpath(dev)); + link_update(dev, name, 0); + } +} + +static int node_fixup(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) +{ + struct udev *udev = udev_device_get_udev(dev); + const char *devnode = udev_device_get_devnode(dev); + dev_t devnum = udev_device_get_devnum(dev); + struct stat stats; + int err = 0; + + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + mode |= S_IFBLK; + else + mode |= S_IFCHR; + + if (lstat(devnode, &stats) != 0) { + err = -errno; + info(udev, "can not stat() node '%s' (%m)\n", devnode); + goto out; + } + + if (((stats.st_mode & S_IFMT) != (mode & S_IFMT)) || (stats.st_rdev != devnum)) { + err = -EEXIST; + info(udev, "found node '%s' with non-matching devnum %s, skip handling\n", + udev_device_get_devnode(dev), udev_device_get_id_filename(dev)); + goto out; + } + + if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { + info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); + chmod(devnode, mode); + chown(devnode, uid, gid); + } else { + info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); + } + + /* + * Set initial selinux file context only on add events. + * We set the proper context on bootup (triger) or for newly + * added devices, but we don't change it later, in case + * something else has set a custom context in the meantime. + */ + if (strcmp(udev_device_get_action(dev), "add") == 0) + udev_selinux_lsetfilecon(udev, devnode, mode); + + /* always update timestamp when we re-use the node, like on media change events */ + utimensat(AT_FDCWD, devnode, NULL, 0); +out: + return err; +} + +int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) +{ + struct udev *udev = udev_device_get_udev(dev); + char filename[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + int err = 0; + + info(udev, "handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d\n", + udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid); + + err = node_fixup(dev, mode, uid, gid); + if (err < 0) + goto exit; + + /* always add /dev/{block,char}/$major:$minor */ + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(udev), + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + node_symlink(udev, udev_device_get_devnode(dev), filename); + + /* create/update symlinks, add symlinks to name index */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { + if (udev_list_entry_get_num(list_entry)) + /* simple unmanaged link name */ + node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry)); + else + link_update(dev, udev_list_entry_get_name(list_entry), 1); + } +exit: + return err; +} + +int udev_node_remove(struct udev_device *dev) +{ + struct udev *udev = udev_device_get_udev(dev); + struct udev_list_entry *list_entry; + const char *devnode; + struct stat stats; + struct udev_device *dev_check; + char filename[UTIL_PATH_SIZE]; + int err = 0; + + /* remove/update symlinks, remove symlinks from name index */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) + link_update(dev, udev_list_entry_get_name(list_entry), 0); + + /* remove /dev/{block,char}/$major:$minor */ + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(udev), + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + unlink(filename); +out: + return err; +} diff --git a/src/udev-rules.c b/src/udev-rules.c new file mode 100644 index 0000000000..7e79545124 --- /dev/null +++ b/src/udev-rules.c @@ -0,0 +1,2753 @@ +/* + * Copyright (C) 2003-2010 Kay Sievers + * Copyright (C) 2008 Alan Jenkins + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +#define PREALLOC_TOKEN 2048 +#define PREALLOC_STRBUF 32 * 1024 +#define PREALLOC_TRIE 256 + +struct uid_gid { + unsigned int name_off; + union { + uid_t uid; + gid_t gid; + }; +}; + +struct trie_node { + /* this node's first child */ + unsigned int child_idx; + /* the next child of our parent node's child list */ + unsigned int next_child_idx; + /* this node's last child (shortcut for append) */ + unsigned int last_child_idx; + unsigned int value_off; + unsigned short value_len; + unsigned char key; +}; + +struct udev_rules { + struct udev *udev; + int resolve_names; + + /* every key in the rules file becomes a token */ + struct token *tokens; + unsigned int token_cur; + unsigned int token_max; + + /* all key strings are copied to a single string buffer */ + char *buf; + size_t buf_cur; + size_t buf_max; + unsigned int buf_count; + + /* during rule parsing, strings are indexed to find duplicates */ + struct trie_node *trie_nodes; + unsigned int trie_nodes_cur; + unsigned int trie_nodes_max; + + /* during rule parsing, uid/gid lookup results are cached */ + struct uid_gid *uids; + unsigned int uids_cur; + unsigned int uids_max; + struct uid_gid *gids; + unsigned int gids_cur; + unsigned int gids_max; +}; + +/* KEY=="", KEY!="", KEY+="", KEY="", KEY:="" */ +enum operation_type { + OP_UNSET, + + OP_MATCH, + OP_NOMATCH, + OP_MATCH_MAX, + + OP_ADD, + OP_ASSIGN, + OP_ASSIGN_FINAL, +}; + +enum string_glob_type { + GL_UNSET, + GL_PLAIN, /* no special chars */ + GL_GLOB, /* shell globs ?,*,[] */ + GL_SPLIT, /* multi-value A|B */ + GL_SPLIT_GLOB, /* multi-value with glob A*|B* */ + GL_SOMETHING, /* commonly used "?*" */ +}; + +enum string_subst_type { + SB_UNSET, + SB_NONE, + SB_FORMAT, + SB_SUBSYS, +}; + +/* tokens of a rule are sorted/handled in this order */ +enum token_type { + TK_UNSET, + TK_RULE, + + TK_M_ACTION, /* val */ + TK_M_DEVPATH, /* val */ + TK_M_KERNEL, /* val */ + TK_M_DEVLINK, /* val */ + TK_M_NAME, /* val */ + TK_M_ENV, /* val, attr */ + TK_M_TAG, /* val */ + TK_M_SUBSYSTEM, /* val */ + TK_M_DRIVER, /* val */ + TK_M_WAITFOR, /* val */ + TK_M_ATTR, /* val, attr */ + + TK_M_PARENTS_MIN, + TK_M_KERNELS, /* val */ + TK_M_SUBSYSTEMS, /* val */ + TK_M_DRIVERS, /* val */ + TK_M_ATTRS, /* val, attr */ + TK_M_TAGS, /* val */ + TK_M_PARENTS_MAX, + + TK_M_TEST, /* val, mode_t */ + TK_M_EVENT_TIMEOUT, /* int */ + TK_M_PROGRAM, /* val */ + TK_M_IMPORT_FILE, /* val */ + TK_M_IMPORT_PROG, /* val */ + TK_M_IMPORT_BUILTIN, /* val */ + TK_M_IMPORT_DB, /* val */ + TK_M_IMPORT_CMDLINE, /* val */ + TK_M_IMPORT_PARENT, /* val */ + TK_M_RESULT, /* val */ + TK_M_MAX, + + TK_A_STRING_ESCAPE_NONE, + TK_A_STRING_ESCAPE_REPLACE, + TK_A_DB_PERSIST, + TK_A_INOTIFY_WATCH, /* int */ + TK_A_DEVLINK_PRIO, /* int */ + TK_A_OWNER, /* val */ + TK_A_GROUP, /* val */ + TK_A_MODE, /* val */ + TK_A_OWNER_ID, /* uid_t */ + TK_A_GROUP_ID, /* gid_t */ + TK_A_MODE_ID, /* mode_t */ + TK_A_STATIC_NODE, /* val */ + TK_A_ENV, /* val, attr */ + TK_A_TAG, /* val */ + TK_A_NAME, /* val */ + TK_A_DEVLINK, /* val */ + TK_A_ATTR, /* val, attr */ + TK_A_RUN, /* val, bool */ + TK_A_GOTO, /* size_t */ + + TK_END, +}; + +/* we try to pack stuff in a way that we take only 12 bytes per token */ +struct token { + union { + unsigned char type; /* same in rule and key */ + struct { + enum token_type type:8; + bool can_set_name:1; + bool has_static_node:1; + unsigned int unused:6; + unsigned short token_count; + unsigned int label_off; + unsigned short filename_off; + unsigned short filename_line; + } rule; + struct { + enum token_type type:8; + enum operation_type op:8; + enum string_glob_type glob:8; + enum string_subst_type subst:4; + enum string_subst_type attrsubst:4; + unsigned int value_off; + union { + unsigned int attr_off; + int devlink_unique; + unsigned int rule_goto; + mode_t mode; + uid_t uid; + gid_t gid; + int devlink_prio; + int event_timeout; + int watch; + enum udev_builtin_cmd builtin_cmd; + }; + } key; + }; +}; + +#define MAX_TK 64 +struct rule_tmp { + struct udev_rules *rules; + struct token rule; + struct token token[MAX_TK]; + unsigned int token_cur; +}; + +#ifdef ENABLE_DEBUG +static const char *operation_str(enum operation_type type) +{ + static const char *operation_strs[] = { + [OP_UNSET] = "UNSET", + [OP_MATCH] = "match", + [OP_NOMATCH] = "nomatch", + [OP_MATCH_MAX] = "MATCH_MAX", + + [OP_ADD] = "add", + [OP_ASSIGN] = "assign", + [OP_ASSIGN_FINAL] = "assign-final", +} ; + + return operation_strs[type]; +} + +static const char *string_glob_str(enum string_glob_type type) +{ + static const char *string_glob_strs[] = { + [GL_UNSET] = "UNSET", + [GL_PLAIN] = "plain", + [GL_GLOB] = "glob", + [GL_SPLIT] = "split", + [GL_SPLIT_GLOB] = "split-glob", + [GL_SOMETHING] = "split-glob", + }; + + return string_glob_strs[type]; +} + +static const char *token_str(enum token_type type) +{ + static const char *token_strs[] = { + [TK_UNSET] = "UNSET", + [TK_RULE] = "RULE", + + [TK_M_ACTION] = "M ACTION", + [TK_M_DEVPATH] = "M DEVPATH", + [TK_M_KERNEL] = "M KERNEL", + [TK_M_DEVLINK] = "M DEVLINK", + [TK_M_NAME] = "M NAME", + [TK_M_ENV] = "M ENV", + [TK_M_TAG] = "M TAG", + [TK_M_SUBSYSTEM] = "M SUBSYSTEM", + [TK_M_DRIVER] = "M DRIVER", + [TK_M_WAITFOR] = "M WAITFOR", + [TK_M_ATTR] = "M ATTR", + + [TK_M_PARENTS_MIN] = "M PARENTS_MIN", + [TK_M_KERNELS] = "M KERNELS", + [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", + [TK_M_DRIVERS] = "M DRIVERS", + [TK_M_ATTRS] = "M ATTRS", + [TK_M_TAGS] = "M TAGS", + [TK_M_PARENTS_MAX] = "M PARENTS_MAX", + + [TK_M_TEST] = "M TEST", + [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", + [TK_M_PROGRAM] = "M PROGRAM", + [TK_M_IMPORT_FILE] = "M IMPORT_FILE", + [TK_M_IMPORT_PROG] = "M IMPORT_PROG", + [TK_M_IMPORT_BUILTIN] = "M IMPORT_BUILTIN", + [TK_M_IMPORT_DB] = "M IMPORT_DB", + [TK_M_IMPORT_CMDLINE] = "M IMPORT_CMDLINE", + [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", + [TK_M_RESULT] = "M RESULT", + [TK_M_MAX] = "M MAX", + + [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", + [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", + [TK_A_DB_PERSIST] = "A DB_PERSIST", + [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", + [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", + [TK_A_OWNER] = "A OWNER", + [TK_A_GROUP] = "A GROUP", + [TK_A_MODE] = "A MODE", + [TK_A_OWNER_ID] = "A OWNER_ID", + [TK_A_GROUP_ID] = "A GROUP_ID", + [TK_A_STATIC_NODE] = "A STATIC_NODE", + [TK_A_MODE_ID] = "A MODE_ID", + [TK_A_ENV] = "A ENV", + [TK_A_TAG] = "A ENV", + [TK_A_NAME] = "A NAME", + [TK_A_DEVLINK] = "A DEVLINK", + [TK_A_ATTR] = "A ATTR", + [TK_A_RUN] = "A RUN", + [TK_A_GOTO] = "A GOTO", + + [TK_END] = "END", + }; + + return token_strs[type]; +} + +static void dump_token(struct udev_rules *rules, struct token *token) +{ + enum token_type type = token->type; + enum operation_type op = token->key.op; + enum string_glob_type glob = token->key.glob; + const char *value = &rules->buf[token->key.value_off]; + const char *attr = &rules->buf[token->key.attr_off]; + + switch (type) { + case TK_RULE: + { + const char *tks_ptr = (char *)rules->tokens; + const char *tk_ptr = (char *)token; + unsigned int idx = (tk_ptr - tks_ptr) / sizeof(struct token); + + dbg(rules->udev, "* RULE %s:%u, token: %u, count: %u, label: '%s'\n", + &rules->buf[token->rule.filename_off], token->rule.filename_line, + idx, token->rule.token_count, + &rules->buf[token->rule.label_off]); + break; + } + case TK_M_ACTION: + case TK_M_DEVPATH: + case TK_M_KERNEL: + case TK_M_SUBSYSTEM: + case TK_M_DRIVER: + case TK_M_WAITFOR: + case TK_M_DEVLINK: + case TK_M_NAME: + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_TAGS: + case TK_M_PROGRAM: + case TK_M_IMPORT_FILE: + case TK_M_IMPORT_PROG: + case TK_M_IMPORT_DB: + case TK_M_IMPORT_CMDLINE: + case TK_M_IMPORT_PARENT: + case TK_M_RESULT: + case TK_A_NAME: + case TK_A_DEVLINK: + case TK_A_OWNER: + case TK_A_GROUP: + case TK_A_MODE: + case TK_A_RUN: + dbg(rules->udev, "%s %s '%s'(%s)\n", + token_str(type), operation_str(op), value, string_glob_str(glob)); + break; + case TK_M_IMPORT_BUILTIN: + dbg(rules->udev, "%s %i '%s'\n", token_str(type), token->key.builtin_cmd, value); + break; + case TK_M_ATTR: + case TK_M_ATTRS: + case TK_M_ENV: + case TK_A_ATTR: + case TK_A_ENV: + dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", + token_str(type), operation_str(op), attr, value, string_glob_str(glob)); + break; + case TK_M_TAG: + case TK_A_TAG: + dbg(rules->udev, "%s %s '%s'\n", token_str(type), operation_str(op), value); + break; + case TK_A_STRING_ESCAPE_NONE: + case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_DB_PERSIST: + dbg(rules->udev, "%s\n", token_str(type)); + break; + case TK_M_TEST: + dbg(rules->udev, "%s %s '%s'(%s) %#o\n", + token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode); + break; + case TK_A_INOTIFY_WATCH: + dbg(rules->udev, "%s %u\n", token_str(type), token->key.watch); + break; + case TK_A_DEVLINK_PRIO: + dbg(rules->udev, "%s %u\n", token_str(type), token->key.devlink_prio); + break; + case TK_A_OWNER_ID: + dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.uid); + break; + case TK_A_GROUP_ID: + dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.gid); + break; + case TK_A_MODE_ID: + dbg(rules->udev, "%s %s %#o\n", token_str(type), operation_str(op), token->key.mode); + break; + case TK_A_STATIC_NODE: + dbg(rules->udev, "%s '%s'\n", token_str(type), value); + break; + case TK_M_EVENT_TIMEOUT: + dbg(rules->udev, "%s %u\n", token_str(type), token->key.event_timeout); + break; + case TK_A_GOTO: + dbg(rules->udev, "%s '%s' %u\n", token_str(type), value, token->key.rule_goto); + break; + case TK_END: + dbg(rules->udev, "* %s\n", token_str(type)); + break; + case TK_M_PARENTS_MIN: + case TK_M_PARENTS_MAX: + case TK_M_MAX: + case TK_UNSET: + dbg(rules->udev, "unknown type %u\n", type); + break; + } +} + +static void dump_rules(struct udev_rules *rules) +{ + unsigned int i; + + dbg(rules->udev, "dumping %u (%zu bytes) tokens, %u (%zu bytes) strings\n", + rules->token_cur, + rules->token_cur * sizeof(struct token), + rules->buf_count, + rules->buf_cur); + for(i = 0; i < rules->token_cur; i++) + dump_token(rules, &rules->tokens[i]); +} +#else +static inline const char *operation_str(enum operation_type type) { return NULL; } +static inline const char *token_str(enum token_type type) { return NULL; } +static inline void dump_token(struct udev_rules *rules, struct token *token) {} +static inline void dump_rules(struct udev_rules *rules) {} +#endif /* ENABLE_DEBUG */ + +static int add_new_string(struct udev_rules *rules, const char *str, size_t bytes) +{ + int off; + + /* grow buffer if needed */ + if (rules->buf_cur + bytes+1 >= rules->buf_max) { + char *buf; + unsigned int add; + + /* double the buffer size */ + add = rules->buf_max; + if (add < bytes * 8) + add = bytes * 8; + + buf = realloc(rules->buf, rules->buf_max + add); + if (buf == NULL) + return -1; + dbg(rules->udev, "extend buffer from %zu to %zu\n", rules->buf_max, rules->buf_max + add); + rules->buf = buf; + rules->buf_max += add; + } + off = rules->buf_cur; + memcpy(&rules->buf[rules->buf_cur], str, bytes); + rules->buf_cur += bytes; + rules->buf_count++; + return off; +} + +static int add_string(struct udev_rules *rules, const char *str) +{ + unsigned int node_idx; + struct trie_node *new_node; + unsigned int new_node_idx; + unsigned char key; + unsigned short len; + unsigned int depth; + unsigned int off; + struct trie_node *parent; + + /* walk trie, start from last character of str to find matching tails */ + len = strlen(str); + key = str[len-1]; + node_idx = 0; + for (depth = 0; depth <= len; depth++) { + struct trie_node *node; + unsigned int child_idx; + + node = &rules->trie_nodes[node_idx]; + off = node->value_off + node->value_len - len; + + /* match against current node */ + if (depth == len || (node->value_len >= len && memcmp(&rules->buf[off], str, len) == 0)) + return off; + + /* lookup child node */ + key = str[len - 1 - depth]; + child_idx = node->child_idx; + while (child_idx > 0) { + struct trie_node *child; + + child = &rules->trie_nodes[child_idx]; + if (child->key == key) + break; + child_idx = child->next_child_idx; + } + if (child_idx == 0) + break; + node_idx = child_idx; + } + + /* string not found, add it */ + off = add_new_string(rules, str, len + 1); + + /* grow trie nodes if needed */ + if (rules->trie_nodes_cur >= rules->trie_nodes_max) { + struct trie_node *nodes; + unsigned int add; + + /* double the buffer size */ + add = rules->trie_nodes_max; + if (add < 8) + add = 8; + + nodes = realloc(rules->trie_nodes, (rules->trie_nodes_max + add) * sizeof(struct trie_node)); + if (nodes == NULL) + return -1; + dbg(rules->udev, "extend trie nodes from %u to %u\n", + rules->trie_nodes_max, rules->trie_nodes_max + add); + rules->trie_nodes = nodes; + rules->trie_nodes_max += add; + } + + /* get a new node */ + new_node_idx = rules->trie_nodes_cur; + rules->trie_nodes_cur++; + new_node = &rules->trie_nodes[new_node_idx]; + memset(new_node, 0x00, sizeof(struct trie_node)); + new_node->value_off = off; + new_node->value_len = len; + new_node->key = key; + + /* join the parent's child list */ + parent = &rules->trie_nodes[node_idx]; + if (parent->child_idx == 0) { + parent->child_idx = new_node_idx; + } else { + struct trie_node *last_child; + + last_child = &rules->trie_nodes[parent->last_child_idx]; + last_child->next_child_idx = new_node_idx; + } + parent->last_child_idx = new_node_idx; + return off; +} + +static int add_token(struct udev_rules *rules, struct token *token) +{ + /* grow buffer if needed */ + if (rules->token_cur+1 >= rules->token_max) { + struct token *tokens; + unsigned int add; + + /* double the buffer size */ + add = rules->token_max; + if (add < 8) + add = 8; + + tokens = realloc(rules->tokens, (rules->token_max + add ) * sizeof(struct token)); + if (tokens == NULL) + return -1; + dbg(rules->udev, "extend tokens from %u to %u\n", rules->token_max, rules->token_max + add); + rules->tokens = tokens; + rules->token_max += add; + } + memcpy(&rules->tokens[rules->token_cur], token, sizeof(struct token)); + rules->token_cur++; + return 0; +} + +static uid_t add_uid(struct udev_rules *rules, const char *owner) +{ + unsigned int i; + uid_t uid; + unsigned int off; + + /* lookup, if we know it already */ + for (i = 0; i < rules->uids_cur; i++) { + off = rules->uids[i].name_off; + if (strcmp(&rules->buf[off], owner) == 0) { + uid = rules->uids[i].uid; + dbg(rules->udev, "return existing %u for '%s'\n", uid, owner); + return uid; + } + } + uid = util_lookup_user(rules->udev, owner); + + /* grow buffer if needed */ + if (rules->uids_cur+1 >= rules->uids_max) { + struct uid_gid *uids; + unsigned int add; + + /* double the buffer size */ + add = rules->uids_max; + if (add < 1) + add = 8; + + uids = realloc(rules->uids, (rules->uids_max + add ) * sizeof(struct uid_gid)); + if (uids == NULL) + return uid; + dbg(rules->udev, "extend uids from %u to %u\n", rules->uids_max, rules->uids_max + add); + rules->uids = uids; + rules->uids_max += add; + } + rules->uids[rules->uids_cur].uid = uid; + off = add_string(rules, owner); + if (off <= 0) + return uid; + rules->uids[rules->uids_cur].name_off = off; + rules->uids_cur++; + return uid; +} + +static gid_t add_gid(struct udev_rules *rules, const char *group) +{ + unsigned int i; + gid_t gid; + unsigned int off; + + /* lookup, if we know it already */ + for (i = 0; i < rules->gids_cur; i++) { + off = rules->gids[i].name_off; + if (strcmp(&rules->buf[off], group) == 0) { + gid = rules->gids[i].gid; + dbg(rules->udev, "return existing %u for '%s'\n", gid, group); + return gid; + } + } + gid = util_lookup_group(rules->udev, group); + + /* grow buffer if needed */ + if (rules->gids_cur+1 >= rules->gids_max) { + struct uid_gid *gids; + unsigned int add; + + /* double the buffer size */ + add = rules->gids_max; + if (add < 1) + add = 8; + + gids = realloc(rules->gids, (rules->gids_max + add ) * sizeof(struct uid_gid)); + if (gids == NULL) + return gid; + dbg(rules->udev, "extend gids from %u to %u\n", rules->gids_max, rules->gids_max + add); + rules->gids = gids; + rules->gids_max += add; + } + rules->gids[rules->gids_cur].gid = gid; + off = add_string(rules, group); + if (off <= 0) + return gid; + rules->gids[rules->gids_cur].name_off = off; + rules->gids_cur++; + return gid; +} + +static int import_property_from_string(struct udev_device *dev, char *line) +{ + struct udev *udev = udev_device_get_udev(dev); + char *key; + char *val; + size_t len; + + /* find key */ + key = line; + while (isspace(key[0])) + key++; + + /* comment or empty line */ + if (key[0] == '#' || key[0] == '\0') + return -1; + + /* split key/value */ + val = strchr(key, '='); + if (val == NULL) + return -1; + val[0] = '\0'; + val++; + + /* find value */ + while (isspace(val[0])) + val++; + + /* terminate key */ + len = strlen(key); + if (len == 0) + return -1; + while (isspace(key[len-1])) + len--; + key[len] = '\0'; + + /* terminate value */ + len = strlen(val); + if (len == 0) + return -1; + while (isspace(val[len-1])) + len--; + val[len] = '\0'; + + if (len == 0) + return -1; + + /* unquote */ + if (val[0] == '"' || val[0] == '\'') { + if (val[len-1] != val[0]) { + info(udev, "inconsistent quoting: '%s', skip\n", line); + return -1; + } + val[len-1] = '\0'; + val++; + } + + dbg(udev, "adding '%s'='%s'\n", key, val); + + /* handle device, renamed by external tool, returning new path */ + if (strcmp(key, "DEVPATH") == 0) { + char syspath[UTIL_PATH_SIZE]; + + info(udev, "updating devpath from '%s' to '%s'\n", + udev_device_get_devpath(dev), val); + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), val, NULL); + udev_device_set_syspath(dev, syspath); + } else { + struct udev_list_entry *entry; + + entry = udev_device_add_property(dev, key, val); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_num(entry, true); + } + return 0; +} + +static int import_file_into_properties(struct udev_device *dev, const char *filename) +{ + FILE *f; + char line[UTIL_LINE_SIZE]; + + f = fopen(filename, "r"); + if (f == NULL) + return -1; + while (fgets(line, sizeof(line), f) != NULL) + import_property_from_string(dev, line); + fclose(f); + return 0; +} + +static int import_program_into_properties(struct udev_event *event, const char *program, const sigset_t *sigmask) +{ + struct udev_device *dev = event->dev; + char **envp; + char result[UTIL_LINE_SIZE]; + char *line; + int err; + + envp = udev_device_get_properties_envp(dev); + err = udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)); + if (err < 0) + return err; + + line = result; + while (line != NULL) { + char *pos; + + pos = strchr(line, '\n'); + if (pos != NULL) { + pos[0] = '\0'; + pos = &pos[1]; + } + import_property_from_string(dev, line); + line = pos; + } + return 0; +} + +static int import_parent_into_properties(struct udev_device *dev, const char *filter) +{ + struct udev *udev = udev_device_get_udev(dev); + struct udev_device *dev_parent; + struct udev_list_entry *list_entry; + + dev_parent = udev_device_get_parent(dev); + if (dev_parent == NULL) + return -1; + + dbg(udev, "found parent '%s', get the node name\n", udev_device_get_syspath(dev_parent)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev_parent)) { + const char *key = udev_list_entry_get_name(list_entry); + const char *val = udev_list_entry_get_value(list_entry); + + if (fnmatch(filter, key, 0) == 0) { + struct udev_list_entry *entry; + + dbg(udev, "import key '%s=%s'\n", key, val); + entry = udev_device_add_property(dev, key, val); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_num(entry, true); + } + } + return 0; +} + +#define WAIT_LOOP_PER_SECOND 50 +static int wait_for_file(struct udev_device *dev, const char *file, int timeout) +{ + struct udev *udev = udev_device_get_udev(dev); + char filepath[UTIL_PATH_SIZE]; + char devicepath[UTIL_PATH_SIZE]; + struct stat stats; + int loop = timeout * WAIT_LOOP_PER_SECOND; + + /* a relative path is a device attribute */ + devicepath[0] = '\0'; + if (file[0] != '/') { + util_strscpyl(devicepath, sizeof(devicepath), + udev_get_sys_path(udev), udev_device_get_devpath(dev), NULL); + util_strscpyl(filepath, sizeof(filepath), devicepath, "/", file, NULL); + file = filepath; + } + + dbg(udev, "will wait %i sec for '%s'\n", timeout, file); + while (--loop) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / WAIT_LOOP_PER_SECOND }; + + /* lookup file */ + if (stat(file, &stats) == 0) { + info(udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + return 0; + } + /* make sure, the device did not disappear in the meantime */ + if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { + info(udev, "device disappeared while waiting for '%s'\n", file); + return -2; + } + info(udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); + nanosleep(&duration, NULL); + } + info(udev, "waiting for '%s' failed\n", file); + return -1; +} + +static int attr_subst_subdir(char *attr, size_t len) +{ + bool found = false; + + if (strstr(attr, "/*/")) { + char *pos; + char dirname[UTIL_PATH_SIZE]; + const char *tail; + DIR *dir; + + util_strscpy(dirname, sizeof(dirname), attr); + pos = strstr(dirname, "/*/"); + if (pos == NULL) + return -1; + pos[0] = '\0'; + tail = &pos[2]; + dir = opendir(dirname); + if (dir != NULL) { + struct dirent *dent; + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + util_strscpyl(attr, len, dirname, "/", dent->d_name, tail, NULL); + if (stat(attr, &stats) == 0) { + found = true; + break; + } + } + closedir(dir); + } + } + + return found; +} + +static int get_key(struct udev *udev, char **line, char **key, enum operation_type *op, char **value) +{ + char *linepos; + char *temp; + + linepos = *line; + if (linepos == NULL || linepos[0] == '\0') + return -1; + + /* skip whitespace */ + while (isspace(linepos[0]) || linepos[0] == ',') + linepos++; + + /* get the key */ + if (linepos[0] == '\0') + return -1; + *key = linepos; + + for (;;) { + linepos++; + if (linepos[0] == '\0') + return -1; + if (isspace(linepos[0])) + break; + if (linepos[0] == '=') + break; + if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) + if (linepos[1] == '=') + break; + } + + /* remember end of key */ + temp = linepos; + + /* skip whitespace after key */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get operation type */ + if (linepos[0] == '=' && linepos[1] == '=') { + *op = OP_MATCH; + linepos += 2; + } else if (linepos[0] == '!' && linepos[1] == '=') { + *op = OP_NOMATCH; + linepos += 2; + } else if (linepos[0] == '+' && linepos[1] == '=') { + *op = OP_ADD; + linepos += 2; + } else if (linepos[0] == '=') { + *op = OP_ASSIGN; + linepos++; + } else if (linepos[0] == ':' && linepos[1] == '=') { + *op = OP_ASSIGN_FINAL; + linepos += 2; + } else + return -1; + + /* terminate key */ + temp[0] = '\0'; + + /* skip whitespace after operator */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get the value */ + if (linepos[0] == '"') + linepos++; + else + return -1; + *value = linepos; + + /* terminate */ + temp = strchr(linepos, '"'); + if (!temp) + return -1; + temp[0] = '\0'; + temp++; + dbg(udev, "%s '%s'-'%s'\n", operation_str(*op), *key, *value); + + /* move line to next key */ + *line = temp; + return 0; +} + +/* extract possible KEY{attr} */ +static char *get_key_attribute(struct udev *udev, char *str) +{ + char *pos; + char *attr; + + attr = strchr(str, '{'); + if (attr != NULL) { + attr++; + pos = strchr(attr, '}'); + if (pos == NULL) { + err(udev, "missing closing brace for format\n"); + return NULL; + } + pos[0] = '\0'; + dbg(udev, "attribute='%s'\n", attr); + return attr; + } + return NULL; +} + +static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, + enum operation_type op, + const char *value, const void *data) +{ + struct token *token = &rule_tmp->token[rule_tmp->token_cur]; + const char *attr = NULL; + + memset(token, 0x00, sizeof(struct token)); + + switch (type) { + case TK_M_ACTION: + case TK_M_DEVPATH: + case TK_M_KERNEL: + case TK_M_SUBSYSTEM: + case TK_M_DRIVER: + case TK_M_WAITFOR: + case TK_M_DEVLINK: + case TK_M_NAME: + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_TAGS: + case TK_M_PROGRAM: + case TK_M_IMPORT_FILE: + case TK_M_IMPORT_PROG: + case TK_M_IMPORT_DB: + case TK_M_IMPORT_CMDLINE: + case TK_M_IMPORT_PARENT: + case TK_M_RESULT: + case TK_A_OWNER: + case TK_A_GROUP: + case TK_A_MODE: + case TK_A_NAME: + case TK_A_GOTO: + case TK_M_TAG: + case TK_A_TAG: + token->key.value_off = add_string(rule_tmp->rules, value); + break; + case TK_M_IMPORT_BUILTIN: + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.builtin_cmd = *(enum udev_builtin_cmd *)data; + break; + case TK_M_ENV: + case TK_M_ATTR: + case TK_M_ATTRS: + case TK_A_ATTR: + case TK_A_ENV: + attr = data; + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.attr_off = add_string(rule_tmp->rules, attr); + break; + case TK_A_DEVLINK: + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.devlink_unique = *(int *)data; + break; + case TK_M_TEST: + token->key.value_off = add_string(rule_tmp->rules, value); + if (data != NULL) + token->key.mode = *(mode_t *)data; + break; + case TK_A_STRING_ESCAPE_NONE: + case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_DB_PERSIST: + break; + case TK_A_RUN: + token->key.value_off = add_string(rule_tmp->rules, value); + break; + case TK_A_INOTIFY_WATCH: + case TK_A_DEVLINK_PRIO: + token->key.devlink_prio = *(int *)data; + break; + case TK_A_OWNER_ID: + token->key.uid = *(uid_t *)data; + break; + case TK_A_GROUP_ID: + token->key.gid = *(gid_t *)data; + break; + case TK_A_MODE_ID: + token->key.mode = *(mode_t *)data; + break; + case TK_A_STATIC_NODE: + token->key.value_off = add_string(rule_tmp->rules, value); + break; + case TK_M_EVENT_TIMEOUT: + token->key.event_timeout = *(int *)data; + break; + case TK_RULE: + case TK_M_PARENTS_MIN: + case TK_M_PARENTS_MAX: + case TK_M_MAX: + case TK_END: + case TK_UNSET: + err(rule_tmp->rules->udev, "wrong type %u\n", type); + return -1; + } + + if (value != NULL && type < TK_M_MAX) { + /* check if we need to split or call fnmatch() while matching rules */ + enum string_glob_type glob; + int has_split; + int has_glob; + + has_split = (strchr(value, '|') != NULL); + has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || strchr(value, '[') != NULL); + if (has_split && has_glob) { + glob = GL_SPLIT_GLOB; + } else if (has_split) { + glob = GL_SPLIT; + } else if (has_glob) { + if (strcmp(value, "?*") == 0) + glob = GL_SOMETHING; + else + glob = GL_GLOB; + } else { + glob = GL_PLAIN; + } + token->key.glob = glob; + } + + if (value != NULL && type > TK_M_MAX) { + /* check if assigned value has substitution chars */ + if (value[0] == '[') + token->key.subst = SB_SUBSYS; + else if (strchr(value, '%') != NULL || strchr(value, '$') != NULL) + token->key.subst = SB_FORMAT; + else + token->key.subst = SB_NONE; + } + + if (attr != NULL) { + /* check if property/attribut name has substitution chars */ + if (attr[0] == '[') + token->key.attrsubst = SB_SUBSYS; + else if (strchr(attr, '%') != NULL || strchr(attr, '$') != NULL) + token->key.attrsubst = SB_FORMAT; + else + token->key.attrsubst = SB_NONE; + } + + token->key.type = type; + token->key.op = op; + rule_tmp->token_cur++; + if (rule_tmp->token_cur >= ARRAY_SIZE(rule_tmp->token)) { + err(rule_tmp->rules->udev, "temporary rule array too small\n"); + return -1; + } + return 0; +} + +static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) +{ + unsigned int i; + unsigned int start = 0; + unsigned int end = rule_tmp->token_cur; + + for (i = 0; i < rule_tmp->token_cur; i++) { + enum token_type next_val = TK_UNSET; + unsigned int next_idx = 0; + unsigned int j; + + /* find smallest value */ + for (j = start; j < end; j++) { + if (rule_tmp->token[j].type == TK_UNSET) + continue; + if (next_val == TK_UNSET || rule_tmp->token[j].type < next_val) { + next_val = rule_tmp->token[j].type; + next_idx = j; + } + } + + /* add token and mark done */ + if (add_token(rules, &rule_tmp->token[next_idx]) != 0) + return -1; + rule_tmp->token[next_idx].type = TK_UNSET; + + /* shrink range */ + if (next_idx == start) + start++; + if (next_idx+1 == end) + end--; + } + return 0; +} + +static int add_rule(struct udev_rules *rules, char *line, + const char *filename, unsigned int filename_off, unsigned int lineno) +{ + char *linepos; + char *attr; + struct rule_tmp rule_tmp; + + memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); + rule_tmp.rules = rules; + rule_tmp.rule.type = TK_RULE; + rule_tmp.rule.rule.filename_off = filename_off; + rule_tmp.rule.rule.filename_line = lineno; + + linepos = line; + for (;;) { + char *key; + char *value; + enum operation_type op; + + if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) + break; + + if (strcmp(key, "ACTION") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid ACTION operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_ACTION, op, value, NULL); + continue; + } + + if (strcmp(key, "DEVPATH") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid DEVPATH operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_DEVPATH, op, value, NULL); + continue; + } + + if (strcmp(key, "KERNEL") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid KERNEL operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_KERNEL, op, value, NULL); + continue; + } + + if (strcmp(key, "SUBSYSTEM") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid SUBSYSTEM operation\n"); + goto invalid; + } + /* bus, class, subsystem events should all be the same */ + if (strcmp(value, "subsystem") == 0 || + strcmp(value, "bus") == 0 || + strcmp(value, "class") == 0) { + if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) + err(rules->udev, "'%s' must be specified as 'subsystem' \n" + "please fix it in %s:%u", value, filename, lineno); + rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, "subsystem|class|bus", NULL); + } else + rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, value, NULL); + continue; + } + + if (strcmp(key, "DRIVER") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid DRIVER operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_DRIVER, op, value, NULL); + continue; + } + + if (strncmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { + attr = get_key_attribute(rules->udev, key + sizeof("ATTR")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ATTR attribute\n"); + goto invalid; + } + if (op < OP_MATCH_MAX) { + rule_add_key(&rule_tmp, TK_M_ATTR, op, value, attr); + } else { + rule_add_key(&rule_tmp, TK_A_ATTR, op, value, attr); + } + continue; + } + + if (strcmp(key, "KERNELS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid KERNELS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL); + continue; + } + + if (strcmp(key, "SUBSYSTEMS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid SUBSYSTEMS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); + continue; + } + + if (strcmp(key, "DRIVERS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid DRIVERS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_DRIVERS, op, value, NULL); + continue; + } + + if (strncmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid ATTRS operation\n"); + goto invalid; + } + attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ATTRS attribute\n"); + goto invalid; + } + if (strncmp(attr, "device/", 7) == 0) + err(rules->udev, "the 'device' link may not be available in a future kernel, " + "please fix it in %s:%u", filename, lineno); + else if (strstr(attr, "../") != NULL) + err(rules->udev, "do not reference parent sysfs directories directly, " + "it may break with a future kernel, please fix it in %s:%u", filename, lineno); + rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr); + continue; + } + + if (strcmp(key, "TAGS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid TAGS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_TAGS, op, value, NULL); + continue; + } + + if (strncmp(key, "ENV{", sizeof("ENV{")-1) == 0) { + attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ENV attribute\n"); + goto invalid; + } + if (op < OP_MATCH_MAX) { + if (rule_add_key(&rule_tmp, TK_M_ENV, op, value, attr) != 0) + goto invalid; + } else { + static const char *blacklist[] = { + "ACTION", + "SUBSYSTEM", + "DEVTYPE", + "MAJOR", + "MINOR", + "DRIVER", + "IFINDEX", + "DEVNAME", + "DEVLINKS", + "DEVPATH", + "TAGS", + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(blacklist); i++) + if (strcmp(attr, blacklist[i]) == 0) { + err(rules->udev, "invalid ENV attribute, '%s' can not be set %s:%u\n", attr, filename, lineno); + continue; + } + if (rule_add_key(&rule_tmp, TK_A_ENV, op, value, attr) != 0) + goto invalid; + } + continue; + } + + if (strcmp(key, "TAG") == 0) { + if (op < OP_MATCH_MAX) + rule_add_key(&rule_tmp, TK_M_TAG, op, value, NULL); + else + rule_add_key(&rule_tmp, TK_A_TAG, op, value, NULL); + continue; + } + + if (strcmp(key, "PROGRAM") == 0) { + rule_add_key(&rule_tmp, TK_M_PROGRAM, op, value, NULL); + continue; + } + + if (strcmp(key, "RESULT") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid RESULT operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_RESULT, op, value, NULL); + continue; + } + + if (strncmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { + attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1); + if (attr == NULL) { + err(rules->udev, "IMPORT{} type missing, ignoring IMPORT %s:%u\n", filename, lineno); + continue; + } + if (strstr(attr, "program")) { + /* find known built-in command */ + if (value[0] != '/') { + enum udev_builtin_cmd cmd; + + cmd = udev_builtin_lookup(value); + if (cmd < UDEV_BUILTIN_MAX) { + info(rules->udev, "IMPORT found builtin '%s', replacing %s:%u\n", + value, filename, lineno); + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); + continue; + } + } + dbg(rules->udev, "IMPORT will be executed\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); + } else if (strstr(attr, "builtin")) { + enum udev_builtin_cmd cmd = udev_builtin_lookup(value); + + dbg(rules->udev, "IMPORT execute builtin\n"); + if (cmd < UDEV_BUILTIN_MAX) + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); + else + err(rules->udev, "IMPORT{builtin}: '%s' unknown %s:%u\n", value, filename, lineno); + } else if (strstr(attr, "file")) { + dbg(rules->udev, "IMPORT will be included as file\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); + } else if (strstr(attr, "db")) { + dbg(rules->udev, "IMPORT will include db values\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_DB, op, value, NULL); + } else if (strstr(attr, "cmdline")) { + dbg(rules->udev, "IMPORT will include db values\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_CMDLINE, op, value, NULL); + } else if (strstr(attr, "parent")) { + dbg(rules->udev, "IMPORT will include the parent values\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); + } + continue; + } + + if (strncmp(key, "TEST", sizeof("TEST")-1) == 0) { + mode_t mode = 0; + + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid TEST operation\n"); + goto invalid; + } + attr = get_key_attribute(rules->udev, key + sizeof("TEST")-1); + if (attr != NULL) { + mode = strtol(attr, NULL, 8); + rule_add_key(&rule_tmp, TK_M_TEST, op, value, &mode); + } else { + rule_add_key(&rule_tmp, TK_M_TEST, op, value, NULL); + } + continue; + } + + if (strcmp(key, "RUN") == 0) { + rule_add_key(&rule_tmp, TK_A_RUN, op, value, NULL); + continue; + } + + if (strcmp(key, "WAIT_FOR") == 0 || strcmp(key, "WAIT_FOR_SYSFS") == 0) { + rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL); + continue; + } + + if (strcmp(key, "LABEL") == 0) { + rule_tmp.rule.rule.label_off = add_string(rules, value); + continue; + } + + if (strcmp(key, "GOTO") == 0) { + rule_add_key(&rule_tmp, TK_A_GOTO, 0, value, NULL); + continue; + } + + if (strncmp(key, "NAME", sizeof("NAME")-1) == 0) { + if (op < OP_MATCH_MAX) { + rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL); + } else { + if (strcmp(value, "%k") == 0) { + err(rules->udev, "NAME=\"%%k\" is ignored, because it breaks kernel supplied names, " + "please remove it from %s:%u\n", filename, lineno); + continue; + } + if (value[0] == '\0') { + info(rules->udev, "NAME=\"\" is ignored, because udev will not delete any device nodes, " + "please remove it from %s:%u\n", filename, lineno); + continue; + } + rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); + } + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strncmp(key, "SYMLINK", sizeof("SYMLINK")-1) == 0) { + if (op < OP_MATCH_MAX) { + rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL); + } else { + int flag = 0; + + attr = get_key_attribute(rules->udev, key + sizeof("SYMLINK")-1); + if (attr != NULL && strstr(attr, "unique") != NULL) + flag = 1; + rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, &flag); + } + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strcmp(key, "OWNER") == 0) { + uid_t uid; + char *endptr; + + uid = strtoul(value, &endptr, 10); + if (endptr[0] == '\0') { + rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); + } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { + uid = add_uid(rules, value); + rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); + } else if (rules->resolve_names >= 0) { + rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL); + } + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strcmp(key, "GROUP") == 0) { + gid_t gid; + char *endptr; + + gid = strtoul(value, &endptr, 10); + if (endptr[0] == '\0') { + rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); + } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { + gid = add_gid(rules, value); + rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); + } else if (rules->resolve_names >= 0) { + rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL); + } + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strcmp(key, "MODE") == 0) { + mode_t mode; + char *endptr; + + mode = strtol(value, &endptr, 8); + if (endptr[0] == '\0') + rule_add_key(&rule_tmp, TK_A_MODE_ID, op, NULL, &mode); + else + rule_add_key(&rule_tmp, TK_A_MODE, op, value, NULL); + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strcmp(key, "OPTIONS") == 0) { + const char *pos; + + pos = strstr(value, "link_priority="); + if (pos != NULL) { + int prio = atoi(&pos[strlen("link_priority=")]); + + rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); + dbg(rules->udev, "link priority=%i\n", prio); + } + + pos = strstr(value, "event_timeout="); + if (pos != NULL) { + int tout = atoi(&pos[strlen("event_timeout=")]); + + rule_add_key(&rule_tmp, TK_M_EVENT_TIMEOUT, op, NULL, &tout); + dbg(rules->udev, "event timeout=%i\n", tout); + } + + pos = strstr(value, "string_escape="); + if (pos != NULL) { + pos = &pos[strlen("string_escape=")]; + if (strncmp(pos, "none", strlen("none")) == 0) + rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_NONE, op, NULL, NULL); + else if (strncmp(pos, "replace", strlen("replace")) == 0) + rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, op, NULL, NULL); + } + + pos = strstr(value, "db_persist"); + if (pos != NULL) + rule_add_key(&rule_tmp, TK_A_DB_PERSIST, op, NULL, NULL); + + pos = strstr(value, "nowatch"); + if (pos != NULL) { + const int off = 0; + + rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &off); + dbg(rules->udev, "inotify watch of device disabled\n"); + } else { + pos = strstr(value, "watch"); + if (pos != NULL) { + const int on = 1; + + rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &on); + dbg(rules->udev, "inotify watch of device requested\n"); + } + } + + pos = strstr(value, "static_node="); + if (pos != NULL) { + rule_add_key(&rule_tmp, TK_A_STATIC_NODE, op, &pos[strlen("static_node=")], NULL); + rule_tmp.rule.rule.has_static_node = true; + } + + continue; + } + + err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); + goto invalid; + } + + /* add rule token */ + rule_tmp.rule.rule.token_count = 1 + rule_tmp.token_cur; + if (add_token(rules, &rule_tmp.rule) != 0) + goto invalid; + + /* add tokens to list, sorted by type */ + if (sort_token(rules, &rule_tmp) != 0) + goto invalid; + + return 0; +invalid: + err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); + return -1; +} + +static int parse_file(struct udev_rules *rules, const char *filename, unsigned short filename_off) +{ + FILE *f; + unsigned int first_token; + char line[UTIL_LINE_SIZE]; + int line_nr = 0; + unsigned int i; + + info(rules->udev, "reading '%s' as rules file\n", filename); + + f = fopen(filename, "r"); + if (f == NULL) + return -1; + + first_token = rules->token_cur; + + while (fgets(line, sizeof(line), f) != NULL) { + char *key; + size_t len; + + /* skip whitespace */ + line_nr++; + key = line; + while (isspace(key[0])) + key++; + + /* comment */ + if (key[0] == '#') + continue; + + len = strlen(line); + if (len < 3) + continue; + + /* continue reading if backslash+newline is found */ + while (line[len-2] == '\\') { + if (fgets(&line[len-2], (sizeof(line)-len)+2, f) == NULL) + break; + if (strlen(&line[len-2]) < 2) + break; + line_nr++; + len = strlen(line); + } + + if (len+1 >= sizeof(line)) { + err(rules->udev, "line too long '%s':%u, ignored\n", filename, line_nr); + continue; + } + add_rule(rules, key, filename, filename_off, line_nr); + } + fclose(f); + + /* link GOTOs to LABEL rules in this file to be able to fast-forward */ + for (i = first_token+1; i < rules->token_cur; i++) { + if (rules->tokens[i].type == TK_A_GOTO) { + char *label = &rules->buf[rules->tokens[i].key.value_off]; + unsigned int j; + + for (j = i+1; j < rules->token_cur; j++) { + if (rules->tokens[j].type != TK_RULE) + continue; + if (rules->tokens[j].rule.label_off == 0) + continue; + if (strcmp(label, &rules->buf[rules->tokens[j].rule.label_off]) != 0) + continue; + rules->tokens[i].key.rule_goto = j; + break; + } + if (rules->tokens[i].key.rule_goto == 0) + err(rules->udev, "GOTO '%s' has no matching label in: '%s'\n", label, filename); + } + } + return 0; +} + +static int add_matching_files(struct udev *udev, struct udev_list *file_list, const char *dirname, const char *suffix) +{ + DIR *dir; + struct dirent *dent; + char filename[UTIL_PATH_SIZE]; + + dbg(udev, "open directory '%s'\n", dirname); + dir = opendir(dirname); + if (dir == NULL) { + info(udev, "unable to open '%s': %m\n", dirname); + return -1; + } + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + + /* look for file matching with specified suffix */ + if (suffix != NULL) { + const char *ext; + + ext = strrchr(dent->d_name, '.'); + if (ext == NULL) + continue; + if (strcmp(ext, suffix) != 0) + continue; + } + util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL); + dbg(udev, "put file '%s' into list\n", filename); + /* + * the basename is the key, the filename the value + * identical basenames from different directories overwrite each other + * entries are sorted after basename + */ + udev_list_entry_add(file_list, dent->d_name, filename); + } + + closedir(dir); + return 0; +} + +struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) +{ + struct udev_rules *rules; + struct udev_list file_list; + struct udev_list_entry *file_loop; + struct token end_token; + char **s; + + rules = calloc(1, sizeof(struct udev_rules)); + if (rules == NULL) + return NULL; + rules->udev = udev; + rules->resolve_names = resolve_names; + udev_list_init(udev, &file_list, true); + + /* init token array and string buffer */ + rules->tokens = malloc(PREALLOC_TOKEN * sizeof(struct token)); + if (rules->tokens == NULL) { + free(rules); + return NULL; + } + rules->token_max = PREALLOC_TOKEN; + + rules->buf = malloc(PREALLOC_STRBUF); + if (rules->buf == NULL) { + free(rules->tokens); + free(rules); + return NULL; + } + rules->buf_max = PREALLOC_STRBUF; + /* offset 0 is always '\0' */ + rules->buf[0] = '\0'; + rules->buf_cur = 1; + dbg(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); + + rules->trie_nodes = malloc(PREALLOC_TRIE * sizeof(struct trie_node)); + if (rules->trie_nodes == NULL) { + free(rules->buf); + free(rules->tokens); + free(rules); + return NULL; + } + rules->trie_nodes_max = PREALLOC_TRIE; + /* offset 0 is the trie root, with an empty string */ + memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); + rules->trie_nodes_cur = 1; + + for (udev_get_rules_path(udev, &s, NULL); *s != NULL; s++) + add_matching_files(udev, &file_list, *s, ".rules"); + + /* add all filenames to the string buffer */ + udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { + const char *filename = udev_list_entry_get_value(file_loop); + unsigned int filename_off; + + filename_off = add_string(rules, filename); + /* the offset in the rule is limited to unsigned short */ + if (filename_off < USHRT_MAX) + udev_list_entry_set_num(file_loop, filename_off); + } + + /* parse all rules files */ + udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { + const char *filename = udev_list_entry_get_value(file_loop); + unsigned int filename_off = udev_list_entry_get_num(file_loop); + struct stat st; + + if (stat(filename, &st) != 0) { + err(udev, "can not find '%s': %m\n", filename); + continue; + } + if (S_ISREG(st.st_mode) && st.st_size <= 0) { + info(udev, "ignore empty '%s'\n", filename); + continue; + } + if (S_ISCHR(st.st_mode)) { + info(udev, "ignore masked '%s'\n", filename); + continue; + } + parse_file(rules, filename, filename_off); + } + udev_list_cleanup(&file_list); + + memset(&end_token, 0x00, sizeof(struct token)); + end_token.type = TK_END; + add_token(rules, &end_token); + + /* shrink allocated token and string buffer */ + if (rules->token_cur < rules->token_max) { + struct token *tokens; + + tokens = realloc(rules->tokens, rules->token_cur * sizeof(struct token)); + if (tokens != NULL || rules->token_cur == 0) { + rules->tokens = tokens; + rules->token_max = rules->token_cur; + } + } + if (rules->buf_cur < rules->buf_max) { + char *buf; + + buf = realloc(rules->buf, rules->buf_cur); + if (buf != NULL || rules->buf_cur == 0) { + rules->buf = buf; + rules->buf_max = rules->buf_cur; + } + } + info(udev, "rules use %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); + info(udev, "temporary index used %zu bytes (%u * %zu bytes)\n", + rules->trie_nodes_cur * sizeof(struct trie_node), + rules->trie_nodes_cur, sizeof(struct trie_node)); + + /* cleanup trie */ + free(rules->trie_nodes); + rules->trie_nodes = NULL; + rules->trie_nodes_cur = 0; + rules->trie_nodes_max = 0; + + /* cleanup uid/gid cache */ + free(rules->uids); + rules->uids = NULL; + rules->uids_cur = 0; + rules->uids_max = 0; + free(rules->gids); + rules->gids = NULL; + rules->gids_cur = 0; + rules->gids_max = 0; + + dump_rules(rules); + return rules; +} + +struct udev_rules *udev_rules_unref(struct udev_rules *rules) +{ + if (rules == NULL) + return NULL; + free(rules->tokens); + free(rules->buf); + free(rules->trie_nodes); + free(rules->uids); + free(rules->gids); + free(rules); + return NULL; +} + +static int match_key(struct udev_rules *rules, struct token *token, const char *val) +{ + char *key_value = &rules->buf[token->key.value_off]; + char *pos; + bool match = false; + + if (val == NULL) + val = ""; + + switch (token->key.glob) { + case GL_PLAIN: + match = (strcmp(key_value, val) == 0); + break; + case GL_GLOB: + match = (fnmatch(key_value, val, 0) == 0); + break; + case GL_SPLIT: + { + const char *split; + size_t len; + + split = &rules->buf[token->key.value_off]; + len = strlen(val); + for (;;) { + const char *next; + + next = strchr(split, '|'); + if (next != NULL) { + size_t matchlen = (size_t)(next - split); + + match = (matchlen == len && strncmp(split, val, matchlen) == 0); + if (match) + break; + } else { + match = (strcmp(split, val) == 0); + break; + } + split = &next[1]; + } + break; + } + case GL_SPLIT_GLOB: + { + char value[UTIL_PATH_SIZE]; + + util_strscpy(value, sizeof(value), &rules->buf[token->key.value_off]); + key_value = value; + while (key_value != NULL) { + pos = strchr(key_value, '|'); + if (pos != NULL) { + pos[0] = '\0'; + pos = &pos[1]; + } + dbg(rules->udev, "match %s '%s' <-> '%s'\n", token_str(token->type), key_value, val); + match = (fnmatch(key_value, val, 0) == 0); + if (match) + break; + key_value = pos; + } + break; + } + case GL_SOMETHING: + match = (val[0] != '\0'); + break; + case GL_UNSET: + return -1; + } + + if (match && (token->key.op == OP_MATCH)) { + dbg(rules->udev, "%s is true (matching value)\n", token_str(token->type)); + return 0; + } + if (!match && (token->key.op == OP_NOMATCH)) { + dbg(rules->udev, "%s is true (non-matching value)\n", token_str(token->type)); + return 0; + } + dbg(rules->udev, "%s is not true\n", token_str(token->type)); + return -1; +} + +static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur) +{ + const char *name; + char nbuf[UTIL_NAME_SIZE]; + const char *value; + char vbuf[UTIL_NAME_SIZE]; + size_t len; + + name = &rules->buf[cur->key.attr_off]; + switch (cur->key.attrsubst) { + case SB_FORMAT: + udev_event_apply_format(event, name, nbuf, sizeof(nbuf)); + name = nbuf; + /* fall through */ + case SB_NONE: + value = udev_device_get_sysattr_value(dev, name); + if (value == NULL) + return -1; + break; + case SB_SUBSYS: + if (util_resolve_subsys_kernel(event->udev, name, vbuf, sizeof(vbuf), 1) != 0) + return -1; + value = vbuf; + break; + default: + return -1; + } + + /* remove trailing whitespace, if not asked to match for it */ + len = strlen(value); + if (len > 0 && isspace(value[len-1])) { + const char *key_value; + size_t klen; + + key_value = &rules->buf[cur->key.value_off]; + klen = strlen(key_value); + if (klen > 0 && !isspace(key_value[klen-1])) { + if (value != vbuf) { + util_strscpy(vbuf, sizeof(vbuf), value); + value = vbuf; + } + while (len > 0 && isspace(vbuf[--len])) + vbuf[len] = '\0'; + dbg(rules->udev, "removed trailing whitespace from '%s'\n", value); + } + } + + return match_key(rules, cur, value); +} + +enum escape_type { + ESCAPE_UNSET, + ESCAPE_NONE, + ESCAPE_REPLACE, +}; + +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask) +{ + struct token *cur; + struct token *rule; + enum escape_type esc = ESCAPE_UNSET; + bool can_set_name; + + if (rules->tokens == NULL) + return -1; + + can_set_name = ((strcmp(udev_device_get_action(event->dev), "remove") != 0) && + (major(udev_device_get_devnum(event->dev)) > 0 || + udev_device_get_ifindex(event->dev) > 0)); + + /* loop through token list, match, run actions or forward to next rule */ + cur = &rules->tokens[0]; + rule = cur; + for (;;) { + dump_token(rules, cur); + switch (cur->type) { + case TK_RULE: + /* current rule */ + rule = cur; + /* possibly skip rules which want to set NAME, SYMLINK, OWNER, GROUP, MODE */ + if (!can_set_name && rule->rule.can_set_name) + goto nomatch; + esc = ESCAPE_UNSET; + break; + case TK_M_ACTION: + if (match_key(rules, cur, udev_device_get_action(event->dev)) != 0) + goto nomatch; + break; + case TK_M_DEVPATH: + if (match_key(rules, cur, udev_device_get_devpath(event->dev)) != 0) + goto nomatch; + break; + case TK_M_KERNEL: + if (match_key(rules, cur, udev_device_get_sysname(event->dev)) != 0) + goto nomatch; + break; + case TK_M_DEVLINK: { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; + bool match = false; + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { + const char *devlink; + + devlink = &udev_list_entry_get_name(list_entry)[devlen]; + if (match_key(rules, cur, devlink) == 0) { + match = true; + break; + } + } + if (!match) + goto nomatch; + break; + } + case TK_M_NAME: + if (match_key(rules, cur, event->name) != 0) + goto nomatch; + break; + case TK_M_ENV: { + const char *key_name = &rules->buf[cur->key.attr_off]; + const char *value; + + value = udev_device_get_property_value(event->dev, key_name); + if (value == NULL) { + dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); + value = ""; + } + if (match_key(rules, cur, value)) + goto nomatch; + break; + } + case TK_M_TAG: { + struct udev_list_entry *list_entry; + bool match = false; + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) { + if (strcmp(&rules->buf[cur->key.value_off], udev_list_entry_get_name(list_entry)) == 0) { + match = true; + break; + } + } + if (!match && (cur->key.op != OP_NOMATCH)) + goto nomatch; + break; + } + case TK_M_SUBSYSTEM: + if (match_key(rules, cur, udev_device_get_subsystem(event->dev)) != 0) + goto nomatch; + break; + case TK_M_DRIVER: + if (match_key(rules, cur, udev_device_get_driver(event->dev)) != 0) + goto nomatch; + break; + case TK_M_WAITFOR: { + char filename[UTIL_PATH_SIZE]; + int found; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); + found = (wait_for_file(event->dev, filename, 10) == 0); + if (!found && (cur->key.op != OP_NOMATCH)) + goto nomatch; + break; + } + case TK_M_ATTR: + if (match_attr(rules, event->dev, event, cur) != 0) + goto nomatch; + break; + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_ATTRS: + case TK_M_TAGS: { + struct token *next; + + /* get whole sequence of parent matches */ + next = cur; + while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX) + next++; + + /* loop over parents */ + event->dev_parent = event->dev; + for (;;) { + struct token *key; + + dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); + /* loop over sequence of parent match keys */ + for (key = cur; key < next; key++ ) { + dump_token(rules, key); + switch(key->type) { + case TK_M_KERNELS: + if (match_key(rules, key, udev_device_get_sysname(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_SUBSYSTEMS: + if (match_key(rules, key, udev_device_get_subsystem(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_DRIVERS: + if (match_key(rules, key, udev_device_get_driver(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_ATTRS: + if (match_attr(rules, event->dev_parent, event, key) != 0) + goto try_parent; + break; + case TK_M_TAGS: { + bool match = udev_device_has_tag(event->dev_parent, &rules->buf[cur->key.value_off]); + + if (match && key->key.op == OP_NOMATCH) + goto try_parent; + if (!match && key->key.op == OP_MATCH) + goto try_parent; + break; + } + default: + goto nomatch; + } + dbg(event->udev, "parent key matched\n"); + } + dbg(event->udev, "all parent keys matched\n"); + break; + + try_parent: + event->dev_parent = udev_device_get_parent(event->dev_parent); + if (event->dev_parent == NULL) + goto nomatch; + } + /* move behind our sequence of parent match keys */ + cur = next; + continue; + } + case TK_M_TEST: { + char filename[UTIL_PATH_SIZE]; + struct stat statbuf; + int match; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); + if (util_resolve_subsys_kernel(event->udev, filename, filename, sizeof(filename), 0) != 0) { + if (filename[0] != '/') { + char tmp[UTIL_PATH_SIZE]; + + util_strscpy(tmp, sizeof(tmp), filename); + util_strscpyl(filename, sizeof(filename), + udev_device_get_syspath(event->dev), "/", tmp, NULL); + } + } + attr_subst_subdir(filename, sizeof(filename)); + + match = (stat(filename, &statbuf) == 0); + dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + if (match && cur->key.mode > 0) { + match = ((statbuf.st_mode & cur->key.mode) > 0); + dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + match ? "matches" : "does not match", cur->key.mode); + } + if (match && cur->key.op == OP_NOMATCH) + goto nomatch; + if (!match && cur->key.op == OP_MATCH) + goto nomatch; + break; + } + case TK_M_EVENT_TIMEOUT: + info(event->udev, "OPTIONS event_timeout=%u\n", cur->key.event_timeout); + event->timeout_usec = cur->key.event_timeout * 1000 * 1000; + break; + case TK_M_PROGRAM: { + char program[UTIL_PATH_SIZE]; + char **envp; + char result[UTIL_PATH_SIZE]; + + free(event->program_result); + event->program_result = NULL; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + info(event->udev, "PROGRAM '%s' %s:%u\n", + program, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + + if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } else { + int count; + + util_remove_trailing_chars(result, '\n'); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + } + event->program_result = strdup(result); + dbg(event->udev, "storing result '%s'\n", event->program_result); + if (cur->key.op == OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_FILE: { + char import[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + if (import_file_into_properties(event->dev, import) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PROG: { + char import[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + info(event->udev, "IMPORT '%s' %s:%u\n", + import, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + + if (import_program_into_properties(event, import, sigmask) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_BUILTIN: { + char command[UTIL_PATH_SIZE]; + + if (udev_builtin_run_once(cur->key.builtin_cmd)) { + /* check if we ran already */ + if (event->builtin_run & (1 << cur->key.builtin_cmd)) { + info(event->udev, "IMPORT builtin skip '%s' %s:%u\n", + udev_builtin_name(cur->key.builtin_cmd), + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + /* return the result from earlier run */ + if (event->builtin_ret & (1 << cur->key.builtin_cmd)) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + /* mark as ran */ + event->builtin_run |= (1 << cur->key.builtin_cmd); + } + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], command, sizeof(command)); + info(event->udev, "IMPORT builtin '%s' %s:%u\n", + udev_builtin_name(cur->key.builtin_cmd), + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + + if (udev_builtin_run(event->dev, cur->key.builtin_cmd, command, false) != 0) { + /* remember failure */ + info(rules->udev, "IMPORT builtin '%s' returned non-zero\n", + udev_builtin_name(cur->key.builtin_cmd)); + event->builtin_ret |= (1 << cur->key.builtin_cmd); + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_DB: { + const char *key = &rules->buf[cur->key.value_off]; + const char *value; + + value = udev_device_get_property_value(event->dev_db, key); + if (value != NULL) { + struct udev_list_entry *entry; + + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_num(entry, true); + } else { + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_CMDLINE: { + FILE *f; + bool imported = false; + + f = fopen("/proc/cmdline", "r"); + if (f != NULL) { + char cmdline[4096]; + + if (fgets(cmdline, sizeof(cmdline), f) != NULL) { + const char *key = &rules->buf[cur->key.value_off]; + char *pos; + + pos = strstr(cmdline, key); + if (pos != NULL) { + struct udev_list_entry *entry; + + pos += strlen(key); + if (pos[0] == '\0' || isspace(pos[0])) { + /* we import simple flags as 'FLAG=1' */ + entry = udev_device_add_property(event->dev, key, "1"); + udev_list_entry_set_num(entry, true); + imported = true; + } else if (pos[0] == '=') { + const char *value; + + pos++; + value = pos; + while (pos[0] != '\0' && !isspace(pos[0])) + pos++; + pos[0] = '\0'; + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_num(entry, true); + imported = true; + } + } + } + fclose(f); + } + if (!imported && cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PARENT: { + char import[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + if (import_parent_into_properties(event->dev, import) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_RESULT: + if (match_key(rules, cur, event->program_result) != 0) + goto nomatch; + break; + case TK_A_STRING_ESCAPE_NONE: + esc = ESCAPE_NONE; + break; + case TK_A_STRING_ESCAPE_REPLACE: + esc = ESCAPE_REPLACE; + break; + case TK_A_DB_PERSIST: + udev_device_set_db_persist(event->dev); + break; + case TK_A_INOTIFY_WATCH: + if (event->inotify_watch_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->inotify_watch_final = true; + event->inotify_watch = cur->key.watch; + break; + case TK_A_DEVLINK_PRIO: + udev_device_set_devlink_priority(event->dev, cur->key.devlink_prio); + break; + case TK_A_OWNER: { + char owner[UTIL_NAME_SIZE]; + + if (event->owner_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->owner_final = true; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); + event->uid = util_lookup_user(event->udev, owner); + info(event->udev, "OWNER %u %s:%u\n", + event->uid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_GROUP: { + char group[UTIL_NAME_SIZE]; + + if (event->group_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->group_final = true; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); + event->gid = util_lookup_group(event->udev, group); + info(event->udev, "GROUP %u %s:%u\n", + event->gid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_MODE: { + char mode_str[UTIL_NAME_SIZE]; + mode_t mode; + char *endptr; + + if (event->mode_final) + break; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode_str, sizeof(mode_str)); + mode = strtol(mode_str, &endptr, 8); + if (endptr[0] != '\0') { + err(event->udev, "ignoring invalid mode '%s'\n", mode_str); + break; + } + if (cur->key.op == OP_ASSIGN_FINAL) + event->mode_final = true; + event->mode_set = true; + event->mode = mode; + info(event->udev, "MODE %#o %s:%u\n", + event->mode, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_OWNER_ID: + if (event->owner_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->owner_final = true; + event->uid = cur->key.uid; + info(event->udev, "OWNER %u %s:%u\n", + event->uid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + case TK_A_GROUP_ID: + if (event->group_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->group_final = true; + event->gid = cur->key.gid; + info(event->udev, "GROUP %u %s:%u\n", + event->gid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + case TK_A_MODE_ID: + if (event->mode_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->mode_final = true; + event->mode_set = true; + event->mode = cur->key.mode; + info(event->udev, "MODE %#o %s:%u\n", + event->mode, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + case TK_A_ENV: { + const char *name = &rules->buf[cur->key.attr_off]; + char *value = &rules->buf[cur->key.value_off]; + + if (value[0] != '\0') { + char temp_value[UTIL_NAME_SIZE]; + struct udev_list_entry *entry; + + udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); + entry = udev_device_add_property(event->dev, name, temp_value); + /* store in db, skip private keys */ + if (name[0] != '.') + udev_list_entry_set_num(entry, true); + } else { + udev_device_add_property(event->dev, name, NULL); + } + break; + } + case TK_A_TAG: { + char tag[UTIL_PATH_SIZE]; + const char *p; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], tag, sizeof(tag)); + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_device_cleanup_tags_list(event->dev); + for (p = tag; *p != '\0'; p++) { + if ((*p >= 'a' && *p <= 'z') || + (*p >= 'A' && *p <= 'Z') || + (*p >= '0' && *p <= '9') || + *p == '-' || *p == '_') + continue; + err(event->udev, "ignoring invalid tag name '%s'\n", tag); + break; + } + udev_device_add_tag(event->dev, tag); + break; + } + case TK_A_NAME: { + const char *name = &rules->buf[cur->key.value_off]; + char name_str[UTIL_PATH_SIZE]; + int count; + + if (event->name_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->name_final = true; + udev_event_apply_format(event, name, name_str, sizeof(name_str)); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = util_replace_chars(name_str, "/"); + if (count > 0) + info(event->udev, "%i character(s) replaced\n", count); + } + free(event->name); + event->name = strdup(name_str); + info(event->udev, "NAME '%s' %s:%u\n", + event->name, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_DEVLINK: { + char temp[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char *pos, *next; + int count = 0; + + if (event->devlink_final) + break; + if (major(udev_device_get_devnum(event->dev)) == 0) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->devlink_final = true; + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_device_cleanup_devlinks_list(event->dev); + + /* allow multiple symlinks separated by spaces */ + udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); + if (esc == ESCAPE_UNSET) + count = util_replace_chars(temp, "/ "); + else if (esc == ESCAPE_REPLACE) + count = util_replace_chars(temp, "/"); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); + pos = temp; + while (isspace(pos[0])) + pos++; + next = strchr(pos, ' '); + while (next != NULL) { + next[0] = '\0'; + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); + while (isspace(next[1])) + next++; + pos = &next[1]; + next = strchr(pos, ' '); + } + if (pos[0] != '\0') { + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); + } + break; + } + case TK_A_ATTR: { + const char *key_name = &rules->buf[cur->key.attr_off]; + char attr[UTIL_PATH_SIZE]; + char value[UTIL_NAME_SIZE]; + FILE *f; + + if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) + util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); + attr_subst_subdir(attr, sizeof(attr)); + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], value, sizeof(value)); + info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + f = fopen(attr, "w"); + if (f != NULL) { + if (fprintf(f, "%s", value) <= 0) + err(event->udev, "error writing ATTR{%s}: %m\n", attr); + fclose(f); + } else { + err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); + } + break; + } + case TK_A_RUN: { + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_list_cleanup(&event->run_list); + info(event->udev, "RUN '%s' %s:%u\n", + &rules->buf[cur->key.value_off], + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL); + break; + } + case TK_A_GOTO: + if (cur->key.rule_goto == 0) + break; + cur = &rules->tokens[cur->key.rule_goto]; + continue; + case TK_END: + return 0; + + case TK_M_PARENTS_MIN: + case TK_M_PARENTS_MAX: + case TK_M_MAX: + case TK_UNSET: + err(rules->udev, "wrong type %u\n", cur->type); + goto nomatch; + } + + cur++; + continue; + nomatch: + /* fast-forward to next rule */ + cur = rule + rule->rule.token_count; + dbg(rules->udev, "forward to rule: %u\n", + (unsigned int) (cur - rules->tokens)); + } +} + +void udev_rules_apply_static_dev_perms(struct udev_rules *rules) +{ + struct token *cur; + struct token *rule; + uid_t uid = 0; + gid_t gid = 0; + mode_t mode = 0; + + if (rules->tokens == NULL) + return; + + cur = &rules->tokens[0]; + rule = cur; + for (;;) { + switch (cur->type) { + case TK_RULE: + /* current rule */ + rule = cur; + + /* skip rules without a static_node tag */ + if (!rule->rule.has_static_node) + goto next; + + uid = 0; + gid = 0; + mode = 0; + break; + case TK_A_OWNER_ID: + uid = cur->key.uid; + break; + case TK_A_GROUP_ID: + gid = cur->key.gid; + break; + case TK_A_MODE_ID: + mode = cur->key.mode; + break; + case TK_A_STATIC_NODE: { + char filename[UTIL_PATH_SIZE]; + struct stat stats; + + /* we assure, that the permissions tokens are sorted before the static token */ + if (mode == 0 && uid == 0 && gid == 0) + goto next; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(rules->udev), "/", + &rules->buf[cur->key.value_off], NULL); + if (stat(filename, &stats) != 0) + goto next; + if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) + goto next; + if (mode == 0) { + if (gid > 0) + mode = 0660; + else + mode = 0600; + } + if (mode != (stats.st_mode & 01777)) { + chmod(filename, mode); + info(rules->udev, "chmod '%s' %#o\n", filename, mode); + } + + if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) { + chown(filename, uid, gid); + info(rules->udev, "chown '%s' %u %u\n", filename, uid, gid); + } + + utimensat(AT_FDCWD, filename, NULL, 0); + break; + } + case TK_END: + return; + } + + cur++; + continue; +next: + /* fast-forward to next rule */ + cur = rule + rule->rule.token_count; + continue; + } +} diff --git a/src/udev-settle.service.in b/src/udev-settle.service.in new file mode 100644 index 0000000000..b0a4964f76 --- /dev/null +++ b/src/udev-settle.service.in @@ -0,0 +1,25 @@ +# This service is usually not enabled by default. If enabled, it +# acts as a barrier for basic.target -- so all later services will +# wait for udev completely finishing its coldplug run. +# +# If needed, to work around broken or non-hotplug-aware services, +# it might be enabled unconditionally, or pulled-in on-demand by +# the services that assume a fully populated /dev at startup. It +# should not be used or pulled-in ever on systems without such +# legacy services running. + +[Unit] +Description=udev Wait for Complete Device Initialization +DefaultDependencies=no +Wants=udev.service +After=udev-trigger.service +Before=basic.target + +[Service] +Type=oneshot +TimeoutSec=180 +RemainAfterExit=yes +ExecStart=@bindir@/udevadm settle + +[Install] +WantedBy=basic.target diff --git a/src/udev-trigger.service.in b/src/udev-trigger.service.in new file mode 100644 index 0000000000..cd81945c88 --- /dev/null +++ b/src/udev-trigger.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=udev Coldplug all Devices +Wants=udev.service +After=udev-kernel.socket udev-control.socket +DefaultDependencies=no + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=@bindir@/udevadm trigger --type=subsystems --action=add ; @bindir@/udevadm trigger --type=devices --action=add diff --git a/src/udev-watch.c b/src/udev-watch.c new file mode 100644 index 0000000000..0ec8bfd627 --- /dev/null +++ b/src/udev-watch.c @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2004-2010 Kay Sievers + * Copyright (C) 2009 Canonical Ltd. + * Copyright (C) 2009 Scott James Remnant + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int inotify_fd = -1; + +/* inotify descriptor, will be shared with rules directory; + * set to cloexec since we need our children to be able to add + * watches for us + */ +int udev_watch_init(struct udev *udev) +{ + inotify_fd = inotify_init1(IN_CLOEXEC); + if (inotify_fd < 0) + err(udev, "inotify_init failed: %m\n"); + return inotify_fd; +} + +/* move any old watches directory out of the way, and then restore + * the watches + */ +void udev_watch_restore(struct udev *udev) +{ + char filename[UTIL_PATH_SIZE], oldname[UTIL_PATH_SIZE]; + + if (inotify_fd < 0) + return; + + util_strscpyl(oldname, sizeof(oldname), udev_get_run_path(udev), "/watch.old", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); + if (rename(filename, oldname) == 0) { + DIR *dir; + struct dirent *ent; + + dir = opendir(oldname); + if (dir == NULL) { + err(udev, "unable to open old watches dir '%s', old watches will not be restored: %m", oldname); + return; + } + + for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) { + char device[UTIL_PATH_SIZE]; + char *s; + size_t l; + ssize_t len; + struct udev_device *dev; + + if (ent->d_name[0] == '.') + continue; + + s = device; + l = util_strpcpy(&s, sizeof(device), udev_get_sys_path(udev)); + len = readlinkat(dirfd(dir), ent->d_name, s, l); + if (len <= 0 || len == (ssize_t)l) + goto unlink; + s[len] = '\0'; + + dev = udev_device_new_from_id_filename(udev, s); + if (dev == NULL) + goto unlink; + + info(udev, "restoring old watch on '%s'\n", udev_device_get_devnode(dev)); + udev_watch_begin(udev, dev); + udev_device_unref(dev); +unlink: + unlinkat(dirfd(dir), ent->d_name, 0); + } + + closedir(dir); + rmdir(oldname); + + } else if (errno != ENOENT) { + err(udev, "unable to move watches dir '%s', old watches will not be restored: %m", filename); + } +} + +void udev_watch_begin(struct udev *udev, struct udev_device *dev) +{ + char filename[UTIL_PATH_SIZE]; + int wd; + + if (inotify_fd < 0) + return; + + info(udev, "adding watch on '%s'\n", udev_device_get_devnode(dev)); + wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); + if (wd < 0) { + err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n", + inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); + return; + } + + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); + util_create_path(udev, filename); + unlink(filename); + symlink(udev_device_get_id_filename(dev), filename); + + udev_device_set_watch_handle(dev, wd); +} + +void udev_watch_end(struct udev *udev, struct udev_device *dev) +{ + int wd; + char filename[UTIL_PATH_SIZE]; + + if (inotify_fd < 0) + return; + + wd = udev_device_get_watch_handle(dev); + if (wd < 0) + return; + + info(udev, "removing watch on '%s'\n", udev_device_get_devnode(dev)); + inotify_rm_watch(inotify_fd, wd); + + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); + unlink(filename); + + udev_device_set_watch_handle(dev, -1); +} + +struct udev_device *udev_watch_lookup(struct udev *udev, int wd) +{ + char filename[UTIL_PATH_SIZE]; + char majmin[UTIL_PATH_SIZE]; + char *s; + size_t l; + ssize_t len; + + if (inotify_fd < 0 || wd < 0) + return NULL; + + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); + s = majmin; + l = util_strpcpy(&s, sizeof(majmin), udev_get_sys_path(udev)); + len = readlink(filename, s, l); + if (len <= 0 || (size_t)len == l) + return NULL; + s[len] = '\0'; + + return udev_device_new_from_id_filename(udev, s); +} diff --git a/src/udev.conf b/src/udev.conf new file mode 100644 index 0000000000..31bb6620ee --- /dev/null +++ b/src/udev.conf @@ -0,0 +1,4 @@ +# The initial syslog(3) priority: "err", "info", "debug" or its +# numerical equivalent. For runtime debugging, the daemons internal +# state can be changed with: "udevadm control --log-priority=". +udev_log="err" diff --git a/src/udev.h b/src/udev.h new file mode 100644 index 0000000000..56b1652c74 --- /dev/null +++ b/src/udev.h @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2003 Greg Kroah-Hartman + * Copyright (C) 2003-2010 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef _UDEV_H_ +#define _UDEV_H_ + +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +struct udev_event { + struct udev *udev; + struct udev_device *dev; + struct udev_device *dev_parent; + struct udev_device *dev_db; + char *name; + char *program_result; + mode_t mode; + uid_t uid; + gid_t gid; + struct udev_list run_list; + int exec_delay; + unsigned long long birth_usec; + unsigned long long timeout_usec; + int fd_signal; + unsigned int builtin_run; + unsigned int builtin_ret; + bool sigterm; + bool inotify_watch; + bool inotify_watch_final; + bool group_final; + bool owner_final; + bool mode_set; + bool mode_final; + bool name_final; + bool devlink_final; + bool run_final; +}; + +struct udev_watch { + struct udev_list_node node; + int handle; + char *name; +}; + +/* udev-rules.c */ +struct udev_rules; +struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); +struct udev_rules *udev_rules_unref(struct udev_rules *rules); +int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask); +void udev_rules_apply_static_dev_perms(struct udev_rules *rules); + +/* udev-event.c */ +struct udev_event *udev_event_new(struct udev_device *dev); +void udev_event_unref(struct udev_event *event); +size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size); +int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, + char *result, size_t maxsize, int read_value); +int udev_event_spawn(struct udev_event *event, + const char *cmd, char **envp, const sigset_t *sigmask, + char *result, size_t ressize); +int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); +int udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); +int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); + +/* udev-watch.c */ +int udev_watch_init(struct udev *udev); +void udev_watch_restore(struct udev *udev); +void udev_watch_begin(struct udev *udev, struct udev_device *dev); +void udev_watch_end(struct udev *udev, struct udev_device *dev); +struct udev_device *udev_watch_lookup(struct udev *udev, int wd); + +/* udev-node.c */ +int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); +int udev_node_remove(struct udev_device *dev); +void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); + +/* udev-ctrl.c */ +struct udev_ctrl; +struct udev_ctrl *udev_ctrl_new(struct udev *udev); +struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd); +int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); +struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); +struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); +int udev_ctrl_cleanup(struct udev_ctrl *uctrl); +struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); +int udev_ctrl_get_fd(struct udev_ctrl *uctrl); +int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout); +int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout); +int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout); +int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout); +struct udev_ctrl_connection; +struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl); +struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn); +struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn); +struct udev_ctrl_msg; +struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn); +struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); +struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg); +const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); +int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); + +/* built-in commands */ +enum udev_builtin_cmd { + UDEV_BUILTIN_BLKID, + UDEV_BUILTIN_FIRMWARE, + UDEV_BUILTIN_INPUT_ID, + UDEV_BUILTIN_KMOD, + UDEV_BUILTIN_PATH_ID, + UDEV_BUILTIN_PCI_DB, + UDEV_BUILTIN_USB_DB, + UDEV_BUILTIN_USB_ID, + UDEV_BUILTIN_MAX +}; +struct udev_builtin { + const char *name; + int (*cmd)(struct udev_device *dev, int argc, char *argv[], bool test); + const char *help; + int (*init)(struct udev *udev); + void (*exit)(struct udev *udev); + bool (*validate)(struct udev *udev); + bool run_once; +}; +extern const struct udev_builtin udev_builtin_blkid; +extern const struct udev_builtin udev_builtin_firmware; +extern const struct udev_builtin udev_builtin_input_id; +extern const struct udev_builtin udev_builtin_kmod; +extern const struct udev_builtin udev_builtin_path_id; +extern const struct udev_builtin udev_builtin_pci_db; +extern const struct udev_builtin udev_builtin_usb_db; +extern const struct udev_builtin udev_builtin_usb_id; +int udev_builtin_init(struct udev *udev); +void udev_builtin_exit(struct udev *udev); +enum udev_builtin_cmd udev_builtin_lookup(const char *command); +const char *udev_builtin_name(enum udev_builtin_cmd cmd); +bool udev_builtin_run_once(enum udev_builtin_cmd cmd); +int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test); +void udev_builtin_list(struct udev *udev); +int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val); + +/* udev logging */ +void udev_main_log(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args); + +/* udevadm commands */ +struct udevadm_cmd { + const char *name; + int (*cmd)(struct udev *udev, int argc, char *argv[]); + const char *help; + int debug; +}; +extern const struct udevadm_cmd udevadm_info; +extern const struct udevadm_cmd udevadm_trigger; +extern const struct udevadm_cmd udevadm_settle; +extern const struct udevadm_cmd udevadm_control; +extern const struct udevadm_cmd udevadm_monitor; +extern const struct udevadm_cmd udevadm_test; +extern const struct udevadm_cmd udevadm_test_builtin; +#endif diff --git a/src/udev.pc.in b/src/udev.pc.in new file mode 100644 index 0000000000..0b04c02ef6 --- /dev/null +++ b/src/udev.pc.in @@ -0,0 +1,5 @@ +Name: udev +Description: udev +Version: @VERSION@ + +udevdir=@pkglibexecdir@ diff --git a/src/udev.service.in b/src/udev.service.in new file mode 100644 index 0000000000..c27eb1baf5 --- /dev/null +++ b/src/udev.service.in @@ -0,0 +1,14 @@ +[Unit] +Description=udev Kernel Device Manager +Wants=udev-control.socket udev-kernel.socket +After=udev-control.socket udev-kernel.socket +Before=basic.target +DefaultDependencies=no +ConditionCapability=CAP_MKNOD + +[Service] +Type=notify +OOMScoreAdjust=-1000 +Sockets=udev-control.socket udev-kernel.socket +Restart=on-failure +ExecStart=@pkglibexecdir@/udevd diff --git a/src/udev.xml b/src/udev.xml new file mode 100644 index 0000000000..88e19f30d1 --- /dev/null +++ b/src/udev.xml @@ -0,0 +1,694 @@ + + + + + + + udev + udev + + + + udev + 7 + + + + udev + Linux dynamic device management + + + Description + udev supplies the system software with device events, manages permissions + of device nodes and may create additional symlinks in the /dev + directory, or renames network interfaces. The kernel usually just assigns unpredictable + device names based on the order of discovery. Meaningful symlinks or network device + names provide a way to reliably identify devices based on their properties or + current configuration. + + The udev daemon, udevd + 8, receives device uevents directly from + the kernel whenever a device is added or removed from the system, or it changes its + state. When udev receives a device event, it matches its configured set of rules + against various device attributes to identify the device. Rules that match may + provide additional device information to be stored in the udev database or + to be used to create meaningful symlink names. + + All device information udev processes is stored in the udev database and + sent out to possible event subscribers. Access to all stored data and the event + sources is provided by the library libudev. + + + Configuration + udev configuration files are placed in /etc/udev + and /usr/lib/udev. All empty lines or lines beginning with + '#' are ignored. + + Configuration file + udev expects its main configuration file at /etc/udev/udev.conf. + It consists of a set of variables allowing the user to override default udev values. + The following variables can be set: + + + + + Specifies where to place the device nodes in the filesystem. + The default value is /dev. + + + + + + + The logging priority. Valid values are the numerical syslog priorities + or their textual representations: , + and . + + + + + + Rules files + The udev rules are read from the files located in the + system rules directory /usr/lib/udev/rules.d, + the local administration directory /etc/udev/rules.d + and the volatile runtime directory /run/udev/rules.d. + All rules files are collectively sorted and processed in lexical order, + regardless of the directories in which they live. However, files with + identical file names replace each other. Files in /run + have the highest priority, files in /etc take precedence + over files with the same name in /lib. This can be + used to overwrite a system rules file if needed; a symlink in + /etc with the same name as a rules file in + /lib, pointing to /dev/null, + disables the rules file entirely. + + Rule files must have the extension .rules; other + extensions are ignored. + + Every line in the rules file contains at least one key-value pair. + There are two kind of keys: match and assignment. + If all match keys are matching against its value, the rule gets applied and the + assignment keys get the specified value assigned. + + A matching rule may rename a network interface, add symlinks + pointing to the device node, or run a specified program as part of + the event handling. + + A rule consists of a comma-separated list of one or more key-value pairs. + Each key has a distinct operation, depending on the used operator. Valid + operators are: + + + + + Compare for equality. + + + + + + + Compare for inequality. + + + + + + + Assign a value to a key. Keys that represent a list are reset + and only this single value is assigned. + + + + + + + Add the value to a key that holds a list of entries. + + + + + + + Assign a value to a key finally; disallow any later changes. + + + + + The following key names can be used to match against device properties. + Some of the keys also match against properties of the parent devices in sysfs, + not only the device that has generated the event. If multiple keys that match + a parent device are specified in a single rule, all these keys must match at + one and the same parent device. + + + + + Match the name of the event action. + + + + + + + Match the devpath of the event device. + + + + + + + Match the name of the event device. + + + + + + + Match the name of a network interface. It can be used once the + NAME key has been set in one of the preceding rules. + + + + + + + Match the name of a symlink targeting the node. It can + be used once a SYMLINK key has been set in one of the preceding + rules. There may be multiple symlinks; only one needs to match. + + + + + + + + Match the subsystem of the event device. + + + + + + Match the driver name of the event device. Only set this key for devices + which are bound to a driver at the time the event is generated. + + + + + + Match sysfs attribute values of the event device. Trailing + whitespace in the attribute values is ignored unless the specified match + value itself contains trailing whitespace. + + + + + + + + Search the devpath upwards for a matching device name. + + + + + + + Search the devpath upwards for a matching device subsystem name. + + + + + + + Search the devpath upwards for a matching device driver name. + + + + + + + Search the devpath upwards for a device with matching sysfs attribute values. + If multiple matches are specified, all of them + must match on the same device. Trailing whitespace in the attribute values is ignored + unless the specified match value itself contains trailing whitespace. + + + + + + + Search the devpath upwards for a device with matching tag. + + + + + + + Match against a device property value. + + + + + + + Match against a device tag. + + + + + + + Test the existence of a file. An octal mode mask can be specified + if needed. + + + + + + + Execute a program to determine whether there + is a match; the key is true if the program returns + successfully. The device properties are made available to the + executed program in the environment. The program's stdout + is available in the RESULT key. + + + + + + + Match the returned string of the last PROGRAM call. This key can + be used in the same or in any later rule after a PROGRAM call. + + + + + Most of the fields support shell-style pattern matching. The following + pattern characters are supported: + + + + + Matches zero or more characters. + + + + + + Matches any single character. + + + + + + Matches any single character specified within the brackets. For + example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. + Ranges are also supported via the '-' character. + For example, to match on the range of all digits, the pattern [0-9] could + be used. If the first character following the '[' is a '!', any characters + not enclosed are matched. + + + + + The following keys can get values assigned: + + + + + The name to use for a network interface. The name of a device node + can not be changed by udev, only additional symlinks can be created. + + + + + + + The name of a symlink targeting the node. Every matching rule adds + this value to the list of symlinks to be created. Multiple symlinks may be + specified by separating the names by the space character. In case multiple + devices claim the same name, the link always points to the device with + the highest link_priority. If the current device goes away, the links are + re-evaluated and the device with the next highest link_priority becomes the owner of + the link. If no link_priority is specified, the order of the devices (and + which one of them owns the link) is undefined. Also, symlink names must + never conflict with the kernel's default device node names, as that would + result in unpredictable behavior. + + + + + + + + The permissions for the device node. Every specified value overwrites + the compiled-in default value. + + + + + + + The value that should be written to a sysfs attribute of the + event device. + + + + + + + Set a device property value. Property names with a leading '.' + are neither stored in the database nor exported to events or + external tools (run by, say, the PROGRAM match key). + + + + + + + Attach a tag to a device. This is used to filter events for users + of libudev's monitor functionality, or to enumerate a group of tagged + devices. The implementation can only work efficiently if only a few + tags are attached to a device. It is only meant to be used in + contexts with specific device filter requirements, and not as a + general-purpose flag. Excessive use might result in inefficient event + handling. + + + + + + + Add a program to the list of programs to be executed for a specific + device. This can only be used for very short running tasks. Running an + event process for a long period of time may block all further events for + this or a dependent device. Long running tasks need to be immediately + detached from the event process itself. + If no absolute path is given, the program is expected to live in + /usr/lib/udev, otherwise the absolute path must be specified. The program + name and following arguments are separated by spaces. Single quotes can + be used to specify arguments with spaces. + + + + + + + A named label to which a GOTO may jump. + + + + + + + Jumps to the next LABEL with a matching name. + + + + + + + Import a set of variables as device properties, + depending on type: + + + + + Execute an external program specified as the assigned value and + import its output, which must be in environment key + format. Path specification, command/argument separation, + and quoting work like in . + + + + + + Import a text file specified as the assigned value, the content + of which must be in environment key format. + + + + + + Import a single property specified as the assigned value from the + current device database. This works only if the database is already populated + by an earlier event. + + + + + + Import a single property from the kernel command line. For simple flags + the value of the property is set to '1'. + + + + + + Import the stored keys from the parent device by reading + the database entry of the parent device. The value assigned to + is used as a filter of key names + to import (with the same shell-style pattern matching used for + comparisons). + + + + + + + + + + Wait for a file to become available or until a timeout of + 10 seconds expires. The path is relative to the sysfs device; + if no path is specified, this waits for an attribute to appear. + + + + + + + Rule and device options: + + + + + Specify the priority of the created symlinks. Devices with higher + priorities overwrite existing symlinks of other devices. The default is 0. + + + + + + Number of seconds an event waits for operations to finish before + giving up and terminating itself. + + + + + + Usually control and other possibly unsafe characters are replaced + in strings used for device naming. The mode of replacement can be specified + with this option. + + + + + + Apply the permissions specified in this rule to the static device node with + the specified name. Static device nodes might be provided by kernel modules + or copied from /usr/lib/udev/devices. These nodes might not have + a corresponding kernel device at the time udevd is started; they can trigger + automatic kernel module loading. + + + + + + Watch the device node with inotify; when the node is closed after being opened for + writing, a change uevent is synthesized. + + + + + + Disable the watching of a device node with inotify. + + + + + + + + The , , , + , , and + fields support simple string substitutions. The + substitutions are performed after all rules have been processed, right before the program + is executed, allowing for the use of device properties set by earlier matching + rules. For all other fields, substitutions are performed while the individual rule is + being processed. The available substitutions are: + + + , + + The kernel name for this device. + + + + + , + + The kernel number for this device. For example, 'sda3' has + kernel number of '3' + + + + + , + + The devpath of the device. + + + + + , + + The name of the device matched while searching the devpath upwards for + , , and . + + + + + + + + The driver name of the device matched while searching the devpath upwards for + , , and . + + + + + + , + + The value of a sysfs attribute found at the device where + all keys of the rule have matched. If the matching device does not have + such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or + ATTRS test selected a parent device, then the attribute from that + parent device is used. + If the attribute is a symlink, the last element of the symlink target is + returned as the value. + + + + + , + + A device property value. + + + + + , + + The kernel major number for the device. + + + + + , + + The kernel minor number for the device. + + + + + , + + The string returned by the external program requested with PROGRAM. + A single part of the string, separated by a space character, may be selected + by specifying the part number as an attribute: . + If the number is followed by the '+' character, this part plus all remaining parts + of the result string are substituted: + + + + + , + + The node name of the parent device. + + + + + + + The current name of the device. If not changed by a rule, it is the + name of the kernel device. + + + + + + + A space-separated list of the current symlinks. The value is + only set during a remove event or if an earlier rule assigned a value. + + + + + , + + The udev_root value. + + + + + , + + The sysfs mount point. + + + + + , + + The name of the device node. + + + + + + + The '%' character itself. + + + + + + + The '$' character itself. + + + + + + + Author + Written by Greg Kroah-Hartman greg@kroah.com and + Kay Sievers kay.sievers@vrfy.org. With much help from + Dan Stekloff and many others. + + + + See Also + + udevd8 + , + + udevadm8 + + + diff --git a/src/udevadm-control.c b/src/udevadm-control.c new file mode 100644 index 0000000000..dd1d5d783f --- /dev/null +++ b/src/udevadm-control.c @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2005-2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static void print_help(void) +{ + printf("Usage: udevadm control COMMAND\n" + " --exit instruct the daemon to cleanup and exit\n" + " --log-priority= set the udev log level for the daemon\n" + " --stop-exec-queue do not execute events, queue only\n" + " --start-exec-queue execute events, flush queue\n" + " --reload reload rules and databases\n" + " --property== set a global property for all events\n" + " --children-max= maximum number of children\n" + " --timeout= maximum time to block for a reply\n" + " --help print this help text\n\n"); +} + +static int adm_control(struct udev *udev, int argc, char *argv[]) +{ + struct udev_ctrl *uctrl = NULL; + int timeout = 60; + int rc = 1; + + static const struct option options[] = { + { "exit", no_argument, NULL, 'e' }, + { "log-priority", required_argument, NULL, 'l' }, + { "stop-exec-queue", no_argument, NULL, 's' }, + { "start-exec-queue", no_argument, NULL, 'S' }, + { "reload", no_argument, NULL, 'R' }, + { "reload-rules", no_argument, NULL, 'R' }, + { "property", required_argument, NULL, 'p' }, + { "env", required_argument, NULL, 'p' }, + { "children-max", required_argument, NULL, 'm' }, + { "timeout", required_argument, NULL, 't' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); + return 1; + } + + uctrl = udev_ctrl_new(udev); + if (uctrl == NULL) + return 2; + + for (;;) { + int option; + + option = getopt_long(argc, argv, "el:sSRp:m:h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'e': + if (udev_ctrl_send_exit(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'l': { + int i; + + i = util_log_priority(optarg); + if (i < 0) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto out; + } + if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg), timeout) < 0) + rc = 2; + else + rc = 0; + break; + } + case 's': + if (udev_ctrl_send_stop_exec_queue(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'S': + if (udev_ctrl_send_start_exec_queue(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'R': + if (udev_ctrl_send_reload(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'p': + if (strchr(optarg, '=') == NULL) { + fprintf(stderr, "expect = instead of '%s'\n", optarg); + goto out; + } + if (udev_ctrl_send_set_env(uctrl, optarg, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'm': { + char *endp; + int i; + + i = strtoul(optarg, &endp, 0); + if (endp[0] != '\0' || i < 1) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto out; + } + if (udev_ctrl_send_set_children_max(uctrl, i, timeout) < 0) + rc = 2; + else + rc = 0; + break; + } + case 't': { + int seconds; + + seconds = atoi(optarg); + if (seconds >= 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); + break; + } + case 'h': + print_help(); + rc = 0; + break; + } + } + + if (argv[optind] != NULL) + fprintf(stderr, "unknown option\n"); + else if (optind == 1) + fprintf(stderr, "missing option\n"); +out: + udev_ctrl_unref(uctrl); + return rc; +} + +const struct udevadm_cmd udevadm_control = { + .name = "control", + .cmd = adm_control, + .help = "control the udev daemon", +}; diff --git a/src/udevadm-info.c b/src/udevadm-info.c new file mode 100644 index 0000000000..f7e7e86b6a --- /dev/null +++ b/src/udevadm-info.c @@ -0,0 +1,568 @@ +/* + * Copyright (C) 2004-2009 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static bool skip_attribute(const char *name) +{ + static const char const *skip[] = { + "uevent", + "dev", + "modalias", + "resource", + "driver", + "subsystem", + "module", + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(skip); i++) + if (strcmp(name, skip[i]) == 0) + return true; + return false; +} + +static void print_all_attributes(struct udev_device *device, const char *key) +{ + struct udev *udev = udev_device_get_udev(device); + struct udev_list_entry *sysattr; + + udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { + const char *name; + const char *value; + size_t len; + + name = udev_list_entry_get_name(sysattr); + if (skip_attribute(name)) + continue; + + value = udev_device_get_sysattr_value(device, name); + if (value == NULL) + continue; + dbg(udev, "attr '%s'='%s'\n", name, value); + + /* skip any values that look like a path */ + if (value[0] == '/') + continue; + + /* skip nonprintable attributes */ + len = strlen(value); + while (len > 0 && isprint(value[len-1])) + len--; + if (len > 0) { + dbg(udev, "attribute value of '%s' non-printable, skip\n", name); + continue; + } + + printf(" %s{%s}==\"%s\"\n", key, name, value); + } + printf("\n"); +} + +static int print_device_chain(struct udev_device *device) +{ + struct udev_device *device_parent; + const char *str; + + printf("\n" + "Udevadm info starts with the device specified by the devpath and then\n" + "walks up the chain of parent devices. It prints for every device\n" + "found, all possible attributes in the udev rules key format.\n" + "A rule to match, can be composed by the attributes of the device\n" + "and the attributes from one single parent device.\n" + "\n"); + + printf(" looking at device '%s':\n", udev_device_get_devpath(device)); + printf(" KERNEL==\"%s\"\n", udev_device_get_sysname(device)); + str = udev_device_get_subsystem(device); + if (str == NULL) + str = ""; + printf(" SUBSYSTEM==\"%s\"\n", str); + str = udev_device_get_driver(device); + if (str == NULL) + str = ""; + printf(" DRIVER==\"%s\"\n", str); + print_all_attributes(device, "ATTR"); + + device_parent = device; + do { + device_parent = udev_device_get_parent(device_parent); + if (device_parent == NULL) + break; + printf(" looking at parent device '%s':\n", udev_device_get_devpath(device_parent)); + printf(" KERNELS==\"%s\"\n", udev_device_get_sysname(device_parent)); + str = udev_device_get_subsystem(device_parent); + if (str == NULL) + str = ""; + printf(" SUBSYSTEMS==\"%s\"\n", str); + str = udev_device_get_driver(device_parent); + if (str == NULL) + str = ""; + printf(" DRIVERS==\"%s\"\n", str); + print_all_attributes(device_parent, "ATTRS"); + } while (device_parent != NULL); + + return 0; +} + +static void print_record(struct udev_device *device) +{ + size_t len; + const char *str; + int i; + struct udev_list_entry *list_entry; + + printf("P: %s\n", udev_device_get_devpath(device)); + + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + str = udev_device_get_devnode(device); + if (str != NULL) + printf("N: %s\n", &str[len+1]); + + i = udev_device_get_devlink_priority(device); + if (i != 0) + printf("L: %i\n", i); + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + printf("S: %s\n", &udev_list_entry_get_name(list_entry)[len+1]); + } + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) + printf("E: %s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + printf("\n"); +} + +static int stat_device(const char *name, bool export, const char *prefix) +{ + struct stat statbuf; + + if (stat(name, &statbuf) != 0) + return -1; + + if (export) { + if (prefix == NULL) + prefix = "INFO_"; + printf("%sMAJOR=%d\n" + "%sMINOR=%d\n", + prefix, major(statbuf.st_dev), + prefix, minor(statbuf.st_dev)); + } else + printf("%d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); + return 0; +} + +static int export_devices(struct udev *udev) +{ + struct udev_enumerate *udev_enumerate; + struct udev_list_entry *list_entry; + + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_devices(udev_enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + if (device != NULL) { + print_record(device); + udev_device_unref(device); + } + } + udev_enumerate_unref(udev_enumerate); + return 0; +} + +static void cleanup_dir(DIR *dir, mode_t mask, int depth) +{ + struct dirent *dent; + + if (depth <= 0) + return; + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + if (fstatat(dirfd(dir), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) + continue; + if ((stats.st_mode & mask) != 0) + continue; + if (S_ISDIR(stats.st_mode)) { + DIR *dir2; + + dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2 != NULL) { + cleanup_dir(dir2, mask, depth-1); + closedir(dir2); + } + unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR); + } else { + unlinkat(dirfd(dir), dent->d_name, 0); + } + } +} + +static void cleanup_db(struct udev *udev) +{ + char filename[UTIL_PATH_SIZE]; + DIR *dir; + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/queue.bin", NULL); + unlink(filename); + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, S_ISVTX, 1); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/links", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 2); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 2); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 1); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/firmware-missing", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 1); + closedir(dir); + } +} + +static int uinfo(struct udev *udev, int argc, char *argv[]) +{ + struct udev_device *device = NULL; + bool root = 0; + bool export = 0; + const char *export_prefix = NULL; + char path[UTIL_PATH_SIZE]; + char name[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + int rc = 0; + + static const struct option options[] = { + { "name", required_argument, NULL, 'n' }, + { "path", required_argument, NULL, 'p' }, + { "query", required_argument, NULL, 'q' }, + { "attribute-walk", no_argument, NULL, 'a' }, + { "cleanup-db", no_argument, NULL, 'c' }, + { "export-db", no_argument, NULL, 'e' }, + { "root", no_argument, NULL, 'r' }, + { "run", no_argument, NULL, 'R' }, + { "device-id-of-file", required_argument, NULL, 'd' }, + { "export", no_argument, NULL, 'x' }, + { "export-prefix", required_argument, NULL, 'P' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + enum action_type { + ACTION_NONE, + ACTION_QUERY, + ACTION_ATTRIBUTE_WALK, + ACTION_ROOT, + ACTION_DEVICE_ID_FILE, + } action = ACTION_NONE; + + enum query_type { + QUERY_NONE, + QUERY_NAME, + QUERY_PATH, + QUERY_SYMLINK, + QUERY_PROPERTY, + QUERY_ALL, + } query = QUERY_NONE; + + for (;;) { + int option; + struct stat statbuf; + + option = getopt_long(argc, argv, "aced:n:p:q:rxP:RVh", options, NULL); + if (option == -1) + break; + + dbg(udev, "option '%c'\n", option); + switch (option) { + case 'n': + if (device != NULL) { + fprintf(stderr, "device already specified\n"); + rc = 2; + goto exit; + } + /* remove /dev if given */ + if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) + util_strscpyl(name, sizeof(name), udev_get_dev_path(udev), "/", optarg, NULL); + else + util_strscpy(name, sizeof(name), optarg); + util_remove_trailing_chars(name, '/'); + if (stat(name, &statbuf) < 0) { + fprintf(stderr, "device node not found\n"); + rc = 2; + goto exit; + } else { + char type; + + if (S_ISBLK(statbuf.st_mode)) { + type = 'b'; + } else if (S_ISCHR(statbuf.st_mode)) { + type = 'c'; + } else { + fprintf(stderr, "device node has wrong file type\n"); + rc = 2; + goto exit; + } + device = udev_device_new_from_devnum(udev, type, statbuf.st_rdev); + if (device == NULL) { + fprintf(stderr, "device node not found\n"); + rc = 2; + goto exit; + } + } + break; + case 'p': + if (device != NULL) { + fprintf(stderr, "device already specified\n"); + rc = 2; + goto exit; + } + /* add sys dir if needed */ + if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); + else + util_strscpy(path, sizeof(path), optarg); + util_remove_trailing_chars(path, '/'); + device = udev_device_new_from_syspath(udev, path); + if (device == NULL) { + fprintf(stderr, "device path not found\n"); + rc = 2; + goto exit; + } + break; + case 'q': + action = ACTION_QUERY; + if (strcmp(optarg, "property") == 0 || strcmp(optarg, "env") == 0) { + query = QUERY_PROPERTY; + } else if (strcmp(optarg, "name") == 0) { + query = QUERY_NAME; + } else if (strcmp(optarg, "symlink") == 0) { + query = QUERY_SYMLINK; + } else if (strcmp(optarg, "path") == 0) { + query = QUERY_PATH; + } else if (strcmp(optarg, "all") == 0) { + query = QUERY_ALL; + } else { + fprintf(stderr, "unknown query type\n"); + rc = 3; + goto exit; + } + break; + case 'r': + if (action == ACTION_NONE) + action = ACTION_ROOT; + root = true; + break; + case 'R': + printf("%s\n", udev_get_run_path(udev)); + goto exit; + case 'd': + action = ACTION_DEVICE_ID_FILE; + util_strscpy(name, sizeof(name), optarg); + break; + case 'a': + action = ACTION_ATTRIBUTE_WALK; + break; + case 'e': + export_devices(udev); + goto exit; + case 'c': + cleanup_db(udev); + goto exit; + case 'x': + export = true; + break; + case 'P': + export_prefix = optarg; + break; + case 'V': + printf("%s\n", VERSION); + goto exit; + case 'h': + printf("Usage: udevadm info OPTIONS\n" + " --query= query device information:\n" + " name name of device node\n" + " symlink pointing to node\n" + " path sys device path\n" + " property the device properties\n" + " all all values\n" + " --path= sys device path used for query or attribute walk\n" + " --name= node or symlink name used for query or attribute walk\n" + " --root prepend dev directory to path names\n" + " --attribute-walk print all key matches while walking along the chain\n" + " of parent devices\n" + " --device-id-of-file= print major:minor of device containing this file\n" + " --export export key/value pairs\n" + " --export-prefix export the key name with a prefix\n" + " --export-db export the content of the udev database\n" + " --cleanup-db cleanup the udev database\n" + " --help\n\n"); + goto exit; + default: + rc = 1; + goto exit; + } + } + + switch (action) { + case ACTION_QUERY: + if (device == NULL) { + fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); + rc = 4; + goto exit; + } + + switch(query) { + case QUERY_NAME: { + const char *node = udev_device_get_devnode(device); + + if (node == NULL) { + fprintf(stderr, "no device node found\n"); + rc = 5; + goto exit; + } + + if (root) { + printf("%s\n", udev_device_get_devnode(device)); + } else { + size_t len = strlen(udev_get_dev_path(udev)); + + printf("%s\n", &udev_device_get_devnode(device)[len+1]); + } + break; + } + case QUERY_SYMLINK: + list_entry = udev_device_get_devlinks_list_entry(device); + while (list_entry != NULL) { + if (root) { + printf("%s", udev_list_entry_get_name(list_entry)); + } else { + size_t len; + + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + printf("%s", &udev_list_entry_get_name(list_entry)[len+1]); + } + list_entry = udev_list_entry_get_next(list_entry); + if (list_entry != NULL) + printf(" "); + } + printf("\n"); + break; + case QUERY_PATH: + printf("%s\n", udev_device_get_devpath(device)); + goto exit; + case QUERY_PROPERTY: + list_entry = udev_device_get_properties_list_entry(device); + while (list_entry != NULL) { + if (export) { + const char *prefix = export_prefix; + + if (prefix == NULL) + prefix = ""; + printf("%s%s='%s'\n", prefix, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } else { + printf("%s=%s\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + } + list_entry = udev_list_entry_get_next(list_entry); + } + break; + case QUERY_ALL: + print_record(device); + break; + default: + fprintf(stderr, "unknown query type\n"); + break; + } + break; + case ACTION_ATTRIBUTE_WALK: + if (device == NULL) { + fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); + rc = 4; + goto exit; + } + print_device_chain(device); + break; + case ACTION_DEVICE_ID_FILE: + if (stat_device(name, export, export_prefix) != 0) + rc = 1; + break; + case ACTION_ROOT: + printf("%s\n", udev_get_dev_path(udev)); + break; + default: + fprintf(stderr, "missing option\n"); + rc = 1; + break; + } + +exit: + udev_device_unref(device); + return rc; +} + +const struct udevadm_cmd udevadm_info = { + .name = "info", + .cmd = uinfo, + .help = "query sysfs or the udev database", +}; diff --git a/src/udevadm-monitor.c b/src/udevadm-monitor.c new file mode 100644 index 0000000000..64913dbd55 --- /dev/null +++ b/src/udevadm-monitor.c @@ -0,0 +1,297 @@ +/* + * Copyright (C) 2004-2010 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static bool udev_exit; + +static void sig_handler(int signum) +{ + if (signum == SIGINT || signum == SIGTERM) + udev_exit = true; +} + +static void print_device(struct udev_device *device, const char *source, int prop) +{ + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + printf("%-6s[%llu.%06u] %-8s %s (%s)\n", + source, + (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, + udev_device_get_action(device), + udev_device_get_devpath(device), + udev_device_get_subsystem(device)); + if (prop) { + struct udev_list_entry *list_entry; + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) + printf("%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + printf("\n"); + } +} + +static int adm_monitor(struct udev *udev, int argc, char *argv[]) +{ + struct sigaction act; + sigset_t mask; + int option; + bool prop = false; + bool print_kernel = false; + bool print_udev = false; + struct udev_list subsystem_match_list; + struct udev_list tag_match_list; + struct udev_monitor *udev_monitor = NULL; + struct udev_monitor *kernel_monitor = NULL; + int fd_ep = -1; + int fd_kernel = -1, fd_udev = -1; + struct epoll_event ep_kernel, ep_udev; + int rc = 0; + + static const struct option options[] = { + { "property", no_argument, NULL, 'p' }, + { "environment", no_argument, NULL, 'e' }, + { "kernel", no_argument, NULL, 'k' }, + { "udev", no_argument, NULL, 'u' }, + { "subsystem-match", required_argument, NULL, 's' }, + { "tag-match", required_argument, NULL, 't' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + udev_list_init(udev, &subsystem_match_list, true); + udev_list_init(udev, &tag_match_list, true); + + for (;;) { + option = getopt_long(argc, argv, "pekus:t:h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'p': + case 'e': + prop = true; + break; + case 'k': + print_kernel = true; + break; + case 'u': + print_udev = true; + break; + case 's': + { + char subsys[UTIL_NAME_SIZE]; + char *devtype; + + util_strscpy(subsys, sizeof(subsys), optarg); + devtype = strchr(subsys, '/'); + if (devtype != NULL) { + devtype[0] = '\0'; + devtype++; + } + udev_list_entry_add(&subsystem_match_list, subsys, devtype); + break; + } + case 't': + udev_list_entry_add(&tag_match_list, optarg, NULL); + break; + case 'h': + printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" + " --property print the event properties\n" + " --kernel print kernel uevents\n" + " --udev print udev events\n" + " --subsystem-match= filter events by subsystem\n" + " --tag-match= filter events by tag\n" + " --help\n\n"); + goto out; + default: + rc = 1; + goto out; + } + } + + if (!print_kernel && !print_udev) { + print_kernel = true; + print_udev = true; + } + + /* set signal handlers */ + memset(&act, 0x00, sizeof(struct sigaction)); + act.sa_handler = sig_handler; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_RESTART; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + sigemptyset(&mask); + sigaddset(&mask, SIGINT); + sigaddset(&mask, SIGTERM); + sigprocmask(SIG_UNBLOCK, &mask, NULL); + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto out; + } + + printf("monitor will print the received events for:\n"); + if (print_udev) { + struct udev_list_entry *entry; + + udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); + if (udev_monitor == NULL) { + fprintf(stderr, "error: unable to create netlink socket\n"); + rc = 1; + goto out; + } + udev_monitor_set_receive_buffer_size(udev_monitor, 128*1024*1024); + fd_udev = udev_monitor_get_fd(udev_monitor); + + udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { + const char *subsys = udev_list_entry_get_name(entry); + const char *devtype = udev_list_entry_get_value(entry); + + if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, subsys, devtype) < 0) + fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys); + } + + udev_list_entry_foreach(entry, udev_list_get_entry(&tag_match_list)) { + const char *tag = udev_list_entry_get_name(entry); + + if (udev_monitor_filter_add_match_tag(udev_monitor, tag) < 0) + fprintf(stderr, "error: unable to apply tag filter '%s'\n", tag); + } + + if (udev_monitor_enable_receiving(udev_monitor) < 0) { + fprintf(stderr, "error: unable to subscribe to udev events\n"); + rc = 2; + goto out; + } + + memset(&ep_udev, 0, sizeof(struct epoll_event)); + ep_udev.events = EPOLLIN; + ep_udev.data.fd = fd_udev; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + + printf("UDEV - the event which udev sends out after rule processing\n"); + } + + if (print_kernel) { + struct udev_list_entry *entry; + + kernel_monitor = udev_monitor_new_from_netlink(udev, "kernel"); + if (kernel_monitor == NULL) { + fprintf(stderr, "error: unable to create netlink socket\n"); + rc = 3; + goto out; + } + udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); + fd_kernel = udev_monitor_get_fd(kernel_monitor); + + udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { + const char *subsys = udev_list_entry_get_name(entry); + + if (udev_monitor_filter_add_match_subsystem_devtype(kernel_monitor, subsys, NULL) < 0) + fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys); + } + + if (udev_monitor_enable_receiving(kernel_monitor) < 0) { + fprintf(stderr, "error: unable to subscribe to kernel events\n"); + rc = 4; + goto out; + } + + memset(&ep_kernel, 0, sizeof(struct epoll_event)); + ep_kernel.events = EPOLLIN; + ep_kernel.data.fd = fd_kernel; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + + printf("KERNEL - the kernel uevent\n"); + } + printf("\n"); + + while (!udev_exit) { + int fdcount; + struct epoll_event ev[4]; + int i; + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + if (fdcount < 0) { + if (errno != EINTR) + fprintf(stderr, "error receiving uevent message: %m\n"); + continue; + } + + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_kernel && ev[i].events & EPOLLIN) { + struct udev_device *device; + + device = udev_monitor_receive_device(kernel_monitor); + if (device == NULL) + continue; + print_device(device, "KERNEL", prop); + udev_device_unref(device); + } else if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { + struct udev_device *device; + + device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) + continue; + print_device(device, "UDEV", prop); + udev_device_unref(device); + } + } + } +out: + if (fd_ep >= 0) + close(fd_ep); + udev_monitor_unref(udev_monitor); + udev_monitor_unref(kernel_monitor); + udev_list_cleanup(&subsystem_match_list); + udev_list_cleanup(&tag_match_list); + return rc; +} + +const struct udevadm_cmd udevadm_monitor = { + .name = "monitor", + .cmd = adm_monitor, + .help = "listen to kernel and udev events", +}; diff --git a/src/udevadm-settle.c b/src/udevadm-settle.c new file mode 100644 index 0000000000..a59d7c39e5 --- /dev/null +++ b/src/udevadm-settle.c @@ -0,0 +1,235 @@ +/* + * Copyright (C) 2006-2009 Kay Sievers + * Copyright (C) 2009 Canonical Ltd. + * Copyright (C) 2009 Scott James Remnant + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int adm_settle(struct udev *udev, int argc, char *argv[]) +{ + static const struct option options[] = { + { "seq-start", required_argument, NULL, 's' }, + { "seq-end", required_argument, NULL, 'e' }, + { "timeout", required_argument, NULL, 't' }, + { "exit-if-exists", required_argument, NULL, 'E' }, + { "quiet", no_argument, NULL, 'q' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + unsigned long long start_usec = now_usec(); + unsigned long long start = 0; + unsigned long long end = 0; + int quiet = 0; + const char *exists = NULL; + unsigned int timeout = 120; + struct pollfd pfd[1]; + struct udev_queue *udev_queue = NULL; + int rc = EXIT_FAILURE; + + dbg(udev, "version %s\n", VERSION); + + for (;;) { + int option; + int seconds; + + option = getopt_long(argc, argv, "s:e:t:E:qh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 's': + start = strtoull(optarg, NULL, 0); + break; + case 'e': + end = strtoull(optarg, NULL, 0); + break; + case 't': + seconds = atoi(optarg); + if (seconds >= 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); + dbg(udev, "timeout=%i\n", timeout); + break; + case 'q': + quiet = 1; + break; + case 'E': + exists = optarg; + break; + case 'h': + printf("Usage: udevadm settle OPTIONS\n" + " --timeout= maximum time to wait for events\n" + " --seq-start= first seqnum to wait for\n" + " --seq-end= last seqnum to wait for\n" + " --exit-if-exists= stop waiting if file exists\n" + " --quiet do not print list after timeout\n" + " --help\n\n"); + exit(EXIT_SUCCESS); + default: + exit(EXIT_FAILURE); + } + } + + udev_queue = udev_queue_new(udev); + if (udev_queue == NULL) + exit(2); + + if (start > 0) { + unsigned long long kernel_seq; + + kernel_seq = udev_queue_get_kernel_seqnum(udev_queue); + + /* unless specified, the last event is the current kernel seqnum */ + if (end == 0) + end = udev_queue_get_kernel_seqnum(udev_queue); + + if (start > end) { + err(udev, "seq-start larger than seq-end, ignoring\n"); + start = 0; + end = 0; + } + + if (start > kernel_seq || end > kernel_seq) { + err(udev, "seq-start or seq-end larger than current kernel value, ignoring\n"); + start = 0; + end = 0; + } + info(udev, "start=%llu end=%llu current=%llu\n", start, end, kernel_seq); + } else { + if (end > 0) { + err(udev, "seq-end needs seq-start parameter, ignoring\n"); + end = 0; + } + } + + /* guarantee that the udev daemon isn't pre-processing */ + if (getuid() == 0) { + struct udev_ctrl *uctrl; + + uctrl = udev_ctrl_new(udev); + if (uctrl != NULL) { + if (udev_ctrl_send_ping(uctrl, timeout) < 0) { + info(udev, "no connection to daemon\n"); + udev_ctrl_unref(uctrl); + rc = EXIT_SUCCESS; + goto out; + } + udev_ctrl_unref(uctrl); + } + } + + pfd[0].events = POLLIN; + pfd[0].fd = inotify_init1(IN_CLOEXEC); + if (pfd[0].fd < 0) { + err(udev, "inotify_init failed: %m\n"); + } else { + if (inotify_add_watch(pfd[0].fd, udev_get_run_path(udev), IN_MOVED_TO) < 0) { + err(udev, "watching '%s' failed\n", udev_get_run_path(udev)); + close(pfd[0].fd); + pfd[0].fd = -1; + } + } + + for (;;) { + struct stat statbuf; + + if (exists != NULL && stat(exists, &statbuf) == 0) { + rc = EXIT_SUCCESS; + break; + } + + if (start > 0) { + /* if asked for, wait for a specific sequence of events */ + if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) { + rc = EXIT_SUCCESS; + break; + } + } else { + /* exit if queue is empty */ + if (udev_queue_get_queue_is_empty(udev_queue)) { + rc = EXIT_SUCCESS; + break; + } + } + + if (pfd[0].fd >= 0) { + int delay; + + if (exists != NULL || start > 0) + delay = 100; + else + delay = 1000; + /* wake up after delay, or immediately after the queue is rebuilt */ + if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) { + char buf[sizeof(struct inotify_event) + PATH_MAX]; + + read(pfd[0].fd, buf, sizeof(buf)); + } + } else { + sleep(1); + } + + if (timeout > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - start_usec; + if (age_usec / (1000 * 1000) >= timeout) { + struct udev_list_entry *list_entry; + + if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) { + info(udev, "timeout waiting for udev queue\n"); + printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf(" %s (%s)\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + + break; + } + } + } +out: + if (pfd[0].fd >= 0) + close(pfd[0].fd); + udev_queue_unref(udev_queue); + return rc; +} + +const struct udevadm_cmd udevadm_settle = { + .name = "settle", + .cmd = adm_settle, + .help = "wait for the event queue to finish", +}; diff --git a/src/udevadm-test-builtin.c b/src/udevadm-test-builtin.c new file mode 100644 index 0000000000..253fcd0c8f --- /dev/null +++ b/src/udevadm-test-builtin.c @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2011 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static void help(struct udev *udev) +{ + fprintf(stderr, "\n"); + fprintf(stderr, "Usage: udevadm builtin [--help] \n"); + udev_builtin_list(udev); + fprintf(stderr, "\n"); +} + +static int adm_builtin(struct udev *udev, int argc, char *argv[]) +{ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + {} + }; + char *command = NULL; + char *syspath = NULL; + char filename[UTIL_PATH_SIZE]; + struct udev_device *dev = NULL; + enum udev_builtin_cmd cmd; + int rc = EXIT_SUCCESS; + + dbg(udev, "version %s\n", VERSION); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + help(udev); + goto out; + } + } + + command = argv[optind++]; + if (command == NULL) { + fprintf(stderr, "command missing\n"); + help(udev); + rc = 2; + goto out; + } + + syspath = argv[optind++]; + if (syspath == NULL) { + fprintf(stderr, "syspath missing\n\n"); + rc = 3; + goto out; + } + + udev_builtin_init(udev); + + cmd = udev_builtin_lookup(command); + if (cmd >= UDEV_BUILTIN_MAX) { + fprintf(stderr, "unknown command '%s'\n", command); + help(udev); + rc = 5; + goto out; + } + + /* add /sys if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); + else + util_strscpy(filename, sizeof(filename), syspath); + util_remove_trailing_chars(filename, '/'); + + dev = udev_device_new_from_syspath(udev, filename); + if (dev == NULL) { + fprintf(stderr, "unable to open device '%s'\n\n", filename); + rc = 4; + goto out; + } + + if (udev_builtin_run(dev, cmd, command, true) < 0) { + fprintf(stderr, "error executing '%s'\n\n", command); + rc = 6; + } +out: + udev_device_unref(dev); + udev_builtin_exit(udev); + return rc; +} + +const struct udevadm_cmd udevadm_test_builtin = { + .name = "test-builtin", + .cmd = adm_builtin, + .help = "test a built-in command", + .debug = true, +}; diff --git a/src/udevadm-test.c b/src/udevadm-test.c new file mode 100644 index 0000000000..851500527f --- /dev/null +++ b/src/udevadm-test.c @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2003-2004 Greg Kroah-Hartman + * Copyright (C) 2004-2008 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int adm_test(struct udev *udev, int argc, char *argv[]) +{ + int resolve_names = 1; + char filename[UTIL_PATH_SIZE]; + const char *action = "add"; + const char *syspath = NULL; + struct udev_event *event = NULL; + struct udev_device *dev = NULL; + struct udev_rules *rules = NULL; + struct udev_list_entry *entry; + sigset_t mask, sigmask_orig; + int err; + int rc = 0; + + static const struct option options[] = { + { "action", required_argument, NULL, 'a' }, + { "resolve-names", required_argument, NULL, 'N' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + info(udev, "version %s\n", VERSION); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "a:s:N:fh", options, NULL); + if (option == -1) + break; + + dbg(udev, "option '%c'\n", option); + switch (option) { + case 'a': + action = optarg; + break; + case 'N': + if (strcmp (optarg, "early") == 0) { + resolve_names = 1; + } else if (strcmp (optarg, "late") == 0) { + resolve_names = 0; + } else if (strcmp (optarg, "never") == 0) { + resolve_names = -1; + } else { + fprintf(stderr, "resolve-names must be early, late or never\n"); + err(udev, "resolve-names must be early, late or never\n"); + exit(EXIT_FAILURE); + } + break; + case 'h': + printf("Usage: udevadm test OPTIONS \n" + " --action= set action string\n" + " --help\n\n"); + exit(EXIT_SUCCESS); + default: + exit(EXIT_FAILURE); + } + } + syspath = argv[optind]; + + if (syspath == NULL) { + fprintf(stderr, "syspath parameter missing\n"); + rc = 2; + goto out; + } + + printf("This program is for debugging only, it does not run any program,\n" + "specified by a RUN key. It may show incorrect results, because\n" + "some values may be different, or not available at a simulation run.\n" + "\n"); + + sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); + + udev_builtin_init(udev); + + rules = udev_rules_new(udev, resolve_names); + if (rules == NULL) { + fprintf(stderr, "error reading rules\n"); + rc = 3; + goto out; + } + + /* add /sys if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); + else + util_strscpy(filename, sizeof(filename), syspath); + util_remove_trailing_chars(filename, '/'); + + dev = udev_device_new_from_syspath(udev, filename); + if (dev == NULL) { + fprintf(stderr, "unable to open device '%s'\n", filename); + rc = 4; + goto out; + } + + /* skip reading of db, but read kernel parameters */ + udev_device_set_info_loaded(dev); + udev_device_read_uevent_file(dev); + + udev_device_set_action(dev, action); + event = udev_event_new(dev); + + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (event->fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + rc = 5; + goto out; + } + + err = udev_event_execute_rules(event, rules, &sigmask_orig); + + udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) + printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); + + if (err == 0) { + udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { + char program[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); + printf("run: '%s'\n", program); + } + } +out: + if (event != NULL && event->fd_signal >= 0) + close(event->fd_signal); + udev_event_unref(event); + udev_device_unref(dev); + udev_rules_unref(rules); + udev_builtin_exit(udev); + return rc; +} + +const struct udevadm_cmd udevadm_test = { + .name = "test", + .cmd = adm_test, + .help = "test an event run", + .debug = true, +}; diff --git a/src/udevadm-trigger.c b/src/udevadm-trigger.c new file mode 100644 index 0000000000..2cee2297d4 --- /dev/null +++ b/src/udevadm-trigger.c @@ -0,0 +1,232 @@ +/* + * Copyright (C) 2008-2009 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static int verbose; +static int dry_run; + +static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_list_entry *entry; + + udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(udev_enumerate)) { + char filename[UTIL_PATH_SIZE]; + int fd; + + if (verbose) + printf("%s\n", udev_list_entry_get_name(entry)); + if (dry_run) + continue; + util_strscpyl(filename, sizeof(filename), udev_list_entry_get_name(entry), "/uevent", NULL); + fd = open(filename, O_WRONLY); + if (fd < 0) { + dbg(udev, "error on opening %s: %m\n", filename); + continue; + } + if (write(fd, action, strlen(action)) < 0) + info(udev, "error writing '%s' to '%s': %m\n", action, filename); + close(fd); + } +} + +static const char *keyval(const char *str, const char **val, char *buf, size_t size) +{ + char *pos; + + util_strscpy(buf, size,str); + pos = strchr(buf, '='); + if (pos != NULL) { + pos[0] = 0; + pos++; + } + *val = pos; + return buf; +} + +static int adm_trigger(struct udev *udev, int argc, char *argv[]) +{ + static const struct option options[] = { + { "verbose", no_argument, NULL, 'v' }, + { "dry-run", no_argument, NULL, 'n' }, + { "type", required_argument, NULL, 't' }, + { "action", required_argument, NULL, 'c' }, + { "subsystem-match", required_argument, NULL, 's' }, + { "subsystem-nomatch", required_argument, NULL, 'S' }, + { "attr-match", required_argument, NULL, 'a' }, + { "attr-nomatch", required_argument, NULL, 'A' }, + { "property-match", required_argument, NULL, 'p' }, + { "tag-match", required_argument, NULL, 'g' }, + { "sysname-match", required_argument, NULL, 'y' }, + { "parent-match", required_argument, NULL, 'b' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + enum { + TYPE_DEVICES, + TYPE_SUBSYSTEMS, + } device_type = TYPE_DEVICES; + const char *action = "change"; + struct udev_enumerate *udev_enumerate; + int rc = 0; + + dbg(udev, "version %s\n", VERSION); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) { + rc = 1; + goto exit; + } + + for (;;) { + int option; + const char *key; + const char *val; + char buf[UTIL_PATH_SIZE]; + + option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:b:", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'v': + verbose = 1; + break; + case 'n': + dry_run = 1; + break; + case 't': + if (strcmp(optarg, "devices") == 0) { + device_type = TYPE_DEVICES; + } else if (strcmp(optarg, "subsystems") == 0) { + device_type = TYPE_SUBSYSTEMS; + } else { + err(udev, "unknown type --type=%s\n", optarg); + rc = 2; + goto exit; + } + break; + case 'c': + action = optarg; + break; + case 's': + udev_enumerate_add_match_subsystem(udev_enumerate, optarg); + break; + case 'S': + udev_enumerate_add_nomatch_subsystem(udev_enumerate, optarg); + break; + case 'a': + key = keyval(optarg, &val, buf, sizeof(buf)); + udev_enumerate_add_match_sysattr(udev_enumerate, key, val); + break; + case 'A': + key = keyval(optarg, &val, buf, sizeof(buf)); + udev_enumerate_add_nomatch_sysattr(udev_enumerate, key, val); + break; + case 'p': + key = keyval(optarg, &val, buf, sizeof(buf)); + udev_enumerate_add_match_property(udev_enumerate, key, val); + break; + case 'g': + udev_enumerate_add_match_tag(udev_enumerate, optarg); + break; + case 'y': + udev_enumerate_add_match_sysname(udev_enumerate, optarg); + break; + case 'b': { + char path[UTIL_PATH_SIZE]; + struct udev_device *dev; + + /* add sys dir if needed */ + if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); + else + util_strscpy(path, sizeof(path), optarg); + util_remove_trailing_chars(path, '/'); + dev = udev_device_new_from_syspath(udev, path); + if (dev == NULL) { + err(udev, "unable to open the device '%s'\n", optarg); + rc = 2; + goto exit; + } + udev_enumerate_add_match_parent(udev_enumerate, dev); + /* drop reference immediately, enumerate pins the device as long as needed */ + udev_device_unref(dev); + break; + } + case 'h': + printf("Usage: udevadm trigger OPTIONS\n" + " --verbose print the list of devices while running\n" + " --dry-run do not actually trigger the events\n" + " --type= type of events to trigger\n" + " devices sys devices (default)\n" + " subsystems sys subsystems and drivers\n" + " --action= event action value, default is \"change\"\n" + " --subsystem-match= trigger devices from a matching subsystem\n" + " --subsystem-nomatch= exclude devices from a matching subsystem\n" + " --attr-match=]> trigger devices with a matching attribute\n" + " --attr-nomatch=]> exclude devices with a matching attribute\n" + " --property-match== trigger devices with a matching property\n" + " --tag-match== trigger devices with a matching property\n" + " --sysname-match= trigger devices with a matching name\n" + " --parent-match= trigger devices with that parent device\n" + " --help\n\n"); + goto exit; + default: + rc = 1; + goto exit; + } + } + + switch (device_type) { + case TYPE_SUBSYSTEMS: + udev_enumerate_scan_subsystems(udev_enumerate); + exec_list(udev_enumerate, action); + goto exit; + case TYPE_DEVICES: + udev_enumerate_scan_devices(udev_enumerate); + exec_list(udev_enumerate, action); + goto exit; + default: + goto exit; + } +exit: + udev_enumerate_unref(udev_enumerate); + return rc; +} + +const struct udevadm_cmd udevadm_trigger = { + .name = "trigger", + .cmd = adm_trigger, + .help = "request events from the kernel", +}; diff --git a/src/udevadm.c b/src/udevadm.c new file mode 100644 index 0000000000..5410f00c02 --- /dev/null +++ b/src/udevadm.c @@ -0,0 +1,165 @@ +/* + * Copyright (C) 2007-2009 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" + +static bool debug; + +void udev_main_log(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + va_list args2; + + va_copy(args2, args); + vfprintf(stderr, format, args2); + va_end(args2); + vsyslog(priority, format, args); + } +} + +static int adm_version(struct udev *udev, int argc, char *argv[]) +{ + printf("%s\n", VERSION); + return 0; +} +static const struct udevadm_cmd udevadm_version = { + .name = "version", + .cmd = adm_version, +}; + +static int adm_help(struct udev *udev, int argc, char *argv[]); +static const struct udevadm_cmd udevadm_help = { + .name = "help", + .cmd = adm_help, +}; + +static const struct udevadm_cmd *udevadm_cmds[] = { + &udevadm_info, + &udevadm_trigger, + &udevadm_settle, + &udevadm_control, + &udevadm_monitor, + &udevadm_test, + &udevadm_test_builtin, + &udevadm_version, + &udevadm_help, +}; + +static int adm_help(struct udev *udev, int argc, char *argv[]) +{ + unsigned int i; + + fprintf(stderr, "Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); + for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) + if (udevadm_cmds[i]->help != NULL) + printf(" %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help); + fprintf(stderr, "\n"); + return 0; +} + +static int run_command(struct udev *udev, const struct udevadm_cmd *cmd, int argc, char *argv[]) +{ + if (cmd->debug) { + debug = true; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + } + info(udev, "calling: %s\n", cmd->name); + return cmd->cmd(udev, argc, argv); +} + +int main(int argc, char *argv[]) +{ + struct udev *udev; + static const struct option options[] = { + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + {} + }; + const char *command; + unsigned int i; + int rc = 1; + + udev = udev_new(); + if (udev == NULL) + goto out; + + udev_log_init("udevadm"); + udev_set_log_fn(udev, udev_main_log); + udev_selinux_init(udev); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "+dhV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = true; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + rc = adm_help(udev, argc, argv); + goto out; + case 'V': + rc = adm_version(udev, argc, argv); + goto out; + default: + goto out; + } + } + command = argv[optind]; + + info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); + + if (command != NULL) + for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) { + if (strcmp(udevadm_cmds[i]->name, command) == 0) { + argc -= optind; + argv += optind; + optind = 0; + rc = run_command(udev, udevadm_cmds[i], argc, argv); + goto out; + } + } + + fprintf(stderr, "missing or unknown command\n\n"); + adm_help(udev, argc, argv); + rc = 2; +out: + udev_selinux_exit(udev); + udev_unref(udev); + udev_log_close(); + return rc; +} diff --git a/src/udevadm.xml b/src/udevadm.xml new file mode 100644 index 0000000000..455ce80ca9 --- /dev/null +++ b/src/udevadm.xml @@ -0,0 +1,472 @@ + + + + + + + udevadm + udev + + + + udevadm + 8 + + + + + udevadmudev management tool + + + + + udevadm + + + + + + udevadm info options + + + udevadm trigger options + + + udevadm settle options + + + udevadm control command + + + udevadm monitor options + + + udevadm test options devpath + + + udevadm test-builtin options command devpath + + + + Description + udevadm expects a command and command specific options. It + controls the runtime behavior of udev, requests kernel events, + manages the event queue, and provides simple debugging mechanisms. + + + OPTIONS + + + + + Print debug messages to stderr. + + + + + + Print version number. + + + + + + Print help text. + + + + + udevadm info <replaceable>options</replaceable> + Queries the udev database for device information + stored in the udev database. It can also query the properties + of a device from its sysfs representation to help creating udev + rules that match this device. + + + + + Query the database for specified type of device data. It needs the + or to identify the specified + device. Valid queries are: + name, symlink, path, + property, all. + + + + + + The devpath of the device to query. + + + + + + The name of the device node or a symlink to query + + + + + + The udev root directory: /dev. If used in conjunction + with a name or symlink query, the + query returns the absolute path including the root directory. + + + + + + The udev runtime directory: /run/udev. + + + + + + Print all sysfs properties of the specified device that can be used + in udev rules to match the specified device. It prints all devices + along the chain, up to the root of sysfs that can be used in udev rules. + + + + + + Print output as key/value pairs. Values are enclosed in single quotes. + + + + + + Add a prefix to the key name of exported values. + + + + + + Print major/minor numbers of the underlying device, where the file + lives on. + + + + + + Export the content of the udev database. + + + + + + Cleanup the udev database. + + + + + + Print version. + + + + + + Print help text. + + + + + + udevadm trigger <optional>options</optional> + Request device events from the kernel. Primarily used to replay events at system coldplug time. + + + + + Print the list of devices which will be triggered. + + + + + + Do not actually trigger the event. + + + + + + Trigger a specific type of devices. Valid types are: + devices, subsystems. + The default value is devices. + + + + + + Type of event to be triggered. The default value is change. + + + + + + Trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Do not trigger events for devices which belong to a matching subsystem. This option + can be specified multiple times and supports shell style pattern matching. + + + + + + Trigger events for devices with a matching sysfs attribute. If a value is specified + along with the attribute name, the content of the attribute is matched against the given + value using shell style pattern matching. If no value is specified, the existence of the + sysfs attribute is checked. This option can be specified multiple times. + + + + + + Do not trigger events for devices with a matching sysfs attribute. If a value is + specified along with the attribute name, the content of the attribute is matched against + the given value using shell style pattern matching. If no value is specified, the existence + of the sysfs attribute is checked. This option can be specified multiple times. + + + + + + Trigger events for devices with a matching property value. This option can be + specified multiple times and supports shell style pattern matching. + + + + + + Trigger events for devices with a matching tag. This option can be + specified multiple times. + + + + + + Trigger events for devices with a matching sys device name. This option can be + specified multiple times and supports shell style pattern matching. + + + + + + Trigger events for all children of a given device. + + + + + + udevadm settle <optional>options</optional> + Watches the udev event queue, and exits if all current events are handled. + + + + + Maximum number of seconds to wait for the event queue to become empty. + The default value is 120 seconds. A value of 0 will check if the queue is empty + and always return immediately. + + + + + + Wait only for events after the given sequence number. + + + + + + Wait only for events before the given sequence number. + + + + + + Stop waiting if file exists. + + + + + + Do not print any output, like the remaining queue entries when reaching the timeout. + + + + + + Print help text. + + + + + + udevadm control <replaceable>command</replaceable> + Modify the internal state of the running udev daemon. + + + + + Signal and wait for udevd to exit. + + + + + + Set the internal log level of udevd. Valid values are the numerical + syslog priorities or their textual representations: , + and . + + + + + + Signal udevd to stop executing new events. Incoming events + will be queued. + + + + + + Signal udevd to enable the execution of events. + + + + + + Signal udevd to reload the rules files and other databases like the kernel + module index. Reloading rules and databases does not apply any changes to already + existing devices; the new configuration will only be applied to new events. + + + + + + Set a global property for all events. + + + + value + + Set the maximum number of events, udevd will handle at the + same time. + + + + seconds + + The maximum number seconds to wait for a reply from udevd. + + + + + + Print help text. + + + + + + udevadm monitor <optional>options</optional> + Listens to the kernel uevents and events sent out by a udev rule + and prints the devpath of the event to the console. It can be used to analyze the + event timing, by comparing the timestamps of the kernel uevent and the udev event. + + + + + + Print the kernel uevents. + + + + + + Print the udev event after the rule processing. + + + + + + Also print the properties of the event. + + + + + + Filter events by subsystem[/devtype]. Only udev events with a matching subsystem value will pass. + + + + + + Filter events by property. Only udev events with a given tag attached will pass. + + + + + + Print help text. + + + + + + udevadm test <optional>options</optional> <replaceable>devpath</replaceable> + Simulate a udev event run for the given device, and print debug output. + + + + + The action string. + + + + + + The subsystem string. + + + + + + Print help text. + + + + + + udevadm test-builtin <optional>options</optional> <replaceable>command</replaceable> <replaceable>devpath</replaceable> + Run a built-in command for the given device, and print debug output. + + + + + Print help text. + + + + + + + Author + Written by Kay Sievers kay.sievers@vrfy.org. + + + + See Also + + udev7 + + + udevd8 + + + diff --git a/src/udevd.c b/src/udevd.c new file mode 100644 index 0000000000..b88213e5b5 --- /dev/null +++ b/src/udevd.c @@ -0,0 +1,1708 @@ +/* + * Copyright (C) 2004-2011 Kay Sievers + * Copyright (C) 2004 Chris Friesen + * Copyright (C) 2009 Canonical Ltd. + * Copyright (C) 2009 Scott James Remnant + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "udev.h" +#include "sd-daemon.h" + +static bool debug; + +void udev_main_log(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + char buf[1024]; + struct timespec ts; + + vsnprintf(buf, sizeof(buf), format, args); + clock_gettime(CLOCK_MONOTONIC, &ts); + fprintf(stderr, "[%llu.%06u] [%u] %s: %s", + (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, + (int) getpid(), fn, buf); + } else { + vsyslog(priority, format, args); + } +} + +static struct udev_rules *rules; +static struct udev_queue_export *udev_queue_export; +static struct udev_ctrl *udev_ctrl; +static struct udev_monitor *monitor; +static int worker_watch[2] = { -1, -1 }; +static int fd_signal = -1; +static int fd_ep = -1; +static int fd_inotify = -1; +static bool stop_exec_queue; +static bool reload; +static int children; +static int children_max; +static int exec_delay; +static sigset_t sigmask_orig; +static UDEV_LIST(event_list); +static UDEV_LIST(worker_list); +static bool udev_exit; + +enum event_state { + EVENT_UNDEF, + EVENT_QUEUED, + EVENT_RUNNING, +}; + +struct event { + struct udev_list_node node; + struct udev *udev; + struct udev_device *dev; + enum event_state state; + int exitcode; + unsigned long long int delaying_seqnum; + unsigned long long int seqnum; + const char *devpath; + size_t devpath_len; + const char *devpath_old; + dev_t devnum; + bool is_block; + int ifindex; +}; + +static struct event *node_to_event(struct udev_list_node *node) +{ + char *event; + + event = (char *)node; + event -= offsetof(struct event, node); + return (struct event *)event; +} + +static void event_queue_cleanup(struct udev *udev, enum event_state type); + +enum worker_state { + WORKER_UNDEF, + WORKER_RUNNING, + WORKER_IDLE, + WORKER_KILLED, +}; + +struct worker { + struct udev_list_node node; + struct udev *udev; + int refcount; + pid_t pid; + struct udev_monitor *monitor; + enum worker_state state; + struct event *event; +}; + +/* passed from worker to main process */ +struct worker_message { + pid_t pid; + int exitcode; +}; + +static struct worker *node_to_worker(struct udev_list_node *node) +{ + char *worker; + + worker = (char *)node; + worker -= offsetof(struct worker, node); + return (struct worker *)worker; +} + +static void event_queue_delete(struct event *event, bool export) +{ + udev_list_node_remove(&event->node); + + if (export) { + udev_queue_export_device_finished(udev_queue_export, event->dev); + info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); + } + udev_device_unref(event->dev); + free(event); +} + +static struct worker *worker_ref(struct worker *worker) +{ + worker->refcount++; + return worker; +} + +static void worker_cleanup(struct worker *worker) +{ + udev_list_node_remove(&worker->node); + udev_monitor_unref(worker->monitor); + children--; + free(worker); +} + +static void worker_unref(struct worker *worker) +{ + worker->refcount--; + if (worker->refcount > 0) + return; + info(worker->udev, "worker [%u] cleaned up\n", worker->pid); + worker_cleanup(worker); +} + +static void worker_list_cleanup(struct udev *udev) +{ + struct udev_list_node *loop, *tmp; + + udev_list_node_foreach_safe(loop, tmp, &worker_list) { + struct worker *worker = node_to_worker(loop); + + worker_cleanup(worker); + } +} + +static void worker_new(struct event *event) +{ + struct udev *udev = event->udev; + struct worker *worker; + struct udev_monitor *worker_monitor; + pid_t pid; + + /* listen for new events */ + worker_monitor = udev_monitor_new_from_netlink(udev, NULL); + if (worker_monitor == NULL) + return; + /* allow the main daemon netlink address to send devices to the worker */ + udev_monitor_allow_unicast_sender(worker_monitor, monitor); + udev_monitor_enable_receiving(worker_monitor); + + worker = calloc(1, sizeof(struct worker)); + if (worker == NULL) { + udev_monitor_unref(worker_monitor); + return; + } + /* worker + event reference */ + worker->refcount = 2; + worker->udev = udev; + + pid = fork(); + switch (pid) { + case 0: { + struct udev_device *dev = NULL; + int fd_monitor; + struct epoll_event ep_signal, ep_monitor; + sigset_t mask; + int rc = EXIT_SUCCESS; + + /* move initial device from queue */ + dev = event->dev; + event->dev = NULL; + + free(worker); + worker_list_cleanup(udev); + event_queue_cleanup(udev, EVENT_UNDEF); + udev_queue_export_unref(udev_queue_export); + udev_monitor_unref(monitor); + udev_ctrl_unref(udev_ctrl); + close(fd_signal); + close(fd_ep); + close(worker_watch[READ_END]); + + sigfillset(&mask); + fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (fd_signal < 0) { + err(udev, "error creating signalfd %m\n"); + rc = 2; + goto out; + } + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + rc = 3; + goto out; + } + + memset(&ep_signal, 0, sizeof(struct epoll_event)); + ep_signal.events = EPOLLIN; + ep_signal.data.fd = fd_signal; + + fd_monitor = udev_monitor_get_fd(worker_monitor); + memset(&ep_monitor, 0, sizeof(struct epoll_event)); + ep_monitor.events = EPOLLIN; + ep_monitor.data.fd = fd_monitor; + + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_monitor, &ep_monitor) < 0) { + err(udev, "fail to add fds to epoll: %m\n"); + rc = 4; + goto out; + } + + /* request TERM signal if parent exits */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + + for (;;) { + struct udev_event *udev_event; + struct worker_message msg; + int err; + + info(udev, "seq %llu running\n", udev_device_get_seqnum(dev)); + udev_event = udev_event_new(dev); + if (udev_event == NULL) { + rc = 5; + goto out; + } + + /* needed for SIGCHLD/SIGTERM in spawn() */ + udev_event->fd_signal = fd_signal; + + if (exec_delay > 0) + udev_event->exec_delay = exec_delay; + + /* apply rules, create node, symlinks */ + err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); + + if (err == 0) + udev_event_execute_run(udev_event, &sigmask_orig); + + /* apply/restore inotify watch */ + if (err == 0 && udev_event->inotify_watch) { + udev_watch_begin(udev, dev); + udev_device_update_db(dev); + } + + /* send processed event back to libudev listeners */ + udev_monitor_send_device(worker_monitor, NULL, dev); + + /* send udevd the result of the event execution */ + memset(&msg, 0, sizeof(struct worker_message)); + if (err != 0) + msg.exitcode = err; + msg.pid = getpid(); + send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); + + info(udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); + + udev_device_unref(dev); + dev = NULL; + + if (udev_event->sigterm) { + udev_event_unref(udev_event); + goto out; + } + + udev_event_unref(udev_event); + + /* wait for more device messages from main udevd, or term signal */ + while (dev == NULL) { + struct epoll_event ev[4]; + int fdcount; + int i; + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } + + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_monitor && ev[i].events & EPOLLIN) { + dev = udev_monitor_receive_device(worker_monitor); + break; + } else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) { + struct signalfd_siginfo fdsi; + ssize_t size; + + size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size != sizeof(struct signalfd_siginfo)) + continue; + switch (fdsi.ssi_signo) { + case SIGTERM: + goto out; + } + } + } + } + } +out: + udev_device_unref(dev); + if (fd_signal >= 0) + close(fd_signal); + if (fd_ep >= 0) + close(fd_ep); + close(fd_inotify); + close(worker_watch[WRITE_END]); + udev_rules_unref(rules); + udev_monitor_unref(worker_monitor); + udev_unref(udev); + udev_log_close(); + exit(rc); + } + case -1: + udev_monitor_unref(worker_monitor); + event->state = EVENT_QUEUED; + free(worker); + err(udev, "fork of child failed: %m\n"); + break; + default: + /* close monitor, but keep address around */ + udev_monitor_disconnect(worker_monitor); + worker->monitor = worker_monitor; + worker->pid = pid; + worker->state = WORKER_RUNNING; + worker->event = event; + event->state = EVENT_RUNNING; + udev_list_node_append(&worker->node, &worker_list); + children++; + info(udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); + break; + } +} + +static void event_run(struct event *event) +{ + struct udev_list_node *loop; + + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); + ssize_t count; + + if (worker->state != WORKER_IDLE) + continue; + + count = udev_monitor_send_device(monitor, worker->monitor, event->dev); + if (count < 0) { + err(event->udev, "worker [%u] did not accept message %zi (%m), kill it\n", worker->pid, count); + kill(worker->pid, SIGKILL); + worker->state = WORKER_KILLED; + continue; + } + worker_ref(worker); + worker->event = event; + worker->state = WORKER_RUNNING; + event->state = EVENT_RUNNING; + return; + } + + if (children >= children_max) { + if (children_max > 1) + info(event->udev, "maximum number (%i) of children reached\n", children); + return; + } + + /* start new worker and pass initial device */ + worker_new(event); +} + +static int event_queue_insert(struct udev_device *dev) +{ + struct event *event; + + event = calloc(1, sizeof(struct event)); + if (event == NULL) + return -1; + + event->udev = udev_device_get_udev(dev); + event->dev = dev; + event->seqnum = udev_device_get_seqnum(dev); + event->devpath = udev_device_get_devpath(dev); + event->devpath_len = strlen(event->devpath); + event->devpath_old = udev_device_get_devpath_old(dev); + event->devnum = udev_device_get_devnum(dev); + event->is_block = (strcmp("block", udev_device_get_subsystem(dev)) == 0); + event->ifindex = udev_device_get_ifindex(dev); + + udev_queue_export_device_queued(udev_queue_export, dev); + info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev), + udev_device_get_action(dev), udev_device_get_subsystem(dev)); + + event->state = EVENT_QUEUED; + udev_list_node_append(&event->node, &event_list); + return 0; +} + +static void worker_kill(struct udev *udev, int retain) +{ + struct udev_list_node *loop; + int max; + + if (children <= retain) + return; + + max = children - retain; + + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); + + if (max-- <= 0) + break; + + if (worker->state == WORKER_KILLED) + continue; + + worker->state = WORKER_KILLED; + kill(worker->pid, SIGTERM); + } +} + +/* lookup event for identical, parent, child device */ +static bool is_devpath_busy(struct event *event) +{ + struct udev_list_node *loop; + size_t common; + + /* check if queue contains events we depend on */ + udev_list_node_foreach(loop, &event_list) { + struct event *loop_event = node_to_event(loop); + + /* we already found a later event, earlier can not block us, no need to check again */ + if (loop_event->seqnum < event->delaying_seqnum) + continue; + + /* event we checked earlier still exists, no need to check again */ + if (loop_event->seqnum == event->delaying_seqnum) + return true; + + /* found ourself, no later event can block us */ + if (loop_event->seqnum >= event->seqnum) + break; + + /* check major/minor */ + if (major(event->devnum) != 0 && event->devnum == loop_event->devnum && event->is_block == loop_event->is_block) + return true; + + /* check network device ifindex */ + if (event->ifindex != 0 && event->ifindex == loop_event->ifindex) + return true; + + /* check our old name */ + if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) { + event->delaying_seqnum = loop_event->seqnum; + return true; + } + + /* compare devpath */ + common = MIN(loop_event->devpath_len, event->devpath_len); + + /* one devpath is contained in the other? */ + if (memcmp(loop_event->devpath, event->devpath, common) != 0) + continue; + + /* identical device event found */ + if (loop_event->devpath_len == event->devpath_len) { + /* devices names might have changed/swapped in the meantime */ + if (major(event->devnum) != 0 && (event->devnum != loop_event->devnum || event->is_block != loop_event->is_block)) + continue; + if (event->ifindex != 0 && event->ifindex != loop_event->ifindex) + continue; + event->delaying_seqnum = loop_event->seqnum; + return true; + } + + /* parent device event found */ + if (event->devpath[common] == '/') { + event->delaying_seqnum = loop_event->seqnum; + return true; + } + + /* child device event found */ + if (loop_event->devpath[common] == '/') { + event->delaying_seqnum = loop_event->seqnum; + return true; + } + + /* no matching device */ + continue; + } + + return false; +} + +static void event_queue_start(struct udev *udev) +{ + struct udev_list_node *loop; + + udev_list_node_foreach(loop, &event_list) { + struct event *event = node_to_event(loop); + + if (event->state != EVENT_QUEUED) + continue; + + /* do not start event if parent or child event is still running */ + if (is_devpath_busy(event)) { + dbg(udev, "delay seq %llu (%s)\n", event->seqnum, event->devpath); + continue; + } + + event_run(event); + } +} + +static void event_queue_cleanup(struct udev *udev, enum event_state match_type) +{ + struct udev_list_node *loop, *tmp; + + udev_list_node_foreach_safe(loop, tmp, &event_list) { + struct event *event = node_to_event(loop); + + if (match_type != EVENT_UNDEF && match_type != event->state) + continue; + + event_queue_delete(event, false); + } +} + +static void worker_returned(int fd_worker) +{ + for (;;) { + struct worker_message msg; + ssize_t size; + struct udev_list_node *loop; + + size = recv(fd_worker, &msg, sizeof(struct worker_message), MSG_DONTWAIT); + if (size != sizeof(struct worker_message)) + break; + + /* lookup worker who sent the signal */ + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); + + if (worker->pid != msg.pid) + continue; + + /* worker returned */ + worker->event->exitcode = msg.exitcode; + event_queue_delete(worker->event, true); + worker->event = NULL; + if (worker->state != WORKER_KILLED) + worker->state = WORKER_IDLE; + worker_unref(worker); + break; + } + } +} + +/* receive the udevd message from userspace */ +static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) +{ + struct udev *udev = udev_ctrl_get_udev(uctrl); + struct udev_ctrl_connection *ctrl_conn; + struct udev_ctrl_msg *ctrl_msg = NULL; + const char *str; + int i; + + ctrl_conn = udev_ctrl_get_connection(uctrl); + if (ctrl_conn == NULL) + goto out; + + ctrl_msg = udev_ctrl_receive_msg(ctrl_conn); + if (ctrl_msg == NULL) + goto out; + + i = udev_ctrl_get_set_log_level(ctrl_msg); + if (i >= 0) { + info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", i); + udev_set_log_priority(udev, i); + worker_kill(udev, 0); + } + + if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) { + info(udev, "udevd message (STOP_EXEC_QUEUE) received\n"); + stop_exec_queue = true; + } + + if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) { + info(udev, "udevd message (START_EXEC_QUEUE) received\n"); + stop_exec_queue = false; + } + + if (udev_ctrl_get_reload(ctrl_msg) > 0) { + info(udev, "udevd message (RELOAD) received\n"); + reload = true; + } + + str = udev_ctrl_get_set_env(ctrl_msg); + if (str != NULL) { + char *key; + + key = strdup(str); + if (key != NULL) { + char *val; + + val = strchr(key, '='); + if (val != NULL) { + val[0] = '\0'; + val = &val[1]; + if (val[0] == '\0') { + info(udev, "udevd message (ENV) received, unset '%s'\n", key); + udev_add_property(udev, key, NULL); + } else { + info(udev, "udevd message (ENV) received, set '%s=%s'\n", key, val); + udev_add_property(udev, key, val); + } + } else { + err(udev, "wrong key format '%s'\n", key); + } + free(key); + } + worker_kill(udev, 0); + } + + i = udev_ctrl_get_set_children_max(ctrl_msg); + if (i >= 0) { + info(udev, "udevd message (SET_MAX_CHILDREN) received, children_max=%i\n", i); + children_max = i; + } + + if (udev_ctrl_get_ping(ctrl_msg) > 0) + info(udev, "udevd message (SYNC) received\n"); + + if (udev_ctrl_get_exit(ctrl_msg) > 0) { + info(udev, "udevd message (EXIT) received\n"); + udev_exit = true; + /* keep reference to block the client until we exit */ + udev_ctrl_connection_ref(ctrl_conn); + } +out: + udev_ctrl_msg_unref(ctrl_msg); + return udev_ctrl_connection_unref(ctrl_conn); +} + +/* read inotify messages */ +static int handle_inotify(struct udev *udev) +{ + int nbytes, pos; + char *buf; + struct inotify_event *ev; + + if ((ioctl(fd_inotify, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) + return 0; + + buf = malloc(nbytes); + if (buf == NULL) { + err(udev, "error getting buffer for inotify\n"); + return -1; + } + + nbytes = read(fd_inotify, buf, nbytes); + + for (pos = 0; pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) { + struct udev_device *dev; + + ev = (struct inotify_event *)(buf + pos); + dev = udev_watch_lookup(udev, ev->wd); + if (dev != NULL) { + info(udev, "inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev)); + if (ev->mask & IN_CLOSE_WRITE) { + char filename[UTIL_PATH_SIZE]; + int fd; + + info(udev, "device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev)); + util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); + fd = open(filename, O_WRONLY); + if (fd >= 0) { + if (write(fd, "change", 6) < 0) + info(udev, "error writing uevent: %m\n"); + close(fd); + } + } + if (ev->mask & IN_IGNORED) + udev_watch_end(udev, dev); + + udev_device_unref(dev); + } + + } + + free(buf); + return 0; +} + +static void handle_signal(struct udev *udev, int signo) +{ + switch (signo) { + case SIGINT: + case SIGTERM: + udev_exit = true; + break; + case SIGCHLD: + for (;;) { + pid_t pid; + int status; + struct udev_list_node *loop, *tmp; + + pid = waitpid(-1, &status, WNOHANG); + if (pid <= 0) + break; + + udev_list_node_foreach_safe(loop, tmp, &worker_list) { + struct worker *worker = node_to_worker(loop); + + if (worker->pid != pid) + continue; + info(udev, "worker [%u] exit\n", pid); + + if (WIFEXITED(status)) { + if (WEXITSTATUS(status) != 0) + err(udev, "worker [%u] exit with return code %i\n", pid, WEXITSTATUS(status)); + } else if (WIFSIGNALED(status)) { + err(udev, "worker [%u] terminated by signal %i (%s)\n", + pid, WTERMSIG(status), strsignal(WTERMSIG(status))); + } else if (WIFSTOPPED(status)) { + err(udev, "worker [%u] stopped\n", pid); + } else if (WIFCONTINUED(status)) { + err(udev, "worker [%u] continued\n", pid); + } else { + err(udev, "worker [%u] exit with status 0x%04x\n", pid, status); + } + + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { + if (worker->event != NULL) { + err(udev, "worker [%u] failed while handling '%s'\n", + pid, worker->event->devpath); + worker->event->exitcode = -32; + event_queue_delete(worker->event, true); + /* drop reference taken for state 'running' */ + worker_unref(worker); + } + } + worker_unref(worker); + break; + } + } + break; + case SIGHUP: + reload = true; + break; + } +} + +static void static_dev_create_from_modules(struct udev *udev) +{ + struct utsname kernel; + char modules[UTIL_PATH_SIZE]; + char buf[4096]; + FILE *f; + + uname(&kernel); + util_strscpyl(modules, sizeof(modules), "/lib/modules/", kernel.release, "/modules.devname", NULL); + f = fopen(modules, "r"); + if (f == NULL) + return; + + while (fgets(buf, sizeof(buf), f) != NULL) { + char *s; + const char *modname; + const char *devname; + const char *devno; + int maj, min; + char type; + mode_t mode; + char filename[UTIL_PATH_SIZE]; + + if (buf[0] == '#') + continue; + + modname = buf; + s = strchr(modname, ' '); + if (s == NULL) + continue; + s[0] = '\0'; + + devname = &s[1]; + s = strchr(devname, ' '); + if (s == NULL) + continue; + s[0] = '\0'; + + devno = &s[1]; + s = strchr(devno, ' '); + if (s == NULL) + s = strchr(devno, '\n'); + if (s != NULL) + s[0] = '\0'; + if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3) + continue; + + if (type == 'c') + mode = S_IFCHR; + else if (type == 'b') + mode = S_IFBLK; + else + continue; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/", devname, NULL); + util_create_path_selinux(udev, filename); + udev_selinux_setfscreatecon(udev, filename, mode); + info(udev, "mknod '%s' %c%u:%u\n", filename, type, maj, min); + if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST) + utimensat(AT_FDCWD, filename, NULL, 0); + udev_selinux_resetfscreatecon(udev); + } + + fclose(f); +} + +static int copy_dev_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) +{ + struct dirent *dent; + + for (dent = readdir(dir_from); dent != NULL; dent = readdir(dir_from)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + if (fstatat(dirfd(dir_from), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) + continue; + + if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { + udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, stats.st_mode & 0777); + if (mknodat(dirfd(dir_to), dent->d_name, stats.st_mode, stats.st_rdev) == 0) { + fchmodat(dirfd(dir_to), dent->d_name, stats.st_mode & 0777, 0); + fchownat(dirfd(dir_to), dent->d_name, stats.st_uid, stats.st_gid, 0); + } else { + utimensat(dirfd(dir_to), dent->d_name, NULL, 0); + } + udev_selinux_resetfscreatecon(udev); + } else if (S_ISLNK(stats.st_mode)) { + char target[UTIL_PATH_SIZE]; + ssize_t len; + + len = readlinkat(dirfd(dir_from), dent->d_name, target, sizeof(target)); + if (len <= 0 || len == (ssize_t)sizeof(target)) + continue; + target[len] = '\0'; + udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFLNK); + if (symlinkat(target, dirfd(dir_to), dent->d_name) < 0 && errno == EEXIST) + utimensat(dirfd(dir_to), dent->d_name, NULL, AT_SYMLINK_NOFOLLOW); + udev_selinux_resetfscreatecon(udev); + } else if (S_ISDIR(stats.st_mode)) { + DIR *dir2_from, *dir2_to; + + if (maxdepth == 0) + continue; + + udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFDIR|0755); + mkdirat(dirfd(dir_to), dent->d_name, 0755); + udev_selinux_resetfscreatecon(udev); + + dir2_to = fdopendir(openat(dirfd(dir_to), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2_to == NULL) + continue; + + dir2_from = fdopendir(openat(dirfd(dir_from), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2_from == NULL) { + closedir(dir2_to); + continue; + } + + copy_dev_dir(udev, dir2_from, dir2_to, maxdepth-1); + + closedir(dir2_to); + closedir(dir2_from); + } + } + + return 0; +} + +static void static_dev_create_links(struct udev *udev, DIR *dir) +{ + struct stdlinks { + const char *link; + const char *target; + }; + static const struct stdlinks stdlinks[] = { + { "core", "/proc/kcore" }, + { "fd", "/proc/self/fd" }, + { "stdin", "/proc/self/fd/0" }, + { "stdout", "/proc/self/fd/1" }, + { "stderr", "/proc/self/fd/2" }, + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(stdlinks); i++) { + struct stat sb; + + if (stat(stdlinks[i].target, &sb) == 0) { + udev_selinux_setfscreateconat(udev, dirfd(dir), stdlinks[i].link, S_IFLNK); + if (symlinkat(stdlinks[i].target, dirfd(dir), stdlinks[i].link) < 0 && errno == EEXIST) + utimensat(dirfd(dir), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); + udev_selinux_resetfscreatecon(udev); + } + } +} + +static void static_dev_create_from_devices(struct udev *udev, DIR *dir) +{ + DIR *dir_from; + + dir_from = opendir(PKGLIBEXECDIR "/devices"); + if (dir_from == NULL) + return; + copy_dev_dir(udev, dir_from, dir, 8); + closedir(dir_from); +} + +static void static_dev_create(struct udev *udev) +{ + DIR *dir; + + dir = opendir(udev_get_dev_path(udev)); + if (dir == NULL) + return; + + static_dev_create_links(udev, dir); + static_dev_create_from_devices(udev, dir); + + closedir(dir); +} + +static int mem_size_mb(void) +{ + FILE *f; + char buf[4096]; + long int memsize = -1; + + f = fopen("/proc/meminfo", "r"); + if (f == NULL) + return -1; + + while (fgets(buf, sizeof(buf), f) != NULL) { + long int value; + + if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { + memsize = value / 1024; + break; + } + } + + fclose(f); + return memsize; +} + +static int convert_db(struct udev *udev) +{ + char filename[UTIL_PATH_SIZE]; + FILE *f; + struct udev_enumerate *udev_enumerate; + struct udev_list_entry *list_entry; + + /* current database */ + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); + if (access(filename, F_OK) >= 0) + return 0; + + /* make sure we do not get here again */ + util_create_path(udev, filename); + mkdir(filename, 0755); + + /* old database */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db", NULL); + if (access(filename, F_OK) < 0) + return 0; + + f = fopen("/dev/kmsg", "w"); + if (f != NULL) { + fprintf(f, "<30>udevd[%u]: converting old udev database\n", getpid()); + fclose(f); + } + + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_devices(udev_enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + + /* try to find the old database for devices without a current one */ + if (udev_device_read_db(device, NULL) < 0) { + bool have_db; + const char *id; + struct stat stats; + char devpath[UTIL_PATH_SIZE]; + char from[UTIL_PATH_SIZE]; + + have_db = false; + + /* find database in old location */ + id = udev_device_get_id_filename(device); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", id, NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* find old database with $subsys:$sysname name */ + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), + "/.udev/db/", udev_device_get_subsystem(device), ":", + udev_device_get_sysname(device), NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* find old database with the encoded devpath name */ + util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", devpath, NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* write out new database */ + if (have_db) + udev_device_update_db(device); + } + udev_device_unref(device); + } + udev_enumerate_unref(udev_enumerate); + return 0; +} + +static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) +{ + int ctrl = -1, netlink = -1; + int fd, n; + + n = sd_listen_fds(true); + if (n <= 0) + return -1; + + for (fd = SD_LISTEN_FDS_START; fd < n + SD_LISTEN_FDS_START; fd++) { + if (sd_is_socket(fd, AF_LOCAL, SOCK_SEQPACKET, -1)) { + if (ctrl >= 0) + return -1; + ctrl = fd; + continue; + } + + if (sd_is_socket(fd, AF_NETLINK, SOCK_RAW, -1)) { + if (netlink >= 0) + return -1; + netlink = fd; + continue; + } + + return -1; + } + + if (ctrl < 0 || netlink < 0) + return -1; + + info(udev, "ctrl=%i netlink=%i\n", ctrl, netlink); + *rctrl = ctrl; + *rnetlink = netlink; + return 0; +} + +static bool check_rules_timestamp(struct udev *udev) +{ + char **p; + unsigned long long *stamp_usec; + int i, n; + bool changed = false; + + n = udev_get_rules_path(udev, &p, &stamp_usec); + for (i = 0; i < n; i++) { + struct stat stats; + + if (stat(p[i], &stats) < 0) + continue; + + if (stamp_usec[i] == ts_usec(&stats.st_mtim)) + continue; + + /* first check */ + if (stamp_usec[i] != 0) { + info(udev, "reload - timestamp of '%s' changed\n", p[i]); + changed = true; + } + + /* update timestamp */ + stamp_usec[i] = ts_usec(&stats.st_mtim); + } + + return changed; +} + +int main(int argc, char *argv[]) +{ + struct udev *udev; + FILE *f; + sigset_t mask; + int daemonize = false; + int resolve_names = 1; + static const struct option options[] = { + { "daemon", no_argument, NULL, 'd' }, + { "debug", no_argument, NULL, 'D' }, + { "children-max", required_argument, NULL, 'c' }, + { "exec-delay", required_argument, NULL, 'e' }, + { "resolve-names", required_argument, NULL, 'N' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + {} + }; + int fd_ctrl = -1; + int fd_netlink = -1; + int fd_worker = -1; + struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker; + struct udev_ctrl_connection *ctrl_conn = NULL; + char **s; + int rc = 1; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("udevd"); + udev_set_log_fn(udev, udev_main_log); + info(udev, "version %s\n", VERSION); + udev_selinux_init(udev); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "c:deDtN:hV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + daemonize = true; + break; + case 'c': + children_max = strtoul(optarg, NULL, 0); + break; + case 'e': + exec_delay = strtoul(optarg, NULL, 0); + break; + case 'D': + debug = true; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'N': + if (strcmp (optarg, "early") == 0) { + resolve_names = 1; + } else if (strcmp (optarg, "late") == 0) { + resolve_names = 0; + } else if (strcmp (optarg, "never") == 0) { + resolve_names = -1; + } else { + fprintf(stderr, "resolve-names must be early, late or never\n"); + err(udev, "resolve-names must be early, late or never\n"); + goto exit; + } + break; + case 'h': + printf("Usage: udevd OPTIONS\n" + " --daemon\n" + " --debug\n" + " --children-max=\n" + " --exec-delay=\n" + " --resolve-names=early|late|never\n" + " --version\n" + " --help\n" + "\n"); + goto exit; + case 'V': + printf("%s\n", VERSION); + goto exit; + default: + goto exit; + } + } + + /* + * read the kernel commandline, in case we need to get into debug mode + * udev.log-priority= syslog priority + * udev.children-max= events are fully serialized if set to 1 + * + */ + f = fopen("/proc/cmdline", "r"); + if (f != NULL) { + char cmdline[4096]; + + if (fgets(cmdline, sizeof(cmdline), f) != NULL) { + char *pos; + + pos = strstr(cmdline, "udev.log-priority="); + if (pos != NULL) { + pos += strlen("udev.log-priority="); + udev_set_log_priority(udev, util_log_priority(pos)); + } + + pos = strstr(cmdline, "udev.children-max="); + if (pos != NULL) { + pos += strlen("udev.children-max="); + children_max = strtoul(pos, NULL, 0); + } + + pos = strstr(cmdline, "udev.exec-delay="); + if (pos != NULL) { + pos += strlen("udev.exec-delay="); + exec_delay = strtoul(pos, NULL, 0); + } + } + fclose(f); + } + + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); + err(udev, "root privileges required\n"); + goto exit; + } + + /* set umask before creating any file/directory */ + chdir("/"); + umask(022); + + /* /run/udev */ + mkdir(udev_get_run_path(udev), 0755); + + /* create standard links, copy static nodes, create nodes from modules */ + static_dev_create(udev); + static_dev_create_from_modules(udev); + + /* before opening new files, make sure std{in,out,err} fds are in a sane state */ + if (daemonize) { + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + if (write(STDOUT_FILENO, 0, 0) < 0) + dup2(fd, STDOUT_FILENO); + if (write(STDERR_FILENO, 0, 0) < 0) + dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) + close(fd); + } else { + fprintf(stderr, "cannot open /dev/null\n"); + err(udev, "cannot open /dev/null\n"); + } + } + + if (systemd_fds(udev, &fd_ctrl, &fd_netlink) >= 0) { + /* get control and netlink socket from from systemd */ + udev_ctrl = udev_ctrl_new_from_fd(udev, fd_ctrl); + if (udev_ctrl == NULL) { + err(udev, "error taking over udev control socket"); + rc = 1; + goto exit; + } + + monitor = udev_monitor_new_from_netlink_fd(udev, "kernel", fd_netlink); + if (monitor == NULL) { + err(udev, "error taking over netlink socket\n"); + rc = 3; + goto exit; + } + } else { + /* open control and netlink socket */ + udev_ctrl = udev_ctrl_new(udev); + if (udev_ctrl == NULL) { + fprintf(stderr, "error initializing udev control socket"); + err(udev, "error initializing udev control socket"); + rc = 1; + goto exit; + } + fd_ctrl = udev_ctrl_get_fd(udev_ctrl); + + monitor = udev_monitor_new_from_netlink(udev, "kernel"); + if (monitor == NULL) { + fprintf(stderr, "error initializing netlink socket\n"); + err(udev, "error initializing netlink socket\n"); + rc = 3; + goto exit; + } + fd_netlink = udev_monitor_get_fd(monitor); + } + + if (udev_monitor_enable_receiving(monitor) < 0) { + fprintf(stderr, "error binding netlink socket\n"); + err(udev, "error binding netlink socket\n"); + rc = 3; + goto exit; + } + + if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { + fprintf(stderr, "error binding udev control socket\n"); + err(udev, "error binding udev control socket\n"); + rc = 1; + goto exit; + } + + udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); + + /* create queue file before signalling 'ready', to make sure we block 'settle' */ + udev_queue_export = udev_queue_export_new(udev); + if (udev_queue_export == NULL) { + err(udev, "error creating queue file\n"); + goto exit; + } + + if (daemonize) { + pid_t pid; + int fd; + + pid = fork(); + switch (pid) { + case 0: + break; + case -1: + err(udev, "fork of daemon failed: %m\n"); + rc = 4; + goto exit; + default: + rc = EXIT_SUCCESS; + goto exit_daemonize; + } + + setsid(); + + fd = open("/proc/self/oom_score_adj", O_RDWR); + if (fd < 0) { + /* Fallback to old interface */ + fd = open("/proc/self/oom_adj", O_RDWR); + if (fd < 0) { + err(udev, "error disabling OOM: %m\n"); + } else { + /* OOM_DISABLE == -17 */ + write(fd, "-17", 3); + close(fd); + } + } else { + write(fd, "-1000", 5); + close(fd); + } + } else { + sd_notify(1, "READY=1"); + } + + f = fopen("/dev/kmsg", "w"); + if (f != NULL) { + fprintf(f, "<30>udevd[%u]: starting version " VERSION "\n", getpid()); + fclose(f); + } + + if (!debug) { + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + close(fd); + } + } + + fd_inotify = udev_watch_init(udev); + if (fd_inotify < 0) { + fprintf(stderr, "error initializing inotify\n"); + err(udev, "error initializing inotify\n"); + rc = 4; + goto exit; + } + udev_watch_restore(udev); + + /* block and listen to all signals on signalfd */ + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + err(udev, "error creating signalfd\n"); + rc = 5; + goto exit; + } + + /* unnamed socket from workers to the main daemon */ + if (socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, worker_watch) < 0) { + fprintf(stderr, "error creating socketpair\n"); + err(udev, "error creating socketpair\n"); + rc = 6; + goto exit; + } + fd_worker = worker_watch[READ_END]; + + udev_builtin_init(udev); + + rules = udev_rules_new(udev, resolve_names); + if (rules == NULL) { + err(udev, "error reading rules\n"); + goto exit; + } + + memset(&ep_ctrl, 0, sizeof(struct epoll_event)); + ep_ctrl.events = EPOLLIN; + ep_ctrl.data.fd = fd_ctrl; + + memset(&ep_inotify, 0, sizeof(struct epoll_event)); + ep_inotify.events = EPOLLIN; + ep_inotify.data.fd = fd_inotify; + + memset(&ep_signal, 0, sizeof(struct epoll_event)); + ep_signal.events = EPOLLIN; + ep_signal.data.fd = fd_signal; + + memset(&ep_netlink, 0, sizeof(struct epoll_event)); + ep_netlink.events = EPOLLIN; + ep_netlink.data.fd = fd_netlink; + + memset(&ep_worker, 0, sizeof(struct epoll_event)); + ep_worker.events = EPOLLIN; + ep_worker.data.fd = fd_worker; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto exit; + } + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_ctrl, &ep_ctrl) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_inotify, &ep_inotify) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_netlink, &ep_netlink) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_worker, &ep_worker) < 0) { + err(udev, "fail to add fds to epoll: %m\n"); + goto exit; + } + + /* if needed, convert old database from earlier udev version */ + convert_db(udev); + + if (children_max <= 0) { + int memsize = mem_size_mb(); + + /* set value depending on the amount of RAM */ + if (memsize > 0) + children_max = 128 + (memsize / 8); + else + children_max = 128; + } + info(udev, "set children_max to %u\n", children_max); + + udev_rules_apply_static_dev_perms(rules); + + udev_list_node_init(&event_list); + udev_list_node_init(&worker_list); + + for (;;) { + static unsigned long long last_usec; + struct epoll_event ev[8]; + int fdcount; + int timeout; + bool is_worker, is_signal, is_inotify, is_netlink, is_ctrl; + int i; + + if (udev_exit) { + /* close sources of new events and discard buffered events */ + if (fd_ctrl >= 0) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_ctrl, NULL); + fd_ctrl = -1; + } + if (monitor != NULL) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_netlink, NULL); + udev_monitor_unref(monitor); + monitor = NULL; + } + if (fd_inotify >= 0) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_inotify, NULL); + close(fd_inotify); + fd_inotify = -1; + } + + /* discard queued events and kill workers */ + event_queue_cleanup(udev, EVENT_QUEUED); + worker_kill(udev, 0); + + /* exit after all has cleaned up */ + if (udev_list_node_is_empty(&event_list) && udev_list_node_is_empty(&worker_list)) + break; + + /* timeout at exit for workers to finish */ + timeout = 60 * 1000; + } else if (udev_list_node_is_empty(&event_list) && children > 2) { + /* set timeout to kill idle workers */ + timeout = 3 * 1000; + } else { + timeout = -1; + } + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); + if (fdcount < 0) + continue; + + if (fdcount == 0) { + if (udev_exit) { + info(udev, "timeout, giving up waiting for workers to finish\n"); + break; + } + + /* timeout - kill idle workers */ + worker_kill(udev, 2); + } + + is_worker = is_signal = is_inotify = is_netlink = is_ctrl = false; + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_worker && ev[i].events & EPOLLIN) + is_worker = true; + else if (ev[i].data.fd == fd_netlink && ev[i].events & EPOLLIN) + is_netlink = true; + else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) + is_signal = true; + else if (ev[i].data.fd == fd_inotify && ev[i].events & EPOLLIN) + is_inotify = true; + else if (ev[i].data.fd == fd_ctrl && ev[i].events & EPOLLIN) + is_ctrl = true; + } + + /* check for changed config, every 3 seconds at most */ + if ((now_usec() - last_usec) > 3 * 1000 * 1000) { + if (check_rules_timestamp(udev)) + reload = true; + if (udev_builtin_validate(udev)) + reload = true; + + last_usec = now_usec(); + } + + /* reload requested, HUP signal received, rules changed, builtin changed */ + if (reload) { + worker_kill(udev, 0); + rules = udev_rules_unref(rules); + udev_builtin_exit(udev); + reload = 0; + } + + /* event has finished */ + if (is_worker) + worker_returned(fd_worker); + + if (is_netlink) { + struct udev_device *dev; + + dev = udev_monitor_receive_device(monitor); + if (dev != NULL) { + udev_device_set_usec_initialized(dev, now_usec()); + if (event_queue_insert(dev) < 0) + udev_device_unref(dev); + } + } + + /* start new events */ + if (!udev_list_node_is_empty(&event_list) && !udev_exit && !stop_exec_queue) { + if (rules == NULL) + rules = udev_rules_new(udev, resolve_names); + if (rules != NULL) + event_queue_start(udev); + } + + if (is_signal) { + struct signalfd_siginfo fdsi; + ssize_t size; + + size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size == sizeof(struct signalfd_siginfo)) + handle_signal(udev, fdsi.ssi_signo); + } + + /* we are shutting down, the events below are not handled anymore */ + if (udev_exit) + continue; + + /* device node watch */ + if (is_inotify) + handle_inotify(udev); + + /* + * This needs to be after the inotify handling, to make sure, + * that the ping is send back after the possibly generated + * "change" events by the inotify device node watch. + * + * A single time we may receive a client connection which we need to + * keep open to block the client. It will be closed right before we + * exit. + */ + if (is_ctrl) + ctrl_conn = handle_ctrl_msg(udev_ctrl); + } + + rc = EXIT_SUCCESS; +exit: + udev_queue_export_cleanup(udev_queue_export); + udev_ctrl_cleanup(udev_ctrl); +exit_daemonize: + if (fd_ep >= 0) + close(fd_ep); + worker_list_cleanup(udev); + event_queue_cleanup(udev, EVENT_UNDEF); + udev_rules_unref(rules); + udev_builtin_exit(udev); + if (fd_signal >= 0) + close(fd_signal); + if (worker_watch[READ_END] >= 0) + close(worker_watch[READ_END]); + if (worker_watch[WRITE_END] >= 0) + close(worker_watch[WRITE_END]); + udev_monitor_unref(monitor); + udev_queue_export_unref(udev_queue_export); + udev_ctrl_connection_unref(ctrl_conn); + udev_ctrl_unref(udev_ctrl); + udev_selinux_exit(udev); + udev_unref(udev); + udev_log_close(); + return rc; +} diff --git a/src/udevd.xml b/src/udevd.xml new file mode 100644 index 0000000000..c516eb9793 --- /dev/null +++ b/src/udevd.xml @@ -0,0 +1,151 @@ + + + + + + + udevd + udev + + + + udevd + 8 + + + + + udevdevent managing daemon + + + + + udevd + + + + + + + + + + + Description + udevd listens to kernel uevents. For every event, udevd executes matching + instructions specified in udev rules. See + udev7 + . + On startup the content of the directory /usr/lib/udev/devices + is copied to /dev. If kernel modules specify static device + nodes, these nodes are created even without a corresponding kernel device, to + allow on-demand loading of kernel modules. Matching permissions specified in udev + rules are applied to these static device nodes. + The behavior of the running daemon can be changed with + udevadm control. + + + Options + + + + + Detach and run in the background. + + + + + + Print debug messages to stderr. + + + + + + Limit the number of parallel executed events. + + + + + + Number of seconds to delay the execution of RUN instructions. + This might be useful when debugging system crashes during coldplug + cause by loading non-working kernel modules. + + + + + + Specify when udevd should resolve names of users and groups. + When set to (the default) names will be + resolved when the rules are parsed. When set to + names will be resolved for every event. + When set to names will never be resolved + and all devices will be owned by root. + + + + + + Print version number. + + + + + + Print help text. + + + + + + Environment + + + UDEV_LOG= + + Set the logging priority. + + + + + + Kernel command line + + + udev.log-priority= + + Set the logging priority. + + + + udev.children-max= + + Limit the number of parallel executed events. + + + + udev.exec-delay= + + Number of seconds to delay the execution of RUN instructions. + This might be useful when debugging system crashes during coldplug + cause by loading non-working kernel modules. + + + + + + Author + Written by Kay Sievers kay.sievers@vrfy.org. + + + + See Also + + udev7 + , + udevadm8 + + + diff --git a/systemd/.gitignore b/systemd/.gitignore deleted file mode 100644 index 904e445e72..0000000000 --- a/systemd/.gitignore +++ /dev/null @@ -1 +0,0 @@ -udev*.service diff --git a/systemd/udev-control.socket b/systemd/udev-control.socket deleted file mode 100644 index f80f774427..0000000000 --- a/systemd/udev-control.socket +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=udev Control Socket -DefaultDependencies=no -ConditionCapability=CAP_MKNOD - -[Socket] -Service=udev.service -ListenSequentialPacket=/run/udev/control -SocketMode=0600 -PassCredentials=yes diff --git a/systemd/udev-kernel.socket b/systemd/udev-kernel.socket deleted file mode 100644 index 23fa9d5e11..0000000000 --- a/systemd/udev-kernel.socket +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=udev Kernel Socket -DefaultDependencies=no -ConditionCapability=CAP_MKNOD - -[Socket] -Service=udev.service -ReceiveBuffer=134217728 -ListenNetlink=kobject-uevent 1 -PassCredentials=yes diff --git a/systemd/udev-settle.service.in b/systemd/udev-settle.service.in deleted file mode 100644 index b0a4964f76..0000000000 --- a/systemd/udev-settle.service.in +++ /dev/null @@ -1,25 +0,0 @@ -# This service is usually not enabled by default. If enabled, it -# acts as a barrier for basic.target -- so all later services will -# wait for udev completely finishing its coldplug run. -# -# If needed, to work around broken or non-hotplug-aware services, -# it might be enabled unconditionally, or pulled-in on-demand by -# the services that assume a fully populated /dev at startup. It -# should not be used or pulled-in ever on systems without such -# legacy services running. - -[Unit] -Description=udev Wait for Complete Device Initialization -DefaultDependencies=no -Wants=udev.service -After=udev-trigger.service -Before=basic.target - -[Service] -Type=oneshot -TimeoutSec=180 -RemainAfterExit=yes -ExecStart=@bindir@/udevadm settle - -[Install] -WantedBy=basic.target diff --git a/systemd/udev-trigger.service.in b/systemd/udev-trigger.service.in deleted file mode 100644 index cd81945c88..0000000000 --- a/systemd/udev-trigger.service.in +++ /dev/null @@ -1,10 +0,0 @@ -[Unit] -Description=udev Coldplug all Devices -Wants=udev.service -After=udev-kernel.socket udev-control.socket -DefaultDependencies=no - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=@bindir@/udevadm trigger --type=subsystems --action=add ; @bindir@/udevadm trigger --type=devices --action=add diff --git a/systemd/udev.service.in b/systemd/udev.service.in deleted file mode 100644 index c27eb1baf5..0000000000 --- a/systemd/udev.service.in +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=udev Kernel Device Manager -Wants=udev-control.socket udev-kernel.socket -After=udev-control.socket udev-kernel.socket -Before=basic.target -DefaultDependencies=no -ConditionCapability=CAP_MKNOD - -[Service] -Type=notify -OOMScoreAdjust=-1000 -Sockets=udev-control.socket udev-kernel.socket -Restart=on-failure -ExecStart=@pkglibexecdir@/udevd diff --git a/test/udev-test.pl.in b/test/udev-test.pl.in index 05055013d5..6c5eeee762 100755 --- a/test/udev-test.pl.in +++ b/test/udev-test.pl.in @@ -22,7 +22,7 @@ use strict; my $PWD = $ENV{PWD}; my $sysfs = "test/sys/"; -my $udev_bin = "udev/test-udev"; +my $udev_bin = "src/test-udev"; my $valgrind = 0; my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; my $udev_root = "udev-root"; diff --git a/udev.conf b/udev.conf deleted file mode 100644 index 31bb6620ee..0000000000 --- a/udev.conf +++ /dev/null @@ -1,4 +0,0 @@ -# The initial syslog(3) priority: "err", "info", "debug" or its -# numerical equivalent. For runtime debugging, the daemons internal -# state can be changed with: "udevadm control --log-priority=". -udev_log="err" diff --git a/udev/.gitignore b/udev/.gitignore deleted file mode 100644 index 73f746cb7d..0000000000 --- a/udev/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -udevd -udevadm -test-udev -*.[78] -*.html -udev.pc diff --git a/udev/sd-daemon.c b/udev/sd-daemon.c deleted file mode 100644 index e68b70875c..0000000000 --- a/udev/sd-daemon.c +++ /dev/null @@ -1,526 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -/*** - Copyright 2010 Lennart Poettering - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -***/ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(__linux__) -#include -#endif - -#include "sd-daemon.h" - -#if (__GNUC__ >= 4) -#ifdef SD_EXPORT_SYMBOLS -/* Export symbols */ -#define _sd_export_ __attribute__ ((visibility("default"))) -#else -/* Don't export the symbols */ -#define _sd_export_ __attribute__ ((visibility("hidden"))) -#endif -#else -#define _sd_export_ -#endif - -_sd_export_ int sd_listen_fds(int unset_environment) { - -#if defined(DISABLE_SYSTEMD) || !defined(__linux__) - return 0; -#else - int r, fd; - const char *e; - char *p = NULL; - unsigned long l; - - if (!(e = getenv("LISTEN_PID"))) { - r = 0; - goto finish; - } - - errno = 0; - l = strtoul(e, &p, 10); - - if (errno != 0) { - r = -errno; - goto finish; - } - - if (!p || *p || l <= 0) { - r = -EINVAL; - goto finish; - } - - /* Is this for us? */ - if (getpid() != (pid_t) l) { - r = 0; - goto finish; - } - - if (!(e = getenv("LISTEN_FDS"))) { - r = 0; - goto finish; - } - - errno = 0; - l = strtoul(e, &p, 10); - - if (errno != 0) { - r = -errno; - goto finish; - } - - if (!p || *p) { - r = -EINVAL; - goto finish; - } - - for (fd = SD_LISTEN_FDS_START; fd < SD_LISTEN_FDS_START + (int) l; fd ++) { - int flags; - - if ((flags = fcntl(fd, F_GETFD)) < 0) { - r = -errno; - goto finish; - } - - if (flags & FD_CLOEXEC) - continue; - - if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) < 0) { - r = -errno; - goto finish; - } - } - - r = (int) l; - -finish: - if (unset_environment) { - unsetenv("LISTEN_PID"); - unsetenv("LISTEN_FDS"); - } - - return r; -#endif -} - -_sd_export_ int sd_is_fifo(int fd, const char *path) { - struct stat st_fd; - - if (fd < 0) - return -EINVAL; - - memset(&st_fd, 0, sizeof(st_fd)); - if (fstat(fd, &st_fd) < 0) - return -errno; - - if (!S_ISFIFO(st_fd.st_mode)) - return 0; - - if (path) { - struct stat st_path; - - memset(&st_path, 0, sizeof(st_path)); - if (stat(path, &st_path) < 0) { - - if (errno == ENOENT || errno == ENOTDIR) - return 0; - - return -errno; - } - - return - st_path.st_dev == st_fd.st_dev && - st_path.st_ino == st_fd.st_ino; - } - - return 1; -} - -_sd_export_ int sd_is_special(int fd, const char *path) { - struct stat st_fd; - - if (fd < 0) - return -EINVAL; - - if (fstat(fd, &st_fd) < 0) - return -errno; - - if (!S_ISREG(st_fd.st_mode) && !S_ISCHR(st_fd.st_mode)) - return 0; - - if (path) { - struct stat st_path; - - if (stat(path, &st_path) < 0) { - - if (errno == ENOENT || errno == ENOTDIR) - return 0; - - return -errno; - } - - if (S_ISREG(st_fd.st_mode) && S_ISREG(st_path.st_mode)) - return - st_path.st_dev == st_fd.st_dev && - st_path.st_ino == st_fd.st_ino; - else if (S_ISCHR(st_fd.st_mode) && S_ISCHR(st_path.st_mode)) - return st_path.st_rdev == st_fd.st_rdev; - else - return 0; - } - - return 1; -} - -static int sd_is_socket_internal(int fd, int type, int listening) { - struct stat st_fd; - - if (fd < 0 || type < 0) - return -EINVAL; - - if (fstat(fd, &st_fd) < 0) - return -errno; - - if (!S_ISSOCK(st_fd.st_mode)) - return 0; - - if (type != 0) { - int other_type = 0; - socklen_t l = sizeof(other_type); - - if (getsockopt(fd, SOL_SOCKET, SO_TYPE, &other_type, &l) < 0) - return -errno; - - if (l != sizeof(other_type)) - return -EINVAL; - - if (other_type != type) - return 0; - } - - if (listening >= 0) { - int accepting = 0; - socklen_t l = sizeof(accepting); - - if (getsockopt(fd, SOL_SOCKET, SO_ACCEPTCONN, &accepting, &l) < 0) - return -errno; - - if (l != sizeof(accepting)) - return -EINVAL; - - if (!accepting != !listening) - return 0; - } - - return 1; -} - -union sockaddr_union { - struct sockaddr sa; - struct sockaddr_in in4; - struct sockaddr_in6 in6; - struct sockaddr_un un; - struct sockaddr_storage storage; -}; - -_sd_export_ int sd_is_socket(int fd, int family, int type, int listening) { - int r; - - if (family < 0) - return -EINVAL; - - if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) - return r; - - if (family > 0) { - union sockaddr_union sockaddr; - socklen_t l; - - memset(&sockaddr, 0, sizeof(sockaddr)); - l = sizeof(sockaddr); - - if (getsockname(fd, &sockaddr.sa, &l) < 0) - return -errno; - - if (l < sizeof(sa_family_t)) - return -EINVAL; - - return sockaddr.sa.sa_family == family; - } - - return 1; -} - -_sd_export_ int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port) { - union sockaddr_union sockaddr; - socklen_t l; - int r; - - if (family != 0 && family != AF_INET && family != AF_INET6) - return -EINVAL; - - if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) - return r; - - memset(&sockaddr, 0, sizeof(sockaddr)); - l = sizeof(sockaddr); - - if (getsockname(fd, &sockaddr.sa, &l) < 0) - return -errno; - - if (l < sizeof(sa_family_t)) - return -EINVAL; - - if (sockaddr.sa.sa_family != AF_INET && - sockaddr.sa.sa_family != AF_INET6) - return 0; - - if (family > 0) - if (sockaddr.sa.sa_family != family) - return 0; - - if (port > 0) { - if (sockaddr.sa.sa_family == AF_INET) { - if (l < sizeof(struct sockaddr_in)) - return -EINVAL; - - return htons(port) == sockaddr.in4.sin_port; - } else { - if (l < sizeof(struct sockaddr_in6)) - return -EINVAL; - - return htons(port) == sockaddr.in6.sin6_port; - } - } - - return 1; -} - -_sd_export_ int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length) { - union sockaddr_union sockaddr; - socklen_t l; - int r; - - if ((r = sd_is_socket_internal(fd, type, listening)) <= 0) - return r; - - memset(&sockaddr, 0, sizeof(sockaddr)); - l = sizeof(sockaddr); - - if (getsockname(fd, &sockaddr.sa, &l) < 0) - return -errno; - - if (l < sizeof(sa_family_t)) - return -EINVAL; - - if (sockaddr.sa.sa_family != AF_UNIX) - return 0; - - if (path) { - if (length <= 0) - length = strlen(path); - - if (length <= 0) - /* Unnamed socket */ - return l == offsetof(struct sockaddr_un, sun_path); - - if (path[0]) - /* Normal path socket */ - return - (l >= offsetof(struct sockaddr_un, sun_path) + length + 1) && - memcmp(path, sockaddr.un.sun_path, length+1) == 0; - else - /* Abstract namespace socket */ - return - (l == offsetof(struct sockaddr_un, sun_path) + length) && - memcmp(path, sockaddr.un.sun_path, length) == 0; - } - - return 1; -} - -_sd_export_ int sd_is_mq(int fd, const char *path) { -#if !defined(__linux__) - return 0; -#else - struct mq_attr attr; - - if (fd < 0) - return -EINVAL; - - if (mq_getattr(fd, &attr) < 0) - return -errno; - - if (path) { - char fpath[PATH_MAX]; - struct stat a, b; - - if (path[0] != '/') - return -EINVAL; - - if (fstat(fd, &a) < 0) - return -errno; - - strncpy(stpcpy(fpath, "/dev/mqueue"), path, sizeof(fpath) - 12); - fpath[sizeof(fpath)-1] = 0; - - if (stat(fpath, &b) < 0) - return -errno; - - if (a.st_dev != b.st_dev || - a.st_ino != b.st_ino) - return 0; - } - - return 1; -#endif -} - -_sd_export_ int sd_notify(int unset_environment, const char *state) { -#if defined(DISABLE_SYSTEMD) || !defined(__linux__) || !defined(SOCK_CLOEXEC) - return 0; -#else - int fd = -1, r; - struct msghdr msghdr; - struct iovec iovec; - union sockaddr_union sockaddr; - const char *e; - - if (!state) { - r = -EINVAL; - goto finish; - } - - if (!(e = getenv("NOTIFY_SOCKET"))) - return 0; - - /* Must be an abstract socket, or an absolute path */ - if ((e[0] != '@' && e[0] != '/') || e[1] == 0) { - r = -EINVAL; - goto finish; - } - - if ((fd = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0)) < 0) { - r = -errno; - goto finish; - } - - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sa.sa_family = AF_UNIX; - strncpy(sockaddr.un.sun_path, e, sizeof(sockaddr.un.sun_path)); - - if (sockaddr.un.sun_path[0] == '@') - sockaddr.un.sun_path[0] = 0; - - memset(&iovec, 0, sizeof(iovec)); - iovec.iov_base = (char*) state; - iovec.iov_len = strlen(state); - - memset(&msghdr, 0, sizeof(msghdr)); - msghdr.msg_name = &sockaddr; - msghdr.msg_namelen = offsetof(struct sockaddr_un, sun_path) + strlen(e); - - if (msghdr.msg_namelen > sizeof(struct sockaddr_un)) - msghdr.msg_namelen = sizeof(struct sockaddr_un); - - msghdr.msg_iov = &iovec; - msghdr.msg_iovlen = 1; - - if (sendmsg(fd, &msghdr, MSG_NOSIGNAL) < 0) { - r = -errno; - goto finish; - } - - r = 1; - -finish: - if (unset_environment) - unsetenv("NOTIFY_SOCKET"); - - if (fd >= 0) - close(fd); - - return r; -#endif -} - -_sd_export_ int sd_notifyf(int unset_environment, const char *format, ...) { -#if defined(DISABLE_SYSTEMD) || !defined(__linux__) - return 0; -#else - va_list ap; - char *p = NULL; - int r; - - va_start(ap, format); - r = vasprintf(&p, format, ap); - va_end(ap); - - if (r < 0 || !p) - return -ENOMEM; - - r = sd_notify(unset_environment, p); - free(p); - - return r; -#endif -} - -_sd_export_ int sd_booted(void) { -#if defined(DISABLE_SYSTEMD) || !defined(__linux__) - return 0; -#else - - struct stat a, b; - - /* We simply test whether the systemd cgroup hierarchy is - * mounted */ - - if (lstat("/sys/fs/cgroup", &a) < 0) - return 0; - - if (lstat("/sys/fs/cgroup/systemd", &b) < 0) - return 0; - - return a.st_dev != b.st_dev; -#endif -} diff --git a/udev/sd-daemon.h b/udev/sd-daemon.h deleted file mode 100644 index 46dc7fd7e5..0000000000 --- a/udev/sd-daemon.h +++ /dev/null @@ -1,277 +0,0 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - -#ifndef foosddaemonhfoo -#define foosddaemonhfoo - -/*** - Copyright 2010 Lennart Poettering - - Permission is hereby granted, free of charge, to any person - obtaining a copy of this software and associated documentation files - (the "Software"), to deal in the Software without restriction, - including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, - and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. -***/ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - Reference implementation of a few systemd related interfaces for - writing daemons. These interfaces are trivial to implement. To - simplify porting we provide this reference implementation. - Applications are welcome to reimplement the algorithms described - here if they do not want to include these two source files. - - The following functionality is provided: - - - Support for logging with log levels on stderr - - File descriptor passing for socket-based activation - - Daemon startup and status notification - - Detection of systemd boots - - You may compile this with -DDISABLE_SYSTEMD to disable systemd - support. This makes all those calls NOPs that are directly related to - systemd (i.e. only sd_is_xxx() will stay useful). - - Since this is drop-in code we don't want any of our symbols to be - exported in any case. Hence we declare hidden visibility for all of - them. - - You may find an up-to-date version of these source files online: - - http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h - http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c - - This should compile on non-Linux systems, too, but with the - exception of the sd_is_xxx() calls all functions will become NOPs. - - See sd-daemon(7) for more information. -*/ - -#ifndef _sd_printf_attr_ -#if __GNUC__ >= 4 -#define _sd_printf_attr_(a,b) __attribute__ ((format (printf, a, b))) -#else -#define _sd_printf_attr_(a,b) -#endif -#endif - -/* - Log levels for usage on stderr: - - fprintf(stderr, SD_NOTICE "Hello World!\n"); - - This is similar to printk() usage in the kernel. -*/ -#define SD_EMERG "<0>" /* system is unusable */ -#define SD_ALERT "<1>" /* action must be taken immediately */ -#define SD_CRIT "<2>" /* critical conditions */ -#define SD_ERR "<3>" /* error conditions */ -#define SD_WARNING "<4>" /* warning conditions */ -#define SD_NOTICE "<5>" /* normal but significant condition */ -#define SD_INFO "<6>" /* informational */ -#define SD_DEBUG "<7>" /* debug-level messages */ - -/* The first passed file descriptor is fd 3 */ -#define SD_LISTEN_FDS_START 3 - -/* - Returns how many file descriptors have been passed, or a negative - errno code on failure. Optionally, removes the $LISTEN_FDS and - $LISTEN_PID file descriptors from the environment (recommended, but - problematic in threaded environments). If r is the return value of - this function you'll find the file descriptors passed as fds - SD_LISTEN_FDS_START to SD_LISTEN_FDS_START+r-1. Returns a negative - errno style error code on failure. This function call ensures that - the FD_CLOEXEC flag is set for the passed file descriptors, to make - sure they are not passed on to child processes. If FD_CLOEXEC shall - not be set, the caller needs to unset it after this call for all file - descriptors that are used. - - See sd_listen_fds(3) for more information. -*/ -int sd_listen_fds(int unset_environment); - -/* - Helper call for identifying a passed file descriptor. Returns 1 if - the file descriptor is a FIFO in the file system stored under the - specified path, 0 otherwise. If path is NULL a path name check will - not be done and the call only verifies if the file descriptor - refers to a FIFO. Returns a negative errno style error code on - failure. - - See sd_is_fifo(3) for more information. -*/ -int sd_is_fifo(int fd, const char *path); - -/* - Helper call for identifying a passed file descriptor. Returns 1 if - the file descriptor is a special character device on the file - system stored under the specified path, 0 otherwise. - If path is NULL a path name check will not be done and the call - only verifies if the file descriptor refers to a special character. - Returns a negative errno style error code on failure. - - See sd_is_special(3) for more information. -*/ -int sd_is_special(int fd, const char *path); - -/* - Helper call for identifying a passed file descriptor. Returns 1 if - the file descriptor is a socket of the specified family (AF_INET, - ...) and type (SOCK_DGRAM, SOCK_STREAM, ...), 0 otherwise. If - family is 0 a socket family check will not be done. If type is 0 a - socket type check will not be done and the call only verifies if - the file descriptor refers to a socket. If listening is > 0 it is - verified that the socket is in listening mode. (i.e. listen() has - been called) If listening is == 0 it is verified that the socket is - not in listening mode. If listening is < 0 no listening mode check - is done. Returns a negative errno style error code on failure. - - See sd_is_socket(3) for more information. -*/ -int sd_is_socket(int fd, int family, int type, int listening); - -/* - Helper call for identifying a passed file descriptor. Returns 1 if - the file descriptor is an Internet socket, of the specified family - (either AF_INET or AF_INET6) and the specified type (SOCK_DGRAM, - SOCK_STREAM, ...), 0 otherwise. If version is 0 a protocol version - check is not done. If type is 0 a socket type check will not be - done. If port is 0 a socket port check will not be done. The - listening flag is used the same way as in sd_is_socket(). Returns a - negative errno style error code on failure. - - See sd_is_socket_inet(3) for more information. -*/ -int sd_is_socket_inet(int fd, int family, int type, int listening, uint16_t port); - -/* - Helper call for identifying a passed file descriptor. Returns 1 if - the file descriptor is an AF_UNIX socket of the specified type - (SOCK_DGRAM, SOCK_STREAM, ...) and path, 0 otherwise. If type is 0 - a socket type check will not be done. If path is NULL a socket path - check will not be done. For normal AF_UNIX sockets set length to - 0. For abstract namespace sockets set length to the length of the - socket name (including the initial 0 byte), and pass the full - socket path in path (including the initial 0 byte). The listening - flag is used the same way as in sd_is_socket(). Returns a negative - errno style error code on failure. - - See sd_is_socket_unix(3) for more information. -*/ -int sd_is_socket_unix(int fd, int type, int listening, const char *path, size_t length); - -/* - Helper call for identifying a passed file descriptor. Returns 1 if - the file descriptor is a POSIX Message Queue of the specified name, - 0 otherwise. If path is NULL a message queue name check is not - done. Returns a negative errno style error code on failure. -*/ -int sd_is_mq(int fd, const char *path); - -/* - Informs systemd about changed daemon state. This takes a number of - newline separated environment-style variable assignments in a - string. The following variables are known: - - READY=1 Tells systemd that daemon startup is finished (only - relevant for services of Type=notify). The passed - argument is a boolean "1" or "0". Since there is - little value in signaling non-readiness the only - value daemons should send is "READY=1". - - STATUS=... Passes a single-line status string back to systemd - that describes the daemon state. This is free-from - and can be used for various purposes: general state - feedback, fsck-like programs could pass completion - percentages and failing programs could pass a human - readable error message. Example: "STATUS=Completed - 66% of file system check..." - - ERRNO=... If a daemon fails, the errno-style error code, - formatted as string. Example: "ERRNO=2" for ENOENT. - - BUSERROR=... If a daemon fails, the D-Bus error-style error - code. Example: "BUSERROR=org.freedesktop.DBus.Error.TimedOut" - - MAINPID=... The main pid of a daemon, in case systemd did not - fork off the process itself. Example: "MAINPID=4711" - - Daemons can choose to send additional variables. However, it is - recommended to prefix variable names not listed above with X_. - - Returns a negative errno-style error code on failure. Returns > 0 - if systemd could be notified, 0 if it couldn't possibly because - systemd is not running. - - Example: When a daemon finished starting up, it could issue this - call to notify systemd about it: - - sd_notify(0, "READY=1"); - - See sd_notifyf() for more complete examples. - - See sd_notify(3) for more information. -*/ -int sd_notify(int unset_environment, const char *state); - -/* - Similar to sd_notify() but takes a format string. - - Example 1: A daemon could send the following after initialization: - - sd_notifyf(0, "READY=1\n" - "STATUS=Processing requests...\n" - "MAINPID=%lu", - (unsigned long) getpid()); - - Example 2: A daemon could send the following shortly before - exiting, on failure: - - sd_notifyf(0, "STATUS=Failed to start up: %s\n" - "ERRNO=%i", - strerror(errno), - errno); - - See sd_notifyf(3) for more information. -*/ -int sd_notifyf(int unset_environment, const char *format, ...) _sd_printf_attr_(2,3); - -/* - Returns > 0 if the system was booted with systemd. Returns < 0 on - error. Returns 0 if the system was not booted with systemd. Note - that all of the functions above handle non-systemd boots just - fine. You should NOT protect them with a call to this function. Also - note that this function checks whether the system, not the user - session is controlled by systemd. However the functions above work - for both user and system services. - - See sd_booted(3) for more information. -*/ -int sd_booted(void); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/udev/test-udev.c b/udev/test-udev.c deleted file mode 100644 index 8d5baf7f54..0000000000 --- a/udev/test-udev.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -void udev_main_log(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) {} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - struct udev_event *event = NULL; - struct udev_device *dev = NULL; - struct udev_rules *rules = NULL; - char syspath[UTIL_PATH_SIZE]; - const char *devpath; - const char *action; - sigset_t mask, sigmask_orig; - int err = -EINVAL; - - udev = udev_new(); - if (udev == NULL) - exit(1); - info(udev, "version %s\n", VERSION); - udev_selinux_init(udev); - - sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); - - action = argv[1]; - if (action == NULL) { - err(udev, "action missing\n"); - goto out; - } - - devpath = argv[2]; - if (devpath == NULL) { - err(udev, "devpath missing\n"); - goto out; - } - - rules = udev_rules_new(udev, 1); - - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - dev = udev_device_new_from_syspath(udev, syspath); - if (dev == NULL) { - info(udev, "unknown device '%s'\n", devpath); - goto out; - } - - udev_device_set_action(dev, action); - event = udev_event_new(dev); - - sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); - event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (event->fd_signal < 0) { - fprintf(stderr, "error creating signalfd\n"); - goto out; - } - - /* do what devtmpfs usually provides us */ - if (udev_device_get_devnode(dev) != NULL) { - mode_t mode; - - if (strcmp(udev_device_get_subsystem(dev), "block") == 0) - mode |= S_IFBLK; - else - mode |= S_IFCHR; - - if (strcmp(action, "remove") != 0) { - util_create_path(udev, udev_device_get_devnode(dev)); - mknod(udev_device_get_devnode(dev), mode, udev_device_get_devnum(dev)); - } else { - unlink(udev_device_get_devnode(dev)); - util_delete_path(udev, udev_device_get_devnode(dev)); - } - } - - err = udev_event_execute_rules(event, rules, &sigmask_orig); - if (err == 0) - udev_event_execute_run(event, NULL); -out: - if (event != NULL && event->fd_signal >= 0) - close(event->fd_signal); - udev_event_unref(event); - udev_device_unref(dev); - udev_rules_unref(rules); - udev_selinux_exit(udev); - udev_unref(udev); - if (err != 0) - return 1; - return 0; -} diff --git a/udev/udev-builtin-blkid.c b/udev/udev-builtin-blkid.c deleted file mode 100644 index 0260c440e2..0000000000 --- a/udev/udev-builtin-blkid.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * probe disks for filesystems and partitions - * - * Copyright (C) 2011 Kay Sievers - * Copyright (C) 2011 Karel Zak - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static void print_property(struct udev_device *dev, bool test, const char *name, const char *value) -{ - char s[265]; - - s[0] = '\0'; - - if (!strcmp(name, "TYPE")) { - udev_builtin_add_property(dev, test, "ID_FS_TYPE", value); - - } else if (!strcmp(name, "USAGE")) { - udev_builtin_add_property(dev, test, "ID_FS_USAGE", value); - - } else if (!strcmp(name, "VERSION")) { - udev_builtin_add_property(dev, test, "ID_FS_VERSION", value); - - } else if (!strcmp(name, "UUID")) { - blkid_safe_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_UUID", s); - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_UUID_ENC", s); - - } else if (!strcmp(name, "UUID_SUB")) { - blkid_safe_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB", s); - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB_ENC", s); - - } else if (!strcmp(name, "LABEL")) { - blkid_safe_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_LABEL", s); - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_LABEL_ENC", s); - - } else if (!strcmp(name, "PTTYPE")) { - udev_builtin_add_property(dev, test, "ID_PART_TABLE_TYPE", value); - - } else if (!strcmp(name, "PART_ENTRY_NAME")) { - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "PART_ENTRY_NAME", s); - - } else if (!strcmp(name, "PART_ENTRY_TYPE")) { - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "PART_ENTRY_TYPE", s); - - } else if (!strncmp(name, "PART_ENTRY_", 11)) { - util_strscpyl(s, sizeof(s), "ID_", name, NULL); - udev_builtin_add_property(dev, test, name, value); - } -} - -static int probe_superblocks(blkid_probe pr) -{ - struct stat st; - int rc; - - if (fstat(blkid_probe_get_fd(pr), &st)) - return -1; - - blkid_probe_enable_partitions(pr, 1); - - if (!S_ISCHR(st.st_mode) && blkid_probe_get_size(pr) <= 1024 * 1440 && - blkid_probe_is_wholedisk(pr)) { - /* - * check if the small disk is partitioned, if yes then - * don't probe for filesystems. - */ - blkid_probe_enable_superblocks(pr, 0); - - rc = blkid_do_fullprobe(pr); - if (rc < 0) - return rc; /* -1 = error, 1 = nothing, 0 = succes */ - - if (blkid_probe_lookup_value(pr, "PTTYPE", NULL, NULL) == 0) - return 0; /* partition table detected */ - } - - blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); - blkid_probe_enable_superblocks(pr, 1); - - return blkid_do_safeprobe(pr); -} - -static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) -{ - struct udev *udev = udev_device_get_udev(dev); - int64_t offset = 0; - bool noraid = false; - int fd = -1; - blkid_probe pr; - const char *data; - const char *name; - int nvals; - int i; - size_t len; - int err = 0; - - static const struct option options[] = { - { "offset", optional_argument, NULL, 'o' }, - { "noraid", no_argument, NULL, 'R' }, - {} - }; - - for (;;) { - int option; - - option = getopt_long(argc, argv, "oR", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'o': - offset = strtoull(optarg, NULL, 0); - break; - case 'R': - noraid = true; - break; - } - } - - pr = blkid_new_probe(); - if (!pr) { - err = -ENOMEM; - return EXIT_FAILURE; - } - - blkid_probe_set_superblocks_flags(pr, - BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | - BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE | - BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION); - - if (noraid) - blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID); - - fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC); - if (fd < 0) { - fprintf(stderr, "error: %s: %m\n", udev_device_get_devnode(dev)); - goto out; - } - - err = blkid_probe_set_device(pr, fd, offset, 0); - if (err < 0) - goto out; - - info(udev, "probe %s %sraid offset=%llu\n", - udev_device_get_devnode(dev), - noraid ? "no" : "", (unsigned long long) offset); - - err = probe_superblocks(pr); - if (err < 0) - goto out; - - nvals = blkid_probe_numof_values(pr); - for (i = 0; i < nvals; i++) { - if (blkid_probe_get_value(pr, i, &name, &data, &len)) - continue; - len = strnlen((char *) data, len); - print_property(dev, test, name, (char *) data); - } - - blkid_free_probe(pr); -out: - if (fd > 0) - close(fd); - if (err < 0) - return EXIT_FAILURE; - return EXIT_SUCCESS; -} - -const struct udev_builtin udev_builtin_blkid = { - .name = "blkid", - .cmd = builtin_blkid, - .help = "filesystem and partition probing", - .run_once = true, -}; diff --git a/udev/udev-builtin-firmware.c b/udev/udev-builtin-firmware.c deleted file mode 100644 index d7921a2693..0000000000 --- a/udev/udev-builtin-firmware.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * firmware - Kernel firmware loader - * - * Copyright (C) 2009 Piter Punk - * Copyright (C) 2009-2011 Kay Sievers - * - * 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; either version 2 of the - * License, or (at your option) any later version. - * - * 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:* - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static bool set_loading(struct udev *udev, char *loadpath, const char *state) -{ - FILE *ldfile; - - ldfile = fopen(loadpath, "we"); - if (ldfile == NULL) { - err(udev, "error: can not open '%s'\n", loadpath); - return false; - }; - fprintf(ldfile, "%s\n", state); - fclose(ldfile); - return true; -} - -static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) -{ - char *buf; - FILE *fsource = NULL, *ftarget = NULL; - bool ret = false; - - buf = malloc(size); - if (buf == NULL) { - err(udev,"No memory available to load firmware file"); - return false; - } - - info(udev, "writing '%s' (%zi) to '%s'\n", source, size, target); - - fsource = fopen(source, "re"); - if (fsource == NULL) - goto exit; - ftarget = fopen(target, "we"); - if (ftarget == NULL) - goto exit; - if (fread(buf, size, 1, fsource) != 1) - goto exit; - if (fwrite(buf, size, 1, ftarget) == 1) - ret = true; -exit: - if (ftarget != NULL) - fclose(ftarget); - if (fsource != NULL) - fclose(fsource); - free(buf); - return ret; -} - -static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) -{ - struct udev *udev = udev_device_get_udev(dev); - static const char *searchpath[] = { FIRMWARE_PATH }; - char fwencpath[UTIL_PATH_SIZE]; - char misspath[UTIL_PATH_SIZE]; - char loadpath[UTIL_PATH_SIZE]; - char datapath[UTIL_PATH_SIZE]; - char fwpath[UTIL_PATH_SIZE]; - const char *firmware; - FILE *fwfile; - struct utsname kernel; - struct stat statbuf; - unsigned int i; - int rc = EXIT_SUCCESS; - - firmware = udev_device_get_property_value(dev, "FIRMWARE"); - if (firmware == NULL) { - err(udev, "firmware parameter missing\n\n"); - rc = EXIT_FAILURE; - goto exit; - } - - /* lookup firmware file */ - uname(&kernel); - for (i = 0; i < ARRAY_SIZE(searchpath); i++) { - util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); - dbg(udev, "trying %s\n", fwpath); - fwfile = fopen(fwpath, "re"); - if (fwfile != NULL) - break; - - util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); - dbg(udev, "trying %s\n", fwpath); - fwfile = fopen(fwpath, "re"); - if (fwfile != NULL) - break; - } - - util_path_encode(firmware, fwencpath, sizeof(fwencpath)); - util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL); - util_strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); - - if (fwfile == NULL) { - int err; - - /* This link indicates the missing firmware file and the associated device */ - info(udev, "did not find firmware file '%s'\n", firmware); - do { - err = util_create_path(udev, misspath); - if (err != 0 && err != -ENOENT) - break; - err = symlink(udev_device_get_devpath(dev), misspath); - if (err != 0) - err = -errno; - } while (err == -ENOENT); - rc = EXIT_FAILURE; - set_loading(udev, loadpath, "-1"); - goto exit; - } - - if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { - rc = EXIT_FAILURE; - goto exit; - } - if (unlink(misspath) == 0) - util_delete_path(udev, misspath); - - if (!set_loading(udev, loadpath, "1")) - goto exit; - - util_strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); - if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { - err(udev, "error sending firmware '%s' to device\n", firmware); - set_loading(udev, loadpath, "-1"); - rc = EXIT_FAILURE; - goto exit; - }; - - set_loading(udev, loadpath, "0"); -exit: - if (fwfile) - fclose(fwfile); - return rc; -} - -const struct udev_builtin udev_builtin_firmware = { - .name = "firmware", - .cmd = builtin_firmware, - .help = "kernel firmware loader", - .run_once = true, -}; diff --git a/udev/udev-builtin-hwdb.c b/udev/udev-builtin-hwdb.c deleted file mode 100644 index b6af4b6fcf..0000000000 --- a/udev/udev-builtin-hwdb.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * usb-db, pci-db - lookup vendor/product database - * - * Copyright (C) 2009 Lennart Poettering - * Copyright (C) 2011 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int get_id_attr( - struct udev_device *parent, - const char *name, - uint16_t *value) { - - const char *t; - unsigned u; - - if (!(t = udev_device_get_sysattr_value(parent, name))) { - fprintf(stderr, "%s lacks %s.\n", udev_device_get_syspath(parent), name); - return -1; - } - - if (!strncmp(t, "0x", 2)) - t += 2; - - if (sscanf(t, "%04x", &u) != 1 || u > 0xFFFFU) { - fprintf(stderr, "Failed to parse %s on %s.\n", name, udev_device_get_syspath(parent)); - return -1; - } - - *value = (uint16_t) u; - return 0; -} - -static int get_vid_pid( - struct udev_device *parent, - const char *vendor_attr, - const char *product_attr, - uint16_t *vid, - uint16_t *pid) { - - if (get_id_attr(parent, vendor_attr, vid) < 0) - return -1; - else if (*vid <= 0) { - fprintf(stderr, "Invalid vendor id.\n"); - return -1; - } - - if (get_id_attr(parent, product_attr, pid) < 0) - return -1; - - return 0; -} - -static void rstrip(char *n) { - size_t i; - - for (i = strlen(n); i > 0 && isspace(n[i-1]); i--) - n[i-1] = 0; -} - -#define HEXCHARS "0123456789abcdefABCDEF" -#define WHITESPACE " \t\n\r" -static int lookup_vid_pid(const char *database, - uint16_t vid, uint16_t pid, - char **vendor, char **product) -{ - - FILE *f; - int ret = -1; - int found_vendor = 0; - char *line = NULL; - - *vendor = *product = NULL; - - if (!(f = fopen(database, "rme"))) { - fprintf(stderr, "Failed to open database file '%s': %s\n", database, strerror(errno)); - return -1; - } - - for (;;) { - size_t n; - - if (getline(&line, &n, f) < 0) - break; - - rstrip(line); - - if (line[0] == '#' || line[0] == 0) - continue; - - if (strspn(line, HEXCHARS) == 4) { - unsigned u; - - if (found_vendor) - break; - - if (sscanf(line, "%04x", &u) == 1 && u == vid) { - char *t; - - t = line+4; - t += strspn(t, WHITESPACE); - - if (!(*vendor = strdup(t))) { - fprintf(stderr, "Out of memory.\n"); - goto finish; - } - - found_vendor = 1; - } - - continue; - } - - if (found_vendor && line[0] == '\t' && strspn(line+1, HEXCHARS) == 4) { - unsigned u; - - if (sscanf(line+1, "%04x", &u) == 1 && u == pid) { - char *t; - - t = line+5; - t += strspn(t, WHITESPACE); - - if (!(*product = strdup(t))) { - fprintf(stderr, "Out of memory.\n"); - goto finish; - } - - break; - } - } - } - - ret = 0; - -finish: - free(line); - fclose(f); - - if (ret < 0) { - free(*product); - free(*vendor); - - *product = *vendor = NULL; - } - - return ret; -} - -static struct udev_device *find_device(struct udev_device *dev, const char *subsys, const char *devtype) -{ - const char *str; - - str = udev_device_get_subsystem(dev); - if (str == NULL) - goto try_parent; - if (strcmp(str, subsys) != 0) - goto try_parent; - - if (devtype != NULL) { - str = udev_device_get_devtype(dev); - if (str == NULL) - goto try_parent; - if (strcmp(str, devtype) != 0) - goto try_parent; - } - return dev; -try_parent: - return udev_device_get_parent_with_subsystem_devtype(dev, subsys, devtype); -} - - -static int builtin_db(struct udev_device *dev, bool test, - const char *database, - const char *vendor_attr, const char *product_attr, - const char *subsys, const char *devtype) -{ - struct udev_device *parent; - uint16_t vid = 0, pid = 0; - char *vendor = NULL, *product = NULL; - - parent = find_device(dev, subsys, devtype); - if (!parent) { - fprintf(stderr, "Failed to find device.\n"); - goto finish; - } - - if (get_vid_pid(parent, vendor_attr, product_attr, &vid, &pid) < 0) - goto finish; - - if (lookup_vid_pid(database, vid, pid, &vendor, &product) < 0) - goto finish; - - if (vendor) - udev_builtin_add_property(dev, test, "ID_VENDOR_FROM_DATABASE", vendor); - if (product) - udev_builtin_add_property(dev, test, "ID_MODEL_FROM_DATABASE", product); - -finish: - free(vendor); - free(product); - return 0; -} - -static int builtin_usb_db(struct udev_device *dev, int argc, char *argv[], bool test) -{ - return builtin_db(dev, test, USB_DATABASE, "idVendor", "idProduct", "usb", "usb_device"); -} - -static int builtin_pci_db(struct udev_device *dev, int argc, char *argv[], bool test) -{ - return builtin_db(dev, test, PCI_DATABASE, "vendor", "device", "pci", NULL); -} - -const struct udev_builtin udev_builtin_usb_db = { - .name = "usb-db", - .cmd = builtin_usb_db, - .help = "USB vendor/product database", - .run_once = true, -}; - -const struct udev_builtin udev_builtin_pci_db = { - .name = "pci-db", - .cmd = builtin_pci_db, - .help = "PCI vendor/product database", - .run_once = true, -}; diff --git a/udev/udev-builtin-input_id.c b/udev/udev-builtin-input_id.c deleted file mode 100644 index 4ef060d899..0000000000 --- a/udev/udev-builtin-input_id.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * compose persistent device path - * - * Copyright (C) 2009 Martin Pitt - * Portions Copyright (C) 2004 David Zeuthen, - * Copyright (C) 2011 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -/* we must use this kernel-compatible implementation */ -#define BITS_PER_LONG (sizeof(unsigned long) * 8) -#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) -#define OFF(x) ((x)%BITS_PER_LONG) -#define BIT(x) (1UL<> OFF(bit)) & 1) - -/* - * Read a capability attribute and return bitmask. - * @param dev udev_device - * @param attr sysfs attribute name (e. g. "capabilities/key") - * @param bitmask: Output array which has a sizeof of bitmask_size - */ -static void get_cap_mask(struct udev_device *dev, - struct udev_device *pdev, const char* attr, - unsigned long *bitmask, size_t bitmask_size, - bool test) -{ - struct udev *udev = udev_device_get_udev(dev); - char text[4096]; - unsigned i; - char* word; - unsigned long val; - - snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(pdev, attr)); - info(udev, "%s raw kernel attribute: %s\n", attr, text); - - memset (bitmask, 0, bitmask_size); - i = 0; - while ((word = strrchr(text, ' ')) != NULL) { - val = strtoul (word+1, NULL, 16); - if (i < bitmask_size/sizeof(unsigned long)) - bitmask[i] = val; - else - info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); - *word = '\0'; - ++i; - } - val = strtoul (text, NULL, 16); - if (i < bitmask_size / sizeof(unsigned long)) - bitmask[i] = val; - else - info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); - - if (test) { - /* printf pattern with the right unsigned long number of hex chars */ - snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long)); - info(udev, "%s decoded bit map:\n", attr); - val = bitmask_size / sizeof (unsigned long); - /* skip over leading zeros */ - while (bitmask[val-1] == 0 && val > 0) - --val; - for (i = 0; i < val; ++i) - info(udev, text, i * BITS_PER_LONG, bitmask[i]); - } -} - -/* pointer devices */ -static void test_pointers (struct udev_device *dev, - const unsigned long* bitmask_ev, - const unsigned long* bitmask_abs, - const unsigned long* bitmask_key, - const unsigned long* bitmask_rel, - bool test) -{ - int is_mouse = 0; - int is_touchpad = 0; - - if (!test_bit (EV_KEY, bitmask_ev)) { - if (test_bit (EV_ABS, bitmask_ev) && - test_bit (ABS_X, bitmask_abs) && - test_bit (ABS_Y, bitmask_abs) && - test_bit (ABS_Z, bitmask_abs)) - udev_builtin_add_property(dev, test, "ID_INPUT_ACCELEROMETER", "1"); - return; - } - - if (test_bit (EV_ABS, bitmask_ev) && - test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { - if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) - udev_builtin_add_property(dev, test, "ID_INPUT_TABLET", "1"); - else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) - is_touchpad = 1; - else if (test_bit (BTN_TRIGGER, bitmask_key) || - test_bit (BTN_A, bitmask_key) || - test_bit (BTN_1, bitmask_key)) - udev_builtin_add_property(dev, test, "ID_INPUT_JOYSTICK", "1"); - else if (test_bit (BTN_MOUSE, bitmask_key)) - /* This path is taken by VMware's USB mouse, which has - * absolute axes, but no touch/pressure button. */ - is_mouse = 1; - else if (test_bit (BTN_TOUCH, bitmask_key)) - udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHSCREEN", "1"); - } - - if (test_bit (EV_REL, bitmask_ev) && - test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && - test_bit (BTN_MOUSE, bitmask_key)) - is_mouse = 1; - - if (is_mouse) - udev_builtin_add_property(dev, test, "ID_INPUT_MOUSE", "1"); - if (is_touchpad) - udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHPAD", "1"); -} - -/* key like devices */ -static void test_key (struct udev_device *dev, - const unsigned long* bitmask_ev, - const unsigned long* bitmask_key, - bool test) -{ - struct udev *udev = udev_device_get_udev(dev); - unsigned i; - unsigned long found; - unsigned long mask; - - /* do we have any KEY_* capability? */ - if (!test_bit (EV_KEY, bitmask_ev)) { - info(udev, "test_key: no EV_KEY capability\n"); - return; - } - - /* only consider KEY_* here, not BTN_* */ - found = 0; - for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) { - found |= bitmask_key[i]; - info(udev, "test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); - } - /* If there are no keys in the lower block, check the higher block */ - if (!found) { - for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) { - if (test_bit (i, bitmask_key)) { - info(udev, "test_key: Found key %x in high block\n", i); - found = 1; - break; - } - } - } - - if (found > 0) - udev_builtin_add_property(dev, test, "ID_INPUT_KEY", "1"); - - /* the first 32 bits are ESC, numbers, and Q to D; if we have all of - * those, consider it a full keyboard; do not test KEY_RESERVED, though */ - mask = 0xFFFFFFFE; - if ((bitmask_key[0] & mask) == mask) - udev_builtin_add_property(dev, test, "ID_INPUT_KEYBOARD", "1"); -} - -static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], bool test) -{ - struct udev_device *pdev; - unsigned long bitmask_ev[NBITS(EV_MAX)]; - unsigned long bitmask_abs[NBITS(ABS_MAX)]; - unsigned long bitmask_key[NBITS(KEY_MAX)]; - unsigned long bitmask_rel[NBITS(REL_MAX)]; - - /* walk up the parental chain until we find the real input device; the - * argument is very likely a subdevice of this, like eventN */ - pdev = dev; - while (pdev != NULL && udev_device_get_sysattr_value(pdev, "capabilities/ev") == NULL) - pdev = udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); - - /* not an "input" class device */ - if (pdev == NULL) - return EXIT_SUCCESS; - - /* Use this as a flag that input devices were detected, so that this - * program doesn't need to be called more than once per device */ - udev_builtin_add_property(dev, test, "ID_INPUT", "1"); - get_cap_mask(dev, pdev, "capabilities/ev", bitmask_ev, sizeof(bitmask_ev), test); - get_cap_mask(dev, pdev, "capabilities/abs", bitmask_abs, sizeof(bitmask_abs), test); - get_cap_mask(dev, pdev, "capabilities/rel", bitmask_rel, sizeof(bitmask_rel), test); - get_cap_mask(dev, pdev, "capabilities/key", bitmask_key, sizeof(bitmask_key), test); - test_pointers(dev, bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel, test); - test_key(dev, bitmask_ev, bitmask_key, test); - return EXIT_SUCCESS; -} - -const struct udev_builtin udev_builtin_input_id = { - .name = "input_id", - .cmd = builtin_input_id, - .help = "input device properties", -}; diff --git a/udev/udev-builtin-kmod.c b/udev/udev-builtin-kmod.c deleted file mode 100644 index 6719432c08..0000000000 --- a/udev/udev-builtin-kmod.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * load kernel modules - * - * Copyright (C) 2011 Kay Sievers - * Copyright (C) 2011 ProFUSION embedded systems - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static struct kmod_ctx *ctx; - -static int load_module(struct udev *udev, const char *alias) -{ - struct kmod_list *list = NULL; - struct kmod_list *listb = NULL; - struct kmod_list *l; - int err; - - err = kmod_module_new_from_lookup(ctx, alias, &list); - if (err < 0) - return err; - - err = kmod_module_get_filtered_blacklist(ctx, list, &listb); - if (err < 0) - return err; - - if (list == NULL) - info(udev, "no module matches '%s'\n", alias); - - kmod_list_foreach(l, listb) { - struct kmod_module *mod = kmod_module_get_module(l); - - err = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL); - if (err >=0 ) - info(udev, "inserted '%s'\n", kmod_module_get_name(mod)); - else - info(udev, "failed to insert '%s'\n", kmod_module_get_name(mod)); - - kmod_module_unref(mod); - } - - kmod_module_unref_list(list); - kmod_module_unref_list(listb); - return err; -} - -static void udev_kmod_log(void *data, int priority, const char *file, int line, - const char *fn, const char *format, va_list args) -{ - udev_main_log(data, priority, file, line, fn, format, args); -} - -/* needs to re-instantiate the context after a reload */ -static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) -{ - struct udev *udev = udev_device_get_udev(dev); - int i; - - if (!ctx) { - ctx = kmod_new(NULL, NULL); - if (!ctx) - return -ENOMEM; - - info(udev, "load module index\n"); - kmod_set_log_fn(ctx, udev_kmod_log, udev); - kmod_load_resources(ctx); - } - - if (argc < 3 || strcmp(argv[1], "load")) { - err(udev, "expect: %s load \n", argv[0]); - return EXIT_FAILURE; - } - - for (i = 2; argv[i]; i++) { - info(udev, "execute '%s' '%s'\n", argv[1], argv[i]); - load_module(udev, argv[i]); - } - - return EXIT_SUCCESS; -} - -/* called at udev startup */ -static int builtin_kmod_init(struct udev *udev) -{ - if (ctx) - return 0; - - ctx = kmod_new(NULL, NULL); - if (!ctx) - return -ENOMEM; - - info(udev, "load module index\n"); - kmod_set_log_fn(ctx, udev_kmod_log, udev); - kmod_load_resources(ctx); - return 0; -} - -/* called on udev shutdown and reload request */ -static void builtin_kmod_exit(struct udev *udev) -{ - info(udev, "unload module index\n"); - ctx = kmod_unref(ctx); -} - -/* called every couple of seconds during event activity; 'true' if config has changed */ -static bool builtin_kmod_validate(struct udev *udev) -{ - info(udev, "validate module index\n"); - if (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK) - return true; - return false; -} - -const struct udev_builtin udev_builtin_kmod = { - .name = "kmod", - .cmd = builtin_kmod, - .init = builtin_kmod_init, - .exit = builtin_kmod_exit, - .validate = builtin_kmod_validate, - .help = "kernel module loader", - .run_once = false, -}; diff --git a/udev/udev-builtin-path_id.c b/udev/udev-builtin-path_id.c deleted file mode 100644 index 18af12f29a..0000000000 --- a/udev/udev-builtin-path_id.c +++ /dev/null @@ -1,487 +0,0 @@ -/* - * compose persistent device path - * - * Copyright (C) 2009-2011 Kay Sievers - * - * Logic based on Hannes Reinecke's shell script. - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int path_prepend(char **path, const char *fmt, ...) -{ - va_list va; - char *pre; - int err = 0; - - va_start(va, fmt); - err = vasprintf(&pre, fmt, va); - va_end(va); - if (err < 0) - goto out; - - if (*path != NULL) { - char *new; - - err = asprintf(&new, "%s-%s", pre, *path); - free(pre); - if (err < 0) - goto out; - free(*path); - *path = new; - } else { - *path = pre; - } -out: - return err; -} - -/* -** Linux only supports 32 bit luns. -** See drivers/scsi/scsi_scan.c::scsilun_to_int() for more details. -*/ -static int format_lun_number(struct udev_device *dev, char **path) -{ - unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10); - - /* address method 0, peripheral device addressing with bus id of zero */ - if (lun < 256) - return path_prepend(path, "lun-%d", lun); - /* handle all other lun addressing methods by using a variant of the original lun format */ - return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff); -} - -static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) -{ - struct udev_device *parent = dev; - - while (parent != NULL) { - const char *subsystem; - - subsystem = udev_device_get_subsystem(parent); - if (subsystem == NULL || strcmp(subsystem, subsys) != 0) - break; - dev = parent; - parent = udev_device_get_parent(parent); - } - return dev; -} - -static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) -{ - struct udev *udev = udev_device_get_udev(parent); - struct udev_device *targetdev; - struct udev_device *fcdev = NULL; - const char *port; - char *lun = NULL;; - - targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); - if (targetdev == NULL) - return NULL; - - fcdev = udev_device_new_from_subsystem_sysname(udev, "fc_transport", udev_device_get_sysname(targetdev)); - if (fcdev == NULL) - return NULL; - port = udev_device_get_sysattr_value(fcdev, "port_name"); - if (port == NULL) { - parent = NULL; - goto out; - } - - format_lun_number(parent, &lun); - path_prepend(path, "fc-%s-%s", port, lun); - if (lun) - free(lun); -out: - udev_device_unref(fcdev); - return parent; -} - -static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) -{ - struct udev *udev = udev_device_get_udev(parent); - struct udev_device *targetdev; - struct udev_device *target_parent; - struct udev_device *sasdev; - const char *sas_address; - char *lun = NULL; - - targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); - if (targetdev == NULL) - return NULL; - - target_parent = udev_device_get_parent(targetdev); - if (target_parent == NULL) - return NULL; - - sasdev = udev_device_new_from_subsystem_sysname(udev, "sas_device", - udev_device_get_sysname(target_parent)); - if (sasdev == NULL) - return NULL; - - sas_address = udev_device_get_sysattr_value(sasdev, "sas_address"); - if (sas_address == NULL) { - parent = NULL; - goto out; - } - - format_lun_number(parent, &lun); - path_prepend(path, "sas-%s-%s", sas_address, lun); - if (lun) - free(lun); -out: - udev_device_unref(sasdev); - return parent; -} - -static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) -{ - struct udev *udev = udev_device_get_udev(parent); - struct udev_device *transportdev; - struct udev_device *sessiondev = NULL; - const char *target; - char *connname; - struct udev_device *conndev = NULL; - const char *addr; - const char *port; - char *lun = NULL; - - /* find iscsi session */ - transportdev = parent; - for (;;) { - transportdev = udev_device_get_parent(transportdev); - if (transportdev == NULL) - return NULL; - if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0) - break; - } - - /* find iscsi session device */ - sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev)); - if (sessiondev == NULL) - return NULL; - target = udev_device_get_sysattr_value(sessiondev, "targetname"); - if (target == NULL) { - parent = NULL; - goto out; - } - - if (asprintf(&connname, "connection%s:0", udev_device_get_sysnum(transportdev)) < 0) { - parent = NULL; - goto out; - } - conndev = udev_device_new_from_subsystem_sysname(udev, "iscsi_connection", connname); - free(connname); - if (conndev == NULL) { - parent = NULL; - goto out; - } - addr = udev_device_get_sysattr_value(conndev, "persistent_address"); - port = udev_device_get_sysattr_value(conndev, "persistent_port"); - if (addr == NULL || port == NULL) { - parent = NULL; - goto out; - } - - format_lun_number(parent, &lun); - path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun); - if (lun) - free(lun); -out: - udev_device_unref(sessiondev); - udev_device_unref(conndev); - return parent; -} - -static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path) -{ - struct udev_device *hostdev; - int host, bus, target, lun; - const char *name; - char *base; - char *pos; - DIR *dir; - struct dirent *dent; - int basenum; - - hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host"); - if (hostdev == NULL) - return NULL; - - name = udev_device_get_sysname(parent); - if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) - return NULL; - - /* rebase host offset to get the local relative number */ - basenum = -1; - base = strdup(udev_device_get_syspath(hostdev)); - if (base == NULL) - return NULL; - pos = strrchr(base, '/'); - if (pos == NULL) { - parent = NULL; - goto out; - } - pos[0] = '\0'; - dir = opendir(base); - if (dir == NULL) { - parent = NULL; - goto out; - } - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char *rest; - int i; - - if (dent->d_name[0] == '.') - continue; - if (dent->d_type != DT_DIR && dent->d_type != DT_LNK) - continue; - if (strncmp(dent->d_name, "host", 4) != 0) - continue; - i = strtoul(&dent->d_name[4], &rest, 10); - if (rest[0] != '\0') - continue; - if (basenum == -1 || i < basenum) - basenum = i; - } - closedir(dir); - if (basenum == -1) { - parent = NULL; - goto out; - } - host -= basenum; - - path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun); -out: - free(base); - return hostdev; -} - -static struct udev_device *handle_scsi(struct udev_device *parent, char **path) -{ - const char *devtype; - const char *name; - const char *id; - - devtype = udev_device_get_devtype(parent); - if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) - return parent; - - /* firewire */ - id = udev_device_get_sysattr_value(parent, "ieee1394_id"); - if (id != NULL) { - parent = skip_subsystem(parent, "scsi"); - path_prepend(path, "ieee1394-0x%s", id); - goto out; - } - - /* lousy scsi sysfs does not have a "subsystem" for the transport */ - name = udev_device_get_syspath(parent); - - if (strstr(name, "/rport-") != NULL) { - parent = handle_scsi_fibre_channel(parent, path); - goto out; - } - - if (strstr(name, "/end_device-") != NULL) { - parent = handle_scsi_sas(parent, path); - goto out; - } - - if (strstr(name, "/session") != NULL) { - parent = handle_scsi_iscsi(parent, path); - goto out; - } - - parent = handle_scsi_default(parent, path); -out: - return parent; -} - -static void handle_scsi_tape(struct udev_device *dev, char **path) -{ - const char *name; - - /* must be the last device in the syspath */ - if (*path != NULL) - return; - - name = udev_device_get_sysname(dev); - if (strncmp(name, "nst", 3) == 0 && strchr("lma", name[3]) != NULL) - path_prepend(path, "nst%c", name[3]); - else if (strncmp(name, "st", 2) == 0 && strchr("lma", name[2]) != NULL) - path_prepend(path, "st%c", name[2]); -} - -static struct udev_device *handle_usb(struct udev_device *parent, char **path) -{ - const char *devtype; - const char *str; - const char *port; - - devtype = udev_device_get_devtype(parent); - if (devtype == NULL) - return parent; - if (strcmp(devtype, "usb_interface") != 0 && strcmp(devtype, "usb_device") != 0) - return parent; - - str = udev_device_get_sysname(parent); - port = strchr(str, '-'); - if (port == NULL) - return parent; - port++; - - parent = skip_subsystem(parent, "usb"); - path_prepend(path, "usb-0:%s", port); - return parent; -} - -static struct udev_device *handle_cciss(struct udev_device *parent, char **path) -{ - return NULL; -} - -static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) -{ - struct udev_device *scsi_dev; - - scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); - if (scsi_dev != NULL) { - const char *wwpn; - const char *lun; - const char *hba_id; - - hba_id = udev_device_get_sysattr_value(scsi_dev, "hba_id"); - wwpn = udev_device_get_sysattr_value(scsi_dev, "wwpn"); - lun = udev_device_get_sysattr_value(scsi_dev, "fcp_lun"); - if (hba_id != NULL && lun != NULL && wwpn != NULL) { - path_prepend(path, "ccw-%s-zfcp-%s:%s", hba_id, wwpn, lun); - goto out; - } - } - - path_prepend(path, "ccw-%s", udev_device_get_sysname(parent)); -out: - parent = skip_subsystem(parent, "ccw"); - return parent; -} - -static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool test) -{ - struct udev_device *parent; - char *path = NULL; - - /* S390 ccw bus */ - parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); - if (parent != NULL) { - handle_ccw(parent, dev, &path); - goto out; - } - - /* walk up the chain of devices and compose path */ - parent = dev; - while (parent != NULL) { - const char *subsys; - - subsys = udev_device_get_subsystem(parent); - if (subsys == NULL) { - ; - } else if (strcmp(subsys, "scsi_tape") == 0) { - handle_scsi_tape(parent, &path); - } else if (strcmp(subsys, "scsi") == 0) { - parent = handle_scsi(parent, &path); - } else if (strcmp(subsys, "cciss") == 0) { - handle_cciss(parent, &path); - } else if (strcmp(subsys, "usb") == 0) { - parent = handle_usb(parent, &path); - } else if (strcmp(subsys, "serio") == 0) { - path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); - parent = skip_subsystem(parent, "serio"); - } else if (strcmp(subsys, "pci") == 0) { - path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "pci"); - } else if (strcmp(subsys, "platform") == 0) { - path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "platform"); - } else if (strcmp(subsys, "acpi") == 0) { - path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "acpi"); - } else if (strcmp(subsys, "xen") == 0) { - path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "xen"); - } else if (strcmp(subsys, "virtio") == 0) { - path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "virtio"); - } - - parent = udev_device_get_parent(parent); - } -out: - if (path != NULL) { - char tag[UTIL_NAME_SIZE]; - size_t i; - const char *p; - - /* compose valid udev tag name */ - for (p = path, i = 0; *p; p++) { - if ((*p >= '0' && *p <= '9') || - (*p >= 'A' && *p <= 'Z') || - (*p >= 'a' && *p <= 'z') || - *p == '-') { - tag[i++] = *p; - continue; - } - - /* skip all leading '_' */ - if (i == 0) - continue; - - /* avoid second '_' */ - if (tag[i-1] == '_') - continue; - - tag[i++] = '_'; - } - /* strip trailing '_' */ - while (i > 0 && tag[i-1] == '_') - i--; - tag[i] = '\0'; - - udev_builtin_add_property(dev, test, "ID_PATH", path); - udev_builtin_add_property(dev, test, "ID_PATH_TAG", tag); - free(path); - return EXIT_SUCCESS; - } - return EXIT_FAILURE; -} - -const struct udev_builtin udev_builtin_path_id = { - .name = "path_id", - .cmd = builtin_path_id, - .help = "compose persistent device path", - .run_once = true, -}; diff --git a/udev/udev-builtin-usb_id.c b/udev/udev-builtin-usb_id.c deleted file mode 100644 index 21c3c03d8a..0000000000 --- a/udev/udev-builtin-usb_id.c +++ /dev/null @@ -1,482 +0,0 @@ -/* - * USB device properties and persistent device path - * - * Copyright (c) 2005 SUSE Linux Products GmbH, Germany - * Author: Hannes Reinecke - * - * Copyright (C) 2005-2011 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static void set_usb_iftype(char *to, int if_class_num, size_t len) -{ - char *type = "generic"; - - switch (if_class_num) { - case 1: - type = "audio"; - break; - case 2: /* CDC-Control */ - break; - case 3: - type = "hid"; - break; - case 5: /* Physical */ - break; - case 6: - type = "media"; - break; - case 7: - type = "printer"; - break; - case 8: - type = "storage"; - break; - case 9: - type = "hub"; - break; - case 0x0a: /* CDC-Data */ - break; - case 0x0b: /* Chip/Smart Card */ - break; - case 0x0d: /* Content Security */ - break; - case 0x0e: - type = "video"; - break; - case 0xdc: /* Diagnostic Device */ - break; - case 0xe0: /* Wireless Controller */ - break; - case 0xfe: /* Application-specific */ - break; - case 0xff: /* Vendor-specific */ - break; - default: - break; - } - strncpy(to, type, len); - to[len-1] = '\0'; -} - -static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len) -{ - int type_num = 0; - char *eptr; - char *type = "generic"; - - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 2: - type = "atapi"; - break; - case 3: - type = "tape"; - break; - case 4: /* UFI */ - case 5: /* SFF-8070i */ - type = "floppy"; - break; - case 1: /* RBC devices */ - type = "rbc"; - break; - case 6: /* Transparent SPC-2 devices */ - type = "scsi"; - break; - default: - break; - } - } - util_strscpy(to, len, type); - return type_num; -} - -static void set_scsi_type(char *to, const char *from, size_t len) -{ - int type_num; - char *eptr; - char *type = "generic"; - - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 0: - case 0xe: - type = "disk"; - break; - case 1: - type = "tape"; - break; - case 4: - case 7: - case 0xf: - type = "optical"; - break; - case 5: - type = "cd"; - break; - default: - break; - } - } - util_strscpy(to, len, type); -} - -#define USB_DT_DEVICE 0x01 -#define USB_DT_INTERFACE 0x04 - -static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len) -{ - char *filename = NULL; - int fd; - ssize_t size; - unsigned char buf[18 + 65535]; - unsigned int pos, strpos; - struct usb_interface_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int8_t bInterfaceNumber; - u_int8_t bAlternateSetting; - u_int8_t bNumEndpoints; - u_int8_t bInterfaceClass; - u_int8_t bInterfaceSubClass; - u_int8_t bInterfaceProtocol; - u_int8_t iInterface; - } __attribute__((packed)); - int err = 0; - - if (asprintf(&filename, "%s/descriptors", udev_device_get_syspath(dev)) < 0) { - err = -1; - goto out; - } - fd = open(filename, O_RDONLY|O_CLOEXEC); - if (fd < 0) { - fprintf(stderr, "error opening USB device 'descriptors' file\n"); - err = -1; - goto out; - } - size = read(fd, buf, sizeof(buf)); - close(fd); - if (size < 18 || size == sizeof(buf)) { - err = -1; - goto out; - } - - pos = 0; - strpos = 0; - ifs_str[0] = '\0'; - while (pos < sizeof(buf) && strpos+7 < len-2) { - struct usb_interface_descriptor *desc; - char if_str[8]; - - desc = (struct usb_interface_descriptor *) &buf[pos]; - if (desc->bLength < 3) - break; - pos += desc->bLength; - - if (desc->bDescriptorType != USB_DT_INTERFACE) - continue; - - if (snprintf(if_str, 8, ":%02x%02x%02x", - desc->bInterfaceClass, - desc->bInterfaceSubClass, - desc->bInterfaceProtocol) != 7) - continue; - - if (strstr(ifs_str, if_str) != NULL) - continue; - - memcpy(&ifs_str[strpos], if_str, 8), - strpos += 7; - } - if (strpos > 0) { - ifs_str[strpos++] = ':'; - ifs_str[strpos++] = '\0'; - } -out: - free(filename); - return err; -} - -/* - * A unique USB identification is generated like this: - * - * 1.) Get the USB device type from InterfaceClass and InterfaceSubClass - * 2.) If the device type is 'Mass-Storage/SPC-2' or 'Mass-Storage/RBC' - * use the SCSI vendor and model as USB-Vendor and USB-model. - * 3.) Otherwise use the USB manufacturer and product as - * USB-Vendor and USB-model. Any non-printable characters - * in those strings will be skipped; a slash '/' will be converted - * into a full stop '.'. - * 4.) If that fails, too, we will use idVendor and idProduct - * as USB-Vendor and USB-model. - * 5.) The USB identification is the USB-vendor and USB-model - * string concatenated with an underscore '_'. - * 6.) If the device supplies a serial number, this number - * is concatenated with the identification with an underscore '_'. - */ -static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool test) -{ - char vendor_str[64]; - char vendor_str_enc[256]; - const char *vendor_id; - char model_str[64]; - char model_str_enc[256]; - const char *product_id; - char serial_str[UTIL_NAME_SIZE]; - char packed_if_str[UTIL_NAME_SIZE]; - char revision_str[64]; - char type_str[64]; - char instance_str[64]; - const char *ifnum = NULL; - const char *driver = NULL; - char serial[256]; - - struct udev *udev = udev_device_get_udev(dev); - struct udev_device *dev_interface = NULL; - struct udev_device *dev_usb = NULL; - const char *if_class, *if_subclass; - int if_class_num; - int protocol = 0; - size_t l; - char *s; - - vendor_str[0] = '\0'; - model_str[0] = '\0'; - serial_str[0] = '\0'; - packed_if_str[0] = '\0'; - revision_str[0] = '\0'; - type_str[0] = '\0'; - instance_str[0] = '\0'; - - dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); - - /* shortcut, if we are called directly for a "usb_device" type */ - if (udev_device_get_devtype(dev) != NULL && strcmp(udev_device_get_devtype(dev), "usb_device") == 0) { - dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str)); - dev_usb = dev; - goto fallback; - } - - /* usb interface directory */ - dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface"); - if (dev_interface == NULL) { - info(udev, "unable to access usb_interface device of '%s'\n", - udev_device_get_syspath(dev)); - return EXIT_FAILURE; - } - - ifnum = udev_device_get_sysattr_value(dev_interface, "bInterfaceNumber"); - driver = udev_device_get_sysattr_value(dev_interface, "driver"); - - if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass"); - if (!if_class) { - info(udev, "%s: cannot get bInterfaceClass attribute\n", - udev_device_get_sysname(dev)); - return EXIT_FAILURE; - } - - if_class_num = strtoul(if_class, NULL, 16); - if (if_class_num == 8) { - /* mass storage */ - if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass"); - if (if_subclass != NULL) - protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); - } else { - set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1); - } - - info(udev, "%s: if_class %d protocol %d\n", - udev_device_get_syspath(dev_interface), if_class_num, protocol); - - /* usb device directory */ - dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", "usb_device"); - if (!dev_usb) { - info(udev, "unable to find parent 'usb' device of '%s'\n", - udev_device_get_syspath(dev)); - return EXIT_FAILURE; - } - - /* all interfaces of the device in a single string */ - dev_if_packed_info(dev_usb, packed_if_str, sizeof(packed_if_str)); - - /* mass storage : SCSI or ATAPI */ - if ((protocol == 6 || protocol == 2)) { - struct udev_device *dev_scsi; - const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; - int host, bus, target, lun; - - /* get scsi device */ - dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); - if (dev_scsi == NULL) { - info(udev, "unable to find parent 'scsi' device of '%s'\n", - udev_device_get_syspath(dev)); - goto fallback; - } - if (sscanf(udev_device_get_sysname(dev_scsi), "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { - info(udev, "invalid scsi device '%s'\n", udev_device_get_sysname(dev_scsi)); - goto fallback; - } - - /* Generic SPC-2 device */ - scsi_vendor = udev_device_get_sysattr_value(dev_scsi, "vendor"); - if (!scsi_vendor) { - info(udev, "%s: cannot get SCSI vendor attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); - util_replace_chars(vendor_str, NULL); - - scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); - if (!scsi_model) { - info(udev, "%s: cannot get SCSI model attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc)); - util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); - util_replace_chars(model_str, NULL); - - scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); - if (!scsi_type) { - info(udev, "%s: cannot get SCSI type attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); - - scsi_rev = udev_device_get_sysattr_value(dev_scsi, "rev"); - if (!scsi_rev) { - info(udev, "%s: cannot get SCSI revision attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); - util_replace_chars(revision_str, NULL); - - /* - * some broken devices have the same identifiers - * for all luns, export the target:lun number - */ - sprintf(instance_str, "%d:%d", target, lun); - } - -fallback: - vendor_id = udev_device_get_sysattr_value(dev_usb, "idVendor"); - product_id = udev_device_get_sysattr_value(dev_usb, "idProduct"); - - /* fallback to USB vendor & device */ - if (vendor_str[0] == '\0') { - const char *usb_vendor = NULL; - - usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); - if (!usb_vendor) - usb_vendor = vendor_id; - if (!usb_vendor) { - info(udev, "No USB vendor information available\n"); - return EXIT_FAILURE; - } - udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); - util_replace_chars(vendor_str, NULL); - } - - if (model_str[0] == '\0') { - const char *usb_model = NULL; - - usb_model = udev_device_get_sysattr_value(dev_usb, "product"); - if (!usb_model) - usb_model = product_id; - if (!usb_model) { - dbg(udev, "No USB model information available\n"); - return EXIT_FAILURE; - } - udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); - util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); - util_replace_chars(model_str, NULL); - } - - if (revision_str[0] == '\0') { - const char *usb_rev; - - usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); - if (usb_rev) { - util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); - util_replace_chars(revision_str, NULL); - } - } - - if (serial_str[0] == '\0') { - const char *usb_serial; - - usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); - if (usb_serial) { - util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); - util_replace_chars(serial_str, NULL); - } - } - - s = serial; - l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); - if (serial_str[0] != '\0') - l = util_strpcpyl(&s, l, "_", serial_str, NULL); - - if (instance_str[0] != '\0') - util_strpcpyl(&s, l, "-", instance_str, NULL); - - udev_builtin_add_property(dev, test, "ID_VENDOR", vendor_str); - udev_builtin_add_property(dev, test, "ID_VENDOR_ENC", vendor_str_enc); - udev_builtin_add_property(dev, test, "ID_VENDOR_ID", vendor_id); - udev_builtin_add_property(dev, test, "ID_MODEL", model_str); - udev_builtin_add_property(dev, test, "ID_MODEL_ENC", model_str_enc); - udev_builtin_add_property(dev, test, "ID_MODEL_ID", product_id); - udev_builtin_add_property(dev, test, "ID_REVISION", revision_str); - udev_builtin_add_property(dev, test, "ID_SERIAL", serial); - if (serial_str[0] != '\0') - udev_builtin_add_property(dev, test, "ID_SERIAL_SHORT", serial_str); - if (type_str[0] != '\0') - udev_builtin_add_property(dev, test, "ID_TYPE", type_str); - if (instance_str[0] != '\0') - udev_builtin_add_property(dev, test, "ID_INSTANCE", instance_str); - udev_builtin_add_property(dev, test, "ID_BUS", "usb"); - if (packed_if_str[0] != '\0') - udev_builtin_add_property(dev, test, "ID_USB_INTERFACES", packed_if_str); - if (ifnum != NULL) - udev_builtin_add_property(dev, test, "ID_USB_INTERFACE_NUM", ifnum); - if (driver != NULL) - udev_builtin_add_property(dev, test, "ID_USB_DRIVER", driver); - return EXIT_SUCCESS; -} - -const struct udev_builtin udev_builtin_usb_id = { - .name = "usb_id", - .cmd = builtin_usb_id, - .help = "usb device properties", - .run_once = true, -}; diff --git a/udev/udev-builtin.c b/udev/udev-builtin.c deleted file mode 100644 index 8beac8a678..0000000000 --- a/udev/udev-builtin.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (C) 2007-2009 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static const struct udev_builtin *builtins[] = { - [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, - [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, - [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, - [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, - [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, - [UDEV_BUILTIN_PCI_DB] = &udev_builtin_pci_db, - [UDEV_BUILTIN_USB_DB] = &udev_builtin_usb_db, - [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, -}; - -int udev_builtin_init(struct udev *udev) -{ - unsigned int i; - int err; - - for (i = 0; i < ARRAY_SIZE(builtins); i++) { - if (builtins[i]->init) { - err = builtins[i]->init(udev); - if (err < 0) - break; - } - } - return err; -} - -void udev_builtin_exit(struct udev *udev) -{ - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(builtins); i++) - if (builtins[i]->exit) - builtins[i]->exit(udev); -} - -bool udev_builtin_validate(struct udev *udev) -{ - unsigned int i; - bool change = false; - - for (i = 0; i < ARRAY_SIZE(builtins); i++) - if (builtins[i]->validate) - if (builtins[i]->validate(udev)) - change = true; - return change; -} - -void udev_builtin_list(struct udev *udev) -{ - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(builtins); i++) - fprintf(stderr, " %-12s %s\n", builtins[i]->name, builtins[i]->help); -} - -const char *udev_builtin_name(enum udev_builtin_cmd cmd) -{ - return builtins[cmd]->name; -} - -bool udev_builtin_run_once(enum udev_builtin_cmd cmd) -{ - return builtins[cmd]->run_once; -} - -enum udev_builtin_cmd udev_builtin_lookup(const char *command) -{ - char name[UTIL_PATH_SIZE]; - enum udev_builtin_cmd i; - char *pos; - - util_strscpy(name, sizeof(name), command); - pos = strchr(name, ' '); - if (pos) - pos[0] = '\0'; - for (i = 0; i < ARRAY_SIZE(builtins); i++) - if (strcmp(builtins[i]->name, name) == 0) - return i; - return UDEV_BUILTIN_MAX; -} - -int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) -{ - char arg[UTIL_PATH_SIZE]; - int argc; - char *argv[128]; - - optind = 0; - util_strscpy(arg, sizeof(arg), command); - udev_build_argv(udev_device_get_udev(dev), arg, &argc, argv); - return builtins[cmd]->cmd(dev, argc, argv, test); -} - -int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val) -{ - struct udev_list_entry *entry; - - entry = udev_device_add_property(dev, key, val); - /* store in db, skip private keys */ - if (key[0] != '.') - udev_list_entry_set_num(entry, true); - - info(udev_device_get_udev(dev), "%s=%s\n", key, val); - if (test) - printf("%s=%s\n", key, val); - return 0; -} diff --git a/udev/udev-ctrl.c b/udev/udev-ctrl.c deleted file mode 100644 index fab1108de0..0000000000 --- a/udev/udev-ctrl.c +++ /dev/null @@ -1,494 +0,0 @@ -/* - * libudev - interface to udev device information - * - * Copyright (C) 2008 Kay Sievers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -/* wire protocol magic must match */ -#define UDEV_CTRL_MAGIC 0xdead1dea - -enum udev_ctrl_msg_type { - UDEV_CTRL_UNKNOWN, - UDEV_CTRL_SET_LOG_LEVEL, - UDEV_CTRL_STOP_EXEC_QUEUE, - UDEV_CTRL_START_EXEC_QUEUE, - UDEV_CTRL_RELOAD, - UDEV_CTRL_SET_ENV, - UDEV_CTRL_SET_CHILDREN_MAX, - UDEV_CTRL_PING, - UDEV_CTRL_EXIT, -}; - -struct udev_ctrl_msg_wire { - char version[16]; - unsigned int magic; - enum udev_ctrl_msg_type type; - union { - int intval; - char buf[256]; - }; -}; - -struct udev_ctrl_msg { - int refcount; - struct udev_ctrl_connection *conn; - struct udev_ctrl_msg_wire ctrl_msg_wire; -}; - -struct udev_ctrl { - int refcount; - struct udev *udev; - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; - bool bound; - bool cleanup_socket; - bool connected; -}; - -struct udev_ctrl_connection { - int refcount; - struct udev_ctrl *uctrl; - int sock; -}; - -struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) -{ - struct udev_ctrl *uctrl; - - uctrl = calloc(1, sizeof(struct udev_ctrl)); - if (uctrl == NULL) - return NULL; - uctrl->refcount = 1; - uctrl->udev = udev; - - if (fd < 0) { - uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); - if (uctrl->sock < 0) { - err(udev, "error getting socket: %m\n"); - udev_ctrl_unref(uctrl); - return NULL; - } - } else { - uctrl->bound = true; - uctrl->sock = fd; - } - - uctrl->saddr.sun_family = AF_LOCAL; - util_strscpyl(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), - udev_get_run_path(udev), "/control", NULL); - uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); - return uctrl; -} - -struct udev_ctrl *udev_ctrl_new(struct udev *udev) -{ - return udev_ctrl_new_from_fd(udev, -1); -} - -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) -{ - int err; - - if (!uctrl->bound) { - err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err < 0 && errno == EADDRINUSE) { - unlink(uctrl->saddr.sun_path); - err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - } - - if (err < 0) { - err = -errno; - err(uctrl->udev, "bind failed: %m\n"); - return err; - } - - err = listen(uctrl->sock, 0); - if (err < 0) { - err = -errno; - err(uctrl->udev, "listen failed: %m\n"); - return err; - } - - uctrl->bound = true; - uctrl->cleanup_socket = true; - } - return 0; -} - -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) -{ - return uctrl->udev; -} - -struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return NULL; - uctrl->refcount++; - return uctrl; -} - -struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return NULL; - uctrl->refcount--; - if (uctrl->refcount > 0) - return uctrl; - if (uctrl->sock >= 0) - close(uctrl->sock); - free(uctrl); - return NULL; -} - -int udev_ctrl_cleanup(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return 0; - if (uctrl->cleanup_socket) - unlink(uctrl->saddr.sun_path); - return 0; -} - -int udev_ctrl_get_fd(struct udev_ctrl *uctrl) -{ - if (uctrl == NULL) - return -EINVAL; - return uctrl->sock; -} - -struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) -{ - struct udev_ctrl_connection *conn; - struct ucred ucred; - socklen_t slen; - const int on = 1; - - conn = calloc(1, sizeof(struct udev_ctrl_connection)); - if (conn == NULL) - return NULL; - conn->refcount = 1; - conn->uctrl = uctrl; - - conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); - if (conn->sock < 0) { - if (errno != EINTR) - err(uctrl->udev, "unable to receive ctrl connection: %m\n"); - goto err; - } - - /* check peer credential of connection */ - slen = sizeof(ucred); - if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) { - err(uctrl->udev, "unable to receive credentials of ctrl connection: %m\n"); - goto err; - } - if (ucred.uid > 0) { - err(uctrl->udev, "sender uid=%i, message ignored\n", ucred.uid); - goto err; - } - - /* enable receiving of the sender credentials in the messages */ - setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - udev_ctrl_ref(uctrl); - return conn; -err: - if (conn->sock >= 0) - close(conn->sock); - free(conn); - return NULL; -} - -struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) -{ - if (conn == NULL) - return NULL; - conn->refcount++; - return conn; -} - -struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) -{ - if (conn == NULL) - return NULL; - conn->refcount--; - if (conn->refcount > 0) - return conn; - if (conn->sock >= 0) - close(conn->sock); - udev_ctrl_unref(conn->uctrl); - free(conn); - return NULL; -} - -static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) -{ - struct udev_ctrl_msg_wire ctrl_msg_wire; - int err = 0; - - memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); - strcpy(ctrl_msg_wire.version, "udev-" VERSION); - ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; - ctrl_msg_wire.type = type; - - if (buf != NULL) - util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); - else - ctrl_msg_wire.intval = intval; - - if (!uctrl->connected) { - if (connect(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen) < 0) { - err = -errno; - goto out; - } - uctrl->connected = true; - } - if (send(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0) < 0) { - err = -errno; - goto out; - } - - /* wait for peer message handling or disconnect */ - for (;;) { - struct pollfd pfd[1]; - int r; - - pfd[0].fd = uctrl->sock; - pfd[0].events = POLLIN; - r = poll(pfd, 1, timeout * 1000); - if (r < 0) { - if (errno == EINTR) - continue; - err = -errno; - break; - } - - if (r > 0 && pfd[0].revents & POLLERR) { - err = -EIO; - break; - } - - if (r == 0) - err = -ETIMEDOUT; - break; - } -out: - return err; -} - -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); -} - -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); -} - -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); -} - -int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_RELOAD, 0, NULL, timeout); -} - -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); -} - -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); -} - -int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); -} - -int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) -{ - return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); -} - -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) -{ - struct udev *udev = conn->uctrl->udev; - struct udev_ctrl_msg *uctrl_msg; - ssize_t size; - struct msghdr smsg; - struct cmsghdr *cmsg; - struct iovec iov; - struct ucred *cred; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - - uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); - if (uctrl_msg == NULL) - return NULL; - uctrl_msg->refcount = 1; - uctrl_msg->conn = conn; - udev_ctrl_connection_ref(conn); - - /* wait for the incoming message */ - for(;;) { - struct pollfd pfd[1]; - int r; - - pfd[0].fd = conn->sock; - pfd[0].events = POLLIN; - - r = poll(pfd, 1, 10000); - if (r < 0) { - if (errno == EINTR) - continue; - goto err; - } else if (r == 0) { - err(udev, "timeout waiting for ctrl message\n"); - goto err; - } else { - if (!(pfd[0].revents & POLLIN)) { - err(udev, "ctrl connection error: %m\n"); - goto err; - } - } - - break; - } - - iov.iov_base = &uctrl_msg->ctrl_msg_wire; - iov.iov_len = sizeof(struct udev_ctrl_msg_wire); - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - size = recvmsg(conn->sock, &smsg, 0); - if (size < 0) { - err(udev, "unable to receive ctrl message: %m\n"); - goto err; - } - cmsg = CMSG_FIRSTHDR(&smsg); - cred = (struct ucred *) CMSG_DATA(cmsg); - - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err(udev, "no sender credentials received, message ignored\n"); - goto err; - } - - if (cred->uid != 0) { - err(udev, "sender uid=%i, message ignored\n", cred->uid); - goto err; - } - - if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { - err(udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); - goto err; - } - - dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); - return uctrl_msg; -err: - udev_ctrl_msg_unref(uctrl_msg); - return NULL; -} - -struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg == NULL) - return NULL; - ctrl_msg->refcount++; - return ctrl_msg; -} - -struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg == NULL) - return NULL; - ctrl_msg->refcount--; - if (ctrl_msg->refcount > 0) - return ctrl_msg; - dbg(ctrl_msg->conn->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); - udev_ctrl_connection_unref(ctrl_msg->conn); - free(ctrl_msg); - return NULL; -} - -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; -} - -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) - return 1; - return -1; -} - -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) - return 1; - return -1; -} - -int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD) - return 1; - return -1; -} - -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) - return ctrl_msg->ctrl_msg_wire.buf; - return NULL; -} - -int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; -} - -int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) - return 1; - return -1; -} - -int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) -{ - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) - return 1; - return -1; -} diff --git a/udev/udev-event.c b/udev/udev-event.c deleted file mode 100644 index 859d811bff..0000000000 --- a/udev/udev-event.c +++ /dev/null @@ -1,1005 +0,0 @@ -/* - * Copyright (C) 2003-2010 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -struct udev_event *udev_event_new(struct udev_device *dev) -{ - struct udev *udev = udev_device_get_udev(dev); - struct udev_event *event; - - event = calloc(1, sizeof(struct udev_event)); - if (event == NULL) - return NULL; - event->dev = dev; - event->udev = udev; - udev_list_init(udev, &event->run_list, false); - event->fd_signal = -1; - event->birth_usec = now_usec(); - event->timeout_usec = 60 * 1000 * 1000; - dbg(event->udev, "allocated event %p\n", event); - return event; -} - -void udev_event_unref(struct udev_event *event) -{ - if (event == NULL) - return; - udev_list_cleanup(&event->run_list); - free(event->program_result); - free(event->name); - dbg(event->udev, "free event %p\n", event); - free(event); -} - -size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size) -{ - struct udev_device *dev = event->dev; - enum subst_type { - SUBST_UNKNOWN, - SUBST_DEVNODE, - SUBST_ATTR, - SUBST_ENV, - SUBST_KERNEL, - SUBST_KERNEL_NUMBER, - SUBST_DRIVER, - SUBST_DEVPATH, - SUBST_ID, - SUBST_MAJOR, - SUBST_MINOR, - SUBST_RESULT, - SUBST_PARENT, - SUBST_NAME, - SUBST_LINKS, - SUBST_ROOT, - SUBST_SYS, - }; - static const struct subst_map { - char *name; - char fmt; - enum subst_type type; - } map[] = { - { .name = "devnode", .fmt = 'N', .type = SUBST_DEVNODE }, - { .name = "tempnode", .fmt = 'N', .type = SUBST_DEVNODE }, - { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, - { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, - { .name = "env", .fmt = 'E', .type = SUBST_ENV }, - { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, - { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, - { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, - { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, - { .name = "id", .fmt = 'b', .type = SUBST_ID }, - { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, - { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, - { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, - { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, - { .name = "name", .fmt = 'D', .type = SUBST_NAME }, - { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, - { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, - { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, - }; - const char *from; - char *s; - size_t l; - - from = src; - s = dest; - l = size; - - for (;;) { - enum subst_type type = SUBST_UNKNOWN; - char attrbuf[UTIL_PATH_SIZE]; - char *attr = NULL; - - while (from[0] != '\0') { - if (from[0] == '$') { - /* substitute named variable */ - unsigned int i; - - if (from[1] == '$') { - from++; - goto copy; - } - - for (i = 0; i < ARRAY_SIZE(map); i++) { - if (strncmp(&from[1], map[i].name, strlen(map[i].name)) == 0) { - type = map[i].type; - from += strlen(map[i].name)+1; - dbg(event->udev, "will substitute format name '%s'\n", map[i].name); - goto subst; - } - } - } else if (from[0] == '%') { - /* substitute format char */ - unsigned int i; - - if (from[1] == '%') { - from++; - goto copy; - } - - for (i = 0; i < ARRAY_SIZE(map); i++) { - if (from[1] == map[i].fmt) { - type = map[i].type; - from += 2; - dbg(event->udev, "will substitute format char '%c'\n", map[i].fmt); - goto subst; - } - } - } -copy: - /* copy char */ - if (l == 0) - goto out; - s[0] = from[0]; - from++; - s++; - l--; - } - - goto out; -subst: - /* extract possible $format{attr} */ - if (from[0] == '{') { - unsigned int i; - - from++; - for (i = 0; from[i] != '}'; i++) { - if (from[i] == '\0') { - err(event->udev, "missing closing brace for format '%s'\n", src); - goto out; - } - } - if (i >= sizeof(attrbuf)) - goto out; - memcpy(attrbuf, from, i); - attrbuf[i] = '\0'; - from += i+1; - attr = attrbuf; - } else { - attr = NULL; - } - - switch (type) { - case SUBST_DEVPATH: - l = util_strpcpy(&s, l, udev_device_get_devpath(dev)); - dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); - break; - case SUBST_KERNEL: - l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); - dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); - break; - case SUBST_KERNEL_NUMBER: - if (udev_device_get_sysnum(dev) == NULL) - break; - l = util_strpcpy(&s, l, udev_device_get_sysnum(dev)); - dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); - break; - case SUBST_ID: - if (event->dev_parent == NULL) - break; - l = util_strpcpy(&s, l, udev_device_get_sysname(event->dev_parent)); - dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); - break; - case SUBST_DRIVER: { - const char *driver; - - if (event->dev_parent == NULL) - break; - - driver = udev_device_get_driver(event->dev_parent); - if (driver == NULL) - break; - l = util_strpcpy(&s, l, driver); - dbg(event->udev, "substitute driver '%s'\n", driver); - break; - } - case SUBST_MAJOR: { - char num[UTIL_PATH_SIZE]; - - sprintf(num, "%d", major(udev_device_get_devnum(dev))); - l = util_strpcpy(&s, l, num); - dbg(event->udev, "substitute major number '%s'\n", num); - break; - } - case SUBST_MINOR: { - char num[UTIL_PATH_SIZE]; - - sprintf(num, "%d", minor(udev_device_get_devnum(dev))); - l = util_strpcpy(&s, l, num); - dbg(event->udev, "substitute minor number '%s'\n", num); - break; - } - case SUBST_RESULT: { - char *rest; - int i; - - if (event->program_result == NULL) - break; - /* get part part of the result string */ - i = 0; - if (attr != NULL) - i = strtoul(attr, &rest, 10); - if (i > 0) { - char result[UTIL_PATH_SIZE]; - char tmp[UTIL_PATH_SIZE]; - char *cpos; - - dbg(event->udev, "request part #%d of result string\n", i); - util_strscpy(result, sizeof(result), event->program_result); - cpos = result; - while (--i) { - while (cpos[0] != '\0' && !isspace(cpos[0])) - cpos++; - while (isspace(cpos[0])) - cpos++; - } - if (i > 0) { - err(event->udev, "requested part of result string not found\n"); - break; - } - util_strscpy(tmp, sizeof(tmp), cpos); - /* %{2+}c copies the whole string from the second part on */ - if (rest[0] != '+') { - cpos = strchr(tmp, ' '); - if (cpos) - cpos[0] = '\0'; - } - l = util_strpcpy(&s, l, tmp); - dbg(event->udev, "substitute part of result string '%s'\n", tmp); - } else { - l = util_strpcpy(&s, l, event->program_result); - dbg(event->udev, "substitute result string '%s'\n", event->program_result); - } - break; - } - case SUBST_ATTR: { - const char *value = NULL; - char vbuf[UTIL_NAME_SIZE]; - size_t len; - int count; - - if (attr == NULL) { - err(event->udev, "missing file parameter for attr\n"); - break; - } - - /* try to read the value specified by "[dmi/id]product_name" */ - if (util_resolve_subsys_kernel(event->udev, attr, vbuf, sizeof(vbuf), 1) == 0) - value = vbuf; - - /* try to read the attribute the device */ - if (value == NULL) - value = udev_device_get_sysattr_value(event->dev, attr); - - /* try to read the attribute of the parent device, other matches have selected */ - if (value == NULL && event->dev_parent != NULL && event->dev_parent != event->dev) - value = udev_device_get_sysattr_value(event->dev_parent, attr); - - if (value == NULL) - break; - - /* strip trailing whitespace, and replace unwanted characters */ - if (value != vbuf) - util_strscpy(vbuf, sizeof(vbuf), value); - len = strlen(vbuf); - while (len > 0 && isspace(vbuf[--len])) - vbuf[len] = '\0'; - count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - l = util_strpcpy(&s, l, vbuf); - dbg(event->udev, "substitute sysfs value '%s'\n", vbuf); - break; - } - case SUBST_PARENT: { - struct udev_device *dev_parent; - const char *devnode; - - dev_parent = udev_device_get_parent(event->dev); - if (dev_parent == NULL) - break; - devnode = udev_device_get_devnode(dev_parent); - if (devnode != NULL) { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - - l = util_strpcpy(&s, l, &devnode[devlen]); - dbg(event->udev, "found parent '%s', got node name '%s'\n", - udev_device_get_syspath(dev_parent), &devnode[devlen]); - } - break; - } - case SUBST_DEVNODE: - if (udev_device_get_devnode(dev) != NULL) - l = util_strpcpy(&s, l, udev_device_get_devnode(dev)); - break; - case SUBST_NAME: - if (event->name != NULL) { - l = util_strpcpy(&s, l, event->name); - dbg(event->udev, "substitute name '%s'\n", event->name); - } else { - l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); - dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); - } - break; - case SUBST_LINKS: { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - struct udev_list_entry *list_entry; - - list_entry = udev_device_get_devlinks_list_entry(dev); - if (list_entry == NULL) - break; - l = util_strpcpy(&s, l, &udev_list_entry_get_name(list_entry)[devlen]); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) - l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); - break; - } - case SUBST_ROOT: - l = util_strpcpy(&s, l, udev_get_dev_path(event->udev)); - dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); - break; - case SUBST_SYS: - l = util_strpcpy(&s, l, udev_get_sys_path(event->udev)); - dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); - break; - case SUBST_ENV: - if (attr == NULL) { - dbg(event->udev, "missing attribute\n"); - break; - } else { - const char *value; - - value = udev_device_get_property_value(event->dev, attr); - if (value == NULL) - break; - dbg(event->udev, "substitute env '%s=%s'\n", attr, value); - l = util_strpcpy(&s, l, value); - break; - } - default: - err(event->udev, "unknown substitution type=%i\n", type); - break; - } - } - -out: - s[0] = '\0'; - dbg(event->udev, "'%s' -> '%s' (%zu)\n", src, dest, l); - return l; -} - -static int spawn_exec(struct udev_event *event, - const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask, - int fd_stdout, int fd_stderr) -{ - struct udev *udev = event->udev; - int err; - int fd; - - /* discard child output or connect to pipe */ - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDIN_FILENO); - if (fd_stdout < 0) - dup2(fd, STDOUT_FILENO); - if (fd_stderr < 0) - dup2(fd, STDERR_FILENO); - close(fd); - } else { - err(udev, "open /dev/null failed: %m\n"); - } - - /* connect pipes to std{out,err} */ - if (fd_stdout >= 0) { - dup2(fd_stdout, STDOUT_FILENO); - close(fd_stdout); - } - if (fd_stderr >= 0) { - dup2(fd_stderr, STDERR_FILENO); - close(fd_stderr); - } - - /* terminate child in case parent goes away */ - prctl(PR_SET_PDEATHSIG, SIGTERM); - - /* restore original udev sigmask before exec */ - if (sigmask) - sigprocmask(SIG_SETMASK, sigmask, NULL); - - execve(argv[0], argv, envp); - - /* exec failed */ - err = -errno; - err(udev, "failed to execute '%s' '%s': %m\n", argv[0], cmd); - return err; -} - -static void spawn_read(struct udev_event *event, - const char *cmd, - int fd_stdout, int fd_stderr, - char *result, size_t ressize) -{ - struct udev *udev = event->udev; - size_t respos = 0; - int fd_ep = -1; - struct epoll_event ep_outpipe, ep_errpipe; - - /* read from child if requested */ - if (fd_stdout < 0 && fd_stderr < 0) - return; - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - err(udev, "error creating epoll fd: %m\n"); - goto out; - } - - if (fd_stdout >= 0) { - memset(&ep_outpipe, 0, sizeof(struct epoll_event)); - ep_outpipe.events = EPOLLIN; - ep_outpipe.data.ptr = &fd_stdout; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - } - - if (fd_stderr >= 0) { - memset(&ep_errpipe, 0, sizeof(struct epoll_event)); - ep_errpipe.events = EPOLLIN; - ep_errpipe.data.ptr = &fd_stderr; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - } - - /* read child output */ - while (fd_stdout >= 0 || fd_stderr >= 0) { - int timeout; - int fdcount; - struct epoll_event ev[4]; - int i; - - if (event->timeout_usec > 0) { - unsigned long long age_usec; - - age_usec = now_usec() - event->birth_usec; - if (age_usec >= event->timeout_usec) { - err(udev, "timeout '%s'\n", cmd); - goto out; - } - timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; - } else { - timeout = -1; - } - - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err(udev, "failed to poll: %m\n"); - goto out; - } - if (fdcount == 0) { - err(udev, "timeout '%s'\n", cmd); - goto out; - } - - for (i = 0; i < fdcount; i++) { - int *fd = (int *)ev[i].data.ptr; - - if (ev[i].events & EPOLLIN) { - ssize_t count; - char buf[4096]; - - count = read(*fd, buf, sizeof(buf)-1); - if (count <= 0) - continue; - buf[count] = '\0'; - - /* store stdout result */ - if (result != NULL && *fd == fd_stdout) { - if (respos + count < ressize) { - memcpy(&result[respos], buf, count); - respos += count; - } else { - err(udev, "'%s' ressize %zd too short\n", cmd, ressize); - } - } - - /* log debug output only if we watch stderr */ - if (fd_stderr >= 0) { - char *pos; - char *line; - - pos = buf; - while ((line = strsep(&pos, "\n"))) { - if (pos != NULL || line[0] != '\0') - info(udev, "'%s'(%s) '%s'\n", cmd, *fd == fd_stdout ? "out" : "err" , line); - } - } - } else if (ev[i].events & EPOLLHUP) { - if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) { - err(udev, "failed to remove fd from epoll: %m\n"); - goto out; - } - *fd = -1; - } - } - } - - /* return the child's stdout string */ - if (result != NULL) { - result[respos] = '\0'; - dbg(udev, "result='%s'\n", result); - } -out: - if (fd_ep >= 0) - close(fd_ep); -} - -static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) -{ - struct udev *udev = event->udev; - struct pollfd pfd[1]; - int err = 0; - - pfd[0].events = POLLIN; - pfd[0].fd = event->fd_signal; - - while (pid > 0) { - int timeout; - int fdcount; - - if (event->timeout_usec > 0) { - unsigned long long age_usec; - - age_usec = now_usec() - event->birth_usec; - if (age_usec >= event->timeout_usec) - timeout = 1000; - else - timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; - } else { - timeout = -1; - } - - fdcount = poll(pfd, 1, timeout); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err = -errno; - err(udev, "failed to poll: %m\n"); - goto out; - } - if (fdcount == 0) { - err(udev, "timeout: killing '%s' [%u]\n", cmd, pid); - kill(pid, SIGKILL); - } - - if (pfd[0].revents & POLLIN) { - struct signalfd_siginfo fdsi; - int status; - ssize_t size; - - size = read(event->fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); - if (size != sizeof(struct signalfd_siginfo)) - continue; - - switch (fdsi.ssi_signo) { - case SIGTERM: - event->sigterm = true; - break; - case SIGCHLD: - if (waitpid(pid, &status, WNOHANG) < 0) - break; - if (WIFEXITED(status)) { - info(udev, "'%s' [%u] exit with return code %i\n", cmd, pid, WEXITSTATUS(status)); - if (WEXITSTATUS(status) != 0) - err = -1; - } else if (WIFSIGNALED(status)) { - err(udev, "'%s' [%u] terminated by signal %i (%s)\n", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status))); - err = -1; - } else if (WIFSTOPPED(status)) { - err(udev, "'%s' [%u] stopped\n", cmd, pid); - err = -1; - } else if (WIFCONTINUED(status)) { - err(udev, "'%s' [%u] continued\n", cmd, pid); - err = -1; - } else { - err(udev, "'%s' [%u] exit with status 0x%04x\n", cmd, pid, status); - err = -1; - } - pid = 0; - break; - } - } - } -out: - return err; -} - -int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]) -{ - int i = 0; - char *pos; - - if (strchr(cmd, ' ') == NULL) { - argv[i++] = cmd; - goto out; - } - - pos = cmd; - while (pos != NULL && pos[0] != '\0') { - if (pos[0] == '\'') { - /* do not separate quotes */ - pos++; - argv[i] = strsep(&pos, "\'"); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } - dbg(udev, "argv[%i] '%s'\n", i, argv[i]); - i++; - } -out: - argv[i] = NULL; - if (argc) - *argc = i; - return 0; -} - -int udev_event_spawn(struct udev_event *event, - const char *cmd, char **envp, const sigset_t *sigmask, - char *result, size_t ressize) -{ - struct udev *udev = event->udev; - int outpipe[2] = {-1, -1}; - int errpipe[2] = {-1, -1}; - pid_t pid; - char arg[UTIL_PATH_SIZE]; - char *argv[128]; - char program[UTIL_PATH_SIZE]; - int err = 0; - - util_strscpy(arg, sizeof(arg), cmd); - udev_build_argv(event->udev, arg, NULL, argv); - - /* pipes from child to parent */ - if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe2(outpipe, O_NONBLOCK) != 0) { - err = -errno; - err(udev, "pipe failed: %m\n"); - goto out; - } - } - if (udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe2(errpipe, O_NONBLOCK) != 0) { - err = -errno; - err(udev, "pipe failed: %m\n"); - goto out; - } - } - - /* allow programs in /usr/lib/udev/ to be called without the path */ - if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), PKGLIBEXECDIR "/", argv[0], NULL); - argv[0] = program; - } - - pid = fork(); - switch(pid) { - case 0: - /* child closes parent's ends of pipes */ - if (outpipe[READ_END] >= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - } - if (errpipe[READ_END] >= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - } - - info(udev, "starting '%s'\n", cmd); - - err = spawn_exec(event, cmd, argv, envp, sigmask, - outpipe[WRITE_END], errpipe[WRITE_END]); - - _exit(2 ); - case -1: - err(udev, "fork of '%s' failed: %m\n", cmd); - err = -1; - goto out; - default: - /* parent closed child's ends of pipes */ - if (outpipe[WRITE_END] >= 0) { - close(outpipe[WRITE_END]); - outpipe[WRITE_END] = -1; - } - if (errpipe[WRITE_END] >= 0) { - close(errpipe[WRITE_END]); - errpipe[WRITE_END] = -1; - } - - spawn_read(event, cmd, - outpipe[READ_END], errpipe[READ_END], - result, ressize); - - err = spawn_wait(event, cmd, pid); - } - -out: - if (outpipe[READ_END] >= 0) - close(outpipe[READ_END]); - if (outpipe[WRITE_END] >= 0) - close(outpipe[WRITE_END]); - if (errpipe[READ_END] >= 0) - close(errpipe[READ_END]); - if (errpipe[WRITE_END] >= 0) - close(errpipe[WRITE_END]); - return err; -} - -static void rename_netif_kernel_log(struct ifreq ifr) -{ - int klog; - FILE *f; - - klog = open("/dev/kmsg", O_WRONLY); - if (klog < 0) - return; - - f = fdopen(klog, "w"); - if (f == NULL) { - close(klog); - return; - } - - fprintf(f, "<30>udevd[%u]: renamed network interface %s to %s\n", - getpid(), ifr.ifr_name, ifr.ifr_newname); - fclose(f); -} - -static int rename_netif(struct udev_event *event) -{ - struct udev_device *dev = event->dev; - int sk; - struct ifreq ifr; - int loop; - int err; - - info(event->udev, "changing net interface name from '%s' to '%s'\n", - udev_device_get_sysname(dev), event->name); - - sk = socket(PF_INET, SOCK_DGRAM, 0); - if (sk < 0) { - err = -errno; - err(event->udev, "error opening socket: %m\n"); - return err; - } - - memset(&ifr, 0x00, sizeof(struct ifreq)); - util_strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev)); - util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err == 0) { - rename_netif_kernel_log(ifr); - goto out; - } - - /* keep trying if the destination interface name already exists */ - err = -errno; - if (err != -EEXIST) - goto out; - - /* free our own name, another process may wait for us */ - snprintf(ifr.ifr_newname, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev)); - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err < 0) { - err = -errno; - goto out; - } - - /* log temporary name */ - rename_netif_kernel_log(ifr); - - /* wait a maximum of 90 seconds for our target to become available */ - util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); - util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); - loop = 90 * 20; - while (loop--) { - const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; - - dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", - event->name, (90 * 20) - loop); - nanosleep(&duration, NULL); - - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err == 0) { - rename_netif_kernel_log(ifr); - break; - } - err = -errno; - if (err != -EEXIST) - break; - } - -out: - if (err < 0) - err(event->udev, "error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); - close(sk); - return err; -} - -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) -{ - struct udev_device *dev = event->dev; - int err = 0; - - if (udev_device_get_subsystem(dev) == NULL) - return -1; - - if (strcmp(udev_device_get_action(dev), "remove") == 0) { - udev_device_read_db(dev, NULL); - udev_device_delete_db(dev); - udev_device_tag_index(dev, NULL, false); - - if (major(udev_device_get_devnum(dev)) != 0) - udev_watch_end(event->udev, dev); - - udev_rules_apply_to_event(rules, event, sigmask); - - if (major(udev_device_get_devnum(dev)) != 0) - err = udev_node_remove(dev); - } else { - event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); - if (event->dev_db != NULL) { - udev_device_read_db(event->dev_db, NULL); - udev_device_set_info_loaded(event->dev_db); - - /* disable watch during event processing */ - if (major(udev_device_get_devnum(dev)) != 0) - udev_watch_end(event->udev, event->dev_db); - } - - udev_rules_apply_to_event(rules, event, sigmask); - - /* rename a new network interface, if needed */ - if (udev_device_get_ifindex(dev) > 0 && strcmp(udev_device_get_action(dev), "add") == 0 && - event->name != NULL && strcmp(event->name, udev_device_get_sysname(dev)) != 0) { - char syspath[UTIL_PATH_SIZE]; - char *pos; - - err = rename_netif(event); - if (err == 0) { - info(event->udev, "renamed netif to '%s'\n", event->name); - - /* remember old name */ - udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); - - /* now change the devpath, because the kernel device name has changed */ - util_strscpy(syspath, sizeof(syspath), udev_device_get_syspath(dev)); - pos = strrchr(syspath, '/'); - if (pos != NULL) { - pos++; - util_strscpy(pos, sizeof(syspath) - (pos - syspath), event->name); - udev_device_set_syspath(event->dev, syspath); - udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); - info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); - } - } - } - - if (major(udev_device_get_devnum(dev)) != 0) { - /* remove/update possible left-over symlinks from old database entry */ - if (event->dev_db != NULL) - udev_node_update_old_links(dev, event->dev_db); - - if (!event->mode_set) { - if (udev_device_get_devnode_mode(dev) > 0) { - /* kernel supplied value */ - event->mode = udev_device_get_devnode_mode(dev); - } else if (event->gid > 0) { - /* default 0660 if a group is assigned */ - event->mode = 0660; - } else { - /* default 0600 */ - event->mode = 0600; - } - } - - err = udev_node_add(dev, event->mode, event->uid, event->gid); - } - - /* preserve old, or get new initialization timestamp */ - if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0) - udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db)); - else if (udev_device_get_usec_initialized(event->dev) == 0) - udev_device_set_usec_initialized(event->dev, now_usec()); - - /* (re)write database file */ - udev_device_update_db(dev); - udev_device_tag_index(dev, event->dev_db, true); - udev_device_set_is_initialized(dev); - - udev_device_unref(event->dev_db); - event->dev_db = NULL; - } -out: - return err; -} - -int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) -{ - struct udev_list_entry *list_entry; - int err = 0; - - dbg(event->udev, "executing run list\n"); - udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { - const char *cmd = udev_list_entry_get_name(list_entry); - - if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { - struct udev_monitor *monitor; - - monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); - if (monitor == NULL) - continue; - udev_monitor_send_device(monitor, NULL, event->dev); - udev_monitor_unref(monitor); - } else { - char program[UTIL_PATH_SIZE]; - char **envp; - - if (event->exec_delay > 0) { - info(event->udev, "delay execution of '%s'\n", program); - sleep(event->exec_delay); - } - - udev_event_apply_format(event, cmd, program, sizeof(program)); - envp = udev_device_get_properties_envp(event->dev); - if (udev_event_spawn(event, program, envp, sigmask, NULL, 0) < 0) { - if (udev_list_entry_get_num(list_entry)) - err = -1; - } - } - } - return err; -} diff --git a/udev/udev-node.c b/udev/udev-node.c deleted file mode 100644 index 31046bd713..0000000000 --- a/udev/udev-node.c +++ /dev/null @@ -1,385 +0,0 @@ -/* - * Copyright (C) 2003-2010 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -#define TMP_FILE_EXT ".udev-tmp" - -static int node_symlink(struct udev *udev, const char *node, const char *slink) -{ - struct stat stats; - char target[UTIL_PATH_SIZE]; - char *s; - size_t l; - char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; - int i = 0; - int tail = 0; - int err = 0; - - /* use relative link */ - target[0] = '\0'; - while (node[i] && (node[i] == slink[i])) { - if (node[i] == '/') - tail = i+1; - i++; - } - s = target; - l = sizeof(target); - while (slink[i] != '\0') { - if (slink[i] == '/') - l = util_strpcpy(&s, l, "../"); - i++; - } - l = util_strscpy(s, l, &node[tail]); - if (l == 0) { - err = -EINVAL; - goto exit; - } - - /* preserve link with correct target, do not replace node of other device */ - if (lstat(slink, &stats) == 0) { - if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { - struct stat stats2; - - info(udev, "found existing node instead of symlink '%s'\n", slink); - if (lstat(node, &stats2) == 0) { - if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && - stats.st_rdev == stats2.st_rdev && stats.st_ino != stats2.st_ino) { - info(udev, "replace device node '%s' with symlink to our node '%s'\n", - slink, node); - } else { - err(udev, "device node '%s' already exists, " - "link to '%s' will not overwrite it\n", - slink, node); - goto exit; - } - } - } else if (S_ISLNK(stats.st_mode)) { - char buf[UTIL_PATH_SIZE]; - int len; - - dbg(udev, "found existing symlink '%s'\n", slink); - len = readlink(slink, buf, sizeof(buf)); - if (len > 0 && len < (int)sizeof(buf)) { - buf[len] = '\0'; - if (strcmp(target, buf) == 0) { - info(udev, "preserve already existing symlink '%s' to '%s'\n", - slink, target); - udev_selinux_lsetfilecon(udev, slink, S_IFLNK); - utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); - goto exit; - } - } - } - } else { - info(udev, "creating symlink '%s' to '%s'\n", slink, target); - do { - err = util_create_path_selinux(udev, slink); - if (err != 0 && err != -ENOENT) - break; - udev_selinux_setfscreatecon(udev, slink, S_IFLNK); - err = symlink(target, slink); - if (err != 0) - err = -errno; - udev_selinux_resetfscreatecon(udev); - } while (err == -ENOENT); - if (err == 0) - goto exit; - } - - info(udev, "atomically replace '%s'\n", slink); - util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); - unlink(slink_tmp); - do { - err = util_create_path_selinux(udev, slink_tmp); - if (err != 0 && err != -ENOENT) - break; - udev_selinux_setfscreatecon(udev, slink_tmp, S_IFLNK); - err = symlink(target, slink_tmp); - if (err != 0) - err = -errno; - udev_selinux_resetfscreatecon(udev); - } while (err == -ENOENT); - if (err != 0) { - err(udev, "symlink '%s' '%s' failed: %m\n", target, slink_tmp); - goto exit; - } - err = rename(slink_tmp, slink); - if (err != 0) { - err(udev, "rename '%s' '%s' failed: %m\n", slink_tmp, slink); - unlink(slink_tmp); - } -exit: - return err; -} - -/* find device node of device with highest priority */ -static const char *link_find_prioritized(struct udev_device *dev, bool add, const char *stackdir, char *buf, size_t bufsize) -{ - struct udev *udev = udev_device_get_udev(dev); - DIR *dir; - int priority = 0; - const char *target = NULL; - - if (add) { - priority = udev_device_get_devlink_priority(dev); - util_strscpy(buf, bufsize, udev_device_get_devnode(dev)); - target = buf; - } - - dir = opendir(stackdir); - if (dir == NULL) - return target; - for (;;) { - struct udev_device *dev_db; - struct dirent *dent; - - dent = readdir(dir); - if (dent == NULL || dent->d_name[0] == '\0') - break; - if (dent->d_name[0] == '.') - continue; - - info(udev, "found '%s' claiming '%s'\n", dent->d_name, stackdir); - - /* did we find ourself? */ - if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0) - continue; - - dev_db = udev_device_new_from_id_filename(udev, dent->d_name); - if (dev_db != NULL) { - const char *devnode; - - devnode = udev_device_get_devnode(dev_db); - if (devnode != NULL) { - dbg(udev, "compare priority of '%s'(%i) > '%s'(%i)\n", target, priority, - udev_device_get_devnode(dev_db), udev_device_get_devlink_priority(dev_db)); - if (target == NULL || udev_device_get_devlink_priority(dev_db) > priority) { - info(udev, "'%s' claims priority %i for '%s'\n", - udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir); - priority = udev_device_get_devlink_priority(dev_db); - util_strscpy(buf, bufsize, devnode); - target = buf; - } - } - udev_device_unref(dev_db); - } - } - closedir(dir); - return target; -} - -/* manage "stack of names" with possibly specified device priorities */ -static void link_update(struct udev_device *dev, const char *slink, bool add) -{ - struct udev *udev = udev_device_get_udev(dev); - char name_enc[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE * 2]; - char dirname[UTIL_PATH_SIZE]; - const char *target; - char buf[UTIL_PATH_SIZE]; - - dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); - - util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); - util_strscpyl(dirname, sizeof(dirname), udev_get_run_path(udev), "/links/", name_enc, NULL); - util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); - - if (!add) { - dbg(udev, "removing index: '%s'\n", filename); - if (unlink(filename) == 0) - rmdir(dirname); - } - - target = link_find_prioritized(dev, add, dirname, buf, sizeof(buf)); - if (target == NULL) { - info(udev, "no reference left, remove '%s'\n", slink); - if (unlink(slink) == 0) - util_delete_path(udev, slink); - } else { - info(udev, "creating link '%s' to '%s'\n", slink, target); - node_symlink(udev, target, slink); - } - - if (add) { - int err; - - dbg(udev, "creating index: '%s'\n", filename); - do { - int fd; - - err = util_create_path(udev, filename); - if (err != 0 && err != -ENOENT) - break; - fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); - if (fd >= 0) - close(fd); - else - err = -errno; - } while (err == -ENOENT); - } -} - -void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old) -{ - struct udev *udev = udev_device_get_udev(dev); - struct udev_list_entry *list_entry; - - /* update possible left-over symlinks */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { - const char *name = udev_list_entry_get_name(list_entry); - struct udev_list_entry *list_entry_current; - int found; - - /* check if old link name still belongs to this device */ - found = 0; - udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { - const char *name_current = udev_list_entry_get_name(list_entry_current); - - if (strcmp(name, name_current) == 0) { - found = 1; - break; - } - } - if (found) - continue; - - info(udev, "update old name, '%s' no longer belonging to '%s'\n", - name, udev_device_get_devpath(dev)); - link_update(dev, name, 0); - } -} - -static int node_fixup(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) -{ - struct udev *udev = udev_device_get_udev(dev); - const char *devnode = udev_device_get_devnode(dev); - dev_t devnum = udev_device_get_devnum(dev); - struct stat stats; - int err = 0; - - if (strcmp(udev_device_get_subsystem(dev), "block") == 0) - mode |= S_IFBLK; - else - mode |= S_IFCHR; - - if (lstat(devnode, &stats) != 0) { - err = -errno; - info(udev, "can not stat() node '%s' (%m)\n", devnode); - goto out; - } - - if (((stats.st_mode & S_IFMT) != (mode & S_IFMT)) || (stats.st_rdev != devnum)) { - err = -EEXIST; - info(udev, "found node '%s' with non-matching devnum %s, skip handling\n", - udev_device_get_devnode(dev), udev_device_get_id_filename(dev)); - goto out; - } - - if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { - info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); - chmod(devnode, mode); - chown(devnode, uid, gid); - } else { - info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); - } - - /* - * Set initial selinux file context only on add events. - * We set the proper context on bootup (triger) or for newly - * added devices, but we don't change it later, in case - * something else has set a custom context in the meantime. - */ - if (strcmp(udev_device_get_action(dev), "add") == 0) - udev_selinux_lsetfilecon(udev, devnode, mode); - - /* always update timestamp when we re-use the node, like on media change events */ - utimensat(AT_FDCWD, devnode, NULL, 0); -out: - return err; -} - -int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) -{ - struct udev *udev = udev_device_get_udev(dev); - char filename[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - int err = 0; - - info(udev, "handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d\n", - udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid); - - err = node_fixup(dev, mode, uid, gid); - if (err < 0) - goto exit; - - /* always add /dev/{block,char}/$major:$minor */ - snprintf(filename, sizeof(filename), "%s/%s/%u:%u", - udev_get_dev_path(udev), - strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); - node_symlink(udev, udev_device_get_devnode(dev), filename); - - /* create/update symlinks, add symlinks to name index */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - if (udev_list_entry_get_num(list_entry)) - /* simple unmanaged link name */ - node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry)); - else - link_update(dev, udev_list_entry_get_name(list_entry), 1); - } -exit: - return err; -} - -int udev_node_remove(struct udev_device *dev) -{ - struct udev *udev = udev_device_get_udev(dev); - struct udev_list_entry *list_entry; - const char *devnode; - struct stat stats; - struct udev_device *dev_check; - char filename[UTIL_PATH_SIZE]; - int err = 0; - - /* remove/update symlinks, remove symlinks from name index */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) - link_update(dev, udev_list_entry_get_name(list_entry), 0); - - /* remove /dev/{block,char}/$major:$minor */ - snprintf(filename, sizeof(filename), "%s/%s/%u:%u", - udev_get_dev_path(udev), - strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); - unlink(filename); -out: - return err; -} diff --git a/udev/udev-rules.c b/udev/udev-rules.c deleted file mode 100644 index 7e79545124..0000000000 --- a/udev/udev-rules.c +++ /dev/null @@ -1,2753 +0,0 @@ -/* - * Copyright (C) 2003-2010 Kay Sievers - * Copyright (C) 2008 Alan Jenkins - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -#define PREALLOC_TOKEN 2048 -#define PREALLOC_STRBUF 32 * 1024 -#define PREALLOC_TRIE 256 - -struct uid_gid { - unsigned int name_off; - union { - uid_t uid; - gid_t gid; - }; -}; - -struct trie_node { - /* this node's first child */ - unsigned int child_idx; - /* the next child of our parent node's child list */ - unsigned int next_child_idx; - /* this node's last child (shortcut for append) */ - unsigned int last_child_idx; - unsigned int value_off; - unsigned short value_len; - unsigned char key; -}; - -struct udev_rules { - struct udev *udev; - int resolve_names; - - /* every key in the rules file becomes a token */ - struct token *tokens; - unsigned int token_cur; - unsigned int token_max; - - /* all key strings are copied to a single string buffer */ - char *buf; - size_t buf_cur; - size_t buf_max; - unsigned int buf_count; - - /* during rule parsing, strings are indexed to find duplicates */ - struct trie_node *trie_nodes; - unsigned int trie_nodes_cur; - unsigned int trie_nodes_max; - - /* during rule parsing, uid/gid lookup results are cached */ - struct uid_gid *uids; - unsigned int uids_cur; - unsigned int uids_max; - struct uid_gid *gids; - unsigned int gids_cur; - unsigned int gids_max; -}; - -/* KEY=="", KEY!="", KEY+="", KEY="", KEY:="" */ -enum operation_type { - OP_UNSET, - - OP_MATCH, - OP_NOMATCH, - OP_MATCH_MAX, - - OP_ADD, - OP_ASSIGN, - OP_ASSIGN_FINAL, -}; - -enum string_glob_type { - GL_UNSET, - GL_PLAIN, /* no special chars */ - GL_GLOB, /* shell globs ?,*,[] */ - GL_SPLIT, /* multi-value A|B */ - GL_SPLIT_GLOB, /* multi-value with glob A*|B* */ - GL_SOMETHING, /* commonly used "?*" */ -}; - -enum string_subst_type { - SB_UNSET, - SB_NONE, - SB_FORMAT, - SB_SUBSYS, -}; - -/* tokens of a rule are sorted/handled in this order */ -enum token_type { - TK_UNSET, - TK_RULE, - - TK_M_ACTION, /* val */ - TK_M_DEVPATH, /* val */ - TK_M_KERNEL, /* val */ - TK_M_DEVLINK, /* val */ - TK_M_NAME, /* val */ - TK_M_ENV, /* val, attr */ - TK_M_TAG, /* val */ - TK_M_SUBSYSTEM, /* val */ - TK_M_DRIVER, /* val */ - TK_M_WAITFOR, /* val */ - TK_M_ATTR, /* val, attr */ - - TK_M_PARENTS_MIN, - TK_M_KERNELS, /* val */ - TK_M_SUBSYSTEMS, /* val */ - TK_M_DRIVERS, /* val */ - TK_M_ATTRS, /* val, attr */ - TK_M_TAGS, /* val */ - TK_M_PARENTS_MAX, - - TK_M_TEST, /* val, mode_t */ - TK_M_EVENT_TIMEOUT, /* int */ - TK_M_PROGRAM, /* val */ - TK_M_IMPORT_FILE, /* val */ - TK_M_IMPORT_PROG, /* val */ - TK_M_IMPORT_BUILTIN, /* val */ - TK_M_IMPORT_DB, /* val */ - TK_M_IMPORT_CMDLINE, /* val */ - TK_M_IMPORT_PARENT, /* val */ - TK_M_RESULT, /* val */ - TK_M_MAX, - - TK_A_STRING_ESCAPE_NONE, - TK_A_STRING_ESCAPE_REPLACE, - TK_A_DB_PERSIST, - TK_A_INOTIFY_WATCH, /* int */ - TK_A_DEVLINK_PRIO, /* int */ - TK_A_OWNER, /* val */ - TK_A_GROUP, /* val */ - TK_A_MODE, /* val */ - TK_A_OWNER_ID, /* uid_t */ - TK_A_GROUP_ID, /* gid_t */ - TK_A_MODE_ID, /* mode_t */ - TK_A_STATIC_NODE, /* val */ - TK_A_ENV, /* val, attr */ - TK_A_TAG, /* val */ - TK_A_NAME, /* val */ - TK_A_DEVLINK, /* val */ - TK_A_ATTR, /* val, attr */ - TK_A_RUN, /* val, bool */ - TK_A_GOTO, /* size_t */ - - TK_END, -}; - -/* we try to pack stuff in a way that we take only 12 bytes per token */ -struct token { - union { - unsigned char type; /* same in rule and key */ - struct { - enum token_type type:8; - bool can_set_name:1; - bool has_static_node:1; - unsigned int unused:6; - unsigned short token_count; - unsigned int label_off; - unsigned short filename_off; - unsigned short filename_line; - } rule; - struct { - enum token_type type:8; - enum operation_type op:8; - enum string_glob_type glob:8; - enum string_subst_type subst:4; - enum string_subst_type attrsubst:4; - unsigned int value_off; - union { - unsigned int attr_off; - int devlink_unique; - unsigned int rule_goto; - mode_t mode; - uid_t uid; - gid_t gid; - int devlink_prio; - int event_timeout; - int watch; - enum udev_builtin_cmd builtin_cmd; - }; - } key; - }; -}; - -#define MAX_TK 64 -struct rule_tmp { - struct udev_rules *rules; - struct token rule; - struct token token[MAX_TK]; - unsigned int token_cur; -}; - -#ifdef ENABLE_DEBUG -static const char *operation_str(enum operation_type type) -{ - static const char *operation_strs[] = { - [OP_UNSET] = "UNSET", - [OP_MATCH] = "match", - [OP_NOMATCH] = "nomatch", - [OP_MATCH_MAX] = "MATCH_MAX", - - [OP_ADD] = "add", - [OP_ASSIGN] = "assign", - [OP_ASSIGN_FINAL] = "assign-final", -} ; - - return operation_strs[type]; -} - -static const char *string_glob_str(enum string_glob_type type) -{ - static const char *string_glob_strs[] = { - [GL_UNSET] = "UNSET", - [GL_PLAIN] = "plain", - [GL_GLOB] = "glob", - [GL_SPLIT] = "split", - [GL_SPLIT_GLOB] = "split-glob", - [GL_SOMETHING] = "split-glob", - }; - - return string_glob_strs[type]; -} - -static const char *token_str(enum token_type type) -{ - static const char *token_strs[] = { - [TK_UNSET] = "UNSET", - [TK_RULE] = "RULE", - - [TK_M_ACTION] = "M ACTION", - [TK_M_DEVPATH] = "M DEVPATH", - [TK_M_KERNEL] = "M KERNEL", - [TK_M_DEVLINK] = "M DEVLINK", - [TK_M_NAME] = "M NAME", - [TK_M_ENV] = "M ENV", - [TK_M_TAG] = "M TAG", - [TK_M_SUBSYSTEM] = "M SUBSYSTEM", - [TK_M_DRIVER] = "M DRIVER", - [TK_M_WAITFOR] = "M WAITFOR", - [TK_M_ATTR] = "M ATTR", - - [TK_M_PARENTS_MIN] = "M PARENTS_MIN", - [TK_M_KERNELS] = "M KERNELS", - [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", - [TK_M_DRIVERS] = "M DRIVERS", - [TK_M_ATTRS] = "M ATTRS", - [TK_M_TAGS] = "M TAGS", - [TK_M_PARENTS_MAX] = "M PARENTS_MAX", - - [TK_M_TEST] = "M TEST", - [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", - [TK_M_PROGRAM] = "M PROGRAM", - [TK_M_IMPORT_FILE] = "M IMPORT_FILE", - [TK_M_IMPORT_PROG] = "M IMPORT_PROG", - [TK_M_IMPORT_BUILTIN] = "M IMPORT_BUILTIN", - [TK_M_IMPORT_DB] = "M IMPORT_DB", - [TK_M_IMPORT_CMDLINE] = "M IMPORT_CMDLINE", - [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", - [TK_M_RESULT] = "M RESULT", - [TK_M_MAX] = "M MAX", - - [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", - [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", - [TK_A_DB_PERSIST] = "A DB_PERSIST", - [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", - [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", - [TK_A_OWNER] = "A OWNER", - [TK_A_GROUP] = "A GROUP", - [TK_A_MODE] = "A MODE", - [TK_A_OWNER_ID] = "A OWNER_ID", - [TK_A_GROUP_ID] = "A GROUP_ID", - [TK_A_STATIC_NODE] = "A STATIC_NODE", - [TK_A_MODE_ID] = "A MODE_ID", - [TK_A_ENV] = "A ENV", - [TK_A_TAG] = "A ENV", - [TK_A_NAME] = "A NAME", - [TK_A_DEVLINK] = "A DEVLINK", - [TK_A_ATTR] = "A ATTR", - [TK_A_RUN] = "A RUN", - [TK_A_GOTO] = "A GOTO", - - [TK_END] = "END", - }; - - return token_strs[type]; -} - -static void dump_token(struct udev_rules *rules, struct token *token) -{ - enum token_type type = token->type; - enum operation_type op = token->key.op; - enum string_glob_type glob = token->key.glob; - const char *value = &rules->buf[token->key.value_off]; - const char *attr = &rules->buf[token->key.attr_off]; - - switch (type) { - case TK_RULE: - { - const char *tks_ptr = (char *)rules->tokens; - const char *tk_ptr = (char *)token; - unsigned int idx = (tk_ptr - tks_ptr) / sizeof(struct token); - - dbg(rules->udev, "* RULE %s:%u, token: %u, count: %u, label: '%s'\n", - &rules->buf[token->rule.filename_off], token->rule.filename_line, - idx, token->rule.token_count, - &rules->buf[token->rule.label_off]); - break; - } - case TK_M_ACTION: - case TK_M_DEVPATH: - case TK_M_KERNEL: - case TK_M_SUBSYSTEM: - case TK_M_DRIVER: - case TK_M_WAITFOR: - case TK_M_DEVLINK: - case TK_M_NAME: - case TK_M_KERNELS: - case TK_M_SUBSYSTEMS: - case TK_M_DRIVERS: - case TK_M_TAGS: - case TK_M_PROGRAM: - case TK_M_IMPORT_FILE: - case TK_M_IMPORT_PROG: - case TK_M_IMPORT_DB: - case TK_M_IMPORT_CMDLINE: - case TK_M_IMPORT_PARENT: - case TK_M_RESULT: - case TK_A_NAME: - case TK_A_DEVLINK: - case TK_A_OWNER: - case TK_A_GROUP: - case TK_A_MODE: - case TK_A_RUN: - dbg(rules->udev, "%s %s '%s'(%s)\n", - token_str(type), operation_str(op), value, string_glob_str(glob)); - break; - case TK_M_IMPORT_BUILTIN: - dbg(rules->udev, "%s %i '%s'\n", token_str(type), token->key.builtin_cmd, value); - break; - case TK_M_ATTR: - case TK_M_ATTRS: - case TK_M_ENV: - case TK_A_ATTR: - case TK_A_ENV: - dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", - token_str(type), operation_str(op), attr, value, string_glob_str(glob)); - break; - case TK_M_TAG: - case TK_A_TAG: - dbg(rules->udev, "%s %s '%s'\n", token_str(type), operation_str(op), value); - break; - case TK_A_STRING_ESCAPE_NONE: - case TK_A_STRING_ESCAPE_REPLACE: - case TK_A_DB_PERSIST: - dbg(rules->udev, "%s\n", token_str(type)); - break; - case TK_M_TEST: - dbg(rules->udev, "%s %s '%s'(%s) %#o\n", - token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode); - break; - case TK_A_INOTIFY_WATCH: - dbg(rules->udev, "%s %u\n", token_str(type), token->key.watch); - break; - case TK_A_DEVLINK_PRIO: - dbg(rules->udev, "%s %u\n", token_str(type), token->key.devlink_prio); - break; - case TK_A_OWNER_ID: - dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.uid); - break; - case TK_A_GROUP_ID: - dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.gid); - break; - case TK_A_MODE_ID: - dbg(rules->udev, "%s %s %#o\n", token_str(type), operation_str(op), token->key.mode); - break; - case TK_A_STATIC_NODE: - dbg(rules->udev, "%s '%s'\n", token_str(type), value); - break; - case TK_M_EVENT_TIMEOUT: - dbg(rules->udev, "%s %u\n", token_str(type), token->key.event_timeout); - break; - case TK_A_GOTO: - dbg(rules->udev, "%s '%s' %u\n", token_str(type), value, token->key.rule_goto); - break; - case TK_END: - dbg(rules->udev, "* %s\n", token_str(type)); - break; - case TK_M_PARENTS_MIN: - case TK_M_PARENTS_MAX: - case TK_M_MAX: - case TK_UNSET: - dbg(rules->udev, "unknown type %u\n", type); - break; - } -} - -static void dump_rules(struct udev_rules *rules) -{ - unsigned int i; - - dbg(rules->udev, "dumping %u (%zu bytes) tokens, %u (%zu bytes) strings\n", - rules->token_cur, - rules->token_cur * sizeof(struct token), - rules->buf_count, - rules->buf_cur); - for(i = 0; i < rules->token_cur; i++) - dump_token(rules, &rules->tokens[i]); -} -#else -static inline const char *operation_str(enum operation_type type) { return NULL; } -static inline const char *token_str(enum token_type type) { return NULL; } -static inline void dump_token(struct udev_rules *rules, struct token *token) {} -static inline void dump_rules(struct udev_rules *rules) {} -#endif /* ENABLE_DEBUG */ - -static int add_new_string(struct udev_rules *rules, const char *str, size_t bytes) -{ - int off; - - /* grow buffer if needed */ - if (rules->buf_cur + bytes+1 >= rules->buf_max) { - char *buf; - unsigned int add; - - /* double the buffer size */ - add = rules->buf_max; - if (add < bytes * 8) - add = bytes * 8; - - buf = realloc(rules->buf, rules->buf_max + add); - if (buf == NULL) - return -1; - dbg(rules->udev, "extend buffer from %zu to %zu\n", rules->buf_max, rules->buf_max + add); - rules->buf = buf; - rules->buf_max += add; - } - off = rules->buf_cur; - memcpy(&rules->buf[rules->buf_cur], str, bytes); - rules->buf_cur += bytes; - rules->buf_count++; - return off; -} - -static int add_string(struct udev_rules *rules, const char *str) -{ - unsigned int node_idx; - struct trie_node *new_node; - unsigned int new_node_idx; - unsigned char key; - unsigned short len; - unsigned int depth; - unsigned int off; - struct trie_node *parent; - - /* walk trie, start from last character of str to find matching tails */ - len = strlen(str); - key = str[len-1]; - node_idx = 0; - for (depth = 0; depth <= len; depth++) { - struct trie_node *node; - unsigned int child_idx; - - node = &rules->trie_nodes[node_idx]; - off = node->value_off + node->value_len - len; - - /* match against current node */ - if (depth == len || (node->value_len >= len && memcmp(&rules->buf[off], str, len) == 0)) - return off; - - /* lookup child node */ - key = str[len - 1 - depth]; - child_idx = node->child_idx; - while (child_idx > 0) { - struct trie_node *child; - - child = &rules->trie_nodes[child_idx]; - if (child->key == key) - break; - child_idx = child->next_child_idx; - } - if (child_idx == 0) - break; - node_idx = child_idx; - } - - /* string not found, add it */ - off = add_new_string(rules, str, len + 1); - - /* grow trie nodes if needed */ - if (rules->trie_nodes_cur >= rules->trie_nodes_max) { - struct trie_node *nodes; - unsigned int add; - - /* double the buffer size */ - add = rules->trie_nodes_max; - if (add < 8) - add = 8; - - nodes = realloc(rules->trie_nodes, (rules->trie_nodes_max + add) * sizeof(struct trie_node)); - if (nodes == NULL) - return -1; - dbg(rules->udev, "extend trie nodes from %u to %u\n", - rules->trie_nodes_max, rules->trie_nodes_max + add); - rules->trie_nodes = nodes; - rules->trie_nodes_max += add; - } - - /* get a new node */ - new_node_idx = rules->trie_nodes_cur; - rules->trie_nodes_cur++; - new_node = &rules->trie_nodes[new_node_idx]; - memset(new_node, 0x00, sizeof(struct trie_node)); - new_node->value_off = off; - new_node->value_len = len; - new_node->key = key; - - /* join the parent's child list */ - parent = &rules->trie_nodes[node_idx]; - if (parent->child_idx == 0) { - parent->child_idx = new_node_idx; - } else { - struct trie_node *last_child; - - last_child = &rules->trie_nodes[parent->last_child_idx]; - last_child->next_child_idx = new_node_idx; - } - parent->last_child_idx = new_node_idx; - return off; -} - -static int add_token(struct udev_rules *rules, struct token *token) -{ - /* grow buffer if needed */ - if (rules->token_cur+1 >= rules->token_max) { - struct token *tokens; - unsigned int add; - - /* double the buffer size */ - add = rules->token_max; - if (add < 8) - add = 8; - - tokens = realloc(rules->tokens, (rules->token_max + add ) * sizeof(struct token)); - if (tokens == NULL) - return -1; - dbg(rules->udev, "extend tokens from %u to %u\n", rules->token_max, rules->token_max + add); - rules->tokens = tokens; - rules->token_max += add; - } - memcpy(&rules->tokens[rules->token_cur], token, sizeof(struct token)); - rules->token_cur++; - return 0; -} - -static uid_t add_uid(struct udev_rules *rules, const char *owner) -{ - unsigned int i; - uid_t uid; - unsigned int off; - - /* lookup, if we know it already */ - for (i = 0; i < rules->uids_cur; i++) { - off = rules->uids[i].name_off; - if (strcmp(&rules->buf[off], owner) == 0) { - uid = rules->uids[i].uid; - dbg(rules->udev, "return existing %u for '%s'\n", uid, owner); - return uid; - } - } - uid = util_lookup_user(rules->udev, owner); - - /* grow buffer if needed */ - if (rules->uids_cur+1 >= rules->uids_max) { - struct uid_gid *uids; - unsigned int add; - - /* double the buffer size */ - add = rules->uids_max; - if (add < 1) - add = 8; - - uids = realloc(rules->uids, (rules->uids_max + add ) * sizeof(struct uid_gid)); - if (uids == NULL) - return uid; - dbg(rules->udev, "extend uids from %u to %u\n", rules->uids_max, rules->uids_max + add); - rules->uids = uids; - rules->uids_max += add; - } - rules->uids[rules->uids_cur].uid = uid; - off = add_string(rules, owner); - if (off <= 0) - return uid; - rules->uids[rules->uids_cur].name_off = off; - rules->uids_cur++; - return uid; -} - -static gid_t add_gid(struct udev_rules *rules, const char *group) -{ - unsigned int i; - gid_t gid; - unsigned int off; - - /* lookup, if we know it already */ - for (i = 0; i < rules->gids_cur; i++) { - off = rules->gids[i].name_off; - if (strcmp(&rules->buf[off], group) == 0) { - gid = rules->gids[i].gid; - dbg(rules->udev, "return existing %u for '%s'\n", gid, group); - return gid; - } - } - gid = util_lookup_group(rules->udev, group); - - /* grow buffer if needed */ - if (rules->gids_cur+1 >= rules->gids_max) { - struct uid_gid *gids; - unsigned int add; - - /* double the buffer size */ - add = rules->gids_max; - if (add < 1) - add = 8; - - gids = realloc(rules->gids, (rules->gids_max + add ) * sizeof(struct uid_gid)); - if (gids == NULL) - return gid; - dbg(rules->udev, "extend gids from %u to %u\n", rules->gids_max, rules->gids_max + add); - rules->gids = gids; - rules->gids_max += add; - } - rules->gids[rules->gids_cur].gid = gid; - off = add_string(rules, group); - if (off <= 0) - return gid; - rules->gids[rules->gids_cur].name_off = off; - rules->gids_cur++; - return gid; -} - -static int import_property_from_string(struct udev_device *dev, char *line) -{ - struct udev *udev = udev_device_get_udev(dev); - char *key; - char *val; - size_t len; - - /* find key */ - key = line; - while (isspace(key[0])) - key++; - - /* comment or empty line */ - if (key[0] == '#' || key[0] == '\0') - return -1; - - /* split key/value */ - val = strchr(key, '='); - if (val == NULL) - return -1; - val[0] = '\0'; - val++; - - /* find value */ - while (isspace(val[0])) - val++; - - /* terminate key */ - len = strlen(key); - if (len == 0) - return -1; - while (isspace(key[len-1])) - len--; - key[len] = '\0'; - - /* terminate value */ - len = strlen(val); - if (len == 0) - return -1; - while (isspace(val[len-1])) - len--; - val[len] = '\0'; - - if (len == 0) - return -1; - - /* unquote */ - if (val[0] == '"' || val[0] == '\'') { - if (val[len-1] != val[0]) { - info(udev, "inconsistent quoting: '%s', skip\n", line); - return -1; - } - val[len-1] = '\0'; - val++; - } - - dbg(udev, "adding '%s'='%s'\n", key, val); - - /* handle device, renamed by external tool, returning new path */ - if (strcmp(key, "DEVPATH") == 0) { - char syspath[UTIL_PATH_SIZE]; - - info(udev, "updating devpath from '%s' to '%s'\n", - udev_device_get_devpath(dev), val); - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), val, NULL); - udev_device_set_syspath(dev, syspath); - } else { - struct udev_list_entry *entry; - - entry = udev_device_add_property(dev, key, val); - /* store in db, skip private keys */ - if (key[0] != '.') - udev_list_entry_set_num(entry, true); - } - return 0; -} - -static int import_file_into_properties(struct udev_device *dev, const char *filename) -{ - FILE *f; - char line[UTIL_LINE_SIZE]; - - f = fopen(filename, "r"); - if (f == NULL) - return -1; - while (fgets(line, sizeof(line), f) != NULL) - import_property_from_string(dev, line); - fclose(f); - return 0; -} - -static int import_program_into_properties(struct udev_event *event, const char *program, const sigset_t *sigmask) -{ - struct udev_device *dev = event->dev; - char **envp; - char result[UTIL_LINE_SIZE]; - char *line; - int err; - - envp = udev_device_get_properties_envp(dev); - err = udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)); - if (err < 0) - return err; - - line = result; - while (line != NULL) { - char *pos; - - pos = strchr(line, '\n'); - if (pos != NULL) { - pos[0] = '\0'; - pos = &pos[1]; - } - import_property_from_string(dev, line); - line = pos; - } - return 0; -} - -static int import_parent_into_properties(struct udev_device *dev, const char *filter) -{ - struct udev *udev = udev_device_get_udev(dev); - struct udev_device *dev_parent; - struct udev_list_entry *list_entry; - - dev_parent = udev_device_get_parent(dev); - if (dev_parent == NULL) - return -1; - - dbg(udev, "found parent '%s', get the node name\n", udev_device_get_syspath(dev_parent)); - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev_parent)) { - const char *key = udev_list_entry_get_name(list_entry); - const char *val = udev_list_entry_get_value(list_entry); - - if (fnmatch(filter, key, 0) == 0) { - struct udev_list_entry *entry; - - dbg(udev, "import key '%s=%s'\n", key, val); - entry = udev_device_add_property(dev, key, val); - /* store in db, skip private keys */ - if (key[0] != '.') - udev_list_entry_set_num(entry, true); - } - } - return 0; -} - -#define WAIT_LOOP_PER_SECOND 50 -static int wait_for_file(struct udev_device *dev, const char *file, int timeout) -{ - struct udev *udev = udev_device_get_udev(dev); - char filepath[UTIL_PATH_SIZE]; - char devicepath[UTIL_PATH_SIZE]; - struct stat stats; - int loop = timeout * WAIT_LOOP_PER_SECOND; - - /* a relative path is a device attribute */ - devicepath[0] = '\0'; - if (file[0] != '/') { - util_strscpyl(devicepath, sizeof(devicepath), - udev_get_sys_path(udev), udev_device_get_devpath(dev), NULL); - util_strscpyl(filepath, sizeof(filepath), devicepath, "/", file, NULL); - file = filepath; - } - - dbg(udev, "will wait %i sec for '%s'\n", timeout, file); - while (--loop) { - const struct timespec duration = { 0, 1000 * 1000 * 1000 / WAIT_LOOP_PER_SECOND }; - - /* lookup file */ - if (stat(file, &stats) == 0) { - info(udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); - return 0; - } - /* make sure, the device did not disappear in the meantime */ - if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { - info(udev, "device disappeared while waiting for '%s'\n", file); - return -2; - } - info(udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); - nanosleep(&duration, NULL); - } - info(udev, "waiting for '%s' failed\n", file); - return -1; -} - -static int attr_subst_subdir(char *attr, size_t len) -{ - bool found = false; - - if (strstr(attr, "/*/")) { - char *pos; - char dirname[UTIL_PATH_SIZE]; - const char *tail; - DIR *dir; - - util_strscpy(dirname, sizeof(dirname), attr); - pos = strstr(dirname, "/*/"); - if (pos == NULL) - return -1; - pos[0] = '\0'; - tail = &pos[2]; - dir = opendir(dirname); - if (dir != NULL) { - struct dirent *dent; - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat stats; - - if (dent->d_name[0] == '.') - continue; - util_strscpyl(attr, len, dirname, "/", dent->d_name, tail, NULL); - if (stat(attr, &stats) == 0) { - found = true; - break; - } - } - closedir(dir); - } - } - - return found; -} - -static int get_key(struct udev *udev, char **line, char **key, enum operation_type *op, char **value) -{ - char *linepos; - char *temp; - - linepos = *line; - if (linepos == NULL || linepos[0] == '\0') - return -1; - - /* skip whitespace */ - while (isspace(linepos[0]) || linepos[0] == ',') - linepos++; - - /* get the key */ - if (linepos[0] == '\0') - return -1; - *key = linepos; - - for (;;) { - linepos++; - if (linepos[0] == '\0') - return -1; - if (isspace(linepos[0])) - break; - if (linepos[0] == '=') - break; - if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) - if (linepos[1] == '=') - break; - } - - /* remember end of key */ - temp = linepos; - - /* skip whitespace after key */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get operation type */ - if (linepos[0] == '=' && linepos[1] == '=') { - *op = OP_MATCH; - linepos += 2; - } else if (linepos[0] == '!' && linepos[1] == '=') { - *op = OP_NOMATCH; - linepos += 2; - } else if (linepos[0] == '+' && linepos[1] == '=') { - *op = OP_ADD; - linepos += 2; - } else if (linepos[0] == '=') { - *op = OP_ASSIGN; - linepos++; - } else if (linepos[0] == ':' && linepos[1] == '=') { - *op = OP_ASSIGN_FINAL; - linepos += 2; - } else - return -1; - - /* terminate key */ - temp[0] = '\0'; - - /* skip whitespace after operator */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get the value */ - if (linepos[0] == '"') - linepos++; - else - return -1; - *value = linepos; - - /* terminate */ - temp = strchr(linepos, '"'); - if (!temp) - return -1; - temp[0] = '\0'; - temp++; - dbg(udev, "%s '%s'-'%s'\n", operation_str(*op), *key, *value); - - /* move line to next key */ - *line = temp; - return 0; -} - -/* extract possible KEY{attr} */ -static char *get_key_attribute(struct udev *udev, char *str) -{ - char *pos; - char *attr; - - attr = strchr(str, '{'); - if (attr != NULL) { - attr++; - pos = strchr(attr, '}'); - if (pos == NULL) { - err(udev, "missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - dbg(udev, "attribute='%s'\n", attr); - return attr; - } - return NULL; -} - -static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, - enum operation_type op, - const char *value, const void *data) -{ - struct token *token = &rule_tmp->token[rule_tmp->token_cur]; - const char *attr = NULL; - - memset(token, 0x00, sizeof(struct token)); - - switch (type) { - case TK_M_ACTION: - case TK_M_DEVPATH: - case TK_M_KERNEL: - case TK_M_SUBSYSTEM: - case TK_M_DRIVER: - case TK_M_WAITFOR: - case TK_M_DEVLINK: - case TK_M_NAME: - case TK_M_KERNELS: - case TK_M_SUBSYSTEMS: - case TK_M_DRIVERS: - case TK_M_TAGS: - case TK_M_PROGRAM: - case TK_M_IMPORT_FILE: - case TK_M_IMPORT_PROG: - case TK_M_IMPORT_DB: - case TK_M_IMPORT_CMDLINE: - case TK_M_IMPORT_PARENT: - case TK_M_RESULT: - case TK_A_OWNER: - case TK_A_GROUP: - case TK_A_MODE: - case TK_A_NAME: - case TK_A_GOTO: - case TK_M_TAG: - case TK_A_TAG: - token->key.value_off = add_string(rule_tmp->rules, value); - break; - case TK_M_IMPORT_BUILTIN: - token->key.value_off = add_string(rule_tmp->rules, value); - token->key.builtin_cmd = *(enum udev_builtin_cmd *)data; - break; - case TK_M_ENV: - case TK_M_ATTR: - case TK_M_ATTRS: - case TK_A_ATTR: - case TK_A_ENV: - attr = data; - token->key.value_off = add_string(rule_tmp->rules, value); - token->key.attr_off = add_string(rule_tmp->rules, attr); - break; - case TK_A_DEVLINK: - token->key.value_off = add_string(rule_tmp->rules, value); - token->key.devlink_unique = *(int *)data; - break; - case TK_M_TEST: - token->key.value_off = add_string(rule_tmp->rules, value); - if (data != NULL) - token->key.mode = *(mode_t *)data; - break; - case TK_A_STRING_ESCAPE_NONE: - case TK_A_STRING_ESCAPE_REPLACE: - case TK_A_DB_PERSIST: - break; - case TK_A_RUN: - token->key.value_off = add_string(rule_tmp->rules, value); - break; - case TK_A_INOTIFY_WATCH: - case TK_A_DEVLINK_PRIO: - token->key.devlink_prio = *(int *)data; - break; - case TK_A_OWNER_ID: - token->key.uid = *(uid_t *)data; - break; - case TK_A_GROUP_ID: - token->key.gid = *(gid_t *)data; - break; - case TK_A_MODE_ID: - token->key.mode = *(mode_t *)data; - break; - case TK_A_STATIC_NODE: - token->key.value_off = add_string(rule_tmp->rules, value); - break; - case TK_M_EVENT_TIMEOUT: - token->key.event_timeout = *(int *)data; - break; - case TK_RULE: - case TK_M_PARENTS_MIN: - case TK_M_PARENTS_MAX: - case TK_M_MAX: - case TK_END: - case TK_UNSET: - err(rule_tmp->rules->udev, "wrong type %u\n", type); - return -1; - } - - if (value != NULL && type < TK_M_MAX) { - /* check if we need to split or call fnmatch() while matching rules */ - enum string_glob_type glob; - int has_split; - int has_glob; - - has_split = (strchr(value, '|') != NULL); - has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || strchr(value, '[') != NULL); - if (has_split && has_glob) { - glob = GL_SPLIT_GLOB; - } else if (has_split) { - glob = GL_SPLIT; - } else if (has_glob) { - if (strcmp(value, "?*") == 0) - glob = GL_SOMETHING; - else - glob = GL_GLOB; - } else { - glob = GL_PLAIN; - } - token->key.glob = glob; - } - - if (value != NULL && type > TK_M_MAX) { - /* check if assigned value has substitution chars */ - if (value[0] == '[') - token->key.subst = SB_SUBSYS; - else if (strchr(value, '%') != NULL || strchr(value, '$') != NULL) - token->key.subst = SB_FORMAT; - else - token->key.subst = SB_NONE; - } - - if (attr != NULL) { - /* check if property/attribut name has substitution chars */ - if (attr[0] == '[') - token->key.attrsubst = SB_SUBSYS; - else if (strchr(attr, '%') != NULL || strchr(attr, '$') != NULL) - token->key.attrsubst = SB_FORMAT; - else - token->key.attrsubst = SB_NONE; - } - - token->key.type = type; - token->key.op = op; - rule_tmp->token_cur++; - if (rule_tmp->token_cur >= ARRAY_SIZE(rule_tmp->token)) { - err(rule_tmp->rules->udev, "temporary rule array too small\n"); - return -1; - } - return 0; -} - -static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) -{ - unsigned int i; - unsigned int start = 0; - unsigned int end = rule_tmp->token_cur; - - for (i = 0; i < rule_tmp->token_cur; i++) { - enum token_type next_val = TK_UNSET; - unsigned int next_idx = 0; - unsigned int j; - - /* find smallest value */ - for (j = start; j < end; j++) { - if (rule_tmp->token[j].type == TK_UNSET) - continue; - if (next_val == TK_UNSET || rule_tmp->token[j].type < next_val) { - next_val = rule_tmp->token[j].type; - next_idx = j; - } - } - - /* add token and mark done */ - if (add_token(rules, &rule_tmp->token[next_idx]) != 0) - return -1; - rule_tmp->token[next_idx].type = TK_UNSET; - - /* shrink range */ - if (next_idx == start) - start++; - if (next_idx+1 == end) - end--; - } - return 0; -} - -static int add_rule(struct udev_rules *rules, char *line, - const char *filename, unsigned int filename_off, unsigned int lineno) -{ - char *linepos; - char *attr; - struct rule_tmp rule_tmp; - - memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); - rule_tmp.rules = rules; - rule_tmp.rule.type = TK_RULE; - rule_tmp.rule.rule.filename_off = filename_off; - rule_tmp.rule.rule.filename_line = lineno; - - linepos = line; - for (;;) { - char *key; - char *value; - enum operation_type op; - - if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) - break; - - if (strcmp(key, "ACTION") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid ACTION operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_ACTION, op, value, NULL); - continue; - } - - if (strcmp(key, "DEVPATH") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid DEVPATH operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_DEVPATH, op, value, NULL); - continue; - } - - if (strcmp(key, "KERNEL") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid KERNEL operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_KERNEL, op, value, NULL); - continue; - } - - if (strcmp(key, "SUBSYSTEM") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid SUBSYSTEM operation\n"); - goto invalid; - } - /* bus, class, subsystem events should all be the same */ - if (strcmp(value, "subsystem") == 0 || - strcmp(value, "bus") == 0 || - strcmp(value, "class") == 0) { - if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) - err(rules->udev, "'%s' must be specified as 'subsystem' \n" - "please fix it in %s:%u", value, filename, lineno); - rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, "subsystem|class|bus", NULL); - } else - rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, value, NULL); - continue; - } - - if (strcmp(key, "DRIVER") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid DRIVER operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_DRIVER, op, value, NULL); - continue; - } - - if (strncmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { - attr = get_key_attribute(rules->udev, key + sizeof("ATTR")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTR attribute\n"); - goto invalid; - } - if (op < OP_MATCH_MAX) { - rule_add_key(&rule_tmp, TK_M_ATTR, op, value, attr); - } else { - rule_add_key(&rule_tmp, TK_A_ATTR, op, value, attr); - } - continue; - } - - if (strcmp(key, "KERNELS") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid KERNELS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL); - continue; - } - - if (strcmp(key, "SUBSYSTEMS") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid SUBSYSTEMS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); - continue; - } - - if (strcmp(key, "DRIVERS") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid DRIVERS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_DRIVERS, op, value, NULL); - continue; - } - - if (strncmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid ATTRS operation\n"); - goto invalid; - } - attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTRS attribute\n"); - goto invalid; - } - if (strncmp(attr, "device/", 7) == 0) - err(rules->udev, "the 'device' link may not be available in a future kernel, " - "please fix it in %s:%u", filename, lineno); - else if (strstr(attr, "../") != NULL) - err(rules->udev, "do not reference parent sysfs directories directly, " - "it may break with a future kernel, please fix it in %s:%u", filename, lineno); - rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr); - continue; - } - - if (strcmp(key, "TAGS") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid TAGS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_TAGS, op, value, NULL); - continue; - } - - if (strncmp(key, "ENV{", sizeof("ENV{")-1) == 0) { - attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ENV attribute\n"); - goto invalid; - } - if (op < OP_MATCH_MAX) { - if (rule_add_key(&rule_tmp, TK_M_ENV, op, value, attr) != 0) - goto invalid; - } else { - static const char *blacklist[] = { - "ACTION", - "SUBSYSTEM", - "DEVTYPE", - "MAJOR", - "MINOR", - "DRIVER", - "IFINDEX", - "DEVNAME", - "DEVLINKS", - "DEVPATH", - "TAGS", - }; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(blacklist); i++) - if (strcmp(attr, blacklist[i]) == 0) { - err(rules->udev, "invalid ENV attribute, '%s' can not be set %s:%u\n", attr, filename, lineno); - continue; - } - if (rule_add_key(&rule_tmp, TK_A_ENV, op, value, attr) != 0) - goto invalid; - } - continue; - } - - if (strcmp(key, "TAG") == 0) { - if (op < OP_MATCH_MAX) - rule_add_key(&rule_tmp, TK_M_TAG, op, value, NULL); - else - rule_add_key(&rule_tmp, TK_A_TAG, op, value, NULL); - continue; - } - - if (strcmp(key, "PROGRAM") == 0) { - rule_add_key(&rule_tmp, TK_M_PROGRAM, op, value, NULL); - continue; - } - - if (strcmp(key, "RESULT") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid RESULT operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_RESULT, op, value, NULL); - continue; - } - - if (strncmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { - attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1); - if (attr == NULL) { - err(rules->udev, "IMPORT{} type missing, ignoring IMPORT %s:%u\n", filename, lineno); - continue; - } - if (strstr(attr, "program")) { - /* find known built-in command */ - if (value[0] != '/') { - enum udev_builtin_cmd cmd; - - cmd = udev_builtin_lookup(value); - if (cmd < UDEV_BUILTIN_MAX) { - info(rules->udev, "IMPORT found builtin '%s', replacing %s:%u\n", - value, filename, lineno); - rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); - continue; - } - } - dbg(rules->udev, "IMPORT will be executed\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); - } else if (strstr(attr, "builtin")) { - enum udev_builtin_cmd cmd = udev_builtin_lookup(value); - - dbg(rules->udev, "IMPORT execute builtin\n"); - if (cmd < UDEV_BUILTIN_MAX) - rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); - else - err(rules->udev, "IMPORT{builtin}: '%s' unknown %s:%u\n", value, filename, lineno); - } else if (strstr(attr, "file")) { - dbg(rules->udev, "IMPORT will be included as file\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); - } else if (strstr(attr, "db")) { - dbg(rules->udev, "IMPORT will include db values\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_DB, op, value, NULL); - } else if (strstr(attr, "cmdline")) { - dbg(rules->udev, "IMPORT will include db values\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_CMDLINE, op, value, NULL); - } else if (strstr(attr, "parent")) { - dbg(rules->udev, "IMPORT will include the parent values\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); - } - continue; - } - - if (strncmp(key, "TEST", sizeof("TEST")-1) == 0) { - mode_t mode = 0; - - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid TEST operation\n"); - goto invalid; - } - attr = get_key_attribute(rules->udev, key + sizeof("TEST")-1); - if (attr != NULL) { - mode = strtol(attr, NULL, 8); - rule_add_key(&rule_tmp, TK_M_TEST, op, value, &mode); - } else { - rule_add_key(&rule_tmp, TK_M_TEST, op, value, NULL); - } - continue; - } - - if (strcmp(key, "RUN") == 0) { - rule_add_key(&rule_tmp, TK_A_RUN, op, value, NULL); - continue; - } - - if (strcmp(key, "WAIT_FOR") == 0 || strcmp(key, "WAIT_FOR_SYSFS") == 0) { - rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL); - continue; - } - - if (strcmp(key, "LABEL") == 0) { - rule_tmp.rule.rule.label_off = add_string(rules, value); - continue; - } - - if (strcmp(key, "GOTO") == 0) { - rule_add_key(&rule_tmp, TK_A_GOTO, 0, value, NULL); - continue; - } - - if (strncmp(key, "NAME", sizeof("NAME")-1) == 0) { - if (op < OP_MATCH_MAX) { - rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL); - } else { - if (strcmp(value, "%k") == 0) { - err(rules->udev, "NAME=\"%%k\" is ignored, because it breaks kernel supplied names, " - "please remove it from %s:%u\n", filename, lineno); - continue; - } - if (value[0] == '\0') { - info(rules->udev, "NAME=\"\" is ignored, because udev will not delete any device nodes, " - "please remove it from %s:%u\n", filename, lineno); - continue; - } - rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); - } - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strncmp(key, "SYMLINK", sizeof("SYMLINK")-1) == 0) { - if (op < OP_MATCH_MAX) { - rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL); - } else { - int flag = 0; - - attr = get_key_attribute(rules->udev, key + sizeof("SYMLINK")-1); - if (attr != NULL && strstr(attr, "unique") != NULL) - flag = 1; - rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, &flag); - } - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strcmp(key, "OWNER") == 0) { - uid_t uid; - char *endptr; - - uid = strtoul(value, &endptr, 10); - if (endptr[0] == '\0') { - rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); - } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { - uid = add_uid(rules, value); - rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); - } else if (rules->resolve_names >= 0) { - rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL); - } - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strcmp(key, "GROUP") == 0) { - gid_t gid; - char *endptr; - - gid = strtoul(value, &endptr, 10); - if (endptr[0] == '\0') { - rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); - } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { - gid = add_gid(rules, value); - rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); - } else if (rules->resolve_names >= 0) { - rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL); - } - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strcmp(key, "MODE") == 0) { - mode_t mode; - char *endptr; - - mode = strtol(value, &endptr, 8); - if (endptr[0] == '\0') - rule_add_key(&rule_tmp, TK_A_MODE_ID, op, NULL, &mode); - else - rule_add_key(&rule_tmp, TK_A_MODE, op, value, NULL); - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strcmp(key, "OPTIONS") == 0) { - const char *pos; - - pos = strstr(value, "link_priority="); - if (pos != NULL) { - int prio = atoi(&pos[strlen("link_priority=")]); - - rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); - dbg(rules->udev, "link priority=%i\n", prio); - } - - pos = strstr(value, "event_timeout="); - if (pos != NULL) { - int tout = atoi(&pos[strlen("event_timeout=")]); - - rule_add_key(&rule_tmp, TK_M_EVENT_TIMEOUT, op, NULL, &tout); - dbg(rules->udev, "event timeout=%i\n", tout); - } - - pos = strstr(value, "string_escape="); - if (pos != NULL) { - pos = &pos[strlen("string_escape=")]; - if (strncmp(pos, "none", strlen("none")) == 0) - rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_NONE, op, NULL, NULL); - else if (strncmp(pos, "replace", strlen("replace")) == 0) - rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, op, NULL, NULL); - } - - pos = strstr(value, "db_persist"); - if (pos != NULL) - rule_add_key(&rule_tmp, TK_A_DB_PERSIST, op, NULL, NULL); - - pos = strstr(value, "nowatch"); - if (pos != NULL) { - const int off = 0; - - rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &off); - dbg(rules->udev, "inotify watch of device disabled\n"); - } else { - pos = strstr(value, "watch"); - if (pos != NULL) { - const int on = 1; - - rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &on); - dbg(rules->udev, "inotify watch of device requested\n"); - } - } - - pos = strstr(value, "static_node="); - if (pos != NULL) { - rule_add_key(&rule_tmp, TK_A_STATIC_NODE, op, &pos[strlen("static_node=")], NULL); - rule_tmp.rule.rule.has_static_node = true; - } - - continue; - } - - err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); - goto invalid; - } - - /* add rule token */ - rule_tmp.rule.rule.token_count = 1 + rule_tmp.token_cur; - if (add_token(rules, &rule_tmp.rule) != 0) - goto invalid; - - /* add tokens to list, sorted by type */ - if (sort_token(rules, &rule_tmp) != 0) - goto invalid; - - return 0; -invalid: - err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); - return -1; -} - -static int parse_file(struct udev_rules *rules, const char *filename, unsigned short filename_off) -{ - FILE *f; - unsigned int first_token; - char line[UTIL_LINE_SIZE]; - int line_nr = 0; - unsigned int i; - - info(rules->udev, "reading '%s' as rules file\n", filename); - - f = fopen(filename, "r"); - if (f == NULL) - return -1; - - first_token = rules->token_cur; - - while (fgets(line, sizeof(line), f) != NULL) { - char *key; - size_t len; - - /* skip whitespace */ - line_nr++; - key = line; - while (isspace(key[0])) - key++; - - /* comment */ - if (key[0] == '#') - continue; - - len = strlen(line); - if (len < 3) - continue; - - /* continue reading if backslash+newline is found */ - while (line[len-2] == '\\') { - if (fgets(&line[len-2], (sizeof(line)-len)+2, f) == NULL) - break; - if (strlen(&line[len-2]) < 2) - break; - line_nr++; - len = strlen(line); - } - - if (len+1 >= sizeof(line)) { - err(rules->udev, "line too long '%s':%u, ignored\n", filename, line_nr); - continue; - } - add_rule(rules, key, filename, filename_off, line_nr); - } - fclose(f); - - /* link GOTOs to LABEL rules in this file to be able to fast-forward */ - for (i = first_token+1; i < rules->token_cur; i++) { - if (rules->tokens[i].type == TK_A_GOTO) { - char *label = &rules->buf[rules->tokens[i].key.value_off]; - unsigned int j; - - for (j = i+1; j < rules->token_cur; j++) { - if (rules->tokens[j].type != TK_RULE) - continue; - if (rules->tokens[j].rule.label_off == 0) - continue; - if (strcmp(label, &rules->buf[rules->tokens[j].rule.label_off]) != 0) - continue; - rules->tokens[i].key.rule_goto = j; - break; - } - if (rules->tokens[i].key.rule_goto == 0) - err(rules->udev, "GOTO '%s' has no matching label in: '%s'\n", label, filename); - } - } - return 0; -} - -static int add_matching_files(struct udev *udev, struct udev_list *file_list, const char *dirname, const char *suffix) -{ - DIR *dir; - struct dirent *dent; - char filename[UTIL_PATH_SIZE]; - - dbg(udev, "open directory '%s'\n", dirname); - dir = opendir(dirname); - if (dir == NULL) { - info(udev, "unable to open '%s': %m\n", dirname); - return -1; - } - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - if (dent->d_name[0] == '.') - continue; - - /* look for file matching with specified suffix */ - if (suffix != NULL) { - const char *ext; - - ext = strrchr(dent->d_name, '.'); - if (ext == NULL) - continue; - if (strcmp(ext, suffix) != 0) - continue; - } - util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL); - dbg(udev, "put file '%s' into list\n", filename); - /* - * the basename is the key, the filename the value - * identical basenames from different directories overwrite each other - * entries are sorted after basename - */ - udev_list_entry_add(file_list, dent->d_name, filename); - } - - closedir(dir); - return 0; -} - -struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) -{ - struct udev_rules *rules; - struct udev_list file_list; - struct udev_list_entry *file_loop; - struct token end_token; - char **s; - - rules = calloc(1, sizeof(struct udev_rules)); - if (rules == NULL) - return NULL; - rules->udev = udev; - rules->resolve_names = resolve_names; - udev_list_init(udev, &file_list, true); - - /* init token array and string buffer */ - rules->tokens = malloc(PREALLOC_TOKEN * sizeof(struct token)); - if (rules->tokens == NULL) { - free(rules); - return NULL; - } - rules->token_max = PREALLOC_TOKEN; - - rules->buf = malloc(PREALLOC_STRBUF); - if (rules->buf == NULL) { - free(rules->tokens); - free(rules); - return NULL; - } - rules->buf_max = PREALLOC_STRBUF; - /* offset 0 is always '\0' */ - rules->buf[0] = '\0'; - rules->buf_cur = 1; - dbg(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", - rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); - - rules->trie_nodes = malloc(PREALLOC_TRIE * sizeof(struct trie_node)); - if (rules->trie_nodes == NULL) { - free(rules->buf); - free(rules->tokens); - free(rules); - return NULL; - } - rules->trie_nodes_max = PREALLOC_TRIE; - /* offset 0 is the trie root, with an empty string */ - memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); - rules->trie_nodes_cur = 1; - - for (udev_get_rules_path(udev, &s, NULL); *s != NULL; s++) - add_matching_files(udev, &file_list, *s, ".rules"); - - /* add all filenames to the string buffer */ - udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { - const char *filename = udev_list_entry_get_value(file_loop); - unsigned int filename_off; - - filename_off = add_string(rules, filename); - /* the offset in the rule is limited to unsigned short */ - if (filename_off < USHRT_MAX) - udev_list_entry_set_num(file_loop, filename_off); - } - - /* parse all rules files */ - udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { - const char *filename = udev_list_entry_get_value(file_loop); - unsigned int filename_off = udev_list_entry_get_num(file_loop); - struct stat st; - - if (stat(filename, &st) != 0) { - err(udev, "can not find '%s': %m\n", filename); - continue; - } - if (S_ISREG(st.st_mode) && st.st_size <= 0) { - info(udev, "ignore empty '%s'\n", filename); - continue; - } - if (S_ISCHR(st.st_mode)) { - info(udev, "ignore masked '%s'\n", filename); - continue; - } - parse_file(rules, filename, filename_off); - } - udev_list_cleanup(&file_list); - - memset(&end_token, 0x00, sizeof(struct token)); - end_token.type = TK_END; - add_token(rules, &end_token); - - /* shrink allocated token and string buffer */ - if (rules->token_cur < rules->token_max) { - struct token *tokens; - - tokens = realloc(rules->tokens, rules->token_cur * sizeof(struct token)); - if (tokens != NULL || rules->token_cur == 0) { - rules->tokens = tokens; - rules->token_max = rules->token_cur; - } - } - if (rules->buf_cur < rules->buf_max) { - char *buf; - - buf = realloc(rules->buf, rules->buf_cur); - if (buf != NULL || rules->buf_cur == 0) { - rules->buf = buf; - rules->buf_max = rules->buf_cur; - } - } - info(udev, "rules use %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", - rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); - info(udev, "temporary index used %zu bytes (%u * %zu bytes)\n", - rules->trie_nodes_cur * sizeof(struct trie_node), - rules->trie_nodes_cur, sizeof(struct trie_node)); - - /* cleanup trie */ - free(rules->trie_nodes); - rules->trie_nodes = NULL; - rules->trie_nodes_cur = 0; - rules->trie_nodes_max = 0; - - /* cleanup uid/gid cache */ - free(rules->uids); - rules->uids = NULL; - rules->uids_cur = 0; - rules->uids_max = 0; - free(rules->gids); - rules->gids = NULL; - rules->gids_cur = 0; - rules->gids_max = 0; - - dump_rules(rules); - return rules; -} - -struct udev_rules *udev_rules_unref(struct udev_rules *rules) -{ - if (rules == NULL) - return NULL; - free(rules->tokens); - free(rules->buf); - free(rules->trie_nodes); - free(rules->uids); - free(rules->gids); - free(rules); - return NULL; -} - -static int match_key(struct udev_rules *rules, struct token *token, const char *val) -{ - char *key_value = &rules->buf[token->key.value_off]; - char *pos; - bool match = false; - - if (val == NULL) - val = ""; - - switch (token->key.glob) { - case GL_PLAIN: - match = (strcmp(key_value, val) == 0); - break; - case GL_GLOB: - match = (fnmatch(key_value, val, 0) == 0); - break; - case GL_SPLIT: - { - const char *split; - size_t len; - - split = &rules->buf[token->key.value_off]; - len = strlen(val); - for (;;) { - const char *next; - - next = strchr(split, '|'); - if (next != NULL) { - size_t matchlen = (size_t)(next - split); - - match = (matchlen == len && strncmp(split, val, matchlen) == 0); - if (match) - break; - } else { - match = (strcmp(split, val) == 0); - break; - } - split = &next[1]; - } - break; - } - case GL_SPLIT_GLOB: - { - char value[UTIL_PATH_SIZE]; - - util_strscpy(value, sizeof(value), &rules->buf[token->key.value_off]); - key_value = value; - while (key_value != NULL) { - pos = strchr(key_value, '|'); - if (pos != NULL) { - pos[0] = '\0'; - pos = &pos[1]; - } - dbg(rules->udev, "match %s '%s' <-> '%s'\n", token_str(token->type), key_value, val); - match = (fnmatch(key_value, val, 0) == 0); - if (match) - break; - key_value = pos; - } - break; - } - case GL_SOMETHING: - match = (val[0] != '\0'); - break; - case GL_UNSET: - return -1; - } - - if (match && (token->key.op == OP_MATCH)) { - dbg(rules->udev, "%s is true (matching value)\n", token_str(token->type)); - return 0; - } - if (!match && (token->key.op == OP_NOMATCH)) { - dbg(rules->udev, "%s is true (non-matching value)\n", token_str(token->type)); - return 0; - } - dbg(rules->udev, "%s is not true\n", token_str(token->type)); - return -1; -} - -static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur) -{ - const char *name; - char nbuf[UTIL_NAME_SIZE]; - const char *value; - char vbuf[UTIL_NAME_SIZE]; - size_t len; - - name = &rules->buf[cur->key.attr_off]; - switch (cur->key.attrsubst) { - case SB_FORMAT: - udev_event_apply_format(event, name, nbuf, sizeof(nbuf)); - name = nbuf; - /* fall through */ - case SB_NONE: - value = udev_device_get_sysattr_value(dev, name); - if (value == NULL) - return -1; - break; - case SB_SUBSYS: - if (util_resolve_subsys_kernel(event->udev, name, vbuf, sizeof(vbuf), 1) != 0) - return -1; - value = vbuf; - break; - default: - return -1; - } - - /* remove trailing whitespace, if not asked to match for it */ - len = strlen(value); - if (len > 0 && isspace(value[len-1])) { - const char *key_value; - size_t klen; - - key_value = &rules->buf[cur->key.value_off]; - klen = strlen(key_value); - if (klen > 0 && !isspace(key_value[klen-1])) { - if (value != vbuf) { - util_strscpy(vbuf, sizeof(vbuf), value); - value = vbuf; - } - while (len > 0 && isspace(vbuf[--len])) - vbuf[len] = '\0'; - dbg(rules->udev, "removed trailing whitespace from '%s'\n", value); - } - } - - return match_key(rules, cur, value); -} - -enum escape_type { - ESCAPE_UNSET, - ESCAPE_NONE, - ESCAPE_REPLACE, -}; - -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask) -{ - struct token *cur; - struct token *rule; - enum escape_type esc = ESCAPE_UNSET; - bool can_set_name; - - if (rules->tokens == NULL) - return -1; - - can_set_name = ((strcmp(udev_device_get_action(event->dev), "remove") != 0) && - (major(udev_device_get_devnum(event->dev)) > 0 || - udev_device_get_ifindex(event->dev) > 0)); - - /* loop through token list, match, run actions or forward to next rule */ - cur = &rules->tokens[0]; - rule = cur; - for (;;) { - dump_token(rules, cur); - switch (cur->type) { - case TK_RULE: - /* current rule */ - rule = cur; - /* possibly skip rules which want to set NAME, SYMLINK, OWNER, GROUP, MODE */ - if (!can_set_name && rule->rule.can_set_name) - goto nomatch; - esc = ESCAPE_UNSET; - break; - case TK_M_ACTION: - if (match_key(rules, cur, udev_device_get_action(event->dev)) != 0) - goto nomatch; - break; - case TK_M_DEVPATH: - if (match_key(rules, cur, udev_device_get_devpath(event->dev)) != 0) - goto nomatch; - break; - case TK_M_KERNEL: - if (match_key(rules, cur, udev_device_get_sysname(event->dev)) != 0) - goto nomatch; - break; - case TK_M_DEVLINK: { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - struct udev_list_entry *list_entry; - bool match = false; - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { - const char *devlink; - - devlink = &udev_list_entry_get_name(list_entry)[devlen]; - if (match_key(rules, cur, devlink) == 0) { - match = true; - break; - } - } - if (!match) - goto nomatch; - break; - } - case TK_M_NAME: - if (match_key(rules, cur, event->name) != 0) - goto nomatch; - break; - case TK_M_ENV: { - const char *key_name = &rules->buf[cur->key.attr_off]; - const char *value; - - value = udev_device_get_property_value(event->dev, key_name); - if (value == NULL) { - dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); - value = ""; - } - if (match_key(rules, cur, value)) - goto nomatch; - break; - } - case TK_M_TAG: { - struct udev_list_entry *list_entry; - bool match = false; - - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) { - if (strcmp(&rules->buf[cur->key.value_off], udev_list_entry_get_name(list_entry)) == 0) { - match = true; - break; - } - } - if (!match && (cur->key.op != OP_NOMATCH)) - goto nomatch; - break; - } - case TK_M_SUBSYSTEM: - if (match_key(rules, cur, udev_device_get_subsystem(event->dev)) != 0) - goto nomatch; - break; - case TK_M_DRIVER: - if (match_key(rules, cur, udev_device_get_driver(event->dev)) != 0) - goto nomatch; - break; - case TK_M_WAITFOR: { - char filename[UTIL_PATH_SIZE]; - int found; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); - found = (wait_for_file(event->dev, filename, 10) == 0); - if (!found && (cur->key.op != OP_NOMATCH)) - goto nomatch; - break; - } - case TK_M_ATTR: - if (match_attr(rules, event->dev, event, cur) != 0) - goto nomatch; - break; - case TK_M_KERNELS: - case TK_M_SUBSYSTEMS: - case TK_M_DRIVERS: - case TK_M_ATTRS: - case TK_M_TAGS: { - struct token *next; - - /* get whole sequence of parent matches */ - next = cur; - while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX) - next++; - - /* loop over parents */ - event->dev_parent = event->dev; - for (;;) { - struct token *key; - - dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); - /* loop over sequence of parent match keys */ - for (key = cur; key < next; key++ ) { - dump_token(rules, key); - switch(key->type) { - case TK_M_KERNELS: - if (match_key(rules, key, udev_device_get_sysname(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_SUBSYSTEMS: - if (match_key(rules, key, udev_device_get_subsystem(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_DRIVERS: - if (match_key(rules, key, udev_device_get_driver(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_ATTRS: - if (match_attr(rules, event->dev_parent, event, key) != 0) - goto try_parent; - break; - case TK_M_TAGS: { - bool match = udev_device_has_tag(event->dev_parent, &rules->buf[cur->key.value_off]); - - if (match && key->key.op == OP_NOMATCH) - goto try_parent; - if (!match && key->key.op == OP_MATCH) - goto try_parent; - break; - } - default: - goto nomatch; - } - dbg(event->udev, "parent key matched\n"); - } - dbg(event->udev, "all parent keys matched\n"); - break; - - try_parent: - event->dev_parent = udev_device_get_parent(event->dev_parent); - if (event->dev_parent == NULL) - goto nomatch; - } - /* move behind our sequence of parent match keys */ - cur = next; - continue; - } - case TK_M_TEST: { - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; - int match; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); - if (util_resolve_subsys_kernel(event->udev, filename, filename, sizeof(filename), 0) != 0) { - if (filename[0] != '/') { - char tmp[UTIL_PATH_SIZE]; - - util_strscpy(tmp, sizeof(tmp), filename); - util_strscpyl(filename, sizeof(filename), - udev_device_get_syspath(event->dev), "/", tmp, NULL); - } - } - attr_subst_subdir(filename, sizeof(filename)); - - match = (stat(filename, &statbuf) == 0); - dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); - if (match && cur->key.mode > 0) { - match = ((statbuf.st_mode & cur->key.mode) > 0); - dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, - match ? "matches" : "does not match", cur->key.mode); - } - if (match && cur->key.op == OP_NOMATCH) - goto nomatch; - if (!match && cur->key.op == OP_MATCH) - goto nomatch; - break; - } - case TK_M_EVENT_TIMEOUT: - info(event->udev, "OPTIONS event_timeout=%u\n", cur->key.event_timeout); - event->timeout_usec = cur->key.event_timeout * 1000 * 1000; - break; - case TK_M_PROGRAM: { - char program[UTIL_PATH_SIZE]; - char **envp; - char result[UTIL_PATH_SIZE]; - - free(event->program_result); - event->program_result = NULL; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], program, sizeof(program)); - envp = udev_device_get_properties_envp(event->dev); - info(event->udev, "PROGRAM '%s' %s:%u\n", - program, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - - if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } else { - int count; - - util_remove_trailing_chars(result, '\n'); - if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - } - event->program_result = strdup(result); - dbg(event->udev, "storing result '%s'\n", event->program_result); - if (cur->key.op == OP_NOMATCH) - goto nomatch; - } - break; - } - case TK_M_IMPORT_FILE: { - char import[UTIL_PATH_SIZE]; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - if (import_file_into_properties(event->dev, import) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_IMPORT_PROG: { - char import[UTIL_PATH_SIZE]; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - info(event->udev, "IMPORT '%s' %s:%u\n", - import, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - - if (import_program_into_properties(event, import, sigmask) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_IMPORT_BUILTIN: { - char command[UTIL_PATH_SIZE]; - - if (udev_builtin_run_once(cur->key.builtin_cmd)) { - /* check if we ran already */ - if (event->builtin_run & (1 << cur->key.builtin_cmd)) { - info(event->udev, "IMPORT builtin skip '%s' %s:%u\n", - udev_builtin_name(cur->key.builtin_cmd), - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - /* return the result from earlier run */ - if (event->builtin_ret & (1 << cur->key.builtin_cmd)) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - /* mark as ran */ - event->builtin_run |= (1 << cur->key.builtin_cmd); - } - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], command, sizeof(command)); - info(event->udev, "IMPORT builtin '%s' %s:%u\n", - udev_builtin_name(cur->key.builtin_cmd), - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - - if (udev_builtin_run(event->dev, cur->key.builtin_cmd, command, false) != 0) { - /* remember failure */ - info(rules->udev, "IMPORT builtin '%s' returned non-zero\n", - udev_builtin_name(cur->key.builtin_cmd)); - event->builtin_ret |= (1 << cur->key.builtin_cmd); - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } - break; - } - case TK_M_IMPORT_DB: { - const char *key = &rules->buf[cur->key.value_off]; - const char *value; - - value = udev_device_get_property_value(event->dev_db, key); - if (value != NULL) { - struct udev_list_entry *entry; - - entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_num(entry, true); - } else { - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } - break; - } - case TK_M_IMPORT_CMDLINE: { - FILE *f; - bool imported = false; - - f = fopen("/proc/cmdline", "r"); - if (f != NULL) { - char cmdline[4096]; - - if (fgets(cmdline, sizeof(cmdline), f) != NULL) { - const char *key = &rules->buf[cur->key.value_off]; - char *pos; - - pos = strstr(cmdline, key); - if (pos != NULL) { - struct udev_list_entry *entry; - - pos += strlen(key); - if (pos[0] == '\0' || isspace(pos[0])) { - /* we import simple flags as 'FLAG=1' */ - entry = udev_device_add_property(event->dev, key, "1"); - udev_list_entry_set_num(entry, true); - imported = true; - } else if (pos[0] == '=') { - const char *value; - - pos++; - value = pos; - while (pos[0] != '\0' && !isspace(pos[0])) - pos++; - pos[0] = '\0'; - entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_num(entry, true); - imported = true; - } - } - } - fclose(f); - } - if (!imported && cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_IMPORT_PARENT: { - char import[UTIL_PATH_SIZE]; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - if (import_parent_into_properties(event->dev, import) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_RESULT: - if (match_key(rules, cur, event->program_result) != 0) - goto nomatch; - break; - case TK_A_STRING_ESCAPE_NONE: - esc = ESCAPE_NONE; - break; - case TK_A_STRING_ESCAPE_REPLACE: - esc = ESCAPE_REPLACE; - break; - case TK_A_DB_PERSIST: - udev_device_set_db_persist(event->dev); - break; - case TK_A_INOTIFY_WATCH: - if (event->inotify_watch_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->inotify_watch_final = true; - event->inotify_watch = cur->key.watch; - break; - case TK_A_DEVLINK_PRIO: - udev_device_set_devlink_priority(event->dev, cur->key.devlink_prio); - break; - case TK_A_OWNER: { - char owner[UTIL_NAME_SIZE]; - - if (event->owner_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->owner_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); - event->uid = util_lookup_user(event->udev, owner); - info(event->udev, "OWNER %u %s:%u\n", - event->uid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - } - case TK_A_GROUP: { - char group[UTIL_NAME_SIZE]; - - if (event->group_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->group_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); - event->gid = util_lookup_group(event->udev, group); - info(event->udev, "GROUP %u %s:%u\n", - event->gid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - } - case TK_A_MODE: { - char mode_str[UTIL_NAME_SIZE]; - mode_t mode; - char *endptr; - - if (event->mode_final) - break; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode_str, sizeof(mode_str)); - mode = strtol(mode_str, &endptr, 8); - if (endptr[0] != '\0') { - err(event->udev, "ignoring invalid mode '%s'\n", mode_str); - break; - } - if (cur->key.op == OP_ASSIGN_FINAL) - event->mode_final = true; - event->mode_set = true; - event->mode = mode; - info(event->udev, "MODE %#o %s:%u\n", - event->mode, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - } - case TK_A_OWNER_ID: - if (event->owner_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->owner_final = true; - event->uid = cur->key.uid; - info(event->udev, "OWNER %u %s:%u\n", - event->uid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - case TK_A_GROUP_ID: - if (event->group_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->group_final = true; - event->gid = cur->key.gid; - info(event->udev, "GROUP %u %s:%u\n", - event->gid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - case TK_A_MODE_ID: - if (event->mode_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->mode_final = true; - event->mode_set = true; - event->mode = cur->key.mode; - info(event->udev, "MODE %#o %s:%u\n", - event->mode, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - case TK_A_ENV: { - const char *name = &rules->buf[cur->key.attr_off]; - char *value = &rules->buf[cur->key.value_off]; - - if (value[0] != '\0') { - char temp_value[UTIL_NAME_SIZE]; - struct udev_list_entry *entry; - - udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); - entry = udev_device_add_property(event->dev, name, temp_value); - /* store in db, skip private keys */ - if (name[0] != '.') - udev_list_entry_set_num(entry, true); - } else { - udev_device_add_property(event->dev, name, NULL); - } - break; - } - case TK_A_TAG: { - char tag[UTIL_PATH_SIZE]; - const char *p; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], tag, sizeof(tag)); - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_device_cleanup_tags_list(event->dev); - for (p = tag; *p != '\0'; p++) { - if ((*p >= 'a' && *p <= 'z') || - (*p >= 'A' && *p <= 'Z') || - (*p >= '0' && *p <= '9') || - *p == '-' || *p == '_') - continue; - err(event->udev, "ignoring invalid tag name '%s'\n", tag); - break; - } - udev_device_add_tag(event->dev, tag); - break; - } - case TK_A_NAME: { - const char *name = &rules->buf[cur->key.value_off]; - char name_str[UTIL_PATH_SIZE]; - int count; - - if (event->name_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->name_final = true; - udev_event_apply_format(event, name, name_str, sizeof(name_str)); - if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = util_replace_chars(name_str, "/"); - if (count > 0) - info(event->udev, "%i character(s) replaced\n", count); - } - free(event->name); - event->name = strdup(name_str); - info(event->udev, "NAME '%s' %s:%u\n", - event->name, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - } - case TK_A_DEVLINK: { - char temp[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - char *pos, *next; - int count = 0; - - if (event->devlink_final) - break; - if (major(udev_device_get_devnum(event->dev)) == 0) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->devlink_final = true; - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_device_cleanup_devlinks_list(event->dev); - - /* allow multiple symlinks separated by spaces */ - udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); - if (esc == ESCAPE_UNSET) - count = util_replace_chars(temp, "/ "); - else if (esc == ESCAPE_REPLACE) - count = util_replace_chars(temp, "/"); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); - pos = temp; - while (isspace(pos[0])) - pos++; - next = strchr(pos, ' '); - while (next != NULL) { - next[0] = '\0'; - info(event->udev, "LINK '%s' %s:%u\n", pos, - &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); - while (isspace(next[1])) - next++; - pos = &next[1]; - next = strchr(pos, ' '); - } - if (pos[0] != '\0') { - info(event->udev, "LINK '%s' %s:%u\n", pos, - &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); - } - break; - } - case TK_A_ATTR: { - const char *key_name = &rules->buf[cur->key.attr_off]; - char attr[UTIL_PATH_SIZE]; - char value[UTIL_NAME_SIZE]; - FILE *f; - - if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) - util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); - attr_subst_subdir(attr, sizeof(attr)); - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], value, sizeof(value)); - info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - f = fopen(attr, "w"); - if (f != NULL) { - if (fprintf(f, "%s", value) <= 0) - err(event->udev, "error writing ATTR{%s}: %m\n", attr); - fclose(f); - } else { - err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); - } - break; - } - case TK_A_RUN: { - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_list_cleanup(&event->run_list); - info(event->udev, "RUN '%s' %s:%u\n", - &rules->buf[cur->key.value_off], - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL); - break; - } - case TK_A_GOTO: - if (cur->key.rule_goto == 0) - break; - cur = &rules->tokens[cur->key.rule_goto]; - continue; - case TK_END: - return 0; - - case TK_M_PARENTS_MIN: - case TK_M_PARENTS_MAX: - case TK_M_MAX: - case TK_UNSET: - err(rules->udev, "wrong type %u\n", cur->type); - goto nomatch; - } - - cur++; - continue; - nomatch: - /* fast-forward to next rule */ - cur = rule + rule->rule.token_count; - dbg(rules->udev, "forward to rule: %u\n", - (unsigned int) (cur - rules->tokens)); - } -} - -void udev_rules_apply_static_dev_perms(struct udev_rules *rules) -{ - struct token *cur; - struct token *rule; - uid_t uid = 0; - gid_t gid = 0; - mode_t mode = 0; - - if (rules->tokens == NULL) - return; - - cur = &rules->tokens[0]; - rule = cur; - for (;;) { - switch (cur->type) { - case TK_RULE: - /* current rule */ - rule = cur; - - /* skip rules without a static_node tag */ - if (!rule->rule.has_static_node) - goto next; - - uid = 0; - gid = 0; - mode = 0; - break; - case TK_A_OWNER_ID: - uid = cur->key.uid; - break; - case TK_A_GROUP_ID: - gid = cur->key.gid; - break; - case TK_A_MODE_ID: - mode = cur->key.mode; - break; - case TK_A_STATIC_NODE: { - char filename[UTIL_PATH_SIZE]; - struct stat stats; - - /* we assure, that the permissions tokens are sorted before the static token */ - if (mode == 0 && uid == 0 && gid == 0) - goto next; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(rules->udev), "/", - &rules->buf[cur->key.value_off], NULL); - if (stat(filename, &stats) != 0) - goto next; - if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) - goto next; - if (mode == 0) { - if (gid > 0) - mode = 0660; - else - mode = 0600; - } - if (mode != (stats.st_mode & 01777)) { - chmod(filename, mode); - info(rules->udev, "chmod '%s' %#o\n", filename, mode); - } - - if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) { - chown(filename, uid, gid); - info(rules->udev, "chown '%s' %u %u\n", filename, uid, gid); - } - - utimensat(AT_FDCWD, filename, NULL, 0); - break; - } - case TK_END: - return; - } - - cur++; - continue; -next: - /* fast-forward to next rule */ - cur = rule + rule->rule.token_count; - continue; - } -} diff --git a/udev/udev-watch.c b/udev/udev-watch.c deleted file mode 100644 index 0ec8bfd627..0000000000 --- a/udev/udev-watch.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2004-2010 Kay Sievers - * Copyright (C) 2009 Canonical Ltd. - * Copyright (C) 2009 Scott James Remnant - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int inotify_fd = -1; - -/* inotify descriptor, will be shared with rules directory; - * set to cloexec since we need our children to be able to add - * watches for us - */ -int udev_watch_init(struct udev *udev) -{ - inotify_fd = inotify_init1(IN_CLOEXEC); - if (inotify_fd < 0) - err(udev, "inotify_init failed: %m\n"); - return inotify_fd; -} - -/* move any old watches directory out of the way, and then restore - * the watches - */ -void udev_watch_restore(struct udev *udev) -{ - char filename[UTIL_PATH_SIZE], oldname[UTIL_PATH_SIZE]; - - if (inotify_fd < 0) - return; - - util_strscpyl(oldname, sizeof(oldname), udev_get_run_path(udev), "/watch.old", NULL); - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); - if (rename(filename, oldname) == 0) { - DIR *dir; - struct dirent *ent; - - dir = opendir(oldname); - if (dir == NULL) { - err(udev, "unable to open old watches dir '%s', old watches will not be restored: %m", oldname); - return; - } - - for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) { - char device[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - struct udev_device *dev; - - if (ent->d_name[0] == '.') - continue; - - s = device; - l = util_strpcpy(&s, sizeof(device), udev_get_sys_path(udev)); - len = readlinkat(dirfd(dir), ent->d_name, s, l); - if (len <= 0 || len == (ssize_t)l) - goto unlink; - s[len] = '\0'; - - dev = udev_device_new_from_id_filename(udev, s); - if (dev == NULL) - goto unlink; - - info(udev, "restoring old watch on '%s'\n", udev_device_get_devnode(dev)); - udev_watch_begin(udev, dev); - udev_device_unref(dev); -unlink: - unlinkat(dirfd(dir), ent->d_name, 0); - } - - closedir(dir); - rmdir(oldname); - - } else if (errno != ENOENT) { - err(udev, "unable to move watches dir '%s', old watches will not be restored: %m", filename); - } -} - -void udev_watch_begin(struct udev *udev, struct udev_device *dev) -{ - char filename[UTIL_PATH_SIZE]; - int wd; - - if (inotify_fd < 0) - return; - - info(udev, "adding watch on '%s'\n", udev_device_get_devnode(dev)); - wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); - if (wd < 0) { - err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n", - inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); - return; - } - - snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); - util_create_path(udev, filename); - unlink(filename); - symlink(udev_device_get_id_filename(dev), filename); - - udev_device_set_watch_handle(dev, wd); -} - -void udev_watch_end(struct udev *udev, struct udev_device *dev) -{ - int wd; - char filename[UTIL_PATH_SIZE]; - - if (inotify_fd < 0) - return; - - wd = udev_device_get_watch_handle(dev); - if (wd < 0) - return; - - info(udev, "removing watch on '%s'\n", udev_device_get_devnode(dev)); - inotify_rm_watch(inotify_fd, wd); - - snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); - unlink(filename); - - udev_device_set_watch_handle(dev, -1); -} - -struct udev_device *udev_watch_lookup(struct udev *udev, int wd) -{ - char filename[UTIL_PATH_SIZE]; - char majmin[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - - if (inotify_fd < 0 || wd < 0) - return NULL; - - snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); - s = majmin; - l = util_strpcpy(&s, sizeof(majmin), udev_get_sys_path(udev)); - len = readlink(filename, s, l); - if (len <= 0 || (size_t)len == l) - return NULL; - s[len] = '\0'; - - return udev_device_new_from_id_filename(udev, s); -} diff --git a/udev/udev.h b/udev/udev.h deleted file mode 100644 index 56b1652c74..0000000000 --- a/udev/udev.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2003 Greg Kroah-Hartman - * Copyright (C) 2003-2010 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _UDEV_H_ -#define _UDEV_H_ - -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -struct udev_event { - struct udev *udev; - struct udev_device *dev; - struct udev_device *dev_parent; - struct udev_device *dev_db; - char *name; - char *program_result; - mode_t mode; - uid_t uid; - gid_t gid; - struct udev_list run_list; - int exec_delay; - unsigned long long birth_usec; - unsigned long long timeout_usec; - int fd_signal; - unsigned int builtin_run; - unsigned int builtin_ret; - bool sigterm; - bool inotify_watch; - bool inotify_watch_final; - bool group_final; - bool owner_final; - bool mode_set; - bool mode_final; - bool name_final; - bool devlink_final; - bool run_final; -}; - -struct udev_watch { - struct udev_list_node node; - int handle; - char *name; -}; - -/* udev-rules.c */ -struct udev_rules; -struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names); -struct udev_rules *udev_rules_unref(struct udev_rules *rules); -int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask); -void udev_rules_apply_static_dev_perms(struct udev_rules *rules); - -/* udev-event.c */ -struct udev_event *udev_event_new(struct udev_device *dev); -void udev_event_unref(struct udev_event *event); -size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size); -int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, - char *result, size_t maxsize, int read_value); -int udev_event_spawn(struct udev_event *event, - const char *cmd, char **envp, const sigset_t *sigmask, - char *result, size_t ressize); -int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); -int udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); -int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); - -/* udev-watch.c */ -int udev_watch_init(struct udev *udev); -void udev_watch_restore(struct udev *udev); -void udev_watch_begin(struct udev *udev, struct udev_device *dev); -void udev_watch_end(struct udev *udev, struct udev_device *dev); -struct udev_device *udev_watch_lookup(struct udev *udev, int wd); - -/* udev-node.c */ -int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); -int udev_node_remove(struct udev_device *dev); -void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); - -/* udev-ctrl.c */ -struct udev_ctrl; -struct udev_ctrl *udev_ctrl_new(struct udev *udev); -struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd); -int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl); -struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl); -struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl); -int udev_ctrl_cleanup(struct udev_ctrl *uctrl); -struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl); -int udev_ctrl_get_fd(struct udev_ctrl *uctrl); -int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout); -int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout); -int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout); -int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout); -struct udev_ctrl_connection; -struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl); -struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn); -struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn); -struct udev_ctrl_msg; -struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn); -struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg); -struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg); -const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg); -int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); - -/* built-in commands */ -enum udev_builtin_cmd { - UDEV_BUILTIN_BLKID, - UDEV_BUILTIN_FIRMWARE, - UDEV_BUILTIN_INPUT_ID, - UDEV_BUILTIN_KMOD, - UDEV_BUILTIN_PATH_ID, - UDEV_BUILTIN_PCI_DB, - UDEV_BUILTIN_USB_DB, - UDEV_BUILTIN_USB_ID, - UDEV_BUILTIN_MAX -}; -struct udev_builtin { - const char *name; - int (*cmd)(struct udev_device *dev, int argc, char *argv[], bool test); - const char *help; - int (*init)(struct udev *udev); - void (*exit)(struct udev *udev); - bool (*validate)(struct udev *udev); - bool run_once; -}; -extern const struct udev_builtin udev_builtin_blkid; -extern const struct udev_builtin udev_builtin_firmware; -extern const struct udev_builtin udev_builtin_input_id; -extern const struct udev_builtin udev_builtin_kmod; -extern const struct udev_builtin udev_builtin_path_id; -extern const struct udev_builtin udev_builtin_pci_db; -extern const struct udev_builtin udev_builtin_usb_db; -extern const struct udev_builtin udev_builtin_usb_id; -int udev_builtin_init(struct udev *udev); -void udev_builtin_exit(struct udev *udev); -enum udev_builtin_cmd udev_builtin_lookup(const char *command); -const char *udev_builtin_name(enum udev_builtin_cmd cmd); -bool udev_builtin_run_once(enum udev_builtin_cmd cmd); -int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test); -void udev_builtin_list(struct udev *udev); -int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val); - -/* udev logging */ -void udev_main_log(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args); - -/* udevadm commands */ -struct udevadm_cmd { - const char *name; - int (*cmd)(struct udev *udev, int argc, char *argv[]); - const char *help; - int debug; -}; -extern const struct udevadm_cmd udevadm_info; -extern const struct udevadm_cmd udevadm_trigger; -extern const struct udevadm_cmd udevadm_settle; -extern const struct udevadm_cmd udevadm_control; -extern const struct udevadm_cmd udevadm_monitor; -extern const struct udevadm_cmd udevadm_test; -extern const struct udevadm_cmd udevadm_test_builtin; -#endif diff --git a/udev/udev.pc.in b/udev/udev.pc.in deleted file mode 100644 index 0b04c02ef6..0000000000 --- a/udev/udev.pc.in +++ /dev/null @@ -1,5 +0,0 @@ -Name: udev -Description: udev -Version: @VERSION@ - -udevdir=@pkglibexecdir@ diff --git a/udev/udev.xml b/udev/udev.xml deleted file mode 100644 index 79213b4bbe..0000000000 --- a/udev/udev.xml +++ /dev/null @@ -1,694 +0,0 @@ - - - - - - - udev - udev - - - - udev - 7 - - - - udev - Linux dynamic device management - - - Description - udev supplies the system software with device events, manages permissions - of device nodes and may create additional symlinks in the /dev - directory, or renames network interfaces. The kernel usually just assigns unpredictable - device names based on the order of discovery. Meaningful symlinks or network device - names provide a way to reliably identify devices based on their properties or - current configuration. - - The udev daemon, udevd - 8, receives device uevents directly from - the kernel whenever a device is added or removed from the system, or it changes its - state. When udev receives a device event, it matches its configured set of rules - against various device attributes to identify the device. Rules that match may - provide additional device information to be stored in the udev database or - to be used to create meaningful symlink names. - - All device information udev processes is stored in the udev database and - sent out to possible event subscribers. Access to all stored data and the event - sources is provided by the library libudev. - - - Configuration - udev configuration files are placed in /etc/udev - and /usr/lib/udev. All empty lines or lines beginning with - '#' are ignored. - - Configuration file - udev expects its main configuration file at /etc/udev/udev.conf. - It consists of a set of variables allowing the user to override default udev values. - The following variables can be set: - - - - - Specifies where to place the device nodes in the filesystem. - The default value is /dev. - - - - - - - The logging priority. Valid values are the numerical syslog priorities - or their textual representations: , - and . - - - - - - Rules files - The udev rules are read from the files located in the - system rules directory /usr/lib/udev/rules.d, - the local administration directory /etc/udev/rules.d - and the volatile runtime directory /run/udev/rules.d. - All rules files are collectively sorted and processed in lexical order, - regardless of the directories in which they live. However, files with - identical file names replace each other. Files in /run - have the highest priority, files in /etc take precedence - over files with the same name in /lib. This can be - used to overwrite a system rules file if needed; a symlink in - /etc with the same name as a rules file in - /lib, pointing to /dev/null, - disables the rules file entirely. - - Rule files must have the extension .rules; other - extensions are ignored. - - Every line in the rules file contains at least one key-value pair. - There are two kind of keys: match and assignment. - If all match keys are matching against its value, the rule gets applied and the - assignment keys get the specified value assigned. - - A matching rule may rename a network interface, add symlinks - pointing to the device node, or run a specified program as part of - the event handling. - - A rule consists of a comma-separated list of one or more key-value pairs. - Each key has a distinct operation, depending on the used operator. Valid - operators are: - - - - - Compare for equality. - - - - - - - Compare for inequality. - - - - - - - Assign a value to a key. Keys that represent a list are reset - and only this single value is assigned. - - - - - - - Add the value to a key that holds a list of entries. - - - - - - - Assign a value to a key finally; disallow any later changes. - - - - - The following key names can be used to match against device properties. - Some of the keys also match against properties of the parent devices in sysfs, - not only the device that has generated the event. If multiple keys that match - a parent device are specified in a single rule, all these keys must match at - one and the same parent device. - - - - - Match the name of the event action. - - - - - - - Match the devpath of the event device. - - - - - - - Match the name of the event device. - - - - - - - Match the name of a network interface. It can be used once the - NAME key has been set in one of the preceding rules. - - - - - - - Match the name of a symlink targeting the node. It can - be used once a SYMLINK key has been set in one of the preceding - rules. There may be multiple symlinks; only one needs to match. - - - - - - - - Match the subsystem of the event device. - - - - - - Match the driver name of the event device. Only set this key for devices - which are bound to a driver at the time the event is generated. - - - - - - Match sysfs attribute values of the event device. Trailing - whitespace in the attribute values is ignored unless the specified match - value itself contains trailing whitespace. - - - - - - - - Search the devpath upwards for a matching device name. - - - - - - - Search the devpath upwards for a matching device subsystem name. - - - - - - - Search the devpath upwards for a matching device driver name. - - - - - - - Search the devpath upwards for a device with matching sysfs attribute values. - If multiple matches are specified, all of them - must match on the same device. Trailing whitespace in the attribute values is ignored - unless the specified match value itself contains trailing whitespace. - - - - - - - Search the devpath upwards for a device with matching tag. - - - - - - - Match against a device property value. - - - - - - - Match against a device tag. - - - - - - - Test the existence of a file. An octal mode mask can be specified - if needed. - - - - - - - Execute a program to determine whether there - is a match; the key is true if the program returns - successfully. The device properties are made available to the - executed program in the environment. The program's stdout - is available in the RESULT key. - - - - - - - Match the returned string of the last PROGRAM call. This key can - be used in the same or in any later rule after a PROGRAM call. - - - - - Most of the fields support shell-style pattern matching. The following - pattern characters are supported: - - - - - Matches zero or more characters. - - - - - - Matches any single character. - - - - - - Matches any single character specified within the brackets. For - example, the pattern string 'tty[SR]' would match either 'ttyS' or 'ttyR'. - Ranges are also supported via the '-' character. - For example, to match on the range of all digits, the pattern [0-9] could - be used. If the first character following the '[' is a '!', any characters - not enclosed are matched. - - - - - The following keys can get values assigned: - - - - - The name to use for a network interface. The name of a device node - can not be changed by udev, only additional symlinks can be created. - - - - - - - The name of a symlink targeting the node. Every matching rule adds - this value to the list of symlinks to be created. Multiple symlinks may be - specified by separating the names by the space character. In case multiple - devices claim the same name, the link always points to the device with - the highest link_priority. If the current device goes away, the links are - re-evaluated and the device with the next highest link_priority becomes the owner of - the link. If no link_priority is specified, the order of the devices (and - which one of them owns the link) is undefined. Also, symlink names must - never conflict with the kernel's default device node names, as that would - result in unpredictable behavior. - - - - - - - - The permissions for the device node. Every specified value overwrites - the compiled-in default value. - - - - - - - The value that should be written to a sysfs attribute of the - event device. - - - - - - - Set a device property value. Property names with a leading '.' - are neither stored in the database nor exported to events or - external tools (run by, say, the PROGRAM match key). - - - - - - - Attach a tag to a device. This is used to filter events for users - of libudev's monitor functionality, or to enumerate a group of tagged - devices. The implementation can only work efficiently if only a few - tags are attached to a device. It is only meant to be used in - contexts with specific device filter requirements, and not as a - general-purpose flag. Excessive use might result in inefficient event - handling. - - - - - - - Add a program to the list of programs to be executed for a specific - device. This can only be used for very short running tasks. Running an - event process for a long period of time may block all further events for - this or a dependent device. Long running tasks need to be immediately - detached from the event process itself. - If no absolute path is given, the program is expected to live in - /usr/lib/udev, otherwise the absolute path must be specified. The program - name and following arguments are separated by spaces. Single quotes can - be used to specify arguments with spaces. - - - - - - - A named label to which a GOTO may jump. - - - - - - - Jumps to the next LABEL with a matching name. - - - - - - - Import a set of variables as device properties, - depending on type: - - - - - Execute an external program specified as the assigned value and - import its output, which must be in environment key - format. Path specification, command/argument separation, - and quoting work like in . - - - - - - Import a text file specified as the assigned value, the content - of which must be in environment key format. - - - - - - Import a single property specified as the assigned value from the - current device database. This works only if the database is already populated - by an earlier event. - - - - - - Import a single property from the kernel command line. For simple flags - the value of the property is set to '1'. - - - - - - Import the stored keys from the parent device by reading - the database entry of the parent device. The value assigned to - is used as a filter of key names - to import (with the same shell-style pattern matching used for - comparisons). - - - - - - - - - - Wait for a file to become available or until a timeout of - 10 seconds expires. The path is relative to the sysfs device; - if no path is specified, this waits for an attribute to appear. - - - - - - - Rule and device options: - - - - - Specify the priority of the created symlinks. Devices with higher - priorities overwrite existing symlinks of other devices. The default is 0. - - - - - - Number of seconds an event waits for operations to finish before - giving up and terminating itself. - - - - - - Usually control and other possibly unsafe characters are replaced - in strings used for device naming. The mode of replacement can be specified - with this option. - - - - - - Apply the permissions specified in this rule to the static device node with - the specified name. Static device nodes might be provided by kernel modules - or copied from /usr/lib/udev/devices. These nodes might not have - a corresponding kernel device at the time udevd is started; they can trigger - automatic kernel module loading. - - - - - - Watch the device node with inotify; when the node is closed after being opened for - writing, a change uevent is synthesized. - - - - - - Disable the watching of a device node with inotify. - - - - - - - - The , , , - , , and - fields support simple string substitutions. The - substitutions are performed after all rules have been processed, right before the program - is executed, allowing for the use of device properties set by earlier matching - rules. For all other fields, substitutions are performed while the individual rule is - being processed. The available substitutions are: - - - , - - The kernel name for this device. - - - - - , - - The kernel number for this device. For example, 'sda3' has - kernel number of '3' - - - - - , - - The devpath of the device. - - - - - , - - The name of the device matched while searching the devpath upwards for - , , and . - - - - - - - - The driver name of the device matched while searching the devpath upwards for - , , and . - - - - - - , - - The value of a sysfs attribute found at the device where - all keys of the rule have matched. If the matching device does not have - such an attribute, and a previous KERNELS, SUBSYSTEMS, DRIVERS, or - ATTRS test selected a parent device, then the attribute from that - parent device is used. - If the attribute is a symlink, the last element of the symlink target is - returned as the value. - - - - - , - - A device property value. - - - - - , - - The kernel major number for the device. - - - - - , - - The kernel minor number for the device. - - - - - , - - The string returned by the external program requested with PROGRAM. - A single part of the string, separated by a space character, may be selected - by specifying the part number as an attribute: . - If the number is followed by the '+' character, this part plus all remaining parts - of the result string are substituted: - - - - - , - - The node name of the parent device. - - - - - - - The current name of the device. If not changed by a rule, it is the - name of the kernel device. - - - - - - - A space-separated list of the current symlinks. The value is - only set during a remove event or if an earlier rule assigned a value. - - - - - , - - The udev_root value. - - - - - , - - The sysfs mount point. - - - - - , - - The name of the device node. - - - - - - - The '%' character itself. - - - - - - - The '$' character itself. - - - - - - - Author - Written by Greg Kroah-Hartman greg@kroah.com and - Kay Sievers kay.sievers@vrfy.org. With much help from - Dan Stekloff and many others. - - - - See Also - - udevd8 - , - - udevadm8 - - - diff --git a/udev/udevadm-control.c b/udev/udevadm-control.c deleted file mode 100644 index dd1d5d783f..0000000000 --- a/udev/udevadm-control.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright (C) 2005-2011 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static void print_help(void) -{ - printf("Usage: udevadm control COMMAND\n" - " --exit instruct the daemon to cleanup and exit\n" - " --log-priority= set the udev log level for the daemon\n" - " --stop-exec-queue do not execute events, queue only\n" - " --start-exec-queue execute events, flush queue\n" - " --reload reload rules and databases\n" - " --property== set a global property for all events\n" - " --children-max= maximum number of children\n" - " --timeout= maximum time to block for a reply\n" - " --help print this help text\n\n"); -} - -static int adm_control(struct udev *udev, int argc, char *argv[]) -{ - struct udev_ctrl *uctrl = NULL; - int timeout = 60; - int rc = 1; - - static const struct option options[] = { - { "exit", no_argument, NULL, 'e' }, - { "log-priority", required_argument, NULL, 'l' }, - { "stop-exec-queue", no_argument, NULL, 's' }, - { "start-exec-queue", no_argument, NULL, 'S' }, - { "reload", no_argument, NULL, 'R' }, - { "reload-rules", no_argument, NULL, 'R' }, - { "property", required_argument, NULL, 'p' }, - { "env", required_argument, NULL, 'p' }, - { "children-max", required_argument, NULL, 'm' }, - { "timeout", required_argument, NULL, 't' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - return 1; - } - - uctrl = udev_ctrl_new(udev); - if (uctrl == NULL) - return 2; - - for (;;) { - int option; - - option = getopt_long(argc, argv, "el:sSRp:m:h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'e': - if (udev_ctrl_send_exit(uctrl, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'l': { - int i; - - i = util_log_priority(optarg); - if (i < 0) { - fprintf(stderr, "invalid number '%s'\n", optarg); - goto out; - } - if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg), timeout) < 0) - rc = 2; - else - rc = 0; - break; - } - case 's': - if (udev_ctrl_send_stop_exec_queue(uctrl, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'S': - if (udev_ctrl_send_start_exec_queue(uctrl, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'R': - if (udev_ctrl_send_reload(uctrl, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'p': - if (strchr(optarg, '=') == NULL) { - fprintf(stderr, "expect = instead of '%s'\n", optarg); - goto out; - } - if (udev_ctrl_send_set_env(uctrl, optarg, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'm': { - char *endp; - int i; - - i = strtoul(optarg, &endp, 0); - if (endp[0] != '\0' || i < 1) { - fprintf(stderr, "invalid number '%s'\n", optarg); - goto out; - } - if (udev_ctrl_send_set_children_max(uctrl, i, timeout) < 0) - rc = 2; - else - rc = 0; - break; - } - case 't': { - int seconds; - - seconds = atoi(optarg); - if (seconds >= 0) - timeout = seconds; - else - fprintf(stderr, "invalid timeout value\n"); - break; - } - case 'h': - print_help(); - rc = 0; - break; - } - } - - if (argv[optind] != NULL) - fprintf(stderr, "unknown option\n"); - else if (optind == 1) - fprintf(stderr, "missing option\n"); -out: - udev_ctrl_unref(uctrl); - return rc; -} - -const struct udevadm_cmd udevadm_control = { - .name = "control", - .cmd = adm_control, - .help = "control the udev daemon", -}; diff --git a/udev/udevadm-info.c b/udev/udevadm-info.c deleted file mode 100644 index f7e7e86b6a..0000000000 --- a/udev/udevadm-info.c +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Copyright (C) 2004-2009 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static bool skip_attribute(const char *name) -{ - static const char const *skip[] = { - "uevent", - "dev", - "modalias", - "resource", - "driver", - "subsystem", - "module", - }; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(skip); i++) - if (strcmp(name, skip[i]) == 0) - return true; - return false; -} - -static void print_all_attributes(struct udev_device *device, const char *key) -{ - struct udev *udev = udev_device_get_udev(device); - struct udev_list_entry *sysattr; - - udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { - const char *name; - const char *value; - size_t len; - - name = udev_list_entry_get_name(sysattr); - if (skip_attribute(name)) - continue; - - value = udev_device_get_sysattr_value(device, name); - if (value == NULL) - continue; - dbg(udev, "attr '%s'='%s'\n", name, value); - - /* skip any values that look like a path */ - if (value[0] == '/') - continue; - - /* skip nonprintable attributes */ - len = strlen(value); - while (len > 0 && isprint(value[len-1])) - len--; - if (len > 0) { - dbg(udev, "attribute value of '%s' non-printable, skip\n", name); - continue; - } - - printf(" %s{%s}==\"%s\"\n", key, name, value); - } - printf("\n"); -} - -static int print_device_chain(struct udev_device *device) -{ - struct udev_device *device_parent; - const char *str; - - printf("\n" - "Udevadm info starts with the device specified by the devpath and then\n" - "walks up the chain of parent devices. It prints for every device\n" - "found, all possible attributes in the udev rules key format.\n" - "A rule to match, can be composed by the attributes of the device\n" - "and the attributes from one single parent device.\n" - "\n"); - - printf(" looking at device '%s':\n", udev_device_get_devpath(device)); - printf(" KERNEL==\"%s\"\n", udev_device_get_sysname(device)); - str = udev_device_get_subsystem(device); - if (str == NULL) - str = ""; - printf(" SUBSYSTEM==\"%s\"\n", str); - str = udev_device_get_driver(device); - if (str == NULL) - str = ""; - printf(" DRIVER==\"%s\"\n", str); - print_all_attributes(device, "ATTR"); - - device_parent = device; - do { - device_parent = udev_device_get_parent(device_parent); - if (device_parent == NULL) - break; - printf(" looking at parent device '%s':\n", udev_device_get_devpath(device_parent)); - printf(" KERNELS==\"%s\"\n", udev_device_get_sysname(device_parent)); - str = udev_device_get_subsystem(device_parent); - if (str == NULL) - str = ""; - printf(" SUBSYSTEMS==\"%s\"\n", str); - str = udev_device_get_driver(device_parent); - if (str == NULL) - str = ""; - printf(" DRIVERS==\"%s\"\n", str); - print_all_attributes(device_parent, "ATTRS"); - } while (device_parent != NULL); - - return 0; -} - -static void print_record(struct udev_device *device) -{ - size_t len; - const char *str; - int i; - struct udev_list_entry *list_entry; - - printf("P: %s\n", udev_device_get_devpath(device)); - - len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - str = udev_device_get_devnode(device); - if (str != NULL) - printf("N: %s\n", &str[len+1]); - - i = udev_device_get_devlink_priority(device); - if (i != 0) - printf("L: %i\n", i); - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { - len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("S: %s\n", &udev_list_entry_get_name(list_entry)[len+1]); - } - - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) - printf("E: %s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - printf("\n"); -} - -static int stat_device(const char *name, bool export, const char *prefix) -{ - struct stat statbuf; - - if (stat(name, &statbuf) != 0) - return -1; - - if (export) { - if (prefix == NULL) - prefix = "INFO_"; - printf("%sMAJOR=%d\n" - "%sMINOR=%d\n", - prefix, major(statbuf.st_dev), - prefix, minor(statbuf.st_dev)); - } else - printf("%d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); - return 0; -} - -static int export_devices(struct udev *udev) -{ - struct udev_enumerate *udev_enumerate; - struct udev_list_entry *list_entry; - - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_devices(udev_enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device != NULL) { - print_record(device); - udev_device_unref(device); - } - } - udev_enumerate_unref(udev_enumerate); - return 0; -} - -static void cleanup_dir(DIR *dir, mode_t mask, int depth) -{ - struct dirent *dent; - - if (depth <= 0) - return; - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat stats; - - if (dent->d_name[0] == '.') - continue; - if (fstatat(dirfd(dir), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) - continue; - if ((stats.st_mode & mask) != 0) - continue; - if (S_ISDIR(stats.st_mode)) { - DIR *dir2; - - dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); - if (dir2 != NULL) { - cleanup_dir(dir2, mask, depth-1); - closedir(dir2); - } - unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR); - } else { - unlinkat(dirfd(dir), dent->d_name, 0); - } - } -} - -static void cleanup_db(struct udev *udev) -{ - char filename[UTIL_PATH_SIZE]; - DIR *dir; - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/queue.bin", NULL); - unlink(filename); - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, S_ISVTX, 1); - closedir(dir); - } - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/links", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, 0, 2); - closedir(dir); - } - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, 0, 2); - closedir(dir); - } - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, 0, 1); - closedir(dir); - } - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/firmware-missing", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, 0, 1); - closedir(dir); - } -} - -static int uinfo(struct udev *udev, int argc, char *argv[]) -{ - struct udev_device *device = NULL; - bool root = 0; - bool export = 0; - const char *export_prefix = NULL; - char path[UTIL_PATH_SIZE]; - char name[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - int rc = 0; - - static const struct option options[] = { - { "name", required_argument, NULL, 'n' }, - { "path", required_argument, NULL, 'p' }, - { "query", required_argument, NULL, 'q' }, - { "attribute-walk", no_argument, NULL, 'a' }, - { "cleanup-db", no_argument, NULL, 'c' }, - { "export-db", no_argument, NULL, 'e' }, - { "root", no_argument, NULL, 'r' }, - { "run", no_argument, NULL, 'R' }, - { "device-id-of-file", required_argument, NULL, 'd' }, - { "export", no_argument, NULL, 'x' }, - { "export-prefix", required_argument, NULL, 'P' }, - { "version", no_argument, NULL, 'V' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - enum action_type { - ACTION_NONE, - ACTION_QUERY, - ACTION_ATTRIBUTE_WALK, - ACTION_ROOT, - ACTION_DEVICE_ID_FILE, - } action = ACTION_NONE; - - enum query_type { - QUERY_NONE, - QUERY_NAME, - QUERY_PATH, - QUERY_SYMLINK, - QUERY_PROPERTY, - QUERY_ALL, - } query = QUERY_NONE; - - for (;;) { - int option; - struct stat statbuf; - - option = getopt_long(argc, argv, "aced:n:p:q:rxP:RVh", options, NULL); - if (option == -1) - break; - - dbg(udev, "option '%c'\n", option); - switch (option) { - case 'n': - if (device != NULL) { - fprintf(stderr, "device already specified\n"); - rc = 2; - goto exit; - } - /* remove /dev if given */ - if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) - util_strscpyl(name, sizeof(name), udev_get_dev_path(udev), "/", optarg, NULL); - else - util_strscpy(name, sizeof(name), optarg); - util_remove_trailing_chars(name, '/'); - if (stat(name, &statbuf) < 0) { - fprintf(stderr, "device node not found\n"); - rc = 2; - goto exit; - } else { - char type; - - if (S_ISBLK(statbuf.st_mode)) { - type = 'b'; - } else if (S_ISCHR(statbuf.st_mode)) { - type = 'c'; - } else { - fprintf(stderr, "device node has wrong file type\n"); - rc = 2; - goto exit; - } - device = udev_device_new_from_devnum(udev, type, statbuf.st_rdev); - if (device == NULL) { - fprintf(stderr, "device node not found\n"); - rc = 2; - goto exit; - } - } - break; - case 'p': - if (device != NULL) { - fprintf(stderr, "device already specified\n"); - rc = 2; - goto exit; - } - /* add sys dir if needed */ - if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); - else - util_strscpy(path, sizeof(path), optarg); - util_remove_trailing_chars(path, '/'); - device = udev_device_new_from_syspath(udev, path); - if (device == NULL) { - fprintf(stderr, "device path not found\n"); - rc = 2; - goto exit; - } - break; - case 'q': - action = ACTION_QUERY; - if (strcmp(optarg, "property") == 0 || strcmp(optarg, "env") == 0) { - query = QUERY_PROPERTY; - } else if (strcmp(optarg, "name") == 0) { - query = QUERY_NAME; - } else if (strcmp(optarg, "symlink") == 0) { - query = QUERY_SYMLINK; - } else if (strcmp(optarg, "path") == 0) { - query = QUERY_PATH; - } else if (strcmp(optarg, "all") == 0) { - query = QUERY_ALL; - } else { - fprintf(stderr, "unknown query type\n"); - rc = 3; - goto exit; - } - break; - case 'r': - if (action == ACTION_NONE) - action = ACTION_ROOT; - root = true; - break; - case 'R': - printf("%s\n", udev_get_run_path(udev)); - goto exit; - case 'd': - action = ACTION_DEVICE_ID_FILE; - util_strscpy(name, sizeof(name), optarg); - break; - case 'a': - action = ACTION_ATTRIBUTE_WALK; - break; - case 'e': - export_devices(udev); - goto exit; - case 'c': - cleanup_db(udev); - goto exit; - case 'x': - export = true; - break; - case 'P': - export_prefix = optarg; - break; - case 'V': - printf("%s\n", VERSION); - goto exit; - case 'h': - printf("Usage: udevadm info OPTIONS\n" - " --query= query device information:\n" - " name name of device node\n" - " symlink pointing to node\n" - " path sys device path\n" - " property the device properties\n" - " all all values\n" - " --path= sys device path used for query or attribute walk\n" - " --name= node or symlink name used for query or attribute walk\n" - " --root prepend dev directory to path names\n" - " --attribute-walk print all key matches while walking along the chain\n" - " of parent devices\n" - " --device-id-of-file= print major:minor of device containing this file\n" - " --export export key/value pairs\n" - " --export-prefix export the key name with a prefix\n" - " --export-db export the content of the udev database\n" - " --cleanup-db cleanup the udev database\n" - " --help\n\n"); - goto exit; - default: - rc = 1; - goto exit; - } - } - - switch (action) { - case ACTION_QUERY: - if (device == NULL) { - fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); - rc = 4; - goto exit; - } - - switch(query) { - case QUERY_NAME: { - const char *node = udev_device_get_devnode(device); - - if (node == NULL) { - fprintf(stderr, "no device node found\n"); - rc = 5; - goto exit; - } - - if (root) { - printf("%s\n", udev_device_get_devnode(device)); - } else { - size_t len = strlen(udev_get_dev_path(udev)); - - printf("%s\n", &udev_device_get_devnode(device)[len+1]); - } - break; - } - case QUERY_SYMLINK: - list_entry = udev_device_get_devlinks_list_entry(device); - while (list_entry != NULL) { - if (root) { - printf("%s", udev_list_entry_get_name(list_entry)); - } else { - size_t len; - - len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("%s", &udev_list_entry_get_name(list_entry)[len+1]); - } - list_entry = udev_list_entry_get_next(list_entry); - if (list_entry != NULL) - printf(" "); - } - printf("\n"); - break; - case QUERY_PATH: - printf("%s\n", udev_device_get_devpath(device)); - goto exit; - case QUERY_PROPERTY: - list_entry = udev_device_get_properties_list_entry(device); - while (list_entry != NULL) { - if (export) { - const char *prefix = export_prefix; - - if (prefix == NULL) - prefix = ""; - printf("%s%s='%s'\n", prefix, - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - } else { - printf("%s=%s\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - } - list_entry = udev_list_entry_get_next(list_entry); - } - break; - case QUERY_ALL: - print_record(device); - break; - default: - fprintf(stderr, "unknown query type\n"); - break; - } - break; - case ACTION_ATTRIBUTE_WALK: - if (device == NULL) { - fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); - rc = 4; - goto exit; - } - print_device_chain(device); - break; - case ACTION_DEVICE_ID_FILE: - if (stat_device(name, export, export_prefix) != 0) - rc = 1; - break; - case ACTION_ROOT: - printf("%s\n", udev_get_dev_path(udev)); - break; - default: - fprintf(stderr, "missing option\n"); - rc = 1; - break; - } - -exit: - udev_device_unref(device); - return rc; -} - -const struct udevadm_cmd udevadm_info = { - .name = "info", - .cmd = uinfo, - .help = "query sysfs or the udev database", -}; diff --git a/udev/udevadm-monitor.c b/udev/udevadm-monitor.c deleted file mode 100644 index 64913dbd55..0000000000 --- a/udev/udevadm-monitor.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (C) 2004-2010 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static bool udev_exit; - -static void sig_handler(int signum) -{ - if (signum == SIGINT || signum == SIGTERM) - udev_exit = true; -} - -static void print_device(struct udev_device *device, const char *source, int prop) -{ - struct timespec ts; - - clock_gettime(CLOCK_MONOTONIC, &ts); - printf("%-6s[%llu.%06u] %-8s %s (%s)\n", - source, - (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, - udev_device_get_action(device), - udev_device_get_devpath(device), - udev_device_get_subsystem(device)); - if (prop) { - struct udev_list_entry *list_entry; - - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) - printf("%s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - printf("\n"); - } -} - -static int adm_monitor(struct udev *udev, int argc, char *argv[]) -{ - struct sigaction act; - sigset_t mask; - int option; - bool prop = false; - bool print_kernel = false; - bool print_udev = false; - struct udev_list subsystem_match_list; - struct udev_list tag_match_list; - struct udev_monitor *udev_monitor = NULL; - struct udev_monitor *kernel_monitor = NULL; - int fd_ep = -1; - int fd_kernel = -1, fd_udev = -1; - struct epoll_event ep_kernel, ep_udev; - int rc = 0; - - static const struct option options[] = { - { "property", no_argument, NULL, 'p' }, - { "environment", no_argument, NULL, 'e' }, - { "kernel", no_argument, NULL, 'k' }, - { "udev", no_argument, NULL, 'u' }, - { "subsystem-match", required_argument, NULL, 's' }, - { "tag-match", required_argument, NULL, 't' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - udev_list_init(udev, &subsystem_match_list, true); - udev_list_init(udev, &tag_match_list, true); - - for (;;) { - option = getopt_long(argc, argv, "pekus:t:h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'p': - case 'e': - prop = true; - break; - case 'k': - print_kernel = true; - break; - case 'u': - print_udev = true; - break; - case 's': - { - char subsys[UTIL_NAME_SIZE]; - char *devtype; - - util_strscpy(subsys, sizeof(subsys), optarg); - devtype = strchr(subsys, '/'); - if (devtype != NULL) { - devtype[0] = '\0'; - devtype++; - } - udev_list_entry_add(&subsystem_match_list, subsys, devtype); - break; - } - case 't': - udev_list_entry_add(&tag_match_list, optarg, NULL); - break; - case 'h': - printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" - " --property print the event properties\n" - " --kernel print kernel uevents\n" - " --udev print udev events\n" - " --subsystem-match= filter events by subsystem\n" - " --tag-match= filter events by tag\n" - " --help\n\n"); - goto out; - default: - rc = 1; - goto out; - } - } - - if (!print_kernel && !print_udev) { - print_kernel = true; - print_udev = true; - } - - /* set signal handlers */ - memset(&act, 0x00, sizeof(struct sigaction)); - act.sa_handler = sig_handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_RESTART; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigemptyset(&mask); - sigaddset(&mask, SIGINT); - sigaddset(&mask, SIGTERM); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - err(udev, "error creating epoll fd: %m\n"); - goto out; - } - - printf("monitor will print the received events for:\n"); - if (print_udev) { - struct udev_list_entry *entry; - - udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); - if (udev_monitor == NULL) { - fprintf(stderr, "error: unable to create netlink socket\n"); - rc = 1; - goto out; - } - udev_monitor_set_receive_buffer_size(udev_monitor, 128*1024*1024); - fd_udev = udev_monitor_get_fd(udev_monitor); - - udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { - const char *subsys = udev_list_entry_get_name(entry); - const char *devtype = udev_list_entry_get_value(entry); - - if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, subsys, devtype) < 0) - fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys); - } - - udev_list_entry_foreach(entry, udev_list_get_entry(&tag_match_list)) { - const char *tag = udev_list_entry_get_name(entry); - - if (udev_monitor_filter_add_match_tag(udev_monitor, tag) < 0) - fprintf(stderr, "error: unable to apply tag filter '%s'\n", tag); - } - - if (udev_monitor_enable_receiving(udev_monitor) < 0) { - fprintf(stderr, "error: unable to subscribe to udev events\n"); - rc = 2; - goto out; - } - - memset(&ep_udev, 0, sizeof(struct epoll_event)); - ep_udev.events = EPOLLIN; - ep_udev.data.fd = fd_udev; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - - printf("UDEV - the event which udev sends out after rule processing\n"); - } - - if (print_kernel) { - struct udev_list_entry *entry; - - kernel_monitor = udev_monitor_new_from_netlink(udev, "kernel"); - if (kernel_monitor == NULL) { - fprintf(stderr, "error: unable to create netlink socket\n"); - rc = 3; - goto out; - } - udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); - fd_kernel = udev_monitor_get_fd(kernel_monitor); - - udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { - const char *subsys = udev_list_entry_get_name(entry); - - if (udev_monitor_filter_add_match_subsystem_devtype(kernel_monitor, subsys, NULL) < 0) - fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys); - } - - if (udev_monitor_enable_receiving(kernel_monitor) < 0) { - fprintf(stderr, "error: unable to subscribe to kernel events\n"); - rc = 4; - goto out; - } - - memset(&ep_kernel, 0, sizeof(struct epoll_event)); - ep_kernel.events = EPOLLIN; - ep_kernel.data.fd = fd_kernel; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - - printf("KERNEL - the kernel uevent\n"); - } - printf("\n"); - - while (!udev_exit) { - int fdcount; - struct epoll_event ev[4]; - int i; - - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); - if (fdcount < 0) { - if (errno != EINTR) - fprintf(stderr, "error receiving uevent message: %m\n"); - continue; - } - - for (i = 0; i < fdcount; i++) { - if (ev[i].data.fd == fd_kernel && ev[i].events & EPOLLIN) { - struct udev_device *device; - - device = udev_monitor_receive_device(kernel_monitor); - if (device == NULL) - continue; - print_device(device, "KERNEL", prop); - udev_device_unref(device); - } else if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { - struct udev_device *device; - - device = udev_monitor_receive_device(udev_monitor); - if (device == NULL) - continue; - print_device(device, "UDEV", prop); - udev_device_unref(device); - } - } - } -out: - if (fd_ep >= 0) - close(fd_ep); - udev_monitor_unref(udev_monitor); - udev_monitor_unref(kernel_monitor); - udev_list_cleanup(&subsystem_match_list); - udev_list_cleanup(&tag_match_list); - return rc; -} - -const struct udevadm_cmd udevadm_monitor = { - .name = "monitor", - .cmd = adm_monitor, - .help = "listen to kernel and udev events", -}; diff --git a/udev/udevadm-settle.c b/udev/udevadm-settle.c deleted file mode 100644 index a59d7c39e5..0000000000 --- a/udev/udevadm-settle.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (C) 2006-2009 Kay Sievers - * Copyright (C) 2009 Canonical Ltd. - * Copyright (C) 2009 Scott James Remnant - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int adm_settle(struct udev *udev, int argc, char *argv[]) -{ - static const struct option options[] = { - { "seq-start", required_argument, NULL, 's' }, - { "seq-end", required_argument, NULL, 'e' }, - { "timeout", required_argument, NULL, 't' }, - { "exit-if-exists", required_argument, NULL, 'E' }, - { "quiet", no_argument, NULL, 'q' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - unsigned long long start_usec = now_usec(); - unsigned long long start = 0; - unsigned long long end = 0; - int quiet = 0; - const char *exists = NULL; - unsigned int timeout = 120; - struct pollfd pfd[1]; - struct udev_queue *udev_queue = NULL; - int rc = EXIT_FAILURE; - - dbg(udev, "version %s\n", VERSION); - - for (;;) { - int option; - int seconds; - - option = getopt_long(argc, argv, "s:e:t:E:qh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 's': - start = strtoull(optarg, NULL, 0); - break; - case 'e': - end = strtoull(optarg, NULL, 0); - break; - case 't': - seconds = atoi(optarg); - if (seconds >= 0) - timeout = seconds; - else - fprintf(stderr, "invalid timeout value\n"); - dbg(udev, "timeout=%i\n", timeout); - break; - case 'q': - quiet = 1; - break; - case 'E': - exists = optarg; - break; - case 'h': - printf("Usage: udevadm settle OPTIONS\n" - " --timeout= maximum time to wait for events\n" - " --seq-start= first seqnum to wait for\n" - " --seq-end= last seqnum to wait for\n" - " --exit-if-exists= stop waiting if file exists\n" - " --quiet do not print list after timeout\n" - " --help\n\n"); - exit(EXIT_SUCCESS); - default: - exit(EXIT_FAILURE); - } - } - - udev_queue = udev_queue_new(udev); - if (udev_queue == NULL) - exit(2); - - if (start > 0) { - unsigned long long kernel_seq; - - kernel_seq = udev_queue_get_kernel_seqnum(udev_queue); - - /* unless specified, the last event is the current kernel seqnum */ - if (end == 0) - end = udev_queue_get_kernel_seqnum(udev_queue); - - if (start > end) { - err(udev, "seq-start larger than seq-end, ignoring\n"); - start = 0; - end = 0; - } - - if (start > kernel_seq || end > kernel_seq) { - err(udev, "seq-start or seq-end larger than current kernel value, ignoring\n"); - start = 0; - end = 0; - } - info(udev, "start=%llu end=%llu current=%llu\n", start, end, kernel_seq); - } else { - if (end > 0) { - err(udev, "seq-end needs seq-start parameter, ignoring\n"); - end = 0; - } - } - - /* guarantee that the udev daemon isn't pre-processing */ - if (getuid() == 0) { - struct udev_ctrl *uctrl; - - uctrl = udev_ctrl_new(udev); - if (uctrl != NULL) { - if (udev_ctrl_send_ping(uctrl, timeout) < 0) { - info(udev, "no connection to daemon\n"); - udev_ctrl_unref(uctrl); - rc = EXIT_SUCCESS; - goto out; - } - udev_ctrl_unref(uctrl); - } - } - - pfd[0].events = POLLIN; - pfd[0].fd = inotify_init1(IN_CLOEXEC); - if (pfd[0].fd < 0) { - err(udev, "inotify_init failed: %m\n"); - } else { - if (inotify_add_watch(pfd[0].fd, udev_get_run_path(udev), IN_MOVED_TO) < 0) { - err(udev, "watching '%s' failed\n", udev_get_run_path(udev)); - close(pfd[0].fd); - pfd[0].fd = -1; - } - } - - for (;;) { - struct stat statbuf; - - if (exists != NULL && stat(exists, &statbuf) == 0) { - rc = EXIT_SUCCESS; - break; - } - - if (start > 0) { - /* if asked for, wait for a specific sequence of events */ - if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) { - rc = EXIT_SUCCESS; - break; - } - } else { - /* exit if queue is empty */ - if (udev_queue_get_queue_is_empty(udev_queue)) { - rc = EXIT_SUCCESS; - break; - } - } - - if (pfd[0].fd >= 0) { - int delay; - - if (exists != NULL || start > 0) - delay = 100; - else - delay = 1000; - /* wake up after delay, or immediately after the queue is rebuilt */ - if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) { - char buf[sizeof(struct inotify_event) + PATH_MAX]; - - read(pfd[0].fd, buf, sizeof(buf)); - } - } else { - sleep(1); - } - - if (timeout > 0) { - unsigned long long age_usec; - - age_usec = now_usec() - start_usec; - if (age_usec / (1000 * 1000) >= timeout) { - struct udev_list_entry *list_entry; - - if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) { - info(udev, "timeout waiting for udev queue\n"); - printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf(" %s (%s)\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - } - - break; - } - } - } -out: - if (pfd[0].fd >= 0) - close(pfd[0].fd); - udev_queue_unref(udev_queue); - return rc; -} - -const struct udevadm_cmd udevadm_settle = { - .name = "settle", - .cmd = adm_settle, - .help = "wait for the event queue to finish", -}; diff --git a/udev/udevadm-test-builtin.c b/udev/udevadm-test-builtin.c deleted file mode 100644 index 253fcd0c8f..0000000000 --- a/udev/udevadm-test-builtin.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2011 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static void help(struct udev *udev) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "Usage: udevadm builtin [--help] \n"); - udev_builtin_list(udev); - fprintf(stderr, "\n"); -} - -static int adm_builtin(struct udev *udev, int argc, char *argv[]) -{ - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - {} - }; - char *command = NULL; - char *syspath = NULL; - char filename[UTIL_PATH_SIZE]; - struct udev_device *dev = NULL; - enum udev_builtin_cmd cmd; - int rc = EXIT_SUCCESS; - - dbg(udev, "version %s\n", VERSION); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'h': - help(udev); - goto out; - } - } - - command = argv[optind++]; - if (command == NULL) { - fprintf(stderr, "command missing\n"); - help(udev); - rc = 2; - goto out; - } - - syspath = argv[optind++]; - if (syspath == NULL) { - fprintf(stderr, "syspath missing\n\n"); - rc = 3; - goto out; - } - - udev_builtin_init(udev); - - cmd = udev_builtin_lookup(command); - if (cmd >= UDEV_BUILTIN_MAX) { - fprintf(stderr, "unknown command '%s'\n", command); - help(udev); - rc = 5; - goto out; - } - - /* add /sys if needed */ - if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); - else - util_strscpy(filename, sizeof(filename), syspath); - util_remove_trailing_chars(filename, '/'); - - dev = udev_device_new_from_syspath(udev, filename); - if (dev == NULL) { - fprintf(stderr, "unable to open device '%s'\n\n", filename); - rc = 4; - goto out; - } - - if (udev_builtin_run(dev, cmd, command, true) < 0) { - fprintf(stderr, "error executing '%s'\n\n", command); - rc = 6; - } -out: - udev_device_unref(dev); - udev_builtin_exit(udev); - return rc; -} - -const struct udevadm_cmd udevadm_test_builtin = { - .name = "test-builtin", - .cmd = adm_builtin, - .help = "test a built-in command", - .debug = true, -}; diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c deleted file mode 100644 index 851500527f..0000000000 --- a/udev/udevadm-test.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2003-2004 Greg Kroah-Hartman - * Copyright (C) 2004-2008 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int adm_test(struct udev *udev, int argc, char *argv[]) -{ - int resolve_names = 1; - char filename[UTIL_PATH_SIZE]; - const char *action = "add"; - const char *syspath = NULL; - struct udev_event *event = NULL; - struct udev_device *dev = NULL; - struct udev_rules *rules = NULL; - struct udev_list_entry *entry; - sigset_t mask, sigmask_orig; - int err; - int rc = 0; - - static const struct option options[] = { - { "action", required_argument, NULL, 'a' }, - { "resolve-names", required_argument, NULL, 'N' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - info(udev, "version %s\n", VERSION); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "a:s:N:fh", options, NULL); - if (option == -1) - break; - - dbg(udev, "option '%c'\n", option); - switch (option) { - case 'a': - action = optarg; - break; - case 'N': - if (strcmp (optarg, "early") == 0) { - resolve_names = 1; - } else if (strcmp (optarg, "late") == 0) { - resolve_names = 0; - } else if (strcmp (optarg, "never") == 0) { - resolve_names = -1; - } else { - fprintf(stderr, "resolve-names must be early, late or never\n"); - err(udev, "resolve-names must be early, late or never\n"); - exit(EXIT_FAILURE); - } - break; - case 'h': - printf("Usage: udevadm test OPTIONS \n" - " --action= set action string\n" - " --help\n\n"); - exit(EXIT_SUCCESS); - default: - exit(EXIT_FAILURE); - } - } - syspath = argv[optind]; - - if (syspath == NULL) { - fprintf(stderr, "syspath parameter missing\n"); - rc = 2; - goto out; - } - - printf("This program is for debugging only, it does not run any program,\n" - "specified by a RUN key. It may show incorrect results, because\n" - "some values may be different, or not available at a simulation run.\n" - "\n"); - - sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); - - udev_builtin_init(udev); - - rules = udev_rules_new(udev, resolve_names); - if (rules == NULL) { - fprintf(stderr, "error reading rules\n"); - rc = 3; - goto out; - } - - /* add /sys if needed */ - if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); - else - util_strscpy(filename, sizeof(filename), syspath); - util_remove_trailing_chars(filename, '/'); - - dev = udev_device_new_from_syspath(udev, filename); - if (dev == NULL) { - fprintf(stderr, "unable to open device '%s'\n", filename); - rc = 4; - goto out; - } - - /* skip reading of db, but read kernel parameters */ - udev_device_set_info_loaded(dev); - udev_device_read_uevent_file(dev); - - udev_device_set_action(dev, action); - event = udev_event_new(dev); - - sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); - event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (event->fd_signal < 0) { - fprintf(stderr, "error creating signalfd\n"); - rc = 5; - goto out; - } - - err = udev_event_execute_rules(event, rules, &sigmask_orig); - - udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) - printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); - - if (err == 0) { - udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { - char program[UTIL_PATH_SIZE]; - - udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); - printf("run: '%s'\n", program); - } - } -out: - if (event != NULL && event->fd_signal >= 0) - close(event->fd_signal); - udev_event_unref(event); - udev_device_unref(dev); - udev_rules_unref(rules); - udev_builtin_exit(udev); - return rc; -} - -const struct udevadm_cmd udevadm_test = { - .name = "test", - .cmd = adm_test, - .help = "test an event run", - .debug = true, -}; diff --git a/udev/udevadm-trigger.c b/udev/udevadm-trigger.c deleted file mode 100644 index 2cee2297d4..0000000000 --- a/udev/udevadm-trigger.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2008-2009 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static int verbose; -static int dry_run; - -static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - struct udev_list_entry *entry; - - udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(udev_enumerate)) { - char filename[UTIL_PATH_SIZE]; - int fd; - - if (verbose) - printf("%s\n", udev_list_entry_get_name(entry)); - if (dry_run) - continue; - util_strscpyl(filename, sizeof(filename), udev_list_entry_get_name(entry), "/uevent", NULL); - fd = open(filename, O_WRONLY); - if (fd < 0) { - dbg(udev, "error on opening %s: %m\n", filename); - continue; - } - if (write(fd, action, strlen(action)) < 0) - info(udev, "error writing '%s' to '%s': %m\n", action, filename); - close(fd); - } -} - -static const char *keyval(const char *str, const char **val, char *buf, size_t size) -{ - char *pos; - - util_strscpy(buf, size,str); - pos = strchr(buf, '='); - if (pos != NULL) { - pos[0] = 0; - pos++; - } - *val = pos; - return buf; -} - -static int adm_trigger(struct udev *udev, int argc, char *argv[]) -{ - static const struct option options[] = { - { "verbose", no_argument, NULL, 'v' }, - { "dry-run", no_argument, NULL, 'n' }, - { "type", required_argument, NULL, 't' }, - { "action", required_argument, NULL, 'c' }, - { "subsystem-match", required_argument, NULL, 's' }, - { "subsystem-nomatch", required_argument, NULL, 'S' }, - { "attr-match", required_argument, NULL, 'a' }, - { "attr-nomatch", required_argument, NULL, 'A' }, - { "property-match", required_argument, NULL, 'p' }, - { "tag-match", required_argument, NULL, 'g' }, - { "sysname-match", required_argument, NULL, 'y' }, - { "parent-match", required_argument, NULL, 'b' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - enum { - TYPE_DEVICES, - TYPE_SUBSYSTEMS, - } device_type = TYPE_DEVICES; - const char *action = "change"; - struct udev_enumerate *udev_enumerate; - int rc = 0; - - dbg(udev, "version %s\n", VERSION); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) { - rc = 1; - goto exit; - } - - for (;;) { - int option; - const char *key; - const char *val; - char buf[UTIL_PATH_SIZE]; - - option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:b:", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'v': - verbose = 1; - break; - case 'n': - dry_run = 1; - break; - case 't': - if (strcmp(optarg, "devices") == 0) { - device_type = TYPE_DEVICES; - } else if (strcmp(optarg, "subsystems") == 0) { - device_type = TYPE_SUBSYSTEMS; - } else { - err(udev, "unknown type --type=%s\n", optarg); - rc = 2; - goto exit; - } - break; - case 'c': - action = optarg; - break; - case 's': - udev_enumerate_add_match_subsystem(udev_enumerate, optarg); - break; - case 'S': - udev_enumerate_add_nomatch_subsystem(udev_enumerate, optarg); - break; - case 'a': - key = keyval(optarg, &val, buf, sizeof(buf)); - udev_enumerate_add_match_sysattr(udev_enumerate, key, val); - break; - case 'A': - key = keyval(optarg, &val, buf, sizeof(buf)); - udev_enumerate_add_nomatch_sysattr(udev_enumerate, key, val); - break; - case 'p': - key = keyval(optarg, &val, buf, sizeof(buf)); - udev_enumerate_add_match_property(udev_enumerate, key, val); - break; - case 'g': - udev_enumerate_add_match_tag(udev_enumerate, optarg); - break; - case 'y': - udev_enumerate_add_match_sysname(udev_enumerate, optarg); - break; - case 'b': { - char path[UTIL_PATH_SIZE]; - struct udev_device *dev; - - /* add sys dir if needed */ - if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); - else - util_strscpy(path, sizeof(path), optarg); - util_remove_trailing_chars(path, '/'); - dev = udev_device_new_from_syspath(udev, path); - if (dev == NULL) { - err(udev, "unable to open the device '%s'\n", optarg); - rc = 2; - goto exit; - } - udev_enumerate_add_match_parent(udev_enumerate, dev); - /* drop reference immediately, enumerate pins the device as long as needed */ - udev_device_unref(dev); - break; - } - case 'h': - printf("Usage: udevadm trigger OPTIONS\n" - " --verbose print the list of devices while running\n" - " --dry-run do not actually trigger the events\n" - " --type= type of events to trigger\n" - " devices sys devices (default)\n" - " subsystems sys subsystems and drivers\n" - " --action= event action value, default is \"change\"\n" - " --subsystem-match= trigger devices from a matching subsystem\n" - " --subsystem-nomatch= exclude devices from a matching subsystem\n" - " --attr-match=]> trigger devices with a matching attribute\n" - " --attr-nomatch=]> exclude devices with a matching attribute\n" - " --property-match== trigger devices with a matching property\n" - " --tag-match== trigger devices with a matching property\n" - " --sysname-match= trigger devices with a matching name\n" - " --parent-match= trigger devices with that parent device\n" - " --help\n\n"); - goto exit; - default: - rc = 1; - goto exit; - } - } - - switch (device_type) { - case TYPE_SUBSYSTEMS: - udev_enumerate_scan_subsystems(udev_enumerate); - exec_list(udev_enumerate, action); - goto exit; - case TYPE_DEVICES: - udev_enumerate_scan_devices(udev_enumerate); - exec_list(udev_enumerate, action); - goto exit; - default: - goto exit; - } -exit: - udev_enumerate_unref(udev_enumerate); - return rc; -} - -const struct udevadm_cmd udevadm_trigger = { - .name = "trigger", - .cmd = adm_trigger, - .help = "request events from the kernel", -}; diff --git a/udev/udevadm.c b/udev/udevadm.c deleted file mode 100644 index 5410f00c02..0000000000 --- a/udev/udevadm.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2007-2009 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" - -static bool debug; - -void udev_main_log(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - va_list args2; - - va_copy(args2, args); - vfprintf(stderr, format, args2); - va_end(args2); - vsyslog(priority, format, args); - } -} - -static int adm_version(struct udev *udev, int argc, char *argv[]) -{ - printf("%s\n", VERSION); - return 0; -} -static const struct udevadm_cmd udevadm_version = { - .name = "version", - .cmd = adm_version, -}; - -static int adm_help(struct udev *udev, int argc, char *argv[]); -static const struct udevadm_cmd udevadm_help = { - .name = "help", - .cmd = adm_help, -}; - -static const struct udevadm_cmd *udevadm_cmds[] = { - &udevadm_info, - &udevadm_trigger, - &udevadm_settle, - &udevadm_control, - &udevadm_monitor, - &udevadm_test, - &udevadm_test_builtin, - &udevadm_version, - &udevadm_help, -}; - -static int adm_help(struct udev *udev, int argc, char *argv[]) -{ - unsigned int i; - - fprintf(stderr, "Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); - for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) - if (udevadm_cmds[i]->help != NULL) - printf(" %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help); - fprintf(stderr, "\n"); - return 0; -} - -static int run_command(struct udev *udev, const struct udevadm_cmd *cmd, int argc, char *argv[]) -{ - if (cmd->debug) { - debug = true; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - } - info(udev, "calling: %s\n", cmd->name); - return cmd->cmd(udev, argc, argv); -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - static const struct option options[] = { - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - {} - }; - const char *command; - unsigned int i; - int rc = 1; - - udev = udev_new(); - if (udev == NULL) - goto out; - - udev_log_init("udevadm"); - udev_set_log_fn(udev, udev_main_log); - udev_selinux_init(udev); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "+dhV", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = true; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - rc = adm_help(udev, argc, argv); - goto out; - case 'V': - rc = adm_version(udev, argc, argv); - goto out; - default: - goto out; - } - } - command = argv[optind]; - - info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); - - if (command != NULL) - for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) { - if (strcmp(udevadm_cmds[i]->name, command) == 0) { - argc -= optind; - argv += optind; - optind = 0; - rc = run_command(udev, udevadm_cmds[i], argc, argv); - goto out; - } - } - - fprintf(stderr, "missing or unknown command\n\n"); - adm_help(udev, argc, argv); - rc = 2; -out: - udev_selinux_exit(udev); - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/udev/udevadm.xml b/udev/udevadm.xml deleted file mode 100644 index 455ce80ca9..0000000000 --- a/udev/udevadm.xml +++ /dev/null @@ -1,472 +0,0 @@ - - - - - - - udevadm - udev - - - - udevadm - 8 - - - - - udevadmudev management tool - - - - - udevadm - - - - - - udevadm info options - - - udevadm trigger options - - - udevadm settle options - - - udevadm control command - - - udevadm monitor options - - - udevadm test options devpath - - - udevadm test-builtin options command devpath - - - - Description - udevadm expects a command and command specific options. It - controls the runtime behavior of udev, requests kernel events, - manages the event queue, and provides simple debugging mechanisms. - - - OPTIONS - - - - - Print debug messages to stderr. - - - - - - Print version number. - - - - - - Print help text. - - - - - udevadm info <replaceable>options</replaceable> - Queries the udev database for device information - stored in the udev database. It can also query the properties - of a device from its sysfs representation to help creating udev - rules that match this device. - - - - - Query the database for specified type of device data. It needs the - or to identify the specified - device. Valid queries are: - name, symlink, path, - property, all. - - - - - - The devpath of the device to query. - - - - - - The name of the device node or a symlink to query - - - - - - The udev root directory: /dev. If used in conjunction - with a name or symlink query, the - query returns the absolute path including the root directory. - - - - - - The udev runtime directory: /run/udev. - - - - - - Print all sysfs properties of the specified device that can be used - in udev rules to match the specified device. It prints all devices - along the chain, up to the root of sysfs that can be used in udev rules. - - - - - - Print output as key/value pairs. Values are enclosed in single quotes. - - - - - - Add a prefix to the key name of exported values. - - - - - - Print major/minor numbers of the underlying device, where the file - lives on. - - - - - - Export the content of the udev database. - - - - - - Cleanup the udev database. - - - - - - Print version. - - - - - - Print help text. - - - - - - udevadm trigger <optional>options</optional> - Request device events from the kernel. Primarily used to replay events at system coldplug time. - - - - - Print the list of devices which will be triggered. - - - - - - Do not actually trigger the event. - - - - - - Trigger a specific type of devices. Valid types are: - devices, subsystems. - The default value is devices. - - - - - - Type of event to be triggered. The default value is change. - - - - - - Trigger events for devices which belong to a matching subsystem. This option - can be specified multiple times and supports shell style pattern matching. - - - - - - Do not trigger events for devices which belong to a matching subsystem. This option - can be specified multiple times and supports shell style pattern matching. - - - - - - Trigger events for devices with a matching sysfs attribute. If a value is specified - along with the attribute name, the content of the attribute is matched against the given - value using shell style pattern matching. If no value is specified, the existence of the - sysfs attribute is checked. This option can be specified multiple times. - - - - - - Do not trigger events for devices with a matching sysfs attribute. If a value is - specified along with the attribute name, the content of the attribute is matched against - the given value using shell style pattern matching. If no value is specified, the existence - of the sysfs attribute is checked. This option can be specified multiple times. - - - - - - Trigger events for devices with a matching property value. This option can be - specified multiple times and supports shell style pattern matching. - - - - - - Trigger events for devices with a matching tag. This option can be - specified multiple times. - - - - - - Trigger events for devices with a matching sys device name. This option can be - specified multiple times and supports shell style pattern matching. - - - - - - Trigger events for all children of a given device. - - - - - - udevadm settle <optional>options</optional> - Watches the udev event queue, and exits if all current events are handled. - - - - - Maximum number of seconds to wait for the event queue to become empty. - The default value is 120 seconds. A value of 0 will check if the queue is empty - and always return immediately. - - - - - - Wait only for events after the given sequence number. - - - - - - Wait only for events before the given sequence number. - - - - - - Stop waiting if file exists. - - - - - - Do not print any output, like the remaining queue entries when reaching the timeout. - - - - - - Print help text. - - - - - - udevadm control <replaceable>command</replaceable> - Modify the internal state of the running udev daemon. - - - - - Signal and wait for udevd to exit. - - - - - - Set the internal log level of udevd. Valid values are the numerical - syslog priorities or their textual representations: , - and . - - - - - - Signal udevd to stop executing new events. Incoming events - will be queued. - - - - - - Signal udevd to enable the execution of events. - - - - - - Signal udevd to reload the rules files and other databases like the kernel - module index. Reloading rules and databases does not apply any changes to already - existing devices; the new configuration will only be applied to new events. - - - - - - Set a global property for all events. - - - - value - - Set the maximum number of events, udevd will handle at the - same time. - - - - seconds - - The maximum number seconds to wait for a reply from udevd. - - - - - - Print help text. - - - - - - udevadm monitor <optional>options</optional> - Listens to the kernel uevents and events sent out by a udev rule - and prints the devpath of the event to the console. It can be used to analyze the - event timing, by comparing the timestamps of the kernel uevent and the udev event. - - - - - - Print the kernel uevents. - - - - - - Print the udev event after the rule processing. - - - - - - Also print the properties of the event. - - - - - - Filter events by subsystem[/devtype]. Only udev events with a matching subsystem value will pass. - - - - - - Filter events by property. Only udev events with a given tag attached will pass. - - - - - - Print help text. - - - - - - udevadm test <optional>options</optional> <replaceable>devpath</replaceable> - Simulate a udev event run for the given device, and print debug output. - - - - - The action string. - - - - - - The subsystem string. - - - - - - Print help text. - - - - - - udevadm test-builtin <optional>options</optional> <replaceable>command</replaceable> <replaceable>devpath</replaceable> - Run a built-in command for the given device, and print debug output. - - - - - Print help text. - - - - - - - Author - Written by Kay Sievers kay.sievers@vrfy.org. - - - - See Also - - udev7 - - - udevd8 - - - diff --git a/udev/udevd.c b/udev/udevd.c deleted file mode 100644 index 196e63fd0d..0000000000 --- a/udev/udevd.c +++ /dev/null @@ -1,1708 +0,0 @@ -/* - * Copyright (C) 2004-2011 Kay Sievers - * Copyright (C) 2004 Chris Friesen - * Copyright (C) 2009 Canonical Ltd. - * Copyright (C) 2009 Scott James Remnant - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "udev.h" -#include "sd-daemon.h" - -static bool debug; - -void udev_main_log(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - char buf[1024]; - struct timespec ts; - - vsnprintf(buf, sizeof(buf), format, args); - clock_gettime(CLOCK_MONOTONIC, &ts); - fprintf(stderr, "[%llu.%06u] [%u] %s: %s", - (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, - (int) getpid(), fn, buf); - } else { - vsyslog(priority, format, args); - } -} - -static struct udev_rules *rules; -static struct udev_queue_export *udev_queue_export; -static struct udev_ctrl *udev_ctrl; -static struct udev_monitor *monitor; -static int worker_watch[2] = { -1, -1 }; -static int fd_signal = -1; -static int fd_ep = -1; -static int fd_inotify = -1; -static bool stop_exec_queue; -static bool reload; -static int children; -static int children_max; -static int exec_delay; -static sigset_t sigmask_orig; -static UDEV_LIST(event_list); -static UDEV_LIST(worker_list); -static bool udev_exit; - -enum event_state { - EVENT_UNDEF, - EVENT_QUEUED, - EVENT_RUNNING, -}; - -struct event { - struct udev_list_node node; - struct udev *udev; - struct udev_device *dev; - enum event_state state; - int exitcode; - unsigned long long int delaying_seqnum; - unsigned long long int seqnum; - const char *devpath; - size_t devpath_len; - const char *devpath_old; - dev_t devnum; - bool is_block; - int ifindex; -}; - -static struct event *node_to_event(struct udev_list_node *node) -{ - char *event; - - event = (char *)node; - event -= offsetof(struct event, node); - return (struct event *)event; -} - -static void event_queue_cleanup(struct udev *udev, enum event_state type); - -enum worker_state { - WORKER_UNDEF, - WORKER_RUNNING, - WORKER_IDLE, - WORKER_KILLED, -}; - -struct worker { - struct udev_list_node node; - struct udev *udev; - int refcount; - pid_t pid; - struct udev_monitor *monitor; - enum worker_state state; - struct event *event; -}; - -/* passed from worker to main process */ -struct worker_message { - pid_t pid; - int exitcode; -}; - -static struct worker *node_to_worker(struct udev_list_node *node) -{ - char *worker; - - worker = (char *)node; - worker -= offsetof(struct worker, node); - return (struct worker *)worker; -} - -static void event_queue_delete(struct event *event, bool export) -{ - udev_list_node_remove(&event->node); - - if (export) { - udev_queue_export_device_finished(udev_queue_export, event->dev); - info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); - } - udev_device_unref(event->dev); - free(event); -} - -static struct worker *worker_ref(struct worker *worker) -{ - worker->refcount++; - return worker; -} - -static void worker_cleanup(struct worker *worker) -{ - udev_list_node_remove(&worker->node); - udev_monitor_unref(worker->monitor); - children--; - free(worker); -} - -static void worker_unref(struct worker *worker) -{ - worker->refcount--; - if (worker->refcount > 0) - return; - info(worker->udev, "worker [%u] cleaned up\n", worker->pid); - worker_cleanup(worker); -} - -static void worker_list_cleanup(struct udev *udev) -{ - struct udev_list_node *loop, *tmp; - - udev_list_node_foreach_safe(loop, tmp, &worker_list) { - struct worker *worker = node_to_worker(loop); - - worker_cleanup(worker); - } -} - -static void worker_new(struct event *event) -{ - struct udev *udev = event->udev; - struct worker *worker; - struct udev_monitor *worker_monitor; - pid_t pid; - - /* listen for new events */ - worker_monitor = udev_monitor_new_from_netlink(udev, NULL); - if (worker_monitor == NULL) - return; - /* allow the main daemon netlink address to send devices to the worker */ - udev_monitor_allow_unicast_sender(worker_monitor, monitor); - udev_monitor_enable_receiving(worker_monitor); - - worker = calloc(1, sizeof(struct worker)); - if (worker == NULL) { - udev_monitor_unref(worker_monitor); - return; - } - /* worker + event reference */ - worker->refcount = 2; - worker->udev = udev; - - pid = fork(); - switch (pid) { - case 0: { - struct udev_device *dev = NULL; - int fd_monitor; - struct epoll_event ep_signal, ep_monitor; - sigset_t mask; - int rc = EXIT_SUCCESS; - - /* move initial device from queue */ - dev = event->dev; - event->dev = NULL; - - free(worker); - worker_list_cleanup(udev); - event_queue_cleanup(udev, EVENT_UNDEF); - udev_queue_export_unref(udev_queue_export); - udev_monitor_unref(monitor); - udev_ctrl_unref(udev_ctrl); - close(fd_signal); - close(fd_ep); - close(worker_watch[READ_END]); - - sigfillset(&mask); - fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (fd_signal < 0) { - err(udev, "error creating signalfd %m\n"); - rc = 2; - goto out; - } - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - err(udev, "error creating epoll fd: %m\n"); - rc = 3; - goto out; - } - - memset(&ep_signal, 0, sizeof(struct epoll_event)); - ep_signal.events = EPOLLIN; - ep_signal.data.fd = fd_signal; - - fd_monitor = udev_monitor_get_fd(worker_monitor); - memset(&ep_monitor, 0, sizeof(struct epoll_event)); - ep_monitor.events = EPOLLIN; - ep_monitor.data.fd = fd_monitor; - - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_monitor, &ep_monitor) < 0) { - err(udev, "fail to add fds to epoll: %m\n"); - rc = 4; - goto out; - } - - /* request TERM signal if parent exits */ - prctl(PR_SET_PDEATHSIG, SIGTERM); - - for (;;) { - struct udev_event *udev_event; - struct worker_message msg; - int err; - - info(udev, "seq %llu running\n", udev_device_get_seqnum(dev)); - udev_event = udev_event_new(dev); - if (udev_event == NULL) { - rc = 5; - goto out; - } - - /* needed for SIGCHLD/SIGTERM in spawn() */ - udev_event->fd_signal = fd_signal; - - if (exec_delay > 0) - udev_event->exec_delay = exec_delay; - - /* apply rules, create node, symlinks */ - err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); - - if (err == 0) - udev_event_execute_run(udev_event, &sigmask_orig); - - /* apply/restore inotify watch */ - if (err == 0 && udev_event->inotify_watch) { - udev_watch_begin(udev, dev); - udev_device_update_db(dev); - } - - /* send processed event back to libudev listeners */ - udev_monitor_send_device(worker_monitor, NULL, dev); - - /* send udevd the result of the event execution */ - memset(&msg, 0, sizeof(struct worker_message)); - if (err != 0) - msg.exitcode = err; - msg.pid = getpid(); - send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); - - info(udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); - - udev_device_unref(dev); - dev = NULL; - - if (udev_event->sigterm) { - udev_event_unref(udev_event); - goto out; - } - - udev_event_unref(udev_event); - - /* wait for more device messages from main udevd, or term signal */ - while (dev == NULL) { - struct epoll_event ev[4]; - int fdcount; - int i; - - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err = -errno; - err(udev, "failed to poll: %m\n"); - goto out; - } - - for (i = 0; i < fdcount; i++) { - if (ev[i].data.fd == fd_monitor && ev[i].events & EPOLLIN) { - dev = udev_monitor_receive_device(worker_monitor); - break; - } else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) { - struct signalfd_siginfo fdsi; - ssize_t size; - - size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); - if (size != sizeof(struct signalfd_siginfo)) - continue; - switch (fdsi.ssi_signo) { - case SIGTERM: - goto out; - } - } - } - } - } -out: - udev_device_unref(dev); - if (fd_signal >= 0) - close(fd_signal); - if (fd_ep >= 0) - close(fd_ep); - close(fd_inotify); - close(worker_watch[WRITE_END]); - udev_rules_unref(rules); - udev_monitor_unref(worker_monitor); - udev_unref(udev); - udev_log_close(); - exit(rc); - } - case -1: - udev_monitor_unref(worker_monitor); - event->state = EVENT_QUEUED; - free(worker); - err(udev, "fork of child failed: %m\n"); - break; - default: - /* close monitor, but keep address around */ - udev_monitor_disconnect(worker_monitor); - worker->monitor = worker_monitor; - worker->pid = pid; - worker->state = WORKER_RUNNING; - worker->event = event; - event->state = EVENT_RUNNING; - udev_list_node_append(&worker->node, &worker_list); - children++; - info(udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); - break; - } -} - -static void event_run(struct event *event) -{ - struct udev_list_node *loop; - - udev_list_node_foreach(loop, &worker_list) { - struct worker *worker = node_to_worker(loop); - ssize_t count; - - if (worker->state != WORKER_IDLE) - continue; - - count = udev_monitor_send_device(monitor, worker->monitor, event->dev); - if (count < 0) { - err(event->udev, "worker [%u] did not accept message %zi (%m), kill it\n", worker->pid, count); - kill(worker->pid, SIGKILL); - worker->state = WORKER_KILLED; - continue; - } - worker_ref(worker); - worker->event = event; - worker->state = WORKER_RUNNING; - event->state = EVENT_RUNNING; - return; - } - - if (children >= children_max) { - if (children_max > 1) - info(event->udev, "maximum number (%i) of children reached\n", children); - return; - } - - /* start new worker and pass initial device */ - worker_new(event); -} - -static int event_queue_insert(struct udev_device *dev) -{ - struct event *event; - - event = calloc(1, sizeof(struct event)); - if (event == NULL) - return -1; - - event->udev = udev_device_get_udev(dev); - event->dev = dev; - event->seqnum = udev_device_get_seqnum(dev); - event->devpath = udev_device_get_devpath(dev); - event->devpath_len = strlen(event->devpath); - event->devpath_old = udev_device_get_devpath_old(dev); - event->devnum = udev_device_get_devnum(dev); - event->is_block = (strcmp("block", udev_device_get_subsystem(dev)) == 0); - event->ifindex = udev_device_get_ifindex(dev); - - udev_queue_export_device_queued(udev_queue_export, dev); - info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev), - udev_device_get_action(dev), udev_device_get_subsystem(dev)); - - event->state = EVENT_QUEUED; - udev_list_node_append(&event->node, &event_list); - return 0; -} - -static void worker_kill(struct udev *udev, int retain) -{ - struct udev_list_node *loop; - int max; - - if (children <= retain) - return; - - max = children - retain; - - udev_list_node_foreach(loop, &worker_list) { - struct worker *worker = node_to_worker(loop); - - if (max-- <= 0) - break; - - if (worker->state == WORKER_KILLED) - continue; - - worker->state = WORKER_KILLED; - kill(worker->pid, SIGTERM); - } -} - -/* lookup event for identical, parent, child device */ -static bool is_devpath_busy(struct event *event) -{ - struct udev_list_node *loop; - size_t common; - - /* check if queue contains events we depend on */ - udev_list_node_foreach(loop, &event_list) { - struct event *loop_event = node_to_event(loop); - - /* we already found a later event, earlier can not block us, no need to check again */ - if (loop_event->seqnum < event->delaying_seqnum) - continue; - - /* event we checked earlier still exists, no need to check again */ - if (loop_event->seqnum == event->delaying_seqnum) - return true; - - /* found ourself, no later event can block us */ - if (loop_event->seqnum >= event->seqnum) - break; - - /* check major/minor */ - if (major(event->devnum) != 0 && event->devnum == loop_event->devnum && event->is_block == loop_event->is_block) - return true; - - /* check network device ifindex */ - if (event->ifindex != 0 && event->ifindex == loop_event->ifindex) - return true; - - /* check our old name */ - if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) { - event->delaying_seqnum = loop_event->seqnum; - return true; - } - - /* compare devpath */ - common = MIN(loop_event->devpath_len, event->devpath_len); - - /* one devpath is contained in the other? */ - if (memcmp(loop_event->devpath, event->devpath, common) != 0) - continue; - - /* identical device event found */ - if (loop_event->devpath_len == event->devpath_len) { - /* devices names might have changed/swapped in the meantime */ - if (major(event->devnum) != 0 && (event->devnum != loop_event->devnum || event->is_block != loop_event->is_block)) - continue; - if (event->ifindex != 0 && event->ifindex != loop_event->ifindex) - continue; - event->delaying_seqnum = loop_event->seqnum; - return true; - } - - /* parent device event found */ - if (event->devpath[common] == '/') { - event->delaying_seqnum = loop_event->seqnum; - return true; - } - - /* child device event found */ - if (loop_event->devpath[common] == '/') { - event->delaying_seqnum = loop_event->seqnum; - return true; - } - - /* no matching device */ - continue; - } - - return false; -} - -static void event_queue_start(struct udev *udev) -{ - struct udev_list_node *loop; - - udev_list_node_foreach(loop, &event_list) { - struct event *event = node_to_event(loop); - - if (event->state != EVENT_QUEUED) - continue; - - /* do not start event if parent or child event is still running */ - if (is_devpath_busy(event)) { - dbg(udev, "delay seq %llu (%s)\n", event->seqnum, event->devpath); - continue; - } - - event_run(event); - } -} - -static void event_queue_cleanup(struct udev *udev, enum event_state match_type) -{ - struct udev_list_node *loop, *tmp; - - udev_list_node_foreach_safe(loop, tmp, &event_list) { - struct event *event = node_to_event(loop); - - if (match_type != EVENT_UNDEF && match_type != event->state) - continue; - - event_queue_delete(event, false); - } -} - -static void worker_returned(int fd_worker) -{ - for (;;) { - struct worker_message msg; - ssize_t size; - struct udev_list_node *loop; - - size = recv(fd_worker, &msg, sizeof(struct worker_message), MSG_DONTWAIT); - if (size != sizeof(struct worker_message)) - break; - - /* lookup worker who sent the signal */ - udev_list_node_foreach(loop, &worker_list) { - struct worker *worker = node_to_worker(loop); - - if (worker->pid != msg.pid) - continue; - - /* worker returned */ - worker->event->exitcode = msg.exitcode; - event_queue_delete(worker->event, true); - worker->event = NULL; - if (worker->state != WORKER_KILLED) - worker->state = WORKER_IDLE; - worker_unref(worker); - break; - } - } -} - -/* receive the udevd message from userspace */ -static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) -{ - struct udev *udev = udev_ctrl_get_udev(uctrl); - struct udev_ctrl_connection *ctrl_conn; - struct udev_ctrl_msg *ctrl_msg = NULL; - const char *str; - int i; - - ctrl_conn = udev_ctrl_get_connection(uctrl); - if (ctrl_conn == NULL) - goto out; - - ctrl_msg = udev_ctrl_receive_msg(ctrl_conn); - if (ctrl_msg == NULL) - goto out; - - i = udev_ctrl_get_set_log_level(ctrl_msg); - if (i >= 0) { - info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", i); - udev_set_log_priority(udev, i); - worker_kill(udev, 0); - } - - if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) { - info(udev, "udevd message (STOP_EXEC_QUEUE) received\n"); - stop_exec_queue = true; - } - - if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) { - info(udev, "udevd message (START_EXEC_QUEUE) received\n"); - stop_exec_queue = false; - } - - if (udev_ctrl_get_reload(ctrl_msg) > 0) { - info(udev, "udevd message (RELOAD) received\n"); - reload = true; - } - - str = udev_ctrl_get_set_env(ctrl_msg); - if (str != NULL) { - char *key; - - key = strdup(str); - if (key != NULL) { - char *val; - - val = strchr(key, '='); - if (val != NULL) { - val[0] = '\0'; - val = &val[1]; - if (val[0] == '\0') { - info(udev, "udevd message (ENV) received, unset '%s'\n", key); - udev_add_property(udev, key, NULL); - } else { - info(udev, "udevd message (ENV) received, set '%s=%s'\n", key, val); - udev_add_property(udev, key, val); - } - } else { - err(udev, "wrong key format '%s'\n", key); - } - free(key); - } - worker_kill(udev, 0); - } - - i = udev_ctrl_get_set_children_max(ctrl_msg); - if (i >= 0) { - info(udev, "udevd message (SET_MAX_CHILDREN) received, children_max=%i\n", i); - children_max = i; - } - - if (udev_ctrl_get_ping(ctrl_msg) > 0) - info(udev, "udevd message (SYNC) received\n"); - - if (udev_ctrl_get_exit(ctrl_msg) > 0) { - info(udev, "udevd message (EXIT) received\n"); - udev_exit = true; - /* keep reference to block the client until we exit */ - udev_ctrl_connection_ref(ctrl_conn); - } -out: - udev_ctrl_msg_unref(ctrl_msg); - return udev_ctrl_connection_unref(ctrl_conn); -} - -/* read inotify messages */ -static int handle_inotify(struct udev *udev) -{ - int nbytes, pos; - char *buf; - struct inotify_event *ev; - - if ((ioctl(fd_inotify, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) - return 0; - - buf = malloc(nbytes); - if (buf == NULL) { - err(udev, "error getting buffer for inotify\n"); - return -1; - } - - nbytes = read(fd_inotify, buf, nbytes); - - for (pos = 0; pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) { - struct udev_device *dev; - - ev = (struct inotify_event *)(buf + pos); - dev = udev_watch_lookup(udev, ev->wd); - if (dev != NULL) { - info(udev, "inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev)); - if (ev->mask & IN_CLOSE_WRITE) { - char filename[UTIL_PATH_SIZE]; - int fd; - - info(udev, "device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev)); - util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); - fd = open(filename, O_WRONLY); - if (fd >= 0) { - if (write(fd, "change", 6) < 0) - info(udev, "error writing uevent: %m\n"); - close(fd); - } - } - if (ev->mask & IN_IGNORED) - udev_watch_end(udev, dev); - - udev_device_unref(dev); - } - - } - - free(buf); - return 0; -} - -static void handle_signal(struct udev *udev, int signo) -{ - switch (signo) { - case SIGINT: - case SIGTERM: - udev_exit = true; - break; - case SIGCHLD: - for (;;) { - pid_t pid; - int status; - struct udev_list_node *loop, *tmp; - - pid = waitpid(-1, &status, WNOHANG); - if (pid <= 0) - break; - - udev_list_node_foreach_safe(loop, tmp, &worker_list) { - struct worker *worker = node_to_worker(loop); - - if (worker->pid != pid) - continue; - info(udev, "worker [%u] exit\n", pid); - - if (WIFEXITED(status)) { - if (WEXITSTATUS(status) != 0) - err(udev, "worker [%u] exit with return code %i\n", pid, WEXITSTATUS(status)); - } else if (WIFSIGNALED(status)) { - err(udev, "worker [%u] terminated by signal %i (%s)\n", - pid, WTERMSIG(status), strsignal(WTERMSIG(status))); - } else if (WIFSTOPPED(status)) { - err(udev, "worker [%u] stopped\n", pid); - } else if (WIFCONTINUED(status)) { - err(udev, "worker [%u] continued\n", pid); - } else { - err(udev, "worker [%u] exit with status 0x%04x\n", pid, status); - } - - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - if (worker->event != NULL) { - err(udev, "worker [%u] failed while handling '%s'\n", - pid, worker->event->devpath); - worker->event->exitcode = -32; - event_queue_delete(worker->event, true); - /* drop reference taken for state 'running' */ - worker_unref(worker); - } - } - worker_unref(worker); - break; - } - } - break; - case SIGHUP: - reload = true; - break; - } -} - -static void static_dev_create_from_modules(struct udev *udev) -{ - struct utsname kernel; - char modules[UTIL_PATH_SIZE]; - char buf[4096]; - FILE *f; - - uname(&kernel); - util_strscpyl(modules, sizeof(modules), "/lib/modules/", kernel.release, "/modules.devname", NULL); - f = fopen(modules, "r"); - if (f == NULL) - return; - - while (fgets(buf, sizeof(buf), f) != NULL) { - char *s; - const char *modname; - const char *devname; - const char *devno; - int maj, min; - char type; - mode_t mode; - char filename[UTIL_PATH_SIZE]; - - if (buf[0] == '#') - continue; - - modname = buf; - s = strchr(modname, ' '); - if (s == NULL) - continue; - s[0] = '\0'; - - devname = &s[1]; - s = strchr(devname, ' '); - if (s == NULL) - continue; - s[0] = '\0'; - - devno = &s[1]; - s = strchr(devno, ' '); - if (s == NULL) - s = strchr(devno, '\n'); - if (s != NULL) - s[0] = '\0'; - if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3) - continue; - - if (type == 'c') - mode = S_IFCHR; - else if (type == 'b') - mode = S_IFBLK; - else - continue; - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/", devname, NULL); - util_create_path_selinux(udev, filename); - udev_selinux_setfscreatecon(udev, filename, mode); - info(udev, "mknod '%s' %c%u:%u\n", filename, type, maj, min); - if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST) - utimensat(AT_FDCWD, filename, NULL, 0); - udev_selinux_resetfscreatecon(udev); - } - - fclose(f); -} - -static int copy_dev_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) -{ - struct dirent *dent; - - for (dent = readdir(dir_from); dent != NULL; dent = readdir(dir_from)) { - struct stat stats; - - if (dent->d_name[0] == '.') - continue; - if (fstatat(dirfd(dir_from), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) - continue; - - if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { - udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, stats.st_mode & 0777); - if (mknodat(dirfd(dir_to), dent->d_name, stats.st_mode, stats.st_rdev) == 0) { - fchmodat(dirfd(dir_to), dent->d_name, stats.st_mode & 0777, 0); - fchownat(dirfd(dir_to), dent->d_name, stats.st_uid, stats.st_gid, 0); - } else { - utimensat(dirfd(dir_to), dent->d_name, NULL, 0); - } - udev_selinux_resetfscreatecon(udev); - } else if (S_ISLNK(stats.st_mode)) { - char target[UTIL_PATH_SIZE]; - ssize_t len; - - len = readlinkat(dirfd(dir_from), dent->d_name, target, sizeof(target)); - if (len <= 0 || len == (ssize_t)sizeof(target)) - continue; - target[len] = '\0'; - udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFLNK); - if (symlinkat(target, dirfd(dir_to), dent->d_name) < 0 && errno == EEXIST) - utimensat(dirfd(dir_to), dent->d_name, NULL, AT_SYMLINK_NOFOLLOW); - udev_selinux_resetfscreatecon(udev); - } else if (S_ISDIR(stats.st_mode)) { - DIR *dir2_from, *dir2_to; - - if (maxdepth == 0) - continue; - - udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFDIR|0755); - mkdirat(dirfd(dir_to), dent->d_name, 0755); - udev_selinux_resetfscreatecon(udev); - - dir2_to = fdopendir(openat(dirfd(dir_to), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); - if (dir2_to == NULL) - continue; - - dir2_from = fdopendir(openat(dirfd(dir_from), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); - if (dir2_from == NULL) { - closedir(dir2_to); - continue; - } - - copy_dev_dir(udev, dir2_from, dir2_to, maxdepth-1); - - closedir(dir2_to); - closedir(dir2_from); - } - } - - return 0; -} - -static void static_dev_create_links(struct udev *udev, DIR *dir) -{ - struct stdlinks { - const char *link; - const char *target; - }; - static const struct stdlinks stdlinks[] = { - { "core", "/proc/kcore" }, - { "fd", "/proc/self/fd" }, - { "stdin", "/proc/self/fd/0" }, - { "stdout", "/proc/self/fd/1" }, - { "stderr", "/proc/self/fd/2" }, - }; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(stdlinks); i++) { - struct stat sb; - - if (stat(stdlinks[i].target, &sb) == 0) { - udev_selinux_setfscreateconat(udev, dirfd(dir), stdlinks[i].link, S_IFLNK); - if (symlinkat(stdlinks[i].target, dirfd(dir), stdlinks[i].link) < 0 && errno == EEXIST) - utimensat(dirfd(dir), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); - udev_selinux_resetfscreatecon(udev); - } - } -} - -static void static_dev_create_from_devices(struct udev *udev, DIR *dir) -{ - DIR *dir_from; - - dir_from = opendir(PKGLIBEXECDIR "/devices"); - if (dir_from == NULL) - return; - copy_dev_dir(udev, dir_from, dir, 8); - closedir(dir_from); -} - -static void static_dev_create(struct udev *udev) -{ - DIR *dir; - - dir = opendir(udev_get_dev_path(udev)); - if (dir == NULL) - return; - - static_dev_create_links(udev, dir); - static_dev_create_from_devices(udev, dir); - - closedir(dir); -} - -static int mem_size_mb(void) -{ - FILE *f; - char buf[4096]; - long int memsize = -1; - - f = fopen("/proc/meminfo", "r"); - if (f == NULL) - return -1; - - while (fgets(buf, sizeof(buf), f) != NULL) { - long int value; - - if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { - memsize = value / 1024; - break; - } - } - - fclose(f); - return memsize; -} - -static int convert_db(struct udev *udev) -{ - char filename[UTIL_PATH_SIZE]; - FILE *f; - struct udev_enumerate *udev_enumerate; - struct udev_list_entry *list_entry; - - /* current database */ - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); - if (access(filename, F_OK) >= 0) - return 0; - - /* make sure we do not get here again */ - util_create_path(udev, filename); - mkdir(filename, 0755); - - /* old database */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db", NULL); - if (access(filename, F_OK) < 0) - return 0; - - f = fopen("/dev/kmsg", "w"); - if (f != NULL) { - fprintf(f, "<30>udevd[%u]: converting old udev database\n", getpid()); - fclose(f); - } - - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_devices(udev_enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - - /* try to find the old database for devices without a current one */ - if (udev_device_read_db(device, NULL) < 0) { - bool have_db; - const char *id; - struct stat stats; - char devpath[UTIL_PATH_SIZE]; - char from[UTIL_PATH_SIZE]; - - have_db = false; - - /* find database in old location */ - id = udev_device_get_id_filename(device); - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", id, NULL); - if (lstat(from, &stats) == 0) { - if (!have_db) { - udev_device_read_db(device, from); - have_db = true; - } - unlink(from); - } - - /* find old database with $subsys:$sysname name */ - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), - "/.udev/db/", udev_device_get_subsystem(device), ":", - udev_device_get_sysname(device), NULL); - if (lstat(from, &stats) == 0) { - if (!have_db) { - udev_device_read_db(device, from); - have_db = true; - } - unlink(from); - } - - /* find old database with the encoded devpath name */ - util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", devpath, NULL); - if (lstat(from, &stats) == 0) { - if (!have_db) { - udev_device_read_db(device, from); - have_db = true; - } - unlink(from); - } - - /* write out new database */ - if (have_db) - udev_device_update_db(device); - } - udev_device_unref(device); - } - udev_enumerate_unref(udev_enumerate); - return 0; -} - -static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) -{ - int ctrl = -1, netlink = -1; - int fd, n; - - n = sd_listen_fds(true); - if (n <= 0) - return -1; - - for (fd = SD_LISTEN_FDS_START; fd < n + SD_LISTEN_FDS_START; fd++) { - if (sd_is_socket(fd, AF_LOCAL, SOCK_SEQPACKET, -1)) { - if (ctrl >= 0) - return -1; - ctrl = fd; - continue; - } - - if (sd_is_socket(fd, AF_NETLINK, SOCK_RAW, -1)) { - if (netlink >= 0) - return -1; - netlink = fd; - continue; - } - - return -1; - } - - if (ctrl < 0 || netlink < 0) - return -1; - - info(udev, "ctrl=%i netlink=%i\n", ctrl, netlink); - *rctrl = ctrl; - *rnetlink = netlink; - return 0; -} - -static bool check_rules_timestamp(struct udev *udev) -{ - char **p; - unsigned long long *stamp_usec; - int i, n; - bool changed = false; - - n = udev_get_rules_path(udev, &p, &stamp_usec); - for (i = 0; i < n; i++) { - struct stat stats; - - if (stat(p[i], &stats) < 0) - continue; - - if (stamp_usec[i] == ts_usec(&stats.st_mtim)) - continue; - - /* first check */ - if (stamp_usec[i] != 0) { - info(udev, "reload - timestamp of '%s' changed\n", p[i]); - changed = true; - } - - /* update timestamp */ - stamp_usec[i] = ts_usec(&stats.st_mtim); - } - - return changed; -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - FILE *f; - sigset_t mask; - int daemonize = false; - int resolve_names = 1; - static const struct option options[] = { - { "daemon", no_argument, NULL, 'd' }, - { "debug", no_argument, NULL, 'D' }, - { "children-max", required_argument, NULL, 'c' }, - { "exec-delay", required_argument, NULL, 'e' }, - { "resolve-names", required_argument, NULL, 'N' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - {} - }; - int fd_ctrl = -1; - int fd_netlink = -1; - int fd_worker = -1; - struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker; - struct udev_ctrl_connection *ctrl_conn = NULL; - char **s; - int rc = 1; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("udevd"); - udev_set_log_fn(udev, udev_main_log); - info(udev, "version %s\n", VERSION); - udev_selinux_init(udev); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "c:deDtN:hV", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - daemonize = true; - break; - case 'c': - children_max = strtoul(optarg, NULL, 0); - break; - case 'e': - exec_delay = strtoul(optarg, NULL, 0); - break; - case 'D': - debug = true; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'N': - if (strcmp (optarg, "early") == 0) { - resolve_names = 1; - } else if (strcmp (optarg, "late") == 0) { - resolve_names = 0; - } else if (strcmp (optarg, "never") == 0) { - resolve_names = -1; - } else { - fprintf(stderr, "resolve-names must be early, late or never\n"); - err(udev, "resolve-names must be early, late or never\n"); - goto exit; - } - break; - case 'h': - printf("Usage: udevd OPTIONS\n" - " --daemon\n" - " --debug\n" - " --children-max=\n" - " --exec-delay=\n" - " --resolve-names=early|late|never\n" - " --version\n" - " --help\n" - "\n"); - goto exit; - case 'V': - printf("%s\n", VERSION); - goto exit; - default: - goto exit; - } - } - - /* - * read the kernel commandline, in case we need to get into debug mode - * udev.log-priority= syslog priority - * udev.children-max= events are fully serialized if set to 1 - * - */ - f = fopen("/proc/cmdline", "r"); - if (f != NULL) { - char cmdline[4096]; - - if (fgets(cmdline, sizeof(cmdline), f) != NULL) { - char *pos; - - pos = strstr(cmdline, "udev.log-priority="); - if (pos != NULL) { - pos += strlen("udev.log-priority="); - udev_set_log_priority(udev, util_log_priority(pos)); - } - - pos = strstr(cmdline, "udev.children-max="); - if (pos != NULL) { - pos += strlen("udev.children-max="); - children_max = strtoul(pos, NULL, 0); - } - - pos = strstr(cmdline, "udev.exec-delay="); - if (pos != NULL) { - pos += strlen("udev.exec-delay="); - exec_delay = strtoul(pos, NULL, 0); - } - } - fclose(f); - } - - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - err(udev, "root privileges required\n"); - goto exit; - } - - /* set umask before creating any file/directory */ - chdir("/"); - umask(022); - - /* /run/udev */ - mkdir(udev_get_run_path(udev), 0755); - - /* create standard links, copy static nodes, create nodes from modules */ - static_dev_create(udev); - static_dev_create_from_modules(udev); - - /* before opening new files, make sure std{in,out,err} fds are in a sane state */ - if (daemonize) { - int fd; - - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - if (write(STDOUT_FILENO, 0, 0) < 0) - dup2(fd, STDOUT_FILENO); - if (write(STDERR_FILENO, 0, 0) < 0) - dup2(fd, STDERR_FILENO); - if (fd > STDERR_FILENO) - close(fd); - } else { - fprintf(stderr, "cannot open /dev/null\n"); - err(udev, "cannot open /dev/null\n"); - } - } - - if (systemd_fds(udev, &fd_ctrl, &fd_netlink) >= 0) { - /* get control and netlink socket from from systemd */ - udev_ctrl = udev_ctrl_new_from_fd(udev, fd_ctrl); - if (udev_ctrl == NULL) { - err(udev, "error taking over udev control socket"); - rc = 1; - goto exit; - } - - monitor = udev_monitor_new_from_netlink_fd(udev, "kernel", fd_netlink); - if (monitor == NULL) { - err(udev, "error taking over netlink socket\n"); - rc = 3; - goto exit; - } - } else { - /* open control and netlink socket */ - udev_ctrl = udev_ctrl_new(udev); - if (udev_ctrl == NULL) { - fprintf(stderr, "error initializing udev control socket"); - err(udev, "error initializing udev control socket"); - rc = 1; - goto exit; - } - fd_ctrl = udev_ctrl_get_fd(udev_ctrl); - - monitor = udev_monitor_new_from_netlink(udev, "kernel"); - if (monitor == NULL) { - fprintf(stderr, "error initializing netlink socket\n"); - err(udev, "error initializing netlink socket\n"); - rc = 3; - goto exit; - } - fd_netlink = udev_monitor_get_fd(monitor); - } - - if (udev_monitor_enable_receiving(monitor) < 0) { - fprintf(stderr, "error binding netlink socket\n"); - err(udev, "error binding netlink socket\n"); - rc = 3; - goto exit; - } - - if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { - fprintf(stderr, "error binding udev control socket\n"); - err(udev, "error binding udev control socket\n"); - rc = 1; - goto exit; - } - - udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); - - /* create queue file before signalling 'ready', to make sure we block 'settle' */ - udev_queue_export = udev_queue_export_new(udev); - if (udev_queue_export == NULL) { - err(udev, "error creating queue file\n"); - goto exit; - } - - if (daemonize) { - pid_t pid; - int fd; - - pid = fork(); - switch (pid) { - case 0: - break; - case -1: - err(udev, "fork of daemon failed: %m\n"); - rc = 4; - goto exit; - default: - rc = EXIT_SUCCESS; - goto exit_daemonize; - } - - setsid(); - - fd = open("/proc/self/oom_score_adj", O_RDWR); - if (fd < 0) { - /* Fallback to old interface */ - fd = open("/proc/self/oom_adj", O_RDWR); - if (fd < 0) { - err(udev, "error disabling OOM: %m\n"); - } else { - /* OOM_DISABLE == -17 */ - write(fd, "-17", 3); - close(fd); - } - } else { - write(fd, "-1000", 5); - close(fd); - } - } else { - sd_notify(1, "READY=1"); - } - - f = fopen("/dev/kmsg", "w"); - if (f != NULL) { - fprintf(f, "<30>udevd[%u]: starting version " VERSION "\n", getpid()); - fclose(f); - } - - if (!debug) { - int fd; - - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - close(fd); - } - } - - fd_inotify = udev_watch_init(udev); - if (fd_inotify < 0) { - fprintf(stderr, "error initializing inotify\n"); - err(udev, "error initializing inotify\n"); - rc = 4; - goto exit; - } - udev_watch_restore(udev); - - /* block and listen to all signals on signalfd */ - sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); - fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (fd_signal < 0) { - fprintf(stderr, "error creating signalfd\n"); - err(udev, "error creating signalfd\n"); - rc = 5; - goto exit; - } - - /* unnamed socket from workers to the main daemon */ - if (socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, worker_watch) < 0) { - fprintf(stderr, "error creating socketpair\n"); - err(udev, "error creating socketpair\n"); - rc = 6; - goto exit; - } - fd_worker = worker_watch[READ_END]; - - udev_builtin_init(udev); - - rules = udev_rules_new(udev, resolve_names); - if (rules == NULL) { - err(udev, "error reading rules\n"); - goto exit; - } - - memset(&ep_ctrl, 0, sizeof(struct epoll_event)); - ep_ctrl.events = EPOLLIN; - ep_ctrl.data.fd = fd_ctrl; - - memset(&ep_inotify, 0, sizeof(struct epoll_event)); - ep_inotify.events = EPOLLIN; - ep_inotify.data.fd = fd_inotify; - - memset(&ep_signal, 0, sizeof(struct epoll_event)); - ep_signal.events = EPOLLIN; - ep_signal.data.fd = fd_signal; - - memset(&ep_netlink, 0, sizeof(struct epoll_event)); - ep_netlink.events = EPOLLIN; - ep_netlink.data.fd = fd_netlink; - - memset(&ep_worker, 0, sizeof(struct epoll_event)); - ep_worker.events = EPOLLIN; - ep_worker.data.fd = fd_worker; - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - err(udev, "error creating epoll fd: %m\n"); - goto exit; - } - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_ctrl, &ep_ctrl) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_inotify, &ep_inotify) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_netlink, &ep_netlink) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_worker, &ep_worker) < 0) { - err(udev, "fail to add fds to epoll: %m\n"); - goto exit; - } - - /* if needed, convert old database from earlier udev version */ - convert_db(udev); - - if (children_max <= 0) { - int memsize = mem_size_mb(); - - /* set value depending on the amount of RAM */ - if (memsize > 0) - children_max = 128 + (memsize / 8); - else - children_max = 128; - } - info(udev, "set children_max to %u\n", children_max); - - udev_rules_apply_static_dev_perms(rules); - - udev_list_node_init(&event_list); - udev_list_node_init(&worker_list); - - for (;;) { - static unsigned long long last_usec; - struct epoll_event ev[8]; - int fdcount; - int timeout; - bool is_worker, is_signal, is_inotify, is_netlink, is_ctrl; - int i; - - if (udev_exit) { - /* close sources of new events and discard buffered events */ - if (fd_ctrl >= 0) { - epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_ctrl, NULL); - fd_ctrl = -1; - } - if (monitor != NULL) { - epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_netlink, NULL); - udev_monitor_unref(monitor); - monitor = NULL; - } - if (fd_inotify >= 0) { - epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_inotify, NULL); - close(fd_inotify); - fd_inotify = -1; - } - - /* discard queued events and kill workers */ - event_queue_cleanup(udev, EVENT_QUEUED); - worker_kill(udev, 0); - - /* exit after all has cleaned up */ - if (udev_list_node_is_empty(&event_list) && udev_list_node_is_empty(&worker_list)) - break; - - /* timeout at exit for workers to finish */ - timeout = 60 * 1000; - } else if (udev_list_node_is_empty(&event_list) && children > 2) { - /* set timeout to kill idle workers */ - timeout = 3 * 1000; - } else { - timeout = -1; - } - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); - if (fdcount < 0) - continue; - - if (fdcount == 0) { - if (udev_exit) { - info(udev, "timeout, giving up waiting for workers to finish\n"); - break; - } - - /* timeout - kill idle workers */ - worker_kill(udev, 2); - } - - is_worker = is_signal = is_inotify = is_netlink = is_ctrl = false; - for (i = 0; i < fdcount; i++) { - if (ev[i].data.fd == fd_worker && ev[i].events & EPOLLIN) - is_worker = true; - else if (ev[i].data.fd == fd_netlink && ev[i].events & EPOLLIN) - is_netlink = true; - else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) - is_signal = true; - else if (ev[i].data.fd == fd_inotify && ev[i].events & EPOLLIN) - is_inotify = true; - else if (ev[i].data.fd == fd_ctrl && ev[i].events & EPOLLIN) - is_ctrl = true; - } - - /* check for changed config, every 3 seconds at most */ - if ((now_usec() - last_usec) > 3 * 1000 * 1000) { - if (check_rules_timestamp(udev)) - reload = true; - if (udev_builtin_validate(udev)) - reload = true; - - last_usec = now_usec(); - } - - /* reload requested, HUP signal received, rules changed, builtin changed */ - if (reload) { - worker_kill(udev, 0); - rules = udev_rules_unref(rules); - udev_builtin_exit(udev); - reload = 0; - } - - /* event has finished */ - if (is_worker) - worker_returned(fd_worker); - - if (is_netlink) { - struct udev_device *dev; - - dev = udev_monitor_receive_device(monitor); - if (dev != NULL) { - udev_device_set_usec_initialized(dev, now_usec()); - if (event_queue_insert(dev) < 0) - udev_device_unref(dev); - } - } - - /* start new events */ - if (!udev_list_node_is_empty(&event_list) && !udev_exit && !stop_exec_queue) { - if (rules == NULL) - rules = udev_rules_new(udev, resolve_names); - if (rules != NULL) - event_queue_start(udev); - } - - if (is_signal) { - struct signalfd_siginfo fdsi; - ssize_t size; - - size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); - if (size == sizeof(struct signalfd_siginfo)) - handle_signal(udev, fdsi.ssi_signo); - } - - /* we are shutting down, the events below are not handled anymore */ - if (udev_exit) - continue; - - /* device node watch */ - if (is_inotify) - handle_inotify(udev); - - /* - * This needs to be after the inotify handling, to make sure, - * that the ping is send back after the possibly generated - * "change" events by the inotify device node watch. - * - * A single time we may receive a client connection which we need to - * keep open to block the client. It will be closed right before we - * exit. - */ - if (is_ctrl) - ctrl_conn = handle_ctrl_msg(udev_ctrl); - } - - rc = EXIT_SUCCESS; -exit: - udev_queue_export_cleanup(udev_queue_export); - udev_ctrl_cleanup(udev_ctrl); -exit_daemonize: - if (fd_ep >= 0) - close(fd_ep); - worker_list_cleanup(udev); - event_queue_cleanup(udev, EVENT_UNDEF); - udev_rules_unref(rules); - udev_builtin_exit(udev); - if (fd_signal >= 0) - close(fd_signal); - if (worker_watch[READ_END] >= 0) - close(worker_watch[READ_END]); - if (worker_watch[WRITE_END] >= 0) - close(worker_watch[WRITE_END]); - udev_monitor_unref(monitor); - udev_queue_export_unref(udev_queue_export); - udev_ctrl_connection_unref(ctrl_conn); - udev_ctrl_unref(udev_ctrl); - udev_selinux_exit(udev); - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/udev/udevd.xml b/udev/udevd.xml deleted file mode 100644 index c516eb9793..0000000000 --- a/udev/udevd.xml +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - udevd - udev - - - - udevd - 8 - - - - - udevdevent managing daemon - - - - - udevd - - - - - - - - - - - Description - udevd listens to kernel uevents. For every event, udevd executes matching - instructions specified in udev rules. See - udev7 - . - On startup the content of the directory /usr/lib/udev/devices - is copied to /dev. If kernel modules specify static device - nodes, these nodes are created even without a corresponding kernel device, to - allow on-demand loading of kernel modules. Matching permissions specified in udev - rules are applied to these static device nodes. - The behavior of the running daemon can be changed with - udevadm control. - - - Options - - - - - Detach and run in the background. - - - - - - Print debug messages to stderr. - - - - - - Limit the number of parallel executed events. - - - - - - Number of seconds to delay the execution of RUN instructions. - This might be useful when debugging system crashes during coldplug - cause by loading non-working kernel modules. - - - - - - Specify when udevd should resolve names of users and groups. - When set to (the default) names will be - resolved when the rules are parsed. When set to - names will be resolved for every event. - When set to names will never be resolved - and all devices will be owned by root. - - - - - - Print version number. - - - - - - Print help text. - - - - - - Environment - - - UDEV_LOG= - - Set the logging priority. - - - - - - Kernel command line - - - udev.log-priority= - - Set the logging priority. - - - - udev.children-max= - - Limit the number of parallel executed events. - - - - udev.exec-delay= - - Number of seconds to delay the execution of RUN instructions. - This might be useful when debugging system crashes during coldplug - cause by loading non-working kernel modules. - - - - - - Author - Written by Kay Sievers kay.sievers@vrfy.org. - - - - See Also - - udev7 - , - udevadm8 - - - -- cgit v1.2.3-54-g00ecf From d914e44509abf8bf305d00ebc5c6282dd84e809b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Fri, 6 Jan 2012 14:34:40 +0100 Subject: replace unpacked sysfs test tree 'test/sys/' with packed tarball --- Makefile.am | 39 +- test/.gitignore | 2 - test/sys.tar.xz | Bin 0 -> 165116 bytes test/sys/block/loop0 | 1 - test/sys/block/loop1 | 1 - test/sys/block/loop2 | 1 - test/sys/block/loop3 | 1 - test/sys/block/loop4 | 1 - test/sys/block/loop5 | 1 - test/sys/block/loop6 | 1 - test/sys/block/loop7 | 1 - test/sys/block/md0 | 1 - test/sys/block/sda | 1 - test/sys/block/sdb | 1 - test/sys/block/sr0 | 1 - test/sys/bus/acpi/devices/ACPI0003:00 | 1 - test/sys/bus/acpi/devices/ACPI0007:00 | 1 - test/sys/bus/acpi/devices/ACPI0007:01 | 1 - test/sys/bus/acpi/devices/ATM1200:00 | 1 - test/sys/bus/acpi/devices/IBM0057:00 | 1 - test/sys/bus/acpi/devices/IBM0068:00 | 1 - test/sys/bus/acpi/devices/IBM0079:00 | 1 - test/sys/bus/acpi/devices/LNXPOWER:00 | 1 - test/sys/bus/acpi/devices/LNXPWRBN:00 | 1 - test/sys/bus/acpi/devices/LNXSYSTM:00 | 1 - test/sys/bus/acpi/devices/LNXTHERM:00 | 1 - test/sys/bus/acpi/devices/LNXTHERM:01 | 1 - test/sys/bus/acpi/devices/LNXTHERM:02 | 1 - test/sys/bus/acpi/devices/PNP0000:00 | 1 - test/sys/bus/acpi/devices/PNP0100:00 | 1 - test/sys/bus/acpi/devices/PNP0103:00 | 1 - test/sys/bus/acpi/devices/PNP0200:00 | 1 - test/sys/bus/acpi/devices/PNP0303:00 | 1 - test/sys/bus/acpi/devices/PNP0800:00 | 1 - test/sys/bus/acpi/devices/PNP0A08:00 | 1 - test/sys/bus/acpi/devices/PNP0B00:00 | 1 - test/sys/bus/acpi/devices/PNP0C01:00 | 1 - test/sys/bus/acpi/devices/PNP0C02:00 | 1 - test/sys/bus/acpi/devices/PNP0C04:00 | 1 - test/sys/bus/acpi/devices/PNP0C09:00 | 1 - test/sys/bus/acpi/devices/PNP0C0A:00 | 1 - test/sys/bus/acpi/devices/PNP0C0D:00 | 1 - test/sys/bus/acpi/devices/PNP0C0E:00 | 1 - test/sys/bus/acpi/devices/PNP0C0F:00 | 1 - test/sys/bus/acpi/devices/PNP0C0F:01 | 1 - test/sys/bus/acpi/devices/PNP0C0F:02 | 1 - test/sys/bus/acpi/devices/PNP0C0F:03 | 1 - test/sys/bus/acpi/devices/PNP0C0F:04 | 1 - test/sys/bus/acpi/devices/PNP0C0F:05 | 1 - test/sys/bus/acpi/devices/PNP0C0F:06 | 1 - test/sys/bus/acpi/devices/PNP0C0F:07 | 1 - test/sys/bus/acpi/devices/device:00 | 1 - test/sys/bus/acpi/devices/device:01 | 1 - test/sys/bus/acpi/devices/device:02 | 1 - test/sys/bus/acpi/devices/device:03 | 1 - test/sys/bus/acpi/devices/device:04 | 1 - test/sys/bus/acpi/devices/device:05 | 1 - test/sys/bus/acpi/devices/device:06 | 1 - test/sys/bus/acpi/devices/device:07 | 1 - test/sys/bus/acpi/devices/device:08 | 1 - test/sys/bus/acpi/devices/device:09 | 1 - test/sys/bus/acpi/devices/device:0a | 1 - test/sys/bus/acpi/devices/device:0b | 1 - test/sys/bus/acpi/devices/device:0c | 1 - test/sys/bus/acpi/devices/device:0d | 1 - test/sys/bus/acpi/devices/device:0e | 1 - test/sys/bus/acpi/devices/device:0f | 1 - test/sys/bus/acpi/devices/device:10 | 1 - test/sys/bus/acpi/devices/device:11 | 1 - test/sys/bus/acpi/devices/device:12 | 1 - test/sys/bus/acpi/devices/device:13 | 1 - test/sys/bus/acpi/devices/device:14 | 1 - test/sys/bus/acpi/devices/device:15 | 1 - test/sys/bus/acpi/devices/device:16 | 1 - test/sys/bus/acpi/devices/device:17 | 1 - test/sys/bus/acpi/devices/device:18 | 1 - test/sys/bus/acpi/devices/device:19 | 1 - test/sys/bus/acpi/devices/device:1a | 1 - test/sys/bus/acpi/devices/device:1b | 1 - test/sys/bus/acpi/devices/device:1c | 1 - test/sys/bus/acpi/devices/device:1d | 1 - test/sys/bus/acpi/devices/device:1e | 1 - test/sys/bus/acpi/devices/device:1f | 1 - test/sys/bus/acpi/devices/device:20 | 1 - test/sys/bus/acpi/devices/device:21 | 1 - test/sys/bus/acpi/devices/device:22 | 1 - test/sys/bus/acpi/devices/device:23 | 1 - test/sys/bus/acpi/devices/device:24 | 1 - test/sys/bus/acpi/devices/device:25 | 1 - test/sys/bus/acpi/drivers/ac/ACPI0003:00 | 1 - test/sys/bus/acpi/drivers/battery/PNP0C0A:00 | 1 - test/sys/bus/acpi/drivers/button/LNXPWRBN:00 | 1 - test/sys/bus/acpi/drivers/button/PNP0C0D:00 | 1 - test/sys/bus/acpi/drivers/button/PNP0C0E:00 | 1 - test/sys/bus/acpi/drivers/ec/PNP0C09:00 | 1 - test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 | 1 - test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 | 1 - test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 | 1 - test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 | 1 - test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 | 1 - test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 | 1 - test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 | 1 - test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 | 1 - test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 | 1 - test/sys/bus/acpi/drivers/power/LNXPOWER:00 | 1 - test/sys/bus/acpi/drivers/processor/ACPI0007:00 | 1 - test/sys/bus/acpi/drivers/processor/ACPI0007:01 | 1 - test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 | 1 - test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 | 1 - .../bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 | 1 - test/sys/bus/acpi/drivers_autoprobe | 1 - test/sys/bus/pci/devices/0000:00:00.0 | 1 - test/sys/bus/pci/devices/0000:00:01.0 | 1 - test/sys/bus/pci/devices/0000:00:1b.0 | 1 - test/sys/bus/pci/devices/0000:00:1c.0 | 1 - test/sys/bus/pci/devices/0000:00:1c.1 | 1 - test/sys/bus/pci/devices/0000:00:1c.2 | 1 - test/sys/bus/pci/devices/0000:00:1c.3 | 1 - test/sys/bus/pci/devices/0000:00:1d.0 | 1 - test/sys/bus/pci/devices/0000:00:1d.1 | 1 - test/sys/bus/pci/devices/0000:00:1d.2 | 1 - test/sys/bus/pci/devices/0000:00:1d.3 | 1 - test/sys/bus/pci/devices/0000:00:1e.0 | 1 - test/sys/bus/pci/devices/0000:00:1f.0 | 1 - test/sys/bus/pci/devices/0000:00:1f.1 | 1 - test/sys/bus/pci/devices/0000:00:1f.2 | 1 - test/sys/bus/pci/devices/0000:00:1f.3 | 1 - test/sys/bus/pci/devices/0000:01:00.0 | 1 - test/sys/bus/pci/devices/0000:02:00.0 | 1 - test/sys/bus/pci/devices/0000:03:00.0 | 1 - test/sys/bus/pci/devices/0000:15:00.0 | 1 - test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 | 1 - test/sys/bus/pci/drivers/HDA Intel/module | 1 - test/sys/bus/pci/drivers/agpgart-intel/module | 1 - test/sys/bus/pci/drivers/ahci/0000:00:1f.2 | 1 - test/sys/bus/pci/drivers/ahci/module | 1 - test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 | 1 - test/sys/bus/pci/drivers/e1000e/0000:02:00.0 | 1 - test/sys/bus/pci/drivers/e1000e/module | 1 - test/sys/bus/pci/drivers/ehci_hcd/module | 1 - test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 | 1 - test/sys/bus/pci/drivers/iwl3945/module | 1 - .../bus/pci/drivers/pcieport-driver/0000:00:01.0 | 1 - .../bus/pci/drivers/pcieport-driver/0000:00:1c.0 | 1 - .../bus/pci/drivers/pcieport-driver/0000:00:1c.1 | 1 - .../bus/pci/drivers/pcieport-driver/0000:00:1c.2 | 1 - .../bus/pci/drivers/pcieport-driver/0000:00:1c.3 | 1 - test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 | 1 - test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 | 1 - test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 | 1 - test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 | 1 - test/sys/bus/pci/drivers/uhci_hcd/module | 1 - .../sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 | 1 - test/sys/bus/pci/drivers/yenta_cardbus/module | 1 - test/sys/bus/pci/drivers_autoprobe | 1 - .../bus/pci_express/devices/0000:00:01.0:pcie00 | 1 - .../bus/pci_express/devices/0000:00:01.0:pcie03 | 1 - .../bus/pci_express/devices/0000:00:1c.0:pcie00 | 1 - .../bus/pci_express/devices/0000:00:1c.0:pcie02 | 1 - .../bus/pci_express/devices/0000:00:1c.0:pcie03 | 1 - .../bus/pci_express/devices/0000:00:1c.1:pcie00 | 1 - .../bus/pci_express/devices/0000:00:1c.1:pcie02 | 1 - .../bus/pci_express/devices/0000:00:1c.1:pcie03 | 1 - .../bus/pci_express/devices/0000:00:1c.2:pcie00 | 1 - .../bus/pci_express/devices/0000:00:1c.2:pcie02 | 1 - .../bus/pci_express/devices/0000:00:1c.2:pcie03 | 1 - .../bus/pci_express/devices/0000:00:1c.3:pcie00 | 1 - .../bus/pci_express/devices/0000:00:1c.3:pcie02 | 1 - .../bus/pci_express/devices/0000:00:1c.3:pcie03 | 1 - test/sys/bus/pci_express/drivers_autoprobe | 1 - test/sys/bus/pcmcia/drivers_autoprobe | 1 - test/sys/bus/platform/devices/dock.0 | 1 - test/sys/bus/platform/devices/i8042 | 1 - test/sys/bus/platform/devices/microcode | 1 - test/sys/bus/platform/devices/pcspkr | 1 - test/sys/bus/platform/devices/serial8250 | 1 - test/sys/bus/platform/devices/thinkpad_acpi | 1 - test/sys/bus/platform/devices/thinkpad_hwmon | 1 - test/sys/bus/platform/devices/vesafb.0 | 1 - test/sys/bus/platform/drivers/i8042/i8042 | 1 - test/sys/bus/platform/drivers/pcspkr/module | 1 - test/sys/bus/platform/drivers/pcspkr/pcspkr | 1 - .../sys/bus/platform/drivers/serial8250/serial8250 | 1 - .../bus/platform/drivers/thinkpad_acpi/debug_level | 1 - .../drivers/thinkpad_acpi/interface_version | 1 - test/sys/bus/platform/drivers/thinkpad_acpi/module | 1 - .../platform/drivers/thinkpad_acpi/thinkpad_acpi | 1 - .../sys/bus/platform/drivers/thinkpad_acpi/version | 1 - .../platform/drivers/thinkpad_hwmon/debug_level | 1 - .../platform/drivers/thinkpad_hwmon/fan_watchdog | 1 - .../drivers/thinkpad_hwmon/interface_version | 1 - .../sys/bus/platform/drivers/thinkpad_hwmon/module | 1 - .../platform/drivers/thinkpad_hwmon/thinkpad_hwmon | 1 - .../bus/platform/drivers/thinkpad_hwmon/version | 1 - test/sys/bus/platform/drivers/vesafb/vesafb.0 | 1 - test/sys/bus/platform/drivers_autoprobe | 1 - test/sys/bus/pnp/devices/00:00 | 1 - test/sys/bus/pnp/devices/00:01 | 1 - test/sys/bus/pnp/devices/00:02 | 1 - test/sys/bus/pnp/devices/00:03 | 1 - test/sys/bus/pnp/devices/00:04 | 1 - test/sys/bus/pnp/devices/00:05 | 1 - test/sys/bus/pnp/devices/00:06 | 1 - test/sys/bus/pnp/devices/00:07 | 1 - test/sys/bus/pnp/devices/00:08 | 1 - test/sys/bus/pnp/devices/00:09 | 1 - test/sys/bus/pnp/devices/00:0a | 1 - test/sys/bus/pnp/drivers/i8042 aux/00:09 | 1 - test/sys/bus/pnp/drivers/i8042 kbd/00:08 | 1 - test/sys/bus/pnp/drivers/rtc_cmos/00:07 | 1 - test/sys/bus/pnp/drivers/system/00:00 | 1 - test/sys/bus/pnp/drivers/system/00:02 | 1 - test/sys/bus/pnp/drivers_autoprobe | 1 - test/sys/bus/scsi/devices/0:0:0:0 | 1 - test/sys/bus/scsi/devices/4:0:0:0 | 1 - test/sys/bus/scsi/devices/7:0:0:0 | 1 - test/sys/bus/scsi/devices/host0 | 1 - test/sys/bus/scsi/devices/host1 | 1 - test/sys/bus/scsi/devices/host2 | 1 - test/sys/bus/scsi/devices/host3 | 1 - test/sys/bus/scsi/devices/host4 | 1 - test/sys/bus/scsi/devices/host5 | 1 - test/sys/bus/scsi/devices/host7 | 1 - test/sys/bus/scsi/devices/target0:0:0 | 1 - test/sys/bus/scsi/devices/target4:0:0 | 1 - test/sys/bus/scsi/devices/target7:0:0 | 1 - test/sys/bus/scsi/drivers/sd/0:0:0:0 | 1 - test/sys/bus/scsi/drivers/sd/7:0:0:0 | 1 - test/sys/bus/scsi/drivers/sr/4:0:0:0 | 1 - test/sys/bus/scsi/drivers_autoprobe | 1 - test/sys/bus/serio/devices/serio0 | 1 - test/sys/bus/serio/devices/serio1 | 1 - test/sys/bus/serio/drivers/atkbd/bind_mode | 1 - test/sys/bus/serio/drivers/atkbd/description | 1 - test/sys/bus/serio/drivers/atkbd/module | 1 - test/sys/bus/serio/drivers/atkbd/serio0 | 1 - test/sys/bus/serio/drivers/psmouse/bind_mode | 1 - test/sys/bus/serio/drivers/psmouse/description | 1 - test/sys/bus/serio/drivers/psmouse/module | 1 - test/sys/bus/serio/drivers/psmouse/serio1 | 1 - test/sys/bus/serio/drivers_autoprobe | 1 - test/sys/bus/usb/devices/1-0:1.0 | 1 - test/sys/bus/usb/devices/2-0:1.0 | 1 - test/sys/bus/usb/devices/3-0:1.0 | 1 - test/sys/bus/usb/devices/3-1 | 1 - test/sys/bus/usb/devices/3-1:1.0 | 1 - test/sys/bus/usb/devices/4-0:1.0 | 1 - test/sys/bus/usb/devices/4-1 | 1 - test/sys/bus/usb/devices/4-1:1.0 | 1 - test/sys/bus/usb/devices/4-1:1.1 | 1 - test/sys/bus/usb/devices/4-1:1.2 | 1 - test/sys/bus/usb/devices/4-1:1.3 | 1 - test/sys/bus/usb/devices/4-2 | 1 - test/sys/bus/usb/devices/4-2:1.0 | 1 - test/sys/bus/usb/devices/5-0:1.0 | 1 - test/sys/bus/usb/devices/5-1 | 1 - test/sys/bus/usb/devices/5-1:1.0 | 1 - test/sys/bus/usb/devices/5-2 | 1 - test/sys/bus/usb/devices/5-2:1.0 | 1 - test/sys/bus/usb/devices/5-2:1.1 | 1 - test/sys/bus/usb/devices/5-2:1.10 | 1 - test/sys/bus/usb/devices/5-2:1.11 | 1 - test/sys/bus/usb/devices/5-2:1.12 | 1 - test/sys/bus/usb/devices/5-2:1.13 | 1 - test/sys/bus/usb/devices/5-2:1.2 | 1 - test/sys/bus/usb/devices/5-2:1.3 | 1 - test/sys/bus/usb/devices/5-2:1.4 | 1 - test/sys/bus/usb/devices/5-2:1.5 | 1 - test/sys/bus/usb/devices/5-2:1.6 | 1 - test/sys/bus/usb/devices/5-2:1.9 | 1 - test/sys/bus/usb/devices/usb1 | 1 - test/sys/bus/usb/devices/usb2 | 1 - test/sys/bus/usb/devices/usb3 | 1 - test/sys/bus/usb/devices/usb4 | 1 - test/sys/bus/usb/devices/usb5 | 1 - test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 | 1 - test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 | 1 - test/sys/bus/usb/drivers/cdc_acm/module | 1 - test/sys/bus/usb/drivers/hub/1-0:1.0 | 1 - test/sys/bus/usb/drivers/hub/2-0:1.0 | 1 - test/sys/bus/usb/drivers/hub/3-0:1.0 | 1 - test/sys/bus/usb/drivers/hub/4-0:1.0 | 1 - test/sys/bus/usb/drivers/hub/5-0:1.0 | 1 - test/sys/bus/usb/drivers/hub/module | 1 - test/sys/bus/usb/drivers/usb-storage/5-1:1.0 | 1 - test/sys/bus/usb/drivers/usb-storage/module | 1 - test/sys/bus/usb/drivers/usb/3-1 | 1 - test/sys/bus/usb/drivers/usb/4-1 | 1 - test/sys/bus/usb/drivers/usb/4-2 | 1 - test/sys/bus/usb/drivers/usb/5-1 | 1 - test/sys/bus/usb/drivers/usb/5-2 | 1 - test/sys/bus/usb/drivers/usb/module | 1 - test/sys/bus/usb/drivers/usb/usb1 | 1 - test/sys/bus/usb/drivers/usb/usb2 | 1 - test/sys/bus/usb/drivers/usb/usb3 | 1 - test/sys/bus/usb/drivers/usb/usb4 | 1 - test/sys/bus/usb/drivers/usb/usb5 | 1 - test/sys/bus/usb/drivers/usbfs/module | 1 - test/sys/bus/usb/drivers/usbhid/3-1:1.0 | 1 - test/sys/bus/usb/drivers/usbhid/module | 1 - test/sys/bus/usb/drivers_autoprobe | 1 - test/sys/class/bdi/0:16 | 1 - test/sys/class/bdi/11:0 | 1 - test/sys/class/bdi/7:0 | 1 - test/sys/class/bdi/7:1 | 1 - test/sys/class/bdi/7:2 | 1 - test/sys/class/bdi/7:3 | 1 - test/sys/class/bdi/7:4 | 1 - test/sys/class/bdi/7:5 | 1 - test/sys/class/bdi/7:6 | 1 - test/sys/class/bdi/7:7 | 1 - test/sys/class/bdi/8:0 | 1 - test/sys/class/bdi/8:16 | 1 - test/sys/class/bdi/9:0 | 1 - test/sys/class/bdi/default | 1 - test/sys/class/block/loop0 | 1 - test/sys/class/block/loop1 | 1 - test/sys/class/block/loop2 | 1 - test/sys/class/block/loop3 | 1 - test/sys/class/block/loop4 | 1 - test/sys/class/block/loop5 | 1 - test/sys/class/block/loop6 | 1 - test/sys/class/block/loop7 | 1 - test/sys/class/block/md0 | 1 - test/sys/class/block/sda | 1 - test/sys/class/block/sda1 | 1 - test/sys/class/block/sda10 | 1 - test/sys/class/block/sda5 | 1 - test/sys/class/block/sda6 | 1 - test/sys/class/block/sda7 | 1 - test/sys/class/block/sda8 | 1 - test/sys/class/block/sda9 | 1 - test/sys/class/block/sdb | 1 - test/sys/class/block/sdb1 | 1 - test/sys/class/block/sr0 | 1 - test/sys/class/bsg/0:0:0:0 | 1 - test/sys/class/bsg/4:0:0:0 | 1 - test/sys/class/bsg/7:0:0:0 | 1 - test/sys/class/dmi/id | 1 - test/sys/class/firmware/timeout | 1 - test/sys/class/graphics/fb0 | 1 - test/sys/class/graphics/fbcon | 1 - test/sys/class/hwmon/hwmon0 | 1 - test/sys/class/ieee80211/phy0 | 1 - test/sys/class/input/event0 | 1 - test/sys/class/input/event1 | 1 - test/sys/class/input/event2 | 1 - test/sys/class/input/event3 | 1 - test/sys/class/input/event4 | 1 - test/sys/class/input/event5 | 1 - test/sys/class/input/event6 | 1 - test/sys/class/input/event7 | 1 - test/sys/class/input/input0 | 1 - test/sys/class/input/input1 | 1 - test/sys/class/input/input2 | 1 - test/sys/class/input/input3 | 1 - test/sys/class/input/input4 | 1 - test/sys/class/input/input5 | 1 - test/sys/class/input/input6 | 1 - test/sys/class/input/input8 | 1 - test/sys/class/input/mice | 1 - test/sys/class/input/mouse0 | 1 - test/sys/class/input/mouse1 | 1 - test/sys/class/leds/iwl-phy0:RX | 1 - test/sys/class/leds/iwl-phy0:TX | 1 - test/sys/class/leds/iwl-phy0:assoc | 1 - test/sys/class/leds/iwl-phy0:radio | 1 - test/sys/class/leds/tpacpi::bay_active | 1 - test/sys/class/leds/tpacpi::dock_active | 1 - test/sys/class/leds/tpacpi::dock_batt | 1 - test/sys/class/leds/tpacpi::power | 1 - test/sys/class/leds/tpacpi::standby | 1 - test/sys/class/leds/tpacpi::thinklight | 1 - test/sys/class/leds/tpacpi::unknown_led | 1 - test/sys/class/leds/tpacpi:green:batt | 1 - test/sys/class/leds/tpacpi:orange:batt | 1 - test/sys/class/mem/full | 1 - test/sys/class/mem/kmem | 1 - test/sys/class/mem/kmsg | 1 - test/sys/class/mem/mem | 1 - test/sys/class/mem/null | 1 - test/sys/class/mem/port | 1 - test/sys/class/mem/random | 1 - test/sys/class/mem/urandom | 1 - test/sys/class/mem/zero | 1 - test/sys/class/misc/cpu_dma_latency | 1 - test/sys/class/misc/device-mapper | 1 - test/sys/class/misc/fuse | 1 - test/sys/class/misc/hpet | 1 - test/sys/class/misc/mcelog | 1 - test/sys/class/misc/microcode | 1 - test/sys/class/misc/network_latency | 1 - test/sys/class/misc/network_throughput | 1 - test/sys/class/misc/nvram | 1 - test/sys/class/misc/psaux | 1 - test/sys/class/misc/uinput | 1 - test/sys/class/net/eth0 | 1 - test/sys/class/net/lo | 1 - test/sys/class/net/wlan0 | 1 - test/sys/class/net/wmaster0 | 1 - test/sys/class/pci_bus/0000:00 | 1 - test/sys/class/pci_bus/0000:01 | 1 - test/sys/class/pci_bus/0000:02 | 1 - test/sys/class/pci_bus/0000:03 | 1 - test/sys/class/pci_bus/0000:04 | 1 - test/sys/class/pci_bus/0000:0c | 1 - test/sys/class/pci_bus/0000:15 | 1 - test/sys/class/pci_bus/0000:16 | 1 - test/sys/class/pcmcia_socket/pcmcia_socket0 | 1 - test/sys/class/power_supply/AC | 1 - test/sys/class/power_supply/BAT0 | 1 - test/sys/class/rfkill/rfkill0 | 1 - test/sys/class/rtc/rtc0 | 1 - test/sys/class/scsi_device/0:0:0:0 | 1 - test/sys/class/scsi_device/4:0:0:0 | 1 - test/sys/class/scsi_device/7:0:0:0 | 1 - test/sys/class/scsi_disk/0:0:0:0 | 1 - test/sys/class/scsi_disk/7:0:0:0 | 1 - test/sys/class/scsi_generic/sg0 | 1 - test/sys/class/scsi_generic/sg1 | 1 - test/sys/class/scsi_generic/sg2 | 1 - test/sys/class/scsi_host/host0 | 1 - test/sys/class/scsi_host/host1 | 1 - test/sys/class/scsi_host/host2 | 1 - test/sys/class/scsi_host/host3 | 1 - test/sys/class/scsi_host/host4 | 1 - test/sys/class/scsi_host/host5 | 1 - test/sys/class/scsi_host/host7 | 1 - test/sys/class/sound/adsp | 1 - test/sys/class/sound/audio | 1 - test/sys/class/sound/card0 | 1 - test/sys/class/sound/controlC0 | 1 - test/sys/class/sound/dsp | 1 - test/sys/class/sound/mixer | 1 - test/sys/class/sound/pcmC0D0c | 1 - test/sys/class/sound/pcmC0D0p | 1 - test/sys/class/sound/pcmC0D1p | 1 - test/sys/class/sound/seq | 1 - test/sys/class/sound/timer | 1 - test/sys/class/thermal/cooling_device0 | 1 - test/sys/class/thermal/cooling_device1 | 1 - test/sys/class/thermal/thermal_zone0 | 1 - test/sys/class/thermal/thermal_zone1 | 1 - test/sys/class/tty/console | 1 - test/sys/class/tty/ptmx | 1 - test/sys/class/tty/tty | 1 - test/sys/class/tty/tty0 | 1 - test/sys/class/tty/tty1 | 1 - test/sys/class/tty/tty10 | 1 - test/sys/class/tty/tty11 | 1 - test/sys/class/tty/tty12 | 1 - test/sys/class/tty/tty13 | 1 - test/sys/class/tty/tty14 | 1 - test/sys/class/tty/tty15 | 1 - test/sys/class/tty/tty16 | 1 - test/sys/class/tty/tty17 | 1 - test/sys/class/tty/tty18 | 1 - test/sys/class/tty/tty19 | 1 - test/sys/class/tty/tty2 | 1 - test/sys/class/tty/tty20 | 1 - test/sys/class/tty/tty21 | 1 - test/sys/class/tty/tty22 | 1 - test/sys/class/tty/tty23 | 1 - test/sys/class/tty/tty24 | 1 - test/sys/class/tty/tty25 | 1 - test/sys/class/tty/tty26 | 1 - test/sys/class/tty/tty27 | 1 - test/sys/class/tty/tty28 | 1 - test/sys/class/tty/tty29 | 1 - test/sys/class/tty/tty3 | 1 - test/sys/class/tty/tty30 | 1 - test/sys/class/tty/tty31 | 1 - test/sys/class/tty/tty32 | 1 - test/sys/class/tty/tty33 | 1 - test/sys/class/tty/tty34 | 1 - test/sys/class/tty/tty35 | 1 - test/sys/class/tty/tty36 | 1 - test/sys/class/tty/tty37 | 1 - test/sys/class/tty/tty38 | 1 - test/sys/class/tty/tty39 | 1 - test/sys/class/tty/tty4 | 1 - test/sys/class/tty/tty40 | 1 - test/sys/class/tty/tty41 | 1 - test/sys/class/tty/tty42 | 1 - test/sys/class/tty/tty43 | 1 - test/sys/class/tty/tty44 | 1 - test/sys/class/tty/tty45 | 1 - test/sys/class/tty/tty46 | 1 - test/sys/class/tty/tty47 | 1 - test/sys/class/tty/tty48 | 1 - test/sys/class/tty/tty49 | 1 - test/sys/class/tty/tty5 | 1 - test/sys/class/tty/tty50 | 1 - test/sys/class/tty/tty51 | 1 - test/sys/class/tty/tty52 | 1 - test/sys/class/tty/tty53 | 1 - test/sys/class/tty/tty54 | 1 - test/sys/class/tty/tty55 | 1 - test/sys/class/tty/tty56 | 1 - test/sys/class/tty/tty57 | 1 - test/sys/class/tty/tty58 | 1 - test/sys/class/tty/tty59 | 1 - test/sys/class/tty/tty6 | 1 - test/sys/class/tty/tty60 | 1 - test/sys/class/tty/tty61 | 1 - test/sys/class/tty/tty62 | 1 - test/sys/class/tty/tty63 | 1 - test/sys/class/tty/tty7 | 1 - test/sys/class/tty/tty8 | 1 - test/sys/class/tty/tty9 | 1 - test/sys/class/tty/ttyACM0 | 1 - test/sys/class/tty/ttyS0 | 1 - test/sys/class/tty/ttyS1 | 1 - test/sys/class/tty/ttyS2 | 1 - test/sys/class/tty/ttyS3 | 1 - test/sys/class/usb_endpoint/usbdev1.1_ep00 | 1 - test/sys/class/usb_endpoint/usbdev1.1_ep81 | 1 - test/sys/class/usb_endpoint/usbdev2.1_ep00 | 1 - test/sys/class/usb_endpoint/usbdev2.1_ep81 | 1 - test/sys/class/usb_endpoint/usbdev3.1_ep00 | 1 - test/sys/class/usb_endpoint/usbdev3.1_ep81 | 1 - test/sys/class/usb_endpoint/usbdev3.4_ep00 | 1 - test/sys/class/usb_endpoint/usbdev3.4_ep81 | 1 - test/sys/class/usb_endpoint/usbdev4.1_ep00 | 1 - test/sys/class/usb_endpoint/usbdev4.1_ep81 | 1 - test/sys/class/usb_endpoint/usbdev4.2_ep00 | 1 - test/sys/class/usb_endpoint/usbdev4.2_ep02 | 1 - test/sys/class/usb_endpoint/usbdev4.2_ep03 | 1 - test/sys/class/usb_endpoint/usbdev4.2_ep04 | 1 - test/sys/class/usb_endpoint/usbdev4.2_ep81 | 1 - test/sys/class/usb_endpoint/usbdev4.2_ep82 | 1 - test/sys/class/usb_endpoint/usbdev4.2_ep83 | 1 - test/sys/class/usb_endpoint/usbdev4.2_ep84 | 1 - test/sys/class/usb_endpoint/usbdev4.3_ep00 | 1 - test/sys/class/usb_endpoint/usbdev4.3_ep02 | 1 - test/sys/class/usb_endpoint/usbdev4.3_ep81 | 1 - test/sys/class/usb_endpoint/usbdev4.3_ep83 | 1 - test/sys/class/usb_endpoint/usbdev5.1_ep00 | 1 - test/sys/class/usb_endpoint/usbdev5.1_ep81 | 1 - test/sys/class/usb_endpoint/usbdev5.7_ep00 | 1 - test/sys/class/usb_endpoint/usbdev5.7_ep02 | 1 - test/sys/class/usb_endpoint/usbdev5.7_ep81 | 1 - test/sys/class/usb_endpoint/usbdev5.9_ep00 | 1 - test/sys/class/usb_endpoint/usbdev5.9_ep01 | 1 - test/sys/class/usb_endpoint/usbdev5.9_ep02 | 1 - test/sys/class/usb_endpoint/usbdev5.9_ep81 | 1 - test/sys/class/usb_endpoint/usbdev5.9_ep82 | 1 - test/sys/class/usb_endpoint/usbdev5.9_ep83 | 1 - test/sys/class/usb_endpoint/usbdev5.9_ep84 | 1 - test/sys/class/usb_host/usb_host1 | 1 - test/sys/class/usb_host/usb_host2 | 1 - test/sys/class/usb_host/usb_host3 | 1 - test/sys/class/usb_host/usb_host4 | 1 - test/sys/class/usb_host/usb_host5 | 1 - test/sys/class/vc/vcs | 1 - test/sys/class/vc/vcs1 | 1 - test/sys/class/vc/vcs10 | 1 - test/sys/class/vc/vcs2 | 1 - test/sys/class/vc/vcs3 | 1 - test/sys/class/vc/vcs4 | 1 - test/sys/class/vc/vcs5 | 1 - test/sys/class/vc/vcs6 | 1 - test/sys/class/vc/vcs7 | 1 - test/sys/class/vc/vcsa | 1 - test/sys/class/vc/vcsa1 | 1 - test/sys/class/vc/vcsa10 | 1 - test/sys/class/vc/vcsa2 | 1 - test/sys/class/vc/vcsa3 | 1 - test/sys/class/vc/vcsa4 | 1 - test/sys/class/vc/vcsa5 | 1 - test/sys/class/vc/vcsa6 | 1 - test/sys/class/vc/vcsa7 | 1 - test/sys/class/vtconsole/vtcon0 | 1 - test/sys/class/vtconsole/vtcon1 | 1 - test/sys/dev/block/11:0 | 1 - test/sys/dev/block/7:0 | 1 - test/sys/dev/block/7:1 | 1 - test/sys/dev/block/7:2 | 1 - test/sys/dev/block/7:3 | 1 - test/sys/dev/block/7:4 | 1 - test/sys/dev/block/7:5 | 1 - test/sys/dev/block/7:6 | 1 - test/sys/dev/block/7:7 | 1 - test/sys/dev/block/8:0 | 1 - test/sys/dev/block/8:1 | 1 - test/sys/dev/block/8:10 | 1 - test/sys/dev/block/8:16 | 1 - test/sys/dev/block/8:17 | 1 - test/sys/dev/block/8:5 | 1 - test/sys/dev/block/8:6 | 1 - test/sys/dev/block/8:7 | 1 - test/sys/dev/block/8:8 | 1 - test/sys/dev/block/8:9 | 1 - test/sys/dev/block/9:0 | 1 - test/sys/dev/char/10:1 | 1 - test/sys/dev/char/10:144 | 1 - test/sys/dev/char/10:184 | 1 - test/sys/dev/char/10:223 | 1 - test/sys/dev/char/10:227 | 1 - test/sys/dev/char/10:228 | 1 - test/sys/dev/char/10:229 | 1 - test/sys/dev/char/10:60 | 1 - test/sys/dev/char/10:61 | 1 - test/sys/dev/char/10:62 | 1 - test/sys/dev/char/10:63 | 1 - test/sys/dev/char/116:0 | 1 - test/sys/dev/char/116:1 | 1 - test/sys/dev/char/116:16 | 1 - test/sys/dev/char/116:17 | 1 - test/sys/dev/char/116:24 | 1 - test/sys/dev/char/116:33 | 1 - test/sys/dev/char/13:32 | 1 - test/sys/dev/char/13:33 | 1 - test/sys/dev/char/13:63 | 1 - test/sys/dev/char/13:64 | 1 - test/sys/dev/char/13:65 | 1 - test/sys/dev/char/13:66 | 1 - test/sys/dev/char/13:67 | 1 - test/sys/dev/char/13:68 | 1 - test/sys/dev/char/13:69 | 1 - test/sys/dev/char/13:70 | 1 - test/sys/dev/char/13:71 | 1 - test/sys/dev/char/14:0 | 1 - test/sys/dev/char/14:12 | 1 - test/sys/dev/char/14:3 | 1 - test/sys/dev/char/14:4 | 1 - test/sys/dev/char/166:0 | 1 - test/sys/dev/char/189:0 | 1 - test/sys/dev/char/189:128 | 1 - test/sys/dev/char/189:256 | 1 - test/sys/dev/char/189:259 | 1 - test/sys/dev/char/189:384 | 1 - test/sys/dev/char/189:385 | 1 - test/sys/dev/char/189:386 | 1 - test/sys/dev/char/189:512 | 1 - test/sys/dev/char/189:518 | 1 - test/sys/dev/char/189:520 | 1 - test/sys/dev/char/1:1 | 1 - test/sys/dev/char/1:11 | 1 - test/sys/dev/char/1:2 | 1 - test/sys/dev/char/1:3 | 1 - test/sys/dev/char/1:4 | 1 - test/sys/dev/char/1:5 | 1 - test/sys/dev/char/1:7 | 1 - test/sys/dev/char/1:8 | 1 - test/sys/dev/char/1:9 | 1 - test/sys/dev/char/21:0 | 1 - test/sys/dev/char/21:1 | 1 - test/sys/dev/char/21:2 | 1 - test/sys/dev/char/252:0 | 1 - test/sys/dev/char/252:1 | 1 - test/sys/dev/char/252:10 | 1 - test/sys/dev/char/252:11 | 1 - test/sys/dev/char/252:12 | 1 - test/sys/dev/char/252:13 | 1 - test/sys/dev/char/252:14 | 1 - test/sys/dev/char/252:15 | 1 - test/sys/dev/char/252:16 | 1 - test/sys/dev/char/252:17 | 1 - test/sys/dev/char/252:18 | 1 - test/sys/dev/char/252:19 | 1 - test/sys/dev/char/252:2 | 1 - test/sys/dev/char/252:20 | 1 - test/sys/dev/char/252:21 | 1 - test/sys/dev/char/252:22 | 1 - test/sys/dev/char/252:23 | 1 - test/sys/dev/char/252:24 | 1 - test/sys/dev/char/252:25 | 1 - test/sys/dev/char/252:26 | 1 - test/sys/dev/char/252:27 | 1 - test/sys/dev/char/252:28 | 1 - test/sys/dev/char/252:29 | 1 - test/sys/dev/char/252:3 | 1 - test/sys/dev/char/252:30 | 1 - test/sys/dev/char/252:31 | 1 - test/sys/dev/char/252:32 | 1 - test/sys/dev/char/252:33 | 1 - test/sys/dev/char/252:4 | 1 - test/sys/dev/char/252:5 | 1 - test/sys/dev/char/252:6 | 1 - test/sys/dev/char/252:7 | 1 - test/sys/dev/char/252:8 | 1 - test/sys/dev/char/252:9 | 1 - test/sys/dev/char/253:0 | 1 - test/sys/dev/char/254:0 | 1 - test/sys/dev/char/254:1 | 1 - test/sys/dev/char/254:2 | 1 - test/sys/dev/char/29:0 | 1 - test/sys/dev/char/4:0 | 1 - test/sys/dev/char/4:1 | 1 - test/sys/dev/char/4:10 | 1 - test/sys/dev/char/4:11 | 1 - test/sys/dev/char/4:12 | 1 - test/sys/dev/char/4:13 | 1 - test/sys/dev/char/4:14 | 1 - test/sys/dev/char/4:15 | 1 - test/sys/dev/char/4:16 | 1 - test/sys/dev/char/4:17 | 1 - test/sys/dev/char/4:18 | 1 - test/sys/dev/char/4:19 | 1 - test/sys/dev/char/4:2 | 1 - test/sys/dev/char/4:20 | 1 - test/sys/dev/char/4:21 | 1 - test/sys/dev/char/4:22 | 1 - test/sys/dev/char/4:23 | 1 - test/sys/dev/char/4:24 | 1 - test/sys/dev/char/4:25 | 1 - test/sys/dev/char/4:26 | 1 - test/sys/dev/char/4:27 | 1 - test/sys/dev/char/4:28 | 1 - test/sys/dev/char/4:29 | 1 - test/sys/dev/char/4:3 | 1 - test/sys/dev/char/4:30 | 1 - test/sys/dev/char/4:31 | 1 - test/sys/dev/char/4:32 | 1 - test/sys/dev/char/4:33 | 1 - test/sys/dev/char/4:34 | 1 - test/sys/dev/char/4:35 | 1 - test/sys/dev/char/4:36 | 1 - test/sys/dev/char/4:37 | 1 - test/sys/dev/char/4:38 | 1 - test/sys/dev/char/4:39 | 1 - test/sys/dev/char/4:4 | 1 - test/sys/dev/char/4:40 | 1 - test/sys/dev/char/4:41 | 1 - test/sys/dev/char/4:42 | 1 - test/sys/dev/char/4:43 | 1 - test/sys/dev/char/4:44 | 1 - test/sys/dev/char/4:45 | 1 - test/sys/dev/char/4:46 | 1 - test/sys/dev/char/4:47 | 1 - test/sys/dev/char/4:48 | 1 - test/sys/dev/char/4:49 | 1 - test/sys/dev/char/4:5 | 1 - test/sys/dev/char/4:50 | 1 - test/sys/dev/char/4:51 | 1 - test/sys/dev/char/4:52 | 1 - test/sys/dev/char/4:53 | 1 - test/sys/dev/char/4:54 | 1 - test/sys/dev/char/4:55 | 1 - test/sys/dev/char/4:56 | 1 - test/sys/dev/char/4:57 | 1 - test/sys/dev/char/4:58 | 1 - test/sys/dev/char/4:59 | 1 - test/sys/dev/char/4:6 | 1 - test/sys/dev/char/4:60 | 1 - test/sys/dev/char/4:61 | 1 - test/sys/dev/char/4:62 | 1 - test/sys/dev/char/4:63 | 1 - test/sys/dev/char/4:64 | 1 - test/sys/dev/char/4:65 | 1 - test/sys/dev/char/4:66 | 1 - test/sys/dev/char/4:67 | 1 - test/sys/dev/char/4:7 | 1 - test/sys/dev/char/4:8 | 1 - test/sys/dev/char/4:9 | 1 - test/sys/dev/char/5:0 | 1 - test/sys/dev/char/5:1 | 1 - test/sys/dev/char/5:2 | 1 - test/sys/dev/char/7:0 | 1 - test/sys/dev/char/7:1 | 1 - test/sys/dev/char/7:10 | 1 - test/sys/dev/char/7:128 | 1 - test/sys/dev/char/7:129 | 1 - test/sys/dev/char/7:130 | 1 - test/sys/dev/char/7:131 | 1 - test/sys/dev/char/7:132 | 1 - test/sys/dev/char/7:133 | 1 - test/sys/dev/char/7:134 | 1 - test/sys/dev/char/7:135 | 1 - test/sys/dev/char/7:138 | 1 - test/sys/dev/char/7:2 | 1 - test/sys/dev/char/7:3 | 1 - test/sys/dev/char/7:4 | 1 - test/sys/dev/char/7:5 | 1 - test/sys/dev/char/7:6 | 1 - test/sys/dev/char/7:7 | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:00/path | 1 - .../devices/LNXSYSTM:00/ACPI0007:00/power/wakeup | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev | 1 - .../LNXSYSTM:00/ACPI0007:00/thermal_cooling | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent | 2 - test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:01/path | 1 - .../devices/LNXSYSTM:00/ACPI0007:01/power/wakeup | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev | 1 - .../LNXSYSTM:00/ACPI0007:01/thermal_cooling | 1 - test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent | 2 - test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver | 1 - test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid | 1 - .../LNXPWRBN:00/input/input3/capabilities/abs | 1 - .../LNXPWRBN:00/input/input3/capabilities/ev | 1 - .../LNXPWRBN:00/input/input3/capabilities/ff | 1 - .../LNXPWRBN:00/input/input3/capabilities/key | 1 - .../LNXPWRBN:00/input/input3/capabilities/led | 1 - .../LNXPWRBN:00/input/input3/capabilities/msc | 1 - .../LNXPWRBN:00/input/input3/capabilities/rel | 1 - .../LNXPWRBN:00/input/input3/capabilities/snd | 1 - .../LNXPWRBN:00/input/input3/capabilities/sw | 1 - .../LNXSYSTM:00/LNXPWRBN:00/input/input3/device | 1 - .../LNXPWRBN:00/input/input3/event3/dev | 1 - .../LNXPWRBN:00/input/input3/event3/device | 1 - .../LNXPWRBN:00/input/input3/event3/power/wakeup | 1 - .../LNXPWRBN:00/input/input3/event3/subsystem | 1 - .../LNXPWRBN:00/input/input3/event3/uevent | 2 - .../LNXPWRBN:00/input/input3/id/bustype | 1 - .../LNXPWRBN:00/input/input3/id/product | 1 - .../LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor | 1 - .../LNXPWRBN:00/input/input3/id/version | 1 - .../LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias | 1 - .../LNXSYSTM:00/LNXPWRBN:00/input/input3/name | 1 - .../LNXSYSTM:00/LNXPWRBN:00/input/input3/phys | 1 - .../LNXPWRBN:00/input/input3/power/wakeup | 1 - .../LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem | 1 - .../LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent | 6 - .../LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq | 1 - test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias | 1 - .../devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup | 1 - test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem | 1 - test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent | 2 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path | 1 - .../LNXTHERM:00/LNXTHERM:01/power/wakeup | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem | 1 - .../LNXTHERM:00/LNXTHERM:01/thermal_zone | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent | 2 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path | 1 - .../LNXTHERM:00/LNXTHERM:02/power/wakeup | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem | 1 - .../LNXTHERM:00/LNXTHERM:02/thermal_zone | 1 - .../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent | 2 - test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid | 1 - test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias | 1 - test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path | 1 - .../devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup | 1 - test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem | 1 - test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent | 1 - .../devices/LNXSYSTM:00/device:00/IBM0079:00/hid | 1 - .../LNXSYSTM:00/device:00/IBM0079:00/modalias | 1 - .../devices/LNXSYSTM:00/device:00/IBM0079:00/path | 1 - .../LNXSYSTM:00/device:00/IBM0079:00/power/wakeup | 1 - .../LNXSYSTM:00/device:00/IBM0079:00/subsystem | 1 - .../LNXSYSTM:00/device:00/IBM0079:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/ATM1200:00/hid | 1 - .../PNP0A08:00/device:01/ATM1200:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/ATM1200:00/path | 1 - .../PNP0A08:00/device:01/ATM1200:00/physical_node | 1 - .../PNP0A08:00/device:01/ATM1200:00/power/wakeup | 1 - .../PNP0A08:00/device:01/ATM1200:00/subsystem | 1 - .../PNP0A08:00/device:01/ATM1200:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/IBM0057:00/hid | 1 - .../PNP0A08:00/device:01/IBM0057:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/IBM0057:00/path | 1 - .../PNP0A08:00/device:01/IBM0057:00/physical_node | 1 - .../PNP0A08:00/device:01/IBM0057:00/power/wakeup | 1 - .../PNP0A08:00/device:01/IBM0057:00/subsystem | 1 - .../PNP0A08:00/device:01/IBM0057:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/PNP0000:00/hid | 1 - .../PNP0A08:00/device:01/PNP0000:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0000:00/path | 1 - .../PNP0A08:00/device:01/PNP0000:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0000:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0000:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/PNP0100:00/hid | 1 - .../PNP0A08:00/device:01/PNP0100:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0100:00/path | 1 - .../PNP0A08:00/device:01/PNP0100:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0100:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0100:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/PNP0103:00/hid | 1 - .../PNP0A08:00/device:01/PNP0103:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0103:00/path | 1 - .../PNP0A08:00/device:01/PNP0103:00/physical_node | 1 - .../PNP0A08:00/device:01/PNP0103:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0103:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0103:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/PNP0200:00/hid | 1 - .../PNP0A08:00/device:01/PNP0200:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0200:00/path | 1 - .../PNP0A08:00/device:01/PNP0200:00/physical_node | 1 - .../PNP0A08:00/device:01/PNP0200:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0200:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0200:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/PNP0303:00/hid | 1 - .../PNP0A08:00/device:01/PNP0303:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0303:00/path | 1 - .../PNP0A08:00/device:01/PNP0303:00/physical_node | 1 - .../PNP0A08:00/device:01/PNP0303:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0303:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0303:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/PNP0800:00/hid | 1 - .../PNP0A08:00/device:01/PNP0800:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0800:00/path | 1 - .../PNP0A08:00/device:01/PNP0800:00/physical_node | 1 - .../PNP0A08:00/device:01/PNP0800:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0800:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0800:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/PNP0B00:00/hid | 1 - .../PNP0A08:00/device:01/PNP0B00:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0B00:00/path | 1 - .../PNP0A08:00/device:01/PNP0B00:00/physical_node | 1 - .../PNP0A08:00/device:01/PNP0B00:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0B00:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0B00:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/PNP0C02:00/hid | 1 - .../PNP0A08:00/device:01/PNP0C02:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0C02:00/path | 1 - .../PNP0A08:00/device:01/PNP0C02:00/physical_node | 1 - .../PNP0A08:00/device:01/PNP0C02:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0C02:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0C02:00/uevent | 1 - .../device:00/PNP0A08:00/device:01/PNP0C04:00/hid | 1 - .../PNP0A08:00/device:01/PNP0C04:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0C04:00/path | 1 - .../PNP0A08:00/device:01/PNP0C04:00/physical_node | 1 - .../PNP0A08:00/device:01/PNP0C04:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0C04:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0C04:00/uevent | 1 - .../device:01/PNP0C09:00/ACPI0003:00/driver | 1 - .../device:01/PNP0C09:00/ACPI0003:00/hid | 1 - .../device:01/PNP0C09:00/ACPI0003:00/modalias | 1 - .../device:01/PNP0C09:00/ACPI0003:00/path | 1 - .../device:01/PNP0C09:00/ACPI0003:00/power/wakeup | 1 - .../PNP0C09:00/ACPI0003:00/power_supply/AC/device | 1 - .../PNP0C09:00/ACPI0003:00/power_supply/AC/online | 1 - .../ACPI0003:00/power_supply/AC/power/wakeup | 1 - .../ACPI0003:00/power_supply/AC/subsystem | 1 - .../PNP0C09:00/ACPI0003:00/power_supply/AC/type | 1 - .../PNP0C09:00/ACPI0003:00/power_supply/AC/uevent | 3 - .../device:01/PNP0C09:00/ACPI0003:00/subsystem | 1 - .../device:01/PNP0C09:00/ACPI0003:00/uevent | 2 - .../device:01/PNP0C09:00/IBM0068:00/driver | 1 - .../PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid | 1 - .../device:01/PNP0C09:00/IBM0068:00/modalias | 1 - .../device:01/PNP0C09:00/IBM0068:00/path | 1 - .../device:01/PNP0C09:00/IBM0068:00/power/wakeup | 1 - .../device:01/PNP0C09:00/IBM0068:00/subsystem | 1 - .../device:01/PNP0C09:00/IBM0068:00/uevent | 2 - .../device:01/PNP0C09:00/LNXPOWER:00/driver | 1 - .../device:01/PNP0C09:00/LNXPOWER:00/hid | 1 - .../device:01/PNP0C09:00/LNXPOWER:00/modalias | 1 - .../device:01/PNP0C09:00/LNXPOWER:00/path | 1 - .../device:01/PNP0C09:00/LNXPOWER:00/power/wakeup | 1 - .../device:01/PNP0C09:00/LNXPOWER:00/subsystem | 1 - .../device:01/PNP0C09:00/LNXPOWER:00/uevent | 2 - .../device:01/PNP0C09:00/PNP0C0A:00/driver | 1 - .../PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid | 1 - .../device:01/PNP0C09:00/PNP0C0A:00/modalias | 1 - .../device:01/PNP0C09:00/PNP0C0A:00/path | 1 - .../device:01/PNP0C09:00/PNP0C0A:00/power/wakeup | 1 - .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm | 1 - .../PNP0C0A:00/power_supply/BAT0/current_now | 1 - .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device | 1 - .../PNP0C0A:00/power_supply/BAT0/energy_full | 1 - .../power_supply/BAT0/energy_full_design | 1 - .../PNP0C0A:00/power_supply/BAT0/energy_now | 1 - .../PNP0C0A:00/power_supply/BAT0/manufacturer | 1 - .../PNP0C0A:00/power_supply/BAT0/model_name | 1 - .../PNP0C0A:00/power_supply/BAT0/power/wakeup | 1 - .../PNP0C0A:00/power_supply/BAT0/present | 1 - .../PNP0C0A:00/power_supply/BAT0/serial_number | 1 - .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status | 1 - .../PNP0C0A:00/power_supply/BAT0/subsystem | 1 - .../PNP0C0A:00/power_supply/BAT0/technology | 1 - .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type | 1 - .../PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent | 14 - .../power_supply/BAT0/voltage_min_design | 1 - .../PNP0C0A:00/power_supply/BAT0/voltage_now | 1 - .../device:01/PNP0C09:00/PNP0C0A:00/subsystem | 1 - .../device:01/PNP0C09:00/PNP0C0A:00/uevent | 2 - .../PNP0A08:00/device:01/PNP0C09:00/driver | 1 - .../device:00/PNP0A08:00/device:01/PNP0C09:00/hid | 1 - .../PNP0A08:00/device:01/PNP0C09:00/modalias | 1 - .../device:00/PNP0A08:00/device:01/PNP0C09:00/path | 1 - .../PNP0A08:00/device:01/PNP0C09:00/power/wakeup | 1 - .../PNP0A08:00/device:01/PNP0C09:00/subsystem | 1 - .../PNP0A08:00/device:01/PNP0C09:00/uevent | 2 - .../device:00/PNP0A08:00/device:01/path | 1 - .../device:00/PNP0A08:00/device:01/physical_node | 1 - .../device:00/PNP0A08:00/device:01/power/wakeup | 1 - .../device:00/PNP0A08:00/device:01/subsystem | 1 - .../device:00/PNP0A08:00/device:01/uevent | 0 .../device:00/PNP0A08:00/device:02/device:03/path | 1 - .../PNP0A08:00/device:02/device:03/power/wakeup | 1 - .../PNP0A08:00/device:02/device:03/subsystem | 1 - .../PNP0A08:00/device:02/device:03/uevent | 0 .../device:00/PNP0A08:00/device:02/device:04/path | 1 - .../PNP0A08:00/device:02/device:04/power/wakeup | 1 - .../PNP0A08:00/device:02/device:04/subsystem | 1 - .../PNP0A08:00/device:02/device:04/uevent | 0 .../device:00/PNP0A08:00/device:02/device:05/path | 1 - .../PNP0A08:00/device:02/device:05/power/wakeup | 1 - .../PNP0A08:00/device:02/device:05/subsystem | 1 - .../PNP0A08:00/device:02/device:05/uevent | 0 .../device:00/PNP0A08:00/device:02/modalias | 1 - .../device:00/PNP0A08:00/device:02/path | 1 - .../device:00/PNP0A08:00/device:02/power/wakeup | 1 - .../device:00/PNP0A08:00/device:02/subsystem | 1 - .../device:00/PNP0A08:00/device:02/uevent | 1 - .../PNP0A08:00/device:06/device:07/device:08/path | 1 - .../device:06/device:07/device:08/power/wakeup | 1 - .../device:06/device:07/device:08/subsystem | 1 - .../device:06/device:07/device:08/uevent | 0 .../PNP0A08:00/device:06/device:07/device:09/path | 1 - .../device:06/device:07/device:09/power/wakeup | 1 - .../device:06/device:07/device:09/subsystem | 1 - .../device:06/device:07/device:09/uevent | 0 .../PNP0A08:00/device:06/device:07/device:0a/path | 1 - .../device:06/device:07/device:0a/power/wakeup | 1 - .../device:06/device:07/device:0a/subsystem | 1 - .../device:06/device:07/device:0a/uevent | 0 .../PNP0A08:00/device:06/device:07/modalias | 1 - .../device:00/PNP0A08:00/device:06/device:07/path | 1 - .../PNP0A08:00/device:06/device:07/physical_node | 1 - .../PNP0A08:00/device:06/device:07/power/wakeup | 1 - .../PNP0A08:00/device:06/device:07/subsystem | 1 - .../PNP0A08:00/device:06/device:07/uevent | 1 - .../device:00/PNP0A08:00/device:06/path | 1 - .../device:00/PNP0A08:00/device:06/physical_node | 1 - .../device:00/PNP0A08:00/device:06/power/wakeup | 1 - .../device:00/PNP0A08:00/device:06/subsystem | 1 - .../device:00/PNP0A08:00/device:06/uevent | 0 .../device:00/PNP0A08:00/device:0b/path | 1 - .../device:00/PNP0A08:00/device:0b/physical_node | 1 - .../device:00/PNP0A08:00/device:0b/power/wakeup | 1 - .../device:00/PNP0A08:00/device:0b/subsystem | 1 - .../device:00/PNP0A08:00/device:0b/uevent | 0 .../device:00/PNP0A08:00/device:0c/path | 1 - .../device:00/PNP0A08:00/device:0c/physical_node | 1 - .../device:00/PNP0A08:00/device:0c/power/wakeup | 1 - .../device:00/PNP0A08:00/device:0c/subsystem | 1 - .../device:00/PNP0A08:00/device:0c/uevent | 0 .../device:00/PNP0A08:00/device:0d/device:0e/path | 1 - .../PNP0A08:00/device:0d/device:0e/power/wakeup | 1 - .../PNP0A08:00/device:0d/device:0e/subsystem | 1 - .../PNP0A08:00/device:0d/device:0e/uevent | 0 .../device:00/PNP0A08:00/device:0d/path | 1 - .../device:00/PNP0A08:00/device:0d/physical_node | 1 - .../device:00/PNP0A08:00/device:0d/power/wakeup | 1 - .../device:00/PNP0A08:00/device:0d/subsystem | 1 - .../device:00/PNP0A08:00/device:0d/uevent | 0 .../device:00/PNP0A08:00/device:0f/device:10/path | 1 - .../PNP0A08:00/device:0f/device:10/power/wakeup | 1 - .../PNP0A08:00/device:0f/device:10/subsystem | 1 - .../PNP0A08:00/device:0f/device:10/uevent | 0 .../device:00/PNP0A08:00/device:0f/path | 1 - .../device:00/PNP0A08:00/device:0f/physical_node | 1 - .../device:00/PNP0A08:00/device:0f/power/wakeup | 1 - .../device:00/PNP0A08:00/device:0f/subsystem | 1 - .../device:00/PNP0A08:00/device:0f/uevent | 0 .../device:00/PNP0A08:00/device:11/device:12/path | 1 - .../PNP0A08:00/device:11/device:12/physical_node | 1 - .../PNP0A08:00/device:11/device:12/power/wakeup | 1 - .../PNP0A08:00/device:11/device:12/subsystem | 1 - .../PNP0A08:00/device:11/device:12/uevent | 0 .../device:00/PNP0A08:00/device:11/path | 1 - .../device:00/PNP0A08:00/device:11/physical_node | 1 - .../device:00/PNP0A08:00/device:11/power/wakeup | 1 - .../device:00/PNP0A08:00/device:11/subsystem | 1 - .../device:00/PNP0A08:00/device:11/uevent | 0 .../device:13/device:14/device:15/modalias | 1 - .../PNP0A08:00/device:13/device:14/device:15/path | 1 - .../device:13/device:14/device:15/power/wakeup | 1 - .../device:13/device:14/device:15/subsystem | 1 - .../device:13/device:14/device:15/uevent | 1 - .../device:00/PNP0A08:00/device:13/device:14/path | 1 - .../PNP0A08:00/device:13/device:14/power/wakeup | 1 - .../PNP0A08:00/device:13/device:14/subsystem | 1 - .../PNP0A08:00/device:13/device:14/uevent | 0 .../device:00/PNP0A08:00/device:13/path | 1 - .../device:00/PNP0A08:00/device:13/physical_node | 1 - .../device:00/PNP0A08:00/device:13/power/wakeup | 1 - .../device:00/PNP0A08:00/device:13/subsystem | 1 - .../device:00/PNP0A08:00/device:13/uevent | 0 .../device:00/PNP0A08:00/device:16/device:17/path | 1 - .../PNP0A08:00/device:16/device:17/power/wakeup | 1 - .../PNP0A08:00/device:16/device:17/subsystem | 1 - .../PNP0A08:00/device:16/device:17/uevent | 0 .../device:00/PNP0A08:00/device:16/path | 1 - .../device:00/PNP0A08:00/device:16/physical_node | 1 - .../device:00/PNP0A08:00/device:16/power/wakeup | 1 - .../device:00/PNP0A08:00/device:16/subsystem | 1 - .../device:00/PNP0A08:00/device:16/uevent | 0 .../device:00/PNP0A08:00/device:18/path | 1 - .../device:00/PNP0A08:00/device:18/physical_node | 1 - .../device:00/PNP0A08:00/device:18/power/wakeup | 1 - .../device:00/PNP0A08:00/device:18/subsystem | 1 - .../device:00/PNP0A08:00/device:18/uevent | 0 .../device:00/PNP0A08:00/device:19/path | 1 - .../device:00/PNP0A08:00/device:19/physical_node | 1 - .../device:00/PNP0A08:00/device:19/power/wakeup | 1 - .../device:00/PNP0A08:00/device:19/subsystem | 1 - .../device:00/PNP0A08:00/device:19/uevent | 0 .../PNP0A08:00/device:1a/device:1b/device:1c/path | 1 - .../device:1a/device:1b/device:1c/power/wakeup | 1 - .../device:1a/device:1b/device:1c/subsystem | 1 - .../device:1a/device:1b/device:1c/uevent | 0 .../device:00/PNP0A08:00/device:1a/device:1b/path | 1 - .../PNP0A08:00/device:1a/device:1b/power/wakeup | 1 - .../PNP0A08:00/device:1a/device:1b/subsystem | 1 - .../PNP0A08:00/device:1a/device:1b/uevent | 0 .../device:00/PNP0A08:00/device:1a/path | 1 - .../device:00/PNP0A08:00/device:1a/physical_node | 1 - .../device:00/PNP0A08:00/device:1a/power/wakeup | 1 - .../device:00/PNP0A08:00/device:1a/subsystem | 1 - .../device:00/PNP0A08:00/device:1a/uevent | 0 .../PNP0A08:00/device:1d/device:1e/device:1f/path | 1 - .../device:1d/device:1e/device:1f/power/wakeup | 1 - .../device:1d/device:1e/device:1f/subsystem | 1 - .../device:1d/device:1e/device:1f/uevent | 0 .../device:00/PNP0A08:00/device:1d/device:1e/path | 1 - .../PNP0A08:00/device:1d/device:1e/power/wakeup | 1 - .../PNP0A08:00/device:1d/device:1e/subsystem | 1 - .../PNP0A08:00/device:1d/device:1e/uevent | 0 .../device:00/PNP0A08:00/device:1d/path | 1 - .../device:00/PNP0A08:00/device:1d/physical_node | 1 - .../device:00/PNP0A08:00/device:1d/power/wakeup | 1 - .../device:00/PNP0A08:00/device:1d/subsystem | 1 - .../device:00/PNP0A08:00/device:1d/uevent | 0 .../device:00/PNP0A08:00/device:20/path | 1 - .../device:00/PNP0A08:00/device:20/physical_node | 1 - .../device:00/PNP0A08:00/device:20/power/wakeup | 1 - .../device:00/PNP0A08:00/device:20/subsystem | 1 - .../device:00/PNP0A08:00/device:20/uevent | 0 .../PNP0A08:00/device:21/device:22/device:23/path | 1 - .../device:21/device:22/device:23/power/wakeup | 1 - .../device:21/device:22/device:23/subsystem | 1 - .../device:21/device:22/device:23/uevent | 0 .../PNP0A08:00/device:21/device:22/device:24/path | 1 - .../device:21/device:22/device:24/power/wakeup | 1 - .../device:21/device:22/device:24/subsystem | 1 - .../device:21/device:22/device:24/uevent | 0 .../device:00/PNP0A08:00/device:21/device:22/path | 1 - .../PNP0A08:00/device:21/device:22/power/wakeup | 1 - .../PNP0A08:00/device:21/device:22/subsystem | 1 - .../PNP0A08:00/device:21/device:22/uevent | 0 .../device:00/PNP0A08:00/device:21/path | 1 - .../device:00/PNP0A08:00/device:21/physical_node | 1 - .../device:00/PNP0A08:00/device:21/power/wakeup | 1 - .../device:00/PNP0A08:00/device:21/subsystem | 1 - .../device:00/PNP0A08:00/device:21/uevent | 0 .../device:00/PNP0A08:00/device:25/path | 1 - .../device:00/PNP0A08:00/device:25/physical_node | 1 - .../device:00/PNP0A08:00/device:25/power/wakeup | 1 - .../device:00/PNP0A08:00/device:25/subsystem | 1 - .../device:00/PNP0A08:00/device:25/uevent | 0 .../LNXSYSTM:00/device:00/PNP0A08:00/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0A08:00/hid | 1 - .../LNXSYSTM:00/device:00/PNP0A08:00/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0A08:00/path | 1 - .../LNXSYSTM:00/device:00/PNP0A08:00/physical_node | 1 - .../LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0A08:00/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0A08:00/uevent | 2 - .../devices/LNXSYSTM:00/device:00/PNP0C01:00/hid | 1 - .../LNXSYSTM:00/device:00/PNP0C01:00/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C01:00/path | 1 - .../LNXSYSTM:00/device:00/PNP0C01:00/physical_node | 1 - .../LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C01:00/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C01:00/uevent | 1 - .../LNXSYSTM:00/device:00/PNP0C0D:00/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid | 1 - .../PNP0C0D:00/input/input4/capabilities/abs | 1 - .../PNP0C0D:00/input/input4/capabilities/ev | 1 - .../PNP0C0D:00/input/input4/capabilities/ff | 1 - .../PNP0C0D:00/input/input4/capabilities/key | 1 - .../PNP0C0D:00/input/input4/capabilities/led | 1 - .../PNP0C0D:00/input/input4/capabilities/msc | 1 - .../PNP0C0D:00/input/input4/capabilities/rel | 1 - .../PNP0C0D:00/input/input4/capabilities/snd | 1 - .../PNP0C0D:00/input/input4/capabilities/sw | 1 - .../device:00/PNP0C0D:00/input/input4/device | 1 - .../device:00/PNP0C0D:00/input/input4/event4/dev | 1 - .../PNP0C0D:00/input/input4/event4/device | 1 - .../PNP0C0D:00/input/input4/event4/power/wakeup | 1 - .../PNP0C0D:00/input/input4/event4/subsystem | 1 - .../PNP0C0D:00/input/input4/event4/uevent | 2 - .../device:00/PNP0C0D:00/input/input4/id/bustype | 1 - .../device:00/PNP0C0D:00/input/input4/id/product | 1 - .../device:00/PNP0C0D:00/input/input4/id/vendor | 1 - .../device:00/PNP0C0D:00/input/input4/id/version | 1 - .../device:00/PNP0C0D:00/input/input4/modalias | 1 - .../device:00/PNP0C0D:00/input/input4/name | 1 - .../device:00/PNP0C0D:00/input/input4/phys | 1 - .../device:00/PNP0C0D:00/input/input4/power/wakeup | 1 - .../device:00/PNP0C0D:00/input/input4/subsystem | 1 - .../device:00/PNP0C0D:00/input/input4/uevent | 6 - .../device:00/PNP0C0D:00/input/input4/uniq | 1 - .../LNXSYSTM:00/device:00/PNP0C0D:00/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0D:00/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0D:00/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0D:00/uevent | 2 - .../LNXSYSTM:00/device:00/PNP0C0E:00/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid | 1 - .../PNP0C0E:00/input/input5/capabilities/abs | 1 - .../PNP0C0E:00/input/input5/capabilities/ev | 1 - .../PNP0C0E:00/input/input5/capabilities/ff | 1 - .../PNP0C0E:00/input/input5/capabilities/key | 1 - .../PNP0C0E:00/input/input5/capabilities/led | 1 - .../PNP0C0E:00/input/input5/capabilities/msc | 1 - .../PNP0C0E:00/input/input5/capabilities/rel | 1 - .../PNP0C0E:00/input/input5/capabilities/snd | 1 - .../PNP0C0E:00/input/input5/capabilities/sw | 1 - .../device:00/PNP0C0E:00/input/input5/device | 1 - .../device:00/PNP0C0E:00/input/input5/event5/dev | 1 - .../PNP0C0E:00/input/input5/event5/device | 1 - .../PNP0C0E:00/input/input5/event5/power/wakeup | 1 - .../PNP0C0E:00/input/input5/event5/subsystem | 1 - .../PNP0C0E:00/input/input5/event5/uevent | 2 - .../device:00/PNP0C0E:00/input/input5/id/bustype | 1 - .../device:00/PNP0C0E:00/input/input5/id/product | 1 - .../device:00/PNP0C0E:00/input/input5/id/vendor | 1 - .../device:00/PNP0C0E:00/input/input5/id/version | 1 - .../device:00/PNP0C0E:00/input/input5/modalias | 1 - .../device:00/PNP0C0E:00/input/input5/name | 1 - .../device:00/PNP0C0E:00/input/input5/phys | 1 - .../device:00/PNP0C0E:00/input/input5/power/wakeup | 1 - .../device:00/PNP0C0E:00/input/input5/subsystem | 1 - .../device:00/PNP0C0E:00/input/input5/uevent | 6 - .../device:00/PNP0C0E:00/input/input5/uniq | 1 - .../LNXSYSTM:00/device:00/PNP0C0E:00/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0E:00/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0E:00/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0E:00/uevent | 2 - .../LNXSYSTM:00/device:00/PNP0C0F:00/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:00/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:00/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:00/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:00/uevent | 2 - .../LNXSYSTM:00/device:00/PNP0C0F:01/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:01/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:01/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:01/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:01/uevent | 2 - .../LNXSYSTM:00/device:00/PNP0C0F:02/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:02/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:02/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:02/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:02/uevent | 2 - .../LNXSYSTM:00/device:00/PNP0C0F:03/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:03/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:03/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:03/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:03/uevent | 2 - .../LNXSYSTM:00/device:00/PNP0C0F:04/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:04/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:04/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:04/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:04/uevent | 2 - .../LNXSYSTM:00/device:00/PNP0C0F:05/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:05/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:05/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:05/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:05/uevent | 2 - .../LNXSYSTM:00/device:00/PNP0C0F:06/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:06/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:06/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:06/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:06/uevent | 2 - .../LNXSYSTM:00/device:00/PNP0C0F:07/driver | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:07/modalias | 1 - .../devices/LNXSYSTM:00/device:00/PNP0C0F:07/path | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:07/subsystem | 1 - .../LNXSYSTM:00/device:00/PNP0C0F:07/uevent | 2 - test/sys/devices/LNXSYSTM:00/device:00/path | 1 - .../sys/devices/LNXSYSTM:00/device:00/power/wakeup | 1 - test/sys/devices/LNXSYSTM:00/device:00/subsystem | 1 - test/sys/devices/LNXSYSTM:00/device:00/uevent | 0 test/sys/devices/LNXSYSTM:00/hid | 1 - test/sys/devices/LNXSYSTM:00/modalias | 1 - test/sys/devices/LNXSYSTM:00/path | 1 - test/sys/devices/LNXSYSTM:00/power/wakeup | 1 - test/sys/devices/LNXSYSTM:00/subsystem | 1 - test/sys/devices/LNXSYSTM:00/uevent | 1 - .../pci0000:00/0000:00:00.0/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:00.0/class | 1 - test/sys/devices/pci0000:00/0000:00:00.0/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:00.0/device | 1 - test/sys/devices/pci0000:00/0000:00:00.0/enable | 1 - test/sys/devices/pci0000:00/0000:00:00.0/irq | 1 - .../devices/pci0000:00/0000:00:00.0/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:00.0/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:00.0/modalias | 1 - test/sys/devices/pci0000:00/0000:00:00.0/msi_bus | 0 .../devices/pci0000:00/0000:00:00.0/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:00.0/resource | 7 - test/sys/devices/pci0000:00/0000:00:00.0/subsystem | 1 - .../pci0000:00/0000:00:00.0/subsystem_device | 1 - .../pci0000:00/0000:00:00.0/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:00.0/uevent | 5 - test/sys/devices/pci0000:00/0000:00:00.0/vendor | 1 - .../0000:00:01.0/0000:00:01.0:pcie00/power/wakeup | 1 - .../0000:00:01.0/0000:00:01.0:pcie00/subsystem | 1 - .../0000:00:01.0/0000:00:01.0:pcie00/uevent | 0 .../0000:00:01.0/0000:00:01.0:pcie03/power/wakeup | 1 - .../0000:00:01.0/0000:00:01.0:pcie03/subsystem | 1 - .../0000:00:01.0/0000:00:01.0:pcie03/uevent | 0 .../0000:00:01.0/0000:01:00.0/broken_parity_status | 1 - .../pci0000:00/0000:00:01.0/0000:01:00.0/class | 1 - .../pci0000:00/0000:00:01.0/0000:01:00.0/config | Bin 4096 -> 0 bytes .../pci0000:00/0000:00:01.0/0000:01:00.0/device | 1 - .../pci0000:00/0000:00:01.0/0000:01:00.0/enable | 1 - .../0000:00:01.0/0000:01:00.0/firmware_node | 1 - .../pci0000:00/0000:00:01.0/0000:01:00.0/irq | 1 - .../0000:00:01.0/0000:01:00.0/local_cpulist | 1 - .../0000:00:01.0/0000:01:00.0/local_cpus | 1 - .../pci0000:00/0000:00:01.0/0000:01:00.0/modalias | 1 - .../pci0000:00/0000:00:01.0/0000:01:00.0/msi_bus | 0 .../0000:00:01.0/0000:01:00.0/power/wakeup | 1 - .../pci0000:00/0000:00:01.0/0000:01:00.0/resource | 7 - .../pci0000:00/0000:00:01.0/0000:01:00.0/resource0 | 0 .../0000:00:01.0/0000:01:00.0/resource0_wc | 0 .../pci0000:00/0000:00:01.0/0000:01:00.0/resource1 | 0 .../pci0000:00/0000:00:01.0/0000:01:00.0/resource2 | 0 .../pci0000:00/0000:00:01.0/0000:01:00.0/rom | 0 .../pci0000:00/0000:00:01.0/0000:01:00.0/subsystem | 1 - .../0000:00:01.0/0000:01:00.0/subsystem_device | 1 - .../0000:00:01.0/0000:01:00.0/subsystem_vendor | 1 - .../pci0000:00/0000:00:01.0/0000:01:00.0/uevent | 5 - .../pci0000:00/0000:00:01.0/0000:01:00.0/vendor | 1 - .../pci0000:00/0000:00:01.0/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:01.0/class | 1 - test/sys/devices/pci0000:00/0000:00:01.0/config | Bin 4096 -> 0 bytes test/sys/devices/pci0000:00/0000:00:01.0/device | 1 - test/sys/devices/pci0000:00/0000:00:01.0/driver | 1 - test/sys/devices/pci0000:00/0000:00:01.0/enable | 1 - .../devices/pci0000:00/0000:00:01.0/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:01.0/irq | 1 - .../devices/pci0000:00/0000:00:01.0/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:01.0/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:01.0/modalias | 1 - test/sys/devices/pci0000:00/0000:00:01.0/msi_bus | 1 - .../0000:00:01.0/pci_bus/0000:01/cpuaffinity | 1 - .../pci0000:00/0000:00:01.0/pci_bus/0000:01/device | 1 - .../0000:00:01.0/pci_bus/0000:01/power/wakeup | 1 - .../0000:00:01.0/pci_bus/0000:01/subsystem | 1 - .../pci0000:00/0000:00:01.0/pci_bus/0000:01/uevent | 0 .../devices/pci0000:00/0000:00:01.0/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:01.0/resource | 12 - test/sys/devices/pci0000:00/0000:00:01.0/subsystem | 1 - .../pci0000:00/0000:00:01.0/subsystem_device | 1 - .../pci0000:00/0000:00:01.0/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:01.0/uevent | 6 - test/sys/devices/pci0000:00/0000:00:01.0/vendor | 1 - .../pci0000:00/0000:00:1b.0/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1b.0/class | 1 - test/sys/devices/pci0000:00/0000:00:1b.0/config | Bin 4096 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1b.0/device | 1 - test/sys/devices/pci0000:00/0000:00:1b.0/driver | 1 - test/sys/devices/pci0000:00/0000:00:1b.0/enable | 1 - .../devices/pci0000:00/0000:00:1b.0/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1b.0/irq | 1 - .../devices/pci0000:00/0000:00:1b.0/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1b.0/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1b.0/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1b.0/msi_bus | 0 .../devices/pci0000:00/0000:00:1b.0/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1b.0/resource | 7 - test/sys/devices/pci0000:00/0000:00:1b.0/resource0 | 0 .../pci0000:00/0000:00:1b.0/sound/card0/adsp/dev | 1 - .../0000:00:1b.0/sound/card0/adsp/device | 1 - .../0000:00:1b.0/sound/card0/adsp/power/wakeup | 1 - .../0000:00:1b.0/sound/card0/adsp/subsystem | 1 - .../0000:00:1b.0/sound/card0/adsp/uevent | 2 - .../pci0000:00/0000:00:1b.0/sound/card0/audio/dev | 1 - .../0000:00:1b.0/sound/card0/audio/device | 1 - .../0000:00:1b.0/sound/card0/audio/power/wakeup | 1 - .../0000:00:1b.0/sound/card0/audio/subsystem | 1 - .../0000:00:1b.0/sound/card0/audio/uevent | 2 - .../0000:00:1b.0/sound/card0/controlC0/dev | 1 - .../0000:00:1b.0/sound/card0/controlC0/device | 1 - .../sound/card0/controlC0/power/wakeup | 1 - .../0000:00:1b.0/sound/card0/controlC0/subsystem | 1 - .../0000:00:1b.0/sound/card0/controlC0/uevent | 2 - .../pci0000:00/0000:00:1b.0/sound/card0/device | 1 - .../pci0000:00/0000:00:1b.0/sound/card0/dsp/dev | 1 - .../pci0000:00/0000:00:1b.0/sound/card0/dsp/device | 1 - .../0000:00:1b.0/sound/card0/dsp/power/wakeup | 1 - .../0000:00:1b.0/sound/card0/dsp/subsystem | 1 - .../pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent | 2 - .../pci0000:00/0000:00:1b.0/sound/card0/mixer/dev | 1 - .../0000:00:1b.0/sound/card0/mixer/device | 1 - .../0000:00:1b.0/sound/card0/mixer/power/wakeup | 1 - .../0000:00:1b.0/sound/card0/mixer/subsystem | 1 - .../0000:00:1b.0/sound/card0/mixer/uevent | 2 - .../0000:00:1b.0/sound/card0/pcmC0D0c/dev | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0c/device | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0c/subsystem | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0c/uevent | 2 - .../0000:00:1b.0/sound/card0/pcmC0D0p/dev | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0p/device | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0p/subsystem | 1 - .../0000:00:1b.0/sound/card0/pcmC0D0p/uevent | 2 - .../0000:00:1b.0/sound/card0/pcmC0D1p/dev | 1 - .../0000:00:1b.0/sound/card0/pcmC0D1p/device | 1 - .../0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class | 1 - .../0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup | 1 - .../0000:00:1b.0/sound/card0/pcmC0D1p/subsystem | 1 - .../0000:00:1b.0/sound/card0/pcmC0D1p/uevent | 2 - .../0000:00:1b.0/sound/card0/power/wakeup | 1 - .../pci0000:00/0000:00:1b.0/sound/card0/subsystem | 1 - .../pci0000:00/0000:00:1b.0/sound/card0/uevent | 0 test/sys/devices/pci0000:00/0000:00:1b.0/subsystem | 1 - .../pci0000:00/0000:00:1b.0/subsystem_device | 1 - .../pci0000:00/0000:00:1b.0/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1b.0/uevent | 6 - test/sys/devices/pci0000:00/0000:00:1b.0/vendor | 1 - .../0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup | 1 - .../0000:00:1c.0/0000:00:1c.0:pcie00/subsystem | 1 - .../0000:00:1c.0/0000:00:1c.0:pcie00/uevent | 0 .../0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup | 1 - .../0000:00:1c.0/0000:00:1c.0:pcie02/subsystem | 1 - .../0000:00:1c.0/0000:00:1c.0:pcie02/uevent | 0 .../0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup | 1 - .../0000:00:1c.0/0000:00:1c.0:pcie03/subsystem | 1 - .../0000:00:1c.0/0000:00:1c.0:pcie03/uevent | 0 .../0000:00:1c.0/0000:02:00.0/broken_parity_status | 1 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/class | 1 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/config | Bin 4096 -> 0 bytes .../pci0000:00/0000:00:1c.0/0000:02:00.0/device | 1 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/driver | 1 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/enable | 1 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/irq | 1 - .../0000:00:1c.0/0000:02:00.0/local_cpulist | 1 - .../0000:00:1c.0/0000:02:00.0/local_cpus | 1 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/modalias | 1 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/msi_bus | 0 .../0000:00:1c.0/0000:02:00.0/net/eth0/addr_len | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/address | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/broadcast | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/carrier | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/dev_id | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/device | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/dormant | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/features | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/flags | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/ifindex | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/iflink | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/link_mode | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/mtu | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/operstate | 1 - .../0000:02:00.0/net/eth0/power/wakeup | 1 - .../0000:02:00.0/net/eth0/statistics/collisions | 1 - .../0000:02:00.0/net/eth0/statistics/multicast | 1 - .../0000:02:00.0/net/eth0/statistics/rx_bytes | 1 - .../0000:02:00.0/net/eth0/statistics/rx_compressed | 1 - .../0000:02:00.0/net/eth0/statistics/rx_crc_errors | 1 - .../0000:02:00.0/net/eth0/statistics/rx_dropped | 1 - .../0000:02:00.0/net/eth0/statistics/rx_errors | 1 - .../net/eth0/statistics/rx_fifo_errors | 1 - .../net/eth0/statistics/rx_frame_errors | 1 - .../net/eth0/statistics/rx_length_errors | 1 - .../net/eth0/statistics/rx_missed_errors | 1 - .../net/eth0/statistics/rx_over_errors | 1 - .../0000:02:00.0/net/eth0/statistics/rx_packets | 1 - .../net/eth0/statistics/tx_aborted_errors | 1 - .../0000:02:00.0/net/eth0/statistics/tx_bytes | 1 - .../net/eth0/statistics/tx_carrier_errors | 1 - .../0000:02:00.0/net/eth0/statistics/tx_compressed | 1 - .../0000:02:00.0/net/eth0/statistics/tx_dropped | 1 - .../0000:02:00.0/net/eth0/statistics/tx_errors | 1 - .../net/eth0/statistics/tx_fifo_errors | 1 - .../net/eth0/statistics/tx_heartbeat_errors | 1 - .../0000:02:00.0/net/eth0/statistics/tx_packets | 1 - .../net/eth0/statistics/tx_window_errors | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/subsystem | 1 - .../0000:02:00.0/net/eth0/tx_queue_len | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/type | 1 - .../0000:00:1c.0/0000:02:00.0/net/eth0/uevent | 2 - .../0000:00:1c.0/0000:02:00.0/power/wakeup | 1 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/resource | 7 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/resource0 | 0 .../pci0000:00/0000:00:1c.0/0000:02:00.0/resource2 | 0 .../pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem | 1 - .../0000:00:1c.0/0000:02:00.0/subsystem_device | 1 - .../0000:00:1c.0/0000:02:00.0/subsystem_vendor | 1 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/uevent | 6 - .../pci0000:00/0000:00:1c.0/0000:02:00.0/vendor | 1 - .../pci0000:00/0000:00:1c.0/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1c.0/class | 1 - test/sys/devices/pci0000:00/0000:00:1c.0/config | Bin 4096 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1c.0/device | 1 - test/sys/devices/pci0000:00/0000:00:1c.0/driver | 1 - test/sys/devices/pci0000:00/0000:00:1c.0/enable | 1 - .../devices/pci0000:00/0000:00:1c.0/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1c.0/irq | 1 - .../devices/pci0000:00/0000:00:1c.0/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1c.0/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1c.0/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus | 1 - .../0000:00:1c.0/pci_bus/0000:02/cpuaffinity | 1 - .../pci0000:00/0000:00:1c.0/pci_bus/0000:02/device | 1 - .../0000:00:1c.0/pci_bus/0000:02/power/wakeup | 1 - .../0000:00:1c.0/pci_bus/0000:02/subsystem | 1 - .../pci0000:00/0000:00:1c.0/pci_bus/0000:02/uevent | 0 .../devices/pci0000:00/0000:00:1c.0/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1c.0/resource | 12 - test/sys/devices/pci0000:00/0000:00:1c.0/subsystem | 1 - .../pci0000:00/0000:00:1c.0/subsystem_device | 1 - .../pci0000:00/0000:00:1c.0/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1c.0/uevent | 6 - test/sys/devices/pci0000:00/0000:00:1c.0/vendor | 1 - .../0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup | 1 - .../0000:00:1c.1/0000:00:1c.1:pcie00/subsystem | 1 - .../0000:00:1c.1/0000:00:1c.1:pcie00/uevent | 0 .../0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup | 1 - .../0000:00:1c.1/0000:00:1c.1:pcie02/subsystem | 1 - .../0000:00:1c.1/0000:00:1c.1:pcie02/uevent | 0 .../0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup | 1 - .../0000:00:1c.1/0000:00:1c.1:pcie03/subsystem | 1 - .../0000:00:1c.1/0000:00:1c.1:pcie03/uevent | 0 .../pci0000:00/0000:00:1c.1/0000:03:00.0/antenna | 1 - .../0000:00:1c.1/0000:03:00.0/broken_parity_status | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/channels | 0 .../pci0000:00/0000:00:1c.1/0000:03:00.0/class | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/config | Bin 4096 -> 0 bytes .../pci0000:00/0000:00:1c.1/0000:03:00.0/device | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/driver | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/enable | 1 - .../0000:00:1c.1/0000:03:00.0/filter_flags | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/flags | 1 - .../0000:03:00.0/ieee80211/phy0/device | 1 - .../0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index | 1 - .../0000:03:00.0/ieee80211/phy0/macaddress | 1 - .../0000:03:00.0/ieee80211/phy0/power/wakeup | 1 - .../0000:03:00.0/ieee80211/phy0/subsystem | 1 - .../0000:03:00.0/ieee80211/phy0/uevent | 0 .../pci0000:00/0000:00:1c.1/0000:03:00.0/irq | 1 - .../0000:03:00.0/leds/iwl-phy0:RX/brightness | Bin 3 -> 0 bytes .../0000:03:00.0/leds/iwl-phy0:RX/device | 1 - .../0000:03:00.0/leds/iwl-phy0:RX/power/wakeup | 1 - .../0000:03:00.0/leds/iwl-phy0:RX/subsystem | 1 - .../0000:03:00.0/leds/iwl-phy0:RX/trigger | 1 - .../0000:03:00.0/leds/iwl-phy0:RX/uevent | 0 .../0000:03:00.0/leds/iwl-phy0:TX/brightness | Bin 3 -> 0 bytes .../0000:03:00.0/leds/iwl-phy0:TX/device | 1 - .../0000:03:00.0/leds/iwl-phy0:TX/power/wakeup | 1 - .../0000:03:00.0/leds/iwl-phy0:TX/subsystem | 1 - .../0000:03:00.0/leds/iwl-phy0:TX/trigger | 1 - .../0000:03:00.0/leds/iwl-phy0:TX/uevent | 0 .../0000:03:00.0/leds/iwl-phy0:assoc/brightness | Bin 5 -> 0 bytes .../0000:03:00.0/leds/iwl-phy0:assoc/device | 1 - .../0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup | 1 - .../0000:03:00.0/leds/iwl-phy0:assoc/subsystem | 1 - .../0000:03:00.0/leds/iwl-phy0:assoc/trigger | 1 - .../0000:03:00.0/leds/iwl-phy0:assoc/uevent | 0 .../0000:03:00.0/leds/iwl-phy0:radio/brightness | Bin 5 -> 0 bytes .../0000:03:00.0/leds/iwl-phy0:radio/device | 1 - .../0000:03:00.0/leds/iwl-phy0:radio/power/wakeup | 1 - .../0000:03:00.0/leds/iwl-phy0:radio/subsystem | 1 - .../0000:03:00.0/leds/iwl-phy0:radio/trigger | 1 - .../0000:03:00.0/leds/iwl-phy0:radio/uevent | 0 .../0000:00:1c.1/0000:03:00.0/local_cpulist | 1 - .../0000:00:1c.1/0000:03:00.0/local_cpus | 1 - .../0000:00:1c.1/0000:03:00.0/measurement | 0 .../pci0000:00/0000:00:1c.1/0000:03:00.0/modalias | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/msi_bus | 0 .../0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/address | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/carrier | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/device | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/dormant | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/features | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/flags | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/iflink | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/mtu | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/operstate | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 | 1 - .../0000:03:00.0/net/wlan0/power/wakeup | 1 - .../0000:03:00.0/net/wlan0/statistics/collisions | 1 - .../0000:03:00.0/net/wlan0/statistics/multicast | 1 - .../0000:03:00.0/net/wlan0/statistics/rx_bytes | 1 - .../net/wlan0/statistics/rx_compressed | 1 - .../net/wlan0/statistics/rx_crc_errors | 1 - .../0000:03:00.0/net/wlan0/statistics/rx_dropped | 1 - .../0000:03:00.0/net/wlan0/statistics/rx_errors | 1 - .../net/wlan0/statistics/rx_fifo_errors | 1 - .../net/wlan0/statistics/rx_frame_errors | 1 - .../net/wlan0/statistics/rx_length_errors | 1 - .../net/wlan0/statistics/rx_missed_errors | 1 - .../net/wlan0/statistics/rx_over_errors | 1 - .../0000:03:00.0/net/wlan0/statistics/rx_packets | 1 - .../net/wlan0/statistics/tx_aborted_errors | 1 - .../0000:03:00.0/net/wlan0/statistics/tx_bytes | 1 - .../net/wlan0/statistics/tx_carrier_errors | 1 - .../net/wlan0/statistics/tx_compressed | 1 - .../0000:03:00.0/net/wlan0/statistics/tx_dropped | 1 - .../0000:03:00.0/net/wlan0/statistics/tx_errors | 1 - .../net/wlan0/statistics/tx_fifo_errors | 1 - .../net/wlan0/statistics/tx_heartbeat_errors | 1 - .../0000:03:00.0/net/wlan0/statistics/tx_packets | 1 - .../net/wlan0/statistics/tx_window_errors | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem | 1 - .../0000:03:00.0/net/wlan0/tx_queue_len | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/type | 1 - .../0000:00:1c.1/0000:03:00.0/net/wlan0/uevent | 2 - .../0000:03:00.0/net/wlan0/wireless/beacon | 1 - .../0000:03:00.0/net/wlan0/wireless/crypt | 1 - .../0000:03:00.0/net/wlan0/wireless/fragment | 1 - .../0000:03:00.0/net/wlan0/wireless/level | 1 - .../0000:03:00.0/net/wlan0/wireless/link | 1 - .../0000:03:00.0/net/wlan0/wireless/misc | 1 - .../0000:03:00.0/net/wlan0/wireless/noise | 1 - .../0000:03:00.0/net/wlan0/wireless/nwid | 1 - .../0000:03:00.0/net/wlan0/wireless/retries | 1 - .../0000:03:00.0/net/wlan0/wireless/status | 1 - .../0000:03:00.0/net/wmaster0/addr_len | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/address | 1 - .../0000:03:00.0/net/wmaster0/broadcast | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/device | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant | 1 - .../0000:03:00.0/net/wmaster0/features | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/flags | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink | 1 - .../0000:03:00.0/net/wmaster0/link_mode | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu | 1 - .../0000:03:00.0/net/wmaster0/operstate | 1 - .../0000:03:00.0/net/wmaster0/phy80211 | 1 - .../0000:03:00.0/net/wmaster0/power/wakeup | 1 - .../net/wmaster0/statistics/collisions | 1 - .../0000:03:00.0/net/wmaster0/statistics/multicast | 1 - .../0000:03:00.0/net/wmaster0/statistics/rx_bytes | 1 - .../net/wmaster0/statistics/rx_compressed | 1 - .../net/wmaster0/statistics/rx_crc_errors | 1 - .../net/wmaster0/statistics/rx_dropped | 1 - .../0000:03:00.0/net/wmaster0/statistics/rx_errors | 1 - .../net/wmaster0/statistics/rx_fifo_errors | 1 - .../net/wmaster0/statistics/rx_frame_errors | 1 - .../net/wmaster0/statistics/rx_length_errors | 1 - .../net/wmaster0/statistics/rx_missed_errors | 1 - .../net/wmaster0/statistics/rx_over_errors | 1 - .../net/wmaster0/statistics/rx_packets | 1 - .../net/wmaster0/statistics/tx_aborted_errors | 1 - .../0000:03:00.0/net/wmaster0/statistics/tx_bytes | 1 - .../net/wmaster0/statistics/tx_carrier_errors | 1 - .../net/wmaster0/statistics/tx_compressed | 1 - .../net/wmaster0/statistics/tx_dropped | 1 - .../0000:03:00.0/net/wmaster0/statistics/tx_errors | 1 - .../net/wmaster0/statistics/tx_fifo_errors | 1 - .../net/wmaster0/statistics/tx_heartbeat_errors | 1 - .../net/wmaster0/statistics/tx_packets | 1 - .../net/wmaster0/statistics/tx_window_errors | 1 - .../0000:03:00.0/net/wmaster0/subsystem | 1 - .../0000:03:00.0/net/wmaster0/tx_queue_len | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/type | 1 - .../0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent | 2 - .../0000:00:1c.1/0000:03:00.0/power/wakeup | 1 - .../0000:00:1c.1/0000:03:00.0/power_level | Bin 12 -> 0 bytes .../pci0000:00/0000:00:1c.1/0000:03:00.0/resource | 7 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/resource0 | 0 .../0000:00:1c.1/0000:03:00.0/retry_rate | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window | 14 - .../0000:00:1c.1/0000:03:00.0/statistics | 15 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/status | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem | 1 - .../0000:00:1c.1/0000:03:00.0/subsystem_device | 1 - .../0000:00:1c.1/0000:03:00.0/subsystem_vendor | 1 - .../0000:00:1c.1/0000:03:00.0/temperature | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power | 1 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/uevent | 6 - .../pci0000:00/0000:00:1c.1/0000:03:00.0/vendor | 1 - .../pci0000:00/0000:00:1c.1/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1c.1/class | 1 - test/sys/devices/pci0000:00/0000:00:1c.1/config | Bin 4096 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1c.1/device | 1 - test/sys/devices/pci0000:00/0000:00:1c.1/driver | 1 - test/sys/devices/pci0000:00/0000:00:1c.1/enable | 1 - .../devices/pci0000:00/0000:00:1c.1/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1c.1/irq | 1 - .../devices/pci0000:00/0000:00:1c.1/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1c.1/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1c.1/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus | 1 - .../0000:00:1c.1/pci_bus/0000:03/cpuaffinity | 1 - .../pci0000:00/0000:00:1c.1/pci_bus/0000:03/device | 1 - .../0000:00:1c.1/pci_bus/0000:03/power/wakeup | 1 - .../0000:00:1c.1/pci_bus/0000:03/subsystem | 1 - .../pci0000:00/0000:00:1c.1/pci_bus/0000:03/uevent | 0 .../devices/pci0000:00/0000:00:1c.1/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1c.1/resource | 12 - test/sys/devices/pci0000:00/0000:00:1c.1/subsystem | 1 - .../pci0000:00/0000:00:1c.1/subsystem_device | 1 - .../pci0000:00/0000:00:1c.1/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1c.1/uevent | 6 - test/sys/devices/pci0000:00/0000:00:1c.1/vendor | 1 - .../0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup | 1 - .../0000:00:1c.2/0000:00:1c.2:pcie00/subsystem | 1 - .../0000:00:1c.2/0000:00:1c.2:pcie00/uevent | 0 .../0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup | 1 - .../0000:00:1c.2/0000:00:1c.2:pcie02/subsystem | 1 - .../0000:00:1c.2/0000:00:1c.2:pcie02/uevent | 0 .../0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup | 1 - .../0000:00:1c.2/0000:00:1c.2:pcie03/subsystem | 1 - .../0000:00:1c.2/0000:00:1c.2:pcie03/uevent | 0 .../pci0000:00/0000:00:1c.2/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1c.2/class | 1 - test/sys/devices/pci0000:00/0000:00:1c.2/config | Bin 4096 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1c.2/device | 1 - test/sys/devices/pci0000:00/0000:00:1c.2/driver | 1 - test/sys/devices/pci0000:00/0000:00:1c.2/enable | 1 - .../devices/pci0000:00/0000:00:1c.2/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1c.2/irq | 1 - .../devices/pci0000:00/0000:00:1c.2/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1c.2/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1c.2/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus | 1 - .../0000:00:1c.2/pci_bus/0000:04/cpuaffinity | 1 - .../pci0000:00/0000:00:1c.2/pci_bus/0000:04/device | 1 - .../0000:00:1c.2/pci_bus/0000:04/power/wakeup | 1 - .../0000:00:1c.2/pci_bus/0000:04/subsystem | 1 - .../pci0000:00/0000:00:1c.2/pci_bus/0000:04/uevent | 0 .../devices/pci0000:00/0000:00:1c.2/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1c.2/resource | 12 - test/sys/devices/pci0000:00/0000:00:1c.2/subsystem | 1 - .../pci0000:00/0000:00:1c.2/subsystem_device | 1 - .../pci0000:00/0000:00:1c.2/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1c.2/uevent | 6 - test/sys/devices/pci0000:00/0000:00:1c.2/vendor | 1 - .../0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup | 1 - .../0000:00:1c.3/0000:00:1c.3:pcie00/subsystem | 1 - .../0000:00:1c.3/0000:00:1c.3:pcie00/uevent | 0 .../0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup | 1 - .../0000:00:1c.3/0000:00:1c.3:pcie02/subsystem | 1 - .../0000:00:1c.3/0000:00:1c.3:pcie02/uevent | 0 .../0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup | 1 - .../0000:00:1c.3/0000:00:1c.3:pcie03/subsystem | 1 - .../0000:00:1c.3/0000:00:1c.3:pcie03/uevent | 0 .../pci0000:00/0000:00:1c.3/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1c.3/class | 1 - test/sys/devices/pci0000:00/0000:00:1c.3/config | Bin 4096 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1c.3/device | 1 - test/sys/devices/pci0000:00/0000:00:1c.3/driver | 1 - test/sys/devices/pci0000:00/0000:00:1c.3/enable | 1 - .../devices/pci0000:00/0000:00:1c.3/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1c.3/irq | 1 - .../devices/pci0000:00/0000:00:1c.3/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1c.3/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1c.3/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus | 1 - .../0000:00:1c.3/pci_bus/0000:0c/cpuaffinity | 1 - .../pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device | 1 - .../0000:00:1c.3/pci_bus/0000:0c/power/wakeup | 1 - .../0000:00:1c.3/pci_bus/0000:0c/subsystem | 1 - .../pci0000:00/0000:00:1c.3/pci_bus/0000:0c/uevent | 0 .../devices/pci0000:00/0000:00:1c.3/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1c.3/resource | 12 - test/sys/devices/pci0000:00/0000:00:1c.3/subsystem | 1 - .../pci0000:00/0000:00:1c.3/subsystem_device | 1 - .../pci0000:00/0000:00:1c.3/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1c.3/uevent | 6 - test/sys/devices/pci0000:00/0000:00:1c.3/vendor | 1 - .../pci0000:00/0000:00:1d.0/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1d.0/class | 1 - test/sys/devices/pci0000:00/0000:00:1d.0/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.0/device | 1 - test/sys/devices/pci0000:00/0000:00:1d.0/driver | 1 - test/sys/devices/pci0000:00/0000:00:1d.0/enable | 1 - .../devices/pci0000:00/0000:00:1d.0/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1d.0/irq | 1 - .../devices/pci0000:00/0000:00:1d.0/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1d.0/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1d.0/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1d.0/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.0/pools | 7 - .../devices/pci0000:00/0000:00:1d.0/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1d.0/resource | 7 - test/sys/devices/pci0000:00/0000:00:1d.0/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1d.0/subsystem | 1 - .../pci0000:00/0000:00:1d.0/subsystem_device | 1 - .../pci0000:00/0000:00:1d.0/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1d.0/uevent | 6 - .../0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting | 1 - .../0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass | 1 - .../0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber | 1 - .../0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol | 1 - .../0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver | 1 - .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 | 1 - .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias | 1 - .../0000:00:1d.0/usb1/1-0:1.0/power/wakeup | 1 - .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem | 1 - .../pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent | 6 - .../usb_endpoint/usbdev1.1_ep81/bEndpointAddress | 1 - .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval | 1 - .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength | 1 - .../usb_endpoint/usbdev1.1_ep81/bmAttributes | 1 - .../usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev | 1 - .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/device | 1 - .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction | 1 - .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval | 1 - .../usb_endpoint/usbdev1.1_ep81/power/wakeup | 1 - .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem | 1 - .../usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type | 1 - .../1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent | 2 - .../usb_endpoint/usbdev1.1_ep81/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.0/usb1/authorized | 1 - .../0000:00:1d.0/usb1/authorized_default | 1 - .../0000:00:1d.0/usb1/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.0/usb1/bDeviceClass | 1 - .../pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol | 1 - .../pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass | 1 - .../pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower | 1 - .../0000:00:1d.0/usb1/bNumConfigurations | 1 - .../pci0000:00/0000:00:1d.0/usb1/bNumInterfaces | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice | 1 - .../pci0000:00/0000:00:1d.0/usb1/bmAttributes | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/busnum | 1 - .../pci0000:00/0000:00:1d.0/usb1/configuration | 0 .../pci0000:00/0000:00:1d.0/usb1/descriptors | Bin 43 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/devnum | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/driver | 1 - .../sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/idProduct | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/idVendor | 1 - .../pci0000:00/0000:00:1d.0/usb1/manufacturer | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/maxchild | 1 - .../0000:00:1d.0/usb1/power/active_duration | 1 - .../pci0000:00/0000:00:1d.0/usb1/power/autosuspend | 1 - .../0000:00:1d.0/usb1/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.0/usb1/power/level | 1 - .../pci0000:00/0000:00:1d.0/usb1/power/wakeup | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/product | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/quirks | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/serial | 1 - .../sys/devices/pci0000:00/0000:00:1d.0/usb1/speed | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/subsystem | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/uevent | 8 - .../devices/pci0000:00/0000:00:1d.0/usb1/urbnum | 1 - .../usb_endpoint/usbdev1.1_ep00/bEndpointAddress | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/bInterval | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/bLength | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/dev | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/device | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/direction | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/interval | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/subsystem | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/type | 1 - .../usb1/usb_endpoint/usbdev1.1_ep00/uevent | 2 - .../usb_endpoint/usbdev1.1_ep00/wMaxPacketSize | 1 - .../devices/pci0000:00/0000:00:1d.0/usb1/version | 1 - .../0000:00:1d.0/usb_host/usb_host1/device | 1 - .../0000:00:1d.0/usb_host/usb_host1/power/wakeup | 1 - .../0000:00:1d.0/usb_host/usb_host1/subsystem | 1 - .../0000:00:1d.0/usb_host/usb_host1/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.0/vendor | 1 - .../pci0000:00/0000:00:1d.1/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1d.1/class | 1 - test/sys/devices/pci0000:00/0000:00:1d.1/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.1/device | 1 - test/sys/devices/pci0000:00/0000:00:1d.1/driver | 1 - test/sys/devices/pci0000:00/0000:00:1d.1/enable | 1 - .../devices/pci0000:00/0000:00:1d.1/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1d.1/irq | 1 - .../devices/pci0000:00/0000:00:1d.1/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1d.1/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1d.1/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1d.1/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.1/pools | 7 - .../devices/pci0000:00/0000:00:1d.1/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1d.1/resource | 7 - test/sys/devices/pci0000:00/0000:00:1d.1/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1d.1/subsystem | 1 - .../pci0000:00/0000:00:1d.1/subsystem_device | 1 - .../pci0000:00/0000:00:1d.1/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1d.1/uevent | 6 - .../0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting | 1 - .../0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass | 1 - .../0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber | 1 - .../0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol | 1 - .../0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver | 1 - .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 | 1 - .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias | 1 - .../0000:00:1d.1/usb2/2-0:1.0/power/wakeup | 1 - .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem | 1 - .../pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent | 6 - .../usb_endpoint/usbdev2.1_ep81/bEndpointAddress | 1 - .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval | 1 - .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength | 1 - .../usb_endpoint/usbdev2.1_ep81/bmAttributes | 1 - .../usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev | 1 - .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/device | 1 - .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction | 1 - .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval | 1 - .../usb_endpoint/usbdev2.1_ep81/power/wakeup | 1 - .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem | 1 - .../usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type | 1 - .../2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent | 2 - .../usb_endpoint/usbdev2.1_ep81/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.1/usb2/authorized | 1 - .../0000:00:1d.1/usb2/authorized_default | 1 - .../0000:00:1d.1/usb2/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.1/usb2/bDeviceClass | 1 - .../pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol | 1 - .../pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass | 1 - .../pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower | 1 - .../0000:00:1d.1/usb2/bNumConfigurations | 1 - .../pci0000:00/0000:00:1d.1/usb2/bNumInterfaces | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice | 1 - .../pci0000:00/0000:00:1d.1/usb2/bmAttributes | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/busnum | 1 - .../pci0000:00/0000:00:1d.1/usb2/configuration | 0 .../pci0000:00/0000:00:1d.1/usb2/descriptors | Bin 43 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/devnum | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/driver | 1 - .../sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/idProduct | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/idVendor | 1 - .../pci0000:00/0000:00:1d.1/usb2/manufacturer | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/maxchild | 1 - .../0000:00:1d.1/usb2/power/active_duration | 1 - .../pci0000:00/0000:00:1d.1/usb2/power/autosuspend | 1 - .../0000:00:1d.1/usb2/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.1/usb2/power/level | 1 - .../pci0000:00/0000:00:1d.1/usb2/power/wakeup | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/product | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/quirks | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/serial | 1 - .../sys/devices/pci0000:00/0000:00:1d.1/usb2/speed | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/subsystem | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/uevent | 8 - .../devices/pci0000:00/0000:00:1d.1/usb2/urbnum | 1 - .../usb_endpoint/usbdev2.1_ep00/bEndpointAddress | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/bInterval | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/bLength | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/dev | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/device | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/direction | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/interval | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/subsystem | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/type | 1 - .../usb2/usb_endpoint/usbdev2.1_ep00/uevent | 2 - .../usb_endpoint/usbdev2.1_ep00/wMaxPacketSize | 1 - .../devices/pci0000:00/0000:00:1d.1/usb2/version | 1 - .../0000:00:1d.1/usb_host/usb_host2/device | 1 - .../0000:00:1d.1/usb_host/usb_host2/power/wakeup | 1 - .../0000:00:1d.1/usb_host/usb_host2/subsystem | 1 - .../0000:00:1d.1/usb_host/usb_host2/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.1/vendor | 1 - .../pci0000:00/0000:00:1d.2/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1d.2/class | 1 - test/sys/devices/pci0000:00/0000:00:1d.2/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.2/device | 1 - test/sys/devices/pci0000:00/0000:00:1d.2/driver | 1 - test/sys/devices/pci0000:00/0000:00:1d.2/enable | 1 - .../devices/pci0000:00/0000:00:1d.2/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1d.2/irq | 1 - .../devices/pci0000:00/0000:00:1d.2/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1d.2/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1d.2/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1d.2/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.2/pools | 7 - .../devices/pci0000:00/0000:00:1d.2/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1d.2/resource | 7 - test/sys/devices/pci0000:00/0000:00:1d.2/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1d.2/subsystem | 1 - .../pci0000:00/0000:00:1d.2/subsystem_device | 1 - .../pci0000:00/0000:00:1d.2/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1d.2/uevent | 6 - .../0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting | 1 - .../0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass | 1 - .../0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber | 1 - .../0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol | 1 - .../0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias | 1 - .../0000:00:1d.2/usb3/3-0:1.0/power/wakeup | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent | 6 - .../usb_endpoint/usbdev3.1_ep81/bEndpointAddress | 1 - .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval | 1 - .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength | 1 - .../usb_endpoint/usbdev3.1_ep81/bmAttributes | 1 - .../usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev | 1 - .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/device | 1 - .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction | 1 - .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval | 1 - .../usb_endpoint/usbdev3.1_ep81/power/wakeup | 1 - .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem | 1 - .../usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type | 1 - .../3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent | 2 - .../usb_endpoint/usbdev3.1_ep81/wMaxPacketSize | 1 - .../usb3/3-1/3-1:1.0/bAlternateSetting | 1 - .../0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass | 1 - .../0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber | 1 - .../usb3/3-1/3-1:1.0/bInterfaceProtocol | 1 - .../usb3/3-1/3-1:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints | 1 - .../0000:00:1d.2/usb3/3-1/3-1:1.0/driver | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/abs | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/ev | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/ff | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/key | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/led | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/msc | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/rel | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/snd | 1 - .../usb3/3-1/3-1:1.0/input/input8/capabilities/sw | 1 - .../usb3/3-1/3-1:1.0/input/input8/device | 1 - .../usb3/3-1/3-1:1.0/input/input8/event7/dev | 1 - .../usb3/3-1/3-1:1.0/input/input8/event7/device | 1 - .../3-1/3-1:1.0/input/input8/event7/power/wakeup | 1 - .../usb3/3-1/3-1:1.0/input/input8/event7/subsystem | 1 - .../usb3/3-1/3-1:1.0/input/input8/event7/uevent | 2 - .../usb3/3-1/3-1:1.0/input/input8/id/bustype | 1 - .../usb3/3-1/3-1:1.0/input/input8/id/product | 1 - .../usb3/3-1/3-1:1.0/input/input8/id/vendor | 1 - .../usb3/3-1/3-1:1.0/input/input8/id/version | 1 - .../usb3/3-1/3-1:1.0/input/input8/modalias | 1 - .../usb3/3-1/3-1:1.0/input/input8/mouse1/dev | 1 - .../usb3/3-1/3-1:1.0/input/input8/mouse1/device | 1 - .../3-1/3-1:1.0/input/input8/mouse1/power/wakeup | 1 - .../usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem | 1 - .../usb3/3-1/3-1:1.0/input/input8/mouse1/uevent | 2 - .../usb3/3-1/3-1:1.0/input/input8/name | 1 - .../usb3/3-1/3-1:1.0/input/input8/phys | 1 - .../usb3/3-1/3-1:1.0/input/input8/power/wakeup | 1 - .../usb3/3-1/3-1:1.0/input/input8/subsystem | 1 - .../usb3/3-1/3-1:1.0/input/input8/uevent | 9 - .../usb3/3-1/3-1:1.0/input/input8/uniq | 1 - .../0000:00:1d.2/usb3/3-1/3-1:1.0/modalias | 1 - .../0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup | 1 - .../0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem | 1 - .../0000:00:1d.2/usb3/3-1/3-1:1.0/uevent | 6 - .../usb_endpoint/usbdev3.4_ep81/bEndpointAddress | 1 - .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval | 1 - .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength | 1 - .../usb_endpoint/usbdev3.4_ep81/bmAttributes | 1 - .../3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev | 1 - .../3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device | 1 - .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction | 1 - .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval | 1 - .../usb_endpoint/usbdev3.4_ep81/power/wakeup | 1 - .../3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem | 1 - .../3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type | 1 - .../3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent | 2 - .../usb_endpoint/usbdev3.4_ep81/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/authorized | 1 - .../0000:00:1d.2/usb3/3-1/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass | 1 - .../0000:00:1d.2/usb3/3-1/bDeviceProtocol | 1 - .../0000:00:1d.2/usb3/3-1/bDeviceSubClass | 1 - .../0000:00:1d.2/usb3/3-1/bMaxPacketSize0 | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower | 1 - .../0000:00:1d.2/usb3/3-1/bNumConfigurations | 1 - .../0000:00:1d.2/usb3/3-1/bNumInterfaces | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/busnum | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/configuration | 0 .../pci0000:00/0000:00:1d.2/usb3/3-1/descriptors | Bin 52 -> 0 bytes .../devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/devnum | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/driver | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/idProduct | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/idVendor | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/maxchild | 1 - .../0000:00:1d.2/usb3/3-1/power/active_duration | 1 - .../0000:00:1d.2/usb3/3-1/power/autosuspend | 1 - .../0000:00:1d.2/usb3/3-1/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/power/level | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/power/persist | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/product | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/quirks | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/subsystem | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/uevent | 8 - .../pci0000:00/0000:00:1d.2/usb3/3-1/urbnum | 1 - .../usb_endpoint/usbdev3.4_ep00/bEndpointAddress | 1 - .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval | 1 - .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength | 1 - .../3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes | 1 - .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev | 1 - .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/device | 1 - .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction | 1 - .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval | 1 - .../3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup | 1 - .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem | 1 - .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/type | 1 - .../usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent | 2 - .../3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.2/usb3/3-1/version | 1 - .../pci0000:00/0000:00:1d.2/usb3/authorized | 1 - .../0000:00:1d.2/usb3/authorized_default | 1 - .../0000:00:1d.2/usb3/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.2/usb3/bDeviceClass | 1 - .../pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol | 1 - .../pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass | 1 - .../pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower | 1 - .../0000:00:1d.2/usb3/bNumConfigurations | 1 - .../pci0000:00/0000:00:1d.2/usb3/bNumInterfaces | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice | 1 - .../pci0000:00/0000:00:1d.2/usb3/bmAttributes | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/busnum | 1 - .../pci0000:00/0000:00:1d.2/usb3/configuration | 0 .../pci0000:00/0000:00:1d.2/usb3/descriptors | Bin 43 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/devnum | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/driver | 1 - .../sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/idProduct | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/idVendor | 1 - .../pci0000:00/0000:00:1d.2/usb3/manufacturer | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/maxchild | 1 - .../0000:00:1d.2/usb3/power/active_duration | 1 - .../pci0000:00/0000:00:1d.2/usb3/power/autosuspend | 1 - .../0000:00:1d.2/usb3/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.2/usb3/power/level | 1 - .../pci0000:00/0000:00:1d.2/usb3/power/wakeup | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/product | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/quirks | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/serial | 1 - .../sys/devices/pci0000:00/0000:00:1d.2/usb3/speed | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/subsystem | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/uevent | 8 - .../devices/pci0000:00/0000:00:1d.2/usb3/urbnum | 1 - .../usb_endpoint/usbdev3.1_ep00/bEndpointAddress | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/bInterval | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/bLength | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/dev | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/device | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/direction | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/interval | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/subsystem | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/type | 1 - .../usb3/usb_endpoint/usbdev3.1_ep00/uevent | 2 - .../usb_endpoint/usbdev3.1_ep00/wMaxPacketSize | 1 - .../devices/pci0000:00/0000:00:1d.2/usb3/version | 1 - .../0000:00:1d.2/usb_host/usb_host3/device | 1 - .../0000:00:1d.2/usb_host/usb_host3/power/wakeup | 1 - .../0000:00:1d.2/usb_host/usb_host3/subsystem | 1 - .../0000:00:1d.2/usb_host/usb_host3/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.2/vendor | 1 - .../pci0000:00/0000:00:1d.3/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1d.3/class | 1 - test/sys/devices/pci0000:00/0000:00:1d.3/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.3/device | 1 - test/sys/devices/pci0000:00/0000:00:1d.3/driver | 1 - test/sys/devices/pci0000:00/0000:00:1d.3/enable | 1 - .../devices/pci0000:00/0000:00:1d.3/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1d.3/irq | 1 - .../devices/pci0000:00/0000:00:1d.3/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1d.3/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1d.3/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1d.3/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.3/pools | 7 - .../devices/pci0000:00/0000:00:1d.3/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1d.3/resource | 7 - test/sys/devices/pci0000:00/0000:00:1d.3/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1d.3/subsystem | 1 - .../pci0000:00/0000:00:1d.3/subsystem_device | 1 - .../pci0000:00/0000:00:1d.3/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1d.3/uevent | 6 - .../0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting | 1 - .../0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass | 1 - .../0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber | 1 - .../0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol | 1 - .../0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias | 1 - .../0000:00:1d.3/usb4/4-0:1.0/power/wakeup | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent | 6 - .../usb_endpoint/usbdev4.1_ep81/bEndpointAddress | 1 - .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval | 1 - .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength | 1 - .../usb_endpoint/usbdev4.1_ep81/bmAttributes | 1 - .../usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev | 1 - .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/device | 1 - .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction | 1 - .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval | 1 - .../usb_endpoint/usbdev4.1_ep81/power/wakeup | 1 - .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem | 1 - .../usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type | 1 - .../4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent | 2 - .../usb_endpoint/usbdev4.1_ep81/wMaxPacketSize | 1 - .../usb4/4-1/4-1:1.0/bAlternateSetting | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber | 1 - .../usb4/4-1/4-1:1.0/bInterfaceProtocol | 1 - .../usb4/4-1/4-1:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.0/modalias | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.0/uevent | 5 - .../usb_endpoint/usbdev4.2_ep02/bEndpointAddress | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength | 1 - .../usb_endpoint/usbdev4.2_ep02/bmAttributes | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval | 1 - .../usb_endpoint/usbdev4.2_ep02/power/wakeup | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent | 2 - .../usb_endpoint/usbdev4.2_ep02/wMaxPacketSize | 1 - .../usb_endpoint/usbdev4.2_ep81/bEndpointAddress | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength | 1 - .../usb_endpoint/usbdev4.2_ep81/bmAttributes | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval | 1 - .../usb_endpoint/usbdev4.2_ep81/power/wakeup | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent | 2 - .../usb_endpoint/usbdev4.2_ep81/wMaxPacketSize | 1 - .../usb_endpoint/usbdev4.2_ep82/bEndpointAddress | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength | 1 - .../usb_endpoint/usbdev4.2_ep82/bmAttributes | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval | 1 - .../usb_endpoint/usbdev4.2_ep82/power/wakeup | 1 - .../4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type | 1 - .../4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent | 2 - .../usb_endpoint/usbdev4.2_ep82/wMaxPacketSize | 1 - .../usb4/4-1/4-1:1.1/bAlternateSetting | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber | 1 - .../usb4/4-1/4-1:1.1/bInterfaceProtocol | 1 - .../usb4/4-1/4-1:1.1/bInterfaceSubClass | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.1/modalias | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.1/uevent | 5 - .../usb_endpoint/usbdev4.2_ep03/bEndpointAddress | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength | 1 - .../usb_endpoint/usbdev4.2_ep03/bmAttributes | 1 - .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev | 1 - .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval | 1 - .../usb_endpoint/usbdev4.2_ep03/power/wakeup | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem | 1 - .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type | 1 - .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent | 2 - .../usb_endpoint/usbdev4.2_ep03/wMaxPacketSize | 1 - .../usb_endpoint/usbdev4.2_ep83/bEndpointAddress | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength | 1 - .../usb_endpoint/usbdev4.2_ep83/bmAttributes | 1 - .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev | 1 - .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval | 1 - .../usb_endpoint/usbdev4.2_ep83/power/wakeup | 1 - .../4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem | 1 - .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type | 1 - .../4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent | 2 - .../usb_endpoint/usbdev4.2_ep83/wMaxPacketSize | 1 - .../usb4/4-1/4-1:1.2/bAlternateSetting | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber | 1 - .../usb4/4-1/4-1:1.2/bInterfaceProtocol | 1 - .../usb4/4-1/4-1:1.2/bInterfaceSubClass | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.2/modalias | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.2/uevent | 5 - .../usb_endpoint/usbdev4.2_ep04/bEndpointAddress | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength | 1 - .../usb_endpoint/usbdev4.2_ep04/bmAttributes | 1 - .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev | 1 - .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval | 1 - .../usb_endpoint/usbdev4.2_ep04/power/wakeup | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem | 1 - .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type | 1 - .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent | 2 - .../usb_endpoint/usbdev4.2_ep04/wMaxPacketSize | 1 - .../usb_endpoint/usbdev4.2_ep84/bEndpointAddress | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength | 1 - .../usb_endpoint/usbdev4.2_ep84/bmAttributes | 1 - .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev | 1 - .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval | 1 - .../usb_endpoint/usbdev4.2_ep84/power/wakeup | 1 - .../4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem | 1 - .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type | 1 - .../4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent | 2 - .../usb_endpoint/usbdev4.2_ep84/wMaxPacketSize | 1 - .../usb4/4-1/4-1:1.3/bAlternateSetting | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber | 1 - .../usb4/4-1/4-1:1.3/bInterfaceProtocol | 1 - .../usb4/4-1/4-1:1.3/bInterfaceSubClass | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.3/modalias | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem | 1 - .../0000:00:1d.3/usb4/4-1/4-1:1.3/uevent | 5 - .../pci0000:00/0000:00:1d.3/usb4/4-1/authorized | 1 - .../0000:00:1d.3/usb4/4-1/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass | 1 - .../0000:00:1d.3/usb4/4-1/bDeviceProtocol | 1 - .../0000:00:1d.3/usb4/4-1/bDeviceSubClass | 1 - .../0000:00:1d.3/usb4/4-1/bMaxPacketSize0 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower | 1 - .../0000:00:1d.3/usb4/4-1/bNumConfigurations | 1 - .../0000:00:1d.3/usb4/4-1/bNumInterfaces | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/busnum | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/configuration | 0 .../pci0000:00/0000:00:1d.3/usb4/4-1/descriptors | Bin 234 -> 0 bytes .../devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/devnum | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/driver | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/idProduct | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/idVendor | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/maxchild | 1 - .../0000:00:1d.3/usb4/4-1/power/active_duration | 1 - .../0000:00:1d.3/usb4/4-1/power/autosuspend | 1 - .../0000:00:1d.3/usb4/4-1/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/power/level | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/power/persist | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/product | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/quirks | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/subsystem | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/uevent | 8 - .../pci0000:00/0000:00:1d.3/usb4/4-1/urbnum | 1 - .../usb_endpoint/usbdev4.2_ep00/bEndpointAddress | 1 - .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval | 1 - .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength | 1 - .../4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes | 1 - .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev | 1 - .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/device | 1 - .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction | 1 - .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval | 1 - .../4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup | 1 - .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem | 1 - .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/type | 1 - .../usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent | 2 - .../4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-1/version | 1 - .../usb4/4-2/4-2:1.0/bAlternateSetting | 1 - .../0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass | 1 - .../0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber | 1 - .../usb4/4-2/4-2:1.0/bInterfaceProtocol | 1 - .../usb4/4-2/4-2:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 | 1 - .../0000:00:1d.3/usb4/4-2/4-2:1.0/modalias | 1 - .../0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup | 1 - .../0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem | 1 - .../0000:00:1d.3/usb4/4-2/4-2:1.0/uevent | 5 - .../usb_endpoint/usbdev4.3_ep02/bEndpointAddress | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength | 1 - .../usb_endpoint/usbdev4.3_ep02/bmAttributes | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval | 1 - .../usb_endpoint/usbdev4.3_ep02/power/wakeup | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent | 2 - .../usb_endpoint/usbdev4.3_ep02/wMaxPacketSize | 1 - .../usb_endpoint/usbdev4.3_ep81/bEndpointAddress | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength | 1 - .../usb_endpoint/usbdev4.3_ep81/bmAttributes | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval | 1 - .../usb_endpoint/usbdev4.3_ep81/power/wakeup | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent | 2 - .../usb_endpoint/usbdev4.3_ep81/wMaxPacketSize | 1 - .../usb_endpoint/usbdev4.3_ep83/bEndpointAddress | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength | 1 - .../usb_endpoint/usbdev4.3_ep83/bmAttributes | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval | 1 - .../usb_endpoint/usbdev4.3_ep83/power/wakeup | 1 - .../4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type | 1 - .../4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent | 2 - .../usb_endpoint/usbdev4.3_ep83/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/authorized | 1 - .../0000:00:1d.3/usb4/4-2/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass | 1 - .../0000:00:1d.3/usb4/4-2/bDeviceProtocol | 1 - .../0000:00:1d.3/usb4/4-2/bDeviceSubClass | 1 - .../0000:00:1d.3/usb4/4-2/bMaxPacketSize0 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower | 1 - .../0000:00:1d.3/usb4/4-2/bNumConfigurations | 1 - .../0000:00:1d.3/usb4/4-2/bNumInterfaces | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/busnum | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/configuration | 0 .../pci0000:00/0000:00:1d.3/usb4/4-2/descriptors | Bin 57 -> 0 bytes .../devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/devnum | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/driver | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/idProduct | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/idVendor | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/maxchild | 1 - .../0000:00:1d.3/usb4/4-2/power/active_duration | 1 - .../0000:00:1d.3/usb4/4-2/power/autosuspend | 1 - .../0000:00:1d.3/usb4/4-2/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/power/level | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/power/persist | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/product | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/quirks | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/subsystem | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/uevent | 8 - .../pci0000:00/0000:00:1d.3/usb4/4-2/urbnum | 1 - .../usb_endpoint/usbdev4.3_ep00/bEndpointAddress | 1 - .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval | 1 - .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength | 1 - .../4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes | 1 - .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev | 1 - .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/device | 1 - .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction | 1 - .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval | 1 - .../4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup | 1 - .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem | 1 - .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/type | 1 - .../usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent | 2 - .../4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.3/usb4/4-2/version | 1 - .../pci0000:00/0000:00:1d.3/usb4/authorized | 1 - .../0000:00:1d.3/usb4/authorized_default | 1 - .../0000:00:1d.3/usb4/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.3/usb4/bDeviceClass | 1 - .../pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol | 1 - .../pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass | 1 - .../pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower | 1 - .../0000:00:1d.3/usb4/bNumConfigurations | 1 - .../pci0000:00/0000:00:1d.3/usb4/bNumInterfaces | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice | 1 - .../pci0000:00/0000:00:1d.3/usb4/bmAttributes | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/busnum | 1 - .../pci0000:00/0000:00:1d.3/usb4/configuration | 0 .../pci0000:00/0000:00:1d.3/usb4/descriptors | Bin 43 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/devnum | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/driver | 1 - .../sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/idProduct | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/idVendor | 1 - .../pci0000:00/0000:00:1d.3/usb4/manufacturer | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/maxchild | 1 - .../0000:00:1d.3/usb4/power/active_duration | 1 - .../pci0000:00/0000:00:1d.3/usb4/power/autosuspend | 1 - .../0000:00:1d.3/usb4/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.3/usb4/power/level | 1 - .../pci0000:00/0000:00:1d.3/usb4/power/wakeup | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/product | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/quirks | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/serial | 1 - .../sys/devices/pci0000:00/0000:00:1d.3/usb4/speed | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/subsystem | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/uevent | 8 - .../devices/pci0000:00/0000:00:1d.3/usb4/urbnum | 1 - .../usb_endpoint/usbdev4.1_ep00/bEndpointAddress | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/bInterval | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/bLength | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/dev | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/device | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/direction | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/interval | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/subsystem | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/type | 1 - .../usb4/usb_endpoint/usbdev4.1_ep00/uevent | 2 - .../usb_endpoint/usbdev4.1_ep00/wMaxPacketSize | 1 - .../devices/pci0000:00/0000:00:1d.3/usb4/version | 1 - .../0000:00:1d.3/usb_host/usb_host4/device | 1 - .../0000:00:1d.3/usb_host/usb_host4/power/wakeup | 1 - .../0000:00:1d.3/usb_host/usb_host4/subsystem | 1 - .../0000:00:1d.3/usb_host/usb_host4/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.3/vendor | 1 - .../pci0000:00/0000:00:1d.7/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1d.7/class | 1 - test/sys/devices/pci0000:00/0000:00:1d.7/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.7/device | 1 - test/sys/devices/pci0000:00/0000:00:1d.7/driver | 1 - test/sys/devices/pci0000:00/0000:00:1d.7/enable | 1 - .../devices/pci0000:00/0000:00:1d.7/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1d.7/irq | 1 - .../devices/pci0000:00/0000:00:1d.7/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1d.7/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1d.7/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1d.7/msi_bus | 0 test/sys/devices/pci0000:00/0000:00:1d.7/pools | 9 - .../devices/pci0000:00/0000:00:1d.7/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1d.7/resource | 7 - test/sys/devices/pci0000:00/0000:00:1d.7/resource0 | 0 test/sys/devices/pci0000:00/0000:00:1d.7/subsystem | 1 - .../pci0000:00/0000:00:1d.7/subsystem_device | 1 - .../pci0000:00/0000:00:1d.7/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1d.7/uevent | 6 - .../0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber | 1 - .../0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol | 1 - .../0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias | 1 - .../0000:00:1d.7/usb5/5-0:1.0/power/wakeup | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent | 6 - .../usb_endpoint/usbdev5.1_ep81/bEndpointAddress | 1 - .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval | 1 - .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength | 1 - .../usb_endpoint/usbdev5.1_ep81/bmAttributes | 1 - .../usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev | 1 - .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/device | 1 - .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction | 1 - .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval | 1 - .../usb_endpoint/usbdev5.1_ep81/power/wakeup | 1 - .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem | 1 - .../usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type | 1 - .../5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent | 2 - .../usb_endpoint/usbdev5.1_ep81/wMaxPacketSize | 1 - .../usb5/5-1/5-1:1.0/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber | 1 - .../usb5/5-1/5-1:1.0/bInterfaceProtocol | 1 - .../usb5/5-1/5-1:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/driver | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 | 1 - .../usb5/5-1/5-1:1.0/host7/power/wakeup | 1 - .../5-1/5-1:1.0/host7/scsi_host/host7/active_mode | 1 - .../5-1/5-1:1.0/host7/scsi_host/host7/can_queue | 1 - .../5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun | 1 - .../usb5/5-1/5-1:1.0/host7/scsi_host/host7/device | 1 - .../5-1/5-1:1.0/host7/scsi_host/host7/host_busy | 1 - .../5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup | 1 - .../5-1/5-1:1.0/host7/scsi_host/host7/proc_name | 1 - .../host7/scsi_host/host7/prot_capabilities | 1 - .../5-1:1.0/host7/scsi_host/host7/prot_guard_type | 1 - .../5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize | 1 - .../usb5/5-1/5-1:1.0/host7/scsi_host/host7/state | 1 - .../5-1/5-1:1.0/host7/scsi_host/host7/subsystem | 1 - .../5-1:1.0/host7/scsi_host/host7/supported_mode | 1 - .../usb5/5-1/5-1:1.0/host7/scsi_host/host7/uevent | 0 .../host7/scsi_host/host7/unchecked_isa_dma | 1 - .../5-1/5-1:1.0/host7/scsi_host/host7/unique_id | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/bdi | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/capability | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/dev | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/device | 1 - .../target7:0:0/7:0:0:0/block/sdb/make-it-fail | 1 - .../target7:0:0/7:0:0:0/block/sdb/power/wakeup | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg | 1 - .../7:0:0:0/block/sdb/queue/hw_sector_size | 1 - .../7:0:0:0/block/sdb/queue/iosched/back_seek_max | 1 - .../block/sdb/queue/iosched/back_seek_penalty | 1 - .../block/sdb/queue/iosched/fifo_expire_async | 1 - .../block/sdb/queue/iosched/fifo_expire_sync | 1 - .../7:0:0:0/block/sdb/queue/iosched/quantum | 1 - .../7:0:0:0/block/sdb/queue/iosched/slice_async | 1 - .../7:0:0:0/block/sdb/queue/iosched/slice_async_rq | 1 - .../7:0:0:0/block/sdb/queue/iosched/slice_idle | 1 - .../7:0:0:0/block/sdb/queue/iosched/slice_sync | 1 - .../7:0:0:0/block/sdb/queue/max_hw_sectors_kb | 1 - .../7:0:0:0/block/sdb/queue/max_sectors_kb | 1 - .../target7:0:0/7:0:0:0/block/sdb/queue/nomerges | 1 - .../7:0:0:0/block/sdb/queue/nr_requests | 1 - .../7:0:0:0/block/sdb/queue/read_ahead_kb | 1 - .../target7:0:0/7:0:0:0/block/sdb/queue/scheduler | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/range | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/removable | 1 - .../5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev | 1 - .../7:0:0:0/block/sdb/sdb1/make-it-fail | 1 - .../7:0:0:0/block/sdb/sdb1/power/wakeup | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat | 1 - .../target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem | 1 - .../target7:0:0/7:0:0:0/block/sdb/sdb1/uevent | 3 - .../host7/target7:0:0/7:0:0:0/block/sdb/size | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/stat | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/subsystem | 1 - .../host7/target7:0:0/7:0:0:0/block/sdb/uevent | 3 - .../host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev | 1 - .../host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device | 1 - .../target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup | 1 - .../target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem | 1 - .../host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent | 2 - .../host7/target7:0:0/7:0:0:0/device_blocked | 1 - .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver | 1 - .../host7/target7:0:0/7:0:0:0/evt_media_change | 1 - .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic | 1 - .../host7/target7:0:0/7:0:0:0/iocounterbits | 1 - .../5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt | 1 - .../5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt | 1 - .../host7/target7:0:0/7:0:0:0/iorequest_cnt | 1 - .../5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors | 1 - .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias | 1 - .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model | 1 - .../5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup | 1 - .../5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth | 1 - .../5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type | 1 - .../usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev | 1 - .../target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device | 1 - .../7:0:0:0/scsi_device/7:0:0:0/power/wakeup | 1 - .../7:0:0:0/scsi_device/7:0:0:0/subsystem | 1 - .../target7:0:0/7:0:0:0/scsi_device/7:0:0:0/uevent | 0 .../target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA | 1 - .../7:0:0:0/scsi_disk/7:0:0:0/allow_restart | 1 - .../7:0:0:0/scsi_disk/7:0:0:0/app_tag_own | 1 - .../7:0:0:0/scsi_disk/7:0:0:0/cache_type | 1 - .../target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device | 1 - .../7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop | 1 - .../7:0:0:0/scsi_disk/7:0:0:0/power/wakeup | 1 - .../7:0:0:0/scsi_disk/7:0:0:0/protection_type | 1 - .../7:0:0:0/scsi_disk/7:0:0:0/subsystem | 1 - .../target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/uevent | 0 .../host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev | 1 - .../target7:0:0/7:0:0:0/scsi_generic/sg2/device | 1 - .../7:0:0:0/scsi_generic/sg2/power/wakeup | 1 - .../target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem | 1 - .../target7:0:0/7:0:0:0/scsi_generic/sg2/uevent | 2 - .../5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level | 1 - .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state | 1 - .../5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem | 1 - .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout | 1 - .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type | 1 - .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent | 3 - .../5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor | 1 - .../5-1/5-1:1.0/host7/target7:0:0/power/wakeup | 1 - .../usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem | 1 - .../usb5/5-1/5-1:1.0/host7/target7:0:0/uevent | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/modalias | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem | 1 - .../0000:00:1d.7/usb5/5-1/5-1:1.0/uevent | 6 - .../usb_endpoint/usbdev5.7_ep02/bEndpointAddress | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength | 1 - .../usb_endpoint/usbdev5.7_ep02/bmAttributes | 1 - .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev | 1 - .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval | 1 - .../usb_endpoint/usbdev5.7_ep02/power/wakeup | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem | 1 - .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type | 1 - .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent | 2 - .../usb_endpoint/usbdev5.7_ep02/wMaxPacketSize | 1 - .../usb_endpoint/usbdev5.7_ep81/bEndpointAddress | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength | 1 - .../usb_endpoint/usbdev5.7_ep81/bmAttributes | 1 - .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev | 1 - .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval | 1 - .../usb_endpoint/usbdev5.7_ep81/power/wakeup | 1 - .../5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem | 1 - .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type | 1 - .../5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent | 2 - .../usb_endpoint/usbdev5.7_ep81/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/authorized | 1 - .../0000:00:1d.7/usb5/5-1/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass | 1 - .../0000:00:1d.7/usb5/5-1/bDeviceProtocol | 1 - .../0000:00:1d.7/usb5/5-1/bDeviceSubClass | 1 - .../0000:00:1d.7/usb5/5-1/bMaxPacketSize0 | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower | 1 - .../0000:00:1d.7/usb5/5-1/bNumConfigurations | 1 - .../0000:00:1d.7/usb5/5-1/bNumInterfaces | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/busnum | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/configuration | 0 .../pci0000:00/0000:00:1d.7/usb5/5-1/descriptors | Bin 50 -> 0 bytes .../devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/devnum | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/driver | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/idProduct | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/idVendor | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/maxchild | 1 - .../0000:00:1d.7/usb5/5-1/power/active_duration | 1 - .../0000:00:1d.7/usb5/5-1/power/autosuspend | 1 - .../0000:00:1d.7/usb5/5-1/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/power/level | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/power/persist | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/product | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/quirks | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/subsystem | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/uevent | 8 - .../pci0000:00/0000:00:1d.7/usb5/5-1/urbnum | 1 - .../usb_endpoint/usbdev5.7_ep00/bEndpointAddress | 1 - .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval | 1 - .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength | 1 - .../5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes | 1 - .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev | 1 - .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/device | 1 - .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction | 1 - .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval | 1 - .../5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup | 1 - .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem | 1 - .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/type | 1 - .../usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent | 2 - .../5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-1/version | 1 - .../usb5/5-2/5-2:1.0/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.0/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.0/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/driver | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/interface | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev | 1 - .../usb5/5-2/5-2:1.0/tty/ttyACM0/device | 1 - .../usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup | 1 - .../usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem | 1 - .../usb5/5-2/5-2:1.0/tty/ttyACM0/uevent | 3 - .../0000:00:1d.7/usb5/5-2/5-2:1.0/uevent | 6 - .../usb_endpoint/usbdev5.9_ep81/bEndpointAddress | 1 - .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval | 1 - .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength | 1 - .../usb_endpoint/usbdev5.9_ep81/bmAttributes | 1 - .../5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev | 1 - .../5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device | 1 - .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction | 1 - .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval | 1 - .../usb_endpoint/usbdev5.9_ep81/power/wakeup | 1 - .../5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem | 1 - .../5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type | 1 - .../5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent | 2 - .../usb_endpoint/usbdev5.9_ep81/wMaxPacketSize | 1 - .../usb5/5-2/5-2:1.1/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.1/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.1/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.1/driver | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.1/interface | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.1/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.1/uevent | 6 - .../usb_endpoint/usbdev5.9_ep01/bEndpointAddress | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength | 1 - .../usb_endpoint/usbdev5.9_ep01/bmAttributes | 1 - .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev | 1 - .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval | 1 - .../usb_endpoint/usbdev5.9_ep01/power/wakeup | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem | 1 - .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type | 1 - .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent | 2 - .../usb_endpoint/usbdev5.9_ep01/wMaxPacketSize | 1 - .../usb_endpoint/usbdev5.9_ep82/bEndpointAddress | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength | 1 - .../usb_endpoint/usbdev5.9_ep82/bmAttributes | 1 - .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev | 1 - .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval | 1 - .../usb_endpoint/usbdev5.9_ep82/power/wakeup | 1 - .../5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem | 1 - .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type | 1 - .../5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent | 2 - .../usb_endpoint/usbdev5.9_ep82/wMaxPacketSize | 1 - .../usb5/5-2/5-2:1.10/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass | 1 - .../usb5/5-2/5-2:1.10/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.10/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.10/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.10/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.10/uevent | 5 - .../usb5/5-2/5-2:1.11/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass | 1 - .../usb5/5-2/5-2:1.11/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.11/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.11/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.11/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.11/uevent | 5 - .../usb5/5-2/5-2:1.12/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass | 1 - .../usb5/5-2/5-2:1.12/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.12/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.12/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.12/interface | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.12/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.12/uevent | 5 - .../usb5/5-2/5-2:1.13/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass | 1 - .../usb5/5-2/5-2:1.13/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.13/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.13/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.13/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.13/uevent | 5 - .../usb5/5-2/5-2:1.2/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.2/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.2/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.2/interface | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.2/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.2/uevent | 5 - .../usb_endpoint/usbdev5.9_ep83/bEndpointAddress | 1 - .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval | 1 - .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength | 1 - .../usb_endpoint/usbdev5.9_ep83/bmAttributes | 1 - .../5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev | 1 - .../5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device | 1 - .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction | 1 - .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval | 1 - .../usb_endpoint/usbdev5.9_ep83/power/wakeup | 1 - .../5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem | 1 - .../5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type | 1 - .../5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent | 2 - .../usb_endpoint/usbdev5.9_ep83/wMaxPacketSize | 1 - .../usb5/5-2/5-2:1.3/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.3/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.3/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.3/interface | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.3/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.3/uevent | 5 - .../usb_endpoint/usbdev5.9_ep02/bEndpointAddress | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength | 1 - .../usb_endpoint/usbdev5.9_ep02/bmAttributes | 1 - .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev | 1 - .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval | 1 - .../usb_endpoint/usbdev5.9_ep02/power/wakeup | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem | 1 - .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type | 1 - .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent | 2 - .../usb_endpoint/usbdev5.9_ep02/wMaxPacketSize | 1 - .../usb_endpoint/usbdev5.9_ep84/bEndpointAddress | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength | 1 - .../usb_endpoint/usbdev5.9_ep84/bmAttributes | 1 - .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev | 1 - .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval | 1 - .../usb_endpoint/usbdev5.9_ep84/power/wakeup | 1 - .../5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem | 1 - .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type | 1 - .../5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent | 2 - .../usb_endpoint/usbdev5.9_ep84/wMaxPacketSize | 1 - .../usb5/5-2/5-2:1.4/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.4/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.4/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.4/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.4/uevent | 5 - .../usb5/5-2/5-2:1.5/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.5/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.5/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.5/interface | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.5/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.5/uevent | 5 - .../usb5/5-2/5-2:1.6/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.6/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.6/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.6/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.6/uevent | 5 - .../usb5/5-2/5-2:1.7/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.7/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.7/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.7/interface | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.7/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.7/uevent | 5 - .../usb5/5-2/5-2:1.8/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.8/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.8/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.8/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.8/uevent | 5 - .../usb5/5-2/5-2:1.9/bAlternateSetting | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber | 1 - .../usb5/5-2/5-2:1.9/bInterfaceProtocol | 1 - .../usb5/5-2/5-2:1.9/bInterfaceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.9/modalias | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem | 1 - .../0000:00:1d.7/usb5/5-2/5-2:1.9/uevent | 5 - .../pci0000:00/0000:00:1d.7/usb5/5-2/authorized | 1 - .../0000:00:1d.7/usb5/5-2/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass | 1 - .../0000:00:1d.7/usb5/5-2/bDeviceProtocol | 1 - .../0000:00:1d.7/usb5/5-2/bDeviceSubClass | 1 - .../0000:00:1d.7/usb5/5-2/bMaxPacketSize0 | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower | 1 - .../0000:00:1d.7/usb5/5-2/bNumConfigurations | 1 - .../0000:00:1d.7/usb5/5-2/bNumInterfaces | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/busnum | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/configuration | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/descriptors | Bin 445 -> 0 bytes .../devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/devnum | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/driver | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/idProduct | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/idVendor | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/maxchild | 1 - .../0000:00:1d.7/usb5/5-2/power/active_duration | 1 - .../0000:00:1d.7/usb5/5-2/power/autosuspend | 1 - .../0000:00:1d.7/usb5/5-2/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/power/level | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/power/persist | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/product | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/quirks | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/serial | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/subsystem | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/uevent | 8 - .../pci0000:00/0000:00:1d.7/usb5/5-2/urbnum | 1 - .../usb_endpoint/usbdev5.9_ep00/bEndpointAddress | 1 - .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval | 1 - .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength | 1 - .../5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes | 1 - .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev | 1 - .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/device | 1 - .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction | 1 - .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval | 1 - .../5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup | 1 - .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem | 1 - .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/type | 1 - .../usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent | 2 - .../5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize | 1 - .../pci0000:00/0000:00:1d.7/usb5/5-2/version | 1 - .../pci0000:00/0000:00:1d.7/usb5/authorized | 1 - .../0000:00:1d.7/usb5/authorized_default | 1 - .../0000:00:1d.7/usb5/bConfigurationValue | 1 - .../pci0000:00/0000:00:1d.7/usb5/bDeviceClass | 1 - .../pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol | 1 - .../pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass | 1 - .../pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower | 1 - .../0000:00:1d.7/usb5/bNumConfigurations | 1 - .../pci0000:00/0000:00:1d.7/usb5/bNumInterfaces | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice | 1 - .../pci0000:00/0000:00:1d.7/usb5/bmAttributes | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/busnum | 1 - .../pci0000:00/0000:00:1d.7/usb5/configuration | 0 .../pci0000:00/0000:00:1d.7/usb5/descriptors | Bin 43 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/devnum | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/driver | 1 - .../sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/idProduct | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/idVendor | 1 - .../pci0000:00/0000:00:1d.7/usb5/manufacturer | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/maxchild | 1 - .../0000:00:1d.7/usb5/power/active_duration | 1 - .../pci0000:00/0000:00:1d.7/usb5/power/autosuspend | 1 - .../0000:00:1d.7/usb5/power/connected_duration | 1 - .../pci0000:00/0000:00:1d.7/usb5/power/level | 1 - .../pci0000:00/0000:00:1d.7/usb5/power/wakeup | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/product | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/quirks | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/serial | 1 - .../sys/devices/pci0000:00/0000:00:1d.7/usb5/speed | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/subsystem | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/uevent | 8 - .../devices/pci0000:00/0000:00:1d.7/usb5/urbnum | 1 - .../usb_endpoint/usbdev5.1_ep00/bEndpointAddress | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/bInterval | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/bLength | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/dev | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/device | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/direction | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/interval | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/subsystem | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/type | 1 - .../usb5/usb_endpoint/usbdev5.1_ep00/uevent | 2 - .../usb_endpoint/usbdev5.1_ep00/wMaxPacketSize | 1 - .../devices/pci0000:00/0000:00:1d.7/usb5/version | 1 - .../0000:00:1d.7/usb_host/usb_host5/companion | 0 .../0000:00:1d.7/usb_host/usb_host5/device | 1 - .../0000:00:1d.7/usb_host/usb_host5/power/wakeup | 1 - .../0000:00:1d.7/usb_host/usb_host5/subsystem | 1 - .../0000:00:1d.7/usb_host/usb_host5/uevent | 0 test/sys/devices/pci0000:00/0000:00:1d.7/vendor | 1 - .../0000:00:1e.0/0000:15:00.0/broken_parity_status | 1 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/class | 1 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/config | Bin 256 -> 0 bytes .../pci0000:00/0000:00:1e.0/0000:15:00.0/device | 1 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/driver | 1 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/enable | 1 - .../0000:00:1e.0/0000:15:00.0/firmware_node | 1 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/irq | 1 - .../0000:00:1e.0/0000:15:00.0/local_cpulist | 1 - .../0000:00:1e.0/0000:15:00.0/local_cpus | 1 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/modalias | 1 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus | 1 - .../0000:15:00.0/pci_bus/0000:16/cpuaffinity | 1 - .../0000:15:00.0/pci_bus/0000:16/device | 1 - .../0000:15:00.0/pci_bus/0000:16/power/wakeup | 1 - .../0000:15:00.0/pci_bus/0000:16/subsystem | 1 - .../0000:15:00.0/pci_bus/0000:16/uevent | 0 .../pcmcia_socket0/available_resources_io | 6 - .../pcmcia_socket0/available_resources_mem | 5 - .../pcmcia_socket0/available_resources_setup_done | 1 - .../pcmcia_socket/pcmcia_socket0/card_irq_mask | 1 - .../pcmcia_socket/pcmcia_socket0/card_pm_state | 1 - .../pcmcia_socket/pcmcia_socket0/card_type | 0 .../pcmcia_socket/pcmcia_socket0/card_vcc | 0 .../pcmcia_socket/pcmcia_socket0/card_voltage | 0 .../pcmcia_socket/pcmcia_socket0/card_vpp | 0 .../0000:15:00.0/pcmcia_socket/pcmcia_socket0/cis | 0 .../pcmcia_socket/pcmcia_socket0/device | 1 - .../pcmcia_socket/pcmcia_socket0/power/wakeup | 1 - .../pcmcia_socket/pcmcia_socket0/subsystem | 1 - .../pcmcia_socket/pcmcia_socket0/uevent | 1 - .../0000:00:1e.0/0000:15:00.0/power/wakeup | 1 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/resource | 12 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/resource0 | 0 .../pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem | 1 - .../0000:00:1e.0/0000:15:00.0/subsystem_device | 1 - .../0000:00:1e.0/0000:15:00.0/subsystem_vendor | 1 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/uevent | 6 - .../pci0000:00/0000:00:1e.0/0000:15:00.0/vendor | 1 - .../0000:00:1e.0/0000:15:00.0/yenta_registers | 11 - .../pci0000:00/0000:00:1e.0/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/class | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1e.0/device | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/enable | 1 - .../devices/pci0000:00/0000:00:1e.0/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/irq | 1 - .../devices/pci0000:00/0000:00:1e.0/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1e.0/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus | 1 - .../0000:00:1e.0/pci_bus/0000:15/cpuaffinity | 1 - .../pci0000:00/0000:00:1e.0/pci_bus/0000:15/device | 1 - .../0000:00:1e.0/pci_bus/0000:15/power/wakeup | 1 - .../0000:00:1e.0/pci_bus/0000:15/subsystem | 1 - .../pci0000:00/0000:00:1e.0/pci_bus/0000:15/uevent | 0 .../devices/pci0000:00/0000:00:1e.0/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/resource | 12 - test/sys/devices/pci0000:00/0000:00:1e.0/subsystem | 1 - .../pci0000:00/0000:00:1e.0/subsystem_device | 1 - .../pci0000:00/0000:00:1e.0/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1e.0/uevent | 5 - test/sys/devices/pci0000:00/0000:00:1e.0/vendor | 1 - .../pci0000:00/0000:00:1f.0/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1f.0/class | 1 - test/sys/devices/pci0000:00/0000:00:1f.0/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1f.0/device | 1 - test/sys/devices/pci0000:00/0000:00:1f.0/enable | 1 - .../devices/pci0000:00/0000:00:1f.0/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1f.0/irq | 1 - .../devices/pci0000:00/0000:00:1f.0/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1f.0/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1f.0/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1f.0/msi_bus | 0 .../devices/pci0000:00/0000:00:1f.0/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1f.0/resource | 7 - test/sys/devices/pci0000:00/0000:00:1f.0/subsystem | 1 - .../pci0000:00/0000:00:1f.0/subsystem_device | 1 - .../pci0000:00/0000:00:1f.0/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1f.0/uevent | 5 - test/sys/devices/pci0000:00/0000:00:1f.0/vendor | 1 - .../pci0000:00/0000:00:1f.1/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1f.1/class | 1 - test/sys/devices/pci0000:00/0000:00:1f.1/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1f.1/device | 1 - test/sys/devices/pci0000:00/0000:00:1f.1/driver | 1 - test/sys/devices/pci0000:00/0000:00:1f.1/enable | 1 - .../devices/pci0000:00/0000:00:1f.1/firmware_node | 1 - .../pci0000:00/0000:00:1f.1/host4/power/wakeup | 1 - .../0000:00:1f.1/host4/scsi_host/host4/active_mode | 1 - .../0000:00:1f.1/host4/scsi_host/host4/can_queue | 1 - .../0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun | 1 - .../0000:00:1f.1/host4/scsi_host/host4/device | 1 - .../0000:00:1f.1/host4/scsi_host/host4/host_busy | 1 - .../host4/scsi_host/host4/power/wakeup | 1 - .../0000:00:1f.1/host4/scsi_host/host4/proc_name | 1 - .../host4/scsi_host/host4/prot_capabilities | 1 - .../host4/scsi_host/host4/prot_guard_type | 1 - .../host4/scsi_host/host4/sg_tablesize | 1 - .../0000:00:1f.1/host4/scsi_host/host4/state | 1 - .../0000:00:1f.1/host4/scsi_host/host4/subsystem | 1 - .../host4/scsi_host/host4/supported_mode | 1 - .../0000:00:1f.1/host4/scsi_host/host4/uevent | 0 .../host4/scsi_host/host4/unchecked_isa_dma | 1 - .../0000:00:1f.1/host4/scsi_host/host4/unique_id | 1 - .../pci0000:00/0000:00:1f.1/host4/subsystem | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/bdi | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/capability | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/dev | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/device | 1 - .../target4:0:0/4:0:0:0/block/sr0/make-it-fail | 1 - .../target4:0:0/4:0:0:0/block/sr0/power/wakeup | 1 - .../4:0:0:0/block/sr0/queue/hw_sector_size | 1 - .../4:0:0:0/block/sr0/queue/iosched/back_seek_max | 1 - .../block/sr0/queue/iosched/back_seek_penalty | 1 - .../block/sr0/queue/iosched/fifo_expire_async | 1 - .../block/sr0/queue/iosched/fifo_expire_sync | 1 - .../4:0:0:0/block/sr0/queue/iosched/quantum | 1 - .../4:0:0:0/block/sr0/queue/iosched/slice_async | 1 - .../4:0:0:0/block/sr0/queue/iosched/slice_async_rq | 1 - .../4:0:0:0/block/sr0/queue/iosched/slice_idle | 1 - .../4:0:0:0/block/sr0/queue/iosched/slice_sync | 1 - .../4:0:0:0/block/sr0/queue/max_hw_sectors_kb | 1 - .../4:0:0:0/block/sr0/queue/max_sectors_kb | 1 - .../target4:0:0/4:0:0:0/block/sr0/queue/nomerges | 1 - .../4:0:0:0/block/sr0/queue/nr_requests | 1 - .../4:0:0:0/block/sr0/queue/read_ahead_kb | 1 - .../target4:0:0/4:0:0:0/block/sr0/queue/scheduler | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/range | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/removable | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/ro | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/size | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/stat | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/subsystem | 1 - .../host4/target4:0:0/4:0:0:0/block/sr0/uevent | 3 - .../host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev | 1 - .../host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device | 1 - .../target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup | 1 - .../target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem | 1 - .../host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent | 2 - .../host4/target4:0:0/4:0:0:0/device_blocked | 1 - .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver | 1 - .../host4/target4:0:0/4:0:0:0/evt_media_change | 1 - .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic | 1 - .../host4/target4:0:0/4:0:0:0/iocounterbits | 1 - .../host4/target4:0:0/4:0:0:0/iodone_cnt | 1 - .../host4/target4:0:0/4:0:0:0/ioerr_cnt | 1 - .../host4/target4:0:0/4:0:0:0/iorequest_cnt | 1 - .../host4/target4:0:0/4:0:0:0/modalias | 1 - .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/model | 1 - .../host4/target4:0:0/4:0:0:0/power/wakeup | 1 - .../host4/target4:0:0/4:0:0:0/queue_depth | 1 - .../host4/target4:0:0/4:0:0:0/queue_type | 1 - .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev | 1 - .../target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device | 1 - .../4:0:0:0/scsi_device/4:0:0:0/power/wakeup | 1 - .../4:0:0:0/scsi_device/4:0:0:0/subsystem | 1 - .../target4:0:0/4:0:0:0/scsi_device/4:0:0:0/uevent | 0 .../host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev | 1 - .../target4:0:0/4:0:0:0/scsi_generic/sg1/device | 1 - .../4:0:0:0/scsi_generic/sg1/power/wakeup | 1 - .../target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem | 1 - .../target4:0:0/4:0:0:0/scsi_generic/sg1/uevent | 2 - .../host4/target4:0:0/4:0:0:0/scsi_level | 1 - .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/state | 1 - .../host4/target4:0:0/4:0:0:0/subsystem | 1 - .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout | 1 - .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/type | 1 - .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent | 3 - .../0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor | 1 - .../0000:00:1f.1/host4/target4:0:0/power/wakeup | 1 - .../0000:00:1f.1/host4/target4:0:0/subsystem | 1 - .../0000:00:1f.1/host4/target4:0:0/uevent | 1 - .../devices/pci0000:00/0000:00:1f.1/host4/uevent | 1 - .../pci0000:00/0000:00:1f.1/host5/power/wakeup | 1 - .../0000:00:1f.1/host5/scsi_host/host5/active_mode | 1 - .../0000:00:1f.1/host5/scsi_host/host5/can_queue | 1 - .../0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun | 1 - .../0000:00:1f.1/host5/scsi_host/host5/device | 1 - .../0000:00:1f.1/host5/scsi_host/host5/host_busy | 1 - .../host5/scsi_host/host5/power/wakeup | 1 - .../0000:00:1f.1/host5/scsi_host/host5/proc_name | 1 - .../host5/scsi_host/host5/prot_capabilities | 1 - .../host5/scsi_host/host5/prot_guard_type | 1 - .../host5/scsi_host/host5/sg_tablesize | 1 - .../0000:00:1f.1/host5/scsi_host/host5/state | 1 - .../0000:00:1f.1/host5/scsi_host/host5/subsystem | 1 - .../host5/scsi_host/host5/supported_mode | 1 - .../0000:00:1f.1/host5/scsi_host/host5/uevent | 0 .../host5/scsi_host/host5/unchecked_isa_dma | 1 - .../0000:00:1f.1/host5/scsi_host/host5/unique_id | 1 - .../pci0000:00/0000:00:1f.1/host5/subsystem | 1 - .../devices/pci0000:00/0000:00:1f.1/host5/uevent | 1 - test/sys/devices/pci0000:00/0000:00:1f.1/irq | 1 - .../devices/pci0000:00/0000:00:1f.1/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1f.1/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1f.1/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1f.1/msi_bus | 0 .../devices/pci0000:00/0000:00:1f.1/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1f.1/resource | 7 - test/sys/devices/pci0000:00/0000:00:1f.1/resource0 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/resource1 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/resource2 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/resource3 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1f.1/subsystem | 1 - .../pci0000:00/0000:00:1f.1/subsystem_device | 1 - .../pci0000:00/0000:00:1f.1/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1f.1/uevent | 6 - test/sys/devices/pci0000:00/0000:00:1f.1/vendor | 1 - .../pci0000:00/0000:00:1f.2/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1f.2/class | 1 - test/sys/devices/pci0000:00/0000:00:1f.2/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1f.2/device | 1 - test/sys/devices/pci0000:00/0000:00:1f.2/driver | 1 - test/sys/devices/pci0000:00/0000:00:1f.2/enable | 1 - .../devices/pci0000:00/0000:00:1f.2/firmware_node | 1 - .../pci0000:00/0000:00:1f.2/host0/power/wakeup | 1 - .../0000:00:1f.2/host0/scsi_host/host0/active_mode | 1 - .../0000:00:1f.2/host0/scsi_host/host0/can_queue | 1 - .../0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun | 1 - .../0000:00:1f.2/host0/scsi_host/host0/device | 1 - .../0000:00:1f.2/host0/scsi_host/host0/em_message | 0 .../host0/scsi_host/host0/em_message_type | 1 - .../0000:00:1f.2/host0/scsi_host/host0/host_busy | 1 - .../scsi_host/host0/link_power_management_policy | 1 - .../host0/scsi_host/host0/power/wakeup | 1 - .../0000:00:1f.2/host0/scsi_host/host0/proc_name | 1 - .../host0/scsi_host/host0/prot_capabilities | 1 - .../host0/scsi_host/host0/prot_guard_type | 1 - .../host0/scsi_host/host0/sg_tablesize | 1 - .../0000:00:1f.2/host0/scsi_host/host0/state | 1 - .../0000:00:1f.2/host0/scsi_host/host0/subsystem | 1 - .../host0/scsi_host/host0/supported_mode | 1 - .../0000:00:1f.2/host0/scsi_host/host0/uevent | 0 .../host0/scsi_host/host0/unchecked_isa_dma | 1 - .../0000:00:1f.2/host0/scsi_host/host0/unique_id | 1 - .../pci0000:00/0000:00:1f.2/host0/subsystem | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/bdi | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/capability | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/dev | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/device | 1 - .../target0:0:0/0:0:0:0/block/sda/make-it-fail | 1 - .../target0:0:0/0:0:0:0/block/sda/power/wakeup | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/queue/bsg | 1 - .../0:0:0:0/block/sda/queue/hw_sector_size | 1 - .../0:0:0:0/block/sda/queue/iosched/back_seek_max | 1 - .../block/sda/queue/iosched/back_seek_penalty | 1 - .../block/sda/queue/iosched/fifo_expire_async | 1 - .../block/sda/queue/iosched/fifo_expire_sync | 1 - .../0:0:0:0/block/sda/queue/iosched/quantum | 1 - .../0:0:0:0/block/sda/queue/iosched/slice_async | 1 - .../0:0:0:0/block/sda/queue/iosched/slice_async_rq | 1 - .../0:0:0:0/block/sda/queue/iosched/slice_idle | 1 - .../0:0:0:0/block/sda/queue/iosched/slice_sync | 1 - .../0:0:0:0/block/sda/queue/max_hw_sectors_kb | 1 - .../0:0:0:0/block/sda/queue/max_sectors_kb | 1 - .../target0:0:0/0:0:0:0/block/sda/queue/nomerges | 1 - .../0:0:0:0/block/sda/queue/nr_requests | 1 - .../0:0:0:0/block/sda/queue/read_ahead_kb | 1 - .../target0:0:0/0:0:0:0/block/sda/queue/scheduler | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/range | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/removable | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/ro | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda1/dev | 1 - .../0:0:0:0/block/sda/sda1/make-it-fail | 1 - .../0:0:0:0/block/sda/sda1/power/wakeup | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda1/size | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda1/start | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda1/stat | 1 - .../target0:0:0/0:0:0:0/block/sda/sda1/subsystem | 1 - .../target0:0:0/0:0:0:0/block/sda/sda1/uevent | 4 - .../host0/target0:0:0/0:0:0:0/block/sda/sda10/dev | 1 - .../0:0:0:0/block/sda/sda10/make-it-fail | 1 - .../0:0:0:0/block/sda/sda10/power/wakeup | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda10/size | 1 - .../target0:0:0/0:0:0:0/block/sda/sda10/start | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda10/stat | 1 - .../target0:0:0/0:0:0:0/block/sda/sda10/subsystem | 1 - .../target0:0:0/0:0:0:0/block/sda/sda10/uevent | 3 - .../host0/target0:0:0/0:0:0:0/block/sda/sda5/dev | 1 - .../0:0:0:0/block/sda/sda5/make-it-fail | 1 - .../0:0:0:0/block/sda/sda5/power/wakeup | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda5/size | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda5/start | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda5/stat | 1 - .../target0:0:0/0:0:0:0/block/sda/sda5/subsystem | 1 - .../target0:0:0/0:0:0:0/block/sda/sda5/uevent | 4 - .../host0/target0:0:0/0:0:0:0/block/sda/sda6/dev | 1 - .../0:0:0:0/block/sda/sda6/make-it-fail | 1 - .../0:0:0:0/block/sda/sda6/power/wakeup | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda6/size | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda6/start | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda6/stat | 1 - .../target0:0:0/0:0:0:0/block/sda/sda6/subsystem | 1 - .../target0:0:0/0:0:0:0/block/sda/sda6/uevent | 3 - .../host0/target0:0:0/0:0:0:0/block/sda/sda7/dev | 1 - .../0:0:0:0/block/sda/sda7/make-it-fail | 1 - .../0:0:0:0/block/sda/sda7/power/wakeup | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda7/size | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda7/start | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda7/stat | 1 - .../target0:0:0/0:0:0:0/block/sda/sda7/subsystem | 1 - .../target0:0:0/0:0:0:0/block/sda/sda7/uevent | 3 - .../host0/target0:0:0/0:0:0:0/block/sda/sda8/dev | 1 - .../0:0:0:0/block/sda/sda8/make-it-fail | 1 - .../0:0:0:0/block/sda/sda8/power/wakeup | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda8/size | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda8/start | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda8/stat | 1 - .../target0:0:0/0:0:0:0/block/sda/sda8/subsystem | 1 - .../target0:0:0/0:0:0:0/block/sda/sda8/uevent | 3 - .../host0/target0:0:0/0:0:0:0/block/sda/sda9/dev | 1 - .../target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 | 1 - .../0:0:0:0/block/sda/sda9/make-it-fail | 1 - .../0:0:0:0/block/sda/sda9/power/wakeup | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda9/size | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda9/start | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/sda9/stat | 1 - .../target0:0:0/0:0:0:0/block/sda/sda9/subsystem | 1 - .../target0:0:0/0:0:0:0/block/sda/sda9/uevent | 3 - .../host0/target0:0:0/0:0:0:0/block/sda/size | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/stat | 1 - .../host0/target0:0:0/0:0:0:0/block/sda/subsystem | 1 - .../target0:0:0/0:0:0:0/block/sda/test:colon+plus | 1 - .../target0:0:0/0:0:0:0/block/sda/test_empty_file | 0 .../host0/target0:0:0/0:0:0:0/block/sda/uevent | 4 - .../host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev | 1 - .../host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device | 1 - .../target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup | 1 - .../target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem | 1 - .../host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent | 2 - .../host0/target0:0:0/0:0:0:0/device_blocked | 1 - .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver | 1 - .../host0/target0:0:0/0:0:0:0/evt_media_change | 1 - .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic | 1 - .../host0/target0:0:0/0:0:0:0/iocounterbits | 1 - .../host0/target0:0:0/0:0:0:0/iodone_cnt | 1 - .../host0/target0:0:0/0:0:0:0/ioerr_cnt | 1 - .../host0/target0:0:0/0:0:0:0/iorequest_cnt | 1 - .../host0/target0:0:0/0:0:0:0/modalias | 1 - .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/model | 1 - .../host0/target0:0:0/0:0:0:0/power/wakeup | 1 - .../host0/target0:0:0/0:0:0:0/queue_depth | 1 - .../host0/target0:0:0/0:0:0:0/queue_type | 1 - .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev | 1 - .../target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device | 1 - .../0:0:0:0/scsi_device/0:0:0:0/power/wakeup | 1 - .../0:0:0:0/scsi_device/0:0:0:0/subsystem | 1 - .../target0:0:0/0:0:0:0/scsi_device/0:0:0:0/uevent | 0 .../target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA | 1 - .../0:0:0:0/scsi_disk/0:0:0:0/allow_restart | 1 - .../0:0:0:0/scsi_disk/0:0:0:0/app_tag_own | 1 - .../0:0:0:0/scsi_disk/0:0:0:0/cache_type | 1 - .../target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device | 1 - .../0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop | 1 - .../0:0:0:0/scsi_disk/0:0:0:0/power/wakeup | 1 - .../0:0:0:0/scsi_disk/0:0:0:0/protection_type | 1 - .../0:0:0:0/scsi_disk/0:0:0:0/subsystem | 1 - .../target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/uevent | 0 .../host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev | 1 - .../target0:0:0/0:0:0:0/scsi_generic/sg0/device | 1 - .../0:0:0:0/scsi_generic/sg0/power/wakeup | 1 - .../target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem | 1 - .../target0:0:0/0:0:0:0/scsi_generic/sg0/uevent | 2 - .../host0/target0:0:0/0:0:0:0/scsi_level | 1 - .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/state | 1 - .../host0/target0:0:0/0:0:0:0/subsystem | 1 - .../host0/target0:0:0/0:0:0:0/sw_activity | 0 .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout | 1 - .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/type | 1 - .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent | 3 - .../0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor | 1 - .../host0/target0:0:0/0:0:0:0/whitespace_test | 1 - .../0000:00:1f.2/host0/target0:0:0/power/wakeup | 1 - .../0000:00:1f.2/host0/target0:0:0/subsystem | 1 - .../0000:00:1f.2/host0/target0:0:0/uevent | 1 - .../devices/pci0000:00/0000:00:1f.2/host0/uevent | 1 - .../pci0000:00/0000:00:1f.2/host1/power/wakeup | 1 - .../0000:00:1f.2/host1/scsi_host/host1/active_mode | 1 - .../0000:00:1f.2/host1/scsi_host/host1/can_queue | 1 - .../0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun | 1 - .../0000:00:1f.2/host1/scsi_host/host1/device | 1 - .../0000:00:1f.2/host1/scsi_host/host1/em_message | 0 .../host1/scsi_host/host1/em_message_type | 1 - .../0000:00:1f.2/host1/scsi_host/host1/host_busy | 1 - .../scsi_host/host1/link_power_management_policy | 1 - .../host1/scsi_host/host1/power/wakeup | 1 - .../0000:00:1f.2/host1/scsi_host/host1/proc_name | 1 - .../host1/scsi_host/host1/prot_capabilities | 1 - .../host1/scsi_host/host1/prot_guard_type | 1 - .../host1/scsi_host/host1/sg_tablesize | 1 - .../0000:00:1f.2/host1/scsi_host/host1/state | 1 - .../0000:00:1f.2/host1/scsi_host/host1/subsystem | 1 - .../host1/scsi_host/host1/supported_mode | 1 - .../0000:00:1f.2/host1/scsi_host/host1/uevent | 0 .../host1/scsi_host/host1/unchecked_isa_dma | 1 - .../0000:00:1f.2/host1/scsi_host/host1/unique_id | 1 - .../pci0000:00/0000:00:1f.2/host1/subsystem | 1 - .../devices/pci0000:00/0000:00:1f.2/host1/uevent | 1 - .../pci0000:00/0000:00:1f.2/host2/power/wakeup | 1 - .../0000:00:1f.2/host2/scsi_host/host2/active_mode | 1 - .../0000:00:1f.2/host2/scsi_host/host2/can_queue | 1 - .../0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun | 1 - .../0000:00:1f.2/host2/scsi_host/host2/device | 1 - .../0000:00:1f.2/host2/scsi_host/host2/em_message | 0 .../host2/scsi_host/host2/em_message_type | 1 - .../0000:00:1f.2/host2/scsi_host/host2/host_busy | 1 - .../scsi_host/host2/link_power_management_policy | 1 - .../host2/scsi_host/host2/power/wakeup | 1 - .../0000:00:1f.2/host2/scsi_host/host2/proc_name | 1 - .../host2/scsi_host/host2/prot_capabilities | 1 - .../host2/scsi_host/host2/prot_guard_type | 1 - .../host2/scsi_host/host2/sg_tablesize | 1 - .../0000:00:1f.2/host2/scsi_host/host2/state | 1 - .../0000:00:1f.2/host2/scsi_host/host2/subsystem | 1 - .../host2/scsi_host/host2/supported_mode | 1 - .../0000:00:1f.2/host2/scsi_host/host2/uevent | 0 .../host2/scsi_host/host2/unchecked_isa_dma | 1 - .../0000:00:1f.2/host2/scsi_host/host2/unique_id | 1 - .../pci0000:00/0000:00:1f.2/host2/subsystem | 1 - .../devices/pci0000:00/0000:00:1f.2/host2/uevent | 1 - .../pci0000:00/0000:00:1f.2/host3/power/wakeup | 1 - .../0000:00:1f.2/host3/scsi_host/host3/active_mode | 1 - .../0000:00:1f.2/host3/scsi_host/host3/can_queue | 1 - .../0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun | 1 - .../0000:00:1f.2/host3/scsi_host/host3/device | 1 - .../0000:00:1f.2/host3/scsi_host/host3/em_message | 0 .../host3/scsi_host/host3/em_message_type | 1 - .../0000:00:1f.2/host3/scsi_host/host3/host_busy | 1 - .../scsi_host/host3/link_power_management_policy | 1 - .../host3/scsi_host/host3/power/wakeup | 1 - .../0000:00:1f.2/host3/scsi_host/host3/proc_name | 1 - .../host3/scsi_host/host3/prot_capabilities | 1 - .../host3/scsi_host/host3/prot_guard_type | 1 - .../host3/scsi_host/host3/sg_tablesize | 1 - .../0000:00:1f.2/host3/scsi_host/host3/state | 1 - .../0000:00:1f.2/host3/scsi_host/host3/subsystem | 1 - .../host3/scsi_host/host3/supported_mode | 1 - .../0000:00:1f.2/host3/scsi_host/host3/uevent | 0 .../host3/scsi_host/host3/unchecked_isa_dma | 1 - .../0000:00:1f.2/host3/scsi_host/host3/unique_id | 1 - .../pci0000:00/0000:00:1f.2/host3/subsystem | 1 - .../devices/pci0000:00/0000:00:1f.2/host3/uevent | 1 - test/sys/devices/pci0000:00/0000:00:1f.2/irq | 1 - .../devices/pci0000:00/0000:00:1f.2/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1f.2/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1f.2/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1f.2/msi_bus | 0 .../devices/pci0000:00/0000:00:1f.2/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1f.2/resource | 7 - test/sys/devices/pci0000:00/0000:00:1f.2/resource0 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource1 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource2 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource3 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/resource5 | 0 test/sys/devices/pci0000:00/0000:00:1f.2/subsystem | 1 - .../pci0000:00/0000:00:1f.2/subsystem_device | 1 - .../pci0000:00/0000:00:1f.2/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1f.2/uevent | 6 - test/sys/devices/pci0000:00/0000:00:1f.2/vendor | 1 - .../pci0000:00/0000:00:1f.3/broken_parity_status | 1 - test/sys/devices/pci0000:00/0000:00:1f.3/class | 1 - test/sys/devices/pci0000:00/0000:00:1f.3/config | Bin 256 -> 0 bytes test/sys/devices/pci0000:00/0000:00:1f.3/device | 1 - test/sys/devices/pci0000:00/0000:00:1f.3/enable | 1 - .../devices/pci0000:00/0000:00:1f.3/firmware_node | 1 - test/sys/devices/pci0000:00/0000:00:1f.3/irq | 1 - .../devices/pci0000:00/0000:00:1f.3/local_cpulist | 1 - .../sys/devices/pci0000:00/0000:00:1f.3/local_cpus | 1 - test/sys/devices/pci0000:00/0000:00:1f.3/modalias | 1 - test/sys/devices/pci0000:00/0000:00:1f.3/msi_bus | 0 .../devices/pci0000:00/0000:00:1f.3/power/wakeup | 1 - test/sys/devices/pci0000:00/0000:00:1f.3/resource | 7 - test/sys/devices/pci0000:00/0000:00:1f.3/resource4 | 0 test/sys/devices/pci0000:00/0000:00:1f.3/subsystem | 1 - .../pci0000:00/0000:00:1f.3/subsystem_device | 1 - .../pci0000:00/0000:00:1f.3/subsystem_vendor | 1 - test/sys/devices/pci0000:00/0000:00:1f.3/uevent | 5 - test/sys/devices/pci0000:00/0000:00:1f.3/vendor | 1 - test/sys/devices/pci0000:00/firmware_node | 1 - .../devices/pci0000:00/pci_bus/0000:00/cpuaffinity | 1 - test/sys/devices/pci0000:00/pci_bus/0000:00/device | 1 - .../pci0000:00/pci_bus/0000:00/power/wakeup | 1 - .../devices/pci0000:00/pci_bus/0000:00/subsystem | 1 - test/sys/devices/pci0000:00/pci_bus/0000:00/uevent | 0 test/sys/devices/pci0000:00/power/wakeup | 1 - test/sys/devices/pci0000:00/uevent | 0 test/sys/devices/platform/dock.0/docked | 1 - test/sys/devices/platform/dock.0/flags | 1 - test/sys/devices/platform/dock.0/modalias | 1 - test/sys/devices/platform/dock.0/power/wakeup | 1 - test/sys/devices/platform/dock.0/subsystem | 1 - test/sys/devices/platform/dock.0/uevent | 1 - test/sys/devices/platform/dock.0/uid | 1 - test/sys/devices/platform/i8042/driver | 1 - test/sys/devices/platform/i8042/modalias | 1 - test/sys/devices/platform/i8042/power/wakeup | 1 - test/sys/devices/platform/i8042/serio0/bind_mode | 1 - test/sys/devices/platform/i8042/serio0/description | 1 - test/sys/devices/platform/i8042/serio0/driver | 1 - test/sys/devices/platform/i8042/serio0/err_count | 1 - test/sys/devices/platform/i8042/serio0/extra | 1 - test/sys/devices/platform/i8042/serio0/id/extra | 1 - test/sys/devices/platform/i8042/serio0/id/id | 1 - test/sys/devices/platform/i8042/serio0/id/proto | 1 - test/sys/devices/platform/i8042/serio0/id/type | 1 - .../i8042/serio0/input/input0/capabilities/abs | 1 - .../i8042/serio0/input/input0/capabilities/ev | 1 - .../i8042/serio0/input/input0/capabilities/ff | 1 - .../i8042/serio0/input/input0/capabilities/key | 1 - .../i8042/serio0/input/input0/capabilities/led | 1 - .../i8042/serio0/input/input0/capabilities/msc | 1 - .../i8042/serio0/input/input0/capabilities/rel | 1 - .../i8042/serio0/input/input0/capabilities/snd | 1 - .../i8042/serio0/input/input0/capabilities/sw | 1 - .../platform/i8042/serio0/input/input0/device | 1 - .../platform/i8042/serio0/input/input0/event0/dev | 1 - .../i8042/serio0/input/input0/event0/device | 1 - .../i8042/serio0/input/input0/event0/power/wakeup | 1 - .../i8042/serio0/input/input0/event0/subsystem | 1 - .../i8042/serio0/input/input0/event0/uevent | 2 - .../platform/i8042/serio0/input/input0/id/bustype | 1 - .../platform/i8042/serio0/input/input0/id/product | 1 - .../platform/i8042/serio0/input/input0/id/vendor | 1 - .../platform/i8042/serio0/input/input0/id/version | 1 - .../platform/i8042/serio0/input/input0/modalias | 1 - .../platform/i8042/serio0/input/input0/name | 1 - .../platform/i8042/serio0/input/input0/phys | 1 - .../i8042/serio0/input/input0/power/wakeup | 1 - .../platform/i8042/serio0/input/input0/subsystem | 1 - .../platform/i8042/serio0/input/input0/uevent | 8 - .../platform/i8042/serio0/input/input0/uniq | 1 - test/sys/devices/platform/i8042/serio0/modalias | 1 - .../sys/devices/platform/i8042/serio0/power/wakeup | 1 - test/sys/devices/platform/i8042/serio0/scroll | 1 - test/sys/devices/platform/i8042/serio0/set | 1 - test/sys/devices/platform/i8042/serio0/softraw | 1 - test/sys/devices/platform/i8042/serio0/softrepeat | 1 - test/sys/devices/platform/i8042/serio0/subsystem | 1 - test/sys/devices/platform/i8042/serio0/uevent | 6 - test/sys/devices/platform/i8042/serio1/bind_mode | 1 - test/sys/devices/platform/i8042/serio1/description | 1 - test/sys/devices/platform/i8042/serio1/draghys | 1 - test/sys/devices/platform/i8042/serio1/driver | 1 - test/sys/devices/platform/i8042/serio1/ext_dev | 1 - test/sys/devices/platform/i8042/serio1/id/extra | 1 - test/sys/devices/platform/i8042/serio1/id/id | 1 - test/sys/devices/platform/i8042/serio1/id/proto | 1 - test/sys/devices/platform/i8042/serio1/id/type | 1 - test/sys/devices/platform/i8042/serio1/inertia | 1 - .../i8042/serio1/input/input1/capabilities/abs | 1 - .../i8042/serio1/input/input1/capabilities/ev | 1 - .../i8042/serio1/input/input1/capabilities/ff | 1 - .../i8042/serio1/input/input1/capabilities/key | 1 - .../i8042/serio1/input/input1/capabilities/led | 1 - .../i8042/serio1/input/input1/capabilities/msc | 1 - .../i8042/serio1/input/input1/capabilities/rel | 1 - .../i8042/serio1/input/input1/capabilities/snd | 1 - .../i8042/serio1/input/input1/capabilities/sw | 1 - .../platform/i8042/serio1/input/input1/device | 1 - .../platform/i8042/serio1/input/input1/event1/dev | 1 - .../i8042/serio1/input/input1/event1/device | 1 - .../i8042/serio1/input/input1/event1/power/wakeup | 1 - .../i8042/serio1/input/input1/event1/subsystem | 1 - .../i8042/serio1/input/input1/event1/uevent | 2 - .../platform/i8042/serio1/input/input1/id/bustype | 1 - .../platform/i8042/serio1/input/input1/id/product | 1 - .../platform/i8042/serio1/input/input1/id/vendor | 1 - .../platform/i8042/serio1/input/input1/id/version | 1 - .../platform/i8042/serio1/input/input1/modalias | 1 - .../platform/i8042/serio1/input/input1/mouse0/dev | 1 - .../i8042/serio1/input/input1/mouse0/device | 1 - .../i8042/serio1/input/input1/mouse0/power/wakeup | 1 - .../i8042/serio1/input/input1/mouse0/subsystem | 1 - .../i8042/serio1/input/input1/mouse0/uevent | 2 - .../platform/i8042/serio1/input/input1/name | 1 - .../platform/i8042/serio1/input/input1/phys | 1 - .../i8042/serio1/input/input1/power/wakeup | 1 - .../platform/i8042/serio1/input/input1/subsystem | 1 - .../platform/i8042/serio1/input/input1/uevent | 7 - .../platform/i8042/serio1/input/input1/uniq | 1 - test/sys/devices/platform/i8042/serio1/jenks | 1 - test/sys/devices/platform/i8042/serio1/mindrag | 1 - test/sys/devices/platform/i8042/serio1/modalias | 1 - .../sys/devices/platform/i8042/serio1/power/wakeup | 1 - .../devices/platform/i8042/serio1/press_to_select | 1 - test/sys/devices/platform/i8042/serio1/protocol | 1 - test/sys/devices/platform/i8042/serio1/rate | 1 - test/sys/devices/platform/i8042/serio1/reach | 1 - test/sys/devices/platform/i8042/serio1/resetafter | 1 - test/sys/devices/platform/i8042/serio1/resolution | 1 - test/sys/devices/platform/i8042/serio1/resync_time | 1 - test/sys/devices/platform/i8042/serio1/sensitivity | 1 - test/sys/devices/platform/i8042/serio1/skipback | 1 - test/sys/devices/platform/i8042/serio1/speed | 1 - test/sys/devices/platform/i8042/serio1/subsystem | 1 - test/sys/devices/platform/i8042/serio1/thresh | 1 - test/sys/devices/platform/i8042/serio1/uevent | 6 - test/sys/devices/platform/i8042/serio1/upthresh | 1 - test/sys/devices/platform/i8042/serio1/ztime | 1 - test/sys/devices/platform/i8042/subsystem | 1 - test/sys/devices/platform/i8042/uevent | 2 - test/sys/devices/platform/microcode/modalias | 1 - test/sys/devices/platform/microcode/power/wakeup | 1 - test/sys/devices/platform/microcode/subsystem | 1 - test/sys/devices/platform/microcode/uevent | 1 - test/sys/devices/platform/pcspkr/driver | 1 - .../platform/pcspkr/input/input2/capabilities/abs | 1 - .../platform/pcspkr/input/input2/capabilities/ev | 1 - .../platform/pcspkr/input/input2/capabilities/ff | 1 - .../platform/pcspkr/input/input2/capabilities/key | 1 - .../platform/pcspkr/input/input2/capabilities/led | 1 - .../platform/pcspkr/input/input2/capabilities/msc | 1 - .../platform/pcspkr/input/input2/capabilities/rel | 1 - .../platform/pcspkr/input/input2/capabilities/snd | 1 - .../platform/pcspkr/input/input2/capabilities/sw | 1 - .../devices/platform/pcspkr/input/input2/device | 1 - .../platform/pcspkr/input/input2/event2/dev | 1 - .../platform/pcspkr/input/input2/event2/device | 1 - .../pcspkr/input/input2/event2/power/wakeup | 1 - .../platform/pcspkr/input/input2/event2/subsystem | 1 - .../platform/pcspkr/input/input2/event2/uevent | 2 - .../platform/pcspkr/input/input2/id/bustype | 1 - .../platform/pcspkr/input/input2/id/product | 1 - .../devices/platform/pcspkr/input/input2/id/vendor | 1 - .../platform/pcspkr/input/input2/id/version | 1 - .../devices/platform/pcspkr/input/input2/modalias | 1 - test/sys/devices/platform/pcspkr/input/input2/name | 1 - test/sys/devices/platform/pcspkr/input/input2/phys | 1 - .../platform/pcspkr/input/input2/power/wakeup | 1 - .../devices/platform/pcspkr/input/input2/subsystem | 1 - .../devices/platform/pcspkr/input/input2/uevent | 6 - test/sys/devices/platform/pcspkr/input/input2/uniq | 1 - test/sys/devices/platform/pcspkr/modalias | 1 - test/sys/devices/platform/pcspkr/power/wakeup | 1 - test/sys/devices/platform/pcspkr/subsystem | 1 - test/sys/devices/platform/pcspkr/uevent | 2 - test/sys/devices/platform/power/wakeup | 1 - test/sys/devices/platform/serial8250/driver | 1 - test/sys/devices/platform/serial8250/modalias | 1 - test/sys/devices/platform/serial8250/power/wakeup | 1 - test/sys/devices/platform/serial8250/subsystem | 1 - test/sys/devices/platform/serial8250/tty/ttyS0/dev | 1 - .../devices/platform/serial8250/tty/ttyS0/device | 1 - .../platform/serial8250/tty/ttyS0/power/wakeup | 1 - .../platform/serial8250/tty/ttyS0/subsystem | 1 - .../devices/platform/serial8250/tty/ttyS0/uevent | 2 - test/sys/devices/platform/serial8250/tty/ttyS1/dev | 1 - .../devices/platform/serial8250/tty/ttyS1/device | 1 - .../platform/serial8250/tty/ttyS1/power/wakeup | 1 - .../platform/serial8250/tty/ttyS1/subsystem | 1 - .../devices/platform/serial8250/tty/ttyS1/uevent | 2 - test/sys/devices/platform/serial8250/tty/ttyS2/dev | 1 - .../devices/platform/serial8250/tty/ttyS2/device | 1 - .../platform/serial8250/tty/ttyS2/power/wakeup | 1 - .../platform/serial8250/tty/ttyS2/subsystem | 1 - .../devices/platform/serial8250/tty/ttyS2/uevent | 2 - test/sys/devices/platform/serial8250/tty/ttyS3/dev | 1 - .../devices/platform/serial8250/tty/ttyS3/device | 1 - .../platform/serial8250/tty/ttyS3/power/wakeup | 1 - .../platform/serial8250/tty/ttyS3/subsystem | 1 - .../devices/platform/serial8250/tty/ttyS3/uevent | 2 - test/sys/devices/platform/serial8250/uevent | 2 - .../platform/thinkpad_acpi/bluetooth_enable | 1 - test/sys/devices/platform/thinkpad_acpi/driver | 1 - .../devices/platform/thinkpad_acpi/hotkey_all_mask | 1 - .../platform/thinkpad_acpi/hotkey_bios_enabled | 1 - .../platform/thinkpad_acpi/hotkey_bios_mask | 1 - .../devices/platform/thinkpad_acpi/hotkey_enable | 1 - .../sys/devices/platform/thinkpad_acpi/hotkey_mask | 1 - .../platform/thinkpad_acpi/hotkey_poll_freq | 1 - .../devices/platform/thinkpad_acpi/hotkey_radio_sw | 1 - .../platform/thinkpad_acpi/hotkey_recommended_mask | 1 - .../platform/thinkpad_acpi/hotkey_report_mode | 1 - .../platform/thinkpad_acpi/hotkey_source_mask | 1 - .../leds/tpacpi::bay_active/brightness | Bin 3 -> 0 bytes .../thinkpad_acpi/leds/tpacpi::bay_active/device | 1 - .../leds/tpacpi::bay_active/power/wakeup | 1 - .../leds/tpacpi::bay_active/subsystem | 1 - .../thinkpad_acpi/leds/tpacpi::bay_active/trigger | 1 - .../thinkpad_acpi/leds/tpacpi::bay_active/uevent | 0 .../leds/tpacpi::dock_active/brightness | Bin 3 -> 0 bytes .../thinkpad_acpi/leds/tpacpi::dock_active/device | 1 - .../leds/tpacpi::dock_active/power/wakeup | 1 - .../leds/tpacpi::dock_active/subsystem | 1 - .../thinkpad_acpi/leds/tpacpi::dock_active/trigger | 1 - .../thinkpad_acpi/leds/tpacpi::dock_active/uevent | 0 .../leds/tpacpi::dock_batt/brightness | Bin 3 -> 0 bytes .../thinkpad_acpi/leds/tpacpi::dock_batt/device | 1 - .../leds/tpacpi::dock_batt/power/wakeup | 1 - .../thinkpad_acpi/leds/tpacpi::dock_batt/subsystem | 1 - .../thinkpad_acpi/leds/tpacpi::dock_batt/trigger | 1 - .../thinkpad_acpi/leds/tpacpi::dock_batt/uevent | 0 .../thinkpad_acpi/leds/tpacpi::power/brightness | Bin 3 -> 0 bytes .../thinkpad_acpi/leds/tpacpi::power/device | 1 - .../thinkpad_acpi/leds/tpacpi::power/power/wakeup | 1 - .../thinkpad_acpi/leds/tpacpi::power/subsystem | 1 - .../thinkpad_acpi/leds/tpacpi::power/trigger | 1 - .../thinkpad_acpi/leds/tpacpi::power/uevent | 0 .../thinkpad_acpi/leds/tpacpi::standby/brightness | Bin 3 -> 0 bytes .../thinkpad_acpi/leds/tpacpi::standby/device | 1 - .../leds/tpacpi::standby/power/wakeup | 1 - .../thinkpad_acpi/leds/tpacpi::standby/subsystem | 1 - .../thinkpad_acpi/leds/tpacpi::standby/trigger | 1 - .../thinkpad_acpi/leds/tpacpi::standby/uevent | 0 .../leds/tpacpi::thinklight/brightness | Bin 5 -> 0 bytes .../thinkpad_acpi/leds/tpacpi::thinklight/device | 1 - .../leds/tpacpi::thinklight/power/wakeup | 1 - .../leds/tpacpi::thinklight/subsystem | 1 - .../thinkpad_acpi/leds/tpacpi::thinklight/trigger | 1 - .../thinkpad_acpi/leds/tpacpi::thinklight/uevent | 0 .../leds/tpacpi::unknown_led/brightness | Bin 3 -> 0 bytes .../thinkpad_acpi/leds/tpacpi::unknown_led/device | 1 - .../leds/tpacpi::unknown_led/power/wakeup | 1 - .../leds/tpacpi::unknown_led/subsystem | 1 - .../thinkpad_acpi/leds/tpacpi::unknown_led/trigger | 1 - .../thinkpad_acpi/leds/tpacpi::unknown_led/uevent | 0 .../leds/tpacpi:green:batt/brightness | Bin 3 -> 0 bytes .../thinkpad_acpi/leds/tpacpi:green:batt/device | 1 - .../leds/tpacpi:green:batt/power/wakeup | 1 - .../thinkpad_acpi/leds/tpacpi:green:batt/subsystem | 1 - .../thinkpad_acpi/leds/tpacpi:green:batt/trigger | 1 - .../thinkpad_acpi/leds/tpacpi:green:batt/uevent | 0 .../leds/tpacpi:orange:batt/brightness | Bin 3 -> 0 bytes .../thinkpad_acpi/leds/tpacpi:orange:batt/device | 1 - .../leds/tpacpi:orange:batt/power/wakeup | 1 - .../leds/tpacpi:orange:batt/subsystem | 1 - .../thinkpad_acpi/leds/tpacpi:orange:batt/trigger | 1 - .../thinkpad_acpi/leds/tpacpi:orange:batt/uevent | 0 test/sys/devices/platform/thinkpad_acpi/modalias | 1 - .../devices/platform/thinkpad_acpi/power/wakeup | 1 - .../platform/thinkpad_acpi/rfkill/rfkill0/claim | 1 - .../platform/thinkpad_acpi/rfkill/rfkill0/device | 1 - .../platform/thinkpad_acpi/rfkill/rfkill0/name | 1 - .../thinkpad_acpi/rfkill/rfkill0/power/wakeup | 1 - .../platform/thinkpad_acpi/rfkill/rfkill0/state | 1 - .../thinkpad_acpi/rfkill/rfkill0/subsystem | 1 - .../platform/thinkpad_acpi/rfkill/rfkill0/type | 1 - .../platform/thinkpad_acpi/rfkill/rfkill0/uevent | 3 - test/sys/devices/platform/thinkpad_acpi/subsystem | 1 - test/sys/devices/platform/thinkpad_acpi/uevent | 2 - .../thinkpad_acpi/wakeup_hotunplug_complete | 1 - .../devices/platform/thinkpad_acpi/wakeup_reason | 1 - test/sys/devices/platform/thinkpad_hwmon/driver | 1 - .../sys/devices/platform/thinkpad_hwmon/fan1_input | 1 - .../platform/thinkpad_hwmon/hwmon/hwmon0/device | 1 - .../thinkpad_hwmon/hwmon/hwmon0/power/wakeup | 1 - .../platform/thinkpad_hwmon/hwmon/hwmon0/subsystem | 1 - .../platform/thinkpad_hwmon/hwmon/hwmon0/uevent | 0 test/sys/devices/platform/thinkpad_hwmon/modalias | 1 - test/sys/devices/platform/thinkpad_hwmon/name | 1 - .../devices/platform/thinkpad_hwmon/power/wakeup | 1 - test/sys/devices/platform/thinkpad_hwmon/pwm1 | 1 - .../devices/platform/thinkpad_hwmon/pwm1_enable | 1 - test/sys/devices/platform/thinkpad_hwmon/subsystem | 1 - .../devices/platform/thinkpad_hwmon/temp10_input | 1 - .../devices/platform/thinkpad_hwmon/temp11_input | 1 - .../devices/platform/thinkpad_hwmon/temp12_input | 0 .../devices/platform/thinkpad_hwmon/temp13_input | 0 .../devices/platform/thinkpad_hwmon/temp14_input | 0 .../devices/platform/thinkpad_hwmon/temp15_input | 0 .../devices/platform/thinkpad_hwmon/temp16_input | 0 .../devices/platform/thinkpad_hwmon/temp1_input | 1 - .../devices/platform/thinkpad_hwmon/temp2_input | 1 - .../devices/platform/thinkpad_hwmon/temp3_input | 1 - .../devices/platform/thinkpad_hwmon/temp4_input | 1 - .../devices/platform/thinkpad_hwmon/temp5_input | 1 - .../devices/platform/thinkpad_hwmon/temp6_input | 0 .../devices/platform/thinkpad_hwmon/temp7_input | 1 - .../devices/platform/thinkpad_hwmon/temp8_input | 0 .../devices/platform/thinkpad_hwmon/temp9_input | 1 - test/sys/devices/platform/thinkpad_hwmon/uevent | 2 - test/sys/devices/platform/uevent | 0 test/sys/devices/platform/vesafb.0/driver | 1 - .../platform/vesafb.0/graphics/fb0/bits_per_pixel | 1 - .../devices/platform/vesafb.0/graphics/fb0/blank | 0 .../devices/platform/vesafb.0/graphics/fb0/console | 0 .../devices/platform/vesafb.0/graphics/fb0/cursor | 0 .../sys/devices/platform/vesafb.0/graphics/fb0/dev | 1 - .../devices/platform/vesafb.0/graphics/fb0/device | 1 - .../devices/platform/vesafb.0/graphics/fb0/mode | 0 .../devices/platform/vesafb.0/graphics/fb0/modes | 1 - .../devices/platform/vesafb.0/graphics/fb0/name | 1 - .../sys/devices/platform/vesafb.0/graphics/fb0/pan | 1 - .../platform/vesafb.0/graphics/fb0/power/wakeup | 1 - .../devices/platform/vesafb.0/graphics/fb0/rotate | 1 - .../devices/platform/vesafb.0/graphics/fb0/state | 1 - .../devices/platform/vesafb.0/graphics/fb0/stride | 1 - .../platform/vesafb.0/graphics/fb0/subsystem | 1 - .../devices/platform/vesafb.0/graphics/fb0/uevent | 2 - .../platform/vesafb.0/graphics/fb0/virtual_size | 1 - test/sys/devices/platform/vesafb.0/modalias | 1 - test/sys/devices/platform/vesafb.0/power/wakeup | 1 - test/sys/devices/platform/vesafb.0/subsystem | 1 - test/sys/devices/platform/vesafb.0/uevent | 2 - test/sys/devices/pnp0/00:00/driver | 1 - test/sys/devices/pnp0/00:00/firmware_node | 1 - test/sys/devices/pnp0/00:00/id | 1 - test/sys/devices/pnp0/00:00/options | 0 test/sys/devices/pnp0/00:00/power/wakeup | 1 - test/sys/devices/pnp0/00:00/resources | 18 - test/sys/devices/pnp0/00:00/subsystem | 1 - test/sys/devices/pnp0/00:00/uevent | 1 - test/sys/devices/pnp0/00:01/id | 2 - test/sys/devices/pnp0/00:01/options | 0 test/sys/devices/pnp0/00:01/power/wakeup | 1 - test/sys/devices/pnp0/00:01/resources | 2 - test/sys/devices/pnp0/00:01/subsystem | 1 - test/sys/devices/pnp0/00:01/uevent | 0 test/sys/devices/pnp0/00:02/driver | 1 - test/sys/devices/pnp0/00:02/firmware_node | 1 - test/sys/devices/pnp0/00:02/id | 1 - test/sys/devices/pnp0/00:02/options | 0 test/sys/devices/pnp0/00:02/power/wakeup | 1 - test/sys/devices/pnp0/00:02/resources | 30 - test/sys/devices/pnp0/00:02/subsystem | 1 - test/sys/devices/pnp0/00:02/uevent | 1 - test/sys/devices/pnp0/00:03/firmware_node | 1 - test/sys/devices/pnp0/00:03/id | 1 - test/sys/devices/pnp0/00:03/options | 0 test/sys/devices/pnp0/00:03/power/wakeup | 1 - test/sys/devices/pnp0/00:03/resources | 2 - test/sys/devices/pnp0/00:03/subsystem | 1 - test/sys/devices/pnp0/00:03/uevent | 0 test/sys/devices/pnp0/00:04/firmware_node | 1 - test/sys/devices/pnp0/00:04/id | 1 - test/sys/devices/pnp0/00:04/options | 0 test/sys/devices/pnp0/00:04/power/wakeup | 1 - test/sys/devices/pnp0/00:04/resources | 5 - test/sys/devices/pnp0/00:04/subsystem | 1 - test/sys/devices/pnp0/00:04/uevent | 0 test/sys/devices/pnp0/00:05/firmware_node | 1 - test/sys/devices/pnp0/00:05/id | 1 - test/sys/devices/pnp0/00:05/options | 0 test/sys/devices/pnp0/00:05/power/wakeup | 1 - test/sys/devices/pnp0/00:05/resources | 2 - test/sys/devices/pnp0/00:05/subsystem | 1 - test/sys/devices/pnp0/00:05/uevent | 0 test/sys/devices/pnp0/00:06/firmware_node | 1 - test/sys/devices/pnp0/00:06/id | 1 - test/sys/devices/pnp0/00:06/options | 0 test/sys/devices/pnp0/00:06/power/wakeup | 1 - test/sys/devices/pnp0/00:06/resources | 3 - test/sys/devices/pnp0/00:06/subsystem | 1 - test/sys/devices/pnp0/00:06/uevent | 0 test/sys/devices/pnp0/00:07/driver | 1 - test/sys/devices/pnp0/00:07/firmware_node | 1 - test/sys/devices/pnp0/00:07/id | 1 - test/sys/devices/pnp0/00:07/nvram | Bin 114 -> 0 bytes test/sys/devices/pnp0/00:07/options | 0 test/sys/devices/pnp0/00:07/power/wakeup | 1 - test/sys/devices/pnp0/00:07/resources | 3 - test/sys/devices/pnp0/00:07/rtc/rtc0/date | 1 - test/sys/devices/pnp0/00:07/rtc/rtc0/dev | 1 - test/sys/devices/pnp0/00:07/rtc/rtc0/device | 1 - test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq | 1 - test/sys/devices/pnp0/00:07/rtc/rtc0/name | 1 - test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup | 1 - test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch | 1 - test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem | 1 - test/sys/devices/pnp0/00:07/rtc/rtc0/time | 1 - test/sys/devices/pnp0/00:07/rtc/rtc0/uevent | 2 - test/sys/devices/pnp0/00:07/rtc/rtc0/wakealarm | 0 test/sys/devices/pnp0/00:07/subsystem | 1 - test/sys/devices/pnp0/00:07/uevent | 1 - test/sys/devices/pnp0/00:08/driver | 1 - test/sys/devices/pnp0/00:08/firmware_node | 1 - test/sys/devices/pnp0/00:08/id | 1 - test/sys/devices/pnp0/00:08/options | 0 test/sys/devices/pnp0/00:08/power/wakeup | 1 - test/sys/devices/pnp0/00:08/resources | 4 - test/sys/devices/pnp0/00:08/subsystem | 1 - test/sys/devices/pnp0/00:08/uevent | 1 - test/sys/devices/pnp0/00:09/driver | 1 - test/sys/devices/pnp0/00:09/firmware_node | 1 - test/sys/devices/pnp0/00:09/id | 2 - test/sys/devices/pnp0/00:09/options | 0 test/sys/devices/pnp0/00:09/power/wakeup | 1 - test/sys/devices/pnp0/00:09/resources | 2 - test/sys/devices/pnp0/00:09/subsystem | 1 - test/sys/devices/pnp0/00:09/uevent | 1 - test/sys/devices/pnp0/00:0a/firmware_node | 1 - test/sys/devices/pnp0/00:0a/id | 2 - test/sys/devices/pnp0/00:0a/options | 0 test/sys/devices/pnp0/00:0a/power/wakeup | 1 - test/sys/devices/pnp0/00:0a/resources | 2 - test/sys/devices/pnp0/00:0a/subsystem | 1 - test/sys/devices/pnp0/00:0a/uevent | 0 test/sys/devices/pnp0/power/wakeup | 1 - test/sys/devices/pnp0/uevent | 0 .../clocksource/clocksource0/available_clocksource | 1 - .../clocksource/clocksource0/current_clocksource | 1 - .../cpu/cpu0/cache/index0/coherency_line_size | 1 - .../sys/devices/system/cpu/cpu0/cache/index0/level | 1 - .../system/cpu/cpu0/cache/index0/number_of_sets | 1 - .../cpu/cpu0/cache/index0/physical_line_partition | 1 - .../system/cpu/cpu0/cache/index0/shared_cpu_list | 1 - .../system/cpu/cpu0/cache/index0/shared_cpu_map | 1 - test/sys/devices/system/cpu/cpu0/cache/index0/size | 1 - test/sys/devices/system/cpu/cpu0/cache/index0/type | 1 - .../cpu/cpu0/cache/index0/ways_of_associativity | 1 - .../cpu/cpu0/cache/index1/coherency_line_size | 1 - .../sys/devices/system/cpu/cpu0/cache/index1/level | 1 - .../system/cpu/cpu0/cache/index1/number_of_sets | 1 - .../cpu/cpu0/cache/index1/physical_line_partition | 1 - .../system/cpu/cpu0/cache/index1/shared_cpu_list | 1 - .../system/cpu/cpu0/cache/index1/shared_cpu_map | 1 - test/sys/devices/system/cpu/cpu0/cache/index1/size | 1 - test/sys/devices/system/cpu/cpu0/cache/index1/type | 1 - .../cpu/cpu0/cache/index1/ways_of_associativity | 1 - .../cpu/cpu0/cache/index2/coherency_line_size | 1 - .../sys/devices/system/cpu/cpu0/cache/index2/level | 1 - .../system/cpu/cpu0/cache/index2/number_of_sets | 1 - .../cpu/cpu0/cache/index2/physical_line_partition | 1 - .../system/cpu/cpu0/cache/index2/shared_cpu_list | 1 - .../system/cpu/cpu0/cache/index2/shared_cpu_map | 1 - test/sys/devices/system/cpu/cpu0/cache/index2/size | 1 - test/sys/devices/system/cpu/cpu0/cache/index2/type | 1 - .../cpu/cpu0/cache/index2/ways_of_associativity | 1 - .../devices/system/cpu/cpu0/cpufreq/affected_cpus | 1 - .../system/cpu/cpu0/cpufreq/cpuinfo_cur_freq | 1 - .../system/cpu/cpu0/cpufreq/cpuinfo_max_freq | 1 - .../system/cpu/cpu0/cpufreq/cpuinfo_min_freq | 1 - .../cpu/cpu0/cpufreq/ondemand/ignore_nice_load | 1 - .../cpu/cpu0/cpufreq/ondemand/powersave_bias | 1 - .../system/cpu/cpu0/cpufreq/ondemand/sampling_rate | 1 - .../cpu/cpu0/cpufreq/ondemand/sampling_rate_max | 1 - .../cpu/cpu0/cpufreq/ondemand/sampling_rate_min | 1 - .../system/cpu/cpu0/cpufreq/ondemand/up_threshold | 1 - .../devices/system/cpu/cpu0/cpufreq/related_cpus | 1 - .../cpu/cpu0/cpufreq/scaling_available_frequencies | 1 - .../cpu/cpu0/cpufreq/scaling_available_governors | 1 - .../system/cpu/cpu0/cpufreq/scaling_cur_freq | 1 - .../devices/system/cpu/cpu0/cpufreq/scaling_driver | 1 - .../system/cpu/cpu0/cpufreq/scaling_governor | 1 - .../system/cpu/cpu0/cpufreq/scaling_max_freq | 1 - .../system/cpu/cpu0/cpufreq/scaling_min_freq | 1 - .../system/cpu/cpu0/cpufreq/scaling_setspeed | 1 - .../system/cpu/cpu0/cpufreq/stats/time_in_state | 5 - .../system/cpu/cpu0/cpufreq/stats/total_trans | 1 - .../devices/system/cpu/cpu0/cpuidle/state0/desc | 1 - .../devices/system/cpu/cpu0/cpuidle/state0/latency | 1 - .../devices/system/cpu/cpu0/cpuidle/state0/name | 1 - .../devices/system/cpu/cpu0/cpuidle/state0/power | 1 - .../devices/system/cpu/cpu0/cpuidle/state0/time | 1 - .../devices/system/cpu/cpu0/cpuidle/state0/usage | 1 - .../devices/system/cpu/cpu0/cpuidle/state1/desc | 1 - .../devices/system/cpu/cpu0/cpuidle/state1/latency | 1 - .../devices/system/cpu/cpu0/cpuidle/state1/name | 1 - .../devices/system/cpu/cpu0/cpuidle/state1/power | 1 - .../devices/system/cpu/cpu0/cpuidle/state1/time | 1 - .../devices/system/cpu/cpu0/cpuidle/state1/usage | 1 - .../devices/system/cpu/cpu0/cpuidle/state2/desc | 1 - .../devices/system/cpu/cpu0/cpuidle/state2/latency | 1 - .../devices/system/cpu/cpu0/cpuidle/state2/name | 1 - .../devices/system/cpu/cpu0/cpuidle/state2/power | 1 - .../devices/system/cpu/cpu0/cpuidle/state2/time | 1 - .../devices/system/cpu/cpu0/cpuidle/state2/usage | 1 - .../devices/system/cpu/cpu0/cpuidle/state3/desc | 1 - .../devices/system/cpu/cpu0/cpuidle/state3/latency | 1 - .../devices/system/cpu/cpu0/cpuidle/state3/name | 1 - .../devices/system/cpu/cpu0/cpuidle/state3/power | 1 - .../devices/system/cpu/cpu0/cpuidle/state3/time | 1 - .../devices/system/cpu/cpu0/cpuidle/state3/usage | 1 - test/sys/devices/system/cpu/cpu0/crash_notes | 1 - .../system/cpu/cpu0/microcode/processor_flags | 1 - test/sys/devices/system/cpu/cpu0/microcode/version | 1 - .../devices/system/cpu/cpu0/thermal_throttle/count | 1 - test/sys/devices/system/cpu/cpu0/topology/core_id | 1 - .../devices/system/cpu/cpu0/topology/core_siblings | 1 - .../system/cpu/cpu0/topology/core_siblings_list | 1 - .../system/cpu/cpu0/topology/physical_package_id | 1 - .../system/cpu/cpu0/topology/thread_siblings | 1 - .../system/cpu/cpu0/topology/thread_siblings_list | 1 - .../cpu/cpu1/cache/index0/coherency_line_size | 1 - .../sys/devices/system/cpu/cpu1/cache/index0/level | 1 - .../system/cpu/cpu1/cache/index0/number_of_sets | 1 - .../cpu/cpu1/cache/index0/physical_line_partition | 1 - .../system/cpu/cpu1/cache/index0/shared_cpu_list | 1 - .../system/cpu/cpu1/cache/index0/shared_cpu_map | 1 - test/sys/devices/system/cpu/cpu1/cache/index0/size | 1 - test/sys/devices/system/cpu/cpu1/cache/index0/type | 1 - .../cpu/cpu1/cache/index0/ways_of_associativity | 1 - .../cpu/cpu1/cache/index1/coherency_line_size | 1 - .../sys/devices/system/cpu/cpu1/cache/index1/level | 1 - .../system/cpu/cpu1/cache/index1/number_of_sets | 1 - .../cpu/cpu1/cache/index1/physical_line_partition | 1 - .../system/cpu/cpu1/cache/index1/shared_cpu_list | 1 - .../system/cpu/cpu1/cache/index1/shared_cpu_map | 1 - test/sys/devices/system/cpu/cpu1/cache/index1/size | 1 - test/sys/devices/system/cpu/cpu1/cache/index1/type | 1 - .../cpu/cpu1/cache/index1/ways_of_associativity | 1 - .../cpu/cpu1/cache/index2/coherency_line_size | 1 - .../sys/devices/system/cpu/cpu1/cache/index2/level | 1 - .../system/cpu/cpu1/cache/index2/number_of_sets | 1 - .../cpu/cpu1/cache/index2/physical_line_partition | 1 - .../system/cpu/cpu1/cache/index2/shared_cpu_list | 1 - .../system/cpu/cpu1/cache/index2/shared_cpu_map | 1 - test/sys/devices/system/cpu/cpu1/cache/index2/size | 1 - test/sys/devices/system/cpu/cpu1/cache/index2/type | 1 - .../cpu/cpu1/cache/index2/ways_of_associativity | 1 - test/sys/devices/system/cpu/cpu1/cpufreq | 1 - .../devices/system/cpu/cpu1/cpuidle/state0/desc | 1 - .../devices/system/cpu/cpu1/cpuidle/state0/latency | 1 - .../devices/system/cpu/cpu1/cpuidle/state0/name | 1 - .../devices/system/cpu/cpu1/cpuidle/state0/power | 1 - .../devices/system/cpu/cpu1/cpuidle/state0/time | 1 - .../devices/system/cpu/cpu1/cpuidle/state0/usage | 1 - .../devices/system/cpu/cpu1/cpuidle/state1/desc | 1 - .../devices/system/cpu/cpu1/cpuidle/state1/latency | 1 - .../devices/system/cpu/cpu1/cpuidle/state1/name | 1 - .../devices/system/cpu/cpu1/cpuidle/state1/power | 1 - .../devices/system/cpu/cpu1/cpuidle/state1/time | 1 - .../devices/system/cpu/cpu1/cpuidle/state1/usage | 1 - .../devices/system/cpu/cpu1/cpuidle/state2/desc | 1 - .../devices/system/cpu/cpu1/cpuidle/state2/latency | 1 - .../devices/system/cpu/cpu1/cpuidle/state2/name | 1 - .../devices/system/cpu/cpu1/cpuidle/state2/power | 1 - .../devices/system/cpu/cpu1/cpuidle/state2/time | 1 - .../devices/system/cpu/cpu1/cpuidle/state2/usage | 1 - .../devices/system/cpu/cpu1/cpuidle/state3/desc | 1 - .../devices/system/cpu/cpu1/cpuidle/state3/latency | 1 - .../devices/system/cpu/cpu1/cpuidle/state3/name | 1 - .../devices/system/cpu/cpu1/cpuidle/state3/power | 1 - .../devices/system/cpu/cpu1/cpuidle/state3/time | 1 - .../devices/system/cpu/cpu1/cpuidle/state3/usage | 1 - test/sys/devices/system/cpu/cpu1/crash_notes | 1 - .../system/cpu/cpu1/microcode/processor_flags | 1 - test/sys/devices/system/cpu/cpu1/microcode/version | 1 - test/sys/devices/system/cpu/cpu1/online | 1 - .../devices/system/cpu/cpu1/thermal_throttle/count | 1 - test/sys/devices/system/cpu/cpu1/topology/core_id | 1 - .../devices/system/cpu/cpu1/topology/core_siblings | 1 - .../system/cpu/cpu1/topology/core_siblings_list | 1 - .../system/cpu/cpu1/topology/physical_package_id | 1 - .../system/cpu/cpu1/topology/thread_siblings | 1 - .../system/cpu/cpu1/topology/thread_siblings_list | 1 - test/sys/devices/system/cpu/cpuidle/current_driver | 1 - .../devices/system/cpu/cpuidle/current_governor_ro | 1 - test/sys/devices/system/cpu/online | 1 - test/sys/devices/system/cpu/possible | 1 - test/sys/devices/system/cpu/present | 1 - test/sys/devices/system/cpu/sched_mc_power_savings | 1 - .../system/machinecheck/machinecheck0/bank0ctl | 1 - .../system/machinecheck/machinecheck0/bank1ctl | 1 - .../system/machinecheck/machinecheck0/bank2ctl | 1 - .../system/machinecheck/machinecheck0/bank3ctl | 1 - .../system/machinecheck/machinecheck0/bank4ctl | 1 - .../system/machinecheck/machinecheck0/bank5ctl | 1 - .../machinecheck/machinecheck0/check_interval | 1 - .../system/machinecheck/machinecheck0/tolerant | 1 - .../system/machinecheck/machinecheck0/trigger | 1 - .../system/machinecheck/machinecheck1/bank0ctl | 1 - .../system/machinecheck/machinecheck1/bank1ctl | 1 - .../system/machinecheck/machinecheck1/bank2ctl | 1 - .../system/machinecheck/machinecheck1/bank3ctl | 1 - .../system/machinecheck/machinecheck1/bank4ctl | 1 - .../system/machinecheck/machinecheck1/bank5ctl | 1 - .../machinecheck/machinecheck1/check_interval | 1 - .../system/machinecheck/machinecheck1/tolerant | 1 - .../system/machinecheck/machinecheck1/trigger | 1 - test/sys/devices/virtual/bdi/0:16/max_ratio | 1 - test/sys/devices/virtual/bdi/0:16/min_ratio | 1 - test/sys/devices/virtual/bdi/0:16/power/wakeup | 1 - test/sys/devices/virtual/bdi/0:16/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/0:16/subsystem | 1 - test/sys/devices/virtual/bdi/0:16/uevent | 0 test/sys/devices/virtual/bdi/11:0/max_ratio | 1 - test/sys/devices/virtual/bdi/11:0/min_ratio | 1 - test/sys/devices/virtual/bdi/11:0/power/wakeup | 1 - test/sys/devices/virtual/bdi/11:0/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/11:0/subsystem | 1 - test/sys/devices/virtual/bdi/11:0/uevent | 0 test/sys/devices/virtual/bdi/7:0/max_ratio | 1 - test/sys/devices/virtual/bdi/7:0/min_ratio | 1 - test/sys/devices/virtual/bdi/7:0/power/wakeup | 1 - test/sys/devices/virtual/bdi/7:0/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/7:0/subsystem | 1 - test/sys/devices/virtual/bdi/7:0/uevent | 0 test/sys/devices/virtual/bdi/7:1/max_ratio | 1 - test/sys/devices/virtual/bdi/7:1/min_ratio | 1 - test/sys/devices/virtual/bdi/7:1/power/wakeup | 1 - test/sys/devices/virtual/bdi/7:1/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/7:1/subsystem | 1 - test/sys/devices/virtual/bdi/7:1/uevent | 0 test/sys/devices/virtual/bdi/7:2/max_ratio | 1 - test/sys/devices/virtual/bdi/7:2/min_ratio | 1 - test/sys/devices/virtual/bdi/7:2/power/wakeup | 1 - test/sys/devices/virtual/bdi/7:2/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/7:2/subsystem | 1 - test/sys/devices/virtual/bdi/7:2/uevent | 0 test/sys/devices/virtual/bdi/7:3/max_ratio | 1 - test/sys/devices/virtual/bdi/7:3/min_ratio | 1 - test/sys/devices/virtual/bdi/7:3/power/wakeup | 1 - test/sys/devices/virtual/bdi/7:3/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/7:3/subsystem | 1 - test/sys/devices/virtual/bdi/7:3/uevent | 0 test/sys/devices/virtual/bdi/7:4/max_ratio | 1 - test/sys/devices/virtual/bdi/7:4/min_ratio | 1 - test/sys/devices/virtual/bdi/7:4/power/wakeup | 1 - test/sys/devices/virtual/bdi/7:4/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/7:4/subsystem | 1 - test/sys/devices/virtual/bdi/7:4/uevent | 0 test/sys/devices/virtual/bdi/7:5/max_ratio | 1 - test/sys/devices/virtual/bdi/7:5/min_ratio | 1 - test/sys/devices/virtual/bdi/7:5/power/wakeup | 1 - test/sys/devices/virtual/bdi/7:5/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/7:5/subsystem | 1 - test/sys/devices/virtual/bdi/7:5/uevent | 0 test/sys/devices/virtual/bdi/7:6/max_ratio | 1 - test/sys/devices/virtual/bdi/7:6/min_ratio | 1 - test/sys/devices/virtual/bdi/7:6/power/wakeup | 1 - test/sys/devices/virtual/bdi/7:6/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/7:6/subsystem | 1 - test/sys/devices/virtual/bdi/7:6/uevent | 0 test/sys/devices/virtual/bdi/7:7/max_ratio | 1 - test/sys/devices/virtual/bdi/7:7/min_ratio | 1 - test/sys/devices/virtual/bdi/7:7/power/wakeup | 1 - test/sys/devices/virtual/bdi/7:7/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/7:7/subsystem | 1 - test/sys/devices/virtual/bdi/7:7/uevent | 0 test/sys/devices/virtual/bdi/8:0/max_ratio | 1 - test/sys/devices/virtual/bdi/8:0/min_ratio | 1 - test/sys/devices/virtual/bdi/8:0/power/wakeup | 1 - test/sys/devices/virtual/bdi/8:0/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/8:0/subsystem | 1 - test/sys/devices/virtual/bdi/8:0/uevent | 0 test/sys/devices/virtual/bdi/8:16/max_ratio | 1 - test/sys/devices/virtual/bdi/8:16/min_ratio | 1 - test/sys/devices/virtual/bdi/8:16/power/wakeup | 1 - test/sys/devices/virtual/bdi/8:16/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/8:16/subsystem | 1 - test/sys/devices/virtual/bdi/8:16/uevent | 0 test/sys/devices/virtual/bdi/9:0/max_ratio | 1 - test/sys/devices/virtual/bdi/9:0/min_ratio | 1 - test/sys/devices/virtual/bdi/9:0/power/wakeup | 1 - test/sys/devices/virtual/bdi/9:0/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/9:0/subsystem | 1 - test/sys/devices/virtual/bdi/9:0/uevent | 0 test/sys/devices/virtual/bdi/default/max_ratio | 1 - test/sys/devices/virtual/bdi/default/min_ratio | 1 - test/sys/devices/virtual/bdi/default/power/wakeup | 1 - test/sys/devices/virtual/bdi/default/read_ahead_kb | 1 - test/sys/devices/virtual/bdi/default/subsystem | 1 - test/sys/devices/virtual/bdi/default/uevent | 0 .../virtual/block/fake!blockdev0/capability | 1 - test/sys/devices/virtual/block/fake!blockdev0/dev | 1 - .../sys/devices/virtual/block/fake!blockdev0/range | 1 - .../devices/virtual/block/fake!blockdev0/removable | 1 - test/sys/devices/virtual/block/fake!blockdev0/ro | 1 - test/sys/devices/virtual/block/fake!blockdev0/size | 1 - test/sys/devices/virtual/block/fake!blockdev0/stat | 1 - .../devices/virtual/block/fake!blockdev0/subsystem | 1 - .../devices/virtual/block/fake!blockdev0/uevent | 4 - test/sys/devices/virtual/block/loop0/bdi | 1 - test/sys/devices/virtual/block/loop0/capability | 1 - test/sys/devices/virtual/block/loop0/dev | 1 - test/sys/devices/virtual/block/loop0/make-it-fail | 1 - test/sys/devices/virtual/block/loop0/power/wakeup | 1 - test/sys/devices/virtual/block/loop0/range | 1 - test/sys/devices/virtual/block/loop0/removable | 1 - test/sys/devices/virtual/block/loop0/ro | 1 - test/sys/devices/virtual/block/loop0/size | 1 - test/sys/devices/virtual/block/loop0/stat | 1 - test/sys/devices/virtual/block/loop0/subsystem | 1 - test/sys/devices/virtual/block/loop0/uevent | 3 - test/sys/devices/virtual/block/loop1/bdi | 1 - test/sys/devices/virtual/block/loop1/capability | 1 - test/sys/devices/virtual/block/loop1/dev | 1 - test/sys/devices/virtual/block/loop1/make-it-fail | 1 - test/sys/devices/virtual/block/loop1/power/wakeup | 1 - test/sys/devices/virtual/block/loop1/range | 1 - test/sys/devices/virtual/block/loop1/removable | 1 - test/sys/devices/virtual/block/loop1/ro | 1 - test/sys/devices/virtual/block/loop1/size | 1 - test/sys/devices/virtual/block/loop1/stat | 1 - test/sys/devices/virtual/block/loop1/subsystem | 1 - test/sys/devices/virtual/block/loop1/uevent | 3 - test/sys/devices/virtual/block/loop2/bdi | 1 - test/sys/devices/virtual/block/loop2/capability | 1 - test/sys/devices/virtual/block/loop2/dev | 1 - test/sys/devices/virtual/block/loop2/make-it-fail | 1 - test/sys/devices/virtual/block/loop2/power/wakeup | 1 - test/sys/devices/virtual/block/loop2/range | 1 - test/sys/devices/virtual/block/loop2/removable | 1 - test/sys/devices/virtual/block/loop2/ro | 1 - test/sys/devices/virtual/block/loop2/size | 1 - test/sys/devices/virtual/block/loop2/stat | 1 - test/sys/devices/virtual/block/loop2/subsystem | 1 - test/sys/devices/virtual/block/loop2/uevent | 3 - test/sys/devices/virtual/block/loop3/bdi | 1 - test/sys/devices/virtual/block/loop3/capability | 1 - test/sys/devices/virtual/block/loop3/dev | 1 - test/sys/devices/virtual/block/loop3/make-it-fail | 1 - test/sys/devices/virtual/block/loop3/power/wakeup | 1 - test/sys/devices/virtual/block/loop3/range | 1 - test/sys/devices/virtual/block/loop3/removable | 1 - test/sys/devices/virtual/block/loop3/ro | 1 - test/sys/devices/virtual/block/loop3/size | 1 - test/sys/devices/virtual/block/loop3/stat | 1 - test/sys/devices/virtual/block/loop3/subsystem | 1 - test/sys/devices/virtual/block/loop3/uevent | 3 - test/sys/devices/virtual/block/loop4/bdi | 1 - test/sys/devices/virtual/block/loop4/capability | 1 - test/sys/devices/virtual/block/loop4/dev | 1 - test/sys/devices/virtual/block/loop4/make-it-fail | 1 - test/sys/devices/virtual/block/loop4/power/wakeup | 1 - test/sys/devices/virtual/block/loop4/range | 1 - test/sys/devices/virtual/block/loop4/removable | 1 - test/sys/devices/virtual/block/loop4/ro | 1 - test/sys/devices/virtual/block/loop4/size | 1 - test/sys/devices/virtual/block/loop4/stat | 1 - test/sys/devices/virtual/block/loop4/subsystem | 1 - test/sys/devices/virtual/block/loop4/uevent | 3 - test/sys/devices/virtual/block/loop5/bdi | 1 - test/sys/devices/virtual/block/loop5/capability | 1 - test/sys/devices/virtual/block/loop5/dev | 1 - test/sys/devices/virtual/block/loop5/make-it-fail | 1 - test/sys/devices/virtual/block/loop5/power/wakeup | 1 - test/sys/devices/virtual/block/loop5/range | 1 - test/sys/devices/virtual/block/loop5/removable | 1 - test/sys/devices/virtual/block/loop5/ro | 1 - test/sys/devices/virtual/block/loop5/size | 1 - test/sys/devices/virtual/block/loop5/stat | 1 - test/sys/devices/virtual/block/loop5/subsystem | 1 - test/sys/devices/virtual/block/loop5/uevent | 3 - test/sys/devices/virtual/block/loop6/bdi | 1 - test/sys/devices/virtual/block/loop6/capability | 1 - test/sys/devices/virtual/block/loop6/dev | 1 - test/sys/devices/virtual/block/loop6/make-it-fail | 1 - test/sys/devices/virtual/block/loop6/power/wakeup | 1 - test/sys/devices/virtual/block/loop6/range | 1 - test/sys/devices/virtual/block/loop6/removable | 1 - test/sys/devices/virtual/block/loop6/ro | 1 - test/sys/devices/virtual/block/loop6/size | 1 - test/sys/devices/virtual/block/loop6/stat | 1 - test/sys/devices/virtual/block/loop6/subsystem | 1 - test/sys/devices/virtual/block/loop6/uevent | 3 - test/sys/devices/virtual/block/loop7/bdi | 1 - test/sys/devices/virtual/block/loop7/capability | 1 - test/sys/devices/virtual/block/loop7/dev | 1 - test/sys/devices/virtual/block/loop7/make-it-fail | 1 - test/sys/devices/virtual/block/loop7/power/wakeup | 1 - test/sys/devices/virtual/block/loop7/range | 1 - test/sys/devices/virtual/block/loop7/removable | 1 - test/sys/devices/virtual/block/loop7/ro | 1 - test/sys/devices/virtual/block/loop7/size | 1 - test/sys/devices/virtual/block/loop7/stat | 1 - test/sys/devices/virtual/block/loop7/subsystem | 1 - test/sys/devices/virtual/block/loop7/uevent | 3 - test/sys/devices/virtual/block/md0/bdi | 1 - test/sys/devices/virtual/block/md0/capability | 1 - test/sys/devices/virtual/block/md0/dev | 1 - test/sys/devices/virtual/block/md0/make-it-fail | 1 - test/sys/devices/virtual/block/md0/md/array_state | 1 - test/sys/devices/virtual/block/md0/md/chunk_size | 1 - .../devices/virtual/block/md0/md/component_size | 1 - test/sys/devices/virtual/block/md0/md/degraded | 1 - .../devices/virtual/block/md0/md/dev-sda9/block | 1 - .../devices/virtual/block/md0/md/dev-sda9/errors | 1 - .../devices/virtual/block/md0/md/dev-sda9/offset | 1 - .../sys/devices/virtual/block/md0/md/dev-sda9/size | 1 - .../sys/devices/virtual/block/md0/md/dev-sda9/slot | 1 - .../devices/virtual/block/md0/md/dev-sda9/state | 1 - test/sys/devices/virtual/block/md0/md/layout | 1 - test/sys/devices/virtual/block/md0/md/level | 1 - .../devices/virtual/block/md0/md/metadata_version | 1 - test/sys/devices/virtual/block/md0/md/mismatch_cnt | 1 - test/sys/devices/virtual/block/md0/md/raid_disks | 1 - test/sys/devices/virtual/block/md0/md/rd1 | 1 - .../devices/virtual/block/md0/md/reshape_position | 1 - test/sys/devices/virtual/block/md0/md/resync_start | 1 - .../devices/virtual/block/md0/md/safe_mode_delay | 1 - test/sys/devices/virtual/block/md0/md/suspend_hi | 1 - test/sys/devices/virtual/block/md0/md/suspend_lo | 1 - test/sys/devices/virtual/block/md0/md/sync_action | 1 - .../devices/virtual/block/md0/md/sync_completed | 1 - .../virtual/block/md0/md/sync_force_parallel | 1 - test/sys/devices/virtual/block/md0/md/sync_max | 1 - test/sys/devices/virtual/block/md0/md/sync_min | 1 - test/sys/devices/virtual/block/md0/md/sync_speed | 1 - .../devices/virtual/block/md0/md/sync_speed_max | 1 - .../devices/virtual/block/md0/md/sync_speed_min | 1 - test/sys/devices/virtual/block/md0/power/wakeup | 1 - test/sys/devices/virtual/block/md0/range | 1 - test/sys/devices/virtual/block/md0/removable | 1 - test/sys/devices/virtual/block/md0/ro | 1 - test/sys/devices/virtual/block/md0/size | 1 - test/sys/devices/virtual/block/md0/slaves/sda9 | 1 - test/sys/devices/virtual/block/md0/stat | 1 - test/sys/devices/virtual/block/md0/subsystem | 1 - test/sys/devices/virtual/block/md0/uevent | 3 - test/sys/devices/virtual/dmi/id/bios_date | 1 - test/sys/devices/virtual/dmi/id/bios_vendor | 1 - test/sys/devices/virtual/dmi/id/bios_version | 1 - test/sys/devices/virtual/dmi/id/board_asset_tag | 1 - test/sys/devices/virtual/dmi/id/board_name | 1 - test/sys/devices/virtual/dmi/id/board_serial | 1 - test/sys/devices/virtual/dmi/id/board_vendor | 1 - test/sys/devices/virtual/dmi/id/board_version | 1 - test/sys/devices/virtual/dmi/id/chassis_asset_tag | 1 - test/sys/devices/virtual/dmi/id/chassis_serial | 1 - test/sys/devices/virtual/dmi/id/chassis_type | 1 - test/sys/devices/virtual/dmi/id/chassis_vendor | 1 - test/sys/devices/virtual/dmi/id/chassis_version | 1 - test/sys/devices/virtual/dmi/id/modalias | 1 - test/sys/devices/virtual/dmi/id/power/wakeup | 1 - test/sys/devices/virtual/dmi/id/product_name | 1 - test/sys/devices/virtual/dmi/id/product_serial | 1 - test/sys/devices/virtual/dmi/id/product_uuid | 1 - test/sys/devices/virtual/dmi/id/product_version | 1 - test/sys/devices/virtual/dmi/id/subsystem | 1 - test/sys/devices/virtual/dmi/id/sys_vendor | 1 - test/sys/devices/virtual/dmi/id/uevent | 1 - .../devices/virtual/graphics/fbcon/cursor_blink | 1 - .../devices/virtual/graphics/fbcon/power/wakeup | 1 - test/sys/devices/virtual/graphics/fbcon/rotate | 1 - test/sys/devices/virtual/graphics/fbcon/subsystem | 1 - test/sys/devices/virtual/graphics/fbcon/uevent | 0 .../devices/virtual/input/input6/capabilities/abs | 1 - .../devices/virtual/input/input6/capabilities/ev | 1 - .../devices/virtual/input/input6/capabilities/ff | 1 - .../devices/virtual/input/input6/capabilities/key | 1 - .../devices/virtual/input/input6/capabilities/led | 1 - .../devices/virtual/input/input6/capabilities/msc | 1 - .../devices/virtual/input/input6/capabilities/rel | 1 - .../devices/virtual/input/input6/capabilities/snd | 1 - .../devices/virtual/input/input6/capabilities/sw | 1 - test/sys/devices/virtual/input/input6/event6/dev | 1 - .../sys/devices/virtual/input/input6/event6/device | 1 - .../virtual/input/input6/event6/power/wakeup | 1 - .../devices/virtual/input/input6/event6/subsystem | 1 - .../sys/devices/virtual/input/input6/event6/uevent | 2 - test/sys/devices/virtual/input/input6/id/bustype | 1 - test/sys/devices/virtual/input/input6/id/product | 1 - test/sys/devices/virtual/input/input6/id/vendor | 1 - test/sys/devices/virtual/input/input6/id/version | 1 - test/sys/devices/virtual/input/input6/modalias | 1 - test/sys/devices/virtual/input/input6/name | 1 - test/sys/devices/virtual/input/input6/phys | 1 - test/sys/devices/virtual/input/input6/power/wakeup | 1 - test/sys/devices/virtual/input/input6/subsystem | 1 - test/sys/devices/virtual/input/input6/uevent | 8 - test/sys/devices/virtual/input/input6/uniq | 1 - test/sys/devices/virtual/input/mice/dev | 1 - test/sys/devices/virtual/input/mice/power/wakeup | 1 - test/sys/devices/virtual/input/mice/subsystem | 1 - test/sys/devices/virtual/input/mice/uevent | 2 - test/sys/devices/virtual/mem/full/dev | 1 - test/sys/devices/virtual/mem/full/power/wakeup | 1 - test/sys/devices/virtual/mem/full/subsystem | 1 - test/sys/devices/virtual/mem/full/uevent | 2 - test/sys/devices/virtual/mem/kmem/dev | 1 - test/sys/devices/virtual/mem/kmem/power/wakeup | 1 - test/sys/devices/virtual/mem/kmem/subsystem | 1 - test/sys/devices/virtual/mem/kmem/uevent | 2 - test/sys/devices/virtual/mem/kmsg/dev | 1 - test/sys/devices/virtual/mem/kmsg/power/wakeup | 1 - test/sys/devices/virtual/mem/kmsg/subsystem | 1 - test/sys/devices/virtual/mem/kmsg/uevent | 2 - test/sys/devices/virtual/mem/mem/dev | 1 - test/sys/devices/virtual/mem/mem/power/wakeup | 1 - test/sys/devices/virtual/mem/mem/subsystem | 1 - test/sys/devices/virtual/mem/mem/uevent | 2 - test/sys/devices/virtual/mem/null/dev | 1 - test/sys/devices/virtual/mem/null/power/wakeup | 1 - test/sys/devices/virtual/mem/null/subsystem | 1 - test/sys/devices/virtual/mem/null/uevent | 2 - test/sys/devices/virtual/mem/port/dev | 1 - test/sys/devices/virtual/mem/port/power/wakeup | 1 - test/sys/devices/virtual/mem/port/subsystem | 1 - test/sys/devices/virtual/mem/port/uevent | 2 - test/sys/devices/virtual/mem/random/dev | 1 - test/sys/devices/virtual/mem/random/power/wakeup | 1 - test/sys/devices/virtual/mem/random/subsystem | 1 - test/sys/devices/virtual/mem/random/uevent | 2 - test/sys/devices/virtual/mem/urandom/dev | 1 - test/sys/devices/virtual/mem/urandom/power/wakeup | 1 - test/sys/devices/virtual/mem/urandom/subsystem | 1 - test/sys/devices/virtual/mem/urandom/uevent | 2 - test/sys/devices/virtual/mem/zero/dev | 1 - test/sys/devices/virtual/mem/zero/power/wakeup | 1 - test/sys/devices/virtual/mem/zero/subsystem | 1 - test/sys/devices/virtual/mem/zero/uevent | 2 - test/sys/devices/virtual/misc/cpu_dma_latency/dev | 1 - .../virtual/misc/cpu_dma_latency/power/wakeup | 1 - .../devices/virtual/misc/cpu_dma_latency/subsystem | 1 - .../devices/virtual/misc/cpu_dma_latency/uevent | 2 - test/sys/devices/virtual/misc/device-mapper/dev | 1 - .../virtual/misc/device-mapper/power/wakeup | 1 - .../devices/virtual/misc/device-mapper/subsystem | 1 - test/sys/devices/virtual/misc/device-mapper/uevent | 2 - test/sys/devices/virtual/misc/fuse/dev | 1 - test/sys/devices/virtual/misc/fuse/power/wakeup | 1 - test/sys/devices/virtual/misc/fuse/subsystem | 1 - test/sys/devices/virtual/misc/fuse/uevent | 2 - test/sys/devices/virtual/misc/hpet/dev | 1 - test/sys/devices/virtual/misc/hpet/power/wakeup | 1 - test/sys/devices/virtual/misc/hpet/subsystem | 1 - test/sys/devices/virtual/misc/hpet/uevent | 2 - test/sys/devices/virtual/misc/mcelog/dev | 1 - test/sys/devices/virtual/misc/mcelog/power/wakeup | 1 - test/sys/devices/virtual/misc/mcelog/subsystem | 1 - test/sys/devices/virtual/misc/mcelog/uevent | 2 - test/sys/devices/virtual/misc/microcode/dev | 1 - .../devices/virtual/misc/microcode/power/wakeup | 1 - test/sys/devices/virtual/misc/microcode/subsystem | 1 - test/sys/devices/virtual/misc/microcode/uevent | 2 - test/sys/devices/virtual/misc/misc-fake1/dev | 1 - .../devices/virtual/misc/misc-fake1/power/wakeup | 1 - test/sys/devices/virtual/misc/misc-fake1/subsystem | 1 - test/sys/devices/virtual/misc/misc-fake1/uevent | 4 - test/sys/devices/virtual/misc/misc-fake89999/dev | 1 - .../virtual/misc/misc-fake89999/power/wakeup | 1 - .../devices/virtual/misc/misc-fake89999/subsystem | 1 - .../sys/devices/virtual/misc/misc-fake89999/uevent | 3 - test/sys/devices/virtual/misc/network_latency/dev | 1 - .../virtual/misc/network_latency/power/wakeup | 1 - .../devices/virtual/misc/network_latency/subsystem | 1 - .../devices/virtual/misc/network_latency/uevent | 2 - .../devices/virtual/misc/network_throughput/dev | 1 - .../virtual/misc/network_throughput/power/wakeup | 1 - .../virtual/misc/network_throughput/subsystem | 1 - .../devices/virtual/misc/network_throughput/uevent | 2 - test/sys/devices/virtual/misc/nvram/dev | 1 - test/sys/devices/virtual/misc/nvram/power/wakeup | 1 - test/sys/devices/virtual/misc/nvram/subsystem | 1 - test/sys/devices/virtual/misc/nvram/uevent | 2 - test/sys/devices/virtual/misc/psaux/dev | 1 - test/sys/devices/virtual/misc/psaux/power/wakeup | 1 - test/sys/devices/virtual/misc/psaux/subsystem | 1 - test/sys/devices/virtual/misc/psaux/uevent | 2 - test/sys/devices/virtual/misc/uinput/dev | 1 - test/sys/devices/virtual/misc/uinput/power/wakeup | 1 - test/sys/devices/virtual/misc/uinput/subsystem | 1 - test/sys/devices/virtual/misc/uinput/uevent | 2 - test/sys/devices/virtual/net/lo/addr_len | 1 - test/sys/devices/virtual/net/lo/address | 1 - test/sys/devices/virtual/net/lo/broadcast | 1 - test/sys/devices/virtual/net/lo/carrier | 1 - test/sys/devices/virtual/net/lo/dev_id | 1 - test/sys/devices/virtual/net/lo/dormant | 1 - test/sys/devices/virtual/net/lo/features | 1 - test/sys/devices/virtual/net/lo/flags | 1 - test/sys/devices/virtual/net/lo/ifindex | 1 - test/sys/devices/virtual/net/lo/iflink | 1 - test/sys/devices/virtual/net/lo/link_mode | 1 - test/sys/devices/virtual/net/lo/mtu | 1 - test/sys/devices/virtual/net/lo/operstate | 1 - test/sys/devices/virtual/net/lo/power/wakeup | 1 - .../devices/virtual/net/lo/statistics/collisions | 1 - .../devices/virtual/net/lo/statistics/multicast | 1 - .../sys/devices/virtual/net/lo/statistics/rx_bytes | 1 - .../virtual/net/lo/statistics/rx_compressed | 1 - .../virtual/net/lo/statistics/rx_crc_errors | 1 - .../devices/virtual/net/lo/statistics/rx_dropped | 1 - .../devices/virtual/net/lo/statistics/rx_errors | 1 - .../virtual/net/lo/statistics/rx_fifo_errors | 1 - .../virtual/net/lo/statistics/rx_frame_errors | 1 - .../virtual/net/lo/statistics/rx_length_errors | 1 - .../virtual/net/lo/statistics/rx_missed_errors | 1 - .../virtual/net/lo/statistics/rx_over_errors | 1 - .../devices/virtual/net/lo/statistics/rx_packets | 1 - .../virtual/net/lo/statistics/tx_aborted_errors | 1 - .../sys/devices/virtual/net/lo/statistics/tx_bytes | 1 - .../virtual/net/lo/statistics/tx_carrier_errors | 1 - .../virtual/net/lo/statistics/tx_compressed | 1 - .../devices/virtual/net/lo/statistics/tx_dropped | 1 - .../devices/virtual/net/lo/statistics/tx_errors | 1 - .../virtual/net/lo/statistics/tx_fifo_errors | 1 - .../virtual/net/lo/statistics/tx_heartbeat_errors | 1 - .../devices/virtual/net/lo/statistics/tx_packets | 1 - .../virtual/net/lo/statistics/tx_window_errors | 1 - test/sys/devices/virtual/net/lo/subsystem | 1 - test/sys/devices/virtual/net/lo/tx_queue_len | 1 - test/sys/devices/virtual/net/lo/type | 1 - test/sys/devices/virtual/net/lo/uevent | 2 - test/sys/devices/virtual/sound/seq/dev | 1 - test/sys/devices/virtual/sound/seq/power/wakeup | 1 - test/sys/devices/virtual/sound/seq/subsystem | 1 - test/sys/devices/virtual/sound/seq/uevent | 2 - test/sys/devices/virtual/sound/timer/dev | 1 - test/sys/devices/virtual/sound/timer/power/wakeup | 1 - test/sys/devices/virtual/sound/timer/subsystem | 1 - test/sys/devices/virtual/sound/timer/uevent | 2 - .../virtual/thermal/cooling_device0/cur_state | 1 - .../devices/virtual/thermal/cooling_device0/device | 1 - .../virtual/thermal/cooling_device0/max_state | 1 - .../virtual/thermal/cooling_device0/power/wakeup | 1 - .../virtual/thermal/cooling_device0/subsystem | 1 - .../devices/virtual/thermal/cooling_device0/type | 1 - .../devices/virtual/thermal/cooling_device0/uevent | 0 .../virtual/thermal/cooling_device1/cur_state | 1 - .../devices/virtual/thermal/cooling_device1/device | 1 - .../virtual/thermal/cooling_device1/max_state | 1 - .../virtual/thermal/cooling_device1/power/wakeup | 1 - .../virtual/thermal/cooling_device1/subsystem | 1 - .../devices/virtual/thermal/cooling_device1/type | 1 - .../devices/virtual/thermal/cooling_device1/uevent | 0 .../devices/virtual/thermal/thermal_zone0/device | 1 - .../sys/devices/virtual/thermal/thermal_zone0/mode | 1 - .../virtual/thermal/thermal_zone0/power/wakeup | 1 - .../virtual/thermal/thermal_zone0/subsystem | 1 - .../sys/devices/virtual/thermal/thermal_zone0/temp | 1 - .../thermal/thermal_zone0/trip_point_0_temp | 1 - .../thermal/thermal_zone0/trip_point_0_type | 1 - .../sys/devices/virtual/thermal/thermal_zone0/type | 1 - .../devices/virtual/thermal/thermal_zone0/uevent | 0 .../devices/virtual/thermal/thermal_zone1/cdev0 | 1 - .../virtual/thermal/thermal_zone1/cdev0_trip_point | 1 - .../devices/virtual/thermal/thermal_zone1/cdev1 | 1 - .../virtual/thermal/thermal_zone1/cdev1_trip_point | 1 - .../devices/virtual/thermal/thermal_zone1/device | 1 - .../sys/devices/virtual/thermal/thermal_zone1/mode | 1 - .../virtual/thermal/thermal_zone1/power/wakeup | 1 - .../virtual/thermal/thermal_zone1/subsystem | 1 - .../sys/devices/virtual/thermal/thermal_zone1/temp | 1 - .../thermal/thermal_zone1/trip_point_0_temp | 1 - .../thermal/thermal_zone1/trip_point_0_type | 1 - .../thermal/thermal_zone1/trip_point_1_temp | 1 - .../thermal/thermal_zone1/trip_point_1_type | 1 - .../sys/devices/virtual/thermal/thermal_zone1/type | 1 - .../devices/virtual/thermal/thermal_zone1/uevent | 0 test/sys/devices/virtual/tty/console/dev | 1 - test/sys/devices/virtual/tty/console/power/wakeup | 1 - test/sys/devices/virtual/tty/console/subsystem | 1 - test/sys/devices/virtual/tty/console/uevent | 3 - test/sys/devices/virtual/tty/ptmx/dev | 1 - test/sys/devices/virtual/tty/ptmx/power/wakeup | 1 - test/sys/devices/virtual/tty/ptmx/subsystem | 1 - test/sys/devices/virtual/tty/ptmx/uevent | 2 - test/sys/devices/virtual/tty/tty/dev | 1 - test/sys/devices/virtual/tty/tty/power/wakeup | 1 - test/sys/devices/virtual/tty/tty/subsystem | 1 - test/sys/devices/virtual/tty/tty/uevent | 2 - test/sys/devices/virtual/tty/tty0/dev | 1 - test/sys/devices/virtual/tty/tty0/power/wakeup | 1 - test/sys/devices/virtual/tty/tty0/subsystem | 1 - test/sys/devices/virtual/tty/tty0/uevent | 3 - test/sys/devices/virtual/tty/tty1/dev | 1 - test/sys/devices/virtual/tty/tty1/power/wakeup | 1 - test/sys/devices/virtual/tty/tty1/subsystem | 1 - test/sys/devices/virtual/tty/tty1/uevent | 2 - test/sys/devices/virtual/tty/tty10/dev | 1 - test/sys/devices/virtual/tty/tty10/power/wakeup | 1 - test/sys/devices/virtual/tty/tty10/subsystem | 1 - test/sys/devices/virtual/tty/tty10/uevent | 2 - test/sys/devices/virtual/tty/tty11/dev | 1 - test/sys/devices/virtual/tty/tty11/power/wakeup | 1 - test/sys/devices/virtual/tty/tty11/subsystem | 1 - test/sys/devices/virtual/tty/tty11/uevent | 2 - test/sys/devices/virtual/tty/tty12/dev | 1 - test/sys/devices/virtual/tty/tty12/power/wakeup | 1 - test/sys/devices/virtual/tty/tty12/subsystem | 1 - test/sys/devices/virtual/tty/tty12/uevent | 2 - test/sys/devices/virtual/tty/tty13/dev | 1 - test/sys/devices/virtual/tty/tty13/power/wakeup | 1 - test/sys/devices/virtual/tty/tty13/subsystem | 1 - test/sys/devices/virtual/tty/tty13/uevent | 2 - test/sys/devices/virtual/tty/tty14/dev | 1 - test/sys/devices/virtual/tty/tty14/power/wakeup | 1 - test/sys/devices/virtual/tty/tty14/subsystem | 1 - test/sys/devices/virtual/tty/tty14/uevent | 2 - test/sys/devices/virtual/tty/tty15/dev | 1 - test/sys/devices/virtual/tty/tty15/power/wakeup | 1 - test/sys/devices/virtual/tty/tty15/subsystem | 1 - test/sys/devices/virtual/tty/tty15/uevent | 2 - test/sys/devices/virtual/tty/tty16/dev | 1 - test/sys/devices/virtual/tty/tty16/power/wakeup | 1 - test/sys/devices/virtual/tty/tty16/subsystem | 1 - test/sys/devices/virtual/tty/tty16/uevent | 2 - test/sys/devices/virtual/tty/tty17/dev | 1 - test/sys/devices/virtual/tty/tty17/power/wakeup | 1 - test/sys/devices/virtual/tty/tty17/subsystem | 1 - test/sys/devices/virtual/tty/tty17/uevent | 2 - test/sys/devices/virtual/tty/tty18/dev | 1 - test/sys/devices/virtual/tty/tty18/power/wakeup | 1 - test/sys/devices/virtual/tty/tty18/subsystem | 1 - test/sys/devices/virtual/tty/tty18/uevent | 2 - test/sys/devices/virtual/tty/tty19/dev | 1 - test/sys/devices/virtual/tty/tty19/power/wakeup | 1 - test/sys/devices/virtual/tty/tty19/subsystem | 1 - test/sys/devices/virtual/tty/tty19/uevent | 2 - test/sys/devices/virtual/tty/tty2/dev | 1 - test/sys/devices/virtual/tty/tty2/power/wakeup | 1 - test/sys/devices/virtual/tty/tty2/subsystem | 1 - test/sys/devices/virtual/tty/tty2/uevent | 2 - test/sys/devices/virtual/tty/tty20/dev | 1 - test/sys/devices/virtual/tty/tty20/power/wakeup | 1 - test/sys/devices/virtual/tty/tty20/subsystem | 1 - test/sys/devices/virtual/tty/tty20/uevent | 2 - test/sys/devices/virtual/tty/tty21/dev | 1 - test/sys/devices/virtual/tty/tty21/power/wakeup | 1 - test/sys/devices/virtual/tty/tty21/subsystem | 1 - test/sys/devices/virtual/tty/tty21/uevent | 2 - test/sys/devices/virtual/tty/tty22/dev | 1 - test/sys/devices/virtual/tty/tty22/power/wakeup | 1 - test/sys/devices/virtual/tty/tty22/subsystem | 1 - test/sys/devices/virtual/tty/tty22/uevent | 2 - test/sys/devices/virtual/tty/tty23/dev | 1 - test/sys/devices/virtual/tty/tty23/power/wakeup | 1 - test/sys/devices/virtual/tty/tty23/subsystem | 1 - test/sys/devices/virtual/tty/tty23/uevent | 2 - test/sys/devices/virtual/tty/tty24/dev | 1 - test/sys/devices/virtual/tty/tty24/power/wakeup | 1 - test/sys/devices/virtual/tty/tty24/subsystem | 1 - test/sys/devices/virtual/tty/tty24/uevent | 2 - test/sys/devices/virtual/tty/tty25/dev | 1 - test/sys/devices/virtual/tty/tty25/power/wakeup | 1 - test/sys/devices/virtual/tty/tty25/subsystem | 1 - test/sys/devices/virtual/tty/tty25/uevent | 2 - test/sys/devices/virtual/tty/tty26/dev | 1 - test/sys/devices/virtual/tty/tty26/power/wakeup | 1 - test/sys/devices/virtual/tty/tty26/subsystem | 1 - test/sys/devices/virtual/tty/tty26/uevent | 2 - test/sys/devices/virtual/tty/tty27/dev | 1 - test/sys/devices/virtual/tty/tty27/power/wakeup | 1 - test/sys/devices/virtual/tty/tty27/subsystem | 1 - test/sys/devices/virtual/tty/tty27/uevent | 2 - test/sys/devices/virtual/tty/tty28/dev | 1 - test/sys/devices/virtual/tty/tty28/power/wakeup | 1 - test/sys/devices/virtual/tty/tty28/subsystem | 1 - test/sys/devices/virtual/tty/tty28/uevent | 2 - test/sys/devices/virtual/tty/tty29/dev | 1 - test/sys/devices/virtual/tty/tty29/power/wakeup | 1 - test/sys/devices/virtual/tty/tty29/subsystem | 1 - test/sys/devices/virtual/tty/tty29/uevent | 2 - test/sys/devices/virtual/tty/tty3/dev | 1 - test/sys/devices/virtual/tty/tty3/power/wakeup | 1 - test/sys/devices/virtual/tty/tty3/subsystem | 1 - test/sys/devices/virtual/tty/tty3/uevent | 2 - test/sys/devices/virtual/tty/tty30/dev | 1 - test/sys/devices/virtual/tty/tty30/power/wakeup | 1 - test/sys/devices/virtual/tty/tty30/subsystem | 1 - test/sys/devices/virtual/tty/tty30/uevent | 2 - test/sys/devices/virtual/tty/tty31/dev | 1 - test/sys/devices/virtual/tty/tty31/power/wakeup | 1 - test/sys/devices/virtual/tty/tty31/subsystem | 1 - test/sys/devices/virtual/tty/tty31/uevent | 2 - test/sys/devices/virtual/tty/tty32/dev | 1 - test/sys/devices/virtual/tty/tty32/power/wakeup | 1 - test/sys/devices/virtual/tty/tty32/subsystem | 1 - test/sys/devices/virtual/tty/tty32/uevent | 2 - test/sys/devices/virtual/tty/tty33/dev | 1 - test/sys/devices/virtual/tty/tty33/power/wakeup | 1 - test/sys/devices/virtual/tty/tty33/subsystem | 1 - test/sys/devices/virtual/tty/tty33/uevent | 3 - test/sys/devices/virtual/tty/tty34/dev | 1 - test/sys/devices/virtual/tty/tty34/power/wakeup | 1 - test/sys/devices/virtual/tty/tty34/subsystem | 1 - test/sys/devices/virtual/tty/tty34/uevent | 2 - test/sys/devices/virtual/tty/tty35/dev | 1 - test/sys/devices/virtual/tty/tty35/power/wakeup | 1 - test/sys/devices/virtual/tty/tty35/subsystem | 1 - test/sys/devices/virtual/tty/tty35/uevent | 2 - test/sys/devices/virtual/tty/tty36/dev | 1 - test/sys/devices/virtual/tty/tty36/power/wakeup | 1 - test/sys/devices/virtual/tty/tty36/subsystem | 1 - test/sys/devices/virtual/tty/tty36/uevent | 2 - test/sys/devices/virtual/tty/tty37/dev | 1 - test/sys/devices/virtual/tty/tty37/power/wakeup | 1 - test/sys/devices/virtual/tty/tty37/subsystem | 1 - test/sys/devices/virtual/tty/tty37/uevent | 2 - test/sys/devices/virtual/tty/tty38/dev | 1 - test/sys/devices/virtual/tty/tty38/power/wakeup | 1 - test/sys/devices/virtual/tty/tty38/subsystem | 1 - test/sys/devices/virtual/tty/tty38/uevent | 2 - test/sys/devices/virtual/tty/tty39/dev | 1 - test/sys/devices/virtual/tty/tty39/power/wakeup | 1 - test/sys/devices/virtual/tty/tty39/subsystem | 1 - test/sys/devices/virtual/tty/tty39/uevent | 2 - test/sys/devices/virtual/tty/tty4/dev | 1 - test/sys/devices/virtual/tty/tty4/power/wakeup | 1 - test/sys/devices/virtual/tty/tty4/subsystem | 1 - test/sys/devices/virtual/tty/tty4/uevent | 2 - test/sys/devices/virtual/tty/tty40/dev | 1 - test/sys/devices/virtual/tty/tty40/power/wakeup | 1 - test/sys/devices/virtual/tty/tty40/subsystem | 1 - test/sys/devices/virtual/tty/tty40/uevent | 2 - test/sys/devices/virtual/tty/tty41/dev | 1 - test/sys/devices/virtual/tty/tty41/power/wakeup | 1 - test/sys/devices/virtual/tty/tty41/subsystem | 1 - test/sys/devices/virtual/tty/tty41/uevent | 2 - test/sys/devices/virtual/tty/tty42/dev | 1 - test/sys/devices/virtual/tty/tty42/power/wakeup | 1 - test/sys/devices/virtual/tty/tty42/subsystem | 1 - test/sys/devices/virtual/tty/tty42/uevent | 2 - test/sys/devices/virtual/tty/tty43/dev | 1 - test/sys/devices/virtual/tty/tty43/power/wakeup | 1 - test/sys/devices/virtual/tty/tty43/subsystem | 1 - test/sys/devices/virtual/tty/tty43/uevent | 2 - test/sys/devices/virtual/tty/tty44/dev | 1 - test/sys/devices/virtual/tty/tty44/power/wakeup | 1 - test/sys/devices/virtual/tty/tty44/subsystem | 1 - test/sys/devices/virtual/tty/tty44/uevent | 2 - test/sys/devices/virtual/tty/tty45/dev | 1 - test/sys/devices/virtual/tty/tty45/power/wakeup | 1 - test/sys/devices/virtual/tty/tty45/subsystem | 1 - test/sys/devices/virtual/tty/tty45/uevent | 2 - test/sys/devices/virtual/tty/tty46/dev | 1 - test/sys/devices/virtual/tty/tty46/power/wakeup | 1 - test/sys/devices/virtual/tty/tty46/subsystem | 1 - test/sys/devices/virtual/tty/tty46/uevent | 2 - test/sys/devices/virtual/tty/tty47/dev | 1 - test/sys/devices/virtual/tty/tty47/power/wakeup | 1 - test/sys/devices/virtual/tty/tty47/subsystem | 1 - test/sys/devices/virtual/tty/tty47/uevent | 2 - test/sys/devices/virtual/tty/tty48/dev | 1 - test/sys/devices/virtual/tty/tty48/power/wakeup | 1 - test/sys/devices/virtual/tty/tty48/subsystem | 1 - test/sys/devices/virtual/tty/tty48/uevent | 2 - test/sys/devices/virtual/tty/tty49/dev | 1 - test/sys/devices/virtual/tty/tty49/power/wakeup | 1 - test/sys/devices/virtual/tty/tty49/subsystem | 1 - test/sys/devices/virtual/tty/tty49/uevent | 2 - test/sys/devices/virtual/tty/tty5/dev | 1 - test/sys/devices/virtual/tty/tty5/power/wakeup | 1 - test/sys/devices/virtual/tty/tty5/subsystem | 1 - test/sys/devices/virtual/tty/tty5/uevent | 2 - test/sys/devices/virtual/tty/tty50/dev | 1 - test/sys/devices/virtual/tty/tty50/power/wakeup | 1 - test/sys/devices/virtual/tty/tty50/subsystem | 1 - test/sys/devices/virtual/tty/tty50/uevent | 2 - test/sys/devices/virtual/tty/tty51/dev | 1 - test/sys/devices/virtual/tty/tty51/power/wakeup | 1 - test/sys/devices/virtual/tty/tty51/subsystem | 1 - test/sys/devices/virtual/tty/tty51/uevent | 2 - test/sys/devices/virtual/tty/tty52/dev | 1 - test/sys/devices/virtual/tty/tty52/power/wakeup | 1 - test/sys/devices/virtual/tty/tty52/subsystem | 1 - test/sys/devices/virtual/tty/tty52/uevent | 2 - test/sys/devices/virtual/tty/tty53/dev | 1 - test/sys/devices/virtual/tty/tty53/power/wakeup | 1 - test/sys/devices/virtual/tty/tty53/subsystem | 1 - test/sys/devices/virtual/tty/tty53/uevent | 2 - test/sys/devices/virtual/tty/tty54/dev | 1 - test/sys/devices/virtual/tty/tty54/power/wakeup | 1 - test/sys/devices/virtual/tty/tty54/subsystem | 1 - test/sys/devices/virtual/tty/tty54/uevent | 2 - test/sys/devices/virtual/tty/tty55/dev | 1 - test/sys/devices/virtual/tty/tty55/power/wakeup | 1 - test/sys/devices/virtual/tty/tty55/subsystem | 1 - test/sys/devices/virtual/tty/tty55/uevent | 2 - test/sys/devices/virtual/tty/tty56/dev | 1 - test/sys/devices/virtual/tty/tty56/power/wakeup | 1 - test/sys/devices/virtual/tty/tty56/subsystem | 1 - test/sys/devices/virtual/tty/tty56/uevent | 2 - test/sys/devices/virtual/tty/tty57/dev | 1 - test/sys/devices/virtual/tty/tty57/power/wakeup | 1 - test/sys/devices/virtual/tty/tty57/subsystem | 1 - test/sys/devices/virtual/tty/tty57/uevent | 2 - test/sys/devices/virtual/tty/tty58/dev | 1 - test/sys/devices/virtual/tty/tty58/power/wakeup | 1 - test/sys/devices/virtual/tty/tty58/subsystem | 1 - test/sys/devices/virtual/tty/tty58/uevent | 2 - test/sys/devices/virtual/tty/tty59/dev | 1 - test/sys/devices/virtual/tty/tty59/power/wakeup | 1 - test/sys/devices/virtual/tty/tty59/subsystem | 1 - test/sys/devices/virtual/tty/tty59/uevent | 2 - test/sys/devices/virtual/tty/tty6/dev | 1 - test/sys/devices/virtual/tty/tty6/power/wakeup | 1 - test/sys/devices/virtual/tty/tty6/subsystem | 1 - test/sys/devices/virtual/tty/tty6/uevent | 2 - test/sys/devices/virtual/tty/tty60/dev | 1 - test/sys/devices/virtual/tty/tty60/power/wakeup | 1 - test/sys/devices/virtual/tty/tty60/subsystem | 1 - test/sys/devices/virtual/tty/tty60/uevent | 2 - test/sys/devices/virtual/tty/tty61/dev | 1 - test/sys/devices/virtual/tty/tty61/power/wakeup | 1 - test/sys/devices/virtual/tty/tty61/subsystem | 1 - test/sys/devices/virtual/tty/tty61/uevent | 2 - test/sys/devices/virtual/tty/tty62/dev | 1 - test/sys/devices/virtual/tty/tty62/power/wakeup | 1 - test/sys/devices/virtual/tty/tty62/subsystem | 1 - test/sys/devices/virtual/tty/tty62/uevent | 2 - test/sys/devices/virtual/tty/tty63/dev | 1 - test/sys/devices/virtual/tty/tty63/power/wakeup | 1 - test/sys/devices/virtual/tty/tty63/subsystem | 1 - test/sys/devices/virtual/tty/tty63/uevent | 2 - test/sys/devices/virtual/tty/tty7/dev | 1 - test/sys/devices/virtual/tty/tty7/power/wakeup | 1 - test/sys/devices/virtual/tty/tty7/subsystem | 1 - test/sys/devices/virtual/tty/tty7/uevent | 2 - test/sys/devices/virtual/tty/tty8/dev | 1 - test/sys/devices/virtual/tty/tty8/power/wakeup | 1 - test/sys/devices/virtual/tty/tty8/subsystem | 1 - test/sys/devices/virtual/tty/tty8/uevent | 2 - test/sys/devices/virtual/tty/tty9/dev | 1 - test/sys/devices/virtual/tty/tty9/power/wakeup | 1 - test/sys/devices/virtual/tty/tty9/subsystem | 1 - test/sys/devices/virtual/tty/tty9/uevent | 2 - test/sys/devices/virtual/vc/vcs/dev | 1 - test/sys/devices/virtual/vc/vcs/power/wakeup | 1 - test/sys/devices/virtual/vc/vcs/subsystem | 1 - test/sys/devices/virtual/vc/vcs/uevent | 2 - test/sys/devices/virtual/vc/vcs1/dev | 1 - test/sys/devices/virtual/vc/vcs1/power/wakeup | 1 - test/sys/devices/virtual/vc/vcs1/subsystem | 1 - test/sys/devices/virtual/vc/vcs1/uevent | 2 - test/sys/devices/virtual/vc/vcs10/dev | 1 - test/sys/devices/virtual/vc/vcs10/power/wakeup | 1 - test/sys/devices/virtual/vc/vcs10/subsystem | 1 - test/sys/devices/virtual/vc/vcs10/uevent | 2 - test/sys/devices/virtual/vc/vcs2/dev | 1 - test/sys/devices/virtual/vc/vcs2/power/wakeup | 1 - test/sys/devices/virtual/vc/vcs2/subsystem | 1 - test/sys/devices/virtual/vc/vcs2/uevent | 2 - test/sys/devices/virtual/vc/vcs3/dev | 1 - test/sys/devices/virtual/vc/vcs3/power/wakeup | 1 - test/sys/devices/virtual/vc/vcs3/subsystem | 1 - test/sys/devices/virtual/vc/vcs3/uevent | 2 - test/sys/devices/virtual/vc/vcs4/dev | 1 - test/sys/devices/virtual/vc/vcs4/power/wakeup | 1 - test/sys/devices/virtual/vc/vcs4/subsystem | 1 - test/sys/devices/virtual/vc/vcs4/uevent | 2 - test/sys/devices/virtual/vc/vcs5/dev | 1 - test/sys/devices/virtual/vc/vcs5/power/wakeup | 1 - test/sys/devices/virtual/vc/vcs5/subsystem | 1 - test/sys/devices/virtual/vc/vcs5/uevent | 2 - test/sys/devices/virtual/vc/vcs6/dev | 1 - test/sys/devices/virtual/vc/vcs6/power/wakeup | 1 - test/sys/devices/virtual/vc/vcs6/subsystem | 1 - test/sys/devices/virtual/vc/vcs6/uevent | 2 - test/sys/devices/virtual/vc/vcs7/dev | 1 - test/sys/devices/virtual/vc/vcs7/power/wakeup | 1 - test/sys/devices/virtual/vc/vcs7/subsystem | 1 - test/sys/devices/virtual/vc/vcs7/uevent | 2 - test/sys/devices/virtual/vc/vcsa/dev | 1 - test/sys/devices/virtual/vc/vcsa/power/wakeup | 1 - test/sys/devices/virtual/vc/vcsa/subsystem | 1 - test/sys/devices/virtual/vc/vcsa/uevent | 2 - test/sys/devices/virtual/vc/vcsa1/dev | 1 - test/sys/devices/virtual/vc/vcsa1/power/wakeup | 1 - test/sys/devices/virtual/vc/vcsa1/subsystem | 1 - test/sys/devices/virtual/vc/vcsa1/uevent | 2 - test/sys/devices/virtual/vc/vcsa10/dev | 1 - test/sys/devices/virtual/vc/vcsa10/power/wakeup | 1 - test/sys/devices/virtual/vc/vcsa10/subsystem | 1 - test/sys/devices/virtual/vc/vcsa10/uevent | 2 - test/sys/devices/virtual/vc/vcsa2/dev | 1 - test/sys/devices/virtual/vc/vcsa2/power/wakeup | 1 - test/sys/devices/virtual/vc/vcsa2/subsystem | 1 - test/sys/devices/virtual/vc/vcsa2/uevent | 2 - test/sys/devices/virtual/vc/vcsa3/dev | 1 - test/sys/devices/virtual/vc/vcsa3/power/wakeup | 1 - test/sys/devices/virtual/vc/vcsa3/subsystem | 1 - test/sys/devices/virtual/vc/vcsa3/uevent | 2 - test/sys/devices/virtual/vc/vcsa4/dev | 1 - test/sys/devices/virtual/vc/vcsa4/power/wakeup | 1 - test/sys/devices/virtual/vc/vcsa4/subsystem | 1 - test/sys/devices/virtual/vc/vcsa4/uevent | 2 - test/sys/devices/virtual/vc/vcsa5/dev | 1 - test/sys/devices/virtual/vc/vcsa5/power/wakeup | 1 - test/sys/devices/virtual/vc/vcsa5/subsystem | 1 - test/sys/devices/virtual/vc/vcsa5/uevent | 2 - test/sys/devices/virtual/vc/vcsa6/dev | 1 - test/sys/devices/virtual/vc/vcsa6/power/wakeup | 1 - test/sys/devices/virtual/vc/vcsa6/subsystem | 1 - test/sys/devices/virtual/vc/vcsa6/uevent | 2 - test/sys/devices/virtual/vc/vcsa7/dev | 1 - test/sys/devices/virtual/vc/vcsa7/power/wakeup | 1 - test/sys/devices/virtual/vc/vcsa7/subsystem | 1 - test/sys/devices/virtual/vc/vcsa7/uevent | 2 - test/sys/devices/virtual/vtconsole/vtcon0/bind | 1 - test/sys/devices/virtual/vtconsole/vtcon0/name | 1 - .../devices/virtual/vtconsole/vtcon0/power/wakeup | 1 - .../sys/devices/virtual/vtconsole/vtcon0/subsystem | 1 - test/sys/devices/virtual/vtconsole/vtcon0/uevent | 0 test/sys/devices/virtual/vtconsole/vtcon1/bind | 1 - test/sys/devices/virtual/vtconsole/vtcon1/name | 1 - .../devices/virtual/vtconsole/vtcon1/power/wakeup | 1 - .../sys/devices/virtual/vtconsole/vtcon1/subsystem | 1 - test/sys/devices/virtual/vtconsole/vtcon1/uevent | 0 test/sys/firmware/acpi/interrupts/error | 1 - test/sys/firmware/acpi/interrupts/ff_gbl_lock | 1 - test/sys/firmware/acpi/interrupts/ff_pmtimer | 1 - test/sys/firmware/acpi/interrupts/ff_pwr_btn | 1 - test/sys/firmware/acpi/interrupts/ff_rt_clk | 1 - test/sys/firmware/acpi/interrupts/ff_slp_btn | 1 - test/sys/firmware/acpi/interrupts/gpe00 | 1 - test/sys/firmware/acpi/interrupts/gpe01 | 1 - test/sys/firmware/acpi/interrupts/gpe02 | 1 - test/sys/firmware/acpi/interrupts/gpe03 | 1 - test/sys/firmware/acpi/interrupts/gpe04 | 1 - test/sys/firmware/acpi/interrupts/gpe05 | 1 - test/sys/firmware/acpi/interrupts/gpe06 | 1 - test/sys/firmware/acpi/interrupts/gpe07 | 1 - test/sys/firmware/acpi/interrupts/gpe08 | 1 - test/sys/firmware/acpi/interrupts/gpe09 | 1 - test/sys/firmware/acpi/interrupts/gpe0A | 1 - test/sys/firmware/acpi/interrupts/gpe0B | 1 - test/sys/firmware/acpi/interrupts/gpe0C | 1 - test/sys/firmware/acpi/interrupts/gpe0D | 1 - test/sys/firmware/acpi/interrupts/gpe0E | 1 - test/sys/firmware/acpi/interrupts/gpe0F | 1 - test/sys/firmware/acpi/interrupts/gpe10 | 1 - test/sys/firmware/acpi/interrupts/gpe11 | 1 - test/sys/firmware/acpi/interrupts/gpe12 | 1 - test/sys/firmware/acpi/interrupts/gpe13 | 1 - test/sys/firmware/acpi/interrupts/gpe14 | 1 - test/sys/firmware/acpi/interrupts/gpe15 | 1 - test/sys/firmware/acpi/interrupts/gpe16 | 1 - test/sys/firmware/acpi/interrupts/gpe17 | 1 - test/sys/firmware/acpi/interrupts/gpe18 | 1 - test/sys/firmware/acpi/interrupts/gpe19 | 1 - test/sys/firmware/acpi/interrupts/gpe1A | 1 - test/sys/firmware/acpi/interrupts/gpe1B | 1 - test/sys/firmware/acpi/interrupts/gpe1C | 1 - test/sys/firmware/acpi/interrupts/gpe1D | 1 - test/sys/firmware/acpi/interrupts/gpe1E | 1 - test/sys/firmware/acpi/interrupts/gpe1F | 1 - test/sys/firmware/acpi/interrupts/gpe_all | 1 - test/sys/firmware/acpi/interrupts/sci | 1 - test/sys/firmware/acpi/tables/APIC | Bin 104 -> 0 bytes test/sys/firmware/acpi/tables/BOOT | Bin 40 -> 0 bytes test/sys/firmware/acpi/tables/DSDT | Bin 53812 -> 0 bytes test/sys/firmware/acpi/tables/ECDT | Bin 82 -> 0 bytes test/sys/firmware/acpi/tables/FACP | Bin 244 -> 0 bytes test/sys/firmware/acpi/tables/FACS | Bin 64 -> 0 bytes test/sys/firmware/acpi/tables/HPET | Bin 56 -> 0 bytes test/sys/firmware/acpi/tables/MCFG | Bin 60 -> 0 bytes test/sys/firmware/acpi/tables/SLIC | Bin 374 -> 0 bytes test/sys/firmware/acpi/tables/SSDT1 | Bin 426 -> 0 bytes test/sys/firmware/acpi/tables/SSDT2 | Bin 607 -> 0 bytes test/sys/firmware/acpi/tables/SSDT3 | Bin 166 -> 0 bytes test/sys/firmware/acpi/tables/SSDT4 | Bin 1271 -> 0 bytes test/sys/firmware/acpi/tables/SSDT5 | Bin 472 -> 0 bytes test/sys/firmware/acpi/tables/TCPA | Bin 50 -> 0 bytes .../sys/firmware/edd/int13_dev80/default_cylinders | 1 - test/sys/firmware/edd/int13_dev80/default_heads | 1 - .../edd/int13_dev80/default_sectors_per_track | 1 - test/sys/firmware/edd/int13_dev80/extensions | 2 - test/sys/firmware/edd/int13_dev80/host_bus | 1 - test/sys/firmware/edd/int13_dev80/info_flags | 1 - test/sys/firmware/edd/int13_dev80/interface | 1 - .../firmware/edd/int13_dev80/legacy_max_cylinder | 1 - test/sys/firmware/edd/int13_dev80/legacy_max_head | 1 - .../edd/int13_dev80/legacy_sectors_per_track | 1 - test/sys/firmware/edd/int13_dev80/mbr_signature | 1 - test/sys/firmware/edd/int13_dev80/pci_dev | 1 - test/sys/firmware/edd/int13_dev80/raw_data | Bin 74 -> 0 bytes test/sys/firmware/edd/int13_dev80/sectors | 1 - test/sys/firmware/edd/int13_dev80/version | 1 - test/sys/firmware/memmap/0/end | 1 - test/sys/firmware/memmap/0/start | 1 - test/sys/firmware/memmap/0/type | 1 - test/sys/firmware/memmap/1/end | 1 - test/sys/firmware/memmap/1/start | 1 - test/sys/firmware/memmap/1/type | 1 - test/sys/firmware/memmap/10/end | 1 - test/sys/firmware/memmap/10/start | 1 - test/sys/firmware/memmap/10/type | 1 - test/sys/firmware/memmap/11/end | 1 - test/sys/firmware/memmap/11/start | 1 - test/sys/firmware/memmap/11/type | 1 - test/sys/firmware/memmap/12/end | 1 - test/sys/firmware/memmap/12/start | 1 - test/sys/firmware/memmap/12/type | 1 - test/sys/firmware/memmap/13/end | 1 - test/sys/firmware/memmap/13/start | 1 - test/sys/firmware/memmap/13/type | 1 - test/sys/firmware/memmap/2/end | 1 - test/sys/firmware/memmap/2/start | 1 - test/sys/firmware/memmap/2/type | 1 - test/sys/firmware/memmap/3/end | 1 - test/sys/firmware/memmap/3/start | 1 - test/sys/firmware/memmap/3/type | 1 - test/sys/firmware/memmap/4/end | 1 - test/sys/firmware/memmap/4/start | 1 - test/sys/firmware/memmap/4/type | 1 - test/sys/firmware/memmap/5/end | 1 - test/sys/firmware/memmap/5/start | 1 - test/sys/firmware/memmap/5/type | 1 - test/sys/firmware/memmap/6/end | 1 - test/sys/firmware/memmap/6/start | 1 - test/sys/firmware/memmap/6/type | 1 - test/sys/firmware/memmap/7/end | 1 - test/sys/firmware/memmap/7/start | 1 - test/sys/firmware/memmap/7/type | 1 - test/sys/firmware/memmap/8/end | 1 - test/sys/firmware/memmap/8/start | 1 - test/sys/firmware/memmap/8/type | 1 - test/sys/firmware/memmap/9/end | 1 - test/sys/firmware/memmap/9/start | 1 - test/sys/firmware/memmap/9/type | 1 - test/sys/fs/fuse/connections/16/abort | 0 test/sys/fs/fuse/connections/16/waiting | 1 - test/sys/kernel/debug/bdi/0:16/stats | 5 - test/sys/kernel/debug/bdi/11:0/stats | 5 - test/sys/kernel/debug/bdi/7:0/stats | 5 - test/sys/kernel/debug/bdi/7:1/stats | 5 - test/sys/kernel/debug/bdi/7:2/stats | 5 - test/sys/kernel/debug/bdi/7:3/stats | 5 - test/sys/kernel/debug/bdi/7:4/stats | 5 - test/sys/kernel/debug/bdi/7:5/stats | 5 - test/sys/kernel/debug/bdi/7:6/stats | 5 - test/sys/kernel/debug/bdi/7:7/stats | 5 - test/sys/kernel/debug/bdi/8:0/stats | 5 - test/sys/kernel/debug/bdi/8:16/stats | 5 - test/sys/kernel/debug/bdi/9:0/stats | 5 - test/sys/kernel/debug/bdi/default/stats | 5 - test/sys/kernel/debug/x86/pat_memtype_list | 0 test/sys/kernel/kexec_crash_loaded | 1 - test/sys/kernel/kexec_loaded | 1 - test/sys/kernel/notes | Bin 36 -> 0 bytes test/sys/kernel/slab/Acpi-Namespace/aliases | 1 - test/sys/kernel/slab/Acpi-Namespace/align | 1 - test/sys/kernel/slab/Acpi-Namespace/alloc_calls | 1 - test/sys/kernel/slab/Acpi-Namespace/cache_dma | 1 - test/sys/kernel/slab/Acpi-Namespace/cpu_slabs | 1 - test/sys/kernel/slab/Acpi-Namespace/ctor | 0 test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu | 1 - test/sys/kernel/slab/Acpi-Namespace/free_calls | 1 - test/sys/kernel/slab/Acpi-Namespace/hwcache_align | 1 - test/sys/kernel/slab/Acpi-Namespace/object_size | 1 - test/sys/kernel/slab/Acpi-Namespace/objects | 1 - .../sys/kernel/slab/Acpi-Namespace/objects_partial | 1 - test/sys/kernel/slab/Acpi-Namespace/objs_per_slab | 1 - test/sys/kernel/slab/Acpi-Namespace/order | 1 - test/sys/kernel/slab/Acpi-Namespace/partial | 1 - test/sys/kernel/slab/Acpi-Namespace/poison | 1 - .../sys/kernel/slab/Acpi-Namespace/reclaim_account | 1 - test/sys/kernel/slab/Acpi-Namespace/red_zone | 1 - test/sys/kernel/slab/Acpi-Namespace/sanity_checks | 1 - test/sys/kernel/slab/Acpi-Namespace/shrink | 0 test/sys/kernel/slab/Acpi-Namespace/slab_size | 1 - test/sys/kernel/slab/Acpi-Namespace/slabs | 1 - test/sys/kernel/slab/Acpi-Namespace/store_user | 1 - test/sys/kernel/slab/Acpi-Namespace/total_objects | 1 - test/sys/kernel/slab/Acpi-Namespace/trace | 1 - test/sys/kernel/slab/Acpi-Namespace/validate | 0 test/sys/kernel/slab/Acpi-Operand/aliases | 1 - test/sys/kernel/slab/Acpi-Operand/align | 1 - test/sys/kernel/slab/Acpi-Operand/alloc_calls | 1 - test/sys/kernel/slab/Acpi-Operand/cache_dma | 1 - test/sys/kernel/slab/Acpi-Operand/cpu_slabs | 1 - test/sys/kernel/slab/Acpi-Operand/ctor | 0 test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu | 1 - test/sys/kernel/slab/Acpi-Operand/free_calls | 2 - test/sys/kernel/slab/Acpi-Operand/hwcache_align | 1 - test/sys/kernel/slab/Acpi-Operand/object_size | 1 - test/sys/kernel/slab/Acpi-Operand/objects | 1 - test/sys/kernel/slab/Acpi-Operand/objects_partial | 1 - test/sys/kernel/slab/Acpi-Operand/objs_per_slab | 1 - test/sys/kernel/slab/Acpi-Operand/order | 1 - test/sys/kernel/slab/Acpi-Operand/partial | 1 - test/sys/kernel/slab/Acpi-Operand/poison | 1 - test/sys/kernel/slab/Acpi-Operand/reclaim_account | 1 - test/sys/kernel/slab/Acpi-Operand/red_zone | 1 - test/sys/kernel/slab/Acpi-Operand/sanity_checks | 1 - test/sys/kernel/slab/Acpi-Operand/shrink | 0 test/sys/kernel/slab/Acpi-Operand/slab_size | 1 - test/sys/kernel/slab/Acpi-Operand/slabs | 1 - test/sys/kernel/slab/Acpi-Operand/store_user | 1 - test/sys/kernel/slab/Acpi-Operand/total_objects | 1 - test/sys/kernel/slab/Acpi-Operand/trace | 1 - test/sys/kernel/slab/Acpi-Operand/validate | 0 test/sys/kernel/slab/Acpi-Parse/aliases | 1 - test/sys/kernel/slab/Acpi-Parse/align | 1 - test/sys/kernel/slab/Acpi-Parse/alloc_calls | 1 - test/sys/kernel/slab/Acpi-Parse/cache_dma | 1 - test/sys/kernel/slab/Acpi-Parse/cpu_slabs | 1 - test/sys/kernel/slab/Acpi-Parse/ctor | 0 test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu | 1 - test/sys/kernel/slab/Acpi-Parse/free_calls | 1 - test/sys/kernel/slab/Acpi-Parse/hwcache_align | 1 - test/sys/kernel/slab/Acpi-Parse/object_size | 1 - test/sys/kernel/slab/Acpi-Parse/objects | 1 - test/sys/kernel/slab/Acpi-Parse/objects_partial | 1 - test/sys/kernel/slab/Acpi-Parse/objs_per_slab | 1 - test/sys/kernel/slab/Acpi-Parse/order | 1 - test/sys/kernel/slab/Acpi-Parse/partial | 1 - test/sys/kernel/slab/Acpi-Parse/poison | 1 - test/sys/kernel/slab/Acpi-Parse/reclaim_account | 1 - test/sys/kernel/slab/Acpi-Parse/red_zone | 1 - test/sys/kernel/slab/Acpi-Parse/sanity_checks | 1 - test/sys/kernel/slab/Acpi-Parse/shrink | 0 test/sys/kernel/slab/Acpi-Parse/slab_size | 1 - test/sys/kernel/slab/Acpi-Parse/slabs | 1 - test/sys/kernel/slab/Acpi-Parse/store_user | 1 - test/sys/kernel/slab/Acpi-Parse/total_objects | 1 - test/sys/kernel/slab/Acpi-Parse/trace | 1 - test/sys/kernel/slab/Acpi-Parse/validate | 0 test/sys/kernel/slab/Acpi-ParseExt/aliases | 1 - test/sys/kernel/slab/Acpi-ParseExt/align | 1 - test/sys/kernel/slab/Acpi-ParseExt/alloc_calls | 1 - test/sys/kernel/slab/Acpi-ParseExt/cache_dma | 1 - test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs | 1 - test/sys/kernel/slab/Acpi-ParseExt/ctor | 0 test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu | 1 - test/sys/kernel/slab/Acpi-ParseExt/free_calls | 1 - test/sys/kernel/slab/Acpi-ParseExt/hwcache_align | 1 - test/sys/kernel/slab/Acpi-ParseExt/object_size | 1 - test/sys/kernel/slab/Acpi-ParseExt/objects | 1 - test/sys/kernel/slab/Acpi-ParseExt/objects_partial | 1 - test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab | 1 - test/sys/kernel/slab/Acpi-ParseExt/order | 1 - test/sys/kernel/slab/Acpi-ParseExt/partial | 1 - test/sys/kernel/slab/Acpi-ParseExt/poison | 1 - test/sys/kernel/slab/Acpi-ParseExt/reclaim_account | 1 - test/sys/kernel/slab/Acpi-ParseExt/red_zone | 1 - test/sys/kernel/slab/Acpi-ParseExt/sanity_checks | 1 - test/sys/kernel/slab/Acpi-ParseExt/shrink | 0 test/sys/kernel/slab/Acpi-ParseExt/slab_size | 1 - test/sys/kernel/slab/Acpi-ParseExt/slabs | 1 - test/sys/kernel/slab/Acpi-ParseExt/store_user | 1 - test/sys/kernel/slab/Acpi-ParseExt/total_objects | 1 - test/sys/kernel/slab/Acpi-ParseExt/trace | 1 - test/sys/kernel/slab/Acpi-ParseExt/validate | 0 test/sys/kernel/slab/Acpi-State/aliases | 1 - test/sys/kernel/slab/Acpi-State/align | 1 - test/sys/kernel/slab/Acpi-State/alloc_calls | 1 - test/sys/kernel/slab/Acpi-State/cache_dma | 1 - test/sys/kernel/slab/Acpi-State/cpu_slabs | 1 - test/sys/kernel/slab/Acpi-State/ctor | 0 test/sys/kernel/slab/Acpi-State/destroy_by_rcu | 1 - test/sys/kernel/slab/Acpi-State/free_calls | 1 - test/sys/kernel/slab/Acpi-State/hwcache_align | 1 - test/sys/kernel/slab/Acpi-State/object_size | 1 - test/sys/kernel/slab/Acpi-State/objects | 1 - test/sys/kernel/slab/Acpi-State/objects_partial | 1 - test/sys/kernel/slab/Acpi-State/objs_per_slab | 1 - test/sys/kernel/slab/Acpi-State/order | 1 - test/sys/kernel/slab/Acpi-State/partial | 1 - test/sys/kernel/slab/Acpi-State/poison | 1 - test/sys/kernel/slab/Acpi-State/reclaim_account | 1 - test/sys/kernel/slab/Acpi-State/red_zone | 1 - test/sys/kernel/slab/Acpi-State/sanity_checks | 1 - test/sys/kernel/slab/Acpi-State/shrink | 0 test/sys/kernel/slab/Acpi-State/slab_size | 1 - test/sys/kernel/slab/Acpi-State/slabs | 1 - test/sys/kernel/slab/Acpi-State/store_user | 1 - test/sys/kernel/slab/Acpi-State/total_objects | 1 - test/sys/kernel/slab/Acpi-State/trace | 1 - test/sys/kernel/slab/Acpi-State/validate | 0 test/sys/kernel/slab/RAW/aliases | 1 - test/sys/kernel/slab/RAW/align | 1 - test/sys/kernel/slab/RAW/alloc_calls | 1 - test/sys/kernel/slab/RAW/cache_dma | 1 - test/sys/kernel/slab/RAW/cpu_slabs | 1 - test/sys/kernel/slab/RAW/ctor | 0 test/sys/kernel/slab/RAW/destroy_by_rcu | 1 - test/sys/kernel/slab/RAW/free_calls | 1 - test/sys/kernel/slab/RAW/hwcache_align | 1 - test/sys/kernel/slab/RAW/object_size | 1 - test/sys/kernel/slab/RAW/objects | 1 - test/sys/kernel/slab/RAW/objects_partial | 1 - test/sys/kernel/slab/RAW/objs_per_slab | 1 - test/sys/kernel/slab/RAW/order | 1 - test/sys/kernel/slab/RAW/partial | 1 - test/sys/kernel/slab/RAW/poison | 1 - test/sys/kernel/slab/RAW/reclaim_account | 1 - test/sys/kernel/slab/RAW/red_zone | 1 - test/sys/kernel/slab/RAW/sanity_checks | 1 - test/sys/kernel/slab/RAW/shrink | 0 test/sys/kernel/slab/RAW/slab_size | 1 - test/sys/kernel/slab/RAW/slabs | 1 - test/sys/kernel/slab/RAW/store_user | 1 - test/sys/kernel/slab/RAW/total_objects | 1 - test/sys/kernel/slab/RAW/trace | 1 - test/sys/kernel/slab/RAW/validate | 0 test/sys/kernel/slab/RAWv6/aliases | 1 - test/sys/kernel/slab/RAWv6/align | 1 - test/sys/kernel/slab/RAWv6/alloc_calls | 1 - test/sys/kernel/slab/RAWv6/cache_dma | 1 - test/sys/kernel/slab/RAWv6/cpu_slabs | 1 - test/sys/kernel/slab/RAWv6/ctor | 0 test/sys/kernel/slab/RAWv6/destroy_by_rcu | 1 - test/sys/kernel/slab/RAWv6/free_calls | 1 - test/sys/kernel/slab/RAWv6/hwcache_align | 1 - test/sys/kernel/slab/RAWv6/object_size | 1 - test/sys/kernel/slab/RAWv6/objects | 1 - test/sys/kernel/slab/RAWv6/objects_partial | 1 - test/sys/kernel/slab/RAWv6/objs_per_slab | 1 - test/sys/kernel/slab/RAWv6/order | 1 - test/sys/kernel/slab/RAWv6/partial | 1 - test/sys/kernel/slab/RAWv6/poison | 1 - test/sys/kernel/slab/RAWv6/reclaim_account | 1 - test/sys/kernel/slab/RAWv6/red_zone | 1 - test/sys/kernel/slab/RAWv6/sanity_checks | 1 - test/sys/kernel/slab/RAWv6/shrink | 0 test/sys/kernel/slab/RAWv6/slab_size | 1 - test/sys/kernel/slab/RAWv6/slabs | 1 - test/sys/kernel/slab/RAWv6/store_user | 1 - test/sys/kernel/slab/RAWv6/total_objects | 1 - test/sys/kernel/slab/RAWv6/trace | 1 - test/sys/kernel/slab/RAWv6/validate | 0 test/sys/kernel/slab/TCP/aliases | 1 - test/sys/kernel/slab/TCP/align | 1 - test/sys/kernel/slab/TCP/alloc_calls | 1 - test/sys/kernel/slab/TCP/cache_dma | 1 - test/sys/kernel/slab/TCP/cpu_slabs | 1 - test/sys/kernel/slab/TCP/ctor | 0 test/sys/kernel/slab/TCP/destroy_by_rcu | 1 - test/sys/kernel/slab/TCP/free_calls | 1 - test/sys/kernel/slab/TCP/hwcache_align | 1 - test/sys/kernel/slab/TCP/object_size | 1 - test/sys/kernel/slab/TCP/objects | 1 - test/sys/kernel/slab/TCP/objects_partial | 1 - test/sys/kernel/slab/TCP/objs_per_slab | 1 - test/sys/kernel/slab/TCP/order | 1 - test/sys/kernel/slab/TCP/partial | 1 - test/sys/kernel/slab/TCP/poison | 1 - test/sys/kernel/slab/TCP/reclaim_account | 1 - test/sys/kernel/slab/TCP/red_zone | 1 - test/sys/kernel/slab/TCP/sanity_checks | 1 - test/sys/kernel/slab/TCP/shrink | 0 test/sys/kernel/slab/TCP/slab_size | 1 - test/sys/kernel/slab/TCP/slabs | 1 - test/sys/kernel/slab/TCP/store_user | 1 - test/sys/kernel/slab/TCP/total_objects | 1 - test/sys/kernel/slab/TCP/trace | 1 - test/sys/kernel/slab/TCP/validate | 0 test/sys/kernel/slab/TCPv6/aliases | 1 - test/sys/kernel/slab/TCPv6/align | 1 - test/sys/kernel/slab/TCPv6/alloc_calls | 1 - test/sys/kernel/slab/TCPv6/cache_dma | 1 - test/sys/kernel/slab/TCPv6/cpu_slabs | 1 - test/sys/kernel/slab/TCPv6/ctor | 0 test/sys/kernel/slab/TCPv6/destroy_by_rcu | 1 - test/sys/kernel/slab/TCPv6/free_calls | 1 - test/sys/kernel/slab/TCPv6/hwcache_align | 1 - test/sys/kernel/slab/TCPv6/object_size | 1 - test/sys/kernel/slab/TCPv6/objects | 1 - test/sys/kernel/slab/TCPv6/objects_partial | 1 - test/sys/kernel/slab/TCPv6/objs_per_slab | 1 - test/sys/kernel/slab/TCPv6/order | 1 - test/sys/kernel/slab/TCPv6/partial | 1 - test/sys/kernel/slab/TCPv6/poison | 1 - test/sys/kernel/slab/TCPv6/reclaim_account | 1 - test/sys/kernel/slab/TCPv6/red_zone | 1 - test/sys/kernel/slab/TCPv6/sanity_checks | 1 - test/sys/kernel/slab/TCPv6/shrink | 0 test/sys/kernel/slab/TCPv6/slab_size | 1 - test/sys/kernel/slab/TCPv6/slabs | 1 - test/sys/kernel/slab/TCPv6/store_user | 1 - test/sys/kernel/slab/TCPv6/total_objects | 1 - test/sys/kernel/slab/TCPv6/trace | 1 - test/sys/kernel/slab/TCPv6/validate | 0 test/sys/kernel/slab/UDP-Lite/aliases | 1 - test/sys/kernel/slab/UDP-Lite/align | 1 - test/sys/kernel/slab/UDP-Lite/alloc_calls | 1 - test/sys/kernel/slab/UDP-Lite/cache_dma | 1 - test/sys/kernel/slab/UDP-Lite/cpu_slabs | 1 - test/sys/kernel/slab/UDP-Lite/ctor | 0 test/sys/kernel/slab/UDP-Lite/destroy_by_rcu | 1 - test/sys/kernel/slab/UDP-Lite/free_calls | 1 - test/sys/kernel/slab/UDP-Lite/hwcache_align | 1 - test/sys/kernel/slab/UDP-Lite/object_size | 1 - test/sys/kernel/slab/UDP-Lite/objects | 1 - test/sys/kernel/slab/UDP-Lite/objects_partial | 1 - test/sys/kernel/slab/UDP-Lite/objs_per_slab | 1 - test/sys/kernel/slab/UDP-Lite/order | 1 - test/sys/kernel/slab/UDP-Lite/partial | 1 - test/sys/kernel/slab/UDP-Lite/poison | 1 - test/sys/kernel/slab/UDP-Lite/reclaim_account | 1 - test/sys/kernel/slab/UDP-Lite/red_zone | 1 - test/sys/kernel/slab/UDP-Lite/sanity_checks | 1 - test/sys/kernel/slab/UDP-Lite/shrink | 0 test/sys/kernel/slab/UDP-Lite/slab_size | 1 - test/sys/kernel/slab/UDP-Lite/slabs | 1 - test/sys/kernel/slab/UDP-Lite/store_user | 1 - test/sys/kernel/slab/UDP-Lite/total_objects | 1 - test/sys/kernel/slab/UDP-Lite/trace | 1 - test/sys/kernel/slab/UDP-Lite/validate | 0 test/sys/kernel/slab/UDP/aliases | 1 - test/sys/kernel/slab/UDP/align | 1 - test/sys/kernel/slab/UDP/alloc_calls | 1 - test/sys/kernel/slab/UDP/cache_dma | 1 - test/sys/kernel/slab/UDP/cpu_slabs | 1 - test/sys/kernel/slab/UDP/ctor | 0 test/sys/kernel/slab/UDP/destroy_by_rcu | 1 - test/sys/kernel/slab/UDP/free_calls | 2 - test/sys/kernel/slab/UDP/hwcache_align | 1 - test/sys/kernel/slab/UDP/object_size | 1 - test/sys/kernel/slab/UDP/objects | 1 - test/sys/kernel/slab/UDP/objects_partial | 1 - test/sys/kernel/slab/UDP/objs_per_slab | 1 - test/sys/kernel/slab/UDP/order | 1 - test/sys/kernel/slab/UDP/partial | 1 - test/sys/kernel/slab/UDP/poison | 1 - test/sys/kernel/slab/UDP/reclaim_account | 1 - test/sys/kernel/slab/UDP/red_zone | 1 - test/sys/kernel/slab/UDP/sanity_checks | 1 - test/sys/kernel/slab/UDP/shrink | 0 test/sys/kernel/slab/UDP/slab_size | 1 - test/sys/kernel/slab/UDP/slabs | 1 - test/sys/kernel/slab/UDP/store_user | 1 - test/sys/kernel/slab/UDP/total_objects | 1 - test/sys/kernel/slab/UDP/trace | 1 - test/sys/kernel/slab/UDP/validate | 0 test/sys/kernel/slab/UDPLITEv6/aliases | 1 - test/sys/kernel/slab/UDPLITEv6/align | 1 - test/sys/kernel/slab/UDPLITEv6/alloc_calls | 1 - test/sys/kernel/slab/UDPLITEv6/cache_dma | 1 - test/sys/kernel/slab/UDPLITEv6/cpu_slabs | 1 - test/sys/kernel/slab/UDPLITEv6/ctor | 0 test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu | 1 - test/sys/kernel/slab/UDPLITEv6/free_calls | 1 - test/sys/kernel/slab/UDPLITEv6/hwcache_align | 1 - test/sys/kernel/slab/UDPLITEv6/object_size | 1 - test/sys/kernel/slab/UDPLITEv6/objects | 1 - test/sys/kernel/slab/UDPLITEv6/objects_partial | 1 - test/sys/kernel/slab/UDPLITEv6/objs_per_slab | 1 - test/sys/kernel/slab/UDPLITEv6/order | 1 - test/sys/kernel/slab/UDPLITEv6/partial | 1 - test/sys/kernel/slab/UDPLITEv6/poison | 1 - test/sys/kernel/slab/UDPLITEv6/reclaim_account | 1 - test/sys/kernel/slab/UDPLITEv6/red_zone | 1 - test/sys/kernel/slab/UDPLITEv6/sanity_checks | 1 - test/sys/kernel/slab/UDPLITEv6/shrink | 0 test/sys/kernel/slab/UDPLITEv6/slab_size | 1 - test/sys/kernel/slab/UDPLITEv6/slabs | 1 - test/sys/kernel/slab/UDPLITEv6/store_user | 1 - test/sys/kernel/slab/UDPLITEv6/total_objects | 1 - test/sys/kernel/slab/UDPLITEv6/trace | 1 - test/sys/kernel/slab/UDPLITEv6/validate | 0 test/sys/kernel/slab/UDPv6/aliases | 1 - test/sys/kernel/slab/UDPv6/align | 1 - test/sys/kernel/slab/UDPv6/alloc_calls | 1 - test/sys/kernel/slab/UDPv6/cache_dma | 1 - test/sys/kernel/slab/UDPv6/cpu_slabs | 1 - test/sys/kernel/slab/UDPv6/ctor | 0 test/sys/kernel/slab/UDPv6/destroy_by_rcu | 1 - test/sys/kernel/slab/UDPv6/free_calls | 1 - test/sys/kernel/slab/UDPv6/hwcache_align | 1 - test/sys/kernel/slab/UDPv6/object_size | 1 - test/sys/kernel/slab/UDPv6/objects | 1 - test/sys/kernel/slab/UDPv6/objects_partial | 1 - test/sys/kernel/slab/UDPv6/objs_per_slab | 1 - test/sys/kernel/slab/UDPv6/order | 1 - test/sys/kernel/slab/UDPv6/partial | 1 - test/sys/kernel/slab/UDPv6/poison | 1 - test/sys/kernel/slab/UDPv6/reclaim_account | 1 - test/sys/kernel/slab/UDPv6/red_zone | 1 - test/sys/kernel/slab/UDPv6/sanity_checks | 1 - test/sys/kernel/slab/UDPv6/shrink | 0 test/sys/kernel/slab/UDPv6/slab_size | 1 - test/sys/kernel/slab/UDPv6/slabs | 1 - test/sys/kernel/slab/UDPv6/store_user | 1 - test/sys/kernel/slab/UDPv6/total_objects | 1 - test/sys/kernel/slab/UDPv6/trace | 1 - test/sys/kernel/slab/UDPv6/validate | 0 test/sys/kernel/slab/UNIX/aliases | 1 - test/sys/kernel/slab/UNIX/align | 1 - test/sys/kernel/slab/UNIX/alloc_calls | 1 - test/sys/kernel/slab/UNIX/cache_dma | 1 - test/sys/kernel/slab/UNIX/cpu_slabs | 1 - test/sys/kernel/slab/UNIX/ctor | 0 test/sys/kernel/slab/UNIX/destroy_by_rcu | 1 - test/sys/kernel/slab/UNIX/free_calls | 2 - test/sys/kernel/slab/UNIX/hwcache_align | 1 - test/sys/kernel/slab/UNIX/object_size | 1 - test/sys/kernel/slab/UNIX/objects | 1 - test/sys/kernel/slab/UNIX/objects_partial | 1 - test/sys/kernel/slab/UNIX/objs_per_slab | 1 - test/sys/kernel/slab/UNIX/order | 1 - test/sys/kernel/slab/UNIX/partial | 1 - test/sys/kernel/slab/UNIX/poison | 1 - test/sys/kernel/slab/UNIX/reclaim_account | 1 - test/sys/kernel/slab/UNIX/red_zone | 1 - test/sys/kernel/slab/UNIX/sanity_checks | 1 - test/sys/kernel/slab/UNIX/shrink | 0 test/sys/kernel/slab/UNIX/slab_size | 1 - test/sys/kernel/slab/UNIX/slabs | 1 - test/sys/kernel/slab/UNIX/store_user | 1 - test/sys/kernel/slab/UNIX/total_objects | 1 - test/sys/kernel/slab/UNIX/trace | 1 - test/sys/kernel/slab/UNIX/validate | 0 test/sys/kernel/slab/anon_vma/aliases | 1 - test/sys/kernel/slab/anon_vma/align | 1 - test/sys/kernel/slab/anon_vma/alloc_calls | 1 - test/sys/kernel/slab/anon_vma/cache_dma | 1 - test/sys/kernel/slab/anon_vma/cpu_slabs | 1 - test/sys/kernel/slab/anon_vma/ctor | 1 - test/sys/kernel/slab/anon_vma/destroy_by_rcu | 1 - test/sys/kernel/slab/anon_vma/free_calls | 2 - test/sys/kernel/slab/anon_vma/hwcache_align | 1 - test/sys/kernel/slab/anon_vma/object_size | 1 - test/sys/kernel/slab/anon_vma/objects | 1 - test/sys/kernel/slab/anon_vma/objects_partial | 1 - test/sys/kernel/slab/anon_vma/objs_per_slab | 1 - test/sys/kernel/slab/anon_vma/order | 1 - test/sys/kernel/slab/anon_vma/partial | 1 - test/sys/kernel/slab/anon_vma/poison | 1 - test/sys/kernel/slab/anon_vma/reclaim_account | 1 - test/sys/kernel/slab/anon_vma/red_zone | 1 - test/sys/kernel/slab/anon_vma/sanity_checks | 1 - test/sys/kernel/slab/anon_vma/shrink | 0 test/sys/kernel/slab/anon_vma/slab_size | 1 - test/sys/kernel/slab/anon_vma/slabs | 1 - test/sys/kernel/slab/anon_vma/store_user | 1 - test/sys/kernel/slab/anon_vma/total_objects | 1 - test/sys/kernel/slab/anon_vma/trace | 1 - test/sys/kernel/slab/anon_vma/validate | 0 test/sys/kernel/slab/arp_cache/aliases | 1 - test/sys/kernel/slab/arp_cache/align | 1 - test/sys/kernel/slab/arp_cache/alloc_calls | 1 - test/sys/kernel/slab/arp_cache/cache_dma | 1 - test/sys/kernel/slab/arp_cache/cpu_slabs | 1 - test/sys/kernel/slab/arp_cache/ctor | 0 test/sys/kernel/slab/arp_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/arp_cache/free_calls | 1 - test/sys/kernel/slab/arp_cache/hwcache_align | 1 - test/sys/kernel/slab/arp_cache/object_size | 1 - test/sys/kernel/slab/arp_cache/objects | 1 - test/sys/kernel/slab/arp_cache/objects_partial | 1 - test/sys/kernel/slab/arp_cache/objs_per_slab | 1 - test/sys/kernel/slab/arp_cache/order | 1 - test/sys/kernel/slab/arp_cache/partial | 1 - test/sys/kernel/slab/arp_cache/poison | 1 - test/sys/kernel/slab/arp_cache/reclaim_account | 1 - test/sys/kernel/slab/arp_cache/red_zone | 1 - test/sys/kernel/slab/arp_cache/sanity_checks | 1 - test/sys/kernel/slab/arp_cache/shrink | 0 test/sys/kernel/slab/arp_cache/slab_size | 1 - test/sys/kernel/slab/arp_cache/slabs | 1 - test/sys/kernel/slab/arp_cache/store_user | 1 - test/sys/kernel/slab/arp_cache/total_objects | 1 - test/sys/kernel/slab/arp_cache/trace | 1 - test/sys/kernel/slab/arp_cache/validate | 0 test/sys/kernel/slab/bdev_cache/aliases | 1 - test/sys/kernel/slab/bdev_cache/align | 1 - test/sys/kernel/slab/bdev_cache/alloc_calls | 1 - test/sys/kernel/slab/bdev_cache/cache_dma | 1 - test/sys/kernel/slab/bdev_cache/cpu_slabs | 1 - test/sys/kernel/slab/bdev_cache/ctor | 1 - test/sys/kernel/slab/bdev_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/bdev_cache/free_calls | 2 - test/sys/kernel/slab/bdev_cache/hwcache_align | 1 - test/sys/kernel/slab/bdev_cache/object_size | 1 - test/sys/kernel/slab/bdev_cache/objects | 1 - test/sys/kernel/slab/bdev_cache/objects_partial | 1 - test/sys/kernel/slab/bdev_cache/objs_per_slab | 1 - test/sys/kernel/slab/bdev_cache/order | 1 - test/sys/kernel/slab/bdev_cache/partial | 1 - test/sys/kernel/slab/bdev_cache/poison | 1 - test/sys/kernel/slab/bdev_cache/reclaim_account | 1 - test/sys/kernel/slab/bdev_cache/red_zone | 1 - test/sys/kernel/slab/bdev_cache/sanity_checks | 1 - test/sys/kernel/slab/bdev_cache/shrink | 0 test/sys/kernel/slab/bdev_cache/slab_size | 1 - test/sys/kernel/slab/bdev_cache/slabs | 1 - test/sys/kernel/slab/bdev_cache/store_user | 1 - test/sys/kernel/slab/bdev_cache/total_objects | 1 - test/sys/kernel/slab/bdev_cache/trace | 1 - test/sys/kernel/slab/bdev_cache/validate | 0 test/sys/kernel/slab/bio/aliases | 1 - test/sys/kernel/slab/bio/align | 1 - test/sys/kernel/slab/bio/alloc_calls | 1 - test/sys/kernel/slab/bio/cache_dma | 1 - test/sys/kernel/slab/bio/cpu_slabs | 1 - test/sys/kernel/slab/bio/ctor | 0 test/sys/kernel/slab/bio/destroy_by_rcu | 1 - test/sys/kernel/slab/bio/free_calls | 1 - test/sys/kernel/slab/bio/hwcache_align | 1 - test/sys/kernel/slab/bio/object_size | 1 - test/sys/kernel/slab/bio/objects | 1 - test/sys/kernel/slab/bio/objects_partial | 1 - test/sys/kernel/slab/bio/objs_per_slab | 1 - test/sys/kernel/slab/bio/order | 1 - test/sys/kernel/slab/bio/partial | 1 - test/sys/kernel/slab/bio/poison | 1 - test/sys/kernel/slab/bio/reclaim_account | 1 - test/sys/kernel/slab/bio/red_zone | 1 - test/sys/kernel/slab/bio/sanity_checks | 1 - test/sys/kernel/slab/bio/shrink | 0 test/sys/kernel/slab/bio/slab_size | 1 - test/sys/kernel/slab/bio/slabs | 1 - test/sys/kernel/slab/bio/store_user | 1 - test/sys/kernel/slab/bio/total_objects | 1 - test/sys/kernel/slab/bio/trace | 1 - test/sys/kernel/slab/bio/validate | 0 test/sys/kernel/slab/biovec-1/aliases | 1 - test/sys/kernel/slab/biovec-1/align | 1 - test/sys/kernel/slab/biovec-1/alloc_calls | 1 - test/sys/kernel/slab/biovec-1/cache_dma | 1 - test/sys/kernel/slab/biovec-1/cpu_slabs | 1 - test/sys/kernel/slab/biovec-1/ctor | 0 test/sys/kernel/slab/biovec-1/destroy_by_rcu | 1 - test/sys/kernel/slab/biovec-1/free_calls | 1 - test/sys/kernel/slab/biovec-1/hwcache_align | 1 - test/sys/kernel/slab/biovec-1/object_size | 1 - test/sys/kernel/slab/biovec-1/objects | 1 - test/sys/kernel/slab/biovec-1/objects_partial | 1 - test/sys/kernel/slab/biovec-1/objs_per_slab | 1 - test/sys/kernel/slab/biovec-1/order | 1 - test/sys/kernel/slab/biovec-1/partial | 1 - test/sys/kernel/slab/biovec-1/poison | 1 - test/sys/kernel/slab/biovec-1/reclaim_account | 1 - test/sys/kernel/slab/biovec-1/red_zone | 1 - test/sys/kernel/slab/biovec-1/sanity_checks | 1 - test/sys/kernel/slab/biovec-1/shrink | 0 test/sys/kernel/slab/biovec-1/slab_size | 1 - test/sys/kernel/slab/biovec-1/slabs | 1 - test/sys/kernel/slab/biovec-1/store_user | 1 - test/sys/kernel/slab/biovec-1/total_objects | 1 - test/sys/kernel/slab/biovec-1/trace | 1 - test/sys/kernel/slab/biovec-1/validate | 0 test/sys/kernel/slab/biovec-128/aliases | 1 - test/sys/kernel/slab/biovec-128/align | 1 - test/sys/kernel/slab/biovec-128/alloc_calls | 1 - test/sys/kernel/slab/biovec-128/cache_dma | 1 - test/sys/kernel/slab/biovec-128/cpu_slabs | 1 - test/sys/kernel/slab/biovec-128/ctor | 0 test/sys/kernel/slab/biovec-128/destroy_by_rcu | 1 - test/sys/kernel/slab/biovec-128/free_calls | 1 - test/sys/kernel/slab/biovec-128/hwcache_align | 1 - test/sys/kernel/slab/biovec-128/object_size | 1 - test/sys/kernel/slab/biovec-128/objects | 1 - test/sys/kernel/slab/biovec-128/objects_partial | 1 - test/sys/kernel/slab/biovec-128/objs_per_slab | 1 - test/sys/kernel/slab/biovec-128/order | 1 - test/sys/kernel/slab/biovec-128/partial | 1 - test/sys/kernel/slab/biovec-128/poison | 1 - test/sys/kernel/slab/biovec-128/reclaim_account | 1 - test/sys/kernel/slab/biovec-128/red_zone | 1 - test/sys/kernel/slab/biovec-128/sanity_checks | 1 - test/sys/kernel/slab/biovec-128/shrink | 0 test/sys/kernel/slab/biovec-128/slab_size | 1 - test/sys/kernel/slab/biovec-128/slabs | 1 - test/sys/kernel/slab/biovec-128/store_user | 1 - test/sys/kernel/slab/biovec-128/total_objects | 1 - test/sys/kernel/slab/biovec-128/trace | 1 - test/sys/kernel/slab/biovec-128/validate | 0 test/sys/kernel/slab/biovec-16/aliases | 1 - test/sys/kernel/slab/biovec-16/align | 1 - test/sys/kernel/slab/biovec-16/alloc_calls | 1 - test/sys/kernel/slab/biovec-16/cache_dma | 1 - test/sys/kernel/slab/biovec-16/cpu_slabs | 1 - test/sys/kernel/slab/biovec-16/ctor | 0 test/sys/kernel/slab/biovec-16/destroy_by_rcu | 1 - test/sys/kernel/slab/biovec-16/free_calls | 1 - test/sys/kernel/slab/biovec-16/hwcache_align | 1 - test/sys/kernel/slab/biovec-16/object_size | 1 - test/sys/kernel/slab/biovec-16/objects | 1 - test/sys/kernel/slab/biovec-16/objects_partial | 1 - test/sys/kernel/slab/biovec-16/objs_per_slab | 1 - test/sys/kernel/slab/biovec-16/order | 1 - test/sys/kernel/slab/biovec-16/partial | 1 - test/sys/kernel/slab/biovec-16/poison | 1 - test/sys/kernel/slab/biovec-16/reclaim_account | 1 - test/sys/kernel/slab/biovec-16/red_zone | 1 - test/sys/kernel/slab/biovec-16/sanity_checks | 1 - test/sys/kernel/slab/biovec-16/shrink | 0 test/sys/kernel/slab/biovec-16/slab_size | 1 - test/sys/kernel/slab/biovec-16/slabs | 1 - test/sys/kernel/slab/biovec-16/store_user | 1 - test/sys/kernel/slab/biovec-16/total_objects | 1 - test/sys/kernel/slab/biovec-16/trace | 1 - test/sys/kernel/slab/biovec-16/validate | 0 test/sys/kernel/slab/biovec-256/aliases | 1 - test/sys/kernel/slab/biovec-256/align | 1 - test/sys/kernel/slab/biovec-256/alloc_calls | 1 - test/sys/kernel/slab/biovec-256/cache_dma | 1 - test/sys/kernel/slab/biovec-256/cpu_slabs | 1 - test/sys/kernel/slab/biovec-256/ctor | 0 test/sys/kernel/slab/biovec-256/destroy_by_rcu | 1 - test/sys/kernel/slab/biovec-256/free_calls | 1 - test/sys/kernel/slab/biovec-256/hwcache_align | 1 - test/sys/kernel/slab/biovec-256/object_size | 1 - test/sys/kernel/slab/biovec-256/objects | 1 - test/sys/kernel/slab/biovec-256/objects_partial | 1 - test/sys/kernel/slab/biovec-256/objs_per_slab | 1 - test/sys/kernel/slab/biovec-256/order | 1 - test/sys/kernel/slab/biovec-256/partial | 1 - test/sys/kernel/slab/biovec-256/poison | 1 - test/sys/kernel/slab/biovec-256/reclaim_account | 1 - test/sys/kernel/slab/biovec-256/red_zone | 1 - test/sys/kernel/slab/biovec-256/sanity_checks | 1 - test/sys/kernel/slab/biovec-256/shrink | 0 test/sys/kernel/slab/biovec-256/slab_size | 1 - test/sys/kernel/slab/biovec-256/slabs | 1 - test/sys/kernel/slab/biovec-256/store_user | 1 - test/sys/kernel/slab/biovec-256/total_objects | 1 - test/sys/kernel/slab/biovec-256/trace | 1 - test/sys/kernel/slab/biovec-256/validate | 0 test/sys/kernel/slab/biovec-4/aliases | 1 - test/sys/kernel/slab/biovec-4/align | 1 - test/sys/kernel/slab/biovec-4/alloc_calls | 1 - test/sys/kernel/slab/biovec-4/cache_dma | 1 - test/sys/kernel/slab/biovec-4/cpu_slabs | 1 - test/sys/kernel/slab/biovec-4/ctor | 0 test/sys/kernel/slab/biovec-4/destroy_by_rcu | 1 - test/sys/kernel/slab/biovec-4/free_calls | 1 - test/sys/kernel/slab/biovec-4/hwcache_align | 1 - test/sys/kernel/slab/biovec-4/object_size | 1 - test/sys/kernel/slab/biovec-4/objects | 1 - test/sys/kernel/slab/biovec-4/objects_partial | 1 - test/sys/kernel/slab/biovec-4/objs_per_slab | 1 - test/sys/kernel/slab/biovec-4/order | 1 - test/sys/kernel/slab/biovec-4/partial | 1 - test/sys/kernel/slab/biovec-4/poison | 1 - test/sys/kernel/slab/biovec-4/reclaim_account | 1 - test/sys/kernel/slab/biovec-4/red_zone | 1 - test/sys/kernel/slab/biovec-4/sanity_checks | 1 - test/sys/kernel/slab/biovec-4/shrink | 0 test/sys/kernel/slab/biovec-4/slab_size | 1 - test/sys/kernel/slab/biovec-4/slabs | 1 - test/sys/kernel/slab/biovec-4/store_user | 1 - test/sys/kernel/slab/biovec-4/total_objects | 1 - test/sys/kernel/slab/biovec-4/trace | 1 - test/sys/kernel/slab/biovec-4/validate | 0 test/sys/kernel/slab/biovec-64/aliases | 1 - test/sys/kernel/slab/biovec-64/align | 1 - test/sys/kernel/slab/biovec-64/alloc_calls | 1 - test/sys/kernel/slab/biovec-64/cache_dma | 1 - test/sys/kernel/slab/biovec-64/cpu_slabs | 1 - test/sys/kernel/slab/biovec-64/ctor | 0 test/sys/kernel/slab/biovec-64/destroy_by_rcu | 1 - test/sys/kernel/slab/biovec-64/free_calls | 1 - test/sys/kernel/slab/biovec-64/hwcache_align | 1 - test/sys/kernel/slab/biovec-64/object_size | 1 - test/sys/kernel/slab/biovec-64/objects | 1 - test/sys/kernel/slab/biovec-64/objects_partial | 1 - test/sys/kernel/slab/biovec-64/objs_per_slab | 1 - test/sys/kernel/slab/biovec-64/order | 1 - test/sys/kernel/slab/biovec-64/partial | 1 - test/sys/kernel/slab/biovec-64/poison | 1 - test/sys/kernel/slab/biovec-64/reclaim_account | 1 - test/sys/kernel/slab/biovec-64/red_zone | 1 - test/sys/kernel/slab/biovec-64/sanity_checks | 1 - test/sys/kernel/slab/biovec-64/shrink | 0 test/sys/kernel/slab/biovec-64/slab_size | 1 - test/sys/kernel/slab/biovec-64/slabs | 1 - test/sys/kernel/slab/biovec-64/store_user | 1 - test/sys/kernel/slab/biovec-64/total_objects | 1 - test/sys/kernel/slab/biovec-64/trace | 1 - test/sys/kernel/slab/biovec-64/validate | 0 test/sys/kernel/slab/blkdev_ioc/aliases | 1 - test/sys/kernel/slab/blkdev_ioc/align | 1 - test/sys/kernel/slab/blkdev_ioc/alloc_calls | 1 - test/sys/kernel/slab/blkdev_ioc/cache_dma | 1 - test/sys/kernel/slab/blkdev_ioc/cpu_slabs | 1 - test/sys/kernel/slab/blkdev_ioc/ctor | 0 test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu | 1 - test/sys/kernel/slab/blkdev_ioc/free_calls | 2 - test/sys/kernel/slab/blkdev_ioc/hwcache_align | 1 - test/sys/kernel/slab/blkdev_ioc/object_size | 1 - test/sys/kernel/slab/blkdev_ioc/objects | 1 - test/sys/kernel/slab/blkdev_ioc/objects_partial | 1 - test/sys/kernel/slab/blkdev_ioc/objs_per_slab | 1 - test/sys/kernel/slab/blkdev_ioc/order | 1 - test/sys/kernel/slab/blkdev_ioc/partial | 1 - test/sys/kernel/slab/blkdev_ioc/poison | 1 - test/sys/kernel/slab/blkdev_ioc/reclaim_account | 1 - test/sys/kernel/slab/blkdev_ioc/red_zone | 1 - test/sys/kernel/slab/blkdev_ioc/sanity_checks | 1 - test/sys/kernel/slab/blkdev_ioc/shrink | 0 test/sys/kernel/slab/blkdev_ioc/slab_size | 1 - test/sys/kernel/slab/blkdev_ioc/slabs | 1 - test/sys/kernel/slab/blkdev_ioc/store_user | 1 - test/sys/kernel/slab/blkdev_ioc/total_objects | 1 - test/sys/kernel/slab/blkdev_ioc/trace | 1 - test/sys/kernel/slab/blkdev_ioc/validate | 0 test/sys/kernel/slab/blkdev_queue/aliases | 1 - test/sys/kernel/slab/blkdev_queue/align | 1 - test/sys/kernel/slab/blkdev_queue/alloc_calls | 1 - test/sys/kernel/slab/blkdev_queue/cache_dma | 1 - test/sys/kernel/slab/blkdev_queue/cpu_slabs | 1 - test/sys/kernel/slab/blkdev_queue/ctor | 0 test/sys/kernel/slab/blkdev_queue/destroy_by_rcu | 1 - test/sys/kernel/slab/blkdev_queue/free_calls | 1 - test/sys/kernel/slab/blkdev_queue/hwcache_align | 1 - test/sys/kernel/slab/blkdev_queue/object_size | 1 - test/sys/kernel/slab/blkdev_queue/objects | 1 - test/sys/kernel/slab/blkdev_queue/objects_partial | 1 - test/sys/kernel/slab/blkdev_queue/objs_per_slab | 1 - test/sys/kernel/slab/blkdev_queue/order | 1 - test/sys/kernel/slab/blkdev_queue/partial | 1 - test/sys/kernel/slab/blkdev_queue/poison | 1 - test/sys/kernel/slab/blkdev_queue/reclaim_account | 1 - test/sys/kernel/slab/blkdev_queue/red_zone | 1 - test/sys/kernel/slab/blkdev_queue/sanity_checks | 1 - test/sys/kernel/slab/blkdev_queue/shrink | 0 test/sys/kernel/slab/blkdev_queue/slab_size | 1 - test/sys/kernel/slab/blkdev_queue/slabs | 1 - test/sys/kernel/slab/blkdev_queue/store_user | 1 - test/sys/kernel/slab/blkdev_queue/total_objects | 1 - test/sys/kernel/slab/blkdev_queue/trace | 1 - test/sys/kernel/slab/blkdev_queue/validate | 0 test/sys/kernel/slab/blkdev_requests/aliases | 1 - test/sys/kernel/slab/blkdev_requests/align | 1 - test/sys/kernel/slab/blkdev_requests/alloc_calls | 1 - test/sys/kernel/slab/blkdev_requests/cache_dma | 1 - test/sys/kernel/slab/blkdev_requests/cpu_slabs | 1 - test/sys/kernel/slab/blkdev_requests/ctor | 0 .../sys/kernel/slab/blkdev_requests/destroy_by_rcu | 1 - test/sys/kernel/slab/blkdev_requests/free_calls | 2 - test/sys/kernel/slab/blkdev_requests/hwcache_align | 1 - test/sys/kernel/slab/blkdev_requests/object_size | 1 - test/sys/kernel/slab/blkdev_requests/objects | 1 - .../kernel/slab/blkdev_requests/objects_partial | 1 - test/sys/kernel/slab/blkdev_requests/objs_per_slab | 1 - test/sys/kernel/slab/blkdev_requests/order | 1 - test/sys/kernel/slab/blkdev_requests/partial | 1 - test/sys/kernel/slab/blkdev_requests/poison | 1 - .../kernel/slab/blkdev_requests/reclaim_account | 1 - test/sys/kernel/slab/blkdev_requests/red_zone | 1 - test/sys/kernel/slab/blkdev_requests/sanity_checks | 1 - test/sys/kernel/slab/blkdev_requests/shrink | 0 test/sys/kernel/slab/blkdev_requests/slab_size | 1 - test/sys/kernel/slab/blkdev_requests/slabs | 1 - test/sys/kernel/slab/blkdev_requests/store_user | 1 - test/sys/kernel/slab/blkdev_requests/total_objects | 1 - test/sys/kernel/slab/blkdev_requests/trace | 1 - test/sys/kernel/slab/blkdev_requests/validate | 0 test/sys/kernel/slab/bsg_cmd/aliases | 1 - test/sys/kernel/slab/bsg_cmd/align | 1 - test/sys/kernel/slab/bsg_cmd/alloc_calls | 1 - test/sys/kernel/slab/bsg_cmd/cache_dma | 1 - test/sys/kernel/slab/bsg_cmd/cpu_slabs | 1 - test/sys/kernel/slab/bsg_cmd/ctor | 0 test/sys/kernel/slab/bsg_cmd/destroy_by_rcu | 1 - test/sys/kernel/slab/bsg_cmd/free_calls | 1 - test/sys/kernel/slab/bsg_cmd/hwcache_align | 1 - test/sys/kernel/slab/bsg_cmd/object_size | 1 - test/sys/kernel/slab/bsg_cmd/objects | 1 - test/sys/kernel/slab/bsg_cmd/objects_partial | 1 - test/sys/kernel/slab/bsg_cmd/objs_per_slab | 1 - test/sys/kernel/slab/bsg_cmd/order | 1 - test/sys/kernel/slab/bsg_cmd/partial | 1 - test/sys/kernel/slab/bsg_cmd/poison | 1 - test/sys/kernel/slab/bsg_cmd/reclaim_account | 1 - test/sys/kernel/slab/bsg_cmd/red_zone | 1 - test/sys/kernel/slab/bsg_cmd/sanity_checks | 1 - test/sys/kernel/slab/bsg_cmd/shrink | 0 test/sys/kernel/slab/bsg_cmd/slab_size | 1 - test/sys/kernel/slab/bsg_cmd/slabs | 1 - test/sys/kernel/slab/bsg_cmd/store_user | 1 - test/sys/kernel/slab/bsg_cmd/total_objects | 1 - test/sys/kernel/slab/bsg_cmd/trace | 1 - test/sys/kernel/slab/bsg_cmd/validate | 0 test/sys/kernel/slab/buffer_head/aliases | 1 - test/sys/kernel/slab/buffer_head/align | 1 - test/sys/kernel/slab/buffer_head/alloc_calls | 1 - test/sys/kernel/slab/buffer_head/cache_dma | 1 - test/sys/kernel/slab/buffer_head/cpu_slabs | 1 - test/sys/kernel/slab/buffer_head/ctor | 1 - test/sys/kernel/slab/buffer_head/destroy_by_rcu | 1 - test/sys/kernel/slab/buffer_head/free_calls | 2 - test/sys/kernel/slab/buffer_head/hwcache_align | 1 - test/sys/kernel/slab/buffer_head/object_size | 1 - test/sys/kernel/slab/buffer_head/objects | 1 - test/sys/kernel/slab/buffer_head/objects_partial | 1 - test/sys/kernel/slab/buffer_head/objs_per_slab | 1 - test/sys/kernel/slab/buffer_head/order | 1 - test/sys/kernel/slab/buffer_head/partial | 1 - test/sys/kernel/slab/buffer_head/poison | 1 - test/sys/kernel/slab/buffer_head/reclaim_account | 1 - test/sys/kernel/slab/buffer_head/red_zone | 1 - test/sys/kernel/slab/buffer_head/sanity_checks | 1 - test/sys/kernel/slab/buffer_head/shrink | 0 test/sys/kernel/slab/buffer_head/slab_size | 1 - test/sys/kernel/slab/buffer_head/slabs | 1 - test/sys/kernel/slab/buffer_head/store_user | 1 - test/sys/kernel/slab/buffer_head/total_objects | 1 - test/sys/kernel/slab/buffer_head/trace | 1 - test/sys/kernel/slab/buffer_head/validate | 0 test/sys/kernel/slab/cfq_io_context/aliases | 1 - test/sys/kernel/slab/cfq_io_context/align | 1 - test/sys/kernel/slab/cfq_io_context/alloc_calls | 1 - test/sys/kernel/slab/cfq_io_context/cache_dma | 1 - test/sys/kernel/slab/cfq_io_context/cpu_slabs | 1 - test/sys/kernel/slab/cfq_io_context/ctor | 0 test/sys/kernel/slab/cfq_io_context/destroy_by_rcu | 1 - test/sys/kernel/slab/cfq_io_context/free_calls | 2 - test/sys/kernel/slab/cfq_io_context/hwcache_align | 1 - test/sys/kernel/slab/cfq_io_context/object_size | 1 - test/sys/kernel/slab/cfq_io_context/objects | 1 - .../sys/kernel/slab/cfq_io_context/objects_partial | 1 - test/sys/kernel/slab/cfq_io_context/objs_per_slab | 1 - test/sys/kernel/slab/cfq_io_context/order | 1 - test/sys/kernel/slab/cfq_io_context/partial | 1 - test/sys/kernel/slab/cfq_io_context/poison | 1 - .../sys/kernel/slab/cfq_io_context/reclaim_account | 1 - test/sys/kernel/slab/cfq_io_context/red_zone | 1 - test/sys/kernel/slab/cfq_io_context/sanity_checks | 1 - test/sys/kernel/slab/cfq_io_context/shrink | 0 test/sys/kernel/slab/cfq_io_context/slab_size | 1 - test/sys/kernel/slab/cfq_io_context/slabs | 1 - test/sys/kernel/slab/cfq_io_context/store_user | 1 - test/sys/kernel/slab/cfq_io_context/total_objects | 1 - test/sys/kernel/slab/cfq_io_context/trace | 1 - test/sys/kernel/slab/cfq_io_context/validate | 0 test/sys/kernel/slab/cfq_queue/aliases | 1 - test/sys/kernel/slab/cfq_queue/align | 1 - test/sys/kernel/slab/cfq_queue/alloc_calls | 1 - test/sys/kernel/slab/cfq_queue/cache_dma | 1 - test/sys/kernel/slab/cfq_queue/cpu_slabs | 1 - test/sys/kernel/slab/cfq_queue/ctor | 0 test/sys/kernel/slab/cfq_queue/destroy_by_rcu | 1 - test/sys/kernel/slab/cfq_queue/free_calls | 2 - test/sys/kernel/slab/cfq_queue/hwcache_align | 1 - test/sys/kernel/slab/cfq_queue/object_size | 1 - test/sys/kernel/slab/cfq_queue/objects | 1 - test/sys/kernel/slab/cfq_queue/objects_partial | 1 - test/sys/kernel/slab/cfq_queue/objs_per_slab | 1 - test/sys/kernel/slab/cfq_queue/order | 1 - test/sys/kernel/slab/cfq_queue/partial | 1 - test/sys/kernel/slab/cfq_queue/poison | 1 - test/sys/kernel/slab/cfq_queue/reclaim_account | 1 - test/sys/kernel/slab/cfq_queue/red_zone | 1 - test/sys/kernel/slab/cfq_queue/sanity_checks | 1 - test/sys/kernel/slab/cfq_queue/shrink | 0 test/sys/kernel/slab/cfq_queue/slab_size | 1 - test/sys/kernel/slab/cfq_queue/slabs | 1 - test/sys/kernel/slab/cfq_queue/store_user | 1 - test/sys/kernel/slab/cfq_queue/total_objects | 1 - test/sys/kernel/slab/cfq_queue/trace | 1 - test/sys/kernel/slab/cfq_queue/validate | 0 test/sys/kernel/slab/dentry/aliases | 1 - test/sys/kernel/slab/dentry/align | 1 - test/sys/kernel/slab/dentry/alloc_calls | 1 - test/sys/kernel/slab/dentry/cache_dma | 1 - test/sys/kernel/slab/dentry/cpu_slabs | 1 - test/sys/kernel/slab/dentry/ctor | 0 test/sys/kernel/slab/dentry/destroy_by_rcu | 1 - test/sys/kernel/slab/dentry/free_calls | 3 - test/sys/kernel/slab/dentry/hwcache_align | 1 - test/sys/kernel/slab/dentry/object_size | 1 - test/sys/kernel/slab/dentry/objects | 1 - test/sys/kernel/slab/dentry/objects_partial | 1 - test/sys/kernel/slab/dentry/objs_per_slab | 1 - test/sys/kernel/slab/dentry/order | 1 - test/sys/kernel/slab/dentry/partial | 1 - test/sys/kernel/slab/dentry/poison | 1 - test/sys/kernel/slab/dentry/reclaim_account | 1 - test/sys/kernel/slab/dentry/red_zone | 1 - test/sys/kernel/slab/dentry/sanity_checks | 1 - test/sys/kernel/slab/dentry/shrink | 0 test/sys/kernel/slab/dentry/slab_size | 1 - test/sys/kernel/slab/dentry/slabs | 1 - test/sys/kernel/slab/dentry/store_user | 1 - test/sys/kernel/slab/dentry/total_objects | 1 - test/sys/kernel/slab/dentry/trace | 1 - test/sys/kernel/slab/dentry/validate | 0 test/sys/kernel/slab/dm_io/aliases | 1 - test/sys/kernel/slab/dm_io/align | 1 - test/sys/kernel/slab/dm_io/alloc_calls | 1 - test/sys/kernel/slab/dm_io/cache_dma | 1 - test/sys/kernel/slab/dm_io/cpu_slabs | 1 - test/sys/kernel/slab/dm_io/ctor | 0 test/sys/kernel/slab/dm_io/destroy_by_rcu | 1 - test/sys/kernel/slab/dm_io/free_calls | 1 - test/sys/kernel/slab/dm_io/hwcache_align | 1 - test/sys/kernel/slab/dm_io/object_size | 1 - test/sys/kernel/slab/dm_io/objects | 1 - test/sys/kernel/slab/dm_io/objects_partial | 1 - test/sys/kernel/slab/dm_io/objs_per_slab | 1 - test/sys/kernel/slab/dm_io/order | 1 - test/sys/kernel/slab/dm_io/partial | 1 - test/sys/kernel/slab/dm_io/poison | 1 - test/sys/kernel/slab/dm_io/reclaim_account | 1 - test/sys/kernel/slab/dm_io/red_zone | 1 - test/sys/kernel/slab/dm_io/sanity_checks | 1 - test/sys/kernel/slab/dm_io/shrink | 0 test/sys/kernel/slab/dm_io/slab_size | 1 - test/sys/kernel/slab/dm_io/slabs | 1 - test/sys/kernel/slab/dm_io/store_user | 1 - test/sys/kernel/slab/dm_io/total_objects | 1 - test/sys/kernel/slab/dm_io/trace | 1 - test/sys/kernel/slab/dm_io/validate | 0 test/sys/kernel/slab/dm_target_io/aliases | 1 - test/sys/kernel/slab/dm_target_io/align | 1 - test/sys/kernel/slab/dm_target_io/alloc_calls | 1 - test/sys/kernel/slab/dm_target_io/cache_dma | 1 - test/sys/kernel/slab/dm_target_io/cpu_slabs | 1 - test/sys/kernel/slab/dm_target_io/ctor | 0 test/sys/kernel/slab/dm_target_io/destroy_by_rcu | 1 - test/sys/kernel/slab/dm_target_io/free_calls | 1 - test/sys/kernel/slab/dm_target_io/hwcache_align | 1 - test/sys/kernel/slab/dm_target_io/object_size | 1 - test/sys/kernel/slab/dm_target_io/objects | 1 - test/sys/kernel/slab/dm_target_io/objects_partial | 1 - test/sys/kernel/slab/dm_target_io/objs_per_slab | 1 - test/sys/kernel/slab/dm_target_io/order | 1 - test/sys/kernel/slab/dm_target_io/partial | 1 - test/sys/kernel/slab/dm_target_io/poison | 1 - test/sys/kernel/slab/dm_target_io/reclaim_account | 1 - test/sys/kernel/slab/dm_target_io/red_zone | 1 - test/sys/kernel/slab/dm_target_io/sanity_checks | 1 - test/sys/kernel/slab/dm_target_io/shrink | 0 test/sys/kernel/slab/dm_target_io/slab_size | 1 - test/sys/kernel/slab/dm_target_io/slabs | 1 - test/sys/kernel/slab/dm_target_io/store_user | 1 - test/sys/kernel/slab/dm_target_io/total_objects | 1 - test/sys/kernel/slab/dm_target_io/trace | 1 - test/sys/kernel/slab/dm_target_io/validate | 0 test/sys/kernel/slab/dnotify_cache/aliases | 1 - test/sys/kernel/slab/dnotify_cache/align | 1 - test/sys/kernel/slab/dnotify_cache/alloc_calls | 1 - test/sys/kernel/slab/dnotify_cache/cache_dma | 1 - test/sys/kernel/slab/dnotify_cache/cpu_slabs | 1 - test/sys/kernel/slab/dnotify_cache/ctor | 0 test/sys/kernel/slab/dnotify_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/dnotify_cache/free_calls | 1 - test/sys/kernel/slab/dnotify_cache/hwcache_align | 1 - test/sys/kernel/slab/dnotify_cache/object_size | 1 - test/sys/kernel/slab/dnotify_cache/objects | 1 - test/sys/kernel/slab/dnotify_cache/objects_partial | 1 - test/sys/kernel/slab/dnotify_cache/objs_per_slab | 1 - test/sys/kernel/slab/dnotify_cache/order | 1 - test/sys/kernel/slab/dnotify_cache/partial | 1 - test/sys/kernel/slab/dnotify_cache/poison | 1 - test/sys/kernel/slab/dnotify_cache/reclaim_account | 1 - test/sys/kernel/slab/dnotify_cache/red_zone | 1 - test/sys/kernel/slab/dnotify_cache/sanity_checks | 1 - test/sys/kernel/slab/dnotify_cache/shrink | 0 test/sys/kernel/slab/dnotify_cache/slab_size | 1 - test/sys/kernel/slab/dnotify_cache/slabs | 1 - test/sys/kernel/slab/dnotify_cache/store_user | 1 - test/sys/kernel/slab/dnotify_cache/total_objects | 1 - test/sys/kernel/slab/dnotify_cache/trace | 1 - test/sys/kernel/slab/dnotify_cache/validate | 0 test/sys/kernel/slab/eventpoll_epi/aliases | 1 - test/sys/kernel/slab/eventpoll_epi/align | 1 - test/sys/kernel/slab/eventpoll_epi/alloc_calls | 1 - test/sys/kernel/slab/eventpoll_epi/cache_dma | 1 - test/sys/kernel/slab/eventpoll_epi/cpu_slabs | 1 - test/sys/kernel/slab/eventpoll_epi/ctor | 0 test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu | 1 - test/sys/kernel/slab/eventpoll_epi/free_calls | 2 - test/sys/kernel/slab/eventpoll_epi/hwcache_align | 1 - test/sys/kernel/slab/eventpoll_epi/object_size | 1 - test/sys/kernel/slab/eventpoll_epi/objects | 1 - test/sys/kernel/slab/eventpoll_epi/objects_partial | 1 - test/sys/kernel/slab/eventpoll_epi/objs_per_slab | 1 - test/sys/kernel/slab/eventpoll_epi/order | 1 - test/sys/kernel/slab/eventpoll_epi/partial | 1 - test/sys/kernel/slab/eventpoll_epi/poison | 1 - test/sys/kernel/slab/eventpoll_epi/reclaim_account | 1 - test/sys/kernel/slab/eventpoll_epi/red_zone | 1 - test/sys/kernel/slab/eventpoll_epi/sanity_checks | 1 - test/sys/kernel/slab/eventpoll_epi/shrink | 0 test/sys/kernel/slab/eventpoll_epi/slab_size | 1 - test/sys/kernel/slab/eventpoll_epi/slabs | 1 - test/sys/kernel/slab/eventpoll_epi/store_user | 1 - test/sys/kernel/slab/eventpoll_epi/total_objects | 1 - test/sys/kernel/slab/eventpoll_epi/trace | 1 - test/sys/kernel/slab/eventpoll_epi/validate | 0 test/sys/kernel/slab/eventpoll_pwq/aliases | 1 - test/sys/kernel/slab/eventpoll_pwq/align | 1 - test/sys/kernel/slab/eventpoll_pwq/alloc_calls | 1 - test/sys/kernel/slab/eventpoll_pwq/cache_dma | 1 - test/sys/kernel/slab/eventpoll_pwq/cpu_slabs | 1 - test/sys/kernel/slab/eventpoll_pwq/ctor | 0 test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu | 1 - test/sys/kernel/slab/eventpoll_pwq/free_calls | 2 - test/sys/kernel/slab/eventpoll_pwq/hwcache_align | 1 - test/sys/kernel/slab/eventpoll_pwq/object_size | 1 - test/sys/kernel/slab/eventpoll_pwq/objects | 1 - test/sys/kernel/slab/eventpoll_pwq/objects_partial | 1 - test/sys/kernel/slab/eventpoll_pwq/objs_per_slab | 1 - test/sys/kernel/slab/eventpoll_pwq/order | 1 - test/sys/kernel/slab/eventpoll_pwq/partial | 1 - test/sys/kernel/slab/eventpoll_pwq/poison | 1 - test/sys/kernel/slab/eventpoll_pwq/reclaim_account | 1 - test/sys/kernel/slab/eventpoll_pwq/red_zone | 1 - test/sys/kernel/slab/eventpoll_pwq/sanity_checks | 1 - test/sys/kernel/slab/eventpoll_pwq/shrink | 0 test/sys/kernel/slab/eventpoll_pwq/slab_size | 1 - test/sys/kernel/slab/eventpoll_pwq/slabs | 1 - test/sys/kernel/slab/eventpoll_pwq/store_user | 1 - test/sys/kernel/slab/eventpoll_pwq/total_objects | 1 - test/sys/kernel/slab/eventpoll_pwq/trace | 1 - test/sys/kernel/slab/eventpoll_pwq/validate | 0 test/sys/kernel/slab/ext2_inode_cache/aliases | 1 - test/sys/kernel/slab/ext2_inode_cache/align | 1 - test/sys/kernel/slab/ext2_inode_cache/alloc_calls | 1 - test/sys/kernel/slab/ext2_inode_cache/cache_dma | 1 - test/sys/kernel/slab/ext2_inode_cache/cpu_slabs | 1 - test/sys/kernel/slab/ext2_inode_cache/ctor | 1 - .../kernel/slab/ext2_inode_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/ext2_inode_cache/free_calls | 1 - .../sys/kernel/slab/ext2_inode_cache/hwcache_align | 1 - test/sys/kernel/slab/ext2_inode_cache/object_size | 1 - test/sys/kernel/slab/ext2_inode_cache/objects | 1 - .../kernel/slab/ext2_inode_cache/objects_partial | 1 - .../sys/kernel/slab/ext2_inode_cache/objs_per_slab | 1 - test/sys/kernel/slab/ext2_inode_cache/order | 1 - test/sys/kernel/slab/ext2_inode_cache/partial | 1 - test/sys/kernel/slab/ext2_inode_cache/poison | 1 - .../kernel/slab/ext2_inode_cache/reclaim_account | 1 - test/sys/kernel/slab/ext2_inode_cache/red_zone | 1 - .../sys/kernel/slab/ext2_inode_cache/sanity_checks | 1 - test/sys/kernel/slab/ext2_inode_cache/shrink | 0 test/sys/kernel/slab/ext2_inode_cache/slab_size | 1 - test/sys/kernel/slab/ext2_inode_cache/slabs | 1 - test/sys/kernel/slab/ext2_inode_cache/store_user | 1 - .../sys/kernel/slab/ext2_inode_cache/total_objects | 1 - test/sys/kernel/slab/ext2_inode_cache/trace | 1 - test/sys/kernel/slab/ext2_inode_cache/validate | 0 test/sys/kernel/slab/ext3_inode_cache/aliases | 1 - test/sys/kernel/slab/ext3_inode_cache/align | 1 - test/sys/kernel/slab/ext3_inode_cache/alloc_calls | 1 - test/sys/kernel/slab/ext3_inode_cache/cache_dma | 1 - test/sys/kernel/slab/ext3_inode_cache/cpu_slabs | 1 - test/sys/kernel/slab/ext3_inode_cache/ctor | 1 - .../kernel/slab/ext3_inode_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/ext3_inode_cache/free_calls | 2 - .../sys/kernel/slab/ext3_inode_cache/hwcache_align | 1 - test/sys/kernel/slab/ext3_inode_cache/object_size | 1 - test/sys/kernel/slab/ext3_inode_cache/objects | 1 - .../kernel/slab/ext3_inode_cache/objects_partial | 1 - .../sys/kernel/slab/ext3_inode_cache/objs_per_slab | 1 - test/sys/kernel/slab/ext3_inode_cache/order | 1 - test/sys/kernel/slab/ext3_inode_cache/partial | 1 - test/sys/kernel/slab/ext3_inode_cache/poison | 1 - .../kernel/slab/ext3_inode_cache/reclaim_account | 1 - test/sys/kernel/slab/ext3_inode_cache/red_zone | 1 - .../sys/kernel/slab/ext3_inode_cache/sanity_checks | 1 - test/sys/kernel/slab/ext3_inode_cache/shrink | 0 test/sys/kernel/slab/ext3_inode_cache/slab_size | 1 - test/sys/kernel/slab/ext3_inode_cache/slabs | 1 - test/sys/kernel/slab/ext3_inode_cache/store_user | 1 - .../sys/kernel/slab/ext3_inode_cache/total_objects | 1 - test/sys/kernel/slab/ext3_inode_cache/trace | 1 - test/sys/kernel/slab/ext3_inode_cache/validate | 0 test/sys/kernel/slab/ext3_xattr/aliases | 1 - test/sys/kernel/slab/ext3_xattr/align | 1 - test/sys/kernel/slab/ext3_xattr/alloc_calls | 1 - test/sys/kernel/slab/ext3_xattr/cache_dma | 1 - test/sys/kernel/slab/ext3_xattr/cpu_slabs | 1 - test/sys/kernel/slab/ext3_xattr/ctor | 0 test/sys/kernel/slab/ext3_xattr/destroy_by_rcu | 1 - test/sys/kernel/slab/ext3_xattr/free_calls | 1 - test/sys/kernel/slab/ext3_xattr/hwcache_align | 1 - test/sys/kernel/slab/ext3_xattr/object_size | 1 - test/sys/kernel/slab/ext3_xattr/objects | 1 - test/sys/kernel/slab/ext3_xattr/objects_partial | 1 - test/sys/kernel/slab/ext3_xattr/objs_per_slab | 1 - test/sys/kernel/slab/ext3_xattr/order | 1 - test/sys/kernel/slab/ext3_xattr/partial | 1 - test/sys/kernel/slab/ext3_xattr/poison | 1 - test/sys/kernel/slab/ext3_xattr/reclaim_account | 1 - test/sys/kernel/slab/ext3_xattr/red_zone | 1 - test/sys/kernel/slab/ext3_xattr/sanity_checks | 1 - test/sys/kernel/slab/ext3_xattr/shrink | 0 test/sys/kernel/slab/ext3_xattr/slab_size | 1 - test/sys/kernel/slab/ext3_xattr/slabs | 1 - test/sys/kernel/slab/ext3_xattr/store_user | 1 - test/sys/kernel/slab/ext3_xattr/total_objects | 1 - test/sys/kernel/slab/ext3_xattr/trace | 1 - test/sys/kernel/slab/ext3_xattr/validate | 0 test/sys/kernel/slab/fasync_cache/aliases | 1 - test/sys/kernel/slab/fasync_cache/align | 1 - test/sys/kernel/slab/fasync_cache/alloc_calls | 1 - test/sys/kernel/slab/fasync_cache/cache_dma | 1 - test/sys/kernel/slab/fasync_cache/cpu_slabs | 1 - test/sys/kernel/slab/fasync_cache/ctor | 0 test/sys/kernel/slab/fasync_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/fasync_cache/free_calls | 1 - test/sys/kernel/slab/fasync_cache/hwcache_align | 1 - test/sys/kernel/slab/fasync_cache/object_size | 1 - test/sys/kernel/slab/fasync_cache/objects | 1 - test/sys/kernel/slab/fasync_cache/objects_partial | 1 - test/sys/kernel/slab/fasync_cache/objs_per_slab | 1 - test/sys/kernel/slab/fasync_cache/order | 1 - test/sys/kernel/slab/fasync_cache/partial | 1 - test/sys/kernel/slab/fasync_cache/poison | 1 - test/sys/kernel/slab/fasync_cache/reclaim_account | 1 - test/sys/kernel/slab/fasync_cache/red_zone | 1 - test/sys/kernel/slab/fasync_cache/sanity_checks | 1 - test/sys/kernel/slab/fasync_cache/shrink | 0 test/sys/kernel/slab/fasync_cache/slab_size | 1 - test/sys/kernel/slab/fasync_cache/slabs | 1 - test/sys/kernel/slab/fasync_cache/store_user | 1 - test/sys/kernel/slab/fasync_cache/total_objects | 1 - test/sys/kernel/slab/fasync_cache/trace | 1 - test/sys/kernel/slab/fasync_cache/validate | 0 test/sys/kernel/slab/fat_cache/aliases | 1 - test/sys/kernel/slab/fat_cache/align | 1 - test/sys/kernel/slab/fat_cache/alloc_calls | 1 - test/sys/kernel/slab/fat_cache/cache_dma | 1 - test/sys/kernel/slab/fat_cache/cpu_slabs | 1 - test/sys/kernel/slab/fat_cache/ctor | 1 - test/sys/kernel/slab/fat_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/fat_cache/free_calls | 1 - test/sys/kernel/slab/fat_cache/hwcache_align | 1 - test/sys/kernel/slab/fat_cache/object_size | 1 - test/sys/kernel/slab/fat_cache/objects | 1 - test/sys/kernel/slab/fat_cache/objects_partial | 1 - test/sys/kernel/slab/fat_cache/objs_per_slab | 1 - test/sys/kernel/slab/fat_cache/order | 1 - test/sys/kernel/slab/fat_cache/partial | 1 - test/sys/kernel/slab/fat_cache/poison | 1 - test/sys/kernel/slab/fat_cache/reclaim_account | 1 - test/sys/kernel/slab/fat_cache/red_zone | 1 - test/sys/kernel/slab/fat_cache/sanity_checks | 1 - test/sys/kernel/slab/fat_cache/shrink | 0 test/sys/kernel/slab/fat_cache/slab_size | 1 - test/sys/kernel/slab/fat_cache/slabs | 1 - test/sys/kernel/slab/fat_cache/store_user | 1 - test/sys/kernel/slab/fat_cache/total_objects | 1 - test/sys/kernel/slab/fat_cache/trace | 1 - test/sys/kernel/slab/fat_cache/validate | 0 test/sys/kernel/slab/fat_inode_cache/aliases | 1 - test/sys/kernel/slab/fat_inode_cache/align | 1 - test/sys/kernel/slab/fat_inode_cache/alloc_calls | 1 - test/sys/kernel/slab/fat_inode_cache/cache_dma | 1 - test/sys/kernel/slab/fat_inode_cache/cpu_slabs | 1 - test/sys/kernel/slab/fat_inode_cache/ctor | 1 - .../sys/kernel/slab/fat_inode_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/fat_inode_cache/free_calls | 1 - test/sys/kernel/slab/fat_inode_cache/hwcache_align | 1 - test/sys/kernel/slab/fat_inode_cache/object_size | 1 - test/sys/kernel/slab/fat_inode_cache/objects | 1 - .../kernel/slab/fat_inode_cache/objects_partial | 1 - test/sys/kernel/slab/fat_inode_cache/objs_per_slab | 1 - test/sys/kernel/slab/fat_inode_cache/order | 1 - test/sys/kernel/slab/fat_inode_cache/partial | 1 - test/sys/kernel/slab/fat_inode_cache/poison | 1 - .../kernel/slab/fat_inode_cache/reclaim_account | 1 - test/sys/kernel/slab/fat_inode_cache/red_zone | 1 - test/sys/kernel/slab/fat_inode_cache/sanity_checks | 1 - test/sys/kernel/slab/fat_inode_cache/shrink | 0 test/sys/kernel/slab/fat_inode_cache/slab_size | 1 - test/sys/kernel/slab/fat_inode_cache/slabs | 1 - test/sys/kernel/slab/fat_inode_cache/store_user | 1 - test/sys/kernel/slab/fat_inode_cache/total_objects | 1 - test/sys/kernel/slab/fat_inode_cache/trace | 1 - test/sys/kernel/slab/fat_inode_cache/validate | 0 test/sys/kernel/slab/fib6_nodes/aliases | 1 - test/sys/kernel/slab/fib6_nodes/align | 1 - test/sys/kernel/slab/fib6_nodes/alloc_calls | 3 - test/sys/kernel/slab/fib6_nodes/cache_dma | 1 - test/sys/kernel/slab/fib6_nodes/cpu_slabs | 1 - test/sys/kernel/slab/fib6_nodes/ctor | 0 test/sys/kernel/slab/fib6_nodes/destroy_by_rcu | 1 - test/sys/kernel/slab/fib6_nodes/free_calls | 1 - test/sys/kernel/slab/fib6_nodes/hwcache_align | 1 - test/sys/kernel/slab/fib6_nodes/object_size | 1 - test/sys/kernel/slab/fib6_nodes/objects | 1 - test/sys/kernel/slab/fib6_nodes/objects_partial | 1 - test/sys/kernel/slab/fib6_nodes/objs_per_slab | 1 - test/sys/kernel/slab/fib6_nodes/order | 1 - test/sys/kernel/slab/fib6_nodes/partial | 1 - test/sys/kernel/slab/fib6_nodes/poison | 1 - test/sys/kernel/slab/fib6_nodes/reclaim_account | 1 - test/sys/kernel/slab/fib6_nodes/red_zone | 1 - test/sys/kernel/slab/fib6_nodes/sanity_checks | 1 - test/sys/kernel/slab/fib6_nodes/shrink | 0 test/sys/kernel/slab/fib6_nodes/slab_size | 1 - test/sys/kernel/slab/fib6_nodes/slabs | 1 - test/sys/kernel/slab/fib6_nodes/store_user | 1 - test/sys/kernel/slab/fib6_nodes/total_objects | 1 - test/sys/kernel/slab/fib6_nodes/trace | 1 - test/sys/kernel/slab/fib6_nodes/validate | 0 test/sys/kernel/slab/file_lock_cache/aliases | 1 - test/sys/kernel/slab/file_lock_cache/align | 1 - test/sys/kernel/slab/file_lock_cache/alloc_calls | 2 - test/sys/kernel/slab/file_lock_cache/cache_dma | 1 - test/sys/kernel/slab/file_lock_cache/cpu_slabs | 1 - test/sys/kernel/slab/file_lock_cache/ctor | 1 - .../sys/kernel/slab/file_lock_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/file_lock_cache/free_calls | 1 - test/sys/kernel/slab/file_lock_cache/hwcache_align | 1 - test/sys/kernel/slab/file_lock_cache/object_size | 1 - test/sys/kernel/slab/file_lock_cache/objects | 1 - .../kernel/slab/file_lock_cache/objects_partial | 1 - test/sys/kernel/slab/file_lock_cache/objs_per_slab | 1 - test/sys/kernel/slab/file_lock_cache/order | 1 - test/sys/kernel/slab/file_lock_cache/partial | 1 - test/sys/kernel/slab/file_lock_cache/poison | 1 - .../kernel/slab/file_lock_cache/reclaim_account | 1 - test/sys/kernel/slab/file_lock_cache/red_zone | 1 - test/sys/kernel/slab/file_lock_cache/sanity_checks | 1 - test/sys/kernel/slab/file_lock_cache/shrink | 0 test/sys/kernel/slab/file_lock_cache/slab_size | 1 - test/sys/kernel/slab/file_lock_cache/slabs | 1 - test/sys/kernel/slab/file_lock_cache/store_user | 1 - test/sys/kernel/slab/file_lock_cache/total_objects | 1 - test/sys/kernel/slab/file_lock_cache/trace | 1 - test/sys/kernel/slab/file_lock_cache/validate | 0 test/sys/kernel/slab/files_cache/aliases | 1 - test/sys/kernel/slab/files_cache/align | 1 - test/sys/kernel/slab/files_cache/alloc_calls | 1 - test/sys/kernel/slab/files_cache/cache_dma | 1 - test/sys/kernel/slab/files_cache/cpu_slabs | 1 - test/sys/kernel/slab/files_cache/ctor | 0 test/sys/kernel/slab/files_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/files_cache/free_calls | 3 - test/sys/kernel/slab/files_cache/hwcache_align | 1 - test/sys/kernel/slab/files_cache/object_size | 1 - test/sys/kernel/slab/files_cache/objects | 1 - test/sys/kernel/slab/files_cache/objects_partial | 1 - test/sys/kernel/slab/files_cache/objs_per_slab | 1 - test/sys/kernel/slab/files_cache/order | 1 - test/sys/kernel/slab/files_cache/partial | 1 - test/sys/kernel/slab/files_cache/poison | 1 - test/sys/kernel/slab/files_cache/reclaim_account | 1 - test/sys/kernel/slab/files_cache/red_zone | 1 - test/sys/kernel/slab/files_cache/sanity_checks | 1 - test/sys/kernel/slab/files_cache/shrink | 0 test/sys/kernel/slab/files_cache/slab_size | 1 - test/sys/kernel/slab/files_cache/slabs | 1 - test/sys/kernel/slab/files_cache/store_user | 1 - test/sys/kernel/slab/files_cache/total_objects | 1 - test/sys/kernel/slab/files_cache/trace | 1 - test/sys/kernel/slab/files_cache/validate | 0 test/sys/kernel/slab/filp/aliases | 1 - test/sys/kernel/slab/filp/align | 1 - test/sys/kernel/slab/filp/alloc_calls | 1 - test/sys/kernel/slab/filp/cache_dma | 1 - test/sys/kernel/slab/filp/cpu_slabs | 1 - test/sys/kernel/slab/filp/ctor | 0 test/sys/kernel/slab/filp/destroy_by_rcu | 1 - test/sys/kernel/slab/filp/free_calls | 2 - test/sys/kernel/slab/filp/hwcache_align | 1 - test/sys/kernel/slab/filp/object_size | 1 - test/sys/kernel/slab/filp/objects | 1 - test/sys/kernel/slab/filp/objects_partial | 1 - test/sys/kernel/slab/filp/objs_per_slab | 1 - test/sys/kernel/slab/filp/order | 1 - test/sys/kernel/slab/filp/partial | 1 - test/sys/kernel/slab/filp/poison | 1 - test/sys/kernel/slab/filp/reclaim_account | 1 - test/sys/kernel/slab/filp/red_zone | 1 - test/sys/kernel/slab/filp/sanity_checks | 1 - test/sys/kernel/slab/filp/shrink | 0 test/sys/kernel/slab/filp/slab_size | 1 - test/sys/kernel/slab/filp/slabs | 1 - test/sys/kernel/slab/filp/store_user | 1 - test/sys/kernel/slab/filp/total_objects | 1 - test/sys/kernel/slab/filp/trace | 1 - test/sys/kernel/slab/filp/validate | 0 test/sys/kernel/slab/flow_cache/aliases | 1 - test/sys/kernel/slab/flow_cache/align | 1 - test/sys/kernel/slab/flow_cache/alloc_calls | 1 - test/sys/kernel/slab/flow_cache/cache_dma | 1 - test/sys/kernel/slab/flow_cache/cpu_slabs | 1 - test/sys/kernel/slab/flow_cache/ctor | 0 test/sys/kernel/slab/flow_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/flow_cache/free_calls | 1 - test/sys/kernel/slab/flow_cache/hwcache_align | 1 - test/sys/kernel/slab/flow_cache/object_size | 1 - test/sys/kernel/slab/flow_cache/objects | 1 - test/sys/kernel/slab/flow_cache/objects_partial | 1 - test/sys/kernel/slab/flow_cache/objs_per_slab | 1 - test/sys/kernel/slab/flow_cache/order | 1 - test/sys/kernel/slab/flow_cache/partial | 1 - test/sys/kernel/slab/flow_cache/poison | 1 - test/sys/kernel/slab/flow_cache/reclaim_account | 1 - test/sys/kernel/slab/flow_cache/red_zone | 1 - test/sys/kernel/slab/flow_cache/sanity_checks | 1 - test/sys/kernel/slab/flow_cache/shrink | 0 test/sys/kernel/slab/flow_cache/slab_size | 1 - test/sys/kernel/slab/flow_cache/slabs | 1 - test/sys/kernel/slab/flow_cache/store_user | 1 - test/sys/kernel/slab/flow_cache/total_objects | 1 - test/sys/kernel/slab/flow_cache/trace | 1 - test/sys/kernel/slab/flow_cache/validate | 0 test/sys/kernel/slab/fs_cache/aliases | 1 - test/sys/kernel/slab/fs_cache/align | 1 - test/sys/kernel/slab/fs_cache/alloc_calls | 1 - test/sys/kernel/slab/fs_cache/cache_dma | 1 - test/sys/kernel/slab/fs_cache/cpu_slabs | 1 - test/sys/kernel/slab/fs_cache/ctor | 0 test/sys/kernel/slab/fs_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/fs_cache/free_calls | 2 - test/sys/kernel/slab/fs_cache/hwcache_align | 1 - test/sys/kernel/slab/fs_cache/object_size | 1 - test/sys/kernel/slab/fs_cache/objects | 1 - test/sys/kernel/slab/fs_cache/objects_partial | 1 - test/sys/kernel/slab/fs_cache/objs_per_slab | 1 - test/sys/kernel/slab/fs_cache/order | 1 - test/sys/kernel/slab/fs_cache/partial | 1 - test/sys/kernel/slab/fs_cache/poison | 1 - test/sys/kernel/slab/fs_cache/reclaim_account | 1 - test/sys/kernel/slab/fs_cache/red_zone | 1 - test/sys/kernel/slab/fs_cache/sanity_checks | 1 - test/sys/kernel/slab/fs_cache/shrink | 0 test/sys/kernel/slab/fs_cache/slab_size | 1 - test/sys/kernel/slab/fs_cache/slabs | 1 - test/sys/kernel/slab/fs_cache/store_user | 1 - test/sys/kernel/slab/fs_cache/total_objects | 1 - test/sys/kernel/slab/fs_cache/trace | 1 - test/sys/kernel/slab/fs_cache/validate | 0 test/sys/kernel/slab/fuse_inode/aliases | 1 - test/sys/kernel/slab/fuse_inode/align | 1 - test/sys/kernel/slab/fuse_inode/alloc_calls | 1 - test/sys/kernel/slab/fuse_inode/cache_dma | 1 - test/sys/kernel/slab/fuse_inode/cpu_slabs | 1 - test/sys/kernel/slab/fuse_inode/ctor | 1 - test/sys/kernel/slab/fuse_inode/destroy_by_rcu | 1 - test/sys/kernel/slab/fuse_inode/free_calls | 1 - test/sys/kernel/slab/fuse_inode/hwcache_align | 1 - test/sys/kernel/slab/fuse_inode/object_size | 1 - test/sys/kernel/slab/fuse_inode/objects | 1 - test/sys/kernel/slab/fuse_inode/objects_partial | 1 - test/sys/kernel/slab/fuse_inode/objs_per_slab | 1 - test/sys/kernel/slab/fuse_inode/order | 1 - test/sys/kernel/slab/fuse_inode/partial | 1 - test/sys/kernel/slab/fuse_inode/poison | 1 - test/sys/kernel/slab/fuse_inode/reclaim_account | 1 - test/sys/kernel/slab/fuse_inode/red_zone | 1 - test/sys/kernel/slab/fuse_inode/sanity_checks | 1 - test/sys/kernel/slab/fuse_inode/shrink | 0 test/sys/kernel/slab/fuse_inode/slab_size | 1 - test/sys/kernel/slab/fuse_inode/slabs | 1 - test/sys/kernel/slab/fuse_inode/store_user | 1 - test/sys/kernel/slab/fuse_inode/total_objects | 1 - test/sys/kernel/slab/fuse_inode/trace | 1 - test/sys/kernel/slab/fuse_inode/validate | 0 test/sys/kernel/slab/fuse_request/aliases | 1 - test/sys/kernel/slab/fuse_request/align | 1 - test/sys/kernel/slab/fuse_request/alloc_calls | 1 - test/sys/kernel/slab/fuse_request/cache_dma | 1 - test/sys/kernel/slab/fuse_request/cpu_slabs | 1 - test/sys/kernel/slab/fuse_request/ctor | 0 test/sys/kernel/slab/fuse_request/destroy_by_rcu | 1 - test/sys/kernel/slab/fuse_request/free_calls | 1 - test/sys/kernel/slab/fuse_request/hwcache_align | 1 - test/sys/kernel/slab/fuse_request/object_size | 1 - test/sys/kernel/slab/fuse_request/objects | 1 - test/sys/kernel/slab/fuse_request/objects_partial | 1 - test/sys/kernel/slab/fuse_request/objs_per_slab | 1 - test/sys/kernel/slab/fuse_request/order | 1 - test/sys/kernel/slab/fuse_request/partial | 1 - test/sys/kernel/slab/fuse_request/poison | 1 - test/sys/kernel/slab/fuse_request/reclaim_account | 1 - test/sys/kernel/slab/fuse_request/red_zone | 1 - test/sys/kernel/slab/fuse_request/sanity_checks | 1 - test/sys/kernel/slab/fuse_request/shrink | 0 test/sys/kernel/slab/fuse_request/slab_size | 1 - test/sys/kernel/slab/fuse_request/slabs | 1 - test/sys/kernel/slab/fuse_request/store_user | 1 - test/sys/kernel/slab/fuse_request/total_objects | 1 - test/sys/kernel/slab/fuse_request/trace | 1 - test/sys/kernel/slab/fuse_request/validate | 0 test/sys/kernel/slab/idr_layer_cache/aliases | 1 - test/sys/kernel/slab/idr_layer_cache/align | 1 - test/sys/kernel/slab/idr_layer_cache/alloc_calls | 1 - test/sys/kernel/slab/idr_layer_cache/cache_dma | 1 - test/sys/kernel/slab/idr_layer_cache/cpu_slabs | 1 - test/sys/kernel/slab/idr_layer_cache/ctor | 1 - .../sys/kernel/slab/idr_layer_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/idr_layer_cache/free_calls | 4 - test/sys/kernel/slab/idr_layer_cache/hwcache_align | 1 - test/sys/kernel/slab/idr_layer_cache/object_size | 1 - test/sys/kernel/slab/idr_layer_cache/objects | 1 - .../kernel/slab/idr_layer_cache/objects_partial | 1 - test/sys/kernel/slab/idr_layer_cache/objs_per_slab | 1 - test/sys/kernel/slab/idr_layer_cache/order | 1 - test/sys/kernel/slab/idr_layer_cache/partial | 1 - test/sys/kernel/slab/idr_layer_cache/poison | 1 - .../kernel/slab/idr_layer_cache/reclaim_account | 1 - test/sys/kernel/slab/idr_layer_cache/red_zone | 1 - test/sys/kernel/slab/idr_layer_cache/sanity_checks | 1 - test/sys/kernel/slab/idr_layer_cache/shrink | 0 test/sys/kernel/slab/idr_layer_cache/slab_size | 1 - test/sys/kernel/slab/idr_layer_cache/slabs | 1 - test/sys/kernel/slab/idr_layer_cache/store_user | 1 - test/sys/kernel/slab/idr_layer_cache/total_objects | 1 - test/sys/kernel/slab/idr_layer_cache/trace | 1 - test/sys/kernel/slab/idr_layer_cache/validate | 0 test/sys/kernel/slab/inet_peer_cache/aliases | 1 - test/sys/kernel/slab/inet_peer_cache/align | 1 - test/sys/kernel/slab/inet_peer_cache/alloc_calls | 1 - test/sys/kernel/slab/inet_peer_cache/cache_dma | 1 - test/sys/kernel/slab/inet_peer_cache/cpu_slabs | 1 - test/sys/kernel/slab/inet_peer_cache/ctor | 0 .../sys/kernel/slab/inet_peer_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/inet_peer_cache/free_calls | 1 - test/sys/kernel/slab/inet_peer_cache/hwcache_align | 1 - test/sys/kernel/slab/inet_peer_cache/object_size | 1 - test/sys/kernel/slab/inet_peer_cache/objects | 1 - .../kernel/slab/inet_peer_cache/objects_partial | 1 - test/sys/kernel/slab/inet_peer_cache/objs_per_slab | 1 - test/sys/kernel/slab/inet_peer_cache/order | 1 - test/sys/kernel/slab/inet_peer_cache/partial | 1 - test/sys/kernel/slab/inet_peer_cache/poison | 1 - .../kernel/slab/inet_peer_cache/reclaim_account | 1 - test/sys/kernel/slab/inet_peer_cache/red_zone | 1 - test/sys/kernel/slab/inet_peer_cache/sanity_checks | 1 - test/sys/kernel/slab/inet_peer_cache/shrink | 0 test/sys/kernel/slab/inet_peer_cache/slab_size | 1 - test/sys/kernel/slab/inet_peer_cache/slabs | 1 - test/sys/kernel/slab/inet_peer_cache/store_user | 1 - test/sys/kernel/slab/inet_peer_cache/total_objects | 1 - test/sys/kernel/slab/inet_peer_cache/trace | 1 - test/sys/kernel/slab/inet_peer_cache/validate | 0 test/sys/kernel/slab/inode_cache/aliases | 1 - test/sys/kernel/slab/inode_cache/align | 1 - test/sys/kernel/slab/inode_cache/alloc_calls | 1 - test/sys/kernel/slab/inode_cache/cache_dma | 1 - test/sys/kernel/slab/inode_cache/cpu_slabs | 1 - test/sys/kernel/slab/inode_cache/ctor | 1 - test/sys/kernel/slab/inode_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/inode_cache/free_calls | 2 - test/sys/kernel/slab/inode_cache/hwcache_align | 1 - test/sys/kernel/slab/inode_cache/object_size | 1 - test/sys/kernel/slab/inode_cache/objects | 1 - test/sys/kernel/slab/inode_cache/objects_partial | 1 - test/sys/kernel/slab/inode_cache/objs_per_slab | 1 - test/sys/kernel/slab/inode_cache/order | 1 - test/sys/kernel/slab/inode_cache/partial | 1 - test/sys/kernel/slab/inode_cache/poison | 1 - test/sys/kernel/slab/inode_cache/reclaim_account | 1 - test/sys/kernel/slab/inode_cache/red_zone | 1 - test/sys/kernel/slab/inode_cache/sanity_checks | 1 - test/sys/kernel/slab/inode_cache/shrink | 0 test/sys/kernel/slab/inode_cache/slab_size | 1 - test/sys/kernel/slab/inode_cache/slabs | 1 - test/sys/kernel/slab/inode_cache/store_user | 1 - test/sys/kernel/slab/inode_cache/total_objects | 1 - test/sys/kernel/slab/inode_cache/trace | 1 - test/sys/kernel/slab/inode_cache/validate | 0 test/sys/kernel/slab/inotify_event_cache/aliases | 1 - test/sys/kernel/slab/inotify_event_cache/align | 1 - .../kernel/slab/inotify_event_cache/alloc_calls | 1 - test/sys/kernel/slab/inotify_event_cache/cache_dma | 1 - test/sys/kernel/slab/inotify_event_cache/cpu_slabs | 1 - test/sys/kernel/slab/inotify_event_cache/ctor | 0 .../kernel/slab/inotify_event_cache/destroy_by_rcu | 1 - .../sys/kernel/slab/inotify_event_cache/free_calls | 1 - .../kernel/slab/inotify_event_cache/hwcache_align | 1 - .../kernel/slab/inotify_event_cache/object_size | 1 - test/sys/kernel/slab/inotify_event_cache/objects | 1 - .../slab/inotify_event_cache/objects_partial | 1 - .../kernel/slab/inotify_event_cache/objs_per_slab | 1 - test/sys/kernel/slab/inotify_event_cache/order | 1 - test/sys/kernel/slab/inotify_event_cache/partial | 1 - test/sys/kernel/slab/inotify_event_cache/poison | 1 - .../slab/inotify_event_cache/reclaim_account | 1 - test/sys/kernel/slab/inotify_event_cache/red_zone | 1 - .../kernel/slab/inotify_event_cache/sanity_checks | 1 - test/sys/kernel/slab/inotify_event_cache/shrink | 0 test/sys/kernel/slab/inotify_event_cache/slab_size | 1 - test/sys/kernel/slab/inotify_event_cache/slabs | 1 - .../sys/kernel/slab/inotify_event_cache/store_user | 1 - .../kernel/slab/inotify_event_cache/total_objects | 1 - test/sys/kernel/slab/inotify_event_cache/trace | 1 - test/sys/kernel/slab/inotify_event_cache/validate | 0 test/sys/kernel/slab/inotify_watch_cache/aliases | 1 - test/sys/kernel/slab/inotify_watch_cache/align | 1 - .../kernel/slab/inotify_watch_cache/alloc_calls | 1 - test/sys/kernel/slab/inotify_watch_cache/cache_dma | 1 - test/sys/kernel/slab/inotify_watch_cache/cpu_slabs | 1 - test/sys/kernel/slab/inotify_watch_cache/ctor | 0 .../kernel/slab/inotify_watch_cache/destroy_by_rcu | 1 - .../sys/kernel/slab/inotify_watch_cache/free_calls | 2 - .../kernel/slab/inotify_watch_cache/hwcache_align | 1 - .../kernel/slab/inotify_watch_cache/object_size | 1 - test/sys/kernel/slab/inotify_watch_cache/objects | 1 - .../slab/inotify_watch_cache/objects_partial | 1 - .../kernel/slab/inotify_watch_cache/objs_per_slab | 1 - test/sys/kernel/slab/inotify_watch_cache/order | 1 - test/sys/kernel/slab/inotify_watch_cache/partial | 1 - test/sys/kernel/slab/inotify_watch_cache/poison | 1 - .../slab/inotify_watch_cache/reclaim_account | 1 - test/sys/kernel/slab/inotify_watch_cache/red_zone | 1 - .../kernel/slab/inotify_watch_cache/sanity_checks | 1 - test/sys/kernel/slab/inotify_watch_cache/shrink | 0 test/sys/kernel/slab/inotify_watch_cache/slab_size | 1 - test/sys/kernel/slab/inotify_watch_cache/slabs | 1 - .../sys/kernel/slab/inotify_watch_cache/store_user | 1 - .../kernel/slab/inotify_watch_cache/total_objects | 1 - test/sys/kernel/slab/inotify_watch_cache/trace | 1 - test/sys/kernel/slab/inotify_watch_cache/validate | 0 test/sys/kernel/slab/ip6_dst_cache/aliases | 1 - test/sys/kernel/slab/ip6_dst_cache/align | 1 - test/sys/kernel/slab/ip6_dst_cache/alloc_calls | 1 - test/sys/kernel/slab/ip6_dst_cache/cache_dma | 1 - test/sys/kernel/slab/ip6_dst_cache/cpu_slabs | 1 - test/sys/kernel/slab/ip6_dst_cache/ctor | 0 test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/ip6_dst_cache/free_calls | 1 - test/sys/kernel/slab/ip6_dst_cache/hwcache_align | 1 - test/sys/kernel/slab/ip6_dst_cache/object_size | 1 - test/sys/kernel/slab/ip6_dst_cache/objects | 1 - test/sys/kernel/slab/ip6_dst_cache/objects_partial | 1 - test/sys/kernel/slab/ip6_dst_cache/objs_per_slab | 1 - test/sys/kernel/slab/ip6_dst_cache/order | 1 - test/sys/kernel/slab/ip6_dst_cache/partial | 1 - test/sys/kernel/slab/ip6_dst_cache/poison | 1 - test/sys/kernel/slab/ip6_dst_cache/reclaim_account | 1 - test/sys/kernel/slab/ip6_dst_cache/red_zone | 1 - test/sys/kernel/slab/ip6_dst_cache/sanity_checks | 1 - test/sys/kernel/slab/ip6_dst_cache/shrink | 0 test/sys/kernel/slab/ip6_dst_cache/slab_size | 1 - test/sys/kernel/slab/ip6_dst_cache/slabs | 1 - test/sys/kernel/slab/ip6_dst_cache/store_user | 1 - test/sys/kernel/slab/ip6_dst_cache/total_objects | 1 - test/sys/kernel/slab/ip6_dst_cache/trace | 1 - test/sys/kernel/slab/ip6_dst_cache/validate | 0 test/sys/kernel/slab/ip_dst_cache/aliases | 1 - test/sys/kernel/slab/ip_dst_cache/align | 1 - test/sys/kernel/slab/ip_dst_cache/alloc_calls | 1 - test/sys/kernel/slab/ip_dst_cache/cache_dma | 1 - test/sys/kernel/slab/ip_dst_cache/cpu_slabs | 1 - test/sys/kernel/slab/ip_dst_cache/ctor | 0 test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/ip_dst_cache/free_calls | 1 - test/sys/kernel/slab/ip_dst_cache/hwcache_align | 1 - test/sys/kernel/slab/ip_dst_cache/object_size | 1 - test/sys/kernel/slab/ip_dst_cache/objects | 1 - test/sys/kernel/slab/ip_dst_cache/objects_partial | 1 - test/sys/kernel/slab/ip_dst_cache/objs_per_slab | 1 - test/sys/kernel/slab/ip_dst_cache/order | 1 - test/sys/kernel/slab/ip_dst_cache/partial | 1 - test/sys/kernel/slab/ip_dst_cache/poison | 1 - test/sys/kernel/slab/ip_dst_cache/reclaim_account | 1 - test/sys/kernel/slab/ip_dst_cache/red_zone | 1 - test/sys/kernel/slab/ip_dst_cache/sanity_checks | 1 - test/sys/kernel/slab/ip_dst_cache/shrink | 0 test/sys/kernel/slab/ip_dst_cache/slab_size | 1 - test/sys/kernel/slab/ip_dst_cache/slabs | 1 - test/sys/kernel/slab/ip_dst_cache/store_user | 1 - test/sys/kernel/slab/ip_dst_cache/total_objects | 1 - test/sys/kernel/slab/ip_dst_cache/trace | 1 - test/sys/kernel/slab/ip_dst_cache/validate | 0 test/sys/kernel/slab/ip_fib_alias/aliases | 1 - test/sys/kernel/slab/ip_fib_alias/align | 1 - test/sys/kernel/slab/ip_fib_alias/alloc_calls | 1 - test/sys/kernel/slab/ip_fib_alias/cache_dma | 1 - test/sys/kernel/slab/ip_fib_alias/cpu_slabs | 1 - test/sys/kernel/slab/ip_fib_alias/ctor | 0 test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu | 1 - test/sys/kernel/slab/ip_fib_alias/free_calls | 1 - test/sys/kernel/slab/ip_fib_alias/hwcache_align | 1 - test/sys/kernel/slab/ip_fib_alias/object_size | 1 - test/sys/kernel/slab/ip_fib_alias/objects | 1 - test/sys/kernel/slab/ip_fib_alias/objects_partial | 1 - test/sys/kernel/slab/ip_fib_alias/objs_per_slab | 1 - test/sys/kernel/slab/ip_fib_alias/order | 1 - test/sys/kernel/slab/ip_fib_alias/partial | 1 - test/sys/kernel/slab/ip_fib_alias/poison | 1 - test/sys/kernel/slab/ip_fib_alias/reclaim_account | 1 - test/sys/kernel/slab/ip_fib_alias/red_zone | 1 - test/sys/kernel/slab/ip_fib_alias/sanity_checks | 1 - test/sys/kernel/slab/ip_fib_alias/shrink | 0 test/sys/kernel/slab/ip_fib_alias/slab_size | 1 - test/sys/kernel/slab/ip_fib_alias/slabs | 1 - test/sys/kernel/slab/ip_fib_alias/store_user | 1 - test/sys/kernel/slab/ip_fib_alias/total_objects | 1 - test/sys/kernel/slab/ip_fib_alias/trace | 1 - test/sys/kernel/slab/ip_fib_alias/validate | 0 test/sys/kernel/slab/ip_fib_hash/aliases | 1 - test/sys/kernel/slab/ip_fib_hash/align | 1 - test/sys/kernel/slab/ip_fib_hash/alloc_calls | 1 - test/sys/kernel/slab/ip_fib_hash/cache_dma | 1 - test/sys/kernel/slab/ip_fib_hash/cpu_slabs | 1 - test/sys/kernel/slab/ip_fib_hash/ctor | 0 test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu | 1 - test/sys/kernel/slab/ip_fib_hash/free_calls | 2 - test/sys/kernel/slab/ip_fib_hash/hwcache_align | 1 - test/sys/kernel/slab/ip_fib_hash/object_size | 1 - test/sys/kernel/slab/ip_fib_hash/objects | 1 - test/sys/kernel/slab/ip_fib_hash/objects_partial | 1 - test/sys/kernel/slab/ip_fib_hash/objs_per_slab | 1 - test/sys/kernel/slab/ip_fib_hash/order | 1 - test/sys/kernel/slab/ip_fib_hash/partial | 1 - test/sys/kernel/slab/ip_fib_hash/poison | 1 - test/sys/kernel/slab/ip_fib_hash/reclaim_account | 1 - test/sys/kernel/slab/ip_fib_hash/red_zone | 1 - test/sys/kernel/slab/ip_fib_hash/sanity_checks | 1 - test/sys/kernel/slab/ip_fib_hash/shrink | 0 test/sys/kernel/slab/ip_fib_hash/slab_size | 1 - test/sys/kernel/slab/ip_fib_hash/slabs | 1 - test/sys/kernel/slab/ip_fib_hash/store_user | 1 - test/sys/kernel/slab/ip_fib_hash/total_objects | 1 - test/sys/kernel/slab/ip_fib_hash/trace | 1 - test/sys/kernel/slab/ip_fib_hash/validate | 0 test/sys/kernel/slab/journal_handle/aliases | 1 - test/sys/kernel/slab/journal_handle/align | 1 - test/sys/kernel/slab/journal_handle/alloc_calls | 1 - test/sys/kernel/slab/journal_handle/cache_dma | 1 - test/sys/kernel/slab/journal_handle/cpu_slabs | 1 - test/sys/kernel/slab/journal_handle/ctor | 0 test/sys/kernel/slab/journal_handle/destroy_by_rcu | 1 - test/sys/kernel/slab/journal_handle/free_calls | 1 - test/sys/kernel/slab/journal_handle/hwcache_align | 1 - test/sys/kernel/slab/journal_handle/object_size | 1 - test/sys/kernel/slab/journal_handle/objects | 1 - .../sys/kernel/slab/journal_handle/objects_partial | 1 - test/sys/kernel/slab/journal_handle/objs_per_slab | 1 - test/sys/kernel/slab/journal_handle/order | 1 - test/sys/kernel/slab/journal_handle/partial | 1 - test/sys/kernel/slab/journal_handle/poison | 1 - .../sys/kernel/slab/journal_handle/reclaim_account | 1 - test/sys/kernel/slab/journal_handle/red_zone | 1 - test/sys/kernel/slab/journal_handle/sanity_checks | 1 - test/sys/kernel/slab/journal_handle/shrink | 0 test/sys/kernel/slab/journal_handle/slab_size | 1 - test/sys/kernel/slab/journal_handle/slabs | 1 - test/sys/kernel/slab/journal_handle/store_user | 1 - test/sys/kernel/slab/journal_handle/total_objects | 1 - test/sys/kernel/slab/journal_handle/trace | 1 - test/sys/kernel/slab/journal_handle/validate | 0 test/sys/kernel/slab/journal_head/aliases | 1 - test/sys/kernel/slab/journal_head/align | 1 - test/sys/kernel/slab/journal_head/alloc_calls | 1 - test/sys/kernel/slab/journal_head/cache_dma | 1 - test/sys/kernel/slab/journal_head/cpu_slabs | 1 - test/sys/kernel/slab/journal_head/ctor | 0 test/sys/kernel/slab/journal_head/destroy_by_rcu | 1 - test/sys/kernel/slab/journal_head/free_calls | 2 - test/sys/kernel/slab/journal_head/hwcache_align | 1 - test/sys/kernel/slab/journal_head/object_size | 1 - test/sys/kernel/slab/journal_head/objects | 1 - test/sys/kernel/slab/journal_head/objects_partial | 1 - test/sys/kernel/slab/journal_head/objs_per_slab | 1 - test/sys/kernel/slab/journal_head/order | 1 - test/sys/kernel/slab/journal_head/partial | 1 - test/sys/kernel/slab/journal_head/poison | 1 - test/sys/kernel/slab/journal_head/reclaim_account | 1 - test/sys/kernel/slab/journal_head/red_zone | 1 - test/sys/kernel/slab/journal_head/sanity_checks | 1 - test/sys/kernel/slab/journal_head/shrink | 0 test/sys/kernel/slab/journal_head/slab_size | 1 - test/sys/kernel/slab/journal_head/slabs | 1 - test/sys/kernel/slab/journal_head/store_user | 1 - test/sys/kernel/slab/journal_head/total_objects | 1 - test/sys/kernel/slab/journal_head/trace | 1 - test/sys/kernel/slab/journal_head/validate | 0 test/sys/kernel/slab/kcopyd_job/aliases | 1 - test/sys/kernel/slab/kcopyd_job/align | 1 - test/sys/kernel/slab/kcopyd_job/alloc_calls | 1 - test/sys/kernel/slab/kcopyd_job/cache_dma | 1 - test/sys/kernel/slab/kcopyd_job/cpu_slabs | 1 - test/sys/kernel/slab/kcopyd_job/ctor | 0 test/sys/kernel/slab/kcopyd_job/destroy_by_rcu | 1 - test/sys/kernel/slab/kcopyd_job/free_calls | 1 - test/sys/kernel/slab/kcopyd_job/hwcache_align | 1 - test/sys/kernel/slab/kcopyd_job/object_size | 1 - test/sys/kernel/slab/kcopyd_job/objects | 1 - test/sys/kernel/slab/kcopyd_job/objects_partial | 1 - test/sys/kernel/slab/kcopyd_job/objs_per_slab | 1 - test/sys/kernel/slab/kcopyd_job/order | 1 - test/sys/kernel/slab/kcopyd_job/partial | 1 - test/sys/kernel/slab/kcopyd_job/poison | 1 - test/sys/kernel/slab/kcopyd_job/reclaim_account | 1 - test/sys/kernel/slab/kcopyd_job/red_zone | 1 - test/sys/kernel/slab/kcopyd_job/sanity_checks | 1 - test/sys/kernel/slab/kcopyd_job/shrink | 0 test/sys/kernel/slab/kcopyd_job/slab_size | 1 - test/sys/kernel/slab/kcopyd_job/slabs | 1 - test/sys/kernel/slab/kcopyd_job/store_user | 1 - test/sys/kernel/slab/kcopyd_job/total_objects | 1 - test/sys/kernel/slab/kcopyd_job/trace | 1 - test/sys/kernel/slab/kcopyd_job/validate | 0 test/sys/kernel/slab/key_jar/aliases | 1 - test/sys/kernel/slab/key_jar/align | 1 - test/sys/kernel/slab/key_jar/alloc_calls | 1 - test/sys/kernel/slab/key_jar/cache_dma | 1 - test/sys/kernel/slab/key_jar/cpu_slabs | 1 - test/sys/kernel/slab/key_jar/ctor | 0 test/sys/kernel/slab/key_jar/destroy_by_rcu | 1 - test/sys/kernel/slab/key_jar/free_calls | 1 - test/sys/kernel/slab/key_jar/hwcache_align | 1 - test/sys/kernel/slab/key_jar/object_size | 1 - test/sys/kernel/slab/key_jar/objects | 1 - test/sys/kernel/slab/key_jar/objects_partial | 1 - test/sys/kernel/slab/key_jar/objs_per_slab | 1 - test/sys/kernel/slab/key_jar/order | 1 - test/sys/kernel/slab/key_jar/partial | 1 - test/sys/kernel/slab/key_jar/poison | 1 - test/sys/kernel/slab/key_jar/reclaim_account | 1 - test/sys/kernel/slab/key_jar/red_zone | 1 - test/sys/kernel/slab/key_jar/sanity_checks | 1 - test/sys/kernel/slab/key_jar/shrink | 0 test/sys/kernel/slab/key_jar/slab_size | 1 - test/sys/kernel/slab/key_jar/slabs | 1 - test/sys/kernel/slab/key_jar/store_user | 1 - test/sys/kernel/slab/key_jar/total_objects | 1 - test/sys/kernel/slab/key_jar/trace | 1 - test/sys/kernel/slab/key_jar/validate | 0 test/sys/kernel/slab/kiocb/aliases | 1 - test/sys/kernel/slab/kiocb/align | 1 - test/sys/kernel/slab/kiocb/alloc_calls | 1 - test/sys/kernel/slab/kiocb/cache_dma | 1 - test/sys/kernel/slab/kiocb/cpu_slabs | 1 - test/sys/kernel/slab/kiocb/ctor | 0 test/sys/kernel/slab/kiocb/destroy_by_rcu | 1 - test/sys/kernel/slab/kiocb/free_calls | 1 - test/sys/kernel/slab/kiocb/hwcache_align | 1 - test/sys/kernel/slab/kiocb/object_size | 1 - test/sys/kernel/slab/kiocb/objects | 1 - test/sys/kernel/slab/kiocb/objects_partial | 1 - test/sys/kernel/slab/kiocb/objs_per_slab | 1 - test/sys/kernel/slab/kiocb/order | 1 - test/sys/kernel/slab/kiocb/partial | 1 - test/sys/kernel/slab/kiocb/poison | 1 - test/sys/kernel/slab/kiocb/reclaim_account | 1 - test/sys/kernel/slab/kiocb/red_zone | 1 - test/sys/kernel/slab/kiocb/sanity_checks | 1 - test/sys/kernel/slab/kiocb/shrink | 0 test/sys/kernel/slab/kiocb/slab_size | 1 - test/sys/kernel/slab/kiocb/slabs | 1 - test/sys/kernel/slab/kiocb/store_user | 1 - test/sys/kernel/slab/kiocb/total_objects | 1 - test/sys/kernel/slab/kiocb/trace | 1 - test/sys/kernel/slab/kiocb/validate | 0 test/sys/kernel/slab/kioctx/aliases | 1 - test/sys/kernel/slab/kioctx/align | 1 - test/sys/kernel/slab/kioctx/alloc_calls | 1 - test/sys/kernel/slab/kioctx/cache_dma | 1 - test/sys/kernel/slab/kioctx/cpu_slabs | 1 - test/sys/kernel/slab/kioctx/ctor | 0 test/sys/kernel/slab/kioctx/destroy_by_rcu | 1 - test/sys/kernel/slab/kioctx/free_calls | 1 - test/sys/kernel/slab/kioctx/hwcache_align | 1 - test/sys/kernel/slab/kioctx/object_size | 1 - test/sys/kernel/slab/kioctx/objects | 1 - test/sys/kernel/slab/kioctx/objects_partial | 1 - test/sys/kernel/slab/kioctx/objs_per_slab | 1 - test/sys/kernel/slab/kioctx/order | 1 - test/sys/kernel/slab/kioctx/partial | 1 - test/sys/kernel/slab/kioctx/poison | 1 - test/sys/kernel/slab/kioctx/reclaim_account | 1 - test/sys/kernel/slab/kioctx/red_zone | 1 - test/sys/kernel/slab/kioctx/sanity_checks | 1 - test/sys/kernel/slab/kioctx/shrink | 0 test/sys/kernel/slab/kioctx/slab_size | 1 - test/sys/kernel/slab/kioctx/slabs | 1 - test/sys/kernel/slab/kioctx/store_user | 1 - test/sys/kernel/slab/kioctx/total_objects | 1 - test/sys/kernel/slab/kioctx/trace | 1 - test/sys/kernel/slab/kioctx/validate | 0 test/sys/kernel/slab/kmalloc-1024/aliases | 1 - test/sys/kernel/slab/kmalloc-1024/align | 1 - test/sys/kernel/slab/kmalloc-1024/alloc_calls | 51 - test/sys/kernel/slab/kmalloc-1024/cache_dma | 1 - test/sys/kernel/slab/kmalloc-1024/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-1024/ctor | 0 test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-1024/free_calls | 10 - test/sys/kernel/slab/kmalloc-1024/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-1024/object_size | 1 - test/sys/kernel/slab/kmalloc-1024/objects | 1 - test/sys/kernel/slab/kmalloc-1024/objects_partial | 1 - test/sys/kernel/slab/kmalloc-1024/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-1024/order | 1 - test/sys/kernel/slab/kmalloc-1024/partial | 1 - test/sys/kernel/slab/kmalloc-1024/poison | 1 - test/sys/kernel/slab/kmalloc-1024/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-1024/red_zone | 1 - test/sys/kernel/slab/kmalloc-1024/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-1024/shrink | 0 test/sys/kernel/slab/kmalloc-1024/slab_size | 1 - test/sys/kernel/slab/kmalloc-1024/slabs | 1 - test/sys/kernel/slab/kmalloc-1024/store_user | 1 - test/sys/kernel/slab/kmalloc-1024/total_objects | 1 - test/sys/kernel/slab/kmalloc-1024/trace | 1 - test/sys/kernel/slab/kmalloc-1024/validate | 0 test/sys/kernel/slab/kmalloc-128/aliases | 1 - test/sys/kernel/slab/kmalloc-128/align | 1 - test/sys/kernel/slab/kmalloc-128/alloc_calls | 36 - test/sys/kernel/slab/kmalloc-128/cache_dma | 1 - test/sys/kernel/slab/kmalloc-128/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-128/ctor | 0 test/sys/kernel/slab/kmalloc-128/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-128/free_calls | 18 - test/sys/kernel/slab/kmalloc-128/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-128/object_size | 1 - test/sys/kernel/slab/kmalloc-128/objects | 1 - test/sys/kernel/slab/kmalloc-128/objects_partial | 1 - test/sys/kernel/slab/kmalloc-128/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-128/order | 1 - test/sys/kernel/slab/kmalloc-128/partial | 1 - test/sys/kernel/slab/kmalloc-128/poison | 1 - test/sys/kernel/slab/kmalloc-128/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-128/red_zone | 1 - test/sys/kernel/slab/kmalloc-128/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-128/shrink | 0 test/sys/kernel/slab/kmalloc-128/slab_size | 1 - test/sys/kernel/slab/kmalloc-128/slabs | 1 - test/sys/kernel/slab/kmalloc-128/store_user | 1 - test/sys/kernel/slab/kmalloc-128/total_objects | 1 - test/sys/kernel/slab/kmalloc-128/trace | 1 - test/sys/kernel/slab/kmalloc-128/validate | 0 test/sys/kernel/slab/kmalloc-16/aliases | 1 - test/sys/kernel/slab/kmalloc-16/align | 1 - test/sys/kernel/slab/kmalloc-16/alloc_calls | 41 - test/sys/kernel/slab/kmalloc-16/cache_dma | 1 - test/sys/kernel/slab/kmalloc-16/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-16/ctor | 0 test/sys/kernel/slab/kmalloc-16/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-16/free_calls | 26 - test/sys/kernel/slab/kmalloc-16/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-16/object_size | 1 - test/sys/kernel/slab/kmalloc-16/objects | 1 - test/sys/kernel/slab/kmalloc-16/objects_partial | 1 - test/sys/kernel/slab/kmalloc-16/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-16/order | 1 - test/sys/kernel/slab/kmalloc-16/partial | 1 - test/sys/kernel/slab/kmalloc-16/poison | 1 - test/sys/kernel/slab/kmalloc-16/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-16/red_zone | 1 - test/sys/kernel/slab/kmalloc-16/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-16/shrink | 0 test/sys/kernel/slab/kmalloc-16/slab_size | 1 - test/sys/kernel/slab/kmalloc-16/slabs | 1 - test/sys/kernel/slab/kmalloc-16/store_user | 1 - test/sys/kernel/slab/kmalloc-16/total_objects | 1 - test/sys/kernel/slab/kmalloc-16/trace | 1 - test/sys/kernel/slab/kmalloc-16/validate | 0 test/sys/kernel/slab/kmalloc-192/aliases | 1 - test/sys/kernel/slab/kmalloc-192/align | 1 - test/sys/kernel/slab/kmalloc-192/alloc_calls | 34 - test/sys/kernel/slab/kmalloc-192/cache_dma | 1 - test/sys/kernel/slab/kmalloc-192/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-192/ctor | 0 test/sys/kernel/slab/kmalloc-192/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-192/free_calls | 16 - test/sys/kernel/slab/kmalloc-192/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-192/object_size | 1 - test/sys/kernel/slab/kmalloc-192/objects | 1 - test/sys/kernel/slab/kmalloc-192/objects_partial | 1 - test/sys/kernel/slab/kmalloc-192/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-192/order | 1 - test/sys/kernel/slab/kmalloc-192/partial | 1 - test/sys/kernel/slab/kmalloc-192/poison | 1 - test/sys/kernel/slab/kmalloc-192/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-192/red_zone | 1 - test/sys/kernel/slab/kmalloc-192/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-192/shrink | 0 test/sys/kernel/slab/kmalloc-192/slab_size | 1 - test/sys/kernel/slab/kmalloc-192/slabs | 1 - test/sys/kernel/slab/kmalloc-192/store_user | 1 - test/sys/kernel/slab/kmalloc-192/total_objects | 1 - test/sys/kernel/slab/kmalloc-192/trace | 1 - test/sys/kernel/slab/kmalloc-192/validate | 0 test/sys/kernel/slab/kmalloc-2048/aliases | 1 - test/sys/kernel/slab/kmalloc-2048/align | 1 - test/sys/kernel/slab/kmalloc-2048/alloc_calls | 41 - test/sys/kernel/slab/kmalloc-2048/cache_dma | 1 - test/sys/kernel/slab/kmalloc-2048/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-2048/ctor | 0 test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-2048/free_calls | 16 - test/sys/kernel/slab/kmalloc-2048/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-2048/object_size | 1 - test/sys/kernel/slab/kmalloc-2048/objects | 1 - test/sys/kernel/slab/kmalloc-2048/objects_partial | 1 - test/sys/kernel/slab/kmalloc-2048/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-2048/order | 1 - test/sys/kernel/slab/kmalloc-2048/partial | 1 - test/sys/kernel/slab/kmalloc-2048/poison | 1 - test/sys/kernel/slab/kmalloc-2048/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-2048/red_zone | 1 - test/sys/kernel/slab/kmalloc-2048/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-2048/shrink | 0 test/sys/kernel/slab/kmalloc-2048/slab_size | 1 - test/sys/kernel/slab/kmalloc-2048/slabs | 1 - test/sys/kernel/slab/kmalloc-2048/store_user | 1 - test/sys/kernel/slab/kmalloc-2048/total_objects | 1 - test/sys/kernel/slab/kmalloc-2048/trace | 1 - test/sys/kernel/slab/kmalloc-2048/validate | 0 test/sys/kernel/slab/kmalloc-256/aliases | 1 - test/sys/kernel/slab/kmalloc-256/align | 1 - test/sys/kernel/slab/kmalloc-256/alloc_calls | 27 - test/sys/kernel/slab/kmalloc-256/cache_dma | 1 - test/sys/kernel/slab/kmalloc-256/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-256/ctor | 0 test/sys/kernel/slab/kmalloc-256/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-256/free_calls | 12 - test/sys/kernel/slab/kmalloc-256/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-256/object_size | 1 - test/sys/kernel/slab/kmalloc-256/objects | 1 - test/sys/kernel/slab/kmalloc-256/objects_partial | 1 - test/sys/kernel/slab/kmalloc-256/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-256/order | 1 - test/sys/kernel/slab/kmalloc-256/partial | 1 - test/sys/kernel/slab/kmalloc-256/poison | 1 - test/sys/kernel/slab/kmalloc-256/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-256/red_zone | 1 - test/sys/kernel/slab/kmalloc-256/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-256/shrink | 0 test/sys/kernel/slab/kmalloc-256/slab_size | 1 - test/sys/kernel/slab/kmalloc-256/slabs | 1 - test/sys/kernel/slab/kmalloc-256/store_user | 1 - test/sys/kernel/slab/kmalloc-256/total_objects | 1 - test/sys/kernel/slab/kmalloc-256/trace | 1 - test/sys/kernel/slab/kmalloc-256/validate | 0 test/sys/kernel/slab/kmalloc-32/aliases | 1 - test/sys/kernel/slab/kmalloc-32/align | 1 - test/sys/kernel/slab/kmalloc-32/alloc_calls | 50 - test/sys/kernel/slab/kmalloc-32/cache_dma | 1 - test/sys/kernel/slab/kmalloc-32/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-32/ctor | 0 test/sys/kernel/slab/kmalloc-32/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-32/free_calls | 25 - test/sys/kernel/slab/kmalloc-32/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-32/object_size | 1 - test/sys/kernel/slab/kmalloc-32/objects | 1 - test/sys/kernel/slab/kmalloc-32/objects_partial | 1 - test/sys/kernel/slab/kmalloc-32/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-32/order | 1 - test/sys/kernel/slab/kmalloc-32/partial | 1 - test/sys/kernel/slab/kmalloc-32/poison | 1 - test/sys/kernel/slab/kmalloc-32/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-32/red_zone | 1 - test/sys/kernel/slab/kmalloc-32/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-32/shrink | 0 test/sys/kernel/slab/kmalloc-32/slab_size | 1 - test/sys/kernel/slab/kmalloc-32/slabs | 1 - test/sys/kernel/slab/kmalloc-32/store_user | 1 - test/sys/kernel/slab/kmalloc-32/total_objects | 1 - test/sys/kernel/slab/kmalloc-32/trace | 1 - test/sys/kernel/slab/kmalloc-32/validate | 0 test/sys/kernel/slab/kmalloc-4096/aliases | 1 - test/sys/kernel/slab/kmalloc-4096/align | 1 - test/sys/kernel/slab/kmalloc-4096/alloc_calls | 23 - test/sys/kernel/slab/kmalloc-4096/cache_dma | 1 - test/sys/kernel/slab/kmalloc-4096/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-4096/ctor | 0 test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-4096/free_calls | 7 - test/sys/kernel/slab/kmalloc-4096/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-4096/object_size | 1 - test/sys/kernel/slab/kmalloc-4096/objects | 1 - test/sys/kernel/slab/kmalloc-4096/objects_partial | 1 - test/sys/kernel/slab/kmalloc-4096/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-4096/order | 1 - test/sys/kernel/slab/kmalloc-4096/partial | 1 - test/sys/kernel/slab/kmalloc-4096/poison | 1 - test/sys/kernel/slab/kmalloc-4096/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-4096/red_zone | 1 - test/sys/kernel/slab/kmalloc-4096/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-4096/shrink | 0 test/sys/kernel/slab/kmalloc-4096/slab_size | 1 - test/sys/kernel/slab/kmalloc-4096/slabs | 1 - test/sys/kernel/slab/kmalloc-4096/store_user | 1 - test/sys/kernel/slab/kmalloc-4096/total_objects | 1 - test/sys/kernel/slab/kmalloc-4096/trace | 1 - test/sys/kernel/slab/kmalloc-4096/validate | 0 test/sys/kernel/slab/kmalloc-512/aliases | 1 - test/sys/kernel/slab/kmalloc-512/align | 1 - test/sys/kernel/slab/kmalloc-512/alloc_calls | 52 - test/sys/kernel/slab/kmalloc-512/cache_dma | 1 - test/sys/kernel/slab/kmalloc-512/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-512/ctor | 0 test/sys/kernel/slab/kmalloc-512/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-512/free_calls | 10 - test/sys/kernel/slab/kmalloc-512/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-512/object_size | 1 - test/sys/kernel/slab/kmalloc-512/objects | 1 - test/sys/kernel/slab/kmalloc-512/objects_partial | 1 - test/sys/kernel/slab/kmalloc-512/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-512/order | 1 - test/sys/kernel/slab/kmalloc-512/partial | 1 - test/sys/kernel/slab/kmalloc-512/poison | 1 - test/sys/kernel/slab/kmalloc-512/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-512/red_zone | 1 - test/sys/kernel/slab/kmalloc-512/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-512/shrink | 0 test/sys/kernel/slab/kmalloc-512/slab_size | 1 - test/sys/kernel/slab/kmalloc-512/slabs | 1 - test/sys/kernel/slab/kmalloc-512/store_user | 1 - test/sys/kernel/slab/kmalloc-512/total_objects | 1 - test/sys/kernel/slab/kmalloc-512/trace | 1 - test/sys/kernel/slab/kmalloc-512/validate | 0 test/sys/kernel/slab/kmalloc-64/aliases | 1 - test/sys/kernel/slab/kmalloc-64/align | 1 - test/sys/kernel/slab/kmalloc-64/alloc_calls | 51 - test/sys/kernel/slab/kmalloc-64/cache_dma | 1 - test/sys/kernel/slab/kmalloc-64/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-64/ctor | 0 test/sys/kernel/slab/kmalloc-64/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-64/free_calls | 49 - test/sys/kernel/slab/kmalloc-64/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-64/object_size | 1 - test/sys/kernel/slab/kmalloc-64/objects | 1 - test/sys/kernel/slab/kmalloc-64/objects_partial | 1 - test/sys/kernel/slab/kmalloc-64/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-64/order | 1 - test/sys/kernel/slab/kmalloc-64/partial | 1 - test/sys/kernel/slab/kmalloc-64/poison | 1 - test/sys/kernel/slab/kmalloc-64/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-64/red_zone | 1 - test/sys/kernel/slab/kmalloc-64/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-64/shrink | 0 test/sys/kernel/slab/kmalloc-64/slab_size | 1 - test/sys/kernel/slab/kmalloc-64/slabs | 1 - test/sys/kernel/slab/kmalloc-64/store_user | 1 - test/sys/kernel/slab/kmalloc-64/total_objects | 1 - test/sys/kernel/slab/kmalloc-64/trace | 1 - test/sys/kernel/slab/kmalloc-64/validate | 0 test/sys/kernel/slab/kmalloc-8/aliases | 1 - test/sys/kernel/slab/kmalloc-8/align | 1 - test/sys/kernel/slab/kmalloc-8/alloc_calls | 32 - test/sys/kernel/slab/kmalloc-8/cache_dma | 1 - test/sys/kernel/slab/kmalloc-8/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-8/ctor | 0 test/sys/kernel/slab/kmalloc-8/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-8/free_calls | 25 - test/sys/kernel/slab/kmalloc-8/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-8/object_size | 1 - test/sys/kernel/slab/kmalloc-8/objects | 1 - test/sys/kernel/slab/kmalloc-8/objects_partial | 1 - test/sys/kernel/slab/kmalloc-8/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-8/order | 1 - test/sys/kernel/slab/kmalloc-8/partial | 1 - test/sys/kernel/slab/kmalloc-8/poison | 1 - test/sys/kernel/slab/kmalloc-8/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-8/red_zone | 1 - test/sys/kernel/slab/kmalloc-8/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-8/shrink | 0 test/sys/kernel/slab/kmalloc-8/slab_size | 1 - test/sys/kernel/slab/kmalloc-8/slabs | 1 - test/sys/kernel/slab/kmalloc-8/store_user | 1 - test/sys/kernel/slab/kmalloc-8/total_objects | 1 - test/sys/kernel/slab/kmalloc-8/trace | 1 - test/sys/kernel/slab/kmalloc-8/validate | 0 test/sys/kernel/slab/kmalloc-96/aliases | 1 - test/sys/kernel/slab/kmalloc-96/align | 1 - test/sys/kernel/slab/kmalloc-96/alloc_calls | 39 - test/sys/kernel/slab/kmalloc-96/cache_dma | 1 - test/sys/kernel/slab/kmalloc-96/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc-96/ctor | 0 test/sys/kernel/slab/kmalloc-96/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc-96/free_calls | 18 - test/sys/kernel/slab/kmalloc-96/hwcache_align | 1 - test/sys/kernel/slab/kmalloc-96/object_size | 1 - test/sys/kernel/slab/kmalloc-96/objects | 1 - test/sys/kernel/slab/kmalloc-96/objects_partial | 1 - test/sys/kernel/slab/kmalloc-96/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc-96/order | 1 - test/sys/kernel/slab/kmalloc-96/partial | 1 - test/sys/kernel/slab/kmalloc-96/poison | 1 - test/sys/kernel/slab/kmalloc-96/reclaim_account | 1 - test/sys/kernel/slab/kmalloc-96/red_zone | 1 - test/sys/kernel/slab/kmalloc-96/sanity_checks | 1 - test/sys/kernel/slab/kmalloc-96/shrink | 0 test/sys/kernel/slab/kmalloc-96/slab_size | 1 - test/sys/kernel/slab/kmalloc-96/slabs | 1 - test/sys/kernel/slab/kmalloc-96/store_user | 1 - test/sys/kernel/slab/kmalloc-96/total_objects | 1 - test/sys/kernel/slab/kmalloc-96/trace | 1 - test/sys/kernel/slab/kmalloc-96/validate | 0 test/sys/kernel/slab/kmalloc_dma-512/aliases | 1 - test/sys/kernel/slab/kmalloc_dma-512/align | 1 - test/sys/kernel/slab/kmalloc_dma-512/alloc_calls | 1 - test/sys/kernel/slab/kmalloc_dma-512/cache_dma | 1 - test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs | 1 - test/sys/kernel/slab/kmalloc_dma-512/ctor | 0 .../sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu | 1 - test/sys/kernel/slab/kmalloc_dma-512/free_calls | 1 - test/sys/kernel/slab/kmalloc_dma-512/hwcache_align | 1 - test/sys/kernel/slab/kmalloc_dma-512/object_size | 1 - test/sys/kernel/slab/kmalloc_dma-512/objects | 1 - .../kernel/slab/kmalloc_dma-512/objects_partial | 1 - test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab | 1 - test/sys/kernel/slab/kmalloc_dma-512/order | 1 - test/sys/kernel/slab/kmalloc_dma-512/partial | 1 - test/sys/kernel/slab/kmalloc_dma-512/poison | 1 - .../kernel/slab/kmalloc_dma-512/reclaim_account | 1 - test/sys/kernel/slab/kmalloc_dma-512/red_zone | 1 - test/sys/kernel/slab/kmalloc_dma-512/sanity_checks | 1 - test/sys/kernel/slab/kmalloc_dma-512/shrink | 0 test/sys/kernel/slab/kmalloc_dma-512/slab_size | 1 - test/sys/kernel/slab/kmalloc_dma-512/slabs | 1 - test/sys/kernel/slab/kmalloc_dma-512/store_user | 1 - test/sys/kernel/slab/kmalloc_dma-512/total_objects | 1 - test/sys/kernel/slab/kmalloc_dma-512/trace | 1 - test/sys/kernel/slab/kmalloc_dma-512/validate | 0 test/sys/kernel/slab/mm_struct/aliases | 1 - test/sys/kernel/slab/mm_struct/align | 1 - test/sys/kernel/slab/mm_struct/alloc_calls | 2 - test/sys/kernel/slab/mm_struct/cache_dma | 1 - test/sys/kernel/slab/mm_struct/cpu_slabs | 1 - test/sys/kernel/slab/mm_struct/ctor | 0 test/sys/kernel/slab/mm_struct/destroy_by_rcu | 1 - test/sys/kernel/slab/mm_struct/free_calls | 2 - test/sys/kernel/slab/mm_struct/hwcache_align | 1 - test/sys/kernel/slab/mm_struct/object_size | 1 - test/sys/kernel/slab/mm_struct/objects | 1 - test/sys/kernel/slab/mm_struct/objects_partial | 1 - test/sys/kernel/slab/mm_struct/objs_per_slab | 1 - test/sys/kernel/slab/mm_struct/order | 1 - test/sys/kernel/slab/mm_struct/partial | 1 - test/sys/kernel/slab/mm_struct/poison | 1 - test/sys/kernel/slab/mm_struct/reclaim_account | 1 - test/sys/kernel/slab/mm_struct/red_zone | 1 - test/sys/kernel/slab/mm_struct/sanity_checks | 1 - test/sys/kernel/slab/mm_struct/shrink | 0 test/sys/kernel/slab/mm_struct/slab_size | 1 - test/sys/kernel/slab/mm_struct/slabs | 1 - test/sys/kernel/slab/mm_struct/store_user | 1 - test/sys/kernel/slab/mm_struct/total_objects | 1 - test/sys/kernel/slab/mm_struct/trace | 1 - test/sys/kernel/slab/mm_struct/validate | 0 test/sys/kernel/slab/mnt_cache/aliases | 1 - test/sys/kernel/slab/mnt_cache/align | 1 - test/sys/kernel/slab/mnt_cache/alloc_calls | 1 - test/sys/kernel/slab/mnt_cache/cache_dma | 1 - test/sys/kernel/slab/mnt_cache/cpu_slabs | 1 - test/sys/kernel/slab/mnt_cache/ctor | 0 test/sys/kernel/slab/mnt_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/mnt_cache/free_calls | 2 - test/sys/kernel/slab/mnt_cache/hwcache_align | 1 - test/sys/kernel/slab/mnt_cache/object_size | 1 - test/sys/kernel/slab/mnt_cache/objects | 1 - test/sys/kernel/slab/mnt_cache/objects_partial | 1 - test/sys/kernel/slab/mnt_cache/objs_per_slab | 1 - test/sys/kernel/slab/mnt_cache/order | 1 - test/sys/kernel/slab/mnt_cache/partial | 1 - test/sys/kernel/slab/mnt_cache/poison | 1 - test/sys/kernel/slab/mnt_cache/reclaim_account | 1 - test/sys/kernel/slab/mnt_cache/red_zone | 1 - test/sys/kernel/slab/mnt_cache/sanity_checks | 1 - test/sys/kernel/slab/mnt_cache/shrink | 0 test/sys/kernel/slab/mnt_cache/slab_size | 1 - test/sys/kernel/slab/mnt_cache/slabs | 1 - test/sys/kernel/slab/mnt_cache/store_user | 1 - test/sys/kernel/slab/mnt_cache/total_objects | 1 - test/sys/kernel/slab/mnt_cache/trace | 1 - test/sys/kernel/slab/mnt_cache/validate | 0 test/sys/kernel/slab/mqueue_inode_cache/aliases | 1 - test/sys/kernel/slab/mqueue_inode_cache/align | 1 - .../sys/kernel/slab/mqueue_inode_cache/alloc_calls | 1 - test/sys/kernel/slab/mqueue_inode_cache/cache_dma | 1 - test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs | 1 - test/sys/kernel/slab/mqueue_inode_cache/ctor | 1 - .../kernel/slab/mqueue_inode_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/mqueue_inode_cache/free_calls | 1 - .../kernel/slab/mqueue_inode_cache/hwcache_align | 1 - .../sys/kernel/slab/mqueue_inode_cache/object_size | 1 - test/sys/kernel/slab/mqueue_inode_cache/objects | 1 - .../kernel/slab/mqueue_inode_cache/objects_partial | 1 - .../kernel/slab/mqueue_inode_cache/objs_per_slab | 1 - test/sys/kernel/slab/mqueue_inode_cache/order | 1 - test/sys/kernel/slab/mqueue_inode_cache/partial | 1 - test/sys/kernel/slab/mqueue_inode_cache/poison | 1 - .../kernel/slab/mqueue_inode_cache/reclaim_account | 1 - test/sys/kernel/slab/mqueue_inode_cache/red_zone | 1 - .../kernel/slab/mqueue_inode_cache/sanity_checks | 1 - test/sys/kernel/slab/mqueue_inode_cache/shrink | 0 test/sys/kernel/slab/mqueue_inode_cache/slab_size | 1 - test/sys/kernel/slab/mqueue_inode_cache/slabs | 1 - test/sys/kernel/slab/mqueue_inode_cache/store_user | 1 - .../kernel/slab/mqueue_inode_cache/total_objects | 1 - test/sys/kernel/slab/mqueue_inode_cache/trace | 1 - test/sys/kernel/slab/mqueue_inode_cache/validate | 0 test/sys/kernel/slab/names_cache/aliases | 1 - test/sys/kernel/slab/names_cache/align | 1 - test/sys/kernel/slab/names_cache/alloc_calls | 1 - test/sys/kernel/slab/names_cache/cache_dma | 1 - test/sys/kernel/slab/names_cache/cpu_slabs | 1 - test/sys/kernel/slab/names_cache/ctor | 0 test/sys/kernel/slab/names_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/names_cache/free_calls | 1 - test/sys/kernel/slab/names_cache/hwcache_align | 1 - test/sys/kernel/slab/names_cache/object_size | 1 - test/sys/kernel/slab/names_cache/objects | 1 - test/sys/kernel/slab/names_cache/objects_partial | 1 - test/sys/kernel/slab/names_cache/objs_per_slab | 1 - test/sys/kernel/slab/names_cache/order | 1 - test/sys/kernel/slab/names_cache/partial | 1 - test/sys/kernel/slab/names_cache/poison | 1 - test/sys/kernel/slab/names_cache/reclaim_account | 1 - test/sys/kernel/slab/names_cache/red_zone | 1 - test/sys/kernel/slab/names_cache/sanity_checks | 1 - test/sys/kernel/slab/names_cache/shrink | 0 test/sys/kernel/slab/names_cache/slab_size | 1 - test/sys/kernel/slab/names_cache/slabs | 1 - test/sys/kernel/slab/names_cache/store_user | 1 - test/sys/kernel/slab/names_cache/total_objects | 1 - test/sys/kernel/slab/names_cache/trace | 1 - test/sys/kernel/slab/names_cache/validate | 0 test/sys/kernel/slab/ndisc_cache/aliases | 1 - test/sys/kernel/slab/ndisc_cache/align | 1 - test/sys/kernel/slab/ndisc_cache/alloc_calls | 1 - test/sys/kernel/slab/ndisc_cache/cache_dma | 1 - test/sys/kernel/slab/ndisc_cache/cpu_slabs | 1 - test/sys/kernel/slab/ndisc_cache/ctor | 0 test/sys/kernel/slab/ndisc_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/ndisc_cache/free_calls | 1 - test/sys/kernel/slab/ndisc_cache/hwcache_align | 1 - test/sys/kernel/slab/ndisc_cache/object_size | 1 - test/sys/kernel/slab/ndisc_cache/objects | 1 - test/sys/kernel/slab/ndisc_cache/objects_partial | 1 - test/sys/kernel/slab/ndisc_cache/objs_per_slab | 1 - test/sys/kernel/slab/ndisc_cache/order | 1 - test/sys/kernel/slab/ndisc_cache/partial | 1 - test/sys/kernel/slab/ndisc_cache/poison | 1 - test/sys/kernel/slab/ndisc_cache/reclaim_account | 1 - test/sys/kernel/slab/ndisc_cache/red_zone | 1 - test/sys/kernel/slab/ndisc_cache/sanity_checks | 1 - test/sys/kernel/slab/ndisc_cache/shrink | 0 test/sys/kernel/slab/ndisc_cache/slab_size | 1 - test/sys/kernel/slab/ndisc_cache/slabs | 1 - test/sys/kernel/slab/ndisc_cache/store_user | 1 - test/sys/kernel/slab/ndisc_cache/total_objects | 1 - test/sys/kernel/slab/ndisc_cache/trace | 1 - test/sys/kernel/slab/ndisc_cache/validate | 0 test/sys/kernel/slab/nsproxy/aliases | 1 - test/sys/kernel/slab/nsproxy/align | 1 - test/sys/kernel/slab/nsproxy/alloc_calls | 1 - test/sys/kernel/slab/nsproxy/cache_dma | 1 - test/sys/kernel/slab/nsproxy/cpu_slabs | 1 - test/sys/kernel/slab/nsproxy/ctor | 0 test/sys/kernel/slab/nsproxy/destroy_by_rcu | 1 - test/sys/kernel/slab/nsproxy/free_calls | 1 - test/sys/kernel/slab/nsproxy/hwcache_align | 1 - test/sys/kernel/slab/nsproxy/object_size | 1 - test/sys/kernel/slab/nsproxy/objects | 1 - test/sys/kernel/slab/nsproxy/objects_partial | 1 - test/sys/kernel/slab/nsproxy/objs_per_slab | 1 - test/sys/kernel/slab/nsproxy/order | 1 - test/sys/kernel/slab/nsproxy/partial | 1 - test/sys/kernel/slab/nsproxy/poison | 1 - test/sys/kernel/slab/nsproxy/reclaim_account | 1 - test/sys/kernel/slab/nsproxy/red_zone | 1 - test/sys/kernel/slab/nsproxy/sanity_checks | 1 - test/sys/kernel/slab/nsproxy/shrink | 0 test/sys/kernel/slab/nsproxy/slab_size | 1 - test/sys/kernel/slab/nsproxy/slabs | 1 - test/sys/kernel/slab/nsproxy/store_user | 1 - test/sys/kernel/slab/nsproxy/total_objects | 1 - test/sys/kernel/slab/nsproxy/trace | 1 - test/sys/kernel/slab/nsproxy/validate | 0 test/sys/kernel/slab/pid/aliases | 1 - test/sys/kernel/slab/pid/align | 1 - test/sys/kernel/slab/pid/alloc_calls | 1 - test/sys/kernel/slab/pid/cache_dma | 1 - test/sys/kernel/slab/pid/cpu_slabs | 1 - test/sys/kernel/slab/pid/ctor | 0 test/sys/kernel/slab/pid/destroy_by_rcu | 1 - test/sys/kernel/slab/pid/free_calls | 2 - test/sys/kernel/slab/pid/hwcache_align | 1 - test/sys/kernel/slab/pid/object_size | 1 - test/sys/kernel/slab/pid/objects | 1 - test/sys/kernel/slab/pid/objects_partial | 1 - test/sys/kernel/slab/pid/objs_per_slab | 1 - test/sys/kernel/slab/pid/order | 1 - test/sys/kernel/slab/pid/partial | 1 - test/sys/kernel/slab/pid/poison | 1 - test/sys/kernel/slab/pid/reclaim_account | 1 - test/sys/kernel/slab/pid/red_zone | 1 - test/sys/kernel/slab/pid/sanity_checks | 1 - test/sys/kernel/slab/pid/shrink | 0 test/sys/kernel/slab/pid/slab_size | 1 - test/sys/kernel/slab/pid/slabs | 1 - test/sys/kernel/slab/pid/store_user | 1 - test/sys/kernel/slab/pid/total_objects | 1 - test/sys/kernel/slab/pid/trace | 1 - test/sys/kernel/slab/pid/validate | 0 test/sys/kernel/slab/posix_timers_cache/aliases | 1 - test/sys/kernel/slab/posix_timers_cache/align | 1 - .../sys/kernel/slab/posix_timers_cache/alloc_calls | 1 - test/sys/kernel/slab/posix_timers_cache/cache_dma | 1 - test/sys/kernel/slab/posix_timers_cache/cpu_slabs | 1 - test/sys/kernel/slab/posix_timers_cache/ctor | 0 .../kernel/slab/posix_timers_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/posix_timers_cache/free_calls | 1 - .../kernel/slab/posix_timers_cache/hwcache_align | 1 - .../sys/kernel/slab/posix_timers_cache/object_size | 1 - test/sys/kernel/slab/posix_timers_cache/objects | 1 - .../kernel/slab/posix_timers_cache/objects_partial | 1 - .../kernel/slab/posix_timers_cache/objs_per_slab | 1 - test/sys/kernel/slab/posix_timers_cache/order | 1 - test/sys/kernel/slab/posix_timers_cache/partial | 1 - test/sys/kernel/slab/posix_timers_cache/poison | 1 - .../kernel/slab/posix_timers_cache/reclaim_account | 1 - test/sys/kernel/slab/posix_timers_cache/red_zone | 1 - .../kernel/slab/posix_timers_cache/sanity_checks | 1 - test/sys/kernel/slab/posix_timers_cache/shrink | 0 test/sys/kernel/slab/posix_timers_cache/slab_size | 1 - test/sys/kernel/slab/posix_timers_cache/slabs | 1 - test/sys/kernel/slab/posix_timers_cache/store_user | 1 - .../kernel/slab/posix_timers_cache/total_objects | 1 - test/sys/kernel/slab/posix_timers_cache/trace | 1 - test/sys/kernel/slab/posix_timers_cache/validate | 0 test/sys/kernel/slab/proc_inode_cache/aliases | 1 - test/sys/kernel/slab/proc_inode_cache/align | 1 - test/sys/kernel/slab/proc_inode_cache/alloc_calls | 1 - test/sys/kernel/slab/proc_inode_cache/cache_dma | 1 - test/sys/kernel/slab/proc_inode_cache/cpu_slabs | 1 - test/sys/kernel/slab/proc_inode_cache/ctor | 1 - .../kernel/slab/proc_inode_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/proc_inode_cache/free_calls | 2 - .../sys/kernel/slab/proc_inode_cache/hwcache_align | 1 - test/sys/kernel/slab/proc_inode_cache/object_size | 1 - test/sys/kernel/slab/proc_inode_cache/objects | 1 - .../kernel/slab/proc_inode_cache/objects_partial | 1 - .../sys/kernel/slab/proc_inode_cache/objs_per_slab | 1 - test/sys/kernel/slab/proc_inode_cache/order | 1 - test/sys/kernel/slab/proc_inode_cache/partial | 1 - test/sys/kernel/slab/proc_inode_cache/poison | 1 - .../kernel/slab/proc_inode_cache/reclaim_account | 1 - test/sys/kernel/slab/proc_inode_cache/red_zone | 1 - .../sys/kernel/slab/proc_inode_cache/sanity_checks | 1 - test/sys/kernel/slab/proc_inode_cache/shrink | 0 test/sys/kernel/slab/proc_inode_cache/slab_size | 1 - test/sys/kernel/slab/proc_inode_cache/slabs | 1 - test/sys/kernel/slab/proc_inode_cache/store_user | 1 - .../sys/kernel/slab/proc_inode_cache/total_objects | 1 - test/sys/kernel/slab/proc_inode_cache/trace | 1 - test/sys/kernel/slab/proc_inode_cache/validate | 0 test/sys/kernel/slab/radix_tree_node/aliases | 1 - test/sys/kernel/slab/radix_tree_node/align | 1 - test/sys/kernel/slab/radix_tree_node/alloc_calls | 1 - test/sys/kernel/slab/radix_tree_node/cache_dma | 1 - test/sys/kernel/slab/radix_tree_node/cpu_slabs | 1 - test/sys/kernel/slab/radix_tree_node/ctor | 1 - .../sys/kernel/slab/radix_tree_node/destroy_by_rcu | 1 - test/sys/kernel/slab/radix_tree_node/free_calls | 2 - test/sys/kernel/slab/radix_tree_node/hwcache_align | 1 - test/sys/kernel/slab/radix_tree_node/object_size | 1 - test/sys/kernel/slab/radix_tree_node/objects | 1 - .../kernel/slab/radix_tree_node/objects_partial | 1 - test/sys/kernel/slab/radix_tree_node/objs_per_slab | 1 - test/sys/kernel/slab/radix_tree_node/order | 1 - test/sys/kernel/slab/radix_tree_node/partial | 1 - test/sys/kernel/slab/radix_tree_node/poison | 1 - .../kernel/slab/radix_tree_node/reclaim_account | 1 - test/sys/kernel/slab/radix_tree_node/red_zone | 1 - test/sys/kernel/slab/radix_tree_node/sanity_checks | 1 - test/sys/kernel/slab/radix_tree_node/shrink | 0 test/sys/kernel/slab/radix_tree_node/slab_size | 1 - test/sys/kernel/slab/radix_tree_node/slabs | 1 - test/sys/kernel/slab/radix_tree_node/store_user | 1 - test/sys/kernel/slab/radix_tree_node/total_objects | 1 - test/sys/kernel/slab/radix_tree_node/trace | 1 - test/sys/kernel/slab/radix_tree_node/validate | 0 test/sys/kernel/slab/request_sock_TCP/aliases | 1 - test/sys/kernel/slab/request_sock_TCP/align | 1 - test/sys/kernel/slab/request_sock_TCP/alloc_calls | 1 - test/sys/kernel/slab/request_sock_TCP/cache_dma | 1 - test/sys/kernel/slab/request_sock_TCP/cpu_slabs | 1 - test/sys/kernel/slab/request_sock_TCP/ctor | 0 .../kernel/slab/request_sock_TCP/destroy_by_rcu | 1 - test/sys/kernel/slab/request_sock_TCP/free_calls | 1 - .../sys/kernel/slab/request_sock_TCP/hwcache_align | 1 - test/sys/kernel/slab/request_sock_TCP/object_size | 1 - test/sys/kernel/slab/request_sock_TCP/objects | 1 - .../kernel/slab/request_sock_TCP/objects_partial | 1 - .../sys/kernel/slab/request_sock_TCP/objs_per_slab | 1 - test/sys/kernel/slab/request_sock_TCP/order | 1 - test/sys/kernel/slab/request_sock_TCP/partial | 1 - test/sys/kernel/slab/request_sock_TCP/poison | 1 - .../kernel/slab/request_sock_TCP/reclaim_account | 1 - test/sys/kernel/slab/request_sock_TCP/red_zone | 1 - .../sys/kernel/slab/request_sock_TCP/sanity_checks | 1 - test/sys/kernel/slab/request_sock_TCP/shrink | 0 test/sys/kernel/slab/request_sock_TCP/slab_size | 1 - test/sys/kernel/slab/request_sock_TCP/slabs | 1 - test/sys/kernel/slab/request_sock_TCP/store_user | 1 - .../sys/kernel/slab/request_sock_TCP/total_objects | 1 - test/sys/kernel/slab/request_sock_TCP/trace | 1 - test/sys/kernel/slab/request_sock_TCP/validate | 0 test/sys/kernel/slab/request_sock_TCPv6/aliases | 1 - test/sys/kernel/slab/request_sock_TCPv6/align | 1 - .../sys/kernel/slab/request_sock_TCPv6/alloc_calls | 1 - test/sys/kernel/slab/request_sock_TCPv6/cache_dma | 1 - test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs | 1 - test/sys/kernel/slab/request_sock_TCPv6/ctor | 0 .../kernel/slab/request_sock_TCPv6/destroy_by_rcu | 1 - test/sys/kernel/slab/request_sock_TCPv6/free_calls | 1 - .../kernel/slab/request_sock_TCPv6/hwcache_align | 1 - .../sys/kernel/slab/request_sock_TCPv6/object_size | 1 - test/sys/kernel/slab/request_sock_TCPv6/objects | 1 - .../kernel/slab/request_sock_TCPv6/objects_partial | 1 - .../kernel/slab/request_sock_TCPv6/objs_per_slab | 1 - test/sys/kernel/slab/request_sock_TCPv6/order | 1 - test/sys/kernel/slab/request_sock_TCPv6/partial | 1 - test/sys/kernel/slab/request_sock_TCPv6/poison | 1 - .../kernel/slab/request_sock_TCPv6/reclaim_account | 1 - test/sys/kernel/slab/request_sock_TCPv6/red_zone | 1 - .../kernel/slab/request_sock_TCPv6/sanity_checks | 1 - test/sys/kernel/slab/request_sock_TCPv6/shrink | 0 test/sys/kernel/slab/request_sock_TCPv6/slab_size | 1 - test/sys/kernel/slab/request_sock_TCPv6/slabs | 1 - test/sys/kernel/slab/request_sock_TCPv6/store_user | 1 - .../kernel/slab/request_sock_TCPv6/total_objects | 1 - test/sys/kernel/slab/request_sock_TCPv6/trace | 1 - test/sys/kernel/slab/request_sock_TCPv6/validate | 0 test/sys/kernel/slab/revoke_record/aliases | 1 - test/sys/kernel/slab/revoke_record/align | 1 - test/sys/kernel/slab/revoke_record/alloc_calls | 1 - test/sys/kernel/slab/revoke_record/cache_dma | 1 - test/sys/kernel/slab/revoke_record/cpu_slabs | 1 - test/sys/kernel/slab/revoke_record/ctor | 0 test/sys/kernel/slab/revoke_record/destroy_by_rcu | 1 - test/sys/kernel/slab/revoke_record/free_calls | 1 - test/sys/kernel/slab/revoke_record/hwcache_align | 1 - test/sys/kernel/slab/revoke_record/object_size | 1 - test/sys/kernel/slab/revoke_record/objects | 1 - test/sys/kernel/slab/revoke_record/objects_partial | 1 - test/sys/kernel/slab/revoke_record/objs_per_slab | 1 - test/sys/kernel/slab/revoke_record/order | 1 - test/sys/kernel/slab/revoke_record/partial | 1 - test/sys/kernel/slab/revoke_record/poison | 1 - test/sys/kernel/slab/revoke_record/reclaim_account | 1 - test/sys/kernel/slab/revoke_record/red_zone | 1 - test/sys/kernel/slab/revoke_record/sanity_checks | 1 - test/sys/kernel/slab/revoke_record/shrink | 0 test/sys/kernel/slab/revoke_record/slab_size | 1 - test/sys/kernel/slab/revoke_record/slabs | 1 - test/sys/kernel/slab/revoke_record/store_user | 1 - test/sys/kernel/slab/revoke_record/total_objects | 1 - test/sys/kernel/slab/revoke_record/trace | 1 - test/sys/kernel/slab/revoke_record/validate | 0 test/sys/kernel/slab/revoke_table/aliases | 1 - test/sys/kernel/slab/revoke_table/align | 1 - test/sys/kernel/slab/revoke_table/alloc_calls | 1 - test/sys/kernel/slab/revoke_table/cache_dma | 1 - test/sys/kernel/slab/revoke_table/cpu_slabs | 1 - test/sys/kernel/slab/revoke_table/ctor | 0 test/sys/kernel/slab/revoke_table/destroy_by_rcu | 1 - test/sys/kernel/slab/revoke_table/free_calls | 1 - test/sys/kernel/slab/revoke_table/hwcache_align | 1 - test/sys/kernel/slab/revoke_table/object_size | 1 - test/sys/kernel/slab/revoke_table/objects | 1 - test/sys/kernel/slab/revoke_table/objects_partial | 1 - test/sys/kernel/slab/revoke_table/objs_per_slab | 1 - test/sys/kernel/slab/revoke_table/order | 1 - test/sys/kernel/slab/revoke_table/partial | 1 - test/sys/kernel/slab/revoke_table/poison | 1 - test/sys/kernel/slab/revoke_table/reclaim_account | 1 - test/sys/kernel/slab/revoke_table/red_zone | 1 - test/sys/kernel/slab/revoke_table/sanity_checks | 1 - test/sys/kernel/slab/revoke_table/shrink | 0 test/sys/kernel/slab/revoke_table/slab_size | 1 - test/sys/kernel/slab/revoke_table/slabs | 1 - test/sys/kernel/slab/revoke_table/store_user | 1 - test/sys/kernel/slab/revoke_table/total_objects | 1 - test/sys/kernel/slab/revoke_table/trace | 1 - test/sys/kernel/slab/revoke_table/validate | 0 test/sys/kernel/slab/scsi_cmd_cache/aliases | 1 - test/sys/kernel/slab/scsi_cmd_cache/align | 1 - test/sys/kernel/slab/scsi_cmd_cache/alloc_calls | 1 - test/sys/kernel/slab/scsi_cmd_cache/cache_dma | 1 - test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs | 1 - test/sys/kernel/slab/scsi_cmd_cache/ctor | 0 test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/scsi_cmd_cache/free_calls | 2 - test/sys/kernel/slab/scsi_cmd_cache/hwcache_align | 1 - test/sys/kernel/slab/scsi_cmd_cache/object_size | 1 - test/sys/kernel/slab/scsi_cmd_cache/objects | 1 - .../sys/kernel/slab/scsi_cmd_cache/objects_partial | 1 - test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab | 1 - test/sys/kernel/slab/scsi_cmd_cache/order | 1 - test/sys/kernel/slab/scsi_cmd_cache/partial | 1 - test/sys/kernel/slab/scsi_cmd_cache/poison | 1 - .../sys/kernel/slab/scsi_cmd_cache/reclaim_account | 1 - test/sys/kernel/slab/scsi_cmd_cache/red_zone | 1 - test/sys/kernel/slab/scsi_cmd_cache/sanity_checks | 1 - test/sys/kernel/slab/scsi_cmd_cache/shrink | 0 test/sys/kernel/slab/scsi_cmd_cache/slab_size | 1 - test/sys/kernel/slab/scsi_cmd_cache/slabs | 1 - test/sys/kernel/slab/scsi_cmd_cache/store_user | 1 - test/sys/kernel/slab/scsi_cmd_cache/total_objects | 1 - test/sys/kernel/slab/scsi_cmd_cache/trace | 1 - test/sys/kernel/slab/scsi_cmd_cache/validate | 0 test/sys/kernel/slab/scsi_data_buffer/aliases | 1 - test/sys/kernel/slab/scsi_data_buffer/align | 1 - test/sys/kernel/slab/scsi_data_buffer/alloc_calls | 1 - test/sys/kernel/slab/scsi_data_buffer/cache_dma | 1 - test/sys/kernel/slab/scsi_data_buffer/cpu_slabs | 1 - test/sys/kernel/slab/scsi_data_buffer/ctor | 0 .../kernel/slab/scsi_data_buffer/destroy_by_rcu | 1 - test/sys/kernel/slab/scsi_data_buffer/free_calls | 1 - .../sys/kernel/slab/scsi_data_buffer/hwcache_align | 1 - test/sys/kernel/slab/scsi_data_buffer/object_size | 1 - test/sys/kernel/slab/scsi_data_buffer/objects | 1 - .../kernel/slab/scsi_data_buffer/objects_partial | 1 - .../sys/kernel/slab/scsi_data_buffer/objs_per_slab | 1 - test/sys/kernel/slab/scsi_data_buffer/order | 1 - test/sys/kernel/slab/scsi_data_buffer/partial | 1 - test/sys/kernel/slab/scsi_data_buffer/poison | 1 - .../kernel/slab/scsi_data_buffer/reclaim_account | 1 - test/sys/kernel/slab/scsi_data_buffer/red_zone | 1 - .../sys/kernel/slab/scsi_data_buffer/sanity_checks | 1 - test/sys/kernel/slab/scsi_data_buffer/shrink | 0 test/sys/kernel/slab/scsi_data_buffer/slab_size | 1 - test/sys/kernel/slab/scsi_data_buffer/slabs | 1 - test/sys/kernel/slab/scsi_data_buffer/store_user | 1 - .../sys/kernel/slab/scsi_data_buffer/total_objects | 1 - test/sys/kernel/slab/scsi_data_buffer/trace | 1 - test/sys/kernel/slab/scsi_data_buffer/validate | 0 test/sys/kernel/slab/scsi_io_context/aliases | 1 - test/sys/kernel/slab/scsi_io_context/align | 1 - test/sys/kernel/slab/scsi_io_context/alloc_calls | 1 - test/sys/kernel/slab/scsi_io_context/cache_dma | 1 - test/sys/kernel/slab/scsi_io_context/cpu_slabs | 1 - test/sys/kernel/slab/scsi_io_context/ctor | 0 .../sys/kernel/slab/scsi_io_context/destroy_by_rcu | 1 - test/sys/kernel/slab/scsi_io_context/free_calls | 1 - test/sys/kernel/slab/scsi_io_context/hwcache_align | 1 - test/sys/kernel/slab/scsi_io_context/object_size | 1 - test/sys/kernel/slab/scsi_io_context/objects | 1 - .../kernel/slab/scsi_io_context/objects_partial | 1 - test/sys/kernel/slab/scsi_io_context/objs_per_slab | 1 - test/sys/kernel/slab/scsi_io_context/order | 1 - test/sys/kernel/slab/scsi_io_context/partial | 1 - test/sys/kernel/slab/scsi_io_context/poison | 1 - .../kernel/slab/scsi_io_context/reclaim_account | 1 - test/sys/kernel/slab/scsi_io_context/red_zone | 1 - test/sys/kernel/slab/scsi_io_context/sanity_checks | 1 - test/sys/kernel/slab/scsi_io_context/shrink | 0 test/sys/kernel/slab/scsi_io_context/slab_size | 1 - test/sys/kernel/slab/scsi_io_context/slabs | 1 - test/sys/kernel/slab/scsi_io_context/store_user | 1 - test/sys/kernel/slab/scsi_io_context/total_objects | 1 - test/sys/kernel/slab/scsi_io_context/trace | 1 - test/sys/kernel/slab/scsi_io_context/validate | 0 test/sys/kernel/slab/scsi_sense_cache/aliases | 1 - test/sys/kernel/slab/scsi_sense_cache/align | 1 - test/sys/kernel/slab/scsi_sense_cache/alloc_calls | 1 - test/sys/kernel/slab/scsi_sense_cache/cache_dma | 1 - test/sys/kernel/slab/scsi_sense_cache/cpu_slabs | 1 - test/sys/kernel/slab/scsi_sense_cache/ctor | 0 .../kernel/slab/scsi_sense_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/scsi_sense_cache/free_calls | 2 - .../sys/kernel/slab/scsi_sense_cache/hwcache_align | 1 - test/sys/kernel/slab/scsi_sense_cache/object_size | 1 - test/sys/kernel/slab/scsi_sense_cache/objects | 1 - .../kernel/slab/scsi_sense_cache/objects_partial | 1 - .../sys/kernel/slab/scsi_sense_cache/objs_per_slab | 1 - test/sys/kernel/slab/scsi_sense_cache/order | 1 - test/sys/kernel/slab/scsi_sense_cache/partial | 1 - test/sys/kernel/slab/scsi_sense_cache/poison | 1 - .../kernel/slab/scsi_sense_cache/reclaim_account | 1 - test/sys/kernel/slab/scsi_sense_cache/red_zone | 1 - .../sys/kernel/slab/scsi_sense_cache/sanity_checks | 1 - test/sys/kernel/slab/scsi_sense_cache/shrink | 0 test/sys/kernel/slab/scsi_sense_cache/slab_size | 1 - test/sys/kernel/slab/scsi_sense_cache/slabs | 1 - test/sys/kernel/slab/scsi_sense_cache/store_user | 1 - .../sys/kernel/slab/scsi_sense_cache/total_objects | 1 - test/sys/kernel/slab/scsi_sense_cache/trace | 1 - test/sys/kernel/slab/scsi_sense_cache/validate | 0 test/sys/kernel/slab/secpath_cache/aliases | 1 - test/sys/kernel/slab/secpath_cache/align | 1 - test/sys/kernel/slab/secpath_cache/alloc_calls | 1 - test/sys/kernel/slab/secpath_cache/cache_dma | 1 - test/sys/kernel/slab/secpath_cache/cpu_slabs | 1 - test/sys/kernel/slab/secpath_cache/ctor | 0 test/sys/kernel/slab/secpath_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/secpath_cache/free_calls | 1 - test/sys/kernel/slab/secpath_cache/hwcache_align | 1 - test/sys/kernel/slab/secpath_cache/object_size | 1 - test/sys/kernel/slab/secpath_cache/objects | 1 - test/sys/kernel/slab/secpath_cache/objects_partial | 1 - test/sys/kernel/slab/secpath_cache/objs_per_slab | 1 - test/sys/kernel/slab/secpath_cache/order | 1 - test/sys/kernel/slab/secpath_cache/partial | 1 - test/sys/kernel/slab/secpath_cache/poison | 1 - test/sys/kernel/slab/secpath_cache/reclaim_account | 1 - test/sys/kernel/slab/secpath_cache/red_zone | 1 - test/sys/kernel/slab/secpath_cache/sanity_checks | 1 - test/sys/kernel/slab/secpath_cache/shrink | 0 test/sys/kernel/slab/secpath_cache/slab_size | 1 - test/sys/kernel/slab/secpath_cache/slabs | 1 - test/sys/kernel/slab/secpath_cache/store_user | 1 - test/sys/kernel/slab/secpath_cache/total_objects | 1 - test/sys/kernel/slab/secpath_cache/trace | 1 - test/sys/kernel/slab/secpath_cache/validate | 0 test/sys/kernel/slab/sgpool-128/aliases | 1 - test/sys/kernel/slab/sgpool-128/align | 1 - test/sys/kernel/slab/sgpool-128/alloc_calls | 1 - test/sys/kernel/slab/sgpool-128/cache_dma | 1 - test/sys/kernel/slab/sgpool-128/cpu_slabs | 1 - test/sys/kernel/slab/sgpool-128/ctor | 0 test/sys/kernel/slab/sgpool-128/destroy_by_rcu | 1 - test/sys/kernel/slab/sgpool-128/free_calls | 1 - test/sys/kernel/slab/sgpool-128/hwcache_align | 1 - test/sys/kernel/slab/sgpool-128/object_size | 1 - test/sys/kernel/slab/sgpool-128/objects | 1 - test/sys/kernel/slab/sgpool-128/objects_partial | 1 - test/sys/kernel/slab/sgpool-128/objs_per_slab | 1 - test/sys/kernel/slab/sgpool-128/order | 1 - test/sys/kernel/slab/sgpool-128/partial | 1 - test/sys/kernel/slab/sgpool-128/poison | 1 - test/sys/kernel/slab/sgpool-128/reclaim_account | 1 - test/sys/kernel/slab/sgpool-128/red_zone | 1 - test/sys/kernel/slab/sgpool-128/sanity_checks | 1 - test/sys/kernel/slab/sgpool-128/shrink | 0 test/sys/kernel/slab/sgpool-128/slab_size | 1 - test/sys/kernel/slab/sgpool-128/slabs | 1 - test/sys/kernel/slab/sgpool-128/store_user | 1 - test/sys/kernel/slab/sgpool-128/total_objects | 1 - test/sys/kernel/slab/sgpool-128/trace | 1 - test/sys/kernel/slab/sgpool-128/validate | 0 test/sys/kernel/slab/sgpool-16/aliases | 1 - test/sys/kernel/slab/sgpool-16/align | 1 - test/sys/kernel/slab/sgpool-16/alloc_calls | 1 - test/sys/kernel/slab/sgpool-16/cache_dma | 1 - test/sys/kernel/slab/sgpool-16/cpu_slabs | 1 - test/sys/kernel/slab/sgpool-16/ctor | 0 test/sys/kernel/slab/sgpool-16/destroy_by_rcu | 1 - test/sys/kernel/slab/sgpool-16/free_calls | 1 - test/sys/kernel/slab/sgpool-16/hwcache_align | 1 - test/sys/kernel/slab/sgpool-16/object_size | 1 - test/sys/kernel/slab/sgpool-16/objects | 1 - test/sys/kernel/slab/sgpool-16/objects_partial | 1 - test/sys/kernel/slab/sgpool-16/objs_per_slab | 1 - test/sys/kernel/slab/sgpool-16/order | 1 - test/sys/kernel/slab/sgpool-16/partial | 1 - test/sys/kernel/slab/sgpool-16/poison | 1 - test/sys/kernel/slab/sgpool-16/reclaim_account | 1 - test/sys/kernel/slab/sgpool-16/red_zone | 1 - test/sys/kernel/slab/sgpool-16/sanity_checks | 1 - test/sys/kernel/slab/sgpool-16/shrink | 0 test/sys/kernel/slab/sgpool-16/slab_size | 1 - test/sys/kernel/slab/sgpool-16/slabs | 1 - test/sys/kernel/slab/sgpool-16/store_user | 1 - test/sys/kernel/slab/sgpool-16/total_objects | 1 - test/sys/kernel/slab/sgpool-16/trace | 1 - test/sys/kernel/slab/sgpool-16/validate | 0 test/sys/kernel/slab/sgpool-32/aliases | 1 - test/sys/kernel/slab/sgpool-32/align | 1 - test/sys/kernel/slab/sgpool-32/alloc_calls | 1 - test/sys/kernel/slab/sgpool-32/cache_dma | 1 - test/sys/kernel/slab/sgpool-32/cpu_slabs | 1 - test/sys/kernel/slab/sgpool-32/ctor | 0 test/sys/kernel/slab/sgpool-32/destroy_by_rcu | 1 - test/sys/kernel/slab/sgpool-32/free_calls | 1 - test/sys/kernel/slab/sgpool-32/hwcache_align | 1 - test/sys/kernel/slab/sgpool-32/object_size | 1 - test/sys/kernel/slab/sgpool-32/objects | 1 - test/sys/kernel/slab/sgpool-32/objects_partial | 1 - test/sys/kernel/slab/sgpool-32/objs_per_slab | 1 - test/sys/kernel/slab/sgpool-32/order | 1 - test/sys/kernel/slab/sgpool-32/partial | 1 - test/sys/kernel/slab/sgpool-32/poison | 1 - test/sys/kernel/slab/sgpool-32/reclaim_account | 1 - test/sys/kernel/slab/sgpool-32/red_zone | 1 - test/sys/kernel/slab/sgpool-32/sanity_checks | 1 - test/sys/kernel/slab/sgpool-32/shrink | 0 test/sys/kernel/slab/sgpool-32/slab_size | 1 - test/sys/kernel/slab/sgpool-32/slabs | 1 - test/sys/kernel/slab/sgpool-32/store_user | 1 - test/sys/kernel/slab/sgpool-32/total_objects | 1 - test/sys/kernel/slab/sgpool-32/trace | 1 - test/sys/kernel/slab/sgpool-32/validate | 0 test/sys/kernel/slab/sgpool-64/aliases | 1 - test/sys/kernel/slab/sgpool-64/align | 1 - test/sys/kernel/slab/sgpool-64/alloc_calls | 1 - test/sys/kernel/slab/sgpool-64/cache_dma | 1 - test/sys/kernel/slab/sgpool-64/cpu_slabs | 1 - test/sys/kernel/slab/sgpool-64/ctor | 0 test/sys/kernel/slab/sgpool-64/destroy_by_rcu | 1 - test/sys/kernel/slab/sgpool-64/free_calls | 1 - test/sys/kernel/slab/sgpool-64/hwcache_align | 1 - test/sys/kernel/slab/sgpool-64/object_size | 1 - test/sys/kernel/slab/sgpool-64/objects | 1 - test/sys/kernel/slab/sgpool-64/objects_partial | 1 - test/sys/kernel/slab/sgpool-64/objs_per_slab | 1 - test/sys/kernel/slab/sgpool-64/order | 1 - test/sys/kernel/slab/sgpool-64/partial | 1 - test/sys/kernel/slab/sgpool-64/poison | 1 - test/sys/kernel/slab/sgpool-64/reclaim_account | 1 - test/sys/kernel/slab/sgpool-64/red_zone | 1 - test/sys/kernel/slab/sgpool-64/sanity_checks | 1 - test/sys/kernel/slab/sgpool-64/shrink | 0 test/sys/kernel/slab/sgpool-64/slab_size | 1 - test/sys/kernel/slab/sgpool-64/slabs | 1 - test/sys/kernel/slab/sgpool-64/store_user | 1 - test/sys/kernel/slab/sgpool-64/total_objects | 1 - test/sys/kernel/slab/sgpool-64/trace | 1 - test/sys/kernel/slab/sgpool-64/validate | 0 test/sys/kernel/slab/sgpool-8/aliases | 1 - test/sys/kernel/slab/sgpool-8/align | 1 - test/sys/kernel/slab/sgpool-8/alloc_calls | 1 - test/sys/kernel/slab/sgpool-8/cache_dma | 1 - test/sys/kernel/slab/sgpool-8/cpu_slabs | 1 - test/sys/kernel/slab/sgpool-8/ctor | 0 test/sys/kernel/slab/sgpool-8/destroy_by_rcu | 1 - test/sys/kernel/slab/sgpool-8/free_calls | 1 - test/sys/kernel/slab/sgpool-8/hwcache_align | 1 - test/sys/kernel/slab/sgpool-8/object_size | 1 - test/sys/kernel/slab/sgpool-8/objects | 1 - test/sys/kernel/slab/sgpool-8/objects_partial | 1 - test/sys/kernel/slab/sgpool-8/objs_per_slab | 1 - test/sys/kernel/slab/sgpool-8/order | 1 - test/sys/kernel/slab/sgpool-8/partial | 1 - test/sys/kernel/slab/sgpool-8/poison | 1 - test/sys/kernel/slab/sgpool-8/reclaim_account | 1 - test/sys/kernel/slab/sgpool-8/red_zone | 1 - test/sys/kernel/slab/sgpool-8/sanity_checks | 1 - test/sys/kernel/slab/sgpool-8/shrink | 0 test/sys/kernel/slab/sgpool-8/slab_size | 1 - test/sys/kernel/slab/sgpool-8/slabs | 1 - test/sys/kernel/slab/sgpool-8/store_user | 1 - test/sys/kernel/slab/sgpool-8/total_objects | 1 - test/sys/kernel/slab/sgpool-8/trace | 1 - test/sys/kernel/slab/sgpool-8/validate | 0 test/sys/kernel/slab/shmem_inode_cache/aliases | 1 - test/sys/kernel/slab/shmem_inode_cache/align | 1 - test/sys/kernel/slab/shmem_inode_cache/alloc_calls | 1 - test/sys/kernel/slab/shmem_inode_cache/cache_dma | 1 - test/sys/kernel/slab/shmem_inode_cache/cpu_slabs | 1 - test/sys/kernel/slab/shmem_inode_cache/ctor | 1 - .../kernel/slab/shmem_inode_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/shmem_inode_cache/free_calls | 2 - .../kernel/slab/shmem_inode_cache/hwcache_align | 1 - test/sys/kernel/slab/shmem_inode_cache/object_size | 1 - test/sys/kernel/slab/shmem_inode_cache/objects | 1 - .../kernel/slab/shmem_inode_cache/objects_partial | 1 - .../kernel/slab/shmem_inode_cache/objs_per_slab | 1 - test/sys/kernel/slab/shmem_inode_cache/order | 1 - test/sys/kernel/slab/shmem_inode_cache/partial | 1 - test/sys/kernel/slab/shmem_inode_cache/poison | 1 - .../kernel/slab/shmem_inode_cache/reclaim_account | 1 - test/sys/kernel/slab/shmem_inode_cache/red_zone | 1 - .../kernel/slab/shmem_inode_cache/sanity_checks | 1 - test/sys/kernel/slab/shmem_inode_cache/shrink | 0 test/sys/kernel/slab/shmem_inode_cache/slab_size | 1 - test/sys/kernel/slab/shmem_inode_cache/slabs | 1 - test/sys/kernel/slab/shmem_inode_cache/store_user | 1 - .../kernel/slab/shmem_inode_cache/total_objects | 1 - test/sys/kernel/slab/shmem_inode_cache/trace | 1 - test/sys/kernel/slab/shmem_inode_cache/validate | 0 test/sys/kernel/slab/sighand_cache/aliases | 1 - test/sys/kernel/slab/sighand_cache/align | 1 - test/sys/kernel/slab/sighand_cache/alloc_calls | 2 - test/sys/kernel/slab/sighand_cache/cache_dma | 1 - test/sys/kernel/slab/sighand_cache/cpu_slabs | 1 - test/sys/kernel/slab/sighand_cache/ctor | 1 - test/sys/kernel/slab/sighand_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/sighand_cache/free_calls | 2 - test/sys/kernel/slab/sighand_cache/hwcache_align | 1 - test/sys/kernel/slab/sighand_cache/object_size | 1 - test/sys/kernel/slab/sighand_cache/objects | 1 - test/sys/kernel/slab/sighand_cache/objects_partial | 1 - test/sys/kernel/slab/sighand_cache/objs_per_slab | 1 - test/sys/kernel/slab/sighand_cache/order | 1 - test/sys/kernel/slab/sighand_cache/partial | 1 - test/sys/kernel/slab/sighand_cache/poison | 1 - test/sys/kernel/slab/sighand_cache/reclaim_account | 1 - test/sys/kernel/slab/sighand_cache/red_zone | 1 - test/sys/kernel/slab/sighand_cache/sanity_checks | 1 - test/sys/kernel/slab/sighand_cache/shrink | 0 test/sys/kernel/slab/sighand_cache/slab_size | 1 - test/sys/kernel/slab/sighand_cache/slabs | 1 - test/sys/kernel/slab/sighand_cache/store_user | 1 - test/sys/kernel/slab/sighand_cache/total_objects | 1 - test/sys/kernel/slab/sighand_cache/trace | 1 - test/sys/kernel/slab/sighand_cache/validate | 0 test/sys/kernel/slab/signal_cache/aliases | 1 - test/sys/kernel/slab/signal_cache/align | 1 - test/sys/kernel/slab/signal_cache/alloc_calls | 1 - test/sys/kernel/slab/signal_cache/cache_dma | 1 - test/sys/kernel/slab/signal_cache/cpu_slabs | 1 - test/sys/kernel/slab/signal_cache/ctor | 0 test/sys/kernel/slab/signal_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/signal_cache/free_calls | 2 - test/sys/kernel/slab/signal_cache/hwcache_align | 1 - test/sys/kernel/slab/signal_cache/object_size | 1 - test/sys/kernel/slab/signal_cache/objects | 1 - test/sys/kernel/slab/signal_cache/objects_partial | 1 - test/sys/kernel/slab/signal_cache/objs_per_slab | 1 - test/sys/kernel/slab/signal_cache/order | 1 - test/sys/kernel/slab/signal_cache/partial | 1 - test/sys/kernel/slab/signal_cache/poison | 1 - test/sys/kernel/slab/signal_cache/reclaim_account | 1 - test/sys/kernel/slab/signal_cache/red_zone | 1 - test/sys/kernel/slab/signal_cache/sanity_checks | 1 - test/sys/kernel/slab/signal_cache/shrink | 0 test/sys/kernel/slab/signal_cache/slab_size | 1 - test/sys/kernel/slab/signal_cache/slabs | 1 - test/sys/kernel/slab/signal_cache/store_user | 1 - test/sys/kernel/slab/signal_cache/total_objects | 1 - test/sys/kernel/slab/signal_cache/trace | 1 - test/sys/kernel/slab/signal_cache/validate | 0 test/sys/kernel/slab/sigqueue/aliases | 1 - test/sys/kernel/slab/sigqueue/align | 1 - test/sys/kernel/slab/sigqueue/alloc_calls | 1 - test/sys/kernel/slab/sigqueue/cache_dma | 1 - test/sys/kernel/slab/sigqueue/cpu_slabs | 1 - test/sys/kernel/slab/sigqueue/ctor | 0 test/sys/kernel/slab/sigqueue/destroy_by_rcu | 1 - test/sys/kernel/slab/sigqueue/free_calls | 1 - test/sys/kernel/slab/sigqueue/hwcache_align | 1 - test/sys/kernel/slab/sigqueue/object_size | 1 - test/sys/kernel/slab/sigqueue/objects | 1 - test/sys/kernel/slab/sigqueue/objects_partial | 1 - test/sys/kernel/slab/sigqueue/objs_per_slab | 1 - test/sys/kernel/slab/sigqueue/order | 1 - test/sys/kernel/slab/sigqueue/partial | 1 - test/sys/kernel/slab/sigqueue/poison | 1 - test/sys/kernel/slab/sigqueue/reclaim_account | 1 - test/sys/kernel/slab/sigqueue/red_zone | 1 - test/sys/kernel/slab/sigqueue/sanity_checks | 1 - test/sys/kernel/slab/sigqueue/shrink | 0 test/sys/kernel/slab/sigqueue/slab_size | 1 - test/sys/kernel/slab/sigqueue/slabs | 1 - test/sys/kernel/slab/sigqueue/store_user | 1 - test/sys/kernel/slab/sigqueue/total_objects | 1 - test/sys/kernel/slab/sigqueue/trace | 1 - test/sys/kernel/slab/sigqueue/validate | 0 test/sys/kernel/slab/skbuff_fclone_cache/aliases | 1 - test/sys/kernel/slab/skbuff_fclone_cache/align | 1 - .../kernel/slab/skbuff_fclone_cache/alloc_calls | 1 - test/sys/kernel/slab/skbuff_fclone_cache/cache_dma | 1 - test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs | 1 - test/sys/kernel/slab/skbuff_fclone_cache/ctor | 0 .../kernel/slab/skbuff_fclone_cache/destroy_by_rcu | 1 - .../sys/kernel/slab/skbuff_fclone_cache/free_calls | 1 - .../kernel/slab/skbuff_fclone_cache/hwcache_align | 1 - .../kernel/slab/skbuff_fclone_cache/object_size | 1 - test/sys/kernel/slab/skbuff_fclone_cache/objects | 1 - .../slab/skbuff_fclone_cache/objects_partial | 1 - .../kernel/slab/skbuff_fclone_cache/objs_per_slab | 1 - test/sys/kernel/slab/skbuff_fclone_cache/order | 1 - test/sys/kernel/slab/skbuff_fclone_cache/partial | 1 - test/sys/kernel/slab/skbuff_fclone_cache/poison | 1 - .../slab/skbuff_fclone_cache/reclaim_account | 1 - test/sys/kernel/slab/skbuff_fclone_cache/red_zone | 1 - .../kernel/slab/skbuff_fclone_cache/sanity_checks | 1 - test/sys/kernel/slab/skbuff_fclone_cache/shrink | 0 test/sys/kernel/slab/skbuff_fclone_cache/slab_size | 1 - test/sys/kernel/slab/skbuff_fclone_cache/slabs | 1 - .../sys/kernel/slab/skbuff_fclone_cache/store_user | 1 - .../kernel/slab/skbuff_fclone_cache/total_objects | 1 - test/sys/kernel/slab/skbuff_fclone_cache/trace | 1 - test/sys/kernel/slab/skbuff_fclone_cache/validate | 0 test/sys/kernel/slab/skbuff_head_cache/aliases | 1 - test/sys/kernel/slab/skbuff_head_cache/align | 1 - test/sys/kernel/slab/skbuff_head_cache/alloc_calls | 1 - test/sys/kernel/slab/skbuff_head_cache/cache_dma | 1 - test/sys/kernel/slab/skbuff_head_cache/cpu_slabs | 1 - test/sys/kernel/slab/skbuff_head_cache/ctor | 0 .../kernel/slab/skbuff_head_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/skbuff_head_cache/free_calls | 2 - .../kernel/slab/skbuff_head_cache/hwcache_align | 1 - test/sys/kernel/slab/skbuff_head_cache/object_size | 1 - test/sys/kernel/slab/skbuff_head_cache/objects | 1 - .../kernel/slab/skbuff_head_cache/objects_partial | 1 - .../kernel/slab/skbuff_head_cache/objs_per_slab | 1 - test/sys/kernel/slab/skbuff_head_cache/order | 1 - test/sys/kernel/slab/skbuff_head_cache/partial | 1 - test/sys/kernel/slab/skbuff_head_cache/poison | 1 - .../kernel/slab/skbuff_head_cache/reclaim_account | 1 - test/sys/kernel/slab/skbuff_head_cache/red_zone | 1 - .../kernel/slab/skbuff_head_cache/sanity_checks | 1 - test/sys/kernel/slab/skbuff_head_cache/shrink | 0 test/sys/kernel/slab/skbuff_head_cache/slab_size | 1 - test/sys/kernel/slab/skbuff_head_cache/slabs | 1 - test/sys/kernel/slab/skbuff_head_cache/store_user | 1 - .../kernel/slab/skbuff_head_cache/total_objects | 1 - test/sys/kernel/slab/skbuff_head_cache/trace | 1 - test/sys/kernel/slab/skbuff_head_cache/validate | 0 test/sys/kernel/slab/sock_inode_cache/aliases | 1 - test/sys/kernel/slab/sock_inode_cache/align | 1 - test/sys/kernel/slab/sock_inode_cache/alloc_calls | 1 - test/sys/kernel/slab/sock_inode_cache/cache_dma | 1 - test/sys/kernel/slab/sock_inode_cache/cpu_slabs | 1 - test/sys/kernel/slab/sock_inode_cache/ctor | 1 - .../kernel/slab/sock_inode_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/sock_inode_cache/free_calls | 2 - .../sys/kernel/slab/sock_inode_cache/hwcache_align | 1 - test/sys/kernel/slab/sock_inode_cache/object_size | 1 - test/sys/kernel/slab/sock_inode_cache/objects | 1 - .../kernel/slab/sock_inode_cache/objects_partial | 1 - .../sys/kernel/slab/sock_inode_cache/objs_per_slab | 1 - test/sys/kernel/slab/sock_inode_cache/order | 1 - test/sys/kernel/slab/sock_inode_cache/partial | 1 - test/sys/kernel/slab/sock_inode_cache/poison | 1 - .../kernel/slab/sock_inode_cache/reclaim_account | 1 - test/sys/kernel/slab/sock_inode_cache/red_zone | 1 - .../sys/kernel/slab/sock_inode_cache/sanity_checks | 1 - test/sys/kernel/slab/sock_inode_cache/shrink | 0 test/sys/kernel/slab/sock_inode_cache/slab_size | 1 - test/sys/kernel/slab/sock_inode_cache/slabs | 1 - test/sys/kernel/slab/sock_inode_cache/store_user | 1 - .../sys/kernel/slab/sock_inode_cache/total_objects | 1 - test/sys/kernel/slab/sock_inode_cache/trace | 1 - test/sys/kernel/slab/sock_inode_cache/validate | 0 test/sys/kernel/slab/sysfs_dir_cache/aliases | 1 - test/sys/kernel/slab/sysfs_dir_cache/align | 1 - test/sys/kernel/slab/sysfs_dir_cache/alloc_calls | 1 - test/sys/kernel/slab/sysfs_dir_cache/cache_dma | 1 - test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs | 1 - test/sys/kernel/slab/sysfs_dir_cache/ctor | 0 .../sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/sysfs_dir_cache/free_calls | 2 - test/sys/kernel/slab/sysfs_dir_cache/hwcache_align | 1 - test/sys/kernel/slab/sysfs_dir_cache/object_size | 1 - test/sys/kernel/slab/sysfs_dir_cache/objects | 1 - .../kernel/slab/sysfs_dir_cache/objects_partial | 1 - test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab | 1 - test/sys/kernel/slab/sysfs_dir_cache/order | 1 - test/sys/kernel/slab/sysfs_dir_cache/partial | 1 - test/sys/kernel/slab/sysfs_dir_cache/poison | 1 - .../kernel/slab/sysfs_dir_cache/reclaim_account | 1 - test/sys/kernel/slab/sysfs_dir_cache/red_zone | 1 - test/sys/kernel/slab/sysfs_dir_cache/sanity_checks | 1 - test/sys/kernel/slab/sysfs_dir_cache/shrink | 0 test/sys/kernel/slab/sysfs_dir_cache/slab_size | 1 - test/sys/kernel/slab/sysfs_dir_cache/slabs | 1 - test/sys/kernel/slab/sysfs_dir_cache/store_user | 1 - test/sys/kernel/slab/sysfs_dir_cache/total_objects | 1 - test/sys/kernel/slab/sysfs_dir_cache/trace | 1 - test/sys/kernel/slab/sysfs_dir_cache/validate | 0 test/sys/kernel/slab/task_struct/aliases | 1 - test/sys/kernel/slab/task_struct/align | 1 - test/sys/kernel/slab/task_struct/alloc_calls | 1 - test/sys/kernel/slab/task_struct/cache_dma | 1 - test/sys/kernel/slab/task_struct/cpu_slabs | 1 - test/sys/kernel/slab/task_struct/ctor | 0 test/sys/kernel/slab/task_struct/destroy_by_rcu | 1 - test/sys/kernel/slab/task_struct/free_calls | 2 - test/sys/kernel/slab/task_struct/hwcache_align | 1 - test/sys/kernel/slab/task_struct/object_size | 1 - test/sys/kernel/slab/task_struct/objects | 1 - test/sys/kernel/slab/task_struct/objects_partial | 1 - test/sys/kernel/slab/task_struct/objs_per_slab | 1 - test/sys/kernel/slab/task_struct/order | 1 - test/sys/kernel/slab/task_struct/partial | 1 - test/sys/kernel/slab/task_struct/poison | 1 - test/sys/kernel/slab/task_struct/reclaim_account | 1 - test/sys/kernel/slab/task_struct/red_zone | 1 - test/sys/kernel/slab/task_struct/sanity_checks | 1 - test/sys/kernel/slab/task_struct/shrink | 0 test/sys/kernel/slab/task_struct/slab_size | 1 - test/sys/kernel/slab/task_struct/slabs | 1 - test/sys/kernel/slab/task_struct/store_user | 1 - test/sys/kernel/slab/task_struct/total_objects | 1 - test/sys/kernel/slab/task_struct/trace | 1 - test/sys/kernel/slab/task_struct/validate | 0 test/sys/kernel/slab/task_xstate/aliases | 1 - test/sys/kernel/slab/task_xstate/align | 1 - test/sys/kernel/slab/task_xstate/alloc_calls | 2 - test/sys/kernel/slab/task_xstate/cache_dma | 1 - test/sys/kernel/slab/task_xstate/cpu_slabs | 1 - test/sys/kernel/slab/task_xstate/ctor | 0 test/sys/kernel/slab/task_xstate/destroy_by_rcu | 1 - test/sys/kernel/slab/task_xstate/free_calls | 2 - test/sys/kernel/slab/task_xstate/hwcache_align | 1 - test/sys/kernel/slab/task_xstate/object_size | 1 - test/sys/kernel/slab/task_xstate/objects | 1 - test/sys/kernel/slab/task_xstate/objects_partial | 1 - test/sys/kernel/slab/task_xstate/objs_per_slab | 1 - test/sys/kernel/slab/task_xstate/order | 1 - test/sys/kernel/slab/task_xstate/partial | 1 - test/sys/kernel/slab/task_xstate/poison | 1 - test/sys/kernel/slab/task_xstate/reclaim_account | 1 - test/sys/kernel/slab/task_xstate/red_zone | 1 - test/sys/kernel/slab/task_xstate/sanity_checks | 1 - test/sys/kernel/slab/task_xstate/shrink | 0 test/sys/kernel/slab/task_xstate/slab_size | 1 - test/sys/kernel/slab/task_xstate/slabs | 1 - test/sys/kernel/slab/task_xstate/store_user | 1 - test/sys/kernel/slab/task_xstate/total_objects | 1 - test/sys/kernel/slab/task_xstate/trace | 1 - test/sys/kernel/slab/task_xstate/validate | 0 test/sys/kernel/slab/tcp_bind_bucket/aliases | 1 - test/sys/kernel/slab/tcp_bind_bucket/align | 1 - test/sys/kernel/slab/tcp_bind_bucket/alloc_calls | 1 - test/sys/kernel/slab/tcp_bind_bucket/cache_dma | 1 - test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs | 1 - test/sys/kernel/slab/tcp_bind_bucket/ctor | 0 .../sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu | 1 - test/sys/kernel/slab/tcp_bind_bucket/free_calls | 2 - test/sys/kernel/slab/tcp_bind_bucket/hwcache_align | 1 - test/sys/kernel/slab/tcp_bind_bucket/object_size | 1 - test/sys/kernel/slab/tcp_bind_bucket/objects | 1 - .../kernel/slab/tcp_bind_bucket/objects_partial | 1 - test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab | 1 - test/sys/kernel/slab/tcp_bind_bucket/order | 1 - test/sys/kernel/slab/tcp_bind_bucket/partial | 1 - test/sys/kernel/slab/tcp_bind_bucket/poison | 1 - .../kernel/slab/tcp_bind_bucket/reclaim_account | 1 - test/sys/kernel/slab/tcp_bind_bucket/red_zone | 1 - test/sys/kernel/slab/tcp_bind_bucket/sanity_checks | 1 - test/sys/kernel/slab/tcp_bind_bucket/shrink | 0 test/sys/kernel/slab/tcp_bind_bucket/slab_size | 1 - test/sys/kernel/slab/tcp_bind_bucket/slabs | 1 - test/sys/kernel/slab/tcp_bind_bucket/store_user | 1 - test/sys/kernel/slab/tcp_bind_bucket/total_objects | 1 - test/sys/kernel/slab/tcp_bind_bucket/trace | 1 - test/sys/kernel/slab/tcp_bind_bucket/validate | 0 test/sys/kernel/slab/tw_sock_TCP/aliases | 1 - test/sys/kernel/slab/tw_sock_TCP/align | 1 - test/sys/kernel/slab/tw_sock_TCP/alloc_calls | 1 - test/sys/kernel/slab/tw_sock_TCP/cache_dma | 1 - test/sys/kernel/slab/tw_sock_TCP/cpu_slabs | 1 - test/sys/kernel/slab/tw_sock_TCP/ctor | 0 test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu | 1 - test/sys/kernel/slab/tw_sock_TCP/free_calls | 1 - test/sys/kernel/slab/tw_sock_TCP/hwcache_align | 1 - test/sys/kernel/slab/tw_sock_TCP/object_size | 1 - test/sys/kernel/slab/tw_sock_TCP/objects | 1 - test/sys/kernel/slab/tw_sock_TCP/objects_partial | 1 - test/sys/kernel/slab/tw_sock_TCP/objs_per_slab | 1 - test/sys/kernel/slab/tw_sock_TCP/order | 1 - test/sys/kernel/slab/tw_sock_TCP/partial | 1 - test/sys/kernel/slab/tw_sock_TCP/poison | 1 - test/sys/kernel/slab/tw_sock_TCP/reclaim_account | 1 - test/sys/kernel/slab/tw_sock_TCP/red_zone | 1 - test/sys/kernel/slab/tw_sock_TCP/sanity_checks | 1 - test/sys/kernel/slab/tw_sock_TCP/shrink | 0 test/sys/kernel/slab/tw_sock_TCP/slab_size | 1 - test/sys/kernel/slab/tw_sock_TCP/slabs | 1 - test/sys/kernel/slab/tw_sock_TCP/store_user | 1 - test/sys/kernel/slab/tw_sock_TCP/total_objects | 1 - test/sys/kernel/slab/tw_sock_TCP/trace | 1 - test/sys/kernel/slab/tw_sock_TCP/validate | 0 test/sys/kernel/slab/tw_sock_TCPv6/aliases | 1 - test/sys/kernel/slab/tw_sock_TCPv6/align | 1 - test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls | 1 - test/sys/kernel/slab/tw_sock_TCPv6/cache_dma | 1 - test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs | 1 - test/sys/kernel/slab/tw_sock_TCPv6/ctor | 0 test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu | 1 - test/sys/kernel/slab/tw_sock_TCPv6/free_calls | 1 - test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align | 1 - test/sys/kernel/slab/tw_sock_TCPv6/object_size | 1 - test/sys/kernel/slab/tw_sock_TCPv6/objects | 1 - test/sys/kernel/slab/tw_sock_TCPv6/objects_partial | 1 - test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab | 1 - test/sys/kernel/slab/tw_sock_TCPv6/order | 1 - test/sys/kernel/slab/tw_sock_TCPv6/partial | 1 - test/sys/kernel/slab/tw_sock_TCPv6/poison | 1 - test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account | 1 - test/sys/kernel/slab/tw_sock_TCPv6/red_zone | 1 - test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks | 1 - test/sys/kernel/slab/tw_sock_TCPv6/shrink | 0 test/sys/kernel/slab/tw_sock_TCPv6/slab_size | 1 - test/sys/kernel/slab/tw_sock_TCPv6/slabs | 1 - test/sys/kernel/slab/tw_sock_TCPv6/store_user | 1 - test/sys/kernel/slab/tw_sock_TCPv6/total_objects | 1 - test/sys/kernel/slab/tw_sock_TCPv6/trace | 1 - test/sys/kernel/slab/tw_sock_TCPv6/validate | 0 test/sys/kernel/slab/uhci_urb_priv/aliases | 1 - test/sys/kernel/slab/uhci_urb_priv/align | 1 - test/sys/kernel/slab/uhci_urb_priv/alloc_calls | 1 - test/sys/kernel/slab/uhci_urb_priv/cache_dma | 1 - test/sys/kernel/slab/uhci_urb_priv/cpu_slabs | 1 - test/sys/kernel/slab/uhci_urb_priv/ctor | 0 test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu | 1 - test/sys/kernel/slab/uhci_urb_priv/free_calls | 1 - test/sys/kernel/slab/uhci_urb_priv/hwcache_align | 1 - test/sys/kernel/slab/uhci_urb_priv/object_size | 1 - test/sys/kernel/slab/uhci_urb_priv/objects | 1 - test/sys/kernel/slab/uhci_urb_priv/objects_partial | 1 - test/sys/kernel/slab/uhci_urb_priv/objs_per_slab | 1 - test/sys/kernel/slab/uhci_urb_priv/order | 1 - test/sys/kernel/slab/uhci_urb_priv/partial | 1 - test/sys/kernel/slab/uhci_urb_priv/poison | 1 - test/sys/kernel/slab/uhci_urb_priv/reclaim_account | 1 - test/sys/kernel/slab/uhci_urb_priv/red_zone | 1 - test/sys/kernel/slab/uhci_urb_priv/sanity_checks | 1 - test/sys/kernel/slab/uhci_urb_priv/shrink | 0 test/sys/kernel/slab/uhci_urb_priv/slab_size | 1 - test/sys/kernel/slab/uhci_urb_priv/slabs | 1 - test/sys/kernel/slab/uhci_urb_priv/store_user | 1 - test/sys/kernel/slab/uhci_urb_priv/total_objects | 1 - test/sys/kernel/slab/uhci_urb_priv/trace | 1 - test/sys/kernel/slab/uhci_urb_priv/validate | 0 test/sys/kernel/slab/uid_cache/aliases | 1 - test/sys/kernel/slab/uid_cache/align | 1 - test/sys/kernel/slab/uid_cache/alloc_calls | 1 - test/sys/kernel/slab/uid_cache/cache_dma | 1 - test/sys/kernel/slab/uid_cache/cpu_slabs | 1 - test/sys/kernel/slab/uid_cache/ctor | 0 test/sys/kernel/slab/uid_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/uid_cache/free_calls | 2 - test/sys/kernel/slab/uid_cache/hwcache_align | 1 - test/sys/kernel/slab/uid_cache/object_size | 1 - test/sys/kernel/slab/uid_cache/objects | 1 - test/sys/kernel/slab/uid_cache/objects_partial | 1 - test/sys/kernel/slab/uid_cache/objs_per_slab | 1 - test/sys/kernel/slab/uid_cache/order | 1 - test/sys/kernel/slab/uid_cache/partial | 1 - test/sys/kernel/slab/uid_cache/poison | 1 - test/sys/kernel/slab/uid_cache/reclaim_account | 1 - test/sys/kernel/slab/uid_cache/red_zone | 1 - test/sys/kernel/slab/uid_cache/sanity_checks | 1 - test/sys/kernel/slab/uid_cache/shrink | 0 test/sys/kernel/slab/uid_cache/slab_size | 1 - test/sys/kernel/slab/uid_cache/slabs | 1 - test/sys/kernel/slab/uid_cache/store_user | 1 - test/sys/kernel/slab/uid_cache/total_objects | 1 - test/sys/kernel/slab/uid_cache/trace | 1 - test/sys/kernel/slab/uid_cache/validate | 0 test/sys/kernel/slab/vm_area_struct/aliases | 1 - test/sys/kernel/slab/vm_area_struct/align | 1 - test/sys/kernel/slab/vm_area_struct/alloc_calls | 7 - test/sys/kernel/slab/vm_area_struct/cache_dma | 1 - test/sys/kernel/slab/vm_area_struct/cpu_slabs | 1 - test/sys/kernel/slab/vm_area_struct/ctor | 0 test/sys/kernel/slab/vm_area_struct/destroy_by_rcu | 1 - test/sys/kernel/slab/vm_area_struct/free_calls | 3 - test/sys/kernel/slab/vm_area_struct/hwcache_align | 1 - test/sys/kernel/slab/vm_area_struct/object_size | 1 - test/sys/kernel/slab/vm_area_struct/objects | 1 - .../sys/kernel/slab/vm_area_struct/objects_partial | 1 - test/sys/kernel/slab/vm_area_struct/objs_per_slab | 1 - test/sys/kernel/slab/vm_area_struct/order | 1 - test/sys/kernel/slab/vm_area_struct/partial | 1 - test/sys/kernel/slab/vm_area_struct/poison | 1 - .../sys/kernel/slab/vm_area_struct/reclaim_account | 1 - test/sys/kernel/slab/vm_area_struct/red_zone | 1 - test/sys/kernel/slab/vm_area_struct/sanity_checks | 1 - test/sys/kernel/slab/vm_area_struct/shrink | 0 test/sys/kernel/slab/vm_area_struct/slab_size | 1 - test/sys/kernel/slab/vm_area_struct/slabs | 1 - test/sys/kernel/slab/vm_area_struct/store_user | 1 - test/sys/kernel/slab/vm_area_struct/total_objects | 1 - test/sys/kernel/slab/vm_area_struct/trace | 1 - test/sys/kernel/slab/vm_area_struct/validate | 0 test/sys/kernel/slab/xfrm_dst_cache/aliases | 1 - test/sys/kernel/slab/xfrm_dst_cache/align | 1 - test/sys/kernel/slab/xfrm_dst_cache/alloc_calls | 1 - test/sys/kernel/slab/xfrm_dst_cache/cache_dma | 1 - test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs | 1 - test/sys/kernel/slab/xfrm_dst_cache/ctor | 0 test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu | 1 - test/sys/kernel/slab/xfrm_dst_cache/free_calls | 1 - test/sys/kernel/slab/xfrm_dst_cache/hwcache_align | 1 - test/sys/kernel/slab/xfrm_dst_cache/object_size | 1 - test/sys/kernel/slab/xfrm_dst_cache/objects | 1 - .../sys/kernel/slab/xfrm_dst_cache/objects_partial | 1 - test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab | 1 - test/sys/kernel/slab/xfrm_dst_cache/order | 1 - test/sys/kernel/slab/xfrm_dst_cache/partial | 1 - test/sys/kernel/slab/xfrm_dst_cache/poison | 1 - .../sys/kernel/slab/xfrm_dst_cache/reclaim_account | 1 - test/sys/kernel/slab/xfrm_dst_cache/red_zone | 1 - test/sys/kernel/slab/xfrm_dst_cache/sanity_checks | 1 - test/sys/kernel/slab/xfrm_dst_cache/shrink | 0 test/sys/kernel/slab/xfrm_dst_cache/slab_size | 1 - test/sys/kernel/slab/xfrm_dst_cache/slabs | 1 - test/sys/kernel/slab/xfrm_dst_cache/store_user | 1 - test/sys/kernel/slab/xfrm_dst_cache/total_objects | 1 - test/sys/kernel/slab/xfrm_dst_cache/trace | 1 - test/sys/kernel/slab/xfrm_dst_cache/validate | 0 test/sys/kernel/uevent_helper | 1 - test/sys/kernel/uevent_seqnum | 1 - test/sys/kernel/uids/0/cpu_share | 1 - test/sys/kernel/uids/100/cpu_share | 1 - test/sys/kernel/uids/103/cpu_share | 1 - test/sys/kernel/uids/105/cpu_share | 1 - test/sys/kernel/uids/2702/cpu_share | 1 - test/sys/kernel/uids/51/cpu_share | 1 - test/sys/kernel/vmcoreinfo | 1 - test/sys/module/8250/parameters/nr_uarts | 1 - test/sys/module/8250/parameters/share_irqs | 1 - test/sys/module/ac/initstate | 1 - test/sys/module/ac/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/ac/refcnt | 1 - test/sys/module/ac/sections/.bss | 1 - test/sys/module/ac/sections/.data | 1 - test/sys/module/ac/sections/.exit.text | 1 - .../module/ac/sections/.gnu.linkonce.this_module | 1 - test/sys/module/ac/sections/.init.text | 1 - test/sys/module/ac/sections/.note.gnu.build-id | 1 - test/sys/module/ac/sections/.rodata | 1 - test/sys/module/ac/sections/.rodata.str1.1 | 1 - test/sys/module/ac/sections/.strtab | 1 - test/sys/module/ac/sections/.symtab | 1 - test/sys/module/ac/sections/.text | 1 - test/sys/module/ac/srcversion | 1 - test/sys/module/acpi/parameters/acpica_version | 1 - test/sys/module/acpi_cpufreq/initstate | 1 - .../module/acpi_cpufreq/notes/.note.gnu.build-id | Bin 36 -> 0 bytes .../acpi_cpufreq/parameters/acpi_pstate_strict | 1 - test/sys/module/acpi_cpufreq/refcnt | 1 - test/sys/module/acpi_cpufreq/sections/.bss | 1 - test/sys/module/acpi_cpufreq/sections/.data | 1 - test/sys/module/acpi_cpufreq/sections/.exit.text | 1 - .../sections/.gnu.linkonce.this_module | 1 - test/sys/module/acpi_cpufreq/sections/.init.text | 1 - .../acpi_cpufreq/sections/.note.gnu.build-id | 1 - test/sys/module/acpi_cpufreq/sections/.rodata | 1 - .../module/acpi_cpufreq/sections/.rodata.str1.1 | 1 - test/sys/module/acpi_cpufreq/sections/.smp_locks | 1 - test/sys/module/acpi_cpufreq/sections/.strtab | 1 - test/sys/module/acpi_cpufreq/sections/.symtab | 1 - test/sys/module/acpi_cpufreq/sections/.text | 1 - test/sys/module/acpi_cpufreq/sections/__param | 1 - test/sys/module/acpi_cpufreq/srcversion | 1 - test/sys/module/aes_generic/holders/aes_x86_64 | 1 - test/sys/module/aes_generic/initstate | 1 - .../module/aes_generic/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/aes_generic/refcnt | 1 - test/sys/module/aes_generic/sections/.bss | 1 - test/sys/module/aes_generic/sections/.data | 1 - test/sys/module/aes_generic/sections/.exit.text | 1 - .../aes_generic/sections/.gnu.linkonce.this_module | 1 - test/sys/module/aes_generic/sections/.init.data | 1 - test/sys/module/aes_generic/sections/.init.text | 1 - .../module/aes_generic/sections/.note.gnu.build-id | 1 - test/sys/module/aes_generic/sections/.strtab | 1 - test/sys/module/aes_generic/sections/.symtab | 1 - test/sys/module/aes_generic/sections/.text | 1 - test/sys/module/aes_generic/sections/__kcrctab_gpl | 1 - test/sys/module/aes_generic/sections/__ksymtab_gpl | 1 - .../module/aes_generic/sections/__ksymtab_strings | 1 - test/sys/module/aes_generic/srcversion | 1 - test/sys/module/aes_x86_64/initstate | 1 - .../sys/module/aes_x86_64/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/aes_x86_64/refcnt | 1 - test/sys/module/aes_x86_64/sections/.bss | 1 - test/sys/module/aes_x86_64/sections/.data | 1 - test/sys/module/aes_x86_64/sections/.exit.text | 1 - .../aes_x86_64/sections/.gnu.linkonce.this_module | 1 - test/sys/module/aes_x86_64/sections/.init.text | 1 - .../module/aes_x86_64/sections/.note.gnu.build-id | 1 - test/sys/module/aes_x86_64/sections/.strtab | 1 - test/sys/module/aes_x86_64/sections/.symtab | 1 - test/sys/module/aes_x86_64/sections/.text | 1 - test/sys/module/aes_x86_64/srcversion | 1 - test/sys/module/ahci/drivers/pci:ahci | 1 - test/sys/module/ahci/parameters/ahci_em_messages | 1 - test/sys/module/ahci/parameters/marvell_enable | 1 - test/sys/module/ahci/parameters/skip_host_reset | 1 - test/sys/module/arc4/initstate | 1 - test/sys/module/arc4/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/arc4/refcnt | 1 - test/sys/module/arc4/sections/.bss | 1 - test/sys/module/arc4/sections/.data | 1 - test/sys/module/arc4/sections/.exit.text | 1 - .../module/arc4/sections/.gnu.linkonce.this_module | 1 - test/sys/module/arc4/sections/.init.text | 1 - test/sys/module/arc4/sections/.note.gnu.build-id | 1 - test/sys/module/arc4/sections/.strtab | 1 - test/sys/module/arc4/sections/.symtab | 1 - test/sys/module/arc4/sections/.text | 1 - test/sys/module/arc4/srcversion | 1 - test/sys/module/atkbd/drivers/serio:atkbd | 1 - test/sys/module/backlight/holders/thinkpad_acpi | 1 - test/sys/module/backlight/initstate | 1 - test/sys/module/backlight/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/backlight/refcnt | 1 - test/sys/module/backlight/sections/.bss | 1 - test/sys/module/backlight/sections/.data | 1 - test/sys/module/backlight/sections/.exit.text | 1 - .../backlight/sections/.gnu.linkonce.this_module | 1 - test/sys/module/backlight/sections/.init.text | 1 - .../module/backlight/sections/.note.gnu.build-id | 1 - test/sys/module/backlight/sections/.rodata.str1.1 | 1 - test/sys/module/backlight/sections/.strtab | 1 - test/sys/module/backlight/sections/.symtab | 1 - test/sys/module/backlight/sections/.text | 1 - test/sys/module/backlight/sections/__kcrctab | 1 - test/sys/module/backlight/sections/__ksymtab | 1 - .../module/backlight/sections/__ksymtab_strings | 1 - test/sys/module/backlight/srcversion | 1 - test/sys/module/battery/initstate | 1 - test/sys/module/battery/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/battery/parameters/cache_time | 1 - test/sys/module/battery/refcnt | 1 - test/sys/module/battery/sections/.bss | 1 - test/sys/module/battery/sections/.data | 1 - test/sys/module/battery/sections/.exit.text | 1 - .../battery/sections/.gnu.linkonce.this_module | 1 - test/sys/module/battery/sections/.init.text | 1 - .../sys/module/battery/sections/.note.gnu.build-id | 1 - test/sys/module/battery/sections/.rodata | 1 - test/sys/module/battery/sections/.rodata.str1.1 | 1 - test/sys/module/battery/sections/.strtab | 1 - test/sys/module/battery/sections/.symtab | 1 - test/sys/module/battery/sections/.text | 1 - test/sys/module/battery/sections/__param | 1 - test/sys/module/battery/srcversion | 1 - test/sys/module/button/initstate | 1 - test/sys/module/button/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/button/refcnt | 1 - test/sys/module/button/sections/.bss | 1 - test/sys/module/button/sections/.data | 1 - test/sys/module/button/sections/.exit.text | 1 - .../button/sections/.gnu.linkonce.this_module | 1 - test/sys/module/button/sections/.init.text | 1 - test/sys/module/button/sections/.note.gnu.build-id | 1 - test/sys/module/button/sections/.rodata | 1 - test/sys/module/button/sections/.rodata.str1.1 | 1 - test/sys/module/button/sections/.smp_locks | 1 - test/sys/module/button/sections/.strtab | 1 - test/sys/module/button/sections/.symtab | 1 - test/sys/module/button/sections/.text | 1 - test/sys/module/button/srcversion | 1 - test/sys/module/cdc_acm/drivers/usb:cdc_acm | 1 - test/sys/module/cdc_acm/initstate | 1 - test/sys/module/cdc_acm/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/cdc_acm/refcnt | 1 - test/sys/module/cdc_acm/sections/.bss | 1 - test/sys/module/cdc_acm/sections/.data | 1 - test/sys/module/cdc_acm/sections/.exit.text | 1 - .../cdc_acm/sections/.gnu.linkonce.this_module | 1 - test/sys/module/cdc_acm/sections/.init.text | 1 - .../sys/module/cdc_acm/sections/.note.gnu.build-id | 1 - test/sys/module/cdc_acm/sections/.rodata | 1 - test/sys/module/cdc_acm/sections/.rodata.str1.1 | 1 - test/sys/module/cdc_acm/sections/.smp_locks | 1 - test/sys/module/cdc_acm/sections/.strtab | 1 - test/sys/module/cdc_acm/sections/.symtab | 1 - test/sys/module/cdc_acm/sections/.text | 1 - test/sys/module/cdc_acm/srcversion | 1 - test/sys/module/cdrom/holders/sr_mod | 1 - test/sys/module/cdrom/initstate | 1 - test/sys/module/cdrom/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/cdrom/refcnt | 1 - test/sys/module/cdrom/sections/.bss | 1 - test/sys/module/cdrom/sections/.data | 1 - test/sys/module/cdrom/sections/.exit.text | 1 - .../cdrom/sections/.gnu.linkonce.this_module | 1 - test/sys/module/cdrom/sections/.init.text | 1 - test/sys/module/cdrom/sections/.note.gnu.build-id | 1 - test/sys/module/cdrom/sections/.rodata | 1 - test/sys/module/cdrom/sections/.rodata.str1.1 | 1 - test/sys/module/cdrom/sections/.strtab | 1 - test/sys/module/cdrom/sections/.symtab | 1 - test/sys/module/cdrom/sections/.text | 1 - test/sys/module/cdrom/sections/__kcrctab | 1 - test/sys/module/cdrom/sections/__ksymtab | 1 - test/sys/module/cdrom/sections/__ksymtab_strings | 1 - test/sys/module/cdrom/sections/__param | 1 - test/sys/module/cdrom/srcversion | 1 - test/sys/module/cfg80211/holders/iwl3945 | 1 - test/sys/module/cfg80211/holders/mac80211 | 1 - test/sys/module/cfg80211/initstate | 1 - test/sys/module/cfg80211/notes/.note.gnu.build-id | Bin 36 -> 0 bytes .../module/cfg80211/parameters/ieee80211_regdom | 1 - test/sys/module/cfg80211/refcnt | 1 - test/sys/module/cfg80211/sections/.bss | 1 - test/sys/module/cfg80211/sections/.data | 1 - .../sys/module/cfg80211/sections/.data.read_mostly | 1 - .../cfg80211/sections/.gnu.linkonce.this_module | 1 - .../module/cfg80211/sections/.note.gnu.build-id | 1 - test/sys/module/cfg80211/sections/.rodata | 1 - test/sys/module/cfg80211/sections/.rodata.str1.1 | 1 - test/sys/module/cfg80211/sections/.smp_locks | 1 - test/sys/module/cfg80211/sections/.strtab | 1 - test/sys/module/cfg80211/sections/.symtab | 1 - test/sys/module/cfg80211/sections/.text | 1 - test/sys/module/cfg80211/sections/__bug_table | 1 - test/sys/module/cfg80211/sections/__kcrctab | 1 - test/sys/module/cfg80211/sections/__ksymtab | 1 - .../sys/module/cfg80211/sections/__ksymtab_strings | 1 - test/sys/module/cfg80211/sections/__param | 1 - test/sys/module/cfg80211/srcversion | 1 - test/sys/module/crypto_blkcipher/holders/ecb | 1 - test/sys/module/crypto_blkcipher/initstate | 1 - .../crypto_blkcipher/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/crypto_blkcipher/refcnt | 1 - test/sys/module/crypto_blkcipher/sections/.bss | 1 - test/sys/module/crypto_blkcipher/sections/.data | 1 - .../module/crypto_blkcipher/sections/.exit.text | 1 - .../sections/.gnu.linkonce.this_module | 1 - .../module/crypto_blkcipher/sections/.init.text | 1 - .../crypto_blkcipher/sections/.note.gnu.build-id | 1 - test/sys/module/crypto_blkcipher/sections/.rodata | 1 - .../crypto_blkcipher/sections/.rodata.str1.1 | 1 - .../module/crypto_blkcipher/sections/.smp_locks | 1 - test/sys/module/crypto_blkcipher/sections/.strtab | 1 - test/sys/module/crypto_blkcipher/sections/.symtab | 1 - test/sys/module/crypto_blkcipher/sections/.text | 1 - .../module/crypto_blkcipher/sections/__bug_table | 1 - .../module/crypto_blkcipher/sections/__kcrctab_gpl | 1 - .../module/crypto_blkcipher/sections/__ksymtab_gpl | 1 - .../crypto_blkcipher/sections/__ksymtab_strings | 1 - test/sys/module/crypto_blkcipher/srcversion | 1 - test/sys/module/dm_mod/initstate | 1 - test/sys/module/dm_mod/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/dm_mod/refcnt | 1 - test/sys/module/dm_mod/sections/.bss | 1 - test/sys/module/dm_mod/sections/.data | 1 - test/sys/module/dm_mod/sections/.exit.text | 1 - .../dm_mod/sections/.gnu.linkonce.this_module | 1 - test/sys/module/dm_mod/sections/.init.data | 1 - test/sys/module/dm_mod/sections/.init.text | 1 - test/sys/module/dm_mod/sections/.note.gnu.build-id | 1 - test/sys/module/dm_mod/sections/.rodata | 1 - test/sys/module/dm_mod/sections/.rodata.str1.1 | 1 - test/sys/module/dm_mod/sections/.smp_locks | 1 - test/sys/module/dm_mod/sections/.strtab | 1 - test/sys/module/dm_mod/sections/.symtab | 1 - test/sys/module/dm_mod/sections/.text | 1 - test/sys/module/dm_mod/sections/__bug_table | 1 - test/sys/module/dm_mod/sections/__kcrctab | 1 - test/sys/module/dm_mod/sections/__kcrctab_gpl | 1 - test/sys/module/dm_mod/sections/__ksymtab | 1 - test/sys/module/dm_mod/sections/__ksymtab_gpl | 1 - test/sys/module/dm_mod/sections/__ksymtab_strings | 1 - test/sys/module/dm_mod/sections/__param | 1 - test/sys/module/dm_mod/srcversion | 1 - test/sys/module/dock/parameters/immediate_undock | 1 - test/sys/module/e1000e/drivers/pci:e1000e | 1 - test/sys/module/e1000e/initstate | 1 - test/sys/module/e1000e/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/e1000e/parameters/copybreak | 1 - test/sys/module/e1000e/refcnt | 1 - test/sys/module/e1000e/sections/.bss | 1 - test/sys/module/e1000e/sections/.data | 1 - test/sys/module/e1000e/sections/.devexit.text | 1 - test/sys/module/e1000e/sections/.devinit.data | 1 - test/sys/module/e1000e/sections/.devinit.text | 1 - test/sys/module/e1000e/sections/.exit.text | 1 - .../e1000e/sections/.gnu.linkonce.this_module | 1 - test/sys/module/e1000e/sections/.init.text | 1 - test/sys/module/e1000e/sections/.note.gnu.build-id | 1 - test/sys/module/e1000e/sections/.rodata | 1 - test/sys/module/e1000e/sections/.rodata.str1.1 | 1 - test/sys/module/e1000e/sections/.smp_locks | 1 - test/sys/module/e1000e/sections/.strtab | 1 - test/sys/module/e1000e/sections/.symtab | 1 - test/sys/module/e1000e/sections/.text | 1 - test/sys/module/e1000e/sections/__bug_table | 1 - test/sys/module/e1000e/sections/__param | 1 - test/sys/module/e1000e/srcversion | 1 - test/sys/module/e1000e/version | 1 - test/sys/module/ecb/initstate | 1 - test/sys/module/ecb/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/ecb/refcnt | 1 - test/sys/module/ecb/sections/.bss | 1 - test/sys/module/ecb/sections/.data | 1 - test/sys/module/ecb/sections/.exit.text | 1 - .../module/ecb/sections/.gnu.linkonce.this_module | 1 - test/sys/module/ecb/sections/.init.text | 1 - test/sys/module/ecb/sections/.note.gnu.build-id | 1 - test/sys/module/ecb/sections/.rodata.str1.1 | 1 - test/sys/module/ecb/sections/.strtab | 1 - test/sys/module/ecb/sections/.symtab | 1 - test/sys/module/ecb/sections/.text | 1 - test/sys/module/ecb/srcversion | 1 - test/sys/module/edd/initstate | 1 - test/sys/module/edd/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/edd/refcnt | 1 - test/sys/module/edd/sections/.bss | 1 - test/sys/module/edd/sections/.data | 1 - test/sys/module/edd/sections/.exit.text | 1 - .../module/edd/sections/.gnu.linkonce.this_module | 1 - test/sys/module/edd/sections/.init.text | 1 - test/sys/module/edd/sections/.note.gnu.build-id | 1 - test/sys/module/edd/sections/.rodata | 1 - test/sys/module/edd/sections/.rodata.str1.1 | 1 - test/sys/module/edd/sections/.strtab | 1 - test/sys/module/edd/sections/.symtab | 1 - test/sys/module/edd/sections/.text | 1 - test/sys/module/edd/srcversion | 1 - test/sys/module/edd/version | 1 - test/sys/module/ehci_hcd/drivers/pci:ehci_hcd | 1 - test/sys/module/ehci_hcd/initstate | 1 - test/sys/module/ehci_hcd/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/ehci_hcd/parameters/ignore_oc | 1 - .../sys/module/ehci_hcd/parameters/log2_irq_thresh | 1 - test/sys/module/ehci_hcd/parameters/park | 1 - test/sys/module/ehci_hcd/refcnt | 1 - test/sys/module/ehci_hcd/sections/.bss | 1 - test/sys/module/ehci_hcd/sections/.data | 1 - test/sys/module/ehci_hcd/sections/.exit.text | 1 - .../ehci_hcd/sections/.gnu.linkonce.this_module | 1 - test/sys/module/ehci_hcd/sections/.init.text | 1 - .../module/ehci_hcd/sections/.note.gnu.build-id | 1 - test/sys/module/ehci_hcd/sections/.rodata | 1 - test/sys/module/ehci_hcd/sections/.rodata.str1.1 | 1 - test/sys/module/ehci_hcd/sections/.smp_locks | 1 - test/sys/module/ehci_hcd/sections/.strtab | 1 - test/sys/module/ehci_hcd/sections/.symtab | 1 - test/sys/module/ehci_hcd/sections/.text | 1 - test/sys/module/ehci_hcd/sections/__bug_table | 1 - test/sys/module/ehci_hcd/sections/__param | 1 - test/sys/module/ehci_hcd/srcversion | 1 - test/sys/module/evdev/initstate | 1 - test/sys/module/evdev/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/evdev/refcnt | 1 - test/sys/module/evdev/sections/.bss | 1 - test/sys/module/evdev/sections/.data | 1 - test/sys/module/evdev/sections/.exit.text | 1 - .../evdev/sections/.gnu.linkonce.this_module | 1 - test/sys/module/evdev/sections/.init.text | 1 - test/sys/module/evdev/sections/.note.gnu.build-id | 1 - test/sys/module/evdev/sections/.rodata | 1 - test/sys/module/evdev/sections/.rodata.str1.1 | 1 - test/sys/module/evdev/sections/.strtab | 1 - test/sys/module/evdev/sections/.symtab | 1 - test/sys/module/evdev/sections/.text | 1 - test/sys/module/evdev/srcversion | 1 - test/sys/module/fuse/initstate | 1 - test/sys/module/fuse/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/fuse/refcnt | 1 - test/sys/module/fuse/sections/.bss | 1 - test/sys/module/fuse/sections/.data | 1 - test/sys/module/fuse/sections/.exit.text | 1 - .../module/fuse/sections/.gnu.linkonce.this_module | 1 - test/sys/module/fuse/sections/.init.text | 1 - test/sys/module/fuse/sections/.note.gnu.build-id | 1 - test/sys/module/fuse/sections/.rodata | 1 - test/sys/module/fuse/sections/.rodata.str1.1 | 1 - test/sys/module/fuse/sections/.smp_locks | 1 - test/sys/module/fuse/sections/.strtab | 1 - test/sys/module/fuse/sections/.symtab | 1 - test/sys/module/fuse/sections/.text | 1 - test/sys/module/fuse/sections/__bug_table | 1 - test/sys/module/fuse/srcversion | 1 - test/sys/module/hid/parameters/pb_fnmode | 1 - test/sys/module/hwmon/holders/thinkpad_acpi | 1 - test/sys/module/hwmon/initstate | 1 - test/sys/module/hwmon/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/hwmon/refcnt | 1 - test/sys/module/hwmon/sections/.bss | 1 - test/sys/module/hwmon/sections/.data | 1 - test/sys/module/hwmon/sections/.exit.text | 1 - .../hwmon/sections/.gnu.linkonce.this_module | 1 - test/sys/module/hwmon/sections/.init.text | 1 - test/sys/module/hwmon/sections/.note.gnu.build-id | 1 - test/sys/module/hwmon/sections/.rodata.str1.1 | 1 - test/sys/module/hwmon/sections/.strtab | 1 - test/sys/module/hwmon/sections/.symtab | 1 - test/sys/module/hwmon/sections/.text | 1 - test/sys/module/hwmon/sections/__kcrctab_gpl | 1 - test/sys/module/hwmon/sections/__ksymtab_gpl | 1 - test/sys/module/hwmon/sections/__ksymtab_strings | 1 - test/sys/module/hwmon/srcversion | 1 - test/sys/module/i8042/parameters/debug | 1 - test/sys/module/i8042/parameters/panicblink | 1 - .../sys/module/intel_agp/drivers/pci:agpgart-intel | 1 - test/sys/module/intel_agp/initstate | 1 - test/sys/module/intel_agp/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/intel_agp/refcnt | 1 - test/sys/module/intel_agp/sections/.bss | 1 - test/sys/module/intel_agp/sections/.data | 1 - test/sys/module/intel_agp/sections/.devexit.text | 1 - test/sys/module/intel_agp/sections/.devinit.text | 1 - test/sys/module/intel_agp/sections/.exit.text | 1 - .../intel_agp/sections/.gnu.linkonce.this_module | 1 - test/sys/module/intel_agp/sections/.init.text | 1 - .../module/intel_agp/sections/.note.gnu.build-id | 1 - test/sys/module/intel_agp/sections/.rodata | 1 - test/sys/module/intel_agp/sections/.rodata.str1.1 | 1 - test/sys/module/intel_agp/sections/.smp_locks | 1 - test/sys/module/intel_agp/sections/.strtab | 1 - test/sys/module/intel_agp/sections/.symtab | 1 - test/sys/module/intel_agp/sections/.text | 1 - test/sys/module/intel_agp/srcversion | 1 - test/sys/module/ipv6/initstate | 1 - test/sys/module/ipv6/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/ipv6/refcnt | 1 - test/sys/module/ipv6/sections/.bss | 1 - test/sys/module/ipv6/sections/.data | 1 - test/sys/module/ipv6/sections/.data.read_mostly | 1 - test/sys/module/ipv6/sections/.exit.text | 1 - .../module/ipv6/sections/.gnu.linkonce.this_module | 1 - test/sys/module/ipv6/sections/.init.data | 1 - test/sys/module/ipv6/sections/.init.text | 1 - test/sys/module/ipv6/sections/.note.gnu.build-id | 1 - test/sys/module/ipv6/sections/.ref.text | 1 - test/sys/module/ipv6/sections/.rodata | 1 - test/sys/module/ipv6/sections/.rodata.str1.1 | 1 - test/sys/module/ipv6/sections/.smp_locks | 1 - test/sys/module/ipv6/sections/.strtab | 1 - test/sys/module/ipv6/sections/.symtab | 1 - test/sys/module/ipv6/sections/.text | 1 - test/sys/module/ipv6/sections/__bug_table | 1 - test/sys/module/ipv6/sections/__kcrctab | 1 - test/sys/module/ipv6/sections/__kcrctab_gpl | 1 - test/sys/module/ipv6/sections/__ksymtab | 1 - test/sys/module/ipv6/sections/__ksymtab_gpl | 1 - test/sys/module/ipv6/sections/__ksymtab_strings | 1 - test/sys/module/ipv6/srcversion | 1 - test/sys/module/iwl3945/drivers/pci:iwl3945 | 1 - test/sys/module/iwl3945/initstate | 1 - test/sys/module/iwl3945/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/iwl3945/parameters/antenna | 1 - test/sys/module/iwl3945/parameters/debug | 1 - test/sys/module/iwl3945/parameters/disable | 1 - test/sys/module/iwl3945/parameters/disable_hw_scan | 1 - test/sys/module/iwl3945/parameters/hwcrypto | 1 - test/sys/module/iwl3945/parameters/qos_enable | 1 - test/sys/module/iwl3945/parameters/queues_num | 1 - test/sys/module/iwl3945/refcnt | 1 - test/sys/module/iwl3945/sections/.bss | 1 - test/sys/module/iwl3945/sections/.data | 1 - test/sys/module/iwl3945/sections/.devexit.text | 1 - test/sys/module/iwl3945/sections/.exit.text | 1 - .../iwl3945/sections/.gnu.linkonce.this_module | 1 - test/sys/module/iwl3945/sections/.init.text | 1 - .../sys/module/iwl3945/sections/.note.gnu.build-id | 1 - test/sys/module/iwl3945/sections/.rodata | 1 - test/sys/module/iwl3945/sections/.rodata.str1.1 | 1 - test/sys/module/iwl3945/sections/.smp_locks | 1 - test/sys/module/iwl3945/sections/.strtab | 1 - test/sys/module/iwl3945/sections/.symtab | 1 - test/sys/module/iwl3945/sections/.text | 1 - test/sys/module/iwl3945/sections/__bug_table | 1 - test/sys/module/iwl3945/sections/__param | 1 - test/sys/module/iwl3945/srcversion | 1 - test/sys/module/iwl3945/version | 1 - test/sys/module/keyboard/parameters/brl_nbchords | 1 - test/sys/module/keyboard/parameters/brl_timeout | 1 - test/sys/module/led_class/holders/iwl3945 | 1 - test/sys/module/led_class/holders/thinkpad_acpi | 1 - test/sys/module/led_class/initstate | 1 - test/sys/module/led_class/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/led_class/refcnt | 1 - test/sys/module/led_class/sections/.bss | 1 - test/sys/module/led_class/sections/.data | 1 - test/sys/module/led_class/sections/.exit.text | 1 - .../led_class/sections/.gnu.linkonce.this_module | 1 - test/sys/module/led_class/sections/.init.text | 1 - .../module/led_class/sections/.note.gnu.build-id | 1 - test/sys/module/led_class/sections/.rodata.str1.1 | 1 - test/sys/module/led_class/sections/.strtab | 1 - test/sys/module/led_class/sections/.symtab | 1 - test/sys/module/led_class/sections/.text | 1 - test/sys/module/led_class/sections/__kcrctab_gpl | 1 - test/sys/module/led_class/sections/__ksymtab_gpl | 1 - .../module/led_class/sections/__ksymtab_strings | 1 - test/sys/module/led_class/srcversion | 1 - test/sys/module/libata/parameters/acpi_gtf_filter | 1 - test/sys/module/libata/parameters/allow_tpm | 1 - .../sys/module/libata/parameters/ata_probe_timeout | 1 - test/sys/module/libata/parameters/atapi_dmadir | 1 - test/sys/module/libata/parameters/atapi_enabled | 1 - test/sys/module/libata/parameters/atapi_passthru16 | 1 - test/sys/module/libata/parameters/dma | 1 - test/sys/module/libata/parameters/fua | 1 - test/sys/module/libata/parameters/ignore_hpa | 1 - test/sys/module/libata/parameters/noacpi | 1 - test/sys/module/lockdep/parameters/lock_stat | 1 - test/sys/module/loop/initstate | 1 - test/sys/module/loop/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/loop/refcnt | 1 - test/sys/module/loop/sections/.bss | 1 - test/sys/module/loop/sections/.data | 1 - test/sys/module/loop/sections/.exit.text | 1 - .../module/loop/sections/.gnu.linkonce.this_module | 1 - test/sys/module/loop/sections/.init.text | 1 - test/sys/module/loop/sections/.note.gnu.build-id | 1 - test/sys/module/loop/sections/.rodata | 1 - test/sys/module/loop/sections/.rodata.str1.1 | 1 - test/sys/module/loop/sections/.strtab | 1 - test/sys/module/loop/sections/.symtab | 1 - test/sys/module/loop/sections/.text | 1 - test/sys/module/loop/sections/__bug_table | 1 - test/sys/module/loop/sections/__kcrctab | 1 - test/sys/module/loop/sections/__ksymtab | 1 - test/sys/module/loop/sections/__ksymtab_strings | 1 - test/sys/module/loop/sections/__param | 1 - test/sys/module/loop/srcversion | 1 - test/sys/module/mac80211/holders/iwl3945 | 1 - test/sys/module/mac80211/initstate | 1 - test/sys/module/mac80211/notes/.note.gnu.build-id | Bin 36 -> 0 bytes .../mac80211/parameters/ieee80211_default_rc_algo | 1 - test/sys/module/mac80211/refcnt | 1 - test/sys/module/mac80211/sections/.bss | 1 - test/sys/module/mac80211/sections/.data | 1 - test/sys/module/mac80211/sections/.exit.text | 1 - .../mac80211/sections/.gnu.linkonce.this_module | 1 - test/sys/module/mac80211/sections/.init.text | 1 - .../module/mac80211/sections/.note.gnu.build-id | 1 - test/sys/module/mac80211/sections/.rodata | 1 - test/sys/module/mac80211/sections/.rodata.str1.1 | 1 - test/sys/module/mac80211/sections/.smp_locks | 1 - test/sys/module/mac80211/sections/.strtab | 1 - test/sys/module/mac80211/sections/.symtab | 1 - test/sys/module/mac80211/sections/.text | 1 - test/sys/module/mac80211/sections/__bug_table | 1 - test/sys/module/mac80211/sections/__kcrctab | 1 - test/sys/module/mac80211/sections/__kcrctab_gpl | 1 - test/sys/module/mac80211/sections/__ksymtab | 1 - test/sys/module/mac80211/sections/__ksymtab_gpl | 1 - .../sys/module/mac80211/sections/__ksymtab_strings | 1 - test/sys/module/mac80211/sections/__param | 1 - test/sys/module/mac80211/srcversion | 1 - test/sys/module/md_mod/holders/raid1 | 1 - test/sys/module/md_mod/initstate | 1 - test/sys/module/md_mod/notes/.note.gnu.build-id | Bin 36 -> 0 bytes .../module/md_mod/parameters/start_dirty_degraded | 1 - test/sys/module/md_mod/parameters/start_ro | 1 - test/sys/module/md_mod/refcnt | 1 - test/sys/module/md_mod/sections/.bss | 1 - test/sys/module/md_mod/sections/.data | 1 - test/sys/module/md_mod/sections/.exit.text | 1 - .../md_mod/sections/.gnu.linkonce.this_module | 1 - test/sys/module/md_mod/sections/.init.text | 1 - test/sys/module/md_mod/sections/.note.gnu.build-id | 1 - test/sys/module/md_mod/sections/.rodata | 1 - test/sys/module/md_mod/sections/.rodata.str1.1 | 1 - test/sys/module/md_mod/sections/.smp_locks | 1 - test/sys/module/md_mod/sections/.strtab | 1 - test/sys/module/md_mod/sections/.symtab | 1 - test/sys/module/md_mod/sections/.text | 1 - test/sys/module/md_mod/sections/__bug_table | 1 - test/sys/module/md_mod/sections/__kcrctab | 1 - test/sys/module/md_mod/sections/__kcrctab_gpl | 1 - test/sys/module/md_mod/sections/__ksymtab | 1 - test/sys/module/md_mod/sections/__ksymtab_gpl | 1 - test/sys/module/md_mod/sections/__ksymtab_strings | 1 - test/sys/module/md_mod/sections/__param | 1 - test/sys/module/md_mod/srcversion | 1 - test/sys/module/microcode/initstate | 1 - test/sys/module/microcode/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/microcode/refcnt | 1 - test/sys/module/microcode/sections/.bss | 1 - test/sys/module/microcode/sections/.cpuinit.text | 1 - test/sys/module/microcode/sections/.data | 1 - test/sys/module/microcode/sections/.exit.text | 1 - .../microcode/sections/.gnu.linkonce.this_module | 1 - test/sys/module/microcode/sections/.init.text | 1 - .../module/microcode/sections/.note.gnu.build-id | 1 - test/sys/module/microcode/sections/.ref.data | 1 - test/sys/module/microcode/sections/.rodata | 1 - test/sys/module/microcode/sections/.rodata.str1.1 | 1 - test/sys/module/microcode/sections/.strtab | 1 - test/sys/module/microcode/sections/.symtab | 1 - test/sys/module/microcode/sections/.text | 1 - test/sys/module/microcode/sections/__bug_table | 1 - test/sys/module/microcode/srcversion | 1 - test/sys/module/mousedev/parameters/tap_time | 1 - test/sys/module/mousedev/parameters/xres | 1 - test/sys/module/mousedev/parameters/yres | 1 - test/sys/module/nvram/holders/thinkpad_acpi | 1 - test/sys/module/nvram/initstate | 1 - test/sys/module/nvram/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/nvram/refcnt | 1 - test/sys/module/nvram/sections/.bss | 1 - test/sys/module/nvram/sections/.data | 1 - test/sys/module/nvram/sections/.exit.text | 1 - .../nvram/sections/.gnu.linkonce.this_module | 1 - test/sys/module/nvram/sections/.init.text | 1 - test/sys/module/nvram/sections/.note.gnu.build-id | 1 - test/sys/module/nvram/sections/.rodata | 1 - test/sys/module/nvram/sections/.rodata.str1.1 | 1 - test/sys/module/nvram/sections/.strtab | 1 - test/sys/module/nvram/sections/.symtab | 1 - test/sys/module/nvram/sections/.text | 1 - test/sys/module/nvram/sections/__kcrctab | 1 - test/sys/module/nvram/sections/__ksymtab | 1 - test/sys/module/nvram/sections/__ksymtab_strings | 1 - test/sys/module/nvram/srcversion | 1 - test/sys/module/oprofile/parameters/timer | 1 - test/sys/module/pcie_aspm/parameters/policy | 1 - test/sys/module/pcmcia/initstate | 1 - test/sys/module/pcmcia/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/pcmcia/parameters/io_speed | 1 - test/sys/module/pcmcia/refcnt | 1 - test/sys/module/pcmcia/sections/.bss | 1 - test/sys/module/pcmcia/sections/.data | 1 - test/sys/module/pcmcia/sections/.devinit.text | 1 - test/sys/module/pcmcia/sections/.exit.text | 1 - .../pcmcia/sections/.gnu.linkonce.this_module | 1 - test/sys/module/pcmcia/sections/.init.text | 1 - test/sys/module/pcmcia/sections/.note.gnu.build-id | 1 - test/sys/module/pcmcia/sections/.ref.data | 1 - test/sys/module/pcmcia/sections/.rodata | 1 - test/sys/module/pcmcia/sections/.rodata.str1.1 | 1 - test/sys/module/pcmcia/sections/.strtab | 1 - test/sys/module/pcmcia/sections/.symtab | 1 - test/sys/module/pcmcia/sections/.text | 1 - test/sys/module/pcmcia/sections/__kcrctab | 1 - test/sys/module/pcmcia/sections/__ksymtab | 1 - test/sys/module/pcmcia/sections/__ksymtab_strings | 1 - test/sys/module/pcmcia/sections/__param | 1 - test/sys/module/pcmcia/srcversion | 1 - test/sys/module/pcmcia_core/holders/pcmcia | 1 - test/sys/module/pcmcia_core/holders/rsrc_nonstatic | 1 - test/sys/module/pcmcia_core/holders/yenta_socket | 1 - test/sys/module/pcmcia_core/initstate | 1 - .../module/pcmcia_core/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/pcmcia_core/parameters/cis_speed | 1 - test/sys/module/pcmcia_core/parameters/cis_width | 1 - test/sys/module/pcmcia_core/parameters/reset_time | 1 - .../sys/module/pcmcia_core/parameters/resume_delay | 1 - test/sys/module/pcmcia_core/parameters/setup_delay | 1 - .../module/pcmcia_core/parameters/shutdown_delay | 1 - .../module/pcmcia_core/parameters/unreset_check | 1 - .../module/pcmcia_core/parameters/unreset_delay | 1 - .../module/pcmcia_core/parameters/unreset_limit | 1 - test/sys/module/pcmcia_core/parameters/vcc_settle | 1 - test/sys/module/pcmcia_core/refcnt | 1 - test/sys/module/pcmcia_core/sections/.bss | 1 - test/sys/module/pcmcia_core/sections/.data | 1 - test/sys/module/pcmcia_core/sections/.exit.text | 1 - .../pcmcia_core/sections/.gnu.linkonce.this_module | 1 - test/sys/module/pcmcia_core/sections/.init.text | 1 - .../module/pcmcia_core/sections/.note.gnu.build-id | 1 - test/sys/module/pcmcia_core/sections/.ref.text | 1 - test/sys/module/pcmcia_core/sections/.rodata | 1 - .../sys/module/pcmcia_core/sections/.rodata.str1.1 | 1 - test/sys/module/pcmcia_core/sections/.strtab | 1 - test/sys/module/pcmcia_core/sections/.symtab | 1 - test/sys/module/pcmcia_core/sections/.text | 1 - test/sys/module/pcmcia_core/sections/__kcrctab | 1 - test/sys/module/pcmcia_core/sections/__ksymtab | 1 - .../module/pcmcia_core/sections/__ksymtab_strings | 1 - test/sys/module/pcmcia_core/sections/__param | 1 - test/sys/module/pcmcia_core/srcversion | 1 - test/sys/module/pcspkr/drivers/platform:pcspkr | 1 - test/sys/module/pcspkr/initstate | 1 - test/sys/module/pcspkr/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/pcspkr/refcnt | 1 - test/sys/module/pcspkr/sections/.bss | 1 - test/sys/module/pcspkr/sections/.data | 1 - test/sys/module/pcspkr/sections/.devexit.text | 1 - test/sys/module/pcspkr/sections/.devinit.text | 1 - test/sys/module/pcspkr/sections/.exit.text | 1 - .../pcspkr/sections/.gnu.linkonce.this_module | 1 - test/sys/module/pcspkr/sections/.init.text | 1 - test/sys/module/pcspkr/sections/.note.gnu.build-id | 1 - test/sys/module/pcspkr/sections/.rodata.str1.1 | 1 - test/sys/module/pcspkr/sections/.strtab | 1 - test/sys/module/pcspkr/sections/.symtab | 1 - test/sys/module/pcspkr/sections/.text | 1 - test/sys/module/pcspkr/srcversion | 1 - test/sys/module/printk/parameters/time | 1 - test/sys/module/processor/holders/acpi_cpufreq | 1 - test/sys/module/processor/holders/thermal | 1 - test/sys/module/processor/initstate | 1 - test/sys/module/processor/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/processor/parameters/ignore_ppc | 1 - .../sys/module/processor/parameters/latency_factor | 1 - test/sys/module/processor/refcnt | 1 - test/sys/module/processor/sections/.bss | 1 - test/sys/module/processor/sections/.cpuinit.data | 1 - test/sys/module/processor/sections/.cpuinit.text | 1 - test/sys/module/processor/sections/.data | 1 - .../module/processor/sections/.data.read_mostly | 1 - test/sys/module/processor/sections/.exit.text | 1 - test/sys/module/processor/sections/.fixup | 1 - .../processor/sections/.gnu.linkonce.this_module | 1 - test/sys/module/processor/sections/.init.text | 1 - .../module/processor/sections/.note.gnu.build-id | 1 - test/sys/module/processor/sections/.ref.text | 1 - test/sys/module/processor/sections/.rodata | 1 - test/sys/module/processor/sections/.rodata.str1.1 | 1 - test/sys/module/processor/sections/.smp_locks | 1 - test/sys/module/processor/sections/.strtab | 1 - test/sys/module/processor/sections/.symtab | 1 - test/sys/module/processor/sections/.text | 1 - test/sys/module/processor/sections/__bug_table | 1 - test/sys/module/processor/sections/__ex_table | 1 - test/sys/module/processor/sections/__kcrctab | 1 - test/sys/module/processor/sections/__ksymtab | 1 - .../module/processor/sections/__ksymtab_strings | 1 - test/sys/module/processor/sections/__param | 1 - test/sys/module/processor/srcversion | 1 - test/sys/module/psmouse/drivers/serio:psmouse | 1 - test/sys/module/psmouse/parameters/proto | 2 - test/sys/module/psmouse/parameters/rate | 1 - test/sys/module/psmouse/parameters/resetafter | 1 - test/sys/module/psmouse/parameters/resolution | 1 - test/sys/module/psmouse/parameters/resync_time | 1 - test/sys/module/psmouse/parameters/smartscroll | 1 - test/sys/module/raid1/initstate | 1 - test/sys/module/raid1/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/raid1/refcnt | 1 - test/sys/module/raid1/sections/.bss | 1 - test/sys/module/raid1/sections/.data | 1 - .../raid1/sections/.gnu.linkonce.this_module | 1 - test/sys/module/raid1/sections/.init.text | 1 - test/sys/module/raid1/sections/.note.gnu.build-id | 1 - test/sys/module/raid1/sections/.rodata.str1.1 | 1 - test/sys/module/raid1/sections/.smp_locks | 1 - test/sys/module/raid1/sections/.strtab | 1 - test/sys/module/raid1/sections/.symtab | 1 - test/sys/module/raid1/sections/.text | 1 - test/sys/module/raid1/sections/__bug_table | 1 - test/sys/module/raid1/srcversion | 1 - test/sys/module/rfkill/holders/thinkpad_acpi | 1 - test/sys/module/rfkill/initstate | 1 - test/sys/module/rfkill/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/rfkill/parameters/default_state | 1 - test/sys/module/rfkill/refcnt | 1 - test/sys/module/rfkill/sections/.bss | 1 - test/sys/module/rfkill/sections/.data | 1 - test/sys/module/rfkill/sections/.exit.text | 1 - .../rfkill/sections/.gnu.linkonce.this_module | 1 - test/sys/module/rfkill/sections/.init.text | 1 - test/sys/module/rfkill/sections/.note.gnu.build-id | 1 - test/sys/module/rfkill/sections/.rodata | 1 - test/sys/module/rfkill/sections/.rodata.str1.1 | 1 - test/sys/module/rfkill/sections/.smp_locks | 1 - test/sys/module/rfkill/sections/.strtab | 1 - test/sys/module/rfkill/sections/.symtab | 1 - test/sys/module/rfkill/sections/.text | 1 - test/sys/module/rfkill/sections/__bug_table | 1 - test/sys/module/rfkill/sections/__kcrctab | 1 - test/sys/module/rfkill/sections/__kcrctab_gpl | 1 - test/sys/module/rfkill/sections/__ksymtab | 1 - test/sys/module/rfkill/sections/__ksymtab_gpl | 1 - test/sys/module/rfkill/sections/__ksymtab_strings | 1 - test/sys/module/rfkill/sections/__param | 1 - test/sys/module/rfkill/srcversion | 1 - test/sys/module/rfkill/version | 1 - .../sys/module/rsrc_nonstatic/holders/yenta_socket | 1 - test/sys/module/rsrc_nonstatic/initstate | 1 - .../module/rsrc_nonstatic/notes/.note.gnu.build-id | Bin 36 -> 0 bytes .../sys/module/rsrc_nonstatic/parameters/probe_mem | 1 - test/sys/module/rsrc_nonstatic/refcnt | 1 - test/sys/module/rsrc_nonstatic/sections/.bss | 1 - test/sys/module/rsrc_nonstatic/sections/.data | 1 - .../module/rsrc_nonstatic/sections/.devexit.text | 1 - .../module/rsrc_nonstatic/sections/.devinit.text | 1 - test/sys/module/rsrc_nonstatic/sections/.exit.text | 1 - .../sections/.gnu.linkonce.this_module | 1 - test/sys/module/rsrc_nonstatic/sections/.init.text | 1 - .../rsrc_nonstatic/sections/.note.gnu.build-id | 1 - test/sys/module/rsrc_nonstatic/sections/.ref.data | 1 - test/sys/module/rsrc_nonstatic/sections/.rodata | 1 - .../module/rsrc_nonstatic/sections/.rodata.str1.1 | 1 - test/sys/module/rsrc_nonstatic/sections/.strtab | 1 - test/sys/module/rsrc_nonstatic/sections/.symtab | 1 - test/sys/module/rsrc_nonstatic/sections/.text | 1 - test/sys/module/rsrc_nonstatic/sections/__kcrctab | 1 - test/sys/module/rsrc_nonstatic/sections/__ksymtab | 1 - .../rsrc_nonstatic/sections/__ksymtab_strings | 1 - test/sys/module/rsrc_nonstatic/sections/__param | 1 - test/sys/module/rsrc_nonstatic/srcversion | 1 - test/sys/module/rtc_cmos/initstate | 1 - test/sys/module/rtc_cmos/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/rtc_cmos/refcnt | 1 - test/sys/module/rtc_cmos/sections/.bss | 1 - test/sys/module/rtc_cmos/sections/.data | 1 - test/sys/module/rtc_cmos/sections/.devinit.text | 1 - test/sys/module/rtc_cmos/sections/.exit.text | 1 - .../rtc_cmos/sections/.gnu.linkonce.this_module | 1 - test/sys/module/rtc_cmos/sections/.init.text | 1 - .../module/rtc_cmos/sections/.note.gnu.build-id | 1 - test/sys/module/rtc_cmos/sections/.rodata | 1 - test/sys/module/rtc_cmos/sections/.rodata.str1.1 | 1 - test/sys/module/rtc_cmos/sections/.strtab | 1 - test/sys/module/rtc_cmos/sections/.symtab | 1 - test/sys/module/rtc_cmos/sections/.text | 1 - test/sys/module/rtc_cmos/srcversion | 1 - test/sys/module/rtc_core/holders/rtc_cmos | 1 - test/sys/module/rtc_core/initstate | 1 - test/sys/module/rtc_core/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/rtc_core/refcnt | 1 - test/sys/module/rtc_core/sections/.bss | 1 - test/sys/module/rtc_core/sections/.data | 1 - test/sys/module/rtc_core/sections/.exit.text | 1 - .../rtc_core/sections/.gnu.linkonce.this_module | 1 - test/sys/module/rtc_core/sections/.init.text | 1 - .../module/rtc_core/sections/.note.gnu.build-id | 1 - test/sys/module/rtc_core/sections/.rodata | 1 - test/sys/module/rtc_core/sections/.rodata.str1.1 | 1 - test/sys/module/rtc_core/sections/.smp_locks | 1 - test/sys/module/rtc_core/sections/.strtab | 1 - test/sys/module/rtc_core/sections/.symtab | 1 - test/sys/module/rtc_core/sections/.text | 1 - test/sys/module/rtc_core/sections/__kcrctab_gpl | 1 - test/sys/module/rtc_core/sections/__ksymtab_gpl | 1 - .../sys/module/rtc_core/sections/__ksymtab_strings | 1 - test/sys/module/rtc_core/srcversion | 1 - test/sys/module/rtc_lib/holders/rtc_core | 1 - test/sys/module/rtc_lib/initstate | 1 - test/sys/module/rtc_lib/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/rtc_lib/refcnt | 1 - test/sys/module/rtc_lib/sections/.bss | 1 - test/sys/module/rtc_lib/sections/.data | 1 - .../rtc_lib/sections/.gnu.linkonce.this_module | 1 - .../sys/module/rtc_lib/sections/.note.gnu.build-id | 1 - test/sys/module/rtc_lib/sections/.rodata | 1 - test/sys/module/rtc_lib/sections/.strtab | 1 - test/sys/module/rtc_lib/sections/.symtab | 1 - test/sys/module/rtc_lib/sections/.text | 1 - test/sys/module/rtc_lib/sections/__kcrctab | 1 - test/sys/module/rtc_lib/sections/__ksymtab | 1 - test/sys/module/rtc_lib/sections/__ksymtab_strings | 1 - test/sys/module/rtc_lib/srcversion | 1 - .../module/scsi_mod/parameters/default_dev_flags | 1 - test/sys/module/scsi_mod/parameters/inq_timeout | 1 - test/sys/module/scsi_mod/parameters/max_luns | 1 - .../sys/module/scsi_mod/parameters/max_report_luns | 1 - test/sys/module/scsi_mod/parameters/scan | 1 - .../module/scsi_mod/parameters/scsi_logging_level | 1 - test/sys/module/sg/initstate | 1 - test/sys/module/sg/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/sg/parameters/allow_dio | 1 - test/sys/module/sg/parameters/def_reserved_size | 1 - test/sys/module/sg/parameters/scatter_elem_sz | 1 - test/sys/module/sg/refcnt | 1 - test/sys/module/sg/sections/.bss | 1 - test/sys/module/sg/sections/.data | 1 - test/sys/module/sg/sections/.exit.text | 1 - test/sys/module/sg/sections/.fixup | 1 - .../module/sg/sections/.gnu.linkonce.this_module | 1 - test/sys/module/sg/sections/.init.text | 1 - test/sys/module/sg/sections/.note.gnu.build-id | 1 - test/sys/module/sg/sections/.rodata | 1 - test/sys/module/sg/sections/.rodata.str1.1 | 1 - test/sys/module/sg/sections/.smp_locks | 1 - test/sys/module/sg/sections/.strtab | 1 - test/sys/module/sg/sections/.symtab | 1 - test/sys/module/sg/sections/.text | 1 - test/sys/module/sg/sections/__bug_table | 1 - test/sys/module/sg/sections/__ex_table | 1 - test/sys/module/sg/sections/__param | 1 - test/sys/module/sg/srcversion | 1 - test/sys/module/sg/version | 1 - test/sys/module/snd/holders/snd_hda_intel | 1 - test/sys/module/snd/holders/snd_mixer_oss | 1 - test/sys/module/snd/holders/snd_pcm | 1 - test/sys/module/snd/holders/snd_pcm_oss | 1 - test/sys/module/snd/holders/snd_seq | 1 - test/sys/module/snd/holders/snd_seq_device | 1 - test/sys/module/snd/holders/snd_timer | 1 - test/sys/module/snd/initstate | 1 - test/sys/module/snd/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/snd/parameters/cards_limit | 1 - test/sys/module/snd/parameters/major | 1 - test/sys/module/snd/parameters/slots | 1 - test/sys/module/snd/refcnt | 1 - test/sys/module/snd/sections/.bss | 1 - test/sys/module/snd/sections/.data | 1 - test/sys/module/snd/sections/.exit.text | 1 - .../module/snd/sections/.gnu.linkonce.this_module | 1 - test/sys/module/snd/sections/.init.text | 1 - test/sys/module/snd/sections/.note.gnu.build-id | 1 - test/sys/module/snd/sections/.rodata | 1 - test/sys/module/snd/sections/.rodata.str1.1 | 1 - test/sys/module/snd/sections/.strtab | 1 - test/sys/module/snd/sections/.symtab | 1 - test/sys/module/snd/sections/.text | 1 - test/sys/module/snd/sections/__kcrctab | 1 - test/sys/module/snd/sections/__ksymtab | 1 - test/sys/module/snd/sections/__ksymtab_strings | 1 - test/sys/module/snd/sections/__param | 1 - test/sys/module/snd/srcversion | 1 - .../sys/module/snd_hda_intel/drivers/pci:HDA Intel | 1 - test/sys/module/snd_hda_intel/initstate | 1 - .../module/snd_hda_intel/notes/.note.gnu.build-id | Bin 36 -> 0 bytes .../module/snd_hda_intel/parameters/bdl_pos_adj | 1 - test/sys/module/snd_hda_intel/parameters/enable | 1 - .../sys/module/snd_hda_intel/parameters/enable_msi | 1 - test/sys/module/snd_hda_intel/parameters/id | 1 - test/sys/module/snd_hda_intel/parameters/index | 1 - test/sys/module/snd_hda_intel/parameters/model | 1 - .../module/snd_hda_intel/parameters/position_fix | 1 - .../sys/module/snd_hda_intel/parameters/probe_mask | 1 - .../sys/module/snd_hda_intel/parameters/single_cmd | 1 - test/sys/module/snd_hda_intel/refcnt | 1 - test/sys/module/snd_hda_intel/sections/.bss | 1 - test/sys/module/snd_hda_intel/sections/.data | 1 - .../module/snd_hda_intel/sections/.devexit.text | 1 - .../module/snd_hda_intel/sections/.devinit.data | 1 - .../module/snd_hda_intel/sections/.devinit.text | 1 - test/sys/module/snd_hda_intel/sections/.exit.text | 1 - .../sections/.gnu.linkonce.this_module | 1 - test/sys/module/snd_hda_intel/sections/.init.text | 1 - .../snd_hda_intel/sections/.note.gnu.build-id | 1 - test/sys/module/snd_hda_intel/sections/.rodata | 1 - .../module/snd_hda_intel/sections/.rodata.str1.1 | 1 - test/sys/module/snd_hda_intel/sections/.strtab | 1 - test/sys/module/snd_hda_intel/sections/.symtab | 1 - test/sys/module/snd_hda_intel/sections/.text | 1 - test/sys/module/snd_hda_intel/sections/__param | 1 - test/sys/module/snd_hda_intel/srcversion | 1 - test/sys/module/snd_mixer_oss/holders/snd_pcm_oss | 1 - test/sys/module/snd_mixer_oss/initstate | 1 - .../module/snd_mixer_oss/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/snd_mixer_oss/refcnt | 1 - test/sys/module/snd_mixer_oss/sections/.bss | 1 - test/sys/module/snd_mixer_oss/sections/.data | 1 - test/sys/module/snd_mixer_oss/sections/.exit.text | 1 - .../sections/.gnu.linkonce.this_module | 1 - test/sys/module/snd_mixer_oss/sections/.init.text | 1 - .../snd_mixer_oss/sections/.note.gnu.build-id | 1 - test/sys/module/snd_mixer_oss/sections/.rodata | 1 - .../module/snd_mixer_oss/sections/.rodata.str1.1 | 1 - test/sys/module/snd_mixer_oss/sections/.strtab | 1 - test/sys/module/snd_mixer_oss/sections/.symtab | 1 - test/sys/module/snd_mixer_oss/sections/.text | 1 - test/sys/module/snd_mixer_oss/sections/__kcrctab | 1 - test/sys/module/snd_mixer_oss/sections/__ksymtab | 1 - .../snd_mixer_oss/sections/__ksymtab_strings | 1 - test/sys/module/snd_mixer_oss/srcversion | 1 - .../module/snd_page_alloc/holders/snd_hda_intel | 1 - test/sys/module/snd_page_alloc/holders/snd_pcm | 1 - test/sys/module/snd_page_alloc/initstate | 1 - .../module/snd_page_alloc/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/snd_page_alloc/refcnt | 1 - test/sys/module/snd_page_alloc/sections/.bss | 1 - test/sys/module/snd_page_alloc/sections/.data | 1 - test/sys/module/snd_page_alloc/sections/.exit.text | 1 - .../sections/.gnu.linkonce.this_module | 1 - test/sys/module/snd_page_alloc/sections/.init.text | 1 - .../snd_page_alloc/sections/.note.gnu.build-id | 1 - test/sys/module/snd_page_alloc/sections/.rodata | 1 - .../module/snd_page_alloc/sections/.rodata.str1.1 | 1 - test/sys/module/snd_page_alloc/sections/.strtab | 1 - test/sys/module/snd_page_alloc/sections/.symtab | 1 - test/sys/module/snd_page_alloc/sections/.text | 1 - test/sys/module/snd_page_alloc/sections/__kcrctab | 1 - test/sys/module/snd_page_alloc/sections/__ksymtab | 1 - .../snd_page_alloc/sections/__ksymtab_strings | 1 - test/sys/module/snd_page_alloc/srcversion | 1 - test/sys/module/snd_pcm/holders/snd_hda_intel | 1 - test/sys/module/snd_pcm/holders/snd_pcm_oss | 1 - test/sys/module/snd_pcm/initstate | 1 - test/sys/module/snd_pcm/notes/.note.gnu.build-id | Bin 36 -> 0 bytes .../module/snd_pcm/parameters/maximum_substreams | 1 - test/sys/module/snd_pcm/parameters/preallocate_dma | 1 - test/sys/module/snd_pcm/refcnt | 1 - test/sys/module/snd_pcm/sections/.bss | 1 - test/sys/module/snd_pcm/sections/.data | 1 - test/sys/module/snd_pcm/sections/.exit.text | 1 - test/sys/module/snd_pcm/sections/.fixup | 1 - .../snd_pcm/sections/.gnu.linkonce.this_module | 1 - test/sys/module/snd_pcm/sections/.init.text | 1 - .../sys/module/snd_pcm/sections/.note.gnu.build-id | 1 - test/sys/module/snd_pcm/sections/.rodata | 1 - test/sys/module/snd_pcm/sections/.rodata.str1.1 | 1 - test/sys/module/snd_pcm/sections/.smp_locks | 1 - test/sys/module/snd_pcm/sections/.strtab | 1 - test/sys/module/snd_pcm/sections/.symtab | 1 - test/sys/module/snd_pcm/sections/.text | 1 - test/sys/module/snd_pcm/sections/__ex_table | 1 - test/sys/module/snd_pcm/sections/__kcrctab | 1 - test/sys/module/snd_pcm/sections/__ksymtab | 1 - test/sys/module/snd_pcm/sections/__ksymtab_strings | 1 - test/sys/module/snd_pcm/sections/__param | 1 - test/sys/module/snd_pcm/srcversion | 1 - test/sys/module/snd_pcm_oss/initstate | 1 - .../module/snd_pcm_oss/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/snd_pcm_oss/parameters/adsp_map | 1 - test/sys/module/snd_pcm_oss/parameters/dsp_map | 1 - .../module/snd_pcm_oss/parameters/nonblock_open | 1 - test/sys/module/snd_pcm_oss/refcnt | 1 - test/sys/module/snd_pcm_oss/sections/.bss | 1 - test/sys/module/snd_pcm_oss/sections/.data | 1 - test/sys/module/snd_pcm_oss/sections/.exit.text | 1 - .../snd_pcm_oss/sections/.gnu.linkonce.this_module | 1 - test/sys/module/snd_pcm_oss/sections/.init.text | 1 - .../module/snd_pcm_oss/sections/.note.gnu.build-id | 1 - test/sys/module/snd_pcm_oss/sections/.rodata | 1 - .../sys/module/snd_pcm_oss/sections/.rodata.str1.1 | 1 - test/sys/module/snd_pcm_oss/sections/.strtab | 1 - test/sys/module/snd_pcm_oss/sections/.symtab | 1 - test/sys/module/snd_pcm_oss/sections/.text | 1 - test/sys/module/snd_pcm_oss/sections/__param | 1 - test/sys/module/snd_pcm_oss/srcversion | 1 - test/sys/module/snd_seq/initstate | 1 - test/sys/module/snd_seq/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/snd_seq/parameters/seq_client_load | 1 - .../snd_seq/parameters/seq_default_timer_card | 1 - .../snd_seq/parameters/seq_default_timer_class | 1 - .../snd_seq/parameters/seq_default_timer_device | 1 - .../parameters/seq_default_timer_resolution | 1 - .../snd_seq/parameters/seq_default_timer_sclass | 1 - .../snd_seq/parameters/seq_default_timer_subdevice | 1 - test/sys/module/snd_seq/refcnt | 1 - test/sys/module/snd_seq/sections/.bss | 1 - test/sys/module/snd_seq/sections/.data | 1 - test/sys/module/snd_seq/sections/.exit.text | 1 - .../snd_seq/sections/.gnu.linkonce.this_module | 1 - test/sys/module/snd_seq/sections/.init.text | 1 - .../sys/module/snd_seq/sections/.note.gnu.build-id | 1 - test/sys/module/snd_seq/sections/.rodata | 1 - test/sys/module/snd_seq/sections/.rodata.str1.1 | 1 - test/sys/module/snd_seq/sections/.smp_locks | 1 - test/sys/module/snd_seq/sections/.strtab | 1 - test/sys/module/snd_seq/sections/.symtab | 1 - test/sys/module/snd_seq/sections/.text | 1 - test/sys/module/snd_seq/sections/__kcrctab | 1 - test/sys/module/snd_seq/sections/__ksymtab | 1 - test/sys/module/snd_seq/sections/__ksymtab_strings | 1 - test/sys/module/snd_seq/sections/__param | 1 - test/sys/module/snd_seq/srcversion | 1 - test/sys/module/snd_seq_device/holders/snd_seq | 1 - test/sys/module/snd_seq_device/initstate | 1 - .../module/snd_seq_device/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/snd_seq_device/refcnt | 1 - test/sys/module/snd_seq_device/sections/.bss | 1 - test/sys/module/snd_seq_device/sections/.data | 1 - test/sys/module/snd_seq_device/sections/.exit.text | 1 - .../sections/.gnu.linkonce.this_module | 1 - test/sys/module/snd_seq_device/sections/.init.text | 1 - .../snd_seq_device/sections/.note.gnu.build-id | 1 - .../module/snd_seq_device/sections/.rodata.str1.1 | 1 - test/sys/module/snd_seq_device/sections/.strtab | 1 - test/sys/module/snd_seq_device/sections/.symtab | 1 - test/sys/module/snd_seq_device/sections/.text | 1 - test/sys/module/snd_seq_device/sections/__kcrctab | 1 - test/sys/module/snd_seq_device/sections/__ksymtab | 1 - .../snd_seq_device/sections/__ksymtab_strings | 1 - test/sys/module/snd_seq_device/srcversion | 1 - test/sys/module/snd_timer/holders/snd_pcm | 1 - test/sys/module/snd_timer/holders/snd_seq | 1 - test/sys/module/snd_timer/initstate | 1 - test/sys/module/snd_timer/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/snd_timer/parameters/timer_limit | 1 - .../snd_timer/parameters/timer_tstamp_monotonic | 1 - test/sys/module/snd_timer/refcnt | 1 - test/sys/module/snd_timer/sections/.bss | 1 - test/sys/module/snd_timer/sections/.data | 1 - test/sys/module/snd_timer/sections/.exit.text | 1 - .../snd_timer/sections/.gnu.linkonce.this_module | 1 - test/sys/module/snd_timer/sections/.init.text | 1 - .../module/snd_timer/sections/.note.gnu.build-id | 1 - test/sys/module/snd_timer/sections/.rodata | 1 - test/sys/module/snd_timer/sections/.rodata.str1.1 | 1 - test/sys/module/snd_timer/sections/.smp_locks | 1 - test/sys/module/snd_timer/sections/.strtab | 1 - test/sys/module/snd_timer/sections/.symtab | 1 - test/sys/module/snd_timer/sections/.text | 1 - test/sys/module/snd_timer/sections/__bug_table | 1 - test/sys/module/snd_timer/sections/__kcrctab | 1 - test/sys/module/snd_timer/sections/__ksymtab | 1 - .../module/snd_timer/sections/__ksymtab_strings | 1 - test/sys/module/snd_timer/sections/__param | 1 - test/sys/module/snd_timer/srcversion | 1 - test/sys/module/soundcore/holders/snd | 1 - test/sys/module/soundcore/initstate | 1 - test/sys/module/soundcore/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/soundcore/refcnt | 1 - test/sys/module/soundcore/sections/.bss | 1 - test/sys/module/soundcore/sections/.data | 1 - test/sys/module/soundcore/sections/.exit.text | 1 - .../soundcore/sections/.gnu.linkonce.this_module | 1 - test/sys/module/soundcore/sections/.init.text | 1 - .../module/soundcore/sections/.note.gnu.build-id | 1 - test/sys/module/soundcore/sections/.rodata | 1 - test/sys/module/soundcore/sections/.rodata.str1.1 | 1 - test/sys/module/soundcore/sections/.strtab | 1 - test/sys/module/soundcore/sections/.symtab | 1 - test/sys/module/soundcore/sections/.text | 1 - test/sys/module/soundcore/sections/__kcrctab | 1 - test/sys/module/soundcore/sections/__ksymtab | 1 - .../module/soundcore/sections/__ksymtab_strings | 1 - test/sys/module/soundcore/srcversion | 1 - test/sys/module/spurious/parameters/irqfixup | 1 - test/sys/module/spurious/parameters/noirqdebug | 1 - test/sys/module/sr_mod/initstate | 1 - test/sys/module/sr_mod/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/sr_mod/parameters/xa_test | 1 - test/sys/module/sr_mod/refcnt | 1 - test/sys/module/sr_mod/sections/.bss | 1 - test/sys/module/sr_mod/sections/.data | 1 - test/sys/module/sr_mod/sections/.exit.text | 1 - .../sr_mod/sections/.gnu.linkonce.this_module | 1 - test/sys/module/sr_mod/sections/.init.text | 1 - test/sys/module/sr_mod/sections/.note.gnu.build-id | 1 - test/sys/module/sr_mod/sections/.rodata | 1 - test/sys/module/sr_mod/sections/.rodata.str1.1 | 1 - test/sys/module/sr_mod/sections/.smp_locks | 1 - test/sys/module/sr_mod/sections/.strtab | 1 - test/sys/module/sr_mod/sections/.symtab | 1 - test/sys/module/sr_mod/sections/.text | 1 - test/sys/module/sr_mod/sections/__param | 1 - test/sys/module/sr_mod/srcversion | 1 - test/sys/module/tcp_cubic/parameters/beta | 1 - test/sys/module/tcp_cubic/parameters/bic_scale | 1 - .../module/tcp_cubic/parameters/fast_convergence | 1 - .../module/tcp_cubic/parameters/initial_ssthresh | 1 - .../module/tcp_cubic/parameters/tcp_friendliness | 1 - test/sys/module/thermal/initstate | 1 - test/sys/module/thermal/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/thermal/parameters/act | 1 - test/sys/module/thermal/parameters/crt | 1 - test/sys/module/thermal/parameters/psv | 1 - test/sys/module/thermal/parameters/tzp | 1 - test/sys/module/thermal/refcnt | 1 - test/sys/module/thermal/sections/.bss | 1 - test/sys/module/thermal/sections/.data | 1 - test/sys/module/thermal/sections/.exit.text | 1 - .../thermal/sections/.gnu.linkonce.this_module | 1 - test/sys/module/thermal/sections/.init.data | 1 - test/sys/module/thermal/sections/.init.text | 1 - .../sys/module/thermal/sections/.note.gnu.build-id | 1 - test/sys/module/thermal/sections/.rodata | 1 - test/sys/module/thermal/sections/.rodata.str1.1 | 1 - test/sys/module/thermal/sections/.strtab | 1 - test/sys/module/thermal/sections/.symtab | 1 - test/sys/module/thermal/sections/.text | 1 - test/sys/module/thermal/sections/__param | 1 - test/sys/module/thermal/srcversion | 1 - .../thinkpad_acpi/drivers/platform:thinkpad_acpi | 1 - .../thinkpad_acpi/drivers/platform:thinkpad_hwmon | 1 - test/sys/module/thinkpad_acpi/initstate | 1 - .../module/thinkpad_acpi/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/thinkpad_acpi/refcnt | 1 - test/sys/module/thinkpad_acpi/sections/.bss | 1 - test/sys/module/thinkpad_acpi/sections/.data | 1 - .../sections/.gnu.linkonce.this_module | 1 - test/sys/module/thinkpad_acpi/sections/.init.data | 1 - test/sys/module/thinkpad_acpi/sections/.init.text | 1 - .../thinkpad_acpi/sections/.note.gnu.build-id | 1 - test/sys/module/thinkpad_acpi/sections/.rodata | 1 - .../module/thinkpad_acpi/sections/.rodata.str1.1 | 1 - test/sys/module/thinkpad_acpi/sections/.smp_locks | 1 - test/sys/module/thinkpad_acpi/sections/.strtab | 1 - test/sys/module/thinkpad_acpi/sections/.symtab | 1 - test/sys/module/thinkpad_acpi/sections/.text | 1 - test/sys/module/thinkpad_acpi/sections/__bug_table | 1 - test/sys/module/thinkpad_acpi/sections/__param | 1 - test/sys/module/thinkpad_acpi/srcversion | 1 - test/sys/module/thinkpad_acpi/version | 1 - test/sys/module/uhci_hcd/drivers/pci:uhci_hcd | 1 - test/sys/module/uhci_hcd/initstate | 1 - test/sys/module/uhci_hcd/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/uhci_hcd/parameters/ignore_oc | 1 - test/sys/module/uhci_hcd/refcnt | 1 - test/sys/module/uhci_hcd/sections/.bss | 1 - test/sys/module/uhci_hcd/sections/.data | 1 - test/sys/module/uhci_hcd/sections/.exit.text | 1 - .../uhci_hcd/sections/.gnu.linkonce.this_module | 1 - test/sys/module/uhci_hcd/sections/.init.text | 1 - .../module/uhci_hcd/sections/.note.gnu.build-id | 1 - test/sys/module/uhci_hcd/sections/.rodata | 1 - test/sys/module/uhci_hcd/sections/.rodata.str1.1 | 1 - test/sys/module/uhci_hcd/sections/.smp_locks | 1 - test/sys/module/uhci_hcd/sections/.strtab | 1 - test/sys/module/uhci_hcd/sections/.symtab | 1 - test/sys/module/uhci_hcd/sections/.text | 1 - test/sys/module/uhci_hcd/sections/__param | 1 - test/sys/module/uhci_hcd/srcversion | 1 - test/sys/module/uinput/initstate | 1 - test/sys/module/uinput/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/uinput/refcnt | 1 - test/sys/module/uinput/sections/.bss | 1 - test/sys/module/uinput/sections/.data | 1 - test/sys/module/uinput/sections/.exit.text | 1 - .../uinput/sections/.gnu.linkonce.this_module | 1 - test/sys/module/uinput/sections/.init.text | 1 - test/sys/module/uinput/sections/.note.gnu.build-id | 1 - test/sys/module/uinput/sections/.rodata | 1 - test/sys/module/uinput/sections/.rodata.str1.1 | 1 - test/sys/module/uinput/sections/.smp_locks | 1 - test/sys/module/uinput/sections/.strtab | 1 - test/sys/module/uinput/sections/.symtab | 1 - test/sys/module/uinput/sections/.text | 1 - test/sys/module/uinput/srcversion | 1 - test/sys/module/uinput/version | 1 - .../sys/module/usb_storage/drivers/usb:usb-storage | 1 - test/sys/module/usb_storage/initstate | 1 - .../module/usb_storage/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/usb_storage/parameters/delay_use | 1 - .../module/usb_storage/parameters/swi_tru_install | 1 - test/sys/module/usb_storage/refcnt | 1 - test/sys/module/usb_storage/sections/.bss | 1 - test/sys/module/usb_storage/sections/.data | 1 - test/sys/module/usb_storage/sections/.exit.text | 1 - .../usb_storage/sections/.gnu.linkonce.this_module | 1 - test/sys/module/usb_storage/sections/.init.text | 1 - .../module/usb_storage/sections/.note.gnu.build-id | 1 - test/sys/module/usb_storage/sections/.rodata | 1 - .../sys/module/usb_storage/sections/.rodata.str1.1 | 1 - test/sys/module/usb_storage/sections/.smp_locks | 1 - test/sys/module/usb_storage/sections/.strtab | 1 - test/sys/module/usb_storage/sections/.symtab | 1 - test/sys/module/usb_storage/sections/.text | 1 - test/sys/module/usb_storage/sections/__param | 1 - test/sys/module/usb_storage/srcversion | 1 - test/sys/module/usbcore/drivers/usb:hub | 1 - test/sys/module/usbcore/drivers/usb:usb | 1 - test/sys/module/usbcore/drivers/usb:usbfs | 1 - test/sys/module/usbcore/holders/cdc_acm | 1 - test/sys/module/usbcore/holders/ehci_hcd | 1 - test/sys/module/usbcore/holders/uhci_hcd | 1 - test/sys/module/usbcore/holders/usb_storage | 1 - test/sys/module/usbcore/holders/usbhid | 1 - test/sys/module/usbcore/initstate | 1 - test/sys/module/usbcore/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/usbcore/parameters/autosuspend | 1 - test/sys/module/usbcore/parameters/blinkenlights | 1 - test/sys/module/usbcore/parameters/nousb | 1 - .../sys/module/usbcore/parameters/old_scheme_first | 1 - test/sys/module/usbcore/parameters/usbfs_snoop | 1 - .../sys/module/usbcore/parameters/use_both_schemes | 1 - test/sys/module/usbcore/refcnt | 1 - test/sys/module/usbcore/sections/.bss | 1 - test/sys/module/usbcore/sections/.data | 1 - test/sys/module/usbcore/sections/.exit.text | 1 - test/sys/module/usbcore/sections/.fixup | 1 - .../usbcore/sections/.gnu.linkonce.this_module | 1 - test/sys/module/usbcore/sections/.init.text | 1 - .../sys/module/usbcore/sections/.note.gnu.build-id | 1 - test/sys/module/usbcore/sections/.rodata | 1 - test/sys/module/usbcore/sections/.rodata.str1.1 | 1 - test/sys/module/usbcore/sections/.smp_locks | 1 - test/sys/module/usbcore/sections/.strtab | 1 - test/sys/module/usbcore/sections/.symtab | 1 - test/sys/module/usbcore/sections/.text | 1 - test/sys/module/usbcore/sections/__bug_table | 1 - test/sys/module/usbcore/sections/__ex_table | 1 - test/sys/module/usbcore/sections/__kcrctab_gpl | 1 - test/sys/module/usbcore/sections/__ksymtab_gpl | 1 - test/sys/module/usbcore/sections/__ksymtab_strings | 1 - test/sys/module/usbcore/sections/__param | 1 - test/sys/module/usbcore/srcversion | 1 - test/sys/module/usbhid/drivers/usb:usbhid | 1 - test/sys/module/usbhid/initstate | 1 - test/sys/module/usbhid/notes/.note.gnu.build-id | Bin 36 -> 0 bytes test/sys/module/usbhid/parameters/mousepoll | 1 - test/sys/module/usbhid/parameters/quirks | 1 - test/sys/module/usbhid/parameters/rdesc_quirks | 1 - test/sys/module/usbhid/refcnt | 1 - test/sys/module/usbhid/sections/.bss | 1 - test/sys/module/usbhid/sections/.data | 1 - test/sys/module/usbhid/sections/.exit.text | 1 - .../usbhid/sections/.gnu.linkonce.this_module | 1 - test/sys/module/usbhid/sections/.init.text | 1 - test/sys/module/usbhid/sections/.note.gnu.build-id | 1 - test/sys/module/usbhid/sections/.rodata | 1 - test/sys/module/usbhid/sections/.rodata.str1.1 | 1 - test/sys/module/usbhid/sections/.smp_locks | 1 - test/sys/module/usbhid/sections/.strtab | 1 - test/sys/module/usbhid/sections/.symtab | 1 - test/sys/module/usbhid/sections/.text | 1 - test/sys/module/usbhid/sections/__kcrctab_gpl | 1 - test/sys/module/usbhid/sections/__ksymtab_gpl | 1 - test/sys/module/usbhid/sections/__ksymtab_strings | 1 - test/sys/module/usbhid/sections/__param | 1 - test/sys/module/usbhid/srcversion | 1 - test/sys/module/vt/parameters/default_blu | 1 - test/sys/module/vt/parameters/default_grn | 1 - test/sys/module/vt/parameters/default_red | 1 - test/sys/module/vt/parameters/default_utf8 | 1 - test/sys/module/vt/parameters/italic | 1 - test/sys/module/vt/parameters/underline | 1 - .../module/yenta_socket/drivers/pci:yenta_cardbus | 1 - test/sys/module/yenta_socket/initstate | 1 - .../module/yenta_socket/notes/.note.gnu.build-id | Bin 36 -> 0 bytes .../module/yenta_socket/parameters/disable_clkrun | 1 - test/sys/module/yenta_socket/parameters/isa_probe | 1 - .../module/yenta_socket/parameters/pwr_irqs_off | 1 - test/sys/module/yenta_socket/refcnt | 1 - test/sys/module/yenta_socket/sections/.bss | 1 - test/sys/module/yenta_socket/sections/.data | 1 - .../sys/module/yenta_socket/sections/.devinit.text | 1 - test/sys/module/yenta_socket/sections/.exit.text | 1 - .../sections/.gnu.linkonce.this_module | 1 - test/sys/module/yenta_socket/sections/.init.text | 1 - .../yenta_socket/sections/.note.gnu.build-id | 1 - test/sys/module/yenta_socket/sections/.rodata | 1 - .../module/yenta_socket/sections/.rodata.str1.1 | 1 - test/sys/module/yenta_socket/sections/.strtab | 1 - test/sys/module/yenta_socket/sections/.symtab | 1 - test/sys/module/yenta_socket/sections/.text | 1 - test/sys/module/yenta_socket/sections/__bug_table | 1 - test/sys/module/yenta_socket/sections/__param | 1 - test/sys/module/yenta_socket/srcversion | 1 - test/sys/power/state | 1 - test/udev-test.pl | 1560 ++++++++++++++++++++ test/udev-test.pl.in | 1560 -------------------- 9588 files changed, 1584 insertions(+), 12217 deletions(-) delete mode 100644 test/.gitignore create mode 100644 test/sys.tar.xz delete mode 120000 test/sys/block/loop0 delete mode 120000 test/sys/block/loop1 delete mode 120000 test/sys/block/loop2 delete mode 120000 test/sys/block/loop3 delete mode 120000 test/sys/block/loop4 delete mode 120000 test/sys/block/loop5 delete mode 120000 test/sys/block/loop6 delete mode 120000 test/sys/block/loop7 delete mode 120000 test/sys/block/md0 delete mode 120000 test/sys/block/sda delete mode 120000 test/sys/block/sdb delete mode 120000 test/sys/block/sr0 delete mode 120000 test/sys/bus/acpi/devices/ACPI0003:00 delete mode 120000 test/sys/bus/acpi/devices/ACPI0007:00 delete mode 120000 test/sys/bus/acpi/devices/ACPI0007:01 delete mode 120000 test/sys/bus/acpi/devices/ATM1200:00 delete mode 120000 test/sys/bus/acpi/devices/IBM0057:00 delete mode 120000 test/sys/bus/acpi/devices/IBM0068:00 delete mode 120000 test/sys/bus/acpi/devices/IBM0079:00 delete mode 120000 test/sys/bus/acpi/devices/LNXPOWER:00 delete mode 120000 test/sys/bus/acpi/devices/LNXPWRBN:00 delete mode 120000 test/sys/bus/acpi/devices/LNXSYSTM:00 delete mode 120000 test/sys/bus/acpi/devices/LNXTHERM:00 delete mode 120000 test/sys/bus/acpi/devices/LNXTHERM:01 delete mode 120000 test/sys/bus/acpi/devices/LNXTHERM:02 delete mode 120000 test/sys/bus/acpi/devices/PNP0000:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0100:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0103:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0200:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0303:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0800:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0A08:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0B00:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0C01:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0C02:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0C04:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0C09:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0A:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0D:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0E:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0F:00 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0F:01 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0F:02 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0F:03 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0F:04 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0F:05 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0F:06 delete mode 120000 test/sys/bus/acpi/devices/PNP0C0F:07 delete mode 120000 test/sys/bus/acpi/devices/device:00 delete mode 120000 test/sys/bus/acpi/devices/device:01 delete mode 120000 test/sys/bus/acpi/devices/device:02 delete mode 120000 test/sys/bus/acpi/devices/device:03 delete mode 120000 test/sys/bus/acpi/devices/device:04 delete mode 120000 test/sys/bus/acpi/devices/device:05 delete mode 120000 test/sys/bus/acpi/devices/device:06 delete mode 120000 test/sys/bus/acpi/devices/device:07 delete mode 120000 test/sys/bus/acpi/devices/device:08 delete mode 120000 test/sys/bus/acpi/devices/device:09 delete mode 120000 test/sys/bus/acpi/devices/device:0a delete mode 120000 test/sys/bus/acpi/devices/device:0b delete mode 120000 test/sys/bus/acpi/devices/device:0c delete mode 120000 test/sys/bus/acpi/devices/device:0d delete mode 120000 test/sys/bus/acpi/devices/device:0e delete mode 120000 test/sys/bus/acpi/devices/device:0f delete mode 120000 test/sys/bus/acpi/devices/device:10 delete mode 120000 test/sys/bus/acpi/devices/device:11 delete mode 120000 test/sys/bus/acpi/devices/device:12 delete mode 120000 test/sys/bus/acpi/devices/device:13 delete mode 120000 test/sys/bus/acpi/devices/device:14 delete mode 120000 test/sys/bus/acpi/devices/device:15 delete mode 120000 test/sys/bus/acpi/devices/device:16 delete mode 120000 test/sys/bus/acpi/devices/device:17 delete mode 120000 test/sys/bus/acpi/devices/device:18 delete mode 120000 test/sys/bus/acpi/devices/device:19 delete mode 120000 test/sys/bus/acpi/devices/device:1a delete mode 120000 test/sys/bus/acpi/devices/device:1b delete mode 120000 test/sys/bus/acpi/devices/device:1c delete mode 120000 test/sys/bus/acpi/devices/device:1d delete mode 120000 test/sys/bus/acpi/devices/device:1e delete mode 120000 test/sys/bus/acpi/devices/device:1f delete mode 120000 test/sys/bus/acpi/devices/device:20 delete mode 120000 test/sys/bus/acpi/devices/device:21 delete mode 120000 test/sys/bus/acpi/devices/device:22 delete mode 120000 test/sys/bus/acpi/devices/device:23 delete mode 120000 test/sys/bus/acpi/devices/device:24 delete mode 120000 test/sys/bus/acpi/devices/device:25 delete mode 120000 test/sys/bus/acpi/drivers/ac/ACPI0003:00 delete mode 120000 test/sys/bus/acpi/drivers/battery/PNP0C0A:00 delete mode 120000 test/sys/bus/acpi/drivers/button/LNXPWRBN:00 delete mode 120000 test/sys/bus/acpi/drivers/button/PNP0C0D:00 delete mode 120000 test/sys/bus/acpi/drivers/button/PNP0C0E:00 delete mode 120000 test/sys/bus/acpi/drivers/ec/PNP0C09:00 delete mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 delete mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 delete mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 delete mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 delete mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 delete mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 delete mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 delete mode 120000 test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 delete mode 120000 test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 delete mode 120000 test/sys/bus/acpi/drivers/power/LNXPOWER:00 delete mode 120000 test/sys/bus/acpi/drivers/processor/ACPI0007:00 delete mode 120000 test/sys/bus/acpi/drivers/processor/ACPI0007:01 delete mode 120000 test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 delete mode 120000 test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 delete mode 120000 test/sys/bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 delete mode 100644 test/sys/bus/acpi/drivers_autoprobe delete mode 120000 test/sys/bus/pci/devices/0000:00:00.0 delete mode 120000 test/sys/bus/pci/devices/0000:00:01.0 delete mode 120000 test/sys/bus/pci/devices/0000:00:1b.0 delete mode 120000 test/sys/bus/pci/devices/0000:00:1c.0 delete mode 120000 test/sys/bus/pci/devices/0000:00:1c.1 delete mode 120000 test/sys/bus/pci/devices/0000:00:1c.2 delete mode 120000 test/sys/bus/pci/devices/0000:00:1c.3 delete mode 120000 test/sys/bus/pci/devices/0000:00:1d.0 delete mode 120000 test/sys/bus/pci/devices/0000:00:1d.1 delete mode 120000 test/sys/bus/pci/devices/0000:00:1d.2 delete mode 120000 test/sys/bus/pci/devices/0000:00:1d.3 delete mode 120000 test/sys/bus/pci/devices/0000:00:1e.0 delete mode 120000 test/sys/bus/pci/devices/0000:00:1f.0 delete mode 120000 test/sys/bus/pci/devices/0000:00:1f.1 delete mode 120000 test/sys/bus/pci/devices/0000:00:1f.2 delete mode 120000 test/sys/bus/pci/devices/0000:00:1f.3 delete mode 120000 test/sys/bus/pci/devices/0000:01:00.0 delete mode 120000 test/sys/bus/pci/devices/0000:02:00.0 delete mode 120000 test/sys/bus/pci/devices/0000:03:00.0 delete mode 120000 test/sys/bus/pci/devices/0000:15:00.0 delete mode 120000 test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 delete mode 120000 test/sys/bus/pci/drivers/HDA Intel/module delete mode 120000 test/sys/bus/pci/drivers/agpgart-intel/module delete mode 120000 test/sys/bus/pci/drivers/ahci/0000:00:1f.2 delete mode 120000 test/sys/bus/pci/drivers/ahci/module delete mode 120000 test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 delete mode 120000 test/sys/bus/pci/drivers/e1000e/0000:02:00.0 delete mode 120000 test/sys/bus/pci/drivers/e1000e/module delete mode 120000 test/sys/bus/pci/drivers/ehci_hcd/module delete mode 120000 test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 delete mode 120000 test/sys/bus/pci/drivers/iwl3945/module delete mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:01.0 delete mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.0 delete mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.1 delete mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.2 delete mode 120000 test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.3 delete mode 120000 test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 delete mode 120000 test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 delete mode 120000 test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 delete mode 120000 test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 delete mode 120000 test/sys/bus/pci/drivers/uhci_hcd/module delete mode 120000 test/sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 delete mode 120000 test/sys/bus/pci/drivers/yenta_cardbus/module delete mode 100644 test/sys/bus/pci/drivers_autoprobe delete mode 120000 test/sys/bus/pci_express/devices/0000:00:01.0:pcie00 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:01.0:pcie03 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.0:pcie00 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.0:pcie02 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.0:pcie03 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.1:pcie00 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.1:pcie02 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.1:pcie03 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.2:pcie00 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.2:pcie02 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.2:pcie03 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.3:pcie00 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.3:pcie02 delete mode 120000 test/sys/bus/pci_express/devices/0000:00:1c.3:pcie03 delete mode 100644 test/sys/bus/pci_express/drivers_autoprobe delete mode 100644 test/sys/bus/pcmcia/drivers_autoprobe delete mode 120000 test/sys/bus/platform/devices/dock.0 delete mode 120000 test/sys/bus/platform/devices/i8042 delete mode 120000 test/sys/bus/platform/devices/microcode delete mode 120000 test/sys/bus/platform/devices/pcspkr delete mode 120000 test/sys/bus/platform/devices/serial8250 delete mode 120000 test/sys/bus/platform/devices/thinkpad_acpi delete mode 120000 test/sys/bus/platform/devices/thinkpad_hwmon delete mode 120000 test/sys/bus/platform/devices/vesafb.0 delete mode 120000 test/sys/bus/platform/drivers/i8042/i8042 delete mode 120000 test/sys/bus/platform/drivers/pcspkr/module delete mode 120000 test/sys/bus/platform/drivers/pcspkr/pcspkr delete mode 120000 test/sys/bus/platform/drivers/serial8250/serial8250 delete mode 100644 test/sys/bus/platform/drivers/thinkpad_acpi/debug_level delete mode 100644 test/sys/bus/platform/drivers/thinkpad_acpi/interface_version delete mode 120000 test/sys/bus/platform/drivers/thinkpad_acpi/module delete mode 120000 test/sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi delete mode 100644 test/sys/bus/platform/drivers/thinkpad_acpi/version delete mode 100644 test/sys/bus/platform/drivers/thinkpad_hwmon/debug_level delete mode 100644 test/sys/bus/platform/drivers/thinkpad_hwmon/fan_watchdog delete mode 100644 test/sys/bus/platform/drivers/thinkpad_hwmon/interface_version delete mode 120000 test/sys/bus/platform/drivers/thinkpad_hwmon/module delete mode 120000 test/sys/bus/platform/drivers/thinkpad_hwmon/thinkpad_hwmon delete mode 100644 test/sys/bus/platform/drivers/thinkpad_hwmon/version delete mode 120000 test/sys/bus/platform/drivers/vesafb/vesafb.0 delete mode 100644 test/sys/bus/platform/drivers_autoprobe delete mode 120000 test/sys/bus/pnp/devices/00:00 delete mode 120000 test/sys/bus/pnp/devices/00:01 delete mode 120000 test/sys/bus/pnp/devices/00:02 delete mode 120000 test/sys/bus/pnp/devices/00:03 delete mode 120000 test/sys/bus/pnp/devices/00:04 delete mode 120000 test/sys/bus/pnp/devices/00:05 delete mode 120000 test/sys/bus/pnp/devices/00:06 delete mode 120000 test/sys/bus/pnp/devices/00:07 delete mode 120000 test/sys/bus/pnp/devices/00:08 delete mode 120000 test/sys/bus/pnp/devices/00:09 delete mode 120000 test/sys/bus/pnp/devices/00:0a delete mode 120000 test/sys/bus/pnp/drivers/i8042 aux/00:09 delete mode 120000 test/sys/bus/pnp/drivers/i8042 kbd/00:08 delete mode 120000 test/sys/bus/pnp/drivers/rtc_cmos/00:07 delete mode 120000 test/sys/bus/pnp/drivers/system/00:00 delete mode 120000 test/sys/bus/pnp/drivers/system/00:02 delete mode 100644 test/sys/bus/pnp/drivers_autoprobe delete mode 120000 test/sys/bus/scsi/devices/0:0:0:0 delete mode 120000 test/sys/bus/scsi/devices/4:0:0:0 delete mode 120000 test/sys/bus/scsi/devices/7:0:0:0 delete mode 120000 test/sys/bus/scsi/devices/host0 delete mode 120000 test/sys/bus/scsi/devices/host1 delete mode 120000 test/sys/bus/scsi/devices/host2 delete mode 120000 test/sys/bus/scsi/devices/host3 delete mode 120000 test/sys/bus/scsi/devices/host4 delete mode 120000 test/sys/bus/scsi/devices/host5 delete mode 120000 test/sys/bus/scsi/devices/host7 delete mode 120000 test/sys/bus/scsi/devices/target0:0:0 delete mode 120000 test/sys/bus/scsi/devices/target4:0:0 delete mode 120000 test/sys/bus/scsi/devices/target7:0:0 delete mode 120000 test/sys/bus/scsi/drivers/sd/0:0:0:0 delete mode 120000 test/sys/bus/scsi/drivers/sd/7:0:0:0 delete mode 120000 test/sys/bus/scsi/drivers/sr/4:0:0:0 delete mode 100644 test/sys/bus/scsi/drivers_autoprobe delete mode 120000 test/sys/bus/serio/devices/serio0 delete mode 120000 test/sys/bus/serio/devices/serio1 delete mode 100644 test/sys/bus/serio/drivers/atkbd/bind_mode delete mode 100644 test/sys/bus/serio/drivers/atkbd/description delete mode 120000 test/sys/bus/serio/drivers/atkbd/module delete mode 120000 test/sys/bus/serio/drivers/atkbd/serio0 delete mode 100644 test/sys/bus/serio/drivers/psmouse/bind_mode delete mode 100644 test/sys/bus/serio/drivers/psmouse/description delete mode 120000 test/sys/bus/serio/drivers/psmouse/module delete mode 120000 test/sys/bus/serio/drivers/psmouse/serio1 delete mode 100644 test/sys/bus/serio/drivers_autoprobe delete mode 120000 test/sys/bus/usb/devices/1-0:1.0 delete mode 120000 test/sys/bus/usb/devices/2-0:1.0 delete mode 120000 test/sys/bus/usb/devices/3-0:1.0 delete mode 120000 test/sys/bus/usb/devices/3-1 delete mode 120000 test/sys/bus/usb/devices/3-1:1.0 delete mode 120000 test/sys/bus/usb/devices/4-0:1.0 delete mode 120000 test/sys/bus/usb/devices/4-1 delete mode 120000 test/sys/bus/usb/devices/4-1:1.0 delete mode 120000 test/sys/bus/usb/devices/4-1:1.1 delete mode 120000 test/sys/bus/usb/devices/4-1:1.2 delete mode 120000 test/sys/bus/usb/devices/4-1:1.3 delete mode 120000 test/sys/bus/usb/devices/4-2 delete mode 120000 test/sys/bus/usb/devices/4-2:1.0 delete mode 120000 test/sys/bus/usb/devices/5-0:1.0 delete mode 120000 test/sys/bus/usb/devices/5-1 delete mode 120000 test/sys/bus/usb/devices/5-1:1.0 delete mode 120000 test/sys/bus/usb/devices/5-2 delete mode 120000 test/sys/bus/usb/devices/5-2:1.0 delete mode 120000 test/sys/bus/usb/devices/5-2:1.1 delete mode 120000 test/sys/bus/usb/devices/5-2:1.10 delete mode 120000 test/sys/bus/usb/devices/5-2:1.11 delete mode 120000 test/sys/bus/usb/devices/5-2:1.12 delete mode 120000 test/sys/bus/usb/devices/5-2:1.13 delete mode 120000 test/sys/bus/usb/devices/5-2:1.2 delete mode 120000 test/sys/bus/usb/devices/5-2:1.3 delete mode 120000 test/sys/bus/usb/devices/5-2:1.4 delete mode 120000 test/sys/bus/usb/devices/5-2:1.5 delete mode 120000 test/sys/bus/usb/devices/5-2:1.6 delete mode 120000 test/sys/bus/usb/devices/5-2:1.9 delete mode 120000 test/sys/bus/usb/devices/usb1 delete mode 120000 test/sys/bus/usb/devices/usb2 delete mode 120000 test/sys/bus/usb/devices/usb3 delete mode 120000 test/sys/bus/usb/devices/usb4 delete mode 120000 test/sys/bus/usb/devices/usb5 delete mode 120000 test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 delete mode 120000 test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 delete mode 120000 test/sys/bus/usb/drivers/cdc_acm/module delete mode 120000 test/sys/bus/usb/drivers/hub/1-0:1.0 delete mode 120000 test/sys/bus/usb/drivers/hub/2-0:1.0 delete mode 120000 test/sys/bus/usb/drivers/hub/3-0:1.0 delete mode 120000 test/sys/bus/usb/drivers/hub/4-0:1.0 delete mode 120000 test/sys/bus/usb/drivers/hub/5-0:1.0 delete mode 120000 test/sys/bus/usb/drivers/hub/module delete mode 120000 test/sys/bus/usb/drivers/usb-storage/5-1:1.0 delete mode 120000 test/sys/bus/usb/drivers/usb-storage/module delete mode 120000 test/sys/bus/usb/drivers/usb/3-1 delete mode 120000 test/sys/bus/usb/drivers/usb/4-1 delete mode 120000 test/sys/bus/usb/drivers/usb/4-2 delete mode 120000 test/sys/bus/usb/drivers/usb/5-1 delete mode 120000 test/sys/bus/usb/drivers/usb/5-2 delete mode 120000 test/sys/bus/usb/drivers/usb/module delete mode 120000 test/sys/bus/usb/drivers/usb/usb1 delete mode 120000 test/sys/bus/usb/drivers/usb/usb2 delete mode 120000 test/sys/bus/usb/drivers/usb/usb3 delete mode 120000 test/sys/bus/usb/drivers/usb/usb4 delete mode 120000 test/sys/bus/usb/drivers/usb/usb5 delete mode 120000 test/sys/bus/usb/drivers/usbfs/module delete mode 120000 test/sys/bus/usb/drivers/usbhid/3-1:1.0 delete mode 120000 test/sys/bus/usb/drivers/usbhid/module delete mode 100644 test/sys/bus/usb/drivers_autoprobe delete mode 120000 test/sys/class/bdi/0:16 delete mode 120000 test/sys/class/bdi/11:0 delete mode 120000 test/sys/class/bdi/7:0 delete mode 120000 test/sys/class/bdi/7:1 delete mode 120000 test/sys/class/bdi/7:2 delete mode 120000 test/sys/class/bdi/7:3 delete mode 120000 test/sys/class/bdi/7:4 delete mode 120000 test/sys/class/bdi/7:5 delete mode 120000 test/sys/class/bdi/7:6 delete mode 120000 test/sys/class/bdi/7:7 delete mode 120000 test/sys/class/bdi/8:0 delete mode 120000 test/sys/class/bdi/8:16 delete mode 120000 test/sys/class/bdi/9:0 delete mode 120000 test/sys/class/bdi/default delete mode 120000 test/sys/class/block/loop0 delete mode 120000 test/sys/class/block/loop1 delete mode 120000 test/sys/class/block/loop2 delete mode 120000 test/sys/class/block/loop3 delete mode 120000 test/sys/class/block/loop4 delete mode 120000 test/sys/class/block/loop5 delete mode 120000 test/sys/class/block/loop6 delete mode 120000 test/sys/class/block/loop7 delete mode 120000 test/sys/class/block/md0 delete mode 120000 test/sys/class/block/sda delete mode 120000 test/sys/class/block/sda1 delete mode 120000 test/sys/class/block/sda10 delete mode 120000 test/sys/class/block/sda5 delete mode 120000 test/sys/class/block/sda6 delete mode 120000 test/sys/class/block/sda7 delete mode 120000 test/sys/class/block/sda8 delete mode 120000 test/sys/class/block/sda9 delete mode 120000 test/sys/class/block/sdb delete mode 120000 test/sys/class/block/sdb1 delete mode 120000 test/sys/class/block/sr0 delete mode 120000 test/sys/class/bsg/0:0:0:0 delete mode 120000 test/sys/class/bsg/4:0:0:0 delete mode 120000 test/sys/class/bsg/7:0:0:0 delete mode 120000 test/sys/class/dmi/id delete mode 100644 test/sys/class/firmware/timeout delete mode 120000 test/sys/class/graphics/fb0 delete mode 120000 test/sys/class/graphics/fbcon delete mode 120000 test/sys/class/hwmon/hwmon0 delete mode 120000 test/sys/class/ieee80211/phy0 delete mode 120000 test/sys/class/input/event0 delete mode 120000 test/sys/class/input/event1 delete mode 120000 test/sys/class/input/event2 delete mode 120000 test/sys/class/input/event3 delete mode 120000 test/sys/class/input/event4 delete mode 120000 test/sys/class/input/event5 delete mode 120000 test/sys/class/input/event6 delete mode 120000 test/sys/class/input/event7 delete mode 120000 test/sys/class/input/input0 delete mode 120000 test/sys/class/input/input1 delete mode 120000 test/sys/class/input/input2 delete mode 120000 test/sys/class/input/input3 delete mode 120000 test/sys/class/input/input4 delete mode 120000 test/sys/class/input/input5 delete mode 120000 test/sys/class/input/input6 delete mode 120000 test/sys/class/input/input8 delete mode 120000 test/sys/class/input/mice delete mode 120000 test/sys/class/input/mouse0 delete mode 120000 test/sys/class/input/mouse1 delete mode 120000 test/sys/class/leds/iwl-phy0:RX delete mode 120000 test/sys/class/leds/iwl-phy0:TX delete mode 120000 test/sys/class/leds/iwl-phy0:assoc delete mode 120000 test/sys/class/leds/iwl-phy0:radio delete mode 120000 test/sys/class/leds/tpacpi::bay_active delete mode 120000 test/sys/class/leds/tpacpi::dock_active delete mode 120000 test/sys/class/leds/tpacpi::dock_batt delete mode 120000 test/sys/class/leds/tpacpi::power delete mode 120000 test/sys/class/leds/tpacpi::standby delete mode 120000 test/sys/class/leds/tpacpi::thinklight delete mode 120000 test/sys/class/leds/tpacpi::unknown_led delete mode 120000 test/sys/class/leds/tpacpi:green:batt delete mode 120000 test/sys/class/leds/tpacpi:orange:batt delete mode 120000 test/sys/class/mem/full delete mode 120000 test/sys/class/mem/kmem delete mode 120000 test/sys/class/mem/kmsg delete mode 120000 test/sys/class/mem/mem delete mode 120000 test/sys/class/mem/null delete mode 120000 test/sys/class/mem/port delete mode 120000 test/sys/class/mem/random delete mode 120000 test/sys/class/mem/urandom delete mode 120000 test/sys/class/mem/zero delete mode 120000 test/sys/class/misc/cpu_dma_latency delete mode 120000 test/sys/class/misc/device-mapper delete mode 120000 test/sys/class/misc/fuse delete mode 120000 test/sys/class/misc/hpet delete mode 120000 test/sys/class/misc/mcelog delete mode 120000 test/sys/class/misc/microcode delete mode 120000 test/sys/class/misc/network_latency delete mode 120000 test/sys/class/misc/network_throughput delete mode 120000 test/sys/class/misc/nvram delete mode 120000 test/sys/class/misc/psaux delete mode 120000 test/sys/class/misc/uinput delete mode 120000 test/sys/class/net/eth0 delete mode 120000 test/sys/class/net/lo delete mode 120000 test/sys/class/net/wlan0 delete mode 120000 test/sys/class/net/wmaster0 delete mode 120000 test/sys/class/pci_bus/0000:00 delete mode 120000 test/sys/class/pci_bus/0000:01 delete mode 120000 test/sys/class/pci_bus/0000:02 delete mode 120000 test/sys/class/pci_bus/0000:03 delete mode 120000 test/sys/class/pci_bus/0000:04 delete mode 120000 test/sys/class/pci_bus/0000:0c delete mode 120000 test/sys/class/pci_bus/0000:15 delete mode 120000 test/sys/class/pci_bus/0000:16 delete mode 120000 test/sys/class/pcmcia_socket/pcmcia_socket0 delete mode 120000 test/sys/class/power_supply/AC delete mode 120000 test/sys/class/power_supply/BAT0 delete mode 120000 test/sys/class/rfkill/rfkill0 delete mode 120000 test/sys/class/rtc/rtc0 delete mode 120000 test/sys/class/scsi_device/0:0:0:0 delete mode 120000 test/sys/class/scsi_device/4:0:0:0 delete mode 120000 test/sys/class/scsi_device/7:0:0:0 delete mode 120000 test/sys/class/scsi_disk/0:0:0:0 delete mode 120000 test/sys/class/scsi_disk/7:0:0:0 delete mode 120000 test/sys/class/scsi_generic/sg0 delete mode 120000 test/sys/class/scsi_generic/sg1 delete mode 120000 test/sys/class/scsi_generic/sg2 delete mode 120000 test/sys/class/scsi_host/host0 delete mode 120000 test/sys/class/scsi_host/host1 delete mode 120000 test/sys/class/scsi_host/host2 delete mode 120000 test/sys/class/scsi_host/host3 delete mode 120000 test/sys/class/scsi_host/host4 delete mode 120000 test/sys/class/scsi_host/host5 delete mode 120000 test/sys/class/scsi_host/host7 delete mode 120000 test/sys/class/sound/adsp delete mode 120000 test/sys/class/sound/audio delete mode 120000 test/sys/class/sound/card0 delete mode 120000 test/sys/class/sound/controlC0 delete mode 120000 test/sys/class/sound/dsp delete mode 120000 test/sys/class/sound/mixer delete mode 120000 test/sys/class/sound/pcmC0D0c delete mode 120000 test/sys/class/sound/pcmC0D0p delete mode 120000 test/sys/class/sound/pcmC0D1p delete mode 120000 test/sys/class/sound/seq delete mode 120000 test/sys/class/sound/timer delete mode 120000 test/sys/class/thermal/cooling_device0 delete mode 120000 test/sys/class/thermal/cooling_device1 delete mode 120000 test/sys/class/thermal/thermal_zone0 delete mode 120000 test/sys/class/thermal/thermal_zone1 delete mode 120000 test/sys/class/tty/console delete mode 120000 test/sys/class/tty/ptmx delete mode 120000 test/sys/class/tty/tty delete mode 120000 test/sys/class/tty/tty0 delete mode 120000 test/sys/class/tty/tty1 delete mode 120000 test/sys/class/tty/tty10 delete mode 120000 test/sys/class/tty/tty11 delete mode 120000 test/sys/class/tty/tty12 delete mode 120000 test/sys/class/tty/tty13 delete mode 120000 test/sys/class/tty/tty14 delete mode 120000 test/sys/class/tty/tty15 delete mode 120000 test/sys/class/tty/tty16 delete mode 120000 test/sys/class/tty/tty17 delete mode 120000 test/sys/class/tty/tty18 delete mode 120000 test/sys/class/tty/tty19 delete mode 120000 test/sys/class/tty/tty2 delete mode 120000 test/sys/class/tty/tty20 delete mode 120000 test/sys/class/tty/tty21 delete mode 120000 test/sys/class/tty/tty22 delete mode 120000 test/sys/class/tty/tty23 delete mode 120000 test/sys/class/tty/tty24 delete mode 120000 test/sys/class/tty/tty25 delete mode 120000 test/sys/class/tty/tty26 delete mode 120000 test/sys/class/tty/tty27 delete mode 120000 test/sys/class/tty/tty28 delete mode 120000 test/sys/class/tty/tty29 delete mode 120000 test/sys/class/tty/tty3 delete mode 120000 test/sys/class/tty/tty30 delete mode 120000 test/sys/class/tty/tty31 delete mode 120000 test/sys/class/tty/tty32 delete mode 120000 test/sys/class/tty/tty33 delete mode 120000 test/sys/class/tty/tty34 delete mode 120000 test/sys/class/tty/tty35 delete mode 120000 test/sys/class/tty/tty36 delete mode 120000 test/sys/class/tty/tty37 delete mode 120000 test/sys/class/tty/tty38 delete mode 120000 test/sys/class/tty/tty39 delete mode 120000 test/sys/class/tty/tty4 delete mode 120000 test/sys/class/tty/tty40 delete mode 120000 test/sys/class/tty/tty41 delete mode 120000 test/sys/class/tty/tty42 delete mode 120000 test/sys/class/tty/tty43 delete mode 120000 test/sys/class/tty/tty44 delete mode 120000 test/sys/class/tty/tty45 delete mode 120000 test/sys/class/tty/tty46 delete mode 120000 test/sys/class/tty/tty47 delete mode 120000 test/sys/class/tty/tty48 delete mode 120000 test/sys/class/tty/tty49 delete mode 120000 test/sys/class/tty/tty5 delete mode 120000 test/sys/class/tty/tty50 delete mode 120000 test/sys/class/tty/tty51 delete mode 120000 test/sys/class/tty/tty52 delete mode 120000 test/sys/class/tty/tty53 delete mode 120000 test/sys/class/tty/tty54 delete mode 120000 test/sys/class/tty/tty55 delete mode 120000 test/sys/class/tty/tty56 delete mode 120000 test/sys/class/tty/tty57 delete mode 120000 test/sys/class/tty/tty58 delete mode 120000 test/sys/class/tty/tty59 delete mode 120000 test/sys/class/tty/tty6 delete mode 120000 test/sys/class/tty/tty60 delete mode 120000 test/sys/class/tty/tty61 delete mode 120000 test/sys/class/tty/tty62 delete mode 120000 test/sys/class/tty/tty63 delete mode 120000 test/sys/class/tty/tty7 delete mode 120000 test/sys/class/tty/tty8 delete mode 120000 test/sys/class/tty/tty9 delete mode 120000 test/sys/class/tty/ttyACM0 delete mode 120000 test/sys/class/tty/ttyS0 delete mode 120000 test/sys/class/tty/ttyS1 delete mode 120000 test/sys/class/tty/ttyS2 delete mode 120000 test/sys/class/tty/ttyS3 delete mode 120000 test/sys/class/usb_endpoint/usbdev1.1_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev1.1_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev2.1_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev2.1_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev3.1_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev3.1_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev3.4_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev3.4_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.1_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.1_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep02 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep03 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep04 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep82 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep83 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.2_ep84 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.3_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.3_ep02 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.3_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev4.3_ep83 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.1_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.1_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.7_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.7_ep02 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.7_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep00 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep01 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep02 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep81 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep82 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep83 delete mode 120000 test/sys/class/usb_endpoint/usbdev5.9_ep84 delete mode 120000 test/sys/class/usb_host/usb_host1 delete mode 120000 test/sys/class/usb_host/usb_host2 delete mode 120000 test/sys/class/usb_host/usb_host3 delete mode 120000 test/sys/class/usb_host/usb_host4 delete mode 120000 test/sys/class/usb_host/usb_host5 delete mode 120000 test/sys/class/vc/vcs delete mode 120000 test/sys/class/vc/vcs1 delete mode 120000 test/sys/class/vc/vcs10 delete mode 120000 test/sys/class/vc/vcs2 delete mode 120000 test/sys/class/vc/vcs3 delete mode 120000 test/sys/class/vc/vcs4 delete mode 120000 test/sys/class/vc/vcs5 delete mode 120000 test/sys/class/vc/vcs6 delete mode 120000 test/sys/class/vc/vcs7 delete mode 120000 test/sys/class/vc/vcsa delete mode 120000 test/sys/class/vc/vcsa1 delete mode 120000 test/sys/class/vc/vcsa10 delete mode 120000 test/sys/class/vc/vcsa2 delete mode 120000 test/sys/class/vc/vcsa3 delete mode 120000 test/sys/class/vc/vcsa4 delete mode 120000 test/sys/class/vc/vcsa5 delete mode 120000 test/sys/class/vc/vcsa6 delete mode 120000 test/sys/class/vc/vcsa7 delete mode 120000 test/sys/class/vtconsole/vtcon0 delete mode 120000 test/sys/class/vtconsole/vtcon1 delete mode 120000 test/sys/dev/block/11:0 delete mode 120000 test/sys/dev/block/7:0 delete mode 120000 test/sys/dev/block/7:1 delete mode 120000 test/sys/dev/block/7:2 delete mode 120000 test/sys/dev/block/7:3 delete mode 120000 test/sys/dev/block/7:4 delete mode 120000 test/sys/dev/block/7:5 delete mode 120000 test/sys/dev/block/7:6 delete mode 120000 test/sys/dev/block/7:7 delete mode 120000 test/sys/dev/block/8:0 delete mode 120000 test/sys/dev/block/8:1 delete mode 120000 test/sys/dev/block/8:10 delete mode 120000 test/sys/dev/block/8:16 delete mode 120000 test/sys/dev/block/8:17 delete mode 120000 test/sys/dev/block/8:5 delete mode 120000 test/sys/dev/block/8:6 delete mode 120000 test/sys/dev/block/8:7 delete mode 120000 test/sys/dev/block/8:8 delete mode 120000 test/sys/dev/block/8:9 delete mode 120000 test/sys/dev/block/9:0 delete mode 120000 test/sys/dev/char/10:1 delete mode 120000 test/sys/dev/char/10:144 delete mode 120000 test/sys/dev/char/10:184 delete mode 120000 test/sys/dev/char/10:223 delete mode 120000 test/sys/dev/char/10:227 delete mode 120000 test/sys/dev/char/10:228 delete mode 120000 test/sys/dev/char/10:229 delete mode 120000 test/sys/dev/char/10:60 delete mode 120000 test/sys/dev/char/10:61 delete mode 120000 test/sys/dev/char/10:62 delete mode 120000 test/sys/dev/char/10:63 delete mode 120000 test/sys/dev/char/116:0 delete mode 120000 test/sys/dev/char/116:1 delete mode 120000 test/sys/dev/char/116:16 delete mode 120000 test/sys/dev/char/116:17 delete mode 120000 test/sys/dev/char/116:24 delete mode 120000 test/sys/dev/char/116:33 delete mode 120000 test/sys/dev/char/13:32 delete mode 120000 test/sys/dev/char/13:33 delete mode 120000 test/sys/dev/char/13:63 delete mode 120000 test/sys/dev/char/13:64 delete mode 120000 test/sys/dev/char/13:65 delete mode 120000 test/sys/dev/char/13:66 delete mode 120000 test/sys/dev/char/13:67 delete mode 120000 test/sys/dev/char/13:68 delete mode 120000 test/sys/dev/char/13:69 delete mode 120000 test/sys/dev/char/13:70 delete mode 120000 test/sys/dev/char/13:71 delete mode 120000 test/sys/dev/char/14:0 delete mode 120000 test/sys/dev/char/14:12 delete mode 120000 test/sys/dev/char/14:3 delete mode 120000 test/sys/dev/char/14:4 delete mode 120000 test/sys/dev/char/166:0 delete mode 120000 test/sys/dev/char/189:0 delete mode 120000 test/sys/dev/char/189:128 delete mode 120000 test/sys/dev/char/189:256 delete mode 120000 test/sys/dev/char/189:259 delete mode 120000 test/sys/dev/char/189:384 delete mode 120000 test/sys/dev/char/189:385 delete mode 120000 test/sys/dev/char/189:386 delete mode 120000 test/sys/dev/char/189:512 delete mode 120000 test/sys/dev/char/189:518 delete mode 120000 test/sys/dev/char/189:520 delete mode 120000 test/sys/dev/char/1:1 delete mode 120000 test/sys/dev/char/1:11 delete mode 120000 test/sys/dev/char/1:2 delete mode 120000 test/sys/dev/char/1:3 delete mode 120000 test/sys/dev/char/1:4 delete mode 120000 test/sys/dev/char/1:5 delete mode 120000 test/sys/dev/char/1:7 delete mode 120000 test/sys/dev/char/1:8 delete mode 120000 test/sys/dev/char/1:9 delete mode 120000 test/sys/dev/char/21:0 delete mode 120000 test/sys/dev/char/21:1 delete mode 120000 test/sys/dev/char/21:2 delete mode 120000 test/sys/dev/char/252:0 delete mode 120000 test/sys/dev/char/252:1 delete mode 120000 test/sys/dev/char/252:10 delete mode 120000 test/sys/dev/char/252:11 delete mode 120000 test/sys/dev/char/252:12 delete mode 120000 test/sys/dev/char/252:13 delete mode 120000 test/sys/dev/char/252:14 delete mode 120000 test/sys/dev/char/252:15 delete mode 120000 test/sys/dev/char/252:16 delete mode 120000 test/sys/dev/char/252:17 delete mode 120000 test/sys/dev/char/252:18 delete mode 120000 test/sys/dev/char/252:19 delete mode 120000 test/sys/dev/char/252:2 delete mode 120000 test/sys/dev/char/252:20 delete mode 120000 test/sys/dev/char/252:21 delete mode 120000 test/sys/dev/char/252:22 delete mode 120000 test/sys/dev/char/252:23 delete mode 120000 test/sys/dev/char/252:24 delete mode 120000 test/sys/dev/char/252:25 delete mode 120000 test/sys/dev/char/252:26 delete mode 120000 test/sys/dev/char/252:27 delete mode 120000 test/sys/dev/char/252:28 delete mode 120000 test/sys/dev/char/252:29 delete mode 120000 test/sys/dev/char/252:3 delete mode 120000 test/sys/dev/char/252:30 delete mode 120000 test/sys/dev/char/252:31 delete mode 120000 test/sys/dev/char/252:32 delete mode 120000 test/sys/dev/char/252:33 delete mode 120000 test/sys/dev/char/252:4 delete mode 120000 test/sys/dev/char/252:5 delete mode 120000 test/sys/dev/char/252:6 delete mode 120000 test/sys/dev/char/252:7 delete mode 120000 test/sys/dev/char/252:8 delete mode 120000 test/sys/dev/char/252:9 delete mode 120000 test/sys/dev/char/253:0 delete mode 120000 test/sys/dev/char/254:0 delete mode 120000 test/sys/dev/char/254:1 delete mode 120000 test/sys/dev/char/254:2 delete mode 120000 test/sys/dev/char/29:0 delete mode 120000 test/sys/dev/char/4:0 delete mode 120000 test/sys/dev/char/4:1 delete mode 120000 test/sys/dev/char/4:10 delete mode 120000 test/sys/dev/char/4:11 delete mode 120000 test/sys/dev/char/4:12 delete mode 120000 test/sys/dev/char/4:13 delete mode 120000 test/sys/dev/char/4:14 delete mode 120000 test/sys/dev/char/4:15 delete mode 120000 test/sys/dev/char/4:16 delete mode 120000 test/sys/dev/char/4:17 delete mode 120000 test/sys/dev/char/4:18 delete mode 120000 test/sys/dev/char/4:19 delete mode 120000 test/sys/dev/char/4:2 delete mode 120000 test/sys/dev/char/4:20 delete mode 120000 test/sys/dev/char/4:21 delete mode 120000 test/sys/dev/char/4:22 delete mode 120000 test/sys/dev/char/4:23 delete mode 120000 test/sys/dev/char/4:24 delete mode 120000 test/sys/dev/char/4:25 delete mode 120000 test/sys/dev/char/4:26 delete mode 120000 test/sys/dev/char/4:27 delete mode 120000 test/sys/dev/char/4:28 delete mode 120000 test/sys/dev/char/4:29 delete mode 120000 test/sys/dev/char/4:3 delete mode 120000 test/sys/dev/char/4:30 delete mode 120000 test/sys/dev/char/4:31 delete mode 120000 test/sys/dev/char/4:32 delete mode 120000 test/sys/dev/char/4:33 delete mode 120000 test/sys/dev/char/4:34 delete mode 120000 test/sys/dev/char/4:35 delete mode 120000 test/sys/dev/char/4:36 delete mode 120000 test/sys/dev/char/4:37 delete mode 120000 test/sys/dev/char/4:38 delete mode 120000 test/sys/dev/char/4:39 delete mode 120000 test/sys/dev/char/4:4 delete mode 120000 test/sys/dev/char/4:40 delete mode 120000 test/sys/dev/char/4:41 delete mode 120000 test/sys/dev/char/4:42 delete mode 120000 test/sys/dev/char/4:43 delete mode 120000 test/sys/dev/char/4:44 delete mode 120000 test/sys/dev/char/4:45 delete mode 120000 test/sys/dev/char/4:46 delete mode 120000 test/sys/dev/char/4:47 delete mode 120000 test/sys/dev/char/4:48 delete mode 120000 test/sys/dev/char/4:49 delete mode 120000 test/sys/dev/char/4:5 delete mode 120000 test/sys/dev/char/4:50 delete mode 120000 test/sys/dev/char/4:51 delete mode 120000 test/sys/dev/char/4:52 delete mode 120000 test/sys/dev/char/4:53 delete mode 120000 test/sys/dev/char/4:54 delete mode 120000 test/sys/dev/char/4:55 delete mode 120000 test/sys/dev/char/4:56 delete mode 120000 test/sys/dev/char/4:57 delete mode 120000 test/sys/dev/char/4:58 delete mode 120000 test/sys/dev/char/4:59 delete mode 120000 test/sys/dev/char/4:6 delete mode 120000 test/sys/dev/char/4:60 delete mode 120000 test/sys/dev/char/4:61 delete mode 120000 test/sys/dev/char/4:62 delete mode 120000 test/sys/dev/char/4:63 delete mode 120000 test/sys/dev/char/4:64 delete mode 120000 test/sys/dev/char/4:65 delete mode 120000 test/sys/dev/char/4:66 delete mode 120000 test/sys/dev/char/4:67 delete mode 120000 test/sys/dev/char/4:7 delete mode 120000 test/sys/dev/char/4:8 delete mode 120000 test/sys/dev/char/4:9 delete mode 120000 test/sys/dev/char/5:0 delete mode 120000 test/sys/dev/char/5:1 delete mode 120000 test/sys/dev/char/5:2 delete mode 120000 test/sys/dev/char/7:0 delete mode 120000 test/sys/dev/char/7:1 delete mode 120000 test/sys/dev/char/7:10 delete mode 120000 test/sys/dev/char/7:128 delete mode 120000 test/sys/dev/char/7:129 delete mode 120000 test/sys/dev/char/7:130 delete mode 120000 test/sys/dev/char/7:131 delete mode 120000 test/sys/dev/char/7:132 delete mode 120000 test/sys/dev/char/7:133 delete mode 120000 test/sys/dev/char/7:134 delete mode 120000 test/sys/dev/char/7:135 delete mode 120000 test/sys/dev/char/7:138 delete mode 120000 test/sys/dev/char/7:2 delete mode 120000 test/sys/dev/char/7:3 delete mode 120000 test/sys/dev/char/7:4 delete mode 120000 test/sys/dev/char/7:5 delete mode 120000 test/sys/dev/char/7:6 delete mode 120000 test/sys/dev/char/7:7 delete mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem delete mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev delete mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:00/thermal_cooling delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/path delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem delete mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev delete mode 120000 test/sys/devices/LNXSYSTM:00/ACPI0007:01/thermal_cooling delete mode 100644 test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/abs delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ev delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ff delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/key delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/led delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/msc delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/rel delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/snd delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/sw delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/device delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/dev delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/device delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/bustype delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/product delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/version delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/name delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/phys delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/thermal_zone delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/thermal_zone delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/device delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/type delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power/wakeup delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full_design delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/manufacturer delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/model_name delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/wakeup delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/present delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/serial_number delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/technology delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/path delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/physical_node delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/abs delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ev delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ff delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/key delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/led delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/msc delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/rel delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/snd delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/sw delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/device delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/dev delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/device delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/bustype delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/product delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/vendor delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/version delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/name delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/phys delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uniq delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/abs delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ev delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ff delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/key delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/led delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/msc delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/rel delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/snd delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/sw delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/device delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/dev delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/device delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/bustype delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/product delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/vendor delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/version delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/name delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/phys delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uniq delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/uevent delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/driver delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/device:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/device:00/uevent delete mode 100644 test/sys/devices/LNXSYSTM:00/hid delete mode 100644 test/sys/devices/LNXSYSTM:00/modalias delete mode 100644 test/sys/devices/LNXSYSTM:00/path delete mode 100644 test/sys/devices/LNXSYSTM:00/power/wakeup delete mode 120000 test/sys/devices/LNXSYSTM:00/subsystem delete mode 100644 test/sys/devices/LNXSYSTM:00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/enable delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:00.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:00.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0_wc delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource1 delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource2 delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom delete mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/cpuaffinity delete mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:01.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:01.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/resource0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/uevent delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/uevent delete mode 120000 test/sys/devices/pci0000:00/0000:00:1b.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1b.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/enable delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/addr_len delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/address delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/broadcast delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/carrier delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dev_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dormant delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/features delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/flags delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/ifindex delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/iflink delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/link_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/mtu delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/operstate delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/collisions delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/multicast delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_bytes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_compressed delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_crc_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_dropped delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_fifo_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_frame_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_length_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_missed_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_over_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_packets delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_aborted_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_bytes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_carrier_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_compressed delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_dropped delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_fifo_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_heartbeat_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_packets delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_window_errors delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/tx_queue_len delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource2 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/cpuaffinity delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/antenna delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/channels delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/enable delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/filter_flags delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/flags delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/macaddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/brightness delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/trigger delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/brightness delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/trigger delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/brightness delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/trigger delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/brightness delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/trigger delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/measurement delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/address delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/carrier delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dormant delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/features delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/flags delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/iflink delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/mtu delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/operstate delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/collisions delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/multicast delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_compressed delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_crc_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_dropped delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_fifo_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_frame_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_length_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_missed_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_over_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_aborted_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_carrier_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_compressed delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_dropped delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_fifo_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_heartbeat_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_window_errors delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/tx_queue_len delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/beacon delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/crypt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/fragment delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/misc delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/nwid delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/retries delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/addr_len delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/address delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/broadcast delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/features delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/flags delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/link_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/operstate delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/phy80211 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/collisions delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/multicast delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_bytes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_compressed delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_crc_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_dropped delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_fifo_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_frame_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_length_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_missed_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_over_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_packets delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_aborted_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_bytes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_carrier_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_compressed delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_dropped delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_fifo_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_heartbeat_errors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_packets delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_window_errors delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/tx_queue_len delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power_level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/retry_rate delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/status delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/cpuaffinity delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.1/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/cpuaffinity delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.2/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/cpuaffinity delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:1c.3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1c.3/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/pools delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/resource4 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized_default delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/serial delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb1/version delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/pools delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/resource4 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized_default delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/serial delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb2/version delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.1/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/pools delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/resource4 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/abs delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ff delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/key delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/led delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/msc delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/rel delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/snd delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/sw delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/bustype delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/version delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/name delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/phys delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uniq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/persist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/version delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized_default delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/serial delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb3/version delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.2/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/pools delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/resource4 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/persist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/version delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/persist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/version delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized_default delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/serial delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb4/version delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.3/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/pools delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/resource0 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/active_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/can_queue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/host_busy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/proc_name delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_capabilities delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_guard_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/supported_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unchecked_isa_dma delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unique_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/bdi delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/capability delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/hw_sector_size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_max delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_penalty delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_async delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_sync delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/quantum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async_rq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_idle delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_sync delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_hw_sectors_kb delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_sectors_kb delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nomerges delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nr_requests delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/read_ahead_kb delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/scheduler delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/range delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/removable delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/device_blocked delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/evt_media_change delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iocounterbits delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iorequest_cnt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/allow_restart delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/app_tag_own delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/cache_type delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/protection_type delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/persist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/version delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/interface delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/interface delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/interface delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/interface delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/interface delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/interface delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/interface delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bAlternateSetting delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/persist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/serial delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/version delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized_default delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bConfigurationValue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumConfigurations delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumInterfaces delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/busnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/configuration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/descriptors delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/devnum delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/driver delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idProduct delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idVendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/manufacturer delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/maxchild delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/active_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/autosuspend delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/connected_duration delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/product delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/quirks delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/serial delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/speed delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/urbnum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bEndpointAddress delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bInterval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bLength delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/direction delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/interval delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/wMaxPacketSize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb5/version delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/companion delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1d.7/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/cpuaffinity delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_io delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_mem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_setup_done delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_irq_mask delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_pm_state delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vcc delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_voltage delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vpp delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/cis delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource0 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/yenta_registers delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/cpuaffinity delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:1e.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1e.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.0/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/resource delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/active_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/can_queue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/host_busy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/proc_name delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_capabilities delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_guard_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/sg_tablesize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/supported_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unchecked_isa_dma delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unique_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/bdi delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/capability delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/hw_sector_size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_max delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_penalty delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_async delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_sync delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/quantum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async_rq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_idle delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_sync delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_hw_sectors_kb delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_sectors_kb delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nomerges delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nr_requests delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/read_ahead_kb delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/scheduler delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/range delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/removable delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/ro delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/device_blocked delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/evt_media_change delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iocounterbits delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/ioerr_cnt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/model delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_depth delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host4/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/active_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/can_queue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/host_busy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/proc_name delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_capabilities delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_guard_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/sg_tablesize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/supported_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unchecked_isa_dma delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unique_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/host5/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/host5/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource1 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource2 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource3 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/resource4 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.1/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/device delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/active_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/can_queue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/host_busy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/proc_name delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_capabilities delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_guard_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/sg_tablesize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/supported_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unchecked_isa_dma delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unique_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/subsystem delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/bdi delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/capability delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/bsg delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/hw_sector_size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_max delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_penalty delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_async delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_sync delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/quantum delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async_rq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_idle delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_sync delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_hw_sectors_kb delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_sectors_kb delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nomerges delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nr_requests delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/read_ahead_kb delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/scheduler delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/range delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/removable delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/ro delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/start delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/start delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/start delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/start delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/start delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/dev delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/start delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/make-it-fail delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/start delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/size delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test:colon+plus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/device_blocked delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/evt_media_change delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iocounterbits delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/model delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_depth delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/allow_restart delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/app_tag_own delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/cache_type delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/protection_type delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_level delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/sw_activity delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/whitespace_test delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host0/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/active_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/can_queue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/host_busy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/link_power_management_policy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/proc_name delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_capabilities delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_guard_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/sg_tablesize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/supported_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unchecked_isa_dma delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unique_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host1/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host1/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/active_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/can_queue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/host_busy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/link_power_management_policy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/proc_name delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_capabilities delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_guard_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/sg_tablesize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/supported_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unchecked_isa_dma delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unique_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/active_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/can_queue delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/host_busy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/link_power_management_policy delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/proc_name delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_capabilities delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_guard_type delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/sg_tablesize delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/state delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/supported_mode delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unchecked_isa_dma delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unique_id delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/host3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/host3/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource0 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource1 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource2 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource3 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource4 delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/resource5 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.2/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.2/vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/broken_parity_status delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/class delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/config delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/enable delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.3/firmware_node delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/irq delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/local_cpulist delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/local_cpus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/modalias delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/msi_bus delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/resource delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/resource4 delete mode 120000 test/sys/devices/pci0000:00/0000:00:1f.3/subsystem delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_device delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_vendor delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/uevent delete mode 100644 test/sys/devices/pci0000:00/0000:00:1f.3/vendor delete mode 120000 test/sys/devices/pci0000:00/firmware_node delete mode 100644 test/sys/devices/pci0000:00/pci_bus/0000:00/cpuaffinity delete mode 120000 test/sys/devices/pci0000:00/pci_bus/0000:00/device delete mode 100644 test/sys/devices/pci0000:00/pci_bus/0000:00/power/wakeup delete mode 120000 test/sys/devices/pci0000:00/pci_bus/0000:00/subsystem delete mode 100644 test/sys/devices/pci0000:00/pci_bus/0000:00/uevent delete mode 100644 test/sys/devices/pci0000:00/power/wakeup delete mode 100644 test/sys/devices/pci0000:00/uevent delete mode 100644 test/sys/devices/platform/dock.0/docked delete mode 100644 test/sys/devices/platform/dock.0/flags delete mode 100644 test/sys/devices/platform/dock.0/modalias delete mode 100644 test/sys/devices/platform/dock.0/power/wakeup delete mode 120000 test/sys/devices/platform/dock.0/subsystem delete mode 100644 test/sys/devices/platform/dock.0/uevent delete mode 100644 test/sys/devices/platform/dock.0/uid delete mode 120000 test/sys/devices/platform/i8042/driver delete mode 100644 test/sys/devices/platform/i8042/modalias delete mode 100644 test/sys/devices/platform/i8042/power/wakeup delete mode 100644 test/sys/devices/platform/i8042/serio0/bind_mode delete mode 100644 test/sys/devices/platform/i8042/serio0/description delete mode 120000 test/sys/devices/platform/i8042/serio0/driver delete mode 100644 test/sys/devices/platform/i8042/serio0/err_count delete mode 100644 test/sys/devices/platform/i8042/serio0/extra delete mode 100644 test/sys/devices/platform/i8042/serio0/id/extra delete mode 100644 test/sys/devices/platform/i8042/serio0/id/id delete mode 100644 test/sys/devices/platform/i8042/serio0/id/proto delete mode 100644 test/sys/devices/platform/i8042/serio0/id/type delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/abs delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ev delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ff delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/key delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/led delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/msc delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/rel delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/snd delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/capabilities/sw delete mode 120000 test/sys/devices/platform/i8042/serio0/input/input0/device delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/event0/dev delete mode 120000 test/sys/devices/platform/i8042/serio0/input/input0/event0/device delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/event0/power/wakeup delete mode 120000 test/sys/devices/platform/i8042/serio0/input/input0/event0/subsystem delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/event0/uevent delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/id/bustype delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/id/product delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/id/vendor delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/id/version delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/modalias delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/name delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/phys delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/power/wakeup delete mode 120000 test/sys/devices/platform/i8042/serio0/input/input0/subsystem delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/uevent delete mode 100644 test/sys/devices/platform/i8042/serio0/input/input0/uniq delete mode 100644 test/sys/devices/platform/i8042/serio0/modalias delete mode 100644 test/sys/devices/platform/i8042/serio0/power/wakeup delete mode 100644 test/sys/devices/platform/i8042/serio0/scroll delete mode 100644 test/sys/devices/platform/i8042/serio0/set delete mode 100644 test/sys/devices/platform/i8042/serio0/softraw delete mode 100644 test/sys/devices/platform/i8042/serio0/softrepeat delete mode 120000 test/sys/devices/platform/i8042/serio0/subsystem delete mode 100644 test/sys/devices/platform/i8042/serio0/uevent delete mode 100644 test/sys/devices/platform/i8042/serio1/bind_mode delete mode 100644 test/sys/devices/platform/i8042/serio1/description delete mode 100644 test/sys/devices/platform/i8042/serio1/draghys delete mode 120000 test/sys/devices/platform/i8042/serio1/driver delete mode 100644 test/sys/devices/platform/i8042/serio1/ext_dev delete mode 100644 test/sys/devices/platform/i8042/serio1/id/extra delete mode 100644 test/sys/devices/platform/i8042/serio1/id/id delete mode 100644 test/sys/devices/platform/i8042/serio1/id/proto delete mode 100644 test/sys/devices/platform/i8042/serio1/id/type delete mode 100644 test/sys/devices/platform/i8042/serio1/inertia delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/abs delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ev delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ff delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/key delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/led delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/msc delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/rel delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/snd delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/capabilities/sw delete mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/device delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/event1/dev delete mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/event1/device delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/event1/power/wakeup delete mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/event1/subsystem delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/event1/uevent delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/id/bustype delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/id/product delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/id/vendor delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/id/version delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/modalias delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/dev delete mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/device delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/power/wakeup delete mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/subsystem delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/mouse0/uevent delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/name delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/phys delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/power/wakeup delete mode 120000 test/sys/devices/platform/i8042/serio1/input/input1/subsystem delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/uevent delete mode 100644 test/sys/devices/platform/i8042/serio1/input/input1/uniq delete mode 100644 test/sys/devices/platform/i8042/serio1/jenks delete mode 100644 test/sys/devices/platform/i8042/serio1/mindrag delete mode 100644 test/sys/devices/platform/i8042/serio1/modalias delete mode 100644 test/sys/devices/platform/i8042/serio1/power/wakeup delete mode 100644 test/sys/devices/platform/i8042/serio1/press_to_select delete mode 100644 test/sys/devices/platform/i8042/serio1/protocol delete mode 100644 test/sys/devices/platform/i8042/serio1/rate delete mode 100644 test/sys/devices/platform/i8042/serio1/reach delete mode 100644 test/sys/devices/platform/i8042/serio1/resetafter delete mode 100644 test/sys/devices/platform/i8042/serio1/resolution delete mode 100644 test/sys/devices/platform/i8042/serio1/resync_time delete mode 100644 test/sys/devices/platform/i8042/serio1/sensitivity delete mode 100644 test/sys/devices/platform/i8042/serio1/skipback delete mode 100644 test/sys/devices/platform/i8042/serio1/speed delete mode 120000 test/sys/devices/platform/i8042/serio1/subsystem delete mode 100644 test/sys/devices/platform/i8042/serio1/thresh delete mode 100644 test/sys/devices/platform/i8042/serio1/uevent delete mode 100644 test/sys/devices/platform/i8042/serio1/upthresh delete mode 100644 test/sys/devices/platform/i8042/serio1/ztime delete mode 120000 test/sys/devices/platform/i8042/subsystem delete mode 100644 test/sys/devices/platform/i8042/uevent delete mode 100644 test/sys/devices/platform/microcode/modalias delete mode 100644 test/sys/devices/platform/microcode/power/wakeup delete mode 120000 test/sys/devices/platform/microcode/subsystem delete mode 100644 test/sys/devices/platform/microcode/uevent delete mode 120000 test/sys/devices/platform/pcspkr/driver delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/abs delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/ev delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/ff delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/key delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/led delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/msc delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/rel delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/snd delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/capabilities/sw delete mode 120000 test/sys/devices/platform/pcspkr/input/input2/device delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/event2/dev delete mode 120000 test/sys/devices/platform/pcspkr/input/input2/event2/device delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/event2/power/wakeup delete mode 120000 test/sys/devices/platform/pcspkr/input/input2/event2/subsystem delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/event2/uevent delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/id/bustype delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/id/product delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/id/vendor delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/id/version delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/modalias delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/name delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/phys delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/power/wakeup delete mode 120000 test/sys/devices/platform/pcspkr/input/input2/subsystem delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/uevent delete mode 100644 test/sys/devices/platform/pcspkr/input/input2/uniq delete mode 100644 test/sys/devices/platform/pcspkr/modalias delete mode 100644 test/sys/devices/platform/pcspkr/power/wakeup delete mode 120000 test/sys/devices/platform/pcspkr/subsystem delete mode 100644 test/sys/devices/platform/pcspkr/uevent delete mode 100644 test/sys/devices/platform/power/wakeup delete mode 120000 test/sys/devices/platform/serial8250/driver delete mode 100644 test/sys/devices/platform/serial8250/modalias delete mode 100644 test/sys/devices/platform/serial8250/power/wakeup delete mode 120000 test/sys/devices/platform/serial8250/subsystem delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS0/dev delete mode 120000 test/sys/devices/platform/serial8250/tty/ttyS0/device delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS0/power/wakeup delete mode 120000 test/sys/devices/platform/serial8250/tty/ttyS0/subsystem delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS0/uevent delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS1/dev delete mode 120000 test/sys/devices/platform/serial8250/tty/ttyS1/device delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS1/power/wakeup delete mode 120000 test/sys/devices/platform/serial8250/tty/ttyS1/subsystem delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS1/uevent delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS2/dev delete mode 120000 test/sys/devices/platform/serial8250/tty/ttyS2/device delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS2/power/wakeup delete mode 120000 test/sys/devices/platform/serial8250/tty/ttyS2/subsystem delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS2/uevent delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS3/dev delete mode 120000 test/sys/devices/platform/serial8250/tty/ttyS3/device delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS3/power/wakeup delete mode 120000 test/sys/devices/platform/serial8250/tty/ttyS3/subsystem delete mode 100644 test/sys/devices/platform/serial8250/tty/ttyS3/uevent delete mode 100644 test/sys/devices/platform/serial8250/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/bluetooth_enable delete mode 120000 test/sys/devices/platform/thinkpad_acpi/driver delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_all_mask delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_bios_enabled delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_bios_mask delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_enable delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_mask delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_poll_freq delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_radio_sw delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_recommended_mask delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_report_mode delete mode 100644 test/sys/devices/platform/thinkpad_acpi/hotkey_source_mask delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/brightness delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/trigger delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/brightness delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/trigger delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/brightness delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/trigger delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/trigger delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/brightness delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/trigger delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/trigger delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/brightness delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/trigger delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/brightness delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/trigger delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/brightness delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/trigger delete mode 100644 test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/modalias delete mode 100644 test/sys/devices/platform/thinkpad_acpi/power/wakeup delete mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/claim delete mode 120000 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/device delete mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/name delete mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/power/wakeup delete mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state delete mode 120000 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/type delete mode 100644 test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/uevent delete mode 120000 test/sys/devices/platform/thinkpad_acpi/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_acpi/uevent delete mode 100644 test/sys/devices/platform/thinkpad_acpi/wakeup_hotunplug_complete delete mode 100644 test/sys/devices/platform/thinkpad_acpi/wakeup_reason delete mode 120000 test/sys/devices/platform/thinkpad_hwmon/driver delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/fan1_input delete mode 120000 test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/device delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/power/wakeup delete mode 120000 test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/uevent delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/modalias delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/name delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/power/wakeup delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/pwm1 delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/pwm1_enable delete mode 120000 test/sys/devices/platform/thinkpad_hwmon/subsystem delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp10_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp11_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp12_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp13_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp14_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp15_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp16_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp1_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp2_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp3_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp4_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp5_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp6_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp7_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp8_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/temp9_input delete mode 100644 test/sys/devices/platform/thinkpad_hwmon/uevent delete mode 100644 test/sys/devices/platform/uevent delete mode 120000 test/sys/devices/platform/vesafb.0/driver delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/bits_per_pixel delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/blank delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/console delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/cursor delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/dev delete mode 120000 test/sys/devices/platform/vesafb.0/graphics/fb0/device delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/mode delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/modes delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/name delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/pan delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/power/wakeup delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/rotate delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/state delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/stride delete mode 120000 test/sys/devices/platform/vesafb.0/graphics/fb0/subsystem delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/uevent delete mode 100644 test/sys/devices/platform/vesafb.0/graphics/fb0/virtual_size delete mode 100644 test/sys/devices/platform/vesafb.0/modalias delete mode 100644 test/sys/devices/platform/vesafb.0/power/wakeup delete mode 120000 test/sys/devices/platform/vesafb.0/subsystem delete mode 100644 test/sys/devices/platform/vesafb.0/uevent delete mode 120000 test/sys/devices/pnp0/00:00/driver delete mode 120000 test/sys/devices/pnp0/00:00/firmware_node delete mode 100644 test/sys/devices/pnp0/00:00/id delete mode 100644 test/sys/devices/pnp0/00:00/options delete mode 100644 test/sys/devices/pnp0/00:00/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:00/resources delete mode 120000 test/sys/devices/pnp0/00:00/subsystem delete mode 100644 test/sys/devices/pnp0/00:00/uevent delete mode 100644 test/sys/devices/pnp0/00:01/id delete mode 100644 test/sys/devices/pnp0/00:01/options delete mode 100644 test/sys/devices/pnp0/00:01/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:01/resources delete mode 120000 test/sys/devices/pnp0/00:01/subsystem delete mode 100644 test/sys/devices/pnp0/00:01/uevent delete mode 120000 test/sys/devices/pnp0/00:02/driver delete mode 120000 test/sys/devices/pnp0/00:02/firmware_node delete mode 100644 test/sys/devices/pnp0/00:02/id delete mode 100644 test/sys/devices/pnp0/00:02/options delete mode 100644 test/sys/devices/pnp0/00:02/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:02/resources delete mode 120000 test/sys/devices/pnp0/00:02/subsystem delete mode 100644 test/sys/devices/pnp0/00:02/uevent delete mode 120000 test/sys/devices/pnp0/00:03/firmware_node delete mode 100644 test/sys/devices/pnp0/00:03/id delete mode 100644 test/sys/devices/pnp0/00:03/options delete mode 100644 test/sys/devices/pnp0/00:03/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:03/resources delete mode 120000 test/sys/devices/pnp0/00:03/subsystem delete mode 100644 test/sys/devices/pnp0/00:03/uevent delete mode 120000 test/sys/devices/pnp0/00:04/firmware_node delete mode 100644 test/sys/devices/pnp0/00:04/id delete mode 100644 test/sys/devices/pnp0/00:04/options delete mode 100644 test/sys/devices/pnp0/00:04/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:04/resources delete mode 120000 test/sys/devices/pnp0/00:04/subsystem delete mode 100644 test/sys/devices/pnp0/00:04/uevent delete mode 120000 test/sys/devices/pnp0/00:05/firmware_node delete mode 100644 test/sys/devices/pnp0/00:05/id delete mode 100644 test/sys/devices/pnp0/00:05/options delete mode 100644 test/sys/devices/pnp0/00:05/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:05/resources delete mode 120000 test/sys/devices/pnp0/00:05/subsystem delete mode 100644 test/sys/devices/pnp0/00:05/uevent delete mode 120000 test/sys/devices/pnp0/00:06/firmware_node delete mode 100644 test/sys/devices/pnp0/00:06/id delete mode 100644 test/sys/devices/pnp0/00:06/options delete mode 100644 test/sys/devices/pnp0/00:06/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:06/resources delete mode 120000 test/sys/devices/pnp0/00:06/subsystem delete mode 100644 test/sys/devices/pnp0/00:06/uevent delete mode 120000 test/sys/devices/pnp0/00:07/driver delete mode 120000 test/sys/devices/pnp0/00:07/firmware_node delete mode 100644 test/sys/devices/pnp0/00:07/id delete mode 100644 test/sys/devices/pnp0/00:07/nvram delete mode 100644 test/sys/devices/pnp0/00:07/options delete mode 100644 test/sys/devices/pnp0/00:07/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:07/resources delete mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/date delete mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/dev delete mode 120000 test/sys/devices/pnp0/00:07/rtc/rtc0/device delete mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq delete mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/name delete mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch delete mode 120000 test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem delete mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/time delete mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/uevent delete mode 100644 test/sys/devices/pnp0/00:07/rtc/rtc0/wakealarm delete mode 120000 test/sys/devices/pnp0/00:07/subsystem delete mode 100644 test/sys/devices/pnp0/00:07/uevent delete mode 120000 test/sys/devices/pnp0/00:08/driver delete mode 120000 test/sys/devices/pnp0/00:08/firmware_node delete mode 100644 test/sys/devices/pnp0/00:08/id delete mode 100644 test/sys/devices/pnp0/00:08/options delete mode 100644 test/sys/devices/pnp0/00:08/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:08/resources delete mode 120000 test/sys/devices/pnp0/00:08/subsystem delete mode 100644 test/sys/devices/pnp0/00:08/uevent delete mode 120000 test/sys/devices/pnp0/00:09/driver delete mode 120000 test/sys/devices/pnp0/00:09/firmware_node delete mode 100644 test/sys/devices/pnp0/00:09/id delete mode 100644 test/sys/devices/pnp0/00:09/options delete mode 100644 test/sys/devices/pnp0/00:09/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:09/resources delete mode 120000 test/sys/devices/pnp0/00:09/subsystem delete mode 100644 test/sys/devices/pnp0/00:09/uevent delete mode 120000 test/sys/devices/pnp0/00:0a/firmware_node delete mode 100644 test/sys/devices/pnp0/00:0a/id delete mode 100644 test/sys/devices/pnp0/00:0a/options delete mode 100644 test/sys/devices/pnp0/00:0a/power/wakeup delete mode 100644 test/sys/devices/pnp0/00:0a/resources delete mode 120000 test/sys/devices/pnp0/00:0a/subsystem delete mode 100644 test/sys/devices/pnp0/00:0a/uevent delete mode 100644 test/sys/devices/pnp0/power/wakeup delete mode 100644 test/sys/devices/pnp0/uevent delete mode 100644 test/sys/devices/system/clocksource/clocksource0/available_clocksource delete mode 100644 test/sys/devices/system/clocksource/clocksource0/current_clocksource delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/level delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/number_of_sets delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/physical_line_partition delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/size delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/type delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index0/ways_of_associativity delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/level delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/number_of_sets delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/physical_line_partition delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/size delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/type delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index1/ways_of_associativity delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/level delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/number_of_sets delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/physical_line_partition delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/size delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/type delete mode 100644 test/sys/devices/system/cpu/cpu0/cache/index2/ways_of_associativity delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_min delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/related_cpus delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state delete mode 100644 test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/latency delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/name delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/power delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/time delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state0/usage delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/desc delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/latency delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/name delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/power delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/time delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/desc delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/latency delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/name delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/power delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/time delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/name delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/power delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/time delete mode 100644 test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage delete mode 100644 test/sys/devices/system/cpu/cpu0/crash_notes delete mode 100644 test/sys/devices/system/cpu/cpu0/microcode/processor_flags delete mode 100644 test/sys/devices/system/cpu/cpu0/microcode/version delete mode 100644 test/sys/devices/system/cpu/cpu0/thermal_throttle/count delete mode 100644 test/sys/devices/system/cpu/cpu0/topology/core_id delete mode 100644 test/sys/devices/system/cpu/cpu0/topology/core_siblings delete mode 100644 test/sys/devices/system/cpu/cpu0/topology/core_siblings_list delete mode 100644 test/sys/devices/system/cpu/cpu0/topology/physical_package_id delete mode 100644 test/sys/devices/system/cpu/cpu0/topology/thread_siblings delete mode 100644 test/sys/devices/system/cpu/cpu0/topology/thread_siblings_list delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/coherency_line_size delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/level delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/number_of_sets delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/physical_line_partition delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/size delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/type delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index0/ways_of_associativity delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/coherency_line_size delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/level delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/number_of_sets delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/physical_line_partition delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/size delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/type delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index1/ways_of_associativity delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/coherency_line_size delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/level delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/number_of_sets delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/physical_line_partition delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/size delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/type delete mode 100644 test/sys/devices/system/cpu/cpu1/cache/index2/ways_of_associativity delete mode 120000 test/sys/devices/system/cpu/cpu1/cpufreq delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/latency delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/name delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/power delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/time delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state0/usage delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/desc delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/latency delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/name delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/power delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/time delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/desc delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/latency delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/name delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/power delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/time delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/name delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/power delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/time delete mode 100644 test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage delete mode 100644 test/sys/devices/system/cpu/cpu1/crash_notes delete mode 100644 test/sys/devices/system/cpu/cpu1/microcode/processor_flags delete mode 100644 test/sys/devices/system/cpu/cpu1/microcode/version delete mode 100644 test/sys/devices/system/cpu/cpu1/online delete mode 100644 test/sys/devices/system/cpu/cpu1/thermal_throttle/count delete mode 100644 test/sys/devices/system/cpu/cpu1/topology/core_id delete mode 100644 test/sys/devices/system/cpu/cpu1/topology/core_siblings delete mode 100644 test/sys/devices/system/cpu/cpu1/topology/core_siblings_list delete mode 100644 test/sys/devices/system/cpu/cpu1/topology/physical_package_id delete mode 100644 test/sys/devices/system/cpu/cpu1/topology/thread_siblings delete mode 100644 test/sys/devices/system/cpu/cpu1/topology/thread_siblings_list delete mode 100644 test/sys/devices/system/cpu/cpuidle/current_driver delete mode 100644 test/sys/devices/system/cpu/cpuidle/current_governor_ro delete mode 100644 test/sys/devices/system/cpu/online delete mode 100644 test/sys/devices/system/cpu/possible delete mode 100644 test/sys/devices/system/cpu/present delete mode 100644 test/sys/devices/system/cpu/sched_mc_power_savings delete mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank0ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank1ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank2ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank3ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank4ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck0/bank5ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck0/check_interval delete mode 100644 test/sys/devices/system/machinecheck/machinecheck0/tolerant delete mode 100644 test/sys/devices/system/machinecheck/machinecheck0/trigger delete mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank0ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank1ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank2ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank3ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank4ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck1/bank5ctl delete mode 100644 test/sys/devices/system/machinecheck/machinecheck1/check_interval delete mode 100644 test/sys/devices/system/machinecheck/machinecheck1/tolerant delete mode 100644 test/sys/devices/system/machinecheck/machinecheck1/trigger delete mode 100644 test/sys/devices/virtual/bdi/0:16/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/0:16/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/0:16/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/0:16/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/0:16/subsystem delete mode 100644 test/sys/devices/virtual/bdi/0:16/uevent delete mode 100644 test/sys/devices/virtual/bdi/11:0/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/11:0/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/11:0/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/11:0/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/11:0/subsystem delete mode 100644 test/sys/devices/virtual/bdi/11:0/uevent delete mode 100644 test/sys/devices/virtual/bdi/7:0/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:0/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:0/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/7:0/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/7:0/subsystem delete mode 100644 test/sys/devices/virtual/bdi/7:0/uevent delete mode 100644 test/sys/devices/virtual/bdi/7:1/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:1/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:1/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/7:1/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/7:1/subsystem delete mode 100644 test/sys/devices/virtual/bdi/7:1/uevent delete mode 100644 test/sys/devices/virtual/bdi/7:2/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:2/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:2/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/7:2/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/7:2/subsystem delete mode 100644 test/sys/devices/virtual/bdi/7:2/uevent delete mode 100644 test/sys/devices/virtual/bdi/7:3/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:3/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:3/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/7:3/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/7:3/subsystem delete mode 100644 test/sys/devices/virtual/bdi/7:3/uevent delete mode 100644 test/sys/devices/virtual/bdi/7:4/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:4/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:4/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/7:4/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/7:4/subsystem delete mode 100644 test/sys/devices/virtual/bdi/7:4/uevent delete mode 100644 test/sys/devices/virtual/bdi/7:5/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:5/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:5/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/7:5/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/7:5/subsystem delete mode 100644 test/sys/devices/virtual/bdi/7:5/uevent delete mode 100644 test/sys/devices/virtual/bdi/7:6/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:6/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:6/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/7:6/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/7:6/subsystem delete mode 100644 test/sys/devices/virtual/bdi/7:6/uevent delete mode 100644 test/sys/devices/virtual/bdi/7:7/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:7/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/7:7/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/7:7/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/7:7/subsystem delete mode 100644 test/sys/devices/virtual/bdi/7:7/uevent delete mode 100644 test/sys/devices/virtual/bdi/8:0/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/8:0/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/8:0/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/8:0/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/8:0/subsystem delete mode 100644 test/sys/devices/virtual/bdi/8:0/uevent delete mode 100644 test/sys/devices/virtual/bdi/8:16/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/8:16/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/8:16/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/8:16/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/8:16/subsystem delete mode 100644 test/sys/devices/virtual/bdi/8:16/uevent delete mode 100644 test/sys/devices/virtual/bdi/9:0/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/9:0/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/9:0/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/9:0/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/9:0/subsystem delete mode 100644 test/sys/devices/virtual/bdi/9:0/uevent delete mode 100644 test/sys/devices/virtual/bdi/default/max_ratio delete mode 100644 test/sys/devices/virtual/bdi/default/min_ratio delete mode 100644 test/sys/devices/virtual/bdi/default/power/wakeup delete mode 100644 test/sys/devices/virtual/bdi/default/read_ahead_kb delete mode 120000 test/sys/devices/virtual/bdi/default/subsystem delete mode 100644 test/sys/devices/virtual/bdi/default/uevent delete mode 100644 test/sys/devices/virtual/block/fake!blockdev0/capability delete mode 100644 test/sys/devices/virtual/block/fake!blockdev0/dev delete mode 100644 test/sys/devices/virtual/block/fake!blockdev0/range delete mode 100644 test/sys/devices/virtual/block/fake!blockdev0/removable delete mode 100644 test/sys/devices/virtual/block/fake!blockdev0/ro delete mode 100644 test/sys/devices/virtual/block/fake!blockdev0/size delete mode 100644 test/sys/devices/virtual/block/fake!blockdev0/stat delete mode 120000 test/sys/devices/virtual/block/fake!blockdev0/subsystem delete mode 100644 test/sys/devices/virtual/block/fake!blockdev0/uevent delete mode 120000 test/sys/devices/virtual/block/loop0/bdi delete mode 100644 test/sys/devices/virtual/block/loop0/capability delete mode 100644 test/sys/devices/virtual/block/loop0/dev delete mode 100644 test/sys/devices/virtual/block/loop0/make-it-fail delete mode 100644 test/sys/devices/virtual/block/loop0/power/wakeup delete mode 100644 test/sys/devices/virtual/block/loop0/range delete mode 100644 test/sys/devices/virtual/block/loop0/removable delete mode 100644 test/sys/devices/virtual/block/loop0/ro delete mode 100644 test/sys/devices/virtual/block/loop0/size delete mode 100644 test/sys/devices/virtual/block/loop0/stat delete mode 120000 test/sys/devices/virtual/block/loop0/subsystem delete mode 100644 test/sys/devices/virtual/block/loop0/uevent delete mode 120000 test/sys/devices/virtual/block/loop1/bdi delete mode 100644 test/sys/devices/virtual/block/loop1/capability delete mode 100644 test/sys/devices/virtual/block/loop1/dev delete mode 100644 test/sys/devices/virtual/block/loop1/make-it-fail delete mode 100644 test/sys/devices/virtual/block/loop1/power/wakeup delete mode 100644 test/sys/devices/virtual/block/loop1/range delete mode 100644 test/sys/devices/virtual/block/loop1/removable delete mode 100644 test/sys/devices/virtual/block/loop1/ro delete mode 100644 test/sys/devices/virtual/block/loop1/size delete mode 100644 test/sys/devices/virtual/block/loop1/stat delete mode 120000 test/sys/devices/virtual/block/loop1/subsystem delete mode 100644 test/sys/devices/virtual/block/loop1/uevent delete mode 120000 test/sys/devices/virtual/block/loop2/bdi delete mode 100644 test/sys/devices/virtual/block/loop2/capability delete mode 100644 test/sys/devices/virtual/block/loop2/dev delete mode 100644 test/sys/devices/virtual/block/loop2/make-it-fail delete mode 100644 test/sys/devices/virtual/block/loop2/power/wakeup delete mode 100644 test/sys/devices/virtual/block/loop2/range delete mode 100644 test/sys/devices/virtual/block/loop2/removable delete mode 100644 test/sys/devices/virtual/block/loop2/ro delete mode 100644 test/sys/devices/virtual/block/loop2/size delete mode 100644 test/sys/devices/virtual/block/loop2/stat delete mode 120000 test/sys/devices/virtual/block/loop2/subsystem delete mode 100644 test/sys/devices/virtual/block/loop2/uevent delete mode 120000 test/sys/devices/virtual/block/loop3/bdi delete mode 100644 test/sys/devices/virtual/block/loop3/capability delete mode 100644 test/sys/devices/virtual/block/loop3/dev delete mode 100644 test/sys/devices/virtual/block/loop3/make-it-fail delete mode 100644 test/sys/devices/virtual/block/loop3/power/wakeup delete mode 100644 test/sys/devices/virtual/block/loop3/range delete mode 100644 test/sys/devices/virtual/block/loop3/removable delete mode 100644 test/sys/devices/virtual/block/loop3/ro delete mode 100644 test/sys/devices/virtual/block/loop3/size delete mode 100644 test/sys/devices/virtual/block/loop3/stat delete mode 120000 test/sys/devices/virtual/block/loop3/subsystem delete mode 100644 test/sys/devices/virtual/block/loop3/uevent delete mode 120000 test/sys/devices/virtual/block/loop4/bdi delete mode 100644 test/sys/devices/virtual/block/loop4/capability delete mode 100644 test/sys/devices/virtual/block/loop4/dev delete mode 100644 test/sys/devices/virtual/block/loop4/make-it-fail delete mode 100644 test/sys/devices/virtual/block/loop4/power/wakeup delete mode 100644 test/sys/devices/virtual/block/loop4/range delete mode 100644 test/sys/devices/virtual/block/loop4/removable delete mode 100644 test/sys/devices/virtual/block/loop4/ro delete mode 100644 test/sys/devices/virtual/block/loop4/size delete mode 100644 test/sys/devices/virtual/block/loop4/stat delete mode 120000 test/sys/devices/virtual/block/loop4/subsystem delete mode 100644 test/sys/devices/virtual/block/loop4/uevent delete mode 120000 test/sys/devices/virtual/block/loop5/bdi delete mode 100644 test/sys/devices/virtual/block/loop5/capability delete mode 100644 test/sys/devices/virtual/block/loop5/dev delete mode 100644 test/sys/devices/virtual/block/loop5/make-it-fail delete mode 100644 test/sys/devices/virtual/block/loop5/power/wakeup delete mode 100644 test/sys/devices/virtual/block/loop5/range delete mode 100644 test/sys/devices/virtual/block/loop5/removable delete mode 100644 test/sys/devices/virtual/block/loop5/ro delete mode 100644 test/sys/devices/virtual/block/loop5/size delete mode 100644 test/sys/devices/virtual/block/loop5/stat delete mode 120000 test/sys/devices/virtual/block/loop5/subsystem delete mode 100644 test/sys/devices/virtual/block/loop5/uevent delete mode 120000 test/sys/devices/virtual/block/loop6/bdi delete mode 100644 test/sys/devices/virtual/block/loop6/capability delete mode 100644 test/sys/devices/virtual/block/loop6/dev delete mode 100644 test/sys/devices/virtual/block/loop6/make-it-fail delete mode 100644 test/sys/devices/virtual/block/loop6/power/wakeup delete mode 100644 test/sys/devices/virtual/block/loop6/range delete mode 100644 test/sys/devices/virtual/block/loop6/removable delete mode 100644 test/sys/devices/virtual/block/loop6/ro delete mode 100644 test/sys/devices/virtual/block/loop6/size delete mode 100644 test/sys/devices/virtual/block/loop6/stat delete mode 120000 test/sys/devices/virtual/block/loop6/subsystem delete mode 100644 test/sys/devices/virtual/block/loop6/uevent delete mode 120000 test/sys/devices/virtual/block/loop7/bdi delete mode 100644 test/sys/devices/virtual/block/loop7/capability delete mode 100644 test/sys/devices/virtual/block/loop7/dev delete mode 100644 test/sys/devices/virtual/block/loop7/make-it-fail delete mode 100644 test/sys/devices/virtual/block/loop7/power/wakeup delete mode 100644 test/sys/devices/virtual/block/loop7/range delete mode 100644 test/sys/devices/virtual/block/loop7/removable delete mode 100644 test/sys/devices/virtual/block/loop7/ro delete mode 100644 test/sys/devices/virtual/block/loop7/size delete mode 100644 test/sys/devices/virtual/block/loop7/stat delete mode 120000 test/sys/devices/virtual/block/loop7/subsystem delete mode 100644 test/sys/devices/virtual/block/loop7/uevent delete mode 120000 test/sys/devices/virtual/block/md0/bdi delete mode 100644 test/sys/devices/virtual/block/md0/capability delete mode 100644 test/sys/devices/virtual/block/md0/dev delete mode 100644 test/sys/devices/virtual/block/md0/make-it-fail delete mode 100644 test/sys/devices/virtual/block/md0/md/array_state delete mode 100644 test/sys/devices/virtual/block/md0/md/chunk_size delete mode 100644 test/sys/devices/virtual/block/md0/md/component_size delete mode 100644 test/sys/devices/virtual/block/md0/md/degraded delete mode 120000 test/sys/devices/virtual/block/md0/md/dev-sda9/block delete mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/errors delete mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/offset delete mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/size delete mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/slot delete mode 100644 test/sys/devices/virtual/block/md0/md/dev-sda9/state delete mode 100644 test/sys/devices/virtual/block/md0/md/layout delete mode 100644 test/sys/devices/virtual/block/md0/md/level delete mode 100644 test/sys/devices/virtual/block/md0/md/metadata_version delete mode 100644 test/sys/devices/virtual/block/md0/md/mismatch_cnt delete mode 100644 test/sys/devices/virtual/block/md0/md/raid_disks delete mode 120000 test/sys/devices/virtual/block/md0/md/rd1 delete mode 100644 test/sys/devices/virtual/block/md0/md/reshape_position delete mode 100644 test/sys/devices/virtual/block/md0/md/resync_start delete mode 100644 test/sys/devices/virtual/block/md0/md/safe_mode_delay delete mode 100644 test/sys/devices/virtual/block/md0/md/suspend_hi delete mode 100644 test/sys/devices/virtual/block/md0/md/suspend_lo delete mode 100644 test/sys/devices/virtual/block/md0/md/sync_action delete mode 100644 test/sys/devices/virtual/block/md0/md/sync_completed delete mode 100644 test/sys/devices/virtual/block/md0/md/sync_force_parallel delete mode 100644 test/sys/devices/virtual/block/md0/md/sync_max delete mode 100644 test/sys/devices/virtual/block/md0/md/sync_min delete mode 100644 test/sys/devices/virtual/block/md0/md/sync_speed delete mode 100644 test/sys/devices/virtual/block/md0/md/sync_speed_max delete mode 100644 test/sys/devices/virtual/block/md0/md/sync_speed_min delete mode 100644 test/sys/devices/virtual/block/md0/power/wakeup delete mode 100644 test/sys/devices/virtual/block/md0/range delete mode 100644 test/sys/devices/virtual/block/md0/removable delete mode 100644 test/sys/devices/virtual/block/md0/ro delete mode 100644 test/sys/devices/virtual/block/md0/size delete mode 120000 test/sys/devices/virtual/block/md0/slaves/sda9 delete mode 100644 test/sys/devices/virtual/block/md0/stat delete mode 120000 test/sys/devices/virtual/block/md0/subsystem delete mode 100644 test/sys/devices/virtual/block/md0/uevent delete mode 100644 test/sys/devices/virtual/dmi/id/bios_date delete mode 100644 test/sys/devices/virtual/dmi/id/bios_vendor delete mode 100644 test/sys/devices/virtual/dmi/id/bios_version delete mode 100644 test/sys/devices/virtual/dmi/id/board_asset_tag delete mode 100644 test/sys/devices/virtual/dmi/id/board_name delete mode 100644 test/sys/devices/virtual/dmi/id/board_serial delete mode 100644 test/sys/devices/virtual/dmi/id/board_vendor delete mode 100644 test/sys/devices/virtual/dmi/id/board_version delete mode 100644 test/sys/devices/virtual/dmi/id/chassis_asset_tag delete mode 100644 test/sys/devices/virtual/dmi/id/chassis_serial delete mode 100644 test/sys/devices/virtual/dmi/id/chassis_type delete mode 100644 test/sys/devices/virtual/dmi/id/chassis_vendor delete mode 100644 test/sys/devices/virtual/dmi/id/chassis_version delete mode 100644 test/sys/devices/virtual/dmi/id/modalias delete mode 100644 test/sys/devices/virtual/dmi/id/power/wakeup delete mode 100644 test/sys/devices/virtual/dmi/id/product_name delete mode 100644 test/sys/devices/virtual/dmi/id/product_serial delete mode 100644 test/sys/devices/virtual/dmi/id/product_uuid delete mode 100644 test/sys/devices/virtual/dmi/id/product_version delete mode 120000 test/sys/devices/virtual/dmi/id/subsystem delete mode 100644 test/sys/devices/virtual/dmi/id/sys_vendor delete mode 100644 test/sys/devices/virtual/dmi/id/uevent delete mode 100644 test/sys/devices/virtual/graphics/fbcon/cursor_blink delete mode 100644 test/sys/devices/virtual/graphics/fbcon/power/wakeup delete mode 100644 test/sys/devices/virtual/graphics/fbcon/rotate delete mode 120000 test/sys/devices/virtual/graphics/fbcon/subsystem delete mode 100644 test/sys/devices/virtual/graphics/fbcon/uevent delete mode 100644 test/sys/devices/virtual/input/input6/capabilities/abs delete mode 100644 test/sys/devices/virtual/input/input6/capabilities/ev delete mode 100644 test/sys/devices/virtual/input/input6/capabilities/ff delete mode 100644 test/sys/devices/virtual/input/input6/capabilities/key delete mode 100644 test/sys/devices/virtual/input/input6/capabilities/led delete mode 100644 test/sys/devices/virtual/input/input6/capabilities/msc delete mode 100644 test/sys/devices/virtual/input/input6/capabilities/rel delete mode 100644 test/sys/devices/virtual/input/input6/capabilities/snd delete mode 100644 test/sys/devices/virtual/input/input6/capabilities/sw delete mode 100644 test/sys/devices/virtual/input/input6/event6/dev delete mode 120000 test/sys/devices/virtual/input/input6/event6/device delete mode 100644 test/sys/devices/virtual/input/input6/event6/power/wakeup delete mode 120000 test/sys/devices/virtual/input/input6/event6/subsystem delete mode 100644 test/sys/devices/virtual/input/input6/event6/uevent delete mode 100644 test/sys/devices/virtual/input/input6/id/bustype delete mode 100644 test/sys/devices/virtual/input/input6/id/product delete mode 100644 test/sys/devices/virtual/input/input6/id/vendor delete mode 100644 test/sys/devices/virtual/input/input6/id/version delete mode 100644 test/sys/devices/virtual/input/input6/modalias delete mode 100644 test/sys/devices/virtual/input/input6/name delete mode 100644 test/sys/devices/virtual/input/input6/phys delete mode 100644 test/sys/devices/virtual/input/input6/power/wakeup delete mode 120000 test/sys/devices/virtual/input/input6/subsystem delete mode 100644 test/sys/devices/virtual/input/input6/uevent delete mode 100644 test/sys/devices/virtual/input/input6/uniq delete mode 100644 test/sys/devices/virtual/input/mice/dev delete mode 100644 test/sys/devices/virtual/input/mice/power/wakeup delete mode 120000 test/sys/devices/virtual/input/mice/subsystem delete mode 100644 test/sys/devices/virtual/input/mice/uevent delete mode 100644 test/sys/devices/virtual/mem/full/dev delete mode 100644 test/sys/devices/virtual/mem/full/power/wakeup delete mode 120000 test/sys/devices/virtual/mem/full/subsystem delete mode 100644 test/sys/devices/virtual/mem/full/uevent delete mode 100644 test/sys/devices/virtual/mem/kmem/dev delete mode 100644 test/sys/devices/virtual/mem/kmem/power/wakeup delete mode 120000 test/sys/devices/virtual/mem/kmem/subsystem delete mode 100644 test/sys/devices/virtual/mem/kmem/uevent delete mode 100644 test/sys/devices/virtual/mem/kmsg/dev delete mode 100644 test/sys/devices/virtual/mem/kmsg/power/wakeup delete mode 120000 test/sys/devices/virtual/mem/kmsg/subsystem delete mode 100644 test/sys/devices/virtual/mem/kmsg/uevent delete mode 100644 test/sys/devices/virtual/mem/mem/dev delete mode 100644 test/sys/devices/virtual/mem/mem/power/wakeup delete mode 120000 test/sys/devices/virtual/mem/mem/subsystem delete mode 100644 test/sys/devices/virtual/mem/mem/uevent delete mode 100644 test/sys/devices/virtual/mem/null/dev delete mode 100644 test/sys/devices/virtual/mem/null/power/wakeup delete mode 120000 test/sys/devices/virtual/mem/null/subsystem delete mode 100644 test/sys/devices/virtual/mem/null/uevent delete mode 100644 test/sys/devices/virtual/mem/port/dev delete mode 100644 test/sys/devices/virtual/mem/port/power/wakeup delete mode 120000 test/sys/devices/virtual/mem/port/subsystem delete mode 100644 test/sys/devices/virtual/mem/port/uevent delete mode 100644 test/sys/devices/virtual/mem/random/dev delete mode 100644 test/sys/devices/virtual/mem/random/power/wakeup delete mode 120000 test/sys/devices/virtual/mem/random/subsystem delete mode 100644 test/sys/devices/virtual/mem/random/uevent delete mode 100644 test/sys/devices/virtual/mem/urandom/dev delete mode 100644 test/sys/devices/virtual/mem/urandom/power/wakeup delete mode 120000 test/sys/devices/virtual/mem/urandom/subsystem delete mode 100644 test/sys/devices/virtual/mem/urandom/uevent delete mode 100644 test/sys/devices/virtual/mem/zero/dev delete mode 100644 test/sys/devices/virtual/mem/zero/power/wakeup delete mode 120000 test/sys/devices/virtual/mem/zero/subsystem delete mode 100644 test/sys/devices/virtual/mem/zero/uevent delete mode 100644 test/sys/devices/virtual/misc/cpu_dma_latency/dev delete mode 100644 test/sys/devices/virtual/misc/cpu_dma_latency/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/cpu_dma_latency/subsystem delete mode 100644 test/sys/devices/virtual/misc/cpu_dma_latency/uevent delete mode 100644 test/sys/devices/virtual/misc/device-mapper/dev delete mode 100644 test/sys/devices/virtual/misc/device-mapper/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/device-mapper/subsystem delete mode 100644 test/sys/devices/virtual/misc/device-mapper/uevent delete mode 100644 test/sys/devices/virtual/misc/fuse/dev delete mode 100644 test/sys/devices/virtual/misc/fuse/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/fuse/subsystem delete mode 100644 test/sys/devices/virtual/misc/fuse/uevent delete mode 100644 test/sys/devices/virtual/misc/hpet/dev delete mode 100644 test/sys/devices/virtual/misc/hpet/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/hpet/subsystem delete mode 100644 test/sys/devices/virtual/misc/hpet/uevent delete mode 100644 test/sys/devices/virtual/misc/mcelog/dev delete mode 100644 test/sys/devices/virtual/misc/mcelog/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/mcelog/subsystem delete mode 100644 test/sys/devices/virtual/misc/mcelog/uevent delete mode 100644 test/sys/devices/virtual/misc/microcode/dev delete mode 100644 test/sys/devices/virtual/misc/microcode/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/microcode/subsystem delete mode 100644 test/sys/devices/virtual/misc/microcode/uevent delete mode 100644 test/sys/devices/virtual/misc/misc-fake1/dev delete mode 100644 test/sys/devices/virtual/misc/misc-fake1/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/misc-fake1/subsystem delete mode 100644 test/sys/devices/virtual/misc/misc-fake1/uevent delete mode 100644 test/sys/devices/virtual/misc/misc-fake89999/dev delete mode 100644 test/sys/devices/virtual/misc/misc-fake89999/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/misc-fake89999/subsystem delete mode 100644 test/sys/devices/virtual/misc/misc-fake89999/uevent delete mode 100644 test/sys/devices/virtual/misc/network_latency/dev delete mode 100644 test/sys/devices/virtual/misc/network_latency/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/network_latency/subsystem delete mode 100644 test/sys/devices/virtual/misc/network_latency/uevent delete mode 100644 test/sys/devices/virtual/misc/network_throughput/dev delete mode 100644 test/sys/devices/virtual/misc/network_throughput/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/network_throughput/subsystem delete mode 100644 test/sys/devices/virtual/misc/network_throughput/uevent delete mode 100644 test/sys/devices/virtual/misc/nvram/dev delete mode 100644 test/sys/devices/virtual/misc/nvram/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/nvram/subsystem delete mode 100644 test/sys/devices/virtual/misc/nvram/uevent delete mode 100644 test/sys/devices/virtual/misc/psaux/dev delete mode 100644 test/sys/devices/virtual/misc/psaux/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/psaux/subsystem delete mode 100644 test/sys/devices/virtual/misc/psaux/uevent delete mode 100644 test/sys/devices/virtual/misc/uinput/dev delete mode 100644 test/sys/devices/virtual/misc/uinput/power/wakeup delete mode 120000 test/sys/devices/virtual/misc/uinput/subsystem delete mode 100644 test/sys/devices/virtual/misc/uinput/uevent delete mode 100644 test/sys/devices/virtual/net/lo/addr_len delete mode 100644 test/sys/devices/virtual/net/lo/address delete mode 100644 test/sys/devices/virtual/net/lo/broadcast delete mode 100644 test/sys/devices/virtual/net/lo/carrier delete mode 100644 test/sys/devices/virtual/net/lo/dev_id delete mode 100644 test/sys/devices/virtual/net/lo/dormant delete mode 100644 test/sys/devices/virtual/net/lo/features delete mode 100644 test/sys/devices/virtual/net/lo/flags delete mode 100644 test/sys/devices/virtual/net/lo/ifindex delete mode 100644 test/sys/devices/virtual/net/lo/iflink delete mode 100644 test/sys/devices/virtual/net/lo/link_mode delete mode 100644 test/sys/devices/virtual/net/lo/mtu delete mode 100644 test/sys/devices/virtual/net/lo/operstate delete mode 100644 test/sys/devices/virtual/net/lo/power/wakeup delete mode 100644 test/sys/devices/virtual/net/lo/statistics/collisions delete mode 100644 test/sys/devices/virtual/net/lo/statistics/multicast delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_bytes delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_compressed delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_crc_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_dropped delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_fifo_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_frame_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_length_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_missed_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_over_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/rx_packets delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_aborted_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_bytes delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_carrier_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_compressed delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_dropped delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_fifo_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_heartbeat_errors delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_packets delete mode 100644 test/sys/devices/virtual/net/lo/statistics/tx_window_errors delete mode 120000 test/sys/devices/virtual/net/lo/subsystem delete mode 100644 test/sys/devices/virtual/net/lo/tx_queue_len delete mode 100644 test/sys/devices/virtual/net/lo/type delete mode 100644 test/sys/devices/virtual/net/lo/uevent delete mode 100644 test/sys/devices/virtual/sound/seq/dev delete mode 100644 test/sys/devices/virtual/sound/seq/power/wakeup delete mode 120000 test/sys/devices/virtual/sound/seq/subsystem delete mode 100644 test/sys/devices/virtual/sound/seq/uevent delete mode 100644 test/sys/devices/virtual/sound/timer/dev delete mode 100644 test/sys/devices/virtual/sound/timer/power/wakeup delete mode 120000 test/sys/devices/virtual/sound/timer/subsystem delete mode 100644 test/sys/devices/virtual/sound/timer/uevent delete mode 100644 test/sys/devices/virtual/thermal/cooling_device0/cur_state delete mode 120000 test/sys/devices/virtual/thermal/cooling_device0/device delete mode 100644 test/sys/devices/virtual/thermal/cooling_device0/max_state delete mode 100644 test/sys/devices/virtual/thermal/cooling_device0/power/wakeup delete mode 120000 test/sys/devices/virtual/thermal/cooling_device0/subsystem delete mode 100644 test/sys/devices/virtual/thermal/cooling_device0/type delete mode 100644 test/sys/devices/virtual/thermal/cooling_device0/uevent delete mode 100644 test/sys/devices/virtual/thermal/cooling_device1/cur_state delete mode 120000 test/sys/devices/virtual/thermal/cooling_device1/device delete mode 100644 test/sys/devices/virtual/thermal/cooling_device1/max_state delete mode 100644 test/sys/devices/virtual/thermal/cooling_device1/power/wakeup delete mode 120000 test/sys/devices/virtual/thermal/cooling_device1/subsystem delete mode 100644 test/sys/devices/virtual/thermal/cooling_device1/type delete mode 100644 test/sys/devices/virtual/thermal/cooling_device1/uevent delete mode 120000 test/sys/devices/virtual/thermal/thermal_zone0/device delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/mode delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/power/wakeup delete mode 120000 test/sys/devices/virtual/thermal/thermal_zone0/subsystem delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/temp delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_type delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/type delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone0/uevent delete mode 120000 test/sys/devices/virtual/thermal/thermal_zone1/cdev0 delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/cdev0_trip_point delete mode 120000 test/sys/devices/virtual/thermal/thermal_zone1/cdev1 delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/cdev1_trip_point delete mode 120000 test/sys/devices/virtual/thermal/thermal_zone1/device delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/mode delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/power/wakeup delete mode 120000 test/sys/devices/virtual/thermal/thermal_zone1/subsystem delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/temp delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_type delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_temp delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_type delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/type delete mode 100644 test/sys/devices/virtual/thermal/thermal_zone1/uevent delete mode 100644 test/sys/devices/virtual/tty/console/dev delete mode 100644 test/sys/devices/virtual/tty/console/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/console/subsystem delete mode 100644 test/sys/devices/virtual/tty/console/uevent delete mode 100644 test/sys/devices/virtual/tty/ptmx/dev delete mode 100644 test/sys/devices/virtual/tty/ptmx/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/ptmx/subsystem delete mode 100644 test/sys/devices/virtual/tty/ptmx/uevent delete mode 100644 test/sys/devices/virtual/tty/tty/dev delete mode 100644 test/sys/devices/virtual/tty/tty/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty/uevent delete mode 100644 test/sys/devices/virtual/tty/tty0/dev delete mode 100644 test/sys/devices/virtual/tty/tty0/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty0/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty0/uevent delete mode 100644 test/sys/devices/virtual/tty/tty1/dev delete mode 100644 test/sys/devices/virtual/tty/tty1/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty1/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty1/uevent delete mode 100644 test/sys/devices/virtual/tty/tty10/dev delete mode 100644 test/sys/devices/virtual/tty/tty10/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty10/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty10/uevent delete mode 100644 test/sys/devices/virtual/tty/tty11/dev delete mode 100644 test/sys/devices/virtual/tty/tty11/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty11/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty11/uevent delete mode 100644 test/sys/devices/virtual/tty/tty12/dev delete mode 100644 test/sys/devices/virtual/tty/tty12/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty12/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty12/uevent delete mode 100644 test/sys/devices/virtual/tty/tty13/dev delete mode 100644 test/sys/devices/virtual/tty/tty13/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty13/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty13/uevent delete mode 100644 test/sys/devices/virtual/tty/tty14/dev delete mode 100644 test/sys/devices/virtual/tty/tty14/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty14/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty14/uevent delete mode 100644 test/sys/devices/virtual/tty/tty15/dev delete mode 100644 test/sys/devices/virtual/tty/tty15/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty15/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty15/uevent delete mode 100644 test/sys/devices/virtual/tty/tty16/dev delete mode 100644 test/sys/devices/virtual/tty/tty16/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty16/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty16/uevent delete mode 100644 test/sys/devices/virtual/tty/tty17/dev delete mode 100644 test/sys/devices/virtual/tty/tty17/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty17/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty17/uevent delete mode 100644 test/sys/devices/virtual/tty/tty18/dev delete mode 100644 test/sys/devices/virtual/tty/tty18/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty18/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty18/uevent delete mode 100644 test/sys/devices/virtual/tty/tty19/dev delete mode 100644 test/sys/devices/virtual/tty/tty19/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty19/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty19/uevent delete mode 100644 test/sys/devices/virtual/tty/tty2/dev delete mode 100644 test/sys/devices/virtual/tty/tty2/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty2/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty2/uevent delete mode 100644 test/sys/devices/virtual/tty/tty20/dev delete mode 100644 test/sys/devices/virtual/tty/tty20/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty20/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty20/uevent delete mode 100644 test/sys/devices/virtual/tty/tty21/dev delete mode 100644 test/sys/devices/virtual/tty/tty21/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty21/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty21/uevent delete mode 100644 test/sys/devices/virtual/tty/tty22/dev delete mode 100644 test/sys/devices/virtual/tty/tty22/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty22/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty22/uevent delete mode 100644 test/sys/devices/virtual/tty/tty23/dev delete mode 100644 test/sys/devices/virtual/tty/tty23/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty23/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty23/uevent delete mode 100644 test/sys/devices/virtual/tty/tty24/dev delete mode 100644 test/sys/devices/virtual/tty/tty24/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty24/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty24/uevent delete mode 100644 test/sys/devices/virtual/tty/tty25/dev delete mode 100644 test/sys/devices/virtual/tty/tty25/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty25/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty25/uevent delete mode 100644 test/sys/devices/virtual/tty/tty26/dev delete mode 100644 test/sys/devices/virtual/tty/tty26/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty26/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty26/uevent delete mode 100644 test/sys/devices/virtual/tty/tty27/dev delete mode 100644 test/sys/devices/virtual/tty/tty27/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty27/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty27/uevent delete mode 100644 test/sys/devices/virtual/tty/tty28/dev delete mode 100644 test/sys/devices/virtual/tty/tty28/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty28/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty28/uevent delete mode 100644 test/sys/devices/virtual/tty/tty29/dev delete mode 100644 test/sys/devices/virtual/tty/tty29/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty29/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty29/uevent delete mode 100644 test/sys/devices/virtual/tty/tty3/dev delete mode 100644 test/sys/devices/virtual/tty/tty3/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty3/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty3/uevent delete mode 100644 test/sys/devices/virtual/tty/tty30/dev delete mode 100644 test/sys/devices/virtual/tty/tty30/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty30/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty30/uevent delete mode 100644 test/sys/devices/virtual/tty/tty31/dev delete mode 100644 test/sys/devices/virtual/tty/tty31/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty31/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty31/uevent delete mode 100644 test/sys/devices/virtual/tty/tty32/dev delete mode 100644 test/sys/devices/virtual/tty/tty32/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty32/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty32/uevent delete mode 100644 test/sys/devices/virtual/tty/tty33/dev delete mode 100644 test/sys/devices/virtual/tty/tty33/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty33/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty33/uevent delete mode 100644 test/sys/devices/virtual/tty/tty34/dev delete mode 100644 test/sys/devices/virtual/tty/tty34/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty34/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty34/uevent delete mode 100644 test/sys/devices/virtual/tty/tty35/dev delete mode 100644 test/sys/devices/virtual/tty/tty35/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty35/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty35/uevent delete mode 100644 test/sys/devices/virtual/tty/tty36/dev delete mode 100644 test/sys/devices/virtual/tty/tty36/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty36/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty36/uevent delete mode 100644 test/sys/devices/virtual/tty/tty37/dev delete mode 100644 test/sys/devices/virtual/tty/tty37/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty37/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty37/uevent delete mode 100644 test/sys/devices/virtual/tty/tty38/dev delete mode 100644 test/sys/devices/virtual/tty/tty38/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty38/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty38/uevent delete mode 100644 test/sys/devices/virtual/tty/tty39/dev delete mode 100644 test/sys/devices/virtual/tty/tty39/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty39/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty39/uevent delete mode 100644 test/sys/devices/virtual/tty/tty4/dev delete mode 100644 test/sys/devices/virtual/tty/tty4/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty4/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty4/uevent delete mode 100644 test/sys/devices/virtual/tty/tty40/dev delete mode 100644 test/sys/devices/virtual/tty/tty40/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty40/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty40/uevent delete mode 100644 test/sys/devices/virtual/tty/tty41/dev delete mode 100644 test/sys/devices/virtual/tty/tty41/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty41/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty41/uevent delete mode 100644 test/sys/devices/virtual/tty/tty42/dev delete mode 100644 test/sys/devices/virtual/tty/tty42/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty42/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty42/uevent delete mode 100644 test/sys/devices/virtual/tty/tty43/dev delete mode 100644 test/sys/devices/virtual/tty/tty43/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty43/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty43/uevent delete mode 100644 test/sys/devices/virtual/tty/tty44/dev delete mode 100644 test/sys/devices/virtual/tty/tty44/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty44/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty44/uevent delete mode 100644 test/sys/devices/virtual/tty/tty45/dev delete mode 100644 test/sys/devices/virtual/tty/tty45/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty45/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty45/uevent delete mode 100644 test/sys/devices/virtual/tty/tty46/dev delete mode 100644 test/sys/devices/virtual/tty/tty46/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty46/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty46/uevent delete mode 100644 test/sys/devices/virtual/tty/tty47/dev delete mode 100644 test/sys/devices/virtual/tty/tty47/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty47/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty47/uevent delete mode 100644 test/sys/devices/virtual/tty/tty48/dev delete mode 100644 test/sys/devices/virtual/tty/tty48/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty48/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty48/uevent delete mode 100644 test/sys/devices/virtual/tty/tty49/dev delete mode 100644 test/sys/devices/virtual/tty/tty49/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty49/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty49/uevent delete mode 100644 test/sys/devices/virtual/tty/tty5/dev delete mode 100644 test/sys/devices/virtual/tty/tty5/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty5/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty5/uevent delete mode 100644 test/sys/devices/virtual/tty/tty50/dev delete mode 100644 test/sys/devices/virtual/tty/tty50/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty50/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty50/uevent delete mode 100644 test/sys/devices/virtual/tty/tty51/dev delete mode 100644 test/sys/devices/virtual/tty/tty51/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty51/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty51/uevent delete mode 100644 test/sys/devices/virtual/tty/tty52/dev delete mode 100644 test/sys/devices/virtual/tty/tty52/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty52/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty52/uevent delete mode 100644 test/sys/devices/virtual/tty/tty53/dev delete mode 100644 test/sys/devices/virtual/tty/tty53/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty53/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty53/uevent delete mode 100644 test/sys/devices/virtual/tty/tty54/dev delete mode 100644 test/sys/devices/virtual/tty/tty54/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty54/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty54/uevent delete mode 100644 test/sys/devices/virtual/tty/tty55/dev delete mode 100644 test/sys/devices/virtual/tty/tty55/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty55/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty55/uevent delete mode 100644 test/sys/devices/virtual/tty/tty56/dev delete mode 100644 test/sys/devices/virtual/tty/tty56/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty56/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty56/uevent delete mode 100644 test/sys/devices/virtual/tty/tty57/dev delete mode 100644 test/sys/devices/virtual/tty/tty57/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty57/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty57/uevent delete mode 100644 test/sys/devices/virtual/tty/tty58/dev delete mode 100644 test/sys/devices/virtual/tty/tty58/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty58/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty58/uevent delete mode 100644 test/sys/devices/virtual/tty/tty59/dev delete mode 100644 test/sys/devices/virtual/tty/tty59/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty59/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty59/uevent delete mode 100644 test/sys/devices/virtual/tty/tty6/dev delete mode 100644 test/sys/devices/virtual/tty/tty6/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty6/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty6/uevent delete mode 100644 test/sys/devices/virtual/tty/tty60/dev delete mode 100644 test/sys/devices/virtual/tty/tty60/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty60/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty60/uevent delete mode 100644 test/sys/devices/virtual/tty/tty61/dev delete mode 100644 test/sys/devices/virtual/tty/tty61/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty61/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty61/uevent delete mode 100644 test/sys/devices/virtual/tty/tty62/dev delete mode 100644 test/sys/devices/virtual/tty/tty62/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty62/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty62/uevent delete mode 100644 test/sys/devices/virtual/tty/tty63/dev delete mode 100644 test/sys/devices/virtual/tty/tty63/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty63/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty63/uevent delete mode 100644 test/sys/devices/virtual/tty/tty7/dev delete mode 100644 test/sys/devices/virtual/tty/tty7/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty7/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty7/uevent delete mode 100644 test/sys/devices/virtual/tty/tty8/dev delete mode 100644 test/sys/devices/virtual/tty/tty8/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty8/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty8/uevent delete mode 100644 test/sys/devices/virtual/tty/tty9/dev delete mode 100644 test/sys/devices/virtual/tty/tty9/power/wakeup delete mode 120000 test/sys/devices/virtual/tty/tty9/subsystem delete mode 100644 test/sys/devices/virtual/tty/tty9/uevent delete mode 100644 test/sys/devices/virtual/vc/vcs/dev delete mode 100644 test/sys/devices/virtual/vc/vcs/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcs/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcs/uevent delete mode 100644 test/sys/devices/virtual/vc/vcs1/dev delete mode 100644 test/sys/devices/virtual/vc/vcs1/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcs1/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcs1/uevent delete mode 100644 test/sys/devices/virtual/vc/vcs10/dev delete mode 100644 test/sys/devices/virtual/vc/vcs10/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcs10/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcs10/uevent delete mode 100644 test/sys/devices/virtual/vc/vcs2/dev delete mode 100644 test/sys/devices/virtual/vc/vcs2/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcs2/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcs2/uevent delete mode 100644 test/sys/devices/virtual/vc/vcs3/dev delete mode 100644 test/sys/devices/virtual/vc/vcs3/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcs3/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcs3/uevent delete mode 100644 test/sys/devices/virtual/vc/vcs4/dev delete mode 100644 test/sys/devices/virtual/vc/vcs4/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcs4/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcs4/uevent delete mode 100644 test/sys/devices/virtual/vc/vcs5/dev delete mode 100644 test/sys/devices/virtual/vc/vcs5/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcs5/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcs5/uevent delete mode 100644 test/sys/devices/virtual/vc/vcs6/dev delete mode 100644 test/sys/devices/virtual/vc/vcs6/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcs6/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcs6/uevent delete mode 100644 test/sys/devices/virtual/vc/vcs7/dev delete mode 100644 test/sys/devices/virtual/vc/vcs7/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcs7/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcs7/uevent delete mode 100644 test/sys/devices/virtual/vc/vcsa/dev delete mode 100644 test/sys/devices/virtual/vc/vcsa/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcsa/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcsa/uevent delete mode 100644 test/sys/devices/virtual/vc/vcsa1/dev delete mode 100644 test/sys/devices/virtual/vc/vcsa1/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcsa1/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcsa1/uevent delete mode 100644 test/sys/devices/virtual/vc/vcsa10/dev delete mode 100644 test/sys/devices/virtual/vc/vcsa10/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcsa10/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcsa10/uevent delete mode 100644 test/sys/devices/virtual/vc/vcsa2/dev delete mode 100644 test/sys/devices/virtual/vc/vcsa2/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcsa2/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcsa2/uevent delete mode 100644 test/sys/devices/virtual/vc/vcsa3/dev delete mode 100644 test/sys/devices/virtual/vc/vcsa3/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcsa3/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcsa3/uevent delete mode 100644 test/sys/devices/virtual/vc/vcsa4/dev delete mode 100644 test/sys/devices/virtual/vc/vcsa4/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcsa4/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcsa4/uevent delete mode 100644 test/sys/devices/virtual/vc/vcsa5/dev delete mode 100644 test/sys/devices/virtual/vc/vcsa5/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcsa5/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcsa5/uevent delete mode 100644 test/sys/devices/virtual/vc/vcsa6/dev delete mode 100644 test/sys/devices/virtual/vc/vcsa6/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcsa6/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcsa6/uevent delete mode 100644 test/sys/devices/virtual/vc/vcsa7/dev delete mode 100644 test/sys/devices/virtual/vc/vcsa7/power/wakeup delete mode 120000 test/sys/devices/virtual/vc/vcsa7/subsystem delete mode 100644 test/sys/devices/virtual/vc/vcsa7/uevent delete mode 100644 test/sys/devices/virtual/vtconsole/vtcon0/bind delete mode 100644 test/sys/devices/virtual/vtconsole/vtcon0/name delete mode 100644 test/sys/devices/virtual/vtconsole/vtcon0/power/wakeup delete mode 120000 test/sys/devices/virtual/vtconsole/vtcon0/subsystem delete mode 100644 test/sys/devices/virtual/vtconsole/vtcon0/uevent delete mode 100644 test/sys/devices/virtual/vtconsole/vtcon1/bind delete mode 100644 test/sys/devices/virtual/vtconsole/vtcon1/name delete mode 100644 test/sys/devices/virtual/vtconsole/vtcon1/power/wakeup delete mode 120000 test/sys/devices/virtual/vtconsole/vtcon1/subsystem delete mode 100644 test/sys/devices/virtual/vtconsole/vtcon1/uevent delete mode 100644 test/sys/firmware/acpi/interrupts/error delete mode 100644 test/sys/firmware/acpi/interrupts/ff_gbl_lock delete mode 100644 test/sys/firmware/acpi/interrupts/ff_pmtimer delete mode 100644 test/sys/firmware/acpi/interrupts/ff_pwr_btn delete mode 100644 test/sys/firmware/acpi/interrupts/ff_rt_clk delete mode 100644 test/sys/firmware/acpi/interrupts/ff_slp_btn delete mode 100644 test/sys/firmware/acpi/interrupts/gpe00 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe01 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe02 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe03 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe04 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe05 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe06 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe07 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe08 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe09 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe0A delete mode 100644 test/sys/firmware/acpi/interrupts/gpe0B delete mode 100644 test/sys/firmware/acpi/interrupts/gpe0C delete mode 100644 test/sys/firmware/acpi/interrupts/gpe0D delete mode 100644 test/sys/firmware/acpi/interrupts/gpe0E delete mode 100644 test/sys/firmware/acpi/interrupts/gpe0F delete mode 100644 test/sys/firmware/acpi/interrupts/gpe10 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe11 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe12 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe13 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe14 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe15 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe16 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe17 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe18 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe19 delete mode 100644 test/sys/firmware/acpi/interrupts/gpe1A delete mode 100644 test/sys/firmware/acpi/interrupts/gpe1B delete mode 100644 test/sys/firmware/acpi/interrupts/gpe1C delete mode 100644 test/sys/firmware/acpi/interrupts/gpe1D delete mode 100644 test/sys/firmware/acpi/interrupts/gpe1E delete mode 100644 test/sys/firmware/acpi/interrupts/gpe1F delete mode 100644 test/sys/firmware/acpi/interrupts/gpe_all delete mode 100644 test/sys/firmware/acpi/interrupts/sci delete mode 100644 test/sys/firmware/acpi/tables/APIC delete mode 100644 test/sys/firmware/acpi/tables/BOOT delete mode 100644 test/sys/firmware/acpi/tables/DSDT delete mode 100644 test/sys/firmware/acpi/tables/ECDT delete mode 100644 test/sys/firmware/acpi/tables/FACP delete mode 100644 test/sys/firmware/acpi/tables/FACS delete mode 100644 test/sys/firmware/acpi/tables/HPET delete mode 100644 test/sys/firmware/acpi/tables/MCFG delete mode 100644 test/sys/firmware/acpi/tables/SLIC delete mode 100644 test/sys/firmware/acpi/tables/SSDT1 delete mode 100644 test/sys/firmware/acpi/tables/SSDT2 delete mode 100644 test/sys/firmware/acpi/tables/SSDT3 delete mode 100644 test/sys/firmware/acpi/tables/SSDT4 delete mode 100644 test/sys/firmware/acpi/tables/SSDT5 delete mode 100644 test/sys/firmware/acpi/tables/TCPA delete mode 100644 test/sys/firmware/edd/int13_dev80/default_cylinders delete mode 100644 test/sys/firmware/edd/int13_dev80/default_heads delete mode 100644 test/sys/firmware/edd/int13_dev80/default_sectors_per_track delete mode 100644 test/sys/firmware/edd/int13_dev80/extensions delete mode 100644 test/sys/firmware/edd/int13_dev80/host_bus delete mode 100644 test/sys/firmware/edd/int13_dev80/info_flags delete mode 100644 test/sys/firmware/edd/int13_dev80/interface delete mode 100644 test/sys/firmware/edd/int13_dev80/legacy_max_cylinder delete mode 100644 test/sys/firmware/edd/int13_dev80/legacy_max_head delete mode 100644 test/sys/firmware/edd/int13_dev80/legacy_sectors_per_track delete mode 100644 test/sys/firmware/edd/int13_dev80/mbr_signature delete mode 120000 test/sys/firmware/edd/int13_dev80/pci_dev delete mode 100644 test/sys/firmware/edd/int13_dev80/raw_data delete mode 100644 test/sys/firmware/edd/int13_dev80/sectors delete mode 100644 test/sys/firmware/edd/int13_dev80/version delete mode 100644 test/sys/firmware/memmap/0/end delete mode 100644 test/sys/firmware/memmap/0/start delete mode 100644 test/sys/firmware/memmap/0/type delete mode 100644 test/sys/firmware/memmap/1/end delete mode 100644 test/sys/firmware/memmap/1/start delete mode 100644 test/sys/firmware/memmap/1/type delete mode 100644 test/sys/firmware/memmap/10/end delete mode 100644 test/sys/firmware/memmap/10/start delete mode 100644 test/sys/firmware/memmap/10/type delete mode 100644 test/sys/firmware/memmap/11/end delete mode 100644 test/sys/firmware/memmap/11/start delete mode 100644 test/sys/firmware/memmap/11/type delete mode 100644 test/sys/firmware/memmap/12/end delete mode 100644 test/sys/firmware/memmap/12/start delete mode 100644 test/sys/firmware/memmap/12/type delete mode 100644 test/sys/firmware/memmap/13/end delete mode 100644 test/sys/firmware/memmap/13/start delete mode 100644 test/sys/firmware/memmap/13/type delete mode 100644 test/sys/firmware/memmap/2/end delete mode 100644 test/sys/firmware/memmap/2/start delete mode 100644 test/sys/firmware/memmap/2/type delete mode 100644 test/sys/firmware/memmap/3/end delete mode 100644 test/sys/firmware/memmap/3/start delete mode 100644 test/sys/firmware/memmap/3/type delete mode 100644 test/sys/firmware/memmap/4/end delete mode 100644 test/sys/firmware/memmap/4/start delete mode 100644 test/sys/firmware/memmap/4/type delete mode 100644 test/sys/firmware/memmap/5/end delete mode 100644 test/sys/firmware/memmap/5/start delete mode 100644 test/sys/firmware/memmap/5/type delete mode 100644 test/sys/firmware/memmap/6/end delete mode 100644 test/sys/firmware/memmap/6/start delete mode 100644 test/sys/firmware/memmap/6/type delete mode 100644 test/sys/firmware/memmap/7/end delete mode 100644 test/sys/firmware/memmap/7/start delete mode 100644 test/sys/firmware/memmap/7/type delete mode 100644 test/sys/firmware/memmap/8/end delete mode 100644 test/sys/firmware/memmap/8/start delete mode 100644 test/sys/firmware/memmap/8/type delete mode 100644 test/sys/firmware/memmap/9/end delete mode 100644 test/sys/firmware/memmap/9/start delete mode 100644 test/sys/firmware/memmap/9/type delete mode 100644 test/sys/fs/fuse/connections/16/abort delete mode 100644 test/sys/fs/fuse/connections/16/waiting delete mode 100644 test/sys/kernel/debug/bdi/0:16/stats delete mode 100644 test/sys/kernel/debug/bdi/11:0/stats delete mode 100644 test/sys/kernel/debug/bdi/7:0/stats delete mode 100644 test/sys/kernel/debug/bdi/7:1/stats delete mode 100644 test/sys/kernel/debug/bdi/7:2/stats delete mode 100644 test/sys/kernel/debug/bdi/7:3/stats delete mode 100644 test/sys/kernel/debug/bdi/7:4/stats delete mode 100644 test/sys/kernel/debug/bdi/7:5/stats delete mode 100644 test/sys/kernel/debug/bdi/7:6/stats delete mode 100644 test/sys/kernel/debug/bdi/7:7/stats delete mode 100644 test/sys/kernel/debug/bdi/8:0/stats delete mode 100644 test/sys/kernel/debug/bdi/8:16/stats delete mode 100644 test/sys/kernel/debug/bdi/9:0/stats delete mode 100644 test/sys/kernel/debug/bdi/default/stats delete mode 100644 test/sys/kernel/debug/x86/pat_memtype_list delete mode 100644 test/sys/kernel/kexec_crash_loaded delete mode 100644 test/sys/kernel/kexec_loaded delete mode 100644 test/sys/kernel/notes delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/aliases delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/align delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/alloc_calls delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/cache_dma delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/cpu_slabs delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/ctor delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/free_calls delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/hwcache_align delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/object_size delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/objects delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/objects_partial delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/objs_per_slab delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/order delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/partial delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/poison delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/reclaim_account delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/red_zone delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/sanity_checks delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/shrink delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/slab_size delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/slabs delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/store_user delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/total_objects delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/trace delete mode 100644 test/sys/kernel/slab/Acpi-Namespace/validate delete mode 100644 test/sys/kernel/slab/Acpi-Operand/aliases delete mode 100644 test/sys/kernel/slab/Acpi-Operand/align delete mode 100644 test/sys/kernel/slab/Acpi-Operand/alloc_calls delete mode 100644 test/sys/kernel/slab/Acpi-Operand/cache_dma delete mode 100644 test/sys/kernel/slab/Acpi-Operand/cpu_slabs delete mode 100644 test/sys/kernel/slab/Acpi-Operand/ctor delete mode 100644 test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/Acpi-Operand/free_calls delete mode 100644 test/sys/kernel/slab/Acpi-Operand/hwcache_align delete mode 100644 test/sys/kernel/slab/Acpi-Operand/object_size delete mode 100644 test/sys/kernel/slab/Acpi-Operand/objects delete mode 100644 test/sys/kernel/slab/Acpi-Operand/objects_partial delete mode 100644 test/sys/kernel/slab/Acpi-Operand/objs_per_slab delete mode 100644 test/sys/kernel/slab/Acpi-Operand/order delete mode 100644 test/sys/kernel/slab/Acpi-Operand/partial delete mode 100644 test/sys/kernel/slab/Acpi-Operand/poison delete mode 100644 test/sys/kernel/slab/Acpi-Operand/reclaim_account delete mode 100644 test/sys/kernel/slab/Acpi-Operand/red_zone delete mode 100644 test/sys/kernel/slab/Acpi-Operand/sanity_checks delete mode 100644 test/sys/kernel/slab/Acpi-Operand/shrink delete mode 100644 test/sys/kernel/slab/Acpi-Operand/slab_size delete mode 100644 test/sys/kernel/slab/Acpi-Operand/slabs delete mode 100644 test/sys/kernel/slab/Acpi-Operand/store_user delete mode 100644 test/sys/kernel/slab/Acpi-Operand/total_objects delete mode 100644 test/sys/kernel/slab/Acpi-Operand/trace delete mode 100644 test/sys/kernel/slab/Acpi-Operand/validate delete mode 100644 test/sys/kernel/slab/Acpi-Parse/aliases delete mode 100644 test/sys/kernel/slab/Acpi-Parse/align delete mode 100644 test/sys/kernel/slab/Acpi-Parse/alloc_calls delete mode 100644 test/sys/kernel/slab/Acpi-Parse/cache_dma delete mode 100644 test/sys/kernel/slab/Acpi-Parse/cpu_slabs delete mode 100644 test/sys/kernel/slab/Acpi-Parse/ctor delete mode 100644 test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/Acpi-Parse/free_calls delete mode 100644 test/sys/kernel/slab/Acpi-Parse/hwcache_align delete mode 100644 test/sys/kernel/slab/Acpi-Parse/object_size delete mode 100644 test/sys/kernel/slab/Acpi-Parse/objects delete mode 100644 test/sys/kernel/slab/Acpi-Parse/objects_partial delete mode 100644 test/sys/kernel/slab/Acpi-Parse/objs_per_slab delete mode 100644 test/sys/kernel/slab/Acpi-Parse/order delete mode 100644 test/sys/kernel/slab/Acpi-Parse/partial delete mode 100644 test/sys/kernel/slab/Acpi-Parse/poison delete mode 100644 test/sys/kernel/slab/Acpi-Parse/reclaim_account delete mode 100644 test/sys/kernel/slab/Acpi-Parse/red_zone delete mode 100644 test/sys/kernel/slab/Acpi-Parse/sanity_checks delete mode 100644 test/sys/kernel/slab/Acpi-Parse/shrink delete mode 100644 test/sys/kernel/slab/Acpi-Parse/slab_size delete mode 100644 test/sys/kernel/slab/Acpi-Parse/slabs delete mode 100644 test/sys/kernel/slab/Acpi-Parse/store_user delete mode 100644 test/sys/kernel/slab/Acpi-Parse/total_objects delete mode 100644 test/sys/kernel/slab/Acpi-Parse/trace delete mode 100644 test/sys/kernel/slab/Acpi-Parse/validate delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/aliases delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/align delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/alloc_calls delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/cache_dma delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/ctor delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/free_calls delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/hwcache_align delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/object_size delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/objects delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/objects_partial delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/order delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/partial delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/poison delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/reclaim_account delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/red_zone delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/sanity_checks delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/shrink delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/slab_size delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/slabs delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/store_user delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/total_objects delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/trace delete mode 100644 test/sys/kernel/slab/Acpi-ParseExt/validate delete mode 100644 test/sys/kernel/slab/Acpi-State/aliases delete mode 100644 test/sys/kernel/slab/Acpi-State/align delete mode 100644 test/sys/kernel/slab/Acpi-State/alloc_calls delete mode 100644 test/sys/kernel/slab/Acpi-State/cache_dma delete mode 100644 test/sys/kernel/slab/Acpi-State/cpu_slabs delete mode 100644 test/sys/kernel/slab/Acpi-State/ctor delete mode 100644 test/sys/kernel/slab/Acpi-State/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/Acpi-State/free_calls delete mode 100644 test/sys/kernel/slab/Acpi-State/hwcache_align delete mode 100644 test/sys/kernel/slab/Acpi-State/object_size delete mode 100644 test/sys/kernel/slab/Acpi-State/objects delete mode 100644 test/sys/kernel/slab/Acpi-State/objects_partial delete mode 100644 test/sys/kernel/slab/Acpi-State/objs_per_slab delete mode 100644 test/sys/kernel/slab/Acpi-State/order delete mode 100644 test/sys/kernel/slab/Acpi-State/partial delete mode 100644 test/sys/kernel/slab/Acpi-State/poison delete mode 100644 test/sys/kernel/slab/Acpi-State/reclaim_account delete mode 100644 test/sys/kernel/slab/Acpi-State/red_zone delete mode 100644 test/sys/kernel/slab/Acpi-State/sanity_checks delete mode 100644 test/sys/kernel/slab/Acpi-State/shrink delete mode 100644 test/sys/kernel/slab/Acpi-State/slab_size delete mode 100644 test/sys/kernel/slab/Acpi-State/slabs delete mode 100644 test/sys/kernel/slab/Acpi-State/store_user delete mode 100644 test/sys/kernel/slab/Acpi-State/total_objects delete mode 100644 test/sys/kernel/slab/Acpi-State/trace delete mode 100644 test/sys/kernel/slab/Acpi-State/validate delete mode 100644 test/sys/kernel/slab/RAW/aliases delete mode 100644 test/sys/kernel/slab/RAW/align delete mode 100644 test/sys/kernel/slab/RAW/alloc_calls delete mode 100644 test/sys/kernel/slab/RAW/cache_dma delete mode 100644 test/sys/kernel/slab/RAW/cpu_slabs delete mode 100644 test/sys/kernel/slab/RAW/ctor delete mode 100644 test/sys/kernel/slab/RAW/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/RAW/free_calls delete mode 100644 test/sys/kernel/slab/RAW/hwcache_align delete mode 100644 test/sys/kernel/slab/RAW/object_size delete mode 100644 test/sys/kernel/slab/RAW/objects delete mode 100644 test/sys/kernel/slab/RAW/objects_partial delete mode 100644 test/sys/kernel/slab/RAW/objs_per_slab delete mode 100644 test/sys/kernel/slab/RAW/order delete mode 100644 test/sys/kernel/slab/RAW/partial delete mode 100644 test/sys/kernel/slab/RAW/poison delete mode 100644 test/sys/kernel/slab/RAW/reclaim_account delete mode 100644 test/sys/kernel/slab/RAW/red_zone delete mode 100644 test/sys/kernel/slab/RAW/sanity_checks delete mode 100644 test/sys/kernel/slab/RAW/shrink delete mode 100644 test/sys/kernel/slab/RAW/slab_size delete mode 100644 test/sys/kernel/slab/RAW/slabs delete mode 100644 test/sys/kernel/slab/RAW/store_user delete mode 100644 test/sys/kernel/slab/RAW/total_objects delete mode 100644 test/sys/kernel/slab/RAW/trace delete mode 100644 test/sys/kernel/slab/RAW/validate delete mode 100644 test/sys/kernel/slab/RAWv6/aliases delete mode 100644 test/sys/kernel/slab/RAWv6/align delete mode 100644 test/sys/kernel/slab/RAWv6/alloc_calls delete mode 100644 test/sys/kernel/slab/RAWv6/cache_dma delete mode 100644 test/sys/kernel/slab/RAWv6/cpu_slabs delete mode 100644 test/sys/kernel/slab/RAWv6/ctor delete mode 100644 test/sys/kernel/slab/RAWv6/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/RAWv6/free_calls delete mode 100644 test/sys/kernel/slab/RAWv6/hwcache_align delete mode 100644 test/sys/kernel/slab/RAWv6/object_size delete mode 100644 test/sys/kernel/slab/RAWv6/objects delete mode 100644 test/sys/kernel/slab/RAWv6/objects_partial delete mode 100644 test/sys/kernel/slab/RAWv6/objs_per_slab delete mode 100644 test/sys/kernel/slab/RAWv6/order delete mode 100644 test/sys/kernel/slab/RAWv6/partial delete mode 100644 test/sys/kernel/slab/RAWv6/poison delete mode 100644 test/sys/kernel/slab/RAWv6/reclaim_account delete mode 100644 test/sys/kernel/slab/RAWv6/red_zone delete mode 100644 test/sys/kernel/slab/RAWv6/sanity_checks delete mode 100644 test/sys/kernel/slab/RAWv6/shrink delete mode 100644 test/sys/kernel/slab/RAWv6/slab_size delete mode 100644 test/sys/kernel/slab/RAWv6/slabs delete mode 100644 test/sys/kernel/slab/RAWv6/store_user delete mode 100644 test/sys/kernel/slab/RAWv6/total_objects delete mode 100644 test/sys/kernel/slab/RAWv6/trace delete mode 100644 test/sys/kernel/slab/RAWv6/validate delete mode 100644 test/sys/kernel/slab/TCP/aliases delete mode 100644 test/sys/kernel/slab/TCP/align delete mode 100644 test/sys/kernel/slab/TCP/alloc_calls delete mode 100644 test/sys/kernel/slab/TCP/cache_dma delete mode 100644 test/sys/kernel/slab/TCP/cpu_slabs delete mode 100644 test/sys/kernel/slab/TCP/ctor delete mode 100644 test/sys/kernel/slab/TCP/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/TCP/free_calls delete mode 100644 test/sys/kernel/slab/TCP/hwcache_align delete mode 100644 test/sys/kernel/slab/TCP/object_size delete mode 100644 test/sys/kernel/slab/TCP/objects delete mode 100644 test/sys/kernel/slab/TCP/objects_partial delete mode 100644 test/sys/kernel/slab/TCP/objs_per_slab delete mode 100644 test/sys/kernel/slab/TCP/order delete mode 100644 test/sys/kernel/slab/TCP/partial delete mode 100644 test/sys/kernel/slab/TCP/poison delete mode 100644 test/sys/kernel/slab/TCP/reclaim_account delete mode 100644 test/sys/kernel/slab/TCP/red_zone delete mode 100644 test/sys/kernel/slab/TCP/sanity_checks delete mode 100644 test/sys/kernel/slab/TCP/shrink delete mode 100644 test/sys/kernel/slab/TCP/slab_size delete mode 100644 test/sys/kernel/slab/TCP/slabs delete mode 100644 test/sys/kernel/slab/TCP/store_user delete mode 100644 test/sys/kernel/slab/TCP/total_objects delete mode 100644 test/sys/kernel/slab/TCP/trace delete mode 100644 test/sys/kernel/slab/TCP/validate delete mode 100644 test/sys/kernel/slab/TCPv6/aliases delete mode 100644 test/sys/kernel/slab/TCPv6/align delete mode 100644 test/sys/kernel/slab/TCPv6/alloc_calls delete mode 100644 test/sys/kernel/slab/TCPv6/cache_dma delete mode 100644 test/sys/kernel/slab/TCPv6/cpu_slabs delete mode 100644 test/sys/kernel/slab/TCPv6/ctor delete mode 100644 test/sys/kernel/slab/TCPv6/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/TCPv6/free_calls delete mode 100644 test/sys/kernel/slab/TCPv6/hwcache_align delete mode 100644 test/sys/kernel/slab/TCPv6/object_size delete mode 100644 test/sys/kernel/slab/TCPv6/objects delete mode 100644 test/sys/kernel/slab/TCPv6/objects_partial delete mode 100644 test/sys/kernel/slab/TCPv6/objs_per_slab delete mode 100644 test/sys/kernel/slab/TCPv6/order delete mode 100644 test/sys/kernel/slab/TCPv6/partial delete mode 100644 test/sys/kernel/slab/TCPv6/poison delete mode 100644 test/sys/kernel/slab/TCPv6/reclaim_account delete mode 100644 test/sys/kernel/slab/TCPv6/red_zone delete mode 100644 test/sys/kernel/slab/TCPv6/sanity_checks delete mode 100644 test/sys/kernel/slab/TCPv6/shrink delete mode 100644 test/sys/kernel/slab/TCPv6/slab_size delete mode 100644 test/sys/kernel/slab/TCPv6/slabs delete mode 100644 test/sys/kernel/slab/TCPv6/store_user delete mode 100644 test/sys/kernel/slab/TCPv6/total_objects delete mode 100644 test/sys/kernel/slab/TCPv6/trace delete mode 100644 test/sys/kernel/slab/TCPv6/validate delete mode 100644 test/sys/kernel/slab/UDP-Lite/aliases delete mode 100644 test/sys/kernel/slab/UDP-Lite/align delete mode 100644 test/sys/kernel/slab/UDP-Lite/alloc_calls delete mode 100644 test/sys/kernel/slab/UDP-Lite/cache_dma delete mode 100644 test/sys/kernel/slab/UDP-Lite/cpu_slabs delete mode 100644 test/sys/kernel/slab/UDP-Lite/ctor delete mode 100644 test/sys/kernel/slab/UDP-Lite/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/UDP-Lite/free_calls delete mode 100644 test/sys/kernel/slab/UDP-Lite/hwcache_align delete mode 100644 test/sys/kernel/slab/UDP-Lite/object_size delete mode 100644 test/sys/kernel/slab/UDP-Lite/objects delete mode 100644 test/sys/kernel/slab/UDP-Lite/objects_partial delete mode 100644 test/sys/kernel/slab/UDP-Lite/objs_per_slab delete mode 100644 test/sys/kernel/slab/UDP-Lite/order delete mode 100644 test/sys/kernel/slab/UDP-Lite/partial delete mode 100644 test/sys/kernel/slab/UDP-Lite/poison delete mode 100644 test/sys/kernel/slab/UDP-Lite/reclaim_account delete mode 100644 test/sys/kernel/slab/UDP-Lite/red_zone delete mode 100644 test/sys/kernel/slab/UDP-Lite/sanity_checks delete mode 100644 test/sys/kernel/slab/UDP-Lite/shrink delete mode 100644 test/sys/kernel/slab/UDP-Lite/slab_size delete mode 100644 test/sys/kernel/slab/UDP-Lite/slabs delete mode 100644 test/sys/kernel/slab/UDP-Lite/store_user delete mode 100644 test/sys/kernel/slab/UDP-Lite/total_objects delete mode 100644 test/sys/kernel/slab/UDP-Lite/trace delete mode 100644 test/sys/kernel/slab/UDP-Lite/validate delete mode 100644 test/sys/kernel/slab/UDP/aliases delete mode 100644 test/sys/kernel/slab/UDP/align delete mode 100644 test/sys/kernel/slab/UDP/alloc_calls delete mode 100644 test/sys/kernel/slab/UDP/cache_dma delete mode 100644 test/sys/kernel/slab/UDP/cpu_slabs delete mode 100644 test/sys/kernel/slab/UDP/ctor delete mode 100644 test/sys/kernel/slab/UDP/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/UDP/free_calls delete mode 100644 test/sys/kernel/slab/UDP/hwcache_align delete mode 100644 test/sys/kernel/slab/UDP/object_size delete mode 100644 test/sys/kernel/slab/UDP/objects delete mode 100644 test/sys/kernel/slab/UDP/objects_partial delete mode 100644 test/sys/kernel/slab/UDP/objs_per_slab delete mode 100644 test/sys/kernel/slab/UDP/order delete mode 100644 test/sys/kernel/slab/UDP/partial delete mode 100644 test/sys/kernel/slab/UDP/poison delete mode 100644 test/sys/kernel/slab/UDP/reclaim_account delete mode 100644 test/sys/kernel/slab/UDP/red_zone delete mode 100644 test/sys/kernel/slab/UDP/sanity_checks delete mode 100644 test/sys/kernel/slab/UDP/shrink delete mode 100644 test/sys/kernel/slab/UDP/slab_size delete mode 100644 test/sys/kernel/slab/UDP/slabs delete mode 100644 test/sys/kernel/slab/UDP/store_user delete mode 100644 test/sys/kernel/slab/UDP/total_objects delete mode 100644 test/sys/kernel/slab/UDP/trace delete mode 100644 test/sys/kernel/slab/UDP/validate delete mode 100644 test/sys/kernel/slab/UDPLITEv6/aliases delete mode 100644 test/sys/kernel/slab/UDPLITEv6/align delete mode 100644 test/sys/kernel/slab/UDPLITEv6/alloc_calls delete mode 100644 test/sys/kernel/slab/UDPLITEv6/cache_dma delete mode 100644 test/sys/kernel/slab/UDPLITEv6/cpu_slabs delete mode 100644 test/sys/kernel/slab/UDPLITEv6/ctor delete mode 100644 test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/UDPLITEv6/free_calls delete mode 100644 test/sys/kernel/slab/UDPLITEv6/hwcache_align delete mode 100644 test/sys/kernel/slab/UDPLITEv6/object_size delete mode 100644 test/sys/kernel/slab/UDPLITEv6/objects delete mode 100644 test/sys/kernel/slab/UDPLITEv6/objects_partial delete mode 100644 test/sys/kernel/slab/UDPLITEv6/objs_per_slab delete mode 100644 test/sys/kernel/slab/UDPLITEv6/order delete mode 100644 test/sys/kernel/slab/UDPLITEv6/partial delete mode 100644 test/sys/kernel/slab/UDPLITEv6/poison delete mode 100644 test/sys/kernel/slab/UDPLITEv6/reclaim_account delete mode 100644 test/sys/kernel/slab/UDPLITEv6/red_zone delete mode 100644 test/sys/kernel/slab/UDPLITEv6/sanity_checks delete mode 100644 test/sys/kernel/slab/UDPLITEv6/shrink delete mode 100644 test/sys/kernel/slab/UDPLITEv6/slab_size delete mode 100644 test/sys/kernel/slab/UDPLITEv6/slabs delete mode 100644 test/sys/kernel/slab/UDPLITEv6/store_user delete mode 100644 test/sys/kernel/slab/UDPLITEv6/total_objects delete mode 100644 test/sys/kernel/slab/UDPLITEv6/trace delete mode 100644 test/sys/kernel/slab/UDPLITEv6/validate delete mode 100644 test/sys/kernel/slab/UDPv6/aliases delete mode 100644 test/sys/kernel/slab/UDPv6/align delete mode 100644 test/sys/kernel/slab/UDPv6/alloc_calls delete mode 100644 test/sys/kernel/slab/UDPv6/cache_dma delete mode 100644 test/sys/kernel/slab/UDPv6/cpu_slabs delete mode 100644 test/sys/kernel/slab/UDPv6/ctor delete mode 100644 test/sys/kernel/slab/UDPv6/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/UDPv6/free_calls delete mode 100644 test/sys/kernel/slab/UDPv6/hwcache_align delete mode 100644 test/sys/kernel/slab/UDPv6/object_size delete mode 100644 test/sys/kernel/slab/UDPv6/objects delete mode 100644 test/sys/kernel/slab/UDPv6/objects_partial delete mode 100644 test/sys/kernel/slab/UDPv6/objs_per_slab delete mode 100644 test/sys/kernel/slab/UDPv6/order delete mode 100644 test/sys/kernel/slab/UDPv6/partial delete mode 100644 test/sys/kernel/slab/UDPv6/poison delete mode 100644 test/sys/kernel/slab/UDPv6/reclaim_account delete mode 100644 test/sys/kernel/slab/UDPv6/red_zone delete mode 100644 test/sys/kernel/slab/UDPv6/sanity_checks delete mode 100644 test/sys/kernel/slab/UDPv6/shrink delete mode 100644 test/sys/kernel/slab/UDPv6/slab_size delete mode 100644 test/sys/kernel/slab/UDPv6/slabs delete mode 100644 test/sys/kernel/slab/UDPv6/store_user delete mode 100644 test/sys/kernel/slab/UDPv6/total_objects delete mode 100644 test/sys/kernel/slab/UDPv6/trace delete mode 100644 test/sys/kernel/slab/UDPv6/validate delete mode 100644 test/sys/kernel/slab/UNIX/aliases delete mode 100644 test/sys/kernel/slab/UNIX/align delete mode 100644 test/sys/kernel/slab/UNIX/alloc_calls delete mode 100644 test/sys/kernel/slab/UNIX/cache_dma delete mode 100644 test/sys/kernel/slab/UNIX/cpu_slabs delete mode 100644 test/sys/kernel/slab/UNIX/ctor delete mode 100644 test/sys/kernel/slab/UNIX/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/UNIX/free_calls delete mode 100644 test/sys/kernel/slab/UNIX/hwcache_align delete mode 100644 test/sys/kernel/slab/UNIX/object_size delete mode 100644 test/sys/kernel/slab/UNIX/objects delete mode 100644 test/sys/kernel/slab/UNIX/objects_partial delete mode 100644 test/sys/kernel/slab/UNIX/objs_per_slab delete mode 100644 test/sys/kernel/slab/UNIX/order delete mode 100644 test/sys/kernel/slab/UNIX/partial delete mode 100644 test/sys/kernel/slab/UNIX/poison delete mode 100644 test/sys/kernel/slab/UNIX/reclaim_account delete mode 100644 test/sys/kernel/slab/UNIX/red_zone delete mode 100644 test/sys/kernel/slab/UNIX/sanity_checks delete mode 100644 test/sys/kernel/slab/UNIX/shrink delete mode 100644 test/sys/kernel/slab/UNIX/slab_size delete mode 100644 test/sys/kernel/slab/UNIX/slabs delete mode 100644 test/sys/kernel/slab/UNIX/store_user delete mode 100644 test/sys/kernel/slab/UNIX/total_objects delete mode 100644 test/sys/kernel/slab/UNIX/trace delete mode 100644 test/sys/kernel/slab/UNIX/validate delete mode 100644 test/sys/kernel/slab/anon_vma/aliases delete mode 100644 test/sys/kernel/slab/anon_vma/align delete mode 100644 test/sys/kernel/slab/anon_vma/alloc_calls delete mode 100644 test/sys/kernel/slab/anon_vma/cache_dma delete mode 100644 test/sys/kernel/slab/anon_vma/cpu_slabs delete mode 100644 test/sys/kernel/slab/anon_vma/ctor delete mode 100644 test/sys/kernel/slab/anon_vma/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/anon_vma/free_calls delete mode 100644 test/sys/kernel/slab/anon_vma/hwcache_align delete mode 100644 test/sys/kernel/slab/anon_vma/object_size delete mode 100644 test/sys/kernel/slab/anon_vma/objects delete mode 100644 test/sys/kernel/slab/anon_vma/objects_partial delete mode 100644 test/sys/kernel/slab/anon_vma/objs_per_slab delete mode 100644 test/sys/kernel/slab/anon_vma/order delete mode 100644 test/sys/kernel/slab/anon_vma/partial delete mode 100644 test/sys/kernel/slab/anon_vma/poison delete mode 100644 test/sys/kernel/slab/anon_vma/reclaim_account delete mode 100644 test/sys/kernel/slab/anon_vma/red_zone delete mode 100644 test/sys/kernel/slab/anon_vma/sanity_checks delete mode 100644 test/sys/kernel/slab/anon_vma/shrink delete mode 100644 test/sys/kernel/slab/anon_vma/slab_size delete mode 100644 test/sys/kernel/slab/anon_vma/slabs delete mode 100644 test/sys/kernel/slab/anon_vma/store_user delete mode 100644 test/sys/kernel/slab/anon_vma/total_objects delete mode 100644 test/sys/kernel/slab/anon_vma/trace delete mode 100644 test/sys/kernel/slab/anon_vma/validate delete mode 100644 test/sys/kernel/slab/arp_cache/aliases delete mode 100644 test/sys/kernel/slab/arp_cache/align delete mode 100644 test/sys/kernel/slab/arp_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/arp_cache/cache_dma delete mode 100644 test/sys/kernel/slab/arp_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/arp_cache/ctor delete mode 100644 test/sys/kernel/slab/arp_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/arp_cache/free_calls delete mode 100644 test/sys/kernel/slab/arp_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/arp_cache/object_size delete mode 100644 test/sys/kernel/slab/arp_cache/objects delete mode 100644 test/sys/kernel/slab/arp_cache/objects_partial delete mode 100644 test/sys/kernel/slab/arp_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/arp_cache/order delete mode 100644 test/sys/kernel/slab/arp_cache/partial delete mode 100644 test/sys/kernel/slab/arp_cache/poison delete mode 100644 test/sys/kernel/slab/arp_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/arp_cache/red_zone delete mode 100644 test/sys/kernel/slab/arp_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/arp_cache/shrink delete mode 100644 test/sys/kernel/slab/arp_cache/slab_size delete mode 100644 test/sys/kernel/slab/arp_cache/slabs delete mode 100644 test/sys/kernel/slab/arp_cache/store_user delete mode 100644 test/sys/kernel/slab/arp_cache/total_objects delete mode 100644 test/sys/kernel/slab/arp_cache/trace delete mode 100644 test/sys/kernel/slab/arp_cache/validate delete mode 100644 test/sys/kernel/slab/bdev_cache/aliases delete mode 100644 test/sys/kernel/slab/bdev_cache/align delete mode 100644 test/sys/kernel/slab/bdev_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/bdev_cache/cache_dma delete mode 100644 test/sys/kernel/slab/bdev_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/bdev_cache/ctor delete mode 100644 test/sys/kernel/slab/bdev_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/bdev_cache/free_calls delete mode 100644 test/sys/kernel/slab/bdev_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/bdev_cache/object_size delete mode 100644 test/sys/kernel/slab/bdev_cache/objects delete mode 100644 test/sys/kernel/slab/bdev_cache/objects_partial delete mode 100644 test/sys/kernel/slab/bdev_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/bdev_cache/order delete mode 100644 test/sys/kernel/slab/bdev_cache/partial delete mode 100644 test/sys/kernel/slab/bdev_cache/poison delete mode 100644 test/sys/kernel/slab/bdev_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/bdev_cache/red_zone delete mode 100644 test/sys/kernel/slab/bdev_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/bdev_cache/shrink delete mode 100644 test/sys/kernel/slab/bdev_cache/slab_size delete mode 100644 test/sys/kernel/slab/bdev_cache/slabs delete mode 100644 test/sys/kernel/slab/bdev_cache/store_user delete mode 100644 test/sys/kernel/slab/bdev_cache/total_objects delete mode 100644 test/sys/kernel/slab/bdev_cache/trace delete mode 100644 test/sys/kernel/slab/bdev_cache/validate delete mode 100644 test/sys/kernel/slab/bio/aliases delete mode 100644 test/sys/kernel/slab/bio/align delete mode 100644 test/sys/kernel/slab/bio/alloc_calls delete mode 100644 test/sys/kernel/slab/bio/cache_dma delete mode 100644 test/sys/kernel/slab/bio/cpu_slabs delete mode 100644 test/sys/kernel/slab/bio/ctor delete mode 100644 test/sys/kernel/slab/bio/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/bio/free_calls delete mode 100644 test/sys/kernel/slab/bio/hwcache_align delete mode 100644 test/sys/kernel/slab/bio/object_size delete mode 100644 test/sys/kernel/slab/bio/objects delete mode 100644 test/sys/kernel/slab/bio/objects_partial delete mode 100644 test/sys/kernel/slab/bio/objs_per_slab delete mode 100644 test/sys/kernel/slab/bio/order delete mode 100644 test/sys/kernel/slab/bio/partial delete mode 100644 test/sys/kernel/slab/bio/poison delete mode 100644 test/sys/kernel/slab/bio/reclaim_account delete mode 100644 test/sys/kernel/slab/bio/red_zone delete mode 100644 test/sys/kernel/slab/bio/sanity_checks delete mode 100644 test/sys/kernel/slab/bio/shrink delete mode 100644 test/sys/kernel/slab/bio/slab_size delete mode 100644 test/sys/kernel/slab/bio/slabs delete mode 100644 test/sys/kernel/slab/bio/store_user delete mode 100644 test/sys/kernel/slab/bio/total_objects delete mode 100644 test/sys/kernel/slab/bio/trace delete mode 100644 test/sys/kernel/slab/bio/validate delete mode 100644 test/sys/kernel/slab/biovec-1/aliases delete mode 100644 test/sys/kernel/slab/biovec-1/align delete mode 100644 test/sys/kernel/slab/biovec-1/alloc_calls delete mode 100644 test/sys/kernel/slab/biovec-1/cache_dma delete mode 100644 test/sys/kernel/slab/biovec-1/cpu_slabs delete mode 100644 test/sys/kernel/slab/biovec-1/ctor delete mode 100644 test/sys/kernel/slab/biovec-1/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/biovec-1/free_calls delete mode 100644 test/sys/kernel/slab/biovec-1/hwcache_align delete mode 100644 test/sys/kernel/slab/biovec-1/object_size delete mode 100644 test/sys/kernel/slab/biovec-1/objects delete mode 100644 test/sys/kernel/slab/biovec-1/objects_partial delete mode 100644 test/sys/kernel/slab/biovec-1/objs_per_slab delete mode 100644 test/sys/kernel/slab/biovec-1/order delete mode 100644 test/sys/kernel/slab/biovec-1/partial delete mode 100644 test/sys/kernel/slab/biovec-1/poison delete mode 100644 test/sys/kernel/slab/biovec-1/reclaim_account delete mode 100644 test/sys/kernel/slab/biovec-1/red_zone delete mode 100644 test/sys/kernel/slab/biovec-1/sanity_checks delete mode 100644 test/sys/kernel/slab/biovec-1/shrink delete mode 100644 test/sys/kernel/slab/biovec-1/slab_size delete mode 100644 test/sys/kernel/slab/biovec-1/slabs delete mode 100644 test/sys/kernel/slab/biovec-1/store_user delete mode 100644 test/sys/kernel/slab/biovec-1/total_objects delete mode 100644 test/sys/kernel/slab/biovec-1/trace delete mode 100644 test/sys/kernel/slab/biovec-1/validate delete mode 100644 test/sys/kernel/slab/biovec-128/aliases delete mode 100644 test/sys/kernel/slab/biovec-128/align delete mode 100644 test/sys/kernel/slab/biovec-128/alloc_calls delete mode 100644 test/sys/kernel/slab/biovec-128/cache_dma delete mode 100644 test/sys/kernel/slab/biovec-128/cpu_slabs delete mode 100644 test/sys/kernel/slab/biovec-128/ctor delete mode 100644 test/sys/kernel/slab/biovec-128/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/biovec-128/free_calls delete mode 100644 test/sys/kernel/slab/biovec-128/hwcache_align delete mode 100644 test/sys/kernel/slab/biovec-128/object_size delete mode 100644 test/sys/kernel/slab/biovec-128/objects delete mode 100644 test/sys/kernel/slab/biovec-128/objects_partial delete mode 100644 test/sys/kernel/slab/biovec-128/objs_per_slab delete mode 100644 test/sys/kernel/slab/biovec-128/order delete mode 100644 test/sys/kernel/slab/biovec-128/partial delete mode 100644 test/sys/kernel/slab/biovec-128/poison delete mode 100644 test/sys/kernel/slab/biovec-128/reclaim_account delete mode 100644 test/sys/kernel/slab/biovec-128/red_zone delete mode 100644 test/sys/kernel/slab/biovec-128/sanity_checks delete mode 100644 test/sys/kernel/slab/biovec-128/shrink delete mode 100644 test/sys/kernel/slab/biovec-128/slab_size delete mode 100644 test/sys/kernel/slab/biovec-128/slabs delete mode 100644 test/sys/kernel/slab/biovec-128/store_user delete mode 100644 test/sys/kernel/slab/biovec-128/total_objects delete mode 100644 test/sys/kernel/slab/biovec-128/trace delete mode 100644 test/sys/kernel/slab/biovec-128/validate delete mode 100644 test/sys/kernel/slab/biovec-16/aliases delete mode 100644 test/sys/kernel/slab/biovec-16/align delete mode 100644 test/sys/kernel/slab/biovec-16/alloc_calls delete mode 100644 test/sys/kernel/slab/biovec-16/cache_dma delete mode 100644 test/sys/kernel/slab/biovec-16/cpu_slabs delete mode 100644 test/sys/kernel/slab/biovec-16/ctor delete mode 100644 test/sys/kernel/slab/biovec-16/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/biovec-16/free_calls delete mode 100644 test/sys/kernel/slab/biovec-16/hwcache_align delete mode 100644 test/sys/kernel/slab/biovec-16/object_size delete mode 100644 test/sys/kernel/slab/biovec-16/objects delete mode 100644 test/sys/kernel/slab/biovec-16/objects_partial delete mode 100644 test/sys/kernel/slab/biovec-16/objs_per_slab delete mode 100644 test/sys/kernel/slab/biovec-16/order delete mode 100644 test/sys/kernel/slab/biovec-16/partial delete mode 100644 test/sys/kernel/slab/biovec-16/poison delete mode 100644 test/sys/kernel/slab/biovec-16/reclaim_account delete mode 100644 test/sys/kernel/slab/biovec-16/red_zone delete mode 100644 test/sys/kernel/slab/biovec-16/sanity_checks delete mode 100644 test/sys/kernel/slab/biovec-16/shrink delete mode 100644 test/sys/kernel/slab/biovec-16/slab_size delete mode 100644 test/sys/kernel/slab/biovec-16/slabs delete mode 100644 test/sys/kernel/slab/biovec-16/store_user delete mode 100644 test/sys/kernel/slab/biovec-16/total_objects delete mode 100644 test/sys/kernel/slab/biovec-16/trace delete mode 100644 test/sys/kernel/slab/biovec-16/validate delete mode 100644 test/sys/kernel/slab/biovec-256/aliases delete mode 100644 test/sys/kernel/slab/biovec-256/align delete mode 100644 test/sys/kernel/slab/biovec-256/alloc_calls delete mode 100644 test/sys/kernel/slab/biovec-256/cache_dma delete mode 100644 test/sys/kernel/slab/biovec-256/cpu_slabs delete mode 100644 test/sys/kernel/slab/biovec-256/ctor delete mode 100644 test/sys/kernel/slab/biovec-256/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/biovec-256/free_calls delete mode 100644 test/sys/kernel/slab/biovec-256/hwcache_align delete mode 100644 test/sys/kernel/slab/biovec-256/object_size delete mode 100644 test/sys/kernel/slab/biovec-256/objects delete mode 100644 test/sys/kernel/slab/biovec-256/objects_partial delete mode 100644 test/sys/kernel/slab/biovec-256/objs_per_slab delete mode 100644 test/sys/kernel/slab/biovec-256/order delete mode 100644 test/sys/kernel/slab/biovec-256/partial delete mode 100644 test/sys/kernel/slab/biovec-256/poison delete mode 100644 test/sys/kernel/slab/biovec-256/reclaim_account delete mode 100644 test/sys/kernel/slab/biovec-256/red_zone delete mode 100644 test/sys/kernel/slab/biovec-256/sanity_checks delete mode 100644 test/sys/kernel/slab/biovec-256/shrink delete mode 100644 test/sys/kernel/slab/biovec-256/slab_size delete mode 100644 test/sys/kernel/slab/biovec-256/slabs delete mode 100644 test/sys/kernel/slab/biovec-256/store_user delete mode 100644 test/sys/kernel/slab/biovec-256/total_objects delete mode 100644 test/sys/kernel/slab/biovec-256/trace delete mode 100644 test/sys/kernel/slab/biovec-256/validate delete mode 100644 test/sys/kernel/slab/biovec-4/aliases delete mode 100644 test/sys/kernel/slab/biovec-4/align delete mode 100644 test/sys/kernel/slab/biovec-4/alloc_calls delete mode 100644 test/sys/kernel/slab/biovec-4/cache_dma delete mode 100644 test/sys/kernel/slab/biovec-4/cpu_slabs delete mode 100644 test/sys/kernel/slab/biovec-4/ctor delete mode 100644 test/sys/kernel/slab/biovec-4/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/biovec-4/free_calls delete mode 100644 test/sys/kernel/slab/biovec-4/hwcache_align delete mode 100644 test/sys/kernel/slab/biovec-4/object_size delete mode 100644 test/sys/kernel/slab/biovec-4/objects delete mode 100644 test/sys/kernel/slab/biovec-4/objects_partial delete mode 100644 test/sys/kernel/slab/biovec-4/objs_per_slab delete mode 100644 test/sys/kernel/slab/biovec-4/order delete mode 100644 test/sys/kernel/slab/biovec-4/partial delete mode 100644 test/sys/kernel/slab/biovec-4/poison delete mode 100644 test/sys/kernel/slab/biovec-4/reclaim_account delete mode 100644 test/sys/kernel/slab/biovec-4/red_zone delete mode 100644 test/sys/kernel/slab/biovec-4/sanity_checks delete mode 100644 test/sys/kernel/slab/biovec-4/shrink delete mode 100644 test/sys/kernel/slab/biovec-4/slab_size delete mode 100644 test/sys/kernel/slab/biovec-4/slabs delete mode 100644 test/sys/kernel/slab/biovec-4/store_user delete mode 100644 test/sys/kernel/slab/biovec-4/total_objects delete mode 100644 test/sys/kernel/slab/biovec-4/trace delete mode 100644 test/sys/kernel/slab/biovec-4/validate delete mode 100644 test/sys/kernel/slab/biovec-64/aliases delete mode 100644 test/sys/kernel/slab/biovec-64/align delete mode 100644 test/sys/kernel/slab/biovec-64/alloc_calls delete mode 100644 test/sys/kernel/slab/biovec-64/cache_dma delete mode 100644 test/sys/kernel/slab/biovec-64/cpu_slabs delete mode 100644 test/sys/kernel/slab/biovec-64/ctor delete mode 100644 test/sys/kernel/slab/biovec-64/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/biovec-64/free_calls delete mode 100644 test/sys/kernel/slab/biovec-64/hwcache_align delete mode 100644 test/sys/kernel/slab/biovec-64/object_size delete mode 100644 test/sys/kernel/slab/biovec-64/objects delete mode 100644 test/sys/kernel/slab/biovec-64/objects_partial delete mode 100644 test/sys/kernel/slab/biovec-64/objs_per_slab delete mode 100644 test/sys/kernel/slab/biovec-64/order delete mode 100644 test/sys/kernel/slab/biovec-64/partial delete mode 100644 test/sys/kernel/slab/biovec-64/poison delete mode 100644 test/sys/kernel/slab/biovec-64/reclaim_account delete mode 100644 test/sys/kernel/slab/biovec-64/red_zone delete mode 100644 test/sys/kernel/slab/biovec-64/sanity_checks delete mode 100644 test/sys/kernel/slab/biovec-64/shrink delete mode 100644 test/sys/kernel/slab/biovec-64/slab_size delete mode 100644 test/sys/kernel/slab/biovec-64/slabs delete mode 100644 test/sys/kernel/slab/biovec-64/store_user delete mode 100644 test/sys/kernel/slab/biovec-64/total_objects delete mode 100644 test/sys/kernel/slab/biovec-64/trace delete mode 100644 test/sys/kernel/slab/biovec-64/validate delete mode 100644 test/sys/kernel/slab/blkdev_ioc/aliases delete mode 100644 test/sys/kernel/slab/blkdev_ioc/align delete mode 100644 test/sys/kernel/slab/blkdev_ioc/alloc_calls delete mode 100644 test/sys/kernel/slab/blkdev_ioc/cache_dma delete mode 100644 test/sys/kernel/slab/blkdev_ioc/cpu_slabs delete mode 100644 test/sys/kernel/slab/blkdev_ioc/ctor delete mode 100644 test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/blkdev_ioc/free_calls delete mode 100644 test/sys/kernel/slab/blkdev_ioc/hwcache_align delete mode 100644 test/sys/kernel/slab/blkdev_ioc/object_size delete mode 100644 test/sys/kernel/slab/blkdev_ioc/objects delete mode 100644 test/sys/kernel/slab/blkdev_ioc/objects_partial delete mode 100644 test/sys/kernel/slab/blkdev_ioc/objs_per_slab delete mode 100644 test/sys/kernel/slab/blkdev_ioc/order delete mode 100644 test/sys/kernel/slab/blkdev_ioc/partial delete mode 100644 test/sys/kernel/slab/blkdev_ioc/poison delete mode 100644 test/sys/kernel/slab/blkdev_ioc/reclaim_account delete mode 100644 test/sys/kernel/slab/blkdev_ioc/red_zone delete mode 100644 test/sys/kernel/slab/blkdev_ioc/sanity_checks delete mode 100644 test/sys/kernel/slab/blkdev_ioc/shrink delete mode 100644 test/sys/kernel/slab/blkdev_ioc/slab_size delete mode 100644 test/sys/kernel/slab/blkdev_ioc/slabs delete mode 100644 test/sys/kernel/slab/blkdev_ioc/store_user delete mode 100644 test/sys/kernel/slab/blkdev_ioc/total_objects delete mode 100644 test/sys/kernel/slab/blkdev_ioc/trace delete mode 100644 test/sys/kernel/slab/blkdev_ioc/validate delete mode 100644 test/sys/kernel/slab/blkdev_queue/aliases delete mode 100644 test/sys/kernel/slab/blkdev_queue/align delete mode 100644 test/sys/kernel/slab/blkdev_queue/alloc_calls delete mode 100644 test/sys/kernel/slab/blkdev_queue/cache_dma delete mode 100644 test/sys/kernel/slab/blkdev_queue/cpu_slabs delete mode 100644 test/sys/kernel/slab/blkdev_queue/ctor delete mode 100644 test/sys/kernel/slab/blkdev_queue/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/blkdev_queue/free_calls delete mode 100644 test/sys/kernel/slab/blkdev_queue/hwcache_align delete mode 100644 test/sys/kernel/slab/blkdev_queue/object_size delete mode 100644 test/sys/kernel/slab/blkdev_queue/objects delete mode 100644 test/sys/kernel/slab/blkdev_queue/objects_partial delete mode 100644 test/sys/kernel/slab/blkdev_queue/objs_per_slab delete mode 100644 test/sys/kernel/slab/blkdev_queue/order delete mode 100644 test/sys/kernel/slab/blkdev_queue/partial delete mode 100644 test/sys/kernel/slab/blkdev_queue/poison delete mode 100644 test/sys/kernel/slab/blkdev_queue/reclaim_account delete mode 100644 test/sys/kernel/slab/blkdev_queue/red_zone delete mode 100644 test/sys/kernel/slab/blkdev_queue/sanity_checks delete mode 100644 test/sys/kernel/slab/blkdev_queue/shrink delete mode 100644 test/sys/kernel/slab/blkdev_queue/slab_size delete mode 100644 test/sys/kernel/slab/blkdev_queue/slabs delete mode 100644 test/sys/kernel/slab/blkdev_queue/store_user delete mode 100644 test/sys/kernel/slab/blkdev_queue/total_objects delete mode 100644 test/sys/kernel/slab/blkdev_queue/trace delete mode 100644 test/sys/kernel/slab/blkdev_queue/validate delete mode 100644 test/sys/kernel/slab/blkdev_requests/aliases delete mode 100644 test/sys/kernel/slab/blkdev_requests/align delete mode 100644 test/sys/kernel/slab/blkdev_requests/alloc_calls delete mode 100644 test/sys/kernel/slab/blkdev_requests/cache_dma delete mode 100644 test/sys/kernel/slab/blkdev_requests/cpu_slabs delete mode 100644 test/sys/kernel/slab/blkdev_requests/ctor delete mode 100644 test/sys/kernel/slab/blkdev_requests/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/blkdev_requests/free_calls delete mode 100644 test/sys/kernel/slab/blkdev_requests/hwcache_align delete mode 100644 test/sys/kernel/slab/blkdev_requests/object_size delete mode 100644 test/sys/kernel/slab/blkdev_requests/objects delete mode 100644 test/sys/kernel/slab/blkdev_requests/objects_partial delete mode 100644 test/sys/kernel/slab/blkdev_requests/objs_per_slab delete mode 100644 test/sys/kernel/slab/blkdev_requests/order delete mode 100644 test/sys/kernel/slab/blkdev_requests/partial delete mode 100644 test/sys/kernel/slab/blkdev_requests/poison delete mode 100644 test/sys/kernel/slab/blkdev_requests/reclaim_account delete mode 100644 test/sys/kernel/slab/blkdev_requests/red_zone delete mode 100644 test/sys/kernel/slab/blkdev_requests/sanity_checks delete mode 100644 test/sys/kernel/slab/blkdev_requests/shrink delete mode 100644 test/sys/kernel/slab/blkdev_requests/slab_size delete mode 100644 test/sys/kernel/slab/blkdev_requests/slabs delete mode 100644 test/sys/kernel/slab/blkdev_requests/store_user delete mode 100644 test/sys/kernel/slab/blkdev_requests/total_objects delete mode 100644 test/sys/kernel/slab/blkdev_requests/trace delete mode 100644 test/sys/kernel/slab/blkdev_requests/validate delete mode 100644 test/sys/kernel/slab/bsg_cmd/aliases delete mode 100644 test/sys/kernel/slab/bsg_cmd/align delete mode 100644 test/sys/kernel/slab/bsg_cmd/alloc_calls delete mode 100644 test/sys/kernel/slab/bsg_cmd/cache_dma delete mode 100644 test/sys/kernel/slab/bsg_cmd/cpu_slabs delete mode 100644 test/sys/kernel/slab/bsg_cmd/ctor delete mode 100644 test/sys/kernel/slab/bsg_cmd/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/bsg_cmd/free_calls delete mode 100644 test/sys/kernel/slab/bsg_cmd/hwcache_align delete mode 100644 test/sys/kernel/slab/bsg_cmd/object_size delete mode 100644 test/sys/kernel/slab/bsg_cmd/objects delete mode 100644 test/sys/kernel/slab/bsg_cmd/objects_partial delete mode 100644 test/sys/kernel/slab/bsg_cmd/objs_per_slab delete mode 100644 test/sys/kernel/slab/bsg_cmd/order delete mode 100644 test/sys/kernel/slab/bsg_cmd/partial delete mode 100644 test/sys/kernel/slab/bsg_cmd/poison delete mode 100644 test/sys/kernel/slab/bsg_cmd/reclaim_account delete mode 100644 test/sys/kernel/slab/bsg_cmd/red_zone delete mode 100644 test/sys/kernel/slab/bsg_cmd/sanity_checks delete mode 100644 test/sys/kernel/slab/bsg_cmd/shrink delete mode 100644 test/sys/kernel/slab/bsg_cmd/slab_size delete mode 100644 test/sys/kernel/slab/bsg_cmd/slabs delete mode 100644 test/sys/kernel/slab/bsg_cmd/store_user delete mode 100644 test/sys/kernel/slab/bsg_cmd/total_objects delete mode 100644 test/sys/kernel/slab/bsg_cmd/trace delete mode 100644 test/sys/kernel/slab/bsg_cmd/validate delete mode 100644 test/sys/kernel/slab/buffer_head/aliases delete mode 100644 test/sys/kernel/slab/buffer_head/align delete mode 100644 test/sys/kernel/slab/buffer_head/alloc_calls delete mode 100644 test/sys/kernel/slab/buffer_head/cache_dma delete mode 100644 test/sys/kernel/slab/buffer_head/cpu_slabs delete mode 100644 test/sys/kernel/slab/buffer_head/ctor delete mode 100644 test/sys/kernel/slab/buffer_head/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/buffer_head/free_calls delete mode 100644 test/sys/kernel/slab/buffer_head/hwcache_align delete mode 100644 test/sys/kernel/slab/buffer_head/object_size delete mode 100644 test/sys/kernel/slab/buffer_head/objects delete mode 100644 test/sys/kernel/slab/buffer_head/objects_partial delete mode 100644 test/sys/kernel/slab/buffer_head/objs_per_slab delete mode 100644 test/sys/kernel/slab/buffer_head/order delete mode 100644 test/sys/kernel/slab/buffer_head/partial delete mode 100644 test/sys/kernel/slab/buffer_head/poison delete mode 100644 test/sys/kernel/slab/buffer_head/reclaim_account delete mode 100644 test/sys/kernel/slab/buffer_head/red_zone delete mode 100644 test/sys/kernel/slab/buffer_head/sanity_checks delete mode 100644 test/sys/kernel/slab/buffer_head/shrink delete mode 100644 test/sys/kernel/slab/buffer_head/slab_size delete mode 100644 test/sys/kernel/slab/buffer_head/slabs delete mode 100644 test/sys/kernel/slab/buffer_head/store_user delete mode 100644 test/sys/kernel/slab/buffer_head/total_objects delete mode 100644 test/sys/kernel/slab/buffer_head/trace delete mode 100644 test/sys/kernel/slab/buffer_head/validate delete mode 100644 test/sys/kernel/slab/cfq_io_context/aliases delete mode 100644 test/sys/kernel/slab/cfq_io_context/align delete mode 100644 test/sys/kernel/slab/cfq_io_context/alloc_calls delete mode 100644 test/sys/kernel/slab/cfq_io_context/cache_dma delete mode 100644 test/sys/kernel/slab/cfq_io_context/cpu_slabs delete mode 100644 test/sys/kernel/slab/cfq_io_context/ctor delete mode 100644 test/sys/kernel/slab/cfq_io_context/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/cfq_io_context/free_calls delete mode 100644 test/sys/kernel/slab/cfq_io_context/hwcache_align delete mode 100644 test/sys/kernel/slab/cfq_io_context/object_size delete mode 100644 test/sys/kernel/slab/cfq_io_context/objects delete mode 100644 test/sys/kernel/slab/cfq_io_context/objects_partial delete mode 100644 test/sys/kernel/slab/cfq_io_context/objs_per_slab delete mode 100644 test/sys/kernel/slab/cfq_io_context/order delete mode 100644 test/sys/kernel/slab/cfq_io_context/partial delete mode 100644 test/sys/kernel/slab/cfq_io_context/poison delete mode 100644 test/sys/kernel/slab/cfq_io_context/reclaim_account delete mode 100644 test/sys/kernel/slab/cfq_io_context/red_zone delete mode 100644 test/sys/kernel/slab/cfq_io_context/sanity_checks delete mode 100644 test/sys/kernel/slab/cfq_io_context/shrink delete mode 100644 test/sys/kernel/slab/cfq_io_context/slab_size delete mode 100644 test/sys/kernel/slab/cfq_io_context/slabs delete mode 100644 test/sys/kernel/slab/cfq_io_context/store_user delete mode 100644 test/sys/kernel/slab/cfq_io_context/total_objects delete mode 100644 test/sys/kernel/slab/cfq_io_context/trace delete mode 100644 test/sys/kernel/slab/cfq_io_context/validate delete mode 100644 test/sys/kernel/slab/cfq_queue/aliases delete mode 100644 test/sys/kernel/slab/cfq_queue/align delete mode 100644 test/sys/kernel/slab/cfq_queue/alloc_calls delete mode 100644 test/sys/kernel/slab/cfq_queue/cache_dma delete mode 100644 test/sys/kernel/slab/cfq_queue/cpu_slabs delete mode 100644 test/sys/kernel/slab/cfq_queue/ctor delete mode 100644 test/sys/kernel/slab/cfq_queue/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/cfq_queue/free_calls delete mode 100644 test/sys/kernel/slab/cfq_queue/hwcache_align delete mode 100644 test/sys/kernel/slab/cfq_queue/object_size delete mode 100644 test/sys/kernel/slab/cfq_queue/objects delete mode 100644 test/sys/kernel/slab/cfq_queue/objects_partial delete mode 100644 test/sys/kernel/slab/cfq_queue/objs_per_slab delete mode 100644 test/sys/kernel/slab/cfq_queue/order delete mode 100644 test/sys/kernel/slab/cfq_queue/partial delete mode 100644 test/sys/kernel/slab/cfq_queue/poison delete mode 100644 test/sys/kernel/slab/cfq_queue/reclaim_account delete mode 100644 test/sys/kernel/slab/cfq_queue/red_zone delete mode 100644 test/sys/kernel/slab/cfq_queue/sanity_checks delete mode 100644 test/sys/kernel/slab/cfq_queue/shrink delete mode 100644 test/sys/kernel/slab/cfq_queue/slab_size delete mode 100644 test/sys/kernel/slab/cfq_queue/slabs delete mode 100644 test/sys/kernel/slab/cfq_queue/store_user delete mode 100644 test/sys/kernel/slab/cfq_queue/total_objects delete mode 100644 test/sys/kernel/slab/cfq_queue/trace delete mode 100644 test/sys/kernel/slab/cfq_queue/validate delete mode 100644 test/sys/kernel/slab/dentry/aliases delete mode 100644 test/sys/kernel/slab/dentry/align delete mode 100644 test/sys/kernel/slab/dentry/alloc_calls delete mode 100644 test/sys/kernel/slab/dentry/cache_dma delete mode 100644 test/sys/kernel/slab/dentry/cpu_slabs delete mode 100644 test/sys/kernel/slab/dentry/ctor delete mode 100644 test/sys/kernel/slab/dentry/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/dentry/free_calls delete mode 100644 test/sys/kernel/slab/dentry/hwcache_align delete mode 100644 test/sys/kernel/slab/dentry/object_size delete mode 100644 test/sys/kernel/slab/dentry/objects delete mode 100644 test/sys/kernel/slab/dentry/objects_partial delete mode 100644 test/sys/kernel/slab/dentry/objs_per_slab delete mode 100644 test/sys/kernel/slab/dentry/order delete mode 100644 test/sys/kernel/slab/dentry/partial delete mode 100644 test/sys/kernel/slab/dentry/poison delete mode 100644 test/sys/kernel/slab/dentry/reclaim_account delete mode 100644 test/sys/kernel/slab/dentry/red_zone delete mode 100644 test/sys/kernel/slab/dentry/sanity_checks delete mode 100644 test/sys/kernel/slab/dentry/shrink delete mode 100644 test/sys/kernel/slab/dentry/slab_size delete mode 100644 test/sys/kernel/slab/dentry/slabs delete mode 100644 test/sys/kernel/slab/dentry/store_user delete mode 100644 test/sys/kernel/slab/dentry/total_objects delete mode 100644 test/sys/kernel/slab/dentry/trace delete mode 100644 test/sys/kernel/slab/dentry/validate delete mode 100644 test/sys/kernel/slab/dm_io/aliases delete mode 100644 test/sys/kernel/slab/dm_io/align delete mode 100644 test/sys/kernel/slab/dm_io/alloc_calls delete mode 100644 test/sys/kernel/slab/dm_io/cache_dma delete mode 100644 test/sys/kernel/slab/dm_io/cpu_slabs delete mode 100644 test/sys/kernel/slab/dm_io/ctor delete mode 100644 test/sys/kernel/slab/dm_io/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/dm_io/free_calls delete mode 100644 test/sys/kernel/slab/dm_io/hwcache_align delete mode 100644 test/sys/kernel/slab/dm_io/object_size delete mode 100644 test/sys/kernel/slab/dm_io/objects delete mode 100644 test/sys/kernel/slab/dm_io/objects_partial delete mode 100644 test/sys/kernel/slab/dm_io/objs_per_slab delete mode 100644 test/sys/kernel/slab/dm_io/order delete mode 100644 test/sys/kernel/slab/dm_io/partial delete mode 100644 test/sys/kernel/slab/dm_io/poison delete mode 100644 test/sys/kernel/slab/dm_io/reclaim_account delete mode 100644 test/sys/kernel/slab/dm_io/red_zone delete mode 100644 test/sys/kernel/slab/dm_io/sanity_checks delete mode 100644 test/sys/kernel/slab/dm_io/shrink delete mode 100644 test/sys/kernel/slab/dm_io/slab_size delete mode 100644 test/sys/kernel/slab/dm_io/slabs delete mode 100644 test/sys/kernel/slab/dm_io/store_user delete mode 100644 test/sys/kernel/slab/dm_io/total_objects delete mode 100644 test/sys/kernel/slab/dm_io/trace delete mode 100644 test/sys/kernel/slab/dm_io/validate delete mode 100644 test/sys/kernel/slab/dm_target_io/aliases delete mode 100644 test/sys/kernel/slab/dm_target_io/align delete mode 100644 test/sys/kernel/slab/dm_target_io/alloc_calls delete mode 100644 test/sys/kernel/slab/dm_target_io/cache_dma delete mode 100644 test/sys/kernel/slab/dm_target_io/cpu_slabs delete mode 100644 test/sys/kernel/slab/dm_target_io/ctor delete mode 100644 test/sys/kernel/slab/dm_target_io/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/dm_target_io/free_calls delete mode 100644 test/sys/kernel/slab/dm_target_io/hwcache_align delete mode 100644 test/sys/kernel/slab/dm_target_io/object_size delete mode 100644 test/sys/kernel/slab/dm_target_io/objects delete mode 100644 test/sys/kernel/slab/dm_target_io/objects_partial delete mode 100644 test/sys/kernel/slab/dm_target_io/objs_per_slab delete mode 100644 test/sys/kernel/slab/dm_target_io/order delete mode 100644 test/sys/kernel/slab/dm_target_io/partial delete mode 100644 test/sys/kernel/slab/dm_target_io/poison delete mode 100644 test/sys/kernel/slab/dm_target_io/reclaim_account delete mode 100644 test/sys/kernel/slab/dm_target_io/red_zone delete mode 100644 test/sys/kernel/slab/dm_target_io/sanity_checks delete mode 100644 test/sys/kernel/slab/dm_target_io/shrink delete mode 100644 test/sys/kernel/slab/dm_target_io/slab_size delete mode 100644 test/sys/kernel/slab/dm_target_io/slabs delete mode 100644 test/sys/kernel/slab/dm_target_io/store_user delete mode 100644 test/sys/kernel/slab/dm_target_io/total_objects delete mode 100644 test/sys/kernel/slab/dm_target_io/trace delete mode 100644 test/sys/kernel/slab/dm_target_io/validate delete mode 100644 test/sys/kernel/slab/dnotify_cache/aliases delete mode 100644 test/sys/kernel/slab/dnotify_cache/align delete mode 100644 test/sys/kernel/slab/dnotify_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/dnotify_cache/cache_dma delete mode 100644 test/sys/kernel/slab/dnotify_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/dnotify_cache/ctor delete mode 100644 test/sys/kernel/slab/dnotify_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/dnotify_cache/free_calls delete mode 100644 test/sys/kernel/slab/dnotify_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/dnotify_cache/object_size delete mode 100644 test/sys/kernel/slab/dnotify_cache/objects delete mode 100644 test/sys/kernel/slab/dnotify_cache/objects_partial delete mode 100644 test/sys/kernel/slab/dnotify_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/dnotify_cache/order delete mode 100644 test/sys/kernel/slab/dnotify_cache/partial delete mode 100644 test/sys/kernel/slab/dnotify_cache/poison delete mode 100644 test/sys/kernel/slab/dnotify_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/dnotify_cache/red_zone delete mode 100644 test/sys/kernel/slab/dnotify_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/dnotify_cache/shrink delete mode 100644 test/sys/kernel/slab/dnotify_cache/slab_size delete mode 100644 test/sys/kernel/slab/dnotify_cache/slabs delete mode 100644 test/sys/kernel/slab/dnotify_cache/store_user delete mode 100644 test/sys/kernel/slab/dnotify_cache/total_objects delete mode 100644 test/sys/kernel/slab/dnotify_cache/trace delete mode 100644 test/sys/kernel/slab/dnotify_cache/validate delete mode 100644 test/sys/kernel/slab/eventpoll_epi/aliases delete mode 100644 test/sys/kernel/slab/eventpoll_epi/align delete mode 100644 test/sys/kernel/slab/eventpoll_epi/alloc_calls delete mode 100644 test/sys/kernel/slab/eventpoll_epi/cache_dma delete mode 100644 test/sys/kernel/slab/eventpoll_epi/cpu_slabs delete mode 100644 test/sys/kernel/slab/eventpoll_epi/ctor delete mode 100644 test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/eventpoll_epi/free_calls delete mode 100644 test/sys/kernel/slab/eventpoll_epi/hwcache_align delete mode 100644 test/sys/kernel/slab/eventpoll_epi/object_size delete mode 100644 test/sys/kernel/slab/eventpoll_epi/objects delete mode 100644 test/sys/kernel/slab/eventpoll_epi/objects_partial delete mode 100644 test/sys/kernel/slab/eventpoll_epi/objs_per_slab delete mode 100644 test/sys/kernel/slab/eventpoll_epi/order delete mode 100644 test/sys/kernel/slab/eventpoll_epi/partial delete mode 100644 test/sys/kernel/slab/eventpoll_epi/poison delete mode 100644 test/sys/kernel/slab/eventpoll_epi/reclaim_account delete mode 100644 test/sys/kernel/slab/eventpoll_epi/red_zone delete mode 100644 test/sys/kernel/slab/eventpoll_epi/sanity_checks delete mode 100644 test/sys/kernel/slab/eventpoll_epi/shrink delete mode 100644 test/sys/kernel/slab/eventpoll_epi/slab_size delete mode 100644 test/sys/kernel/slab/eventpoll_epi/slabs delete mode 100644 test/sys/kernel/slab/eventpoll_epi/store_user delete mode 100644 test/sys/kernel/slab/eventpoll_epi/total_objects delete mode 100644 test/sys/kernel/slab/eventpoll_epi/trace delete mode 100644 test/sys/kernel/slab/eventpoll_epi/validate delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/aliases delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/align delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/alloc_calls delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/cache_dma delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/cpu_slabs delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/ctor delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/free_calls delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/hwcache_align delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/object_size delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/objects delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/objects_partial delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/objs_per_slab delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/order delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/partial delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/poison delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/reclaim_account delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/red_zone delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/sanity_checks delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/shrink delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/slab_size delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/slabs delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/store_user delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/total_objects delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/trace delete mode 100644 test/sys/kernel/slab/eventpoll_pwq/validate delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/aliases delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/align delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/cache_dma delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/ctor delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/free_calls delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/object_size delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/objects delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/objects_partial delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/order delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/partial delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/poison delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/red_zone delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/shrink delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/slab_size delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/slabs delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/store_user delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/total_objects delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/trace delete mode 100644 test/sys/kernel/slab/ext2_inode_cache/validate delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/aliases delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/align delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/cache_dma delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/ctor delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/free_calls delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/object_size delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/objects delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/objects_partial delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/order delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/partial delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/poison delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/red_zone delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/shrink delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/slab_size delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/slabs delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/store_user delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/total_objects delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/trace delete mode 100644 test/sys/kernel/slab/ext3_inode_cache/validate delete mode 100644 test/sys/kernel/slab/ext3_xattr/aliases delete mode 100644 test/sys/kernel/slab/ext3_xattr/align delete mode 100644 test/sys/kernel/slab/ext3_xattr/alloc_calls delete mode 100644 test/sys/kernel/slab/ext3_xattr/cache_dma delete mode 100644 test/sys/kernel/slab/ext3_xattr/cpu_slabs delete mode 100644 test/sys/kernel/slab/ext3_xattr/ctor delete mode 100644 test/sys/kernel/slab/ext3_xattr/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/ext3_xattr/free_calls delete mode 100644 test/sys/kernel/slab/ext3_xattr/hwcache_align delete mode 100644 test/sys/kernel/slab/ext3_xattr/object_size delete mode 100644 test/sys/kernel/slab/ext3_xattr/objects delete mode 100644 test/sys/kernel/slab/ext3_xattr/objects_partial delete mode 100644 test/sys/kernel/slab/ext3_xattr/objs_per_slab delete mode 100644 test/sys/kernel/slab/ext3_xattr/order delete mode 100644 test/sys/kernel/slab/ext3_xattr/partial delete mode 100644 test/sys/kernel/slab/ext3_xattr/poison delete mode 100644 test/sys/kernel/slab/ext3_xattr/reclaim_account delete mode 100644 test/sys/kernel/slab/ext3_xattr/red_zone delete mode 100644 test/sys/kernel/slab/ext3_xattr/sanity_checks delete mode 100644 test/sys/kernel/slab/ext3_xattr/shrink delete mode 100644 test/sys/kernel/slab/ext3_xattr/slab_size delete mode 100644 test/sys/kernel/slab/ext3_xattr/slabs delete mode 100644 test/sys/kernel/slab/ext3_xattr/store_user delete mode 100644 test/sys/kernel/slab/ext3_xattr/total_objects delete mode 100644 test/sys/kernel/slab/ext3_xattr/trace delete mode 100644 test/sys/kernel/slab/ext3_xattr/validate delete mode 100644 test/sys/kernel/slab/fasync_cache/aliases delete mode 100644 test/sys/kernel/slab/fasync_cache/align delete mode 100644 test/sys/kernel/slab/fasync_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/fasync_cache/cache_dma delete mode 100644 test/sys/kernel/slab/fasync_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/fasync_cache/ctor delete mode 100644 test/sys/kernel/slab/fasync_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/fasync_cache/free_calls delete mode 100644 test/sys/kernel/slab/fasync_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/fasync_cache/object_size delete mode 100644 test/sys/kernel/slab/fasync_cache/objects delete mode 100644 test/sys/kernel/slab/fasync_cache/objects_partial delete mode 100644 test/sys/kernel/slab/fasync_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/fasync_cache/order delete mode 100644 test/sys/kernel/slab/fasync_cache/partial delete mode 100644 test/sys/kernel/slab/fasync_cache/poison delete mode 100644 test/sys/kernel/slab/fasync_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/fasync_cache/red_zone delete mode 100644 test/sys/kernel/slab/fasync_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/fasync_cache/shrink delete mode 100644 test/sys/kernel/slab/fasync_cache/slab_size delete mode 100644 test/sys/kernel/slab/fasync_cache/slabs delete mode 100644 test/sys/kernel/slab/fasync_cache/store_user delete mode 100644 test/sys/kernel/slab/fasync_cache/total_objects delete mode 100644 test/sys/kernel/slab/fasync_cache/trace delete mode 100644 test/sys/kernel/slab/fasync_cache/validate delete mode 100644 test/sys/kernel/slab/fat_cache/aliases delete mode 100644 test/sys/kernel/slab/fat_cache/align delete mode 100644 test/sys/kernel/slab/fat_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/fat_cache/cache_dma delete mode 100644 test/sys/kernel/slab/fat_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/fat_cache/ctor delete mode 100644 test/sys/kernel/slab/fat_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/fat_cache/free_calls delete mode 100644 test/sys/kernel/slab/fat_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/fat_cache/object_size delete mode 100644 test/sys/kernel/slab/fat_cache/objects delete mode 100644 test/sys/kernel/slab/fat_cache/objects_partial delete mode 100644 test/sys/kernel/slab/fat_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/fat_cache/order delete mode 100644 test/sys/kernel/slab/fat_cache/partial delete mode 100644 test/sys/kernel/slab/fat_cache/poison delete mode 100644 test/sys/kernel/slab/fat_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/fat_cache/red_zone delete mode 100644 test/sys/kernel/slab/fat_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/fat_cache/shrink delete mode 100644 test/sys/kernel/slab/fat_cache/slab_size delete mode 100644 test/sys/kernel/slab/fat_cache/slabs delete mode 100644 test/sys/kernel/slab/fat_cache/store_user delete mode 100644 test/sys/kernel/slab/fat_cache/total_objects delete mode 100644 test/sys/kernel/slab/fat_cache/trace delete mode 100644 test/sys/kernel/slab/fat_cache/validate delete mode 100644 test/sys/kernel/slab/fat_inode_cache/aliases delete mode 100644 test/sys/kernel/slab/fat_inode_cache/align delete mode 100644 test/sys/kernel/slab/fat_inode_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/fat_inode_cache/cache_dma delete mode 100644 test/sys/kernel/slab/fat_inode_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/fat_inode_cache/ctor delete mode 100644 test/sys/kernel/slab/fat_inode_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/fat_inode_cache/free_calls delete mode 100644 test/sys/kernel/slab/fat_inode_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/fat_inode_cache/object_size delete mode 100644 test/sys/kernel/slab/fat_inode_cache/objects delete mode 100644 test/sys/kernel/slab/fat_inode_cache/objects_partial delete mode 100644 test/sys/kernel/slab/fat_inode_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/fat_inode_cache/order delete mode 100644 test/sys/kernel/slab/fat_inode_cache/partial delete mode 100644 test/sys/kernel/slab/fat_inode_cache/poison delete mode 100644 test/sys/kernel/slab/fat_inode_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/fat_inode_cache/red_zone delete mode 100644 test/sys/kernel/slab/fat_inode_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/fat_inode_cache/shrink delete mode 100644 test/sys/kernel/slab/fat_inode_cache/slab_size delete mode 100644 test/sys/kernel/slab/fat_inode_cache/slabs delete mode 100644 test/sys/kernel/slab/fat_inode_cache/store_user delete mode 100644 test/sys/kernel/slab/fat_inode_cache/total_objects delete mode 100644 test/sys/kernel/slab/fat_inode_cache/trace delete mode 100644 test/sys/kernel/slab/fat_inode_cache/validate delete mode 100644 test/sys/kernel/slab/fib6_nodes/aliases delete mode 100644 test/sys/kernel/slab/fib6_nodes/align delete mode 100644 test/sys/kernel/slab/fib6_nodes/alloc_calls delete mode 100644 test/sys/kernel/slab/fib6_nodes/cache_dma delete mode 100644 test/sys/kernel/slab/fib6_nodes/cpu_slabs delete mode 100644 test/sys/kernel/slab/fib6_nodes/ctor delete mode 100644 test/sys/kernel/slab/fib6_nodes/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/fib6_nodes/free_calls delete mode 100644 test/sys/kernel/slab/fib6_nodes/hwcache_align delete mode 100644 test/sys/kernel/slab/fib6_nodes/object_size delete mode 100644 test/sys/kernel/slab/fib6_nodes/objects delete mode 100644 test/sys/kernel/slab/fib6_nodes/objects_partial delete mode 100644 test/sys/kernel/slab/fib6_nodes/objs_per_slab delete mode 100644 test/sys/kernel/slab/fib6_nodes/order delete mode 100644 test/sys/kernel/slab/fib6_nodes/partial delete mode 100644 test/sys/kernel/slab/fib6_nodes/poison delete mode 100644 test/sys/kernel/slab/fib6_nodes/reclaim_account delete mode 100644 test/sys/kernel/slab/fib6_nodes/red_zone delete mode 100644 test/sys/kernel/slab/fib6_nodes/sanity_checks delete mode 100644 test/sys/kernel/slab/fib6_nodes/shrink delete mode 100644 test/sys/kernel/slab/fib6_nodes/slab_size delete mode 100644 test/sys/kernel/slab/fib6_nodes/slabs delete mode 100644 test/sys/kernel/slab/fib6_nodes/store_user delete mode 100644 test/sys/kernel/slab/fib6_nodes/total_objects delete mode 100644 test/sys/kernel/slab/fib6_nodes/trace delete mode 100644 test/sys/kernel/slab/fib6_nodes/validate delete mode 100644 test/sys/kernel/slab/file_lock_cache/aliases delete mode 100644 test/sys/kernel/slab/file_lock_cache/align delete mode 100644 test/sys/kernel/slab/file_lock_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/file_lock_cache/cache_dma delete mode 100644 test/sys/kernel/slab/file_lock_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/file_lock_cache/ctor delete mode 100644 test/sys/kernel/slab/file_lock_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/file_lock_cache/free_calls delete mode 100644 test/sys/kernel/slab/file_lock_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/file_lock_cache/object_size delete mode 100644 test/sys/kernel/slab/file_lock_cache/objects delete mode 100644 test/sys/kernel/slab/file_lock_cache/objects_partial delete mode 100644 test/sys/kernel/slab/file_lock_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/file_lock_cache/order delete mode 100644 test/sys/kernel/slab/file_lock_cache/partial delete mode 100644 test/sys/kernel/slab/file_lock_cache/poison delete mode 100644 test/sys/kernel/slab/file_lock_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/file_lock_cache/red_zone delete mode 100644 test/sys/kernel/slab/file_lock_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/file_lock_cache/shrink delete mode 100644 test/sys/kernel/slab/file_lock_cache/slab_size delete mode 100644 test/sys/kernel/slab/file_lock_cache/slabs delete mode 100644 test/sys/kernel/slab/file_lock_cache/store_user delete mode 100644 test/sys/kernel/slab/file_lock_cache/total_objects delete mode 100644 test/sys/kernel/slab/file_lock_cache/trace delete mode 100644 test/sys/kernel/slab/file_lock_cache/validate delete mode 100644 test/sys/kernel/slab/files_cache/aliases delete mode 100644 test/sys/kernel/slab/files_cache/align delete mode 100644 test/sys/kernel/slab/files_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/files_cache/cache_dma delete mode 100644 test/sys/kernel/slab/files_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/files_cache/ctor delete mode 100644 test/sys/kernel/slab/files_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/files_cache/free_calls delete mode 100644 test/sys/kernel/slab/files_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/files_cache/object_size delete mode 100644 test/sys/kernel/slab/files_cache/objects delete mode 100644 test/sys/kernel/slab/files_cache/objects_partial delete mode 100644 test/sys/kernel/slab/files_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/files_cache/order delete mode 100644 test/sys/kernel/slab/files_cache/partial delete mode 100644 test/sys/kernel/slab/files_cache/poison delete mode 100644 test/sys/kernel/slab/files_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/files_cache/red_zone delete mode 100644 test/sys/kernel/slab/files_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/files_cache/shrink delete mode 100644 test/sys/kernel/slab/files_cache/slab_size delete mode 100644 test/sys/kernel/slab/files_cache/slabs delete mode 100644 test/sys/kernel/slab/files_cache/store_user delete mode 100644 test/sys/kernel/slab/files_cache/total_objects delete mode 100644 test/sys/kernel/slab/files_cache/trace delete mode 100644 test/sys/kernel/slab/files_cache/validate delete mode 100644 test/sys/kernel/slab/filp/aliases delete mode 100644 test/sys/kernel/slab/filp/align delete mode 100644 test/sys/kernel/slab/filp/alloc_calls delete mode 100644 test/sys/kernel/slab/filp/cache_dma delete mode 100644 test/sys/kernel/slab/filp/cpu_slabs delete mode 100644 test/sys/kernel/slab/filp/ctor delete mode 100644 test/sys/kernel/slab/filp/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/filp/free_calls delete mode 100644 test/sys/kernel/slab/filp/hwcache_align delete mode 100644 test/sys/kernel/slab/filp/object_size delete mode 100644 test/sys/kernel/slab/filp/objects delete mode 100644 test/sys/kernel/slab/filp/objects_partial delete mode 100644 test/sys/kernel/slab/filp/objs_per_slab delete mode 100644 test/sys/kernel/slab/filp/order delete mode 100644 test/sys/kernel/slab/filp/partial delete mode 100644 test/sys/kernel/slab/filp/poison delete mode 100644 test/sys/kernel/slab/filp/reclaim_account delete mode 100644 test/sys/kernel/slab/filp/red_zone delete mode 100644 test/sys/kernel/slab/filp/sanity_checks delete mode 100644 test/sys/kernel/slab/filp/shrink delete mode 100644 test/sys/kernel/slab/filp/slab_size delete mode 100644 test/sys/kernel/slab/filp/slabs delete mode 100644 test/sys/kernel/slab/filp/store_user delete mode 100644 test/sys/kernel/slab/filp/total_objects delete mode 100644 test/sys/kernel/slab/filp/trace delete mode 100644 test/sys/kernel/slab/filp/validate delete mode 100644 test/sys/kernel/slab/flow_cache/aliases delete mode 100644 test/sys/kernel/slab/flow_cache/align delete mode 100644 test/sys/kernel/slab/flow_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/flow_cache/cache_dma delete mode 100644 test/sys/kernel/slab/flow_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/flow_cache/ctor delete mode 100644 test/sys/kernel/slab/flow_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/flow_cache/free_calls delete mode 100644 test/sys/kernel/slab/flow_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/flow_cache/object_size delete mode 100644 test/sys/kernel/slab/flow_cache/objects delete mode 100644 test/sys/kernel/slab/flow_cache/objects_partial delete mode 100644 test/sys/kernel/slab/flow_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/flow_cache/order delete mode 100644 test/sys/kernel/slab/flow_cache/partial delete mode 100644 test/sys/kernel/slab/flow_cache/poison delete mode 100644 test/sys/kernel/slab/flow_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/flow_cache/red_zone delete mode 100644 test/sys/kernel/slab/flow_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/flow_cache/shrink delete mode 100644 test/sys/kernel/slab/flow_cache/slab_size delete mode 100644 test/sys/kernel/slab/flow_cache/slabs delete mode 100644 test/sys/kernel/slab/flow_cache/store_user delete mode 100644 test/sys/kernel/slab/flow_cache/total_objects delete mode 100644 test/sys/kernel/slab/flow_cache/trace delete mode 100644 test/sys/kernel/slab/flow_cache/validate delete mode 100644 test/sys/kernel/slab/fs_cache/aliases delete mode 100644 test/sys/kernel/slab/fs_cache/align delete mode 100644 test/sys/kernel/slab/fs_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/fs_cache/cache_dma delete mode 100644 test/sys/kernel/slab/fs_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/fs_cache/ctor delete mode 100644 test/sys/kernel/slab/fs_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/fs_cache/free_calls delete mode 100644 test/sys/kernel/slab/fs_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/fs_cache/object_size delete mode 100644 test/sys/kernel/slab/fs_cache/objects delete mode 100644 test/sys/kernel/slab/fs_cache/objects_partial delete mode 100644 test/sys/kernel/slab/fs_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/fs_cache/order delete mode 100644 test/sys/kernel/slab/fs_cache/partial delete mode 100644 test/sys/kernel/slab/fs_cache/poison delete mode 100644 test/sys/kernel/slab/fs_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/fs_cache/red_zone delete mode 100644 test/sys/kernel/slab/fs_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/fs_cache/shrink delete mode 100644 test/sys/kernel/slab/fs_cache/slab_size delete mode 100644 test/sys/kernel/slab/fs_cache/slabs delete mode 100644 test/sys/kernel/slab/fs_cache/store_user delete mode 100644 test/sys/kernel/slab/fs_cache/total_objects delete mode 100644 test/sys/kernel/slab/fs_cache/trace delete mode 100644 test/sys/kernel/slab/fs_cache/validate delete mode 100644 test/sys/kernel/slab/fuse_inode/aliases delete mode 100644 test/sys/kernel/slab/fuse_inode/align delete mode 100644 test/sys/kernel/slab/fuse_inode/alloc_calls delete mode 100644 test/sys/kernel/slab/fuse_inode/cache_dma delete mode 100644 test/sys/kernel/slab/fuse_inode/cpu_slabs delete mode 100644 test/sys/kernel/slab/fuse_inode/ctor delete mode 100644 test/sys/kernel/slab/fuse_inode/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/fuse_inode/free_calls delete mode 100644 test/sys/kernel/slab/fuse_inode/hwcache_align delete mode 100644 test/sys/kernel/slab/fuse_inode/object_size delete mode 100644 test/sys/kernel/slab/fuse_inode/objects delete mode 100644 test/sys/kernel/slab/fuse_inode/objects_partial delete mode 100644 test/sys/kernel/slab/fuse_inode/objs_per_slab delete mode 100644 test/sys/kernel/slab/fuse_inode/order delete mode 100644 test/sys/kernel/slab/fuse_inode/partial delete mode 100644 test/sys/kernel/slab/fuse_inode/poison delete mode 100644 test/sys/kernel/slab/fuse_inode/reclaim_account delete mode 100644 test/sys/kernel/slab/fuse_inode/red_zone delete mode 100644 test/sys/kernel/slab/fuse_inode/sanity_checks delete mode 100644 test/sys/kernel/slab/fuse_inode/shrink delete mode 100644 test/sys/kernel/slab/fuse_inode/slab_size delete mode 100644 test/sys/kernel/slab/fuse_inode/slabs delete mode 100644 test/sys/kernel/slab/fuse_inode/store_user delete mode 100644 test/sys/kernel/slab/fuse_inode/total_objects delete mode 100644 test/sys/kernel/slab/fuse_inode/trace delete mode 100644 test/sys/kernel/slab/fuse_inode/validate delete mode 100644 test/sys/kernel/slab/fuse_request/aliases delete mode 100644 test/sys/kernel/slab/fuse_request/align delete mode 100644 test/sys/kernel/slab/fuse_request/alloc_calls delete mode 100644 test/sys/kernel/slab/fuse_request/cache_dma delete mode 100644 test/sys/kernel/slab/fuse_request/cpu_slabs delete mode 100644 test/sys/kernel/slab/fuse_request/ctor delete mode 100644 test/sys/kernel/slab/fuse_request/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/fuse_request/free_calls delete mode 100644 test/sys/kernel/slab/fuse_request/hwcache_align delete mode 100644 test/sys/kernel/slab/fuse_request/object_size delete mode 100644 test/sys/kernel/slab/fuse_request/objects delete mode 100644 test/sys/kernel/slab/fuse_request/objects_partial delete mode 100644 test/sys/kernel/slab/fuse_request/objs_per_slab delete mode 100644 test/sys/kernel/slab/fuse_request/order delete mode 100644 test/sys/kernel/slab/fuse_request/partial delete mode 100644 test/sys/kernel/slab/fuse_request/poison delete mode 100644 test/sys/kernel/slab/fuse_request/reclaim_account delete mode 100644 test/sys/kernel/slab/fuse_request/red_zone delete mode 100644 test/sys/kernel/slab/fuse_request/sanity_checks delete mode 100644 test/sys/kernel/slab/fuse_request/shrink delete mode 100644 test/sys/kernel/slab/fuse_request/slab_size delete mode 100644 test/sys/kernel/slab/fuse_request/slabs delete mode 100644 test/sys/kernel/slab/fuse_request/store_user delete mode 100644 test/sys/kernel/slab/fuse_request/total_objects delete mode 100644 test/sys/kernel/slab/fuse_request/trace delete mode 100644 test/sys/kernel/slab/fuse_request/validate delete mode 100644 test/sys/kernel/slab/idr_layer_cache/aliases delete mode 100644 test/sys/kernel/slab/idr_layer_cache/align delete mode 100644 test/sys/kernel/slab/idr_layer_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/idr_layer_cache/cache_dma delete mode 100644 test/sys/kernel/slab/idr_layer_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/idr_layer_cache/ctor delete mode 100644 test/sys/kernel/slab/idr_layer_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/idr_layer_cache/free_calls delete mode 100644 test/sys/kernel/slab/idr_layer_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/idr_layer_cache/object_size delete mode 100644 test/sys/kernel/slab/idr_layer_cache/objects delete mode 100644 test/sys/kernel/slab/idr_layer_cache/objects_partial delete mode 100644 test/sys/kernel/slab/idr_layer_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/idr_layer_cache/order delete mode 100644 test/sys/kernel/slab/idr_layer_cache/partial delete mode 100644 test/sys/kernel/slab/idr_layer_cache/poison delete mode 100644 test/sys/kernel/slab/idr_layer_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/idr_layer_cache/red_zone delete mode 100644 test/sys/kernel/slab/idr_layer_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/idr_layer_cache/shrink delete mode 100644 test/sys/kernel/slab/idr_layer_cache/slab_size delete mode 100644 test/sys/kernel/slab/idr_layer_cache/slabs delete mode 100644 test/sys/kernel/slab/idr_layer_cache/store_user delete mode 100644 test/sys/kernel/slab/idr_layer_cache/total_objects delete mode 100644 test/sys/kernel/slab/idr_layer_cache/trace delete mode 100644 test/sys/kernel/slab/idr_layer_cache/validate delete mode 100644 test/sys/kernel/slab/inet_peer_cache/aliases delete mode 100644 test/sys/kernel/slab/inet_peer_cache/align delete mode 100644 test/sys/kernel/slab/inet_peer_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/inet_peer_cache/cache_dma delete mode 100644 test/sys/kernel/slab/inet_peer_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/inet_peer_cache/ctor delete mode 100644 test/sys/kernel/slab/inet_peer_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/inet_peer_cache/free_calls delete mode 100644 test/sys/kernel/slab/inet_peer_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/inet_peer_cache/object_size delete mode 100644 test/sys/kernel/slab/inet_peer_cache/objects delete mode 100644 test/sys/kernel/slab/inet_peer_cache/objects_partial delete mode 100644 test/sys/kernel/slab/inet_peer_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/inet_peer_cache/order delete mode 100644 test/sys/kernel/slab/inet_peer_cache/partial delete mode 100644 test/sys/kernel/slab/inet_peer_cache/poison delete mode 100644 test/sys/kernel/slab/inet_peer_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/inet_peer_cache/red_zone delete mode 100644 test/sys/kernel/slab/inet_peer_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/inet_peer_cache/shrink delete mode 100644 test/sys/kernel/slab/inet_peer_cache/slab_size delete mode 100644 test/sys/kernel/slab/inet_peer_cache/slabs delete mode 100644 test/sys/kernel/slab/inet_peer_cache/store_user delete mode 100644 test/sys/kernel/slab/inet_peer_cache/total_objects delete mode 100644 test/sys/kernel/slab/inet_peer_cache/trace delete mode 100644 test/sys/kernel/slab/inet_peer_cache/validate delete mode 100644 test/sys/kernel/slab/inode_cache/aliases delete mode 100644 test/sys/kernel/slab/inode_cache/align delete mode 100644 test/sys/kernel/slab/inode_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/inode_cache/cache_dma delete mode 100644 test/sys/kernel/slab/inode_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/inode_cache/ctor delete mode 100644 test/sys/kernel/slab/inode_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/inode_cache/free_calls delete mode 100644 test/sys/kernel/slab/inode_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/inode_cache/object_size delete mode 100644 test/sys/kernel/slab/inode_cache/objects delete mode 100644 test/sys/kernel/slab/inode_cache/objects_partial delete mode 100644 test/sys/kernel/slab/inode_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/inode_cache/order delete mode 100644 test/sys/kernel/slab/inode_cache/partial delete mode 100644 test/sys/kernel/slab/inode_cache/poison delete mode 100644 test/sys/kernel/slab/inode_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/inode_cache/red_zone delete mode 100644 test/sys/kernel/slab/inode_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/inode_cache/shrink delete mode 100644 test/sys/kernel/slab/inode_cache/slab_size delete mode 100644 test/sys/kernel/slab/inode_cache/slabs delete mode 100644 test/sys/kernel/slab/inode_cache/store_user delete mode 100644 test/sys/kernel/slab/inode_cache/total_objects delete mode 100644 test/sys/kernel/slab/inode_cache/trace delete mode 100644 test/sys/kernel/slab/inode_cache/validate delete mode 100644 test/sys/kernel/slab/inotify_event_cache/aliases delete mode 100644 test/sys/kernel/slab/inotify_event_cache/align delete mode 100644 test/sys/kernel/slab/inotify_event_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/inotify_event_cache/cache_dma delete mode 100644 test/sys/kernel/slab/inotify_event_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/inotify_event_cache/ctor delete mode 100644 test/sys/kernel/slab/inotify_event_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/inotify_event_cache/free_calls delete mode 100644 test/sys/kernel/slab/inotify_event_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/inotify_event_cache/object_size delete mode 100644 test/sys/kernel/slab/inotify_event_cache/objects delete mode 100644 test/sys/kernel/slab/inotify_event_cache/objects_partial delete mode 100644 test/sys/kernel/slab/inotify_event_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/inotify_event_cache/order delete mode 100644 test/sys/kernel/slab/inotify_event_cache/partial delete mode 100644 test/sys/kernel/slab/inotify_event_cache/poison delete mode 100644 test/sys/kernel/slab/inotify_event_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/inotify_event_cache/red_zone delete mode 100644 test/sys/kernel/slab/inotify_event_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/inotify_event_cache/shrink delete mode 100644 test/sys/kernel/slab/inotify_event_cache/slab_size delete mode 100644 test/sys/kernel/slab/inotify_event_cache/slabs delete mode 100644 test/sys/kernel/slab/inotify_event_cache/store_user delete mode 100644 test/sys/kernel/slab/inotify_event_cache/total_objects delete mode 100644 test/sys/kernel/slab/inotify_event_cache/trace delete mode 100644 test/sys/kernel/slab/inotify_event_cache/validate delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/aliases delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/align delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/cache_dma delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/ctor delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/free_calls delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/object_size delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/objects delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/objects_partial delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/order delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/partial delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/poison delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/red_zone delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/shrink delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/slab_size delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/slabs delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/store_user delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/total_objects delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/trace delete mode 100644 test/sys/kernel/slab/inotify_watch_cache/validate delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/aliases delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/align delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/cache_dma delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/ctor delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/free_calls delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/object_size delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/objects delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/objects_partial delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/order delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/partial delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/poison delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/red_zone delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/shrink delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/slab_size delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/slabs delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/store_user delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/total_objects delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/trace delete mode 100644 test/sys/kernel/slab/ip6_dst_cache/validate delete mode 100644 test/sys/kernel/slab/ip_dst_cache/aliases delete mode 100644 test/sys/kernel/slab/ip_dst_cache/align delete mode 100644 test/sys/kernel/slab/ip_dst_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/ip_dst_cache/cache_dma delete mode 100644 test/sys/kernel/slab/ip_dst_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/ip_dst_cache/ctor delete mode 100644 test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/ip_dst_cache/free_calls delete mode 100644 test/sys/kernel/slab/ip_dst_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/ip_dst_cache/object_size delete mode 100644 test/sys/kernel/slab/ip_dst_cache/objects delete mode 100644 test/sys/kernel/slab/ip_dst_cache/objects_partial delete mode 100644 test/sys/kernel/slab/ip_dst_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/ip_dst_cache/order delete mode 100644 test/sys/kernel/slab/ip_dst_cache/partial delete mode 100644 test/sys/kernel/slab/ip_dst_cache/poison delete mode 100644 test/sys/kernel/slab/ip_dst_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/ip_dst_cache/red_zone delete mode 100644 test/sys/kernel/slab/ip_dst_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/ip_dst_cache/shrink delete mode 100644 test/sys/kernel/slab/ip_dst_cache/slab_size delete mode 100644 test/sys/kernel/slab/ip_dst_cache/slabs delete mode 100644 test/sys/kernel/slab/ip_dst_cache/store_user delete mode 100644 test/sys/kernel/slab/ip_dst_cache/total_objects delete mode 100644 test/sys/kernel/slab/ip_dst_cache/trace delete mode 100644 test/sys/kernel/slab/ip_dst_cache/validate delete mode 100644 test/sys/kernel/slab/ip_fib_alias/aliases delete mode 100644 test/sys/kernel/slab/ip_fib_alias/align delete mode 100644 test/sys/kernel/slab/ip_fib_alias/alloc_calls delete mode 100644 test/sys/kernel/slab/ip_fib_alias/cache_dma delete mode 100644 test/sys/kernel/slab/ip_fib_alias/cpu_slabs delete mode 100644 test/sys/kernel/slab/ip_fib_alias/ctor delete mode 100644 test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/ip_fib_alias/free_calls delete mode 100644 test/sys/kernel/slab/ip_fib_alias/hwcache_align delete mode 100644 test/sys/kernel/slab/ip_fib_alias/object_size delete mode 100644 test/sys/kernel/slab/ip_fib_alias/objects delete mode 100644 test/sys/kernel/slab/ip_fib_alias/objects_partial delete mode 100644 test/sys/kernel/slab/ip_fib_alias/objs_per_slab delete mode 100644 test/sys/kernel/slab/ip_fib_alias/order delete mode 100644 test/sys/kernel/slab/ip_fib_alias/partial delete mode 100644 test/sys/kernel/slab/ip_fib_alias/poison delete mode 100644 test/sys/kernel/slab/ip_fib_alias/reclaim_account delete mode 100644 test/sys/kernel/slab/ip_fib_alias/red_zone delete mode 100644 test/sys/kernel/slab/ip_fib_alias/sanity_checks delete mode 100644 test/sys/kernel/slab/ip_fib_alias/shrink delete mode 100644 test/sys/kernel/slab/ip_fib_alias/slab_size delete mode 100644 test/sys/kernel/slab/ip_fib_alias/slabs delete mode 100644 test/sys/kernel/slab/ip_fib_alias/store_user delete mode 100644 test/sys/kernel/slab/ip_fib_alias/total_objects delete mode 100644 test/sys/kernel/slab/ip_fib_alias/trace delete mode 100644 test/sys/kernel/slab/ip_fib_alias/validate delete mode 100644 test/sys/kernel/slab/ip_fib_hash/aliases delete mode 100644 test/sys/kernel/slab/ip_fib_hash/align delete mode 100644 test/sys/kernel/slab/ip_fib_hash/alloc_calls delete mode 100644 test/sys/kernel/slab/ip_fib_hash/cache_dma delete mode 100644 test/sys/kernel/slab/ip_fib_hash/cpu_slabs delete mode 100644 test/sys/kernel/slab/ip_fib_hash/ctor delete mode 100644 test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/ip_fib_hash/free_calls delete mode 100644 test/sys/kernel/slab/ip_fib_hash/hwcache_align delete mode 100644 test/sys/kernel/slab/ip_fib_hash/object_size delete mode 100644 test/sys/kernel/slab/ip_fib_hash/objects delete mode 100644 test/sys/kernel/slab/ip_fib_hash/objects_partial delete mode 100644 test/sys/kernel/slab/ip_fib_hash/objs_per_slab delete mode 100644 test/sys/kernel/slab/ip_fib_hash/order delete mode 100644 test/sys/kernel/slab/ip_fib_hash/partial delete mode 100644 test/sys/kernel/slab/ip_fib_hash/poison delete mode 100644 test/sys/kernel/slab/ip_fib_hash/reclaim_account delete mode 100644 test/sys/kernel/slab/ip_fib_hash/red_zone delete mode 100644 test/sys/kernel/slab/ip_fib_hash/sanity_checks delete mode 100644 test/sys/kernel/slab/ip_fib_hash/shrink delete mode 100644 test/sys/kernel/slab/ip_fib_hash/slab_size delete mode 100644 test/sys/kernel/slab/ip_fib_hash/slabs delete mode 100644 test/sys/kernel/slab/ip_fib_hash/store_user delete mode 100644 test/sys/kernel/slab/ip_fib_hash/total_objects delete mode 100644 test/sys/kernel/slab/ip_fib_hash/trace delete mode 100644 test/sys/kernel/slab/ip_fib_hash/validate delete mode 100644 test/sys/kernel/slab/journal_handle/aliases delete mode 100644 test/sys/kernel/slab/journal_handle/align delete mode 100644 test/sys/kernel/slab/journal_handle/alloc_calls delete mode 100644 test/sys/kernel/slab/journal_handle/cache_dma delete mode 100644 test/sys/kernel/slab/journal_handle/cpu_slabs delete mode 100644 test/sys/kernel/slab/journal_handle/ctor delete mode 100644 test/sys/kernel/slab/journal_handle/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/journal_handle/free_calls delete mode 100644 test/sys/kernel/slab/journal_handle/hwcache_align delete mode 100644 test/sys/kernel/slab/journal_handle/object_size delete mode 100644 test/sys/kernel/slab/journal_handle/objects delete mode 100644 test/sys/kernel/slab/journal_handle/objects_partial delete mode 100644 test/sys/kernel/slab/journal_handle/objs_per_slab delete mode 100644 test/sys/kernel/slab/journal_handle/order delete mode 100644 test/sys/kernel/slab/journal_handle/partial delete mode 100644 test/sys/kernel/slab/journal_handle/poison delete mode 100644 test/sys/kernel/slab/journal_handle/reclaim_account delete mode 100644 test/sys/kernel/slab/journal_handle/red_zone delete mode 100644 test/sys/kernel/slab/journal_handle/sanity_checks delete mode 100644 test/sys/kernel/slab/journal_handle/shrink delete mode 100644 test/sys/kernel/slab/journal_handle/slab_size delete mode 100644 test/sys/kernel/slab/journal_handle/slabs delete mode 100644 test/sys/kernel/slab/journal_handle/store_user delete mode 100644 test/sys/kernel/slab/journal_handle/total_objects delete mode 100644 test/sys/kernel/slab/journal_handle/trace delete mode 100644 test/sys/kernel/slab/journal_handle/validate delete mode 100644 test/sys/kernel/slab/journal_head/aliases delete mode 100644 test/sys/kernel/slab/journal_head/align delete mode 100644 test/sys/kernel/slab/journal_head/alloc_calls delete mode 100644 test/sys/kernel/slab/journal_head/cache_dma delete mode 100644 test/sys/kernel/slab/journal_head/cpu_slabs delete mode 100644 test/sys/kernel/slab/journal_head/ctor delete mode 100644 test/sys/kernel/slab/journal_head/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/journal_head/free_calls delete mode 100644 test/sys/kernel/slab/journal_head/hwcache_align delete mode 100644 test/sys/kernel/slab/journal_head/object_size delete mode 100644 test/sys/kernel/slab/journal_head/objects delete mode 100644 test/sys/kernel/slab/journal_head/objects_partial delete mode 100644 test/sys/kernel/slab/journal_head/objs_per_slab delete mode 100644 test/sys/kernel/slab/journal_head/order delete mode 100644 test/sys/kernel/slab/journal_head/partial delete mode 100644 test/sys/kernel/slab/journal_head/poison delete mode 100644 test/sys/kernel/slab/journal_head/reclaim_account delete mode 100644 test/sys/kernel/slab/journal_head/red_zone delete mode 100644 test/sys/kernel/slab/journal_head/sanity_checks delete mode 100644 test/sys/kernel/slab/journal_head/shrink delete mode 100644 test/sys/kernel/slab/journal_head/slab_size delete mode 100644 test/sys/kernel/slab/journal_head/slabs delete mode 100644 test/sys/kernel/slab/journal_head/store_user delete mode 100644 test/sys/kernel/slab/journal_head/total_objects delete mode 100644 test/sys/kernel/slab/journal_head/trace delete mode 100644 test/sys/kernel/slab/journal_head/validate delete mode 100644 test/sys/kernel/slab/kcopyd_job/aliases delete mode 100644 test/sys/kernel/slab/kcopyd_job/align delete mode 100644 test/sys/kernel/slab/kcopyd_job/alloc_calls delete mode 100644 test/sys/kernel/slab/kcopyd_job/cache_dma delete mode 100644 test/sys/kernel/slab/kcopyd_job/cpu_slabs delete mode 100644 test/sys/kernel/slab/kcopyd_job/ctor delete mode 100644 test/sys/kernel/slab/kcopyd_job/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kcopyd_job/free_calls delete mode 100644 test/sys/kernel/slab/kcopyd_job/hwcache_align delete mode 100644 test/sys/kernel/slab/kcopyd_job/object_size delete mode 100644 test/sys/kernel/slab/kcopyd_job/objects delete mode 100644 test/sys/kernel/slab/kcopyd_job/objects_partial delete mode 100644 test/sys/kernel/slab/kcopyd_job/objs_per_slab delete mode 100644 test/sys/kernel/slab/kcopyd_job/order delete mode 100644 test/sys/kernel/slab/kcopyd_job/partial delete mode 100644 test/sys/kernel/slab/kcopyd_job/poison delete mode 100644 test/sys/kernel/slab/kcopyd_job/reclaim_account delete mode 100644 test/sys/kernel/slab/kcopyd_job/red_zone delete mode 100644 test/sys/kernel/slab/kcopyd_job/sanity_checks delete mode 100644 test/sys/kernel/slab/kcopyd_job/shrink delete mode 100644 test/sys/kernel/slab/kcopyd_job/slab_size delete mode 100644 test/sys/kernel/slab/kcopyd_job/slabs delete mode 100644 test/sys/kernel/slab/kcopyd_job/store_user delete mode 100644 test/sys/kernel/slab/kcopyd_job/total_objects delete mode 100644 test/sys/kernel/slab/kcopyd_job/trace delete mode 100644 test/sys/kernel/slab/kcopyd_job/validate delete mode 100644 test/sys/kernel/slab/key_jar/aliases delete mode 100644 test/sys/kernel/slab/key_jar/align delete mode 100644 test/sys/kernel/slab/key_jar/alloc_calls delete mode 100644 test/sys/kernel/slab/key_jar/cache_dma delete mode 100644 test/sys/kernel/slab/key_jar/cpu_slabs delete mode 100644 test/sys/kernel/slab/key_jar/ctor delete mode 100644 test/sys/kernel/slab/key_jar/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/key_jar/free_calls delete mode 100644 test/sys/kernel/slab/key_jar/hwcache_align delete mode 100644 test/sys/kernel/slab/key_jar/object_size delete mode 100644 test/sys/kernel/slab/key_jar/objects delete mode 100644 test/sys/kernel/slab/key_jar/objects_partial delete mode 100644 test/sys/kernel/slab/key_jar/objs_per_slab delete mode 100644 test/sys/kernel/slab/key_jar/order delete mode 100644 test/sys/kernel/slab/key_jar/partial delete mode 100644 test/sys/kernel/slab/key_jar/poison delete mode 100644 test/sys/kernel/slab/key_jar/reclaim_account delete mode 100644 test/sys/kernel/slab/key_jar/red_zone delete mode 100644 test/sys/kernel/slab/key_jar/sanity_checks delete mode 100644 test/sys/kernel/slab/key_jar/shrink delete mode 100644 test/sys/kernel/slab/key_jar/slab_size delete mode 100644 test/sys/kernel/slab/key_jar/slabs delete mode 100644 test/sys/kernel/slab/key_jar/store_user delete mode 100644 test/sys/kernel/slab/key_jar/total_objects delete mode 100644 test/sys/kernel/slab/key_jar/trace delete mode 100644 test/sys/kernel/slab/key_jar/validate delete mode 100644 test/sys/kernel/slab/kiocb/aliases delete mode 100644 test/sys/kernel/slab/kiocb/align delete mode 100644 test/sys/kernel/slab/kiocb/alloc_calls delete mode 100644 test/sys/kernel/slab/kiocb/cache_dma delete mode 100644 test/sys/kernel/slab/kiocb/cpu_slabs delete mode 100644 test/sys/kernel/slab/kiocb/ctor delete mode 100644 test/sys/kernel/slab/kiocb/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kiocb/free_calls delete mode 100644 test/sys/kernel/slab/kiocb/hwcache_align delete mode 100644 test/sys/kernel/slab/kiocb/object_size delete mode 100644 test/sys/kernel/slab/kiocb/objects delete mode 100644 test/sys/kernel/slab/kiocb/objects_partial delete mode 100644 test/sys/kernel/slab/kiocb/objs_per_slab delete mode 100644 test/sys/kernel/slab/kiocb/order delete mode 100644 test/sys/kernel/slab/kiocb/partial delete mode 100644 test/sys/kernel/slab/kiocb/poison delete mode 100644 test/sys/kernel/slab/kiocb/reclaim_account delete mode 100644 test/sys/kernel/slab/kiocb/red_zone delete mode 100644 test/sys/kernel/slab/kiocb/sanity_checks delete mode 100644 test/sys/kernel/slab/kiocb/shrink delete mode 100644 test/sys/kernel/slab/kiocb/slab_size delete mode 100644 test/sys/kernel/slab/kiocb/slabs delete mode 100644 test/sys/kernel/slab/kiocb/store_user delete mode 100644 test/sys/kernel/slab/kiocb/total_objects delete mode 100644 test/sys/kernel/slab/kiocb/trace delete mode 100644 test/sys/kernel/slab/kiocb/validate delete mode 100644 test/sys/kernel/slab/kioctx/aliases delete mode 100644 test/sys/kernel/slab/kioctx/align delete mode 100644 test/sys/kernel/slab/kioctx/alloc_calls delete mode 100644 test/sys/kernel/slab/kioctx/cache_dma delete mode 100644 test/sys/kernel/slab/kioctx/cpu_slabs delete mode 100644 test/sys/kernel/slab/kioctx/ctor delete mode 100644 test/sys/kernel/slab/kioctx/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kioctx/free_calls delete mode 100644 test/sys/kernel/slab/kioctx/hwcache_align delete mode 100644 test/sys/kernel/slab/kioctx/object_size delete mode 100644 test/sys/kernel/slab/kioctx/objects delete mode 100644 test/sys/kernel/slab/kioctx/objects_partial delete mode 100644 test/sys/kernel/slab/kioctx/objs_per_slab delete mode 100644 test/sys/kernel/slab/kioctx/order delete mode 100644 test/sys/kernel/slab/kioctx/partial delete mode 100644 test/sys/kernel/slab/kioctx/poison delete mode 100644 test/sys/kernel/slab/kioctx/reclaim_account delete mode 100644 test/sys/kernel/slab/kioctx/red_zone delete mode 100644 test/sys/kernel/slab/kioctx/sanity_checks delete mode 100644 test/sys/kernel/slab/kioctx/shrink delete mode 100644 test/sys/kernel/slab/kioctx/slab_size delete mode 100644 test/sys/kernel/slab/kioctx/slabs delete mode 100644 test/sys/kernel/slab/kioctx/store_user delete mode 100644 test/sys/kernel/slab/kioctx/total_objects delete mode 100644 test/sys/kernel/slab/kioctx/trace delete mode 100644 test/sys/kernel/slab/kioctx/validate delete mode 100644 test/sys/kernel/slab/kmalloc-1024/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-1024/align delete mode 100644 test/sys/kernel/slab/kmalloc-1024/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-1024/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-1024/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-1024/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-1024/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-1024/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-1024/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-1024/objects delete mode 100644 test/sys/kernel/slab/kmalloc-1024/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-1024/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-1024/order delete mode 100644 test/sys/kernel/slab/kmalloc-1024/partial delete mode 100644 test/sys/kernel/slab/kmalloc-1024/poison delete mode 100644 test/sys/kernel/slab/kmalloc-1024/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-1024/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-1024/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-1024/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-1024/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-1024/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-1024/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-1024/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-1024/trace delete mode 100644 test/sys/kernel/slab/kmalloc-1024/validate delete mode 100644 test/sys/kernel/slab/kmalloc-128/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-128/align delete mode 100644 test/sys/kernel/slab/kmalloc-128/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-128/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-128/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-128/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-128/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-128/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-128/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-128/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-128/objects delete mode 100644 test/sys/kernel/slab/kmalloc-128/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-128/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-128/order delete mode 100644 test/sys/kernel/slab/kmalloc-128/partial delete mode 100644 test/sys/kernel/slab/kmalloc-128/poison delete mode 100644 test/sys/kernel/slab/kmalloc-128/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-128/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-128/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-128/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-128/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-128/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-128/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-128/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-128/trace delete mode 100644 test/sys/kernel/slab/kmalloc-128/validate delete mode 100644 test/sys/kernel/slab/kmalloc-16/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-16/align delete mode 100644 test/sys/kernel/slab/kmalloc-16/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-16/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-16/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-16/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-16/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-16/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-16/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-16/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-16/objects delete mode 100644 test/sys/kernel/slab/kmalloc-16/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-16/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-16/order delete mode 100644 test/sys/kernel/slab/kmalloc-16/partial delete mode 100644 test/sys/kernel/slab/kmalloc-16/poison delete mode 100644 test/sys/kernel/slab/kmalloc-16/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-16/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-16/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-16/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-16/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-16/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-16/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-16/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-16/trace delete mode 100644 test/sys/kernel/slab/kmalloc-16/validate delete mode 100644 test/sys/kernel/slab/kmalloc-192/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-192/align delete mode 100644 test/sys/kernel/slab/kmalloc-192/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-192/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-192/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-192/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-192/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-192/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-192/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-192/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-192/objects delete mode 100644 test/sys/kernel/slab/kmalloc-192/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-192/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-192/order delete mode 100644 test/sys/kernel/slab/kmalloc-192/partial delete mode 100644 test/sys/kernel/slab/kmalloc-192/poison delete mode 100644 test/sys/kernel/slab/kmalloc-192/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-192/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-192/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-192/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-192/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-192/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-192/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-192/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-192/trace delete mode 100644 test/sys/kernel/slab/kmalloc-192/validate delete mode 100644 test/sys/kernel/slab/kmalloc-2048/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-2048/align delete mode 100644 test/sys/kernel/slab/kmalloc-2048/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-2048/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-2048/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-2048/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-2048/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-2048/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-2048/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-2048/objects delete mode 100644 test/sys/kernel/slab/kmalloc-2048/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-2048/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-2048/order delete mode 100644 test/sys/kernel/slab/kmalloc-2048/partial delete mode 100644 test/sys/kernel/slab/kmalloc-2048/poison delete mode 100644 test/sys/kernel/slab/kmalloc-2048/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-2048/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-2048/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-2048/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-2048/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-2048/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-2048/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-2048/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-2048/trace delete mode 100644 test/sys/kernel/slab/kmalloc-2048/validate delete mode 100644 test/sys/kernel/slab/kmalloc-256/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-256/align delete mode 100644 test/sys/kernel/slab/kmalloc-256/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-256/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-256/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-256/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-256/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-256/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-256/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-256/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-256/objects delete mode 100644 test/sys/kernel/slab/kmalloc-256/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-256/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-256/order delete mode 100644 test/sys/kernel/slab/kmalloc-256/partial delete mode 100644 test/sys/kernel/slab/kmalloc-256/poison delete mode 100644 test/sys/kernel/slab/kmalloc-256/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-256/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-256/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-256/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-256/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-256/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-256/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-256/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-256/trace delete mode 100644 test/sys/kernel/slab/kmalloc-256/validate delete mode 100644 test/sys/kernel/slab/kmalloc-32/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-32/align delete mode 100644 test/sys/kernel/slab/kmalloc-32/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-32/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-32/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-32/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-32/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-32/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-32/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-32/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-32/objects delete mode 100644 test/sys/kernel/slab/kmalloc-32/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-32/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-32/order delete mode 100644 test/sys/kernel/slab/kmalloc-32/partial delete mode 100644 test/sys/kernel/slab/kmalloc-32/poison delete mode 100644 test/sys/kernel/slab/kmalloc-32/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-32/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-32/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-32/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-32/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-32/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-32/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-32/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-32/trace delete mode 100644 test/sys/kernel/slab/kmalloc-32/validate delete mode 100644 test/sys/kernel/slab/kmalloc-4096/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-4096/align delete mode 100644 test/sys/kernel/slab/kmalloc-4096/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-4096/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-4096/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-4096/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-4096/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-4096/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-4096/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-4096/objects delete mode 100644 test/sys/kernel/slab/kmalloc-4096/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-4096/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-4096/order delete mode 100644 test/sys/kernel/slab/kmalloc-4096/partial delete mode 100644 test/sys/kernel/slab/kmalloc-4096/poison delete mode 100644 test/sys/kernel/slab/kmalloc-4096/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-4096/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-4096/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-4096/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-4096/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-4096/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-4096/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-4096/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-4096/trace delete mode 100644 test/sys/kernel/slab/kmalloc-4096/validate delete mode 100644 test/sys/kernel/slab/kmalloc-512/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-512/align delete mode 100644 test/sys/kernel/slab/kmalloc-512/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-512/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-512/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-512/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-512/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-512/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-512/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-512/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-512/objects delete mode 100644 test/sys/kernel/slab/kmalloc-512/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-512/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-512/order delete mode 100644 test/sys/kernel/slab/kmalloc-512/partial delete mode 100644 test/sys/kernel/slab/kmalloc-512/poison delete mode 100644 test/sys/kernel/slab/kmalloc-512/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-512/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-512/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-512/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-512/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-512/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-512/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-512/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-512/trace delete mode 100644 test/sys/kernel/slab/kmalloc-512/validate delete mode 100644 test/sys/kernel/slab/kmalloc-64/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-64/align delete mode 100644 test/sys/kernel/slab/kmalloc-64/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-64/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-64/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-64/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-64/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-64/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-64/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-64/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-64/objects delete mode 100644 test/sys/kernel/slab/kmalloc-64/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-64/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-64/order delete mode 100644 test/sys/kernel/slab/kmalloc-64/partial delete mode 100644 test/sys/kernel/slab/kmalloc-64/poison delete mode 100644 test/sys/kernel/slab/kmalloc-64/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-64/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-64/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-64/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-64/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-64/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-64/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-64/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-64/trace delete mode 100644 test/sys/kernel/slab/kmalloc-64/validate delete mode 100644 test/sys/kernel/slab/kmalloc-8/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-8/align delete mode 100644 test/sys/kernel/slab/kmalloc-8/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-8/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-8/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-8/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-8/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-8/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-8/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-8/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-8/objects delete mode 100644 test/sys/kernel/slab/kmalloc-8/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-8/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-8/order delete mode 100644 test/sys/kernel/slab/kmalloc-8/partial delete mode 100644 test/sys/kernel/slab/kmalloc-8/poison delete mode 100644 test/sys/kernel/slab/kmalloc-8/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-8/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-8/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-8/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-8/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-8/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-8/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-8/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-8/trace delete mode 100644 test/sys/kernel/slab/kmalloc-8/validate delete mode 100644 test/sys/kernel/slab/kmalloc-96/aliases delete mode 100644 test/sys/kernel/slab/kmalloc-96/align delete mode 100644 test/sys/kernel/slab/kmalloc-96/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc-96/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc-96/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc-96/ctor delete mode 100644 test/sys/kernel/slab/kmalloc-96/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc-96/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc-96/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc-96/object_size delete mode 100644 test/sys/kernel/slab/kmalloc-96/objects delete mode 100644 test/sys/kernel/slab/kmalloc-96/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc-96/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc-96/order delete mode 100644 test/sys/kernel/slab/kmalloc-96/partial delete mode 100644 test/sys/kernel/slab/kmalloc-96/poison delete mode 100644 test/sys/kernel/slab/kmalloc-96/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc-96/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc-96/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc-96/shrink delete mode 100644 test/sys/kernel/slab/kmalloc-96/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc-96/slabs delete mode 100644 test/sys/kernel/slab/kmalloc-96/store_user delete mode 100644 test/sys/kernel/slab/kmalloc-96/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc-96/trace delete mode 100644 test/sys/kernel/slab/kmalloc-96/validate delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/aliases delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/align delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/alloc_calls delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/cache_dma delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/ctor delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/free_calls delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/hwcache_align delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/object_size delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/objects delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/objects_partial delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/order delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/partial delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/poison delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/reclaim_account delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/red_zone delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/sanity_checks delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/shrink delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/slab_size delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/slabs delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/store_user delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/total_objects delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/trace delete mode 100644 test/sys/kernel/slab/kmalloc_dma-512/validate delete mode 100644 test/sys/kernel/slab/mm_struct/aliases delete mode 100644 test/sys/kernel/slab/mm_struct/align delete mode 100644 test/sys/kernel/slab/mm_struct/alloc_calls delete mode 100644 test/sys/kernel/slab/mm_struct/cache_dma delete mode 100644 test/sys/kernel/slab/mm_struct/cpu_slabs delete mode 100644 test/sys/kernel/slab/mm_struct/ctor delete mode 100644 test/sys/kernel/slab/mm_struct/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/mm_struct/free_calls delete mode 100644 test/sys/kernel/slab/mm_struct/hwcache_align delete mode 100644 test/sys/kernel/slab/mm_struct/object_size delete mode 100644 test/sys/kernel/slab/mm_struct/objects delete mode 100644 test/sys/kernel/slab/mm_struct/objects_partial delete mode 100644 test/sys/kernel/slab/mm_struct/objs_per_slab delete mode 100644 test/sys/kernel/slab/mm_struct/order delete mode 100644 test/sys/kernel/slab/mm_struct/partial delete mode 100644 test/sys/kernel/slab/mm_struct/poison delete mode 100644 test/sys/kernel/slab/mm_struct/reclaim_account delete mode 100644 test/sys/kernel/slab/mm_struct/red_zone delete mode 100644 test/sys/kernel/slab/mm_struct/sanity_checks delete mode 100644 test/sys/kernel/slab/mm_struct/shrink delete mode 100644 test/sys/kernel/slab/mm_struct/slab_size delete mode 100644 test/sys/kernel/slab/mm_struct/slabs delete mode 100644 test/sys/kernel/slab/mm_struct/store_user delete mode 100644 test/sys/kernel/slab/mm_struct/total_objects delete mode 100644 test/sys/kernel/slab/mm_struct/trace delete mode 100644 test/sys/kernel/slab/mm_struct/validate delete mode 100644 test/sys/kernel/slab/mnt_cache/aliases delete mode 100644 test/sys/kernel/slab/mnt_cache/align delete mode 100644 test/sys/kernel/slab/mnt_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/mnt_cache/cache_dma delete mode 100644 test/sys/kernel/slab/mnt_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/mnt_cache/ctor delete mode 100644 test/sys/kernel/slab/mnt_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/mnt_cache/free_calls delete mode 100644 test/sys/kernel/slab/mnt_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/mnt_cache/object_size delete mode 100644 test/sys/kernel/slab/mnt_cache/objects delete mode 100644 test/sys/kernel/slab/mnt_cache/objects_partial delete mode 100644 test/sys/kernel/slab/mnt_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/mnt_cache/order delete mode 100644 test/sys/kernel/slab/mnt_cache/partial delete mode 100644 test/sys/kernel/slab/mnt_cache/poison delete mode 100644 test/sys/kernel/slab/mnt_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/mnt_cache/red_zone delete mode 100644 test/sys/kernel/slab/mnt_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/mnt_cache/shrink delete mode 100644 test/sys/kernel/slab/mnt_cache/slab_size delete mode 100644 test/sys/kernel/slab/mnt_cache/slabs delete mode 100644 test/sys/kernel/slab/mnt_cache/store_user delete mode 100644 test/sys/kernel/slab/mnt_cache/total_objects delete mode 100644 test/sys/kernel/slab/mnt_cache/trace delete mode 100644 test/sys/kernel/slab/mnt_cache/validate delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/aliases delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/align delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/cache_dma delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/ctor delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/free_calls delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/object_size delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/objects delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/objects_partial delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/order delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/partial delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/poison delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/red_zone delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/shrink delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/slab_size delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/slabs delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/store_user delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/total_objects delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/trace delete mode 100644 test/sys/kernel/slab/mqueue_inode_cache/validate delete mode 100644 test/sys/kernel/slab/names_cache/aliases delete mode 100644 test/sys/kernel/slab/names_cache/align delete mode 100644 test/sys/kernel/slab/names_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/names_cache/cache_dma delete mode 100644 test/sys/kernel/slab/names_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/names_cache/ctor delete mode 100644 test/sys/kernel/slab/names_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/names_cache/free_calls delete mode 100644 test/sys/kernel/slab/names_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/names_cache/object_size delete mode 100644 test/sys/kernel/slab/names_cache/objects delete mode 100644 test/sys/kernel/slab/names_cache/objects_partial delete mode 100644 test/sys/kernel/slab/names_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/names_cache/order delete mode 100644 test/sys/kernel/slab/names_cache/partial delete mode 100644 test/sys/kernel/slab/names_cache/poison delete mode 100644 test/sys/kernel/slab/names_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/names_cache/red_zone delete mode 100644 test/sys/kernel/slab/names_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/names_cache/shrink delete mode 100644 test/sys/kernel/slab/names_cache/slab_size delete mode 100644 test/sys/kernel/slab/names_cache/slabs delete mode 100644 test/sys/kernel/slab/names_cache/store_user delete mode 100644 test/sys/kernel/slab/names_cache/total_objects delete mode 100644 test/sys/kernel/slab/names_cache/trace delete mode 100644 test/sys/kernel/slab/names_cache/validate delete mode 100644 test/sys/kernel/slab/ndisc_cache/aliases delete mode 100644 test/sys/kernel/slab/ndisc_cache/align delete mode 100644 test/sys/kernel/slab/ndisc_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/ndisc_cache/cache_dma delete mode 100644 test/sys/kernel/slab/ndisc_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/ndisc_cache/ctor delete mode 100644 test/sys/kernel/slab/ndisc_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/ndisc_cache/free_calls delete mode 100644 test/sys/kernel/slab/ndisc_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/ndisc_cache/object_size delete mode 100644 test/sys/kernel/slab/ndisc_cache/objects delete mode 100644 test/sys/kernel/slab/ndisc_cache/objects_partial delete mode 100644 test/sys/kernel/slab/ndisc_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/ndisc_cache/order delete mode 100644 test/sys/kernel/slab/ndisc_cache/partial delete mode 100644 test/sys/kernel/slab/ndisc_cache/poison delete mode 100644 test/sys/kernel/slab/ndisc_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/ndisc_cache/red_zone delete mode 100644 test/sys/kernel/slab/ndisc_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/ndisc_cache/shrink delete mode 100644 test/sys/kernel/slab/ndisc_cache/slab_size delete mode 100644 test/sys/kernel/slab/ndisc_cache/slabs delete mode 100644 test/sys/kernel/slab/ndisc_cache/store_user delete mode 100644 test/sys/kernel/slab/ndisc_cache/total_objects delete mode 100644 test/sys/kernel/slab/ndisc_cache/trace delete mode 100644 test/sys/kernel/slab/ndisc_cache/validate delete mode 100644 test/sys/kernel/slab/nsproxy/aliases delete mode 100644 test/sys/kernel/slab/nsproxy/align delete mode 100644 test/sys/kernel/slab/nsproxy/alloc_calls delete mode 100644 test/sys/kernel/slab/nsproxy/cache_dma delete mode 100644 test/sys/kernel/slab/nsproxy/cpu_slabs delete mode 100644 test/sys/kernel/slab/nsproxy/ctor delete mode 100644 test/sys/kernel/slab/nsproxy/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/nsproxy/free_calls delete mode 100644 test/sys/kernel/slab/nsproxy/hwcache_align delete mode 100644 test/sys/kernel/slab/nsproxy/object_size delete mode 100644 test/sys/kernel/slab/nsproxy/objects delete mode 100644 test/sys/kernel/slab/nsproxy/objects_partial delete mode 100644 test/sys/kernel/slab/nsproxy/objs_per_slab delete mode 100644 test/sys/kernel/slab/nsproxy/order delete mode 100644 test/sys/kernel/slab/nsproxy/partial delete mode 100644 test/sys/kernel/slab/nsproxy/poison delete mode 100644 test/sys/kernel/slab/nsproxy/reclaim_account delete mode 100644 test/sys/kernel/slab/nsproxy/red_zone delete mode 100644 test/sys/kernel/slab/nsproxy/sanity_checks delete mode 100644 test/sys/kernel/slab/nsproxy/shrink delete mode 100644 test/sys/kernel/slab/nsproxy/slab_size delete mode 100644 test/sys/kernel/slab/nsproxy/slabs delete mode 100644 test/sys/kernel/slab/nsproxy/store_user delete mode 100644 test/sys/kernel/slab/nsproxy/total_objects delete mode 100644 test/sys/kernel/slab/nsproxy/trace delete mode 100644 test/sys/kernel/slab/nsproxy/validate delete mode 100644 test/sys/kernel/slab/pid/aliases delete mode 100644 test/sys/kernel/slab/pid/align delete mode 100644 test/sys/kernel/slab/pid/alloc_calls delete mode 100644 test/sys/kernel/slab/pid/cache_dma delete mode 100644 test/sys/kernel/slab/pid/cpu_slabs delete mode 100644 test/sys/kernel/slab/pid/ctor delete mode 100644 test/sys/kernel/slab/pid/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/pid/free_calls delete mode 100644 test/sys/kernel/slab/pid/hwcache_align delete mode 100644 test/sys/kernel/slab/pid/object_size delete mode 100644 test/sys/kernel/slab/pid/objects delete mode 100644 test/sys/kernel/slab/pid/objects_partial delete mode 100644 test/sys/kernel/slab/pid/objs_per_slab delete mode 100644 test/sys/kernel/slab/pid/order delete mode 100644 test/sys/kernel/slab/pid/partial delete mode 100644 test/sys/kernel/slab/pid/poison delete mode 100644 test/sys/kernel/slab/pid/reclaim_account delete mode 100644 test/sys/kernel/slab/pid/red_zone delete mode 100644 test/sys/kernel/slab/pid/sanity_checks delete mode 100644 test/sys/kernel/slab/pid/shrink delete mode 100644 test/sys/kernel/slab/pid/slab_size delete mode 100644 test/sys/kernel/slab/pid/slabs delete mode 100644 test/sys/kernel/slab/pid/store_user delete mode 100644 test/sys/kernel/slab/pid/total_objects delete mode 100644 test/sys/kernel/slab/pid/trace delete mode 100644 test/sys/kernel/slab/pid/validate delete mode 100644 test/sys/kernel/slab/posix_timers_cache/aliases delete mode 100644 test/sys/kernel/slab/posix_timers_cache/align delete mode 100644 test/sys/kernel/slab/posix_timers_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/posix_timers_cache/cache_dma delete mode 100644 test/sys/kernel/slab/posix_timers_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/posix_timers_cache/ctor delete mode 100644 test/sys/kernel/slab/posix_timers_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/posix_timers_cache/free_calls delete mode 100644 test/sys/kernel/slab/posix_timers_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/posix_timers_cache/object_size delete mode 100644 test/sys/kernel/slab/posix_timers_cache/objects delete mode 100644 test/sys/kernel/slab/posix_timers_cache/objects_partial delete mode 100644 test/sys/kernel/slab/posix_timers_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/posix_timers_cache/order delete mode 100644 test/sys/kernel/slab/posix_timers_cache/partial delete mode 100644 test/sys/kernel/slab/posix_timers_cache/poison delete mode 100644 test/sys/kernel/slab/posix_timers_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/posix_timers_cache/red_zone delete mode 100644 test/sys/kernel/slab/posix_timers_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/posix_timers_cache/shrink delete mode 100644 test/sys/kernel/slab/posix_timers_cache/slab_size delete mode 100644 test/sys/kernel/slab/posix_timers_cache/slabs delete mode 100644 test/sys/kernel/slab/posix_timers_cache/store_user delete mode 100644 test/sys/kernel/slab/posix_timers_cache/total_objects delete mode 100644 test/sys/kernel/slab/posix_timers_cache/trace delete mode 100644 test/sys/kernel/slab/posix_timers_cache/validate delete mode 100644 test/sys/kernel/slab/proc_inode_cache/aliases delete mode 100644 test/sys/kernel/slab/proc_inode_cache/align delete mode 100644 test/sys/kernel/slab/proc_inode_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/proc_inode_cache/cache_dma delete mode 100644 test/sys/kernel/slab/proc_inode_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/proc_inode_cache/ctor delete mode 100644 test/sys/kernel/slab/proc_inode_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/proc_inode_cache/free_calls delete mode 100644 test/sys/kernel/slab/proc_inode_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/proc_inode_cache/object_size delete mode 100644 test/sys/kernel/slab/proc_inode_cache/objects delete mode 100644 test/sys/kernel/slab/proc_inode_cache/objects_partial delete mode 100644 test/sys/kernel/slab/proc_inode_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/proc_inode_cache/order delete mode 100644 test/sys/kernel/slab/proc_inode_cache/partial delete mode 100644 test/sys/kernel/slab/proc_inode_cache/poison delete mode 100644 test/sys/kernel/slab/proc_inode_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/proc_inode_cache/red_zone delete mode 100644 test/sys/kernel/slab/proc_inode_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/proc_inode_cache/shrink delete mode 100644 test/sys/kernel/slab/proc_inode_cache/slab_size delete mode 100644 test/sys/kernel/slab/proc_inode_cache/slabs delete mode 100644 test/sys/kernel/slab/proc_inode_cache/store_user delete mode 100644 test/sys/kernel/slab/proc_inode_cache/total_objects delete mode 100644 test/sys/kernel/slab/proc_inode_cache/trace delete mode 100644 test/sys/kernel/slab/proc_inode_cache/validate delete mode 100644 test/sys/kernel/slab/radix_tree_node/aliases delete mode 100644 test/sys/kernel/slab/radix_tree_node/align delete mode 100644 test/sys/kernel/slab/radix_tree_node/alloc_calls delete mode 100644 test/sys/kernel/slab/radix_tree_node/cache_dma delete mode 100644 test/sys/kernel/slab/radix_tree_node/cpu_slabs delete mode 100644 test/sys/kernel/slab/radix_tree_node/ctor delete mode 100644 test/sys/kernel/slab/radix_tree_node/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/radix_tree_node/free_calls delete mode 100644 test/sys/kernel/slab/radix_tree_node/hwcache_align delete mode 100644 test/sys/kernel/slab/radix_tree_node/object_size delete mode 100644 test/sys/kernel/slab/radix_tree_node/objects delete mode 100644 test/sys/kernel/slab/radix_tree_node/objects_partial delete mode 100644 test/sys/kernel/slab/radix_tree_node/objs_per_slab delete mode 100644 test/sys/kernel/slab/radix_tree_node/order delete mode 100644 test/sys/kernel/slab/radix_tree_node/partial delete mode 100644 test/sys/kernel/slab/radix_tree_node/poison delete mode 100644 test/sys/kernel/slab/radix_tree_node/reclaim_account delete mode 100644 test/sys/kernel/slab/radix_tree_node/red_zone delete mode 100644 test/sys/kernel/slab/radix_tree_node/sanity_checks delete mode 100644 test/sys/kernel/slab/radix_tree_node/shrink delete mode 100644 test/sys/kernel/slab/radix_tree_node/slab_size delete mode 100644 test/sys/kernel/slab/radix_tree_node/slabs delete mode 100644 test/sys/kernel/slab/radix_tree_node/store_user delete mode 100644 test/sys/kernel/slab/radix_tree_node/total_objects delete mode 100644 test/sys/kernel/slab/radix_tree_node/trace delete mode 100644 test/sys/kernel/slab/radix_tree_node/validate delete mode 100644 test/sys/kernel/slab/request_sock_TCP/aliases delete mode 100644 test/sys/kernel/slab/request_sock_TCP/align delete mode 100644 test/sys/kernel/slab/request_sock_TCP/alloc_calls delete mode 100644 test/sys/kernel/slab/request_sock_TCP/cache_dma delete mode 100644 test/sys/kernel/slab/request_sock_TCP/cpu_slabs delete mode 100644 test/sys/kernel/slab/request_sock_TCP/ctor delete mode 100644 test/sys/kernel/slab/request_sock_TCP/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/request_sock_TCP/free_calls delete mode 100644 test/sys/kernel/slab/request_sock_TCP/hwcache_align delete mode 100644 test/sys/kernel/slab/request_sock_TCP/object_size delete mode 100644 test/sys/kernel/slab/request_sock_TCP/objects delete mode 100644 test/sys/kernel/slab/request_sock_TCP/objects_partial delete mode 100644 test/sys/kernel/slab/request_sock_TCP/objs_per_slab delete mode 100644 test/sys/kernel/slab/request_sock_TCP/order delete mode 100644 test/sys/kernel/slab/request_sock_TCP/partial delete mode 100644 test/sys/kernel/slab/request_sock_TCP/poison delete mode 100644 test/sys/kernel/slab/request_sock_TCP/reclaim_account delete mode 100644 test/sys/kernel/slab/request_sock_TCP/red_zone delete mode 100644 test/sys/kernel/slab/request_sock_TCP/sanity_checks delete mode 100644 test/sys/kernel/slab/request_sock_TCP/shrink delete mode 100644 test/sys/kernel/slab/request_sock_TCP/slab_size delete mode 100644 test/sys/kernel/slab/request_sock_TCP/slabs delete mode 100644 test/sys/kernel/slab/request_sock_TCP/store_user delete mode 100644 test/sys/kernel/slab/request_sock_TCP/total_objects delete mode 100644 test/sys/kernel/slab/request_sock_TCP/trace delete mode 100644 test/sys/kernel/slab/request_sock_TCP/validate delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/aliases delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/align delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/alloc_calls delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/cache_dma delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/ctor delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/free_calls delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/hwcache_align delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/object_size delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/objects delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/objects_partial delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/objs_per_slab delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/order delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/partial delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/poison delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/reclaim_account delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/red_zone delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/sanity_checks delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/shrink delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/slab_size delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/slabs delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/store_user delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/total_objects delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/trace delete mode 100644 test/sys/kernel/slab/request_sock_TCPv6/validate delete mode 100644 test/sys/kernel/slab/revoke_record/aliases delete mode 100644 test/sys/kernel/slab/revoke_record/align delete mode 100644 test/sys/kernel/slab/revoke_record/alloc_calls delete mode 100644 test/sys/kernel/slab/revoke_record/cache_dma delete mode 100644 test/sys/kernel/slab/revoke_record/cpu_slabs delete mode 100644 test/sys/kernel/slab/revoke_record/ctor delete mode 100644 test/sys/kernel/slab/revoke_record/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/revoke_record/free_calls delete mode 100644 test/sys/kernel/slab/revoke_record/hwcache_align delete mode 100644 test/sys/kernel/slab/revoke_record/object_size delete mode 100644 test/sys/kernel/slab/revoke_record/objects delete mode 100644 test/sys/kernel/slab/revoke_record/objects_partial delete mode 100644 test/sys/kernel/slab/revoke_record/objs_per_slab delete mode 100644 test/sys/kernel/slab/revoke_record/order delete mode 100644 test/sys/kernel/slab/revoke_record/partial delete mode 100644 test/sys/kernel/slab/revoke_record/poison delete mode 100644 test/sys/kernel/slab/revoke_record/reclaim_account delete mode 100644 test/sys/kernel/slab/revoke_record/red_zone delete mode 100644 test/sys/kernel/slab/revoke_record/sanity_checks delete mode 100644 test/sys/kernel/slab/revoke_record/shrink delete mode 100644 test/sys/kernel/slab/revoke_record/slab_size delete mode 100644 test/sys/kernel/slab/revoke_record/slabs delete mode 100644 test/sys/kernel/slab/revoke_record/store_user delete mode 100644 test/sys/kernel/slab/revoke_record/total_objects delete mode 100644 test/sys/kernel/slab/revoke_record/trace delete mode 100644 test/sys/kernel/slab/revoke_record/validate delete mode 100644 test/sys/kernel/slab/revoke_table/aliases delete mode 100644 test/sys/kernel/slab/revoke_table/align delete mode 100644 test/sys/kernel/slab/revoke_table/alloc_calls delete mode 100644 test/sys/kernel/slab/revoke_table/cache_dma delete mode 100644 test/sys/kernel/slab/revoke_table/cpu_slabs delete mode 100644 test/sys/kernel/slab/revoke_table/ctor delete mode 100644 test/sys/kernel/slab/revoke_table/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/revoke_table/free_calls delete mode 100644 test/sys/kernel/slab/revoke_table/hwcache_align delete mode 100644 test/sys/kernel/slab/revoke_table/object_size delete mode 100644 test/sys/kernel/slab/revoke_table/objects delete mode 100644 test/sys/kernel/slab/revoke_table/objects_partial delete mode 100644 test/sys/kernel/slab/revoke_table/objs_per_slab delete mode 100644 test/sys/kernel/slab/revoke_table/order delete mode 100644 test/sys/kernel/slab/revoke_table/partial delete mode 100644 test/sys/kernel/slab/revoke_table/poison delete mode 100644 test/sys/kernel/slab/revoke_table/reclaim_account delete mode 100644 test/sys/kernel/slab/revoke_table/red_zone delete mode 100644 test/sys/kernel/slab/revoke_table/sanity_checks delete mode 100644 test/sys/kernel/slab/revoke_table/shrink delete mode 100644 test/sys/kernel/slab/revoke_table/slab_size delete mode 100644 test/sys/kernel/slab/revoke_table/slabs delete mode 100644 test/sys/kernel/slab/revoke_table/store_user delete mode 100644 test/sys/kernel/slab/revoke_table/total_objects delete mode 100644 test/sys/kernel/slab/revoke_table/trace delete mode 100644 test/sys/kernel/slab/revoke_table/validate delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/aliases delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/align delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/cache_dma delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/ctor delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/free_calls delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/object_size delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/objects delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/objects_partial delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/order delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/partial delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/poison delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/red_zone delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/shrink delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/slab_size delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/slabs delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/store_user delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/total_objects delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/trace delete mode 100644 test/sys/kernel/slab/scsi_cmd_cache/validate delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/aliases delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/align delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/alloc_calls delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/cache_dma delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/cpu_slabs delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/ctor delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/free_calls delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/hwcache_align delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/object_size delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/objects delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/objects_partial delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/objs_per_slab delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/order delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/partial delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/poison delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/reclaim_account delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/red_zone delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/sanity_checks delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/shrink delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/slab_size delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/slabs delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/store_user delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/total_objects delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/trace delete mode 100644 test/sys/kernel/slab/scsi_data_buffer/validate delete mode 100644 test/sys/kernel/slab/scsi_io_context/aliases delete mode 100644 test/sys/kernel/slab/scsi_io_context/align delete mode 100644 test/sys/kernel/slab/scsi_io_context/alloc_calls delete mode 100644 test/sys/kernel/slab/scsi_io_context/cache_dma delete mode 100644 test/sys/kernel/slab/scsi_io_context/cpu_slabs delete mode 100644 test/sys/kernel/slab/scsi_io_context/ctor delete mode 100644 test/sys/kernel/slab/scsi_io_context/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/scsi_io_context/free_calls delete mode 100644 test/sys/kernel/slab/scsi_io_context/hwcache_align delete mode 100644 test/sys/kernel/slab/scsi_io_context/object_size delete mode 100644 test/sys/kernel/slab/scsi_io_context/objects delete mode 100644 test/sys/kernel/slab/scsi_io_context/objects_partial delete mode 100644 test/sys/kernel/slab/scsi_io_context/objs_per_slab delete mode 100644 test/sys/kernel/slab/scsi_io_context/order delete mode 100644 test/sys/kernel/slab/scsi_io_context/partial delete mode 100644 test/sys/kernel/slab/scsi_io_context/poison delete mode 100644 test/sys/kernel/slab/scsi_io_context/reclaim_account delete mode 100644 test/sys/kernel/slab/scsi_io_context/red_zone delete mode 100644 test/sys/kernel/slab/scsi_io_context/sanity_checks delete mode 100644 test/sys/kernel/slab/scsi_io_context/shrink delete mode 100644 test/sys/kernel/slab/scsi_io_context/slab_size delete mode 100644 test/sys/kernel/slab/scsi_io_context/slabs delete mode 100644 test/sys/kernel/slab/scsi_io_context/store_user delete mode 100644 test/sys/kernel/slab/scsi_io_context/total_objects delete mode 100644 test/sys/kernel/slab/scsi_io_context/trace delete mode 100644 test/sys/kernel/slab/scsi_io_context/validate delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/aliases delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/align delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/cache_dma delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/ctor delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/free_calls delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/object_size delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/objects delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/objects_partial delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/order delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/partial delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/poison delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/red_zone delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/shrink delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/slab_size delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/slabs delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/store_user delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/total_objects delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/trace delete mode 100644 test/sys/kernel/slab/scsi_sense_cache/validate delete mode 100644 test/sys/kernel/slab/secpath_cache/aliases delete mode 100644 test/sys/kernel/slab/secpath_cache/align delete mode 100644 test/sys/kernel/slab/secpath_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/secpath_cache/cache_dma delete mode 100644 test/sys/kernel/slab/secpath_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/secpath_cache/ctor delete mode 100644 test/sys/kernel/slab/secpath_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/secpath_cache/free_calls delete mode 100644 test/sys/kernel/slab/secpath_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/secpath_cache/object_size delete mode 100644 test/sys/kernel/slab/secpath_cache/objects delete mode 100644 test/sys/kernel/slab/secpath_cache/objects_partial delete mode 100644 test/sys/kernel/slab/secpath_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/secpath_cache/order delete mode 100644 test/sys/kernel/slab/secpath_cache/partial delete mode 100644 test/sys/kernel/slab/secpath_cache/poison delete mode 100644 test/sys/kernel/slab/secpath_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/secpath_cache/red_zone delete mode 100644 test/sys/kernel/slab/secpath_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/secpath_cache/shrink delete mode 100644 test/sys/kernel/slab/secpath_cache/slab_size delete mode 100644 test/sys/kernel/slab/secpath_cache/slabs delete mode 100644 test/sys/kernel/slab/secpath_cache/store_user delete mode 100644 test/sys/kernel/slab/secpath_cache/total_objects delete mode 100644 test/sys/kernel/slab/secpath_cache/trace delete mode 100644 test/sys/kernel/slab/secpath_cache/validate delete mode 100644 test/sys/kernel/slab/sgpool-128/aliases delete mode 100644 test/sys/kernel/slab/sgpool-128/align delete mode 100644 test/sys/kernel/slab/sgpool-128/alloc_calls delete mode 100644 test/sys/kernel/slab/sgpool-128/cache_dma delete mode 100644 test/sys/kernel/slab/sgpool-128/cpu_slabs delete mode 100644 test/sys/kernel/slab/sgpool-128/ctor delete mode 100644 test/sys/kernel/slab/sgpool-128/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/sgpool-128/free_calls delete mode 100644 test/sys/kernel/slab/sgpool-128/hwcache_align delete mode 100644 test/sys/kernel/slab/sgpool-128/object_size delete mode 100644 test/sys/kernel/slab/sgpool-128/objects delete mode 100644 test/sys/kernel/slab/sgpool-128/objects_partial delete mode 100644 test/sys/kernel/slab/sgpool-128/objs_per_slab delete mode 100644 test/sys/kernel/slab/sgpool-128/order delete mode 100644 test/sys/kernel/slab/sgpool-128/partial delete mode 100644 test/sys/kernel/slab/sgpool-128/poison delete mode 100644 test/sys/kernel/slab/sgpool-128/reclaim_account delete mode 100644 test/sys/kernel/slab/sgpool-128/red_zone delete mode 100644 test/sys/kernel/slab/sgpool-128/sanity_checks delete mode 100644 test/sys/kernel/slab/sgpool-128/shrink delete mode 100644 test/sys/kernel/slab/sgpool-128/slab_size delete mode 100644 test/sys/kernel/slab/sgpool-128/slabs delete mode 100644 test/sys/kernel/slab/sgpool-128/store_user delete mode 100644 test/sys/kernel/slab/sgpool-128/total_objects delete mode 100644 test/sys/kernel/slab/sgpool-128/trace delete mode 100644 test/sys/kernel/slab/sgpool-128/validate delete mode 100644 test/sys/kernel/slab/sgpool-16/aliases delete mode 100644 test/sys/kernel/slab/sgpool-16/align delete mode 100644 test/sys/kernel/slab/sgpool-16/alloc_calls delete mode 100644 test/sys/kernel/slab/sgpool-16/cache_dma delete mode 100644 test/sys/kernel/slab/sgpool-16/cpu_slabs delete mode 100644 test/sys/kernel/slab/sgpool-16/ctor delete mode 100644 test/sys/kernel/slab/sgpool-16/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/sgpool-16/free_calls delete mode 100644 test/sys/kernel/slab/sgpool-16/hwcache_align delete mode 100644 test/sys/kernel/slab/sgpool-16/object_size delete mode 100644 test/sys/kernel/slab/sgpool-16/objects delete mode 100644 test/sys/kernel/slab/sgpool-16/objects_partial delete mode 100644 test/sys/kernel/slab/sgpool-16/objs_per_slab delete mode 100644 test/sys/kernel/slab/sgpool-16/order delete mode 100644 test/sys/kernel/slab/sgpool-16/partial delete mode 100644 test/sys/kernel/slab/sgpool-16/poison delete mode 100644 test/sys/kernel/slab/sgpool-16/reclaim_account delete mode 100644 test/sys/kernel/slab/sgpool-16/red_zone delete mode 100644 test/sys/kernel/slab/sgpool-16/sanity_checks delete mode 100644 test/sys/kernel/slab/sgpool-16/shrink delete mode 100644 test/sys/kernel/slab/sgpool-16/slab_size delete mode 100644 test/sys/kernel/slab/sgpool-16/slabs delete mode 100644 test/sys/kernel/slab/sgpool-16/store_user delete mode 100644 test/sys/kernel/slab/sgpool-16/total_objects delete mode 100644 test/sys/kernel/slab/sgpool-16/trace delete mode 100644 test/sys/kernel/slab/sgpool-16/validate delete mode 100644 test/sys/kernel/slab/sgpool-32/aliases delete mode 100644 test/sys/kernel/slab/sgpool-32/align delete mode 100644 test/sys/kernel/slab/sgpool-32/alloc_calls delete mode 100644 test/sys/kernel/slab/sgpool-32/cache_dma delete mode 100644 test/sys/kernel/slab/sgpool-32/cpu_slabs delete mode 100644 test/sys/kernel/slab/sgpool-32/ctor delete mode 100644 test/sys/kernel/slab/sgpool-32/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/sgpool-32/free_calls delete mode 100644 test/sys/kernel/slab/sgpool-32/hwcache_align delete mode 100644 test/sys/kernel/slab/sgpool-32/object_size delete mode 100644 test/sys/kernel/slab/sgpool-32/objects delete mode 100644 test/sys/kernel/slab/sgpool-32/objects_partial delete mode 100644 test/sys/kernel/slab/sgpool-32/objs_per_slab delete mode 100644 test/sys/kernel/slab/sgpool-32/order delete mode 100644 test/sys/kernel/slab/sgpool-32/partial delete mode 100644 test/sys/kernel/slab/sgpool-32/poison delete mode 100644 test/sys/kernel/slab/sgpool-32/reclaim_account delete mode 100644 test/sys/kernel/slab/sgpool-32/red_zone delete mode 100644 test/sys/kernel/slab/sgpool-32/sanity_checks delete mode 100644 test/sys/kernel/slab/sgpool-32/shrink delete mode 100644 test/sys/kernel/slab/sgpool-32/slab_size delete mode 100644 test/sys/kernel/slab/sgpool-32/slabs delete mode 100644 test/sys/kernel/slab/sgpool-32/store_user delete mode 100644 test/sys/kernel/slab/sgpool-32/total_objects delete mode 100644 test/sys/kernel/slab/sgpool-32/trace delete mode 100644 test/sys/kernel/slab/sgpool-32/validate delete mode 100644 test/sys/kernel/slab/sgpool-64/aliases delete mode 100644 test/sys/kernel/slab/sgpool-64/align delete mode 100644 test/sys/kernel/slab/sgpool-64/alloc_calls delete mode 100644 test/sys/kernel/slab/sgpool-64/cache_dma delete mode 100644 test/sys/kernel/slab/sgpool-64/cpu_slabs delete mode 100644 test/sys/kernel/slab/sgpool-64/ctor delete mode 100644 test/sys/kernel/slab/sgpool-64/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/sgpool-64/free_calls delete mode 100644 test/sys/kernel/slab/sgpool-64/hwcache_align delete mode 100644 test/sys/kernel/slab/sgpool-64/object_size delete mode 100644 test/sys/kernel/slab/sgpool-64/objects delete mode 100644 test/sys/kernel/slab/sgpool-64/objects_partial delete mode 100644 test/sys/kernel/slab/sgpool-64/objs_per_slab delete mode 100644 test/sys/kernel/slab/sgpool-64/order delete mode 100644 test/sys/kernel/slab/sgpool-64/partial delete mode 100644 test/sys/kernel/slab/sgpool-64/poison delete mode 100644 test/sys/kernel/slab/sgpool-64/reclaim_account delete mode 100644 test/sys/kernel/slab/sgpool-64/red_zone delete mode 100644 test/sys/kernel/slab/sgpool-64/sanity_checks delete mode 100644 test/sys/kernel/slab/sgpool-64/shrink delete mode 100644 test/sys/kernel/slab/sgpool-64/slab_size delete mode 100644 test/sys/kernel/slab/sgpool-64/slabs delete mode 100644 test/sys/kernel/slab/sgpool-64/store_user delete mode 100644 test/sys/kernel/slab/sgpool-64/total_objects delete mode 100644 test/sys/kernel/slab/sgpool-64/trace delete mode 100644 test/sys/kernel/slab/sgpool-64/validate delete mode 100644 test/sys/kernel/slab/sgpool-8/aliases delete mode 100644 test/sys/kernel/slab/sgpool-8/align delete mode 100644 test/sys/kernel/slab/sgpool-8/alloc_calls delete mode 100644 test/sys/kernel/slab/sgpool-8/cache_dma delete mode 100644 test/sys/kernel/slab/sgpool-8/cpu_slabs delete mode 100644 test/sys/kernel/slab/sgpool-8/ctor delete mode 100644 test/sys/kernel/slab/sgpool-8/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/sgpool-8/free_calls delete mode 100644 test/sys/kernel/slab/sgpool-8/hwcache_align delete mode 100644 test/sys/kernel/slab/sgpool-8/object_size delete mode 100644 test/sys/kernel/slab/sgpool-8/objects delete mode 100644 test/sys/kernel/slab/sgpool-8/objects_partial delete mode 100644 test/sys/kernel/slab/sgpool-8/objs_per_slab delete mode 100644 test/sys/kernel/slab/sgpool-8/order delete mode 100644 test/sys/kernel/slab/sgpool-8/partial delete mode 100644 test/sys/kernel/slab/sgpool-8/poison delete mode 100644 test/sys/kernel/slab/sgpool-8/reclaim_account delete mode 100644 test/sys/kernel/slab/sgpool-8/red_zone delete mode 100644 test/sys/kernel/slab/sgpool-8/sanity_checks delete mode 100644 test/sys/kernel/slab/sgpool-8/shrink delete mode 100644 test/sys/kernel/slab/sgpool-8/slab_size delete mode 100644 test/sys/kernel/slab/sgpool-8/slabs delete mode 100644 test/sys/kernel/slab/sgpool-8/store_user delete mode 100644 test/sys/kernel/slab/sgpool-8/total_objects delete mode 100644 test/sys/kernel/slab/sgpool-8/trace delete mode 100644 test/sys/kernel/slab/sgpool-8/validate delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/aliases delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/align delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/cache_dma delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/ctor delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/free_calls delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/object_size delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/objects delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/objects_partial delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/order delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/partial delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/poison delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/red_zone delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/shrink delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/slab_size delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/slabs delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/store_user delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/total_objects delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/trace delete mode 100644 test/sys/kernel/slab/shmem_inode_cache/validate delete mode 100644 test/sys/kernel/slab/sighand_cache/aliases delete mode 100644 test/sys/kernel/slab/sighand_cache/align delete mode 100644 test/sys/kernel/slab/sighand_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/sighand_cache/cache_dma delete mode 100644 test/sys/kernel/slab/sighand_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/sighand_cache/ctor delete mode 100644 test/sys/kernel/slab/sighand_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/sighand_cache/free_calls delete mode 100644 test/sys/kernel/slab/sighand_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/sighand_cache/object_size delete mode 100644 test/sys/kernel/slab/sighand_cache/objects delete mode 100644 test/sys/kernel/slab/sighand_cache/objects_partial delete mode 100644 test/sys/kernel/slab/sighand_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/sighand_cache/order delete mode 100644 test/sys/kernel/slab/sighand_cache/partial delete mode 100644 test/sys/kernel/slab/sighand_cache/poison delete mode 100644 test/sys/kernel/slab/sighand_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/sighand_cache/red_zone delete mode 100644 test/sys/kernel/slab/sighand_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/sighand_cache/shrink delete mode 100644 test/sys/kernel/slab/sighand_cache/slab_size delete mode 100644 test/sys/kernel/slab/sighand_cache/slabs delete mode 100644 test/sys/kernel/slab/sighand_cache/store_user delete mode 100644 test/sys/kernel/slab/sighand_cache/total_objects delete mode 100644 test/sys/kernel/slab/sighand_cache/trace delete mode 100644 test/sys/kernel/slab/sighand_cache/validate delete mode 100644 test/sys/kernel/slab/signal_cache/aliases delete mode 100644 test/sys/kernel/slab/signal_cache/align delete mode 100644 test/sys/kernel/slab/signal_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/signal_cache/cache_dma delete mode 100644 test/sys/kernel/slab/signal_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/signal_cache/ctor delete mode 100644 test/sys/kernel/slab/signal_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/signal_cache/free_calls delete mode 100644 test/sys/kernel/slab/signal_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/signal_cache/object_size delete mode 100644 test/sys/kernel/slab/signal_cache/objects delete mode 100644 test/sys/kernel/slab/signal_cache/objects_partial delete mode 100644 test/sys/kernel/slab/signal_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/signal_cache/order delete mode 100644 test/sys/kernel/slab/signal_cache/partial delete mode 100644 test/sys/kernel/slab/signal_cache/poison delete mode 100644 test/sys/kernel/slab/signal_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/signal_cache/red_zone delete mode 100644 test/sys/kernel/slab/signal_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/signal_cache/shrink delete mode 100644 test/sys/kernel/slab/signal_cache/slab_size delete mode 100644 test/sys/kernel/slab/signal_cache/slabs delete mode 100644 test/sys/kernel/slab/signal_cache/store_user delete mode 100644 test/sys/kernel/slab/signal_cache/total_objects delete mode 100644 test/sys/kernel/slab/signal_cache/trace delete mode 100644 test/sys/kernel/slab/signal_cache/validate delete mode 100644 test/sys/kernel/slab/sigqueue/aliases delete mode 100644 test/sys/kernel/slab/sigqueue/align delete mode 100644 test/sys/kernel/slab/sigqueue/alloc_calls delete mode 100644 test/sys/kernel/slab/sigqueue/cache_dma delete mode 100644 test/sys/kernel/slab/sigqueue/cpu_slabs delete mode 100644 test/sys/kernel/slab/sigqueue/ctor delete mode 100644 test/sys/kernel/slab/sigqueue/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/sigqueue/free_calls delete mode 100644 test/sys/kernel/slab/sigqueue/hwcache_align delete mode 100644 test/sys/kernel/slab/sigqueue/object_size delete mode 100644 test/sys/kernel/slab/sigqueue/objects delete mode 100644 test/sys/kernel/slab/sigqueue/objects_partial delete mode 100644 test/sys/kernel/slab/sigqueue/objs_per_slab delete mode 100644 test/sys/kernel/slab/sigqueue/order delete mode 100644 test/sys/kernel/slab/sigqueue/partial delete mode 100644 test/sys/kernel/slab/sigqueue/poison delete mode 100644 test/sys/kernel/slab/sigqueue/reclaim_account delete mode 100644 test/sys/kernel/slab/sigqueue/red_zone delete mode 100644 test/sys/kernel/slab/sigqueue/sanity_checks delete mode 100644 test/sys/kernel/slab/sigqueue/shrink delete mode 100644 test/sys/kernel/slab/sigqueue/slab_size delete mode 100644 test/sys/kernel/slab/sigqueue/slabs delete mode 100644 test/sys/kernel/slab/sigqueue/store_user delete mode 100644 test/sys/kernel/slab/sigqueue/total_objects delete mode 100644 test/sys/kernel/slab/sigqueue/trace delete mode 100644 test/sys/kernel/slab/sigqueue/validate delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/aliases delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/align delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/cache_dma delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/ctor delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/free_calls delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/object_size delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/objects delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/objects_partial delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/order delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/partial delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/poison delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/red_zone delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/shrink delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/slab_size delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/slabs delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/store_user delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/total_objects delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/trace delete mode 100644 test/sys/kernel/slab/skbuff_fclone_cache/validate delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/aliases delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/align delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/cache_dma delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/ctor delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/free_calls delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/object_size delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/objects delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/objects_partial delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/order delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/partial delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/poison delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/red_zone delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/shrink delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/slab_size delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/slabs delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/store_user delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/total_objects delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/trace delete mode 100644 test/sys/kernel/slab/skbuff_head_cache/validate delete mode 100644 test/sys/kernel/slab/sock_inode_cache/aliases delete mode 100644 test/sys/kernel/slab/sock_inode_cache/align delete mode 100644 test/sys/kernel/slab/sock_inode_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/sock_inode_cache/cache_dma delete mode 100644 test/sys/kernel/slab/sock_inode_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/sock_inode_cache/ctor delete mode 100644 test/sys/kernel/slab/sock_inode_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/sock_inode_cache/free_calls delete mode 100644 test/sys/kernel/slab/sock_inode_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/sock_inode_cache/object_size delete mode 100644 test/sys/kernel/slab/sock_inode_cache/objects delete mode 100644 test/sys/kernel/slab/sock_inode_cache/objects_partial delete mode 100644 test/sys/kernel/slab/sock_inode_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/sock_inode_cache/order delete mode 100644 test/sys/kernel/slab/sock_inode_cache/partial delete mode 100644 test/sys/kernel/slab/sock_inode_cache/poison delete mode 100644 test/sys/kernel/slab/sock_inode_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/sock_inode_cache/red_zone delete mode 100644 test/sys/kernel/slab/sock_inode_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/sock_inode_cache/shrink delete mode 100644 test/sys/kernel/slab/sock_inode_cache/slab_size delete mode 100644 test/sys/kernel/slab/sock_inode_cache/slabs delete mode 100644 test/sys/kernel/slab/sock_inode_cache/store_user delete mode 100644 test/sys/kernel/slab/sock_inode_cache/total_objects delete mode 100644 test/sys/kernel/slab/sock_inode_cache/trace delete mode 100644 test/sys/kernel/slab/sock_inode_cache/validate delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/aliases delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/align delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/cache_dma delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/ctor delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/free_calls delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/object_size delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/objects delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/objects_partial delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/order delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/partial delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/poison delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/red_zone delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/shrink delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/slab_size delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/slabs delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/store_user delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/total_objects delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/trace delete mode 100644 test/sys/kernel/slab/sysfs_dir_cache/validate delete mode 100644 test/sys/kernel/slab/task_struct/aliases delete mode 100644 test/sys/kernel/slab/task_struct/align delete mode 100644 test/sys/kernel/slab/task_struct/alloc_calls delete mode 100644 test/sys/kernel/slab/task_struct/cache_dma delete mode 100644 test/sys/kernel/slab/task_struct/cpu_slabs delete mode 100644 test/sys/kernel/slab/task_struct/ctor delete mode 100644 test/sys/kernel/slab/task_struct/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/task_struct/free_calls delete mode 100644 test/sys/kernel/slab/task_struct/hwcache_align delete mode 100644 test/sys/kernel/slab/task_struct/object_size delete mode 100644 test/sys/kernel/slab/task_struct/objects delete mode 100644 test/sys/kernel/slab/task_struct/objects_partial delete mode 100644 test/sys/kernel/slab/task_struct/objs_per_slab delete mode 100644 test/sys/kernel/slab/task_struct/order delete mode 100644 test/sys/kernel/slab/task_struct/partial delete mode 100644 test/sys/kernel/slab/task_struct/poison delete mode 100644 test/sys/kernel/slab/task_struct/reclaim_account delete mode 100644 test/sys/kernel/slab/task_struct/red_zone delete mode 100644 test/sys/kernel/slab/task_struct/sanity_checks delete mode 100644 test/sys/kernel/slab/task_struct/shrink delete mode 100644 test/sys/kernel/slab/task_struct/slab_size delete mode 100644 test/sys/kernel/slab/task_struct/slabs delete mode 100644 test/sys/kernel/slab/task_struct/store_user delete mode 100644 test/sys/kernel/slab/task_struct/total_objects delete mode 100644 test/sys/kernel/slab/task_struct/trace delete mode 100644 test/sys/kernel/slab/task_struct/validate delete mode 100644 test/sys/kernel/slab/task_xstate/aliases delete mode 100644 test/sys/kernel/slab/task_xstate/align delete mode 100644 test/sys/kernel/slab/task_xstate/alloc_calls delete mode 100644 test/sys/kernel/slab/task_xstate/cache_dma delete mode 100644 test/sys/kernel/slab/task_xstate/cpu_slabs delete mode 100644 test/sys/kernel/slab/task_xstate/ctor delete mode 100644 test/sys/kernel/slab/task_xstate/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/task_xstate/free_calls delete mode 100644 test/sys/kernel/slab/task_xstate/hwcache_align delete mode 100644 test/sys/kernel/slab/task_xstate/object_size delete mode 100644 test/sys/kernel/slab/task_xstate/objects delete mode 100644 test/sys/kernel/slab/task_xstate/objects_partial delete mode 100644 test/sys/kernel/slab/task_xstate/objs_per_slab delete mode 100644 test/sys/kernel/slab/task_xstate/order delete mode 100644 test/sys/kernel/slab/task_xstate/partial delete mode 100644 test/sys/kernel/slab/task_xstate/poison delete mode 100644 test/sys/kernel/slab/task_xstate/reclaim_account delete mode 100644 test/sys/kernel/slab/task_xstate/red_zone delete mode 100644 test/sys/kernel/slab/task_xstate/sanity_checks delete mode 100644 test/sys/kernel/slab/task_xstate/shrink delete mode 100644 test/sys/kernel/slab/task_xstate/slab_size delete mode 100644 test/sys/kernel/slab/task_xstate/slabs delete mode 100644 test/sys/kernel/slab/task_xstate/store_user delete mode 100644 test/sys/kernel/slab/task_xstate/total_objects delete mode 100644 test/sys/kernel/slab/task_xstate/trace delete mode 100644 test/sys/kernel/slab/task_xstate/validate delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/aliases delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/align delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/alloc_calls delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/cache_dma delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/ctor delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/free_calls delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/hwcache_align delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/object_size delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/objects delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/objects_partial delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/order delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/partial delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/poison delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/reclaim_account delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/red_zone delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/sanity_checks delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/shrink delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/slab_size delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/slabs delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/store_user delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/total_objects delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/trace delete mode 100644 test/sys/kernel/slab/tcp_bind_bucket/validate delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/aliases delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/align delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/alloc_calls delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/cache_dma delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/cpu_slabs delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/ctor delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/free_calls delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/hwcache_align delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/object_size delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/objects delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/objects_partial delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/objs_per_slab delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/order delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/partial delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/poison delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/reclaim_account delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/red_zone delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/sanity_checks delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/shrink delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/slab_size delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/slabs delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/store_user delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/total_objects delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/trace delete mode 100644 test/sys/kernel/slab/tw_sock_TCP/validate delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/aliases delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/align delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/cache_dma delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/ctor delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/free_calls delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/object_size delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/objects delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/objects_partial delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/order delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/partial delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/poison delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/red_zone delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/shrink delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/slab_size delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/slabs delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/store_user delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/total_objects delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/trace delete mode 100644 test/sys/kernel/slab/tw_sock_TCPv6/validate delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/aliases delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/align delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/alloc_calls delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/cache_dma delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/cpu_slabs delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/ctor delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/free_calls delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/hwcache_align delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/object_size delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/objects delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/objects_partial delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/objs_per_slab delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/order delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/partial delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/poison delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/reclaim_account delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/red_zone delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/sanity_checks delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/shrink delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/slab_size delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/slabs delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/store_user delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/total_objects delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/trace delete mode 100644 test/sys/kernel/slab/uhci_urb_priv/validate delete mode 100644 test/sys/kernel/slab/uid_cache/aliases delete mode 100644 test/sys/kernel/slab/uid_cache/align delete mode 100644 test/sys/kernel/slab/uid_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/uid_cache/cache_dma delete mode 100644 test/sys/kernel/slab/uid_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/uid_cache/ctor delete mode 100644 test/sys/kernel/slab/uid_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/uid_cache/free_calls delete mode 100644 test/sys/kernel/slab/uid_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/uid_cache/object_size delete mode 100644 test/sys/kernel/slab/uid_cache/objects delete mode 100644 test/sys/kernel/slab/uid_cache/objects_partial delete mode 100644 test/sys/kernel/slab/uid_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/uid_cache/order delete mode 100644 test/sys/kernel/slab/uid_cache/partial delete mode 100644 test/sys/kernel/slab/uid_cache/poison delete mode 100644 test/sys/kernel/slab/uid_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/uid_cache/red_zone delete mode 100644 test/sys/kernel/slab/uid_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/uid_cache/shrink delete mode 100644 test/sys/kernel/slab/uid_cache/slab_size delete mode 100644 test/sys/kernel/slab/uid_cache/slabs delete mode 100644 test/sys/kernel/slab/uid_cache/store_user delete mode 100644 test/sys/kernel/slab/uid_cache/total_objects delete mode 100644 test/sys/kernel/slab/uid_cache/trace delete mode 100644 test/sys/kernel/slab/uid_cache/validate delete mode 100644 test/sys/kernel/slab/vm_area_struct/aliases delete mode 100644 test/sys/kernel/slab/vm_area_struct/align delete mode 100644 test/sys/kernel/slab/vm_area_struct/alloc_calls delete mode 100644 test/sys/kernel/slab/vm_area_struct/cache_dma delete mode 100644 test/sys/kernel/slab/vm_area_struct/cpu_slabs delete mode 100644 test/sys/kernel/slab/vm_area_struct/ctor delete mode 100644 test/sys/kernel/slab/vm_area_struct/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/vm_area_struct/free_calls delete mode 100644 test/sys/kernel/slab/vm_area_struct/hwcache_align delete mode 100644 test/sys/kernel/slab/vm_area_struct/object_size delete mode 100644 test/sys/kernel/slab/vm_area_struct/objects delete mode 100644 test/sys/kernel/slab/vm_area_struct/objects_partial delete mode 100644 test/sys/kernel/slab/vm_area_struct/objs_per_slab delete mode 100644 test/sys/kernel/slab/vm_area_struct/order delete mode 100644 test/sys/kernel/slab/vm_area_struct/partial delete mode 100644 test/sys/kernel/slab/vm_area_struct/poison delete mode 100644 test/sys/kernel/slab/vm_area_struct/reclaim_account delete mode 100644 test/sys/kernel/slab/vm_area_struct/red_zone delete mode 100644 test/sys/kernel/slab/vm_area_struct/sanity_checks delete mode 100644 test/sys/kernel/slab/vm_area_struct/shrink delete mode 100644 test/sys/kernel/slab/vm_area_struct/slab_size delete mode 100644 test/sys/kernel/slab/vm_area_struct/slabs delete mode 100644 test/sys/kernel/slab/vm_area_struct/store_user delete mode 100644 test/sys/kernel/slab/vm_area_struct/total_objects delete mode 100644 test/sys/kernel/slab/vm_area_struct/trace delete mode 100644 test/sys/kernel/slab/vm_area_struct/validate delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/aliases delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/align delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/alloc_calls delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/cache_dma delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/ctor delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/free_calls delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/hwcache_align delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/object_size delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/objects delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/objects_partial delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/order delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/partial delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/poison delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/reclaim_account delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/red_zone delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/sanity_checks delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/shrink delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/slab_size delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/slabs delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/store_user delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/total_objects delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/trace delete mode 100644 test/sys/kernel/slab/xfrm_dst_cache/validate delete mode 100644 test/sys/kernel/uevent_helper delete mode 100644 test/sys/kernel/uevent_seqnum delete mode 100644 test/sys/kernel/uids/0/cpu_share delete mode 100644 test/sys/kernel/uids/100/cpu_share delete mode 100644 test/sys/kernel/uids/103/cpu_share delete mode 100644 test/sys/kernel/uids/105/cpu_share delete mode 100644 test/sys/kernel/uids/2702/cpu_share delete mode 100644 test/sys/kernel/uids/51/cpu_share delete mode 100644 test/sys/kernel/vmcoreinfo delete mode 100644 test/sys/module/8250/parameters/nr_uarts delete mode 100644 test/sys/module/8250/parameters/share_irqs delete mode 100644 test/sys/module/ac/initstate delete mode 100644 test/sys/module/ac/notes/.note.gnu.build-id delete mode 100644 test/sys/module/ac/refcnt delete mode 100644 test/sys/module/ac/sections/.bss delete mode 100644 test/sys/module/ac/sections/.data delete mode 100644 test/sys/module/ac/sections/.exit.text delete mode 100644 test/sys/module/ac/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/ac/sections/.init.text delete mode 100644 test/sys/module/ac/sections/.note.gnu.build-id delete mode 100644 test/sys/module/ac/sections/.rodata delete mode 100644 test/sys/module/ac/sections/.rodata.str1.1 delete mode 100644 test/sys/module/ac/sections/.strtab delete mode 100644 test/sys/module/ac/sections/.symtab delete mode 100644 test/sys/module/ac/sections/.text delete mode 100644 test/sys/module/ac/srcversion delete mode 100644 test/sys/module/acpi/parameters/acpica_version delete mode 100644 test/sys/module/acpi_cpufreq/initstate delete mode 100644 test/sys/module/acpi_cpufreq/notes/.note.gnu.build-id delete mode 100644 test/sys/module/acpi_cpufreq/parameters/acpi_pstate_strict delete mode 100644 test/sys/module/acpi_cpufreq/refcnt delete mode 100644 test/sys/module/acpi_cpufreq/sections/.bss delete mode 100644 test/sys/module/acpi_cpufreq/sections/.data delete mode 100644 test/sys/module/acpi_cpufreq/sections/.exit.text delete mode 100644 test/sys/module/acpi_cpufreq/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/acpi_cpufreq/sections/.init.text delete mode 100644 test/sys/module/acpi_cpufreq/sections/.note.gnu.build-id delete mode 100644 test/sys/module/acpi_cpufreq/sections/.rodata delete mode 100644 test/sys/module/acpi_cpufreq/sections/.rodata.str1.1 delete mode 100644 test/sys/module/acpi_cpufreq/sections/.smp_locks delete mode 100644 test/sys/module/acpi_cpufreq/sections/.strtab delete mode 100644 test/sys/module/acpi_cpufreq/sections/.symtab delete mode 100644 test/sys/module/acpi_cpufreq/sections/.text delete mode 100644 test/sys/module/acpi_cpufreq/sections/__param delete mode 100644 test/sys/module/acpi_cpufreq/srcversion delete mode 120000 test/sys/module/aes_generic/holders/aes_x86_64 delete mode 100644 test/sys/module/aes_generic/initstate delete mode 100644 test/sys/module/aes_generic/notes/.note.gnu.build-id delete mode 100644 test/sys/module/aes_generic/refcnt delete mode 100644 test/sys/module/aes_generic/sections/.bss delete mode 100644 test/sys/module/aes_generic/sections/.data delete mode 100644 test/sys/module/aes_generic/sections/.exit.text delete mode 100644 test/sys/module/aes_generic/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/aes_generic/sections/.init.data delete mode 100644 test/sys/module/aes_generic/sections/.init.text delete mode 100644 test/sys/module/aes_generic/sections/.note.gnu.build-id delete mode 100644 test/sys/module/aes_generic/sections/.strtab delete mode 100644 test/sys/module/aes_generic/sections/.symtab delete mode 100644 test/sys/module/aes_generic/sections/.text delete mode 100644 test/sys/module/aes_generic/sections/__kcrctab_gpl delete mode 100644 test/sys/module/aes_generic/sections/__ksymtab_gpl delete mode 100644 test/sys/module/aes_generic/sections/__ksymtab_strings delete mode 100644 test/sys/module/aes_generic/srcversion delete mode 100644 test/sys/module/aes_x86_64/initstate delete mode 100644 test/sys/module/aes_x86_64/notes/.note.gnu.build-id delete mode 100644 test/sys/module/aes_x86_64/refcnt delete mode 100644 test/sys/module/aes_x86_64/sections/.bss delete mode 100644 test/sys/module/aes_x86_64/sections/.data delete mode 100644 test/sys/module/aes_x86_64/sections/.exit.text delete mode 100644 test/sys/module/aes_x86_64/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/aes_x86_64/sections/.init.text delete mode 100644 test/sys/module/aes_x86_64/sections/.note.gnu.build-id delete mode 100644 test/sys/module/aes_x86_64/sections/.strtab delete mode 100644 test/sys/module/aes_x86_64/sections/.symtab delete mode 100644 test/sys/module/aes_x86_64/sections/.text delete mode 100644 test/sys/module/aes_x86_64/srcversion delete mode 120000 test/sys/module/ahci/drivers/pci:ahci delete mode 100644 test/sys/module/ahci/parameters/ahci_em_messages delete mode 100644 test/sys/module/ahci/parameters/marvell_enable delete mode 100644 test/sys/module/ahci/parameters/skip_host_reset delete mode 100644 test/sys/module/arc4/initstate delete mode 100644 test/sys/module/arc4/notes/.note.gnu.build-id delete mode 100644 test/sys/module/arc4/refcnt delete mode 100644 test/sys/module/arc4/sections/.bss delete mode 100644 test/sys/module/arc4/sections/.data delete mode 100644 test/sys/module/arc4/sections/.exit.text delete mode 100644 test/sys/module/arc4/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/arc4/sections/.init.text delete mode 100644 test/sys/module/arc4/sections/.note.gnu.build-id delete mode 100644 test/sys/module/arc4/sections/.strtab delete mode 100644 test/sys/module/arc4/sections/.symtab delete mode 100644 test/sys/module/arc4/sections/.text delete mode 100644 test/sys/module/arc4/srcversion delete mode 120000 test/sys/module/atkbd/drivers/serio:atkbd delete mode 120000 test/sys/module/backlight/holders/thinkpad_acpi delete mode 100644 test/sys/module/backlight/initstate delete mode 100644 test/sys/module/backlight/notes/.note.gnu.build-id delete mode 100644 test/sys/module/backlight/refcnt delete mode 100644 test/sys/module/backlight/sections/.bss delete mode 100644 test/sys/module/backlight/sections/.data delete mode 100644 test/sys/module/backlight/sections/.exit.text delete mode 100644 test/sys/module/backlight/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/backlight/sections/.init.text delete mode 100644 test/sys/module/backlight/sections/.note.gnu.build-id delete mode 100644 test/sys/module/backlight/sections/.rodata.str1.1 delete mode 100644 test/sys/module/backlight/sections/.strtab delete mode 100644 test/sys/module/backlight/sections/.symtab delete mode 100644 test/sys/module/backlight/sections/.text delete mode 100644 test/sys/module/backlight/sections/__kcrctab delete mode 100644 test/sys/module/backlight/sections/__ksymtab delete mode 100644 test/sys/module/backlight/sections/__ksymtab_strings delete mode 100644 test/sys/module/backlight/srcversion delete mode 100644 test/sys/module/battery/initstate delete mode 100644 test/sys/module/battery/notes/.note.gnu.build-id delete mode 100644 test/sys/module/battery/parameters/cache_time delete mode 100644 test/sys/module/battery/refcnt delete mode 100644 test/sys/module/battery/sections/.bss delete mode 100644 test/sys/module/battery/sections/.data delete mode 100644 test/sys/module/battery/sections/.exit.text delete mode 100644 test/sys/module/battery/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/battery/sections/.init.text delete mode 100644 test/sys/module/battery/sections/.note.gnu.build-id delete mode 100644 test/sys/module/battery/sections/.rodata delete mode 100644 test/sys/module/battery/sections/.rodata.str1.1 delete mode 100644 test/sys/module/battery/sections/.strtab delete mode 100644 test/sys/module/battery/sections/.symtab delete mode 100644 test/sys/module/battery/sections/.text delete mode 100644 test/sys/module/battery/sections/__param delete mode 100644 test/sys/module/battery/srcversion delete mode 100644 test/sys/module/button/initstate delete mode 100644 test/sys/module/button/notes/.note.gnu.build-id delete mode 100644 test/sys/module/button/refcnt delete mode 100644 test/sys/module/button/sections/.bss delete mode 100644 test/sys/module/button/sections/.data delete mode 100644 test/sys/module/button/sections/.exit.text delete mode 100644 test/sys/module/button/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/button/sections/.init.text delete mode 100644 test/sys/module/button/sections/.note.gnu.build-id delete mode 100644 test/sys/module/button/sections/.rodata delete mode 100644 test/sys/module/button/sections/.rodata.str1.1 delete mode 100644 test/sys/module/button/sections/.smp_locks delete mode 100644 test/sys/module/button/sections/.strtab delete mode 100644 test/sys/module/button/sections/.symtab delete mode 100644 test/sys/module/button/sections/.text delete mode 100644 test/sys/module/button/srcversion delete mode 120000 test/sys/module/cdc_acm/drivers/usb:cdc_acm delete mode 100644 test/sys/module/cdc_acm/initstate delete mode 100644 test/sys/module/cdc_acm/notes/.note.gnu.build-id delete mode 100644 test/sys/module/cdc_acm/refcnt delete mode 100644 test/sys/module/cdc_acm/sections/.bss delete mode 100644 test/sys/module/cdc_acm/sections/.data delete mode 100644 test/sys/module/cdc_acm/sections/.exit.text delete mode 100644 test/sys/module/cdc_acm/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/cdc_acm/sections/.init.text delete mode 100644 test/sys/module/cdc_acm/sections/.note.gnu.build-id delete mode 100644 test/sys/module/cdc_acm/sections/.rodata delete mode 100644 test/sys/module/cdc_acm/sections/.rodata.str1.1 delete mode 100644 test/sys/module/cdc_acm/sections/.smp_locks delete mode 100644 test/sys/module/cdc_acm/sections/.strtab delete mode 100644 test/sys/module/cdc_acm/sections/.symtab delete mode 100644 test/sys/module/cdc_acm/sections/.text delete mode 100644 test/sys/module/cdc_acm/srcversion delete mode 120000 test/sys/module/cdrom/holders/sr_mod delete mode 100644 test/sys/module/cdrom/initstate delete mode 100644 test/sys/module/cdrom/notes/.note.gnu.build-id delete mode 100644 test/sys/module/cdrom/refcnt delete mode 100644 test/sys/module/cdrom/sections/.bss delete mode 100644 test/sys/module/cdrom/sections/.data delete mode 100644 test/sys/module/cdrom/sections/.exit.text delete mode 100644 test/sys/module/cdrom/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/cdrom/sections/.init.text delete mode 100644 test/sys/module/cdrom/sections/.note.gnu.build-id delete mode 100644 test/sys/module/cdrom/sections/.rodata delete mode 100644 test/sys/module/cdrom/sections/.rodata.str1.1 delete mode 100644 test/sys/module/cdrom/sections/.strtab delete mode 100644 test/sys/module/cdrom/sections/.symtab delete mode 100644 test/sys/module/cdrom/sections/.text delete mode 100644 test/sys/module/cdrom/sections/__kcrctab delete mode 100644 test/sys/module/cdrom/sections/__ksymtab delete mode 100644 test/sys/module/cdrom/sections/__ksymtab_strings delete mode 100644 test/sys/module/cdrom/sections/__param delete mode 100644 test/sys/module/cdrom/srcversion delete mode 120000 test/sys/module/cfg80211/holders/iwl3945 delete mode 120000 test/sys/module/cfg80211/holders/mac80211 delete mode 100644 test/sys/module/cfg80211/initstate delete mode 100644 test/sys/module/cfg80211/notes/.note.gnu.build-id delete mode 100644 test/sys/module/cfg80211/parameters/ieee80211_regdom delete mode 100644 test/sys/module/cfg80211/refcnt delete mode 100644 test/sys/module/cfg80211/sections/.bss delete mode 100644 test/sys/module/cfg80211/sections/.data delete mode 100644 test/sys/module/cfg80211/sections/.data.read_mostly delete mode 100644 test/sys/module/cfg80211/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/cfg80211/sections/.note.gnu.build-id delete mode 100644 test/sys/module/cfg80211/sections/.rodata delete mode 100644 test/sys/module/cfg80211/sections/.rodata.str1.1 delete mode 100644 test/sys/module/cfg80211/sections/.smp_locks delete mode 100644 test/sys/module/cfg80211/sections/.strtab delete mode 100644 test/sys/module/cfg80211/sections/.symtab delete mode 100644 test/sys/module/cfg80211/sections/.text delete mode 100644 test/sys/module/cfg80211/sections/__bug_table delete mode 100644 test/sys/module/cfg80211/sections/__kcrctab delete mode 100644 test/sys/module/cfg80211/sections/__ksymtab delete mode 100644 test/sys/module/cfg80211/sections/__ksymtab_strings delete mode 100644 test/sys/module/cfg80211/sections/__param delete mode 100644 test/sys/module/cfg80211/srcversion delete mode 120000 test/sys/module/crypto_blkcipher/holders/ecb delete mode 100644 test/sys/module/crypto_blkcipher/initstate delete mode 100644 test/sys/module/crypto_blkcipher/notes/.note.gnu.build-id delete mode 100644 test/sys/module/crypto_blkcipher/refcnt delete mode 100644 test/sys/module/crypto_blkcipher/sections/.bss delete mode 100644 test/sys/module/crypto_blkcipher/sections/.data delete mode 100644 test/sys/module/crypto_blkcipher/sections/.exit.text delete mode 100644 test/sys/module/crypto_blkcipher/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/crypto_blkcipher/sections/.init.text delete mode 100644 test/sys/module/crypto_blkcipher/sections/.note.gnu.build-id delete mode 100644 test/sys/module/crypto_blkcipher/sections/.rodata delete mode 100644 test/sys/module/crypto_blkcipher/sections/.rodata.str1.1 delete mode 100644 test/sys/module/crypto_blkcipher/sections/.smp_locks delete mode 100644 test/sys/module/crypto_blkcipher/sections/.strtab delete mode 100644 test/sys/module/crypto_blkcipher/sections/.symtab delete mode 100644 test/sys/module/crypto_blkcipher/sections/.text delete mode 100644 test/sys/module/crypto_blkcipher/sections/__bug_table delete mode 100644 test/sys/module/crypto_blkcipher/sections/__kcrctab_gpl delete mode 100644 test/sys/module/crypto_blkcipher/sections/__ksymtab_gpl delete mode 100644 test/sys/module/crypto_blkcipher/sections/__ksymtab_strings delete mode 100644 test/sys/module/crypto_blkcipher/srcversion delete mode 100644 test/sys/module/dm_mod/initstate delete mode 100644 test/sys/module/dm_mod/notes/.note.gnu.build-id delete mode 100644 test/sys/module/dm_mod/refcnt delete mode 100644 test/sys/module/dm_mod/sections/.bss delete mode 100644 test/sys/module/dm_mod/sections/.data delete mode 100644 test/sys/module/dm_mod/sections/.exit.text delete mode 100644 test/sys/module/dm_mod/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/dm_mod/sections/.init.data delete mode 100644 test/sys/module/dm_mod/sections/.init.text delete mode 100644 test/sys/module/dm_mod/sections/.note.gnu.build-id delete mode 100644 test/sys/module/dm_mod/sections/.rodata delete mode 100644 test/sys/module/dm_mod/sections/.rodata.str1.1 delete mode 100644 test/sys/module/dm_mod/sections/.smp_locks delete mode 100644 test/sys/module/dm_mod/sections/.strtab delete mode 100644 test/sys/module/dm_mod/sections/.symtab delete mode 100644 test/sys/module/dm_mod/sections/.text delete mode 100644 test/sys/module/dm_mod/sections/__bug_table delete mode 100644 test/sys/module/dm_mod/sections/__kcrctab delete mode 100644 test/sys/module/dm_mod/sections/__kcrctab_gpl delete mode 100644 test/sys/module/dm_mod/sections/__ksymtab delete mode 100644 test/sys/module/dm_mod/sections/__ksymtab_gpl delete mode 100644 test/sys/module/dm_mod/sections/__ksymtab_strings delete mode 100644 test/sys/module/dm_mod/sections/__param delete mode 100644 test/sys/module/dm_mod/srcversion delete mode 100644 test/sys/module/dock/parameters/immediate_undock delete mode 120000 test/sys/module/e1000e/drivers/pci:e1000e delete mode 100644 test/sys/module/e1000e/initstate delete mode 100644 test/sys/module/e1000e/notes/.note.gnu.build-id delete mode 100644 test/sys/module/e1000e/parameters/copybreak delete mode 100644 test/sys/module/e1000e/refcnt delete mode 100644 test/sys/module/e1000e/sections/.bss delete mode 100644 test/sys/module/e1000e/sections/.data delete mode 100644 test/sys/module/e1000e/sections/.devexit.text delete mode 100644 test/sys/module/e1000e/sections/.devinit.data delete mode 100644 test/sys/module/e1000e/sections/.devinit.text delete mode 100644 test/sys/module/e1000e/sections/.exit.text delete mode 100644 test/sys/module/e1000e/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/e1000e/sections/.init.text delete mode 100644 test/sys/module/e1000e/sections/.note.gnu.build-id delete mode 100644 test/sys/module/e1000e/sections/.rodata delete mode 100644 test/sys/module/e1000e/sections/.rodata.str1.1 delete mode 100644 test/sys/module/e1000e/sections/.smp_locks delete mode 100644 test/sys/module/e1000e/sections/.strtab delete mode 100644 test/sys/module/e1000e/sections/.symtab delete mode 100644 test/sys/module/e1000e/sections/.text delete mode 100644 test/sys/module/e1000e/sections/__bug_table delete mode 100644 test/sys/module/e1000e/sections/__param delete mode 100644 test/sys/module/e1000e/srcversion delete mode 100644 test/sys/module/e1000e/version delete mode 100644 test/sys/module/ecb/initstate delete mode 100644 test/sys/module/ecb/notes/.note.gnu.build-id delete mode 100644 test/sys/module/ecb/refcnt delete mode 100644 test/sys/module/ecb/sections/.bss delete mode 100644 test/sys/module/ecb/sections/.data delete mode 100644 test/sys/module/ecb/sections/.exit.text delete mode 100644 test/sys/module/ecb/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/ecb/sections/.init.text delete mode 100644 test/sys/module/ecb/sections/.note.gnu.build-id delete mode 100644 test/sys/module/ecb/sections/.rodata.str1.1 delete mode 100644 test/sys/module/ecb/sections/.strtab delete mode 100644 test/sys/module/ecb/sections/.symtab delete mode 100644 test/sys/module/ecb/sections/.text delete mode 100644 test/sys/module/ecb/srcversion delete mode 100644 test/sys/module/edd/initstate delete mode 100644 test/sys/module/edd/notes/.note.gnu.build-id delete mode 100644 test/sys/module/edd/refcnt delete mode 100644 test/sys/module/edd/sections/.bss delete mode 100644 test/sys/module/edd/sections/.data delete mode 100644 test/sys/module/edd/sections/.exit.text delete mode 100644 test/sys/module/edd/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/edd/sections/.init.text delete mode 100644 test/sys/module/edd/sections/.note.gnu.build-id delete mode 100644 test/sys/module/edd/sections/.rodata delete mode 100644 test/sys/module/edd/sections/.rodata.str1.1 delete mode 100644 test/sys/module/edd/sections/.strtab delete mode 100644 test/sys/module/edd/sections/.symtab delete mode 100644 test/sys/module/edd/sections/.text delete mode 100644 test/sys/module/edd/srcversion delete mode 100644 test/sys/module/edd/version delete mode 120000 test/sys/module/ehci_hcd/drivers/pci:ehci_hcd delete mode 100644 test/sys/module/ehci_hcd/initstate delete mode 100644 test/sys/module/ehci_hcd/notes/.note.gnu.build-id delete mode 100644 test/sys/module/ehci_hcd/parameters/ignore_oc delete mode 100644 test/sys/module/ehci_hcd/parameters/log2_irq_thresh delete mode 100644 test/sys/module/ehci_hcd/parameters/park delete mode 100644 test/sys/module/ehci_hcd/refcnt delete mode 100644 test/sys/module/ehci_hcd/sections/.bss delete mode 100644 test/sys/module/ehci_hcd/sections/.data delete mode 100644 test/sys/module/ehci_hcd/sections/.exit.text delete mode 100644 test/sys/module/ehci_hcd/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/ehci_hcd/sections/.init.text delete mode 100644 test/sys/module/ehci_hcd/sections/.note.gnu.build-id delete mode 100644 test/sys/module/ehci_hcd/sections/.rodata delete mode 100644 test/sys/module/ehci_hcd/sections/.rodata.str1.1 delete mode 100644 test/sys/module/ehci_hcd/sections/.smp_locks delete mode 100644 test/sys/module/ehci_hcd/sections/.strtab delete mode 100644 test/sys/module/ehci_hcd/sections/.symtab delete mode 100644 test/sys/module/ehci_hcd/sections/.text delete mode 100644 test/sys/module/ehci_hcd/sections/__bug_table delete mode 100644 test/sys/module/ehci_hcd/sections/__param delete mode 100644 test/sys/module/ehci_hcd/srcversion delete mode 100644 test/sys/module/evdev/initstate delete mode 100644 test/sys/module/evdev/notes/.note.gnu.build-id delete mode 100644 test/sys/module/evdev/refcnt delete mode 100644 test/sys/module/evdev/sections/.bss delete mode 100644 test/sys/module/evdev/sections/.data delete mode 100644 test/sys/module/evdev/sections/.exit.text delete mode 100644 test/sys/module/evdev/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/evdev/sections/.init.text delete mode 100644 test/sys/module/evdev/sections/.note.gnu.build-id delete mode 100644 test/sys/module/evdev/sections/.rodata delete mode 100644 test/sys/module/evdev/sections/.rodata.str1.1 delete mode 100644 test/sys/module/evdev/sections/.strtab delete mode 100644 test/sys/module/evdev/sections/.symtab delete mode 100644 test/sys/module/evdev/sections/.text delete mode 100644 test/sys/module/evdev/srcversion delete mode 100644 test/sys/module/fuse/initstate delete mode 100644 test/sys/module/fuse/notes/.note.gnu.build-id delete mode 100644 test/sys/module/fuse/refcnt delete mode 100644 test/sys/module/fuse/sections/.bss delete mode 100644 test/sys/module/fuse/sections/.data delete mode 100644 test/sys/module/fuse/sections/.exit.text delete mode 100644 test/sys/module/fuse/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/fuse/sections/.init.text delete mode 100644 test/sys/module/fuse/sections/.note.gnu.build-id delete mode 100644 test/sys/module/fuse/sections/.rodata delete mode 100644 test/sys/module/fuse/sections/.rodata.str1.1 delete mode 100644 test/sys/module/fuse/sections/.smp_locks delete mode 100644 test/sys/module/fuse/sections/.strtab delete mode 100644 test/sys/module/fuse/sections/.symtab delete mode 100644 test/sys/module/fuse/sections/.text delete mode 100644 test/sys/module/fuse/sections/__bug_table delete mode 100644 test/sys/module/fuse/srcversion delete mode 100644 test/sys/module/hid/parameters/pb_fnmode delete mode 120000 test/sys/module/hwmon/holders/thinkpad_acpi delete mode 100644 test/sys/module/hwmon/initstate delete mode 100644 test/sys/module/hwmon/notes/.note.gnu.build-id delete mode 100644 test/sys/module/hwmon/refcnt delete mode 100644 test/sys/module/hwmon/sections/.bss delete mode 100644 test/sys/module/hwmon/sections/.data delete mode 100644 test/sys/module/hwmon/sections/.exit.text delete mode 100644 test/sys/module/hwmon/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/hwmon/sections/.init.text delete mode 100644 test/sys/module/hwmon/sections/.note.gnu.build-id delete mode 100644 test/sys/module/hwmon/sections/.rodata.str1.1 delete mode 100644 test/sys/module/hwmon/sections/.strtab delete mode 100644 test/sys/module/hwmon/sections/.symtab delete mode 100644 test/sys/module/hwmon/sections/.text delete mode 100644 test/sys/module/hwmon/sections/__kcrctab_gpl delete mode 100644 test/sys/module/hwmon/sections/__ksymtab_gpl delete mode 100644 test/sys/module/hwmon/sections/__ksymtab_strings delete mode 100644 test/sys/module/hwmon/srcversion delete mode 100644 test/sys/module/i8042/parameters/debug delete mode 100644 test/sys/module/i8042/parameters/panicblink delete mode 120000 test/sys/module/intel_agp/drivers/pci:agpgart-intel delete mode 100644 test/sys/module/intel_agp/initstate delete mode 100644 test/sys/module/intel_agp/notes/.note.gnu.build-id delete mode 100644 test/sys/module/intel_agp/refcnt delete mode 100644 test/sys/module/intel_agp/sections/.bss delete mode 100644 test/sys/module/intel_agp/sections/.data delete mode 100644 test/sys/module/intel_agp/sections/.devexit.text delete mode 100644 test/sys/module/intel_agp/sections/.devinit.text delete mode 100644 test/sys/module/intel_agp/sections/.exit.text delete mode 100644 test/sys/module/intel_agp/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/intel_agp/sections/.init.text delete mode 100644 test/sys/module/intel_agp/sections/.note.gnu.build-id delete mode 100644 test/sys/module/intel_agp/sections/.rodata delete mode 100644 test/sys/module/intel_agp/sections/.rodata.str1.1 delete mode 100644 test/sys/module/intel_agp/sections/.smp_locks delete mode 100644 test/sys/module/intel_agp/sections/.strtab delete mode 100644 test/sys/module/intel_agp/sections/.symtab delete mode 100644 test/sys/module/intel_agp/sections/.text delete mode 100644 test/sys/module/intel_agp/srcversion delete mode 100644 test/sys/module/ipv6/initstate delete mode 100644 test/sys/module/ipv6/notes/.note.gnu.build-id delete mode 100644 test/sys/module/ipv6/refcnt delete mode 100644 test/sys/module/ipv6/sections/.bss delete mode 100644 test/sys/module/ipv6/sections/.data delete mode 100644 test/sys/module/ipv6/sections/.data.read_mostly delete mode 100644 test/sys/module/ipv6/sections/.exit.text delete mode 100644 test/sys/module/ipv6/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/ipv6/sections/.init.data delete mode 100644 test/sys/module/ipv6/sections/.init.text delete mode 100644 test/sys/module/ipv6/sections/.note.gnu.build-id delete mode 100644 test/sys/module/ipv6/sections/.ref.text delete mode 100644 test/sys/module/ipv6/sections/.rodata delete mode 100644 test/sys/module/ipv6/sections/.rodata.str1.1 delete mode 100644 test/sys/module/ipv6/sections/.smp_locks delete mode 100644 test/sys/module/ipv6/sections/.strtab delete mode 100644 test/sys/module/ipv6/sections/.symtab delete mode 100644 test/sys/module/ipv6/sections/.text delete mode 100644 test/sys/module/ipv6/sections/__bug_table delete mode 100644 test/sys/module/ipv6/sections/__kcrctab delete mode 100644 test/sys/module/ipv6/sections/__kcrctab_gpl delete mode 100644 test/sys/module/ipv6/sections/__ksymtab delete mode 100644 test/sys/module/ipv6/sections/__ksymtab_gpl delete mode 100644 test/sys/module/ipv6/sections/__ksymtab_strings delete mode 100644 test/sys/module/ipv6/srcversion delete mode 120000 test/sys/module/iwl3945/drivers/pci:iwl3945 delete mode 100644 test/sys/module/iwl3945/initstate delete mode 100644 test/sys/module/iwl3945/notes/.note.gnu.build-id delete mode 100644 test/sys/module/iwl3945/parameters/antenna delete mode 100644 test/sys/module/iwl3945/parameters/debug delete mode 100644 test/sys/module/iwl3945/parameters/disable delete mode 100644 test/sys/module/iwl3945/parameters/disable_hw_scan delete mode 100644 test/sys/module/iwl3945/parameters/hwcrypto delete mode 100644 test/sys/module/iwl3945/parameters/qos_enable delete mode 100644 test/sys/module/iwl3945/parameters/queues_num delete mode 100644 test/sys/module/iwl3945/refcnt delete mode 100644 test/sys/module/iwl3945/sections/.bss delete mode 100644 test/sys/module/iwl3945/sections/.data delete mode 100644 test/sys/module/iwl3945/sections/.devexit.text delete mode 100644 test/sys/module/iwl3945/sections/.exit.text delete mode 100644 test/sys/module/iwl3945/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/iwl3945/sections/.init.text delete mode 100644 test/sys/module/iwl3945/sections/.note.gnu.build-id delete mode 100644 test/sys/module/iwl3945/sections/.rodata delete mode 100644 test/sys/module/iwl3945/sections/.rodata.str1.1 delete mode 100644 test/sys/module/iwl3945/sections/.smp_locks delete mode 100644 test/sys/module/iwl3945/sections/.strtab delete mode 100644 test/sys/module/iwl3945/sections/.symtab delete mode 100644 test/sys/module/iwl3945/sections/.text delete mode 100644 test/sys/module/iwl3945/sections/__bug_table delete mode 100644 test/sys/module/iwl3945/sections/__param delete mode 100644 test/sys/module/iwl3945/srcversion delete mode 100644 test/sys/module/iwl3945/version delete mode 100644 test/sys/module/keyboard/parameters/brl_nbchords delete mode 100644 test/sys/module/keyboard/parameters/brl_timeout delete mode 120000 test/sys/module/led_class/holders/iwl3945 delete mode 120000 test/sys/module/led_class/holders/thinkpad_acpi delete mode 100644 test/sys/module/led_class/initstate delete mode 100644 test/sys/module/led_class/notes/.note.gnu.build-id delete mode 100644 test/sys/module/led_class/refcnt delete mode 100644 test/sys/module/led_class/sections/.bss delete mode 100644 test/sys/module/led_class/sections/.data delete mode 100644 test/sys/module/led_class/sections/.exit.text delete mode 100644 test/sys/module/led_class/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/led_class/sections/.init.text delete mode 100644 test/sys/module/led_class/sections/.note.gnu.build-id delete mode 100644 test/sys/module/led_class/sections/.rodata.str1.1 delete mode 100644 test/sys/module/led_class/sections/.strtab delete mode 100644 test/sys/module/led_class/sections/.symtab delete mode 100644 test/sys/module/led_class/sections/.text delete mode 100644 test/sys/module/led_class/sections/__kcrctab_gpl delete mode 100644 test/sys/module/led_class/sections/__ksymtab_gpl delete mode 100644 test/sys/module/led_class/sections/__ksymtab_strings delete mode 100644 test/sys/module/led_class/srcversion delete mode 100644 test/sys/module/libata/parameters/acpi_gtf_filter delete mode 100644 test/sys/module/libata/parameters/allow_tpm delete mode 100644 test/sys/module/libata/parameters/ata_probe_timeout delete mode 100644 test/sys/module/libata/parameters/atapi_dmadir delete mode 100644 test/sys/module/libata/parameters/atapi_enabled delete mode 100644 test/sys/module/libata/parameters/atapi_passthru16 delete mode 100644 test/sys/module/libata/parameters/dma delete mode 100644 test/sys/module/libata/parameters/fua delete mode 100644 test/sys/module/libata/parameters/ignore_hpa delete mode 100644 test/sys/module/libata/parameters/noacpi delete mode 100644 test/sys/module/lockdep/parameters/lock_stat delete mode 100644 test/sys/module/loop/initstate delete mode 100644 test/sys/module/loop/notes/.note.gnu.build-id delete mode 100644 test/sys/module/loop/refcnt delete mode 100644 test/sys/module/loop/sections/.bss delete mode 100644 test/sys/module/loop/sections/.data delete mode 100644 test/sys/module/loop/sections/.exit.text delete mode 100644 test/sys/module/loop/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/loop/sections/.init.text delete mode 100644 test/sys/module/loop/sections/.note.gnu.build-id delete mode 100644 test/sys/module/loop/sections/.rodata delete mode 100644 test/sys/module/loop/sections/.rodata.str1.1 delete mode 100644 test/sys/module/loop/sections/.strtab delete mode 100644 test/sys/module/loop/sections/.symtab delete mode 100644 test/sys/module/loop/sections/.text delete mode 100644 test/sys/module/loop/sections/__bug_table delete mode 100644 test/sys/module/loop/sections/__kcrctab delete mode 100644 test/sys/module/loop/sections/__ksymtab delete mode 100644 test/sys/module/loop/sections/__ksymtab_strings delete mode 100644 test/sys/module/loop/sections/__param delete mode 100644 test/sys/module/loop/srcversion delete mode 120000 test/sys/module/mac80211/holders/iwl3945 delete mode 100644 test/sys/module/mac80211/initstate delete mode 100644 test/sys/module/mac80211/notes/.note.gnu.build-id delete mode 100644 test/sys/module/mac80211/parameters/ieee80211_default_rc_algo delete mode 100644 test/sys/module/mac80211/refcnt delete mode 100644 test/sys/module/mac80211/sections/.bss delete mode 100644 test/sys/module/mac80211/sections/.data delete mode 100644 test/sys/module/mac80211/sections/.exit.text delete mode 100644 test/sys/module/mac80211/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/mac80211/sections/.init.text delete mode 100644 test/sys/module/mac80211/sections/.note.gnu.build-id delete mode 100644 test/sys/module/mac80211/sections/.rodata delete mode 100644 test/sys/module/mac80211/sections/.rodata.str1.1 delete mode 100644 test/sys/module/mac80211/sections/.smp_locks delete mode 100644 test/sys/module/mac80211/sections/.strtab delete mode 100644 test/sys/module/mac80211/sections/.symtab delete mode 100644 test/sys/module/mac80211/sections/.text delete mode 100644 test/sys/module/mac80211/sections/__bug_table delete mode 100644 test/sys/module/mac80211/sections/__kcrctab delete mode 100644 test/sys/module/mac80211/sections/__kcrctab_gpl delete mode 100644 test/sys/module/mac80211/sections/__ksymtab delete mode 100644 test/sys/module/mac80211/sections/__ksymtab_gpl delete mode 100644 test/sys/module/mac80211/sections/__ksymtab_strings delete mode 100644 test/sys/module/mac80211/sections/__param delete mode 100644 test/sys/module/mac80211/srcversion delete mode 120000 test/sys/module/md_mod/holders/raid1 delete mode 100644 test/sys/module/md_mod/initstate delete mode 100644 test/sys/module/md_mod/notes/.note.gnu.build-id delete mode 100644 test/sys/module/md_mod/parameters/start_dirty_degraded delete mode 100644 test/sys/module/md_mod/parameters/start_ro delete mode 100644 test/sys/module/md_mod/refcnt delete mode 100644 test/sys/module/md_mod/sections/.bss delete mode 100644 test/sys/module/md_mod/sections/.data delete mode 100644 test/sys/module/md_mod/sections/.exit.text delete mode 100644 test/sys/module/md_mod/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/md_mod/sections/.init.text delete mode 100644 test/sys/module/md_mod/sections/.note.gnu.build-id delete mode 100644 test/sys/module/md_mod/sections/.rodata delete mode 100644 test/sys/module/md_mod/sections/.rodata.str1.1 delete mode 100644 test/sys/module/md_mod/sections/.smp_locks delete mode 100644 test/sys/module/md_mod/sections/.strtab delete mode 100644 test/sys/module/md_mod/sections/.symtab delete mode 100644 test/sys/module/md_mod/sections/.text delete mode 100644 test/sys/module/md_mod/sections/__bug_table delete mode 100644 test/sys/module/md_mod/sections/__kcrctab delete mode 100644 test/sys/module/md_mod/sections/__kcrctab_gpl delete mode 100644 test/sys/module/md_mod/sections/__ksymtab delete mode 100644 test/sys/module/md_mod/sections/__ksymtab_gpl delete mode 100644 test/sys/module/md_mod/sections/__ksymtab_strings delete mode 100644 test/sys/module/md_mod/sections/__param delete mode 100644 test/sys/module/md_mod/srcversion delete mode 100644 test/sys/module/microcode/initstate delete mode 100644 test/sys/module/microcode/notes/.note.gnu.build-id delete mode 100644 test/sys/module/microcode/refcnt delete mode 100644 test/sys/module/microcode/sections/.bss delete mode 100644 test/sys/module/microcode/sections/.cpuinit.text delete mode 100644 test/sys/module/microcode/sections/.data delete mode 100644 test/sys/module/microcode/sections/.exit.text delete mode 100644 test/sys/module/microcode/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/microcode/sections/.init.text delete mode 100644 test/sys/module/microcode/sections/.note.gnu.build-id delete mode 100644 test/sys/module/microcode/sections/.ref.data delete mode 100644 test/sys/module/microcode/sections/.rodata delete mode 100644 test/sys/module/microcode/sections/.rodata.str1.1 delete mode 100644 test/sys/module/microcode/sections/.strtab delete mode 100644 test/sys/module/microcode/sections/.symtab delete mode 100644 test/sys/module/microcode/sections/.text delete mode 100644 test/sys/module/microcode/sections/__bug_table delete mode 100644 test/sys/module/microcode/srcversion delete mode 100644 test/sys/module/mousedev/parameters/tap_time delete mode 100644 test/sys/module/mousedev/parameters/xres delete mode 100644 test/sys/module/mousedev/parameters/yres delete mode 120000 test/sys/module/nvram/holders/thinkpad_acpi delete mode 100644 test/sys/module/nvram/initstate delete mode 100644 test/sys/module/nvram/notes/.note.gnu.build-id delete mode 100644 test/sys/module/nvram/refcnt delete mode 100644 test/sys/module/nvram/sections/.bss delete mode 100644 test/sys/module/nvram/sections/.data delete mode 100644 test/sys/module/nvram/sections/.exit.text delete mode 100644 test/sys/module/nvram/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/nvram/sections/.init.text delete mode 100644 test/sys/module/nvram/sections/.note.gnu.build-id delete mode 100644 test/sys/module/nvram/sections/.rodata delete mode 100644 test/sys/module/nvram/sections/.rodata.str1.1 delete mode 100644 test/sys/module/nvram/sections/.strtab delete mode 100644 test/sys/module/nvram/sections/.symtab delete mode 100644 test/sys/module/nvram/sections/.text delete mode 100644 test/sys/module/nvram/sections/__kcrctab delete mode 100644 test/sys/module/nvram/sections/__ksymtab delete mode 100644 test/sys/module/nvram/sections/__ksymtab_strings delete mode 100644 test/sys/module/nvram/srcversion delete mode 100644 test/sys/module/oprofile/parameters/timer delete mode 100644 test/sys/module/pcie_aspm/parameters/policy delete mode 100644 test/sys/module/pcmcia/initstate delete mode 100644 test/sys/module/pcmcia/notes/.note.gnu.build-id delete mode 100644 test/sys/module/pcmcia/parameters/io_speed delete mode 100644 test/sys/module/pcmcia/refcnt delete mode 100644 test/sys/module/pcmcia/sections/.bss delete mode 100644 test/sys/module/pcmcia/sections/.data delete mode 100644 test/sys/module/pcmcia/sections/.devinit.text delete mode 100644 test/sys/module/pcmcia/sections/.exit.text delete mode 100644 test/sys/module/pcmcia/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/pcmcia/sections/.init.text delete mode 100644 test/sys/module/pcmcia/sections/.note.gnu.build-id delete mode 100644 test/sys/module/pcmcia/sections/.ref.data delete mode 100644 test/sys/module/pcmcia/sections/.rodata delete mode 100644 test/sys/module/pcmcia/sections/.rodata.str1.1 delete mode 100644 test/sys/module/pcmcia/sections/.strtab delete mode 100644 test/sys/module/pcmcia/sections/.symtab delete mode 100644 test/sys/module/pcmcia/sections/.text delete mode 100644 test/sys/module/pcmcia/sections/__kcrctab delete mode 100644 test/sys/module/pcmcia/sections/__ksymtab delete mode 100644 test/sys/module/pcmcia/sections/__ksymtab_strings delete mode 100644 test/sys/module/pcmcia/sections/__param delete mode 100644 test/sys/module/pcmcia/srcversion delete mode 120000 test/sys/module/pcmcia_core/holders/pcmcia delete mode 120000 test/sys/module/pcmcia_core/holders/rsrc_nonstatic delete mode 120000 test/sys/module/pcmcia_core/holders/yenta_socket delete mode 100644 test/sys/module/pcmcia_core/initstate delete mode 100644 test/sys/module/pcmcia_core/notes/.note.gnu.build-id delete mode 100644 test/sys/module/pcmcia_core/parameters/cis_speed delete mode 100644 test/sys/module/pcmcia_core/parameters/cis_width delete mode 100644 test/sys/module/pcmcia_core/parameters/reset_time delete mode 100644 test/sys/module/pcmcia_core/parameters/resume_delay delete mode 100644 test/sys/module/pcmcia_core/parameters/setup_delay delete mode 100644 test/sys/module/pcmcia_core/parameters/shutdown_delay delete mode 100644 test/sys/module/pcmcia_core/parameters/unreset_check delete mode 100644 test/sys/module/pcmcia_core/parameters/unreset_delay delete mode 100644 test/sys/module/pcmcia_core/parameters/unreset_limit delete mode 100644 test/sys/module/pcmcia_core/parameters/vcc_settle delete mode 100644 test/sys/module/pcmcia_core/refcnt delete mode 100644 test/sys/module/pcmcia_core/sections/.bss delete mode 100644 test/sys/module/pcmcia_core/sections/.data delete mode 100644 test/sys/module/pcmcia_core/sections/.exit.text delete mode 100644 test/sys/module/pcmcia_core/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/pcmcia_core/sections/.init.text delete mode 100644 test/sys/module/pcmcia_core/sections/.note.gnu.build-id delete mode 100644 test/sys/module/pcmcia_core/sections/.ref.text delete mode 100644 test/sys/module/pcmcia_core/sections/.rodata delete mode 100644 test/sys/module/pcmcia_core/sections/.rodata.str1.1 delete mode 100644 test/sys/module/pcmcia_core/sections/.strtab delete mode 100644 test/sys/module/pcmcia_core/sections/.symtab delete mode 100644 test/sys/module/pcmcia_core/sections/.text delete mode 100644 test/sys/module/pcmcia_core/sections/__kcrctab delete mode 100644 test/sys/module/pcmcia_core/sections/__ksymtab delete mode 100644 test/sys/module/pcmcia_core/sections/__ksymtab_strings delete mode 100644 test/sys/module/pcmcia_core/sections/__param delete mode 100644 test/sys/module/pcmcia_core/srcversion delete mode 120000 test/sys/module/pcspkr/drivers/platform:pcspkr delete mode 100644 test/sys/module/pcspkr/initstate delete mode 100644 test/sys/module/pcspkr/notes/.note.gnu.build-id delete mode 100644 test/sys/module/pcspkr/refcnt delete mode 100644 test/sys/module/pcspkr/sections/.bss delete mode 100644 test/sys/module/pcspkr/sections/.data delete mode 100644 test/sys/module/pcspkr/sections/.devexit.text delete mode 100644 test/sys/module/pcspkr/sections/.devinit.text delete mode 100644 test/sys/module/pcspkr/sections/.exit.text delete mode 100644 test/sys/module/pcspkr/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/pcspkr/sections/.init.text delete mode 100644 test/sys/module/pcspkr/sections/.note.gnu.build-id delete mode 100644 test/sys/module/pcspkr/sections/.rodata.str1.1 delete mode 100644 test/sys/module/pcspkr/sections/.strtab delete mode 100644 test/sys/module/pcspkr/sections/.symtab delete mode 100644 test/sys/module/pcspkr/sections/.text delete mode 100644 test/sys/module/pcspkr/srcversion delete mode 100644 test/sys/module/printk/parameters/time delete mode 120000 test/sys/module/processor/holders/acpi_cpufreq delete mode 120000 test/sys/module/processor/holders/thermal delete mode 100644 test/sys/module/processor/initstate delete mode 100644 test/sys/module/processor/notes/.note.gnu.build-id delete mode 100644 test/sys/module/processor/parameters/ignore_ppc delete mode 100644 test/sys/module/processor/parameters/latency_factor delete mode 100644 test/sys/module/processor/refcnt delete mode 100644 test/sys/module/processor/sections/.bss delete mode 100644 test/sys/module/processor/sections/.cpuinit.data delete mode 100644 test/sys/module/processor/sections/.cpuinit.text delete mode 100644 test/sys/module/processor/sections/.data delete mode 100644 test/sys/module/processor/sections/.data.read_mostly delete mode 100644 test/sys/module/processor/sections/.exit.text delete mode 100644 test/sys/module/processor/sections/.fixup delete mode 100644 test/sys/module/processor/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/processor/sections/.init.text delete mode 100644 test/sys/module/processor/sections/.note.gnu.build-id delete mode 100644 test/sys/module/processor/sections/.ref.text delete mode 100644 test/sys/module/processor/sections/.rodata delete mode 100644 test/sys/module/processor/sections/.rodata.str1.1 delete mode 100644 test/sys/module/processor/sections/.smp_locks delete mode 100644 test/sys/module/processor/sections/.strtab delete mode 100644 test/sys/module/processor/sections/.symtab delete mode 100644 test/sys/module/processor/sections/.text delete mode 100644 test/sys/module/processor/sections/__bug_table delete mode 100644 test/sys/module/processor/sections/__ex_table delete mode 100644 test/sys/module/processor/sections/__kcrctab delete mode 100644 test/sys/module/processor/sections/__ksymtab delete mode 100644 test/sys/module/processor/sections/__ksymtab_strings delete mode 100644 test/sys/module/processor/sections/__param delete mode 100644 test/sys/module/processor/srcversion delete mode 120000 test/sys/module/psmouse/drivers/serio:psmouse delete mode 100644 test/sys/module/psmouse/parameters/proto delete mode 100644 test/sys/module/psmouse/parameters/rate delete mode 100644 test/sys/module/psmouse/parameters/resetafter delete mode 100644 test/sys/module/psmouse/parameters/resolution delete mode 100644 test/sys/module/psmouse/parameters/resync_time delete mode 100644 test/sys/module/psmouse/parameters/smartscroll delete mode 100644 test/sys/module/raid1/initstate delete mode 100644 test/sys/module/raid1/notes/.note.gnu.build-id delete mode 100644 test/sys/module/raid1/refcnt delete mode 100644 test/sys/module/raid1/sections/.bss delete mode 100644 test/sys/module/raid1/sections/.data delete mode 100644 test/sys/module/raid1/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/raid1/sections/.init.text delete mode 100644 test/sys/module/raid1/sections/.note.gnu.build-id delete mode 100644 test/sys/module/raid1/sections/.rodata.str1.1 delete mode 100644 test/sys/module/raid1/sections/.smp_locks delete mode 100644 test/sys/module/raid1/sections/.strtab delete mode 100644 test/sys/module/raid1/sections/.symtab delete mode 100644 test/sys/module/raid1/sections/.text delete mode 100644 test/sys/module/raid1/sections/__bug_table delete mode 100644 test/sys/module/raid1/srcversion delete mode 120000 test/sys/module/rfkill/holders/thinkpad_acpi delete mode 100644 test/sys/module/rfkill/initstate delete mode 100644 test/sys/module/rfkill/notes/.note.gnu.build-id delete mode 100644 test/sys/module/rfkill/parameters/default_state delete mode 100644 test/sys/module/rfkill/refcnt delete mode 100644 test/sys/module/rfkill/sections/.bss delete mode 100644 test/sys/module/rfkill/sections/.data delete mode 100644 test/sys/module/rfkill/sections/.exit.text delete mode 100644 test/sys/module/rfkill/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/rfkill/sections/.init.text delete mode 100644 test/sys/module/rfkill/sections/.note.gnu.build-id delete mode 100644 test/sys/module/rfkill/sections/.rodata delete mode 100644 test/sys/module/rfkill/sections/.rodata.str1.1 delete mode 100644 test/sys/module/rfkill/sections/.smp_locks delete mode 100644 test/sys/module/rfkill/sections/.strtab delete mode 100644 test/sys/module/rfkill/sections/.symtab delete mode 100644 test/sys/module/rfkill/sections/.text delete mode 100644 test/sys/module/rfkill/sections/__bug_table delete mode 100644 test/sys/module/rfkill/sections/__kcrctab delete mode 100644 test/sys/module/rfkill/sections/__kcrctab_gpl delete mode 100644 test/sys/module/rfkill/sections/__ksymtab delete mode 100644 test/sys/module/rfkill/sections/__ksymtab_gpl delete mode 100644 test/sys/module/rfkill/sections/__ksymtab_strings delete mode 100644 test/sys/module/rfkill/sections/__param delete mode 100644 test/sys/module/rfkill/srcversion delete mode 100644 test/sys/module/rfkill/version delete mode 120000 test/sys/module/rsrc_nonstatic/holders/yenta_socket delete mode 100644 test/sys/module/rsrc_nonstatic/initstate delete mode 100644 test/sys/module/rsrc_nonstatic/notes/.note.gnu.build-id delete mode 100644 test/sys/module/rsrc_nonstatic/parameters/probe_mem delete mode 100644 test/sys/module/rsrc_nonstatic/refcnt delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.bss delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.data delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.devexit.text delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.devinit.text delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.exit.text delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.init.text delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.note.gnu.build-id delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.ref.data delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.rodata delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.rodata.str1.1 delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.strtab delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.symtab delete mode 100644 test/sys/module/rsrc_nonstatic/sections/.text delete mode 100644 test/sys/module/rsrc_nonstatic/sections/__kcrctab delete mode 100644 test/sys/module/rsrc_nonstatic/sections/__ksymtab delete mode 100644 test/sys/module/rsrc_nonstatic/sections/__ksymtab_strings delete mode 100644 test/sys/module/rsrc_nonstatic/sections/__param delete mode 100644 test/sys/module/rsrc_nonstatic/srcversion delete mode 100644 test/sys/module/rtc_cmos/initstate delete mode 100644 test/sys/module/rtc_cmos/notes/.note.gnu.build-id delete mode 100644 test/sys/module/rtc_cmos/refcnt delete mode 100644 test/sys/module/rtc_cmos/sections/.bss delete mode 100644 test/sys/module/rtc_cmos/sections/.data delete mode 100644 test/sys/module/rtc_cmos/sections/.devinit.text delete mode 100644 test/sys/module/rtc_cmos/sections/.exit.text delete mode 100644 test/sys/module/rtc_cmos/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/rtc_cmos/sections/.init.text delete mode 100644 test/sys/module/rtc_cmos/sections/.note.gnu.build-id delete mode 100644 test/sys/module/rtc_cmos/sections/.rodata delete mode 100644 test/sys/module/rtc_cmos/sections/.rodata.str1.1 delete mode 100644 test/sys/module/rtc_cmos/sections/.strtab delete mode 100644 test/sys/module/rtc_cmos/sections/.symtab delete mode 100644 test/sys/module/rtc_cmos/sections/.text delete mode 100644 test/sys/module/rtc_cmos/srcversion delete mode 120000 test/sys/module/rtc_core/holders/rtc_cmos delete mode 100644 test/sys/module/rtc_core/initstate delete mode 100644 test/sys/module/rtc_core/notes/.note.gnu.build-id delete mode 100644 test/sys/module/rtc_core/refcnt delete mode 100644 test/sys/module/rtc_core/sections/.bss delete mode 100644 test/sys/module/rtc_core/sections/.data delete mode 100644 test/sys/module/rtc_core/sections/.exit.text delete mode 100644 test/sys/module/rtc_core/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/rtc_core/sections/.init.text delete mode 100644 test/sys/module/rtc_core/sections/.note.gnu.build-id delete mode 100644 test/sys/module/rtc_core/sections/.rodata delete mode 100644 test/sys/module/rtc_core/sections/.rodata.str1.1 delete mode 100644 test/sys/module/rtc_core/sections/.smp_locks delete mode 100644 test/sys/module/rtc_core/sections/.strtab delete mode 100644 test/sys/module/rtc_core/sections/.symtab delete mode 100644 test/sys/module/rtc_core/sections/.text delete mode 100644 test/sys/module/rtc_core/sections/__kcrctab_gpl delete mode 100644 test/sys/module/rtc_core/sections/__ksymtab_gpl delete mode 100644 test/sys/module/rtc_core/sections/__ksymtab_strings delete mode 100644 test/sys/module/rtc_core/srcversion delete mode 120000 test/sys/module/rtc_lib/holders/rtc_core delete mode 100644 test/sys/module/rtc_lib/initstate delete mode 100644 test/sys/module/rtc_lib/notes/.note.gnu.build-id delete mode 100644 test/sys/module/rtc_lib/refcnt delete mode 100644 test/sys/module/rtc_lib/sections/.bss delete mode 100644 test/sys/module/rtc_lib/sections/.data delete mode 100644 test/sys/module/rtc_lib/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/rtc_lib/sections/.note.gnu.build-id delete mode 100644 test/sys/module/rtc_lib/sections/.rodata delete mode 100644 test/sys/module/rtc_lib/sections/.strtab delete mode 100644 test/sys/module/rtc_lib/sections/.symtab delete mode 100644 test/sys/module/rtc_lib/sections/.text delete mode 100644 test/sys/module/rtc_lib/sections/__kcrctab delete mode 100644 test/sys/module/rtc_lib/sections/__ksymtab delete mode 100644 test/sys/module/rtc_lib/sections/__ksymtab_strings delete mode 100644 test/sys/module/rtc_lib/srcversion delete mode 100644 test/sys/module/scsi_mod/parameters/default_dev_flags delete mode 100644 test/sys/module/scsi_mod/parameters/inq_timeout delete mode 100644 test/sys/module/scsi_mod/parameters/max_luns delete mode 100644 test/sys/module/scsi_mod/parameters/max_report_luns delete mode 100644 test/sys/module/scsi_mod/parameters/scan delete mode 100644 test/sys/module/scsi_mod/parameters/scsi_logging_level delete mode 100644 test/sys/module/sg/initstate delete mode 100644 test/sys/module/sg/notes/.note.gnu.build-id delete mode 100644 test/sys/module/sg/parameters/allow_dio delete mode 100644 test/sys/module/sg/parameters/def_reserved_size delete mode 100644 test/sys/module/sg/parameters/scatter_elem_sz delete mode 100644 test/sys/module/sg/refcnt delete mode 100644 test/sys/module/sg/sections/.bss delete mode 100644 test/sys/module/sg/sections/.data delete mode 100644 test/sys/module/sg/sections/.exit.text delete mode 100644 test/sys/module/sg/sections/.fixup delete mode 100644 test/sys/module/sg/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/sg/sections/.init.text delete mode 100644 test/sys/module/sg/sections/.note.gnu.build-id delete mode 100644 test/sys/module/sg/sections/.rodata delete mode 100644 test/sys/module/sg/sections/.rodata.str1.1 delete mode 100644 test/sys/module/sg/sections/.smp_locks delete mode 100644 test/sys/module/sg/sections/.strtab delete mode 100644 test/sys/module/sg/sections/.symtab delete mode 100644 test/sys/module/sg/sections/.text delete mode 100644 test/sys/module/sg/sections/__bug_table delete mode 100644 test/sys/module/sg/sections/__ex_table delete mode 100644 test/sys/module/sg/sections/__param delete mode 100644 test/sys/module/sg/srcversion delete mode 100644 test/sys/module/sg/version delete mode 120000 test/sys/module/snd/holders/snd_hda_intel delete mode 120000 test/sys/module/snd/holders/snd_mixer_oss delete mode 120000 test/sys/module/snd/holders/snd_pcm delete mode 120000 test/sys/module/snd/holders/snd_pcm_oss delete mode 120000 test/sys/module/snd/holders/snd_seq delete mode 120000 test/sys/module/snd/holders/snd_seq_device delete mode 120000 test/sys/module/snd/holders/snd_timer delete mode 100644 test/sys/module/snd/initstate delete mode 100644 test/sys/module/snd/notes/.note.gnu.build-id delete mode 100644 test/sys/module/snd/parameters/cards_limit delete mode 100644 test/sys/module/snd/parameters/major delete mode 100644 test/sys/module/snd/parameters/slots delete mode 100644 test/sys/module/snd/refcnt delete mode 100644 test/sys/module/snd/sections/.bss delete mode 100644 test/sys/module/snd/sections/.data delete mode 100644 test/sys/module/snd/sections/.exit.text delete mode 100644 test/sys/module/snd/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/snd/sections/.init.text delete mode 100644 test/sys/module/snd/sections/.note.gnu.build-id delete mode 100644 test/sys/module/snd/sections/.rodata delete mode 100644 test/sys/module/snd/sections/.rodata.str1.1 delete mode 100644 test/sys/module/snd/sections/.strtab delete mode 100644 test/sys/module/snd/sections/.symtab delete mode 100644 test/sys/module/snd/sections/.text delete mode 100644 test/sys/module/snd/sections/__kcrctab delete mode 100644 test/sys/module/snd/sections/__ksymtab delete mode 100644 test/sys/module/snd/sections/__ksymtab_strings delete mode 100644 test/sys/module/snd/sections/__param delete mode 100644 test/sys/module/snd/srcversion delete mode 120000 test/sys/module/snd_hda_intel/drivers/pci:HDA Intel delete mode 100644 test/sys/module/snd_hda_intel/initstate delete mode 100644 test/sys/module/snd_hda_intel/notes/.note.gnu.build-id delete mode 100644 test/sys/module/snd_hda_intel/parameters/bdl_pos_adj delete mode 100644 test/sys/module/snd_hda_intel/parameters/enable delete mode 100644 test/sys/module/snd_hda_intel/parameters/enable_msi delete mode 100644 test/sys/module/snd_hda_intel/parameters/id delete mode 100644 test/sys/module/snd_hda_intel/parameters/index delete mode 100644 test/sys/module/snd_hda_intel/parameters/model delete mode 100644 test/sys/module/snd_hda_intel/parameters/position_fix delete mode 100644 test/sys/module/snd_hda_intel/parameters/probe_mask delete mode 100644 test/sys/module/snd_hda_intel/parameters/single_cmd delete mode 100644 test/sys/module/snd_hda_intel/refcnt delete mode 100644 test/sys/module/snd_hda_intel/sections/.bss delete mode 100644 test/sys/module/snd_hda_intel/sections/.data delete mode 100644 test/sys/module/snd_hda_intel/sections/.devexit.text delete mode 100644 test/sys/module/snd_hda_intel/sections/.devinit.data delete mode 100644 test/sys/module/snd_hda_intel/sections/.devinit.text delete mode 100644 test/sys/module/snd_hda_intel/sections/.exit.text delete mode 100644 test/sys/module/snd_hda_intel/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/snd_hda_intel/sections/.init.text delete mode 100644 test/sys/module/snd_hda_intel/sections/.note.gnu.build-id delete mode 100644 test/sys/module/snd_hda_intel/sections/.rodata delete mode 100644 test/sys/module/snd_hda_intel/sections/.rodata.str1.1 delete mode 100644 test/sys/module/snd_hda_intel/sections/.strtab delete mode 100644 test/sys/module/snd_hda_intel/sections/.symtab delete mode 100644 test/sys/module/snd_hda_intel/sections/.text delete mode 100644 test/sys/module/snd_hda_intel/sections/__param delete mode 100644 test/sys/module/snd_hda_intel/srcversion delete mode 120000 test/sys/module/snd_mixer_oss/holders/snd_pcm_oss delete mode 100644 test/sys/module/snd_mixer_oss/initstate delete mode 100644 test/sys/module/snd_mixer_oss/notes/.note.gnu.build-id delete mode 100644 test/sys/module/snd_mixer_oss/refcnt delete mode 100644 test/sys/module/snd_mixer_oss/sections/.bss delete mode 100644 test/sys/module/snd_mixer_oss/sections/.data delete mode 100644 test/sys/module/snd_mixer_oss/sections/.exit.text delete mode 100644 test/sys/module/snd_mixer_oss/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/snd_mixer_oss/sections/.init.text delete mode 100644 test/sys/module/snd_mixer_oss/sections/.note.gnu.build-id delete mode 100644 test/sys/module/snd_mixer_oss/sections/.rodata delete mode 100644 test/sys/module/snd_mixer_oss/sections/.rodata.str1.1 delete mode 100644 test/sys/module/snd_mixer_oss/sections/.strtab delete mode 100644 test/sys/module/snd_mixer_oss/sections/.symtab delete mode 100644 test/sys/module/snd_mixer_oss/sections/.text delete mode 100644 test/sys/module/snd_mixer_oss/sections/__kcrctab delete mode 100644 test/sys/module/snd_mixer_oss/sections/__ksymtab delete mode 100644 test/sys/module/snd_mixer_oss/sections/__ksymtab_strings delete mode 100644 test/sys/module/snd_mixer_oss/srcversion delete mode 120000 test/sys/module/snd_page_alloc/holders/snd_hda_intel delete mode 120000 test/sys/module/snd_page_alloc/holders/snd_pcm delete mode 100644 test/sys/module/snd_page_alloc/initstate delete mode 100644 test/sys/module/snd_page_alloc/notes/.note.gnu.build-id delete mode 100644 test/sys/module/snd_page_alloc/refcnt delete mode 100644 test/sys/module/snd_page_alloc/sections/.bss delete mode 100644 test/sys/module/snd_page_alloc/sections/.data delete mode 100644 test/sys/module/snd_page_alloc/sections/.exit.text delete mode 100644 test/sys/module/snd_page_alloc/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/snd_page_alloc/sections/.init.text delete mode 100644 test/sys/module/snd_page_alloc/sections/.note.gnu.build-id delete mode 100644 test/sys/module/snd_page_alloc/sections/.rodata delete mode 100644 test/sys/module/snd_page_alloc/sections/.rodata.str1.1 delete mode 100644 test/sys/module/snd_page_alloc/sections/.strtab delete mode 100644 test/sys/module/snd_page_alloc/sections/.symtab delete mode 100644 test/sys/module/snd_page_alloc/sections/.text delete mode 100644 test/sys/module/snd_page_alloc/sections/__kcrctab delete mode 100644 test/sys/module/snd_page_alloc/sections/__ksymtab delete mode 100644 test/sys/module/snd_page_alloc/sections/__ksymtab_strings delete mode 100644 test/sys/module/snd_page_alloc/srcversion delete mode 120000 test/sys/module/snd_pcm/holders/snd_hda_intel delete mode 120000 test/sys/module/snd_pcm/holders/snd_pcm_oss delete mode 100644 test/sys/module/snd_pcm/initstate delete mode 100644 test/sys/module/snd_pcm/notes/.note.gnu.build-id delete mode 100644 test/sys/module/snd_pcm/parameters/maximum_substreams delete mode 100644 test/sys/module/snd_pcm/parameters/preallocate_dma delete mode 100644 test/sys/module/snd_pcm/refcnt delete mode 100644 test/sys/module/snd_pcm/sections/.bss delete mode 100644 test/sys/module/snd_pcm/sections/.data delete mode 100644 test/sys/module/snd_pcm/sections/.exit.text delete mode 100644 test/sys/module/snd_pcm/sections/.fixup delete mode 100644 test/sys/module/snd_pcm/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/snd_pcm/sections/.init.text delete mode 100644 test/sys/module/snd_pcm/sections/.note.gnu.build-id delete mode 100644 test/sys/module/snd_pcm/sections/.rodata delete mode 100644 test/sys/module/snd_pcm/sections/.rodata.str1.1 delete mode 100644 test/sys/module/snd_pcm/sections/.smp_locks delete mode 100644 test/sys/module/snd_pcm/sections/.strtab delete mode 100644 test/sys/module/snd_pcm/sections/.symtab delete mode 100644 test/sys/module/snd_pcm/sections/.text delete mode 100644 test/sys/module/snd_pcm/sections/__ex_table delete mode 100644 test/sys/module/snd_pcm/sections/__kcrctab delete mode 100644 test/sys/module/snd_pcm/sections/__ksymtab delete mode 100644 test/sys/module/snd_pcm/sections/__ksymtab_strings delete mode 100644 test/sys/module/snd_pcm/sections/__param delete mode 100644 test/sys/module/snd_pcm/srcversion delete mode 100644 test/sys/module/snd_pcm_oss/initstate delete mode 100644 test/sys/module/snd_pcm_oss/notes/.note.gnu.build-id delete mode 100644 test/sys/module/snd_pcm_oss/parameters/adsp_map delete mode 100644 test/sys/module/snd_pcm_oss/parameters/dsp_map delete mode 100644 test/sys/module/snd_pcm_oss/parameters/nonblock_open delete mode 100644 test/sys/module/snd_pcm_oss/refcnt delete mode 100644 test/sys/module/snd_pcm_oss/sections/.bss delete mode 100644 test/sys/module/snd_pcm_oss/sections/.data delete mode 100644 test/sys/module/snd_pcm_oss/sections/.exit.text delete mode 100644 test/sys/module/snd_pcm_oss/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/snd_pcm_oss/sections/.init.text delete mode 100644 test/sys/module/snd_pcm_oss/sections/.note.gnu.build-id delete mode 100644 test/sys/module/snd_pcm_oss/sections/.rodata delete mode 100644 test/sys/module/snd_pcm_oss/sections/.rodata.str1.1 delete mode 100644 test/sys/module/snd_pcm_oss/sections/.strtab delete mode 100644 test/sys/module/snd_pcm_oss/sections/.symtab delete mode 100644 test/sys/module/snd_pcm_oss/sections/.text delete mode 100644 test/sys/module/snd_pcm_oss/sections/__param delete mode 100644 test/sys/module/snd_pcm_oss/srcversion delete mode 100644 test/sys/module/snd_seq/initstate delete mode 100644 test/sys/module/snd_seq/notes/.note.gnu.build-id delete mode 100644 test/sys/module/snd_seq/parameters/seq_client_load delete mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_card delete mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_class delete mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_device delete mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_resolution delete mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_sclass delete mode 100644 test/sys/module/snd_seq/parameters/seq_default_timer_subdevice delete mode 100644 test/sys/module/snd_seq/refcnt delete mode 100644 test/sys/module/snd_seq/sections/.bss delete mode 100644 test/sys/module/snd_seq/sections/.data delete mode 100644 test/sys/module/snd_seq/sections/.exit.text delete mode 100644 test/sys/module/snd_seq/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/snd_seq/sections/.init.text delete mode 100644 test/sys/module/snd_seq/sections/.note.gnu.build-id delete mode 100644 test/sys/module/snd_seq/sections/.rodata delete mode 100644 test/sys/module/snd_seq/sections/.rodata.str1.1 delete mode 100644 test/sys/module/snd_seq/sections/.smp_locks delete mode 100644 test/sys/module/snd_seq/sections/.strtab delete mode 100644 test/sys/module/snd_seq/sections/.symtab delete mode 100644 test/sys/module/snd_seq/sections/.text delete mode 100644 test/sys/module/snd_seq/sections/__kcrctab delete mode 100644 test/sys/module/snd_seq/sections/__ksymtab delete mode 100644 test/sys/module/snd_seq/sections/__ksymtab_strings delete mode 100644 test/sys/module/snd_seq/sections/__param delete mode 100644 test/sys/module/snd_seq/srcversion delete mode 120000 test/sys/module/snd_seq_device/holders/snd_seq delete mode 100644 test/sys/module/snd_seq_device/initstate delete mode 100644 test/sys/module/snd_seq_device/notes/.note.gnu.build-id delete mode 100644 test/sys/module/snd_seq_device/refcnt delete mode 100644 test/sys/module/snd_seq_device/sections/.bss delete mode 100644 test/sys/module/snd_seq_device/sections/.data delete mode 100644 test/sys/module/snd_seq_device/sections/.exit.text delete mode 100644 test/sys/module/snd_seq_device/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/snd_seq_device/sections/.init.text delete mode 100644 test/sys/module/snd_seq_device/sections/.note.gnu.build-id delete mode 100644 test/sys/module/snd_seq_device/sections/.rodata.str1.1 delete mode 100644 test/sys/module/snd_seq_device/sections/.strtab delete mode 100644 test/sys/module/snd_seq_device/sections/.symtab delete mode 100644 test/sys/module/snd_seq_device/sections/.text delete mode 100644 test/sys/module/snd_seq_device/sections/__kcrctab delete mode 100644 test/sys/module/snd_seq_device/sections/__ksymtab delete mode 100644 test/sys/module/snd_seq_device/sections/__ksymtab_strings delete mode 100644 test/sys/module/snd_seq_device/srcversion delete mode 120000 test/sys/module/snd_timer/holders/snd_pcm delete mode 120000 test/sys/module/snd_timer/holders/snd_seq delete mode 100644 test/sys/module/snd_timer/initstate delete mode 100644 test/sys/module/snd_timer/notes/.note.gnu.build-id delete mode 100644 test/sys/module/snd_timer/parameters/timer_limit delete mode 100644 test/sys/module/snd_timer/parameters/timer_tstamp_monotonic delete mode 100644 test/sys/module/snd_timer/refcnt delete mode 100644 test/sys/module/snd_timer/sections/.bss delete mode 100644 test/sys/module/snd_timer/sections/.data delete mode 100644 test/sys/module/snd_timer/sections/.exit.text delete mode 100644 test/sys/module/snd_timer/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/snd_timer/sections/.init.text delete mode 100644 test/sys/module/snd_timer/sections/.note.gnu.build-id delete mode 100644 test/sys/module/snd_timer/sections/.rodata delete mode 100644 test/sys/module/snd_timer/sections/.rodata.str1.1 delete mode 100644 test/sys/module/snd_timer/sections/.smp_locks delete mode 100644 test/sys/module/snd_timer/sections/.strtab delete mode 100644 test/sys/module/snd_timer/sections/.symtab delete mode 100644 test/sys/module/snd_timer/sections/.text delete mode 100644 test/sys/module/snd_timer/sections/__bug_table delete mode 100644 test/sys/module/snd_timer/sections/__kcrctab delete mode 100644 test/sys/module/snd_timer/sections/__ksymtab delete mode 100644 test/sys/module/snd_timer/sections/__ksymtab_strings delete mode 100644 test/sys/module/snd_timer/sections/__param delete mode 100644 test/sys/module/snd_timer/srcversion delete mode 120000 test/sys/module/soundcore/holders/snd delete mode 100644 test/sys/module/soundcore/initstate delete mode 100644 test/sys/module/soundcore/notes/.note.gnu.build-id delete mode 100644 test/sys/module/soundcore/refcnt delete mode 100644 test/sys/module/soundcore/sections/.bss delete mode 100644 test/sys/module/soundcore/sections/.data delete mode 100644 test/sys/module/soundcore/sections/.exit.text delete mode 100644 test/sys/module/soundcore/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/soundcore/sections/.init.text delete mode 100644 test/sys/module/soundcore/sections/.note.gnu.build-id delete mode 100644 test/sys/module/soundcore/sections/.rodata delete mode 100644 test/sys/module/soundcore/sections/.rodata.str1.1 delete mode 100644 test/sys/module/soundcore/sections/.strtab delete mode 100644 test/sys/module/soundcore/sections/.symtab delete mode 100644 test/sys/module/soundcore/sections/.text delete mode 100644 test/sys/module/soundcore/sections/__kcrctab delete mode 100644 test/sys/module/soundcore/sections/__ksymtab delete mode 100644 test/sys/module/soundcore/sections/__ksymtab_strings delete mode 100644 test/sys/module/soundcore/srcversion delete mode 100644 test/sys/module/spurious/parameters/irqfixup delete mode 100644 test/sys/module/spurious/parameters/noirqdebug delete mode 100644 test/sys/module/sr_mod/initstate delete mode 100644 test/sys/module/sr_mod/notes/.note.gnu.build-id delete mode 100644 test/sys/module/sr_mod/parameters/xa_test delete mode 100644 test/sys/module/sr_mod/refcnt delete mode 100644 test/sys/module/sr_mod/sections/.bss delete mode 100644 test/sys/module/sr_mod/sections/.data delete mode 100644 test/sys/module/sr_mod/sections/.exit.text delete mode 100644 test/sys/module/sr_mod/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/sr_mod/sections/.init.text delete mode 100644 test/sys/module/sr_mod/sections/.note.gnu.build-id delete mode 100644 test/sys/module/sr_mod/sections/.rodata delete mode 100644 test/sys/module/sr_mod/sections/.rodata.str1.1 delete mode 100644 test/sys/module/sr_mod/sections/.smp_locks delete mode 100644 test/sys/module/sr_mod/sections/.strtab delete mode 100644 test/sys/module/sr_mod/sections/.symtab delete mode 100644 test/sys/module/sr_mod/sections/.text delete mode 100644 test/sys/module/sr_mod/sections/__param delete mode 100644 test/sys/module/sr_mod/srcversion delete mode 100644 test/sys/module/tcp_cubic/parameters/beta delete mode 100644 test/sys/module/tcp_cubic/parameters/bic_scale delete mode 100644 test/sys/module/tcp_cubic/parameters/fast_convergence delete mode 100644 test/sys/module/tcp_cubic/parameters/initial_ssthresh delete mode 100644 test/sys/module/tcp_cubic/parameters/tcp_friendliness delete mode 100644 test/sys/module/thermal/initstate delete mode 100644 test/sys/module/thermal/notes/.note.gnu.build-id delete mode 100644 test/sys/module/thermal/parameters/act delete mode 100644 test/sys/module/thermal/parameters/crt delete mode 100644 test/sys/module/thermal/parameters/psv delete mode 100644 test/sys/module/thermal/parameters/tzp delete mode 100644 test/sys/module/thermal/refcnt delete mode 100644 test/sys/module/thermal/sections/.bss delete mode 100644 test/sys/module/thermal/sections/.data delete mode 100644 test/sys/module/thermal/sections/.exit.text delete mode 100644 test/sys/module/thermal/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/thermal/sections/.init.data delete mode 100644 test/sys/module/thermal/sections/.init.text delete mode 100644 test/sys/module/thermal/sections/.note.gnu.build-id delete mode 100644 test/sys/module/thermal/sections/.rodata delete mode 100644 test/sys/module/thermal/sections/.rodata.str1.1 delete mode 100644 test/sys/module/thermal/sections/.strtab delete mode 100644 test/sys/module/thermal/sections/.symtab delete mode 100644 test/sys/module/thermal/sections/.text delete mode 100644 test/sys/module/thermal/sections/__param delete mode 100644 test/sys/module/thermal/srcversion delete mode 120000 test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_acpi delete mode 120000 test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_hwmon delete mode 100644 test/sys/module/thinkpad_acpi/initstate delete mode 100644 test/sys/module/thinkpad_acpi/notes/.note.gnu.build-id delete mode 100644 test/sys/module/thinkpad_acpi/refcnt delete mode 100644 test/sys/module/thinkpad_acpi/sections/.bss delete mode 100644 test/sys/module/thinkpad_acpi/sections/.data delete mode 100644 test/sys/module/thinkpad_acpi/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/thinkpad_acpi/sections/.init.data delete mode 100644 test/sys/module/thinkpad_acpi/sections/.init.text delete mode 100644 test/sys/module/thinkpad_acpi/sections/.note.gnu.build-id delete mode 100644 test/sys/module/thinkpad_acpi/sections/.rodata delete mode 100644 test/sys/module/thinkpad_acpi/sections/.rodata.str1.1 delete mode 100644 test/sys/module/thinkpad_acpi/sections/.smp_locks delete mode 100644 test/sys/module/thinkpad_acpi/sections/.strtab delete mode 100644 test/sys/module/thinkpad_acpi/sections/.symtab delete mode 100644 test/sys/module/thinkpad_acpi/sections/.text delete mode 100644 test/sys/module/thinkpad_acpi/sections/__bug_table delete mode 100644 test/sys/module/thinkpad_acpi/sections/__param delete mode 100644 test/sys/module/thinkpad_acpi/srcversion delete mode 100644 test/sys/module/thinkpad_acpi/version delete mode 120000 test/sys/module/uhci_hcd/drivers/pci:uhci_hcd delete mode 100644 test/sys/module/uhci_hcd/initstate delete mode 100644 test/sys/module/uhci_hcd/notes/.note.gnu.build-id delete mode 100644 test/sys/module/uhci_hcd/parameters/ignore_oc delete mode 100644 test/sys/module/uhci_hcd/refcnt delete mode 100644 test/sys/module/uhci_hcd/sections/.bss delete mode 100644 test/sys/module/uhci_hcd/sections/.data delete mode 100644 test/sys/module/uhci_hcd/sections/.exit.text delete mode 100644 test/sys/module/uhci_hcd/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/uhci_hcd/sections/.init.text delete mode 100644 test/sys/module/uhci_hcd/sections/.note.gnu.build-id delete mode 100644 test/sys/module/uhci_hcd/sections/.rodata delete mode 100644 test/sys/module/uhci_hcd/sections/.rodata.str1.1 delete mode 100644 test/sys/module/uhci_hcd/sections/.smp_locks delete mode 100644 test/sys/module/uhci_hcd/sections/.strtab delete mode 100644 test/sys/module/uhci_hcd/sections/.symtab delete mode 100644 test/sys/module/uhci_hcd/sections/.text delete mode 100644 test/sys/module/uhci_hcd/sections/__param delete mode 100644 test/sys/module/uhci_hcd/srcversion delete mode 100644 test/sys/module/uinput/initstate delete mode 100644 test/sys/module/uinput/notes/.note.gnu.build-id delete mode 100644 test/sys/module/uinput/refcnt delete mode 100644 test/sys/module/uinput/sections/.bss delete mode 100644 test/sys/module/uinput/sections/.data delete mode 100644 test/sys/module/uinput/sections/.exit.text delete mode 100644 test/sys/module/uinput/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/uinput/sections/.init.text delete mode 100644 test/sys/module/uinput/sections/.note.gnu.build-id delete mode 100644 test/sys/module/uinput/sections/.rodata delete mode 100644 test/sys/module/uinput/sections/.rodata.str1.1 delete mode 100644 test/sys/module/uinput/sections/.smp_locks delete mode 100644 test/sys/module/uinput/sections/.strtab delete mode 100644 test/sys/module/uinput/sections/.symtab delete mode 100644 test/sys/module/uinput/sections/.text delete mode 100644 test/sys/module/uinput/srcversion delete mode 100644 test/sys/module/uinput/version delete mode 120000 test/sys/module/usb_storage/drivers/usb:usb-storage delete mode 100644 test/sys/module/usb_storage/initstate delete mode 100644 test/sys/module/usb_storage/notes/.note.gnu.build-id delete mode 100644 test/sys/module/usb_storage/parameters/delay_use delete mode 100644 test/sys/module/usb_storage/parameters/swi_tru_install delete mode 100644 test/sys/module/usb_storage/refcnt delete mode 100644 test/sys/module/usb_storage/sections/.bss delete mode 100644 test/sys/module/usb_storage/sections/.data delete mode 100644 test/sys/module/usb_storage/sections/.exit.text delete mode 100644 test/sys/module/usb_storage/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/usb_storage/sections/.init.text delete mode 100644 test/sys/module/usb_storage/sections/.note.gnu.build-id delete mode 100644 test/sys/module/usb_storage/sections/.rodata delete mode 100644 test/sys/module/usb_storage/sections/.rodata.str1.1 delete mode 100644 test/sys/module/usb_storage/sections/.smp_locks delete mode 100644 test/sys/module/usb_storage/sections/.strtab delete mode 100644 test/sys/module/usb_storage/sections/.symtab delete mode 100644 test/sys/module/usb_storage/sections/.text delete mode 100644 test/sys/module/usb_storage/sections/__param delete mode 100644 test/sys/module/usb_storage/srcversion delete mode 120000 test/sys/module/usbcore/drivers/usb:hub delete mode 120000 test/sys/module/usbcore/drivers/usb:usb delete mode 120000 test/sys/module/usbcore/drivers/usb:usbfs delete mode 120000 test/sys/module/usbcore/holders/cdc_acm delete mode 120000 test/sys/module/usbcore/holders/ehci_hcd delete mode 120000 test/sys/module/usbcore/holders/uhci_hcd delete mode 120000 test/sys/module/usbcore/holders/usb_storage delete mode 120000 test/sys/module/usbcore/holders/usbhid delete mode 100644 test/sys/module/usbcore/initstate delete mode 100644 test/sys/module/usbcore/notes/.note.gnu.build-id delete mode 100644 test/sys/module/usbcore/parameters/autosuspend delete mode 100644 test/sys/module/usbcore/parameters/blinkenlights delete mode 100644 test/sys/module/usbcore/parameters/nousb delete mode 100644 test/sys/module/usbcore/parameters/old_scheme_first delete mode 100644 test/sys/module/usbcore/parameters/usbfs_snoop delete mode 100644 test/sys/module/usbcore/parameters/use_both_schemes delete mode 100644 test/sys/module/usbcore/refcnt delete mode 100644 test/sys/module/usbcore/sections/.bss delete mode 100644 test/sys/module/usbcore/sections/.data delete mode 100644 test/sys/module/usbcore/sections/.exit.text delete mode 100644 test/sys/module/usbcore/sections/.fixup delete mode 100644 test/sys/module/usbcore/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/usbcore/sections/.init.text delete mode 100644 test/sys/module/usbcore/sections/.note.gnu.build-id delete mode 100644 test/sys/module/usbcore/sections/.rodata delete mode 100644 test/sys/module/usbcore/sections/.rodata.str1.1 delete mode 100644 test/sys/module/usbcore/sections/.smp_locks delete mode 100644 test/sys/module/usbcore/sections/.strtab delete mode 100644 test/sys/module/usbcore/sections/.symtab delete mode 100644 test/sys/module/usbcore/sections/.text delete mode 100644 test/sys/module/usbcore/sections/__bug_table delete mode 100644 test/sys/module/usbcore/sections/__ex_table delete mode 100644 test/sys/module/usbcore/sections/__kcrctab_gpl delete mode 100644 test/sys/module/usbcore/sections/__ksymtab_gpl delete mode 100644 test/sys/module/usbcore/sections/__ksymtab_strings delete mode 100644 test/sys/module/usbcore/sections/__param delete mode 100644 test/sys/module/usbcore/srcversion delete mode 120000 test/sys/module/usbhid/drivers/usb:usbhid delete mode 100644 test/sys/module/usbhid/initstate delete mode 100644 test/sys/module/usbhid/notes/.note.gnu.build-id delete mode 100644 test/sys/module/usbhid/parameters/mousepoll delete mode 100644 test/sys/module/usbhid/parameters/quirks delete mode 100644 test/sys/module/usbhid/parameters/rdesc_quirks delete mode 100644 test/sys/module/usbhid/refcnt delete mode 100644 test/sys/module/usbhid/sections/.bss delete mode 100644 test/sys/module/usbhid/sections/.data delete mode 100644 test/sys/module/usbhid/sections/.exit.text delete mode 100644 test/sys/module/usbhid/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/usbhid/sections/.init.text delete mode 100644 test/sys/module/usbhid/sections/.note.gnu.build-id delete mode 100644 test/sys/module/usbhid/sections/.rodata delete mode 100644 test/sys/module/usbhid/sections/.rodata.str1.1 delete mode 100644 test/sys/module/usbhid/sections/.smp_locks delete mode 100644 test/sys/module/usbhid/sections/.strtab delete mode 100644 test/sys/module/usbhid/sections/.symtab delete mode 100644 test/sys/module/usbhid/sections/.text delete mode 100644 test/sys/module/usbhid/sections/__kcrctab_gpl delete mode 100644 test/sys/module/usbhid/sections/__ksymtab_gpl delete mode 100644 test/sys/module/usbhid/sections/__ksymtab_strings delete mode 100644 test/sys/module/usbhid/sections/__param delete mode 100644 test/sys/module/usbhid/srcversion delete mode 100644 test/sys/module/vt/parameters/default_blu delete mode 100644 test/sys/module/vt/parameters/default_grn delete mode 100644 test/sys/module/vt/parameters/default_red delete mode 100644 test/sys/module/vt/parameters/default_utf8 delete mode 100644 test/sys/module/vt/parameters/italic delete mode 100644 test/sys/module/vt/parameters/underline delete mode 120000 test/sys/module/yenta_socket/drivers/pci:yenta_cardbus delete mode 100644 test/sys/module/yenta_socket/initstate delete mode 100644 test/sys/module/yenta_socket/notes/.note.gnu.build-id delete mode 100644 test/sys/module/yenta_socket/parameters/disable_clkrun delete mode 100644 test/sys/module/yenta_socket/parameters/isa_probe delete mode 100644 test/sys/module/yenta_socket/parameters/pwr_irqs_off delete mode 100644 test/sys/module/yenta_socket/refcnt delete mode 100644 test/sys/module/yenta_socket/sections/.bss delete mode 100644 test/sys/module/yenta_socket/sections/.data delete mode 100644 test/sys/module/yenta_socket/sections/.devinit.text delete mode 100644 test/sys/module/yenta_socket/sections/.exit.text delete mode 100644 test/sys/module/yenta_socket/sections/.gnu.linkonce.this_module delete mode 100644 test/sys/module/yenta_socket/sections/.init.text delete mode 100644 test/sys/module/yenta_socket/sections/.note.gnu.build-id delete mode 100644 test/sys/module/yenta_socket/sections/.rodata delete mode 100644 test/sys/module/yenta_socket/sections/.rodata.str1.1 delete mode 100644 test/sys/module/yenta_socket/sections/.strtab delete mode 100644 test/sys/module/yenta_socket/sections/.symtab delete mode 100644 test/sys/module/yenta_socket/sections/.text delete mode 100644 test/sys/module/yenta_socket/sections/__bug_table delete mode 100644 test/sys/module/yenta_socket/sections/__param delete mode 100644 test/sys/module/yenta_socket/srcversion delete mode 100644 test/sys/power/state create mode 100755 test/udev-test.pl delete mode 100755 test/udev-test.pl.in diff --git a/Makefile.am b/Makefile.am index 4329291243..06500b068b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -36,6 +36,7 @@ INSTALL_EXEC_HOOKS = INSTALL_DATA_HOOKS = UNINSTALL_EXEC_HOOKS = DISTCHECK_HOOKS = +DISTCLEAN_LOCAL_HOOKS = udevhomedir = $(libexecdir)/udev udevhome_SCRIPTS = @@ -289,12 +290,6 @@ TESTS = \ test/udev-test.pl \ test/rules-test.sh -EXTRA_DIST += \ - test/udev-test.pl.in - -CLEANFILES += \ - test/udev-test.pl - check_PROGRAMS = \ src/test-libudev \ src/test-udev @@ -309,6 +304,18 @@ src_test_udev_CFLAGS = $(udev_common_CFLAGS) src_test_udev_LDADD = $(udev_common_LDADD) src_test_udev_CPPFLAGS = $(udev_common_CPPFLAGS) +# packed sysfs test tree +test/sys/kernel/uevent_seqnum: + $(AM_V_GEN)mkdir -p test && tar -C test/ -xJf $(top_srcdir)/test/sys.tar.xz + +BUILT_SOURCES += test/sys/kernel/uevent_seqnum + +test-sys-distclean: + -rm -rf test/sys +DISTCLEAN_LOCAL_HOOKS += test-sys-distclean + +EXTRA_DIST += test/sys.tar.xz + # ------------------------------------------------------------------------------ # ata_id - ATA identify # ------------------------------------------------------------------------------ @@ -517,14 +524,14 @@ if ENABLE_KEYMAP # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ -src_keymap_SOURCES = src/extras/keymap/keymap.c -src_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I src/extras/keymap -nodist_src_keymap_SOURCES = \ +src_extras_keymap_keymap_SOURCES = src/extras/keymap/keymap.c +src_extras_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I src/extras/keymap +nodist_src_extras_keymap_keymap_SOURCES = \ src/extras/keymap/keys-from-name.h \ src/extras/keymap/keys-to-name.h -BUILT_SOURCES += $(nodist_src_keymap_SOURCES) +BUILT_SOURCES += $(nodist_src_extras_keymap_keymap_SOURCES) -pkglibexec_PROGRAMS += src/keymap +pkglibexec_PROGRAMS += src/extras/keymap/keymap dist_doc_DATA = src/extras/keymap/README.keymap.txt dist_udevrules_DATA += \ @@ -631,13 +638,13 @@ if ENABLE_MTD_PROBE # ------------------------------------------------------------------------------ # mtd_probe - autoloads FTL module for mtd devices # ------------------------------------------------------------------------------ -src_mtd_probe_SOURCES = \ +src_extras_mtd_probe_mtd_probe_SOURCES = \ src/extras/mtd_probe/mtd_probe.c \ src/extras/mtd_probe/mtd_probe.h \ src/extras/mtd_probe/probe_smartmedia.c -src_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +src_extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) dist_udevrules_DATA += src/extras/mtd_probe/75-probe_mtd.rules -pkglibexec_PROGRAMS += src/mtd_probe +pkglibexec_PROGRAMS += src/extras/mtd_probe/mtd_probe endif if ENABLE_RULE_GENERATOR @@ -649,7 +656,7 @@ dist_udevhome_SCRIPTS += \ src/extras/rule_generator/write_net_rules udevhome_DATA = src/extras/rule_generator/rule_generator.functions -dist_udevhome_DATA = \ +dist_udevhome_DATA += \ src/extras/rule_generator/75-cd-aliases-generator.rules \ src/extras/rule_generator/75-persistent-net-generator.rules endif @@ -715,6 +722,8 @@ uninstall-hook: $(UNINSTALL_EXEC_HOOKS) distcheck-hook: $(DISTCHECK_HOOKS) +distclean-local: $(DISTCLEAN_LOCAL_HOOKS) + # ------------------------------------------------------------------------------ # custom release helpers # ------------------------------------------------------------------------------ diff --git a/test/.gitignore b/test/.gitignore deleted file mode 100644 index 8d662eaf4d..0000000000 --- a/test/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -udev-test.pl - diff --git a/test/sys.tar.xz b/test/sys.tar.xz new file mode 100644 index 0000000000..49ee8027b2 Binary files /dev/null and b/test/sys.tar.xz differ diff --git a/test/sys/block/loop0 b/test/sys/block/loop0 deleted file mode 120000 index caf270b78b..0000000000 --- a/test/sys/block/loop0 +++ /dev/null @@ -1 +0,0 @@ -../devices/virtual/block/loop0 \ No newline at end of file diff --git a/test/sys/block/loop1 b/test/sys/block/loop1 deleted file mode 120000 index ad28556992..0000000000 --- a/test/sys/block/loop1 +++ /dev/null @@ -1 +0,0 @@ -../devices/virtual/block/loop1 \ No newline at end of file diff --git a/test/sys/block/loop2 b/test/sys/block/loop2 deleted file mode 120000 index cd6da29c2f..0000000000 --- a/test/sys/block/loop2 +++ /dev/null @@ -1 +0,0 @@ -../devices/virtual/block/loop2 \ No newline at end of file diff --git a/test/sys/block/loop3 b/test/sys/block/loop3 deleted file mode 120000 index 69a4794dbb..0000000000 --- a/test/sys/block/loop3 +++ /dev/null @@ -1 +0,0 @@ -../devices/virtual/block/loop3 \ No newline at end of file diff --git a/test/sys/block/loop4 b/test/sys/block/loop4 deleted file mode 120000 index 8244471b16..0000000000 --- a/test/sys/block/loop4 +++ /dev/null @@ -1 +0,0 @@ -../devices/virtual/block/loop4 \ No newline at end of file diff --git a/test/sys/block/loop5 b/test/sys/block/loop5 deleted file mode 120000 index 9b436c9d67..0000000000 --- a/test/sys/block/loop5 +++ /dev/null @@ -1 +0,0 @@ -../devices/virtual/block/loop5 \ No newline at end of file diff --git a/test/sys/block/loop6 b/test/sys/block/loop6 deleted file mode 120000 index b968dfdabb..0000000000 --- a/test/sys/block/loop6 +++ /dev/null @@ -1 +0,0 @@ -../devices/virtual/block/loop6 \ No newline at end of file diff --git a/test/sys/block/loop7 b/test/sys/block/loop7 deleted file mode 120000 index 947b66f25c..0000000000 --- a/test/sys/block/loop7 +++ /dev/null @@ -1 +0,0 @@ -../devices/virtual/block/loop7 \ No newline at end of file diff --git a/test/sys/block/md0 b/test/sys/block/md0 deleted file mode 120000 index 2a12b5d3fa..0000000000 --- a/test/sys/block/md0 +++ /dev/null @@ -1 +0,0 @@ -../devices/virtual/block/md0 \ No newline at end of file diff --git a/test/sys/block/sda b/test/sys/block/sda deleted file mode 120000 index 623767d6b6..0000000000 --- a/test/sys/block/sda +++ /dev/null @@ -1 +0,0 @@ -../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda \ No newline at end of file diff --git a/test/sys/block/sdb b/test/sys/block/sdb deleted file mode 120000 index 9d55a61996..0000000000 --- a/test/sys/block/sdb +++ /dev/null @@ -1 +0,0 @@ -../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb \ No newline at end of file diff --git a/test/sys/block/sr0 b/test/sys/block/sr0 deleted file mode 120000 index c61fe209d6..0000000000 --- a/test/sys/block/sr0 +++ /dev/null @@ -1 +0,0 @@ -../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/ACPI0003:00 b/test/sys/bus/acpi/devices/ACPI0003:00 deleted file mode 120000 index 655d3c2b80..0000000000 --- a/test/sys/bus/acpi/devices/ACPI0003:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/ACPI0007:00 b/test/sys/bus/acpi/devices/ACPI0007:00 deleted file mode 120000 index 81838c937a..0000000000 --- a/test/sys/bus/acpi/devices/ACPI0007:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/ACPI0007:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/ACPI0007:01 b/test/sys/bus/acpi/devices/ACPI0007:01 deleted file mode 120000 index 898e064922..0000000000 --- a/test/sys/bus/acpi/devices/ACPI0007:01 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/ACPI0007:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/ATM1200:00 b/test/sys/bus/acpi/devices/ATM1200:00 deleted file mode 120000 index 32ea54ccc9..0000000000 --- a/test/sys/bus/acpi/devices/ATM1200:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/IBM0057:00 b/test/sys/bus/acpi/devices/IBM0057:00 deleted file mode 120000 index 2160bb1b20..0000000000 --- a/test/sys/bus/acpi/devices/IBM0057:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/IBM0068:00 b/test/sys/bus/acpi/devices/IBM0068:00 deleted file mode 120000 index 8cc3fb2a56..0000000000 --- a/test/sys/bus/acpi/devices/IBM0068:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/IBM0079:00 b/test/sys/bus/acpi/devices/IBM0079:00 deleted file mode 120000 index 37a83b4286..0000000000 --- a/test/sys/bus/acpi/devices/IBM0079:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/IBM0079:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXPOWER:00 b/test/sys/bus/acpi/devices/LNXPOWER:00 deleted file mode 120000 index bc1e9ec5fd..0000000000 --- a/test/sys/bus/acpi/devices/LNXPOWER:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXPWRBN:00 b/test/sys/bus/acpi/devices/LNXPWRBN:00 deleted file mode 120000 index 3d630ea18b..0000000000 --- a/test/sys/bus/acpi/devices/LNXPWRBN:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/LNXPWRBN:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXSYSTM:00 b/test/sys/bus/acpi/devices/LNXSYSTM:00 deleted file mode 120000 index c72f26c090..0000000000 --- a/test/sys/bus/acpi/devices/LNXSYSTM:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXTHERM:00 b/test/sys/bus/acpi/devices/LNXTHERM:00 deleted file mode 120000 index 0d88be41d3..0000000000 --- a/test/sys/bus/acpi/devices/LNXTHERM:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/LNXTHERM:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXTHERM:01 b/test/sys/bus/acpi/devices/LNXTHERM:01 deleted file mode 120000 index bb2431d1f3..0000000000 --- a/test/sys/bus/acpi/devices/LNXTHERM:01 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/LNXTHERM:02 b/test/sys/bus/acpi/devices/LNXTHERM:02 deleted file mode 120000 index 8b5c6c91df..0000000000 --- a/test/sys/bus/acpi/devices/LNXTHERM:02 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0000:00 b/test/sys/bus/acpi/devices/PNP0000:00 deleted file mode 120000 index c67279b47b..0000000000 --- a/test/sys/bus/acpi/devices/PNP0000:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0100:00 b/test/sys/bus/acpi/devices/PNP0100:00 deleted file mode 120000 index 87b7a787cd..0000000000 --- a/test/sys/bus/acpi/devices/PNP0100:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0103:00 b/test/sys/bus/acpi/devices/PNP0103:00 deleted file mode 120000 index ff1c0e5cf0..0000000000 --- a/test/sys/bus/acpi/devices/PNP0103:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0200:00 b/test/sys/bus/acpi/devices/PNP0200:00 deleted file mode 120000 index 81809075f1..0000000000 --- a/test/sys/bus/acpi/devices/PNP0200:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0303:00 b/test/sys/bus/acpi/devices/PNP0303:00 deleted file mode 120000 index cd99abcc2c..0000000000 --- a/test/sys/bus/acpi/devices/PNP0303:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0800:00 b/test/sys/bus/acpi/devices/PNP0800:00 deleted file mode 120000 index f0ffdfa1db..0000000000 --- a/test/sys/bus/acpi/devices/PNP0800:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0A08:00 b/test/sys/bus/acpi/devices/PNP0A08:00 deleted file mode 120000 index 99592aef58..0000000000 --- a/test/sys/bus/acpi/devices/PNP0A08:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0B00:00 b/test/sys/bus/acpi/devices/PNP0B00:00 deleted file mode 120000 index 6cb2d7c575..0000000000 --- a/test/sys/bus/acpi/devices/PNP0B00:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C01:00 b/test/sys/bus/acpi/devices/PNP0C01:00 deleted file mode 120000 index 197577a13f..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C01:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C01:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C02:00 b/test/sys/bus/acpi/devices/PNP0C02:00 deleted file mode 120000 index 077939468e..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C02:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C04:00 b/test/sys/bus/acpi/devices/PNP0C04:00 deleted file mode 120000 index 75c2e30b70..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C04:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C09:00 b/test/sys/bus/acpi/devices/PNP0C09:00 deleted file mode 120000 index 0d813f6351..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C09:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0A:00 b/test/sys/bus/acpi/devices/PNP0C0A:00 deleted file mode 120000 index 8f050d9a62..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0A:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0D:00 b/test/sys/bus/acpi/devices/PNP0C0D:00 deleted file mode 120000 index 4aa9bb0093..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0D:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0D:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0E:00 b/test/sys/bus/acpi/devices/PNP0C0E:00 deleted file mode 120000 index 9124fb2f19..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0E:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0E:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:00 b/test/sys/bus/acpi/devices/PNP0C0F:00 deleted file mode 120000 index 3fafe1361f..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0F:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0F:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:01 b/test/sys/bus/acpi/devices/PNP0C0F:01 deleted file mode 120000 index 1c40af1325..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0F:01 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0F:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:02 b/test/sys/bus/acpi/devices/PNP0C0F:02 deleted file mode 120000 index 09320cf8cf..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0F:02 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0F:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:03 b/test/sys/bus/acpi/devices/PNP0C0F:03 deleted file mode 120000 index 0c2fbb5115..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0F:03 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0F:03 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:04 b/test/sys/bus/acpi/devices/PNP0C0F:04 deleted file mode 120000 index 6119670a38..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0F:04 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0F:04 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:05 b/test/sys/bus/acpi/devices/PNP0C0F:05 deleted file mode 120000 index 50fd3653b7..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0F:05 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0F:05 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:06 b/test/sys/bus/acpi/devices/PNP0C0F:06 deleted file mode 120000 index ffc5553f15..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0F:06 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0F:06 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/PNP0C0F:07 b/test/sys/bus/acpi/devices/PNP0C0F:07 deleted file mode 120000 index 3f1ea32333..0000000000 --- a/test/sys/bus/acpi/devices/PNP0C0F:07 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0C0F:07 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:00 b/test/sys/bus/acpi/devices/device:00 deleted file mode 120000 index 4e97101d3d..0000000000 --- a/test/sys/bus/acpi/devices/device:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:01 b/test/sys/bus/acpi/devices/device:01 deleted file mode 120000 index dc2eff75ab..0000000000 --- a/test/sys/bus/acpi/devices/device:01 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:02 b/test/sys/bus/acpi/devices/device:02 deleted file mode 120000 index 7a96002f9f..0000000000 --- a/test/sys/bus/acpi/devices/device:02 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:03 b/test/sys/bus/acpi/devices/device:03 deleted file mode 120000 index 78b1f241b2..0000000000 --- a/test/sys/bus/acpi/devices/device:03 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:04 b/test/sys/bus/acpi/devices/device:04 deleted file mode 120000 index 9e843d76fd..0000000000 --- a/test/sys/bus/acpi/devices/device:04 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:05 b/test/sys/bus/acpi/devices/device:05 deleted file mode 120000 index a4f6682167..0000000000 --- a/test/sys/bus/acpi/devices/device:05 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:06 b/test/sys/bus/acpi/devices/device:06 deleted file mode 120000 index ed5e6b1f99..0000000000 --- a/test/sys/bus/acpi/devices/device:06 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:07 b/test/sys/bus/acpi/devices/device:07 deleted file mode 120000 index f69fa70fb2..0000000000 --- a/test/sys/bus/acpi/devices/device:07 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:08 b/test/sys/bus/acpi/devices/device:08 deleted file mode 120000 index ed31186527..0000000000 --- a/test/sys/bus/acpi/devices/device:08 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:09 b/test/sys/bus/acpi/devices/device:09 deleted file mode 120000 index 194fcaaf12..0000000000 --- a/test/sys/bus/acpi/devices/device:09 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0a b/test/sys/bus/acpi/devices/device:0a deleted file mode 120000 index 9e9aad8d1d..0000000000 --- a/test/sys/bus/acpi/devices/device:0a +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0b b/test/sys/bus/acpi/devices/device:0b deleted file mode 120000 index 9f16cff1ef..0000000000 --- a/test/sys/bus/acpi/devices/device:0b +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0c b/test/sys/bus/acpi/devices/device:0c deleted file mode 120000 index a57d0300db..0000000000 --- a/test/sys/bus/acpi/devices/device:0c +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0d b/test/sys/bus/acpi/devices/device:0d deleted file mode 120000 index 34f57dc91c..0000000000 --- a/test/sys/bus/acpi/devices/device:0d +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0e b/test/sys/bus/acpi/devices/device:0e deleted file mode 120000 index 1c1326f6d7..0000000000 --- a/test/sys/bus/acpi/devices/device:0e +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:0f b/test/sys/bus/acpi/devices/device:0f deleted file mode 120000 index 2426961458..0000000000 --- a/test/sys/bus/acpi/devices/device:0f +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:10 b/test/sys/bus/acpi/devices/device:10 deleted file mode 120000 index 5339f6708e..0000000000 --- a/test/sys/bus/acpi/devices/device:10 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:11 b/test/sys/bus/acpi/devices/device:11 deleted file mode 120000 index dbb93de0f7..0000000000 --- a/test/sys/bus/acpi/devices/device:11 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:12 b/test/sys/bus/acpi/devices/device:12 deleted file mode 120000 index d715768d07..0000000000 --- a/test/sys/bus/acpi/devices/device:12 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:13 b/test/sys/bus/acpi/devices/device:13 deleted file mode 120000 index bb3033f5cc..0000000000 --- a/test/sys/bus/acpi/devices/device:13 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:14 b/test/sys/bus/acpi/devices/device:14 deleted file mode 120000 index 813cac7cb7..0000000000 --- a/test/sys/bus/acpi/devices/device:14 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:15 b/test/sys/bus/acpi/devices/device:15 deleted file mode 120000 index 75f3012ade..0000000000 --- a/test/sys/bus/acpi/devices/device:15 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:16 b/test/sys/bus/acpi/devices/device:16 deleted file mode 120000 index c03c72704f..0000000000 --- a/test/sys/bus/acpi/devices/device:16 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:17 b/test/sys/bus/acpi/devices/device:17 deleted file mode 120000 index 7de3b0e648..0000000000 --- a/test/sys/bus/acpi/devices/device:17 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:18 b/test/sys/bus/acpi/devices/device:18 deleted file mode 120000 index 1ce92876f5..0000000000 --- a/test/sys/bus/acpi/devices/device:18 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:19 b/test/sys/bus/acpi/devices/device:19 deleted file mode 120000 index 1180346499..0000000000 --- a/test/sys/bus/acpi/devices/device:19 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1a b/test/sys/bus/acpi/devices/device:1a deleted file mode 120000 index 618f261610..0000000000 --- a/test/sys/bus/acpi/devices/device:1a +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1b b/test/sys/bus/acpi/devices/device:1b deleted file mode 120000 index 9f5c9e2ed8..0000000000 --- a/test/sys/bus/acpi/devices/device:1b +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1c b/test/sys/bus/acpi/devices/device:1c deleted file mode 120000 index 25c0b84323..0000000000 --- a/test/sys/bus/acpi/devices/device:1c +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1d b/test/sys/bus/acpi/devices/device:1d deleted file mode 120000 index 19fb701973..0000000000 --- a/test/sys/bus/acpi/devices/device:1d +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1e b/test/sys/bus/acpi/devices/device:1e deleted file mode 120000 index 05d6d3d017..0000000000 --- a/test/sys/bus/acpi/devices/device:1e +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:1f b/test/sys/bus/acpi/devices/device:1f deleted file mode 120000 index e68bcc3f0a..0000000000 --- a/test/sys/bus/acpi/devices/device:1f +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:20 b/test/sys/bus/acpi/devices/device:20 deleted file mode 120000 index 26bfff520a..0000000000 --- a/test/sys/bus/acpi/devices/device:20 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:21 b/test/sys/bus/acpi/devices/device:21 deleted file mode 120000 index f9d5c37d3c..0000000000 --- a/test/sys/bus/acpi/devices/device:21 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:22 b/test/sys/bus/acpi/devices/device:22 deleted file mode 120000 index 15947672e9..0000000000 --- a/test/sys/bus/acpi/devices/device:22 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:23 b/test/sys/bus/acpi/devices/device:23 deleted file mode 120000 index 8a81978ad8..0000000000 --- a/test/sys/bus/acpi/devices/device:23 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:24 b/test/sys/bus/acpi/devices/device:24 deleted file mode 120000 index 718669b245..0000000000 --- a/test/sys/bus/acpi/devices/device:24 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24 \ No newline at end of file diff --git a/test/sys/bus/acpi/devices/device:25 b/test/sys/bus/acpi/devices/device:25 deleted file mode 120000 index 1055658761..0000000000 --- a/test/sys/bus/acpi/devices/device:25 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/ac/ACPI0003:00 b/test/sys/bus/acpi/drivers/ac/ACPI0003:00 deleted file mode 120000 index bb4955228d..0000000000 --- a/test/sys/bus/acpi/drivers/ac/ACPI0003:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/battery/PNP0C0A:00 b/test/sys/bus/acpi/drivers/battery/PNP0C0A:00 deleted file mode 120000 index 7f7754c48c..0000000000 --- a/test/sys/bus/acpi/drivers/battery/PNP0C0A:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/button/LNXPWRBN:00 b/test/sys/bus/acpi/drivers/button/LNXPWRBN:00 deleted file mode 120000 index 94bfa02ebb..0000000000 --- a/test/sys/bus/acpi/drivers/button/LNXPWRBN:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/LNXPWRBN:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/button/PNP0C0D:00 b/test/sys/bus/acpi/drivers/button/PNP0C0D:00 deleted file mode 120000 index 8488f42871..0000000000 --- a/test/sys/bus/acpi/drivers/button/PNP0C0D:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0D:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/button/PNP0C0E:00 b/test/sys/bus/acpi/drivers/button/PNP0C0E:00 deleted file mode 120000 index 2324f7314d..0000000000 --- a/test/sys/bus/acpi/drivers/button/PNP0C0E:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0E:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/ec/PNP0C09:00 b/test/sys/bus/acpi/drivers/ec/PNP0C09:00 deleted file mode 120000 index bb79fa762a..0000000000 --- a/test/sys/bus/acpi/drivers/ec/PNP0C09:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 deleted file mode 120000 index 1d774fb92c..0000000000 --- a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 deleted file mode 120000 index 248ca41a00..0000000000 --- a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:01 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 deleted file mode 120000 index a96a10bf11..0000000000 --- a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:02 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 deleted file mode 120000 index e0a724bbb0..0000000000 --- a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:03 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:03 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 deleted file mode 120000 index 8c9b8e2e8b..0000000000 --- a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:04 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:04 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 deleted file mode 120000 index f5ec92970e..0000000000 --- a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:05 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:05 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 deleted file mode 120000 index e8e6ce971a..0000000000 --- a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:06 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:06 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 b/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 deleted file mode 120000 index 0a2a79c177..0000000000 --- a/test/sys/bus/acpi/drivers/pci_link/PNP0C0F:07 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0C0F:07 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 b/test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 deleted file mode 120000 index b0535ab690..0000000000 --- a/test/sys/bus/acpi/drivers/pci_root/PNP0A08:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/power/LNXPOWER:00 b/test/sys/bus/acpi/drivers/power/LNXPOWER:00 deleted file mode 120000 index f0eb1b9da1..0000000000 --- a/test/sys/bus/acpi/drivers/power/LNXPOWER:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/processor/ACPI0007:00 b/test/sys/bus/acpi/drivers/processor/ACPI0007:00 deleted file mode 120000 index fe29ff7547..0000000000 --- a/test/sys/bus/acpi/drivers/processor/ACPI0007:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/ACPI0007:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/processor/ACPI0007:01 b/test/sys/bus/acpi/drivers/processor/ACPI0007:01 deleted file mode 120000 index 38d000407a..0000000000 --- a/test/sys/bus/acpi/drivers/processor/ACPI0007:01 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/ACPI0007:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 b/test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 deleted file mode 120000 index bbedbc8312..0000000000 --- a/test/sys/bus/acpi/drivers/thermal/LNXTHERM:01 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 b/test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 deleted file mode 120000 index ca295600e1..0000000000 --- a/test/sys/bus/acpi/drivers/thermal/LNXTHERM:02 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 b/test/sys/bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 deleted file mode 120000 index 1d4b168b38..0000000000 --- a/test/sys/bus/acpi/drivers/thinkpad_hotkey/IBM0068:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00 \ No newline at end of file diff --git a/test/sys/bus/acpi/drivers_autoprobe b/test/sys/bus/acpi/drivers_autoprobe deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/bus/acpi/drivers_autoprobe +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/bus/pci/devices/0000:00:00.0 b/test/sys/bus/pci/devices/0000:00:00.0 deleted file mode 120000 index e61686a507..0000000000 --- a/test/sys/bus/pci/devices/0000:00:00.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:01.0 b/test/sys/bus/pci/devices/0000:00:01.0 deleted file mode 120000 index 2d40bc9782..0000000000 --- a/test/sys/bus/pci/devices/0000:00:01.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:01.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1b.0 b/test/sys/bus/pci/devices/0000:00:1b.0 deleted file mode 120000 index b1f192d9a7..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1b.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1b.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1c.0 b/test/sys/bus/pci/devices/0000:00:1c.0 deleted file mode 120000 index 4bf4f01884..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1c.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1c.1 b/test/sys/bus/pci/devices/0000:00:1c.1 deleted file mode 120000 index 7d501ef205..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1c.1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.1 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1c.2 b/test/sys/bus/pci/devices/0000:00:1c.2 deleted file mode 120000 index 43a55a338d..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1c.2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.2 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1c.3 b/test/sys/bus/pci/devices/0000:00:1c.3 deleted file mode 120000 index 342b8b5889..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1c.3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.3 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1d.0 b/test/sys/bus/pci/devices/0000:00:1d.0 deleted file mode 120000 index b883309173..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1d.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1d.1 b/test/sys/bus/pci/devices/0000:00:1d.1 deleted file mode 120000 index c9058b7776..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1d.1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.1 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1d.2 b/test/sys/bus/pci/devices/0000:00:1d.2 deleted file mode 120000 index c94140da28..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1d.2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.2 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1d.3 b/test/sys/bus/pci/devices/0000:00:1d.3 deleted file mode 120000 index 75b0de6506..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1d.3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1e.0 b/test/sys/bus/pci/devices/0000:00:1e.0 deleted file mode 120000 index e000c77614..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1e.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1f.0 b/test/sys/bus/pci/devices/0000:00:1f.0 deleted file mode 120000 index 11b66db1e3..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1f.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1f.1 b/test/sys/bus/pci/devices/0000:00:1f.1 deleted file mode 120000 index 005f9fdf7d..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1f.1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.1 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1f.2 b/test/sys/bus/pci/devices/0000:00:1f.2 deleted file mode 120000 index cb9f3ca449..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1f.2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.2 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:00:1f.3 b/test/sys/bus/pci/devices/0000:00:1f.3 deleted file mode 120000 index c1efad804e..0000000000 --- a/test/sys/bus/pci/devices/0000:00:1f.3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.3 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:01:00.0 b/test/sys/bus/pci/devices/0000:01:00.0 deleted file mode 120000 index db204c1ff1..0000000000 --- a/test/sys/bus/pci/devices/0000:01:00.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:01.0/0000:01:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:02:00.0 b/test/sys/bus/pci/devices/0000:02:00.0 deleted file mode 120000 index 24aa5ee776..0000000000 --- a/test/sys/bus/pci/devices/0000:02:00.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.0/0000:02:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:03:00.0 b/test/sys/bus/pci/devices/0000:03:00.0 deleted file mode 120000 index 3770ce19b9..0000000000 --- a/test/sys/bus/pci/devices/0000:03:00.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/devices/0000:15:00.0 b/test/sys/bus/pci/devices/0000:15:00.0 deleted file mode 120000 index 5cbde66843..0000000000 --- a/test/sys/bus/pci/devices/0000:15:00.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1e.0/0000:15:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 b/test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 deleted file mode 120000 index e7529cd08b..0000000000 --- a/test/sys/bus/pci/drivers/HDA Intel/0000:00:1b.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1b.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/HDA Intel/module b/test/sys/bus/pci/drivers/HDA Intel/module deleted file mode 120000 index 86642bc49e..0000000000 --- a/test/sys/bus/pci/drivers/HDA Intel/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/snd_hda_intel \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/agpgart-intel/module b/test/sys/bus/pci/drivers/agpgart-intel/module deleted file mode 120000 index 7fa1e07806..0000000000 --- a/test/sys/bus/pci/drivers/agpgart-intel/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/intel_agp \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/ahci/0000:00:1f.2 b/test/sys/bus/pci/drivers/ahci/0000:00:1f.2 deleted file mode 120000 index 4d9f1df625..0000000000 --- a/test/sys/bus/pci/drivers/ahci/0000:00:1f.2 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1f.2 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/ahci/module b/test/sys/bus/pci/drivers/ahci/module deleted file mode 120000 index ca9b8364a5..0000000000 --- a/test/sys/bus/pci/drivers/ahci/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/ahci \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 b/test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 deleted file mode 120000 index db282150b8..0000000000 --- a/test/sys/bus/pci/drivers/ata_piix/0000:00:1f.1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1f.1 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/e1000e/0000:02:00.0 b/test/sys/bus/pci/drivers/e1000e/0000:02:00.0 deleted file mode 120000 index 5f111870cb..0000000000 --- a/test/sys/bus/pci/drivers/e1000e/0000:02:00.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1c.0/0000:02:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/e1000e/module b/test/sys/bus/pci/drivers/e1000e/module deleted file mode 120000 index 6b33aca904..0000000000 --- a/test/sys/bus/pci/drivers/e1000e/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/e1000e \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/ehci_hcd/module b/test/sys/bus/pci/drivers/ehci_hcd/module deleted file mode 120000 index 83e35c1f0f..0000000000 --- a/test/sys/bus/pci/drivers/ehci_hcd/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/ehci_hcd \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 b/test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 deleted file mode 120000 index 72d8419279..0000000000 --- a/test/sys/bus/pci/drivers/iwl3945/0000:03:00.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/iwl3945/module b/test/sys/bus/pci/drivers/iwl3945/module deleted file mode 120000 index 6688601419..0000000000 --- a/test/sys/bus/pci/drivers/iwl3945/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/iwl3945 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:01.0 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:01.0 deleted file mode 120000 index 8b79fc7c87..0000000000 --- a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:01.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:01.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.0 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.0 deleted file mode 120000 index a703b2272a..0000000000 --- a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1c.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.1 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.1 deleted file mode 120000 index 47e7f793da..0000000000 --- a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1c.1 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.2 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.2 deleted file mode 120000 index 93e3907d51..0000000000 --- a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.2 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1c.2 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.3 b/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.3 deleted file mode 120000 index 865098bd43..0000000000 --- a/test/sys/bus/pci/drivers/pcieport-driver/0000:00:1c.3 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1c.3 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 deleted file mode 120000 index 824ea3dc92..0000000000 --- a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 deleted file mode 120000 index 051d270749..0000000000 --- a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.1 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 deleted file mode 120000 index 92476e3c24..0000000000 --- a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.2 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.2 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 b/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 deleted file mode 120000 index d8bb384d34..0000000000 --- a/test/sys/bus/pci/drivers/uhci_hcd/0000:00:1d.3 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.3 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/uhci_hcd/module b/test/sys/bus/pci/drivers/uhci_hcd/module deleted file mode 120000 index 4247875342..0000000000 --- a/test/sys/bus/pci/drivers/uhci_hcd/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/uhci_hcd \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 b/test/sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 deleted file mode 120000 index 7cc48e0eba..0000000000 --- a/test/sys/bus/pci/drivers/yenta_cardbus/0000:15:00.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1e.0/0000:15:00.0 \ No newline at end of file diff --git a/test/sys/bus/pci/drivers/yenta_cardbus/module b/test/sys/bus/pci/drivers/yenta_cardbus/module deleted file mode 120000 index 7a24f4085f..0000000000 --- a/test/sys/bus/pci/drivers/yenta_cardbus/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/yenta_socket \ No newline at end of file diff --git a/test/sys/bus/pci/drivers_autoprobe b/test/sys/bus/pci/drivers_autoprobe deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/bus/pci/drivers_autoprobe +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/bus/pci_express/devices/0000:00:01.0:pcie00 b/test/sys/bus/pci_express/devices/0000:00:01.0:pcie00 deleted file mode 120000 index 945332b73a..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:01.0:pcie00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:01.0:pcie03 b/test/sys/bus/pci_express/devices/0000:00:01.0:pcie03 deleted file mode 120000 index 3ebf398e1e..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:01.0:pcie03 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie00 b/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie00 deleted file mode 120000 index 4777498937..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie02 b/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie02 deleted file mode 120000 index 8f59adaaab..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie02 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie03 b/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie03 deleted file mode 120000 index 4266e50530..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.0:pcie03 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie00 b/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie00 deleted file mode 120000 index 7123598c22..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie02 b/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie02 deleted file mode 120000 index 4bbde954cd..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie02 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie03 b/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie03 deleted file mode 120000 index d3fc20fe81..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.1:pcie03 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie00 b/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie00 deleted file mode 120000 index 05b3c4df71..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie02 b/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie02 deleted file mode 120000 index f235cf5eae..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie02 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie03 b/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie03 deleted file mode 120000 index a1787ad63a..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.2:pcie03 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie00 b/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie00 deleted file mode 120000 index a9b5b8739c..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie02 b/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie02 deleted file mode 120000 index a1901b3841..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie02 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02 \ No newline at end of file diff --git a/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie03 b/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie03 deleted file mode 120000 index 8d8c037879..0000000000 --- a/test/sys/bus/pci_express/devices/0000:00:1c.3:pcie03 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03 \ No newline at end of file diff --git a/test/sys/bus/pci_express/drivers_autoprobe b/test/sys/bus/pci_express/drivers_autoprobe deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/bus/pci_express/drivers_autoprobe +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/bus/pcmcia/drivers_autoprobe b/test/sys/bus/pcmcia/drivers_autoprobe deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/bus/pcmcia/drivers_autoprobe +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/bus/platform/devices/dock.0 b/test/sys/bus/platform/devices/dock.0 deleted file mode 120000 index ba96de30eb..0000000000 --- a/test/sys/bus/platform/devices/dock.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/dock.0 \ No newline at end of file diff --git a/test/sys/bus/platform/devices/i8042 b/test/sys/bus/platform/devices/i8042 deleted file mode 120000 index 4fee324a4d..0000000000 --- a/test/sys/bus/platform/devices/i8042 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/i8042 \ No newline at end of file diff --git a/test/sys/bus/platform/devices/microcode b/test/sys/bus/platform/devices/microcode deleted file mode 120000 index e50f32c632..0000000000 --- a/test/sys/bus/platform/devices/microcode +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/microcode \ No newline at end of file diff --git a/test/sys/bus/platform/devices/pcspkr b/test/sys/bus/platform/devices/pcspkr deleted file mode 120000 index 079eeb0347..0000000000 --- a/test/sys/bus/platform/devices/pcspkr +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/pcspkr \ No newline at end of file diff --git a/test/sys/bus/platform/devices/serial8250 b/test/sys/bus/platform/devices/serial8250 deleted file mode 120000 index 5594bc91f6..0000000000 --- a/test/sys/bus/platform/devices/serial8250 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/serial8250 \ No newline at end of file diff --git a/test/sys/bus/platform/devices/thinkpad_acpi b/test/sys/bus/platform/devices/thinkpad_acpi deleted file mode 120000 index 8011e89c2c..0000000000 --- a/test/sys/bus/platform/devices/thinkpad_acpi +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/bus/platform/devices/thinkpad_hwmon b/test/sys/bus/platform/devices/thinkpad_hwmon deleted file mode 120000 index 3dd92bd52c..0000000000 --- a/test/sys/bus/platform/devices/thinkpad_hwmon +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/bus/platform/devices/vesafb.0 b/test/sys/bus/platform/devices/vesafb.0 deleted file mode 120000 index ef6c547a1f..0000000000 --- a/test/sys/bus/platform/devices/vesafb.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/vesafb.0 \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/i8042/i8042 b/test/sys/bus/platform/drivers/i8042/i8042 deleted file mode 120000 index 7c99115f6f..0000000000 --- a/test/sys/bus/platform/drivers/i8042/i8042 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/platform/i8042 \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/pcspkr/module b/test/sys/bus/platform/drivers/pcspkr/module deleted file mode 120000 index 8649c737fb..0000000000 --- a/test/sys/bus/platform/drivers/pcspkr/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/pcspkr \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/pcspkr/pcspkr b/test/sys/bus/platform/drivers/pcspkr/pcspkr deleted file mode 120000 index 925b9c6238..0000000000 --- a/test/sys/bus/platform/drivers/pcspkr/pcspkr +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/platform/pcspkr \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/serial8250/serial8250 b/test/sys/bus/platform/drivers/serial8250/serial8250 deleted file mode 120000 index 5676a20b4c..0000000000 --- a/test/sys/bus/platform/drivers/serial8250/serial8250 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/platform/serial8250 \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/debug_level b/test/sys/bus/platform/drivers/thinkpad_acpi/debug_level deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_acpi/debug_level +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/interface_version b/test/sys/bus/platform/drivers/thinkpad_acpi/interface_version deleted file mode 100644 index 8b33f3d20a..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_acpi/interface_version +++ /dev/null @@ -1 +0,0 @@ -0x00020200 diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/module b/test/sys/bus/platform/drivers/thinkpad_acpi/module deleted file mode 120000 index f95fa91132..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_acpi/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi b/test/sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi deleted file mode 120000 index 3f34d607bf..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_acpi/thinkpad_acpi +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/platform/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_acpi/version b/test/sys/bus/platform/drivers/thinkpad_acpi/version deleted file mode 100644 index 6c2f139f6e..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_acpi/version +++ /dev/null @@ -1 +0,0 @@ -ThinkPad ACPI Extras v0.21 diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/debug_level b/test/sys/bus/platform/drivers/thinkpad_hwmon/debug_level deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_hwmon/debug_level +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/fan_watchdog b/test/sys/bus/platform/drivers/thinkpad_hwmon/fan_watchdog deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_hwmon/fan_watchdog +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/interface_version b/test/sys/bus/platform/drivers/thinkpad_hwmon/interface_version deleted file mode 100644 index 8b33f3d20a..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_hwmon/interface_version +++ /dev/null @@ -1 +0,0 @@ -0x00020200 diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/module b/test/sys/bus/platform/drivers/thinkpad_hwmon/module deleted file mode 120000 index f95fa91132..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_hwmon/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/thinkpad_hwmon b/test/sys/bus/platform/drivers/thinkpad_hwmon/thinkpad_hwmon deleted file mode 120000 index 3ca5d914ea..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_hwmon/thinkpad_hwmon +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/platform/thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/bus/platform/drivers/thinkpad_hwmon/version b/test/sys/bus/platform/drivers/thinkpad_hwmon/version deleted file mode 100644 index 6c2f139f6e..0000000000 --- a/test/sys/bus/platform/drivers/thinkpad_hwmon/version +++ /dev/null @@ -1 +0,0 @@ -ThinkPad ACPI Extras v0.21 diff --git a/test/sys/bus/platform/drivers/vesafb/vesafb.0 b/test/sys/bus/platform/drivers/vesafb/vesafb.0 deleted file mode 120000 index 13a9757d51..0000000000 --- a/test/sys/bus/platform/drivers/vesafb/vesafb.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/platform/vesafb.0 \ No newline at end of file diff --git a/test/sys/bus/platform/drivers_autoprobe b/test/sys/bus/platform/drivers_autoprobe deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/bus/platform/drivers_autoprobe +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/bus/pnp/devices/00:00 b/test/sys/bus/pnp/devices/00:00 deleted file mode 120000 index 88949d8171..0000000000 --- a/test/sys/bus/pnp/devices/00:00 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:00 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:01 b/test/sys/bus/pnp/devices/00:01 deleted file mode 120000 index 20683ec26f..0000000000 --- a/test/sys/bus/pnp/devices/00:01 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:01 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:02 b/test/sys/bus/pnp/devices/00:02 deleted file mode 120000 index 74708dbb0e..0000000000 --- a/test/sys/bus/pnp/devices/00:02 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:02 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:03 b/test/sys/bus/pnp/devices/00:03 deleted file mode 120000 index 3fd5bed66f..0000000000 --- a/test/sys/bus/pnp/devices/00:03 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:03 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:04 b/test/sys/bus/pnp/devices/00:04 deleted file mode 120000 index 4721b90121..0000000000 --- a/test/sys/bus/pnp/devices/00:04 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:04 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:05 b/test/sys/bus/pnp/devices/00:05 deleted file mode 120000 index 5fe11eac2f..0000000000 --- a/test/sys/bus/pnp/devices/00:05 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:05 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:06 b/test/sys/bus/pnp/devices/00:06 deleted file mode 120000 index 7ab8959018..0000000000 --- a/test/sys/bus/pnp/devices/00:06 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:06 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:07 b/test/sys/bus/pnp/devices/00:07 deleted file mode 120000 index e8c3f4adfe..0000000000 --- a/test/sys/bus/pnp/devices/00:07 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:07 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:08 b/test/sys/bus/pnp/devices/00:08 deleted file mode 120000 index 0e99de9576..0000000000 --- a/test/sys/bus/pnp/devices/00:08 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:08 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:09 b/test/sys/bus/pnp/devices/00:09 deleted file mode 120000 index 5ecf7dd1f5..0000000000 --- a/test/sys/bus/pnp/devices/00:09 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:09 \ No newline at end of file diff --git a/test/sys/bus/pnp/devices/00:0a b/test/sys/bus/pnp/devices/00:0a deleted file mode 120000 index 1413e4e6f1..0000000000 --- a/test/sys/bus/pnp/devices/00:0a +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pnp0/00:0a \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/i8042 aux/00:09 b/test/sys/bus/pnp/drivers/i8042 aux/00:09 deleted file mode 120000 index 813b86fef7..0000000000 --- a/test/sys/bus/pnp/drivers/i8042 aux/00:09 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pnp0/00:09 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/i8042 kbd/00:08 b/test/sys/bus/pnp/drivers/i8042 kbd/00:08 deleted file mode 120000 index 2de3b7687c..0000000000 --- a/test/sys/bus/pnp/drivers/i8042 kbd/00:08 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pnp0/00:08 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/rtc_cmos/00:07 b/test/sys/bus/pnp/drivers/rtc_cmos/00:07 deleted file mode 120000 index a38b961a92..0000000000 --- a/test/sys/bus/pnp/drivers/rtc_cmos/00:07 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pnp0/00:07 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/system/00:00 b/test/sys/bus/pnp/drivers/system/00:00 deleted file mode 120000 index dce9928428..0000000000 --- a/test/sys/bus/pnp/drivers/system/00:00 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pnp0/00:00 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers/system/00:02 b/test/sys/bus/pnp/drivers/system/00:02 deleted file mode 120000 index 2cf747c575..0000000000 --- a/test/sys/bus/pnp/drivers/system/00:02 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pnp0/00:02 \ No newline at end of file diff --git a/test/sys/bus/pnp/drivers_autoprobe b/test/sys/bus/pnp/drivers_autoprobe deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/bus/pnp/drivers_autoprobe +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/bus/scsi/devices/0:0:0:0 b/test/sys/bus/scsi/devices/0:0:0:0 deleted file mode 120000 index f6a756b526..0000000000 --- a/test/sys/bus/scsi/devices/0:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/4:0:0:0 b/test/sys/bus/scsi/devices/4:0:0:0 deleted file mode 120000 index ae0b657fec..0000000000 --- a/test/sys/bus/scsi/devices/4:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/7:0:0:0 b/test/sys/bus/scsi/devices/7:0:0:0 deleted file mode 120000 index 772a4f0841..0000000000 --- a/test/sys/bus/scsi/devices/7:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host0 b/test/sys/bus/scsi/devices/host0 deleted file mode 120000 index 7e2e99d988..0000000000 --- a/test/sys/bus/scsi/devices/host0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.2/host0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host1 b/test/sys/bus/scsi/devices/host1 deleted file mode 120000 index e612bbf10b..0000000000 --- a/test/sys/bus/scsi/devices/host1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.2/host1 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host2 b/test/sys/bus/scsi/devices/host2 deleted file mode 120000 index 41f9a48737..0000000000 --- a/test/sys/bus/scsi/devices/host2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.2/host2 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host3 b/test/sys/bus/scsi/devices/host3 deleted file mode 120000 index 97243474e9..0000000000 --- a/test/sys/bus/scsi/devices/host3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.2/host3 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host4 b/test/sys/bus/scsi/devices/host4 deleted file mode 120000 index 7d38a6f412..0000000000 --- a/test/sys/bus/scsi/devices/host4 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.1/host4 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host5 b/test/sys/bus/scsi/devices/host5 deleted file mode 120000 index 436466adbc..0000000000 --- a/test/sys/bus/scsi/devices/host5 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.1/host5 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/host7 b/test/sys/bus/scsi/devices/host7 deleted file mode 120000 index 4de41d6158..0000000000 --- a/test/sys/bus/scsi/devices/host7 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/target0:0:0 b/test/sys/bus/scsi/devices/target0:0:0 deleted file mode 120000 index 91ff550d7a..0000000000 --- a/test/sys/bus/scsi/devices/target0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/target4:0:0 b/test/sys/bus/scsi/devices/target4:0:0 deleted file mode 120000 index de9abe2a0f..0000000000 --- a/test/sys/bus/scsi/devices/target4:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/devices/target7:0:0 b/test/sys/bus/scsi/devices/target7:0:0 deleted file mode 120000 index 982ab348ce..0000000000 --- a/test/sys/bus/scsi/devices/target7:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/0:0:0:0 b/test/sys/bus/scsi/drivers/sd/0:0:0:0 deleted file mode 120000 index 6a5b5a1a15..0000000000 --- a/test/sys/bus/scsi/drivers/sd/0:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sd/7:0:0:0 b/test/sys/bus/scsi/drivers/sd/7:0:0:0 deleted file mode 120000 index 025591cd47..0000000000 --- a/test/sys/bus/scsi/drivers/sd/7:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers/sr/4:0:0:0 b/test/sys/bus/scsi/drivers/sr/4:0:0:0 deleted file mode 120000 index 2ceb4f67e3..0000000000 --- a/test/sys/bus/scsi/drivers/sr/4:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0 \ No newline at end of file diff --git a/test/sys/bus/scsi/drivers_autoprobe b/test/sys/bus/scsi/drivers_autoprobe deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/bus/scsi/drivers_autoprobe +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/bus/serio/devices/serio0 b/test/sys/bus/serio/devices/serio0 deleted file mode 120000 index 9cea974c79..0000000000 --- a/test/sys/bus/serio/devices/serio0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/i8042/serio0 \ No newline at end of file diff --git a/test/sys/bus/serio/devices/serio1 b/test/sys/bus/serio/devices/serio1 deleted file mode 120000 index d6538384c0..0000000000 --- a/test/sys/bus/serio/devices/serio1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/platform/i8042/serio1 \ No newline at end of file diff --git a/test/sys/bus/serio/drivers/atkbd/bind_mode b/test/sys/bus/serio/drivers/atkbd/bind_mode deleted file mode 100644 index 865faf10cb..0000000000 --- a/test/sys/bus/serio/drivers/atkbd/bind_mode +++ /dev/null @@ -1 +0,0 @@ -auto diff --git a/test/sys/bus/serio/drivers/atkbd/description b/test/sys/bus/serio/drivers/atkbd/description deleted file mode 100644 index 15ba15d8c2..0000000000 --- a/test/sys/bus/serio/drivers/atkbd/description +++ /dev/null @@ -1 +0,0 @@ -AT and PS/2 keyboard driver diff --git a/test/sys/bus/serio/drivers/atkbd/module b/test/sys/bus/serio/drivers/atkbd/module deleted file mode 120000 index 358061bdce..0000000000 --- a/test/sys/bus/serio/drivers/atkbd/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/atkbd \ No newline at end of file diff --git a/test/sys/bus/serio/drivers/atkbd/serio0 b/test/sys/bus/serio/drivers/atkbd/serio0 deleted file mode 120000 index bca0d4a0ad..0000000000 --- a/test/sys/bus/serio/drivers/atkbd/serio0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/platform/i8042/serio0 \ No newline at end of file diff --git a/test/sys/bus/serio/drivers/psmouse/bind_mode b/test/sys/bus/serio/drivers/psmouse/bind_mode deleted file mode 100644 index 865faf10cb..0000000000 --- a/test/sys/bus/serio/drivers/psmouse/bind_mode +++ /dev/null @@ -1 +0,0 @@ -auto diff --git a/test/sys/bus/serio/drivers/psmouse/description b/test/sys/bus/serio/drivers/psmouse/description deleted file mode 100644 index ed4368fb01..0000000000 --- a/test/sys/bus/serio/drivers/psmouse/description +++ /dev/null @@ -1 +0,0 @@ -PS/2 mouse driver diff --git a/test/sys/bus/serio/drivers/psmouse/module b/test/sys/bus/serio/drivers/psmouse/module deleted file mode 120000 index d2a4e172b0..0000000000 --- a/test/sys/bus/serio/drivers/psmouse/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/psmouse \ No newline at end of file diff --git a/test/sys/bus/serio/drivers/psmouse/serio1 b/test/sys/bus/serio/drivers/psmouse/serio1 deleted file mode 120000 index b6cf321d27..0000000000 --- a/test/sys/bus/serio/drivers/psmouse/serio1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/platform/i8042/serio1 \ No newline at end of file diff --git a/test/sys/bus/serio/drivers_autoprobe b/test/sys/bus/serio/drivers_autoprobe deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/bus/serio/drivers_autoprobe +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/bus/usb/devices/1-0:1.0 b/test/sys/bus/usb/devices/1-0:1.0 deleted file mode 120000 index accc4df554..0000000000 --- a/test/sys/bus/usb/devices/1-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/2-0:1.0 b/test/sys/bus/usb/devices/2-0:1.0 deleted file mode 120000 index c9569dacc9..0000000000 --- a/test/sys/bus/usb/devices/2-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-0:1.0 b/test/sys/bus/usb/devices/3-0:1.0 deleted file mode 120000 index 97b545f5c0..0000000000 --- a/test/sys/bus/usb/devices/3-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1 b/test/sys/bus/usb/devices/3-1 deleted file mode 120000 index d387bcd81f..0000000000 --- a/test/sys/bus/usb/devices/3-1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.2/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/3-1:1.0 b/test/sys/bus/usb/devices/3-1:1.0 deleted file mode 120000 index 446d9ce45a..0000000000 --- a/test/sys/bus/usb/devices/3-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-0:1.0 b/test/sys/bus/usb/devices/4-0:1.0 deleted file mode 120000 index 1b44614ae1..0000000000 --- a/test/sys/bus/usb/devices/4-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1 b/test/sys/bus/usb/devices/4-1 deleted file mode 120000 index 164351ec36..0000000000 --- a/test/sys/bus/usb/devices/4-1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1:1.0 b/test/sys/bus/usb/devices/4-1:1.0 deleted file mode 120000 index 154e43cc22..0000000000 --- a/test/sys/bus/usb/devices/4-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1:1.1 b/test/sys/bus/usb/devices/4-1:1.1 deleted file mode 120000 index 50d0764b22..0000000000 --- a/test/sys/bus/usb/devices/4-1:1.1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1:1.2 b/test/sys/bus/usb/devices/4-1:1.2 deleted file mode 120000 index e8694cf789..0000000000 --- a/test/sys/bus/usb/devices/4-1:1.2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-1:1.3 b/test/sys/bus/usb/devices/4-1:1.3 deleted file mode 120000 index 25795b6dc0..0000000000 --- a/test/sys/bus/usb/devices/4-1:1.3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-2 b/test/sys/bus/usb/devices/4-2 deleted file mode 120000 index 9fa9e07faa..0000000000 --- a/test/sys/bus/usb/devices/4-2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3/usb4/4-2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/4-2:1.0 b/test/sys/bus/usb/devices/4-2:1.0 deleted file mode 120000 index 1b0c1a9ebc..0000000000 --- a/test/sys/bus/usb/devices/4-2:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-0:1.0 b/test/sys/bus/usb/devices/5-0:1.0 deleted file mode 120000 index de3fbb26f5..0000000000 --- a/test/sys/bus/usb/devices/5-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1 b/test/sys/bus/usb/devices/5-1 deleted file mode 120000 index 69e88ccf21..0000000000 --- a/test/sys/bus/usb/devices/5-1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-1:1.0 b/test/sys/bus/usb/devices/5-1:1.0 deleted file mode 120000 index f0ea70d8a4..0000000000 --- a/test/sys/bus/usb/devices/5-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2 b/test/sys/bus/usb/devices/5-2 deleted file mode 120000 index 9425fc82b1..0000000000 --- a/test/sys/bus/usb/devices/5-2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.0 b/test/sys/bus/usb/devices/5-2:1.0 deleted file mode 120000 index a2b7214a0e..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.1 b/test/sys/bus/usb/devices/5-2:1.1 deleted file mode 120000 index 4507a84959..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.10 b/test/sys/bus/usb/devices/5-2:1.10 deleted file mode 120000 index 64c3c49552..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.10 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.11 b/test/sys/bus/usb/devices/5-2:1.11 deleted file mode 120000 index 7a6f8fd6a7..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.11 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.12 b/test/sys/bus/usb/devices/5-2:1.12 deleted file mode 120000 index d8a97f48bd..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.12 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.13 b/test/sys/bus/usb/devices/5-2:1.13 deleted file mode 120000 index b7ca9e713c..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.13 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.2 b/test/sys/bus/usb/devices/5-2:1.2 deleted file mode 120000 index 9b5fdba2d0..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.3 b/test/sys/bus/usb/devices/5-2:1.3 deleted file mode 120000 index 470433c456..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.4 b/test/sys/bus/usb/devices/5-2:1.4 deleted file mode 120000 index 512faa9fef..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.4 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.5 b/test/sys/bus/usb/devices/5-2:1.5 deleted file mode 120000 index 4a3bf6cab8..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.5 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.6 b/test/sys/bus/usb/devices/5-2:1.6 deleted file mode 120000 index 091b27c11a..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.6 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/5-2:1.9 b/test/sys/bus/usb/devices/5-2:1.9 deleted file mode 120000 index 66ae2e529c..0000000000 --- a/test/sys/bus/usb/devices/5-2:1.9 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb1 b/test/sys/bus/usb/devices/usb1 deleted file mode 120000 index febdf43da9..0000000000 --- a/test/sys/bus/usb/devices/usb1 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.0/usb1 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb2 b/test/sys/bus/usb/devices/usb2 deleted file mode 120000 index a016fbd3f5..0000000000 --- a/test/sys/bus/usb/devices/usb2 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.1/usb2 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb3 b/test/sys/bus/usb/devices/usb3 deleted file mode 120000 index 83afcc385d..0000000000 --- a/test/sys/bus/usb/devices/usb3 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.2/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb4 b/test/sys/bus/usb/devices/usb4 deleted file mode 120000 index a144d15318..0000000000 --- a/test/sys/bus/usb/devices/usb4 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.3/usb4 \ No newline at end of file diff --git a/test/sys/bus/usb/devices/usb5 b/test/sys/bus/usb/devices/usb5 deleted file mode 120000 index f147fe5e2f..0000000000 --- a/test/sys/bus/usb/devices/usb5 +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1d.7/usb5 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 b/test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 deleted file mode 120000 index f41d924d48..0000000000 --- a/test/sys/bus/usb/drivers/cdc_acm/5-2:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 b/test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 deleted file mode 120000 index 7de556c1ab..0000000000 --- a/test/sys/bus/usb/drivers/cdc_acm/5-2:1.1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/cdc_acm/module b/test/sys/bus/usb/drivers/cdc_acm/module deleted file mode 120000 index 95ffe94c2c..0000000000 --- a/test/sys/bus/usb/drivers/cdc_acm/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/cdc_acm \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/1-0:1.0 b/test/sys/bus/usb/drivers/hub/1-0:1.0 deleted file mode 120000 index 5c0e29abba..0000000000 --- a/test/sys/bus/usb/drivers/hub/1-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/2-0:1.0 b/test/sys/bus/usb/drivers/hub/2-0:1.0 deleted file mode 120000 index 34d75f3d41..0000000000 --- a/test/sys/bus/usb/drivers/hub/2-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/3-0:1.0 b/test/sys/bus/usb/drivers/hub/3-0:1.0 deleted file mode 120000 index 7869f4257d..0000000000 --- a/test/sys/bus/usb/drivers/hub/3-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/4-0:1.0 b/test/sys/bus/usb/drivers/hub/4-0:1.0 deleted file mode 120000 index c5f7fd15a8..0000000000 --- a/test/sys/bus/usb/drivers/hub/4-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/5-0:1.0 b/test/sys/bus/usb/drivers/hub/5-0:1.0 deleted file mode 120000 index 77b3decca5..0000000000 --- a/test/sys/bus/usb/drivers/hub/5-0:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/hub/module b/test/sys/bus/usb/drivers/hub/module deleted file mode 120000 index d5a2f0734e..0000000000 --- a/test/sys/bus/usb/drivers/hub/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/usbcore \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb-storage/5-1:1.0 b/test/sys/bus/usb/drivers/usb-storage/5-1:1.0 deleted file mode 120000 index 68d13ef99f..0000000000 --- a/test/sys/bus/usb/drivers/usb-storage/5-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb-storage/module b/test/sys/bus/usb/drivers/usb-storage/module deleted file mode 120000 index 01f59943d5..0000000000 --- a/test/sys/bus/usb/drivers/usb-storage/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/usb_storage \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/3-1 b/test/sys/bus/usb/drivers/usb/3-1 deleted file mode 120000 index 421ad85757..0000000000 --- a/test/sys/bus/usb/drivers/usb/3-1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.2/usb3/3-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/4-1 b/test/sys/bus/usb/drivers/usb/4-1 deleted file mode 120000 index 8b427f8e43..0000000000 --- a/test/sys/bus/usb/drivers/usb/4-1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.3/usb4/4-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/4-2 b/test/sys/bus/usb/drivers/usb/4-2 deleted file mode 120000 index 552bf837f4..0000000000 --- a/test/sys/bus/usb/drivers/usb/4-2 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.3/usb4/4-2 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/5-1 b/test/sys/bus/usb/drivers/usb/5-1 deleted file mode 120000 index 0ee91d5361..0000000000 --- a/test/sys/bus/usb/drivers/usb/5-1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/5-2 b/test/sys/bus/usb/drivers/usb/5-2 deleted file mode 120000 index 330c5cdba2..0000000000 --- a/test/sys/bus/usb/drivers/usb/5-2 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5/5-2 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/module b/test/sys/bus/usb/drivers/usb/module deleted file mode 120000 index d5a2f0734e..0000000000 --- a/test/sys/bus/usb/drivers/usb/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/usbcore \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb1 b/test/sys/bus/usb/drivers/usb/usb1 deleted file mode 120000 index 27deaa5572..0000000000 --- a/test/sys/bus/usb/drivers/usb/usb1 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.0/usb1 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb2 b/test/sys/bus/usb/drivers/usb/usb2 deleted file mode 120000 index 2cc69486b0..0000000000 --- a/test/sys/bus/usb/drivers/usb/usb2 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.1/usb2 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb3 b/test/sys/bus/usb/drivers/usb/usb3 deleted file mode 120000 index 6217ac2038..0000000000 --- a/test/sys/bus/usb/drivers/usb/usb3 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.2/usb3 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb4 b/test/sys/bus/usb/drivers/usb/usb4 deleted file mode 120000 index 55886bf07d..0000000000 --- a/test/sys/bus/usb/drivers/usb/usb4 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.3/usb4 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usb/usb5 b/test/sys/bus/usb/drivers/usb/usb5 deleted file mode 120000 index c3d8216a47..0000000000 --- a/test/sys/bus/usb/drivers/usb/usb5 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.7/usb5 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usbfs/module b/test/sys/bus/usb/drivers/usbfs/module deleted file mode 120000 index d5a2f0734e..0000000000 --- a/test/sys/bus/usb/drivers/usbfs/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/usbcore \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usbhid/3-1:1.0 b/test/sys/bus/usb/drivers/usbhid/3-1:1.0 deleted file mode 120000 index 620e5846d8..0000000000 --- a/test/sys/bus/usb/drivers/usbhid/3-1:1.0 +++ /dev/null @@ -1 +0,0 @@ -../../../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0 \ No newline at end of file diff --git a/test/sys/bus/usb/drivers/usbhid/module b/test/sys/bus/usb/drivers/usbhid/module deleted file mode 120000 index 6afe48340c..0000000000 --- a/test/sys/bus/usb/drivers/usbhid/module +++ /dev/null @@ -1 +0,0 @@ -../../../../module/usbhid \ No newline at end of file diff --git a/test/sys/bus/usb/drivers_autoprobe b/test/sys/bus/usb/drivers_autoprobe deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/bus/usb/drivers_autoprobe +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/class/bdi/0:16 b/test/sys/class/bdi/0:16 deleted file mode 120000 index b3da1ea4a4..0000000000 --- a/test/sys/class/bdi/0:16 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/0:16 \ No newline at end of file diff --git a/test/sys/class/bdi/11:0 b/test/sys/class/bdi/11:0 deleted file mode 120000 index 51f50263c5..0000000000 --- a/test/sys/class/bdi/11:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/11:0 \ No newline at end of file diff --git a/test/sys/class/bdi/7:0 b/test/sys/class/bdi/7:0 deleted file mode 120000 index d9cb5b7f8d..0000000000 --- a/test/sys/class/bdi/7:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/7:0 \ No newline at end of file diff --git a/test/sys/class/bdi/7:1 b/test/sys/class/bdi/7:1 deleted file mode 120000 index 2f9a127483..0000000000 --- a/test/sys/class/bdi/7:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/7:1 \ No newline at end of file diff --git a/test/sys/class/bdi/7:2 b/test/sys/class/bdi/7:2 deleted file mode 120000 index d311db60ee..0000000000 --- a/test/sys/class/bdi/7:2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/7:2 \ No newline at end of file diff --git a/test/sys/class/bdi/7:3 b/test/sys/class/bdi/7:3 deleted file mode 120000 index a0b3d465c6..0000000000 --- a/test/sys/class/bdi/7:3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/7:3 \ No newline at end of file diff --git a/test/sys/class/bdi/7:4 b/test/sys/class/bdi/7:4 deleted file mode 120000 index 7f69348297..0000000000 --- a/test/sys/class/bdi/7:4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/7:4 \ No newline at end of file diff --git a/test/sys/class/bdi/7:5 b/test/sys/class/bdi/7:5 deleted file mode 120000 index 47fe1f649a..0000000000 --- a/test/sys/class/bdi/7:5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/7:5 \ No newline at end of file diff --git a/test/sys/class/bdi/7:6 b/test/sys/class/bdi/7:6 deleted file mode 120000 index 4e71e037da..0000000000 --- a/test/sys/class/bdi/7:6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/7:6 \ No newline at end of file diff --git a/test/sys/class/bdi/7:7 b/test/sys/class/bdi/7:7 deleted file mode 120000 index dae22b2f33..0000000000 --- a/test/sys/class/bdi/7:7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/7:7 \ No newline at end of file diff --git a/test/sys/class/bdi/8:0 b/test/sys/class/bdi/8:0 deleted file mode 120000 index afb0584c55..0000000000 --- a/test/sys/class/bdi/8:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/8:0 \ No newline at end of file diff --git a/test/sys/class/bdi/8:16 b/test/sys/class/bdi/8:16 deleted file mode 120000 index 41f616c9db..0000000000 --- a/test/sys/class/bdi/8:16 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/8:16 \ No newline at end of file diff --git a/test/sys/class/bdi/9:0 b/test/sys/class/bdi/9:0 deleted file mode 120000 index 996f542c17..0000000000 --- a/test/sys/class/bdi/9:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/9:0 \ No newline at end of file diff --git a/test/sys/class/bdi/default b/test/sys/class/bdi/default deleted file mode 120000 index 3bf98bde0d..0000000000 --- a/test/sys/class/bdi/default +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/bdi/default \ No newline at end of file diff --git a/test/sys/class/block/loop0 b/test/sys/class/block/loop0 deleted file mode 120000 index 86a5878d7d..0000000000 --- a/test/sys/class/block/loop0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop0 \ No newline at end of file diff --git a/test/sys/class/block/loop1 b/test/sys/class/block/loop1 deleted file mode 120000 index 97476753e1..0000000000 --- a/test/sys/class/block/loop1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop1 \ No newline at end of file diff --git a/test/sys/class/block/loop2 b/test/sys/class/block/loop2 deleted file mode 120000 index 5fc0d7dd11..0000000000 --- a/test/sys/class/block/loop2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop2 \ No newline at end of file diff --git a/test/sys/class/block/loop3 b/test/sys/class/block/loop3 deleted file mode 120000 index a6d7b89dea..0000000000 --- a/test/sys/class/block/loop3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop3 \ No newline at end of file diff --git a/test/sys/class/block/loop4 b/test/sys/class/block/loop4 deleted file mode 120000 index 71386cbfd8..0000000000 --- a/test/sys/class/block/loop4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop4 \ No newline at end of file diff --git a/test/sys/class/block/loop5 b/test/sys/class/block/loop5 deleted file mode 120000 index af83a27367..0000000000 --- a/test/sys/class/block/loop5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop5 \ No newline at end of file diff --git a/test/sys/class/block/loop6 b/test/sys/class/block/loop6 deleted file mode 120000 index efdbd9532a..0000000000 --- a/test/sys/class/block/loop6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop6 \ No newline at end of file diff --git a/test/sys/class/block/loop7 b/test/sys/class/block/loop7 deleted file mode 120000 index 7a6d7e4aac..0000000000 --- a/test/sys/class/block/loop7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop7 \ No newline at end of file diff --git a/test/sys/class/block/md0 b/test/sys/class/block/md0 deleted file mode 120000 index 2072a2f60f..0000000000 --- a/test/sys/class/block/md0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/md0 \ No newline at end of file diff --git a/test/sys/class/block/sda b/test/sys/class/block/sda deleted file mode 120000 index 7ecaff1132..0000000000 --- a/test/sys/class/block/sda +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda \ No newline at end of file diff --git a/test/sys/class/block/sda1 b/test/sys/class/block/sda1 deleted file mode 120000 index 18dc11fc29..0000000000 --- a/test/sys/class/block/sda1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1 \ No newline at end of file diff --git a/test/sys/class/block/sda10 b/test/sys/class/block/sda10 deleted file mode 120000 index d64a8257ae..0000000000 --- a/test/sys/class/block/sda10 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10 \ No newline at end of file diff --git a/test/sys/class/block/sda5 b/test/sys/class/block/sda5 deleted file mode 120000 index d7bd5661cf..0000000000 --- a/test/sys/class/block/sda5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5 \ No newline at end of file diff --git a/test/sys/class/block/sda6 b/test/sys/class/block/sda6 deleted file mode 120000 index 2b13ee8459..0000000000 --- a/test/sys/class/block/sda6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6 \ No newline at end of file diff --git a/test/sys/class/block/sda7 b/test/sys/class/block/sda7 deleted file mode 120000 index d8b862667f..0000000000 --- a/test/sys/class/block/sda7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7 \ No newline at end of file diff --git a/test/sys/class/block/sda8 b/test/sys/class/block/sda8 deleted file mode 120000 index 34923aae6d..0000000000 --- a/test/sys/class/block/sda8 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8 \ No newline at end of file diff --git a/test/sys/class/block/sda9 b/test/sys/class/block/sda9 deleted file mode 120000 index 4b108b2336..0000000000 --- a/test/sys/class/block/sda9 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9 \ No newline at end of file diff --git a/test/sys/class/block/sdb b/test/sys/class/block/sdb deleted file mode 120000 index f588ad7926..0000000000 --- a/test/sys/class/block/sdb +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb \ No newline at end of file diff --git a/test/sys/class/block/sdb1 b/test/sys/class/block/sdb1 deleted file mode 120000 index 02be95389e..0000000000 --- a/test/sys/class/block/sdb1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1 \ No newline at end of file diff --git a/test/sys/class/block/sr0 b/test/sys/class/block/sr0 deleted file mode 120000 index 4d1c248a3c..0000000000 --- a/test/sys/class/block/sr0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0 \ No newline at end of file diff --git a/test/sys/class/bsg/0:0:0:0 b/test/sys/class/bsg/0:0:0:0 deleted file mode 120000 index 00f1c6aef9..0000000000 --- a/test/sys/class/bsg/0:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 \ No newline at end of file diff --git a/test/sys/class/bsg/4:0:0:0 b/test/sys/class/bsg/4:0:0:0 deleted file mode 120000 index 805fed84d2..0000000000 --- a/test/sys/class/bsg/4:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0 \ No newline at end of file diff --git a/test/sys/class/bsg/7:0:0:0 b/test/sys/class/bsg/7:0:0:0 deleted file mode 120000 index 7b5b2c882e..0000000000 --- a/test/sys/class/bsg/7:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0 \ No newline at end of file diff --git a/test/sys/class/dmi/id b/test/sys/class/dmi/id deleted file mode 120000 index 939f06e07c..0000000000 --- a/test/sys/class/dmi/id +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/dmi/id \ No newline at end of file diff --git a/test/sys/class/firmware/timeout b/test/sys/class/firmware/timeout deleted file mode 100644 index abdfb053e4..0000000000 --- a/test/sys/class/firmware/timeout +++ /dev/null @@ -1 +0,0 @@ -60 diff --git a/test/sys/class/graphics/fb0 b/test/sys/class/graphics/fb0 deleted file mode 120000 index 1944247bd4..0000000000 --- a/test/sys/class/graphics/fb0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/vesafb.0/graphics/fb0 \ No newline at end of file diff --git a/test/sys/class/graphics/fbcon b/test/sys/class/graphics/fbcon deleted file mode 120000 index 3a85c3bebf..0000000000 --- a/test/sys/class/graphics/fbcon +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/graphics/fbcon \ No newline at end of file diff --git a/test/sys/class/hwmon/hwmon0 b/test/sys/class/hwmon/hwmon0 deleted file mode 120000 index 035cf38190..0000000000 --- a/test/sys/class/hwmon/hwmon0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_hwmon/hwmon/hwmon0 \ No newline at end of file diff --git a/test/sys/class/ieee80211/phy0 b/test/sys/class/ieee80211/phy0 deleted file mode 120000 index 0b6cc2d6f6..0000000000 --- a/test/sys/class/ieee80211/phy0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0 \ No newline at end of file diff --git a/test/sys/class/input/event0 b/test/sys/class/input/event0 deleted file mode 120000 index d2d695f0b7..0000000000 --- a/test/sys/class/input/event0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/i8042/serio0/input/input0/event0 \ No newline at end of file diff --git a/test/sys/class/input/event1 b/test/sys/class/input/event1 deleted file mode 120000 index a4dcf8e11d..0000000000 --- a/test/sys/class/input/event1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/i8042/serio1/input/input1/event1 \ No newline at end of file diff --git a/test/sys/class/input/event2 b/test/sys/class/input/event2 deleted file mode 120000 index 5faad280d9..0000000000 --- a/test/sys/class/input/event2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/pcspkr/input/input2/event2 \ No newline at end of file diff --git a/test/sys/class/input/event3 b/test/sys/class/input/event3 deleted file mode 120000 index 65fdd24cfd..0000000000 --- a/test/sys/class/input/event3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3 \ No newline at end of file diff --git a/test/sys/class/input/event4 b/test/sys/class/input/event4 deleted file mode 120000 index 3bd330ffb8..0000000000 --- a/test/sys/class/input/event4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4 \ No newline at end of file diff --git a/test/sys/class/input/event5 b/test/sys/class/input/event5 deleted file mode 120000 index d60c233c11..0000000000 --- a/test/sys/class/input/event5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5 \ No newline at end of file diff --git a/test/sys/class/input/event6 b/test/sys/class/input/event6 deleted file mode 120000 index 581626ed43..0000000000 --- a/test/sys/class/input/event6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/input/input6/event6 \ No newline at end of file diff --git a/test/sys/class/input/event7 b/test/sys/class/input/event7 deleted file mode 120000 index a09790ab02..0000000000 --- a/test/sys/class/input/event7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7 \ No newline at end of file diff --git a/test/sys/class/input/input0 b/test/sys/class/input/input0 deleted file mode 120000 index 681d162216..0000000000 --- a/test/sys/class/input/input0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/i8042/serio0/input/input0 \ No newline at end of file diff --git a/test/sys/class/input/input1 b/test/sys/class/input/input1 deleted file mode 120000 index e7300b62a3..0000000000 --- a/test/sys/class/input/input1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/i8042/serio1/input/input1 \ No newline at end of file diff --git a/test/sys/class/input/input2 b/test/sys/class/input/input2 deleted file mode 120000 index 78641a6c94..0000000000 --- a/test/sys/class/input/input2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/pcspkr/input/input2 \ No newline at end of file diff --git a/test/sys/class/input/input3 b/test/sys/class/input/input3 deleted file mode 120000 index 2eaa003db1..0000000000 --- a/test/sys/class/input/input3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/LNXPWRBN:00/input/input3 \ No newline at end of file diff --git a/test/sys/class/input/input4 b/test/sys/class/input/input4 deleted file mode 120000 index 7d0a5a3208..0000000000 --- a/test/sys/class/input/input4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4 \ No newline at end of file diff --git a/test/sys/class/input/input5 b/test/sys/class/input/input5 deleted file mode 120000 index 815d79445b..0000000000 --- a/test/sys/class/input/input5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5 \ No newline at end of file diff --git a/test/sys/class/input/input6 b/test/sys/class/input/input6 deleted file mode 120000 index df5cd72332..0000000000 --- a/test/sys/class/input/input6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/input/input6 \ No newline at end of file diff --git a/test/sys/class/input/input8 b/test/sys/class/input/input8 deleted file mode 120000 index fe04976a38..0000000000 --- a/test/sys/class/input/input8 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8 \ No newline at end of file diff --git a/test/sys/class/input/mice b/test/sys/class/input/mice deleted file mode 120000 index 17e795b481..0000000000 --- a/test/sys/class/input/mice +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/input/mice \ No newline at end of file diff --git a/test/sys/class/input/mouse0 b/test/sys/class/input/mouse0 deleted file mode 120000 index 58db4cc7fa..0000000000 --- a/test/sys/class/input/mouse0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/i8042/serio1/input/input1/mouse0 \ No newline at end of file diff --git a/test/sys/class/input/mouse1 b/test/sys/class/input/mouse1 deleted file mode 120000 index 995db704ef..0000000000 --- a/test/sys/class/input/mouse1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1 \ No newline at end of file diff --git a/test/sys/class/leds/iwl-phy0:RX b/test/sys/class/leds/iwl-phy0:RX deleted file mode 120000 index 3e852657ea..0000000000 --- a/test/sys/class/leds/iwl-phy0:RX +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX \ No newline at end of file diff --git a/test/sys/class/leds/iwl-phy0:TX b/test/sys/class/leds/iwl-phy0:TX deleted file mode 120000 index 23bba069e8..0000000000 --- a/test/sys/class/leds/iwl-phy0:TX +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX \ No newline at end of file diff --git a/test/sys/class/leds/iwl-phy0:assoc b/test/sys/class/leds/iwl-phy0:assoc deleted file mode 120000 index c41f12aafc..0000000000 --- a/test/sys/class/leds/iwl-phy0:assoc +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc \ No newline at end of file diff --git a/test/sys/class/leds/iwl-phy0:radio b/test/sys/class/leds/iwl-phy0:radio deleted file mode 120000 index 7a62fa159f..0000000000 --- a/test/sys/class/leds/iwl-phy0:radio +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::bay_active b/test/sys/class/leds/tpacpi::bay_active deleted file mode 120000 index 4553847f29..0000000000 --- a/test/sys/class/leds/tpacpi::bay_active +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/leds/tpacpi::bay_active \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::dock_active b/test/sys/class/leds/tpacpi::dock_active deleted file mode 120000 index 51d1bf9360..0000000000 --- a/test/sys/class/leds/tpacpi::dock_active +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/leds/tpacpi::dock_active \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::dock_batt b/test/sys/class/leds/tpacpi::dock_batt deleted file mode 120000 index ae8a31fae0..0000000000 --- a/test/sys/class/leds/tpacpi::dock_batt +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::power b/test/sys/class/leds/tpacpi::power deleted file mode 120000 index 9214cffbc9..0000000000 --- a/test/sys/class/leds/tpacpi::power +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/leds/tpacpi::power \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::standby b/test/sys/class/leds/tpacpi::standby deleted file mode 120000 index 98c4779ae9..0000000000 --- a/test/sys/class/leds/tpacpi::standby +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/leds/tpacpi::standby \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::thinklight b/test/sys/class/leds/tpacpi::thinklight deleted file mode 120000 index 64c7da5986..0000000000 --- a/test/sys/class/leds/tpacpi::thinklight +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/leds/tpacpi::thinklight \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi::unknown_led b/test/sys/class/leds/tpacpi::unknown_led deleted file mode 120000 index e1088e9f8e..0000000000 --- a/test/sys/class/leds/tpacpi::unknown_led +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi:green:batt b/test/sys/class/leds/tpacpi:green:batt deleted file mode 120000 index 0c69835c94..0000000000 --- a/test/sys/class/leds/tpacpi:green:batt +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/leds/tpacpi:green:batt \ No newline at end of file diff --git a/test/sys/class/leds/tpacpi:orange:batt b/test/sys/class/leds/tpacpi:orange:batt deleted file mode 120000 index 3a29c366e0..0000000000 --- a/test/sys/class/leds/tpacpi:orange:batt +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt \ No newline at end of file diff --git a/test/sys/class/mem/full b/test/sys/class/mem/full deleted file mode 120000 index 3305ef6885..0000000000 --- a/test/sys/class/mem/full +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/full \ No newline at end of file diff --git a/test/sys/class/mem/kmem b/test/sys/class/mem/kmem deleted file mode 120000 index fd2e57d601..0000000000 --- a/test/sys/class/mem/kmem +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/kmem \ No newline at end of file diff --git a/test/sys/class/mem/kmsg b/test/sys/class/mem/kmsg deleted file mode 120000 index cd44206462..0000000000 --- a/test/sys/class/mem/kmsg +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/kmsg \ No newline at end of file diff --git a/test/sys/class/mem/mem b/test/sys/class/mem/mem deleted file mode 120000 index 4971e087b4..0000000000 --- a/test/sys/class/mem/mem +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/mem \ No newline at end of file diff --git a/test/sys/class/mem/null b/test/sys/class/mem/null deleted file mode 120000 index 8fe50f9623..0000000000 --- a/test/sys/class/mem/null +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/null \ No newline at end of file diff --git a/test/sys/class/mem/port b/test/sys/class/mem/port deleted file mode 120000 index 0f635f5945..0000000000 --- a/test/sys/class/mem/port +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/port \ No newline at end of file diff --git a/test/sys/class/mem/random b/test/sys/class/mem/random deleted file mode 120000 index b751f35293..0000000000 --- a/test/sys/class/mem/random +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/random \ No newline at end of file diff --git a/test/sys/class/mem/urandom b/test/sys/class/mem/urandom deleted file mode 120000 index c69f1e2c68..0000000000 --- a/test/sys/class/mem/urandom +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/urandom \ No newline at end of file diff --git a/test/sys/class/mem/zero b/test/sys/class/mem/zero deleted file mode 120000 index fea0d4d472..0000000000 --- a/test/sys/class/mem/zero +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/zero \ No newline at end of file diff --git a/test/sys/class/misc/cpu_dma_latency b/test/sys/class/misc/cpu_dma_latency deleted file mode 120000 index 9236586351..0000000000 --- a/test/sys/class/misc/cpu_dma_latency +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/cpu_dma_latency \ No newline at end of file diff --git a/test/sys/class/misc/device-mapper b/test/sys/class/misc/device-mapper deleted file mode 120000 index be736a2d8e..0000000000 --- a/test/sys/class/misc/device-mapper +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/device-mapper \ No newline at end of file diff --git a/test/sys/class/misc/fuse b/test/sys/class/misc/fuse deleted file mode 120000 index 293b69bfe8..0000000000 --- a/test/sys/class/misc/fuse +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/fuse \ No newline at end of file diff --git a/test/sys/class/misc/hpet b/test/sys/class/misc/hpet deleted file mode 120000 index 9a8a753964..0000000000 --- a/test/sys/class/misc/hpet +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/hpet \ No newline at end of file diff --git a/test/sys/class/misc/mcelog b/test/sys/class/misc/mcelog deleted file mode 120000 index b89f6666f5..0000000000 --- a/test/sys/class/misc/mcelog +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/mcelog \ No newline at end of file diff --git a/test/sys/class/misc/microcode b/test/sys/class/misc/microcode deleted file mode 120000 index d5989199d8..0000000000 --- a/test/sys/class/misc/microcode +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/microcode \ No newline at end of file diff --git a/test/sys/class/misc/network_latency b/test/sys/class/misc/network_latency deleted file mode 120000 index 13bd46af83..0000000000 --- a/test/sys/class/misc/network_latency +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/network_latency \ No newline at end of file diff --git a/test/sys/class/misc/network_throughput b/test/sys/class/misc/network_throughput deleted file mode 120000 index 3804785676..0000000000 --- a/test/sys/class/misc/network_throughput +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/network_throughput \ No newline at end of file diff --git a/test/sys/class/misc/nvram b/test/sys/class/misc/nvram deleted file mode 120000 index e819d9348c..0000000000 --- a/test/sys/class/misc/nvram +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/nvram \ No newline at end of file diff --git a/test/sys/class/misc/psaux b/test/sys/class/misc/psaux deleted file mode 120000 index 740b359d77..0000000000 --- a/test/sys/class/misc/psaux +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/psaux \ No newline at end of file diff --git a/test/sys/class/misc/uinput b/test/sys/class/misc/uinput deleted file mode 120000 index 565db3ee51..0000000000 --- a/test/sys/class/misc/uinput +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/uinput \ No newline at end of file diff --git a/test/sys/class/net/eth0 b/test/sys/class/net/eth0 deleted file mode 120000 index c1ba21c554..0000000000 --- a/test/sys/class/net/eth0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0 \ No newline at end of file diff --git a/test/sys/class/net/lo b/test/sys/class/net/lo deleted file mode 120000 index c40cc08ac2..0000000000 --- a/test/sys/class/net/lo +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/net/lo \ No newline at end of file diff --git a/test/sys/class/net/wlan0 b/test/sys/class/net/wlan0 deleted file mode 120000 index c4c4a83f57..0000000000 --- a/test/sys/class/net/wlan0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0 \ No newline at end of file diff --git a/test/sys/class/net/wmaster0 b/test/sys/class/net/wmaster0 deleted file mode 120000 index 3e0bec365e..0000000000 --- a/test/sys/class/net/wmaster0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:00 b/test/sys/class/pci_bus/0000:00 deleted file mode 120000 index 6682dbbd1f..0000000000 --- a/test/sys/class/pci_bus/0000:00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/pci_bus/0000:00 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:01 b/test/sys/class/pci_bus/0000:01 deleted file mode 120000 index 58140954bb..0000000000 --- a/test/sys/class/pci_bus/0000:01 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:01.0/pci_bus/0000:01 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:02 b/test/sys/class/pci_bus/0000:02 deleted file mode 120000 index 56a18e1cff..0000000000 --- a/test/sys/class/pci_bus/0000:02 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:03 b/test/sys/class/pci_bus/0000:03 deleted file mode 120000 index fe9c6f68c5..0000000000 --- a/test/sys/class/pci_bus/0000:03 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:04 b/test/sys/class/pci_bus/0000:04 deleted file mode 120000 index 7b5aa93c47..0000000000 --- a/test/sys/class/pci_bus/0000:04 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:0c b/test/sys/class/pci_bus/0000:0c deleted file mode 120000 index cc1031e67d..0000000000 --- a/test/sys/class/pci_bus/0000:0c +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:15 b/test/sys/class/pci_bus/0000:15 deleted file mode 120000 index cd1d3322b7..0000000000 --- a/test/sys/class/pci_bus/0000:15 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15 \ No newline at end of file diff --git a/test/sys/class/pci_bus/0000:16 b/test/sys/class/pci_bus/0000:16 deleted file mode 120000 index c32e0c7a83..0000000000 --- a/test/sys/class/pci_bus/0000:16 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16 \ No newline at end of file diff --git a/test/sys/class/pcmcia_socket/pcmcia_socket0 b/test/sys/class/pcmcia_socket/pcmcia_socket0 deleted file mode 120000 index ecb6225dbc..0000000000 --- a/test/sys/class/pcmcia_socket/pcmcia_socket0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0 \ No newline at end of file diff --git a/test/sys/class/power_supply/AC b/test/sys/class/power_supply/AC deleted file mode 120000 index a42c2072ba..0000000000 --- a/test/sys/class/power_supply/AC +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC \ No newline at end of file diff --git a/test/sys/class/power_supply/BAT0 b/test/sys/class/power_supply/BAT0 deleted file mode 120000 index 3858474d5c..0000000000 --- a/test/sys/class/power_supply/BAT0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 \ No newline at end of file diff --git a/test/sys/class/rfkill/rfkill0 b/test/sys/class/rfkill/rfkill0 deleted file mode 120000 index 912a4e0a68..0000000000 --- a/test/sys/class/rfkill/rfkill0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/thinkpad_acpi/rfkill/rfkill0 \ No newline at end of file diff --git a/test/sys/class/rtc/rtc0 b/test/sys/class/rtc/rtc0 deleted file mode 120000 index b7116fb0aa..0000000000 --- a/test/sys/class/rtc/rtc0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pnp0/00:07/rtc/rtc0 \ No newline at end of file diff --git a/test/sys/class/scsi_device/0:0:0:0 b/test/sys/class/scsi_device/0:0:0:0 deleted file mode 120000 index bfa2c195ac..0000000000 --- a/test/sys/class/scsi_device/0:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_device/4:0:0:0 b/test/sys/class/scsi_device/4:0:0:0 deleted file mode 120000 index 8de428ae89..0000000000 --- a/test/sys/class/scsi_device/4:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_device/7:0:0:0 b/test/sys/class/scsi_device/7:0:0:0 deleted file mode 120000 index f04936b31b..0000000000 --- a/test/sys/class/scsi_device/7:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_disk/0:0:0:0 b/test/sys/class/scsi_disk/0:0:0:0 deleted file mode 120000 index 904526c6ee..0000000000 --- a/test/sys/class/scsi_disk/0:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_disk/7:0:0:0 b/test/sys/class/scsi_disk/7:0:0:0 deleted file mode 120000 index b4219d7bf2..0000000000 --- a/test/sys/class/scsi_disk/7:0:0:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0 \ No newline at end of file diff --git a/test/sys/class/scsi_generic/sg0 b/test/sys/class/scsi_generic/sg0 deleted file mode 120000 index 93d1199d1d..0000000000 --- a/test/sys/class/scsi_generic/sg0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 \ No newline at end of file diff --git a/test/sys/class/scsi_generic/sg1 b/test/sys/class/scsi_generic/sg1 deleted file mode 120000 index 768d2dc122..0000000000 --- a/test/sys/class/scsi_generic/sg1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1 \ No newline at end of file diff --git a/test/sys/class/scsi_generic/sg2 b/test/sys/class/scsi_generic/sg2 deleted file mode 120000 index 2433e998a8..0000000000 --- a/test/sys/class/scsi_generic/sg2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host0 b/test/sys/class/scsi_host/host0 deleted file mode 120000 index 2b32179c87..0000000000 --- a/test/sys/class/scsi_host/host0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host1 b/test/sys/class/scsi_host/host1 deleted file mode 120000 index 2ea45e4583..0000000000 --- a/test/sys/class/scsi_host/host1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host2 b/test/sys/class/scsi_host/host2 deleted file mode 120000 index 728d191704..0000000000 --- a/test/sys/class/scsi_host/host2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host3 b/test/sys/class/scsi_host/host3 deleted file mode 120000 index 76de2907dd..0000000000 --- a/test/sys/class/scsi_host/host3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host4 b/test/sys/class/scsi_host/host4 deleted file mode 120000 index 0d3a7503e3..0000000000 --- a/test/sys/class/scsi_host/host4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host5 b/test/sys/class/scsi_host/host5 deleted file mode 120000 index 5ff01499aa..0000000000 --- a/test/sys/class/scsi_host/host5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5 \ No newline at end of file diff --git a/test/sys/class/scsi_host/host7 b/test/sys/class/scsi_host/host7 deleted file mode 120000 index f4ec0bb3dc..0000000000 --- a/test/sys/class/scsi_host/host7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7 \ No newline at end of file diff --git a/test/sys/class/sound/adsp b/test/sys/class/sound/adsp deleted file mode 120000 index 1c2d43b53c..0000000000 --- a/test/sys/class/sound/adsp +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/adsp \ No newline at end of file diff --git a/test/sys/class/sound/audio b/test/sys/class/sound/audio deleted file mode 120000 index 1fa8f211b8..0000000000 --- a/test/sys/class/sound/audio +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/audio \ No newline at end of file diff --git a/test/sys/class/sound/card0 b/test/sys/class/sound/card0 deleted file mode 120000 index b70239b7be..0000000000 --- a/test/sys/class/sound/card0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0 \ No newline at end of file diff --git a/test/sys/class/sound/controlC0 b/test/sys/class/sound/controlC0 deleted file mode 120000 index 72acd4aa77..0000000000 --- a/test/sys/class/sound/controlC0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0 \ No newline at end of file diff --git a/test/sys/class/sound/dsp b/test/sys/class/sound/dsp deleted file mode 120000 index 91f29fcdfb..0000000000 --- a/test/sys/class/sound/dsp +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/dsp \ No newline at end of file diff --git a/test/sys/class/sound/mixer b/test/sys/class/sound/mixer deleted file mode 120000 index d1099becaf..0000000000 --- a/test/sys/class/sound/mixer +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/mixer \ No newline at end of file diff --git a/test/sys/class/sound/pcmC0D0c b/test/sys/class/sound/pcmC0D0c deleted file mode 120000 index af82f9219b..0000000000 --- a/test/sys/class/sound/pcmC0D0c +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c \ No newline at end of file diff --git a/test/sys/class/sound/pcmC0D0p b/test/sys/class/sound/pcmC0D0p deleted file mode 120000 index ac9e13aaf7..0000000000 --- a/test/sys/class/sound/pcmC0D0p +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p \ No newline at end of file diff --git a/test/sys/class/sound/pcmC0D1p b/test/sys/class/sound/pcmC0D1p deleted file mode 120000 index d8efba4918..0000000000 --- a/test/sys/class/sound/pcmC0D1p +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p \ No newline at end of file diff --git a/test/sys/class/sound/seq b/test/sys/class/sound/seq deleted file mode 120000 index 322a82bfa0..0000000000 --- a/test/sys/class/sound/seq +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/sound/seq \ No newline at end of file diff --git a/test/sys/class/sound/timer b/test/sys/class/sound/timer deleted file mode 120000 index 1ce5c875c2..0000000000 --- a/test/sys/class/sound/timer +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/sound/timer \ No newline at end of file diff --git a/test/sys/class/thermal/cooling_device0 b/test/sys/class/thermal/cooling_device0 deleted file mode 120000 index ea93d4309f..0000000000 --- a/test/sys/class/thermal/cooling_device0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/thermal/cooling_device0 \ No newline at end of file diff --git a/test/sys/class/thermal/cooling_device1 b/test/sys/class/thermal/cooling_device1 deleted file mode 120000 index 0e8e30cb05..0000000000 --- a/test/sys/class/thermal/cooling_device1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/thermal/cooling_device1 \ No newline at end of file diff --git a/test/sys/class/thermal/thermal_zone0 b/test/sys/class/thermal/thermal_zone0 deleted file mode 120000 index e26359c431..0000000000 --- a/test/sys/class/thermal/thermal_zone0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/thermal/thermal_zone0 \ No newline at end of file diff --git a/test/sys/class/thermal/thermal_zone1 b/test/sys/class/thermal/thermal_zone1 deleted file mode 120000 index 6e49270d04..0000000000 --- a/test/sys/class/thermal/thermal_zone1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/thermal/thermal_zone1 \ No newline at end of file diff --git a/test/sys/class/tty/console b/test/sys/class/tty/console deleted file mode 120000 index 2483dd2791..0000000000 --- a/test/sys/class/tty/console +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/console \ No newline at end of file diff --git a/test/sys/class/tty/ptmx b/test/sys/class/tty/ptmx deleted file mode 120000 index 9c489ead9f..0000000000 --- a/test/sys/class/tty/ptmx +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/ptmx \ No newline at end of file diff --git a/test/sys/class/tty/tty b/test/sys/class/tty/tty deleted file mode 120000 index e67d736497..0000000000 --- a/test/sys/class/tty/tty +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty \ No newline at end of file diff --git a/test/sys/class/tty/tty0 b/test/sys/class/tty/tty0 deleted file mode 120000 index 1ebbbc882a..0000000000 --- a/test/sys/class/tty/tty0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty0 \ No newline at end of file diff --git a/test/sys/class/tty/tty1 b/test/sys/class/tty/tty1 deleted file mode 120000 index e0418dabc9..0000000000 --- a/test/sys/class/tty/tty1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty1 \ No newline at end of file diff --git a/test/sys/class/tty/tty10 b/test/sys/class/tty/tty10 deleted file mode 120000 index 319d31f915..0000000000 --- a/test/sys/class/tty/tty10 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty10 \ No newline at end of file diff --git a/test/sys/class/tty/tty11 b/test/sys/class/tty/tty11 deleted file mode 120000 index 9c76e05207..0000000000 --- a/test/sys/class/tty/tty11 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty11 \ No newline at end of file diff --git a/test/sys/class/tty/tty12 b/test/sys/class/tty/tty12 deleted file mode 120000 index abac0f831a..0000000000 --- a/test/sys/class/tty/tty12 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty12 \ No newline at end of file diff --git a/test/sys/class/tty/tty13 b/test/sys/class/tty/tty13 deleted file mode 120000 index c3812100e0..0000000000 --- a/test/sys/class/tty/tty13 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty13 \ No newline at end of file diff --git a/test/sys/class/tty/tty14 b/test/sys/class/tty/tty14 deleted file mode 120000 index 63bd3a6764..0000000000 --- a/test/sys/class/tty/tty14 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty14 \ No newline at end of file diff --git a/test/sys/class/tty/tty15 b/test/sys/class/tty/tty15 deleted file mode 120000 index e2c5914874..0000000000 --- a/test/sys/class/tty/tty15 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty15 \ No newline at end of file diff --git a/test/sys/class/tty/tty16 b/test/sys/class/tty/tty16 deleted file mode 120000 index d8846a866d..0000000000 --- a/test/sys/class/tty/tty16 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty16 \ No newline at end of file diff --git a/test/sys/class/tty/tty17 b/test/sys/class/tty/tty17 deleted file mode 120000 index a488b19305..0000000000 --- a/test/sys/class/tty/tty17 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty17 \ No newline at end of file diff --git a/test/sys/class/tty/tty18 b/test/sys/class/tty/tty18 deleted file mode 120000 index 933880a8c7..0000000000 --- a/test/sys/class/tty/tty18 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty18 \ No newline at end of file diff --git a/test/sys/class/tty/tty19 b/test/sys/class/tty/tty19 deleted file mode 120000 index 398ff33d7a..0000000000 --- a/test/sys/class/tty/tty19 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty19 \ No newline at end of file diff --git a/test/sys/class/tty/tty2 b/test/sys/class/tty/tty2 deleted file mode 120000 index 15b216c9f4..0000000000 --- a/test/sys/class/tty/tty2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty2 \ No newline at end of file diff --git a/test/sys/class/tty/tty20 b/test/sys/class/tty/tty20 deleted file mode 120000 index bacbb6a5cc..0000000000 --- a/test/sys/class/tty/tty20 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty20 \ No newline at end of file diff --git a/test/sys/class/tty/tty21 b/test/sys/class/tty/tty21 deleted file mode 120000 index 73f9c8c982..0000000000 --- a/test/sys/class/tty/tty21 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty21 \ No newline at end of file diff --git a/test/sys/class/tty/tty22 b/test/sys/class/tty/tty22 deleted file mode 120000 index a2a0d8ca63..0000000000 --- a/test/sys/class/tty/tty22 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty22 \ No newline at end of file diff --git a/test/sys/class/tty/tty23 b/test/sys/class/tty/tty23 deleted file mode 120000 index 8daebf5f43..0000000000 --- a/test/sys/class/tty/tty23 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty23 \ No newline at end of file diff --git a/test/sys/class/tty/tty24 b/test/sys/class/tty/tty24 deleted file mode 120000 index 67a64368f8..0000000000 --- a/test/sys/class/tty/tty24 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty24 \ No newline at end of file diff --git a/test/sys/class/tty/tty25 b/test/sys/class/tty/tty25 deleted file mode 120000 index 4f8d0795d2..0000000000 --- a/test/sys/class/tty/tty25 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty25 \ No newline at end of file diff --git a/test/sys/class/tty/tty26 b/test/sys/class/tty/tty26 deleted file mode 120000 index 2f65d8be1d..0000000000 --- a/test/sys/class/tty/tty26 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty26 \ No newline at end of file diff --git a/test/sys/class/tty/tty27 b/test/sys/class/tty/tty27 deleted file mode 120000 index 0d1a42b943..0000000000 --- a/test/sys/class/tty/tty27 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty27 \ No newline at end of file diff --git a/test/sys/class/tty/tty28 b/test/sys/class/tty/tty28 deleted file mode 120000 index 1419911bde..0000000000 --- a/test/sys/class/tty/tty28 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty28 \ No newline at end of file diff --git a/test/sys/class/tty/tty29 b/test/sys/class/tty/tty29 deleted file mode 120000 index 2d15900bf2..0000000000 --- a/test/sys/class/tty/tty29 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty29 \ No newline at end of file diff --git a/test/sys/class/tty/tty3 b/test/sys/class/tty/tty3 deleted file mode 120000 index 7764e1c747..0000000000 --- a/test/sys/class/tty/tty3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty3 \ No newline at end of file diff --git a/test/sys/class/tty/tty30 b/test/sys/class/tty/tty30 deleted file mode 120000 index d8bb78d95e..0000000000 --- a/test/sys/class/tty/tty30 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty30 \ No newline at end of file diff --git a/test/sys/class/tty/tty31 b/test/sys/class/tty/tty31 deleted file mode 120000 index 4f5a23296a..0000000000 --- a/test/sys/class/tty/tty31 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty31 \ No newline at end of file diff --git a/test/sys/class/tty/tty32 b/test/sys/class/tty/tty32 deleted file mode 120000 index 5d1dc6fe32..0000000000 --- a/test/sys/class/tty/tty32 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty32 \ No newline at end of file diff --git a/test/sys/class/tty/tty33 b/test/sys/class/tty/tty33 deleted file mode 120000 index 95bb3af2f0..0000000000 --- a/test/sys/class/tty/tty33 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty33 \ No newline at end of file diff --git a/test/sys/class/tty/tty34 b/test/sys/class/tty/tty34 deleted file mode 120000 index 9212f5c8ac..0000000000 --- a/test/sys/class/tty/tty34 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty34 \ No newline at end of file diff --git a/test/sys/class/tty/tty35 b/test/sys/class/tty/tty35 deleted file mode 120000 index 7a3ebc2945..0000000000 --- a/test/sys/class/tty/tty35 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty35 \ No newline at end of file diff --git a/test/sys/class/tty/tty36 b/test/sys/class/tty/tty36 deleted file mode 120000 index 96a7b1a62e..0000000000 --- a/test/sys/class/tty/tty36 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty36 \ No newline at end of file diff --git a/test/sys/class/tty/tty37 b/test/sys/class/tty/tty37 deleted file mode 120000 index 520543a8c2..0000000000 --- a/test/sys/class/tty/tty37 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty37 \ No newline at end of file diff --git a/test/sys/class/tty/tty38 b/test/sys/class/tty/tty38 deleted file mode 120000 index 6ad284dfdc..0000000000 --- a/test/sys/class/tty/tty38 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty38 \ No newline at end of file diff --git a/test/sys/class/tty/tty39 b/test/sys/class/tty/tty39 deleted file mode 120000 index d001bab9ee..0000000000 --- a/test/sys/class/tty/tty39 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty39 \ No newline at end of file diff --git a/test/sys/class/tty/tty4 b/test/sys/class/tty/tty4 deleted file mode 120000 index 784bf4d728..0000000000 --- a/test/sys/class/tty/tty4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty4 \ No newline at end of file diff --git a/test/sys/class/tty/tty40 b/test/sys/class/tty/tty40 deleted file mode 120000 index dc6ea499d3..0000000000 --- a/test/sys/class/tty/tty40 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty40 \ No newline at end of file diff --git a/test/sys/class/tty/tty41 b/test/sys/class/tty/tty41 deleted file mode 120000 index 8a8f597f36..0000000000 --- a/test/sys/class/tty/tty41 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty41 \ No newline at end of file diff --git a/test/sys/class/tty/tty42 b/test/sys/class/tty/tty42 deleted file mode 120000 index 397f4316e3..0000000000 --- a/test/sys/class/tty/tty42 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty42 \ No newline at end of file diff --git a/test/sys/class/tty/tty43 b/test/sys/class/tty/tty43 deleted file mode 120000 index 77f93885e1..0000000000 --- a/test/sys/class/tty/tty43 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty43 \ No newline at end of file diff --git a/test/sys/class/tty/tty44 b/test/sys/class/tty/tty44 deleted file mode 120000 index 9b9077d9f0..0000000000 --- a/test/sys/class/tty/tty44 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty44 \ No newline at end of file diff --git a/test/sys/class/tty/tty45 b/test/sys/class/tty/tty45 deleted file mode 120000 index 794cf19308..0000000000 --- a/test/sys/class/tty/tty45 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty45 \ No newline at end of file diff --git a/test/sys/class/tty/tty46 b/test/sys/class/tty/tty46 deleted file mode 120000 index 200c809887..0000000000 --- a/test/sys/class/tty/tty46 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty46 \ No newline at end of file diff --git a/test/sys/class/tty/tty47 b/test/sys/class/tty/tty47 deleted file mode 120000 index 9c3d9156d9..0000000000 --- a/test/sys/class/tty/tty47 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty47 \ No newline at end of file diff --git a/test/sys/class/tty/tty48 b/test/sys/class/tty/tty48 deleted file mode 120000 index 9b9a4cda68..0000000000 --- a/test/sys/class/tty/tty48 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty48 \ No newline at end of file diff --git a/test/sys/class/tty/tty49 b/test/sys/class/tty/tty49 deleted file mode 120000 index 304113d078..0000000000 --- a/test/sys/class/tty/tty49 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty49 \ No newline at end of file diff --git a/test/sys/class/tty/tty5 b/test/sys/class/tty/tty5 deleted file mode 120000 index 88eaad31a4..0000000000 --- a/test/sys/class/tty/tty5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty5 \ No newline at end of file diff --git a/test/sys/class/tty/tty50 b/test/sys/class/tty/tty50 deleted file mode 120000 index 980e47e84d..0000000000 --- a/test/sys/class/tty/tty50 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty50 \ No newline at end of file diff --git a/test/sys/class/tty/tty51 b/test/sys/class/tty/tty51 deleted file mode 120000 index 996785ba60..0000000000 --- a/test/sys/class/tty/tty51 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty51 \ No newline at end of file diff --git a/test/sys/class/tty/tty52 b/test/sys/class/tty/tty52 deleted file mode 120000 index da16c4fa0f..0000000000 --- a/test/sys/class/tty/tty52 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty52 \ No newline at end of file diff --git a/test/sys/class/tty/tty53 b/test/sys/class/tty/tty53 deleted file mode 120000 index 2f9b5fc00d..0000000000 --- a/test/sys/class/tty/tty53 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty53 \ No newline at end of file diff --git a/test/sys/class/tty/tty54 b/test/sys/class/tty/tty54 deleted file mode 120000 index 066ee67726..0000000000 --- a/test/sys/class/tty/tty54 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty54 \ No newline at end of file diff --git a/test/sys/class/tty/tty55 b/test/sys/class/tty/tty55 deleted file mode 120000 index 36b5ab23ea..0000000000 --- a/test/sys/class/tty/tty55 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty55 \ No newline at end of file diff --git a/test/sys/class/tty/tty56 b/test/sys/class/tty/tty56 deleted file mode 120000 index 9d59eb5509..0000000000 --- a/test/sys/class/tty/tty56 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty56 \ No newline at end of file diff --git a/test/sys/class/tty/tty57 b/test/sys/class/tty/tty57 deleted file mode 120000 index faad99a937..0000000000 --- a/test/sys/class/tty/tty57 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty57 \ No newline at end of file diff --git a/test/sys/class/tty/tty58 b/test/sys/class/tty/tty58 deleted file mode 120000 index c8600121f7..0000000000 --- a/test/sys/class/tty/tty58 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty58 \ No newline at end of file diff --git a/test/sys/class/tty/tty59 b/test/sys/class/tty/tty59 deleted file mode 120000 index 703f555529..0000000000 --- a/test/sys/class/tty/tty59 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty59 \ No newline at end of file diff --git a/test/sys/class/tty/tty6 b/test/sys/class/tty/tty6 deleted file mode 120000 index efc1d693e2..0000000000 --- a/test/sys/class/tty/tty6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty6 \ No newline at end of file diff --git a/test/sys/class/tty/tty60 b/test/sys/class/tty/tty60 deleted file mode 120000 index 3f7263f9ff..0000000000 --- a/test/sys/class/tty/tty60 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty60 \ No newline at end of file diff --git a/test/sys/class/tty/tty61 b/test/sys/class/tty/tty61 deleted file mode 120000 index cee51b9cdb..0000000000 --- a/test/sys/class/tty/tty61 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty61 \ No newline at end of file diff --git a/test/sys/class/tty/tty62 b/test/sys/class/tty/tty62 deleted file mode 120000 index c951635197..0000000000 --- a/test/sys/class/tty/tty62 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty62 \ No newline at end of file diff --git a/test/sys/class/tty/tty63 b/test/sys/class/tty/tty63 deleted file mode 120000 index 055770a378..0000000000 --- a/test/sys/class/tty/tty63 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty63 \ No newline at end of file diff --git a/test/sys/class/tty/tty7 b/test/sys/class/tty/tty7 deleted file mode 120000 index 0e04f76811..0000000000 --- a/test/sys/class/tty/tty7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty7 \ No newline at end of file diff --git a/test/sys/class/tty/tty8 b/test/sys/class/tty/tty8 deleted file mode 120000 index 1289573e26..0000000000 --- a/test/sys/class/tty/tty8 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty8 \ No newline at end of file diff --git a/test/sys/class/tty/tty9 b/test/sys/class/tty/tty9 deleted file mode 120000 index e4a707b9f4..0000000000 --- a/test/sys/class/tty/tty9 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty9 \ No newline at end of file diff --git a/test/sys/class/tty/ttyACM0 b/test/sys/class/tty/ttyACM0 deleted file mode 120000 index 5aff7254d0..0000000000 --- a/test/sys/class/tty/ttyACM0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0 \ No newline at end of file diff --git a/test/sys/class/tty/ttyS0 b/test/sys/class/tty/ttyS0 deleted file mode 120000 index 860756e70e..0000000000 --- a/test/sys/class/tty/ttyS0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/serial8250/tty/ttyS0 \ No newline at end of file diff --git a/test/sys/class/tty/ttyS1 b/test/sys/class/tty/ttyS1 deleted file mode 120000 index a4e521e3ba..0000000000 --- a/test/sys/class/tty/ttyS1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/serial8250/tty/ttyS1 \ No newline at end of file diff --git a/test/sys/class/tty/ttyS2 b/test/sys/class/tty/ttyS2 deleted file mode 120000 index a0170b5335..0000000000 --- a/test/sys/class/tty/ttyS2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/serial8250/tty/ttyS2 \ No newline at end of file diff --git a/test/sys/class/tty/ttyS3 b/test/sys/class/tty/ttyS3 deleted file mode 120000 index 15ae8b290e..0000000000 --- a/test/sys/class/tty/ttyS3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/serial8250/tty/ttyS3 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev1.1_ep00 b/test/sys/class/usb_endpoint/usbdev1.1_ep00 deleted file mode 120000 index d7bfbd0c6a..0000000000 --- a/test/sys/class/usb_endpoint/usbdev1.1_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev1.1_ep81 b/test/sys/class/usb_endpoint/usbdev1.1_ep81 deleted file mode 120000 index bd2c39312b..0000000000 --- a/test/sys/class/usb_endpoint/usbdev1.1_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev2.1_ep00 b/test/sys/class/usb_endpoint/usbdev2.1_ep00 deleted file mode 120000 index 47d9d584d5..0000000000 --- a/test/sys/class/usb_endpoint/usbdev2.1_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev2.1_ep81 b/test/sys/class/usb_endpoint/usbdev2.1_ep81 deleted file mode 120000 index d83045b65f..0000000000 --- a/test/sys/class/usb_endpoint/usbdev2.1_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.1_ep00 b/test/sys/class/usb_endpoint/usbdev3.1_ep00 deleted file mode 120000 index eb3e0285f7..0000000000 --- a/test/sys/class/usb_endpoint/usbdev3.1_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.1_ep81 b/test/sys/class/usb_endpoint/usbdev3.1_ep81 deleted file mode 120000 index 31df8a686d..0000000000 --- a/test/sys/class/usb_endpoint/usbdev3.1_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.4_ep00 b/test/sys/class/usb_endpoint/usbdev3.4_ep00 deleted file mode 120000 index 7ca132ea67..0000000000 --- a/test/sys/class/usb_endpoint/usbdev3.4_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev3.4_ep81 b/test/sys/class/usb_endpoint/usbdev3.4_ep81 deleted file mode 120000 index f22eaef49a..0000000000 --- a/test/sys/class/usb_endpoint/usbdev3.4_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.1_ep00 b/test/sys/class/usb_endpoint/usbdev4.1_ep00 deleted file mode 120000 index d8722976a0..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.1_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.1_ep81 b/test/sys/class/usb_endpoint/usbdev4.1_ep81 deleted file mode 120000 index b93a8b8714..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.1_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep00 b/test/sys/class/usb_endpoint/usbdev4.2_ep00 deleted file mode 120000 index b55c0ca993..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.2_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep02 b/test/sys/class/usb_endpoint/usbdev4.2_ep02 deleted file mode 120000 index 4252382cb5..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.2_ep02 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep03 b/test/sys/class/usb_endpoint/usbdev4.2_ep03 deleted file mode 120000 index 2c9c471c58..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.2_ep03 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep04 b/test/sys/class/usb_endpoint/usbdev4.2_ep04 deleted file mode 120000 index 7a90390108..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.2_ep04 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep81 b/test/sys/class/usb_endpoint/usbdev4.2_ep81 deleted file mode 120000 index 6513618361..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.2_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep82 b/test/sys/class/usb_endpoint/usbdev4.2_ep82 deleted file mode 120000 index 6978069f5a..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.2_ep82 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep83 b/test/sys/class/usb_endpoint/usbdev4.2_ep83 deleted file mode 120000 index f65bab5870..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.2_ep83 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.2_ep84 b/test/sys/class/usb_endpoint/usbdev4.2_ep84 deleted file mode 120000 index 8c21bd0b99..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.2_ep84 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.3_ep00 b/test/sys/class/usb_endpoint/usbdev4.3_ep00 deleted file mode 120000 index f94fad7264..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.3_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.3_ep02 b/test/sys/class/usb_endpoint/usbdev4.3_ep02 deleted file mode 120000 index ed97352880..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.3_ep02 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.3_ep81 b/test/sys/class/usb_endpoint/usbdev4.3_ep81 deleted file mode 120000 index 2af437dc67..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.3_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev4.3_ep83 b/test/sys/class/usb_endpoint/usbdev4.3_ep83 deleted file mode 120000 index 7b5d1c3e1f..0000000000 --- a/test/sys/class/usb_endpoint/usbdev4.3_ep83 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.1_ep00 b/test/sys/class/usb_endpoint/usbdev5.1_ep00 deleted file mode 120000 index c4f7637252..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.1_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.1_ep81 b/test/sys/class/usb_endpoint/usbdev5.1_ep81 deleted file mode 120000 index 7ca8e5a1fd..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.1_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.7_ep00 b/test/sys/class/usb_endpoint/usbdev5.7_ep00 deleted file mode 120000 index ca461f6444..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.7_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.7_ep02 b/test/sys/class/usb_endpoint/usbdev5.7_ep02 deleted file mode 120000 index c01c58b147..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.7_ep02 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.7_ep81 b/test/sys/class/usb_endpoint/usbdev5.7_ep81 deleted file mode 120000 index 1b4eb8d4b4..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.7_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep00 b/test/sys/class/usb_endpoint/usbdev5.9_ep00 deleted file mode 120000 index 84a7886030..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.9_ep00 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep01 b/test/sys/class/usb_endpoint/usbdev5.9_ep01 deleted file mode 120000 index 6ab35bd8b3..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.9_ep01 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep02 b/test/sys/class/usb_endpoint/usbdev5.9_ep02 deleted file mode 120000 index 01b893ff00..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.9_ep02 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep81 b/test/sys/class/usb_endpoint/usbdev5.9_ep81 deleted file mode 120000 index 971b8a16df..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.9_ep81 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep82 b/test/sys/class/usb_endpoint/usbdev5.9_ep82 deleted file mode 120000 index 9061b7226c..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.9_ep82 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep83 b/test/sys/class/usb_endpoint/usbdev5.9_ep83 deleted file mode 120000 index 8f626bd8f5..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.9_ep83 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83 \ No newline at end of file diff --git a/test/sys/class/usb_endpoint/usbdev5.9_ep84 b/test/sys/class/usb_endpoint/usbdev5.9_ep84 deleted file mode 120000 index 40e1671524..0000000000 --- a/test/sys/class/usb_endpoint/usbdev5.9_ep84 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host1 b/test/sys/class/usb_host/usb_host1 deleted file mode 120000 index 7d48824d91..0000000000 --- a/test/sys/class/usb_host/usb_host1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host2 b/test/sys/class/usb_host/usb_host2 deleted file mode 120000 index 841817def2..0000000000 --- a/test/sys/class/usb_host/usb_host2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host3 b/test/sys/class/usb_host/usb_host3 deleted file mode 120000 index 3258cdf796..0000000000 --- a/test/sys/class/usb_host/usb_host3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host4 b/test/sys/class/usb_host/usb_host4 deleted file mode 120000 index c67658538e..0000000000 --- a/test/sys/class/usb_host/usb_host4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4 \ No newline at end of file diff --git a/test/sys/class/usb_host/usb_host5 b/test/sys/class/usb_host/usb_host5 deleted file mode 120000 index c2ed47c2cc..0000000000 --- a/test/sys/class/usb_host/usb_host5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5 \ No newline at end of file diff --git a/test/sys/class/vc/vcs b/test/sys/class/vc/vcs deleted file mode 120000 index b642424830..0000000000 --- a/test/sys/class/vc/vcs +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs \ No newline at end of file diff --git a/test/sys/class/vc/vcs1 b/test/sys/class/vc/vcs1 deleted file mode 120000 index 5855850e22..0000000000 --- a/test/sys/class/vc/vcs1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs1 \ No newline at end of file diff --git a/test/sys/class/vc/vcs10 b/test/sys/class/vc/vcs10 deleted file mode 120000 index dab30ff21f..0000000000 --- a/test/sys/class/vc/vcs10 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs10 \ No newline at end of file diff --git a/test/sys/class/vc/vcs2 b/test/sys/class/vc/vcs2 deleted file mode 120000 index 3f257365e1..0000000000 --- a/test/sys/class/vc/vcs2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs2 \ No newline at end of file diff --git a/test/sys/class/vc/vcs3 b/test/sys/class/vc/vcs3 deleted file mode 120000 index c7190a927a..0000000000 --- a/test/sys/class/vc/vcs3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs3 \ No newline at end of file diff --git a/test/sys/class/vc/vcs4 b/test/sys/class/vc/vcs4 deleted file mode 120000 index 2cbf17f636..0000000000 --- a/test/sys/class/vc/vcs4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs4 \ No newline at end of file diff --git a/test/sys/class/vc/vcs5 b/test/sys/class/vc/vcs5 deleted file mode 120000 index 0493a1b39b..0000000000 --- a/test/sys/class/vc/vcs5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs5 \ No newline at end of file diff --git a/test/sys/class/vc/vcs6 b/test/sys/class/vc/vcs6 deleted file mode 120000 index aa0eb575d6..0000000000 --- a/test/sys/class/vc/vcs6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs6 \ No newline at end of file diff --git a/test/sys/class/vc/vcs7 b/test/sys/class/vc/vcs7 deleted file mode 120000 index a6bd54ca4c..0000000000 --- a/test/sys/class/vc/vcs7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs7 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa b/test/sys/class/vc/vcsa deleted file mode 120000 index b7b448a413..0000000000 --- a/test/sys/class/vc/vcsa +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa \ No newline at end of file diff --git a/test/sys/class/vc/vcsa1 b/test/sys/class/vc/vcsa1 deleted file mode 120000 index ee2129054b..0000000000 --- a/test/sys/class/vc/vcsa1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa1 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa10 b/test/sys/class/vc/vcsa10 deleted file mode 120000 index 24f19fa165..0000000000 --- a/test/sys/class/vc/vcsa10 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa10 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa2 b/test/sys/class/vc/vcsa2 deleted file mode 120000 index 32135b67b3..0000000000 --- a/test/sys/class/vc/vcsa2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa2 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa3 b/test/sys/class/vc/vcsa3 deleted file mode 120000 index 808a1372af..0000000000 --- a/test/sys/class/vc/vcsa3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa3 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa4 b/test/sys/class/vc/vcsa4 deleted file mode 120000 index 094974435e..0000000000 --- a/test/sys/class/vc/vcsa4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa4 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa5 b/test/sys/class/vc/vcsa5 deleted file mode 120000 index 028b0a82ea..0000000000 --- a/test/sys/class/vc/vcsa5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa5 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa6 b/test/sys/class/vc/vcsa6 deleted file mode 120000 index 9206bb2635..0000000000 --- a/test/sys/class/vc/vcsa6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa6 \ No newline at end of file diff --git a/test/sys/class/vc/vcsa7 b/test/sys/class/vc/vcsa7 deleted file mode 120000 index 546fe2044b..0000000000 --- a/test/sys/class/vc/vcsa7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa7 \ No newline at end of file diff --git a/test/sys/class/vtconsole/vtcon0 b/test/sys/class/vtconsole/vtcon0 deleted file mode 120000 index a6cd626112..0000000000 --- a/test/sys/class/vtconsole/vtcon0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vtconsole/vtcon0 \ No newline at end of file diff --git a/test/sys/class/vtconsole/vtcon1 b/test/sys/class/vtconsole/vtcon1 deleted file mode 120000 index 23c2dd8de6..0000000000 --- a/test/sys/class/vtconsole/vtcon1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vtconsole/vtcon1 \ No newline at end of file diff --git a/test/sys/dev/block/11:0 b/test/sys/dev/block/11:0 deleted file mode 120000 index 4d1c248a3c..0000000000 --- a/test/sys/dev/block/11:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0 \ No newline at end of file diff --git a/test/sys/dev/block/7:0 b/test/sys/dev/block/7:0 deleted file mode 120000 index 86a5878d7d..0000000000 --- a/test/sys/dev/block/7:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop0 \ No newline at end of file diff --git a/test/sys/dev/block/7:1 b/test/sys/dev/block/7:1 deleted file mode 120000 index 97476753e1..0000000000 --- a/test/sys/dev/block/7:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop1 \ No newline at end of file diff --git a/test/sys/dev/block/7:2 b/test/sys/dev/block/7:2 deleted file mode 120000 index 5fc0d7dd11..0000000000 --- a/test/sys/dev/block/7:2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop2 \ No newline at end of file diff --git a/test/sys/dev/block/7:3 b/test/sys/dev/block/7:3 deleted file mode 120000 index a6d7b89dea..0000000000 --- a/test/sys/dev/block/7:3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop3 \ No newline at end of file diff --git a/test/sys/dev/block/7:4 b/test/sys/dev/block/7:4 deleted file mode 120000 index 71386cbfd8..0000000000 --- a/test/sys/dev/block/7:4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop4 \ No newline at end of file diff --git a/test/sys/dev/block/7:5 b/test/sys/dev/block/7:5 deleted file mode 120000 index af83a27367..0000000000 --- a/test/sys/dev/block/7:5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop5 \ No newline at end of file diff --git a/test/sys/dev/block/7:6 b/test/sys/dev/block/7:6 deleted file mode 120000 index efdbd9532a..0000000000 --- a/test/sys/dev/block/7:6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop6 \ No newline at end of file diff --git a/test/sys/dev/block/7:7 b/test/sys/dev/block/7:7 deleted file mode 120000 index 7a6d7e4aac..0000000000 --- a/test/sys/dev/block/7:7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/loop7 \ No newline at end of file diff --git a/test/sys/dev/block/8:0 b/test/sys/dev/block/8:0 deleted file mode 120000 index 7ecaff1132..0000000000 --- a/test/sys/dev/block/8:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda \ No newline at end of file diff --git a/test/sys/dev/block/8:1 b/test/sys/dev/block/8:1 deleted file mode 120000 index 18dc11fc29..0000000000 --- a/test/sys/dev/block/8:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1 \ No newline at end of file diff --git a/test/sys/dev/block/8:10 b/test/sys/dev/block/8:10 deleted file mode 120000 index d64a8257ae..0000000000 --- a/test/sys/dev/block/8:10 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10 \ No newline at end of file diff --git a/test/sys/dev/block/8:16 b/test/sys/dev/block/8:16 deleted file mode 120000 index f588ad7926..0000000000 --- a/test/sys/dev/block/8:16 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb \ No newline at end of file diff --git a/test/sys/dev/block/8:17 b/test/sys/dev/block/8:17 deleted file mode 120000 index 02be95389e..0000000000 --- a/test/sys/dev/block/8:17 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1 \ No newline at end of file diff --git a/test/sys/dev/block/8:5 b/test/sys/dev/block/8:5 deleted file mode 120000 index d7bd5661cf..0000000000 --- a/test/sys/dev/block/8:5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5 \ No newline at end of file diff --git a/test/sys/dev/block/8:6 b/test/sys/dev/block/8:6 deleted file mode 120000 index 2b13ee8459..0000000000 --- a/test/sys/dev/block/8:6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6 \ No newline at end of file diff --git a/test/sys/dev/block/8:7 b/test/sys/dev/block/8:7 deleted file mode 120000 index d8b862667f..0000000000 --- a/test/sys/dev/block/8:7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7 \ No newline at end of file diff --git a/test/sys/dev/block/8:8 b/test/sys/dev/block/8:8 deleted file mode 120000 index 34923aae6d..0000000000 --- a/test/sys/dev/block/8:8 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8 \ No newline at end of file diff --git a/test/sys/dev/block/8:9 b/test/sys/dev/block/8:9 deleted file mode 120000 index 4b108b2336..0000000000 --- a/test/sys/dev/block/8:9 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9 \ No newline at end of file diff --git a/test/sys/dev/block/9:0 b/test/sys/dev/block/9:0 deleted file mode 120000 index 2072a2f60f..0000000000 --- a/test/sys/dev/block/9:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/block/md0 \ No newline at end of file diff --git a/test/sys/dev/char/10:1 b/test/sys/dev/char/10:1 deleted file mode 120000 index 740b359d77..0000000000 --- a/test/sys/dev/char/10:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/psaux \ No newline at end of file diff --git a/test/sys/dev/char/10:144 b/test/sys/dev/char/10:144 deleted file mode 120000 index e819d9348c..0000000000 --- a/test/sys/dev/char/10:144 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/nvram \ No newline at end of file diff --git a/test/sys/dev/char/10:184 b/test/sys/dev/char/10:184 deleted file mode 120000 index d5989199d8..0000000000 --- a/test/sys/dev/char/10:184 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/microcode \ No newline at end of file diff --git a/test/sys/dev/char/10:223 b/test/sys/dev/char/10:223 deleted file mode 120000 index 565db3ee51..0000000000 --- a/test/sys/dev/char/10:223 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/uinput \ No newline at end of file diff --git a/test/sys/dev/char/10:227 b/test/sys/dev/char/10:227 deleted file mode 120000 index b89f6666f5..0000000000 --- a/test/sys/dev/char/10:227 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/mcelog \ No newline at end of file diff --git a/test/sys/dev/char/10:228 b/test/sys/dev/char/10:228 deleted file mode 120000 index 9a8a753964..0000000000 --- a/test/sys/dev/char/10:228 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/hpet \ No newline at end of file diff --git a/test/sys/dev/char/10:229 b/test/sys/dev/char/10:229 deleted file mode 120000 index 293b69bfe8..0000000000 --- a/test/sys/dev/char/10:229 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/fuse \ No newline at end of file diff --git a/test/sys/dev/char/10:60 b/test/sys/dev/char/10:60 deleted file mode 120000 index be736a2d8e..0000000000 --- a/test/sys/dev/char/10:60 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/device-mapper \ No newline at end of file diff --git a/test/sys/dev/char/10:61 b/test/sys/dev/char/10:61 deleted file mode 120000 index 3804785676..0000000000 --- a/test/sys/dev/char/10:61 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/network_throughput \ No newline at end of file diff --git a/test/sys/dev/char/10:62 b/test/sys/dev/char/10:62 deleted file mode 120000 index 13bd46af83..0000000000 --- a/test/sys/dev/char/10:62 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/network_latency \ No newline at end of file diff --git a/test/sys/dev/char/10:63 b/test/sys/dev/char/10:63 deleted file mode 120000 index 9236586351..0000000000 --- a/test/sys/dev/char/10:63 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/misc/cpu_dma_latency \ No newline at end of file diff --git a/test/sys/dev/char/116:0 b/test/sys/dev/char/116:0 deleted file mode 120000 index 72acd4aa77..0000000000 --- a/test/sys/dev/char/116:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0 \ No newline at end of file diff --git a/test/sys/dev/char/116:1 b/test/sys/dev/char/116:1 deleted file mode 120000 index 322a82bfa0..0000000000 --- a/test/sys/dev/char/116:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/sound/seq \ No newline at end of file diff --git a/test/sys/dev/char/116:16 b/test/sys/dev/char/116:16 deleted file mode 120000 index ac9e13aaf7..0000000000 --- a/test/sys/dev/char/116:16 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p \ No newline at end of file diff --git a/test/sys/dev/char/116:17 b/test/sys/dev/char/116:17 deleted file mode 120000 index d8efba4918..0000000000 --- a/test/sys/dev/char/116:17 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p \ No newline at end of file diff --git a/test/sys/dev/char/116:24 b/test/sys/dev/char/116:24 deleted file mode 120000 index af82f9219b..0000000000 --- a/test/sys/dev/char/116:24 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c \ No newline at end of file diff --git a/test/sys/dev/char/116:33 b/test/sys/dev/char/116:33 deleted file mode 120000 index 1ce5c875c2..0000000000 --- a/test/sys/dev/char/116:33 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/sound/timer \ No newline at end of file diff --git a/test/sys/dev/char/13:32 b/test/sys/dev/char/13:32 deleted file mode 120000 index 58db4cc7fa..0000000000 --- a/test/sys/dev/char/13:32 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/i8042/serio1/input/input1/mouse0 \ No newline at end of file diff --git a/test/sys/dev/char/13:33 b/test/sys/dev/char/13:33 deleted file mode 120000 index 995db704ef..0000000000 --- a/test/sys/dev/char/13:33 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1 \ No newline at end of file diff --git a/test/sys/dev/char/13:63 b/test/sys/dev/char/13:63 deleted file mode 120000 index 17e795b481..0000000000 --- a/test/sys/dev/char/13:63 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/input/mice \ No newline at end of file diff --git a/test/sys/dev/char/13:64 b/test/sys/dev/char/13:64 deleted file mode 120000 index d2d695f0b7..0000000000 --- a/test/sys/dev/char/13:64 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/i8042/serio0/input/input0/event0 \ No newline at end of file diff --git a/test/sys/dev/char/13:65 b/test/sys/dev/char/13:65 deleted file mode 120000 index a4dcf8e11d..0000000000 --- a/test/sys/dev/char/13:65 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/i8042/serio1/input/input1/event1 \ No newline at end of file diff --git a/test/sys/dev/char/13:66 b/test/sys/dev/char/13:66 deleted file mode 120000 index 5faad280d9..0000000000 --- a/test/sys/dev/char/13:66 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/pcspkr/input/input2/event2 \ No newline at end of file diff --git a/test/sys/dev/char/13:67 b/test/sys/dev/char/13:67 deleted file mode 120000 index 65fdd24cfd..0000000000 --- a/test/sys/dev/char/13:67 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3 \ No newline at end of file diff --git a/test/sys/dev/char/13:68 b/test/sys/dev/char/13:68 deleted file mode 120000 index 3bd330ffb8..0000000000 --- a/test/sys/dev/char/13:68 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4 \ No newline at end of file diff --git a/test/sys/dev/char/13:69 b/test/sys/dev/char/13:69 deleted file mode 120000 index d60c233c11..0000000000 --- a/test/sys/dev/char/13:69 +++ /dev/null @@ -1 +0,0 @@ -../../devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5 \ No newline at end of file diff --git a/test/sys/dev/char/13:70 b/test/sys/dev/char/13:70 deleted file mode 120000 index 581626ed43..0000000000 --- a/test/sys/dev/char/13:70 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/input/input6/event6 \ No newline at end of file diff --git a/test/sys/dev/char/13:71 b/test/sys/dev/char/13:71 deleted file mode 120000 index a09790ab02..0000000000 --- a/test/sys/dev/char/13:71 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7 \ No newline at end of file diff --git a/test/sys/dev/char/14:0 b/test/sys/dev/char/14:0 deleted file mode 120000 index d1099becaf..0000000000 --- a/test/sys/dev/char/14:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/mixer \ No newline at end of file diff --git a/test/sys/dev/char/14:12 b/test/sys/dev/char/14:12 deleted file mode 120000 index 1c2d43b53c..0000000000 --- a/test/sys/dev/char/14:12 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/adsp \ No newline at end of file diff --git a/test/sys/dev/char/14:3 b/test/sys/dev/char/14:3 deleted file mode 120000 index 91f29fcdfb..0000000000 --- a/test/sys/dev/char/14:3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/dsp \ No newline at end of file diff --git a/test/sys/dev/char/14:4 b/test/sys/dev/char/14:4 deleted file mode 120000 index 1fa8f211b8..0000000000 --- a/test/sys/dev/char/14:4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1b.0/sound/card0/audio \ No newline at end of file diff --git a/test/sys/dev/char/166:0 b/test/sys/dev/char/166:0 deleted file mode 120000 index 5aff7254d0..0000000000 --- a/test/sys/dev/char/166:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0 \ No newline at end of file diff --git a/test/sys/dev/char/189:0 b/test/sys/dev/char/189:0 deleted file mode 120000 index a4ab699dd2..0000000000 --- a/test/sys/dev/char/189:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.0/usb1 \ No newline at end of file diff --git a/test/sys/dev/char/189:128 b/test/sys/dev/char/189:128 deleted file mode 120000 index 0a7dff8529..0000000000 --- a/test/sys/dev/char/189:128 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.1/usb2 \ No newline at end of file diff --git a/test/sys/dev/char/189:256 b/test/sys/dev/char/189:256 deleted file mode 120000 index d1c346f1d1..0000000000 --- a/test/sys/dev/char/189:256 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3 \ No newline at end of file diff --git a/test/sys/dev/char/189:259 b/test/sys/dev/char/189:259 deleted file mode 120000 index 8e33ef34ac..0000000000 --- a/test/sys/dev/char/189:259 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:384 b/test/sys/dev/char/189:384 deleted file mode 120000 index d4def11289..0000000000 --- a/test/sys/dev/char/189:384 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4 \ No newline at end of file diff --git a/test/sys/dev/char/189:385 b/test/sys/dev/char/189:385 deleted file mode 120000 index 9bf3f86dc9..0000000000 --- a/test/sys/dev/char/189:385 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:386 b/test/sys/dev/char/189:386 deleted file mode 120000 index 972ff17fad..0000000000 --- a/test/sys/dev/char/189:386 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-2 \ No newline at end of file diff --git a/test/sys/dev/char/189:512 b/test/sys/dev/char/189:512 deleted file mode 120000 index 7ef4821176..0000000000 --- a/test/sys/dev/char/189:512 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5 \ No newline at end of file diff --git a/test/sys/dev/char/189:518 b/test/sys/dev/char/189:518 deleted file mode 120000 index 26d5b39dd4..0000000000 --- a/test/sys/dev/char/189:518 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1 \ No newline at end of file diff --git a/test/sys/dev/char/189:520 b/test/sys/dev/char/189:520 deleted file mode 120000 index 619c2a79a6..0000000000 --- a/test/sys/dev/char/189:520 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2 \ No newline at end of file diff --git a/test/sys/dev/char/1:1 b/test/sys/dev/char/1:1 deleted file mode 120000 index 4971e087b4..0000000000 --- a/test/sys/dev/char/1:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/mem \ No newline at end of file diff --git a/test/sys/dev/char/1:11 b/test/sys/dev/char/1:11 deleted file mode 120000 index cd44206462..0000000000 --- a/test/sys/dev/char/1:11 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/kmsg \ No newline at end of file diff --git a/test/sys/dev/char/1:2 b/test/sys/dev/char/1:2 deleted file mode 120000 index fd2e57d601..0000000000 --- a/test/sys/dev/char/1:2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/kmem \ No newline at end of file diff --git a/test/sys/dev/char/1:3 b/test/sys/dev/char/1:3 deleted file mode 120000 index 8fe50f9623..0000000000 --- a/test/sys/dev/char/1:3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/null \ No newline at end of file diff --git a/test/sys/dev/char/1:4 b/test/sys/dev/char/1:4 deleted file mode 120000 index 0f635f5945..0000000000 --- a/test/sys/dev/char/1:4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/port \ No newline at end of file diff --git a/test/sys/dev/char/1:5 b/test/sys/dev/char/1:5 deleted file mode 120000 index fea0d4d472..0000000000 --- a/test/sys/dev/char/1:5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/zero \ No newline at end of file diff --git a/test/sys/dev/char/1:7 b/test/sys/dev/char/1:7 deleted file mode 120000 index 3305ef6885..0000000000 --- a/test/sys/dev/char/1:7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/full \ No newline at end of file diff --git a/test/sys/dev/char/1:8 b/test/sys/dev/char/1:8 deleted file mode 120000 index b751f35293..0000000000 --- a/test/sys/dev/char/1:8 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/random \ No newline at end of file diff --git a/test/sys/dev/char/1:9 b/test/sys/dev/char/1:9 deleted file mode 120000 index c69f1e2c68..0000000000 --- a/test/sys/dev/char/1:9 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/mem/urandom \ No newline at end of file diff --git a/test/sys/dev/char/21:0 b/test/sys/dev/char/21:0 deleted file mode 120000 index 93d1199d1d..0000000000 --- a/test/sys/dev/char/21:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0 \ No newline at end of file diff --git a/test/sys/dev/char/21:1 b/test/sys/dev/char/21:1 deleted file mode 120000 index 768d2dc122..0000000000 --- a/test/sys/dev/char/21:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1 \ No newline at end of file diff --git a/test/sys/dev/char/21:2 b/test/sys/dev/char/21:2 deleted file mode 120000 index 2433e998a8..0000000000 --- a/test/sys/dev/char/21:2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2 \ No newline at end of file diff --git a/test/sys/dev/char/252:0 b/test/sys/dev/char/252:0 deleted file mode 120000 index bd2c39312b..0000000000 --- a/test/sys/dev/char/252:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:1 b/test/sys/dev/char/252:1 deleted file mode 120000 index d7bfbd0c6a..0000000000 --- a/test/sys/dev/char/252:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:10 b/test/sys/dev/char/252:10 deleted file mode 120000 index 1b4eb8d4b4..0000000000 --- a/test/sys/dev/char/252:10 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:11 b/test/sys/dev/char/252:11 deleted file mode 120000 index c01c58b147..0000000000 --- a/test/sys/dev/char/252:11 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:12 b/test/sys/dev/char/252:12 deleted file mode 120000 index 6513618361..0000000000 --- a/test/sys/dev/char/252:12 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:13 b/test/sys/dev/char/252:13 deleted file mode 120000 index 6978069f5a..0000000000 --- a/test/sys/dev/char/252:13 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82 \ No newline at end of file diff --git a/test/sys/dev/char/252:14 b/test/sys/dev/char/252:14 deleted file mode 120000 index 4252382cb5..0000000000 --- a/test/sys/dev/char/252:14 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:15 b/test/sys/dev/char/252:15 deleted file mode 120000 index f65bab5870..0000000000 --- a/test/sys/dev/char/252:15 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83 \ No newline at end of file diff --git a/test/sys/dev/char/252:16 b/test/sys/dev/char/252:16 deleted file mode 120000 index 2c9c471c58..0000000000 --- a/test/sys/dev/char/252:16 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03 \ No newline at end of file diff --git a/test/sys/dev/char/252:17 b/test/sys/dev/char/252:17 deleted file mode 120000 index 8c21bd0b99..0000000000 --- a/test/sys/dev/char/252:17 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84 \ No newline at end of file diff --git a/test/sys/dev/char/252:18 b/test/sys/dev/char/252:18 deleted file mode 120000 index 7a90390108..0000000000 --- a/test/sys/dev/char/252:18 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04 \ No newline at end of file diff --git a/test/sys/dev/char/252:19 b/test/sys/dev/char/252:19 deleted file mode 120000 index b55c0ca993..0000000000 --- a/test/sys/dev/char/252:19 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:2 b/test/sys/dev/char/252:2 deleted file mode 120000 index d83045b65f..0000000000 --- a/test/sys/dev/char/252:2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:20 b/test/sys/dev/char/252:20 deleted file mode 120000 index 2af437dc67..0000000000 --- a/test/sys/dev/char/252:20 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:21 b/test/sys/dev/char/252:21 deleted file mode 120000 index ed97352880..0000000000 --- a/test/sys/dev/char/252:21 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:22 b/test/sys/dev/char/252:22 deleted file mode 120000 index 7b5d1c3e1f..0000000000 --- a/test/sys/dev/char/252:22 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83 \ No newline at end of file diff --git a/test/sys/dev/char/252:23 b/test/sys/dev/char/252:23 deleted file mode 120000 index f94fad7264..0000000000 --- a/test/sys/dev/char/252:23 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:24 b/test/sys/dev/char/252:24 deleted file mode 120000 index ca461f6444..0000000000 --- a/test/sys/dev/char/252:24 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:25 b/test/sys/dev/char/252:25 deleted file mode 120000 index f22eaef49a..0000000000 --- a/test/sys/dev/char/252:25 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:26 b/test/sys/dev/char/252:26 deleted file mode 120000 index 7ca132ea67..0000000000 --- a/test/sys/dev/char/252:26 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:27 b/test/sys/dev/char/252:27 deleted file mode 120000 index 971b8a16df..0000000000 --- a/test/sys/dev/char/252:27 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:28 b/test/sys/dev/char/252:28 deleted file mode 120000 index 9061b7226c..0000000000 --- a/test/sys/dev/char/252:28 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82 \ No newline at end of file diff --git a/test/sys/dev/char/252:29 b/test/sys/dev/char/252:29 deleted file mode 120000 index 6ab35bd8b3..0000000000 --- a/test/sys/dev/char/252:29 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01 \ No newline at end of file diff --git a/test/sys/dev/char/252:3 b/test/sys/dev/char/252:3 deleted file mode 120000 index 47d9d584d5..0000000000 --- a/test/sys/dev/char/252:3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:30 b/test/sys/dev/char/252:30 deleted file mode 120000 index 8f626bd8f5..0000000000 --- a/test/sys/dev/char/252:30 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83 \ No newline at end of file diff --git a/test/sys/dev/char/252:31 b/test/sys/dev/char/252:31 deleted file mode 120000 index 40e1671524..0000000000 --- a/test/sys/dev/char/252:31 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84 \ No newline at end of file diff --git a/test/sys/dev/char/252:32 b/test/sys/dev/char/252:32 deleted file mode 120000 index 01b893ff00..0000000000 --- a/test/sys/dev/char/252:32 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02 \ No newline at end of file diff --git a/test/sys/dev/char/252:33 b/test/sys/dev/char/252:33 deleted file mode 120000 index 84a7886030..0000000000 --- a/test/sys/dev/char/252:33 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:4 b/test/sys/dev/char/252:4 deleted file mode 120000 index 31df8a686d..0000000000 --- a/test/sys/dev/char/252:4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:5 b/test/sys/dev/char/252:5 deleted file mode 120000 index eb3e0285f7..0000000000 --- a/test/sys/dev/char/252:5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:6 b/test/sys/dev/char/252:6 deleted file mode 120000 index b93a8b8714..0000000000 --- a/test/sys/dev/char/252:6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:7 b/test/sys/dev/char/252:7 deleted file mode 120000 index d8722976a0..0000000000 --- a/test/sys/dev/char/252:7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/252:8 b/test/sys/dev/char/252:8 deleted file mode 120000 index 7ca8e5a1fd..0000000000 --- a/test/sys/dev/char/252:8 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81 \ No newline at end of file diff --git a/test/sys/dev/char/252:9 b/test/sys/dev/char/252:9 deleted file mode 120000 index c4f7637252..0000000000 --- a/test/sys/dev/char/252:9 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00 \ No newline at end of file diff --git a/test/sys/dev/char/253:0 b/test/sys/dev/char/253:0 deleted file mode 120000 index b7116fb0aa..0000000000 --- a/test/sys/dev/char/253:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pnp0/00:07/rtc/rtc0 \ No newline at end of file diff --git a/test/sys/dev/char/254:0 b/test/sys/dev/char/254:0 deleted file mode 120000 index 00f1c6aef9..0000000000 --- a/test/sys/dev/char/254:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0 \ No newline at end of file diff --git a/test/sys/dev/char/254:1 b/test/sys/dev/char/254:1 deleted file mode 120000 index 805fed84d2..0000000000 --- a/test/sys/dev/char/254:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0 \ No newline at end of file diff --git a/test/sys/dev/char/254:2 b/test/sys/dev/char/254:2 deleted file mode 120000 index 7b5b2c882e..0000000000 --- a/test/sys/dev/char/254:2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0 \ No newline at end of file diff --git a/test/sys/dev/char/29:0 b/test/sys/dev/char/29:0 deleted file mode 120000 index 1944247bd4..0000000000 --- a/test/sys/dev/char/29:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/vesafb.0/graphics/fb0 \ No newline at end of file diff --git a/test/sys/dev/char/4:0 b/test/sys/dev/char/4:0 deleted file mode 120000 index 1ebbbc882a..0000000000 --- a/test/sys/dev/char/4:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty0 \ No newline at end of file diff --git a/test/sys/dev/char/4:1 b/test/sys/dev/char/4:1 deleted file mode 120000 index e0418dabc9..0000000000 --- a/test/sys/dev/char/4:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty1 \ No newline at end of file diff --git a/test/sys/dev/char/4:10 b/test/sys/dev/char/4:10 deleted file mode 120000 index 319d31f915..0000000000 --- a/test/sys/dev/char/4:10 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty10 \ No newline at end of file diff --git a/test/sys/dev/char/4:11 b/test/sys/dev/char/4:11 deleted file mode 120000 index 9c76e05207..0000000000 --- a/test/sys/dev/char/4:11 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty11 \ No newline at end of file diff --git a/test/sys/dev/char/4:12 b/test/sys/dev/char/4:12 deleted file mode 120000 index abac0f831a..0000000000 --- a/test/sys/dev/char/4:12 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty12 \ No newline at end of file diff --git a/test/sys/dev/char/4:13 b/test/sys/dev/char/4:13 deleted file mode 120000 index c3812100e0..0000000000 --- a/test/sys/dev/char/4:13 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty13 \ No newline at end of file diff --git a/test/sys/dev/char/4:14 b/test/sys/dev/char/4:14 deleted file mode 120000 index 63bd3a6764..0000000000 --- a/test/sys/dev/char/4:14 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty14 \ No newline at end of file diff --git a/test/sys/dev/char/4:15 b/test/sys/dev/char/4:15 deleted file mode 120000 index e2c5914874..0000000000 --- a/test/sys/dev/char/4:15 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty15 \ No newline at end of file diff --git a/test/sys/dev/char/4:16 b/test/sys/dev/char/4:16 deleted file mode 120000 index d8846a866d..0000000000 --- a/test/sys/dev/char/4:16 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty16 \ No newline at end of file diff --git a/test/sys/dev/char/4:17 b/test/sys/dev/char/4:17 deleted file mode 120000 index a488b19305..0000000000 --- a/test/sys/dev/char/4:17 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty17 \ No newline at end of file diff --git a/test/sys/dev/char/4:18 b/test/sys/dev/char/4:18 deleted file mode 120000 index 933880a8c7..0000000000 --- a/test/sys/dev/char/4:18 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty18 \ No newline at end of file diff --git a/test/sys/dev/char/4:19 b/test/sys/dev/char/4:19 deleted file mode 120000 index 398ff33d7a..0000000000 --- a/test/sys/dev/char/4:19 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty19 \ No newline at end of file diff --git a/test/sys/dev/char/4:2 b/test/sys/dev/char/4:2 deleted file mode 120000 index 15b216c9f4..0000000000 --- a/test/sys/dev/char/4:2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty2 \ No newline at end of file diff --git a/test/sys/dev/char/4:20 b/test/sys/dev/char/4:20 deleted file mode 120000 index bacbb6a5cc..0000000000 --- a/test/sys/dev/char/4:20 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty20 \ No newline at end of file diff --git a/test/sys/dev/char/4:21 b/test/sys/dev/char/4:21 deleted file mode 120000 index 73f9c8c982..0000000000 --- a/test/sys/dev/char/4:21 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty21 \ No newline at end of file diff --git a/test/sys/dev/char/4:22 b/test/sys/dev/char/4:22 deleted file mode 120000 index a2a0d8ca63..0000000000 --- a/test/sys/dev/char/4:22 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty22 \ No newline at end of file diff --git a/test/sys/dev/char/4:23 b/test/sys/dev/char/4:23 deleted file mode 120000 index 8daebf5f43..0000000000 --- a/test/sys/dev/char/4:23 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty23 \ No newline at end of file diff --git a/test/sys/dev/char/4:24 b/test/sys/dev/char/4:24 deleted file mode 120000 index 67a64368f8..0000000000 --- a/test/sys/dev/char/4:24 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty24 \ No newline at end of file diff --git a/test/sys/dev/char/4:25 b/test/sys/dev/char/4:25 deleted file mode 120000 index 4f8d0795d2..0000000000 --- a/test/sys/dev/char/4:25 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty25 \ No newline at end of file diff --git a/test/sys/dev/char/4:26 b/test/sys/dev/char/4:26 deleted file mode 120000 index 2f65d8be1d..0000000000 --- a/test/sys/dev/char/4:26 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty26 \ No newline at end of file diff --git a/test/sys/dev/char/4:27 b/test/sys/dev/char/4:27 deleted file mode 120000 index 0d1a42b943..0000000000 --- a/test/sys/dev/char/4:27 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty27 \ No newline at end of file diff --git a/test/sys/dev/char/4:28 b/test/sys/dev/char/4:28 deleted file mode 120000 index 1419911bde..0000000000 --- a/test/sys/dev/char/4:28 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty28 \ No newline at end of file diff --git a/test/sys/dev/char/4:29 b/test/sys/dev/char/4:29 deleted file mode 120000 index 2d15900bf2..0000000000 --- a/test/sys/dev/char/4:29 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty29 \ No newline at end of file diff --git a/test/sys/dev/char/4:3 b/test/sys/dev/char/4:3 deleted file mode 120000 index 7764e1c747..0000000000 --- a/test/sys/dev/char/4:3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty3 \ No newline at end of file diff --git a/test/sys/dev/char/4:30 b/test/sys/dev/char/4:30 deleted file mode 120000 index d8bb78d95e..0000000000 --- a/test/sys/dev/char/4:30 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty30 \ No newline at end of file diff --git a/test/sys/dev/char/4:31 b/test/sys/dev/char/4:31 deleted file mode 120000 index 4f5a23296a..0000000000 --- a/test/sys/dev/char/4:31 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty31 \ No newline at end of file diff --git a/test/sys/dev/char/4:32 b/test/sys/dev/char/4:32 deleted file mode 120000 index 5d1dc6fe32..0000000000 --- a/test/sys/dev/char/4:32 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty32 \ No newline at end of file diff --git a/test/sys/dev/char/4:33 b/test/sys/dev/char/4:33 deleted file mode 120000 index 95bb3af2f0..0000000000 --- a/test/sys/dev/char/4:33 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty33 \ No newline at end of file diff --git a/test/sys/dev/char/4:34 b/test/sys/dev/char/4:34 deleted file mode 120000 index 9212f5c8ac..0000000000 --- a/test/sys/dev/char/4:34 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty34 \ No newline at end of file diff --git a/test/sys/dev/char/4:35 b/test/sys/dev/char/4:35 deleted file mode 120000 index 7a3ebc2945..0000000000 --- a/test/sys/dev/char/4:35 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty35 \ No newline at end of file diff --git a/test/sys/dev/char/4:36 b/test/sys/dev/char/4:36 deleted file mode 120000 index 96a7b1a62e..0000000000 --- a/test/sys/dev/char/4:36 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty36 \ No newline at end of file diff --git a/test/sys/dev/char/4:37 b/test/sys/dev/char/4:37 deleted file mode 120000 index 520543a8c2..0000000000 --- a/test/sys/dev/char/4:37 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty37 \ No newline at end of file diff --git a/test/sys/dev/char/4:38 b/test/sys/dev/char/4:38 deleted file mode 120000 index 6ad284dfdc..0000000000 --- a/test/sys/dev/char/4:38 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty38 \ No newline at end of file diff --git a/test/sys/dev/char/4:39 b/test/sys/dev/char/4:39 deleted file mode 120000 index d001bab9ee..0000000000 --- a/test/sys/dev/char/4:39 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty39 \ No newline at end of file diff --git a/test/sys/dev/char/4:4 b/test/sys/dev/char/4:4 deleted file mode 120000 index 784bf4d728..0000000000 --- a/test/sys/dev/char/4:4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty4 \ No newline at end of file diff --git a/test/sys/dev/char/4:40 b/test/sys/dev/char/4:40 deleted file mode 120000 index dc6ea499d3..0000000000 --- a/test/sys/dev/char/4:40 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty40 \ No newline at end of file diff --git a/test/sys/dev/char/4:41 b/test/sys/dev/char/4:41 deleted file mode 120000 index 8a8f597f36..0000000000 --- a/test/sys/dev/char/4:41 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty41 \ No newline at end of file diff --git a/test/sys/dev/char/4:42 b/test/sys/dev/char/4:42 deleted file mode 120000 index 397f4316e3..0000000000 --- a/test/sys/dev/char/4:42 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty42 \ No newline at end of file diff --git a/test/sys/dev/char/4:43 b/test/sys/dev/char/4:43 deleted file mode 120000 index 77f93885e1..0000000000 --- a/test/sys/dev/char/4:43 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty43 \ No newline at end of file diff --git a/test/sys/dev/char/4:44 b/test/sys/dev/char/4:44 deleted file mode 120000 index 9b9077d9f0..0000000000 --- a/test/sys/dev/char/4:44 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty44 \ No newline at end of file diff --git a/test/sys/dev/char/4:45 b/test/sys/dev/char/4:45 deleted file mode 120000 index 794cf19308..0000000000 --- a/test/sys/dev/char/4:45 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty45 \ No newline at end of file diff --git a/test/sys/dev/char/4:46 b/test/sys/dev/char/4:46 deleted file mode 120000 index 200c809887..0000000000 --- a/test/sys/dev/char/4:46 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty46 \ No newline at end of file diff --git a/test/sys/dev/char/4:47 b/test/sys/dev/char/4:47 deleted file mode 120000 index 9c3d9156d9..0000000000 --- a/test/sys/dev/char/4:47 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty47 \ No newline at end of file diff --git a/test/sys/dev/char/4:48 b/test/sys/dev/char/4:48 deleted file mode 120000 index 9b9a4cda68..0000000000 --- a/test/sys/dev/char/4:48 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty48 \ No newline at end of file diff --git a/test/sys/dev/char/4:49 b/test/sys/dev/char/4:49 deleted file mode 120000 index 304113d078..0000000000 --- a/test/sys/dev/char/4:49 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty49 \ No newline at end of file diff --git a/test/sys/dev/char/4:5 b/test/sys/dev/char/4:5 deleted file mode 120000 index 88eaad31a4..0000000000 --- a/test/sys/dev/char/4:5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty5 \ No newline at end of file diff --git a/test/sys/dev/char/4:50 b/test/sys/dev/char/4:50 deleted file mode 120000 index 980e47e84d..0000000000 --- a/test/sys/dev/char/4:50 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty50 \ No newline at end of file diff --git a/test/sys/dev/char/4:51 b/test/sys/dev/char/4:51 deleted file mode 120000 index 996785ba60..0000000000 --- a/test/sys/dev/char/4:51 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty51 \ No newline at end of file diff --git a/test/sys/dev/char/4:52 b/test/sys/dev/char/4:52 deleted file mode 120000 index da16c4fa0f..0000000000 --- a/test/sys/dev/char/4:52 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty52 \ No newline at end of file diff --git a/test/sys/dev/char/4:53 b/test/sys/dev/char/4:53 deleted file mode 120000 index 2f9b5fc00d..0000000000 --- a/test/sys/dev/char/4:53 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty53 \ No newline at end of file diff --git a/test/sys/dev/char/4:54 b/test/sys/dev/char/4:54 deleted file mode 120000 index 066ee67726..0000000000 --- a/test/sys/dev/char/4:54 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty54 \ No newline at end of file diff --git a/test/sys/dev/char/4:55 b/test/sys/dev/char/4:55 deleted file mode 120000 index 36b5ab23ea..0000000000 --- a/test/sys/dev/char/4:55 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty55 \ No newline at end of file diff --git a/test/sys/dev/char/4:56 b/test/sys/dev/char/4:56 deleted file mode 120000 index 9d59eb5509..0000000000 --- a/test/sys/dev/char/4:56 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty56 \ No newline at end of file diff --git a/test/sys/dev/char/4:57 b/test/sys/dev/char/4:57 deleted file mode 120000 index faad99a937..0000000000 --- a/test/sys/dev/char/4:57 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty57 \ No newline at end of file diff --git a/test/sys/dev/char/4:58 b/test/sys/dev/char/4:58 deleted file mode 120000 index c8600121f7..0000000000 --- a/test/sys/dev/char/4:58 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty58 \ No newline at end of file diff --git a/test/sys/dev/char/4:59 b/test/sys/dev/char/4:59 deleted file mode 120000 index 703f555529..0000000000 --- a/test/sys/dev/char/4:59 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty59 \ No newline at end of file diff --git a/test/sys/dev/char/4:6 b/test/sys/dev/char/4:6 deleted file mode 120000 index efc1d693e2..0000000000 --- a/test/sys/dev/char/4:6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty6 \ No newline at end of file diff --git a/test/sys/dev/char/4:60 b/test/sys/dev/char/4:60 deleted file mode 120000 index 3f7263f9ff..0000000000 --- a/test/sys/dev/char/4:60 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty60 \ No newline at end of file diff --git a/test/sys/dev/char/4:61 b/test/sys/dev/char/4:61 deleted file mode 120000 index cee51b9cdb..0000000000 --- a/test/sys/dev/char/4:61 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty61 \ No newline at end of file diff --git a/test/sys/dev/char/4:62 b/test/sys/dev/char/4:62 deleted file mode 120000 index c951635197..0000000000 --- a/test/sys/dev/char/4:62 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty62 \ No newline at end of file diff --git a/test/sys/dev/char/4:63 b/test/sys/dev/char/4:63 deleted file mode 120000 index 055770a378..0000000000 --- a/test/sys/dev/char/4:63 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty63 \ No newline at end of file diff --git a/test/sys/dev/char/4:64 b/test/sys/dev/char/4:64 deleted file mode 120000 index 860756e70e..0000000000 --- a/test/sys/dev/char/4:64 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/serial8250/tty/ttyS0 \ No newline at end of file diff --git a/test/sys/dev/char/4:65 b/test/sys/dev/char/4:65 deleted file mode 120000 index a4e521e3ba..0000000000 --- a/test/sys/dev/char/4:65 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/serial8250/tty/ttyS1 \ No newline at end of file diff --git a/test/sys/dev/char/4:66 b/test/sys/dev/char/4:66 deleted file mode 120000 index a0170b5335..0000000000 --- a/test/sys/dev/char/4:66 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/serial8250/tty/ttyS2 \ No newline at end of file diff --git a/test/sys/dev/char/4:67 b/test/sys/dev/char/4:67 deleted file mode 120000 index 15ae8b290e..0000000000 --- a/test/sys/dev/char/4:67 +++ /dev/null @@ -1 +0,0 @@ -../../devices/platform/serial8250/tty/ttyS3 \ No newline at end of file diff --git a/test/sys/dev/char/4:7 b/test/sys/dev/char/4:7 deleted file mode 120000 index 0e04f76811..0000000000 --- a/test/sys/dev/char/4:7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty7 \ No newline at end of file diff --git a/test/sys/dev/char/4:8 b/test/sys/dev/char/4:8 deleted file mode 120000 index 1289573e26..0000000000 --- a/test/sys/dev/char/4:8 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty8 \ No newline at end of file diff --git a/test/sys/dev/char/4:9 b/test/sys/dev/char/4:9 deleted file mode 120000 index e4a707b9f4..0000000000 --- a/test/sys/dev/char/4:9 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty9 \ No newline at end of file diff --git a/test/sys/dev/char/5:0 b/test/sys/dev/char/5:0 deleted file mode 120000 index e67d736497..0000000000 --- a/test/sys/dev/char/5:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/tty \ No newline at end of file diff --git a/test/sys/dev/char/5:1 b/test/sys/dev/char/5:1 deleted file mode 120000 index 2483dd2791..0000000000 --- a/test/sys/dev/char/5:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/console \ No newline at end of file diff --git a/test/sys/dev/char/5:2 b/test/sys/dev/char/5:2 deleted file mode 120000 index 9c489ead9f..0000000000 --- a/test/sys/dev/char/5:2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/tty/ptmx \ No newline at end of file diff --git a/test/sys/dev/char/7:0 b/test/sys/dev/char/7:0 deleted file mode 120000 index b642424830..0000000000 --- a/test/sys/dev/char/7:0 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs \ No newline at end of file diff --git a/test/sys/dev/char/7:1 b/test/sys/dev/char/7:1 deleted file mode 120000 index 5855850e22..0000000000 --- a/test/sys/dev/char/7:1 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs1 \ No newline at end of file diff --git a/test/sys/dev/char/7:10 b/test/sys/dev/char/7:10 deleted file mode 120000 index dab30ff21f..0000000000 --- a/test/sys/dev/char/7:10 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs10 \ No newline at end of file diff --git a/test/sys/dev/char/7:128 b/test/sys/dev/char/7:128 deleted file mode 120000 index b7b448a413..0000000000 --- a/test/sys/dev/char/7:128 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa \ No newline at end of file diff --git a/test/sys/dev/char/7:129 b/test/sys/dev/char/7:129 deleted file mode 120000 index ee2129054b..0000000000 --- a/test/sys/dev/char/7:129 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa1 \ No newline at end of file diff --git a/test/sys/dev/char/7:130 b/test/sys/dev/char/7:130 deleted file mode 120000 index 32135b67b3..0000000000 --- a/test/sys/dev/char/7:130 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa2 \ No newline at end of file diff --git a/test/sys/dev/char/7:131 b/test/sys/dev/char/7:131 deleted file mode 120000 index 808a1372af..0000000000 --- a/test/sys/dev/char/7:131 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa3 \ No newline at end of file diff --git a/test/sys/dev/char/7:132 b/test/sys/dev/char/7:132 deleted file mode 120000 index 094974435e..0000000000 --- a/test/sys/dev/char/7:132 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa4 \ No newline at end of file diff --git a/test/sys/dev/char/7:133 b/test/sys/dev/char/7:133 deleted file mode 120000 index 028b0a82ea..0000000000 --- a/test/sys/dev/char/7:133 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa5 \ No newline at end of file diff --git a/test/sys/dev/char/7:134 b/test/sys/dev/char/7:134 deleted file mode 120000 index 9206bb2635..0000000000 --- a/test/sys/dev/char/7:134 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa6 \ No newline at end of file diff --git a/test/sys/dev/char/7:135 b/test/sys/dev/char/7:135 deleted file mode 120000 index 546fe2044b..0000000000 --- a/test/sys/dev/char/7:135 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa7 \ No newline at end of file diff --git a/test/sys/dev/char/7:138 b/test/sys/dev/char/7:138 deleted file mode 120000 index 24f19fa165..0000000000 --- a/test/sys/dev/char/7:138 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcsa10 \ No newline at end of file diff --git a/test/sys/dev/char/7:2 b/test/sys/dev/char/7:2 deleted file mode 120000 index 3f257365e1..0000000000 --- a/test/sys/dev/char/7:2 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs2 \ No newline at end of file diff --git a/test/sys/dev/char/7:3 b/test/sys/dev/char/7:3 deleted file mode 120000 index c7190a927a..0000000000 --- a/test/sys/dev/char/7:3 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs3 \ No newline at end of file diff --git a/test/sys/dev/char/7:4 b/test/sys/dev/char/7:4 deleted file mode 120000 index 2cbf17f636..0000000000 --- a/test/sys/dev/char/7:4 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs4 \ No newline at end of file diff --git a/test/sys/dev/char/7:5 b/test/sys/dev/char/7:5 deleted file mode 120000 index 0493a1b39b..0000000000 --- a/test/sys/dev/char/7:5 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs5 \ No newline at end of file diff --git a/test/sys/dev/char/7:6 b/test/sys/dev/char/7:6 deleted file mode 120000 index aa0eb575d6..0000000000 --- a/test/sys/dev/char/7:6 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs6 \ No newline at end of file diff --git a/test/sys/dev/char/7:7 b/test/sys/dev/char/7:7 deleted file mode 120000 index a6bd54ca4c..0000000000 --- a/test/sys/dev/char/7:7 +++ /dev/null @@ -1 +0,0 @@ -../../devices/virtual/vc/vcs7 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver deleted file mode 120000 index c0755b7a7f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/acpi/drivers/processor \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid deleted file mode 100644 index 3cdddd7137..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/hid +++ /dev/null @@ -1 +0,0 @@ -ACPI0007 diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias deleted file mode 100644 index 4590bb1f2c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:ACPI0007: diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/path b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/path deleted file mode 100644 index db9f8f67a1..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/path +++ /dev/null @@ -1 +0,0 @@ -\_PR_.CPU0 diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem deleted file mode 120000 index a9dfb93327..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev deleted file mode 120000 index 9da2c4682d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/sysdev +++ /dev/null @@ -1 +0,0 @@ -../../system/cpu/cpu0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/thermal_cooling b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/thermal_cooling deleted file mode 120000 index 3366be01eb..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/thermal_cooling +++ /dev/null @@ -1 +0,0 @@ -../../virtual/thermal/cooling_device0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent b/test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent deleted file mode 100644 index b7df82a63c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=processor -MODALIAS=acpi:ACPI0007: diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver deleted file mode 120000 index c0755b7a7f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/acpi/drivers/processor \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid deleted file mode 100644 index 3cdddd7137..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/hid +++ /dev/null @@ -1 +0,0 @@ -ACPI0007 diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias deleted file mode 100644 index 4590bb1f2c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:ACPI0007: diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/path b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/path deleted file mode 100644 index 56405af1dc..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/path +++ /dev/null @@ -1 +0,0 @@ -\_PR_.CPU1 diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/power/wakeup b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem deleted file mode 120000 index a9dfb93327..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev deleted file mode 120000 index 6927d39b0d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/sysdev +++ /dev/null @@ -1 +0,0 @@ -../../system/cpu/cpu1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/thermal_cooling b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/thermal_cooling deleted file mode 120000 index a036a04b64..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/thermal_cooling +++ /dev/null @@ -1 +0,0 @@ -../../virtual/thermal/cooling_device1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent b/test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent deleted file mode 100644 index b7df82a63c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/ACPI0007:01/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=processor -MODALIAS=acpi:ACPI0007: diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver deleted file mode 120000 index e880a0df02..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/acpi/drivers/button \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid deleted file mode 100644 index a4bd0e963a..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/hid +++ /dev/null @@ -1 +0,0 @@ -LNXPWRBN diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/abs b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/abs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/abs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ev b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ev deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ev +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ff b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ff deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/ff +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/key b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/key deleted file mode 100644 index a384a9b7f8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/key +++ /dev/null @@ -1 +0,0 @@ -10000000000000 0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/led b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/led deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/led +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/msc b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/msc deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/msc +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/rel b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/rel deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/rel +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/snd b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/snd deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/snd +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/sw b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/sw deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/capabilities/sw +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/device b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/device deleted file mode 120000 index b000b23fde..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/device +++ /dev/null @@ -1 +0,0 @@ -../../../LNXPWRBN:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/dev b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/dev deleted file mode 100644 index 91eb0ccdb9..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/dev +++ /dev/null @@ -1 +0,0 @@ -13:67 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/device b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/device deleted file mode 120000 index 7f61e05e64..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/device +++ /dev/null @@ -1 +0,0 @@ -../../input3 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/subsystem b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/subsystem deleted file mode 120000 index a181f4f9d1..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/uevent b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/uevent deleted file mode 100644 index 9124bc53e1..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/event3/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=67 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/bustype b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/bustype deleted file mode 100644 index f1993fb3a7..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/bustype +++ /dev/null @@ -1 +0,0 @@ -0019 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/product b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/product deleted file mode 100644 index 5fca1fda0b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/product +++ /dev/null @@ -1 +0,0 @@ -0002 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/vendor +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/version b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/version deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/id/version +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias deleted file mode 100644 index 2248a2516e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/modalias +++ /dev/null @@ -1 +0,0 @@ -input:b0019v0000p0002e0000-e0,1,k74,ramlsfw diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/name b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/name deleted file mode 100644 index 228ff268c1..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/name +++ /dev/null @@ -1 +0,0 @@ -Power Button (FF) diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/phys b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/phys deleted file mode 100644 index 88a1fe2d56..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/phys +++ /dev/null @@ -1 +0,0 @@ -LNXPWRBN/button/input0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem deleted file mode 120000 index bd2a91fcf2..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent deleted file mode 100644 index 4ee3cf653c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uevent +++ /dev/null @@ -1,6 +0,0 @@ -PRODUCT=19/0/2/0 -NAME="Power Button (FF)" -PHYS="LNXPWRBN/button/input0" -EV==3 -KEY==10000000000000 0 -MODALIAS=input:b0019v0000p0002e0000-e0,1,k74,ramlsfw diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/input/input3/uniq +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias deleted file mode 100644 index f25ac9bed2..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:LNXPWRBN: diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem deleted file mode 120000 index a9dfb93327..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent b/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent deleted file mode 100644 index 1e7a4fb734..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXPWRBN:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=button -MODALIAS=acpi:LNXPWRBN: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver deleted file mode 120000 index 9373eb378c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/thermal \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid deleted file mode 100644 index af4799663d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/hid +++ /dev/null @@ -1 +0,0 @@ -LNXTHERM diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias deleted file mode 100644 index b1054f9d27..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path deleted file mode 100644 index 4dd3ade433..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/path +++ /dev/null @@ -1 +0,0 @@ -\_TZ_.THM0 diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/thermal_zone b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/thermal_zone deleted file mode 120000 index 694521091e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/thermal_zone +++ /dev/null @@ -1 +0,0 @@ -../../../virtual/thermal/thermal_zone0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent deleted file mode 100644 index 1d557a95a4..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=thermal -MODALIAS=acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver deleted file mode 120000 index 9373eb378c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/thermal \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid deleted file mode 100644 index af4799663d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/hid +++ /dev/null @@ -1 +0,0 @@ -LNXTHERM diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias deleted file mode 100644 index b1054f9d27..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path deleted file mode 100644 index a1a565ddea..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/path +++ /dev/null @@ -1 +0,0 @@ -\_TZ_.THM1 diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/thermal_zone b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/thermal_zone deleted file mode 120000 index 8e148453d4..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/thermal_zone +++ /dev/null @@ -1 +0,0 @@ -../../../virtual/thermal/thermal_zone1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent deleted file mode 100644 index 1d557a95a4..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=thermal -MODALIAS=acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid deleted file mode 100644 index af4799663d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/hid +++ /dev/null @@ -1 +0,0 @@ -LNXTHERM diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias deleted file mode 100644 index b1054f9d27..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path deleted file mode 100644 index 060f460fad..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/path +++ /dev/null @@ -1 +0,0 @@ -\_TZ_ diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem deleted file mode 120000 index a9dfb93327..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent b/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent deleted file mode 100644 index 236b226e58..0000000000 --- a/test/sys/devices/LNXSYSTM:00/LNXTHERM:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:LNXTHERM: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/hid deleted file mode 100644 index 23daf0c824..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/hid +++ /dev/null @@ -1 +0,0 @@ -IBM0079 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/modalias deleted file mode 100644 index ec2476bf45..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:IBM0079:PNP0C15:LNXDOCK: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/path b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/path deleted file mode 100644 index c69dd9d7ad..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.GDCK diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/uevent deleted file mode 100644 index 630e64a790..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/IBM0079:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:IBM0079:PNP0C15:LNXDOCK: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/hid deleted file mode 100644 index a48d4426eb..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/hid +++ /dev/null @@ -1 +0,0 @@ -ATM1200 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/modalias deleted file mode 100644 index 7239e1ac92..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:ATM1200:PNP0C31: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/path deleted file mode 100644 index 10ff73954c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.TPM_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/physical_node deleted file mode 120000 index d73f8da534..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pnp0/00:0a \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/uevent deleted file mode 100644 index 1e2b3ec26e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:ATM1200:PNP0C31: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/hid deleted file mode 100644 index 475abcdc61..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/hid +++ /dev/null @@ -1 +0,0 @@ -IBM0057 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/modalias deleted file mode 100644 index 37b29a8cb5..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:IBM0057:PNP0F13: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/path deleted file mode 100644 index 4ddbc184d2..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.MOU_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/physical_node deleted file mode 120000 index 3cc02b97f8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pnp0/00:09 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/uevent deleted file mode 100644 index d62d0fe275..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:IBM0057:PNP0F13: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/hid deleted file mode 100644 index b1fd8f62a2..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/modalias deleted file mode 100644 index dbd39e483c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0000: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/path deleted file mode 100644 index 726cdc1f11..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.PIC_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/uevent deleted file mode 100644 index 22a696e74f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0000:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0000: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/hid deleted file mode 100644 index b593381c48..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0100 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/modalias deleted file mode 100644 index 2e970b6c12..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0100: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/path deleted file mode 100644 index ecefa7c0c7..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.TIMR diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/uevent deleted file mode 100644 index af0dd875d8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0100:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0100: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/hid deleted file mode 100644 index 01bdd099b8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0103 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/modalias deleted file mode 100644 index 30023a86ef..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0103: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/path deleted file mode 100644 index 53dda49910..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.HPET diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/physical_node deleted file mode 120000 index e06816ccc9..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pnp0/00:03 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/uevent deleted file mode 100644 index bb8024626e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0103: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/hid deleted file mode 100644 index d14c5bc3ff..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0200 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/modalias deleted file mode 100644 index e3c5fdeca6..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0200: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/path deleted file mode 100644 index 92cf969aca..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.DMAC diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/physical_node deleted file mode 120000 index afe28a0d8f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pnp0/00:04 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/uevent deleted file mode 100644 index 3e20ab0ce7..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0200: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/hid deleted file mode 100644 index 958febdd9e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0303 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/modalias deleted file mode 100644 index 585fdca68a..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0303: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/path deleted file mode 100644 index 9936957ed5..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.KBD_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/physical_node deleted file mode 120000 index 88eaf70b6c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pnp0/00:08 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/uevent deleted file mode 100644 index fbd39d8f1d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0303: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/hid deleted file mode 100644 index aec7221dee..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0800 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/modalias deleted file mode 100644 index 721f7c31b8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0800: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/path deleted file mode 100644 index 905bc37db3..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.SPKR diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/physical_node deleted file mode 120000 index eecd61da6d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pnp0/00:05 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/uevent deleted file mode 100644 index 7495b1b8a6..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0800: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/hid deleted file mode 100644 index 9d03dbb448..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0B00 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/modalias deleted file mode 100644 index 9d135ac1e3..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0B00: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/path deleted file mode 100644 index 75b7df3aff..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.RTC_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/physical_node deleted file mode 120000 index 7456f7876f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pnp0/00:07 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/uevent deleted file mode 100644 index 54fcb6ad2d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0B00: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/hid deleted file mode 100644 index 7b80763afa..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C02 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/modalias deleted file mode 100644 index e27f28d41f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C02: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/path deleted file mode 100644 index 7e94a0fd3c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.SIO_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/physical_node deleted file mode 120000 index 999270e913..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pnp0/00:02 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/uevent deleted file mode 100644 index b6f43bbf82..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0C02: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/hid deleted file mode 100644 index f7526732dc..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C04 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/modalias deleted file mode 100644 index 5787b19ab4..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C04: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/path deleted file mode 100644 index da352ec579..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.FPU_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/physical_node deleted file mode 120000 index 6680a64796..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pnp0/00:06 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/uevent deleted file mode 100644 index 18c9c5efdc..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0C04: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/driver deleted file mode 120000 index 50a6634c95..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi/drivers/ac \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/hid deleted file mode 100644 index ea0d5fb834..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/hid +++ /dev/null @@ -1 +0,0 @@ -ACPI0003 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/modalias deleted file mode 100644 index cb2b78fc33..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:ACPI0003: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/path deleted file mode 100644 index 7f99e03071..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.EC__.AC__ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/device deleted file mode 120000 index f617994654..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/device +++ /dev/null @@ -1 +0,0 @@ -../../../ACPI0003:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/online +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/subsystem deleted file mode 120000 index eeac787e94..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/power_supply \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/type b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/type deleted file mode 100644 index 9aaee2dade..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/type +++ /dev/null @@ -1 +0,0 @@ -Mains diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent deleted file mode 100644 index 71da405d1b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/power_supply/AC/uevent +++ /dev/null @@ -1,3 +0,0 @@ -POWER_SUPPLY_NAME=AC -POWER_SUPPLY_TYPE=Mains -POWER_SUPPLY_ONLINE=0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/uevent deleted file mode 100644 index 708c891771..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=ac -MODALIAS=acpi:ACPI0003: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/driver deleted file mode 120000 index 28523cef0e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi/drivers/thinkpad_hotkey \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid deleted file mode 100644 index d09f0e2a78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/hid +++ /dev/null @@ -1 +0,0 @@ -IBM0068 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/modalias deleted file mode 100644 index 78a97b9783..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:IBM0068: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/path deleted file mode 100644 index 5e6871ba41..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.EC__.HKEY diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/uevent deleted file mode 100644 index a847bf581b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/IBM0068:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=thinkpad_hotkey -MODALIAS=acpi:IBM0068: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/driver deleted file mode 120000 index 9ee99277ef..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi/drivers/power \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/hid deleted file mode 100644 index 2658e7b466..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/hid +++ /dev/null @@ -1 +0,0 @@ -LNXPOWER diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/modalias deleted file mode 100644 index 1acba2a31b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:LNXPOWER: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/path deleted file mode 100644 index 52bc528e90..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.EC__.PUBS diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/uevent deleted file mode 100644 index cab9b4d4f0..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/LNXPOWER:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=power -MODALIAS=acpi:LNXPOWER: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/driver deleted file mode 120000 index eae38ea111..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi/drivers/battery \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid deleted file mode 100644 index f0e9b61652..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0A diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/modalias deleted file mode 100644 index 6fd005c690..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0A: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/path deleted file mode 100644 index 03547d8e84..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.EC__.BAT0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm deleted file mode 100644 index 260a626e56..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/alarm +++ /dev/null @@ -1 +0,0 @@ -3075000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now deleted file mode 100644 index 78c34944a9..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/current_now +++ /dev/null @@ -1 +0,0 @@ -25830000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device deleted file mode 120000 index 1a192d8d1c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/device +++ /dev/null @@ -1 +0,0 @@ -../../../PNP0C0A:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full deleted file mode 100644 index 0bf389e5f2..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full +++ /dev/null @@ -1 +0,0 @@ -61510000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full_design b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full_design deleted file mode 100644 index 65b7a8515f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_full_design +++ /dev/null @@ -1 +0,0 @@ -84240000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now deleted file mode 100644 index a3e16aa89a..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/energy_now +++ /dev/null @@ -1 +0,0 @@ -59980000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/manufacturer b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/manufacturer deleted file mode 100644 index c4857dfb86..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/manufacturer +++ /dev/null @@ -1 +0,0 @@ -SANYO diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/model_name b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/model_name deleted file mode 100644 index 05082d6a8b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/model_name +++ /dev/null @@ -1 +0,0 @@ -42T5245 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/present b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/present deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/present +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/serial_number b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/serial_number deleted file mode 100644 index 5642b4cccb..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/serial_number +++ /dev/null @@ -1 +0,0 @@ - 6463 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status deleted file mode 100644 index 4674475b6e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/status +++ /dev/null @@ -1 +0,0 @@ -Discharging diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/subsystem deleted file mode 120000 index eeac787e94..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/power_supply \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/technology b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/technology deleted file mode 100644 index 2c679ca734..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/technology +++ /dev/null @@ -1 +0,0 @@ -Li-ion diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type deleted file mode 100644 index 6784dd35ce..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/type +++ /dev/null @@ -1 +0,0 @@ -Battery diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent deleted file mode 100644 index 57197cd329..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/uevent +++ /dev/null @@ -1,14 +0,0 @@ -POWER_SUPPLY_NAME=BAT0 -POWER_SUPPLY_TYPE=Battery -POWER_SUPPLY_STATUS=Discharging -POWER_SUPPLY_PRESENT=1 -POWER_SUPPLY_TECHNOLOGY=Li-ion -POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000 -POWER_SUPPLY_VOLTAGE_NOW=12207000 -POWER_SUPPLY_CURRENT_NOW=25830000 -POWER_SUPPLY_ENERGY_FULL_DESIGN=84240000 -POWER_SUPPLY_ENERGY_FULL=61510000 -POWER_SUPPLY_ENERGY_NOW=59980000 -POWER_SUPPLY_MODEL_NAME=42T5245 -POWER_SUPPLY_MANUFACTURER=SANYO -POWER_SUPPLY_SERIAL_NUMBER= 6463 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design deleted file mode 100644 index 2636081d72..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_min_design +++ /dev/null @@ -1 +0,0 @@ -10800000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now deleted file mode 100644 index d0c228f780..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/power_supply/BAT0/voltage_now +++ /dev/null @@ -1 +0,0 @@ -12207000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/uevent deleted file mode 100644 index 1afe034bbb..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/PNP0C0A:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=battery -MODALIAS=acpi:PNP0C0A: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/driver deleted file mode 120000 index 78583b7456..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi/drivers/ec \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/hid deleted file mode 100644 index f45606d178..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C09 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/modalias deleted file mode 100644 index a6dcf49544..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C09: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/path deleted file mode 100644 index 1c15db71f4..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_.EC__ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/uevent deleted file mode 100644 index 39d3180ba8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=ec -MODALIAS=acpi:PNP0C09: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/path deleted file mode 100644 index 70e3d1ad5d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.LPC_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/physical_node deleted file mode 120000 index 4cab8f6315..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1f.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/path deleted file mode 100644 index 761a72d9d7..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.VID_.LCD0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:03/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/path deleted file mode 100644 index 7ff768b0d7..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.VID_.CRT0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:04/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/path deleted file mode 100644 index 293a381df9..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.VID_.DVI0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/device:05/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/modalias deleted file mode 100644 index 42d369f887..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:LNXVIDEO: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/path deleted file mode 100644 index dd962244c7..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.VID_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/uevent deleted file mode 100644 index e08505ab58..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:LNXVIDEO: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/path deleted file mode 100644 index 7338d716b6..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.AGP_.VID_.LCD0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:08/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/path deleted file mode 100644 index 840af2b9e6..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.AGP_.VID_.CRT0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:09/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/path deleted file mode 100644 index 1480e899ce..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.AGP_.VID_.DVI0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/device:0a/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/modalias deleted file mode 100644 index 42d369f887..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:LNXVIDEO: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/path deleted file mode 100644 index c60f80c93f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.AGP_.VID_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/physical_node deleted file mode 120000 index b9be7aabc3..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pci0000:00/0000:00:01.0/0000:01:00.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/uevent deleted file mode 100644 index e08505ab58..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:LNXVIDEO: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/path deleted file mode 100644 index 8a923d8adf..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.AGP_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/physical_node deleted file mode 120000 index c248b7891d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:01.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:06/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/path deleted file mode 100644 index cf015c0e43..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.EXP0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/physical_node deleted file mode 120000 index 1c817658c8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1c.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0b/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/path deleted file mode 100644 index ad9adfaf0d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.EXP1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/physical_node deleted file mode 120000 index f2ef6c4a86..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1c.1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0c/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/path deleted file mode 100644 index 59515bd8fd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.EXP2.EXUP diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/device:0e/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/path deleted file mode 100644 index 5d82614aa2..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.EXP2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/physical_node deleted file mode 120000 index f35791f384..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1c.2 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/path deleted file mode 100644 index 4eb0f292a4..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.EXP3.EXPD diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/device:10/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/path deleted file mode 100644 index 59ad546003..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.EXP3 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/physical_node deleted file mode 120000 index c0ce681297..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1c.3 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0f/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/path deleted file mode 100644 index 50539e182b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.PCI1.CDBS diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/physical_node deleted file mode 120000 index e3e6c28729..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../../pci0000:00/0000:00:1e.0/0000:15:00.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/path deleted file mode 100644 index 3726f6d993..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.PCI1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/physical_node deleted file mode 120000 index 68b01daac3..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:11/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/modalias deleted file mode 100644 index d9da66f2b8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:LNXIOBAY: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/path deleted file mode 100644 index f8542f371b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.IDE0.PRIM.MSTR diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/uevent deleted file mode 100644 index ce4f42475e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/device:15/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:LNXIOBAY: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/path deleted file mode 100644 index e693cfc4ae..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.IDE0.PRIM diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/device:14/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/path deleted file mode 100644 index 8c85a31d95..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.IDE0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/physical_node deleted file mode 120000 index 49439891e4..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1f.1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:13/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/path deleted file mode 100644 index 332145062a..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.SATA.PRT0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/device:17/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/path deleted file mode 100644 index 7946fbc055..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.SATA diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/physical_node deleted file mode 120000 index d44ac47d2c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1f.2 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:16/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/path deleted file mode 100644 index 00cb0e0601..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.SMBU diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/physical_node deleted file mode 120000 index 8373e13586..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1f.3 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:18/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/path deleted file mode 100644 index 90feac0ec2..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/physical_node deleted file mode 120000 index ae9769e4d6..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1d.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/path deleted file mode 100644 index 8ac5af3142..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB1.URTH.UPEX diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/device:1c/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/path deleted file mode 100644 index 09b16a3ced..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB1.URTH diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/device:1b/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/path deleted file mode 100644 index 23e35fcfa0..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/physical_node deleted file mode 120000 index a6b409fe0b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1d.1 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1a/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/path deleted file mode 100644 index d5ea43571b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB2.URTH.UPDK diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/device:1f/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/path deleted file mode 100644 index d493814ae8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB2.URTH diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/device:1e/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/path deleted file mode 100644 index 1c2b00f9d4..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB2 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/physical_node deleted file mode 120000 index 14f4165f79..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1d.2 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:1d/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/path deleted file mode 100644 index a39841e12c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB3 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/physical_node deleted file mode 120000 index 1e17c8f55e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1d.3 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:20/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/path deleted file mode 100644 index 489a6c8625..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB7.URTH.UPDK diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:23/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/path deleted file mode 100644 index ddceca5d30..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB7.URTH.UPEX diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/subsystem deleted file mode 120000 index 328069c6bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/device:24/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/path deleted file mode 100644 index 9eb337be25..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB7.URTH diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/subsystem deleted file mode 120000 index 1429387650..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/device:22/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/path deleted file mode 100644 index 530247ff61..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.USB7 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/physical_node deleted file mode 120000 index 8525c168e3..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1d.7 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:21/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/path deleted file mode 100644 index ee6276f7bf..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0.HDEF diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/physical_node deleted file mode 120000 index 02dd7ad3c8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1b.0 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/subsystem deleted file mode 120000 index 2319c1fc78..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:25/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/driver deleted file mode 120000 index 8085013227..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/pci_root \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/hid deleted file mode 100644 index 636eed19b3..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0A08 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/modalias deleted file mode 100644 index b90e645703..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0A08:PNP0A03: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/path deleted file mode 100644 index 313edcd0cd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.PCI0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/physical_node deleted file mode 120000 index 1b094a25e9..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../pci0000:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/uevent deleted file mode 100644 index af09b45dd3..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pci_root -MODALIAS=acpi:PNP0A08:PNP0A03: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/hid deleted file mode 100644 index 5c42a4262b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C01 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/modalias deleted file mode 100644 index b7aa586f30..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C01: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/path deleted file mode 100644 index 56eb1dc44f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.MEM_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/physical_node b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/physical_node deleted file mode 120000 index 142a45a2ab..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/physical_node +++ /dev/null @@ -1 +0,0 @@ -../../../pnp0/00:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/uevent deleted file mode 100644 index aebbbf8555..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C01:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:PNP0C01: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/driver deleted file mode 120000 index fe3d26376a..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/button \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid deleted file mode 100644 index f9f5922e90..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0D diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/abs b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/abs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/abs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ev b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ev deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ev +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ff b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ff deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/ff +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/key b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/key deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/key +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/led b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/led deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/led +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/msc b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/msc deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/msc +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/rel b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/rel deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/rel +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/snd b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/snd deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/snd +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/sw b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/sw deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/capabilities/sw +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/device deleted file mode 120000 index 29849b0b2a..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/device +++ /dev/null @@ -1 +0,0 @@ -../../../PNP0C0D:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/dev b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/dev deleted file mode 100644 index b0fa894fcf..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/dev +++ /dev/null @@ -1 +0,0 @@ -13:68 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/device deleted file mode 120000 index 3206827665..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/device +++ /dev/null @@ -1 +0,0 @@ -../../input4 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/subsystem deleted file mode 120000 index adf0173c53..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/uevent deleted file mode 100644 index 713fa5b0fa..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/event4/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=68 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/bustype b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/bustype deleted file mode 100644 index f1993fb3a7..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/bustype +++ /dev/null @@ -1 +0,0 @@ -0019 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/product b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/product deleted file mode 100644 index edd6487e02..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/product +++ /dev/null @@ -1 +0,0 @@ -0005 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/vendor b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/vendor deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/vendor +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/version b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/version deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/id/version +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/modalias deleted file mode 100644 index fb7de7b5c8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/modalias +++ /dev/null @@ -1 +0,0 @@ -input:b0019v0000p0005e0000-e0,5,kramlsfw0, diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/name b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/name deleted file mode 100644 index a9975a6a4c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/name +++ /dev/null @@ -1 +0,0 @@ -Lid Switch diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/phys b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/phys deleted file mode 100644 index a1e12fb554..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/phys +++ /dev/null @@ -1 +0,0 @@ -PNP0C0D/button/input0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/subsystem deleted file mode 120000 index a181f4f9d1..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uevent deleted file mode 100644 index f55398e539..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uevent +++ /dev/null @@ -1,6 +0,0 @@ -PRODUCT=19/0/5/0 -NAME="Lid Switch" -PHYS="PNP0C0D/button/input0" -EV==21 -SW==1 -MODALIAS=input:b0019v0000p0005e0000-e0,5,kramlsfw0, diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uniq b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uniq deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/input/input4/uniq +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/modalias deleted file mode 100644 index ba899cbcf1..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0D: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/path deleted file mode 100644 index edf97b8cde..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.LID_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/uevent deleted file mode 100644 index f58d0e9862..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0D:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=button -MODALIAS=acpi:PNP0C0D: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/driver deleted file mode 120000 index fe3d26376a..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/button \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid deleted file mode 100644 index 166a5212d6..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0E diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/abs b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/abs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/abs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ev b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ev deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ev +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ff b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ff deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/ff +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/key b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/key deleted file mode 100644 index 46f68a575d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/key +++ /dev/null @@ -1 +0,0 @@ -4000 0 0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/led b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/led deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/led +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/msc b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/msc deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/msc +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/rel b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/rel deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/rel +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/snd b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/snd deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/snd +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/sw b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/sw deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/capabilities/sw +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/device deleted file mode 120000 index 8720cc2f93..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/device +++ /dev/null @@ -1 +0,0 @@ -../../../PNP0C0E:00 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/dev b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/dev deleted file mode 100644 index 00b51205ed..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/dev +++ /dev/null @@ -1 +0,0 @@ -13:69 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/device b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/device deleted file mode 120000 index eb7862e025..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/device +++ /dev/null @@ -1 +0,0 @@ -../../input5 \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/subsystem deleted file mode 120000 index adf0173c53..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/uevent deleted file mode 100644 index f2a4e86587..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/event5/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=69 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/bustype b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/bustype deleted file mode 100644 index f1993fb3a7..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/bustype +++ /dev/null @@ -1 +0,0 @@ -0019 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/product b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/product deleted file mode 100644 index 1ce74b6b00..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/product +++ /dev/null @@ -1 +0,0 @@ -0003 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/vendor b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/vendor deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/vendor +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/version b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/version deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/id/version +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/modalias deleted file mode 100644 index 437a395c00..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/modalias +++ /dev/null @@ -1 +0,0 @@ -input:b0019v0000p0003e0000-e0,1,k8E,ramlsfw diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/name b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/name deleted file mode 100644 index b933ba313a..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/name +++ /dev/null @@ -1 +0,0 @@ -Sleep Button (CM) diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/phys b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/phys deleted file mode 100644 index 165a87f297..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/phys +++ /dev/null @@ -1 +0,0 @@ -PNP0C0E/button/input0 diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/subsystem deleted file mode 120000 index a181f4f9d1..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uevent deleted file mode 100644 index e9b639e1bd..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uevent +++ /dev/null @@ -1,6 +0,0 @@ -PRODUCT=19/0/3/0 -NAME="Sleep Button (CM)" -PHYS="PNP0C0E/button/input0" -EV==3 -KEY==4000 0 0 -MODALIAS=input:b0019v0000p0003e0000-e0,1,k8E,ramlsfw diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uniq b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uniq deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/input/input5/uniq +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/modalias deleted file mode 100644 index 5439a79133..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0E: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/path deleted file mode 100644 index cb65018f8e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.SLPB diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/uevent deleted file mode 100644 index 06585c64c5..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0E:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=button -MODALIAS=acpi:PNP0C0E: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/driver deleted file mode 120000 index 1b3a6d6570..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid deleted file mode 100644 index a00f9f7005..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/modalias deleted file mode 100644 index 26ff254b50..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/path deleted file mode 100644 index 9f95ffde70..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.LNKA diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/uevent deleted file mode 100644 index 8820dec22c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pci_link -MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/driver deleted file mode 120000 index 1b3a6d6570..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid deleted file mode 100644 index a00f9f7005..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/modalias deleted file mode 100644 index 26ff254b50..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/path deleted file mode 100644 index 1d3fe83056..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.LNKB diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/uevent deleted file mode 100644 index 8820dec22c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:01/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pci_link -MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/driver deleted file mode 120000 index 1b3a6d6570..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid deleted file mode 100644 index a00f9f7005..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/modalias deleted file mode 100644 index 26ff254b50..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/path deleted file mode 100644 index 790ff3a5ee..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.LNKC diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/uevent deleted file mode 100644 index 8820dec22c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:02/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pci_link -MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/driver deleted file mode 120000 index 1b3a6d6570..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid deleted file mode 100644 index a00f9f7005..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/modalias deleted file mode 100644 index 26ff254b50..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/path deleted file mode 100644 index 236204ddc8..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.LNKD diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/uevent deleted file mode 100644 index 8820dec22c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:03/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pci_link -MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/driver deleted file mode 120000 index 1b3a6d6570..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid deleted file mode 100644 index a00f9f7005..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/modalias deleted file mode 100644 index 26ff254b50..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/path deleted file mode 100644 index 4c4d0d83ef..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.LNKE diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/uevent deleted file mode 100644 index 8820dec22c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:04/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pci_link -MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/driver deleted file mode 120000 index 1b3a6d6570..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid deleted file mode 100644 index a00f9f7005..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/modalias deleted file mode 100644 index 26ff254b50..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/path deleted file mode 100644 index c3a3967f4a..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.LNKF diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/uevent deleted file mode 100644 index 8820dec22c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:05/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pci_link -MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/driver deleted file mode 120000 index 1b3a6d6570..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid deleted file mode 100644 index a00f9f7005..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/modalias deleted file mode 100644 index 26ff254b50..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/path deleted file mode 100644 index 5d8b3c3609..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.LNKG diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/uevent deleted file mode 100644 index 8820dec22c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:06/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pci_link -MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/driver b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/driver deleted file mode 120000 index 1b3a6d6570..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi/drivers/pci_link \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid deleted file mode 100644 index a00f9f7005..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/hid +++ /dev/null @@ -1 +0,0 @@ -PNP0C0F diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/modalias b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/modalias deleted file mode 100644 index 26ff254b50..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/path b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/path deleted file mode 100644 index 70eac1404b..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_.LNKH diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/subsystem deleted file mode 120000 index 8ec129451f..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/uevent b/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/uevent deleted file mode 100644 index 8820dec22c..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/PNP0C0F:07/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pci_link -MODALIAS=acpi:PNP0C0F: diff --git a/test/sys/devices/LNXSYSTM:00/device:00/path b/test/sys/devices/LNXSYSTM:00/device:00/path deleted file mode 100644 index f914d16ee9..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/path +++ /dev/null @@ -1 +0,0 @@ -\_SB_ diff --git a/test/sys/devices/LNXSYSTM:00/device:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/device:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/device:00/subsystem b/test/sys/devices/LNXSYSTM:00/device:00/subsystem deleted file mode 120000 index a9dfb93327..0000000000 --- a/test/sys/devices/LNXSYSTM:00/device:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/device:00/uevent b/test/sys/devices/LNXSYSTM:00/device:00/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/LNXSYSTM:00/hid b/test/sys/devices/LNXSYSTM:00/hid deleted file mode 100644 index fda0cf0719..0000000000 --- a/test/sys/devices/LNXSYSTM:00/hid +++ /dev/null @@ -1 +0,0 @@ -LNXSYSTM diff --git a/test/sys/devices/LNXSYSTM:00/modalias b/test/sys/devices/LNXSYSTM:00/modalias deleted file mode 100644 index 2d63ad6e4e..0000000000 --- a/test/sys/devices/LNXSYSTM:00/modalias +++ /dev/null @@ -1 +0,0 @@ -acpi:LNXSYSTM: diff --git a/test/sys/devices/LNXSYSTM:00/path b/test/sys/devices/LNXSYSTM:00/path deleted file mode 100644 index 57ddad2aec..0000000000 --- a/test/sys/devices/LNXSYSTM:00/path +++ /dev/null @@ -1 +0,0 @@ -\ diff --git a/test/sys/devices/LNXSYSTM:00/power/wakeup b/test/sys/devices/LNXSYSTM:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/LNXSYSTM:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/LNXSYSTM:00/subsystem b/test/sys/devices/LNXSYSTM:00/subsystem deleted file mode 120000 index 849bcf8601..0000000000 --- a/test/sys/devices/LNXSYSTM:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../bus/acpi \ No newline at end of file diff --git a/test/sys/devices/LNXSYSTM:00/uevent b/test/sys/devices/LNXSYSTM:00/uevent deleted file mode 100644 index 67d9632712..0000000000 --- a/test/sys/devices/LNXSYSTM:00/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=acpi:LNXSYSTM: diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:00.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/class b/test/sys/devices/pci0000:00/0000:00:00.0/class deleted file mode 100644 index fc636cd5b1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/class +++ /dev/null @@ -1 +0,0 @@ -0x060000 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/config b/test/sys/devices/pci0000:00/0000:00:00.0/config deleted file mode 100644 index 971699c343..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:00.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/device b/test/sys/devices/pci0000:00/0000:00:00.0/device deleted file mode 100644 index 0b573abbac..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/device +++ /dev/null @@ -1 +0,0 @@ -0x27a0 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/enable b/test/sys/devices/pci0000:00/0000:00:00.0/enable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/enable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/irq b/test/sys/devices/pci0000:00/0000:00:00.0/irq deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/irq +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:00.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:00.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:00.0/modalias deleted file mode 100644 index 0682834866..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027A0sv000017AAsd00002015bc06sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:00.0/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:00.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/resource b/test/sys/devices/pci0000:00/0000:00:00.0/resource deleted file mode 100644 index 2d8766d6a3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:00.0/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_device deleted file mode 100644 index 4762874631..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x2015 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:00.0/uevent deleted file mode 100644 index 067e9d055f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/uevent +++ /dev/null @@ -1,5 +0,0 @@ -PCI_CLASS=60000 -PCI_ID=8086:27A0 -PCI_SUBSYS_ID=17AA:2015 -PCI_SLOT_NAME=0000:00:00.0 -MODALIAS=pci:v00008086d000027A0sv000017AAsd00002015bc06sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:00.0/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:00.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie00/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/0000:00:01.0:pcie03/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/class b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/class deleted file mode 100644 index c5f02e331c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/class +++ /dev/null @@ -1 +0,0 @@ -0x030000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/config b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/config deleted file mode 100644 index fd5c966343..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/device b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/device deleted file mode 100644 index 91130e3409..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/device +++ /dev/null @@ -1 +0,0 @@ -0x71d4 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/enable b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/enable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/enable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/firmware_node deleted file mode 120000 index e9679446a9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../../LNXSYSTM:00/device:00/PNP0A08:00/device:06/device:07 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/irq b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/irq deleted file mode 100644 index b4de394767..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/irq +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/modalias deleted file mode 100644 index 8ee72c88ae..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00001002d000071D4sv000017AAsd000020A4bc03sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource deleted file mode 100644 index c58a0ad747..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x00000000d0000000 0x00000000dfffffff 0x0000000000021208 -0x0000000000002000 0x00000000000020ff 0x0000000000020101 -0x00000000ee100000 0x00000000ee10ffff 0x0000000000020200 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x00000000ee120000 0x00000000ee13ffff 0x0000000000027202 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0 b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0_wc b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource0_wc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource1 b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource1 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource2 b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/resource2 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/rom deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem deleted file mode 120000 index d6210992bb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_device deleted file mode 100644 index 7d855fa37b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x20a4 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/uevent deleted file mode 100644 index 3e8cb35af4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/uevent +++ /dev/null @@ -1,5 +0,0 @@ -PCI_CLASS=30000 -PCI_ID=1002:71D4 -PCI_SUBSYS_ID=17AA:20A4 -PCI_SLOT_NAME=0000:01:00.0 -MODALIAS=pci:v00001002d000071D4sv000017AAsd000020A4bc03sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/vendor deleted file mode 100644 index 7f97d854fc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x1002 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:01.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/class b/test/sys/devices/pci0000:00/0000:00:01.0/class deleted file mode 100644 index 8b40e6a7b7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/class +++ /dev/null @@ -1 +0,0 @@ -0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/config b/test/sys/devices/pci0000:00/0000:00:01.0/config deleted file mode 100644 index e4f57f0cdb..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:01.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/device b/test/sys/devices/pci0000:00/0000:00:01.0/device deleted file mode 100644 index 10f865d779..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/device +++ /dev/null @@ -1 +0,0 @@ -0x27a1 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/driver b/test/sys/devices/pci0000:00/0000:00:01.0/driver deleted file mode 120000 index b30b691e0c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/enable b/test/sys/devices/pci0000:00/0000:00:01.0/enable deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/enable +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:01.0/firmware_node deleted file mode 120000 index d17adf10f9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:06 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/irq b/test/sys/devices/pci0000:00/0000:00:01.0/irq deleted file mode 100644 index c0556fb20f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/irq +++ /dev/null @@ -1 +0,0 @@ -511 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:01.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:01.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/modalias b/test/sys/devices/pci0000:00/0000:00:01.0/modalias deleted file mode 100644 index 61e49dd13c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027A1sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:01.0/msi_bus deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/msi_bus +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/cpuaffinity deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/cpuaffinity +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/device b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/device deleted file mode 120000 index 538f478101..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:01.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/subsystem deleted file mode 120000 index 1d26d30581..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/pci_bus/0000:01/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:01.0/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/resource b/test/sys/devices/pci0000:00/0000:00:01.0/resource deleted file mode 100644 index 5a19d3a09c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/resource +++ /dev/null @@ -1,12 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000002000 0x0000000000002fff 0x0000000000000100 -0x00000000ee100000 0x00000000ee1fffff 0x0000000000000200 -0x00000000d0000000 0x00000000dfffffff 0x0000000000001201 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/subsystem b/test/sys/devices/pci0000:00/0000:00:01.0/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_device deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_vendor deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/uevent b/test/sys/devices/pci0000:00/0000:00:01.0/uevent deleted file mode 100644 index f2616c08c3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=pcieport-driver -PCI_CLASS=60400 -PCI_ID=8086:27A1 -PCI_SUBSYS_ID=0000:0000 -PCI_SLOT_NAME=0000:00:01.0 -MODALIAS=pci:v00008086d000027A1sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:01.0/vendor b/test/sys/devices/pci0000:00/0000:00:01.0/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:01.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1b.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/class b/test/sys/devices/pci0000:00/0000:00:1b.0/class deleted file mode 100644 index 3c2627acb0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/class +++ /dev/null @@ -1 +0,0 @@ -0x040300 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/config b/test/sys/devices/pci0000:00/0000:00:1b.0/config deleted file mode 100644 index 1eef27b506..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1b.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/device b/test/sys/devices/pci0000:00/0000:00:1b.0/device deleted file mode 100644 index 9025bfeec0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/device +++ /dev/null @@ -1 +0,0 @@ -0x27d8 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/driver b/test/sys/devices/pci0000:00/0000:00:1b.0/driver deleted file mode 120000 index 5e8e0d3965..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/HDA Intel \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/enable b/test/sys/devices/pci0000:00/0000:00:1b.0/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1b.0/firmware_node deleted file mode 120000 index eadb0cff46..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:25 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/irq b/test/sys/devices/pci0000:00/0000:00:1b.0/irq deleted file mode 100644 index 98d9bcb75a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/irq +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/modalias b/test/sys/devices/pci0000:00/0000:00:1b.0/modalias deleted file mode 100644 index 91d145cd1e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027D8sv000017AAsd00002010bc04sc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1b.0/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/resource b/test/sys/devices/pci0000:00/0000:00:1b.0/resource deleted file mode 100644 index a9b7ff4d10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x00000000ee400000 0x00000000ee403fff 0x0000000000020204 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/resource0 b/test/sys/devices/pci0000:00/0000:00:1b.0/resource0 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/dev deleted file mode 100644 index 78881128c5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/dev +++ /dev/null @@ -1 +0,0 @@ -14:12 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/device deleted file mode 120000 index ea6bff6f6f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/device +++ /dev/null @@ -1 +0,0 @@ -../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/subsystem deleted file mode 120000 index 1fc6fc816b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/uevent deleted file mode 100644 index 89e2bf79bd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/adsp/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=14 -MINOR=12 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/dev deleted file mode 100644 index 17abe70697..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/dev +++ /dev/null @@ -1 +0,0 @@ -14:4 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/device deleted file mode 120000 index ea6bff6f6f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/device +++ /dev/null @@ -1 +0,0 @@ -../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/subsystem deleted file mode 120000 index 1fc6fc816b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/uevent deleted file mode 100644 index 23e5010b03..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/audio/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=14 -MINOR=4 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/dev deleted file mode 100644 index 0113082e4c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/dev +++ /dev/null @@ -1 +0,0 @@ -116:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/device deleted file mode 120000 index ea6bff6f6f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/device +++ /dev/null @@ -1 +0,0 @@ -../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/subsystem deleted file mode 120000 index 1fc6fc816b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/uevent deleted file mode 100644 index d2f63999d2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/controlC0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=116 -MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/device deleted file mode 120000 index 1cef4e5894..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1b.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/dev deleted file mode 100644 index c2063c2f70..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/dev +++ /dev/null @@ -1 +0,0 @@ -14:3 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/device deleted file mode 120000 index ea6bff6f6f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/device +++ /dev/null @@ -1 +0,0 @@ -../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/subsystem deleted file mode 120000 index 1fc6fc816b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent deleted file mode 100644 index 34ffea3b16..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/dsp/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=14 -MINOR=3 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/dev deleted file mode 100644 index 32f50eb60a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/dev +++ /dev/null @@ -1 +0,0 @@ -14:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/device deleted file mode 120000 index ea6bff6f6f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/device +++ /dev/null @@ -1 +0,0 @@ -../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/subsystem deleted file mode 120000 index 1fc6fc816b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/uevent deleted file mode 100644 index 1d6618a675..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/mixer/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=14 -MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/dev deleted file mode 100644 index 81ad956b04..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/dev +++ /dev/null @@ -1 +0,0 @@ -116:24 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/device deleted file mode 120000 index ea6bff6f6f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/device +++ /dev/null @@ -1 +0,0 @@ -../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class deleted file mode 100644 index 6ab389274c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/pcm_class +++ /dev/null @@ -1 +0,0 @@ -generic diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/subsystem deleted file mode 120000 index 1fc6fc816b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/uevent deleted file mode 100644 index 2185936b2a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0c/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=116 -MINOR=24 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/dev deleted file mode 100644 index ecbfb9c12e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/dev +++ /dev/null @@ -1 +0,0 @@ -116:16 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/device deleted file mode 120000 index ea6bff6f6f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/device +++ /dev/null @@ -1 +0,0 @@ -../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class deleted file mode 100644 index 6ab389274c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/pcm_class +++ /dev/null @@ -1 +0,0 @@ -generic diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/subsystem deleted file mode 120000 index 1fc6fc816b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/uevent deleted file mode 100644 index 5dcc942c02..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D0p/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=116 -MINOR=16 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/dev b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/dev deleted file mode 100644 index 546caa3cf9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/dev +++ /dev/null @@ -1 +0,0 @@ -116:17 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/device b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/device deleted file mode 120000 index ea6bff6f6f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/device +++ /dev/null @@ -1 +0,0 @@ -../../card0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class deleted file mode 100644 index 6ab389274c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/pcm_class +++ /dev/null @@ -1 +0,0 @@ -generic diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/subsystem deleted file mode 120000 index 1fc6fc816b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/uevent deleted file mode 100644 index 54775d251c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/pcmC0D1p/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=116 -MINOR=17 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/subsystem deleted file mode 120000 index 5159c1f494..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/sound/card0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_device deleted file mode 100644 index 50e277c1bf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x2010 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/uevent b/test/sys/devices/pci0000:00/0000:00:1b.0/uevent deleted file mode 100644 index 4c0291ed5e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=HDA Intel -PCI_CLASS=40300 -PCI_ID=8086:27D8 -PCI_SUBSYS_ID=17AA:2010 -PCI_SLOT_NAME=0000:00:1b.0 -MODALIAS=pci:v00008086d000027D8sv000017AAsd00002010bc04sc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1b.0/vendor b/test/sys/devices/pci0000:00/0000:00:1b.0/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1b.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie00/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie02/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:00:1c.0:pcie03/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/class b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/class deleted file mode 100644 index 2f9c1dada8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/class +++ /dev/null @@ -1 +0,0 @@ -0x020000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/config b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/config deleted file mode 100644 index 171b3f9cf5..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/device b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/device deleted file mode 100644 index 67c31bd657..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/device +++ /dev/null @@ -1 +0,0 @@ -0x109a diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/driver b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/driver deleted file mode 120000 index 2b53f77214..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci/drivers/e1000e \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/enable b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/irq b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/irq deleted file mode 100644 index f573e999ac..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/irq +++ /dev/null @@ -1 +0,0 @@ -505 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/modalias deleted file mode 100644 index 30a5e00f88..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d0000109Asv000017AAsd00002001bc02sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/addr_len b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/addr_len deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/addr_len +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/address b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/address deleted file mode 100644 index 1f26c2166a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/address +++ /dev/null @@ -1 +0,0 @@ -00:16:41:e2:8d:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/broadcast b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/broadcast deleted file mode 100644 index d516b03245..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/broadcast +++ /dev/null @@ -1 +0,0 @@ -ff:ff:ff:ff:ff:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/carrier b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/carrier deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/carrier +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dev_id b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dev_id deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dev_id +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/device b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/device deleted file mode 120000 index ffee7993af..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:02:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dormant b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dormant deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/dormant +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/features b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/features deleted file mode 100644 index be03677532..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/features +++ /dev/null @@ -1 +0,0 @@ -0x111ba9 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/flags b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/flags deleted file mode 100644 index 8198c040f7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/flags +++ /dev/null @@ -1 +0,0 @@ -0x1003 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/ifindex b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/ifindex deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/ifindex +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/iflink b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/iflink deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/iflink +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/link_mode b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/link_mode deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/link_mode +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/mtu b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/mtu deleted file mode 100644 index 3d86ec6498..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/mtu +++ /dev/null @@ -1 +0,0 @@ -1500 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/operstate b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/operstate deleted file mode 100644 index eb0e90439e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/operstate +++ /dev/null @@ -1 +0,0 @@ -down diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/collisions b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/collisions deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/collisions +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/multicast b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/multicast deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/multicast +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_bytes deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_bytes +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_compressed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_compressed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_crc_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_crc_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_crc_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_dropped deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_dropped +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_fifo_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_fifo_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_frame_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_frame_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_frame_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_length_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_length_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_length_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_missed_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_missed_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_missed_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_over_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_over_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_over_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_packets b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_packets deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/rx_packets +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_aborted_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_aborted_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_aborted_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_bytes deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_bytes +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_carrier_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_carrier_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_carrier_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_compressed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_compressed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_dropped deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_dropped +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_fifo_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_fifo_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_heartbeat_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_heartbeat_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_heartbeat_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_packets b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_packets deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_packets +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_window_errors b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_window_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/statistics/tx_window_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/subsystem deleted file mode 120000 index b9058136e4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/net \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/tx_queue_len b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/tx_queue_len deleted file mode 100644 index 83b33d238d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/tx_queue_len +++ /dev/null @@ -1 +0,0 @@ -1000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/type b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/type deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/type +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/uevent deleted file mode 100644 index f819639c91..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/net/eth0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -INTERFACE=eth0 -IFINDEX=2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource deleted file mode 100644 index 1ae54bc336..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x00000000ee000000 0x00000000ee01ffff 0x0000000000020200 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000003000 0x000000000000301f 0x0000000000020101 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource0 b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource0 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource2 b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/resource2 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem deleted file mode 120000 index d6210992bb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_device deleted file mode 100644 index 2c5221be24..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x2001 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/uevent deleted file mode 100644 index 7698cc6193..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=e1000e -PCI_CLASS=20000 -PCI_ID=8086:109A -PCI_SUBSYS_ID=17AA:2001 -PCI_SLOT_NAME=0000:02:00.0 -MODALIAS=pci:v00008086d0000109Asv000017AAsd00002001bc02sc00i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/class b/test/sys/devices/pci0000:00/0000:00:1c.0/class deleted file mode 100644 index 8b40e6a7b7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/class +++ /dev/null @@ -1 +0,0 @@ -0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/config b/test/sys/devices/pci0000:00/0000:00:1c.0/config deleted file mode 100644 index 4e1f907b34..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/device b/test/sys/devices/pci0000:00/0000:00:1c.0/device deleted file mode 100644 index 4f6c1fb911..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/device +++ /dev/null @@ -1 +0,0 @@ -0x27d0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/driver b/test/sys/devices/pci0000:00/0000:00:1c.0/driver deleted file mode 120000 index b30b691e0c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/enable b/test/sys/devices/pci0000:00/0000:00:1c.0/enable deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/enable +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1c.0/firmware_node deleted file mode 120000 index 8542a81a99..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:0b \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/irq b/test/sys/devices/pci0000:00/0000:00:1c.0/irq deleted file mode 100644 index 2bc4cd64b8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/irq +++ /dev/null @@ -1 +0,0 @@ -510 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/modalias b/test/sys/devices/pci0000:00/0000:00:1c.0/modalias deleted file mode 100644 index 4433f5b340..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027D0sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/msi_bus +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/cpuaffinity deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/cpuaffinity +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/device b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/device deleted file mode 120000 index 3148dbbb01..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1c.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/subsystem deleted file mode 120000 index 1d26d30581..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/pci_bus/0000:02/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.0/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/resource b/test/sys/devices/pci0000:00/0000:00:1c.0/resource deleted file mode 100644 index 60c3557063..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/resource +++ /dev/null @@ -1,12 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000003000 0x0000000000003fff 0x0000000000000100 -0x00000000ee000000 0x00000000ee0fffff 0x0000000000000200 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_device deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_vendor deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.0/uevent deleted file mode 100644 index 0b6e3b5cc2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=pcieport-driver -PCI_CLASS=60400 -PCI_ID=8086:27D0 -PCI_SUBSYS_ID=0000:0000 -PCI_SLOT_NAME=0000:00:1c.0 -MODALIAS=pci:v00008086d000027D0sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.0/vendor b/test/sys/devices/pci0000:00/0000:00:1c.0/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie00/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie02/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:00:1c.1:pcie03/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/antenna b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/antenna deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/antenna +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/channels b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/channels deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/class b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/class deleted file mode 100644 index 52e8d0c98d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/class +++ /dev/null @@ -1 +0,0 @@ -0x028000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/config b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/config deleted file mode 100644 index 27de3fdc36..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/device deleted file mode 100644 index fc9475debf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/device +++ /dev/null @@ -1 +0,0 @@ -0x4227 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/driver b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/driver deleted file mode 120000 index c01b848be9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci/drivers/iwl3945 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/enable b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/filter_flags b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/filter_flags deleted file mode 100644 index 4d3011b503..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/filter_flags +++ /dev/null @@ -1 +0,0 @@ -0x0024 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/flags b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/flags deleted file mode 100644 index 47c2bd8f43..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/flags +++ /dev/null @@ -1 +0,0 @@ -0x8015 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/device deleted file mode 120000 index a9ab757999..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/index +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/macaddress b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/macaddress deleted file mode 100644 index c3b402d820..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/macaddress +++ /dev/null @@ -1 +0,0 @@ -00:19:d2:75:ae:d1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/subsystem deleted file mode 120000 index a124df1449..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/ieee80211 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/ieee80211/phy0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/irq b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/irq deleted file mode 100644 index 3091e8eea2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/irq +++ /dev/null @@ -1 +0,0 @@ -504 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/brightness b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/brightness and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/device deleted file mode 120000 index a9ab757999..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/subsystem deleted file mode 120000 index eaca89c4c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/trigger b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/trigger deleted file mode 100644 index 347fc33e63..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/trigger +++ /dev/null @@ -1 +0,0 @@ -none AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 [phy0rx] phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:RX/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/brightness b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/brightness and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/device deleted file mode 120000 index a9ab757999..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/subsystem deleted file mode 120000 index eaca89c4c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/trigger b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/trigger deleted file mode 100644 index 36ae426791..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/trigger +++ /dev/null @@ -1 +0,0 @@ -none AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx [phy0tx] phy0assoc phy0radio diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:TX/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/brightness b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/brightness deleted file mode 100644 index 8364fdecfc..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/brightness and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/device deleted file mode 120000 index a9ab757999..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/subsystem deleted file mode 120000 index eaca89c4c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/trigger b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/trigger deleted file mode 100644 index c1d0a0ed64..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/trigger +++ /dev/null @@ -1 +0,0 @@ -none AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx [phy0assoc] phy0radio diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:assoc/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/brightness b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/brightness deleted file mode 100644 index 8364fdecfc..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/brightness and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/device deleted file mode 120000 index a9ab757999..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/subsystem deleted file mode 120000 index eaca89c4c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/trigger b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/trigger deleted file mode 100644 index 53846e2627..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/trigger +++ /dev/null @@ -1 +0,0 @@ -none AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc [phy0radio] diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/leds/iwl-phy0:radio/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/measurement b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/measurement deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/modalias deleted file mode 100644 index 6a633532bf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d00004227sv00008086sd00001011bc02sc80i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/addr_len +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/address b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/address deleted file mode 100644 index 20ffb99c00..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/address +++ /dev/null @@ -1 +0,0 @@ -00:19:d2:75:ae:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast deleted file mode 100644 index d516b03245..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/broadcast +++ /dev/null @@ -1 +0,0 @@ -ff:ff:ff:ff:ff:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/carrier b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/carrier deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/carrier +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dev_id +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/device deleted file mode 120000 index a9ab757999..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dormant b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dormant deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/dormant +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/features b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/features deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/features +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/flags b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/flags deleted file mode 100644 index 8198c040f7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/flags +++ /dev/null @@ -1 +0,0 @@ -0x1003 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/ifindex +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/iflink b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/iflink deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/iflink +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/link_mode +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/mtu b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/mtu deleted file mode 100644 index 3d86ec6498..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/mtu +++ /dev/null @@ -1 +0,0 @@ -1500 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/operstate b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/operstate deleted file mode 100644 index e31ee94e17..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/operstate +++ /dev/null @@ -1 +0,0 @@ -up diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 deleted file mode 120000 index 4796453191..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/phy80211 +++ /dev/null @@ -1 +0,0 @@ -../../ieee80211/phy0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/collisions b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/collisions deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/collisions +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/multicast b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/multicast deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/multicast +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes deleted file mode 100644 index cecd5503f4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_bytes +++ /dev/null @@ -1 +0,0 @@ -289996 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_compressed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_compressed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_crc_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_crc_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_crc_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_dropped deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_dropped +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_fifo_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_fifo_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_frame_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_frame_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_frame_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_length_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_length_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_length_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_missed_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_missed_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_missed_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_over_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_over_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_over_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets deleted file mode 100644 index cbdc9073bf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/rx_packets +++ /dev/null @@ -1 +0,0 @@ -788 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_aborted_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_aborted_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_aborted_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes deleted file mode 100644 index 14a39c90ad..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_bytes +++ /dev/null @@ -1 +0,0 @@ -530013 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_carrier_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_carrier_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_carrier_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_compressed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_compressed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_dropped deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_dropped +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_fifo_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_fifo_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_heartbeat_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_heartbeat_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_heartbeat_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets deleted file mode 100644 index 5208b59131..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_packets +++ /dev/null @@ -1 +0,0 @@ -1029 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_window_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_window_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/statistics/tx_window_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem deleted file mode 120000 index b9058136e4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/net \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/tx_queue_len b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/tx_queue_len deleted file mode 100644 index 83b33d238d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/tx_queue_len +++ /dev/null @@ -1 +0,0 @@ -1000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/type b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/type deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/type +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/uevent deleted file mode 100644 index 3e19b5de47..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -INTERFACE=wlan0 -IFINDEX=4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/beacon b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/beacon deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/beacon +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/crypt b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/crypt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/crypt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/fragment b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/fragment deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/fragment +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level deleted file mode 100644 index aa34eab5fe..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/level +++ /dev/null @@ -1 +0,0 @@ -199 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link deleted file mode 100644 index 987e7ca9a7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/link +++ /dev/null @@ -1 +0,0 @@ -77 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/misc b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/misc deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/misc +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise deleted file mode 100644 index f84d24e50a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/noise +++ /dev/null @@ -1 +0,0 @@ -178 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/nwid b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/nwid deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/nwid +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/retries b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/retries deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/retries +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/status b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/status deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wlan0/wireless/status +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/addr_len b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/addr_len deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/addr_len +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/address b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/address deleted file mode 100644 index 20ffb99c00..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/address +++ /dev/null @@ -1 +0,0 @@ -00:19:d2:75:ae:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/broadcast b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/broadcast deleted file mode 100644 index d516b03245..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/broadcast +++ /dev/null @@ -1 +0,0 @@ -ff:ff:ff:ff:ff:ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/carrier +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dev_id +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/device deleted file mode 120000 index a9ab757999..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:03:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/dormant +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/features b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/features deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/features +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/flags b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/flags deleted file mode 100644 index 8198c040f7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/flags +++ /dev/null @@ -1 +0,0 @@ -0x1003 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/ifindex +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/iflink +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/link_mode b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/link_mode deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/link_mode +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu deleted file mode 100644 index 3d86ec6498..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/mtu +++ /dev/null @@ -1 +0,0 @@ -1500 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/operstate b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/operstate deleted file mode 100644 index 3546645658..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/operstate +++ /dev/null @@ -1 +0,0 @@ -unknown diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/phy80211 b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/phy80211 deleted file mode 120000 index 4796453191..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/phy80211 +++ /dev/null @@ -1 +0,0 @@ -../../ieee80211/phy0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/collisions b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/collisions deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/collisions +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/multicast b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/multicast deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/multicast +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_bytes deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_bytes +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_compressed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_compressed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_crc_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_crc_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_crc_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_dropped deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_dropped +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_fifo_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_fifo_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_frame_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_frame_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_frame_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_length_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_length_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_length_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_missed_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_missed_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_missed_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_over_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_over_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_over_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_packets deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/rx_packets +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_aborted_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_aborted_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_aborted_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_bytes b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_bytes deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_bytes +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_carrier_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_carrier_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_carrier_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_compressed b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_compressed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_compressed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_dropped b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_dropped deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_dropped +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_fifo_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_fifo_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_fifo_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_heartbeat_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_heartbeat_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_heartbeat_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_packets b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_packets deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_packets +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_window_errors b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_window_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/statistics/tx_window_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/subsystem deleted file mode 120000 index b9058136e4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/net \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/tx_queue_len b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/tx_queue_len deleted file mode 100644 index 83b33d238d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/tx_queue_len +++ /dev/null @@ -1 +0,0 @@ -1000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/type b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/type deleted file mode 100644 index 8bce69f505..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/type +++ /dev/null @@ -1 +0,0 @@ -801 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent deleted file mode 100644 index 23a068bf7b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/net/wmaster0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -INTERFACE=wmaster0 -IFINDEX=3 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power_level b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power_level deleted file mode 100644 index 067791e80f..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/power_level and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource deleted file mode 100644 index 9f377a76e9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x00000000edf00000 0x00000000edf00fff 0x0000000000020200 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource0 b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/resource0 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/retry_rate b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/retry_rate deleted file mode 100644 index 56a6051ca2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/retry_rate +++ /dev/null @@ -1 +0,0 @@ -1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window deleted file mode 100644 index 19f86cea0f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/rs_window +++ /dev/null @@ -1,14 +0,0 @@ - 54Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 48Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 36Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 24Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 18Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 12Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 11Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 9Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 6Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 5Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 2Mbs: 00000000000000000000000000000000000000000000000000000000000000 - 1Mbs: 00000000000000000000000000000000000000000000000000000000000000 - -Average rate: 0Mbs diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics deleted file mode 100644 index f8b4855266..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/statistics +++ /dev/null @@ -1,15 +0,0 @@ -02 00 01 00 a4 c0 02 00 c6 27 01 00 80 16 01 00 .........'...... -e9 0c 00 00 00 00 00 00 00 00 00 00 69 05 00 00 ............i... -de 98 01 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ -00 00 00 00 00 00 00 00 bd 01 00 00 00 00 00 00 ................ -fd 68 08 00 ae d3 06 00 78 65 04 00 b8 2b 00 00 .h......xe...+.. -00 00 00 00 00 00 00 00 7e 42 02 00 4f 95 01 00 ........~B..O... -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ -00 00 00 00 da 01 00 00 00 00 00 00 00 00 00 00 ................ -00 00 00 00 d8 dc 00 00 59 10 01 00 00 00 00 00 ........Y....... -df 0c 00 00 16 00 00 00 00 00 00 00 00 00 00 00 ................ -88 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ................ -00 00 00 00 72 ff ff ff 00 00 00 00 00 00 00 00 ....r........... -00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ -00 00 00 00 01 00 00 00 bb 45 98 35 1c 91 e7 f1 .........E.5.... -4c 19 00 00 c2 0c 00 00 e7 ed 00 00 1c 4c 00 00 L............L.. diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/status b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/status deleted file mode 100644 index 9aa3c58dd0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/status +++ /dev/null @@ -1 +0,0 @@ -0x000002e4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem deleted file mode 120000 index d6210992bb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_device deleted file mode 100644 index 027a57369a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x1011 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature deleted file mode 100644 index 92e20e6058..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/temperature +++ /dev/null @@ -1 +0,0 @@ --142 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/tx_power +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/uevent deleted file mode 100644 index 3b5ab70143..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=iwl3945 -PCI_CLASS=28000 -PCI_ID=8086:4227 -PCI_SUBSYS_ID=8086:1011 -PCI_SLOT_NAME=0000:03:00.0 -MODALIAS=pci:v00008086d00004227sv00008086sd00001011bc02sc80i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/0000:03:00.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.1/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/class b/test/sys/devices/pci0000:00/0000:00:1c.1/class deleted file mode 100644 index 8b40e6a7b7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/class +++ /dev/null @@ -1 +0,0 @@ -0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/config b/test/sys/devices/pci0000:00/0000:00:1c.1/config deleted file mode 100644 index eab8639f6d..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.1/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/device b/test/sys/devices/pci0000:00/0000:00:1c.1/device deleted file mode 100644 index 31a89f4aac..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/device +++ /dev/null @@ -1 +0,0 @@ -0x27d2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/driver b/test/sys/devices/pci0000:00/0000:00:1c.1/driver deleted file mode 120000 index b30b691e0c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/enable b/test/sys/devices/pci0000:00/0000:00:1c.1/enable deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/enable +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/firmware_node b/test/sys/devices/pci0000:00/0000:00:1c.1/firmware_node deleted file mode 120000 index 2166c3933d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:0c \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/irq b/test/sys/devices/pci0000:00/0000:00:1c.1/irq deleted file mode 100644 index 77afe238f2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/irq +++ /dev/null @@ -1 +0,0 @@ -509 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/modalias b/test/sys/devices/pci0000:00/0000:00:1c.1/modalias deleted file mode 100644 index 709bec5825..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027D2sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/msi_bus +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/cpuaffinity deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/cpuaffinity +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/device b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/device deleted file mode 120000 index 63c77b404e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1c.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/subsystem deleted file mode 120000 index 1d26d30581..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/pci_bus/0000:03/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.1/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/resource b/test/sys/devices/pci0000:00/0000:00:1c.1/resource deleted file mode 100644 index da3f0b15b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/resource +++ /dev/null @@ -1,12 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000004000 0x0000000000005fff 0x0000000000000100 -0x00000000ec000000 0x00000000edffffff 0x0000000000000200 -0x00000000e4000000 0x00000000e40fffff 0x0000000000001201 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_device deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_vendor deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/uevent b/test/sys/devices/pci0000:00/0000:00:1c.1/uevent deleted file mode 100644 index 1146b4efcc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=pcieport-driver -PCI_CLASS=60400 -PCI_ID=8086:27D2 -PCI_SUBSYS_ID=0000:0000 -PCI_SLOT_NAME=0000:00:1c.1 -MODALIAS=pci:v00008086d000027D2sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.1/vendor b/test/sys/devices/pci0000:00/0000:00:1c.1/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.1/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie00/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie02/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/0000:00:1c.2:pcie03/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.2/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/class b/test/sys/devices/pci0000:00/0000:00:1c.2/class deleted file mode 100644 index 8b40e6a7b7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/class +++ /dev/null @@ -1 +0,0 @@ -0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/config b/test/sys/devices/pci0000:00/0000:00:1c.2/config deleted file mode 100644 index 3ef4d02b0e..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.2/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/device b/test/sys/devices/pci0000:00/0000:00:1c.2/device deleted file mode 100644 index 05e3bd983c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/device +++ /dev/null @@ -1 +0,0 @@ -0x27d4 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/driver b/test/sys/devices/pci0000:00/0000:00:1c.2/driver deleted file mode 120000 index b30b691e0c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/enable b/test/sys/devices/pci0000:00/0000:00:1c.2/enable deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/enable +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/firmware_node b/test/sys/devices/pci0000:00/0000:00:1c.2/firmware_node deleted file mode 120000 index c20611ecef..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:0d \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/irq b/test/sys/devices/pci0000:00/0000:00:1c.2/irq deleted file mode 100644 index 1eccde1106..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/irq +++ /dev/null @@ -1 +0,0 @@ -508 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/modalias b/test/sys/devices/pci0000:00/0000:00:1c.2/modalias deleted file mode 100644 index ce84663a01..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027D4sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/msi_bus +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/cpuaffinity deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/cpuaffinity +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/device b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/device deleted file mode 120000 index 4009572037..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1c.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/subsystem deleted file mode 120000 index 1d26d30581..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/pci_bus/0000:04/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.2/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/resource b/test/sys/devices/pci0000:00/0000:00:1c.2/resource deleted file mode 100644 index e7480e66c9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/resource +++ /dev/null @@ -1,12 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000006000 0x0000000000007fff 0x0000000000000100 -0x00000000e8000000 0x00000000e9ffffff 0x0000000000000200 -0x00000000e4100000 0x00000000e41fffff 0x0000000000001201 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_device deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_vendor deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/uevent b/test/sys/devices/pci0000:00/0000:00:1c.2/uevent deleted file mode 100644 index 3e9124e423..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=pcieport-driver -PCI_CLASS=60400 -PCI_ID=8086:27D4 -PCI_SUBSYS_ID=0000:0000 -PCI_SLOT_NAME=0000:00:1c.2 -MODALIAS=pci:v00008086d000027D4sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.2/vendor b/test/sys/devices/pci0000:00/0000:00:1c.2/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.2/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie00/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie02/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/subsystem deleted file mode 120000 index 60163d477b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci_express \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/0000:00:1c.3:pcie03/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1c.3/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/class b/test/sys/devices/pci0000:00/0000:00:1c.3/class deleted file mode 100644 index 8b40e6a7b7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/class +++ /dev/null @@ -1 +0,0 @@ -0x060400 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/config b/test/sys/devices/pci0000:00/0000:00:1c.3/config deleted file mode 100644 index 21a16d3c02..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1c.3/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/device b/test/sys/devices/pci0000:00/0000:00:1c.3/device deleted file mode 100644 index 77699e3094..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/device +++ /dev/null @@ -1 +0,0 @@ -0x27d6 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/driver b/test/sys/devices/pci0000:00/0000:00:1c.3/driver deleted file mode 120000 index b30b691e0c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/pcieport-driver \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/enable b/test/sys/devices/pci0000:00/0000:00:1c.3/enable deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/enable +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/firmware_node b/test/sys/devices/pci0000:00/0000:00:1c.3/firmware_node deleted file mode 120000 index 5252d6b90f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:0f \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/irq b/test/sys/devices/pci0000:00/0000:00:1c.3/irq deleted file mode 100644 index 055b6671a5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/irq +++ /dev/null @@ -1 +0,0 @@ -507 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpus b/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/modalias b/test/sys/devices/pci0000:00/0000:00:1c.3/modalias deleted file mode 100644 index e0f4ef6c00..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027D6sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus b/test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/msi_bus +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/cpuaffinity deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/cpuaffinity +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device deleted file mode 120000 index ef57e893c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1c.3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/subsystem deleted file mode 120000 index 1d26d30581..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/pci_bus/0000:0c/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1c.3/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/resource b/test/sys/devices/pci0000:00/0000:00:1c.3/resource deleted file mode 100644 index cc54a66782..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/resource +++ /dev/null @@ -1,12 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000008000 0x0000000000009fff 0x0000000000000100 -0x00000000ea000000 0x00000000ebffffff 0x0000000000000200 -0x00000000e4200000 0x00000000e42fffff 0x0000000000001201 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_device deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_vendor deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/uevent b/test/sys/devices/pci0000:00/0000:00:1c.3/uevent deleted file mode 100644 index 1478a5df5e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=pcieport-driver -PCI_CLASS=60400 -PCI_ID=8086:27D6 -PCI_SUBSYS_ID=0000:0000 -PCI_SLOT_NAME=0000:00:1c.3 -MODALIAS=pci:v00008086d000027D6sv00000000sd00000000bc06sc04i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1c.3/vendor b/test/sys/devices/pci0000:00/0000:00:1c.3/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1c.3/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/class b/test/sys/devices/pci0000:00/0000:00:1d.0/class deleted file mode 100644 index 233dcce516..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/class +++ /dev/null @@ -1 +0,0 @@ -0x0c0300 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/config b/test/sys/devices/pci0000:00/0000:00:1d.0/config deleted file mode 100644 index 0b41a78483..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/device b/test/sys/devices/pci0000:00/0000:00:1d.0/device deleted file mode 100644 index 80d993702f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/device +++ /dev/null @@ -1 +0,0 @@ -0x27c8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.0/driver deleted file mode 120000 index ed69e37601..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/enable b/test/sys/devices/pci0000:00/0000:00:1d.0/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.0/firmware_node deleted file mode 120000 index 50216bb7f4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:19 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/irq b/test/sys/devices/pci0000:00/0000:00:1d.0/irq deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/irq +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.0/modalias deleted file mode 100644 index 30a46dde13..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027C8sv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.0/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/pools b/test/sys/devices/pci0000:00/0000:00:1d.0/pools deleted file mode 100644 index 6f8c27bbc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/pools +++ /dev/null @@ -1,7 +0,0 @@ -poolinfo - 0.1 -uhci_qh 11 32 128 1 -uhci_td 1 64 64 1 -buffer-2048 0 0 2048 0 -buffer-512 0 0 512 0 -buffer-128 0 0 128 0 -buffer-32 1 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/resource b/test/sys/devices/pci0000:00/0000:00:1d.0/resource deleted file mode 100644 index 30e43da8a7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000001800 0x000000000000181f 0x0000000000020101 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/resource4 b/test/sys/devices/pci0000:00/0000:00:1d.0/resource4 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_device deleted file mode 100644 index dcce13f2d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x200a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/uevent deleted file mode 100644 index 0a55a0c851..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=uhci_hcd -PCI_CLASS=C0300 -PCI_ID=8086:27C8 -PCI_SUBSYS_ID=17AA:200A -PCI_SLOT_NAME=0000:00:1d.0 -MODALIAS=pci:v00008086d000027C8sv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver deleted file mode 120000 index 5cf493442c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 deleted file mode 120000 index 1c42b874b8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev1.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias deleted file mode 100644 index a27a9fdc71..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent deleted file mode 100644 index ffd136d9e1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DEVTYPE=usb_interface -DRIVER=hub -PRODUCT=1d6b/1/206 -TYPE=9/0/0 -INTERFACE=9/0/0 -MODALIAS=usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev deleted file mode 100644 index eeb4a2eb64..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/device deleted file mode 120000 index f276392cf7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../1-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval deleted file mode 100644 index fcb4fa4875..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -255ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent deleted file mode 100644 index b1c40b2b20..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/wMaxPacketSize deleted file mode 100644 index 5fca1fda0b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/1-0:1.0/usb_endpoint/usbdev1.1_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized_default deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/authorized_default +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower deleted file mode 100644 index ca2ea0dab5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bMaxPower +++ /dev/null @@ -1 +0,0 @@ - 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice deleted file mode 100644 index ff5c1613f9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bmAttributes deleted file mode 100644 index 4fe4106b50..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/busnum b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/busnum deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/busnum +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/configuration b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/configuration deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/descriptors deleted file mode 100644 index bc75b5136f..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev deleted file mode 100644 index 1641758778..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/dev +++ /dev/null @@ -1 +0,0 @@ -189:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/devnum b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/devnum deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/devnum +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/driver b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/driver deleted file mode 120000 index 0b3eba3d91..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 deleted file mode 120000 index 7053b52021..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev1.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idProduct deleted file mode 100644 index 635047563b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idProduct +++ /dev/null @@ -1 +0,0 @@ -0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idVendor deleted file mode 100644 index d247637ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/idVendor +++ /dev/null @@ -1 +0,0 @@ -1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/manufacturer deleted file mode 100644 index 4d6c1e12b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Linux 2.6.27-rc7-00106-g6ef190c-dirty uhci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/maxchild deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/maxchild +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/active_duration deleted file mode 100644 index 4aabc755bc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -2532 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration deleted file mode 100644 index 18dffb356f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -8372376 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/level b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/level deleted file mode 100644 index 865faf10cb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/level +++ /dev/null @@ -1 +0,0 @@ -auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/wakeup deleted file mode 100644 index 86981e69f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/product b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/product deleted file mode 100644 index 9677780a85..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/product +++ /dev/null @@ -1 +0,0 @@ -UHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/quirks b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/serial b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/serial deleted file mode 100644 index 3fed6956d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/serial +++ /dev/null @@ -1 +0,0 @@ -0000:00:1d.0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/speed b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/speed deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/speed +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/subsystem deleted file mode 120000 index 77682faf80..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/uevent deleted file mode 100644 index 08586f0f4d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=0 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=1d6b/1/206 -TYPE=9/0/0 -BUSNUM=001 -DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/urbnum deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/urbnum +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/dev deleted file mode 100644 index 461fbe7bb8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/device deleted file mode 120000 index ec3aabbdda..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../usb1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/subsystem deleted file mode 120000 index 4f40f16eba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/uevent deleted file mode 100644 index c5a4fd1202..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/usb_endpoint/usbdev1.1_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/version b/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/version deleted file mode 100644 index d4dcb24258..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb1/version +++ /dev/null @@ -1 +0,0 @@ - 1.10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/device b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/device deleted file mode 120000 index f06be5ab3d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1d.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/subsystem deleted file mode 120000 index 72a11573f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.0/usb_host/usb_host1/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.0/vendor b/test/sys/devices/pci0000:00/0000:00:1d.0/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.1/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/class b/test/sys/devices/pci0000:00/0000:00:1d.1/class deleted file mode 100644 index 233dcce516..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/class +++ /dev/null @@ -1 +0,0 @@ -0x0c0300 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/config b/test/sys/devices/pci0000:00/0000:00:1d.1/config deleted file mode 100644 index f5dc52e043..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.1/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/device b/test/sys/devices/pci0000:00/0000:00:1d.1/device deleted file mode 100644 index e72bab0b81..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/device +++ /dev/null @@ -1 +0,0 @@ -0x27c9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/driver b/test/sys/devices/pci0000:00/0000:00:1d.1/driver deleted file mode 120000 index ed69e37601..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/enable b/test/sys/devices/pci0000:00/0000:00:1d.1/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.1/firmware_node deleted file mode 120000 index 2ad3429d38..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:1a \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/irq b/test/sys/devices/pci0000:00/0000:00:1d.1/irq deleted file mode 100644 index 98d9bcb75a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/irq +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/modalias b/test/sys/devices/pci0000:00/0000:00:1d.1/modalias deleted file mode 100644 index d96dba36b2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027C9sv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.1/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/pools b/test/sys/devices/pci0000:00/0000:00:1d.1/pools deleted file mode 100644 index 6f8c27bbc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/pools +++ /dev/null @@ -1,7 +0,0 @@ -poolinfo - 0.1 -uhci_qh 11 32 128 1 -uhci_td 1 64 64 1 -buffer-2048 0 0 2048 0 -buffer-512 0 0 512 0 -buffer-128 0 0 128 0 -buffer-32 1 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/resource b/test/sys/devices/pci0000:00/0000:00:1d.1/resource deleted file mode 100644 index 7386ec0a04..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000001820 0x000000000000183f 0x0000000000020101 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/resource4 b/test/sys/devices/pci0000:00/0000:00:1d.1/resource4 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_device deleted file mode 100644 index dcce13f2d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x200a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/uevent deleted file mode 100644 index bb331518c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=uhci_hcd -PCI_CLASS=C0300 -PCI_ID=8086:27C9 -PCI_SUBSYS_ID=17AA:200A -PCI_SLOT_NAME=0000:00:1d.1 -MODALIAS=pci:v00008086d000027C9sv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver deleted file mode 120000 index 5cf493442c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 deleted file mode 120000 index ca095e9f4a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev2.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias deleted file mode 100644 index a27a9fdc71..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent deleted file mode 100644 index ffd136d9e1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DEVTYPE=usb_interface -DRIVER=hub -PRODUCT=1d6b/1/206 -TYPE=9/0/0 -INTERFACE=9/0/0 -MODALIAS=usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev deleted file mode 100644 index 674a2b6609..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/device deleted file mode 120000 index 5a93828298..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../2-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval deleted file mode 100644 index fcb4fa4875..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -255ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent deleted file mode 100644 index 9ada5a539c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/wMaxPacketSize deleted file mode 100644 index 5fca1fda0b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/2-0:1.0/usb_endpoint/usbdev2.1_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized_default deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/authorized_default +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower deleted file mode 100644 index ca2ea0dab5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bMaxPower +++ /dev/null @@ -1 +0,0 @@ - 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice deleted file mode 100644 index ff5c1613f9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bmAttributes deleted file mode 100644 index 4fe4106b50..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/busnum b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/busnum deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/busnum +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/configuration b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/configuration deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/descriptors deleted file mode 100644 index bc75b5136f..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev deleted file mode 100644 index c6d526cc24..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/dev +++ /dev/null @@ -1 +0,0 @@ -189:128 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/devnum b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/devnum deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/devnum +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/driver b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/driver deleted file mode 120000 index 0b3eba3d91..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 deleted file mode 120000 index dd434a788f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev2.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idProduct deleted file mode 100644 index 635047563b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idProduct +++ /dev/null @@ -1 +0,0 @@ -0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idVendor deleted file mode 100644 index d247637ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/idVendor +++ /dev/null @@ -1 +0,0 @@ -1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/manufacturer deleted file mode 100644 index 4d6c1e12b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Linux 2.6.27-rc7-00106-g6ef190c-dirty uhci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/maxchild deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/maxchild +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/active_duration deleted file mode 100644 index 6a0b84b987..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -2363 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration deleted file mode 100644 index cd4d47e67e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -8372254 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/level b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/level deleted file mode 100644 index 865faf10cb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/level +++ /dev/null @@ -1 +0,0 @@ -auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/wakeup deleted file mode 100644 index 86981e69f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/product b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/product deleted file mode 100644 index 9677780a85..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/product +++ /dev/null @@ -1 +0,0 @@ -UHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/quirks b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/serial b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/serial deleted file mode 100644 index c95bfb0d3e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/serial +++ /dev/null @@ -1 +0,0 @@ -0000:00:1d.1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/speed b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/speed deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/speed +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/subsystem deleted file mode 120000 index 77682faf80..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/uevent deleted file mode 100644 index a48590e6e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=128 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=1d6b/1/206 -TYPE=9/0/0 -BUSNUM=002 -DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/urbnum deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/urbnum +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/dev deleted file mode 100644 index cae42f5657..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/device deleted file mode 120000 index bc415c5bd3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../usb2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/subsystem deleted file mode 120000 index 4f40f16eba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/uevent deleted file mode 100644 index 598a310fc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/usb_endpoint/usbdev2.1_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/version b/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/version deleted file mode 100644 index d4dcb24258..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb2/version +++ /dev/null @@ -1 +0,0 @@ - 1.10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/device b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/device deleted file mode 120000 index f82d15303e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1d.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/subsystem deleted file mode 120000 index 72a11573f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.1/usb_host/usb_host2/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.1/vendor b/test/sys/devices/pci0000:00/0000:00:1d.1/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.1/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.2/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/class b/test/sys/devices/pci0000:00/0000:00:1d.2/class deleted file mode 100644 index 233dcce516..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/class +++ /dev/null @@ -1 +0,0 @@ -0x0c0300 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/config b/test/sys/devices/pci0000:00/0000:00:1d.2/config deleted file mode 100644 index 47731a6c30..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.2/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/device b/test/sys/devices/pci0000:00/0000:00:1d.2/device deleted file mode 100644 index 8b7c28a8dc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/device +++ /dev/null @@ -1 +0,0 @@ -0x27ca diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/driver deleted file mode 120000 index ed69e37601..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/enable b/test/sys/devices/pci0000:00/0000:00:1d.2/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.2/firmware_node deleted file mode 120000 index 76eb9479c5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:1d \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/irq b/test/sys/devices/pci0000:00/0000:00:1d.2/irq deleted file mode 100644 index 3c032078a4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/irq +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/modalias deleted file mode 100644 index 0540045650..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027CAsv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.2/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/pools b/test/sys/devices/pci0000:00/0000:00:1d.2/pools deleted file mode 100644 index 3fae9312c4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/pools +++ /dev/null @@ -1,7 +0,0 @@ -poolinfo - 0.1 -uhci_qh 13 32 128 1 -uhci_td 4 64 64 1 -buffer-2048 0 0 2048 0 -buffer-512 0 0 512 0 -buffer-128 3 32 128 1 -buffer-32 2 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/resource b/test/sys/devices/pci0000:00/0000:00:1d.2/resource deleted file mode 100644 index 1e785fe677..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000001840 0x000000000000185f 0x0000000000020101 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/resource4 b/test/sys/devices/pci0000:00/0000:00:1d.2/resource4 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_device deleted file mode 100644 index dcce13f2d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x200a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/uevent deleted file mode 100644 index 4390e929fc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=uhci_hcd -PCI_CLASS=C0300 -PCI_ID=8086:27CA -PCI_SUBSYS_ID=17AA:200A -PCI_SLOT_NAME=0000:00:1d.2 -MODALIAS=pci:v00008086d000027CAsv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver deleted file mode 120000 index 5cf493442c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 deleted file mode 120000 index b3d2f00653..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev3.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias deleted file mode 100644 index a27a9fdc71..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent deleted file mode 100644 index ffd136d9e1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DEVTYPE=usb_interface -DRIVER=hub -PRODUCT=1d6b/1/206 -TYPE=9/0/0 -INTERFACE=9/0/0 -MODALIAS=usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev deleted file mode 100644 index 2914c02271..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/device deleted file mode 120000 index 03ac22c21d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../3-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval deleted file mode 100644 index fcb4fa4875..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -255ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent deleted file mode 100644 index 33f313772c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/wMaxPacketSize deleted file mode 100644 index 5fca1fda0b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-0:1.0/usb_endpoint/usbdev3.1_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceProtocol deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceSubClass deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/driver deleted file mode 120000 index a28197f174..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb/drivers/usbhid \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 deleted file mode 120000 index 4eef781864..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev3.4_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/abs b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/abs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/abs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ev deleted file mode 100644 index 98d9bcb75a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ev +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ff b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ff deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/ff +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/key b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/key deleted file mode 100644 index 844d194187..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/key +++ /dev/null @@ -1 +0,0 @@ -70000 0 0 0 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/led b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/led deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/led +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/msc b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/msc deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/msc +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/rel b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/rel deleted file mode 100644 index a9c8fe8292..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/rel +++ /dev/null @@ -1 +0,0 @@ -103 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/snd b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/snd deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/snd +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/sw b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/sw deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/capabilities/sw +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/device deleted file mode 120000 index 459da56856..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/device +++ /dev/null @@ -1 +0,0 @@ -../../../3-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/dev deleted file mode 100644 index 95aa46e144..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/dev +++ /dev/null @@ -1 +0,0 @@ -13:71 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/device deleted file mode 120000 index 10b936c7ac..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/device +++ /dev/null @@ -1 +0,0 @@ -../../input8 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/subsystem deleted file mode 120000 index 4fae54fac9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/uevent deleted file mode 100644 index 4e0079927a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/event7/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=71 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/bustype b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/bustype deleted file mode 100644 index 1ce74b6b00..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/bustype +++ /dev/null @@ -1 +0,0 @@ -0003 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/product b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/product deleted file mode 100644 index c7b1c6ebbd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/product +++ /dev/null @@ -1 +0,0 @@ -c03e diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/vendor b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/vendor deleted file mode 100644 index cb40fac378..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/vendor +++ /dev/null @@ -1 +0,0 @@ -046d diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/version b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/version deleted file mode 100644 index 2450c58538..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/id/version +++ /dev/null @@ -1 +0,0 @@ -0110 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/modalias deleted file mode 100644 index 2f189939cb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/modalias +++ /dev/null @@ -1 +0,0 @@ -input:b0003v046DpC03Ee0110-e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/dev deleted file mode 100644 index 24a842e3cf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/dev +++ /dev/null @@ -1 +0,0 @@ -13:33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/device deleted file mode 120000 index 10b936c7ac..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/device +++ /dev/null @@ -1 +0,0 @@ -../../input8 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem deleted file mode 120000 index 4fae54fac9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/uevent deleted file mode 100644 index 83b19e0d53..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/mouse1/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/name b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/name deleted file mode 100644 index 6eb4e9675f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/name +++ /dev/null @@ -1 +0,0 @@ -Logitech USB-PS/2 Optical Mouse diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/phys b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/phys deleted file mode 100644 index 501849bcf7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/phys +++ /dev/null @@ -1 +0,0 @@ -usb-0000:00:1d.2-1/input0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/subsystem deleted file mode 120000 index ed8b4fa1e4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uevent deleted file mode 100644 index c7d04d0191..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uevent +++ /dev/null @@ -1,9 +0,0 @@ -PRODUCT=3/46d/c03e/110 -NAME="Logitech USB-PS/2 Optical Mouse" -PHYS="usb-0000:00:1d.2-1/input0" -UNIQ="" -EV==17 -KEY==70000 0 0 0 0 -REL==103 -MSC==10 -MODALIAS=input:b0003v046DpC03Ee0110-e0,1,2,4,k110,111,112,r0,1,8,am4,lsfw diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uniq b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uniq deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/input/input8/uniq +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/modalias deleted file mode 100644 index 94c6e52b4f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v046DpC03Ed2000dc00dsc00dp00ic03isc01ip02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/uevent deleted file mode 100644 index fb47686b5f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DEVTYPE=usb_interface -DRIVER=usbhid -PRODUCT=46d/c03e/2000 -TYPE=0/0/0 -INTERFACE=3/1/2 -MODALIAS=usb:v046DpC03Ed2000dc00dsc00dp00ic03isc01ip02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval deleted file mode 100644 index eb6e8821f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev deleted file mode 100644 index 7ff90f594c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:25 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device deleted file mode 120000 index 459da56856..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../3-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval deleted file mode 100644 index f5ef4471e1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -10ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent deleted file mode 100644 index f40b59cf7b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=25 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/wMaxPacketSize deleted file mode 100644 index e224381915..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/3-1:1.0/usb_endpoint/usbdev3.4_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/authorized b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPacketSize0 deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower deleted file mode 100644 index a87e477349..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bMaxPower +++ /dev/null @@ -1 +0,0 @@ - 98mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice deleted file mode 100644 index 8bd1af11bf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -2000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes deleted file mode 100644 index 0042f6c56d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -a0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/busnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/busnum deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/busnum +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/configuration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/configuration deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/descriptors deleted file mode 100644 index 82204b0849..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev deleted file mode 100644 index 5af6713c30..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/dev +++ /dev/null @@ -1 +0,0 @@ -189:259 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/devnum +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/driver deleted file mode 120000 index 092d2282f3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 deleted file mode 120000 index 077d8bafc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev3.4_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idProduct deleted file mode 100644 index c7b1c6ebbd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idProduct +++ /dev/null @@ -1 +0,0 @@ -c03e diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idVendor deleted file mode 100644 index cb40fac378..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/idVendor +++ /dev/null @@ -1 +0,0 @@ -046d diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer deleted file mode 100644 index 2a8f966756..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Logitech diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/maxchild deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/maxchild +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration deleted file mode 100644 index 42d86b1fc5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -51384 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration deleted file mode 100644 index 2dbd43cd84..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -51383 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/level b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/level deleted file mode 100644 index b3d86404ab..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/level +++ /dev/null @@ -1 +0,0 @@ -on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/persist deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/persist +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup deleted file mode 100644 index 86981e69f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/product b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/product deleted file mode 100644 index 87ccc5cc7a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/product +++ /dev/null @@ -1 +0,0 @@ -USB-PS/2 Optical Mouse diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/quirks b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed deleted file mode 100644 index c239c60cba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/speed +++ /dev/null @@ -1 +0,0 @@ -1.5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent deleted file mode 100644 index afde682b7a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=259 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=46d/c03e/2000 -TYPE=0/0/0 -BUSNUM=003 -DEVNUM=004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/urbnum +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev deleted file mode 100644 index 13ca53a2c5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:26 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/device deleted file mode 120000 index b2ea03bcd6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../3-1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent deleted file mode 100644 index 0e554b19c0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=26 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize deleted file mode 100644 index be15c71fd2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/usb_endpoint/usbdev3.4_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0008 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/version b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/version deleted file mode 100644 index 602f25e1f4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/3-1/version +++ /dev/null @@ -1 +0,0 @@ - 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized_default deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/authorized_default +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower deleted file mode 100644 index ca2ea0dab5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bMaxPower +++ /dev/null @@ -1 +0,0 @@ - 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice deleted file mode 100644 index ff5c1613f9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bmAttributes deleted file mode 100644 index 4fe4106b50..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/busnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/busnum deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/busnum +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/configuration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/configuration deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/descriptors deleted file mode 100644 index bc75b5136f..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev deleted file mode 100644 index a16713ed24..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/dev +++ /dev/null @@ -1 +0,0 @@ -189:256 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/devnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/devnum deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/devnum +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/driver b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/driver deleted file mode 120000 index 0b3eba3d91..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 deleted file mode 120000 index 017d4dfa59..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev3.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idProduct deleted file mode 100644 index 635047563b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idProduct +++ /dev/null @@ -1 +0,0 @@ -0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idVendor deleted file mode 100644 index d247637ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/idVendor +++ /dev/null @@ -1 +0,0 @@ -1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/manufacturer deleted file mode 100644 index 4d6c1e12b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Linux 2.6.27-rc7-00106-g6ef190c-dirty uhci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/maxchild deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/maxchild +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration deleted file mode 100644 index 220ab5a75f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -603809 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration deleted file mode 100644 index edb008c032..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -8372166 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/level b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/level deleted file mode 100644 index 865faf10cb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/level +++ /dev/null @@ -1 +0,0 @@ -auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/wakeup deleted file mode 100644 index 86981e69f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/product b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/product deleted file mode 100644 index 9677780a85..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/product +++ /dev/null @@ -1 +0,0 @@ -UHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/quirks b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/serial b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/serial deleted file mode 100644 index a01e935c74..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/serial +++ /dev/null @@ -1 +0,0 @@ -0000:00:1d.2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/speed b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/speed deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/speed +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/subsystem deleted file mode 120000 index 77682faf80..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/uevent deleted file mode 100644 index e3fdc17d41..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=256 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=1d6b/1/206 -TYPE=9/0/0 -BUSNUM=003 -DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum deleted file mode 100644 index 38b10c1b2b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/urbnum +++ /dev/null @@ -1 +0,0 @@ -68 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/dev deleted file mode 100644 index bf7752aa37..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/device deleted file mode 120000 index a6dd0c44b7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../usb3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/subsystem deleted file mode 120000 index 4f40f16eba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/uevent deleted file mode 100644 index 9d301ac5d2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/usb_endpoint/usbdev3.1_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/version b/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/version deleted file mode 100644 index d4dcb24258..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb3/version +++ /dev/null @@ -1 +0,0 @@ - 1.10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/device b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/device deleted file mode 120000 index b7eb8a384a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1d.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/subsystem deleted file mode 120000 index 72a11573f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.2/usb_host/usb_host3/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.2/vendor b/test/sys/devices/pci0000:00/0000:00:1d.2/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.2/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.3/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/class b/test/sys/devices/pci0000:00/0000:00:1d.3/class deleted file mode 100644 index 233dcce516..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/class +++ /dev/null @@ -1 +0,0 @@ -0x0c0300 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/config b/test/sys/devices/pci0000:00/0000:00:1d.3/config deleted file mode 100644 index 1312a0a522..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.3/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/device b/test/sys/devices/pci0000:00/0000:00:1d.3/device deleted file mode 100644 index 4a09851bab..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/device +++ /dev/null @@ -1 +0,0 @@ -0x27cb diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/driver deleted file mode 120000 index ed69e37601..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/enable b/test/sys/devices/pci0000:00/0000:00:1d.3/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.3/firmware_node deleted file mode 120000 index cc9eecc0b4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:20 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/irq b/test/sys/devices/pci0000:00/0000:00:1d.3/irq deleted file mode 100644 index d6b24041cf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/irq +++ /dev/null @@ -1 +0,0 @@ -19 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/modalias deleted file mode 100644 index 6160ef48d9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027CBsv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.3/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/pools b/test/sys/devices/pci0000:00/0000:00:1d.3/pools deleted file mode 100644 index e62f9cbdf3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/pools +++ /dev/null @@ -1,7 +0,0 @@ -poolinfo - 0.1 -uhci_qh 13 32 128 1 -uhci_td 3 64 64 1 -buffer-2048 0 0 2048 0 -buffer-512 0 0 512 0 -buffer-128 0 0 128 0 -buffer-32 1 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/resource b/test/sys/devices/pci0000:00/0000:00:1d.3/resource deleted file mode 100644 index 7a2726f3da..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000001860 0x000000000000187f 0x0000000000020101 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/resource4 b/test/sys/devices/pci0000:00/0000:00:1d.3/resource4 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_device deleted file mode 100644 index dcce13f2d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x200a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/uevent deleted file mode 100644 index 52447e7b39..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=uhci_hcd -PCI_CLASS=C0300 -PCI_ID=8086:27CB -PCI_SUBSYS_ID=17AA:200A -PCI_SLOT_NAME=0000:00:1d.3 -MODALIAS=pci:v00008086d000027CBsv000017AAsd0000200Abc0Csc03i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver deleted file mode 120000 index 5cf493442c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 deleted file mode 120000 index a904869fe1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias deleted file mode 100644 index a27a9fdc71..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent deleted file mode 100644 index ffd136d9e1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DEVTYPE=usb_interface -DRIVER=hub -PRODUCT=1d6b/1/206 -TYPE=9/0/0 -INTERFACE=9/0/0 -MODALIAS=usb:v1D6Bp0001d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev deleted file mode 100644 index f1b39606ef..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:6 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/device deleted file mode 120000 index 1d2aa23960..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval deleted file mode 100644 index fcb4fa4875..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -255ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent deleted file mode 100644 index 68b352b4f2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=6 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/wMaxPacketSize deleted file mode 100644 index 5fca1fda0b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-0:1.0/usb_endpoint/usbdev4.1_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass deleted file mode 100644 index 4fe4106b50..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceProtocol deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceSubClass deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 deleted file mode 120000 index 90cfdfb9c0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_02 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.2_ep02 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 deleted file mode 120000 index 060171be3e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.2_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 deleted file mode 120000 index 44fc98ae14..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/ep_82 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.2_ep82 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/modalias deleted file mode 100644 index 822555251f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0A5Cp2110d0100dcE0dsc01dp01icE0isc01ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/uevent deleted file mode 100644 index 4e34a977ba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=a5c/2110/100 -TYPE=224/1/1 -INTERFACE=224/1/1 -MODALIAS=usb:v0A5Cp2110d0100dcE0dsc01dp01icE0isc01ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bEndpointAddress deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bInterval +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev deleted file mode 100644 index bdcbeab347..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/dev +++ /dev/null @@ -1 +0,0 @@ -252:14 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device deleted file mode 120000 index 4e6c223359..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction deleted file mode 100644 index 1fcb1529f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/direction +++ /dev/null @@ -1 +0,0 @@ -out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent deleted file mode 100644 index 04412f8dd2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=14 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep02/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev deleted file mode 100644 index f500d09323..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device deleted file mode 120000 index 4e6c223359..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval deleted file mode 100644 index 2280f71329..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -1ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent deleted file mode 100644 index f3c1616a84..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/wMaxPacketSize deleted file mode 100644 index 66375d5000..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0010 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bEndpointAddress deleted file mode 100644 index dde92ddc1a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -82 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bInterval +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev deleted file mode 100644 index d4e9a09b8a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/dev +++ /dev/null @@ -1 +0,0 @@ -252:13 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device deleted file mode 120000 index 4e6c223359..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent deleted file mode 100644 index 5e324ec077..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=13 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.0/usb_endpoint/usbdev4.2_ep82/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass deleted file mode 100644 index 4fe4106b50..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceProtocol deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceSubClass deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 deleted file mode 120000 index c24d9704cc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_03 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.2_ep03 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 deleted file mode 120000 index 0fa6c5ace1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/ep_83 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.2_ep83 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/modalias deleted file mode 100644 index 822555251f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0A5Cp2110d0100dcE0dsc01dp01icE0isc01ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/uevent deleted file mode 100644 index 4e34a977ba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=a5c/2110/100 -TYPE=224/1/1 -INTERFACE=224/1/1 -MODALIAS=usb:v0A5Cp2110d0100dcE0dsc01dp01icE0isc01ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bEndpointAddress deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bInterval +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bmAttributes deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev deleted file mode 100644 index a2baf86e19..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/dev +++ /dev/null @@ -1 +0,0 @@ -252:16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device deleted file mode 120000 index 9412af3e6c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-1:1.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction deleted file mode 100644 index 1fcb1529f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/direction +++ /dev/null @@ -1 +0,0 @@ -out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval deleted file mode 100644 index 2280f71329..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/interval +++ /dev/null @@ -1 +0,0 @@ -1ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type deleted file mode 100644 index 1ac1521640..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/type +++ /dev/null @@ -1 +0,0 @@ -Isoc diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent deleted file mode 100644 index 60fb5b7b2f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/wMaxPacketSize deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep03/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bEndpointAddress deleted file mode 100644 index 76a8b2b703..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -83 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bInterval +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bmAttributes deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev deleted file mode 100644 index 525a9fe407..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/dev +++ /dev/null @@ -1 +0,0 @@ -252:15 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device deleted file mode 120000 index 9412af3e6c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-1:1.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval deleted file mode 100644 index 2280f71329..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/interval +++ /dev/null @@ -1 +0,0 @@ -1ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type deleted file mode 100644 index 1ac1521640..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/type +++ /dev/null @@ -1 +0,0 @@ -Isoc diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent deleted file mode 100644 index b030034051..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=15 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/wMaxPacketSize deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.1/usb_endpoint/usbdev4.2_ep83/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceProtocol deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceSubClass deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 deleted file mode 120000 index e4a6309a18..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_04 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.2_ep04 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 deleted file mode 120000 index e1dc4a4010..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/ep_84 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.2_ep84 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/modalias deleted file mode 100644 index 430f2aac8f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0A5Cp2110d0100dcE0dsc01dp01icFFiscFFipFF diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/uevent deleted file mode 100644 index 6a006a9ac6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=a5c/2110/100 -TYPE=224/1/1 -INTERFACE=255/255/255 -MODALIAS=usb:v0A5Cp2110d0100dcE0dsc01dp01icFFiscFFipFF diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bEndpointAddress deleted file mode 100644 index 64969239d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -04 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bInterval +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev deleted file mode 100644 index 106878c9a4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/dev +++ /dev/null @@ -1 +0,0 @@ -252:18 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device deleted file mode 120000 index 5426d76110..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-1:1.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction deleted file mode 100644 index 1fcb1529f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/direction +++ /dev/null @@ -1 +0,0 @@ -out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent deleted file mode 100644 index 22e8ee4de1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=18 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/wMaxPacketSize deleted file mode 100644 index 0bfe0202ed..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep04/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0020 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bEndpointAddress deleted file mode 100644 index 871727de1f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -84 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bInterval +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev deleted file mode 100644 index 2d7484226d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/dev +++ /dev/null @@ -1 +0,0 @@ -252:17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device deleted file mode 120000 index 5426d76110..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-1:1.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent deleted file mode 100644 index 1b9c38e51c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/wMaxPacketSize deleted file mode 100644 index 0bfe0202ed..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.2/usb_endpoint/usbdev4.2_ep84/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0020 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass deleted file mode 100644 index d6ddcd5065..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -fe diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceSubClass deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/modalias deleted file mode 100644 index bfa5015a37..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0A5Cp2110d0100dcE0dsc01dp01icFEisc01ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/uevent deleted file mode 100644 index 4bf4782582..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/4-1:1.3/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=a5c/2110/100 -TYPE=224/1/1 -INTERFACE=254/1/0 -MODALIAS=usb:v0A5Cp2110d0100dcE0dsc01dp01icFEisc01ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/authorized b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass deleted file mode 100644 index 4fe4106b50..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceProtocol deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceSubClass deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPacketSize0 deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower deleted file mode 100644 index ca2ea0dab5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bMaxPower +++ /dev/null @@ -1 +0,0 @@ - 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumInterfaces deleted file mode 100644 index 4429917f30..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice deleted file mode 100644 index e199843fc5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0100 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes deleted file mode 100644 index 4fe4106b50..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/busnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/busnum deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/busnum +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/configuration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/configuration deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/descriptors deleted file mode 100644 index e3acb3958b..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev deleted file mode 100644 index 1d0e3c7085..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/dev +++ /dev/null @@ -1 +0,0 @@ -189:385 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/devnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/devnum deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/devnum +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/driver deleted file mode 120000 index 092d2282f3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 deleted file mode 120000 index 9901da9a04..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.2_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idProduct deleted file mode 100644 index 281e3d9981..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idProduct +++ /dev/null @@ -1 +0,0 @@ -2110 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idVendor deleted file mode 100644 index 4a60677656..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/idVendor +++ /dev/null @@ -1 +0,0 @@ -0a5c diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer deleted file mode 100644 index 2fa5dd2a8c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Broadcom Corp diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/maxchild deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/maxchild +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration deleted file mode 100644 index 8376cc386f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -8370651 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration deleted file mode 100644 index e23bd34407..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -8370650 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/level b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/level deleted file mode 100644 index b3d86404ab..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/level +++ /dev/null @@ -1 +0,0 @@ -on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/persist deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/persist +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup deleted file mode 100644 index 86981e69f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/product b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/product deleted file mode 100644 index 0ce5be71ba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/product +++ /dev/null @@ -1 +0,0 @@ -BCM2045B diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/quirks b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/speed +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/uevent deleted file mode 100644 index 1b9c8bea34..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=385 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=a5c/2110/100 -TYPE=224/1/1 -BUSNUM=004 -DEVNUM=002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/urbnum deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/urbnum +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev deleted file mode 100644 index af7fe00234..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:19 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/device deleted file mode 120000 index 8134880373..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent deleted file mode 100644 index 4e2c7e84ed..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=19 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/usb_endpoint/usbdev4.2_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/version b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/version deleted file mode 100644 index 602f25e1f4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-1/version +++ /dev/null @@ -1 +0,0 @@ - 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 deleted file mode 120000 index f75e6a2118..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_02 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.3_ep02 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 deleted file mode 120000 index 6df694755d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.3_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 deleted file mode 120000 index d32e1eede3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/ep_83 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.3_ep83 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/modalias deleted file mode 100644 index dbcbdda812..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0483p2016d0001dc00dsc00dp00icFFisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/uevent deleted file mode 100644 index 9dcf599894..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=483/2016/1 -TYPE=0/0/0 -INTERFACE=255/0/0 -MODALIAS=usb:v0483p2016d0001dc00dsc00dp00icFFisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bEndpointAddress deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev deleted file mode 100644 index 9845e54b6a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/dev +++ /dev/null @@ -1 +0,0 @@ -252:21 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device deleted file mode 120000 index 033ddb420b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction deleted file mode 100644 index 1fcb1529f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/direction +++ /dev/null @@ -1 +0,0 @@ -out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent deleted file mode 100644 index 834fe58a57..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=21 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep02/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev deleted file mode 100644 index 85618872ba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device deleted file mode 120000 index 033ddb420b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent deleted file mode 100644 index cbe1fcb996..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bEndpointAddress deleted file mode 100644 index 76a8b2b703..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -83 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bInterval +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev deleted file mode 100644 index a2c5eecc73..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/dev +++ /dev/null @@ -1 +0,0 @@ -252:22 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device deleted file mode 120000 index 033ddb420b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval deleted file mode 100644 index 164c349ec6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/interval +++ /dev/null @@ -1 +0,0 @@ -20ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent deleted file mode 100644 index 5e23395efb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=22 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/wMaxPacketSize deleted file mode 100644 index e224381915..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/4-2:1.0/usb_endpoint/usbdev4.3_ep83/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/authorized b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPacketSize0 deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower deleted file mode 100644 index a3369c7120..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bMaxPower +++ /dev/null @@ -1 +0,0 @@ -100mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice deleted file mode 100644 index 635047563b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes deleted file mode 100644 index 0042f6c56d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -a0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/busnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/busnum deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/busnum +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/configuration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/configuration deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/descriptors deleted file mode 100644 index f7eeffd8e9..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev deleted file mode 100644 index 2b44fb9531..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/dev +++ /dev/null @@ -1 +0,0 @@ -189:386 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/devnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/devnum deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/devnum +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/driver deleted file mode 120000 index 092d2282f3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 deleted file mode 120000 index 5944a8358f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.3_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idProduct deleted file mode 100644 index 6f6d045ba5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idProduct +++ /dev/null @@ -1 +0,0 @@ -2016 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idVendor deleted file mode 100644 index a5aba47ba4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/idVendor +++ /dev/null @@ -1 +0,0 @@ -0483 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer deleted file mode 100644 index 4513b02f04..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/manufacturer +++ /dev/null @@ -1 +0,0 @@ -STMicroelectronics diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/maxchild deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/maxchild +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration deleted file mode 100644 index d97138e6e2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -8370363 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration deleted file mode 100644 index 3189ff86f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -8370362 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/level b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/level deleted file mode 100644 index b3d86404ab..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/level +++ /dev/null @@ -1 +0,0 @@ -on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/persist deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/persist +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup deleted file mode 100644 index 86981e69f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/product b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/product deleted file mode 100644 index e6a3064b63..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/product +++ /dev/null @@ -1 +0,0 @@ -Biometric Coprocessor diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/quirks b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/speed +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/uevent deleted file mode 100644 index 0c9f0b83fe..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=386 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=483/2016/1 -TYPE=0/0/0 -BUSNUM=004 -DEVNUM=003 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/urbnum deleted file mode 100644 index ec635144f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/urbnum +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev deleted file mode 100644 index 155ecf8f22..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:23 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/device deleted file mode 120000 index 8fe9e1c7ab..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../4-2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent deleted file mode 100644 index bd5d7c8474..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=23 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize deleted file mode 100644 index be15c71fd2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/usb_endpoint/usbdev4.3_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0008 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/version b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/version deleted file mode 100644 index 9fce849a25..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/4-2/version +++ /dev/null @@ -1 +0,0 @@ - 1.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized_default deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/authorized_default +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower deleted file mode 100644 index ca2ea0dab5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bMaxPower +++ /dev/null @@ -1 +0,0 @@ - 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice deleted file mode 100644 index ff5c1613f9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bmAttributes deleted file mode 100644 index 4fe4106b50..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/busnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/busnum deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/busnum +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/configuration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/configuration deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/descriptors deleted file mode 100644 index bc75b5136f..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev deleted file mode 100644 index f57dc503b8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/dev +++ /dev/null @@ -1 +0,0 @@ -189:384 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/devnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/devnum deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/devnum +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/driver b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/driver deleted file mode 120000 index 0b3eba3d91..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 deleted file mode 120000 index 2ed7a69d09..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev4.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idProduct deleted file mode 100644 index 635047563b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idProduct +++ /dev/null @@ -1 +0,0 @@ -0001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idVendor deleted file mode 100644 index d247637ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/idVendor +++ /dev/null @@ -1 +0,0 @@ -1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/manufacturer deleted file mode 100644 index 4d6c1e12b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Linux 2.6.27-rc7-00106-g6ef190c-dirty uhci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/maxchild deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/maxchild +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration deleted file mode 100644 index 4876d39b40..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -8372033 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration deleted file mode 100644 index 4876d39b40..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -8372033 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/level b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/level deleted file mode 100644 index 865faf10cb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/level +++ /dev/null @@ -1 +0,0 @@ -auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/wakeup deleted file mode 100644 index 86981e69f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/product b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/product deleted file mode 100644 index 9677780a85..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/product +++ /dev/null @@ -1 +0,0 @@ -UHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/quirks b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/serial b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/serial deleted file mode 100644 index a37bb88ca7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/serial +++ /dev/null @@ -1 +0,0 @@ -0000:00:1d.3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/speed b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/speed deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/speed +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/subsystem deleted file mode 120000 index 77682faf80..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/uevent deleted file mode 100644 index 65141c1f08..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=384 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=1d6b/1/206 -TYPE=9/0/0 -BUSNUM=004 -DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/urbnum deleted file mode 100644 index a8fa06e1be..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/urbnum +++ /dev/null @@ -1 +0,0 @@ -62 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/dev deleted file mode 100644 index 697e2170aa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/device deleted file mode 120000 index 8a501f195f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../usb4 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/subsystem deleted file mode 120000 index 4f40f16eba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/uevent deleted file mode 100644 index 7dcc2a045b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/usb_endpoint/usbdev4.1_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/version b/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/version deleted file mode 100644 index d4dcb24258..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb4/version +++ /dev/null @@ -1 +0,0 @@ - 1.10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/device b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/device deleted file mode 120000 index d7a7d7674c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1d.3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/subsystem deleted file mode 120000 index 72a11573f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/uevent b/test/sys/devices/pci0000:00/0000:00:1d.3/usb_host/usb_host4/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.3/vendor b/test/sys/devices/pci0000:00/0000:00:1d.3/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.3/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1d.7/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/class b/test/sys/devices/pci0000:00/0000:00:1d.7/class deleted file mode 100644 index 4c84acd962..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/class +++ /dev/null @@ -1 +0,0 @@ -0x0c0320 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/config b/test/sys/devices/pci0000:00/0000:00:1d.7/config deleted file mode 100644 index 2dd52898e0..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.7/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/device b/test/sys/devices/pci0000:00/0000:00:1d.7/device deleted file mode 100644 index 812d332d30..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/device +++ /dev/null @@ -1 +0,0 @@ -0x27cc diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/driver deleted file mode 120000 index 04a01344aa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/ehci_hcd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/enable b/test/sys/devices/pci0000:00/0000:00:1d.7/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/firmware_node b/test/sys/devices/pci0000:00/0000:00:1d.7/firmware_node deleted file mode 120000 index f0777b2b2b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:21 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/irq b/test/sys/devices/pci0000:00/0000:00:1d.7/irq deleted file mode 100644 index d6b24041cf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/irq +++ /dev/null @@ -1 +0,0 @@ -19 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpus b/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/modalias deleted file mode 100644 index aa8699f429..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027CCsv000017AAsd0000200Bbc0Csc03i20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/msi_bus b/test/sys/devices/pci0000:00/0000:00:1d.7/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/pools b/test/sys/devices/pci0000:00/0000:00:1d.7/pools deleted file mode 100644 index 74b7ab55d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/pools +++ /dev/null @@ -1,9 +0,0 @@ -poolinfo - 0.1 -ehci_sitd 0 0 96 0 -ehci_itd 0 0 192 0 -ehci_qh 5 25 160 1 -ehci_qtd 5 42 96 1 -buffer-2048 16 32 2048 16 -buffer-512 0 0 512 0 -buffer-128 2 32 128 1 -buffer-32 2 128 32 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/resource b/test/sys/devices/pci0000:00/0000:00:1d.7/resource deleted file mode 100644 index 369eb0b54d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x00000000ee404000 0x00000000ee4043ff 0x0000000000020200 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/resource0 b/test/sys/devices/pci0000:00/0000:00:1d.7/resource0 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_device deleted file mode 100644 index 58a8abe675..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x200b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/uevent deleted file mode 100644 index 601e83b52c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=ehci_hcd -PCI_CLASS=C0320 -PCI_ID=8086:27CC -PCI_SUBSYS_ID=17AA:200B -PCI_SLOT_NAME=0000:00:1d.7 -MODALIAS=pci:v00008086d000027CCsv000017AAsd0000200Bbc0Csc03i20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver deleted file mode 120000 index 5cf493442c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 deleted file mode 120000 index f40fc8a5a4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.1_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias deleted file mode 100644 index 7eae526595..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v1D6Bp0002d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent deleted file mode 100644 index 2a8be06e21..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DEVTYPE=usb_interface -DRIVER=hub -PRODUCT=1d6b/2/206 -TYPE=9/0/0 -INTERFACE=9/0/0 -MODALIAS=usb:v1D6Bp0002d0206dc09dsc00dp00ic09isc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval deleted file mode 100644 index 8ac4b4ca54..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -0c diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev deleted file mode 100644 index 6c314ee8e2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/device deleted file mode 120000 index 945b94e9ef..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-0:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval deleted file mode 100644 index fa4bd3732b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -256ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent deleted file mode 100644 index d047937b3d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/wMaxPacketSize deleted file mode 100644 index e224381915..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-0:1.0/usb_endpoint/usbdev5.1_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0004 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass deleted file mode 100644 index adb9de8ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceProtocol deleted file mode 100644 index e373ee695f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -50 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceSubClass deleted file mode 100644 index cd672a533b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -06 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/driver deleted file mode 120000 index 6fabfe92d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb/drivers/usb-storage \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 deleted file mode 120000 index f2e9b56c05..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_02 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.7_ep02 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 deleted file mode 120000 index 1203e0516e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.7_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/active_mode b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/active_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/active_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/can_queue b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/can_queue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/can_queue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/cmd_per_lun +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/device deleted file mode 120000 index dbb92b165b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/device +++ /dev/null @@ -1 +0,0 @@ -../../../host7 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/host_busy b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/host_busy deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/host_busy +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/proc_name b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/proc_name deleted file mode 100644 index 6b30c92459..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/proc_name +++ /dev/null @@ -1 +0,0 @@ -usb-storage diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_capabilities deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_capabilities +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_guard_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/prot_guard_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/sg_tablesize +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/state b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/subsystem deleted file mode 120000 index 17253776ee..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/supported_mode b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/supported_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/supported_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unchecked_isa_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unchecked_isa_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unique_id b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unique_id deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/scsi_host/host7/unique_id +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem deleted file mode 120000 index 2edcea4660..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/bdi b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/bdi deleted file mode 120000 index 32e1a77343..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/bdi +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../../virtual/bdi/8:16 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/capability b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/capability deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/capability +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/dev deleted file mode 100644 index 112fc37ffb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/dev +++ /dev/null @@ -1 +0,0 @@ -8:16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/device deleted file mode 120000 index 4784c37861..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/device +++ /dev/null @@ -1 +0,0 @@ -../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg deleted file mode 120000 index c7c07d7fb2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/bsg +++ /dev/null @@ -1 +0,0 @@ -../../../bsg/7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/hw_sector_size b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/hw_sector_size deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/hw_sector_size +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_max b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_max deleted file mode 100644 index 08558e471c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_max +++ /dev/null @@ -1 +0,0 @@ -16384 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_penalty b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_penalty deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/back_seek_penalty +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_async b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_async deleted file mode 100644 index cb1a40df0f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_async +++ /dev/null @@ -1 +0,0 @@ -250 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_sync b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_sync deleted file mode 100644 index d136d6a714..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/fifo_expire_sync +++ /dev/null @@ -1 +0,0 @@ -125 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/quantum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/quantum deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/quantum +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async deleted file mode 100644 index 425151f3a4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async +++ /dev/null @@ -1 +0,0 @@ -40 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async_rq b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async_rq deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_async_rq +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_idle b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_idle deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_idle +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_sync b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_sync deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/iosched/slice_sync +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_hw_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_hw_sectors_kb deleted file mode 100644 index 52bd8e43af..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_hw_sectors_kb +++ /dev/null @@ -1 +0,0 @@ -120 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_sectors_kb deleted file mode 100644 index 52bd8e43af..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/max_sectors_kb +++ /dev/null @@ -1 +0,0 @@ -120 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nomerges b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nomerges deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nomerges +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nr_requests b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nr_requests deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/nr_requests +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/read_ahead_kb b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/read_ahead_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/scheduler b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/scheduler deleted file mode 100644 index 8b357d87cf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/queue/scheduler +++ /dev/null @@ -1 +0,0 @@ -noop anticipatory deadline [cfq] diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/range b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/range deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/range +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/removable b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/removable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/removable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev deleted file mode 100644 index 022b1f47b4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/dev +++ /dev/null @@ -1 +0,0 @@ -8:17 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size deleted file mode 100644 index f712151505..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/size +++ /dev/null @@ -1 +0,0 @@ -256992 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/start +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat deleted file mode 100644 index 316332de2e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/stat +++ /dev/null @@ -1 +0,0 @@ - 109 392 1903 246 0 0 0 0 0 169 246 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem deleted file mode 120000 index 2b8519ddfe..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/uevent deleted file mode 100644 index 0718e30f77..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/sdb1/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=8 -MINOR=17 -DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/size b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/size deleted file mode 100644 index 2a2fc24578..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/size +++ /dev/null @@ -1 +0,0 @@ -257024 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/stat b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/stat deleted file mode 100644 index 3d77827fe7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/stat +++ /dev/null @@ -1 +0,0 @@ - 117 409 2103 272 0 0 0 0 0 194 272 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/subsystem deleted file mode 120000 index ad0acddd88..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/uevent deleted file mode 100644 index ffdbcce52f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/block/sdb/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=8 -MINOR=16 -DEVTYPE=disk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev deleted file mode 100644 index 45afae7d31..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/dev +++ /dev/null @@ -1 +0,0 @@ -254:2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device deleted file mode 120000 index 4784c37861..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/device +++ /dev/null @@ -1 +0,0 @@ -../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem deleted file mode 120000 index c5637f4f0f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../../../class/bsg \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent deleted file mode 100644 index eb058fa9c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/bsg/7:0:0:0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=254 -MINOR=2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/device_blocked deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/device_blocked +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver deleted file mode 120000 index adcb36def8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../bus/scsi/drivers/sd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/evt_media_change b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/evt_media_change deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/evt_media_change +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic deleted file mode 120000 index c18ccd1812..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/generic +++ /dev/null @@ -1 +0,0 @@ -scsi_generic/sg2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iocounterbits b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iocounterbits deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iocounterbits +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt deleted file mode 100644 index 4c26d37eb8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iodone_cnt +++ /dev/null @@ -1 +0,0 @@ -0xc3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt deleted file mode 100644 index 87c20ee33d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/ioerr_cnt +++ /dev/null @@ -1 +0,0 @@ -0x2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iorequest_cnt b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iorequest_cnt deleted file mode 100644 index 4c26d37eb8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/iorequest_cnt +++ /dev/null @@ -1 +0,0 @@ -0xc3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors deleted file mode 100644 index eb08bc0b0b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/max_sectors +++ /dev/null @@ -1 +0,0 @@ -240 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias deleted file mode 100644 index cbde94ebdb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/modalias +++ /dev/null @@ -1 +0,0 @@ -scsi:t-0x00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model deleted file mode 100644 index 92f0694a08..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/model +++ /dev/null @@ -1 +0,0 @@ -USB Flash Drive diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_depth +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type deleted file mode 100644 index 621e94f0ec..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/queue_type +++ /dev/null @@ -1 +0,0 @@ -none diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev deleted file mode 100644 index 1e376f6617..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/rev +++ /dev/null @@ -1 +0,0 @@ -1.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device deleted file mode 120000 index 4784c37861..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/device +++ /dev/null @@ -1 +0,0 @@ -../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/subsystem deleted file mode 120000 index a0b71604b8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../../../class/scsi_device \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_device/7:0:0:0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/FUA +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/allow_restart b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/allow_restart deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/allow_restart +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/app_tag_own b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/app_tag_own deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/app_tag_own +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/cache_type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/cache_type deleted file mode 100644 index e9644f31aa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/cache_type +++ /dev/null @@ -1 +0,0 @@ -write through diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device deleted file mode 120000 index 4784c37861..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/device +++ /dev/null @@ -1 +0,0 @@ -../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/manage_start_stop +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/protection_type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/protection_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/protection_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/subsystem deleted file mode 120000 index a67c6b367f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../../../class/scsi_disk \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_disk/7:0:0:0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev deleted file mode 100644 index db694dd0be..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/dev +++ /dev/null @@ -1 +0,0 @@ -21:2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/device deleted file mode 120000 index 4784c37861..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/device +++ /dev/null @@ -1 +0,0 @@ -../../../7:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem deleted file mode 120000 index a00b997ea1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../../../class/scsi_generic \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/uevent deleted file mode 100644 index a9bc7144b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_generic/sg2/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=21 -MINOR=2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/scsi_level +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem deleted file mode 120000 index a58dd0ae01..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout deleted file mode 100644 index abdfb053e4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/timeout +++ /dev/null @@ -1 +0,0 @@ -60 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent deleted file mode 100644 index 85c5088edf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/uevent +++ /dev/null @@ -1,3 +0,0 @@ -DEVTYPE=scsi_device -DRIVER=sd -MODALIAS=scsi:t-0x00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor deleted file mode 100644 index 9ee005f771..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/7:0:0:0/vendor +++ /dev/null @@ -1 +0,0 @@ -Generic diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem deleted file mode 120000 index 90f0ab37d0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/uevent deleted file mode 100644 index ce02d8524b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/target7:0:0/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_target diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent deleted file mode 100644 index 934f648e8c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/host7/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/modalias deleted file mode 100644 index 2631a9c47c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v1043p8012d0100dc00dsc00dp00ic08isc06ip50 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/uevent deleted file mode 100644 index c0e64b8890..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DEVTYPE=usb_interface -DRIVER=usb-storage -PRODUCT=1043/8012/100 -TYPE=0/0/0 -INTERFACE=8/6/80 -MODALIAS=usb:v1043p8012d0100dc00dsc00dp00ic08isc06ip50 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bEndpointAddress deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev deleted file mode 100644 index e9646862ed..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/dev +++ /dev/null @@ -1 +0,0 @@ -252:11 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device deleted file mode 120000 index 1e92c83aee..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction deleted file mode 100644 index 1fcb1529f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/direction +++ /dev/null @@ -1 +0,0 @@ -out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent deleted file mode 100644 index 7dde40c6e6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=11 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/wMaxPacketSize deleted file mode 100644 index 092ce5f323..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep02/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev deleted file mode 100644 index d12c5095f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device deleted file mode 120000 index 1e92c83aee..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-1:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent deleted file mode 100644 index 3ff3a28c56..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=10 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/wMaxPacketSize deleted file mode 100644 index 092ce5f323..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/5-1:1.0/usb_endpoint/usbdev5.7_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/authorized b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPacketSize0 deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower deleted file mode 100644 index a3369c7120..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bMaxPower +++ /dev/null @@ -1 +0,0 @@ -100mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice deleted file mode 100644 index e199843fc5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0100 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes deleted file mode 100644 index d15a2cc44e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -80 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/busnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/busnum deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/busnum +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/configuration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/configuration deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/descriptors deleted file mode 100644 index af16ffd0ed..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev deleted file mode 100644 index db1a2907ef..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/dev +++ /dev/null @@ -1 +0,0 @@ -189:518 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/devnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/devnum deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/devnum +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/driver deleted file mode 120000 index 092d2282f3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 deleted file mode 120000 index 18e4e875d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.7_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idProduct deleted file mode 100644 index f36af27d06..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idProduct +++ /dev/null @@ -1 +0,0 @@ -8012 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idVendor deleted file mode 100644 index 34d9aaeb09..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/idVendor +++ /dev/null @@ -1 +0,0 @@ -1043 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer deleted file mode 100644 index 8470d61195..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Generic diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/maxchild deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/maxchild +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/active_duration deleted file mode 100644 index d2268f7c60..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -65113 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/connected_duration deleted file mode 100644 index d2268f7c60..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -65113 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/level b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/level deleted file mode 100644 index b3d86404ab..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/level +++ /dev/null @@ -1 +0,0 @@ -on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/persist deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/persist +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/product b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/product deleted file mode 100644 index a3827c329c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/product +++ /dev/null @@ -1 +0,0 @@ -Flash Disk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/quirks b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed deleted file mode 100644 index 36e082614b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/speed +++ /dev/null @@ -1 +0,0 @@ -480 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/uevent deleted file mode 100644 index bfbb551bc4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=518 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=1043/8012/100 -TYPE=0/0/0 -BUSNUM=005 -DEVNUM=007 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/urbnum deleted file mode 100644 index 611de25367..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/urbnum +++ /dev/null @@ -1 +0,0 @@ -743 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev deleted file mode 100644 index 12d19732c9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:24 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/device deleted file mode 120000 index 35e552af56..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent deleted file mode 100644 index e6445200c1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=24 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/usb_endpoint/usbdev5.7_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/version b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/version deleted file mode 100644 index 602f25e1f4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-1/version +++ /dev/null @@ -1 +0,0 @@ - 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceProtocol deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceSubClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities deleted file mode 100644 index 3f10ffe7a4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/bmCapabilities +++ /dev/null @@ -1 +0,0 @@ -15 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/driver deleted file mode 120000 index cd15059f11..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb/drivers/cdc_acm \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 deleted file mode 120000 index 2a8a0666e2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/ep_81 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.9_ep81 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/interface deleted file mode 100644 index 7575fe2088..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/interface +++ /dev/null @@ -1 +0,0 @@ -CDC Comms Interface diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/modalias deleted file mode 100644 index dd88185db4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic02isc02ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev deleted file mode 100644 index 5b278d2839..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/dev +++ /dev/null @@ -1 +0,0 @@ -166:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/device deleted file mode 120000 index feb7c79cbe..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem deleted file mode 120000 index 5a82a28739..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent deleted file mode 100644 index 22f0302e2a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=166 -MINOR=0 -DEVNAME=ttyACM0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/uevent deleted file mode 100644 index c2ff691a84..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DEVTYPE=usb_interface -DRIVER=cdc_acm -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=2/2/1 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc02ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bEndpointAddress deleted file mode 100644 index d88e313699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -81 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval deleted file mode 100644 index adb9de8ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bInterval +++ /dev/null @@ -1 +0,0 @@ -08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev deleted file mode 100644 index 41133ae815..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/dev +++ /dev/null @@ -1 +0,0 @@ -252:27 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device deleted file mode 120000 index feb7c79cbe..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-2:1.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval deleted file mode 100644 index 260640cf65..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/interval +++ /dev/null @@ -1 +0,0 @@ -16ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent deleted file mode 100644 index cdda16fbbc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=27 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/usb_endpoint/usbdev5.9_ep81/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass deleted file mode 100644 index eb6e8821f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/driver deleted file mode 120000 index cd15059f11..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb/drivers/cdc_acm \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 deleted file mode 120000 index 9c29fa84ea..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_01 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.9_ep01 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 deleted file mode 120000 index 3bb8550262..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/ep_82 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.9_ep82 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/interface deleted file mode 100644 index 9f4232ca19..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/interface +++ /dev/null @@ -1 +0,0 @@ -CDC Data Interface diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/modalias deleted file mode 100644 index 2b00a7b41b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/uevent deleted file mode 100644 index f8c33c7987..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DEVTYPE=usb_interface -DRIVER=cdc_acm -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=10/0/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bEndpointAddress deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bInterval +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev deleted file mode 100644 index 31a8b5d781..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/dev +++ /dev/null @@ -1 +0,0 @@ -252:29 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device deleted file mode 120000 index d334d1acfd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-2:1.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction deleted file mode 100644 index 1fcb1529f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/direction +++ /dev/null @@ -1 +0,0 @@ -out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval deleted file mode 100644 index 300966c68e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/interval +++ /dev/null @@ -1 +0,0 @@ -31875us diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent deleted file mode 100644 index fe99938b47..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=29 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/wMaxPacketSize deleted file mode 100644 index 092ce5f323..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep01/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bEndpointAddress deleted file mode 100644 index dde92ddc1a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -82 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bInterval +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev deleted file mode 100644 index d50e7b3952..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/dev +++ /dev/null @@ -1 +0,0 @@ -252:28 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device deleted file mode 120000 index d334d1acfd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-2:1.1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent deleted file mode 100644 index 2a92107242..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=28 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/wMaxPacketSize deleted file mode 100644 index 092ce5f323..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.1/usb_endpoint/usbdev5.9_ep82/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceNumber deleted file mode 100644 index eb6e8821f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceSubClass deleted file mode 100644 index d6ddcd5065..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -fe diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/modalias deleted file mode 100644 index acd278866f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic02iscFEip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/uevent deleted file mode 100644 index e638139f28..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.10/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=2/254/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02iscFEip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass deleted file mode 100644 index eb6e8821f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceNumber deleted file mode 100644 index 59db2fe288..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -0b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/modalias deleted file mode 100644 index 2b00a7b41b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/uevent deleted file mode 100644 index d70db7a9c6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.11/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=10/0/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceNumber deleted file mode 100644 index 8ac4b4ca54..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -0c diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceSubClass deleted file mode 100644 index 18fb2459b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -fd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/interface deleted file mode 100644 index d19e3dc633..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/interface +++ /dev/null @@ -1 +0,0 @@ -LCIF_Alt0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/modalias deleted file mode 100644 index dc4c407200..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic02iscFDip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/uevent deleted file mode 100644 index 2e63fd3b37..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.12/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=2/253/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02iscFDip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass deleted file mode 100644 index eb6e8821f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceNumber deleted file mode 100644 index 655e789cd6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -0d diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/modalias deleted file mode 100644 index 2b00a7b41b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/uevent deleted file mode 100644 index d70db7a9c6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.13/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=10/0/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceProtocol deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceSubClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 deleted file mode 120000 index 89ce0147b6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/ep_83 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.9_ep83 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/interface deleted file mode 100644 index 7575fe2088..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/interface +++ /dev/null @@ -1 +0,0 @@ -CDC Comms Interface diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/modalias deleted file mode 100644 index 7770117f05..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic02isc02ipFF diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/uevent deleted file mode 100644 index 4324de940d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=2/2/255 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc02ipFF diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bEndpointAddress deleted file mode 100644 index 76a8b2b703..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -83 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval deleted file mode 100644 index adb9de8ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bInterval +++ /dev/null @@ -1 +0,0 @@ -08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bmAttributes deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev deleted file mode 100644 index ff9325acf8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/dev +++ /dev/null @@ -1 +0,0 @@ -252:30 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device deleted file mode 120000 index b1ba0b452c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-2:1.2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval deleted file mode 100644 index 260640cf65..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/interval +++ /dev/null @@ -1 +0,0 @@ -16ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type deleted file mode 100644 index 8b4382873b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/type +++ /dev/null @@ -1 +0,0 @@ -Interrupt diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent deleted file mode 100644 index 18fc5d3ab4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=30 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.2/usb_endpoint/usbdev5.9_ep83/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass deleted file mode 100644 index eb6e8821f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 deleted file mode 120000 index d19aadae9e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_02 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.9_ep02 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 deleted file mode 120000 index 70a3176432..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/ep_84 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.9_ep84 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/interface deleted file mode 100644 index 9f4232ca19..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/interface +++ /dev/null @@ -1 +0,0 @@ -CDC Data Interface diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/modalias deleted file mode 100644 index 2b00a7b41b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/uevent deleted file mode 100644 index d70db7a9c6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=10/0/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bEndpointAddress deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bInterval +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev deleted file mode 100644 index beb6386382..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/dev +++ /dev/null @@ -1 +0,0 @@ -252:32 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device deleted file mode 120000 index 26f02bfaa1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-2:1.3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction deleted file mode 100644 index 1fcb1529f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/direction +++ /dev/null @@ -1 +0,0 @@ -out diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval deleted file mode 100644 index 300966c68e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/interval +++ /dev/null @@ -1 +0,0 @@ -31875us diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent deleted file mode 100644 index f3c2dbb6eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=32 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/wMaxPacketSize deleted file mode 100644 index 092ce5f323..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep02/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bEndpointAddress deleted file mode 100644 index 871727de1f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -84 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bInterval +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bmAttributes deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev deleted file mode 100644 index b0d2a8ab72..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/dev +++ /dev/null @@ -1 +0,0 @@ -252:31 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device deleted file mode 120000 index 26f02bfaa1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-2:1.3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction deleted file mode 100644 index 4935e88d32..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/direction +++ /dev/null @@ -1 +0,0 @@ -in diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem deleted file mode 120000 index e2cbff2b9d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type deleted file mode 100644 index 0ac5fdc00b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/type +++ /dev/null @@ -1 +0,0 @@ -Bulk diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent deleted file mode 100644 index 2f90d508ea..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=31 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/wMaxPacketSize deleted file mode 100644 index 092ce5f323..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.3/usb_endpoint/usbdev5.9_ep84/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0200 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber deleted file mode 100644 index 64969239d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -04 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceSubClass deleted file mode 100644 index adb9de8ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/modalias deleted file mode 100644 index 6101e55ac2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic02isc08ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/uevent deleted file mode 100644 index 7f52898b15..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.4/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=2/8/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc08ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber deleted file mode 100644 index eeee65ec41..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -05 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceSubClass deleted file mode 100644 index 59db2fe288..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -0b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/interface deleted file mode 100644 index 2e50dbe3a3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/interface +++ /dev/null @@ -1 +0,0 @@ -SYNCML-SYNC diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/modalias deleted file mode 100644 index aa6b275f9c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic02isc0Bip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/uevent deleted file mode 100644 index dcd130df1a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.5/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=2/11/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc0Bip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass deleted file mode 100644 index eb6e8821f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber deleted file mode 100644 index cd672a533b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -06 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/modalias deleted file mode 100644 index 2b00a7b41b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/uevent deleted file mode 100644 index d70db7a9c6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.6/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=10/0/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceSubClass deleted file mode 100644 index 59db2fe288..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -0b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/interface b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/interface deleted file mode 100644 index 887a02bdf1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/interface +++ /dev/null @@ -1 +0,0 @@ -PC Suite Services diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/modalias deleted file mode 100644 index aa6b275f9c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic02isc0Bip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/uevent deleted file mode 100644 index dcd130df1a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.7/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=2/11/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc0Bip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass deleted file mode 100644 index eb6e8821f1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -0a diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber deleted file mode 100644 index adb9de8ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/modalias deleted file mode 100644 index 2b00a7b41b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/uevent deleted file mode 100644 index d70db7a9c6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.8/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=10/0/0 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic0Aisc00ip00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bAlternateSetting b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bAlternateSetting deleted file mode 100644 index 2142470504..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bAlternateSetting +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceNumber +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceProtocol deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceProtocol +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceSubClass deleted file mode 100644 index adb9de8ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bInterfaceSubClass +++ /dev/null @@ -1 +0,0 @@ -08 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/bNumEndpoints +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/modalias b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/modalias deleted file mode 100644 index 2bdbac21ec..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/modalias +++ /dev/null @@ -1 +0,0 @@ -usb:v0421p007Bd0100dc02dsc00dp00ic02isc08ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem deleted file mode 120000 index 29689de588..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/uevent deleted file mode 100644 index 6e844be632..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.9/uevent +++ /dev/null @@ -1,5 +0,0 @@ -DEVTYPE=usb_interface -PRODUCT=421/7b/100 -TYPE=2/0/0 -INTERFACE=2/8/1 -MODALIAS=usb:v0421p007Bd0100dc02dsc00dp00ic02isc08ip01 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/authorized b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPacketSize0 deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower deleted file mode 100644 index a3369c7120..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bMaxPower +++ /dev/null @@ -1 +0,0 @@ -100mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumInterfaces deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice deleted file mode 100644 index e199843fc5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0100 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes deleted file mode 100644 index caecf05cdb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -c0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/busnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/busnum deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/busnum +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/configuration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/configuration deleted file mode 100644 index ef898cf0f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/configuration +++ /dev/null @@ -1 +0,0 @@ -Bulk transfer method configuration diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/descriptors deleted file mode 100644 index 3250eb64e0..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev deleted file mode 100644 index 6c012507a7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/dev +++ /dev/null @@ -1 +0,0 @@ -189:520 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/devnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/devnum deleted file mode 100644 index ec635144f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/devnum +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/driver deleted file mode 120000 index 092d2282f3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 deleted file mode 120000 index 73771a2a71..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.9_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idProduct deleted file mode 100644 index a001e3e847..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idProduct +++ /dev/null @@ -1 +0,0 @@ -007b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idVendor deleted file mode 100644 index 7520ff4088..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/idVendor +++ /dev/null @@ -1 +0,0 @@ -0421 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer deleted file mode 100644 index 67a1dab28f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Nokia diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/maxchild deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/maxchild +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/active_duration deleted file mode 100644 index 4504f4a975..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -20902 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/connected_duration deleted file mode 100644 index bd76d61330..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -20901 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/level b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/level deleted file mode 100644 index b3d86404ab..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/level +++ /dev/null @@ -1 +0,0 @@ -on diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/persist b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/persist deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/persist +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/product b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/product deleted file mode 100644 index 382a6a8dc6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/product +++ /dev/null @@ -1 +0,0 @@ -N78 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/quirks b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/serial b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/serial deleted file mode 100644 index 3f1a85e94e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/serial +++ /dev/null @@ -1 +0,0 @@ -354172020305000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed deleted file mode 100644 index 36e082614b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/speed +++ /dev/null @@ -1 +0,0 @@ -480 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/subsystem deleted file mode 120000 index af968de921..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/uevent deleted file mode 100644 index 9e5884a126..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=520 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=421/7b/100 -TYPE=2/0/0 -BUSNUM=005 -DEVNUM=009 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/urbnum deleted file mode 100644 index 209e3ef4b6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/urbnum +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev deleted file mode 100644 index 7ac0f6d850..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/device deleted file mode 120000 index 87adad0979..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../5-2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem deleted file mode 120000 index c25f816d1d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent deleted file mode 100644 index 2e248d76c3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=33 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/usb_endpoint/usbdev5.9_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/version b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/version deleted file mode 100644 index 602f25e1f4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/5-2/version +++ /dev/null @@ -1 +0,0 @@ - 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized_default b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized_default deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/authorized_default +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bConfigurationValue b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bConfigurationValue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bConfigurationValue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceClass deleted file mode 100644 index 86397e5c10..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceClass +++ /dev/null @@ -1 +0,0 @@ -09 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceProtocol +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bDeviceSubClass +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPacketSize0 +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower deleted file mode 100644 index ca2ea0dab5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bMaxPower +++ /dev/null @@ -1 +0,0 @@ - 0mA diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumConfigurations b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumConfigurations deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumConfigurations +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumInterfaces b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumInterfaces deleted file mode 100644 index c6cf38636b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bNumInterfaces +++ /dev/null @@ -1 +0,0 @@ - 1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice deleted file mode 100644 index ff5c1613f9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bcdDevice +++ /dev/null @@ -1 +0,0 @@ -0206 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bmAttributes deleted file mode 100644 index 4fe4106b50..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -e0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/busnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/busnum deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/busnum +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/configuration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/configuration deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/descriptors b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/descriptors deleted file mode 100644 index 18f922b269..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/descriptors and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev deleted file mode 100644 index 3ee8435395..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/dev +++ /dev/null @@ -1 +0,0 @@ -189:512 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/devnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/devnum deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/devnum +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/driver b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/driver deleted file mode 120000 index 0b3eba3d91..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 deleted file mode 120000 index 9e855fa6a8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/ep_00 +++ /dev/null @@ -1 +0,0 @@ -usb_endpoint/usbdev5.1_ep00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idProduct b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idProduct deleted file mode 100644 index 5fca1fda0b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idProduct +++ /dev/null @@ -1 +0,0 @@ -0002 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idVendor b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idVendor deleted file mode 100644 index d247637ee0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/idVendor +++ /dev/null @@ -1 +0,0 @@ -1d6b diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/manufacturer b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/manufacturer deleted file mode 100644 index 8d50915527..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/manufacturer +++ /dev/null @@ -1 +0,0 @@ -Linux 2.6.27-rc7-00106-g6ef190c-dirty ehci_hcd diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/maxchild b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/maxchild deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/maxchild +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/active_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/active_duration deleted file mode 100644 index 6705442e12..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/active_duration +++ /dev/null @@ -1 +0,0 @@ -547102 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/autosuspend b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/connected_duration b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/connected_duration deleted file mode 100644 index c5c8756420..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/connected_duration +++ /dev/null @@ -1 +0,0 @@ -8371932 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/level b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/level deleted file mode 100644 index 865faf10cb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/level +++ /dev/null @@ -1 +0,0 @@ -auto diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/wakeup deleted file mode 100644 index 86981e69f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -enabled diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/product b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/product deleted file mode 100644 index 45e90b152b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/product +++ /dev/null @@ -1 +0,0 @@ -EHCI Host Controller diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/quirks b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/quirks deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/quirks +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/serial b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/serial deleted file mode 100644 index 1c4cc57a63..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/serial +++ /dev/null @@ -1 +0,0 @@ -0000:00:1d.7 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/speed b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/speed deleted file mode 100644 index 36e082614b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/speed +++ /dev/null @@ -1 +0,0 @@ -480 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/subsystem deleted file mode 120000 index 77682faf80..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/usb \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/uevent deleted file mode 100644 index 2f55d8d1aa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/uevent +++ /dev/null @@ -1,8 +0,0 @@ -MAJOR=189 -MINOR=512 -DEVTYPE=usb_device -DRIVER=usb -PRODUCT=1d6b/2/206 -TYPE=9/0/0 -BUSNUM=005 -DEVNUM=001 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/urbnum b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/urbnum deleted file mode 100644 index 1b9cba4ae5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/urbnum +++ /dev/null @@ -1 +0,0 @@ -151 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bEndpointAddress b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bEndpointAddress deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bEndpointAddress +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bInterval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bInterval deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bInterval +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bLength b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bLength deleted file mode 100644 index 2c7456e3eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bLength +++ /dev/null @@ -1 +0,0 @@ -07 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/bmAttributes +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/dev b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/dev deleted file mode 100644 index 7d5a3cabad..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/dev +++ /dev/null @@ -1 +0,0 @@ -252:9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/device deleted file mode 120000 index b8e2d31484..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/device +++ /dev/null @@ -1 +0,0 @@ -../../../usb5 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/direction b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/direction deleted file mode 100644 index 49f33a8c6e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/direction +++ /dev/null @@ -1 +0,0 @@ -both diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/interval b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/interval deleted file mode 100644 index a6d0b37ffa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/interval +++ /dev/null @@ -1 +0,0 @@ -0ms diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/subsystem deleted file mode 120000 index 4f40f16eba..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/usb_endpoint \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/type b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/type deleted file mode 100644 index 6ba80ac5b5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/type +++ /dev/null @@ -1 +0,0 @@ -Control diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/uevent deleted file mode 100644 index a3bbb7a76a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=252 -MINOR=9 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/wMaxPacketSize b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/wMaxPacketSize deleted file mode 100644 index b5fda7b228..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/usb_endpoint/usbdev5.1_ep00/wMaxPacketSize +++ /dev/null @@ -1 +0,0 @@ -0040 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/version b/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/version deleted file mode 100644 index 602f25e1f4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb5/version +++ /dev/null @@ -1 +0,0 @@ - 2.00 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/companion b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/companion deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/device b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/device deleted file mode 120000 index 05e6ef115e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1d.7 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/subsystem b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/subsystem deleted file mode 120000 index 72a11573f8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/usb_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/uevent b/test/sys/devices/pci0000:00/0000:00:1d.7/usb_host/usb_host5/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1d.7/vendor b/test/sys/devices/pci0000:00/0000:00:1d.7/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1d.7/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/class b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/class deleted file mode 100644 index 6096f61aaf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/class +++ /dev/null @@ -1 +0,0 @@ -0x060700 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config deleted file mode 100644 index d428930057..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/device deleted file mode 100644 index a06a6ac093..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/device +++ /dev/null @@ -1 +0,0 @@ -0xac56 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/driver b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/driver deleted file mode 120000 index 9c9a8b7a35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci/drivers/yenta_cardbus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/enable b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/enable deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/enable +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/firmware_node deleted file mode 120000 index 01ec1668be..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../../LNXSYSTM:00/device:00/PNP0A08:00/device:11/device:12 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/irq b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/irq deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/irq +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/modalias b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/modalias deleted file mode 100644 index 4052d948c8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v0000104Cd0000AC56sv000017AAsd00002012bc06sc07i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/msi_bus +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/cpuaffinity deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/cpuaffinity +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/device deleted file mode 120000 index 6a46f1e54e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:15:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/subsystem deleted file mode 120000 index deea66be17..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pci_bus/0000:16/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_io b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_io deleted file mode 100644 index b1c976ec33..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_io +++ /dev/null @@ -1,6 +0,0 @@ -0x00000100 - 0x000003af -0x000003e0 - 0x000004ff -0x00000820 - 0x000008ff -0x00000a00 - 0x00000aff -0x00000c00 - 0x00000cf7 -0x0000a000 - 0x0000dfff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_mem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_mem deleted file mode 100644 index 2f519cc453..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_mem +++ /dev/null @@ -1,5 +0,0 @@ -0x000c0000 - 0x000fffff -0x60000000 - 0x60ffffff -0xa0000000 - 0xa0ffffff -0xe0000000 - 0xe3ffffff -0xe4300000 - 0xe7ffffff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_setup_done b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_setup_done deleted file mode 100644 index 7cfab5b05d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/available_resources_setup_done +++ /dev/null @@ -1 +0,0 @@ -yes diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_irq_mask b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_irq_mask deleted file mode 100644 index d2ce0ecb99..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_irq_mask +++ /dev/null @@ -1 +0,0 @@ -0x0cf8 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_pm_state b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_pm_state deleted file mode 100644 index b3d86404ab..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_pm_state +++ /dev/null @@ -1 +0,0 @@ -on diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_type b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_type deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vcc b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vcc deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_voltage b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_voltage deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vpp b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/card_vpp deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/cis b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/cis deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/device deleted file mode 120000 index 6a46f1e54e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:15:00.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/subsystem deleted file mode 120000 index c09baf13e4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/pcmcia_socket \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/uevent deleted file mode 100644 index 636f168941..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/pcmcia_socket/pcmcia_socket0/uevent +++ /dev/null @@ -1 +0,0 @@ -SOCKET_NO=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource deleted file mode 100644 index 6ce957e317..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource +++ /dev/null @@ -1,12 +0,0 @@ -0x00000000e4300000 0x00000000e4300fff 0x0000000000020200 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x000000000000a000 0x000000000000a0ff 0x0000000000020100 -0x000000000000a400 0x000000000000a4ff 0x0000000000020100 -0x00000000e0000000 0x00000000e3ffffff 0x0000000000021200 -0x0000000088000000 0x000000008bffffff 0x0000000000020200 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource0 b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/resource0 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem deleted file mode 120000 index d6210992bb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_device deleted file mode 100644 index 5a95ea2bb8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x2012 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/uevent deleted file mode 100644 index 7c77bd7d77..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=yenta_cardbus -PCI_CLASS=60700 -PCI_ID=104C:AC56 -PCI_SUBSYS_ID=17AA:2012 -PCI_SLOT_NAME=0000:15:00.0 -MODALIAS=pci:v0000104Cd0000AC56sv000017AAsd00002012bc06sc07i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/vendor deleted file mode 100644 index b6b18b2ea4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x104c diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/yenta_registers b/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/yenta_registers deleted file mode 100644 index e3eb56c08d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/0000:15:00.0/yenta_registers +++ /dev/null @@ -1,11 +0,0 @@ -CB registers: -00: 00000000 00000006 30000087 00000000 -10: 00000400 00000000 00000000 00000000 -20: 00000000 - -ExCA registers: -00: 84 01 00 50 00 08 00 00 - 00 00 01 00 00 00 01 00 -10: 00 00 00 00 00 00 c0 00 - 00 00 00 00 00 00 00 00 -20: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 -30: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00 -40: 00 00 00 00 00 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1e.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/class b/test/sys/devices/pci0000:00/0000:00:1e.0/class deleted file mode 100644 index 725935d078..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/class +++ /dev/null @@ -1 +0,0 @@ -0x060401 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/config b/test/sys/devices/pci0000:00/0000:00:1e.0/config deleted file mode 100644 index 412c109356..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1e.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/device b/test/sys/devices/pci0000:00/0000:00:1e.0/device deleted file mode 100644 index 9f43cba31e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/device +++ /dev/null @@ -1 +0,0 @@ -0x2448 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/enable b/test/sys/devices/pci0000:00/0000:00:1e.0/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1e.0/firmware_node deleted file mode 120000 index 9c1a17f9b2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:11 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/irq b/test/sys/devices/pci0000:00/0000:00:1e.0/irq deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/irq +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/modalias b/test/sys/devices/pci0000:00/0000:00:1e.0/modalias deleted file mode 100644 index b294153163..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d00002448sv00000000sd00000000bc06sc04i01 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/msi_bus +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/cpuaffinity b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/cpuaffinity deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/cpuaffinity +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/device b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/device deleted file mode 120000 index a97370a78a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/device +++ /dev/null @@ -1 +0,0 @@ -../../../0000:00:1e.0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/subsystem deleted file mode 120000 index 1d26d30581..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/pci_bus/0000:15/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1e.0/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/resource b/test/sys/devices/pci0000:00/0000:00:1e.0/resource deleted file mode 100644 index 1c1359fc60..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/resource +++ /dev/null @@ -1,12 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x000000000000a000 0x000000000000dfff 0x0000000000000100 -0x00000000e4300000 0x00000000e7ffffff 0x0000000000000200 -0x00000000e0000000 0x00000000e3ffffff 0x0000000000001201 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_device deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_vendor deleted file mode 100644 index aa01954cc8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x0000 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/uevent b/test/sys/devices/pci0000:00/0000:00:1e.0/uevent deleted file mode 100644 index c028e2616f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/uevent +++ /dev/null @@ -1,5 +0,0 @@ -PCI_CLASS=60401 -PCI_ID=8086:2448 -PCI_SUBSYS_ID=0000:0000 -PCI_SLOT_NAME=0000:00:1e.0 -MODALIAS=pci:v00008086d00002448sv00000000sd00000000bc06sc04i01 diff --git a/test/sys/devices/pci0000:00/0000:00:1e.0/vendor b/test/sys/devices/pci0000:00/0000:00:1e.0/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1e.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1f.0/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/class b/test/sys/devices/pci0000:00/0000:00:1f.0/class deleted file mode 100644 index bc758a7b5e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/class +++ /dev/null @@ -1 +0,0 @@ -0x060100 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/config b/test/sys/devices/pci0000:00/0000:00:1f.0/config deleted file mode 100644 index 725c494770..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1f.0/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/device b/test/sys/devices/pci0000:00/0000:00:1f.0/device deleted file mode 100644 index b31957e282..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/device +++ /dev/null @@ -1 +0,0 @@ -0x27b9 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/enable b/test/sys/devices/pci0000:00/0000:00:1f.0/enable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/enable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/firmware_node b/test/sys/devices/pci0000:00/0000:00:1f.0/firmware_node deleted file mode 120000 index fb3bddbb26..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/irq b/test/sys/devices/pci0000:00/0000:00:1f.0/irq deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/irq +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpus b/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/modalias b/test/sys/devices/pci0000:00/0000:00:1f.0/modalias deleted file mode 100644 index 8f0301c211..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027B9sv000017AAsd00002009bc06sc01i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/msi_bus b/test/sys/devices/pci0000:00/0000:00:1f.0/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/resource b/test/sys/devices/pci0000:00/0000:00:1f.0/resource deleted file mode 100644 index 2d8766d6a3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_device deleted file mode 100644 index 8cee5396f3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x2009 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.0/uevent deleted file mode 100644 index 3ca5d6a5aa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/uevent +++ /dev/null @@ -1,5 +0,0 @@ -PCI_CLASS=60100 -PCI_ID=8086:27B9 -PCI_SUBSYS_ID=17AA:2009 -PCI_SLOT_NAME=0000:00:1f.0 -MODALIAS=pci:v00008086d000027B9sv000017AAsd00002009bc06sc01i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.0/vendor b/test/sys/devices/pci0000:00/0000:00:1f.0/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.0/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1f.1/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/class b/test/sys/devices/pci0000:00/0000:00:1f.1/class deleted file mode 100644 index d2ded34f93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/class +++ /dev/null @@ -1 +0,0 @@ -0x01018a diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/config b/test/sys/devices/pci0000:00/0000:00:1f.1/config deleted file mode 100644 index 7856da2674..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1f.1/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/device b/test/sys/devices/pci0000:00/0000:00:1f.1/device deleted file mode 100644 index 1e54094661..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/device +++ /dev/null @@ -1 +0,0 @@ -0x27df diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/driver b/test/sys/devices/pci0000:00/0000:00:1f.1/driver deleted file mode 120000 index f2901b951a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/ata_piix \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/enable b/test/sys/devices/pci0000:00/0000:00:1f.1/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/firmware_node b/test/sys/devices/pci0000:00/0000:00:1f.1/firmware_node deleted file mode 120000 index ebc9a22514..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:13 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/active_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/active_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/can_queue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/can_queue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/cmd_per_lun +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/device deleted file mode 120000 index 59e9abe1c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/device +++ /dev/null @@ -1 +0,0 @@ -../../../host4 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/host_busy deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/host_busy +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/proc_name deleted file mode 100644 index eaf803c1a1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/proc_name +++ /dev/null @@ -1 +0,0 @@ -ata_piix diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_capabilities deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_capabilities +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_guard_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/prot_guard_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/sg_tablesize deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/sg_tablesize +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/state b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/subsystem deleted file mode 120000 index b369d53598..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/supported_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/supported_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unchecked_isa_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unchecked_isa_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unique_id deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/scsi_host/host4/unique_id +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/subsystem deleted file mode 120000 index c4acf92b7f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/bdi b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/bdi deleted file mode 120000 index 0a96e7f45f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/bdi +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../virtual/bdi/11:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/capability b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/capability deleted file mode 100644 index d6b24041cf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/capability +++ /dev/null @@ -1 +0,0 @@ -19 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/dev b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/dev deleted file mode 100644 index 3d33f0f4ad..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/dev +++ /dev/null @@ -1 +0,0 @@ -11:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/device deleted file mode 120000 index 32d31073aa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/device +++ /dev/null @@ -1 +0,0 @@ -../../../4:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/hw_sector_size b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/hw_sector_size deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/hw_sector_size +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_max b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_max deleted file mode 100644 index 08558e471c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_max +++ /dev/null @@ -1 +0,0 @@ -16384 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_penalty b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_penalty deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/back_seek_penalty +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_async b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_async deleted file mode 100644 index cb1a40df0f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_async +++ /dev/null @@ -1 +0,0 @@ -250 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_sync b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_sync deleted file mode 100644 index d136d6a714..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/fifo_expire_sync +++ /dev/null @@ -1 +0,0 @@ -125 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/quantum b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/quantum deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/quantum +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async deleted file mode 100644 index 425151f3a4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async +++ /dev/null @@ -1 +0,0 @@ -40 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async_rq b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async_rq deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_async_rq +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_idle b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_idle deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_idle +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_sync b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_sync deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/iosched/slice_sync +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_hw_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_hw_sectors_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_hw_sectors_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_sectors_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/max_sectors_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nomerges b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nomerges deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nomerges +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nr_requests b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nr_requests deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/nr_requests +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/read_ahead_kb b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/read_ahead_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/scheduler b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/scheduler deleted file mode 100644 index 8b357d87cf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/queue/scheduler +++ /dev/null @@ -1 +0,0 @@ -noop anticipatory deadline [cfq] diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/range b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/removable b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/removable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/removable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/ro b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/size b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/size deleted file mode 100644 index 8078c2a5cd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/size +++ /dev/null @@ -1 +0,0 @@ -2097151 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/stat b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/subsystem deleted file mode 120000 index 33c70a3d49..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/uevent deleted file mode 100644 index 59eb810607..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/block/sr0/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=11 -MINOR=0 -DEVTYPE=disk diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev deleted file mode 100644 index 69195c0b96..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/dev +++ /dev/null @@ -1 +0,0 @@ -254:1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device deleted file mode 120000 index 32d31073aa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/device +++ /dev/null @@ -1 +0,0 @@ -../../../4:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem deleted file mode 120000 index e2aa920b92..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/bsg \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent deleted file mode 100644 index 02142464db..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/bsg/4:0:0:0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=254 -MINOR=1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/device_blocked deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/device_blocked +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver deleted file mode 120000 index fe479f5836..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/scsi/drivers/sr \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/evt_media_change b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/evt_media_change deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/evt_media_change +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic deleted file mode 120000 index 41bc82db60..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/generic +++ /dev/null @@ -1 +0,0 @@ -scsi_generic/sg1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iocounterbits b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iocounterbits deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iocounterbits +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt deleted file mode 100644 index 32763433b8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iodone_cnt +++ /dev/null @@ -1 +0,0 @@ -0x20b3 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/ioerr_cnt b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/ioerr_cnt deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/ioerr_cnt +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt deleted file mode 100644 index f17fa5cc95..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/iorequest_cnt +++ /dev/null @@ -1 +0,0 @@ -0x82a9 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/modalias b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/modalias deleted file mode 100644 index b584a10dd0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/modalias +++ /dev/null @@ -1 +0,0 @@ -scsi:t-0x05 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/model deleted file mode 100644 index 23bd1b72f6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/model +++ /dev/null @@ -1 +0,0 @@ -DVD-RAM UJ-842 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_depth deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_depth +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_type b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_type deleted file mode 100644 index 621e94f0ec..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/queue_type +++ /dev/null @@ -1 +0,0 @@ -none diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev deleted file mode 100644 index f6ba21e6cf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/rev +++ /dev/null @@ -1 +0,0 @@ -RB01 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device deleted file mode 120000 index 32d31073aa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/device +++ /dev/null @@ -1 +0,0 @@ -../../../4:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/subsystem deleted file mode 120000 index caa8462699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/scsi_device \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_device/4:0:0:0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev deleted file mode 100644 index bd84814a63..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/dev +++ /dev/null @@ -1 +0,0 @@ -21:1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/device deleted file mode 120000 index 32d31073aa..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/device +++ /dev/null @@ -1 +0,0 @@ -../../../4:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem deleted file mode 120000 index 248211f592..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/scsi_generic \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/uevent deleted file mode 100644 index d154bb40a1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_generic/sg1/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=21 -MINOR=1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_level deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/scsi_level +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/state b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/subsystem deleted file mode 120000 index 0093fc1762..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/timeout +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/type deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/type +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent deleted file mode 100644 index 3782602bb0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/uevent +++ /dev/null @@ -1,3 +0,0 @@ -DEVTYPE=scsi_device -DRIVER=sr -MODALIAS=scsi:t-0x05 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor deleted file mode 100644 index 0d22c779a2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/4:0:0:0/vendor +++ /dev/null @@ -1 +0,0 @@ -MATSHITA diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/subsystem deleted file mode 120000 index 117235d664..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/uevent deleted file mode 100644 index ce02d8524b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/target4:0:0/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_target diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host4/uevent deleted file mode 100644 index 934f648e8c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host4/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/active_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/active_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/can_queue deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/can_queue +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/cmd_per_lun +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/device b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/device deleted file mode 120000 index 6916fb5952..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/device +++ /dev/null @@ -1 +0,0 @@ -../../../host5 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/host_busy deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/host_busy +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/proc_name deleted file mode 100644 index eaf803c1a1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/proc_name +++ /dev/null @@ -1 +0,0 @@ -ata_piix diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_capabilities deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_capabilities +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_guard_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/prot_guard_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/sg_tablesize deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/sg_tablesize +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/state b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/subsystem deleted file mode 120000 index b369d53598..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/supported_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/supported_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unchecked_isa_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unchecked_isa_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unique_id deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/scsi_host/host5/unique_id +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/subsystem deleted file mode 120000 index c4acf92b7f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/host5/uevent deleted file mode 100644 index 934f648e8c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/host5/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/irq b/test/sys/devices/pci0000:00/0000:00:1f.1/irq deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/irq +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpus b/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/modalias b/test/sys/devices/pci0000:00/0000:00:1f.1/modalias deleted file mode 100644 index 7d40b86a94..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027DFsv000017AAsd0000200Cbc01sc01i8a diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/msi_bus b/test/sys/devices/pci0000:00/0000:00:1f.1/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource b/test/sys/devices/pci0000:00/0000:00:1f.1/resource deleted file mode 100644 index 51946efb9e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x00000000000001f0 0x00000000000001f7 0x0000000000000110 -0x00000000000003f6 0x00000000000003f6 0x0000000000000110 -0x0000000000000170 0x0000000000000177 0x0000000000000110 -0x0000000000000376 0x0000000000000376 0x0000000000000110 -0x0000000000001880 0x000000000000188f 0x0000000000020101 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource0 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource0 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource1 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource1 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource2 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource2 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource3 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource3 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/resource4 b/test/sys/devices/pci0000:00/0000:00:1f.1/resource4 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_device deleted file mode 100644 index 2402878ff1..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x200c diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.1/uevent deleted file mode 100644 index af637407ff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=ata_piix -PCI_CLASS=1018A -PCI_ID=8086:27DF -PCI_SUBSYS_ID=17AA:200C -PCI_SLOT_NAME=0000:00:1f.1 -MODALIAS=pci:v00008086d000027DFsv000017AAsd0000200Cbc01sc01i8a diff --git a/test/sys/devices/pci0000:00/0000:00:1f.1/vendor b/test/sys/devices/pci0000:00/0000:00:1f.1/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.1/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1f.2/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/class b/test/sys/devices/pci0000:00/0000:00:1f.2/class deleted file mode 100644 index 83229b2e3e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/class +++ /dev/null @@ -1 +0,0 @@ -0x010601 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/config b/test/sys/devices/pci0000:00/0000:00:1f.2/config deleted file mode 100644 index 6e2794dc8c..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1f.2/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/device b/test/sys/devices/pci0000:00/0000:00:1f.2/device deleted file mode 100644 index 3e2c9cc80b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/device +++ /dev/null @@ -1 +0,0 @@ -0x27c5 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/driver b/test/sys/devices/pci0000:00/0000:00:1f.2/driver deleted file mode 120000 index e08571dcb2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/ahci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/enable b/test/sys/devices/pci0000:00/0000:00:1f.2/enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/firmware_node b/test/sys/devices/pci0000:00/0000:00:1f.2/firmware_node deleted file mode 120000 index 9ee381b89e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:16 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/active_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/active_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/can_queue deleted file mode 100644 index e85087affd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/can_queue +++ /dev/null @@ -1 +0,0 @@ -31 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/cmd_per_lun +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/device deleted file mode 120000 index 50ea9d7d91..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/device +++ /dev/null @@ -1 +0,0 @@ -../../../host0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/em_message_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/host_busy deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/host_busy +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy deleted file mode 100644 index 8e795ce1d3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/link_power_management_policy +++ /dev/null @@ -1 +0,0 @@ -medium_power diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/proc_name deleted file mode 100644 index bde306049d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/proc_name +++ /dev/null @@ -1 +0,0 @@ -ahci diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_capabilities deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_capabilities +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_guard_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/prot_guard_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/sg_tablesize deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/sg_tablesize +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/subsystem deleted file mode 120000 index b369d53598..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/supported_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/supported_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unchecked_isa_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unchecked_isa_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unique_id deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/scsi_host/host0/unique_id +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/subsystem deleted file mode 120000 index c4acf92b7f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/bdi b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/bdi deleted file mode 120000 index 6737c794cc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/bdi +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../virtual/bdi/8:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/capability b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/capability deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/capability +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/dev deleted file mode 100644 index fae0a50572..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/dev +++ /dev/null @@ -1 +0,0 @@ -8:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/device deleted file mode 120000 index 79ba80254b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/device +++ /dev/null @@ -1 +0,0 @@ -../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/bsg b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/bsg deleted file mode 120000 index 973a440fb2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/bsg +++ /dev/null @@ -1 +0,0 @@ -../../../bsg/0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/hw_sector_size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/hw_sector_size deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/hw_sector_size +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_max b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_max deleted file mode 100644 index 08558e471c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_max +++ /dev/null @@ -1 +0,0 @@ -16384 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_penalty b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_penalty deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/back_seek_penalty +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_async b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_async deleted file mode 100644 index cb1a40df0f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_async +++ /dev/null @@ -1 +0,0 @@ -250 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_sync b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_sync deleted file mode 100644 index d136d6a714..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/fifo_expire_sync +++ /dev/null @@ -1 +0,0 @@ -125 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/quantum b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/quantum deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/quantum +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async deleted file mode 100644 index 425151f3a4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async +++ /dev/null @@ -1 +0,0 @@ -40 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async_rq b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async_rq deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_async_rq +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_idle b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_idle deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_idle +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_sync b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_sync deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/iosched/slice_sync +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_hw_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_hw_sectors_kb deleted file mode 100644 index 10130bb020..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_hw_sectors_kb +++ /dev/null @@ -1 +0,0 @@ -32767 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_sectors_kb b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_sectors_kb deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/max_sectors_kb +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nomerges b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nomerges deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nomerges +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nr_requests b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nr_requests deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/nr_requests +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/read_ahead_kb b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/read_ahead_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/scheduler b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/scheduler deleted file mode 100644 index 8b357d87cf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/queue/scheduler +++ /dev/null @@ -1 +0,0 @@ -noop anticipatory deadline [cfq] diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/range b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/range deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/range +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/removable b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/ro b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/dev deleted file mode 100644 index 92c4b9b088..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/dev +++ /dev/null @@ -1 +0,0 @@ -8:1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/size deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/size +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/start deleted file mode 100644 index 4b9026d8e2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/start +++ /dev/null @@ -1 +0,0 @@ -63 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/stat deleted file mode 100644 index 0f17c6b4b8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/stat +++ /dev/null @@ -1 +0,0 @@ - 2 0 4 36 0 0 0 0 0 36 36 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/subsystem deleted file mode 120000 index 813accd22c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent deleted file mode 100644 index c70ff22ad4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1/uevent +++ /dev/null @@ -1,4 +0,0 @@ -MAJOR=8 -MINOR=1 -DEVTYPE=partition -DEVNAME=sda1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/dev deleted file mode 100644 index e7cbbe3a6d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/dev +++ /dev/null @@ -1 +0,0 @@ -8:10 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/size deleted file mode 100644 index 33e366515f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/size +++ /dev/null @@ -1 +0,0 @@ -4546332 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/start deleted file mode 100644 index 748059172f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/start +++ /dev/null @@ -1 +0,0 @@ -190820133 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/stat deleted file mode 100644 index 3deac173ed..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/stat +++ /dev/null @@ -1 +0,0 @@ - 42 43 384 417 0 0 0 0 0 286 417 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/subsystem deleted file mode 120000 index 813accd22c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/uevent deleted file mode 100644 index 0fa408dc51..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda10/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=8 -MINOR=10 -DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/dev deleted file mode 100644 index b3d5042192..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/dev +++ /dev/null @@ -1 +0,0 @@ -8:5 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/size deleted file mode 100644 index 73bd1fe947..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/size +++ /dev/null @@ -1 +0,0 @@ -62926479 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/start deleted file mode 100644 index 0a3e7b0422..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/start +++ /dev/null @@ -1 +0,0 @@ -126 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat deleted file mode 100644 index 14817cb638..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/stat +++ /dev/null @@ -1 +0,0 @@ - 11087 4819 566626 169007 2951 4548 59992 129572 0 65249 298573 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/subsystem deleted file mode 120000 index 813accd22c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent deleted file mode 100644 index ab7569dc37..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5/uevent +++ /dev/null @@ -1,4 +0,0 @@ -MAJOR=8 -MINOR=5 -DEVTYPE=partition -DEVNAME=sda5 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/dev deleted file mode 100644 index c1a2f319ee..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/dev +++ /dev/null @@ -1 +0,0 @@ -8:6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/size deleted file mode 100644 index 42ca54d94d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/size +++ /dev/null @@ -1 +0,0 @@ -41945652 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/start deleted file mode 100644 index fdac9735a9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/start +++ /dev/null @@ -1 +0,0 @@ -62926668 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat deleted file mode 100644 index 0b9162b06e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/stat +++ /dev/null @@ -1 +0,0 @@ - 1648 67 21334 22824 10801 58775 557024 2548214 0 51231 2571037 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/subsystem deleted file mode 120000 index 813accd22c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/uevent deleted file mode 100644 index e08f4c0982..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda6/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=8 -MINOR=6 -DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/dev deleted file mode 100644 index e8f00a5462..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/dev +++ /dev/null @@ -1 +0,0 @@ -8:7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/size deleted file mode 100644 index 5424df4263..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/size +++ /dev/null @@ -1 +0,0 @@ -19534977 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/start deleted file mode 100644 index d8099b00ac..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/start +++ /dev/null @@ -1 +0,0 @@ -104872383 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/stat deleted file mode 100644 index ea68657675..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/stat +++ /dev/null @@ -1 +0,0 @@ - 35 263 298 419 0 0 0 0 0 298 419 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/subsystem deleted file mode 120000 index 813accd22c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/uevent deleted file mode 100644 index 308c3941be..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda7/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=8 -MINOR=7 -DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/dev deleted file mode 100644 index e9530d7b36..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/dev +++ /dev/null @@ -1 +0,0 @@ -8:8 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/size deleted file mode 100644 index 5424df4263..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/size +++ /dev/null @@ -1 +0,0 @@ -19534977 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/start deleted file mode 100644 index e8e80b605d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/start +++ /dev/null @@ -1 +0,0 @@ -124407423 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/stat deleted file mode 100644 index c69e9c06ce..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/stat +++ /dev/null @@ -1 +0,0 @@ - 34 264 298 498 0 0 0 0 0 368 498 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/subsystem deleted file mode 120000 index 813accd22c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/uevent deleted file mode 100644 index f23daf504f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda8/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=8 -MINOR=8 -DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/dev deleted file mode 100644 index acf0ba30b9..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/dev +++ /dev/null @@ -1 +0,0 @@ -8:9 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 deleted file mode 120000 index f69190bd80..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/holders/md0 +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../virtual/block/md0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/make-it-fail b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/size deleted file mode 100644 index e9c908dcb4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/size +++ /dev/null @@ -1 +0,0 @@ -46877607 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/start b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/start deleted file mode 100644 index 443fe70bd0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/start +++ /dev/null @@ -1 +0,0 @@ -143942463 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/stat deleted file mode 100644 index 65e26a19dd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/stat +++ /dev/null @@ -1 +0,0 @@ - 70 322 896 800 3 0 40 240 0 945 1039 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/subsystem deleted file mode 120000 index 813accd22c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/uevent deleted file mode 100644 index 9bea60637b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=8 -MINOR=9 -DEVTYPE=partition diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/size b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/size deleted file mode 100644 index 967b32b605..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/size +++ /dev/null @@ -1 +0,0 @@ -195371568 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat deleted file mode 100644 index 64703d7f45..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/stat +++ /dev/null @@ -1 +0,0 @@ - 12939 5801 590192 194190 13755 63323 617056 2678026 0 114408 2872209 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/subsystem deleted file mode 120000 index 33c70a3d49..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test:colon+plus b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test:colon+plus deleted file mode 100644 index 0fed9a5d60..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test:colon+plus +++ /dev/null @@ -1 +0,0 @@ -colon diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/test_empty_file deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent deleted file mode 100644 index af0df2f298..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/uevent +++ /dev/null @@ -1,4 +0,0 @@ -MAJOR=8 -MINOR=0 -DEVTYPE=disk -DEVNAME=sda diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev deleted file mode 100644 index 7a902749a2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/dev +++ /dev/null @@ -1 +0,0 @@ -254:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device deleted file mode 120000 index 79ba80254b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem deleted file mode 120000 index e2aa920b92..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/bsg \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent deleted file mode 100644 index 79ff461eda..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/bsg/0:0:0:0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=254 -MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/device_blocked b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/device_blocked deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/device_blocked +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver deleted file mode 120000 index 2ea53129c0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/scsi/drivers/sd \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/evt_media_change b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/evt_media_change deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/evt_media_change +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic deleted file mode 120000 index 4bf718c25a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/generic +++ /dev/null @@ -1 +0,0 @@ -scsi_generic/sg0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iocounterbits b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iocounterbits deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iocounterbits +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt deleted file mode 100644 index a334449373..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iodone_cnt +++ /dev/null @@ -1 +0,0 @@ -0x6877 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt deleted file mode 100644 index e881767f8c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/ioerr_cnt +++ /dev/null @@ -1 +0,0 @@ -0x6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt deleted file mode 100644 index a334449373..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/iorequest_cnt +++ /dev/null @@ -1 +0,0 @@ -0x6877 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/modalias b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/modalias deleted file mode 100644 index cbde94ebdb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/modalias +++ /dev/null @@ -1 +0,0 @@ -scsi:t-0x00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/model b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/model deleted file mode 100644 index 1147c9f13e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/model +++ /dev/null @@ -1 +0,0 @@ -ST910021AS diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_depth b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_depth deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_depth +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_type deleted file mode 100644 index 621e94f0ec..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/queue_type +++ /dev/null @@ -1 +0,0 @@ -none diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev deleted file mode 100644 index 4c88fe11eb..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/rev +++ /dev/null @@ -1 +0,0 @@ -4.06 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device deleted file mode 120000 index 79ba80254b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/subsystem deleted file mode 120000 index caa8462699..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/scsi_device \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_device/0:0:0:0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/FUA +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/allow_restart b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/allow_restart deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/allow_restart +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/app_tag_own b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/app_tag_own deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/app_tag_own +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/cache_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/cache_type deleted file mode 100644 index 5e6bcb066b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/cache_type +++ /dev/null @@ -1 +0,0 @@ -write back diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device deleted file mode 120000 index 79ba80254b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/manage_start_stop +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/protection_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/protection_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/protection_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/subsystem deleted file mode 120000 index c02ce9f005..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/scsi_disk \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_disk/0:0:0:0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev deleted file mode 100644 index 992e92097e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/dev +++ /dev/null @@ -1 +0,0 @@ -21:0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/device deleted file mode 120000 index 79ba80254b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/device +++ /dev/null @@ -1 +0,0 @@ -../../../0:0:0:0 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem deleted file mode 120000 index 248211f592..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../../class/scsi_generic \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/uevent deleted file mode 100644 index 8bfb5920b3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_generic/sg0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=21 -MINOR=0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_level b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_level deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/scsi_level +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/subsystem deleted file mode 120000 index 0093fc1762..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/sw_activity b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/sw_activity deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout deleted file mode 100644 index abdfb053e4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/timeout +++ /dev/null @@ -1 +0,0 @@ -60 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/type b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent deleted file mode 100644 index 85c5088edf..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/uevent +++ /dev/null @@ -1,3 +0,0 @@ -DEVTYPE=scsi_device -DRIVER=sd -MODALIAS=scsi:t-0x00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor deleted file mode 100644 index fdc812418a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/vendor +++ /dev/null @@ -1 +0,0 @@ -ATA diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/whitespace_test b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/whitespace_test deleted file mode 100644 index e3d48f0fe0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/whitespace_test +++ /dev/null @@ -1 +0,0 @@ -WHITE SPACE diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/subsystem deleted file mode 120000 index 117235d664..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/uevent deleted file mode 100644 index ce02d8524b..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_target diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host0/uevent deleted file mode 100644 index 934f648e8c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host0/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/active_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/active_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/can_queue deleted file mode 100644 index e85087affd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/can_queue +++ /dev/null @@ -1 +0,0 @@ -31 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/cmd_per_lun +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/device deleted file mode 120000 index 20f114d36a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/device +++ /dev/null @@ -1 +0,0 @@ -../../../host1 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/em_message_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/host_busy deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/host_busy +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/link_power_management_policy b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/link_power_management_policy deleted file mode 100644 index 7fa451caf2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/link_power_management_policy +++ /dev/null @@ -1 +0,0 @@ -max_performance diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/proc_name deleted file mode 100644 index bde306049d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/proc_name +++ /dev/null @@ -1 +0,0 @@ -ahci diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_capabilities deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_capabilities +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_guard_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/prot_guard_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/sg_tablesize deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/sg_tablesize +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/subsystem deleted file mode 120000 index b369d53598..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/supported_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/supported_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unchecked_isa_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unchecked_isa_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unique_id deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/scsi_host/host1/unique_id +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/subsystem deleted file mode 120000 index c4acf92b7f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host1/uevent deleted file mode 100644 index 934f648e8c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host1/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/active_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/active_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/can_queue deleted file mode 100644 index e85087affd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/can_queue +++ /dev/null @@ -1 +0,0 @@ -31 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/cmd_per_lun +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/device deleted file mode 120000 index c616df189a..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/device +++ /dev/null @@ -1 +0,0 @@ -../../../host2 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/em_message_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/host_busy deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/host_busy +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/link_power_management_policy b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/link_power_management_policy deleted file mode 100644 index 7fa451caf2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/link_power_management_policy +++ /dev/null @@ -1 +0,0 @@ -max_performance diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/proc_name deleted file mode 100644 index bde306049d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/proc_name +++ /dev/null @@ -1 +0,0 @@ -ahci diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_capabilities deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_capabilities +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_guard_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/prot_guard_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/sg_tablesize deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/sg_tablesize +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/subsystem deleted file mode 120000 index b369d53598..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/supported_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/supported_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unchecked_isa_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unchecked_isa_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unique_id deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/scsi_host/host2/unique_id +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/subsystem deleted file mode 120000 index c4acf92b7f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host2/uevent deleted file mode 100644 index 934f648e8c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host2/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/active_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/active_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/active_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/can_queue b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/can_queue deleted file mode 100644 index e85087affd..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/can_queue +++ /dev/null @@ -1 +0,0 @@ -31 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/cmd_per_lun +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/device b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/device deleted file mode 120000 index 027c07ff96..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/device +++ /dev/null @@ -1 +0,0 @@ -../../../host3 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/em_message_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/host_busy b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/host_busy deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/host_busy +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/link_power_management_policy b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/link_power_management_policy deleted file mode 100644 index 7fa451caf2..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/link_power_management_policy +++ /dev/null @@ -1 +0,0 @@ -max_performance diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/proc_name b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/proc_name deleted file mode 100644 index bde306049d..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/proc_name +++ /dev/null @@ -1 +0,0 @@ -ahci diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_capabilities b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_capabilities deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_capabilities +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_guard_type b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_guard_type deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/prot_guard_type +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/sg_tablesize b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/sg_tablesize deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/sg_tablesize +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/state b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/state deleted file mode 100644 index a2ae71b338..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/state +++ /dev/null @@ -1 +0,0 @@ -running diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/subsystem deleted file mode 120000 index b369d53598..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/scsi_host \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/supported_mode b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/supported_mode deleted file mode 100644 index 46cc42c0d5..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/supported_mode +++ /dev/null @@ -1 +0,0 @@ -Initiator diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unchecked_isa_dma b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unchecked_isa_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unchecked_isa_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unique_id b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unique_id deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/scsi_host/host3/unique_id +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/subsystem deleted file mode 120000 index c4acf92b7f..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/scsi \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/host3/uevent deleted file mode 100644 index 934f648e8c..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/host3/uevent +++ /dev/null @@ -1 +0,0 @@ -DEVTYPE=scsi_host diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/irq b/test/sys/devices/pci0000:00/0000:00:1f.2/irq deleted file mode 100644 index 80e3e6eab6..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/irq +++ /dev/null @@ -1 +0,0 @@ -506 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpus b/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/modalias b/test/sys/devices/pci0000:00/0000:00:1f.2/modalias deleted file mode 100644 index 3769235882..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027C5sv000017AAsd0000200Dbc01sc06i01 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/msi_bus b/test/sys/devices/pci0000:00/0000:00:1f.2/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.2/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource b/test/sys/devices/pci0000:00/0000:00:1f.2/resource deleted file mode 100644 index 1c4b743cb4..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x00000000000018c8 0x00000000000018cf 0x0000000000020101 -0x00000000000018ac 0x00000000000018af 0x0000000000020101 -0x00000000000018c0 0x00000000000018c7 0x0000000000020101 -0x00000000000018a8 0x00000000000018ab 0x0000000000020101 -0x00000000000018b0 0x00000000000018bf 0x0000000000020101 -0x00000000ee404400 0x00000000ee4047ff 0x0000000000020200 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource0 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource0 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource1 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource1 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource2 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource2 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource3 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource3 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource4 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource4 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/resource5 b/test/sys/devices/pci0000:00/0000:00:1f.2/resource5 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_device deleted file mode 100644 index d1a710ea02..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x200d diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/uevent b/test/sys/devices/pci0000:00/0000:00:1f.2/uevent deleted file mode 100644 index 328e9dd1f3..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=ahci -PCI_CLASS=10601 -PCI_ID=8086:27C5 -PCI_SUBSYS_ID=17AA:200D -PCI_SLOT_NAME=0000:00:1f.2 -MODALIAS=pci:v00008086d000027C5sv000017AAsd0000200Dbc01sc06i01 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.2/vendor b/test/sys/devices/pci0000:00/0000:00:1f.2/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.2/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/broken_parity_status b/test/sys/devices/pci0000:00/0000:00:1f.3/broken_parity_status deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/broken_parity_status +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/class b/test/sys/devices/pci0000:00/0000:00:1f.3/class deleted file mode 100644 index 4c9fbc3630..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/class +++ /dev/null @@ -1 +0,0 @@ -0x0c0500 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/config b/test/sys/devices/pci0000:00/0000:00:1f.3/config deleted file mode 100644 index 11498afd39..0000000000 Binary files a/test/sys/devices/pci0000:00/0000:00:1f.3/config and /dev/null differ diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/device b/test/sys/devices/pci0000:00/0000:00:1f.3/device deleted file mode 100644 index 7993325705..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/device +++ /dev/null @@ -1 +0,0 @@ -0x27da diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/enable b/test/sys/devices/pci0000:00/0000:00:1f.3/enable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/enable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/firmware_node b/test/sys/devices/pci0000:00/0000:00:1f.3/firmware_node deleted file mode 120000 index 29587b0613..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:18 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/irq b/test/sys/devices/pci0000:00/0000:00:1f.3/irq deleted file mode 100644 index b4de394767..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/irq +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpulist b/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpulist deleted file mode 100644 index 74fc2fb6b0..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpulist +++ /dev/null @@ -1 +0,0 @@ -0-7 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpus b/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpus deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/local_cpus +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/modalias b/test/sys/devices/pci0000:00/0000:00:1f.3/modalias deleted file mode 100644 index 4dae4f8822..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/modalias +++ /dev/null @@ -1 +0,0 @@ -pci:v00008086d000027DAsv000017AAsd0000200Fbc0Csc05i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/msi_bus b/test/sys/devices/pci0000:00/0000:00:1f.3/msi_bus deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/power/wakeup b/test/sys/devices/pci0000:00/0000:00:1f.3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/resource b/test/sys/devices/pci0000:00/0000:00:1f.3/resource deleted file mode 100644 index abe447f282..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/resource +++ /dev/null @@ -1,7 +0,0 @@ -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x00000000000018e0 0x00000000000018ff 0x0000000000020101 -0x0000000000000000 0x0000000000000000 0x0000000000000000 -0x0000000000000000 0x0000000000000000 0x0000000000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/resource4 b/test/sys/devices/pci0000:00/0000:00:1f.3/resource4 deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem b/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem deleted file mode 120000 index 4b20ef9984..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_device b/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_device deleted file mode 100644 index fdb60b6c65..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_device +++ /dev/null @@ -1 +0,0 @@ -0x200f diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_vendor b/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_vendor deleted file mode 100644 index 49311ac3d8..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/subsystem_vendor +++ /dev/null @@ -1 +0,0 @@ -0x17aa diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/uevent b/test/sys/devices/pci0000:00/0000:00:1f.3/uevent deleted file mode 100644 index 018d6a9a40..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/uevent +++ /dev/null @@ -1,5 +0,0 @@ -PCI_CLASS=C0500 -PCI_ID=8086:27DA -PCI_SUBSYS_ID=17AA:200F -PCI_SLOT_NAME=0000:00:1f.3 -MODALIAS=pci:v00008086d000027DAsv000017AAsd0000200Fbc0Csc05i00 diff --git a/test/sys/devices/pci0000:00/0000:00:1f.3/vendor b/test/sys/devices/pci0000:00/0000:00:1f.3/vendor deleted file mode 100644 index ce6dc4da35..0000000000 --- a/test/sys/devices/pci0000:00/0000:00:1f.3/vendor +++ /dev/null @@ -1 +0,0 @@ -0x8086 diff --git a/test/sys/devices/pci0000:00/firmware_node b/test/sys/devices/pci0000:00/firmware_node deleted file mode 120000 index d3a6b704b4..0000000000 --- a/test/sys/devices/pci0000:00/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../LNXSYSTM:00/device:00/PNP0A08:00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/cpuaffinity b/test/sys/devices/pci0000:00/pci_bus/0000:00/cpuaffinity deleted file mode 100644 index fcd15acf93..0000000000 --- a/test/sys/devices/pci0000:00/pci_bus/0000:00/cpuaffinity +++ /dev/null @@ -1 +0,0 @@ -ff diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/device b/test/sys/devices/pci0000:00/pci_bus/0000:00/device deleted file mode 120000 index 1b094a25e9..0000000000 --- a/test/sys/devices/pci0000:00/pci_bus/0000:00/device +++ /dev/null @@ -1 +0,0 @@ -../../../pci0000:00 \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/power/wakeup b/test/sys/devices/pci0000:00/pci_bus/0000:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/pci_bus/0000:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/subsystem b/test/sys/devices/pci0000:00/pci_bus/0000:00/subsystem deleted file mode 120000 index e41a3cae86..0000000000 --- a/test/sys/devices/pci0000:00/pci_bus/0000:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/pci_bus \ No newline at end of file diff --git a/test/sys/devices/pci0000:00/pci_bus/0000:00/uevent b/test/sys/devices/pci0000:00/pci_bus/0000:00/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pci0000:00/power/wakeup b/test/sys/devices/pci0000:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pci0000:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pci0000:00/uevent b/test/sys/devices/pci0000:00/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/dock.0/docked b/test/sys/devices/platform/dock.0/docked deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/dock.0/docked +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/dock.0/flags b/test/sys/devices/platform/dock.0/flags deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/dock.0/flags +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/dock.0/modalias b/test/sys/devices/platform/dock.0/modalias deleted file mode 100644 index a591f3fed0..0000000000 --- a/test/sys/devices/platform/dock.0/modalias +++ /dev/null @@ -1 +0,0 @@ -platform:dock diff --git a/test/sys/devices/platform/dock.0/power/wakeup b/test/sys/devices/platform/dock.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/dock.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/dock.0/subsystem b/test/sys/devices/platform/dock.0/subsystem deleted file mode 120000 index deb3a3fbdd..0000000000 --- a/test/sys/devices/platform/dock.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/dock.0/uevent b/test/sys/devices/platform/dock.0/uevent deleted file mode 100644 index ba0fe39c25..0000000000 --- a/test/sys/devices/platform/dock.0/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=platform:dock diff --git a/test/sys/devices/platform/dock.0/uid b/test/sys/devices/platform/dock.0/uid deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/dock.0/uid +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/driver b/test/sys/devices/platform/i8042/driver deleted file mode 120000 index 4afb21678f..0000000000 --- a/test/sys/devices/platform/i8042/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform/drivers/i8042 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/modalias b/test/sys/devices/platform/i8042/modalias deleted file mode 100644 index c28b0df3d2..0000000000 --- a/test/sys/devices/platform/i8042/modalias +++ /dev/null @@ -1 +0,0 @@ -platform:i8042 diff --git a/test/sys/devices/platform/i8042/power/wakeup b/test/sys/devices/platform/i8042/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio0/bind_mode b/test/sys/devices/platform/i8042/serio0/bind_mode deleted file mode 100644 index 865faf10cb..0000000000 --- a/test/sys/devices/platform/i8042/serio0/bind_mode +++ /dev/null @@ -1 +0,0 @@ -auto diff --git a/test/sys/devices/platform/i8042/serio0/description b/test/sys/devices/platform/i8042/serio0/description deleted file mode 100644 index 12ea600444..0000000000 --- a/test/sys/devices/platform/i8042/serio0/description +++ /dev/null @@ -1 +0,0 @@ -i8042 KBD port diff --git a/test/sys/devices/platform/i8042/serio0/driver b/test/sys/devices/platform/i8042/serio0/driver deleted file mode 120000 index 09cf3fed6c..0000000000 --- a/test/sys/devices/platform/i8042/serio0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/serio/drivers/atkbd \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/err_count b/test/sys/devices/platform/i8042/serio0/err_count deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio0/err_count +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio0/extra b/test/sys/devices/platform/i8042/serio0/extra deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio0/extra +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio0/id/extra b/test/sys/devices/platform/i8042/serio0/id/extra deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/platform/i8042/serio0/id/extra +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/platform/i8042/serio0/id/id b/test/sys/devices/platform/i8042/serio0/id/id deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/platform/i8042/serio0/id/id +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/platform/i8042/serio0/id/proto b/test/sys/devices/platform/i8042/serio0/id/proto deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/platform/i8042/serio0/id/proto +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/platform/i8042/serio0/id/type b/test/sys/devices/platform/i8042/serio0/id/type deleted file mode 100644 index cd672a533b..0000000000 --- a/test/sys/devices/platform/i8042/serio0/id/type +++ /dev/null @@ -1 +0,0 @@ -06 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/abs b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/abs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/abs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ev b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ev deleted file mode 100644 index a1fc5336aa..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ev +++ /dev/null @@ -1 +0,0 @@ -120013 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ff b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ff deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/ff +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/key b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/key deleted file mode 100644 index 8ac71fcd8e..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/key +++ /dev/null @@ -1 +0,0 @@ -402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/led b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/led deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/led +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/msc b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/msc deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/msc +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/rel b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/rel deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/rel +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/snd b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/snd deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/snd +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/sw b/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/sw deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/capabilities/sw +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/device b/test/sys/devices/platform/i8042/serio0/input/input0/device deleted file mode 120000 index a67cb96f47..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/device +++ /dev/null @@ -1 +0,0 @@ -../../../serio0 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/dev b/test/sys/devices/platform/i8042/serio0/input/input0/event0/dev deleted file mode 100644 index 5f9cbbd304..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/event0/dev +++ /dev/null @@ -1 +0,0 @@ -13:64 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/device b/test/sys/devices/platform/i8042/serio0/input/input0/event0/device deleted file mode 120000 index 1b1db35805..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/event0/device +++ /dev/null @@ -1 +0,0 @@ -../../input0 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/power/wakeup b/test/sys/devices/platform/i8042/serio0/input/input0/event0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/event0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/subsystem b/test/sys/devices/platform/i8042/serio0/input/input0/event0/subsystem deleted file mode 120000 index adf0173c53..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/event0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/event0/uevent b/test/sys/devices/platform/i8042/serio0/input/input0/event0/uevent deleted file mode 100644 index e53b86e19e..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/event0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=64 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/id/bustype b/test/sys/devices/platform/i8042/serio0/input/input0/id/bustype deleted file mode 100644 index af68ed919d..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/id/bustype +++ /dev/null @@ -1 +0,0 @@ -0011 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/id/product b/test/sys/devices/platform/i8042/serio0/input/input0/id/product deleted file mode 100644 index 635047563b..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/id/product +++ /dev/null @@ -1 +0,0 @@ -0001 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/id/vendor b/test/sys/devices/platform/i8042/serio0/input/input0/id/vendor deleted file mode 100644 index 635047563b..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/id/vendor +++ /dev/null @@ -1 +0,0 @@ -0001 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/id/version b/test/sys/devices/platform/i8042/serio0/input/input0/id/version deleted file mode 100644 index 47173e2bcd..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/id/version +++ /dev/null @@ -1 +0,0 @@ -ab54 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/modalias b/test/sys/devices/platform/i8042/serio0/input/input0/modalias deleted file mode 100644 index 568c156db6..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/modalias +++ /dev/null @@ -1 +0,0 @@ -input:b0011v0001p0001eAB54-e0,1,4,11,14,k71,72,73,74,75,76,77,79,7A,7B,7C,7D,7E,7F,80,8C,8E,8F,9B,9C,9D,9E,9F,A3,A4,A5,A6,AC,AD,B7,B8,B9,D9,E2,ram4,l0,1,2,sfw diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/name b/test/sys/devices/platform/i8042/serio0/input/input0/name deleted file mode 100644 index 21187cff1b..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/name +++ /dev/null @@ -1 +0,0 @@ -AT Translated Set 2 keyboard diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/phys b/test/sys/devices/platform/i8042/serio0/input/input0/phys deleted file mode 100644 index b20cdbf077..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/phys +++ /dev/null @@ -1 +0,0 @@ -isa0060/serio0/input0 diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/power/wakeup b/test/sys/devices/platform/i8042/serio0/input/input0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/subsystem b/test/sys/devices/platform/i8042/serio0/input/input0/subsystem deleted file mode 120000 index a181f4f9d1..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/uevent b/test/sys/devices/platform/i8042/serio0/input/input0/uevent deleted file mode 100644 index 0b1c5aa622..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/uevent +++ /dev/null @@ -1,8 +0,0 @@ -PRODUCT=11/1/1/ab54 -NAME="AT Translated Set 2 keyboard" -PHYS="isa0060/serio0/input0" -EV==120013 -KEY==402000000 3803078f800d001 feffffdfffefffff fffffffffffffffe -MSC==10 -LED==7 -MODALIAS=input:b0011v0001p0001eAB54-e0,1,4,11,14,k71,72,73,74,75,76,77,79,7A,7B,7C,7D,7E,7F,80,8C,8E,8F,9B,9C,9D,9E,9F,A3,A4,A5,A6,AC,AD,B7,B8,B9,D9,E2,ram4,l0,1,2,sfw diff --git a/test/sys/devices/platform/i8042/serio0/input/input0/uniq b/test/sys/devices/platform/i8042/serio0/input/input0/uniq deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/serio0/input/input0/uniq +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio0/modalias b/test/sys/devices/platform/i8042/serio0/modalias deleted file mode 100644 index 91a98bc6d1..0000000000 --- a/test/sys/devices/platform/i8042/serio0/modalias +++ /dev/null @@ -1 +0,0 @@ -serio:ty06pr00id00ex00 diff --git a/test/sys/devices/platform/i8042/serio0/power/wakeup b/test/sys/devices/platform/i8042/serio0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/serio0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio0/scroll b/test/sys/devices/platform/i8042/serio0/scroll deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio0/scroll +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio0/set b/test/sys/devices/platform/i8042/serio0/set deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/platform/i8042/serio0/set +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/platform/i8042/serio0/softraw b/test/sys/devices/platform/i8042/serio0/softraw deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/platform/i8042/serio0/softraw +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/platform/i8042/serio0/softrepeat b/test/sys/devices/platform/i8042/serio0/softrepeat deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio0/softrepeat +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio0/subsystem b/test/sys/devices/platform/i8042/serio0/subsystem deleted file mode 120000 index cba8f97706..0000000000 --- a/test/sys/devices/platform/i8042/serio0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/serio \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio0/uevent b/test/sys/devices/platform/i8042/serio0/uevent deleted file mode 100644 index 0c1c0bd13a..0000000000 --- a/test/sys/devices/platform/i8042/serio0/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=atkbd -SERIO_TYPE=06 -SERIO_PROTO=00 -SERIO_ID=00 -SERIO_EXTRA=00 -MODALIAS=serio:ty06pr00id00ex00 diff --git a/test/sys/devices/platform/i8042/serio1/bind_mode b/test/sys/devices/platform/i8042/serio1/bind_mode deleted file mode 100644 index 865faf10cb..0000000000 --- a/test/sys/devices/platform/i8042/serio1/bind_mode +++ /dev/null @@ -1 +0,0 @@ -auto diff --git a/test/sys/devices/platform/i8042/serio1/description b/test/sys/devices/platform/i8042/serio1/description deleted file mode 100644 index 52d76352d8..0000000000 --- a/test/sys/devices/platform/i8042/serio1/description +++ /dev/null @@ -1 +0,0 @@ -i8042 AUX port diff --git a/test/sys/devices/platform/i8042/serio1/draghys b/test/sys/devices/platform/i8042/serio1/draghys deleted file mode 100644 index ace9d03621..0000000000 --- a/test/sys/devices/platform/i8042/serio1/draghys +++ /dev/null @@ -1 +0,0 @@ -255 diff --git a/test/sys/devices/platform/i8042/serio1/driver b/test/sys/devices/platform/i8042/serio1/driver deleted file mode 120000 index fed3e77dee..0000000000 --- a/test/sys/devices/platform/i8042/serio1/driver +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/serio/drivers/psmouse \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/ext_dev b/test/sys/devices/platform/i8042/serio1/ext_dev deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/platform/i8042/serio1/ext_dev +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/platform/i8042/serio1/id/extra b/test/sys/devices/platform/i8042/serio1/id/extra deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/platform/i8042/serio1/id/extra +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/platform/i8042/serio1/id/id b/test/sys/devices/platform/i8042/serio1/id/id deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/platform/i8042/serio1/id/id +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/platform/i8042/serio1/id/proto b/test/sys/devices/platform/i8042/serio1/id/proto deleted file mode 100644 index 4daddb72ff..0000000000 --- a/test/sys/devices/platform/i8042/serio1/id/proto +++ /dev/null @@ -1 +0,0 @@ -00 diff --git a/test/sys/devices/platform/i8042/serio1/id/type b/test/sys/devices/platform/i8042/serio1/id/type deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/platform/i8042/serio1/id/type +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/platform/i8042/serio1/inertia b/test/sys/devices/platform/i8042/serio1/inertia deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/devices/platform/i8042/serio1/inertia +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/abs b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/abs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/abs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ev b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ev deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ev +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ff b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ff deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/ff +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/key b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/key deleted file mode 100644 index 844d194187..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/key +++ /dev/null @@ -1 +0,0 @@ -70000 0 0 0 0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/led b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/led deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/led +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/msc b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/msc deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/msc +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/rel b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/rel deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/rel +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/snd b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/snd deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/snd +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/sw b/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/sw deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/capabilities/sw +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/device b/test/sys/devices/platform/i8042/serio1/input/input1/device deleted file mode 120000 index ce36cfb05c..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/device +++ /dev/null @@ -1 +0,0 @@ -../../../serio1 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/dev b/test/sys/devices/platform/i8042/serio1/input/input1/event1/dev deleted file mode 100644 index 09ab49186c..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/event1/dev +++ /dev/null @@ -1 +0,0 @@ -13:65 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/device b/test/sys/devices/platform/i8042/serio1/input/input1/event1/device deleted file mode 120000 index 37ba281756..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/event1/device +++ /dev/null @@ -1 +0,0 @@ -../../input1 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/power/wakeup b/test/sys/devices/platform/i8042/serio1/input/input1/event1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/event1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/subsystem b/test/sys/devices/platform/i8042/serio1/input/input1/event1/subsystem deleted file mode 120000 index adf0173c53..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/event1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/event1/uevent b/test/sys/devices/platform/i8042/serio1/input/input1/event1/uevent deleted file mode 100644 index 07a5840c3e..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/event1/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=65 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/id/bustype b/test/sys/devices/platform/i8042/serio1/input/input1/id/bustype deleted file mode 100644 index af68ed919d..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/id/bustype +++ /dev/null @@ -1 +0,0 @@ -0011 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/id/product b/test/sys/devices/platform/i8042/serio1/input/input1/id/product deleted file mode 100644 index 7182ba593d..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/id/product +++ /dev/null @@ -1 +0,0 @@ -000a diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/id/vendor b/test/sys/devices/platform/i8042/serio1/input/input1/id/vendor deleted file mode 100644 index 5fca1fda0b..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/id/vendor +++ /dev/null @@ -1 +0,0 @@ -0002 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/id/version b/test/sys/devices/platform/i8042/serio1/input/input1/id/version deleted file mode 100644 index 739d79706d..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/id/version +++ /dev/null @@ -1 +0,0 @@ -0000 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/modalias b/test/sys/devices/platform/i8042/serio1/input/input1/modalias deleted file mode 100644 index b962fcbfa8..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/modalias +++ /dev/null @@ -1 +0,0 @@ -input:b0011v0002p000Ae0000-e0,1,2,k110,111,112,r0,1,amlsfw diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/dev b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/dev deleted file mode 100644 index 9fd5b64561..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/dev +++ /dev/null @@ -1 +0,0 @@ -13:32 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/device b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/device deleted file mode 120000 index 37ba281756..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/device +++ /dev/null @@ -1 +0,0 @@ -../../input1 \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/power/wakeup b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/subsystem b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/subsystem deleted file mode 120000 index adf0173c53..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/uevent b/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/uevent deleted file mode 100644 index ac16de1c56..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/mouse0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=32 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/name b/test/sys/devices/platform/i8042/serio1/input/input1/name deleted file mode 100644 index c571620617..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/name +++ /dev/null @@ -1 +0,0 @@ -TPPS/2 IBM TrackPoint diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/phys b/test/sys/devices/platform/i8042/serio1/input/input1/phys deleted file mode 100644 index 1e40530d5d..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/phys +++ /dev/null @@ -1 +0,0 @@ -isa0060/serio1/input0 diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/power/wakeup b/test/sys/devices/platform/i8042/serio1/input/input1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/subsystem b/test/sys/devices/platform/i8042/serio1/input/input1/subsystem deleted file mode 120000 index a181f4f9d1..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/uevent b/test/sys/devices/platform/i8042/serio1/input/input1/uevent deleted file mode 100644 index bbe9314bb1..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/uevent +++ /dev/null @@ -1,7 +0,0 @@ -PRODUCT=11/2/a/0 -NAME="TPPS/2 IBM TrackPoint" -PHYS="isa0060/serio1/input0" -EV==7 -KEY==70000 0 0 0 0 -REL==3 -MODALIAS=input:b0011v0002p000Ae0000-e0,1,2,k110,111,112,r0,1,amlsfw diff --git a/test/sys/devices/platform/i8042/serio1/input/input1/uniq b/test/sys/devices/platform/i8042/serio1/input/input1/uniq deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/serio1/input/input1/uniq +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio1/jenks b/test/sys/devices/platform/i8042/serio1/jenks deleted file mode 100644 index c8b255fc8e..0000000000 --- a/test/sys/devices/platform/i8042/serio1/jenks +++ /dev/null @@ -1 +0,0 @@ -135 diff --git a/test/sys/devices/platform/i8042/serio1/mindrag b/test/sys/devices/platform/i8042/serio1/mindrag deleted file mode 100644 index 209e3ef4b6..0000000000 --- a/test/sys/devices/platform/i8042/serio1/mindrag +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/test/sys/devices/platform/i8042/serio1/modalias b/test/sys/devices/platform/i8042/serio1/modalias deleted file mode 100644 index 2c6c3b4b93..0000000000 --- a/test/sys/devices/platform/i8042/serio1/modalias +++ /dev/null @@ -1 +0,0 @@ -serio:ty01pr00id00ex00 diff --git a/test/sys/devices/platform/i8042/serio1/power/wakeup b/test/sys/devices/platform/i8042/serio1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/i8042/serio1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/i8042/serio1/press_to_select b/test/sys/devices/platform/i8042/serio1/press_to_select deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio1/press_to_select +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio1/protocol b/test/sys/devices/platform/i8042/serio1/protocol deleted file mode 100644 index 87c11d491c..0000000000 --- a/test/sys/devices/platform/i8042/serio1/protocol +++ /dev/null @@ -1 +0,0 @@ -TPPS/2 diff --git a/test/sys/devices/platform/i8042/serio1/rate b/test/sys/devices/platform/i8042/serio1/rate deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/platform/i8042/serio1/rate +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/platform/i8042/serio1/reach b/test/sys/devices/platform/i8042/serio1/reach deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/platform/i8042/serio1/reach +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/platform/i8042/serio1/resetafter b/test/sys/devices/platform/i8042/serio1/resetafter deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/devices/platform/i8042/serio1/resetafter +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/devices/platform/i8042/serio1/resolution b/test/sys/devices/platform/i8042/serio1/resolution deleted file mode 100644 index 08839f6bb2..0000000000 --- a/test/sys/devices/platform/i8042/serio1/resolution +++ /dev/null @@ -1 +0,0 @@ -200 diff --git a/test/sys/devices/platform/i8042/serio1/resync_time b/test/sys/devices/platform/i8042/serio1/resync_time deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio1/resync_time +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio1/sensitivity b/test/sys/devices/platform/i8042/serio1/sensitivity deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/platform/i8042/serio1/sensitivity +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/platform/i8042/serio1/skipback b/test/sys/devices/platform/i8042/serio1/skipback deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/i8042/serio1/skipback +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/i8042/serio1/speed b/test/sys/devices/platform/i8042/serio1/speed deleted file mode 100644 index c17e934b51..0000000000 --- a/test/sys/devices/platform/i8042/serio1/speed +++ /dev/null @@ -1 +0,0 @@ -97 diff --git a/test/sys/devices/platform/i8042/serio1/subsystem b/test/sys/devices/platform/i8042/serio1/subsystem deleted file mode 120000 index cba8f97706..0000000000 --- a/test/sys/devices/platform/i8042/serio1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../bus/serio \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/serio1/thresh b/test/sys/devices/platform/i8042/serio1/thresh deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/platform/i8042/serio1/thresh +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/platform/i8042/serio1/uevent b/test/sys/devices/platform/i8042/serio1/uevent deleted file mode 100644 index 36b5a6a578..0000000000 --- a/test/sys/devices/platform/i8042/serio1/uevent +++ /dev/null @@ -1,6 +0,0 @@ -DRIVER=psmouse -SERIO_TYPE=01 -SERIO_PROTO=00 -SERIO_ID=00 -SERIO_EXTRA=00 -MODALIAS=serio:ty01pr00id00ex00 diff --git a/test/sys/devices/platform/i8042/serio1/upthresh b/test/sys/devices/platform/i8042/serio1/upthresh deleted file mode 100644 index ace9d03621..0000000000 --- a/test/sys/devices/platform/i8042/serio1/upthresh +++ /dev/null @@ -1 +0,0 @@ -255 diff --git a/test/sys/devices/platform/i8042/serio1/ztime b/test/sys/devices/platform/i8042/serio1/ztime deleted file mode 100644 index e522732c77..0000000000 --- a/test/sys/devices/platform/i8042/serio1/ztime +++ /dev/null @@ -1 +0,0 @@ -38 diff --git a/test/sys/devices/platform/i8042/subsystem b/test/sys/devices/platform/i8042/subsystem deleted file mode 120000 index deb3a3fbdd..0000000000 --- a/test/sys/devices/platform/i8042/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/i8042/uevent b/test/sys/devices/platform/i8042/uevent deleted file mode 100644 index d66517d1d8..0000000000 --- a/test/sys/devices/platform/i8042/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=i8042 -MODALIAS=platform:i8042 diff --git a/test/sys/devices/platform/microcode/modalias b/test/sys/devices/platform/microcode/modalias deleted file mode 100644 index 85dd39961e..0000000000 --- a/test/sys/devices/platform/microcode/modalias +++ /dev/null @@ -1 +0,0 @@ -platform:microcode diff --git a/test/sys/devices/platform/microcode/power/wakeup b/test/sys/devices/platform/microcode/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/microcode/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/microcode/subsystem b/test/sys/devices/platform/microcode/subsystem deleted file mode 120000 index deb3a3fbdd..0000000000 --- a/test/sys/devices/platform/microcode/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/microcode/uevent b/test/sys/devices/platform/microcode/uevent deleted file mode 100644 index 8ee65c8412..0000000000 --- a/test/sys/devices/platform/microcode/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=platform:microcode diff --git a/test/sys/devices/platform/pcspkr/driver b/test/sys/devices/platform/pcspkr/driver deleted file mode 120000 index 44af544108..0000000000 --- a/test/sys/devices/platform/pcspkr/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform/drivers/pcspkr \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/abs b/test/sys/devices/platform/pcspkr/input/input2/capabilities/abs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/capabilities/abs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/ev b/test/sys/devices/platform/pcspkr/input/input2/capabilities/ev deleted file mode 100644 index acd6c0ecb9..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/capabilities/ev +++ /dev/null @@ -1 +0,0 @@ -40001 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/ff b/test/sys/devices/platform/pcspkr/input/input2/capabilities/ff deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/capabilities/ff +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/key b/test/sys/devices/platform/pcspkr/input/input2/capabilities/key deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/capabilities/key +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/led b/test/sys/devices/platform/pcspkr/input/input2/capabilities/led deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/capabilities/led +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/msc b/test/sys/devices/platform/pcspkr/input/input2/capabilities/msc deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/capabilities/msc +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/rel b/test/sys/devices/platform/pcspkr/input/input2/capabilities/rel deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/capabilities/rel +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/snd b/test/sys/devices/platform/pcspkr/input/input2/capabilities/snd deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/capabilities/snd +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/devices/platform/pcspkr/input/input2/capabilities/sw b/test/sys/devices/platform/pcspkr/input/input2/capabilities/sw deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/capabilities/sw +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/device b/test/sys/devices/platform/pcspkr/input/input2/device deleted file mode 120000 index da50b6db55..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/device +++ /dev/null @@ -1 +0,0 @@ -../../../pcspkr \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/dev b/test/sys/devices/platform/pcspkr/input/input2/event2/dev deleted file mode 100644 index a72362ad0a..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/event2/dev +++ /dev/null @@ -1 +0,0 @@ -13:66 diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/device b/test/sys/devices/platform/pcspkr/input/input2/event2/device deleted file mode 120000 index 174b819910..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/event2/device +++ /dev/null @@ -1 +0,0 @@ -../../input2 \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/power/wakeup b/test/sys/devices/platform/pcspkr/input/input2/event2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/event2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/subsystem b/test/sys/devices/platform/pcspkr/input/input2/event2/subsystem deleted file mode 120000 index a181f4f9d1..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/event2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/event2/uevent b/test/sys/devices/platform/pcspkr/input/input2/event2/uevent deleted file mode 100644 index 7bf99838b9..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/event2/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=66 diff --git a/test/sys/devices/platform/pcspkr/input/input2/id/bustype b/test/sys/devices/platform/pcspkr/input/input2/id/bustype deleted file mode 100644 index 66375d5000..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/id/bustype +++ /dev/null @@ -1 +0,0 @@ -0010 diff --git a/test/sys/devices/platform/pcspkr/input/input2/id/product b/test/sys/devices/platform/pcspkr/input/input2/id/product deleted file mode 100644 index 635047563b..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/id/product +++ /dev/null @@ -1 +0,0 @@ -0001 diff --git a/test/sys/devices/platform/pcspkr/input/input2/id/vendor b/test/sys/devices/platform/pcspkr/input/input2/id/vendor deleted file mode 100644 index fc50928281..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/id/vendor +++ /dev/null @@ -1 +0,0 @@ -001f diff --git a/test/sys/devices/platform/pcspkr/input/input2/id/version b/test/sys/devices/platform/pcspkr/input/input2/id/version deleted file mode 100644 index e199843fc5..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/id/version +++ /dev/null @@ -1 +0,0 @@ -0100 diff --git a/test/sys/devices/platform/pcspkr/input/input2/modalias b/test/sys/devices/platform/pcspkr/input/input2/modalias deleted file mode 100644 index 14cc19ee12..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/modalias +++ /dev/null @@ -1 +0,0 @@ -input:b0010v001Fp0001e0100-e0,12,kramls1,2,fw diff --git a/test/sys/devices/platform/pcspkr/input/input2/name b/test/sys/devices/platform/pcspkr/input/input2/name deleted file mode 100644 index 6c731d3902..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/name +++ /dev/null @@ -1 +0,0 @@ -PC Speaker diff --git a/test/sys/devices/platform/pcspkr/input/input2/phys b/test/sys/devices/platform/pcspkr/input/input2/phys deleted file mode 100644 index 798e7ffd0e..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/phys +++ /dev/null @@ -1 +0,0 @@ -isa0061/input0 diff --git a/test/sys/devices/platform/pcspkr/input/input2/power/wakeup b/test/sys/devices/platform/pcspkr/input/input2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/pcspkr/input/input2/subsystem b/test/sys/devices/platform/pcspkr/input/input2/subsystem deleted file mode 120000 index bd2a91fcf2..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/input/input2/uevent b/test/sys/devices/platform/pcspkr/input/input2/uevent deleted file mode 100644 index 1d9916ca72..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/uevent +++ /dev/null @@ -1,6 +0,0 @@ -PRODUCT=10/1f/1/100 -NAME="PC Speaker" -PHYS="isa0061/input0" -EV==40001 -SND==6 -MODALIAS=input:b0010v001Fp0001e0100-e0,12,kramls1,2,fw diff --git a/test/sys/devices/platform/pcspkr/input/input2/uniq b/test/sys/devices/platform/pcspkr/input/input2/uniq deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/pcspkr/input/input2/uniq +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/pcspkr/modalias b/test/sys/devices/platform/pcspkr/modalias deleted file mode 100644 index c42b3b35bb..0000000000 --- a/test/sys/devices/platform/pcspkr/modalias +++ /dev/null @@ -1 +0,0 @@ -platform:pcspkr diff --git a/test/sys/devices/platform/pcspkr/power/wakeup b/test/sys/devices/platform/pcspkr/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/pcspkr/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/pcspkr/subsystem b/test/sys/devices/platform/pcspkr/subsystem deleted file mode 120000 index deb3a3fbdd..0000000000 --- a/test/sys/devices/platform/pcspkr/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/pcspkr/uevent b/test/sys/devices/platform/pcspkr/uevent deleted file mode 100644 index b570adefa2..0000000000 --- a/test/sys/devices/platform/pcspkr/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=pcspkr -MODALIAS=platform:pcspkr diff --git a/test/sys/devices/platform/power/wakeup b/test/sys/devices/platform/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/serial8250/driver b/test/sys/devices/platform/serial8250/driver deleted file mode 120000 index 0bb0a3f502..0000000000 --- a/test/sys/devices/platform/serial8250/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform/drivers/serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/modalias b/test/sys/devices/platform/serial8250/modalias deleted file mode 100644 index d8875a5672..0000000000 --- a/test/sys/devices/platform/serial8250/modalias +++ /dev/null @@ -1 +0,0 @@ -platform:serial8250 diff --git a/test/sys/devices/platform/serial8250/power/wakeup b/test/sys/devices/platform/serial8250/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/serial8250/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/serial8250/subsystem b/test/sys/devices/platform/serial8250/subsystem deleted file mode 120000 index deb3a3fbdd..0000000000 --- a/test/sys/devices/platform/serial8250/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/dev b/test/sys/devices/platform/serial8250/tty/ttyS0/dev deleted file mode 100644 index 9f6b667886..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS0/dev +++ /dev/null @@ -1 +0,0 @@ -4:64 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/device b/test/sys/devices/platform/serial8250/tty/ttyS0/device deleted file mode 120000 index aeed1b12f5..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS0/device +++ /dev/null @@ -1 +0,0 @@ -../../../serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/power/wakeup b/test/sys/devices/platform/serial8250/tty/ttyS0/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/subsystem b/test/sys/devices/platform/serial8250/tty/ttyS0/subsystem deleted file mode 120000 index 2c914ca516..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS0/uevent b/test/sys/devices/platform/serial8250/tty/ttyS0/uevent deleted file mode 100644 index defc92d919..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=64 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/dev b/test/sys/devices/platform/serial8250/tty/ttyS1/dev deleted file mode 100644 index db3f8ecdcd..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS1/dev +++ /dev/null @@ -1 +0,0 @@ -4:65 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/device b/test/sys/devices/platform/serial8250/tty/ttyS1/device deleted file mode 120000 index aeed1b12f5..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS1/device +++ /dev/null @@ -1 +0,0 @@ -../../../serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/power/wakeup b/test/sys/devices/platform/serial8250/tty/ttyS1/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/subsystem b/test/sys/devices/platform/serial8250/tty/ttyS1/subsystem deleted file mode 120000 index 2c914ca516..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS1/uevent b/test/sys/devices/platform/serial8250/tty/ttyS1/uevent deleted file mode 100644 index 8a073e38da..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS1/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=65 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/dev b/test/sys/devices/platform/serial8250/tty/ttyS2/dev deleted file mode 100644 index cef5d02fd9..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS2/dev +++ /dev/null @@ -1 +0,0 @@ -4:66 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/device b/test/sys/devices/platform/serial8250/tty/ttyS2/device deleted file mode 120000 index aeed1b12f5..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS2/device +++ /dev/null @@ -1 +0,0 @@ -../../../serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/power/wakeup b/test/sys/devices/platform/serial8250/tty/ttyS2/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/subsystem b/test/sys/devices/platform/serial8250/tty/ttyS2/subsystem deleted file mode 120000 index 2c914ca516..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS2/uevent b/test/sys/devices/platform/serial8250/tty/ttyS2/uevent deleted file mode 100644 index f3202231b5..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS2/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=66 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/dev b/test/sys/devices/platform/serial8250/tty/ttyS3/dev deleted file mode 100644 index 3077006e7a..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS3/dev +++ /dev/null @@ -1 +0,0 @@ -4:67 diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/device b/test/sys/devices/platform/serial8250/tty/ttyS3/device deleted file mode 120000 index aeed1b12f5..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS3/device +++ /dev/null @@ -1 +0,0 @@ -../../../serial8250 \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/power/wakeup b/test/sys/devices/platform/serial8250/tty/ttyS3/power/wakeup deleted file mode 100644 index 7a68b11da8..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -disabled diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/subsystem b/test/sys/devices/platform/serial8250/tty/ttyS3/subsystem deleted file mode 120000 index 2c914ca516..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/platform/serial8250/tty/ttyS3/uevent b/test/sys/devices/platform/serial8250/tty/ttyS3/uevent deleted file mode 100644 index bc5fa8f157..0000000000 --- a/test/sys/devices/platform/serial8250/tty/ttyS3/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=67 diff --git a/test/sys/devices/platform/serial8250/uevent b/test/sys/devices/platform/serial8250/uevent deleted file mode 100644 index 00b8c5f66d..0000000000 --- a/test/sys/devices/platform/serial8250/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=serial8250 -MODALIAS=platform:serial8250 diff --git a/test/sys/devices/platform/thinkpad_acpi/bluetooth_enable b/test/sys/devices/platform/thinkpad_acpi/bluetooth_enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/bluetooth_enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/platform/thinkpad_acpi/driver b/test/sys/devices/platform/thinkpad_acpi/driver deleted file mode 120000 index 388b2236b0..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform/drivers/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_all_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_all_mask deleted file mode 100644 index 74f4cb244f..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_all_mask +++ /dev/null @@ -1 +0,0 @@ -0x00ffffff diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_enabled b/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_enabled deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_enabled +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_mask deleted file mode 100644 index b5c557ab01..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_bios_mask +++ /dev/null @@ -1 +0,0 @@ -0x0000080c diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_enable b/test/sys/devices/platform/thinkpad_acpi/hotkey_enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_mask deleted file mode 100644 index 74f4cb244f..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_mask +++ /dev/null @@ -1 +0,0 @@ -0x00ffffff diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_poll_freq b/test/sys/devices/platform/thinkpad_acpi/hotkey_poll_freq deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_poll_freq +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_radio_sw b/test/sys/devices/platform/thinkpad_acpi/hotkey_radio_sw deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_radio_sw +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_recommended_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_recommended_mask deleted file mode 100644 index 7e5947ab27..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_recommended_mask +++ /dev/null @@ -1 +0,0 @@ -0x008c7fff diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_report_mode b/test/sys/devices/platform/thinkpad_acpi/hotkey_report_mode deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_report_mode +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/platform/thinkpad_acpi/hotkey_source_mask b/test/sys/devices/platform/thinkpad_acpi/hotkey_source_mask deleted file mode 100644 index e79e876aae..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/hotkey_source_mask +++ /dev/null @@ -1 +0,0 @@ -0x00000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/brightness and /dev/null differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/subsystem deleted file mode 120000 index 46e2484aa6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/trigger deleted file mode 100644 index d29a9f783c..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/trigger +++ /dev/null @@ -1 +0,0 @@ -[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::bay_active/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/brightness and /dev/null differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/subsystem deleted file mode 120000 index 46e2484aa6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/trigger deleted file mode 100644 index d29a9f783c..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/trigger +++ /dev/null @@ -1 +0,0 @@ -[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_active/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/brightness and /dev/null differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/subsystem deleted file mode 120000 index 46e2484aa6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/trigger deleted file mode 100644 index d29a9f783c..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/trigger +++ /dev/null @@ -1 +0,0 @@ -[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::dock_batt/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/brightness and /dev/null differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/subsystem deleted file mode 120000 index 46e2484aa6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/trigger deleted file mode 100644 index d29a9f783c..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/trigger +++ /dev/null @@ -1 +0,0 @@ -[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::power/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/brightness and /dev/null differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/subsystem deleted file mode 120000 index 46e2484aa6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/trigger deleted file mode 100644 index d29a9f783c..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/trigger +++ /dev/null @@ -1 +0,0 @@ -[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::standby/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness deleted file mode 100644 index 8364fdecfc..0000000000 Binary files a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/brightness and /dev/null differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/subsystem deleted file mode 120000 index 46e2484aa6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/trigger deleted file mode 100644 index d29a9f783c..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/trigger +++ /dev/null @@ -1 +0,0 @@ -[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::thinklight/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/brightness and /dev/null differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/subsystem deleted file mode 120000 index 46e2484aa6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/trigger deleted file mode 100644 index d29a9f783c..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/trigger +++ /dev/null @@ -1 +0,0 @@ -[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi::unknown_led/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/brightness and /dev/null differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/subsystem deleted file mode 120000 index 46e2484aa6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/trigger deleted file mode 100644 index d29a9f783c..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/trigger +++ /dev/null @@ -1 +0,0 @@ -[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:green:batt/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/brightness b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/brightness deleted file mode 100644 index c1da2e294b..0000000000 Binary files a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/brightness and /dev/null differ diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/device b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/subsystem b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/subsystem deleted file mode 120000 index 46e2484aa6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/leds \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/trigger b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/trigger deleted file mode 100644 index d29a9f783c..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/trigger +++ /dev/null @@ -1 +0,0 @@ -[none] AC-online BAT0-charging-or-full BAT0-charging BAT0-full rfkill0 phy0rx phy0tx phy0assoc phy0radio diff --git a/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/uevent b/test/sys/devices/platform/thinkpad_acpi/leds/tpacpi:orange:batt/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_acpi/modalias b/test/sys/devices/platform/thinkpad_acpi/modalias deleted file mode 100644 index 6a50447be6..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/modalias +++ /dev/null @@ -1 +0,0 @@ -platform:thinkpad_acpi diff --git a/test/sys/devices/platform/thinkpad_acpi/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/claim b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/claim deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/claim +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/device b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/device deleted file mode 120000 index bd6c926505..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/name b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/name deleted file mode 100644 index 28b8511147..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/name +++ /dev/null @@ -1 +0,0 @@ -tpacpi_bluetooth_sw diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/power/wakeup b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/state +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/subsystem b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/subsystem deleted file mode 120000 index 5a34d65f45..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/rfkill \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/type b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/type deleted file mode 100644 index 89e437991e..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/type +++ /dev/null @@ -1 +0,0 @@ -bluetooth diff --git a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/uevent b/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/uevent deleted file mode 100644 index 1a870a5240..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/rfkill/rfkill0/uevent +++ /dev/null @@ -1,3 +0,0 @@ -RFKILL_NAME=tpacpi_bluetooth_sw -RFKILL_TYPE=bluetooth -RFKILL_STATE=1 diff --git a/test/sys/devices/platform/thinkpad_acpi/subsystem b/test/sys/devices/platform/thinkpad_acpi/subsystem deleted file mode 120000 index deb3a3fbdd..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_acpi/uevent b/test/sys/devices/platform/thinkpad_acpi/uevent deleted file mode 100644 index 1aa572cc2a..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=thinkpad_acpi -MODALIAS=platform:thinkpad_acpi diff --git a/test/sys/devices/platform/thinkpad_acpi/wakeup_hotunplug_complete b/test/sys/devices/platform/thinkpad_acpi/wakeup_hotunplug_complete deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/wakeup_hotunplug_complete +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/thinkpad_acpi/wakeup_reason b/test/sys/devices/platform/thinkpad_acpi/wakeup_reason deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/thinkpad_acpi/wakeup_reason +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/thinkpad_hwmon/driver b/test/sys/devices/platform/thinkpad_hwmon/driver deleted file mode 120000 index b34f0fde53..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform/drivers/thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_hwmon/fan1_input b/test/sys/devices/platform/thinkpad_hwmon/fan1_input deleted file mode 100644 index 6cf44d4c8c..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/fan1_input +++ /dev/null @@ -1 +0,0 @@ -3446 diff --git a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/device b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/device deleted file mode 120000 index 152dbac4e0..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/device +++ /dev/null @@ -1 +0,0 @@ -../../../thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/power/wakeup b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/subsystem b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/subsystem deleted file mode 120000 index c02ab68b5d..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/hwmon \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/uevent b/test/sys/devices/platform/thinkpad_hwmon/hwmon/hwmon0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/modalias b/test/sys/devices/platform/thinkpad_hwmon/modalias deleted file mode 100644 index 9208eea4e0..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/modalias +++ /dev/null @@ -1 +0,0 @@ -platform:thinkpad_hwmon diff --git a/test/sys/devices/platform/thinkpad_hwmon/name b/test/sys/devices/platform/thinkpad_hwmon/name deleted file mode 100644 index d282e4fa6f..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/name +++ /dev/null @@ -1 +0,0 @@ -thinkpad diff --git a/test/sys/devices/platform/thinkpad_hwmon/power/wakeup b/test/sys/devices/platform/thinkpad_hwmon/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/thinkpad_hwmon/pwm1 b/test/sys/devices/platform/thinkpad_hwmon/pwm1 deleted file mode 100644 index ace9d03621..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/pwm1 +++ /dev/null @@ -1 +0,0 @@ -255 diff --git a/test/sys/devices/platform/thinkpad_hwmon/pwm1_enable b/test/sys/devices/platform/thinkpad_hwmon/pwm1_enable deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/pwm1_enable +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/platform/thinkpad_hwmon/subsystem b/test/sys/devices/platform/thinkpad_hwmon/subsystem deleted file mode 120000 index deb3a3fbdd..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp10_input b/test/sys/devices/platform/thinkpad_hwmon/temp10_input deleted file mode 100644 index afdd418402..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/temp10_input +++ /dev/null @@ -1 +0,0 @@ -49000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp11_input b/test/sys/devices/platform/thinkpad_hwmon/temp11_input deleted file mode 100644 index d468d452ad..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/temp11_input +++ /dev/null @@ -1 +0,0 @@ -43000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp12_input b/test/sys/devices/platform/thinkpad_hwmon/temp12_input deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp13_input b/test/sys/devices/platform/thinkpad_hwmon/temp13_input deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp14_input b/test/sys/devices/platform/thinkpad_hwmon/temp14_input deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp15_input b/test/sys/devices/platform/thinkpad_hwmon/temp15_input deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp16_input b/test/sys/devices/platform/thinkpad_hwmon/temp16_input deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp1_input b/test/sys/devices/platform/thinkpad_hwmon/temp1_input deleted file mode 100644 index 44ecd33b16..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/temp1_input +++ /dev/null @@ -1 +0,0 @@ -46000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp2_input b/test/sys/devices/platform/thinkpad_hwmon/temp2_input deleted file mode 100644 index 7ca5e37363..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/temp2_input +++ /dev/null @@ -1 +0,0 @@ -41000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp3_input b/test/sys/devices/platform/thinkpad_hwmon/temp3_input deleted file mode 100644 index c58dea0097..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/temp3_input +++ /dev/null @@ -1 +0,0 @@ -33000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp4_input b/test/sys/devices/platform/thinkpad_hwmon/temp4_input deleted file mode 100644 index 78647fdafd..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/temp4_input +++ /dev/null @@ -1 +0,0 @@ -63000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp5_input b/test/sys/devices/platform/thinkpad_hwmon/temp5_input deleted file mode 100644 index 25410eb726..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/temp5_input +++ /dev/null @@ -1 +0,0 @@ -35000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp6_input b/test/sys/devices/platform/thinkpad_hwmon/temp6_input deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp7_input b/test/sys/devices/platform/thinkpad_hwmon/temp7_input deleted file mode 100644 index c58dea0097..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/temp7_input +++ /dev/null @@ -1 +0,0 @@ -33000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp8_input b/test/sys/devices/platform/thinkpad_hwmon/temp8_input deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/temp9_input b/test/sys/devices/platform/thinkpad_hwmon/temp9_input deleted file mode 100644 index 25410eb726..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/temp9_input +++ /dev/null @@ -1 +0,0 @@ -35000 diff --git a/test/sys/devices/platform/thinkpad_hwmon/uevent b/test/sys/devices/platform/thinkpad_hwmon/uevent deleted file mode 100644 index a155fce352..0000000000 --- a/test/sys/devices/platform/thinkpad_hwmon/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=thinkpad_hwmon -MODALIAS=platform:thinkpad_hwmon diff --git a/test/sys/devices/platform/uevent b/test/sys/devices/platform/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/vesafb.0/driver b/test/sys/devices/platform/vesafb.0/driver deleted file mode 120000 index 99735db79f..0000000000 --- a/test/sys/devices/platform/vesafb.0/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform/drivers/vesafb \ No newline at end of file diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/bits_per_pixel b/test/sys/devices/platform/vesafb.0/graphics/fb0/bits_per_pixel deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/bits_per_pixel +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/blank b/test/sys/devices/platform/vesafb.0/graphics/fb0/blank deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/console b/test/sys/devices/platform/vesafb.0/graphics/fb0/console deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/cursor b/test/sys/devices/platform/vesafb.0/graphics/fb0/cursor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/dev b/test/sys/devices/platform/vesafb.0/graphics/fb0/dev deleted file mode 100644 index e6032bec01..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/dev +++ /dev/null @@ -1 +0,0 @@ -29:0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/device b/test/sys/devices/platform/vesafb.0/graphics/fb0/device deleted file mode 120000 index ac00bf6034..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/device +++ /dev/null @@ -1 +0,0 @@ -../../../vesafb.0 \ No newline at end of file diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/mode b/test/sys/devices/platform/vesafb.0/graphics/fb0/mode deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/modes b/test/sys/devices/platform/vesafb.0/graphics/fb0/modes deleted file mode 100644 index 9a8863a213..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/modes +++ /dev/null @@ -1 +0,0 @@ -U:800x600p-75 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/name b/test/sys/devices/platform/vesafb.0/graphics/fb0/name deleted file mode 100644 index b1f2d26618..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/name +++ /dev/null @@ -1 +0,0 @@ -VESA VGA diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/pan b/test/sys/devices/platform/vesafb.0/graphics/fb0/pan deleted file mode 100644 index 15794e0070..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/pan +++ /dev/null @@ -1 +0,0 @@ -0,0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/power/wakeup b/test/sys/devices/platform/vesafb.0/graphics/fb0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/rotate b/test/sys/devices/platform/vesafb.0/graphics/fb0/rotate deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/rotate +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/state b/test/sys/devices/platform/vesafb.0/graphics/fb0/state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/stride b/test/sys/devices/platform/vesafb.0/graphics/fb0/stride deleted file mode 100644 index b67470f1dc..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/stride +++ /dev/null @@ -1 +0,0 @@ -1600 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/subsystem b/test/sys/devices/platform/vesafb.0/graphics/fb0/subsystem deleted file mode 120000 index 4272ecbd5f..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/graphics \ No newline at end of file diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/uevent b/test/sys/devices/platform/vesafb.0/graphics/fb0/uevent deleted file mode 100644 index 92a188018b..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=29 -MINOR=0 diff --git a/test/sys/devices/platform/vesafb.0/graphics/fb0/virtual_size b/test/sys/devices/platform/vesafb.0/graphics/fb0/virtual_size deleted file mode 100644 index 80d581f413..0000000000 --- a/test/sys/devices/platform/vesafb.0/graphics/fb0/virtual_size +++ /dev/null @@ -1 +0,0 @@ -800,600 diff --git a/test/sys/devices/platform/vesafb.0/modalias b/test/sys/devices/platform/vesafb.0/modalias deleted file mode 100644 index a09e0f64e2..0000000000 --- a/test/sys/devices/platform/vesafb.0/modalias +++ /dev/null @@ -1 +0,0 @@ -platform:vesafb diff --git a/test/sys/devices/platform/vesafb.0/power/wakeup b/test/sys/devices/platform/vesafb.0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/platform/vesafb.0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/platform/vesafb.0/subsystem b/test/sys/devices/platform/vesafb.0/subsystem deleted file mode 120000 index deb3a3fbdd..0000000000 --- a/test/sys/devices/platform/vesafb.0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform \ No newline at end of file diff --git a/test/sys/devices/platform/vesafb.0/uevent b/test/sys/devices/platform/vesafb.0/uevent deleted file mode 100644 index dabaf7ddb3..0000000000 --- a/test/sys/devices/platform/vesafb.0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -DRIVER=vesafb -MODALIAS=platform:vesafb diff --git a/test/sys/devices/pnp0/00:00/driver b/test/sys/devices/pnp0/00:00/driver deleted file mode 120000 index 49809519dd..0000000000 --- a/test/sys/devices/pnp0/00:00/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp/drivers/system \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:00/firmware_node b/test/sys/devices/pnp0/00:00/firmware_node deleted file mode 120000 index 2d4d4b4535..0000000000 --- a/test/sys/devices/pnp0/00:00/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0C01:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:00/id b/test/sys/devices/pnp0/00:00/id deleted file mode 100644 index 8a67a657c5..0000000000 --- a/test/sys/devices/pnp0/00:00/id +++ /dev/null @@ -1 +0,0 @@ -PNP0c01 diff --git a/test/sys/devices/pnp0/00:00/options b/test/sys/devices/pnp0/00:00/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:00/power/wakeup b/test/sys/devices/pnp0/00:00/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:00/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:00/resources b/test/sys/devices/pnp0/00:00/resources deleted file mode 100644 index e776f37bcd..0000000000 --- a/test/sys/devices/pnp0/00:00/resources +++ /dev/null @@ -1,18 +0,0 @@ -state = active -mem 0x0-0x9ffff -mem 0xc0000-0xc3fff -mem 0xc4000-0xc7fff -mem 0xc8000-0xcbfff -mem 0xcc000-0xcffff -mem disabled -mem disabled -mem disabled -mem 0xdc000-0xdffff -mem 0xe0000-0xe3fff -mem 0xe4000-0xe7fff -mem 0xe8000-0xebfff -mem 0xec000-0xeffff -mem 0xf0000-0xfffff -mem 0x100000-0x7fffffff -mem 0xfec00000-0xfed3ffff -mem 0xfed41000-0xffffffff diff --git a/test/sys/devices/pnp0/00:00/subsystem b/test/sys/devices/pnp0/00:00/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:00/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:00/uevent b/test/sys/devices/pnp0/00:00/uevent deleted file mode 100644 index 5f289cdaa8..0000000000 --- a/test/sys/devices/pnp0/00:00/uevent +++ /dev/null @@ -1 +0,0 @@ -DRIVER=system diff --git a/test/sys/devices/pnp0/00:01/id b/test/sys/devices/pnp0/00:01/id deleted file mode 100644 index ea60bfdf5f..0000000000 --- a/test/sys/devices/pnp0/00:01/id +++ /dev/null @@ -1,2 +0,0 @@ -PNP0a08 -PNP0a03 diff --git a/test/sys/devices/pnp0/00:01/options b/test/sys/devices/pnp0/00:01/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:01/power/wakeup b/test/sys/devices/pnp0/00:01/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:01/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:01/resources b/test/sys/devices/pnp0/00:01/resources deleted file mode 100644 index f70025a192..0000000000 --- a/test/sys/devices/pnp0/00:01/resources +++ /dev/null @@ -1,2 +0,0 @@ -state = active -io 0xcf8-0xcff diff --git a/test/sys/devices/pnp0/00:01/subsystem b/test/sys/devices/pnp0/00:01/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:01/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:01/uevent b/test/sys/devices/pnp0/00:01/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:02/driver b/test/sys/devices/pnp0/00:02/driver deleted file mode 120000 index 49809519dd..0000000000 --- a/test/sys/devices/pnp0/00:02/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp/drivers/system \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:02/firmware_node b/test/sys/devices/pnp0/00:02/firmware_node deleted file mode 120000 index 7bf7dd260b..0000000000 --- a/test/sys/devices/pnp0/00:02/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C02:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:02/id b/test/sys/devices/pnp0/00:02/id deleted file mode 100644 index c6dcd897da..0000000000 --- a/test/sys/devices/pnp0/00:02/id +++ /dev/null @@ -1 +0,0 @@ -PNP0c02 diff --git a/test/sys/devices/pnp0/00:02/options b/test/sys/devices/pnp0/00:02/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:02/power/wakeup b/test/sys/devices/pnp0/00:02/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:02/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:02/resources b/test/sys/devices/pnp0/00:02/resources deleted file mode 100644 index 0ea5e8e82b..0000000000 --- a/test/sys/devices/pnp0/00:02/resources +++ /dev/null @@ -1,30 +0,0 @@ -state = active -io 0x10-0x1f -io 0x90-0x9f -io 0x24-0x25 -io 0x28-0x29 -io 0x2c-0x2d -io 0x30-0x31 -io 0x34-0x35 -io 0x38-0x39 -io 0x3c-0x3d -io 0xa4-0xa5 -io 0xa8-0xa9 -io 0xac-0xad -io 0xb0-0xb5 -io 0xb8-0xb9 -io 0xbc-0xbd -io 0x50-0x53 -io 0x72-0x77 -io 0x164e-0x164f -io 0x2e-0x2f -io 0x1000-0x107f -io 0x1180-0x11bf -io 0x800-0x80f -io 0x15e0-0x15ef -io 0x1600-0x165f -mem 0xf0000000-0xf3ffffff -mem 0xfed1c000-0xfed1ffff -mem 0xfed14000-0xfed17fff -mem 0xfed18000-0xfed18fff -mem 0xfed19000-0xfed19fff diff --git a/test/sys/devices/pnp0/00:02/subsystem b/test/sys/devices/pnp0/00:02/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:02/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:02/uevent b/test/sys/devices/pnp0/00:02/uevent deleted file mode 100644 index 5f289cdaa8..0000000000 --- a/test/sys/devices/pnp0/00:02/uevent +++ /dev/null @@ -1 +0,0 @@ -DRIVER=system diff --git a/test/sys/devices/pnp0/00:03/firmware_node b/test/sys/devices/pnp0/00:03/firmware_node deleted file mode 120000 index f1383eda0f..0000000000 --- a/test/sys/devices/pnp0/00:03/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0103:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:03/id b/test/sys/devices/pnp0/00:03/id deleted file mode 100644 index 01bdd099b8..0000000000 --- a/test/sys/devices/pnp0/00:03/id +++ /dev/null @@ -1 +0,0 @@ -PNP0103 diff --git a/test/sys/devices/pnp0/00:03/options b/test/sys/devices/pnp0/00:03/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:03/power/wakeup b/test/sys/devices/pnp0/00:03/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:03/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:03/resources b/test/sys/devices/pnp0/00:03/resources deleted file mode 100644 index 04faff5084..0000000000 --- a/test/sys/devices/pnp0/00:03/resources +++ /dev/null @@ -1,2 +0,0 @@ -state = active -mem 0xfed00000-0xfed003ff diff --git a/test/sys/devices/pnp0/00:03/subsystem b/test/sys/devices/pnp0/00:03/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:03/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:03/uevent b/test/sys/devices/pnp0/00:03/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:04/firmware_node b/test/sys/devices/pnp0/00:04/firmware_node deleted file mode 120000 index dfcdf1c3b5..0000000000 --- a/test/sys/devices/pnp0/00:04/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0200:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:04/id b/test/sys/devices/pnp0/00:04/id deleted file mode 100644 index d14c5bc3ff..0000000000 --- a/test/sys/devices/pnp0/00:04/id +++ /dev/null @@ -1 +0,0 @@ -PNP0200 diff --git a/test/sys/devices/pnp0/00:04/options b/test/sys/devices/pnp0/00:04/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:04/power/wakeup b/test/sys/devices/pnp0/00:04/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:04/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:04/resources b/test/sys/devices/pnp0/00:04/resources deleted file mode 100644 index 8d6e436d77..0000000000 --- a/test/sys/devices/pnp0/00:04/resources +++ /dev/null @@ -1,5 +0,0 @@ -state = active -io 0x0-0xf -io 0x80-0x8f -io 0xc0-0xdf -dma 4 diff --git a/test/sys/devices/pnp0/00:04/subsystem b/test/sys/devices/pnp0/00:04/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:04/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:04/uevent b/test/sys/devices/pnp0/00:04/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:05/firmware_node b/test/sys/devices/pnp0/00:05/firmware_node deleted file mode 120000 index 17eea0d63a..0000000000 --- a/test/sys/devices/pnp0/00:05/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0800:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:05/id b/test/sys/devices/pnp0/00:05/id deleted file mode 100644 index aec7221dee..0000000000 --- a/test/sys/devices/pnp0/00:05/id +++ /dev/null @@ -1 +0,0 @@ -PNP0800 diff --git a/test/sys/devices/pnp0/00:05/options b/test/sys/devices/pnp0/00:05/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:05/power/wakeup b/test/sys/devices/pnp0/00:05/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:05/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:05/resources b/test/sys/devices/pnp0/00:05/resources deleted file mode 100644 index 068ca9b670..0000000000 --- a/test/sys/devices/pnp0/00:05/resources +++ /dev/null @@ -1,2 +0,0 @@ -state = active -io 0x61-0x61 diff --git a/test/sys/devices/pnp0/00:05/subsystem b/test/sys/devices/pnp0/00:05/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:05/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:05/uevent b/test/sys/devices/pnp0/00:05/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:06/firmware_node b/test/sys/devices/pnp0/00:06/firmware_node deleted file mode 120000 index 99a333d2b4..0000000000 --- a/test/sys/devices/pnp0/00:06/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C04:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:06/id b/test/sys/devices/pnp0/00:06/id deleted file mode 100644 index 808147da40..0000000000 --- a/test/sys/devices/pnp0/00:06/id +++ /dev/null @@ -1 +0,0 @@ -PNP0c04 diff --git a/test/sys/devices/pnp0/00:06/options b/test/sys/devices/pnp0/00:06/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:06/power/wakeup b/test/sys/devices/pnp0/00:06/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:06/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:06/resources b/test/sys/devices/pnp0/00:06/resources deleted file mode 100644 index da2ff4ba78..0000000000 --- a/test/sys/devices/pnp0/00:06/resources +++ /dev/null @@ -1,3 +0,0 @@ -state = active -io 0xf0-0xf0 -irq 13 diff --git a/test/sys/devices/pnp0/00:06/subsystem b/test/sys/devices/pnp0/00:06/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:06/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:06/uevent b/test/sys/devices/pnp0/00:06/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:07/driver b/test/sys/devices/pnp0/00:07/driver deleted file mode 120000 index 6a8764e224..0000000000 --- a/test/sys/devices/pnp0/00:07/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp/drivers/rtc_cmos \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/firmware_node b/test/sys/devices/pnp0/00:07/firmware_node deleted file mode 120000 index 4154e9a091..0000000000 --- a/test/sys/devices/pnp0/00:07/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0B00:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/id b/test/sys/devices/pnp0/00:07/id deleted file mode 100644 index 13b00bc481..0000000000 --- a/test/sys/devices/pnp0/00:07/id +++ /dev/null @@ -1 +0,0 @@ -PNP0b00 diff --git a/test/sys/devices/pnp0/00:07/nvram b/test/sys/devices/pnp0/00:07/nvram deleted file mode 100644 index 0c4c788d9d..0000000000 Binary files a/test/sys/devices/pnp0/00:07/nvram and /dev/null differ diff --git a/test/sys/devices/pnp0/00:07/options b/test/sys/devices/pnp0/00:07/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:07/power/wakeup b/test/sys/devices/pnp0/00:07/power/wakeup deleted file mode 100644 index 86981e69f6..0000000000 --- a/test/sys/devices/pnp0/00:07/power/wakeup +++ /dev/null @@ -1 +0,0 @@ -enabled diff --git a/test/sys/devices/pnp0/00:07/resources b/test/sys/devices/pnp0/00:07/resources deleted file mode 100644 index c697323bf4..0000000000 --- a/test/sys/devices/pnp0/00:07/resources +++ /dev/null @@ -1,3 +0,0 @@ -state = active -io 0x70-0x71 -irq 8 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/date b/test/sys/devices/pnp0/00:07/rtc/rtc0/date deleted file mode 100644 index 5315755e05..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/date +++ /dev/null @@ -1 +0,0 @@ -2008-09-29 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/dev b/test/sys/devices/pnp0/00:07/rtc/rtc0/dev deleted file mode 100644 index 0cad52aef5..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/dev +++ /dev/null @@ -1 +0,0 @@ -253:0 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/device b/test/sys/devices/pnp0/00:07/rtc/rtc0/device deleted file mode 120000 index 617545acf7..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/device +++ /dev/null @@ -1 +0,0 @@ -../../../00:07 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq b/test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/max_user_freq +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/name b/test/sys/devices/pnp0/00:07/rtc/rtc0/name deleted file mode 100644 index 89830d2bdb..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/name +++ /dev/null @@ -1 +0,0 @@ -rtc_cmos diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup b/test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch b/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch deleted file mode 100644 index d81530dfc7..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/since_epoch +++ /dev/null @@ -1 +0,0 @@ -1222655451 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem b/test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem deleted file mode 120000 index 00b31dd527..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/rtc \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/time b/test/sys/devices/pnp0/00:07/rtc/rtc0/time deleted file mode 100644 index 4b7b55dee1..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/time +++ /dev/null @@ -1 +0,0 @@ -02:30:51 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/uevent b/test/sys/devices/pnp0/00:07/rtc/rtc0/uevent deleted file mode 100644 index b04cc3e1d0..0000000000 --- a/test/sys/devices/pnp0/00:07/rtc/rtc0/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=253 -MINOR=0 diff --git a/test/sys/devices/pnp0/00:07/rtc/rtc0/wakealarm b/test/sys/devices/pnp0/00:07/rtc/rtc0/wakealarm deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:07/subsystem b/test/sys/devices/pnp0/00:07/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:07/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:07/uevent b/test/sys/devices/pnp0/00:07/uevent deleted file mode 100644 index cb584c04e3..0000000000 --- a/test/sys/devices/pnp0/00:07/uevent +++ /dev/null @@ -1 +0,0 @@ -DRIVER=rtc_cmos diff --git a/test/sys/devices/pnp0/00:08/driver b/test/sys/devices/pnp0/00:08/driver deleted file mode 120000 index 51bc226008..0000000000 --- a/test/sys/devices/pnp0/00:08/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp/drivers/i8042 kbd \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:08/firmware_node b/test/sys/devices/pnp0/00:08/firmware_node deleted file mode 120000 index b38ee5b14b..0000000000 --- a/test/sys/devices/pnp0/00:08/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0303:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:08/id b/test/sys/devices/pnp0/00:08/id deleted file mode 100644 index 958febdd9e..0000000000 --- a/test/sys/devices/pnp0/00:08/id +++ /dev/null @@ -1 +0,0 @@ -PNP0303 diff --git a/test/sys/devices/pnp0/00:08/options b/test/sys/devices/pnp0/00:08/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:08/power/wakeup b/test/sys/devices/pnp0/00:08/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:08/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:08/resources b/test/sys/devices/pnp0/00:08/resources deleted file mode 100644 index ee3406e25d..0000000000 --- a/test/sys/devices/pnp0/00:08/resources +++ /dev/null @@ -1,4 +0,0 @@ -state = active -io 0x60-0x60 -io 0x64-0x64 -irq 1 diff --git a/test/sys/devices/pnp0/00:08/subsystem b/test/sys/devices/pnp0/00:08/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:08/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:08/uevent b/test/sys/devices/pnp0/00:08/uevent deleted file mode 100644 index 5cde1e92e9..0000000000 --- a/test/sys/devices/pnp0/00:08/uevent +++ /dev/null @@ -1 +0,0 @@ -DRIVER=i8042 kbd diff --git a/test/sys/devices/pnp0/00:09/driver b/test/sys/devices/pnp0/00:09/driver deleted file mode 120000 index d34888c126..0000000000 --- a/test/sys/devices/pnp0/00:09/driver +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp/drivers/i8042 aux \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:09/firmware_node b/test/sys/devices/pnp0/00:09/firmware_node deleted file mode 120000 index 05b19685a6..0000000000 --- a/test/sys/devices/pnp0/00:09/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/IBM0057:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:09/id b/test/sys/devices/pnp0/00:09/id deleted file mode 100644 index 68c3528574..0000000000 --- a/test/sys/devices/pnp0/00:09/id +++ /dev/null @@ -1,2 +0,0 @@ -IBM0057 -PNP0f13 diff --git a/test/sys/devices/pnp0/00:09/options b/test/sys/devices/pnp0/00:09/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:09/power/wakeup b/test/sys/devices/pnp0/00:09/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:09/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:09/resources b/test/sys/devices/pnp0/00:09/resources deleted file mode 100644 index 76ceb09fcf..0000000000 --- a/test/sys/devices/pnp0/00:09/resources +++ /dev/null @@ -1,2 +0,0 @@ -state = active -irq 12 diff --git a/test/sys/devices/pnp0/00:09/subsystem b/test/sys/devices/pnp0/00:09/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:09/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:09/uevent b/test/sys/devices/pnp0/00:09/uevent deleted file mode 100644 index da1cb5a961..0000000000 --- a/test/sys/devices/pnp0/00:09/uevent +++ /dev/null @@ -1 +0,0 @@ -DRIVER=i8042 aux diff --git a/test/sys/devices/pnp0/00:0a/firmware_node b/test/sys/devices/pnp0/00:0a/firmware_node deleted file mode 120000 index 4eaafe596c..0000000000 --- a/test/sys/devices/pnp0/00:0a/firmware_node +++ /dev/null @@ -1 +0,0 @@ -../../LNXSYSTM:00/device:00/PNP0A08:00/device:01/ATM1200:00 \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:0a/id b/test/sys/devices/pnp0/00:0a/id deleted file mode 100644 index 710874173e..0000000000 --- a/test/sys/devices/pnp0/00:0a/id +++ /dev/null @@ -1,2 +0,0 @@ -ATM1200 -PNP0c31 diff --git a/test/sys/devices/pnp0/00:0a/options b/test/sys/devices/pnp0/00:0a/options deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/00:0a/power/wakeup b/test/sys/devices/pnp0/00:0a/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/00:0a/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/00:0a/resources b/test/sys/devices/pnp0/00:0a/resources deleted file mode 100644 index eb1cddfd47..0000000000 --- a/test/sys/devices/pnp0/00:0a/resources +++ /dev/null @@ -1,2 +0,0 @@ -state = active -mem 0xfed40000-0xfed40fff diff --git a/test/sys/devices/pnp0/00:0a/subsystem b/test/sys/devices/pnp0/00:0a/subsystem deleted file mode 120000 index eca01f4dff..0000000000 --- a/test/sys/devices/pnp0/00:0a/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pnp \ No newline at end of file diff --git a/test/sys/devices/pnp0/00:0a/uevent b/test/sys/devices/pnp0/00:0a/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/pnp0/power/wakeup b/test/sys/devices/pnp0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/pnp0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/pnp0/uevent b/test/sys/devices/pnp0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/system/clocksource/clocksource0/available_clocksource b/test/sys/devices/system/clocksource/clocksource0/available_clocksource deleted file mode 100644 index dbfc0c4897..0000000000 --- a/test/sys/devices/system/clocksource/clocksource0/available_clocksource +++ /dev/null @@ -1 +0,0 @@ -hpet acpi_pm jiffies tsc diff --git a/test/sys/devices/system/clocksource/clocksource0/current_clocksource b/test/sys/devices/system/clocksource/clocksource0/current_clocksource deleted file mode 100644 index 5ad7d8fabe..0000000000 --- a/test/sys/devices/system/clocksource/clocksource0/current_clocksource +++ /dev/null @@ -1 +0,0 @@ -hpet diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size b/test/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/level b/test/sys/devices/system/cpu/cpu0/cache/index0/level deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index0/level +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/number_of_sets b/test/sys/devices/system/cpu/cpu0/cache/index0/number_of_sets deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index0/number_of_sets +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/physical_line_partition b/test/sys/devices/system/cpu/cpu0/cache/index0/physical_line_partition deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index0/physical_line_partition +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list b/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_list +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map b/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index0/shared_cpu_map +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/size b/test/sys/devices/system/cpu/cpu0/cache/index0/size deleted file mode 100644 index 56b868b2a3..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index0/size +++ /dev/null @@ -1 +0,0 @@ -32K diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/type b/test/sys/devices/system/cpu/cpu0/cache/index0/type deleted file mode 100644 index 0b7088ec63..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index0/type +++ /dev/null @@ -1 +0,0 @@ -Data diff --git a/test/sys/devices/system/cpu/cpu0/cache/index0/ways_of_associativity b/test/sys/devices/system/cpu/cpu0/cache/index0/ways_of_associativity deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index0/ways_of_associativity +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size b/test/sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index1/coherency_line_size +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/level b/test/sys/devices/system/cpu/cpu0/cache/index1/level deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index1/level +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/number_of_sets b/test/sys/devices/system/cpu/cpu0/cache/index1/number_of_sets deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index1/number_of_sets +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/physical_line_partition b/test/sys/devices/system/cpu/cpu0/cache/index1/physical_line_partition deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index1/physical_line_partition +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list b/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_list +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map b/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index1/shared_cpu_map +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/size b/test/sys/devices/system/cpu/cpu0/cache/index1/size deleted file mode 100644 index 56b868b2a3..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index1/size +++ /dev/null @@ -1 +0,0 @@ -32K diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/type b/test/sys/devices/system/cpu/cpu0/cache/index1/type deleted file mode 100644 index 9a53cbfa32..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index1/type +++ /dev/null @@ -1 +0,0 @@ -Instruction diff --git a/test/sys/devices/system/cpu/cpu0/cache/index1/ways_of_associativity b/test/sys/devices/system/cpu/cpu0/cache/index1/ways_of_associativity deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index1/ways_of_associativity +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size b/test/sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index2/coherency_line_size +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/level b/test/sys/devices/system/cpu/cpu0/cache/index2/level deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index2/level +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/number_of_sets b/test/sys/devices/system/cpu/cpu0/cache/index2/number_of_sets deleted file mode 100644 index 801c306ed3..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index2/number_of_sets +++ /dev/null @@ -1 +0,0 @@ -4096 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/physical_line_partition b/test/sys/devices/system/cpu/cpu0/cache/index2/physical_line_partition deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index2/physical_line_partition +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list b/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list deleted file mode 100644 index 8b0fab869c..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_list +++ /dev/null @@ -1 +0,0 @@ -0-1 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map b/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index2/shared_cpu_map +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/size b/test/sys/devices/system/cpu/cpu0/cache/index2/size deleted file mode 100644 index 6399ecd3bd..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index2/size +++ /dev/null @@ -1 +0,0 @@ -4096K diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/type b/test/sys/devices/system/cpu/cpu0/cache/index2/type deleted file mode 100644 index e4fd9dccda..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index2/type +++ /dev/null @@ -1 +0,0 @@ -Unified diff --git a/test/sys/devices/system/cpu/cpu0/cache/index2/ways_of_associativity b/test/sys/devices/system/cpu/cpu0/cache/index2/ways_of_associativity deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cache/index2/ways_of_associativity +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus b/test/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus deleted file mode 100644 index 6e8183b72e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/affected_cpus +++ /dev/null @@ -1 +0,0 @@ -0 1 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq deleted file mode 100644 index 749fce669d..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq +++ /dev/null @@ -1 +0,0 @@ -1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq deleted file mode 100644 index d69c7579dd..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq +++ /dev/null @@ -1 +0,0 @@ -2333000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq deleted file mode 100644 index 749fce669d..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq +++ /dev/null @@ -1 +0,0 @@ -1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/powersave_bias +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate deleted file mode 100644 index b92677edb9..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate +++ /dev/null @@ -1 +0,0 @@ -20000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max deleted file mode 100644 index 825319e1c5..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max +++ /dev/null @@ -1 +0,0 @@ -10000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_min b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_min deleted file mode 100644 index 5caff40c4a..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_min +++ /dev/null @@ -1 +0,0 @@ -10000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold b/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold deleted file mode 100644 index d61f00d8ca..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold +++ /dev/null @@ -1 +0,0 @@ -90 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/related_cpus b/test/sys/devices/system/cpu/cpu0/cpufreq/related_cpus deleted file mode 100644 index 6e8183b72e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/related_cpus +++ /dev/null @@ -1 +0,0 @@ -0 1 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies deleted file mode 100644 index 05f8e24a95..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies +++ /dev/null @@ -1 +0,0 @@ -2333000 2000000 1667000 1333000 1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors deleted file mode 100644 index 78d5ebe295..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors +++ /dev/null @@ -1 +0,0 @@ -ondemand performance diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq deleted file mode 100644 index 749fce669d..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq +++ /dev/null @@ -1 +0,0 @@ -1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver deleted file mode 100644 index 840e47772f..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver +++ /dev/null @@ -1 +0,0 @@ -acpi-cpufreq diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor deleted file mode 100644 index 7c0425c393..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor +++ /dev/null @@ -1 +0,0 @@ -ondemand diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq deleted file mode 100644 index 749fce669d..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq +++ /dev/null @@ -1 +0,0 @@ -1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq deleted file mode 100644 index 749fce669d..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq +++ /dev/null @@ -1 +0,0 @@ -1000000 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed b/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed deleted file mode 100644 index 2bc16b6d12..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state deleted file mode 100644 index ea287bd1c9..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state +++ /dev/null @@ -1,5 +0,0 @@ -2333000 92206 -2000000 442 -1667000 1009 -1333000 1713 -1000000 740740 diff --git a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans b/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans deleted file mode 100644 index 09a6148e46..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpufreq/stats/total_trans +++ /dev/null @@ -1 +0,0 @@ -12627 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc deleted file mode 100644 index 8d12e88506..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/desc +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/latency b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/latency deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/latency +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name deleted file mode 100644 index 8d12e88506..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/name +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/power b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/power deleted file mode 100644 index 4f6ff861c9..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/power +++ /dev/null @@ -1 +0,0 @@ -4294967295 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/time deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/time +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state0/usage deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state0/usage +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/desc deleted file mode 100644 index a96b77dc9c..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/desc +++ /dev/null @@ -1 +0,0 @@ -ACPI FFH INTEL MWAIT 0x0 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/latency b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/latency deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/latency +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/name b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/name deleted file mode 100644 index e2cf5e7905..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/name +++ /dev/null @@ -1 +0,0 @@ -C1 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/power b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/power deleted file mode 100644 index 83b33d238d..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/power +++ /dev/null @@ -1 +0,0 @@ -1000 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time deleted file mode 100644 index 408adce179..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/time +++ /dev/null @@ -1 +0,0 @@ -1044 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state1/usage +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/desc deleted file mode 100644 index a37c1e636b..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/desc +++ /dev/null @@ -1 +0,0 @@ -ACPI FFH INTEL MWAIT 0x10 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/latency b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/latency deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/latency +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/name b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/name deleted file mode 100644 index c4b2d41eaa..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/name +++ /dev/null @@ -1 +0,0 @@ -C2 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/power b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/power deleted file mode 100644 index 1b79f38e25..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/power +++ /dev/null @@ -1 +0,0 @@ -500 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time deleted file mode 100644 index bd98ddf2cd..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/time +++ /dev/null @@ -1 +0,0 @@ -209561 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage deleted file mode 100644 index e4d4fcd0b3..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state2/usage +++ /dev/null @@ -1 +0,0 @@ -689 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc deleted file mode 100644 index a5ce98be16..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/desc +++ /dev/null @@ -1 +0,0 @@ -ACPI FFH INTEL MWAIT 0x30 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency deleted file mode 100644 index e1617e842a..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/latency +++ /dev/null @@ -1 +0,0 @@ -57 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/name b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/name deleted file mode 100644 index b1954f8204..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/name +++ /dev/null @@ -1 +0,0 @@ -C3 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/power +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time deleted file mode 100644 index 533478614c..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/time +++ /dev/null @@ -1 +0,0 @@ -116651688 diff --git a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage b/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage deleted file mode 100644 index 74a3eba7b4..0000000000 --- a/test/sys/devices/system/cpu/cpu0/cpuidle/state3/usage +++ /dev/null @@ -1 +0,0 @@ -11774 diff --git a/test/sys/devices/system/cpu/cpu0/crash_notes b/test/sys/devices/system/cpu/cpu0/crash_notes deleted file mode 100644 index 33ad4f3599..0000000000 --- a/test/sys/devices/system/cpu/cpu0/crash_notes +++ /dev/null @@ -1 +0,0 @@ -7fb20920 diff --git a/test/sys/devices/system/cpu/cpu0/microcode/processor_flags b/test/sys/devices/system/cpu/cpu0/microcode/processor_flags deleted file mode 100644 index a1b07c7533..0000000000 --- a/test/sys/devices/system/cpu/cpu0/microcode/processor_flags +++ /dev/null @@ -1 +0,0 @@ -0x20 diff --git a/test/sys/devices/system/cpu/cpu0/microcode/version b/test/sys/devices/system/cpu/cpu0/microcode/version deleted file mode 100644 index bfd49ddc8d..0000000000 --- a/test/sys/devices/system/cpu/cpu0/microcode/version +++ /dev/null @@ -1 +0,0 @@ -0xc7 diff --git a/test/sys/devices/system/cpu/cpu0/thermal_throttle/count b/test/sys/devices/system/cpu/cpu0/thermal_throttle/count deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/thermal_throttle/count +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu0/topology/core_id b/test/sys/devices/system/cpu/cpu0/topology/core_id deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/topology/core_id +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu0/topology/core_siblings b/test/sys/devices/system/cpu/cpu0/topology/core_siblings deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/system/cpu/cpu0/topology/core_siblings +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/system/cpu/cpu0/topology/core_siblings_list b/test/sys/devices/system/cpu/cpu0/topology/core_siblings_list deleted file mode 100644 index 8b0fab869c..0000000000 --- a/test/sys/devices/system/cpu/cpu0/topology/core_siblings_list +++ /dev/null @@ -1 +0,0 @@ -0-1 diff --git a/test/sys/devices/system/cpu/cpu0/topology/physical_package_id b/test/sys/devices/system/cpu/cpu0/topology/physical_package_id deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/topology/physical_package_id +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu0/topology/thread_siblings b/test/sys/devices/system/cpu/cpu0/topology/thread_siblings deleted file mode 100644 index 8a0f05e166..0000000000 --- a/test/sys/devices/system/cpu/cpu0/topology/thread_siblings +++ /dev/null @@ -1 +0,0 @@ -01 diff --git a/test/sys/devices/system/cpu/cpu0/topology/thread_siblings_list b/test/sys/devices/system/cpu/cpu0/topology/thread_siblings_list deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu0/topology/thread_siblings_list +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/coherency_line_size b/test/sys/devices/system/cpu/cpu1/cache/index0/coherency_line_size deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index0/coherency_line_size +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/level b/test/sys/devices/system/cpu/cpu1/cache/index0/level deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index0/level +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/number_of_sets b/test/sys/devices/system/cpu/cpu1/cache/index0/number_of_sets deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index0/number_of_sets +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/physical_line_partition b/test/sys/devices/system/cpu/cpu1/cache/index0/physical_line_partition deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index0/physical_line_partition +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list b/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_list +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map b/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index0/shared_cpu_map +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/size b/test/sys/devices/system/cpu/cpu1/cache/index0/size deleted file mode 100644 index 56b868b2a3..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index0/size +++ /dev/null @@ -1 +0,0 @@ -32K diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/type b/test/sys/devices/system/cpu/cpu1/cache/index0/type deleted file mode 100644 index 0b7088ec63..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index0/type +++ /dev/null @@ -1 +0,0 @@ -Data diff --git a/test/sys/devices/system/cpu/cpu1/cache/index0/ways_of_associativity b/test/sys/devices/system/cpu/cpu1/cache/index0/ways_of_associativity deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index0/ways_of_associativity +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/coherency_line_size b/test/sys/devices/system/cpu/cpu1/cache/index1/coherency_line_size deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index1/coherency_line_size +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/level b/test/sys/devices/system/cpu/cpu1/cache/index1/level deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index1/level +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/number_of_sets b/test/sys/devices/system/cpu/cpu1/cache/index1/number_of_sets deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index1/number_of_sets +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/physical_line_partition b/test/sys/devices/system/cpu/cpu1/cache/index1/physical_line_partition deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index1/physical_line_partition +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list b/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_list +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map b/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index1/shared_cpu_map +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/size b/test/sys/devices/system/cpu/cpu1/cache/index1/size deleted file mode 100644 index 56b868b2a3..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index1/size +++ /dev/null @@ -1 +0,0 @@ -32K diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/type b/test/sys/devices/system/cpu/cpu1/cache/index1/type deleted file mode 100644 index 9a53cbfa32..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index1/type +++ /dev/null @@ -1 +0,0 @@ -Instruction diff --git a/test/sys/devices/system/cpu/cpu1/cache/index1/ways_of_associativity b/test/sys/devices/system/cpu/cpu1/cache/index1/ways_of_associativity deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index1/ways_of_associativity +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/coherency_line_size b/test/sys/devices/system/cpu/cpu1/cache/index2/coherency_line_size deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index2/coherency_line_size +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/level b/test/sys/devices/system/cpu/cpu1/cache/index2/level deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index2/level +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/number_of_sets b/test/sys/devices/system/cpu/cpu1/cache/index2/number_of_sets deleted file mode 100644 index 801c306ed3..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index2/number_of_sets +++ /dev/null @@ -1 +0,0 @@ -4096 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/physical_line_partition b/test/sys/devices/system/cpu/cpu1/cache/index2/physical_line_partition deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index2/physical_line_partition +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list b/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list deleted file mode 100644 index 8b0fab869c..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_list +++ /dev/null @@ -1 +0,0 @@ -0-1 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map b/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index2/shared_cpu_map +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/size b/test/sys/devices/system/cpu/cpu1/cache/index2/size deleted file mode 100644 index 6399ecd3bd..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index2/size +++ /dev/null @@ -1 +0,0 @@ -4096K diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/type b/test/sys/devices/system/cpu/cpu1/cache/index2/type deleted file mode 100644 index e4fd9dccda..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index2/type +++ /dev/null @@ -1 +0,0 @@ -Unified diff --git a/test/sys/devices/system/cpu/cpu1/cache/index2/ways_of_associativity b/test/sys/devices/system/cpu/cpu1/cache/index2/ways_of_associativity deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cache/index2/ways_of_associativity +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/devices/system/cpu/cpu1/cpufreq b/test/sys/devices/system/cpu/cpu1/cpufreq deleted file mode 120000 index 3af6695473..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpufreq +++ /dev/null @@ -1 +0,0 @@ -../cpu0/cpufreq \ No newline at end of file diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc deleted file mode 100644 index 8d12e88506..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/desc +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/latency b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/latency deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/latency +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name deleted file mode 100644 index 8d12e88506..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/name +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/power b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/power deleted file mode 100644 index 4f6ff861c9..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/power +++ /dev/null @@ -1 +0,0 @@ -4294967295 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/time deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/time +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state0/usage deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state0/usage +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/desc deleted file mode 100644 index a96b77dc9c..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/desc +++ /dev/null @@ -1 +0,0 @@ -ACPI FFH INTEL MWAIT 0x0 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/latency b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/latency deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/latency +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/name b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/name deleted file mode 100644 index e2cf5e7905..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/name +++ /dev/null @@ -1 +0,0 @@ -C1 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/power b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/power deleted file mode 100644 index 83b33d238d..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/power +++ /dev/null @@ -1 +0,0 @@ -1000 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/time +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state1/usage +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/desc deleted file mode 100644 index a37c1e636b..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/desc +++ /dev/null @@ -1 +0,0 @@ -ACPI FFH INTEL MWAIT 0x10 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/latency b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/latency deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/latency +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/name b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/name deleted file mode 100644 index c4b2d41eaa..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/name +++ /dev/null @@ -1 +0,0 @@ -C2 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/power b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/power deleted file mode 100644 index 1b79f38e25..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/power +++ /dev/null @@ -1 +0,0 @@ -500 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time deleted file mode 100644 index 85ac849b08..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/time +++ /dev/null @@ -1 +0,0 @@ -47233 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage deleted file mode 100644 index e6a4f00bf7..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state2/usage +++ /dev/null @@ -1 +0,0 @@ -271 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc deleted file mode 100644 index a5ce98be16..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/desc +++ /dev/null @@ -1 +0,0 @@ -ACPI FFH INTEL MWAIT 0x30 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency deleted file mode 100644 index e1617e842a..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/latency +++ /dev/null @@ -1 +0,0 @@ -57 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/name b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/name deleted file mode 100644 index b1954f8204..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/name +++ /dev/null @@ -1 +0,0 @@ -C3 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/power +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time deleted file mode 100644 index 0e44adfdf4..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/time +++ /dev/null @@ -1 +0,0 @@ -117038054 diff --git a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage b/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage deleted file mode 100644 index 390213311e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/cpuidle/state3/usage +++ /dev/null @@ -1 +0,0 @@ -10601 diff --git a/test/sys/devices/system/cpu/cpu1/crash_notes b/test/sys/devices/system/cpu/cpu1/crash_notes deleted file mode 100644 index 80d7b8d1fd..0000000000 --- a/test/sys/devices/system/cpu/cpu1/crash_notes +++ /dev/null @@ -1 +0,0 @@ -7fb20b68 diff --git a/test/sys/devices/system/cpu/cpu1/microcode/processor_flags b/test/sys/devices/system/cpu/cpu1/microcode/processor_flags deleted file mode 100644 index a1b07c7533..0000000000 --- a/test/sys/devices/system/cpu/cpu1/microcode/processor_flags +++ /dev/null @@ -1 +0,0 @@ -0x20 diff --git a/test/sys/devices/system/cpu/cpu1/microcode/version b/test/sys/devices/system/cpu/cpu1/microcode/version deleted file mode 100644 index bfd49ddc8d..0000000000 --- a/test/sys/devices/system/cpu/cpu1/microcode/version +++ /dev/null @@ -1 +0,0 @@ -0xc7 diff --git a/test/sys/devices/system/cpu/cpu1/online b/test/sys/devices/system/cpu/cpu1/online deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/online +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/thermal_throttle/count b/test/sys/devices/system/cpu/cpu1/thermal_throttle/count deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu1/thermal_throttle/count +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu1/topology/core_id b/test/sys/devices/system/cpu/cpu1/topology/core_id deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/topology/core_id +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpu1/topology/core_siblings b/test/sys/devices/system/cpu/cpu1/topology/core_siblings deleted file mode 100644 index 75016ea362..0000000000 --- a/test/sys/devices/system/cpu/cpu1/topology/core_siblings +++ /dev/null @@ -1 +0,0 @@ -03 diff --git a/test/sys/devices/system/cpu/cpu1/topology/core_siblings_list b/test/sys/devices/system/cpu/cpu1/topology/core_siblings_list deleted file mode 100644 index 8b0fab869c..0000000000 --- a/test/sys/devices/system/cpu/cpu1/topology/core_siblings_list +++ /dev/null @@ -1 +0,0 @@ -0-1 diff --git a/test/sys/devices/system/cpu/cpu1/topology/physical_package_id b/test/sys/devices/system/cpu/cpu1/topology/physical_package_id deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/system/cpu/cpu1/topology/physical_package_id +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/system/cpu/cpu1/topology/thread_siblings b/test/sys/devices/system/cpu/cpu1/topology/thread_siblings deleted file mode 100644 index 9e22bcb8e3..0000000000 --- a/test/sys/devices/system/cpu/cpu1/topology/thread_siblings +++ /dev/null @@ -1 +0,0 @@ -02 diff --git a/test/sys/devices/system/cpu/cpu1/topology/thread_siblings_list b/test/sys/devices/system/cpu/cpu1/topology/thread_siblings_list deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/cpu1/topology/thread_siblings_list +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/cpu/cpuidle/current_driver b/test/sys/devices/system/cpu/cpuidle/current_driver deleted file mode 100644 index 57d5dd37cd..0000000000 --- a/test/sys/devices/system/cpu/cpuidle/current_driver +++ /dev/null @@ -1 +0,0 @@ -acpi_idle diff --git a/test/sys/devices/system/cpu/cpuidle/current_governor_ro b/test/sys/devices/system/cpu/cpuidle/current_governor_ro deleted file mode 100644 index c35a724b3f..0000000000 --- a/test/sys/devices/system/cpu/cpuidle/current_governor_ro +++ /dev/null @@ -1 +0,0 @@ -menu diff --git a/test/sys/devices/system/cpu/online b/test/sys/devices/system/cpu/online deleted file mode 100644 index 8b0fab869c..0000000000 --- a/test/sys/devices/system/cpu/online +++ /dev/null @@ -1 +0,0 @@ -0-1 diff --git a/test/sys/devices/system/cpu/possible b/test/sys/devices/system/cpu/possible deleted file mode 100644 index 8b0fab869c..0000000000 --- a/test/sys/devices/system/cpu/possible +++ /dev/null @@ -1 +0,0 @@ -0-1 diff --git a/test/sys/devices/system/cpu/present b/test/sys/devices/system/cpu/present deleted file mode 100644 index 8b0fab869c..0000000000 --- a/test/sys/devices/system/cpu/present +++ /dev/null @@ -1 +0,0 @@ -0-1 diff --git a/test/sys/devices/system/cpu/sched_mc_power_savings b/test/sys/devices/system/cpu/sched_mc_power_savings deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/cpu/sched_mc_power_savings +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank0ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank0ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck0/bank0ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank1ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank1ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck0/bank1ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank2ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank2ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck0/bank2ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank3ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank3ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck0/bank3ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank4ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank4ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck0/bank4ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/bank5ctl b/test/sys/devices/system/machinecheck/machinecheck0/bank5ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck0/bank5ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck0/check_interval b/test/sys/devices/system/machinecheck/machinecheck0/check_interval deleted file mode 100644 index 3af45c94a2..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck0/check_interval +++ /dev/null @@ -1 +0,0 @@ -12c diff --git a/test/sys/devices/system/machinecheck/machinecheck0/tolerant b/test/sys/devices/system/machinecheck/machinecheck0/tolerant deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck0/tolerant +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/machinecheck/machinecheck0/trigger b/test/sys/devices/system/machinecheck/machinecheck0/trigger deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck0/trigger +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank0ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank0ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck1/bank0ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank1ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank1ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck1/bank1ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank2ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank2ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck1/bank2ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank3ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank3ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck1/bank3ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank4ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank4ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck1/bank4ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/bank5ctl b/test/sys/devices/system/machinecheck/machinecheck1/bank5ctl deleted file mode 100644 index 36521686ac..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck1/bank5ctl +++ /dev/null @@ -1 +0,0 @@ -ffffffffffffffff diff --git a/test/sys/devices/system/machinecheck/machinecheck1/check_interval b/test/sys/devices/system/machinecheck/machinecheck1/check_interval deleted file mode 100644 index 3af45c94a2..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck1/check_interval +++ /dev/null @@ -1 +0,0 @@ -12c diff --git a/test/sys/devices/system/machinecheck/machinecheck1/tolerant b/test/sys/devices/system/machinecheck/machinecheck1/tolerant deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck1/tolerant +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/system/machinecheck/machinecheck1/trigger b/test/sys/devices/system/machinecheck/machinecheck1/trigger deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/system/machinecheck/machinecheck1/trigger +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/0:16/max_ratio b/test/sys/devices/virtual/bdi/0:16/max_ratio deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/bdi/0:16/max_ratio +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/bdi/0:16/min_ratio b/test/sys/devices/virtual/bdi/0:16/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/0:16/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/0:16/power/wakeup b/test/sys/devices/virtual/bdi/0:16/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/0:16/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/0:16/read_ahead_kb b/test/sys/devices/virtual/bdi/0:16/read_ahead_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/virtual/bdi/0:16/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/virtual/bdi/0:16/subsystem b/test/sys/devices/virtual/bdi/0:16/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/0:16/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/0:16/uevent b/test/sys/devices/virtual/bdi/0:16/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/11:0/max_ratio b/test/sys/devices/virtual/bdi/11:0/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/11:0/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/11:0/min_ratio b/test/sys/devices/virtual/bdi/11:0/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/11:0/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/11:0/power/wakeup b/test/sys/devices/virtual/bdi/11:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/11:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/11:0/read_ahead_kb b/test/sys/devices/virtual/bdi/11:0/read_ahead_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/virtual/bdi/11:0/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/virtual/bdi/11:0/subsystem b/test/sys/devices/virtual/bdi/11:0/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/11:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/11:0/uevent b/test/sys/devices/virtual/bdi/11:0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/7:0/max_ratio b/test/sys/devices/virtual/bdi/7:0/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/7:0/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/7:0/min_ratio b/test/sys/devices/virtual/bdi/7:0/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:0/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:0/power/wakeup b/test/sys/devices/virtual/bdi/7:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/7:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/7:0/read_ahead_kb b/test/sys/devices/virtual/bdi/7:0/read_ahead_kb deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:0/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:0/subsystem b/test/sys/devices/virtual/bdi/7:0/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/7:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:0/uevent b/test/sys/devices/virtual/bdi/7:0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/7:1/max_ratio b/test/sys/devices/virtual/bdi/7:1/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/7:1/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/7:1/min_ratio b/test/sys/devices/virtual/bdi/7:1/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:1/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:1/power/wakeup b/test/sys/devices/virtual/bdi/7:1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/7:1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/7:1/read_ahead_kb b/test/sys/devices/virtual/bdi/7:1/read_ahead_kb deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:1/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:1/subsystem b/test/sys/devices/virtual/bdi/7:1/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/7:1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:1/uevent b/test/sys/devices/virtual/bdi/7:1/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/7:2/max_ratio b/test/sys/devices/virtual/bdi/7:2/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/7:2/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/7:2/min_ratio b/test/sys/devices/virtual/bdi/7:2/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:2/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:2/power/wakeup b/test/sys/devices/virtual/bdi/7:2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/7:2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/7:2/read_ahead_kb b/test/sys/devices/virtual/bdi/7:2/read_ahead_kb deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:2/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:2/subsystem b/test/sys/devices/virtual/bdi/7:2/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/7:2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:2/uevent b/test/sys/devices/virtual/bdi/7:2/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/7:3/max_ratio b/test/sys/devices/virtual/bdi/7:3/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/7:3/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/7:3/min_ratio b/test/sys/devices/virtual/bdi/7:3/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:3/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:3/power/wakeup b/test/sys/devices/virtual/bdi/7:3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/7:3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/7:3/read_ahead_kb b/test/sys/devices/virtual/bdi/7:3/read_ahead_kb deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:3/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:3/subsystem b/test/sys/devices/virtual/bdi/7:3/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/7:3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:3/uevent b/test/sys/devices/virtual/bdi/7:3/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/7:4/max_ratio b/test/sys/devices/virtual/bdi/7:4/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/7:4/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/7:4/min_ratio b/test/sys/devices/virtual/bdi/7:4/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:4/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:4/power/wakeup b/test/sys/devices/virtual/bdi/7:4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/7:4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/7:4/read_ahead_kb b/test/sys/devices/virtual/bdi/7:4/read_ahead_kb deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:4/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:4/subsystem b/test/sys/devices/virtual/bdi/7:4/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/7:4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:4/uevent b/test/sys/devices/virtual/bdi/7:4/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/7:5/max_ratio b/test/sys/devices/virtual/bdi/7:5/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/7:5/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/7:5/min_ratio b/test/sys/devices/virtual/bdi/7:5/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:5/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:5/power/wakeup b/test/sys/devices/virtual/bdi/7:5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/7:5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/7:5/read_ahead_kb b/test/sys/devices/virtual/bdi/7:5/read_ahead_kb deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:5/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:5/subsystem b/test/sys/devices/virtual/bdi/7:5/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/7:5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:5/uevent b/test/sys/devices/virtual/bdi/7:5/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/7:6/max_ratio b/test/sys/devices/virtual/bdi/7:6/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/7:6/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/7:6/min_ratio b/test/sys/devices/virtual/bdi/7:6/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:6/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:6/power/wakeup b/test/sys/devices/virtual/bdi/7:6/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/7:6/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/7:6/read_ahead_kb b/test/sys/devices/virtual/bdi/7:6/read_ahead_kb deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:6/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:6/subsystem b/test/sys/devices/virtual/bdi/7:6/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/7:6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:6/uevent b/test/sys/devices/virtual/bdi/7:6/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/7:7/max_ratio b/test/sys/devices/virtual/bdi/7:7/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/7:7/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/7:7/min_ratio b/test/sys/devices/virtual/bdi/7:7/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:7/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:7/power/wakeup b/test/sys/devices/virtual/bdi/7:7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/7:7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/7:7/read_ahead_kb b/test/sys/devices/virtual/bdi/7:7/read_ahead_kb deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/7:7/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/7:7/subsystem b/test/sys/devices/virtual/bdi/7:7/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/7:7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/7:7/uevent b/test/sys/devices/virtual/bdi/7:7/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/8:0/max_ratio b/test/sys/devices/virtual/bdi/8:0/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/8:0/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/8:0/min_ratio b/test/sys/devices/virtual/bdi/8:0/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/8:0/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/8:0/power/wakeup b/test/sys/devices/virtual/bdi/8:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/8:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/8:0/read_ahead_kb b/test/sys/devices/virtual/bdi/8:0/read_ahead_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/virtual/bdi/8:0/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/virtual/bdi/8:0/subsystem b/test/sys/devices/virtual/bdi/8:0/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/8:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/8:0/uevent b/test/sys/devices/virtual/bdi/8:0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/8:16/max_ratio b/test/sys/devices/virtual/bdi/8:16/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/8:16/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/8:16/min_ratio b/test/sys/devices/virtual/bdi/8:16/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/8:16/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/8:16/power/wakeup b/test/sys/devices/virtual/bdi/8:16/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/8:16/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/8:16/read_ahead_kb b/test/sys/devices/virtual/bdi/8:16/read_ahead_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/virtual/bdi/8:16/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/virtual/bdi/8:16/subsystem b/test/sys/devices/virtual/bdi/8:16/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/8:16/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/8:16/uevent b/test/sys/devices/virtual/bdi/8:16/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/9:0/max_ratio b/test/sys/devices/virtual/bdi/9:0/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/9:0/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/9:0/min_ratio b/test/sys/devices/virtual/bdi/9:0/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/9:0/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/9:0/power/wakeup b/test/sys/devices/virtual/bdi/9:0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/9:0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/9:0/read_ahead_kb b/test/sys/devices/virtual/bdi/9:0/read_ahead_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/virtual/bdi/9:0/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/virtual/bdi/9:0/subsystem b/test/sys/devices/virtual/bdi/9:0/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/9:0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/9:0/uevent b/test/sys/devices/virtual/bdi/9:0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/bdi/default/max_ratio b/test/sys/devices/virtual/bdi/default/max_ratio deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/devices/virtual/bdi/default/max_ratio +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/devices/virtual/bdi/default/min_ratio b/test/sys/devices/virtual/bdi/default/min_ratio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/bdi/default/min_ratio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/bdi/default/power/wakeup b/test/sys/devices/virtual/bdi/default/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/bdi/default/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/bdi/default/read_ahead_kb b/test/sys/devices/virtual/bdi/default/read_ahead_kb deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/devices/virtual/bdi/default/read_ahead_kb +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/devices/virtual/bdi/default/subsystem b/test/sys/devices/virtual/bdi/default/subsystem deleted file mode 120000 index 01f5e19517..0000000000 --- a/test/sys/devices/virtual/bdi/default/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/bdi \ No newline at end of file diff --git a/test/sys/devices/virtual/bdi/default/uevent b/test/sys/devices/virtual/bdi/default/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/capability b/test/sys/devices/virtual/block/fake!blockdev0/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/fake!blockdev0/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/dev b/test/sys/devices/virtual/block/fake!blockdev0/dev deleted file mode 100644 index 2ad787a87a..0000000000 --- a/test/sys/devices/virtual/block/fake!blockdev0/dev +++ /dev/null @@ -1 +0,0 @@ -711:0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/range b/test/sys/devices/virtual/block/fake!blockdev0/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/fake!blockdev0/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/removable b/test/sys/devices/virtual/block/fake!blockdev0/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/fake!blockdev0/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/ro b/test/sys/devices/virtual/block/fake!blockdev0/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/fake!blockdev0/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/size b/test/sys/devices/virtual/block/fake!blockdev0/size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/fake!blockdev0/size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/stat b/test/sys/devices/virtual/block/fake!blockdev0/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/virtual/block/fake!blockdev0/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/fake!blockdev0/subsystem b/test/sys/devices/virtual/block/fake!blockdev0/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/fake!blockdev0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/fake!blockdev0/uevent b/test/sys/devices/virtual/block/fake!blockdev0/uevent deleted file mode 100644 index 6c472ca852..0000000000 --- a/test/sys/devices/virtual/block/fake!blockdev0/uevent +++ /dev/null @@ -1,4 +0,0 @@ -MAJOR=7 -MINOR=0 -DEVTYPE=disk -DEVNAME=fake/blockdev0 diff --git a/test/sys/devices/virtual/block/loop0/bdi b/test/sys/devices/virtual/block/loop0/bdi deleted file mode 120000 index 18ceac07e2..0000000000 --- a/test/sys/devices/virtual/block/loop0/bdi +++ /dev/null @@ -1 +0,0 @@ -../../bdi/7:0 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop0/capability b/test/sys/devices/virtual/block/loop0/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/loop0/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/loop0/dev b/test/sys/devices/virtual/block/loop0/dev deleted file mode 100644 index 63cbc465cd..0000000000 --- a/test/sys/devices/virtual/block/loop0/dev +++ /dev/null @@ -1 +0,0 @@ -7:0 diff --git a/test/sys/devices/virtual/block/loop0/make-it-fail b/test/sys/devices/virtual/block/loop0/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop0/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop0/power/wakeup b/test/sys/devices/virtual/block/loop0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/block/loop0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/block/loop0/range b/test/sys/devices/virtual/block/loop0/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/loop0/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/loop0/removable b/test/sys/devices/virtual/block/loop0/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop0/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop0/ro b/test/sys/devices/virtual/block/loop0/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop0/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop0/size b/test/sys/devices/virtual/block/loop0/size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop0/size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop0/stat b/test/sys/devices/virtual/block/loop0/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/virtual/block/loop0/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop0/subsystem b/test/sys/devices/virtual/block/loop0/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/loop0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop0/uevent b/test/sys/devices/virtual/block/loop0/uevent deleted file mode 100644 index 70997d361b..0000000000 --- a/test/sys/devices/virtual/block/loop0/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=7 -MINOR=0 -DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop1/bdi b/test/sys/devices/virtual/block/loop1/bdi deleted file mode 120000 index c909eb9ec2..0000000000 --- a/test/sys/devices/virtual/block/loop1/bdi +++ /dev/null @@ -1 +0,0 @@ -../../bdi/7:1 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop1/capability b/test/sys/devices/virtual/block/loop1/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/loop1/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/loop1/dev b/test/sys/devices/virtual/block/loop1/dev deleted file mode 100644 index 084aafd011..0000000000 --- a/test/sys/devices/virtual/block/loop1/dev +++ /dev/null @@ -1 +0,0 @@ -7:1 diff --git a/test/sys/devices/virtual/block/loop1/make-it-fail b/test/sys/devices/virtual/block/loop1/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop1/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop1/power/wakeup b/test/sys/devices/virtual/block/loop1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/block/loop1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/block/loop1/range b/test/sys/devices/virtual/block/loop1/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/loop1/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/loop1/removable b/test/sys/devices/virtual/block/loop1/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop1/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop1/ro b/test/sys/devices/virtual/block/loop1/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop1/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop1/size b/test/sys/devices/virtual/block/loop1/size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop1/size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop1/stat b/test/sys/devices/virtual/block/loop1/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/virtual/block/loop1/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop1/subsystem b/test/sys/devices/virtual/block/loop1/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/loop1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop1/uevent b/test/sys/devices/virtual/block/loop1/uevent deleted file mode 100644 index 735db02c53..0000000000 --- a/test/sys/devices/virtual/block/loop1/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=7 -MINOR=1 -DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop2/bdi b/test/sys/devices/virtual/block/loop2/bdi deleted file mode 120000 index 5ab426c8de..0000000000 --- a/test/sys/devices/virtual/block/loop2/bdi +++ /dev/null @@ -1 +0,0 @@ -../../bdi/7:2 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop2/capability b/test/sys/devices/virtual/block/loop2/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/loop2/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/loop2/dev b/test/sys/devices/virtual/block/loop2/dev deleted file mode 100644 index 665a343e7d..0000000000 --- a/test/sys/devices/virtual/block/loop2/dev +++ /dev/null @@ -1 +0,0 @@ -7:2 diff --git a/test/sys/devices/virtual/block/loop2/make-it-fail b/test/sys/devices/virtual/block/loop2/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop2/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop2/power/wakeup b/test/sys/devices/virtual/block/loop2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/block/loop2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/block/loop2/range b/test/sys/devices/virtual/block/loop2/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/loop2/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/loop2/removable b/test/sys/devices/virtual/block/loop2/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop2/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop2/ro b/test/sys/devices/virtual/block/loop2/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop2/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop2/size b/test/sys/devices/virtual/block/loop2/size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop2/size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop2/stat b/test/sys/devices/virtual/block/loop2/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/virtual/block/loop2/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop2/subsystem b/test/sys/devices/virtual/block/loop2/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/loop2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop2/uevent b/test/sys/devices/virtual/block/loop2/uevent deleted file mode 100644 index 6d170d368a..0000000000 --- a/test/sys/devices/virtual/block/loop2/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=7 -MINOR=2 -DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop3/bdi b/test/sys/devices/virtual/block/loop3/bdi deleted file mode 120000 index 756b9c2cf5..0000000000 --- a/test/sys/devices/virtual/block/loop3/bdi +++ /dev/null @@ -1 +0,0 @@ -../../bdi/7:3 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop3/capability b/test/sys/devices/virtual/block/loop3/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/loop3/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/loop3/dev b/test/sys/devices/virtual/block/loop3/dev deleted file mode 100644 index 62f686140a..0000000000 --- a/test/sys/devices/virtual/block/loop3/dev +++ /dev/null @@ -1 +0,0 @@ -7:3 diff --git a/test/sys/devices/virtual/block/loop3/make-it-fail b/test/sys/devices/virtual/block/loop3/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop3/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop3/power/wakeup b/test/sys/devices/virtual/block/loop3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/block/loop3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/block/loop3/range b/test/sys/devices/virtual/block/loop3/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/loop3/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/loop3/removable b/test/sys/devices/virtual/block/loop3/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop3/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop3/ro b/test/sys/devices/virtual/block/loop3/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop3/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop3/size b/test/sys/devices/virtual/block/loop3/size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop3/size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop3/stat b/test/sys/devices/virtual/block/loop3/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/virtual/block/loop3/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop3/subsystem b/test/sys/devices/virtual/block/loop3/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/loop3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop3/uevent b/test/sys/devices/virtual/block/loop3/uevent deleted file mode 100644 index e6bbabc43d..0000000000 --- a/test/sys/devices/virtual/block/loop3/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=7 -MINOR=3 -DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop4/bdi b/test/sys/devices/virtual/block/loop4/bdi deleted file mode 120000 index 48969485be..0000000000 --- a/test/sys/devices/virtual/block/loop4/bdi +++ /dev/null @@ -1 +0,0 @@ -../../bdi/7:4 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop4/capability b/test/sys/devices/virtual/block/loop4/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/loop4/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/loop4/dev b/test/sys/devices/virtual/block/loop4/dev deleted file mode 100644 index 684e7ade03..0000000000 --- a/test/sys/devices/virtual/block/loop4/dev +++ /dev/null @@ -1 +0,0 @@ -7:4 diff --git a/test/sys/devices/virtual/block/loop4/make-it-fail b/test/sys/devices/virtual/block/loop4/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop4/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop4/power/wakeup b/test/sys/devices/virtual/block/loop4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/block/loop4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/block/loop4/range b/test/sys/devices/virtual/block/loop4/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/loop4/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/loop4/removable b/test/sys/devices/virtual/block/loop4/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop4/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop4/ro b/test/sys/devices/virtual/block/loop4/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop4/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop4/size b/test/sys/devices/virtual/block/loop4/size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop4/size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop4/stat b/test/sys/devices/virtual/block/loop4/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/virtual/block/loop4/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop4/subsystem b/test/sys/devices/virtual/block/loop4/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/loop4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop4/uevent b/test/sys/devices/virtual/block/loop4/uevent deleted file mode 100644 index dd9b914b9c..0000000000 --- a/test/sys/devices/virtual/block/loop4/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=7 -MINOR=4 -DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop5/bdi b/test/sys/devices/virtual/block/loop5/bdi deleted file mode 120000 index 28a54a9841..0000000000 --- a/test/sys/devices/virtual/block/loop5/bdi +++ /dev/null @@ -1 +0,0 @@ -../../bdi/7:5 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop5/capability b/test/sys/devices/virtual/block/loop5/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/loop5/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/loop5/dev b/test/sys/devices/virtual/block/loop5/dev deleted file mode 100644 index 9028bbffdb..0000000000 --- a/test/sys/devices/virtual/block/loop5/dev +++ /dev/null @@ -1 +0,0 @@ -7:5 diff --git a/test/sys/devices/virtual/block/loop5/make-it-fail b/test/sys/devices/virtual/block/loop5/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop5/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop5/power/wakeup b/test/sys/devices/virtual/block/loop5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/block/loop5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/block/loop5/range b/test/sys/devices/virtual/block/loop5/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/loop5/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/loop5/removable b/test/sys/devices/virtual/block/loop5/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop5/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop5/ro b/test/sys/devices/virtual/block/loop5/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop5/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop5/size b/test/sys/devices/virtual/block/loop5/size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop5/size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop5/stat b/test/sys/devices/virtual/block/loop5/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/virtual/block/loop5/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop5/subsystem b/test/sys/devices/virtual/block/loop5/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/loop5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop5/uevent b/test/sys/devices/virtual/block/loop5/uevent deleted file mode 100644 index 83a31c4f74..0000000000 --- a/test/sys/devices/virtual/block/loop5/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=7 -MINOR=5 -DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop6/bdi b/test/sys/devices/virtual/block/loop6/bdi deleted file mode 120000 index bf36ddae30..0000000000 --- a/test/sys/devices/virtual/block/loop6/bdi +++ /dev/null @@ -1 +0,0 @@ -../../bdi/7:6 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop6/capability b/test/sys/devices/virtual/block/loop6/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/loop6/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/loop6/dev b/test/sys/devices/virtual/block/loop6/dev deleted file mode 100644 index fc5d660a44..0000000000 --- a/test/sys/devices/virtual/block/loop6/dev +++ /dev/null @@ -1 +0,0 @@ -7:6 diff --git a/test/sys/devices/virtual/block/loop6/make-it-fail b/test/sys/devices/virtual/block/loop6/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop6/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop6/power/wakeup b/test/sys/devices/virtual/block/loop6/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/block/loop6/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/block/loop6/range b/test/sys/devices/virtual/block/loop6/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/loop6/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/loop6/removable b/test/sys/devices/virtual/block/loop6/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop6/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop6/ro b/test/sys/devices/virtual/block/loop6/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop6/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop6/size b/test/sys/devices/virtual/block/loop6/size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop6/size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop6/stat b/test/sys/devices/virtual/block/loop6/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/virtual/block/loop6/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop6/subsystem b/test/sys/devices/virtual/block/loop6/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/loop6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop6/uevent b/test/sys/devices/virtual/block/loop6/uevent deleted file mode 100644 index f4428d9334..0000000000 --- a/test/sys/devices/virtual/block/loop6/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=7 -MINOR=6 -DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/loop7/bdi b/test/sys/devices/virtual/block/loop7/bdi deleted file mode 120000 index b8918dde28..0000000000 --- a/test/sys/devices/virtual/block/loop7/bdi +++ /dev/null @@ -1 +0,0 @@ -../../bdi/7:7 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop7/capability b/test/sys/devices/virtual/block/loop7/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/loop7/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/loop7/dev b/test/sys/devices/virtual/block/loop7/dev deleted file mode 100644 index 5d4edd3ce1..0000000000 --- a/test/sys/devices/virtual/block/loop7/dev +++ /dev/null @@ -1 +0,0 @@ -7:7 diff --git a/test/sys/devices/virtual/block/loop7/make-it-fail b/test/sys/devices/virtual/block/loop7/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop7/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop7/power/wakeup b/test/sys/devices/virtual/block/loop7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/block/loop7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/block/loop7/range b/test/sys/devices/virtual/block/loop7/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/loop7/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/loop7/removable b/test/sys/devices/virtual/block/loop7/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop7/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop7/ro b/test/sys/devices/virtual/block/loop7/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop7/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop7/size b/test/sys/devices/virtual/block/loop7/size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/loop7/size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/loop7/stat b/test/sys/devices/virtual/block/loop7/stat deleted file mode 100644 index ddf0f2a1f7..0000000000 --- a/test/sys/devices/virtual/block/loop7/stat +++ /dev/null @@ -1 +0,0 @@ - 0 0 0 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/loop7/subsystem b/test/sys/devices/virtual/block/loop7/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/loop7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/loop7/uevent b/test/sys/devices/virtual/block/loop7/uevent deleted file mode 100644 index 7209ef3d6b..0000000000 --- a/test/sys/devices/virtual/block/loop7/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=7 -MINOR=7 -DEVTYPE=disk diff --git a/test/sys/devices/virtual/block/md0/bdi b/test/sys/devices/virtual/block/md0/bdi deleted file mode 120000 index e4fd778bea..0000000000 --- a/test/sys/devices/virtual/block/md0/bdi +++ /dev/null @@ -1 +0,0 @@ -../../bdi/9:0 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/capability b/test/sys/devices/virtual/block/md0/capability deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/block/md0/capability +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/block/md0/dev b/test/sys/devices/virtual/block/md0/dev deleted file mode 100644 index 3dd777e840..0000000000 --- a/test/sys/devices/virtual/block/md0/dev +++ /dev/null @@ -1 +0,0 @@ -9:0 diff --git a/test/sys/devices/virtual/block/md0/make-it-fail b/test/sys/devices/virtual/block/md0/make-it-fail deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/make-it-fail +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/array_state b/test/sys/devices/virtual/block/md0/md/array_state deleted file mode 100644 index 8312630207..0000000000 --- a/test/sys/devices/virtual/block/md0/md/array_state +++ /dev/null @@ -1 +0,0 @@ -clean diff --git a/test/sys/devices/virtual/block/md0/md/chunk_size b/test/sys/devices/virtual/block/md0/md/chunk_size deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/chunk_size +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/component_size b/test/sys/devices/virtual/block/md0/md/component_size deleted file mode 100644 index cad9317825..0000000000 --- a/test/sys/devices/virtual/block/md0/md/component_size +++ /dev/null @@ -1 +0,0 @@ -9767424 diff --git a/test/sys/devices/virtual/block/md0/md/degraded b/test/sys/devices/virtual/block/md0/md/degraded deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/md0/md/degraded +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/block b/test/sys/devices/virtual/block/md0/md/dev-sda9/block deleted file mode 120000 index c633a674f2..0000000000 --- a/test/sys/devices/virtual/block/md0/md/dev-sda9/block +++ /dev/null @@ -1 +0,0 @@ -../../../../../pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/errors b/test/sys/devices/virtual/block/md0/md/dev-sda9/errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/dev-sda9/errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/offset b/test/sys/devices/virtual/block/md0/md/dev-sda9/offset deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/dev-sda9/offset +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/size b/test/sys/devices/virtual/block/md0/md/dev-sda9/size deleted file mode 100644 index 80892c8881..0000000000 --- a/test/sys/devices/virtual/block/md0/md/dev-sda9/size +++ /dev/null @@ -1 +0,0 @@ -23438720 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/slot b/test/sys/devices/virtual/block/md0/md/dev-sda9/slot deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/md0/md/dev-sda9/slot +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/md0/md/dev-sda9/state b/test/sys/devices/virtual/block/md0/md/dev-sda9/state deleted file mode 100644 index 964991008d..0000000000 --- a/test/sys/devices/virtual/block/md0/md/dev-sda9/state +++ /dev/null @@ -1 +0,0 @@ -in_sync diff --git a/test/sys/devices/virtual/block/md0/md/layout b/test/sys/devices/virtual/block/md0/md/layout deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/layout +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/level b/test/sys/devices/virtual/block/md0/md/level deleted file mode 100644 index 341b806e6c..0000000000 --- a/test/sys/devices/virtual/block/md0/md/level +++ /dev/null @@ -1 +0,0 @@ -raid1 diff --git a/test/sys/devices/virtual/block/md0/md/metadata_version b/test/sys/devices/virtual/block/md0/md/metadata_version deleted file mode 100644 index 2c4a1a017f..0000000000 --- a/test/sys/devices/virtual/block/md0/md/metadata_version +++ /dev/null @@ -1 +0,0 @@ -0.90 diff --git a/test/sys/devices/virtual/block/md0/md/mismatch_cnt b/test/sys/devices/virtual/block/md0/md/mismatch_cnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/mismatch_cnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/raid_disks b/test/sys/devices/virtual/block/md0/md/raid_disks deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/devices/virtual/block/md0/md/raid_disks +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/devices/virtual/block/md0/md/rd1 b/test/sys/devices/virtual/block/md0/md/rd1 deleted file mode 120000 index f414d06453..0000000000 --- a/test/sys/devices/virtual/block/md0/md/rd1 +++ /dev/null @@ -1 +0,0 @@ -dev-sda9 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/md/reshape_position b/test/sys/devices/virtual/block/md0/md/reshape_position deleted file mode 100644 index 621e94f0ec..0000000000 --- a/test/sys/devices/virtual/block/md0/md/reshape_position +++ /dev/null @@ -1 +0,0 @@ -none diff --git a/test/sys/devices/virtual/block/md0/md/resync_start b/test/sys/devices/virtual/block/md0/md/resync_start deleted file mode 100644 index 93221a2954..0000000000 --- a/test/sys/devices/virtual/block/md0/md/resync_start +++ /dev/null @@ -1 +0,0 @@ -18446744073709551615 diff --git a/test/sys/devices/virtual/block/md0/md/safe_mode_delay b/test/sys/devices/virtual/block/md0/md/safe_mode_delay deleted file mode 100644 index 4faa381f80..0000000000 --- a/test/sys/devices/virtual/block/md0/md/safe_mode_delay +++ /dev/null @@ -1 +0,0 @@ -0.201 diff --git a/test/sys/devices/virtual/block/md0/md/suspend_hi b/test/sys/devices/virtual/block/md0/md/suspend_hi deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/suspend_hi +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/suspend_lo b/test/sys/devices/virtual/block/md0/md/suspend_lo deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/suspend_lo +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/sync_action b/test/sys/devices/virtual/block/md0/md/sync_action deleted file mode 100644 index 5a5e41c8f4..0000000000 --- a/test/sys/devices/virtual/block/md0/md/sync_action +++ /dev/null @@ -1 +0,0 @@ -idle diff --git a/test/sys/devices/virtual/block/md0/md/sync_completed b/test/sys/devices/virtual/block/md0/md/sync_completed deleted file mode 100644 index cd2858796d..0000000000 --- a/test/sys/devices/virtual/block/md0/md/sync_completed +++ /dev/null @@ -1 +0,0 @@ -0 / 19534848 diff --git a/test/sys/devices/virtual/block/md0/md/sync_force_parallel b/test/sys/devices/virtual/block/md0/md/sync_force_parallel deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/sync_force_parallel +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/sync_max b/test/sys/devices/virtual/block/md0/md/sync_max deleted file mode 100644 index 355295a05a..0000000000 --- a/test/sys/devices/virtual/block/md0/md/sync_max +++ /dev/null @@ -1 +0,0 @@ -max diff --git a/test/sys/devices/virtual/block/md0/md/sync_min b/test/sys/devices/virtual/block/md0/md/sync_min deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/sync_min +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/sync_speed b/test/sys/devices/virtual/block/md0/md/sync_speed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/md/sync_speed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/md/sync_speed_max b/test/sys/devices/virtual/block/md0/md/sync_speed_max deleted file mode 100644 index ba1ff86e53..0000000000 --- a/test/sys/devices/virtual/block/md0/md/sync_speed_max +++ /dev/null @@ -1 +0,0 @@ -200000 (system) diff --git a/test/sys/devices/virtual/block/md0/md/sync_speed_min b/test/sys/devices/virtual/block/md0/md/sync_speed_min deleted file mode 100644 index 406019d218..0000000000 --- a/test/sys/devices/virtual/block/md0/md/sync_speed_min +++ /dev/null @@ -1 +0,0 @@ -1000 (system) diff --git a/test/sys/devices/virtual/block/md0/power/wakeup b/test/sys/devices/virtual/block/md0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/block/md0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/block/md0/range b/test/sys/devices/virtual/block/md0/range deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/block/md0/range +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/block/md0/removable b/test/sys/devices/virtual/block/md0/removable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/removable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/ro b/test/sys/devices/virtual/block/md0/ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/block/md0/ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/block/md0/size b/test/sys/devices/virtual/block/md0/size deleted file mode 100644 index f50f9f358c..0000000000 --- a/test/sys/devices/virtual/block/md0/size +++ /dev/null @@ -1 +0,0 @@ -19534848 diff --git a/test/sys/devices/virtual/block/md0/slaves/sda9 b/test/sys/devices/virtual/block/md0/slaves/sda9 deleted file mode 120000 index ccc05e002b..0000000000 --- a/test/sys/devices/virtual/block/md0/slaves/sda9 +++ /dev/null @@ -1 +0,0 @@ -../../../../pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda9 \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/stat b/test/sys/devices/virtual/block/md0/stat deleted file mode 100644 index 4510288568..0000000000 --- a/test/sys/devices/virtual/block/md0/stat +++ /dev/null @@ -1 +0,0 @@ - 60 0 480 0 0 0 0 0 0 0 0 diff --git a/test/sys/devices/virtual/block/md0/subsystem b/test/sys/devices/virtual/block/md0/subsystem deleted file mode 120000 index b257cfc23c..0000000000 --- a/test/sys/devices/virtual/block/md0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/block \ No newline at end of file diff --git a/test/sys/devices/virtual/block/md0/uevent b/test/sys/devices/virtual/block/md0/uevent deleted file mode 100644 index bed44e5181..0000000000 --- a/test/sys/devices/virtual/block/md0/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=9 -MINOR=0 -DEVTYPE=disk diff --git a/test/sys/devices/virtual/dmi/id/bios_date b/test/sys/devices/virtual/dmi/id/bios_date deleted file mode 100644 index b68141e827..0000000000 --- a/test/sys/devices/virtual/dmi/id/bios_date +++ /dev/null @@ -1 +0,0 @@ -09/19/2007 diff --git a/test/sys/devices/virtual/dmi/id/bios_vendor b/test/sys/devices/virtual/dmi/id/bios_vendor deleted file mode 100644 index 84dae9baf6..0000000000 --- a/test/sys/devices/virtual/dmi/id/bios_vendor +++ /dev/null @@ -1 +0,0 @@ -LENOVO diff --git a/test/sys/devices/virtual/dmi/id/bios_version b/test/sys/devices/virtual/dmi/id/bios_version deleted file mode 100644 index 110327614e..0000000000 --- a/test/sys/devices/virtual/dmi/id/bios_version +++ /dev/null @@ -1 +0,0 @@ -7IET31WW (1.12 ) diff --git a/test/sys/devices/virtual/dmi/id/board_asset_tag b/test/sys/devices/virtual/dmi/id/board_asset_tag deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/dmi/id/board_asset_tag +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/dmi/id/board_name b/test/sys/devices/virtual/dmi/id/board_name deleted file mode 100644 index 7b899b9e32..0000000000 --- a/test/sys/devices/virtual/dmi/id/board_name +++ /dev/null @@ -1 +0,0 @@ -8741C4G diff --git a/test/sys/devices/virtual/dmi/id/board_serial b/test/sys/devices/virtual/dmi/id/board_serial deleted file mode 100644 index 887d672e48..0000000000 --- a/test/sys/devices/virtual/dmi/id/board_serial +++ /dev/null @@ -1 +0,0 @@ -VF0UV72C10X diff --git a/test/sys/devices/virtual/dmi/id/board_vendor b/test/sys/devices/virtual/dmi/id/board_vendor deleted file mode 100644 index 84dae9baf6..0000000000 --- a/test/sys/devices/virtual/dmi/id/board_vendor +++ /dev/null @@ -1 +0,0 @@ -LENOVO diff --git a/test/sys/devices/virtual/dmi/id/board_version b/test/sys/devices/virtual/dmi/id/board_version deleted file mode 100644 index 6d46bf7e2c..0000000000 --- a/test/sys/devices/virtual/dmi/id/board_version +++ /dev/null @@ -1 +0,0 @@ -Not Available diff --git a/test/sys/devices/virtual/dmi/id/chassis_asset_tag b/test/sys/devices/virtual/dmi/id/chassis_asset_tag deleted file mode 100644 index 227547603f..0000000000 --- a/test/sys/devices/virtual/dmi/id/chassis_asset_tag +++ /dev/null @@ -1 +0,0 @@ -No Asset Information diff --git a/test/sys/devices/virtual/dmi/id/chassis_serial b/test/sys/devices/virtual/dmi/id/chassis_serial deleted file mode 100644 index 6d46bf7e2c..0000000000 --- a/test/sys/devices/virtual/dmi/id/chassis_serial +++ /dev/null @@ -1 +0,0 @@ -Not Available diff --git a/test/sys/devices/virtual/dmi/id/chassis_type b/test/sys/devices/virtual/dmi/id/chassis_type deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/dmi/id/chassis_type +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/dmi/id/chassis_vendor b/test/sys/devices/virtual/dmi/id/chassis_vendor deleted file mode 100644 index 84dae9baf6..0000000000 --- a/test/sys/devices/virtual/dmi/id/chassis_vendor +++ /dev/null @@ -1 +0,0 @@ -LENOVO diff --git a/test/sys/devices/virtual/dmi/id/chassis_version b/test/sys/devices/virtual/dmi/id/chassis_version deleted file mode 100644 index 6d46bf7e2c..0000000000 --- a/test/sys/devices/virtual/dmi/id/chassis_version +++ /dev/null @@ -1 +0,0 @@ -Not Available diff --git a/test/sys/devices/virtual/dmi/id/modalias b/test/sys/devices/virtual/dmi/id/modalias deleted file mode 100644 index 4f22922d4a..0000000000 --- a/test/sys/devices/virtual/dmi/id/modalias +++ /dev/null @@ -1 +0,0 @@ -dmi:bvnLENOVO:bvr7IET31WW(1.12):bd09/19/2007:svnLENOVO:pn8741C4G:pvrThinkPadT60p:rvnLENOVO:rn8741C4G:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable: diff --git a/test/sys/devices/virtual/dmi/id/power/wakeup b/test/sys/devices/virtual/dmi/id/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/dmi/id/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/dmi/id/product_name b/test/sys/devices/virtual/dmi/id/product_name deleted file mode 100644 index 7b899b9e32..0000000000 --- a/test/sys/devices/virtual/dmi/id/product_name +++ /dev/null @@ -1 +0,0 @@ -8741C4G diff --git a/test/sys/devices/virtual/dmi/id/product_serial b/test/sys/devices/virtual/dmi/id/product_serial deleted file mode 100644 index ebf0c607cd..0000000000 --- a/test/sys/devices/virtual/dmi/id/product_serial +++ /dev/null @@ -1 +0,0 @@ -L3AK195 diff --git a/test/sys/devices/virtual/dmi/id/product_uuid b/test/sys/devices/virtual/dmi/id/product_uuid deleted file mode 100644 index 4f53ec4329..0000000000 --- a/test/sys/devices/virtual/dmi/id/product_uuid +++ /dev/null @@ -1 +0,0 @@ -82161681-492E-11CB-BCCA-A7FDE26F414B diff --git a/test/sys/devices/virtual/dmi/id/product_version b/test/sys/devices/virtual/dmi/id/product_version deleted file mode 100644 index 6e0471f033..0000000000 --- a/test/sys/devices/virtual/dmi/id/product_version +++ /dev/null @@ -1 +0,0 @@ -ThinkPad T60p diff --git a/test/sys/devices/virtual/dmi/id/subsystem b/test/sys/devices/virtual/dmi/id/subsystem deleted file mode 120000 index 98086270cf..0000000000 --- a/test/sys/devices/virtual/dmi/id/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/dmi \ No newline at end of file diff --git a/test/sys/devices/virtual/dmi/id/sys_vendor b/test/sys/devices/virtual/dmi/id/sys_vendor deleted file mode 100644 index 84dae9baf6..0000000000 --- a/test/sys/devices/virtual/dmi/id/sys_vendor +++ /dev/null @@ -1 +0,0 @@ -LENOVO diff --git a/test/sys/devices/virtual/dmi/id/uevent b/test/sys/devices/virtual/dmi/id/uevent deleted file mode 100644 index d1455ca29e..0000000000 --- a/test/sys/devices/virtual/dmi/id/uevent +++ /dev/null @@ -1 +0,0 @@ -MODALIAS=dmi:bvnLENOVO:bvr7IET31WW(1.12):bd09/19/2007:svnLENOVO:pn8741C4G:pvrThinkPadT60p:rvnLENOVO:rn8741C4G:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable: diff --git a/test/sys/devices/virtual/graphics/fbcon/cursor_blink b/test/sys/devices/virtual/graphics/fbcon/cursor_blink deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/graphics/fbcon/cursor_blink +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/graphics/fbcon/power/wakeup b/test/sys/devices/virtual/graphics/fbcon/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/graphics/fbcon/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/graphics/fbcon/rotate b/test/sys/devices/virtual/graphics/fbcon/rotate deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/graphics/fbcon/rotate +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/graphics/fbcon/subsystem b/test/sys/devices/virtual/graphics/fbcon/subsystem deleted file mode 120000 index 2bb3d7c891..0000000000 --- a/test/sys/devices/virtual/graphics/fbcon/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/graphics \ No newline at end of file diff --git a/test/sys/devices/virtual/graphics/fbcon/uevent b/test/sys/devices/virtual/graphics/fbcon/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/input/input6/capabilities/abs b/test/sys/devices/virtual/input/input6/capabilities/abs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/input/input6/capabilities/abs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/ev b/test/sys/devices/virtual/input/input6/capabilities/ev deleted file mode 100644 index bb95160cb6..0000000000 --- a/test/sys/devices/virtual/input/input6/capabilities/ev +++ /dev/null @@ -1 +0,0 @@ -33 diff --git a/test/sys/devices/virtual/input/input6/capabilities/ff b/test/sys/devices/virtual/input/input6/capabilities/ff deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/input/input6/capabilities/ff +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/key b/test/sys/devices/virtual/input/input6/capabilities/key deleted file mode 100644 index 2dd8e658dd..0000000000 --- a/test/sys/devices/virtual/input/input6/capabilities/key +++ /dev/null @@ -1 +0,0 @@ -18840000 2 10010000000000 0 1101b00002005 1004000 e000000000000 0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/led b/test/sys/devices/virtual/input/input6/capabilities/led deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/input/input6/capabilities/led +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/msc b/test/sys/devices/virtual/input/input6/capabilities/msc deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/input/input6/capabilities/msc +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/input/input6/capabilities/rel b/test/sys/devices/virtual/input/input6/capabilities/rel deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/input/input6/capabilities/rel +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/snd b/test/sys/devices/virtual/input/input6/capabilities/snd deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/input/input6/capabilities/snd +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/input/input6/capabilities/sw b/test/sys/devices/virtual/input/input6/capabilities/sw deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/devices/virtual/input/input6/capabilities/sw +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/devices/virtual/input/input6/event6/dev b/test/sys/devices/virtual/input/input6/event6/dev deleted file mode 100644 index 86cdae4868..0000000000 --- a/test/sys/devices/virtual/input/input6/event6/dev +++ /dev/null @@ -1 +0,0 @@ -13:70 diff --git a/test/sys/devices/virtual/input/input6/event6/device b/test/sys/devices/virtual/input/input6/event6/device deleted file mode 120000 index b2c87d8fd5..0000000000 --- a/test/sys/devices/virtual/input/input6/event6/device +++ /dev/null @@ -1 +0,0 @@ -../../input6 \ No newline at end of file diff --git a/test/sys/devices/virtual/input/input6/event6/power/wakeup b/test/sys/devices/virtual/input/input6/event6/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/input/input6/event6/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/input/input6/event6/subsystem b/test/sys/devices/virtual/input/input6/event6/subsystem deleted file mode 120000 index bd2a91fcf2..0000000000 --- a/test/sys/devices/virtual/input/input6/event6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/virtual/input/input6/event6/uevent b/test/sys/devices/virtual/input/input6/event6/uevent deleted file mode 100644 index 38cfaedb0f..0000000000 --- a/test/sys/devices/virtual/input/input6/event6/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=70 diff --git a/test/sys/devices/virtual/input/input6/id/bustype b/test/sys/devices/virtual/input/input6/id/bustype deleted file mode 100644 index f1993fb3a7..0000000000 --- a/test/sys/devices/virtual/input/input6/id/bustype +++ /dev/null @@ -1 +0,0 @@ -0019 diff --git a/test/sys/devices/virtual/input/input6/id/product b/test/sys/devices/virtual/input/input6/id/product deleted file mode 100644 index d7998ca503..0000000000 --- a/test/sys/devices/virtual/input/input6/id/product +++ /dev/null @@ -1 +0,0 @@ -5054 diff --git a/test/sys/devices/virtual/input/input6/id/vendor b/test/sys/devices/virtual/input/input6/id/vendor deleted file mode 100644 index 1e2f734e4f..0000000000 --- a/test/sys/devices/virtual/input/input6/id/vendor +++ /dev/null @@ -1 +0,0 @@ -17aa diff --git a/test/sys/devices/virtual/input/input6/id/version b/test/sys/devices/virtual/input/input6/id/version deleted file mode 100644 index cb15afe743..0000000000 --- a/test/sys/devices/virtual/input/input6/id/version +++ /dev/null @@ -1 +0,0 @@ -4101 diff --git a/test/sys/devices/virtual/input/input6/modalias b/test/sys/devices/virtual/input/input6/modalias deleted file mode 100644 index 5c0877dd8b..0000000000 --- a/test/sys/devices/virtual/input/input6/modalias +++ /dev/null @@ -1 +0,0 @@ -input:b0019v17AAp5054e4101-e0,1,4,5,k71,72,73,8E,98,C0,C2,CD,E0,E1,E3,E4,EC,F0,168,174,181,1D2,1D7,1DB,1DC,ram4,lsfw3, diff --git a/test/sys/devices/virtual/input/input6/name b/test/sys/devices/virtual/input/input6/name deleted file mode 100644 index 41ab1abca8..0000000000 --- a/test/sys/devices/virtual/input/input6/name +++ /dev/null @@ -1 +0,0 @@ -ThinkPad Extra Buttons diff --git a/test/sys/devices/virtual/input/input6/phys b/test/sys/devices/virtual/input/input6/phys deleted file mode 100644 index a3c6d04da4..0000000000 --- a/test/sys/devices/virtual/input/input6/phys +++ /dev/null @@ -1 +0,0 @@ -thinkpad_acpi/input0 diff --git a/test/sys/devices/virtual/input/input6/power/wakeup b/test/sys/devices/virtual/input/input6/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/input/input6/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/input/input6/subsystem b/test/sys/devices/virtual/input/input6/subsystem deleted file mode 120000 index 2a4af36646..0000000000 --- a/test/sys/devices/virtual/input/input6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/virtual/input/input6/uevent b/test/sys/devices/virtual/input/input6/uevent deleted file mode 100644 index 34ae721d6e..0000000000 --- a/test/sys/devices/virtual/input/input6/uevent +++ /dev/null @@ -1,8 +0,0 @@ -PRODUCT=19/17aa/5054/4101 -NAME="ThinkPad Extra Buttons" -PHYS="thinkpad_acpi/input0" -EV==33 -KEY==18840000 2 10010000000000 0 1101b00002005 1004000 e000000000000 0 -MSC==10 -SW==8 -MODALIAS=input:b0019v17AAp5054e4101-e0,1,4,5,k71,72,73,8E,98,C0,C2,CD,E0,E1,E3,E4,EC,F0,168,174,181,1D2,1D7,1DB,1DC,ram4,lsfw3, diff --git a/test/sys/devices/virtual/input/input6/uniq b/test/sys/devices/virtual/input/input6/uniq deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/input/input6/uniq +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/input/mice/dev b/test/sys/devices/virtual/input/mice/dev deleted file mode 100644 index d9b0b90407..0000000000 --- a/test/sys/devices/virtual/input/mice/dev +++ /dev/null @@ -1 +0,0 @@ -13:63 diff --git a/test/sys/devices/virtual/input/mice/power/wakeup b/test/sys/devices/virtual/input/mice/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/input/mice/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/input/mice/subsystem b/test/sys/devices/virtual/input/mice/subsystem deleted file mode 120000 index 2a4af36646..0000000000 --- a/test/sys/devices/virtual/input/mice/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/input \ No newline at end of file diff --git a/test/sys/devices/virtual/input/mice/uevent b/test/sys/devices/virtual/input/mice/uevent deleted file mode 100644 index 5a754f68a0..0000000000 --- a/test/sys/devices/virtual/input/mice/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=13 -MINOR=63 diff --git a/test/sys/devices/virtual/mem/full/dev b/test/sys/devices/virtual/mem/full/dev deleted file mode 100644 index 4dc588f930..0000000000 --- a/test/sys/devices/virtual/mem/full/dev +++ /dev/null @@ -1 +0,0 @@ -1:7 diff --git a/test/sys/devices/virtual/mem/full/power/wakeup b/test/sys/devices/virtual/mem/full/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/mem/full/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/mem/full/subsystem b/test/sys/devices/virtual/mem/full/subsystem deleted file mode 120000 index 3ac1f53f89..0000000000 --- a/test/sys/devices/virtual/mem/full/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/full/uevent b/test/sys/devices/virtual/mem/full/uevent deleted file mode 100644 index 0f608f0f79..0000000000 --- a/test/sys/devices/virtual/mem/full/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=1 -MINOR=7 diff --git a/test/sys/devices/virtual/mem/kmem/dev b/test/sys/devices/virtual/mem/kmem/dev deleted file mode 100644 index c7bc405e0f..0000000000 --- a/test/sys/devices/virtual/mem/kmem/dev +++ /dev/null @@ -1 +0,0 @@ -1:2 diff --git a/test/sys/devices/virtual/mem/kmem/power/wakeup b/test/sys/devices/virtual/mem/kmem/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/mem/kmem/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/mem/kmem/subsystem b/test/sys/devices/virtual/mem/kmem/subsystem deleted file mode 120000 index 3ac1f53f89..0000000000 --- a/test/sys/devices/virtual/mem/kmem/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/kmem/uevent b/test/sys/devices/virtual/mem/kmem/uevent deleted file mode 100644 index 90ea9b4d77..0000000000 --- a/test/sys/devices/virtual/mem/kmem/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=1 -MINOR=2 diff --git a/test/sys/devices/virtual/mem/kmsg/dev b/test/sys/devices/virtual/mem/kmsg/dev deleted file mode 100644 index 59effa12a9..0000000000 --- a/test/sys/devices/virtual/mem/kmsg/dev +++ /dev/null @@ -1 +0,0 @@ -1:11 diff --git a/test/sys/devices/virtual/mem/kmsg/power/wakeup b/test/sys/devices/virtual/mem/kmsg/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/mem/kmsg/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/mem/kmsg/subsystem b/test/sys/devices/virtual/mem/kmsg/subsystem deleted file mode 120000 index 3ac1f53f89..0000000000 --- a/test/sys/devices/virtual/mem/kmsg/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/kmsg/uevent b/test/sys/devices/virtual/mem/kmsg/uevent deleted file mode 100644 index f9386d0564..0000000000 --- a/test/sys/devices/virtual/mem/kmsg/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=1 -MINOR=11 diff --git a/test/sys/devices/virtual/mem/mem/dev b/test/sys/devices/virtual/mem/mem/dev deleted file mode 100644 index a72b75e75e..0000000000 --- a/test/sys/devices/virtual/mem/mem/dev +++ /dev/null @@ -1 +0,0 @@ -1:1 diff --git a/test/sys/devices/virtual/mem/mem/power/wakeup b/test/sys/devices/virtual/mem/mem/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/mem/mem/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/mem/mem/subsystem b/test/sys/devices/virtual/mem/mem/subsystem deleted file mode 120000 index 3ac1f53f89..0000000000 --- a/test/sys/devices/virtual/mem/mem/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/mem/uevent b/test/sys/devices/virtual/mem/mem/uevent deleted file mode 100644 index c755b90645..0000000000 --- a/test/sys/devices/virtual/mem/mem/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=1 -MINOR=1 diff --git a/test/sys/devices/virtual/mem/null/dev b/test/sys/devices/virtual/mem/null/dev deleted file mode 100644 index d9812edfef..0000000000 --- a/test/sys/devices/virtual/mem/null/dev +++ /dev/null @@ -1 +0,0 @@ -1:3 diff --git a/test/sys/devices/virtual/mem/null/power/wakeup b/test/sys/devices/virtual/mem/null/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/mem/null/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/mem/null/subsystem b/test/sys/devices/virtual/mem/null/subsystem deleted file mode 120000 index 3ac1f53f89..0000000000 --- a/test/sys/devices/virtual/mem/null/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/null/uevent b/test/sys/devices/virtual/mem/null/uevent deleted file mode 100644 index a26957d9fe..0000000000 --- a/test/sys/devices/virtual/mem/null/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=1 -MINOR=3 diff --git a/test/sys/devices/virtual/mem/port/dev b/test/sys/devices/virtual/mem/port/dev deleted file mode 100644 index ab11afd2ec..0000000000 --- a/test/sys/devices/virtual/mem/port/dev +++ /dev/null @@ -1 +0,0 @@ -1:4 diff --git a/test/sys/devices/virtual/mem/port/power/wakeup b/test/sys/devices/virtual/mem/port/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/mem/port/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/mem/port/subsystem b/test/sys/devices/virtual/mem/port/subsystem deleted file mode 120000 index 3ac1f53f89..0000000000 --- a/test/sys/devices/virtual/mem/port/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/port/uevent b/test/sys/devices/virtual/mem/port/uevent deleted file mode 100644 index a3655e8547..0000000000 --- a/test/sys/devices/virtual/mem/port/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=1 -MINOR=4 diff --git a/test/sys/devices/virtual/mem/random/dev b/test/sys/devices/virtual/mem/random/dev deleted file mode 100644 index 2b7b905849..0000000000 --- a/test/sys/devices/virtual/mem/random/dev +++ /dev/null @@ -1 +0,0 @@ -1:8 diff --git a/test/sys/devices/virtual/mem/random/power/wakeup b/test/sys/devices/virtual/mem/random/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/mem/random/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/mem/random/subsystem b/test/sys/devices/virtual/mem/random/subsystem deleted file mode 120000 index 3ac1f53f89..0000000000 --- a/test/sys/devices/virtual/mem/random/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/random/uevent b/test/sys/devices/virtual/mem/random/uevent deleted file mode 100644 index c63f2f3794..0000000000 --- a/test/sys/devices/virtual/mem/random/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=1 -MINOR=8 diff --git a/test/sys/devices/virtual/mem/urandom/dev b/test/sys/devices/virtual/mem/urandom/dev deleted file mode 100644 index 0695af03c5..0000000000 --- a/test/sys/devices/virtual/mem/urandom/dev +++ /dev/null @@ -1 +0,0 @@ -1:9 diff --git a/test/sys/devices/virtual/mem/urandom/power/wakeup b/test/sys/devices/virtual/mem/urandom/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/mem/urandom/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/mem/urandom/subsystem b/test/sys/devices/virtual/mem/urandom/subsystem deleted file mode 120000 index 3ac1f53f89..0000000000 --- a/test/sys/devices/virtual/mem/urandom/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/urandom/uevent b/test/sys/devices/virtual/mem/urandom/uevent deleted file mode 100644 index fb5b500e9d..0000000000 --- a/test/sys/devices/virtual/mem/urandom/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=1 -MINOR=9 diff --git a/test/sys/devices/virtual/mem/zero/dev b/test/sys/devices/virtual/mem/zero/dev deleted file mode 100644 index 0acbea55a4..0000000000 --- a/test/sys/devices/virtual/mem/zero/dev +++ /dev/null @@ -1 +0,0 @@ -1:5 diff --git a/test/sys/devices/virtual/mem/zero/power/wakeup b/test/sys/devices/virtual/mem/zero/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/mem/zero/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/mem/zero/subsystem b/test/sys/devices/virtual/mem/zero/subsystem deleted file mode 120000 index 3ac1f53f89..0000000000 --- a/test/sys/devices/virtual/mem/zero/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/mem \ No newline at end of file diff --git a/test/sys/devices/virtual/mem/zero/uevent b/test/sys/devices/virtual/mem/zero/uevent deleted file mode 100644 index 868763b207..0000000000 --- a/test/sys/devices/virtual/mem/zero/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=1 -MINOR=5 diff --git a/test/sys/devices/virtual/misc/cpu_dma_latency/dev b/test/sys/devices/virtual/misc/cpu_dma_latency/dev deleted file mode 100644 index 28837209ce..0000000000 --- a/test/sys/devices/virtual/misc/cpu_dma_latency/dev +++ /dev/null @@ -1 +0,0 @@ -10:63 diff --git a/test/sys/devices/virtual/misc/cpu_dma_latency/power/wakeup b/test/sys/devices/virtual/misc/cpu_dma_latency/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/cpu_dma_latency/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/cpu_dma_latency/subsystem b/test/sys/devices/virtual/misc/cpu_dma_latency/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/cpu_dma_latency/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/cpu_dma_latency/uevent b/test/sys/devices/virtual/misc/cpu_dma_latency/uevent deleted file mode 100644 index 4bdadb6f50..0000000000 --- a/test/sys/devices/virtual/misc/cpu_dma_latency/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=63 diff --git a/test/sys/devices/virtual/misc/device-mapper/dev b/test/sys/devices/virtual/misc/device-mapper/dev deleted file mode 100644 index 0ec44eadb5..0000000000 --- a/test/sys/devices/virtual/misc/device-mapper/dev +++ /dev/null @@ -1 +0,0 @@ -10:60 diff --git a/test/sys/devices/virtual/misc/device-mapper/power/wakeup b/test/sys/devices/virtual/misc/device-mapper/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/device-mapper/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/device-mapper/subsystem b/test/sys/devices/virtual/misc/device-mapper/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/device-mapper/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/device-mapper/uevent b/test/sys/devices/virtual/misc/device-mapper/uevent deleted file mode 100644 index 8ed41d736f..0000000000 --- a/test/sys/devices/virtual/misc/device-mapper/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=60 diff --git a/test/sys/devices/virtual/misc/fuse/dev b/test/sys/devices/virtual/misc/fuse/dev deleted file mode 100644 index 79f0a7cccf..0000000000 --- a/test/sys/devices/virtual/misc/fuse/dev +++ /dev/null @@ -1 +0,0 @@ -10:229 diff --git a/test/sys/devices/virtual/misc/fuse/power/wakeup b/test/sys/devices/virtual/misc/fuse/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/fuse/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/fuse/subsystem b/test/sys/devices/virtual/misc/fuse/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/fuse/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/fuse/uevent b/test/sys/devices/virtual/misc/fuse/uevent deleted file mode 100644 index 68746cf6f2..0000000000 --- a/test/sys/devices/virtual/misc/fuse/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=229 diff --git a/test/sys/devices/virtual/misc/hpet/dev b/test/sys/devices/virtual/misc/hpet/dev deleted file mode 100644 index daa7cef902..0000000000 --- a/test/sys/devices/virtual/misc/hpet/dev +++ /dev/null @@ -1 +0,0 @@ -10:228 diff --git a/test/sys/devices/virtual/misc/hpet/power/wakeup b/test/sys/devices/virtual/misc/hpet/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/hpet/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/hpet/subsystem b/test/sys/devices/virtual/misc/hpet/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/hpet/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/hpet/uevent b/test/sys/devices/virtual/misc/hpet/uevent deleted file mode 100644 index f5d709e4b2..0000000000 --- a/test/sys/devices/virtual/misc/hpet/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=228 diff --git a/test/sys/devices/virtual/misc/mcelog/dev b/test/sys/devices/virtual/misc/mcelog/dev deleted file mode 100644 index 103ebda577..0000000000 --- a/test/sys/devices/virtual/misc/mcelog/dev +++ /dev/null @@ -1 +0,0 @@ -10:227 diff --git a/test/sys/devices/virtual/misc/mcelog/power/wakeup b/test/sys/devices/virtual/misc/mcelog/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/mcelog/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/mcelog/subsystem b/test/sys/devices/virtual/misc/mcelog/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/mcelog/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/mcelog/uevent b/test/sys/devices/virtual/misc/mcelog/uevent deleted file mode 100644 index 572ef2a6b2..0000000000 --- a/test/sys/devices/virtual/misc/mcelog/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=227 diff --git a/test/sys/devices/virtual/misc/microcode/dev b/test/sys/devices/virtual/misc/microcode/dev deleted file mode 100644 index ece87cd3f8..0000000000 --- a/test/sys/devices/virtual/misc/microcode/dev +++ /dev/null @@ -1 +0,0 @@ -10:184 diff --git a/test/sys/devices/virtual/misc/microcode/power/wakeup b/test/sys/devices/virtual/misc/microcode/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/microcode/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/microcode/subsystem b/test/sys/devices/virtual/misc/microcode/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/microcode/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/microcode/uevent b/test/sys/devices/virtual/misc/microcode/uevent deleted file mode 100644 index 6ef0dc9892..0000000000 --- a/test/sys/devices/virtual/misc/microcode/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=184 diff --git a/test/sys/devices/virtual/misc/misc-fake1/dev b/test/sys/devices/virtual/misc/misc-fake1/dev deleted file mode 100644 index ab453138aa..0000000000 --- a/test/sys/devices/virtual/misc/misc-fake1/dev +++ /dev/null @@ -1 +0,0 @@ -4095:1 diff --git a/test/sys/devices/virtual/misc/misc-fake1/power/wakeup b/test/sys/devices/virtual/misc/misc-fake1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/misc-fake1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/misc-fake1/subsystem b/test/sys/devices/virtual/misc/misc-fake1/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/misc-fake1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/misc-fake1/uevent b/test/sys/devices/virtual/misc/misc-fake1/uevent deleted file mode 100644 index 67faa81eb2..0000000000 --- a/test/sys/devices/virtual/misc/misc-fake1/uevent +++ /dev/null @@ -1,4 +0,0 @@ -MAJOR=4095 -MINOR=1 -DEVNAME=misc-fake1 - diff --git a/test/sys/devices/virtual/misc/misc-fake89999/dev b/test/sys/devices/virtual/misc/misc-fake89999/dev deleted file mode 100644 index a3793f5e66..0000000000 --- a/test/sys/devices/virtual/misc/misc-fake89999/dev +++ /dev/null @@ -1 +0,0 @@ -4095:89999 diff --git a/test/sys/devices/virtual/misc/misc-fake89999/power/wakeup b/test/sys/devices/virtual/misc/misc-fake89999/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/misc-fake89999/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/misc-fake89999/subsystem b/test/sys/devices/virtual/misc/misc-fake89999/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/misc-fake89999/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/misc-fake89999/uevent b/test/sys/devices/virtual/misc/misc-fake89999/uevent deleted file mode 100644 index 53bb34ad99..0000000000 --- a/test/sys/devices/virtual/misc/misc-fake89999/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=4095 -MINOR=89999 -DEVNAME=misc-fake89999 diff --git a/test/sys/devices/virtual/misc/network_latency/dev b/test/sys/devices/virtual/misc/network_latency/dev deleted file mode 100644 index e0d47a5fd0..0000000000 --- a/test/sys/devices/virtual/misc/network_latency/dev +++ /dev/null @@ -1 +0,0 @@ -10:62 diff --git a/test/sys/devices/virtual/misc/network_latency/power/wakeup b/test/sys/devices/virtual/misc/network_latency/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/network_latency/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/network_latency/subsystem b/test/sys/devices/virtual/misc/network_latency/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/network_latency/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/network_latency/uevent b/test/sys/devices/virtual/misc/network_latency/uevent deleted file mode 100644 index 418594295c..0000000000 --- a/test/sys/devices/virtual/misc/network_latency/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=62 diff --git a/test/sys/devices/virtual/misc/network_throughput/dev b/test/sys/devices/virtual/misc/network_throughput/dev deleted file mode 100644 index e201e40e50..0000000000 --- a/test/sys/devices/virtual/misc/network_throughput/dev +++ /dev/null @@ -1 +0,0 @@ -10:61 diff --git a/test/sys/devices/virtual/misc/network_throughput/power/wakeup b/test/sys/devices/virtual/misc/network_throughput/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/network_throughput/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/network_throughput/subsystem b/test/sys/devices/virtual/misc/network_throughput/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/network_throughput/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/network_throughput/uevent b/test/sys/devices/virtual/misc/network_throughput/uevent deleted file mode 100644 index 6749edd437..0000000000 --- a/test/sys/devices/virtual/misc/network_throughput/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=61 diff --git a/test/sys/devices/virtual/misc/nvram/dev b/test/sys/devices/virtual/misc/nvram/dev deleted file mode 100644 index e147110645..0000000000 --- a/test/sys/devices/virtual/misc/nvram/dev +++ /dev/null @@ -1 +0,0 @@ -10:144 diff --git a/test/sys/devices/virtual/misc/nvram/power/wakeup b/test/sys/devices/virtual/misc/nvram/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/nvram/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/nvram/subsystem b/test/sys/devices/virtual/misc/nvram/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/nvram/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/nvram/uevent b/test/sys/devices/virtual/misc/nvram/uevent deleted file mode 100644 index 28a0aa22b8..0000000000 --- a/test/sys/devices/virtual/misc/nvram/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=144 diff --git a/test/sys/devices/virtual/misc/psaux/dev b/test/sys/devices/virtual/misc/psaux/dev deleted file mode 100644 index 48ace1eca2..0000000000 --- a/test/sys/devices/virtual/misc/psaux/dev +++ /dev/null @@ -1 +0,0 @@ -10:1 diff --git a/test/sys/devices/virtual/misc/psaux/power/wakeup b/test/sys/devices/virtual/misc/psaux/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/psaux/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/psaux/subsystem b/test/sys/devices/virtual/misc/psaux/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/psaux/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/psaux/uevent b/test/sys/devices/virtual/misc/psaux/uevent deleted file mode 100644 index c4ee0650db..0000000000 --- a/test/sys/devices/virtual/misc/psaux/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=1 diff --git a/test/sys/devices/virtual/misc/uinput/dev b/test/sys/devices/virtual/misc/uinput/dev deleted file mode 100644 index a47be0d551..0000000000 --- a/test/sys/devices/virtual/misc/uinput/dev +++ /dev/null @@ -1 +0,0 @@ -10:223 diff --git a/test/sys/devices/virtual/misc/uinput/power/wakeup b/test/sys/devices/virtual/misc/uinput/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/misc/uinput/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/misc/uinput/subsystem b/test/sys/devices/virtual/misc/uinput/subsystem deleted file mode 120000 index 168949151e..0000000000 --- a/test/sys/devices/virtual/misc/uinput/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/misc \ No newline at end of file diff --git a/test/sys/devices/virtual/misc/uinput/uevent b/test/sys/devices/virtual/misc/uinput/uevent deleted file mode 100644 index 4dd780577d..0000000000 --- a/test/sys/devices/virtual/misc/uinput/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=10 -MINOR=223 diff --git a/test/sys/devices/virtual/net/lo/addr_len b/test/sys/devices/virtual/net/lo/addr_len deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/devices/virtual/net/lo/addr_len +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/devices/virtual/net/lo/address b/test/sys/devices/virtual/net/lo/address deleted file mode 100644 index 34e09d077c..0000000000 --- a/test/sys/devices/virtual/net/lo/address +++ /dev/null @@ -1 +0,0 @@ -00:00:00:00:00:00 diff --git a/test/sys/devices/virtual/net/lo/broadcast b/test/sys/devices/virtual/net/lo/broadcast deleted file mode 100644 index 34e09d077c..0000000000 --- a/test/sys/devices/virtual/net/lo/broadcast +++ /dev/null @@ -1 +0,0 @@ -00:00:00:00:00:00 diff --git a/test/sys/devices/virtual/net/lo/carrier b/test/sys/devices/virtual/net/lo/carrier deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/net/lo/carrier +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/net/lo/dev_id b/test/sys/devices/virtual/net/lo/dev_id deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/devices/virtual/net/lo/dev_id +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/devices/virtual/net/lo/dormant b/test/sys/devices/virtual/net/lo/dormant deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/dormant +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/features b/test/sys/devices/virtual/net/lo/features deleted file mode 100644 index dd1bd2f4c0..0000000000 --- a/test/sys/devices/virtual/net/lo/features +++ /dev/null @@ -1 +0,0 @@ -0x13865 diff --git a/test/sys/devices/virtual/net/lo/flags b/test/sys/devices/virtual/net/lo/flags deleted file mode 100644 index 4bc4da19ae..0000000000 --- a/test/sys/devices/virtual/net/lo/flags +++ /dev/null @@ -1 +0,0 @@ -0x9 diff --git a/test/sys/devices/virtual/net/lo/ifindex b/test/sys/devices/virtual/net/lo/ifindex deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/net/lo/ifindex +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/net/lo/iflink b/test/sys/devices/virtual/net/lo/iflink deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/net/lo/iflink +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/net/lo/link_mode b/test/sys/devices/virtual/net/lo/link_mode deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/link_mode +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/mtu b/test/sys/devices/virtual/net/lo/mtu deleted file mode 100644 index e20e16cfe8..0000000000 --- a/test/sys/devices/virtual/net/lo/mtu +++ /dev/null @@ -1 +0,0 @@ -16436 diff --git a/test/sys/devices/virtual/net/lo/operstate b/test/sys/devices/virtual/net/lo/operstate deleted file mode 100644 index 3546645658..0000000000 --- a/test/sys/devices/virtual/net/lo/operstate +++ /dev/null @@ -1 +0,0 @@ -unknown diff --git a/test/sys/devices/virtual/net/lo/power/wakeup b/test/sys/devices/virtual/net/lo/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/net/lo/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/net/lo/statistics/collisions b/test/sys/devices/virtual/net/lo/statistics/collisions deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/collisions +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/multicast b/test/sys/devices/virtual/net/lo/statistics/multicast deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/multicast +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_bytes b/test/sys/devices/virtual/net/lo/statistics/rx_bytes deleted file mode 100644 index 058db39b75..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_bytes +++ /dev/null @@ -1 +0,0 @@ -3380 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_compressed b/test/sys/devices/virtual/net/lo/statistics/rx_compressed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_compressed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_crc_errors b/test/sys/devices/virtual/net/lo/statistics/rx_crc_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_crc_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_dropped b/test/sys/devices/virtual/net/lo/statistics/rx_dropped deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_dropped +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_errors b/test/sys/devices/virtual/net/lo/statistics/rx_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_fifo_errors b/test/sys/devices/virtual/net/lo/statistics/rx_fifo_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_fifo_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_frame_errors b/test/sys/devices/virtual/net/lo/statistics/rx_frame_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_frame_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_length_errors b/test/sys/devices/virtual/net/lo/statistics/rx_length_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_length_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_missed_errors b/test/sys/devices/virtual/net/lo/statistics/rx_missed_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_missed_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_over_errors b/test/sys/devices/virtual/net/lo/statistics/rx_over_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_over_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/rx_packets b/test/sys/devices/virtual/net/lo/statistics/rx_packets deleted file mode 100644 index 9e5feb5256..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/rx_packets +++ /dev/null @@ -1 +0,0 @@ -46 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_aborted_errors b/test/sys/devices/virtual/net/lo/statistics/tx_aborted_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_aborted_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_bytes b/test/sys/devices/virtual/net/lo/statistics/tx_bytes deleted file mode 100644 index 058db39b75..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_bytes +++ /dev/null @@ -1 +0,0 @@ -3380 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_carrier_errors b/test/sys/devices/virtual/net/lo/statistics/tx_carrier_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_carrier_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_compressed b/test/sys/devices/virtual/net/lo/statistics/tx_compressed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_compressed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_dropped b/test/sys/devices/virtual/net/lo/statistics/tx_dropped deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_dropped +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_errors b/test/sys/devices/virtual/net/lo/statistics/tx_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_fifo_errors b/test/sys/devices/virtual/net/lo/statistics/tx_fifo_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_fifo_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_heartbeat_errors b/test/sys/devices/virtual/net/lo/statistics/tx_heartbeat_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_heartbeat_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_packets b/test/sys/devices/virtual/net/lo/statistics/tx_packets deleted file mode 100644 index 9e5feb5256..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_packets +++ /dev/null @@ -1 +0,0 @@ -46 diff --git a/test/sys/devices/virtual/net/lo/statistics/tx_window_errors b/test/sys/devices/virtual/net/lo/statistics/tx_window_errors deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/statistics/tx_window_errors +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/subsystem b/test/sys/devices/virtual/net/lo/subsystem deleted file mode 120000 index 508114fb7f..0000000000 --- a/test/sys/devices/virtual/net/lo/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/net \ No newline at end of file diff --git a/test/sys/devices/virtual/net/lo/tx_queue_len b/test/sys/devices/virtual/net/lo/tx_queue_len deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/net/lo/tx_queue_len +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/net/lo/type b/test/sys/devices/virtual/net/lo/type deleted file mode 100644 index 6d629c4a23..0000000000 --- a/test/sys/devices/virtual/net/lo/type +++ /dev/null @@ -1 +0,0 @@ -772 diff --git a/test/sys/devices/virtual/net/lo/uevent b/test/sys/devices/virtual/net/lo/uevent deleted file mode 100644 index 58110228a7..0000000000 --- a/test/sys/devices/virtual/net/lo/uevent +++ /dev/null @@ -1,2 +0,0 @@ -INTERFACE=lo -IFINDEX=1 diff --git a/test/sys/devices/virtual/sound/seq/dev b/test/sys/devices/virtual/sound/seq/dev deleted file mode 100644 index 1a0d1fd1f2..0000000000 --- a/test/sys/devices/virtual/sound/seq/dev +++ /dev/null @@ -1 +0,0 @@ -116:1 diff --git a/test/sys/devices/virtual/sound/seq/power/wakeup b/test/sys/devices/virtual/sound/seq/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/sound/seq/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/sound/seq/subsystem b/test/sys/devices/virtual/sound/seq/subsystem deleted file mode 120000 index 19f824e8c4..0000000000 --- a/test/sys/devices/virtual/sound/seq/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/virtual/sound/seq/uevent b/test/sys/devices/virtual/sound/seq/uevent deleted file mode 100644 index 25e7c9dee1..0000000000 --- a/test/sys/devices/virtual/sound/seq/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=116 -MINOR=1 diff --git a/test/sys/devices/virtual/sound/timer/dev b/test/sys/devices/virtual/sound/timer/dev deleted file mode 100644 index 2929a66732..0000000000 --- a/test/sys/devices/virtual/sound/timer/dev +++ /dev/null @@ -1 +0,0 @@ -116:33 diff --git a/test/sys/devices/virtual/sound/timer/power/wakeup b/test/sys/devices/virtual/sound/timer/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/sound/timer/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/sound/timer/subsystem b/test/sys/devices/virtual/sound/timer/subsystem deleted file mode 120000 index 19f824e8c4..0000000000 --- a/test/sys/devices/virtual/sound/timer/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/sound \ No newline at end of file diff --git a/test/sys/devices/virtual/sound/timer/uevent b/test/sys/devices/virtual/sound/timer/uevent deleted file mode 100644 index fc65cb6c5c..0000000000 --- a/test/sys/devices/virtual/sound/timer/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=116 -MINOR=33 diff --git a/test/sys/devices/virtual/thermal/cooling_device0/cur_state b/test/sys/devices/virtual/thermal/cooling_device0/cur_state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device0/cur_state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/thermal/cooling_device0/device b/test/sys/devices/virtual/thermal/cooling_device0/device deleted file mode 120000 index 782af8da65..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device0/device +++ /dev/null @@ -1 +0,0 @@ -../../../LNXSYSTM:00/ACPI0007:00 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/cooling_device0/max_state b/test/sys/devices/virtual/thermal/cooling_device0/max_state deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device0/max_state +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/thermal/cooling_device0/power/wakeup b/test/sys/devices/virtual/thermal/cooling_device0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/thermal/cooling_device0/subsystem b/test/sys/devices/virtual/thermal/cooling_device0/subsystem deleted file mode 120000 index 511bf4b518..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/thermal \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/cooling_device0/type b/test/sys/devices/virtual/thermal/cooling_device0/type deleted file mode 100644 index eb921429ef..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device0/type +++ /dev/null @@ -1 +0,0 @@ -Processor diff --git a/test/sys/devices/virtual/thermal/cooling_device0/uevent b/test/sys/devices/virtual/thermal/cooling_device0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/thermal/cooling_device1/cur_state b/test/sys/devices/virtual/thermal/cooling_device1/cur_state deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device1/cur_state +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/thermal/cooling_device1/device b/test/sys/devices/virtual/thermal/cooling_device1/device deleted file mode 120000 index d1ea213f83..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device1/device +++ /dev/null @@ -1 +0,0 @@ -../../../LNXSYSTM:00/ACPI0007:01 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/cooling_device1/max_state b/test/sys/devices/virtual/thermal/cooling_device1/max_state deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device1/max_state +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/devices/virtual/thermal/cooling_device1/power/wakeup b/test/sys/devices/virtual/thermal/cooling_device1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/thermal/cooling_device1/subsystem b/test/sys/devices/virtual/thermal/cooling_device1/subsystem deleted file mode 120000 index 511bf4b518..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/thermal \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/cooling_device1/type b/test/sys/devices/virtual/thermal/cooling_device1/type deleted file mode 100644 index eb921429ef..0000000000 --- a/test/sys/devices/virtual/thermal/cooling_device1/type +++ /dev/null @@ -1 +0,0 @@ -Processor diff --git a/test/sys/devices/virtual/thermal/cooling_device1/uevent b/test/sys/devices/virtual/thermal/cooling_device1/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/device b/test/sys/devices/virtual/thermal/thermal_zone0/device deleted file mode 120000 index 0370bc60ad..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone0/device +++ /dev/null @@ -1 +0,0 @@ -../../../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:01 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/mode b/test/sys/devices/virtual/thermal/thermal_zone0/mode deleted file mode 100644 index 533e957ce2..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone0/mode +++ /dev/null @@ -1 +0,0 @@ -kernel diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/power/wakeup b/test/sys/devices/virtual/thermal/thermal_zone0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/subsystem b/test/sys/devices/virtual/thermal/thermal_zone0/subsystem deleted file mode 120000 index 511bf4b518..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/thermal \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/temp b/test/sys/devices/virtual/thermal/thermal_zone0/temp deleted file mode 100644 index 44ecd33b16..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone0/temp +++ /dev/null @@ -1 +0,0 @@ -46000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp b/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp deleted file mode 100644 index e854d41596..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_temp +++ /dev/null @@ -1 +0,0 @@ -127000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_type b/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_type deleted file mode 100644 index 886e5fa6f8..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone0/trip_point_0_type +++ /dev/null @@ -1 +0,0 @@ -critical diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/type b/test/sys/devices/virtual/thermal/thermal_zone0/type deleted file mode 100644 index a29f406ca9..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone0/type +++ /dev/null @@ -1 +0,0 @@ -acpitz diff --git a/test/sys/devices/virtual/thermal/thermal_zone0/uevent b/test/sys/devices/virtual/thermal/thermal_zone0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/cdev0 b/test/sys/devices/virtual/thermal/thermal_zone1/cdev0 deleted file mode 120000 index 511cd963f8..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/cdev0 +++ /dev/null @@ -1 +0,0 @@ -../cooling_device1 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/cdev0_trip_point b/test/sys/devices/virtual/thermal/thermal_zone1/cdev0_trip_point deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/cdev0_trip_point +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/cdev1 b/test/sys/devices/virtual/thermal/thermal_zone1/cdev1 deleted file mode 120000 index 576329385e..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/cdev1 +++ /dev/null @@ -1 +0,0 @@ -../cooling_device0 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/cdev1_trip_point b/test/sys/devices/virtual/thermal/thermal_zone1/cdev1_trip_point deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/cdev1_trip_point +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/device b/test/sys/devices/virtual/thermal/thermal_zone1/device deleted file mode 120000 index 2bc4755205..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/device +++ /dev/null @@ -1 +0,0 @@ -../../../LNXSYSTM:00/LNXTHERM:00/LNXTHERM:02 \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/mode b/test/sys/devices/virtual/thermal/thermal_zone1/mode deleted file mode 100644 index 533e957ce2..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/mode +++ /dev/null @@ -1 +0,0 @@ -kernel diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/power/wakeup b/test/sys/devices/virtual/thermal/thermal_zone1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/subsystem b/test/sys/devices/virtual/thermal/thermal_zone1/subsystem deleted file mode 120000 index 511bf4b518..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/thermal \ No newline at end of file diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/temp b/test/sys/devices/virtual/thermal/thermal_zone1/temp deleted file mode 100644 index e50754ae09..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/temp +++ /dev/null @@ -1 +0,0 @@ -47000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp deleted file mode 100644 index f7393e847d..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_temp +++ /dev/null @@ -1 +0,0 @@ -100000 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_type b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_type deleted file mode 100644 index 886e5fa6f8..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_0_type +++ /dev/null @@ -1 +0,0 @@ -critical diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_temp b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_temp deleted file mode 100644 index 6e7b04525a..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_temp +++ /dev/null @@ -1 +0,0 @@ -95500 diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_type b/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_type deleted file mode 100644 index 321b98e05d..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/trip_point_1_type +++ /dev/null @@ -1 +0,0 @@ -passive diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/type b/test/sys/devices/virtual/thermal/thermal_zone1/type deleted file mode 100644 index a29f406ca9..0000000000 --- a/test/sys/devices/virtual/thermal/thermal_zone1/type +++ /dev/null @@ -1 +0,0 @@ -acpitz diff --git a/test/sys/devices/virtual/thermal/thermal_zone1/uevent b/test/sys/devices/virtual/thermal/thermal_zone1/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/tty/console/dev b/test/sys/devices/virtual/tty/console/dev deleted file mode 100644 index 99eb99cd27..0000000000 --- a/test/sys/devices/virtual/tty/console/dev +++ /dev/null @@ -1 +0,0 @@ -5:1 diff --git a/test/sys/devices/virtual/tty/console/power/wakeup b/test/sys/devices/virtual/tty/console/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/console/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/console/subsystem b/test/sys/devices/virtual/tty/console/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/console/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/console/uevent b/test/sys/devices/virtual/tty/console/uevent deleted file mode 100644 index 71aad75b12..0000000000 --- a/test/sys/devices/virtual/tty/console/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=5 -MINOR=1 -DEVNAME=console diff --git a/test/sys/devices/virtual/tty/ptmx/dev b/test/sys/devices/virtual/tty/ptmx/dev deleted file mode 100644 index b1df63ebd3..0000000000 --- a/test/sys/devices/virtual/tty/ptmx/dev +++ /dev/null @@ -1 +0,0 @@ -5:2 diff --git a/test/sys/devices/virtual/tty/ptmx/power/wakeup b/test/sys/devices/virtual/tty/ptmx/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/ptmx/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/ptmx/subsystem b/test/sys/devices/virtual/tty/ptmx/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/ptmx/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/ptmx/uevent b/test/sys/devices/virtual/tty/ptmx/uevent deleted file mode 100644 index 9002cdd00a..0000000000 --- a/test/sys/devices/virtual/tty/ptmx/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=5 -MINOR=2 diff --git a/test/sys/devices/virtual/tty/tty/dev b/test/sys/devices/virtual/tty/tty/dev deleted file mode 100644 index 97f5a222f0..0000000000 --- a/test/sys/devices/virtual/tty/tty/dev +++ /dev/null @@ -1 +0,0 @@ -5:0 diff --git a/test/sys/devices/virtual/tty/tty/power/wakeup b/test/sys/devices/virtual/tty/tty/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty/subsystem b/test/sys/devices/virtual/tty/tty/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty/uevent b/test/sys/devices/virtual/tty/tty/uevent deleted file mode 100644 index 5526a77b78..0000000000 --- a/test/sys/devices/virtual/tty/tty/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=5 -MINOR=0 diff --git a/test/sys/devices/virtual/tty/tty0/dev b/test/sys/devices/virtual/tty/tty0/dev deleted file mode 100644 index 192d8b739c..0000000000 --- a/test/sys/devices/virtual/tty/tty0/dev +++ /dev/null @@ -1 +0,0 @@ -4:0 diff --git a/test/sys/devices/virtual/tty/tty0/power/wakeup b/test/sys/devices/virtual/tty/tty0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty0/subsystem b/test/sys/devices/virtual/tty/tty0/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty0/uevent b/test/sys/devices/virtual/tty/tty0/uevent deleted file mode 100644 index f338919a3b..0000000000 --- a/test/sys/devices/virtual/tty/tty0/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=4 -MINOR=0 -DEVNAME=tty0 diff --git a/test/sys/devices/virtual/tty/tty1/dev b/test/sys/devices/virtual/tty/tty1/dev deleted file mode 100644 index 71275a262f..0000000000 --- a/test/sys/devices/virtual/tty/tty1/dev +++ /dev/null @@ -1 +0,0 @@ -4:1 diff --git a/test/sys/devices/virtual/tty/tty1/power/wakeup b/test/sys/devices/virtual/tty/tty1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty1/subsystem b/test/sys/devices/virtual/tty/tty1/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty1/uevent b/test/sys/devices/virtual/tty/tty1/uevent deleted file mode 100644 index 3a2de38445..0000000000 --- a/test/sys/devices/virtual/tty/tty1/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=1 diff --git a/test/sys/devices/virtual/tty/tty10/dev b/test/sys/devices/virtual/tty/tty10/dev deleted file mode 100644 index eb477d040f..0000000000 --- a/test/sys/devices/virtual/tty/tty10/dev +++ /dev/null @@ -1 +0,0 @@ -4:10 diff --git a/test/sys/devices/virtual/tty/tty10/power/wakeup b/test/sys/devices/virtual/tty/tty10/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty10/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty10/subsystem b/test/sys/devices/virtual/tty/tty10/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty10/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty10/uevent b/test/sys/devices/virtual/tty/tty10/uevent deleted file mode 100644 index 0c29d5afd6..0000000000 --- a/test/sys/devices/virtual/tty/tty10/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=10 diff --git a/test/sys/devices/virtual/tty/tty11/dev b/test/sys/devices/virtual/tty/tty11/dev deleted file mode 100644 index 685b194273..0000000000 --- a/test/sys/devices/virtual/tty/tty11/dev +++ /dev/null @@ -1 +0,0 @@ -4:11 diff --git a/test/sys/devices/virtual/tty/tty11/power/wakeup b/test/sys/devices/virtual/tty/tty11/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty11/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty11/subsystem b/test/sys/devices/virtual/tty/tty11/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty11/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty11/uevent b/test/sys/devices/virtual/tty/tty11/uevent deleted file mode 100644 index dbc9d32554..0000000000 --- a/test/sys/devices/virtual/tty/tty11/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=11 diff --git a/test/sys/devices/virtual/tty/tty12/dev b/test/sys/devices/virtual/tty/tty12/dev deleted file mode 100644 index 47b68a96a5..0000000000 --- a/test/sys/devices/virtual/tty/tty12/dev +++ /dev/null @@ -1 +0,0 @@ -4:12 diff --git a/test/sys/devices/virtual/tty/tty12/power/wakeup b/test/sys/devices/virtual/tty/tty12/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty12/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty12/subsystem b/test/sys/devices/virtual/tty/tty12/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty12/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty12/uevent b/test/sys/devices/virtual/tty/tty12/uevent deleted file mode 100644 index 6da3cd31cc..0000000000 --- a/test/sys/devices/virtual/tty/tty12/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=12 diff --git a/test/sys/devices/virtual/tty/tty13/dev b/test/sys/devices/virtual/tty/tty13/dev deleted file mode 100644 index 86e31456d2..0000000000 --- a/test/sys/devices/virtual/tty/tty13/dev +++ /dev/null @@ -1 +0,0 @@ -4:13 diff --git a/test/sys/devices/virtual/tty/tty13/power/wakeup b/test/sys/devices/virtual/tty/tty13/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty13/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty13/subsystem b/test/sys/devices/virtual/tty/tty13/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty13/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty13/uevent b/test/sys/devices/virtual/tty/tty13/uevent deleted file mode 100644 index 3a8adc0a90..0000000000 --- a/test/sys/devices/virtual/tty/tty13/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=13 diff --git a/test/sys/devices/virtual/tty/tty14/dev b/test/sys/devices/virtual/tty/tty14/dev deleted file mode 100644 index 9fa8103ff8..0000000000 --- a/test/sys/devices/virtual/tty/tty14/dev +++ /dev/null @@ -1 +0,0 @@ -4:14 diff --git a/test/sys/devices/virtual/tty/tty14/power/wakeup b/test/sys/devices/virtual/tty/tty14/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty14/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty14/subsystem b/test/sys/devices/virtual/tty/tty14/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty14/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty14/uevent b/test/sys/devices/virtual/tty/tty14/uevent deleted file mode 100644 index 722fa4af3d..0000000000 --- a/test/sys/devices/virtual/tty/tty14/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=14 diff --git a/test/sys/devices/virtual/tty/tty15/dev b/test/sys/devices/virtual/tty/tty15/dev deleted file mode 100644 index 3f601b851f..0000000000 --- a/test/sys/devices/virtual/tty/tty15/dev +++ /dev/null @@ -1 +0,0 @@ -4:15 diff --git a/test/sys/devices/virtual/tty/tty15/power/wakeup b/test/sys/devices/virtual/tty/tty15/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty15/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty15/subsystem b/test/sys/devices/virtual/tty/tty15/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty15/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty15/uevent b/test/sys/devices/virtual/tty/tty15/uevent deleted file mode 100644 index f570be0c70..0000000000 --- a/test/sys/devices/virtual/tty/tty15/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=15 diff --git a/test/sys/devices/virtual/tty/tty16/dev b/test/sys/devices/virtual/tty/tty16/dev deleted file mode 100644 index 0310e8064a..0000000000 --- a/test/sys/devices/virtual/tty/tty16/dev +++ /dev/null @@ -1 +0,0 @@ -4:16 diff --git a/test/sys/devices/virtual/tty/tty16/power/wakeup b/test/sys/devices/virtual/tty/tty16/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty16/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty16/subsystem b/test/sys/devices/virtual/tty/tty16/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty16/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty16/uevent b/test/sys/devices/virtual/tty/tty16/uevent deleted file mode 100644 index 469ec57ad4..0000000000 --- a/test/sys/devices/virtual/tty/tty16/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=16 diff --git a/test/sys/devices/virtual/tty/tty17/dev b/test/sys/devices/virtual/tty/tty17/dev deleted file mode 100644 index 19360464d0..0000000000 --- a/test/sys/devices/virtual/tty/tty17/dev +++ /dev/null @@ -1 +0,0 @@ -4:17 diff --git a/test/sys/devices/virtual/tty/tty17/power/wakeup b/test/sys/devices/virtual/tty/tty17/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty17/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty17/subsystem b/test/sys/devices/virtual/tty/tty17/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty17/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty17/uevent b/test/sys/devices/virtual/tty/tty17/uevent deleted file mode 100644 index 7e3d979e13..0000000000 --- a/test/sys/devices/virtual/tty/tty17/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=17 diff --git a/test/sys/devices/virtual/tty/tty18/dev b/test/sys/devices/virtual/tty/tty18/dev deleted file mode 100644 index 8710c48f12..0000000000 --- a/test/sys/devices/virtual/tty/tty18/dev +++ /dev/null @@ -1 +0,0 @@ -4:18 diff --git a/test/sys/devices/virtual/tty/tty18/power/wakeup b/test/sys/devices/virtual/tty/tty18/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty18/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty18/subsystem b/test/sys/devices/virtual/tty/tty18/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty18/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty18/uevent b/test/sys/devices/virtual/tty/tty18/uevent deleted file mode 100644 index 9001e97ccf..0000000000 --- a/test/sys/devices/virtual/tty/tty18/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=18 diff --git a/test/sys/devices/virtual/tty/tty19/dev b/test/sys/devices/virtual/tty/tty19/dev deleted file mode 100644 index 5fac93ed2f..0000000000 --- a/test/sys/devices/virtual/tty/tty19/dev +++ /dev/null @@ -1 +0,0 @@ -4:19 diff --git a/test/sys/devices/virtual/tty/tty19/power/wakeup b/test/sys/devices/virtual/tty/tty19/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty19/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty19/subsystem b/test/sys/devices/virtual/tty/tty19/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty19/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty19/uevent b/test/sys/devices/virtual/tty/tty19/uevent deleted file mode 100644 index 7a7dd2dc75..0000000000 --- a/test/sys/devices/virtual/tty/tty19/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=19 diff --git a/test/sys/devices/virtual/tty/tty2/dev b/test/sys/devices/virtual/tty/tty2/dev deleted file mode 100644 index ac0836d7ca..0000000000 --- a/test/sys/devices/virtual/tty/tty2/dev +++ /dev/null @@ -1 +0,0 @@ -4:2 diff --git a/test/sys/devices/virtual/tty/tty2/power/wakeup b/test/sys/devices/virtual/tty/tty2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty2/subsystem b/test/sys/devices/virtual/tty/tty2/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty2/uevent b/test/sys/devices/virtual/tty/tty2/uevent deleted file mode 100644 index 08d1b80de4..0000000000 --- a/test/sys/devices/virtual/tty/tty2/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=2 diff --git a/test/sys/devices/virtual/tty/tty20/dev b/test/sys/devices/virtual/tty/tty20/dev deleted file mode 100644 index 3db4a84c87..0000000000 --- a/test/sys/devices/virtual/tty/tty20/dev +++ /dev/null @@ -1 +0,0 @@ -4:20 diff --git a/test/sys/devices/virtual/tty/tty20/power/wakeup b/test/sys/devices/virtual/tty/tty20/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty20/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty20/subsystem b/test/sys/devices/virtual/tty/tty20/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty20/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty20/uevent b/test/sys/devices/virtual/tty/tty20/uevent deleted file mode 100644 index e32651b73c..0000000000 --- a/test/sys/devices/virtual/tty/tty20/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=20 diff --git a/test/sys/devices/virtual/tty/tty21/dev b/test/sys/devices/virtual/tty/tty21/dev deleted file mode 100644 index f86a02508c..0000000000 --- a/test/sys/devices/virtual/tty/tty21/dev +++ /dev/null @@ -1 +0,0 @@ -4:21 diff --git a/test/sys/devices/virtual/tty/tty21/power/wakeup b/test/sys/devices/virtual/tty/tty21/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty21/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty21/subsystem b/test/sys/devices/virtual/tty/tty21/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty21/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty21/uevent b/test/sys/devices/virtual/tty/tty21/uevent deleted file mode 100644 index 836852c354..0000000000 --- a/test/sys/devices/virtual/tty/tty21/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=21 diff --git a/test/sys/devices/virtual/tty/tty22/dev b/test/sys/devices/virtual/tty/tty22/dev deleted file mode 100644 index b27a240d1a..0000000000 --- a/test/sys/devices/virtual/tty/tty22/dev +++ /dev/null @@ -1 +0,0 @@ -4:22 diff --git a/test/sys/devices/virtual/tty/tty22/power/wakeup b/test/sys/devices/virtual/tty/tty22/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty22/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty22/subsystem b/test/sys/devices/virtual/tty/tty22/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty22/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty22/uevent b/test/sys/devices/virtual/tty/tty22/uevent deleted file mode 100644 index 649c903592..0000000000 --- a/test/sys/devices/virtual/tty/tty22/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=22 diff --git a/test/sys/devices/virtual/tty/tty23/dev b/test/sys/devices/virtual/tty/tty23/dev deleted file mode 100644 index 9359bfa71d..0000000000 --- a/test/sys/devices/virtual/tty/tty23/dev +++ /dev/null @@ -1 +0,0 @@ -4:23 diff --git a/test/sys/devices/virtual/tty/tty23/power/wakeup b/test/sys/devices/virtual/tty/tty23/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty23/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty23/subsystem b/test/sys/devices/virtual/tty/tty23/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty23/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty23/uevent b/test/sys/devices/virtual/tty/tty23/uevent deleted file mode 100644 index 73d66798ab..0000000000 --- a/test/sys/devices/virtual/tty/tty23/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=23 diff --git a/test/sys/devices/virtual/tty/tty24/dev b/test/sys/devices/virtual/tty/tty24/dev deleted file mode 100644 index 9cd85c8a81..0000000000 --- a/test/sys/devices/virtual/tty/tty24/dev +++ /dev/null @@ -1 +0,0 @@ -4:24 diff --git a/test/sys/devices/virtual/tty/tty24/power/wakeup b/test/sys/devices/virtual/tty/tty24/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty24/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty24/subsystem b/test/sys/devices/virtual/tty/tty24/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty24/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty24/uevent b/test/sys/devices/virtual/tty/tty24/uevent deleted file mode 100644 index 31396c49b5..0000000000 --- a/test/sys/devices/virtual/tty/tty24/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=24 diff --git a/test/sys/devices/virtual/tty/tty25/dev b/test/sys/devices/virtual/tty/tty25/dev deleted file mode 100644 index f9d8c9c059..0000000000 --- a/test/sys/devices/virtual/tty/tty25/dev +++ /dev/null @@ -1 +0,0 @@ -4:25 diff --git a/test/sys/devices/virtual/tty/tty25/power/wakeup b/test/sys/devices/virtual/tty/tty25/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty25/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty25/subsystem b/test/sys/devices/virtual/tty/tty25/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty25/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty25/uevent b/test/sys/devices/virtual/tty/tty25/uevent deleted file mode 100644 index db34acbde3..0000000000 --- a/test/sys/devices/virtual/tty/tty25/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=25 diff --git a/test/sys/devices/virtual/tty/tty26/dev b/test/sys/devices/virtual/tty/tty26/dev deleted file mode 100644 index 210b637b97..0000000000 --- a/test/sys/devices/virtual/tty/tty26/dev +++ /dev/null @@ -1 +0,0 @@ -4:26 diff --git a/test/sys/devices/virtual/tty/tty26/power/wakeup b/test/sys/devices/virtual/tty/tty26/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty26/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty26/subsystem b/test/sys/devices/virtual/tty/tty26/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty26/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty26/uevent b/test/sys/devices/virtual/tty/tty26/uevent deleted file mode 100644 index 5f47d0ebf9..0000000000 --- a/test/sys/devices/virtual/tty/tty26/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=26 diff --git a/test/sys/devices/virtual/tty/tty27/dev b/test/sys/devices/virtual/tty/tty27/dev deleted file mode 100644 index de59b627a5..0000000000 --- a/test/sys/devices/virtual/tty/tty27/dev +++ /dev/null @@ -1 +0,0 @@ -4:27 diff --git a/test/sys/devices/virtual/tty/tty27/power/wakeup b/test/sys/devices/virtual/tty/tty27/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty27/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty27/subsystem b/test/sys/devices/virtual/tty/tty27/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty27/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty27/uevent b/test/sys/devices/virtual/tty/tty27/uevent deleted file mode 100644 index e0062ad951..0000000000 --- a/test/sys/devices/virtual/tty/tty27/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=27 diff --git a/test/sys/devices/virtual/tty/tty28/dev b/test/sys/devices/virtual/tty/tty28/dev deleted file mode 100644 index 023871c676..0000000000 --- a/test/sys/devices/virtual/tty/tty28/dev +++ /dev/null @@ -1 +0,0 @@ -4:28 diff --git a/test/sys/devices/virtual/tty/tty28/power/wakeup b/test/sys/devices/virtual/tty/tty28/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty28/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty28/subsystem b/test/sys/devices/virtual/tty/tty28/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty28/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty28/uevent b/test/sys/devices/virtual/tty/tty28/uevent deleted file mode 100644 index 6d8b15f412..0000000000 --- a/test/sys/devices/virtual/tty/tty28/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=28 diff --git a/test/sys/devices/virtual/tty/tty29/dev b/test/sys/devices/virtual/tty/tty29/dev deleted file mode 100644 index 2edd7c58af..0000000000 --- a/test/sys/devices/virtual/tty/tty29/dev +++ /dev/null @@ -1 +0,0 @@ -4:29 diff --git a/test/sys/devices/virtual/tty/tty29/power/wakeup b/test/sys/devices/virtual/tty/tty29/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty29/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty29/subsystem b/test/sys/devices/virtual/tty/tty29/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty29/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty29/uevent b/test/sys/devices/virtual/tty/tty29/uevent deleted file mode 100644 index 8da0dd3458..0000000000 --- a/test/sys/devices/virtual/tty/tty29/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=29 diff --git a/test/sys/devices/virtual/tty/tty3/dev b/test/sys/devices/virtual/tty/tty3/dev deleted file mode 100644 index c8142884a4..0000000000 --- a/test/sys/devices/virtual/tty/tty3/dev +++ /dev/null @@ -1 +0,0 @@ -4:3 diff --git a/test/sys/devices/virtual/tty/tty3/power/wakeup b/test/sys/devices/virtual/tty/tty3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty3/subsystem b/test/sys/devices/virtual/tty/tty3/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty3/uevent b/test/sys/devices/virtual/tty/tty3/uevent deleted file mode 100644 index e8bc1486d7..0000000000 --- a/test/sys/devices/virtual/tty/tty3/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=3 diff --git a/test/sys/devices/virtual/tty/tty30/dev b/test/sys/devices/virtual/tty/tty30/dev deleted file mode 100644 index 63f0e669b8..0000000000 --- a/test/sys/devices/virtual/tty/tty30/dev +++ /dev/null @@ -1 +0,0 @@ -4:30 diff --git a/test/sys/devices/virtual/tty/tty30/power/wakeup b/test/sys/devices/virtual/tty/tty30/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty30/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty30/subsystem b/test/sys/devices/virtual/tty/tty30/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty30/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty30/uevent b/test/sys/devices/virtual/tty/tty30/uevent deleted file mode 100644 index 8131cc03e0..0000000000 --- a/test/sys/devices/virtual/tty/tty30/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=30 diff --git a/test/sys/devices/virtual/tty/tty31/dev b/test/sys/devices/virtual/tty/tty31/dev deleted file mode 100644 index 77a50eeff5..0000000000 --- a/test/sys/devices/virtual/tty/tty31/dev +++ /dev/null @@ -1 +0,0 @@ -4:31 diff --git a/test/sys/devices/virtual/tty/tty31/power/wakeup b/test/sys/devices/virtual/tty/tty31/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty31/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty31/subsystem b/test/sys/devices/virtual/tty/tty31/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty31/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty31/uevent b/test/sys/devices/virtual/tty/tty31/uevent deleted file mode 100644 index 9f31a6cd0a..0000000000 --- a/test/sys/devices/virtual/tty/tty31/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=31 diff --git a/test/sys/devices/virtual/tty/tty32/dev b/test/sys/devices/virtual/tty/tty32/dev deleted file mode 100644 index ae38a8dcd7..0000000000 --- a/test/sys/devices/virtual/tty/tty32/dev +++ /dev/null @@ -1 +0,0 @@ -4:32 diff --git a/test/sys/devices/virtual/tty/tty32/power/wakeup b/test/sys/devices/virtual/tty/tty32/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty32/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty32/subsystem b/test/sys/devices/virtual/tty/tty32/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty32/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty32/uevent b/test/sys/devices/virtual/tty/tty32/uevent deleted file mode 100644 index 954f7a034b..0000000000 --- a/test/sys/devices/virtual/tty/tty32/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=32 diff --git a/test/sys/devices/virtual/tty/tty33/dev b/test/sys/devices/virtual/tty/tty33/dev deleted file mode 100644 index 9307b44cd0..0000000000 --- a/test/sys/devices/virtual/tty/tty33/dev +++ /dev/null @@ -1 +0,0 @@ -4:33 diff --git a/test/sys/devices/virtual/tty/tty33/power/wakeup b/test/sys/devices/virtual/tty/tty33/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty33/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty33/subsystem b/test/sys/devices/virtual/tty/tty33/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty33/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty33/uevent b/test/sys/devices/virtual/tty/tty33/uevent deleted file mode 100644 index 737826b96b..0000000000 --- a/test/sys/devices/virtual/tty/tty33/uevent +++ /dev/null @@ -1,3 +0,0 @@ -MAJOR=4 -MINOR=33 -DEVNAME=tty33 diff --git a/test/sys/devices/virtual/tty/tty34/dev b/test/sys/devices/virtual/tty/tty34/dev deleted file mode 100644 index be00cbe67c..0000000000 --- a/test/sys/devices/virtual/tty/tty34/dev +++ /dev/null @@ -1 +0,0 @@ -4:34 diff --git a/test/sys/devices/virtual/tty/tty34/power/wakeup b/test/sys/devices/virtual/tty/tty34/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty34/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty34/subsystem b/test/sys/devices/virtual/tty/tty34/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty34/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty34/uevent b/test/sys/devices/virtual/tty/tty34/uevent deleted file mode 100644 index a15e8abd22..0000000000 --- a/test/sys/devices/virtual/tty/tty34/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=34 diff --git a/test/sys/devices/virtual/tty/tty35/dev b/test/sys/devices/virtual/tty/tty35/dev deleted file mode 100644 index 4e5e85cb70..0000000000 --- a/test/sys/devices/virtual/tty/tty35/dev +++ /dev/null @@ -1 +0,0 @@ -4:35 diff --git a/test/sys/devices/virtual/tty/tty35/power/wakeup b/test/sys/devices/virtual/tty/tty35/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty35/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty35/subsystem b/test/sys/devices/virtual/tty/tty35/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty35/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty35/uevent b/test/sys/devices/virtual/tty/tty35/uevent deleted file mode 100644 index 9d18da0a08..0000000000 --- a/test/sys/devices/virtual/tty/tty35/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=35 diff --git a/test/sys/devices/virtual/tty/tty36/dev b/test/sys/devices/virtual/tty/tty36/dev deleted file mode 100644 index 4e5407ef59..0000000000 --- a/test/sys/devices/virtual/tty/tty36/dev +++ /dev/null @@ -1 +0,0 @@ -4:36 diff --git a/test/sys/devices/virtual/tty/tty36/power/wakeup b/test/sys/devices/virtual/tty/tty36/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty36/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty36/subsystem b/test/sys/devices/virtual/tty/tty36/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty36/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty36/uevent b/test/sys/devices/virtual/tty/tty36/uevent deleted file mode 100644 index 12b0fdc0af..0000000000 --- a/test/sys/devices/virtual/tty/tty36/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=36 diff --git a/test/sys/devices/virtual/tty/tty37/dev b/test/sys/devices/virtual/tty/tty37/dev deleted file mode 100644 index 765acf2d2c..0000000000 --- a/test/sys/devices/virtual/tty/tty37/dev +++ /dev/null @@ -1 +0,0 @@ -4:37 diff --git a/test/sys/devices/virtual/tty/tty37/power/wakeup b/test/sys/devices/virtual/tty/tty37/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty37/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty37/subsystem b/test/sys/devices/virtual/tty/tty37/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty37/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty37/uevent b/test/sys/devices/virtual/tty/tty37/uevent deleted file mode 100644 index 46766f60f1..0000000000 --- a/test/sys/devices/virtual/tty/tty37/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=37 diff --git a/test/sys/devices/virtual/tty/tty38/dev b/test/sys/devices/virtual/tty/tty38/dev deleted file mode 100644 index 1532b15793..0000000000 --- a/test/sys/devices/virtual/tty/tty38/dev +++ /dev/null @@ -1 +0,0 @@ -4:38 diff --git a/test/sys/devices/virtual/tty/tty38/power/wakeup b/test/sys/devices/virtual/tty/tty38/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty38/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty38/subsystem b/test/sys/devices/virtual/tty/tty38/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty38/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty38/uevent b/test/sys/devices/virtual/tty/tty38/uevent deleted file mode 100644 index 385022c777..0000000000 --- a/test/sys/devices/virtual/tty/tty38/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=38 diff --git a/test/sys/devices/virtual/tty/tty39/dev b/test/sys/devices/virtual/tty/tty39/dev deleted file mode 100644 index fac383d3df..0000000000 --- a/test/sys/devices/virtual/tty/tty39/dev +++ /dev/null @@ -1 +0,0 @@ -4:39 diff --git a/test/sys/devices/virtual/tty/tty39/power/wakeup b/test/sys/devices/virtual/tty/tty39/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty39/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty39/subsystem b/test/sys/devices/virtual/tty/tty39/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty39/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty39/uevent b/test/sys/devices/virtual/tty/tty39/uevent deleted file mode 100644 index d96a89c4cd..0000000000 --- a/test/sys/devices/virtual/tty/tty39/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=39 diff --git a/test/sys/devices/virtual/tty/tty4/dev b/test/sys/devices/virtual/tty/tty4/dev deleted file mode 100644 index 7f407b5d25..0000000000 --- a/test/sys/devices/virtual/tty/tty4/dev +++ /dev/null @@ -1 +0,0 @@ -4:4 diff --git a/test/sys/devices/virtual/tty/tty4/power/wakeup b/test/sys/devices/virtual/tty/tty4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty4/subsystem b/test/sys/devices/virtual/tty/tty4/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty4/uevent b/test/sys/devices/virtual/tty/tty4/uevent deleted file mode 100644 index 150ecd0369..0000000000 --- a/test/sys/devices/virtual/tty/tty4/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=4 diff --git a/test/sys/devices/virtual/tty/tty40/dev b/test/sys/devices/virtual/tty/tty40/dev deleted file mode 100644 index d7246138ac..0000000000 --- a/test/sys/devices/virtual/tty/tty40/dev +++ /dev/null @@ -1 +0,0 @@ -4:40 diff --git a/test/sys/devices/virtual/tty/tty40/power/wakeup b/test/sys/devices/virtual/tty/tty40/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty40/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty40/subsystem b/test/sys/devices/virtual/tty/tty40/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty40/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty40/uevent b/test/sys/devices/virtual/tty/tty40/uevent deleted file mode 100644 index 1527f923c4..0000000000 --- a/test/sys/devices/virtual/tty/tty40/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=40 diff --git a/test/sys/devices/virtual/tty/tty41/dev b/test/sys/devices/virtual/tty/tty41/dev deleted file mode 100644 index 0d974303d5..0000000000 --- a/test/sys/devices/virtual/tty/tty41/dev +++ /dev/null @@ -1 +0,0 @@ -4:41 diff --git a/test/sys/devices/virtual/tty/tty41/power/wakeup b/test/sys/devices/virtual/tty/tty41/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty41/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty41/subsystem b/test/sys/devices/virtual/tty/tty41/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty41/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty41/uevent b/test/sys/devices/virtual/tty/tty41/uevent deleted file mode 100644 index 8e3df11fed..0000000000 --- a/test/sys/devices/virtual/tty/tty41/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=41 diff --git a/test/sys/devices/virtual/tty/tty42/dev b/test/sys/devices/virtual/tty/tty42/dev deleted file mode 100644 index 4019d23bfa..0000000000 --- a/test/sys/devices/virtual/tty/tty42/dev +++ /dev/null @@ -1 +0,0 @@ -4:42 diff --git a/test/sys/devices/virtual/tty/tty42/power/wakeup b/test/sys/devices/virtual/tty/tty42/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty42/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty42/subsystem b/test/sys/devices/virtual/tty/tty42/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty42/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty42/uevent b/test/sys/devices/virtual/tty/tty42/uevent deleted file mode 100644 index c4ad0ae5ec..0000000000 --- a/test/sys/devices/virtual/tty/tty42/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=42 diff --git a/test/sys/devices/virtual/tty/tty43/dev b/test/sys/devices/virtual/tty/tty43/dev deleted file mode 100644 index 4b6c086540..0000000000 --- a/test/sys/devices/virtual/tty/tty43/dev +++ /dev/null @@ -1 +0,0 @@ -4:43 diff --git a/test/sys/devices/virtual/tty/tty43/power/wakeup b/test/sys/devices/virtual/tty/tty43/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty43/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty43/subsystem b/test/sys/devices/virtual/tty/tty43/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty43/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty43/uevent b/test/sys/devices/virtual/tty/tty43/uevent deleted file mode 100644 index d64b5a090b..0000000000 --- a/test/sys/devices/virtual/tty/tty43/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=43 diff --git a/test/sys/devices/virtual/tty/tty44/dev b/test/sys/devices/virtual/tty/tty44/dev deleted file mode 100644 index 9c2357463f..0000000000 --- a/test/sys/devices/virtual/tty/tty44/dev +++ /dev/null @@ -1 +0,0 @@ -4:44 diff --git a/test/sys/devices/virtual/tty/tty44/power/wakeup b/test/sys/devices/virtual/tty/tty44/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty44/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty44/subsystem b/test/sys/devices/virtual/tty/tty44/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty44/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty44/uevent b/test/sys/devices/virtual/tty/tty44/uevent deleted file mode 100644 index 3c9416a93d..0000000000 --- a/test/sys/devices/virtual/tty/tty44/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=44 diff --git a/test/sys/devices/virtual/tty/tty45/dev b/test/sys/devices/virtual/tty/tty45/dev deleted file mode 100644 index 23437be177..0000000000 --- a/test/sys/devices/virtual/tty/tty45/dev +++ /dev/null @@ -1 +0,0 @@ -4:45 diff --git a/test/sys/devices/virtual/tty/tty45/power/wakeup b/test/sys/devices/virtual/tty/tty45/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty45/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty45/subsystem b/test/sys/devices/virtual/tty/tty45/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty45/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty45/uevent b/test/sys/devices/virtual/tty/tty45/uevent deleted file mode 100644 index 39c83be491..0000000000 --- a/test/sys/devices/virtual/tty/tty45/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=45 diff --git a/test/sys/devices/virtual/tty/tty46/dev b/test/sys/devices/virtual/tty/tty46/dev deleted file mode 100644 index 816feaf47d..0000000000 --- a/test/sys/devices/virtual/tty/tty46/dev +++ /dev/null @@ -1 +0,0 @@ -4:46 diff --git a/test/sys/devices/virtual/tty/tty46/power/wakeup b/test/sys/devices/virtual/tty/tty46/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty46/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty46/subsystem b/test/sys/devices/virtual/tty/tty46/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty46/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty46/uevent b/test/sys/devices/virtual/tty/tty46/uevent deleted file mode 100644 index 9b9b311c3c..0000000000 --- a/test/sys/devices/virtual/tty/tty46/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=46 diff --git a/test/sys/devices/virtual/tty/tty47/dev b/test/sys/devices/virtual/tty/tty47/dev deleted file mode 100644 index d2534e707d..0000000000 --- a/test/sys/devices/virtual/tty/tty47/dev +++ /dev/null @@ -1 +0,0 @@ -4:47 diff --git a/test/sys/devices/virtual/tty/tty47/power/wakeup b/test/sys/devices/virtual/tty/tty47/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty47/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty47/subsystem b/test/sys/devices/virtual/tty/tty47/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty47/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty47/uevent b/test/sys/devices/virtual/tty/tty47/uevent deleted file mode 100644 index ad6f1bb57d..0000000000 --- a/test/sys/devices/virtual/tty/tty47/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=47 diff --git a/test/sys/devices/virtual/tty/tty48/dev b/test/sys/devices/virtual/tty/tty48/dev deleted file mode 100644 index 4003c709df..0000000000 --- a/test/sys/devices/virtual/tty/tty48/dev +++ /dev/null @@ -1 +0,0 @@ -4:48 diff --git a/test/sys/devices/virtual/tty/tty48/power/wakeup b/test/sys/devices/virtual/tty/tty48/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty48/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty48/subsystem b/test/sys/devices/virtual/tty/tty48/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty48/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty48/uevent b/test/sys/devices/virtual/tty/tty48/uevent deleted file mode 100644 index 5a0ca32bed..0000000000 --- a/test/sys/devices/virtual/tty/tty48/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=48 diff --git a/test/sys/devices/virtual/tty/tty49/dev b/test/sys/devices/virtual/tty/tty49/dev deleted file mode 100644 index 64dc806057..0000000000 --- a/test/sys/devices/virtual/tty/tty49/dev +++ /dev/null @@ -1 +0,0 @@ -4:49 diff --git a/test/sys/devices/virtual/tty/tty49/power/wakeup b/test/sys/devices/virtual/tty/tty49/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty49/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty49/subsystem b/test/sys/devices/virtual/tty/tty49/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty49/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty49/uevent b/test/sys/devices/virtual/tty/tty49/uevent deleted file mode 100644 index fd4db4cc3b..0000000000 --- a/test/sys/devices/virtual/tty/tty49/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=49 diff --git a/test/sys/devices/virtual/tty/tty5/dev b/test/sys/devices/virtual/tty/tty5/dev deleted file mode 100644 index 1553222302..0000000000 --- a/test/sys/devices/virtual/tty/tty5/dev +++ /dev/null @@ -1 +0,0 @@ -4:5 diff --git a/test/sys/devices/virtual/tty/tty5/power/wakeup b/test/sys/devices/virtual/tty/tty5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty5/subsystem b/test/sys/devices/virtual/tty/tty5/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty5/uevent b/test/sys/devices/virtual/tty/tty5/uevent deleted file mode 100644 index 0bed287e73..0000000000 --- a/test/sys/devices/virtual/tty/tty5/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=5 diff --git a/test/sys/devices/virtual/tty/tty50/dev b/test/sys/devices/virtual/tty/tty50/dev deleted file mode 100644 index 71e681bc39..0000000000 --- a/test/sys/devices/virtual/tty/tty50/dev +++ /dev/null @@ -1 +0,0 @@ -4:50 diff --git a/test/sys/devices/virtual/tty/tty50/power/wakeup b/test/sys/devices/virtual/tty/tty50/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty50/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty50/subsystem b/test/sys/devices/virtual/tty/tty50/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty50/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty50/uevent b/test/sys/devices/virtual/tty/tty50/uevent deleted file mode 100644 index 1d8161d40f..0000000000 --- a/test/sys/devices/virtual/tty/tty50/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=50 diff --git a/test/sys/devices/virtual/tty/tty51/dev b/test/sys/devices/virtual/tty/tty51/dev deleted file mode 100644 index 1f8c4b6976..0000000000 --- a/test/sys/devices/virtual/tty/tty51/dev +++ /dev/null @@ -1 +0,0 @@ -4:51 diff --git a/test/sys/devices/virtual/tty/tty51/power/wakeup b/test/sys/devices/virtual/tty/tty51/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty51/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty51/subsystem b/test/sys/devices/virtual/tty/tty51/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty51/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty51/uevent b/test/sys/devices/virtual/tty/tty51/uevent deleted file mode 100644 index ca119adabb..0000000000 --- a/test/sys/devices/virtual/tty/tty51/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=51 diff --git a/test/sys/devices/virtual/tty/tty52/dev b/test/sys/devices/virtual/tty/tty52/dev deleted file mode 100644 index 344e8c93f9..0000000000 --- a/test/sys/devices/virtual/tty/tty52/dev +++ /dev/null @@ -1 +0,0 @@ -4:52 diff --git a/test/sys/devices/virtual/tty/tty52/power/wakeup b/test/sys/devices/virtual/tty/tty52/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty52/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty52/subsystem b/test/sys/devices/virtual/tty/tty52/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty52/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty52/uevent b/test/sys/devices/virtual/tty/tty52/uevent deleted file mode 100644 index 193dad2077..0000000000 --- a/test/sys/devices/virtual/tty/tty52/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=52 diff --git a/test/sys/devices/virtual/tty/tty53/dev b/test/sys/devices/virtual/tty/tty53/dev deleted file mode 100644 index c4b80fb134..0000000000 --- a/test/sys/devices/virtual/tty/tty53/dev +++ /dev/null @@ -1 +0,0 @@ -4:53 diff --git a/test/sys/devices/virtual/tty/tty53/power/wakeup b/test/sys/devices/virtual/tty/tty53/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty53/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty53/subsystem b/test/sys/devices/virtual/tty/tty53/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty53/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty53/uevent b/test/sys/devices/virtual/tty/tty53/uevent deleted file mode 100644 index 4501e57d32..0000000000 --- a/test/sys/devices/virtual/tty/tty53/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=53 diff --git a/test/sys/devices/virtual/tty/tty54/dev b/test/sys/devices/virtual/tty/tty54/dev deleted file mode 100644 index ba56c5e44c..0000000000 --- a/test/sys/devices/virtual/tty/tty54/dev +++ /dev/null @@ -1 +0,0 @@ -4:54 diff --git a/test/sys/devices/virtual/tty/tty54/power/wakeup b/test/sys/devices/virtual/tty/tty54/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty54/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty54/subsystem b/test/sys/devices/virtual/tty/tty54/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty54/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty54/uevent b/test/sys/devices/virtual/tty/tty54/uevent deleted file mode 100644 index d6db7eb38a..0000000000 --- a/test/sys/devices/virtual/tty/tty54/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=54 diff --git a/test/sys/devices/virtual/tty/tty55/dev b/test/sys/devices/virtual/tty/tty55/dev deleted file mode 100644 index 540bf11253..0000000000 --- a/test/sys/devices/virtual/tty/tty55/dev +++ /dev/null @@ -1 +0,0 @@ -4:55 diff --git a/test/sys/devices/virtual/tty/tty55/power/wakeup b/test/sys/devices/virtual/tty/tty55/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty55/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty55/subsystem b/test/sys/devices/virtual/tty/tty55/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty55/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty55/uevent b/test/sys/devices/virtual/tty/tty55/uevent deleted file mode 100644 index f718194915..0000000000 --- a/test/sys/devices/virtual/tty/tty55/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=55 diff --git a/test/sys/devices/virtual/tty/tty56/dev b/test/sys/devices/virtual/tty/tty56/dev deleted file mode 100644 index ee03fba97d..0000000000 --- a/test/sys/devices/virtual/tty/tty56/dev +++ /dev/null @@ -1 +0,0 @@ -4:56 diff --git a/test/sys/devices/virtual/tty/tty56/power/wakeup b/test/sys/devices/virtual/tty/tty56/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty56/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty56/subsystem b/test/sys/devices/virtual/tty/tty56/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty56/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty56/uevent b/test/sys/devices/virtual/tty/tty56/uevent deleted file mode 100644 index d083a45055..0000000000 --- a/test/sys/devices/virtual/tty/tty56/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=56 diff --git a/test/sys/devices/virtual/tty/tty57/dev b/test/sys/devices/virtual/tty/tty57/dev deleted file mode 100644 index 664d8ec646..0000000000 --- a/test/sys/devices/virtual/tty/tty57/dev +++ /dev/null @@ -1 +0,0 @@ -4:57 diff --git a/test/sys/devices/virtual/tty/tty57/power/wakeup b/test/sys/devices/virtual/tty/tty57/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty57/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty57/subsystem b/test/sys/devices/virtual/tty/tty57/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty57/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty57/uevent b/test/sys/devices/virtual/tty/tty57/uevent deleted file mode 100644 index 044ab1fa24..0000000000 --- a/test/sys/devices/virtual/tty/tty57/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=57 diff --git a/test/sys/devices/virtual/tty/tty58/dev b/test/sys/devices/virtual/tty/tty58/dev deleted file mode 100644 index ffc6c0b62c..0000000000 --- a/test/sys/devices/virtual/tty/tty58/dev +++ /dev/null @@ -1 +0,0 @@ -4:58 diff --git a/test/sys/devices/virtual/tty/tty58/power/wakeup b/test/sys/devices/virtual/tty/tty58/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty58/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty58/subsystem b/test/sys/devices/virtual/tty/tty58/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty58/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty58/uevent b/test/sys/devices/virtual/tty/tty58/uevent deleted file mode 100644 index 56b9272548..0000000000 --- a/test/sys/devices/virtual/tty/tty58/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=58 diff --git a/test/sys/devices/virtual/tty/tty59/dev b/test/sys/devices/virtual/tty/tty59/dev deleted file mode 100644 index c48309e7f0..0000000000 --- a/test/sys/devices/virtual/tty/tty59/dev +++ /dev/null @@ -1 +0,0 @@ -4:59 diff --git a/test/sys/devices/virtual/tty/tty59/power/wakeup b/test/sys/devices/virtual/tty/tty59/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty59/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty59/subsystem b/test/sys/devices/virtual/tty/tty59/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty59/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty59/uevent b/test/sys/devices/virtual/tty/tty59/uevent deleted file mode 100644 index 19542335c9..0000000000 --- a/test/sys/devices/virtual/tty/tty59/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=59 diff --git a/test/sys/devices/virtual/tty/tty6/dev b/test/sys/devices/virtual/tty/tty6/dev deleted file mode 100644 index cd94e0d09d..0000000000 --- a/test/sys/devices/virtual/tty/tty6/dev +++ /dev/null @@ -1 +0,0 @@ -4:6 diff --git a/test/sys/devices/virtual/tty/tty6/power/wakeup b/test/sys/devices/virtual/tty/tty6/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty6/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty6/subsystem b/test/sys/devices/virtual/tty/tty6/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty6/uevent b/test/sys/devices/virtual/tty/tty6/uevent deleted file mode 100644 index 59dd7fb038..0000000000 --- a/test/sys/devices/virtual/tty/tty6/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=6 diff --git a/test/sys/devices/virtual/tty/tty60/dev b/test/sys/devices/virtual/tty/tty60/dev deleted file mode 100644 index 37d25eab02..0000000000 --- a/test/sys/devices/virtual/tty/tty60/dev +++ /dev/null @@ -1 +0,0 @@ -4:60 diff --git a/test/sys/devices/virtual/tty/tty60/power/wakeup b/test/sys/devices/virtual/tty/tty60/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty60/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty60/subsystem b/test/sys/devices/virtual/tty/tty60/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty60/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty60/uevent b/test/sys/devices/virtual/tty/tty60/uevent deleted file mode 100644 index b2e6f63034..0000000000 --- a/test/sys/devices/virtual/tty/tty60/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=60 diff --git a/test/sys/devices/virtual/tty/tty61/dev b/test/sys/devices/virtual/tty/tty61/dev deleted file mode 100644 index 599df60bfd..0000000000 --- a/test/sys/devices/virtual/tty/tty61/dev +++ /dev/null @@ -1 +0,0 @@ -4:61 diff --git a/test/sys/devices/virtual/tty/tty61/power/wakeup b/test/sys/devices/virtual/tty/tty61/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty61/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty61/subsystem b/test/sys/devices/virtual/tty/tty61/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty61/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty61/uevent b/test/sys/devices/virtual/tty/tty61/uevent deleted file mode 100644 index a589537746..0000000000 --- a/test/sys/devices/virtual/tty/tty61/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=61 diff --git a/test/sys/devices/virtual/tty/tty62/dev b/test/sys/devices/virtual/tty/tty62/dev deleted file mode 100644 index 49fc9a0af5..0000000000 --- a/test/sys/devices/virtual/tty/tty62/dev +++ /dev/null @@ -1 +0,0 @@ -4:62 diff --git a/test/sys/devices/virtual/tty/tty62/power/wakeup b/test/sys/devices/virtual/tty/tty62/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty62/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty62/subsystem b/test/sys/devices/virtual/tty/tty62/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty62/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty62/uevent b/test/sys/devices/virtual/tty/tty62/uevent deleted file mode 100644 index b80482faed..0000000000 --- a/test/sys/devices/virtual/tty/tty62/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=62 diff --git a/test/sys/devices/virtual/tty/tty63/dev b/test/sys/devices/virtual/tty/tty63/dev deleted file mode 100644 index d11e9d2a82..0000000000 --- a/test/sys/devices/virtual/tty/tty63/dev +++ /dev/null @@ -1 +0,0 @@ -4:63 diff --git a/test/sys/devices/virtual/tty/tty63/power/wakeup b/test/sys/devices/virtual/tty/tty63/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty63/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty63/subsystem b/test/sys/devices/virtual/tty/tty63/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty63/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty63/uevent b/test/sys/devices/virtual/tty/tty63/uevent deleted file mode 100644 index 870a3031fa..0000000000 --- a/test/sys/devices/virtual/tty/tty63/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=63 diff --git a/test/sys/devices/virtual/tty/tty7/dev b/test/sys/devices/virtual/tty/tty7/dev deleted file mode 100644 index 9410476660..0000000000 --- a/test/sys/devices/virtual/tty/tty7/dev +++ /dev/null @@ -1 +0,0 @@ -4:7 diff --git a/test/sys/devices/virtual/tty/tty7/power/wakeup b/test/sys/devices/virtual/tty/tty7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty7/subsystem b/test/sys/devices/virtual/tty/tty7/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty7/uevent b/test/sys/devices/virtual/tty/tty7/uevent deleted file mode 100644 index 7354738777..0000000000 --- a/test/sys/devices/virtual/tty/tty7/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=7 diff --git a/test/sys/devices/virtual/tty/tty8/dev b/test/sys/devices/virtual/tty/tty8/dev deleted file mode 100644 index a79f74ba39..0000000000 --- a/test/sys/devices/virtual/tty/tty8/dev +++ /dev/null @@ -1 +0,0 @@ -4:8 diff --git a/test/sys/devices/virtual/tty/tty8/power/wakeup b/test/sys/devices/virtual/tty/tty8/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty8/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty8/subsystem b/test/sys/devices/virtual/tty/tty8/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty8/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty8/uevent b/test/sys/devices/virtual/tty/tty8/uevent deleted file mode 100644 index 62911804c1..0000000000 --- a/test/sys/devices/virtual/tty/tty8/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=8 diff --git a/test/sys/devices/virtual/tty/tty9/dev b/test/sys/devices/virtual/tty/tty9/dev deleted file mode 100644 index 62ada4bbe9..0000000000 --- a/test/sys/devices/virtual/tty/tty9/dev +++ /dev/null @@ -1 +0,0 @@ -4:9 diff --git a/test/sys/devices/virtual/tty/tty9/power/wakeup b/test/sys/devices/virtual/tty/tty9/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/tty/tty9/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/tty/tty9/subsystem b/test/sys/devices/virtual/tty/tty9/subsystem deleted file mode 120000 index 870c6a7986..0000000000 --- a/test/sys/devices/virtual/tty/tty9/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/tty \ No newline at end of file diff --git a/test/sys/devices/virtual/tty/tty9/uevent b/test/sys/devices/virtual/tty/tty9/uevent deleted file mode 100644 index 5e959d0629..0000000000 --- a/test/sys/devices/virtual/tty/tty9/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=4 -MINOR=9 diff --git a/test/sys/devices/virtual/vc/vcs/dev b/test/sys/devices/virtual/vc/vcs/dev deleted file mode 100644 index 63cbc465cd..0000000000 --- a/test/sys/devices/virtual/vc/vcs/dev +++ /dev/null @@ -1 +0,0 @@ -7:0 diff --git a/test/sys/devices/virtual/vc/vcs/power/wakeup b/test/sys/devices/virtual/vc/vcs/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcs/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcs/subsystem b/test/sys/devices/virtual/vc/vcs/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcs/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs/uevent b/test/sys/devices/virtual/vc/vcs/uevent deleted file mode 100644 index 34a8790bf8..0000000000 --- a/test/sys/devices/virtual/vc/vcs/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=0 diff --git a/test/sys/devices/virtual/vc/vcs1/dev b/test/sys/devices/virtual/vc/vcs1/dev deleted file mode 100644 index 084aafd011..0000000000 --- a/test/sys/devices/virtual/vc/vcs1/dev +++ /dev/null @@ -1 +0,0 @@ -7:1 diff --git a/test/sys/devices/virtual/vc/vcs1/power/wakeup b/test/sys/devices/virtual/vc/vcs1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcs1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcs1/subsystem b/test/sys/devices/virtual/vc/vcs1/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcs1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs1/uevent b/test/sys/devices/virtual/vc/vcs1/uevent deleted file mode 100644 index 9dd9e85495..0000000000 --- a/test/sys/devices/virtual/vc/vcs1/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=1 diff --git a/test/sys/devices/virtual/vc/vcs10/dev b/test/sys/devices/virtual/vc/vcs10/dev deleted file mode 100644 index b6bd8172d1..0000000000 --- a/test/sys/devices/virtual/vc/vcs10/dev +++ /dev/null @@ -1 +0,0 @@ -7:10 diff --git a/test/sys/devices/virtual/vc/vcs10/power/wakeup b/test/sys/devices/virtual/vc/vcs10/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcs10/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcs10/subsystem b/test/sys/devices/virtual/vc/vcs10/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcs10/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs10/uevent b/test/sys/devices/virtual/vc/vcs10/uevent deleted file mode 100644 index 1a76c71d05..0000000000 --- a/test/sys/devices/virtual/vc/vcs10/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=10 diff --git a/test/sys/devices/virtual/vc/vcs2/dev b/test/sys/devices/virtual/vc/vcs2/dev deleted file mode 100644 index 665a343e7d..0000000000 --- a/test/sys/devices/virtual/vc/vcs2/dev +++ /dev/null @@ -1 +0,0 @@ -7:2 diff --git a/test/sys/devices/virtual/vc/vcs2/power/wakeup b/test/sys/devices/virtual/vc/vcs2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcs2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcs2/subsystem b/test/sys/devices/virtual/vc/vcs2/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcs2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs2/uevent b/test/sys/devices/virtual/vc/vcs2/uevent deleted file mode 100644 index d7089e1974..0000000000 --- a/test/sys/devices/virtual/vc/vcs2/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=2 diff --git a/test/sys/devices/virtual/vc/vcs3/dev b/test/sys/devices/virtual/vc/vcs3/dev deleted file mode 100644 index 62f686140a..0000000000 --- a/test/sys/devices/virtual/vc/vcs3/dev +++ /dev/null @@ -1 +0,0 @@ -7:3 diff --git a/test/sys/devices/virtual/vc/vcs3/power/wakeup b/test/sys/devices/virtual/vc/vcs3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcs3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcs3/subsystem b/test/sys/devices/virtual/vc/vcs3/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcs3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs3/uevent b/test/sys/devices/virtual/vc/vcs3/uevent deleted file mode 100644 index 3d0dcff819..0000000000 --- a/test/sys/devices/virtual/vc/vcs3/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=3 diff --git a/test/sys/devices/virtual/vc/vcs4/dev b/test/sys/devices/virtual/vc/vcs4/dev deleted file mode 100644 index 684e7ade03..0000000000 --- a/test/sys/devices/virtual/vc/vcs4/dev +++ /dev/null @@ -1 +0,0 @@ -7:4 diff --git a/test/sys/devices/virtual/vc/vcs4/power/wakeup b/test/sys/devices/virtual/vc/vcs4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcs4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcs4/subsystem b/test/sys/devices/virtual/vc/vcs4/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcs4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs4/uevent b/test/sys/devices/virtual/vc/vcs4/uevent deleted file mode 100644 index 51fca4943f..0000000000 --- a/test/sys/devices/virtual/vc/vcs4/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=4 diff --git a/test/sys/devices/virtual/vc/vcs5/dev b/test/sys/devices/virtual/vc/vcs5/dev deleted file mode 100644 index 9028bbffdb..0000000000 --- a/test/sys/devices/virtual/vc/vcs5/dev +++ /dev/null @@ -1 +0,0 @@ -7:5 diff --git a/test/sys/devices/virtual/vc/vcs5/power/wakeup b/test/sys/devices/virtual/vc/vcs5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcs5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcs5/subsystem b/test/sys/devices/virtual/vc/vcs5/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcs5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs5/uevent b/test/sys/devices/virtual/vc/vcs5/uevent deleted file mode 100644 index 16f8908955..0000000000 --- a/test/sys/devices/virtual/vc/vcs5/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=5 diff --git a/test/sys/devices/virtual/vc/vcs6/dev b/test/sys/devices/virtual/vc/vcs6/dev deleted file mode 100644 index fc5d660a44..0000000000 --- a/test/sys/devices/virtual/vc/vcs6/dev +++ /dev/null @@ -1 +0,0 @@ -7:6 diff --git a/test/sys/devices/virtual/vc/vcs6/power/wakeup b/test/sys/devices/virtual/vc/vcs6/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcs6/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcs6/subsystem b/test/sys/devices/virtual/vc/vcs6/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcs6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs6/uevent b/test/sys/devices/virtual/vc/vcs6/uevent deleted file mode 100644 index d5b6875958..0000000000 --- a/test/sys/devices/virtual/vc/vcs6/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=6 diff --git a/test/sys/devices/virtual/vc/vcs7/dev b/test/sys/devices/virtual/vc/vcs7/dev deleted file mode 100644 index 5d4edd3ce1..0000000000 --- a/test/sys/devices/virtual/vc/vcs7/dev +++ /dev/null @@ -1 +0,0 @@ -7:7 diff --git a/test/sys/devices/virtual/vc/vcs7/power/wakeup b/test/sys/devices/virtual/vc/vcs7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcs7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcs7/subsystem b/test/sys/devices/virtual/vc/vcs7/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcs7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcs7/uevent b/test/sys/devices/virtual/vc/vcs7/uevent deleted file mode 100644 index f150fec021..0000000000 --- a/test/sys/devices/virtual/vc/vcs7/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=7 diff --git a/test/sys/devices/virtual/vc/vcsa/dev b/test/sys/devices/virtual/vc/vcsa/dev deleted file mode 100644 index 780668ac31..0000000000 --- a/test/sys/devices/virtual/vc/vcsa/dev +++ /dev/null @@ -1 +0,0 @@ -7:128 diff --git a/test/sys/devices/virtual/vc/vcsa/power/wakeup b/test/sys/devices/virtual/vc/vcsa/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcsa/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcsa/subsystem b/test/sys/devices/virtual/vc/vcsa/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa/uevent b/test/sys/devices/virtual/vc/vcsa/uevent deleted file mode 100644 index b98170132e..0000000000 --- a/test/sys/devices/virtual/vc/vcsa/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=128 diff --git a/test/sys/devices/virtual/vc/vcsa1/dev b/test/sys/devices/virtual/vc/vcsa1/dev deleted file mode 100644 index d52dc18c71..0000000000 --- a/test/sys/devices/virtual/vc/vcsa1/dev +++ /dev/null @@ -1 +0,0 @@ -7:129 diff --git a/test/sys/devices/virtual/vc/vcsa1/power/wakeup b/test/sys/devices/virtual/vc/vcsa1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcsa1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcsa1/subsystem b/test/sys/devices/virtual/vc/vcsa1/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa1/uevent b/test/sys/devices/virtual/vc/vcsa1/uevent deleted file mode 100644 index 2a1995b5f6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa1/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=129 diff --git a/test/sys/devices/virtual/vc/vcsa10/dev b/test/sys/devices/virtual/vc/vcsa10/dev deleted file mode 100644 index 9a6941953e..0000000000 --- a/test/sys/devices/virtual/vc/vcsa10/dev +++ /dev/null @@ -1 +0,0 @@ -7:138 diff --git a/test/sys/devices/virtual/vc/vcsa10/power/wakeup b/test/sys/devices/virtual/vc/vcsa10/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcsa10/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcsa10/subsystem b/test/sys/devices/virtual/vc/vcsa10/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa10/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa10/uevent b/test/sys/devices/virtual/vc/vcsa10/uevent deleted file mode 100644 index 5cd65a25d8..0000000000 --- a/test/sys/devices/virtual/vc/vcsa10/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=138 diff --git a/test/sys/devices/virtual/vc/vcsa2/dev b/test/sys/devices/virtual/vc/vcsa2/dev deleted file mode 100644 index 77035b45c7..0000000000 --- a/test/sys/devices/virtual/vc/vcsa2/dev +++ /dev/null @@ -1 +0,0 @@ -7:130 diff --git a/test/sys/devices/virtual/vc/vcsa2/power/wakeup b/test/sys/devices/virtual/vc/vcsa2/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcsa2/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcsa2/subsystem b/test/sys/devices/virtual/vc/vcsa2/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa2/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa2/uevent b/test/sys/devices/virtual/vc/vcsa2/uevent deleted file mode 100644 index 38a6f878db..0000000000 --- a/test/sys/devices/virtual/vc/vcsa2/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=130 diff --git a/test/sys/devices/virtual/vc/vcsa3/dev b/test/sys/devices/virtual/vc/vcsa3/dev deleted file mode 100644 index ed36a09609..0000000000 --- a/test/sys/devices/virtual/vc/vcsa3/dev +++ /dev/null @@ -1 +0,0 @@ -7:131 diff --git a/test/sys/devices/virtual/vc/vcsa3/power/wakeup b/test/sys/devices/virtual/vc/vcsa3/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcsa3/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcsa3/subsystem b/test/sys/devices/virtual/vc/vcsa3/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa3/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa3/uevent b/test/sys/devices/virtual/vc/vcsa3/uevent deleted file mode 100644 index 9664556a81..0000000000 --- a/test/sys/devices/virtual/vc/vcsa3/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=131 diff --git a/test/sys/devices/virtual/vc/vcsa4/dev b/test/sys/devices/virtual/vc/vcsa4/dev deleted file mode 100644 index d522190032..0000000000 --- a/test/sys/devices/virtual/vc/vcsa4/dev +++ /dev/null @@ -1 +0,0 @@ -7:132 diff --git a/test/sys/devices/virtual/vc/vcsa4/power/wakeup b/test/sys/devices/virtual/vc/vcsa4/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcsa4/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcsa4/subsystem b/test/sys/devices/virtual/vc/vcsa4/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa4/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa4/uevent b/test/sys/devices/virtual/vc/vcsa4/uevent deleted file mode 100644 index 7f11f5dded..0000000000 --- a/test/sys/devices/virtual/vc/vcsa4/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=132 diff --git a/test/sys/devices/virtual/vc/vcsa5/dev b/test/sys/devices/virtual/vc/vcsa5/dev deleted file mode 100644 index 6e362b4ce2..0000000000 --- a/test/sys/devices/virtual/vc/vcsa5/dev +++ /dev/null @@ -1 +0,0 @@ -7:133 diff --git a/test/sys/devices/virtual/vc/vcsa5/power/wakeup b/test/sys/devices/virtual/vc/vcsa5/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcsa5/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcsa5/subsystem b/test/sys/devices/virtual/vc/vcsa5/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa5/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa5/uevent b/test/sys/devices/virtual/vc/vcsa5/uevent deleted file mode 100644 index aabd0163a8..0000000000 --- a/test/sys/devices/virtual/vc/vcsa5/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=133 diff --git a/test/sys/devices/virtual/vc/vcsa6/dev b/test/sys/devices/virtual/vc/vcsa6/dev deleted file mode 100644 index fd31ac3ce4..0000000000 --- a/test/sys/devices/virtual/vc/vcsa6/dev +++ /dev/null @@ -1 +0,0 @@ -7:134 diff --git a/test/sys/devices/virtual/vc/vcsa6/power/wakeup b/test/sys/devices/virtual/vc/vcsa6/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcsa6/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcsa6/subsystem b/test/sys/devices/virtual/vc/vcsa6/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa6/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa6/uevent b/test/sys/devices/virtual/vc/vcsa6/uevent deleted file mode 100644 index fb62516d67..0000000000 --- a/test/sys/devices/virtual/vc/vcsa6/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=134 diff --git a/test/sys/devices/virtual/vc/vcsa7/dev b/test/sys/devices/virtual/vc/vcsa7/dev deleted file mode 100644 index 1ba6ffbb24..0000000000 --- a/test/sys/devices/virtual/vc/vcsa7/dev +++ /dev/null @@ -1 +0,0 @@ -7:135 diff --git a/test/sys/devices/virtual/vc/vcsa7/power/wakeup b/test/sys/devices/virtual/vc/vcsa7/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vc/vcsa7/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vc/vcsa7/subsystem b/test/sys/devices/virtual/vc/vcsa7/subsystem deleted file mode 120000 index 6a4bc6b0b6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa7/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vc \ No newline at end of file diff --git a/test/sys/devices/virtual/vc/vcsa7/uevent b/test/sys/devices/virtual/vc/vcsa7/uevent deleted file mode 100644 index 34d1003db6..0000000000 --- a/test/sys/devices/virtual/vc/vcsa7/uevent +++ /dev/null @@ -1,2 +0,0 @@ -MAJOR=7 -MINOR=135 diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/bind b/test/sys/devices/virtual/vtconsole/vtcon0/bind deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/devices/virtual/vtconsole/vtcon0/bind +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/name b/test/sys/devices/virtual/vtconsole/vtcon0/name deleted file mode 100644 index ff01778438..0000000000 --- a/test/sys/devices/virtual/vtconsole/vtcon0/name +++ /dev/null @@ -1 +0,0 @@ -(S) dummy device diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/power/wakeup b/test/sys/devices/virtual/vtconsole/vtcon0/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vtconsole/vtcon0/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/subsystem b/test/sys/devices/virtual/vtconsole/vtcon0/subsystem deleted file mode 120000 index c43603a273..0000000000 --- a/test/sys/devices/virtual/vtconsole/vtcon0/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vtconsole \ No newline at end of file diff --git a/test/sys/devices/virtual/vtconsole/vtcon0/uevent b/test/sys/devices/virtual/vtconsole/vtcon0/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/bind b/test/sys/devices/virtual/vtconsole/vtcon1/bind deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/devices/virtual/vtconsole/vtcon1/bind +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/name b/test/sys/devices/virtual/vtconsole/vtcon1/name deleted file mode 100644 index a93a47836e..0000000000 --- a/test/sys/devices/virtual/vtconsole/vtcon1/name +++ /dev/null @@ -1 +0,0 @@ -(M) frame buffer device diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/power/wakeup b/test/sys/devices/virtual/vtconsole/vtcon1/power/wakeup deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/devices/virtual/vtconsole/vtcon1/power/wakeup +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/subsystem b/test/sys/devices/virtual/vtconsole/vtcon1/subsystem deleted file mode 120000 index c43603a273..0000000000 --- a/test/sys/devices/virtual/vtconsole/vtcon1/subsystem +++ /dev/null @@ -1 +0,0 @@ -../../../../class/vtconsole \ No newline at end of file diff --git a/test/sys/devices/virtual/vtconsole/vtcon1/uevent b/test/sys/devices/virtual/vtconsole/vtcon1/uevent deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/firmware/acpi/interrupts/error b/test/sys/firmware/acpi/interrupts/error deleted file mode 100644 index 1acf61e2c3..0000000000 --- a/test/sys/firmware/acpi/interrupts/error +++ /dev/null @@ -1 +0,0 @@ - 0 diff --git a/test/sys/firmware/acpi/interrupts/ff_gbl_lock b/test/sys/firmware/acpi/interrupts/ff_gbl_lock deleted file mode 100644 index c352d5552e..0000000000 --- a/test/sys/firmware/acpi/interrupts/ff_gbl_lock +++ /dev/null @@ -1 +0,0 @@ - 0 enable diff --git a/test/sys/firmware/acpi/interrupts/ff_pmtimer b/test/sys/firmware/acpi/interrupts/ff_pmtimer deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/ff_pmtimer +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/ff_pwr_btn b/test/sys/firmware/acpi/interrupts/ff_pwr_btn deleted file mode 100644 index c352d5552e..0000000000 --- a/test/sys/firmware/acpi/interrupts/ff_pwr_btn +++ /dev/null @@ -1 +0,0 @@ - 0 enable diff --git a/test/sys/firmware/acpi/interrupts/ff_rt_clk b/test/sys/firmware/acpi/interrupts/ff_rt_clk deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/ff_rt_clk +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/ff_slp_btn b/test/sys/firmware/acpi/interrupts/ff_slp_btn deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/ff_slp_btn +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe00 b/test/sys/firmware/acpi/interrupts/gpe00 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe00 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe01 b/test/sys/firmware/acpi/interrupts/gpe01 deleted file mode 100644 index a335a10c19..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe01 +++ /dev/null @@ -1 +0,0 @@ - 1 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe02 b/test/sys/firmware/acpi/interrupts/gpe02 deleted file mode 100644 index 3b84de6c6e..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe02 +++ /dev/null @@ -1 +0,0 @@ - 200 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe03 b/test/sys/firmware/acpi/interrupts/gpe03 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe03 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe04 b/test/sys/firmware/acpi/interrupts/gpe04 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe04 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe05 b/test/sys/firmware/acpi/interrupts/gpe05 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe05 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe06 b/test/sys/firmware/acpi/interrupts/gpe06 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe06 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe07 b/test/sys/firmware/acpi/interrupts/gpe07 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe07 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe08 b/test/sys/firmware/acpi/interrupts/gpe08 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe08 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe09 b/test/sys/firmware/acpi/interrupts/gpe09 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe09 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0A b/test/sys/firmware/acpi/interrupts/gpe0A deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe0A +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0B b/test/sys/firmware/acpi/interrupts/gpe0B deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe0B +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0C b/test/sys/firmware/acpi/interrupts/gpe0C deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe0C +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0D b/test/sys/firmware/acpi/interrupts/gpe0D deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe0D +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0E b/test/sys/firmware/acpi/interrupts/gpe0E deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe0E +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe0F b/test/sys/firmware/acpi/interrupts/gpe0F deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe0F +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe10 b/test/sys/firmware/acpi/interrupts/gpe10 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe10 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe11 b/test/sys/firmware/acpi/interrupts/gpe11 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe11 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe12 b/test/sys/firmware/acpi/interrupts/gpe12 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe12 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe13 b/test/sys/firmware/acpi/interrupts/gpe13 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe13 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe14 b/test/sys/firmware/acpi/interrupts/gpe14 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe14 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe15 b/test/sys/firmware/acpi/interrupts/gpe15 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe15 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe16 b/test/sys/firmware/acpi/interrupts/gpe16 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe16 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe17 b/test/sys/firmware/acpi/interrupts/gpe17 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe17 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe18 b/test/sys/firmware/acpi/interrupts/gpe18 deleted file mode 100644 index c352d5552e..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe18 +++ /dev/null @@ -1 +0,0 @@ - 0 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe19 b/test/sys/firmware/acpi/interrupts/gpe19 deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe19 +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1A b/test/sys/firmware/acpi/interrupts/gpe1A deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe1A +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1B b/test/sys/firmware/acpi/interrupts/gpe1B deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe1B +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1C b/test/sys/firmware/acpi/interrupts/gpe1C deleted file mode 100644 index 8cc1fbe414..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe1C +++ /dev/null @@ -1 +0,0 @@ - 14039 enable diff --git a/test/sys/firmware/acpi/interrupts/gpe1D b/test/sys/firmware/acpi/interrupts/gpe1D deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe1D +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1E b/test/sys/firmware/acpi/interrupts/gpe1E deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe1E +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe1F b/test/sys/firmware/acpi/interrupts/gpe1F deleted file mode 100644 index f71740f689..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe1F +++ /dev/null @@ -1 +0,0 @@ - 0 invalid diff --git a/test/sys/firmware/acpi/interrupts/gpe_all b/test/sys/firmware/acpi/interrupts/gpe_all deleted file mode 100644 index 2ba757cc72..0000000000 --- a/test/sys/firmware/acpi/interrupts/gpe_all +++ /dev/null @@ -1 +0,0 @@ - 14240 diff --git a/test/sys/firmware/acpi/interrupts/sci b/test/sys/firmware/acpi/interrupts/sci deleted file mode 100644 index 2ba757cc72..0000000000 --- a/test/sys/firmware/acpi/interrupts/sci +++ /dev/null @@ -1 +0,0 @@ - 14240 diff --git a/test/sys/firmware/acpi/tables/APIC b/test/sys/firmware/acpi/tables/APIC deleted file mode 100644 index e5b4b6053d..0000000000 Binary files a/test/sys/firmware/acpi/tables/APIC and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/BOOT b/test/sys/firmware/acpi/tables/BOOT deleted file mode 100644 index 8f294f6cee..0000000000 Binary files a/test/sys/firmware/acpi/tables/BOOT and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/DSDT b/test/sys/firmware/acpi/tables/DSDT deleted file mode 100644 index c380b3e41c..0000000000 Binary files a/test/sys/firmware/acpi/tables/DSDT and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/ECDT b/test/sys/firmware/acpi/tables/ECDT deleted file mode 100644 index edf4f8549f..0000000000 Binary files a/test/sys/firmware/acpi/tables/ECDT and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/FACP b/test/sys/firmware/acpi/tables/FACP deleted file mode 100644 index f64347e783..0000000000 Binary files a/test/sys/firmware/acpi/tables/FACP and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/FACS b/test/sys/firmware/acpi/tables/FACS deleted file mode 100644 index 09155e37fe..0000000000 Binary files a/test/sys/firmware/acpi/tables/FACS and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/HPET b/test/sys/firmware/acpi/tables/HPET deleted file mode 100644 index 4857c3ad8f..0000000000 Binary files a/test/sys/firmware/acpi/tables/HPET and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/MCFG b/test/sys/firmware/acpi/tables/MCFG deleted file mode 100644 index 9b2c4d5652..0000000000 Binary files a/test/sys/firmware/acpi/tables/MCFG and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/SLIC b/test/sys/firmware/acpi/tables/SLIC deleted file mode 100644 index c2e22ef127..0000000000 Binary files a/test/sys/firmware/acpi/tables/SLIC and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/SSDT1 b/test/sys/firmware/acpi/tables/SSDT1 deleted file mode 100644 index d9c4b950f7..0000000000 Binary files a/test/sys/firmware/acpi/tables/SSDT1 and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/SSDT2 b/test/sys/firmware/acpi/tables/SSDT2 deleted file mode 100644 index c85a6ea2c5..0000000000 Binary files a/test/sys/firmware/acpi/tables/SSDT2 and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/SSDT3 b/test/sys/firmware/acpi/tables/SSDT3 deleted file mode 100644 index 6dc6f825d4..0000000000 Binary files a/test/sys/firmware/acpi/tables/SSDT3 and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/SSDT4 b/test/sys/firmware/acpi/tables/SSDT4 deleted file mode 100644 index d9587a4fb7..0000000000 Binary files a/test/sys/firmware/acpi/tables/SSDT4 and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/SSDT5 b/test/sys/firmware/acpi/tables/SSDT5 deleted file mode 100644 index efd58bb46d..0000000000 Binary files a/test/sys/firmware/acpi/tables/SSDT5 and /dev/null differ diff --git a/test/sys/firmware/acpi/tables/TCPA b/test/sys/firmware/acpi/tables/TCPA deleted file mode 100644 index d3013a31bb..0000000000 Binary files a/test/sys/firmware/acpi/tables/TCPA and /dev/null differ diff --git a/test/sys/firmware/edd/int13_dev80/default_cylinders b/test/sys/firmware/edd/int13_dev80/default_cylinders deleted file mode 100644 index cb521a2fb3..0000000000 --- a/test/sys/firmware/edd/int13_dev80/default_cylinders +++ /dev/null @@ -1 +0,0 @@ -16383 diff --git a/test/sys/firmware/edd/int13_dev80/default_heads b/test/sys/firmware/edd/int13_dev80/default_heads deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/firmware/edd/int13_dev80/default_heads +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/firmware/edd/int13_dev80/default_sectors_per_track b/test/sys/firmware/edd/int13_dev80/default_sectors_per_track deleted file mode 100644 index 4b9026d8e2..0000000000 --- a/test/sys/firmware/edd/int13_dev80/default_sectors_per_track +++ /dev/null @@ -1 +0,0 @@ -63 diff --git a/test/sys/firmware/edd/int13_dev80/extensions b/test/sys/firmware/edd/int13_dev80/extensions deleted file mode 100644 index 3229770709..0000000000 --- a/test/sys/firmware/edd/int13_dev80/extensions +++ /dev/null @@ -1,2 +0,0 @@ -Fixed disk access -Enhanced Disk Drive support diff --git a/test/sys/firmware/edd/int13_dev80/host_bus b/test/sys/firmware/edd/int13_dev80/host_bus deleted file mode 100644 index 03c9d72858..0000000000 --- a/test/sys/firmware/edd/int13_dev80/host_bus +++ /dev/null @@ -1 +0,0 @@ -PCI 00:1f.2 channel: 1 diff --git a/test/sys/firmware/edd/int13_dev80/info_flags b/test/sys/firmware/edd/int13_dev80/info_flags deleted file mode 100644 index e9b93025c1..0000000000 --- a/test/sys/firmware/edd/int13_dev80/info_flags +++ /dev/null @@ -1 +0,0 @@ -DMA boundary error transparent diff --git a/test/sys/firmware/edd/int13_dev80/interface b/test/sys/firmware/edd/int13_dev80/interface deleted file mode 100644 index f476fd0659..0000000000 --- a/test/sys/firmware/edd/int13_dev80/interface +++ /dev/null @@ -1 +0,0 @@ -ATA device: 0 diff --git a/test/sys/firmware/edd/int13_dev80/legacy_max_cylinder b/test/sys/firmware/edd/int13_dev80/legacy_max_cylinder deleted file mode 100644 index c7781419a3..0000000000 --- a/test/sys/firmware/edd/int13_dev80/legacy_max_cylinder +++ /dev/null @@ -1 +0,0 @@ -1022 diff --git a/test/sys/firmware/edd/int13_dev80/legacy_max_head b/test/sys/firmware/edd/int13_dev80/legacy_max_head deleted file mode 100644 index b4249c475b..0000000000 --- a/test/sys/firmware/edd/int13_dev80/legacy_max_head +++ /dev/null @@ -1 +0,0 @@ -239 diff --git a/test/sys/firmware/edd/int13_dev80/legacy_sectors_per_track b/test/sys/firmware/edd/int13_dev80/legacy_sectors_per_track deleted file mode 100644 index 4b9026d8e2..0000000000 --- a/test/sys/firmware/edd/int13_dev80/legacy_sectors_per_track +++ /dev/null @@ -1 +0,0 @@ -63 diff --git a/test/sys/firmware/edd/int13_dev80/mbr_signature b/test/sys/firmware/edd/int13_dev80/mbr_signature deleted file mode 100644 index fd4966ce3a..0000000000 --- a/test/sys/firmware/edd/int13_dev80/mbr_signature +++ /dev/null @@ -1 +0,0 @@ -0x00087b5f diff --git a/test/sys/firmware/edd/int13_dev80/pci_dev b/test/sys/firmware/edd/int13_dev80/pci_dev deleted file mode 120000 index cb9f3ca449..0000000000 --- a/test/sys/firmware/edd/int13_dev80/pci_dev +++ /dev/null @@ -1 +0,0 @@ -../../../devices/pci0000:00/0000:00:1f.2 \ No newline at end of file diff --git a/test/sys/firmware/edd/int13_dev80/raw_data b/test/sys/firmware/edd/int13_dev80/raw_data deleted file mode 100644 index 78ecca3487..0000000000 Binary files a/test/sys/firmware/edd/int13_dev80/raw_data and /dev/null differ diff --git a/test/sys/firmware/edd/int13_dev80/sectors b/test/sys/firmware/edd/int13_dev80/sectors deleted file mode 100644 index 967b32b605..0000000000 --- a/test/sys/firmware/edd/int13_dev80/sectors +++ /dev/null @@ -1 +0,0 @@ -195371568 diff --git a/test/sys/firmware/edd/int13_dev80/version b/test/sys/firmware/edd/int13_dev80/version deleted file mode 100644 index 5a0dc65a29..0000000000 --- a/test/sys/firmware/edd/int13_dev80/version +++ /dev/null @@ -1 +0,0 @@ -0x30 diff --git a/test/sys/firmware/memmap/0/end b/test/sys/firmware/memmap/0/end deleted file mode 100644 index 13ddd545ab..0000000000 --- a/test/sys/firmware/memmap/0/end +++ /dev/null @@ -1 +0,0 @@ -0x9efff diff --git a/test/sys/firmware/memmap/0/start b/test/sys/firmware/memmap/0/start deleted file mode 100644 index 9982566dc0..0000000000 --- a/test/sys/firmware/memmap/0/start +++ /dev/null @@ -1 +0,0 @@ -0x0 diff --git a/test/sys/firmware/memmap/0/type b/test/sys/firmware/memmap/0/type deleted file mode 100644 index e9d695712c..0000000000 --- a/test/sys/firmware/memmap/0/type +++ /dev/null @@ -1 +0,0 @@ -System RAM diff --git a/test/sys/firmware/memmap/1/end b/test/sys/firmware/memmap/1/end deleted file mode 100644 index b68cf02550..0000000000 --- a/test/sys/firmware/memmap/1/end +++ /dev/null @@ -1 +0,0 @@ -0x9ffff diff --git a/test/sys/firmware/memmap/1/start b/test/sys/firmware/memmap/1/start deleted file mode 100644 index 9176a6235d..0000000000 --- a/test/sys/firmware/memmap/1/start +++ /dev/null @@ -1 +0,0 @@ -0x9f000 diff --git a/test/sys/firmware/memmap/1/type b/test/sys/firmware/memmap/1/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/1/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/firmware/memmap/10/end b/test/sys/firmware/memmap/10/end deleted file mode 100644 index abc04b14b5..0000000000 --- a/test/sys/firmware/memmap/10/end +++ /dev/null @@ -1 +0,0 @@ -0xfed19fff diff --git a/test/sys/firmware/memmap/10/start b/test/sys/firmware/memmap/10/start deleted file mode 100644 index 70ad16771c..0000000000 --- a/test/sys/firmware/memmap/10/start +++ /dev/null @@ -1 +0,0 @@ -0xfed14000 diff --git a/test/sys/firmware/memmap/10/type b/test/sys/firmware/memmap/10/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/10/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/firmware/memmap/11/end b/test/sys/firmware/memmap/11/end deleted file mode 100644 index 8bd04cbbad..0000000000 --- a/test/sys/firmware/memmap/11/end +++ /dev/null @@ -1 +0,0 @@ -0xfed8ffff diff --git a/test/sys/firmware/memmap/11/start b/test/sys/firmware/memmap/11/start deleted file mode 100644 index 538a4d1d55..0000000000 --- a/test/sys/firmware/memmap/11/start +++ /dev/null @@ -1 +0,0 @@ -0xfed1c000 diff --git a/test/sys/firmware/memmap/11/type b/test/sys/firmware/memmap/11/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/11/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/firmware/memmap/12/end b/test/sys/firmware/memmap/12/end deleted file mode 100644 index 617cccfb8b..0000000000 --- a/test/sys/firmware/memmap/12/end +++ /dev/null @@ -1 +0,0 @@ -0xfee00fff diff --git a/test/sys/firmware/memmap/12/start b/test/sys/firmware/memmap/12/start deleted file mode 100644 index c6c4677ee5..0000000000 --- a/test/sys/firmware/memmap/12/start +++ /dev/null @@ -1 +0,0 @@ -0xfee00000 diff --git a/test/sys/firmware/memmap/12/type b/test/sys/firmware/memmap/12/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/12/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/firmware/memmap/13/end b/test/sys/firmware/memmap/13/end deleted file mode 100644 index adefea55b5..0000000000 --- a/test/sys/firmware/memmap/13/end +++ /dev/null @@ -1 +0,0 @@ -0xffffffff diff --git a/test/sys/firmware/memmap/13/start b/test/sys/firmware/memmap/13/start deleted file mode 100644 index 3a12bbc151..0000000000 --- a/test/sys/firmware/memmap/13/start +++ /dev/null @@ -1 +0,0 @@ -0xff800000 diff --git a/test/sys/firmware/memmap/13/type b/test/sys/firmware/memmap/13/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/13/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/firmware/memmap/2/end b/test/sys/firmware/memmap/2/end deleted file mode 100644 index 0db57c80aa..0000000000 --- a/test/sys/firmware/memmap/2/end +++ /dev/null @@ -1 +0,0 @@ -0xfffff diff --git a/test/sys/firmware/memmap/2/start b/test/sys/firmware/memmap/2/start deleted file mode 100644 index cc594eb8b6..0000000000 --- a/test/sys/firmware/memmap/2/start +++ /dev/null @@ -1 +0,0 @@ -0xdc000 diff --git a/test/sys/firmware/memmap/2/type b/test/sys/firmware/memmap/2/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/2/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/firmware/memmap/3/end b/test/sys/firmware/memmap/3/end deleted file mode 100644 index 588e544dc0..0000000000 --- a/test/sys/firmware/memmap/3/end +++ /dev/null @@ -1 +0,0 @@ -0x7fecffff diff --git a/test/sys/firmware/memmap/3/start b/test/sys/firmware/memmap/3/start deleted file mode 100644 index 22dd9361aa..0000000000 --- a/test/sys/firmware/memmap/3/start +++ /dev/null @@ -1 +0,0 @@ -0x100000 diff --git a/test/sys/firmware/memmap/3/type b/test/sys/firmware/memmap/3/type deleted file mode 100644 index e9d695712c..0000000000 --- a/test/sys/firmware/memmap/3/type +++ /dev/null @@ -1 +0,0 @@ -System RAM diff --git a/test/sys/firmware/memmap/4/end b/test/sys/firmware/memmap/4/end deleted file mode 100644 index d2cc696799..0000000000 --- a/test/sys/firmware/memmap/4/end +++ /dev/null @@ -1 +0,0 @@ -0x7fedefff diff --git a/test/sys/firmware/memmap/4/start b/test/sys/firmware/memmap/4/start deleted file mode 100644 index d5573a6898..0000000000 --- a/test/sys/firmware/memmap/4/start +++ /dev/null @@ -1 +0,0 @@ -0x7fed0000 diff --git a/test/sys/firmware/memmap/4/type b/test/sys/firmware/memmap/4/type deleted file mode 100644 index 7bb0fe5f44..0000000000 --- a/test/sys/firmware/memmap/4/type +++ /dev/null @@ -1 +0,0 @@ -ACPI Tables diff --git a/test/sys/firmware/memmap/5/end b/test/sys/firmware/memmap/5/end deleted file mode 100644 index c909944edf..0000000000 --- a/test/sys/firmware/memmap/5/end +++ /dev/null @@ -1 +0,0 @@ -0x7fefffff diff --git a/test/sys/firmware/memmap/5/start b/test/sys/firmware/memmap/5/start deleted file mode 100644 index 2ad0b0e0ce..0000000000 --- a/test/sys/firmware/memmap/5/start +++ /dev/null @@ -1 +0,0 @@ -0x7fedf000 diff --git a/test/sys/firmware/memmap/5/type b/test/sys/firmware/memmap/5/type deleted file mode 100644 index 1c3449031a..0000000000 --- a/test/sys/firmware/memmap/5/type +++ /dev/null @@ -1 +0,0 @@ -ACPI Non-volatile Storage diff --git a/test/sys/firmware/memmap/6/end b/test/sys/firmware/memmap/6/end deleted file mode 100644 index 4910c67e83..0000000000 --- a/test/sys/firmware/memmap/6/end +++ /dev/null @@ -1 +0,0 @@ -0x7fffffff diff --git a/test/sys/firmware/memmap/6/start b/test/sys/firmware/memmap/6/start deleted file mode 100644 index 16b9a9bba9..0000000000 --- a/test/sys/firmware/memmap/6/start +++ /dev/null @@ -1 +0,0 @@ -0x7ff00000 diff --git a/test/sys/firmware/memmap/6/type b/test/sys/firmware/memmap/6/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/6/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/firmware/memmap/7/end b/test/sys/firmware/memmap/7/end deleted file mode 100644 index c039514719..0000000000 --- a/test/sys/firmware/memmap/7/end +++ /dev/null @@ -1 +0,0 @@ -0xf3ffffff diff --git a/test/sys/firmware/memmap/7/start b/test/sys/firmware/memmap/7/start deleted file mode 100644 index 554667a99e..0000000000 --- a/test/sys/firmware/memmap/7/start +++ /dev/null @@ -1 +0,0 @@ -0xf0000000 diff --git a/test/sys/firmware/memmap/7/type b/test/sys/firmware/memmap/7/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/7/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/firmware/memmap/8/end b/test/sys/firmware/memmap/8/end deleted file mode 100644 index 526bcba100..0000000000 --- a/test/sys/firmware/memmap/8/end +++ /dev/null @@ -1 +0,0 @@ -0xfec0ffff diff --git a/test/sys/firmware/memmap/8/start b/test/sys/firmware/memmap/8/start deleted file mode 100644 index 7a9cc31e9e..0000000000 --- a/test/sys/firmware/memmap/8/start +++ /dev/null @@ -1 +0,0 @@ -0xfec00000 diff --git a/test/sys/firmware/memmap/8/type b/test/sys/firmware/memmap/8/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/8/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/firmware/memmap/9/end b/test/sys/firmware/memmap/9/end deleted file mode 100644 index 1e17e98a47..0000000000 --- a/test/sys/firmware/memmap/9/end +++ /dev/null @@ -1 +0,0 @@ -0xfed003ff diff --git a/test/sys/firmware/memmap/9/start b/test/sys/firmware/memmap/9/start deleted file mode 100644 index febf41c046..0000000000 --- a/test/sys/firmware/memmap/9/start +++ /dev/null @@ -1 +0,0 @@ -0xfed00000 diff --git a/test/sys/firmware/memmap/9/type b/test/sys/firmware/memmap/9/type deleted file mode 100644 index 123f60c77e..0000000000 --- a/test/sys/firmware/memmap/9/type +++ /dev/null @@ -1 +0,0 @@ -reserved diff --git a/test/sys/fs/fuse/connections/16/abort b/test/sys/fs/fuse/connections/16/abort deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/fs/fuse/connections/16/waiting b/test/sys/fs/fuse/connections/16/waiting deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/fs/fuse/connections/16/waiting +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/debug/bdi/0:16/stats b/test/sys/kernel/debug/bdi/0:16/stats deleted file mode 100644 index cf9d91d60e..0000000000 --- a/test/sys/kernel/debug/bdi/0:16/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189272 kB -BackgroundThresh: 94636 kB diff --git a/test/sys/kernel/debug/bdi/11:0/stats b/test/sys/kernel/debug/bdi/11:0/stats deleted file mode 100644 index a909944b30..0000000000 --- a/test/sys/kernel/debug/bdi/11:0/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189292 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:0/stats b/test/sys/kernel/debug/bdi/7:0/stats deleted file mode 100644 index a909944b30..0000000000 --- a/test/sys/kernel/debug/bdi/7:0/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189292 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:1/stats b/test/sys/kernel/debug/bdi/7:1/stats deleted file mode 100644 index 6f601e0157..0000000000 --- a/test/sys/kernel/debug/bdi/7:1/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189288 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:2/stats b/test/sys/kernel/debug/bdi/7:2/stats deleted file mode 100644 index 6f601e0157..0000000000 --- a/test/sys/kernel/debug/bdi/7:2/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189288 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:3/stats b/test/sys/kernel/debug/bdi/7:3/stats deleted file mode 100644 index 6f601e0157..0000000000 --- a/test/sys/kernel/debug/bdi/7:3/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189288 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:4/stats b/test/sys/kernel/debug/bdi/7:4/stats deleted file mode 100644 index 6f601e0157..0000000000 --- a/test/sys/kernel/debug/bdi/7:4/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189288 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:5/stats b/test/sys/kernel/debug/bdi/7:5/stats deleted file mode 100644 index 6f601e0157..0000000000 --- a/test/sys/kernel/debug/bdi/7:5/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189288 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:6/stats b/test/sys/kernel/debug/bdi/7:6/stats deleted file mode 100644 index 6f601e0157..0000000000 --- a/test/sys/kernel/debug/bdi/7:6/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189288 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/7:7/stats b/test/sys/kernel/debug/bdi/7:7/stats deleted file mode 100644 index 6f601e0157..0000000000 --- a/test/sys/kernel/debug/bdi/7:7/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189288 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/8:0/stats b/test/sys/kernel/debug/bdi/8:0/stats deleted file mode 100644 index 1c5a4fc6e4..0000000000 --- a/test/sys/kernel/debug/bdi/8:0/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 13696 kB -BdiDirtyThresh: 83368 kB -DirtyThresh: 189292 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/8:16/stats b/test/sys/kernel/debug/bdi/8:16/stats deleted file mode 100644 index cf9d91d60e..0000000000 --- a/test/sys/kernel/debug/bdi/8:16/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189272 kB -BackgroundThresh: 94636 kB diff --git a/test/sys/kernel/debug/bdi/9:0/stats b/test/sys/kernel/debug/bdi/9:0/stats deleted file mode 100644 index a909944b30..0000000000 --- a/test/sys/kernel/debug/bdi/9:0/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189292 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/bdi/default/stats b/test/sys/kernel/debug/bdi/default/stats deleted file mode 100644 index a909944b30..0000000000 --- a/test/sys/kernel/debug/bdi/default/stats +++ /dev/null @@ -1,5 +0,0 @@ -BdiWriteback: 0 kB -BdiReclaimable: 0 kB -BdiDirtyThresh: 0 kB -DirtyThresh: 189292 kB -BackgroundThresh: 94644 kB diff --git a/test/sys/kernel/debug/x86/pat_memtype_list b/test/sys/kernel/debug/x86/pat_memtype_list deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/kexec_crash_loaded b/test/sys/kernel/kexec_crash_loaded deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/kexec_crash_loaded +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/kexec_loaded b/test/sys/kernel/kexec_loaded deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/kexec_loaded +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/notes b/test/sys/kernel/notes deleted file mode 100644 index 7b82063519..0000000000 Binary files a/test/sys/kernel/notes and /dev/null differ diff --git a/test/sys/kernel/slab/Acpi-Namespace/aliases b/test/sys/kernel/slab/Acpi-Namespace/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/align b/test/sys/kernel/slab/Acpi-Namespace/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/alloc_calls b/test/sys/kernel/slab/Acpi-Namespace/alloc_calls deleted file mode 100644 index c6f4ed8d9e..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1709 acpi_ns_create_node+0x34/0x45 age=8375345/8379655/8379737 pid=0-330 cpus=0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/cache_dma b/test/sys/kernel/slab/Acpi-Namespace/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/cpu_slabs b/test/sys/kernel/slab/Acpi-Namespace/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/ctor b/test/sys/kernel/slab/Acpi-Namespace/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu b/test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/free_calls b/test/sys/kernel/slab/Acpi-Namespace/free_calls deleted file mode 100644 index c1a5ab5032..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/free_calls +++ /dev/null @@ -1 +0,0 @@ - 1709 age=4303047034 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/hwcache_align b/test/sys/kernel/slab/Acpi-Namespace/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/object_size b/test/sys/kernel/slab/Acpi-Namespace/object_size deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/object_size +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/Acpi-Namespace/objects b/test/sys/kernel/slab/Acpi-Namespace/objects deleted file mode 100644 index 44b88aa386..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/objects +++ /dev/null @@ -1 +0,0 @@ -1709 diff --git a/test/sys/kernel/slab/Acpi-Namespace/objects_partial b/test/sys/kernel/slab/Acpi-Namespace/objects_partial deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/objects_partial +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/Acpi-Namespace/objs_per_slab b/test/sys/kernel/slab/Acpi-Namespace/objs_per_slab deleted file mode 100644 index a2720097dc..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -39 diff --git a/test/sys/kernel/slab/Acpi-Namespace/order b/test/sys/kernel/slab/Acpi-Namespace/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/partial b/test/sys/kernel/slab/Acpi-Namespace/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/Acpi-Namespace/poison b/test/sys/kernel/slab/Acpi-Namespace/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Namespace/reclaim_account b/test/sys/kernel/slab/Acpi-Namespace/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/red_zone b/test/sys/kernel/slab/Acpi-Namespace/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Namespace/sanity_checks b/test/sys/kernel/slab/Acpi-Namespace/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Namespace/shrink b/test/sys/kernel/slab/Acpi-Namespace/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-Namespace/slab_size b/test/sys/kernel/slab/Acpi-Namespace/slab_size deleted file mode 100644 index b16e5f75e3..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/slab_size +++ /dev/null @@ -1 +0,0 @@ -104 diff --git a/test/sys/kernel/slab/Acpi-Namespace/slabs b/test/sys/kernel/slab/Acpi-Namespace/slabs deleted file mode 100644 index ea90ee3198..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/slabs +++ /dev/null @@ -1 +0,0 @@ -45 diff --git a/test/sys/kernel/slab/Acpi-Namespace/store_user b/test/sys/kernel/slab/Acpi-Namespace/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Namespace/total_objects b/test/sys/kernel/slab/Acpi-Namespace/total_objects deleted file mode 100644 index 2358ac3b44..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/total_objects +++ /dev/null @@ -1 +0,0 @@ -1755 diff --git a/test/sys/kernel/slab/Acpi-Namespace/trace b/test/sys/kernel/slab/Acpi-Namespace/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Namespace/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Namespace/validate b/test/sys/kernel/slab/Acpi-Namespace/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-Operand/aliases b/test/sys/kernel/slab/Acpi-Operand/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Operand/align b/test/sys/kernel/slab/Acpi-Operand/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Operand/alloc_calls b/test/sys/kernel/slab/Acpi-Operand/alloc_calls deleted file mode 100644 index b86ef24d54..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2653 acpi_ut_allocate_object_desc_dbg+0x39/0x75 age=2625/8339457/8379700 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/Acpi-Operand/cache_dma b/test/sys/kernel/slab/Acpi-Operand/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Operand/cpu_slabs b/test/sys/kernel/slab/Acpi-Operand/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Operand/ctor b/test/sys/kernel/slab/Acpi-Operand/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu b/test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Operand/free_calls b/test/sys/kernel/slab/Acpi-Operand/free_calls deleted file mode 100644 index 8459645dbb..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 2267 age=4303046997 pid=0 cpus=0 - 386 acpi_os_release_object+0x9/0xd age=2626/8137233/8379689 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/Acpi-Operand/hwcache_align b/test/sys/kernel/slab/Acpi-Operand/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Operand/object_size b/test/sys/kernel/slab/Acpi-Operand/object_size deleted file mode 100644 index ea70ce0134..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/object_size +++ /dev/null @@ -1 +0,0 @@ -72 diff --git a/test/sys/kernel/slab/Acpi-Operand/objects b/test/sys/kernel/slab/Acpi-Operand/objects deleted file mode 100644 index 4633262609..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/objects +++ /dev/null @@ -1 +0,0 @@ -2663 diff --git a/test/sys/kernel/slab/Acpi-Operand/objects_partial b/test/sys/kernel/slab/Acpi-Operand/objects_partial deleted file mode 100644 index b34c321e9c..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/objects_partial +++ /dev/null @@ -1 +0,0 @@ -171 diff --git a/test/sys/kernel/slab/Acpi-Operand/objs_per_slab b/test/sys/kernel/slab/Acpi-Operand/objs_per_slab deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/Acpi-Operand/order b/test/sys/kernel/slab/Acpi-Operand/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Operand/partial b/test/sys/kernel/slab/Acpi-Operand/partial deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/partial +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/Acpi-Operand/poison b/test/sys/kernel/slab/Acpi-Operand/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Operand/reclaim_account b/test/sys/kernel/slab/Acpi-Operand/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Operand/red_zone b/test/sys/kernel/slab/Acpi-Operand/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Operand/sanity_checks b/test/sys/kernel/slab/Acpi-Operand/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Operand/shrink b/test/sys/kernel/slab/Acpi-Operand/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-Operand/slab_size b/test/sys/kernel/slab/Acpi-Operand/slab_size deleted file mode 100644 index a29644e57e..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/slab_size +++ /dev/null @@ -1 +0,0 @@ -144 diff --git a/test/sys/kernel/slab/Acpi-Operand/slabs b/test/sys/kernel/slab/Acpi-Operand/slabs deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/slabs +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/Acpi-Operand/store_user b/test/sys/kernel/slab/Acpi-Operand/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Operand/total_objects b/test/sys/kernel/slab/Acpi-Operand/total_objects deleted file mode 100644 index 9e46834fcb..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/total_objects +++ /dev/null @@ -1 +0,0 @@ -2688 diff --git a/test/sys/kernel/slab/Acpi-Operand/trace b/test/sys/kernel/slab/Acpi-Operand/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Operand/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Operand/validate b/test/sys/kernel/slab/Acpi-Operand/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-Parse/aliases b/test/sys/kernel/slab/Acpi-Parse/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/align b/test/sys/kernel/slab/Acpi-Parse/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/alloc_calls b/test/sys/kernel/slab/Acpi-Parse/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/Acpi-Parse/cache_dma b/test/sys/kernel/slab/Acpi-Parse/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/cpu_slabs b/test/sys/kernel/slab/Acpi-Parse/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/ctor b/test/sys/kernel/slab/Acpi-Parse/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu b/test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/free_calls b/test/sys/kernel/slab/Acpi-Parse/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/Acpi-Parse/hwcache_align b/test/sys/kernel/slab/Acpi-Parse/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/object_size b/test/sys/kernel/slab/Acpi-Parse/object_size deleted file mode 100644 index 21e72e8ac3..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/object_size +++ /dev/null @@ -1 +0,0 @@ -48 diff --git a/test/sys/kernel/slab/Acpi-Parse/objects b/test/sys/kernel/slab/Acpi-Parse/objects deleted file mode 100644 index 38b10c1b2b..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/objects +++ /dev/null @@ -1 +0,0 @@ -68 diff --git a/test/sys/kernel/slab/Acpi-Parse/objects_partial b/test/sys/kernel/slab/Acpi-Parse/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/objs_per_slab b/test/sys/kernel/slab/Acpi-Parse/objs_per_slab deleted file mode 100644 index a787364590..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -34 diff --git a/test/sys/kernel/slab/Acpi-Parse/order b/test/sys/kernel/slab/Acpi-Parse/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/partial b/test/sys/kernel/slab/Acpi-Parse/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/poison b/test/sys/kernel/slab/Acpi-Parse/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Parse/reclaim_account b/test/sys/kernel/slab/Acpi-Parse/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/red_zone b/test/sys/kernel/slab/Acpi-Parse/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Parse/sanity_checks b/test/sys/kernel/slab/Acpi-Parse/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Parse/shrink b/test/sys/kernel/slab/Acpi-Parse/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-Parse/slab_size b/test/sys/kernel/slab/Acpi-Parse/slab_size deleted file mode 100644 index 52bd8e43af..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/slab_size +++ /dev/null @@ -1 +0,0 @@ -120 diff --git a/test/sys/kernel/slab/Acpi-Parse/slabs b/test/sys/kernel/slab/Acpi-Parse/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/Acpi-Parse/store_user b/test/sys/kernel/slab/Acpi-Parse/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-Parse/total_objects b/test/sys/kernel/slab/Acpi-Parse/total_objects deleted file mode 100644 index 38b10c1b2b..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/total_objects +++ /dev/null @@ -1 +0,0 @@ -68 diff --git a/test/sys/kernel/slab/Acpi-Parse/trace b/test/sys/kernel/slab/Acpi-Parse/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-Parse/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-Parse/validate b/test/sys/kernel/slab/Acpi-Parse/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/aliases b/test/sys/kernel/slab/Acpi-ParseExt/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/align b/test/sys/kernel/slab/Acpi-ParseExt/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/alloc_calls b/test/sys/kernel/slab/Acpi-ParseExt/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/Acpi-ParseExt/cache_dma b/test/sys/kernel/slab/Acpi-ParseExt/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs b/test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/ctor b/test/sys/kernel/slab/Acpi-ParseExt/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu b/test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/free_calls b/test/sys/kernel/slab/Acpi-ParseExt/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/Acpi-ParseExt/hwcache_align b/test/sys/kernel/slab/Acpi-ParseExt/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/object_size b/test/sys/kernel/slab/Acpi-ParseExt/object_size deleted file mode 100644 index ea70ce0134..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/object_size +++ /dev/null @@ -1 +0,0 @@ -72 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/objects b/test/sys/kernel/slab/Acpi-ParseExt/objects deleted file mode 100644 index f6b91e0e1f..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/objects +++ /dev/null @@ -1 +0,0 @@ -56 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/objects_partial b/test/sys/kernel/slab/Acpi-ParseExt/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab b/test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/order b/test/sys/kernel/slab/Acpi-ParseExt/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/partial b/test/sys/kernel/slab/Acpi-ParseExt/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/poison b/test/sys/kernel/slab/Acpi-ParseExt/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/reclaim_account b/test/sys/kernel/slab/Acpi-ParseExt/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/red_zone b/test/sys/kernel/slab/Acpi-ParseExt/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/sanity_checks b/test/sys/kernel/slab/Acpi-ParseExt/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/shrink b/test/sys/kernel/slab/Acpi-ParseExt/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/slab_size b/test/sys/kernel/slab/Acpi-ParseExt/slab_size deleted file mode 100644 index a29644e57e..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/slab_size +++ /dev/null @@ -1 +0,0 @@ -144 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/slabs b/test/sys/kernel/slab/Acpi-ParseExt/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/store_user b/test/sys/kernel/slab/Acpi-ParseExt/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/total_objects b/test/sys/kernel/slab/Acpi-ParseExt/total_objects deleted file mode 100644 index f6b91e0e1f..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/total_objects +++ /dev/null @@ -1 +0,0 @@ -56 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/trace b/test/sys/kernel/slab/Acpi-ParseExt/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-ParseExt/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-ParseExt/validate b/test/sys/kernel/slab/Acpi-ParseExt/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-State/aliases b/test/sys/kernel/slab/Acpi-State/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/align b/test/sys/kernel/slab/Acpi-State/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/alloc_calls b/test/sys/kernel/slab/Acpi-State/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/Acpi-State/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/Acpi-State/cache_dma b/test/sys/kernel/slab/Acpi-State/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/cpu_slabs b/test/sys/kernel/slab/Acpi-State/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/ctor b/test/sys/kernel/slab/Acpi-State/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-State/destroy_by_rcu b/test/sys/kernel/slab/Acpi-State/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/free_calls b/test/sys/kernel/slab/Acpi-State/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/Acpi-State/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/Acpi-State/hwcache_align b/test/sys/kernel/slab/Acpi-State/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/object_size b/test/sys/kernel/slab/Acpi-State/object_size deleted file mode 100644 index d15a2cc44e..0000000000 --- a/test/sys/kernel/slab/Acpi-State/object_size +++ /dev/null @@ -1 +0,0 @@ -80 diff --git a/test/sys/kernel/slab/Acpi-State/objects b/test/sys/kernel/slab/Acpi-State/objects deleted file mode 100644 index 0691f67b20..0000000000 --- a/test/sys/kernel/slab/Acpi-State/objects +++ /dev/null @@ -1 +0,0 @@ -52 diff --git a/test/sys/kernel/slab/Acpi-State/objects_partial b/test/sys/kernel/slab/Acpi-State/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/objs_per_slab b/test/sys/kernel/slab/Acpi-State/objs_per_slab deleted file mode 100644 index 6f4247a625..0000000000 --- a/test/sys/kernel/slab/Acpi-State/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -26 diff --git a/test/sys/kernel/slab/Acpi-State/order b/test/sys/kernel/slab/Acpi-State/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/partial b/test/sys/kernel/slab/Acpi-State/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/poison b/test/sys/kernel/slab/Acpi-State/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-State/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-State/reclaim_account b/test/sys/kernel/slab/Acpi-State/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/red_zone b/test/sys/kernel/slab/Acpi-State/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-State/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-State/sanity_checks b/test/sys/kernel/slab/Acpi-State/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-State/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-State/shrink b/test/sys/kernel/slab/Acpi-State/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/Acpi-State/slab_size b/test/sys/kernel/slab/Acpi-State/slab_size deleted file mode 100644 index 492dff089a..0000000000 --- a/test/sys/kernel/slab/Acpi-State/slab_size +++ /dev/null @@ -1 +0,0 @@ -152 diff --git a/test/sys/kernel/slab/Acpi-State/slabs b/test/sys/kernel/slab/Acpi-State/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/Acpi-State/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/Acpi-State/store_user b/test/sys/kernel/slab/Acpi-State/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/Acpi-State/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/Acpi-State/total_objects b/test/sys/kernel/slab/Acpi-State/total_objects deleted file mode 100644 index 0691f67b20..0000000000 --- a/test/sys/kernel/slab/Acpi-State/total_objects +++ /dev/null @@ -1 +0,0 @@ -52 diff --git a/test/sys/kernel/slab/Acpi-State/trace b/test/sys/kernel/slab/Acpi-State/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/Acpi-State/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/Acpi-State/validate b/test/sys/kernel/slab/Acpi-State/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/RAW/aliases b/test/sys/kernel/slab/RAW/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAW/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAW/align b/test/sys/kernel/slab/RAW/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAW/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAW/alloc_calls b/test/sys/kernel/slab/RAW/alloc_calls deleted file mode 100644 index fd834f1a86..0000000000 --- a/test/sys/kernel/slab/RAW/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 3 sk_prot_alloc+0x1e/0xb0 age=8379168/8379171/8379177 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/RAW/cache_dma b/test/sys/kernel/slab/RAW/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAW/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAW/cpu_slabs b/test/sys/kernel/slab/RAW/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAW/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAW/ctor b/test/sys/kernel/slab/RAW/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/RAW/destroy_by_rcu b/test/sys/kernel/slab/RAW/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAW/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAW/free_calls b/test/sys/kernel/slab/RAW/free_calls deleted file mode 100644 index ce52248534..0000000000 --- a/test/sys/kernel/slab/RAW/free_calls +++ /dev/null @@ -1 +0,0 @@ - 3 age=4303046751 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/RAW/hwcache_align b/test/sys/kernel/slab/RAW/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAW/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAW/object_size b/test/sys/kernel/slab/RAW/object_size deleted file mode 100644 index 42d797944e..0000000000 --- a/test/sys/kernel/slab/RAW/object_size +++ /dev/null @@ -1 +0,0 @@ -1208 diff --git a/test/sys/kernel/slab/RAW/objects b/test/sys/kernel/slab/RAW/objects deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/RAW/objects +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/RAW/objects_partial b/test/sys/kernel/slab/RAW/objects_partial deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/RAW/objects_partial +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/RAW/objs_per_slab b/test/sys/kernel/slab/RAW/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/RAW/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/RAW/order b/test/sys/kernel/slab/RAW/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/RAW/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/RAW/partial b/test/sys/kernel/slab/RAW/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAW/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAW/poison b/test/sys/kernel/slab/RAW/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAW/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAW/reclaim_account b/test/sys/kernel/slab/RAW/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAW/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAW/red_zone b/test/sys/kernel/slab/RAW/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAW/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAW/sanity_checks b/test/sys/kernel/slab/RAW/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAW/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAW/shrink b/test/sys/kernel/slab/RAW/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/RAW/slab_size b/test/sys/kernel/slab/RAW/slab_size deleted file mode 100644 index 003638ac6a..0000000000 --- a/test/sys/kernel/slab/RAW/slab_size +++ /dev/null @@ -1 +0,0 @@ -1280 diff --git a/test/sys/kernel/slab/RAW/slabs b/test/sys/kernel/slab/RAW/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAW/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAW/store_user b/test/sys/kernel/slab/RAW/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAW/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAW/total_objects b/test/sys/kernel/slab/RAW/total_objects deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/RAW/total_objects +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/RAW/trace b/test/sys/kernel/slab/RAW/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAW/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAW/validate b/test/sys/kernel/slab/RAW/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/RAWv6/aliases b/test/sys/kernel/slab/RAWv6/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAWv6/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAWv6/align b/test/sys/kernel/slab/RAWv6/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAWv6/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAWv6/alloc_calls b/test/sys/kernel/slab/RAWv6/alloc_calls deleted file mode 100644 index 434e0be2cf..0000000000 --- a/test/sys/kernel/slab/RAWv6/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 5 sk_prot_alloc+0x1e/0xb0 age=8360545/8360552/8360555 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/RAWv6/cache_dma b/test/sys/kernel/slab/RAWv6/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAWv6/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAWv6/cpu_slabs b/test/sys/kernel/slab/RAWv6/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAWv6/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAWv6/ctor b/test/sys/kernel/slab/RAWv6/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/RAWv6/destroy_by_rcu b/test/sys/kernel/slab/RAWv6/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAWv6/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAWv6/free_calls b/test/sys/kernel/slab/RAWv6/free_calls deleted file mode 100644 index a25d5a189b..0000000000 --- a/test/sys/kernel/slab/RAWv6/free_calls +++ /dev/null @@ -1 +0,0 @@ - 5 age=4303047773 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/RAWv6/hwcache_align b/test/sys/kernel/slab/RAWv6/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAWv6/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAWv6/object_size b/test/sys/kernel/slab/RAWv6/object_size deleted file mode 100644 index 10570a3409..0000000000 --- a/test/sys/kernel/slab/RAWv6/object_size +++ /dev/null @@ -1 +0,0 @@ -1376 diff --git a/test/sys/kernel/slab/RAWv6/objects b/test/sys/kernel/slab/RAWv6/objects deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/RAWv6/objects +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/RAWv6/objects_partial b/test/sys/kernel/slab/RAWv6/objects_partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/RAWv6/objects_partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/RAWv6/objs_per_slab b/test/sys/kernel/slab/RAWv6/objs_per_slab deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/RAWv6/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/RAWv6/order b/test/sys/kernel/slab/RAWv6/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/RAWv6/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/RAWv6/partial b/test/sys/kernel/slab/RAWv6/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAWv6/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAWv6/poison b/test/sys/kernel/slab/RAWv6/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAWv6/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAWv6/reclaim_account b/test/sys/kernel/slab/RAWv6/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAWv6/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAWv6/red_zone b/test/sys/kernel/slab/RAWv6/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAWv6/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAWv6/sanity_checks b/test/sys/kernel/slab/RAWv6/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAWv6/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAWv6/shrink b/test/sys/kernel/slab/RAWv6/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/RAWv6/slab_size b/test/sys/kernel/slab/RAWv6/slab_size deleted file mode 100644 index bfc0bcc570..0000000000 --- a/test/sys/kernel/slab/RAWv6/slab_size +++ /dev/null @@ -1 +0,0 @@ -1472 diff --git a/test/sys/kernel/slab/RAWv6/slabs b/test/sys/kernel/slab/RAWv6/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAWv6/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAWv6/store_user b/test/sys/kernel/slab/RAWv6/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/RAWv6/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/RAWv6/total_objects b/test/sys/kernel/slab/RAWv6/total_objects deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/RAWv6/total_objects +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/RAWv6/trace b/test/sys/kernel/slab/RAWv6/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/RAWv6/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/RAWv6/validate b/test/sys/kernel/slab/RAWv6/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/TCP/aliases b/test/sys/kernel/slab/TCP/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCP/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCP/align b/test/sys/kernel/slab/TCP/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCP/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCP/alloc_calls b/test/sys/kernel/slab/TCP/alloc_calls deleted file mode 100644 index 7d42046b4a..0000000000 --- a/test/sys/kernel/slab/TCP/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 3 sk_prot_alloc+0x1e/0xb0 age=926836/5879023/8356238 pid=1206-1920 cpus=0 diff --git a/test/sys/kernel/slab/TCP/cache_dma b/test/sys/kernel/slab/TCP/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCP/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCP/cpu_slabs b/test/sys/kernel/slab/TCP/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCP/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCP/ctor b/test/sys/kernel/slab/TCP/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/TCP/destroy_by_rcu b/test/sys/kernel/slab/TCP/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCP/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCP/free_calls b/test/sys/kernel/slab/TCP/free_calls deleted file mode 100644 index ea0c7ed6af..0000000000 --- a/test/sys/kernel/slab/TCP/free_calls +++ /dev/null @@ -1 +0,0 @@ - 3 sk_free+0x80/0x100 age=932105/5881414/8356684 pid=0-1762 cpus=0 diff --git a/test/sys/kernel/slab/TCP/hwcache_align b/test/sys/kernel/slab/TCP/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCP/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCP/object_size b/test/sys/kernel/slab/TCP/object_size deleted file mode 100644 index fca0e8a08c..0000000000 --- a/test/sys/kernel/slab/TCP/object_size +++ /dev/null @@ -1 +0,0 @@ -2200 diff --git a/test/sys/kernel/slab/TCP/objects b/test/sys/kernel/slab/TCP/objects deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/TCP/objects +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/TCP/objects_partial b/test/sys/kernel/slab/TCP/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCP/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCP/objs_per_slab b/test/sys/kernel/slab/TCP/objs_per_slab deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/TCP/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/TCP/order b/test/sys/kernel/slab/TCP/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/TCP/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/TCP/partial b/test/sys/kernel/slab/TCP/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCP/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCP/poison b/test/sys/kernel/slab/TCP/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCP/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCP/reclaim_account b/test/sys/kernel/slab/TCP/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCP/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCP/red_zone b/test/sys/kernel/slab/TCP/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCP/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCP/sanity_checks b/test/sys/kernel/slab/TCP/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCP/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCP/shrink b/test/sys/kernel/slab/TCP/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/TCP/slab_size b/test/sys/kernel/slab/TCP/slab_size deleted file mode 100644 index c801f0a47c..0000000000 --- a/test/sys/kernel/slab/TCP/slab_size +++ /dev/null @@ -1 +0,0 @@ -2304 diff --git a/test/sys/kernel/slab/TCP/slabs b/test/sys/kernel/slab/TCP/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/TCP/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/TCP/store_user b/test/sys/kernel/slab/TCP/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCP/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCP/total_objects b/test/sys/kernel/slab/TCP/total_objects deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/TCP/total_objects +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/TCP/trace b/test/sys/kernel/slab/TCP/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCP/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCP/validate b/test/sys/kernel/slab/TCP/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/TCPv6/aliases b/test/sys/kernel/slab/TCPv6/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCPv6/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCPv6/align b/test/sys/kernel/slab/TCPv6/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCPv6/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCPv6/alloc_calls b/test/sys/kernel/slab/TCPv6/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/TCPv6/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/TCPv6/cache_dma b/test/sys/kernel/slab/TCPv6/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCPv6/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCPv6/cpu_slabs b/test/sys/kernel/slab/TCPv6/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCPv6/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCPv6/ctor b/test/sys/kernel/slab/TCPv6/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/TCPv6/destroy_by_rcu b/test/sys/kernel/slab/TCPv6/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCPv6/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCPv6/free_calls b/test/sys/kernel/slab/TCPv6/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/TCPv6/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/TCPv6/hwcache_align b/test/sys/kernel/slab/TCPv6/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCPv6/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCPv6/object_size b/test/sys/kernel/slab/TCPv6/object_size deleted file mode 100644 index d61563f929..0000000000 --- a/test/sys/kernel/slab/TCPv6/object_size +++ /dev/null @@ -1 +0,0 @@ -2336 diff --git a/test/sys/kernel/slab/TCPv6/objects b/test/sys/kernel/slab/TCPv6/objects deleted file mode 100644 index 6f4247a625..0000000000 --- a/test/sys/kernel/slab/TCPv6/objects +++ /dev/null @@ -1 +0,0 @@ -26 diff --git a/test/sys/kernel/slab/TCPv6/objects_partial b/test/sys/kernel/slab/TCPv6/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCPv6/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCPv6/objs_per_slab b/test/sys/kernel/slab/TCPv6/objs_per_slab deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/kernel/slab/TCPv6/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/kernel/slab/TCPv6/order b/test/sys/kernel/slab/TCPv6/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/TCPv6/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/TCPv6/partial b/test/sys/kernel/slab/TCPv6/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCPv6/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCPv6/poison b/test/sys/kernel/slab/TCPv6/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCPv6/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCPv6/reclaim_account b/test/sys/kernel/slab/TCPv6/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCPv6/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCPv6/red_zone b/test/sys/kernel/slab/TCPv6/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCPv6/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCPv6/sanity_checks b/test/sys/kernel/slab/TCPv6/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCPv6/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCPv6/shrink b/test/sys/kernel/slab/TCPv6/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/TCPv6/slab_size b/test/sys/kernel/slab/TCPv6/slab_size deleted file mode 100644 index e576ab3169..0000000000 --- a/test/sys/kernel/slab/TCPv6/slab_size +++ /dev/null @@ -1 +0,0 @@ -2432 diff --git a/test/sys/kernel/slab/TCPv6/slabs b/test/sys/kernel/slab/TCPv6/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/TCPv6/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/TCPv6/store_user b/test/sys/kernel/slab/TCPv6/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/TCPv6/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/TCPv6/total_objects b/test/sys/kernel/slab/TCPv6/total_objects deleted file mode 100644 index 6f4247a625..0000000000 --- a/test/sys/kernel/slab/TCPv6/total_objects +++ /dev/null @@ -1 +0,0 @@ -26 diff --git a/test/sys/kernel/slab/TCPv6/trace b/test/sys/kernel/slab/TCPv6/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/TCPv6/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/TCPv6/validate b/test/sys/kernel/slab/TCPv6/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDP-Lite/aliases b/test/sys/kernel/slab/UDP-Lite/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/align b/test/sys/kernel/slab/UDP-Lite/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/alloc_calls b/test/sys/kernel/slab/UDP-Lite/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/UDP-Lite/cache_dma b/test/sys/kernel/slab/UDP-Lite/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/cpu_slabs b/test/sys/kernel/slab/UDP-Lite/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/ctor b/test/sys/kernel/slab/UDP-Lite/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDP-Lite/destroy_by_rcu b/test/sys/kernel/slab/UDP-Lite/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/free_calls b/test/sys/kernel/slab/UDP-Lite/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/UDP-Lite/hwcache_align b/test/sys/kernel/slab/UDP-Lite/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP-Lite/object_size b/test/sys/kernel/slab/UDP-Lite/object_size deleted file mode 100644 index 9ee8e02295..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/object_size +++ /dev/null @@ -1 +0,0 @@ -1232 diff --git a/test/sys/kernel/slab/UDP-Lite/objects b/test/sys/kernel/slab/UDP-Lite/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/objects_partial b/test/sys/kernel/slab/UDP-Lite/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/objs_per_slab b/test/sys/kernel/slab/UDP-Lite/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/UDP-Lite/order b/test/sys/kernel/slab/UDP-Lite/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/UDP-Lite/partial b/test/sys/kernel/slab/UDP-Lite/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/poison b/test/sys/kernel/slab/UDP-Lite/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP-Lite/reclaim_account b/test/sys/kernel/slab/UDP-Lite/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/red_zone b/test/sys/kernel/slab/UDP-Lite/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP-Lite/sanity_checks b/test/sys/kernel/slab/UDP-Lite/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP-Lite/shrink b/test/sys/kernel/slab/UDP-Lite/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDP-Lite/slab_size b/test/sys/kernel/slab/UDP-Lite/slab_size deleted file mode 100644 index 3f3c936679..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/slab_size +++ /dev/null @@ -1 +0,0 @@ -1344 diff --git a/test/sys/kernel/slab/UDP-Lite/slabs b/test/sys/kernel/slab/UDP-Lite/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/store_user b/test/sys/kernel/slab/UDP-Lite/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP-Lite/total_objects b/test/sys/kernel/slab/UDP-Lite/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/trace b/test/sys/kernel/slab/UDP-Lite/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP-Lite/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP-Lite/validate b/test/sys/kernel/slab/UDP-Lite/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDP/aliases b/test/sys/kernel/slab/UDP/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP/align b/test/sys/kernel/slab/UDP/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP/alloc_calls b/test/sys/kernel/slab/UDP/alloc_calls deleted file mode 100644 index 6adaa44484..0000000000 --- a/test/sys/kernel/slab/UDP/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 5 sk_prot_alloc+0x1e/0xb0 age=8327731/8349275/8355457 pid=1545-2586 cpus=0-1 diff --git a/test/sys/kernel/slab/UDP/cache_dma b/test/sys/kernel/slab/UDP/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP/cpu_slabs b/test/sys/kernel/slab/UDP/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP/ctor b/test/sys/kernel/slab/UDP/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDP/destroy_by_rcu b/test/sys/kernel/slab/UDP/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP/free_calls b/test/sys/kernel/slab/UDP/free_calls deleted file mode 100644 index 142010e3b7..0000000000 --- a/test/sys/kernel/slab/UDP/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 1 age=4303046759 pid=0 cpus=0 - 4 sk_free+0x80/0x100 age=8327731/8350484/8364461 pid=1371-2586 cpus=0-1 diff --git a/test/sys/kernel/slab/UDP/hwcache_align b/test/sys/kernel/slab/UDP/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP/object_size b/test/sys/kernel/slab/UDP/object_size deleted file mode 100644 index 9ee8e02295..0000000000 --- a/test/sys/kernel/slab/UDP/object_size +++ /dev/null @@ -1 +0,0 @@ -1232 diff --git a/test/sys/kernel/slab/UDP/objects b/test/sys/kernel/slab/UDP/objects deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/UDP/objects +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/UDP/objects_partial b/test/sys/kernel/slab/UDP/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP/objs_per_slab b/test/sys/kernel/slab/UDP/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/UDP/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/UDP/order b/test/sys/kernel/slab/UDP/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/UDP/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/UDP/partial b/test/sys/kernel/slab/UDP/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP/poison b/test/sys/kernel/slab/UDP/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP/reclaim_account b/test/sys/kernel/slab/UDP/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP/red_zone b/test/sys/kernel/slab/UDP/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP/sanity_checks b/test/sys/kernel/slab/UDP/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP/shrink b/test/sys/kernel/slab/UDP/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDP/slab_size b/test/sys/kernel/slab/UDP/slab_size deleted file mode 100644 index 3f3c936679..0000000000 --- a/test/sys/kernel/slab/UDP/slab_size +++ /dev/null @@ -1 +0,0 @@ -1344 diff --git a/test/sys/kernel/slab/UDP/slabs b/test/sys/kernel/slab/UDP/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/UDP/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/UDP/store_user b/test/sys/kernel/slab/UDP/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDP/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDP/total_objects b/test/sys/kernel/slab/UDP/total_objects deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/UDP/total_objects +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/UDP/trace b/test/sys/kernel/slab/UDP/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDP/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDP/validate b/test/sys/kernel/slab/UDP/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDPLITEv6/aliases b/test/sys/kernel/slab/UDPLITEv6/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/align b/test/sys/kernel/slab/UDPLITEv6/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/alloc_calls b/test/sys/kernel/slab/UDPLITEv6/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/UDPLITEv6/cache_dma b/test/sys/kernel/slab/UDPLITEv6/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/cpu_slabs b/test/sys/kernel/slab/UDPLITEv6/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/ctor b/test/sys/kernel/slab/UDPLITEv6/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu b/test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/free_calls b/test/sys/kernel/slab/UDPLITEv6/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/UDPLITEv6/hwcache_align b/test/sys/kernel/slab/UDPLITEv6/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPLITEv6/object_size b/test/sys/kernel/slab/UDPLITEv6/object_size deleted file mode 100644 index 8a055dcf59..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/object_size +++ /dev/null @@ -1 +0,0 @@ -1368 diff --git a/test/sys/kernel/slab/UDPLITEv6/objects b/test/sys/kernel/slab/UDPLITEv6/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/objects_partial b/test/sys/kernel/slab/UDPLITEv6/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/objs_per_slab b/test/sys/kernel/slab/UDPLITEv6/objs_per_slab deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/UDPLITEv6/order b/test/sys/kernel/slab/UDPLITEv6/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/UDPLITEv6/partial b/test/sys/kernel/slab/UDPLITEv6/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/poison b/test/sys/kernel/slab/UDPLITEv6/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPLITEv6/reclaim_account b/test/sys/kernel/slab/UDPLITEv6/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/red_zone b/test/sys/kernel/slab/UDPLITEv6/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPLITEv6/sanity_checks b/test/sys/kernel/slab/UDPLITEv6/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPLITEv6/shrink b/test/sys/kernel/slab/UDPLITEv6/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDPLITEv6/slab_size b/test/sys/kernel/slab/UDPLITEv6/slab_size deleted file mode 100644 index bfc0bcc570..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/slab_size +++ /dev/null @@ -1 +0,0 @@ -1472 diff --git a/test/sys/kernel/slab/UDPLITEv6/slabs b/test/sys/kernel/slab/UDPLITEv6/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/store_user b/test/sys/kernel/slab/UDPLITEv6/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPLITEv6/total_objects b/test/sys/kernel/slab/UDPLITEv6/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/trace b/test/sys/kernel/slab/UDPLITEv6/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPLITEv6/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPLITEv6/validate b/test/sys/kernel/slab/UDPLITEv6/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDPv6/aliases b/test/sys/kernel/slab/UDPv6/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPv6/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPv6/align b/test/sys/kernel/slab/UDPv6/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPv6/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPv6/alloc_calls b/test/sys/kernel/slab/UDPv6/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/UDPv6/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/UDPv6/cache_dma b/test/sys/kernel/slab/UDPv6/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPv6/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPv6/cpu_slabs b/test/sys/kernel/slab/UDPv6/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPv6/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPv6/ctor b/test/sys/kernel/slab/UDPv6/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDPv6/destroy_by_rcu b/test/sys/kernel/slab/UDPv6/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPv6/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPv6/free_calls b/test/sys/kernel/slab/UDPv6/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/UDPv6/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/UDPv6/hwcache_align b/test/sys/kernel/slab/UDPv6/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPv6/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPv6/object_size b/test/sys/kernel/slab/UDPv6/object_size deleted file mode 100644 index 8a055dcf59..0000000000 --- a/test/sys/kernel/slab/UDPv6/object_size +++ /dev/null @@ -1 +0,0 @@ -1368 diff --git a/test/sys/kernel/slab/UDPv6/objects b/test/sys/kernel/slab/UDPv6/objects deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/UDPv6/objects +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/UDPv6/objects_partial b/test/sys/kernel/slab/UDPv6/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPv6/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPv6/objs_per_slab b/test/sys/kernel/slab/UDPv6/objs_per_slab deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/UDPv6/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/UDPv6/order b/test/sys/kernel/slab/UDPv6/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/UDPv6/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/UDPv6/partial b/test/sys/kernel/slab/UDPv6/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPv6/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPv6/poison b/test/sys/kernel/slab/UDPv6/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPv6/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPv6/reclaim_account b/test/sys/kernel/slab/UDPv6/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPv6/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPv6/red_zone b/test/sys/kernel/slab/UDPv6/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPv6/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPv6/sanity_checks b/test/sys/kernel/slab/UDPv6/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPv6/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPv6/shrink b/test/sys/kernel/slab/UDPv6/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UDPv6/slab_size b/test/sys/kernel/slab/UDPv6/slab_size deleted file mode 100644 index bfc0bcc570..0000000000 --- a/test/sys/kernel/slab/UDPv6/slab_size +++ /dev/null @@ -1 +0,0 @@ -1472 diff --git a/test/sys/kernel/slab/UDPv6/slabs b/test/sys/kernel/slab/UDPv6/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPv6/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPv6/store_user b/test/sys/kernel/slab/UDPv6/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UDPv6/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UDPv6/total_objects b/test/sys/kernel/slab/UDPv6/total_objects deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/UDPv6/total_objects +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/UDPv6/trace b/test/sys/kernel/slab/UDPv6/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UDPv6/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UDPv6/validate b/test/sys/kernel/slab/UDPv6/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UNIX/aliases b/test/sys/kernel/slab/UNIX/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UNIX/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UNIX/align b/test/sys/kernel/slab/UNIX/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UNIX/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UNIX/alloc_calls b/test/sys/kernel/slab/UNIX/alloc_calls deleted file mode 100644 index 4c460087fa..0000000000 --- a/test/sys/kernel/slab/UNIX/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 450 sk_prot_alloc+0x1e/0xb0 age=61033/8220474/8376385 pid=71-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/UNIX/cache_dma b/test/sys/kernel/slab/UNIX/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UNIX/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UNIX/cpu_slabs b/test/sys/kernel/slab/UNIX/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UNIX/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UNIX/ctor b/test/sys/kernel/slab/UNIX/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UNIX/destroy_by_rcu b/test/sys/kernel/slab/UNIX/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UNIX/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UNIX/free_calls b/test/sys/kernel/slab/UNIX/free_calls deleted file mode 100644 index 1ff76ab6cc..0000000000 --- a/test/sys/kernel/slab/UNIX/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 235 age=4303046663 pid=0 cpus=0 - 215 sk_free+0x80/0x100 age=61050/8083366/8375930 pid=76-20292 cpus=0-1 diff --git a/test/sys/kernel/slab/UNIX/hwcache_align b/test/sys/kernel/slab/UNIX/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UNIX/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UNIX/object_size b/test/sys/kernel/slab/UNIX/object_size deleted file mode 100644 index 10570a3409..0000000000 --- a/test/sys/kernel/slab/UNIX/object_size +++ /dev/null @@ -1 +0,0 @@ -1376 diff --git a/test/sys/kernel/slab/UNIX/objects b/test/sys/kernel/slab/UNIX/objects deleted file mode 100644 index 615d0e0532..0000000000 --- a/test/sys/kernel/slab/UNIX/objects +++ /dev/null @@ -1 +0,0 @@ -486 diff --git a/test/sys/kernel/slab/UNIX/objects_partial b/test/sys/kernel/slab/UNIX/objects_partial deleted file mode 100644 index f84d24e50a..0000000000 --- a/test/sys/kernel/slab/UNIX/objects_partial +++ /dev/null @@ -1 +0,0 @@ -178 diff --git a/test/sys/kernel/slab/UNIX/objs_per_slab b/test/sys/kernel/slab/UNIX/objs_per_slab deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/UNIX/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/UNIX/order b/test/sys/kernel/slab/UNIX/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/UNIX/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/UNIX/partial b/test/sys/kernel/slab/UNIX/partial deleted file mode 100644 index ec635144f6..0000000000 --- a/test/sys/kernel/slab/UNIX/partial +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/test/sys/kernel/slab/UNIX/poison b/test/sys/kernel/slab/UNIX/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UNIX/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UNIX/reclaim_account b/test/sys/kernel/slab/UNIX/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UNIX/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UNIX/red_zone b/test/sys/kernel/slab/UNIX/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UNIX/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UNIX/sanity_checks b/test/sys/kernel/slab/UNIX/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UNIX/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UNIX/shrink b/test/sys/kernel/slab/UNIX/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/UNIX/slab_size b/test/sys/kernel/slab/UNIX/slab_size deleted file mode 100644 index bfc0bcc570..0000000000 --- a/test/sys/kernel/slab/UNIX/slab_size +++ /dev/null @@ -1 +0,0 @@ -1472 diff --git a/test/sys/kernel/slab/UNIX/slabs b/test/sys/kernel/slab/UNIX/slabs deleted file mode 100644 index 409940768f..0000000000 --- a/test/sys/kernel/slab/UNIX/slabs +++ /dev/null @@ -1 +0,0 @@ -23 diff --git a/test/sys/kernel/slab/UNIX/store_user b/test/sys/kernel/slab/UNIX/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/UNIX/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/UNIX/total_objects b/test/sys/kernel/slab/UNIX/total_objects deleted file mode 100644 index 80e3e6eab6..0000000000 --- a/test/sys/kernel/slab/UNIX/total_objects +++ /dev/null @@ -1 +0,0 @@ -506 diff --git a/test/sys/kernel/slab/UNIX/trace b/test/sys/kernel/slab/UNIX/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/UNIX/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/UNIX/validate b/test/sys/kernel/slab/UNIX/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/anon_vma/aliases b/test/sys/kernel/slab/anon_vma/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/anon_vma/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/anon_vma/align b/test/sys/kernel/slab/anon_vma/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/anon_vma/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/anon_vma/alloc_calls b/test/sys/kernel/slab/anon_vma/alloc_calls deleted file mode 100644 index c376817f33..0000000000 --- a/test/sys/kernel/slab/anon_vma/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 3234 anon_vma_prepare+0xe0/0x100 age=4177/7981073/8378201 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/anon_vma/cache_dma b/test/sys/kernel/slab/anon_vma/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/anon_vma/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/anon_vma/cpu_slabs b/test/sys/kernel/slab/anon_vma/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/anon_vma/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/anon_vma/ctor b/test/sys/kernel/slab/anon_vma/ctor deleted file mode 100644 index 13aeabc977..0000000000 --- a/test/sys/kernel/slab/anon_vma/ctor +++ /dev/null @@ -1 +0,0 @@ -anon_vma_ctor+0x0/0x40 diff --git a/test/sys/kernel/slab/anon_vma/destroy_by_rcu b/test/sys/kernel/slab/anon_vma/destroy_by_rcu deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/anon_vma/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/anon_vma/free_calls b/test/sys/kernel/slab/anon_vma/free_calls deleted file mode 100644 index 88d9e22a1d..0000000000 --- a/test/sys/kernel/slab/anon_vma/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 1575 age=4303047296 pid=0 cpus=0 - 1659 anon_vma_unlink+0x5f/0x70 age=7225/7638870/8377152 pid=56-20292 cpus=0-1 diff --git a/test/sys/kernel/slab/anon_vma/hwcache_align b/test/sys/kernel/slab/anon_vma/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/anon_vma/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/anon_vma/object_size b/test/sys/kernel/slab/anon_vma/object_size deleted file mode 100644 index ea70ce0134..0000000000 --- a/test/sys/kernel/slab/anon_vma/object_size +++ /dev/null @@ -1 +0,0 @@ -72 diff --git a/test/sys/kernel/slab/anon_vma/objects b/test/sys/kernel/slab/anon_vma/objects deleted file mode 100644 index 33a5f705ca..0000000000 --- a/test/sys/kernel/slab/anon_vma/objects +++ /dev/null @@ -1 +0,0 @@ -3265 diff --git a/test/sys/kernel/slab/anon_vma/objects_partial b/test/sys/kernel/slab/anon_vma/objects_partial deleted file mode 100644 index 725a5ba2a7..0000000000 --- a/test/sys/kernel/slab/anon_vma/objects_partial +++ /dev/null @@ -1 +0,0 @@ -185 diff --git a/test/sys/kernel/slab/anon_vma/objs_per_slab b/test/sys/kernel/slab/anon_vma/objs_per_slab deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/anon_vma/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/anon_vma/order b/test/sys/kernel/slab/anon_vma/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/anon_vma/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/anon_vma/partial b/test/sys/kernel/slab/anon_vma/partial deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/anon_vma/partial +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/anon_vma/poison b/test/sys/kernel/slab/anon_vma/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/anon_vma/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/anon_vma/reclaim_account b/test/sys/kernel/slab/anon_vma/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/anon_vma/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/anon_vma/red_zone b/test/sys/kernel/slab/anon_vma/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/anon_vma/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/anon_vma/sanity_checks b/test/sys/kernel/slab/anon_vma/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/anon_vma/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/anon_vma/shrink b/test/sys/kernel/slab/anon_vma/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/anon_vma/slab_size b/test/sys/kernel/slab/anon_vma/slab_size deleted file mode 100644 index a29644e57e..0000000000 --- a/test/sys/kernel/slab/anon_vma/slab_size +++ /dev/null @@ -1 +0,0 @@ -144 diff --git a/test/sys/kernel/slab/anon_vma/slabs b/test/sys/kernel/slab/anon_vma/slabs deleted file mode 100644 index 415196e47f..0000000000 --- a/test/sys/kernel/slab/anon_vma/slabs +++ /dev/null @@ -1 +0,0 @@ -118 diff --git a/test/sys/kernel/slab/anon_vma/store_user b/test/sys/kernel/slab/anon_vma/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/anon_vma/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/anon_vma/total_objects b/test/sys/kernel/slab/anon_vma/total_objects deleted file mode 100644 index 4025184410..0000000000 --- a/test/sys/kernel/slab/anon_vma/total_objects +++ /dev/null @@ -1 +0,0 @@ -3304 diff --git a/test/sys/kernel/slab/anon_vma/trace b/test/sys/kernel/slab/anon_vma/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/anon_vma/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/anon_vma/validate b/test/sys/kernel/slab/anon_vma/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/arp_cache/aliases b/test/sys/kernel/slab/arp_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/arp_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/arp_cache/align b/test/sys/kernel/slab/arp_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/arp_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/arp_cache/alloc_calls b/test/sys/kernel/slab/arp_cache/alloc_calls deleted file mode 100644 index f3c601dc6d..0000000000 --- a/test/sys/kernel/slab/arp_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1 neigh_create+0x8b/0x530 age=1133499 pid=952 cpus=0 diff --git a/test/sys/kernel/slab/arp_cache/cache_dma b/test/sys/kernel/slab/arp_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/arp_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/arp_cache/cpu_slabs b/test/sys/kernel/slab/arp_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/arp_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/arp_cache/ctor b/test/sys/kernel/slab/arp_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/arp_cache/destroy_by_rcu b/test/sys/kernel/slab/arp_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/arp_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/arp_cache/free_calls b/test/sys/kernel/slab/arp_cache/free_calls deleted file mode 100644 index 93f6bb7495..0000000000 --- a/test/sys/kernel/slab/arp_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ - 1 neigh_destroy+0x10c/0x160 age=1135741 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/arp_cache/hwcache_align b/test/sys/kernel/slab/arp_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/arp_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/arp_cache/object_size b/test/sys/kernel/slab/arp_cache/object_size deleted file mode 100644 index 71627d7107..0000000000 --- a/test/sys/kernel/slab/arp_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -348 diff --git a/test/sys/kernel/slab/arp_cache/objects b/test/sys/kernel/slab/arp_cache/objects deleted file mode 100644 index 7facc89938..0000000000 --- a/test/sys/kernel/slab/arp_cache/objects +++ /dev/null @@ -1 +0,0 @@ -36 diff --git a/test/sys/kernel/slab/arp_cache/objects_partial b/test/sys/kernel/slab/arp_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/arp_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/arp_cache/objs_per_slab b/test/sys/kernel/slab/arp_cache/objs_per_slab deleted file mode 100644 index 3c032078a4..0000000000 --- a/test/sys/kernel/slab/arp_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/test/sys/kernel/slab/arp_cache/order b/test/sys/kernel/slab/arp_cache/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/arp_cache/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/arp_cache/partial b/test/sys/kernel/slab/arp_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/arp_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/arp_cache/poison b/test/sys/kernel/slab/arp_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/arp_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/arp_cache/reclaim_account b/test/sys/kernel/slab/arp_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/arp_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/arp_cache/red_zone b/test/sys/kernel/slab/arp_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/arp_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/arp_cache/sanity_checks b/test/sys/kernel/slab/arp_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/arp_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/arp_cache/shrink b/test/sys/kernel/slab/arp_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/arp_cache/slab_size b/test/sys/kernel/slab/arp_cache/slab_size deleted file mode 100644 index 5379c470da..0000000000 --- a/test/sys/kernel/slab/arp_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -448 diff --git a/test/sys/kernel/slab/arp_cache/slabs b/test/sys/kernel/slab/arp_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/arp_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/arp_cache/store_user b/test/sys/kernel/slab/arp_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/arp_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/arp_cache/total_objects b/test/sys/kernel/slab/arp_cache/total_objects deleted file mode 100644 index 7facc89938..0000000000 --- a/test/sys/kernel/slab/arp_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -36 diff --git a/test/sys/kernel/slab/arp_cache/trace b/test/sys/kernel/slab/arp_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/arp_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/arp_cache/validate b/test/sys/kernel/slab/arp_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/bdev_cache/aliases b/test/sys/kernel/slab/bdev_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bdev_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bdev_cache/align b/test/sys/kernel/slab/bdev_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bdev_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bdev_cache/alloc_calls b/test/sys/kernel/slab/bdev_cache/alloc_calls deleted file mode 100644 index c6d765d374..0000000000 --- a/test/sys/kernel/slab/bdev_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 13 bdev_alloc_inode+0x15/0x30 age=61383/7093434/8379778 pid=0-13333 cpus=0 diff --git a/test/sys/kernel/slab/bdev_cache/cache_dma b/test/sys/kernel/slab/bdev_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bdev_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bdev_cache/cpu_slabs b/test/sys/kernel/slab/bdev_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bdev_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bdev_cache/ctor b/test/sys/kernel/slab/bdev_cache/ctor deleted file mode 100644 index 3e8fad602c..0000000000 --- a/test/sys/kernel/slab/bdev_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x100 diff --git a/test/sys/kernel/slab/bdev_cache/destroy_by_rcu b/test/sys/kernel/slab/bdev_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bdev_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bdev_cache/free_calls b/test/sys/kernel/slab/bdev_cache/free_calls deleted file mode 100644 index a6122267cc..0000000000 --- a/test/sys/kernel/slab/bdev_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 9 age=4303047074 pid=0 cpus=0 - 4 bdev_destroy_inode+0x1f/0x30 age=61405/4218130/8374840 pid=488-13325 cpus=0-1 diff --git a/test/sys/kernel/slab/bdev_cache/hwcache_align b/test/sys/kernel/slab/bdev_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bdev_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bdev_cache/object_size b/test/sys/kernel/slab/bdev_cache/object_size deleted file mode 100644 index 19a5f54fa2..0000000000 --- a/test/sys/kernel/slab/bdev_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -1432 diff --git a/test/sys/kernel/slab/bdev_cache/objects b/test/sys/kernel/slab/bdev_cache/objects deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/bdev_cache/objects +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/bdev_cache/objects_partial b/test/sys/kernel/slab/bdev_cache/objects_partial deleted file mode 100644 index b4de394767..0000000000 --- a/test/sys/kernel/slab/bdev_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/test/sys/kernel/slab/bdev_cache/objs_per_slab b/test/sys/kernel/slab/bdev_cache/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/bdev_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/bdev_cache/order b/test/sys/kernel/slab/bdev_cache/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/bdev_cache/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/bdev_cache/partial b/test/sys/kernel/slab/bdev_cache/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bdev_cache/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bdev_cache/poison b/test/sys/kernel/slab/bdev_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bdev_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bdev_cache/reclaim_account b/test/sys/kernel/slab/bdev_cache/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bdev_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bdev_cache/red_zone b/test/sys/kernel/slab/bdev_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bdev_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bdev_cache/sanity_checks b/test/sys/kernel/slab/bdev_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bdev_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bdev_cache/shrink b/test/sys/kernel/slab/bdev_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/bdev_cache/slab_size b/test/sys/kernel/slab/bdev_cache/slab_size deleted file mode 100644 index fa94e88e60..0000000000 --- a/test/sys/kernel/slab/bdev_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1536 diff --git a/test/sys/kernel/slab/bdev_cache/slabs b/test/sys/kernel/slab/bdev_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/bdev_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/bdev_cache/store_user b/test/sys/kernel/slab/bdev_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bdev_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bdev_cache/total_objects b/test/sys/kernel/slab/bdev_cache/total_objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/bdev_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/bdev_cache/trace b/test/sys/kernel/slab/bdev_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bdev_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bdev_cache/validate b/test/sys/kernel/slab/bdev_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/bio/aliases b/test/sys/kernel/slab/bio/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bio/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bio/align b/test/sys/kernel/slab/bio/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/bio/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/bio/alloc_calls b/test/sys/kernel/slab/bio/alloc_calls deleted file mode 100644 index 5a0c4b0c79..0000000000 --- a/test/sys/kernel/slab/bio/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379518/8379518/8379518 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/bio/cache_dma b/test/sys/kernel/slab/bio/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bio/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bio/cpu_slabs b/test/sys/kernel/slab/bio/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bio/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bio/ctor b/test/sys/kernel/slab/bio/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/bio/destroy_by_rcu b/test/sys/kernel/slab/bio/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bio/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bio/free_calls b/test/sys/kernel/slab/bio/free_calls deleted file mode 100644 index 787809f431..0000000000 --- a/test/sys/kernel/slab/bio/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046952 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/bio/hwcache_align b/test/sys/kernel/slab/bio/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bio/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bio/object_size b/test/sys/kernel/slab/bio/object_size deleted file mode 100644 index b16e5f75e3..0000000000 --- a/test/sys/kernel/slab/bio/object_size +++ /dev/null @@ -1 +0,0 @@ -104 diff --git a/test/sys/kernel/slab/bio/objects b/test/sys/kernel/slab/bio/objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/bio/objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/bio/objects_partial b/test/sys/kernel/slab/bio/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bio/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bio/objs_per_slab b/test/sys/kernel/slab/bio/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/bio/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/bio/order b/test/sys/kernel/slab/bio/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bio/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bio/partial b/test/sys/kernel/slab/bio/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bio/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bio/poison b/test/sys/kernel/slab/bio/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bio/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bio/reclaim_account b/test/sys/kernel/slab/bio/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bio/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bio/red_zone b/test/sys/kernel/slab/bio/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bio/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bio/sanity_checks b/test/sys/kernel/slab/bio/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bio/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bio/shrink b/test/sys/kernel/slab/bio/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/bio/slab_size b/test/sys/kernel/slab/bio/slab_size deleted file mode 100644 index 86a0307199..0000000000 --- a/test/sys/kernel/slab/bio/slab_size +++ /dev/null @@ -1 +0,0 @@ -192 diff --git a/test/sys/kernel/slab/bio/slabs b/test/sys/kernel/slab/bio/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/bio/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/bio/store_user b/test/sys/kernel/slab/bio/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bio/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bio/total_objects b/test/sys/kernel/slab/bio/total_objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/bio/total_objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/bio/trace b/test/sys/kernel/slab/bio/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bio/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bio/validate b/test/sys/kernel/slab/bio/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-1/aliases b/test/sys/kernel/slab/biovec-1/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-1/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-1/align b/test/sys/kernel/slab/biovec-1/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-1/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-1/alloc_calls b/test/sys/kernel/slab/biovec-1/alloc_calls deleted file mode 100644 index c67ebfc174..0000000000 --- a/test/sys/kernel/slab/biovec-1/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379509/8379509/8379509 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-1/cache_dma b/test/sys/kernel/slab/biovec-1/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-1/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-1/cpu_slabs b/test/sys/kernel/slab/biovec-1/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-1/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-1/ctor b/test/sys/kernel/slab/biovec-1/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-1/destroy_by_rcu b/test/sys/kernel/slab/biovec-1/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-1/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-1/free_calls b/test/sys/kernel/slab/biovec-1/free_calls deleted file mode 100644 index 2f8cf495dd..0000000000 --- a/test/sys/kernel/slab/biovec-1/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046943 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-1/hwcache_align b/test/sys/kernel/slab/biovec-1/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-1/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-1/object_size b/test/sys/kernel/slab/biovec-1/object_size deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/biovec-1/object_size +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/biovec-1/objects b/test/sys/kernel/slab/biovec-1/objects deleted file mode 100644 index 8cf5c1a22a..0000000000 --- a/test/sys/kernel/slab/biovec-1/objects +++ /dev/null @@ -1 +0,0 @@ -86 diff --git a/test/sys/kernel/slab/biovec-1/objects_partial b/test/sys/kernel/slab/biovec-1/objects_partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/biovec-1/objects_partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/biovec-1/objs_per_slab b/test/sys/kernel/slab/biovec-1/objs_per_slab deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/biovec-1/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/biovec-1/order b/test/sys/kernel/slab/biovec-1/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-1/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-1/partial b/test/sys/kernel/slab/biovec-1/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-1/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-1/poison b/test/sys/kernel/slab/biovec-1/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-1/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-1/reclaim_account b/test/sys/kernel/slab/biovec-1/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-1/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-1/red_zone b/test/sys/kernel/slab/biovec-1/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-1/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-1/sanity_checks b/test/sys/kernel/slab/biovec-1/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-1/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-1/shrink b/test/sys/kernel/slab/biovec-1/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-1/slab_size b/test/sys/kernel/slab/biovec-1/slab_size deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/biovec-1/slab_size +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/biovec-1/slabs b/test/sys/kernel/slab/biovec-1/slabs deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/biovec-1/slabs +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/biovec-1/store_user b/test/sys/kernel/slab/biovec-1/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-1/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-1/total_objects b/test/sys/kernel/slab/biovec-1/total_objects deleted file mode 100644 index 0a3e7b0422..0000000000 --- a/test/sys/kernel/slab/biovec-1/total_objects +++ /dev/null @@ -1 +0,0 @@ -126 diff --git a/test/sys/kernel/slab/biovec-1/trace b/test/sys/kernel/slab/biovec-1/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-1/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-1/validate b/test/sys/kernel/slab/biovec-1/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-128/aliases b/test/sys/kernel/slab/biovec-128/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-128/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-128/align b/test/sys/kernel/slab/biovec-128/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-128/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-128/alloc_calls b/test/sys/kernel/slab/biovec-128/alloc_calls deleted file mode 100644 index b80db34b3b..0000000000 --- a/test/sys/kernel/slab/biovec-128/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379474/8379474/8379474 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-128/cache_dma b/test/sys/kernel/slab/biovec-128/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-128/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-128/cpu_slabs b/test/sys/kernel/slab/biovec-128/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-128/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-128/ctor b/test/sys/kernel/slab/biovec-128/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-128/destroy_by_rcu b/test/sys/kernel/slab/biovec-128/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-128/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-128/free_calls b/test/sys/kernel/slab/biovec-128/free_calls deleted file mode 100644 index 29801ee6cf..0000000000 --- a/test/sys/kernel/slab/biovec-128/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046908 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-128/hwcache_align b/test/sys/kernel/slab/biovec-128/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-128/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-128/object_size b/test/sys/kernel/slab/biovec-128/object_size deleted file mode 100644 index c873496a22..0000000000 --- a/test/sys/kernel/slab/biovec-128/object_size +++ /dev/null @@ -1 +0,0 @@ -2048 diff --git a/test/sys/kernel/slab/biovec-128/objects b/test/sys/kernel/slab/biovec-128/objects deleted file mode 100644 index 60d3b2f4a4..0000000000 --- a/test/sys/kernel/slab/biovec-128/objects +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/test/sys/kernel/slab/biovec-128/objects_partial b/test/sys/kernel/slab/biovec-128/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-128/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-128/objs_per_slab b/test/sys/kernel/slab/biovec-128/objs_per_slab deleted file mode 100644 index 60d3b2f4a4..0000000000 --- a/test/sys/kernel/slab/biovec-128/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/test/sys/kernel/slab/biovec-128/order b/test/sys/kernel/slab/biovec-128/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/biovec-128/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/biovec-128/partial b/test/sys/kernel/slab/biovec-128/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-128/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-128/poison b/test/sys/kernel/slab/biovec-128/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-128/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-128/reclaim_account b/test/sys/kernel/slab/biovec-128/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-128/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-128/red_zone b/test/sys/kernel/slab/biovec-128/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-128/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-128/sanity_checks b/test/sys/kernel/slab/biovec-128/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-128/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-128/shrink b/test/sys/kernel/slab/biovec-128/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-128/slab_size b/test/sys/kernel/slab/biovec-128/slab_size deleted file mode 100644 index f52b3ac70f..0000000000 --- a/test/sys/kernel/slab/biovec-128/slab_size +++ /dev/null @@ -1 +0,0 @@ -2176 diff --git a/test/sys/kernel/slab/biovec-128/slabs b/test/sys/kernel/slab/biovec-128/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-128/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-128/store_user b/test/sys/kernel/slab/biovec-128/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-128/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-128/total_objects b/test/sys/kernel/slab/biovec-128/total_objects deleted file mode 100644 index 60d3b2f4a4..0000000000 --- a/test/sys/kernel/slab/biovec-128/total_objects +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/test/sys/kernel/slab/biovec-128/trace b/test/sys/kernel/slab/biovec-128/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-128/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-128/validate b/test/sys/kernel/slab/biovec-128/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-16/aliases b/test/sys/kernel/slab/biovec-16/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-16/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-16/align b/test/sys/kernel/slab/biovec-16/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-16/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-16/alloc_calls b/test/sys/kernel/slab/biovec-16/alloc_calls deleted file mode 100644 index 7a5c142192..0000000000 --- a/test/sys/kernel/slab/biovec-16/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379491/8379491/8379491 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-16/cache_dma b/test/sys/kernel/slab/biovec-16/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-16/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-16/cpu_slabs b/test/sys/kernel/slab/biovec-16/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-16/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-16/ctor b/test/sys/kernel/slab/biovec-16/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-16/destroy_by_rcu b/test/sys/kernel/slab/biovec-16/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-16/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-16/free_calls b/test/sys/kernel/slab/biovec-16/free_calls deleted file mode 100644 index 408a0c7ce0..0000000000 --- a/test/sys/kernel/slab/biovec-16/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046925 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-16/hwcache_align b/test/sys/kernel/slab/biovec-16/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-16/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-16/object_size b/test/sys/kernel/slab/biovec-16/object_size deleted file mode 100644 index 9183bf03fc..0000000000 --- a/test/sys/kernel/slab/biovec-16/object_size +++ /dev/null @@ -1 +0,0 @@ -256 diff --git a/test/sys/kernel/slab/biovec-16/objects b/test/sys/kernel/slab/biovec-16/objects deleted file mode 100644 index c739b42c4d..0000000000 --- a/test/sys/kernel/slab/biovec-16/objects +++ /dev/null @@ -1 +0,0 @@ -44 diff --git a/test/sys/kernel/slab/biovec-16/objects_partial b/test/sys/kernel/slab/biovec-16/objects_partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/biovec-16/objects_partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/biovec-16/objs_per_slab b/test/sys/kernel/slab/biovec-16/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/biovec-16/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/biovec-16/order b/test/sys/kernel/slab/biovec-16/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-16/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-16/partial b/test/sys/kernel/slab/biovec-16/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-16/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-16/poison b/test/sys/kernel/slab/biovec-16/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-16/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-16/reclaim_account b/test/sys/kernel/slab/biovec-16/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-16/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-16/red_zone b/test/sys/kernel/slab/biovec-16/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-16/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-16/sanity_checks b/test/sys/kernel/slab/biovec-16/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-16/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-16/shrink b/test/sys/kernel/slab/biovec-16/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-16/slab_size b/test/sys/kernel/slab/biovec-16/slab_size deleted file mode 100644 index e45b99e958..0000000000 --- a/test/sys/kernel/slab/biovec-16/slab_size +++ /dev/null @@ -1 +0,0 @@ -384 diff --git a/test/sys/kernel/slab/biovec-16/slabs b/test/sys/kernel/slab/biovec-16/slabs deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/biovec-16/slabs +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/biovec-16/store_user b/test/sys/kernel/slab/biovec-16/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-16/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-16/total_objects b/test/sys/kernel/slab/biovec-16/total_objects deleted file mode 100644 index 4b9026d8e2..0000000000 --- a/test/sys/kernel/slab/biovec-16/total_objects +++ /dev/null @@ -1 +0,0 @@ -63 diff --git a/test/sys/kernel/slab/biovec-16/trace b/test/sys/kernel/slab/biovec-16/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-16/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-16/validate b/test/sys/kernel/slab/biovec-16/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-256/aliases b/test/sys/kernel/slab/biovec-256/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-256/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-256/align b/test/sys/kernel/slab/biovec-256/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-256/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-256/alloc_calls b/test/sys/kernel/slab/biovec-256/alloc_calls deleted file mode 100644 index 58801f9c5f..0000000000 --- a/test/sys/kernel/slab/biovec-256/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379465/8379465/8379465 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-256/cache_dma b/test/sys/kernel/slab/biovec-256/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-256/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-256/cpu_slabs b/test/sys/kernel/slab/biovec-256/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-256/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-256/ctor b/test/sys/kernel/slab/biovec-256/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-256/destroy_by_rcu b/test/sys/kernel/slab/biovec-256/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-256/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-256/free_calls b/test/sys/kernel/slab/biovec-256/free_calls deleted file mode 100644 index 8b5bee2d4c..0000000000 --- a/test/sys/kernel/slab/biovec-256/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046899 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-256/hwcache_align b/test/sys/kernel/slab/biovec-256/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-256/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-256/object_size b/test/sys/kernel/slab/biovec-256/object_size deleted file mode 100644 index 801c306ed3..0000000000 --- a/test/sys/kernel/slab/biovec-256/object_size +++ /dev/null @@ -1 +0,0 @@ -4096 diff --git a/test/sys/kernel/slab/biovec-256/objects b/test/sys/kernel/slab/biovec-256/objects deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/biovec-256/objects +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/biovec-256/objects_partial b/test/sys/kernel/slab/biovec-256/objects_partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/biovec-256/objects_partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/biovec-256/objs_per_slab b/test/sys/kernel/slab/biovec-256/objs_per_slab deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/biovec-256/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/biovec-256/order b/test/sys/kernel/slab/biovec-256/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/biovec-256/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/biovec-256/partial b/test/sys/kernel/slab/biovec-256/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-256/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-256/poison b/test/sys/kernel/slab/biovec-256/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-256/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-256/reclaim_account b/test/sys/kernel/slab/biovec-256/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-256/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-256/red_zone b/test/sys/kernel/slab/biovec-256/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-256/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-256/sanity_checks b/test/sys/kernel/slab/biovec-256/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-256/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-256/shrink b/test/sys/kernel/slab/biovec-256/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-256/slab_size b/test/sys/kernel/slab/biovec-256/slab_size deleted file mode 100644 index 7137ddbe18..0000000000 --- a/test/sys/kernel/slab/biovec-256/slab_size +++ /dev/null @@ -1 +0,0 @@ -4224 diff --git a/test/sys/kernel/slab/biovec-256/slabs b/test/sys/kernel/slab/biovec-256/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-256/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-256/store_user b/test/sys/kernel/slab/biovec-256/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-256/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-256/total_objects b/test/sys/kernel/slab/biovec-256/total_objects deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/biovec-256/total_objects +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/biovec-256/trace b/test/sys/kernel/slab/biovec-256/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-256/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-256/validate b/test/sys/kernel/slab/biovec-256/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-4/aliases b/test/sys/kernel/slab/biovec-4/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/align b/test/sys/kernel/slab/biovec-4/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/alloc_calls b/test/sys/kernel/slab/biovec-4/alloc_calls deleted file mode 100644 index 87cf50aabc..0000000000 --- a/test/sys/kernel/slab/biovec-4/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379500/8379500/8379500 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-4/cache_dma b/test/sys/kernel/slab/biovec-4/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/cpu_slabs b/test/sys/kernel/slab/biovec-4/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/ctor b/test/sys/kernel/slab/biovec-4/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-4/destroy_by_rcu b/test/sys/kernel/slab/biovec-4/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/free_calls b/test/sys/kernel/slab/biovec-4/free_calls deleted file mode 100644 index 52061cea61..0000000000 --- a/test/sys/kernel/slab/biovec-4/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046934 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-4/hwcache_align b/test/sys/kernel/slab/biovec-4/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-4/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-4/object_size b/test/sys/kernel/slab/biovec-4/object_size deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/kernel/slab/biovec-4/object_size +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/kernel/slab/biovec-4/objects b/test/sys/kernel/slab/biovec-4/objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/biovec-4/objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/biovec-4/objects_partial b/test/sys/kernel/slab/biovec-4/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/objs_per_slab b/test/sys/kernel/slab/biovec-4/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/biovec-4/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/biovec-4/order b/test/sys/kernel/slab/biovec-4/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/partial b/test/sys/kernel/slab/biovec-4/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/poison b/test/sys/kernel/slab/biovec-4/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-4/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-4/reclaim_account b/test/sys/kernel/slab/biovec-4/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/red_zone b/test/sys/kernel/slab/biovec-4/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-4/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-4/sanity_checks b/test/sys/kernel/slab/biovec-4/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-4/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-4/shrink b/test/sys/kernel/slab/biovec-4/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-4/slab_size b/test/sys/kernel/slab/biovec-4/slab_size deleted file mode 100644 index 86a0307199..0000000000 --- a/test/sys/kernel/slab/biovec-4/slab_size +++ /dev/null @@ -1 +0,0 @@ -192 diff --git a/test/sys/kernel/slab/biovec-4/slabs b/test/sys/kernel/slab/biovec-4/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/biovec-4/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/biovec-4/store_user b/test/sys/kernel/slab/biovec-4/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-4/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-4/total_objects b/test/sys/kernel/slab/biovec-4/total_objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/biovec-4/total_objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/biovec-4/trace b/test/sys/kernel/slab/biovec-4/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-4/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-4/validate b/test/sys/kernel/slab/biovec-4/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-64/aliases b/test/sys/kernel/slab/biovec-64/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-64/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-64/align b/test/sys/kernel/slab/biovec-64/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-64/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-64/alloc_calls b/test/sys/kernel/slab/biovec-64/alloc_calls deleted file mode 100644 index 482478fcc2..0000000000 --- a/test/sys/kernel/slab/biovec-64/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379482/8379482/8379482 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/biovec-64/cache_dma b/test/sys/kernel/slab/biovec-64/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-64/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-64/cpu_slabs b/test/sys/kernel/slab/biovec-64/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-64/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-64/ctor b/test/sys/kernel/slab/biovec-64/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-64/destroy_by_rcu b/test/sys/kernel/slab/biovec-64/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-64/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-64/free_calls b/test/sys/kernel/slab/biovec-64/free_calls deleted file mode 100644 index 34759e4b0a..0000000000 --- a/test/sys/kernel/slab/biovec-64/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046917 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/biovec-64/hwcache_align b/test/sys/kernel/slab/biovec-64/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-64/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-64/object_size b/test/sys/kernel/slab/biovec-64/object_size deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/kernel/slab/biovec-64/object_size +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/kernel/slab/biovec-64/objects b/test/sys/kernel/slab/biovec-64/objects deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/biovec-64/objects +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/biovec-64/objects_partial b/test/sys/kernel/slab/biovec-64/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-64/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-64/objs_per_slab b/test/sys/kernel/slab/biovec-64/objs_per_slab deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/biovec-64/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/biovec-64/order b/test/sys/kernel/slab/biovec-64/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/biovec-64/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/biovec-64/partial b/test/sys/kernel/slab/biovec-64/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-64/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-64/poison b/test/sys/kernel/slab/biovec-64/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-64/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-64/reclaim_account b/test/sys/kernel/slab/biovec-64/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-64/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-64/red_zone b/test/sys/kernel/slab/biovec-64/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-64/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-64/sanity_checks b/test/sys/kernel/slab/biovec-64/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-64/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-64/shrink b/test/sys/kernel/slab/biovec-64/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/biovec-64/slab_size b/test/sys/kernel/slab/biovec-64/slab_size deleted file mode 100644 index d98057a110..0000000000 --- a/test/sys/kernel/slab/biovec-64/slab_size +++ /dev/null @@ -1 +0,0 @@ -1152 diff --git a/test/sys/kernel/slab/biovec-64/slabs b/test/sys/kernel/slab/biovec-64/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/biovec-64/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/biovec-64/store_user b/test/sys/kernel/slab/biovec-64/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/biovec-64/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/biovec-64/total_objects b/test/sys/kernel/slab/biovec-64/total_objects deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/biovec-64/total_objects +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/biovec-64/trace b/test/sys/kernel/slab/biovec-64/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/biovec-64/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/biovec-64/validate b/test/sys/kernel/slab/biovec-64/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/blkdev_ioc/aliases b/test/sys/kernel/slab/blkdev_ioc/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_ioc/align b/test/sys/kernel/slab/blkdev_ioc/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_ioc/alloc_calls b/test/sys/kernel/slab/blkdev_ioc/alloc_calls deleted file mode 100644 index 54887723d7..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 64 alloc_io_context+0x19/0xa0 age=3410/8058449/8378873 pid=1-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_ioc/cache_dma b/test/sys/kernel/slab/blkdev_ioc/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_ioc/cpu_slabs b/test/sys/kernel/slab/blkdev_ioc/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_ioc/ctor b/test/sys/kernel/slab/blkdev_ioc/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu b/test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_ioc/free_calls b/test/sys/kernel/slab/blkdev_ioc/free_calls deleted file mode 100644 index 312d929f67..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 9 age=4303046891 pid=0 cpus=0 - 55 put_io_context+0xb2/0xd0 age=45025/8043308/8374605 pid=145-13349 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_ioc/hwcache_align b/test/sys/kernel/slab/blkdev_ioc/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_ioc/object_size b/test/sys/kernel/slab/blkdev_ioc/object_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/object_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/blkdev_ioc/objects b/test/sys/kernel/slab/blkdev_ioc/objects deleted file mode 100644 index 6529ff889b..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/objects +++ /dev/null @@ -1 +0,0 @@ -98 diff --git a/test/sys/kernel/slab/blkdev_ioc/objects_partial b/test/sys/kernel/slab/blkdev_ioc/objects_partial deleted file mode 100644 index e522732c77..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/objects_partial +++ /dev/null @@ -1 +0,0 @@ -38 diff --git a/test/sys/kernel/slab/blkdev_ioc/objs_per_slab b/test/sys/kernel/slab/blkdev_ioc/objs_per_slab deleted file mode 100644 index 209e3ef4b6..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/test/sys/kernel/slab/blkdev_ioc/order b/test/sys/kernel/slab/blkdev_ioc/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_ioc/partial b/test/sys/kernel/slab/blkdev_ioc/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/blkdev_ioc/poison b/test/sys/kernel/slab/blkdev_ioc/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_ioc/reclaim_account b/test/sys/kernel/slab/blkdev_ioc/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_ioc/red_zone b/test/sys/kernel/slab/blkdev_ioc/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_ioc/sanity_checks b/test/sys/kernel/slab/blkdev_ioc/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_ioc/shrink b/test/sys/kernel/slab/blkdev_ioc/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/blkdev_ioc/slab_size b/test/sys/kernel/slab/blkdev_ioc/slab_size deleted file mode 100644 index 08839f6bb2..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/slab_size +++ /dev/null @@ -1 +0,0 @@ -200 diff --git a/test/sys/kernel/slab/blkdev_ioc/slabs b/test/sys/kernel/slab/blkdev_ioc/slabs deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/slabs +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/blkdev_ioc/store_user b/test/sys/kernel/slab/blkdev_ioc/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_ioc/total_objects b/test/sys/kernel/slab/blkdev_ioc/total_objects deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/total_objects +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/kernel/slab/blkdev_ioc/trace b/test/sys/kernel/slab/blkdev_ioc/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_ioc/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_ioc/validate b/test/sys/kernel/slab/blkdev_ioc/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/blkdev_queue/aliases b/test/sys/kernel/slab/blkdev_queue/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_queue/align b/test/sys/kernel/slab/blkdev_queue/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_queue/alloc_calls b/test/sys/kernel/slab/blkdev_queue/alloc_calls deleted file mode 100644 index 186b58b921..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 12 blk_alloc_queue_node+0x1c/0xc0 age=61520/7678497/8378855 pid=1-13295 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_queue/cache_dma b/test/sys/kernel/slab/blkdev_queue/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_queue/cpu_slabs b/test/sys/kernel/slab/blkdev_queue/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_queue/ctor b/test/sys/kernel/slab/blkdev_queue/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/blkdev_queue/destroy_by_rcu b/test/sys/kernel/slab/blkdev_queue/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_queue/free_calls b/test/sys/kernel/slab/blkdev_queue/free_calls deleted file mode 100644 index d87e667686..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/free_calls +++ /dev/null @@ -1 +0,0 @@ - 12 age=4303046873 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/blkdev_queue/hwcache_align b/test/sys/kernel/slab/blkdev_queue/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_queue/object_size b/test/sys/kernel/slab/blkdev_queue/object_size deleted file mode 100644 index e5db7ea053..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/object_size +++ /dev/null @@ -1 +0,0 @@ -2424 diff --git a/test/sys/kernel/slab/blkdev_queue/objects b/test/sys/kernel/slab/blkdev_queue/objects deleted file mode 100644 index 409940768f..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/objects +++ /dev/null @@ -1 +0,0 @@ -23 diff --git a/test/sys/kernel/slab/blkdev_queue/objects_partial b/test/sys/kernel/slab/blkdev_queue/objects_partial deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/objects_partial +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/kernel/slab/blkdev_queue/objs_per_slab b/test/sys/kernel/slab/blkdev_queue/objs_per_slab deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/kernel/slab/blkdev_queue/order b/test/sys/kernel/slab/blkdev_queue/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/blkdev_queue/partial b/test/sys/kernel/slab/blkdev_queue/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_queue/poison b/test/sys/kernel/slab/blkdev_queue/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_queue/reclaim_account b/test/sys/kernel/slab/blkdev_queue/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_queue/red_zone b/test/sys/kernel/slab/blkdev_queue/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_queue/sanity_checks b/test/sys/kernel/slab/blkdev_queue/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_queue/shrink b/test/sys/kernel/slab/blkdev_queue/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/blkdev_queue/slab_size b/test/sys/kernel/slab/blkdev_queue/slab_size deleted file mode 100644 index 7f5add1bcb..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/slab_size +++ /dev/null @@ -1 +0,0 @@ -2496 diff --git a/test/sys/kernel/slab/blkdev_queue/slabs b/test/sys/kernel/slab/blkdev_queue/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/blkdev_queue/store_user b/test/sys/kernel/slab/blkdev_queue/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_queue/total_objects b/test/sys/kernel/slab/blkdev_queue/total_objects deleted file mode 100644 index 6f4247a625..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/total_objects +++ /dev/null @@ -1 +0,0 @@ -26 diff --git a/test/sys/kernel/slab/blkdev_queue/trace b/test/sys/kernel/slab/blkdev_queue/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_queue/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_queue/validate b/test/sys/kernel/slab/blkdev_queue/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/blkdev_requests/aliases b/test/sys/kernel/slab/blkdev_requests/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_requests/align b/test/sys/kernel/slab/blkdev_requests/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_requests/alloc_calls b/test/sys/kernel/slab/blkdev_requests/alloc_calls deleted file mode 100644 index 76880926cb..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 12 mempool_alloc_slab+0x11/0x20 age=61529/5606309/8378864 pid=1-13295 cpus=0-1 diff --git a/test/sys/kernel/slab/blkdev_requests/cache_dma b/test/sys/kernel/slab/blkdev_requests/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_requests/cpu_slabs b/test/sys/kernel/slab/blkdev_requests/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_requests/ctor b/test/sys/kernel/slab/blkdev_requests/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/blkdev_requests/destroy_by_rcu b/test/sys/kernel/slab/blkdev_requests/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_requests/free_calls b/test/sys/kernel/slab/blkdev_requests/free_calls deleted file mode 100644 index 9ff2f4c912..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 7 age=4303046881 pid=0 cpus=0 - 5 mempool_free_slab+0x12/0x20 age=63050/1742015/8378750 pid=0-1456 cpus=0 diff --git a/test/sys/kernel/slab/blkdev_requests/hwcache_align b/test/sys/kernel/slab/blkdev_requests/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_requests/object_size b/test/sys/kernel/slab/blkdev_requests/object_size deleted file mode 100644 index 873b744bc5..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/object_size +++ /dev/null @@ -1 +0,0 @@ -304 diff --git a/test/sys/kernel/slab/blkdev_requests/objects b/test/sys/kernel/slab/blkdev_requests/objects deleted file mode 100644 index e373ee695f..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/objects +++ /dev/null @@ -1 +0,0 @@ -50 diff --git a/test/sys/kernel/slab/blkdev_requests/objects_partial b/test/sys/kernel/slab/blkdev_requests/objects_partial deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/objects_partial +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/blkdev_requests/objs_per_slab b/test/sys/kernel/slab/blkdev_requests/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/blkdev_requests/order b/test/sys/kernel/slab/blkdev_requests/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_requests/partial b/test/sys/kernel/slab/blkdev_requests/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/blkdev_requests/poison b/test/sys/kernel/slab/blkdev_requests/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_requests/reclaim_account b/test/sys/kernel/slab/blkdev_requests/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_requests/red_zone b/test/sys/kernel/slab/blkdev_requests/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_requests/sanity_checks b/test/sys/kernel/slab/blkdev_requests/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_requests/shrink b/test/sys/kernel/slab/blkdev_requests/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/blkdev_requests/slab_size b/test/sys/kernel/slab/blkdev_requests/slab_size deleted file mode 100644 index 100000a678..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/slab_size +++ /dev/null @@ -1 +0,0 @@ -376 diff --git a/test/sys/kernel/slab/blkdev_requests/slabs b/test/sys/kernel/slab/blkdev_requests/slabs deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/slabs +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/blkdev_requests/store_user b/test/sys/kernel/slab/blkdev_requests/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/blkdev_requests/total_objects b/test/sys/kernel/slab/blkdev_requests/total_objects deleted file mode 100644 index 871727de1f..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/total_objects +++ /dev/null @@ -1 +0,0 @@ -84 diff --git a/test/sys/kernel/slab/blkdev_requests/trace b/test/sys/kernel/slab/blkdev_requests/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/blkdev_requests/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/blkdev_requests/validate b/test/sys/kernel/slab/blkdev_requests/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/bsg_cmd/aliases b/test/sys/kernel/slab/bsg_cmd/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/align b/test/sys/kernel/slab/bsg_cmd/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/alloc_calls b/test/sys/kernel/slab/bsg_cmd/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/bsg_cmd/cache_dma b/test/sys/kernel/slab/bsg_cmd/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/cpu_slabs b/test/sys/kernel/slab/bsg_cmd/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/ctor b/test/sys/kernel/slab/bsg_cmd/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/bsg_cmd/destroy_by_rcu b/test/sys/kernel/slab/bsg_cmd/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/free_calls b/test/sys/kernel/slab/bsg_cmd/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/bsg_cmd/hwcache_align b/test/sys/kernel/slab/bsg_cmd/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/object_size b/test/sys/kernel/slab/bsg_cmd/object_size deleted file mode 100644 index a1e0432c9a..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/object_size +++ /dev/null @@ -1 +0,0 @@ -312 diff --git a/test/sys/kernel/slab/bsg_cmd/objects b/test/sys/kernel/slab/bsg_cmd/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/objects_partial b/test/sys/kernel/slab/bsg_cmd/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/objs_per_slab b/test/sys/kernel/slab/bsg_cmd/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/bsg_cmd/order b/test/sys/kernel/slab/bsg_cmd/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bsg_cmd/partial b/test/sys/kernel/slab/bsg_cmd/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/poison b/test/sys/kernel/slab/bsg_cmd/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bsg_cmd/reclaim_account b/test/sys/kernel/slab/bsg_cmd/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/red_zone b/test/sys/kernel/slab/bsg_cmd/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bsg_cmd/sanity_checks b/test/sys/kernel/slab/bsg_cmd/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bsg_cmd/shrink b/test/sys/kernel/slab/bsg_cmd/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/bsg_cmd/slab_size b/test/sys/kernel/slab/bsg_cmd/slab_size deleted file mode 100644 index e45b99e958..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/slab_size +++ /dev/null @@ -1 +0,0 @@ -384 diff --git a/test/sys/kernel/slab/bsg_cmd/slabs b/test/sys/kernel/slab/bsg_cmd/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/store_user b/test/sys/kernel/slab/bsg_cmd/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/bsg_cmd/total_objects b/test/sys/kernel/slab/bsg_cmd/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/trace b/test/sys/kernel/slab/bsg_cmd/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/bsg_cmd/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/bsg_cmd/validate b/test/sys/kernel/slab/bsg_cmd/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/buffer_head/aliases b/test/sys/kernel/slab/buffer_head/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/align b/test/sys/kernel/slab/buffer_head/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/alloc_calls b/test/sys/kernel/slab/buffer_head/alloc_calls deleted file mode 100644 index 36694c00fe..0000000000 --- a/test/sys/kernel/slab/buffer_head/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 31488 alloc_buffer_head+0x19/0x50 age=1/3079345/8378152 pid=1-32767 cpus=0-1 diff --git a/test/sys/kernel/slab/buffer_head/cache_dma b/test/sys/kernel/slab/buffer_head/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/cpu_slabs b/test/sys/kernel/slab/buffer_head/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/ctor b/test/sys/kernel/slab/buffer_head/ctor deleted file mode 100644 index efb838b249..0000000000 --- a/test/sys/kernel/slab/buffer_head/ctor +++ /dev/null @@ -1 +0,0 @@ -init_buffer_head+0x0/0x20 diff --git a/test/sys/kernel/slab/buffer_head/destroy_by_rcu b/test/sys/kernel/slab/buffer_head/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/free_calls b/test/sys/kernel/slab/buffer_head/free_calls deleted file mode 100644 index fc5fc3165c..0000000000 --- a/test/sys/kernel/slab/buffer_head/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 14436 age=4303047199 pid=0 cpus=0 - 17053 free_buffer_head+0x20/0x40 age=1227/1928220/8379062 pid=1-32759 cpus=0-1 diff --git a/test/sys/kernel/slab/buffer_head/hwcache_align b/test/sys/kernel/slab/buffer_head/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/object_size b/test/sys/kernel/slab/buffer_head/object_size deleted file mode 100644 index b16e5f75e3..0000000000 --- a/test/sys/kernel/slab/buffer_head/object_size +++ /dev/null @@ -1 +0,0 @@ -104 diff --git a/test/sys/kernel/slab/buffer_head/objects b/test/sys/kernel/slab/buffer_head/objects deleted file mode 100644 index 3ebec5690d..0000000000 --- a/test/sys/kernel/slab/buffer_head/objects +++ /dev/null @@ -1 +0,0 @@ -31487 diff --git a/test/sys/kernel/slab/buffer_head/objects_partial b/test/sys/kernel/slab/buffer_head/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/objs_per_slab b/test/sys/kernel/slab/buffer_head/objs_per_slab deleted file mode 100644 index 409940768f..0000000000 --- a/test/sys/kernel/slab/buffer_head/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -23 diff --git a/test/sys/kernel/slab/buffer_head/order b/test/sys/kernel/slab/buffer_head/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/partial b/test/sys/kernel/slab/buffer_head/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/poison b/test/sys/kernel/slab/buffer_head/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/buffer_head/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/buffer_head/reclaim_account b/test/sys/kernel/slab/buffer_head/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/buffer_head/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/buffer_head/red_zone b/test/sys/kernel/slab/buffer_head/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/buffer_head/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/buffer_head/sanity_checks b/test/sys/kernel/slab/buffer_head/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/buffer_head/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/buffer_head/shrink b/test/sys/kernel/slab/buffer_head/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/buffer_head/slab_size b/test/sys/kernel/slab/buffer_head/slab_size deleted file mode 100644 index 1057e9a273..0000000000 --- a/test/sys/kernel/slab/buffer_head/slab_size +++ /dev/null @@ -1 +0,0 @@ -176 diff --git a/test/sys/kernel/slab/buffer_head/slabs b/test/sys/kernel/slab/buffer_head/slabs deleted file mode 100644 index 66227acdb3..0000000000 --- a/test/sys/kernel/slab/buffer_head/slabs +++ /dev/null @@ -1 +0,0 @@ -1369 diff --git a/test/sys/kernel/slab/buffer_head/store_user b/test/sys/kernel/slab/buffer_head/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/buffer_head/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/buffer_head/total_objects b/test/sys/kernel/slab/buffer_head/total_objects deleted file mode 100644 index 3ebec5690d..0000000000 --- a/test/sys/kernel/slab/buffer_head/total_objects +++ /dev/null @@ -1 +0,0 @@ -31487 diff --git a/test/sys/kernel/slab/buffer_head/trace b/test/sys/kernel/slab/buffer_head/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/buffer_head/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/buffer_head/validate b/test/sys/kernel/slab/buffer_head/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/cfq_io_context/aliases b/test/sys/kernel/slab/cfq_io_context/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_io_context/align b/test/sys/kernel/slab/cfq_io_context/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/cfq_io_context/alloc_calls b/test/sys/kernel/slab/cfq_io_context/alloc_calls deleted file mode 100644 index ce95d893f6..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 69 cfq_set_request+0x13d/0x390 age=177/7837888/8379613 pid=1-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_io_context/cache_dma b/test/sys/kernel/slab/cfq_io_context/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_io_context/cpu_slabs b/test/sys/kernel/slab/cfq_io_context/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_io_context/ctor b/test/sys/kernel/slab/cfq_io_context/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/cfq_io_context/destroy_by_rcu b/test/sys/kernel/slab/cfq_io_context/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_io_context/free_calls b/test/sys/kernel/slab/cfq_io_context/free_calls deleted file mode 100644 index da85ebf4d0..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 12 age=4303047630 pid=0 cpus=0 - 57 cfq_cic_free_rcu+0x21/0xc0 age=61842/7747595/8376055 pid=0-2535 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_io_context/hwcache_align b/test/sys/kernel/slab/cfq_io_context/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_io_context/object_size b/test/sys/kernel/slab/cfq_io_context/object_size deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/object_size +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/kernel/slab/cfq_io_context/objects b/test/sys/kernel/slab/cfq_io_context/objects deleted file mode 100644 index 871727de1f..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/objects +++ /dev/null @@ -1 +0,0 @@ -84 diff --git a/test/sys/kernel/slab/cfq_io_context/objects_partial b/test/sys/kernel/slab/cfq_io_context/objects_partial deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/objects_partial +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/cfq_io_context/objs_per_slab b/test/sys/kernel/slab/cfq_io_context/objs_per_slab deleted file mode 100644 index 98d9bcb75a..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/test/sys/kernel/slab/cfq_io_context/order b/test/sys/kernel/slab/cfq_io_context/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_io_context/partial b/test/sys/kernel/slab/cfq_io_context/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/cfq_io_context/poison b/test/sys/kernel/slab/cfq_io_context/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/cfq_io_context/reclaim_account b/test/sys/kernel/slab/cfq_io_context/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_io_context/red_zone b/test/sys/kernel/slab/cfq_io_context/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/cfq_io_context/sanity_checks b/test/sys/kernel/slab/cfq_io_context/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/cfq_io_context/shrink b/test/sys/kernel/slab/cfq_io_context/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/cfq_io_context/slab_size b/test/sys/kernel/slab/cfq_io_context/slab_size deleted file mode 100644 index eb08bc0b0b..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/slab_size +++ /dev/null @@ -1 +0,0 @@ -240 diff --git a/test/sys/kernel/slab/cfq_io_context/slabs b/test/sys/kernel/slab/cfq_io_context/slabs deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/slabs +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/cfq_io_context/store_user b/test/sys/kernel/slab/cfq_io_context/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/cfq_io_context/total_objects b/test/sys/kernel/slab/cfq_io_context/total_objects deleted file mode 100644 index a862eb8444..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/total_objects +++ /dev/null @@ -1 +0,0 @@ -85 diff --git a/test/sys/kernel/slab/cfq_io_context/trace b/test/sys/kernel/slab/cfq_io_context/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_io_context/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_io_context/validate b/test/sys/kernel/slab/cfq_io_context/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/cfq_queue/aliases b/test/sys/kernel/slab/cfq_queue/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_queue/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_queue/align b/test/sys/kernel/slab/cfq_queue/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/cfq_queue/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/cfq_queue/alloc_calls b/test/sys/kernel/slab/cfq_queue/alloc_calls deleted file mode 100644 index 5a863fcad8..0000000000 --- a/test/sys/kernel/slab/cfq_queue/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 67 cfq_get_queue+0xc6/0x220 age=168/7825503/8379604 pid=1-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_queue/cache_dma b/test/sys/kernel/slab/cfq_queue/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_queue/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_queue/cpu_slabs b/test/sys/kernel/slab/cfq_queue/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_queue/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_queue/ctor b/test/sys/kernel/slab/cfq_queue/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/cfq_queue/destroy_by_rcu b/test/sys/kernel/slab/cfq_queue/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_queue/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_queue/free_calls b/test/sys/kernel/slab/cfq_queue/free_calls deleted file mode 100644 index d91e1bf689..0000000000 --- a/test/sys/kernel/slab/cfq_queue/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 11 age=4303047621 pid=0 cpus=0 - 56 cfq_put_queue+0x6f/0xe0 age=45755/7905388/8375272 pid=163-26529 cpus=0-1 diff --git a/test/sys/kernel/slab/cfq_queue/hwcache_align b/test/sys/kernel/slab/cfq_queue/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_queue/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_queue/object_size b/test/sys/kernel/slab/cfq_queue/object_size deleted file mode 100644 index 7296f257eb..0000000000 --- a/test/sys/kernel/slab/cfq_queue/object_size +++ /dev/null @@ -1 +0,0 @@ -136 diff --git a/test/sys/kernel/slab/cfq_queue/objects b/test/sys/kernel/slab/cfq_queue/objects deleted file mode 100644 index cd5b025272..0000000000 --- a/test/sys/kernel/slab/cfq_queue/objects +++ /dev/null @@ -1 +0,0 @@ -92 diff --git a/test/sys/kernel/slab/cfq_queue/objects_partial b/test/sys/kernel/slab/cfq_queue/objects_partial deleted file mode 100644 index 8f92bfdd49..0000000000 --- a/test/sys/kernel/slab/cfq_queue/objects_partial +++ /dev/null @@ -1 +0,0 @@ -35 diff --git a/test/sys/kernel/slab/cfq_queue/objs_per_slab b/test/sys/kernel/slab/cfq_queue/objs_per_slab deleted file mode 100644 index d6b24041cf..0000000000 --- a/test/sys/kernel/slab/cfq_queue/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -19 diff --git a/test/sys/kernel/slab/cfq_queue/order b/test/sys/kernel/slab/cfq_queue/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_queue/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_queue/partial b/test/sys/kernel/slab/cfq_queue/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/cfq_queue/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/cfq_queue/poison b/test/sys/kernel/slab/cfq_queue/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/cfq_queue/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/cfq_queue/reclaim_account b/test/sys/kernel/slab/cfq_queue/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_queue/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_queue/red_zone b/test/sys/kernel/slab/cfq_queue/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/cfq_queue/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/cfq_queue/sanity_checks b/test/sys/kernel/slab/cfq_queue/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/cfq_queue/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/cfq_queue/shrink b/test/sys/kernel/slab/cfq_queue/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/cfq_queue/slab_size b/test/sys/kernel/slab/cfq_queue/slab_size deleted file mode 100644 index 7d645f5893..0000000000 --- a/test/sys/kernel/slab/cfq_queue/slab_size +++ /dev/null @@ -1 +0,0 @@ -208 diff --git a/test/sys/kernel/slab/cfq_queue/slabs b/test/sys/kernel/slab/cfq_queue/slabs deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/cfq_queue/slabs +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/cfq_queue/store_user b/test/sys/kernel/slab/cfq_queue/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/cfq_queue/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/cfq_queue/total_objects b/test/sys/kernel/slab/cfq_queue/total_objects deleted file mode 100644 index 5595fa46c0..0000000000 --- a/test/sys/kernel/slab/cfq_queue/total_objects +++ /dev/null @@ -1 +0,0 @@ -95 diff --git a/test/sys/kernel/slab/cfq_queue/trace b/test/sys/kernel/slab/cfq_queue/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/cfq_queue/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/cfq_queue/validate b/test/sys/kernel/slab/cfq_queue/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dentry/aliases b/test/sys/kernel/slab/dentry/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dentry/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dentry/align b/test/sys/kernel/slab/dentry/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/dentry/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/dentry/alloc_calls b/test/sys/kernel/slab/dentry/alloc_calls deleted file mode 100644 index 446f29eb77..0000000000 --- a/test/sys/kernel/slab/dentry/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 49656 d_alloc+0x22/0x1f0 age=0/4250434/8379825 pid=0-32757 cpus=0-1 diff --git a/test/sys/kernel/slab/dentry/cache_dma b/test/sys/kernel/slab/dentry/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dentry/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dentry/cpu_slabs b/test/sys/kernel/slab/dentry/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dentry/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dentry/ctor b/test/sys/kernel/slab/dentry/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dentry/destroy_by_rcu b/test/sys/kernel/slab/dentry/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dentry/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dentry/free_calls b/test/sys/kernel/slab/dentry/free_calls deleted file mode 100644 index 86f293cce3..0000000000 --- a/test/sys/kernel/slab/dentry/free_calls +++ /dev/null @@ -1,3 +0,0 @@ - 30093 age=4303047137 pid=0 cpus=0 - 2265 d_free+0x6c/0x80 age=519/5532797/8376904 pid=1-32728 cpus=0-1 - 17299 d_callback+0x31/0x40 age=1040/2433896/8379551 pid=0-30210 cpus=0-1 diff --git a/test/sys/kernel/slab/dentry/hwcache_align b/test/sys/kernel/slab/dentry/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dentry/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dentry/object_size b/test/sys/kernel/slab/dentry/object_size deleted file mode 100644 index 9183bf03fc..0000000000 --- a/test/sys/kernel/slab/dentry/object_size +++ /dev/null @@ -1 +0,0 @@ -256 diff --git a/test/sys/kernel/slab/dentry/objects b/test/sys/kernel/slab/dentry/objects deleted file mode 100644 index d4fff57d7b..0000000000 --- a/test/sys/kernel/slab/dentry/objects +++ /dev/null @@ -1 +0,0 @@ -49656 diff --git a/test/sys/kernel/slab/dentry/objects_partial b/test/sys/kernel/slab/dentry/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dentry/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dentry/objs_per_slab b/test/sys/kernel/slab/dentry/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/dentry/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/dentry/order b/test/sys/kernel/slab/dentry/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dentry/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dentry/partial b/test/sys/kernel/slab/dentry/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dentry/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dentry/poison b/test/sys/kernel/slab/dentry/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dentry/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dentry/reclaim_account b/test/sys/kernel/slab/dentry/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dentry/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dentry/red_zone b/test/sys/kernel/slab/dentry/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dentry/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dentry/sanity_checks b/test/sys/kernel/slab/dentry/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dentry/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dentry/shrink b/test/sys/kernel/slab/dentry/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dentry/slab_size b/test/sys/kernel/slab/dentry/slab_size deleted file mode 100644 index 86619979c3..0000000000 --- a/test/sys/kernel/slab/dentry/slab_size +++ /dev/null @@ -1 +0,0 @@ -328 diff --git a/test/sys/kernel/slab/dentry/slabs b/test/sys/kernel/slab/dentry/slabs deleted file mode 100644 index bcfe4e9786..0000000000 --- a/test/sys/kernel/slab/dentry/slabs +++ /dev/null @@ -1 +0,0 @@ -4138 diff --git a/test/sys/kernel/slab/dentry/store_user b/test/sys/kernel/slab/dentry/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dentry/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dentry/total_objects b/test/sys/kernel/slab/dentry/total_objects deleted file mode 100644 index d4fff57d7b..0000000000 --- a/test/sys/kernel/slab/dentry/total_objects +++ /dev/null @@ -1 +0,0 @@ -49656 diff --git a/test/sys/kernel/slab/dentry/trace b/test/sys/kernel/slab/dentry/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dentry/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dentry/validate b/test/sys/kernel/slab/dentry/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dm_io/aliases b/test/sys/kernel/slab/dm_io/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/align b/test/sys/kernel/slab/dm_io/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/dm_io/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/dm_io/alloc_calls b/test/sys/kernel/slab/dm_io/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/dm_io/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/dm_io/cache_dma b/test/sys/kernel/slab/dm_io/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/cpu_slabs b/test/sys/kernel/slab/dm_io/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/ctor b/test/sys/kernel/slab/dm_io/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dm_io/destroy_by_rcu b/test/sys/kernel/slab/dm_io/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/free_calls b/test/sys/kernel/slab/dm_io/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/dm_io/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/dm_io/hwcache_align b/test/sys/kernel/slab/dm_io/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/object_size b/test/sys/kernel/slab/dm_io/object_size deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/dm_io/object_size +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/dm_io/objects b/test/sys/kernel/slab/dm_io/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/objects_partial b/test/sys/kernel/slab/dm_io/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/objs_per_slab b/test/sys/kernel/slab/dm_io/objs_per_slab deleted file mode 100644 index a2720097dc..0000000000 --- a/test/sys/kernel/slab/dm_io/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -39 diff --git a/test/sys/kernel/slab/dm_io/order b/test/sys/kernel/slab/dm_io/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/partial b/test/sys/kernel/slab/dm_io/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/poison b/test/sys/kernel/slab/dm_io/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dm_io/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dm_io/reclaim_account b/test/sys/kernel/slab/dm_io/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/red_zone b/test/sys/kernel/slab/dm_io/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dm_io/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dm_io/sanity_checks b/test/sys/kernel/slab/dm_io/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dm_io/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dm_io/shrink b/test/sys/kernel/slab/dm_io/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dm_io/slab_size b/test/sys/kernel/slab/dm_io/slab_size deleted file mode 100644 index b16e5f75e3..0000000000 --- a/test/sys/kernel/slab/dm_io/slab_size +++ /dev/null @@ -1 +0,0 @@ -104 diff --git a/test/sys/kernel/slab/dm_io/slabs b/test/sys/kernel/slab/dm_io/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/store_user b/test/sys/kernel/slab/dm_io/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dm_io/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dm_io/total_objects b/test/sys/kernel/slab/dm_io/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/trace b/test/sys/kernel/slab/dm_io/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_io/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_io/validate b/test/sys/kernel/slab/dm_io/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dm_target_io/aliases b/test/sys/kernel/slab/dm_target_io/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/align b/test/sys/kernel/slab/dm_target_io/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/dm_target_io/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/dm_target_io/alloc_calls b/test/sys/kernel/slab/dm_target_io/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/dm_target_io/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/dm_target_io/cache_dma b/test/sys/kernel/slab/dm_target_io/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/cpu_slabs b/test/sys/kernel/slab/dm_target_io/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/ctor b/test/sys/kernel/slab/dm_target_io/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dm_target_io/destroy_by_rcu b/test/sys/kernel/slab/dm_target_io/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/free_calls b/test/sys/kernel/slab/dm_target_io/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/dm_target_io/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/dm_target_io/hwcache_align b/test/sys/kernel/slab/dm_target_io/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/object_size b/test/sys/kernel/slab/dm_target_io/object_size deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/dm_target_io/object_size +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/dm_target_io/objects b/test/sys/kernel/slab/dm_target_io/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/objects_partial b/test/sys/kernel/slab/dm_target_io/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/objs_per_slab b/test/sys/kernel/slab/dm_target_io/objs_per_slab deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/dm_target_io/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/dm_target_io/order b/test/sys/kernel/slab/dm_target_io/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/partial b/test/sys/kernel/slab/dm_target_io/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/poison b/test/sys/kernel/slab/dm_target_io/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dm_target_io/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dm_target_io/reclaim_account b/test/sys/kernel/slab/dm_target_io/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/red_zone b/test/sys/kernel/slab/dm_target_io/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dm_target_io/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dm_target_io/sanity_checks b/test/sys/kernel/slab/dm_target_io/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dm_target_io/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dm_target_io/shrink b/test/sys/kernel/slab/dm_target_io/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dm_target_io/slab_size b/test/sys/kernel/slab/dm_target_io/slab_size deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/dm_target_io/slab_size +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/dm_target_io/slabs b/test/sys/kernel/slab/dm_target_io/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/store_user b/test/sys/kernel/slab/dm_target_io/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dm_target_io/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dm_target_io/total_objects b/test/sys/kernel/slab/dm_target_io/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/trace b/test/sys/kernel/slab/dm_target_io/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dm_target_io/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dm_target_io/validate b/test/sys/kernel/slab/dm_target_io/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dnotify_cache/aliases b/test/sys/kernel/slab/dnotify_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/align b/test/sys/kernel/slab/dnotify_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/alloc_calls b/test/sys/kernel/slab/dnotify_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/dnotify_cache/cache_dma b/test/sys/kernel/slab/dnotify_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/cpu_slabs b/test/sys/kernel/slab/dnotify_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/ctor b/test/sys/kernel/slab/dnotify_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dnotify_cache/destroy_by_rcu b/test/sys/kernel/slab/dnotify_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/free_calls b/test/sys/kernel/slab/dnotify_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/dnotify_cache/hwcache_align b/test/sys/kernel/slab/dnotify_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/object_size b/test/sys/kernel/slab/dnotify_cache/object_size deleted file mode 100644 index 425151f3a4..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -40 diff --git a/test/sys/kernel/slab/dnotify_cache/objects b/test/sys/kernel/slab/dnotify_cache/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/objects_partial b/test/sys/kernel/slab/dnotify_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/objs_per_slab b/test/sys/kernel/slab/dnotify_cache/objs_per_slab deleted file mode 100644 index 7facc89938..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -36 diff --git a/test/sys/kernel/slab/dnotify_cache/order b/test/sys/kernel/slab/dnotify_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/partial b/test/sys/kernel/slab/dnotify_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/poison b/test/sys/kernel/slab/dnotify_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dnotify_cache/reclaim_account b/test/sys/kernel/slab/dnotify_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/red_zone b/test/sys/kernel/slab/dnotify_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dnotify_cache/sanity_checks b/test/sys/kernel/slab/dnotify_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dnotify_cache/shrink b/test/sys/kernel/slab/dnotify_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/dnotify_cache/slab_size b/test/sys/kernel/slab/dnotify_cache/slab_size deleted file mode 100644 index 194b81caae..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -112 diff --git a/test/sys/kernel/slab/dnotify_cache/slabs b/test/sys/kernel/slab/dnotify_cache/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/store_user b/test/sys/kernel/slab/dnotify_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/dnotify_cache/total_objects b/test/sys/kernel/slab/dnotify_cache/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/trace b/test/sys/kernel/slab/dnotify_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/dnotify_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/dnotify_cache/validate b/test/sys/kernel/slab/dnotify_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/eventpoll_epi/aliases b/test/sys/kernel/slab/eventpoll_epi/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_epi/align b/test/sys/kernel/slab/eventpoll_epi/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_epi/alloc_calls b/test/sys/kernel/slab/eventpoll_epi/alloc_calls deleted file mode 100644 index 360e487d13..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 65 sys_epoll_ctl+0x1a4/0x4d0 age=2416443/8173337/8356255 pid=1690-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_epi/cache_dma b/test/sys/kernel/slab/eventpoll_epi/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_epi/cpu_slabs b/test/sys/kernel/slab/eventpoll_epi/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_epi/ctor b/test/sys/kernel/slab/eventpoll_epi/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu b/test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_epi/free_calls b/test/sys/kernel/slab/eventpoll_epi/free_calls deleted file mode 100644 index dc16cafc21..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 61 age=4303046803 pid=0 cpus=0 - 4 ep_remove+0xae/0xc0 age=2416461/6864194/8356250 pid=1690-2073 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_epi/hwcache_align b/test/sys/kernel/slab/eventpoll_epi/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_epi/object_size b/test/sys/kernel/slab/eventpoll_epi/object_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/object_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/eventpoll_epi/objects b/test/sys/kernel/slab/eventpoll_epi/objects deleted file mode 100644 index 85322d0b54..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/objects +++ /dev/null @@ -1 +0,0 @@ -79 diff --git a/test/sys/kernel/slab/eventpoll_epi/objects_partial b/test/sys/kernel/slab/eventpoll_epi/objects_partial deleted file mode 100644 index 60d3b2f4a4..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/objects_partial +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/test/sys/kernel/slab/eventpoll_epi/objs_per_slab b/test/sys/kernel/slab/eventpoll_epi/objs_per_slab deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/eventpoll_epi/order b/test/sys/kernel/slab/eventpoll_epi/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_epi/partial b/test/sys/kernel/slab/eventpoll_epi/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/eventpoll_epi/poison b/test/sys/kernel/slab/eventpoll_epi/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_epi/reclaim_account b/test/sys/kernel/slab/eventpoll_epi/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_epi/red_zone b/test/sys/kernel/slab/eventpoll_epi/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_epi/sanity_checks b/test/sys/kernel/slab/eventpoll_epi/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_epi/shrink b/test/sys/kernel/slab/eventpoll_epi/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/eventpoll_epi/slab_size b/test/sys/kernel/slab/eventpoll_epi/slab_size deleted file mode 100644 index 9183bf03fc..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/slab_size +++ /dev/null @@ -1 +0,0 @@ -256 diff --git a/test/sys/kernel/slab/eventpoll_epi/slabs b/test/sys/kernel/slab/eventpoll_epi/slabs deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/slabs +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/kernel/slab/eventpoll_epi/store_user b/test/sys/kernel/slab/eventpoll_epi/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_epi/total_objects b/test/sys/kernel/slab/eventpoll_epi/total_objects deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/total_objects +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/eventpoll_epi/trace b/test/sys/kernel/slab/eventpoll_epi/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_epi/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_epi/validate b/test/sys/kernel/slab/eventpoll_epi/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/eventpoll_pwq/aliases b/test/sys/kernel/slab/eventpoll_pwq/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/align b/test/sys/kernel/slab/eventpoll_pwq/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/alloc_calls b/test/sys/kernel/slab/eventpoll_pwq/alloc_calls deleted file mode 100644 index 52ae541763..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 65 ep_ptable_queue_proc+0x35/0xa0 age=2416434/8173328/8356246 pid=1690-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/cache_dma b/test/sys/kernel/slab/eventpoll_pwq/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/cpu_slabs b/test/sys/kernel/slab/eventpoll_pwq/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/ctor b/test/sys/kernel/slab/eventpoll_pwq/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu b/test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/free_calls b/test/sys/kernel/slab/eventpoll_pwq/free_calls deleted file mode 100644 index 7910a455f1..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 61 age=4303046794 pid=0 cpus=0 - 4 ep_unregister_pollwait+0x61/0x80 age=2416452/6864185/8356241 pid=1690-2073 cpus=0-1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/hwcache_align b/test/sys/kernel/slab/eventpoll_pwq/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/object_size b/test/sys/kernel/slab/eventpoll_pwq/object_size deleted file mode 100644 index ea70ce0134..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/object_size +++ /dev/null @@ -1 +0,0 @@ -72 diff --git a/test/sys/kernel/slab/eventpoll_pwq/objects b/test/sys/kernel/slab/eventpoll_pwq/objects deleted file mode 100644 index 7fe4e495fe..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/objects +++ /dev/null @@ -1 +0,0 @@ -91 diff --git a/test/sys/kernel/slab/eventpoll_pwq/objects_partial b/test/sys/kernel/slab/eventpoll_pwq/objects_partial deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/objects_partial +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/eventpoll_pwq/objs_per_slab b/test/sys/kernel/slab/eventpoll_pwq/objs_per_slab deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/eventpoll_pwq/order b/test/sys/kernel/slab/eventpoll_pwq/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/partial b/test/sys/kernel/slab/eventpoll_pwq/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/poison b/test/sys/kernel/slab/eventpoll_pwq/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/reclaim_account b/test/sys/kernel/slab/eventpoll_pwq/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/red_zone b/test/sys/kernel/slab/eventpoll_pwq/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/sanity_checks b/test/sys/kernel/slab/eventpoll_pwq/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/shrink b/test/sys/kernel/slab/eventpoll_pwq/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/eventpoll_pwq/slab_size b/test/sys/kernel/slab/eventpoll_pwq/slab_size deleted file mode 100644 index a29644e57e..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/slab_size +++ /dev/null @@ -1 +0,0 @@ -144 diff --git a/test/sys/kernel/slab/eventpoll_pwq/slabs b/test/sys/kernel/slab/eventpoll_pwq/slabs deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/slabs +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/eventpoll_pwq/store_user b/test/sys/kernel/slab/eventpoll_pwq/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/eventpoll_pwq/total_objects b/test/sys/kernel/slab/eventpoll_pwq/total_objects deleted file mode 100644 index 194b81caae..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/total_objects +++ /dev/null @@ -1 +0,0 @@ -112 diff --git a/test/sys/kernel/slab/eventpoll_pwq/trace b/test/sys/kernel/slab/eventpoll_pwq/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/eventpoll_pwq/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/eventpoll_pwq/validate b/test/sys/kernel/slab/eventpoll_pwq/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ext2_inode_cache/aliases b/test/sys/kernel/slab/ext2_inode_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/align b/test/sys/kernel/slab/ext2_inode_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/alloc_calls b/test/sys/kernel/slab/ext2_inode_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/ext2_inode_cache/cache_dma b/test/sys/kernel/slab/ext2_inode_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/cpu_slabs b/test/sys/kernel/slab/ext2_inode_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/ctor b/test/sys/kernel/slab/ext2_inode_cache/ctor deleted file mode 100644 index 102ae87d64..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x60 diff --git a/test/sys/kernel/slab/ext2_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/ext2_inode_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/free_calls b/test/sys/kernel/slab/ext2_inode_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/ext2_inode_cache/hwcache_align b/test/sys/kernel/slab/ext2_inode_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/object_size b/test/sys/kernel/slab/ext2_inode_cache/object_size deleted file mode 100644 index 6ee29474b0..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -1384 diff --git a/test/sys/kernel/slab/ext2_inode_cache/objects b/test/sys/kernel/slab/ext2_inode_cache/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/objects_partial b/test/sys/kernel/slab/ext2_inode_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/objs_per_slab b/test/sys/kernel/slab/ext2_inode_cache/objs_per_slab deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/ext2_inode_cache/order b/test/sys/kernel/slab/ext2_inode_cache/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/ext2_inode_cache/partial b/test/sys/kernel/slab/ext2_inode_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/poison b/test/sys/kernel/slab/ext2_inode_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/reclaim_account b/test/sys/kernel/slab/ext2_inode_cache/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/red_zone b/test/sys/kernel/slab/ext2_inode_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/sanity_checks b/test/sys/kernel/slab/ext2_inode_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/shrink b/test/sys/kernel/slab/ext2_inode_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ext2_inode_cache/slab_size b/test/sys/kernel/slab/ext2_inode_cache/slab_size deleted file mode 100644 index 471d5488d7..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1456 diff --git a/test/sys/kernel/slab/ext2_inode_cache/slabs b/test/sys/kernel/slab/ext2_inode_cache/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/store_user b/test/sys/kernel/slab/ext2_inode_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext2_inode_cache/total_objects b/test/sys/kernel/slab/ext2_inode_cache/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/trace b/test/sys/kernel/slab/ext2_inode_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext2_inode_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext2_inode_cache/validate b/test/sys/kernel/slab/ext2_inode_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ext3_inode_cache/aliases b/test/sys/kernel/slab/ext3_inode_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/align b/test/sys/kernel/slab/ext3_inode_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/alloc_calls b/test/sys/kernel/slab/ext3_inode_cache/alloc_calls deleted file mode 100644 index 0d99c969ba..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 27338 ext3_alloc_inode+0x15/0x60 age=0/2288559/8378475 pid=1-27944 cpus=0-1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/cache_dma b/test/sys/kernel/slab/ext3_inode_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/cpu_slabs b/test/sys/kernel/slab/ext3_inode_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/ctor b/test/sys/kernel/slab/ext3_inode_cache/ctor deleted file mode 100644 index de01745ee3..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x70 diff --git a/test/sys/kernel/slab/ext3_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/ext3_inode_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/free_calls b/test/sys/kernel/slab/ext3_inode_cache/free_calls deleted file mode 100644 index 28981f9042..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 25981 age=4303047521 pid=0 cpus=0 - 1358 ext3_destroy_inode+0x2f/0x90 age=13089/2437961/8371953 pid=542-32759 cpus=0-1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/hwcache_align b/test/sys/kernel/slab/ext3_inode_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/object_size b/test/sys/kernel/slab/ext3_inode_cache/object_size deleted file mode 100644 index bfc0bcc570..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -1472 diff --git a/test/sys/kernel/slab/ext3_inode_cache/objects b/test/sys/kernel/slab/ext3_inode_cache/objects deleted file mode 100644 index cee8ff5a64..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/objects +++ /dev/null @@ -1 +0,0 @@ -27342 diff --git a/test/sys/kernel/slab/ext3_inode_cache/objects_partial b/test/sys/kernel/slab/ext3_inode_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/objs_per_slab b/test/sys/kernel/slab/ext3_inode_cache/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/ext3_inode_cache/order b/test/sys/kernel/slab/ext3_inode_cache/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/ext3_inode_cache/partial b/test/sys/kernel/slab/ext3_inode_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/poison b/test/sys/kernel/slab/ext3_inode_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/reclaim_account b/test/sys/kernel/slab/ext3_inode_cache/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/red_zone b/test/sys/kernel/slab/ext3_inode_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/sanity_checks b/test/sys/kernel/slab/ext3_inode_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/shrink b/test/sys/kernel/slab/ext3_inode_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ext3_inode_cache/slab_size b/test/sys/kernel/slab/ext3_inode_cache/slab_size deleted file mode 100644 index df9d39688a..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1544 diff --git a/test/sys/kernel/slab/ext3_inode_cache/slabs b/test/sys/kernel/slab/ext3_inode_cache/slabs deleted file mode 100644 index 47e9cd481d..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -1302 diff --git a/test/sys/kernel/slab/ext3_inode_cache/store_user b/test/sys/kernel/slab/ext3_inode_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_inode_cache/total_objects b/test/sys/kernel/slab/ext3_inode_cache/total_objects deleted file mode 100644 index cee8ff5a64..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -27342 diff --git a/test/sys/kernel/slab/ext3_inode_cache/trace b/test/sys/kernel/slab/ext3_inode_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_inode_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_inode_cache/validate b/test/sys/kernel/slab/ext3_inode_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ext3_xattr/aliases b/test/sys/kernel/slab/ext3_xattr/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/align b/test/sys/kernel/slab/ext3_xattr/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/alloc_calls b/test/sys/kernel/slab/ext3_xattr/alloc_calls deleted file mode 100644 index cbe56c20c8..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 4 mb_cache_entry_alloc+0x15/0x50 age=5766034/7671829/8319899 pid=2676-9046 cpus=0 diff --git a/test/sys/kernel/slab/ext3_xattr/cache_dma b/test/sys/kernel/slab/ext3_xattr/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/cpu_slabs b/test/sys/kernel/slab/ext3_xattr/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/ctor b/test/sys/kernel/slab/ext3_xattr/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ext3_xattr/destroy_by_rcu b/test/sys/kernel/slab/ext3_xattr/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/free_calls b/test/sys/kernel/slab/ext3_xattr/free_calls deleted file mode 100644 index 1e987092ac..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/free_calls +++ /dev/null @@ -1 +0,0 @@ - 4 age=4303047503 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ext3_xattr/hwcache_align b/test/sys/kernel/slab/ext3_xattr/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/object_size b/test/sys/kernel/slab/ext3_xattr/object_size deleted file mode 100644 index d22307c427..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/object_size +++ /dev/null @@ -1 +0,0 @@ -88 diff --git a/test/sys/kernel/slab/ext3_xattr/objects b/test/sys/kernel/slab/ext3_xattr/objects deleted file mode 100644 index 7273c0fa8c..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/objects +++ /dev/null @@ -1 +0,0 @@ -25 diff --git a/test/sys/kernel/slab/ext3_xattr/objects_partial b/test/sys/kernel/slab/ext3_xattr/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/objs_per_slab b/test/sys/kernel/slab/ext3_xattr/objs_per_slab deleted file mode 100644 index 7273c0fa8c..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -25 diff --git a/test/sys/kernel/slab/ext3_xattr/order b/test/sys/kernel/slab/ext3_xattr/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/partial b/test/sys/kernel/slab/ext3_xattr/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/poison b/test/sys/kernel/slab/ext3_xattr/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_xattr/reclaim_account b/test/sys/kernel/slab/ext3_xattr/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_xattr/red_zone b/test/sys/kernel/slab/ext3_xattr/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_xattr/sanity_checks b/test/sys/kernel/slab/ext3_xattr/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_xattr/shrink b/test/sys/kernel/slab/ext3_xattr/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ext3_xattr/slab_size b/test/sys/kernel/slab/ext3_xattr/slab_size deleted file mode 100644 index a76256037d..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/slab_size +++ /dev/null @@ -1 +0,0 @@ -160 diff --git a/test/sys/kernel/slab/ext3_xattr/slabs b/test/sys/kernel/slab/ext3_xattr/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_xattr/store_user b/test/sys/kernel/slab/ext3_xattr/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ext3_xattr/total_objects b/test/sys/kernel/slab/ext3_xattr/total_objects deleted file mode 100644 index 7273c0fa8c..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/total_objects +++ /dev/null @@ -1 +0,0 @@ -25 diff --git a/test/sys/kernel/slab/ext3_xattr/trace b/test/sys/kernel/slab/ext3_xattr/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ext3_xattr/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ext3_xattr/validate b/test/sys/kernel/slab/ext3_xattr/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fasync_cache/aliases b/test/sys/kernel/slab/fasync_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fasync_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fasync_cache/align b/test/sys/kernel/slab/fasync_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fasync_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fasync_cache/alloc_calls b/test/sys/kernel/slab/fasync_cache/alloc_calls deleted file mode 100644 index ee9229866b..0000000000 --- a/test/sys/kernel/slab/fasync_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1 fasync_helper+0x115/0x130 age=8354059 pid=1738 cpus=0 diff --git a/test/sys/kernel/slab/fasync_cache/cache_dma b/test/sys/kernel/slab/fasync_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fasync_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fasync_cache/cpu_slabs b/test/sys/kernel/slab/fasync_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fasync_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fasync_cache/ctor b/test/sys/kernel/slab/fasync_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fasync_cache/destroy_by_rcu b/test/sys/kernel/slab/fasync_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fasync_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fasync_cache/free_calls b/test/sys/kernel/slab/fasync_cache/free_calls deleted file mode 100644 index faadd37d6e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ - 1 age=4303047449 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fasync_cache/hwcache_align b/test/sys/kernel/slab/fasync_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fasync_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fasync_cache/object_size b/test/sys/kernel/slab/fasync_cache/object_size deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/fasync_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/fasync_cache/objects b/test/sys/kernel/slab/fasync_cache/objects deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/objects +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fasync_cache/objects_partial b/test/sys/kernel/slab/fasync_cache/objects_partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fasync_cache/objs_per_slab b/test/sys/kernel/slab/fasync_cache/objs_per_slab deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/fasync_cache/order b/test/sys/kernel/slab/fasync_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fasync_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fasync_cache/partial b/test/sys/kernel/slab/fasync_cache/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fasync_cache/poison b/test/sys/kernel/slab/fasync_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fasync_cache/reclaim_account b/test/sys/kernel/slab/fasync_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fasync_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fasync_cache/red_zone b/test/sys/kernel/slab/fasync_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fasync_cache/sanity_checks b/test/sys/kernel/slab/fasync_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fasync_cache/shrink b/test/sys/kernel/slab/fasync_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fasync_cache/slab_size b/test/sys/kernel/slab/fasync_cache/slab_size deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/fasync_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/fasync_cache/slabs b/test/sys/kernel/slab/fasync_cache/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fasync_cache/store_user b/test/sys/kernel/slab/fasync_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fasync_cache/total_objects b/test/sys/kernel/slab/fasync_cache/total_objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/fasync_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/fasync_cache/trace b/test/sys/kernel/slab/fasync_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fasync_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fasync_cache/validate b/test/sys/kernel/slab/fasync_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fat_cache/aliases b/test/sys/kernel/slab/fat_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/align b/test/sys/kernel/slab/fat_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/alloc_calls b/test/sys/kernel/slab/fat_cache/alloc_calls deleted file mode 100644 index 134b9b2ae7..0000000000 --- a/test/sys/kernel/slab/fat_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 14 fat_cache_add+0x11f/0x1c0 age=61297/61310/61330 pid=13349 cpus=0 diff --git a/test/sys/kernel/slab/fat_cache/cache_dma b/test/sys/kernel/slab/fat_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/cpu_slabs b/test/sys/kernel/slab/fat_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/ctor b/test/sys/kernel/slab/fat_cache/ctor deleted file mode 100644 index 2940046f62..0000000000 --- a/test/sys/kernel/slab/fat_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/fat_cache/destroy_by_rcu b/test/sys/kernel/slab/fat_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/free_calls b/test/sys/kernel/slab/fat_cache/free_calls deleted file mode 100644 index 77d925edb2..0000000000 --- a/test/sys/kernel/slab/fat_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ - 14 age=4303047585 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fat_cache/hwcache_align b/test/sys/kernel/slab/fat_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/object_size b/test/sys/kernel/slab/fat_cache/object_size deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/fat_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/fat_cache/objects b/test/sys/kernel/slab/fat_cache/objects deleted file mode 100644 index a2720097dc..0000000000 --- a/test/sys/kernel/slab/fat_cache/objects +++ /dev/null @@ -1 +0,0 @@ -39 diff --git a/test/sys/kernel/slab/fat_cache/objects_partial b/test/sys/kernel/slab/fat_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/objs_per_slab b/test/sys/kernel/slab/fat_cache/objs_per_slab deleted file mode 100644 index a2720097dc..0000000000 --- a/test/sys/kernel/slab/fat_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -39 diff --git a/test/sys/kernel/slab/fat_cache/order b/test/sys/kernel/slab/fat_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/partial b/test/sys/kernel/slab/fat_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/poison b/test/sys/kernel/slab/fat_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_cache/reclaim_account b/test/sys/kernel/slab/fat_cache/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_cache/red_zone b/test/sys/kernel/slab/fat_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_cache/sanity_checks b/test/sys/kernel/slab/fat_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_cache/shrink b/test/sys/kernel/slab/fat_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fat_cache/slab_size b/test/sys/kernel/slab/fat_cache/slab_size deleted file mode 100644 index b16e5f75e3..0000000000 --- a/test/sys/kernel/slab/fat_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -104 diff --git a/test/sys/kernel/slab/fat_cache/slabs b/test/sys/kernel/slab/fat_cache/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_cache/store_user b/test/sys/kernel/slab/fat_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_cache/total_objects b/test/sys/kernel/slab/fat_cache/total_objects deleted file mode 100644 index a2720097dc..0000000000 --- a/test/sys/kernel/slab/fat_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -39 diff --git a/test/sys/kernel/slab/fat_cache/trace b/test/sys/kernel/slab/fat_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_cache/validate b/test/sys/kernel/slab/fat_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fat_inode_cache/aliases b/test/sys/kernel/slab/fat_inode_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_inode_cache/align b/test/sys/kernel/slab/fat_inode_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_inode_cache/alloc_calls b/test/sys/kernel/slab/fat_inode_cache/alloc_calls deleted file mode 100644 index 08bb30ff41..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 76 fat_alloc_inode+0x15/0x30 age=61228/61276/61657 pid=13348-13354 cpus=0-1 diff --git a/test/sys/kernel/slab/fat_inode_cache/cache_dma b/test/sys/kernel/slab/fat_inode_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_inode_cache/cpu_slabs b/test/sys/kernel/slab/fat_inode_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_inode_cache/ctor b/test/sys/kernel/slab/fat_inode_cache/ctor deleted file mode 100644 index 102ae87d64..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x60 diff --git a/test/sys/kernel/slab/fat_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/fat_inode_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_inode_cache/free_calls b/test/sys/kernel/slab/fat_inode_cache/free_calls deleted file mode 100644 index 0834595c6d..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ - 76 age=4303047594 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fat_inode_cache/hwcache_align b/test/sys/kernel/slab/fat_inode_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_inode_cache/object_size b/test/sys/kernel/slab/fat_inode_cache/object_size deleted file mode 100644 index 59a3ec59b5..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -1200 diff --git a/test/sys/kernel/slab/fat_inode_cache/objects b/test/sys/kernel/slab/fat_inode_cache/objects deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/objects +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/kernel/slab/fat_inode_cache/objects_partial b/test/sys/kernel/slab/fat_inode_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_inode_cache/objs_per_slab b/test/sys/kernel/slab/fat_inode_cache/objs_per_slab deleted file mode 100644 index 7273c0fa8c..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -25 diff --git a/test/sys/kernel/slab/fat_inode_cache/order b/test/sys/kernel/slab/fat_inode_cache/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/fat_inode_cache/partial b/test/sys/kernel/slab/fat_inode_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_inode_cache/poison b/test/sys/kernel/slab/fat_inode_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_inode_cache/reclaim_account b/test/sys/kernel/slab/fat_inode_cache/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_inode_cache/red_zone b/test/sys/kernel/slab/fat_inode_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_inode_cache/sanity_checks b/test/sys/kernel/slab/fat_inode_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_inode_cache/shrink b/test/sys/kernel/slab/fat_inode_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fat_inode_cache/slab_size b/test/sys/kernel/slab/fat_inode_cache/slab_size deleted file mode 100644 index 88a90959dc..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1272 diff --git a/test/sys/kernel/slab/fat_inode_cache/slabs b/test/sys/kernel/slab/fat_inode_cache/slabs deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/fat_inode_cache/store_user b/test/sys/kernel/slab/fat_inode_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fat_inode_cache/total_objects b/test/sys/kernel/slab/fat_inode_cache/total_objects deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/kernel/slab/fat_inode_cache/trace b/test/sys/kernel/slab/fat_inode_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fat_inode_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fat_inode_cache/validate b/test/sys/kernel/slab/fat_inode_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fib6_nodes/aliases b/test/sys/kernel/slab/fib6_nodes/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fib6_nodes/align b/test/sys/kernel/slab/fib6_nodes/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fib6_nodes/alloc_calls b/test/sys/kernel/slab/fib6_nodes/alloc_calls deleted file mode 100644 index 1755dde1eb..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/alloc_calls +++ /dev/null @@ -1,3 +0,0 @@ - 3 fib6_add+0x112/0x6a0 [ipv6] age=8328809/8339785/8360575 pid=8-2080 cpus=0-1 - 1 fib6_add+0x2a2/0x6a0 [ipv6] age=8329973 pid=8 cpus=1 - 1 fib6_add+0x2b6/0x6a0 [ipv6] age=8329973 pid=8 cpus=1 diff --git a/test/sys/kernel/slab/fib6_nodes/cache_dma b/test/sys/kernel/slab/fib6_nodes/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fib6_nodes/cpu_slabs b/test/sys/kernel/slab/fib6_nodes/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fib6_nodes/ctor b/test/sys/kernel/slab/fib6_nodes/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fib6_nodes/destroy_by_rcu b/test/sys/kernel/slab/fib6_nodes/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fib6_nodes/free_calls b/test/sys/kernel/slab/fib6_nodes/free_calls deleted file mode 100644 index 47334a2e52..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/free_calls +++ /dev/null @@ -1 +0,0 @@ - 5 age=4303047799 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fib6_nodes/hwcache_align b/test/sys/kernel/slab/fib6_nodes/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fib6_nodes/object_size b/test/sys/kernel/slab/fib6_nodes/object_size deleted file mode 100644 index 21e72e8ac3..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/object_size +++ /dev/null @@ -1 +0,0 @@ -48 diff --git a/test/sys/kernel/slab/fib6_nodes/objects b/test/sys/kernel/slab/fib6_nodes/objects deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/objects +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/fib6_nodes/objects_partial b/test/sys/kernel/slab/fib6_nodes/objects_partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/objects_partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/fib6_nodes/objs_per_slab b/test/sys/kernel/slab/fib6_nodes/objs_per_slab deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/fib6_nodes/order b/test/sys/kernel/slab/fib6_nodes/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fib6_nodes/partial b/test/sys/kernel/slab/fib6_nodes/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/fib6_nodes/poison b/test/sys/kernel/slab/fib6_nodes/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fib6_nodes/reclaim_account b/test/sys/kernel/slab/fib6_nodes/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fib6_nodes/red_zone b/test/sys/kernel/slab/fib6_nodes/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fib6_nodes/sanity_checks b/test/sys/kernel/slab/fib6_nodes/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fib6_nodes/shrink b/test/sys/kernel/slab/fib6_nodes/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fib6_nodes/slab_size b/test/sys/kernel/slab/fib6_nodes/slab_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/slab_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/fib6_nodes/slabs b/test/sys/kernel/slab/fib6_nodes/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/fib6_nodes/store_user b/test/sys/kernel/slab/fib6_nodes/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fib6_nodes/total_objects b/test/sys/kernel/slab/fib6_nodes/total_objects deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/total_objects +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/kernel/slab/fib6_nodes/trace b/test/sys/kernel/slab/fib6_nodes/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fib6_nodes/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fib6_nodes/validate b/test/sys/kernel/slab/fib6_nodes/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/file_lock_cache/aliases b/test/sys/kernel/slab/file_lock_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/align b/test/sys/kernel/slab/file_lock_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/alloc_calls b/test/sys/kernel/slab/file_lock_cache/alloc_calls deleted file mode 100644 index 2c475b2731..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/alloc_calls +++ /dev/null @@ -1,2 +0,0 @@ - 2 flock_lock_file_wait+0x2d6/0x2f0 age=8355055/8355767/8356479 pid=1690-1807 cpus=0 - 1 __posix_lock_file+0x3f/0x560 age=8349601 pid=2262 cpus=0 diff --git a/test/sys/kernel/slab/file_lock_cache/cache_dma b/test/sys/kernel/slab/file_lock_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/cpu_slabs b/test/sys/kernel/slab/file_lock_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/ctor b/test/sys/kernel/slab/file_lock_cache/ctor deleted file mode 100644 index 2940046f62..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/file_lock_cache/destroy_by_rcu b/test/sys/kernel/slab/file_lock_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/free_calls b/test/sys/kernel/slab/file_lock_cache/free_calls deleted file mode 100644 index af3a86af86..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ - 3 locks_free_lock+0x3e/0x60 age=8351291/8355422/8359832 pid=1549-2189 cpus=0 diff --git a/test/sys/kernel/slab/file_lock_cache/hwcache_align b/test/sys/kernel/slab/file_lock_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/object_size b/test/sys/kernel/slab/file_lock_cache/object_size deleted file mode 100644 index 20c90807cc..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -224 diff --git a/test/sys/kernel/slab/file_lock_cache/objects b/test/sys/kernel/slab/file_lock_cache/objects deleted file mode 100644 index 6f4247a625..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/objects +++ /dev/null @@ -1 +0,0 @@ -26 diff --git a/test/sys/kernel/slab/file_lock_cache/objects_partial b/test/sys/kernel/slab/file_lock_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/objs_per_slab b/test/sys/kernel/slab/file_lock_cache/objs_per_slab deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/kernel/slab/file_lock_cache/order b/test/sys/kernel/slab/file_lock_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/partial b/test/sys/kernel/slab/file_lock_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/poison b/test/sys/kernel/slab/file_lock_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/file_lock_cache/reclaim_account b/test/sys/kernel/slab/file_lock_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/red_zone b/test/sys/kernel/slab/file_lock_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/file_lock_cache/sanity_checks b/test/sys/kernel/slab/file_lock_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/file_lock_cache/shrink b/test/sys/kernel/slab/file_lock_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/file_lock_cache/slab_size b/test/sys/kernel/slab/file_lock_cache/slab_size deleted file mode 100644 index 9530e04878..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -296 diff --git a/test/sys/kernel/slab/file_lock_cache/slabs b/test/sys/kernel/slab/file_lock_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/file_lock_cache/store_user b/test/sys/kernel/slab/file_lock_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/file_lock_cache/total_objects b/test/sys/kernel/slab/file_lock_cache/total_objects deleted file mode 100644 index 6f4247a625..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -26 diff --git a/test/sys/kernel/slab/file_lock_cache/trace b/test/sys/kernel/slab/file_lock_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/file_lock_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/file_lock_cache/validate b/test/sys/kernel/slab/file_lock_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/files_cache/aliases b/test/sys/kernel/slab/files_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/files_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/files_cache/align b/test/sys/kernel/slab/files_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/files_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/files_cache/alloc_calls b/test/sys/kernel/slab/files_cache/alloc_calls deleted file mode 100644 index 91a3b86393..0000000000 --- a/test/sys/kernel/slab/files_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 80 dup_fd+0x2e/0x420 age=4136/7769280/8379905 pid=0-12336 cpus=0-1 diff --git a/test/sys/kernel/slab/files_cache/cache_dma b/test/sys/kernel/slab/files_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/files_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/files_cache/cpu_slabs b/test/sys/kernel/slab/files_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/files_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/files_cache/ctor b/test/sys/kernel/slab/files_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/files_cache/destroy_by_rcu b/test/sys/kernel/slab/files_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/files_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/files_cache/free_calls b/test/sys/kernel/slab/files_cache/free_calls deleted file mode 100644 index 67591246a6..0000000000 --- a/test/sys/kernel/slab/files_cache/free_calls +++ /dev/null @@ -1,3 +0,0 @@ - 9 age=4303047250 pid=0 cpus=0 - 31 put_files_struct+0xb4/0xe0 age=7177/7367129/8366999 pid=1202-20292 cpus=0-1 - 40 free_fdtable_rcu+0xa0/0xb0 age=61634/7953135/8376143 pid=0-12335 cpus=0-1 diff --git a/test/sys/kernel/slab/files_cache/hwcache_align b/test/sys/kernel/slab/files_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/files_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/files_cache/object_size b/test/sys/kernel/slab/files_cache/object_size deleted file mode 100644 index dc763b654e..0000000000 --- a/test/sys/kernel/slab/files_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -768 diff --git a/test/sys/kernel/slab/files_cache/objects b/test/sys/kernel/slab/files_cache/objects deleted file mode 100644 index 398050c62c..0000000000 --- a/test/sys/kernel/slab/files_cache/objects +++ /dev/null @@ -1 +0,0 @@ -101 diff --git a/test/sys/kernel/slab/files_cache/objects_partial b/test/sys/kernel/slab/files_cache/objects_partial deleted file mode 100644 index f04c001f3f..0000000000 --- a/test/sys/kernel/slab/files_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -29 diff --git a/test/sys/kernel/slab/files_cache/objs_per_slab b/test/sys/kernel/slab/files_cache/objs_per_slab deleted file mode 100644 index 3c032078a4..0000000000 --- a/test/sys/kernel/slab/files_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/test/sys/kernel/slab/files_cache/order b/test/sys/kernel/slab/files_cache/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/files_cache/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/files_cache/partial b/test/sys/kernel/slab/files_cache/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/files_cache/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/files_cache/poison b/test/sys/kernel/slab/files_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/files_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/files_cache/reclaim_account b/test/sys/kernel/slab/files_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/files_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/files_cache/red_zone b/test/sys/kernel/slab/files_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/files_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/files_cache/sanity_checks b/test/sys/kernel/slab/files_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/files_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/files_cache/shrink b/test/sys/kernel/slab/files_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/files_cache/slab_size b/test/sys/kernel/slab/files_cache/slab_size deleted file mode 100644 index 4564b1f0a0..0000000000 --- a/test/sys/kernel/slab/files_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -896 diff --git a/test/sys/kernel/slab/files_cache/slabs b/test/sys/kernel/slab/files_cache/slabs deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/kernel/slab/files_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/kernel/slab/files_cache/store_user b/test/sys/kernel/slab/files_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/files_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/files_cache/total_objects b/test/sys/kernel/slab/files_cache/total_objects deleted file mode 100644 index 3b20426c05..0000000000 --- a/test/sys/kernel/slab/files_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -108 diff --git a/test/sys/kernel/slab/files_cache/trace b/test/sys/kernel/slab/files_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/files_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/files_cache/validate b/test/sys/kernel/slab/files_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/filp/aliases b/test/sys/kernel/slab/filp/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/filp/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/filp/align b/test/sys/kernel/slab/filp/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/filp/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/filp/alloc_calls b/test/sys/kernel/slab/filp/alloc_calls deleted file mode 100644 index 859cdd53d4..0000000000 --- a/test/sys/kernel/slab/filp/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 4081 get_empty_filp+0x44/0x1a0 age=0/7917861/8378089 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/filp/cache_dma b/test/sys/kernel/slab/filp/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/filp/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/filp/cpu_slabs b/test/sys/kernel/slab/filp/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/filp/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/filp/ctor b/test/sys/kernel/slab/filp/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/filp/destroy_by_rcu b/test/sys/kernel/slab/filp/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/filp/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/filp/free_calls b/test/sys/kernel/slab/filp/free_calls deleted file mode 100644 index c9d339b7be..0000000000 --- a/test/sys/kernel/slab/filp/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 866 age=4303047162 pid=0 cpus=0 - 3217 file_free_rcu+0x16/0x20 age=10/7799670/8377025 pid=0-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/filp/hwcache_align b/test/sys/kernel/slab/filp/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/filp/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/filp/object_size b/test/sys/kernel/slab/filp/object_size deleted file mode 100644 index ea80947336..0000000000 --- a/test/sys/kernel/slab/filp/object_size +++ /dev/null @@ -1 +0,0 @@ -288 diff --git a/test/sys/kernel/slab/filp/objects b/test/sys/kernel/slab/filp/objects deleted file mode 100644 index 8fd7a82447..0000000000 --- a/test/sys/kernel/slab/filp/objects +++ /dev/null @@ -1 +0,0 @@ -4064 diff --git a/test/sys/kernel/slab/filp/objects_partial b/test/sys/kernel/slab/filp/objects_partial deleted file mode 100644 index d4d7ff298a..0000000000 --- a/test/sys/kernel/slab/filp/objects_partial +++ /dev/null @@ -1 +0,0 @@ -685 diff --git a/test/sys/kernel/slab/filp/objs_per_slab b/test/sys/kernel/slab/filp/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/filp/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/filp/order b/test/sys/kernel/slab/filp/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/filp/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/filp/partial b/test/sys/kernel/slab/filp/partial deleted file mode 100644 index bb95160cb6..0000000000 --- a/test/sys/kernel/slab/filp/partial +++ /dev/null @@ -1 +0,0 @@ -33 diff --git a/test/sys/kernel/slab/filp/poison b/test/sys/kernel/slab/filp/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/filp/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/filp/reclaim_account b/test/sys/kernel/slab/filp/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/filp/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/filp/red_zone b/test/sys/kernel/slab/filp/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/filp/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/filp/sanity_checks b/test/sys/kernel/slab/filp/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/filp/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/filp/shrink b/test/sys/kernel/slab/filp/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/filp/slab_size b/test/sys/kernel/slab/filp/slab_size deleted file mode 100644 index e45b99e958..0000000000 --- a/test/sys/kernel/slab/filp/slab_size +++ /dev/null @@ -1 +0,0 @@ -384 diff --git a/test/sys/kernel/slab/filp/slabs b/test/sys/kernel/slab/filp/slabs deleted file mode 100644 index ca55a6c593..0000000000 --- a/test/sys/kernel/slab/filp/slabs +++ /dev/null @@ -1 +0,0 @@ -198 diff --git a/test/sys/kernel/slab/filp/store_user b/test/sys/kernel/slab/filp/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/filp/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/filp/total_objects b/test/sys/kernel/slab/filp/total_objects deleted file mode 100644 index 50576ba176..0000000000 --- a/test/sys/kernel/slab/filp/total_objects +++ /dev/null @@ -1 +0,0 @@ -4158 diff --git a/test/sys/kernel/slab/filp/trace b/test/sys/kernel/slab/filp/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/filp/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/filp/validate b/test/sys/kernel/slab/filp/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/flow_cache/aliases b/test/sys/kernel/slab/flow_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/align b/test/sys/kernel/slab/flow_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/alloc_calls b/test/sys/kernel/slab/flow_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/flow_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/flow_cache/cache_dma b/test/sys/kernel/slab/flow_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/cpu_slabs b/test/sys/kernel/slab/flow_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/ctor b/test/sys/kernel/slab/flow_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/flow_cache/destroy_by_rcu b/test/sys/kernel/slab/flow_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/free_calls b/test/sys/kernel/slab/flow_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/flow_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/flow_cache/hwcache_align b/test/sys/kernel/slab/flow_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/object_size b/test/sys/kernel/slab/flow_cache/object_size deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/flow_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/flow_cache/objects b/test/sys/kernel/slab/flow_cache/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/objects_partial b/test/sys/kernel/slab/flow_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/objs_per_slab b/test/sys/kernel/slab/flow_cache/objs_per_slab deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/flow_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/flow_cache/order b/test/sys/kernel/slab/flow_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/partial b/test/sys/kernel/slab/flow_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/poison b/test/sys/kernel/slab/flow_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/flow_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/flow_cache/reclaim_account b/test/sys/kernel/slab/flow_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/red_zone b/test/sys/kernel/slab/flow_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/flow_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/flow_cache/sanity_checks b/test/sys/kernel/slab/flow_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/flow_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/flow_cache/shrink b/test/sys/kernel/slab/flow_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/flow_cache/slab_size b/test/sys/kernel/slab/flow_cache/slab_size deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/kernel/slab/flow_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/kernel/slab/flow_cache/slabs b/test/sys/kernel/slab/flow_cache/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/store_user b/test/sys/kernel/slab/flow_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/flow_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/flow_cache/total_objects b/test/sys/kernel/slab/flow_cache/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/trace b/test/sys/kernel/slab/flow_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/flow_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/flow_cache/validate b/test/sys/kernel/slab/flow_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fs_cache/aliases b/test/sys/kernel/slab/fs_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fs_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fs_cache/align b/test/sys/kernel/slab/fs_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fs_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fs_cache/alloc_calls b/test/sys/kernel/slab/fs_cache/alloc_calls deleted file mode 100644 index b649a58a81..0000000000 --- a/test/sys/kernel/slab/fs_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 79 __copy_fs_struct+0x28/0xc0 age=4126/7761540/8379883 pid=1-12336 cpus=0-1 diff --git a/test/sys/kernel/slab/fs_cache/cache_dma b/test/sys/kernel/slab/fs_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fs_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fs_cache/cpu_slabs b/test/sys/kernel/slab/fs_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fs_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fs_cache/ctor b/test/sys/kernel/slab/fs_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fs_cache/destroy_by_rcu b/test/sys/kernel/slab/fs_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fs_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fs_cache/free_calls b/test/sys/kernel/slab/fs_cache/free_calls deleted file mode 100644 index 012510564c..0000000000 --- a/test/sys/kernel/slab/fs_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 7 age=4303047241 pid=0 cpus=0 - 72 put_fs_struct+0x37/0x40 age=7168/7706405/8375333 pid=145-20292 cpus=0-1 diff --git a/test/sys/kernel/slab/fs_cache/hwcache_align b/test/sys/kernel/slab/fs_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fs_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fs_cache/object_size b/test/sys/kernel/slab/fs_cache/object_size deleted file mode 100644 index b16e5f75e3..0000000000 --- a/test/sys/kernel/slab/fs_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -104 diff --git a/test/sys/kernel/slab/fs_cache/objects b/test/sys/kernel/slab/fs_cache/objects deleted file mode 100644 index 5bc6609e3d..0000000000 --- a/test/sys/kernel/slab/fs_cache/objects +++ /dev/null @@ -1 +0,0 @@ -117 diff --git a/test/sys/kernel/slab/fs_cache/objects_partial b/test/sys/kernel/slab/fs_cache/objects_partial deleted file mode 100644 index 78eb67cee1..0000000000 --- a/test/sys/kernel/slab/fs_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -75 diff --git a/test/sys/kernel/slab/fs_cache/objs_per_slab b/test/sys/kernel/slab/fs_cache/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/fs_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/fs_cache/order b/test/sys/kernel/slab/fs_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fs_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fs_cache/partial b/test/sys/kernel/slab/fs_cache/partial deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/fs_cache/partial +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/fs_cache/poison b/test/sys/kernel/slab/fs_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fs_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fs_cache/reclaim_account b/test/sys/kernel/slab/fs_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fs_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fs_cache/red_zone b/test/sys/kernel/slab/fs_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fs_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fs_cache/sanity_checks b/test/sys/kernel/slab/fs_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fs_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fs_cache/shrink b/test/sys/kernel/slab/fs_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fs_cache/slab_size b/test/sys/kernel/slab/fs_cache/slab_size deleted file mode 100644 index 86a0307199..0000000000 --- a/test/sys/kernel/slab/fs_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -192 diff --git a/test/sys/kernel/slab/fs_cache/slabs b/test/sys/kernel/slab/fs_cache/slabs deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/kernel/slab/fs_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/kernel/slab/fs_cache/store_user b/test/sys/kernel/slab/fs_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fs_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fs_cache/total_objects b/test/sys/kernel/slab/fs_cache/total_objects deleted file mode 100644 index 0a3e7b0422..0000000000 --- a/test/sys/kernel/slab/fs_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -126 diff --git a/test/sys/kernel/slab/fs_cache/trace b/test/sys/kernel/slab/fs_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fs_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fs_cache/validate b/test/sys/kernel/slab/fs_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fuse_inode/aliases b/test/sys/kernel/slab/fuse_inode/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_inode/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_inode/align b/test/sys/kernel/slab/fuse_inode/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_inode/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_inode/alloc_calls b/test/sys/kernel/slab/fuse_inode/alloc_calls deleted file mode 100644 index 936ae91006..0000000000 --- a/test/sys/kernel/slab/fuse_inode/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1 fuse_alloc_inode+0x1a/0xe0 [fuse] age=8336111 pid=2476 cpus=0 diff --git a/test/sys/kernel/slab/fuse_inode/cache_dma b/test/sys/kernel/slab/fuse_inode/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_inode/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_inode/cpu_slabs b/test/sys/kernel/slab/fuse_inode/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_inode/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_inode/ctor b/test/sys/kernel/slab/fuse_inode/ctor deleted file mode 100644 index 74a5d262d7..0000000000 --- a/test/sys/kernel/slab/fuse_inode/ctor +++ /dev/null @@ -1 +0,0 @@ -fuse_inode_init_once+0x0/0x10 [fuse] diff --git a/test/sys/kernel/slab/fuse_inode/destroy_by_rcu b/test/sys/kernel/slab/fuse_inode/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_inode/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_inode/free_calls b/test/sys/kernel/slab/fuse_inode/free_calls deleted file mode 100644 index 0d21fe5f97..0000000000 --- a/test/sys/kernel/slab/fuse_inode/free_calls +++ /dev/null @@ -1 +0,0 @@ - 1 age=4303047710 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fuse_inode/hwcache_align b/test/sys/kernel/slab/fuse_inode/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_inode/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_inode/object_size b/test/sys/kernel/slab/fuse_inode/object_size deleted file mode 100644 index 600fe59b5a..0000000000 --- a/test/sys/kernel/slab/fuse_inode/object_size +++ /dev/null @@ -1 +0,0 @@ -1248 diff --git a/test/sys/kernel/slab/fuse_inode/objects b/test/sys/kernel/slab/fuse_inode/objects deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_inode/objects +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_inode/objects_partial b/test/sys/kernel/slab/fuse_inode/objects_partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_inode/objects_partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_inode/objs_per_slab b/test/sys/kernel/slab/fuse_inode/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/fuse_inode/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/fuse_inode/order b/test/sys/kernel/slab/fuse_inode/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/fuse_inode/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/fuse_inode/partial b/test/sys/kernel/slab/fuse_inode/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_inode/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_inode/poison b/test/sys/kernel/slab/fuse_inode/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_inode/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_inode/reclaim_account b/test/sys/kernel/slab/fuse_inode/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_inode/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_inode/red_zone b/test/sys/kernel/slab/fuse_inode/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_inode/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_inode/sanity_checks b/test/sys/kernel/slab/fuse_inode/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_inode/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_inode/shrink b/test/sys/kernel/slab/fuse_inode/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fuse_inode/slab_size b/test/sys/kernel/slab/fuse_inode/slab_size deleted file mode 100644 index 3f3c936679..0000000000 --- a/test/sys/kernel/slab/fuse_inode/slab_size +++ /dev/null @@ -1 +0,0 @@ -1344 diff --git a/test/sys/kernel/slab/fuse_inode/slabs b/test/sys/kernel/slab/fuse_inode/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_inode/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_inode/store_user b/test/sys/kernel/slab/fuse_inode/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_inode/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_inode/total_objects b/test/sys/kernel/slab/fuse_inode/total_objects deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/fuse_inode/total_objects +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/fuse_inode/trace b/test/sys/kernel/slab/fuse_inode/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_inode/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_inode/validate b/test/sys/kernel/slab/fuse_inode/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fuse_request/aliases b/test/sys/kernel/slab/fuse_request/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/align b/test/sys/kernel/slab/fuse_request/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/alloc_calls b/test/sys/kernel/slab/fuse_request/alloc_calls deleted file mode 100644 index 59a0bc24ac..0000000000 --- a/test/sys/kernel/slab/fuse_request/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1 fuse_request_alloc+0x1a/0x40 [fuse] age=8336120 pid=2476 cpus=0 diff --git a/test/sys/kernel/slab/fuse_request/cache_dma b/test/sys/kernel/slab/fuse_request/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/cpu_slabs b/test/sys/kernel/slab/fuse_request/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/ctor b/test/sys/kernel/slab/fuse_request/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fuse_request/destroy_by_rcu b/test/sys/kernel/slab/fuse_request/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/free_calls b/test/sys/kernel/slab/fuse_request/free_calls deleted file mode 100644 index be2917d224..0000000000 --- a/test/sys/kernel/slab/fuse_request/free_calls +++ /dev/null @@ -1 +0,0 @@ - 1 age=4303047718 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/fuse_request/hwcache_align b/test/sys/kernel/slab/fuse_request/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/object_size b/test/sys/kernel/slab/fuse_request/object_size deleted file mode 100644 index 39adda3c66..0000000000 --- a/test/sys/kernel/slab/fuse_request/object_size +++ /dev/null @@ -1 +0,0 @@ -656 diff --git a/test/sys/kernel/slab/fuse_request/objects b/test/sys/kernel/slab/fuse_request/objects deleted file mode 100644 index c739b42c4d..0000000000 --- a/test/sys/kernel/slab/fuse_request/objects +++ /dev/null @@ -1 +0,0 @@ -44 diff --git a/test/sys/kernel/slab/fuse_request/objects_partial b/test/sys/kernel/slab/fuse_request/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/objs_per_slab b/test/sys/kernel/slab/fuse_request/objs_per_slab deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/fuse_request/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/fuse_request/order b/test/sys/kernel/slab/fuse_request/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/fuse_request/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/fuse_request/partial b/test/sys/kernel/slab/fuse_request/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/poison b/test/sys/kernel/slab/fuse_request/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_request/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_request/reclaim_account b/test/sys/kernel/slab/fuse_request/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/red_zone b/test/sys/kernel/slab/fuse_request/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_request/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_request/sanity_checks b/test/sys/kernel/slab/fuse_request/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_request/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_request/shrink b/test/sys/kernel/slab/fuse_request/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/fuse_request/slab_size b/test/sys/kernel/slab/fuse_request/slab_size deleted file mode 100644 index f4815f7c10..0000000000 --- a/test/sys/kernel/slab/fuse_request/slab_size +++ /dev/null @@ -1 +0,0 @@ -728 diff --git a/test/sys/kernel/slab/fuse_request/slabs b/test/sys/kernel/slab/fuse_request/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/fuse_request/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/fuse_request/store_user b/test/sys/kernel/slab/fuse_request/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/fuse_request/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/fuse_request/total_objects b/test/sys/kernel/slab/fuse_request/total_objects deleted file mode 100644 index c739b42c4d..0000000000 --- a/test/sys/kernel/slab/fuse_request/total_objects +++ /dev/null @@ -1 +0,0 @@ -44 diff --git a/test/sys/kernel/slab/fuse_request/trace b/test/sys/kernel/slab/fuse_request/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/fuse_request/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/fuse_request/validate b/test/sys/kernel/slab/fuse_request/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/idr_layer_cache/aliases b/test/sys/kernel/slab/idr_layer_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/idr_layer_cache/align b/test/sys/kernel/slab/idr_layer_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/idr_layer_cache/alloc_calls b/test/sys/kernel/slab/idr_layer_cache/alloc_calls deleted file mode 100644 index 51a21d5acb..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 406 idr_pre_get+0x5d/0x80 age=60336/8278969/8380018 pid=0-13355 cpus=0-1 diff --git a/test/sys/kernel/slab/idr_layer_cache/cache_dma b/test/sys/kernel/slab/idr_layer_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/idr_layer_cache/cpu_slabs b/test/sys/kernel/slab/idr_layer_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/idr_layer_cache/ctor b/test/sys/kernel/slab/idr_layer_cache/ctor deleted file mode 100644 index 643dfd948c..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -idr_cache_ctor+0x0/0x10 diff --git a/test/sys/kernel/slab/idr_layer_cache/destroy_by_rcu b/test/sys/kernel/slab/idr_layer_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/idr_layer_cache/free_calls b/test/sys/kernel/slab/idr_layer_cache/free_calls deleted file mode 100644 index ce484d2593..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/free_calls +++ /dev/null @@ -1,4 +0,0 @@ - 304 age=4303047315 pid=0 cpus=0 - 3 idr_destroy+0x2f/0x40 age=104486/3178486/4715486 pid=13211-13803 cpus=0-1 - 4 idr_layer_rcu_free+0x17/0x20 age=8334501/8362397/8377168 pid=0-1155 cpus=0-1 - 95 ida_get_new_above+0x141/0x210 age=812584/8292482/8380019 pid=0-2593 cpus=0-1 diff --git a/test/sys/kernel/slab/idr_layer_cache/hwcache_align b/test/sys/kernel/slab/idr_layer_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/idr_layer_cache/object_size b/test/sys/kernel/slab/idr_layer_cache/object_size deleted file mode 100644 index 4970e693e1..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -544 diff --git a/test/sys/kernel/slab/idr_layer_cache/objects b/test/sys/kernel/slab/idr_layer_cache/objects deleted file mode 100644 index 816d01be5c..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/objects +++ /dev/null @@ -1 +0,0 @@ -420 diff --git a/test/sys/kernel/slab/idr_layer_cache/objects_partial b/test/sys/kernel/slab/idr_layer_cache/objects_partial deleted file mode 100644 index dde92ddc1a..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -82 diff --git a/test/sys/kernel/slab/idr_layer_cache/objs_per_slab b/test/sys/kernel/slab/idr_layer_cache/objs_per_slab deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/kernel/slab/idr_layer_cache/order b/test/sys/kernel/slab/idr_layer_cache/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/idr_layer_cache/partial b/test/sys/kernel/slab/idr_layer_cache/partial deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/partial +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/idr_layer_cache/poison b/test/sys/kernel/slab/idr_layer_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/idr_layer_cache/reclaim_account b/test/sys/kernel/slab/idr_layer_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/idr_layer_cache/red_zone b/test/sys/kernel/slab/idr_layer_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/idr_layer_cache/sanity_checks b/test/sys/kernel/slab/idr_layer_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/idr_layer_cache/shrink b/test/sys/kernel/slab/idr_layer_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/idr_layer_cache/slab_size b/test/sys/kernel/slab/idr_layer_cache/slab_size deleted file mode 100644 index ac62e9337c..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -616 diff --git a/test/sys/kernel/slab/idr_layer_cache/slabs b/test/sys/kernel/slab/idr_layer_cache/slabs deleted file mode 100644 index a787364590..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -34 diff --git a/test/sys/kernel/slab/idr_layer_cache/store_user b/test/sys/kernel/slab/idr_layer_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/idr_layer_cache/total_objects b/test/sys/kernel/slab/idr_layer_cache/total_objects deleted file mode 100644 index 18e1dd6bc4..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -442 diff --git a/test/sys/kernel/slab/idr_layer_cache/trace b/test/sys/kernel/slab/idr_layer_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/idr_layer_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/idr_layer_cache/validate b/test/sys/kernel/slab/idr_layer_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inet_peer_cache/aliases b/test/sys/kernel/slab/inet_peer_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/align b/test/sys/kernel/slab/inet_peer_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/alloc_calls b/test/sys/kernel/slab/inet_peer_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/inet_peer_cache/cache_dma b/test/sys/kernel/slab/inet_peer_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/cpu_slabs b/test/sys/kernel/slab/inet_peer_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/ctor b/test/sys/kernel/slab/inet_peer_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inet_peer_cache/destroy_by_rcu b/test/sys/kernel/slab/inet_peer_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/free_calls b/test/sys/kernel/slab/inet_peer_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/inet_peer_cache/hwcache_align b/test/sys/kernel/slab/inet_peer_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inet_peer_cache/object_size b/test/sys/kernel/slab/inet_peer_cache/object_size deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/kernel/slab/inet_peer_cache/objects b/test/sys/kernel/slab/inet_peer_cache/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/objects_partial b/test/sys/kernel/slab/inet_peer_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/objs_per_slab b/test/sys/kernel/slab/inet_peer_cache/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/inet_peer_cache/order b/test/sys/kernel/slab/inet_peer_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/partial b/test/sys/kernel/slab/inet_peer_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/poison b/test/sys/kernel/slab/inet_peer_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inet_peer_cache/reclaim_account b/test/sys/kernel/slab/inet_peer_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/red_zone b/test/sys/kernel/slab/inet_peer_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inet_peer_cache/sanity_checks b/test/sys/kernel/slab/inet_peer_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inet_peer_cache/shrink b/test/sys/kernel/slab/inet_peer_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inet_peer_cache/slab_size b/test/sys/kernel/slab/inet_peer_cache/slab_size deleted file mode 100644 index 86a0307199..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -192 diff --git a/test/sys/kernel/slab/inet_peer_cache/slabs b/test/sys/kernel/slab/inet_peer_cache/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/store_user b/test/sys/kernel/slab/inet_peer_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inet_peer_cache/total_objects b/test/sys/kernel/slab/inet_peer_cache/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/trace b/test/sys/kernel/slab/inet_peer_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inet_peer_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inet_peer_cache/validate b/test/sys/kernel/slab/inet_peer_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inode_cache/aliases b/test/sys/kernel/slab/inode_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inode_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inode_cache/align b/test/sys/kernel/slab/inode_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inode_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inode_cache/alloc_calls b/test/sys/kernel/slab/inode_cache/alloc_calls deleted file mode 100644 index fe8e5cf82f..0000000000 --- a/test/sys/kernel/slab/inode_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 11655 alloc_inode+0x251/0x280 age=665/7686826/8379810 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/inode_cache/cache_dma b/test/sys/kernel/slab/inode_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inode_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inode_cache/cpu_slabs b/test/sys/kernel/slab/inode_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inode_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inode_cache/ctor b/test/sys/kernel/slab/inode_cache/ctor deleted file mode 100644 index 2940046f62..0000000000 --- a/test/sys/kernel/slab/inode_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/inode_cache/destroy_by_rcu b/test/sys/kernel/slab/inode_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inode_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inode_cache/free_calls b/test/sys/kernel/slab/inode_cache/free_calls deleted file mode 100644 index dc7e11783d..0000000000 --- a/test/sys/kernel/slab/inode_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 11113 age=4303047110 pid=0 cpus=0 - 542 destroy_inode+0x4f/0x60 age=1016/6891707/8377435 pid=7-15896 cpus=0-1 diff --git a/test/sys/kernel/slab/inode_cache/hwcache_align b/test/sys/kernel/slab/inode_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inode_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inode_cache/object_size b/test/sys/kernel/slab/inode_cache/object_size deleted file mode 100644 index e255a85551..0000000000 --- a/test/sys/kernel/slab/inode_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -1072 diff --git a/test/sys/kernel/slab/inode_cache/objects b/test/sys/kernel/slab/inode_cache/objects deleted file mode 100644 index 24d09039ee..0000000000 --- a/test/sys/kernel/slab/inode_cache/objects +++ /dev/null @@ -1 +0,0 @@ -11676 diff --git a/test/sys/kernel/slab/inode_cache/objects_partial b/test/sys/kernel/slab/inode_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inode_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inode_cache/objs_per_slab b/test/sys/kernel/slab/inode_cache/objs_per_slab deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/inode_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/inode_cache/order b/test/sys/kernel/slab/inode_cache/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/inode_cache/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/inode_cache/partial b/test/sys/kernel/slab/inode_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inode_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inode_cache/poison b/test/sys/kernel/slab/inode_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inode_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inode_cache/reclaim_account b/test/sys/kernel/slab/inode_cache/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inode_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inode_cache/red_zone b/test/sys/kernel/slab/inode_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inode_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inode_cache/sanity_checks b/test/sys/kernel/slab/inode_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inode_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inode_cache/shrink b/test/sys/kernel/slab/inode_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inode_cache/slab_size b/test/sys/kernel/slab/inode_cache/slab_size deleted file mode 100644 index fdab865fb7..0000000000 --- a/test/sys/kernel/slab/inode_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1144 diff --git a/test/sys/kernel/slab/inode_cache/slabs b/test/sys/kernel/slab/inode_cache/slabs deleted file mode 100644 index 6006f5cafc..0000000000 --- a/test/sys/kernel/slab/inode_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -834 diff --git a/test/sys/kernel/slab/inode_cache/store_user b/test/sys/kernel/slab/inode_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inode_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inode_cache/total_objects b/test/sys/kernel/slab/inode_cache/total_objects deleted file mode 100644 index 24d09039ee..0000000000 --- a/test/sys/kernel/slab/inode_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -11676 diff --git a/test/sys/kernel/slab/inode_cache/trace b/test/sys/kernel/slab/inode_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inode_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inode_cache/validate b/test/sys/kernel/slab/inode_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inotify_event_cache/aliases b/test/sys/kernel/slab/inotify_event_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/align b/test/sys/kernel/slab/inotify_event_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/alloc_calls b/test/sys/kernel/slab/inotify_event_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/inotify_event_cache/cache_dma b/test/sys/kernel/slab/inotify_event_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/cpu_slabs b/test/sys/kernel/slab/inotify_event_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/ctor b/test/sys/kernel/slab/inotify_event_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inotify_event_cache/destroy_by_rcu b/test/sys/kernel/slab/inotify_event_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/free_calls b/test/sys/kernel/slab/inotify_event_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/inotify_event_cache/hwcache_align b/test/sys/kernel/slab/inotify_event_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/object_size b/test/sys/kernel/slab/inotify_event_cache/object_size deleted file mode 100644 index 425151f3a4..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -40 diff --git a/test/sys/kernel/slab/inotify_event_cache/objects b/test/sys/kernel/slab/inotify_event_cache/objects deleted file mode 100644 index ea70ce0134..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/objects +++ /dev/null @@ -1 +0,0 @@ -72 diff --git a/test/sys/kernel/slab/inotify_event_cache/objects_partial b/test/sys/kernel/slab/inotify_event_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/objs_per_slab b/test/sys/kernel/slab/inotify_event_cache/objs_per_slab deleted file mode 100644 index 7facc89938..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -36 diff --git a/test/sys/kernel/slab/inotify_event_cache/order b/test/sys/kernel/slab/inotify_event_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/partial b/test/sys/kernel/slab/inotify_event_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/poison b/test/sys/kernel/slab/inotify_event_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inotify_event_cache/reclaim_account b/test/sys/kernel/slab/inotify_event_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/red_zone b/test/sys/kernel/slab/inotify_event_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inotify_event_cache/sanity_checks b/test/sys/kernel/slab/inotify_event_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inotify_event_cache/shrink b/test/sys/kernel/slab/inotify_event_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inotify_event_cache/slab_size b/test/sys/kernel/slab/inotify_event_cache/slab_size deleted file mode 100644 index 194b81caae..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -112 diff --git a/test/sys/kernel/slab/inotify_event_cache/slabs b/test/sys/kernel/slab/inotify_event_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/inotify_event_cache/store_user b/test/sys/kernel/slab/inotify_event_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inotify_event_cache/total_objects b/test/sys/kernel/slab/inotify_event_cache/total_objects deleted file mode 100644 index ea70ce0134..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -72 diff --git a/test/sys/kernel/slab/inotify_event_cache/trace b/test/sys/kernel/slab/inotify_event_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_event_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_event_cache/validate b/test/sys/kernel/slab/inotify_event_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inotify_watch_cache/aliases b/test/sys/kernel/slab/inotify_watch_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/align b/test/sys/kernel/slab/inotify_watch_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/alloc_calls b/test/sys/kernel/slab/inotify_watch_cache/alloc_calls deleted file mode 100644 index 7ede8c24a9..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 126 sys_inotify_add_watch+0x15e/0x1d0 age=60497/8227702/8376765 pid=72-13355 cpus=0-1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/cache_dma b/test/sys/kernel/slab/inotify_watch_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/cpu_slabs b/test/sys/kernel/slab/inotify_watch_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/ctor b/test/sys/kernel/slab/inotify_watch_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inotify_watch_cache/destroy_by_rcu b/test/sys/kernel/slab/inotify_watch_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/free_calls b/test/sys/kernel/slab/inotify_watch_cache/free_calls deleted file mode 100644 index cafeb9a57e..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 122 age=4303047477 pid=0 cpus=0 - 4 free_inotify_user_watch+0x60/0x70 age=104648/4219698/8334832 pid=2423-13211 cpus=0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/hwcache_align b/test/sys/kernel/slab/inotify_watch_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/object_size b/test/sys/kernel/slab/inotify_watch_cache/object_size deleted file mode 100644 index ea70ce0134..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -72 diff --git a/test/sys/kernel/slab/inotify_watch_cache/objects b/test/sys/kernel/slab/inotify_watch_cache/objects deleted file mode 100644 index 4e9bdff0c6..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/objects +++ /dev/null @@ -1 +0,0 @@ -164 diff --git a/test/sys/kernel/slab/inotify_watch_cache/objects_partial b/test/sys/kernel/slab/inotify_watch_cache/objects_partial deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/inotify_watch_cache/objs_per_slab b/test/sys/kernel/slab/inotify_watch_cache/objs_per_slab deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/inotify_watch_cache/order b/test/sys/kernel/slab/inotify_watch_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/partial b/test/sys/kernel/slab/inotify_watch_cache/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/poison b/test/sys/kernel/slab/inotify_watch_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/reclaim_account b/test/sys/kernel/slab/inotify_watch_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/red_zone b/test/sys/kernel/slab/inotify_watch_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/sanity_checks b/test/sys/kernel/slab/inotify_watch_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/shrink b/test/sys/kernel/slab/inotify_watch_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/inotify_watch_cache/slab_size b/test/sys/kernel/slab/inotify_watch_cache/slab_size deleted file mode 100644 index a29644e57e..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -144 diff --git a/test/sys/kernel/slab/inotify_watch_cache/slabs b/test/sys/kernel/slab/inotify_watch_cache/slabs deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/kernel/slab/inotify_watch_cache/store_user b/test/sys/kernel/slab/inotify_watch_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/inotify_watch_cache/total_objects b/test/sys/kernel/slab/inotify_watch_cache/total_objects deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/kernel/slab/inotify_watch_cache/trace b/test/sys/kernel/slab/inotify_watch_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/inotify_watch_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/inotify_watch_cache/validate b/test/sys/kernel/slab/inotify_watch_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip6_dst_cache/aliases b/test/sys/kernel/slab/ip6_dst_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/align b/test/sys/kernel/slab/ip6_dst_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/alloc_calls b/test/sys/kernel/slab/ip6_dst_cache/alloc_calls deleted file mode 100644 index f13f9f6e66..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 4 dst_alloc+0x2b/0x90 age=8329964/8337614/8360566 pid=8-1549 cpus=0-1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/cache_dma b/test/sys/kernel/slab/ip6_dst_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/cpu_slabs b/test/sys/kernel/slab/ip6_dst_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/ctor b/test/sys/kernel/slab/ip6_dst_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu b/test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/free_calls b/test/sys/kernel/slab/ip6_dst_cache/free_calls deleted file mode 100644 index 0ea6a09c6c..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ - 4 age=4303047790 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/hwcache_align b/test/sys/kernel/slab/ip6_dst_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/object_size b/test/sys/kernel/slab/ip6_dst_cache/object_size deleted file mode 100644 index 873b744bc5..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -304 diff --git a/test/sys/kernel/slab/ip6_dst_cache/objects b/test/sys/kernel/slab/ip6_dst_cache/objects deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/objects +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/ip6_dst_cache/objects_partial b/test/sys/kernel/slab/ip6_dst_cache/objects_partial deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/ip6_dst_cache/objs_per_slab b/test/sys/kernel/slab/ip6_dst_cache/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/ip6_dst_cache/order b/test/sys/kernel/slab/ip6_dst_cache/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/partial b/test/sys/kernel/slab/ip6_dst_cache/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/ip6_dst_cache/poison b/test/sys/kernel/slab/ip6_dst_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/reclaim_account b/test/sys/kernel/slab/ip6_dst_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/red_zone b/test/sys/kernel/slab/ip6_dst_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/sanity_checks b/test/sys/kernel/slab/ip6_dst_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/shrink b/test/sys/kernel/slab/ip6_dst_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip6_dst_cache/slab_size b/test/sys/kernel/slab/ip6_dst_cache/slab_size deleted file mode 100644 index e45b99e958..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -384 diff --git a/test/sys/kernel/slab/ip6_dst_cache/slabs b/test/sys/kernel/slab/ip6_dst_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/ip6_dst_cache/store_user b/test/sys/kernel/slab/ip6_dst_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip6_dst_cache/total_objects b/test/sys/kernel/slab/ip6_dst_cache/total_objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/ip6_dst_cache/trace b/test/sys/kernel/slab/ip6_dst_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip6_dst_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip6_dst_cache/validate b/test/sys/kernel/slab/ip6_dst_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip_dst_cache/aliases b/test/sys/kernel/slab/ip_dst_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_dst_cache/align b/test/sys/kernel/slab/ip_dst_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_dst_cache/alloc_calls b/test/sys/kernel/slab/ip_dst_cache/alloc_calls deleted file mode 100644 index d37535401b..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1 dst_alloc+0x2b/0x90 age=920684 pid=1206 cpus=0 diff --git a/test/sys/kernel/slab/ip_dst_cache/cache_dma b/test/sys/kernel/slab/ip_dst_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_dst_cache/cpu_slabs b/test/sys/kernel/slab/ip_dst_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_dst_cache/ctor b/test/sys/kernel/slab/ip_dst_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu b/test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_dst_cache/free_calls b/test/sys/kernel/slab/ip_dst_cache/free_calls deleted file mode 100644 index 4b1391bc98..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ - 1 age=4303046733 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ip_dst_cache/hwcache_align b/test/sys/kernel/slab/ip_dst_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_dst_cache/object_size b/test/sys/kernel/slab/ip_dst_cache/object_size deleted file mode 100644 index a1e0432c9a..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -312 diff --git a/test/sys/kernel/slab/ip_dst_cache/objects b/test/sys/kernel/slab/ip_dst_cache/objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/ip_dst_cache/objects_partial b/test/sys/kernel/slab/ip_dst_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_dst_cache/objs_per_slab b/test/sys/kernel/slab/ip_dst_cache/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/ip_dst_cache/order b/test/sys/kernel/slab/ip_dst_cache/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_dst_cache/partial b/test/sys/kernel/slab/ip_dst_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_dst_cache/poison b/test/sys/kernel/slab/ip_dst_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_dst_cache/reclaim_account b/test/sys/kernel/slab/ip_dst_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_dst_cache/red_zone b/test/sys/kernel/slab/ip_dst_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_dst_cache/sanity_checks b/test/sys/kernel/slab/ip_dst_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_dst_cache/shrink b/test/sys/kernel/slab/ip_dst_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip_dst_cache/slab_size b/test/sys/kernel/slab/ip_dst_cache/slab_size deleted file mode 100644 index e45b99e958..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -384 diff --git a/test/sys/kernel/slab/ip_dst_cache/slabs b/test/sys/kernel/slab/ip_dst_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/ip_dst_cache/store_user b/test/sys/kernel/slab/ip_dst_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_dst_cache/total_objects b/test/sys/kernel/slab/ip_dst_cache/total_objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/ip_dst_cache/trace b/test/sys/kernel/slab/ip_dst_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_dst_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_dst_cache/validate b/test/sys/kernel/slab/ip_dst_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip_fib_alias/aliases b/test/sys/kernel/slab/ip_fib_alias/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/align b/test/sys/kernel/slab/ip_fib_alias/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/alloc_calls b/test/sys/kernel/slab/ip_fib_alias/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/ip_fib_alias/cache_dma b/test/sys/kernel/slab/ip_fib_alias/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/cpu_slabs b/test/sys/kernel/slab/ip_fib_alias/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/ctor b/test/sys/kernel/slab/ip_fib_alias/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu b/test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/free_calls b/test/sys/kernel/slab/ip_fib_alias/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/ip_fib_alias/hwcache_align b/test/sys/kernel/slab/ip_fib_alias/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/object_size b/test/sys/kernel/slab/ip_fib_alias/object_size deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/object_size +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/ip_fib_alias/objects b/test/sys/kernel/slab/ip_fib_alias/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/objects_partial b/test/sys/kernel/slab/ip_fib_alias/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/objs_per_slab b/test/sys/kernel/slab/ip_fib_alias/objs_per_slab deleted file mode 100644 index a2720097dc..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -39 diff --git a/test/sys/kernel/slab/ip_fib_alias/order b/test/sys/kernel/slab/ip_fib_alias/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/partial b/test/sys/kernel/slab/ip_fib_alias/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/poison b/test/sys/kernel/slab/ip_fib_alias/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_fib_alias/reclaim_account b/test/sys/kernel/slab/ip_fib_alias/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/red_zone b/test/sys/kernel/slab/ip_fib_alias/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_fib_alias/sanity_checks b/test/sys/kernel/slab/ip_fib_alias/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_fib_alias/shrink b/test/sys/kernel/slab/ip_fib_alias/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip_fib_alias/slab_size b/test/sys/kernel/slab/ip_fib_alias/slab_size deleted file mode 100644 index b16e5f75e3..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/slab_size +++ /dev/null @@ -1 +0,0 @@ -104 diff --git a/test/sys/kernel/slab/ip_fib_alias/slabs b/test/sys/kernel/slab/ip_fib_alias/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/store_user b/test/sys/kernel/slab/ip_fib_alias/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_fib_alias/total_objects b/test/sys/kernel/slab/ip_fib_alias/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/trace b/test/sys/kernel/slab/ip_fib_alias/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_alias/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_alias/validate b/test/sys/kernel/slab/ip_fib_alias/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip_fib_hash/aliases b/test/sys/kernel/slab/ip_fib_hash/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_hash/align b/test/sys/kernel/slab/ip_fib_hash/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_hash/alloc_calls b/test/sys/kernel/slab/ip_fib_hash/alloc_calls deleted file mode 100644 index 07e86d0cb2..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 11 fn_hash_insert+0x5a6/0x800 age=8323831/8347847/8367198 pid=1197-1541 cpus=0-1 diff --git a/test/sys/kernel/slab/ip_fib_hash/cache_dma b/test/sys/kernel/slab/ip_fib_hash/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_hash/cpu_slabs b/test/sys/kernel/slab/ip_fib_hash/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_hash/ctor b/test/sys/kernel/slab/ip_fib_hash/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu b/test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_hash/free_calls b/test/sys/kernel/slab/ip_fib_hash/free_calls deleted file mode 100644 index 1aa45c86ad..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 7 age=4303046724 pid=0 cpus=0 - 4 fn_hash_delete+0x22c/0x290 age=8367201/8367201/8367201 pid=1195 cpus=1 diff --git a/test/sys/kernel/slab/ip_fib_hash/hwcache_align b/test/sys/kernel/slab/ip_fib_hash/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_hash/object_size b/test/sys/kernel/slab/ip_fib_hash/object_size deleted file mode 100644 index ea70ce0134..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/object_size +++ /dev/null @@ -1 +0,0 @@ -72 diff --git a/test/sys/kernel/slab/ip_fib_hash/objects b/test/sys/kernel/slab/ip_fib_hash/objects deleted file mode 100644 index b4de394767..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/objects +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/test/sys/kernel/slab/ip_fib_hash/objects_partial b/test/sys/kernel/slab/ip_fib_hash/objects_partial deleted file mode 100644 index b4de394767..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/objects_partial +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/test/sys/kernel/slab/ip_fib_hash/objs_per_slab b/test/sys/kernel/slab/ip_fib_hash/objs_per_slab deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/ip_fib_hash/order b/test/sys/kernel/slab/ip_fib_hash/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_hash/partial b/test/sys/kernel/slab/ip_fib_hash/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/ip_fib_hash/poison b/test/sys/kernel/slab/ip_fib_hash/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_fib_hash/reclaim_account b/test/sys/kernel/slab/ip_fib_hash/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_hash/red_zone b/test/sys/kernel/slab/ip_fib_hash/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_fib_hash/sanity_checks b/test/sys/kernel/slab/ip_fib_hash/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_fib_hash/shrink b/test/sys/kernel/slab/ip_fib_hash/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ip_fib_hash/slab_size b/test/sys/kernel/slab/ip_fib_hash/slab_size deleted file mode 100644 index a29644e57e..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/slab_size +++ /dev/null @@ -1 +0,0 @@ -144 diff --git a/test/sys/kernel/slab/ip_fib_hash/slabs b/test/sys/kernel/slab/ip_fib_hash/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/ip_fib_hash/store_user b/test/sys/kernel/slab/ip_fib_hash/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ip_fib_hash/total_objects b/test/sys/kernel/slab/ip_fib_hash/total_objects deleted file mode 100644 index f6b91e0e1f..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/total_objects +++ /dev/null @@ -1 +0,0 @@ -56 diff --git a/test/sys/kernel/slab/ip_fib_hash/trace b/test/sys/kernel/slab/ip_fib_hash/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ip_fib_hash/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ip_fib_hash/validate b/test/sys/kernel/slab/ip_fib_hash/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/journal_handle/aliases b/test/sys/kernel/slab/journal_handle/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/align b/test/sys/kernel/slab/journal_handle/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/alloc_calls b/test/sys/kernel/slab/journal_handle/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/journal_handle/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/journal_handle/cache_dma b/test/sys/kernel/slab/journal_handle/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/cpu_slabs b/test/sys/kernel/slab/journal_handle/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/ctor b/test/sys/kernel/slab/journal_handle/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/journal_handle/destroy_by_rcu b/test/sys/kernel/slab/journal_handle/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/free_calls b/test/sys/kernel/slab/journal_handle/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/journal_handle/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/journal_handle/hwcache_align b/test/sys/kernel/slab/journal_handle/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/object_size b/test/sys/kernel/slab/journal_handle/object_size deleted file mode 100644 index f6b91e0e1f..0000000000 --- a/test/sys/kernel/slab/journal_handle/object_size +++ /dev/null @@ -1 +0,0 @@ -56 diff --git a/test/sys/kernel/slab/journal_handle/objects b/test/sys/kernel/slab/journal_handle/objects deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/kernel/slab/journal_handle/objects +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/kernel/slab/journal_handle/objects_partial b/test/sys/kernel/slab/journal_handle/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/objs_per_slab b/test/sys/kernel/slab/journal_handle/objs_per_slab deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/journal_handle/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/journal_handle/order b/test/sys/kernel/slab/journal_handle/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/partial b/test/sys/kernel/slab/journal_handle/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/poison b/test/sys/kernel/slab/journal_handle/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_handle/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_handle/reclaim_account b/test/sys/kernel/slab/journal_handle/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_handle/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_handle/red_zone b/test/sys/kernel/slab/journal_handle/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_handle/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_handle/sanity_checks b/test/sys/kernel/slab/journal_handle/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_handle/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_handle/shrink b/test/sys/kernel/slab/journal_handle/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/journal_handle/slab_size b/test/sys/kernel/slab/journal_handle/slab_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/journal_handle/slab_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/journal_handle/slabs b/test/sys/kernel/slab/journal_handle/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/journal_handle/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/journal_handle/store_user b/test/sys/kernel/slab/journal_handle/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_handle/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_handle/total_objects b/test/sys/kernel/slab/journal_handle/total_objects deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/kernel/slab/journal_handle/total_objects +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/kernel/slab/journal_handle/trace b/test/sys/kernel/slab/journal_handle/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_handle/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_handle/validate b/test/sys/kernel/slab/journal_handle/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/journal_head/aliases b/test/sys/kernel/slab/journal_head/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/align b/test/sys/kernel/slab/journal_head/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/alloc_calls b/test/sys/kernel/slab/journal_head/alloc_calls deleted file mode 100644 index 5edba871ae..0000000000 --- a/test/sys/kernel/slab/journal_head/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 7662 journal_add_journal_head+0x9f/0x1b0 age=0/2379/651354 pid=1336-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/journal_head/cache_dma b/test/sys/kernel/slab/journal_head/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/cpu_slabs b/test/sys/kernel/slab/journal_head/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/ctor b/test/sys/kernel/slab/journal_head/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/journal_head/destroy_by_rcu b/test/sys/kernel/slab/journal_head/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/free_calls b/test/sys/kernel/slab/journal_head/free_calls deleted file mode 100644 index 109d7bd49e..0000000000 --- a/test/sys/kernel/slab/journal_head/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 7589 age=4303047557 pid=0 cpus=0 - 74 __journal_remove_journal_head+0xcb/0x160 age=1585/52253/654521 pid=32-13248 cpus=0-1 diff --git a/test/sys/kernel/slab/journal_head/hwcache_align b/test/sys/kernel/slab/journal_head/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/object_size b/test/sys/kernel/slab/journal_head/object_size deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/journal_head/object_size +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/journal_head/objects b/test/sys/kernel/slab/journal_head/objects deleted file mode 100644 index 28e2fde279..0000000000 --- a/test/sys/kernel/slab/journal_head/objects +++ /dev/null @@ -1 +0,0 @@ -7680 diff --git a/test/sys/kernel/slab/journal_head/objects_partial b/test/sys/kernel/slab/journal_head/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/objs_per_slab b/test/sys/kernel/slab/journal_head/objs_per_slab deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/journal_head/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/journal_head/order b/test/sys/kernel/slab/journal_head/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/partial b/test/sys/kernel/slab/journal_head/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/poison b/test/sys/kernel/slab/journal_head/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_head/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_head/reclaim_account b/test/sys/kernel/slab/journal_head/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_head/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_head/red_zone b/test/sys/kernel/slab/journal_head/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_head/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_head/sanity_checks b/test/sys/kernel/slab/journal_head/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_head/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_head/shrink b/test/sys/kernel/slab/journal_head/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/journal_head/slab_size b/test/sys/kernel/slab/journal_head/slab_size deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/kernel/slab/journal_head/slab_size +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/kernel/slab/journal_head/slabs b/test/sys/kernel/slab/journal_head/slabs deleted file mode 100644 index 18eed1357e..0000000000 --- a/test/sys/kernel/slab/journal_head/slabs +++ /dev/null @@ -1 +0,0 @@ -320 diff --git a/test/sys/kernel/slab/journal_head/store_user b/test/sys/kernel/slab/journal_head/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/journal_head/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/journal_head/total_objects b/test/sys/kernel/slab/journal_head/total_objects deleted file mode 100644 index 28e2fde279..0000000000 --- a/test/sys/kernel/slab/journal_head/total_objects +++ /dev/null @@ -1 +0,0 @@ -7680 diff --git a/test/sys/kernel/slab/journal_head/trace b/test/sys/kernel/slab/journal_head/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/journal_head/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/journal_head/validate b/test/sys/kernel/slab/journal_head/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kcopyd_job/aliases b/test/sys/kernel/slab/kcopyd_job/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/align b/test/sys/kernel/slab/kcopyd_job/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kcopyd_job/alloc_calls b/test/sys/kernel/slab/kcopyd_job/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/kcopyd_job/cache_dma b/test/sys/kernel/slab/kcopyd_job/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/cpu_slabs b/test/sys/kernel/slab/kcopyd_job/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/ctor b/test/sys/kernel/slab/kcopyd_job/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kcopyd_job/destroy_by_rcu b/test/sys/kernel/slab/kcopyd_job/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/free_calls b/test/sys/kernel/slab/kcopyd_job/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/kcopyd_job/hwcache_align b/test/sys/kernel/slab/kcopyd_job/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/object_size b/test/sys/kernel/slab/kcopyd_job/object_size deleted file mode 100644 index 68cfb10d1c..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/object_size +++ /dev/null @@ -1 +0,0 @@ -472 diff --git a/test/sys/kernel/slab/kcopyd_job/objects b/test/sys/kernel/slab/kcopyd_job/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/objects_partial b/test/sys/kernel/slab/kcopyd_job/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/objs_per_slab b/test/sys/kernel/slab/kcopyd_job/objs_per_slab deleted file mode 100644 index 60d3b2f4a4..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/test/sys/kernel/slab/kcopyd_job/order b/test/sys/kernel/slab/kcopyd_job/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kcopyd_job/partial b/test/sys/kernel/slab/kcopyd_job/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/poison b/test/sys/kernel/slab/kcopyd_job/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kcopyd_job/reclaim_account b/test/sys/kernel/slab/kcopyd_job/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/red_zone b/test/sys/kernel/slab/kcopyd_job/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kcopyd_job/sanity_checks b/test/sys/kernel/slab/kcopyd_job/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kcopyd_job/shrink b/test/sys/kernel/slab/kcopyd_job/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kcopyd_job/slab_size b/test/sys/kernel/slab/kcopyd_job/slab_size deleted file mode 100644 index 4970e693e1..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/slab_size +++ /dev/null @@ -1 +0,0 @@ -544 diff --git a/test/sys/kernel/slab/kcopyd_job/slabs b/test/sys/kernel/slab/kcopyd_job/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/store_user b/test/sys/kernel/slab/kcopyd_job/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kcopyd_job/total_objects b/test/sys/kernel/slab/kcopyd_job/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/trace b/test/sys/kernel/slab/kcopyd_job/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kcopyd_job/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kcopyd_job/validate b/test/sys/kernel/slab/kcopyd_job/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/key_jar/aliases b/test/sys/kernel/slab/key_jar/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/align b/test/sys/kernel/slab/key_jar/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/alloc_calls b/test/sys/kernel/slab/key_jar/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/key_jar/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/key_jar/cache_dma b/test/sys/kernel/slab/key_jar/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/cpu_slabs b/test/sys/kernel/slab/key_jar/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/ctor b/test/sys/kernel/slab/key_jar/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/key_jar/destroy_by_rcu b/test/sys/kernel/slab/key_jar/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/free_calls b/test/sys/kernel/slab/key_jar/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/key_jar/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/key_jar/hwcache_align b/test/sys/kernel/slab/key_jar/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/key_jar/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/key_jar/object_size b/test/sys/kernel/slab/key_jar/object_size deleted file mode 100644 index 7c022aedd2..0000000000 --- a/test/sys/kernel/slab/key_jar/object_size +++ /dev/null @@ -1 +0,0 @@ -232 diff --git a/test/sys/kernel/slab/key_jar/objects b/test/sys/kernel/slab/key_jar/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/objects_partial b/test/sys/kernel/slab/key_jar/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/objs_per_slab b/test/sys/kernel/slab/key_jar/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/key_jar/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/key_jar/order b/test/sys/kernel/slab/key_jar/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/partial b/test/sys/kernel/slab/key_jar/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/poison b/test/sys/kernel/slab/key_jar/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/key_jar/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/key_jar/reclaim_account b/test/sys/kernel/slab/key_jar/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/red_zone b/test/sys/kernel/slab/key_jar/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/key_jar/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/key_jar/sanity_checks b/test/sys/kernel/slab/key_jar/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/key_jar/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/key_jar/shrink b/test/sys/kernel/slab/key_jar/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/key_jar/slab_size b/test/sys/kernel/slab/key_jar/slab_size deleted file mode 100644 index 18eed1357e..0000000000 --- a/test/sys/kernel/slab/key_jar/slab_size +++ /dev/null @@ -1 +0,0 @@ -320 diff --git a/test/sys/kernel/slab/key_jar/slabs b/test/sys/kernel/slab/key_jar/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/store_user b/test/sys/kernel/slab/key_jar/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/key_jar/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/key_jar/total_objects b/test/sys/kernel/slab/key_jar/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/trace b/test/sys/kernel/slab/key_jar/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/key_jar/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/key_jar/validate b/test/sys/kernel/slab/key_jar/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kiocb/aliases b/test/sys/kernel/slab/kiocb/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/align b/test/sys/kernel/slab/kiocb/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kiocb/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kiocb/alloc_calls b/test/sys/kernel/slab/kiocb/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/kiocb/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/kiocb/cache_dma b/test/sys/kernel/slab/kiocb/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/cpu_slabs b/test/sys/kernel/slab/kiocb/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/ctor b/test/sys/kernel/slab/kiocb/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kiocb/destroy_by_rcu b/test/sys/kernel/slab/kiocb/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/free_calls b/test/sys/kernel/slab/kiocb/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/kiocb/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/kiocb/hwcache_align b/test/sys/kernel/slab/kiocb/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kiocb/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kiocb/object_size b/test/sys/kernel/slab/kiocb/object_size deleted file mode 100644 index eb08bc0b0b..0000000000 --- a/test/sys/kernel/slab/kiocb/object_size +++ /dev/null @@ -1 +0,0 @@ -240 diff --git a/test/sys/kernel/slab/kiocb/objects b/test/sys/kernel/slab/kiocb/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/objects_partial b/test/sys/kernel/slab/kiocb/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/objs_per_slab b/test/sys/kernel/slab/kiocb/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/kiocb/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/kiocb/order b/test/sys/kernel/slab/kiocb/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/partial b/test/sys/kernel/slab/kiocb/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/poison b/test/sys/kernel/slab/kiocb/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kiocb/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kiocb/reclaim_account b/test/sys/kernel/slab/kiocb/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/red_zone b/test/sys/kernel/slab/kiocb/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kiocb/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kiocb/sanity_checks b/test/sys/kernel/slab/kiocb/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kiocb/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kiocb/shrink b/test/sys/kernel/slab/kiocb/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kiocb/slab_size b/test/sys/kernel/slab/kiocb/slab_size deleted file mode 100644 index 18eed1357e..0000000000 --- a/test/sys/kernel/slab/kiocb/slab_size +++ /dev/null @@ -1 +0,0 @@ -320 diff --git a/test/sys/kernel/slab/kiocb/slabs b/test/sys/kernel/slab/kiocb/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/store_user b/test/sys/kernel/slab/kiocb/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kiocb/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kiocb/total_objects b/test/sys/kernel/slab/kiocb/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/trace b/test/sys/kernel/slab/kiocb/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kiocb/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kiocb/validate b/test/sys/kernel/slab/kiocb/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kioctx/aliases b/test/sys/kernel/slab/kioctx/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/align b/test/sys/kernel/slab/kioctx/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kioctx/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kioctx/alloc_calls b/test/sys/kernel/slab/kioctx/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/kioctx/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/kioctx/cache_dma b/test/sys/kernel/slab/kioctx/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/cpu_slabs b/test/sys/kernel/slab/kioctx/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/ctor b/test/sys/kernel/slab/kioctx/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kioctx/destroy_by_rcu b/test/sys/kernel/slab/kioctx/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/free_calls b/test/sys/kernel/slab/kioctx/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/kioctx/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/kioctx/hwcache_align b/test/sys/kernel/slab/kioctx/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kioctx/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kioctx/object_size b/test/sys/kernel/slab/kioctx/object_size deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/kernel/slab/kioctx/object_size +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/kernel/slab/kioctx/objects b/test/sys/kernel/slab/kioctx/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/objects_partial b/test/sys/kernel/slab/kioctx/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/objs_per_slab b/test/sys/kernel/slab/kioctx/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/kioctx/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/kioctx/order b/test/sys/kernel/slab/kioctx/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kioctx/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kioctx/partial b/test/sys/kernel/slab/kioctx/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/poison b/test/sys/kernel/slab/kioctx/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kioctx/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kioctx/reclaim_account b/test/sys/kernel/slab/kioctx/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/red_zone b/test/sys/kernel/slab/kioctx/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kioctx/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kioctx/sanity_checks b/test/sys/kernel/slab/kioctx/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kioctx/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kioctx/shrink b/test/sys/kernel/slab/kioctx/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kioctx/slab_size b/test/sys/kernel/slab/kioctx/slab_size deleted file mode 100644 index fe4d93ae13..0000000000 --- a/test/sys/kernel/slab/kioctx/slab_size +++ /dev/null @@ -1 +0,0 @@ -640 diff --git a/test/sys/kernel/slab/kioctx/slabs b/test/sys/kernel/slab/kioctx/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/store_user b/test/sys/kernel/slab/kioctx/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kioctx/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kioctx/total_objects b/test/sys/kernel/slab/kioctx/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/trace b/test/sys/kernel/slab/kioctx/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kioctx/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kioctx/validate b/test/sys/kernel/slab/kioctx/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-1024/aliases b/test/sys/kernel/slab/kmalloc-1024/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-1024/align b/test/sys/kernel/slab/kmalloc-1024/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-1024/alloc_calls b/test/sys/kernel/slab/kmalloc-1024/alloc_calls deleted file mode 100644 index 90a6c7793d..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/alloc_calls +++ /dev/null @@ -1,51 +0,0 @@ - 23 __register_sysctl_paths+0x56/0x340 age=8360116/8368981/8379769 pid=1-1549 cpus=0-1 - 5 param_sysfs_setup+0x87/0x140 age=8355550/8371926/8379909 pid=1-1805 cpus=0-1 - 5 load_module+0x18d5/0x1b30 age=8328407/8365286/8375764 pid=208-2578 cpus=0 - 2 __vmalloc_area_node+0xfb/0x140 age=8360170/8367347/8374524 pid=107-1549 cpus=0 - 4 __percpu_alloc_mask+0xbc/0x140 age=8379760/8379760/8379760 pid=1 cpus=0 - 113 alloc_pipe_info+0x25/0x60 age=125624/8270722/8377065 pid=1-13212 cpus=0-1 - 2 alloc_fdtable+0x81/0x160 age=2417000/5386894/8356789 pid=1690 cpus=0-1 - 1 mb_cache_create+0xb6/0x1f0 age=8379750 pid=1 cpus=1 - 1 mb_cache_create+0x11e/0x1f0 age=8379750 pid=1 cpus=1 - 8 add_partition+0x45/0x250 age=61959/7339549/8379206 pid=1-13295 cpus=0 - 2 __crypto_alloc_tfm+0x43/0x1b0 age=3544684/3544684/3544684 pid=1545 cpus=0 - 1 pci_create_bus+0x82/0x240 age=8379831 pid=1 cpus=0 - 14 pcie_port_device_register+0x254/0x4a0 age=8379746/8379746/8379748 pid=1 cpus=1 - 1 acpi_ev_create_gpe_block+0x10b/0x3bf age=8379903 pid=1 cpus=0 - 1 acpi_tb_resize_root_table_list+0x66/0xdb age=8375731 pid=330 cpus=0 - 2 tty_buffer_request_room+0x136/0x190 age=8214639/8272696/8330753 pid=0-2262 cpus=0 - 1 tty_register_driver+0x1b3/0x2a0 age=8309081 pid=2711 cpus=1 - 10 tty_write+0x160/0x280 age=7214010/8238951/8377659 pid=34-2590 cpus=0-1 - 2 set_inverse_trans_unicode+0xce/0xf0 age=8355014/8367379/8379745 pid=1-1898 cpus=1 - 1 uart_register_driver+0x31/0x1c0 age=8379710 pid=1 cpus=1 - 166 device_create_vargs+0x8c/0x100 age=22658/8173620/8379911 pid=1-13295 cpus=0-1 - 8 platform_device_alloc+0x37/0x90 age=8367172/8376785/8379911 pid=1-1285 cpus=0-1 - 3 scsi_alloc_target+0x63/0x2e0 age=61990/5606770/8379325 pid=1-13295 cpus=0-1 - 2 sd_probe+0x86/0x430 age=61986/4220653/8379321 pid=1-13295 cpus=1 - 1 ahci_port_start+0x34/0xe0 age=8379708 pid=1 cpus=1 - 1 psmouse_connect+0x5b/0x2c0 age=8378898 pid=17 cpus=1 - 2 thermal_cooling_device_register+0x7f/0x290 age=8375643/8375667/8375692 pid=330 cpus=0-1 - 1 hid_add_field+0xcc/0x3a0 age=53473 pid=419 cpus=0 - 4 sock_alloc_send_skb+0x1cd/0x200 age=8344775/8349266/8350926 pid=1738 cpus=0-1 - 3 __rtnl_register+0x79/0x90 age=8360119/8373266/8379912 pid=1-1549 cpus=0 - 6 qdisc_alloc+0x34/0xd0 age=8356043/8356079/8356257 pid=1541 cpus=0 - 1 dmi_id_init+0x2a4/0x30c age=8379910 pid=1 cpus=0 - 5 hub_probe+0xdd/0x820 [usbcore] age=8373999/8374492/8374845 pid=143-147 cpus=0-1 - 5 usb_create_hcd+0x39/0x150 [usbcore] age=8374071/8374526/8374892 pid=143-147 cpus=0 - 26 usb_set_configuration+0x441/0x5f0 [usbcore] age=22663/3237429/8374857 pid=143-419 cpus=0-1 - 10 usb_get_configuration+0x92/0x1480 [usbcore] age=22667/5876069/8374865 pid=143-419 cpus=0-1 - 34 usb_create_ep_files+0x51/0x350 [usbcore] age=22579/5431762/8374732 pid=143-419 cpus=0-1 - 1 acpi_battery_add+0x29/0x1d3 [battery] age=8375630 pid=396 cpus=0 - 1 snd_card_new+0x38/0x370 [snd] age=8374136 pid=107 cpus=0 - 1 sta_info_alloc+0x3c/0x1d0 [mac80211] age=8329523 pid=742 cpus=0 - 2 snd_pcm_new+0x47/0x130 [snd_pcm] age=8374109/8374109/8374109 pid=107 cpus=1 - 1 rs_alloc_sta+0x25/0x120 [iwl3945] age=8329523 pid=742 cpus=0 - 1 get_alloc_hash+0x9b/0x140 [snd_hda_intel] age=8373108 pid=786 cpus=0 - 1 azx_probe+0xb3/0xc20 [snd_hda_intel] age=8374129 pid=107 cpus=0 - 1 azx_probe+0x4a9/0xc20 [snd_hda_intel] age=8374122 pid=107 cpus=0 - 1 snd_hda_codec_new+0x3e/0x559 [snd_hda_intel] age=8374112 pid=107 cpus=1 - 1 md_probe+0xa1/0x360 [md_mod] age=8370183 pid=916 cpus=0 - 8 loop_alloc+0x28/0x140 [loop] age=8369639/8369639/8369639 pid=951 cpus=0 - 4 ipv6_add_dev+0x69/0x330 [ipv6] age=8360116/8360117/8360119 pid=1549 cpus=0 - 1 ipv6_route_sysctl_init+0x22/0xb0 [ipv6] age=8360115 pid=1549 cpus=0 - 2 snd_seq_create_port+0x35/0x180 [snd_seq] age=8355549/8355549/8355549 pid=1805 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-1024/cache_dma b/test/sys/kernel/slab/kmalloc-1024/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-1024/cpu_slabs b/test/sys/kernel/slab/kmalloc-1024/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-1024/ctor b/test/sys/kernel/slab/kmalloc-1024/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-1024/free_calls b/test/sys/kernel/slab/kmalloc-1024/free_calls deleted file mode 100644 index bd30112481..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/free_calls +++ /dev/null @@ -1,10 +0,0 @@ - 216 age=4303047343 pid=0 cpus=0 - 1 __vunmap+0xe9/0x120 age=8360137 pid=1549 cpus=0 - 64 __free_pipe_info+0x5c/0x70 age=55301/8227248/8377668 pid=34-13363 cpus=0-1 - 19 acpi_ds_delete_walk_state+0xc9/0xcd age=8355814/8376228/8380000 pid=0-1772 cpus=0-1 - 1 acpi_tb_resize_root_table_list+0xbf/0xdb age=8375732 pid=330 cpus=0 - 2 release_one_tty+0xc7/0x190 age=8352476/8361380/8370284 pid=55-1253 cpus=0-1 - 1 vt_ioctl+0x273/0x1c30 age=8356598 pid=1703 cpus=0 - 14 device_create_release+0x9/0x10 age=8352395/8354628/8356598 pid=1703-2139 cpus=0-1 - 1 fw_dev_release+0x20/0x30 age=8356148 pid=1541 cpus=0 - 184 skb_release_data+0x85/0xd0 age=22639/7036434/8379911 pid=0-13303 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-1024/hwcache_align b/test/sys/kernel/slab/kmalloc-1024/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-1024/object_size b/test/sys/kernel/slab/kmalloc-1024/object_size deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/object_size +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/kernel/slab/kmalloc-1024/objects b/test/sys/kernel/slab/kmalloc-1024/objects deleted file mode 100644 index 4970e693e1..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/objects +++ /dev/null @@ -1 +0,0 @@ -544 diff --git a/test/sys/kernel/slab/kmalloc-1024/objects_partial b/test/sys/kernel/slab/kmalloc-1024/objects_partial deleted file mode 100644 index 0f11735ff8..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/objects_partial +++ /dev/null @@ -1 +0,0 @@ -196 diff --git a/test/sys/kernel/slab/kmalloc-1024/objs_per_slab b/test/sys/kernel/slab/kmalloc-1024/objs_per_slab deleted file mode 100644 index f04c001f3f..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -29 diff --git a/test/sys/kernel/slab/kmalloc-1024/order b/test/sys/kernel/slab/kmalloc-1024/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/kmalloc-1024/partial b/test/sys/kernel/slab/kmalloc-1024/partial deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/partial +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-1024/poison b/test/sys/kernel/slab/kmalloc-1024/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-1024/reclaim_account b/test/sys/kernel/slab/kmalloc-1024/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-1024/red_zone b/test/sys/kernel/slab/kmalloc-1024/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-1024/sanity_checks b/test/sys/kernel/slab/kmalloc-1024/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-1024/shrink b/test/sys/kernel/slab/kmalloc-1024/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-1024/slab_size b/test/sys/kernel/slab/kmalloc-1024/slab_size deleted file mode 100644 index ba851d8439..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/slab_size +++ /dev/null @@ -1 +0,0 @@ -1096 diff --git a/test/sys/kernel/slab/kmalloc-1024/slabs b/test/sys/kernel/slab/kmalloc-1024/slabs deleted file mode 100644 index 209e3ef4b6..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/slabs +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/test/sys/kernel/slab/kmalloc-1024/store_user b/test/sys/kernel/slab/kmalloc-1024/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-1024/total_objects b/test/sys/kernel/slab/kmalloc-1024/total_objects deleted file mode 100644 index 4eb9d0d9db..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/total_objects +++ /dev/null @@ -1 +0,0 @@ -580 diff --git a/test/sys/kernel/slab/kmalloc-1024/trace b/test/sys/kernel/slab/kmalloc-1024/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-1024/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-1024/validate b/test/sys/kernel/slab/kmalloc-1024/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-128/aliases b/test/sys/kernel/slab/kmalloc-128/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-128/align b/test/sys/kernel/slab/kmalloc-128/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-128/alloc_calls b/test/sys/kernel/slab/kmalloc-128/alloc_calls deleted file mode 100644 index 8a53c1107e..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/alloc_calls +++ /dev/null @@ -1,36 +0,0 @@ - 17 param_sysfs_setup+0x87/0x140 age=8366402/8376536/8379939 pid=1-1358 cpus=0-1 - 1 mempool_create_node+0x4b/0xf0 age=8379025 pid=1 cpus=0 - 4 __vmalloc_area_node+0xfb/0x140 age=8303049/8349608/8370350 pid=900-2754 cpus=0 - 2 shmem_fill_super+0x38/0x200 age=8377584/8378686/8379788 pid=1-46 cpus=0-1 - 56 __percpu_alloc_mask+0xbc/0x140 age=61988/7483637/8379799 pid=1-13295 cpus=0-1 - 11 cdev_alloc+0x1a/0x50 age=61988/7621848/8379938 pid=1-13295 cpus=0-1 - 110 d_alloc+0x19d/0x1f0 age=22451/5346628/8376065 pid=401-13439 cpus=0-1 - 2 bm_register_write+0x63/0x630 age=8354053/8354053/8354053 pid=2054 cpus=1 - 2 alloc_disk_node+0x6c/0x120 age=62016/4220683/8379351 pid=1-13295 cpus=1 - 20 ida_pre_get+0x86/0x90 age=8298034/8372144/8380076 pid=0-2761 cpus=0-1 - 5 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379905/8379914/8379918 pid=1 cpus=0 - 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379921/8379921/8379921 pid=1 cpus=0 - 1 acpi_ev_create_gpe_block+0xb2/0x3bf age=8379933 pid=1 cpus=0 - 4 acpi_add_single_object+0x5d8/0xd3c age=8379862/8379869/8379873 pid=1 cpus=0 - 41 con_insert_unipair+0xd6/0x110 age=8355044/8369520/8379775 pid=1-1898 cpus=1 - 2 thermal_zone_bind_cooling_device+0xde/0x2a0 age=8374828/8374828/8374828 pid=329 cpus=0 - 4 led_trigger_register_simple+0x2b/0x80 age=8375615/8375659/8375793 pid=392-396 cpus=0 - 1 sock_kmalloc+0x5c/0x70 age=8328344 pid=2586 cpus=0 - 3 alloc_netdev_mq+0x6c/0x180 age=8373612/8376531/8379814 pid=1-126 cpus=0-1 - 2 neigh_table_init_no_netlink+0xd2/0x250 age=8360154/8369976/8379799 pid=1-1549 cpus=0 - 8 neigh_parms_alloc+0x5d/0x110 age=8360146/8367976/8379799 pid=1-1549 cpus=0-1 - 4 fz_hash_alloc+0x4a/0x60 age=8325493/8357250/8367862 pid=1185-1541 cpus=0-1 - 1 get_local_pda+0x39/0x9b age=8380015 pid=1 cpus=0 - 1 mnt_init+0xf9/0x202 age=8380076 pid=0 cpus=0 - 1 net_ns_init+0x49/0x16d age=8379942 pid=1 cpus=0 - 3 sg_add+0x8c/0x400 [sg] age=61988/5604850/8376284 pid=169-13295 cpus=0 - 3 usb_get_configuration+0x5f2/0x1480 [usbcore] age=22696/22696/22696 pid=419 cpus=0 - 15 usb_get_configuration+0x1388/0x1480 [usbcore] age=22696/3922325/8372712 pid=419 cpus=0 - 1 0xffffffffa0065117 age=8374777 pid=107 cpus=1 - 1 ieee80211_led_init+0x1b/0x230 [mac80211] age=8373612 pid=126 cpus=1 - 1 ieee80211_led_init+0x83/0x230 [mac80211] age=8373612 pid=126 cpus=1 - 1 ieee80211_led_init+0xeb/0x230 [mac80211] age=8373611 pid=126 cpus=1 - 1 ieee80211_led_init+0x153/0x230 [mac80211] age=8373611 pid=126 cpus=1 - 1 snd_hda_codec_new+0x1ec/0x559 [snd_hda_intel] age=8374142 pid=107 cpus=1 - 1 md_register_thread+0x35/0xd0 [md_mod] age=8370088 pid=916 cpus=0 - 1 fib6_net_init+0x7e/0x130 [ipv6] age=8360149 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-128/cache_dma b/test/sys/kernel/slab/kmalloc-128/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-128/cpu_slabs b/test/sys/kernel/slab/kmalloc-128/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-128/ctor b/test/sys/kernel/slab/kmalloc-128/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-128/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-128/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-128/free_calls b/test/sys/kernel/slab/kmalloc-128/free_calls deleted file mode 100644 index e19e8283c7..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/free_calls +++ /dev/null @@ -1,18 +0,0 @@ - 197 age=4303047372 pid=0 cpus=0 - 3 call_usermodehelper_freeinfo+0x27/0x30 age=8360145/8367948/8373612 pid=745-1532 cpus=0 - 2 __vunmap+0xe9/0x120 age=8375480/8375882/8376284 pid=105-169 cpus=0 - 5 percpu_free+0x2d/0x60 age=7838031/7838092/7838171 pid=419-3347 cpus=0 - 1 cdev_dynamic_release+0x19/0x20 age=7838171 pid=419 cpus=0 - 49 d_callback+0x22/0x40 age=53327/5302082/8375461 pid=0-13314 cpus=0-1 - 51 load_elf_binary+0xaf/0x1e20 age=25315/7326461/8377585 pid=46-21952 cpus=0-1 - 1 free_rb_tree_fname+0x5c/0xb0 age=8366816 pid=1274 cpus=0 - 1 disk_release+0x2e/0x50 age=7838031 pid=3347 cpus=0 - 2 free_bitmap+0x29/0x80 age=8368053/8369024/8369995 pid=55 cpus=0-1 - 1 acpi_evaluate_reference+0x100/0x117 age=8374829 pid=329 cpus=0 - 6 acpi_get_object_info+0x1b6/0x1d4 age=8379736/8379841/8379873 pid=1 cpus=0-1 - 4 do_acpi_find_child+0x48/0x51 age=8379209/8379658/8379850 pid=1 cpus=0-1 - 1 unpack_to_rootfs+0x105/0xa39 age=8379790 pid=1 cpus=0 - 1 sg_remove+0x1ca/0x240 [sg] age=7838171 pid=419 cpus=0 - 6 usb_release_interface_cache+0x2c/0x60 [usbcore] age=7833192/7833192/7833192 pid=419 cpus=1 - 2 usb_release_interface_cache+0x47/0x60 [usbcore] age=7833192/7833192/7833192 pid=419 cpus=1 - 1 acpi_processor_get_throttling_info+0x15e/0x58c [processor] age=8375683 pid=330 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-128/hwcache_align b/test/sys/kernel/slab/kmalloc-128/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-128/object_size b/test/sys/kernel/slab/kmalloc-128/object_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/object_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/kmalloc-128/objects b/test/sys/kernel/slab/kmalloc-128/objects deleted file mode 100644 index fe2cd8b002..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/objects +++ /dev/null @@ -1 +0,0 @@ -343 diff --git a/test/sys/kernel/slab/kmalloc-128/objects_partial b/test/sys/kernel/slab/kmalloc-128/objects_partial deleted file mode 100644 index 76a8b2b703..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/objects_partial +++ /dev/null @@ -1 +0,0 @@ -83 diff --git a/test/sys/kernel/slab/kmalloc-128/objs_per_slab b/test/sys/kernel/slab/kmalloc-128/objs_per_slab deleted file mode 100644 index 209e3ef4b6..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/test/sys/kernel/slab/kmalloc-128/order b/test/sys/kernel/slab/kmalloc-128/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-128/partial b/test/sys/kernel/slab/kmalloc-128/partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/kmalloc-128/poison b/test/sys/kernel/slab/kmalloc-128/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-128/reclaim_account b/test/sys/kernel/slab/kmalloc-128/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-128/red_zone b/test/sys/kernel/slab/kmalloc-128/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-128/sanity_checks b/test/sys/kernel/slab/kmalloc-128/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-128/shrink b/test/sys/kernel/slab/kmalloc-128/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-128/slab_size b/test/sys/kernel/slab/kmalloc-128/slab_size deleted file mode 100644 index 08839f6bb2..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/slab_size +++ /dev/null @@ -1 +0,0 @@ -200 diff --git a/test/sys/kernel/slab/kmalloc-128/slabs b/test/sys/kernel/slab/kmalloc-128/slabs deleted file mode 100644 index 3c032078a4..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/slabs +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/test/sys/kernel/slab/kmalloc-128/store_user b/test/sys/kernel/slab/kmalloc-128/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-128/total_objects b/test/sys/kernel/slab/kmalloc-128/total_objects deleted file mode 100644 index 2921a1584c..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/total_objects +++ /dev/null @@ -1 +0,0 @@ -360 diff --git a/test/sys/kernel/slab/kmalloc-128/trace b/test/sys/kernel/slab/kmalloc-128/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-128/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-128/validate b/test/sys/kernel/slab/kmalloc-128/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-16/aliases b/test/sys/kernel/slab/kmalloc-16/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/align b/test/sys/kernel/slab/kmalloc-16/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-16/alloc_calls b/test/sys/kernel/slab/kmalloc-16/alloc_calls deleted file mode 100644 index dda95984a9..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/alloc_calls +++ /dev/null @@ -1,41 +0,0 @@ - 2 arch_acpi_processor_init_pdc+0x71/0x180 age=8375737/8375768/8375799 pid=330 cpus=0 - 2 arch_acpi_processor_init_pdc+0xab/0x180 age=8375737/8375768/8375799 pid=330 cpus=0 - 5 sched_create_group+0x40/0x220 age=8351840/8359324/8366851 pid=1333-2177 cpus=0-1 - 5 sched_create_group+0x62/0x220 age=8351840/8359324/8366851 pid=1333-2177 cpus=0-1 - 2 setup_modinfo_version+0x19/0x30 age=8374630/8375434/8376238 pid=122-126 cpus=0-1 - 365 load_module+0x1ac4/0x1b30 age=8303081/8369498/8376320 pid=105-2754 cpus=0-1 - 13 mempool_create_node+0x4b/0xf0 age=8379859/8379929/8379974 pid=1 cpus=0 - 1 krealloc+0x1e/0x60 age=8375802 pid=330 cpus=0 - 4 __vmalloc_area_node+0xfb/0x140 age=8374701/8375120/8375833 pid=126-392 cpus=0 - 7 alloc_vfsmnt+0x97/0x180 age=61473/7184623/8379853 pid=1-13348 cpus=0-1 - 2 proc_symlink+0x4d/0xb0 age=8380112/8380112/8380112 pid=0 cpus=0 - 1275 sysfs_new_dirent+0x10c/0x120 age=22645/7761348/8379979 pid=1-13295 cpus=0-1 - 2 ext3_fill_super+0x691/0x1a20 age=8369671/8374021/8378371 pid=1-962 cpus=0 - 406 kvasprintf+0x55/0x90 age=22645/7760583/8380112 pid=0-13295 cpus=0-1 - 1 bit_cursor+0x223/0x6a0 age=8356170 pid=7 cpus=0 - 12 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379944/8379946/8379954 pid=1 cpus=0 - 14 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379945/8379955/8379961 pid=1 cpus=0 - 2 acpi_ut_copy_simple_object+0x8f/0x11c age=8375657/8375665/8375674 pid=396 cpus=0 - 5 acpi_irq_stats_init+0x1bd/0x268 age=8379969/8379969/8379969 pid=1 cpus=0 - 14 pnp_add_id+0x1e/0xe0 age=8379861/8379863/8379866 pid=1 cpus=0 - 9 reserve_range+0x39/0x130 age=8379850/8379850/8379850 pid=1 cpus=0 - 1 trackpoint_detect+0x94/0x190 age=8378732 pid=17 cpus=0 - 2 proto_register+0xf2/0x260 age=8360199/8370021/8379844 pid=1-1549 cpus=0 - 2 neigh_sysctl_register+0x1cd/0x330 age=8360183/8366975/8373768 pid=126-1549 cpus=0-1 - 1 nl_pid_hash_rehash+0x180/0x1a0 age=8361057 pid=1533 cpus=0 - 1 genl_register_family+0x1b6/0x1e0 age=8379853 pid=1 cpus=0 - 1 __devinet_sysctl_register+0xb8/0x120 age=8373768 pid=126 cpus=1 - 1 pci_acpi_scan_root+0x3f/0x230 age=8379897 pid=1 cpus=0 - 1 acpi_parse_mcfg+0x61/0x140 age=8379976 pid=1 cpus=0 - 1 pci_mmcfg_arch_init+0x26/0x129 age=8379976 pid=1 cpus=0 - 1 icmp_sk_init+0x32/0x13f age=8379826 pid=1 cpus=0 - 5 hub_probe+0x26b/0x820 [usbcore] age=8374065/8374558/8374911 pid=143-147 cpus=0-1 - 12 usb_cache_string+0x65/0xa0 [usbcore] age=22646/4900582/8374931 pid=143-419 cpus=0-1 - 1 usb_create_ep_files+0x283/0x350 [usbcore] age=8374798 pid=143 cpus=0 - 1 0xffffffffa006595f age=8360191 pid=1549 cpus=0 - 13 snd_info_create_entry+0x30/0xa0 [snd] age=8355564/8372743/8374175 pid=107-1813 cpus=0-1 - 1 snd_oss_info_register+0x40/0xc0 [snd] age=8374813 pid=107 cpus=1 - 1 async_chainiv_givencrypt+0xf9/0x110 [crypto_blkcipher] age=8374570 pid=215 cpus=0 - 1 eseqiv_alloc+0x6d/0x80 [crypto_blkcipher] age=8374570 pid=215 cpus=0 - 1 run+0xa9/0x500 [raid1] age=8370124 pid=916 cpus=0 - 1 __addrconf_sysctl_register+0xcd/0x140 [ipv6] age=8360183 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-16/cache_dma b/test/sys/kernel/slab/kmalloc-16/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/cpu_slabs b/test/sys/kernel/slab/kmalloc-16/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/ctor b/test/sys/kernel/slab/kmalloc-16/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-16/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-16/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/free_calls b/test/sys/kernel/slab/kmalloc-16/free_calls deleted file mode 100644 index 9342318395..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/free_calls +++ /dev/null @@ -1,26 +0,0 @@ - 1912 age=4303047409 pid=0 cpus=0 - 2 free_sched_group+0x62/0x80 age=8375109/8375395/8375681 pid=0-72 cpus=0-1 - 2 free_sched_group+0x6b/0x80 age=8375109/8375395/8375681 pid=0-72 cpus=0-1 - 3 free_sect_attrs+0x2e/0x50 age=8375055/8375055/8375055 pid=383 cpus=0 - 3 __vunmap+0xe9/0x120 age=8373650/8374619/8375152 pid=181-754 cpus=0 - 7 vfs_rename+0x301/0x450 age=125333/5028818/8367033 pid=829-13249 cpus=0 - 10 bio_free_map_data+0x14/0x30 age=23581/2550049/8379364 pid=0-1738 cpus=0-1 - 10 bio_free_map_data+0x1d/0x30 age=53581/4218001/8379379 pid=0-558 cpus=0-1 - 60 remove_kevent+0x44/0x60 age=61364/3011504/8354072 pid=1547-2544 cpus=0-1 - 49 release_sysfs_dirent+0x8c/0xd0 age=7824392/8263442/8379778 pid=1-2141 cpus=0-1 - 9 kobject_release+0xe1/0x140 age=7833231/8247578/8373891 pid=419-1541 cpus=0-1 - 70 kobject_uevent_env+0x11a/0x470 age=409229/8261185/8379979 pid=1-12942 cpus=0-1 - 2 bit_cursor+0x23b/0x6a0 age=8356171/8367984/8379797 pid=1-7 cpus=0-1 - 1 acpi_ds_create_operand+0x12c/0x209 age=8379867 pid=1 cpus=0 - 2 acpi_ns_get_node+0x92/0xa1 age=8374467/8374504/8374542 pid=215 cpus=0-1 - 8 acpi_ut_delete_internal_obj+0x15f/0x16f age=8366439/8374588/8375781 pid=330-1358 cpus=0 - 16 acpi_ut_delete_internal_object_list+0x28/0x2f age=8374469/8378935/8379920 pid=1-396 cpus=0 - 2 reserve_range+0x11d/0x130 age=8379851/8379851/8379851 pid=1 cpus=0 - 3 release_firmware+0x57/0x70 age=8356214/8363521/8367182 pid=1285-1541 cpus=0-1 - 8 module_add_driver+0x66/0xd0 age=8373538/8375876/8379266 pid=1-181 cpus=0-1 - 1 power_supply_uevent+0x1a0/0x210 age=8375647 pid=7 cpus=0 - 2 get_modalias+0xd4/0x120 age=8355835/8367906/8379977 pid=1-1772 cpus=0 - 1 nl_pid_hash_rehash+0x18e/0x1a0 age=8356437 pid=1708 cpus=0 - 2 fib_hash_free+0x35/0x40 age=8367899/8367899/8367899 pid=1185 cpus=0 - 2 wireless_send_event+0x172/0x330 age=8329605/8342854/8356103 pid=1545 cpus=0-1 - 10 usb_get_configuration+0x42d/0x1480 [usbcore] age=22733/6708190/8374932 pid=143-419 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-16/hwcache_align b/test/sys/kernel/slab/kmalloc-16/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/object_size b/test/sys/kernel/slab/kmalloc-16/object_size deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/object_size +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/kmalloc-16/objects b/test/sys/kernel/slab/kmalloc-16/objects deleted file mode 100644 index 67f19f909d..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/objects +++ /dev/null @@ -1 +0,0 @@ -2254 diff --git a/test/sys/kernel/slab/kmalloc-16/objects_partial b/test/sys/kernel/slab/kmalloc-16/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/objs_per_slab b/test/sys/kernel/slab/kmalloc-16/objs_per_slab deleted file mode 100644 index 9e5feb5256..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -46 diff --git a/test/sys/kernel/slab/kmalloc-16/order b/test/sys/kernel/slab/kmalloc-16/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/partial b/test/sys/kernel/slab/kmalloc-16/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/poison b/test/sys/kernel/slab/kmalloc-16/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-16/reclaim_account b/test/sys/kernel/slab/kmalloc-16/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/red_zone b/test/sys/kernel/slab/kmalloc-16/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-16/sanity_checks b/test/sys/kernel/slab/kmalloc-16/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-16/shrink b/test/sys/kernel/slab/kmalloc-16/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-16/slab_size b/test/sys/kernel/slab/kmalloc-16/slab_size deleted file mode 100644 index d22307c427..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/slab_size +++ /dev/null @@ -1 +0,0 @@ -88 diff --git a/test/sys/kernel/slab/kmalloc-16/slabs b/test/sys/kernel/slab/kmalloc-16/slabs deleted file mode 100644 index 95f9650f01..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/slabs +++ /dev/null @@ -1 +0,0 @@ -49 diff --git a/test/sys/kernel/slab/kmalloc-16/store_user b/test/sys/kernel/slab/kmalloc-16/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-16/total_objects b/test/sys/kernel/slab/kmalloc-16/total_objects deleted file mode 100644 index 67f19f909d..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/total_objects +++ /dev/null @@ -1 +0,0 @@ -2254 diff --git a/test/sys/kernel/slab/kmalloc-16/trace b/test/sys/kernel/slab/kmalloc-16/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-16/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-16/validate b/test/sys/kernel/slab/kmalloc-16/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-192/aliases b/test/sys/kernel/slab/kmalloc-192/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-192/align b/test/sys/kernel/slab/kmalloc-192/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-192/alloc_calls b/test/sys/kernel/slab/kmalloc-192/alloc_calls deleted file mode 100644 index ca9d453269..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/alloc_calls +++ /dev/null @@ -1,34 +0,0 @@ - 10 sched_create_group+0x91/0x220 age=8351861/8359345/8366872 pid=1333-2177 cpus=0-1 - 10 sched_create_group+0xae/0x220 age=8351861/8359345/8366872 pid=1333-2177 cpus=0-1 - 10 groups_alloc+0x41/0xe0 age=17070/6159814/8366872 pid=1333-20296 cpus=0-1 - 9 param_sysfs_setup+0x87/0x140 age=8303102/8368759/8379996 pid=1-2754 cpus=0-1 - 2 futex_lock_pi+0x776/0xb00 age=125614/1986240/3846867 pid=2411-13213 cpus=0-1 - 18 mempool_create_node+0x2e/0xf0 age=62077/7917175/8379995 pid=1-13295 cpus=0-1 - 4 __vmalloc_area_node+0xfb/0x140 age=8370390/8373664/8374956 pid=107-901 cpus=0 - 30 __percpu_alloc_mask+0xbc/0x140 age=8370400/8377809/8380000 pid=1-900 cpus=0-1 - 4 d_alloc+0x19d/0x1f0 age=61160/6282991/8356935 pid=1706-13349 cpus=0-1 - 1 bm_register_write+0x63/0x630 age=8354110 pid=2054 cpus=1 - 1 sysfs_open_file+0xd6/0x230 age=0 pid=13466 cpus=0 - 15 ipc_rcu_alloc+0x4a/0x70 age=8274192/8330064/8348647 pid=2177-2621 cpus=0-1 - 28 kset_create_and_add+0x35/0xa0 age=8355999/8378311/8380000 pid=1-1766 cpus=0-1 - 1 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379979 pid=1 cpus=0 - 3 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379976/8379976/8379977 pid=1 cpus=0 - 1 acpi_power_add+0x4a/0x1d6 age=8379890 pid=1 cpus=0 - 2 ata_host_alloc+0x4f/0xf0 age=8379280/8379538/8379796 pid=1 cpus=0-1 - 8 cpuidle_add_state_sysfs+0xc3/0x140 age=125753/125759/125766 pid=13 cpus=0-1 - 1 hid_parse_report+0x43/0x2c0 age=53560 pid=419 cpus=0 - 2 hid_add_field+0x18a/0x3a0 age=53560/53560/53560 pid=419 cpus=0 - 6 fib_create_info+0x61/0x970 age=8324536/8346547/8367903 pid=1197-1541 cpus=0-1 - 1 unix_sysctl_register+0x2a/0x80 age=8379847 pid=1 cpus=0 - 1 rtnetlink_init+0x38/0x113 age=8379999 pid=1 cpus=0 - 1 inet_diag_init+0x15/0x6b age=8378998 pid=1 cpus=0 - 41 usb_alloc_urb+0x19/0x50 [usbcore] age=22746/1043846/8374920 pid=143-419 cpus=0-1 - 1 usb_get_configuration+0x5f2/0x1480 [usbcore] age=22753 pid=419 cpus=0 - 2 usb_get_configuration+0x1388/0x1480 [usbcore] age=8372394/8372581/8372769 pid=419 cpus=0 - 1 sr_probe+0x76/0x540 [sr_mod] age=8375854 pid=163 cpus=0 - 18 snd_ctl_new+0x28/0x90 [snd] age=8374174/8374174/8374174 pid=107 cpus=1 - 1 iwl3945_pci_probe+0xd3f/0x1020 [iwl3945] age=8373796 pid=126 cpus=1 - 1 blkcipher_walk_next+0x29c/0x390 [crypto_blkcipher] age=8374562 pid=215 cpus=1 - 3 dm_register_target+0x1f/0xf0 [dm_mod] age=8370400/8370400/8370401 pid=900 cpus=0 - 1 ipv6_icmp_sysctl_init+0x22/0x40 [ipv6] age=8360202 pid=1549 cpus=0 - 1 snd_seq_pool_new+0x1b/0x80 [snd_seq] age=8355636 pid=1805 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-192/cache_dma b/test/sys/kernel/slab/kmalloc-192/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-192/cpu_slabs b/test/sys/kernel/slab/kmalloc-192/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-192/ctor b/test/sys/kernel/slab/kmalloc-192/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-192/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-192/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-192/free_calls b/test/sys/kernel/slab/kmalloc-192/free_calls deleted file mode 100644 index 17b51ccb6e..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/free_calls +++ /dev/null @@ -1,16 +0,0 @@ - 149 age=4303047430 pid=0 cpus=0 - 5 free_sched_group+0x3b/0x80 age=363179/6767246/8375130 pid=0-1614 cpus=0-1 - 1 free_sched_group+0x50/0x80 age=8369988 pid=0 cpus=0 - 1 do_exit+0x713/0x960 age=8333169 pid=2558 cpus=1 - 7 groups_free+0x56/0x60 age=17071/4081875/8369994 pid=0-1690 cpus=0-1 - 1 __vunmap+0xe9/0x120 age=8356237 pid=1748 cpus=1 - 1 do_readv_writev+0xe4/0x1e0 age=8331191 pid=2262 cpus=0 - 4 getxattr+0x8c/0x140 age=0/6266155/8357946 pid=1610-13466 cpus=0-1 - 20 sysfs_release+0x7c/0xa0 age=53608/7118781/8376453 pid=226-2519 cpus=0-1 - 1 ipc_immediate_free+0x9/0x10 age=8330259 pid=2568 cpus=0 - 1 acpi_pci_irq_add_prt+0x30b/0x324 age=8379911 pid=1 cpus=0 - 6 cpuidle_remove_state_sysfs+0x4f/0x70 age=125768/1366349/3847513 pid=13 cpus=0 - 4 free_fib_info+0x34/0x60 age=8367904/8367909/8367920 pid=1185-1197 cpus=0-1 - 36 urb_destroy+0x23/0x30 [usbcore] age=22749/2596918/8374921 pid=143-13294 cpus=0-1 - 1 sg_clean+0x3e/0x80 [usbcore] age=61399 pid=13294 cpus=0 - 1 0xffffffffa006521f age=8355637 pid=1805 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-192/hwcache_align b/test/sys/kernel/slab/kmalloc-192/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-192/object_size b/test/sys/kernel/slab/kmalloc-192/object_size deleted file mode 100644 index 86a0307199..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/object_size +++ /dev/null @@ -1 +0,0 @@ -192 diff --git a/test/sys/kernel/slab/kmalloc-192/objects b/test/sys/kernel/slab/kmalloc-192/objects deleted file mode 100644 index f1aaa90592..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/objects +++ /dev/null @@ -1 +0,0 @@ -254 diff --git a/test/sys/kernel/slab/kmalloc-192/objects_partial b/test/sys/kernel/slab/kmalloc-192/objects_partial deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/objects_partial +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/kmalloc-192/objs_per_slab b/test/sys/kernel/slab/kmalloc-192/objs_per_slab deleted file mode 100644 index 60d3b2f4a4..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/test/sys/kernel/slab/kmalloc-192/order b/test/sys/kernel/slab/kmalloc-192/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-192/partial b/test/sys/kernel/slab/kmalloc-192/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-192/poison b/test/sys/kernel/slab/kmalloc-192/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-192/reclaim_account b/test/sys/kernel/slab/kmalloc-192/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-192/red_zone b/test/sys/kernel/slab/kmalloc-192/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-192/sanity_checks b/test/sys/kernel/slab/kmalloc-192/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-192/shrink b/test/sys/kernel/slab/kmalloc-192/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-192/slab_size b/test/sys/kernel/slab/kmalloc-192/slab_size deleted file mode 100644 index 10b0c0dbc8..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/slab_size +++ /dev/null @@ -1 +0,0 @@ -264 diff --git a/test/sys/kernel/slab/kmalloc-192/slabs b/test/sys/kernel/slab/kmalloc-192/slabs deleted file mode 100644 index 98d9bcb75a..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/slabs +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/test/sys/kernel/slab/kmalloc-192/store_user b/test/sys/kernel/slab/kmalloc-192/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-192/total_objects b/test/sys/kernel/slab/kmalloc-192/total_objects deleted file mode 100644 index ace9d03621..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/total_objects +++ /dev/null @@ -1 +0,0 @@ -255 diff --git a/test/sys/kernel/slab/kmalloc-192/trace b/test/sys/kernel/slab/kmalloc-192/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-192/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-192/validate b/test/sys/kernel/slab/kmalloc-192/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-2048/aliases b/test/sys/kernel/slab/kmalloc-2048/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-2048/align b/test/sys/kernel/slab/kmalloc-2048/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-2048/alloc_calls b/test/sys/kernel/slab/kmalloc-2048/alloc_calls deleted file mode 100644 index a315f8b04c..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/alloc_calls +++ /dev/null @@ -1,41 +0,0 @@ - 53 load_module+0x18d5/0x1b30 age=8303006/8368517/8376245 pid=105-2754 cpus=0-1 - 1 mempool_create_node+0x4b/0xf0 age=8370049 pid=916 cpus=0 - 20 sget+0xc4/0x460 age=61397/7958673/8380037 pid=0-13348 cpus=0-1 - 15 alloc_fdtable+0x81/0x160 age=4219/6197046/8357231 pid=1532-12336 cpus=0-1 - 2 journal_init_common+0x1a/0x130 age=8369592/8373942/8378292 pid=1-962 cpus=0 - 15 alloc_disk_node+0x1b/0x120 age=61949/7263912/8379312 pid=1-13295 cpus=0-1 - 1 pci_create_bus+0x3a/0x240 age=8379822 pid=1 cpus=0 - 21 alloc_pci_dev+0x1a/0x40 age=8379818/8379820/8379822 pid=1 cpus=0 - 1 framebuffer_alloc+0x3a/0x80 age=8379737 pid=1 cpus=1 - 74 acpi_add_single_object+0x4e/0xd3c age=8379823/8379836/8379852 pid=1 cpus=0 - 1 acpi_irq_stats_init+0xcb/0x268 age=8379894 pid=1 cpus=0 - 11 pnp_alloc_dev+0x35/0x120 age=8379786/8379789/8379791 pid=1 cpus=0 - 11 init_dev+0x12e/0x6f0 age=7217110/8250882/8378132 pid=33-2593 cpus=0-1 - 3 init_dev+0x2aa/0x6f0 age=7217110/7969221/8364310 pid=1258-2593 cpus=0-1 - 1 tty_register_driver+0x1b3/0x2a0 age=8379706 pid=1 cpus=1 - 2 tty_write+0x160/0x280 age=913316/4463710/8014104 pid=1206-3110 cpus=0 - 2 kobj_map_init+0x22/0xa0 age=8379899/8379968/8380037 pid=0-1 cpus=0 - 3 mousedev_create+0x36/0x2d0 age=53460/5603607/8378947 pid=1-419 cpus=0 - 1 atkbd_connect+0x33/0x290 age=8378940 pid=17 cpus=1 - 2 thermal_zone_device_register+0x6f/0x310 age=8374790/8374807/8374825 pid=329 cpus=0-1 - 15 sk_prot_alloc+0x83/0xb0 age=8328308/8367505/8379903 pid=1-2586 cpus=0-1 - 1 reqsk_queue_alloc+0x112/0x120 age=8356786 pid=1690 cpus=0 - 255 __netdev_alloc_skb+0x1f/0x40 age=8356300/8356301/8356303 pid=1541 cpus=0 - 10 neigh_sysctl_register+0x8d/0x330 age=8360107/8368337/8379760 pid=1-1549 cpus=0-1 - 6 __devinet_sysctl_register+0x74/0x120 age=8373573/8377097/8379760 pid=1-126 cpus=0-1 - 7 pci_add_new_bus+0x25/0x160 age=8379818/8379818/8379820 pid=1 cpus=0 - 1 i8042_create_aux_port+0x36/0x10f age=8378959 pid=1 cpus=0 - 1 i8042_probe+0x190/0x68d age=8378959 pid=1 cpus=0 - 1 netdev_init+0x32/0xc2 age=8379782 pid=1 cpus=0 - 1 netdev_init+0x66/0xc2 age=8379782 pid=1 cpus=0 - 1 fib_net_init+0x21/0x14c age=8379760 pid=1 cpus=0 - 10 usb_alloc_dev+0x36/0x2c0 [usbcore] age=22875/5876181/8374868 pid=143-419 cpus=0-1 - 2 acpi_thermal_add+0x36/0x4bb [thermal] age=8374792/8374809/8374827 pid=329 cpus=0-1 - 5 evdev_open+0xaf/0x1e0 [evdev] age=8364377/8364927/8365226 pid=1443 cpus=0-1 - 8 evdev_connect+0x54/0x1f0 [evdev] age=53452/7334685/8375002 pid=187-419 cpus=0-1 - 1 rtc_device_register+0xa4/0x260 [rtc_core] age=8374707 pid=208 cpus=0 - 1 iwl3945_bg_request_scan+0x5d3/0x660 [iwl3945] age=8356027 pid=733 cpus=0 - 1 iwl3945_pci_probe+0xd26/0x1020 [iwl3945] age=8373700 pid=126 cpus=1 - 1 patch_ad1981+0x1b/0x1d0 [snd_hda_intel] age=8374101 pid=107 cpus=1 - 1 rfkill_allocate+0x24/0xc0 [rfkill] age=8374401 pid=215 cpus=0 - 1 fuse_fill_super+0x26d/0x6d0 [fuse] age=8335736 pid=2476 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-2048/cache_dma b/test/sys/kernel/slab/kmalloc-2048/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-2048/cpu_slabs b/test/sys/kernel/slab/kmalloc-2048/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-2048/ctor b/test/sys/kernel/slab/kmalloc-2048/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-2048/free_calls b/test/sys/kernel/slab/kmalloc-2048/free_calls deleted file mode 100644 index 9a60610d29..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/free_calls +++ /dev/null @@ -1,16 +0,0 @@ - 424 age=4303047334 pid=0 cpus=0 - 1 __vunmap+0xe9/0x120 age=8374513 pid=107 cpus=1 - 79 free_fdtable_rcu+0x71/0xb0 age=7254/7749386/8377555 pid=0-13365 cpus=0-1 - 4 show_stat+0x50e/0x530 age=23516/2125165/8360113 pid=1258-1868 cpus=0 - 4 acpi_add_single_object+0xc9a/0xd3c age=8379824/8379831/8379839 pid=1 cpus=0 - 20 release_one_tty+0x145/0x190 age=8352386/8360775/8370275 pid=55-2136 cpus=0-1 - 1 atkbd_connect+0x1ae/0x290 age=8378923 pid=17 cpus=0 - 8 sk_free+0xcd/0x100 age=656267/7395001/8360982 pid=1533-12333 cpus=0-1 - 18 skb_release_data+0x85/0xd0 age=61516/7352252/8379750 pid=1-13343 cpus=0-1 - 5 __scm_destroy+0x41/0x50 age=7217111/8111550/8352414 pid=2135-2593 cpus=0-1 - 1 huft_build+0x163/0x63e age=8379752 pid=1 cpus=0 - 1 inflate_fixed+0x17c/0x193 age=8379752 pid=1 cpus=0 - 1 usb_release_dev+0x59/0x70 [usbcore] age=53835 pid=419 cpus=0 - 1 acpi_processor_get_throttling_info+0x2e4/0x58c [processor] age=8375644 pid=330 cpus=0 - 1 acpi_thermal_add+0x457/0x4bb [thermal] age=8374828 pid=329 cpus=1 - 1 snd_ctl_ioctl+0x2cf/0x960 [snd] age=8373099 pid=786 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-2048/hwcache_align b/test/sys/kernel/slab/kmalloc-2048/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-2048/object_size b/test/sys/kernel/slab/kmalloc-2048/object_size deleted file mode 100644 index c873496a22..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/object_size +++ /dev/null @@ -1 +0,0 @@ -2048 diff --git a/test/sys/kernel/slab/kmalloc-2048/objects b/test/sys/kernel/slab/kmalloc-2048/objects deleted file mode 100644 index af368af278..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/objects +++ /dev/null @@ -1 +0,0 @@ -584 diff --git a/test/sys/kernel/slab/kmalloc-2048/objects_partial b/test/sys/kernel/slab/kmalloc-2048/objects_partial deleted file mode 100644 index 04f9fe4606..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/objects_partial +++ /dev/null @@ -1 +0,0 @@ -59 diff --git a/test/sys/kernel/slab/kmalloc-2048/objs_per_slab b/test/sys/kernel/slab/kmalloc-2048/objs_per_slab deleted file mode 100644 index 60d3b2f4a4..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/test/sys/kernel/slab/kmalloc-2048/order b/test/sys/kernel/slab/kmalloc-2048/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/kmalloc-2048/partial b/test/sys/kernel/slab/kmalloc-2048/partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/kmalloc-2048/poison b/test/sys/kernel/slab/kmalloc-2048/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-2048/reclaim_account b/test/sys/kernel/slab/kmalloc-2048/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-2048/red_zone b/test/sys/kernel/slab/kmalloc-2048/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-2048/sanity_checks b/test/sys/kernel/slab/kmalloc-2048/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-2048/shrink b/test/sys/kernel/slab/kmalloc-2048/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-2048/slab_size b/test/sys/kernel/slab/kmalloc-2048/slab_size deleted file mode 100644 index cf41a14a88..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/slab_size +++ /dev/null @@ -1 +0,0 @@ -2120 diff --git a/test/sys/kernel/slab/kmalloc-2048/slabs b/test/sys/kernel/slab/kmalloc-2048/slabs deleted file mode 100644 index 425151f3a4..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/slabs +++ /dev/null @@ -1 +0,0 @@ -40 diff --git a/test/sys/kernel/slab/kmalloc-2048/store_user b/test/sys/kernel/slab/kmalloc-2048/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-2048/total_objects b/test/sys/kernel/slab/kmalloc-2048/total_objects deleted file mode 100644 index e9f960cf4a..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/total_objects +++ /dev/null @@ -1 +0,0 @@ -600 diff --git a/test/sys/kernel/slab/kmalloc-2048/trace b/test/sys/kernel/slab/kmalloc-2048/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-2048/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-2048/validate b/test/sys/kernel/slab/kmalloc-2048/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-256/aliases b/test/sys/kernel/slab/kmalloc-256/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-256/align b/test/sys/kernel/slab/kmalloc-256/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-256/alloc_calls b/test/sys/kernel/slab/kmalloc-256/alloc_calls deleted file mode 100644 index 38a3b680e2..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/alloc_calls +++ /dev/null @@ -1,27 +0,0 @@ - 2 mempool_kmalloc+0x11/0x20 age=8379928/8379928/8379928 pid=1 cpus=0 - 2 __vmalloc_area_node+0xfb/0x140 age=8374585/8375388/8376192 pid=122-126 cpus=0-1 - 32 dma_pool_create+0x90/0x1e0 age=8374074/8374505/8374905 pid=143-147 cpus=0-1 - 28 __percpu_alloc_mask+0xbc/0x140 age=8360136/8365750/8379780 pid=1-1549 cpus=0 - 2 seq_open+0x84/0xa0 age=8355780/8360929/8366079 pid=1371-1738 cpus=0 - 19 inotify_init+0x1b/0x90 age=8333719/8353284/8379778 pid=1-2544 cpus=0-1 - 1 mounts_open_common+0x11e/0x210 age=8365844 pid=1371 cpus=0 - 347 __proc_create+0xa5/0x150 age=8355314/8375854/8380066 pid=0-1813 cpus=0-1 - 6 start_this_handle+0x3f5/0x410 age=4241/38502/142468 pid=21-13466 cpus=0-1 - 3 elevator_alloc+0x1b/0xc0 age=62010/5606790/8379345 pid=1-13295 cpus=0-1 - 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379913/8379914/8379915 pid=1 cpus=0 - 1 find_dock+0x414/0x426 age=8379931 pid=1 cpus=0 - 6 con_insert_unipair+0x96/0x110 age=8355034/8367399/8379765 pid=1-1898 cpus=1 - 2 neigh_resolve_output+0x226/0x2e0 age=1134112/4736669/8339226 pid=0-2401 cpus=0-1 - 1 genl_register_family+0x1b6/0x1e0 age=8375014 pid=126 cpus=0 - 5 ip_mc_inc_group+0x6b/0x280 age=8325482/8352347/8367852 pid=1185-1849 cpus=0-1 - 2 cache_add_dev+0x17b/0x546 age=8379779/8379779/8379780 pid=1 cpus=0-1 - 10 audit_register_class+0x1e/0xa1 age=8379779/8379779/8379779 pid=1 cpus=1 - 1 proc_net_ns_init+0x1b/0x81 age=8380066 pid=0 cpus=0 - 3 snd_malloc_sgbuf_pages+0xfa/0x1f0 [snd_page_alloc] age=8374129/8374129/8374129 pid=107 cpus=1 - 1 usb_get_configuration+0x18f/0x1480 [usbcore] age=8372709 pid=419 cpus=0 - 1 acpi_ac_add+0x3a/0x1b1 [ac] age=8375784 pid=392 cpus=0 - 1 acpi_processor_register_performance+0x2a0/0x3a6 [processor] age=8366391 pid=1358 cpus=0 - 3 snd_ctl_open+0x8e/0x180 [snd] age=8333026/8337179/8339273 pid=2400-2425 cpus=0 - 8 ieee80211_rx_bss_add+0x4e/0x140 [mac80211] age=8354793/8355457/8355979 pid=0-1951 cpus=0 - 2 ipv6_add_addr+0x199/0x3c0 [ipv6] age=8329536/8344837/8360138 pid=8-1549 cpus=0-1 - 5 ipv6_dev_mc_inc+0x141/0x3f0 [ipv6] age=8329536/8354016/8360138 pid=8-1549 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-256/cache_dma b/test/sys/kernel/slab/kmalloc-256/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-256/cpu_slabs b/test/sys/kernel/slab/kmalloc-256/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-256/ctor b/test/sys/kernel/slab/kmalloc-256/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-256/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-256/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-256/free_calls b/test/sys/kernel/slab/kmalloc-256/free_calls deleted file mode 100644 index f919ad9adf..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/free_calls +++ /dev/null @@ -1,12 +0,0 @@ - 389 age=4303047363 pid=0 cpus=0 - 1 __vunmap+0xe9/0x120 age=8374878 pid=107 cpus=1 - 38 do_execve+0x2b1/0x2d0 age=7303/7294190/8377088 pid=71-13465 cpus=0-1 - 51 seq_release+0x20/0x30 age=23541/7877166/8376202 pid=105-2535 cpus=0-1 - 3 free_proc_entry+0x73/0x90 age=8356279/8369643/8378992 pid=1-1541 cpus=0 - 3 __journal_drop_transaction+0xe6/0x170 age=8360317/8363466/8366128 pid=32 cpus=0 - 1 acpi_pci_irq_add_prt+0xc2/0x324 age=8379845 pid=1 cpus=0 - 2 acpi_pci_bind+0x26b/0x28d age=8379844/8379845/8379846 pid=1 cpus=0 - 1 wireless_send_event+0x172/0x330 age=8329538 pid=742 cpus=1 - 3 usb_string+0x17c/0x1e0 [usbcore] age=8374367/8374614/8374886 pid=143 cpus=0 - 3 snd_ctl_release+0xf9/0x130 [snd] age=8333027/8337180/8339274 pid=2400-2425 cpus=0 - 1 ieee80211_set_associated+0x421/0x520 [mac80211] age=8329538 pid=742 cpus=1 diff --git a/test/sys/kernel/slab/kmalloc-256/hwcache_align b/test/sys/kernel/slab/kmalloc-256/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-256/object_size b/test/sys/kernel/slab/kmalloc-256/object_size deleted file mode 100644 index 9183bf03fc..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/object_size +++ /dev/null @@ -1 +0,0 @@ -256 diff --git a/test/sys/kernel/slab/kmalloc-256/objects b/test/sys/kernel/slab/kmalloc-256/objects deleted file mode 100644 index 3091e8eea2..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/objects +++ /dev/null @@ -1 +0,0 @@ -504 diff --git a/test/sys/kernel/slab/kmalloc-256/objects_partial b/test/sys/kernel/slab/kmalloc-256/objects_partial deleted file mode 100644 index abdfb053e4..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/objects_partial +++ /dev/null @@ -1 +0,0 @@ -60 diff --git a/test/sys/kernel/slab/kmalloc-256/objs_per_slab b/test/sys/kernel/slab/kmalloc-256/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/kmalloc-256/order b/test/sys/kernel/slab/kmalloc-256/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-256/partial b/test/sys/kernel/slab/kmalloc-256/partial deleted file mode 100644 index 1e8b314962..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/partial +++ /dev/null @@ -1 +0,0 @@ -6 diff --git a/test/sys/kernel/slab/kmalloc-256/poison b/test/sys/kernel/slab/kmalloc-256/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-256/reclaim_account b/test/sys/kernel/slab/kmalloc-256/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-256/red_zone b/test/sys/kernel/slab/kmalloc-256/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-256/sanity_checks b/test/sys/kernel/slab/kmalloc-256/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-256/shrink b/test/sys/kernel/slab/kmalloc-256/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-256/slab_size b/test/sys/kernel/slab/kmalloc-256/slab_size deleted file mode 100644 index 86619979c3..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/slab_size +++ /dev/null @@ -1 +0,0 @@ -328 diff --git a/test/sys/kernel/slab/kmalloc-256/slabs b/test/sys/kernel/slab/kmalloc-256/slabs deleted file mode 100644 index 920a139664..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/slabs +++ /dev/null @@ -1 +0,0 @@ -43 diff --git a/test/sys/kernel/slab/kmalloc-256/store_user b/test/sys/kernel/slab/kmalloc-256/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-256/total_objects b/test/sys/kernel/slab/kmalloc-256/total_objects deleted file mode 100644 index 1c599d4ff3..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/total_objects +++ /dev/null @@ -1 +0,0 @@ -516 diff --git a/test/sys/kernel/slab/kmalloc-256/trace b/test/sys/kernel/slab/kmalloc-256/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-256/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-256/validate b/test/sys/kernel/slab/kmalloc-256/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-32/aliases b/test/sys/kernel/slab/kmalloc-32/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-32/align b/test/sys/kernel/slab/kmalloc-32/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-32/alloc_calls b/test/sys/kernel/slab/kmalloc-32/alloc_calls deleted file mode 100644 index f924b87f08..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/alloc_calls +++ /dev/null @@ -1,50 +0,0 @@ - 1 mtrr_file_add+0xb0/0xe0 age=8355511 pid=1738 cpus=0 - 2 arch_acpi_processor_init_pdc+0x8e/0x180 age=8375727/8375758/8375789 pid=330 cpus=0 - 1 pm_qos_add_requirement+0x34/0xe0 age=8376080 pid=122 cpus=1 - 59 setup_modinfo_srcversion+0x19/0x30 age=8303075/8368435/8376316 pid=105-2754 cpus=0-1 - 42 load_module+0x1455/0x1b30 age=8303075/8366312/8375832 pid=107-2754 cpus=0-1 - 151 load_module+0x1ac4/0x1b30 age=8303071/8368871/8376310 pid=105-2754 cpus=0-1 - 3 mempool_create_node+0x4b/0xf0 age=62046/5606826/8379381 pid=1-13295 cpus=0-1 - 1 strndup_user+0x6d/0xc0 age=8374925 pid=107 cpus=0 - 16 __vmalloc_area_node+0xfb/0x140 age=8328464/8366300/8376086 pid=107-2578 cpus=0-1 - 1 do_kern_mount+0xca/0x110 age=8335800 pid=2476 cpus=0 - 1 do_sys_poll+0xdb/0x450 age=1303 pid=1333 cpus=1 - 1 alloc_vfsmnt+0x97/0x180 age=8335801 pid=2476 cpus=0 - 1 single_open+0x3c/0xb0 age=8355816 pid=1738 cpus=0 - 66 sysfs_new_dirent+0x10c/0x120 age=8360190/8377926/8379815 pid=1-1549 cpus=0-1 - 30 do_shmat+0x169/0x410 age=8274161/8330033/8348616 pid=1738-2621 cpus=0-1 - 21 register_blkdev+0x60/0x150 age=8369695/8377753/8379765 pid=1-951 cpus=0-1 - 39 kvasprintf+0x55/0x90 age=8360190/8378048/8379814 pid=1-1549 cpus=0-1 - 7 pci_save_state+0x1a4/0x250 age=8373637/8378406/8379803 pid=1-126 cpus=0-1 - 2 pcim_enable_device+0x86/0xb0 age=8379255/8379510/8379765 pid=1 cpus=0-1 - 15 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379932/8379938/8379947 pid=1 cpus=0 - 21 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=3847501/7731852/8379949 pid=1-330 cpus=0 - 1 acpi_install_gpe_handler+0xa7/0x13a age=8379959 pid=1 cpus=0 - 1 acpi_ev_create_gpe_block+0x282/0x3bf age=8379959 pid=1 cpus=0 - 1 acpi_pci_bind_root+0x8d/0x13e age=8379883 pid=1 cpus=0 - 18 acpi_pci_bind+0x85/0x28d age=8379879/8379879/8379882 pid=1 cpus=0 - 15 rand_initialize_disk+0x1d/0x30 age=62014/7263977/8379377 pid=1-13295 cpus=0-1 - 1 ata_host_start+0xcb/0x1e0 age=8379764 pid=1 cpus=1 - 1 hidinput_connect+0x2372/0x24e0 age=53529 pid=419 cpus=0 - 1 sock_kmalloc+0x5c/0x70 age=8325518 pid=1849 cpus=1 - 2 proto_register+0x7c/0x260 age=8360191/8370012/8379834 pid=1-1549 cpus=0 - 2 neigh_hash_alloc+0x42/0x50 age=8325417/8327412/8329408 pid=0-1849 cpus=1 - 1 nl_pid_hash_rehash+0x180/0x1a0 age=947530 pid=1189 cpus=0 - 28 unix_bind+0xd8/0x3a0 age=8356458/8357177/8366824 pid=1336-1738 cpus=0-1 - 3 ipc_init_proc_interface+0x2e/0x7c age=8379805/8379805/8379805 pid=1 cpus=1 - 13 usb_cache_string+0x65/0xa0 [usbcore] age=22649/4521883/8374921 pid=143-419 cpus=0-1 - 6 usb_get_configuration+0x18f/0x1480 [usbcore] age=67053/6989971/8374921 pid=143-419 cpus=0-1 - 2 _snd_ctl_register_ioctl+0x2b/0x80 [snd] age=8374675/8374675/8374675 pid=107 cpus=0 - 2 snd_oss_info_register+0x40/0xc0 [snd] age=8355350/8355452/8355555 pid=1813 cpus=0 - 6 adjust_io+0xeb/0x120 [rsrc_nonstatic] age=8373110/8373182/8373542 pid=352-800 cpus=0 - 5 adjust_memory+0xe5/0x1a0 [rsrc_nonstatic] age=8373110/8373278/8373535 pid=352-800 cpus=0 - 1 ieee80211_sta_set_extra_ie+0x7d/0xe0 [mac80211] age=8329597 pid=1545 cpus=0 - 2 ieee80211_rx_bss_info+0x4df/0xa20 [mac80211] age=8330170/8342783/8355397 pid=0 cpus=0 - 2 ieee80211_rx_bss_info+0x568/0xa20 [mac80211] age=22736/4188782/8354829 pid=742-1951 cpus=0 - 2 ieee80211_rx_bss_info+0x5f7/0xa20 [mac80211] age=22736/4189294/8355852 pid=742-1772 cpus=0 - 1 rate_control_alloc+0x32/0x110 [mac80211] age=8373757 pid=126 cpus=1 - 2 ieee80211_rate_control_register+0x72/0xf0 [mac80211] age=8374580/8374635/8374690 pid=126 cpus=0-1 - 2 azx_probe+0x9a4/0xc20 [snd_hda_intel] age=8374165/8374165/8374165 pid=107 cpus=1 - 1 async_chainiv_givencrypt+0x71/0x110 [crypto_blkcipher] age=8374560 pid=215 cpus=0 - 1 run+0x66/0x500 [raid1] age=8370114 pid=916 cpus=0 - 1 acpi_cpufreq_cpu_init+0x4d/0x45c [acpi_cpufreq] age=8366427 pid=1358 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-32/cache_dma b/test/sys/kernel/slab/kmalloc-32/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-32/cpu_slabs b/test/sys/kernel/slab/kmalloc-32/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-32/ctor b/test/sys/kernel/slab/kmalloc-32/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-32/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-32/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-32/free_calls b/test/sys/kernel/slab/kmalloc-32/free_calls deleted file mode 100644 index 50e82729c9..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/free_calls +++ /dev/null @@ -1,25 +0,0 @@ - 409 age=4303047399 pid=0 cpus=0 - 4 __vunmap+0xe9/0x120 age=8366429/8372533/8374823 pid=215-1358 cpus=0-1 - 1 vfs_rename+0x301/0x450 age=8274772 pid=2851 cpus=0 - 8 do_sys_poll+0x32b/0x450 age=1304/6728883/8333312 pid=1333 cpus=0-1 - 1 seq_release_private+0x2d/0x60 age=8352378 pid=2141 cpus=0 - 5 single_release+0x2e/0x40 age=8343903/8358822/8366889 pid=1258-1806 cpus=0 - 1 setxattr+0xa6/0x130 age=8355591 pid=1816 cpus=0 - 6 bio_free_map_data+0x25/0x30 age=53571/4350975/8375998 pid=0-318 cpus=0 - 6 remove_kevent+0x44/0x60 age=7219423/7961750/8346613 pid=2271-2423 cpus=0-1 - 57 load_elf_binary+0xa72/0x1e20 age=22671/8213994/8376585 pid=102-13419 cpus=0-1 - 1 generic_acl_set+0x15e/0x1a0 age=8355591 pid=1816 cpus=0 - 67 kobject_uevent_env+0x11a/0x470 age=62016/8246870/8379965 pid=1-13295 cpus=0-1 - 2 pci_get_subsys+0x74/0xa0 age=8375728/8375759/8375790 pid=330 cpus=0 - 8 acpi_evaluate_integer+0xbf/0xd1 age=3847577/7810351/8379888 pid=1-2097 cpus=0 - 3 acpi_ds_create_operand+0x12c/0x209 age=3847578/6867437/8379889 pid=1-2097 cpus=0 - 3 acpi_ns_get_node+0x92/0xa1 age=8374447/8376288/8379960 pid=1-215 cpus=0-1 - 5 acpi_ut_delete_internal_obj+0x15f/0x16f age=8366428/8373878/8375771 pid=330-1358 cpus=0 - 3 acpi_pci_bind+0x277/0x28d age=8379881/8379881/8379883 pid=1 cpus=0 - 1 get_modalias+0xd4/0x120 age=8355825 pid=1772 cpus=0 - 2 ioctl_standard_iw_point+0x179/0x350 age=63360/84363/105367 pid=1541 cpus=0 - 1 pci_bus_assign_resources+0xfe/0x4d0 age=8379836 pid=1 cpus=0 - 1 sg_clean+0x3e/0x80 [usbcore] age=59566 pid=13294 cpus=0 - 9 usb_get_device_descriptor+0x9b/0xa0 [usbcore] age=22724/6523118/8374922 pid=143-419 cpus=0-1 - 1 ieee80211_rx_bss_info+0x552/0xa20 [mac80211] age=22737 pid=742 cpus=0 - 2 ieee80211_rx_bss_info+0x5e1/0xa20 [mac80211] age=22737/4189295/8355853 pid=742-1772 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-32/hwcache_align b/test/sys/kernel/slab/kmalloc-32/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-32/object_size b/test/sys/kernel/slab/kmalloc-32/object_size deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/object_size +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/kmalloc-32/objects b/test/sys/kernel/slab/kmalloc-32/objects deleted file mode 100644 index e110e8daae..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/objects +++ /dev/null @@ -1 +0,0 @@ -617 diff --git a/test/sys/kernel/slab/kmalloc-32/objects_partial b/test/sys/kernel/slab/kmalloc-32/objects_partial deleted file mode 100644 index 15c44e939b..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/objects_partial +++ /dev/null @@ -1 +0,0 @@ -149 diff --git a/test/sys/kernel/slab/kmalloc-32/objs_per_slab b/test/sys/kernel/slab/kmalloc-32/objs_per_slab deleted file mode 100644 index a2720097dc..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -39 diff --git a/test/sys/kernel/slab/kmalloc-32/order b/test/sys/kernel/slab/kmalloc-32/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-32/partial b/test/sys/kernel/slab/kmalloc-32/partial deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/partial +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/kmalloc-32/poison b/test/sys/kernel/slab/kmalloc-32/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-32/reclaim_account b/test/sys/kernel/slab/kmalloc-32/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-32/red_zone b/test/sys/kernel/slab/kmalloc-32/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-32/sanity_checks b/test/sys/kernel/slab/kmalloc-32/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-32/shrink b/test/sys/kernel/slab/kmalloc-32/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-32/slab_size b/test/sys/kernel/slab/kmalloc-32/slab_size deleted file mode 100644 index b16e5f75e3..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/slab_size +++ /dev/null @@ -1 +0,0 @@ -104 diff --git a/test/sys/kernel/slab/kmalloc-32/slabs b/test/sys/kernel/slab/kmalloc-32/slabs deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/slabs +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/kmalloc-32/store_user b/test/sys/kernel/slab/kmalloc-32/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-32/total_objects b/test/sys/kernel/slab/kmalloc-32/total_objects deleted file mode 100644 index d27f552128..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/total_objects +++ /dev/null @@ -1 +0,0 @@ -624 diff --git a/test/sys/kernel/slab/kmalloc-32/trace b/test/sys/kernel/slab/kmalloc-32/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-32/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-32/validate b/test/sys/kernel/slab/kmalloc-32/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-4096/aliases b/test/sys/kernel/slab/kmalloc-4096/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-4096/align b/test/sys/kernel/slab/kmalloc-4096/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-4096/alloc_calls b/test/sys/kernel/slab/kmalloc-4096/alloc_calls deleted file mode 100644 index cd1acb03fd..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/alloc_calls +++ /dev/null @@ -1,23 +0,0 @@ - 1 load_module+0x18d5/0x1b30 age=8375716 pid=330 cpus=0 - 1 __vmalloc_area_node+0xfb/0x140 age=8371983 pid=867 cpus=0 - 24 __percpu_alloc_mask+0xbc/0x140 age=8360098/8363374/8379742 pid=1-1549 cpus=0 - 1 seq_read+0x2f0/0x360 age=8365263 pid=1371 cpus=0 - 2 ext3_fill_super+0x68/0x1a20 age=8369599/8373987/8378375 pid=1-962 cpus=0 - 4 journal_init_revoke_table+0x4d/0xb0 age=8369583/8373933/8378283 pid=1-962 cpus=0 - 2 journal_init_inode+0x8d/0x130 age=8369583/8373933/8378283 pid=1-962 cpus=0 - 1 fat_fill_super+0x40/0xdd0 age=61388 pid=13348 cpus=1 - 7 scsi_host_alloc+0x35/0x360 age=66976/7192011/8379690 pid=1-419 cpus=0-1 - 3 scsi_alloc_sdev+0x6a/0x270 age=61972/5606752/8379307 pid=1-13295 cpus=0-1 - 8 input_allocate_device+0x1a/0xb0 age=53455/7335718/8378931 pid=17-419 cpus=0-1 - 1 reqsk_queue_alloc+0x112/0x120 age=8354535 pid=1920 cpus=0 - 3 alloc_netdev_mq+0x4f/0x180 age=8373564/8375671/8379766 pid=1-126 cpus=0-1 - 1 pidmap_init+0x15/0x4e age=8380028 pid=0 cpus=0 - 1 netlink_proto_init+0x47/0x16b age=8379894 pid=1 cpus=0 - 2 acpi_processor_add+0x25/0x6d [processor] age=8375653/8375684/8375715 pid=330 cpus=0 - 1 yenta_probe+0x38/0x6cd [yenta_socket] age=8373766 pid=352 cpus=0 - 281 iwl3945_rx_allocate+0xd5/0x160 [iwl3945] age=2011/7577/13684 pid=733 cpus=0 - 1 skcipher_geniv_alloc+0x304/0x3f0 [crypto_blkcipher] age=8374372 pid=215 cpus=1 - 2 bitmap_get_counter+0x153/0x220 [md_mod] age=8370027/8370029/8370031 pid=916 cpus=0 - 1 bitmap_create+0x2bc/0xad0 [md_mod] age=8370031 pid=916 cpus=0 - 6 __addrconf_sysctl_register+0x7b/0x140 [ipv6] age=8360098/8360099/8360101 pid=1549 cpus=0 - 1 acm_probe+0x34c/0xa50 [cdc_acm] age=22641 pid=419 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-4096/cache_dma b/test/sys/kernel/slab/kmalloc-4096/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-4096/cpu_slabs b/test/sys/kernel/slab/kmalloc-4096/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-4096/ctor b/test/sys/kernel/slab/kmalloc-4096/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-4096/free_calls b/test/sys/kernel/slab/kmalloc-4096/free_calls deleted file mode 100644 index a0d77b9afc..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/free_calls +++ /dev/null @@ -1,7 +0,0 @@ - 187 age=4303047324 pid=0 cpus=0 - 5 seq_release+0x18/0x30 age=61430/6709712/8374782 pid=107-1371 cpus=0-1 - 1 cryptomgr_probe+0x81/0xf0 age=8373564 pid=745 cpus=0 - 30 kobject_uevent_env+0x122/0x470 age=22643/7542644/8379894 pid=1-1549 cpus=0-1 - 1 show_uevent+0xee/0x110 age=2013 pid=13466 cpus=0 - 1 input_dev_release+0x23/0x40 age=8378913 pid=17 cpus=0 - 130 skb_release_data+0x85/0xd0 age=2011/73374/8354535 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-4096/hwcache_align b/test/sys/kernel/slab/kmalloc-4096/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-4096/object_size b/test/sys/kernel/slab/kmalloc-4096/object_size deleted file mode 100644 index 801c306ed3..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/object_size +++ /dev/null @@ -1 +0,0 @@ -4096 diff --git a/test/sys/kernel/slab/kmalloc-4096/objects b/test/sys/kernel/slab/kmalloc-4096/objects deleted file mode 100644 index 526204c865..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/objects +++ /dev/null @@ -1 +0,0 @@ -367 diff --git a/test/sys/kernel/slab/kmalloc-4096/objects_partial b/test/sys/kernel/slab/kmalloc-4096/objects_partial deleted file mode 100644 index 98d9bcb75a..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/objects_partial +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/test/sys/kernel/slab/kmalloc-4096/objs_per_slab b/test/sys/kernel/slab/kmalloc-4096/objs_per_slab deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/kmalloc-4096/order b/test/sys/kernel/slab/kmalloc-4096/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/kmalloc-4096/partial b/test/sys/kernel/slab/kmalloc-4096/partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/kmalloc-4096/poison b/test/sys/kernel/slab/kmalloc-4096/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-4096/reclaim_account b/test/sys/kernel/slab/kmalloc-4096/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-4096/red_zone b/test/sys/kernel/slab/kmalloc-4096/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-4096/sanity_checks b/test/sys/kernel/slab/kmalloc-4096/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-4096/shrink b/test/sys/kernel/slab/kmalloc-4096/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-4096/slab_size b/test/sys/kernel/slab/kmalloc-4096/slab_size deleted file mode 100644 index eaa5ead980..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/slab_size +++ /dev/null @@ -1 +0,0 @@ -4168 diff --git a/test/sys/kernel/slab/kmalloc-4096/slabs b/test/sys/kernel/slab/kmalloc-4096/slabs deleted file mode 100644 index c3f407c095..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/slabs +++ /dev/null @@ -1 +0,0 @@ -55 diff --git a/test/sys/kernel/slab/kmalloc-4096/store_user b/test/sys/kernel/slab/kmalloc-4096/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-4096/total_objects b/test/sys/kernel/slab/kmalloc-4096/total_objects deleted file mode 100644 index df90c3c76c..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/total_objects +++ /dev/null @@ -1 +0,0 @@ -385 diff --git a/test/sys/kernel/slab/kmalloc-4096/trace b/test/sys/kernel/slab/kmalloc-4096/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-4096/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-4096/validate b/test/sys/kernel/slab/kmalloc-4096/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-512/aliases b/test/sys/kernel/slab/kmalloc-512/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-512/align b/test/sys/kernel/slab/kmalloc-512/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-512/alloc_calls b/test/sys/kernel/slab/kmalloc-512/alloc_calls deleted file mode 100644 index bfbfb0327d..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/alloc_calls +++ /dev/null @@ -1,52 +0,0 @@ - 14 __register_sysctl_paths+0x56/0x340 age=8360125/8372514/8379788 pid=1-1549 cpus=0 - 14 param_sysfs_setup+0x87/0x140 age=8355309/8375663/8379919 pid=1-1813 cpus=0-1 - 59 module_add_modinfo_attrs+0x25/0xf0 age=8303025/8368384/8376264 pid=105-2754 cpus=0-1 - 2 __vmalloc_area_node+0xfb/0x140 age=8374650/8375296/8375942 pid=126-144 cpus=0 - 1 dma_kmalloc_cache+0xca/0x150 age=8375776 pid=163 cpus=0 - 107 kmem_cache_create+0x4e/0x2e0 age=8360130/8377702/8380056 pid=0-1549 cpus=0-1 - 2 __percpu_alloc_mask+0xbc/0x140 age=8379768/8379768/8379768 pid=1 cpus=1 - 17 sys_inotify_init1+0xaa/0x220 age=8333709/8350157/8376641 pid=72-2544 cpus=0-1 - 4 sys_epoll_create1+0x41/0x100 age=2416994/6871289/8356805 pid=1690-20296 cpus=0-1 - 2 __crypto_alloc_tfm+0x43/0x1b0 age=8373592/8373592/8373592 pid=126 cpus=1 - 1 crypto_alloc_instance+0x2b/0xe0 age=8373592 pid=745 cpus=0 - 3 elevator_alloc+0x67/0xc0 age=62000/5606780/8379335 pid=1-13295 cpus=0-1 - 3 cfq_init_queue+0x1b/0x120 age=62000/5606780/8379335 pid=1-13295 cpus=0-1 - 1 fb_alloc_cmap+0x66/0x150 age=8379756 pid=1 cpus=1 - 1 fb_alloc_cmap+0x81/0x150 age=8379756 pid=1 cpus=1 - 1 fb_alloc_cmap+0x9c/0x150 age=8379756 pid=1 cpus=1 - 1 fbcon_startup+0xd6/0x2f0 age=8379755 pid=1 cpus=1 - 1 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379896 pid=1 cpus=0 - 1 make_acpi_ec+0x1a/0xcb age=8379913 pid=1 cpus=0 - 1 acpi_irq_stats_init+0x83/0x268 age=8379913 pid=1 cpus=0 - 1 acpi_irq_stats_init+0xa7/0x268 age=8379913 pid=1 cpus=0 - 5 alloc_tty_driver+0x1c/0x40 age=8309091/8365595/8379725 pid=1-2711 cpus=1 - 2 vt_ioctl+0x1874/0x1c30 age=8356613/8356613/8356613 pid=1703 cpus=0 - 8 set_inverse_transl+0xa0/0xb0 age=8355024/8367389/8379755 pid=1-1898 cpus=1 - 2 con_clear_unimap+0x2a/0xd0 age=8355024/8367389/8379755 pid=1-1898 cpus=1 - 7 vc_allocate+0x99/0x1b0 age=8356563/8358748/8368241 pid=1135-1729 cpus=0-1 - 1 hpet_alloc+0x6b/0x3c0 age=8379798 pid=1 cpus=0 - 4 uart_open+0x36c/0x4b0 age=8368845/8368914/8369120 pid=1059-1073 cpus=0-1 - 43 bus_add_driver+0x4f/0x280 age=8303025/8373842/8379841 pid=1-2754 cpus=0-1 - 9 bus_register+0x35/0x290 age=8373434/8378695/8379923 pid=1-770 cpus=0-1 - 30 __class_register+0x28/0x1e0 age=8374523/8378099/8379922 pid=1-352 cpus=0-1 - 1 mousedev_open+0xc8/0x1d0 age=8354269 pid=1738 cpus=0 - 1 cpufreq_add_dev+0x8f/0x5c0 age=8366381 pid=1358 cpus=0 - 4 sock_alloc_send_skb+0x1cd/0x200 age=8330763/8342704/8350746 pid=1738 cpus=0-1 - 1 alloc_netdev_mq+0x6c/0x180 age=8373712 pid=126 cpus=1 - 4 inetdev_init+0x28/0x190 age=8373592/8375784/8379779 pid=1-126 cpus=0-1 - 2 fib_hash_table+0x1c/0x80 age=8379779/8379779/8379779 pid=1 cpus=0 - 1 ioapic_init_sysfs+0x74/0xcf age=8379769 pid=1 cpus=1 - 3 snd_malloc_sgbuf_pages+0xbe/0x1f0 [snd_page_alloc] age=8374119/8374119/8374119 pid=107 cpus=1 - 1 usb_get_configuration+0x18f/0x1480 [usbcore] age=22677 pid=419 cpus=0 - 1 usb_get_configuration+0x5f2/0x1480 [usbcore] age=8372692 pid=419 cpus=0 - 2 acpi_processor_get_throttling_info+0x21f/0x58c [processor] age=8375662/8375686/8375710 pid=330 cpus=0 - 48 snd_info_create_entry+0x1b/0xa0 [snd] age=8355304/8371157/8374867 pid=107-1813 cpus=0-1 - 4 snd_timer_new+0x40/0x190 [snd_timer] age=8374097/8374262/8374757 pid=107 cpus=1 - 2 ieee80211_key_alloc+0x37/0xe0 [mac80211] age=3544694/3544694/3544694 pid=1545 cpus=0 - 3 snd_pcm_new_stream+0x161/0x520 [snd_pcm] age=8374119/8374119/8374119 pid=107 cpus=1 - 1 snd_hda_bus_new+0x31/0xf4 [snd_hda_intel] age=8374122 pid=107 cpus=1 - 1 crypto_blkcipher_type+0x54/0xffffffffffffff8e [crypto_blkcipher] age=8374450 pid=215 cpus=0 - 1 md_import_device+0x32/0x290 [md_mod] age=8370110 pid=916 cpus=0 - 1 bitmap_create+0x5e/0xad0 [md_mod] age=8370066 pid=916 cpus=0 - 1 run+0x42/0x500 [raid1] age=8370068 pid=916 cpus=0 - 1 ip6_route_net_init+0x4d/0xd0 [ipv6] age=8360130 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-512/cache_dma b/test/sys/kernel/slab/kmalloc-512/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-512/cpu_slabs b/test/sys/kernel/slab/kmalloc-512/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-512/ctor b/test/sys/kernel/slab/kmalloc-512/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-512/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-512/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-512/free_calls b/test/sys/kernel/slab/kmalloc-512/free_calls deleted file mode 100644 index 088fbc7448..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/free_calls +++ /dev/null @@ -1,10 +0,0 @@ - 163 age=4303047353 pid=0 cpus=0 - 4 __vunmap+0xe9/0x120 age=8374515/8375319/8376179 pid=122-215 cpus=0 - 1 kmem_cache_shrink+0x5d/0x1b0 age=8379872 pid=1 cpus=0 - 33 load_elf_binary+0xa7e/0x1e20 age=8303117/8365402/8377217 pid=62-2754 cpus=0-1 - 19 load_elf_binary+0xc37/0x1e20 age=8355044/8370854/8376371 pid=197-1912 cpus=0-1 - 1 crypto_larval_destroy+0x2b/0x40 age=8373593 pid=126 cpus=1 - 210 skb_release_data+0x85/0xd0 age=22792/8177097/8379923 pid=1-20296 cpus=0-1 - 1 acpi_processor_get_power_info+0x2eb/0x569 [processor] age=8375661 pid=330 cpus=1 - 1 skcipher_geniv_alloc+0xea/0x3f0 [crypto_blkcipher] age=8374478 pid=215 cpus=0 - 1 snd_mixer_oss_build_input+0x402/0x5c0 [snd_mixer_oss] age=8355509 pid=1813 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-512/hwcache_align b/test/sys/kernel/slab/kmalloc-512/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-512/object_size b/test/sys/kernel/slab/kmalloc-512/object_size deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/object_size +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/kernel/slab/kmalloc-512/objects b/test/sys/kernel/slab/kmalloc-512/objects deleted file mode 100644 index 6a13cf62b5..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/objects +++ /dev/null @@ -1 +0,0 @@ -443 diff --git a/test/sys/kernel/slab/kmalloc-512/objects_partial b/test/sys/kernel/slab/kmalloc-512/objects_partial deleted file mode 100644 index 85322d0b54..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/objects_partial +++ /dev/null @@ -1 +0,0 @@ -79 diff --git a/test/sys/kernel/slab/kmalloc-512/objs_per_slab b/test/sys/kernel/slab/kmalloc-512/objs_per_slab deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/kmalloc-512/order b/test/sys/kernel/slab/kmalloc-512/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-512/partial b/test/sys/kernel/slab/kmalloc-512/partial deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/partial +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/kernel/slab/kmalloc-512/poison b/test/sys/kernel/slab/kmalloc-512/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-512/reclaim_account b/test/sys/kernel/slab/kmalloc-512/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-512/red_zone b/test/sys/kernel/slab/kmalloc-512/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-512/sanity_checks b/test/sys/kernel/slab/kmalloc-512/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-512/shrink b/test/sys/kernel/slab/kmalloc-512/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-512/slab_size b/test/sys/kernel/slab/kmalloc-512/slab_size deleted file mode 100644 index af368af278..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/slab_size +++ /dev/null @@ -1 +0,0 @@ -584 diff --git a/test/sys/kernel/slab/kmalloc-512/slabs b/test/sys/kernel/slab/kmalloc-512/slabs deleted file mode 100644 index 7facc89938..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/slabs +++ /dev/null @@ -1 +0,0 @@ -36 diff --git a/test/sys/kernel/slab/kmalloc-512/store_user b/test/sys/kernel/slab/kmalloc-512/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-512/total_objects b/test/sys/kernel/slab/kmalloc-512/total_objects deleted file mode 100644 index 3091e8eea2..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/total_objects +++ /dev/null @@ -1 +0,0 @@ -504 diff --git a/test/sys/kernel/slab/kmalloc-512/trace b/test/sys/kernel/slab/kmalloc-512/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-512/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-512/validate b/test/sys/kernel/slab/kmalloc-512/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-64/aliases b/test/sys/kernel/slab/kmalloc-64/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/align b/test/sys/kernel/slab/kmalloc-64/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-64/alloc_calls b/test/sys/kernel/slab/kmalloc-64/alloc_calls deleted file mode 100644 index 2dfc805081..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/alloc_calls +++ /dev/null @@ -1,51 +0,0 @@ - 30 alternatives_smp_module_add+0x81/0x160 age=8303055/8368397/8380085 pid=0-2754 cpus=0-1 - 39 __request_region+0x39/0x120 age=8373811/8378273/8379949 pid=1-352 cpus=0-1 - 1 audit_log_start+0x353/0x3f0 age=8379797 pid=1 cpus=1 - 16 request_irq+0x9a/0xf0 age=8356279/8374005/8379942 pid=1-1541 cpus=0-1 - 3 devm_request_irq+0x4b/0xc0 age=8379232/8379403/8379747 pid=1 cpus=0-1 - 1 strndup_user+0x6d/0xc0 age=8374545 pid=215 cpus=0 - 95 __get_vm_area_node+0x9b/0x220 age=8303058/8371551/8380085 pid=0-2754 cpus=0-1 - 17 __vmalloc_area_node+0xfb/0x140 age=8309125/8366469/8376299 pid=105-2711 cpus=0-1 - 1 add_swap_extent+0x57/0xc0 age=8372039 pid=867 cpus=0 - 33 dma_pool_alloc+0x6d/0x200 age=8309120/8340771/8374904 pid=143-2711 cpus=0-1 - 40 alloc_kmem_cache_cpu+0x81/0x90 age=8360159/8368022/8379787 pid=1-1549 cpus=0-1 - 164 __percpu_alloc_mask+0x52/0x140 age=61997/8067718/8380085 pid=0-13295 cpus=0-1 - 184 __percpu_alloc_mask+0xbc/0x140 age=62029/8100825/8380085 pid=0-13295 cpus=0-1 - 604 d_alloc+0x19d/0x1f0 age=22685/7859083/8376462 pid=72-24701 cpus=0-1 - 17 alloc_fdtable+0x57/0x160 age=4267/6101781/8357279 pid=1532-12336 cpus=0-1 - 17 alloc_fdtable+0xb4/0x160 age=4267/6101781/8357279 pid=1532-12336 cpus=0-1 - 1 bioset_create+0x21/0xc0 age=8379947 pid=1 cpus=0 - 1 bd_claim_by_disk+0x6f/0x270 age=8370131 pid=916 cpus=0 - 14 posix_acl_alloc+0x1b/0x30 age=53326/7759393/8352180 pid=2175-13390 cpus=0-1 - 5 proc_reg_open+0x3f/0x170 age=8355799/8361268/8366755 pid=1327-1738 cpus=0 - 12754 ext3_init_block_alloc_info+0x22/0x80 age=1/498494/8368528 pid=1-23373 cpus=0-1 - 4 ext3_readdir+0x617/0x650 age=8352064/8352079/8352114 pid=1370 cpus=0 - 8 ext3_htree_store_dirent+0x37/0x130 age=8352064/8352072/8352099 pid=1370 cpus=0 - 277 kobject_create+0x1a/0x40 age=22618/7771015/8380085 pid=0-13295 cpus=0-1 - 1 pci_create_sysfs_dev_files+0x23e/0x3b0 age=8378937 pid=1 cpus=0 - 11 acpi_os_validate_address+0x3d/0xa3 age=8379914/8379927/8379932 pid=1 cpus=0 - 124 acpi_ds_build_internal_package_obj+0xaf/0x1df age=3847484/8233379/8379936 pid=1-330 cpus=0 - 6 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379920/8379925/8379934 pid=1 cpus=0 - 1 acpi_ev_system_memory_region_setup+0x68/0x8f age=8379914 pid=1 cpus=0 - 3 acpi_add_single_object+0x596/0xd3c age=8379878/8379880/8379882 pid=1 cpus=0 - 3 acpi_add_single_object+0x5d8/0xd3c age=8379886/8379888/8379890 pid=1 cpus=0 - 27 acpi_add_single_object+0x9f7/0xd3c age=8379871/8379888/8379900 pid=1 cpus=0 - 55 acpi_ec_add_query_handler+0x31/0x91 age=8379870/8379870/8379870 pid=1 cpus=0 - 1 find_dock+0x2c9/0x426 age=8379950 pid=1 cpus=0 - 6 find_dock_devices+0x5e/0x92 age=8379950/8379950/8379950 pid=1 cpus=0 - 8 acpi_pci_link_add+0x32/0x1db age=8379843/8379844/8379846 pid=1 cpus=0 - 39 acpi_pci_irq_add_prt+0x181/0x324 age=8379862/8379863/8379865 pid=1 cpus=0 - 15 init_dev+0x3c8/0x6f0 age=7217158/8282400/8378180 pid=33-2593 cpus=0-1 - 15 init_dev+0x437/0x6f0 age=7217158/8282400/8378180 pid=33-2593 cpus=0-1 - 3 init_dev+0x5b2/0x6f0 age=7217158/7969269/8364358 pid=1258-2593 cpus=0-1 - 3 init_dev+0x637/0x6f0 age=7217158/7969269/8364358 pid=1258-2593 cpus=0-1 - 2 kobj_map_init+0x36/0xa0 age=8379947/8380016/8380085 pid=0-1 cpus=0 - 38 kobj_map+0x79/0x1a0 age=61997/7936136/8379947 pid=1-13295 cpus=0-1 - 3 dmam_alloc_coherent+0x3f/0xa0 age=8379232/8379403/8379747 pid=1 cpus=0-1 - 1 scsi_probe_and_add_lun+0x65e/0xd80 age=62028 pid=13295 cpus=0 - 170 scsi_dev_info_list_add+0x3d/0x120 age=8379831/8379831/8379831 pid=1 cpus=0 - 1 ahci_init_one+0x137/0xcb0 age=8379748 pid=1 cpus=1 - 1 cpufreq_stat_notifier_policy+0xa1/0x2e0 age=8366410 pid=1358 cpus=0 - 1 cpufreq_stat_notifier_policy+0x17e/0x2e0 age=8366410 pid=1358 cpus=0 - 1 hid_parse_report+0xa9/0x2c0 age=53512 pid=419 cpus=0 - 10 __dev_addr_add+0x69/0xe0 age=8325501/8345496/8360156 pid=8-1849 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-64/cache_dma b/test/sys/kernel/slab/kmalloc-64/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/cpu_slabs b/test/sys/kernel/slab/kmalloc-64/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/ctor b/test/sys/kernel/slab/kmalloc-64/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-64/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-64/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/free_calls b/test/sys/kernel/slab/kmalloc-64/free_calls deleted file mode 100644 index 655e3c895c..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/free_calls +++ /dev/null @@ -1,49 +0,0 @@ - 13029 age=4303047386 pid=0 cpus=0 - 1 iounmap+0xc2/0x100 age=8379917 pid=1 cpus=0 - 1 memtype_get_idx+0x75/0xc0 age=782 pid=13466 cpus=0 - 2 __release_region+0xc6/0xd0 age=8379754/8379754/8379754 pid=1 cpus=1 - 3 __request_region+0x86/0x120 age=8379828/8379828/8379828 pid=1 cpus=0 - 1 generic_smp_call_function_single_interrupt+0xce/0xe0 age=8355499 pid=0 cpus=1 - 53 __stop_machine+0x216/0x220 age=8303059/8367652/8376299 pid=105-2754 cpus=0-1 - 2 free_irq+0xef/0x190 age=8356302/8367658/8379015 pid=1-1541 cpus=0 - 28 __vunmap+0xcd/0x120 age=8309125/8366969/8376298 pid=105-2711 cpus=0-1 - 8 __vunmap+0xe9/0x120 age=8328457/8364062/8376068 pid=107-2578 cpus=0-1 - 1 percpu_free+0x2d/0x60 age=61987 pid=13295 cpus=0 - 10 do_sys_poll+0x32b/0x450 age=61481/7500944/8334758 pid=1333-2262 cpus=0-1 - 187 d_callback+0x22/0x40 age=22704/7997936/8376459 pid=0-2156 cpus=0-1 - 198 free_fdtable_rcu+0x7a/0xb0 age=1292/3883175/8376371 pid=0-13456 cpus=0-1 - 224 free_fdtable_rcu+0x82/0xb0 age=1292/3491449/8377150 pid=0-13456 cpus=0-1 - 42 proc_reg_release+0x96/0x120 age=3564/7013222/8376067 pid=126-2586 cpus=0-1 - 50 proc_reg_open+0x138/0x170 age=656297/2956669/8367924 pid=1184-12336 cpus=0-1 - 1046 free_rb_tree_fname+0x5c/0xb0 age=5905/4315279/8376402 pid=102-24701 cpus=0-1 - 79 ext3_htree_free_dir_info+0x19/0x20 age=5905/6235661/8376402 pid=102-24701 cpus=0-1 - 26 ext3_clear_inode+0xa5/0xb0 age=12954/2421572/8354304 pid=1253-8445 cpus=0-1 - 1 dynamic_kobj_release+0x2c/0x40 age=8356191 pid=1541 cpus=0 - 66 kobject_uevent_env+0x11a/0x470 age=22624/7608199/8379955 pid=1-2711 cpus=0-1 - 16 acpi_ds_call_control_method+0xfe/0x180 age=3020/4710292/8379848 pid=1-13466 cpus=0-1 - 1 acpi_ev_execute_reg_method+0x129/0x13a age=8379946 pid=1 cpus=0 - 1 acpi_ev_asynch_execute_gpe_method+0xcc/0x119 age=8379905 pid=12 cpus=1 - 33 acpi_evaluate_object+0x1ea/0x1fc age=3015/5838124/8379955 pid=1-13466 cpus=0-1 - 4 acpi_get_object_info+0x1c4/0x1d4 age=8379876/8379888/8379895 pid=1 cpus=0 - 1 acpi_walk_resources+0xa4/0xbd age=8379755 pid=1 cpus=1 - 41 acpi_ut_evaluate_object+0x18d/0x19b age=8379223/8379861/8379919 pid=1 cpus=0-1 - 4 acpi_ut_delete_internal_obj+0x15f/0x16f age=8366416/8373412/8375744 pid=330-1358 cpus=0 - 7 acpi_bus_get_ejd+0x73/0x80 age=8379955/8379955/8379955 pid=1 cpus=0 - 11 pnp_show_options+0x459/0x600 age=1578/1602/1627 pid=13466 cpus=0 - 11 pnp_show_current_resources+0x16f/0x180 age=1578/1603/1628 pid=13466 cpus=0 - 19 release_one_tty+0x53/0x190 age=804540/7566113/8370327 pid=55-2106 cpus=0-1 - 24 release_one_tty+0x60/0x190 age=804540/7729452/8370327 pid=55-2141 cpus=0-1 - 6 release_one_tty+0x167/0x190 age=8352429/8353224/8354794 pid=1967-2141 cpus=0 - 4 devres_remove_group+0x9e/0xe0 age=8379026/8379313/8379753 pid=1 cpus=0-1 - 1 ata_acpi_on_devcfg+0x385/0x6a0 age=8379406 pid=25 cpus=0 - 3 serio_free_event+0x1d/0x30 age=8378463/8378812/8378999 pid=17 cpus=0-1 - 6 input_register_device+0x17c/0x230 age=53514/6988336/8378983 pid=17-803 cpus=0-1 - 1 ip_cork_release+0x1f/0x50 age=8333854 pid=2536 cpus=1 - 1 unix_sock_destructor+0x75/0xd0 age=7217178 pid=2344 cpus=0 - 13 huft_free+0x1e/0x2f age=8379804/8379804/8379804 pid=1 cpus=0 - 6 hub_port_init+0x522/0x740 [usbcore] age=22825/4210550/8374275 pid=419 cpus=0-1 - 1 usb_release_interface_cache+0x2c/0x60 [usbcore] age=8373868 pid=419 cpus=0 - 1 usb_release_interface_cache+0x47/0x60 [usbcore] age=8373868 pid=419 cpus=0 - 1 __param_str_act+0x16c/0xfffffffffffffb13 [thermal] age=8375113 pid=383 cpus=0 - 3 snd_card_file_remove+0x73/0x130 [snd] age=8333050/8337203/8339297 pid=2400-2425 cpus=0 - 2 hid_probe+0x222/0xf30 [usbhid] age=53517/4212911/8372306 pid=419-803 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-64/hwcache_align b/test/sys/kernel/slab/kmalloc-64/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/object_size b/test/sys/kernel/slab/kmalloc-64/object_size deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/object_size +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/kernel/slab/kmalloc-64/objects b/test/sys/kernel/slab/kmalloc-64/objects deleted file mode 100644 index 4fea1d9b43..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/objects +++ /dev/null @@ -1 +0,0 @@ -15300 diff --git a/test/sys/kernel/slab/kmalloc-64/objects_partial b/test/sys/kernel/slab/kmalloc-64/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/objs_per_slab b/test/sys/kernel/slab/kmalloc-64/objs_per_slab deleted file mode 100644 index 64bb6b746d..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -30 diff --git a/test/sys/kernel/slab/kmalloc-64/order b/test/sys/kernel/slab/kmalloc-64/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/partial b/test/sys/kernel/slab/kmalloc-64/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/poison b/test/sys/kernel/slab/kmalloc-64/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-64/reclaim_account b/test/sys/kernel/slab/kmalloc-64/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/red_zone b/test/sys/kernel/slab/kmalloc-64/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-64/sanity_checks b/test/sys/kernel/slab/kmalloc-64/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-64/shrink b/test/sys/kernel/slab/kmalloc-64/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-64/slab_size b/test/sys/kernel/slab/kmalloc-64/slab_size deleted file mode 100644 index 7296f257eb..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/slab_size +++ /dev/null @@ -1 +0,0 @@ -136 diff --git a/test/sys/kernel/slab/kmalloc-64/slabs b/test/sys/kernel/slab/kmalloc-64/slabs deleted file mode 100644 index 2bc4cd64b8..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/slabs +++ /dev/null @@ -1 +0,0 @@ -510 diff --git a/test/sys/kernel/slab/kmalloc-64/store_user b/test/sys/kernel/slab/kmalloc-64/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-64/total_objects b/test/sys/kernel/slab/kmalloc-64/total_objects deleted file mode 100644 index 4fea1d9b43..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/total_objects +++ /dev/null @@ -1 +0,0 @@ -15300 diff --git a/test/sys/kernel/slab/kmalloc-64/trace b/test/sys/kernel/slab/kmalloc-64/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-64/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-64/validate b/test/sys/kernel/slab/kmalloc-64/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-8/aliases b/test/sys/kernel/slab/kmalloc-8/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/align b/test/sys/kernel/slab/kmalloc-8/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-8/alloc_calls b/test/sys/kernel/slab/kmalloc-8/alloc_calls deleted file mode 100644 index e9e0bf6eb3..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/alloc_calls +++ /dev/null @@ -1,32 +0,0 @@ - 1 cache_k8_northbridges+0x5f/0x130 age=8379864 pid=1 cpus=0 - 1 pm_qos_add_requirement+0x51/0xe0 age=8376100 pid=122 cpus=1 - 5 setup_modinfo_version+0x19/0x30 age=8355991/8370769/8376336 pid=169-1766 cpus=0-1 - 379 load_module+0x1ac4/0x1b30 age=8303091/8368856/8376330 pid=105-2754 cpus=0-1 - 57 strndup_user+0x6d/0xc0 age=8303095/8368234/8376336 pid=105-2754 cpus=0-1 - 4 krealloc+0x1e/0x60 age=8355270/8362240/8377141 pid=71-1849 cpus=0-1 - 5 __vmalloc_area_node+0xfb/0x140 age=8373659/8374450/8375164 pid=181-754 cpus=0-1 - 17 alloc_vfsmnt+0x97/0x180 age=8354102/8377143/8380122 pid=0-2064 cpus=0-1 - 1 proc_symlink+0x4d/0xb0 age=8374163 pid=107 cpus=1 - 1954 sysfs_new_dirent+0x10c/0x120 age=22655/7531182/8380122 pid=0-13295 cpus=0-1 - 690 kvasprintf+0x55/0x90 age=22668/7820060/8380122 pid=0-13295 cpus=0-1 - 1 proc_bus_pci_open+0x1d/0x50 age=8355838 pid=1738 cpus=0 - 5 pcie_port_device_register+0x25/0x4a0 age=8379822/8379823/8379824 pid=1 cpus=1 - 19 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379961/8379970/8379972 pid=1 cpus=0 - 9 acpi_ev_pci_config_region_setup+0x162/0x270 age=8379256/8379854/8379947 pid=1-12 cpus=0-1 - 2 acpi_ut_copy_simple_object+0x8f/0x11c age=8375678/8375686/8375694 pid=396 cpus=0 - 35 acpi_irq_stats_init+0x1bd/0x268 age=8379979/8379979/8379979 pid=1 cpus=0 - 8 neigh_sysctl_register+0x1cd/0x330 age=8360192/8368781/8379845 pid=1-1549 cpus=0-1 - 7 netlink_kernel_create+0xab/0x1a0 age=8378987/8379768/8379988 pid=1 cpus=0-1 - 5 __devinet_sysctl_register+0xb8/0x120 age=8373658/8377862/8379845 pid=1-126 cpus=0-1 - 1 fz_hash_alloc+0x4a/0x60 age=8324525 pid=1541 cpus=0 - 1 init_vdso_vars+0x4c/0x24a age=8379835 pid=1 cpus=1 - 30 netlink_proto_init+0xf1/0x16b age=8379988/8379988/8379988 pid=1 cpus=0 - 5 hub_probe+0x20b/0x820 [usbcore] age=8374075/8374568/8374921 pid=143-147 cpus=0-1 - 3 usb_cache_string+0x65/0xa0 [usbcore] age=22742/37518/67072 pid=419 cpus=0 - 10 usb_get_configuration+0xbd/0x1480 [usbcore] age=22743/5876145/8374941 pid=143-419 cpus=0-1 - 35 snd_info_create_entry+0x30/0xa0 [snd] age=8355370/8370655/8374933 pid=107-1813 cpus=0-1 - 1 async_chainiv_givencrypt_first+0x56/0x80 [crypto_blkcipher] age=8374580 pid=215 cpus=0 - 1 md_seq_open+0x2d/0x90 [md_mod] age=8366135 pid=1371 cpus=0 - 1 bitmap_create+0x3aa/0xad0 [md_mod] age=8370125 pid=916 cpus=0 - 5 __addrconf_sysctl_register+0xcd/0x140 [ipv6] age=8360192/8360193/8360195 pid=1549 cpus=0 - 1 fib6_net_init+0x5d/0x130 [ipv6] age=8360195 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-8/cache_dma b/test/sys/kernel/slab/kmalloc-8/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/cpu_slabs b/test/sys/kernel/slab/kmalloc-8/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/ctor b/test/sys/kernel/slab/kmalloc-8/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-8/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-8/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/free_calls b/test/sys/kernel/slab/kmalloc-8/free_calls deleted file mode 100644 index dcd65da84f..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/free_calls +++ /dev/null @@ -1,25 +0,0 @@ - 2657 age=4303047420 pid=0 cpus=0 - 3 free_sect_attrs+0x2e/0x50 age=8375066/8375066/8375066 pid=383 cpus=0 - 6 load_module+0x73f/0x1b30 age=8374844/8375309/8376003 pid=143-332 cpus=0-1 - 1 free_module+0xb9/0xf0 age=8375066 pid=383 cpus=0 - 1 krealloc+0x3a/0x60 age=8375814 pid=330 cpus=0 - 41 __vunmap+0xe9/0x120 age=8355636/8372979/8376319 pid=105-1805 cpus=0-1 - 1 vfs_rename+0x301/0x450 age=8367176 pid=72 cpus=1 - 254 release_sysfs_dirent+0x8c/0xd0 age=125751/7762571/8379789 pid=1-3347 cpus=0-1 - 61 kobject_release+0xe1/0x140 age=125751/6939731/8378264 pid=1-3347 cpus=0-1 - 1 match_number+0x95/0xb0 age=8335823 pid=2476 cpus=0 - 2 proc_bus_pci_release+0x18/0x30 age=8355841/8356005/8356169 pid=1738 cpus=0 - 49 acpi_ds_create_operand+0x12c/0x209 age=125757/8029619/8379980 pid=1-1442 cpus=0-1 - 128 acpi_ns_get_node+0x92/0xa1 age=8366449/8379363/8379989 pid=1-1358 cpus=0-1 - 2 acpi_ut_delete_internal_obj+0x15f/0x16f age=8375669/8375730/8375792 pid=330-396 cpus=0 - 2 module_add_driver+0x66/0xd0 age=8375989/8375992/8375996 pid=144 cpus=0 - 2 sd_media_changed+0xca/0x210 age=7839601/7929600/8019600 pid=2796 cpus=0 - 3 get_modalias+0xd4/0x120 age=8355846/8370834/8379988 pid=1-1772 cpus=0-1 - 1 fib_hash_free+0x35/0x40 age=8367910 pid=1185 cpus=0 - 1 usb_release_dev+0x39/0x70 [usbcore] age=7833240 pid=419 cpus=1 - 2 usb_release_dev+0x45/0x70 [usbcore] age=7833240/7835719/7838199 pid=419 cpus=0-1 - 4 sg_clean+0x3e/0x80 [usbcore] age=62037/2121033/8297977 pid=2760-13294 cpus=0 - 59 usb_control_msg+0xef/0x110 [usbcore] age=22658/5520135/8374943 pid=143-419 cpus=0-1 - 7 usb_set_configuration+0x338/0x5f0 [usbcore] age=53566/5999072/8374935 pid=143-419 cpus=0-1 - 4 usb_destroy_configuration+0x78/0x140 [usbcore] age=7824401/7967435/8373902 pid=419 cpus=0-1 - 7 sr_media_change+0xeb/0x2a0 [sr_mod] age=53597/5984195/8374963 pid=558-1456 cpus=0-1 diff --git a/test/sys/kernel/slab/kmalloc-8/hwcache_align b/test/sys/kernel/slab/kmalloc-8/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/object_size b/test/sys/kernel/slab/kmalloc-8/object_size deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/object_size +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-8/objects b/test/sys/kernel/slab/kmalloc-8/objects deleted file mode 100644 index ff121853a0..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/objects +++ /dev/null @@ -1 +0,0 @@ -3366 diff --git a/test/sys/kernel/slab/kmalloc-8/objects_partial b/test/sys/kernel/slab/kmalloc-8/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/objs_per_slab b/test/sys/kernel/slab/kmalloc-8/objs_per_slab deleted file mode 100644 index 82cced27d7..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -51 diff --git a/test/sys/kernel/slab/kmalloc-8/order b/test/sys/kernel/slab/kmalloc-8/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/partial b/test/sys/kernel/slab/kmalloc-8/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/poison b/test/sys/kernel/slab/kmalloc-8/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-8/reclaim_account b/test/sys/kernel/slab/kmalloc-8/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/red_zone b/test/sys/kernel/slab/kmalloc-8/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-8/sanity_checks b/test/sys/kernel/slab/kmalloc-8/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-8/shrink b/test/sys/kernel/slab/kmalloc-8/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-8/slab_size b/test/sys/kernel/slab/kmalloc-8/slab_size deleted file mode 100644 index d15a2cc44e..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/slab_size +++ /dev/null @@ -1 +0,0 @@ -80 diff --git a/test/sys/kernel/slab/kmalloc-8/slabs b/test/sys/kernel/slab/kmalloc-8/slabs deleted file mode 100644 index 69a893aa31..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/slabs +++ /dev/null @@ -1 +0,0 @@ -66 diff --git a/test/sys/kernel/slab/kmalloc-8/store_user b/test/sys/kernel/slab/kmalloc-8/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-8/total_objects b/test/sys/kernel/slab/kmalloc-8/total_objects deleted file mode 100644 index ff121853a0..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/total_objects +++ /dev/null @@ -1 +0,0 @@ -3366 diff --git a/test/sys/kernel/slab/kmalloc-8/trace b/test/sys/kernel/slab/kmalloc-8/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-8/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-8/validate b/test/sys/kernel/slab/kmalloc-8/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-96/aliases b/test/sys/kernel/slab/kmalloc-96/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-96/align b/test/sys/kernel/slab/kmalloc-96/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc-96/alloc_calls b/test/sys/kernel/slab/kmalloc-96/alloc_calls deleted file mode 100644 index ecc95e9d76..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/alloc_calls +++ /dev/null @@ -1,39 +0,0 @@ - 5 sched_create_group+0x1f/0x220 age=8351870/8359354/8366881 pid=1333-2177 cpus=0-1 - 10 __register_sysctl_paths+0x56/0x340 age=8370387/8378535/8379888 pid=1-901 cpus=0-1 - 15 __create_workqueue_key+0x31/0x290 age=8370409/8377818/8380009 pid=1-900 cpus=0-1 - 59 load_module+0x19c0/0x1b30 age=8303111/8368469/8376350 pid=105-2754 cpus=0-1 - 5 __vmalloc_area_node+0xfb/0x140 age=8355400/8371519/8376226 pid=147-1813 cpus=0 - 22 __register_chrdev_region+0x2d/0x1a0 age=8309177/8375269/8380004 pid=1-2711 cpus=0-1 - 1 do_sys_poll+0xdb/0x450 age=9671 pid=2262 cpus=1 - 98 d_alloc+0x19d/0x1f0 age=22395/7516545/8376320 pid=317-13453 cpus=0-1 - 8 sys_eventfd2+0x51/0xb0 age=8339333/8339377/8339421 pid=2400 cpus=0 - 1 mb_cache_create+0x62/0x1f0 age=8379846 pid=1 cpus=1 - 9 sysfs_setattr+0x19a/0x1f0 age=61999/6511912/8377277 pid=63-13308 cpus=0-1 - 1 sysfs_open_file+0x1c5/0x230 age=0 pid=13466 cpus=0 - 17 copy_semundo+0x71/0xc0 age=3847042/8077586/8366263 pid=1370-2590 cpus=0-1 - 2 __crypto_alloc_tfm+0x43/0x1b0 age=8373678/8373678/8373678 pid=126 cpus=1 - 2 pcim_iomap_table+0x45/0x60 age=8379289/8379547/8379805 pid=1 cpus=0-1 - 26 pci_create_attr+0x3d/0x140 age=8378994/8378994/8378995 pid=1 cpus=0 - 8 pci_enable_msi+0xb1/0x2b0 age=8356336/8373963/8379844 pid=1-1541 cpus=0-1 - 1 fb_add_videomode+0x89/0xf0 age=8379841 pid=1 cpus=1 - 1 soft_cursor+0x92/0x220 age=8379841 pid=1 cpus=1 - 20 acpi_os_create_semaphore+0x36/0xaa age=8379969/8380118/8380142 pid=0-1 cpus=0 - 6 acpi_ds_build_internal_package_obj+0xaf/0x1df age=8379981/8379985/8379993 pid=1 cpus=0 - 2 acpi_ds_build_internal_buffer_obj+0xe1/0x121 age=8379986/8379986/8379987 pid=1 cpus=0 - 1 acpi_ev_create_gpe_block+0x5f/0x3bf age=8379999 pid=1 cpus=0 - 62 pnp_new_resource+0x25/0x60 age=8379891/8379894/8379895 pid=1 cpus=0 - 1 tty_register_driver+0x1b3/0x2a0 age=8379806 pid=1 cpus=1 - 5 kbd_connect+0x4e/0xe0 age=8374352/8375743/8379035 pid=17-341 cpus=0-1 - 17 __class_create+0x3d/0xa0 age=8374616/8377737/8380008 pid=1-215 cpus=0-1 - 2 scsi_probe_and_add_lun+0x65e/0xd80 age=8379084/8379252/8379421 pid=1 cpus=0-1 - 3 inet_rtm_newaddr+0xdb/0x220 age=8325560/8353789/8367912 pid=1197-1541 cpus=0-1 - 2 cache_add_dev+0x7c/0x546 age=8379855/8379855/8379856 pid=1 cpus=0 - 22 kernel_param_sysfs_setup+0x2f/0xc9 age=8380005/8380005/8380005 pid=1 cpus=0 - 15 acpi_system_init+0x12e/0x260 age=8379898/8379898/8379899 pid=1 cpus=0 - 1 pci_mmcfg_insert_resources+0x5d/0x123 age=8378994 pid=1 cpus=0 - 1 0xffffffffa0065104 age=8356008 pid=1766 cpus=0 - 1 bitmap_create+0x373/0xad0 [md_mod] age=8370145 pid=916 cpus=0 - 256 r1bio_pool_alloc+0x2f/0x60 [raid1] age=8370154/8370154/8370154 pid=916 cpus=0 - 8 ip6addrlbl_add+0x75/0x330 [ipv6] age=8360215/8360215/8360215 pid=1549 cpus=0 - 1 ip6_route_net_init+0x22/0xd0 [ipv6] age=8360216 pid=1549 cpus=0 - 6 snd_mixer_oss_build_input+0x431/0x5c0 [snd_mixer_oss] age=8355594/8355594/8355595 pid=1813 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-96/cache_dma b/test/sys/kernel/slab/kmalloc-96/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-96/cpu_slabs b/test/sys/kernel/slab/kmalloc-96/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-96/ctor b/test/sys/kernel/slab/kmalloc-96/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-96/destroy_by_rcu b/test/sys/kernel/slab/kmalloc-96/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-96/free_calls b/test/sys/kernel/slab/kmalloc-96/free_calls deleted file mode 100644 index 5946302537..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/free_calls +++ /dev/null @@ -1,18 +0,0 @@ - 507 age=4303047439 pid=0 cpus=0 - 1 free_notes_attrs+0x4b/0x50 age=8375086 pid=383 cpus=0 - 1 audit_send_list+0x88/0xa0 age=8361087 pid=1538 cpus=1 - 6 __vunmap+0xe9/0x120 age=8309178/8363011/8375091 pid=126-2711 cpus=0-1 - 1 do_sys_poll+0x32b/0x450 age=9672 pid=2262 cpus=1 - 30 d_callback+0x22/0x40 age=22587/7808930/8375651 pid=0-13433 cpus=0-1 - 20 sysfs_release+0x63/0xa0 age=22407/6699376/8376561 pid=165-13453 cpus=0-1 - 1 release_sysfs_dirent+0x22/0xd0 age=8367199 pid=1309 cpus=1 - 116 free_rb_tree_fname+0x5c/0xb0 age=53501/7931736/8376455 pid=163-13373 cpus=0-1 - 7 kobject_uevent_env+0x11a/0x470 age=67088/6542620/8379296 pid=1-419 cpus=0-1 - 1 msi_free_irqs+0xad/0x110 age=8356355 pid=1541 cpus=0 - 1 acpi_os_execute_deferred+0x34/0x39 age=8379958 pid=13 cpus=1 - 1 acpi_walk_resources+0xa4/0xbd age=8379895 pid=1 cpus=0 - 1 acpi_pci_irq_add_prt+0x30b/0x324 age=8379922 pid=1 cpus=0 - 6 scsi_execute_req+0x9f/0xf0 age=8335607/8359788/8379422 pid=1-1456 cpus=0-1 - 9 netlink_destroy_callback+0x21/0x30 age=8325561/8347615/8367913 pid=1197-2527 cpus=0-1 - 12 huft_free+0x1e/0x2f age=8379857/8379857/8379857 pid=1 cpus=0 - 2 r1bio_pool_free+0x9/0x10 [raid1] age=8364428/8364431/8364434 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/kmalloc-96/hwcache_align b/test/sys/kernel/slab/kmalloc-96/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-96/object_size b/test/sys/kernel/slab/kmalloc-96/object_size deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/object_size +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/kmalloc-96/objects b/test/sys/kernel/slab/kmalloc-96/objects deleted file mode 100644 index 611de25367..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/objects +++ /dev/null @@ -1 +0,0 @@ -743 diff --git a/test/sys/kernel/slab/kmalloc-96/objects_partial b/test/sys/kernel/slab/kmalloc-96/objects_partial deleted file mode 100644 index 5595fa46c0..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/objects_partial +++ /dev/null @@ -1 +0,0 @@ -95 diff --git a/test/sys/kernel/slab/kmalloc-96/objs_per_slab b/test/sys/kernel/slab/kmalloc-96/objs_per_slab deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/kmalloc-96/order b/test/sys/kernel/slab/kmalloc-96/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-96/partial b/test/sys/kernel/slab/kmalloc-96/partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/kmalloc-96/poison b/test/sys/kernel/slab/kmalloc-96/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-96/reclaim_account b/test/sys/kernel/slab/kmalloc-96/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-96/red_zone b/test/sys/kernel/slab/kmalloc-96/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-96/sanity_checks b/test/sys/kernel/slab/kmalloc-96/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-96/shrink b/test/sys/kernel/slab/kmalloc-96/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc-96/slab_size b/test/sys/kernel/slab/kmalloc-96/slab_size deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/slab_size +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/kernel/slab/kmalloc-96/slabs b/test/sys/kernel/slab/kmalloc-96/slabs deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/slabs +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/kmalloc-96/store_user b/test/sys/kernel/slab/kmalloc-96/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc-96/total_objects b/test/sys/kernel/slab/kmalloc-96/total_objects deleted file mode 100644 index dc763b654e..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/total_objects +++ /dev/null @@ -1 +0,0 @@ -768 diff --git a/test/sys/kernel/slab/kmalloc-96/trace b/test/sys/kernel/slab/kmalloc-96/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc-96/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc-96/validate b/test/sys/kernel/slab/kmalloc-96/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/aliases b/test/sys/kernel/slab/kmalloc_dma-512/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/align b/test/sys/kernel/slab/kmalloc_dma-512/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/alloc_calls b/test/sys/kernel/slab/kmalloc_dma-512/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/kmalloc_dma-512/cache_dma b/test/sys/kernel/slab/kmalloc_dma-512/cache_dma deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/cache_dma +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs b/test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/ctor b/test/sys/kernel/slab/kmalloc_dma-512/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu b/test/sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/free_calls b/test/sys/kernel/slab/kmalloc_dma-512/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/kmalloc_dma-512/hwcache_align b/test/sys/kernel/slab/kmalloc_dma-512/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/object_size b/test/sys/kernel/slab/kmalloc_dma-512/object_size deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/object_size +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/objects b/test/sys/kernel/slab/kmalloc_dma-512/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/objects_partial b/test/sys/kernel/slab/kmalloc_dma-512/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab b/test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/order b/test/sys/kernel/slab/kmalloc_dma-512/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/partial b/test/sys/kernel/slab/kmalloc_dma-512/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/poison b/test/sys/kernel/slab/kmalloc_dma-512/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/reclaim_account b/test/sys/kernel/slab/kmalloc_dma-512/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/red_zone b/test/sys/kernel/slab/kmalloc_dma-512/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/sanity_checks b/test/sys/kernel/slab/kmalloc_dma-512/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/shrink b/test/sys/kernel/slab/kmalloc_dma-512/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/slab_size b/test/sys/kernel/slab/kmalloc_dma-512/slab_size deleted file mode 100644 index af368af278..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/slab_size +++ /dev/null @@ -1 +0,0 @@ -584 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/slabs b/test/sys/kernel/slab/kmalloc_dma-512/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/store_user b/test/sys/kernel/slab/kmalloc_dma-512/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/total_objects b/test/sys/kernel/slab/kmalloc_dma-512/total_objects deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/total_objects +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/trace b/test/sys/kernel/slab/kmalloc_dma-512/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/kmalloc_dma-512/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/kmalloc_dma-512/validate b/test/sys/kernel/slab/kmalloc_dma-512/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/mm_struct/aliases b/test/sys/kernel/slab/mm_struct/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mm_struct/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mm_struct/align b/test/sys/kernel/slab/mm_struct/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mm_struct/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mm_struct/alloc_calls b/test/sys/kernel/slab/mm_struct/alloc_calls deleted file mode 100644 index ae947e0053..0000000000 --- a/test/sys/kernel/slab/mm_struct/alloc_calls +++ /dev/null @@ -1,2 +0,0 @@ - 52 mm_alloc+0x15/0x50 age=4100/7453183/8378125 pid=1-20296 cpus=0-1 - 27 dup_mm+0x61/0x390 age=8335613/8355052/8376513 pid=71-2467 cpus=0-1 diff --git a/test/sys/kernel/slab/mm_struct/cache_dma b/test/sys/kernel/slab/mm_struct/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mm_struct/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mm_struct/cpu_slabs b/test/sys/kernel/slab/mm_struct/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mm_struct/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mm_struct/ctor b/test/sys/kernel/slab/mm_struct/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/mm_struct/destroy_by_rcu b/test/sys/kernel/slab/mm_struct/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mm_struct/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mm_struct/free_calls b/test/sys/kernel/slab/mm_struct/free_calls deleted file mode 100644 index c564d6f66f..0000000000 --- a/test/sys/kernel/slab/mm_struct/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 6 age=4303047216 pid=0 cpus=0 - 73 __mmdrop+0x47/0x60 age=7143/7714522/8376982 pid=1-20295 cpus=0-1 diff --git a/test/sys/kernel/slab/mm_struct/hwcache_align b/test/sys/kernel/slab/mm_struct/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mm_struct/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mm_struct/object_size b/test/sys/kernel/slab/mm_struct/object_size deleted file mode 100644 index fdab865fb7..0000000000 --- a/test/sys/kernel/slab/mm_struct/object_size +++ /dev/null @@ -1 +0,0 @@ -1144 diff --git a/test/sys/kernel/slab/mm_struct/objects b/test/sys/kernel/slab/mm_struct/objects deleted file mode 100644 index d22307c427..0000000000 --- a/test/sys/kernel/slab/mm_struct/objects +++ /dev/null @@ -1 +0,0 @@ -88 diff --git a/test/sys/kernel/slab/mm_struct/objects_partial b/test/sys/kernel/slab/mm_struct/objects_partial deleted file mode 100644 index 409940768f..0000000000 --- a/test/sys/kernel/slab/mm_struct/objects_partial +++ /dev/null @@ -1 +0,0 @@ -23 diff --git a/test/sys/kernel/slab/mm_struct/objs_per_slab b/test/sys/kernel/slab/mm_struct/objs_per_slab deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/kernel/slab/mm_struct/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/kernel/slab/mm_struct/order b/test/sys/kernel/slab/mm_struct/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/mm_struct/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/mm_struct/partial b/test/sys/kernel/slab/mm_struct/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/mm_struct/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/mm_struct/poison b/test/sys/kernel/slab/mm_struct/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mm_struct/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mm_struct/reclaim_account b/test/sys/kernel/slab/mm_struct/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mm_struct/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mm_struct/red_zone b/test/sys/kernel/slab/mm_struct/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mm_struct/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mm_struct/sanity_checks b/test/sys/kernel/slab/mm_struct/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mm_struct/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mm_struct/shrink b/test/sys/kernel/slab/mm_struct/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/mm_struct/slab_size b/test/sys/kernel/slab/mm_struct/slab_size deleted file mode 100644 index cc7bb991e4..0000000000 --- a/test/sys/kernel/slab/mm_struct/slab_size +++ /dev/null @@ -1 +0,0 @@ -1216 diff --git a/test/sys/kernel/slab/mm_struct/slabs b/test/sys/kernel/slab/mm_struct/slabs deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/mm_struct/slabs +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/mm_struct/store_user b/test/sys/kernel/slab/mm_struct/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mm_struct/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mm_struct/total_objects b/test/sys/kernel/slab/mm_struct/total_objects deleted file mode 100644 index 7fe4e495fe..0000000000 --- a/test/sys/kernel/slab/mm_struct/total_objects +++ /dev/null @@ -1 +0,0 @@ -91 diff --git a/test/sys/kernel/slab/mm_struct/trace b/test/sys/kernel/slab/mm_struct/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mm_struct/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mm_struct/validate b/test/sys/kernel/slab/mm_struct/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/mnt_cache/aliases b/test/sys/kernel/slab/mnt_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mnt_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mnt_cache/align b/test/sys/kernel/slab/mnt_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mnt_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mnt_cache/alloc_calls b/test/sys/kernel/slab/mnt_cache/alloc_calls deleted file mode 100644 index 28ab4b8d8b..0000000000 --- a/test/sys/kernel/slab/mnt_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 25 alloc_vfsmnt+0x1f/0x180 age=61162/8041266/8379801 pid=0-13348 cpus=0-1 diff --git a/test/sys/kernel/slab/mnt_cache/cache_dma b/test/sys/kernel/slab/mnt_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mnt_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mnt_cache/cpu_slabs b/test/sys/kernel/slab/mnt_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mnt_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mnt_cache/ctor b/test/sys/kernel/slab/mnt_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/mnt_cache/destroy_by_rcu b/test/sys/kernel/slab/mnt_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mnt_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mnt_cache/free_calls b/test/sys/kernel/slab/mnt_cache/free_calls deleted file mode 100644 index 9c03e4accc..0000000000 --- a/test/sys/kernel/slab/mnt_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 24 age=4303047098 pid=0 cpus=0 - 1 free_vfsmnt+0x2c/0x40 age=7837771 pid=3347 cpus=0 diff --git a/test/sys/kernel/slab/mnt_cache/hwcache_align b/test/sys/kernel/slab/mnt_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mnt_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mnt_cache/object_size b/test/sys/kernel/slab/mnt_cache/object_size deleted file mode 100644 index 20c90807cc..0000000000 --- a/test/sys/kernel/slab/mnt_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -224 diff --git a/test/sys/kernel/slab/mnt_cache/objects b/test/sys/kernel/slab/mnt_cache/objects deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/mnt_cache/objects +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/mnt_cache/objects_partial b/test/sys/kernel/slab/mnt_cache/objects_partial deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/mnt_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/mnt_cache/objs_per_slab b/test/sys/kernel/slab/mnt_cache/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/mnt_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/mnt_cache/order b/test/sys/kernel/slab/mnt_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mnt_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mnt_cache/partial b/test/sys/kernel/slab/mnt_cache/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mnt_cache/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mnt_cache/poison b/test/sys/kernel/slab/mnt_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mnt_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mnt_cache/reclaim_account b/test/sys/kernel/slab/mnt_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mnt_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mnt_cache/red_zone b/test/sys/kernel/slab/mnt_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mnt_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mnt_cache/sanity_checks b/test/sys/kernel/slab/mnt_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mnt_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mnt_cache/shrink b/test/sys/kernel/slab/mnt_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/mnt_cache/slab_size b/test/sys/kernel/slab/mnt_cache/slab_size deleted file mode 100644 index 18eed1357e..0000000000 --- a/test/sys/kernel/slab/mnt_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -320 diff --git a/test/sys/kernel/slab/mnt_cache/slabs b/test/sys/kernel/slab/mnt_cache/slabs deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/mnt_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/mnt_cache/store_user b/test/sys/kernel/slab/mnt_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mnt_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mnt_cache/total_objects b/test/sys/kernel/slab/mnt_cache/total_objects deleted file mode 100644 index 7facc89938..0000000000 --- a/test/sys/kernel/slab/mnt_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -36 diff --git a/test/sys/kernel/slab/mnt_cache/trace b/test/sys/kernel/slab/mnt_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mnt_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mnt_cache/validate b/test/sys/kernel/slab/mnt_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/aliases b/test/sys/kernel/slab/mqueue_inode_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/align b/test/sys/kernel/slab/mqueue_inode_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls b/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls deleted file mode 100644 index 1aeb6e1162..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1 mqueue_alloc_inode+0x15/0x30 age=8380010 pid=1 cpus=1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/cache_dma b/test/sys/kernel/slab/mqueue_inode_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs b/test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/ctor b/test/sys/kernel/slab/mqueue_inode_cache/ctor deleted file mode 100644 index 2940046f62..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/mqueue_inode_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/free_calls b/test/sys/kernel/slab/mqueue_inode_cache/free_calls deleted file mode 100644 index 6139b1f64f..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ - 1 age=4303047603 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/hwcache_align b/test/sys/kernel/slab/mqueue_inode_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/object_size b/test/sys/kernel/slab/mqueue_inode_cache/object_size deleted file mode 100644 index 471d5488d7..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -1456 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/objects b/test/sys/kernel/slab/mqueue_inode_cache/objects deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/objects +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/objects_partial b/test/sys/kernel/slab/mqueue_inode_cache/objects_partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/objs_per_slab b/test/sys/kernel/slab/mqueue_inode_cache/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/order b/test/sys/kernel/slab/mqueue_inode_cache/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/partial b/test/sys/kernel/slab/mqueue_inode_cache/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/poison b/test/sys/kernel/slab/mqueue_inode_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/reclaim_account b/test/sys/kernel/slab/mqueue_inode_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/red_zone b/test/sys/kernel/slab/mqueue_inode_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/sanity_checks b/test/sys/kernel/slab/mqueue_inode_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/shrink b/test/sys/kernel/slab/mqueue_inode_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/slab_size b/test/sys/kernel/slab/mqueue_inode_cache/slab_size deleted file mode 100644 index fa94e88e60..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1536 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/slabs b/test/sys/kernel/slab/mqueue_inode_cache/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/store_user b/test/sys/kernel/slab/mqueue_inode_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/total_objects b/test/sys/kernel/slab/mqueue_inode_cache/total_objects deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/trace b/test/sys/kernel/slab/mqueue_inode_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/mqueue_inode_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/mqueue_inode_cache/validate b/test/sys/kernel/slab/mqueue_inode_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/names_cache/aliases b/test/sys/kernel/slab/names_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/names_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/names_cache/align b/test/sys/kernel/slab/names_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/names_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/names_cache/alloc_calls b/test/sys/kernel/slab/names_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/names_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/names_cache/cache_dma b/test/sys/kernel/slab/names_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/names_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/names_cache/cpu_slabs b/test/sys/kernel/slab/names_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/names_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/names_cache/ctor b/test/sys/kernel/slab/names_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/names_cache/destroy_by_rcu b/test/sys/kernel/slab/names_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/names_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/names_cache/free_calls b/test/sys/kernel/slab/names_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/names_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/names_cache/hwcache_align b/test/sys/kernel/slab/names_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/names_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/names_cache/object_size b/test/sys/kernel/slab/names_cache/object_size deleted file mode 100644 index 801c306ed3..0000000000 --- a/test/sys/kernel/slab/names_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -4096 diff --git a/test/sys/kernel/slab/names_cache/objects b/test/sys/kernel/slab/names_cache/objects deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/names_cache/objects +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/names_cache/objects_partial b/test/sys/kernel/slab/names_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/names_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/names_cache/objs_per_slab b/test/sys/kernel/slab/names_cache/objs_per_slab deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/names_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/names_cache/order b/test/sys/kernel/slab/names_cache/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/names_cache/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/names_cache/partial b/test/sys/kernel/slab/names_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/names_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/names_cache/poison b/test/sys/kernel/slab/names_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/names_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/names_cache/reclaim_account b/test/sys/kernel/slab/names_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/names_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/names_cache/red_zone b/test/sys/kernel/slab/names_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/names_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/names_cache/sanity_checks b/test/sys/kernel/slab/names_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/names_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/names_cache/shrink b/test/sys/kernel/slab/names_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/names_cache/slab_size b/test/sys/kernel/slab/names_cache/slab_size deleted file mode 100644 index 7137ddbe18..0000000000 --- a/test/sys/kernel/slab/names_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -4224 diff --git a/test/sys/kernel/slab/names_cache/slabs b/test/sys/kernel/slab/names_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/names_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/names_cache/store_user b/test/sys/kernel/slab/names_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/names_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/names_cache/total_objects b/test/sys/kernel/slab/names_cache/total_objects deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/names_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/names_cache/trace b/test/sys/kernel/slab/names_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/names_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/names_cache/validate b/test/sys/kernel/slab/names_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ndisc_cache/aliases b/test/sys/kernel/slab/ndisc_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ndisc_cache/align b/test/sys/kernel/slab/ndisc_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ndisc_cache/alloc_calls b/test/sys/kernel/slab/ndisc_cache/alloc_calls deleted file mode 100644 index 7c40a6ff06..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1 neigh_create+0x8b/0x530 age=8360557 pid=1549 cpus=0 diff --git a/test/sys/kernel/slab/ndisc_cache/cache_dma b/test/sys/kernel/slab/ndisc_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ndisc_cache/cpu_slabs b/test/sys/kernel/slab/ndisc_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ndisc_cache/ctor b/test/sys/kernel/slab/ndisc_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ndisc_cache/destroy_by_rcu b/test/sys/kernel/slab/ndisc_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ndisc_cache/free_calls b/test/sys/kernel/slab/ndisc_cache/free_calls deleted file mode 100644 index fad673ae75..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ - 1 age=4303047782 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/ndisc_cache/hwcache_align b/test/sys/kernel/slab/ndisc_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/object_size b/test/sys/kernel/slab/ndisc_cache/object_size deleted file mode 100644 index 2921a1584c..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -360 diff --git a/test/sys/kernel/slab/ndisc_cache/objects b/test/sys/kernel/slab/ndisc_cache/objects deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/objects +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/objects_partial b/test/sys/kernel/slab/ndisc_cache/objects_partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/objs_per_slab b/test/sys/kernel/slab/ndisc_cache/objs_per_slab deleted file mode 100644 index 3c032078a4..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/test/sys/kernel/slab/ndisc_cache/order b/test/sys/kernel/slab/ndisc_cache/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/partial b/test/sys/kernel/slab/ndisc_cache/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/poison b/test/sys/kernel/slab/ndisc_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/reclaim_account b/test/sys/kernel/slab/ndisc_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ndisc_cache/red_zone b/test/sys/kernel/slab/ndisc_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/sanity_checks b/test/sys/kernel/slab/ndisc_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/shrink b/test/sys/kernel/slab/ndisc_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/ndisc_cache/slab_size b/test/sys/kernel/slab/ndisc_cache/slab_size deleted file mode 100644 index 5379c470da..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -448 diff --git a/test/sys/kernel/slab/ndisc_cache/slabs b/test/sys/kernel/slab/ndisc_cache/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/store_user b/test/sys/kernel/slab/ndisc_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/ndisc_cache/total_objects b/test/sys/kernel/slab/ndisc_cache/total_objects deleted file mode 100644 index 3c032078a4..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/test/sys/kernel/slab/ndisc_cache/trace b/test/sys/kernel/slab/ndisc_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/ndisc_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/ndisc_cache/validate b/test/sys/kernel/slab/ndisc_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/nsproxy/aliases b/test/sys/kernel/slab/nsproxy/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/align b/test/sys/kernel/slab/nsproxy/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/nsproxy/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/nsproxy/alloc_calls b/test/sys/kernel/slab/nsproxy/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/nsproxy/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/nsproxy/cache_dma b/test/sys/kernel/slab/nsproxy/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/cpu_slabs b/test/sys/kernel/slab/nsproxy/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/ctor b/test/sys/kernel/slab/nsproxy/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/nsproxy/destroy_by_rcu b/test/sys/kernel/slab/nsproxy/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/free_calls b/test/sys/kernel/slab/nsproxy/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/nsproxy/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/nsproxy/hwcache_align b/test/sys/kernel/slab/nsproxy/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/object_size b/test/sys/kernel/slab/nsproxy/object_size deleted file mode 100644 index f6b91e0e1f..0000000000 --- a/test/sys/kernel/slab/nsproxy/object_size +++ /dev/null @@ -1 +0,0 @@ -56 diff --git a/test/sys/kernel/slab/nsproxy/objects b/test/sys/kernel/slab/nsproxy/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/objects_partial b/test/sys/kernel/slab/nsproxy/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/objs_per_slab b/test/sys/kernel/slab/nsproxy/objs_per_slab deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/nsproxy/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/nsproxy/order b/test/sys/kernel/slab/nsproxy/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/partial b/test/sys/kernel/slab/nsproxy/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/poison b/test/sys/kernel/slab/nsproxy/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/nsproxy/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/nsproxy/reclaim_account b/test/sys/kernel/slab/nsproxy/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/red_zone b/test/sys/kernel/slab/nsproxy/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/nsproxy/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/nsproxy/sanity_checks b/test/sys/kernel/slab/nsproxy/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/nsproxy/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/nsproxy/shrink b/test/sys/kernel/slab/nsproxy/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/nsproxy/slab_size b/test/sys/kernel/slab/nsproxy/slab_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/nsproxy/slab_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/nsproxy/slabs b/test/sys/kernel/slab/nsproxy/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/store_user b/test/sys/kernel/slab/nsproxy/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/nsproxy/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/nsproxy/total_objects b/test/sys/kernel/slab/nsproxy/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/trace b/test/sys/kernel/slab/nsproxy/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/nsproxy/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/nsproxy/validate b/test/sys/kernel/slab/nsproxy/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/pid/aliases b/test/sys/kernel/slab/pid/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/pid/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/pid/align b/test/sys/kernel/slab/pid/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/pid/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/pid/alloc_calls b/test/sys/kernel/slab/pid/alloc_calls deleted file mode 100644 index 6f6adb1d89..0000000000 --- a/test/sys/kernel/slab/pid/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 207 alloc_pid+0x26/0x430 age=4190/8015525/8379960 pid=0-13212 cpus=0-1 diff --git a/test/sys/kernel/slab/pid/cache_dma b/test/sys/kernel/slab/pid/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/pid/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/pid/cpu_slabs b/test/sys/kernel/slab/pid/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/pid/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/pid/ctor b/test/sys/kernel/slab/pid/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/pid/destroy_by_rcu b/test/sys/kernel/slab/pid/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/pid/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/pid/free_calls b/test/sys/kernel/slab/pid/free_calls deleted file mode 100644 index 804e0da179..0000000000 --- a/test/sys/kernel/slab/pid/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 69 age=4303047306 pid=0 cpus=0 - 138 put_pid+0x36/0x40 age=7228/7841898/8377070 pid=0-13258 cpus=0-1 diff --git a/test/sys/kernel/slab/pid/hwcache_align b/test/sys/kernel/slab/pid/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/pid/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/pid/object_size b/test/sys/kernel/slab/pid/object_size deleted file mode 100644 index d15a2cc44e..0000000000 --- a/test/sys/kernel/slab/pid/object_size +++ /dev/null @@ -1 +0,0 @@ -80 diff --git a/test/sys/kernel/slab/pid/objects b/test/sys/kernel/slab/pid/objects deleted file mode 100644 index f1f094b1c3..0000000000 --- a/test/sys/kernel/slab/pid/objects +++ /dev/null @@ -1 +0,0 @@ -236 diff --git a/test/sys/kernel/slab/pid/objects_partial b/test/sys/kernel/slab/pid/objects_partial deleted file mode 100644 index a57f6ce7bc..0000000000 --- a/test/sys/kernel/slab/pid/objects_partial +++ /dev/null @@ -1 +0,0 @@ -131 diff --git a/test/sys/kernel/slab/pid/objs_per_slab b/test/sys/kernel/slab/pid/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/pid/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/pid/order b/test/sys/kernel/slab/pid/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/pid/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/pid/partial b/test/sys/kernel/slab/pid/partial deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/pid/partial +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/pid/poison b/test/sys/kernel/slab/pid/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/pid/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/pid/reclaim_account b/test/sys/kernel/slab/pid/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/pid/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/pid/red_zone b/test/sys/kernel/slab/pid/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/pid/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/pid/sanity_checks b/test/sys/kernel/slab/pid/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/pid/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/pid/shrink b/test/sys/kernel/slab/pid/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/pid/slab_size b/test/sys/kernel/slab/pid/slab_size deleted file mode 100644 index 86a0307199..0000000000 --- a/test/sys/kernel/slab/pid/slab_size +++ /dev/null @@ -1 +0,0 @@ -192 diff --git a/test/sys/kernel/slab/pid/slabs b/test/sys/kernel/slab/pid/slabs deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/pid/slabs +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/pid/store_user b/test/sys/kernel/slab/pid/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/pid/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/pid/total_objects b/test/sys/kernel/slab/pid/total_objects deleted file mode 100644 index 2197544d04..0000000000 --- a/test/sys/kernel/slab/pid/total_objects +++ /dev/null @@ -1 +0,0 @@ -252 diff --git a/test/sys/kernel/slab/pid/trace b/test/sys/kernel/slab/pid/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/pid/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/pid/validate b/test/sys/kernel/slab/pid/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/posix_timers_cache/aliases b/test/sys/kernel/slab/posix_timers_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/align b/test/sys/kernel/slab/posix_timers_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/alloc_calls b/test/sys/kernel/slab/posix_timers_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/posix_timers_cache/cache_dma b/test/sys/kernel/slab/posix_timers_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/cpu_slabs b/test/sys/kernel/slab/posix_timers_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/ctor b/test/sys/kernel/slab/posix_timers_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/posix_timers_cache/destroy_by_rcu b/test/sys/kernel/slab/posix_timers_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/free_calls b/test/sys/kernel/slab/posix_timers_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/posix_timers_cache/hwcache_align b/test/sys/kernel/slab/posix_timers_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/object_size b/test/sys/kernel/slab/posix_timers_cache/object_size deleted file mode 100644 index 5d0b6c4108..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -248 diff --git a/test/sys/kernel/slab/posix_timers_cache/objects b/test/sys/kernel/slab/posix_timers_cache/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/objects_partial b/test/sys/kernel/slab/posix_timers_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/objs_per_slab b/test/sys/kernel/slab/posix_timers_cache/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/posix_timers_cache/order b/test/sys/kernel/slab/posix_timers_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/partial b/test/sys/kernel/slab/posix_timers_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/poison b/test/sys/kernel/slab/posix_timers_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/posix_timers_cache/reclaim_account b/test/sys/kernel/slab/posix_timers_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/red_zone b/test/sys/kernel/slab/posix_timers_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/posix_timers_cache/sanity_checks b/test/sys/kernel/slab/posix_timers_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/posix_timers_cache/shrink b/test/sys/kernel/slab/posix_timers_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/posix_timers_cache/slab_size b/test/sys/kernel/slab/posix_timers_cache/slab_size deleted file mode 100644 index 18eed1357e..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -320 diff --git a/test/sys/kernel/slab/posix_timers_cache/slabs b/test/sys/kernel/slab/posix_timers_cache/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/store_user b/test/sys/kernel/slab/posix_timers_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/posix_timers_cache/total_objects b/test/sys/kernel/slab/posix_timers_cache/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/trace b/test/sys/kernel/slab/posix_timers_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/posix_timers_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/posix_timers_cache/validate b/test/sys/kernel/slab/posix_timers_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/proc_inode_cache/aliases b/test/sys/kernel/slab/proc_inode_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/proc_inode_cache/align b/test/sys/kernel/slab/proc_inode_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/proc_inode_cache/alloc_calls b/test/sys/kernel/slab/proc_inode_cache/alloc_calls deleted file mode 100644 index 8664b89541..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1627 proc_alloc_inode+0x1b/0x90 age=61424/8163415/8379746 pid=0-19241 cpus=0-1 diff --git a/test/sys/kernel/slab/proc_inode_cache/cache_dma b/test/sys/kernel/slab/proc_inode_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/proc_inode_cache/cpu_slabs b/test/sys/kernel/slab/proc_inode_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/proc_inode_cache/ctor b/test/sys/kernel/slab/proc_inode_cache/ctor deleted file mode 100644 index 2940046f62..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/proc_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/proc_inode_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/proc_inode_cache/free_calls b/test/sys/kernel/slab/proc_inode_cache/free_calls deleted file mode 100644 index 021ea1ded5..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 1124 age=4303047043 pid=0 cpus=0 - 503 proc_destroy_inode+0x14/0x20 age=61430/7970819/8372808 pid=1-12336 cpus=0-1 diff --git a/test/sys/kernel/slab/proc_inode_cache/hwcache_align b/test/sys/kernel/slab/proc_inode_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/proc_inode_cache/object_size b/test/sys/kernel/slab/proc_inode_cache/object_size deleted file mode 100644 index b1e1a0c008..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -1120 diff --git a/test/sys/kernel/slab/proc_inode_cache/objects b/test/sys/kernel/slab/proc_inode_cache/objects deleted file mode 100644 index 49e657f970..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/objects +++ /dev/null @@ -1 +0,0 @@ -1651 diff --git a/test/sys/kernel/slab/proc_inode_cache/objects_partial b/test/sys/kernel/slab/proc_inode_cache/objects_partial deleted file mode 100644 index 8e14edce9c..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -78 diff --git a/test/sys/kernel/slab/proc_inode_cache/objs_per_slab b/test/sys/kernel/slab/proc_inode_cache/objs_per_slab deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/kernel/slab/proc_inode_cache/order b/test/sys/kernel/slab/proc_inode_cache/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/proc_inode_cache/partial b/test/sys/kernel/slab/proc_inode_cache/partial deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/partial +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/proc_inode_cache/poison b/test/sys/kernel/slab/proc_inode_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/proc_inode_cache/reclaim_account b/test/sys/kernel/slab/proc_inode_cache/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/proc_inode_cache/red_zone b/test/sys/kernel/slab/proc_inode_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/proc_inode_cache/sanity_checks b/test/sys/kernel/slab/proc_inode_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/proc_inode_cache/shrink b/test/sys/kernel/slab/proc_inode_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/proc_inode_cache/slab_size b/test/sys/kernel/slab/proc_inode_cache/slab_size deleted file mode 100644 index 8cdd21dbcb..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1192 diff --git a/test/sys/kernel/slab/proc_inode_cache/slabs b/test/sys/kernel/slab/proc_inode_cache/slabs deleted file mode 100644 index b0d73241ca..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -129 diff --git a/test/sys/kernel/slab/proc_inode_cache/store_user b/test/sys/kernel/slab/proc_inode_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/proc_inode_cache/total_objects b/test/sys/kernel/slab/proc_inode_cache/total_objects deleted file mode 100644 index 9b53651732..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -1677 diff --git a/test/sys/kernel/slab/proc_inode_cache/trace b/test/sys/kernel/slab/proc_inode_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/proc_inode_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/proc_inode_cache/validate b/test/sys/kernel/slab/proc_inode_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/radix_tree_node/aliases b/test/sys/kernel/slab/radix_tree_node/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/radix_tree_node/align b/test/sys/kernel/slab/radix_tree_node/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/radix_tree_node/alloc_calls b/test/sys/kernel/slab/radix_tree_node/alloc_calls deleted file mode 100644 index 629655d477..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 6737 radix_tree_preload+0x3b/0xb0 age=16/6612251/8379044 pid=1-32767 cpus=0-1 diff --git a/test/sys/kernel/slab/radix_tree_node/cache_dma b/test/sys/kernel/slab/radix_tree_node/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/radix_tree_node/cpu_slabs b/test/sys/kernel/slab/radix_tree_node/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/radix_tree_node/ctor b/test/sys/kernel/slab/radix_tree_node/ctor deleted file mode 100644 index 0f30d5980c..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/ctor +++ /dev/null @@ -1 +0,0 @@ -radix_tree_node_ctor+0x0/0x10 diff --git a/test/sys/kernel/slab/radix_tree_node/destroy_by_rcu b/test/sys/kernel/slab/radix_tree_node/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/radix_tree_node/free_calls b/test/sys/kernel/slab/radix_tree_node/free_calls deleted file mode 100644 index 7530dda63d..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 4146 age=4303047064 pid=0 cpus=0 - 2591 radix_tree_node_rcu_free+0x41/0x50 age=39290/6239072/8378908 pid=0-32584 cpus=0-1 diff --git a/test/sys/kernel/slab/radix_tree_node/hwcache_align b/test/sys/kernel/slab/radix_tree_node/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/radix_tree_node/object_size b/test/sys/kernel/slab/radix_tree_node/object_size deleted file mode 100644 index f5e47edc5f..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/object_size +++ /dev/null @@ -1 +0,0 @@ -552 diff --git a/test/sys/kernel/slab/radix_tree_node/objects b/test/sys/kernel/slab/radix_tree_node/objects deleted file mode 100644 index 8320e39ba8..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/objects +++ /dev/null @@ -1 +0,0 @@ -6747 diff --git a/test/sys/kernel/slab/radix_tree_node/objects_partial b/test/sys/kernel/slab/radix_tree_node/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/radix_tree_node/objs_per_slab b/test/sys/kernel/slab/radix_tree_node/objs_per_slab deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/kernel/slab/radix_tree_node/order b/test/sys/kernel/slab/radix_tree_node/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/radix_tree_node/partial b/test/sys/kernel/slab/radix_tree_node/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/radix_tree_node/poison b/test/sys/kernel/slab/radix_tree_node/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/radix_tree_node/reclaim_account b/test/sys/kernel/slab/radix_tree_node/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/radix_tree_node/red_zone b/test/sys/kernel/slab/radix_tree_node/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/radix_tree_node/sanity_checks b/test/sys/kernel/slab/radix_tree_node/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/radix_tree_node/shrink b/test/sys/kernel/slab/radix_tree_node/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/radix_tree_node/slab_size b/test/sys/kernel/slab/radix_tree_node/slab_size deleted file mode 100644 index d27f552128..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/slab_size +++ /dev/null @@ -1 +0,0 @@ -624 diff --git a/test/sys/kernel/slab/radix_tree_node/slabs b/test/sys/kernel/slab/radix_tree_node/slabs deleted file mode 100644 index 08f851b6ef..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/slabs +++ /dev/null @@ -1 +0,0 @@ -519 diff --git a/test/sys/kernel/slab/radix_tree_node/store_user b/test/sys/kernel/slab/radix_tree_node/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/radix_tree_node/total_objects b/test/sys/kernel/slab/radix_tree_node/total_objects deleted file mode 100644 index 8320e39ba8..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/total_objects +++ /dev/null @@ -1 +0,0 @@ -6747 diff --git a/test/sys/kernel/slab/radix_tree_node/trace b/test/sys/kernel/slab/radix_tree_node/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/radix_tree_node/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/radix_tree_node/validate b/test/sys/kernel/slab/radix_tree_node/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/request_sock_TCP/aliases b/test/sys/kernel/slab/request_sock_TCP/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/align b/test/sys/kernel/slab/request_sock_TCP/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/alloc_calls b/test/sys/kernel/slab/request_sock_TCP/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/request_sock_TCP/cache_dma b/test/sys/kernel/slab/request_sock_TCP/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/cpu_slabs b/test/sys/kernel/slab/request_sock_TCP/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/ctor b/test/sys/kernel/slab/request_sock_TCP/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/request_sock_TCP/destroy_by_rcu b/test/sys/kernel/slab/request_sock_TCP/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/free_calls b/test/sys/kernel/slab/request_sock_TCP/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/request_sock_TCP/hwcache_align b/test/sys/kernel/slab/request_sock_TCP/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCP/object_size b/test/sys/kernel/slab/request_sock_TCP/object_size deleted file mode 100644 index d22307c427..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/object_size +++ /dev/null @@ -1 +0,0 @@ -88 diff --git a/test/sys/kernel/slab/request_sock_TCP/objects b/test/sys/kernel/slab/request_sock_TCP/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/objects_partial b/test/sys/kernel/slab/request_sock_TCP/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/objs_per_slab b/test/sys/kernel/slab/request_sock_TCP/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/request_sock_TCP/order b/test/sys/kernel/slab/request_sock_TCP/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/partial b/test/sys/kernel/slab/request_sock_TCP/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/poison b/test/sys/kernel/slab/request_sock_TCP/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCP/reclaim_account b/test/sys/kernel/slab/request_sock_TCP/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/red_zone b/test/sys/kernel/slab/request_sock_TCP/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCP/sanity_checks b/test/sys/kernel/slab/request_sock_TCP/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCP/shrink b/test/sys/kernel/slab/request_sock_TCP/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/request_sock_TCP/slab_size b/test/sys/kernel/slab/request_sock_TCP/slab_size deleted file mode 100644 index 86a0307199..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/slab_size +++ /dev/null @@ -1 +0,0 @@ -192 diff --git a/test/sys/kernel/slab/request_sock_TCP/slabs b/test/sys/kernel/slab/request_sock_TCP/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/store_user b/test/sys/kernel/slab/request_sock_TCP/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCP/total_objects b/test/sys/kernel/slab/request_sock_TCP/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/trace b/test/sys/kernel/slab/request_sock_TCP/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCP/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCP/validate b/test/sys/kernel/slab/request_sock_TCP/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/aliases b/test/sys/kernel/slab/request_sock_TCPv6/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/align b/test/sys/kernel/slab/request_sock_TCPv6/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/alloc_calls b/test/sys/kernel/slab/request_sock_TCPv6/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/request_sock_TCPv6/cache_dma b/test/sys/kernel/slab/request_sock_TCPv6/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs b/test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/ctor b/test/sys/kernel/slab/request_sock_TCPv6/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/destroy_by_rcu b/test/sys/kernel/slab/request_sock_TCPv6/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/free_calls b/test/sys/kernel/slab/request_sock_TCPv6/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/request_sock_TCPv6/hwcache_align b/test/sys/kernel/slab/request_sock_TCPv6/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/object_size b/test/sys/kernel/slab/request_sock_TCPv6/object_size deleted file mode 100644 index 7296f257eb..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/object_size +++ /dev/null @@ -1 +0,0 @@ -136 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/objects b/test/sys/kernel/slab/request_sock_TCPv6/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/objects_partial b/test/sys/kernel/slab/request_sock_TCPv6/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/objs_per_slab b/test/sys/kernel/slab/request_sock_TCPv6/objs_per_slab deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/order b/test/sys/kernel/slab/request_sock_TCPv6/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/partial b/test/sys/kernel/slab/request_sock_TCPv6/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/poison b/test/sys/kernel/slab/request_sock_TCPv6/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/reclaim_account b/test/sys/kernel/slab/request_sock_TCPv6/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/red_zone b/test/sys/kernel/slab/request_sock_TCPv6/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/sanity_checks b/test/sys/kernel/slab/request_sock_TCPv6/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/shrink b/test/sys/kernel/slab/request_sock_TCPv6/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/slab_size b/test/sys/kernel/slab/request_sock_TCPv6/slab_size deleted file mode 100644 index 9183bf03fc..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/slab_size +++ /dev/null @@ -1 +0,0 @@ -256 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/slabs b/test/sys/kernel/slab/request_sock_TCPv6/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/store_user b/test/sys/kernel/slab/request_sock_TCPv6/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/total_objects b/test/sys/kernel/slab/request_sock_TCPv6/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/trace b/test/sys/kernel/slab/request_sock_TCPv6/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/request_sock_TCPv6/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/request_sock_TCPv6/validate b/test/sys/kernel/slab/request_sock_TCPv6/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/revoke_record/aliases b/test/sys/kernel/slab/revoke_record/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_record/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_record/align b/test/sys/kernel/slab/revoke_record/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_record/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_record/alloc_calls b/test/sys/kernel/slab/revoke_record/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/revoke_record/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/revoke_record/cache_dma b/test/sys/kernel/slab/revoke_record/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_record/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_record/cpu_slabs b/test/sys/kernel/slab/revoke_record/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_record/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_record/ctor b/test/sys/kernel/slab/revoke_record/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/revoke_record/destroy_by_rcu b/test/sys/kernel/slab/revoke_record/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_record/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_record/free_calls b/test/sys/kernel/slab/revoke_record/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/revoke_record/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/revoke_record/hwcache_align b/test/sys/kernel/slab/revoke_record/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_record/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_record/object_size b/test/sys/kernel/slab/revoke_record/object_size deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/revoke_record/object_size +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/revoke_record/objects b/test/sys/kernel/slab/revoke_record/objects deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/kernel/slab/revoke_record/objects +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/kernel/slab/revoke_record/objects_partial b/test/sys/kernel/slab/revoke_record/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_record/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_record/objs_per_slab b/test/sys/kernel/slab/revoke_record/objs_per_slab deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/revoke_record/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/revoke_record/order b/test/sys/kernel/slab/revoke_record/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_record/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_record/partial b/test/sys/kernel/slab/revoke_record/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_record/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_record/poison b/test/sys/kernel/slab/revoke_record/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_record/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_record/reclaim_account b/test/sys/kernel/slab/revoke_record/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_record/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_record/red_zone b/test/sys/kernel/slab/revoke_record/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_record/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_record/sanity_checks b/test/sys/kernel/slab/revoke_record/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_record/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_record/shrink b/test/sys/kernel/slab/revoke_record/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/revoke_record/slab_size b/test/sys/kernel/slab/revoke_record/slab_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/revoke_record/slab_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/revoke_record/slabs b/test/sys/kernel/slab/revoke_record/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/revoke_record/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/revoke_record/store_user b/test/sys/kernel/slab/revoke_record/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_record/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_record/total_objects b/test/sys/kernel/slab/revoke_record/total_objects deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/kernel/slab/revoke_record/total_objects +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/kernel/slab/revoke_record/trace b/test/sys/kernel/slab/revoke_record/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_record/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_record/validate b/test/sys/kernel/slab/revoke_record/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/revoke_table/aliases b/test/sys/kernel/slab/revoke_table/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_table/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_table/align b/test/sys/kernel/slab/revoke_table/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_table/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_table/alloc_calls b/test/sys/kernel/slab/revoke_table/alloc_calls deleted file mode 100644 index ac6781e49c..0000000000 --- a/test/sys/kernel/slab/revoke_table/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 4 journal_init_revoke_table+0x1b/0xb0 age=8369805/8374155/8378505 pid=1-962 cpus=0 diff --git a/test/sys/kernel/slab/revoke_table/cache_dma b/test/sys/kernel/slab/revoke_table/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_table/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_table/cpu_slabs b/test/sys/kernel/slab/revoke_table/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_table/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_table/ctor b/test/sys/kernel/slab/revoke_table/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/revoke_table/destroy_by_rcu b/test/sys/kernel/slab/revoke_table/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_table/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_table/free_calls b/test/sys/kernel/slab/revoke_table/free_calls deleted file mode 100644 index 7c06c7c562..0000000000 --- a/test/sys/kernel/slab/revoke_table/free_calls +++ /dev/null @@ -1 +0,0 @@ - 4 age=4303047546 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/revoke_table/hwcache_align b/test/sys/kernel/slab/revoke_table/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_table/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_table/object_size b/test/sys/kernel/slab/revoke_table/object_size deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/revoke_table/object_size +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/revoke_table/objects b/test/sys/kernel/slab/revoke_table/objects deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/revoke_table/objects +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/revoke_table/objects_partial b/test/sys/kernel/slab/revoke_table/objects_partial deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/kernel/slab/revoke_table/objects_partial +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/kernel/slab/revoke_table/objs_per_slab b/test/sys/kernel/slab/revoke_table/objs_per_slab deleted file mode 100644 index 9e5feb5256..0000000000 --- a/test/sys/kernel/slab/revoke_table/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -46 diff --git a/test/sys/kernel/slab/revoke_table/order b/test/sys/kernel/slab/revoke_table/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_table/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_table/partial b/test/sys/kernel/slab/revoke_table/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_table/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_table/poison b/test/sys/kernel/slab/revoke_table/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_table/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_table/reclaim_account b/test/sys/kernel/slab/revoke_table/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_table/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_table/red_zone b/test/sys/kernel/slab/revoke_table/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_table/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_table/sanity_checks b/test/sys/kernel/slab/revoke_table/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_table/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_table/shrink b/test/sys/kernel/slab/revoke_table/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/revoke_table/slab_size b/test/sys/kernel/slab/revoke_table/slab_size deleted file mode 100644 index d22307c427..0000000000 --- a/test/sys/kernel/slab/revoke_table/slab_size +++ /dev/null @@ -1 +0,0 @@ -88 diff --git a/test/sys/kernel/slab/revoke_table/slabs b/test/sys/kernel/slab/revoke_table/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_table/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_table/store_user b/test/sys/kernel/slab/revoke_table/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/revoke_table/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/revoke_table/total_objects b/test/sys/kernel/slab/revoke_table/total_objects deleted file mode 100644 index 9e5feb5256..0000000000 --- a/test/sys/kernel/slab/revoke_table/total_objects +++ /dev/null @@ -1 +0,0 @@ -46 diff --git a/test/sys/kernel/slab/revoke_table/trace b/test/sys/kernel/slab/revoke_table/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/revoke_table/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/revoke_table/validate b/test/sys/kernel/slab/revoke_table/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/aliases b/test/sys/kernel/slab/scsi_cmd_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/align b/test/sys/kernel/slab/scsi_cmd_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls b/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls deleted file mode 100644 index ab74101284..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 7 scsi_pool_alloc_command+0x25/0x80 age=67290/7192324/8380005 pid=1-419 cpus=0-1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/cache_dma b/test/sys/kernel/slab/scsi_cmd_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs b/test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/ctor b/test/sys/kernel/slab/scsi_cmd_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu b/test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/free_calls b/test/sys/kernel/slab/scsi_cmd_cache/free_calls deleted file mode 100644 index 384a427c96..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 5 age=4303047639 pid=0 cpus=0 - 2 scsi_pool_free_command+0x4c/0x60 age=67789/4223648/8379508 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/hwcache_align b/test/sys/kernel/slab/scsi_cmd_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/object_size b/test/sys/kernel/slab/scsi_cmd_cache/object_size deleted file mode 100644 index 18eed1357e..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -320 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/objects b/test/sys/kernel/slab/scsi_cmd_cache/objects deleted file mode 100644 index 7facc89938..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/objects +++ /dev/null @@ -1 +0,0 @@ -36 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/objects_partial b/test/sys/kernel/slab/scsi_cmd_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab b/test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab deleted file mode 100644 index 3c032078a4..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/order b/test/sys/kernel/slab/scsi_cmd_cache/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/partial b/test/sys/kernel/slab/scsi_cmd_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/poison b/test/sys/kernel/slab/scsi_cmd_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/reclaim_account b/test/sys/kernel/slab/scsi_cmd_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/red_zone b/test/sys/kernel/slab/scsi_cmd_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/sanity_checks b/test/sys/kernel/slab/scsi_cmd_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/shrink b/test/sys/kernel/slab/scsi_cmd_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/slab_size b/test/sys/kernel/slab/scsi_cmd_cache/slab_size deleted file mode 100644 index 5379c470da..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -448 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/slabs b/test/sys/kernel/slab/scsi_cmd_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/store_user b/test/sys/kernel/slab/scsi_cmd_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/total_objects b/test/sys/kernel/slab/scsi_cmd_cache/total_objects deleted file mode 100644 index 7facc89938..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -36 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/trace b/test/sys/kernel/slab/scsi_cmd_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_cmd_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_cmd_cache/validate b/test/sys/kernel/slab/scsi_cmd_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_data_buffer/aliases b/test/sys/kernel/slab/scsi_data_buffer/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/align b/test/sys/kernel/slab/scsi_data_buffer/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/alloc_calls b/test/sys/kernel/slab/scsi_data_buffer/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/scsi_data_buffer/cache_dma b/test/sys/kernel/slab/scsi_data_buffer/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/cpu_slabs b/test/sys/kernel/slab/scsi_data_buffer/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/ctor b/test/sys/kernel/slab/scsi_data_buffer/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_data_buffer/destroy_by_rcu b/test/sys/kernel/slab/scsi_data_buffer/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/free_calls b/test/sys/kernel/slab/scsi_data_buffer/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/scsi_data_buffer/hwcache_align b/test/sys/kernel/slab/scsi_data_buffer/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/object_size b/test/sys/kernel/slab/scsi_data_buffer/object_size deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/object_size +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/scsi_data_buffer/objects b/test/sys/kernel/slab/scsi_data_buffer/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/objects_partial b/test/sys/kernel/slab/scsi_data_buffer/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/objs_per_slab b/test/sys/kernel/slab/scsi_data_buffer/objs_per_slab deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/scsi_data_buffer/order b/test/sys/kernel/slab/scsi_data_buffer/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/partial b/test/sys/kernel/slab/scsi_data_buffer/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/poison b/test/sys/kernel/slab/scsi_data_buffer/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_data_buffer/reclaim_account b/test/sys/kernel/slab/scsi_data_buffer/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/red_zone b/test/sys/kernel/slab/scsi_data_buffer/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_data_buffer/sanity_checks b/test/sys/kernel/slab/scsi_data_buffer/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_data_buffer/shrink b/test/sys/kernel/slab/scsi_data_buffer/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_data_buffer/slab_size b/test/sys/kernel/slab/scsi_data_buffer/slab_size deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/slab_size +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/scsi_data_buffer/slabs b/test/sys/kernel/slab/scsi_data_buffer/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/store_user b/test/sys/kernel/slab/scsi_data_buffer/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_data_buffer/total_objects b/test/sys/kernel/slab/scsi_data_buffer/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/trace b/test/sys/kernel/slab/scsi_data_buffer/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_data_buffer/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_data_buffer/validate b/test/sys/kernel/slab/scsi_data_buffer/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_io_context/aliases b/test/sys/kernel/slab/scsi_io_context/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/align b/test/sys/kernel/slab/scsi_io_context/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/alloc_calls b/test/sys/kernel/slab/scsi_io_context/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/scsi_io_context/cache_dma b/test/sys/kernel/slab/scsi_io_context/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/cpu_slabs b/test/sys/kernel/slab/scsi_io_context/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/ctor b/test/sys/kernel/slab/scsi_io_context/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_io_context/destroy_by_rcu b/test/sys/kernel/slab/scsi_io_context/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/free_calls b/test/sys/kernel/slab/scsi_io_context/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/scsi_io_context/hwcache_align b/test/sys/kernel/slab/scsi_io_context/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/object_size b/test/sys/kernel/slab/scsi_io_context/object_size deleted file mode 100644 index 194b81caae..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/object_size +++ /dev/null @@ -1 +0,0 @@ -112 diff --git a/test/sys/kernel/slab/scsi_io_context/objects b/test/sys/kernel/slab/scsi_io_context/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/objects_partial b/test/sys/kernel/slab/scsi_io_context/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/objs_per_slab b/test/sys/kernel/slab/scsi_io_context/objs_per_slab deleted file mode 100644 index 2bd5a0a98a..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -22 diff --git a/test/sys/kernel/slab/scsi_io_context/order b/test/sys/kernel/slab/scsi_io_context/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/partial b/test/sys/kernel/slab/scsi_io_context/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/poison b/test/sys/kernel/slab/scsi_io_context/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_io_context/reclaim_account b/test/sys/kernel/slab/scsi_io_context/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/red_zone b/test/sys/kernel/slab/scsi_io_context/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_io_context/sanity_checks b/test/sys/kernel/slab/scsi_io_context/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_io_context/shrink b/test/sys/kernel/slab/scsi_io_context/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_io_context/slab_size b/test/sys/kernel/slab/scsi_io_context/slab_size deleted file mode 100644 index dc37bbdb81..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/slab_size +++ /dev/null @@ -1 +0,0 @@ -184 diff --git a/test/sys/kernel/slab/scsi_io_context/slabs b/test/sys/kernel/slab/scsi_io_context/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/store_user b/test/sys/kernel/slab/scsi_io_context/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_io_context/total_objects b/test/sys/kernel/slab/scsi_io_context/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/trace b/test/sys/kernel/slab/scsi_io_context/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_io_context/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_io_context/validate b/test/sys/kernel/slab/scsi_io_context/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_sense_cache/aliases b/test/sys/kernel/slab/scsi_sense_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/align b/test/sys/kernel/slab/scsi_sense_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/alloc_calls b/test/sys/kernel/slab/scsi_sense_cache/alloc_calls deleted file mode 100644 index f29cd3372a..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 7 scsi_pool_alloc_command+0x4a/0x80 age=67299/7192333/8380014 pid=1-419 cpus=0-1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/cache_dma b/test/sys/kernel/slab/scsi_sense_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/cpu_slabs b/test/sys/kernel/slab/scsi_sense_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/ctor b/test/sys/kernel/slab/scsi_sense_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_sense_cache/destroy_by_rcu b/test/sys/kernel/slab/scsi_sense_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/free_calls b/test/sys/kernel/slab/scsi_sense_cache/free_calls deleted file mode 100644 index 0ef5317549..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 5 age=4303047648 pid=0 cpus=0 - 2 scsi_pool_free_command+0x40/0x60 age=67798/4223657/8379517 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/hwcache_align b/test/sys/kernel/slab/scsi_sense_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/object_size b/test/sys/kernel/slab/scsi_sense_cache/object_size deleted file mode 100644 index f906e1845d..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -96 diff --git a/test/sys/kernel/slab/scsi_sense_cache/objects b/test/sys/kernel/slab/scsi_sense_cache/objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/scsi_sense_cache/objects_partial b/test/sys/kernel/slab/scsi_sense_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/objs_per_slab b/test/sys/kernel/slab/scsi_sense_cache/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/scsi_sense_cache/order b/test/sys/kernel/slab/scsi_sense_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/partial b/test/sys/kernel/slab/scsi_sense_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/poison b/test/sys/kernel/slab/scsi_sense_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/reclaim_account b/test/sys/kernel/slab/scsi_sense_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/red_zone b/test/sys/kernel/slab/scsi_sense_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/sanity_checks b/test/sys/kernel/slab/scsi_sense_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/shrink b/test/sys/kernel/slab/scsi_sense_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/scsi_sense_cache/slab_size b/test/sys/kernel/slab/scsi_sense_cache/slab_size deleted file mode 100644 index 86a0307199..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -192 diff --git a/test/sys/kernel/slab/scsi_sense_cache/slabs b/test/sys/kernel/slab/scsi_sense_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/scsi_sense_cache/store_user b/test/sys/kernel/slab/scsi_sense_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/scsi_sense_cache/total_objects b/test/sys/kernel/slab/scsi_sense_cache/total_objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/scsi_sense_cache/trace b/test/sys/kernel/slab/scsi_sense_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/scsi_sense_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/scsi_sense_cache/validate b/test/sys/kernel/slab/scsi_sense_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/secpath_cache/aliases b/test/sys/kernel/slab/secpath_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/align b/test/sys/kernel/slab/secpath_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/alloc_calls b/test/sys/kernel/slab/secpath_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/secpath_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/secpath_cache/cache_dma b/test/sys/kernel/slab/secpath_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/cpu_slabs b/test/sys/kernel/slab/secpath_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/ctor b/test/sys/kernel/slab/secpath_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/secpath_cache/destroy_by_rcu b/test/sys/kernel/slab/secpath_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/free_calls b/test/sys/kernel/slab/secpath_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/secpath_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/secpath_cache/hwcache_align b/test/sys/kernel/slab/secpath_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/secpath_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/secpath_cache/object_size b/test/sys/kernel/slab/secpath_cache/object_size deleted file mode 100644 index f6b91e0e1f..0000000000 --- a/test/sys/kernel/slab/secpath_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -56 diff --git a/test/sys/kernel/slab/secpath_cache/objects b/test/sys/kernel/slab/secpath_cache/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/objects_partial b/test/sys/kernel/slab/secpath_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/objs_per_slab b/test/sys/kernel/slab/secpath_cache/objs_per_slab deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/secpath_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/secpath_cache/order b/test/sys/kernel/slab/secpath_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/partial b/test/sys/kernel/slab/secpath_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/poison b/test/sys/kernel/slab/secpath_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/secpath_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/secpath_cache/reclaim_account b/test/sys/kernel/slab/secpath_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/red_zone b/test/sys/kernel/slab/secpath_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/secpath_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/secpath_cache/sanity_checks b/test/sys/kernel/slab/secpath_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/secpath_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/secpath_cache/shrink b/test/sys/kernel/slab/secpath_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/secpath_cache/slab_size b/test/sys/kernel/slab/secpath_cache/slab_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/secpath_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/secpath_cache/slabs b/test/sys/kernel/slab/secpath_cache/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/store_user b/test/sys/kernel/slab/secpath_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/secpath_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/secpath_cache/total_objects b/test/sys/kernel/slab/secpath_cache/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/trace b/test/sys/kernel/slab/secpath_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/secpath_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/secpath_cache/validate b/test/sys/kernel/slab/secpath_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-128/aliases b/test/sys/kernel/slab/sgpool-128/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-128/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-128/align b/test/sys/kernel/slab/sgpool-128/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-128/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-128/alloc_calls b/test/sys/kernel/slab/sgpool-128/alloc_calls deleted file mode 100644 index 130b119b48..0000000000 --- a/test/sys/kernel/slab/sgpool-128/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379262/8379262/8379262 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-128/cache_dma b/test/sys/kernel/slab/sgpool-128/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-128/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-128/cpu_slabs b/test/sys/kernel/slab/sgpool-128/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-128/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-128/ctor b/test/sys/kernel/slab/sgpool-128/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-128/destroy_by_rcu b/test/sys/kernel/slab/sgpool-128/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-128/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-128/free_calls b/test/sys/kernel/slab/sgpool-128/free_calls deleted file mode 100644 index 6a6763fb37..0000000000 --- a/test/sys/kernel/slab/sgpool-128/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046812 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-128/hwcache_align b/test/sys/kernel/slab/sgpool-128/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-128/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-128/object_size b/test/sys/kernel/slab/sgpool-128/object_size deleted file mode 100644 index 801c306ed3..0000000000 --- a/test/sys/kernel/slab/sgpool-128/object_size +++ /dev/null @@ -1 +0,0 @@ -4096 diff --git a/test/sys/kernel/slab/sgpool-128/objects b/test/sys/kernel/slab/sgpool-128/objects deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/sgpool-128/objects +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/sgpool-128/objects_partial b/test/sys/kernel/slab/sgpool-128/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-128/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-128/objs_per_slab b/test/sys/kernel/slab/sgpool-128/objs_per_slab deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/sgpool-128/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/sgpool-128/order b/test/sys/kernel/slab/sgpool-128/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/sgpool-128/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/sgpool-128/partial b/test/sys/kernel/slab/sgpool-128/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-128/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-128/poison b/test/sys/kernel/slab/sgpool-128/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-128/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-128/reclaim_account b/test/sys/kernel/slab/sgpool-128/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-128/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-128/red_zone b/test/sys/kernel/slab/sgpool-128/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-128/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-128/sanity_checks b/test/sys/kernel/slab/sgpool-128/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-128/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-128/shrink b/test/sys/kernel/slab/sgpool-128/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-128/slab_size b/test/sys/kernel/slab/sgpool-128/slab_size deleted file mode 100644 index 7137ddbe18..0000000000 --- a/test/sys/kernel/slab/sgpool-128/slab_size +++ /dev/null @@ -1 +0,0 @@ -4224 diff --git a/test/sys/kernel/slab/sgpool-128/slabs b/test/sys/kernel/slab/sgpool-128/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/sgpool-128/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/sgpool-128/store_user b/test/sys/kernel/slab/sgpool-128/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-128/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-128/total_objects b/test/sys/kernel/slab/sgpool-128/total_objects deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/sgpool-128/total_objects +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/sgpool-128/trace b/test/sys/kernel/slab/sgpool-128/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-128/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-128/validate b/test/sys/kernel/slab/sgpool-128/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-16/aliases b/test/sys/kernel/slab/sgpool-16/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-16/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-16/align b/test/sys/kernel/slab/sgpool-16/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-16/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-16/alloc_calls b/test/sys/kernel/slab/sgpool-16/alloc_calls deleted file mode 100644 index 87929847e4..0000000000 --- a/test/sys/kernel/slab/sgpool-16/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379289/8379289/8379289 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-16/cache_dma b/test/sys/kernel/slab/sgpool-16/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-16/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-16/cpu_slabs b/test/sys/kernel/slab/sgpool-16/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-16/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-16/ctor b/test/sys/kernel/slab/sgpool-16/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-16/destroy_by_rcu b/test/sys/kernel/slab/sgpool-16/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-16/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-16/free_calls b/test/sys/kernel/slab/sgpool-16/free_calls deleted file mode 100644 index 0e890c40ff..0000000000 --- a/test/sys/kernel/slab/sgpool-16/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046838 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-16/hwcache_align b/test/sys/kernel/slab/sgpool-16/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-16/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-16/object_size b/test/sys/kernel/slab/sgpool-16/object_size deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/kernel/slab/sgpool-16/object_size +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/kernel/slab/sgpool-16/objects b/test/sys/kernel/slab/sgpool-16/objects deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/sgpool-16/objects +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/sgpool-16/objects_partial b/test/sys/kernel/slab/sgpool-16/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-16/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-16/objs_per_slab b/test/sys/kernel/slab/sgpool-16/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/sgpool-16/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/sgpool-16/order b/test/sys/kernel/slab/sgpool-16/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-16/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-16/partial b/test/sys/kernel/slab/sgpool-16/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-16/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-16/poison b/test/sys/kernel/slab/sgpool-16/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-16/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-16/reclaim_account b/test/sys/kernel/slab/sgpool-16/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-16/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-16/red_zone b/test/sys/kernel/slab/sgpool-16/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-16/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-16/sanity_checks b/test/sys/kernel/slab/sgpool-16/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-16/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-16/shrink b/test/sys/kernel/slab/sgpool-16/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-16/slab_size b/test/sys/kernel/slab/sgpool-16/slab_size deleted file mode 100644 index fe4d93ae13..0000000000 --- a/test/sys/kernel/slab/sgpool-16/slab_size +++ /dev/null @@ -1 +0,0 @@ -640 diff --git a/test/sys/kernel/slab/sgpool-16/slabs b/test/sys/kernel/slab/sgpool-16/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/sgpool-16/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/sgpool-16/store_user b/test/sys/kernel/slab/sgpool-16/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-16/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-16/total_objects b/test/sys/kernel/slab/sgpool-16/total_objects deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/sgpool-16/total_objects +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/sgpool-16/trace b/test/sys/kernel/slab/sgpool-16/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-16/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-16/validate b/test/sys/kernel/slab/sgpool-16/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-32/aliases b/test/sys/kernel/slab/sgpool-32/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-32/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-32/align b/test/sys/kernel/slab/sgpool-32/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-32/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-32/alloc_calls b/test/sys/kernel/slab/sgpool-32/alloc_calls deleted file mode 100644 index b16cb4f40a..0000000000 --- a/test/sys/kernel/slab/sgpool-32/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379280/8379280/8379280 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-32/cache_dma b/test/sys/kernel/slab/sgpool-32/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-32/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-32/cpu_slabs b/test/sys/kernel/slab/sgpool-32/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-32/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-32/ctor b/test/sys/kernel/slab/sgpool-32/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-32/destroy_by_rcu b/test/sys/kernel/slab/sgpool-32/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-32/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-32/free_calls b/test/sys/kernel/slab/sgpool-32/free_calls deleted file mode 100644 index ab6863fa61..0000000000 --- a/test/sys/kernel/slab/sgpool-32/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046829 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-32/hwcache_align b/test/sys/kernel/slab/sgpool-32/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-32/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-32/object_size b/test/sys/kernel/slab/sgpool-32/object_size deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/kernel/slab/sgpool-32/object_size +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/kernel/slab/sgpool-32/objects b/test/sys/kernel/slab/sgpool-32/objects deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/sgpool-32/objects +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/sgpool-32/objects_partial b/test/sys/kernel/slab/sgpool-32/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-32/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-32/objs_per_slab b/test/sys/kernel/slab/sgpool-32/objs_per_slab deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/sgpool-32/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/sgpool-32/order b/test/sys/kernel/slab/sgpool-32/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/sgpool-32/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/sgpool-32/partial b/test/sys/kernel/slab/sgpool-32/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-32/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-32/poison b/test/sys/kernel/slab/sgpool-32/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-32/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-32/reclaim_account b/test/sys/kernel/slab/sgpool-32/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-32/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-32/red_zone b/test/sys/kernel/slab/sgpool-32/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-32/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-32/sanity_checks b/test/sys/kernel/slab/sgpool-32/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-32/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-32/shrink b/test/sys/kernel/slab/sgpool-32/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-32/slab_size b/test/sys/kernel/slab/sgpool-32/slab_size deleted file mode 100644 index d98057a110..0000000000 --- a/test/sys/kernel/slab/sgpool-32/slab_size +++ /dev/null @@ -1 +0,0 @@ -1152 diff --git a/test/sys/kernel/slab/sgpool-32/slabs b/test/sys/kernel/slab/sgpool-32/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/sgpool-32/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/sgpool-32/store_user b/test/sys/kernel/slab/sgpool-32/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-32/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-32/total_objects b/test/sys/kernel/slab/sgpool-32/total_objects deleted file mode 100644 index 9902f17848..0000000000 --- a/test/sys/kernel/slab/sgpool-32/total_objects +++ /dev/null @@ -1 +0,0 @@ -28 diff --git a/test/sys/kernel/slab/sgpool-32/trace b/test/sys/kernel/slab/sgpool-32/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-32/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-32/validate b/test/sys/kernel/slab/sgpool-32/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-64/aliases b/test/sys/kernel/slab/sgpool-64/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-64/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-64/align b/test/sys/kernel/slab/sgpool-64/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-64/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-64/alloc_calls b/test/sys/kernel/slab/sgpool-64/alloc_calls deleted file mode 100644 index a46bc1ed5d..0000000000 --- a/test/sys/kernel/slab/sgpool-64/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379271/8379271/8379271 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-64/cache_dma b/test/sys/kernel/slab/sgpool-64/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-64/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-64/cpu_slabs b/test/sys/kernel/slab/sgpool-64/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-64/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-64/ctor b/test/sys/kernel/slab/sgpool-64/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-64/destroy_by_rcu b/test/sys/kernel/slab/sgpool-64/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-64/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-64/free_calls b/test/sys/kernel/slab/sgpool-64/free_calls deleted file mode 100644 index 0403d6ef86..0000000000 --- a/test/sys/kernel/slab/sgpool-64/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046820 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-64/hwcache_align b/test/sys/kernel/slab/sgpool-64/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-64/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-64/object_size b/test/sys/kernel/slab/sgpool-64/object_size deleted file mode 100644 index c873496a22..0000000000 --- a/test/sys/kernel/slab/sgpool-64/object_size +++ /dev/null @@ -1 +0,0 @@ -2048 diff --git a/test/sys/kernel/slab/sgpool-64/objects b/test/sys/kernel/slab/sgpool-64/objects deleted file mode 100644 index 64bb6b746d..0000000000 --- a/test/sys/kernel/slab/sgpool-64/objects +++ /dev/null @@ -1 +0,0 @@ -30 diff --git a/test/sys/kernel/slab/sgpool-64/objects_partial b/test/sys/kernel/slab/sgpool-64/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-64/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-64/objs_per_slab b/test/sys/kernel/slab/sgpool-64/objs_per_slab deleted file mode 100644 index 60d3b2f4a4..0000000000 --- a/test/sys/kernel/slab/sgpool-64/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -15 diff --git a/test/sys/kernel/slab/sgpool-64/order b/test/sys/kernel/slab/sgpool-64/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/sgpool-64/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/sgpool-64/partial b/test/sys/kernel/slab/sgpool-64/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-64/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-64/poison b/test/sys/kernel/slab/sgpool-64/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-64/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-64/reclaim_account b/test/sys/kernel/slab/sgpool-64/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-64/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-64/red_zone b/test/sys/kernel/slab/sgpool-64/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-64/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-64/sanity_checks b/test/sys/kernel/slab/sgpool-64/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-64/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-64/shrink b/test/sys/kernel/slab/sgpool-64/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-64/slab_size b/test/sys/kernel/slab/sgpool-64/slab_size deleted file mode 100644 index f52b3ac70f..0000000000 --- a/test/sys/kernel/slab/sgpool-64/slab_size +++ /dev/null @@ -1 +0,0 @@ -2176 diff --git a/test/sys/kernel/slab/sgpool-64/slabs b/test/sys/kernel/slab/sgpool-64/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/sgpool-64/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/sgpool-64/store_user b/test/sys/kernel/slab/sgpool-64/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-64/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-64/total_objects b/test/sys/kernel/slab/sgpool-64/total_objects deleted file mode 100644 index 64bb6b746d..0000000000 --- a/test/sys/kernel/slab/sgpool-64/total_objects +++ /dev/null @@ -1 +0,0 @@ -30 diff --git a/test/sys/kernel/slab/sgpool-64/trace b/test/sys/kernel/slab/sgpool-64/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-64/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-64/validate b/test/sys/kernel/slab/sgpool-64/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-8/aliases b/test/sys/kernel/slab/sgpool-8/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-8/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-8/align b/test/sys/kernel/slab/sgpool-8/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-8/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-8/alloc_calls b/test/sys/kernel/slab/sgpool-8/alloc_calls deleted file mode 100644 index f0e2138841..0000000000 --- a/test/sys/kernel/slab/sgpool-8/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 2 mempool_alloc_slab+0x11/0x20 age=8379297/8379297/8379297 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-8/cache_dma b/test/sys/kernel/slab/sgpool-8/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-8/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-8/cpu_slabs b/test/sys/kernel/slab/sgpool-8/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-8/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-8/ctor b/test/sys/kernel/slab/sgpool-8/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-8/destroy_by_rcu b/test/sys/kernel/slab/sgpool-8/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-8/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-8/free_calls b/test/sys/kernel/slab/sgpool-8/free_calls deleted file mode 100644 index 585a3e3502..0000000000 --- a/test/sys/kernel/slab/sgpool-8/free_calls +++ /dev/null @@ -1 +0,0 @@ - 2 age=4303046847 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/sgpool-8/hwcache_align b/test/sys/kernel/slab/sgpool-8/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-8/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-8/object_size b/test/sys/kernel/slab/sgpool-8/object_size deleted file mode 100644 index 9183bf03fc..0000000000 --- a/test/sys/kernel/slab/sgpool-8/object_size +++ /dev/null @@ -1 +0,0 @@ -256 diff --git a/test/sys/kernel/slab/sgpool-8/objects b/test/sys/kernel/slab/sgpool-8/objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/sgpool-8/objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/sgpool-8/objects_partial b/test/sys/kernel/slab/sgpool-8/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-8/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-8/objs_per_slab b/test/sys/kernel/slab/sgpool-8/objs_per_slab deleted file mode 100644 index aabe6ec390..0000000000 --- a/test/sys/kernel/slab/sgpool-8/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -21 diff --git a/test/sys/kernel/slab/sgpool-8/order b/test/sys/kernel/slab/sgpool-8/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-8/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-8/partial b/test/sys/kernel/slab/sgpool-8/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-8/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-8/poison b/test/sys/kernel/slab/sgpool-8/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-8/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-8/reclaim_account b/test/sys/kernel/slab/sgpool-8/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-8/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-8/red_zone b/test/sys/kernel/slab/sgpool-8/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-8/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-8/sanity_checks b/test/sys/kernel/slab/sgpool-8/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-8/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-8/shrink b/test/sys/kernel/slab/sgpool-8/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sgpool-8/slab_size b/test/sys/kernel/slab/sgpool-8/slab_size deleted file mode 100644 index e45b99e958..0000000000 --- a/test/sys/kernel/slab/sgpool-8/slab_size +++ /dev/null @@ -1 +0,0 @@ -384 diff --git a/test/sys/kernel/slab/sgpool-8/slabs b/test/sys/kernel/slab/sgpool-8/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/sgpool-8/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/sgpool-8/store_user b/test/sys/kernel/slab/sgpool-8/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sgpool-8/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sgpool-8/total_objects b/test/sys/kernel/slab/sgpool-8/total_objects deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/sgpool-8/total_objects +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/sgpool-8/trace b/test/sys/kernel/slab/sgpool-8/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sgpool-8/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sgpool-8/validate b/test/sys/kernel/slab/sgpool-8/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/shmem_inode_cache/aliases b/test/sys/kernel/slab/shmem_inode_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/align b/test/sys/kernel/slab/shmem_inode_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/alloc_calls b/test/sys/kernel/slab/shmem_inode_cache/alloc_calls deleted file mode 100644 index 97a94a7e91..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1144 shmem_alloc_inode+0x15/0x30 age=21584/7506265/8379043 pid=1-13453 cpus=0-1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/cache_dma b/test/sys/kernel/slab/shmem_inode_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/cpu_slabs b/test/sys/kernel/slab/shmem_inode_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/ctor b/test/sys/kernel/slab/shmem_inode_cache/ctor deleted file mode 100644 index 54aeafc423..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x40 diff --git a/test/sys/kernel/slab/shmem_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/shmem_inode_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/free_calls b/test/sys/kernel/slab/shmem_inode_cache/free_calls deleted file mode 100644 index 13f4f3104d..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 741 age=4303046628 pid=0 cpus=0 - 403 shmem_destroy_inode+0x24/0x30 age=21598/7406739/8375758 pid=72-13332 cpus=0-1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/hwcache_align b/test/sys/kernel/slab/shmem_inode_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/object_size b/test/sys/kernel/slab/shmem_inode_cache/object_size deleted file mode 100644 index a38c571765..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -1328 diff --git a/test/sys/kernel/slab/shmem_inode_cache/objects b/test/sys/kernel/slab/shmem_inode_cache/objects deleted file mode 100644 index 34684091a9..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/objects +++ /dev/null @@ -1 +0,0 @@ -1169 diff --git a/test/sys/kernel/slab/shmem_inode_cache/objects_partial b/test/sys/kernel/slab/shmem_inode_cache/objects_partial deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/shmem_inode_cache/objs_per_slab b/test/sys/kernel/slab/shmem_inode_cache/objs_per_slab deleted file mode 100644 index 409940768f..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -23 diff --git a/test/sys/kernel/slab/shmem_inode_cache/order b/test/sys/kernel/slab/shmem_inode_cache/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/shmem_inode_cache/partial b/test/sys/kernel/slab/shmem_inode_cache/partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/shmem_inode_cache/poison b/test/sys/kernel/slab/shmem_inode_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/reclaim_account b/test/sys/kernel/slab/shmem_inode_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/red_zone b/test/sys/kernel/slab/shmem_inode_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/sanity_checks b/test/sys/kernel/slab/shmem_inode_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/shrink b/test/sys/kernel/slab/shmem_inode_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/shmem_inode_cache/slab_size b/test/sys/kernel/slab/shmem_inode_cache/slab_size deleted file mode 100644 index 50989ffea1..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1400 diff --git a/test/sys/kernel/slab/shmem_inode_cache/slabs b/test/sys/kernel/slab/shmem_inode_cache/slabs deleted file mode 100644 index 82cced27d7..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -51 diff --git a/test/sys/kernel/slab/shmem_inode_cache/store_user b/test/sys/kernel/slab/shmem_inode_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/shmem_inode_cache/total_objects b/test/sys/kernel/slab/shmem_inode_cache/total_objects deleted file mode 100644 index 6e64a9148e..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -1173 diff --git a/test/sys/kernel/slab/shmem_inode_cache/trace b/test/sys/kernel/slab/shmem_inode_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/shmem_inode_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/shmem_inode_cache/validate b/test/sys/kernel/slab/shmem_inode_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sighand_cache/aliases b/test/sys/kernel/slab/sighand_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sighand_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sighand_cache/align b/test/sys/kernel/slab/sighand_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sighand_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sighand_cache/alloc_calls b/test/sys/kernel/slab/sighand_cache/alloc_calls deleted file mode 100644 index 67d50041cd..0000000000 --- a/test/sys/kernel/slab/sighand_cache/alloc_calls +++ /dev/null @@ -1,2 +0,0 @@ - 123 copy_process+0x82a/0x1220 age=4154/7846897/8379923 pid=0-12336 cpus=0-1 - 1 flush_old_exec+0x4e1/0x8a0 age=8378174 pid=1 cpus=0 diff --git a/test/sys/kernel/slab/sighand_cache/cache_dma b/test/sys/kernel/slab/sighand_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sighand_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sighand_cache/cpu_slabs b/test/sys/kernel/slab/sighand_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sighand_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sighand_cache/ctor b/test/sys/kernel/slab/sighand_cache/ctor deleted file mode 100644 index 27bc087a5c..0000000000 --- a/test/sys/kernel/slab/sighand_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -sighand_ctor+0x0/0x40 diff --git a/test/sys/kernel/slab/sighand_cache/destroy_by_rcu b/test/sys/kernel/slab/sighand_cache/destroy_by_rcu deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sighand_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sighand_cache/free_calls b/test/sys/kernel/slab/sighand_cache/free_calls deleted file mode 100644 index 383c981c29..0000000000 --- a/test/sys/kernel/slab/sighand_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 46 age=4303047268 pid=0 cpus=0 - 78 __cleanup_sighand+0x27/0x30 age=7195/7547046/8375852 pid=1-13288 cpus=0-1 diff --git a/test/sys/kernel/slab/sighand_cache/hwcache_align b/test/sys/kernel/slab/sighand_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sighand_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sighand_cache/object_size b/test/sys/kernel/slab/sighand_cache/object_size deleted file mode 100644 index 523688b618..0000000000 --- a/test/sys/kernel/slab/sighand_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -2184 diff --git a/test/sys/kernel/slab/sighand_cache/objects b/test/sys/kernel/slab/sighand_cache/objects deleted file mode 100644 index 13c09a007e..0000000000 --- a/test/sys/kernel/slab/sighand_cache/objects +++ /dev/null @@ -1 +0,0 @@ -145 diff --git a/test/sys/kernel/slab/sighand_cache/objects_partial b/test/sys/kernel/slab/sighand_cache/objects_partial deleted file mode 100644 index b1e7d265fc..0000000000 --- a/test/sys/kernel/slab/sighand_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -61 diff --git a/test/sys/kernel/slab/sighand_cache/objs_per_slab b/test/sys/kernel/slab/sighand_cache/objs_per_slab deleted file mode 100644 index 8351c19397..0000000000 --- a/test/sys/kernel/slab/sighand_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -14 diff --git a/test/sys/kernel/slab/sighand_cache/order b/test/sys/kernel/slab/sighand_cache/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/sighand_cache/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/sighand_cache/partial b/test/sys/kernel/slab/sighand_cache/partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/sighand_cache/partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/sighand_cache/poison b/test/sys/kernel/slab/sighand_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sighand_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sighand_cache/reclaim_account b/test/sys/kernel/slab/sighand_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sighand_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sighand_cache/red_zone b/test/sys/kernel/slab/sighand_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sighand_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sighand_cache/sanity_checks b/test/sys/kernel/slab/sighand_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sighand_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sighand_cache/shrink b/test/sys/kernel/slab/sighand_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sighand_cache/slab_size b/test/sys/kernel/slab/sighand_cache/slab_size deleted file mode 100644 index c801f0a47c..0000000000 --- a/test/sys/kernel/slab/sighand_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -2304 diff --git a/test/sys/kernel/slab/sighand_cache/slabs b/test/sys/kernel/slab/sighand_cache/slabs deleted file mode 100644 index b4de394767..0000000000 --- a/test/sys/kernel/slab/sighand_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -11 diff --git a/test/sys/kernel/slab/sighand_cache/store_user b/test/sys/kernel/slab/sighand_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sighand_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sighand_cache/total_objects b/test/sys/kernel/slab/sighand_cache/total_objects deleted file mode 100644 index a2ecc456eb..0000000000 --- a/test/sys/kernel/slab/sighand_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -154 diff --git a/test/sys/kernel/slab/sighand_cache/trace b/test/sys/kernel/slab/sighand_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sighand_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sighand_cache/validate b/test/sys/kernel/slab/sighand_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/signal_cache/aliases b/test/sys/kernel/slab/signal_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/signal_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/signal_cache/align b/test/sys/kernel/slab/signal_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/signal_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/signal_cache/alloc_calls b/test/sys/kernel/slab/signal_cache/alloc_calls deleted file mode 100644 index 2b46f3fcf6..0000000000 --- a/test/sys/kernel/slab/signal_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 124 copy_process+0x93c/0x1220 age=4145/7851187/8379914 pid=0-12336 cpus=0-1 diff --git a/test/sys/kernel/slab/signal_cache/cache_dma b/test/sys/kernel/slab/signal_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/signal_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/signal_cache/cpu_slabs b/test/sys/kernel/slab/signal_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/signal_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/signal_cache/ctor b/test/sys/kernel/slab/signal_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/signal_cache/destroy_by_rcu b/test/sys/kernel/slab/signal_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/signal_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/signal_cache/free_calls b/test/sys/kernel/slab/signal_cache/free_calls deleted file mode 100644 index e3300fb82a..0000000000 --- a/test/sys/kernel/slab/signal_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 42 age=4303047259 pid=0 cpus=0 - 82 __cleanup_signal+0x20/0x30 age=7186/7586663/8375843 pid=1-13288 cpus=0-1 diff --git a/test/sys/kernel/slab/signal_cache/hwcache_align b/test/sys/kernel/slab/signal_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/signal_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/signal_cache/object_size b/test/sys/kernel/slab/signal_cache/object_size deleted file mode 100644 index 4564b1f0a0..0000000000 --- a/test/sys/kernel/slab/signal_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -896 diff --git a/test/sys/kernel/slab/signal_cache/objects b/test/sys/kernel/slab/signal_cache/objects deleted file mode 100644 index fa8f08cb6f..0000000000 --- a/test/sys/kernel/slab/signal_cache/objects +++ /dev/null @@ -1 +0,0 @@ -150 diff --git a/test/sys/kernel/slab/signal_cache/objects_partial b/test/sys/kernel/slab/signal_cache/objects_partial deleted file mode 100644 index 2bbd69c2e5..0000000000 --- a/test/sys/kernel/slab/signal_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -70 diff --git a/test/sys/kernel/slab/signal_cache/objs_per_slab b/test/sys/kernel/slab/signal_cache/objs_per_slab deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/signal_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/signal_cache/order b/test/sys/kernel/slab/signal_cache/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/signal_cache/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/signal_cache/partial b/test/sys/kernel/slab/signal_cache/partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/signal_cache/partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/signal_cache/poison b/test/sys/kernel/slab/signal_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/signal_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/signal_cache/reclaim_account b/test/sys/kernel/slab/signal_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/signal_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/signal_cache/red_zone b/test/sys/kernel/slab/signal_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/signal_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/signal_cache/sanity_checks b/test/sys/kernel/slab/signal_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/signal_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/signal_cache/shrink b/test/sys/kernel/slab/signal_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/signal_cache/slab_size b/test/sys/kernel/slab/signal_cache/slab_size deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/kernel/slab/signal_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/kernel/slab/signal_cache/slabs b/test/sys/kernel/slab/signal_cache/slabs deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/kernel/slab/signal_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/kernel/slab/signal_cache/store_user b/test/sys/kernel/slab/signal_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/signal_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/signal_cache/total_objects b/test/sys/kernel/slab/signal_cache/total_objects deleted file mode 100644 index a76256037d..0000000000 --- a/test/sys/kernel/slab/signal_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -160 diff --git a/test/sys/kernel/slab/signal_cache/trace b/test/sys/kernel/slab/signal_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/signal_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/signal_cache/validate b/test/sys/kernel/slab/signal_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sigqueue/aliases b/test/sys/kernel/slab/sigqueue/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/align b/test/sys/kernel/slab/sigqueue/align deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/sigqueue/align +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/sigqueue/alloc_calls b/test/sys/kernel/slab/sigqueue/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/sigqueue/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/sigqueue/cache_dma b/test/sys/kernel/slab/sigqueue/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/cpu_slabs b/test/sys/kernel/slab/sigqueue/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/ctor b/test/sys/kernel/slab/sigqueue/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sigqueue/destroy_by_rcu b/test/sys/kernel/slab/sigqueue/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/free_calls b/test/sys/kernel/slab/sigqueue/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/sigqueue/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/sigqueue/hwcache_align b/test/sys/kernel/slab/sigqueue/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/object_size b/test/sys/kernel/slab/sigqueue/object_size deleted file mode 100644 index a76256037d..0000000000 --- a/test/sys/kernel/slab/sigqueue/object_size +++ /dev/null @@ -1 +0,0 @@ -160 diff --git a/test/sys/kernel/slab/sigqueue/objects b/test/sys/kernel/slab/sigqueue/objects deleted file mode 100644 index a787364590..0000000000 --- a/test/sys/kernel/slab/sigqueue/objects +++ /dev/null @@ -1 +0,0 @@ -34 diff --git a/test/sys/kernel/slab/sigqueue/objects_partial b/test/sys/kernel/slab/sigqueue/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/objs_per_slab b/test/sys/kernel/slab/sigqueue/objs_per_slab deleted file mode 100644 index 98d9bcb75a..0000000000 --- a/test/sys/kernel/slab/sigqueue/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/test/sys/kernel/slab/sigqueue/order b/test/sys/kernel/slab/sigqueue/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/partial b/test/sys/kernel/slab/sigqueue/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/poison b/test/sys/kernel/slab/sigqueue/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sigqueue/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sigqueue/reclaim_account b/test/sys/kernel/slab/sigqueue/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/red_zone b/test/sys/kernel/slab/sigqueue/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sigqueue/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sigqueue/sanity_checks b/test/sys/kernel/slab/sigqueue/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sigqueue/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sigqueue/shrink b/test/sys/kernel/slab/sigqueue/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sigqueue/slab_size b/test/sys/kernel/slab/sigqueue/slab_size deleted file mode 100644 index 7c022aedd2..0000000000 --- a/test/sys/kernel/slab/sigqueue/slab_size +++ /dev/null @@ -1 +0,0 @@ -232 diff --git a/test/sys/kernel/slab/sigqueue/slabs b/test/sys/kernel/slab/sigqueue/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/sigqueue/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/sigqueue/store_user b/test/sys/kernel/slab/sigqueue/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sigqueue/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sigqueue/total_objects b/test/sys/kernel/slab/sigqueue/total_objects deleted file mode 100644 index a787364590..0000000000 --- a/test/sys/kernel/slab/sigqueue/total_objects +++ /dev/null @@ -1 +0,0 @@ -34 diff --git a/test/sys/kernel/slab/sigqueue/trace b/test/sys/kernel/slab/sigqueue/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sigqueue/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sigqueue/validate b/test/sys/kernel/slab/sigqueue/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/aliases b/test/sys/kernel/slab/skbuff_fclone_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/align b/test/sys/kernel/slab/skbuff_fclone_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/alloc_calls b/test/sys/kernel/slab/skbuff_fclone_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/cache_dma b/test/sys/kernel/slab/skbuff_fclone_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs b/test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/ctor b/test/sys/kernel/slab/skbuff_fclone_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/destroy_by_rcu b/test/sys/kernel/slab/skbuff_fclone_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/free_calls b/test/sys/kernel/slab/skbuff_fclone_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/hwcache_align b/test/sys/kernel/slab/skbuff_fclone_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/object_size b/test/sys/kernel/slab/skbuff_fclone_cache/object_size deleted file mode 100644 index 816d01be5c..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -420 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/objects b/test/sys/kernel/slab/skbuff_fclone_cache/objects deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/objects +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/objects_partial b/test/sys/kernel/slab/skbuff_fclone_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/objs_per_slab b/test/sys/kernel/slab/skbuff_fclone_cache/objs_per_slab deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/order b/test/sys/kernel/slab/skbuff_fclone_cache/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/partial b/test/sys/kernel/slab/skbuff_fclone_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/poison b/test/sys/kernel/slab/skbuff_fclone_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/reclaim_account b/test/sys/kernel/slab/skbuff_fclone_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/red_zone b/test/sys/kernel/slab/skbuff_fclone_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/sanity_checks b/test/sys/kernel/slab/skbuff_fclone_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/shrink b/test/sys/kernel/slab/skbuff_fclone_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/slab_size b/test/sys/kernel/slab/skbuff_fclone_cache/slab_size deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/slabs b/test/sys/kernel/slab/skbuff_fclone_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/store_user b/test/sys/kernel/slab/skbuff_fclone_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/total_objects b/test/sys/kernel/slab/skbuff_fclone_cache/total_objects deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/trace b/test/sys/kernel/slab/skbuff_fclone_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_fclone_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_fclone_cache/validate b/test/sys/kernel/slab/skbuff_fclone_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/skbuff_head_cache/aliases b/test/sys/kernel/slab/skbuff_head_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/align b/test/sys/kernel/slab/skbuff_head_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/alloc_calls b/test/sys/kernel/slab/skbuff_head_cache/alloc_calls deleted file mode 100644 index ced571b9e9..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 550 __alloc_skb+0x44/0x150 age=1665/3999351/8355948 pid=733-1738 cpus=0-1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/cache_dma b/test/sys/kernel/slab/skbuff_head_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/cpu_slabs b/test/sys/kernel/slab/skbuff_head_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/ctor b/test/sys/kernel/slab/skbuff_head_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/skbuff_head_cache/destroy_by_rcu b/test/sys/kernel/slab/skbuff_head_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/free_calls b/test/sys/kernel/slab/skbuff_head_cache/free_calls deleted file mode 100644 index 6019669a16..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 333 age=4303046979 pid=0 cpus=0 - 217 __kfree_skb+0x3a/0xa0 age=1666/662694/8356220 pid=0-13466 cpus=0-1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/hwcache_align b/test/sys/kernel/slab/skbuff_head_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/object_size b/test/sys/kernel/slab/skbuff_head_cache/object_size deleted file mode 100644 index 7d645f5893..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -208 diff --git a/test/sys/kernel/slab/skbuff_head_cache/objects b/test/sys/kernel/slab/skbuff_head_cache/objects deleted file mode 100644 index 5629a95847..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/objects +++ /dev/null @@ -1 +0,0 @@ -570 diff --git a/test/sys/kernel/slab/skbuff_head_cache/objects_partial b/test/sys/kernel/slab/skbuff_head_cache/objects_partial deleted file mode 100644 index 3c032078a4..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/test/sys/kernel/slab/skbuff_head_cache/objs_per_slab b/test/sys/kernel/slab/skbuff_head_cache/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/skbuff_head_cache/order b/test/sys/kernel/slab/skbuff_head_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/partial b/test/sys/kernel/slab/skbuff_head_cache/partial deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/partial +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/skbuff_head_cache/poison b/test/sys/kernel/slab/skbuff_head_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/reclaim_account b/test/sys/kernel/slab/skbuff_head_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/red_zone b/test/sys/kernel/slab/skbuff_head_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/sanity_checks b/test/sys/kernel/slab/skbuff_head_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/shrink b/test/sys/kernel/slab/skbuff_head_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/skbuff_head_cache/slab_size b/test/sys/kernel/slab/skbuff_head_cache/slab_size deleted file mode 100644 index 18eed1357e..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -320 diff --git a/test/sys/kernel/slab/skbuff_head_cache/slabs b/test/sys/kernel/slab/skbuff_head_cache/slabs deleted file mode 100644 index 95f9650f01..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -49 diff --git a/test/sys/kernel/slab/skbuff_head_cache/store_user b/test/sys/kernel/slab/skbuff_head_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/skbuff_head_cache/total_objects b/test/sys/kernel/slab/skbuff_head_cache/total_objects deleted file mode 100644 index 9745b4bc48..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -588 diff --git a/test/sys/kernel/slab/skbuff_head_cache/trace b/test/sys/kernel/slab/skbuff_head_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/skbuff_head_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/skbuff_head_cache/validate b/test/sys/kernel/slab/skbuff_head_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sock_inode_cache/aliases b/test/sys/kernel/slab/sock_inode_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sock_inode_cache/align b/test/sys/kernel/slab/sock_inode_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sock_inode_cache/alloc_calls b/test/sys/kernel/slab/sock_inode_cache/alloc_calls deleted file mode 100644 index 3bedaaa4a5..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 481 sock_alloc_inode+0x1a/0x70 age=61330/8214562/8379530 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/sock_inode_cache/cache_dma b/test/sys/kernel/slab/sock_inode_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sock_inode_cache/cpu_slabs b/test/sys/kernel/slab/sock_inode_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sock_inode_cache/ctor b/test/sys/kernel/slab/sock_inode_cache/ctor deleted file mode 100644 index 2940046f62..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/ctor +++ /dev/null @@ -1 +0,0 @@ -init_once+0x0/0x10 diff --git a/test/sys/kernel/slab/sock_inode_cache/destroy_by_rcu b/test/sys/kernel/slab/sock_inode_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sock_inode_cache/free_calls b/test/sys/kernel/slab/sock_inode_cache/free_calls deleted file mode 100644 index c8fa1afa71..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 276 age=4303046961 pid=0 cpus=0 - 205 sock_destroy_inode+0x14/0x20 age=61348/8035806/8376228 pid=76-20292 cpus=0-1 diff --git a/test/sys/kernel/slab/sock_inode_cache/hwcache_align b/test/sys/kernel/slab/sock_inode_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sock_inode_cache/object_size b/test/sys/kernel/slab/sock_inode_cache/object_size deleted file mode 100644 index 8cdd21dbcb..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -1192 diff --git a/test/sys/kernel/slab/sock_inode_cache/objects b/test/sys/kernel/slab/sock_inode_cache/objects deleted file mode 100644 index 84fa17bc22..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/objects +++ /dev/null @@ -1 +0,0 @@ -491 diff --git a/test/sys/kernel/slab/sock_inode_cache/objects_partial b/test/sys/kernel/slab/sock_inode_cache/objects_partial deleted file mode 100644 index 76a8b2b703..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -83 diff --git a/test/sys/kernel/slab/sock_inode_cache/objs_per_slab b/test/sys/kernel/slab/sock_inode_cache/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/sock_inode_cache/order b/test/sys/kernel/slab/sock_inode_cache/order deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/order +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/sock_inode_cache/partial b/test/sys/kernel/slab/sock_inode_cache/partial deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/partial +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/kernel/slab/sock_inode_cache/poison b/test/sys/kernel/slab/sock_inode_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sock_inode_cache/reclaim_account b/test/sys/kernel/slab/sock_inode_cache/reclaim_account deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sock_inode_cache/red_zone b/test/sys/kernel/slab/sock_inode_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sock_inode_cache/sanity_checks b/test/sys/kernel/slab/sock_inode_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sock_inode_cache/shrink b/test/sys/kernel/slab/sock_inode_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sock_inode_cache/slab_size b/test/sys/kernel/slab/sock_inode_cache/slab_size deleted file mode 100644 index 003638ac6a..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -1280 diff --git a/test/sys/kernel/slab/sock_inode_cache/slabs b/test/sys/kernel/slab/sock_inode_cache/slabs deleted file mode 100644 index d81cc0710e..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -42 diff --git a/test/sys/kernel/slab/sock_inode_cache/store_user b/test/sys/kernel/slab/sock_inode_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sock_inode_cache/total_objects b/test/sys/kernel/slab/sock_inode_cache/total_objects deleted file mode 100644 index 3091e8eea2..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -504 diff --git a/test/sys/kernel/slab/sock_inode_cache/trace b/test/sys/kernel/slab/sock_inode_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sock_inode_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sock_inode_cache/validate b/test/sys/kernel/slab/sock_inode_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/aliases b/test/sys/kernel/slab/sysfs_dir_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/align b/test/sys/kernel/slab/sysfs_dir_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls b/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls deleted file mode 100644 index f981f4d922..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 11488 sysfs_new_dirent+0x38/0x120 age=22320/7764235/8379787 pid=0-13295 cpus=0-1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/cache_dma b/test/sys/kernel/slab/sysfs_dir_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs b/test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/ctor b/test/sys/kernel/slab/sysfs_dir_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu b/test/sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/free_calls b/test/sys/kernel/slab/sysfs_dir_cache/free_calls deleted file mode 100644 index 106265d1ce..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 11006 age=4303047087 pid=0 cpus=0 - 482 release_sysfs_dirent+0x5c/0xd0 age=61294/6319346/8379456 pid=1-2141 cpus=0-1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/hwcache_align b/test/sys/kernel/slab/sysfs_dir_cache/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/object_size b/test/sys/kernel/slab/sysfs_dir_cache/object_size deleted file mode 100644 index d15a2cc44e..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -80 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/objects b/test/sys/kernel/slab/sysfs_dir_cache/objects deleted file mode 100644 index 7b8df03e20..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/objects +++ /dev/null @@ -1 +0,0 @@ -11518 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/objects_partial b/test/sys/kernel/slab/sysfs_dir_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab b/test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab deleted file mode 100644 index 6f4247a625..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -26 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/order b/test/sys/kernel/slab/sysfs_dir_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/partial b/test/sys/kernel/slab/sysfs_dir_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/poison b/test/sys/kernel/slab/sysfs_dir_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/reclaim_account b/test/sys/kernel/slab/sysfs_dir_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/red_zone b/test/sys/kernel/slab/sysfs_dir_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/sanity_checks b/test/sys/kernel/slab/sysfs_dir_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/shrink b/test/sys/kernel/slab/sysfs_dir_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/slab_size b/test/sys/kernel/slab/sysfs_dir_cache/slab_size deleted file mode 100644 index 492dff089a..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -152 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/slabs b/test/sys/kernel/slab/sysfs_dir_cache/slabs deleted file mode 100644 index 6a13cf62b5..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -443 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/store_user b/test/sys/kernel/slab/sysfs_dir_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/total_objects b/test/sys/kernel/slab/sysfs_dir_cache/total_objects deleted file mode 100644 index 7b8df03e20..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -11518 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/trace b/test/sys/kernel/slab/sysfs_dir_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/sysfs_dir_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/sysfs_dir_cache/validate b/test/sys/kernel/slab/sysfs_dir_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/task_struct/aliases b/test/sys/kernel/slab/task_struct/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_struct/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_struct/align b/test/sys/kernel/slab/task_struct/align deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/task_struct/align +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/task_struct/alloc_calls b/test/sys/kernel/slab/task_struct/alloc_calls deleted file mode 100644 index 6cf8b6a510..0000000000 --- a/test/sys/kernel/slab/task_struct/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 203 copy_process+0xa4/0x1220 age=4172/8008848/8379941 pid=0-13212 cpus=0-1 diff --git a/test/sys/kernel/slab/task_struct/cache_dma b/test/sys/kernel/slab/task_struct/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_struct/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_struct/cpu_slabs b/test/sys/kernel/slab/task_struct/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_struct/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_struct/ctor b/test/sys/kernel/slab/task_struct/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/task_struct/destroy_by_rcu b/test/sys/kernel/slab/task_struct/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_struct/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_struct/free_calls b/test/sys/kernel/slab/task_struct/free_calls deleted file mode 100644 index 70adce49ce..0000000000 --- a/test/sys/kernel/slab/task_struct/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 93 age=4303047286 pid=0 cpus=0 - 110 free_task+0x30/0x40 age=7208/7706854/8377050 pid=0-13258 cpus=0-1 diff --git a/test/sys/kernel/slab/task_struct/hwcache_align b/test/sys/kernel/slab/task_struct/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_struct/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_struct/object_size b/test/sys/kernel/slab/task_struct/object_size deleted file mode 100644 index 2ac9252254..0000000000 --- a/test/sys/kernel/slab/task_struct/object_size +++ /dev/null @@ -1 +0,0 @@ -4320 diff --git a/test/sys/kernel/slab/task_struct/objects b/test/sys/kernel/slab/task_struct/objects deleted file mode 100644 index dba40afcf7..0000000000 --- a/test/sys/kernel/slab/task_struct/objects +++ /dev/null @@ -1 +0,0 @@ -211 diff --git a/test/sys/kernel/slab/task_struct/objects_partial b/test/sys/kernel/slab/task_struct/objects_partial deleted file mode 100644 index e1617e842a..0000000000 --- a/test/sys/kernel/slab/task_struct/objects_partial +++ /dev/null @@ -1 +0,0 @@ -57 diff --git a/test/sys/kernel/slab/task_struct/objs_per_slab b/test/sys/kernel/slab/task_struct/objs_per_slab deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/kernel/slab/task_struct/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/kernel/slab/task_struct/order b/test/sys/kernel/slab/task_struct/order deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/kernel/slab/task_struct/order +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/kernel/slab/task_struct/partial b/test/sys/kernel/slab/task_struct/partial deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/kernel/slab/task_struct/partial +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/kernel/slab/task_struct/poison b/test/sys/kernel/slab/task_struct/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/task_struct/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/task_struct/reclaim_account b/test/sys/kernel/slab/task_struct/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_struct/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_struct/red_zone b/test/sys/kernel/slab/task_struct/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/task_struct/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/task_struct/sanity_checks b/test/sys/kernel/slab/task_struct/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/task_struct/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/task_struct/shrink b/test/sys/kernel/slab/task_struct/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/task_struct/slab_size b/test/sys/kernel/slab/task_struct/slab_size deleted file mode 100644 index f993a70588..0000000000 --- a/test/sys/kernel/slab/task_struct/slab_size +++ /dev/null @@ -1 +0,0 @@ -4400 diff --git a/test/sys/kernel/slab/task_struct/slabs b/test/sys/kernel/slab/task_struct/slabs deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/task_struct/slabs +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/task_struct/store_user b/test/sys/kernel/slab/task_struct/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/task_struct/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/task_struct/total_objects b/test/sys/kernel/slab/task_struct/total_objects deleted file mode 100644 index 20c90807cc..0000000000 --- a/test/sys/kernel/slab/task_struct/total_objects +++ /dev/null @@ -1 +0,0 @@ -224 diff --git a/test/sys/kernel/slab/task_struct/trace b/test/sys/kernel/slab/task_struct/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_struct/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_struct/validate b/test/sys/kernel/slab/task_struct/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/task_xstate/aliases b/test/sys/kernel/slab/task_xstate/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_xstate/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_xstate/align b/test/sys/kernel/slab/task_xstate/align deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/task_xstate/align +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/task_xstate/alloc_calls b/test/sys/kernel/slab/task_xstate/alloc_calls deleted file mode 100644 index bbb81f8450..0000000000 --- a/test/sys/kernel/slab/task_xstate/alloc_calls +++ /dev/null @@ -1,2 +0,0 @@ - 99 arch_dup_task_struct+0x51/0xa0 age=125559/8275901/8376574 pid=71-13212 cpus=0-1 - 51 init_fpu+0xef/0x110 age=4157/7436734/8378165 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/task_xstate/cache_dma b/test/sys/kernel/slab/task_xstate/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_xstate/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_xstate/cpu_slabs b/test/sys/kernel/slab/task_xstate/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_xstate/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_xstate/ctor b/test/sys/kernel/slab/task_xstate/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/task_xstate/destroy_by_rcu b/test/sys/kernel/slab/task_xstate/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_xstate/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_xstate/free_calls b/test/sys/kernel/slab/task_xstate/free_calls deleted file mode 100644 index d32655a8bb..0000000000 --- a/test/sys/kernel/slab/task_xstate/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 53 age=4303047277 pid=0 cpus=0 - 97 free_thread_xstate+0x24/0x40 age=7199/7795238/8375118 pid=0-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/task_xstate/hwcache_align b/test/sys/kernel/slab/task_xstate/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_xstate/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_xstate/object_size b/test/sys/kernel/slab/task_xstate/object_size deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/kernel/slab/task_xstate/object_size +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/kernel/slab/task_xstate/objects b/test/sys/kernel/slab/task_xstate/objects deleted file mode 100644 index 9386c220a1..0000000000 --- a/test/sys/kernel/slab/task_xstate/objects +++ /dev/null @@ -1 +0,0 @@ -161 diff --git a/test/sys/kernel/slab/task_xstate/objects_partial b/test/sys/kernel/slab/task_xstate/objects_partial deleted file mode 100644 index e1617e842a..0000000000 --- a/test/sys/kernel/slab/task_xstate/objects_partial +++ /dev/null @@ -1 +0,0 @@ -57 diff --git a/test/sys/kernel/slab/task_xstate/objs_per_slab b/test/sys/kernel/slab/task_xstate/objs_per_slab deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/kernel/slab/task_xstate/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/kernel/slab/task_xstate/order b/test/sys/kernel/slab/task_xstate/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/task_xstate/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/task_xstate/partial b/test/sys/kernel/slab/task_xstate/partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/task_xstate/partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/task_xstate/poison b/test/sys/kernel/slab/task_xstate/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/task_xstate/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/task_xstate/reclaim_account b/test/sys/kernel/slab/task_xstate/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_xstate/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_xstate/red_zone b/test/sys/kernel/slab/task_xstate/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/task_xstate/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/task_xstate/sanity_checks b/test/sys/kernel/slab/task_xstate/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/task_xstate/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/task_xstate/shrink b/test/sys/kernel/slab/task_xstate/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/task_xstate/slab_size b/test/sys/kernel/slab/task_xstate/slab_size deleted file mode 100644 index 7cbee132c8..0000000000 --- a/test/sys/kernel/slab/task_xstate/slab_size +++ /dev/null @@ -1 +0,0 @@ -592 diff --git a/test/sys/kernel/slab/task_xstate/slabs b/test/sys/kernel/slab/task_xstate/slabs deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/kernel/slab/task_xstate/slabs +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/kernel/slab/task_xstate/store_user b/test/sys/kernel/slab/task_xstate/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/task_xstate/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/task_xstate/total_objects b/test/sys/kernel/slab/task_xstate/total_objects deleted file mode 100644 index fb402ef6a4..0000000000 --- a/test/sys/kernel/slab/task_xstate/total_objects +++ /dev/null @@ -1 +0,0 @@ -169 diff --git a/test/sys/kernel/slab/task_xstate/trace b/test/sys/kernel/slab/task_xstate/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/task_xstate/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/task_xstate/validate b/test/sys/kernel/slab/task_xstate/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/aliases b/test/sys/kernel/slab/tcp_bind_bucket/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/align b/test/sys/kernel/slab/tcp_bind_bucket/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls b/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls deleted file mode 100644 index df53b0e220..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 3 inet_bind_bucket_create+0x27/0x80 age=926731/5878918/8356133 pid=1206-1920 cpus=0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/cache_dma b/test/sys/kernel/slab/tcp_bind_bucket/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs b/test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/ctor b/test/sys/kernel/slab/tcp_bind_bucket/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu b/test/sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/free_calls b/test/sys/kernel/slab/tcp_bind_bucket/free_calls deleted file mode 100644 index 55e14069c5..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 1 age=4303046680 pid=0 cpus=0 - 2 inet_bind_bucket_destroy+0x29/0x30 age=1107644/4731733/8355822 pid=0-1707 cpus=0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/hwcache_align b/test/sys/kernel/slab/tcp_bind_bucket/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/object_size b/test/sys/kernel/slab/tcp_bind_bucket/object_size deleted file mode 100644 index 425151f3a4..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/object_size +++ /dev/null @@ -1 +0,0 @@ -40 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/objects b/test/sys/kernel/slab/tcp_bind_bucket/objects deleted file mode 100644 index a787364590..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/objects +++ /dev/null @@ -1 +0,0 @@ -34 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/objects_partial b/test/sys/kernel/slab/tcp_bind_bucket/objects_partial deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/objects_partial +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab b/test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/order b/test/sys/kernel/slab/tcp_bind_bucket/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/partial b/test/sys/kernel/slab/tcp_bind_bucket/partial deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/partial +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/poison b/test/sys/kernel/slab/tcp_bind_bucket/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/reclaim_account b/test/sys/kernel/slab/tcp_bind_bucket/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/red_zone b/test/sys/kernel/slab/tcp_bind_bucket/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/sanity_checks b/test/sys/kernel/slab/tcp_bind_bucket/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/shrink b/test/sys/kernel/slab/tcp_bind_bucket/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/slab_size b/test/sys/kernel/slab/tcp_bind_bucket/slab_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/slab_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/slabs b/test/sys/kernel/slab/tcp_bind_bucket/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/store_user b/test/sys/kernel/slab/tcp_bind_bucket/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/total_objects b/test/sys/kernel/slab/tcp_bind_bucket/total_objects deleted file mode 100644 index 900731ffd5..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/total_objects +++ /dev/null @@ -1 +0,0 @@ -64 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/trace b/test/sys/kernel/slab/tcp_bind_bucket/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tcp_bind_bucket/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tcp_bind_bucket/validate b/test/sys/kernel/slab/tcp_bind_bucket/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/tw_sock_TCP/aliases b/test/sys/kernel/slab/tw_sock_TCP/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/align b/test/sys/kernel/slab/tw_sock_TCP/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/alloc_calls b/test/sys/kernel/slab/tw_sock_TCP/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/tw_sock_TCP/cache_dma b/test/sys/kernel/slab/tw_sock_TCP/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/cpu_slabs b/test/sys/kernel/slab/tw_sock_TCP/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/ctor b/test/sys/kernel/slab/tw_sock_TCP/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu b/test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/free_calls b/test/sys/kernel/slab/tw_sock_TCP/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/tw_sock_TCP/hwcache_align b/test/sys/kernel/slab/tw_sock_TCP/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/object_size b/test/sys/kernel/slab/tw_sock_TCP/object_size deleted file mode 100644 index 7296f257eb..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/object_size +++ /dev/null @@ -1 +0,0 @@ -136 diff --git a/test/sys/kernel/slab/tw_sock_TCP/objects b/test/sys/kernel/slab/tw_sock_TCP/objects deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/objects +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/tw_sock_TCP/objects_partial b/test/sys/kernel/slab/tw_sock_TCP/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/objs_per_slab b/test/sys/kernel/slab/tw_sock_TCP/objs_per_slab deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/tw_sock_TCP/order b/test/sys/kernel/slab/tw_sock_TCP/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/partial b/test/sys/kernel/slab/tw_sock_TCP/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/poison b/test/sys/kernel/slab/tw_sock_TCP/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/reclaim_account b/test/sys/kernel/slab/tw_sock_TCP/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/red_zone b/test/sys/kernel/slab/tw_sock_TCP/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/sanity_checks b/test/sys/kernel/slab/tw_sock_TCP/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/shrink b/test/sys/kernel/slab/tw_sock_TCP/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/tw_sock_TCP/slab_size b/test/sys/kernel/slab/tw_sock_TCP/slab_size deleted file mode 100644 index 9183bf03fc..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/slab_size +++ /dev/null @@ -1 +0,0 @@ -256 diff --git a/test/sys/kernel/slab/tw_sock_TCP/slabs b/test/sys/kernel/slab/tw_sock_TCP/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/store_user b/test/sys/kernel/slab/tw_sock_TCP/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCP/total_objects b/test/sys/kernel/slab/tw_sock_TCP/total_objects deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/total_objects +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/tw_sock_TCP/trace b/test/sys/kernel/slab/tw_sock_TCP/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCP/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCP/validate b/test/sys/kernel/slab/tw_sock_TCP/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/aliases b/test/sys/kernel/slab/tw_sock_TCPv6/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/align b/test/sys/kernel/slab/tw_sock_TCPv6/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls b/test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/cache_dma b/test/sys/kernel/slab/tw_sock_TCPv6/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs b/test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/ctor b/test/sys/kernel/slab/tw_sock_TCPv6/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu b/test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/free_calls b/test/sys/kernel/slab/tw_sock_TCPv6/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align b/test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/object_size b/test/sys/kernel/slab/tw_sock_TCPv6/object_size deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/object_size +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/objects b/test/sys/kernel/slab/tw_sock_TCPv6/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/objects_partial b/test/sys/kernel/slab/tw_sock_TCPv6/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab b/test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab deleted file mode 100644 index b6a7d89c68..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -16 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/order b/test/sys/kernel/slab/tw_sock_TCPv6/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/partial b/test/sys/kernel/slab/tw_sock_TCPv6/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/poison b/test/sys/kernel/slab/tw_sock_TCPv6/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account b/test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/red_zone b/test/sys/kernel/slab/tw_sock_TCPv6/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks b/test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/shrink b/test/sys/kernel/slab/tw_sock_TCPv6/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/slab_size b/test/sys/kernel/slab/tw_sock_TCPv6/slab_size deleted file mode 100644 index 9183bf03fc..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/slab_size +++ /dev/null @@ -1 +0,0 @@ -256 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/slabs b/test/sys/kernel/slab/tw_sock_TCPv6/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/store_user b/test/sys/kernel/slab/tw_sock_TCPv6/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/total_objects b/test/sys/kernel/slab/tw_sock_TCPv6/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/trace b/test/sys/kernel/slab/tw_sock_TCPv6/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/tw_sock_TCPv6/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/tw_sock_TCPv6/validate b/test/sys/kernel/slab/tw_sock_TCPv6/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/uhci_urb_priv/aliases b/test/sys/kernel/slab/uhci_urb_priv/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/align b/test/sys/kernel/slab/uhci_urb_priv/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/alloc_calls b/test/sys/kernel/slab/uhci_urb_priv/alloc_calls deleted file mode 100644 index 6a6a516017..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 1 uhci_urb_enqueue+0xb6/0xa30 [uhci_hcd] age=53794 pid=419 cpus=0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/cache_dma b/test/sys/kernel/slab/uhci_urb_priv/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/cpu_slabs b/test/sys/kernel/slab/uhci_urb_priv/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/ctor b/test/sys/kernel/slab/uhci_urb_priv/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu b/test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/free_calls b/test/sys/kernel/slab/uhci_urb_priv/free_calls deleted file mode 100644 index 07c1ab764f..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/free_calls +++ /dev/null @@ -1 +0,0 @@ - 1 uhci_free_urb_priv+0x79/0xd0 [uhci_hcd] age=53806 pid=0 cpus=0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/hwcache_align b/test/sys/kernel/slab/uhci_urb_priv/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/object_size b/test/sys/kernel/slab/uhci_urb_priv/object_size deleted file mode 100644 index f6b91e0e1f..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/object_size +++ /dev/null @@ -1 +0,0 @@ -56 diff --git a/test/sys/kernel/slab/uhci_urb_priv/objects b/test/sys/kernel/slab/uhci_urb_priv/objects deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/objects +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/uhci_urb_priv/objects_partial b/test/sys/kernel/slab/uhci_urb_priv/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/objs_per_slab b/test/sys/kernel/slab/uhci_urb_priv/objs_per_slab deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/uhci_urb_priv/order b/test/sys/kernel/slab/uhci_urb_priv/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/partial b/test/sys/kernel/slab/uhci_urb_priv/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/poison b/test/sys/kernel/slab/uhci_urb_priv/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/reclaim_account b/test/sys/kernel/slab/uhci_urb_priv/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/red_zone b/test/sys/kernel/slab/uhci_urb_priv/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/sanity_checks b/test/sys/kernel/slab/uhci_urb_priv/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/shrink b/test/sys/kernel/slab/uhci_urb_priv/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/uhci_urb_priv/slab_size b/test/sys/kernel/slab/uhci_urb_priv/slab_size deleted file mode 100644 index a949a93dfc..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/slab_size +++ /dev/null @@ -1 +0,0 @@ -128 diff --git a/test/sys/kernel/slab/uhci_urb_priv/slabs b/test/sys/kernel/slab/uhci_urb_priv/slabs deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/slabs +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/store_user b/test/sys/kernel/slab/uhci_urb_priv/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uhci_urb_priv/total_objects b/test/sys/kernel/slab/uhci_urb_priv/total_objects deleted file mode 100644 index f5c89552bd..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/total_objects +++ /dev/null @@ -1 +0,0 @@ -32 diff --git a/test/sys/kernel/slab/uhci_urb_priv/trace b/test/sys/kernel/slab/uhci_urb_priv/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uhci_urb_priv/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uhci_urb_priv/validate b/test/sys/kernel/slab/uhci_urb_priv/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/uid_cache/aliases b/test/sys/kernel/slab/uid_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/align b/test/sys/kernel/slab/uid_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/alloc_calls b/test/sys/kernel/slab/uid_cache/alloc_calls deleted file mode 100644 index 52dc2b09a3..0000000000 --- a/test/sys/kernel/slab/uid_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ - 5 alloc_uid+0xbd/0x1e0 age=8351086/8358570/8366097 pid=1333-2177 cpus=0-1 diff --git a/test/sys/kernel/slab/uid_cache/cache_dma b/test/sys/kernel/slab/uid_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/cpu_slabs b/test/sys/kernel/slab/uid_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/ctor b/test/sys/kernel/slab/uid_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/uid_cache/destroy_by_rcu b/test/sys/kernel/slab/uid_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/free_calls b/test/sys/kernel/slab/uid_cache/free_calls deleted file mode 100644 index 74ef47db60..0000000000 --- a/test/sys/kernel/slab/uid_cache/free_calls +++ /dev/null @@ -1,2 +0,0 @@ - 2 age=4303046654 pid=0 cpus=0 - 3 remove_user_sysfs_dir+0xd0/0x100 age=8357175/8367109/8374935 pid=7 cpus=0 diff --git a/test/sys/kernel/slab/uid_cache/hwcache_align b/test/sys/kernel/slab/uid_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uid_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uid_cache/object_size b/test/sys/kernel/slab/uid_cache/object_size deleted file mode 100644 index a817176f4a..0000000000 --- a/test/sys/kernel/slab/uid_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -216 diff --git a/test/sys/kernel/slab/uid_cache/objects b/test/sys/kernel/slab/uid_cache/objects deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/uid_cache/objects +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/uid_cache/objects_partial b/test/sys/kernel/slab/uid_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/objs_per_slab b/test/sys/kernel/slab/uid_cache/objs_per_slab deleted file mode 100644 index 48082f72f0..0000000000 --- a/test/sys/kernel/slab/uid_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/test/sys/kernel/slab/uid_cache/order b/test/sys/kernel/slab/uid_cache/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/partial b/test/sys/kernel/slab/uid_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/poison b/test/sys/kernel/slab/uid_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uid_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uid_cache/reclaim_account b/test/sys/kernel/slab/uid_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/red_zone b/test/sys/kernel/slab/uid_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uid_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uid_cache/sanity_checks b/test/sys/kernel/slab/uid_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uid_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uid_cache/shrink b/test/sys/kernel/slab/uid_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/uid_cache/slab_size b/test/sys/kernel/slab/uid_cache/slab_size deleted file mode 100644 index 18eed1357e..0000000000 --- a/test/sys/kernel/slab/uid_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -320 diff --git a/test/sys/kernel/slab/uid_cache/slabs b/test/sys/kernel/slab/uid_cache/slabs deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/kernel/slab/uid_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/kernel/slab/uid_cache/store_user b/test/sys/kernel/slab/uid_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/uid_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/uid_cache/total_objects b/test/sys/kernel/slab/uid_cache/total_objects deleted file mode 100644 index a45fd52cc5..0000000000 --- a/test/sys/kernel/slab/uid_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -24 diff --git a/test/sys/kernel/slab/uid_cache/trace b/test/sys/kernel/slab/uid_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/uid_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/uid_cache/validate b/test/sys/kernel/slab/uid_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/vm_area_struct/aliases b/test/sys/kernel/slab/vm_area_struct/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/vm_area_struct/align b/test/sys/kernel/slab/vm_area_struct/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/vm_area_struct/alloc_calls b/test/sys/kernel/slab/vm_area_struct/alloc_calls deleted file mode 100644 index 333d4faaab..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/alloc_calls +++ /dev/null @@ -1,7 +0,0 @@ - 2751 dup_mm+0x194/0x390 age=8335622/8348807/8376522 pid=71-2467 cpus=0-1 - 52 install_special_mapping+0x3d/0xe0 age=4109/7453125/8378118 pid=1-20296 cpus=0-1 - 4006 split_vma+0x61/0x140 age=4107/7930710/8366050 pid=1206-20296 cpus=0-1 - 3 copy_vma+0x125/0x1b0 age=8353805/8353815/8353824 pid=1738 cpus=0 - 54 do_brk+0x2ec/0x360 age=4107/7486452/8378131 pid=1-20296 cpus=0-1 - 5097 mmap_region+0x195/0x5c0 age=4105/7877577/8378131 pid=1-20296 cpus=0-1 - 52 bprm_mm_init+0xa0/0x1b0 age=4109/7453192/8378134 pid=1-20296 cpus=0-1 diff --git a/test/sys/kernel/slab/vm_area_struct/cache_dma b/test/sys/kernel/slab/vm_area_struct/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/vm_area_struct/cpu_slabs b/test/sys/kernel/slab/vm_area_struct/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/vm_area_struct/ctor b/test/sys/kernel/slab/vm_area_struct/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/vm_area_struct/destroy_by_rcu b/test/sys/kernel/slab/vm_area_struct/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/vm_area_struct/free_calls b/test/sys/kernel/slab/vm_area_struct/free_calls deleted file mode 100644 index e9c6dc59f1..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/free_calls +++ /dev/null @@ -1,3 +0,0 @@ - 6424 age=4303047229 pid=0 cpus=0 - 5590 remove_vma+0x53/0x70 age=4110/7683818/8376767 pid=71-20296 cpus=0-1 - 1 vma_adjust+0x32c/0x570 age=8364245 pid=1371 cpus=0 diff --git a/test/sys/kernel/slab/vm_area_struct/hwcache_align b/test/sys/kernel/slab/vm_area_struct/hwcache_align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/vm_area_struct/object_size b/test/sys/kernel/slab/vm_area_struct/object_size deleted file mode 100644 index de8febe1c7..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/object_size +++ /dev/null @@ -1 +0,0 @@ -168 diff --git a/test/sys/kernel/slab/vm_area_struct/objects b/test/sys/kernel/slab/vm_area_struct/objects deleted file mode 100644 index 8e868178cd..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/objects +++ /dev/null @@ -1 +0,0 @@ -12049 diff --git a/test/sys/kernel/slab/vm_area_struct/objects_partial b/test/sys/kernel/slab/vm_area_struct/objects_partial deleted file mode 100644 index abac1ea7b7..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/objects_partial +++ /dev/null @@ -1 +0,0 @@ -47 diff --git a/test/sys/kernel/slab/vm_area_struct/objs_per_slab b/test/sys/kernel/slab/vm_area_struct/objs_per_slab deleted file mode 100644 index 98d9bcb75a..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -17 diff --git a/test/sys/kernel/slab/vm_area_struct/order b/test/sys/kernel/slab/vm_area_struct/order deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/order +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/vm_area_struct/partial b/test/sys/kernel/slab/vm_area_struct/partial deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/partial +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/kernel/slab/vm_area_struct/poison b/test/sys/kernel/slab/vm_area_struct/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/vm_area_struct/reclaim_account b/test/sys/kernel/slab/vm_area_struct/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/vm_area_struct/red_zone b/test/sys/kernel/slab/vm_area_struct/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/vm_area_struct/sanity_checks b/test/sys/kernel/slab/vm_area_struct/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/vm_area_struct/shrink b/test/sys/kernel/slab/vm_area_struct/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/vm_area_struct/slab_size b/test/sys/kernel/slab/vm_area_struct/slab_size deleted file mode 100644 index eb08bc0b0b..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/slab_size +++ /dev/null @@ -1 +0,0 @@ -240 diff --git a/test/sys/kernel/slab/vm_area_struct/slabs b/test/sys/kernel/slab/vm_area_struct/slabs deleted file mode 100644 index b4b6dc3489..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/slabs +++ /dev/null @@ -1 +0,0 @@ -711 diff --git a/test/sys/kernel/slab/vm_area_struct/store_user b/test/sys/kernel/slab/vm_area_struct/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/vm_area_struct/total_objects b/test/sys/kernel/slab/vm_area_struct/total_objects deleted file mode 100644 index 4442e72281..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/total_objects +++ /dev/null @@ -1 +0,0 @@ -12087 diff --git a/test/sys/kernel/slab/vm_area_struct/trace b/test/sys/kernel/slab/vm_area_struct/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/vm_area_struct/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/vm_area_struct/validate b/test/sys/kernel/slab/vm_area_struct/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/aliases b/test/sys/kernel/slab/xfrm_dst_cache/aliases deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/aliases +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/align b/test/sys/kernel/slab/xfrm_dst_cache/align deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/align +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/alloc_calls b/test/sys/kernel/slab/xfrm_dst_cache/alloc_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/alloc_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/xfrm_dst_cache/cache_dma b/test/sys/kernel/slab/xfrm_dst_cache/cache_dma deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/cache_dma +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs b/test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/cpu_slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/ctor b/test/sys/kernel/slab/xfrm_dst_cache/ctor deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu b/test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/destroy_by_rcu +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/free_calls b/test/sys/kernel/slab/xfrm_dst_cache/free_calls deleted file mode 100644 index 923bedcfa7..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/free_calls +++ /dev/null @@ -1 +0,0 @@ -No data diff --git a/test/sys/kernel/slab/xfrm_dst_cache/hwcache_align b/test/sys/kernel/slab/xfrm_dst_cache/hwcache_align deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/hwcache_align +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/object_size b/test/sys/kernel/slab/xfrm_dst_cache/object_size deleted file mode 100644 index 4772052f59..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/object_size +++ /dev/null @@ -1 +0,0 @@ -344 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/objects b/test/sys/kernel/slab/xfrm_dst_cache/objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/objects_partial b/test/sys/kernel/slab/xfrm_dst_cache/objects_partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/objects_partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab b/test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab deleted file mode 100644 index 3c032078a4..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/objs_per_slab +++ /dev/null @@ -1 +0,0 @@ -18 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/order b/test/sys/kernel/slab/xfrm_dst_cache/order deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/order +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/partial b/test/sys/kernel/slab/xfrm_dst_cache/partial deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/partial +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/poison b/test/sys/kernel/slab/xfrm_dst_cache/poison deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/poison +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/reclaim_account b/test/sys/kernel/slab/xfrm_dst_cache/reclaim_account deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/reclaim_account +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/red_zone b/test/sys/kernel/slab/xfrm_dst_cache/red_zone deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/red_zone +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/sanity_checks b/test/sys/kernel/slab/xfrm_dst_cache/sanity_checks deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/sanity_checks +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/shrink b/test/sys/kernel/slab/xfrm_dst_cache/shrink deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/slab_size b/test/sys/kernel/slab/xfrm_dst_cache/slab_size deleted file mode 100644 index 5379c470da..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/slab_size +++ /dev/null @@ -1 +0,0 @@ -448 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/slabs b/test/sys/kernel/slab/xfrm_dst_cache/slabs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/slabs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/store_user b/test/sys/kernel/slab/xfrm_dst_cache/store_user deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/store_user +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/total_objects b/test/sys/kernel/slab/xfrm_dst_cache/total_objects deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/total_objects +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/trace b/test/sys/kernel/slab/xfrm_dst_cache/trace deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/kernel/slab/xfrm_dst_cache/trace +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/kernel/slab/xfrm_dst_cache/validate b/test/sys/kernel/slab/xfrm_dst_cache/validate deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/test/sys/kernel/uevent_helper b/test/sys/kernel/uevent_helper deleted file mode 100644 index 8b13789179..0000000000 --- a/test/sys/kernel/uevent_helper +++ /dev/null @@ -1 +0,0 @@ - diff --git a/test/sys/kernel/uevent_seqnum b/test/sys/kernel/uevent_seqnum deleted file mode 100644 index a11d586ce9..0000000000 --- a/test/sys/kernel/uevent_seqnum +++ /dev/null @@ -1 +0,0 @@ -1407 diff --git a/test/sys/kernel/uids/0/cpu_share b/test/sys/kernel/uids/0/cpu_share deleted file mode 100644 index c873496a22..0000000000 --- a/test/sys/kernel/uids/0/cpu_share +++ /dev/null @@ -1 +0,0 @@ -2048 diff --git a/test/sys/kernel/uids/100/cpu_share b/test/sys/kernel/uids/100/cpu_share deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/kernel/uids/100/cpu_share +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/kernel/uids/103/cpu_share b/test/sys/kernel/uids/103/cpu_share deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/kernel/uids/103/cpu_share +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/kernel/uids/105/cpu_share b/test/sys/kernel/uids/105/cpu_share deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/kernel/uids/105/cpu_share +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/kernel/uids/2702/cpu_share b/test/sys/kernel/uids/2702/cpu_share deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/kernel/uids/2702/cpu_share +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/kernel/uids/51/cpu_share b/test/sys/kernel/uids/51/cpu_share deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/kernel/uids/51/cpu_share +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/kernel/vmcoreinfo b/test/sys/kernel/vmcoreinfo deleted file mode 100644 index 0fbb36a983..0000000000 --- a/test/sys/kernel/vmcoreinfo +++ /dev/null @@ -1 +0,0 @@ -f15380 1000 diff --git a/test/sys/module/8250/parameters/nr_uarts b/test/sys/module/8250/parameters/nr_uarts deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/module/8250/parameters/nr_uarts +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/module/8250/parameters/share_irqs b/test/sys/module/8250/parameters/share_irqs deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/8250/parameters/share_irqs +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/ac/initstate b/test/sys/module/ac/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/ac/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/ac/notes/.note.gnu.build-id b/test/sys/module/ac/notes/.note.gnu.build-id deleted file mode 100644 index d960c5d52c..0000000000 Binary files a/test/sys/module/ac/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/ac/refcnt b/test/sys/module/ac/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/ac/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/ac/sections/.bss b/test/sys/module/ac/sections/.bss deleted file mode 100644 index 4894d5d602..0000000000 --- a/test/sys/module/ac/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006e600 diff --git a/test/sys/module/ac/sections/.data b/test/sys/module/ac/sections/.data deleted file mode 100644 index c3cd6262a8..0000000000 --- a/test/sys/module/ac/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006e0d0 diff --git a/test/sys/module/ac/sections/.exit.text b/test/sys/module/ac/sections/.exit.text deleted file mode 100644 index 3ddb8670de..0000000000 --- a/test/sys/module/ac/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006d43c diff --git a/test/sys/module/ac/sections/.gnu.linkonce.this_module b/test/sys/module/ac/sections/.gnu.linkonce.this_module deleted file mode 100644 index b899110df5..0000000000 --- a/test/sys/module/ac/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006e240 diff --git a/test/sys/module/ac/sections/.init.text b/test/sys/module/ac/sections/.init.text deleted file mode 100644 index 0cac0d19cf..0000000000 --- a/test/sys/module/ac/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0070000 diff --git a/test/sys/module/ac/sections/.note.gnu.build-id b/test/sys/module/ac/sections/.note.gnu.build-id deleted file mode 100644 index 4795d92c12..0000000000 --- a/test/sys/module/ac/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006d45c diff --git a/test/sys/module/ac/sections/.rodata b/test/sys/module/ac/sections/.rodata deleted file mode 100644 index a62e858b73..0000000000 --- a/test/sys/module/ac/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006d480 diff --git a/test/sys/module/ac/sections/.rodata.str1.1 b/test/sys/module/ac/sections/.rodata.str1.1 deleted file mode 100644 index d6d7d076d4..0000000000 --- a/test/sys/module/ac/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006d5a0 diff --git a/test/sys/module/ac/sections/.strtab b/test/sys/module/ac/sections/.strtab deleted file mode 100644 index 7a19447d60..0000000000 --- a/test/sys/module/ac/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006dd28 diff --git a/test/sys/module/ac/sections/.symtab b/test/sys/module/ac/sections/.symtab deleted file mode 100644 index 9bc2c52868..0000000000 --- a/test/sys/module/ac/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006d668 diff --git a/test/sys/module/ac/sections/.text b/test/sys/module/ac/sections/.text deleted file mode 100644 index ad42de2e3a..0000000000 --- a/test/sys/module/ac/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006d000 diff --git a/test/sys/module/ac/srcversion b/test/sys/module/ac/srcversion deleted file mode 100644 index ceec6c94d7..0000000000 --- a/test/sys/module/ac/srcversion +++ /dev/null @@ -1 +0,0 @@ -6E9CD20EE5BE8425A61B938 diff --git a/test/sys/module/acpi/parameters/acpica_version b/test/sys/module/acpi/parameters/acpica_version deleted file mode 100644 index b52e8b8b4a..0000000000 --- a/test/sys/module/acpi/parameters/acpica_version +++ /dev/null @@ -1 +0,0 @@ -20080609 diff --git a/test/sys/module/acpi_cpufreq/initstate b/test/sys/module/acpi_cpufreq/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/acpi_cpufreq/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/acpi_cpufreq/notes/.note.gnu.build-id b/test/sys/module/acpi_cpufreq/notes/.note.gnu.build-id deleted file mode 100644 index 0d5793791b..0000000000 Binary files a/test/sys/module/acpi_cpufreq/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/acpi_cpufreq/parameters/acpi_pstate_strict b/test/sys/module/acpi_cpufreq/parameters/acpi_pstate_strict deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/acpi_cpufreq/parameters/acpi_pstate_strict +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/acpi_cpufreq/refcnt b/test/sys/module/acpi_cpufreq/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/acpi_cpufreq/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/acpi_cpufreq/sections/.bss b/test/sys/module/acpi_cpufreq/sections/.bss deleted file mode 100644 index e149141fb7..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0256000 diff --git a/test/sys/module/acpi_cpufreq/sections/.data b/test/sys/module/acpi_cpufreq/sections/.data deleted file mode 100644 index bef697f084..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0255bc0 diff --git a/test/sys/module/acpi_cpufreq/sections/.exit.text b/test/sys/module/acpi_cpufreq/sections/.exit.text deleted file mode 100644 index ef6e5584d1..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0254c4c diff --git a/test/sys/module/acpi_cpufreq/sections/.gnu.linkonce.this_module b/test/sys/module/acpi_cpufreq/sections/.gnu.linkonce.this_module deleted file mode 100644 index 23a89121cc..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0255c40 diff --git a/test/sys/module/acpi_cpufreq/sections/.init.text b/test/sys/module/acpi_cpufreq/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/acpi_cpufreq/sections/.note.gnu.build-id b/test/sys/module/acpi_cpufreq/sections/.note.gnu.build-id deleted file mode 100644 index 50901d0135..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0254c6c diff --git a/test/sys/module/acpi_cpufreq/sections/.rodata b/test/sys/module/acpi_cpufreq/sections/.rodata deleted file mode 100644 index afb6803fba..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0254ca0 diff --git a/test/sys/module/acpi_cpufreq/sections/.rodata.str1.1 b/test/sys/module/acpi_cpufreq/sections/.rodata.str1.1 deleted file mode 100644 index f9cf060692..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0254d98 diff --git a/test/sys/module/acpi_cpufreq/sections/.smp_locks b/test/sys/module/acpi_cpufreq/sections/.smp_locks deleted file mode 100644 index 3e3e742424..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0254d68 diff --git a/test/sys/module/acpi_cpufreq/sections/.strtab b/test/sys/module/acpi_cpufreq/sections/.strtab deleted file mode 100644 index 448145ba15..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0255620 diff --git a/test/sys/module/acpi_cpufreq/sections/.symtab b/test/sys/module/acpi_cpufreq/sections/.symtab deleted file mode 100644 index e54cf3a5bd..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0254dc8 diff --git a/test/sys/module/acpi_cpufreq/sections/.text b/test/sys/module/acpi_cpufreq/sections/.text deleted file mode 100644 index 40e5733dde..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0254000 diff --git a/test/sys/module/acpi_cpufreq/sections/__param b/test/sys/module/acpi_cpufreq/sections/__param deleted file mode 100644 index 805dd85b24..0000000000 --- a/test/sys/module/acpi_cpufreq/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0254d70 diff --git a/test/sys/module/acpi_cpufreq/srcversion b/test/sys/module/acpi_cpufreq/srcversion deleted file mode 100644 index 71683b6df0..0000000000 --- a/test/sys/module/acpi_cpufreq/srcversion +++ /dev/null @@ -1 +0,0 @@ -09166B6001DCE2189668F16 diff --git a/test/sys/module/aes_generic/holders/aes_x86_64 b/test/sys/module/aes_generic/holders/aes_x86_64 deleted file mode 120000 index 33ea10d47a..0000000000 --- a/test/sys/module/aes_generic/holders/aes_x86_64 +++ /dev/null @@ -1 +0,0 @@ -../../aes_x86_64 \ No newline at end of file diff --git a/test/sys/module/aes_generic/initstate b/test/sys/module/aes_generic/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/aes_generic/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/aes_generic/notes/.note.gnu.build-id b/test/sys/module/aes_generic/notes/.note.gnu.build-id deleted file mode 100644 index 2778379fe1..0000000000 Binary files a/test/sys/module/aes_generic/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/aes_generic/refcnt b/test/sys/module/aes_generic/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/aes_generic/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/aes_generic/sections/.bss b/test/sys/module/aes_generic/sections/.bss deleted file mode 100644 index 210c67338f..0000000000 --- a/test/sys/module/aes_generic/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02cdf80 diff --git a/test/sys/module/aes_generic/sections/.data b/test/sys/module/aes_generic/sections/.data deleted file mode 100644 index 5b34193753..0000000000 --- a/test/sys/module/aes_generic/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02cda80 diff --git a/test/sys/module/aes_generic/sections/.exit.text b/test/sys/module/aes_generic/sections/.exit.text deleted file mode 100644 index 7b5622e218..0000000000 --- a/test/sys/module/aes_generic/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02cceb8 diff --git a/test/sys/module/aes_generic/sections/.gnu.linkonce.this_module b/test/sys/module/aes_generic/sections/.gnu.linkonce.this_module deleted file mode 100644 index 2bce116671..0000000000 --- a/test/sys/module/aes_generic/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02cdbc0 diff --git a/test/sys/module/aes_generic/sections/.init.data b/test/sys/module/aes_generic/sections/.init.data deleted file mode 100644 index bc7aedcd0a..0000000000 --- a/test/sys/module/aes_generic/sections/.init.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065300 diff --git a/test/sys/module/aes_generic/sections/.init.text b/test/sys/module/aes_generic/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/aes_generic/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/aes_generic/sections/.note.gnu.build-id b/test/sys/module/aes_generic/sections/.note.gnu.build-id deleted file mode 100644 index b0efd39ba7..0000000000 --- a/test/sys/module/aes_generic/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02ccecc diff --git a/test/sys/module/aes_generic/sections/.strtab b/test/sys/module/aes_generic/sections/.strtab deleted file mode 100644 index 0818793407..0000000000 --- a/test/sys/module/aes_generic/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02cd678 diff --git a/test/sys/module/aes_generic/sections/.symtab b/test/sys/module/aes_generic/sections/.symtab deleted file mode 100644 index 2e65f00f96..0000000000 --- a/test/sys/module/aes_generic/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02ccfe8 diff --git a/test/sys/module/aes_generic/sections/.text b/test/sys/module/aes_generic/sections/.text deleted file mode 100644 index bef3229f8b..0000000000 --- a/test/sys/module/aes_generic/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02cb000 diff --git a/test/sys/module/aes_generic/sections/__kcrctab_gpl b/test/sys/module/aes_generic/sections/__kcrctab_gpl deleted file mode 100644 index d36d52aab2..0000000000 --- a/test/sys/module/aes_generic/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02ccf50 diff --git a/test/sys/module/aes_generic/sections/__ksymtab_gpl b/test/sys/module/aes_generic/sections/__ksymtab_gpl deleted file mode 100644 index 378fefa624..0000000000 --- a/test/sys/module/aes_generic/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02ccef0 diff --git a/test/sys/module/aes_generic/sections/__ksymtab_strings b/test/sys/module/aes_generic/sections/__ksymtab_strings deleted file mode 100644 index cb9977d82d..0000000000 --- a/test/sys/module/aes_generic/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02ccf80 diff --git a/test/sys/module/aes_generic/srcversion b/test/sys/module/aes_generic/srcversion deleted file mode 100644 index 7570760aa8..0000000000 --- a/test/sys/module/aes_generic/srcversion +++ /dev/null @@ -1 +0,0 @@ -CE7DEF557FD2F72DE36DE4A diff --git a/test/sys/module/aes_x86_64/initstate b/test/sys/module/aes_x86_64/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/aes_x86_64/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/aes_x86_64/notes/.note.gnu.build-id b/test/sys/module/aes_x86_64/notes/.note.gnu.build-id deleted file mode 100644 index 3475a281f5..0000000000 Binary files a/test/sys/module/aes_x86_64/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/aes_x86_64/refcnt b/test/sys/module/aes_x86_64/refcnt deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/aes_x86_64/refcnt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/aes_x86_64/sections/.bss b/test/sys/module/aes_x86_64/sections/.bss deleted file mode 100644 index a12b9f8013..0000000000 --- a/test/sys/module/aes_x86_64/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d5200 diff --git a/test/sys/module/aes_x86_64/sections/.data b/test/sys/module/aes_x86_64/sections/.data deleted file mode 100644 index 9cac01ef74..0000000000 --- a/test/sys/module/aes_x86_64/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d4d20 diff --git a/test/sys/module/aes_x86_64/sections/.exit.text b/test/sys/module/aes_x86_64/sections/.exit.text deleted file mode 100644 index 1460f0aaaf..0000000000 --- a/test/sys/module/aes_x86_64/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d471c diff --git a/test/sys/module/aes_x86_64/sections/.gnu.linkonce.this_module b/test/sys/module/aes_x86_64/sections/.gnu.linkonce.this_module deleted file mode 100644 index a03eb3ff28..0000000000 --- a/test/sys/module/aes_x86_64/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d4e40 diff --git a/test/sys/module/aes_x86_64/sections/.init.text b/test/sys/module/aes_x86_64/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/aes_x86_64/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/aes_x86_64/sections/.note.gnu.build-id b/test/sys/module/aes_x86_64/sections/.note.gnu.build-id deleted file mode 100644 index 0960a334ea..0000000000 --- a/test/sys/module/aes_x86_64/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d4730 diff --git a/test/sys/module/aes_x86_64/sections/.strtab b/test/sys/module/aes_x86_64/sections/.strtab deleted file mode 100644 index c3ee59d4f9..0000000000 --- a/test/sys/module/aes_x86_64/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d4b60 diff --git a/test/sys/module/aes_x86_64/sections/.symtab b/test/sys/module/aes_x86_64/sections/.symtab deleted file mode 100644 index 58cce3c5f5..0000000000 --- a/test/sys/module/aes_x86_64/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d4758 diff --git a/test/sys/module/aes_x86_64/sections/.text b/test/sys/module/aes_x86_64/sections/.text deleted file mode 100644 index d498e370a4..0000000000 --- a/test/sys/module/aes_x86_64/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d3000 diff --git a/test/sys/module/aes_x86_64/srcversion b/test/sys/module/aes_x86_64/srcversion deleted file mode 100644 index b846092a34..0000000000 --- a/test/sys/module/aes_x86_64/srcversion +++ /dev/null @@ -1 +0,0 @@ -4E315E23114A08593D5D731 diff --git a/test/sys/module/ahci/drivers/pci:ahci b/test/sys/module/ahci/drivers/pci:ahci deleted file mode 120000 index e08571dcb2..0000000000 --- a/test/sys/module/ahci/drivers/pci:ahci +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/ahci \ No newline at end of file diff --git a/test/sys/module/ahci/parameters/ahci_em_messages b/test/sys/module/ahci/parameters/ahci_em_messages deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/ahci/parameters/ahci_em_messages +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/ahci/parameters/marvell_enable b/test/sys/module/ahci/parameters/marvell_enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/ahci/parameters/marvell_enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/ahci/parameters/skip_host_reset b/test/sys/module/ahci/parameters/skip_host_reset deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/ahci/parameters/skip_host_reset +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/arc4/initstate b/test/sys/module/arc4/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/arc4/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/arc4/notes/.note.gnu.build-id b/test/sys/module/arc4/notes/.note.gnu.build-id deleted file mode 100644 index a0fbbd8235..0000000000 Binary files a/test/sys/module/arc4/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/arc4/refcnt b/test/sys/module/arc4/refcnt deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/arc4/refcnt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/arc4/sections/.bss b/test/sys/module/arc4/sections/.bss deleted file mode 100644 index f1112df8d5..0000000000 --- a/test/sys/module/arc4/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006ba00 diff --git a/test/sys/module/arc4/sections/.data b/test/sys/module/arc4/sections/.data deleted file mode 100644 index 176373ad8f..0000000000 --- a/test/sys/module/arc4/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b520 diff --git a/test/sys/module/arc4/sections/.exit.text b/test/sys/module/arc4/sections/.exit.text deleted file mode 100644 index 962e1d8e33..0000000000 --- a/test/sys/module/arc4/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b0dc diff --git a/test/sys/module/arc4/sections/.gnu.linkonce.this_module b/test/sys/module/arc4/sections/.gnu.linkonce.this_module deleted file mode 100644 index 27c8402db4..0000000000 --- a/test/sys/module/arc4/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b640 diff --git a/test/sys/module/arc4/sections/.init.text b/test/sys/module/arc4/sections/.init.text deleted file mode 100644 index 0dbbf92722..0000000000 --- a/test/sys/module/arc4/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009a000 diff --git a/test/sys/module/arc4/sections/.note.gnu.build-id b/test/sys/module/arc4/sections/.note.gnu.build-id deleted file mode 100644 index c3e02a06bf..0000000000 --- a/test/sys/module/arc4/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b0f0 diff --git a/test/sys/module/arc4/sections/.strtab b/test/sys/module/arc4/sections/.strtab deleted file mode 100644 index 0ed741f9c4..0000000000 --- a/test/sys/module/arc4/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b400 diff --git a/test/sys/module/arc4/sections/.symtab b/test/sys/module/arc4/sections/.symtab deleted file mode 100644 index 9340859d2a..0000000000 --- a/test/sys/module/arc4/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b118 diff --git a/test/sys/module/arc4/sections/.text b/test/sys/module/arc4/sections/.text deleted file mode 100644 index 6449cb3074..0000000000 --- a/test/sys/module/arc4/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b000 diff --git a/test/sys/module/arc4/srcversion b/test/sys/module/arc4/srcversion deleted file mode 100644 index 58ea5b69cd..0000000000 --- a/test/sys/module/arc4/srcversion +++ /dev/null @@ -1 +0,0 @@ -0E7B177AF22D87B5B21A577 diff --git a/test/sys/module/atkbd/drivers/serio:atkbd b/test/sys/module/atkbd/drivers/serio:atkbd deleted file mode 120000 index b4b270be19..0000000000 --- a/test/sys/module/atkbd/drivers/serio:atkbd +++ /dev/null @@ -1 +0,0 @@ -../../../bus/serio/drivers/atkbd \ No newline at end of file diff --git a/test/sys/module/backlight/holders/thinkpad_acpi b/test/sys/module/backlight/holders/thinkpad_acpi deleted file mode 120000 index 8d266ed087..0000000000 --- a/test/sys/module/backlight/holders/thinkpad_acpi +++ /dev/null @@ -1 +0,0 @@ -../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/backlight/initstate b/test/sys/module/backlight/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/backlight/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/backlight/notes/.note.gnu.build-id b/test/sys/module/backlight/notes/.note.gnu.build-id deleted file mode 100644 index 032a15ec1a..0000000000 Binary files a/test/sys/module/backlight/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/backlight/refcnt b/test/sys/module/backlight/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/backlight/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/backlight/sections/.bss b/test/sys/module/backlight/sections/.bss deleted file mode 100644 index b54e260f04..0000000000 --- a/test/sys/module/backlight/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01326c0 diff --git a/test/sys/module/backlight/sections/.data b/test/sys/module/backlight/sections/.data deleted file mode 100644 index e23c0bc285..0000000000 --- a/test/sys/module/backlight/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0132220 diff --git a/test/sys/module/backlight/sections/.exit.text b/test/sys/module/backlight/sections/.exit.text deleted file mode 100644 index a8d8639717..0000000000 --- a/test/sys/module/backlight/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01315ec diff --git a/test/sys/module/backlight/sections/.gnu.linkonce.this_module b/test/sys/module/backlight/sections/.gnu.linkonce.this_module deleted file mode 100644 index 82409e97c9..0000000000 --- a/test/sys/module/backlight/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0132300 diff --git a/test/sys/module/backlight/sections/.init.text b/test/sys/module/backlight/sections/.init.text deleted file mode 100644 index 0cac0d19cf..0000000000 --- a/test/sys/module/backlight/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0070000 diff --git a/test/sys/module/backlight/sections/.note.gnu.build-id b/test/sys/module/backlight/sections/.note.gnu.build-id deleted file mode 100644 index 5aad31a4e1..0000000000 --- a/test/sys/module/backlight/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0131600 diff --git a/test/sys/module/backlight/sections/.rodata.str1.1 b/test/sys/module/backlight/sections/.rodata.str1.1 deleted file mode 100644 index 2b14e7faca..0000000000 --- a/test/sys/module/backlight/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0131624 diff --git a/test/sys/module/backlight/sections/.strtab b/test/sys/module/backlight/sections/.strtab deleted file mode 100644 index de4719c16a..0000000000 --- a/test/sys/module/backlight/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0131de0 diff --git a/test/sys/module/backlight/sections/.symtab b/test/sys/module/backlight/sections/.symtab deleted file mode 100644 index d79be5a860..0000000000 --- a/test/sys/module/backlight/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0131738 diff --git a/test/sys/module/backlight/sections/.text b/test/sys/module/backlight/sections/.text deleted file mode 100644 index 10b21938c0..0000000000 --- a/test/sys/module/backlight/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0131000 diff --git a/test/sys/module/backlight/sections/__kcrctab b/test/sys/module/backlight/sections/__kcrctab deleted file mode 100644 index 96dec713e0..0000000000 --- a/test/sys/module/backlight/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01316f0 diff --git a/test/sys/module/backlight/sections/__ksymtab b/test/sys/module/backlight/sections/__ksymtab deleted file mode 100644 index 73e5a2e845..0000000000 --- a/test/sys/module/backlight/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01316d0 diff --git a/test/sys/module/backlight/sections/__ksymtab_strings b/test/sys/module/backlight/sections/__ksymtab_strings deleted file mode 100644 index f2da9ef09d..0000000000 --- a/test/sys/module/backlight/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0131700 diff --git a/test/sys/module/backlight/srcversion b/test/sys/module/backlight/srcversion deleted file mode 100644 index 779bb0f7df..0000000000 --- a/test/sys/module/backlight/srcversion +++ /dev/null @@ -1 +0,0 @@ -AFD1565C65F3DA6D942CB52 diff --git a/test/sys/module/battery/initstate b/test/sys/module/battery/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/battery/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/battery/notes/.note.gnu.build-id b/test/sys/module/battery/notes/.note.gnu.build-id deleted file mode 100644 index 1fd28414ed..0000000000 Binary files a/test/sys/module/battery/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/battery/parameters/cache_time b/test/sys/module/battery/parameters/cache_time deleted file mode 100644 index 83b33d238d..0000000000 --- a/test/sys/module/battery/parameters/cache_time +++ /dev/null @@ -1 +0,0 @@ -1000 diff --git a/test/sys/module/battery/refcnt b/test/sys/module/battery/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/battery/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/battery/sections/.bss b/test/sys/module/battery/sections/.bss deleted file mode 100644 index c22be1650c..0000000000 --- a/test/sys/module/battery/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0082440 diff --git a/test/sys/module/battery/sections/.data b/test/sys/module/battery/sections/.data deleted file mode 100644 index a8eead6b54..0000000000 --- a/test/sys/module/battery/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0081a90 diff --git a/test/sys/module/battery/sections/.exit.text b/test/sys/module/battery/sections/.exit.text deleted file mode 100644 index a7d36b6d9c..0000000000 --- a/test/sys/module/battery/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008008c diff --git a/test/sys/module/battery/sections/.gnu.linkonce.this_module b/test/sys/module/battery/sections/.gnu.linkonce.this_module deleted file mode 100644 index df81e13617..0000000000 --- a/test/sys/module/battery/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0082080 diff --git a/test/sys/module/battery/sections/.init.text b/test/sys/module/battery/sections/.init.text deleted file mode 100644 index 9da5e610a8..0000000000 --- a/test/sys/module/battery/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0084000 diff --git a/test/sys/module/battery/sections/.note.gnu.build-id b/test/sys/module/battery/sections/.note.gnu.build-id deleted file mode 100644 index ec30ee8185..0000000000 --- a/test/sys/module/battery/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00800ac diff --git a/test/sys/module/battery/sections/.rodata b/test/sys/module/battery/sections/.rodata deleted file mode 100644 index 66560fccf8..0000000000 --- a/test/sys/module/battery/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00800d0 diff --git a/test/sys/module/battery/sections/.rodata.str1.1 b/test/sys/module/battery/sections/.rodata.str1.1 deleted file mode 100644 index dfccb36c40..0000000000 --- a/test/sys/module/battery/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008025b diff --git a/test/sys/module/battery/sections/.strtab b/test/sys/module/battery/sections/.strtab deleted file mode 100644 index 0023538a4a..0000000000 --- a/test/sys/module/battery/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0081318 diff --git a/test/sys/module/battery/sections/.symtab b/test/sys/module/battery/sections/.symtab deleted file mode 100644 index b7219c9eb3..0000000000 --- a/test/sys/module/battery/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00807c0 diff --git a/test/sys/module/battery/sections/.text b/test/sys/module/battery/sections/.text deleted file mode 100644 index f0a6dc674e..0000000000 --- a/test/sys/module/battery/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007f000 diff --git a/test/sys/module/battery/sections/__param b/test/sys/module/battery/sections/__param deleted file mode 100644 index 1500e41608..0000000000 --- a/test/sys/module/battery/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0080798 diff --git a/test/sys/module/battery/srcversion b/test/sys/module/battery/srcversion deleted file mode 100644 index f5cc60a4b0..0000000000 --- a/test/sys/module/battery/srcversion +++ /dev/null @@ -1 +0,0 @@ -5A2CE8D302B31A112CFB57A diff --git a/test/sys/module/button/initstate b/test/sys/module/button/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/button/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/button/notes/.note.gnu.build-id b/test/sys/module/button/notes/.note.gnu.build-id deleted file mode 100644 index 893a7911fb..0000000000 Binary files a/test/sys/module/button/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/button/refcnt b/test/sys/module/button/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/button/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/button/sections/.bss b/test/sys/module/button/sections/.bss deleted file mode 100644 index 8424cd4a24..0000000000 --- a/test/sys/module/button/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a8f40 diff --git a/test/sys/module/button/sections/.data b/test/sys/module/button/sections/.data deleted file mode 100644 index 026e51ccb8..0000000000 --- a/test/sys/module/button/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a89e0 diff --git a/test/sys/module/button/sections/.exit.text b/test/sys/module/button/sections/.exit.text deleted file mode 100644 index 8e90a5465a..0000000000 --- a/test/sys/module/button/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a781c diff --git a/test/sys/module/button/sections/.gnu.linkonce.this_module b/test/sys/module/button/sections/.gnu.linkonce.this_module deleted file mode 100644 index 88f1098f0e..0000000000 --- a/test/sys/module/button/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a8b80 diff --git a/test/sys/module/button/sections/.init.text b/test/sys/module/button/sections/.init.text deleted file mode 100644 index eac17e2865..0000000000 --- a/test/sys/module/button/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00aa000 diff --git a/test/sys/module/button/sections/.note.gnu.build-id b/test/sys/module/button/sections/.note.gnu.build-id deleted file mode 100644 index ac5978ac75..0000000000 --- a/test/sys/module/button/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a7898 diff --git a/test/sys/module/button/sections/.rodata b/test/sys/module/button/sections/.rodata deleted file mode 100644 index 290e5bc668..0000000000 --- a/test/sys/module/button/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a78c0 diff --git a/test/sys/module/button/sections/.rodata.str1.1 b/test/sys/module/button/sections/.rodata.str1.1 deleted file mode 100644 index d8b6cd36b3..0000000000 --- a/test/sys/module/button/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a7b60 diff --git a/test/sys/module/button/sections/.smp_locks b/test/sys/module/button/sections/.smp_locks deleted file mode 100644 index 6def877473..0000000000 --- a/test/sys/module/button/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a7c98 diff --git a/test/sys/module/button/sections/.strtab b/test/sys/module/button/sections/.strtab deleted file mode 100644 index 9295ce3506..0000000000 --- a/test/sys/module/button/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a84d8 diff --git a/test/sys/module/button/sections/.symtab b/test/sys/module/button/sections/.symtab deleted file mode 100644 index aa4d355f83..0000000000 --- a/test/sys/module/button/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a7cb0 diff --git a/test/sys/module/button/sections/.text b/test/sys/module/button/sections/.text deleted file mode 100644 index 7253b5c98a..0000000000 --- a/test/sys/module/button/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a7000 diff --git a/test/sys/module/button/srcversion b/test/sys/module/button/srcversion deleted file mode 100644 index aa59993526..0000000000 --- a/test/sys/module/button/srcversion +++ /dev/null @@ -1 +0,0 @@ -2713981C971D8EC4C059338 diff --git a/test/sys/module/cdc_acm/drivers/usb:cdc_acm b/test/sys/module/cdc_acm/drivers/usb:cdc_acm deleted file mode 120000 index 079f9e02bc..0000000000 --- a/test/sys/module/cdc_acm/drivers/usb:cdc_acm +++ /dev/null @@ -1 +0,0 @@ -../../../bus/usb/drivers/cdc_acm \ No newline at end of file diff --git a/test/sys/module/cdc_acm/initstate b/test/sys/module/cdc_acm/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/cdc_acm/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/cdc_acm/notes/.note.gnu.build-id b/test/sys/module/cdc_acm/notes/.note.gnu.build-id deleted file mode 100644 index 953ba93fab..0000000000 Binary files a/test/sys/module/cdc_acm/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/cdc_acm/refcnt b/test/sys/module/cdc_acm/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/cdc_acm/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/cdc_acm/sections/.bss b/test/sys/module/cdc_acm/sections/.bss deleted file mode 100644 index 62ae06da6e..0000000000 --- a/test/sys/module/cdc_acm/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02db8c0 diff --git a/test/sys/module/cdc_acm/sections/.data b/test/sys/module/cdc_acm/sections/.data deleted file mode 100644 index 4f5bd1f988..0000000000 --- a/test/sys/module/cdc_acm/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02db0e0 diff --git a/test/sys/module/cdc_acm/sections/.exit.text b/test/sys/module/cdc_acm/sections/.exit.text deleted file mode 100644 index 6ac6281b53..0000000000 --- a/test/sys/module/cdc_acm/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d949c diff --git a/test/sys/module/cdc_acm/sections/.gnu.linkonce.this_module b/test/sys/module/cdc_acm/sections/.gnu.linkonce.this_module deleted file mode 100644 index c8bc831dff..0000000000 --- a/test/sys/module/cdc_acm/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02db500 diff --git a/test/sys/module/cdc_acm/sections/.init.text b/test/sys/module/cdc_acm/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/cdc_acm/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/cdc_acm/sections/.note.gnu.build-id b/test/sys/module/cdc_acm/sections/.note.gnu.build-id deleted file mode 100644 index ad24190ade..0000000000 --- a/test/sys/module/cdc_acm/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d94c8 diff --git a/test/sys/module/cdc_acm/sections/.rodata b/test/sys/module/cdc_acm/sections/.rodata deleted file mode 100644 index 4fe44c791c..0000000000 --- a/test/sys/module/cdc_acm/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d9500 diff --git a/test/sys/module/cdc_acm/sections/.rodata.str1.1 b/test/sys/module/cdc_acm/sections/.rodata.str1.1 deleted file mode 100644 index fce75dc67d..0000000000 --- a/test/sys/module/cdc_acm/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d9698 diff --git a/test/sys/module/cdc_acm/sections/.smp_locks b/test/sys/module/cdc_acm/sections/.smp_locks deleted file mode 100644 index 021aa1b318..0000000000 --- a/test/sys/module/cdc_acm/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d9660 diff --git a/test/sys/module/cdc_acm/sections/.strtab b/test/sys/module/cdc_acm/sections/.strtab deleted file mode 100644 index d80f3c8d60..0000000000 --- a/test/sys/module/cdc_acm/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02da838 diff --git a/test/sys/module/cdc_acm/sections/.symtab b/test/sys/module/cdc_acm/sections/.symtab deleted file mode 100644 index 54ba7b4c2c..0000000000 --- a/test/sys/module/cdc_acm/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d9968 diff --git a/test/sys/module/cdc_acm/sections/.text b/test/sys/module/cdc_acm/sections/.text deleted file mode 100644 index 41d147290c..0000000000 --- a/test/sys/module/cdc_acm/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02d7000 diff --git a/test/sys/module/cdc_acm/srcversion b/test/sys/module/cdc_acm/srcversion deleted file mode 100644 index c74f75eee5..0000000000 --- a/test/sys/module/cdc_acm/srcversion +++ /dev/null @@ -1 +0,0 @@ -5DED3866AA046376E4E36DD diff --git a/test/sys/module/cdrom/holders/sr_mod b/test/sys/module/cdrom/holders/sr_mod deleted file mode 120000 index 0e5f5fb1c5..0000000000 --- a/test/sys/module/cdrom/holders/sr_mod +++ /dev/null @@ -1 +0,0 @@ -../../sr_mod \ No newline at end of file diff --git a/test/sys/module/cdrom/initstate b/test/sys/module/cdrom/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/cdrom/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/cdrom/notes/.note.gnu.build-id b/test/sys/module/cdrom/notes/.note.gnu.build-id deleted file mode 100644 index a828ad39d8..0000000000 Binary files a/test/sys/module/cdrom/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/cdrom/refcnt b/test/sys/module/cdrom/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/cdrom/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/cdrom/sections/.bss b/test/sys/module/cdrom/sections/.bss deleted file mode 100644 index 6156ae0cc9..0000000000 --- a/test/sys/module/cdrom/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0032380 diff --git a/test/sys/module/cdrom/sections/.data b/test/sys/module/cdrom/sections/.data deleted file mode 100644 index 709c04a1c2..0000000000 --- a/test/sys/module/cdrom/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0031b80 diff --git a/test/sys/module/cdrom/sections/.exit.text b/test/sys/module/cdrom/sections/.exit.text deleted file mode 100644 index 55fff8e055..0000000000 --- a/test/sys/module/cdrom/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa002e0f8 diff --git a/test/sys/module/cdrom/sections/.gnu.linkonce.this_module b/test/sys/module/cdrom/sections/.gnu.linkonce.this_module deleted file mode 100644 index 68dec757e2..0000000000 --- a/test/sys/module/cdrom/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0031fc0 diff --git a/test/sys/module/cdrom/sections/.init.text b/test/sys/module/cdrom/sections/.init.text deleted file mode 100644 index 438d2016db..0000000000 --- a/test/sys/module/cdrom/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0034000 diff --git a/test/sys/module/cdrom/sections/.note.gnu.build-id b/test/sys/module/cdrom/sections/.note.gnu.build-id deleted file mode 100644 index f490a72833..0000000000 --- a/test/sys/module/cdrom/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa002e120 diff --git a/test/sys/module/cdrom/sections/.rodata b/test/sys/module/cdrom/sections/.rodata deleted file mode 100644 index 417b1b20fc..0000000000 --- a/test/sys/module/cdrom/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa002e160 diff --git a/test/sys/module/cdrom/sections/.rodata.str1.1 b/test/sys/module/cdrom/sections/.rodata.str1.1 deleted file mode 100644 index 6f18a0f930..0000000000 --- a/test/sys/module/cdrom/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa002f896 diff --git a/test/sys/module/cdrom/sections/.strtab b/test/sys/module/cdrom/sections/.strtab deleted file mode 100644 index 5dc2e0953b..0000000000 --- a/test/sys/module/cdrom/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0030f60 diff --git a/test/sys/module/cdrom/sections/.symtab b/test/sys/module/cdrom/sections/.symtab deleted file mode 100644 index 4000c51bab..0000000000 --- a/test/sys/module/cdrom/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa002fef8 diff --git a/test/sys/module/cdrom/sections/.text b/test/sys/module/cdrom/sections/.text deleted file mode 100644 index c6448a6d56..0000000000 --- a/test/sys/module/cdrom/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0029000 diff --git a/test/sys/module/cdrom/sections/__kcrctab b/test/sys/module/cdrom/sections/__kcrctab deleted file mode 100644 index efa09615a4..0000000000 --- a/test/sys/module/cdrom/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa002fcd0 diff --git a/test/sys/module/cdrom/sections/__ksymtab b/test/sys/module/cdrom/sections/__ksymtab deleted file mode 100644 index 6eb7c581d9..0000000000 --- a/test/sys/module/cdrom/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa002fc10 diff --git a/test/sys/module/cdrom/sections/__ksymtab_strings b/test/sys/module/cdrom/sections/__ksymtab_strings deleted file mode 100644 index 07d160af8f..0000000000 --- a/test/sys/module/cdrom/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa002fe20 diff --git a/test/sys/module/cdrom/sections/__param b/test/sys/module/cdrom/sections/__param deleted file mode 100644 index 37c68c6271..0000000000 --- a/test/sys/module/cdrom/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa002fd30 diff --git a/test/sys/module/cdrom/srcversion b/test/sys/module/cdrom/srcversion deleted file mode 100644 index 8ae5382c37..0000000000 --- a/test/sys/module/cdrom/srcversion +++ /dev/null @@ -1 +0,0 @@ -D868CCB0789DA27F51280A8 diff --git a/test/sys/module/cfg80211/holders/iwl3945 b/test/sys/module/cfg80211/holders/iwl3945 deleted file mode 120000 index 31cc83c4cc..0000000000 --- a/test/sys/module/cfg80211/holders/iwl3945 +++ /dev/null @@ -1 +0,0 @@ -../../iwl3945 \ No newline at end of file diff --git a/test/sys/module/cfg80211/holders/mac80211 b/test/sys/module/cfg80211/holders/mac80211 deleted file mode 120000 index 3e5eafbc30..0000000000 --- a/test/sys/module/cfg80211/holders/mac80211 +++ /dev/null @@ -1 +0,0 @@ -../../mac80211 \ No newline at end of file diff --git a/test/sys/module/cfg80211/initstate b/test/sys/module/cfg80211/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/cfg80211/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/cfg80211/notes/.note.gnu.build-id b/test/sys/module/cfg80211/notes/.note.gnu.build-id deleted file mode 100644 index 456d1f006d..0000000000 Binary files a/test/sys/module/cfg80211/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/cfg80211/parameters/ieee80211_regdom b/test/sys/module/cfg80211/parameters/ieee80211_regdom deleted file mode 100644 index f4cd62e01d..0000000000 --- a/test/sys/module/cfg80211/parameters/ieee80211_regdom +++ /dev/null @@ -1 +0,0 @@ -US diff --git a/test/sys/module/cfg80211/refcnt b/test/sys/module/cfg80211/refcnt deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/cfg80211/refcnt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/cfg80211/sections/.bss b/test/sys/module/cfg80211/sections/.bss deleted file mode 100644 index 656d4058a7..0000000000 --- a/test/sys/module/cfg80211/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c02c0 diff --git a/test/sys/module/cfg80211/sections/.data b/test/sys/module/cfg80211/sections/.data deleted file mode 100644 index 14f4cfea17..0000000000 --- a/test/sys/module/cfg80211/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bf760 diff --git a/test/sys/module/cfg80211/sections/.data.read_mostly b/test/sys/module/cfg80211/sections/.data.read_mostly deleted file mode 100644 index 1f20cbf46d..0000000000 --- a/test/sys/module/cfg80211/sections/.data.read_mostly +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bfe60 diff --git a/test/sys/module/cfg80211/sections/.gnu.linkonce.this_module b/test/sys/module/cfg80211/sections/.gnu.linkonce.this_module deleted file mode 100644 index 3e3b07f0fa..0000000000 --- a/test/sys/module/cfg80211/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bff00 diff --git a/test/sys/module/cfg80211/sections/.note.gnu.build-id b/test/sys/module/cfg80211/sections/.note.gnu.build-id deleted file mode 100644 index d96aee18ea..0000000000 --- a/test/sys/module/cfg80211/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bce58 diff --git a/test/sys/module/cfg80211/sections/.rodata b/test/sys/module/cfg80211/sections/.rodata deleted file mode 100644 index 5f1b3b0871..0000000000 --- a/test/sys/module/cfg80211/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bce80 diff --git a/test/sys/module/cfg80211/sections/.rodata.str1.1 b/test/sys/module/cfg80211/sections/.rodata.str1.1 deleted file mode 100644 index c2b36962ee..0000000000 --- a/test/sys/module/cfg80211/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bd078 diff --git a/test/sys/module/cfg80211/sections/.smp_locks b/test/sys/module/cfg80211/sections/.smp_locks deleted file mode 100644 index 72fa41d330..0000000000 --- a/test/sys/module/cfg80211/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bd2a0 diff --git a/test/sys/module/cfg80211/sections/.strtab b/test/sys/module/cfg80211/sections/.strtab deleted file mode 100644 index c392f0d8c8..0000000000 --- a/test/sys/module/cfg80211/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00be8c0 diff --git a/test/sys/module/cfg80211/sections/.symtab b/test/sys/module/cfg80211/sections/.symtab deleted file mode 100644 index 40575ed44d..0000000000 --- a/test/sys/module/cfg80211/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bd540 diff --git a/test/sys/module/cfg80211/sections/.text b/test/sys/module/cfg80211/sections/.text deleted file mode 100644 index 68fd051fe0..0000000000 --- a/test/sys/module/cfg80211/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b9000 diff --git a/test/sys/module/cfg80211/sections/__bug_table b/test/sys/module/cfg80211/sections/__bug_table deleted file mode 100644 index a6fa3d717c..0000000000 --- a/test/sys/module/cfg80211/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bd166 diff --git a/test/sys/module/cfg80211/sections/__kcrctab b/test/sys/module/cfg80211/sections/__kcrctab deleted file mode 100644 index 7aae4d6b46..0000000000 --- a/test/sys/module/cfg80211/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bd400 diff --git a/test/sys/module/cfg80211/sections/__ksymtab b/test/sys/module/cfg80211/sections/__ksymtab deleted file mode 100644 index edbaa5bae0..0000000000 --- a/test/sys/module/cfg80211/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bd370 diff --git a/test/sys/module/cfg80211/sections/__ksymtab_strings b/test/sys/module/cfg80211/sections/__ksymtab_strings deleted file mode 100644 index 926ecb7a37..0000000000 --- a/test/sys/module/cfg80211/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bd448 diff --git a/test/sys/module/cfg80211/sections/__param b/test/sys/module/cfg80211/sections/__param deleted file mode 100644 index 05d56e648b..0000000000 --- a/test/sys/module/cfg80211/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00bd518 diff --git a/test/sys/module/cfg80211/srcversion b/test/sys/module/cfg80211/srcversion deleted file mode 100644 index 54b0b7b40e..0000000000 --- a/test/sys/module/cfg80211/srcversion +++ /dev/null @@ -1 +0,0 @@ -C43F275505B181F0D1625BE diff --git a/test/sys/module/crypto_blkcipher/holders/ecb b/test/sys/module/crypto_blkcipher/holders/ecb deleted file mode 120000 index 1ab6b733de..0000000000 --- a/test/sys/module/crypto_blkcipher/holders/ecb +++ /dev/null @@ -1 +0,0 @@ -../../ecb \ No newline at end of file diff --git a/test/sys/module/crypto_blkcipher/initstate b/test/sys/module/crypto_blkcipher/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/crypto_blkcipher/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/crypto_blkcipher/notes/.note.gnu.build-id b/test/sys/module/crypto_blkcipher/notes/.note.gnu.build-id deleted file mode 100644 index e1587afc28..0000000000 Binary files a/test/sys/module/crypto_blkcipher/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/crypto_blkcipher/refcnt b/test/sys/module/crypto_blkcipher/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/crypto_blkcipher/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/crypto_blkcipher/sections/.bss b/test/sys/module/crypto_blkcipher/sections/.bss deleted file mode 100644 index 606e762789..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f3ec0 diff --git a/test/sys/module/crypto_blkcipher/sections/.data b/test/sys/module/crypto_blkcipher/sections/.data deleted file mode 100644 index 99f4d7d023..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f39e0 diff --git a/test/sys/module/crypto_blkcipher/sections/.exit.text b/test/sys/module/crypto_blkcipher/sections/.exit.text deleted file mode 100644 index 44111cb1b6..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f138c diff --git a/test/sys/module/crypto_blkcipher/sections/.gnu.linkonce.this_module b/test/sys/module/crypto_blkcipher/sections/.gnu.linkonce.this_module deleted file mode 100644 index d84ce29e3b..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f3b00 diff --git a/test/sys/module/crypto_blkcipher/sections/.init.text b/test/sys/module/crypto_blkcipher/sections/.init.text deleted file mode 100644 index 02c713a482..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027000 diff --git a/test/sys/module/crypto_blkcipher/sections/.note.gnu.build-id b/test/sys/module/crypto_blkcipher/sections/.note.gnu.build-id deleted file mode 100644 index 0e9fea03c5..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f13b0 diff --git a/test/sys/module/crypto_blkcipher/sections/.rodata b/test/sys/module/crypto_blkcipher/sections/.rodata deleted file mode 100644 index e8a546c3b6..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f13e0 diff --git a/test/sys/module/crypto_blkcipher/sections/.rodata.str1.1 b/test/sys/module/crypto_blkcipher/sections/.rodata.str1.1 deleted file mode 100644 index 8884e36da2..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f1440 diff --git a/test/sys/module/crypto_blkcipher/sections/.smp_locks b/test/sys/module/crypto_blkcipher/sections/.smp_locks deleted file mode 100644 index 7697192a16..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f18c0 diff --git a/test/sys/module/crypto_blkcipher/sections/.strtab b/test/sys/module/crypto_blkcipher/sections/.strtab deleted file mode 100644 index e8b4217f02..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f2b10 diff --git a/test/sys/module/crypto_blkcipher/sections/.symtab b/test/sys/module/crypto_blkcipher/sections/.symtab deleted file mode 100644 index 21561abfe9..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f18f8 diff --git a/test/sys/module/crypto_blkcipher/sections/.text b/test/sys/module/crypto_blkcipher/sections/.text deleted file mode 100644 index e3a07aecb9..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01ef000 diff --git a/test/sys/module/crypto_blkcipher/sections/__bug_table b/test/sys/module/crypto_blkcipher/sections/__bug_table deleted file mode 100644 index b8ba8010c6..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f185f diff --git a/test/sys/module/crypto_blkcipher/sections/__kcrctab_gpl b/test/sys/module/crypto_blkcipher/sections/__kcrctab_gpl deleted file mode 100644 index a24c10fa5a..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f16e0 diff --git a/test/sys/module/crypto_blkcipher/sections/__ksymtab_gpl b/test/sys/module/crypto_blkcipher/sections/__ksymtab_gpl deleted file mode 100644 index 59397c545d..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f1610 diff --git a/test/sys/module/crypto_blkcipher/sections/__ksymtab_strings b/test/sys/module/crypto_blkcipher/sections/__ksymtab_strings deleted file mode 100644 index 354b438583..0000000000 --- a/test/sys/module/crypto_blkcipher/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f1748 diff --git a/test/sys/module/crypto_blkcipher/srcversion b/test/sys/module/crypto_blkcipher/srcversion deleted file mode 100644 index 1f5eef5f40..0000000000 --- a/test/sys/module/crypto_blkcipher/srcversion +++ /dev/null @@ -1 +0,0 @@ -723F00BD2391209F4D65272 diff --git a/test/sys/module/dm_mod/initstate b/test/sys/module/dm_mod/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/dm_mod/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/dm_mod/notes/.note.gnu.build-id b/test/sys/module/dm_mod/notes/.note.gnu.build-id deleted file mode 100644 index 31a266d122..0000000000 Binary files a/test/sys/module/dm_mod/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/dm_mod/refcnt b/test/sys/module/dm_mod/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/dm_mod/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/dm_mod/sections/.bss b/test/sys/module/dm_mod/sections/.bss deleted file mode 100644 index f8203179ba..0000000000 --- a/test/sys/module/dm_mod/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02177c0 diff --git a/test/sys/module/dm_mod/sections/.data b/test/sys/module/dm_mod/sections/.data deleted file mode 100644 index cd3cc1ba78..0000000000 --- a/test/sys/module/dm_mod/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0216f40 diff --git a/test/sys/module/dm_mod/sections/.exit.text b/test/sys/module/dm_mod/sections/.exit.text deleted file mode 100644 index 0536d6e99f..0000000000 --- a/test/sys/module/dm_mod/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0210c20 diff --git a/test/sys/module/dm_mod/sections/.gnu.linkonce.this_module b/test/sys/module/dm_mod/sections/.gnu.linkonce.this_module deleted file mode 100644 index 1236a596e9..0000000000 --- a/test/sys/module/dm_mod/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0217400 diff --git a/test/sys/module/dm_mod/sections/.init.data b/test/sys/module/dm_mod/sections/.init.data deleted file mode 100644 index 0c64786a2b..0000000000 --- a/test/sys/module/dm_mod/sections/.init.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00652c0 diff --git a/test/sys/module/dm_mod/sections/.init.text b/test/sys/module/dm_mod/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/dm_mod/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/dm_mod/sections/.note.gnu.build-id b/test/sys/module/dm_mod/sections/.note.gnu.build-id deleted file mode 100644 index 87b899fd00..0000000000 --- a/test/sys/module/dm_mod/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0210c54 diff --git a/test/sys/module/dm_mod/sections/.rodata b/test/sys/module/dm_mod/sections/.rodata deleted file mode 100644 index 7fecd91af0..0000000000 --- a/test/sys/module/dm_mod/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0210c80 diff --git a/test/sys/module/dm_mod/sections/.rodata.str1.1 b/test/sys/module/dm_mod/sections/.rodata.str1.1 deleted file mode 100644 index 34717dbb29..0000000000 --- a/test/sys/module/dm_mod/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0211c4d diff --git a/test/sys/module/dm_mod/sections/.smp_locks b/test/sys/module/dm_mod/sections/.smp_locks deleted file mode 100644 index 8f0c07cf58..0000000000 --- a/test/sys/module/dm_mod/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0210eb8 diff --git a/test/sys/module/dm_mod/sections/.strtab b/test/sys/module/dm_mod/sections/.strtab deleted file mode 100644 index 31ab58e628..0000000000 --- a/test/sys/module/dm_mod/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02151f0 diff --git a/test/sys/module/dm_mod/sections/.symtab b/test/sys/module/dm_mod/sections/.symtab deleted file mode 100644 index e95e4e21b8..0000000000 --- a/test/sys/module/dm_mod/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02124a8 diff --git a/test/sys/module/dm_mod/sections/.text b/test/sys/module/dm_mod/sections/.text deleted file mode 100644 index dea11088ad..0000000000 --- a/test/sys/module/dm_mod/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0209000 diff --git a/test/sys/module/dm_mod/sections/__bug_table b/test/sys/module/dm_mod/sections/__bug_table deleted file mode 100644 index ac601205b1..0000000000 --- a/test/sys/module/dm_mod/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0211f54 diff --git a/test/sys/module/dm_mod/sections/__kcrctab b/test/sys/module/dm_mod/sections/__kcrctab deleted file mode 100644 index 0d6a645432..0000000000 --- a/test/sys/module/dm_mod/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0212210 diff --git a/test/sys/module/dm_mod/sections/__kcrctab_gpl b/test/sys/module/dm_mod/sections/__kcrctab_gpl deleted file mode 100644 index f77ff392a6..0000000000 --- a/test/sys/module/dm_mod/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02122f0 diff --git a/test/sys/module/dm_mod/sections/__ksymtab b/test/sys/module/dm_mod/sections/__ksymtab deleted file mode 100644 index 6154ce23d9..0000000000 --- a/test/sys/module/dm_mod/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02120d0 diff --git a/test/sys/module/dm_mod/sections/__ksymtab_gpl b/test/sys/module/dm_mod/sections/__ksymtab_gpl deleted file mode 100644 index 32c541ebde..0000000000 --- a/test/sys/module/dm_mod/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02122b0 diff --git a/test/sys/module/dm_mod/sections/__ksymtab_strings b/test/sys/module/dm_mod/sections/__ksymtab_strings deleted file mode 100644 index 000191bad8..0000000000 --- a/test/sys/module/dm_mod/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0212310 diff --git a/test/sys/module/dm_mod/sections/__param b/test/sys/module/dm_mod/sections/__param deleted file mode 100644 index cf9b323e33..0000000000 --- a/test/sys/module/dm_mod/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02120a8 diff --git a/test/sys/module/dm_mod/srcversion b/test/sys/module/dm_mod/srcversion deleted file mode 100644 index 3a49ba4d5c..0000000000 --- a/test/sys/module/dm_mod/srcversion +++ /dev/null @@ -1 +0,0 @@ -458AEB289C7AA031FFD0011 diff --git a/test/sys/module/dock/parameters/immediate_undock b/test/sys/module/dock/parameters/immediate_undock deleted file mode 100644 index 9bda8c35c2..0000000000 --- a/test/sys/module/dock/parameters/immediate_undock +++ /dev/null @@ -1 +0,0 @@ -Y diff --git a/test/sys/module/e1000e/drivers/pci:e1000e b/test/sys/module/e1000e/drivers/pci:e1000e deleted file mode 120000 index c8a10dcf7b..0000000000 --- a/test/sys/module/e1000e/drivers/pci:e1000e +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/e1000e \ No newline at end of file diff --git a/test/sys/module/e1000e/initstate b/test/sys/module/e1000e/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/e1000e/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/e1000e/notes/.note.gnu.build-id b/test/sys/module/e1000e/notes/.note.gnu.build-id deleted file mode 100644 index bd1123ff9c..0000000000 Binary files a/test/sys/module/e1000e/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/e1000e/parameters/copybreak b/test/sys/module/e1000e/parameters/copybreak deleted file mode 100644 index 9183bf03fc..0000000000 --- a/test/sys/module/e1000e/parameters/copybreak +++ /dev/null @@ -1 +0,0 @@ -256 diff --git a/test/sys/module/e1000e/refcnt b/test/sys/module/e1000e/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/e1000e/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/e1000e/sections/.bss b/test/sys/module/e1000e/sections/.bss deleted file mode 100644 index c4e25c1ea2..0000000000 --- a/test/sys/module/e1000e/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0025800 diff --git a/test/sys/module/e1000e/sections/.data b/test/sys/module/e1000e/sections/.data deleted file mode 100644 index 2b3221af45..0000000000 --- a/test/sys/module/e1000e/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00243c0 diff --git a/test/sys/module/e1000e/sections/.devexit.text b/test/sys/module/e1000e/sections/.devexit.text deleted file mode 100644 index b100326af6..0000000000 --- a/test/sys/module/e1000e/sections/.devexit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001c672 diff --git a/test/sys/module/e1000e/sections/.devinit.data b/test/sys/module/e1000e/sections/.devinit.data deleted file mode 100644 index 002128c8cf..0000000000 --- a/test/sys/module/e1000e/sections/.devinit.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0024fe0 diff --git a/test/sys/module/e1000e/sections/.devinit.text b/test/sys/module/e1000e/sections/.devinit.text deleted file mode 100644 index 5a6d2efda5..0000000000 --- a/test/sys/module/e1000e/sections/.devinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001b380 diff --git a/test/sys/module/e1000e/sections/.exit.text b/test/sys/module/e1000e/sections/.exit.text deleted file mode 100644 index 71d7245500..0000000000 --- a/test/sys/module/e1000e/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001c64f diff --git a/test/sys/module/e1000e/sections/.gnu.linkonce.this_module b/test/sys/module/e1000e/sections/.gnu.linkonce.this_module deleted file mode 100644 index 8dd3ddf340..0000000000 --- a/test/sys/module/e1000e/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0025440 diff --git a/test/sys/module/e1000e/sections/.init.text b/test/sys/module/e1000e/sections/.init.text deleted file mode 100644 index 02c713a482..0000000000 --- a/test/sys/module/e1000e/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027000 diff --git a/test/sys/module/e1000e/sections/.note.gnu.build-id b/test/sys/module/e1000e/sections/.note.gnu.build-id deleted file mode 100644 index 85b6a4c439..0000000000 --- a/test/sys/module/e1000e/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001c750 diff --git a/test/sys/module/e1000e/sections/.rodata b/test/sys/module/e1000e/sections/.rodata deleted file mode 100644 index f4fae347c2..0000000000 --- a/test/sys/module/e1000e/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001c780 diff --git a/test/sys/module/e1000e/sections/.rodata.str1.1 b/test/sys/module/e1000e/sections/.rodata.str1.1 deleted file mode 100644 index 9553f3a5ea..0000000000 --- a/test/sys/module/e1000e/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001d6f0 diff --git a/test/sys/module/e1000e/sections/.smp_locks b/test/sys/module/e1000e/sections/.smp_locks deleted file mode 100644 index 32e64d23f0..0000000000 --- a/test/sys/module/e1000e/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001e730 diff --git a/test/sys/module/e1000e/sections/.strtab b/test/sys/module/e1000e/sections/.strtab deleted file mode 100644 index 9cac5bb7be..0000000000 --- a/test/sys/module/e1000e/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0021ac0 diff --git a/test/sys/module/e1000e/sections/.symtab b/test/sys/module/e1000e/sections/.symtab deleted file mode 100644 index bd6f46ab55..0000000000 --- a/test/sys/module/e1000e/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001e8b0 diff --git a/test/sys/module/e1000e/sections/.text b/test/sys/module/e1000e/sections/.text deleted file mode 100644 index bebf649c98..0000000000 --- a/test/sys/module/e1000e/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0009000 diff --git a/test/sys/module/e1000e/sections/__bug_table b/test/sys/module/e1000e/sections/__bug_table deleted file mode 100644 index 586c743633..0000000000 --- a/test/sys/module/e1000e/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001e590 diff --git a/test/sys/module/e1000e/sections/__param b/test/sys/module/e1000e/sections/__param deleted file mode 100644 index ad35b4c4d3..0000000000 --- a/test/sys/module/e1000e/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa001e5f0 diff --git a/test/sys/module/e1000e/srcversion b/test/sys/module/e1000e/srcversion deleted file mode 100644 index 2d95f5520c..0000000000 --- a/test/sys/module/e1000e/srcversion +++ /dev/null @@ -1 +0,0 @@ -5B93BF2B618524ED19305C8 diff --git a/test/sys/module/e1000e/version b/test/sys/module/e1000e/version deleted file mode 100644 index 513f3fcac8..0000000000 --- a/test/sys/module/e1000e/version +++ /dev/null @@ -1 +0,0 @@ -0.3.3.3-k2 diff --git a/test/sys/module/ecb/initstate b/test/sys/module/ecb/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/ecb/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/ecb/notes/.note.gnu.build-id b/test/sys/module/ecb/notes/.note.gnu.build-id deleted file mode 100644 index 7429debd49..0000000000 Binary files a/test/sys/module/ecb/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/ecb/refcnt b/test/sys/module/ecb/refcnt deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/ecb/refcnt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/ecb/sections/.bss b/test/sys/module/ecb/sections/.bss deleted file mode 100644 index 3b2d28b674..0000000000 --- a/test/sys/module/ecb/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027e80 diff --git a/test/sys/module/ecb/sections/.data b/test/sys/module/ecb/sections/.data deleted file mode 100644 index fe7969627a..0000000000 --- a/test/sys/module/ecb/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027a40 diff --git a/test/sys/module/ecb/sections/.exit.text b/test/sys/module/ecb/sections/.exit.text deleted file mode 100644 index 316b24e06d..0000000000 --- a/test/sys/module/ecb/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027300 diff --git a/test/sys/module/ecb/sections/.gnu.linkonce.this_module b/test/sys/module/ecb/sections/.gnu.linkonce.this_module deleted file mode 100644 index ed299c2c30..0000000000 --- a/test/sys/module/ecb/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027ac0 diff --git a/test/sys/module/ecb/sections/.init.text b/test/sys/module/ecb/sections/.init.text deleted file mode 100644 index 6449cb3074..0000000000 --- a/test/sys/module/ecb/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b000 diff --git a/test/sys/module/ecb/sections/.note.gnu.build-id b/test/sys/module/ecb/sections/.note.gnu.build-id deleted file mode 100644 index b5f01876b9..0000000000 --- a/test/sys/module/ecb/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027314 diff --git a/test/sys/module/ecb/sections/.rodata.str1.1 b/test/sys/module/ecb/sections/.rodata.str1.1 deleted file mode 100644 index 2d9e094f8b..0000000000 --- a/test/sys/module/ecb/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027338 diff --git a/test/sys/module/ecb/sections/.strtab b/test/sys/module/ecb/sections/.strtab deleted file mode 100644 index c7890605e1..0000000000 --- a/test/sys/module/ecb/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00277c0 diff --git a/test/sys/module/ecb/sections/.symtab b/test/sys/module/ecb/sections/.symtab deleted file mode 100644 index 30e2c736ad..0000000000 --- a/test/sys/module/ecb/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027340 diff --git a/test/sys/module/ecb/sections/.text b/test/sys/module/ecb/sections/.text deleted file mode 100644 index 02c713a482..0000000000 --- a/test/sys/module/ecb/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027000 diff --git a/test/sys/module/ecb/srcversion b/test/sys/module/ecb/srcversion deleted file mode 100644 index 4ac69f7183..0000000000 --- a/test/sys/module/ecb/srcversion +++ /dev/null @@ -1 +0,0 @@ -5BBA8E5CDEA4EA8BA5ED31D diff --git a/test/sys/module/edd/initstate b/test/sys/module/edd/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/edd/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/edd/notes/.note.gnu.build-id b/test/sys/module/edd/notes/.note.gnu.build-id deleted file mode 100644 index 4ddd6f256c..0000000000 Binary files a/test/sys/module/edd/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/edd/refcnt b/test/sys/module/edd/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/edd/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/edd/sections/.bss b/test/sys/module/edd/sections/.bss deleted file mode 100644 index 0d674b34e7..0000000000 --- a/test/sys/module/edd/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a3880 diff --git a/test/sys/module/edd/sections/.data b/test/sys/module/edd/sections/.data deleted file mode 100644 index e6c3f52261..0000000000 --- a/test/sys/module/edd/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a3120 diff --git a/test/sys/module/edd/sections/.exit.text b/test/sys/module/edd/sections/.exit.text deleted file mode 100644 index f2e5e7b5fd..0000000000 --- a/test/sys/module/edd/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a1de8 diff --git a/test/sys/module/edd/sections/.gnu.linkonce.this_module b/test/sys/module/edd/sections/.gnu.linkonce.this_module deleted file mode 100644 index 9323ee2030..0000000000 --- a/test/sys/module/edd/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a34c0 diff --git a/test/sys/module/edd/sections/.init.text b/test/sys/module/edd/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/edd/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/edd/sections/.note.gnu.build-id b/test/sys/module/edd/sections/.note.gnu.build-id deleted file mode 100644 index 755abd10dd..0000000000 --- a/test/sys/module/edd/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a1e6c diff --git a/test/sys/module/edd/sections/.rodata b/test/sys/module/edd/sections/.rodata deleted file mode 100644 index a3d3a996d8..0000000000 --- a/test/sys/module/edd/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a1ea0 diff --git a/test/sys/module/edd/sections/.rodata.str1.1 b/test/sys/module/edd/sections/.rodata.str1.1 deleted file mode 100644 index 94d0aaa103..0000000000 --- a/test/sys/module/edd/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a1f18 diff --git a/test/sys/module/edd/sections/.strtab b/test/sys/module/edd/sections/.strtab deleted file mode 100644 index 51d73a525f..0000000000 --- a/test/sys/module/edd/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a2b88 diff --git a/test/sys/module/edd/sections/.symtab b/test/sys/module/edd/sections/.symtab deleted file mode 100644 index 458cd75d46..0000000000 --- a/test/sys/module/edd/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a22b8 diff --git a/test/sys/module/edd/sections/.text b/test/sys/module/edd/sections/.text deleted file mode 100644 index 31cf860540..0000000000 --- a/test/sys/module/edd/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a1000 diff --git a/test/sys/module/edd/srcversion b/test/sys/module/edd/srcversion deleted file mode 100644 index 4ca2711269..0000000000 --- a/test/sys/module/edd/srcversion +++ /dev/null @@ -1 +0,0 @@ -ED68C1ACC4B2D1B19C7BEA7 diff --git a/test/sys/module/edd/version b/test/sys/module/edd/version deleted file mode 100644 index 8eac30c383..0000000000 --- a/test/sys/module/edd/version +++ /dev/null @@ -1 +0,0 @@ -0.16 diff --git a/test/sys/module/ehci_hcd/drivers/pci:ehci_hcd b/test/sys/module/ehci_hcd/drivers/pci:ehci_hcd deleted file mode 120000 index 04a01344aa..0000000000 --- a/test/sys/module/ehci_hcd/drivers/pci:ehci_hcd +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/ehci_hcd \ No newline at end of file diff --git a/test/sys/module/ehci_hcd/initstate b/test/sys/module/ehci_hcd/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/ehci_hcd/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/ehci_hcd/notes/.note.gnu.build-id b/test/sys/module/ehci_hcd/notes/.note.gnu.build-id deleted file mode 100644 index f11d770ec6..0000000000 Binary files a/test/sys/module/ehci_hcd/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/ehci_hcd/parameters/ignore_oc b/test/sys/module/ehci_hcd/parameters/ignore_oc deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/ehci_hcd/parameters/ignore_oc +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/ehci_hcd/parameters/log2_irq_thresh b/test/sys/module/ehci_hcd/parameters/log2_irq_thresh deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/ehci_hcd/parameters/log2_irq_thresh +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/ehci_hcd/parameters/park b/test/sys/module/ehci_hcd/parameters/park deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/ehci_hcd/parameters/park +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/ehci_hcd/refcnt b/test/sys/module/ehci_hcd/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/ehci_hcd/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/ehci_hcd/sections/.bss b/test/sys/module/ehci_hcd/sections/.bss deleted file mode 100644 index 4b07c38fac..0000000000 --- a/test/sys/module/ehci_hcd/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e6480 diff --git a/test/sys/module/ehci_hcd/sections/.data b/test/sys/module/ehci_hcd/sections/.data deleted file mode 100644 index ebac76e71d..0000000000 --- a/test/sys/module/ehci_hcd/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e5f40 diff --git a/test/sys/module/ehci_hcd/sections/.exit.text b/test/sys/module/ehci_hcd/sections/.exit.text deleted file mode 100644 index 9755351e16..0000000000 --- a/test/sys/module/ehci_hcd/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e3b98 diff --git a/test/sys/module/ehci_hcd/sections/.gnu.linkonce.this_module b/test/sys/module/ehci_hcd/sections/.gnu.linkonce.this_module deleted file mode 100644 index 8ed5a19de2..0000000000 --- a/test/sys/module/ehci_hcd/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e60c0 diff --git a/test/sys/module/ehci_hcd/sections/.init.text b/test/sys/module/ehci_hcd/sections/.init.text deleted file mode 100644 index 6449cb3074..0000000000 --- a/test/sys/module/ehci_hcd/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b000 diff --git a/test/sys/module/ehci_hcd/sections/.note.gnu.build-id b/test/sys/module/ehci_hcd/sections/.note.gnu.build-id deleted file mode 100644 index 991f10afae..0000000000 --- a/test/sys/module/ehci_hcd/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e3bac diff --git a/test/sys/module/ehci_hcd/sections/.rodata b/test/sys/module/ehci_hcd/sections/.rodata deleted file mode 100644 index ffa2b9efa7..0000000000 --- a/test/sys/module/ehci_hcd/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e3be0 diff --git a/test/sys/module/ehci_hcd/sections/.rodata.str1.1 b/test/sys/module/ehci_hcd/sections/.rodata.str1.1 deleted file mode 100644 index 3f05eb7069..0000000000 --- a/test/sys/module/ehci_hcd/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e3dd0 diff --git a/test/sys/module/ehci_hcd/sections/.smp_locks b/test/sys/module/ehci_hcd/sections/.smp_locks deleted file mode 100644 index 0cca8bdca6..0000000000 --- a/test/sys/module/ehci_hcd/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e4048 diff --git a/test/sys/module/ehci_hcd/sections/.strtab b/test/sys/module/ehci_hcd/sections/.strtab deleted file mode 100644 index c91f0f5925..0000000000 --- a/test/sys/module/ehci_hcd/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e54a8 diff --git a/test/sys/module/ehci_hcd/sections/.symtab b/test/sys/module/ehci_hcd/sections/.symtab deleted file mode 100644 index 3b33638dcf..0000000000 --- a/test/sys/module/ehci_hcd/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e4368 diff --git a/test/sys/module/ehci_hcd/sections/.text b/test/sys/module/ehci_hcd/sections/.text deleted file mode 100644 index 49479f1dc2..0000000000 --- a/test/sys/module/ehci_hcd/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00dd000 diff --git a/test/sys/module/ehci_hcd/sections/__bug_table b/test/sys/module/ehci_hcd/sections/__bug_table deleted file mode 100644 index e5e33c0a0f..0000000000 --- a/test/sys/module/ehci_hcd/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e3f22 diff --git a/test/sys/module/ehci_hcd/sections/__param b/test/sys/module/ehci_hcd/sections/__param deleted file mode 100644 index 312ba31e6f..0000000000 --- a/test/sys/module/ehci_hcd/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e42f0 diff --git a/test/sys/module/ehci_hcd/srcversion b/test/sys/module/ehci_hcd/srcversion deleted file mode 100644 index 57c7a54c7e..0000000000 --- a/test/sys/module/ehci_hcd/srcversion +++ /dev/null @@ -1 +0,0 @@ -6EBBF13EC8AD467D8AB11A4 diff --git a/test/sys/module/evdev/initstate b/test/sys/module/evdev/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/evdev/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/evdev/notes/.note.gnu.build-id b/test/sys/module/evdev/notes/.note.gnu.build-id deleted file mode 100644 index 2b9211317f..0000000000 Binary files a/test/sys/module/evdev/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/evdev/refcnt b/test/sys/module/evdev/refcnt deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/module/evdev/refcnt +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/module/evdev/sections/.bss b/test/sys/module/evdev/sections/.bss deleted file mode 100644 index 5266c94928..0000000000 --- a/test/sys/module/evdev/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b50c0 diff --git a/test/sys/module/evdev/sections/.data b/test/sys/module/evdev/sections/.data deleted file mode 100644 index ba09155bc9..0000000000 --- a/test/sys/module/evdev/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b4be0 diff --git a/test/sys/module/evdev/sections/.exit.text b/test/sys/module/evdev/sections/.exit.text deleted file mode 100644 index 84eb25653d..0000000000 --- a/test/sys/module/evdev/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b3724 diff --git a/test/sys/module/evdev/sections/.gnu.linkonce.this_module b/test/sys/module/evdev/sections/.gnu.linkonce.this_module deleted file mode 100644 index 1a737c30f8..0000000000 --- a/test/sys/module/evdev/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b4d00 diff --git a/test/sys/module/evdev/sections/.init.text b/test/sys/module/evdev/sections/.init.text deleted file mode 100644 index 916fbfab4c..0000000000 --- a/test/sys/module/evdev/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b7000 diff --git a/test/sys/module/evdev/sections/.note.gnu.build-id b/test/sys/module/evdev/sections/.note.gnu.build-id deleted file mode 100644 index 121d12d5f2..0000000000 --- a/test/sys/module/evdev/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b3738 diff --git a/test/sys/module/evdev/sections/.rodata b/test/sys/module/evdev/sections/.rodata deleted file mode 100644 index 73b2f23ee1..0000000000 --- a/test/sys/module/evdev/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b3760 diff --git a/test/sys/module/evdev/sections/.rodata.str1.1 b/test/sys/module/evdev/sections/.rodata.str1.1 deleted file mode 100644 index 2db4d5be20..0000000000 --- a/test/sys/module/evdev/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b3a38 diff --git a/test/sys/module/evdev/sections/.strtab b/test/sys/module/evdev/sections/.strtab deleted file mode 100644 index c30b6f353c..0000000000 --- a/test/sys/module/evdev/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b4610 diff --git a/test/sys/module/evdev/sections/.symtab b/test/sys/module/evdev/sections/.symtab deleted file mode 100644 index 6e34c8da01..0000000000 --- a/test/sys/module/evdev/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b3b60 diff --git a/test/sys/module/evdev/sections/.text b/test/sys/module/evdev/sections/.text deleted file mode 100644 index 5ec64aea9b..0000000000 --- a/test/sys/module/evdev/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b2000 diff --git a/test/sys/module/evdev/srcversion b/test/sys/module/evdev/srcversion deleted file mode 100644 index 3972d06473..0000000000 --- a/test/sys/module/evdev/srcversion +++ /dev/null @@ -1 +0,0 @@ -6F6934C1F95317926EA0520 diff --git a/test/sys/module/fuse/initstate b/test/sys/module/fuse/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/fuse/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/fuse/notes/.note.gnu.build-id b/test/sys/module/fuse/notes/.note.gnu.build-id deleted file mode 100644 index d2436c341d..0000000000 Binary files a/test/sys/module/fuse/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/fuse/refcnt b/test/sys/module/fuse/refcnt deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/module/fuse/refcnt +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/module/fuse/sections/.bss b/test/sys/module/fuse/sections/.bss deleted file mode 100644 index 8234908065..0000000000 --- a/test/sys/module/fuse/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa024e300 diff --git a/test/sys/module/fuse/sections/.data b/test/sys/module/fuse/sections/.data deleted file mode 100644 index 5b456fd81a..0000000000 --- a/test/sys/module/fuse/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa024dba0 diff --git a/test/sys/module/fuse/sections/.exit.text b/test/sys/module/fuse/sections/.exit.text deleted file mode 100644 index 6922614c2a..0000000000 --- a/test/sys/module/fuse/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02493d0 diff --git a/test/sys/module/fuse/sections/.gnu.linkonce.this_module b/test/sys/module/fuse/sections/.gnu.linkonce.this_module deleted file mode 100644 index 25cb7caee6..0000000000 --- a/test/sys/module/fuse/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa024df40 diff --git a/test/sys/module/fuse/sections/.init.text b/test/sys/module/fuse/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/fuse/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/fuse/sections/.note.gnu.build-id b/test/sys/module/fuse/sections/.note.gnu.build-id deleted file mode 100644 index 4928d8130d..0000000000 --- a/test/sys/module/fuse/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0249414 diff --git a/test/sys/module/fuse/sections/.rodata b/test/sys/module/fuse/sections/.rodata deleted file mode 100644 index 576e78361a..0000000000 --- a/test/sys/module/fuse/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0249440 diff --git a/test/sys/module/fuse/sections/.rodata.str1.1 b/test/sys/module/fuse/sections/.rodata.str1.1 deleted file mode 100644 index 69a1232d7d..0000000000 --- a/test/sys/module/fuse/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0249e50 diff --git a/test/sys/module/fuse/sections/.smp_locks b/test/sys/module/fuse/sections/.smp_locks deleted file mode 100644 index c5007c706b..0000000000 --- a/test/sys/module/fuse/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0249d78 diff --git a/test/sys/module/fuse/sections/.strtab b/test/sys/module/fuse/sections/.strtab deleted file mode 100644 index 5d7eac3f8b..0000000000 --- a/test/sys/module/fuse/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa024c4e8 diff --git a/test/sys/module/fuse/sections/.symtab b/test/sys/module/fuse/sections/.symtab deleted file mode 100644 index 6945615efa..0000000000 --- a/test/sys/module/fuse/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa024a208 diff --git a/test/sys/module/fuse/sections/.text b/test/sys/module/fuse/sections/.text deleted file mode 100644 index d4f50d42a8..0000000000 --- a/test/sys/module/fuse/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0240000 diff --git a/test/sys/module/fuse/sections/__bug_table b/test/sys/module/fuse/sections/__bug_table deleted file mode 100644 index e83f9548fd..0000000000 --- a/test/sys/module/fuse/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa024a032 diff --git a/test/sys/module/fuse/srcversion b/test/sys/module/fuse/srcversion deleted file mode 100644 index c34beeac0e..0000000000 --- a/test/sys/module/fuse/srcversion +++ /dev/null @@ -1 +0,0 @@ -A6C92EE44A51B1B0DC4377D diff --git a/test/sys/module/hid/parameters/pb_fnmode b/test/sys/module/hid/parameters/pb_fnmode deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/hid/parameters/pb_fnmode +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/hwmon/holders/thinkpad_acpi b/test/sys/module/hwmon/holders/thinkpad_acpi deleted file mode 120000 index 8d266ed087..0000000000 --- a/test/sys/module/hwmon/holders/thinkpad_acpi +++ /dev/null @@ -1 +0,0 @@ -../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/hwmon/initstate b/test/sys/module/hwmon/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/hwmon/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/hwmon/notes/.note.gnu.build-id b/test/sys/module/hwmon/notes/.note.gnu.build-id deleted file mode 100644 index a38e58b6c7..0000000000 Binary files a/test/sys/module/hwmon/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/hwmon/refcnt b/test/sys/module/hwmon/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/hwmon/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/hwmon/sections/.bss b/test/sys/module/hwmon/sections/.bss deleted file mode 100644 index c0ebac7b40..0000000000 --- a/test/sys/module/hwmon/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007de80 diff --git a/test/sys/module/hwmon/sections/.data b/test/sys/module/hwmon/sections/.data deleted file mode 100644 index 7fa5d1d8b2..0000000000 --- a/test/sys/module/hwmon/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007da20 diff --git a/test/sys/module/hwmon/sections/.exit.text b/test/sys/module/hwmon/sections/.exit.text deleted file mode 100644 index 32b81419ba..0000000000 --- a/test/sys/module/hwmon/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d138 diff --git a/test/sys/module/hwmon/sections/.gnu.linkonce.this_module b/test/sys/module/hwmon/sections/.gnu.linkonce.this_module deleted file mode 100644 index d54bf92164..0000000000 --- a/test/sys/module/hwmon/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007dac0 diff --git a/test/sys/module/hwmon/sections/.init.text b/test/sys/module/hwmon/sections/.init.text deleted file mode 100644 index 0dbbf92722..0000000000 --- a/test/sys/module/hwmon/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009a000 diff --git a/test/sys/module/hwmon/sections/.note.gnu.build-id b/test/sys/module/hwmon/sections/.note.gnu.build-id deleted file mode 100644 index b626f19d67..0000000000 --- a/test/sys/module/hwmon/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d14c diff --git a/test/sys/module/hwmon/sections/.rodata.str1.1 b/test/sys/module/hwmon/sections/.rodata.str1.1 deleted file mode 100644 index 17da8b622c..0000000000 --- a/test/sys/module/hwmon/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d170 diff --git a/test/sys/module/hwmon/sections/.strtab b/test/sys/module/hwmon/sections/.strtab deleted file mode 100644 index a40baccfb9..0000000000 --- a/test/sys/module/hwmon/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d770 diff --git a/test/sys/module/hwmon/sections/.symtab b/test/sys/module/hwmon/sections/.symtab deleted file mode 100644 index 727fd07e07..0000000000 --- a/test/sys/module/hwmon/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d230 diff --git a/test/sys/module/hwmon/sections/.text b/test/sys/module/hwmon/sections/.text deleted file mode 100644 index 3e03f3c0fc..0000000000 --- a/test/sys/module/hwmon/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d000 diff --git a/test/sys/module/hwmon/sections/__kcrctab_gpl b/test/sys/module/hwmon/sections/__kcrctab_gpl deleted file mode 100644 index 96d7f65879..0000000000 --- a/test/sys/module/hwmon/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d1f0 diff --git a/test/sys/module/hwmon/sections/__ksymtab_gpl b/test/sys/module/hwmon/sections/__ksymtab_gpl deleted file mode 100644 index 800d572d3e..0000000000 --- a/test/sys/module/hwmon/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d1d0 diff --git a/test/sys/module/hwmon/sections/__ksymtab_strings b/test/sys/module/hwmon/sections/__ksymtab_strings deleted file mode 100644 index 856d50af2f..0000000000 --- a/test/sys/module/hwmon/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d200 diff --git a/test/sys/module/hwmon/srcversion b/test/sys/module/hwmon/srcversion deleted file mode 100644 index 4b0cd9206a..0000000000 --- a/test/sys/module/hwmon/srcversion +++ /dev/null @@ -1 +0,0 @@ -9344A0FAA4A298DC9AEBDC8 diff --git a/test/sys/module/i8042/parameters/debug b/test/sys/module/i8042/parameters/debug deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/i8042/parameters/debug +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/i8042/parameters/panicblink b/test/sys/module/i8042/parameters/panicblink deleted file mode 100644 index 1b79f38e25..0000000000 --- a/test/sys/module/i8042/parameters/panicblink +++ /dev/null @@ -1 +0,0 @@ -500 diff --git a/test/sys/module/intel_agp/drivers/pci:agpgart-intel b/test/sys/module/intel_agp/drivers/pci:agpgart-intel deleted file mode 120000 index cbef79a6d7..0000000000 --- a/test/sys/module/intel_agp/drivers/pci:agpgart-intel +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/agpgart-intel \ No newline at end of file diff --git a/test/sys/module/intel_agp/initstate b/test/sys/module/intel_agp/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/intel_agp/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/intel_agp/notes/.note.gnu.build-id b/test/sys/module/intel_agp/notes/.note.gnu.build-id deleted file mode 100644 index 6749c13ef5..0000000000 Binary files a/test/sys/module/intel_agp/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/intel_agp/refcnt b/test/sys/module/intel_agp/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/intel_agp/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/intel_agp/sections/.bss b/test/sys/module/intel_agp/sections/.bss deleted file mode 100644 index dc2280e1d4..0000000000 --- a/test/sys/module/intel_agp/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008da00 diff --git a/test/sys/module/intel_agp/sections/.data b/test/sys/module/intel_agp/sections/.data deleted file mode 100644 index a94eb61f73..0000000000 --- a/test/sys/module/intel_agp/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008cf60 diff --git a/test/sys/module/intel_agp/sections/.devexit.text b/test/sys/module/intel_agp/sections/.devexit.text deleted file mode 100644 index 1d152abfab..0000000000 --- a/test/sys/module/intel_agp/sections/.devexit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00893be diff --git a/test/sys/module/intel_agp/sections/.devinit.text b/test/sys/module/intel_agp/sections/.devinit.text deleted file mode 100644 index b0ddc821b8..0000000000 --- a/test/sys/module/intel_agp/sections/.devinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0089400 diff --git a/test/sys/module/intel_agp/sections/.exit.text b/test/sys/module/intel_agp/sections/.exit.text deleted file mode 100644 index c671ffc626..0000000000 --- a/test/sys/module/intel_agp/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00893ac diff --git a/test/sys/module/intel_agp/sections/.gnu.linkonce.this_module b/test/sys/module/intel_agp/sections/.gnu.linkonce.this_module deleted file mode 100644 index 4016aceb93..0000000000 --- a/test/sys/module/intel_agp/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008d640 diff --git a/test/sys/module/intel_agp/sections/.init.text b/test/sys/module/intel_agp/sections/.init.text deleted file mode 100644 index 069d70cd89..0000000000 --- a/test/sys/module/intel_agp/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008f000 diff --git a/test/sys/module/intel_agp/sections/.note.gnu.build-id b/test/sys/module/intel_agp/sections/.note.gnu.build-id deleted file mode 100644 index 841176ca5e..0000000000 --- a/test/sys/module/intel_agp/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00896b0 diff --git a/test/sys/module/intel_agp/sections/.rodata b/test/sys/module/intel_agp/sections/.rodata deleted file mode 100644 index e3c6c6ba08..0000000000 --- a/test/sys/module/intel_agp/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00896e0 diff --git a/test/sys/module/intel_agp/sections/.rodata.str1.1 b/test/sys/module/intel_agp/sections/.rodata.str1.1 deleted file mode 100644 index 0671f686e3..0000000000 --- a/test/sys/module/intel_agp/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008a9c0 diff --git a/test/sys/module/intel_agp/sections/.smp_locks b/test/sys/module/intel_agp/sections/.smp_locks deleted file mode 100644 index ac049eebe8..0000000000 --- a/test/sys/module/intel_agp/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008ae38 diff --git a/test/sys/module/intel_agp/sections/.strtab b/test/sys/module/intel_agp/sections/.strtab deleted file mode 100644 index b61f96d96b..0000000000 --- a/test/sys/module/intel_agp/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008c1b8 diff --git a/test/sys/module/intel_agp/sections/.symtab b/test/sys/module/intel_agp/sections/.symtab deleted file mode 100644 index 2f3af25557..0000000000 --- a/test/sys/module/intel_agp/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008ae50 diff --git a/test/sys/module/intel_agp/sections/.text b/test/sys/module/intel_agp/sections/.text deleted file mode 100644 index 45ee43be92..0000000000 --- a/test/sys/module/intel_agp/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0086000 diff --git a/test/sys/module/intel_agp/srcversion b/test/sys/module/intel_agp/srcversion deleted file mode 100644 index bb6ea3579b..0000000000 --- a/test/sys/module/intel_agp/srcversion +++ /dev/null @@ -1 +0,0 @@ -98AFACFFF6A1ADC3A6FAB67 diff --git a/test/sys/module/ipv6/initstate b/test/sys/module/ipv6/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/ipv6/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/ipv6/notes/.note.gnu.build-id b/test/sys/module/ipv6/notes/.note.gnu.build-id deleted file mode 100644 index 4ce3f748dd..0000000000 Binary files a/test/sys/module/ipv6/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/ipv6/refcnt b/test/sys/module/ipv6/refcnt deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/module/ipv6/refcnt +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/module/ipv6/sections/.bss b/test/sys/module/ipv6/sections/.bss deleted file mode 100644 index c4b6fde2cb..0000000000 --- a/test/sys/module/ipv6/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa029dd80 diff --git a/test/sys/module/ipv6/sections/.data b/test/sys/module/ipv6/sections/.data deleted file mode 100644 index e0c1eba38d..0000000000 --- a/test/sys/module/ipv6/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02998c0 diff --git a/test/sys/module/ipv6/sections/.data.read_mostly b/test/sys/module/ipv6/sections/.data.read_mostly deleted file mode 100644 index ab79595de9..0000000000 --- a/test/sys/module/ipv6/sections/.data.read_mostly +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa029cf20 diff --git a/test/sys/module/ipv6/sections/.exit.text b/test/sys/module/ipv6/sections/.exit.text deleted file mode 100644 index 4670322937..0000000000 --- a/test/sys/module/ipv6/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0285e40 diff --git a/test/sys/module/ipv6/sections/.gnu.linkonce.this_module b/test/sys/module/ipv6/sections/.gnu.linkonce.this_module deleted file mode 100644 index d849101f52..0000000000 --- a/test/sys/module/ipv6/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa029d9c0 diff --git a/test/sys/module/ipv6/sections/.init.data b/test/sys/module/ipv6/sections/.init.data deleted file mode 100644 index f94b25b538..0000000000 --- a/test/sys/module/ipv6/sections/.init.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065d80 diff --git a/test/sys/module/ipv6/sections/.init.text b/test/sys/module/ipv6/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/ipv6/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/ipv6/sections/.note.gnu.build-id b/test/sys/module/ipv6/sections/.note.gnu.build-id deleted file mode 100644 index 3858876a3b..0000000000 --- a/test/sys/module/ipv6/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0286024 diff --git a/test/sys/module/ipv6/sections/.ref.text b/test/sys/module/ipv6/sections/.ref.text deleted file mode 100644 index 4b859f70de..0000000000 --- a/test/sys/module/ipv6/sections/.ref.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0285f40 diff --git a/test/sys/module/ipv6/sections/.rodata b/test/sys/module/ipv6/sections/.rodata deleted file mode 100644 index 45747aea98..0000000000 --- a/test/sys/module/ipv6/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0286060 diff --git a/test/sys/module/ipv6/sections/.rodata.str1.1 b/test/sys/module/ipv6/sections/.rodata.str1.1 deleted file mode 100644 index c25ecc816c..0000000000 --- a/test/sys/module/ipv6/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02883c0 diff --git a/test/sys/module/ipv6/sections/.smp_locks b/test/sys/module/ipv6/sections/.smp_locks deleted file mode 100644 index 774f500387..0000000000 --- a/test/sys/module/ipv6/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa028a240 diff --git a/test/sys/module/ipv6/sections/.strtab b/test/sys/module/ipv6/sections/.strtab deleted file mode 100644 index 9cbbb6811e..0000000000 --- a/test/sys/module/ipv6/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02937f0 diff --git a/test/sys/module/ipv6/sections/.symtab b/test/sys/module/ipv6/sections/.symtab deleted file mode 100644 index 8a7abea9b5..0000000000 --- a/test/sys/module/ipv6/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa028b4c8 diff --git a/test/sys/module/ipv6/sections/.text b/test/sys/module/ipv6/sections/.text deleted file mode 100644 index 69bc4b5ea5..0000000000 --- a/test/sys/module/ipv6/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0258000 diff --git a/test/sys/module/ipv6/sections/__bug_table b/test/sys/module/ipv6/sections/__bug_table deleted file mode 100644 index 653607e5b3..0000000000 --- a/test/sys/module/ipv6/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0288edd diff --git a/test/sys/module/ipv6/sections/__kcrctab b/test/sys/module/ipv6/sections/__kcrctab deleted file mode 100644 index ab936c8d19..0000000000 --- a/test/sys/module/ipv6/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa028afe0 diff --git a/test/sys/module/ipv6/sections/__kcrctab_gpl b/test/sys/module/ipv6/sections/__kcrctab_gpl deleted file mode 100644 index e924548943..0000000000 --- a/test/sys/module/ipv6/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa028ad10 diff --git a/test/sys/module/ipv6/sections/__ksymtab b/test/sys/module/ipv6/sections/__ksymtab deleted file mode 100644 index f3dc04a1b8..0000000000 --- a/test/sys/module/ipv6/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa028ad90 diff --git a/test/sys/module/ipv6/sections/__ksymtab_gpl b/test/sys/module/ipv6/sections/__ksymtab_gpl deleted file mode 100644 index 82fc89364e..0000000000 --- a/test/sys/module/ipv6/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa028ac10 diff --git a/test/sys/module/ipv6/sections/__ksymtab_strings b/test/sys/module/ipv6/sections/__ksymtab_strings deleted file mode 100644 index c569e8609d..0000000000 --- a/test/sys/module/ipv6/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa028b108 diff --git a/test/sys/module/ipv6/srcversion b/test/sys/module/ipv6/srcversion deleted file mode 100644 index d1b9b911f3..0000000000 --- a/test/sys/module/ipv6/srcversion +++ /dev/null @@ -1 +0,0 @@ -184C844E7A78529619B4C9D diff --git a/test/sys/module/iwl3945/drivers/pci:iwl3945 b/test/sys/module/iwl3945/drivers/pci:iwl3945 deleted file mode 120000 index d875969343..0000000000 --- a/test/sys/module/iwl3945/drivers/pci:iwl3945 +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/iwl3945 \ No newline at end of file diff --git a/test/sys/module/iwl3945/initstate b/test/sys/module/iwl3945/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/iwl3945/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/iwl3945/notes/.note.gnu.build-id b/test/sys/module/iwl3945/notes/.note.gnu.build-id deleted file mode 100644 index 5ba8fb360f..0000000000 Binary files a/test/sys/module/iwl3945/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/iwl3945/parameters/antenna b/test/sys/module/iwl3945/parameters/antenna deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/iwl3945/parameters/antenna +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/iwl3945/parameters/debug b/test/sys/module/iwl3945/parameters/debug deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/iwl3945/parameters/debug +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/iwl3945/parameters/disable b/test/sys/module/iwl3945/parameters/disable deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/iwl3945/parameters/disable +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/iwl3945/parameters/disable_hw_scan b/test/sys/module/iwl3945/parameters/disable_hw_scan deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/iwl3945/parameters/disable_hw_scan +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/iwl3945/parameters/hwcrypto b/test/sys/module/iwl3945/parameters/hwcrypto deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/iwl3945/parameters/hwcrypto +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/iwl3945/parameters/qos_enable b/test/sys/module/iwl3945/parameters/qos_enable deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/iwl3945/parameters/qos_enable +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/iwl3945/parameters/queues_num b/test/sys/module/iwl3945/parameters/queues_num deleted file mode 100644 index 45a4fb75db..0000000000 --- a/test/sys/module/iwl3945/parameters/queues_num +++ /dev/null @@ -1 +0,0 @@ -8 diff --git a/test/sys/module/iwl3945/refcnt b/test/sys/module/iwl3945/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/iwl3945/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/iwl3945/sections/.bss b/test/sys/module/iwl3945/sections/.bss deleted file mode 100644 index f83abbaa1a..0000000000 --- a/test/sys/module/iwl3945/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0163d80 diff --git a/test/sys/module/iwl3945/sections/.data b/test/sys/module/iwl3945/sections/.data deleted file mode 100644 index fa8158b32b..0000000000 --- a/test/sys/module/iwl3945/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0162f00 diff --git a/test/sys/module/iwl3945/sections/.devexit.text b/test/sys/module/iwl3945/sections/.devexit.text deleted file mode 100644 index 1b534d0daf..0000000000 --- a/test/sys/module/iwl3945/sections/.devexit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa015b044 diff --git a/test/sys/module/iwl3945/sections/.exit.text b/test/sys/module/iwl3945/sections/.exit.text deleted file mode 100644 index f86e36cc47..0000000000 --- a/test/sys/module/iwl3945/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa015b2e4 diff --git a/test/sys/module/iwl3945/sections/.gnu.linkonce.this_module b/test/sys/module/iwl3945/sections/.gnu.linkonce.this_module deleted file mode 100644 index 7fa3eea359..0000000000 --- a/test/sys/module/iwl3945/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01639c0 diff --git a/test/sys/module/iwl3945/sections/.init.text b/test/sys/module/iwl3945/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/iwl3945/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/iwl3945/sections/.note.gnu.build-id b/test/sys/module/iwl3945/sections/.note.gnu.build-id deleted file mode 100644 index fb204740fb..0000000000 --- a/test/sys/module/iwl3945/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa015b2fc diff --git a/test/sys/module/iwl3945/sections/.rodata b/test/sys/module/iwl3945/sections/.rodata deleted file mode 100644 index b743f277c9..0000000000 --- a/test/sys/module/iwl3945/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa015b320 diff --git a/test/sys/module/iwl3945/sections/.rodata.str1.1 b/test/sys/module/iwl3945/sections/.rodata.str1.1 deleted file mode 100644 index 4c197a468a..0000000000 --- a/test/sys/module/iwl3945/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa015bc0c diff --git a/test/sys/module/iwl3945/sections/.smp_locks b/test/sys/module/iwl3945/sections/.smp_locks deleted file mode 100644 index 5925c17427..0000000000 --- a/test/sys/module/iwl3945/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa015e0e0 diff --git a/test/sys/module/iwl3945/sections/.strtab b/test/sys/module/iwl3945/sections/.strtab deleted file mode 100644 index 3258a71020..0000000000 --- a/test/sys/module/iwl3945/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0160f20 diff --git a/test/sys/module/iwl3945/sections/.symtab b/test/sys/module/iwl3945/sections/.symtab deleted file mode 100644 index c801241c5a..0000000000 --- a/test/sys/module/iwl3945/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa015e5c8 diff --git a/test/sys/module/iwl3945/sections/.text b/test/sys/module/iwl3945/sections/.text deleted file mode 100644 index 0902a848df..0000000000 --- a/test/sys/module/iwl3945/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa014b000 diff --git a/test/sys/module/iwl3945/sections/__bug_table b/test/sys/module/iwl3945/sections/__bug_table deleted file mode 100644 index 5c5c354c62..0000000000 --- a/test/sys/module/iwl3945/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa015e300 diff --git a/test/sys/module/iwl3945/sections/__param b/test/sys/module/iwl3945/sections/__param deleted file mode 100644 index 0112cec232..0000000000 --- a/test/sys/module/iwl3945/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa015e4b0 diff --git a/test/sys/module/iwl3945/srcversion b/test/sys/module/iwl3945/srcversion deleted file mode 100644 index fa65dc4968..0000000000 --- a/test/sys/module/iwl3945/srcversion +++ /dev/null @@ -1 +0,0 @@ -5C079549ABD48E07B20F3C7 diff --git a/test/sys/module/iwl3945/version b/test/sys/module/iwl3945/version deleted file mode 100644 index eda05bc452..0000000000 --- a/test/sys/module/iwl3945/version +++ /dev/null @@ -1 +0,0 @@ -1.2.26ks diff --git a/test/sys/module/keyboard/parameters/brl_nbchords b/test/sys/module/keyboard/parameters/brl_nbchords deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/keyboard/parameters/brl_nbchords +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/keyboard/parameters/brl_timeout b/test/sys/module/keyboard/parameters/brl_timeout deleted file mode 100644 index 697cb3a26d..0000000000 --- a/test/sys/module/keyboard/parameters/brl_timeout +++ /dev/null @@ -1 +0,0 @@ -300 diff --git a/test/sys/module/led_class/holders/iwl3945 b/test/sys/module/led_class/holders/iwl3945 deleted file mode 120000 index 31cc83c4cc..0000000000 --- a/test/sys/module/led_class/holders/iwl3945 +++ /dev/null @@ -1 +0,0 @@ -../../iwl3945 \ No newline at end of file diff --git a/test/sys/module/led_class/holders/thinkpad_acpi b/test/sys/module/led_class/holders/thinkpad_acpi deleted file mode 120000 index 8d266ed087..0000000000 --- a/test/sys/module/led_class/holders/thinkpad_acpi +++ /dev/null @@ -1 +0,0 @@ -../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/led_class/initstate b/test/sys/module/led_class/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/led_class/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/led_class/notes/.note.gnu.build-id b/test/sys/module/led_class/notes/.note.gnu.build-id deleted file mode 100644 index 38e15f4ad5..0000000000 Binary files a/test/sys/module/led_class/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/led_class/refcnt b/test/sys/module/led_class/refcnt deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/led_class/refcnt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/led_class/sections/.bss b/test/sys/module/led_class/sections/.bss deleted file mode 100644 index 2f7d3816f0..0000000000 --- a/test/sys/module/led_class/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f3500 diff --git a/test/sys/module/led_class/sections/.data b/test/sys/module/led_class/sections/.data deleted file mode 100644 index 2ddd1e3eef..0000000000 --- a/test/sys/module/led_class/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f30c0 diff --git a/test/sys/module/led_class/sections/.exit.text b/test/sys/module/led_class/sections/.exit.text deleted file mode 100644 index 03d8ca7408..0000000000 --- a/test/sys/module/led_class/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f2330 diff --git a/test/sys/module/led_class/sections/.gnu.linkonce.this_module b/test/sys/module/led_class/sections/.gnu.linkonce.this_module deleted file mode 100644 index 5a7036ff71..0000000000 --- a/test/sys/module/led_class/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f3140 diff --git a/test/sys/module/led_class/sections/.init.text b/test/sys/module/led_class/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/led_class/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/led_class/sections/.note.gnu.build-id b/test/sys/module/led_class/sections/.note.gnu.build-id deleted file mode 100644 index ed2c2c10b3..0000000000 --- a/test/sys/module/led_class/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f2344 diff --git a/test/sys/module/led_class/sections/.rodata.str1.1 b/test/sys/module/led_class/sections/.rodata.str1.1 deleted file mode 100644 index e5f9d5f59d..0000000000 --- a/test/sys/module/led_class/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f2368 diff --git a/test/sys/module/led_class/sections/.strtab b/test/sys/module/led_class/sections/.strtab deleted file mode 100644 index 7ea490f1b1..0000000000 --- a/test/sys/module/led_class/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f2bf8 diff --git a/test/sys/module/led_class/sections/.symtab b/test/sys/module/led_class/sections/.symtab deleted file mode 100644 index 0cb7be4ca6..0000000000 --- a/test/sys/module/led_class/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f2478 diff --git a/test/sys/module/led_class/sections/.text b/test/sys/module/led_class/sections/.text deleted file mode 100644 index 167debf340..0000000000 --- a/test/sys/module/led_class/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f2000 diff --git a/test/sys/module/led_class/sections/__kcrctab_gpl b/test/sys/module/led_class/sections/__kcrctab_gpl deleted file mode 100644 index 8119e7f283..0000000000 --- a/test/sys/module/led_class/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f2400 diff --git a/test/sys/module/led_class/sections/__ksymtab_gpl b/test/sys/module/led_class/sections/__ksymtab_gpl deleted file mode 100644 index dbd2e57e11..0000000000 --- a/test/sys/module/led_class/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f23c0 diff --git a/test/sys/module/led_class/sections/__ksymtab_strings b/test/sys/module/led_class/sections/__ksymtab_strings deleted file mode 100644 index 272942720a..0000000000 --- a/test/sys/module/led_class/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f2420 diff --git a/test/sys/module/led_class/srcversion b/test/sys/module/led_class/srcversion deleted file mode 100644 index 41de285dc7..0000000000 --- a/test/sys/module/led_class/srcversion +++ /dev/null @@ -1 +0,0 @@ -B916A50F53ABBBB19DFF203 diff --git a/test/sys/module/libata/parameters/acpi_gtf_filter b/test/sys/module/libata/parameters/acpi_gtf_filter deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/module/libata/parameters/acpi_gtf_filter +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/module/libata/parameters/allow_tpm b/test/sys/module/libata/parameters/allow_tpm deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/libata/parameters/allow_tpm +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/libata/parameters/ata_probe_timeout b/test/sys/module/libata/parameters/ata_probe_timeout deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/libata/parameters/ata_probe_timeout +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/libata/parameters/atapi_dmadir b/test/sys/module/libata/parameters/atapi_dmadir deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/libata/parameters/atapi_dmadir +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/libata/parameters/atapi_enabled b/test/sys/module/libata/parameters/atapi_enabled deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/libata/parameters/atapi_enabled +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/libata/parameters/atapi_passthru16 b/test/sys/module/libata/parameters/atapi_passthru16 deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/libata/parameters/atapi_passthru16 +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/libata/parameters/dma b/test/sys/module/libata/parameters/dma deleted file mode 100644 index 7f8f011eb7..0000000000 --- a/test/sys/module/libata/parameters/dma +++ /dev/null @@ -1 +0,0 @@ -7 diff --git a/test/sys/module/libata/parameters/fua b/test/sys/module/libata/parameters/fua deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/libata/parameters/fua +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/libata/parameters/ignore_hpa b/test/sys/module/libata/parameters/ignore_hpa deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/libata/parameters/ignore_hpa +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/libata/parameters/noacpi b/test/sys/module/libata/parameters/noacpi deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/libata/parameters/noacpi +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/lockdep/parameters/lock_stat b/test/sys/module/lockdep/parameters/lock_stat deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/lockdep/parameters/lock_stat +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/loop/initstate b/test/sys/module/loop/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/loop/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/loop/notes/.note.gnu.build-id b/test/sys/module/loop/notes/.note.gnu.build-id deleted file mode 100644 index 49e1d58097..0000000000 Binary files a/test/sys/module/loop/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/loop/refcnt b/test/sys/module/loop/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/loop/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/loop/sections/.bss b/test/sys/module/loop/sections/.bss deleted file mode 100644 index 083b73e1df..0000000000 --- a/test/sys/module/loop/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023e780 diff --git a/test/sys/module/loop/sections/.data b/test/sys/module/loop/sections/.data deleted file mode 100644 index af5113091b..0000000000 --- a/test/sys/module/loop/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023e180 diff --git a/test/sys/module/loop/sections/.exit.text b/test/sys/module/loop/sections/.exit.text deleted file mode 100644 index ada33c7e63..0000000000 --- a/test/sys/module/loop/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023c72c diff --git a/test/sys/module/loop/sections/.gnu.linkonce.this_module b/test/sys/module/loop/sections/.gnu.linkonce.this_module deleted file mode 100644 index 6b4f79dc6b..0000000000 --- a/test/sys/module/loop/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023e3c0 diff --git a/test/sys/module/loop/sections/.init.text b/test/sys/module/loop/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/loop/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/loop/sections/.note.gnu.build-id b/test/sys/module/loop/sections/.note.gnu.build-id deleted file mode 100644 index 88525dc457..0000000000 --- a/test/sys/module/loop/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023c7e4 diff --git a/test/sys/module/loop/sections/.rodata b/test/sys/module/loop/sections/.rodata deleted file mode 100644 index d4b2e98c28..0000000000 --- a/test/sys/module/loop/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023c808 diff --git a/test/sys/module/loop/sections/.rodata.str1.1 b/test/sys/module/loop/sections/.rodata.str1.1 deleted file mode 100644 index 6e26c0cd0c..0000000000 --- a/test/sys/module/loop/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023c88a diff --git a/test/sys/module/loop/sections/.strtab b/test/sys/module/loop/sections/.strtab deleted file mode 100644 index 0dfdf48cce..0000000000 --- a/test/sys/module/loop/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023d960 diff --git a/test/sys/module/loop/sections/.symtab b/test/sys/module/loop/sections/.symtab deleted file mode 100644 index 319270eb37..0000000000 --- a/test/sys/module/loop/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023cb20 diff --git a/test/sys/module/loop/sections/.text b/test/sys/module/loop/sections/.text deleted file mode 100644 index 15b9c3b142..0000000000 --- a/test/sys/module/loop/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023a000 diff --git a/test/sys/module/loop/sections/__bug_table b/test/sys/module/loop/sections/__bug_table deleted file mode 100644 index 7527265e79..0000000000 --- a/test/sys/module/loop/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023ca1f diff --git a/test/sys/module/loop/sections/__kcrctab b/test/sys/module/loop/sections/__kcrctab deleted file mode 100644 index e30b4aaed2..0000000000 --- a/test/sys/module/loop/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023ca90 diff --git a/test/sys/module/loop/sections/__ksymtab b/test/sys/module/loop/sections/__ksymtab deleted file mode 100644 index 4e5ddf35ce..0000000000 --- a/test/sys/module/loop/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023ca70 diff --git a/test/sys/module/loop/sections/__ksymtab_strings b/test/sys/module/loop/sections/__ksymtab_strings deleted file mode 100644 index c7ae548fcd..0000000000 --- a/test/sys/module/loop/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023caf0 diff --git a/test/sys/module/loop/sections/__param b/test/sys/module/loop/sections/__param deleted file mode 100644 index 0eeb89ac48..0000000000 --- a/test/sys/module/loop/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa023caa0 diff --git a/test/sys/module/loop/srcversion b/test/sys/module/loop/srcversion deleted file mode 100644 index 07627a9e2c..0000000000 --- a/test/sys/module/loop/srcversion +++ /dev/null @@ -1 +0,0 @@ -7595F5D46DFDB4A2D489DDD diff --git a/test/sys/module/mac80211/holders/iwl3945 b/test/sys/module/mac80211/holders/iwl3945 deleted file mode 120000 index 31cc83c4cc..0000000000 --- a/test/sys/module/mac80211/holders/iwl3945 +++ /dev/null @@ -1 +0,0 @@ -../../iwl3945 \ No newline at end of file diff --git a/test/sys/module/mac80211/initstate b/test/sys/module/mac80211/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/mac80211/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/mac80211/notes/.note.gnu.build-id b/test/sys/module/mac80211/notes/.note.gnu.build-id deleted file mode 100644 index abdec04aed..0000000000 Binary files a/test/sys/module/mac80211/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/mac80211/parameters/ieee80211_default_rc_algo b/test/sys/module/mac80211/parameters/ieee80211_default_rc_algo deleted file mode 100644 index 7fe681d267..0000000000 --- a/test/sys/module/mac80211/parameters/ieee80211_default_rc_algo +++ /dev/null @@ -1 +0,0 @@ -pid diff --git a/test/sys/module/mac80211/refcnt b/test/sys/module/mac80211/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/mac80211/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/mac80211/sections/.bss b/test/sys/module/mac80211/sections/.bss deleted file mode 100644 index 37fb900c52..0000000000 --- a/test/sys/module/mac80211/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa012fa40 diff --git a/test/sys/module/mac80211/sections/.data b/test/sys/module/mac80211/sections/.data deleted file mode 100644 index 99e1579bf4..0000000000 --- a/test/sys/module/mac80211/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa012f340 diff --git a/test/sys/module/mac80211/sections/.exit.text b/test/sys/module/mac80211/sections/.exit.text deleted file mode 100644 index 5ea5e85790..0000000000 --- a/test/sys/module/mac80211/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0122de4 diff --git a/test/sys/module/mac80211/sections/.gnu.linkonce.this_module b/test/sys/module/mac80211/sections/.gnu.linkonce.this_module deleted file mode 100644 index 01498bacc2..0000000000 --- a/test/sys/module/mac80211/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa012f680 diff --git a/test/sys/module/mac80211/sections/.init.text b/test/sys/module/mac80211/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/mac80211/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/mac80211/sections/.note.gnu.build-id b/test/sys/module/mac80211/sections/.note.gnu.build-id deleted file mode 100644 index 45182d7f2b..0000000000 --- a/test/sys/module/mac80211/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0122df4 diff --git a/test/sys/module/mac80211/sections/.rodata b/test/sys/module/mac80211/sections/.rodata deleted file mode 100644 index 2fbabf002d..0000000000 --- a/test/sys/module/mac80211/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0122e20 diff --git a/test/sys/module/mac80211/sections/.rodata.str1.1 b/test/sys/module/mac80211/sections/.rodata.str1.1 deleted file mode 100644 index 71a1c8e248..0000000000 --- a/test/sys/module/mac80211/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0123c40 diff --git a/test/sys/module/mac80211/sections/.smp_locks b/test/sys/module/mac80211/sections/.smp_locks deleted file mode 100644 index 45d9d8ab8a..0000000000 --- a/test/sys/module/mac80211/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01270a0 diff --git a/test/sys/module/mac80211/sections/.strtab b/test/sys/module/mac80211/sections/.strtab deleted file mode 100644 index 9d3adbc950..0000000000 --- a/test/sys/module/mac80211/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa012b890 diff --git a/test/sys/module/mac80211/sections/.symtab b/test/sys/module/mac80211/sections/.symtab deleted file mode 100644 index 954a225786..0000000000 --- a/test/sys/module/mac80211/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0127a80 diff --git a/test/sys/module/mac80211/sections/.text b/test/sys/module/mac80211/sections/.text deleted file mode 100644 index a9e219d005..0000000000 --- a/test/sys/module/mac80211/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0109000 diff --git a/test/sys/module/mac80211/sections/__bug_table b/test/sys/module/mac80211/sections/__bug_table deleted file mode 100644 index 8d4014267f..0000000000 --- a/test/sys/module/mac80211/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0124183 diff --git a/test/sys/module/mac80211/sections/__kcrctab b/test/sys/module/mac80211/sections/__kcrctab deleted file mode 100644 index 56c148953d..0000000000 --- a/test/sys/module/mac80211/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0127500 diff --git a/test/sys/module/mac80211/sections/__kcrctab_gpl b/test/sys/module/mac80211/sections/__kcrctab_gpl deleted file mode 100644 index a485275805..0000000000 --- a/test/sys/module/mac80211/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0127a70 diff --git a/test/sys/module/mac80211/sections/__ksymtab b/test/sys/module/mac80211/sections/__ksymtab deleted file mode 100644 index 967c679208..0000000000 --- a/test/sys/module/mac80211/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01272a0 diff --git a/test/sys/module/mac80211/sections/__ksymtab_gpl b/test/sys/module/mac80211/sections/__ksymtab_gpl deleted file mode 100644 index e9bcf7e136..0000000000 --- a/test/sys/module/mac80211/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0127a50 diff --git a/test/sys/module/mac80211/sections/__ksymtab_strings b/test/sys/module/mac80211/sections/__ksymtab_strings deleted file mode 100644 index e79e4cece9..0000000000 --- a/test/sys/module/mac80211/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0127630 diff --git a/test/sys/module/mac80211/sections/__param b/test/sys/module/mac80211/sections/__param deleted file mode 100644 index a214f0338b..0000000000 --- a/test/sys/module/mac80211/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0127a28 diff --git a/test/sys/module/mac80211/srcversion b/test/sys/module/mac80211/srcversion deleted file mode 100644 index a983e5dc22..0000000000 --- a/test/sys/module/mac80211/srcversion +++ /dev/null @@ -1 +0,0 @@ -330E8FB2F2933F478C444A4 diff --git a/test/sys/module/md_mod/holders/raid1 b/test/sys/module/md_mod/holders/raid1 deleted file mode 120000 index 3d6cc7abf7..0000000000 --- a/test/sys/module/md_mod/holders/raid1 +++ /dev/null @@ -1 +0,0 @@ -../../raid1 \ No newline at end of file diff --git a/test/sys/module/md_mod/initstate b/test/sys/module/md_mod/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/md_mod/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/md_mod/notes/.note.gnu.build-id b/test/sys/module/md_mod/notes/.note.gnu.build-id deleted file mode 100644 index 92df782a6e..0000000000 Binary files a/test/sys/module/md_mod/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/md_mod/parameters/start_dirty_degraded b/test/sys/module/md_mod/parameters/start_dirty_degraded deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/md_mod/parameters/start_dirty_degraded +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/md_mod/parameters/start_ro b/test/sys/module/md_mod/parameters/start_ro deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/md_mod/parameters/start_ro +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/md_mod/refcnt b/test/sys/module/md_mod/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/md_mod/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/md_mod/sections/.bss b/test/sys/module/md_mod/sections/.bss deleted file mode 100644 index a23f3ddb24..0000000000 --- a/test/sys/module/md_mod/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0230880 diff --git a/test/sys/module/md_mod/sections/.data b/test/sys/module/md_mod/sections/.data deleted file mode 100644 index d134d15393..0000000000 --- a/test/sys/module/md_mod/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022f660 diff --git a/test/sys/module/md_mod/sections/.exit.text b/test/sys/module/md_mod/sections/.exit.text deleted file mode 100644 index 6fcd5caef3..0000000000 --- a/test/sys/module/md_mod/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02283a0 diff --git a/test/sys/module/md_mod/sections/.gnu.linkonce.this_module b/test/sys/module/md_mod/sections/.gnu.linkonce.this_module deleted file mode 100644 index 7d622d1d1f..0000000000 --- a/test/sys/module/md_mod/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02304c0 diff --git a/test/sys/module/md_mod/sections/.init.text b/test/sys/module/md_mod/sections/.init.text deleted file mode 100644 index 0cac0d19cf..0000000000 --- a/test/sys/module/md_mod/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0070000 diff --git a/test/sys/module/md_mod/sections/.note.gnu.build-id b/test/sys/module/md_mod/sections/.note.gnu.build-id deleted file mode 100644 index 9a73ad54b1..0000000000 --- a/test/sys/module/md_mod/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02284c8 diff --git a/test/sys/module/md_mod/sections/.rodata b/test/sys/module/md_mod/sections/.rodata deleted file mode 100644 index fcfe7a5ee3..0000000000 --- a/test/sys/module/md_mod/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0228500 diff --git a/test/sys/module/md_mod/sections/.rodata.str1.1 b/test/sys/module/md_mod/sections/.rodata.str1.1 deleted file mode 100644 index 1fc2b5e27d..0000000000 --- a/test/sys/module/md_mod/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022869e diff --git a/test/sys/module/md_mod/sections/.smp_locks b/test/sys/module/md_mod/sections/.smp_locks deleted file mode 100644 index b413436291..0000000000 --- a/test/sys/module/md_mod/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022a038 diff --git a/test/sys/module/md_mod/sections/.strtab b/test/sys/module/md_mod/sections/.strtab deleted file mode 100644 index 24caadad13..0000000000 --- a/test/sys/module/md_mod/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022d7a0 diff --git a/test/sys/module/md_mod/sections/.symtab b/test/sys/module/md_mod/sections/.symtab deleted file mode 100644 index 8b7e2f881a..0000000000 --- a/test/sys/module/md_mod/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022a968 diff --git a/test/sys/module/md_mod/sections/.text b/test/sys/module/md_mod/sections/.text deleted file mode 100644 index 19761bcaf0..0000000000 --- a/test/sys/module/md_mod/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa021a000 diff --git a/test/sys/module/md_mod/sections/__bug_table b/test/sys/module/md_mod/sections/__bug_table deleted file mode 100644 index 61bbfe3885..0000000000 --- a/test/sys/module/md_mod/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022a4b8 diff --git a/test/sys/module/md_mod/sections/__kcrctab b/test/sys/module/md_mod/sections/__kcrctab deleted file mode 100644 index b1d4d56888..0000000000 --- a/test/sys/module/md_mod/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022a6b0 diff --git a/test/sys/module/md_mod/sections/__kcrctab_gpl b/test/sys/module/md_mod/sections/__kcrctab_gpl deleted file mode 100644 index 1f881cc61e..0000000000 --- a/test/sys/module/md_mod/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022a7d0 diff --git a/test/sys/module/md_mod/sections/__ksymtab b/test/sys/module/md_mod/sections/__ksymtab deleted file mode 100644 index 696610dbdd..0000000000 --- a/test/sys/module/md_mod/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022a590 diff --git a/test/sys/module/md_mod/sections/__ksymtab_gpl b/test/sys/module/md_mod/sections/__ksymtab_gpl deleted file mode 100644 index 3d6580a06f..0000000000 --- a/test/sys/module/md_mod/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022a790 diff --git a/test/sys/module/md_mod/sections/__ksymtab_strings b/test/sys/module/md_mod/sections/__ksymtab_strings deleted file mode 100644 index 2e544c8a8f..0000000000 --- a/test/sys/module/md_mod/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022a7f0 diff --git a/test/sys/module/md_mod/sections/__param b/test/sys/module/md_mod/sections/__param deleted file mode 100644 index b7dc1d7b9a..0000000000 --- a/test/sys/module/md_mod/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa022a740 diff --git a/test/sys/module/md_mod/srcversion b/test/sys/module/md_mod/srcversion deleted file mode 100644 index 04620cd647..0000000000 --- a/test/sys/module/md_mod/srcversion +++ /dev/null @@ -1 +0,0 @@ -1DB954BE8FA97D4755DC15B diff --git a/test/sys/module/microcode/initstate b/test/sys/module/microcode/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/microcode/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/microcode/notes/.note.gnu.build-id b/test/sys/module/microcode/notes/.note.gnu.build-id deleted file mode 100644 index e5d5c653ab..0000000000 Binary files a/test/sys/module/microcode/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/microcode/refcnt b/test/sys/module/microcode/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/microcode/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/microcode/sections/.bss b/test/sys/module/microcode/sections/.bss deleted file mode 100644 index 14def56f03..0000000000 --- a/test/sys/module/microcode/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0252c40 diff --git a/test/sys/module/microcode/sections/.cpuinit.text b/test/sys/module/microcode/sections/.cpuinit.text deleted file mode 100644 index 7ade90a2bd..0000000000 --- a/test/sys/module/microcode/sections/.cpuinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0250d90 diff --git a/test/sys/module/microcode/sections/.data b/test/sys/module/microcode/sections/.data deleted file mode 100644 index e02c194aeb..0000000000 --- a/test/sys/module/microcode/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0252600 diff --git a/test/sys/module/microcode/sections/.exit.text b/test/sys/module/microcode/sections/.exit.text deleted file mode 100644 index 6a80762e87..0000000000 --- a/test/sys/module/microcode/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0250ff6 diff --git a/test/sys/module/microcode/sections/.gnu.linkonce.this_module b/test/sys/module/microcode/sections/.gnu.linkonce.this_module deleted file mode 100644 index 8976fa7b35..0000000000 --- a/test/sys/module/microcode/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0252880 diff --git a/test/sys/module/microcode/sections/.init.text b/test/sys/module/microcode/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/microcode/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/microcode/sections/.note.gnu.build-id b/test/sys/module/microcode/sections/.note.gnu.build-id deleted file mode 100644 index 2869215edf..0000000000 --- a/test/sys/module/microcode/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0251040 diff --git a/test/sys/module/microcode/sections/.ref.data b/test/sys/module/microcode/sections/.ref.data deleted file mode 100644 index 3285f61b40..0000000000 --- a/test/sys/module/microcode/sections/.ref.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0252850 diff --git a/test/sys/module/microcode/sections/.rodata b/test/sys/module/microcode/sections/.rodata deleted file mode 100644 index faa8a335f1..0000000000 --- a/test/sys/module/microcode/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0251080 diff --git a/test/sys/module/microcode/sections/.rodata.str1.1 b/test/sys/module/microcode/sections/.rodata.str1.1 deleted file mode 100644 index 83c30cf102..0000000000 --- a/test/sys/module/microcode/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0251218 diff --git a/test/sys/module/microcode/sections/.strtab b/test/sys/module/microcode/sections/.strtab deleted file mode 100644 index f71a7c1531..0000000000 --- a/test/sys/module/microcode/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02520b8 diff --git a/test/sys/module/microcode/sections/.symtab b/test/sys/module/microcode/sections/.symtab deleted file mode 100644 index 9e581706c6..0000000000 --- a/test/sys/module/microcode/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0251740 diff --git a/test/sys/module/microcode/sections/.text b/test/sys/module/microcode/sections/.text deleted file mode 100644 index 3ea5399437..0000000000 --- a/test/sys/module/microcode/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0250000 diff --git a/test/sys/module/microcode/sections/__bug_table b/test/sys/module/microcode/sections/__bug_table deleted file mode 100644 index 1575c1d463..0000000000 --- a/test/sys/module/microcode/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02516f7 diff --git a/test/sys/module/microcode/srcversion b/test/sys/module/microcode/srcversion deleted file mode 100644 index f33e1688ca..0000000000 --- a/test/sys/module/microcode/srcversion +++ /dev/null @@ -1 +0,0 @@ -FC3DA13E858B639D12F2043 diff --git a/test/sys/module/mousedev/parameters/tap_time b/test/sys/module/mousedev/parameters/tap_time deleted file mode 100644 index 08839f6bb2..0000000000 --- a/test/sys/module/mousedev/parameters/tap_time +++ /dev/null @@ -1 +0,0 @@ -200 diff --git a/test/sys/module/mousedev/parameters/xres b/test/sys/module/mousedev/parameters/xres deleted file mode 100644 index d7b1c440c0..0000000000 --- a/test/sys/module/mousedev/parameters/xres +++ /dev/null @@ -1 +0,0 @@ -1024 diff --git a/test/sys/module/mousedev/parameters/yres b/test/sys/module/mousedev/parameters/yres deleted file mode 100644 index dc763b654e..0000000000 --- a/test/sys/module/mousedev/parameters/yres +++ /dev/null @@ -1 +0,0 @@ -768 diff --git a/test/sys/module/nvram/holders/thinkpad_acpi b/test/sys/module/nvram/holders/thinkpad_acpi deleted file mode 120000 index 8d266ed087..0000000000 --- a/test/sys/module/nvram/holders/thinkpad_acpi +++ /dev/null @@ -1 +0,0 @@ -../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/nvram/initstate b/test/sys/module/nvram/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/nvram/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/nvram/notes/.note.gnu.build-id b/test/sys/module/nvram/notes/.note.gnu.build-id deleted file mode 100644 index 579bd3f634..0000000000 Binary files a/test/sys/module/nvram/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/nvram/refcnt b/test/sys/module/nvram/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/nvram/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/nvram/sections/.bss b/test/sys/module/nvram/sections/.bss deleted file mode 100644 index aaf494f4f2..0000000000 --- a/test/sys/module/nvram/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ae640 diff --git a/test/sys/module/nvram/sections/.data b/test/sys/module/nvram/sections/.data deleted file mode 100644 index 134ce8a3d0..0000000000 --- a/test/sys/module/nvram/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ae200 diff --git a/test/sys/module/nvram/sections/.exit.text b/test/sys/module/nvram/sections/.exit.text deleted file mode 100644 index ccc921bf01..0000000000 --- a/test/sys/module/nvram/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ace3c diff --git a/test/sys/module/nvram/sections/.gnu.linkonce.this_module b/test/sys/module/nvram/sections/.gnu.linkonce.this_module deleted file mode 100644 index 8d746ae44e..0000000000 --- a/test/sys/module/nvram/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ae280 diff --git a/test/sys/module/nvram/sections/.init.text b/test/sys/module/nvram/sections/.init.text deleted file mode 100644 index 6e4960413f..0000000000 --- a/test/sys/module/nvram/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00b0000 diff --git a/test/sys/module/nvram/sections/.note.gnu.build-id b/test/sys/module/nvram/sections/.note.gnu.build-id deleted file mode 100644 index 8a1fffd05f..0000000000 --- a/test/sys/module/nvram/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ace5c diff --git a/test/sys/module/nvram/sections/.rodata b/test/sys/module/nvram/sections/.rodata deleted file mode 100644 index 51a91fa9ab..0000000000 --- a/test/sys/module/nvram/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ace80 diff --git a/test/sys/module/nvram/sections/.rodata.str1.1 b/test/sys/module/nvram/sections/.rodata.str1.1 deleted file mode 100644 index da32213582..0000000000 --- a/test/sys/module/nvram/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00acfb8 diff --git a/test/sys/module/nvram/sections/.strtab b/test/sys/module/nvram/sections/.strtab deleted file mode 100644 index 64ae3eb667..0000000000 --- a/test/sys/module/nvram/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00adc38 diff --git a/test/sys/module/nvram/sections/.symtab b/test/sys/module/nvram/sections/.symtab deleted file mode 100644 index 48a1ebf55a..0000000000 --- a/test/sys/module/nvram/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ad338 diff --git a/test/sys/module/nvram/sections/.text b/test/sys/module/nvram/sections/.text deleted file mode 100644 index d356ab8437..0000000000 --- a/test/sys/module/nvram/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ac000 diff --git a/test/sys/module/nvram/sections/__kcrctab b/test/sys/module/nvram/sections/__kcrctab deleted file mode 100644 index 39f7161a73..0000000000 --- a/test/sys/module/nvram/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ad290 diff --git a/test/sys/module/nvram/sections/__ksymtab b/test/sys/module/nvram/sections/__ksymtab deleted file mode 100644 index fdb80739cc..0000000000 --- a/test/sys/module/nvram/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ad230 diff --git a/test/sys/module/nvram/sections/__ksymtab_strings b/test/sys/module/nvram/sections/__ksymtab_strings deleted file mode 100644 index ad984e1a4d..0000000000 --- a/test/sys/module/nvram/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ad2c0 diff --git a/test/sys/module/nvram/srcversion b/test/sys/module/nvram/srcversion deleted file mode 100644 index 46292a3e31..0000000000 --- a/test/sys/module/nvram/srcversion +++ /dev/null @@ -1 +0,0 @@ -ECD12B2949BC771BDCE8146 diff --git a/test/sys/module/oprofile/parameters/timer b/test/sys/module/oprofile/parameters/timer deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/oprofile/parameters/timer +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/pcie_aspm/parameters/policy b/test/sys/module/pcie_aspm/parameters/policy deleted file mode 100644 index f626408897..0000000000 --- a/test/sys/module/pcie_aspm/parameters/policy +++ /dev/null @@ -1 +0,0 @@ -[default] performance powersave diff --git a/test/sys/module/pcmcia/initstate b/test/sys/module/pcmcia/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/pcmcia/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/pcmcia/notes/.note.gnu.build-id b/test/sys/module/pcmcia/notes/.note.gnu.build-id deleted file mode 100644 index e8a8e0e356..0000000000 Binary files a/test/sys/module/pcmcia/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/pcmcia/parameters/io_speed b/test/sys/module/pcmcia/parameters/io_speed deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/pcmcia/parameters/io_speed +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/pcmcia/refcnt b/test/sys/module/pcmcia/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/pcmcia/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/pcmcia/sections/.bss b/test/sys/module/pcmcia/sections/.bss deleted file mode 100644 index 4547187361..0000000000 --- a/test/sys/module/pcmcia/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01fcb40 diff --git a/test/sys/module/pcmcia/sections/.data b/test/sys/module/pcmcia/sections/.data deleted file mode 100644 index 2dc318f6a4..0000000000 --- a/test/sys/module/pcmcia/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01fc3a0 diff --git a/test/sys/module/pcmcia/sections/.devinit.text b/test/sys/module/pcmcia/sections/.devinit.text deleted file mode 100644 index 6272f20204..0000000000 --- a/test/sys/module/pcmcia/sections/.devinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f85e2 diff --git a/test/sys/module/pcmcia/sections/.exit.text b/test/sys/module/pcmcia/sections/.exit.text deleted file mode 100644 index c6055137c2..0000000000 --- a/test/sys/module/pcmcia/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f85c4 diff --git a/test/sys/module/pcmcia/sections/.gnu.linkonce.this_module b/test/sys/module/pcmcia/sections/.gnu.linkonce.this_module deleted file mode 100644 index aa83886b06..0000000000 --- a/test/sys/module/pcmcia/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01fc780 diff --git a/test/sys/module/pcmcia/sections/.init.text b/test/sys/module/pcmcia/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/pcmcia/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/pcmcia/sections/.note.gnu.build-id b/test/sys/module/pcmcia/sections/.note.gnu.build-id deleted file mode 100644 index f7f1d1dd53..0000000000 --- a/test/sys/module/pcmcia/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f86c8 diff --git a/test/sys/module/pcmcia/sections/.ref.data b/test/sys/module/pcmcia/sections/.ref.data deleted file mode 100644 index a87b465de6..0000000000 --- a/test/sys/module/pcmcia/sections/.ref.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01fc720 diff --git a/test/sys/module/pcmcia/sections/.rodata b/test/sys/module/pcmcia/sections/.rodata deleted file mode 100644 index 9800ef9aae..0000000000 --- a/test/sys/module/pcmcia/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f8700 diff --git a/test/sys/module/pcmcia/sections/.rodata.str1.1 b/test/sys/module/pcmcia/sections/.rodata.str1.1 deleted file mode 100644 index 201775af39..0000000000 --- a/test/sys/module/pcmcia/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f913d diff --git a/test/sys/module/pcmcia/sections/.strtab b/test/sys/module/pcmcia/sections/.strtab deleted file mode 100644 index 89990d740c..0000000000 --- a/test/sys/module/pcmcia/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01fb138 diff --git a/test/sys/module/pcmcia/sections/.symtab b/test/sys/module/pcmcia/sections/.symtab deleted file mode 100644 index 35c9ff8333..0000000000 --- a/test/sys/module/pcmcia/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f9a28 diff --git a/test/sys/module/pcmcia/sections/.text b/test/sys/module/pcmcia/sections/.text deleted file mode 100644 index b8eb722db9..0000000000 --- a/test/sys/module/pcmcia/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f5000 diff --git a/test/sys/module/pcmcia/sections/__kcrctab b/test/sys/module/pcmcia/sections/__kcrctab deleted file mode 100644 index 7fe3b12fb6..0000000000 --- a/test/sys/module/pcmcia/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f9810 diff --git a/test/sys/module/pcmcia/sections/__ksymtab b/test/sys/module/pcmcia/sections/__ksymtab deleted file mode 100644 index c838f4d731..0000000000 --- a/test/sys/module/pcmcia/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f9710 diff --git a/test/sys/module/pcmcia/sections/__ksymtab_strings b/test/sys/module/pcmcia/sections/__ksymtab_strings deleted file mode 100644 index ed7fea338e..0000000000 --- a/test/sys/module/pcmcia/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f9890 diff --git a/test/sys/module/pcmcia/sections/__param b/test/sys/module/pcmcia/sections/__param deleted file mode 100644 index a291b4999b..0000000000 --- a/test/sys/module/pcmcia/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f9a00 diff --git a/test/sys/module/pcmcia/srcversion b/test/sys/module/pcmcia/srcversion deleted file mode 100644 index 552f692585..0000000000 --- a/test/sys/module/pcmcia/srcversion +++ /dev/null @@ -1 +0,0 @@ -6544CB07B8D7D79F19A4CD6 diff --git a/test/sys/module/pcmcia_core/holders/pcmcia b/test/sys/module/pcmcia_core/holders/pcmcia deleted file mode 120000 index 171c77dafd..0000000000 --- a/test/sys/module/pcmcia_core/holders/pcmcia +++ /dev/null @@ -1 +0,0 @@ -../../pcmcia \ No newline at end of file diff --git a/test/sys/module/pcmcia_core/holders/rsrc_nonstatic b/test/sys/module/pcmcia_core/holders/rsrc_nonstatic deleted file mode 120000 index 1e8aff1d30..0000000000 --- a/test/sys/module/pcmcia_core/holders/rsrc_nonstatic +++ /dev/null @@ -1 +0,0 @@ -../../rsrc_nonstatic \ No newline at end of file diff --git a/test/sys/module/pcmcia_core/holders/yenta_socket b/test/sys/module/pcmcia_core/holders/yenta_socket deleted file mode 120000 index eb0b77d0b3..0000000000 --- a/test/sys/module/pcmcia_core/holders/yenta_socket +++ /dev/null @@ -1 +0,0 @@ -../../yenta_socket \ No newline at end of file diff --git a/test/sys/module/pcmcia_core/initstate b/test/sys/module/pcmcia_core/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/pcmcia_core/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/pcmcia_core/notes/.note.gnu.build-id b/test/sys/module/pcmcia_core/notes/.note.gnu.build-id deleted file mode 100644 index 6ec9ef0c9f..0000000000 Binary files a/test/sys/module/pcmcia_core/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/pcmcia_core/parameters/cis_speed b/test/sys/module/pcmcia_core/parameters/cis_speed deleted file mode 100644 index 697cb3a26d..0000000000 --- a/test/sys/module/pcmcia_core/parameters/cis_speed +++ /dev/null @@ -1 +0,0 @@ -300 diff --git a/test/sys/module/pcmcia_core/parameters/cis_width b/test/sys/module/pcmcia_core/parameters/cis_width deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/pcmcia_core/parameters/cis_width +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/pcmcia_core/parameters/reset_time b/test/sys/module/pcmcia_core/parameters/reset_time deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/module/pcmcia_core/parameters/reset_time +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/module/pcmcia_core/parameters/resume_delay b/test/sys/module/pcmcia_core/parameters/resume_delay deleted file mode 100644 index 209e3ef4b6..0000000000 --- a/test/sys/module/pcmcia_core/parameters/resume_delay +++ /dev/null @@ -1 +0,0 @@ -20 diff --git a/test/sys/module/pcmcia_core/parameters/setup_delay b/test/sys/module/pcmcia_core/parameters/setup_delay deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/module/pcmcia_core/parameters/setup_delay +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/module/pcmcia_core/parameters/shutdown_delay b/test/sys/module/pcmcia_core/parameters/shutdown_delay deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/module/pcmcia_core/parameters/shutdown_delay +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/module/pcmcia_core/parameters/unreset_check b/test/sys/module/pcmcia_core/parameters/unreset_check deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/module/pcmcia_core/parameters/unreset_check +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/module/pcmcia_core/parameters/unreset_delay b/test/sys/module/pcmcia_core/parameters/unreset_delay deleted file mode 100644 index f599e28b8a..0000000000 --- a/test/sys/module/pcmcia_core/parameters/unreset_delay +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/test/sys/module/pcmcia_core/parameters/unreset_limit b/test/sys/module/pcmcia_core/parameters/unreset_limit deleted file mode 100644 index 64bb6b746d..0000000000 --- a/test/sys/module/pcmcia_core/parameters/unreset_limit +++ /dev/null @@ -1 +0,0 @@ -30 diff --git a/test/sys/module/pcmcia_core/parameters/vcc_settle b/test/sys/module/pcmcia_core/parameters/vcc_settle deleted file mode 100644 index 425151f3a4..0000000000 --- a/test/sys/module/pcmcia_core/parameters/vcc_settle +++ /dev/null @@ -1 +0,0 @@ -40 diff --git a/test/sys/module/pcmcia_core/refcnt b/test/sys/module/pcmcia_core/refcnt deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/module/pcmcia_core/refcnt +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/module/pcmcia_core/sections/.bss b/test/sys/module/pcmcia_core/sections/.bss deleted file mode 100644 index 53e920a0a3..0000000000 --- a/test/sys/module/pcmcia_core/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0098f40 diff --git a/test/sys/module/pcmcia_core/sections/.data b/test/sys/module/pcmcia_core/sections/.data deleted file mode 100644 index 78d13e4bb8..0000000000 --- a/test/sys/module/pcmcia_core/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0098700 diff --git a/test/sys/module/pcmcia_core/sections/.exit.text b/test/sys/module/pcmcia_core/sections/.exit.text deleted file mode 100644 index a09c6db0b2..0000000000 --- a/test/sys/module/pcmcia_core/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0093558 diff --git a/test/sys/module/pcmcia_core/sections/.gnu.linkonce.this_module b/test/sys/module/pcmcia_core/sections/.gnu.linkonce.this_module deleted file mode 100644 index f95a01b342..0000000000 --- a/test/sys/module/pcmcia_core/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0098b80 diff --git a/test/sys/module/pcmcia_core/sections/.init.text b/test/sys/module/pcmcia_core/sections/.init.text deleted file mode 100644 index 0dbbf92722..0000000000 --- a/test/sys/module/pcmcia_core/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009a000 diff --git a/test/sys/module/pcmcia_core/sections/.note.gnu.build-id b/test/sys/module/pcmcia_core/sections/.note.gnu.build-id deleted file mode 100644 index f3e1dc2611..0000000000 --- a/test/sys/module/pcmcia_core/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0093668 diff --git a/test/sys/module/pcmcia_core/sections/.ref.text b/test/sys/module/pcmcia_core/sections/.ref.text deleted file mode 100644 index 5f2996a214..0000000000 --- a/test/sys/module/pcmcia_core/sections/.ref.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0093580 diff --git a/test/sys/module/pcmcia_core/sections/.rodata b/test/sys/module/pcmcia_core/sections/.rodata deleted file mode 100644 index 09e2f8e58d..0000000000 --- a/test/sys/module/pcmcia_core/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00936a0 diff --git a/test/sys/module/pcmcia_core/sections/.rodata.str1.1 b/test/sys/module/pcmcia_core/sections/.rodata.str1.1 deleted file mode 100644 index f13ce1ee29..0000000000 --- a/test/sys/module/pcmcia_core/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0093a88 diff --git a/test/sys/module/pcmcia_core/sections/.strtab b/test/sys/module/pcmcia_core/sections/.strtab deleted file mode 100644 index 2a7dc91449..0000000000 --- a/test/sys/module/pcmcia_core/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0096898 diff --git a/test/sys/module/pcmcia_core/sections/.symtab b/test/sys/module/pcmcia_core/sections/.symtab deleted file mode 100644 index 7dfe446732..0000000000 --- a/test/sys/module/pcmcia_core/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00945d0 diff --git a/test/sys/module/pcmcia_core/sections/.text b/test/sys/module/pcmcia_core/sections/.text deleted file mode 100644 index 069d70cd89..0000000000 --- a/test/sys/module/pcmcia_core/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa008f000 diff --git a/test/sys/module/pcmcia_core/sections/__kcrctab b/test/sys/module/pcmcia_core/sections/__kcrctab deleted file mode 100644 index 38262af623..0000000000 --- a/test/sys/module/pcmcia_core/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0094070 diff --git a/test/sys/module/pcmcia_core/sections/__ksymtab b/test/sys/module/pcmcia_core/sections/__ksymtab deleted file mode 100644 index 9c7381574e..0000000000 --- a/test/sys/module/pcmcia_core/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0093e50 diff --git a/test/sys/module/pcmcia_core/sections/__ksymtab_strings b/test/sys/module/pcmcia_core/sections/__ksymtab_strings deleted file mode 100644 index 4b1033162b..0000000000 --- a/test/sys/module/pcmcia_core/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0094310 diff --git a/test/sys/module/pcmcia_core/sections/__param b/test/sys/module/pcmcia_core/sections/__param deleted file mode 100644 index 5fa904cb38..0000000000 --- a/test/sys/module/pcmcia_core/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0094180 diff --git a/test/sys/module/pcmcia_core/srcversion b/test/sys/module/pcmcia_core/srcversion deleted file mode 100644 index fa1b58a28e..0000000000 --- a/test/sys/module/pcmcia_core/srcversion +++ /dev/null @@ -1 +0,0 @@ -7C1220572DE8897E4D560EB diff --git a/test/sys/module/pcspkr/drivers/platform:pcspkr b/test/sys/module/pcspkr/drivers/platform:pcspkr deleted file mode 120000 index 44af544108..0000000000 --- a/test/sys/module/pcspkr/drivers/platform:pcspkr +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform/drivers/pcspkr \ No newline at end of file diff --git a/test/sys/module/pcspkr/initstate b/test/sys/module/pcspkr/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/pcspkr/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/pcspkr/notes/.note.gnu.build-id b/test/sys/module/pcspkr/notes/.note.gnu.build-id deleted file mode 100644 index 941a2af177..0000000000 Binary files a/test/sys/module/pcspkr/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/pcspkr/refcnt b/test/sys/module/pcspkr/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/pcspkr/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/pcspkr/sections/.bss b/test/sys/module/pcspkr/sections/.bss deleted file mode 100644 index 302aa91225..0000000000 --- a/test/sys/module/pcspkr/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009ed80 diff --git a/test/sys/module/pcspkr/sections/.data b/test/sys/module/pcspkr/sections/.data deleted file mode 100644 index 70d87fbcf7..0000000000 --- a/test/sys/module/pcspkr/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e900 diff --git a/test/sys/module/pcspkr/sections/.devexit.text b/test/sys/module/pcspkr/sections/.devexit.text deleted file mode 100644 index 5577444aae..0000000000 --- a/test/sys/module/pcspkr/sections/.devexit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e16e diff --git a/test/sys/module/pcspkr/sections/.devinit.text b/test/sys/module/pcspkr/sections/.devinit.text deleted file mode 100644 index c8ab2af217..0000000000 --- a/test/sys/module/pcspkr/sections/.devinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e1ad diff --git a/test/sys/module/pcspkr/sections/.exit.text b/test/sys/module/pcspkr/sections/.exit.text deleted file mode 100644 index 175dd5c9ae..0000000000 --- a/test/sys/module/pcspkr/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e15c diff --git a/test/sys/module/pcspkr/sections/.gnu.linkonce.this_module b/test/sys/module/pcspkr/sections/.gnu.linkonce.this_module deleted file mode 100644 index b565dd3785..0000000000 --- a/test/sys/module/pcspkr/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e9c0 diff --git a/test/sys/module/pcspkr/sections/.init.text b/test/sys/module/pcspkr/sections/.init.text deleted file mode 100644 index cb816d17ae..0000000000 --- a/test/sys/module/pcspkr/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a0000 diff --git a/test/sys/module/pcspkr/sections/.note.gnu.build-id b/test/sys/module/pcspkr/sections/.note.gnu.build-id deleted file mode 100644 index 9e47b4a6e0..0000000000 --- a/test/sys/module/pcspkr/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e250 diff --git a/test/sys/module/pcspkr/sections/.rodata.str1.1 b/test/sys/module/pcspkr/sections/.rodata.str1.1 deleted file mode 100644 index ddd8cf2f70..0000000000 --- a/test/sys/module/pcspkr/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e274 diff --git a/test/sys/module/pcspkr/sections/.strtab b/test/sys/module/pcspkr/sections/.strtab deleted file mode 100644 index 48fc2dc2d0..0000000000 --- a/test/sys/module/pcspkr/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e6e8 diff --git a/test/sys/module/pcspkr/sections/.symtab b/test/sys/module/pcspkr/sections/.symtab deleted file mode 100644 index 0339c92d4b..0000000000 --- a/test/sys/module/pcspkr/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e298 diff --git a/test/sys/module/pcspkr/sections/.text b/test/sys/module/pcspkr/sections/.text deleted file mode 100644 index 0ed9948ecb..0000000000 --- a/test/sys/module/pcspkr/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009e000 diff --git a/test/sys/module/pcspkr/srcversion b/test/sys/module/pcspkr/srcversion deleted file mode 100644 index b2378e7e95..0000000000 --- a/test/sys/module/pcspkr/srcversion +++ /dev/null @@ -1 +0,0 @@ -5757E9C81E627525BA9D165 diff --git a/test/sys/module/printk/parameters/time b/test/sys/module/printk/parameters/time deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/printk/parameters/time +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/processor/holders/acpi_cpufreq b/test/sys/module/processor/holders/acpi_cpufreq deleted file mode 120000 index 31c49118f6..0000000000 --- a/test/sys/module/processor/holders/acpi_cpufreq +++ /dev/null @@ -1 +0,0 @@ -../../acpi_cpufreq \ No newline at end of file diff --git a/test/sys/module/processor/holders/thermal b/test/sys/module/processor/holders/thermal deleted file mode 120000 index b8b0080f39..0000000000 --- a/test/sys/module/processor/holders/thermal +++ /dev/null @@ -1 +0,0 @@ -../../thermal \ No newline at end of file diff --git a/test/sys/module/processor/initstate b/test/sys/module/processor/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/processor/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/processor/notes/.note.gnu.build-id b/test/sys/module/processor/notes/.note.gnu.build-id deleted file mode 100644 index 0a62e14198..0000000000 Binary files a/test/sys/module/processor/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/processor/parameters/ignore_ppc b/test/sys/module/processor/parameters/ignore_ppc deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/processor/parameters/ignore_ppc +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/processor/parameters/latency_factor b/test/sys/module/processor/parameters/latency_factor deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/processor/parameters/latency_factor +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/processor/refcnt b/test/sys/module/processor/refcnt deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/module/processor/refcnt +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/module/processor/sections/.bss b/test/sys/module/processor/sections/.bss deleted file mode 100644 index 05a7c56259..0000000000 --- a/test/sys/module/processor/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007bbc0 diff --git a/test/sys/module/processor/sections/.cpuinit.data b/test/sys/module/processor/sections/.cpuinit.data deleted file mode 100644 index ec3180d09f..0000000000 --- a/test/sys/module/processor/sections/.cpuinit.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007b040 diff --git a/test/sys/module/processor/sections/.cpuinit.text b/test/sys/module/processor/sections/.cpuinit.text deleted file mode 100644 index 699392a0bc..0000000000 --- a/test/sys/module/processor/sections/.cpuinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0075abc diff --git a/test/sys/module/processor/sections/.data b/test/sys/module/processor/sections/.data deleted file mode 100644 index 100996acbc..0000000000 --- a/test/sys/module/processor/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007ab90 diff --git a/test/sys/module/processor/sections/.data.read_mostly b/test/sys/module/processor/sections/.data.read_mostly deleted file mode 100644 index c8156db601..0000000000 --- a/test/sys/module/processor/sections/.data.read_mostly +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007b7d8 diff --git a/test/sys/module/processor/sections/.exit.text b/test/sys/module/processor/sections/.exit.text deleted file mode 100644 index 330855e381..0000000000 --- a/test/sys/module/processor/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00763a9 diff --git a/test/sys/module/processor/sections/.fixup b/test/sys/module/processor/sections/.fixup deleted file mode 100644 index a6ab6fca10..0000000000 --- a/test/sys/module/processor/sections/.fixup +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00765ad diff --git a/test/sys/module/processor/sections/.gnu.linkonce.this_module b/test/sys/module/processor/sections/.gnu.linkonce.this_module deleted file mode 100644 index c57b65e96b..0000000000 --- a/test/sys/module/processor/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007b800 diff --git a/test/sys/module/processor/sections/.init.text b/test/sys/module/processor/sections/.init.text deleted file mode 100644 index 3e03f3c0fc..0000000000 --- a/test/sys/module/processor/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d000 diff --git a/test/sys/module/processor/sections/.note.gnu.build-id b/test/sys/module/processor/sections/.note.gnu.build-id deleted file mode 100644 index 1b53386181..0000000000 --- a/test/sys/module/processor/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00765c4 diff --git a/test/sys/module/processor/sections/.ref.text b/test/sys/module/processor/sections/.ref.text deleted file mode 100644 index 3d7adb191e..0000000000 --- a/test/sys/module/processor/sections/.ref.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007641a diff --git a/test/sys/module/processor/sections/.rodata b/test/sys/module/processor/sections/.rodata deleted file mode 100644 index 64930d5917..0000000000 --- a/test/sys/module/processor/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00765f0 diff --git a/test/sys/module/processor/sections/.rodata.str1.1 b/test/sys/module/processor/sections/.rodata.str1.1 deleted file mode 100644 index 2c62281acb..0000000000 --- a/test/sys/module/processor/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0076863 diff --git a/test/sys/module/processor/sections/.smp_locks b/test/sys/module/processor/sections/.smp_locks deleted file mode 100644 index 7c54d3de3b..0000000000 --- a/test/sys/module/processor/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0077788 diff --git a/test/sys/module/processor/sections/.strtab b/test/sys/module/processor/sections/.strtab deleted file mode 100644 index 86061293e3..0000000000 --- a/test/sys/module/processor/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0079438 diff --git a/test/sys/module/processor/sections/.symtab b/test/sys/module/processor/sections/.symtab deleted file mode 100644 index c5ab05949e..0000000000 --- a/test/sys/module/processor/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0077890 diff --git a/test/sys/module/processor/sections/.text b/test/sys/module/processor/sections/.text deleted file mode 100644 index a5187ffb5b..0000000000 --- a/test/sys/module/processor/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0072000 diff --git a/test/sys/module/processor/sections/__bug_table b/test/sys/module/processor/sections/__bug_table deleted file mode 100644 index e4a9b70ca7..0000000000 --- a/test/sys/module/processor/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0077621 diff --git a/test/sys/module/processor/sections/__ex_table b/test/sys/module/processor/sections/__ex_table deleted file mode 100644 index 4bab5f0726..0000000000 --- a/test/sys/module/processor/sections/__ex_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0077768 diff --git a/test/sys/module/processor/sections/__kcrctab b/test/sys/module/processor/sections/__kcrctab deleted file mode 100644 index f7d4abd806..0000000000 --- a/test/sys/module/processor/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0077690 diff --git a/test/sys/module/processor/sections/__ksymtab b/test/sys/module/processor/sections/__ksymtab deleted file mode 100644 index 59d3788052..0000000000 --- a/test/sys/module/processor/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0077640 diff --git a/test/sys/module/processor/sections/__ksymtab_strings b/test/sys/module/processor/sections/__ksymtab_strings deleted file mode 100644 index c185088c08..0000000000 --- a/test/sys/module/processor/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00776b8 diff --git a/test/sys/module/processor/sections/__param b/test/sys/module/processor/sections/__param deleted file mode 100644 index d3a1e4e501..0000000000 --- a/test/sys/module/processor/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00777f0 diff --git a/test/sys/module/processor/srcversion b/test/sys/module/processor/srcversion deleted file mode 100644 index d84fc1aa69..0000000000 --- a/test/sys/module/processor/srcversion +++ /dev/null @@ -1 +0,0 @@ -8A1C302AFF80867DBAC4684 diff --git a/test/sys/module/psmouse/drivers/serio:psmouse b/test/sys/module/psmouse/drivers/serio:psmouse deleted file mode 120000 index 385b8ae0f5..0000000000 --- a/test/sys/module/psmouse/drivers/serio:psmouse +++ /dev/null @@ -1 +0,0 @@ -../../../bus/serio/drivers/psmouse \ No newline at end of file diff --git a/test/sys/module/psmouse/parameters/proto b/test/sys/module/psmouse/parameters/proto deleted file mode 100644 index 588192d1e0..0000000000 --- a/test/sys/module/psmouse/parameters/proto +++ /dev/null @@ -1,2 +0,0 @@ -auto - diff --git a/test/sys/module/psmouse/parameters/rate b/test/sys/module/psmouse/parameters/rate deleted file mode 100644 index 29d6383b52..0000000000 --- a/test/sys/module/psmouse/parameters/rate +++ /dev/null @@ -1 +0,0 @@ -100 diff --git a/test/sys/module/psmouse/parameters/resetafter b/test/sys/module/psmouse/parameters/resetafter deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/module/psmouse/parameters/resetafter +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/module/psmouse/parameters/resolution b/test/sys/module/psmouse/parameters/resolution deleted file mode 100644 index 08839f6bb2..0000000000 --- a/test/sys/module/psmouse/parameters/resolution +++ /dev/null @@ -1 +0,0 @@ -200 diff --git a/test/sys/module/psmouse/parameters/resync_time b/test/sys/module/psmouse/parameters/resync_time deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/psmouse/parameters/resync_time +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/psmouse/parameters/smartscroll b/test/sys/module/psmouse/parameters/smartscroll deleted file mode 100644 index 9bda8c35c2..0000000000 --- a/test/sys/module/psmouse/parameters/smartscroll +++ /dev/null @@ -1 +0,0 @@ -Y diff --git a/test/sys/module/raid1/initstate b/test/sys/module/raid1/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/raid1/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/raid1/notes/.note.gnu.build-id b/test/sys/module/raid1/notes/.note.gnu.build-id deleted file mode 100644 index 63c3265b0b..0000000000 Binary files a/test/sys/module/raid1/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/raid1/refcnt b/test/sys/module/raid1/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/raid1/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/raid1/sections/.bss b/test/sys/module/raid1/sections/.bss deleted file mode 100644 index f63821e1ef..0000000000 --- a/test/sys/module/raid1/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0238280 diff --git a/test/sys/module/raid1/sections/.data b/test/sys/module/raid1/sections/.data deleted file mode 100644 index a56ebcc5da..0000000000 --- a/test/sys/module/raid1/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0237e20 diff --git a/test/sys/module/raid1/sections/.gnu.linkonce.this_module b/test/sys/module/raid1/sections/.gnu.linkonce.this_module deleted file mode 100644 index e58dfa707b..0000000000 --- a/test/sys/module/raid1/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0237ec0 diff --git a/test/sys/module/raid1/sections/.init.text b/test/sys/module/raid1/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/raid1/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/raid1/sections/.note.gnu.build-id b/test/sys/module/raid1/sections/.note.gnu.build-id deleted file mode 100644 index e0ee1019e2..0000000000 --- a/test/sys/module/raid1/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0236414 diff --git a/test/sys/module/raid1/sections/.rodata.str1.1 b/test/sys/module/raid1/sections/.rodata.str1.1 deleted file mode 100644 index ea2a278ffa..0000000000 --- a/test/sys/module/raid1/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0236618 diff --git a/test/sys/module/raid1/sections/.smp_locks b/test/sys/module/raid1/sections/.smp_locks deleted file mode 100644 index 17f191f28f..0000000000 --- a/test/sys/module/raid1/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0236438 diff --git a/test/sys/module/raid1/sections/.strtab b/test/sys/module/raid1/sections/.strtab deleted file mode 100644 index 7ca1f678ba..0000000000 --- a/test/sys/module/raid1/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02376f8 diff --git a/test/sys/module/raid1/sections/.symtab b/test/sys/module/raid1/sections/.symtab deleted file mode 100644 index 31b99d4729..0000000000 --- a/test/sys/module/raid1/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0236a08 diff --git a/test/sys/module/raid1/sections/.text b/test/sys/module/raid1/sections/.text deleted file mode 100644 index 738aafb70b..0000000000 --- a/test/sys/module/raid1/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0232000 diff --git a/test/sys/module/raid1/sections/__bug_table b/test/sys/module/raid1/sections/__bug_table deleted file mode 100644 index e4b01a0bdb..0000000000 --- a/test/sys/module/raid1/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02369c0 diff --git a/test/sys/module/raid1/srcversion b/test/sys/module/raid1/srcversion deleted file mode 100644 index 529578f207..0000000000 --- a/test/sys/module/raid1/srcversion +++ /dev/null @@ -1 +0,0 @@ -EA08FDD37C2EEFA95DE4413 diff --git a/test/sys/module/rfkill/holders/thinkpad_acpi b/test/sys/module/rfkill/holders/thinkpad_acpi deleted file mode 120000 index 8d266ed087..0000000000 --- a/test/sys/module/rfkill/holders/thinkpad_acpi +++ /dev/null @@ -1 +0,0 @@ -../../thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/rfkill/initstate b/test/sys/module/rfkill/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/rfkill/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/rfkill/notes/.note.gnu.build-id b/test/sys/module/rfkill/notes/.note.gnu.build-id deleted file mode 100644 index 91e71bd9c6..0000000000 Binary files a/test/sys/module/rfkill/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/rfkill/parameters/default_state b/test/sys/module/rfkill/parameters/default_state deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/rfkill/parameters/default_state +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/rfkill/refcnt b/test/sys/module/rfkill/refcnt deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/rfkill/refcnt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/rfkill/sections/.bss b/test/sys/module/rfkill/sections/.bss deleted file mode 100644 index 647475aade..0000000000 --- a/test/sys/module/rfkill/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01dbe00 diff --git a/test/sys/module/rfkill/sections/.data b/test/sys/module/rfkill/sections/.data deleted file mode 100644 index a158c33fc2..0000000000 --- a/test/sys/module/rfkill/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01db780 diff --git a/test/sys/module/rfkill/sections/.exit.text b/test/sys/module/rfkill/sections/.exit.text deleted file mode 100644 index ab6800ef4f..0000000000 --- a/test/sys/module/rfkill/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9c88 diff --git a/test/sys/module/rfkill/sections/.gnu.linkonce.this_module b/test/sys/module/rfkill/sections/.gnu.linkonce.this_module deleted file mode 100644 index 174e6eb10a..0000000000 --- a/test/sys/module/rfkill/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01dba40 diff --git a/test/sys/module/rfkill/sections/.init.text b/test/sys/module/rfkill/sections/.init.text deleted file mode 100644 index 0dbbf92722..0000000000 --- a/test/sys/module/rfkill/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009a000 diff --git a/test/sys/module/rfkill/sections/.note.gnu.build-id b/test/sys/module/rfkill/sections/.note.gnu.build-id deleted file mode 100644 index 72651ddb7c..0000000000 --- a/test/sys/module/rfkill/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9cb0 diff --git a/test/sys/module/rfkill/sections/.rodata b/test/sys/module/rfkill/sections/.rodata deleted file mode 100644 index 8dbcbba724..0000000000 --- a/test/sys/module/rfkill/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9cd8 diff --git a/test/sys/module/rfkill/sections/.rodata.str1.1 b/test/sys/module/rfkill/sections/.rodata.str1.1 deleted file mode 100644 index e5b2b05429..0000000000 --- a/test/sys/module/rfkill/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9d36 diff --git a/test/sys/module/rfkill/sections/.smp_locks b/test/sys/module/rfkill/sections/.smp_locks deleted file mode 100644 index 9e92f5e8db..0000000000 --- a/test/sys/module/rfkill/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9e80 diff --git a/test/sys/module/rfkill/sections/.strtab b/test/sys/module/rfkill/sections/.strtab deleted file mode 100644 index c999f4f402..0000000000 --- a/test/sys/module/rfkill/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01dae08 diff --git a/test/sys/module/rfkill/sections/.symtab b/test/sys/module/rfkill/sections/.symtab deleted file mode 100644 index 1df0e25a5e..0000000000 --- a/test/sys/module/rfkill/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01da088 diff --git a/test/sys/module/rfkill/sections/.text b/test/sys/module/rfkill/sections/.text deleted file mode 100644 index e2c99a7fe2..0000000000 --- a/test/sys/module/rfkill/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9000 diff --git a/test/sys/module/rfkill/sections/__bug_table b/test/sys/module/rfkill/sections/__bug_table deleted file mode 100644 index 93eb4e41ee..0000000000 --- a/test/sys/module/rfkill/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9e36 diff --git a/test/sys/module/rfkill/sections/__kcrctab b/test/sys/module/rfkill/sections/__kcrctab deleted file mode 100644 index badd707fb8..0000000000 --- a/test/sys/module/rfkill/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9f40 diff --git a/test/sys/module/rfkill/sections/__kcrctab_gpl b/test/sys/module/rfkill/sections/__kcrctab_gpl deleted file mode 100644 index ef846baf13..0000000000 --- a/test/sys/module/rfkill/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9fa0 diff --git a/test/sys/module/rfkill/sections/__ksymtab b/test/sys/module/rfkill/sections/__ksymtab deleted file mode 100644 index 04d68f1c0e..0000000000 --- a/test/sys/module/rfkill/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9ee0 diff --git a/test/sys/module/rfkill/sections/__ksymtab_gpl b/test/sys/module/rfkill/sections/__ksymtab_gpl deleted file mode 100644 index 747ebe2815..0000000000 --- a/test/sys/module/rfkill/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9f70 diff --git a/test/sys/module/rfkill/sections/__ksymtab_strings b/test/sys/module/rfkill/sections/__ksymtab_strings deleted file mode 100644 index 4d694ea516..0000000000 --- a/test/sys/module/rfkill/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9fe0 diff --git a/test/sys/module/rfkill/sections/__param b/test/sys/module/rfkill/sections/__param deleted file mode 100644 index 5013dc401f..0000000000 --- a/test/sys/module/rfkill/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d9fb8 diff --git a/test/sys/module/rfkill/srcversion b/test/sys/module/rfkill/srcversion deleted file mode 100644 index 342c0f0ee8..0000000000 --- a/test/sys/module/rfkill/srcversion +++ /dev/null @@ -1 +0,0 @@ -6B4E68548C57FD365EB4E71 diff --git a/test/sys/module/rfkill/version b/test/sys/module/rfkill/version deleted file mode 100644 index d3827e75a5..0000000000 --- a/test/sys/module/rfkill/version +++ /dev/null @@ -1 +0,0 @@ -1.0 diff --git a/test/sys/module/rsrc_nonstatic/holders/yenta_socket b/test/sys/module/rsrc_nonstatic/holders/yenta_socket deleted file mode 120000 index eb0b77d0b3..0000000000 --- a/test/sys/module/rsrc_nonstatic/holders/yenta_socket +++ /dev/null @@ -1 +0,0 @@ -../../yenta_socket \ No newline at end of file diff --git a/test/sys/module/rsrc_nonstatic/initstate b/test/sys/module/rsrc_nonstatic/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/rsrc_nonstatic/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/rsrc_nonstatic/notes/.note.gnu.build-id b/test/sys/module/rsrc_nonstatic/notes/.note.gnu.build-id deleted file mode 100644 index 167d69a7bf..0000000000 Binary files a/test/sys/module/rsrc_nonstatic/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/rsrc_nonstatic/parameters/probe_mem b/test/sys/module/rsrc_nonstatic/parameters/probe_mem deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/rsrc_nonstatic/parameters/probe_mem +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/rsrc_nonstatic/refcnt b/test/sys/module/rsrc_nonstatic/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/rsrc_nonstatic/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/rsrc_nonstatic/sections/.bss b/test/sys/module/rsrc_nonstatic/sections/.bss deleted file mode 100644 index a1b0cddb67..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f0dc0 diff --git a/test/sys/module/rsrc_nonstatic/sections/.data b/test/sys/module/rsrc_nonstatic/sections/.data deleted file mode 100644 index aeedb038cc..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f0820 diff --git a/test/sys/module/rsrc_nonstatic/sections/.devexit.text b/test/sys/module/rsrc_nonstatic/sections/.devexit.text deleted file mode 100644 index 192fd76b0a..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.devexit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef636 diff --git a/test/sys/module/rsrc_nonstatic/sections/.devinit.text b/test/sys/module/rsrc_nonstatic/sections/.devinit.text deleted file mode 100644 index 329e7122a5..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.devinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef665 diff --git a/test/sys/module/rsrc_nonstatic/sections/.exit.text b/test/sys/module/rsrc_nonstatic/sections/.exit.text deleted file mode 100644 index a8a6e04a7e..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef624 diff --git a/test/sys/module/rsrc_nonstatic/sections/.gnu.linkonce.this_module b/test/sys/module/rsrc_nonstatic/sections/.gnu.linkonce.this_module deleted file mode 100644 index f2c70516bd..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f0a00 diff --git a/test/sys/module/rsrc_nonstatic/sections/.init.text b/test/sys/module/rsrc_nonstatic/sections/.init.text deleted file mode 100644 index 9da5e610a8..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0084000 diff --git a/test/sys/module/rsrc_nonstatic/sections/.note.gnu.build-id b/test/sys/module/rsrc_nonstatic/sections/.note.gnu.build-id deleted file mode 100644 index ab5f09eba3..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef69c diff --git a/test/sys/module/rsrc_nonstatic/sections/.ref.data b/test/sys/module/rsrc_nonstatic/sections/.ref.data deleted file mode 100644 index 76e2ef6fed..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.ref.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f09c0 diff --git a/test/sys/module/rsrc_nonstatic/sections/.rodata b/test/sys/module/rsrc_nonstatic/sections/.rodata deleted file mode 100644 index fa4be8630b..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef6c0 diff --git a/test/sys/module/rsrc_nonstatic/sections/.rodata.str1.1 b/test/sys/module/rsrc_nonstatic/sections/.rodata.str1.1 deleted file mode 100644 index 40e84a404b..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef78d diff --git a/test/sys/module/rsrc_nonstatic/sections/.strtab b/test/sys/module/rsrc_nonstatic/sections/.strtab deleted file mode 100644 index c622215ae0..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f0260 diff --git a/test/sys/module/rsrc_nonstatic/sections/.symtab b/test/sys/module/rsrc_nonstatic/sections/.symtab deleted file mode 100644 index edc4a28363..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef8b8 diff --git a/test/sys/module/rsrc_nonstatic/sections/.text b/test/sys/module/rsrc_nonstatic/sections/.text deleted file mode 100644 index 3c63036e4e..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ee000 diff --git a/test/sys/module/rsrc_nonstatic/sections/__kcrctab b/test/sys/module/rsrc_nonstatic/sections/__kcrctab deleted file mode 100644 index 89dfacc217..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef870 diff --git a/test/sys/module/rsrc_nonstatic/sections/__ksymtab b/test/sys/module/rsrc_nonstatic/sections/__ksymtab deleted file mode 100644 index de3c665d1b..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef860 diff --git a/test/sys/module/rsrc_nonstatic/sections/__ksymtab_strings b/test/sys/module/rsrc_nonstatic/sections/__ksymtab_strings deleted file mode 100644 index 723bf4fc25..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef8a0 diff --git a/test/sys/module/rsrc_nonstatic/sections/__param b/test/sys/module/rsrc_nonstatic/sections/__param deleted file mode 100644 index 10bdfa75bb..0000000000 --- a/test/sys/module/rsrc_nonstatic/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ef878 diff --git a/test/sys/module/rsrc_nonstatic/srcversion b/test/sys/module/rsrc_nonstatic/srcversion deleted file mode 100644 index 8992221999..0000000000 --- a/test/sys/module/rsrc_nonstatic/srcversion +++ /dev/null @@ -1 +0,0 @@ -8554CBDFE6293476856E830 diff --git a/test/sys/module/rtc_cmos/initstate b/test/sys/module/rtc_cmos/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/rtc_cmos/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/rtc_cmos/notes/.note.gnu.build-id b/test/sys/module/rtc_cmos/notes/.note.gnu.build-id deleted file mode 100644 index d556f6054c..0000000000 Binary files a/test/sys/module/rtc_cmos/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/rtc_cmos/refcnt b/test/sys/module/rtc_cmos/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/rtc_cmos/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/rtc_cmos/sections/.bss b/test/sys/module/rtc_cmos/sections/.bss deleted file mode 100644 index 4fe6d87237..0000000000 --- a/test/sys/module/rtc_cmos/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ffd40 diff --git a/test/sys/module/rtc_cmos/sections/.data b/test/sys/module/rtc_cmos/sections/.data deleted file mode 100644 index 8c315ecfac..0000000000 --- a/test/sys/module/rtc_cmos/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ff800 diff --git a/test/sys/module/rtc_cmos/sections/.devinit.text b/test/sys/module/rtc_cmos/sections/.devinit.text deleted file mode 100644 index 32ba67ea79..0000000000 --- a/test/sys/module/rtc_cmos/sections/.devinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fe44f diff --git a/test/sys/module/rtc_cmos/sections/.exit.text b/test/sys/module/rtc_cmos/sections/.exit.text deleted file mode 100644 index 7ce2bc7857..0000000000 --- a/test/sys/module/rtc_cmos/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fe370 diff --git a/test/sys/module/rtc_cmos/sections/.gnu.linkonce.this_module b/test/sys/module/rtc_cmos/sections/.gnu.linkonce.this_module deleted file mode 100644 index 5bace29d4a..0000000000 --- a/test/sys/module/rtc_cmos/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ff980 diff --git a/test/sys/module/rtc_cmos/sections/.init.text b/test/sys/module/rtc_cmos/sections/.init.text deleted file mode 100644 index 3e03f3c0fc..0000000000 --- a/test/sys/module/rtc_cmos/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d000 diff --git a/test/sys/module/rtc_cmos/sections/.note.gnu.build-id b/test/sys/module/rtc_cmos/sections/.note.gnu.build-id deleted file mode 100644 index d140ffdb3c..0000000000 --- a/test/sys/module/rtc_cmos/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fe4e4 diff --git a/test/sys/module/rtc_cmos/sections/.rodata b/test/sys/module/rtc_cmos/sections/.rodata deleted file mode 100644 index 919d4b7f80..0000000000 --- a/test/sys/module/rtc_cmos/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fe520 diff --git a/test/sys/module/rtc_cmos/sections/.rodata.str1.1 b/test/sys/module/rtc_cmos/sections/.rodata.str1.1 deleted file mode 100644 index 67c238bcde..0000000000 --- a/test/sys/module/rtc_cmos/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fe6a2 diff --git a/test/sys/module/rtc_cmos/sections/.strtab b/test/sys/module/rtc_cmos/sections/.strtab deleted file mode 100644 index d2547cf9fd..0000000000 --- a/test/sys/module/rtc_cmos/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ff1a8 diff --git a/test/sys/module/rtc_cmos/sections/.symtab b/test/sys/module/rtc_cmos/sections/.symtab deleted file mode 100644 index 8e90a58d58..0000000000 --- a/test/sys/module/rtc_cmos/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fe6e0 diff --git a/test/sys/module/rtc_cmos/sections/.text b/test/sys/module/rtc_cmos/sections/.text deleted file mode 100644 index 53c31a2db9..0000000000 --- a/test/sys/module/rtc_cmos/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fd000 diff --git a/test/sys/module/rtc_cmos/srcversion b/test/sys/module/rtc_cmos/srcversion deleted file mode 100644 index 5edf58b29a..0000000000 --- a/test/sys/module/rtc_cmos/srcversion +++ /dev/null @@ -1 +0,0 @@ -7BE4B8C2A52556D0C62CB0B diff --git a/test/sys/module/rtc_core/holders/rtc_cmos b/test/sys/module/rtc_core/holders/rtc_cmos deleted file mode 120000 index e84e2e8773..0000000000 --- a/test/sys/module/rtc_core/holders/rtc_cmos +++ /dev/null @@ -1 +0,0 @@ -../../rtc_cmos \ No newline at end of file diff --git a/test/sys/module/rtc_core/initstate b/test/sys/module/rtc_core/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/rtc_core/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/rtc_core/notes/.note.gnu.build-id b/test/sys/module/rtc_core/notes/.note.gnu.build-id deleted file mode 100644 index e9115085cc..0000000000 Binary files a/test/sys/module/rtc_core/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/rtc_core/refcnt b/test/sys/module/rtc_core/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/rtc_core/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/rtc_core/sections/.bss b/test/sys/module/rtc_core/sections/.bss deleted file mode 100644 index 294a3d3f65..0000000000 --- a/test/sys/module/rtc_core/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ecd80 diff --git a/test/sys/module/rtc_core/sections/.data b/test/sys/module/rtc_core/sections/.data deleted file mode 100644 index 9ee0694526..0000000000 --- a/test/sys/module/rtc_core/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ec760 diff --git a/test/sys/module/rtc_core/sections/.exit.text b/test/sys/module/rtc_core/sections/.exit.text deleted file mode 100644 index 85152e0072..0000000000 --- a/test/sys/module/rtc_core/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e9e60 diff --git a/test/sys/module/rtc_core/sections/.gnu.linkonce.this_module b/test/sys/module/rtc_core/sections/.gnu.linkonce.this_module deleted file mode 100644 index a0046cda7d..0000000000 --- a/test/sys/module/rtc_core/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ec9c0 diff --git a/test/sys/module/rtc_core/sections/.init.text b/test/sys/module/rtc_core/sections/.init.text deleted file mode 100644 index 3e03f3c0fc..0000000000 --- a/test/sys/module/rtc_core/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d000 diff --git a/test/sys/module/rtc_core/sections/.note.gnu.build-id b/test/sys/module/rtc_core/sections/.note.gnu.build-id deleted file mode 100644 index 9f7dfbdc5d..0000000000 --- a/test/sys/module/rtc_core/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e9ea4 diff --git a/test/sys/module/rtc_core/sections/.rodata b/test/sys/module/rtc_core/sections/.rodata deleted file mode 100644 index 2733f06831..0000000000 --- a/test/sys/module/rtc_core/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e9ee0 diff --git a/test/sys/module/rtc_core/sections/.rodata.str1.1 b/test/sys/module/rtc_core/sections/.rodata.str1.1 deleted file mode 100644 index e85a0918e8..0000000000 --- a/test/sys/module/rtc_core/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ea098 diff --git a/test/sys/module/rtc_core/sections/.smp_locks b/test/sys/module/rtc_core/sections/.smp_locks deleted file mode 100644 index 4ceb2da43f..0000000000 --- a/test/sys/module/rtc_core/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ea5b8 diff --git a/test/sys/module/rtc_core/sections/.strtab b/test/sys/module/rtc_core/sections/.strtab deleted file mode 100644 index 884919ccf9..0000000000 --- a/test/sys/module/rtc_core/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00eb9c0 diff --git a/test/sys/module/rtc_core/sections/.symtab b/test/sys/module/rtc_core/sections/.symtab deleted file mode 100644 index cf70da3b3c..0000000000 --- a/test/sys/module/rtc_core/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ea5e0 diff --git a/test/sys/module/rtc_core/sections/.text b/test/sys/module/rtc_core/sections/.text deleted file mode 100644 index fcc02a2cb0..0000000000 --- a/test/sys/module/rtc_core/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00e8000 diff --git a/test/sys/module/rtc_core/sections/__kcrctab_gpl b/test/sys/module/rtc_core/sections/__kcrctab_gpl deleted file mode 100644 index 8025c3c5b9..0000000000 --- a/test/sys/module/rtc_core/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ea460 diff --git a/test/sys/module/rtc_core/sections/__ksymtab_gpl b/test/sys/module/rtc_core/sections/__ksymtab_gpl deleted file mode 100644 index c6a8ba83c4..0000000000 --- a/test/sys/module/rtc_core/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ea380 diff --git a/test/sys/module/rtc_core/sections/__ksymtab_strings b/test/sys/module/rtc_core/sections/__ksymtab_strings deleted file mode 100644 index b05143195e..0000000000 --- a/test/sys/module/rtc_core/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ea4d0 diff --git a/test/sys/module/rtc_core/srcversion b/test/sys/module/rtc_core/srcversion deleted file mode 100644 index 4f5a2b57d3..0000000000 --- a/test/sys/module/rtc_core/srcversion +++ /dev/null @@ -1 +0,0 @@ -8684A14821938B7D8E50DB5 diff --git a/test/sys/module/rtc_lib/holders/rtc_core b/test/sys/module/rtc_lib/holders/rtc_core deleted file mode 120000 index 5dc3e7583c..0000000000 --- a/test/sys/module/rtc_lib/holders/rtc_core +++ /dev/null @@ -1 +0,0 @@ -../../rtc_core \ No newline at end of file diff --git a/test/sys/module/rtc_lib/initstate b/test/sys/module/rtc_lib/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/rtc_lib/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/rtc_lib/notes/.note.gnu.build-id b/test/sys/module/rtc_lib/notes/.note.gnu.build-id deleted file mode 100644 index 0e371ebe87..0000000000 Binary files a/test/sys/module/rtc_lib/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/rtc_lib/refcnt b/test/sys/module/rtc_lib/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/rtc_lib/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/rtc_lib/sections/.bss b/test/sys/module/rtc_lib/sections/.bss deleted file mode 100644 index 5636fe5354..0000000000 --- a/test/sys/module/rtc_lib/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009cf80 diff --git a/test/sys/module/rtc_lib/sections/.data b/test/sys/module/rtc_lib/sections/.data deleted file mode 100644 index 039432bb30..0000000000 --- a/test/sys/module/rtc_lib/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009cba8 diff --git a/test/sys/module/rtc_lib/sections/.gnu.linkonce.this_module b/test/sys/module/rtc_lib/sections/.gnu.linkonce.this_module deleted file mode 100644 index 33df9fd7d3..0000000000 --- a/test/sys/module/rtc_lib/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009cbc0 diff --git a/test/sys/module/rtc_lib/sections/.note.gnu.build-id b/test/sys/module/rtc_lib/sections/.note.gnu.build-id deleted file mode 100644 index b8d1d07cea..0000000000 --- a/test/sys/module/rtc_lib/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009c31c diff --git a/test/sys/module/rtc_lib/sections/.rodata b/test/sys/module/rtc_lib/sections/.rodata deleted file mode 100644 index 210c138214..0000000000 --- a/test/sys/module/rtc_lib/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009c340 diff --git a/test/sys/module/rtc_lib/sections/.strtab b/test/sys/module/rtc_lib/sections/.strtab deleted file mode 100644 index 0b35af1d8d..0000000000 --- a/test/sys/module/rtc_lib/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009c8f0 diff --git a/test/sys/module/rtc_lib/sections/.symtab b/test/sys/module/rtc_lib/sections/.symtab deleted file mode 100644 index 18514173ba..0000000000 --- a/test/sys/module/rtc_lib/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009c440 diff --git a/test/sys/module/rtc_lib/sections/.text b/test/sys/module/rtc_lib/sections/.text deleted file mode 100644 index c9f48f1e53..0000000000 --- a/test/sys/module/rtc_lib/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009c000 diff --git a/test/sys/module/rtc_lib/sections/__kcrctab b/test/sys/module/rtc_lib/sections/__kcrctab deleted file mode 100644 index 043e1e8d33..0000000000 --- a/test/sys/module/rtc_lib/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009c3d0 diff --git a/test/sys/module/rtc_lib/sections/__ksymtab b/test/sys/module/rtc_lib/sections/__ksymtab deleted file mode 100644 index fb41ab0494..0000000000 --- a/test/sys/module/rtc_lib/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009c380 diff --git a/test/sys/module/rtc_lib/sections/__ksymtab_strings b/test/sys/module/rtc_lib/sections/__ksymtab_strings deleted file mode 100644 index 7809d296a2..0000000000 --- a/test/sys/module/rtc_lib/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa009c3f8 diff --git a/test/sys/module/rtc_lib/srcversion b/test/sys/module/rtc_lib/srcversion deleted file mode 100644 index 12c16a9a8f..0000000000 --- a/test/sys/module/rtc_lib/srcversion +++ /dev/null @@ -1 +0,0 @@ -7884E7FF8728D88C6BD1427 diff --git a/test/sys/module/scsi_mod/parameters/default_dev_flags b/test/sys/module/scsi_mod/parameters/default_dev_flags deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/scsi_mod/parameters/default_dev_flags +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/scsi_mod/parameters/inq_timeout b/test/sys/module/scsi_mod/parameters/inq_timeout deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/module/scsi_mod/parameters/inq_timeout +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/module/scsi_mod/parameters/max_luns b/test/sys/module/scsi_mod/parameters/max_luns deleted file mode 100644 index 4d0e90cbcb..0000000000 --- a/test/sys/module/scsi_mod/parameters/max_luns +++ /dev/null @@ -1 +0,0 @@ -512 diff --git a/test/sys/module/scsi_mod/parameters/max_report_luns b/test/sys/module/scsi_mod/parameters/max_report_luns deleted file mode 100644 index c0556fb20f..0000000000 --- a/test/sys/module/scsi_mod/parameters/max_report_luns +++ /dev/null @@ -1 +0,0 @@ -511 diff --git a/test/sys/module/scsi_mod/parameters/scan b/test/sys/module/scsi_mod/parameters/scan deleted file mode 100644 index def1d9c60e..0000000000 --- a/test/sys/module/scsi_mod/parameters/scan +++ /dev/null @@ -1 +0,0 @@ -sync diff --git a/test/sys/module/scsi_mod/parameters/scsi_logging_level b/test/sys/module/scsi_mod/parameters/scsi_logging_level deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/scsi_mod/parameters/scsi_logging_level +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/sg/initstate b/test/sys/module/sg/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/sg/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/sg/notes/.note.gnu.build-id b/test/sys/module/sg/notes/.note.gnu.build-id deleted file mode 100644 index 33cc39ee9c..0000000000 Binary files a/test/sys/module/sg/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/sg/parameters/allow_dio b/test/sys/module/sg/parameters/allow_dio deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/sg/parameters/allow_dio +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/sg/parameters/def_reserved_size b/test/sys/module/sg/parameters/def_reserved_size deleted file mode 100644 index dce60d44b8..0000000000 --- a/test/sys/module/sg/parameters/def_reserved_size +++ /dev/null @@ -1 +0,0 @@ -32768 diff --git a/test/sys/module/sg/parameters/scatter_elem_sz b/test/sys/module/sg/parameters/scatter_elem_sz deleted file mode 100644 index dce60d44b8..0000000000 --- a/test/sys/module/sg/parameters/scatter_elem_sz +++ /dev/null @@ -1 +0,0 @@ -32768 diff --git a/test/sys/module/sg/refcnt b/test/sys/module/sg/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/sg/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/sg/sections/.bss b/test/sys/module/sg/sections/.bss deleted file mode 100644 index 70e81445a4..0000000000 --- a/test/sys/module/sg/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0007640 diff --git a/test/sys/module/sg/sections/.data b/test/sys/module/sg/sections/.data deleted file mode 100644 index 18cc37535f..0000000000 --- a/test/sys/module/sg/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0007040 diff --git a/test/sys/module/sg/sections/.exit.text b/test/sys/module/sg/sections/.exit.text deleted file mode 100644 index cb589964f0..0000000000 --- a/test/sys/module/sg/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00049f0 diff --git a/test/sys/module/sg/sections/.fixup b/test/sys/module/sg/sections/.fixup deleted file mode 100644 index f51d7134a9..0000000000 --- a/test/sys/module/sg/sections/.fixup +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0004a33 diff --git a/test/sys/module/sg/sections/.gnu.linkonce.this_module b/test/sys/module/sg/sections/.gnu.linkonce.this_module deleted file mode 100644 index c2a774833d..0000000000 --- a/test/sys/module/sg/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0007280 diff --git a/test/sys/module/sg/sections/.init.text b/test/sys/module/sg/sections/.init.text deleted file mode 100644 index bebf649c98..0000000000 --- a/test/sys/module/sg/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0009000 diff --git a/test/sys/module/sg/sections/.note.gnu.build-id b/test/sys/module/sg/sections/.note.gnu.build-id deleted file mode 100644 index 24754118f5..0000000000 --- a/test/sys/module/sg/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0004afc diff --git a/test/sys/module/sg/sections/.rodata b/test/sys/module/sg/sections/.rodata deleted file mode 100644 index 3efeea401d..0000000000 --- a/test/sys/module/sg/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0004b20 diff --git a/test/sys/module/sg/sections/.rodata.str1.1 b/test/sys/module/sg/sections/.rodata.str1.1 deleted file mode 100644 index a95725c0f4..0000000000 --- a/test/sys/module/sg/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0004bc0 diff --git a/test/sys/module/sg/sections/.smp_locks b/test/sys/module/sg/sections/.smp_locks deleted file mode 100644 index fb6985841c..0000000000 --- a/test/sys/module/sg/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00054d8 diff --git a/test/sys/module/sg/sections/.strtab b/test/sys/module/sg/sections/.strtab deleted file mode 100644 index 0c1f8f0b78..0000000000 --- a/test/sys/module/sg/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0006710 diff --git a/test/sys/module/sg/sections/.symtab b/test/sys/module/sg/sections/.symtab deleted file mode 100644 index 6b98409cf0..0000000000 --- a/test/sys/module/sg/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00056a8 diff --git a/test/sys/module/sg/sections/.text b/test/sys/module/sg/sections/.text deleted file mode 100644 index 57cc208a8b..0000000000 --- a/test/sys/module/sg/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0000000 diff --git a/test/sys/module/sg/sections/__bug_table b/test/sys/module/sg/sections/__bug_table deleted file mode 100644 index a1ebdb1de1..0000000000 --- a/test/sys/module/sg/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00054e8 diff --git a/test/sys/module/sg/sections/__ex_table b/test/sys/module/sg/sections/__ex_table deleted file mode 100644 index 43a780055c..0000000000 --- a/test/sys/module/sg/sections/__ex_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0005530 diff --git a/test/sys/module/sg/sections/__param b/test/sys/module/sg/sections/__param deleted file mode 100644 index b4ea97d654..0000000000 --- a/test/sys/module/sg/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0005630 diff --git a/test/sys/module/sg/srcversion b/test/sys/module/sg/srcversion deleted file mode 100644 index fe620fbb2d..0000000000 --- a/test/sys/module/sg/srcversion +++ /dev/null @@ -1 +0,0 @@ -DC7DE342543B6D7AB46D718 diff --git a/test/sys/module/sg/version b/test/sys/module/sg/version deleted file mode 100644 index b9687cca65..0000000000 --- a/test/sys/module/sg/version +++ /dev/null @@ -1 +0,0 @@ -3.5.34 diff --git a/test/sys/module/snd/holders/snd_hda_intel b/test/sys/module/snd/holders/snd_hda_intel deleted file mode 120000 index 60eae0503e..0000000000 --- a/test/sys/module/snd/holders/snd_hda_intel +++ /dev/null @@ -1 +0,0 @@ -../../snd_hda_intel \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_mixer_oss b/test/sys/module/snd/holders/snd_mixer_oss deleted file mode 120000 index d7bdae620f..0000000000 --- a/test/sys/module/snd/holders/snd_mixer_oss +++ /dev/null @@ -1 +0,0 @@ -../../snd_mixer_oss \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_pcm b/test/sys/module/snd/holders/snd_pcm deleted file mode 120000 index 0eaac02ed1..0000000000 --- a/test/sys/module/snd/holders/snd_pcm +++ /dev/null @@ -1 +0,0 @@ -../../snd_pcm \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_pcm_oss b/test/sys/module/snd/holders/snd_pcm_oss deleted file mode 120000 index dd2f3b9915..0000000000 --- a/test/sys/module/snd/holders/snd_pcm_oss +++ /dev/null @@ -1 +0,0 @@ -../../snd_pcm_oss \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_seq b/test/sys/module/snd/holders/snd_seq deleted file mode 120000 index fbac6b8360..0000000000 --- a/test/sys/module/snd/holders/snd_seq +++ /dev/null @@ -1 +0,0 @@ -../../snd_seq \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_seq_device b/test/sys/module/snd/holders/snd_seq_device deleted file mode 120000 index 830042ec6d..0000000000 --- a/test/sys/module/snd/holders/snd_seq_device +++ /dev/null @@ -1 +0,0 @@ -../../snd_seq_device \ No newline at end of file diff --git a/test/sys/module/snd/holders/snd_timer b/test/sys/module/snd/holders/snd_timer deleted file mode 120000 index 988e3f661d..0000000000 --- a/test/sys/module/snd/holders/snd_timer +++ /dev/null @@ -1 +0,0 @@ -../../snd_timer \ No newline at end of file diff --git a/test/sys/module/snd/initstate b/test/sys/module/snd/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/snd/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/snd/notes/.note.gnu.build-id b/test/sys/module/snd/notes/.note.gnu.build-id deleted file mode 100644 index 015a8df2a4..0000000000 Binary files a/test/sys/module/snd/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/snd/parameters/cards_limit b/test/sys/module/snd/parameters/cards_limit deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/snd/parameters/cards_limit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/snd/parameters/major b/test/sys/module/snd/parameters/major deleted file mode 100644 index 4699eb3cc9..0000000000 --- a/test/sys/module/snd/parameters/major +++ /dev/null @@ -1 +0,0 @@ -116 diff --git a/test/sys/module/snd/parameters/slots b/test/sys/module/snd/parameters/slots deleted file mode 100644 index dcd518e031..0000000000 --- a/test/sys/module/snd/parameters/slots +++ /dev/null @@ -1 +0,0 @@ -snd-hda-intel,,,,,,, diff --git a/test/sys/module/snd/refcnt b/test/sys/module/snd/refcnt deleted file mode 100644 index b1bd38b62a..0000000000 --- a/test/sys/module/snd/refcnt +++ /dev/null @@ -1 +0,0 @@ -13 diff --git a/test/sys/module/snd/sections/.bss b/test/sys/module/snd/sections/.bss deleted file mode 100644 index f8ddba087d..0000000000 --- a/test/sys/module/snd/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00da480 diff --git a/test/sys/module/snd/sections/.data b/test/sys/module/snd/sections/.data deleted file mode 100644 index d61c05c38d..0000000000 --- a/test/sys/module/snd/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d9be0 diff --git a/test/sys/module/snd/sections/.exit.text b/test/sys/module/snd/sections/.exit.text deleted file mode 100644 index d37277b149..0000000000 --- a/test/sys/module/snd/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d1bc4 diff --git a/test/sys/module/snd/sections/.gnu.linkonce.this_module b/test/sys/module/snd/sections/.gnu.linkonce.this_module deleted file mode 100644 index 3971c4e782..0000000000 --- a/test/sys/module/snd/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00da0c0 diff --git a/test/sys/module/snd/sections/.init.text b/test/sys/module/snd/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/snd/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/snd/sections/.note.gnu.build-id b/test/sys/module/snd/sections/.note.gnu.build-id deleted file mode 100644 index cc765d8e67..0000000000 --- a/test/sys/module/snd/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d1c8c diff --git a/test/sys/module/snd/sections/.rodata b/test/sys/module/snd/sections/.rodata deleted file mode 100644 index 58c871309d..0000000000 --- a/test/sys/module/snd/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d1cc0 diff --git a/test/sys/module/snd/sections/.rodata.str1.1 b/test/sys/module/snd/sections/.rodata.str1.1 deleted file mode 100644 index cd74d97c4d..0000000000 --- a/test/sys/module/snd/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d2558 diff --git a/test/sys/module/snd/sections/.strtab b/test/sys/module/snd/sections/.strtab deleted file mode 100644 index ed1d92298b..0000000000 --- a/test/sys/module/snd/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d6cc8 diff --git a/test/sys/module/snd/sections/.symtab b/test/sys/module/snd/sections/.symtab deleted file mode 100644 index 6b000a666e..0000000000 --- a/test/sys/module/snd/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d3770 diff --git a/test/sys/module/snd/sections/.text b/test/sys/module/snd/sections/.text deleted file mode 100644 index f0a65bd3df..0000000000 --- a/test/sys/module/snd/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00ca000 diff --git a/test/sys/module/snd/sections/__kcrctab b/test/sys/module/snd/sections/__kcrctab deleted file mode 100644 index 680383976e..0000000000 --- a/test/sys/module/snd/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d30a0 diff --git a/test/sys/module/snd/sections/__ksymtab b/test/sys/module/snd/sections/__ksymtab deleted file mode 100644 index 7b8205b90c..0000000000 --- a/test/sys/module/snd/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d2d00 diff --git a/test/sys/module/snd/sections/__ksymtab_strings b/test/sys/module/snd/sections/__ksymtab_strings deleted file mode 100644 index 4d9ab113bd..0000000000 --- a/test/sys/module/snd/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d32e8 diff --git a/test/sys/module/snd/sections/__param b/test/sys/module/snd/sections/__param deleted file mode 100644 index 5a8e6a71b8..0000000000 --- a/test/sys/module/snd/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00d3270 diff --git a/test/sys/module/snd/srcversion b/test/sys/module/snd/srcversion deleted file mode 100644 index e296f686ab..0000000000 --- a/test/sys/module/snd/srcversion +++ /dev/null @@ -1 +0,0 @@ -D48337942305C9A41A7CC12 diff --git a/test/sys/module/snd_hda_intel/drivers/pci:HDA Intel b/test/sys/module/snd_hda_intel/drivers/pci:HDA Intel deleted file mode 120000 index 5e8e0d3965..0000000000 --- a/test/sys/module/snd_hda_intel/drivers/pci:HDA Intel +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/HDA Intel \ No newline at end of file diff --git a/test/sys/module/snd_hda_intel/initstate b/test/sys/module/snd_hda_intel/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/snd_hda_intel/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/snd_hda_intel/notes/.note.gnu.build-id b/test/sys/module/snd_hda_intel/notes/.note.gnu.build-id deleted file mode 100644 index a9a78416d3..0000000000 Binary files a/test/sys/module/snd_hda_intel/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/snd_hda_intel/parameters/bdl_pos_adj b/test/sys/module/snd_hda_intel/parameters/bdl_pos_adj deleted file mode 100644 index a870a0c0b1..0000000000 --- a/test/sys/module/snd_hda_intel/parameters/bdl_pos_adj +++ /dev/null @@ -1 +0,0 @@ -1,-1,-1,-1,-1,-1,-1,-1 diff --git a/test/sys/module/snd_hda_intel/parameters/enable b/test/sys/module/snd_hda_intel/parameters/enable deleted file mode 100644 index 426c63aac1..0000000000 --- a/test/sys/module/snd_hda_intel/parameters/enable +++ /dev/null @@ -1 +0,0 @@ -Y,Y,Y,Y,Y,Y,Y,Y diff --git a/test/sys/module/snd_hda_intel/parameters/enable_msi b/test/sys/module/snd_hda_intel/parameters/enable_msi deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/snd_hda_intel/parameters/enable_msi +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/snd_hda_intel/parameters/id b/test/sys/module/snd_hda_intel/parameters/id deleted file mode 100644 index 23086d6f3d..0000000000 --- a/test/sys/module/snd_hda_intel/parameters/id +++ /dev/null @@ -1 +0,0 @@ -,,,,,,, diff --git a/test/sys/module/snd_hda_intel/parameters/index b/test/sys/module/snd_hda_intel/parameters/index deleted file mode 100644 index b9e59f0d64..0000000000 --- a/test/sys/module/snd_hda_intel/parameters/index +++ /dev/null @@ -1 +0,0 @@ --1,-1,-1,-1,-1,-1,-1,-1 diff --git a/test/sys/module/snd_hda_intel/parameters/model b/test/sys/module/snd_hda_intel/parameters/model deleted file mode 100644 index 23086d6f3d..0000000000 --- a/test/sys/module/snd_hda_intel/parameters/model +++ /dev/null @@ -1 +0,0 @@ -,,,,,,, diff --git a/test/sys/module/snd_hda_intel/parameters/position_fix b/test/sys/module/snd_hda_intel/parameters/position_fix deleted file mode 100644 index b9ead4f049..0000000000 --- a/test/sys/module/snd_hda_intel/parameters/position_fix +++ /dev/null @@ -1 +0,0 @@ -0,0,0,0,0,0,0,0 diff --git a/test/sys/module/snd_hda_intel/parameters/probe_mask b/test/sys/module/snd_hda_intel/parameters/probe_mask deleted file mode 100644 index a870a0c0b1..0000000000 --- a/test/sys/module/snd_hda_intel/parameters/probe_mask +++ /dev/null @@ -1 +0,0 @@ -1,-1,-1,-1,-1,-1,-1,-1 diff --git a/test/sys/module/snd_hda_intel/parameters/single_cmd b/test/sys/module/snd_hda_intel/parameters/single_cmd deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/snd_hda_intel/parameters/single_cmd +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/snd_hda_intel/refcnt b/test/sys/module/snd_hda_intel/refcnt deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/module/snd_hda_intel/refcnt +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/module/snd_hda_intel/sections/.bss b/test/sys/module/snd_hda_intel/sections/.bss deleted file mode 100644 index 89e0252f07..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d7800 diff --git a/test/sys/module/snd_hda_intel/sections/.data b/test/sys/module/snd_hda_intel/sections/.data deleted file mode 100644 index 2bad8a7aac..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa019bd40 diff --git a/test/sys/module/snd_hda_intel/sections/.devexit.text b/test/sys/module/snd_hda_intel/sections/.devexit.text deleted file mode 100644 index 006fa6986f..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.devexit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0182a6a diff --git a/test/sys/module/snd_hda_intel/sections/.devinit.data b/test/sys/module/snd_hda_intel/sections/.devinit.data deleted file mode 100644 index ed7a654471..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.devinit.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d7340 diff --git a/test/sys/module/snd_hda_intel/sections/.devinit.text b/test/sys/module/snd_hda_intel/sections/.devinit.text deleted file mode 100644 index 85a94662d6..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.devinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0182aa0 diff --git a/test/sys/module/snd_hda_intel/sections/.exit.text b/test/sys/module/snd_hda_intel/sections/.exit.text deleted file mode 100644 index 31a498c1dd..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0182a58 diff --git a/test/sys/module/snd_hda_intel/sections/.gnu.linkonce.this_module b/test/sys/module/snd_hda_intel/sections/.gnu.linkonce.this_module deleted file mode 100644 index 9a1ddedad0..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01d7440 diff --git a/test/sys/module/snd_hda_intel/sections/.init.text b/test/sys/module/snd_hda_intel/sections/.init.text deleted file mode 100644 index 0cac0d19cf..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0070000 diff --git a/test/sys/module/snd_hda_intel/sections/.note.gnu.build-id b/test/sys/module/snd_hda_intel/sections/.note.gnu.build-id deleted file mode 100644 index c0e048a5d8..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0183f4c diff --git a/test/sys/module/snd_hda_intel/sections/.rodata b/test/sys/module/snd_hda_intel/sections/.rodata deleted file mode 100644 index 055db77b6e..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0183f80 diff --git a/test/sys/module/snd_hda_intel/sections/.rodata.str1.1 b/test/sys/module/snd_hda_intel/sections/.rodata.str1.1 deleted file mode 100644 index 183cd25a89..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0186d8b diff --git a/test/sys/module/snd_hda_intel/sections/.strtab b/test/sys/module/snd_hda_intel/sections/.strtab deleted file mode 100644 index 5e37a81bf8..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0193910 diff --git a/test/sys/module/snd_hda_intel/sections/.symtab b/test/sys/module/snd_hda_intel/sections/.symtab deleted file mode 100644 index d41e0ecb52..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0189f50 diff --git a/test/sys/module/snd_hda_intel/sections/.text b/test/sys/module/snd_hda_intel/sections/.text deleted file mode 100644 index 1b8f754a8a..0000000000 --- a/test/sys/module/snd_hda_intel/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0165000 diff --git a/test/sys/module/snd_hda_intel/sections/__param b/test/sys/module/snd_hda_intel/sections/__param deleted file mode 100644 index f55dd5eec3..0000000000 --- a/test/sys/module/snd_hda_intel/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0189de8 diff --git a/test/sys/module/snd_hda_intel/srcversion b/test/sys/module/snd_hda_intel/srcversion deleted file mode 100644 index 0c87af8d52..0000000000 --- a/test/sys/module/snd_hda_intel/srcversion +++ /dev/null @@ -1 +0,0 @@ -B76633A09F11336101E5480 diff --git a/test/sys/module/snd_mixer_oss/holders/snd_pcm_oss b/test/sys/module/snd_mixer_oss/holders/snd_pcm_oss deleted file mode 120000 index dd2f3b9915..0000000000 --- a/test/sys/module/snd_mixer_oss/holders/snd_pcm_oss +++ /dev/null @@ -1 +0,0 @@ -../../snd_pcm_oss \ No newline at end of file diff --git a/test/sys/module/snd_mixer_oss/initstate b/test/sys/module/snd_mixer_oss/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/snd_mixer_oss/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/snd_mixer_oss/notes/.note.gnu.build-id b/test/sys/module/snd_mixer_oss/notes/.note.gnu.build-id deleted file mode 100644 index b85562083b..0000000000 Binary files a/test/sys/module/snd_mixer_oss/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/snd_mixer_oss/refcnt b/test/sys/module/snd_mixer_oss/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/snd_mixer_oss/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/snd_mixer_oss/sections/.bss b/test/sys/module/snd_mixer_oss/sections/.bss deleted file mode 100644 index 34e5d4676a..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bd240 diff --git a/test/sys/module/snd_mixer_oss/sections/.data b/test/sys/module/snd_mixer_oss/sections/.data deleted file mode 100644 index d6c2c51545..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bcb20 diff --git a/test/sys/module/snd_mixer_oss/sections/.exit.text b/test/sys/module/snd_mixer_oss/sections/.exit.text deleted file mode 100644 index e982fd28fa..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bb508 diff --git a/test/sys/module/snd_mixer_oss/sections/.gnu.linkonce.this_module b/test/sys/module/snd_mixer_oss/sections/.gnu.linkonce.this_module deleted file mode 100644 index d3d8ad56e4..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bce80 diff --git a/test/sys/module/snd_mixer_oss/sections/.init.text b/test/sys/module/snd_mixer_oss/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/snd_mixer_oss/sections/.note.gnu.build-id b/test/sys/module/snd_mixer_oss/sections/.note.gnu.build-id deleted file mode 100644 index 86f4f2321c..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bb54c diff --git a/test/sys/module/snd_mixer_oss/sections/.rodata b/test/sys/module/snd_mixer_oss/sections/.rodata deleted file mode 100644 index 7ca44d2bf5..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bb580 diff --git a/test/sys/module/snd_mixer_oss/sections/.rodata.str1.1 b/test/sys/module/snd_mixer_oss/sections/.rodata.str1.1 deleted file mode 100644 index 3a6c6c0004..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bb760 diff --git a/test/sys/module/snd_mixer_oss/sections/.strtab b/test/sys/module/snd_mixer_oss/sections/.strtab deleted file mode 100644 index 823ab6d78b..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bc470 diff --git a/test/sys/module/snd_mixer_oss/sections/.symtab b/test/sys/module/snd_mixer_oss/sections/.symtab deleted file mode 100644 index 047bfadc81..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bba98 diff --git a/test/sys/module/snd_mixer_oss/sections/.text b/test/sys/module/snd_mixer_oss/sections/.text deleted file mode 100644 index 688f9d336b..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b9000 diff --git a/test/sys/module/snd_mixer_oss/sections/__kcrctab b/test/sys/module/snd_mixer_oss/sections/__kcrctab deleted file mode 100644 index 7a01b310a0..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bba70 diff --git a/test/sys/module/snd_mixer_oss/sections/__ksymtab b/test/sys/module/snd_mixer_oss/sections/__ksymtab deleted file mode 100644 index 538586a5c0..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bba60 diff --git a/test/sys/module/snd_mixer_oss/sections/__ksymtab_strings b/test/sys/module/snd_mixer_oss/sections/__ksymtab_strings deleted file mode 100644 index 47bfe39613..0000000000 --- a/test/sys/module/snd_mixer_oss/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bba78 diff --git a/test/sys/module/snd_mixer_oss/srcversion b/test/sys/module/snd_mixer_oss/srcversion deleted file mode 100644 index 041fd6fa09..0000000000 --- a/test/sys/module/snd_mixer_oss/srcversion +++ /dev/null @@ -1 +0,0 @@ -9D2BFE821DD0ACFA2CFF364 diff --git a/test/sys/module/snd_page_alloc/holders/snd_hda_intel b/test/sys/module/snd_page_alloc/holders/snd_hda_intel deleted file mode 120000 index 60eae0503e..0000000000 --- a/test/sys/module/snd_page_alloc/holders/snd_hda_intel +++ /dev/null @@ -1 +0,0 @@ -../../snd_hda_intel \ No newline at end of file diff --git a/test/sys/module/snd_page_alloc/holders/snd_pcm b/test/sys/module/snd_page_alloc/holders/snd_pcm deleted file mode 120000 index 0eaac02ed1..0000000000 --- a/test/sys/module/snd_page_alloc/holders/snd_pcm +++ /dev/null @@ -1 +0,0 @@ -../../snd_pcm \ No newline at end of file diff --git a/test/sys/module/snd_page_alloc/initstate b/test/sys/module/snd_page_alloc/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/snd_page_alloc/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/snd_page_alloc/notes/.note.gnu.build-id b/test/sys/module/snd_page_alloc/notes/.note.gnu.build-id deleted file mode 100644 index e1b8096a51..0000000000 Binary files a/test/sys/module/snd_page_alloc/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/snd_page_alloc/refcnt b/test/sys/module/snd_page_alloc/refcnt deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/snd_page_alloc/refcnt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/snd_page_alloc/sections/.bss b/test/sys/module/snd_page_alloc/sections/.bss deleted file mode 100644 index 1ede619946..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0036780 diff --git a/test/sys/module/snd_page_alloc/sections/.data b/test/sys/module/snd_page_alloc/sections/.data deleted file mode 100644 index 9e25ccfa03..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0036300 diff --git a/test/sys/module/snd_page_alloc/sections/.exit.text b/test/sys/module/snd_page_alloc/sections/.exit.text deleted file mode 100644 index e6c8cefae1..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0034cc0 diff --git a/test/sys/module/snd_page_alloc/sections/.gnu.linkonce.this_module b/test/sys/module/snd_page_alloc/sections/.gnu.linkonce.this_module deleted file mode 100644 index b9b31348a8..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00363c0 diff --git a/test/sys/module/snd_page_alloc/sections/.init.text b/test/sys/module/snd_page_alloc/sections/.init.text deleted file mode 100644 index 18822d3d85..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0038000 diff --git a/test/sys/module/snd_page_alloc/sections/.note.gnu.build-id b/test/sys/module/snd_page_alloc/sections/.note.gnu.build-id deleted file mode 100644 index 7dc3a3d99f..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0034cf8 diff --git a/test/sys/module/snd_page_alloc/sections/.rodata b/test/sys/module/snd_page_alloc/sections/.rodata deleted file mode 100644 index 4e5576b471..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0034d20 diff --git a/test/sys/module/snd_page_alloc/sections/.rodata.str1.1 b/test/sys/module/snd_page_alloc/sections/.rodata.str1.1 deleted file mode 100644 index 1fdcb5dc87..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0034fd5 diff --git a/test/sys/module/snd_page_alloc/sections/.strtab b/test/sys/module/snd_page_alloc/sections/.strtab deleted file mode 100644 index f4f9e49156..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0035be8 diff --git a/test/sys/module/snd_page_alloc/sections/.symtab b/test/sys/module/snd_page_alloc/sections/.symtab deleted file mode 100644 index ce21f5e780..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0035180 diff --git a/test/sys/module/snd_page_alloc/sections/.text b/test/sys/module/snd_page_alloc/sections/.text deleted file mode 100644 index 438d2016db..0000000000 --- a/test/sys/module/snd_page_alloc/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0034000 diff --git a/test/sys/module/snd_page_alloc/sections/__kcrctab b/test/sys/module/snd_page_alloc/sections/__kcrctab deleted file mode 100644 index 24280f2f6f..0000000000 --- a/test/sys/module/snd_page_alloc/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00350b0 diff --git a/test/sys/module/snd_page_alloc/sections/__ksymtab b/test/sys/module/snd_page_alloc/sections/__ksymtab deleted file mode 100644 index ce296cd45b..0000000000 --- a/test/sys/module/snd_page_alloc/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0035040 diff --git a/test/sys/module/snd_page_alloc/sections/__ksymtab_strings b/test/sys/module/snd_page_alloc/sections/__ksymtab_strings deleted file mode 100644 index ccb7535438..0000000000 --- a/test/sys/module/snd_page_alloc/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00350e8 diff --git a/test/sys/module/snd_page_alloc/srcversion b/test/sys/module/snd_page_alloc/srcversion deleted file mode 100644 index c3e8eda5b9..0000000000 --- a/test/sys/module/snd_page_alloc/srcversion +++ /dev/null @@ -1 +0,0 @@ -D9E59C27F28D5DA2B935016 diff --git a/test/sys/module/snd_pcm/holders/snd_hda_intel b/test/sys/module/snd_pcm/holders/snd_hda_intel deleted file mode 120000 index 60eae0503e..0000000000 --- a/test/sys/module/snd_pcm/holders/snd_hda_intel +++ /dev/null @@ -1 +0,0 @@ -../../snd_hda_intel \ No newline at end of file diff --git a/test/sys/module/snd_pcm/holders/snd_pcm_oss b/test/sys/module/snd_pcm/holders/snd_pcm_oss deleted file mode 120000 index dd2f3b9915..0000000000 --- a/test/sys/module/snd_pcm/holders/snd_pcm_oss +++ /dev/null @@ -1 +0,0 @@ -../../snd_pcm_oss \ No newline at end of file diff --git a/test/sys/module/snd_pcm/initstate b/test/sys/module/snd_pcm/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/snd_pcm/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/snd_pcm/notes/.note.gnu.build-id b/test/sys/module/snd_pcm/notes/.note.gnu.build-id deleted file mode 100644 index 3723d83515..0000000000 Binary files a/test/sys/module/snd_pcm/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/snd_pcm/parameters/maximum_substreams b/test/sys/module/snd_pcm/parameters/maximum_substreams deleted file mode 100644 index b8626c4cff..0000000000 --- a/test/sys/module/snd_pcm/parameters/maximum_substreams +++ /dev/null @@ -1 +0,0 @@ -4 diff --git a/test/sys/module/snd_pcm/parameters/preallocate_dma b/test/sys/module/snd_pcm/parameters/preallocate_dma deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/snd_pcm/parameters/preallocate_dma +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/snd_pcm/refcnt b/test/sys/module/snd_pcm/refcnt deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/snd_pcm/refcnt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/snd_pcm/sections/.bss b/test/sys/module/snd_pcm/sections/.bss deleted file mode 100644 index 2faa4b2844..0000000000 --- a/test/sys/module/snd_pcm/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0149640 diff --git a/test/sys/module/snd_pcm/sections/.data b/test/sys/module/snd_pcm/sections/.data deleted file mode 100644 index ec00353a31..0000000000 --- a/test/sys/module/snd_pcm/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0148b60 diff --git a/test/sys/module/snd_pcm/sections/.exit.text b/test/sys/module/snd_pcm/sections/.exit.text deleted file mode 100644 index 337356658f..0000000000 --- a/test/sys/module/snd_pcm/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01401d4 diff --git a/test/sys/module/snd_pcm/sections/.fixup b/test/sys/module/snd_pcm/sections/.fixup deleted file mode 100644 index 9694c327fb..0000000000 --- a/test/sys/module/snd_pcm/sections/.fixup +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01401fe diff --git a/test/sys/module/snd_pcm/sections/.gnu.linkonce.this_module b/test/sys/module/snd_pcm/sections/.gnu.linkonce.this_module deleted file mode 100644 index c69b8754af..0000000000 --- a/test/sys/module/snd_pcm/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0149280 diff --git a/test/sys/module/snd_pcm/sections/.init.text b/test/sys/module/snd_pcm/sections/.init.text deleted file mode 100644 index 3e03f3c0fc..0000000000 --- a/test/sys/module/snd_pcm/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa007d000 diff --git a/test/sys/module/snd_pcm/sections/.note.gnu.build-id b/test/sys/module/snd_pcm/sections/.note.gnu.build-id deleted file mode 100644 index 634e55ee13..0000000000 --- a/test/sys/module/snd_pcm/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0140260 diff --git a/test/sys/module/snd_pcm/sections/.rodata b/test/sys/module/snd_pcm/sections/.rodata deleted file mode 100644 index 0f36365e2a..0000000000 --- a/test/sys/module/snd_pcm/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01402a0 diff --git a/test/sys/module/snd_pcm/sections/.rodata.str1.1 b/test/sys/module/snd_pcm/sections/.rodata.str1.1 deleted file mode 100644 index 107983a295..0000000000 --- a/test/sys/module/snd_pcm/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0140930 diff --git a/test/sys/module/snd_pcm/sections/.smp_locks b/test/sys/module/snd_pcm/sections/.smp_locks deleted file mode 100644 index 79289d231b..0000000000 --- a/test/sys/module/snd_pcm/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0141af8 diff --git a/test/sys/module/snd_pcm/sections/.strtab b/test/sys/module/snd_pcm/sections/.strtab deleted file mode 100644 index ddf5dc1a6d..0000000000 --- a/test/sys/module/snd_pcm/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0145428 diff --git a/test/sys/module/snd_pcm/sections/.symtab b/test/sys/module/snd_pcm/sections/.symtab deleted file mode 100644 index f8ce390292..0000000000 --- a/test/sys/module/snd_pcm/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0141c00 diff --git a/test/sys/module/snd_pcm/sections/.text b/test/sys/module/snd_pcm/sections/.text deleted file mode 100644 index c8d9e3c38f..0000000000 --- a/test/sys/module/snd_pcm/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0134000 diff --git a/test/sys/module/snd_pcm/sections/__ex_table b/test/sys/module/snd_pcm/sections/__ex_table deleted file mode 100644 index 29b347ba8b..0000000000 --- a/test/sys/module/snd_pcm/sections/__ex_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0141b30 diff --git a/test/sys/module/snd_pcm/sections/__kcrctab b/test/sys/module/snd_pcm/sections/__kcrctab deleted file mode 100644 index 533e4a32ff..0000000000 --- a/test/sys/module/snd_pcm/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0141430 diff --git a/test/sys/module/snd_pcm/sections/__ksymtab b/test/sys/module/snd_pcm/sections/__ksymtab deleted file mode 100644 index 7813d25bc6..0000000000 --- a/test/sys/module/snd_pcm/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01410b0 diff --git a/test/sys/module/snd_pcm/sections/__ksymtab_strings b/test/sys/module/snd_pcm/sections/__ksymtab_strings deleted file mode 100644 index c02a8896be..0000000000 --- a/test/sys/module/snd_pcm/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01415f0 diff --git a/test/sys/module/snd_pcm/sections/__param b/test/sys/module/snd_pcm/sections/__param deleted file mode 100644 index 6cfa8dc8cc..0000000000 --- a/test/sys/module/snd_pcm/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0141bb0 diff --git a/test/sys/module/snd_pcm/srcversion b/test/sys/module/snd_pcm/srcversion deleted file mode 100644 index bc22819ec4..0000000000 --- a/test/sys/module/snd_pcm/srcversion +++ /dev/null @@ -1 +0,0 @@ -96530AD1426FF7F73757C4F diff --git a/test/sys/module/snd_pcm_oss/initstate b/test/sys/module/snd_pcm_oss/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/snd_pcm_oss/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/snd_pcm_oss/notes/.note.gnu.build-id b/test/sys/module/snd_pcm_oss/notes/.note.gnu.build-id deleted file mode 100644 index b8ee20ffd0..0000000000 Binary files a/test/sys/module/snd_pcm_oss/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/snd_pcm_oss/parameters/adsp_map b/test/sys/module/snd_pcm_oss/parameters/adsp_map deleted file mode 100644 index 096bfcbfbc..0000000000 --- a/test/sys/module/snd_pcm_oss/parameters/adsp_map +++ /dev/null @@ -1 +0,0 @@ -1,1,1,1,1,1,1,1 diff --git a/test/sys/module/snd_pcm_oss/parameters/dsp_map b/test/sys/module/snd_pcm_oss/parameters/dsp_map deleted file mode 100644 index b9ead4f049..0000000000 --- a/test/sys/module/snd_pcm_oss/parameters/dsp_map +++ /dev/null @@ -1 +0,0 @@ -0,0,0,0,0,0,0,0 diff --git a/test/sys/module/snd_pcm_oss/parameters/nonblock_open b/test/sys/module/snd_pcm_oss/parameters/nonblock_open deleted file mode 100644 index 9bda8c35c2..0000000000 --- a/test/sys/module/snd_pcm_oss/parameters/nonblock_open +++ /dev/null @@ -1 +0,0 @@ -Y diff --git a/test/sys/module/snd_pcm_oss/refcnt b/test/sys/module/snd_pcm_oss/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/snd_pcm_oss/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/snd_pcm_oss/sections/.bss b/test/sys/module/snd_pcm_oss/sections/.bss deleted file mode 100644 index 70a907db35..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c9b00 diff --git a/test/sys/module/snd_pcm_oss/sections/.data b/test/sys/module/snd_pcm_oss/sections/.data deleted file mode 100644 index e64b7a8a58..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c96c0 diff --git a/test/sys/module/snd_pcm_oss/sections/.exit.text b/test/sys/module/snd_pcm_oss/sections/.exit.text deleted file mode 100644 index de7eeb6101..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c6e7c diff --git a/test/sys/module/snd_pcm_oss/sections/.gnu.linkonce.this_module b/test/sys/module/snd_pcm_oss/sections/.gnu.linkonce.this_module deleted file mode 100644 index 50cdfcc03c..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c9740 diff --git a/test/sys/module/snd_pcm_oss/sections/.init.text b/test/sys/module/snd_pcm_oss/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/snd_pcm_oss/sections/.note.gnu.build-id b/test/sys/module/snd_pcm_oss/sections/.note.gnu.build-id deleted file mode 100644 index 50b4f862b8..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c6e94 diff --git a/test/sys/module/snd_pcm_oss/sections/.rodata b/test/sys/module/snd_pcm_oss/sections/.rodata deleted file mode 100644 index 94745b4c2d..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c6ec0 diff --git a/test/sys/module/snd_pcm_oss/sections/.rodata.str1.1 b/test/sys/module/snd_pcm_oss/sections/.rodata.str1.1 deleted file mode 100644 index ba5ec7f246..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c71a8 diff --git a/test/sys/module/snd_pcm_oss/sections/.strtab b/test/sys/module/snd_pcm_oss/sections/.strtab deleted file mode 100644 index fff88f5970..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c8818 diff --git a/test/sys/module/snd_pcm_oss/sections/.symtab b/test/sys/module/snd_pcm_oss/sections/.symtab deleted file mode 100644 index 3db134c520..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c73f0 diff --git a/test/sys/module/snd_pcm_oss/sections/.text b/test/sys/module/snd_pcm_oss/sections/.text deleted file mode 100644 index 27d01fb877..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02bf000 diff --git a/test/sys/module/snd_pcm_oss/sections/__param b/test/sys/module/snd_pcm_oss/sections/__param deleted file mode 100644 index cb3588dc0e..0000000000 --- a/test/sys/module/snd_pcm_oss/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02c7378 diff --git a/test/sys/module/snd_pcm_oss/srcversion b/test/sys/module/snd_pcm_oss/srcversion deleted file mode 100644 index 09490a8462..0000000000 --- a/test/sys/module/snd_pcm_oss/srcversion +++ /dev/null @@ -1 +0,0 @@ -E3D05A52B04130012283029 diff --git a/test/sys/module/snd_seq/initstate b/test/sys/module/snd_seq/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/snd_seq/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/snd_seq/notes/.note.gnu.build-id b/test/sys/module/snd_seq/notes/.note.gnu.build-id deleted file mode 100644 index 725fba5068..0000000000 Binary files a/test/sys/module/snd_seq/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/snd_seq/parameters/seq_client_load b/test/sys/module/snd_seq/parameters/seq_client_load deleted file mode 100644 index 8ad37c1248..0000000000 --- a/test/sys/module/snd_seq/parameters/seq_client_load +++ /dev/null @@ -1 +0,0 @@ --1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_card b/test/sys/module/snd_seq/parameters/seq_default_timer_card deleted file mode 100644 index 3a2e3f4984..0000000000 --- a/test/sys/module/snd_seq/parameters/seq_default_timer_card +++ /dev/null @@ -1 +0,0 @@ --1 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_class b/test/sys/module/snd_seq/parameters/seq_default_timer_class deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/snd_seq/parameters/seq_default_timer_class +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_device b/test/sys/module/snd_seq/parameters/seq_default_timer_device deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/snd_seq/parameters/seq_default_timer_device +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_resolution b/test/sys/module/snd_seq/parameters/seq_default_timer_resolution deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/snd_seq/parameters/seq_default_timer_resolution +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_sclass b/test/sys/module/snd_seq/parameters/seq_default_timer_sclass deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/snd_seq/parameters/seq_default_timer_sclass +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/snd_seq/parameters/seq_default_timer_subdevice b/test/sys/module/snd_seq/parameters/seq_default_timer_subdevice deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/snd_seq/parameters/seq_default_timer_subdevice +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/snd_seq/refcnt b/test/sys/module/snd_seq/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/snd_seq/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/snd_seq/sections/.bss b/test/sys/module/snd_seq/sections/.bss deleted file mode 100644 index 7b1ec46001..0000000000 --- a/test/sys/module/snd_seq/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b6f80 diff --git a/test/sys/module/snd_seq/sections/.data b/test/sys/module/snd_seq/sections/.data deleted file mode 100644 index bd80381a68..0000000000 --- a/test/sys/module/snd_seq/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b6860 diff --git a/test/sys/module/snd_seq/sections/.exit.text b/test/sys/module/snd_seq/sections/.exit.text deleted file mode 100644 index c31c6fa71e..0000000000 --- a/test/sys/module/snd_seq/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b0ff0 diff --git a/test/sys/module/snd_seq/sections/.gnu.linkonce.this_module b/test/sys/module/snd_seq/sections/.gnu.linkonce.this_module deleted file mode 100644 index 78bc61dbcf..0000000000 --- a/test/sys/module/snd_seq/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b6bc0 diff --git a/test/sys/module/snd_seq/sections/.init.text b/test/sys/module/snd_seq/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/snd_seq/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/snd_seq/sections/.note.gnu.build-id b/test/sys/module/snd_seq/sections/.note.gnu.build-id deleted file mode 100644 index f4c0efac9a..0000000000 --- a/test/sys/module/snd_seq/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b10bc diff --git a/test/sys/module/snd_seq/sections/.rodata b/test/sys/module/snd_seq/sections/.rodata deleted file mode 100644 index 8154a7e5f8..0000000000 --- a/test/sys/module/snd_seq/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b10e0 diff --git a/test/sys/module/snd_seq/sections/.rodata.str1.1 b/test/sys/module/snd_seq/sections/.rodata.str1.1 deleted file mode 100644 index e7b91207af..0000000000 --- a/test/sys/module/snd_seq/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b18b6 diff --git a/test/sys/module/snd_seq/sections/.smp_locks b/test/sys/module/snd_seq/sections/.smp_locks deleted file mode 100644 index eec8a7bbe3..0000000000 --- a/test/sys/module/snd_seq/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b1d30 diff --git a/test/sys/module/snd_seq/sections/.strtab b/test/sys/module/snd_seq/sections/.strtab deleted file mode 100644 index 01d9aef3e5..0000000000 --- a/test/sys/module/snd_seq/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b4590 diff --git a/test/sys/module/snd_seq/sections/.symtab b/test/sys/module/snd_seq/sections/.symtab deleted file mode 100644 index 9dba092436..0000000000 --- a/test/sys/module/snd_seq/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b1fc8 diff --git a/test/sys/module/snd_seq/sections/.text b/test/sys/module/snd_seq/sections/.text deleted file mode 100644 index c74d6571ae..0000000000 --- a/test/sys/module/snd_seq/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a9000 diff --git a/test/sys/module/snd_seq/sections/__kcrctab b/test/sys/module/snd_seq/sections/__kcrctab deleted file mode 100644 index 1ba6d1d22b..0000000000 --- a/test/sys/module/snd_seq/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b16e0 diff --git a/test/sys/module/snd_seq/sections/__ksymtab b/test/sys/module/snd_seq/sections/__ksymtab deleted file mode 100644 index fa86a08454..0000000000 --- a/test/sys/module/snd_seq/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b1610 diff --git a/test/sys/module/snd_seq/sections/__ksymtab_strings b/test/sys/module/snd_seq/sections/__ksymtab_strings deleted file mode 100644 index 2de51cda12..0000000000 --- a/test/sys/module/snd_seq/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b1748 diff --git a/test/sys/module/snd_seq/sections/__param b/test/sys/module/snd_seq/sections/__param deleted file mode 100644 index 9e3ad157a9..0000000000 --- a/test/sys/module/snd_seq/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02b1320 diff --git a/test/sys/module/snd_seq/srcversion b/test/sys/module/snd_seq/srcversion deleted file mode 100644 index b08bc7ae4f..0000000000 --- a/test/sys/module/snd_seq/srcversion +++ /dev/null @@ -1 +0,0 @@ -94E19F6DBC8F63B241414FE diff --git a/test/sys/module/snd_seq_device/holders/snd_seq b/test/sys/module/snd_seq_device/holders/snd_seq deleted file mode 120000 index fbac6b8360..0000000000 --- a/test/sys/module/snd_seq_device/holders/snd_seq +++ /dev/null @@ -1 +0,0 @@ -../../snd_seq \ No newline at end of file diff --git a/test/sys/module/snd_seq_device/initstate b/test/sys/module/snd_seq_device/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/snd_seq_device/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/snd_seq_device/notes/.note.gnu.build-id b/test/sys/module/snd_seq_device/notes/.note.gnu.build-id deleted file mode 100644 index 3cc827704e..0000000000 Binary files a/test/sys/module/snd_seq_device/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/snd_seq_device/refcnt b/test/sys/module/snd_seq_device/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/snd_seq_device/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/snd_seq_device/sections/.bss b/test/sys/module/snd_seq_device/sections/.bss deleted file mode 100644 index 191949a185..0000000000 --- a/test/sys/module/snd_seq_device/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a7280 diff --git a/test/sys/module/snd_seq_device/sections/.data b/test/sys/module/snd_seq_device/sections/.data deleted file mode 100644 index 9180bc372a..0000000000 --- a/test/sys/module/snd_seq_device/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a6de0 diff --git a/test/sys/module/snd_seq_device/sections/.exit.text b/test/sys/module/snd_seq_device/sections/.exit.text deleted file mode 100644 index 97e829f3b6..0000000000 --- a/test/sys/module/snd_seq_device/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a5a5c diff --git a/test/sys/module/snd_seq_device/sections/.gnu.linkonce.this_module b/test/sys/module/snd_seq_device/sections/.gnu.linkonce.this_module deleted file mode 100644 index d275ad9ce7..0000000000 --- a/test/sys/module/snd_seq_device/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a6ec0 diff --git a/test/sys/module/snd_seq_device/sections/.init.text b/test/sys/module/snd_seq_device/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/snd_seq_device/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/snd_seq_device/sections/.note.gnu.build-id b/test/sys/module/snd_seq_device/sections/.note.gnu.build-id deleted file mode 100644 index e9016b339f..0000000000 --- a/test/sys/module/snd_seq_device/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a5a90 diff --git a/test/sys/module/snd_seq_device/sections/.rodata.str1.1 b/test/sys/module/snd_seq_device/sections/.rodata.str1.1 deleted file mode 100644 index d66a845d5d..0000000000 --- a/test/sys/module/snd_seq_device/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a5bd0 diff --git a/test/sys/module/snd_seq_device/sections/.strtab b/test/sys/module/snd_seq_device/sections/.strtab deleted file mode 100644 index fe92f872a9..0000000000 --- a/test/sys/module/snd_seq_device/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a66e0 diff --git a/test/sys/module/snd_seq_device/sections/.symtab b/test/sys/module/snd_seq_device/sections/.symtab deleted file mode 100644 index cf4dc9ae93..0000000000 --- a/test/sys/module/snd_seq_device/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a5db0 diff --git a/test/sys/module/snd_seq_device/sections/.text b/test/sys/module/snd_seq_device/sections/.text deleted file mode 100644 index f9a94beb2e..0000000000 --- a/test/sys/module/snd_seq_device/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a5000 diff --git a/test/sys/module/snd_seq_device/sections/__kcrctab b/test/sys/module/snd_seq_device/sections/__kcrctab deleted file mode 100644 index 3d5629377b..0000000000 --- a/test/sys/module/snd_seq_device/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a5ce0 diff --git a/test/sys/module/snd_seq_device/sections/__ksymtab b/test/sys/module/snd_seq_device/sections/__ksymtab deleted file mode 100644 index d2c2f00a52..0000000000 --- a/test/sys/module/snd_seq_device/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a5c80 diff --git a/test/sys/module/snd_seq_device/sections/__ksymtab_strings b/test/sys/module/snd_seq_device/sections/__ksymtab_strings deleted file mode 100644 index 7072c5b62b..0000000000 --- a/test/sys/module/snd_seq_device/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02a5d10 diff --git a/test/sys/module/snd_seq_device/srcversion b/test/sys/module/snd_seq_device/srcversion deleted file mode 100644 index 785191c034..0000000000 --- a/test/sys/module/snd_seq_device/srcversion +++ /dev/null @@ -1 +0,0 @@ -A166653189DAF15E3F2B588 diff --git a/test/sys/module/snd_timer/holders/snd_pcm b/test/sys/module/snd_timer/holders/snd_pcm deleted file mode 120000 index 0eaac02ed1..0000000000 --- a/test/sys/module/snd_timer/holders/snd_pcm +++ /dev/null @@ -1 +0,0 @@ -../../snd_pcm \ No newline at end of file diff --git a/test/sys/module/snd_timer/holders/snd_seq b/test/sys/module/snd_timer/holders/snd_seq deleted file mode 120000 index fbac6b8360..0000000000 --- a/test/sys/module/snd_timer/holders/snd_seq +++ /dev/null @@ -1 +0,0 @@ -../../snd_seq \ No newline at end of file diff --git a/test/sys/module/snd_timer/initstate b/test/sys/module/snd_timer/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/snd_timer/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/snd_timer/notes/.note.gnu.build-id b/test/sys/module/snd_timer/notes/.note.gnu.build-id deleted file mode 100644 index 9c99a65b21..0000000000 Binary files a/test/sys/module/snd_timer/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/snd_timer/parameters/timer_limit b/test/sys/module/snd_timer/parameters/timer_limit deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/snd_timer/parameters/timer_limit +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/snd_timer/parameters/timer_tstamp_monotonic b/test/sys/module/snd_timer/parameters/timer_tstamp_monotonic deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/snd_timer/parameters/timer_tstamp_monotonic +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/snd_timer/refcnt b/test/sys/module/snd_timer/refcnt deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/snd_timer/refcnt +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/snd_timer/sections/.bss b/test/sys/module/snd_timer/sections/.bss deleted file mode 100644 index 320fab13c4..0000000000 --- a/test/sys/module/snd_timer/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fb200 diff --git a/test/sys/module/snd_timer/sections/.data b/test/sys/module/snd_timer/sections/.data deleted file mode 100644 index 6198eefdef..0000000000 --- a/test/sys/module/snd_timer/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fad00 diff --git a/test/sys/module/snd_timer/sections/.exit.text b/test/sys/module/snd_timer/sections/.exit.text deleted file mode 100644 index 0988161ab1..0000000000 --- a/test/sys/module/snd_timer/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f8520 diff --git a/test/sys/module/snd_timer/sections/.gnu.linkonce.this_module b/test/sys/module/snd_timer/sections/.gnu.linkonce.this_module deleted file mode 100644 index 56d7a09a36..0000000000 --- a/test/sys/module/snd_timer/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00fae40 diff --git a/test/sys/module/snd_timer/sections/.init.text b/test/sys/module/snd_timer/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/snd_timer/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/snd_timer/sections/.note.gnu.build-id b/test/sys/module/snd_timer/sections/.note.gnu.build-id deleted file mode 100644 index c00eceb9d3..0000000000 --- a/test/sys/module/snd_timer/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f8590 diff --git a/test/sys/module/snd_timer/sections/.rodata b/test/sys/module/snd_timer/sections/.rodata deleted file mode 100644 index a59d2bef00..0000000000 --- a/test/sys/module/snd_timer/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f85c0 diff --git a/test/sys/module/snd_timer/sections/.rodata.str1.1 b/test/sys/module/snd_timer/sections/.rodata.str1.1 deleted file mode 100644 index 4d967834c3..0000000000 --- a/test/sys/module/snd_timer/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f8723 diff --git a/test/sys/module/snd_timer/sections/.smp_locks b/test/sys/module/snd_timer/sections/.smp_locks deleted file mode 100644 index ceeb865500..0000000000 --- a/test/sys/module/snd_timer/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f8908 diff --git a/test/sys/module/snd_timer/sections/.strtab b/test/sys/module/snd_timer/sections/.strtab deleted file mode 100644 index 8076745d9a..0000000000 --- a/test/sys/module/snd_timer/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f9e90 diff --git a/test/sys/module/snd_timer/sections/.symtab b/test/sys/module/snd_timer/sections/.symtab deleted file mode 100644 index 1ee97758bf..0000000000 --- a/test/sys/module/snd_timer/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f8b88 diff --git a/test/sys/module/snd_timer/sections/.text b/test/sys/module/snd_timer/sections/.text deleted file mode 100644 index 3e00728a51..0000000000 --- a/test/sys/module/snd_timer/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f5000 diff --git a/test/sys/module/snd_timer/sections/__bug_table b/test/sys/module/snd_timer/sections/__bug_table deleted file mode 100644 index 368c672d33..0000000000 --- a/test/sys/module/snd_timer/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f888f diff --git a/test/sys/module/snd_timer/sections/__kcrctab b/test/sys/module/snd_timer/sections/__kcrctab deleted file mode 100644 index 0582f6ddb0..0000000000 --- a/test/sys/module/snd_timer/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f89e0 diff --git a/test/sys/module/snd_timer/sections/__ksymtab b/test/sys/module/snd_timer/sections/__ksymtab deleted file mode 100644 index 41c75e77a1..0000000000 --- a/test/sys/module/snd_timer/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f8910 diff --git a/test/sys/module/snd_timer/sections/__ksymtab_strings b/test/sys/module/snd_timer/sections/__ksymtab_strings deleted file mode 100644 index de74bcfefd..0000000000 --- a/test/sys/module/snd_timer/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f8a98 diff --git a/test/sys/module/snd_timer/sections/__param b/test/sys/module/snd_timer/sections/__param deleted file mode 100644 index 5a7dcb4c53..0000000000 --- a/test/sys/module/snd_timer/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00f8a48 diff --git a/test/sys/module/snd_timer/srcversion b/test/sys/module/snd_timer/srcversion deleted file mode 100644 index dd93b11c4a..0000000000 --- a/test/sys/module/snd_timer/srcversion +++ /dev/null @@ -1 +0,0 @@ -1F1836030C5B604CF478CFC diff --git a/test/sys/module/soundcore/holders/snd b/test/sys/module/soundcore/holders/snd deleted file mode 120000 index caa1619fc2..0000000000 --- a/test/sys/module/soundcore/holders/snd +++ /dev/null @@ -1 +0,0 @@ -../../snd \ No newline at end of file diff --git a/test/sys/module/soundcore/initstate b/test/sys/module/soundcore/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/soundcore/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/soundcore/notes/.note.gnu.build-id b/test/sys/module/soundcore/notes/.note.gnu.build-id deleted file mode 100644 index 490a982d90..0000000000 Binary files a/test/sys/module/soundcore/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/soundcore/refcnt b/test/sys/module/soundcore/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/soundcore/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/soundcore/sections/.bss b/test/sys/module/soundcore/sections/.bss deleted file mode 100644 index b9f55a774d..0000000000 --- a/test/sys/module/soundcore/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00692c0 diff --git a/test/sys/module/soundcore/sections/.data b/test/sys/module/soundcore/sections/.data deleted file mode 100644 index 481c93cbf2..0000000000 --- a/test/sys/module/soundcore/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0068ec0 diff --git a/test/sys/module/soundcore/sections/.exit.text b/test/sys/module/soundcore/sections/.exit.text deleted file mode 100644 index c12a0df109..0000000000 --- a/test/sys/module/soundcore/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0067850 diff --git a/test/sys/module/soundcore/sections/.gnu.linkonce.this_module b/test/sys/module/soundcore/sections/.gnu.linkonce.this_module deleted file mode 100644 index 33184728b5..0000000000 --- a/test/sys/module/soundcore/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0068f00 diff --git a/test/sys/module/soundcore/sections/.init.text b/test/sys/module/soundcore/sections/.init.text deleted file mode 100644 index 6449cb3074..0000000000 --- a/test/sys/module/soundcore/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006b000 diff --git a/test/sys/module/soundcore/sections/.note.gnu.build-id b/test/sys/module/soundcore/sections/.note.gnu.build-id deleted file mode 100644 index 9211548ac0..0000000000 --- a/test/sys/module/soundcore/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0067874 diff --git a/test/sys/module/soundcore/sections/.rodata b/test/sys/module/soundcore/sections/.rodata deleted file mode 100644 index 91c56c2e37..0000000000 --- a/test/sys/module/soundcore/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00678a0 diff --git a/test/sys/module/soundcore/sections/.rodata.str1.1 b/test/sys/module/soundcore/sections/.rodata.str1.1 deleted file mode 100644 index 9acba7c958..0000000000 --- a/test/sys/module/soundcore/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00679f8 diff --git a/test/sys/module/soundcore/sections/.strtab b/test/sys/module/soundcore/sections/.strtab deleted file mode 100644 index 5a8f37f39f..0000000000 --- a/test/sys/module/soundcore/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00686d0 diff --git a/test/sys/module/soundcore/sections/.symtab b/test/sys/module/soundcore/sections/.symtab deleted file mode 100644 index 64a5d6febe..0000000000 --- a/test/sys/module/soundcore/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0067cc8 diff --git a/test/sys/module/soundcore/sections/.text b/test/sys/module/soundcore/sections/.text deleted file mode 100644 index 91f7a151f0..0000000000 --- a/test/sys/module/soundcore/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0067000 diff --git a/test/sys/module/soundcore/sections/__kcrctab b/test/sys/module/soundcore/sections/__kcrctab deleted file mode 100644 index 8fa03c387e..0000000000 --- a/test/sys/module/soundcore/sections/__kcrctab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0067ba0 diff --git a/test/sys/module/soundcore/sections/__ksymtab b/test/sys/module/soundcore/sections/__ksymtab deleted file mode 100644 index e6f10f74ad..0000000000 --- a/test/sys/module/soundcore/sections/__ksymtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0067b00 diff --git a/test/sys/module/soundcore/sections/__ksymtab_strings b/test/sys/module/soundcore/sections/__ksymtab_strings deleted file mode 100644 index b13ec916cd..0000000000 --- a/test/sys/module/soundcore/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0067bf0 diff --git a/test/sys/module/soundcore/srcversion b/test/sys/module/soundcore/srcversion deleted file mode 100644 index 24fbc65e33..0000000000 --- a/test/sys/module/soundcore/srcversion +++ /dev/null @@ -1 +0,0 @@ -E4F49ED9C4CFD1A5A923330 diff --git a/test/sys/module/spurious/parameters/irqfixup b/test/sys/module/spurious/parameters/irqfixup deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/spurious/parameters/irqfixup +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/spurious/parameters/noirqdebug b/test/sys/module/spurious/parameters/noirqdebug deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/spurious/parameters/noirqdebug +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/sr_mod/initstate b/test/sys/module/sr_mod/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/sr_mod/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/sr_mod/notes/.note.gnu.build-id b/test/sys/module/sr_mod/notes/.note.gnu.build-id deleted file mode 100644 index 82ee21ec80..0000000000 Binary files a/test/sys/module/sr_mod/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/sr_mod/parameters/xa_test b/test/sys/module/sr_mod/parameters/xa_test deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/sr_mod/parameters/xa_test +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/sr_mod/refcnt b/test/sys/module/sr_mod/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/sr_mod/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/sr_mod/sections/.bss b/test/sys/module/sr_mod/sections/.bss deleted file mode 100644 index 15cfbab0cb..0000000000 --- a/test/sys/module/sr_mod/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00630c0 diff --git a/test/sys/module/sr_mod/sections/.data b/test/sys/module/sr_mod/sections/.data deleted file mode 100644 index f14e1e766f..0000000000 --- a/test/sys/module/sr_mod/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0062aa0 diff --git a/test/sys/module/sr_mod/sections/.exit.text b/test/sys/module/sr_mod/sections/.exit.text deleted file mode 100644 index 10d338e356..0000000000 --- a/test/sys/module/sr_mod/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa006126c diff --git a/test/sys/module/sr_mod/sections/.gnu.linkonce.this_module b/test/sys/module/sr_mod/sections/.gnu.linkonce.this_module deleted file mode 100644 index 5e81537736..0000000000 --- a/test/sys/module/sr_mod/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0062d00 diff --git a/test/sys/module/sr_mod/sections/.init.text b/test/sys/module/sr_mod/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/sr_mod/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/sr_mod/sections/.note.gnu.build-id b/test/sys/module/sr_mod/sections/.note.gnu.build-id deleted file mode 100644 index 8eb98a4e87..0000000000 --- a/test/sys/module/sr_mod/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0061290 diff --git a/test/sys/module/sr_mod/sections/.rodata b/test/sys/module/sr_mod/sections/.rodata deleted file mode 100644 index 715fbc75d0..0000000000 --- a/test/sys/module/sr_mod/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00612c0 diff --git a/test/sys/module/sr_mod/sections/.rodata.str1.1 b/test/sys/module/sr_mod/sections/.rodata.str1.1 deleted file mode 100644 index 112a57ea77..0000000000 --- a/test/sys/module/sr_mod/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0061308 diff --git a/test/sys/module/sr_mod/sections/.smp_locks b/test/sys/module/sr_mod/sections/.smp_locks deleted file mode 100644 index 0dea737950..0000000000 --- a/test/sys/module/sr_mod/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0061488 diff --git a/test/sys/module/sr_mod/sections/.strtab b/test/sys/module/sr_mod/sections/.strtab deleted file mode 100644 index 8691bc3415..0000000000 --- a/test/sys/module/sr_mod/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00623f0 diff --git a/test/sys/module/sr_mod/sections/.symtab b/test/sys/module/sr_mod/sections/.symtab deleted file mode 100644 index cfc0712bb2..0000000000 --- a/test/sys/module/sr_mod/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0061778 diff --git a/test/sys/module/sr_mod/sections/.text b/test/sys/module/sr_mod/sections/.text deleted file mode 100644 index 8293f90783..0000000000 --- a/test/sys/module/sr_mod/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa005f000 diff --git a/test/sys/module/sr_mod/sections/__param b/test/sys/module/sr_mod/sections/__param deleted file mode 100644 index 9f1f49721e..0000000000 --- a/test/sys/module/sr_mod/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0061750 diff --git a/test/sys/module/sr_mod/srcversion b/test/sys/module/sr_mod/srcversion deleted file mode 100644 index 4dc373d962..0000000000 --- a/test/sys/module/sr_mod/srcversion +++ /dev/null @@ -1 +0,0 @@ -3484F077F1A71803F453437 diff --git a/test/sys/module/tcp_cubic/parameters/beta b/test/sys/module/tcp_cubic/parameters/beta deleted file mode 100644 index 05c8b2c097..0000000000 --- a/test/sys/module/tcp_cubic/parameters/beta +++ /dev/null @@ -1 +0,0 @@ -717 diff --git a/test/sys/module/tcp_cubic/parameters/bic_scale b/test/sys/module/tcp_cubic/parameters/bic_scale deleted file mode 100644 index 87523dd7a0..0000000000 --- a/test/sys/module/tcp_cubic/parameters/bic_scale +++ /dev/null @@ -1 +0,0 @@ -41 diff --git a/test/sys/module/tcp_cubic/parameters/fast_convergence b/test/sys/module/tcp_cubic/parameters/fast_convergence deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/tcp_cubic/parameters/fast_convergence +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/tcp_cubic/parameters/initial_ssthresh b/test/sys/module/tcp_cubic/parameters/initial_ssthresh deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/tcp_cubic/parameters/initial_ssthresh +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/tcp_cubic/parameters/tcp_friendliness b/test/sys/module/tcp_cubic/parameters/tcp_friendliness deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/tcp_cubic/parameters/tcp_friendliness +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/thermal/initstate b/test/sys/module/thermal/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/thermal/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/thermal/notes/.note.gnu.build-id b/test/sys/module/thermal/notes/.note.gnu.build-id deleted file mode 100644 index 8781a52306..0000000000 Binary files a/test/sys/module/thermal/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/thermal/parameters/act b/test/sys/module/thermal/parameters/act deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/thermal/parameters/act +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/thermal/parameters/crt b/test/sys/module/thermal/parameters/crt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/thermal/parameters/crt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/thermal/parameters/psv b/test/sys/module/thermal/parameters/psv deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/thermal/parameters/psv +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/thermal/parameters/tzp b/test/sys/module/thermal/parameters/tzp deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/thermal/parameters/tzp +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/thermal/refcnt b/test/sys/module/thermal/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/thermal/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/thermal/sections/.bss b/test/sys/module/thermal/sections/.bss deleted file mode 100644 index 5bb3f1722c..0000000000 --- a/test/sys/module/thermal/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a4bc0 diff --git a/test/sys/module/thermal/sections/.data b/test/sys/module/thermal/sections/.data deleted file mode 100644 index 2bf743d6bd..0000000000 --- a/test/sys/module/thermal/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a4640 diff --git a/test/sys/module/thermal/sections/.exit.text b/test/sys/module/thermal/sections/.exit.text deleted file mode 100644 index 3dc71f41a1..0000000000 --- a/test/sys/module/thermal/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a1f14 diff --git a/test/sys/module/thermal/sections/.gnu.linkonce.this_module b/test/sys/module/thermal/sections/.gnu.linkonce.this_module deleted file mode 100644 index 20e0f91648..0000000000 --- a/test/sys/module/thermal/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a4800 diff --git a/test/sys/module/thermal/sections/.init.data b/test/sys/module/thermal/sections/.init.data deleted file mode 100644 index 5a91c4cd3e..0000000000 --- a/test/sys/module/thermal/sections/.init.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0070090 diff --git a/test/sys/module/thermal/sections/.init.text b/test/sys/module/thermal/sections/.init.text deleted file mode 100644 index 0cac0d19cf..0000000000 --- a/test/sys/module/thermal/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0070000 diff --git a/test/sys/module/thermal/sections/.note.gnu.build-id b/test/sys/module/thermal/sections/.note.gnu.build-id deleted file mode 100644 index 3bca0c2c3f..0000000000 --- a/test/sys/module/thermal/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a1f3c diff --git a/test/sys/module/thermal/sections/.rodata b/test/sys/module/thermal/sections/.rodata deleted file mode 100644 index f8bcea6e91..0000000000 --- a/test/sys/module/thermal/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a1f60 diff --git a/test/sys/module/thermal/sections/.rodata.str1.1 b/test/sys/module/thermal/sections/.rodata.str1.1 deleted file mode 100644 index 34567ede65..0000000000 --- a/test/sys/module/thermal/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a242a diff --git a/test/sys/module/thermal/sections/.strtab b/test/sys/module/thermal/sections/.strtab deleted file mode 100644 index eb9fedc4f3..0000000000 --- a/test/sys/module/thermal/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a3b28 diff --git a/test/sys/module/thermal/sections/.symtab b/test/sys/module/thermal/sections/.symtab deleted file mode 100644 index e888edc2f5..0000000000 --- a/test/sys/module/thermal/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a2ac0 diff --git a/test/sys/module/thermal/sections/.text b/test/sys/module/thermal/sections/.text deleted file mode 100644 index cb816d17ae..0000000000 --- a/test/sys/module/thermal/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a0000 diff --git a/test/sys/module/thermal/sections/__param b/test/sys/module/thermal/sections/__param deleted file mode 100644 index 1971b2fd5a..0000000000 --- a/test/sys/module/thermal/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00a29d0 diff --git a/test/sys/module/thermal/srcversion b/test/sys/module/thermal/srcversion deleted file mode 100644 index e107377fe5..0000000000 --- a/test/sys/module/thermal/srcversion +++ /dev/null @@ -1 +0,0 @@ -1787CE9FEB053C917D031A9 diff --git a/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_acpi b/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_acpi deleted file mode 120000 index 388b2236b0..0000000000 --- a/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_acpi +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform/drivers/thinkpad_acpi \ No newline at end of file diff --git a/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_hwmon b/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_hwmon deleted file mode 120000 index b34f0fde53..0000000000 --- a/test/sys/module/thinkpad_acpi/drivers/platform:thinkpad_hwmon +++ /dev/null @@ -1 +0,0 @@ -../../../bus/platform/drivers/thinkpad_hwmon \ No newline at end of file diff --git a/test/sys/module/thinkpad_acpi/initstate b/test/sys/module/thinkpad_acpi/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/thinkpad_acpi/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/thinkpad_acpi/notes/.note.gnu.build-id b/test/sys/module/thinkpad_acpi/notes/.note.gnu.build-id deleted file mode 100644 index 6852bdc06b..0000000000 Binary files a/test/sys/module/thinkpad_acpi/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/thinkpad_acpi/refcnt b/test/sys/module/thinkpad_acpi/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/thinkpad_acpi/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/thinkpad_acpi/sections/.bss b/test/sys/module/thinkpad_acpi/sections/.bss deleted file mode 100644 index abd0fcfcd9..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01ed600 diff --git a/test/sys/module/thinkpad_acpi/sections/.data b/test/sys/module/thinkpad_acpi/sections/.data deleted file mode 100644 index 94355baa07..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01ebd60 diff --git a/test/sys/module/thinkpad_acpi/sections/.gnu.linkonce.this_module b/test/sys/module/thinkpad_acpi/sections/.gnu.linkonce.this_module deleted file mode 100644 index 6704076caa..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01ed240 diff --git a/test/sys/module/thinkpad_acpi/sections/.init.data b/test/sys/module/thinkpad_acpi/sections/.init.data deleted file mode 100644 index 38453a15c4..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.init.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01f1700 diff --git a/test/sys/module/thinkpad_acpi/sections/.init.text b/test/sys/module/thinkpad_acpi/sections/.init.text deleted file mode 100644 index e3a07aecb9..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01ef000 diff --git a/test/sys/module/thinkpad_acpi/sections/.note.gnu.build-id b/test/sys/module/thinkpad_acpi/sections/.note.gnu.build-id deleted file mode 100644 index df21719621..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01e3a80 diff --git a/test/sys/module/thinkpad_acpi/sections/.rodata b/test/sys/module/thinkpad_acpi/sections/.rodata deleted file mode 100644 index 66e54fae11..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01e3ac0 diff --git a/test/sys/module/thinkpad_acpi/sections/.rodata.str1.1 b/test/sys/module/thinkpad_acpi/sections/.rodata.str1.1 deleted file mode 100644 index b30eb1097a..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01e3df0 diff --git a/test/sys/module/thinkpad_acpi/sections/.smp_locks b/test/sys/module/thinkpad_acpi/sections/.smp_locks deleted file mode 100644 index aa0f507fc7..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01e6088 diff --git a/test/sys/module/thinkpad_acpi/sections/.strtab b/test/sys/module/thinkpad_acpi/sections/.strtab deleted file mode 100644 index e43904d3a7..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01e98b8 diff --git a/test/sys/module/thinkpad_acpi/sections/.symtab b/test/sys/module/thinkpad_acpi/sections/.symtab deleted file mode 100644 index ad8b7caecc..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01e6498 diff --git a/test/sys/module/thinkpad_acpi/sections/.text b/test/sys/module/thinkpad_acpi/sections/.text deleted file mode 100644 index 2265c6d055..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01dd000 diff --git a/test/sys/module/thinkpad_acpi/sections/__bug_table b/test/sys/module/thinkpad_acpi/sections/__bug_table deleted file mode 100644 index d0ab4f22c2..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01e60e0 diff --git a/test/sys/module/thinkpad_acpi/sections/__param b/test/sys/module/thinkpad_acpi/sections/__param deleted file mode 100644 index fa147faf64..0000000000 --- a/test/sys/module/thinkpad_acpi/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01e61a0 diff --git a/test/sys/module/thinkpad_acpi/srcversion b/test/sys/module/thinkpad_acpi/srcversion deleted file mode 100644 index 4f590ebe69..0000000000 --- a/test/sys/module/thinkpad_acpi/srcversion +++ /dev/null @@ -1 +0,0 @@ -FA276F7EFAA90BF39100654 diff --git a/test/sys/module/thinkpad_acpi/version b/test/sys/module/thinkpad_acpi/version deleted file mode 100644 index 5320adc1c9..0000000000 --- a/test/sys/module/thinkpad_acpi/version +++ /dev/null @@ -1 +0,0 @@ -0.21 diff --git a/test/sys/module/uhci_hcd/drivers/pci:uhci_hcd b/test/sys/module/uhci_hcd/drivers/pci:uhci_hcd deleted file mode 120000 index ed69e37601..0000000000 --- a/test/sys/module/uhci_hcd/drivers/pci:uhci_hcd +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/uhci_hcd \ No newline at end of file diff --git a/test/sys/module/uhci_hcd/initstate b/test/sys/module/uhci_hcd/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/uhci_hcd/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/uhci_hcd/notes/.note.gnu.build-id b/test/sys/module/uhci_hcd/notes/.note.gnu.build-id deleted file mode 100644 index 0a49c44d4f..0000000000 Binary files a/test/sys/module/uhci_hcd/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/uhci_hcd/parameters/ignore_oc b/test/sys/module/uhci_hcd/parameters/ignore_oc deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/uhci_hcd/parameters/ignore_oc +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/uhci_hcd/refcnt b/test/sys/module/uhci_hcd/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/uhci_hcd/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/uhci_hcd/sections/.bss b/test/sys/module/uhci_hcd/sections/.bss deleted file mode 100644 index 897410c93c..0000000000 --- a/test/sys/module/uhci_hcd/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c8400 diff --git a/test/sys/module/uhci_hcd/sections/.data b/test/sys/module/uhci_hcd/sections/.data deleted file mode 100644 index 6c1cccf783..0000000000 --- a/test/sys/module/uhci_hcd/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c7ee0 diff --git a/test/sys/module/uhci_hcd/sections/.exit.text b/test/sys/module/uhci_hcd/sections/.exit.text deleted file mode 100644 index ce49ee22ae..0000000000 --- a/test/sys/module/uhci_hcd/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c621c diff --git a/test/sys/module/uhci_hcd/sections/.gnu.linkonce.this_module b/test/sys/module/uhci_hcd/sections/.gnu.linkonce.this_module deleted file mode 100644 index 2a54735f3a..0000000000 --- a/test/sys/module/uhci_hcd/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c8040 diff --git a/test/sys/module/uhci_hcd/sections/.init.text b/test/sys/module/uhci_hcd/sections/.init.text deleted file mode 100644 index 02c713a482..0000000000 --- a/test/sys/module/uhci_hcd/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027000 diff --git a/test/sys/module/uhci_hcd/sections/.note.gnu.build-id b/test/sys/module/uhci_hcd/sections/.note.gnu.build-id deleted file mode 100644 index 8fc3a985e7..0000000000 --- a/test/sys/module/uhci_hcd/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c6254 diff --git a/test/sys/module/uhci_hcd/sections/.rodata b/test/sys/module/uhci_hcd/sections/.rodata deleted file mode 100644 index fcaff176ff..0000000000 --- a/test/sys/module/uhci_hcd/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c6280 diff --git a/test/sys/module/uhci_hcd/sections/.rodata.str1.1 b/test/sys/module/uhci_hcd/sections/.rodata.str1.1 deleted file mode 100644 index 46448bdf6e..0000000000 --- a/test/sys/module/uhci_hcd/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c67d2 diff --git a/test/sys/module/uhci_hcd/sections/.smp_locks b/test/sys/module/uhci_hcd/sections/.smp_locks deleted file mode 100644 index 6cc08f06d0..0000000000 --- a/test/sys/module/uhci_hcd/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c6850 diff --git a/test/sys/module/uhci_hcd/sections/.strtab b/test/sys/module/uhci_hcd/sections/.strtab deleted file mode 100644 index 5ea80aa5d5..0000000000 --- a/test/sys/module/uhci_hcd/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c7690 diff --git a/test/sys/module/uhci_hcd/sections/.symtab b/test/sys/module/uhci_hcd/sections/.symtab deleted file mode 100644 index 75177416bd..0000000000 --- a/test/sys/module/uhci_hcd/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c68b0 diff --git a/test/sys/module/uhci_hcd/sections/.text b/test/sys/module/uhci_hcd/sections/.text deleted file mode 100644 index f2fd2b3e1d..0000000000 --- a/test/sys/module/uhci_hcd/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c2000 diff --git a/test/sys/module/uhci_hcd/sections/__param b/test/sys/module/uhci_hcd/sections/__param deleted file mode 100644 index e5aa8ba25c..0000000000 --- a/test/sys/module/uhci_hcd/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa00c6888 diff --git a/test/sys/module/uhci_hcd/srcversion b/test/sys/module/uhci_hcd/srcversion deleted file mode 100644 index 2d031c30be..0000000000 --- a/test/sys/module/uhci_hcd/srcversion +++ /dev/null @@ -1 +0,0 @@ -E3F4B6BEC99D6670259FCC9 diff --git a/test/sys/module/uinput/initstate b/test/sys/module/uinput/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/uinput/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/uinput/notes/.note.gnu.build-id b/test/sys/module/uinput/notes/.note.gnu.build-id deleted file mode 100644 index b693a3b883..0000000000 Binary files a/test/sys/module/uinput/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/uinput/refcnt b/test/sys/module/uinput/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/uinput/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/uinput/sections/.bss b/test/sys/module/uinput/sections/.bss deleted file mode 100644 index dc0c52fc68..0000000000 --- a/test/sys/module/uinput/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02074c0 diff --git a/test/sys/module/uinput/sections/.data b/test/sys/module/uinput/sections/.data deleted file mode 100644 index e4b09aafd9..0000000000 --- a/test/sys/module/uinput/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02070c0 diff --git a/test/sys/module/uinput/sections/.exit.text b/test/sys/module/uinput/sections/.exit.text deleted file mode 100644 index c755d6f97b..0000000000 --- a/test/sys/module/uinput/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0206278 diff --git a/test/sys/module/uinput/sections/.gnu.linkonce.this_module b/test/sys/module/uinput/sections/.gnu.linkonce.this_module deleted file mode 100644 index f85604d0c7..0000000000 --- a/test/sys/module/uinput/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0207100 diff --git a/test/sys/module/uinput/sections/.init.text b/test/sys/module/uinput/sections/.init.text deleted file mode 100644 index 0cac0d19cf..0000000000 --- a/test/sys/module/uinput/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0070000 diff --git a/test/sys/module/uinput/sections/.note.gnu.build-id b/test/sys/module/uinput/sections/.note.gnu.build-id deleted file mode 100644 index fbda8bdef8..0000000000 --- a/test/sys/module/uinput/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa020628c diff --git a/test/sys/module/uinput/sections/.rodata b/test/sys/module/uinput/sections/.rodata deleted file mode 100644 index 6723f71778..0000000000 --- a/test/sys/module/uinput/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02062c0 diff --git a/test/sys/module/uinput/sections/.rodata.str1.1 b/test/sys/module/uinput/sections/.rodata.str1.1 deleted file mode 100644 index e1f4d0013c..0000000000 --- a/test/sys/module/uinput/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0206398 diff --git a/test/sys/module/uinput/sections/.smp_locks b/test/sys/module/uinput/sections/.smp_locks deleted file mode 100644 index f5e97e9fa0..0000000000 --- a/test/sys/module/uinput/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0206448 diff --git a/test/sys/module/uinput/sections/.strtab b/test/sys/module/uinput/sections/.strtab deleted file mode 100644 index 76793313c0..0000000000 --- a/test/sys/module/uinput/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0206c88 diff --git a/test/sys/module/uinput/sections/.symtab b/test/sys/module/uinput/sections/.symtab deleted file mode 100644 index d8a9e04f13..0000000000 --- a/test/sys/module/uinput/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0206490 diff --git a/test/sys/module/uinput/sections/.text b/test/sys/module/uinput/sections/.text deleted file mode 100644 index 186960c329..0000000000 --- a/test/sys/module/uinput/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0205000 diff --git a/test/sys/module/uinput/srcversion b/test/sys/module/uinput/srcversion deleted file mode 100644 index c1a7284041..0000000000 --- a/test/sys/module/uinput/srcversion +++ /dev/null @@ -1 +0,0 @@ -2C3E0DB9E2496AD70174B85 diff --git a/test/sys/module/uinput/version b/test/sys/module/uinput/version deleted file mode 100644 index be58634173..0000000000 --- a/test/sys/module/uinput/version +++ /dev/null @@ -1 +0,0 @@ -0.3 diff --git a/test/sys/module/usb_storage/drivers/usb:usb-storage b/test/sys/module/usb_storage/drivers/usb:usb-storage deleted file mode 120000 index 529c13f715..0000000000 --- a/test/sys/module/usb_storage/drivers/usb:usb-storage +++ /dev/null @@ -1 +0,0 @@ -../../../bus/usb/drivers/usb-storage \ No newline at end of file diff --git a/test/sys/module/usb_storage/initstate b/test/sys/module/usb_storage/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/usb_storage/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/usb_storage/notes/.note.gnu.build-id b/test/sys/module/usb_storage/notes/.note.gnu.build-id deleted file mode 100644 index 64788b0bec..0000000000 Binary files a/test/sys/module/usb_storage/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/usb_storage/parameters/delay_use b/test/sys/module/usb_storage/parameters/delay_use deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/module/usb_storage/parameters/delay_use +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/module/usb_storage/parameters/swi_tru_install b/test/sys/module/usb_storage/parameters/swi_tru_install deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/usb_storage/parameters/swi_tru_install +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/usb_storage/refcnt b/test/sys/module/usb_storage/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/usb_storage/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/usb_storage/sections/.bss b/test/sys/module/usb_storage/sections/.bss deleted file mode 100644 index c0d1e67a20..0000000000 --- a/test/sys/module/usb_storage/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e9400 diff --git a/test/sys/module/usb_storage/sections/.data b/test/sys/module/usb_storage/sections/.data deleted file mode 100644 index fcd5cadbb6..0000000000 --- a/test/sys/module/usb_storage/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e5dc0 diff --git a/test/sys/module/usb_storage/sections/.exit.text b/test/sys/module/usb_storage/sections/.exit.text deleted file mode 100644 index 2d8dfe5469..0000000000 --- a/test/sys/module/usb_storage/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e056c diff --git a/test/sys/module/usb_storage/sections/.gnu.linkonce.this_module b/test/sys/module/usb_storage/sections/.gnu.linkonce.this_module deleted file mode 100644 index 95fbd77952..0000000000 --- a/test/sys/module/usb_storage/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e9040 diff --git a/test/sys/module/usb_storage/sections/.init.text b/test/sys/module/usb_storage/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/usb_storage/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/usb_storage/sections/.note.gnu.build-id b/test/sys/module/usb_storage/sections/.note.gnu.build-id deleted file mode 100644 index 1e86001a88..0000000000 --- a/test/sys/module/usb_storage/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e0580 diff --git a/test/sys/module/usb_storage/sections/.rodata b/test/sys/module/usb_storage/sections/.rodata deleted file mode 100644 index 3628fc397c..0000000000 --- a/test/sys/module/usb_storage/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e05b0 diff --git a/test/sys/module/usb_storage/sections/.rodata.str1.1 b/test/sys/module/usb_storage/sections/.rodata.str1.1 deleted file mode 100644 index f223a7e369..0000000000 --- a/test/sys/module/usb_storage/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e0ab1 diff --git a/test/sys/module/usb_storage/sections/.smp_locks b/test/sys/module/usb_storage/sections/.smp_locks deleted file mode 100644 index 4f0afdf398..0000000000 --- a/test/sys/module/usb_storage/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e1820 diff --git a/test/sys/module/usb_storage/sections/.strtab b/test/sys/module/usb_storage/sections/.strtab deleted file mode 100644 index 6064f35463..0000000000 --- a/test/sys/module/usb_storage/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e42d0 diff --git a/test/sys/module/usb_storage/sections/.symtab b/test/sys/module/usb_storage/sections/.symtab deleted file mode 100644 index 55075357df..0000000000 --- a/test/sys/module/usb_storage/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e1900 diff --git a/test/sys/module/usb_storage/sections/.text b/test/sys/module/usb_storage/sections/.text deleted file mode 100644 index 2a91d12ca3..0000000000 --- a/test/sys/module/usb_storage/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02dd000 diff --git a/test/sys/module/usb_storage/sections/__param b/test/sys/module/usb_storage/sections/__param deleted file mode 100644 index a67a5a8e0b..0000000000 --- a/test/sys/module/usb_storage/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02e18b0 diff --git a/test/sys/module/usb_storage/srcversion b/test/sys/module/usb_storage/srcversion deleted file mode 100644 index 0045fcb1ec..0000000000 --- a/test/sys/module/usb_storage/srcversion +++ /dev/null @@ -1 +0,0 @@ -D07F7C47643AB7AFB6BEF6F diff --git a/test/sys/module/usbcore/drivers/usb:hub b/test/sys/module/usbcore/drivers/usb:hub deleted file mode 120000 index 610e86cda5..0000000000 --- a/test/sys/module/usbcore/drivers/usb:hub +++ /dev/null @@ -1 +0,0 @@ -../../../bus/usb/drivers/hub \ No newline at end of file diff --git a/test/sys/module/usbcore/drivers/usb:usb b/test/sys/module/usbcore/drivers/usb:usb deleted file mode 120000 index 5a9e5d0958..0000000000 --- a/test/sys/module/usbcore/drivers/usb:usb +++ /dev/null @@ -1 +0,0 @@ -../../../bus/usb/drivers/usb \ No newline at end of file diff --git a/test/sys/module/usbcore/drivers/usb:usbfs b/test/sys/module/usbcore/drivers/usb:usbfs deleted file mode 120000 index 0827b1487c..0000000000 --- a/test/sys/module/usbcore/drivers/usb:usbfs +++ /dev/null @@ -1 +0,0 @@ -../../../bus/usb/drivers/usbfs \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/cdc_acm b/test/sys/module/usbcore/holders/cdc_acm deleted file mode 120000 index 26b62c4122..0000000000 --- a/test/sys/module/usbcore/holders/cdc_acm +++ /dev/null @@ -1 +0,0 @@ -../../cdc_acm \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/ehci_hcd b/test/sys/module/usbcore/holders/ehci_hcd deleted file mode 120000 index 5f0529c1bd..0000000000 --- a/test/sys/module/usbcore/holders/ehci_hcd +++ /dev/null @@ -1 +0,0 @@ -../../ehci_hcd \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/uhci_hcd b/test/sys/module/usbcore/holders/uhci_hcd deleted file mode 120000 index 69c656f6c2..0000000000 --- a/test/sys/module/usbcore/holders/uhci_hcd +++ /dev/null @@ -1 +0,0 @@ -../../uhci_hcd \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/usb_storage b/test/sys/module/usbcore/holders/usb_storage deleted file mode 120000 index 21ab5abc8e..0000000000 --- a/test/sys/module/usbcore/holders/usb_storage +++ /dev/null @@ -1 +0,0 @@ -../../usb_storage \ No newline at end of file diff --git a/test/sys/module/usbcore/holders/usbhid b/test/sys/module/usbcore/holders/usbhid deleted file mode 120000 index fa4793fa31..0000000000 --- a/test/sys/module/usbcore/holders/usbhid +++ /dev/null @@ -1 +0,0 @@ -../../usbhid \ No newline at end of file diff --git a/test/sys/module/usbcore/initstate b/test/sys/module/usbcore/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/usbcore/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/usbcore/notes/.note.gnu.build-id b/test/sys/module/usbcore/notes/.note.gnu.build-id deleted file mode 100644 index eb27ff4ea8..0000000000 Binary files a/test/sys/module/usbcore/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/usbcore/parameters/autosuspend b/test/sys/module/usbcore/parameters/autosuspend deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/usbcore/parameters/autosuspend +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/usbcore/parameters/blinkenlights b/test/sys/module/usbcore/parameters/blinkenlights deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/usbcore/parameters/blinkenlights +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/usbcore/parameters/nousb b/test/sys/module/usbcore/parameters/nousb deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/usbcore/parameters/nousb +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/usbcore/parameters/old_scheme_first b/test/sys/module/usbcore/parameters/old_scheme_first deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/usbcore/parameters/old_scheme_first +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/usbcore/parameters/usbfs_snoop b/test/sys/module/usbcore/parameters/usbfs_snoop deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/usbcore/parameters/usbfs_snoop +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/usbcore/parameters/use_both_schemes b/test/sys/module/usbcore/parameters/use_both_schemes deleted file mode 100644 index 9bda8c35c2..0000000000 --- a/test/sys/module/usbcore/parameters/use_both_schemes +++ /dev/null @@ -1 +0,0 @@ -Y diff --git a/test/sys/module/usbcore/refcnt b/test/sys/module/usbcore/refcnt deleted file mode 100644 index 7ed6ff82de..0000000000 --- a/test/sys/module/usbcore/refcnt +++ /dev/null @@ -1 +0,0 @@ -5 diff --git a/test/sys/module/usbcore/sections/.bss b/test/sys/module/usbcore/sections/.bss deleted file mode 100644 index 7b2c0092a3..0000000000 --- a/test/sys/module/usbcore/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa005cec0 diff --git a/test/sys/module/usbcore/sections/.data b/test/sys/module/usbcore/sections/.data deleted file mode 100644 index a7369af09d..0000000000 --- a/test/sys/module/usbcore/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa005af00 diff --git a/test/sys/module/usbcore/sections/.exit.text b/test/sys/module/usbcore/sections/.exit.text deleted file mode 100644 index 1a76333e54..0000000000 --- a/test/sys/module/usbcore/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004ba30 diff --git a/test/sys/module/usbcore/sections/.fixup b/test/sys/module/usbcore/sections/.fixup deleted file mode 100644 index 431e7b306e..0000000000 --- a/test/sys/module/usbcore/sections/.fixup +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004ba87 diff --git a/test/sys/module/usbcore/sections/.gnu.linkonce.this_module b/test/sys/module/usbcore/sections/.gnu.linkonce.this_module deleted file mode 100644 index 5bd1255670..0000000000 --- a/test/sys/module/usbcore/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa005cb00 diff --git a/test/sys/module/usbcore/sections/.init.text b/test/sys/module/usbcore/sections/.init.text deleted file mode 100644 index 02c713a482..0000000000 --- a/test/sys/module/usbcore/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0027000 diff --git a/test/sys/module/usbcore/sections/.note.gnu.build-id b/test/sys/module/usbcore/sections/.note.gnu.build-id deleted file mode 100644 index ac15d62109..0000000000 --- a/test/sys/module/usbcore/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004bb30 diff --git a/test/sys/module/usbcore/sections/.rodata b/test/sys/module/usbcore/sections/.rodata deleted file mode 100644 index b91dcd7811..0000000000 --- a/test/sys/module/usbcore/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004bb60 diff --git a/test/sys/module/usbcore/sections/.rodata.str1.1 b/test/sys/module/usbcore/sections/.rodata.str1.1 deleted file mode 100644 index 972e9d3f61..0000000000 --- a/test/sys/module/usbcore/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004c044 diff --git a/test/sys/module/usbcore/sections/.smp_locks b/test/sys/module/usbcore/sections/.smp_locks deleted file mode 100644 index ba252c1f48..0000000000 --- a/test/sys/module/usbcore/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004f930 diff --git a/test/sys/module/usbcore/sections/.strtab b/test/sys/module/usbcore/sections/.strtab deleted file mode 100644 index f7aa4bd1a8..0000000000 --- a/test/sys/module/usbcore/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0055cf8 diff --git a/test/sys/module/usbcore/sections/.symtab b/test/sys/module/usbcore/sections/.symtab deleted file mode 100644 index db962319e1..0000000000 --- a/test/sys/module/usbcore/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004fb18 diff --git a/test/sys/module/usbcore/sections/.text b/test/sys/module/usbcore/sections/.text deleted file mode 100644 index 18822d3d85..0000000000 --- a/test/sys/module/usbcore/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0038000 diff --git a/test/sys/module/usbcore/sections/__bug_table b/test/sys/module/usbcore/sections/__bug_table deleted file mode 100644 index c58f602ca9..0000000000 --- a/test/sys/module/usbcore/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004fa40 diff --git a/test/sys/module/usbcore/sections/__ex_table b/test/sys/module/usbcore/sections/__ex_table deleted file mode 100644 index 13cd7abc44..0000000000 --- a/test/sys/module/usbcore/sections/__ex_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004fa58 diff --git a/test/sys/module/usbcore/sections/__kcrctab_gpl b/test/sys/module/usbcore/sections/__kcrctab_gpl deleted file mode 100644 index ad656977f0..0000000000 --- a/test/sys/module/usbcore/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004ef70 diff --git a/test/sys/module/usbcore/sections/__ksymtab_gpl b/test/sys/module/usbcore/sections/__ksymtab_gpl deleted file mode 100644 index fda0fba578..0000000000 --- a/test/sys/module/usbcore/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004ea30 diff --git a/test/sys/module/usbcore/sections/__ksymtab_strings b/test/sys/module/usbcore/sections/__ksymtab_strings deleted file mode 100644 index a8b72eceee..0000000000 --- a/test/sys/module/usbcore/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004f300 diff --git a/test/sys/module/usbcore/sections/__param b/test/sys/module/usbcore/sections/__param deleted file mode 100644 index 20a20138a1..0000000000 --- a/test/sys/module/usbcore/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa004f210 diff --git a/test/sys/module/usbcore/srcversion b/test/sys/module/usbcore/srcversion deleted file mode 100644 index cbae6b2dd3..0000000000 --- a/test/sys/module/usbcore/srcversion +++ /dev/null @@ -1 +0,0 @@ -4FF77EB8DAB25F4076D7357 diff --git a/test/sys/module/usbhid/drivers/usb:usbhid b/test/sys/module/usbhid/drivers/usb:usbhid deleted file mode 120000 index 8c8b2c3944..0000000000 --- a/test/sys/module/usbhid/drivers/usb:usbhid +++ /dev/null @@ -1 +0,0 @@ -../../../bus/usb/drivers/usbhid \ No newline at end of file diff --git a/test/sys/module/usbhid/initstate b/test/sys/module/usbhid/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/usbhid/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/usbhid/notes/.note.gnu.build-id b/test/sys/module/usbhid/notes/.note.gnu.build-id deleted file mode 100644 index dfaf096cda..0000000000 Binary files a/test/sys/module/usbhid/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/usbhid/parameters/mousepoll b/test/sys/module/usbhid/parameters/mousepoll deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/usbhid/parameters/mousepoll +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/usbhid/parameters/quirks b/test/sys/module/usbhid/parameters/quirks deleted file mode 100644 index f23b0f9e5f..0000000000 --- a/test/sys/module/usbhid/parameters/quirks +++ /dev/null @@ -1 +0,0 @@ -,,, diff --git a/test/sys/module/usbhid/parameters/rdesc_quirks b/test/sys/module/usbhid/parameters/rdesc_quirks deleted file mode 100644 index f23b0f9e5f..0000000000 --- a/test/sys/module/usbhid/parameters/rdesc_quirks +++ /dev/null @@ -1 +0,0 @@ -,,, diff --git a/test/sys/module/usbhid/refcnt b/test/sys/module/usbhid/refcnt deleted file mode 100644 index 573541ac97..0000000000 --- a/test/sys/module/usbhid/refcnt +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/sys/module/usbhid/sections/.bss b/test/sys/module/usbhid/sections/.bss deleted file mode 100644 index a07f5cdf62..0000000000 --- a/test/sys/module/usbhid/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0203d80 diff --git a/test/sys/module/usbhid/sections/.data b/test/sys/module/usbhid/sections/.data deleted file mode 100644 index 5484c3b174..0000000000 --- a/test/sys/module/usbhid/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02037c0 diff --git a/test/sys/module/usbhid/sections/.exit.text b/test/sys/module/usbhid/sections/.exit.text deleted file mode 100644 index 5217f1176e..0000000000 --- a/test/sys/module/usbhid/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0200c6c diff --git a/test/sys/module/usbhid/sections/.gnu.linkonce.this_module b/test/sys/module/usbhid/sections/.gnu.linkonce.this_module deleted file mode 100644 index d21c96a8a3..0000000000 --- a/test/sys/module/usbhid/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02039c0 diff --git a/test/sys/module/usbhid/sections/.init.text b/test/sys/module/usbhid/sections/.init.text deleted file mode 100644 index f34ada03b5..0000000000 --- a/test/sys/module/usbhid/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0065000 diff --git a/test/sys/module/usbhid/sections/.note.gnu.build-id b/test/sys/module/usbhid/sections/.note.gnu.build-id deleted file mode 100644 index d47046fbda..0000000000 --- a/test/sys/module/usbhid/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0200c84 diff --git a/test/sys/module/usbhid/sections/.rodata b/test/sys/module/usbhid/sections/.rodata deleted file mode 100644 index e4d4313bb1..0000000000 --- a/test/sys/module/usbhid/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0200cc0 diff --git a/test/sys/module/usbhid/sections/.rodata.str1.1 b/test/sys/module/usbhid/sections/.rodata.str1.1 deleted file mode 100644 index daafd879e1..0000000000 --- a/test/sys/module/usbhid/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa02017a8 diff --git a/test/sys/module/usbhid/sections/.smp_locks b/test/sys/module/usbhid/sections/.smp_locks deleted file mode 100644 index 362619b927..0000000000 --- a/test/sys/module/usbhid/sections/.smp_locks +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0201700 diff --git a/test/sys/module/usbhid/sections/.strtab b/test/sys/module/usbhid/sections/.strtab deleted file mode 100644 index ffe710d197..0000000000 --- a/test/sys/module/usbhid/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0202e68 diff --git a/test/sys/module/usbhid/sections/.symtab b/test/sys/module/usbhid/sections/.symtab deleted file mode 100644 index 39f534b35f..0000000000 --- a/test/sys/module/usbhid/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0201e90 diff --git a/test/sys/module/usbhid/sections/.text b/test/sys/module/usbhid/sections/.text deleted file mode 100644 index dc020a91c8..0000000000 --- a/test/sys/module/usbhid/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa01fe000 diff --git a/test/sys/module/usbhid/sections/__kcrctab_gpl b/test/sys/module/usbhid/sections/__kcrctab_gpl deleted file mode 100644 index 10a86ee016..0000000000 --- a/test/sys/module/usbhid/sections/__kcrctab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0201e70 diff --git a/test/sys/module/usbhid/sections/__ksymtab_gpl b/test/sys/module/usbhid/sections/__ksymtab_gpl deleted file mode 100644 index 92a68e4803..0000000000 --- a/test/sys/module/usbhid/sections/__ksymtab_gpl +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0201e60 diff --git a/test/sys/module/usbhid/sections/__ksymtab_strings b/test/sys/module/usbhid/sections/__ksymtab_strings deleted file mode 100644 index 717e054e14..0000000000 --- a/test/sys/module/usbhid/sections/__ksymtab_strings +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0201e78 diff --git a/test/sys/module/usbhid/sections/__param b/test/sys/module/usbhid/sections/__param deleted file mode 100644 index c6bc71c35f..0000000000 --- a/test/sys/module/usbhid/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0201de0 diff --git a/test/sys/module/usbhid/srcversion b/test/sys/module/usbhid/srcversion deleted file mode 100644 index 19fd49101a..0000000000 --- a/test/sys/module/usbhid/srcversion +++ /dev/null @@ -1 +0,0 @@ -3D7B82FE16E5E534DE4C12B diff --git a/test/sys/module/vt/parameters/default_blu b/test/sys/module/vt/parameters/default_blu deleted file mode 100644 index 71263b55b5..0000000000 --- a/test/sys/module/vt/parameters/default_blu +++ /dev/null @@ -1 +0,0 @@ -0,0,0,0,170,170,170,170,85,85,85,85,255,255,255,255 diff --git a/test/sys/module/vt/parameters/default_grn b/test/sys/module/vt/parameters/default_grn deleted file mode 100644 index d37237dad8..0000000000 --- a/test/sys/module/vt/parameters/default_grn +++ /dev/null @@ -1 +0,0 @@ -0,0,170,85,0,0,170,170,85,85,255,255,85,85,255,255 diff --git a/test/sys/module/vt/parameters/default_red b/test/sys/module/vt/parameters/default_red deleted file mode 100644 index d53982982c..0000000000 --- a/test/sys/module/vt/parameters/default_red +++ /dev/null @@ -1 +0,0 @@ -0,170,0,170,0,170,0,170,85,255,85,255,85,255,85,255 diff --git a/test/sys/module/vt/parameters/default_utf8 b/test/sys/module/vt/parameters/default_utf8 deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/vt/parameters/default_utf8 +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/vt/parameters/italic b/test/sys/module/vt/parameters/italic deleted file mode 100644 index 0cfbf08886..0000000000 --- a/test/sys/module/vt/parameters/italic +++ /dev/null @@ -1 +0,0 @@ -2 diff --git a/test/sys/module/vt/parameters/underline b/test/sys/module/vt/parameters/underline deleted file mode 100644 index 00750edc07..0000000000 --- a/test/sys/module/vt/parameters/underline +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/sys/module/yenta_socket/drivers/pci:yenta_cardbus b/test/sys/module/yenta_socket/drivers/pci:yenta_cardbus deleted file mode 120000 index 8cc0e37a53..0000000000 --- a/test/sys/module/yenta_socket/drivers/pci:yenta_cardbus +++ /dev/null @@ -1 +0,0 @@ -../../../bus/pci/drivers/yenta_cardbus \ No newline at end of file diff --git a/test/sys/module/yenta_socket/initstate b/test/sys/module/yenta_socket/initstate deleted file mode 100644 index e23fe645b7..0000000000 --- a/test/sys/module/yenta_socket/initstate +++ /dev/null @@ -1 +0,0 @@ -live diff --git a/test/sys/module/yenta_socket/notes/.note.gnu.build-id b/test/sys/module/yenta_socket/notes/.note.gnu.build-id deleted file mode 100644 index b7f1fa8fef..0000000000 Binary files a/test/sys/module/yenta_socket/notes/.note.gnu.build-id and /dev/null differ diff --git a/test/sys/module/yenta_socket/parameters/disable_clkrun b/test/sys/module/yenta_socket/parameters/disable_clkrun deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/yenta_socket/parameters/disable_clkrun +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/yenta_socket/parameters/isa_probe b/test/sys/module/yenta_socket/parameters/isa_probe deleted file mode 100644 index 9bda8c35c2..0000000000 --- a/test/sys/module/yenta_socket/parameters/isa_probe +++ /dev/null @@ -1 +0,0 @@ -Y diff --git a/test/sys/module/yenta_socket/parameters/pwr_irqs_off b/test/sys/module/yenta_socket/parameters/pwr_irqs_off deleted file mode 100644 index d52e798775..0000000000 --- a/test/sys/module/yenta_socket/parameters/pwr_irqs_off +++ /dev/null @@ -1 +0,0 @@ -N diff --git a/test/sys/module/yenta_socket/refcnt b/test/sys/module/yenta_socket/refcnt deleted file mode 100644 index d00491fd7e..0000000000 --- a/test/sys/module/yenta_socket/refcnt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/sys/module/yenta_socket/sections/.bss b/test/sys/module/yenta_socket/sections/.bss deleted file mode 100644 index 4778184bfd..0000000000 --- a/test/sys/module/yenta_socket/sections/.bss +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0107800 diff --git a/test/sys/module/yenta_socket/sections/.data b/test/sys/module/yenta_socket/sections/.data deleted file mode 100644 index 7c066485c3..0000000000 --- a/test/sys/module/yenta_socket/sections/.data +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0106ac0 diff --git a/test/sys/module/yenta_socket/sections/.devinit.text b/test/sys/module/yenta_socket/sections/.devinit.text deleted file mode 100644 index 67594d9569..0000000000 --- a/test/sys/module/yenta_socket/sections/.devinit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0103c60 diff --git a/test/sys/module/yenta_socket/sections/.exit.text b/test/sys/module/yenta_socket/sections/.exit.text deleted file mode 100644 index 98704b1032..0000000000 --- a/test/sys/module/yenta_socket/sections/.exit.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0103c44 diff --git a/test/sys/module/yenta_socket/sections/.gnu.linkonce.this_module b/test/sys/module/yenta_socket/sections/.gnu.linkonce.this_module deleted file mode 100644 index 23cd2ee6c2..0000000000 --- a/test/sys/module/yenta_socket/sections/.gnu.linkonce.this_module +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0107440 diff --git a/test/sys/module/yenta_socket/sections/.init.text b/test/sys/module/yenta_socket/sections/.init.text deleted file mode 100644 index 9da5e610a8..0000000000 --- a/test/sys/module/yenta_socket/sections/.init.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0084000 diff --git a/test/sys/module/yenta_socket/sections/.note.gnu.build-id b/test/sys/module/yenta_socket/sections/.note.gnu.build-id deleted file mode 100644 index 6714b3839d..0000000000 --- a/test/sys/module/yenta_socket/sections/.note.gnu.build-id +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0104330 diff --git a/test/sys/module/yenta_socket/sections/.rodata b/test/sys/module/yenta_socket/sections/.rodata deleted file mode 100644 index ca2a85e3ed..0000000000 --- a/test/sys/module/yenta_socket/sections/.rodata +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0104354 diff --git a/test/sys/module/yenta_socket/sections/.rodata.str1.1 b/test/sys/module/yenta_socket/sections/.rodata.str1.1 deleted file mode 100644 index dc50845825..0000000000 --- a/test/sys/module/yenta_socket/sections/.rodata.str1.1 +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0104388 diff --git a/test/sys/module/yenta_socket/sections/.strtab b/test/sys/module/yenta_socket/sections/.strtab deleted file mode 100644 index 704fd08f39..0000000000 --- a/test/sys/module/yenta_socket/sections/.strtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0105e80 diff --git a/test/sys/module/yenta_socket/sections/.symtab b/test/sys/module/yenta_socket/sections/.symtab deleted file mode 100644 index 79e56583e4..0000000000 --- a/test/sys/module/yenta_socket/sections/.symtab +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0104b78 diff --git a/test/sys/module/yenta_socket/sections/.text b/test/sys/module/yenta_socket/sections/.text deleted file mode 100644 index e857ebdb62..0000000000 --- a/test/sys/module/yenta_socket/sections/.text +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0101000 diff --git a/test/sys/module/yenta_socket/sections/__bug_table b/test/sys/module/yenta_socket/sections/__bug_table deleted file mode 100644 index bb16e1420d..0000000000 --- a/test/sys/module/yenta_socket/sections/__bug_table +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0104aa6 diff --git a/test/sys/module/yenta_socket/sections/__param b/test/sys/module/yenta_socket/sections/__param deleted file mode 100644 index 3e87072863..0000000000 --- a/test/sys/module/yenta_socket/sections/__param +++ /dev/null @@ -1 +0,0 @@ -0xffffffffa0104ad8 diff --git a/test/sys/module/yenta_socket/srcversion b/test/sys/module/yenta_socket/srcversion deleted file mode 100644 index 43d40e3ba7..0000000000 --- a/test/sys/module/yenta_socket/srcversion +++ /dev/null @@ -1 +0,0 @@ -B0538CB6E6ED071E80A4575 diff --git a/test/sys/power/state b/test/sys/power/state deleted file mode 100644 index 9f5c0b2a82..0000000000 --- a/test/sys/power/state +++ /dev/null @@ -1 +0,0 @@ -mem diff --git a/test/udev-test.pl b/test/udev-test.pl new file mode 100755 index 0000000000..999c1f76e3 --- /dev/null +++ b/test/udev-test.pl @@ -0,0 +1,1560 @@ +#!/usr/bin/perl + +# udev test +# +# Provides automated testing of the udev binary. +# The whole test is self contained in this file, except the matching sysfs tree. +# Simply extend the @tests array, to add a new test variant. +# +# Every test is driven by its own temporary config file. +# This program prepares the environment, creates the config and calls udev. +# +# udev parses the rules, looks at the provided sysfs and +# first creates and then removes the device node. +# After creation and removal the result is checked against the +# expected value and the result is printed. +# +# Copyright (C) 2004-2011 Kay Sievers +# Copyright (C) 2004 Leann Ogasawara + +use warnings; +use strict; + +my $PWD = $ENV{PWD}; +my $sysfs = "test/sys"; +my $udev_bin = "src/test-udev"; +my $valgrind = 0; +my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; +my $udev_root = "udev-root"; +my $udev_conf = "udev-test.conf"; +my $udev_rules = "udev-test.rules"; + +my @tests = ( + { + desc => "no rules", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda" , + exp_rem_error => "yes", + rules => < "label test of scsi disc", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi disc", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi disc", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi partition", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "label test of pattern match", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "label test of multiple sysfs files", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "label test of max sysfs files (skip invalid rule)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "catch device by *", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "catch device by * - take 2", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "catch device by ?", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "catch device by character class", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "replace kernel name", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle comment lines in config file (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle comment lines in config file with whitespace (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle whitespace only lines (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "whitespace" , + rules => < "Handle empty lines in config file (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle backslashed multi lines in config file (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "preserve backslashes, if they are not for a newline", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "aaa", + rules => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "subdirectory handling", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "sub/direct/ory/modem" , + rules => < "parent device name match of scsi partition", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "first_disk5" , + rules => < "test substitution chars", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , + rules => < "import of shell-value file", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "subdir/err/node" , + rules => < "import of shell-value returned from program", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node12345678", + rules => < "sustitution of sysfs value (%s{file})", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "disk-ATA-sda" , + rules => < "program result substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "special-device-5" , + not_exp_name => "not" , + rules => < "program result substitution (newline removal)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "newline_removed" , + rules => < "program result substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "test-0:0:0:0" , + rules => < "program with lots of arguments", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "foo9" , + rules => < "program with subshell", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "bar9" , + rules => < "program arguments combined with apostrophes", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "foo7" , + rules => < "characters before the %c{N} substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "my-foo9" , + rules => < "substitute the second to last argument", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "my-foo8" , + rules => < "test substitution by variable name", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", + rules => < "test substitution by variable name 2", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", + rules => < "test substitution by variable name 3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "850:0:0:05" , + rules => < "test substitution by variable name 4", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "855" , + rules => < "test substitution by variable name 5", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "8550:0:0:0" , + rules => < "non matching SUBSYSTEMS for device with no parent", + devpath => "/devices/virtual/tty/console", + exp_name => "TTY", + rules => < "non matching SUBSYSTEMS", + devpath => "/devices/virtual/tty/console", + exp_name => "TTY" , + rules => < "ATTRS match", + devpath => "/devices/virtual/tty/console", + exp_name => "foo" , + rules => < "ATTR (empty file)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "empty" , + rules => < "ATTR (non-existent file)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "non-existent" , + rules => < "program and bus type match", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0" , + rules => < "sysfs parent hierarchy", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "name test with ! in the name", + devpath => "/devices/virtual/block/fake!blockdev0", + exp_name => "is/a/fake/blockdev0" , + rules => < "name test with ! in the name, but no matching rule", + devpath => "/devices/virtual/block/fake!blockdev0", + exp_name => "fake/blockdev0" , + exp_rem_error => "yes", + rules => < "KERNELS rule", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "KERNELS wildcard all", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "KERNELS wildcard partial", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "KERNELS wildcard partial 2", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "substitute attr with link target value (first match)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "driver-is-sd", + rules => < "substitute attr with link target value (currently selected device)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "driver-is-ahci", + rules => < "ignore ATTRS attribute whitespace", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ignored", + rules => < "do not ignore ATTRS attribute whitespace", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "matched-with-space", + rules => < "permissions USER=bad GROUP=name", + devpath => "/devices/virtual/tty/tty33", + exp_name => "tty33", + exp_perms => "0:0:0600", + rules => < "permissions OWNER=5000", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "5000::0600", + rules => < "permissions GROUP=100", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => ":100:0660", + rules => < "textual user id", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "nobody::0600", + rules => < "textual group id", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => ":daemon:0660", + rules => < "textual user/group id", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "root:mail:0660", + rules => < "permissions MODE=0777", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "::0777", + rules => < "permissions OWNER=5000 GROUP=100 MODE=0777", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "5000:100:0777", + rules => < "permissions OWNER to 5000", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "5000::", + rules => < "permissions GROUP to 100", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => ":100:0660", + rules => < "permissions MODE to 0060", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "::0060", + rules => < "permissions OWNER, GROUP, MODE", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "5000:100:0777", + rules => < "permissions only rule", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "5000:100:0777", + rules => < "multiple permissions only rule", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "3000:4000:0777", + rules => < "permissions only rule with override at SYMLINK+ rule", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "3000:8000:0777", + rules => < "major/minor number test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_majorminor => "8:0", + rules => < "big major number test", + devpath => "/devices/virtual/misc/misc-fake1", + exp_name => "node", + exp_majorminor => "4095:1", + rules => < "big major and big minor number test", + devpath => "/devices/virtual/misc/misc-fake89999", + exp_name => "node", + exp_majorminor => "4095:89999", + rules => < "multiple symlinks with format char", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "symlink2-ttyACM0", + rules => < "multiple symlinks with a lot of s p a c e s", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "one", + not_exp_name => " ", + rules => < "symlink creation (same directory)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem0", + rules => < "multiple symlinks", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "second-0" , + rules => < "symlink name '.'", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => ".", + exp_add_error => "yes", + exp_rem_error => "yes", + rules => < "symlink node to itself", + devpath => "/devices/virtual/tty/tty0", + exp_name => "link", + exp_add_error => "yes", + exp_rem_error => "yes", + option => "clean", + rules => < "symlink %n substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "symlink0", + rules => < "symlink %k substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "symlink-ttyACM0", + rules => < "symlink %M:%m substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "major-166:0", + rules => < "symlink %b substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "symlink-0:0:0:0", + rules => < "symlink %c substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "test", + rules => < "symlink %c{N} substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "test", + rules => < "symlink %c{N+} substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "this", + rules => < "symlink only rule with %c{N+}", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "test", + rules => < "symlink %s{filename} substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "166:0", + rules => < "program result substitution (numbered part of)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "link1", + rules => < "program result substitution (numbered part of+)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "link4", + rules => < "SUBSYSTEM match test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + rules => < "DRIVERS match test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + rules => < "devnode substitution test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + rules => < "parent node name substitution test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "sda-part-1", + rules => < "udev_root substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "start-udev-root-end", + rules => < "last_rule option", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "last", + rules => < "negation KERNEL!=", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "match", + rules => < "negation SUBSYSTEM!=", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "not-anything", + rules => < "negation PROGRAM!= exit code", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "nonzero-program", + rules => < "test for whitespace between the operator", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign 2 times)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign2)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "part", + rules => < "untrusted string sanitize", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "sane", + rules => < "untrusted string sanitize (don't replace utf8)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "uber", + rules => < "untrusted string sanitize (replace invalid utf8)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "replaced", + rules => < "read sysfs value from parent device", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "serial-354172020305000", + rules => < "match against empty key string", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + rules => < "check ACTION value", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + rules => < "final assignment", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + exp_perms => "root:tty:0640", + rules => < "final assignment 2", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + exp_perms => "root:tty:0640", + rules => < "env substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node-add-me", + rules => < "reset list to current value", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "three", + not_exp_name => "two", + rules => < "test empty SYMLINK+ (empty override)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + not_exp_name => "wrong", + rules => < "test multi matches", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 2", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 3", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 4", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "IMPORT parent test sequence 1/2 (keep)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "parent", + option => "keep", + rules => < "IMPORT parent test sequence 2/2 (keep)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "parentenv-parent_right", + option => "clean", + rules => < "GOTO test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + rules => < "GOTO label does not exist", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + rules => < "SYMLINK+ compare test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + not_exp_name => "wrong", + rules => < "invalid key operation", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "yes", + rules => < "operator chars in attribute", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "yes", + rules => < "overlong comment line", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "yes", + rules => < "magic subsys/kernel lookup", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "00:16:41:e2:8d:ff", + rules => < "TEST absolute path", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "there", + rules => < "TEST subsys/kernel lookup", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "yes", + rules => < "TEST relative path", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "relative", + rules => < "TEST wildcard substitution (find queue/nr_requests)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "found-subdir", + rules => < "TEST MODE=0000", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda", + exp_perms => "0:0:0000", + exp_rem_error => "yes", + rules => < "TEST PROGRAM feeds OWNER, GROUP, MODE", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda", + exp_perms => "5000:100:0400", + exp_rem_error => "yes", + rules => < "TEST PROGRAM feeds MODE with overflow", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda", + exp_perms => "0:0:0440", + exp_rem_error => "yes", + rules => < "magic [subsys/sysname] attribute substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda-8741C4G-end", + exp_perms => "0:0:0600", + rules => < "builtin path_id", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0", + rules => <$udev_rules" || die "unable to create rules file: $udev_rules"; + print CONF $$rules; + close CONF; + + if ($valgrind > 0) { + system("$udev_bin_valgrind $action $devpath"); + } else { + system("$udev_bin $action $devpath"); + } +} + +my $error = 0; + +sub permissions_test { + my($rules, $uid, $gid, $mode) = @_; + + my $wrong = 0; + my $userid; + my $groupid; + + $rules->{exp_perms} =~ m/^(.*):(.*):(.*)$/; + if ($1 ne "") { + if (defined(getpwnam($1))) { + $userid = int(getpwnam($1)); + } else { + $userid = $1; + } + if ($uid != $userid) { $wrong = 1; } + } + if ($2 ne "") { + if (defined(getgrnam($2))) { + $groupid = int(getgrnam($2)); + } else { + $groupid = $2; + } + if ($gid != $groupid) { $wrong = 1; } + } + if ($3 ne "") { + if (($mode & 07777) != oct($3)) { $wrong = 1; }; + } + if ($wrong == 0) { + print "permissions: ok\n"; + } else { + printf " expected permissions are: %s:%s:%#o\n", $1, $2, oct($3); + printf " created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; + print "permissions: error\n"; + $error++; + sleep(1); + } +} + +sub major_minor_test { + my($rules, $rdev) = @_; + + my $major = ($rdev >> 8) & 0xfff; + my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); + my $wrong = 0; + + $rules->{exp_majorminor} =~ m/^(.*):(.*)$/; + if ($1 ne "") { + if ($major != $1) { $wrong = 1; }; + } + if ($2 ne "") { + if ($minor != $2) { $wrong = 1; }; + } + if ($wrong == 0) { + print "major:minor: ok\n"; + } else { + printf " expected major:minor is: %i:%i\n", $1, $2; + printf " created major:minor is : %i:%i\n", $major, $minor; + print "major:minor: error\n"; + $error++; + sleep(1); + } +} + +sub make_udev_root { + system("rm -rf $udev_root"); + mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; + # setting group and mode of udev_root ensures the tests work + # even if the parent directory has setgid bit enabled. + chown (0, 0, $udev_root) || die "unable to chown $udev_root\n"; + chmod (0755, $udev_root) || die "unable to chmod $udev_root\n"; +} + +sub run_test { + my ($rules, $number) = @_; + + print "TEST $number: $rules->{desc}\n"; + print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; + + udev("add", $rules->{devpath}, \$rules->{rules}); + if (defined($rules->{not_exp_name})) { + if ((-e "$PWD/$udev_root/$rules->{not_exp_name}") || + (-l "$PWD/$udev_root/$rules->{not_exp_name}")) { + print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; + $error++; + sleep(1); + } + } + + if ((-e "$PWD/$udev_root/$rules->{exp_name}") || + (-l "$PWD/$udev_root/$rules->{exp_name}")) { + + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root/$rules->{exp_name}"); + + if (defined($rules->{exp_perms})) { + permissions_test($rules, $uid, $gid, $mode); + } + if (defined($rules->{exp_majorminor})) { + major_minor_test($rules, $rdev); + } + print "add: ok\n"; + } else { + print "add: error"; + if ($rules->{exp_add_error}) { + print " as expected\n"; + } else { + print "\n"; + system("tree $udev_root"); + print "\n"; + $error++; + sleep(1); + } + } + + if (defined($rules->{option}) && $rules->{option} eq "keep") { + print "\n\n"; + return; + } + + udev("remove", $rules->{devpath}, \$rules->{rules}); + if ((-e "$PWD/$udev_root/$rules->{exp_name}") || + (-l "$PWD/$udev_root/$rules->{exp_name}")) { + print "remove: error"; + if ($rules->{exp_rem_error}) { + print " as expected\n"; + } else { + print "\n"; + system("tree $udev_root"); + print "\n"; + $error++; + sleep(1); + } + } else { + print "remove: ok\n"; + } + + print "\n"; + + if (defined($rules->{option}) && $rules->{option} eq "clean") { + make_udev_root (); + } + +} + +# only run if we have root permissions +# due to mknod restrictions +if (!($<==0)) { + print "Must have root permissions to run properly.\n"; + exit; +} + +# prepare +make_udev_root(); + +# create config file +open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; +print CONF "udev_root=\"$udev_root\"\n"; +print CONF "udev_run=\"$udev_root/.udev\"\n"; +print CONF "udev_sys=\"$sysfs\"\n"; +print CONF "udev_rules=\"$PWD\"\n"; +print CONF "udev_log=\"err\"\n"; +close CONF; + +my $test_num = 1; +my @list; + +foreach my $arg (@ARGV) { + if ($arg =~ m/--valgrind/) { + $valgrind = 1; + printf("using valgrind\n"); + } else { + push(@list, $arg); + } +} + +if ($list[0]) { + foreach my $arg (@list) { + if (defined($tests[$arg-1]->{desc})) { + print "udev-test will run test number $arg:\n\n"; + run_test($tests[$arg-1], $arg); + } else { + print "test does not exist.\n"; + } + } +} else { + # test all + print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; + + foreach my $rules (@tests) { + run_test($rules, $test_num); + $test_num++; + } +} + +print "$error errors occured\n\n"; + +# cleanup +system("rm -rf $udev_root"); +unlink($udev_rules); +unlink($udev_conf); + +if ($error > 0) { + exit(1); +} +exit(0); diff --git a/test/udev-test.pl.in b/test/udev-test.pl.in deleted file mode 100755 index 6c5eeee762..0000000000 --- a/test/udev-test.pl.in +++ /dev/null @@ -1,1560 +0,0 @@ -#!/usr/bin/perl - -# udev test -# -# Provides automated testing of the udev binary. -# The whole test is self contained in this file, except the matching sysfs tree. -# Simply extend the @tests array, to add a new test variant. -# -# Every test is driven by its own temporary config file. -# This program prepares the environment, creates the config and calls udev. -# -# udev parses the rules, looks at the provided sysfs and -# first creates and then removes the device node. -# After creation and removal the result is checked against the -# expected value and the result is printed. -# -# Copyright (C) 2004-2011 Kay Sievers -# Copyright (C) 2004 Leann Ogasawara - -use warnings; -use strict; - -my $PWD = $ENV{PWD}; -my $sysfs = "test/sys/"; -my $udev_bin = "src/test-udev"; -my $valgrind = 0; -my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; -my $udev_root = "udev-root"; -my $udev_conf = "udev-test.conf"; -my $udev_rules = "udev-test.rules"; - -my @tests = ( - { - desc => "no rules", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda" , - exp_rem_error => "yes", - rules => < "label test of scsi disc", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , - rules => < "label test of scsi disc", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , - rules => < "label test of scsi disc", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , - rules => < "label test of scsi partition", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of pattern match", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of multiple sysfs files", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of max sysfs files (skip invalid rule)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "catch device by *", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by * - take 2", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by ?", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by character class", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "replace kernel name", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle comment lines in config file (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle comment lines in config file with whitespace (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle whitespace only lines (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "whitespace" , - rules => < "Handle empty lines in config file (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle backslashed multi lines in config file (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "preserve backslashes, if they are not for a newline", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "aaa", - rules => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "subdirectory handling", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "sub/direct/ory/modem" , - rules => < "parent device name match of scsi partition", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "first_disk5" , - rules => < "test substitution chars", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , - rules => < "import of shell-value file", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "subdir/err/node" , - rules => < "import of shell-value returned from program", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node12345678", - rules => < "sustitution of sysfs value (%s{file})", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "disk-ATA-sda" , - rules => < "program result substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "special-device-5" , - not_exp_name => "not" , - rules => < "program result substitution (newline removal)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "newline_removed" , - rules => < "program result substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "test-0:0:0:0" , - rules => < "program with lots of arguments", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo9" , - rules => < "program with subshell", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "bar9" , - rules => < "program arguments combined with apostrophes", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo7" , - rules => < "characters before the %c{N} substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "my-foo9" , - rules => < "substitute the second to last argument", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "my-foo8" , - rules => < "test substitution by variable name", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", - rules => < "test substitution by variable name 2", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", - rules => < "test substitution by variable name 3", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "850:0:0:05" , - rules => < "test substitution by variable name 4", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "855" , - rules => < "test substitution by variable name 5", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "8550:0:0:0" , - rules => < "non matching SUBSYSTEMS for device with no parent", - devpath => "/devices/virtual/tty/console", - exp_name => "TTY", - rules => < "non matching SUBSYSTEMS", - devpath => "/devices/virtual/tty/console", - exp_name => "TTY" , - rules => < "ATTRS match", - devpath => "/devices/virtual/tty/console", - exp_name => "foo" , - rules => < "ATTR (empty file)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "empty" , - rules => < "ATTR (non-existent file)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "non-existent" , - rules => < "program and bus type match", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0" , - rules => < "sysfs parent hierarchy", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "name test with ! in the name", - devpath => "/devices/virtual/block/fake!blockdev0", - exp_name => "is/a/fake/blockdev0" , - rules => < "name test with ! in the name, but no matching rule", - devpath => "/devices/virtual/block/fake!blockdev0", - exp_name => "fake/blockdev0" , - exp_rem_error => "yes", - rules => < "KERNELS rule", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS wildcard all", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS wildcard partial", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS wildcard partial 2", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "substitute attr with link target value (first match)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "driver-is-sd", - rules => < "substitute attr with link target value (currently selected device)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "driver-is-ahci", - rules => < "ignore ATTRS attribute whitespace", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ignored", - rules => < "do not ignore ATTRS attribute whitespace", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "matched-with-space", - rules => < "permissions USER=bad GROUP=name", - devpath => "/devices/virtual/tty/tty33", - exp_name => "tty33", - exp_perms => "0:0:0600", - rules => < "permissions OWNER=5000", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "5000::0600", - rules => < "permissions GROUP=100", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => ":100:0660", - rules => < "textual user id", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "nobody::0600", - rules => < "textual group id", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => ":daemon:0660", - rules => < "textual user/group id", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "root:mail:0660", - rules => < "permissions MODE=0777", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "::0777", - rules => < "permissions OWNER=5000 GROUP=100 MODE=0777", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "5000:100:0777", - rules => < "permissions OWNER to 5000", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "5000::", - rules => < "permissions GROUP to 100", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => ":100:0660", - rules => < "permissions MODE to 0060", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "::0060", - rules => < "permissions OWNER, GROUP, MODE", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "5000:100:0777", - rules => < "permissions only rule", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "5000:100:0777", - rules => < "multiple permissions only rule", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "3000:4000:0777", - rules => < "permissions only rule with override at SYMLINK+ rule", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "3000:8000:0777", - rules => < "major/minor number test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_majorminor => "8:0", - rules => < "big major number test", - devpath => "/devices/virtual/misc/misc-fake1", - exp_name => "node", - exp_majorminor => "4095:1", - rules => < "big major and big minor number test", - devpath => "/devices/virtual/misc/misc-fake89999", - exp_name => "node", - exp_majorminor => "4095:89999", - rules => < "multiple symlinks with format char", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "symlink2-ttyACM0", - rules => < "multiple symlinks with a lot of s p a c e s", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "one", - not_exp_name => " ", - rules => < "symlink creation (same directory)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem0", - rules => < "multiple symlinks", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "second-0" , - rules => < "symlink name '.'", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => ".", - exp_add_error => "yes", - exp_rem_error => "yes", - rules => < "symlink node to itself", - devpath => "/devices/virtual/tty/tty0", - exp_name => "link", - exp_add_error => "yes", - exp_rem_error => "yes", - option => "clean", - rules => < "symlink %n substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "symlink0", - rules => < "symlink %k substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "symlink-ttyACM0", - rules => < "symlink %M:%m substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "major-166:0", - rules => < "symlink %b substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "symlink-0:0:0:0", - rules => < "symlink %c substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "test", - rules => < "symlink %c{N} substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "test", - rules => < "symlink %c{N+} substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "this", - rules => < "symlink only rule with %c{N+}", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "test", - rules => < "symlink %s{filename} substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "166:0", - rules => < "program result substitution (numbered part of)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "link1", - rules => < "program result substitution (numbered part of+)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "link4", - rules => < "SUBSYSTEM match test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - rules => < "DRIVERS match test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - rules => < "devnode substitution test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - rules => < "parent node name substitution test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "sda-part-1", - rules => < "udev_root substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "start-udev-root-end", - rules => < "last_rule option", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "last", - rules => < "negation KERNEL!=", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "match", - rules => < "negation SUBSYSTEM!=", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "not-anything", - rules => < "negation PROGRAM!= exit code", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "nonzero-program", - rules => < "test for whitespace between the operator", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test (assign)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test (assign 2 times)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test (assign2)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "part", - rules => < "untrusted string sanitize", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "sane", - rules => < "untrusted string sanitize (don't replace utf8)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "uber", - rules => < "untrusted string sanitize (replace invalid utf8)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "replaced", - rules => < "read sysfs value from parent device", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "serial-354172020305000", - rules => < "match against empty key string", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - rules => < "check ACTION value", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - rules => < "final assignment", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - exp_perms => "root:tty:0640", - rules => < "final assignment 2", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - exp_perms => "root:tty:0640", - rules => < "env substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node-add-me", - rules => < "reset list to current value", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "three", - not_exp_name => "two", - rules => < "test empty SYMLINK+ (empty override)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - not_exp_name => "wrong", - rules => < "test multi matches", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches 2", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches 3", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches 4", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "IMPORT parent test sequence 1/2 (keep)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "parent", - option => "keep", - rules => < "IMPORT parent test sequence 2/2 (keep)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "parentenv-parent_right", - option => "clean", - rules => < "GOTO test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "right", - rules => < "GOTO label does not exist", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "right", - rules => < "SYMLINK+ compare test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "right", - not_exp_name => "wrong", - rules => < "invalid key operation", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "yes", - rules => < "operator chars in attribute", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "yes", - rules => < "overlong comment line", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "yes", - rules => < "magic subsys/kernel lookup", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "00:16:41:e2:8d:ff", - rules => < "TEST absolute path", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "there", - rules => < "TEST subsys/kernel lookup", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "yes", - rules => < "TEST relative path", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "relative", - rules => < "TEST wildcard substitution (find queue/nr_requests)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "found-subdir", - rules => < "TEST MODE=0000", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - exp_perms => "0:0:0000", - exp_rem_error => "yes", - rules => < "TEST PROGRAM feeds OWNER, GROUP, MODE", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - exp_perms => "5000:100:0400", - exp_rem_error => "yes", - rules => < "TEST PROGRAM feeds MODE with overflow", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - exp_perms => "0:0:0440", - exp_rem_error => "yes", - rules => < "magic [subsys/sysname] attribute substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda-8741C4G-end", - exp_perms => "0:0:0600", - rules => < "builtin path_id", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0", - rules => <$udev_rules" || die "unable to create rules file: $udev_rules"; - print CONF $$rules; - close CONF; - - if ($valgrind > 0) { - system("$udev_bin_valgrind $action $devpath"); - } else { - system("$udev_bin $action $devpath"); - } -} - -my $error = 0; - -sub permissions_test { - my($rules, $uid, $gid, $mode) = @_; - - my $wrong = 0; - my $userid; - my $groupid; - - $rules->{exp_perms} =~ m/^(.*):(.*):(.*)$/; - if ($1 ne "") { - if (defined(getpwnam($1))) { - $userid = int(getpwnam($1)); - } else { - $userid = $1; - } - if ($uid != $userid) { $wrong = 1; } - } - if ($2 ne "") { - if (defined(getgrnam($2))) { - $groupid = int(getgrnam($2)); - } else { - $groupid = $2; - } - if ($gid != $groupid) { $wrong = 1; } - } - if ($3 ne "") { - if (($mode & 07777) != oct($3)) { $wrong = 1; }; - } - if ($wrong == 0) { - print "permissions: ok\n"; - } else { - printf " expected permissions are: %s:%s:%#o\n", $1, $2, oct($3); - printf " created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; - print "permissions: error\n"; - $error++; - sleep(1); - } -} - -sub major_minor_test { - my($rules, $rdev) = @_; - - my $major = ($rdev >> 8) & 0xfff; - my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); - my $wrong = 0; - - $rules->{exp_majorminor} =~ m/^(.*):(.*)$/; - if ($1 ne "") { - if ($major != $1) { $wrong = 1; }; - } - if ($2 ne "") { - if ($minor != $2) { $wrong = 1; }; - } - if ($wrong == 0) { - print "major:minor: ok\n"; - } else { - printf " expected major:minor is: %i:%i\n", $1, $2; - printf " created major:minor is : %i:%i\n", $major, $minor; - print "major:minor: error\n"; - $error++; - sleep(1); - } -} - -sub make_udev_root { - system("rm -rf $udev_root"); - mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; - # setting group and mode of udev_root ensures the tests work - # even if the parent directory has setgid bit enabled. - chown (0, 0, $udev_root) || die "unable to chown $udev_root\n"; - chmod (0755, $udev_root) || die "unable to chmod $udev_root\n"; -} - -sub run_test { - my ($rules, $number) = @_; - - print "TEST $number: $rules->{desc}\n"; - print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; - - udev("add", $rules->{devpath}, \$rules->{rules}); - if (defined($rules->{not_exp_name})) { - if ((-e "$PWD/$udev_root/$rules->{not_exp_name}") || - (-l "$PWD/$udev_root/$rules->{not_exp_name}")) { - print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; - $error++; - sleep(1); - } - } - - if ((-e "$PWD/$udev_root/$rules->{exp_name}") || - (-l "$PWD/$udev_root/$rules->{exp_name}")) { - - my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, - $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root/$rules->{exp_name}"); - - if (defined($rules->{exp_perms})) { - permissions_test($rules, $uid, $gid, $mode); - } - if (defined($rules->{exp_majorminor})) { - major_minor_test($rules, $rdev); - } - print "add: ok\n"; - } else { - print "add: error"; - if ($rules->{exp_add_error}) { - print " as expected\n"; - } else { - print "\n"; - system("tree $udev_root"); - print "\n"; - $error++; - sleep(1); - } - } - - if (defined($rules->{option}) && $rules->{option} eq "keep") { - print "\n\n"; - return; - } - - udev("remove", $rules->{devpath}, \$rules->{rules}); - if ((-e "$PWD/$udev_root/$rules->{exp_name}") || - (-l "$PWD/$udev_root/$rules->{exp_name}")) { - print "remove: error"; - if ($rules->{exp_rem_error}) { - print " as expected\n"; - } else { - print "\n"; - system("tree $udev_root"); - print "\n"; - $error++; - sleep(1); - } - } else { - print "remove: ok\n"; - } - - print "\n"; - - if (defined($rules->{option}) && $rules->{option} eq "clean") { - make_udev_root (); - } - -} - -# only run if we have root permissions -# due to mknod restrictions -if (!($<==0)) { - print "Must have root permissions to run properly.\n"; - exit; -} - -# prepare -make_udev_root(); - -# create config file -open CONF, ">$udev_conf" || die "unable to create config file: $udev_conf"; -print CONF "udev_root=\"$udev_root\"\n"; -print CONF "udev_run=\"$udev_root/.udev\"\n"; -print CONF "udev_sys=\"$sysfs\"\n"; -print CONF "udev_rules=\"$PWD\"\n"; -print CONF "udev_log=\"err\"\n"; -close CONF; - -my $test_num = 1; -my @list; - -foreach my $arg (@ARGV) { - if ($arg =~ m/--valgrind/) { - $valgrind = 1; - printf("using valgrind\n"); - } else { - push(@list, $arg); - } -} - -if ($list[0]) { - foreach my $arg (@list) { - if (defined($tests[$arg-1]->{desc})) { - print "udev-test will run test number $arg:\n\n"; - run_test($tests[$arg-1], $arg); - } else { - print "test does not exist.\n"; - } - } -} else { - # test all - print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; - - foreach my $rules (@tests) { - run_test($rules, $test_num); - $test_num++; - } -} - -print "$error errors occured\n\n"; - -# cleanup -system("rm -rf $udev_root"); -unlink($udev_rules); -unlink($udev_conf); - -if ($error > 0) { - exit(1); -} -exit(0); -- cgit v1.2.3-54-g00ecf From 32740a39b5de3f53be73254008167cd24030c156 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 9 Jan 2012 16:00:00 +0100 Subject: rules: delete arch specific rules --- rules/arch/40-ia64.rules | 4 ---- rules/arch/40-ppc.rules | 6 ------ 2 files changed, 10 deletions(-) delete mode 100644 rules/arch/40-ia64.rules delete mode 100644 rules/arch/40-ppc.rules diff --git a/rules/arch/40-ia64.rules b/rules/arch/40-ia64.rules deleted file mode 100644 index 5846f88b1b..0000000000 --- a/rules/arch/40-ia64.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="sgi_*", MODE="0666" - diff --git a/rules/arch/40-ppc.rules b/rules/arch/40-ppc.rules deleted file mode 100644 index a310d63993..0000000000 --- a/rules/arch/40-ppc.rules +++ /dev/null @@ -1,6 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="iseries/ibmsis*", GROUP="disk" -KERNEL=="iseries/nvt*", GROUP="disk" -KERNEL=="iseries/vt*", GROUP="disk" -KERNEL=="iseries/vtty*", GROUP="dialout" -- cgit v1.2.3-54-g00ecf From 1111415a7587a669f9958ef9406c42572e80ff2b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 9 Jan 2012 17:38:29 +0100 Subject: doc: fix out of tree build (copy from libkmod) --- src/docs/Makefile.am | 2 +- src/extras/gudev/docs/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/docs/Makefile.am b/src/docs/Makefile.am index 3b280d87a7..07d06eb14f 100644 --- a/src/docs/Makefile.am +++ b/src/docs/Makefile.am @@ -21,7 +21,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml # gtk-doc will search all .c & .h files beneath here for inline comments # documenting the functions and macros. # e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR=.. +DOC_SOURCE_DIR=$(top_srcdir)/src # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS= diff --git a/src/extras/gudev/docs/Makefile.am b/src/extras/gudev/docs/Makefile.am index d03fc65127..65e69975b5 100644 --- a/src/extras/gudev/docs/Makefile.am +++ b/src/extras/gudev/docs/Makefile.am @@ -21,7 +21,7 @@ DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml # gtk-doc will search all .c & .h files beneath here for inline comments # documenting the functions and macros. # e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR=.. +DOC_SOURCE_DIR=$(top_srcdir)/src # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS= -- cgit v1.2.3-54-g00ecf From 6a6b254354ecb71e67be5fdb87e869adf075c6f6 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Tue, 27 Dec 2011 17:45:24 -0200 Subject: builtin: kmod - log if modules are blacklisted --- src/udev-builtin-kmod.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/udev-builtin-kmod.c b/src/udev-builtin-kmod.c index 6719432c08..68536f17ff 100644 --- a/src/udev-builtin-kmod.c +++ b/src/udev-builtin-kmod.c @@ -50,6 +50,8 @@ static int load_module(struct udev *udev, const char *alias) if (list == NULL) info(udev, "no module matches '%s'\n", alias); + else if (listb == NULL) + info(udev, "modules matching '%s' are blacklisted\n", alias); kmod_list_foreach(l, listb) { struct kmod_module *mod = kmod_module_get_module(l); -- cgit v1.2.3-54-g00ecf From c59d1e45bd50ab36e2ac09f0c4b36d38821f20f5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 9 Jan 2012 23:17:56 +0100 Subject: autogen.sh: add CFLAGS and print entire line, so that mouse copy/paste works --- autogen.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/autogen.sh b/autogen.sh index 582a8a3af4..d32f41df9b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh set -e @@ -28,9 +28,9 @@ args="\ --enable-gtk-doc" echo -echo "---------------------------------------------------------------------" -echo "Initialized udev build system. For a common configuration please run:" -echo "---------------------------------------------------------------------" +echo "----------------------------------------------------------------" +echo "Initialized build system. For a common configuration please run:" +echo "----------------------------------------------------------------" echo -echo "# ./configure $args" +echo "./configure CFLAGS='-g -O0' $args" echo -- cgit v1.2.3-54-g00ecf From 9e4e44e578ec8ba2c626abed4eb8529814557352 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 9 Jan 2012 23:44:47 +0100 Subject: build-sys: try to build without installed xsltproc --- Makefile.am | 5 ++++- configure.ac | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 06500b068b..46f923ea90 100644 --- a/Makefile.am +++ b/Makefile.am @@ -42,6 +42,7 @@ udevhomedir = $(libexecdir)/udev udevhome_SCRIPTS = dist_udevhome_SCRIPTS = dist_udevhome_DATA = +dist_man_MANS = SED_PROCESS = \ $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(SED) \ @@ -259,10 +260,11 @@ src_udevadm_CFLAGS = $(udev_common_CFLAGS) src_udevadm_LDADD = $(udev_common_LDADD) src_udevadm_CPPFLAGS = $(udev_common_CPPFLAGS) +if HAVE_XSLTPROC # ------------------------------------------------------------------------------ # udev man pages # ------------------------------------------------------------------------------ -dist_man_MANS = \ +dist_man_MANS += \ src/udev.7 \ src/udevadm.8 \ src/udevd.8 @@ -282,6 +284,7 @@ src/%.7 src/%.8 : src/%.xml src/%.html : src/%.xml $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $< +endif # ------------------------------------------------------------------------------ # udev tests diff --git a/configure.ac b/configure.ac index 4ba9964cbd..07254feba0 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,9 @@ AC_PROG_SED AC_PROG_MKDIR_P GTK_DOC_CHECK(1.10) AC_PREFIX_DEFAULT([/usr]) + AC_PATH_PROG([XSLTPROC], [xsltproc]) +AM_CONDITIONAL(HAVE_XSLTPROC, test x"$XSLTPROC" != x) AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not found])]) -- cgit v1.2.3-54-g00ecf From ebda27438b66d179c4ba4ac74bbe20df2d57446e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 9 Jan 2012 23:47:00 +0100 Subject: add test/src to .gitignore --- test/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 test/.gitignore diff --git a/test/.gitignore b/test/.gitignore new file mode 100644 index 0000000000..98fa886530 --- /dev/null +++ b/test/.gitignore @@ -0,0 +1 @@ +/sys -- cgit v1.2.3-54-g00ecf From 912541b0246ef315d4d851237483b98c9dd3f992 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Jan 2012 01:34:15 +0100 Subject: tabs are as useful as a hole in the head --- COPYING | 14 +- autogen.sh | 12 +- configure.ac | 238 +- rules/arch/40-s390.rules | 2 +- rules/rules.d/50-udev-default.rules | 62 +- src/COPYING | 12 +- src/extras/accelerometer/accelerometer.c | 454 +- src/extras/ata_id/ata_id.c | 1210 ++--- src/extras/cdrom_id/cdrom_id.c | 1810 +++---- src/extras/collect/collect.c | 646 +-- src/extras/edd_id/edd_id.c | 296 +- src/extras/floppy/create_floppy_devices.c | 252 +- src/extras/gudev/COPYING | 12 +- src/extras/gudev/docs/Makefile.am | 12 +- src/extras/gudev/docs/gudev-docs.xml | 76 +- src/extras/gudev/gudevclient.c | 4 +- src/extras/keymap/check-keymaps.sh | 30 +- src/extras/keymap/findkeyboards | 75 +- src/extras/keymap/keyboard-force-release.sh.in | 18 +- src/extras/keymap/keymap.c | 670 +-- src/extras/keymap/keymaps/acer-aspire_5720 | 2 +- src/extras/keymap/keymaps/lenovo-ideapad | 12 +- src/extras/mtd_probe/mtd_probe.c | 34 +- src/extras/mtd_probe/mtd_probe.h | 24 +- src/extras/mtd_probe/probe_smartmedia.c | 90 +- src/extras/rule_generator/rule_generator.functions | 126 +- src/extras/rule_generator/write_cd_rules | 112 +- src/extras/rule_generator/write_net_rules | 102 +- src/extras/scsi_id/scsi.h | 58 +- src/extras/scsi_id/scsi_id.c | 1064 ++-- src/extras/scsi_id/scsi_id.h | 38 +- src/extras/scsi_id/scsi_serial.c | 1620 +++---- src/extras/udev-acl/udev-acl.c | 724 +-- src/extras/v4l_id/v4l_id.c | 92 +- src/libudev-device-private.c | 284 +- src/libudev-device.c | 2104 ++++---- src/libudev-enumerate.c | 1178 ++--- src/libudev-list.c | 384 +- src/libudev-monitor.c | 1162 ++--- src/libudev-private.h | 58 +- src/libudev-queue-private.c | 560 +-- src/libudev-queue.c | 532 +- src/libudev-selinux-private.c | 124 +- src/libudev-util-private.c | 376 +- src/libudev-util.c | 786 +-- src/libudev.c | 498 +- src/libudev.h | 18 +- src/test-libudev.c | 860 ++-- src/test-udev.c | 166 +- src/udev-builtin-blkid.c | 282 +- src/udev-builtin-firmware.c | 246 +- src/udev-builtin-hwdb.c | 286 +- src/udev-builtin-input_id.c | 304 +- src/udev-builtin-kmod.c | 162 +- src/udev-builtin-path_id.c | 768 +-- src/udev-builtin-usb_id.c | 812 ++-- src/udev-builtin.c | 130 +- src/udev-ctrl.c | 652 +-- src/udev-event.c | 1816 +++---- src/udev-node.c | 636 +-- src/udev-rules.c | 5116 ++++++++++---------- src/udev-watch.c | 204 +- src/udev.h | 108 +- src/udevadm-control.c | 250 +- src/udevadm-info.c | 990 ++-- src/udevadm-monitor.c | 488 +- src/udevadm-settle.c | 380 +- src/udevadm-test-builtin.c | 162 +- src/udevadm-test.c | 266 +- src/udevadm-trigger.c | 358 +- src/udevadm.c | 214 +- src/udevd.c | 2936 +++++------ test/rules-test.sh | 8 +- test/udev-test.pl | 2068 ++++---- 74 files changed, 19364 insertions(+), 19371 deletions(-) diff --git a/COPYING b/COPYING index d511905c16..d159169d10 100644 --- a/COPYING +++ b/COPYING @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it diff --git a/autogen.sh b/autogen.sh index d32f41df9b..697ed919d2 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,18 +1,16 @@ -#!/bin/sh - -set -e +#!/bin/sh -e if [ -f .git/hooks/pre-commit.sample -a ! -f .git/hooks/pre-commit ] ; then - cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \ - chmod +x .git/hooks/pre-commit && \ - echo "Activated pre-commit hook." + cp -p .git/hooks/pre-commit.sample .git/hooks/pre-commit && \ + chmod +x .git/hooks/pre-commit && \ + echo "Activated pre-commit hook." fi gtkdocize autoreconf --install --symlink libdir() { - echo $(cd $1/$(gcc -print-multi-os-directory); pwd) + echo $(cd $1/$(gcc -print-multi-os-directory); pwd) } args="\ diff --git a/configure.ac b/configure.ac index 07254feba0..035e5fa443 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,9 @@ AC_PREREQ(2.60) AC_INIT([udev], - [175], - [linux-hotplug@vger.kernel.org], - [udev], - [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) + [175], + [linux-hotplug@vger.kernel.org], + [udev], + [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) AC_CONFIG_SRCDIR([src/udevd.c]) AC_CONFIG_AUX_DIR([build-aux]) AM_INIT_AUTOMAKE([check-news foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects]) @@ -28,90 +28,90 @@ PKG_CHECK_MODULES(BLKID, blkid >= 2.20) PKG_CHECK_MODULES(KMOD, libkmod >= 3) if test "x$cross_compiling" = "xno" ; then - AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) - AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) - AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) + AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) + AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) + AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) fi AC_ARG_WITH(usb-ids-path, - [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])], - [USB_DATABASE=${withval}], - [if test -n "$usbids" ; then - USB_DATABASE="$usbids" - else - PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) - AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) - fi]) + [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])], + [USB_DATABASE=${withval}], + [if test -n "$usbids" ; then + USB_DATABASE="$usbids" + else + PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) + AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) + fi]) AC_MSG_CHECKING([for USB database location]) AC_MSG_RESULT([$USB_DATABASE]) AC_SUBST(USB_DATABASE) AC_ARG_WITH(pci-ids-path, - [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], - [PCI_DATABASE=${withval}], - [if test -n "$pciids" ; then - PCI_DATABASE="$pciids" - else - AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) - fi]) + [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], + [PCI_DATABASE=${withval}], + [if test -n "$pciids" ; then + PCI_DATABASE="$pciids" + else + AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) + fi]) AC_MSG_CHECKING([for PCI database location]) AC_MSG_RESULT([$PCI_DATABASE]) AC_SUBST(PCI_DATABASE) AC_ARG_WITH([rootprefix], - AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), - [], [with_rootprefix=${ac_default_prefix}]) + AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), + [], [with_rootprefix=${ac_default_prefix}]) AC_SUBST([rootprefix], [$with_rootprefix]) AC_ARG_WITH([rootlibdir], - AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), - [], [with_rootlibdir=$libdir]) + AS_HELP_STRING([--with-rootlibdir=DIR], [rootfs directory to install shared libraries]), + [], [with_rootlibdir=$libdir]) AC_SUBST([rootlib_execdir], [$with_rootlibdir]) AC_ARG_WITH([selinux], - AS_HELP_STRING([--with-selinux], [enable SELinux support]), - [], [with_selinux=no]) + AS_HELP_STRING([--with-selinux], [enable SELinux support]), + [], [with_selinux=no]) AS_IF([test "x$with_selinux" = "xyes"], [ - LIBS_save=$LIBS - AC_CHECK_LIB(selinux, getprevcon, - [], - AC_MSG_ERROR([SELinux selected but libselinux not found])) - LIBS=$LIBS_save - SELINUX_LIBS="-lselinux -lsepol" - AC_DEFINE(WITH_SELINUX, [1] ,[SELinux support.]) + LIBS_save=$LIBS + AC_CHECK_LIB(selinux, getprevcon, + [], + AC_MSG_ERROR([SELinux selected but libselinux not found])) + LIBS=$LIBS_save + SELINUX_LIBS="-lselinux -lsepol" + AC_DEFINE(WITH_SELINUX, [1] ,[SELinux support.]) ]) AC_SUBST([SELINUX_LIBS]) AM_CONDITIONAL(WITH_SELINUX, [test "x$with_selinux" = "xyes"]) AC_ARG_ENABLE([debug], - AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), - [], [enable_debug=no]) + AS_HELP_STRING([--enable-debug], [enable debug messages @<:@default=disabled@:>@]), + [], [enable_debug=no]) AS_IF([test "x$enable_debug" = "xyes"], [ AC_DEFINE(ENABLE_DEBUG, [1], [Debug messages.]) ]) AC_ARG_ENABLE([logging], - AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]), - [], enable_logging=yes) + AS_HELP_STRING([--disable-logging], [disable system logging @<:@default=enabled@:>@]), + [], enable_logging=yes) AS_IF([test "x$enable_logging" = "xyes"], [ AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) ]) AC_ARG_WITH(firmware-path, - AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], - [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), - [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"]) + AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], + [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), + [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"]) OLD_IFS=$IFS IFS=: for i in $with_firmware_path; do - if test "x${FIRMWARE_PATH}" = "x"; then - FIRMWARE_PATH="\\\"${i}/\\\"" - else - FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\"" - fi + if test "x${FIRMWARE_PATH}" = "x"; then + FIRMWARE_PATH="\\\"${i}/\\\"" + else + FIRMWARE_PATH="${FIRMWARE_PATH}, \\\"${i}/\\\"" + fi done IFS=$OLD_IFS AC_SUBST([FIRMWARE_PATH], [$FIRMWARE_PATH]) AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), - [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]), + [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]) AS_IF([test "x$with_systemdsystemunitdir" != "xno"], [ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) ]) AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != "xno" ]) @@ -119,21 +119,21 @@ AM_CONDITIONAL(WITH_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_sy # GUdev - libudev gobject interface # ------------------------------------------------------------------------------ AC_ARG_ENABLE([gudev], - AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]), - [], [enable_gudev=yes]) + AS_HELP_STRING([--disable-gudev], [disable Gobject libudev support @<:@default=enabled@:>@]), + [], [enable_gudev=yes]) AS_IF([test "x$enable_gudev" = "xyes"], [ PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ]) AC_ARG_ENABLE([introspection], - AS_HELP_STRING([--disable-introspection], [disable GObject introspection @<:@default=enabled@:>@]), - [], [enable_introspection=yes]) + AS_HELP_STRING([--disable-introspection], [disable GObject introspection @<:@default=enabled@:>@]), + [], [enable_introspection=yes]) AS_IF([test "x$enable_introspection" = "xyes"], [ - PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) - AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) - AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) - AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) - AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) - AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) - AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) + PKG_CHECK_MODULES([INTROSPECTION], [gobject-introspection-1.0 >= 0.6.2]) + AC_DEFINE([ENABLE_INTROSPECTION], [1], [enable GObject introspection support]) + AC_SUBST([G_IR_SCANNER], [$($PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0)]) + AC_SUBST([G_IR_COMPILER], [$($PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0)]) + AC_SUBST([G_IR_GENERATE], [$($PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0)]) + AC_SUBST([GIRDIR], [$($PKG_CONFIG --define-variable=datadir=${datadir} --variable=girdir gobject-introspection-1.0)]) + AC_SUBST([GIRTYPELIBDIR], [$($PKG_CONFIG --define-variable=libdir=${libdir} --variable=typelibdir gobject-introspection-1.0)]) ]) AM_CONDITIONAL([ENABLE_INTROSPECTION], [test "x$enable_introspection" = "xyes"]) AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"]) @@ -142,16 +142,16 @@ AM_CONDITIONAL([ENABLE_GUDEV], [test "x$enable_gudev" = "xyes"]) # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ AC_ARG_ENABLE([keymap], - AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]), - [], [enable_keymap=yes]) + AS_HELP_STRING([--disable-keymap], [disable keymap fixup support @<:@default=enabled@:>@]), + [], [enable_keymap=yes]) AS_IF([test "x$enable_keymap" = "xyes"], [ - AC_PATH_PROG([GPERF], [gperf]) - if test -z "$GPERF"; then - AC_MSG_ERROR([gperf is needed]) - fi + AC_PATH_PROG([GPERF], [gperf]) + if test -z "$GPERF"; then + AC_MSG_ERROR([gperf is needed]) + fi - AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) - AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) + AC_CHECK_HEADER([linux/input.h], [:], AC_MSG_ERROR([kernel headers not found])) + AC_SUBST([INCLUDE_PREFIX], [$(echo '#include ' | eval $ac_cpp -E - | sed -n '/linux\/input.h/ {s:.*"\(.*\)/linux/input.h".*:\1:; p; q}')]) ]) AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = "xyes"]) @@ -159,29 +159,29 @@ AM_CONDITIONAL([ENABLE_KEYMAP], [test "x$enable_keymap" = "xyes"]) # mtd_probe - autoloads FTL module for mtd devices # ------------------------------------------------------------------------------ AC_ARG_ENABLE([mtd_probe], - AS_HELP_STRING([--disable-mtd_probe], [disable MTD support @<:@default=enabled@:>@]), - [], [enable_mtd_probe=yes]) + AS_HELP_STRING([--disable-mtd_probe], [disable MTD support @<:@default=enabled@:>@]), + [], [enable_mtd_probe=yes]) AM_CONDITIONAL([ENABLE_MTD_PROBE], [test "x$enable_mtd_probe" = "xyes"]) # ------------------------------------------------------------------------------ # rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ AC_ARG_ENABLE([rule_generator], - AS_HELP_STRING([--enable-rule_generator], [enable persistent network + cdrom links support @<:@default=disabled@:>@]), - [], [enable_rule_generator=no]) + AS_HELP_STRING([--enable-rule_generator], [enable persistent network + cdrom links support @<:@default=disabled@:>@]), + [], [enable_rule_generator=no]) AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = "xyes"]) # ------------------------------------------------------------------------------ # udev_acl - apply ACLs for users with local forground sessions # ------------------------------------------------------------------------------ AC_ARG_ENABLE([udev_acl], - AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support @<:@default=disabled@:>@]), - [], [enable_udev_acl=no]) + AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support @<:@default=disabled@:>@]), + [], [enable_udev_acl=no]) AS_IF([test "x$enable_udev_acl" = "xyes"], [ - AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) - AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) + AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) + AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) - PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) + PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) ]) AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = "xyes"]) @@ -189,16 +189,16 @@ AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = "xyes"]) # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) # ------------------------------------------------------------------------------ AC_ARG_ENABLE([floppy], - AS_HELP_STRING([--enable-floppy], [enable legacy floppy support @<:@default=disabled@:>@]), - [], [enable_floppy=no]) + AS_HELP_STRING([--enable-floppy], [enable legacy floppy support @<:@default=disabled@:>@]), + [], [enable_floppy=no]) AM_CONDITIONAL([ENABLE_FLOPPY], [test "x$enable_floppy" = "xyes"]) # ------------------------------------------------------------------------------ # edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data # ------------------------------------------------------------------------------ AC_ARG_ENABLE([edd], - AS_HELP_STRING([--enable-edd], [enable disk edd support @<:@default=disabled@:>@]), - [], [enable_edd=no]) + AS_HELP_STRING([--enable-edd], [enable disk edd support @<:@default=disabled@:>@]), + [], [enable_edd=no]) AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = "xyes"]) my_CFLAGS="-Wall \ @@ -211,50 +211,50 @@ AC_SUBST([my_CFLAGS]) AC_CONFIG_HEADERS(config.h) AC_CONFIG_FILES([ - Makefile - src/docs/Makefile - src/docs/version.xml - src/extras/gudev/docs/Makefile - src/extras/gudev/docs/version.xml + Makefile + src/docs/Makefile + src/docs/version.xml + src/extras/gudev/docs/Makefile + src/extras/gudev/docs/version.xml ]) AC_OUTPUT AC_MSG_RESULT([ - $PACKAGE $VERSION - ======== + $PACKAGE $VERSION + ======== - prefix: ${prefix} - rootprefix: ${rootprefix} - sysconfdir: ${sysconfdir} - bindir: ${bindir} - libdir: ${libdir} - rootlibdir: ${rootlib_execdir} - libexecdir: ${libexecdir} - datarootdir: ${datarootdir} - mandir: ${mandir} - includedir: ${includedir} - include_prefix: ${INCLUDE_PREFIX} - systemdsystemunitdir: ${systemdsystemunitdir} - firmware path: ${FIRMWARE_PATH} - usb.ids: ${USB_DATABASE} - pci.ids: ${PCI_DATABASE} + prefix: ${prefix} + rootprefix: ${rootprefix} + sysconfdir: ${sysconfdir} + bindir: ${bindir} + libdir: ${libdir} + rootlibdir: ${rootlib_execdir} + libexecdir: ${libexecdir} + datarootdir: ${datarootdir} + mandir: ${mandir} + includedir: ${includedir} + include_prefix: ${INCLUDE_PREFIX} + systemdsystemunitdir: ${systemdsystemunitdir} + firmware path: ${FIRMWARE_PATH} + usb.ids: ${USB_DATABASE} + pci.ids: ${PCI_DATABASE} - compiler: ${CC} - cflags: ${CFLAGS} - ldflags: ${LDFLAGS} - xsltproc: ${XSLTPROC} - gperf: ${GPERF} + compiler: ${CC} + cflags: ${CFLAGS} + ldflags: ${LDFLAGS} + xsltproc: ${XSLTPROC} + gperf: ${GPERF} - logging: ${enable_logging} - debug: ${enable_debug} - selinux: ${with_selinux} + logging: ${enable_logging} + debug: ${enable_debug} + selinux: ${with_selinux} - gudev: ${enable_gudev} - gintrospection: ${enable_introspection} - keymap: ${enable_keymap} - mtd_probe: ${enable_mtd_probe} - rule_generator: ${enable_rule_generator} - udev_acl: ${enable_udev_acl} - floppy: ${enable_floppy} - edd: ${enable_edd} + gudev: ${enable_gudev} + gintrospection: ${enable_introspection} + keymap: ${enable_keymap} + mtd_probe: ${enable_mtd_probe} + rule_generator: ${enable_rule_generator} + udev_acl: ${enable_udev_acl} + floppy: ${enable_floppy} + edd: ${enable_edd} ]) diff --git a/rules/arch/40-s390.rules b/rules/arch/40-s390.rules index 43035dbe60..6ff6b65a57 100644 --- a/rules/arch/40-s390.rules +++ b/rules/arch/40-s390.rules @@ -1,4 +1,4 @@ # do not edit this file, it will be overwritten on update -KERNEL=="z90crypt", MODE="0666" +KERNEL=="z90crypt", MODE="0666" diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 353e31d8b9..3744707909 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -2,44 +2,44 @@ KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" -KERNEL=="ptmx", GROUP="tty", MODE="0666" -KERNEL=="tty", GROUP="tty", MODE="0666" -KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" +KERNEL=="ptmx", GROUP="tty", MODE="0666" +KERNEL=="tty", GROUP="tty", MODE="0666" +KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty" # serial KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout" -KERNEL=="mwave", GROUP="dialout" -KERNEL=="hvc*|hvsi*", GROUP="dialout" +KERNEL=="mwave", GROUP="dialout" +KERNEL=="hvc*|hvsi*", GROUP="dialout" # virtio serial / console ports KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" # mem KERNEL=="null|zero|full|random|urandom", MODE="0666" -KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" +KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" # input SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id" -KERNEL=="mouse*|mice|event*", MODE="0640" -KERNEL=="ts[0-9]*|uinput", MODE="0640" -KERNEL=="js[0-9]*", MODE="0644" +KERNEL=="mouse*|mice|event*", MODE="0640" +KERNEL=="ts[0-9]*|uinput", MODE="0640" +KERNEL=="js[0-9]*", MODE="0644" # video4linux -SUBSYSTEM=="video4linux", GROUP="video" -KERNEL=="vttuner*", GROUP="video" -KERNEL=="vtx*|vbi*", GROUP="video" -KERNEL=="winradio*", GROUP="video" +SUBSYSTEM=="video4linux", GROUP="video" +KERNEL=="vttuner*", GROUP="video" +KERNEL=="vtx*|vbi*", GROUP="video" +KERNEL=="winradio*", GROUP="video" # graphics -KERNEL=="agpgart", GROUP="video" -KERNEL=="pmu", GROUP="video" -KERNEL=="nvidia*|nvidiactl*", GROUP="video" -SUBSYSTEM=="graphics", GROUP="video" -SUBSYSTEM=="drm", GROUP="video" +KERNEL=="agpgart", GROUP="video" +KERNEL=="pmu", GROUP="video" +KERNEL=="nvidia*|nvidiactl*", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" # sound -SUBSYSTEM=="sound", GROUP="audio", \ +SUBSYSTEM=="sound", GROUP="audio", \ OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer" # DVB (video) @@ -56,11 +56,11 @@ SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id" # printer -KERNEL=="parport[0-9]*", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" -SUBSYSTEM=="ppdev", GROUP="lp" -KERNEL=="lp[0-9]*", GROUP="lp" -KERNEL=="irlpt[0-9]*", GROUP="lp" +KERNEL=="parport[0-9]*", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="lp[0-9]*", GROUP="lp" +KERNEL=="irlpt[0-9]*", GROUP="lp" SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="lp" # block @@ -91,17 +91,17 @@ SUBSYSTEM=="aoe", GROUP="disk", MODE="0220" SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" # network -KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" -KERNEL=="rfkill", MODE="0644" +KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" +KERNEL=="rfkill", MODE="0644" # CPU -KERNEL=="cpu[0-9]*", MODE="0444" +KERNEL=="cpu[0-9]*", MODE="0444" -KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse" +KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse" SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" -KERNEL=="mmtimer", MODE="0644" -KERNEL=="rflash[0-9]*", MODE="0400" -KERNEL=="rrom[0-9]*", MODE="0400" +KERNEL=="mmtimer", MODE="0644" +KERNEL=="rflash[0-9]*", MODE="0400" +KERNEL=="rrom[0-9]*", MODE="0400" SUBSYSTEM=="firmware", ACTION=="add", IMPORT{builtin}="firmware" diff --git a/src/COPYING b/src/COPYING index 0851b141d8..d2e31278b0 100644 --- a/src/COPYING +++ b/src/COPYING @@ -1,5 +1,5 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -10,7 +10,7 @@ as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -112,7 +112,7 @@ modification follow. Pay close attention to the difference between a former contains code derived from the library, whereas the latter must be combined with the library in order to run. - GNU LESSER GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other @@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. @@ -455,7 +455,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries diff --git a/src/extras/accelerometer/accelerometer.c b/src/extras/accelerometer/accelerometer.c index 59c2a4ece3..bc9715b264 100644 --- a/src/extras/accelerometer/accelerometer.c +++ b/src/extras/accelerometer/accelerometer.c @@ -71,32 +71,32 @@ static int debug = 0; static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) + const char *file, int line, const char *fn, + const char *format, va_list args) { - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } } typedef enum { - ORIENTATION_UNDEFINED, - ORIENTATION_NORMAL, - ORIENTATION_BOTTOM_UP, - ORIENTATION_LEFT_UP, - ORIENTATION_RIGHT_UP + ORIENTATION_UNDEFINED, + ORIENTATION_NORMAL, + ORIENTATION_BOTTOM_UP, + ORIENTATION_LEFT_UP, + ORIENTATION_RIGHT_UP } OrientationUp; static const char *orientations[] = { - "undefined", - "normal", - "bottom-up", - "left-up", - "right-up", - NULL + "undefined", + "normal", + "bottom-up", + "left-up", + "right-up", + NULL }; #define ORIENTATION_UP_UP ORIENTATION_NORMAL @@ -111,247 +111,247 @@ static const char *orientations[] = { static const char * orientation_to_string (OrientationUp o) { - return orientations[o]; + return orientations[o]; } static OrientationUp string_to_orientation (const char *orientation) { - int i; - - if (orientation == NULL) - return ORIENTATION_UNDEFINED; - for (i = 0; orientations[i] != NULL; i++) { - if (strcmp (orientation, orientations[i]) == 0) - return i; - } - return ORIENTATION_UNDEFINED; + int i; + + if (orientation == NULL) + return ORIENTATION_UNDEFINED; + for (i = 0; orientations[i] != NULL; i++) { + if (strcmp (orientation, orientations[i]) == 0) + return i; + } + return ORIENTATION_UNDEFINED; } static OrientationUp orientation_calc (OrientationUp prev, - int x, int y, int z) + int x, int y, int z) { - int rotation; - OrientationUp ret = prev; - - /* Portrait check */ - rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES); - - if (abs(rotation) > THRESHOLD_PORTRAIT) { - ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP; - - /* Some threshold to switching between portrait modes */ - if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) { - if (abs(rotation) < SAME_AXIS_LIMIT) { - ret = prev; - } - } - - } else { - /* Landscape check */ - rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES); - - if (abs(rotation) > THRESHOLD_LANDSCAPE) { - ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL; - - /* Some threshold to switching between landscape modes */ - if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) { - if (abs(rotation) < SAME_AXIS_LIMIT) { - ret = prev; - } - } - } - } - - return ret; + int rotation; + OrientationUp ret = prev; + + /* Portrait check */ + rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_PORTRAIT) { + ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP; + + /* Some threshold to switching between portrait modes */ + if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + + } else { + /* Landscape check */ + rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_LANDSCAPE) { + ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL; + + /* Some threshold to switching between landscape modes */ + if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + } + } + + return ret; } static OrientationUp get_prev_orientation(struct udev_device *dev) { - const char *value; + const char *value; - value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); - if (value == NULL) - return ORIENTATION_UNDEFINED; - return string_to_orientation(value); + value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); + if (value == NULL) + return ORIENTATION_UNDEFINED; + return string_to_orientation(value); } #define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = 1; } } /* accelerometers */ static void test_orientation(struct udev *udev, - struct udev_device *dev, - const char *devpath) + struct udev_device *dev, + const char *devpath) { - OrientationUp old, new; - int fd, r; - struct input_event ev[64]; - int got_syn = 0; - int got_x, got_y, got_z; - int x = 0, y = 0, z = 0; - char text[64]; - - old = get_prev_orientation(dev); - - if ((fd = open(devpath, O_RDONLY)) < 0) - return; - - got_x = got_y = got_z = 0; - - while (1) { - int i; - - r = read(fd, ev, sizeof(struct input_event) * 64); - - if (r < (int) sizeof(struct input_event)) - return; - - for (i = 0; i < r / (int) sizeof(struct input_event); i++) { - if (got_syn == 1) { - if (ev[i].type == EV_ABS) { - SET_AXIS(x, ABS_X); - SET_AXIS(y, ABS_Y); - SET_AXIS(z, ABS_Z); - } - } - if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) { - got_syn = 1; - } - if (got_x && got_y && got_z) - goto read_dev; - } - } + OrientationUp old, new; + int fd, r; + struct input_event ev[64]; + int got_syn = 0; + int got_x, got_y, got_z; + int x = 0, y = 0, z = 0; + char text[64]; + + old = get_prev_orientation(dev); + + if ((fd = open(devpath, O_RDONLY)) < 0) + return; + + got_x = got_y = got_z = 0; + + while (1) { + int i; + + r = read(fd, ev, sizeof(struct input_event) * 64); + + if (r < (int) sizeof(struct input_event)) + return; + + for (i = 0; i < r / (int) sizeof(struct input_event); i++) { + if (got_syn == 1) { + if (ev[i].type == EV_ABS) { + SET_AXIS(x, ABS_X); + SET_AXIS(y, ABS_Y); + SET_AXIS(z, ABS_Z); + } + } + if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) { + got_syn = 1; + } + if (got_x && got_y && got_z) + goto read_dev; + } + } read_dev: - close(fd); + close(fd); - if (!got_x || !got_y || !got_z) - return; + if (!got_x || !got_y || !got_z) + return; - new = orientation_calc(old, x, y, z); - snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new)); - puts(text); + new = orientation_calc(old, x, y, z); + snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new)); + puts(text); } static void help(void) { - printf("Usage: accelerometer [options] \n" - " --debug debug to stderr\n" - " --help print this help text\n\n"); + printf("Usage: accelerometer [options] \n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); } int main (int argc, char** argv) { - struct udev *udev; - struct udev_device *dev; - - static const struct option options[] = { - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - char devpath[PATH_MAX]; - char *devnode; - const char *id_path; - struct udev_enumerate *enumerate; - struct udev_list_entry *list_entry; - - udev = udev_new(); - if (udev == NULL) - return 1; - - udev_log_init("input_id"); - udev_set_log_fn(udev, log_fn); - - /* CLI argument parsing */ - while (1) { - int option; - - option = getopt_long(argc, argv, "dxh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - help(); - exit(0); - default: - exit(1); - } - } - - if (argv[optind] == NULL) { - help(); - exit(1); - } - - /* get the device */ - snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); - dev = udev_device_new_from_syspath(udev, devpath); - if (dev == NULL) { - fprintf(stderr, "unable to access '%s'\n", devpath); - return 1; - } - - id_path = udev_device_get_property_value(dev, "ID_PATH"); - if (id_path == NULL) { - fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath); - return 0; - } - - /* Get the children devices and find the devnode - * FIXME: use udev_enumerate_add_match_children() instead - * when it's available */ - devnode = NULL; - enumerate = udev_enumerate_new(udev); - udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path); - udev_enumerate_add_match_subsystem(enumerate, "input"); - udev_enumerate_scan_devices(enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; - const char *node; - - device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), - udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - /* Already found it */ - if (devnode != NULL) { - udev_device_unref(device); - continue; - } - - node = udev_device_get_devnode(device); - if (node == NULL) { - udev_device_unref(device); - continue; - } - /* Use the event sub-device */ - if (strstr(node, "/event") == NULL) { - udev_device_unref(device); - continue; - } - - devnode = strdup(node); - udev_device_unref(device); - } - - if (devnode == NULL) { - fprintf(stderr, "unable to get device node for '%s'\n", devpath); - return 0; - } - - info(udev, "Opening accelerometer device %s\n", devnode); - test_orientation(udev, dev, devnode); - free(devnode); - - return 0; + struct udev *udev; + struct udev_device *dev; + + static const struct option options[] = { + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + char devpath[PATH_MAX]; + char *devnode; + const char *id_path; + struct udev_enumerate *enumerate; + struct udev_list_entry *list_entry; + + udev = udev_new(); + if (udev == NULL) + return 1; + + udev_log_init("input_id"); + udev_set_log_fn(udev, log_fn); + + /* CLI argument parsing */ + while (1) { + int option; + + option = getopt_long(argc, argv, "dxh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + help(); + exit(0); + default: + exit(1); + } + } + + if (argv[optind] == NULL) { + help(); + exit(1); + } + + /* get the device */ + snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); + dev = udev_device_new_from_syspath(udev, devpath); + if (dev == NULL) { + fprintf(stderr, "unable to access '%s'\n", devpath); + return 1; + } + + id_path = udev_device_get_property_value(dev, "ID_PATH"); + if (id_path == NULL) { + fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath); + return 0; + } + + /* Get the children devices and find the devnode + * FIXME: use udev_enumerate_add_match_children() instead + * when it's available */ + devnode = NULL; + enumerate = udev_enumerate_new(udev); + udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path); + udev_enumerate_add_match_subsystem(enumerate, "input"); + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + const char *node; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + /* Already found it */ + if (devnode != NULL) { + udev_device_unref(device); + continue; + } + + node = udev_device_get_devnode(device); + if (node == NULL) { + udev_device_unref(device); + continue; + } + /* Use the event sub-device */ + if (strstr(node, "/event") == NULL) { + udev_device_unref(device); + continue; + } + + devnode = strdup(node); + udev_device_unref(device); + } + + if (devnode == NULL) { + fprintf(stderr, "unable to get device node for '%s'\n", devpath); + return 0; + } + + info(udev, "Opening accelerometer device %s\n", devnode); + test_orientation(udev, dev, devnode); + free(devnode); + + return 0; } diff --git a/src/extras/ata_id/ata_id.c b/src/extras/ata_id/ata_id.c index 64df86c23a..924d479c1d 100644 --- a/src/extras/ata_id/ata_id.c +++ b/src/extras/ata_id/ata_id.c @@ -48,241 +48,241 @@ #define COMMAND_TIMEOUT_MSEC (30 * 1000) static int disk_scsi_inquiry_command(int fd, - void *buf, - size_t buf_len) + void *buf, + size_t buf_len) { - struct sg_io_v4 io_v4; - uint8_t cdb[6]; - uint8_t sense[32]; - int ret; - - /* - * INQUIRY, see SPC-4 section 6.4 - */ - memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0x12; /* OPERATION CODE: INQUIRY */ - cdb[3] = (buf_len >> 8); /* ALLOCATION LENGTH */ - cdb[4] = (buf_len & 0xff); - - memset(sense, 0, sizeof(sense)); - - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof (cdb); - io_v4.request = (uintptr_t) cdb; - io_v4.max_response_len = sizeof (sense); - io_v4.response = (uintptr_t) sense; - io_v4.din_xfer_len = buf_len; - io_v4.din_xferp = (uintptr_t) buf; - io_v4.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_v4); - if (ret != 0) { - /* could be that the driver doesn't do version 4, try version 3 */ - if (errno == EINVAL) { - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = sizeof (cdb); - io_hdr.dxferp = buf; - io_hdr.dxfer_len = buf_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sizeof (sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_hdr); - if (ret != 0) - goto out; - - /* even if the ioctl succeeds, we need to check the return value */ - if (!(io_hdr.status == 0 && - io_hdr.host_status == 0 && - io_hdr.driver_status == 0)) { - errno = EIO; - ret = -1; - goto out; - } - } else { - goto out; - } - } - - /* even if the ioctl succeeds, we need to check the return value */ - if (!(io_v4.device_status == 0 && - io_v4.transport_status == 0 && - io_v4.driver_status == 0)) { - errno = EIO; - ret = -1; - goto out; - } + struct sg_io_v4 io_v4; + uint8_t cdb[6]; + uint8_t sense[32]; + int ret; + + /* + * INQUIRY, see SPC-4 section 6.4 + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0x12; /* OPERATION CODE: INQUIRY */ + cdb[3] = (buf_len >> 8); /* ALLOCATION LENGTH */ + cdb[4] = (buf_len & 0xff); + + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + + /* even if the ioctl succeeds, we need to check the return value */ + if (!(io_hdr.status == 0 && + io_hdr.host_status == 0 && + io_hdr.driver_status == 0)) { + errno = EIO; + ret = -1; + goto out; + } + } else { + goto out; + } + } + + /* even if the ioctl succeeds, we need to check the return value */ + if (!(io_v4.device_status == 0 && + io_v4.transport_status == 0 && + io_v4.driver_status == 0)) { + errno = EIO; + ret = -1; + goto out; + } out: - return ret; + return ret; } -static int disk_identify_command(int fd, - void *buf, - size_t buf_len) +static int disk_identify_command(int fd, + void *buf, + size_t buf_len) { - struct sg_io_v4 io_v4; - uint8_t cdb[12]; - uint8_t sense[32]; - uint8_t *desc = sense+8; - int ret; - - /* - * ATA Pass-Through 12 byte command, as described in - * - * T10 04-262r8 ATA Command Pass-Through - * - * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf - */ - memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0xa1; /* OPERATION CODE: 12 byte pass through */ - cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ - cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ - cdb[3] = 0; /* FEATURES */ - cdb[4] = 1; /* SECTORS */ - cdb[5] = 0; /* LBA LOW */ - cdb[6] = 0; /* LBA MID */ - cdb[7] = 0; /* LBA HIGH */ - cdb[8] = 0 & 0x4F; /* SELECT */ - cdb[9] = 0xEC; /* Command: ATA IDENTIFY DEVICE */; - memset(sense, 0, sizeof(sense)); - - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof (cdb); - io_v4.request = (uintptr_t) cdb; - io_v4.max_response_len = sizeof (sense); - io_v4.response = (uintptr_t) sense; - io_v4.din_xfer_len = buf_len; - io_v4.din_xferp = (uintptr_t) buf; - io_v4.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_v4); - if (ret != 0) { - /* could be that the driver doesn't do version 4, try version 3 */ - if (errno == EINVAL) { - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = sizeof (cdb); - io_hdr.dxferp = buf; - io_hdr.dxfer_len = buf_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sizeof (sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_hdr); - if (ret != 0) - goto out; - } else { - goto out; - } - } - - if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { - errno = EIO; - ret = -1; - goto out; - } + struct sg_io_v4 io_v4; + uint8_t cdb[12]; + uint8_t sense[32]; + uint8_t *desc = sense+8; + int ret; + + /* + * ATA Pass-Through 12 byte command, as described in + * + * T10 04-262r8 ATA Command Pass-Through + * + * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0xa1; /* OPERATION CODE: 12 byte pass through */ + cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ + cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ + cdb[3] = 0; /* FEATURES */ + cdb[4] = 1; /* SECTORS */ + cdb[5] = 0; /* LBA LOW */ + cdb[6] = 0; /* LBA MID */ + cdb[7] = 0; /* LBA HIGH */ + cdb[8] = 0 & 0x4F; /* SELECT */ + cdb[9] = 0xEC; /* Command: ATA IDENTIFY DEVICE */; + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + } else { + goto out; + } + } + + if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { + errno = EIO; + ret = -1; + goto out; + } out: - return ret; + return ret; } -static int disk_identify_packet_device_command(int fd, - void *buf, - size_t buf_len) +static int disk_identify_packet_device_command(int fd, + void *buf, + size_t buf_len) { - struct sg_io_v4 io_v4; - uint8_t cdb[16]; - uint8_t sense[32]; - uint8_t *desc = sense+8; - int ret; - - /* - * ATA Pass-Through 16 byte command, as described in - * - * T10 04-262r8 ATA Command Pass-Through - * - * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf - */ - memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0x85; /* OPERATION CODE: 16 byte pass through */ - cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ - cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ - cdb[3] = 0; /* FEATURES */ - cdb[4] = 0; /* FEATURES */ - cdb[5] = 0; /* SECTORS */ - cdb[6] = 1; /* SECTORS */ - cdb[7] = 0; /* LBA LOW */ - cdb[8] = 0; /* LBA LOW */ - cdb[9] = 0; /* LBA MID */ - cdb[10] = 0; /* LBA MID */ - cdb[11] = 0; /* LBA HIGH */ - cdb[12] = 0; /* LBA HIGH */ - cdb[13] = 0; /* DEVICE */ - cdb[14] = 0xA1; /* Command: ATA IDENTIFY PACKET DEVICE */; - cdb[15] = 0; /* CONTROL */ - memset(sense, 0, sizeof(sense)); - - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof (cdb); - io_v4.request = (uintptr_t) cdb; - io_v4.max_response_len = sizeof (sense); - io_v4.response = (uintptr_t) sense; - io_v4.din_xfer_len = buf_len; - io_v4.din_xferp = (uintptr_t) buf; - io_v4.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_v4); - if (ret != 0) { - /* could be that the driver doesn't do version 4, try version 3 */ - if (errno == EINVAL) { - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = sizeof (cdb); - io_hdr.dxferp = buf; - io_hdr.dxfer_len = buf_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sizeof (sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_hdr); - if (ret != 0) - goto out; - } else { - goto out; - } - } - - if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { - errno = EIO; - ret = -1; - goto out; - } + struct sg_io_v4 io_v4; + uint8_t cdb[16]; + uint8_t sense[32]; + uint8_t *desc = sense+8; + int ret; + + /* + * ATA Pass-Through 16 byte command, as described in + * + * T10 04-262r8 ATA Command Pass-Through + * + * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0x85; /* OPERATION CODE: 16 byte pass through */ + cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ + cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ + cdb[3] = 0; /* FEATURES */ + cdb[4] = 0; /* FEATURES */ + cdb[5] = 0; /* SECTORS */ + cdb[6] = 1; /* SECTORS */ + cdb[7] = 0; /* LBA LOW */ + cdb[8] = 0; /* LBA LOW */ + cdb[9] = 0; /* LBA MID */ + cdb[10] = 0; /* LBA MID */ + cdb[11] = 0; /* LBA HIGH */ + cdb[12] = 0; /* LBA HIGH */ + cdb[13] = 0; /* DEVICE */ + cdb[14] = 0xA1; /* Command: ATA IDENTIFY PACKET DEVICE */; + cdb[15] = 0; /* CONTROL */ + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + } else { + goto out; + } + } + + if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { + errno = EIO; + ret = -1; + goto out; + } out: - return ret; + return ret; } /** @@ -295,43 +295,43 @@ static int disk_identify_packet_device_command(int fd, * Copies the ATA string from @identify located at @offset_words into @dest. */ static void disk_identify_get_string (uint8_t identify[512], - unsigned int offset_words, - char *dest, - size_t dest_len) + unsigned int offset_words, + char *dest, + size_t dest_len) { - unsigned int c1; - unsigned int c2; - - assert (identify != NULL); - assert (dest != NULL); - assert ((dest_len & 1) == 0); - - while (dest_len > 0) { - c1 = ((uint16_t *) identify)[offset_words] >> 8; - c2 = ((uint16_t *) identify)[offset_words] & 0xff; - *dest = c1; - dest++; - *dest = c2; - dest++; - offset_words++; - dest_len -= 2; - } + unsigned int c1; + unsigned int c2; + + assert (identify != NULL); + assert (dest != NULL); + assert ((dest_len & 1) == 0); + + while (dest_len > 0) { + c1 = ((uint16_t *) identify)[offset_words] >> 8; + c2 = ((uint16_t *) identify)[offset_words] & 0xff; + *dest = c1; + dest++; + *dest = c2; + dest++; + offset_words++; + dest_len -= 2; + } } static void disk_identify_fixup_string (uint8_t identify[512], - unsigned int offset_words, - size_t len) + unsigned int offset_words, + size_t len) { - disk_identify_get_string(identify, offset_words, - (char *) identify + offset_words * 2, len); + disk_identify_get_string(identify, offset_words, + (char *) identify + offset_words * 2, len); } static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offset_words) { - uint16_t *p; + uint16_t *p; - p = (uint16_t *) identify; - p[offset_words] = le16toh (p[offset_words]); + p = (uint16_t *) identify; + p[offset_words] = le16toh (p[offset_words]); } /** @@ -352,375 +352,375 @@ static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offs * non-zero with errno set. */ static int disk_identify (struct udev *udev, - int fd, - uint8_t out_identify[512], - int *out_is_packet_device) + int fd, + uint8_t out_identify[512], + int *out_is_packet_device) { - int ret; - uint8_t inquiry_buf[36]; - int peripheral_device_type; - int all_nul_bytes; - int n; - int is_packet_device; - - assert (out_identify != NULL); - - /* init results */ - ret = -1; - memset (out_identify, '\0', 512); - is_packet_device = 0; - - /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device - * we could accidentally blank media. This is because MMC's BLANK - * command has the same op-code (0x61). - * - * To prevent this from happening we bail out if the device - * isn't a Direct Access Block Device, e.g. SCSI type 0x00 - * (CD/DVD devices are type 0x05). So we send a SCSI INQUIRY - * command first... libata is handling this via its SCSI - * emulation layer. - * - * This also ensures that we're actually dealing with a device - * that understands SCSI commands. - * - * (Yes, it is a bit perverse that we're tunneling the ATA - * command through SCSI and relying on the ATA driver - * emulating SCSI well-enough...) - * - * (See commit 160b069c25690bfb0c785994c7c3710289179107 for - * the original bug-fix and see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635 - * for the original bug-report.) - */ - ret = disk_scsi_inquiry_command (fd, inquiry_buf, sizeof (inquiry_buf)); - if (ret != 0) - goto out; - - /* SPC-4, section 6.4.2: Standard INQUIRY data */ - peripheral_device_type = inquiry_buf[0] & 0x1f; - if (peripheral_device_type == 0x05) - { - is_packet_device = 1; - ret = disk_identify_packet_device_command(fd, out_identify, 512); - goto check_nul_bytes; - } - if (peripheral_device_type != 0x00) { - ret = -1; - errno = EIO; - goto out; - } - - /* OK, now issue the IDENTIFY DEVICE command */ - ret = disk_identify_command(fd, out_identify, 512); - if (ret != 0) - goto out; + int ret; + uint8_t inquiry_buf[36]; + int peripheral_device_type; + int all_nul_bytes; + int n; + int is_packet_device; + + assert (out_identify != NULL); + + /* init results */ + ret = -1; + memset (out_identify, '\0', 512); + is_packet_device = 0; + + /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device + * we could accidentally blank media. This is because MMC's BLANK + * command has the same op-code (0x61). + * + * To prevent this from happening we bail out if the device + * isn't a Direct Access Block Device, e.g. SCSI type 0x00 + * (CD/DVD devices are type 0x05). So we send a SCSI INQUIRY + * command first... libata is handling this via its SCSI + * emulation layer. + * + * This also ensures that we're actually dealing with a device + * that understands SCSI commands. + * + * (Yes, it is a bit perverse that we're tunneling the ATA + * command through SCSI and relying on the ATA driver + * emulating SCSI well-enough...) + * + * (See commit 160b069c25690bfb0c785994c7c3710289179107 for + * the original bug-fix and see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635 + * for the original bug-report.) + */ + ret = disk_scsi_inquiry_command (fd, inquiry_buf, sizeof (inquiry_buf)); + if (ret != 0) + goto out; + + /* SPC-4, section 6.4.2: Standard INQUIRY data */ + peripheral_device_type = inquiry_buf[0] & 0x1f; + if (peripheral_device_type == 0x05) + { + is_packet_device = 1; + ret = disk_identify_packet_device_command(fd, out_identify, 512); + goto check_nul_bytes; + } + if (peripheral_device_type != 0x00) { + ret = -1; + errno = EIO; + goto out; + } + + /* OK, now issue the IDENTIFY DEVICE command */ + ret = disk_identify_command(fd, out_identify, 512); + if (ret != 0) + goto out; check_nul_bytes: - /* Check if IDENTIFY data is all NUL bytes - if so, bail */ - all_nul_bytes = 1; - for (n = 0; n < 512; n++) { - if (out_identify[n] != '\0') { - all_nul_bytes = 0; - break; - } - } - - if (all_nul_bytes) { - ret = -1; - errno = EIO; - goto out; - } + /* Check if IDENTIFY data is all NUL bytes - if so, bail */ + all_nul_bytes = 1; + for (n = 0; n < 512; n++) { + if (out_identify[n] != '\0') { + all_nul_bytes = 0; + break; + } + } + + if (all_nul_bytes) { + ret = -1; + errno = EIO; + goto out; + } out: - if (out_is_packet_device != NULL) - *out_is_packet_device = is_packet_device; - return ret; + if (out_is_packet_device != NULL) + *out_is_packet_device = is_packet_device; + return ret; } static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) + const char *file, int line, const char *fn, + const char *format, va_list args) { - vsyslog(priority, format, args); + vsyslog(priority, format, args); } int main(int argc, char *argv[]) { - struct udev *udev; - struct hd_driveid id; - uint8_t identify[512]; - uint16_t *identify_words; - char model[41]; - char model_enc[256]; - char serial[21]; - char revision[9]; - const char *node = NULL; - int export = 0; - int fd; - uint16_t word; - int rc = 0; - int is_packet_device = 0; - static const struct option options[] = { - { "export", no_argument, NULL, 'x' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("ata_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "xh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'x': - export = 1; - break; - case 'h': - printf("Usage: ata_id [--export] [--help] \n" - " --export print values as environment keys\n" - " --help print this help text\n\n"); - goto exit; - } - } - - node = argv[optind]; - if (node == NULL) { - err(udev, "no node specified\n"); - rc = 1; - goto exit; - } - - fd = open(node, O_RDONLY|O_NONBLOCK); - if (fd < 0) { - err(udev, "unable to open '%s'\n", node); - rc = 1; - goto exit; - } - - if (disk_identify(udev, fd, identify, &is_packet_device) == 0) { - /* - * fix up only the fields from the IDENTIFY data that we are going to - * use and copy it into the hd_driveid struct for convenience - */ - disk_identify_fixup_string (identify, 10, 20); /* serial */ - disk_identify_fixup_string (identify, 23, 6); /* fwrev */ - disk_identify_fixup_string (identify, 27, 40); /* model */ - disk_identify_fixup_uint16 (identify, 0); /* configuration */ - disk_identify_fixup_uint16 (identify, 75); /* queue depth */ - disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ - disk_identify_fixup_uint16 (identify, 82); /* command set supported */ - disk_identify_fixup_uint16 (identify, 83); /* command set supported */ - disk_identify_fixup_uint16 (identify, 84); /* command set supported */ - disk_identify_fixup_uint16 (identify, 85); /* command set supported */ - disk_identify_fixup_uint16 (identify, 86); /* command set supported */ - disk_identify_fixup_uint16 (identify, 87); /* command set supported */ - disk_identify_fixup_uint16 (identify, 89); /* time required for SECURITY ERASE UNIT */ - disk_identify_fixup_uint16 (identify, 90); /* time required for enhanced SECURITY ERASE UNIT */ - disk_identify_fixup_uint16 (identify, 91); /* current APM values */ - disk_identify_fixup_uint16 (identify, 94); /* current AAM value */ - disk_identify_fixup_uint16 (identify, 128); /* device lock function */ - disk_identify_fixup_uint16 (identify, 217); /* nominal media rotation rate */ - memcpy(&id, identify, sizeof id); - } else { - /* If this fails, then try HDIO_GET_IDENTITY */ - if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) { - if (errno == ENOTTY) { - info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); - rc = 2; - } else { - err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); - rc = 3; - } - goto close; - } - } - identify_words = (uint16_t *) identify; - - memcpy (model, id.model, 40); - model[40] = '\0'; - udev_util_encode_string(model, model_enc, sizeof(model_enc)); - util_replace_whitespace((char *) id.model, model, 40); - util_replace_chars(model, NULL); - util_replace_whitespace((char *) id.serial_no, serial, 20); - util_replace_chars(serial, NULL); - util_replace_whitespace((char *) id.fw_rev, revision, 8); - util_replace_chars(revision, NULL); - - if (export) { - /* Set this to convey the disk speaks the ATA protocol */ - printf("ID_ATA=1\n"); - - if ((id.config >> 8) & 0x80) { - /* This is an ATAPI device */ - switch ((id.config >> 8) & 0x1f) { - case 0: - printf("ID_TYPE=cd\n"); - break; - case 1: - printf("ID_TYPE=tape\n"); - break; - case 5: - printf("ID_TYPE=cd\n"); - break; - case 7: - printf("ID_TYPE=optical\n"); - break; - default: - printf("ID_TYPE=generic\n"); - break; - } - } else { - printf("ID_TYPE=disk\n"); - } - printf("ID_BUS=ata\n"); - printf("ID_MODEL=%s\n", model); - printf("ID_MODEL_ENC=%s\n", model_enc); - printf("ID_REVISION=%s\n", revision); - if (serial[0] != '\0') { - printf("ID_SERIAL=%s_%s\n", model, serial); - printf("ID_SERIAL_SHORT=%s\n", serial); - } else { - printf("ID_SERIAL=%s\n", model); - } - - if (id.command_set_1 & (1<<5)) { - printf ("ID_ATA_WRITE_CACHE=1\n"); - printf ("ID_ATA_WRITE_CACHE_ENABLED=%d\n", (id.cfs_enable_1 & (1<<5)) ? 1 : 0); - } - if (id.command_set_1 & (1<<10)) { - printf("ID_ATA_FEATURE_SET_HPA=1\n"); - printf("ID_ATA_FEATURE_SET_HPA_ENABLED=%d\n", (id.cfs_enable_1 & (1<<10)) ? 1 : 0); - - /* - * TODO: use the READ NATIVE MAX ADDRESS command to get the native max address - * so it is easy to check whether the protected area is in use. - */ - } - if (id.command_set_1 & (1<<3)) { - printf("ID_ATA_FEATURE_SET_PM=1\n"); - printf("ID_ATA_FEATURE_SET_PM_ENABLED=%d\n", (id.cfs_enable_1 & (1<<3)) ? 1 : 0); - } - if (id.command_set_1 & (1<<1)) { - printf("ID_ATA_FEATURE_SET_SECURITY=1\n"); - printf("ID_ATA_FEATURE_SET_SECURITY_ENABLED=%d\n", (id.cfs_enable_1 & (1<<1)) ? 1 : 0); - printf("ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=%d\n", id.trseuc * 2); - if ((id.cfs_enable_1 & (1<<1))) /* enabled */ { - if (id.dlf & (1<<8)) - printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=maximum\n"); - else - printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=high\n"); - } - if (id.dlf & (1<<5)) - printf("ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=%d\n", id.trsEuc * 2); - if (id.dlf & (1<<4)) - printf("ID_ATA_FEATURE_SET_SECURITY_EXPIRE=1\n"); - if (id.dlf & (1<<3)) - printf("ID_ATA_FEATURE_SET_SECURITY_FROZEN=1\n"); - if (id.dlf & (1<<2)) - printf("ID_ATA_FEATURE_SET_SECURITY_LOCKED=1\n"); - } - if (id.command_set_1 & (1<<0)) { - printf("ID_ATA_FEATURE_SET_SMART=1\n"); - printf("ID_ATA_FEATURE_SET_SMART_ENABLED=%d\n", (id.cfs_enable_1 & (1<<0)) ? 1 : 0); - } - if (id.command_set_2 & (1<<9)) { - printf("ID_ATA_FEATURE_SET_AAM=1\n"); - printf("ID_ATA_FEATURE_SET_AAM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<9)) ? 1 : 0); - printf("ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=%d\n", id.acoustic >> 8); - printf("ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=%d\n", id.acoustic & 0xff); - } - if (id.command_set_2 & (1<<5)) { - printf("ID_ATA_FEATURE_SET_PUIS=1\n"); - printf("ID_ATA_FEATURE_SET_PUIS_ENABLED=%d\n", (id.cfs_enable_2 & (1<<5)) ? 1 : 0); - } - if (id.command_set_2 & (1<<3)) { - printf("ID_ATA_FEATURE_SET_APM=1\n"); - printf("ID_ATA_FEATURE_SET_APM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<3)) ? 1 : 0); - if ((id.cfs_enable_2 & (1<<3))) - printf("ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=%d\n", id.CurAPMvalues & 0xff); - } - if (id.command_set_2 & (1<<0)) - printf("ID_ATA_DOWNLOAD_MICROCODE=1\n"); - - /* - * Word 76 indicates the capabilities of a SATA device. A PATA device shall set - * word 76 to 0000h or FFFFh. If word 76 is set to 0000h or FFFFh, then - * the device does not claim compliance with the Serial ATA specification and words - * 76 through 79 are not valid and shall be ignored. - */ - word = *((uint16_t *) identify + 76); - if (word != 0x0000 && word != 0xffff) { - printf("ID_ATA_SATA=1\n"); - /* - * If bit 2 of word 76 is set to one, then the device supports the Gen2 - * signaling rate of 3.0 Gb/s (see SATA 2.6). - * - * If bit 1 of word 76 is set to one, then the device supports the Gen1 - * signaling rate of 1.5 Gb/s (see SATA 2.6). - */ - if (word & (1<<2)) - printf("ID_ATA_SATA_SIGNAL_RATE_GEN2=1\n"); - if (word & (1<<1)) - printf("ID_ATA_SATA_SIGNAL_RATE_GEN1=1\n"); - } - - /* Word 217 indicates the nominal media rotation rate of the device */ - word = *((uint16_t *) identify + 217); - if (word != 0x0000) { - if (word == 0x0001) { - printf ("ID_ATA_ROTATION_RATE_RPM=0\n"); /* non-rotating e.g. SSD */ - } else if (word >= 0x0401 && word <= 0xfffe) { - printf ("ID_ATA_ROTATION_RATE_RPM=%d\n", word); - } - } - - /* - * Words 108-111 contain a mandatory World Wide Name (WWN) in the NAA IEEE Registered identifier - * format. Word 108 bits (15:12) shall contain 5h, indicating that the naming authority is IEEE. - * All other values are reserved. - */ - word = *((uint16_t *) identify + 108); - if ((word & 0xf000) == 0x5000) { - uint64_t wwwn; - - wwwn = *((uint16_t *) identify + 108); - wwwn <<= 16; - wwwn |= *((uint16_t *) identify + 109); - wwwn <<= 16; - wwwn |= *((uint16_t *) identify + 110); - wwwn <<= 16; - wwwn |= *((uint16_t *) identify + 111); - printf("ID_WWN=0x%llx\n", (unsigned long long int) wwwn); - /* ATA devices have no vendor extension */ - printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn); - } - - /* from Linux's include/linux/ata.h */ - if (identify_words[0] == 0x848a || identify_words[0] == 0x844a) { - printf("ID_ATA_CFA=1\n"); - } else { - if ((identify_words[83] & 0xc004) == 0x4004) { - printf("ID_ATA_CFA=1\n"); - } - } - } else { - if (serial[0] != '\0') - printf("%s_%s\n", model, serial); - else - printf("%s\n", model); - } + struct udev *udev; + struct hd_driveid id; + uint8_t identify[512]; + uint16_t *identify_words; + char model[41]; + char model_enc[256]; + char serial[21]; + char revision[9]; + const char *node = NULL; + int export = 0; + int fd; + uint16_t word; + int rc = 0; + int is_packet_device = 0; + static const struct option options[] = { + { "export", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("ata_id"); + udev_set_log_fn(udev, log_fn); + + while (1) { + int option; + + option = getopt_long(argc, argv, "xh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'x': + export = 1; + break; + case 'h': + printf("Usage: ata_id [--export] [--help] \n" + " --export print values as environment keys\n" + " --help print this help text\n\n"); + goto exit; + } + } + + node = argv[optind]; + if (node == NULL) { + err(udev, "no node specified\n"); + rc = 1; + goto exit; + } + + fd = open(node, O_RDONLY|O_NONBLOCK); + if (fd < 0) { + err(udev, "unable to open '%s'\n", node); + rc = 1; + goto exit; + } + + if (disk_identify(udev, fd, identify, &is_packet_device) == 0) { + /* + * fix up only the fields from the IDENTIFY data that we are going to + * use and copy it into the hd_driveid struct for convenience + */ + disk_identify_fixup_string (identify, 10, 20); /* serial */ + disk_identify_fixup_string (identify, 23, 6); /* fwrev */ + disk_identify_fixup_string (identify, 27, 40); /* model */ + disk_identify_fixup_uint16 (identify, 0); /* configuration */ + disk_identify_fixup_uint16 (identify, 75); /* queue depth */ + disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ + disk_identify_fixup_uint16 (identify, 82); /* command set supported */ + disk_identify_fixup_uint16 (identify, 83); /* command set supported */ + disk_identify_fixup_uint16 (identify, 84); /* command set supported */ + disk_identify_fixup_uint16 (identify, 85); /* command set supported */ + disk_identify_fixup_uint16 (identify, 86); /* command set supported */ + disk_identify_fixup_uint16 (identify, 87); /* command set supported */ + disk_identify_fixup_uint16 (identify, 89); /* time required for SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 90); /* time required for enhanced SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 91); /* current APM values */ + disk_identify_fixup_uint16 (identify, 94); /* current AAM value */ + disk_identify_fixup_uint16 (identify, 128); /* device lock function */ + disk_identify_fixup_uint16 (identify, 217); /* nominal media rotation rate */ + memcpy(&id, identify, sizeof id); + } else { + /* If this fails, then try HDIO_GET_IDENTITY */ + if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) { + if (errno == ENOTTY) { + info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); + rc = 2; + } else { + err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); + rc = 3; + } + goto close; + } + } + identify_words = (uint16_t *) identify; + + memcpy (model, id.model, 40); + model[40] = '\0'; + udev_util_encode_string(model, model_enc, sizeof(model_enc)); + util_replace_whitespace((char *) id.model, model, 40); + util_replace_chars(model, NULL); + util_replace_whitespace((char *) id.serial_no, serial, 20); + util_replace_chars(serial, NULL); + util_replace_whitespace((char *) id.fw_rev, revision, 8); + util_replace_chars(revision, NULL); + + if (export) { + /* Set this to convey the disk speaks the ATA protocol */ + printf("ID_ATA=1\n"); + + if ((id.config >> 8) & 0x80) { + /* This is an ATAPI device */ + switch ((id.config >> 8) & 0x1f) { + case 0: + printf("ID_TYPE=cd\n"); + break; + case 1: + printf("ID_TYPE=tape\n"); + break; + case 5: + printf("ID_TYPE=cd\n"); + break; + case 7: + printf("ID_TYPE=optical\n"); + break; + default: + printf("ID_TYPE=generic\n"); + break; + } + } else { + printf("ID_TYPE=disk\n"); + } + printf("ID_BUS=ata\n"); + printf("ID_MODEL=%s\n", model); + printf("ID_MODEL_ENC=%s\n", model_enc); + printf("ID_REVISION=%s\n", revision); + if (serial[0] != '\0') { + printf("ID_SERIAL=%s_%s\n", model, serial); + printf("ID_SERIAL_SHORT=%s\n", serial); + } else { + printf("ID_SERIAL=%s\n", model); + } + + if (id.command_set_1 & (1<<5)) { + printf ("ID_ATA_WRITE_CACHE=1\n"); + printf ("ID_ATA_WRITE_CACHE_ENABLED=%d\n", (id.cfs_enable_1 & (1<<5)) ? 1 : 0); + } + if (id.command_set_1 & (1<<10)) { + printf("ID_ATA_FEATURE_SET_HPA=1\n"); + printf("ID_ATA_FEATURE_SET_HPA_ENABLED=%d\n", (id.cfs_enable_1 & (1<<10)) ? 1 : 0); + + /* + * TODO: use the READ NATIVE MAX ADDRESS command to get the native max address + * so it is easy to check whether the protected area is in use. + */ + } + if (id.command_set_1 & (1<<3)) { + printf("ID_ATA_FEATURE_SET_PM=1\n"); + printf("ID_ATA_FEATURE_SET_PM_ENABLED=%d\n", (id.cfs_enable_1 & (1<<3)) ? 1 : 0); + } + if (id.command_set_1 & (1<<1)) { + printf("ID_ATA_FEATURE_SET_SECURITY=1\n"); + printf("ID_ATA_FEATURE_SET_SECURITY_ENABLED=%d\n", (id.cfs_enable_1 & (1<<1)) ? 1 : 0); + printf("ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=%d\n", id.trseuc * 2); + if ((id.cfs_enable_1 & (1<<1))) /* enabled */ { + if (id.dlf & (1<<8)) + printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=maximum\n"); + else + printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=high\n"); + } + if (id.dlf & (1<<5)) + printf("ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=%d\n", id.trsEuc * 2); + if (id.dlf & (1<<4)) + printf("ID_ATA_FEATURE_SET_SECURITY_EXPIRE=1\n"); + if (id.dlf & (1<<3)) + printf("ID_ATA_FEATURE_SET_SECURITY_FROZEN=1\n"); + if (id.dlf & (1<<2)) + printf("ID_ATA_FEATURE_SET_SECURITY_LOCKED=1\n"); + } + if (id.command_set_1 & (1<<0)) { + printf("ID_ATA_FEATURE_SET_SMART=1\n"); + printf("ID_ATA_FEATURE_SET_SMART_ENABLED=%d\n", (id.cfs_enable_1 & (1<<0)) ? 1 : 0); + } + if (id.command_set_2 & (1<<9)) { + printf("ID_ATA_FEATURE_SET_AAM=1\n"); + printf("ID_ATA_FEATURE_SET_AAM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<9)) ? 1 : 0); + printf("ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=%d\n", id.acoustic >> 8); + printf("ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=%d\n", id.acoustic & 0xff); + } + if (id.command_set_2 & (1<<5)) { + printf("ID_ATA_FEATURE_SET_PUIS=1\n"); + printf("ID_ATA_FEATURE_SET_PUIS_ENABLED=%d\n", (id.cfs_enable_2 & (1<<5)) ? 1 : 0); + } + if (id.command_set_2 & (1<<3)) { + printf("ID_ATA_FEATURE_SET_APM=1\n"); + printf("ID_ATA_FEATURE_SET_APM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<3)) ? 1 : 0); + if ((id.cfs_enable_2 & (1<<3))) + printf("ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=%d\n", id.CurAPMvalues & 0xff); + } + if (id.command_set_2 & (1<<0)) + printf("ID_ATA_DOWNLOAD_MICROCODE=1\n"); + + /* + * Word 76 indicates the capabilities of a SATA device. A PATA device shall set + * word 76 to 0000h or FFFFh. If word 76 is set to 0000h or FFFFh, then + * the device does not claim compliance with the Serial ATA specification and words + * 76 through 79 are not valid and shall be ignored. + */ + word = *((uint16_t *) identify + 76); + if (word != 0x0000 && word != 0xffff) { + printf("ID_ATA_SATA=1\n"); + /* + * If bit 2 of word 76 is set to one, then the device supports the Gen2 + * signaling rate of 3.0 Gb/s (see SATA 2.6). + * + * If bit 1 of word 76 is set to one, then the device supports the Gen1 + * signaling rate of 1.5 Gb/s (see SATA 2.6). + */ + if (word & (1<<2)) + printf("ID_ATA_SATA_SIGNAL_RATE_GEN2=1\n"); + if (word & (1<<1)) + printf("ID_ATA_SATA_SIGNAL_RATE_GEN1=1\n"); + } + + /* Word 217 indicates the nominal media rotation rate of the device */ + word = *((uint16_t *) identify + 217); + if (word != 0x0000) { + if (word == 0x0001) { + printf ("ID_ATA_ROTATION_RATE_RPM=0\n"); /* non-rotating e.g. SSD */ + } else if (word >= 0x0401 && word <= 0xfffe) { + printf ("ID_ATA_ROTATION_RATE_RPM=%d\n", word); + } + } + + /* + * Words 108-111 contain a mandatory World Wide Name (WWN) in the NAA IEEE Registered identifier + * format. Word 108 bits (15:12) shall contain 5h, indicating that the naming authority is IEEE. + * All other values are reserved. + */ + word = *((uint16_t *) identify + 108); + if ((word & 0xf000) == 0x5000) { + uint64_t wwwn; + + wwwn = *((uint16_t *) identify + 108); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 109); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 110); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 111); + printf("ID_WWN=0x%llx\n", (unsigned long long int) wwwn); + /* ATA devices have no vendor extension */ + printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn); + } + + /* from Linux's include/linux/ata.h */ + if (identify_words[0] == 0x848a || identify_words[0] == 0x844a) { + printf("ID_ATA_CFA=1\n"); + } else { + if ((identify_words[83] & 0xc004) == 0x4004) { + printf("ID_ATA_CFA=1\n"); + } + } + } else { + if (serial[0] != '\0') + printf("%s_%s\n", model, serial); + else + printf("%s\n", model); + } close: - close(fd); + close(fd); exit: - udev_unref(udev); - udev_log_close(); - return rc; + udev_unref(udev); + udev_log_close(); + return rc; } diff --git a/src/extras/cdrom_id/cdrom_id.c b/src/extras/cdrom_id/cdrom_id.c index 664a00d2c7..daaebee14e 100644 --- a/src/extras/cdrom_id/cdrom_id.c +++ b/src/extras/cdrom_id/cdrom_id.c @@ -44,15 +44,15 @@ static bool debug; static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) + const char *file, int line, const char *fn, + const char *format, va_list args) { - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } } /* device info */ @@ -110,990 +110,990 @@ static unsigned int cd_media_track_count_data = 0; static unsigned int cd_media_track_count_audio = 0; static unsigned long long int cd_media_session_last_offset = 0; -#define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) -#define SK(errcode) (((errcode) >> 16) & 0xF) -#define ASC(errcode) (((errcode) >> 8) & 0xFF) -#define ASCQ(errcode) ((errcode) & 0xFF) +#define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) +#define SK(errcode) (((errcode) >> 16) & 0xF) +#define ASC(errcode) (((errcode) >> 8) & 0xFF) +#define ASCQ(errcode) ((errcode) & 0xFF) static int is_mounted(const char *device) { - struct stat statbuf; - FILE *fp; - int maj, min; - int mounted = 0; - - if (stat(device, &statbuf) < 0) - return -ENODEV; - - fp = fopen("/proc/self/mountinfo", "r"); - if (fp == NULL) - return -ENOSYS; - while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { - if (makedev(maj, min) == statbuf.st_rdev) { - mounted = 1; - break; - } - } - fclose(fp); - return mounted; + struct stat statbuf; + FILE *fp; + int maj, min; + int mounted = 0; + + if (stat(device, &statbuf) < 0) + return -ENODEV; + + fp = fopen("/proc/self/mountinfo", "r"); + if (fp == NULL) + return -ENOSYS; + while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { + if (makedev(maj, min) == statbuf.st_rdev) { + mounted = 1; + break; + } + } + fclose(fp); + return mounted; } static void info_scsi_cmd_err(struct udev *udev, char *cmd, int err) { - if (err == -1) { - info(udev, "%s failed\n", cmd); - return; - } - info(udev, "%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); + if (err == -1) { + info(udev, "%s failed\n", cmd); + return; + } + info(udev, "%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); } struct scsi_cmd { - struct cdrom_generic_command cgc; - union { - struct request_sense s; - unsigned char u[18]; - } _sense; - struct sg_io_hdr sg_io; + struct cdrom_generic_command cgc; + union { + struct request_sense s; + unsigned char u[18]; + } _sense; + struct sg_io_hdr sg_io; }; static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd) { - memset(cmd, 0x00, sizeof(struct scsi_cmd)); - cmd->cgc.quiet = 1; - cmd->cgc.sense = &cmd->_sense.s; - cmd->sg_io.interface_id = 'S'; - cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); - cmd->sg_io.cmdp = cmd->cgc.cmd; - cmd->sg_io.sbp = cmd->_sense.u; - cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; + memset(cmd, 0x00, sizeof(struct scsi_cmd)); + cmd->cgc.quiet = 1; + cmd->cgc.sense = &cmd->_sense.s; + cmd->sg_io.interface_id = 'S'; + cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); + cmd->sg_io.cmdp = cmd->cgc.cmd; + cmd->sg_io.sbp = cmd->_sense.u; + cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; } static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg) { - cmd->sg_io.cmd_len = i + 1; - cmd->cgc.cmd[i] = arg; + cmd->sg_io.cmd_len = i + 1; + cmd->cgc.cmd[i] = arg; } #define CHECK_CONDITION 0x01 static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize) { - int ret = 0; - - if (bufsize > 0) { - cmd->sg_io.dxferp = buf; - cmd->sg_io.dxfer_len = bufsize; - cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; - } else { - cmd->sg_io.dxfer_direction = SG_DXFER_NONE; - } - if (ioctl(fd, SG_IO, &cmd->sg_io)) - return -1; - - if ((cmd->sg_io.info & SG_INFO_OK_MASK) != SG_INFO_OK) { - errno = EIO; - ret = -1; - if (cmd->sg_io.masked_status & CHECK_CONDITION) { - ret = ERRCODE(cmd->_sense.u); - if (ret == 0) - ret = -1; - } - } - return ret; + int ret = 0; + + if (bufsize > 0) { + cmd->sg_io.dxferp = buf; + cmd->sg_io.dxfer_len = bufsize; + cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + } else { + cmd->sg_io.dxfer_direction = SG_DXFER_NONE; + } + if (ioctl(fd, SG_IO, &cmd->sg_io)) + return -1; + + if ((cmd->sg_io.info & SG_INFO_OK_MASK) != SG_INFO_OK) { + errno = EIO; + ret = -1; + if (cmd->sg_io.masked_status & CHECK_CONDITION) { + ret = ERRCODE(cmd->_sense.u); + if (ret == 0) + ret = -1; + } + } + return ret; } static int media_lock(struct udev *udev, int fd, bool lock) { - int err; + int err; - /* disable the kernel's lock logic */ - err = ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK); - if (err < 0) - info(udev, "CDROM_CLEAR_OPTIONS, CDO_LOCK failed\n"); + /* disable the kernel's lock logic */ + err = ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK); + if (err < 0) + info(udev, "CDROM_CLEAR_OPTIONS, CDO_LOCK failed\n"); - err = ioctl(fd, CDROM_LOCKDOOR, lock ? 1 : 0); - if (err < 0) - info(udev, "CDROM_LOCKDOOR failed\n"); + err = ioctl(fd, CDROM_LOCKDOOR, lock ? 1 : 0); + if (err < 0) + info(udev, "CDROM_LOCKDOOR failed\n"); - return err; + return err; } static int media_eject(struct udev *udev, int fd) { - struct scsi_cmd sc; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x1b); - scsi_cmd_set(udev, &sc, 4, 0x02); - scsi_cmd_set(udev, &sc, 5, 0); - err = scsi_cmd_run(udev, &sc, fd, NULL, 0); - if ((err != 0)) { - info_scsi_cmd_err(udev, "START_STOP_UNIT", err); - return -1; - } - return 0; + struct scsi_cmd sc; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x1b); + scsi_cmd_set(udev, &sc, 4, 0x02); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, NULL, 0); + if ((err != 0)) { + info_scsi_cmd_err(udev, "START_STOP_UNIT", err); + return -1; + } + return 0; } static int cd_capability_compat(struct udev *udev, int fd) { - int capability; - - capability = ioctl(fd, CDROM_GET_CAPABILITY, NULL); - if (capability < 0) { - info(udev, "CDROM_GET_CAPABILITY failed\n"); - return -1; - } - - if (capability & CDC_CD_R) - cd_cd_r = 1; - if (capability & CDC_CD_RW) - cd_cd_rw = 1; - if (capability & CDC_DVD) - cd_dvd_rom = 1; - if (capability & CDC_DVD_R) - cd_dvd_r = 1; - if (capability & CDC_DVD_RAM) - cd_dvd_ram = 1; - if (capability & CDC_MRW) - cd_mrw = 1; - if (capability & CDC_MRW_W) - cd_mrw_w = 1; - return 0; + int capability; + + capability = ioctl(fd, CDROM_GET_CAPABILITY, NULL); + if (capability < 0) { + info(udev, "CDROM_GET_CAPABILITY failed\n"); + return -1; + } + + if (capability & CDC_CD_R) + cd_cd_r = 1; + if (capability & CDC_CD_RW) + cd_cd_rw = 1; + if (capability & CDC_DVD) + cd_dvd_rom = 1; + if (capability & CDC_DVD_R) + cd_dvd_r = 1; + if (capability & CDC_DVD_RAM) + cd_dvd_ram = 1; + if (capability & CDC_MRW) + cd_mrw = 1; + if (capability & CDC_MRW_W) + cd_mrw_w = 1; + return 0; } static int cd_media_compat(struct udev *udev, int fd) { - if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) { - info(udev, "CDROM_DRIVE_STATUS != CDS_DISC_OK\n"); - return -1; - } - cd_media = 1; - return 0; + if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) { + info(udev, "CDROM_DRIVE_STATUS != CDS_DISC_OK\n"); + return -1; + } + cd_media = 1; + return 0; } static int cd_inquiry(struct udev *udev, int fd) { - struct scsi_cmd sc; - unsigned char inq[128]; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x12); - scsi_cmd_set(udev, &sc, 4, 36); - scsi_cmd_set(udev, &sc, 5, 0); - err = scsi_cmd_run(udev, &sc, fd, inq, 36); - if ((err != 0)) { - info_scsi_cmd_err(udev, "INQUIRY", err); - return -1; - } - - if ((inq[0] & 0x1F) != 5) { - info(udev, "not an MMC unit\n"); - return -1; - } - - info(udev, "INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); - return 0; + struct scsi_cmd sc; + unsigned char inq[128]; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x12); + scsi_cmd_set(udev, &sc, 4, 36); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, inq, 36); + if ((err != 0)) { + info_scsi_cmd_err(udev, "INQUIRY", err); + return -1; + } + + if ((inq[0] & 0x1F) != 5) { + info(udev, "not an MMC unit\n"); + return -1; + } + + info(udev, "INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); + return 0; } static void feature_profile_media(struct udev *udev, int cur_profile) { - switch (cur_profile) { - case 0x03: - case 0x04: - case 0x05: - info(udev, "profile 0x%02x \n", cur_profile); - cd_media = 1; - cd_media_mo = 1; - break; - case 0x08: - info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); - cd_media = 1; - cd_media_cd_rom = 1; - break; - case 0x09: - info(udev, "profile 0x%02x media_cd_r\n", cur_profile); - cd_media = 1; - cd_media_cd_r = 1; - break; - case 0x0a: - info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); - cd_media = 1; - cd_media_cd_rw = 1; - break; - case 0x10: - info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rom = 1; - break; - case 0x11: - info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_r = 1; - break; - case 0x12: - info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); - cd_media = 1; - cd_media_dvd_ram = 1; - break; - case 0x13: - info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_ro = 1; - break; - case 0x14: - info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_seq = 1; - break; - case 0x1B: - info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r = 1; - break; - case 0x1A: - info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw = 1; - break; - case 0x2A: - info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw_dl = 1; - break; - case 0x2B: - info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r_dl = 1; - break; - case 0x40: - info(udev, "profile 0x%02x media_bd\n", cur_profile); - cd_media = 1; - cd_media_bd = 1; - break; - case 0x41: - case 0x42: - info(udev, "profile 0x%02x media_bd_r\n", cur_profile); - cd_media = 1; - cd_media_bd_r = 1; - break; - case 0x43: - info(udev, "profile 0x%02x media_bd_re\n", cur_profile); - cd_media = 1; - cd_media_bd_re = 1; - break; - case 0x50: - info(udev, "profile 0x%02x media_hddvd\n", cur_profile); - cd_media = 1; - cd_media_hddvd = 1; - break; - case 0x51: - info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); - cd_media = 1; - cd_media_hddvd_r = 1; - break; - case 0x52: - info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); - cd_media = 1; - cd_media_hddvd_rw = 1; - break; - default: - info(udev, "profile 0x%02x \n", cur_profile); - break; - } + switch (cur_profile) { + case 0x03: + case 0x04: + case 0x05: + info(udev, "profile 0x%02x \n", cur_profile); + cd_media = 1; + cd_media_mo = 1; + break; + case 0x08: + info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); + cd_media = 1; + cd_media_cd_rom = 1; + break; + case 0x09: + info(udev, "profile 0x%02x media_cd_r\n", cur_profile); + cd_media = 1; + cd_media_cd_r = 1; + break; + case 0x0a: + info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); + cd_media = 1; + cd_media_cd_rw = 1; + break; + case 0x10: + info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rom = 1; + break; + case 0x11: + info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_r = 1; + break; + case 0x12: + info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); + cd_media = 1; + cd_media_dvd_ram = 1; + break; + case 0x13: + info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_ro = 1; + break; + case 0x14: + info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_seq = 1; + break; + case 0x1B: + info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r = 1; + break; + case 0x1A: + info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw = 1; + break; + case 0x2A: + info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw_dl = 1; + break; + case 0x2B: + info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r_dl = 1; + break; + case 0x40: + info(udev, "profile 0x%02x media_bd\n", cur_profile); + cd_media = 1; + cd_media_bd = 1; + break; + case 0x41: + case 0x42: + info(udev, "profile 0x%02x media_bd_r\n", cur_profile); + cd_media = 1; + cd_media_bd_r = 1; + break; + case 0x43: + info(udev, "profile 0x%02x media_bd_re\n", cur_profile); + cd_media = 1; + cd_media_bd_re = 1; + break; + case 0x50: + info(udev, "profile 0x%02x media_hddvd\n", cur_profile); + cd_media = 1; + cd_media_hddvd = 1; + break; + case 0x51: + info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); + cd_media = 1; + cd_media_hddvd_r = 1; + break; + case 0x52: + info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); + cd_media = 1; + cd_media_hddvd_rw = 1; + break; + default: + info(udev, "profile 0x%02x \n", cur_profile); + break; + } } static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) { - unsigned int i; - - for (i = 0; i+4 <= size; i += 4) { - int profile; - - profile = profiles[i] << 8 | profiles[i+1]; - switch (profile) { - case 0x03: - case 0x04: - case 0x05: - info(udev, "profile 0x%02x mo\n", profile); - cd_mo = 1; - break; - case 0x08: - info(udev, "profile 0x%02x cd_rom\n", profile); - cd_cd_rom = 1; - break; - case 0x09: - info(udev, "profile 0x%02x cd_r\n", profile); - cd_cd_r = 1; - break; - case 0x0A: - info(udev, "profile 0x%02x cd_rw\n", profile); - cd_cd_rw = 1; - break; - case 0x10: - info(udev, "profile 0x%02x dvd_rom\n", profile); - cd_dvd_rom = 1; - break; - case 0x12: - info(udev, "profile 0x%02x dvd_ram\n", profile); - cd_dvd_ram = 1; - break; - case 0x13: - case 0x14: - info(udev, "profile 0x%02x dvd_rw\n", profile); - cd_dvd_rw = 1; - break; - case 0x1B: - info(udev, "profile 0x%02x dvd_plus_r\n", profile); - cd_dvd_plus_r = 1; - break; - case 0x1A: - info(udev, "profile 0x%02x dvd_plus_rw\n", profile); - cd_dvd_plus_rw = 1; - break; - case 0x2A: - info(udev, "profile 0x%02x dvd_plus_rw_dl\n", profile); - cd_dvd_plus_rw_dl = 1; - break; - case 0x2B: - info(udev, "profile 0x%02x dvd_plus_r_dl\n", profile); - cd_dvd_plus_r_dl = 1; - break; - case 0x40: - cd_bd = 1; - info(udev, "profile 0x%02x bd\n", profile); - break; - case 0x41: - case 0x42: - cd_bd_r = 1; - info(udev, "profile 0x%02x bd_r\n", profile); - break; - case 0x43: - cd_bd_re = 1; - info(udev, "profile 0x%02x bd_re\n", profile); - break; - case 0x50: - cd_hddvd = 1; - info(udev, "profile 0x%02x hddvd\n", profile); - break; - case 0x51: - cd_hddvd_r = 1; - info(udev, "profile 0x%02x hddvd_r\n", profile); - break; - case 0x52: - cd_hddvd_rw = 1; - info(udev, "profile 0x%02x hddvd_rw\n", profile); - break; - default: - info(udev, "profile 0x%02x \n", profile); - break; - } - } - return 0; + unsigned int i; + + for (i = 0; i+4 <= size; i += 4) { + int profile; + + profile = profiles[i] << 8 | profiles[i+1]; + switch (profile) { + case 0x03: + case 0x04: + case 0x05: + info(udev, "profile 0x%02x mo\n", profile); + cd_mo = 1; + break; + case 0x08: + info(udev, "profile 0x%02x cd_rom\n", profile); + cd_cd_rom = 1; + break; + case 0x09: + info(udev, "profile 0x%02x cd_r\n", profile); + cd_cd_r = 1; + break; + case 0x0A: + info(udev, "profile 0x%02x cd_rw\n", profile); + cd_cd_rw = 1; + break; + case 0x10: + info(udev, "profile 0x%02x dvd_rom\n", profile); + cd_dvd_rom = 1; + break; + case 0x12: + info(udev, "profile 0x%02x dvd_ram\n", profile); + cd_dvd_ram = 1; + break; + case 0x13: + case 0x14: + info(udev, "profile 0x%02x dvd_rw\n", profile); + cd_dvd_rw = 1; + break; + case 0x1B: + info(udev, "profile 0x%02x dvd_plus_r\n", profile); + cd_dvd_plus_r = 1; + break; + case 0x1A: + info(udev, "profile 0x%02x dvd_plus_rw\n", profile); + cd_dvd_plus_rw = 1; + break; + case 0x2A: + info(udev, "profile 0x%02x dvd_plus_rw_dl\n", profile); + cd_dvd_plus_rw_dl = 1; + break; + case 0x2B: + info(udev, "profile 0x%02x dvd_plus_r_dl\n", profile); + cd_dvd_plus_r_dl = 1; + break; + case 0x40: + cd_bd = 1; + info(udev, "profile 0x%02x bd\n", profile); + break; + case 0x41: + case 0x42: + cd_bd_r = 1; + info(udev, "profile 0x%02x bd_r\n", profile); + break; + case 0x43: + cd_bd_re = 1; + info(udev, "profile 0x%02x bd_re\n", profile); + break; + case 0x50: + cd_hddvd = 1; + info(udev, "profile 0x%02x hddvd\n", profile); + break; + case 0x51: + cd_hddvd_r = 1; + info(udev, "profile 0x%02x hddvd_r\n", profile); + break; + case 0x52: + cd_hddvd_rw = 1; + info(udev, "profile 0x%02x hddvd_rw\n", profile); + break; + default: + info(udev, "profile 0x%02x \n", profile); + break; + } + } + return 0; } /* returns 0 if media was detected */ static int cd_profiles_old_mmc(struct udev *udev, int fd) { - struct scsi_cmd sc; - int err; - - unsigned char header[32]; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - if (cd_media == 1) { - info(udev, "no current profile, but disc is present; assuming CD-ROM\n"); - cd_media_cd_rom = 1; - return 0; - } else { - info(udev, "no current profile, assuming no media\n"); - return -1; - } - }; - - cd_media = 1; - - if (header[2] & 16) { - cd_media_cd_rw = 1; - info(udev, "profile 0x0a media_cd_rw\n"); - } else if ((header[2] & 3) < 2 && cd_cd_r) { - cd_media_cd_r = 1; - info(udev, "profile 0x09 media_cd_r\n"); - } else { - cd_media_cd_rom = 1; - info(udev, "profile 0x08 media_cd_rom\n"); - } - return 0; + struct scsi_cmd sc; + int err; + + unsigned char header[32]; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); + if (cd_media == 1) { + info(udev, "no current profile, but disc is present; assuming CD-ROM\n"); + cd_media_cd_rom = 1; + return 0; + } else { + info(udev, "no current profile, assuming no media\n"); + return -1; + } + }; + + cd_media = 1; + + if (header[2] & 16) { + cd_media_cd_rw = 1; + info(udev, "profile 0x0a media_cd_rw\n"); + } else if ((header[2] & 3) < 2 && cd_cd_r) { + cd_media_cd_r = 1; + info(udev, "profile 0x09 media_cd_r\n"); + } else { + cd_media_cd_rom = 1; + info(udev, "profile 0x08 media_cd_rom\n"); + } + return 0; } /* returns 0 if media was detected */ static int cd_profiles(struct udev *udev, int fd) { - struct scsi_cmd sc; - unsigned char features[65530]; - unsigned int cur_profile = 0; - unsigned int len; - unsigned int i; - int err; - int ret; - - ret = -1; - - /* First query the current profile */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 8, 8); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, features, 8); - if ((err != 0)) { - info_scsi_cmd_err(udev, "GET CONFIGURATION", err); - /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ - if (SK(err) == 0x5 && ASC(err) == 0x20) { - info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n"); - info(udev, "trying to work around the problem\n"); - ret = cd_profiles_old_mmc(udev, fd); - } - goto out; - } - - cur_profile = features[6] << 8 | features[7]; - if (cur_profile > 0) { - info(udev, "current profile 0x%02x\n", cur_profile); - feature_profile_media (udev, cur_profile); - ret = 0; /* we have media */ - } else { - info(udev, "no current profile, assuming no media\n"); - } - - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; - info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); - - if (len > sizeof(features)) { - info(udev, "can not get features in a single query, truncating\n"); - len = sizeof(features); - } else if (len <= 8) { - len = sizeof(features); - } - - /* Now get the full feature buffer */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff); - scsi_cmd_set(udev, &sc, 8, len & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, features, len); - if ((err != 0)) { - info_scsi_cmd_err(udev, "GET CONFIGURATION", err); - return -1; - } - - /* parse the length once more, in case the drive decided to have other features suddenly :) */ - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; - info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); - - if (len > sizeof(features)) { - info(udev, "can not get features in a single query, truncating\n"); - len = sizeof(features); - } - - /* device features */ - for (i = 8; i+4 < len; i += (4 + features[i+3])) { - unsigned int feature; - - feature = features[i] << 8 | features[i+1]; - - switch (feature) { - case 0x00: - info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); - feature_profiles(udev, &features[i]+4, features[i+3]); - break; - default: - info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); - break; - } - } + struct scsi_cmd sc; + unsigned char features[65530]; + unsigned int cur_profile = 0; + unsigned int len; + unsigned int i; + int err; + int ret; + + ret = -1; + + /* First query the current profile */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 8, 8); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, features, 8); + if ((err != 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ + if (SK(err) == 0x5 && ASC(err) == 0x20) { + info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n"); + info(udev, "trying to work around the problem\n"); + ret = cd_profiles_old_mmc(udev, fd); + } + goto out; + } + + cur_profile = features[6] << 8 | features[7]; + if (cur_profile > 0) { + info(udev, "current profile 0x%02x\n", cur_profile); + feature_profile_media (udev, cur_profile); + ret = 0; /* we have media */ + } else { + info(udev, "no current profile, assuming no media\n"); + } + + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; + info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); + len = sizeof(features); + } else if (len <= 8) { + len = sizeof(features); + } + + /* Now get the full feature buffer */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff); + scsi_cmd_set(udev, &sc, 8, len & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, features, len); + if ((err != 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + return -1; + } + + /* parse the length once more, in case the drive decided to have other features suddenly :) */ + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; + info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); + len = sizeof(features); + } + + /* device features */ + for (i = 8; i+4 < len; i += (4 + features[i+3])) { + unsigned int feature; + + feature = features[i] << 8 | features[i+1]; + + switch (feature) { + case 0x00: + info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); + feature_profiles(udev, &features[i]+4, features[i+3]); + break; + default: + info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); + break; + } + } out: - return ret; + return ret; } static int cd_media_info(struct udev *udev, int fd) { - struct scsi_cmd sc; - unsigned char header[32]; - static const char *media_status[] = { - "blank", - "appendable", - "complete", - "other" - }; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - return -1; - }; - - cd_media = 1; - info(udev, "disk type %02x\n", header[8]); - info(udev, "hardware reported media status: %s\n", media_status[header[2] & 3]); - - /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ - if (!cd_media_cd_rom) - cd_media_state = media_status[header[2] & 3]; - - /* fresh DVD-RW in restricted overwite mode reports itself as - * "appendable"; change it to "blank" to make it consistent with what - * gets reported after blanking, and what userspace expects */ - if (cd_media_dvd_rw_ro && (header[2] & 3) == 1) - cd_media_state = media_status[0]; - - /* DVD+RW discs (and DVD-RW in restricted mode) once formatted are - * always "complete", DVD-RAM are "other" or "complete" if the disc is - * write protected; we need to check the contents if it is blank */ - if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { - unsigned char buffer[32 * 2048]; - unsigned char result, len; - int block, offset; - - if (cd_media_dvd_ram) { - /* a write protected dvd-ram may report "complete" status */ - - unsigned char dvdstruct[8]; - unsigned char format[12]; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0xAD); - scsi_cmd_set(udev, &sc, 7, 0xC0); - scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); - scsi_cmd_set(udev, &sc, 11, 0); - err = scsi_cmd_run(udev, &sc, fd, dvdstruct, sizeof(dvdstruct)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DVD STRUCTURE", err); - return -1; - } - if (dvdstruct[4] & 0x02) { - cd_media_state = media_status[2]; - info(udev, "write-protected DVD-RAM media inserted\n"); - goto determined; - } - - /* let's make sure we don't try to read unformatted media */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x23); - scsi_cmd_set(udev, &sc, 8, sizeof(format)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, format, sizeof(format)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DVD FORMAT CAPACITIES", err); - return -1; - } - - len = format[3]; - if (len & 7 || len < 16) { - info(udev, "invalid format capacities length\n"); - return -1; - } - - switch(format[8] & 3) { - case 1: - info(udev, "unformatted DVD-RAM media inserted\n"); - /* This means that last format was interrupted - * or failed, blank dvd-ram discs are factory - * formatted. Take no action here as it takes - * quite a while to reformat a dvd-ram and it's - * not automatically started */ - goto determined; - - case 2: - info(udev, "formatted DVD-RAM media inserted\n"); - break; - - case 3: - cd_media = 0; //return no media - info(udev, "format capacities returned no media\n"); - return -1; - } - } - - /* Take a closer look at formatted media (unformatted DVD+RW - * has "blank" status", DVD-RAM was examined earlier) and check - * for ISO and UDF PVDs or a fs superblock presence and do it - * in one ioctl (we need just sectors 0 and 16) */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x28); - scsi_cmd_set(udev, &sc, 5, 0); - scsi_cmd_set(udev, &sc, 8, 32); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); - if ((err != 0)) { - cd_media = 0; - info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err); - return -1; - } - - /* if any non-zero data is found in sector 16 (iso and udf) or - * eventually 0 (fat32 boot sector, ext2 superblock, etc), disc - * is assumed non-blank */ - result = 0; - - for (block = 32768; block >= 0 && !result; block -= 32768) { - offset = block; - while (offset < (block + 2048) && !result) { - result = buffer [offset]; - offset++; - } - } - - if (!result) { - cd_media_state = media_status[0]; - info(udev, "no data in blocks 0 or 16, assuming blank\n"); - } else { - info(udev, "data in blocks 0 or 16, assuming complete\n"); - } - } + struct scsi_cmd sc; + unsigned char header[32]; + static const char *media_status[] = { + "blank", + "appendable", + "complete", + "other" + }; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); + return -1; + }; + + cd_media = 1; + info(udev, "disk type %02x\n", header[8]); + info(udev, "hardware reported media status: %s\n", media_status[header[2] & 3]); + + /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ + if (!cd_media_cd_rom) + cd_media_state = media_status[header[2] & 3]; + + /* fresh DVD-RW in restricted overwite mode reports itself as + * "appendable"; change it to "blank" to make it consistent with what + * gets reported after blanking, and what userspace expects */ + if (cd_media_dvd_rw_ro && (header[2] & 3) == 1) + cd_media_state = media_status[0]; + + /* DVD+RW discs (and DVD-RW in restricted mode) once formatted are + * always "complete", DVD-RAM are "other" or "complete" if the disc is + * write protected; we need to check the contents if it is blank */ + if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { + unsigned char buffer[32 * 2048]; + unsigned char result, len; + int block, offset; + + if (cd_media_dvd_ram) { + /* a write protected dvd-ram may report "complete" status */ + + unsigned char dvdstruct[8]; + unsigned char format[12]; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0xAD); + scsi_cmd_set(udev, &sc, 7, 0xC0); + scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); + scsi_cmd_set(udev, &sc, 11, 0); + err = scsi_cmd_run(udev, &sc, fd, dvdstruct, sizeof(dvdstruct)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DVD STRUCTURE", err); + return -1; + } + if (dvdstruct[4] & 0x02) { + cd_media_state = media_status[2]; + info(udev, "write-protected DVD-RAM media inserted\n"); + goto determined; + } + + /* let's make sure we don't try to read unformatted media */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x23); + scsi_cmd_set(udev, &sc, 8, sizeof(format)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, format, sizeof(format)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DVD FORMAT CAPACITIES", err); + return -1; + } + + len = format[3]; + if (len & 7 || len < 16) { + info(udev, "invalid format capacities length\n"); + return -1; + } + + switch(format[8] & 3) { + case 1: + info(udev, "unformatted DVD-RAM media inserted\n"); + /* This means that last format was interrupted + * or failed, blank dvd-ram discs are factory + * formatted. Take no action here as it takes + * quite a while to reformat a dvd-ram and it's + * not automatically started */ + goto determined; + + case 2: + info(udev, "formatted DVD-RAM media inserted\n"); + break; + + case 3: + cd_media = 0; //return no media + info(udev, "format capacities returned no media\n"); + return -1; + } + } + + /* Take a closer look at formatted media (unformatted DVD+RW + * has "blank" status", DVD-RAM was examined earlier) and check + * for ISO and UDF PVDs or a fs superblock presence and do it + * in one ioctl (we need just sectors 0 and 16) */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x28); + scsi_cmd_set(udev, &sc, 5, 0); + scsi_cmd_set(udev, &sc, 8, 32); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); + if ((err != 0)) { + cd_media = 0; + info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err); + return -1; + } + + /* if any non-zero data is found in sector 16 (iso and udf) or + * eventually 0 (fat32 boot sector, ext2 superblock, etc), disc + * is assumed non-blank */ + result = 0; + + for (block = 32768; block >= 0 && !result; block -= 32768) { + offset = block; + while (offset < (block + 2048) && !result) { + result = buffer [offset]; + offset++; + } + } + + if (!result) { + cd_media_state = media_status[0]; + info(udev, "no data in blocks 0 or 16, assuming blank\n"); + } else { + info(udev, "data in blocks 0 or 16, assuming complete\n"); + } + } determined: - /* "other" is e. g. DVD-RAM, can't append sessions there; DVDs in - * restricted overwrite mode can never append, only in sequential mode */ - if ((header[2] & 3) < 2 && !cd_media_dvd_rw_ro) - cd_media_session_next = header[10] << 8 | header[5]; - cd_media_session_count = header[9] << 8 | header[4]; - cd_media_track_count = header[11] << 8 | header[6]; - - return 0; + /* "other" is e. g. DVD-RAM, can't append sessions there; DVDs in + * restricted overwrite mode can never append, only in sequential mode */ + if ((header[2] & 3) < 2 && !cd_media_dvd_rw_ro) + cd_media_session_next = header[10] << 8 | header[5]; + cd_media_session_count = header[9] << 8 | header[4]; + cd_media_track_count = header[11] << 8 | header[6]; + + return 0; } static int cd_media_toc(struct udev *udev, int fd) { - struct scsi_cmd sc; - unsigned char header[12]; - unsigned char toc[65536]; - unsigned int len, i, num_tracks; - unsigned char *p; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, 1); - scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC", err); - return -1; - } - - len = (header[0] << 8 | header[1]) + 2; - info(udev, "READ TOC: len: %d, start track: %d, end track: %d\n", len, header[2], header[3]); - if (len > sizeof(toc)) - return -1; - if (len < 2) - return -1; - /* 2: first track, 3: last track */ - num_tracks = header[3] - header[2] + 1; - - /* empty media has no tracks */ - if (len < 8) - return 0; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ - scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); - scsi_cmd_set(udev, &sc, 8, len & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, toc, len); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC (tracks)", err); - return -1; - } - - /* Take care to not iterate beyond the last valid track as specified in - * the TOC, but also avoid going beyond the TOC length, just in case - * the last track number is invalidly large */ - for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) { - unsigned int block; - unsigned int is_data_track; - - is_data_track = (p[1] & 0x04) != 0; - - block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; - info(udev, "track=%u info=0x%x(%s) start_block=%u\n", - p[2], p[1] & 0x0f, is_data_track ? "data":"audio", block); - - if (is_data_track) - cd_media_track_count_data++; - else - cd_media_track_count_audio++; - } - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC (multi session)", err); - return -1; - } - len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; - info(udev, "last track %u starts at block %u\n", header[4+2], len); - cd_media_session_last_offset = (unsigned long long int)len * 2048; - return 0; + struct scsi_cmd sc; + unsigned char header[12]; + unsigned char toc[65536]; + unsigned int len, i, num_tracks; + unsigned char *p; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, 1); + scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC", err); + return -1; + } + + len = (header[0] << 8 | header[1]) + 2; + info(udev, "READ TOC: len: %d, start track: %d, end track: %d\n", len, header[2], header[3]); + if (len > sizeof(toc)) + return -1; + if (len < 2) + return -1; + /* 2: first track, 3: last track */ + num_tracks = header[3] - header[2] + 1; + + /* empty media has no tracks */ + if (len < 8) + return 0; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ + scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); + scsi_cmd_set(udev, &sc, 8, len & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, toc, len); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC (tracks)", err); + return -1; + } + + /* Take care to not iterate beyond the last valid track as specified in + * the TOC, but also avoid going beyond the TOC length, just in case + * the last track number is invalidly large */ + for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) { + unsigned int block; + unsigned int is_data_track; + + is_data_track = (p[1] & 0x04) != 0; + + block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; + info(udev, "track=%u info=0x%x(%s) start_block=%u\n", + p[2], p[1] & 0x0f, is_data_track ? "data":"audio", block); + + if (is_data_track) + cd_media_track_count_data++; + else + cd_media_track_count_audio++; + } + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC (multi session)", err); + return -1; + } + len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; + info(udev, "last track %u starts at block %u\n", header[4+2], len); + cd_media_session_last_offset = (unsigned long long int)len * 2048; + return 0; } int main(int argc, char *argv[]) { - struct udev *udev; - static const struct option options[] = { - { "lock-media", no_argument, NULL, 'l' }, - { "unlock-media", no_argument, NULL, 'u' }, - { "eject-media", no_argument, NULL, 'e' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - bool eject = false; - bool lock = false; - bool unlock = false; - const char *node = NULL; - int fd = -1; - int cnt; - int rc = 0; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("cdrom_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "deluh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'l': - lock = true; - break; - case 'u': - unlock = true; - break; - case 'e': - eject = true; - break; - case 'd': - debug = true; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("Usage: cdrom_id [options] \n" - " --lock-media lock the media (to enable eject request events)\n" - " --unlock-media unlock the media\n" - " --eject-media eject the media\n" - " --debug debug to stderr\n" - " --help print this help text\n\n"); - goto exit; - default: - rc = 1; - goto exit; - } - } - - node = argv[optind]; - if (!node) { - err(udev, "no device\n"); - fprintf(stderr, "no device\n"); - rc = 1; - goto exit; - } - - srand((unsigned int)getpid()); - for (cnt = 20; cnt > 0; cnt--) { - struct timespec duration; - - fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); - if (fd >= 0 || errno != EBUSY) - break; - duration.tv_sec = 0; - duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); - nanosleep(&duration, NULL); - } - if (fd < 0) { - info(udev, "unable to open '%s'\n", node); - fprintf(stderr, "unable to open '%s'\n", node); - rc = 1; - goto exit; - } - info(udev, "probing: '%s'\n", node); - - /* same data as original cdrom_id */ - if (cd_capability_compat(udev, fd) < 0) { - rc = 1; - goto exit; - } - - /* check for media - don't bail if there's no media as we still need to + struct udev *udev; + static const struct option options[] = { + { "lock-media", no_argument, NULL, 'l' }, + { "unlock-media", no_argument, NULL, 'u' }, + { "eject-media", no_argument, NULL, 'e' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + bool eject = false; + bool lock = false; + bool unlock = false; + const char *node = NULL; + int fd = -1; + int cnt; + int rc = 0; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("cdrom_id"); + udev_set_log_fn(udev, log_fn); + + while (1) { + int option; + + option = getopt_long(argc, argv, "deluh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'l': + lock = true; + break; + case 'u': + unlock = true; + break; + case 'e': + eject = true; + break; + case 'd': + debug = true; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + printf("Usage: cdrom_id [options] \n" + " --lock-media lock the media (to enable eject request events)\n" + " --unlock-media unlock the media\n" + " --eject-media eject the media\n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); + goto exit; + default: + rc = 1; + goto exit; + } + } + + node = argv[optind]; + if (!node) { + err(udev, "no device\n"); + fprintf(stderr, "no device\n"); + rc = 1; + goto exit; + } + + srand((unsigned int)getpid()); + for (cnt = 20; cnt > 0; cnt--) { + struct timespec duration; + + fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); + if (fd >= 0 || errno != EBUSY) + break; + duration.tv_sec = 0; + duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); + nanosleep(&duration, NULL); + } + if (fd < 0) { + info(udev, "unable to open '%s'\n", node); + fprintf(stderr, "unable to open '%s'\n", node); + rc = 1; + goto exit; + } + info(udev, "probing: '%s'\n", node); + + /* same data as original cdrom_id */ + if (cd_capability_compat(udev, fd) < 0) { + rc = 1; + goto exit; + } + + /* check for media - don't bail if there's no media as we still need to * to read profiles */ - cd_media_compat(udev, fd); + cd_media_compat(udev, fd); - /* check if drive talks MMC */ - if (cd_inquiry(udev, fd) < 0) - goto work; + /* check if drive talks MMC */ + if (cd_inquiry(udev, fd) < 0) + goto work; - /* read drive and possibly current profile */ - if (cd_profiles(udev, fd) != 0) - goto work; + /* read drive and possibly current profile */ + if (cd_profiles(udev, fd) != 0) + goto work; - /* at this point we are guaranteed to have media in the drive - find out more about it */ + /* at this point we are guaranteed to have media in the drive - find out more about it */ - /* get session/track info */ - cd_media_toc(udev, fd); + /* get session/track info */ + cd_media_toc(udev, fd); - /* get writable media state */ - cd_media_info(udev, fd); + /* get writable media state */ + cd_media_info(udev, fd); work: - /* lock the media, so we enable eject button events */ - if (lock && cd_media) { - info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (lock)\n"); - media_lock(udev, fd, true); - } - - if (unlock && cd_media) { - info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); - media_lock(udev, fd, false); - } - - if (eject) { - info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); - media_lock(udev, fd, false); - info(udev, "START_STOP_UNIT (eject)\n"); - media_eject(udev, fd); - } - - printf("ID_CDROM=1\n"); - if (cd_cd_rom) - printf("ID_CDROM_CD=1\n"); - if (cd_cd_r) - printf("ID_CDROM_CD_R=1\n"); - if (cd_cd_rw) - printf("ID_CDROM_CD_RW=1\n"); - if (cd_dvd_rom) - printf("ID_CDROM_DVD=1\n"); - if (cd_dvd_r) - printf("ID_CDROM_DVD_R=1\n"); - if (cd_dvd_rw) - printf("ID_CDROM_DVD_RW=1\n"); - if (cd_dvd_ram) - printf("ID_CDROM_DVD_RAM=1\n"); - if (cd_dvd_plus_r) - printf("ID_CDROM_DVD_PLUS_R=1\n"); - if (cd_dvd_plus_rw) - printf("ID_CDROM_DVD_PLUS_RW=1\n"); - if (cd_dvd_plus_r_dl) - printf("ID_CDROM_DVD_PLUS_R_DL=1\n"); - if (cd_dvd_plus_rw_dl) - printf("ID_CDROM_DVD_PLUS_RW_DL=1\n"); - if (cd_bd) - printf("ID_CDROM_BD=1\n"); - if (cd_bd_r) - printf("ID_CDROM_BD_R=1\n"); - if (cd_bd_re) - printf("ID_CDROM_BD_RE=1\n"); - if (cd_hddvd) - printf("ID_CDROM_HDDVD=1\n"); - if (cd_hddvd_r) - printf("ID_CDROM_HDDVD_R=1\n"); - if (cd_hddvd_rw) - printf("ID_CDROM_HDDVD_RW=1\n"); - if (cd_mo) - printf("ID_CDROM_MO=1\n"); - if (cd_mrw) - printf("ID_CDROM_MRW=1\n"); - if (cd_mrw_w) - printf("ID_CDROM_MRW_W=1\n"); - - if (cd_media) - printf("ID_CDROM_MEDIA=1\n"); - if (cd_media_mo) - printf("ID_CDROM_MEDIA_MO=1\n"); - if (cd_media_mrw) - printf("ID_CDROM_MEDIA_MRW=1\n"); - if (cd_media_mrw_w) - printf("ID_CDROM_MEDIA_MRW_W=1\n"); - if (cd_media_cd_rom) - printf("ID_CDROM_MEDIA_CD=1\n"); - if (cd_media_cd_r) - printf("ID_CDROM_MEDIA_CD_R=1\n"); - if (cd_media_cd_rw) - printf("ID_CDROM_MEDIA_CD_RW=1\n"); - if (cd_media_dvd_rom) - printf("ID_CDROM_MEDIA_DVD=1\n"); - if (cd_media_dvd_r) - printf("ID_CDROM_MEDIA_DVD_R=1\n"); - if (cd_media_dvd_ram) - printf("ID_CDROM_MEDIA_DVD_RAM=1\n"); - if (cd_media_dvd_rw) - printf("ID_CDROM_MEDIA_DVD_RW=1\n"); - if (cd_media_dvd_plus_r) - printf("ID_CDROM_MEDIA_DVD_PLUS_R=1\n"); - if (cd_media_dvd_plus_rw) - printf("ID_CDROM_MEDIA_DVD_PLUS_RW=1\n"); - if (cd_media_dvd_plus_rw_dl) - printf("ID_CDROM_MEDIA_DVD_PLUS_RW_DL=1\n"); - if (cd_media_dvd_plus_r_dl) - printf("ID_CDROM_MEDIA_DVD_PLUS_R_DL=1\n"); - if (cd_media_bd) - printf("ID_CDROM_MEDIA_BD=1\n"); - if (cd_media_bd_r) - printf("ID_CDROM_MEDIA_BD_R=1\n"); - if (cd_media_bd_re) - printf("ID_CDROM_MEDIA_BD_RE=1\n"); - if (cd_media_hddvd) - printf("ID_CDROM_MEDIA_HDDVD=1\n"); - if (cd_media_hddvd_r) - printf("ID_CDROM_MEDIA_HDDVD_R=1\n"); - if (cd_media_hddvd_rw) - printf("ID_CDROM_MEDIA_HDDVD_RW=1\n"); - - if (cd_media_state != NULL) - printf("ID_CDROM_MEDIA_STATE=%s\n", cd_media_state); - if (cd_media_session_next > 0) - printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); - if (cd_media_session_count > 0) - printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); - if (cd_media_session_count > 1 && cd_media_session_last_offset > 0) - printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); - if (cd_media_track_count > 0) - printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); - if (cd_media_track_count_audio > 0) - printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); - if (cd_media_track_count_data > 0) - printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); + /* lock the media, so we enable eject button events */ + if (lock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (lock)\n"); + media_lock(udev, fd, true); + } + + if (unlock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + } + + if (eject) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + info(udev, "START_STOP_UNIT (eject)\n"); + media_eject(udev, fd); + } + + printf("ID_CDROM=1\n"); + if (cd_cd_rom) + printf("ID_CDROM_CD=1\n"); + if (cd_cd_r) + printf("ID_CDROM_CD_R=1\n"); + if (cd_cd_rw) + printf("ID_CDROM_CD_RW=1\n"); + if (cd_dvd_rom) + printf("ID_CDROM_DVD=1\n"); + if (cd_dvd_r) + printf("ID_CDROM_DVD_R=1\n"); + if (cd_dvd_rw) + printf("ID_CDROM_DVD_RW=1\n"); + if (cd_dvd_ram) + printf("ID_CDROM_DVD_RAM=1\n"); + if (cd_dvd_plus_r) + printf("ID_CDROM_DVD_PLUS_R=1\n"); + if (cd_dvd_plus_rw) + printf("ID_CDROM_DVD_PLUS_RW=1\n"); + if (cd_dvd_plus_r_dl) + printf("ID_CDROM_DVD_PLUS_R_DL=1\n"); + if (cd_dvd_plus_rw_dl) + printf("ID_CDROM_DVD_PLUS_RW_DL=1\n"); + if (cd_bd) + printf("ID_CDROM_BD=1\n"); + if (cd_bd_r) + printf("ID_CDROM_BD_R=1\n"); + if (cd_bd_re) + printf("ID_CDROM_BD_RE=1\n"); + if (cd_hddvd) + printf("ID_CDROM_HDDVD=1\n"); + if (cd_hddvd_r) + printf("ID_CDROM_HDDVD_R=1\n"); + if (cd_hddvd_rw) + printf("ID_CDROM_HDDVD_RW=1\n"); + if (cd_mo) + printf("ID_CDROM_MO=1\n"); + if (cd_mrw) + printf("ID_CDROM_MRW=1\n"); + if (cd_mrw_w) + printf("ID_CDROM_MRW_W=1\n"); + + if (cd_media) + printf("ID_CDROM_MEDIA=1\n"); + if (cd_media_mo) + printf("ID_CDROM_MEDIA_MO=1\n"); + if (cd_media_mrw) + printf("ID_CDROM_MEDIA_MRW=1\n"); + if (cd_media_mrw_w) + printf("ID_CDROM_MEDIA_MRW_W=1\n"); + if (cd_media_cd_rom) + printf("ID_CDROM_MEDIA_CD=1\n"); + if (cd_media_cd_r) + printf("ID_CDROM_MEDIA_CD_R=1\n"); + if (cd_media_cd_rw) + printf("ID_CDROM_MEDIA_CD_RW=1\n"); + if (cd_media_dvd_rom) + printf("ID_CDROM_MEDIA_DVD=1\n"); + if (cd_media_dvd_r) + printf("ID_CDROM_MEDIA_DVD_R=1\n"); + if (cd_media_dvd_ram) + printf("ID_CDROM_MEDIA_DVD_RAM=1\n"); + if (cd_media_dvd_rw) + printf("ID_CDROM_MEDIA_DVD_RW=1\n"); + if (cd_media_dvd_plus_r) + printf("ID_CDROM_MEDIA_DVD_PLUS_R=1\n"); + if (cd_media_dvd_plus_rw) + printf("ID_CDROM_MEDIA_DVD_PLUS_RW=1\n"); + if (cd_media_dvd_plus_rw_dl) + printf("ID_CDROM_MEDIA_DVD_PLUS_RW_DL=1\n"); + if (cd_media_dvd_plus_r_dl) + printf("ID_CDROM_MEDIA_DVD_PLUS_R_DL=1\n"); + if (cd_media_bd) + printf("ID_CDROM_MEDIA_BD=1\n"); + if (cd_media_bd_r) + printf("ID_CDROM_MEDIA_BD_R=1\n"); + if (cd_media_bd_re) + printf("ID_CDROM_MEDIA_BD_RE=1\n"); + if (cd_media_hddvd) + printf("ID_CDROM_MEDIA_HDDVD=1\n"); + if (cd_media_hddvd_r) + printf("ID_CDROM_MEDIA_HDDVD_R=1\n"); + if (cd_media_hddvd_rw) + printf("ID_CDROM_MEDIA_HDDVD_RW=1\n"); + + if (cd_media_state != NULL) + printf("ID_CDROM_MEDIA_STATE=%s\n", cd_media_state); + if (cd_media_session_next > 0) + printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); + if (cd_media_session_count > 0) + printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); + if (cd_media_session_count > 1 && cd_media_session_last_offset > 0) + printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); + if (cd_media_track_count > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); + if (cd_media_track_count_audio > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); + if (cd_media_track_count_data > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); exit: - if (fd >= 0) - close(fd); - udev_unref(udev); - udev_log_close(); - return rc; + if (fd >= 0) + close(fd); + udev_unref(udev); + udev_log_close(); + return rc; } diff --git a/src/extras/collect/collect.c b/src/extras/collect/collect.c index f78f3b778e..076fe479e2 100644 --- a/src/extras/collect/collect.c +++ b/src/extras/collect/collect.c @@ -34,19 +34,19 @@ #include "libudev.h" #include "libudev-private.h" -#define BUFSIZE 16 -#define UDEV_ALARM_TIMEOUT 180 +#define BUFSIZE 16 +#define UDEV_ALARM_TIMEOUT 180 enum collect_state { - STATE_NONE, - STATE_OLD, - STATE_CONFIRMED, + STATE_NONE, + STATE_OLD, + STATE_CONFIRMED, }; struct _mate { - struct udev_list_node node; - char *name; - enum collect_state state; + struct udev_list_node node; + char *name; + enum collect_state state; }; static struct udev_list_node bunch; @@ -57,29 +57,29 @@ static size_t bufsize = BUFSIZE; static struct _mate *node_to_mate(struct udev_list_node *node) { - char *mate; + char *mate; - mate = (char *)node; - mate -= offsetof(struct _mate, node); - return (struct _mate *)mate; + mate = (char *)node; + mate -= offsetof(struct _mate, node); + return (struct _mate *)mate; } static void sig_alrm(int signo) { - exit(4); + exit(4); } static void usage(void) { - printf("usage: collect [--add|--remove] [--debug] \n" - "\n" - " Adds ID to the list governed by .\n" - " must be part of the list .\n" - " If all IDs given by are listed (ie collect has been\n" - " invoked for each ID in ) collect returns 0, the\n" - " number of missing IDs otherwise.\n" - " On error a negative number is returned.\n" - "\n"); + printf("usage: collect [--add|--remove] [--debug] \n" + "\n" + " Adds ID to the list governed by .\n" + " must be part of the list .\n" + " If all IDs given by are listed (ie collect has been\n" + " invoked for each ID in ) collect returns 0, the\n" + " number of missing IDs otherwise.\n" + " On error a negative number is returned.\n" + "\n"); } /* @@ -89,34 +89,34 @@ static void usage(void) */ static int prepare(char *dir, char *filename) { - struct stat statbuf; - char buf[512]; - int fd; - - if (stat(dir, &statbuf) < 0) - mkdir(dir, 0700); - - sprintf(buf, "%s/%s", dir, filename); - - fd = open(buf,O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if (fd < 0) - fprintf(stderr, "Cannot open %s: %s\n", buf, strerror(errno)); - - if (lockf(fd,F_TLOCK,0) < 0) { - if (debug) - fprintf(stderr, "Lock taken, wait for %d seconds\n", UDEV_ALARM_TIMEOUT); - if (errno == EAGAIN || errno == EACCES) { - alarm(UDEV_ALARM_TIMEOUT); - lockf(fd, F_LOCK, 0); - if (debug) - fprintf(stderr, "Acquired lock on %s\n", buf); - } else { - if (debug) - fprintf(stderr, "Could not get lock on %s: %s\n", buf, strerror(errno)); - } - } - - return fd; + struct stat statbuf; + char buf[512]; + int fd; + + if (stat(dir, &statbuf) < 0) + mkdir(dir, 0700); + + sprintf(buf, "%s/%s", dir, filename); + + fd = open(buf,O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); + if (fd < 0) + fprintf(stderr, "Cannot open %s: %s\n", buf, strerror(errno)); + + if (lockf(fd,F_TLOCK,0) < 0) { + if (debug) + fprintf(stderr, "Lock taken, wait for %d seconds\n", UDEV_ALARM_TIMEOUT); + if (errno == EAGAIN || errno == EACCES) { + alarm(UDEV_ALARM_TIMEOUT); + lockf(fd, F_LOCK, 0); + if (debug) + fprintf(stderr, "Acquired lock on %s\n", buf); + } else { + if (debug) + fprintf(stderr, "Could not get lock on %s: %s\n", buf, strerror(errno)); + } + } + + return fd; } /* @@ -136,58 +136,58 @@ static int prepare(char *dir, char *filename) */ static int checkout(int fd) { - int len; - char *buf, *ptr, *word = NULL; - struct _mate *him; + int len; + char *buf, *ptr, *word = NULL; + struct _mate *him; restart: - len = bufsize >> 1; - buf = calloc(1,bufsize + 1); - if (!buf) { - fprintf(stderr, "Out of memory\n"); - return -1; - } - memset(buf, ' ', bufsize); - ptr = buf + len; - while ((read(fd, buf + len, len)) > 0) { - while (ptr && *ptr) { - word = ptr; - ptr = strpbrk(word," \n\t\r"); - if (!ptr && word < (buf + len)) { - bufsize = bufsize << 1; - if (debug) - fprintf(stderr, "ID overflow, restarting with size %zi\n", bufsize); - free(buf); - lseek(fd, 0, SEEK_SET); - goto restart; - } - if (ptr) { - *ptr = '\0'; - ptr++; - if (!strlen(word)) - continue; - - if (debug) - fprintf(stderr, "Found word %s\n", word); - him = malloc(sizeof (struct _mate)); - him->name = strdup(word); - him->state = STATE_OLD; - udev_list_node_append(&him->node, &bunch); - word = NULL; - } - } - memcpy(buf, buf + len, len); - memset(buf + len, ' ', len); - - if (!ptr) - ptr = word; - if (!ptr) - break; - ptr -= len; - } - - free(buf); - return 0; + len = bufsize >> 1; + buf = calloc(1,bufsize + 1); + if (!buf) { + fprintf(stderr, "Out of memory\n"); + return -1; + } + memset(buf, ' ', bufsize); + ptr = buf + len; + while ((read(fd, buf + len, len)) > 0) { + while (ptr && *ptr) { + word = ptr; + ptr = strpbrk(word," \n\t\r"); + if (!ptr && word < (buf + len)) { + bufsize = bufsize << 1; + if (debug) + fprintf(stderr, "ID overflow, restarting with size %zi\n", bufsize); + free(buf); + lseek(fd, 0, SEEK_SET); + goto restart; + } + if (ptr) { + *ptr = '\0'; + ptr++; + if (!strlen(word)) + continue; + + if (debug) + fprintf(stderr, "Found word %s\n", word); + him = malloc(sizeof (struct _mate)); + him->name = strdup(word); + him->state = STATE_OLD; + udev_list_node_append(&him->node, &bunch); + word = NULL; + } + } + memcpy(buf, buf + len, len); + memset(buf + len, ' ', len); + + if (!ptr) + ptr = word; + if (!ptr) + break; + ptr -= len; + } + + free(buf); + return 0; } /* @@ -198,22 +198,22 @@ static int checkout(int fd) */ static void invite(char *us) { - struct udev_list_node *him_node; - struct _mate *who = NULL; + struct udev_list_node *him_node; + struct _mate *who = NULL; - if (debug) - fprintf(stderr, "Adding ID '%s'\n", us); + if (debug) + fprintf(stderr, "Adding ID '%s'\n", us); - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); - if (!strcmp(him->name, us)) { - him->state = STATE_CONFIRMED; - who = him; - } - } - if (debug && !who) - fprintf(stderr, "ID '%s' not in database\n", us); + if (!strcmp(him->name, us)) { + him->state = STATE_CONFIRMED; + who = him; + } + } + if (debug && !who) + fprintf(stderr, "ID '%s' not in database\n", us); } @@ -226,22 +226,22 @@ static void invite(char *us) */ static void reject(char *us) { - struct udev_list_node *him_node; - struct _mate *who = NULL; - - if (debug) - fprintf(stderr, "Removing ID '%s'\n", us); - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (!strcmp(him->name, us)) { - him->state = STATE_NONE; - who = him; - } - } - if (debug && !who) - fprintf(stderr, "ID '%s' not in database\n", us); + struct udev_list_node *him_node; + struct _mate *who = NULL; + + if (debug) + fprintf(stderr, "Removing ID '%s'\n", us); + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (!strcmp(him->name, us)) { + him->state = STATE_NONE; + who = him; + } + } + if (debug && !who) + fprintf(stderr, "ID '%s' not in database\n", us); } /* @@ -252,18 +252,18 @@ static void reject(char *us) */ static void kickout(void) { - struct udev_list_node *him_node; - struct udev_list_node *tmp; - - udev_list_node_foreach_safe(him_node, tmp, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (him->state == STATE_OLD) { - udev_list_node_remove(&him->node); - free(him->name); - free(him); - } - } + struct udev_list_node *him_node; + struct udev_list_node *tmp; + + udev_list_node_foreach_safe(him_node, tmp, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (him->state == STATE_OLD) { + udev_list_node_remove(&him->node); + free(him->name); + free(him); + } + } } /* @@ -273,38 +273,38 @@ static void kickout(void) */ static int missing(int fd) { - char *buf; - int ret = 0; - struct udev_list_node *him_node; - - buf = malloc(bufsize); - if (!buf) - return -1; - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (him->state == STATE_NONE) { - ret++; - } else { - while (strlen(him->name)+1 >= bufsize) { - char *tmpbuf; - - bufsize = bufsize << 1; - tmpbuf = realloc(buf, bufsize); - if (!tmpbuf) { - free(buf); - return -1; - } - buf = tmpbuf; - } - snprintf(buf, strlen(him->name)+2, "%s ", him->name); - write(fd, buf, strlen(buf)); - } - } - - free(buf); - return ret; + char *buf; + int ret = 0; + struct udev_list_node *him_node; + + buf = malloc(bufsize); + if (!buf) + return -1; + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (him->state == STATE_NONE) { + ret++; + } else { + while (strlen(him->name)+1 >= bufsize) { + char *tmpbuf; + + bufsize = bufsize << 1; + tmpbuf = realloc(buf, bufsize); + if (!tmpbuf) { + free(buf); + return -1; + } + buf = tmpbuf; + } + snprintf(buf, strlen(him->name)+2, "%s ", him->name); + write(fd, buf, strlen(buf)); + } + } + + free(buf); + return ret; } /* @@ -314,160 +314,160 @@ static int missing(int fd) */ static void everybody(void) { - struct udev_list_node *him_node; - const char *state = ""; - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - switch (him->state) { - case STATE_NONE: - state = "none"; - break; - case STATE_OLD: - state = "old"; - break; - case STATE_CONFIRMED: - state = "confirmed"; - break; - } - fprintf(stderr, "ID: %s=%s\n", him->name, state); - } + struct udev_list_node *him_node; + const char *state = ""; + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + switch (him->state) { + case STATE_NONE: + state = "none"; + break; + case STATE_OLD: + state = "old"; + break; + case STATE_CONFIRMED: + state = "confirmed"; + break; + } + fprintf(stderr, "ID: %s=%s\n", him->name, state); + } } int main(int argc, char **argv) { - struct udev *udev; - static const struct option options[] = { - { "add", no_argument, NULL, 'a' }, - { "remove", no_argument, NULL, 'r' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - int argi; - char *checkpoint, *us; - int fd; - int i; - int ret = EXIT_SUCCESS; - int prune = 0; - char tmpdir[UTIL_PATH_SIZE]; - - udev = udev_new(); - if (udev == NULL) { - ret = EXIT_FAILURE; - goto exit; - } - - while (1) { - int option; - - option = getopt_long(argc, argv, "ardh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'a': - prune = 0; - break; - case 'r': - prune = 1; - break; - case 'd': - debug = 1; - break; - case 'h': - usage(); - goto exit; - default: - ret = 1; - goto exit; - } - } - - argi = optind; - if (argi + 2 > argc) { - printf("Missing parameter(s)\n"); - ret = 1; - goto exit; - } - checkpoint = argv[argi++]; - us = argv[argi++]; - - if (signal(SIGALRM, sig_alrm) == SIG_ERR) { - fprintf(stderr, "Cannot set SIGALRM: %s\n", strerror(errno)); - ret = 2; - goto exit; - } - - udev_list_node_init(&bunch); - - if (debug) - fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); - - util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL); - fd = prepare(tmpdir, checkpoint); - if (fd < 0) { - ret = 3; - goto out; - } - - if (checkout(fd) < 0) { - ret = 2; - goto out; - } - - for (i = argi; i < argc; i++) { - struct udev_list_node *him_node; - struct _mate *who; - - who = NULL; - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (!strcmp(him->name, argv[i])) - who = him; - } - if (!who) { - struct _mate *him; - - if (debug) - fprintf(stderr, "ID %s: not in database\n", argv[i]); - him = malloc(sizeof (struct _mate)); - him->name = malloc(strlen(argv[i]) + 1); - strcpy(him->name, argv[i]); - him->state = STATE_NONE; - udev_list_node_append(&him->node, &bunch); - } else { - if (debug) - fprintf(stderr, "ID %s: found in database\n", argv[i]); - who->state = STATE_CONFIRMED; - } - } - - if (prune) - reject(us); - else - invite(us); - - if (debug) { - everybody(); - fprintf(stderr, "Prune lists\n"); - } - kickout(); - - lseek(fd, 0, SEEK_SET); - ftruncate(fd, 0); - ret = missing(fd); - - lockf(fd, F_ULOCK, 0); - close(fd); + struct udev *udev; + static const struct option options[] = { + { "add", no_argument, NULL, 'a' }, + { "remove", no_argument, NULL, 'r' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + int argi; + char *checkpoint, *us; + int fd; + int i; + int ret = EXIT_SUCCESS; + int prune = 0; + char tmpdir[UTIL_PATH_SIZE]; + + udev = udev_new(); + if (udev == NULL) { + ret = EXIT_FAILURE; + goto exit; + } + + while (1) { + int option; + + option = getopt_long(argc, argv, "ardh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'a': + prune = 0; + break; + case 'r': + prune = 1; + break; + case 'd': + debug = 1; + break; + case 'h': + usage(); + goto exit; + default: + ret = 1; + goto exit; + } + } + + argi = optind; + if (argi + 2 > argc) { + printf("Missing parameter(s)\n"); + ret = 1; + goto exit; + } + checkpoint = argv[argi++]; + us = argv[argi++]; + + if (signal(SIGALRM, sig_alrm) == SIG_ERR) { + fprintf(stderr, "Cannot set SIGALRM: %s\n", strerror(errno)); + ret = 2; + goto exit; + } + + udev_list_node_init(&bunch); + + if (debug) + fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); + + util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL); + fd = prepare(tmpdir, checkpoint); + if (fd < 0) { + ret = 3; + goto out; + } + + if (checkout(fd) < 0) { + ret = 2; + goto out; + } + + for (i = argi; i < argc; i++) { + struct udev_list_node *him_node; + struct _mate *who; + + who = NULL; + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (!strcmp(him->name, argv[i])) + who = him; + } + if (!who) { + struct _mate *him; + + if (debug) + fprintf(stderr, "ID %s: not in database\n", argv[i]); + him = malloc(sizeof (struct _mate)); + him->name = malloc(strlen(argv[i]) + 1); + strcpy(him->name, argv[i]); + him->state = STATE_NONE; + udev_list_node_append(&him->node, &bunch); + } else { + if (debug) + fprintf(stderr, "ID %s: found in database\n", argv[i]); + who->state = STATE_CONFIRMED; + } + } + + if (prune) + reject(us); + else + invite(us); + + if (debug) { + everybody(); + fprintf(stderr, "Prune lists\n"); + } + kickout(); + + lseek(fd, 0, SEEK_SET); + ftruncate(fd, 0); + ret = missing(fd); + + lockf(fd, F_ULOCK, 0); + close(fd); out: - if (debug) - everybody(); - if (ret >= 0) - printf("COLLECT_%s=%d\n", checkpoint, ret); + if (debug) + everybody(); + if (ret >= 0) + printf("COLLECT_%s=%d\n", checkpoint, ret); exit: - udev_unref(udev); - return ret; + udev_unref(udev); + return ret; } diff --git a/src/extras/edd_id/edd_id.c b/src/extras/edd_id/edd_id.c index ac4da07611..471ea60533 100644 --- a/src/extras/edd_id/edd_id.c +++ b/src/extras/edd_id/edd_id.c @@ -36,161 +36,161 @@ #include "libudev-private.h" static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) + const char *file, int line, const char *fn, + const char *format, va_list args) { - vsyslog(priority, format, args); + vsyslog(priority, format, args); } int main(int argc, char *argv[]) { - struct udev *udev; - const char *node = NULL; - int i; - int export = 0; - uint32_t disk_id; - uint16_t mbr_valid; - struct dirent *dent; - int disk_fd; - int sysfs_fd; - DIR *dir = NULL; - int rc = 1; - char filename[UTIL_PATH_SIZE]; - char match[UTIL_PATH_SIZE]; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("edd_id"); - udev_set_log_fn(udev, log_fn); - - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; - - if (strcmp(arg, "--export") == 0) { - export = 1; - } else - node = arg; - } - if (node == NULL) { - err(udev, "no node specified\n"); - fprintf(stderr, "no node specified\n"); - goto exit; - } - - /* check for kernel support */ - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/firmware/edd", NULL); - dir = opendir(filename); - if (dir == NULL) { - info(udev, "no kernel EDD support\n"); - fprintf(stderr, "no kernel EDD support\n"); - rc = 2; - goto exit; - } - - disk_fd = open(node, O_RDONLY); - if (disk_fd < 0) { - info(udev, "unable to open '%s'\n", node); - fprintf(stderr, "unable to open '%s'\n", node); - rc = 3; - goto closedir; - } - - /* check for valid MBR signature */ - if (lseek(disk_fd, 510, SEEK_SET) < 0) { - info(udev, "seek to MBR validity failed '%s'\n", node); - rc = 4; - goto close; - } - if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { - info(udev, "read MBR validity failed '%s'\n", node); - rc = 5; - goto close; - } - if (mbr_valid != 0xAA55) { - fprintf(stderr, "no valid MBR signature '%s'\n", node); - info(udev, "no valid MBR signature '%s'\n", node); - rc=6; - goto close; - } - - /* read EDD signature */ - if (lseek(disk_fd, 440, SEEK_SET) < 0) { - info(udev, "seek to signature failed '%s'\n", node); - rc = 7; - goto close; - } - if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { - info(udev, "read signature failed '%s'\n", node); - rc = 8; - goto close; - } - /* all zero is invalid */ - info(udev, "read id 0x%08x from '%s'\n", disk_id, node); - if (disk_id == 0) { - fprintf(stderr, "no EDD signature '%s'\n", node); - info(udev, "'%s' signature is zero\n", node); - rc = 9; - goto close; - } - - /* lookup signature in sysfs to determine the name */ - match[0] = '\0'; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char sysfs_id_buf[256]; - uint32_t sysfs_id; - ssize_t size; - - if (dent->d_name[0] == '.') - continue; - - util_strscpyl(filename, sizeof(filename), dent->d_name, "/mbr_signature", NULL); - sysfs_fd = openat(dirfd(dir), filename, O_RDONLY); - if (sysfs_fd < 0) { - info(udev, "unable to open sysfs '%s'\n", filename); - continue; - } - - size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); - close(sysfs_fd); - if (size <= 0) { - info(udev, "read sysfs '%s' failed\n", filename); - continue; - } - sysfs_id_buf[size] = '\0'; - info(udev, "read '%s' from '%s'\n", sysfs_id_buf, filename); - sysfs_id = strtoul(sysfs_id_buf, NULL, 16); - - /* look for matching value, that appears only once */ - if (disk_id == sysfs_id) { - if (match[0] == '\0') { - /* store id */ - util_strscpy(match, sizeof(match), dent->d_name); - } else { - /* error, same signature for another device */ - info(udev, "'%s' does not have a unique signature\n", node); - fprintf(stderr, "'%s' does not have a unique signature\n", node); - rc = 10; - goto exit; - } - } - } - - if (match[0] != '\0') { - if (export) - printf("ID_EDD=%s\n", match); - else - printf("%s\n", match); - rc = 0; - } + struct udev *udev; + const char *node = NULL; + int i; + int export = 0; + uint32_t disk_id; + uint16_t mbr_valid; + struct dirent *dent; + int disk_fd; + int sysfs_fd; + DIR *dir = NULL; + int rc = 1; + char filename[UTIL_PATH_SIZE]; + char match[UTIL_PATH_SIZE]; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("edd_id"); + udev_set_log_fn(udev, log_fn); + + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--export") == 0) { + export = 1; + } else + node = arg; + } + if (node == NULL) { + err(udev, "no node specified\n"); + fprintf(stderr, "no node specified\n"); + goto exit; + } + + /* check for kernel support */ + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/firmware/edd", NULL); + dir = opendir(filename); + if (dir == NULL) { + info(udev, "no kernel EDD support\n"); + fprintf(stderr, "no kernel EDD support\n"); + rc = 2; + goto exit; + } + + disk_fd = open(node, O_RDONLY); + if (disk_fd < 0) { + info(udev, "unable to open '%s'\n", node); + fprintf(stderr, "unable to open '%s'\n", node); + rc = 3; + goto closedir; + } + + /* check for valid MBR signature */ + if (lseek(disk_fd, 510, SEEK_SET) < 0) { + info(udev, "seek to MBR validity failed '%s'\n", node); + rc = 4; + goto close; + } + if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { + info(udev, "read MBR validity failed '%s'\n", node); + rc = 5; + goto close; + } + if (mbr_valid != 0xAA55) { + fprintf(stderr, "no valid MBR signature '%s'\n", node); + info(udev, "no valid MBR signature '%s'\n", node); + rc=6; + goto close; + } + + /* read EDD signature */ + if (lseek(disk_fd, 440, SEEK_SET) < 0) { + info(udev, "seek to signature failed '%s'\n", node); + rc = 7; + goto close; + } + if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { + info(udev, "read signature failed '%s'\n", node); + rc = 8; + goto close; + } + /* all zero is invalid */ + info(udev, "read id 0x%08x from '%s'\n", disk_id, node); + if (disk_id == 0) { + fprintf(stderr, "no EDD signature '%s'\n", node); + info(udev, "'%s' signature is zero\n", node); + rc = 9; + goto close; + } + + /* lookup signature in sysfs to determine the name */ + match[0] = '\0'; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char sysfs_id_buf[256]; + uint32_t sysfs_id; + ssize_t size; + + if (dent->d_name[0] == '.') + continue; + + util_strscpyl(filename, sizeof(filename), dent->d_name, "/mbr_signature", NULL); + sysfs_fd = openat(dirfd(dir), filename, O_RDONLY); + if (sysfs_fd < 0) { + info(udev, "unable to open sysfs '%s'\n", filename); + continue; + } + + size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); + close(sysfs_fd); + if (size <= 0) { + info(udev, "read sysfs '%s' failed\n", filename); + continue; + } + sysfs_id_buf[size] = '\0'; + info(udev, "read '%s' from '%s'\n", sysfs_id_buf, filename); + sysfs_id = strtoul(sysfs_id_buf, NULL, 16); + + /* look for matching value, that appears only once */ + if (disk_id == sysfs_id) { + if (match[0] == '\0') { + /* store id */ + util_strscpy(match, sizeof(match), dent->d_name); + } else { + /* error, same signature for another device */ + info(udev, "'%s' does not have a unique signature\n", node); + fprintf(stderr, "'%s' does not have a unique signature\n", node); + rc = 10; + goto exit; + } + } + } + + if (match[0] != '\0') { + if (export) + printf("ID_EDD=%s\n", match); + else + printf("%s\n", match); + rc = 0; + } close: - close(disk_fd); + close(disk_fd); closedir: - closedir(dir); + closedir(dir); exit: - udev_unref(udev); - udev_log_close(); - return rc; + udev_unref(udev); + udev_log_close(); + return rc; } diff --git a/src/extras/floppy/create_floppy_devices.c b/src/extras/floppy/create_floppy_devices.c index 47724f8b04..f71ef0d809 100644 --- a/src/extras/floppy/create_floppy_devices.c +++ b/src/extras/floppy/create_floppy_devices.c @@ -34,12 +34,12 @@ #include "libudev-private.h" static char *table[] = { - "", "d360", "h1200", "u360", "u720", "h360", "h720", - "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410", - "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743", - "h880", "u1040", "u1120", "h1600", "u1760", "u1920", - "u3200", "u3520", "u3840", "u1840", "u800", "u1600", - NULL + "", "d360", "h1200", "u360", "u720", "h360", "h720", + "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410", + "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743", + "h880", "u1040", "u1120", "h1600", "u1760", "u1920", + "u3200", "u3520", "u3840", "u1840", "u800", "u1600", + NULL }; static int t360[] = { 1, 0 }; @@ -48,130 +48,130 @@ static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, static int *table_sup[] = { NULL, t360, t1200, t3in+5+8, t3in+5, t3in, t3in }; static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) + const char *file, int line, const char *fn, + const char *format, va_list args) { - vsyslog(priority, format, args); + vsyslog(priority, format, args); } int main(int argc, char **argv) { - struct udev *udev; - char *dev; - char *devname; - char node[64]; - int type = 0, i, fdnum, c; - int major = 2, minor; - uid_t uid = 0; - gid_t gid = 0; - mode_t mode = 0660; - int create_nodes = 0; - int print_nodes = 0; - int is_err = 0; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("create_floppy_devices"); - udev_set_log_fn(udev, log_fn); - udev_selinux_init(udev); - - while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { - switch (c) { - case 'c': - create_nodes = 1; - break; - case 'd': - print_nodes = 1; - break; - case 'U': - uid = util_lookup_user(udev, optarg); - break; - case 'G': - gid = util_lookup_group(udev, optarg); - break; - case 'M': - mode = strtol(optarg, NULL, 0); - mode = mode & 0666; - break; - case 'm': - major = strtol(optarg, NULL, 0); - break; - case 't': - type = strtol(optarg, NULL, 0); - break; - default: - is_err++; - break; - } - } - - if (is_err || optind >= argc) { - printf("Usage: %s [OPTION] device\n" - " -c create\n" - " -d debug\n" - " -m Major number\n" - " -t floppy type number\n" - " -U device node user ownership\n" - " -G device node group owner\n" - " -M device node mode\n" - "\n", argv[0]); - return 1; - } - - dev = argv[optind]; - devname = strrchr(dev, '/'); - if (devname != NULL) - devname = &devname[1]; - else - devname = dev; - if (strncmp(devname, "fd", 2) != 0) { - fprintf(stderr,"Device '%s' is not a floppy device\n", dev); - return 1; - } - - fdnum = strtol(&devname[2], NULL, 10); - if (fdnum < 0 || fdnum > 7) { - fprintf(stderr,"Floppy device number %d out of range (0-7)\n", fdnum); - return 1; - } - if (fdnum > 3) - fdnum += 124; - - if (major < 1) { - fprintf(stderr,"Invalid major number %d\n", major); - return 1; - } - - if (type < 0 || type >= (int) ARRAY_SIZE(table_sup)) { - fprintf(stderr,"Invalid CMOS type %d\n", type); - return 1; - } - - if (type == 0) - return 0; - - i = 0; - while (table_sup[type][i]) { - sprintf(node, "%s%s", dev, table[table_sup[type][i]]); - minor = (table_sup[type][i] << 2) + fdnum; - if (print_nodes) - printf("%s b %.4o %d %d\n", node, mode, major, minor); - if (create_nodes) { - unlink(node); - udev_selinux_setfscreatecon(udev, node, S_IFBLK | mode); - mknod(node, S_IFBLK | mode, makedev(major,minor)); - udev_selinux_resetfscreatecon(udev); - chown(node, uid, gid); - chmod(node, S_IFBLK | mode); - } - i++; - } - - udev_selinux_exit(udev); - udev_unref(udev); - udev_log_close(); + struct udev *udev; + char *dev; + char *devname; + char node[64]; + int type = 0, i, fdnum, c; + int major = 2, minor; + uid_t uid = 0; + gid_t gid = 0; + mode_t mode = 0660; + int create_nodes = 0; + int print_nodes = 0; + int is_err = 0; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("create_floppy_devices"); + udev_set_log_fn(udev, log_fn); + udev_selinux_init(udev); + + while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { + switch (c) { + case 'c': + create_nodes = 1; + break; + case 'd': + print_nodes = 1; + break; + case 'U': + uid = util_lookup_user(udev, optarg); + break; + case 'G': + gid = util_lookup_group(udev, optarg); + break; + case 'M': + mode = strtol(optarg, NULL, 0); + mode = mode & 0666; + break; + case 'm': + major = strtol(optarg, NULL, 0); + break; + case 't': + type = strtol(optarg, NULL, 0); + break; + default: + is_err++; + break; + } + } + + if (is_err || optind >= argc) { + printf("Usage: %s [OPTION] device\n" + " -c create\n" + " -d debug\n" + " -m Major number\n" + " -t floppy type number\n" + " -U device node user ownership\n" + " -G device node group owner\n" + " -M device node mode\n" + "\n", argv[0]); + return 1; + } + + dev = argv[optind]; + devname = strrchr(dev, '/'); + if (devname != NULL) + devname = &devname[1]; + else + devname = dev; + if (strncmp(devname, "fd", 2) != 0) { + fprintf(stderr,"Device '%s' is not a floppy device\n", dev); + return 1; + } + + fdnum = strtol(&devname[2], NULL, 10); + if (fdnum < 0 || fdnum > 7) { + fprintf(stderr,"Floppy device number %d out of range (0-7)\n", fdnum); + return 1; + } + if (fdnum > 3) + fdnum += 124; + + if (major < 1) { + fprintf(stderr,"Invalid major number %d\n", major); + return 1; + } + + if (type < 0 || type >= (int) ARRAY_SIZE(table_sup)) { + fprintf(stderr,"Invalid CMOS type %d\n", type); + return 1; + } + + if (type == 0) + return 0; + + i = 0; + while (table_sup[type][i]) { + sprintf(node, "%s%s", dev, table[table_sup[type][i]]); + minor = (table_sup[type][i] << 2) + fdnum; + if (print_nodes) + printf("%s b %.4o %d %d\n", node, mode, major, minor); + if (create_nodes) { + unlink(node); + udev_selinux_setfscreatecon(udev, node, S_IFBLK | mode); + mknod(node, S_IFBLK | mode, makedev(major,minor)); + udev_selinux_resetfscreatecon(udev); + chown(node, uid, gid); + chmod(node, S_IFBLK | mode); + } + i++; + } + + udev_selinux_exit(udev); + udev_unref(udev); + udev_log_close(); exit: - return 0; + return 0; } diff --git a/src/extras/gudev/COPYING b/src/extras/gudev/COPYING index 47044a8c58..da97db2bd0 100644 --- a/src/extras/gudev/COPYING +++ b/src/extras/gudev/COPYING @@ -1,5 +1,5 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA @@ -10,7 +10,7 @@ as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -112,7 +112,7 @@ modification follow. Pay close attention to the difference between a former contains code derived from the library, whereas the latter must be combined with the library in order to run. - GNU LESSER GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other @@ -432,7 +432,7 @@ decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. @@ -455,7 +455,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries diff --git a/src/extras/gudev/docs/Makefile.am b/src/extras/gudev/docs/Makefile.am index 65e69975b5..3512197660 100644 --- a/src/extras/gudev/docs/Makefile.am +++ b/src/extras/gudev/docs/Makefile.am @@ -78,14 +78,14 @@ expand_content_files= # e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) GTKDOC_CFLAGS = \ - $(DBUS_GLIB_CFLAGS) \ - $(GLIB_CFLAGS) \ - -I$(top_srcdir)/src/extras/gudev \ - -I$(top_builddir)/src/extras/gudev + $(DBUS_GLIB_CFLAGS) \ + $(GLIB_CFLAGS) \ + -I$(top_srcdir)/src/extras/gudev \ + -I$(top_builddir)/src/extras/gudev GTKDOC_LIBS = \ - $(GLIB_LIBS) \ - $(top_builddir)/src/extras/gudev/libgudev-1.0.la + $(GLIB_LIBS) \ + $(top_builddir)/src/extras/gudev/libgudev-1.0.la # This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.make diff --git a/src/extras/gudev/docs/gudev-docs.xml b/src/extras/gudev/docs/gudev-docs.xml index 65fdfff8e5..f876c3bc05 100644 --- a/src/extras/gudev/docs/gudev-docs.xml +++ b/src/extras/gudev/docs/gudev-docs.xml @@ -9,22 +9,22 @@ For GUdev version &version; - David - Zeuthen - -
            - davidz@redhat.com -
            -
            + David + Zeuthen + +
            + davidz@redhat.com +
            +
            - Bastien - Nocera - -
            - hadess@hadess.net -
            -
            + Bastien + Nocera + +
            + hadess@hadess.net +
            +
            @@ -35,32 +35,32 @@ - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free - Documentation License, Version 1.1 or any later - version published by the Free Software Foundation with no - Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. You may obtain a copy of the GNU Free - Documentation License from the Free Software - Foundation by visiting their Web site or by writing - to: + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: -
            - The Free Software Foundation, Inc., - 59 Temple Place - Suite 330, - Boston, MA 02111-1307, - USA -
            +
            + The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
            - Many of the names used by companies to distinguish their - products and services are claimed as trademarks. Where those - names appear in any freedesktop.org documentation, and those - trademarks are made aware to the members of the - freedesktop.org Project, the names have been printed in caps - or initial caps. + Many of the names used by companies to distinguish their + products and services are claimed as trademarks. Where those + names appear in any freedesktop.org documentation, and those + trademarks are made aware to the members of the + freedesktop.org Project, the names have been printed in caps + or initial caps.
            @@ -69,8 +69,8 @@ API Reference - This part presents the class and function reference for the - libgudev library. + This part presents the class and function reference for the + libgudev library. diff --git a/src/extras/gudev/gudevclient.c b/src/extras/gudev/gudevclient.c index a6465ad943..2b94102ac5 100644 --- a/src/extras/gudev/gudevclient.c +++ b/src/extras/gudev/gudevclient.c @@ -87,8 +87,8 @@ G_DEFINE_TYPE (GUdevClient, g_udev_client, G_TYPE_OBJECT) static gboolean monitor_event (GIOChannel *source, - GIOCondition condition, - gpointer data) + GIOCondition condition, + gpointer data) { GUdevClient *client = (GUdevClient *) data; GUdevDevice *device; diff --git a/src/extras/keymap/check-keymaps.sh b/src/extras/keymap/check-keymaps.sh index ea77b69c24..f81b6aac36 100755 --- a/src/extras/keymap/check-keymaps.sh +++ b/src/extras/keymap/check-keymaps.sh @@ -9,30 +9,30 @@ KEYMAPS_DIR=$SRCDIR/src/extras/keymap/keymaps #extras/keymap/keymaps RULES=$SRCDIR/src/extras/keymap/95-keymap.rules [ -e "$KEYLIST" ] || { - echo "need $KEYLIST please build first" >&2 - exit 1 + echo "need $KEYLIST please build first" >&2 + exit 1 } missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) \ <(grep -hv '^#' ${KEYMAPS_DIR}/*| awk '{print $2}' | sort -u)) [ -z "$missing" ] || { - echo "ERROR: unknown key names in extras/keymap/keymaps/*:" >&2 - echo "$missing" >&2 - exit 1 + echo "ERROR: unknown key names in extras/keymap/keymaps/*:" >&2 + echo "$missing" >&2 + exit 1 } # check that all maps referred to in $RULES exist maps=$(sed -rn '/keymap \$name/ { s/^.*\$name ([^"[:space:]]+).*$/\1/; p }' $RULES) for m in $maps; do - # ignore inline mappings - [ "$m" = "${m#0x}" ] || continue + # ignore inline mappings + [ "$m" = "${m#0x}" ] || continue - [ -e ${KEYMAPS_DIR}/$m ] || { - echo "ERROR: unknown map name in $RULES: $m" >&2 - exit 1 - } - grep -q "extras/keymap/keymaps/$m\>" $SRCDIR/Makefile.am || { - echo "ERROR: map file $m is not added to Makefile.am" >&2 - exit 1 - } + [ -e ${KEYMAPS_DIR}/$m ] || { + echo "ERROR: unknown map name in $RULES: $m" >&2 + exit 1 + } + grep -q "extras/keymap/keymaps/$m\>" $SRCDIR/Makefile.am || { + echo "ERROR: map file $m is not added to Makefile.am" >&2 + exit 1 + } done diff --git a/src/extras/keymap/findkeyboards b/src/extras/keymap/findkeyboards index eba3737a96..9ce27429b2 100755 --- a/src/extras/keymap/findkeyboards +++ b/src/extras/keymap/findkeyboards @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/bin/sh -e # Find "real" keyboard devices and print their device path. # Author: Martin Pitt # @@ -14,58 +14,55 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. -set -e - # returns OK if $1 contains $2 strstr() { - [ "${1#*$2*}" != "$1" ] + [ "${1#*$2*}" != "$1" ] } # returns OK if $1 contains $2 at the beginning str_starts() { - [ "${1#$2*}" != "$1" ] + [ "${1#$2*}" != "$1" ] } str_line_starts() { - while read a; do str_starts "$a" "$1" && return 0;done - return 1; + while read a; do str_starts "$a" "$1" && return 0;done + return 1; } # print a list of input devices which are keyboard-like keyboard_devices() { - # standard AT keyboard - for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do - walk=`udevadm info --attribute-walk --path=$dev` - env=`udevadm info --query=env --path=$dev` - # filter out non-event devices, such as the parent input devices which - # have no devnode - if ! echo "$env" | str_line_starts 'DEVNAME='; then - continue - fi - if strstr "$walk" 'DRIVERS=="atkbd"'; then - echo -n 'AT keyboard: ' - elif echo "$env" | str_line_starts 'ID_USB_DRIVER=usbhid'; then - echo -n 'USB keyboard: ' - else - echo -n 'Unknown type: ' - fi - udevadm info --query=name --path=$dev - done + # standard AT keyboard + for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do + walk=`udevadm info --attribute-walk --path=$dev` + env=`udevadm info --query=env --path=$dev` + # filter out non-event devices, such as the parent input devices which have no devnode + if ! echo "$env" | str_line_starts 'DEVNAME='; then + continue + fi + if strstr "$walk" 'DRIVERS=="atkbd"'; then + echo -n 'AT keyboard: ' + elif echo "$env" | str_line_starts 'ID_USB_DRIVER=usbhid'; then + echo -n 'USB keyboard: ' + else + echo -n 'Unknown type: ' + fi + udevadm info --query=name --path=$dev + done - # modules - module=$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons') - module="$module -$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons')" - module="$module -$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys')" - for m in $module; do - for evdev in $m/event*/dev; do - if [ -e "$evdev" ]; then - echo -n 'module: ' - udevadm info --query=name --path=${evdev%%/dev} - fi - done - done + # modules + module=$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons') + module="$module + $(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons')" + module="$module + $(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys')" + for m in $module; do + for evdev in $m/event*/dev; do + if [ -e "$evdev" ]; then + echo -n 'module: ' + udevadm info --query=name --path=${evdev%%/dev} + fi + done + done } keyboard_devices diff --git a/src/extras/keymap/keyboard-force-release.sh.in b/src/extras/keymap/keyboard-force-release.sh.in index 154be3d733..dd040cebc3 100755 --- a/src/extras/keymap/keyboard-force-release.sh.in +++ b/src/extras/keymap/keyboard-force-release.sh.in @@ -5,18 +5,18 @@ # $2 file with scancode list (hex or dec) case "$2" in - /*) scf="$2" ;; - *) scf="@pkglibexecdir@/keymaps/force-release/$2" ;; + /*) scf="$2" ;; + *) scf="@pkglibexecdir@/keymaps/force-release/$2" ;; esac read attr <"/sys/$1/force_release" while read scancode dummy; do - case "$scancode" in - \#*) ;; - *) - scancode=$(($scancode)) - attr="$attr${attr:+,}$scancode" - ;; - esac + case "$scancode" in + \#*) ;; + *) + scancode=$(($scancode)) + attr="$attr${attr:+,}$scancode" + ;; + esac done <"$scf" echo "$attr" >"/sys/$1/force_release" diff --git a/src/extras/keymap/keymap.c b/src/extras/keymap/keymap.c index 6bcfaefa18..92ec67b3a6 100644 --- a/src/extras/keymap/keymap.c +++ b/src/extras/keymap/keymap.c @@ -45,403 +45,403 @@ const struct key* lookup_key (const char *str, unsigned int len); static int evdev_open(const char *dev) { - int fd; - char fn[PATH_MAX]; - - if (strncmp(dev, "/dev", 4) != 0) { - snprintf(fn, sizeof(fn), "/dev/%s", dev); - dev = fn; - } - - if ((fd = open(dev, O_RDWR)) < 0) { - fprintf(stderr, "error open('%s'): %m\n", dev); - return -1; - } - return fd; + int fd; + char fn[PATH_MAX]; + + if (strncmp(dev, "/dev", 4) != 0) { + snprintf(fn, sizeof(fn), "/dev/%s", dev); + dev = fn; + } + + if ((fd = open(dev, O_RDWR)) < 0) { + fprintf(stderr, "error open('%s'): %m\n", dev); + return -1; + } + return fd; } static int evdev_get_keycode(int fd, int scancode, int e) { - int codes[2]; - - codes[0] = scancode; - if (ioctl(fd, EVIOCGKEYCODE, codes) < 0) { - if (e && errno == EINVAL) { - return -2; - } else { - fprintf(stderr, "EVIOCGKEYCODE: %m\n"); - return -1; - } - } - return codes[1]; + int codes[2]; + + codes[0] = scancode; + if (ioctl(fd, EVIOCGKEYCODE, codes) < 0) { + if (e && errno == EINVAL) { + return -2; + } else { + fprintf(stderr, "EVIOCGKEYCODE: %m\n"); + return -1; + } + } + return codes[1]; } static int evdev_set_keycode(int fd, int scancode, int keycode) { - int codes[2]; + int codes[2]; - codes[0] = scancode; - codes[1] = keycode; + codes[0] = scancode; + codes[1] = keycode; - if (ioctl(fd, EVIOCSKEYCODE, codes) < 0) { - fprintf(stderr, "EVIOCSKEYCODE: %m\n"); - return -1; - } - return 0; + if (ioctl(fd, EVIOCSKEYCODE, codes) < 0) { + fprintf(stderr, "EVIOCSKEYCODE: %m\n"); + return -1; + } + return 0; } static int evdev_driver_version(int fd, char *v, size_t l) { - int version; + int version; - if (ioctl(fd, EVIOCGVERSION, &version)) { - fprintf(stderr, "EVIOCGVERSION: %m\n"); - return -1; - } + if (ioctl(fd, EVIOCGVERSION, &version)) { + fprintf(stderr, "EVIOCGVERSION: %m\n"); + return -1; + } - snprintf(v, l, "%i.%i.%i.", version >> 16, (version >> 8) & 0xff, version & 0xff); - return 0; + snprintf(v, l, "%i.%i.%i.", version >> 16, (version >> 8) & 0xff, version & 0xff); + return 0; } static int evdev_device_name(int fd, char *n, size_t l) { - if (ioctl(fd, EVIOCGNAME(l), n) < 0) { - fprintf(stderr, "EVIOCGNAME: %m\n"); - return -1; - } - return 0; + if (ioctl(fd, EVIOCGNAME(l), n) < 0) { + fprintf(stderr, "EVIOCGNAME: %m\n"); + return -1; + } + return 0; } /* Return a lower-case string with KEY_ prefix removed */ static const char* format_keyname(const char* key) { - static char result[101]; - const char* s; - int len; - - for (s = key+4, len = 0; *s && len < 100; ++len, ++s) - result[len] = tolower(*s); - result[len] = '\0'; - return result; + static char result[101]; + const char* s; + int len; + + for (s = key+4, len = 0; *s && len < 100; ++len, ++s) + result[len] = tolower(*s); + result[len] = '\0'; + return result; } static int dump_table(int fd) { - char version[256], name[256]; - int scancode, r = -1; + char version[256], name[256]; + int scancode, r = -1; - if (evdev_driver_version(fd, version, sizeof(version)) < 0) - goto fail; + if (evdev_driver_version(fd, version, sizeof(version)) < 0) + goto fail; - if (evdev_device_name(fd, name, sizeof(name)) < 0) - goto fail; + if (evdev_device_name(fd, name, sizeof(name)) < 0) + goto fail; - printf("### evdev %s, driver '%s'\n", version, name); + printf("### evdev %s, driver '%s'\n", version, name); - r = 0; - for (scancode = 0; scancode < MAX_SCANCODES; scancode++) { - int keycode; + r = 0; + for (scancode = 0; scancode < MAX_SCANCODES; scancode++) { + int keycode; - if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { - if (keycode == -2) - continue; - r = -1; - break; - } + if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { + if (keycode == -2) + continue; + r = -1; + break; + } - if (keycode < KEY_MAX && key_names[keycode]) - printf("0x%03x %s\n", scancode, format_keyname(key_names[keycode])); - else - printf("0x%03x 0x%03x\n", scancode, keycode); - } + if (keycode < KEY_MAX && key_names[keycode]) + printf("0x%03x %s\n", scancode, format_keyname(key_names[keycode])); + else + printf("0x%03x 0x%03x\n", scancode, keycode); + } fail: - return r; + return r; } static void set_key(int fd, const char* scancode_str, const char* keyname) { - unsigned scancode; - char *endptr; - char t[105] = "KEY_UNKNOWN"; - const struct key *k; - - scancode = (unsigned) strtol(scancode_str, &endptr, 0); - if (*endptr != '\0') { - fprintf(stderr, "ERROR: Invalid scancode\n"); - exit(1); - } - - snprintf(t, sizeof(t), "KEY_%s", keyname); - - if (!(k = lookup_key(t, strlen(t)))) { - fprintf(stderr, "ERROR: Unknown key name '%s'\n", keyname); - exit(1); - } - - if (evdev_set_keycode(fd, scancode, k->id) < 0) - fprintf(stderr, "setting scancode 0x%2X to key code %i failed\n", - scancode, k->id); - else - printf("setting scancode 0x%2X to key code %i\n", - scancode, k->id); + unsigned scancode; + char *endptr; + char t[105] = "KEY_UNKNOWN"; + const struct key *k; + + scancode = (unsigned) strtol(scancode_str, &endptr, 0); + if (*endptr != '\0') { + fprintf(stderr, "ERROR: Invalid scancode\n"); + exit(1); + } + + snprintf(t, sizeof(t), "KEY_%s", keyname); + + if (!(k = lookup_key(t, strlen(t)))) { + fprintf(stderr, "ERROR: Unknown key name '%s'\n", keyname); + exit(1); + } + + if (evdev_set_keycode(fd, scancode, k->id) < 0) + fprintf(stderr, "setting scancode 0x%2X to key code %i failed\n", + scancode, k->id); + else + printf("setting scancode 0x%2X to key code %i\n", + scancode, k->id); } static int merge_table(int fd, FILE *f) { - int r = 0; - int line = 0; - - while (!feof(f)) { - char s[256], *p; - int scancode, new_keycode, old_keycode; - - if (!fgets(s, sizeof(s), f)) - break; - - line++; - p = s+strspn(s, "\t "); - if (*p == '#' || *p == '\n') - continue; - - if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) { - char t[105] = "KEY_UNKNOWN"; - const struct key *k; - - if (sscanf(p, "%i %100s", &scancode, t+4) != 2) { - fprintf(stderr, "WARNING: Parse failure at line %i, ignoring.\n", line); - r = -1; - continue; - } - - if (!(k = lookup_key(t, strlen(t)))) { - fprintf(stderr, "WARNING: Unknown key '%s' at line %i, ignoring.\n", t, line); - r = -1; - continue; - } - - new_keycode = k->id; - } - - - if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0) { - r = -1; - goto fail; - } - - if (evdev_set_keycode(fd, scancode, new_keycode) < 0) { - r = -1; - goto fail; - } - - if (new_keycode != old_keycode) - fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x (prior: 0x%02x)\n", - scancode, new_keycode, old_keycode); - } + int r = 0; + int line = 0; + + while (!feof(f)) { + char s[256], *p; + int scancode, new_keycode, old_keycode; + + if (!fgets(s, sizeof(s), f)) + break; + + line++; + p = s+strspn(s, "\t "); + if (*p == '#' || *p == '\n') + continue; + + if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) { + char t[105] = "KEY_UNKNOWN"; + const struct key *k; + + if (sscanf(p, "%i %100s", &scancode, t+4) != 2) { + fprintf(stderr, "WARNING: Parse failure at line %i, ignoring.\n", line); + r = -1; + continue; + } + + if (!(k = lookup_key(t, strlen(t)))) { + fprintf(stderr, "WARNING: Unknown key '%s' at line %i, ignoring.\n", t, line); + r = -1; + continue; + } + + new_keycode = k->id; + } + + + if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0) { + r = -1; + goto fail; + } + + if (evdev_set_keycode(fd, scancode, new_keycode) < 0) { + r = -1; + goto fail; + } + + if (new_keycode != old_keycode) + fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x (prior: 0x%02x)\n", + scancode, new_keycode, old_keycode); + } fail: - fclose(f); - return r; + fclose(f); + return r; } /* read one event; return 1 if valid */ static int read_event(int fd, struct input_event* ev) { - int ret; - ret = read(fd, ev, sizeof(struct input_event)); - - if (ret < 0) { - perror("read"); - return 0; - } - if (ret != sizeof(struct input_event)) { - fprintf(stderr, "did not get enough data for event struct, aborting\n"); - return 0; - } - - return 1; + int ret; + ret = read(fd, ev, sizeof(struct input_event)); + + if (ret < 0) { + perror("read"); + return 0; + } + if (ret != sizeof(struct input_event)) { + fprintf(stderr, "did not get enough data for event struct, aborting\n"); + return 0; + } + + return 1; } static void print_key(uint32_t scancode, uint16_t keycode, int has_scan, int has_key) { - const char *keyname; - - /* ignore key release events */ - if (has_key == 1) - return; - - if (has_key == 0 && has_scan != 0) { - fprintf(stderr, "got scan code event 0x%02X without a key code event\n", - scancode); - return; - } - - if (has_scan != 0) - printf("scan code: 0x%02X ", scancode); - else - printf("(no scan code received) "); - - keyname = key_names[keycode]; - if (keyname != NULL) - printf("key code: %s\n", format_keyname(keyname)); - else - printf("key code: %03X\n", keycode); + const char *keyname; + + /* ignore key release events */ + if (has_key == 1) + return; + + if (has_key == 0 && has_scan != 0) { + fprintf(stderr, "got scan code event 0x%02X without a key code event\n", + scancode); + return; + } + + if (has_scan != 0) + printf("scan code: 0x%02X ", scancode); + else + printf("(no scan code received) "); + + keyname = key_names[keycode]; + if (keyname != NULL) + printf("key code: %s\n", format_keyname(keyname)); + else + printf("key code: %03X\n", keycode); } static void interactive(int fd) { - struct input_event ev; - uint32_t last_scan = 0; - uint16_t last_key = 0; - int has_scan; /* boolean */ - int has_key; /* 0: none, 1: release, 2: press */ - - /* grab input device */ - ioctl(fd, EVIOCGRAB, 1); - puts("Press ESC to finish, or Control-C if this device is not your primary keyboard"); - - has_scan = has_key = 0; - while (read_event(fd, &ev)) { - /* Drivers usually send the scan code first, then the key code, - * then a SYN. Some drivers (like thinkpad_acpi) send the key - * code first, and some drivers might not send SYN events, so - * keep a robust state machine which can deal with any of those - */ - - if (ev.type == EV_MSC && ev.code == MSC_SCAN) { - if (has_scan) { - fputs("driver did not send SYN event in between key events; previous event:\n", - stderr); - print_key(last_scan, last_key, has_scan, has_key); - has_key = 0; - } - - last_scan = ev.value; - has_scan = 1; - /*printf("--- got scan %u; has scan %i key %i\n", last_scan, has_scan, has_key); */ - } - else if (ev.type == EV_KEY) { - if (has_key) { - fputs("driver did not send SYN event in between key events; previous event:\n", - stderr); - print_key(last_scan, last_key, has_scan, has_key); - has_scan = 0; - } - - last_key = ev.code; - has_key = 1 + ev.value; - /*printf("--- got key %hu; has scan %i key %i\n", last_key, has_scan, has_key);*/ - - /* Stop on ESC */ - if (ev.code == KEY_ESC && ev.value == 0) - break; - } - else if (ev.type == EV_SYN) { - /*printf("--- got SYN; has scan %i key %i\n", has_scan, has_key);*/ - print_key(last_scan, last_key, has_scan, has_key); - - has_scan = has_key = 0; - } - - } - - /* release input device */ - ioctl(fd, EVIOCGRAB, 0); + struct input_event ev; + uint32_t last_scan = 0; + uint16_t last_key = 0; + int has_scan; /* boolean */ + int has_key; /* 0: none, 1: release, 2: press */ + + /* grab input device */ + ioctl(fd, EVIOCGRAB, 1); + puts("Press ESC to finish, or Control-C if this device is not your primary keyboard"); + + has_scan = has_key = 0; + while (read_event(fd, &ev)) { + /* Drivers usually send the scan code first, then the key code, + * then a SYN. Some drivers (like thinkpad_acpi) send the key + * code first, and some drivers might not send SYN events, so + * keep a robust state machine which can deal with any of those + */ + + if (ev.type == EV_MSC && ev.code == MSC_SCAN) { + if (has_scan) { + fputs("driver did not send SYN event in between key events; previous event:\n", + stderr); + print_key(last_scan, last_key, has_scan, has_key); + has_key = 0; + } + + last_scan = ev.value; + has_scan = 1; + /*printf("--- got scan %u; has scan %i key %i\n", last_scan, has_scan, has_key); */ + } + else if (ev.type == EV_KEY) { + if (has_key) { + fputs("driver did not send SYN event in between key events; previous event:\n", + stderr); + print_key(last_scan, last_key, has_scan, has_key); + has_scan = 0; + } + + last_key = ev.code; + has_key = 1 + ev.value; + /*printf("--- got key %hu; has scan %i key %i\n", last_key, has_scan, has_key);*/ + + /* Stop on ESC */ + if (ev.code == KEY_ESC && ev.value == 0) + break; + } + else if (ev.type == EV_SYN) { + /*printf("--- got SYN; has scan %i key %i\n", has_scan, has_key);*/ + print_key(last_scan, last_key, has_scan, has_key); + + has_scan = has_key = 0; + } + + } + + /* release input device */ + ioctl(fd, EVIOCGRAB, 0); } static void help(int error) { - const char* h = "Usage: keymap []\n" - " keymap scancode keyname [...]\n" - " keymap -i \n"; - if (error) { - fputs(h, stderr); - exit(2); - } else { - fputs(h, stdout); - exit(0); - } + const char* h = "Usage: keymap []\n" + " keymap scancode keyname [...]\n" + " keymap -i \n"; + if (error) { + fputs(h, stderr); + exit(2); + } else { + fputs(h, stdout); + exit(0); + } } int main(int argc, char **argv) { - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - { "interactive", no_argument, NULL, 'i' }, - {} - }; - int fd = -1; - int opt_interactive = 0; - int i; - - while (1) { - int option; - - option = getopt_long(argc, argv, "hi", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'h': - help(0); - - case 'i': - opt_interactive = 1; - break; - default: - return 1; - } - } - - if (argc < optind+1) - help (1); - - if ((fd = evdev_open(argv[optind])) < 0) - return 3; - - /* one argument (device): dump or interactive */ - if (argc == optind+1) { - if (opt_interactive) - interactive(fd); - else - dump_table(fd); - return 0; - } - - /* two arguments (device, mapfile): set map file */ - if (argc == optind+2) { - const char *filearg = argv[optind+1]; - if (strchr(filearg, '/')) { - /* Keymap file argument is a path */ - FILE *f = fopen(filearg, "r"); - if (f) - merge_table(fd, f); - else - perror(filearg); - } else { - /* Keymap file argument is a filename */ - /* Open override file if present, otherwise default file */ - char keymap_path[PATH_MAX]; - snprintf(keymap_path, sizeof(keymap_path), "%s%s", SYSCONFDIR "/udev/keymaps/", filearg); - FILE *f = fopen(keymap_path, "r"); - if (f) { - merge_table(fd, f); - } else { - snprintf(keymap_path, sizeof(keymap_path), "%s%s", PKGLIBEXECDIR "/keymaps/", filearg); - f = fopen(keymap_path, "r"); - if (f) - merge_table(fd, f); - else - perror(keymap_path); - } - } - return 0; - } - - /* more arguments (device, scancode/keyname pairs): set keys directly */ - if ((argc - optind - 1) % 2 == 0) { - for (i = optind+1; i < argc; i += 2) - set_key(fd, argv[i], argv[i+1]); - return 0; - } - - /* invalid number of arguments */ - help(1); - return 1; /* not reached */ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "interactive", no_argument, NULL, 'i' }, + {} + }; + int fd = -1; + int opt_interactive = 0; + int i; + + while (1) { + int option; + + option = getopt_long(argc, argv, "hi", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + help(0); + + case 'i': + opt_interactive = 1; + break; + default: + return 1; + } + } + + if (argc < optind+1) + help (1); + + if ((fd = evdev_open(argv[optind])) < 0) + return 3; + + /* one argument (device): dump or interactive */ + if (argc == optind+1) { + if (opt_interactive) + interactive(fd); + else + dump_table(fd); + return 0; + } + + /* two arguments (device, mapfile): set map file */ + if (argc == optind+2) { + const char *filearg = argv[optind+1]; + if (strchr(filearg, '/')) { + /* Keymap file argument is a path */ + FILE *f = fopen(filearg, "r"); + if (f) + merge_table(fd, f); + else + perror(filearg); + } else { + /* Keymap file argument is a filename */ + /* Open override file if present, otherwise default file */ + char keymap_path[PATH_MAX]; + snprintf(keymap_path, sizeof(keymap_path), "%s%s", SYSCONFDIR "/udev/keymaps/", filearg); + FILE *f = fopen(keymap_path, "r"); + if (f) { + merge_table(fd, f); + } else { + snprintf(keymap_path, sizeof(keymap_path), "%s%s", PKGLIBEXECDIR "/keymaps/", filearg); + f = fopen(keymap_path, "r"); + if (f) + merge_table(fd, f); + else + perror(keymap_path); + } + } + return 0; + } + + /* more arguments (device, scancode/keyname pairs): set keys directly */ + if ((argc - optind - 1) % 2 == 0) { + for (i = optind+1; i < argc; i += 2) + set_key(fd, argv[i], argv[i+1]); + return 0; + } + + /* invalid number of arguments */ + help(1); + return 1; /* not reached */ } diff --git a/src/extras/keymap/keymaps/acer-aspire_5720 b/src/extras/keymap/keymaps/acer-aspire_5720 index c4a8459367..1496d63a52 100644 --- a/src/extras/keymap/keymaps/acer-aspire_5720 +++ b/src/extras/keymap/keymaps/acer-aspire_5720 @@ -1,4 +1,4 @@ 0x84 bluetooth # sent when bluetooth module missing, and key pressed -0x92 media # acer arcade +0x92 media # acer arcade 0xD4 bluetooth # bluetooth on 0xD9 bluetooth # bluetooth off diff --git a/src/extras/keymap/keymaps/lenovo-ideapad b/src/extras/keymap/keymaps/lenovo-ideapad index d5f25671a5..9ab02ba332 100644 --- a/src/extras/keymap/keymaps/lenovo-ideapad +++ b/src/extras/keymap/keymaps/lenovo-ideapad @@ -1,7 +1,7 @@ # Key codes observed on S10-3, assumed valid on other IdeaPad models -0x81 rfkill # does nothing in BIOS -0x83 display_off # BIOS toggles screen state -0xB9 brightnessup # does nothing in BIOS -0xBA brightnessdown # does nothing in BIOS -0xF1 camera # BIOS toggles camera power -0xf2 unknown # trackpad enable/disable (does nothing in BIOS) +0x81 rfkill # does nothing in BIOS +0x83 display_off # BIOS toggles screen state +0xB9 brightnessup # does nothing in BIOS +0xBA brightnessdown # does nothing in BIOS +0xF1 camera # BIOS toggles camera power +0xf2 unknown # trackpad enable/disable (does nothing in BIOS) diff --git a/src/extras/mtd_probe/mtd_probe.c b/src/extras/mtd_probe/mtd_probe.c index e45867ffa9..1aa08d3851 100644 --- a/src/extras/mtd_probe/mtd_probe.c +++ b/src/extras/mtd_probe/mtd_probe.c @@ -28,24 +28,24 @@ int main(int argc, char** argv) { - if (argc != 2) { - printf("usage: mtd_probe /dev/mtd[n]\n"); - return 1; - } + if (argc != 2) { + printf("usage: mtd_probe /dev/mtd[n]\n"); + return 1; + } - int mtd_fd = open(argv[1], O_RDONLY); - if (mtd_fd == -1) { - perror("open"); - exit(-1); - } + int mtd_fd = open(argv[1], O_RDONLY); + if (mtd_fd == -1) { + perror("open"); + exit(-1); + } - mtd_info_t mtd_info; - int error = ioctl(mtd_fd, MEMGETINFO, &mtd_info); - if (error == -1) { - perror("ioctl"); - exit(-1); - } + mtd_info_t mtd_info; + int error = ioctl(mtd_fd, MEMGETINFO, &mtd_info); + if (error == -1) { + perror("ioctl"); + exit(-1); + } - probe_smart_media(mtd_fd, &mtd_info); - return -1; + probe_smart_media(mtd_fd, &mtd_info); + return -1; } diff --git a/src/extras/mtd_probe/mtd_probe.h b/src/extras/mtd_probe/mtd_probe.h index 20ecd4578e..2a37ede578 100644 --- a/src/extras/mtd_probe/mtd_probe.h +++ b/src/extras/mtd_probe/mtd_probe.h @@ -21,29 +21,29 @@ /* Full oob structure as written on the flash */ struct sm_oob { - uint32_t reserved; - uint8_t data_status; - uint8_t block_status; - uint8_t lba_copy1[2]; - uint8_t ecc2[3]; - uint8_t lba_copy2[2]; - uint8_t ecc1[3]; + uint32_t reserved; + uint8_t data_status; + uint8_t block_status; + uint8_t lba_copy1[2]; + uint8_t ecc2[3]; + uint8_t lba_copy2[2]; + uint8_t ecc1[3]; } __attribute__((packed)); /* one sector is always 512 bytes, but it can consist of two nand pages */ -#define SM_SECTOR_SIZE 512 +#define SM_SECTOR_SIZE 512 /* oob area is also 16 bytes, but might be from two pages */ -#define SM_OOB_SIZE 16 +#define SM_OOB_SIZE 16 /* This is maximum zone size, and all devices that have more that one zone have this size */ -#define SM_MAX_ZONE_SIZE 1024 +#define SM_MAX_ZONE_SIZE 1024 /* support for small page nand */ -#define SM_SMALL_PAGE 256 -#define SM_SMALL_OOB_SIZE 8 +#define SM_SMALL_PAGE 256 +#define SM_SMALL_OOB_SIZE 8 void probe_smart_media(int mtd_fd, mtd_info_t *info); diff --git a/src/extras/mtd_probe/probe_smartmedia.c b/src/extras/mtd_probe/probe_smartmedia.c index 49704e380a..b3cdefc633 100644 --- a/src/extras/mtd_probe/probe_smartmedia.c +++ b/src/extras/mtd_probe/probe_smartmedia.c @@ -30,68 +30,68 @@ #include "mtd_probe.h" static const uint8_t cis_signature[] = { - 0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20 + 0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20 }; void probe_smart_media(int mtd_fd, mtd_info_t* info) { - char* cis_buffer = malloc(SM_SECTOR_SIZE); + char* cis_buffer = malloc(SM_SECTOR_SIZE); - if (!cis_buffer) - return; + if (!cis_buffer) + return; - if (info->type != MTD_NANDFLASH) - goto exit; + if (info->type != MTD_NANDFLASH) + goto exit; - int sector_size = info->writesize; - int block_size = info->erasesize; - int size_in_megs = info->size / (1024 * 1024); - int spare_count; + int sector_size = info->writesize; + int block_size = info->erasesize; + int size_in_megs = info->size / (1024 * 1024); + int spare_count; - if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE) - goto exit; + if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE) + goto exit; - switch(size_in_megs) { - case 1: - case 2: - spare_count = 6; - break; - case 4: - spare_count = 12; - break; - default: - spare_count = 24; - break; - } + switch(size_in_megs) { + case 1: + case 2: + spare_count = 6; + break; + case 4: + spare_count = 12; + break; + default: + spare_count = 24; + break; + } - int offset; - int cis_found = 0; + int offset; + int cis_found = 0; - for (offset = 0 ; offset < block_size * spare_count ; - offset += sector_size) { + for (offset = 0 ; offset < block_size * spare_count ; + offset += sector_size) { - lseek(mtd_fd, SEEK_SET, offset); - if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){ - cis_found = 1; - break; - } - } + lseek(mtd_fd, SEEK_SET, offset); + if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){ + cis_found = 1; + break; + } + } - if (!cis_found) - goto exit; + if (!cis_found) + goto exit; - if (memcmp(cis_buffer, cis_signature, sizeof(cis_signature)) != 0 && - (memcmp(cis_buffer + SM_SMALL_PAGE, cis_signature, - sizeof(cis_signature)) != 0)) - goto exit; + if (memcmp(cis_buffer, cis_signature, sizeof(cis_signature)) != 0 && + (memcmp(cis_buffer + SM_SMALL_PAGE, cis_signature, + sizeof(cis_signature)) != 0)) + goto exit; - printf("MTD_FTL=smartmedia\n"); - free(cis_buffer); - exit(0); + printf("MTD_FTL=smartmedia\n"); + free(cis_buffer); + exit(0); exit: - free(cis_buffer); - return; + free(cis_buffer); + return; } diff --git a/src/extras/rule_generator/rule_generator.functions b/src/extras/rule_generator/rule_generator.functions index 0f1b73850e..2eec1b6abf 100644 --- a/src/extras/rule_generator/rule_generator.functions +++ b/src/extras/rule_generator/rule_generator.functions @@ -20,94 +20,94 @@ PATH='/usr/bin:/bin:/usr/sbin:/sbin' # Read a single line from file $1 in the $DEVPATH directory. # The function must not return an error even if the file does not exist. sysread() { - local file="$1" - [ -e "/sys$DEVPATH/$file" ] || return 0 - local value - read value < "/sys$DEVPATH/$file" || return 0 - echo "$value" + local file="$1" + [ -e "/sys$DEVPATH/$file" ] || return 0 + local value + read value < "/sys$DEVPATH/$file" || return 0 + echo "$value" } sysreadlink() { - local file="$1" - [ -e "/sys$DEVPATH/$file" ] || return 0 - readlink -f /sys$DEVPATH/$file 2> /dev/null || true + local file="$1" + [ -e "/sys$DEVPATH/$file" ] || return 0 + readlink -f /sys$DEVPATH/$file 2> /dev/null || true } # Return true if a directory is writeable. writeable() { - if ln -s test-link $1/.is-writeable 2> /dev/null; then - rm -f $1/.is-writeable - return 0 - else - return 1 - fi + if ln -s test-link $1/.is-writeable 2> /dev/null; then + rm -f $1/.is-writeable + return 0 + else + return 1 + fi } # Create a lock file for the current rules file. lock_rules_file() { - RUNDIR=$(udevadm info --run) - [ -e "$RUNDIR" ] || return 0 - - RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}" - - retry=30 - while ! mkdir $RULES_LOCK 2> /dev/null; do - if [ $retry -eq 0 ]; then - echo "Cannot lock $RULES_FILE!" >&2 - exit 2 - fi - sleep 1 - retry=$(($retry - 1)) - done + RUNDIR=$(udevadm info --run) + [ -e "$RUNDIR" ] || return 0 + + RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}" + + retry=30 + while ! mkdir $RULES_LOCK 2> /dev/null; do + if [ $retry -eq 0 ]; then + echo "Cannot lock $RULES_FILE!" >&2 + exit 2 + fi + sleep 1 + retry=$(($retry - 1)) + done } unlock_rules_file() { - [ "$RULES_LOCK" ] || return 0 - rmdir $RULES_LOCK || true + [ "$RULES_LOCK" ] || return 0 + rmdir $RULES_LOCK || true } # Choose the real rules file if it is writeable or a temporary file if not. # Both files should be checked later when looking for existing rules. choose_rules_file() { - RUNDIR=$(udevadm info --run) - local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}" - [ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1 - - if writeable ${RULES_FILE%/*}; then - RO_RULES_FILE='/dev/null' - else - RO_RULES_FILE=$RULES_FILE - RULES_FILE=$tmp_rules_file - fi + RUNDIR=$(udevadm info --run) + local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}" + [ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1 + + if writeable ${RULES_FILE%/*}; then + RO_RULES_FILE='/dev/null' + else + RO_RULES_FILE=$RULES_FILE + RULES_FILE=$tmp_rules_file + fi } # Return the name of the first free device. raw_find_next_available() { - local links="$1" - - local basename=${links%%[ 0-9]*} - local max=-1 - for name in $links; do - local num=${name#$basename} - [ "$num" ] || num=0 - [ $num -gt $max ] && max=$num - done - - local max=$(($max + 1)) - # "name0" actually is just "name" - [ $max -eq 0 ] && return - echo "$max" + local links="$1" + + local basename=${links%%[ 0-9]*} + local max=-1 + for name in $links; do + local num=${name#$basename} + [ "$num" ] || num=0 + [ $num -gt $max ] && max=$num + done + + local max=$(($max + 1)) + # "name0" actually is just "name" + [ $max -eq 0 ] && return + echo "$max" } # Find all rules matching a key (with action) and a pattern. find_all_rules() { - local key="$1" - local linkre="$2" - local match="$3" - - local search='.*[[:space:],]'"$key"'"('"$linkre"')".*' - echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \ - $RO_RULES_FILE \ - $([ -e $RULES_FILE ] && echo $RULES_FILE) \ - 2>/dev/null) + local key="$1" + local linkre="$2" + local match="$3" + + local search='.*[[:space:],]'"$key"'"('"$linkre"')".*' + echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \ + $RO_RULES_FILE \ + $([ -e $RULES_FILE ] && echo $RULES_FILE) \ + 2>/dev/null) } diff --git a/src/extras/rule_generator/write_cd_rules b/src/extras/rule_generator/write_cd_rules index 3f93c7447a..645b9cd521 100644 --- a/src/extras/rule_generator/write_cd_rules +++ b/src/extras/rule_generator/write_cd_rules @@ -22,9 +22,9 @@ # debug, if UDEV_LOG= if [ -n "$UDEV_LOG" ]; then - if [ "$UDEV_LOG" -ge 7 ]; then - set -x - fi + if [ "$UDEV_LOG" -ge 7 ]; then + set -x + fi fi RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" @@ -32,70 +32,70 @@ RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" . /lib/udev/rule_generator.functions find_next_available() { - raw_find_next_available "$(find_all_rules 'SYMLINK\+=' "$1")" + raw_find_next_available "$(find_all_rules 'SYMLINK\+=' "$1")" } write_rule() { - local match="$1" - local link="$2" - local comment="$3" - - { - if [ "$PRINT_HEADER" ]; then - PRINT_HEADER= - echo "# This file was automatically generated by the $0" - echo "# program, run by the cd-aliases-generator.rules rules file." - echo "#" - echo "# You can modify it, as long as you keep each rule on a single" - echo "# line, and set the \$GENERATED variable." - echo "" - fi - - [ "$comment" ] && echo "# $comment" - echo "$match, SYMLINK+=\"$link\", ENV{GENERATED}=\"1\"" - } >> $RULES_FILE - SYMLINKS="$SYMLINKS $link" + local match="$1" + local link="$2" + local comment="$3" + + { + if [ "$PRINT_HEADER" ]; then + PRINT_HEADER= + echo "# This file was automatically generated by the $0" + echo "# program, run by the cd-aliases-generator.rules rules file." + echo "#" + echo "# You can modify it, as long as you keep each rule on a single" + echo "# line, and set the \$GENERATED variable." + echo "" + fi + + [ "$comment" ] && echo "# $comment" + echo "$match, SYMLINK+=\"$link\", ENV{GENERATED}=\"1\"" + } >> $RULES_FILE + SYMLINKS="$SYMLINKS $link" } if [ -z "$DEVPATH" ]; then - echo "Missing \$DEVPATH." >&2 - exit 1 + echo "Missing \$DEVPATH." >&2 + exit 1 fi if [ -z "$ID_CDROM" ]; then - echo "$DEVPATH is not a CD reader." >&2 - exit 1 + echo "$DEVPATH is not a CD reader." >&2 + exit 1 fi if [ "$1" ]; then - METHOD="$1" + METHOD="$1" else - METHOD='by-path' + METHOD='by-path' fi case "$METHOD" in - by-path) - if [ -z "$ID_PATH" ]; then - echo "$DEVPATH not supported by path_id. by-id may work." >&2 - exit 1 - fi - RULE="ENV{ID_PATH}==\"$ID_PATH\"" - ;; - - by-id) - if [ "$ID_SERIAL" ]; then - RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\"" - elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then - RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\"" - else - echo "$DEVPATH not supported by ata_id. by-path may work." >&2 - exit 1 - fi - ;; - - *) - echo "Invalid argument (must be either by-path or by-id)." >&2 - exit 1 - ;; + by-path) + if [ -z "$ID_PATH" ]; then + echo "$DEVPATH not supported by path_id. by-id may work." >&2 + exit 1 + fi + RULE="ENV{ID_PATH}==\"$ID_PATH\"" + ;; + + by-id) + if [ "$ID_SERIAL" ]; then + RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\"" + elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then + RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\"" + else + echo "$DEVPATH not supported by ata_id. by-path may work." >&2 + exit 1 + fi + ;; + + *) + echo "Invalid argument (must be either by-path or by-id)." >&2 + exit 1 + ;; esac # Prevent concurrent processes from modifying the file at the same time. @@ -110,13 +110,13 @@ match="SUBSYSTEM==\"block\", ENV{ID_CDROM}==\"?*\", $RULE" comment="$ID_MODEL ($ID_PATH)" - write_rule "$match" "cdrom$link_num" "$comment" + write_rule "$match" "cdrom$link_num" "$comment" [ "$ID_CDROM_CD_R" -o "$ID_CDROM_CD_RW" ] && \ - write_rule "$match" "cdrw$link_num" + write_rule "$match" "cdrw$link_num" [ "$ID_CDROM_DVD" ] && \ - write_rule "$match" "dvd$link_num" + write_rule "$match" "dvd$link_num" [ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ] && \ - write_rule "$match" "dvdrw$link_num" + write_rule "$match" "dvdrw$link_num" echo >> $RULES_FILE unlock_rules_file diff --git a/src/extras/rule_generator/write_net_rules b/src/extras/rule_generator/write_net_rules index 437979241f..bcea4b09dc 100644 --- a/src/extras/rule_generator/write_net_rules +++ b/src/extras/rule_generator/write_net_rules @@ -33,9 +33,9 @@ # debug, if UDEV_LOG= if [ -n "$UDEV_LOG" ]; then - if [ "$UDEV_LOG" -ge 7 ]; then - set -x - fi + if [ "$UDEV_LOG" -ge 7 ]; then + set -x + fi fi RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' @@ -43,42 +43,42 @@ RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' . /lib/udev/rule_generator.functions interface_name_taken() { - local value="$(find_all_rules 'NAME=' $INTERFACE)" - if [ "$value" ]; then - return 0 - else - return 1 - fi + local value="$(find_all_rules 'NAME=' $INTERFACE)" + if [ "$value" ]; then + return 0 + else + return 1 + fi } find_next_available() { - raw_find_next_available "$(find_all_rules 'NAME=' "$1")" + raw_find_next_available "$(find_all_rules 'NAME=' "$1")" } write_rule() { - local match="$1" - local name="$2" - local comment="$3" - - { - if [ "$PRINT_HEADER" ]; then - PRINT_HEADER= - echo "# This file was automatically generated by the $0" - echo "# program, run by the persistent-net-generator.rules rules file." - echo "#" - echo "# You can modify it, as long as you keep each rule on a single" - echo "# line, and change only the value of the NAME= key." - fi - - echo "" - [ "$comment" ] && echo "# $comment" - echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\"" - } >> $RULES_FILE + local match="$1" + local name="$2" + local comment="$3" + + { + if [ "$PRINT_HEADER" ]; then + PRINT_HEADER= + echo "# This file was automatically generated by the $0" + echo "# program, run by the persistent-net-generator.rules rules file." + echo "#" + echo "# You can modify it, as long as you keep each rule on a single" + echo "# line, and change only the value of the NAME= key." + fi + + echo "" + [ "$comment" ] && echo "# $comment" + echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\"" + } >> $RULES_FILE } if [ -z "$INTERFACE" ]; then - echo "missing \$INTERFACE" >&2 - exit 1 + echo "missing \$INTERFACE" >&2 + exit 1 fi # Prevent concurrent processes from modifying the file at the same time. @@ -89,49 +89,49 @@ choose_rules_file # the DRIVERS key is needed to not match bridges and VLAN sub-interfaces if [ "$MATCHADDR" ]; then - match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\"" + match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\"" fi if [ "$MATCHDRV" ]; then - match="$match, DRIVERS==\"$MATCHDRV\"" + match="$match, DRIVERS==\"$MATCHDRV\"" fi if [ "$MATCHDEVID" ]; then - match="$match, ATTR{dev_id}==\"$MATCHDEVID\"" + match="$match, ATTR{dev_id}==\"$MATCHDEVID\"" fi if [ "$MATCHID" ]; then - match="$match, KERNELS==\"$MATCHID\"" + match="$match, KERNELS==\"$MATCHID\"" fi if [ "$MATCHIFTYPE" ]; then - match="$match, ATTR{type}==\"$MATCHIFTYPE\"" + match="$match, ATTR{type}==\"$MATCHIFTYPE\"" fi if [ -z "$match" ]; then - echo "missing valid match" >&2 - unlock_rules_file - exit 1 + echo "missing valid match" >&2 + unlock_rules_file + exit 1 fi basename=${INTERFACE%%[0-9]*} match="$match, KERNEL==\"$basename*\"" if [ "$INTERFACE_NAME" ]; then - # external tools may request a custom name - COMMENT="$COMMENT (custom name provided by external tool)" - if [ "$INTERFACE_NAME" != "$INTERFACE" ]; then - INTERFACE=$INTERFACE_NAME; - echo "INTERFACE_NEW=$INTERFACE" - fi + # external tools may request a custom name + COMMENT="$COMMENT (custom name provided by external tool)" + if [ "$INTERFACE_NAME" != "$INTERFACE" ]; then + INTERFACE=$INTERFACE_NAME; + echo "INTERFACE_NEW=$INTERFACE" + fi else - # if a rule using the current name already exists, find a new name - if interface_name_taken; then - INTERFACE="$basename$(find_next_available "$basename[0-9]*")" - # prevent INTERFACE from being "eth" instead of "eth0" - [ "$INTERFACE" = "${INTERFACE%%[ \[\]0-9]*}" ] && INTERFACE=${INTERFACE}0 - echo "INTERFACE_NEW=$INTERFACE" - fi + # if a rule using the current name already exists, find a new name + if interface_name_taken; then + INTERFACE="$basename$(find_next_available "$basename[0-9]*")" + # prevent INTERFACE from being "eth" instead of "eth0" + [ "$INTERFACE" = "${INTERFACE%%[ \[\]0-9]*}" ] && INTERFACE=${INTERFACE}0 + echo "INTERFACE_NEW=$INTERFACE" + fi fi write_rule "$match" "$INTERFACE" "$COMMENT" diff --git a/src/extras/scsi_id/scsi.h b/src/extras/scsi_id/scsi.h index 8e9ce406b7..c423cac574 100644 --- a/src/extras/scsi_id/scsi.h +++ b/src/extras/scsi_id/scsi.h @@ -5,39 +5,39 @@ * * Copyright (C) IBM Corp. 2003 * - * 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 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. */ #include struct scsi_ioctl_command { - unsigned int inlen; /* excluding scsi command length */ - unsigned int outlen; - unsigned char data[1]; - /* on input, scsi command starts here then opt. data */ + unsigned int inlen; /* excluding scsi command length */ + unsigned int outlen; + unsigned char data[1]; + /* on input, scsi command starts here then opt. data */ }; /* * Default 5 second timeout */ -#define DEF_TIMEOUT 5000 +#define DEF_TIMEOUT 5000 -#define SENSE_BUFF_LEN 32 +#define SENSE_BUFF_LEN 32 /* * The request buffer size passed to the SCSI INQUIRY commands, use 254, * as this is a nice value for some devices, especially some of the usb * mass storage devices. */ -#define SCSI_INQ_BUFF_LEN 254 +#define SCSI_INQ_BUFF_LEN 254 /* * SCSI INQUIRY vendor and model (really product) lengths. */ -#define VENDOR_LENGTH 8 -#define MODEL_LENGTH 16 +#define VENDOR_LENGTH 8 +#define MODEL_LENGTH 16 #define INQUIRY_CMD 0x12 #define INQUIRY_CMDLEN 6 @@ -50,34 +50,34 @@ struct scsi_ioctl_command { /* * id type values of id descriptors. These are assumed to fit in 4 bits. */ -#define SCSI_ID_VENDOR_SPECIFIC 0 -#define SCSI_ID_T10_VENDOR 1 -#define SCSI_ID_EUI_64 2 -#define SCSI_ID_NAA 3 -#define SCSI_ID_RELPORT 4 -#define SCSI_ID_TGTGROUP 5 -#define SCSI_ID_LUNGROUP 6 -#define SCSI_ID_MD5 7 -#define SCSI_ID_NAME 8 +#define SCSI_ID_VENDOR_SPECIFIC 0 +#define SCSI_ID_T10_VENDOR 1 +#define SCSI_ID_EUI_64 2 +#define SCSI_ID_NAA 3 +#define SCSI_ID_RELPORT 4 +#define SCSI_ID_TGTGROUP 5 +#define SCSI_ID_LUNGROUP 6 +#define SCSI_ID_MD5 7 +#define SCSI_ID_NAME 8 /* * Supported NAA values. These fit in 4 bits, so the "don't care" value * cannot conflict with real values. */ -#define SCSI_ID_NAA_DONT_CARE 0xff -#define SCSI_ID_NAA_IEEE_REG 5 -#define SCSI_ID_NAA_IEEE_REG_EXTENDED 6 +#define SCSI_ID_NAA_DONT_CARE 0xff +#define SCSI_ID_NAA_IEEE_REG 5 +#define SCSI_ID_NAA_IEEE_REG_EXTENDED 6 /* * Supported Code Set values. */ -#define SCSI_ID_BINARY 1 -#define SCSI_ID_ASCII 2 +#define SCSI_ID_BINARY 1 +#define SCSI_ID_ASCII 2 struct scsi_id_search_values { - u_char id_type; - u_char naa_type; - u_char code_set; + u_char id_type; + u_char naa_type; + u_char code_set; }; /* diff --git a/src/extras/scsi_id/scsi_id.c b/src/extras/scsi_id/scsi_id.c index da81d083ce..9bb0d7f538 100644 --- a/src/extras/scsi_id/scsi_id.c +++ b/src/extras/scsi_id/scsi_id.c @@ -34,18 +34,18 @@ #include "scsi_id.h" static const struct option options[] = { - { "device", required_argument, NULL, 'd' }, - { "config", required_argument, NULL, 'f' }, - { "page", required_argument, NULL, 'p' }, - { "blacklisted", no_argument, NULL, 'b' }, - { "whitelisted", no_argument, NULL, 'g' }, - { "replace-whitespace", no_argument, NULL, 'u' }, - { "sg-version", required_argument, NULL, 's' }, - { "verbose", no_argument, NULL, 'v' }, - { "version", no_argument, NULL, 'V' }, - { "export", no_argument, NULL, 'x' }, - { "help", no_argument, NULL, 'h' }, - {} + { "device", required_argument, NULL, 'd' }, + { "config", required_argument, NULL, 'f' }, + { "page", required_argument, NULL, 'p' }, + { "blacklisted", no_argument, NULL, 'b' }, + { "whitelisted", no_argument, NULL, 'g' }, + { "replace-whitespace", no_argument, NULL, 'u' }, + { "sg-version", required_argument, NULL, 's' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { "export", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, + {} }; static const char short_options[] = "d:f:ghip:uvVx"; @@ -68,47 +68,47 @@ static char revision_str[16]; static char type_str[16]; static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) + const char *file, int line, const char *fn, + const char *format, va_list args) { - vsyslog(priority, format, args); + vsyslog(priority, format, args); } static void set_type(const char *from, char *to, size_t len) { - int type_num; - char *eptr; - char *type = "generic"; - - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 0: - type = "disk"; - break; - case 1: - type = "tape"; - break; - case 4: - type = "optical"; - break; - case 5: - type = "cd"; - break; - case 7: - type = "optical"; - break; - case 0xe: - type = "disk"; - break; - case 0xf: - type = "optical"; - break; - default: - break; - } - } - util_strscpy(to, len, type); + int type_num; + char *eptr; + char *type = "generic"; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 0: + type = "disk"; + break; + case 1: + type = "tape"; + break; + case 4: + type = "optical"; + break; + case 5: + type = "cd"; + break; + case 7: + type = "optical"; + break; + case 0xe: + type = "disk"; + break; + case 0xf: + type = "optical"; + break; + default: + break; + } + } + util_strscpy(to, len, type); } /* @@ -122,40 +122,40 @@ static void set_type(const char *from, char *to, size_t len) */ static char *get_value(char **buffer) { - static char *quote_string = "\"\n"; - static char *comma_string = ",\n"; - char *val; - char *end; - - if (**buffer == '"') { - /* - * skip leading quote, terminate when quote seen - */ - (*buffer)++; - end = quote_string; - } else { - end = comma_string; - } - val = strsep(buffer, end); - if (val && end == quote_string) - /* - * skip trailing quote - */ - (*buffer)++; - - while (isspace(**buffer)) - (*buffer)++; - - return val; + static char *quote_string = "\"\n"; + static char *comma_string = ",\n"; + char *val; + char *end; + + if (**buffer == '"') { + /* + * skip leading quote, terminate when quote seen + */ + (*buffer)++; + end = quote_string; + } else { + end = comma_string; + } + val = strsep(buffer, end); + if (val && end == quote_string) + /* + * skip trailing quote + */ + (*buffer)++; + + while (isspace(**buffer)) + (*buffer)++; + + return val; } static int argc_count(char *opts) { - int i = 0; - while (*opts != '\0') - if (*opts++ == ' ') - i++; - return i; + int i = 0; + while (*opts != '\0') + if (*opts++ == ' ') + i++; + return i; } /* @@ -168,356 +168,356 @@ static int argc_count(char *opts) * vendor and model can end in '\n'. */ static int get_file_options(struct udev *udev, - const char *vendor, const char *model, - int *argc, char ***newargv) + const char *vendor, const char *model, + int *argc, char ***newargv) { - char *buffer; - FILE *fd; - char *buf; - char *str1; - char *vendor_in, *model_in, *options_in; /* read in from file */ - int lineno; - int c; - int retval = 0; - - dbg(udev, "vendor='%s'; model='%s'\n", vendor, model); - fd = fopen(config_file, "r"); - if (fd == NULL) { - dbg(udev, "can't open %s\n", config_file); - if (errno == ENOENT) { - return 1; - } else { - err(udev, "can't open %s: %s\n", config_file, strerror(errno)); - return -1; - } - } - - /* - * Allocate a buffer rather than put it on the stack so we can - * keep it around to parse any options (any allocated newargv - * points into this buffer for its strings). - */ - buffer = malloc(MAX_BUFFER_LEN); - if (!buffer) { - fclose(fd); - err(udev, "can't allocate memory\n"); - return -1; - } - - *newargv = NULL; - lineno = 0; - while (1) { - vendor_in = model_in = options_in = NULL; - - buf = fgets(buffer, MAX_BUFFER_LEN, fd); - if (buf == NULL) - break; - lineno++; - if (buf[strlen(buffer) - 1] != '\n') { - err(udev, "Config file line %d too long\n", lineno); - break; - } - - while (isspace(*buf)) - buf++; - - /* blank or all whitespace line */ - if (*buf == '\0') - continue; - - /* comment line */ - if (*buf == '#') - continue; - - dbg(udev, "lineno %d: '%s'\n", lineno, buf); - str1 = strsep(&buf, "="); - if (str1 && strcasecmp(str1, "VENDOR") == 0) { - str1 = get_value(&buf); - if (!str1) { - retval = -1; - break; - } - vendor_in = str1; - - str1 = strsep(&buf, "="); - if (str1 && strcasecmp(str1, "MODEL") == 0) { - str1 = get_value(&buf); - if (!str1) { - retval = -1; - break; - } - model_in = str1; - str1 = strsep(&buf, "="); - } - } - - if (str1 && strcasecmp(str1, "OPTIONS") == 0) { - str1 = get_value(&buf); - if (!str1) { - retval = -1; - break; - } - options_in = str1; - } - dbg(udev, "config file line %d:\n" - " vendor '%s'; model '%s'; options '%s'\n", - lineno, vendor_in, model_in, options_in); - /* - * Only allow: [vendor=foo[,model=bar]]options=stuff - */ - if (!options_in || (!vendor_in && model_in)) { - err(udev, "Error parsing config file line %d '%s'\n", lineno, buffer); - retval = -1; - break; - } - if (vendor == NULL) { - if (vendor_in == NULL) { - dbg(udev, "matched global option\n"); - break; - } - } else if ((vendor_in && strncmp(vendor, vendor_in, - strlen(vendor_in)) == 0) && - (!model_in || (strncmp(model, model_in, - strlen(model_in)) == 0))) { - /* - * Matched vendor and optionally model. - * - * Note: a short vendor_in or model_in can - * give a partial match (that is FOO - * matches FOOBAR). - */ - dbg(udev, "matched vendor/model\n"); - break; - } else { - dbg(udev, "no match\n"); - } - } - - if (retval == 0) { - if (vendor_in != NULL || model_in != NULL || - options_in != NULL) { - /* - * Something matched. Allocate newargv, and store - * values found in options_in. - */ - strcpy(buffer, options_in); - c = argc_count(buffer) + 2; - *newargv = calloc(c, sizeof(**newargv)); - if (!*newargv) { - err(udev, "can't allocate memory\n"); - retval = -1; - } else { - *argc = c; - c = 0; - /* - * argv[0] at 0 is skipped by getopt, but - * store the buffer address there for - * later freeing - */ - (*newargv)[c] = buffer; - for (c = 1; c < *argc; c++) - (*newargv)[c] = strsep(&buffer, " \t"); - } - } else { - /* No matches */ - retval = 1; - } - } - if (retval != 0) - free(buffer); - fclose(fd); - return retval; + char *buffer; + FILE *fd; + char *buf; + char *str1; + char *vendor_in, *model_in, *options_in; /* read in from file */ + int lineno; + int c; + int retval = 0; + + dbg(udev, "vendor='%s'; model='%s'\n", vendor, model); + fd = fopen(config_file, "r"); + if (fd == NULL) { + dbg(udev, "can't open %s\n", config_file); + if (errno == ENOENT) { + return 1; + } else { + err(udev, "can't open %s: %s\n", config_file, strerror(errno)); + return -1; + } + } + + /* + * Allocate a buffer rather than put it on the stack so we can + * keep it around to parse any options (any allocated newargv + * points into this buffer for its strings). + */ + buffer = malloc(MAX_BUFFER_LEN); + if (!buffer) { + fclose(fd); + err(udev, "can't allocate memory\n"); + return -1; + } + + *newargv = NULL; + lineno = 0; + while (1) { + vendor_in = model_in = options_in = NULL; + + buf = fgets(buffer, MAX_BUFFER_LEN, fd); + if (buf == NULL) + break; + lineno++; + if (buf[strlen(buffer) - 1] != '\n') { + err(udev, "Config file line %d too long\n", lineno); + break; + } + + while (isspace(*buf)) + buf++; + + /* blank or all whitespace line */ + if (*buf == '\0') + continue; + + /* comment line */ + if (*buf == '#') + continue; + + dbg(udev, "lineno %d: '%s'\n", lineno, buf); + str1 = strsep(&buf, "="); + if (str1 && strcasecmp(str1, "VENDOR") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + vendor_in = str1; + + str1 = strsep(&buf, "="); + if (str1 && strcasecmp(str1, "MODEL") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + model_in = str1; + str1 = strsep(&buf, "="); + } + } + + if (str1 && strcasecmp(str1, "OPTIONS") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + options_in = str1; + } + dbg(udev, "config file line %d:\n" + " vendor '%s'; model '%s'; options '%s'\n", + lineno, vendor_in, model_in, options_in); + /* + * Only allow: [vendor=foo[,model=bar]]options=stuff + */ + if (!options_in || (!vendor_in && model_in)) { + err(udev, "Error parsing config file line %d '%s'\n", lineno, buffer); + retval = -1; + break; + } + if (vendor == NULL) { + if (vendor_in == NULL) { + dbg(udev, "matched global option\n"); + break; + } + } else if ((vendor_in && strncmp(vendor, vendor_in, + strlen(vendor_in)) == 0) && + (!model_in || (strncmp(model, model_in, + strlen(model_in)) == 0))) { + /* + * Matched vendor and optionally model. + * + * Note: a short vendor_in or model_in can + * give a partial match (that is FOO + * matches FOOBAR). + */ + dbg(udev, "matched vendor/model\n"); + break; + } else { + dbg(udev, "no match\n"); + } + } + + if (retval == 0) { + if (vendor_in != NULL || model_in != NULL || + options_in != NULL) { + /* + * Something matched. Allocate newargv, and store + * values found in options_in. + */ + strcpy(buffer, options_in); + c = argc_count(buffer) + 2; + *newargv = calloc(c, sizeof(**newargv)); + if (!*newargv) { + err(udev, "can't allocate memory\n"); + retval = -1; + } else { + *argc = c; + c = 0; + /* + * argv[0] at 0 is skipped by getopt, but + * store the buffer address there for + * later freeing + */ + (*newargv)[c] = buffer; + for (c = 1; c < *argc; c++) + (*newargv)[c] = strsep(&buffer, " \t"); + } + } else { + /* No matches */ + retval = 1; + } + } + if (retval != 0) + free(buffer); + fclose(fd); + return retval; } static int set_options(struct udev *udev, - int argc, char **argv, const char *short_opts, - char *maj_min_dev) + int argc, char **argv, const char *short_opts, + char *maj_min_dev) { - int option; - - /* - * optind is a global extern used by getopt. Since we can call - * set_options twice (once for command line, and once for config - * file) we have to reset this back to 1. - */ - optind = 1; - while (1) { - option = getopt_long(argc, argv, short_opts, options, NULL); - if (option == -1) - break; - - if (optarg) - dbg(udev, "option '%c' arg '%s'\n", option, optarg); - else - dbg(udev, "option '%c'\n", option); - - switch (option) { - case 'b': - all_good = 0; - break; - - case 'd': - dev_specified = 1; - util_strscpy(maj_min_dev, MAX_PATH_LEN, optarg); - break; - - case 'e': - use_stderr = 1; - break; - - case 'f': - util_strscpy(config_file, MAX_PATH_LEN, optarg); - break; - - case 'g': - all_good = 1; - break; - - case 'h': - printf("Usage: scsi_id OPTIONS \n" - " --device= device node for SG_IO commands\n" - " --config= location of config file\n" - " --page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\n" - " --sg-version=3|4 use SGv3 or SGv4\n" - " --blacklisted threat device as blacklisted\n" - " --whitelisted threat device as whitelisted\n" - " --replace-whitespace replace all whitespaces by underscores\n" - " --verbose verbose logging\n" - " --version print version\n" - " --export print values as environment keys\n" - " --help print this help text\n\n"); - exit(0); - - case 'p': - if (strcmp(optarg, "0x80") == 0) { - default_page_code = PAGE_80; - } else if (strcmp(optarg, "0x83") == 0) { - default_page_code = PAGE_83; - } else if (strcmp(optarg, "pre-spc3-83") == 0) { - default_page_code = PAGE_83_PRE_SPC3; - } else { - err(udev, "Unknown page code '%s'\n", optarg); - return -1; - } - break; - - case 's': - sg_version = atoi(optarg); - if (sg_version < 3 || sg_version > 4) { - err(udev, "Unknown SG version '%s'\n", optarg); - return -1; - } - break; - - case 'u': - reformat_serial = 1; - break; - - case 'x': - export = 1; - break; - - case 'v': - debug++; - break; - - case 'V': - printf("%s\n", VERSION); - exit(0); - break; - - default: - exit(1); - } - } - if (optind < argc && !dev_specified) { - dev_specified = 1; - util_strscpy(maj_min_dev, MAX_PATH_LEN, argv[optind]); - } - return 0; + int option; + + /* + * optind is a global extern used by getopt. Since we can call + * set_options twice (once for command line, and once for config + * file) we have to reset this back to 1. + */ + optind = 1; + while (1) { + option = getopt_long(argc, argv, short_opts, options, NULL); + if (option == -1) + break; + + if (optarg) + dbg(udev, "option '%c' arg '%s'\n", option, optarg); + else + dbg(udev, "option '%c'\n", option); + + switch (option) { + case 'b': + all_good = 0; + break; + + case 'd': + dev_specified = 1; + util_strscpy(maj_min_dev, MAX_PATH_LEN, optarg); + break; + + case 'e': + use_stderr = 1; + break; + + case 'f': + util_strscpy(config_file, MAX_PATH_LEN, optarg); + break; + + case 'g': + all_good = 1; + break; + + case 'h': + printf("Usage: scsi_id OPTIONS \n" + " --device= device node for SG_IO commands\n" + " --config= location of config file\n" + " --page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\n" + " --sg-version=3|4 use SGv3 or SGv4\n" + " --blacklisted threat device as blacklisted\n" + " --whitelisted threat device as whitelisted\n" + " --replace-whitespace replace all whitespaces by underscores\n" + " --verbose verbose logging\n" + " --version print version\n" + " --export print values as environment keys\n" + " --help print this help text\n\n"); + exit(0); + + case 'p': + if (strcmp(optarg, "0x80") == 0) { + default_page_code = PAGE_80; + } else if (strcmp(optarg, "0x83") == 0) { + default_page_code = PAGE_83; + } else if (strcmp(optarg, "pre-spc3-83") == 0) { + default_page_code = PAGE_83_PRE_SPC3; + } else { + err(udev, "Unknown page code '%s'\n", optarg); + return -1; + } + break; + + case 's': + sg_version = atoi(optarg); + if (sg_version < 3 || sg_version > 4) { + err(udev, "Unknown SG version '%s'\n", optarg); + return -1; + } + break; + + case 'u': + reformat_serial = 1; + break; + + case 'x': + export = 1; + break; + + case 'v': + debug++; + break; + + case 'V': + printf("%s\n", VERSION); + exit(0); + break; + + default: + exit(1); + } + } + if (optind < argc && !dev_specified) { + dev_specified = 1; + util_strscpy(maj_min_dev, MAX_PATH_LEN, argv[optind]); + } + return 0; } static int per_dev_options(struct udev *udev, - struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) + struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) { - int retval; - int newargc; - char **newargv = NULL; - int option; - - *good_bad = all_good; - *page_code = default_page_code; - - retval = get_file_options(udev, vendor_str, model_str, &newargc, &newargv); - - optind = 1; /* reset this global extern */ - while (retval == 0) { - option = getopt_long(newargc, newargv, dev_short_options, options, NULL); - if (option == -1) - break; - - if (optarg) - dbg(udev, "option '%c' arg '%s'\n", option, optarg); - else - dbg(udev, "option '%c'\n", option); - - switch (option) { - case 'b': - *good_bad = 0; - break; - - case 'g': - *good_bad = 1; - break; - - case 'p': - if (strcmp(optarg, "0x80") == 0) { - *page_code = PAGE_80; - } else if (strcmp(optarg, "0x83") == 0) { - *page_code = PAGE_83; - } else if (strcmp(optarg, "pre-spc3-83") == 0) { - *page_code = PAGE_83_PRE_SPC3; - } else { - err(udev, "Unknown page code '%s'\n", optarg); - retval = -1; - } - break; - - default: - err(udev, "Unknown or bad option '%c' (0x%x)\n", option, option); - retval = -1; - break; - } - } - - if (newargv) { - free(newargv[0]); - free(newargv); - } - return retval; + int retval; + int newargc; + char **newargv = NULL; + int option; + + *good_bad = all_good; + *page_code = default_page_code; + + retval = get_file_options(udev, vendor_str, model_str, &newargc, &newargv); + + optind = 1; /* reset this global extern */ + while (retval == 0) { + option = getopt_long(newargc, newargv, dev_short_options, options, NULL); + if (option == -1) + break; + + if (optarg) + dbg(udev, "option '%c' arg '%s'\n", option, optarg); + else + dbg(udev, "option '%c'\n", option); + + switch (option) { + case 'b': + *good_bad = 0; + break; + + case 'g': + *good_bad = 1; + break; + + case 'p': + if (strcmp(optarg, "0x80") == 0) { + *page_code = PAGE_80; + } else if (strcmp(optarg, "0x83") == 0) { + *page_code = PAGE_83; + } else if (strcmp(optarg, "pre-spc3-83") == 0) { + *page_code = PAGE_83_PRE_SPC3; + } else { + err(udev, "Unknown page code '%s'\n", optarg); + retval = -1; + } + break; + + default: + err(udev, "Unknown or bad option '%c' (0x%x)\n", option, option); + retval = -1; + break; + } + } + + if (newargv) { + free(newargv[0]); + free(newargv); + } + return retval; } static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, const char *path) { - int retval; + int retval; - dev_scsi->use_sg = sg_version; + dev_scsi->use_sg = sg_version; - retval = scsi_std_inquiry(udev, dev_scsi, path); - if (retval) - return retval; + retval = scsi_std_inquiry(udev, dev_scsi, path); + if (retval) + return retval; - udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); - udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); + udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); + udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); - util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); - util_replace_chars(vendor_str, NULL); - util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); - util_replace_chars(model_str, NULL); - set_type(dev_scsi->type, type_str, sizeof(type_str)); - util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); - util_replace_chars(revision_str, NULL); - return 0; + util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); + util_replace_chars(vendor_str, NULL); + util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); + util_replace_chars(model_str, NULL); + set_type(dev_scsi->type, type_str, sizeof(type_str)); + util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); + util_replace_chars(revision_str, NULL); + return 0; } /* @@ -526,132 +526,132 @@ static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, co */ static int scsi_id(struct udev *udev, char *maj_min_dev) { - struct scsi_id_device dev_scsi; - int good_dev; - int page_code; - int retval = 0; - - memset(&dev_scsi, 0x00, sizeof(struct scsi_id_device)); - - if (set_inq_values(udev, &dev_scsi, maj_min_dev) < 0) { - retval = 1; - goto out; - } - - /* get per device (vendor + model) options from the config file */ - per_dev_options(udev, &dev_scsi, &good_dev, &page_code); - dbg(udev, "per dev options: good %d; page code 0x%x\n", good_dev, page_code); - if (!good_dev) { - retval = 1; - goto out; - } - - /* read serial number from mode pages (no values for optical drives) */ - scsi_get_serial(udev, &dev_scsi, maj_min_dev, page_code, MAX_SERIAL_LEN); - - if (export) { - char serial_str[MAX_SERIAL_LEN]; - - printf("ID_SCSI=1\n"); - printf("ID_VENDOR=%s\n", vendor_str); - printf("ID_VENDOR_ENC=%s\n", vendor_enc_str); - printf("ID_MODEL=%s\n", model_str); - printf("ID_MODEL_ENC=%s\n", model_enc_str); - printf("ID_REVISION=%s\n", revision_str); - printf("ID_TYPE=%s\n", type_str); - if (dev_scsi.serial[0] != '\0') { - util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - util_replace_chars(serial_str, NULL); - printf("ID_SERIAL=%s\n", serial_str); - util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); - util_replace_chars(serial_str, NULL); - printf("ID_SERIAL_SHORT=%s\n", serial_str); - } - if (dev_scsi.wwn[0] != '\0') { - printf("ID_WWN=0x%s\n", dev_scsi.wwn); - if (dev_scsi.wwn_vendor_extension[0] != '\0') { - printf("ID_WWN_VENDOR_EXTENSION=0x%s\n", dev_scsi.wwn_vendor_extension); - printf("ID_WWN_WITH_EXTENSION=0x%s%s\n", dev_scsi.wwn, dev_scsi.wwn_vendor_extension); - } else { - printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn); - } - } - if (dev_scsi.tgpt_group[0] != '\0') { - printf("ID_TARGET_PORT=%s\n", dev_scsi.tgpt_group); - } - if (dev_scsi.unit_serial_number[0] != '\0') { - printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); - } - goto out; - } - - if (dev_scsi.serial[0] == '\0') { - retval = 1; - goto out; - } - - if (reformat_serial) { - char serial_str[MAX_SERIAL_LEN]; - - util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - util_replace_chars(serial_str, NULL); - printf("%s\n", serial_str); - goto out; - } - - printf("%s\n", dev_scsi.serial); + struct scsi_id_device dev_scsi; + int good_dev; + int page_code; + int retval = 0; + + memset(&dev_scsi, 0x00, sizeof(struct scsi_id_device)); + + if (set_inq_values(udev, &dev_scsi, maj_min_dev) < 0) { + retval = 1; + goto out; + } + + /* get per device (vendor + model) options from the config file */ + per_dev_options(udev, &dev_scsi, &good_dev, &page_code); + dbg(udev, "per dev options: good %d; page code 0x%x\n", good_dev, page_code); + if (!good_dev) { + retval = 1; + goto out; + } + + /* read serial number from mode pages (no values for optical drives) */ + scsi_get_serial(udev, &dev_scsi, maj_min_dev, page_code, MAX_SERIAL_LEN); + + if (export) { + char serial_str[MAX_SERIAL_LEN]; + + printf("ID_SCSI=1\n"); + printf("ID_VENDOR=%s\n", vendor_str); + printf("ID_VENDOR_ENC=%s\n", vendor_enc_str); + printf("ID_MODEL=%s\n", model_str); + printf("ID_MODEL_ENC=%s\n", model_enc_str); + printf("ID_REVISION=%s\n", revision_str); + printf("ID_TYPE=%s\n", type_str); + if (dev_scsi.serial[0] != '\0') { + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("ID_SERIAL=%s\n", serial_str); + util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("ID_SERIAL_SHORT=%s\n", serial_str); + } + if (dev_scsi.wwn[0] != '\0') { + printf("ID_WWN=0x%s\n", dev_scsi.wwn); + if (dev_scsi.wwn_vendor_extension[0] != '\0') { + printf("ID_WWN_VENDOR_EXTENSION=0x%s\n", dev_scsi.wwn_vendor_extension); + printf("ID_WWN_WITH_EXTENSION=0x%s%s\n", dev_scsi.wwn, dev_scsi.wwn_vendor_extension); + } else { + printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn); + } + } + if (dev_scsi.tgpt_group[0] != '\0') { + printf("ID_TARGET_PORT=%s\n", dev_scsi.tgpt_group); + } + if (dev_scsi.unit_serial_number[0] != '\0') { + printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); + } + goto out; + } + + if (dev_scsi.serial[0] == '\0') { + retval = 1; + goto out; + } + + if (reformat_serial) { + char serial_str[MAX_SERIAL_LEN]; + + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("%s\n", serial_str); + goto out; + } + + printf("%s\n", dev_scsi.serial); out: - return retval; + return retval; } int main(int argc, char **argv) { - struct udev *udev; - int retval = 0; - char maj_min_dev[MAX_PATH_LEN]; - int newargc; - char **newargv; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("scsi_id"); - udev_set_log_fn(udev, log_fn); - - /* - * Get config file options. - */ - newargv = NULL; - retval = get_file_options(udev, NULL, NULL, &newargc, &newargv); - if (retval < 0) { - retval = 1; - goto exit; - } - if (newargv && (retval == 0)) { - if (set_options(udev, newargc, newargv, short_options, maj_min_dev) < 0) { - retval = 2; - goto exit; - } - free(newargv); - } - - /* - * Get command line options (overriding any config file settings). - */ - if (set_options(udev, argc, argv, short_options, maj_min_dev) < 0) - exit(1); - - if (!dev_specified) { - err(udev, "no device specified\n"); - retval = 1; - goto exit; - } - - retval = scsi_id(udev, maj_min_dev); + struct udev *udev; + int retval = 0; + char maj_min_dev[MAX_PATH_LEN]; + int newargc; + char **newargv; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("scsi_id"); + udev_set_log_fn(udev, log_fn); + + /* + * Get config file options. + */ + newargv = NULL; + retval = get_file_options(udev, NULL, NULL, &newargc, &newargv); + if (retval < 0) { + retval = 1; + goto exit; + } + if (newargv && (retval == 0)) { + if (set_options(udev, newargc, newargv, short_options, maj_min_dev) < 0) { + retval = 2; + goto exit; + } + free(newargv); + } + + /* + * Get command line options (overriding any config file settings). + */ + if (set_options(udev, argc, argv, short_options, maj_min_dev) < 0) + exit(1); + + if (!dev_specified) { + err(udev, "no device specified\n"); + retval = 1; + goto exit; + } + + retval = scsi_id(udev, maj_min_dev); exit: - udev_unref(udev); - udev_log_close(); - return retval; + udev_unref(udev); + udev_log_close(); + return retval; } diff --git a/src/extras/scsi_id/scsi_id.h b/src/extras/scsi_id/scsi_id.h index a28f5e073c..828a98305f 100644 --- a/src/extras/scsi_id/scsi_id.h +++ b/src/extras/scsi_id/scsi_id.h @@ -15,35 +15,35 @@ * along with this program. If not, see . */ -#define MAX_PATH_LEN 512 +#define MAX_PATH_LEN 512 /* * MAX_ATTR_LEN: maximum length of the result of reading a sysfs * attribute. */ -#define MAX_ATTR_LEN 256 +#define MAX_ATTR_LEN 256 /* * MAX_SERIAL_LEN: the maximum length of the serial number, including * added prefixes such as vendor and product (model) strings. */ -#define MAX_SERIAL_LEN 256 +#define MAX_SERIAL_LEN 256 /* * MAX_BUFFER_LEN: maximum buffer size and line length used while reading * the config file. */ -#define MAX_BUFFER_LEN 256 +#define MAX_BUFFER_LEN 256 struct scsi_id_device { - char vendor[9]; - char model[17]; - char revision[5]; - char type[33]; - char kernel[64]; - char serial[MAX_SERIAL_LEN]; - char serial_short[MAX_SERIAL_LEN]; - int use_sg; + char vendor[9]; + char model[17]; + char revision[5]; + char type[33]; + char kernel[64]; + char serial[MAX_SERIAL_LEN]; + char serial_short[MAX_SERIAL_LEN]; + int use_sg; /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */ char unit_serial_number[MAX_SERIAL_LEN]; @@ -54,20 +54,20 @@ struct scsi_id_device { /* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */ char wwn_vendor_extension[17]; - /* NULs if not set - otherwise decimal number */ - char tgpt_group[8]; + /* NULs if not set - otherwise decimal number */ + char tgpt_group[8]; }; extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); extern int scsi_get_serial (struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname, - int page_code, int len); + int page_code, int len); /* * Page code values. */ enum page_code { - PAGE_83_PRE_SPC3 = -0x83, - PAGE_UNSPECIFIED = 0x00, - PAGE_80 = 0x80, - PAGE_83 = 0x83, + PAGE_83_PRE_SPC3 = -0x83, + PAGE_UNSPECIFIED = 0x00, + PAGE_80 = 0x80, + PAGE_83 = 0x83, }; diff --git a/src/extras/scsi_id/scsi_serial.c b/src/extras/scsi_id/scsi_serial.c index 61ec618e99..f1d63f40cc 100644 --- a/src/extras/scsi_id/scsi_serial.c +++ b/src/extras/scsi_id/scsi_serial.c @@ -48,28 +48,28 @@ * is normally one or some small number of descriptors. */ static const struct scsi_id_search_values id_search_list[] = { - { SCSI_ID_TGTGROUP, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_ASCII }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_ASCII }, - /* - * Devices already exist using NAA values that are now marked - * reserved. These should not conflict with other values, or it is - * a bug in the device. As long as we find the IEEE extended one - * first, we really don't care what other ones are used. Using - * don't care here means that a device that returns multiple - * non-IEEE descriptors in a random order will get different - * names. - */ - { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, - { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, - { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, - { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_TGTGROUP, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_ASCII }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_ASCII }, + /* + * Devices already exist using NAA values that are now marked + * reserved. These should not conflict with other values, or it is + * a bug in the device. As long as we find the IEEE extended one + * first, we really don't care what other ones are used. Using + * don't care here means that a device that returns multiple + * non-IEEE descriptors in a random order will get different + * names. + */ + { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, }; static const char hex_str[]="0123456789abcdef"; @@ -79,376 +79,376 @@ static const char hex_str[]="0123456789abcdef"; * are used here. */ -#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ -#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ -#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ -#define DRIVER_TIMEOUT 0x06 -#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ +#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ +#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ +#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ /* The following "category" function returns one of the following */ -#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ -#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ -#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ -#define SG_ERR_CAT_TIMEOUT 3 -#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ -#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ -#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ -#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ +#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ +#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ +#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ +#define SG_ERR_CAT_TIMEOUT 3 +#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ +#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ +#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ static int do_scsi_page80_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int max_len); + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int max_len); static int sg_err_category_new(struct udev *udev, - int scsi_status, int msg_status, int - host_status, int driver_status, const - unsigned char *sense_buffer, int sb_len) + int scsi_status, int msg_status, int + host_status, int driver_status, const + unsigned char *sense_buffer, int sb_len) { - scsi_status &= 0x7e; - - /* - * XXX change to return only two values - failed or OK. - */ - - if (!scsi_status && !host_status && !driver_status) - return SG_ERR_CAT_CLEAN; - - if ((scsi_status == SCSI_CHECK_CONDITION) || - (scsi_status == SCSI_COMMAND_TERMINATED) || - ((driver_status & 0xf) == DRIVER_SENSE)) { - if (sense_buffer && (sb_len > 2)) { - int sense_key; - unsigned char asc; - - if (sense_buffer[0] & 0x2) { - sense_key = sense_buffer[1] & 0xf; - asc = sense_buffer[2]; - } else { - sense_key = sense_buffer[2] & 0xf; - asc = (sb_len > 12) ? sense_buffer[12] : 0; - } - - if (sense_key == RECOVERED_ERROR) - return SG_ERR_CAT_RECOVERED; - else if (sense_key == UNIT_ATTENTION) { - if (0x28 == asc) - return SG_ERR_CAT_MEDIA_CHANGED; - if (0x29 == asc) - return SG_ERR_CAT_RESET; - } else if (sense_key == ILLEGAL_REQUEST) { - return SG_ERR_CAT_NOTSUPPORTED; - } - } - return SG_ERR_CAT_SENSE; - } - if (host_status) { - if ((host_status == DID_NO_CONNECT) || - (host_status == DID_BUS_BUSY) || - (host_status == DID_TIME_OUT)) - return SG_ERR_CAT_TIMEOUT; - } - if (driver_status) { - if (driver_status == DRIVER_TIMEOUT) - return SG_ERR_CAT_TIMEOUT; - } - return SG_ERR_CAT_OTHER; + scsi_status &= 0x7e; + + /* + * XXX change to return only two values - failed or OK. + */ + + if (!scsi_status && !host_status && !driver_status) + return SG_ERR_CAT_CLEAN; + + if ((scsi_status == SCSI_CHECK_CONDITION) || + (scsi_status == SCSI_COMMAND_TERMINATED) || + ((driver_status & 0xf) == DRIVER_SENSE)) { + if (sense_buffer && (sb_len > 2)) { + int sense_key; + unsigned char asc; + + if (sense_buffer[0] & 0x2) { + sense_key = sense_buffer[1] & 0xf; + asc = sense_buffer[2]; + } else { + sense_key = sense_buffer[2] & 0xf; + asc = (sb_len > 12) ? sense_buffer[12] : 0; + } + + if (sense_key == RECOVERED_ERROR) + return SG_ERR_CAT_RECOVERED; + else if (sense_key == UNIT_ATTENTION) { + if (0x28 == asc) + return SG_ERR_CAT_MEDIA_CHANGED; + if (0x29 == asc) + return SG_ERR_CAT_RESET; + } else if (sense_key == ILLEGAL_REQUEST) { + return SG_ERR_CAT_NOTSUPPORTED; + } + } + return SG_ERR_CAT_SENSE; + } + if (host_status) { + if ((host_status == DID_NO_CONNECT) || + (host_status == DID_BUS_BUSY) || + (host_status == DID_TIME_OUT)) + return SG_ERR_CAT_TIMEOUT; + } + if (driver_status) { + if (driver_status == DRIVER_TIMEOUT) + return SG_ERR_CAT_TIMEOUT; + } + return SG_ERR_CAT_OTHER; } static int sg_err_category3(struct udev *udev, struct sg_io_hdr *hp) { - return sg_err_category_new(udev, - hp->status, hp->msg_status, - hp->host_status, hp->driver_status, - hp->sbp, hp->sb_len_wr); + return sg_err_category_new(udev, + hp->status, hp->msg_status, + hp->host_status, hp->driver_status, + hp->sbp, hp->sb_len_wr); } static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) { - return sg_err_category_new(udev, hp->device_status, 0, - hp->transport_status, hp->driver_status, - (unsigned char *)(uintptr_t)hp->response, - hp->response_len); + return sg_err_category_new(udev, hp->device_status, 0, + hp->transport_status, hp->driver_status, + (unsigned char *)(uintptr_t)hp->response, + hp->response_len); } static int scsi_dump_sense(struct udev *udev, - struct scsi_id_device *dev_scsi, - unsigned char *sense_buffer, int sb_len) + struct scsi_id_device *dev_scsi, + unsigned char *sense_buffer, int sb_len) { - int s; - int code; - int sense_class; - int sense_key; - int asc, ascq; + int s; + int code; + int sense_class; + int sense_key; + int asc, ascq; #ifdef DUMP_SENSE - char out_buffer[256]; - int i, j; + char out_buffer[256]; + int i, j; #endif - /* - * Figure out and print the sense key, asc and ascq. - * - * If you want to suppress these for a particular drive model, add - * a black list entry in the scsi_id config file. - * - * XXX We probably need to: lookup the sense/asc/ascq in a retry - * table, and if found return 1 (after dumping the sense, asc, and - * ascq). So, if/when we get something like a power on/reset, - * we'll retry the command. - */ - - dbg(udev, "got check condition\n"); - - if (sb_len < 1) { - info(udev, "%s: sense buffer empty\n", dev_scsi->kernel); - return -1; - } - - sense_class = (sense_buffer[0] >> 4) & 0x07; - code = sense_buffer[0] & 0xf; - - if (sense_class == 7) { - /* - * extended sense data. - */ - s = sense_buffer[7] + 8; - if (sb_len < s) { - info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", - dev_scsi->kernel, sb_len, s - sb_len); - return -1; - } - if ((code == 0x0) || (code == 0x1)) { - sense_key = sense_buffer[2] & 0xf; - if (s < 14) { - /* - * Possible? - */ - info(udev, "%s: sense result too" " small %d bytes\n", - dev_scsi->kernel, s); - return -1; - } - asc = sense_buffer[12]; - ascq = sense_buffer[13]; - } else if ((code == 0x2) || (code == 0x3)) { - sense_key = sense_buffer[1] & 0xf; - asc = sense_buffer[2]; - ascq = sense_buffer[3]; - } else { - info(udev, "%s: invalid sense code 0x%x\n", - dev_scsi->kernel, code); - return -1; - } - info(udev, "%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", - dev_scsi->kernel, sense_key, asc, ascq); - } else { - if (sb_len < 4) { - info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", - dev_scsi->kernel, sb_len, 4 - sb_len); - return -1; - } - - if (sense_buffer[0] < 15) - info(udev, "%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); - else - info(udev, "%s: sense = %2x %2x\n", - dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); - info(udev, "%s: non-extended sense class %d code 0x%0x\n", - dev_scsi->kernel, sense_class, code); - - } + /* + * Figure out and print the sense key, asc and ascq. + * + * If you want to suppress these for a particular drive model, add + * a black list entry in the scsi_id config file. + * + * XXX We probably need to: lookup the sense/asc/ascq in a retry + * table, and if found return 1 (after dumping the sense, asc, and + * ascq). So, if/when we get something like a power on/reset, + * we'll retry the command. + */ + + dbg(udev, "got check condition\n"); + + if (sb_len < 1) { + info(udev, "%s: sense buffer empty\n", dev_scsi->kernel); + return -1; + } + + sense_class = (sense_buffer[0] >> 4) & 0x07; + code = sense_buffer[0] & 0xf; + + if (sense_class == 7) { + /* + * extended sense data. + */ + s = sense_buffer[7] + 8; + if (sb_len < s) { + info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", + dev_scsi->kernel, sb_len, s - sb_len); + return -1; + } + if ((code == 0x0) || (code == 0x1)) { + sense_key = sense_buffer[2] & 0xf; + if (s < 14) { + /* + * Possible? + */ + info(udev, "%s: sense result too" " small %d bytes\n", + dev_scsi->kernel, s); + return -1; + } + asc = sense_buffer[12]; + ascq = sense_buffer[13]; + } else if ((code == 0x2) || (code == 0x3)) { + sense_key = sense_buffer[1] & 0xf; + asc = sense_buffer[2]; + ascq = sense_buffer[3]; + } else { + info(udev, "%s: invalid sense code 0x%x\n", + dev_scsi->kernel, code); + return -1; + } + info(udev, "%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", + dev_scsi->kernel, sense_key, asc, ascq); + } else { + if (sb_len < 4) { + info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", + dev_scsi->kernel, sb_len, 4 - sb_len); + return -1; + } + + if (sense_buffer[0] < 15) + info(udev, "%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); + else + info(udev, "%s: sense = %2x %2x\n", + dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); + info(udev, "%s: non-extended sense class %d code 0x%0x\n", + dev_scsi->kernel, sense_class, code); + + } #ifdef DUMP_SENSE - for (i = 0, j = 0; (i < s) && (j < 254); i++) { - dbg(udev, "i %d, j %d\n", i, j); - out_buffer[j++] = hex_str[(sense_buffer[i] & 0xf0) >> 4]; - out_buffer[j++] = hex_str[sense_buffer[i] & 0x0f]; - out_buffer[j++] = ' '; - } - out_buffer[j] = '\0'; - info(udev, "%s: sense dump:\n", dev_scsi->kernel); - info(udev, "%s: %s\n", dev_scsi->kernel, out_buffer); + for (i = 0, j = 0; (i < s) && (j < 254); i++) { + dbg(udev, "i %d, j %d\n", i, j); + out_buffer[j++] = hex_str[(sense_buffer[i] & 0xf0) >> 4]; + out_buffer[j++] = hex_str[sense_buffer[i] & 0x0f]; + out_buffer[j++] = ' '; + } + out_buffer[j] = '\0'; + info(udev, "%s: sense dump:\n", dev_scsi->kernel); + info(udev, "%s: %s\n", dev_scsi->kernel, out_buffer); #endif - return -1; + return -1; } static int scsi_dump(struct udev *udev, - struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) + struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) { - if (!io->status && !io->host_status && !io->msg_status && - !io->driver_status) { - /* - * Impossible, should not be called. - */ - info(udev, "%s: called with no error\n", __FUNCTION__); - return -1; - } - - info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", - dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); - if (io->status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(udev, dev_scsi, io->sbp, io->sb_len_wr); - else - return -1; + if (!io->status && !io->host_status && !io->msg_status && + !io->driver_status) { + /* + * Impossible, should not be called. + */ + info(udev, "%s: called with no error\n", __FUNCTION__); + return -1; + } + + info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", + dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); + if (io->status == SCSI_CHECK_CONDITION) + return scsi_dump_sense(udev, dev_scsi, io->sbp, io->sb_len_wr); + else + return -1; } static int scsi_dump_v4(struct udev *udev, - struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) + struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) { - if (!io->device_status && !io->transport_status && - !io->driver_status) { - /* - * Impossible, should not be called. - */ - info(udev, "%s: called with no error\n", __FUNCTION__); - return -1; - } - - info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x\n", - dev_scsi->kernel, io->driver_status, io->transport_status, - io->device_status); - if (io->device_status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(udev, dev_scsi, (unsigned char *)(uintptr_t)io->response, - io->response_len); - else - return -1; + if (!io->device_status && !io->transport_status && + !io->driver_status) { + /* + * Impossible, should not be called. + */ + info(udev, "%s: called with no error\n", __FUNCTION__); + return -1; + } + + info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x\n", + dev_scsi->kernel, io->driver_status, io->transport_status, + io->device_status); + if (io->device_status == SCSI_CHECK_CONDITION) + return scsi_dump_sense(udev, dev_scsi, (unsigned char *)(uintptr_t)io->response, + io->response_len); + else + return -1; } static int scsi_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - unsigned char evpd, unsigned char page, - unsigned char *buf, unsigned int buflen) + struct scsi_id_device *dev_scsi, int fd, + unsigned char evpd, unsigned char page, + unsigned char *buf, unsigned int buflen) { - unsigned char inq_cmd[INQUIRY_CMDLEN] = - { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; - unsigned char sense[SENSE_BUFF_LEN]; - void *io_buf; - struct sg_io_v4 io_v4; - struct sg_io_hdr io_hdr; - int retry = 3; /* rather random */ - int retval; - - if (buflen > SCSI_INQ_BUFF_LEN) { - info(udev, "buflen %d too long\n", buflen); - return -1; - } + unsigned char inq_cmd[INQUIRY_CMDLEN] = + { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; + unsigned char sense[SENSE_BUFF_LEN]; + void *io_buf; + struct sg_io_v4 io_v4; + struct sg_io_hdr io_hdr; + int retry = 3; /* rather random */ + int retval; + + if (buflen > SCSI_INQ_BUFF_LEN) { + info(udev, "buflen %d too long\n", buflen); + return -1; + } resend: - dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); - - if (dev_scsi->use_sg == 4) { - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof(inq_cmd); - io_v4.request = (uintptr_t)inq_cmd; - io_v4.max_response_len = sizeof(sense); - io_v4.response = (uintptr_t)sense; - io_v4.din_xfer_len = buflen; - io_v4.din_xferp = (uintptr_t)buf; - io_buf = (void *)&io_v4; - } else { - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(inq_cmd); - io_hdr.mx_sb_len = sizeof(sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.dxfer_len = buflen; - io_hdr.dxferp = buf; - io_hdr.cmdp = inq_cmd; - io_hdr.sbp = sense; - io_hdr.timeout = DEF_TIMEOUT; - io_buf = (void *)&io_hdr; - } - - retval = ioctl(fd, SG_IO, io_buf); - if (retval < 0) { - if ((errno == EINVAL || errno == ENOSYS) && dev_scsi->use_sg == 4) { - dev_scsi->use_sg = 3; - goto resend; - } - info(udev, "%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); - goto error; - } - - if (dev_scsi->use_sg == 4) - retval = sg_err_category4(udev, io_buf); - else - retval = sg_err_category3(udev, io_buf); - - switch (retval) { - case SG_ERR_CAT_NOTSUPPORTED: - buf[1] = 0; - /* Fallthrough */ - case SG_ERR_CAT_CLEAN: - case SG_ERR_CAT_RECOVERED: - retval = 0; - break; - - default: - if (dev_scsi->use_sg == 4) - retval = scsi_dump_v4(udev, dev_scsi, io_buf); - else - retval = scsi_dump(udev, dev_scsi, io_buf); - } - - if (!retval) { - retval = buflen; - } else if (retval > 0) { - if (--retry > 0) { - dbg(udev, "%s: Retrying ...\n", dev_scsi->kernel); - goto resend; - } - retval = -1; - } + dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); + + if (dev_scsi->use_sg == 4) { + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof(inq_cmd); + io_v4.request = (uintptr_t)inq_cmd; + io_v4.max_response_len = sizeof(sense); + io_v4.response = (uintptr_t)sense; + io_v4.din_xfer_len = buflen; + io_v4.din_xferp = (uintptr_t)buf; + io_buf = (void *)&io_v4; + } else { + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof(inq_cmd); + io_hdr.mx_sb_len = sizeof(sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = buflen; + io_hdr.dxferp = buf; + io_hdr.cmdp = inq_cmd; + io_hdr.sbp = sense; + io_hdr.timeout = DEF_TIMEOUT; + io_buf = (void *)&io_hdr; + } + + retval = ioctl(fd, SG_IO, io_buf); + if (retval < 0) { + if ((errno == EINVAL || errno == ENOSYS) && dev_scsi->use_sg == 4) { + dev_scsi->use_sg = 3; + goto resend; + } + info(udev, "%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); + goto error; + } + + if (dev_scsi->use_sg == 4) + retval = sg_err_category4(udev, io_buf); + else + retval = sg_err_category3(udev, io_buf); + + switch (retval) { + case SG_ERR_CAT_NOTSUPPORTED: + buf[1] = 0; + /* Fallthrough */ + case SG_ERR_CAT_CLEAN: + case SG_ERR_CAT_RECOVERED: + retval = 0; + break; + + default: + if (dev_scsi->use_sg == 4) + retval = scsi_dump_v4(udev, dev_scsi, io_buf); + else + retval = scsi_dump(udev, dev_scsi, io_buf); + } + + if (!retval) { + retval = buflen; + } else if (retval > 0) { + if (--retry > 0) { + dbg(udev, "%s: Retrying ...\n", dev_scsi->kernel); + goto resend; + } + retval = -1; + } error: - if (retval < 0) - info(udev, "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", - dev_scsi->kernel, evpd, page); + if (retval < 0) + info(udev, "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", + dev_scsi->kernel, evpd, page); - return retval; + return retval; } /* Get list of supported EVPD pages */ static int do_scsi_page0_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - unsigned char *buffer, unsigned int len) + struct scsi_id_device *dev_scsi, int fd, + unsigned char *buffer, unsigned int len) { - int retval; - - memset(buffer, 0, len); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, 0x0, buffer, len); - if (retval < 0) - return 1; - - if (buffer[1] != 0) { - info(udev, "%s: page 0 not available.\n", dev_scsi->kernel); - return 1; - } - if (buffer[3] > len) { - info(udev, "%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); - return 1; - } - - /* - * Following check is based on code once included in the 2.5.x - * kernel. - * - * Some ill behaved devices return the standard inquiry here - * rather than the evpd data, snoop the data to verify. - */ - if (buffer[3] > MODEL_LENGTH) { - /* - * If the vendor id appears in the page assume the page is - * invalid. - */ - if (!strncmp((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) { - info(udev, "%s: invalid page0 data\n", dev_scsi->kernel); - return 1; - } - } - return 0; + int retval; + + memset(buffer, 0, len); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, 0x0, buffer, len); + if (retval < 0) + return 1; + + if (buffer[1] != 0) { + info(udev, "%s: page 0 not available.\n", dev_scsi->kernel); + return 1; + } + if (buffer[3] > len) { + info(udev, "%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); + return 1; + } + + /* + * Following check is based on code once included in the 2.5.x + * kernel. + * + * Some ill behaved devices return the standard inquiry here + * rather than the evpd data, snoop the data to verify. + */ + if (buffer[3] > MODEL_LENGTH) { + /* + * If the vendor id appears in the page assume the page is + * invalid. + */ + if (!strncmp((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) { + info(udev, "%s: invalid page0 data\n", dev_scsi->kernel); + return 1; + } + } + return 0; } /* @@ -456,24 +456,24 @@ static int do_scsi_page0_inquiry(struct udev *udev, * model. */ static int prepend_vendor_model(struct udev *udev, - struct scsi_id_device *dev_scsi, char *serial) + struct scsi_id_device *dev_scsi, char *serial) { - int ind; - - strncpy(serial, dev_scsi->vendor, VENDOR_LENGTH); - strncat(serial, dev_scsi->model, MODEL_LENGTH); - ind = strlen(serial); - - /* - * This is not a complete check, since we are using strncat/cpy - * above, ind will never be too large. - */ - if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { - info(udev, "%s: expected length %d, got length %d\n", - dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); - return -1; - } - return ind; + int ind; + + strncpy(serial, dev_scsi->vendor, VENDOR_LENGTH); + strncat(serial, dev_scsi->model, MODEL_LENGTH); + ind = strlen(serial); + + /* + * This is not a complete check, since we are using strncat/cpy + * above, ind will never be too large. + */ + if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { + info(udev, "%s: expected length %d, got length %d\n", + dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); + return -1; + } + return ind; } /** @@ -481,236 +481,236 @@ static int prepend_vendor_model(struct udev *udev, * serial number. **/ static int check_fill_0x83_id(struct udev *udev, - struct scsi_id_device *dev_scsi, - unsigned char *page_83, - const struct scsi_id_search_values - *id_search, char *serial, char *serial_short, - int max_len, char *wwn, - char *wwn_vendor_extension, char *tgpt_group) + struct scsi_id_device *dev_scsi, + unsigned char *page_83, + const struct scsi_id_search_values + *id_search, char *serial, char *serial_short, + int max_len, char *wwn, + char *wwn_vendor_extension, char *tgpt_group) { - int i, j, s, len; - - /* - * ASSOCIATION must be with the device (value 0) - * or with the target port for SCSI_ID_TGTPORT - */ - if ((page_83[1] & 0x30) == 0x10) { - if (id_search->id_type != SCSI_ID_TGTGROUP) - return 1; - } else if ((page_83[1] & 0x30) != 0) { - return 1; - } - - if ((page_83[1] & 0x0f) != id_search->id_type) - return 1; - - /* - * Possibly check NAA sub-type. - */ - if ((id_search->naa_type != SCSI_ID_NAA_DONT_CARE) && - (id_search->naa_type != (page_83[4] & 0xf0) >> 4)) - return 1; - - /* - * Check for matching code set - ASCII or BINARY. - */ - if ((page_83[0] & 0x0f) != id_search->code_set) - return 1; - - /* - * page_83[3]: identifier length - */ - len = page_83[3]; - if ((page_83[0] & 0x0f) != SCSI_ID_ASCII) - /* - * If not ASCII, use two bytes for each binary value. - */ - len *= 2; - - /* - * Add one byte for the NUL termination, and one for the id_type. - */ - len += 2; - if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) - len += VENDOR_LENGTH + MODEL_LENGTH; - - if (max_len < len) { - info(udev, "%s: length %d too short - need %d\n", - dev_scsi->kernel, max_len, len); - return 1; - } - - if (id_search->id_type == SCSI_ID_TGTGROUP && tgpt_group != NULL) { - unsigned int group; - - group = ((unsigned int)page_83[6] << 8) | page_83[7]; - sprintf(tgpt_group,"%x", group); - return 1; - } - - serial[0] = hex_str[id_search->id_type]; - - /* - * For SCSI_ID_VENDOR_SPECIFIC prepend the vendor and model before - * the id since it is not unique across all vendors and models, - * this differs from SCSI_ID_T10_VENDOR, where the vendor is - * included in the identifier. - */ - if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) - if (prepend_vendor_model(udev, dev_scsi, &serial[1]) < 0) { - dbg(udev, "prepend failed\n"); - return 1; - } - - i = 4; /* offset to the start of the identifier */ - s = j = strlen(serial); - if ((page_83[0] & 0x0f) == SCSI_ID_ASCII) { - /* - * ASCII descriptor. - */ - while (i < (4 + page_83[3])) - serial[j++] = page_83[i++]; - } else { - /* - * Binary descriptor, convert to ASCII, using two bytes of - * ASCII for each byte in the page_83. - */ - while (i < (4 + page_83[3])) { - serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; - serial[j++] = hex_str[page_83[i] & 0x0f]; - i++; - } - } - - strcpy(serial_short, &serial[s]); - - if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { - strncpy(wwn, &serial[s], 16); - if (wwn_vendor_extension != NULL) { - strncpy(wwn_vendor_extension, &serial[s + 16], 16); - } - } - - return 0; + int i, j, s, len; + + /* + * ASSOCIATION must be with the device (value 0) + * or with the target port for SCSI_ID_TGTPORT + */ + if ((page_83[1] & 0x30) == 0x10) { + if (id_search->id_type != SCSI_ID_TGTGROUP) + return 1; + } else if ((page_83[1] & 0x30) != 0) { + return 1; + } + + if ((page_83[1] & 0x0f) != id_search->id_type) + return 1; + + /* + * Possibly check NAA sub-type. + */ + if ((id_search->naa_type != SCSI_ID_NAA_DONT_CARE) && + (id_search->naa_type != (page_83[4] & 0xf0) >> 4)) + return 1; + + /* + * Check for matching code set - ASCII or BINARY. + */ + if ((page_83[0] & 0x0f) != id_search->code_set) + return 1; + + /* + * page_83[3]: identifier length + */ + len = page_83[3]; + if ((page_83[0] & 0x0f) != SCSI_ID_ASCII) + /* + * If not ASCII, use two bytes for each binary value. + */ + len *= 2; + + /* + * Add one byte for the NUL termination, and one for the id_type. + */ + len += 2; + if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) + len += VENDOR_LENGTH + MODEL_LENGTH; + + if (max_len < len) { + info(udev, "%s: length %d too short - need %d\n", + dev_scsi->kernel, max_len, len); + return 1; + } + + if (id_search->id_type == SCSI_ID_TGTGROUP && tgpt_group != NULL) { + unsigned int group; + + group = ((unsigned int)page_83[6] << 8) | page_83[7]; + sprintf(tgpt_group,"%x", group); + return 1; + } + + serial[0] = hex_str[id_search->id_type]; + + /* + * For SCSI_ID_VENDOR_SPECIFIC prepend the vendor and model before + * the id since it is not unique across all vendors and models, + * this differs from SCSI_ID_T10_VENDOR, where the vendor is + * included in the identifier. + */ + if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) + if (prepend_vendor_model(udev, dev_scsi, &serial[1]) < 0) { + dbg(udev, "prepend failed\n"); + return 1; + } + + i = 4; /* offset to the start of the identifier */ + s = j = strlen(serial); + if ((page_83[0] & 0x0f) == SCSI_ID_ASCII) { + /* + * ASCII descriptor. + */ + while (i < (4 + page_83[3])) + serial[j++] = page_83[i++]; + } else { + /* + * Binary descriptor, convert to ASCII, using two bytes of + * ASCII for each byte in the page_83. + */ + while (i < (4 + page_83[3])) { + serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; + serial[j++] = hex_str[page_83[i] & 0x0f]; + i++; + } + } + + strcpy(serial_short, &serial[s]); + + if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { + strncpy(wwn, &serial[s], 16); + if (wwn_vendor_extension != NULL) { + strncpy(wwn_vendor_extension, &serial[s + 16], 16); + } + } + + return 0; } /* Extract the raw binary from VPD 0x83 pre-SPC devices */ static int check_fill_0x83_prespc3(struct udev *udev, - struct scsi_id_device *dev_scsi, - unsigned char *page_83, - const struct scsi_id_search_values - *id_search, char *serial, char *serial_short, int max_len) + struct scsi_id_device *dev_scsi, + unsigned char *page_83, + const struct scsi_id_search_values + *id_search, char *serial, char *serial_short, int max_len) { - int i, j; - - dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); - serial[0] = hex_str[id_search->id_type]; - /* serial has been memset to zero before */ - j = strlen(serial); /* j = 1; */ - - for (i = 0; (i < page_83[3]) && (j < max_len-3); ++i) { - serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; - serial[j++] = hex_str[ page_83[4+i] & 0x0f]; - } - serial[max_len-1] = 0; - strncpy(serial_short, serial, max_len-1); - return 0; + int i, j; + + dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); + serial[0] = hex_str[id_search->id_type]; + /* serial has been memset to zero before */ + j = strlen(serial); /* j = 1; */ + + for (i = 0; (i < page_83[3]) && (j < max_len-3); ++i) { + serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; + serial[j++] = hex_str[ page_83[4+i] & 0x0f]; + } + serial[max_len-1] = 0; + strncpy(serial_short, serial, max_len-1); + return 0; } /* Get device identification VPD page */ static int do_scsi_page83_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int len, - char *unit_serial_number, char *wwn, - char *wwn_vendor_extension, char *tgpt_group) + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int len, + char *unit_serial_number, char *wwn, + char *wwn_vendor_extension, char *tgpt_group) { - int retval; - unsigned int id_ind, j; - unsigned char page_83[SCSI_INQ_BUFF_LEN]; + int retval; + unsigned int id_ind, j; + unsigned char page_83[SCSI_INQ_BUFF_LEN]; - /* also pick up the page 80 serial number */ + /* also pick up the page 80 serial number */ do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN); - memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, - SCSI_INQ_BUFF_LEN); - if (retval < 0) - return 1; - - if (page_83[1] != PAGE_83) { - info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); - return 1; - } - - /* - * XXX Some devices (IBM 3542) return all spaces for an identifier if - * the LUN is not actually configured. This leads to identifiers of - * the form: "1 ". - */ - - /* - * Model 4, 5, and (some) model 6 EMC Symmetrix devices return - * a page 83 reply according to SCSI-2 format instead of SPC-2/3. - * - * The SCSI-2 page 83 format returns an IEEE WWN in binary - * encoded hexi-decimal in the 16 bytes following the initial - * 4-byte page 83 reply header. - * - * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part - * of an Identification descriptor. The 3rd byte of the first - * Identification descriptor is a reserved (BSZ) byte field. - * - * Reference the 7th byte of the page 83 reply to determine - * whether the reply is compliant with SCSI-2 or SPC-2/3 - * specifications. A zero value in the 7th byte indicates - * an SPC-2/3 conformant reply, (i.e., the reserved field of the - * first Identification descriptor). This byte will be non-zero - * for a SCSI-2 conformant page 83 reply from these EMC - * Symmetrix models since the 7th byte of the reply corresponds - * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, - * 0x006048. - */ - - if (page_83[6] != 0) - return check_fill_0x83_prespc3(udev, - dev_scsi, page_83, id_search_list, - serial, serial_short, len); - - /* - * Search for a match in the prioritized id_search_list - since WWN ids + memset(page_83, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, + SCSI_INQ_BUFF_LEN); + if (retval < 0) + return 1; + + if (page_83[1] != PAGE_83) { + info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); + return 1; + } + + /* + * XXX Some devices (IBM 3542) return all spaces for an identifier if + * the LUN is not actually configured. This leads to identifiers of + * the form: "1 ". + */ + + /* + * Model 4, 5, and (some) model 6 EMC Symmetrix devices return + * a page 83 reply according to SCSI-2 format instead of SPC-2/3. + * + * The SCSI-2 page 83 format returns an IEEE WWN in binary + * encoded hexi-decimal in the 16 bytes following the initial + * 4-byte page 83 reply header. + * + * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part + * of an Identification descriptor. The 3rd byte of the first + * Identification descriptor is a reserved (BSZ) byte field. + * + * Reference the 7th byte of the page 83 reply to determine + * whether the reply is compliant with SCSI-2 or SPC-2/3 + * specifications. A zero value in the 7th byte indicates + * an SPC-2/3 conformant reply, (i.e., the reserved field of the + * first Identification descriptor). This byte will be non-zero + * for a SCSI-2 conformant page 83 reply from these EMC + * Symmetrix models since the 7th byte of the reply corresponds + * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, + * 0x006048. + */ + + if (page_83[6] != 0) + return check_fill_0x83_prespc3(udev, + dev_scsi, page_83, id_search_list, + serial, serial_short, len); + + /* + * Search for a match in the prioritized id_search_list - since WWN ids * come first we can pick up the WWN in check_fill_0x83_id(). - */ - for (id_ind = 0; - id_ind < sizeof(id_search_list)/sizeof(id_search_list[0]); - id_ind++) { - /* - * Examine each descriptor returned. There is normally only - * one or a small number of descriptors. - */ - for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { - retval = check_fill_0x83_id(udev, - dev_scsi, &page_83[j], - &id_search_list[id_ind], - serial, serial_short, len, - wwn, wwn_vendor_extension, - tgpt_group); - dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, - id_search_list[id_ind].id_type, - id_search_list[id_ind].naa_type, - id_search_list[id_ind].code_set); - if (!retval) { - dbg(udev, " used\n"); - return retval; - } else if (retval < 0) { - dbg(udev, " failed\n"); - return retval; - } else { - dbg(udev, " not used\n"); - } - } - } - return 1; + */ + for (id_ind = 0; + id_ind < sizeof(id_search_list)/sizeof(id_search_list[0]); + id_ind++) { + /* + * Examine each descriptor returned. There is normally only + * one or a small number of descriptors. + */ + for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { + retval = check_fill_0x83_id(udev, + dev_scsi, &page_83[j], + &id_search_list[id_ind], + serial, serial_short, len, + wwn, wwn_vendor_extension, + tgpt_group); + dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, + id_search_list[id_ind].id_type, + id_search_list[id_ind].naa_type, + id_search_list[id_ind].code_set); + if (!retval) { + dbg(udev, " used\n"); + return retval; + } else if (retval < 0) { + dbg(udev, " failed\n"); + return retval; + } else { + dbg(udev, " not used\n"); + } + } + } + return 1; } /* @@ -721,98 +721,98 @@ static int do_scsi_page83_inquiry(struct udev *udev, * conformant to the SCSI-2 format. */ static int do_scsi_page83_prespc3_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int len) + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int len) { - int retval; - int i, j; - unsigned char page_83[SCSI_INQ_BUFF_LEN]; - - memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); - if (retval < 0) - return 1; - - if (page_83[1] != PAGE_83) { - info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); - return 1; - } - /* - * Model 4, 5, and (some) model 6 EMC Symmetrix devices return - * a page 83 reply according to SCSI-2 format instead of SPC-2/3. - * - * The SCSI-2 page 83 format returns an IEEE WWN in binary - * encoded hexi-decimal in the 16 bytes following the initial - * 4-byte page 83 reply header. - * - * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part - * of an Identification descriptor. The 3rd byte of the first - * Identification descriptor is a reserved (BSZ) byte field. - * - * Reference the 7th byte of the page 83 reply to determine - * whether the reply is compliant with SCSI-2 or SPC-2/3 - * specifications. A zero value in the 7th byte indicates - * an SPC-2/3 conformant reply, (i.e., the reserved field of the - * first Identification descriptor). This byte will be non-zero - * for a SCSI-2 conformant page 83 reply from these EMC - * Symmetrix models since the 7th byte of the reply corresponds - * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, - * 0x006048. - */ - if (page_83[6] == 0) - return 2; - - serial[0] = hex_str[id_search_list[0].id_type]; - /* - * The first four bytes contain data, not a descriptor. - */ - i = 4; - j = strlen(serial); - /* - * Binary descriptor, convert to ASCII, - * using two bytes of ASCII for each byte - * in the page_83. - */ - while (i < (page_83[3]+4)) { - serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; - serial[j++] = hex_str[page_83[i] & 0x0f]; - i++; - } - dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); - return 0; + int retval; + int i, j; + unsigned char page_83[SCSI_INQ_BUFF_LEN]; + + memset(page_83, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); + if (retval < 0) + return 1; + + if (page_83[1] != PAGE_83) { + info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); + return 1; + } + /* + * Model 4, 5, and (some) model 6 EMC Symmetrix devices return + * a page 83 reply according to SCSI-2 format instead of SPC-2/3. + * + * The SCSI-2 page 83 format returns an IEEE WWN in binary + * encoded hexi-decimal in the 16 bytes following the initial + * 4-byte page 83 reply header. + * + * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part + * of an Identification descriptor. The 3rd byte of the first + * Identification descriptor is a reserved (BSZ) byte field. + * + * Reference the 7th byte of the page 83 reply to determine + * whether the reply is compliant with SCSI-2 or SPC-2/3 + * specifications. A zero value in the 7th byte indicates + * an SPC-2/3 conformant reply, (i.e., the reserved field of the + * first Identification descriptor). This byte will be non-zero + * for a SCSI-2 conformant page 83 reply from these EMC + * Symmetrix models since the 7th byte of the reply corresponds + * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, + * 0x006048. + */ + if (page_83[6] == 0) + return 2; + + serial[0] = hex_str[id_search_list[0].id_type]; + /* + * The first four bytes contain data, not a descriptor. + */ + i = 4; + j = strlen(serial); + /* + * Binary descriptor, convert to ASCII, + * using two bytes of ASCII for each byte + * in the page_83. + */ + while (i < (page_83[3]+4)) { + serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; + serial[j++] = hex_str[page_83[i] & 0x0f]; + i++; + } + dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); + return 0; } /* Get unit serial number VPD page */ static int do_scsi_page80_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int max_len) + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int max_len) { - int retval; - int ser_ind; - int i; - int len; - unsigned char buf[SCSI_INQ_BUFF_LEN]; - - memset(buf, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); - if (retval < 0) - return retval; - - if (buf[1] != PAGE_80) { - info(udev, "%s: Invalid page 0x80\n", dev_scsi->kernel); - return 1; - } - - len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; - if (max_len < len) { - info(udev, "%s: length %d too short - need %d\n", - dev_scsi->kernel, max_len, len); - return 1; - } - /* - * Prepend 'S' to avoid unlikely collision with page 0x83 vendor - * specific type where we prepend '0' + vendor + model. - */ + int retval; + int ser_ind; + int i; + int len; + unsigned char buf[SCSI_INQ_BUFF_LEN]; + + memset(buf, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); + if (retval < 0) + return retval; + + if (buf[1] != PAGE_80) { + info(udev, "%s: Invalid page 0x80\n", dev_scsi->kernel); + return 1; + } + + len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; + if (max_len < len) { + info(udev, "%s: length %d too short - need %d\n", + dev_scsi->kernel, max_len, len); + return 1; + } + /* + * Prepend 'S' to avoid unlikely collision with page 0x83 vendor + * specific type where we prepend '0' + vendor + model. + */ len = buf[3]; if (serial != NULL) { serial[0] = 'S'; @@ -826,165 +826,165 @@ static int do_scsi_page80_inquiry(struct udev *udev, memcpy(serial_short, &buf[4], len); serial_short[len] = '\0'; } - return 0; + return 0; } int scsi_std_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, const char *devname) + struct scsi_id_device *dev_scsi, const char *devname) { - int fd; - unsigned char buf[SCSI_INQ_BUFF_LEN]; - struct stat statbuf; - int err = 0; - - dbg(udev, "opening %s\n", devname); - fd = open(devname, O_RDONLY | O_NONBLOCK); - if (fd < 0) { - info(udev, "scsi_id: cannot open %s: %s\n", - devname, strerror(errno)); - return 1; - } - - if (fstat(fd, &statbuf) < 0) { - info(udev, "scsi_id: cannot stat %s: %s\n", - devname, strerror(errno)); - err = 2; - goto out; - } - sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev), - minor(statbuf.st_rdev)); - - memset(buf, 0, SCSI_INQ_BUFF_LEN); - err = scsi_inquiry(udev, dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); - if (err < 0) - goto out; - - err = 0; - memcpy(dev_scsi->vendor, buf + 8, 8); - dev_scsi->vendor[8] = '\0'; - memcpy(dev_scsi->model, buf + 16, 16); - dev_scsi->model[16] = '\0'; - memcpy(dev_scsi->revision, buf + 32, 4); - dev_scsi->revision[4] = '\0'; - sprintf(dev_scsi->type,"%x", buf[0] & 0x1f); + int fd; + unsigned char buf[SCSI_INQ_BUFF_LEN]; + struct stat statbuf; + int err = 0; + + dbg(udev, "opening %s\n", devname); + fd = open(devname, O_RDONLY | O_NONBLOCK); + if (fd < 0) { + info(udev, "scsi_id: cannot open %s: %s\n", + devname, strerror(errno)); + return 1; + } + + if (fstat(fd, &statbuf) < 0) { + info(udev, "scsi_id: cannot stat %s: %s\n", + devname, strerror(errno)); + err = 2; + goto out; + } + sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev), + minor(statbuf.st_rdev)); + + memset(buf, 0, SCSI_INQ_BUFF_LEN); + err = scsi_inquiry(udev, dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); + if (err < 0) + goto out; + + err = 0; + memcpy(dev_scsi->vendor, buf + 8, 8); + dev_scsi->vendor[8] = '\0'; + memcpy(dev_scsi->model, buf + 16, 16); + dev_scsi->model[16] = '\0'; + memcpy(dev_scsi->revision, buf + 32, 4); + dev_scsi->revision[4] = '\0'; + sprintf(dev_scsi->type,"%x", buf[0] & 0x1f); out: - close(fd); - return err; + close(fd); + return err; } int scsi_get_serial(struct udev *udev, - struct scsi_id_device *dev_scsi, const char *devname, - int page_code, int len) + struct scsi_id_device *dev_scsi, const char *devname, + int page_code, int len) { - unsigned char page0[SCSI_INQ_BUFF_LEN]; - int fd = -1; - int cnt; - int ind; - int retval; - - memset(dev_scsi->serial, 0, len); - dbg(udev, "opening %s\n", devname); - srand((unsigned int)getpid()); - for (cnt = 20; cnt > 0; cnt--) { - struct timespec duration; - - fd = open(devname, O_RDONLY | O_NONBLOCK); - if (fd >= 0 || errno != EBUSY) - break; - duration.tv_sec = 0; - duration.tv_nsec = (200 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); - nanosleep(&duration, NULL); - } - if (fd < 0) - return 1; - - if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { - retval = 1; - goto completed; - } else { - retval = 0; - goto completed; - } - } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { - retval = 1; - goto completed; - } else { - retval = 0; - goto completed; - } - } else if (page_code == PAGE_83_PRE_SPC3) { - retval = do_scsi_page83_prespc3_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len); - if (retval) { - /* - * Fallback to servicing a SPC-2/3 compliant page 83 - * inquiry if the page 83 reply format does not - * conform to pre-SPC3 expectations. - */ - if (retval == 2) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { - retval = 1; - goto completed; - } else { - retval = 0; - goto completed; - } - } - else { - retval = 1; - goto completed; - } - } else { - retval = 0; - goto completed; - } - } else if (page_code != 0x00) { - info(udev, "%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); - return 1; - } - - /* - * Get page 0, the page of the pages. By default, try from best to - * worst of supported pages: 0x83 then 0x80. - */ - if (do_scsi_page0_inquiry(udev, dev_scsi, fd, page0, SCSI_INQ_BUFF_LEN)) { - /* - * Don't try anything else. Black list if a specific page - * should be used for this vendor+model, or maybe have an - * optional fall-back to page 0x80 or page 0x83. - */ - retval = 1; - goto completed; - } - - dbg(udev, "%s: Checking page0\n", dev_scsi->kernel); - - for (ind = 4; ind <= page0[3] + 3; ind++) - if (page0[ind] == PAGE_83) - if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { - /* - * Success - */ - retval = 0; - goto completed; - } - - for (ind = 4; ind <= page0[3] + 3; ind++) - if (page0[ind] == PAGE_80) - if (!do_scsi_page80_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, dev_scsi->serial_short, len)) { - /* - * Success - */ - retval = 0; - goto completed; - } - retval = 1; + unsigned char page0[SCSI_INQ_BUFF_LEN]; + int fd = -1; + int cnt; + int ind; + int retval; + + memset(dev_scsi->serial, 0, len); + dbg(udev, "opening %s\n", devname); + srand((unsigned int)getpid()); + for (cnt = 20; cnt > 0; cnt--) { + struct timespec duration; + + fd = open(devname, O_RDONLY | O_NONBLOCK); + if (fd >= 0 || errno != EBUSY) + break; + duration.tv_sec = 0; + duration.tv_nsec = (200 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); + nanosleep(&duration, NULL); + } + if (fd < 0) + return 1; + + if (page_code == PAGE_80) { + if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } else if (page_code == PAGE_83) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } else if (page_code == PAGE_83_PRE_SPC3) { + retval = do_scsi_page83_prespc3_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len); + if (retval) { + /* + * Fallback to servicing a SPC-2/3 compliant page 83 + * inquiry if the page 83 reply format does not + * conform to pre-SPC3 expectations. + */ + if (retval == 2) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } + else { + retval = 1; + goto completed; + } + } else { + retval = 0; + goto completed; + } + } else if (page_code != 0x00) { + info(udev, "%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); + return 1; + } + + /* + * Get page 0, the page of the pages. By default, try from best to + * worst of supported pages: 0x83 then 0x80. + */ + if (do_scsi_page0_inquiry(udev, dev_scsi, fd, page0, SCSI_INQ_BUFF_LEN)) { + /* + * Don't try anything else. Black list if a specific page + * should be used for this vendor+model, or maybe have an + * optional fall-back to page 0x80 or page 0x83. + */ + retval = 1; + goto completed; + } + + dbg(udev, "%s: Checking page0\n", dev_scsi->kernel); + + for (ind = 4; ind <= page0[3] + 3; ind++) + if (page0[ind] == PAGE_83) + if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, + dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { + /* + * Success + */ + retval = 0; + goto completed; + } + + for (ind = 4; ind <= page0[3] + 3; ind++) + if (page0[ind] == PAGE_80) + if (!do_scsi_page80_inquiry(udev, dev_scsi, fd, + dev_scsi->serial, dev_scsi->serial_short, len)) { + /* + * Success + */ + retval = 0; + goto completed; + } + retval = 1; completed: - close(fd); - return retval; + close(fd); + return retval; } diff --git a/src/extras/udev-acl/udev-acl.c b/src/extras/udev-acl/udev-acl.c index 41e2536e03..628cfbed4e 100644 --- a/src/extras/udev-acl/udev-acl.c +++ b/src/extras/udev-acl/udev-acl.c @@ -28,403 +28,403 @@ static int debug; enum{ - ACTION_NONE = 0, - ACTION_REMOVE, - ACTION_ADD, - ACTION_CHANGE + ACTION_NONE = 0, + ACTION_REMOVE, + ACTION_ADD, + ACTION_CHANGE }; static int set_facl(const char* filename, uid_t uid, int add) { - int get; - acl_t acl; - acl_entry_t entry = NULL; - acl_entry_t e; - acl_permset_t permset; - int ret; - - /* don't touch ACLs for root */ - if (uid == 0) - return 0; - - /* read current record */ - acl = acl_get_file(filename, ACL_TYPE_ACCESS); - if (!acl) - return -1; - - /* locate ACL_USER entry for uid */ - get = acl_get_entry(acl, ACL_FIRST_ENTRY, &e); - while (get == 1) { - acl_tag_t t; - - acl_get_tag_type(e, &t); - if (t == ACL_USER) { - uid_t *u; - - u = (uid_t*)acl_get_qualifier(e); - if (u == NULL) { - ret = -1; - goto out; - } - if (*u == uid) { - entry = e; - acl_free(u); - break; - } - acl_free(u); - } - - get = acl_get_entry(acl, ACL_NEXT_ENTRY, &e); - } - - /* remove ACL_USER entry for uid */ - if (!add) { - if (entry == NULL) { - ret = 0; - goto out; - } - acl_delete_entry(acl, entry); - goto update; - } - - /* create ACL_USER entry for uid */ - if (entry == NULL) { - ret = acl_create_entry(&acl, &entry); - if (ret != 0) - goto out; - acl_set_tag_type(entry, ACL_USER); - acl_set_qualifier(entry, &uid); - } - - /* add permissions for uid */ - acl_get_permset(entry, &permset); - acl_add_perm(permset, ACL_READ|ACL_WRITE); + int get; + acl_t acl; + acl_entry_t entry = NULL; + acl_entry_t e; + acl_permset_t permset; + int ret; + + /* don't touch ACLs for root */ + if (uid == 0) + return 0; + + /* read current record */ + acl = acl_get_file(filename, ACL_TYPE_ACCESS); + if (!acl) + return -1; + + /* locate ACL_USER entry for uid */ + get = acl_get_entry(acl, ACL_FIRST_ENTRY, &e); + while (get == 1) { + acl_tag_t t; + + acl_get_tag_type(e, &t); + if (t == ACL_USER) { + uid_t *u; + + u = (uid_t*)acl_get_qualifier(e); + if (u == NULL) { + ret = -1; + goto out; + } + if (*u == uid) { + entry = e; + acl_free(u); + break; + } + acl_free(u); + } + + get = acl_get_entry(acl, ACL_NEXT_ENTRY, &e); + } + + /* remove ACL_USER entry for uid */ + if (!add) { + if (entry == NULL) { + ret = 0; + goto out; + } + acl_delete_entry(acl, entry); + goto update; + } + + /* create ACL_USER entry for uid */ + if (entry == NULL) { + ret = acl_create_entry(&acl, &entry); + if (ret != 0) + goto out; + acl_set_tag_type(entry, ACL_USER); + acl_set_qualifier(entry, &uid); + } + + /* add permissions for uid */ + acl_get_permset(entry, &permset); + acl_add_perm(permset, ACL_READ|ACL_WRITE); update: - /* update record */ - if (debug) - printf("%c%u %s\n", add ? '+' : '-', uid, filename); - acl_calc_mask(&acl); - ret = acl_set_file(filename, ACL_TYPE_ACCESS, acl); - if (ret != 0) - goto out; + /* update record */ + if (debug) + printf("%c%u %s\n", add ? '+' : '-', uid, filename); + acl_calc_mask(&acl); + ret = acl_set_file(filename, ACL_TYPE_ACCESS, acl); + if (ret != 0) + goto out; out: - acl_free(acl); - return ret; + acl_free(acl); + return ret; } /* check if a given uid is listed */ static int uid_in_list(GSList *list, uid_t uid) { - GSList *l; + GSList *l; - for (l = list; l != NULL; l = g_slist_next(l)) - if (uid == GPOINTER_TO_UINT(l->data)) - return 1; - return 0; + for (l = list; l != NULL; l = g_slist_next(l)) + if (uid == GPOINTER_TO_UINT(l->data)) + return 1; + return 0; } /* return list of current uids of local active sessions */ static GSList *uids_with_local_active_session(const char *own_id) { - GSList *list = NULL; - GKeyFile *keyfile; - - keyfile = g_key_file_new(); - if (g_key_file_load_from_file(keyfile, "/var/run/ConsoleKit/database", 0, NULL)) { - gchar **groups; - - groups = g_key_file_get_groups(keyfile, NULL); - if (groups != NULL) { - int i; - - for (i = 0; groups[i] != NULL; i++) { - uid_t u; - - if (!g_str_has_prefix(groups[i], "Session ")) - continue; - if (own_id != NULL &&g_str_has_suffix(groups[i], own_id)) - continue; - if (!g_key_file_get_boolean(keyfile, groups[i], "is_local", NULL)) - continue; - if (!g_key_file_get_boolean(keyfile, groups[i], "is_active", NULL)) - continue; - u = g_key_file_get_integer(keyfile, groups[i], "uid", NULL); - if (u > 0 && !uid_in_list(list, u)) - list = g_slist_prepend(list, GUINT_TO_POINTER(u)); - } - g_strfreev(groups); - } - } - g_key_file_free(keyfile); - - return list; + GSList *list = NULL; + GKeyFile *keyfile; + + keyfile = g_key_file_new(); + if (g_key_file_load_from_file(keyfile, "/var/run/ConsoleKit/database", 0, NULL)) { + gchar **groups; + + groups = g_key_file_get_groups(keyfile, NULL); + if (groups != NULL) { + int i; + + for (i = 0; groups[i] != NULL; i++) { + uid_t u; + + if (!g_str_has_prefix(groups[i], "Session ")) + continue; + if (own_id != NULL &&g_str_has_suffix(groups[i], own_id)) + continue; + if (!g_key_file_get_boolean(keyfile, groups[i], "is_local", NULL)) + continue; + if (!g_key_file_get_boolean(keyfile, groups[i], "is_active", NULL)) + continue; + u = g_key_file_get_integer(keyfile, groups[i], "uid", NULL); + if (u > 0 && !uid_in_list(list, u)) + list = g_slist_prepend(list, GUINT_TO_POINTER(u)); + } + g_strfreev(groups); + } + } + g_key_file_free(keyfile); + + return list; } /* ConsoleKit calls us with special variables */ static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, const char **remove_session_id, int *action) { - int a = ACTION_NONE; - uid_t u = 0; - uid_t u2 = 0; - const char *s; - const char *s2; - const char *old_session = NULL; - - if (ck_action == NULL || strcmp(ck_action, "seat_active_session_changed") != 0) - return -1; - - /* We can have one of: remove, add, change, no-change */ - s = getenv("CK_SEAT_OLD_SESSION_ID"); - s2 = getenv("CK_SEAT_SESSION_ID"); - if (s == NULL && s2 == NULL) { - return -1; - } else if (s2 == NULL) { - a = ACTION_REMOVE; - } else if (s == NULL) { - a = ACTION_ADD; - } else { - a = ACTION_CHANGE; - } - - switch (a) { - case ACTION_ADD: - s = getenv("CK_SEAT_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - - s = getenv("CK_SEAT_SESSION_IS_LOCAL"); - if (s == NULL) - return -1; - if (strcmp(s, "true") != 0) - return 0; - - break; - case ACTION_REMOVE: - s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - - s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); - if (s == NULL) - return -1; - if (strcmp(s, "true") != 0) - return 0; - - old_session = getenv("CK_SEAT_OLD_SESSION_ID"); - if (old_session == NULL) - return -1; - - break; - case ACTION_CHANGE: - s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - s = getenv("CK_SEAT_SESSION_USER_UID"); - if (s == NULL) - return -1; - u2 = strtoul(s, NULL, 10); - - s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); - s2 = getenv("CK_SEAT_SESSION_IS_LOCAL"); - if (s == NULL || s2 == NULL) - return -1; - /* don't process non-local session changes */ - if (strcmp(s, "true") != 0 && strcmp(s2, "true") != 0) - return 0; - - if (strcmp(s, "true") == 0 && strcmp(s, "true") == 0) { - /* process the change */ - if (u == u2) { - /* special case: we noop if we are - * changing between local sessions for - * the same uid */ - a = ACTION_NONE; - } - old_session = getenv("CK_SEAT_OLD_SESSION_ID"); - if (old_session == NULL) - return -1; - } else if (strcmp(s, "true") == 0) { - /* only process the removal */ - a = ACTION_REMOVE; - old_session = getenv("CK_SEAT_OLD_SESSION_ID"); - if (old_session == NULL) - return -1; - } else if (strcmp(s2, "true") == 0) { - /* only process the addition */ - a = ACTION_ADD; - u = u2; - } - break; - } - - *remove_session_id = old_session; - *uid = u; - *uid2 = u2; - *action = a; - return 0; + int a = ACTION_NONE; + uid_t u = 0; + uid_t u2 = 0; + const char *s; + const char *s2; + const char *old_session = NULL; + + if (ck_action == NULL || strcmp(ck_action, "seat_active_session_changed") != 0) + return -1; + + /* We can have one of: remove, add, change, no-change */ + s = getenv("CK_SEAT_OLD_SESSION_ID"); + s2 = getenv("CK_SEAT_SESSION_ID"); + if (s == NULL && s2 == NULL) { + return -1; + } else if (s2 == NULL) { + a = ACTION_REMOVE; + } else if (s == NULL) { + a = ACTION_ADD; + } else { + a = ACTION_CHANGE; + } + + switch (a) { + case ACTION_ADD: + s = getenv("CK_SEAT_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + + s = getenv("CK_SEAT_SESSION_IS_LOCAL"); + if (s == NULL) + return -1; + if (strcmp(s, "true") != 0) + return 0; + + break; + case ACTION_REMOVE: + s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + + s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); + if (s == NULL) + return -1; + if (strcmp(s, "true") != 0) + return 0; + + old_session = getenv("CK_SEAT_OLD_SESSION_ID"); + if (old_session == NULL) + return -1; + + break; + case ACTION_CHANGE: + s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); + if (s == NULL) + return -1; + u = strtoul(s, NULL, 10); + s = getenv("CK_SEAT_SESSION_USER_UID"); + if (s == NULL) + return -1; + u2 = strtoul(s, NULL, 10); + + s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); + s2 = getenv("CK_SEAT_SESSION_IS_LOCAL"); + if (s == NULL || s2 == NULL) + return -1; + /* don't process non-local session changes */ + if (strcmp(s, "true") != 0 && strcmp(s2, "true") != 0) + return 0; + + if (strcmp(s, "true") == 0 && strcmp(s, "true") == 0) { + /* process the change */ + if (u == u2) { + /* special case: we noop if we are + * changing between local sessions for + * the same uid */ + a = ACTION_NONE; + } + old_session = getenv("CK_SEAT_OLD_SESSION_ID"); + if (old_session == NULL) + return -1; + } else if (strcmp(s, "true") == 0) { + /* only process the removal */ + a = ACTION_REMOVE; + old_session = getenv("CK_SEAT_OLD_SESSION_ID"); + if (old_session == NULL) + return -1; + } else if (strcmp(s2, "true") == 0) { + /* only process the addition */ + a = ACTION_ADD; + u = u2; + } + break; + } + + *remove_session_id = old_session; + *uid = u; + *uid2 = u2; + *action = a; + return 0; } /* add or remove a ACL for a given uid from all matching devices */ static void apply_acl_to_devices(uid_t uid, int add) { - struct udev *udev; - struct udev_enumerate *enumerate; - struct udev_list_entry *list_entry; - - /* iterate over all devices tagged with ACL_SET */ - udev = udev_new(); - enumerate = udev_enumerate_new(udev); - udev_enumerate_add_match_tag(enumerate, "udev-acl"); - udev_enumerate_scan_devices(enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; - const char *node; - - device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), - udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - node = udev_device_get_devnode(device); - if (node == NULL) { - udev_device_unref(device); - continue; - } - set_facl(node, uid, add); - udev_device_unref(device); - } - udev_enumerate_unref(enumerate); - udev_unref(udev); + struct udev *udev; + struct udev_enumerate *enumerate; + struct udev_list_entry *list_entry; + + /* iterate over all devices tagged with ACL_SET */ + udev = udev_new(); + enumerate = udev_enumerate_new(udev); + udev_enumerate_add_match_tag(enumerate, "udev-acl"); + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + const char *node; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + node = udev_device_get_devnode(device); + if (node == NULL) { + udev_device_unref(device); + continue; + } + set_facl(node, uid, add); + udev_device_unref(device); + } + udev_enumerate_unref(enumerate); + udev_unref(udev); } static void remove_uid (uid_t uid, const char *remove_session_id) { - /* - * Remove ACL for given uid from all matching devices - * when there is currently no local active session. - */ - GSList *list; - - list = uids_with_local_active_session(remove_session_id); - if (!uid_in_list(list, uid)) - apply_acl_to_devices(uid, 0); - g_slist_free(list); + /* + * Remove ACL for given uid from all matching devices + * when there is currently no local active session. + */ + GSList *list; + + list = uids_with_local_active_session(remove_session_id); + if (!uid_in_list(list, uid)) + apply_acl_to_devices(uid, 0); + g_slist_free(list); } int main (int argc, char* argv[]) { - static const struct option options[] = { - { "action", required_argument, NULL, 'a' }, - { "device", required_argument, NULL, 'D' }, - { "user", required_argument, NULL, 'u' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - int action = -1; - const char *device = NULL; - bool uid_given = false; - uid_t uid = 0; - uid_t uid2 = 0; - const char* remove_session_id = NULL; - int rc = 0; - - /* valgrind is more important to us than a slice allocator */ - g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, 1); - - while (1) { - int option; - - option = getopt_long(argc, argv, "+a:D:u:dh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'a': - if (strcmp(optarg, "remove") == 0) - action = ACTION_REMOVE; - else - action = ACTION_ADD; - break; - case 'D': - device = optarg; - break; - case 'u': - uid_given = true; - uid = strtoul(optarg, NULL, 10); - break; - case 'd': - debug = 1; - break; - case 'h': - printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n"); - goto out; - } - } - - if (action < 0 && device == NULL && !uid_given) - if (!consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action)) - uid_given = true; - - if (action < 0) { - fprintf(stderr, "missing action\n\n"); - rc = 2; - goto out; - } - - if (device != NULL && uid_given) { - fprintf(stderr, "only one option, --device=DEVICEFILE or --user=UID expected\n\n"); - rc = 3; - goto out; - } - - if (uid_given) { - switch (action) { - case ACTION_ADD: - /* Add ACL for given uid to all matching devices. */ - apply_acl_to_devices(uid, 1); - break; - case ACTION_REMOVE: - remove_uid(uid, remove_session_id); - break; - case ACTION_CHANGE: - remove_uid(uid, remove_session_id); - apply_acl_to_devices(uid2, 1); - break; - case ACTION_NONE: - goto out; - break; - default: - g_assert_not_reached(); - break; - } - } else if (device != NULL) { - /* - * Add ACLs for all current session uids to a given device. - * - * Or remove ACLs for uids which do not have any current local - * active session. Remove is not really interesting, because in - * most cases the device node is removed anyway. - */ - GSList *list; - GSList *l; - - list = uids_with_local_active_session(NULL); - for (l = list; l != NULL; l = g_slist_next(l)) { - uid_t u; - - u = GPOINTER_TO_UINT(l->data); - if (action == ACTION_ADD || !uid_in_list(list, u)) - set_facl(device, u, action == ACTION_ADD); - } - g_slist_free(list); - } else { - fprintf(stderr, "--device=DEVICEFILE or --user=UID expected\n\n"); - rc = 3; - } + static const struct option options[] = { + { "action", required_argument, NULL, 'a' }, + { "device", required_argument, NULL, 'D' }, + { "user", required_argument, NULL, 'u' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + int action = -1; + const char *device = NULL; + bool uid_given = false; + uid_t uid = 0; + uid_t uid2 = 0; + const char* remove_session_id = NULL; + int rc = 0; + + /* valgrind is more important to us than a slice allocator */ + g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, 1); + + while (1) { + int option; + + option = getopt_long(argc, argv, "+a:D:u:dh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'a': + if (strcmp(optarg, "remove") == 0) + action = ACTION_REMOVE; + else + action = ACTION_ADD; + break; + case 'D': + device = optarg; + break; + case 'u': + uid_given = true; + uid = strtoul(optarg, NULL, 10); + break; + case 'd': + debug = 1; + break; + case 'h': + printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n"); + goto out; + } + } + + if (action < 0 && device == NULL && !uid_given) + if (!consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action)) + uid_given = true; + + if (action < 0) { + fprintf(stderr, "missing action\n\n"); + rc = 2; + goto out; + } + + if (device != NULL && uid_given) { + fprintf(stderr, "only one option, --device=DEVICEFILE or --user=UID expected\n\n"); + rc = 3; + goto out; + } + + if (uid_given) { + switch (action) { + case ACTION_ADD: + /* Add ACL for given uid to all matching devices. */ + apply_acl_to_devices(uid, 1); + break; + case ACTION_REMOVE: + remove_uid(uid, remove_session_id); + break; + case ACTION_CHANGE: + remove_uid(uid, remove_session_id); + apply_acl_to_devices(uid2, 1); + break; + case ACTION_NONE: + goto out; + break; + default: + g_assert_not_reached(); + break; + } + } else if (device != NULL) { + /* + * Add ACLs for all current session uids to a given device. + * + * Or remove ACLs for uids which do not have any current local + * active session. Remove is not really interesting, because in + * most cases the device node is removed anyway. + */ + GSList *list; + GSList *l; + + list = uids_with_local_active_session(NULL); + for (l = list; l != NULL; l = g_slist_next(l)) { + uid_t u; + + u = GPOINTER_TO_UINT(l->data); + if (action == ACTION_ADD || !uid_in_list(list, u)) + set_facl(device, u, action == ACTION_ADD); + } + g_slist_free(list); + } else { + fprintf(stderr, "--device=DEVICEFILE or --user=UID expected\n\n"); + rc = 3; + } out: - return rc; + return rc; } diff --git a/src/extras/v4l_id/v4l_id.c b/src/extras/v4l_id/v4l_id.c index 21cb3285ad..a2a80b5f43 100644 --- a/src/extras/v4l_id/v4l_id.c +++ b/src/extras/v4l_id/v4l_id.c @@ -32,56 +32,56 @@ int main (int argc, char *argv[]) { - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - {} - }; - int fd; - char *device; - struct v4l2_capability v2cap; + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + {} + }; + int fd; + char *device; + struct v4l2_capability v2cap; - while (1) { - int option; + while (1) { + int option; - option = getopt_long(argc, argv, "h", options, NULL); - if (option == -1) - break; + option = getopt_long(argc, argv, "h", options, NULL); + if (option == -1) + break; - switch (option) { - case 'h': - printf("Usage: v4l_id [--help] \n\n"); - return 0; - default: - return 1; - } - } - device = argv[optind]; + switch (option) { + case 'h': + printf("Usage: v4l_id [--help] \n\n"); + return 0; + default: + return 1; + } + } + device = argv[optind]; - if (device == NULL) - return 2; - fd = open (device, O_RDONLY); - if (fd < 0) - return 3; + if (device == NULL) + return 2; + fd = open (device, O_RDONLY); + if (fd < 0) + return 3; - if (ioctl (fd, VIDIOC_QUERYCAP, &v2cap) == 0) { - printf("ID_V4L_VERSION=2\n"); - printf("ID_V4L_PRODUCT=%s\n", v2cap.card); - printf("ID_V4L_CAPABILITIES=:"); - if ((v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0) - printf("capture:"); - if ((v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) > 0) - printf("video_output:"); - if ((v2cap.capabilities & V4L2_CAP_VIDEO_OVERLAY) > 0) - printf("video_overlay:"); - if ((v2cap.capabilities & V4L2_CAP_AUDIO) > 0) - printf("audio:"); - if ((v2cap.capabilities & V4L2_CAP_TUNER) > 0) - printf("tuner:"); - if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0) - printf("radio:"); - printf("\n"); - } + if (ioctl (fd, VIDIOC_QUERYCAP, &v2cap) == 0) { + printf("ID_V4L_VERSION=2\n"); + printf("ID_V4L_PRODUCT=%s\n", v2cap.card); + printf("ID_V4L_CAPABILITIES=:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0) + printf("capture:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) > 0) + printf("video_output:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_OVERLAY) > 0) + printf("video_overlay:"); + if ((v2cap.capabilities & V4L2_CAP_AUDIO) > 0) + printf("audio:"); + if ((v2cap.capabilities & V4L2_CAP_TUNER) > 0) + printf("tuner:"); + if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0) + printf("radio:"); + printf("\n"); + } - close (fd); - return 0; + close (fd); + return 0; } diff --git a/src/libudev-device-private.c b/src/libudev-device-private.c index 487d39bb5b..13fdb8eb57 100644 --- a/src/libudev-device-private.c +++ b/src/libudev-device-private.c @@ -24,162 +24,162 @@ static void udev_device_tag(struct udev_device *dev, const char *tag, bool add) { - const char *id; - struct udev *udev = udev_device_get_udev(dev); - char filename[UTIL_PATH_SIZE]; - - id = udev_device_get_id_filename(dev); - if (id == NULL) - return; - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags/", tag, "/", id, NULL); - - if (add) { - int fd; - - util_create_path(udev, filename); - fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); - if (fd >= 0) - close(fd); - } else { - unlink(filename); - } + const char *id; + struct udev *udev = udev_device_get_udev(dev); + char filename[UTIL_PATH_SIZE]; + + id = udev_device_get_id_filename(dev); + if (id == NULL) + return; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags/", tag, "/", id, NULL); + + if (add) { + int fd; + + util_create_path(udev, filename); + fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); + if (fd >= 0) + close(fd); + } else { + unlink(filename); + } } int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, bool add) { - struct udev_list_entry *list_entry; - bool found; - - if (add && dev_old != NULL) { - /* delete possible left-over tags */ - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev_old)) { - const char *tag_old = udev_list_entry_get_name(list_entry); - struct udev_list_entry *list_entry_current; - - found = false; - udev_list_entry_foreach(list_entry_current, udev_device_get_tags_list_entry(dev)) { - const char *tag = udev_list_entry_get_name(list_entry_current); - - if (strcmp(tag, tag_old) == 0) { - found = true; - break; - } - } - if (!found) - udev_device_tag(dev_old, tag_old, false); - } - } - - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev)) - udev_device_tag(dev, udev_list_entry_get_name(list_entry), add); - - return 0; + struct udev_list_entry *list_entry; + bool found; + + if (add && dev_old != NULL) { + /* delete possible left-over tags */ + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev_old)) { + const char *tag_old = udev_list_entry_get_name(list_entry); + struct udev_list_entry *list_entry_current; + + found = false; + udev_list_entry_foreach(list_entry_current, udev_device_get_tags_list_entry(dev)) { + const char *tag = udev_list_entry_get_name(list_entry_current); + + if (strcmp(tag, tag_old) == 0) { + found = true; + break; + } + } + if (!found) + udev_device_tag(dev_old, tag_old, false); + } + } + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(dev)) + udev_device_tag(dev, udev_list_entry_get_name(list_entry), add); + + return 0; } static bool device_has_info(struct udev_device *udev_device) { - struct udev_list_entry *list_entry; - - if (udev_device_get_devlinks_list_entry(udev_device) != NULL) - return true; - if (udev_device_get_devlink_priority(udev_device) != 0) - return true; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) - if (udev_list_entry_get_num(list_entry)) - return true; - if (udev_device_get_tags_list_entry(udev_device) != NULL) - return true; - if (udev_device_get_watch_handle(udev_device) >= 0) - return true; - return false; + struct udev_list_entry *list_entry; + + if (udev_device_get_devlinks_list_entry(udev_device) != NULL) + return true; + if (udev_device_get_devlink_priority(udev_device) != 0) + return true; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) + if (udev_list_entry_get_num(list_entry)) + return true; + if (udev_device_get_tags_list_entry(udev_device) != NULL) + return true; + if (udev_device_get_watch_handle(udev_device) >= 0) + return true; + return false; } int udev_device_update_db(struct udev_device *udev_device) { - bool has_info; - const char *id; - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - char filename_tmp[UTIL_PATH_SIZE]; - FILE *f; - - id = udev_device_get_id_filename(udev_device); - if (id == NULL) - return -1; - - has_info = device_has_info(udev_device); - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); - - /* do not store anything for otherwise empty devices */ - if (!has_info && - major(udev_device_get_devnum(udev_device)) == 0 && - udev_device_get_ifindex(udev_device) == 0) { - unlink(filename); - return 0; - } - - /* write a database file */ - util_strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL); - util_create_path(udev, filename_tmp); - f = fopen(filename_tmp, "we"); - if (f == NULL) { - err(udev, "unable to create temporary db file '%s': %m\n", filename_tmp); - return -1; - } - - /* - * set 'sticky' bit to indicate that we should not clean the - * database when we transition from initramfs to the real root - */ - if (udev_device_get_db_persist(udev_device)) - fchmod(fileno(f), 01644); - - if (has_info) { - struct udev_list_entry *list_entry; - - if (major(udev_device_get_devnum(udev_device)) > 0) { - size_t devlen = strlen(udev_get_dev_path(udev))+1; - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) - fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); - if (udev_device_get_devlink_priority(udev_device) != 0) - fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); - if (udev_device_get_watch_handle(udev_device) >= 0) - fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); - } - - if (udev_device_get_usec_initialized(udev_device) > 0) - fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device)); - - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - if (!udev_list_entry_get_num(list_entry)) - continue; - fprintf(f, "E:%s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - } - - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) - fprintf(f, "G:%s\n", udev_list_entry_get_name(list_entry)); - } - - fclose(f); - rename(filename_tmp, filename); - info(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty", - filename, udev_device_get_devpath(udev_device)); - return 0; + bool has_info; + const char *id; + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + char filename_tmp[UTIL_PATH_SIZE]; + FILE *f; + + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + + has_info = device_has_info(udev_device); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); + + /* do not store anything for otherwise empty devices */ + if (!has_info && + major(udev_device_get_devnum(udev_device)) == 0 && + udev_device_get_ifindex(udev_device) == 0) { + unlink(filename); + return 0; + } + + /* write a database file */ + util_strscpyl(filename_tmp, sizeof(filename_tmp), filename, ".tmp", NULL); + util_create_path(udev, filename_tmp); + f = fopen(filename_tmp, "we"); + if (f == NULL) { + err(udev, "unable to create temporary db file '%s': %m\n", filename_tmp); + return -1; + } + + /* + * set 'sticky' bit to indicate that we should not clean the + * database when we transition from initramfs to the real root + */ + if (udev_device_get_db_persist(udev_device)) + fchmod(fileno(f), 01644); + + if (has_info) { + struct udev_list_entry *list_entry; + + if (major(udev_device_get_devnum(udev_device)) > 0) { + size_t devlen = strlen(udev_get_dev_path(udev))+1; + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(udev_device)) + fprintf(f, "S:%s\n", &udev_list_entry_get_name(list_entry)[devlen]); + if (udev_device_get_devlink_priority(udev_device) != 0) + fprintf(f, "L:%i\n", udev_device_get_devlink_priority(udev_device)); + if (udev_device_get_watch_handle(udev_device) >= 0) + fprintf(f, "W:%i\n", udev_device_get_watch_handle(udev_device)); + } + + if (udev_device_get_usec_initialized(udev_device) > 0) + fprintf(f, "I:%llu\n", udev_device_get_usec_initialized(udev_device)); + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + if (!udev_list_entry_get_num(list_entry)) + continue; + fprintf(f, "E:%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + fprintf(f, "G:%s\n", udev_list_entry_get_name(list_entry)); + } + + fclose(f); + rename(filename_tmp, filename); + info(udev, "created %s file '%s' for '%s'\n", has_info ? "db" : "empty", + filename, udev_device_get_devpath(udev_device)); + return 0; } int udev_device_delete_db(struct udev_device *udev_device) { - const char *id; - struct udev *udev = udev_device_get_udev(udev_device); - char filename[UTIL_PATH_SIZE]; - - id = udev_device_get_id_filename(udev_device); - if (id == NULL) - return -1; - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); - unlink(filename); - return 0; + const char *id; + struct udev *udev = udev_device_get_udev(udev_device); + char filename[UTIL_PATH_SIZE]; + + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data/", id, NULL); + unlink(filename); + return 0; } diff --git a/src/libudev-device.c b/src/libudev-device.c index e5950bb4b1..a3356cfd18 100644 --- a/src/libudev-device.c +++ b/src/libudev-device.c @@ -44,49 +44,49 @@ * Opaque object representing one kernel sys device. */ struct udev_device { - struct udev *udev; - struct udev_device *parent_device; - char *syspath; - const char *devpath; - char *sysname; - const char *sysnum; - char *devnode; - mode_t devnode_mode; - char *subsystem; - char *devtype; - char *driver; - char *action; - char *devpath_old; - char *id_filename; - char **envp; - char *monitor_buf; - size_t monitor_buf_len; - struct udev_list devlinks_list; - struct udev_list properties_list; - struct udev_list sysattr_value_list; - struct udev_list sysattr_list; - struct udev_list tags_list; - unsigned long long int seqnum; - unsigned long long int usec_initialized; - int devlink_priority; - int refcount; - dev_t devnum; - int ifindex; - int watch_handle; - int maj, min; - bool parent_set; - bool subsystem_set; - bool devtype_set; - bool devlinks_uptodate; - bool envp_uptodate; - bool tags_uptodate; - bool driver_set; - bool info_loaded; - bool db_loaded; - bool uevent_loaded; - bool is_initialized; - bool sysattr_list_read; - bool db_persist; + struct udev *udev; + struct udev_device *parent_device; + char *syspath; + const char *devpath; + char *sysname; + const char *sysnum; + char *devnode; + mode_t devnode_mode; + char *subsystem; + char *devtype; + char *driver; + char *action; + char *devpath_old; + char *id_filename; + char **envp; + char *monitor_buf; + size_t monitor_buf_len; + struct udev_list devlinks_list; + struct udev_list properties_list; + struct udev_list sysattr_value_list; + struct udev_list sysattr_list; + struct udev_list tags_list; + unsigned long long int seqnum; + unsigned long long int usec_initialized; + int devlink_priority; + int refcount; + dev_t devnum; + int ifindex; + int watch_handle; + int maj, min; + bool parent_set; + bool subsystem_set; + bool devtype_set; + bool devlinks_uptodate; + bool envp_uptodate; + bool tags_uptodate; + bool driver_set; + bool info_loaded; + bool db_loaded; + bool uevent_loaded; + bool is_initialized; + bool sysattr_list_read; + bool db_persist; }; /** @@ -100,36 +100,36 @@ struct udev_device { **/ UDEV_EXPORT unsigned long long int udev_device_get_seqnum(struct udev_device *udev_device) { - if (udev_device == NULL) - return 0; - return udev_device->seqnum; + if (udev_device == NULL) + return 0; + return udev_device->seqnum; } static int udev_device_set_seqnum(struct udev_device *udev_device, unsigned long long int seqnum) { - char num[32]; + char num[32]; - udev_device->seqnum = seqnum; - snprintf(num, sizeof(num), "%llu", seqnum); - udev_device_add_property(udev_device, "SEQNUM", num); - return 0; + udev_device->seqnum = seqnum; + snprintf(num, sizeof(num), "%llu", seqnum); + udev_device_add_property(udev_device, "SEQNUM", num); + return 0; } int udev_device_get_ifindex(struct udev_device *udev_device) { - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->ifindex; + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->ifindex; } static int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) { - char num[32]; + char num[32]; - udev_device->ifindex = ifindex; - snprintf(num, sizeof(num), "%u", ifindex); - udev_device_add_property(udev_device, "IFINDEX", num); - return 0; + udev_device->ifindex = ifindex; + snprintf(num, sizeof(num), "%u", ifindex); + udev_device_add_property(udev_device, "IFINDEX", num); + return 0; } /** @@ -140,45 +140,45 @@ static int udev_device_set_ifindex(struct udev_device *udev_device, int ifindex) **/ UDEV_EXPORT dev_t udev_device_get_devnum(struct udev_device *udev_device) { - if (udev_device == NULL) - return makedev(0, 0); - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->devnum; + if (udev_device == NULL) + return makedev(0, 0); + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnum; } static int udev_device_set_devnum(struct udev_device *udev_device, dev_t devnum) { - char num[32]; + char num[32]; - udev_device->devnum = devnum; + udev_device->devnum = devnum; - snprintf(num, sizeof(num), "%u", major(devnum)); - udev_device_add_property(udev_device, "MAJOR", num); - snprintf(num, sizeof(num), "%u", minor(devnum)); - udev_device_add_property(udev_device, "MINOR", num); - return 0; + snprintf(num, sizeof(num), "%u", major(devnum)); + udev_device_add_property(udev_device, "MAJOR", num); + snprintf(num, sizeof(num), "%u", minor(devnum)); + udev_device_add_property(udev_device, "MINOR", num); + return 0; } const char *udev_device_get_devpath_old(struct udev_device *udev_device) { - return udev_device->devpath_old; + return udev_device->devpath_old; } static int udev_device_set_devpath_old(struct udev_device *udev_device, const char *devpath_old) { - const char *pos; + const char *pos; - free(udev_device->devpath_old); - udev_device->devpath_old = strdup(devpath_old); - if (udev_device->devpath_old == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); + free(udev_device->devpath_old); + udev_device->devpath_old = strdup(devpath_old); + if (udev_device->devpath_old == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "DEVPATH_OLD", udev_device->devpath_old); - pos = strrchr(udev_device->devpath_old, '/'); - if (pos == NULL) - return -EINVAL; - return 0; + pos = strrchr(udev_device->devpath_old, '/'); + if (pos == NULL) + return -EINVAL; + return 0; } /** @@ -189,27 +189,27 @@ static int udev_device_set_devpath_old(struct udev_device *udev_device, const ch **/ UDEV_EXPORT const char *udev_device_get_driver(struct udev_device *udev_device) { - char driver[UTIL_NAME_SIZE]; + char driver[UTIL_NAME_SIZE]; - if (udev_device == NULL) - return NULL; - if (!udev_device->driver_set) { - udev_device->driver_set = true; - if (util_get_sys_core_link_value(udev_device->udev, "driver", udev_device->syspath, driver, sizeof(driver)) > 0) - udev_device->driver = strdup(driver); - } - return udev_device->driver; + if (udev_device == NULL) + return NULL; + if (!udev_device->driver_set) { + udev_device->driver_set = true; + if (util_get_sys_core_link_value(udev_device->udev, "driver", udev_device->syspath, driver, sizeof(driver)) > 0) + udev_device->driver = strdup(driver); + } + return udev_device->driver; } static int udev_device_set_driver(struct udev_device *udev_device, const char *driver) { - free(udev_device->driver); - udev_device->driver = strdup(driver); - if (udev_device->driver == NULL) - return -ENOMEM; - udev_device->driver_set = true; - udev_device_add_property(udev_device, "DRIVER", udev_device->driver); - return 0; + free(udev_device->driver); + udev_device->driver = strdup(driver); + if (udev_device->driver == NULL) + return -ENOMEM; + udev_device->driver_set = true; + udev_device_add_property(udev_device, "DRIVER", udev_device->driver); + return 0; } /** @@ -222,35 +222,35 @@ static int udev_device_set_driver(struct udev_device *udev_device, const char *d **/ UDEV_EXPORT const char *udev_device_get_devtype(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - if (!udev_device->devtype_set) { - udev_device->devtype_set = true; - udev_device_read_uevent_file(udev_device); - } - return udev_device->devtype; + if (udev_device == NULL) + return NULL; + if (!udev_device->devtype_set) { + udev_device->devtype_set = true; + udev_device_read_uevent_file(udev_device); + } + return udev_device->devtype; } static int udev_device_set_devtype(struct udev_device *udev_device, const char *devtype) { - free(udev_device->devtype); - udev_device->devtype = strdup(devtype); - if (udev_device->devtype == NULL) - return -ENOMEM; - udev_device->devtype_set = true; - udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); - return 0; + free(udev_device->devtype); + udev_device->devtype = strdup(devtype); + if (udev_device->devtype == NULL) + return -ENOMEM; + udev_device->devtype_set = true; + udev_device_add_property(udev_device, "DEVTYPE", udev_device->devtype); + return 0; } static int udev_device_set_subsystem(struct udev_device *udev_device, const char *subsystem) { - free(udev_device->subsystem); - udev_device->subsystem = strdup(subsystem); - if (udev_device->subsystem == NULL) - return -ENOMEM; - udev_device->subsystem_set = true; - udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); - return 0; + free(udev_device->subsystem); + udev_device->subsystem = strdup(subsystem); + if (udev_device->subsystem == NULL) + return -ENOMEM; + udev_device->subsystem_set = true; + udev_device_add_property(udev_device, "SUBSYSTEM", udev_device->subsystem); + return 0; } /** @@ -264,82 +264,82 @@ static int udev_device_set_subsystem(struct udev_device *udev_device, const char **/ UDEV_EXPORT const char *udev_device_get_subsystem(struct udev_device *udev_device) { - char subsystem[UTIL_NAME_SIZE]; - - if (udev_device == NULL) - return NULL; - if (!udev_device->subsystem_set) { - udev_device->subsystem_set = true; - /* read "subsystem" link */ - if (util_get_sys_core_link_value(udev_device->udev, "subsystem", udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { - udev_device_set_subsystem(udev_device, subsystem); - return udev_device->subsystem; - } - /* implicit names */ - if (strncmp(udev_device->devpath, "/module/", 8) == 0) { - udev_device_set_subsystem(udev_device, "module"); - return udev_device->subsystem; - } - if (strstr(udev_device->devpath, "/drivers/") != NULL) { - udev_device_set_subsystem(udev_device, "drivers"); - return udev_device->subsystem; - } - if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || - strncmp(udev_device->devpath, "/class/", 7) == 0 || - strncmp(udev_device->devpath, "/bus/", 5) == 0) { - udev_device_set_subsystem(udev_device, "subsystem"); - return udev_device->subsystem; - } - } - return udev_device->subsystem; + char subsystem[UTIL_NAME_SIZE]; + + if (udev_device == NULL) + return NULL; + if (!udev_device->subsystem_set) { + udev_device->subsystem_set = true; + /* read "subsystem" link */ + if (util_get_sys_core_link_value(udev_device->udev, "subsystem", udev_device->syspath, subsystem, sizeof(subsystem)) > 0) { + udev_device_set_subsystem(udev_device, subsystem); + return udev_device->subsystem; + } + /* implicit names */ + if (strncmp(udev_device->devpath, "/module/", 8) == 0) { + udev_device_set_subsystem(udev_device, "module"); + return udev_device->subsystem; + } + if (strstr(udev_device->devpath, "/drivers/") != NULL) { + udev_device_set_subsystem(udev_device, "drivers"); + return udev_device->subsystem; + } + if (strncmp(udev_device->devpath, "/subsystem/", 11) == 0 || + strncmp(udev_device->devpath, "/class/", 7) == 0 || + strncmp(udev_device->devpath, "/bus/", 5) == 0) { + udev_device_set_subsystem(udev_device, "subsystem"); + return udev_device->subsystem; + } + } + return udev_device->subsystem; } mode_t udev_device_get_devnode_mode(struct udev_device *udev_device) { - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->devnode_mode; + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnode_mode; } static int udev_device_set_devnode_mode(struct udev_device *udev_device, mode_t mode) { - char num[32]; + char num[32]; - udev_device->devnode_mode = mode; - snprintf(num, sizeof(num), "%#o", mode); - udev_device_add_property(udev_device, "DEVMODE", num); - return 0; + udev_device->devnode_mode = mode; + snprintf(num, sizeof(num), "%#o", mode); + udev_device_add_property(udev_device, "DEVMODE", num); + return 0; } struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value) { - udev_device->envp_uptodate = false; - if (value == NULL) { - struct udev_list_entry *list_entry; + udev_device->envp_uptodate = false; + if (value == NULL) { + struct udev_list_entry *list_entry; - list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); - if (list_entry != NULL) - udev_list_entry_delete(list_entry); - return NULL; - } - return udev_list_entry_add(&udev_device->properties_list, key, value); + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + if (list_entry != NULL) + udev_list_entry_delete(list_entry); + return NULL; + } + return udev_list_entry_add(&udev_device->properties_list, key, value); } static struct udev_list_entry *udev_device_add_property_from_string(struct udev_device *udev_device, const char *property) { - char name[UTIL_LINE_SIZE]; - char *val; + char name[UTIL_LINE_SIZE]; + char *val; - util_strscpy(name, sizeof(name), property); - val = strchr(name, '='); - if (val == NULL) - return NULL; - val[0] = '\0'; - val = &val[1]; - if (val[0] == '\0') - val = NULL; - return udev_device_add_property(udev_device, name, val); + util_strscpy(name, sizeof(name), property); + val = strchr(name, '='); + if (val == NULL) + return NULL; + val[0] = '\0'; + val = &val[1]; + if (val[0] == '\0') + val = NULL; + return udev_device_add_property(udev_device, name, val); } /* @@ -353,86 +353,86 @@ static struct udev_list_entry *udev_device_add_property_from_string(struct udev_ */ void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property) { - if (strncmp(property, "DEVPATH=", 8) == 0) { - char path[UTIL_PATH_SIZE]; - - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev_device->udev), &property[8], NULL); - udev_device_set_syspath(udev_device, path); - } else if (strncmp(property, "SUBSYSTEM=", 10) == 0) { - udev_device_set_subsystem(udev_device, &property[10]); - } else if (strncmp(property, "DEVTYPE=", 8) == 0) { - udev_device_set_devtype(udev_device, &property[8]); - } else if (strncmp(property, "DEVNAME=", 8) == 0) { - udev_device_set_devnode(udev_device, &property[8]); - } else if (strncmp(property, "DEVLINKS=", 9) == 0) { - char devlinks[UTIL_PATH_SIZE]; - char *slink; - char *next; - - util_strscpy(devlinks, sizeof(devlinks), &property[9]); - slink = devlinks; - next = strchr(slink, ' '); - while (next != NULL) { - next[0] = '\0'; - udev_device_add_devlink(udev_device, slink, 0); - slink = &next[1]; - next = strchr(slink, ' '); - } - if (slink[0] != '\0') - udev_device_add_devlink(udev_device, slink, 0); - } else if (strncmp(property, "TAGS=", 5) == 0) { - char tags[UTIL_PATH_SIZE]; - char *next; - - util_strscpy(tags, sizeof(tags), &property[5]); - next = strchr(tags, ':'); - if (next != NULL) { - next++; - while (next[0] != '\0') { - char *tag; - - tag = next; - next = strchr(tag, ':'); - if (next == NULL) - break; - next[0] = '\0'; - next++; - udev_device_add_tag(udev_device, tag); - } - } - } else if (strncmp(property, "USEC_INITIALIZED=", 19) == 0) { - udev_device_set_usec_initialized(udev_device, strtoull(&property[19], NULL, 10)); - } else if (strncmp(property, "DRIVER=", 7) == 0) { - udev_device_set_driver(udev_device, &property[7]); - } else if (strncmp(property, "ACTION=", 7) == 0) { - udev_device_set_action(udev_device, &property[7]); - } else if (strncmp(property, "MAJOR=", 6) == 0) { - udev_device->maj = strtoull(&property[6], NULL, 10); - } else if (strncmp(property, "MINOR=", 6) == 0) { - udev_device->min = strtoull(&property[6], NULL, 10); - } else if (strncmp(property, "DEVPATH_OLD=", 12) == 0) { - udev_device_set_devpath_old(udev_device, &property[12]); - } else if (strncmp(property, "SEQNUM=", 7) == 0) { - udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10)); - } else if (strncmp(property, "IFINDEX=", 8) == 0) { - udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10)); - } else if (strncmp(property, "DEVMODE=", 8) == 0) { - udev_device_set_devnode_mode(udev_device, strtoul(&property[8], NULL, 8)); - } else { - udev_device_add_property_from_string(udev_device, property); - } + if (strncmp(property, "DEVPATH=", 8) == 0) { + char path[UTIL_PATH_SIZE]; + + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev_device->udev), &property[8], NULL); + udev_device_set_syspath(udev_device, path); + } else if (strncmp(property, "SUBSYSTEM=", 10) == 0) { + udev_device_set_subsystem(udev_device, &property[10]); + } else if (strncmp(property, "DEVTYPE=", 8) == 0) { + udev_device_set_devtype(udev_device, &property[8]); + } else if (strncmp(property, "DEVNAME=", 8) == 0) { + udev_device_set_devnode(udev_device, &property[8]); + } else if (strncmp(property, "DEVLINKS=", 9) == 0) { + char devlinks[UTIL_PATH_SIZE]; + char *slink; + char *next; + + util_strscpy(devlinks, sizeof(devlinks), &property[9]); + slink = devlinks; + next = strchr(slink, ' '); + while (next != NULL) { + next[0] = '\0'; + udev_device_add_devlink(udev_device, slink, 0); + slink = &next[1]; + next = strchr(slink, ' '); + } + if (slink[0] != '\0') + udev_device_add_devlink(udev_device, slink, 0); + } else if (strncmp(property, "TAGS=", 5) == 0) { + char tags[UTIL_PATH_SIZE]; + char *next; + + util_strscpy(tags, sizeof(tags), &property[5]); + next = strchr(tags, ':'); + if (next != NULL) { + next++; + while (next[0] != '\0') { + char *tag; + + tag = next; + next = strchr(tag, ':'); + if (next == NULL) + break; + next[0] = '\0'; + next++; + udev_device_add_tag(udev_device, tag); + } + } + } else if (strncmp(property, "USEC_INITIALIZED=", 19) == 0) { + udev_device_set_usec_initialized(udev_device, strtoull(&property[19], NULL, 10)); + } else if (strncmp(property, "DRIVER=", 7) == 0) { + udev_device_set_driver(udev_device, &property[7]); + } else if (strncmp(property, "ACTION=", 7) == 0) { + udev_device_set_action(udev_device, &property[7]); + } else if (strncmp(property, "MAJOR=", 6) == 0) { + udev_device->maj = strtoull(&property[6], NULL, 10); + } else if (strncmp(property, "MINOR=", 6) == 0) { + udev_device->min = strtoull(&property[6], NULL, 10); + } else if (strncmp(property, "DEVPATH_OLD=", 12) == 0) { + udev_device_set_devpath_old(udev_device, &property[12]); + } else if (strncmp(property, "SEQNUM=", 7) == 0) { + udev_device_set_seqnum(udev_device, strtoull(&property[7], NULL, 10)); + } else if (strncmp(property, "IFINDEX=", 8) == 0) { + udev_device_set_ifindex(udev_device, strtoull(&property[8], NULL, 10)); + } else if (strncmp(property, "DEVMODE=", 8) == 0) { + udev_device_set_devnode_mode(udev_device, strtoul(&property[8], NULL, 8)); + } else { + udev_device_add_property_from_string(udev_device, property); + } } int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_device) { - if (udev_device->maj > 0) - udev_device_set_devnum(udev_device, makedev(udev_device->maj, udev_device->min)); - udev_device->maj = 0; - udev_device->min = 0; + if (udev_device->maj > 0) + udev_device_set_devnum(udev_device, makedev(udev_device->maj, udev_device->min)); + udev_device->maj = 0; + udev_device->min = 0; - if (udev_device->devpath == NULL || udev_device->subsystem == NULL) - return -EINVAL; - return 0; + if (udev_device->devpath == NULL || udev_device->subsystem == NULL) + return -EINVAL; + return 0; } /** @@ -444,162 +444,162 @@ int udev_device_add_property_from_string_parse_finish(struct udev_device *udev_d **/ UDEV_EXPORT const char *udev_device_get_property_value(struct udev_device *udev_device, const char *key) { - struct udev_list_entry *list_entry; + struct udev_list_entry *list_entry; - if (udev_device == NULL) - return NULL; - if (key == NULL) - return NULL; + if (udev_device == NULL) + return NULL; + if (key == NULL) + return NULL; - list_entry = udev_device_get_properties_list_entry(udev_device); - list_entry = udev_list_entry_get_by_name(list_entry, key); - return udev_list_entry_get_value(list_entry); + list_entry = udev_device_get_properties_list_entry(udev_device); + list_entry = udev_list_entry_get_by_name(list_entry, key); + return udev_list_entry_get_value(list_entry); } int udev_device_read_db(struct udev_device *udev_device, const char *dbfile) { - char filename[UTIL_PATH_SIZE]; - char line[UTIL_LINE_SIZE]; - FILE *f; - - /* providing a database file will always force-load it */ - if (dbfile == NULL) { - const char *id; - - if (udev_device->db_loaded) - return 0; - udev_device->db_loaded = true; - - id = udev_device_get_id_filename(udev_device); - if (id == NULL) - return -1; - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_device->udev), "/data/", id, NULL); - dbfile = filename; - } - - f = fopen(dbfile, "re"); - if (f == NULL) { - info(udev_device->udev, "no db file to read %s: %m\n", dbfile); - return -1; - } - udev_device->is_initialized = true; - - while (fgets(line, sizeof(line), f)) { - ssize_t len; - const char *val; - struct udev_list_entry *entry; - - len = strlen(line); - if (len < 4) - break; - line[len-1] = '\0'; - val = &line[2]; - switch(line[0]) { - case 'S': - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); - udev_device_add_devlink(udev_device, filename, 0); - break; - case 'L': - udev_device_set_devlink_priority(udev_device, atoi(val)); - break; - case 'E': - entry = udev_device_add_property_from_string(udev_device, val); - udev_list_entry_set_num(entry, true); - break; - case 'G': - udev_device_add_tag(udev_device, val); - break; - case 'W': - udev_device_set_watch_handle(udev_device, atoi(val)); - break; - case 'I': - udev_device_set_usec_initialized(udev_device, strtoull(val, NULL, 10)); - break; - } - } - fclose(f); - - info(udev_device->udev, "device %p filled with db file data\n", udev_device); - return 0; + char filename[UTIL_PATH_SIZE]; + char line[UTIL_LINE_SIZE]; + FILE *f; + + /* providing a database file will always force-load it */ + if (dbfile == NULL) { + const char *id; + + if (udev_device->db_loaded) + return 0; + udev_device->db_loaded = true; + + id = udev_device_get_id_filename(udev_device); + if (id == NULL) + return -1; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_device->udev), "/data/", id, NULL); + dbfile = filename; + } + + f = fopen(dbfile, "re"); + if (f == NULL) { + info(udev_device->udev, "no db file to read %s: %m\n", dbfile); + return -1; + } + udev_device->is_initialized = true; + + while (fgets(line, sizeof(line), f)) { + ssize_t len; + const char *val; + struct udev_list_entry *entry; + + len = strlen(line); + if (len < 4) + break; + line[len-1] = '\0'; + val = &line[2]; + switch(line[0]) { + case 'S': + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev_device->udev), "/", val, NULL); + udev_device_add_devlink(udev_device, filename, 0); + break; + case 'L': + udev_device_set_devlink_priority(udev_device, atoi(val)); + break; + case 'E': + entry = udev_device_add_property_from_string(udev_device, val); + udev_list_entry_set_num(entry, true); + break; + case 'G': + udev_device_add_tag(udev_device, val); + break; + case 'W': + udev_device_set_watch_handle(udev_device, atoi(val)); + break; + case 'I': + udev_device_set_usec_initialized(udev_device, strtoull(val, NULL, 10)); + break; + } + } + fclose(f); + + info(udev_device->udev, "device %p filled with db file data\n", udev_device); + return 0; } int udev_device_read_uevent_file(struct udev_device *udev_device) { - char filename[UTIL_PATH_SIZE]; - FILE *f; - char line[UTIL_LINE_SIZE]; - int maj = 0; - int min = 0; - - if (udev_device->uevent_loaded) - return 0; - - util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL); - f = fopen(filename, "re"); - if (f == NULL) - return -1; - udev_device->uevent_loaded = true; - - while (fgets(line, sizeof(line), f)) { - char *pos; - - pos = strchr(line, '\n'); - if (pos == NULL) - continue; - pos[0] = '\0'; - - if (strncmp(line, "DEVTYPE=", 8) == 0) - udev_device_set_devtype(udev_device, &line[8]); - else if (strncmp(line, "MAJOR=", 6) == 0) - maj = strtoull(&line[6], NULL, 10); - else if (strncmp(line, "MINOR=", 6) == 0) - min = strtoull(&line[6], NULL, 10); - else if (strncmp(line, "IFINDEX=", 8) == 0) - udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); - else if (strncmp(line, "DEVNAME=", 8) == 0) - udev_device_set_devnode(udev_device, &line[8]); - else if (strncmp(line, "DEVMODE=", 8) == 0) - udev_device->devnode_mode = strtoul(&line[8], NULL, 8); - - udev_device_add_property_from_string(udev_device, line); - } - - udev_device->devnum = makedev(maj, min); - fclose(f); - return 0; + char filename[UTIL_PATH_SIZE]; + FILE *f; + char line[UTIL_LINE_SIZE]; + int maj = 0; + int min = 0; + + if (udev_device->uevent_loaded) + return 0; + + util_strscpyl(filename, sizeof(filename), udev_device->syspath, "/uevent", NULL); + f = fopen(filename, "re"); + if (f == NULL) + return -1; + udev_device->uevent_loaded = true; + + while (fgets(line, sizeof(line), f)) { + char *pos; + + pos = strchr(line, '\n'); + if (pos == NULL) + continue; + pos[0] = '\0'; + + if (strncmp(line, "DEVTYPE=", 8) == 0) + udev_device_set_devtype(udev_device, &line[8]); + else if (strncmp(line, "MAJOR=", 6) == 0) + maj = strtoull(&line[6], NULL, 10); + else if (strncmp(line, "MINOR=", 6) == 0) + min = strtoull(&line[6], NULL, 10); + else if (strncmp(line, "IFINDEX=", 8) == 0) + udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); + else if (strncmp(line, "DEVNAME=", 8) == 0) + udev_device_set_devnode(udev_device, &line[8]); + else if (strncmp(line, "DEVMODE=", 8) == 0) + udev_device->devnode_mode = strtoul(&line[8], NULL, 8); + + udev_device_add_property_from_string(udev_device, line); + } + + udev_device->devnum = makedev(maj, min); + fclose(f); + return 0; } void udev_device_set_info_loaded(struct udev_device *device) { - device->info_loaded = true; + device->info_loaded = true; } struct udev_device *udev_device_new(struct udev *udev) { - struct udev_device *udev_device; - struct udev_list_entry *list_entry; - - if (udev == NULL) - return NULL; - - udev_device = calloc(1, sizeof(struct udev_device)); - if (udev_device == NULL) - return NULL; - udev_device->refcount = 1; - udev_device->udev = udev; - udev_list_init(udev, &udev_device->devlinks_list, true); - udev_list_init(udev, &udev_device->properties_list, true); - udev_list_init(udev, &udev_device->sysattr_value_list, true); - udev_list_init(udev, &udev_device->sysattr_list, false); - udev_list_init(udev, &udev_device->tags_list, true); - udev_device->watch_handle = -1; - /* copy global properties */ - udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) - udev_device_add_property(udev_device, - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - dbg(udev_device->udev, "udev_device: %p created\n", udev_device); - return udev_device; + struct udev_device *udev_device; + struct udev_list_entry *list_entry; + + if (udev == NULL) + return NULL; + + udev_device = calloc(1, sizeof(struct udev_device)); + if (udev_device == NULL) + return NULL; + udev_device->refcount = 1; + udev_device->udev = udev; + udev_list_init(udev, &udev_device->devlinks_list, true); + udev_list_init(udev, &udev_device->properties_list, true); + udev_list_init(udev, &udev_device->sysattr_value_list, true); + udev_list_init(udev, &udev_device->sysattr_list, false); + udev_list_init(udev, &udev_device->tags_list, true); + udev_device->watch_handle = -1; + /* copy global properties */ + udev_list_entry_foreach(list_entry, udev_get_properties_list_entry(udev)) + udev_device_add_property(udev_device, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + dbg(udev_device->udev, "udev_device: %p created\n", udev_device); + return udev_device; } /** @@ -618,62 +618,62 @@ struct udev_device *udev_device_new(struct udev *udev) **/ UDEV_EXPORT struct udev_device *udev_device_new_from_syspath(struct udev *udev, const char *syspath) { - size_t len; - const char *subdir; - char path[UTIL_PATH_SIZE]; - char *pos; - struct stat statbuf; - struct udev_device *udev_device; - - if (udev == NULL) - return NULL; - if (syspath == NULL) - return NULL; - - /* path starts in sys */ - len = strlen(udev_get_sys_path(udev)); - if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) { - info(udev, "not in sys :%s\n", syspath); - return NULL; - } - - /* path is not a root directory */ - subdir = &syspath[len+1]; - pos = strrchr(subdir, '/'); - if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) { - dbg(udev, "not a subdir :%s\n", syspath); - return NULL; - } - - /* resolve possible symlink to real path */ - util_strscpy(path, sizeof(path), syspath); - util_resolve_sys_link(udev, path, sizeof(path)); - - if (strncmp(&path[len], "/devices/", 9) == 0) { - char file[UTIL_PATH_SIZE]; - - /* all "devices" require a "uevent" file */ - util_strscpyl(file, sizeof(file), path, "/uevent", NULL); - if (stat(file, &statbuf) != 0) { - dbg(udev, "not a device: %s\n", syspath); - return NULL; - } - } else { - /* everything else just needs to be a directory */ - if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) { - dbg(udev, "directory not found: %s\n", syspath); - return NULL; - } - } - - udev_device = udev_device_new(udev); - if (udev_device == NULL) - return NULL; - - udev_device_set_syspath(udev_device, path); - info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); - - return udev_device; + size_t len; + const char *subdir; + char path[UTIL_PATH_SIZE]; + char *pos; + struct stat statbuf; + struct udev_device *udev_device; + + if (udev == NULL) + return NULL; + if (syspath == NULL) + return NULL; + + /* path starts in sys */ + len = strlen(udev_get_sys_path(udev)); + if (strncmp(syspath, udev_get_sys_path(udev), len) != 0) { + info(udev, "not in sys :%s\n", syspath); + return NULL; + } + + /* path is not a root directory */ + subdir = &syspath[len+1]; + pos = strrchr(subdir, '/'); + if (pos == NULL || pos[1] == '\0' || pos < &subdir[2]) { + dbg(udev, "not a subdir :%s\n", syspath); + return NULL; + } + + /* resolve possible symlink to real path */ + util_strscpy(path, sizeof(path), syspath); + util_resolve_sys_link(udev, path, sizeof(path)); + + if (strncmp(&path[len], "/devices/", 9) == 0) { + char file[UTIL_PATH_SIZE]; + + /* all "devices" require a "uevent" file */ + util_strscpyl(file, sizeof(file), path, "/uevent", NULL); + if (stat(file, &statbuf) != 0) { + dbg(udev, "not a device: %s\n", syspath); + return NULL; + } + } else { + /* everything else just needs to be a directory */ + if (stat(path, &statbuf) != 0 || !S_ISDIR(statbuf.st_mode)) { + dbg(udev, "directory not found: %s\n", syspath); + return NULL; + } + } + + udev_device = udev_device_new(udev); + if (udev_device == NULL) + return NULL; + + udev_device_set_syspath(udev_device, path); + info(udev, "device %p has devpath '%s'\n", udev_device, udev_device_get_devpath(udev_device)); + + return udev_device; } /** @@ -694,75 +694,75 @@ UDEV_EXPORT struct udev_device *udev_device_new_from_syspath(struct udev *udev, **/ UDEV_EXPORT struct udev_device *udev_device_new_from_devnum(struct udev *udev, char type, dev_t devnum) { - char path[UTIL_PATH_SIZE]; - const char *type_str; + char path[UTIL_PATH_SIZE]; + const char *type_str; - if (type == 'b') - type_str = "block"; - else if (type == 'c') - type_str = "char"; - else - return NULL; + if (type == 'b') + type_str = "block"; + else if (type == 'c') + type_str = "char"; + else + return NULL; - /* use /sys/dev/{block,char}/: link */ - snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", - udev_get_sys_path(udev), type_str, major(devnum), minor(devnum)); - return udev_device_new_from_syspath(udev, path); + /* use /sys/dev/{block,char}/: link */ + snprintf(path, sizeof(path), "%s/dev/%s/%u:%u", + udev_get_sys_path(udev), type_str, major(devnum), minor(devnum)); + return udev_device_new_from_syspath(udev, path); } struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id) { - char type; - int maj, min; - char subsys[UTIL_PATH_SIZE]; - char *sysname; - - switch(id[0]) { - case 'b': - case 'c': - if (sscanf(id, "%c%i:%i", &type, &maj, &min) != 3) - return NULL; - return udev_device_new_from_devnum(udev, type, makedev(maj, min)); - case 'n': { - int sk; - struct ifreq ifr; - struct udev_device *dev; - int ifindex; - - ifindex = strtoul(&id[1], NULL, 10); - if (ifindex <= 0) - return NULL; - - sk = socket(PF_INET, SOCK_DGRAM, 0); - if (sk < 0) - return NULL; - memset(&ifr, 0x00, sizeof(struct ifreq)); - ifr.ifr_ifindex = ifindex; - if (ioctl(sk, SIOCGIFNAME, &ifr) != 0) { - close(sk); - return NULL; - } - close(sk); - - dev = udev_device_new_from_subsystem_sysname(udev, "net", ifr.ifr_name); - if (dev == NULL) - return NULL; - if (udev_device_get_ifindex(dev) == ifindex) - return dev; - udev_device_unref(dev); - return NULL; - } - case '+': - util_strscpy(subsys, sizeof(subsys), &id[1]); - sysname = strchr(subsys, ':'); - if (sysname == NULL) - return NULL; - sysname[0] = '\0'; - sysname = &sysname[1]; - return udev_device_new_from_subsystem_sysname(udev, subsys, sysname); - default: - return NULL; - } + char type; + int maj, min; + char subsys[UTIL_PATH_SIZE]; + char *sysname; + + switch(id[0]) { + case 'b': + case 'c': + if (sscanf(id, "%c%i:%i", &type, &maj, &min) != 3) + return NULL; + return udev_device_new_from_devnum(udev, type, makedev(maj, min)); + case 'n': { + int sk; + struct ifreq ifr; + struct udev_device *dev; + int ifindex; + + ifindex = strtoul(&id[1], NULL, 10); + if (ifindex <= 0) + return NULL; + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) + return NULL; + memset(&ifr, 0x00, sizeof(struct ifreq)); + ifr.ifr_ifindex = ifindex; + if (ioctl(sk, SIOCGIFNAME, &ifr) != 0) { + close(sk); + return NULL; + } + close(sk); + + dev = udev_device_new_from_subsystem_sysname(udev, "net", ifr.ifr_name); + if (dev == NULL) + return NULL; + if (udev_device_get_ifindex(dev) == ifindex) + return dev; + udev_device_unref(dev); + return NULL; + } + case '+': + util_strscpy(subsys, sizeof(subsys), &id[1]); + sysname = strchr(subsys, ':'); + if (sysname == NULL) + return NULL; + sysname[0] = '\0'; + sysname = &sysname[1]; + return udev_device_new_from_subsystem_sysname(udev, subsys, sysname); + default: + return NULL; + } } /** @@ -782,72 +782,72 @@ struct udev_device *udev_device_new_from_id_filename(struct udev *udev, char *id **/ UDEV_EXPORT struct udev_device *udev_device_new_from_subsystem_sysname(struct udev *udev, const char *subsystem, const char *sysname) { - char path_full[UTIL_PATH_SIZE]; - char *path; - size_t l; - struct stat statbuf; - - path = path_full; - l = util_strpcpyl(&path, sizeof(path_full), udev_get_sys_path(udev), NULL); - - if (strcmp(subsystem, "subsystem") == 0) { - util_strscpyl(path, l, "/subsystem/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/bus/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/class/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - } - - if (strcmp(subsystem, "module") == 0) { - util_strscpyl(path, l, "/module/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - goto out; - } - - if (strcmp(subsystem, "drivers") == 0) { - char subsys[UTIL_NAME_SIZE]; - char *driver; - - util_strscpy(subsys, sizeof(subsys), sysname); - driver = strchr(subsys, ':'); - if (driver != NULL) { - driver[0] = '\0'; - driver = &driver[1]; - - util_strscpyl(path, l, "/subsystem/", subsys, "/drivers/", driver, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/bus/", subsys, "/drivers/", driver, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - } - goto out; - } - - util_strscpyl(path, l, "/subsystem/", subsystem, "/devices/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/bus/", subsystem, "/devices/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; - - util_strscpyl(path, l, "/class/", subsystem, "/", sysname, NULL); - if (stat(path_full, &statbuf) == 0) - goto found; + char path_full[UTIL_PATH_SIZE]; + char *path; + size_t l; + struct stat statbuf; + + path = path_full; + l = util_strpcpyl(&path, sizeof(path_full), udev_get_sys_path(udev), NULL); + + if (strcmp(subsystem, "subsystem") == 0) { + util_strscpyl(path, l, "/subsystem/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/bus/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/class/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "module") == 0) { + util_strscpyl(path, l, "/module/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + goto out; + } + + if (strcmp(subsystem, "drivers") == 0) { + char subsys[UTIL_NAME_SIZE]; + char *driver; + + util_strscpy(subsys, sizeof(subsys), sysname); + driver = strchr(subsys, ':'); + if (driver != NULL) { + driver[0] = '\0'; + driver = &driver[1]; + + util_strscpyl(path, l, "/subsystem/", subsys, "/drivers/", driver, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/bus/", subsys, "/drivers/", driver, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + } + goto out; + } + + util_strscpyl(path, l, "/subsystem/", subsystem, "/devices/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/bus/", subsystem, "/devices/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; + + util_strscpyl(path, l, "/class/", subsystem, "/", sysname, NULL); + if (stat(path_full, &statbuf) == 0) + goto found; out: - return NULL; + return NULL; found: - return udev_device_new_from_syspath(udev, path_full); + return udev_device_new_from_syspath(udev, path_full); } /** @@ -866,46 +866,46 @@ found: **/ UDEV_EXPORT struct udev_device *udev_device_new_from_environment(struct udev *udev) { - int i; - struct udev_device *udev_device; + int i; + struct udev_device *udev_device; - udev_device = udev_device_new(udev); - if (udev_device == NULL) - return NULL; - udev_device_set_info_loaded(udev_device); + udev_device = udev_device_new(udev); + if (udev_device == NULL) + return NULL; + udev_device_set_info_loaded(udev_device); - for (i = 0; environ[i] != NULL; i++) - udev_device_add_property_from_string_parse(udev_device, environ[i]); + for (i = 0; environ[i] != NULL; i++) + udev_device_add_property_from_string_parse(udev_device, environ[i]); - if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { - info(udev, "missing values, invalid device\n"); - udev_device_unref(udev_device); - udev_device = NULL; - } + if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { + info(udev, "missing values, invalid device\n"); + udev_device_unref(udev_device); + udev_device = NULL; + } - return udev_device; + return udev_device; } static struct udev_device *device_new_from_parent(struct udev_device *udev_device) { - struct udev_device *udev_device_parent = NULL; - char path[UTIL_PATH_SIZE]; - const char *subdir; + struct udev_device *udev_device_parent = NULL; + char path[UTIL_PATH_SIZE]; + const char *subdir; - util_strscpy(path, sizeof(path), udev_device->syspath); - subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; - for (;;) { - char *pos; + util_strscpy(path, sizeof(path), udev_device->syspath); + subdir = &path[strlen(udev_get_sys_path(udev_device->udev))+1]; + for (;;) { + char *pos; - pos = strrchr(subdir, '/'); - if (pos == NULL || pos < &subdir[2]) - break; - pos[0] = '\0'; - udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); - if (udev_device_parent != NULL) - return udev_device_parent; - } - return NULL; + pos = strrchr(subdir, '/'); + if (pos == NULL || pos < &subdir[2]) + break; + pos[0] = '\0'; + udev_device_parent = udev_device_new_from_syspath(udev_device->udev, path); + if (udev_device_parent != NULL) + return udev_device_parent; + } + return NULL; } /** @@ -929,15 +929,15 @@ static struct udev_device *device_new_from_parent(struct udev_device *udev_devic **/ UDEV_EXPORT struct udev_device *udev_device_get_parent(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - if (!udev_device->parent_set) { - udev_device->parent_set = true; - udev_device->parent_device = device_new_from_parent(udev_device); - } - if (udev_device->parent_device != NULL) - dbg(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); - return udev_device->parent_device; + if (udev_device == NULL) + return NULL; + if (!udev_device->parent_set) { + udev_device->parent_set = true; + udev_device->parent_device = device_new_from_parent(udev_device); + } + if (udev_device->parent_device != NULL) + dbg(udev_device->udev, "returning existing parent %p\n", udev_device->parent_device); + return udev_device->parent_device; } /** @@ -964,27 +964,27 @@ UDEV_EXPORT struct udev_device *udev_device_get_parent(struct udev_device *udev_ **/ UDEV_EXPORT struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, const char *subsystem, const char *devtype) { - struct udev_device *parent; + struct udev_device *parent; - if (subsystem == NULL) - return NULL; + if (subsystem == NULL) + return NULL; - parent = udev_device_get_parent(udev_device); - while (parent != NULL) { - const char *parent_subsystem; - const char *parent_devtype; + parent = udev_device_get_parent(udev_device); + while (parent != NULL) { + const char *parent_subsystem; + const char *parent_devtype; - parent_subsystem = udev_device_get_subsystem(parent); - if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) { - if (devtype == NULL) - break; - parent_devtype = udev_device_get_devtype(parent); - if (parent_devtype != NULL && strcmp(parent_devtype, devtype) == 0) - break; - } - parent = udev_device_get_parent(parent); - } - return parent; + parent_subsystem = udev_device_get_subsystem(parent); + if (parent_subsystem != NULL && strcmp(parent_subsystem, subsystem) == 0) { + if (devtype == NULL) + break; + parent_devtype = udev_device_get_devtype(parent); + if (parent_devtype != NULL && strcmp(parent_devtype, devtype) == 0) + break; + } + parent = udev_device_get_parent(parent); + } + return parent; } /** @@ -997,9 +997,9 @@ UDEV_EXPORT struct udev_device *udev_device_get_parent_with_subsystem_devtype(st **/ UDEV_EXPORT struct udev *udev_device_get_udev(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - return udev_device->udev; + if (udev_device == NULL) + return NULL; + return udev_device->udev; } /** @@ -1012,10 +1012,10 @@ UDEV_EXPORT struct udev *udev_device_get_udev(struct udev_device *udev_device) **/ UDEV_EXPORT struct udev_device *udev_device_ref(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - udev_device->refcount++; - return udev_device; + if (udev_device == NULL) + return NULL; + udev_device->refcount++; + return udev_device; } /** @@ -1028,31 +1028,31 @@ UDEV_EXPORT struct udev_device *udev_device_ref(struct udev_device *udev_device) **/ UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device) { - if (udev_device == NULL) - return; - udev_device->refcount--; - if (udev_device->refcount > 0) - return; - if (udev_device->parent_device != NULL) - udev_device_unref(udev_device->parent_device); - free(udev_device->syspath); - free(udev_device->sysname); - free(udev_device->devnode); - free(udev_device->subsystem); - free(udev_device->devtype); - udev_list_cleanup(&udev_device->devlinks_list); - udev_list_cleanup(&udev_device->properties_list); - udev_list_cleanup(&udev_device->sysattr_value_list); - udev_list_cleanup(&udev_device->sysattr_list); - udev_list_cleanup(&udev_device->tags_list); - free(udev_device->action); - free(udev_device->driver); - free(udev_device->devpath_old); - free(udev_device->id_filename); - free(udev_device->envp); - free(udev_device->monitor_buf); - dbg(udev_device->udev, "udev_device: %p released\n", udev_device); - free(udev_device); + if (udev_device == NULL) + return; + udev_device->refcount--; + if (udev_device->refcount > 0) + return; + if (udev_device->parent_device != NULL) + udev_device_unref(udev_device->parent_device); + free(udev_device->syspath); + free(udev_device->sysname); + free(udev_device->devnode); + free(udev_device->subsystem); + free(udev_device->devtype); + udev_list_cleanup(&udev_device->devlinks_list); + udev_list_cleanup(&udev_device->properties_list); + udev_list_cleanup(&udev_device->sysattr_value_list); + udev_list_cleanup(&udev_device->sysattr_list); + udev_list_cleanup(&udev_device->tags_list); + free(udev_device->action); + free(udev_device->driver); + free(udev_device->devpath_old); + free(udev_device->id_filename); + free(udev_device->envp); + free(udev_device->monitor_buf); + dbg(udev_device->udev, "udev_device: %p released\n", udev_device); + free(udev_device); } /** @@ -1066,9 +1066,9 @@ UDEV_EXPORT void udev_device_unref(struct udev_device *udev_device) **/ UDEV_EXPORT const char *udev_device_get_devpath(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - return udev_device->devpath; + if (udev_device == NULL) + return NULL; + return udev_device->devpath; } /** @@ -1082,9 +1082,9 @@ UDEV_EXPORT const char *udev_device_get_devpath(struct udev_device *udev_device) **/ UDEV_EXPORT const char *udev_device_get_syspath(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - return udev_device->syspath; + if (udev_device == NULL) + return NULL; + return udev_device->syspath; } /** @@ -1095,9 +1095,9 @@ UDEV_EXPORT const char *udev_device_get_syspath(struct udev_device *udev_device) **/ UDEV_EXPORT const char *udev_device_get_sysname(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - return udev_device->sysname; + if (udev_device == NULL) + return NULL; + return udev_device->sysname; } /** @@ -1108,9 +1108,9 @@ UDEV_EXPORT const char *udev_device_get_sysname(struct udev_device *udev_device) **/ UDEV_EXPORT const char *udev_device_get_sysnum(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - return udev_device->sysnum; + if (udev_device == NULL) + return NULL; + return udev_device->sysnum; } /** @@ -1124,13 +1124,13 @@ UDEV_EXPORT const char *udev_device_get_sysnum(struct udev_device *udev_device) **/ UDEV_EXPORT const char *udev_device_get_devnode(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - if (udev_device->devnode != NULL) - return udev_device->devnode; - if (!udev_device->info_loaded) - udev_device_read_uevent_file(udev_device); - return udev_device->devnode; + if (udev_device == NULL) + return NULL; + if (udev_device->devnode != NULL) + return udev_device->devnode; + if (!udev_device->info_loaded) + udev_device_read_uevent_file(udev_device); + return udev_device->devnode; } /** @@ -1148,17 +1148,17 @@ UDEV_EXPORT const char *udev_device_get_devnode(struct udev_device *udev_device) **/ UDEV_EXPORT struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_list_get_entry(&udev_device->devlinks_list); + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_list_get_entry(&udev_device->devlinks_list); } void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) { - udev_device->devlinks_uptodate = false; - udev_list_cleanup(&udev_device->devlinks_list); + udev_device->devlinks_uptodate = false; + udev_list_cleanup(&udev_device->devlinks_list); } /** @@ -1175,45 +1175,45 @@ void udev_device_cleanup_devlinks_list(struct udev_device *udev_device) **/ UDEV_EXPORT struct udev_list_entry *udev_device_get_properties_list_entry(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - if (!udev_device->info_loaded) { - udev_device_read_uevent_file(udev_device); - udev_device_read_db(udev_device, NULL); - } - if (!udev_device->devlinks_uptodate) { - char symlinks[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - - udev_device->devlinks_uptodate = true; - list_entry = udev_device_get_devlinks_list_entry(udev_device); - if (list_entry != NULL) { - char *s; - size_t l; - - s = symlinks; - l = util_strpcpyl(&s, sizeof(symlinks), udev_list_entry_get_name(list_entry), NULL); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) - l = util_strpcpyl(&s, l, " ", udev_list_entry_get_name(list_entry), NULL); - udev_device_add_property(udev_device, "DEVLINKS", symlinks); - } - } - if (!udev_device->tags_uptodate) { - udev_device->tags_uptodate = true; - if (udev_device_get_tags_list_entry(udev_device) != NULL) { - char tags[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - char *s; - size_t l; - - s = tags; - l = util_strpcpyl(&s, sizeof(tags), ":", NULL); - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) - l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), ":", NULL); - udev_device_add_property(udev_device, "TAGS", tags); - } - } - return udev_list_get_entry(&udev_device->properties_list); + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) { + udev_device_read_uevent_file(udev_device); + udev_device_read_db(udev_device, NULL); + } + if (!udev_device->devlinks_uptodate) { + char symlinks[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + + udev_device->devlinks_uptodate = true; + list_entry = udev_device_get_devlinks_list_entry(udev_device); + if (list_entry != NULL) { + char *s; + size_t l; + + s = symlinks; + l = util_strpcpyl(&s, sizeof(symlinks), udev_list_entry_get_name(list_entry), NULL); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) + l = util_strpcpyl(&s, l, " ", udev_list_entry_get_name(list_entry), NULL); + udev_device_add_property(udev_device, "DEVLINKS", symlinks); + } + } + if (!udev_device->tags_uptodate) { + udev_device->tags_uptodate = true; + if (udev_device_get_tags_list_entry(udev_device) != NULL) { + char tags[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + char *s; + size_t l; + + s = tags; + l = util_strpcpyl(&s, sizeof(tags), ":", NULL); + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + l = util_strpcpyl(&s, l, udev_list_entry_get_name(list_entry), ":", NULL); + udev_device_add_property(udev_device, "TAGS", tags); + } + } + return udev_list_get_entry(&udev_device->properties_list); } /** @@ -1228,9 +1228,9 @@ UDEV_EXPORT struct udev_list_entry *udev_device_get_properties_list_entry(struct **/ UDEV_EXPORT const char *udev_device_get_action(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - return udev_device->action; + if (udev_device == NULL) + return NULL; + return udev_device->action; } /** @@ -1247,32 +1247,32 @@ UDEV_EXPORT const char *udev_device_get_action(struct udev_device *udev_device) **/ UDEV_EXPORT unsigned long long int udev_device_get_usec_since_initialized(struct udev_device *udev_device) { - unsigned long long now; + unsigned long long now; - if (udev_device == NULL) - return 0; - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - if (udev_device->usec_initialized == 0) - return 0; - now = now_usec(); - if (now == 0) - return 0; - return now - udev_device->usec_initialized; + if (udev_device == NULL) + return 0; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + if (udev_device->usec_initialized == 0) + return 0; + now = now_usec(); + if (now == 0) + return 0; + return now - udev_device->usec_initialized; } unsigned long long udev_device_get_usec_initialized(struct udev_device *udev_device) { - return udev_device->usec_initialized; + return udev_device->usec_initialized; } void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned long long usec_initialized) { - char num[32]; + char num[32]; - udev_device->usec_initialized = usec_initialized; - snprintf(num, sizeof(num), "%llu", usec_initialized); - udev_device_add_property(udev_device, "USEC_INITIALIZED", num); + udev_device->usec_initialized = usec_initialized; + snprintf(num, sizeof(num), "%llu", usec_initialized); + udev_device_add_property(udev_device, "USEC_INITIALIZED", num); } /** @@ -1287,139 +1287,139 @@ void udev_device_set_usec_initialized(struct udev_device *udev_device, unsigned **/ UDEV_EXPORT const char *udev_device_get_sysattr_value(struct udev_device *udev_device, const char *sysattr) { - struct udev_list_entry *list_entry; - char path[UTIL_PATH_SIZE]; - char value[4096]; - struct stat statbuf; - int fd; - ssize_t size; - const char *val = NULL; - - if (udev_device == NULL) - return NULL; - if (sysattr == NULL) - return NULL; - - /* look for possibly already cached result */ - list_entry = udev_list_get_entry(&udev_device->sysattr_value_list); - list_entry = udev_list_entry_get_by_name(list_entry, sysattr); - if (list_entry != NULL) { - dbg(udev_device->udev, "got '%s' (%s) from cache\n", - sysattr, udev_list_entry_get_value(list_entry)); - return udev_list_entry_get_value(list_entry); - } - - util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); - if (lstat(path, &statbuf) != 0) { - dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); - udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, NULL); - goto out; - } - - if (S_ISLNK(statbuf.st_mode)) { - struct udev_device *dev; - - /* - * Some core links return only the last element of the target path, - * these are just values, the paths should not be exposed. - */ - if (strcmp(sysattr, "driver") == 0 || - strcmp(sysattr, "subsystem") == 0 || - strcmp(sysattr, "module") == 0) { - if (util_get_sys_core_link_value(udev_device->udev, sysattr, - udev_device->syspath, value, sizeof(value)) < 0) - return NULL; - dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, value); - list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); - val = udev_list_entry_get_value(list_entry); - goto out; - } - - /* resolve link to a device and return its syspath */ - util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL); - dev = udev_device_new_from_syspath(udev_device->udev, path); - if (dev != NULL) { - list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, - udev_device_get_syspath(dev)); - val = udev_list_entry_get_value(list_entry); - udev_device_unref(dev); - } - - goto out; - } - - /* skip directories */ - if (S_ISDIR(statbuf.st_mode)) - goto out; - - /* skip non-readable files */ - if ((statbuf.st_mode & S_IRUSR) == 0) - goto out; - - /* read attribute value */ - fd = open(path, O_RDONLY|O_CLOEXEC); - if (fd < 0) { - dbg(udev_device->udev, "attribute '%s' can not be opened\n", path); - goto out; - } - size = read(fd, value, sizeof(value)); - close(fd); - if (size < 0) - goto out; - if (size == sizeof(value)) - goto out; - - /* got a valid value, store it in cache and return it */ - value[size] = '\0'; - util_remove_trailing_chars(value, '\n'); - dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); - list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); - val = udev_list_entry_get_value(list_entry); + struct udev_list_entry *list_entry; + char path[UTIL_PATH_SIZE]; + char value[4096]; + struct stat statbuf; + int fd; + ssize_t size; + const char *val = NULL; + + if (udev_device == NULL) + return NULL; + if (sysattr == NULL) + return NULL; + + /* look for possibly already cached result */ + list_entry = udev_list_get_entry(&udev_device->sysattr_value_list); + list_entry = udev_list_entry_get_by_name(list_entry, sysattr); + if (list_entry != NULL) { + dbg(udev_device->udev, "got '%s' (%s) from cache\n", + sysattr, udev_list_entry_get_value(list_entry)); + return udev_list_entry_get_value(list_entry); + } + + util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", sysattr, NULL); + if (lstat(path, &statbuf) != 0) { + dbg(udev_device->udev, "no attribute '%s', keep negative entry\n", path); + udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, NULL); + goto out; + } + + if (S_ISLNK(statbuf.st_mode)) { + struct udev_device *dev; + + /* + * Some core links return only the last element of the target path, + * these are just values, the paths should not be exposed. + */ + if (strcmp(sysattr, "driver") == 0 || + strcmp(sysattr, "subsystem") == 0 || + strcmp(sysattr, "module") == 0) { + if (util_get_sys_core_link_value(udev_device->udev, sysattr, + udev_device->syspath, value, sizeof(value)) < 0) + return NULL; + dbg(udev_device->udev, "cache '%s' with link value '%s'\n", sysattr, value); + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); + val = udev_list_entry_get_value(list_entry); + goto out; + } + + /* resolve link to a device and return its syspath */ + util_strscpyl(path, sizeof(path), udev_device->syspath, "/", sysattr, NULL); + dev = udev_device_new_from_syspath(udev_device->udev, path); + if (dev != NULL) { + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, + udev_device_get_syspath(dev)); + val = udev_list_entry_get_value(list_entry); + udev_device_unref(dev); + } + + goto out; + } + + /* skip directories */ + if (S_ISDIR(statbuf.st_mode)) + goto out; + + /* skip non-readable files */ + if ((statbuf.st_mode & S_IRUSR) == 0) + goto out; + + /* read attribute value */ + fd = open(path, O_RDONLY|O_CLOEXEC); + if (fd < 0) { + dbg(udev_device->udev, "attribute '%s' can not be opened\n", path); + goto out; + } + size = read(fd, value, sizeof(value)); + close(fd); + if (size < 0) + goto out; + if (size == sizeof(value)) + goto out; + + /* got a valid value, store it in cache and return it */ + value[size] = '\0'; + util_remove_trailing_chars(value, '\n'); + dbg(udev_device->udev, "'%s' has attribute value '%s'\n", path, value); + list_entry = udev_list_entry_add(&udev_device->sysattr_value_list, sysattr, value); + val = udev_list_entry_get_value(list_entry); out: - return val; + return val; } static int udev_device_sysattr_list_read(struct udev_device *udev_device) { - struct dirent *dent; - DIR *dir; - int num = 0; + struct dirent *dent; + DIR *dir; + int num = 0; - if (udev_device == NULL) - return -1; - if (udev_device->sysattr_list_read) - return 0; + if (udev_device == NULL) + return -1; + if (udev_device->sysattr_list_read) + return 0; - dir = opendir(udev_device_get_syspath(udev_device)); - if (!dir) { - dbg(udev_device->udev, "sysfs dir '%s' can not be opened\n", - udev_device_get_syspath(udev_device)); - return -1; - } + dir = opendir(udev_device_get_syspath(udev_device)); + if (!dir) { + dbg(udev_device->udev, "sysfs dir '%s' can not be opened\n", + udev_device_get_syspath(udev_device)); + return -1; + } - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char path[UTIL_PATH_SIZE]; - struct stat statbuf; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char path[UTIL_PATH_SIZE]; + struct stat statbuf; - /* only handle symlinks and regular files */ - if (dent->d_type != DT_LNK && dent->d_type != DT_REG) - continue; + /* only handle symlinks and regular files */ + if (dent->d_type != DT_LNK && dent->d_type != DT_REG) + continue; - util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", dent->d_name, NULL); - if (lstat(path, &statbuf) != 0) - continue; - if ((statbuf.st_mode & S_IRUSR) == 0) - continue; + util_strscpyl(path, sizeof(path), udev_device_get_syspath(udev_device), "/", dent->d_name, NULL); + if (lstat(path, &statbuf) != 0) + continue; + if ((statbuf.st_mode & S_IRUSR) == 0) + continue; - udev_list_entry_add(&udev_device->sysattr_list, dent->d_name, NULL); - num++; - } + udev_list_entry_add(&udev_device->sysattr_list, dent->d_name, NULL); + num++; + } - closedir(dir); - dbg(udev_device->udev, "found %d sysattrs for '%s'\n", num, udev_device_get_syspath(udev_device)); - udev_device->sysattr_list_read = true; + closedir(dir); + dbg(udev_device->udev, "found %d sysattrs for '%s'\n", num, udev_device_get_syspath(udev_device)); + udev_device->sysattr_list_read = true; - return num; + return num; } /** @@ -1434,114 +1434,114 @@ static int udev_device_sysattr_list_read(struct udev_device *udev_device) **/ UDEV_EXPORT struct udev_list_entry *udev_device_get_sysattr_list_entry(struct udev_device *udev_device) { - if (!udev_device->sysattr_list_read) { - int ret; - ret = udev_device_sysattr_list_read(udev_device); - if (0 > ret) - return NULL; - } + if (!udev_device->sysattr_list_read) { + int ret; + ret = udev_device_sysattr_list_read(udev_device); + if (0 > ret) + return NULL; + } - return udev_list_get_entry(&udev_device->sysattr_list); + return udev_list_get_entry(&udev_device->sysattr_list); } int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath) { - const char *pos; - size_t len; + const char *pos; + size_t len; - free(udev_device->syspath); - udev_device->syspath = strdup(syspath); - if (udev_device->syspath == NULL) - return -ENOMEM; - udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; - udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath); + free(udev_device->syspath); + udev_device->syspath = strdup(syspath); + if (udev_device->syspath == NULL) + return -ENOMEM; + udev_device->devpath = &udev_device->syspath[strlen(udev_get_sys_path(udev_device->udev))]; + udev_device_add_property(udev_device, "DEVPATH", udev_device->devpath); - pos = strrchr(udev_device->syspath, '/'); - if (pos == NULL) - return -EINVAL; - udev_device->sysname = strdup(&pos[1]); - if (udev_device->sysname == NULL) - return -ENOMEM; + pos = strrchr(udev_device->syspath, '/'); + if (pos == NULL) + return -EINVAL; + udev_device->sysname = strdup(&pos[1]); + if (udev_device->sysname == NULL) + return -ENOMEM; - /* some devices have '!' in their name, change that to '/' */ - len = 0; - while (udev_device->sysname[len] != '\0') { - if (udev_device->sysname[len] == '!') - udev_device->sysname[len] = '/'; - len++; - } + /* some devices have '!' in their name, change that to '/' */ + len = 0; + while (udev_device->sysname[len] != '\0') { + if (udev_device->sysname[len] == '!') + udev_device->sysname[len] = '/'; + len++; + } - /* trailing number */ - while (len > 0 && isdigit(udev_device->sysname[--len])) - udev_device->sysnum = &udev_device->sysname[len]; + /* trailing number */ + while (len > 0 && isdigit(udev_device->sysname[--len])) + udev_device->sysnum = &udev_device->sysname[len]; - /* sysname is completely numeric */ - if (len == 0) - udev_device->sysnum = NULL; + /* sysname is completely numeric */ + if (len == 0) + udev_device->sysnum = NULL; - return 0; + return 0; } int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode) { - free(udev_device->devnode); - if (devnode[0] != '/') { - if (asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), devnode) < 0) - udev_device->devnode = NULL; - } else { - udev_device->devnode = strdup(devnode); - } - if (udev_device->devnode == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); - return 0; + free(udev_device->devnode); + if (devnode[0] != '/') { + if (asprintf(&udev_device->devnode, "%s/%s", udev_get_dev_path(udev_device->udev), devnode) < 0) + udev_device->devnode = NULL; + } else { + udev_device->devnode = strdup(devnode); + } + if (udev_device->devnode == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "DEVNAME", udev_device->devnode); + return 0; } int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique) { - struct udev_list_entry *list_entry; + struct udev_list_entry *list_entry; - udev_device->devlinks_uptodate = false; - list_entry = udev_list_entry_add(&udev_device->devlinks_list, devlink, NULL); - if (list_entry == NULL) - return -ENOMEM; - if (unique) - udev_list_entry_set_num(list_entry, true); - return 0; + udev_device->devlinks_uptodate = false; + list_entry = udev_list_entry_add(&udev_device->devlinks_list, devlink, NULL); + if (list_entry == NULL) + return -ENOMEM; + if (unique) + udev_list_entry_set_num(list_entry, true); + return 0; } const char *udev_device_get_id_filename(struct udev_device *udev_device) { - if (udev_device->id_filename == NULL) { - if (udev_device_get_subsystem(udev_device) == NULL) - return NULL; - - if (major(udev_device_get_devnum(udev_device)) > 0) { - /* use dev_t -- b259:131072, c254:0 */ - if (asprintf(&udev_device->id_filename, "%c%u:%u", - strcmp(udev_device_get_subsystem(udev_device), "block") == 0 ? 'b' : 'c', - major(udev_device_get_devnum(udev_device)), - minor(udev_device_get_devnum(udev_device))) < 0) - udev_device->id_filename = NULL; - } else if (udev_device_get_ifindex(udev_device) > 0) { - /* use netdev ifindex -- n3 */ - if (asprintf(&udev_device->id_filename, "n%u", udev_device_get_ifindex(udev_device)) < 0) - udev_device->id_filename = NULL; - } else { - /* - * use $subsys:$syname -- pci:0000:00:1f.2 - * sysname() has '!' translated, get it from devpath - */ - const char *sysname; - sysname = strrchr(udev_device->devpath, '/'); - if (sysname == NULL) - return NULL; - sysname = &sysname[1]; - if (asprintf(&udev_device->id_filename, "+%s:%s", udev_device_get_subsystem(udev_device), sysname) < 0) - udev_device->id_filename = NULL; - } - } - return udev_device->id_filename; + if (udev_device->id_filename == NULL) { + if (udev_device_get_subsystem(udev_device) == NULL) + return NULL; + + if (major(udev_device_get_devnum(udev_device)) > 0) { + /* use dev_t -- b259:131072, c254:0 */ + if (asprintf(&udev_device->id_filename, "%c%u:%u", + strcmp(udev_device_get_subsystem(udev_device), "block") == 0 ? 'b' : 'c', + major(udev_device_get_devnum(udev_device)), + minor(udev_device_get_devnum(udev_device))) < 0) + udev_device->id_filename = NULL; + } else if (udev_device_get_ifindex(udev_device) > 0) { + /* use netdev ifindex -- n3 */ + if (asprintf(&udev_device->id_filename, "n%u", udev_device_get_ifindex(udev_device)) < 0) + udev_device->id_filename = NULL; + } else { + /* + * use $subsys:$syname -- pci:0000:00:1f.2 + * sysname() has '!' translated, get it from devpath + */ + const char *sysname; + sysname = strrchr(udev_device->devpath, '/'); + if (sysname == NULL) + return NULL; + sysname = &sysname[1]; + if (asprintf(&udev_device->id_filename, "+%s:%s", udev_device_get_subsystem(udev_device), sysname) < 0) + udev_device->id_filename = NULL; + } + } + return udev_device->id_filename; } /** @@ -1559,30 +1559,30 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device) **/ UDEV_EXPORT int udev_device_get_is_initialized(struct udev_device *udev_device) { - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_device->is_initialized; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_device->is_initialized; } void udev_device_set_is_initialized(struct udev_device *udev_device) { - udev_device->is_initialized = true; + udev_device->is_initialized = true; } int udev_device_add_tag(struct udev_device *udev_device, const char *tag) { - if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) - return -EINVAL; - udev_device->tags_uptodate = false; - if (udev_list_entry_add(&udev_device->tags_list, tag, NULL) != NULL) - return 0; - return -ENOMEM; + if (strchr(tag, ':') != NULL || strchr(tag, ' ') != NULL) + return -EINVAL; + udev_device->tags_uptodate = false; + if (udev_list_entry_add(&udev_device->tags_list, tag, NULL) != NULL) + return 0; + return -ENOMEM; } void udev_device_cleanup_tags_list(struct udev_device *udev_device) { - udev_device->tags_uptodate = false; - udev_list_cleanup(&udev_device->tags_list); + udev_device->tags_uptodate = false; + udev_list_cleanup(&udev_device->tags_list); } /** @@ -1598,140 +1598,140 @@ void udev_device_cleanup_tags_list(struct udev_device *udev_device) **/ UDEV_EXPORT struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_device *udev_device) { - if (udev_device == NULL) - return NULL; - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_list_get_entry(&udev_device->tags_list); + if (udev_device == NULL) + return NULL; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_list_get_entry(&udev_device->tags_list); } UDEV_EXPORT int udev_device_has_tag(struct udev_device *udev_device, const char *tag) { - struct udev_list_entry *list_entry; + struct udev_list_entry *list_entry; - if (udev_device == NULL) - return false; - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - list_entry = udev_device_get_tags_list_entry(udev_device); - if (udev_list_entry_get_by_name(list_entry, tag) != NULL) - return true; - return false; + if (udev_device == NULL) + return false; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + list_entry = udev_device_get_tags_list_entry(udev_device); + if (udev_list_entry_get_by_name(list_entry, tag) != NULL) + return true; + return false; } -#define ENVP_SIZE 128 -#define MONITOR_BUF_SIZE 4096 +#define ENVP_SIZE 128 +#define MONITOR_BUF_SIZE 4096 static int update_envp_monitor_buf(struct udev_device *udev_device) { - struct udev_list_entry *list_entry; - char *s; - size_t l; - unsigned int i; - - /* monitor buffer of property strings */ - free(udev_device->monitor_buf); - udev_device->monitor_buf_len = 0; - udev_device->monitor_buf = malloc(MONITOR_BUF_SIZE); - if (udev_device->monitor_buf == NULL) - return -ENOMEM; - - /* envp array, strings will point into monitor buffer */ - if (udev_device->envp == NULL) - udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); - if (udev_device->envp == NULL) - return -ENOMEM; - - i = 0; - s = udev_device->monitor_buf; - l = MONITOR_BUF_SIZE; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { - const char *key; - - key = udev_list_entry_get_name(list_entry); - /* skip private variables */ - if (key[0] == '.') - continue; - - /* add string to envp array */ - udev_device->envp[i++] = s; - if (i+1 >= ENVP_SIZE) - return -EINVAL; - - /* add property string to monitor buffer */ - l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL); - if (l == 0) - return -EINVAL; - /* advance past the trailing '\0' that util_strpcpyl() guarantees */ - s++; - l--; - } - udev_device->envp[i] = NULL; - udev_device->monitor_buf_len = s - udev_device->monitor_buf; - udev_device->envp_uptodate = true; - dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", - i, udev_device->monitor_buf_len); - return 0; + struct udev_list_entry *list_entry; + char *s; + size_t l; + unsigned int i; + + /* monitor buffer of property strings */ + free(udev_device->monitor_buf); + udev_device->monitor_buf_len = 0; + udev_device->monitor_buf = malloc(MONITOR_BUF_SIZE); + if (udev_device->monitor_buf == NULL) + return -ENOMEM; + + /* envp array, strings will point into monitor buffer */ + if (udev_device->envp == NULL) + udev_device->envp = malloc(sizeof(char *) * ENVP_SIZE); + if (udev_device->envp == NULL) + return -ENOMEM; + + i = 0; + s = udev_device->monitor_buf; + l = MONITOR_BUF_SIZE; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(udev_device)) { + const char *key; + + key = udev_list_entry_get_name(list_entry); + /* skip private variables */ + if (key[0] == '.') + continue; + + /* add string to envp array */ + udev_device->envp[i++] = s; + if (i+1 >= ENVP_SIZE) + return -EINVAL; + + /* add property string to monitor buffer */ + l = util_strpcpyl(&s, l, key, "=", udev_list_entry_get_value(list_entry), NULL); + if (l == 0) + return -EINVAL; + /* advance past the trailing '\0' that util_strpcpyl() guarantees */ + s++; + l--; + } + udev_device->envp[i] = NULL; + udev_device->monitor_buf_len = s - udev_device->monitor_buf; + udev_device->envp_uptodate = true; + dbg(udev_device->udev, "filled envp/monitor buffer, %u properties, %zu bytes\n", + i, udev_device->monitor_buf_len); + return 0; } char **udev_device_get_properties_envp(struct udev_device *udev_device) { - if (!udev_device->envp_uptodate) - if (update_envp_monitor_buf(udev_device) != 0) - return NULL; - return udev_device->envp; + if (!udev_device->envp_uptodate) + if (update_envp_monitor_buf(udev_device) != 0) + return NULL; + return udev_device->envp; } ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf) { - if (!udev_device->envp_uptodate) - if (update_envp_monitor_buf(udev_device) != 0) - return -EINVAL; - *buf = udev_device->monitor_buf; - return udev_device->monitor_buf_len; + if (!udev_device->envp_uptodate) + if (update_envp_monitor_buf(udev_device) != 0) + return -EINVAL; + *buf = udev_device->monitor_buf; + return udev_device->monitor_buf_len; } int udev_device_set_action(struct udev_device *udev_device, const char *action) { - free(udev_device->action); - udev_device->action = strdup(action); - if (udev_device->action == NULL) - return -ENOMEM; - udev_device_add_property(udev_device, "ACTION", udev_device->action); - return 0; + free(udev_device->action); + udev_device->action = strdup(action); + if (udev_device->action == NULL) + return -ENOMEM; + udev_device_add_property(udev_device, "ACTION", udev_device->action); + return 0; } int udev_device_get_devlink_priority(struct udev_device *udev_device) { - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_device->devlink_priority; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_device->devlink_priority; } int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio) { - udev_device->devlink_priority = prio; - return 0; + udev_device->devlink_priority = prio; + return 0; } int udev_device_get_watch_handle(struct udev_device *udev_device) { - if (!udev_device->info_loaded) - udev_device_read_db(udev_device, NULL); - return udev_device->watch_handle; + if (!udev_device->info_loaded) + udev_device_read_db(udev_device, NULL); + return udev_device->watch_handle; } int udev_device_set_watch_handle(struct udev_device *udev_device, int handle) { - udev_device->watch_handle = handle; - return 0; + udev_device->watch_handle = handle; + return 0; } bool udev_device_get_db_persist(struct udev_device *udev_device) { - return udev_device->db_persist; + return udev_device->db_persist; } void udev_device_set_db_persist(struct udev_device *udev_device) { - udev_device->db_persist = true; + udev_device->db_persist = true; } diff --git a/src/libudev-enumerate.c b/src/libudev-enumerate.c index f14d5c8f57..9a572ef050 100644 --- a/src/libudev-enumerate.c +++ b/src/libudev-enumerate.c @@ -33,8 +33,8 @@ */ struct syspath { - char *syspath; - size_t len; + char *syspath; + size_t len; }; /** @@ -43,22 +43,22 @@ struct syspath { * Opaque object representing one device lookup/sort context. */ struct udev_enumerate { - struct udev *udev; - int refcount; - struct udev_list sysattr_match_list; - struct udev_list sysattr_nomatch_list; - struct udev_list subsystem_match_list; - struct udev_list subsystem_nomatch_list; - struct udev_list sysname_match_list; - struct udev_list properties_match_list; - struct udev_list tags_match_list; - struct udev_device *parent_match; - struct udev_list devices_list; - struct syspath *devices; - unsigned int devices_cur; - unsigned int devices_max; - bool devices_uptodate:1; - bool match_is_initialized; + struct udev *udev; + int refcount; + struct udev_list sysattr_match_list; + struct udev_list sysattr_nomatch_list; + struct udev_list subsystem_match_list; + struct udev_list subsystem_nomatch_list; + struct udev_list sysname_match_list; + struct udev_list properties_match_list; + struct udev_list tags_match_list; + struct udev_device *parent_match; + struct udev_list devices_list; + struct syspath *devices; + unsigned int devices_cur; + unsigned int devices_max; + bool devices_uptodate:1; + bool match_is_initialized; }; /** @@ -69,22 +69,22 @@ struct udev_enumerate { **/ UDEV_EXPORT struct udev_enumerate *udev_enumerate_new(struct udev *udev) { - struct udev_enumerate *udev_enumerate; + struct udev_enumerate *udev_enumerate; - udev_enumerate = calloc(1, sizeof(struct udev_enumerate)); - if (udev_enumerate == NULL) - return NULL; - udev_enumerate->refcount = 1; - udev_enumerate->udev = udev; - udev_list_init(udev, &udev_enumerate->sysattr_match_list, false); - udev_list_init(udev, &udev_enumerate->sysattr_nomatch_list, false); - udev_list_init(udev, &udev_enumerate->subsystem_match_list, true); - udev_list_init(udev, &udev_enumerate->subsystem_nomatch_list, true); - udev_list_init(udev, &udev_enumerate->sysname_match_list, true); - udev_list_init(udev, &udev_enumerate->properties_match_list, false); - udev_list_init(udev, &udev_enumerate->tags_match_list, true); - udev_list_init(udev, &udev_enumerate->devices_list, false); - return udev_enumerate; + udev_enumerate = calloc(1, sizeof(struct udev_enumerate)); + if (udev_enumerate == NULL) + return NULL; + udev_enumerate->refcount = 1; + udev_enumerate->udev = udev; + udev_list_init(udev, &udev_enumerate->sysattr_match_list, false); + udev_list_init(udev, &udev_enumerate->sysattr_nomatch_list, false); + udev_list_init(udev, &udev_enumerate->subsystem_match_list, true); + udev_list_init(udev, &udev_enumerate->subsystem_nomatch_list, true); + udev_list_init(udev, &udev_enumerate->sysname_match_list, true); + udev_list_init(udev, &udev_enumerate->properties_match_list, false); + udev_list_init(udev, &udev_enumerate->tags_match_list, true); + udev_list_init(udev, &udev_enumerate->devices_list, false); + return udev_enumerate; } /** @@ -97,10 +97,10 @@ UDEV_EXPORT struct udev_enumerate *udev_enumerate_new(struct udev *udev) **/ UDEV_EXPORT struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *udev_enumerate) { - if (udev_enumerate == NULL) - return NULL; - udev_enumerate->refcount++; - return udev_enumerate; + if (udev_enumerate == NULL) + return NULL; + udev_enumerate->refcount++; + return udev_enumerate; } /** @@ -112,26 +112,26 @@ UDEV_EXPORT struct udev_enumerate *udev_enumerate_ref(struct udev_enumerate *ude **/ UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) { - unsigned int i; - - if (udev_enumerate == NULL) - return; - udev_enumerate->refcount--; - if (udev_enumerate->refcount > 0) - return; - udev_list_cleanup(&udev_enumerate->sysattr_match_list); - udev_list_cleanup(&udev_enumerate->sysattr_nomatch_list); - udev_list_cleanup(&udev_enumerate->subsystem_match_list); - udev_list_cleanup(&udev_enumerate->subsystem_nomatch_list); - udev_list_cleanup(&udev_enumerate->sysname_match_list); - udev_list_cleanup(&udev_enumerate->properties_match_list); - udev_list_cleanup(&udev_enumerate->tags_match_list); - udev_device_unref(udev_enumerate->parent_match); - udev_list_cleanup(&udev_enumerate->devices_list); - for (i = 0; i < udev_enumerate->devices_cur; i++) - free(udev_enumerate->devices[i].syspath); - free(udev_enumerate->devices); - free(udev_enumerate); + unsigned int i; + + if (udev_enumerate == NULL) + return; + udev_enumerate->refcount--; + if (udev_enumerate->refcount > 0) + return; + udev_list_cleanup(&udev_enumerate->sysattr_match_list); + udev_list_cleanup(&udev_enumerate->sysattr_nomatch_list); + udev_list_cleanup(&udev_enumerate->subsystem_match_list); + udev_list_cleanup(&udev_enumerate->subsystem_nomatch_list); + udev_list_cleanup(&udev_enumerate->sysname_match_list); + udev_list_cleanup(&udev_enumerate->properties_match_list); + udev_list_cleanup(&udev_enumerate->tags_match_list); + udev_device_unref(udev_enumerate->parent_match); + udev_list_cleanup(&udev_enumerate->devices_list); + for (i = 0; i < udev_enumerate->devices_cur; i++) + free(udev_enumerate->devices[i].syspath); + free(udev_enumerate->devices); + free(udev_enumerate); } /** @@ -142,79 +142,79 @@ UDEV_EXPORT void udev_enumerate_unref(struct udev_enumerate *udev_enumerate) */ UDEV_EXPORT struct udev *udev_enumerate_get_udev(struct udev_enumerate *udev_enumerate) { - if (udev_enumerate == NULL) - return NULL; - return udev_enumerate->udev; + if (udev_enumerate == NULL) + return NULL; + return udev_enumerate->udev; } static int syspath_add(struct udev_enumerate *udev_enumerate, const char *syspath) { - char *path; - struct syspath *entry; - - /* double array size if needed */ - if (udev_enumerate->devices_cur >= udev_enumerate->devices_max) { - struct syspath *buf; - unsigned int add; - - add = udev_enumerate->devices_max; - if (add < 1024) - add = 1024; - buf = realloc(udev_enumerate->devices, (udev_enumerate->devices_max + add) * sizeof(struct syspath)); - if (buf == NULL) - return -ENOMEM; - udev_enumerate->devices = buf; - udev_enumerate->devices_max += add; - } - - path = strdup(syspath); - if (path == NULL) - return -ENOMEM; - entry = &udev_enumerate->devices[udev_enumerate->devices_cur]; - entry->syspath = path; - entry->len = strlen(path); - udev_enumerate->devices_cur++; - udev_enumerate->devices_uptodate = false; - return 0; + char *path; + struct syspath *entry; + + /* double array size if needed */ + if (udev_enumerate->devices_cur >= udev_enumerate->devices_max) { + struct syspath *buf; + unsigned int add; + + add = udev_enumerate->devices_max; + if (add < 1024) + add = 1024; + buf = realloc(udev_enumerate->devices, (udev_enumerate->devices_max + add) * sizeof(struct syspath)); + if (buf == NULL) + return -ENOMEM; + udev_enumerate->devices = buf; + udev_enumerate->devices_max += add; + } + + path = strdup(syspath); + if (path == NULL) + return -ENOMEM; + entry = &udev_enumerate->devices[udev_enumerate->devices_cur]; + entry->syspath = path; + entry->len = strlen(path); + udev_enumerate->devices_cur++; + udev_enumerate->devices_uptodate = false; + return 0; } static int syspath_cmp(const void *p1, const void *p2) { - const struct syspath *path1 = p1; - const struct syspath *path2 = p2; - size_t len; - int ret; + const struct syspath *path1 = p1; + const struct syspath *path2 = p2; + size_t len; + int ret; - len = MIN(path1->len, path2->len); - ret = memcmp(path1->syspath, path2->syspath, len); - if (ret == 0) { - if (path1->len < path2->len) - ret = -1; - else if (path1->len > path2->len) - ret = 1; - } - return ret; + len = MIN(path1->len, path2->len); + ret = memcmp(path1->syspath, path2->syspath, len); + if (ret == 0) { + if (path1->len < path2->len) + ret = -1; + else if (path1->len > path2->len) + ret = 1; + } + return ret; } /* For devices that should be moved to the absolute end of the list */ static bool devices_delay_end(struct udev *udev, const char *syspath) { - static const char *delay_device_list[] = { - "/block/md", - "/block/dm-", - NULL - }; - size_t len; - int i; + static const char *delay_device_list[] = { + "/block/md", + "/block/dm-", + NULL + }; + size_t len; + int i; - len = strlen(udev_get_sys_path(udev)); - for (i = 0; delay_device_list[i] != NULL; i++) { - if (strstr(&syspath[len], delay_device_list[i]) != NULL) { - dbg(udev, "delaying: %s\n", syspath); - return true; - } - } - return false; + len = strlen(udev_get_sys_path(udev)); + for (i = 0; delay_device_list[i] != NULL; i++) { + if (strstr(&syspath[len], delay_device_list[i]) != NULL) { + dbg(udev, "delaying: %s\n", syspath); + return true; + } + } + return false; } /* For devices that should just be moved a little bit later, just @@ -222,25 +222,25 @@ static bool devices_delay_end(struct udev *udev, const char *syspath) * number of characters that make up that common prefix */ static size_t devices_delay_later(struct udev *udev, const char *syspath) { - const char *c; + const char *c; - /* For sound cards the control device must be enumerated last - * to make sure it's the final device node that gets ACLs - * applied. Applications rely on this fact and use ACL changes - * on the control node as an indicator that the ACL change of - * the entire sound card completed. The kernel makes this - * guarantee when creating those devices, and hence we should - * too when enumerating them. */ + /* For sound cards the control device must be enumerated last + * to make sure it's the final device node that gets ACLs + * applied. Applications rely on this fact and use ACL changes + * on the control node as an indicator that the ACL change of + * the entire sound card completed. The kernel makes this + * guarantee when creating those devices, and hence we should + * too when enumerating them. */ - if ((c = strstr(syspath, "/sound/card"))) { - c += 11; - c += strcspn(c, "/"); + if ((c = strstr(syspath, "/sound/card"))) { + c += 11; + c += strcspn(c, "/"); - if (strncmp(c, "/controlC", 9) == 0) - return c - syspath + 1; - } + if (strncmp(c, "/controlC", 9) == 0) + return c - syspath + 1; + } - return 0; + return 0; } /** @@ -251,73 +251,73 @@ static size_t devices_delay_later(struct udev *udev, const char *syspath) */ UDEV_EXPORT struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_enumerate *udev_enumerate) { - if (udev_enumerate == NULL) - return NULL; - if (!udev_enumerate->devices_uptodate) { - unsigned int i; - unsigned int max; - struct syspath *prev = NULL, *move_later = NULL; - size_t move_later_prefix = 0; - - udev_list_cleanup(&udev_enumerate->devices_list); - qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); - - max = udev_enumerate->devices_cur; - for (i = 0; i < max; i++) { - struct syspath *entry = &udev_enumerate->devices[i]; - - /* skip duplicated entries */ - if (prev != NULL && - entry->len == prev->len && - memcmp(entry->syspath, prev->syspath, entry->len) == 0) - continue; - prev = entry; - - /* skip to be delayed devices, and add them to the end of the list */ - if (devices_delay_end(udev_enumerate->udev, entry->syspath)) { - syspath_add(udev_enumerate, entry->syspath); - /* need to update prev here for the case realloc() gives a different address */ - prev = &udev_enumerate->devices[i]; - continue; - } - - /* skip to be delayed devices, and move the to - * the point where the prefix changes. We can - * only move one item at a time. */ - if (!move_later) { - move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath); - - if (move_later_prefix > 0) { - move_later = entry; - continue; - } - } - - if (move_later && - strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) { - - udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); - move_later = NULL; - } - - udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); - } - - if (move_later) - udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); - - /* add and cleanup delayed devices from end of list */ - for (i = max; i < udev_enumerate->devices_cur; i++) { - struct syspath *entry = &udev_enumerate->devices[i]; - - udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); - free(entry->syspath); - } - udev_enumerate->devices_cur = max; - - udev_enumerate->devices_uptodate = true; - } - return udev_list_get_entry(&udev_enumerate->devices_list); + if (udev_enumerate == NULL) + return NULL; + if (!udev_enumerate->devices_uptodate) { + unsigned int i; + unsigned int max; + struct syspath *prev = NULL, *move_later = NULL; + size_t move_later_prefix = 0; + + udev_list_cleanup(&udev_enumerate->devices_list); + qsort(udev_enumerate->devices, udev_enumerate->devices_cur, sizeof(struct syspath), syspath_cmp); + + max = udev_enumerate->devices_cur; + for (i = 0; i < max; i++) { + struct syspath *entry = &udev_enumerate->devices[i]; + + /* skip duplicated entries */ + if (prev != NULL && + entry->len == prev->len && + memcmp(entry->syspath, prev->syspath, entry->len) == 0) + continue; + prev = entry; + + /* skip to be delayed devices, and add them to the end of the list */ + if (devices_delay_end(udev_enumerate->udev, entry->syspath)) { + syspath_add(udev_enumerate, entry->syspath); + /* need to update prev here for the case realloc() gives a different address */ + prev = &udev_enumerate->devices[i]; + continue; + } + + /* skip to be delayed devices, and move the to + * the point where the prefix changes. We can + * only move one item at a time. */ + if (!move_later) { + move_later_prefix = devices_delay_later(udev_enumerate->udev, entry->syspath); + + if (move_later_prefix > 0) { + move_later = entry; + continue; + } + } + + if (move_later && + strncmp(entry->syspath, move_later->syspath, move_later_prefix) != 0) { + + udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); + move_later = NULL; + } + + udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); + } + + if (move_later) + udev_list_entry_add(&udev_enumerate->devices_list, move_later->syspath, NULL); + + /* add and cleanup delayed devices from end of list */ + for (i = max; i < udev_enumerate->devices_cur; i++) { + struct syspath *entry = &udev_enumerate->devices[i]; + + udev_list_entry_add(&udev_enumerate->devices_list, entry->syspath, NULL); + free(entry->syspath); + } + udev_enumerate->devices_cur = max; + + udev_enumerate->devices_uptodate = true; + } + return udev_list_get_entry(&udev_enumerate->devices_list); } /** @@ -329,13 +329,13 @@ UDEV_EXPORT struct udev_list_entry *udev_enumerate_get_list_entry(struct udev_en */ UDEV_EXPORT int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { - if (udev_enumerate == NULL) - return -EINVAL; - if (subsystem == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->subsystem_match_list, subsystem, NULL) == NULL) - return -ENOMEM; - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + if (subsystem == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->subsystem_match_list, subsystem, NULL) == NULL) + return -ENOMEM; + return 0; } /** @@ -347,13 +347,13 @@ UDEV_EXPORT int udev_enumerate_add_match_subsystem(struct udev_enumerate *udev_e */ UDEV_EXPORT int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { - if (udev_enumerate == NULL) - return -EINVAL; - if (subsystem == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->subsystem_nomatch_list, subsystem, NULL) == NULL) - return -ENOMEM; - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + if (subsystem == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->subsystem_nomatch_list, subsystem, NULL) == NULL) + return -ENOMEM; + return 0; } /** @@ -366,13 +366,13 @@ UDEV_EXPORT int udev_enumerate_add_nomatch_subsystem(struct udev_enumerate *udev */ UDEV_EXPORT int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { - if (udev_enumerate == NULL) - return -EINVAL; - if (sysattr == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->sysattr_match_list, sysattr, value) == NULL) - return -ENOMEM; - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + if (sysattr == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->sysattr_match_list, sysattr, value) == NULL) + return -ENOMEM; + return 0; } /** @@ -385,33 +385,33 @@ UDEV_EXPORT int udev_enumerate_add_match_sysattr(struct udev_enumerate *udev_enu */ UDEV_EXPORT int udev_enumerate_add_nomatch_sysattr(struct udev_enumerate *udev_enumerate, const char *sysattr, const char *value) { - if (udev_enumerate == NULL) - return -EINVAL; - if (sysattr == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->sysattr_nomatch_list, sysattr, value) == NULL) - return -ENOMEM; - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + if (sysattr == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->sysattr_nomatch_list, sysattr, value) == NULL) + return -ENOMEM; + return 0; } static int match_sysattr_value(struct udev_device *dev, const char *sysattr, const char *match_val) { - const char *val = NULL; - bool match = false; - - val = udev_device_get_sysattr_value(dev, sysattr); - if (val == NULL) - goto exit; - if (match_val == NULL) { - match = true; - goto exit; - } - if (fnmatch(match_val, val, 0) == 0) { - match = true; - goto exit; - } + const char *val = NULL; + bool match = false; + + val = udev_device_get_sysattr_value(dev, sysattr); + if (val == NULL) + goto exit; + if (match_val == NULL) { + match = true; + goto exit; + } + if (fnmatch(match_val, val, 0) == 0) { + match = true; + goto exit; + } exit: - return match; + return match; } /** @@ -424,13 +424,13 @@ exit: */ UDEV_EXPORT int udev_enumerate_add_match_property(struct udev_enumerate *udev_enumerate, const char *property, const char *value) { - if (udev_enumerate == NULL) - return -EINVAL; - if (property == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->properties_match_list, property, value) == NULL) - return -ENOMEM; - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + if (property == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->properties_match_list, property, value) == NULL) + return -ENOMEM; + return 0; } /** @@ -442,13 +442,13 @@ UDEV_EXPORT int udev_enumerate_add_match_property(struct udev_enumerate *udev_en */ UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumerate, const char *tag) { - if (udev_enumerate == NULL) - return -EINVAL; - if (tag == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->tags_match_list, tag, NULL) == NULL) - return -ENOMEM; - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + if (tag == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->tags_match_list, tag, NULL) == NULL) + return -ENOMEM; + return 0; } /** @@ -466,14 +466,14 @@ UDEV_EXPORT int udev_enumerate_add_match_tag(struct udev_enumerate *udev_enumera */ UDEV_EXPORT int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *parent) { - if (udev_enumerate == NULL) - return -EINVAL; - if (parent == NULL) - return 0; - if (udev_enumerate->parent_match != NULL) - udev_device_unref(udev_enumerate->parent_match); - udev_enumerate->parent_match = udev_device_ref(parent); - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + if (parent == NULL) + return 0; + if (udev_enumerate->parent_match != NULL) + udev_device_unref(udev_enumerate->parent_match); + udev_enumerate->parent_match = udev_device_ref(parent); + return 0; } /** @@ -496,10 +496,10 @@ UDEV_EXPORT int udev_enumerate_add_match_parent(struct udev_enumerate *udev_enum */ UDEV_EXPORT int udev_enumerate_add_match_is_initialized(struct udev_enumerate *udev_enumerate) { - if (udev_enumerate == NULL) - return -EINVAL; - udev_enumerate->match_is_initialized = true; - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + udev_enumerate->match_is_initialized = true; + return 0; } /** @@ -511,223 +511,223 @@ UDEV_EXPORT int udev_enumerate_add_match_is_initialized(struct udev_enumerate *u */ UDEV_EXPORT int udev_enumerate_add_match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) { - if (udev_enumerate == NULL) - return -EINVAL; - if (sysname == NULL) - return 0; - if (udev_list_entry_add(&udev_enumerate->sysname_match_list, sysname, NULL) == NULL) - return -ENOMEM; - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + if (sysname == NULL) + return 0; + if (udev_list_entry_add(&udev_enumerate->sysname_match_list, sysname, NULL) == NULL) + return -ENOMEM; + return 0; } static bool match_sysattr(struct udev_enumerate *udev_enumerate, struct udev_device *dev) { - struct udev_list_entry *list_entry; - - /* skip list */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_nomatch_list)) { - if (match_sysattr_value(dev, udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry))) - return false; - } - /* include list */ - if (udev_list_get_entry(&udev_enumerate->sysattr_match_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_match_list)) { - /* anything that does not match, will make it FALSE */ - if (!match_sysattr_value(dev, udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry))) - return false; - } - return true; - } - return true; + struct udev_list_entry *list_entry; + + /* skip list */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_nomatch_list)) { + if (match_sysattr_value(dev, udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return false; + } + /* include list */ + if (udev_list_get_entry(&udev_enumerate->sysattr_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysattr_match_list)) { + /* anything that does not match, will make it FALSE */ + if (!match_sysattr_value(dev, udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry))) + return false; + } + return true; + } + return true; } static bool match_property(struct udev_enumerate *udev_enumerate, struct udev_device *dev) { - struct udev_list_entry *list_entry; - bool match = false; - - /* no match always matches */ - if (udev_list_get_entry(&udev_enumerate->properties_match_list) == NULL) - return true; - - /* loop over matches */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) { - const char *match_key = udev_list_entry_get_name(list_entry); - const char *match_value = udev_list_entry_get_value(list_entry); - struct udev_list_entry *property_entry; - - /* loop over device properties */ - udev_list_entry_foreach(property_entry, udev_device_get_properties_list_entry(dev)) { - const char *dev_key = udev_list_entry_get_name(property_entry); - const char *dev_value = udev_list_entry_get_value(property_entry); - - if (fnmatch(match_key, dev_key, 0) != 0) - continue; - if (match_value == NULL && dev_value == NULL) { - match = true; - goto out; - } - if (match_value == NULL || dev_value == NULL) - continue; - if (fnmatch(match_value, dev_value, 0) == 0) { - match = true; - goto out; - } - } - } + struct udev_list_entry *list_entry; + bool match = false; + + /* no match always matches */ + if (udev_list_get_entry(&udev_enumerate->properties_match_list) == NULL) + return true; + + /* loop over matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->properties_match_list)) { + const char *match_key = udev_list_entry_get_name(list_entry); + const char *match_value = udev_list_entry_get_value(list_entry); + struct udev_list_entry *property_entry; + + /* loop over device properties */ + udev_list_entry_foreach(property_entry, udev_device_get_properties_list_entry(dev)) { + const char *dev_key = udev_list_entry_get_name(property_entry); + const char *dev_value = udev_list_entry_get_value(property_entry); + + if (fnmatch(match_key, dev_key, 0) != 0) + continue; + if (match_value == NULL && dev_value == NULL) { + match = true; + goto out; + } + if (match_value == NULL || dev_value == NULL) + continue; + if (fnmatch(match_value, dev_value, 0) == 0) { + match = true; + goto out; + } + } + } out: - return match; + return match; } static bool match_tag(struct udev_enumerate *udev_enumerate, struct udev_device *dev) { - struct udev_list_entry *list_entry; + struct udev_list_entry *list_entry; - /* no match always matches */ - if (udev_list_get_entry(&udev_enumerate->tags_match_list) == NULL) - return true; + /* no match always matches */ + if (udev_list_get_entry(&udev_enumerate->tags_match_list) == NULL) + return true; - /* loop over matches */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) - if (!udev_device_has_tag(dev, udev_list_entry_get_name(list_entry))) - return false; + /* loop over matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) + if (!udev_device_has_tag(dev, udev_list_entry_get_name(list_entry))) + return false; - return true; + return true; } static bool match_parent(struct udev_enumerate *udev_enumerate, struct udev_device *dev) { - const char *parent; + const char *parent; - if (udev_enumerate->parent_match == NULL) - return true; + if (udev_enumerate->parent_match == NULL) + return true; - parent = udev_device_get_devpath(udev_enumerate->parent_match); - return strncmp(parent, udev_device_get_devpath(dev), strlen(parent)) == 0; + parent = udev_device_get_devpath(udev_enumerate->parent_match); + return strncmp(parent, udev_device_get_devpath(dev), strlen(parent)) == 0; } static bool match_sysname(struct udev_enumerate *udev_enumerate, const char *sysname) { - struct udev_list_entry *list_entry; + struct udev_list_entry *list_entry; - if (udev_list_get_entry(&udev_enumerate->sysname_match_list) == NULL) - return true; + if (udev_list_get_entry(&udev_enumerate->sysname_match_list) == NULL) + return true; - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysname_match_list)) { - if (fnmatch(udev_list_entry_get_name(list_entry), sysname, 0) != 0) - continue; - return true; - } - return false; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->sysname_match_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), sysname, 0) != 0) + continue; + return true; + } + return false; } static int scan_dir_and_add_devices(struct udev_enumerate *udev_enumerate, - const char *basedir, const char *subdir1, const char *subdir2) -{ - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char path[UTIL_PATH_SIZE]; - size_t l; - char *s; - DIR *dir; - struct dirent *dent; - - s = path; - l = util_strpcpyl(&s, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); - if (subdir1 != NULL) - l = util_strpcpyl(&s, l, "/", subdir1, NULL); - if (subdir2 != NULL) - util_strpcpyl(&s, l, "/", subdir2, NULL); - dir = opendir(path); - if (dir == NULL) - return -ENOENT; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char syspath[UTIL_PATH_SIZE]; - struct udev_device *dev; - - if (dent->d_name[0] == '.') - continue; - - if (!match_sysname(udev_enumerate, dent->d_name)) - continue; - - util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); - dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); - if (dev == NULL) - continue; - - if (udev_enumerate->match_is_initialized) { - /* - * All devices with a device node or network interfaces - * possibly need udev to adjust the device node permission - * or context, or rename the interface before it can be - * reliably used from other processes. - * - * For now, we can only check these types of devices, we - * might not store a database, and have no way to find out - * for all other types of devices. - */ - if (!udev_device_get_is_initialized(dev) && - (major(udev_device_get_devnum(dev)) > 0 || udev_device_get_ifindex(dev) > 0)) - goto nomatch; - } - if (!match_parent(udev_enumerate, dev)) - goto nomatch; - if (!match_tag(udev_enumerate, dev)) - goto nomatch; - if (!match_property(udev_enumerate, dev)) - goto nomatch; - if (!match_sysattr(udev_enumerate, dev)) - goto nomatch; - - syspath_add(udev_enumerate, udev_device_get_syspath(dev)); + const char *basedir, const char *subdir1, const char *subdir2) +{ + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char path[UTIL_PATH_SIZE]; + size_t l; + char *s; + DIR *dir; + struct dirent *dent; + + s = path; + l = util_strpcpyl(&s, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); + if (subdir1 != NULL) + l = util_strpcpyl(&s, l, "/", subdir1, NULL); + if (subdir2 != NULL) + util_strpcpyl(&s, l, "/", subdir2, NULL); + dir = opendir(path); + if (dir == NULL) + return -ENOENT; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char syspath[UTIL_PATH_SIZE]; + struct udev_device *dev; + + if (dent->d_name[0] == '.') + continue; + + if (!match_sysname(udev_enumerate, dent->d_name)) + continue; + + util_strscpyl(syspath, sizeof(syspath), path, "/", dent->d_name, NULL); + dev = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (dev == NULL) + continue; + + if (udev_enumerate->match_is_initialized) { + /* + * All devices with a device node or network interfaces + * possibly need udev to adjust the device node permission + * or context, or rename the interface before it can be + * reliably used from other processes. + * + * For now, we can only check these types of devices, we + * might not store a database, and have no way to find out + * for all other types of devices. + */ + if (!udev_device_get_is_initialized(dev) && + (major(udev_device_get_devnum(dev)) > 0 || udev_device_get_ifindex(dev) > 0)) + goto nomatch; + } + if (!match_parent(udev_enumerate, dev)) + goto nomatch; + if (!match_tag(udev_enumerate, dev)) + goto nomatch; + if (!match_property(udev_enumerate, dev)) + goto nomatch; + if (!match_sysattr(udev_enumerate, dev)) + goto nomatch; + + syspath_add(udev_enumerate, udev_device_get_syspath(dev)); nomatch: - udev_device_unref(dev); - } - closedir(dir); - return 0; + udev_device_unref(dev); + } + closedir(dir); + return 0; } static bool match_subsystem(struct udev_enumerate *udev_enumerate, const char *subsystem) { - struct udev_list_entry *list_entry; + struct udev_list_entry *list_entry; - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { - if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) - return false; - } - if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) { - if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) - return true; - } - return false; - } - return true; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_nomatch_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) + return false; + } + if (udev_list_get_entry(&udev_enumerate->subsystem_match_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->subsystem_match_list)) { + if (fnmatch(udev_list_entry_get_name(list_entry), subsystem, 0) == 0) + return true; + } + return false; + } + return true; } static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, const char *subdir, const char *subsystem) { - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char path[UTIL_PATH_SIZE]; - DIR *dir; - struct dirent *dent; + char path[UTIL_PATH_SIZE]; + DIR *dir; + struct dirent *dent; - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); - dir = opendir(path); - if (dir == NULL) - return -1; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - if (dent->d_name[0] == '.') - continue; - if (!match_subsystem(udev_enumerate, subsystem != NULL ? subsystem : dent->d_name)) - continue; - scan_dir_and_add_devices(udev_enumerate, basedir, dent->d_name, subdir); - } - closedir(dir); - return 0; + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), "/", basedir, NULL); + dir = opendir(path); + if (dir == NULL) + return -1; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + if (!match_subsystem(udev_enumerate, subsystem != NULL ? subsystem : dent->d_name)) + continue; + scan_dir_and_add_devices(udev_enumerate, basedir, dent->d_name, subdir); + } + closedir(dir); + return 0; } /** @@ -741,144 +741,144 @@ static int scan_dir(struct udev_enumerate *udev_enumerate, const char *basedir, */ UDEV_EXPORT int udev_enumerate_add_syspath(struct udev_enumerate *udev_enumerate, const char *syspath) { - struct udev_device *udev_device; + struct udev_device *udev_device; - if (udev_enumerate == NULL) - return -EINVAL; - if (syspath == NULL) - return 0; - /* resolve to real syspath */ - udev_device = udev_device_new_from_syspath(udev_enumerate->udev, syspath); - if (udev_device == NULL) - return -EINVAL; - syspath_add(udev_enumerate, udev_device_get_syspath(udev_device)); - udev_device_unref(udev_device); - return 0; + if (udev_enumerate == NULL) + return -EINVAL; + if (syspath == NULL) + return 0; + /* resolve to real syspath */ + udev_device = udev_device_new_from_syspath(udev_enumerate->udev, syspath); + if (udev_device == NULL) + return -EINVAL; + syspath_add(udev_enumerate, udev_device_get_syspath(udev_device)); + udev_device_unref(udev_device); + return 0; } static int scan_devices_tags(struct udev_enumerate *udev_enumerate) { - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - struct udev_list_entry *list_entry; - - /* scan only tagged devices, use tags reverse-index, instead of searching all devices in /sys */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) { - DIR *dir; - struct dirent *dent; - char path[UTIL_PATH_SIZE]; - - util_strscpyl(path, sizeof(path), udev_get_run_path(udev), "/tags/", - udev_list_entry_get_name(list_entry), NULL); - dir = opendir(path); - if (dir == NULL) - continue; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct udev_device *dev; - - if (dent->d_name[0] == '.') - continue; - - dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); - if (dev == NULL) - continue; - - if (!match_subsystem(udev_enumerate, udev_device_get_subsystem(dev))) - goto nomatch; - if (!match_sysname(udev_enumerate, udev_device_get_sysname(dev))) - goto nomatch; - if (!match_parent(udev_enumerate, dev)) - goto nomatch; - if (!match_property(udev_enumerate, dev)) - goto nomatch; - if (!match_sysattr(udev_enumerate, dev)) - goto nomatch; - - syspath_add(udev_enumerate, udev_device_get_syspath(dev)); + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_list_entry *list_entry; + + /* scan only tagged devices, use tags reverse-index, instead of searching all devices in /sys */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_enumerate->tags_match_list)) { + DIR *dir; + struct dirent *dent; + char path[UTIL_PATH_SIZE]; + + util_strscpyl(path, sizeof(path), udev_get_run_path(udev), "/tags/", + udev_list_entry_get_name(list_entry), NULL); + dir = opendir(path); + if (dir == NULL) + continue; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct udev_device *dev; + + if (dent->d_name[0] == '.') + continue; + + dev = udev_device_new_from_id_filename(udev_enumerate->udev, dent->d_name); + if (dev == NULL) + continue; + + if (!match_subsystem(udev_enumerate, udev_device_get_subsystem(dev))) + goto nomatch; + if (!match_sysname(udev_enumerate, udev_device_get_sysname(dev))) + goto nomatch; + if (!match_parent(udev_enumerate, dev)) + goto nomatch; + if (!match_property(udev_enumerate, dev)) + goto nomatch; + if (!match_sysattr(udev_enumerate, dev)) + goto nomatch; + + syspath_add(udev_enumerate, udev_device_get_syspath(dev)); nomatch: - udev_device_unref(dev); - } - closedir(dir); - } - return 0; + udev_device_unref(dev); + } + closedir(dir); + } + return 0; } static int parent_add_child(struct udev_enumerate *enumerate, const char *path) { - struct udev_device *dev; + struct udev_device *dev; - dev = udev_device_new_from_syspath(enumerate->udev, path); - if (dev == NULL) - return -ENODEV; + dev = udev_device_new_from_syspath(enumerate->udev, path); + if (dev == NULL) + return -ENODEV; - if (!match_subsystem(enumerate, udev_device_get_subsystem(dev))) - return 0; - if (!match_sysname(enumerate, udev_device_get_sysname(dev))) - return 0; - if (!match_property(enumerate, dev)) - return 0; - if (!match_sysattr(enumerate, dev)) - return 0; + if (!match_subsystem(enumerate, udev_device_get_subsystem(dev))) + return 0; + if (!match_sysname(enumerate, udev_device_get_sysname(dev))) + return 0; + if (!match_property(enumerate, dev)) + return 0; + if (!match_sysattr(enumerate, dev)) + return 0; - syspath_add(enumerate, udev_device_get_syspath(dev)); - udev_device_unref(dev); - return 1; + syspath_add(enumerate, udev_device_get_syspath(dev)); + udev_device_unref(dev); + return 1; } static int parent_crawl_children(struct udev_enumerate *enumerate, const char *path, int maxdepth) { - DIR *d; - struct dirent *dent; + DIR *d; + struct dirent *dent; - d = opendir(path); - if (d == NULL) - return -errno; + d = opendir(path); + if (d == NULL) + return -errno; - for (dent = readdir(d); dent != NULL; dent = readdir(d)) { - char *child; + for (dent = readdir(d); dent != NULL; dent = readdir(d)) { + char *child; - if (dent->d_name[0] == '.') - continue; - if (dent->d_type != DT_DIR) - continue; - if (asprintf(&child, "%s/%s", path, dent->d_name) < 0) - continue; - parent_add_child(enumerate, child); - if (maxdepth > 0) - parent_crawl_children(enumerate, child, maxdepth-1); - free(child); - } + if (dent->d_name[0] == '.') + continue; + if (dent->d_type != DT_DIR) + continue; + if (asprintf(&child, "%s/%s", path, dent->d_name) < 0) + continue; + parent_add_child(enumerate, child); + if (maxdepth > 0) + parent_crawl_children(enumerate, child, maxdepth-1); + free(child); + } - closedir(d); - return 0; + closedir(d); + return 0; } static int scan_devices_children(struct udev_enumerate *enumerate) { - const char *path; + const char *path; - path = udev_device_get_syspath(enumerate->parent_match); - parent_add_child(enumerate, path); - return parent_crawl_children(enumerate, path, 256); + path = udev_device_get_syspath(enumerate->parent_match); + parent_add_child(enumerate, path); + return parent_crawl_children(enumerate, path, 256); } static int scan_devices_all(struct udev_enumerate *udev_enumerate) { - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char base[UTIL_PATH_SIZE]; - struct stat statbuf; + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char base[UTIL_PATH_SIZE]; + struct stat statbuf; - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); - if (stat(base, &statbuf) == 0) { - /* we have /subsystem/, forget all the old stuff */ - dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "subsystem", "devices", NULL); - } else { - dbg(udev, "searching '/bus/*/devices/*' dir\n"); - scan_dir(udev_enumerate, "bus", "devices", NULL); - dbg(udev, "searching '/class/*' dir\n"); - scan_dir(udev_enumerate, "class", NULL, NULL); - } - return 0; + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); + if (stat(base, &statbuf) == 0) { + /* we have /subsystem/, forget all the old stuff */ + dbg(udev, "searching '/subsystem/*/devices/*' dir\n"); + scan_dir(udev_enumerate, "subsystem", "devices", NULL); + } else { + dbg(udev, "searching '/bus/*/devices/*' dir\n"); + scan_dir(udev_enumerate, "bus", "devices", NULL); + dbg(udev, "searching '/class/*' dir\n"); + scan_dir(udev_enumerate, "class", NULL, NULL); + } + return 0; } /** @@ -889,19 +889,19 @@ static int scan_devices_all(struct udev_enumerate *udev_enumerate) **/ UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerate) { - if (udev_enumerate == NULL) - return -EINVAL; + if (udev_enumerate == NULL) + return -EINVAL; - /* efficiently lookup tags only, we maintain a reverse-index */ - if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) - return scan_devices_tags(udev_enumerate); + /* efficiently lookup tags only, we maintain a reverse-index */ + if (udev_list_get_entry(&udev_enumerate->tags_match_list) != NULL) + return scan_devices_tags(udev_enumerate); - /* walk the subtree of one parent device only */ - if (udev_enumerate->parent_match != NULL) - return scan_devices_children(udev_enumerate); + /* walk the subtree of one parent device only */ + if (udev_enumerate->parent_match != NULL) + return scan_devices_children(udev_enumerate); - /* scan devices of all subsystems */ - return scan_devices_all(udev_enumerate); + /* scan devices of all subsystems */ + return scan_devices_all(udev_enumerate); } /** @@ -912,36 +912,36 @@ UDEV_EXPORT int udev_enumerate_scan_devices(struct udev_enumerate *udev_enumerat **/ UDEV_EXPORT int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enumerate) { - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - char base[UTIL_PATH_SIZE]; - struct stat statbuf; - const char *subsysdir; - - if (udev_enumerate == NULL) - return -EINVAL; - - /* all kernel modules */ - if (match_subsystem(udev_enumerate, "module")) { - dbg(udev, "searching '%s/modules/*' dir\n", subsysdir); - scan_dir_and_add_devices(udev_enumerate, "module", NULL, NULL); - } - - util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); - if (stat(base, &statbuf) == 0) - subsysdir = "subsystem"; - else - subsysdir = "bus"; - - /* all subsystems (only buses support coldplug) */ - if (match_subsystem(udev_enumerate, "subsystem")) { - dbg(udev, "searching '%s/*' dir\n", subsysdir); - scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); - } - - /* all subsystem drivers */ - if (match_subsystem(udev_enumerate, "drivers")) { - dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); - scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); - } - return 0; + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + char base[UTIL_PATH_SIZE]; + struct stat statbuf; + const char *subsysdir; + + if (udev_enumerate == NULL) + return -EINVAL; + + /* all kernel modules */ + if (match_subsystem(udev_enumerate, "module")) { + dbg(udev, "searching '%s/modules/*' dir\n", subsysdir); + scan_dir_and_add_devices(udev_enumerate, "module", NULL, NULL); + } + + util_strscpyl(base, sizeof(base), udev_get_sys_path(udev), "/subsystem", NULL); + if (stat(base, &statbuf) == 0) + subsysdir = "subsystem"; + else + subsysdir = "bus"; + + /* all subsystems (only buses support coldplug) */ + if (match_subsystem(udev_enumerate, "subsystem")) { + dbg(udev, "searching '%s/*' dir\n", subsysdir); + scan_dir_and_add_devices(udev_enumerate, subsysdir, NULL, NULL); + } + + /* all subsystem drivers */ + if (match_subsystem(udev_enumerate, "drivers")) { + dbg(udev, "searching '%s/*/drivers/*' dir\n", subsysdir); + scan_dir(udev_enumerate, subsysdir, "drivers", "drivers"); + } + return 0; } diff --git a/src/libudev-list.c b/src/libudev-list.c index f74a88ca49..4bdef35ae8 100644 --- a/src/libudev-list.c +++ b/src/libudev-list.c @@ -33,232 +33,232 @@ * contains a name, and optionally a value. */ struct udev_list_entry { - struct udev_list_node node; - struct udev_list *list; - char *name; - char *value; - int num; + struct udev_list_node node; + struct udev_list *list; + char *name; + char *value; + int num; }; /* the list's head points to itself if empty */ void udev_list_node_init(struct udev_list_node *list) { - list->next = list; - list->prev = list; + list->next = list; + list->prev = list; } int udev_list_node_is_empty(struct udev_list_node *list) { - return list->next == list; + return list->next == list; } static void udev_list_node_insert_between(struct udev_list_node *new, - struct udev_list_node *prev, - struct udev_list_node *next) + struct udev_list_node *prev, + struct udev_list_node *next) { - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; } void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list) { - udev_list_node_insert_between(new, list->prev, list); + udev_list_node_insert_between(new, list->prev, list); } void udev_list_node_remove(struct udev_list_node *entry) { - struct udev_list_node *prev = entry->prev; - struct udev_list_node *next = entry->next; + struct udev_list_node *prev = entry->prev; + struct udev_list_node *next = entry->next; - next->prev = prev; - prev->next = next; + next->prev = prev; + prev->next = next; - entry->prev = NULL; - entry->next = NULL; + entry->prev = NULL; + entry->next = NULL; } /* return list entry which embeds this node */ static struct udev_list_entry *list_node_to_entry(struct udev_list_node *node) { - char *list; + char *list; - list = (char *)node; - list -= offsetof(struct udev_list_entry, node); - return (struct udev_list_entry *)list; + list = (char *)node; + list -= offsetof(struct udev_list_entry, node); + return (struct udev_list_entry *)list; } void udev_list_init(struct udev *udev, struct udev_list *list, bool unique) { - memset(list, 0x00, sizeof(struct udev_list)); - list->udev = udev; - list->unique = unique; - udev_list_node_init(&list->node); + memset(list, 0x00, sizeof(struct udev_list)); + list->udev = udev; + list->unique = unique; + udev_list_node_init(&list->node); } /* insert entry into a list as the last element */ void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) { - /* inserting before the list head make the node the last node in the list */ - udev_list_node_insert_between(&new->node, list->node.prev, &list->node); - new->list = list; + /* inserting before the list head make the node the last node in the list */ + udev_list_node_insert_between(&new->node, list->node.prev, &list->node); + new->list = list; } /* insert entry into a list, before a given existing entry */ void udev_list_entry_insert_before(struct udev_list_entry *new, struct udev_list_entry *entry) { - udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node); - new->list = entry->list; + udev_list_node_insert_between(&new->node, entry->node.prev, &entry->node); + new->list = entry->list; } /* binary search in sorted array */ static int list_search(struct udev_list *list, const char *name) { - unsigned int first, last; - - first = 0; - last = list->entries_cur; - while (first < last) { - unsigned int i; - int cmp; - - i = (first + last)/2; - cmp = strcmp(name, list->entries[i]->name); - if (cmp < 0) - last = i; - else if (cmp > 0) - first = i+1; - else - return i; - } - - /* not found, return negative insertion-index+1 */ - return -(first+1); + unsigned int first, last; + + first = 0; + last = list->entries_cur; + while (first < last) { + unsigned int i; + int cmp; + + i = (first + last)/2; + cmp = strcmp(name, list->entries[i]->name); + if (cmp < 0) + last = i; + else if (cmp > 0) + first = i+1; + else + return i; + } + + /* not found, return negative insertion-index+1 */ + return -(first+1); } struct udev_list_entry *udev_list_entry_add(struct udev_list *list, const char *name, const char *value) { - struct udev_list_entry *entry; - int i = 0; - - if (list->unique) { - /* lookup existing name or insertion-index */ - i = list_search(list, name); - if (i >= 0) { - entry = list->entries[i]; - - dbg(list->udev, "'%s' is already in the list\n", name); - free(entry->value); - if (value == NULL) { - entry->value = NULL; - dbg(list->udev, "'%s' value unset\n", name); - return entry; - } - entry->value = strdup(value); - if (entry->value == NULL) - return NULL; - dbg(list->udev, "'%s' value replaced with '%s'\n", name, value); - return entry; - } - } - - /* add new name */ - entry = calloc(1, sizeof(struct udev_list_entry)); - if (entry == NULL) - return NULL; - entry->name = strdup(name); - if (entry->name == NULL) { - free(entry); - return NULL; - } - if (value != NULL) { - entry->value = strdup(value); - if (entry->value == NULL) { - free(entry->name); - free(entry); - return NULL; - } - } - - if (list->unique) { - /* allocate or enlarge sorted array if needed */ - if (list->entries_cur >= list->entries_max) { - unsigned int add; - - add = list->entries_max; - if (add < 1) - add = 64; - list->entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *)); - if (list->entries == NULL) { - free(entry->name); - free(entry->value); - return NULL; - } - list->entries_max += add; - } - - /* the negative i returned the insertion index */ - i = (-i)-1; - - /* insert into sorted list */ - if ((unsigned int)i < list->entries_cur) - udev_list_entry_insert_before(entry, list->entries[i]); - else - udev_list_entry_append(entry, list); - - /* insert into sorted array */ - memmove(&list->entries[i+1], &list->entries[i], - (list->entries_cur - i) * sizeof(struct udev_list_entry *)); - list->entries[i] = entry; - list->entries_cur++; - } else { - udev_list_entry_append(entry, list); - } - - dbg(list->udev, "'%s=%s' added\n", entry->name, entry->value); - return entry; + struct udev_list_entry *entry; + int i = 0; + + if (list->unique) { + /* lookup existing name or insertion-index */ + i = list_search(list, name); + if (i >= 0) { + entry = list->entries[i]; + + dbg(list->udev, "'%s' is already in the list\n", name); + free(entry->value); + if (value == NULL) { + entry->value = NULL; + dbg(list->udev, "'%s' value unset\n", name); + return entry; + } + entry->value = strdup(value); + if (entry->value == NULL) + return NULL; + dbg(list->udev, "'%s' value replaced with '%s'\n", name, value); + return entry; + } + } + + /* add new name */ + entry = calloc(1, sizeof(struct udev_list_entry)); + if (entry == NULL) + return NULL; + entry->name = strdup(name); + if (entry->name == NULL) { + free(entry); + return NULL; + } + if (value != NULL) { + entry->value = strdup(value); + if (entry->value == NULL) { + free(entry->name); + free(entry); + return NULL; + } + } + + if (list->unique) { + /* allocate or enlarge sorted array if needed */ + if (list->entries_cur >= list->entries_max) { + unsigned int add; + + add = list->entries_max; + if (add < 1) + add = 64; + list->entries = realloc(list->entries, (list->entries_max + add) * sizeof(struct udev_list_entry *)); + if (list->entries == NULL) { + free(entry->name); + free(entry->value); + return NULL; + } + list->entries_max += add; + } + + /* the negative i returned the insertion index */ + i = (-i)-1; + + /* insert into sorted list */ + if ((unsigned int)i < list->entries_cur) + udev_list_entry_insert_before(entry, list->entries[i]); + else + udev_list_entry_append(entry, list); + + /* insert into sorted array */ + memmove(&list->entries[i+1], &list->entries[i], + (list->entries_cur - i) * sizeof(struct udev_list_entry *)); + list->entries[i] = entry; + list->entries_cur++; + } else { + udev_list_entry_append(entry, list); + } + + dbg(list->udev, "'%s=%s' added\n", entry->name, entry->value); + return entry; } void udev_list_entry_delete(struct udev_list_entry *entry) { - if (entry->list->entries != NULL) { - int i; - struct udev_list *list = entry->list; - - /* remove entry from sorted array */ - i = list_search(list, entry->name); - if (i >= 0) { - memmove(&list->entries[i], &list->entries[i+1], - ((list->entries_cur-1) - i) * sizeof(struct udev_list_entry *)); - list->entries_cur--; - } - } - - udev_list_node_remove(&entry->node); - free(entry->name); - free(entry->value); - free(entry); + if (entry->list->entries != NULL) { + int i; + struct udev_list *list = entry->list; + + /* remove entry from sorted array */ + i = list_search(list, entry->name); + if (i >= 0) { + memmove(&list->entries[i], &list->entries[i+1], + ((list->entries_cur-1) - i) * sizeof(struct udev_list_entry *)); + list->entries_cur--; + } + } + + udev_list_node_remove(&entry->node); + free(entry->name); + free(entry->value); + free(entry); } void udev_list_cleanup(struct udev_list *list) { - struct udev_list_entry *entry_loop; - struct udev_list_entry *entry_tmp; - - free(list->entries); - list->entries = NULL; - list->entries_cur = 0; - list->entries_max = 0; - udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) - udev_list_entry_delete(entry_loop); + struct udev_list_entry *entry_loop; + struct udev_list_entry *entry_tmp; + + free(list->entries); + list->entries = NULL; + list->entries_cur = 0; + list->entries_max = 0; + udev_list_entry_foreach_safe(entry_loop, entry_tmp, udev_list_get_entry(list)) + udev_list_entry_delete(entry_loop); } struct udev_list_entry *udev_list_get_entry(struct udev_list *list) { - if (udev_list_node_is_empty(&list->node)) - return NULL; - return list_node_to_entry(list->node.next); + if (udev_list_node_is_empty(&list->node)) + return NULL; + return list_node_to_entry(list->node.next); } /** @@ -269,15 +269,15 @@ struct udev_list_entry *udev_list_get_entry(struct udev_list *list) */ UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_next(struct udev_list_entry *list_entry) { - struct udev_list_node *next; - - if (list_entry == NULL) - return NULL; - next = list_entry->node.next; - /* empty list or no more entries */ - if (next == &list_entry->list->node) - return NULL; - return list_node_to_entry(next); + struct udev_list_node *next; + + if (list_entry == NULL) + return NULL; + next = list_entry->node.next; + /* empty list or no more entries */ + if (next == &list_entry->list->node) + return NULL; + return list_node_to_entry(next); } /** @@ -289,18 +289,18 @@ UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_next(struct udev_list_en */ UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list_entry *list_entry, const char *name) { - int i; + int i; - if (list_entry == NULL) - return NULL; + if (list_entry == NULL) + return NULL; - if (!list_entry->list->unique) - return NULL; + if (!list_entry->list->unique) + return NULL; - i = list_search(list_entry->list, name); - if (i < 0) - return NULL; - return list_entry->list->entries[i]; + i = list_search(list_entry->list, name); + if (i < 0) + return NULL; + return list_entry->list->entries[i]; } /** @@ -311,9 +311,9 @@ UDEV_EXPORT struct udev_list_entry *udev_list_entry_get_by_name(struct udev_list */ UDEV_EXPORT const char *udev_list_entry_get_name(struct udev_list_entry *list_entry) { - if (list_entry == NULL) - return NULL; - return list_entry->name; + if (list_entry == NULL) + return NULL; + return list_entry->name; } /** @@ -324,21 +324,21 @@ UDEV_EXPORT const char *udev_list_entry_get_name(struct udev_list_entry *list_en */ UDEV_EXPORT const char *udev_list_entry_get_value(struct udev_list_entry *list_entry) { - if (list_entry == NULL) - return NULL; - return list_entry->value; + if (list_entry == NULL) + return NULL; + return list_entry->value; } int udev_list_entry_get_num(struct udev_list_entry *list_entry) { - if (list_entry == NULL) - return -EINVAL; - return list_entry->num; + if (list_entry == NULL) + return -EINVAL; + return list_entry->num; } void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num) { - if (list_entry == NULL) - return; - list_entry->num = num; + if (list_entry == NULL) + return; + list_entry->num = num; } diff --git a/src/libudev-monitor.c b/src/libudev-monitor.c index f2f39f9582..0b57072158 100644 --- a/src/libudev-monitor.c +++ b/src/libudev-monitor.c @@ -40,61 +40,61 @@ * Opaque object handling an event source. */ struct udev_monitor { - struct udev *udev; - int refcount; - int sock; - struct sockaddr_nl snl; - struct sockaddr_nl snl_trusted_sender; - struct sockaddr_nl snl_destination; - struct sockaddr_un sun; - socklen_t addrlen; - struct udev_list filter_subsystem_list; - struct udev_list filter_tag_list; - bool bound; + struct udev *udev; + int refcount; + int sock; + struct sockaddr_nl snl; + struct sockaddr_nl snl_trusted_sender; + struct sockaddr_nl snl_destination; + struct sockaddr_un sun; + socklen_t addrlen; + struct udev_list filter_subsystem_list; + struct udev_list filter_tag_list; + bool bound; }; enum udev_monitor_netlink_group { - UDEV_MONITOR_NONE, - UDEV_MONITOR_KERNEL, - UDEV_MONITOR_UDEV, + UDEV_MONITOR_NONE, + UDEV_MONITOR_KERNEL, + UDEV_MONITOR_UDEV, }; -#define UDEV_MONITOR_MAGIC 0xfeedcafe +#define UDEV_MONITOR_MAGIC 0xfeedcafe struct udev_monitor_netlink_header { - /* "libudev" prefix to distinguish libudev and kernel messages */ - char prefix[8]; - /* - * magic to protect against daemon <-> library message format mismatch - * used in the kernel from socket filter rules; needs to be stored in network order - */ - unsigned int magic; - /* total length of header structure known to the sender */ - unsigned int header_size; - /* properties string buffer */ - unsigned int properties_off; - unsigned int properties_len; - /* - * hashes of primary device properties strings, to let libudev subscribers - * use in-kernel socket filters; values need to be stored in network order - */ - unsigned int filter_subsystem_hash; - unsigned int filter_devtype_hash; - unsigned int filter_tag_bloom_hi; - unsigned int filter_tag_bloom_lo; + /* "libudev" prefix to distinguish libudev and kernel messages */ + char prefix[8]; + /* + * magic to protect against daemon <-> library message format mismatch + * used in the kernel from socket filter rules; needs to be stored in network order + */ + unsigned int magic; + /* total length of header structure known to the sender */ + unsigned int header_size; + /* properties string buffer */ + unsigned int properties_off; + unsigned int properties_len; + /* + * hashes of primary device properties strings, to let libudev subscribers + * use in-kernel socket filters; values need to be stored in network order + */ + unsigned int filter_subsystem_hash; + unsigned int filter_devtype_hash; + unsigned int filter_tag_bloom_hi; + unsigned int filter_tag_bloom_lo; }; static struct udev_monitor *udev_monitor_new(struct udev *udev) { - struct udev_monitor *udev_monitor; - - udev_monitor = calloc(1, sizeof(struct udev_monitor)); - if (udev_monitor == NULL) - return NULL; - udev_monitor->refcount = 1; - udev_monitor->udev = udev; - udev_list_init(udev, &udev_monitor->filter_subsystem_list, false); - udev_list_init(udev, &udev_monitor->filter_tag_list, true); - return udev_monitor; + struct udev_monitor *udev_monitor; + + udev_monitor = calloc(1, sizeof(struct udev_monitor)); + if (udev_monitor == NULL) + return NULL; + udev_monitor->refcount = 1; + udev_monitor->udev = udev; + udev_list_init(udev, &udev_monitor->filter_subsystem_list, false); + udev_list_init(udev, &udev_monitor->filter_tag_list, true); + return udev_monitor; } /** @@ -124,85 +124,85 @@ static struct udev_monitor *udev_monitor_new(struct udev *udev) **/ UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_socket(struct udev *udev, const char *socket_path) { - struct udev_monitor *udev_monitor; - struct stat statbuf; - - if (udev == NULL) - return NULL; - if (socket_path == NULL) - return NULL; - udev_monitor = udev_monitor_new(udev); - if (udev_monitor == NULL) - return NULL; - - udev_monitor->sun.sun_family = AF_LOCAL; - if (socket_path[0] == '@') { - /* translate leading '@' to abstract namespace */ - util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); - udev_monitor->sun.sun_path[0] = '\0'; - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); - } else if (stat(socket_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { - /* existing socket file */ - util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); - } else { - /* no socket file, assume abstract namespace socket */ - util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); - udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; - } - udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); - if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %m\n"); - free(udev_monitor); - return NULL; - } - - dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); - return udev_monitor; + struct udev_monitor *udev_monitor; + struct stat statbuf; + + if (udev == NULL) + return NULL; + if (socket_path == NULL) + return NULL; + udev_monitor = udev_monitor_new(udev); + if (udev_monitor == NULL) + return NULL; + + udev_monitor->sun.sun_family = AF_LOCAL; + if (socket_path[0] == '@') { + /* translate leading '@' to abstract namespace */ + util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); + udev_monitor->sun.sun_path[0] = '\0'; + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); + } else if (stat(socket_path, &statbuf) == 0 && S_ISSOCK(statbuf.st_mode)) { + /* existing socket file */ + util_strscpy(udev_monitor->sun.sun_path, sizeof(udev_monitor->sun.sun_path), socket_path); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path); + } else { + /* no socket file, assume abstract namespace socket */ + util_strscpy(&udev_monitor->sun.sun_path[1], sizeof(udev_monitor->sun.sun_path)-1, socket_path); + udev_monitor->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(socket_path)+1; + } + udev_monitor->sock = socket(AF_LOCAL, SOCK_DGRAM|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); + if (udev_monitor->sock == -1) { + err(udev, "error getting socket: %m\n"); + free(udev_monitor); + return NULL; + } + + dbg(udev, "monitor %p created with '%s'\n", udev_monitor, socket_path); + return udev_monitor; } struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd) { - struct udev_monitor *udev_monitor; - unsigned int group; - - if (udev == NULL) - return NULL; - - if (name == NULL) - group = UDEV_MONITOR_NONE; - else if (strcmp(name, "udev") == 0) - group = UDEV_MONITOR_UDEV; - else if (strcmp(name, "kernel") == 0) - group = UDEV_MONITOR_KERNEL; - else - return NULL; - - udev_monitor = udev_monitor_new(udev); - if (udev_monitor == NULL) - return NULL; - - if (fd < 0) { - udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT); - if (udev_monitor->sock == -1) { - err(udev, "error getting socket: %m\n"); - free(udev_monitor); - return NULL; - } - } else { - udev_monitor->bound = true; - udev_monitor->sock = fd; - } - - udev_monitor->snl.nl_family = AF_NETLINK; - udev_monitor->snl.nl_groups = group; - - /* default destination for sending */ - udev_monitor->snl_destination.nl_family = AF_NETLINK; - udev_monitor->snl_destination.nl_groups = UDEV_MONITOR_UDEV; - - dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT (%u)\n", udev_monitor, group); - return udev_monitor; + struct udev_monitor *udev_monitor; + unsigned int group; + + if (udev == NULL) + return NULL; + + if (name == NULL) + group = UDEV_MONITOR_NONE; + else if (strcmp(name, "udev") == 0) + group = UDEV_MONITOR_UDEV; + else if (strcmp(name, "kernel") == 0) + group = UDEV_MONITOR_KERNEL; + else + return NULL; + + udev_monitor = udev_monitor_new(udev); + if (udev_monitor == NULL) + return NULL; + + if (fd < 0) { + udev_monitor->sock = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT); + if (udev_monitor->sock == -1) { + err(udev, "error getting socket: %m\n"); + free(udev_monitor); + return NULL; + } + } else { + udev_monitor->bound = true; + udev_monitor->sock = fd; + } + + udev_monitor->snl.nl_family = AF_NETLINK; + udev_monitor->snl.nl_groups = group; + + /* default destination for sending */ + udev_monitor->snl_destination.nl_family = AF_NETLINK; + udev_monitor->snl_destination.nl_groups = UDEV_MONITOR_UDEV; + + dbg(udev, "monitor %p created with NETLINK_KOBJECT_UEVENT (%u)\n", udev_monitor, group); + return udev_monitor; } /** @@ -229,30 +229,30 @@ struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const c **/ UDEV_EXPORT struct udev_monitor *udev_monitor_new_from_netlink(struct udev *udev, const char *name) { - return udev_monitor_new_from_netlink_fd(udev, name, -1); + return udev_monitor_new_from_netlink_fd(udev, name, -1); } static inline void bpf_stmt(struct sock_filter *inss, unsigned int *i, - unsigned short code, unsigned int data) + unsigned short code, unsigned int data) { - struct sock_filter *ins = &inss[*i]; + struct sock_filter *ins = &inss[*i]; - ins->code = code; - ins->k = data; - (*i)++; + ins->code = code; + ins->k = data; + (*i)++; } static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, - unsigned short code, unsigned int data, - unsigned short jt, unsigned short jf) + unsigned short code, unsigned int data, + unsigned short jt, unsigned short jf) { - struct sock_filter *ins = &inss[*i]; + struct sock_filter *ins = &inss[*i]; - ins->code = code; - ins->jt = jt; - ins->jf = jf; - ins->k = data; - (*i)++; + ins->code = code; + ins->jt = jt; + ins->jf = jf; + ins->k = data; + (*i)++; } /** @@ -266,107 +266,107 @@ static inline void bpf_jmp(struct sock_filter *inss, unsigned int *i, */ UDEV_EXPORT int udev_monitor_filter_update(struct udev_monitor *udev_monitor) { - struct sock_filter ins[512]; - struct sock_fprog filter; - unsigned int i; - struct udev_list_entry *list_entry; - int err; - - if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL && - udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) - return 0; - - memset(ins, 0x00, sizeof(ins)); - i = 0; - - /* load magic in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, magic)); - /* jump if magic matches */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, UDEV_MONITOR_MAGIC, 1, 0); - /* wrong magic, pass packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); - - if (udev_list_get_entry(&udev_monitor->filter_tag_list) != NULL) { - int tag_matches; - - /* count tag matches, to calculate end of tag match block */ - tag_matches = 0; - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) - tag_matches++; - - /* add all tags matches */ - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { - uint64_t tag_bloom_bits = util_string_bloom64(udev_list_entry_get_name(list_entry)); - uint32_t tag_bloom_hi = tag_bloom_bits >> 32; - uint32_t tag_bloom_lo = tag_bloom_bits & 0xffffffff; - - /* load device bloom bits in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_hi)); - /* clear bits (tag bits & bloom bits) */ - bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_hi); - /* jump to next tag if it does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_hi, 0, 3); - - /* load device bloom bits in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_lo)); - /* clear bits (tag bits & bloom bits) */ - bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_lo); - /* jump behind end of tag match block if tag matches */ - tag_matches--; - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_lo, 1 + (tag_matches * 6), 0); - } - - /* nothing matched, drop packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); - } - - /* add all subsystem matches */ - if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) != NULL) { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { - unsigned int hash = util_string_hash32(udev_list_entry_get_name(list_entry)); - - /* load device subsystem value in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem_hash)); - if (udev_list_entry_get_value(list_entry) == NULL) { - /* jump if subsystem does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); - } else { - /* jump if subsystem does not match */ - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3); - - /* load device devtype value in A */ - bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_devtype_hash)); - /* jump if value does not match */ - hash = util_string_hash32(udev_list_entry_get_value(list_entry)); - bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); - } - - /* matched, pass packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); - - if (i+1 >= ARRAY_SIZE(ins)) - return -1; - } - - /* nothing matched, drop packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); - } - - /* matched, pass packet */ - bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); - - /* install filter */ - memset(&filter, 0x00, sizeof(filter)); - filter.len = i; - filter.filter = ins; - err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); - return err; + struct sock_filter ins[512]; + struct sock_fprog filter; + unsigned int i; + struct udev_list_entry *list_entry; + int err; + + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL && + udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) + return 0; + + memset(ins, 0x00, sizeof(ins)); + i = 0; + + /* load magic in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, magic)); + /* jump if magic matches */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, UDEV_MONITOR_MAGIC, 1, 0); + /* wrong magic, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + + if (udev_list_get_entry(&udev_monitor->filter_tag_list) != NULL) { + int tag_matches; + + /* count tag matches, to calculate end of tag match block */ + tag_matches = 0; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) + tag_matches++; + + /* add all tags matches */ + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { + uint64_t tag_bloom_bits = util_string_bloom64(udev_list_entry_get_name(list_entry)); + uint32_t tag_bloom_hi = tag_bloom_bits >> 32; + uint32_t tag_bloom_lo = tag_bloom_bits & 0xffffffff; + + /* load device bloom bits in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_hi)); + /* clear bits (tag bits & bloom bits) */ + bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_hi); + /* jump to next tag if it does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_hi, 0, 3); + + /* load device bloom bits in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_tag_bloom_lo)); + /* clear bits (tag bits & bloom bits) */ + bpf_stmt(ins, &i, BPF_ALU|BPF_AND|BPF_K, tag_bloom_lo); + /* jump behind end of tag match block if tag matches */ + tag_matches--; + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, tag_bloom_lo, 1 + (tag_matches * 6), 0); + } + + /* nothing matched, drop packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); + } + + /* add all subsystem matches */ + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) != NULL) { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { + unsigned int hash = util_string_hash32(udev_list_entry_get_name(list_entry)); + + /* load device subsystem value in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_subsystem_hash)); + if (udev_list_entry_get_value(list_entry) == NULL) { + /* jump if subsystem does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); + } else { + /* jump if subsystem does not match */ + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 3); + + /* load device devtype value in A */ + bpf_stmt(ins, &i, BPF_LD|BPF_W|BPF_ABS, offsetof(struct udev_monitor_netlink_header, filter_devtype_hash)); + /* jump if value does not match */ + hash = util_string_hash32(udev_list_entry_get_value(list_entry)); + bpf_jmp(ins, &i, BPF_JMP|BPF_JEQ|BPF_K, hash, 0, 1); + } + + /* matched, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + + if (i+1 >= ARRAY_SIZE(ins)) + return -1; + } + + /* nothing matched, drop packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0); + } + + /* matched, pass packet */ + bpf_stmt(ins, &i, BPF_RET|BPF_K, 0xffffffff); + + /* install filter */ + memset(&filter, 0x00, sizeof(filter)); + filter.len = i; + filter.filter = ins; + err = setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); + return err; } int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender) { - udev_monitor->snl_trusted_sender.nl_pid = sender->snl.nl_pid; - return 0; + udev_monitor->snl_trusted_sender.nl_pid = sender->snl.nl_pid; + return 0; } /** * udev_monitor_enable_receiving: @@ -378,49 +378,49 @@ int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct */ UDEV_EXPORT int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) { - int err = 0; - const int on = 1; - - if (udev_monitor->sun.sun_family != 0) { - if (!udev_monitor->bound) { - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); - if (err == 0) - udev_monitor->bound = true; - } - } else if (udev_monitor->snl.nl_family != 0) { - udev_monitor_filter_update(udev_monitor); - if (!udev_monitor->bound) { - err = bind(udev_monitor->sock, - (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); - if (err == 0) - udev_monitor->bound = true; - } - if (err == 0) { - struct sockaddr_nl snl; - socklen_t addrlen; - - /* - * get the address the kernel has assigned us - * it is usually, but not necessarily the pid - */ - addrlen = sizeof(struct sockaddr_nl); - err = getsockname(udev_monitor->sock, (struct sockaddr *)&snl, &addrlen); - if (err == 0) - udev_monitor->snl.nl_pid = snl.nl_pid; - } - } else { - return -EINVAL; - } - - if (err < 0) { - err(udev_monitor->udev, "bind failed: %m\n"); - return err; - } - - /* enable receiving of sender credentials */ - setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - return 0; + int err = 0; + const int on = 1; + + if (udev_monitor->sun.sun_family != 0) { + if (!udev_monitor->bound) { + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->sun, udev_monitor->addrlen); + if (err == 0) + udev_monitor->bound = true; + } + } else if (udev_monitor->snl.nl_family != 0) { + udev_monitor_filter_update(udev_monitor); + if (!udev_monitor->bound) { + err = bind(udev_monitor->sock, + (struct sockaddr *)&udev_monitor->snl, sizeof(struct sockaddr_nl)); + if (err == 0) + udev_monitor->bound = true; + } + if (err == 0) { + struct sockaddr_nl snl; + socklen_t addrlen; + + /* + * get the address the kernel has assigned us + * it is usually, but not necessarily the pid + */ + addrlen = sizeof(struct sockaddr_nl); + err = getsockname(udev_monitor->sock, (struct sockaddr *)&snl, &addrlen); + if (err == 0) + udev_monitor->snl.nl_pid = snl.nl_pid; + } + } else { + return -EINVAL; + } + + if (err < 0) { + err(udev_monitor->udev, "bind failed: %m\n"); + return err; + } + + /* enable receiving of sender credentials */ + setsockopt(udev_monitor->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + return 0; } /** @@ -435,18 +435,18 @@ UDEV_EXPORT int udev_monitor_enable_receiving(struct udev_monitor *udev_monitor) */ UDEV_EXPORT int udev_monitor_set_receive_buffer_size(struct udev_monitor *udev_monitor, int size) { - if (udev_monitor == NULL) - return -1; - return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size)); + if (udev_monitor == NULL) + return -1; + return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_RCVBUFFORCE, &size, sizeof(size)); } int udev_monitor_disconnect(struct udev_monitor *udev_monitor) { - int err; + int err; - err = close(udev_monitor->sock); - udev_monitor->sock = -1; - return err; + err = close(udev_monitor->sock); + udev_monitor->sock = -1; + return err; } /** @@ -459,10 +459,10 @@ int udev_monitor_disconnect(struct udev_monitor *udev_monitor) **/ UDEV_EXPORT struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_monitor) { - if (udev_monitor == NULL) - return NULL; - udev_monitor->refcount++; - return udev_monitor; + if (udev_monitor == NULL) + return NULL; + udev_monitor->refcount++; + return udev_monitor; } /** @@ -476,17 +476,17 @@ UDEV_EXPORT struct udev_monitor *udev_monitor_ref(struct udev_monitor *udev_moni **/ UDEV_EXPORT void udev_monitor_unref(struct udev_monitor *udev_monitor) { - if (udev_monitor == NULL) - return; - udev_monitor->refcount--; - if (udev_monitor->refcount > 0) - return; - if (udev_monitor->sock >= 0) - close(udev_monitor->sock); - udev_list_cleanup(&udev_monitor->filter_subsystem_list); - udev_list_cleanup(&udev_monitor->filter_tag_list); - dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); - free(udev_monitor); + if (udev_monitor == NULL) + return; + udev_monitor->refcount--; + if (udev_monitor->refcount > 0) + return; + if (udev_monitor->sock >= 0) + close(udev_monitor->sock); + udev_list_cleanup(&udev_monitor->filter_subsystem_list); + udev_list_cleanup(&udev_monitor->filter_tag_list); + dbg(udev_monitor->udev, "monitor %p released\n", udev_monitor); + free(udev_monitor); } /** @@ -499,9 +499,9 @@ UDEV_EXPORT void udev_monitor_unref(struct udev_monitor *udev_monitor) **/ UDEV_EXPORT struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor) { - if (udev_monitor == NULL) - return NULL; - return udev_monitor->udev; + if (udev_monitor == NULL) + return NULL; + return udev_monitor->udev; } /** @@ -514,47 +514,47 @@ UDEV_EXPORT struct udev *udev_monitor_get_udev(struct udev_monitor *udev_monitor **/ UDEV_EXPORT int udev_monitor_get_fd(struct udev_monitor *udev_monitor) { - if (udev_monitor == NULL) - return -1; - return udev_monitor->sock; + if (udev_monitor == NULL) + return -1; + return udev_monitor->sock; } static int passes_filter(struct udev_monitor *udev_monitor, struct udev_device *udev_device) { - struct udev_list_entry *list_entry; - - if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) - goto tag; - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { - const char *subsys = udev_list_entry_get_name(list_entry); - const char *dsubsys = udev_device_get_subsystem(udev_device); - const char *devtype; - const char *ddevtype; - - if (strcmp(dsubsys, subsys) != 0) - continue; - - devtype = udev_list_entry_get_value(list_entry); - if (devtype == NULL) - goto tag; - ddevtype = udev_device_get_devtype(udev_device); - if (ddevtype == NULL) - continue; - if (strcmp(ddevtype, devtype) == 0) - goto tag; - } - return 0; + struct udev_list_entry *list_entry; + + if (udev_list_get_entry(&udev_monitor->filter_subsystem_list) == NULL) + goto tag; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_subsystem_list)) { + const char *subsys = udev_list_entry_get_name(list_entry); + const char *dsubsys = udev_device_get_subsystem(udev_device); + const char *devtype; + const char *ddevtype; + + if (strcmp(dsubsys, subsys) != 0) + continue; + + devtype = udev_list_entry_get_value(list_entry); + if (devtype == NULL) + goto tag; + ddevtype = udev_device_get_devtype(udev_device); + if (ddevtype == NULL) + continue; + if (strcmp(ddevtype, devtype) == 0) + goto tag; + } + return 0; tag: - if (udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) - return 1; - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { - const char *tag = udev_list_entry_get_name(list_entry); - - if (udev_device_has_tag(udev_device, tag)) - return 1; - } - return 0; + if (udev_list_get_entry(&udev_monitor->filter_tag_list) == NULL) + return 1; + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_monitor->filter_tag_list)) { + const char *tag = udev_list_entry_get_name(list_entry); + + if (udev_device_has_tag(udev_device, tag)) + return 1; + } + return 0; } /** @@ -573,242 +573,242 @@ tag: **/ UDEV_EXPORT struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor) { - struct udev_device *udev_device; - struct msghdr smsg; - struct iovec iov; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - struct cmsghdr *cmsg; - struct sockaddr_nl snl; - struct ucred *cred; - char buf[8192]; - ssize_t buflen; - ssize_t bufpos; - struct udev_monitor_netlink_header *nlh; + struct udev_device *udev_device; + struct msghdr smsg; + struct iovec iov; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + struct cmsghdr *cmsg; + struct sockaddr_nl snl; + struct ucred *cred; + char buf[8192]; + ssize_t buflen; + ssize_t bufpos; + struct udev_monitor_netlink_header *nlh; retry: - if (udev_monitor == NULL) - return NULL; - memset(buf, 0x00, sizeof(buf)); - iov.iov_base = &buf; - iov.iov_len = sizeof(buf); - memset (&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - - if (udev_monitor->snl.nl_family != 0) { - smsg.msg_name = &snl; - smsg.msg_namelen = sizeof(snl); - } - - buflen = recvmsg(udev_monitor->sock, &smsg, 0); - if (buflen < 0) { - if (errno != EINTR) - info(udev_monitor->udev, "unable to receive message\n"); - return NULL; - } - - if (buflen < 32 || (size_t)buflen >= sizeof(buf)) { - info(udev_monitor->udev, "invalid message length\n"); - return NULL; - } - - if (udev_monitor->snl.nl_family != 0) { - if (snl.nl_groups == 0) { - /* unicast message, check if we trust the sender */ - if (udev_monitor->snl_trusted_sender.nl_pid == 0 || - snl.nl_pid != udev_monitor->snl_trusted_sender.nl_pid) { - info(udev_monitor->udev, "unicast netlink message ignored\n"); - return NULL; - } - } else if (snl.nl_groups == UDEV_MONITOR_KERNEL) { - if (snl.nl_pid > 0) { - info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", - snl.nl_pid); - return NULL; - } - } - } - - cmsg = CMSG_FIRSTHDR(&smsg); - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - info(udev_monitor->udev, "no sender credentials received, message ignored\n"); - return NULL; - } - - cred = (struct ucred *)CMSG_DATA(cmsg); - if (cred->uid != 0) { - info(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid); - return NULL; - } - - if (memcmp(buf, "libudev", 8) == 0) { - /* udev message needs proper version magic */ - nlh = (struct udev_monitor_netlink_header *) buf; - if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) { - err(udev_monitor->udev, "unrecognized message signature (%x != %x)\n", - nlh->magic, htonl(UDEV_MONITOR_MAGIC)); - return NULL; - } - if (nlh->properties_off+32 > buflen) - return NULL; - bufpos = nlh->properties_off; - } else { - /* kernel message with header */ - bufpos = strlen(buf) + 1; - if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) { - info(udev_monitor->udev, "invalid message length\n"); - return NULL; - } - - /* check message header */ - if (strstr(buf, "@/") == NULL) { - info(udev_monitor->udev, "unrecognized message header\n"); - return NULL; - } - } - - udev_device = udev_device_new(udev_monitor->udev); - if (udev_device == NULL) - return NULL; - udev_device_set_info_loaded(udev_device); - - while (bufpos < buflen) { - char *key; - size_t keylen; - - key = &buf[bufpos]; - keylen = strlen(key); - if (keylen == 0) - break; - bufpos += keylen + 1; - udev_device_add_property_from_string_parse(udev_device, key); - } - - if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { - info(udev_monitor->udev, "missing values, invalid device\n"); - udev_device_unref(udev_device); - return NULL; - } - - /* skip device, if it does not pass the current filter */ - if (!passes_filter(udev_monitor, udev_device)) { - struct pollfd pfd[1]; - int rc; - - udev_device_unref(udev_device); - - /* if something is queued, get next device */ - pfd[0].fd = udev_monitor->sock; - pfd[0].events = POLLIN; - rc = poll(pfd, 1, 0); - if (rc > 0) - goto retry; - return NULL; - } - - return udev_device; + if (udev_monitor == NULL) + return NULL; + memset(buf, 0x00, sizeof(buf)); + iov.iov_base = &buf; + iov.iov_len = sizeof(buf); + memset (&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + + if (udev_monitor->snl.nl_family != 0) { + smsg.msg_name = &snl; + smsg.msg_namelen = sizeof(snl); + } + + buflen = recvmsg(udev_monitor->sock, &smsg, 0); + if (buflen < 0) { + if (errno != EINTR) + info(udev_monitor->udev, "unable to receive message\n"); + return NULL; + } + + if (buflen < 32 || (size_t)buflen >= sizeof(buf)) { + info(udev_monitor->udev, "invalid message length\n"); + return NULL; + } + + if (udev_monitor->snl.nl_family != 0) { + if (snl.nl_groups == 0) { + /* unicast message, check if we trust the sender */ + if (udev_monitor->snl_trusted_sender.nl_pid == 0 || + snl.nl_pid != udev_monitor->snl_trusted_sender.nl_pid) { + info(udev_monitor->udev, "unicast netlink message ignored\n"); + return NULL; + } + } else if (snl.nl_groups == UDEV_MONITOR_KERNEL) { + if (snl.nl_pid > 0) { + info(udev_monitor->udev, "multicast kernel netlink message from pid %d ignored\n", + snl.nl_pid); + return NULL; + } + } + } + + cmsg = CMSG_FIRSTHDR(&smsg); + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + info(udev_monitor->udev, "no sender credentials received, message ignored\n"); + return NULL; + } + + cred = (struct ucred *)CMSG_DATA(cmsg); + if (cred->uid != 0) { + info(udev_monitor->udev, "sender uid=%d, message ignored\n", cred->uid); + return NULL; + } + + if (memcmp(buf, "libudev", 8) == 0) { + /* udev message needs proper version magic */ + nlh = (struct udev_monitor_netlink_header *) buf; + if (nlh->magic != htonl(UDEV_MONITOR_MAGIC)) { + err(udev_monitor->udev, "unrecognized message signature (%x != %x)\n", + nlh->magic, htonl(UDEV_MONITOR_MAGIC)); + return NULL; + } + if (nlh->properties_off+32 > buflen) + return NULL; + bufpos = nlh->properties_off; + } else { + /* kernel message with header */ + bufpos = strlen(buf) + 1; + if ((size_t)bufpos < sizeof("a@/d") || bufpos >= buflen) { + info(udev_monitor->udev, "invalid message length\n"); + return NULL; + } + + /* check message header */ + if (strstr(buf, "@/") == NULL) { + info(udev_monitor->udev, "unrecognized message header\n"); + return NULL; + } + } + + udev_device = udev_device_new(udev_monitor->udev); + if (udev_device == NULL) + return NULL; + udev_device_set_info_loaded(udev_device); + + while (bufpos < buflen) { + char *key; + size_t keylen; + + key = &buf[bufpos]; + keylen = strlen(key); + if (keylen == 0) + break; + bufpos += keylen + 1; + udev_device_add_property_from_string_parse(udev_device, key); + } + + if (udev_device_add_property_from_string_parse_finish(udev_device) < 0) { + info(udev_monitor->udev, "missing values, invalid device\n"); + udev_device_unref(udev_device); + return NULL; + } + + /* skip device, if it does not pass the current filter */ + if (!passes_filter(udev_monitor, udev_device)) { + struct pollfd pfd[1]; + int rc; + + udev_device_unref(udev_device); + + /* if something is queued, get next device */ + pfd[0].fd = udev_monitor->sock; + pfd[0].events = POLLIN; + rc = poll(pfd, 1, 0); + if (rc > 0) + goto retry; + return NULL; + } + + return udev_device; } int udev_monitor_send_device(struct udev_monitor *udev_monitor, - struct udev_monitor *destination, struct udev_device *udev_device) + struct udev_monitor *destination, struct udev_device *udev_device) { - const char *buf; - ssize_t blen; - ssize_t count; - - blen = udev_device_get_properties_monitor_buf(udev_device, &buf); - if (blen < 32) - return -EINVAL; - - if (udev_monitor->sun.sun_family != 0) { - struct msghdr smsg; - struct iovec iov[2]; - const char *action; - char header[2048]; - char *s; - - /* header @ */ - action = udev_device_get_action(udev_device); - if (action == NULL) - return -EINVAL; - s = header; - if (util_strpcpyl(&s, sizeof(header), action, "@", udev_device_get_devpath(udev_device), NULL) == 0) - return -EINVAL; - iov[0].iov_base = header; - iov[0].iov_len = (s - header)+1; - - /* add properties list */ - iov[1].iov_base = (char *)buf; - iov[1].iov_len = blen; - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = iov; - smsg.msg_iovlen = 2; - smsg.msg_name = &udev_monitor->sun; - smsg.msg_namelen = udev_monitor->addrlen; - count = sendmsg(udev_monitor->sock, &smsg, 0); - info(udev_monitor->udev, "passed %zi bytes to socket monitor %p\n", count, udev_monitor); - return count; - } - - if (udev_monitor->snl.nl_family != 0) { - struct msghdr smsg; - struct iovec iov[2]; - const char *val; - struct udev_monitor_netlink_header nlh; - struct udev_list_entry *list_entry; - uint64_t tag_bloom_bits; - - /* add versioned header */ - memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header)); - memcpy(nlh.prefix, "libudev", 8); - nlh.magic = htonl(UDEV_MONITOR_MAGIC); - nlh.header_size = sizeof(struct udev_monitor_netlink_header); - val = udev_device_get_subsystem(udev_device); - nlh.filter_subsystem_hash = htonl(util_string_hash32(val)); - val = udev_device_get_devtype(udev_device); - if (val != NULL) - nlh.filter_devtype_hash = htonl(util_string_hash32(val)); - iov[0].iov_base = &nlh; - iov[0].iov_len = sizeof(struct udev_monitor_netlink_header); - - /* add tag bloom filter */ - tag_bloom_bits = 0; - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) - tag_bloom_bits |= util_string_bloom64(udev_list_entry_get_name(list_entry)); - if (tag_bloom_bits > 0) { - nlh.filter_tag_bloom_hi = htonl(tag_bloom_bits >> 32); - nlh.filter_tag_bloom_lo = htonl(tag_bloom_bits & 0xffffffff); - } - - /* add properties list */ - nlh.properties_off = iov[0].iov_len; - nlh.properties_len = blen; - iov[1].iov_base = (char *)buf; - iov[1].iov_len = blen; - - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = iov; - smsg.msg_iovlen = 2; - /* - * Use custom address for target, or the default one. - * - * If we send to a multicast group, we will get - * ECONNREFUSED, which is expected. - */ - if (destination != NULL) - smsg.msg_name = &destination->snl; - else - smsg.msg_name = &udev_monitor->snl_destination; - smsg.msg_namelen = sizeof(struct sockaddr_nl); - count = sendmsg(udev_monitor->sock, &smsg, 0); - info(udev_monitor->udev, "passed %zi bytes to netlink monitor %p\n", count, udev_monitor); - return count; - } - - return -EINVAL; + const char *buf; + ssize_t blen; + ssize_t count; + + blen = udev_device_get_properties_monitor_buf(udev_device, &buf); + if (blen < 32) + return -EINVAL; + + if (udev_monitor->sun.sun_family != 0) { + struct msghdr smsg; + struct iovec iov[2]; + const char *action; + char header[2048]; + char *s; + + /* header @ */ + action = udev_device_get_action(udev_device); + if (action == NULL) + return -EINVAL; + s = header; + if (util_strpcpyl(&s, sizeof(header), action, "@", udev_device_get_devpath(udev_device), NULL) == 0) + return -EINVAL; + iov[0].iov_base = header; + iov[0].iov_len = (s - header)+1; + + /* add properties list */ + iov[1].iov_base = (char *)buf; + iov[1].iov_len = blen; + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = iov; + smsg.msg_iovlen = 2; + smsg.msg_name = &udev_monitor->sun; + smsg.msg_namelen = udev_monitor->addrlen; + count = sendmsg(udev_monitor->sock, &smsg, 0); + info(udev_monitor->udev, "passed %zi bytes to socket monitor %p\n", count, udev_monitor); + return count; + } + + if (udev_monitor->snl.nl_family != 0) { + struct msghdr smsg; + struct iovec iov[2]; + const char *val; + struct udev_monitor_netlink_header nlh; + struct udev_list_entry *list_entry; + uint64_t tag_bloom_bits; + + /* add versioned header */ + memset(&nlh, 0x00, sizeof(struct udev_monitor_netlink_header)); + memcpy(nlh.prefix, "libudev", 8); + nlh.magic = htonl(UDEV_MONITOR_MAGIC); + nlh.header_size = sizeof(struct udev_monitor_netlink_header); + val = udev_device_get_subsystem(udev_device); + nlh.filter_subsystem_hash = htonl(util_string_hash32(val)); + val = udev_device_get_devtype(udev_device); + if (val != NULL) + nlh.filter_devtype_hash = htonl(util_string_hash32(val)); + iov[0].iov_base = &nlh; + iov[0].iov_len = sizeof(struct udev_monitor_netlink_header); + + /* add tag bloom filter */ + tag_bloom_bits = 0; + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(udev_device)) + tag_bloom_bits |= util_string_bloom64(udev_list_entry_get_name(list_entry)); + if (tag_bloom_bits > 0) { + nlh.filter_tag_bloom_hi = htonl(tag_bloom_bits >> 32); + nlh.filter_tag_bloom_lo = htonl(tag_bloom_bits & 0xffffffff); + } + + /* add properties list */ + nlh.properties_off = iov[0].iov_len; + nlh.properties_len = blen; + iov[1].iov_base = (char *)buf; + iov[1].iov_len = blen; + + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = iov; + smsg.msg_iovlen = 2; + /* + * Use custom address for target, or the default one. + * + * If we send to a multicast group, we will get + * ECONNREFUSED, which is expected. + */ + if (destination != NULL) + smsg.msg_name = &destination->snl; + else + smsg.msg_name = &udev_monitor->snl_destination; + smsg.msg_namelen = sizeof(struct sockaddr_nl); + count = sendmsg(udev_monitor->sock, &smsg, 0); + info(udev_monitor->udev, "passed %zi bytes to netlink monitor %p\n", count, udev_monitor); + return count; + } + + return -EINVAL; } /** @@ -826,13 +826,13 @@ int udev_monitor_send_device(struct udev_monitor *udev_monitor, */ UDEV_EXPORT int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, const char *subsystem, const char *devtype) { - if (udev_monitor == NULL) - return -EINVAL; - if (subsystem == NULL) - return -EINVAL; - if (udev_list_entry_add(&udev_monitor->filter_subsystem_list, subsystem, devtype) == NULL) - return -ENOMEM; - return 0; + if (udev_monitor == NULL) + return -EINVAL; + if (subsystem == NULL) + return -EINVAL; + if (udev_list_entry_add(&udev_monitor->filter_subsystem_list, subsystem, devtype) == NULL) + return -ENOMEM; + return 0; } /** @@ -849,13 +849,13 @@ UDEV_EXPORT int udev_monitor_filter_add_match_subsystem_devtype(struct udev_moni */ UDEV_EXPORT int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag) { - if (udev_monitor == NULL) - return -EINVAL; - if (tag == NULL) - return -EINVAL; - if (udev_list_entry_add(&udev_monitor->filter_tag_list, tag, NULL) == NULL) - return -ENOMEM; - return 0; + if (udev_monitor == NULL) + return -EINVAL; + if (tag == NULL) + return -EINVAL; + if (udev_list_entry_add(&udev_monitor->filter_tag_list, tag, NULL) == NULL) + return -ENOMEM; + return 0; } /** @@ -868,8 +868,8 @@ UDEV_EXPORT int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_moni */ UDEV_EXPORT int udev_monitor_filter_remove(struct udev_monitor *udev_monitor) { - static struct sock_fprog filter = { 0, NULL }; + static struct sock_fprog filter = { 0, NULL }; - udev_list_cleanup(&udev_monitor->filter_subsystem_list); - return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); + udev_list_cleanup(&udev_monitor->filter_subsystem_list); + return setsockopt(udev_monitor->sock, SOL_SOCKET, SO_ATTACH_FILTER, &filter, sizeof(filter)); } diff --git a/src/libudev-private.h b/src/libudev-private.h index 83976698a9..5f5c64a63d 100644 --- a/src/libudev-private.h +++ b/src/libudev-private.h @@ -19,8 +19,8 @@ #include "libudev.h" #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -#define READ_END 0 -#define WRITE_END 1 +#define READ_END 0 +#define WRITE_END 1 static inline void __attribute__((always_inline, format(printf, 2, 3))) udev_log_null(struct udev *udev, const char *format, ...) {} @@ -49,19 +49,19 @@ udev_log_null(struct udev *udev, const char *format, ...) {} static inline void udev_log_init(const char *program_name) { - openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); + openlog(program_name, LOG_PID | LOG_CONS, LOG_DAEMON); } static inline void udev_log_close(void) { - closelog(); + closelog(); } /* libudev.c */ void udev_log(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, ...) - __attribute__((format(printf, 6, 7))); + int priority, const char *file, int line, const char *fn, + const char *format, ...) + __attribute__((format(printf, 6, 7))); int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *ts_usec[]); struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value); struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev); @@ -107,20 +107,20 @@ int udev_device_tag_index(struct udev_device *dev, struct udev_device *dev_old, int udev_monitor_disconnect(struct udev_monitor *udev_monitor); int udev_monitor_allow_unicast_sender(struct udev_monitor *udev_monitor, struct udev_monitor *sender); int udev_monitor_send_device(struct udev_monitor *udev_monitor, - struct udev_monitor *destination, struct udev_device *udev_device); + struct udev_monitor *destination, struct udev_device *udev_device); struct udev_monitor *udev_monitor_new_from_netlink_fd(struct udev *udev, const char *name, int fd); /* libudev-list.c */ struct udev_list_node { - struct udev_list_node *next, *prev; + struct udev_list_node *next, *prev; }; struct udev_list { - struct udev *udev; - struct udev_list_node node; - struct udev_list_entry **entries; - unsigned int entries_cur; - unsigned int entries_max; - bool unique; + struct udev *udev; + struct udev_list_node node; + struct udev_list_entry **entries; + unsigned int entries_cur; + unsigned int entries_max; + bool unique; }; #define UDEV_LIST(list) struct udev_list_node list = { &(list), &(list) } void udev_list_node_init(struct udev_list_node *list); @@ -128,13 +128,13 @@ int udev_list_node_is_empty(struct udev_list_node *list); void udev_list_node_append(struct udev_list_node *new, struct udev_list_node *list); void udev_list_node_remove(struct udev_list_node *entry); #define udev_list_node_foreach(node, list) \ - for (node = (list)->next; \ - node != list; \ - node = (node)->next) + for (node = (list)->next; \ + node != list; \ + node = (node)->next) #define udev_list_node_foreach_safe(node, tmp, list) \ - for (node = (list)->next, tmp = (node)->next; \ - node != list; \ - node = tmp, tmp = (tmp)->next) + for (node = (list)->next, tmp = (node)->next; \ + node != list; \ + node = tmp, tmp = (tmp)->next) void udev_list_init(struct udev *udev, struct udev_list *list, bool unique); void udev_list_cleanup(struct udev_list *list); struct udev_list_entry *udev_list_get_entry(struct udev_list *list); @@ -145,9 +145,9 @@ void udev_list_entry_append(struct udev_list_entry *new, struct udev_list *list) int udev_list_entry_get_num(struct udev_list_entry *list_entry); void udev_list_entry_set_num(struct udev_list_entry *list_entry, int num); #define udev_list_entry_foreach_safe(entry, tmp, first) \ - for (entry = first, tmp = udev_list_entry_get_next(entry); \ - entry != NULL; \ - entry = tmp, tmp = udev_list_entry_get_next(tmp)) + for (entry = first, tmp = udev_list_entry_get_next(entry); \ + entry != NULL; \ + entry = tmp, tmp = udev_list_entry_get_next(tmp)) /* libudev-queue.c */ unsigned long long int udev_get_kernel_seqnum(struct udev *udev); @@ -163,10 +163,10 @@ int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device); /* libudev-util.c */ -#define UTIL_PATH_SIZE 1024 -#define UTIL_NAME_SIZE 512 -#define UTIL_LINE_SIZE 16384 -#define UDEV_ALLOWED_CHARS_INPUT "/ $%?," +#define UTIL_PATH_SIZE 1024 +#define UTIL_NAME_SIZE 512 +#define UTIL_LINE_SIZE 16384 +#define UDEV_ALLOWED_CHARS_INPUT "/ $%?," ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size); int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size); int util_log_priority(const char *priority); @@ -189,7 +189,7 @@ int util_delete_path(struct udev *udev, const char *path); uid_t util_lookup_user(struct udev *udev, const char *user); gid_t util_lookup_group(struct udev *udev, const char *group); int util_resolve_subsys_kernel(struct udev *udev, const char *string, - char *result, size_t maxsize, int read_value); + char *result, size_t maxsize, int read_value); unsigned long long ts_usec(const struct timespec *ts); unsigned long long now_usec(void); diff --git a/src/libudev-queue-private.c b/src/libudev-queue-private.c index e0a7b53b81..71771950aa 100644 --- a/src/libudev-queue-private.c +++ b/src/libudev-queue-private.c @@ -22,11 +22,11 @@ * with the same sequence number but a devpath len of 0. * * Example: - * { 0x0000000000000001 } - * { 0x0000000000000001, 0x0019, "/devices/virtual/mem/null" }, - * { 0x0000000000000002, 0x001b, "/devices/virtual/mem/random" }, - * { 0x0000000000000001, 0x0000 }, - * { 0x0000000000000003, 0x0019, "/devices/virtual/mem/zero" }, + * { 0x0000000000000001 } + * { 0x0000000000000001, 0x0019, "/devices/virtual/mem/null" }, + * { 0x0000000000000002, 0x001b, "/devices/virtual/mem/random" }, + * { 0x0000000000000001, 0x0000 }, + * { 0x0000000000000003, 0x0019, "/devices/virtual/mem/zero" }, * * Events 2 and 3 are still queued, but event 1 has finished. * @@ -55,83 +55,83 @@ static int rebuild_queue_file(struct udev_queue_export *udev_queue_export); struct udev_queue_export { - struct udev *udev; - int queued_count; /* number of unfinished events exported in queue file */ - FILE *queue_file; - unsigned long long int seqnum_max; /* earliest sequence number in queue file */ - unsigned long long int seqnum_min; /* latest sequence number in queue file */ - int waste_bytes; /* queue file bytes wasted on finished events */ + struct udev *udev; + int queued_count; /* number of unfinished events exported in queue file */ + FILE *queue_file; + unsigned long long int seqnum_max; /* earliest sequence number in queue file */ + unsigned long long int seqnum_min; /* latest sequence number in queue file */ + int waste_bytes; /* queue file bytes wasted on finished events */ }; struct udev_queue_export *udev_queue_export_new(struct udev *udev) { - struct udev_queue_export *udev_queue_export; - unsigned long long int initial_seqnum; + struct udev_queue_export *udev_queue_export; + unsigned long long int initial_seqnum; - if (udev == NULL) - return NULL; + if (udev == NULL) + return NULL; - udev_queue_export = calloc(1, sizeof(struct udev_queue_export)); - if (udev_queue_export == NULL) - return NULL; - udev_queue_export->udev = udev; + udev_queue_export = calloc(1, sizeof(struct udev_queue_export)); + if (udev_queue_export == NULL) + return NULL; + udev_queue_export->udev = udev; - initial_seqnum = udev_get_kernel_seqnum(udev); - udev_queue_export->seqnum_min = initial_seqnum; - udev_queue_export->seqnum_max = initial_seqnum; + initial_seqnum = udev_get_kernel_seqnum(udev); + udev_queue_export->seqnum_min = initial_seqnum; + udev_queue_export->seqnum_max = initial_seqnum; - udev_queue_export_cleanup(udev_queue_export); - if (rebuild_queue_file(udev_queue_export) != 0) { - free(udev_queue_export); - return NULL; - } + udev_queue_export_cleanup(udev_queue_export); + if (rebuild_queue_file(udev_queue_export) != 0) { + free(udev_queue_export); + return NULL; + } - return udev_queue_export; + return udev_queue_export; } struct udev_queue_export *udev_queue_export_unref(struct udev_queue_export *udev_queue_export) { - if (udev_queue_export == NULL) - return NULL; - if (udev_queue_export->queue_file != NULL) - fclose(udev_queue_export->queue_file); - free(udev_queue_export); - return NULL; + if (udev_queue_export == NULL) + return NULL; + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + free(udev_queue_export); + return NULL; } void udev_queue_export_cleanup(struct udev_queue_export *udev_queue_export) { - char filename[UTIL_PATH_SIZE]; - - if (udev_queue_export == NULL) - return; - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); - unlink(filename); - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); - unlink(filename); + char filename[UTIL_PATH_SIZE]; + + if (udev_queue_export == NULL) + return; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); + unlink(filename); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); + unlink(filename); } static int skip_to(FILE *file, long offset) { - long old_offset; + long old_offset; - /* fseek may drop buffered data, avoid it for small seeks */ - old_offset = ftell(file); - if (offset > old_offset && offset - old_offset <= BUFSIZ) { - size_t skip_bytes = offset - old_offset; - char buf[skip_bytes]; + /* fseek may drop buffered data, avoid it for small seeks */ + old_offset = ftell(file); + if (offset > old_offset && offset - old_offset <= BUFSIZ) { + size_t skip_bytes = offset - old_offset; + char buf[skip_bytes]; - if (fread(buf, skip_bytes, 1, file) != skip_bytes) - return -1; - } + if (fread(buf, skip_bytes, 1, file) != skip_bytes) + return -1; + } - return fseek(file, offset, SEEK_SET); + return fseek(file, offset, SEEK_SET); } struct queue_devpaths { - unsigned int devpaths_first; /* index of first queued event */ - unsigned int devpaths_size; - long devpaths[]; /* seqnum -> offset of devpath in queue file (or 0) */ + unsigned int devpaths_first; /* index of first queued event */ + unsigned int devpaths_size; + long devpaths[]; /* seqnum -> offset of devpath in queue file (or 0) */ }; /* @@ -140,273 +140,273 @@ struct queue_devpaths { */ static struct queue_devpaths *build_index(struct udev_queue_export *udev_queue_export) { - struct queue_devpaths *devpaths; - unsigned long long int range; - long devpath_offset; - ssize_t devpath_len; - unsigned long long int seqnum; - unsigned long long int n; - unsigned int i; - - /* seek to the first event in the file */ - rewind(udev_queue_export->queue_file); - udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum); - - /* allocate the table */ - range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max; - if (range - 1 > INT_MAX) { - err(udev_queue_export->udev, "queue file overflow\n"); - return NULL; - } - devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); - if (devpaths == NULL) - return NULL; - devpaths->devpaths_size = range + 1; - - /* read all records and populate the table */ - for (;;) { - if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) - break; - n = seqnum - udev_queue_export->seqnum_max; - if (n >= devpaths->devpaths_size) - goto read_error; - - devpath_offset = ftell(udev_queue_export->queue_file); - devpath_len = udev_queue_skip_devpath(udev_queue_export->queue_file); - if (devpath_len < 0) - goto read_error; - - if (devpath_len > 0) - devpaths->devpaths[n] = devpath_offset; - else - devpaths->devpaths[n] = 0; - } - - /* find first queued event */ - for (i = 0; i < devpaths->devpaths_size; i++) { - if (devpaths->devpaths[i] != 0) - break; - } - devpaths->devpaths_first = i; - - return devpaths; + struct queue_devpaths *devpaths; + unsigned long long int range; + long devpath_offset; + ssize_t devpath_len; + unsigned long long int seqnum; + unsigned long long int n; + unsigned int i; + + /* seek to the first event in the file */ + rewind(udev_queue_export->queue_file); + udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum); + + /* allocate the table */ + range = udev_queue_export->seqnum_min - udev_queue_export->seqnum_max; + if (range - 1 > INT_MAX) { + err(udev_queue_export->udev, "queue file overflow\n"); + return NULL; + } + devpaths = calloc(1, sizeof(struct queue_devpaths) + (range + 1) * sizeof(long)); + if (devpaths == NULL) + return NULL; + devpaths->devpaths_size = range + 1; + + /* read all records and populate the table */ + for (;;) { + if (udev_queue_read_seqnum(udev_queue_export->queue_file, &seqnum) < 0) + break; + n = seqnum - udev_queue_export->seqnum_max; + if (n >= devpaths->devpaths_size) + goto read_error; + + devpath_offset = ftell(udev_queue_export->queue_file); + devpath_len = udev_queue_skip_devpath(udev_queue_export->queue_file); + if (devpath_len < 0) + goto read_error; + + if (devpath_len > 0) + devpaths->devpaths[n] = devpath_offset; + else + devpaths->devpaths[n] = 0; + } + + /* find first queued event */ + for (i = 0; i < devpaths->devpaths_size; i++) { + if (devpaths->devpaths[i] != 0) + break; + } + devpaths->devpaths_first = i; + + return devpaths; read_error: - err(udev_queue_export->udev, "queue file corrupted\n"); - free(devpaths); - return NULL; + err(udev_queue_export->udev, "queue file corrupted\n"); + free(devpaths); + return NULL; } static int rebuild_queue_file(struct udev_queue_export *udev_queue_export) { - unsigned long long int seqnum; - struct queue_devpaths *devpaths = NULL; - char filename[UTIL_PATH_SIZE]; - char filename_tmp[UTIL_PATH_SIZE]; - FILE *new_queue_file = NULL; - unsigned int i; - - /* read old queue file */ - if (udev_queue_export->queue_file != NULL) { - dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n", - udev_queue_export->waste_bytes); - - devpaths = build_index(udev_queue_export); - if (devpaths != NULL) - udev_queue_export->seqnum_max += devpaths->devpaths_first; - } - if (devpaths == NULL) { - dbg(udev_queue_export->udev, "creating empty queue file\n"); - udev_queue_export->queued_count = 0; - udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; - } - - /* create new queue file */ - util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); - new_queue_file = fopen(filename_tmp, "w+"); - if (new_queue_file == NULL) - goto error; - seqnum = udev_queue_export->seqnum_max; - fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); - - /* copy unfinished events only to the new file */ - if (devpaths != NULL) { - for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { - char devpath[UTIL_PATH_SIZE]; - int err; - unsigned short devpath_len; - - if (devpaths->devpaths[i] != 0) - { - skip_to(udev_queue_export->queue_file, devpaths->devpaths[i]); - err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); - devpath_len = err; - - fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); - fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); - fwrite(devpath, 1, devpath_len, new_queue_file); - } - seqnum++; - } - free(devpaths); - devpaths = NULL; - } - fflush(new_queue_file); - if (ferror(new_queue_file)) - goto error; - - /* rename the new file on top of the old one */ - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); - if (rename(filename_tmp, filename) != 0) - goto error; - - if (udev_queue_export->queue_file != NULL) - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = new_queue_file; - udev_queue_export->waste_bytes = 0; - - return 0; + unsigned long long int seqnum; + struct queue_devpaths *devpaths = NULL; + char filename[UTIL_PATH_SIZE]; + char filename_tmp[UTIL_PATH_SIZE]; + FILE *new_queue_file = NULL; + unsigned int i; + + /* read old queue file */ + if (udev_queue_export->queue_file != NULL) { + dbg(udev_queue_export->udev, "compacting queue file, freeing %d bytes\n", + udev_queue_export->waste_bytes); + + devpaths = build_index(udev_queue_export); + if (devpaths != NULL) + udev_queue_export->seqnum_max += devpaths->devpaths_first; + } + if (devpaths == NULL) { + dbg(udev_queue_export->udev, "creating empty queue file\n"); + udev_queue_export->queued_count = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + } + + /* create new queue file */ + util_strscpyl(filename_tmp, sizeof(filename_tmp), udev_get_run_path(udev_queue_export->udev), "/queue.tmp", NULL); + new_queue_file = fopen(filename_tmp, "w+"); + if (new_queue_file == NULL) + goto error; + seqnum = udev_queue_export->seqnum_max; + fwrite(&seqnum, 1, sizeof(unsigned long long int), new_queue_file); + + /* copy unfinished events only to the new file */ + if (devpaths != NULL) { + for (i = devpaths->devpaths_first; i < devpaths->devpaths_size; i++) { + char devpath[UTIL_PATH_SIZE]; + int err; + unsigned short devpath_len; + + if (devpaths->devpaths[i] != 0) + { + skip_to(udev_queue_export->queue_file, devpaths->devpaths[i]); + err = udev_queue_read_devpath(udev_queue_export->queue_file, devpath, sizeof(devpath)); + devpath_len = err; + + fwrite(&seqnum, sizeof(unsigned long long int), 1, new_queue_file); + fwrite(&devpath_len, sizeof(unsigned short), 1, new_queue_file); + fwrite(devpath, 1, devpath_len, new_queue_file); + } + seqnum++; + } + free(devpaths); + devpaths = NULL; + } + fflush(new_queue_file); + if (ferror(new_queue_file)) + goto error; + + /* rename the new file on top of the old one */ + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue_export->udev), "/queue.bin", NULL); + if (rename(filename_tmp, filename) != 0) + goto error; + + if (udev_queue_export->queue_file != NULL) + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = new_queue_file; + udev_queue_export->waste_bytes = 0; + + return 0; error: - err(udev_queue_export->udev, "failed to create queue file: %m\n"); - udev_queue_export_cleanup(udev_queue_export); - - if (udev_queue_export->queue_file != NULL) { - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - } - if (new_queue_file != NULL) - fclose(new_queue_file); - - if (devpaths != NULL) - free(devpaths); - udev_queue_export->queued_count = 0; - udev_queue_export->waste_bytes = 0; - udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; - - return -1; + err(udev_queue_export->udev, "failed to create queue file: %m\n"); + udev_queue_export_cleanup(udev_queue_export); + + if (udev_queue_export->queue_file != NULL) { + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + } + if (new_queue_file != NULL) + fclose(new_queue_file); + + if (devpaths != NULL) + free(devpaths); + udev_queue_export->queued_count = 0; + udev_queue_export->waste_bytes = 0; + udev_queue_export->seqnum_max = udev_queue_export->seqnum_min; + + return -1; } static int write_queue_record(struct udev_queue_export *udev_queue_export, - unsigned long long int seqnum, const char *devpath, size_t devpath_len) + unsigned long long int seqnum, const char *devpath, size_t devpath_len) { - unsigned short len; + unsigned short len; - if (udev_queue_export->queue_file == NULL) { - dbg(udev_queue_export->udev, "can't record event: queue file not available\n"); - return -1; - } + if (udev_queue_export->queue_file == NULL) { + dbg(udev_queue_export->udev, "can't record event: queue file not available\n"); + return -1; + } - if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1) - goto write_error; + if (fwrite(&seqnum, sizeof(unsigned long long int), 1, udev_queue_export->queue_file) != 1) + goto write_error; - len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; - if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) - goto write_error; - if (len > 0) { - if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) - goto write_error; - } + len = (devpath_len < USHRT_MAX) ? devpath_len : USHRT_MAX; + if (fwrite(&len, sizeof(unsigned short), 1, udev_queue_export->queue_file) != 1) + goto write_error; + if (len > 0) { + if (fwrite(devpath, 1, len, udev_queue_export->queue_file) != len) + goto write_error; + } - /* *must* flush output; caller may fork */ - if (fflush(udev_queue_export->queue_file) != 0) - goto write_error; + /* *must* flush output; caller may fork */ + if (fflush(udev_queue_export->queue_file) != 0) + goto write_error; - return 0; + return 0; write_error: - /* if we failed half way through writing a record to a file, - we should not try to write any further records to it. */ - err(udev_queue_export->udev, "error writing to queue file: %m\n"); - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; + /* if we failed half way through writing a record to a file, + we should not try to write any further records to it. */ + err(udev_queue_export->udev, "error writing to queue file: %m\n"); + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; - return -1; + return -1; } enum device_state { - DEVICE_QUEUED, - DEVICE_FINISHED, + DEVICE_QUEUED, + DEVICE_FINISHED, }; static inline size_t queue_record_size(size_t devpath_len) { - return sizeof(unsigned long long int) + sizeof(unsigned short int) + devpath_len; + return sizeof(unsigned long long int) + sizeof(unsigned short int) + devpath_len; } static int update_queue(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) + struct udev_device *udev_device, enum device_state state) { - unsigned long long int seqnum = udev_device_get_seqnum(udev_device); - const char *devpath = NULL; - size_t devpath_len = 0; - int bytes; - int err; - - /* FINISHED records have a zero length devpath */ - if (state == DEVICE_QUEUED) { - devpath = udev_device_get_devpath(udev_device); - devpath_len = strlen(devpath); - } - - /* recover from an earlier failed rebuild */ - if (udev_queue_export->queue_file == NULL) { - if (rebuild_queue_file(udev_queue_export) != 0) - return -1; - } - - /* if we're removing the last event from the queue, that's the best time to rebuild it */ - if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1) { - /* we don't need to read the old queue file */ - fclose(udev_queue_export->queue_file); - udev_queue_export->queue_file = NULL; - rebuild_queue_file(udev_queue_export); - return 0; - } - - /* try to rebuild the queue files before they grow larger than one page. */ - bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); - if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) - rebuild_queue_file(udev_queue_export); - - /* don't record a finished event, if we already dropped the event in a failed rebuild */ - if (seqnum < udev_queue_export->seqnum_max) - return 0; - - /* now write to the queue */ - if (state == DEVICE_QUEUED) { - udev_queue_export->queued_count++; - udev_queue_export->seqnum_min = seqnum; - } else { - udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0); - udev_queue_export->queued_count--; - } - err = write_queue_record(udev_queue_export, seqnum, devpath, devpath_len); - - /* try to handle ENOSPC */ - if (err != 0 && udev_queue_export->queued_count == 0) { - udev_queue_export_cleanup(udev_queue_export); - err = rebuild_queue_file(udev_queue_export); - } - - return err; + unsigned long long int seqnum = udev_device_get_seqnum(udev_device); + const char *devpath = NULL; + size_t devpath_len = 0; + int bytes; + int err; + + /* FINISHED records have a zero length devpath */ + if (state == DEVICE_QUEUED) { + devpath = udev_device_get_devpath(udev_device); + devpath_len = strlen(devpath); + } + + /* recover from an earlier failed rebuild */ + if (udev_queue_export->queue_file == NULL) { + if (rebuild_queue_file(udev_queue_export) != 0) + return -1; + } + + /* if we're removing the last event from the queue, that's the best time to rebuild it */ + if (state != DEVICE_QUEUED && udev_queue_export->queued_count == 1) { + /* we don't need to read the old queue file */ + fclose(udev_queue_export->queue_file); + udev_queue_export->queue_file = NULL; + rebuild_queue_file(udev_queue_export); + return 0; + } + + /* try to rebuild the queue files before they grow larger than one page. */ + bytes = ftell(udev_queue_export->queue_file) + queue_record_size(devpath_len); + if ((udev_queue_export->waste_bytes > bytes / 2) && bytes > 4096) + rebuild_queue_file(udev_queue_export); + + /* don't record a finished event, if we already dropped the event in a failed rebuild */ + if (seqnum < udev_queue_export->seqnum_max) + return 0; + + /* now write to the queue */ + if (state == DEVICE_QUEUED) { + udev_queue_export->queued_count++; + udev_queue_export->seqnum_min = seqnum; + } else { + udev_queue_export->waste_bytes += queue_record_size(devpath_len) + queue_record_size(0); + udev_queue_export->queued_count--; + } + err = write_queue_record(udev_queue_export, seqnum, devpath, devpath_len); + + /* try to handle ENOSPC */ + if (err != 0 && udev_queue_export->queued_count == 0) { + udev_queue_export_cleanup(udev_queue_export); + err = rebuild_queue_file(udev_queue_export); + } + + return err; } static int update(struct udev_queue_export *udev_queue_export, - struct udev_device *udev_device, enum device_state state) + struct udev_device *udev_device, enum device_state state) { - if (update_queue(udev_queue_export, udev_device, state) != 0) - return -1; + if (update_queue(udev_queue_export, udev_device, state) != 0) + return -1; - return 0; + return 0; } int udev_queue_export_device_queued(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) { - return update(udev_queue_export, udev_device, DEVICE_QUEUED); + return update(udev_queue_export, udev_device, DEVICE_QUEUED); } int udev_queue_export_device_finished(struct udev_queue_export *udev_queue_export, struct udev_device *udev_device) { - return update(udev_queue_export, udev_device, DEVICE_FINISHED); + return update(udev_queue_export, udev_device, DEVICE_FINISHED); } diff --git a/src/libudev-queue.c b/src/libudev-queue.c index 3d46b67d19..7a4b563cfa 100644 --- a/src/libudev-queue.c +++ b/src/libudev-queue.c @@ -40,9 +40,9 @@ * Opaque object representing the current event queue in the udev daemon. */ struct udev_queue { - struct udev *udev; - int refcount; - struct udev_list queue_list; + struct udev *udev; + int refcount; + struct udev_list queue_list; }; /** @@ -56,18 +56,18 @@ struct udev_queue { **/ UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev) { - struct udev_queue *udev_queue; - - if (udev == NULL) - return NULL; - - udev_queue = calloc(1, sizeof(struct udev_queue)); - if (udev_queue == NULL) - return NULL; - udev_queue->refcount = 1; - udev_queue->udev = udev; - udev_list_init(udev, &udev_queue->queue_list, false); - return udev_queue; + struct udev_queue *udev_queue; + + if (udev == NULL) + return NULL; + + udev_queue = calloc(1, sizeof(struct udev_queue)); + if (udev_queue == NULL) + return NULL; + udev_queue->refcount = 1; + udev_queue->udev = udev; + udev_list_init(udev, &udev_queue->queue_list, false); + return udev_queue; } /** @@ -80,10 +80,10 @@ UDEV_EXPORT struct udev_queue *udev_queue_new(struct udev *udev) **/ UDEV_EXPORT struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) { - if (udev_queue == NULL) - return NULL; - udev_queue->refcount++; - return udev_queue; + if (udev_queue == NULL) + return NULL; + udev_queue->refcount++; + return udev_queue; } /** @@ -95,13 +95,13 @@ UDEV_EXPORT struct udev_queue *udev_queue_ref(struct udev_queue *udev_queue) **/ UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue) { - if (udev_queue == NULL) - return; - udev_queue->refcount--; - if (udev_queue->refcount > 0) - return; - udev_list_cleanup(&udev_queue->queue_list); - free(udev_queue); + if (udev_queue == NULL) + return; + udev_queue->refcount--; + if (udev_queue->refcount > 0) + return; + udev_list_cleanup(&udev_queue->queue_list); + free(udev_queue); } /** @@ -114,30 +114,30 @@ UDEV_EXPORT void udev_queue_unref(struct udev_queue *udev_queue) **/ UDEV_EXPORT struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) { - if (udev_queue == NULL) - return NULL; - return udev_queue->udev; + if (udev_queue == NULL) + return NULL; + return udev_queue->udev; } unsigned long long int udev_get_kernel_seqnum(struct udev *udev) { - char filename[UTIL_PATH_SIZE]; - unsigned long long int seqnum; - int fd; - char buf[32]; - ssize_t len; - - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); - fd = open(filename, O_RDONLY|O_CLOEXEC); - if (fd < 0) - return 0; - len = read(fd, buf, sizeof(buf)); - close(fd); - if (len <= 2) - return 0; - buf[len-1] = '\0'; - seqnum = strtoull(buf, NULL, 10); - return seqnum; + char filename[UTIL_PATH_SIZE]; + unsigned long long int seqnum; + int fd; + char buf[32]; + ssize_t len; + + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/kernel/uevent_seqnum", NULL); + fd = open(filename, O_RDONLY|O_CLOEXEC); + if (fd < 0) + return 0; + len = read(fd, buf, sizeof(buf)); + close(fd); + if (len <= 2) + return 0; + buf[len-1] = '\0'; + seqnum = strtoull(buf, NULL, 10); + return seqnum; } /** @@ -148,81 +148,81 @@ unsigned long long int udev_get_kernel_seqnum(struct udev *udev) **/ UDEV_EXPORT unsigned long long int udev_queue_get_kernel_seqnum(struct udev_queue *udev_queue) { - unsigned long long int seqnum; + unsigned long long int seqnum; - if (udev_queue == NULL) - return -EINVAL; + if (udev_queue == NULL) + return -EINVAL; - seqnum = udev_get_kernel_seqnum(udev_queue->udev); - dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); - return seqnum; + seqnum = udev_get_kernel_seqnum(udev_queue->udev); + dbg(udev_queue->udev, "seqnum=%llu\n", seqnum); + return seqnum; } int udev_queue_read_seqnum(FILE *queue_file, unsigned long long int *seqnum) { - if (fread(seqnum, sizeof(unsigned long long int), 1, queue_file) != 1) - return -1; + if (fread(seqnum, sizeof(unsigned long long int), 1, queue_file) != 1) + return -1; - return 0; + return 0; } ssize_t udev_queue_skip_devpath(FILE *queue_file) { - unsigned short int len; + unsigned short int len; - if (fread(&len, sizeof(unsigned short int), 1, queue_file) == 1) { - char devpath[len]; + if (fread(&len, sizeof(unsigned short int), 1, queue_file) == 1) { + char devpath[len]; - /* use fread to skip, fseek might drop buffered data */ - if (fread(devpath, 1, len, queue_file) == len) - return len; - } + /* use fread to skip, fseek might drop buffered data */ + if (fread(devpath, 1, len, queue_file) == len) + return len; + } - return -1; + return -1; } ssize_t udev_queue_read_devpath(FILE *queue_file, char *devpath, size_t size) { - unsigned short int read_bytes = 0; - unsigned short int len; + unsigned short int read_bytes = 0; + unsigned short int len; - if (fread(&len, sizeof(unsigned short int), 1, queue_file) != 1) - return -1; + if (fread(&len, sizeof(unsigned short int), 1, queue_file) != 1) + return -1; - read_bytes = (len < size - 1) ? len : size - 1; - if (fread(devpath, 1, read_bytes, queue_file) != read_bytes) - return -1; - devpath[read_bytes] = '\0'; + read_bytes = (len < size - 1) ? len : size - 1; + if (fread(devpath, 1, read_bytes, queue_file) != read_bytes) + return -1; + devpath[read_bytes] = '\0'; - /* if devpath was too long, skip unread characters */ - if (read_bytes != len) { - unsigned short int skip_bytes = len - read_bytes; - char buf[skip_bytes]; + /* if devpath was too long, skip unread characters */ + if (read_bytes != len) { + unsigned short int skip_bytes = len - read_bytes; + char buf[skip_bytes]; - if (fread(buf, 1, skip_bytes, queue_file) != skip_bytes) - return -1; - } + if (fread(buf, 1, skip_bytes, queue_file) != skip_bytes) + return -1; + } - return read_bytes; + return read_bytes; } static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long int *seqnum_start) { - char filename[UTIL_PATH_SIZE]; - FILE *queue_file; + char filename[UTIL_PATH_SIZE]; + FILE *queue_file; - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue->udev), "/queue.bin", NULL); - queue_file = fopen(filename, "re"); - if (queue_file == NULL) - return NULL; + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev_queue->udev), "/queue.bin", NULL); + queue_file = fopen(filename, "re"); + if (queue_file == NULL) + return NULL; - if (udev_queue_read_seqnum(queue_file, seqnum_start) < 0) { - err(udev_queue->udev, "corrupt queue file\n"); - fclose(queue_file); - return NULL; - } + if (udev_queue_read_seqnum(queue_file, seqnum_start) < 0) { + err(udev_queue->udev, "corrupt queue file\n"); + fclose(queue_file); + return NULL; + } - return queue_file; + return queue_file; } /** @@ -233,28 +233,28 @@ static FILE *open_queue_file(struct udev_queue *udev_queue, unsigned long long i **/ UDEV_EXPORT unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue *udev_queue) { - unsigned long long int seqnum_udev; - FILE *queue_file; - - queue_file = open_queue_file(udev_queue, &seqnum_udev); - if (queue_file == NULL) - return 0; - - for (;;) { - unsigned long long int seqnum; - ssize_t devpath_len; - - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - devpath_len = udev_queue_skip_devpath(queue_file); - if (devpath_len < 0) - break; - if (devpath_len > 0) - seqnum_udev = seqnum; - } - - fclose(queue_file); - return seqnum_udev; + unsigned long long int seqnum_udev; + FILE *queue_file; + + queue_file = open_queue_file(udev_queue, &seqnum_udev); + if (queue_file == NULL) + return 0; + + for (;;) { + unsigned long long int seqnum; + ssize_t devpath_len; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + if (devpath_len > 0) + seqnum_udev = seqnum; + } + + fclose(queue_file); + return seqnum_udev; } /** @@ -265,15 +265,15 @@ UDEV_EXPORT unsigned long long int udev_queue_get_udev_seqnum(struct udev_queue **/ UDEV_EXPORT int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) { - unsigned long long int seqnum_start; - FILE *queue_file; + unsigned long long int seqnum_start; + FILE *queue_file; - queue_file = open_queue_file(udev_queue, &seqnum_start); - if (queue_file == NULL) - return 0; + queue_file = open_queue_file(udev_queue, &seqnum_start); + if (queue_file == NULL) + return 0; - fclose(queue_file); - return 1; + fclose(queue_file); + return 1; } /** @@ -284,54 +284,54 @@ UDEV_EXPORT int udev_queue_get_udev_is_active(struct udev_queue *udev_queue) **/ UDEV_EXPORT int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) { - unsigned long long int seqnum_kernel; - unsigned long long int seqnum_udev = 0; - int queued = 0; - int is_empty = 0; - FILE *queue_file; - - if (udev_queue == NULL) - return -EINVAL; - queue_file = open_queue_file(udev_queue, &seqnum_udev); - if (queue_file == NULL) - return 1; - - for (;;) { - unsigned long long int seqnum; - ssize_t devpath_len; - - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - devpath_len = udev_queue_skip_devpath(queue_file); - if (devpath_len < 0) - break; - - if (devpath_len > 0) { - queued++; - seqnum_udev = seqnum; - } else { - queued--; - } - } - - if (queued > 0) { - dbg(udev_queue->udev, "queue is not empty\n"); - goto out; - } - - seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); - if (seqnum_udev < seqnum_kernel) { - dbg(udev_queue->udev, "queue is empty but kernel events still pending [%llu]<->[%llu]\n", - seqnum_kernel, seqnum_udev); - goto out; - } - - dbg(udev_queue->udev, "queue is empty\n"); - is_empty = 1; + unsigned long long int seqnum_kernel; + unsigned long long int seqnum_udev = 0; + int queued = 0; + int is_empty = 0; + FILE *queue_file; + + if (udev_queue == NULL) + return -EINVAL; + queue_file = open_queue_file(udev_queue, &seqnum_udev); + if (queue_file == NULL) + return 1; + + for (;;) { + unsigned long long int seqnum; + ssize_t devpath_len; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + + if (devpath_len > 0) { + queued++; + seqnum_udev = seqnum; + } else { + queued--; + } + } + + if (queued > 0) { + dbg(udev_queue->udev, "queue is not empty\n"); + goto out; + } + + seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); + if (seqnum_udev < seqnum_kernel) { + dbg(udev_queue->udev, "queue is empty but kernel events still pending [%llu]<->[%llu]\n", + seqnum_kernel, seqnum_udev); + goto out; + } + + dbg(udev_queue->udev, "queue is empty\n"); + is_empty = 1; out: - fclose(queue_file); - return is_empty; + fclose(queue_file); + return is_empty; } /** @@ -343,58 +343,58 @@ out: * Returns: a flag indicating if any of the sequence numbers in the given range is currently active. **/ UDEV_EXPORT int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, - unsigned long long int start, unsigned long long int end) + unsigned long long int start, unsigned long long int end) { - unsigned long long int seqnum; - ssize_t devpath_len; - int unfinished; - FILE *queue_file; - - if (udev_queue == NULL) - return -EINVAL; - queue_file = open_queue_file(udev_queue, &seqnum); - if (queue_file == NULL) - return 1; - if (start < seqnum) - start = seqnum; - if (start > end) { - fclose(queue_file); - return 1; - } - if (end - start > INT_MAX - 1) { - fclose(queue_file); - return -EOVERFLOW; - } - - /* - * we might start with 0, and handle the initial seqnum - * only when we find an entry in the queue file - **/ - unfinished = end - start; - - do { - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - devpath_len = udev_queue_skip_devpath(queue_file); - if (devpath_len < 0) - break; - - /* - * we might start with an empty or re-build queue file, where - * the initial seqnum is not recorded as finished - */ - if (start == seqnum && devpath_len > 0) - unfinished++; - - if (devpath_len == 0) { - if (seqnum >= start && seqnum <= end) - unfinished--; - } - } while (unfinished > 0); - - fclose(queue_file); - - return (unfinished == 0); + unsigned long long int seqnum; + ssize_t devpath_len; + int unfinished; + FILE *queue_file; + + if (udev_queue == NULL) + return -EINVAL; + queue_file = open_queue_file(udev_queue, &seqnum); + if (queue_file == NULL) + return 1; + if (start < seqnum) + start = seqnum; + if (start > end) { + fclose(queue_file); + return 1; + } + if (end - start > INT_MAX - 1) { + fclose(queue_file); + return -EOVERFLOW; + } + + /* + * we might start with 0, and handle the initial seqnum + * only when we find an entry in the queue file + **/ + unfinished = end - start; + + do { + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + devpath_len = udev_queue_skip_devpath(queue_file); + if (devpath_len < 0) + break; + + /* + * we might start with an empty or re-build queue file, where + * the initial seqnum is not recorded as finished + */ + if (start == seqnum && devpath_len > 0) + unfinished++; + + if (devpath_len == 0) { + if (seqnum >= start && seqnum <= end) + unfinished--; + } + } while (unfinished > 0); + + fclose(queue_file); + + return (unfinished == 0); } /** @@ -406,11 +406,11 @@ UDEV_EXPORT int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *ud **/ UDEV_EXPORT int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum) { - if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) - return 0; + if (!udev_queue_get_seqnum_sequence_is_finished(udev_queue, seqnum, seqnum)) + return 0; - dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum); - return 1; + dbg(udev_queue->udev, "seqnum: %llu finished\n", seqnum); + return 1; } /** @@ -421,54 +421,54 @@ UDEV_EXPORT int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, **/ UDEV_EXPORT struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue) { - unsigned long long int seqnum; - FILE *queue_file; - - if (udev_queue == NULL) - return NULL; - udev_list_cleanup(&udev_queue->queue_list); - - queue_file = open_queue_file(udev_queue, &seqnum); - if (queue_file == NULL) - return NULL; - - for (;;) { - char syspath[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - char seqnum_str[32]; - struct udev_list_entry *list_entry; - - if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) - break; - snprintf(seqnum_str, sizeof(seqnum_str), "%llu", seqnum); - - s = syspath; - l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); - len = udev_queue_read_devpath(queue_file, s, l); - if (len < 0) - break; - - if (len > 0) { - udev_list_entry_add(&udev_queue->queue_list, syspath, seqnum_str); - } else { - udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { - if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { - udev_list_entry_delete(list_entry); - break; - } - } - } - } - fclose(queue_file); - - return udev_list_get_entry(&udev_queue->queue_list); + unsigned long long int seqnum; + FILE *queue_file; + + if (udev_queue == NULL) + return NULL; + udev_list_cleanup(&udev_queue->queue_list); + + queue_file = open_queue_file(udev_queue, &seqnum); + if (queue_file == NULL) + return NULL; + + for (;;) { + char syspath[UTIL_PATH_SIZE]; + char *s; + size_t l; + ssize_t len; + char seqnum_str[32]; + struct udev_list_entry *list_entry; + + if (udev_queue_read_seqnum(queue_file, &seqnum) < 0) + break; + snprintf(seqnum_str, sizeof(seqnum_str), "%llu", seqnum); + + s = syspath; + l = util_strpcpyl(&s, sizeof(syspath), udev_get_sys_path(udev_queue->udev), NULL); + len = udev_queue_read_devpath(queue_file, s, l); + if (len < 0) + break; + + if (len > 0) { + udev_list_entry_add(&udev_queue->queue_list, syspath, seqnum_str); + } else { + udev_list_entry_foreach(list_entry, udev_list_get_entry(&udev_queue->queue_list)) { + if (strcmp(seqnum_str, udev_list_entry_get_value(list_entry)) == 0) { + udev_list_entry_delete(list_entry); + break; + } + } + } + } + fclose(queue_file); + + return udev_list_get_entry(&udev_queue->queue_list); } struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue); UDEV_EXPORT struct udev_list_entry *udev_queue_get_failed_list_entry(struct udev_queue *udev_queue) { - errno = ENOSYS; - return NULL; + errno = ENOSYS; + return NULL; } diff --git a/src/libudev-selinux-private.c b/src/libudev-selinux-private.c index cb06a280f7..0f2a617b18 100644 --- a/src/libudev-selinux-private.c +++ b/src/libudev-selinux-private.c @@ -24,86 +24,86 @@ security_context_t selinux_prev_scontext; void udev_selinux_init(struct udev *udev) { - /* record the present security context */ - selinux_enabled = (is_selinux_enabled() > 0); - info(udev, "selinux=%i\n", selinux_enabled); - if (!selinux_enabled) - return; - matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); - if (getfscreatecon(&selinux_prev_scontext) < 0) { - err(udev, "getfscreatecon failed\n"); - selinux_prev_scontext = NULL; - } + /* record the present security context */ + selinux_enabled = (is_selinux_enabled() > 0); + info(udev, "selinux=%i\n", selinux_enabled); + if (!selinux_enabled) + return; + matchpathcon_init_prefix(NULL, udev_get_dev_path(udev)); + if (getfscreatecon(&selinux_prev_scontext) < 0) { + err(udev, "getfscreatecon failed\n"); + selinux_prev_scontext = NULL; + } } void udev_selinux_exit(struct udev *udev) { - if (!selinux_enabled) - return; - freecon(selinux_prev_scontext); - selinux_prev_scontext = NULL; + if (!selinux_enabled) + return; + freecon(selinux_prev_scontext); + selinux_prev_scontext = NULL; } void udev_selinux_lsetfilecon(struct udev *udev, const char *file, unsigned int mode) { - security_context_t scontext = NULL; - - if (!selinux_enabled) - return; - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (lsetfilecon(file, scontext) < 0) - err(udev, "setfilecon %s failed: %m\n", file); - freecon(scontext); + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (lsetfilecon(file, scontext) < 0) + err(udev, "setfilecon %s failed: %m\n", file); + freecon(scontext); } void udev_selinux_setfscreatecon(struct udev *udev, const char *file, unsigned int mode) { - security_context_t scontext = NULL; - - if (!selinux_enabled) - return; - - if (matchpathcon(file, mode, &scontext) < 0) { - err(udev, "matchpathcon(%s) failed\n", file); - return; - } - if (setfscreatecon(scontext) < 0) - err(udev, "setfscreatecon %s failed: %m\n", file); - freecon(scontext); + security_context_t scontext = NULL; + + if (!selinux_enabled) + return; + + if (matchpathcon(file, mode, &scontext) < 0) { + err(udev, "matchpathcon(%s) failed\n", file); + return; + } + if (setfscreatecon(scontext) < 0) + err(udev, "setfscreatecon %s failed: %m\n", file); + freecon(scontext); } void udev_selinux_resetfscreatecon(struct udev *udev) { - if (!selinux_enabled) - return; - if (setfscreatecon(selinux_prev_scontext) < 0) - err(udev, "setfscreatecon failed: %m\n"); + if (!selinux_enabled) + return; + if (setfscreatecon(selinux_prev_scontext) < 0) + err(udev, "setfscreatecon failed: %m\n"); } void udev_selinux_setfscreateconat(struct udev *udev, int dfd, const char *file, unsigned int mode) { - char filename[UTIL_PATH_SIZE]; - - if (!selinux_enabled) - return; - - /* resolve relative filename */ - if (file[0] != '/') { - char procfd[UTIL_PATH_SIZE]; - char target[UTIL_PATH_SIZE]; - ssize_t len; - - snprintf(procfd, sizeof(procfd), "/proc/%u/fd/%u", getpid(), dfd); - len = readlink(procfd, target, sizeof(target)); - if (len <= 0 || len == sizeof(target)) - return; - target[len] = '\0'; - - util_strscpyl(filename, sizeof(filename), target, "/", file, NULL); - file = filename; - } - udev_selinux_setfscreatecon(udev, file, mode); + char filename[UTIL_PATH_SIZE]; + + if (!selinux_enabled) + return; + + /* resolve relative filename */ + if (file[0] != '/') { + char procfd[UTIL_PATH_SIZE]; + char target[UTIL_PATH_SIZE]; + ssize_t len; + + snprintf(procfd, sizeof(procfd), "/proc/%u/fd/%u", getpid(), dfd); + len = readlink(procfd, target, sizeof(target)); + if (len <= 0 || len == sizeof(target)) + return; + target[len] = '\0'; + + util_strscpyl(filename, sizeof(filename), target, "/", file, NULL); + file = filename; + } + udev_selinux_setfscreatecon(udev, file, mode); } diff --git a/src/libudev-util-private.c b/src/libudev-util-private.c index 015e6d5862..08f0ba2228 100644 --- a/src/libudev-util-private.c +++ b/src/libudev-util-private.c @@ -26,217 +26,217 @@ static int create_path(struct udev *udev, const char *path, bool selinux) { - char p[UTIL_PATH_SIZE]; - char *pos; - struct stat stats; - int err; - - util_strscpy(p, sizeof(p), path); - pos = strrchr(p, '/'); - if (pos == NULL) - return 0; - while (pos != p && pos[-1] == '/') - pos--; - if (pos == p) - return 0; - pos[0] = '\0'; - - dbg(udev, "stat '%s'\n", p); - if (stat(p, &stats) == 0) { - if ((stats.st_mode & S_IFMT) == S_IFDIR) - return 0; - else - return -ENOTDIR; - } - - err = util_create_path(udev, p); - if (err != 0) - return err; - - dbg(udev, "mkdir '%s'\n", p); - if (selinux) - udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); - err = mkdir(p, 0755); - if (err != 0) { - err = -errno; - if (err == -EEXIST && stat(p, &stats) == 0) { - if ((stats.st_mode & S_IFMT) == S_IFDIR) - err = 0; - else - err = -ENOTDIR; - } - } - if (selinux) - udev_selinux_resetfscreatecon(udev); - return err; + char p[UTIL_PATH_SIZE]; + char *pos; + struct stat stats; + int err; + + util_strscpy(p, sizeof(p), path); + pos = strrchr(p, '/'); + if (pos == NULL) + return 0; + while (pos != p && pos[-1] == '/') + pos--; + if (pos == p) + return 0; + pos[0] = '\0'; + + dbg(udev, "stat '%s'\n", p); + if (stat(p, &stats) == 0) { + if ((stats.st_mode & S_IFMT) == S_IFDIR) + return 0; + else + return -ENOTDIR; + } + + err = util_create_path(udev, p); + if (err != 0) + return err; + + dbg(udev, "mkdir '%s'\n", p); + if (selinux) + udev_selinux_setfscreatecon(udev, p, S_IFDIR|0755); + err = mkdir(p, 0755); + if (err != 0) { + err = -errno; + if (err == -EEXIST && stat(p, &stats) == 0) { + if ((stats.st_mode & S_IFMT) == S_IFDIR) + err = 0; + else + err = -ENOTDIR; + } + } + if (selinux) + udev_selinux_resetfscreatecon(udev); + return err; } int util_create_path(struct udev *udev, const char *path) { - return create_path(udev, path, false); + return create_path(udev, path, false); } int util_create_path_selinux(struct udev *udev, const char *path) { - return create_path(udev, path, true); + return create_path(udev, path, true); } int util_delete_path(struct udev *udev, const char *path) { - char p[UTIL_PATH_SIZE]; - char *pos; - int err = 0; - - if (path[0] == '/') - while(path[1] == '/') - path++; - util_strscpy(p, sizeof(p), path); - pos = strrchr(p, '/'); - if (pos == p || pos == NULL) - return 0; - - for (;;) { - *pos = '\0'; - pos = strrchr(p, '/'); - - /* don't remove the last one */ - if ((pos == p) || (pos == NULL)) - break; - - err = rmdir(p); - if (err < 0) { - if (errno == ENOENT) - err = 0; - break; - } - } - return err; + char p[UTIL_PATH_SIZE]; + char *pos; + int err = 0; + + if (path[0] == '/') + while(path[1] == '/') + path++; + util_strscpy(p, sizeof(p), path); + pos = strrchr(p, '/'); + if (pos == p || pos == NULL) + return 0; + + for (;;) { + *pos = '\0'; + pos = strrchr(p, '/'); + + /* don't remove the last one */ + if ((pos == p) || (pos == NULL)) + break; + + err = rmdir(p); + if (err < 0) { + if (errno == ENOENT) + err = 0; + break; + } + } + return err; } uid_t util_lookup_user(struct udev *udev, const char *user) { - char *endptr; - size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); - char buf[buflen]; - struct passwd pwbuf; - struct passwd *pw; - uid_t uid; - - if (strcmp(user, "root") == 0) - return 0; - uid = strtoul(user, &endptr, 10); - if (endptr[0] == '\0') - return uid; - - errno = getpwnam_r(user, &pwbuf, buf, buflen, &pw); - if (pw != NULL) - return pw->pw_uid; - if (errno == 0 || errno == ENOENT || errno == ESRCH) - err(udev, "specified user '%s' unknown\n", user); - else - err(udev, "error resolving user '%s': %m\n", user); - return 0; + char *endptr; + size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX); + char buf[buflen]; + struct passwd pwbuf; + struct passwd *pw; + uid_t uid; + + if (strcmp(user, "root") == 0) + return 0; + uid = strtoul(user, &endptr, 10); + if (endptr[0] == '\0') + return uid; + + errno = getpwnam_r(user, &pwbuf, buf, buflen, &pw); + if (pw != NULL) + return pw->pw_uid; + if (errno == 0 || errno == ENOENT || errno == ESRCH) + err(udev, "specified user '%s' unknown\n", user); + else + err(udev, "error resolving user '%s': %m\n", user); + return 0; } gid_t util_lookup_group(struct udev *udev, const char *group) { - char *endptr; - size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX); - char *buf; - struct group grbuf; - struct group *gr; - gid_t gid = 0; - - if (strcmp(group, "root") == 0) - return 0; - gid = strtoul(group, &endptr, 10); - if (endptr[0] == '\0') - return gid; - buf = NULL; - gid = 0; - for (;;) { - char *newbuf; - - newbuf = realloc(buf, buflen); - if (!newbuf) - break; - buf = newbuf; - errno = getgrnam_r(group, &grbuf, buf, buflen, &gr); - if (gr != NULL) { - gid = gr->gr_gid; - } else if (errno == ERANGE) { - buflen *= 2; - continue; - } else if (errno == 0 || errno == ENOENT || errno == ESRCH) { - err(udev, "specified group '%s' unknown\n", group); - } else { - err(udev, "error resolving group '%s': %m\n", group); - } - break; - } - free(buf); - return gid; + char *endptr; + size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX); + char *buf; + struct group grbuf; + struct group *gr; + gid_t gid = 0; + + if (strcmp(group, "root") == 0) + return 0; + gid = strtoul(group, &endptr, 10); + if (endptr[0] == '\0') + return gid; + buf = NULL; + gid = 0; + for (;;) { + char *newbuf; + + newbuf = realloc(buf, buflen); + if (!newbuf) + break; + buf = newbuf; + errno = getgrnam_r(group, &grbuf, buf, buflen, &gr); + if (gr != NULL) { + gid = gr->gr_gid; + } else if (errno == ERANGE) { + buflen *= 2; + continue; + } else if (errno == 0 || errno == ENOENT || errno == ESRCH) { + err(udev, "specified group '%s' unknown\n", group); + } else { + err(udev, "error resolving group '%s': %m\n", group); + } + break; + } + free(buf); + return gid; } /* handle "[/]" format */ int util_resolve_subsys_kernel(struct udev *udev, const char *string, - char *result, size_t maxsize, int read_value) + char *result, size_t maxsize, int read_value) { - char temp[UTIL_PATH_SIZE]; - char *subsys; - char *sysname; - struct udev_device *dev; - char *attr; - - if (string[0] != '[') - return -1; - - util_strscpy(temp, sizeof(temp), string); - - subsys = &temp[1]; - - sysname = strchr(subsys, '/'); - if (sysname == NULL) - return -1; - sysname[0] = '\0'; - sysname = &sysname[1]; - - attr = strchr(sysname, ']'); - if (attr == NULL) - return -1; - attr[0] = '\0'; - attr = &attr[1]; - if (attr[0] == '/') - attr = &attr[1]; - if (attr[0] == '\0') - attr = NULL; - - if (read_value && attr == NULL) - return -1; - - dev = udev_device_new_from_subsystem_sysname(udev, subsys, sysname); - if (dev == NULL) - return -1; - - if (read_value) { - const char *val; - - val = udev_device_get_sysattr_value(dev, attr); - if (val != NULL) - util_strscpy(result, maxsize, val); - else - result[0] = '\0'; - info(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); - } else { - size_t l; - char *s; - - s = result; - l = util_strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL); - if (attr != NULL) - util_strpcpyl(&s, l, "/", attr, NULL); - info(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); - } - udev_device_unref(dev); - return 0; + char temp[UTIL_PATH_SIZE]; + char *subsys; + char *sysname; + struct udev_device *dev; + char *attr; + + if (string[0] != '[') + return -1; + + util_strscpy(temp, sizeof(temp), string); + + subsys = &temp[1]; + + sysname = strchr(subsys, '/'); + if (sysname == NULL) + return -1; + sysname[0] = '\0'; + sysname = &sysname[1]; + + attr = strchr(sysname, ']'); + if (attr == NULL) + return -1; + attr[0] = '\0'; + attr = &attr[1]; + if (attr[0] == '/') + attr = &attr[1]; + if (attr[0] == '\0') + attr = NULL; + + if (read_value && attr == NULL) + return -1; + + dev = udev_device_new_from_subsystem_sysname(udev, subsys, sysname); + if (dev == NULL) + return -1; + + if (read_value) { + const char *val; + + val = udev_device_get_sysattr_value(dev, attr); + if (val != NULL) + util_strscpy(result, maxsize, val); + else + result[0] = '\0'; + info(udev, "value '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } else { + size_t l; + char *s; + + s = result; + l = util_strpcpyl(&s, maxsize, udev_device_get_syspath(dev), NULL); + if (attr != NULL) + util_strpcpyl(&s, l, "/", attr, NULL); + info(udev, "path '[%s/%s]%s' is '%s'\n", subsys, sysname, attr, result); + } + udev_device_unref(dev); + return 0; } diff --git a/src/libudev-util.c b/src/libudev-util.c index 559aa06dc6..a795329f7c 100644 --- a/src/libudev-util.c +++ b/src/libudev-util.c @@ -31,131 +31,131 @@ ssize_t util_get_sys_core_link_value(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size) { - char path[UTIL_PATH_SIZE]; - char target[UTIL_PATH_SIZE]; - ssize_t len; - const char *pos; - - util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL); - len = readlink(path, target, sizeof(target)); - if (len <= 0 || len == (ssize_t)sizeof(target)) - return -1; - target[len] = '\0'; - pos = strrchr(target, '/'); - if (pos == NULL) - return -1; - pos = &pos[1]; - dbg(udev, "resolved link to: '%s'\n", pos); - return util_strscpy(value, size, pos); + char path[UTIL_PATH_SIZE]; + char target[UTIL_PATH_SIZE]; + ssize_t len; + const char *pos; + + util_strscpyl(path, sizeof(path), syspath, "/", slink, NULL); + len = readlink(path, target, sizeof(target)); + if (len <= 0 || len == (ssize_t)sizeof(target)) + return -1; + target[len] = '\0'; + pos = strrchr(target, '/'); + if (pos == NULL) + return -1; + pos = &pos[1]; + dbg(udev, "resolved link to: '%s'\n", pos); + return util_strscpy(value, size, pos); } int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) { - char link_target[UTIL_PATH_SIZE]; - - ssize_t len; - int i; - int back; - char *base; - - len = readlink(syspath, link_target, sizeof(link_target)); - if (len <= 0 || len == (ssize_t)sizeof(link_target)) - return -1; - link_target[len] = '\0'; - dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target); - - for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) - ; - dbg(udev, "base '%s', tail '%s', back %i\n", syspath, &link_target[back * 3], back); - for (i = 0; i <= back; i++) { - base = strrchr(syspath, '/'); - if (base == NULL) - return -1; - base[0] = '\0'; - } - dbg(udev, "after moving back '%s'\n", syspath); - util_strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL); - return 0; + char link_target[UTIL_PATH_SIZE]; + + ssize_t len; + int i; + int back; + char *base; + + len = readlink(syspath, link_target, sizeof(link_target)); + if (len <= 0 || len == (ssize_t)sizeof(link_target)) + return -1; + link_target[len] = '\0'; + dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target); + + for (back = 0; strncmp(&link_target[back * 3], "../", 3) == 0; back++) + ; + dbg(udev, "base '%s', tail '%s', back %i\n", syspath, &link_target[back * 3], back); + for (i = 0; i <= back; i++) { + base = strrchr(syspath, '/'); + if (base == NULL) + return -1; + base[0] = '\0'; + } + dbg(udev, "after moving back '%s'\n", syspath); + util_strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL); + return 0; } int util_log_priority(const char *priority) { - char *endptr; - int prio; - - prio = strtol(priority, &endptr, 10); - if (endptr[0] == '\0' || isspace(endptr[0])) - return prio; - if (strncmp(priority, "err", 3) == 0) - return LOG_ERR; - if (strncmp(priority, "info", 4) == 0) - return LOG_INFO; - if (strncmp(priority, "debug", 5) == 0) - return LOG_DEBUG; - return 0; + char *endptr; + int prio; + + prio = strtol(priority, &endptr, 10); + if (endptr[0] == '\0' || isspace(endptr[0])) + return prio; + if (strncmp(priority, "err", 3) == 0) + return LOG_ERR; + if (strncmp(priority, "info", 4) == 0) + return LOG_INFO; + if (strncmp(priority, "debug", 5) == 0) + return LOG_DEBUG; + return 0; } size_t util_path_encode(const char *src, char *dest, size_t size) { - size_t i, j; - - for (i = 0, j = 0; src[i] != '\0'; i++) { - if (src[i] == '/') { - if (j+4 >= size) { - j = 0; - break; - } - memcpy(&dest[j], "\\x2f", 4); - j += 4; - } else if (src[i] == '\\') { - if (j+4 >= size) { - j = 0; - break; - } - memcpy(&dest[j], "\\x5c", 4); - j += 4; - } else { - if (j+1 >= size) { - j = 0; - break; - } - dest[j] = src[i]; - j++; - } - } - dest[j] = '\0'; - return j; + size_t i, j; + + for (i = 0, j = 0; src[i] != '\0'; i++) { + if (src[i] == '/') { + if (j+4 >= size) { + j = 0; + break; + } + memcpy(&dest[j], "\\x2f", 4); + j += 4; + } else if (src[i] == '\\') { + if (j+4 >= size) { + j = 0; + break; + } + memcpy(&dest[j], "\\x5c", 4); + j += 4; + } else { + if (j+1 >= size) { + j = 0; + break; + } + dest[j] = src[i]; + j++; + } + } + dest[j] = '\0'; + return j; } size_t util_path_decode(char *s) { - size_t i, j; - - for (i = 0, j = 0; s[i] != '\0'; j++) { - if (memcmp(&s[i], "\\x2f", 4) == 0) { - s[j] = '/'; - i += 4; - } else if (memcmp(&s[i], "\\x5c", 4) == 0) { - s[j] = '\\'; - i += 4; - } else { - s[j] = s[i]; - i++; - } - } - s[j] = '\0'; - return j; + size_t i, j; + + for (i = 0, j = 0; s[i] != '\0'; j++) { + if (memcmp(&s[i], "\\x2f", 4) == 0) { + s[j] = '/'; + i += 4; + } else if (memcmp(&s[i], "\\x5c", 4) == 0) { + s[j] = '\\'; + i += 4; + } else { + s[j] = s[i]; + i++; + } + } + s[j] = '\0'; + return j; } void util_remove_trailing_chars(char *path, char c) { - size_t len; + size_t len; - if (path == NULL) - return; - len = strlen(path); - while (len > 0 && path[len-1] == c) - path[--len] = '\0'; + if (path == NULL) + return; + len = strlen(path); + while (len > 0 && path[len-1] == c) + path[--len] = '\0'; } /* @@ -165,268 +165,268 @@ void util_remove_trailing_chars(char *path, char c) */ size_t util_strpcpy(char **dest, size_t size, const char *src) { - size_t len; - - len = strlen(src); - if (len >= size) { - if (size > 1) - *dest = mempcpy(*dest, src, size-1); - size = 0; - *dest[0] = '\0'; - } else { - if (len > 0) { - *dest = mempcpy(*dest, src, len); - size -= len; - } - *dest[0] = '\0'; - } - return size; + size_t len; + + len = strlen(src); + if (len >= size) { + if (size > 1) + *dest = mempcpy(*dest, src, size-1); + size = 0; + *dest[0] = '\0'; + } else { + if (len > 0) { + *dest = mempcpy(*dest, src, len); + size -= len; + } + *dest[0] = '\0'; + } + return size; } /* concatenates list of strings, moves dest forward */ size_t util_strpcpyl(char **dest, size_t size, const char *src, ...) { - va_list va; + va_list va; - va_start(va, src); - do { - size = util_strpcpy(dest, size, src); - src = va_arg(va, char *); - } while (src != NULL); - va_end(va); + va_start(va, src); + do { + size = util_strpcpy(dest, size, src); + src = va_arg(va, char *); + } while (src != NULL); + va_end(va); - return size; + return size; } /* copies string */ size_t util_strscpy(char *dest, size_t size, const char *src) { - char *s; + char *s; - s = dest; - return util_strpcpy(&s, size, src); + s = dest; + return util_strpcpy(&s, size, src); } /* concatenates list of strings */ size_t util_strscpyl(char *dest, size_t size, const char *src, ...) { - va_list va; - char *s; - - va_start(va, src); - s = dest; - do { - size = util_strpcpy(&s, size, src); - src = va_arg(va, char *); - } while (src != NULL); - va_end(va); - - return size; + va_list va; + char *s; + + va_start(va, src); + s = dest; + do { + size = util_strpcpy(&s, size, src); + src = va_arg(va, char *); + } while (src != NULL); + va_end(va); + + return size; } /* count of characters used to encode one unicode char */ static int utf8_encoded_expected_len(const char *str) { - unsigned char c = (unsigned char)str[0]; - - if (c < 0x80) - return 1; - if ((c & 0xe0) == 0xc0) - return 2; - if ((c & 0xf0) == 0xe0) - return 3; - if ((c & 0xf8) == 0xf0) - return 4; - if ((c & 0xfc) == 0xf8) - return 5; - if ((c & 0xfe) == 0xfc) - return 6; - return 0; + unsigned char c = (unsigned char)str[0]; + + if (c < 0x80) + return 1; + if ((c & 0xe0) == 0xc0) + return 2; + if ((c & 0xf0) == 0xe0) + return 3; + if ((c & 0xf8) == 0xf0) + return 4; + if ((c & 0xfc) == 0xf8) + return 5; + if ((c & 0xfe) == 0xfc) + return 6; + return 0; } /* decode one unicode char */ static int utf8_encoded_to_unichar(const char *str) { - int unichar; - int len; - int i; - - len = utf8_encoded_expected_len(str); - switch (len) { - case 1: - return (int)str[0]; - case 2: - unichar = str[0] & 0x1f; - break; - case 3: - unichar = (int)str[0] & 0x0f; - break; - case 4: - unichar = (int)str[0] & 0x07; - break; - case 5: - unichar = (int)str[0] & 0x03; - break; - case 6: - unichar = (int)str[0] & 0x01; - break; - default: - return -1; - } - - for (i = 1; i < len; i++) { - if (((int)str[i] & 0xc0) != 0x80) - return -1; - unichar <<= 6; - unichar |= (int)str[i] & 0x3f; - } - - return unichar; + int unichar; + int len; + int i; + + len = utf8_encoded_expected_len(str); + switch (len) { + case 1: + return (int)str[0]; + case 2: + unichar = str[0] & 0x1f; + break; + case 3: + unichar = (int)str[0] & 0x0f; + break; + case 4: + unichar = (int)str[0] & 0x07; + break; + case 5: + unichar = (int)str[0] & 0x03; + break; + case 6: + unichar = (int)str[0] & 0x01; + break; + default: + return -1; + } + + for (i = 1; i < len; i++) { + if (((int)str[i] & 0xc0) != 0x80) + return -1; + unichar <<= 6; + unichar |= (int)str[i] & 0x3f; + } + + return unichar; } /* expected size used to encode one unicode char */ static int utf8_unichar_to_encoded_len(int unichar) { - if (unichar < 0x80) - return 1; - if (unichar < 0x800) - return 2; - if (unichar < 0x10000) - return 3; - if (unichar < 0x200000) - return 4; - if (unichar < 0x4000000) - return 5; - return 6; + if (unichar < 0x80) + return 1; + if (unichar < 0x800) + return 2; + if (unichar < 0x10000) + return 3; + if (unichar < 0x200000) + return 4; + if (unichar < 0x4000000) + return 5; + return 6; } /* check if unicode char has a valid numeric range */ static int utf8_unichar_valid_range(int unichar) { - if (unichar > 0x10ffff) - return 0; - if ((unichar & 0xfffff800) == 0xd800) - return 0; - if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) - return 0; - if ((unichar & 0xffff) == 0xffff) - return 0; - return 1; + if (unichar > 0x10ffff) + return 0; + if ((unichar & 0xfffff800) == 0xd800) + return 0; + if ((unichar > 0xfdcf) && (unichar < 0xfdf0)) + return 0; + if ((unichar & 0xffff) == 0xffff) + return 0; + return 1; } /* validate one encoded unicode char and return its length */ static int utf8_encoded_valid_unichar(const char *str) { - int len; - int unichar; - int i; + int len; + int unichar; + int i; - len = utf8_encoded_expected_len(str); - if (len == 0) - return -1; + len = utf8_encoded_expected_len(str); + if (len == 0) + return -1; - /* ascii is valid */ - if (len == 1) - return 1; + /* ascii is valid */ + if (len == 1) + return 1; - /* check if expected encoded chars are available */ - for (i = 0; i < len; i++) - if ((str[i] & 0x80) != 0x80) - return -1; + /* check if expected encoded chars are available */ + for (i = 0; i < len; i++) + if ((str[i] & 0x80) != 0x80) + return -1; - unichar = utf8_encoded_to_unichar(str); + unichar = utf8_encoded_to_unichar(str); - /* check if encoded length matches encoded value */ - if (utf8_unichar_to_encoded_len(unichar) != len) - return -1; + /* check if encoded length matches encoded value */ + if (utf8_unichar_to_encoded_len(unichar) != len) + return -1; - /* check if value has valid range */ - if (!utf8_unichar_valid_range(unichar)) - return -1; + /* check if value has valid range */ + if (!utf8_unichar_valid_range(unichar)) + return -1; - return len; + return len; } int util_replace_whitespace(const char *str, char *to, size_t len) { - size_t i, j; - - /* strip trailing whitespace */ - len = strnlen(str, len); - while (len && isspace(str[len-1])) - len--; - - /* strip leading whitespace */ - i = 0; - while (isspace(str[i]) && (i < len)) - i++; - - j = 0; - while (i < len) { - /* substitute multiple whitespace with a single '_' */ - if (isspace(str[i])) { - while (isspace(str[i])) - i++; - to[j++] = '_'; - } - to[j++] = str[i++]; - } - to[j] = '\0'; - return 0; + size_t i, j; + + /* strip trailing whitespace */ + len = strnlen(str, len); + while (len && isspace(str[len-1])) + len--; + + /* strip leading whitespace */ + i = 0; + while (isspace(str[i]) && (i < len)) + i++; + + j = 0; + while (i < len) { + /* substitute multiple whitespace with a single '_' */ + if (isspace(str[i])) { + while (isspace(str[i])) + i++; + to[j++] = '_'; + } + to[j++] = str[i++]; + } + to[j] = '\0'; + return 0; } static int is_whitelisted(char c, const char *white) { - if ((c >= '0' && c <= '9') || - (c >= 'A' && c <= 'Z') || - (c >= 'a' && c <= 'z') || - strchr("#+-.:=@_", c) != NULL || - (white != NULL && strchr(white, c) != NULL)) - return 1; - return 0; + if ((c >= '0' && c <= '9') || + (c >= 'A' && c <= 'Z') || + (c >= 'a' && c <= 'z') || + strchr("#+-.:=@_", c) != NULL || + (white != NULL && strchr(white, c) != NULL)) + return 1; + return 0; } /* allow chars in whitelist, plain ascii, hex-escaping and valid utf8 */ int util_replace_chars(char *str, const char *white) { - size_t i = 0; - int replaced = 0; - - while (str[i] != '\0') { - int len; - - if (is_whitelisted(str[i], white)) { - i++; - continue; - } - - /* accept hex encoding */ - if (str[i] == '\\' && str[i+1] == 'x') { - i += 2; - continue; - } - - /* accept valid utf8 */ - len = utf8_encoded_valid_unichar(&str[i]); - if (len > 1) { - i += len; - continue; - } - - /* if space is allowed, replace whitespace with ordinary space */ - if (isspace(str[i]) && white != NULL && strchr(white, ' ') != NULL) { - str[i] = ' '; - i++; - replaced++; - continue; - } - - /* everything else is replaced with '_' */ - str[i] = '_'; - i++; - replaced++; - } - return replaced; + size_t i = 0; + int replaced = 0; + + while (str[i] != '\0') { + int len; + + if (is_whitelisted(str[i], white)) { + i++; + continue; + } + + /* accept hex encoding */ + if (str[i] == '\\' && str[i+1] == 'x') { + i += 2; + continue; + } + + /* accept valid utf8 */ + len = utf8_encoded_valid_unichar(&str[i]); + if (len > 1) { + i += len; + continue; + } + + /* if space is allowed, replace whitespace with ordinary space */ + if (isspace(str[i]) && white != NULL && strchr(white, ' ') != NULL) { + str[i] = ' '; + i++; + replaced++; + continue; + } + + /* everything else is replaced with '_' */ + str[i] = '_'; + i++; + replaced++; + } + return replaced; } /** @@ -443,39 +443,39 @@ int util_replace_chars(char *str, const char *white) **/ UDEV_EXPORT int udev_util_encode_string(const char *str, char *str_enc, size_t len) { - size_t i, j; - - if (str == NULL || str_enc == NULL) - return -1; - - for (i = 0, j = 0; str[i] != '\0'; i++) { - int seqlen; - - seqlen = utf8_encoded_valid_unichar(&str[i]); - if (seqlen > 1) { - if (len-j < (size_t)seqlen) - goto err; - memcpy(&str_enc[j], &str[i], seqlen); - j += seqlen; - i += (seqlen-1); - } else if (str[i] == '\\' || !is_whitelisted(str[i], NULL)) { - if (len-j < 4) - goto err; - sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); - j += 4; - } else { - if (len-j < 1) - goto err; - str_enc[j] = str[i]; - j++; - } - } - if (len-j < 1) - goto err; - str_enc[j] = '\0'; - return 0; + size_t i, j; + + if (str == NULL || str_enc == NULL) + return -1; + + for (i = 0, j = 0; str[i] != '\0'; i++) { + int seqlen; + + seqlen = utf8_encoded_valid_unichar(&str[i]); + if (seqlen > 1) { + if (len-j < (size_t)seqlen) + goto err; + memcpy(&str_enc[j], &str[i], seqlen); + j += seqlen; + i += (seqlen-1); + } else if (str[i] == '\\' || !is_whitelisted(str[i], NULL)) { + if (len-j < 4) + goto err; + sprintf(&str_enc[j], "\\x%02x", (unsigned char) str[i]); + j += 4; + } else { + if (len-j < 1) + goto err; + str_enc[j] = str[i]; + j++; + } + } + if (len-j < 1) + goto err; + str_enc[j] = '\0'; + return 0; err: - return -1; + return -1; } /* @@ -487,82 +487,82 @@ err: */ static unsigned int murmur_hash2(const char *key, int len, unsigned int seed) { - /* - * 'm' and 'r' are mixing constants generated offline. - * They're not really 'magic', they just happen to work well. - */ - const unsigned int m = 0x5bd1e995; - const int r = 24; - - /* initialize the hash to a 'random' value */ - unsigned int h = seed ^ len; - - /* mix 4 bytes at a time into the hash */ - const unsigned char * data = (const unsigned char *)key; - - while(len >= 4) { - unsigned int k = *(unsigned int *)data; - - k *= m; - k ^= k >> r; - k *= m; - h *= m; - h ^= k; - - data += 4; - len -= 4; - } - - /* handle the last few bytes of the input array */ - switch(len) { - case 3: - h ^= data[2] << 16; - case 2: - h ^= data[1] << 8; - case 1: - h ^= data[0]; - h *= m; - }; - - /* do a few final mixes of the hash to ensure the last few bytes are well-incorporated */ - h ^= h >> 13; - h *= m; - h ^= h >> 15; - - return h; + /* + * 'm' and 'r' are mixing constants generated offline. + * They're not really 'magic', they just happen to work well. + */ + const unsigned int m = 0x5bd1e995; + const int r = 24; + + /* initialize the hash to a 'random' value */ + unsigned int h = seed ^ len; + + /* mix 4 bytes at a time into the hash */ + const unsigned char * data = (const unsigned char *)key; + + while(len >= 4) { + unsigned int k = *(unsigned int *)data; + + k *= m; + k ^= k >> r; + k *= m; + h *= m; + h ^= k; + + data += 4; + len -= 4; + } + + /* handle the last few bytes of the input array */ + switch(len) { + case 3: + h ^= data[2] << 16; + case 2: + h ^= data[1] << 8; + case 1: + h ^= data[0]; + h *= m; + }; + + /* do a few final mixes of the hash to ensure the last few bytes are well-incorporated */ + h ^= h >> 13; + h *= m; + h ^= h >> 15; + + return h; } unsigned int util_string_hash32(const char *str) { - return murmur_hash2(str, strlen(str), 0); + return murmur_hash2(str, strlen(str), 0); } /* get a bunch of bit numbers out of the hash, and set the bits in our bit field */ uint64_t util_string_bloom64(const char *str) { - uint64_t bits = 0; - unsigned int hash = util_string_hash32(str); - - bits |= 1LLU << (hash & 63); - bits |= 1LLU << ((hash >> 6) & 63); - bits |= 1LLU << ((hash >> 12) & 63); - bits |= 1LLU << ((hash >> 18) & 63); - return bits; + uint64_t bits = 0; + unsigned int hash = util_string_hash32(str); + + bits |= 1LLU << (hash & 63); + bits |= 1LLU << ((hash >> 6) & 63); + bits |= 1LLU << ((hash >> 12) & 63); + bits |= 1LLU << ((hash >> 18) & 63); + return bits; } #define USEC_PER_SEC 1000000ULL #define NSEC_PER_USEC 1000ULL unsigned long long ts_usec(const struct timespec *ts) { - return (unsigned long long) ts->tv_sec * USEC_PER_SEC + - (unsigned long long) ts->tv_nsec / NSEC_PER_USEC; + return (unsigned long long) ts->tv_sec * USEC_PER_SEC + + (unsigned long long) ts->tv_nsec / NSEC_PER_USEC; } unsigned long long now_usec(void) { - struct timespec ts; + struct timespec ts; - if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) - return 0; - return ts_usec(&ts); + if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) + return 0; + return ts_usec(&ts); } diff --git a/src/libudev.c b/src/libudev.c index f0f59e3a4d..be24329adc 100644 --- a/src/libudev.c +++ b/src/libudev.c @@ -36,38 +36,38 @@ * Opaque object representing the library context. */ struct udev { - int refcount; - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args); - void *userdata; - char *sys_path; - char *dev_path; - char *rules_path[4]; - unsigned long long rules_path_ts[4]; - int rules_path_count; - char *run_path; - struct udev_list properties_list; - int log_priority; + int refcount; + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args); + void *userdata; + char *sys_path; + char *dev_path; + char *rules_path[4]; + unsigned long long rules_path_ts[4]; + int rules_path_count; + char *run_path; + struct udev_list properties_list; + int log_priority; }; void udev_log(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, ...) + int priority, const char *file, int line, const char *fn, + const char *format, ...) { - va_list args; + va_list args; - va_start(args, format); - udev->log_fn(udev, priority, file, line, fn, format, args); - va_end(args); + va_start(args, format); + udev->log_fn(udev, priority, file, line, fn, format, args); + va_end(args); } static void log_stderr(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args) + int priority, const char *file, int line, const char *fn, + const char *format, va_list args) { - fprintf(stderr, "libudev: %s: ", fn); - vfprintf(stderr, format, args); + fprintf(stderr, "libudev: %s: ", fn); + vfprintf(stderr, format, args); } /** @@ -81,9 +81,9 @@ static void log_stderr(struct udev *udev, **/ UDEV_EXPORT void *udev_get_userdata(struct udev *udev) { - if (udev == NULL) - return NULL; - return udev->userdata; + if (udev == NULL) + return NULL; + return udev->userdata; } /** @@ -95,17 +95,17 @@ UDEV_EXPORT void *udev_get_userdata(struct udev *udev) **/ UDEV_EXPORT void udev_set_userdata(struct udev *udev, void *userdata) { - if (udev == NULL) - return; - udev->userdata = userdata; + if (udev == NULL) + return; + udev->userdata = userdata; } static char *set_value(char **s, const char *v) { - free(*s); - *s = strdup(v); - util_remove_trailing_chars(*s, '/'); - return *s; + free(*s); + *s = strdup(v); + util_remove_trailing_chars(*s, '/'); + return *s; } /** @@ -121,171 +121,171 @@ static char *set_value(char **s, const char *v) **/ UDEV_EXPORT struct udev *udev_new(void) { - struct udev *udev; - const char *env; - char *config_file = NULL; - FILE *f; - - udev = calloc(1, sizeof(struct udev)); - if (udev == NULL) - return NULL; - udev->refcount = 1; - udev->log_fn = log_stderr; - udev->log_priority = LOG_ERR; - udev_list_init(udev, &udev->properties_list, true); - - /* custom config file */ - env = getenv("UDEV_CONFIG_FILE"); - if (env != NULL) { - if (set_value(&config_file, env) == NULL) - goto err; - udev_add_property(udev, "UDEV_CONFIG_FILE", config_file); - } - - /* default config file */ - if (config_file == NULL) - config_file = strdup(SYSCONFDIR "/udev/udev.conf"); - if (config_file == NULL) - goto err; - - f = fopen(config_file, "re"); - if (f != NULL) { - char line[UTIL_LINE_SIZE]; - int line_nr = 0; - - while (fgets(line, sizeof(line), f)) { - size_t len; - char *key; - char *val; - - line_nr++; - - /* find key */ - key = line; - while (isspace(key[0])) - key++; - - /* comment or empty line */ - if (key[0] == '#' || key[0] == '\0') - continue; - - /* split key/value */ - val = strchr(key, '='); - if (val == NULL) { - err(udev, "missing = in '%s'[%i], skip line\n", config_file, line_nr); - continue; - } - val[0] = '\0'; - val++; - - /* find value */ - while (isspace(val[0])) - val++; - - /* terminate key */ - len = strlen(key); - if (len == 0) - continue; - while (isspace(key[len-1])) - len--; - key[len] = '\0'; - - /* terminate value */ - len = strlen(val); - if (len == 0) - continue; - while (isspace(val[len-1])) - len--; - val[len] = '\0'; - - if (len == 0) - continue; - - /* unquote */ - if (val[0] == '"' || val[0] == '\'') { - if (val[len-1] != val[0]) { - err(udev, "inconsistent quoting in '%s'[%i], skip line\n", config_file, line_nr); - continue; - } - val[len-1] = '\0'; - val++; - } - - if (strcmp(key, "udev_log") == 0) { - udev_set_log_priority(udev, util_log_priority(val)); - continue; - } - if (strcmp(key, "udev_root") == 0) { - set_value(&udev->dev_path, val); - continue; - } - if (strcmp(key, "udev_run") == 0) { - set_value(&udev->run_path, val); - continue; - } - if (strcmp(key, "udev_sys") == 0) { - set_value(&udev->sys_path, val); - continue; - } - if (strcmp(key, "udev_rules") == 0) { - set_value(&udev->rules_path[0], val); - udev->rules_path_count = 1; - continue; - } - } - fclose(f); - } - - /* environment overwrites config */ - env = getenv("UDEV_LOG"); - if (env != NULL) - udev_set_log_priority(udev, util_log_priority(env)); - - /* set defaults */ - if (udev->dev_path == NULL) - if (set_value(&udev->dev_path, "/dev") == NULL) - goto err; - - if (udev->sys_path == NULL) - if (set_value(&udev->sys_path, "/sys") == NULL) - goto err; - - if (udev->run_path == NULL) - if (set_value(&udev->run_path, "/run/udev") == NULL) - goto err; - - if (udev->rules_path[0] == NULL) { - /* /usr/lib/udev -- system rules */ - udev->rules_path[0] = strdup(PKGLIBEXECDIR "/rules.d"); - if (!udev->rules_path[0]) - goto err; - - /* /etc/udev -- local administration rules */ - udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d"); - if (!udev->rules_path[1]) - goto err; - - /* /run/udev -- runtime rules */ - if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0) - goto err; - - udev->rules_path_count = 3; - } - - dbg(udev, "context %p created\n", udev); - dbg(udev, "log_priority=%d\n", udev->log_priority); - dbg(udev, "config_file='%s'\n", config_file); - dbg(udev, "dev_path='%s'\n", udev->dev_path); - dbg(udev, "sys_path='%s'\n", udev->sys_path); - dbg(udev, "run_path='%s'\n", udev->run_path); - dbg(udev, "rules_path='%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1], udev->rules_path[2]); - free(config_file); - return udev; + struct udev *udev; + const char *env; + char *config_file = NULL; + FILE *f; + + udev = calloc(1, sizeof(struct udev)); + if (udev == NULL) + return NULL; + udev->refcount = 1; + udev->log_fn = log_stderr; + udev->log_priority = LOG_ERR; + udev_list_init(udev, &udev->properties_list, true); + + /* custom config file */ + env = getenv("UDEV_CONFIG_FILE"); + if (env != NULL) { + if (set_value(&config_file, env) == NULL) + goto err; + udev_add_property(udev, "UDEV_CONFIG_FILE", config_file); + } + + /* default config file */ + if (config_file == NULL) + config_file = strdup(SYSCONFDIR "/udev/udev.conf"); + if (config_file == NULL) + goto err; + + f = fopen(config_file, "re"); + if (f != NULL) { + char line[UTIL_LINE_SIZE]; + int line_nr = 0; + + while (fgets(line, sizeof(line), f)) { + size_t len; + char *key; + char *val; + + line_nr++; + + /* find key */ + key = line; + while (isspace(key[0])) + key++; + + /* comment or empty line */ + if (key[0] == '#' || key[0] == '\0') + continue; + + /* split key/value */ + val = strchr(key, '='); + if (val == NULL) { + err(udev, "missing = in '%s'[%i], skip line\n", config_file, line_nr); + continue; + } + val[0] = '\0'; + val++; + + /* find value */ + while (isspace(val[0])) + val++; + + /* terminate key */ + len = strlen(key); + if (len == 0) + continue; + while (isspace(key[len-1])) + len--; + key[len] = '\0'; + + /* terminate value */ + len = strlen(val); + if (len == 0) + continue; + while (isspace(val[len-1])) + len--; + val[len] = '\0'; + + if (len == 0) + continue; + + /* unquote */ + if (val[0] == '"' || val[0] == '\'') { + if (val[len-1] != val[0]) { + err(udev, "inconsistent quoting in '%s'[%i], skip line\n", config_file, line_nr); + continue; + } + val[len-1] = '\0'; + val++; + } + + if (strcmp(key, "udev_log") == 0) { + udev_set_log_priority(udev, util_log_priority(val)); + continue; + } + if (strcmp(key, "udev_root") == 0) { + set_value(&udev->dev_path, val); + continue; + } + if (strcmp(key, "udev_run") == 0) { + set_value(&udev->run_path, val); + continue; + } + if (strcmp(key, "udev_sys") == 0) { + set_value(&udev->sys_path, val); + continue; + } + if (strcmp(key, "udev_rules") == 0) { + set_value(&udev->rules_path[0], val); + udev->rules_path_count = 1; + continue; + } + } + fclose(f); + } + + /* environment overwrites config */ + env = getenv("UDEV_LOG"); + if (env != NULL) + udev_set_log_priority(udev, util_log_priority(env)); + + /* set defaults */ + if (udev->dev_path == NULL) + if (set_value(&udev->dev_path, "/dev") == NULL) + goto err; + + if (udev->sys_path == NULL) + if (set_value(&udev->sys_path, "/sys") == NULL) + goto err; + + if (udev->run_path == NULL) + if (set_value(&udev->run_path, "/run/udev") == NULL) + goto err; + + if (udev->rules_path[0] == NULL) { + /* /usr/lib/udev -- system rules */ + udev->rules_path[0] = strdup(PKGLIBEXECDIR "/rules.d"); + if (!udev->rules_path[0]) + goto err; + + /* /etc/udev -- local administration rules */ + udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d"); + if (!udev->rules_path[1]) + goto err; + + /* /run/udev -- runtime rules */ + if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0) + goto err; + + udev->rules_path_count = 3; + } + + dbg(udev, "context %p created\n", udev); + dbg(udev, "log_priority=%d\n", udev->log_priority); + dbg(udev, "config_file='%s'\n", config_file); + dbg(udev, "dev_path='%s'\n", udev->dev_path); + dbg(udev, "sys_path='%s'\n", udev->sys_path); + dbg(udev, "run_path='%s'\n", udev->run_path); + dbg(udev, "rules_path='%s':'%s':'%s'\n", udev->rules_path[0], udev->rules_path[1], udev->rules_path[2]); + free(config_file); + return udev; err: - free(config_file); - err(udev, "context creation failed\n"); - udev_unref(udev); - return NULL; + free(config_file); + err(udev, "context creation failed\n"); + udev_unref(udev); + return NULL; } /** @@ -298,10 +298,10 @@ err: **/ UDEV_EXPORT struct udev *udev_ref(struct udev *udev) { - if (udev == NULL) - return NULL; - udev->refcount++; - return udev; + if (udev == NULL) + return NULL; + udev->refcount++; + return udev; } /** @@ -314,20 +314,20 @@ UDEV_EXPORT struct udev *udev_ref(struct udev *udev) **/ UDEV_EXPORT void udev_unref(struct udev *udev) { - if (udev == NULL) - return; - udev->refcount--; - if (udev->refcount > 0) - return; - udev_list_cleanup(&udev->properties_list); - free(udev->dev_path); - free(udev->sys_path); - free(udev->rules_path[0]); - free(udev->rules_path[1]); - free(udev->rules_path[2]); - free(udev->run_path); - dbg(udev, "context %p released\n", udev); - free(udev); + if (udev == NULL) + return; + udev->refcount--; + if (udev->refcount > 0) + return; + udev_list_cleanup(&udev->properties_list); + free(udev->dev_path); + free(udev->sys_path); + free(udev->rules_path[0]); + free(udev->rules_path[1]); + free(udev->rules_path[2]); + free(udev->run_path); + dbg(udev, "context %p released\n", udev); + free(udev); } /** @@ -341,12 +341,12 @@ UDEV_EXPORT void udev_unref(struct udev *udev) * **/ UDEV_EXPORT void udev_set_log_fn(struct udev *udev, - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args)) + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args)) { - udev->log_fn = log_fn; - info(udev, "custom logging function %p registered\n", log_fn); + udev->log_fn = log_fn; + info(udev, "custom logging function %p registered\n", log_fn); } /** @@ -360,7 +360,7 @@ UDEV_EXPORT void udev_set_log_fn(struct udev *udev, **/ UDEV_EXPORT int udev_get_log_priority(struct udev *udev) { - return udev->log_priority; + return udev->log_priority; } /** @@ -373,19 +373,19 @@ UDEV_EXPORT int udev_get_log_priority(struct udev *udev) **/ UDEV_EXPORT void udev_set_log_priority(struct udev *udev, int priority) { - char num[32]; + char num[32]; - udev->log_priority = priority; - snprintf(num, sizeof(num), "%u", udev->log_priority); - udev_add_property(udev, "UDEV_LOG", num); + udev->log_priority = priority; + snprintf(num, sizeof(num), "%u", udev->log_priority); + udev_add_property(udev, "UDEV_LOG", num); } int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *stamp_usec[]) { - *path = udev->rules_path; - if (stamp_usec) - *stamp_usec = udev->rules_path_ts; - return udev->rules_path_count; + *path = udev->rules_path; + if (stamp_usec) + *stamp_usec = udev->rules_path_ts; + return udev->rules_path_count; } /** @@ -400,9 +400,9 @@ int udev_get_rules_path(struct udev *udev, char **path[], unsigned long long *st **/ UDEV_EXPORT const char *udev_get_sys_path(struct udev *udev) { - if (udev == NULL) - return NULL; - return udev->sys_path; + if (udev == NULL) + return NULL; + return udev->sys_path; } /** @@ -417,9 +417,9 @@ UDEV_EXPORT const char *udev_get_sys_path(struct udev *udev) **/ UDEV_EXPORT const char *udev_get_dev_path(struct udev *udev) { - if (udev == NULL) - return NULL; - return udev->dev_path; + if (udev == NULL) + return NULL; + return udev->dev_path; } /** @@ -432,26 +432,26 @@ UDEV_EXPORT const char *udev_get_dev_path(struct udev *udev) **/ UDEV_EXPORT const char *udev_get_run_path(struct udev *udev) { - if (udev == NULL) - return NULL; - return udev->run_path; + if (udev == NULL) + return NULL; + return udev->run_path; } struct udev_list_entry *udev_add_property(struct udev *udev, const char *key, const char *value) { - if (value == NULL) { - struct udev_list_entry *list_entry; - - list_entry = udev_get_properties_list_entry(udev); - list_entry = udev_list_entry_get_by_name(list_entry, key); - if (list_entry != NULL) - udev_list_entry_delete(list_entry); - return NULL; - } - return udev_list_entry_add(&udev->properties_list, key, value); + if (value == NULL) { + struct udev_list_entry *list_entry; + + list_entry = udev_get_properties_list_entry(udev); + list_entry = udev_list_entry_get_by_name(list_entry, key); + if (list_entry != NULL) + udev_list_entry_delete(list_entry); + return NULL; + } + return udev_list_entry_add(&udev->properties_list, key, value); } struct udev_list_entry *udev_get_properties_list_entry(struct udev *udev) { - return udev_list_get_entry(&udev->properties_list); + return udev_list_get_entry(&udev->properties_list); } diff --git a/src/libudev.h b/src/libudev.h index 28d7d0a388..10e098d4f7 100644 --- a/src/libudev.h +++ b/src/libudev.h @@ -31,9 +31,9 @@ struct udev *udev_ref(struct udev *udev); void udev_unref(struct udev *udev); struct udev *udev_new(void); void udev_set_log_fn(struct udev *udev, - void (*log_fn)(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args)); + void (*log_fn)(struct udev *udev, + int priority, const char *file, int line, const char *fn, + const char *format, va_list args)); int udev_get_log_priority(struct udev *udev); void udev_set_log_priority(struct udev *udev, int priority); const char *udev_get_sys_path(struct udev *udev); @@ -60,9 +60,9 @@ const char *udev_list_entry_get_value(struct udev_list_entry *list_entry); * Helper to iterate over all entries of a list. */ #define udev_list_entry_foreach(list_entry, first_entry) \ - for (list_entry = first_entry; \ - list_entry != NULL; \ - list_entry = udev_list_entry_get_next(list_entry)) + for (list_entry = first_entry; \ + list_entry != NULL; \ + list_entry = udev_list_entry_get_next(list_entry)) /* * udev_device @@ -80,7 +80,7 @@ struct udev_device *udev_device_new_from_environment(struct udev *udev); /* udev_device_get_parent_*() does not take a reference on the returned device, it is automatically unref'd with the parent */ struct udev_device *udev_device_get_parent(struct udev_device *udev_device); struct udev_device *udev_device_get_parent_with_subsystem_devtype(struct udev_device *udev_device, - const char *subsystem, const char *devtype); + const char *subsystem, const char *devtype); /* retrieve device properties */ const char *udev_device_get_devpath(struct udev_device *udev_device); const char *udev_device_get_subsystem(struct udev_device *udev_device); @@ -123,7 +123,7 @@ int udev_monitor_get_fd(struct udev_monitor *udev_monitor); struct udev_device *udev_monitor_receive_device(struct udev_monitor *udev_monitor); /* in-kernel socket filters to select messages that get delivered to a listener */ int udev_monitor_filter_add_match_subsystem_devtype(struct udev_monitor *udev_monitor, - const char *subsystem, const char *devtype); + const char *subsystem, const char *devtype); int udev_monitor_filter_add_match_tag(struct udev_monitor *udev_monitor, const char *tag); int udev_monitor_filter_update(struct udev_monitor *udev_monitor); int udev_monitor_filter_remove(struct udev_monitor *udev_monitor); @@ -171,7 +171,7 @@ int udev_queue_get_udev_is_active(struct udev_queue *udev_queue); int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue); int udev_queue_get_seqnum_is_finished(struct udev_queue *udev_queue, unsigned long long int seqnum); int udev_queue_get_seqnum_sequence_is_finished(struct udev_queue *udev_queue, - unsigned long long int start, unsigned long long int end); + unsigned long long int start, unsigned long long int end); struct udev_list_entry *udev_queue_get_queued_list_entry(struct udev_queue *udev_queue); /* diff --git a/src/test-libudev.c b/src/test-libudev.c index c325f8eef5..6161fb3e31 100644 --- a/src/test-libudev.c +++ b/src/test-libudev.c @@ -25,477 +25,477 @@ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) static void log_fn(struct udev *udev, - int priority, const char *file, int line, const char *fn, - const char *format, va_list args) + int priority, const char *file, int line, const char *fn, + const char *format, va_list args) { - printf("test-libudev: %s %s:%d ", fn, file, line); - vprintf(format, args); + printf("test-libudev: %s %s:%d ", fn, file, line); + vprintf(format, args); } static void print_device(struct udev_device *device) { - const char *str; - dev_t devnum; - int count; - struct udev_list_entry *list_entry; - - printf("*** device: %p ***\n", device); - str = udev_device_get_action(device); - if (str != NULL) - printf("action: '%s'\n", str); - - str = udev_device_get_syspath(device); - printf("syspath: '%s'\n", str); - - str = udev_device_get_sysname(device); - printf("sysname: '%s'\n", str); - - str = udev_device_get_sysnum(device); - if (str != NULL) - printf("sysnum: '%s'\n", str); - - str = udev_device_get_devpath(device); - printf("devpath: '%s'\n", str); - - str = udev_device_get_subsystem(device); - if (str != NULL) - printf("subsystem: '%s'\n", str); - - str = udev_device_get_devtype(device); - if (str != NULL) - printf("devtype: '%s'\n", str); - - str = udev_device_get_driver(device); - if (str != NULL) - printf("driver: '%s'\n", str); - - str = udev_device_get_devnode(device); - if (str != NULL) - printf("devname: '%s'\n", str); - - devnum = udev_device_get_devnum(device); - if (major(devnum) > 0) - printf("devnum: %u:%u\n", major(devnum), minor(devnum)); - - count = 0; - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { - printf("link: '%s'\n", udev_list_entry_get_name(list_entry)); - count++; - } - if (count > 0) - printf("found %i links\n", count); - - count = 0; - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) { - printf("property: '%s=%s'\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - count++; - } - if (count > 0) - printf("found %i properties\n", count); - - str = udev_device_get_property_value(device, "MAJOR"); - if (str != NULL) - printf("MAJOR: '%s'\n", str); - - str = udev_device_get_sysattr_value(device, "dev"); - if (str != NULL) - printf("attr{dev}: '%s'\n", str); - - printf("\n"); + const char *str; + dev_t devnum; + int count; + struct udev_list_entry *list_entry; + + printf("*** device: %p ***\n", device); + str = udev_device_get_action(device); + if (str != NULL) + printf("action: '%s'\n", str); + + str = udev_device_get_syspath(device); + printf("syspath: '%s'\n", str); + + str = udev_device_get_sysname(device); + printf("sysname: '%s'\n", str); + + str = udev_device_get_sysnum(device); + if (str != NULL) + printf("sysnum: '%s'\n", str); + + str = udev_device_get_devpath(device); + printf("devpath: '%s'\n", str); + + str = udev_device_get_subsystem(device); + if (str != NULL) + printf("subsystem: '%s'\n", str); + + str = udev_device_get_devtype(device); + if (str != NULL) + printf("devtype: '%s'\n", str); + + str = udev_device_get_driver(device); + if (str != NULL) + printf("driver: '%s'\n", str); + + str = udev_device_get_devnode(device); + if (str != NULL) + printf("devname: '%s'\n", str); + + devnum = udev_device_get_devnum(device); + if (major(devnum) > 0) + printf("devnum: %u:%u\n", major(devnum), minor(devnum)); + + count = 0; + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { + printf("link: '%s'\n", udev_list_entry_get_name(list_entry)); + count++; + } + if (count > 0) + printf("found %i links\n", count); + + count = 0; + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) { + printf("property: '%s=%s'\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + count++; + } + if (count > 0) + printf("found %i properties\n", count); + + str = udev_device_get_property_value(device, "MAJOR"); + if (str != NULL) + printf("MAJOR: '%s'\n", str); + + str = udev_device_get_sysattr_value(device, "dev"); + if (str != NULL) + printf("attr{dev}: '%s'\n", str); + + printf("\n"); } static int test_device(struct udev *udev, const char *syspath) { - struct udev_device *device; - - printf("looking at device: %s\n", syspath); - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) { - printf("no device found\n"); - return -1; - } - print_device(device); - udev_device_unref(device); - return 0; + struct udev_device *device; + + printf("looking at device: %s\n", syspath); + device = udev_device_new_from_syspath(udev, syspath); + if (device == NULL) { + printf("no device found\n"); + return -1; + } + print_device(device); + udev_device_unref(device); + return 0; } static int test_device_parents(struct udev *udev, const char *syspath) { - struct udev_device *device; - struct udev_device *device_parent; - - printf("looking at device: %s\n", syspath); - device = udev_device_new_from_syspath(udev, syspath); - if (device == NULL) - return -1; - - printf("looking at parents\n"); - device_parent = device; - do { - print_device(device_parent); - device_parent = udev_device_get_parent(device_parent); - } while (device_parent != NULL); - - printf("looking at parents again\n"); - device_parent = device; - do { - print_device(device_parent); - device_parent = udev_device_get_parent(device_parent); - } while (device_parent != NULL); - udev_device_unref(device); - - return 0; + struct udev_device *device; + struct udev_device *device_parent; + + printf("looking at device: %s\n", syspath); + device = udev_device_new_from_syspath(udev, syspath); + if (device == NULL) + return -1; + + printf("looking at parents\n"); + device_parent = device; + do { + print_device(device_parent); + device_parent = udev_device_get_parent(device_parent); + } while (device_parent != NULL); + + printf("looking at parents again\n"); + device_parent = device; + do { + print_device(device_parent); + device_parent = udev_device_get_parent(device_parent); + } while (device_parent != NULL); + udev_device_unref(device); + + return 0; } static int test_device_devnum(struct udev *udev) { - dev_t devnum = makedev(1, 3); - struct udev_device *device; - - printf("looking up device: %u:%u\n", major(devnum), minor(devnum)); - device = udev_device_new_from_devnum(udev, 'c', devnum); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - return 0; + dev_t devnum = makedev(1, 3); + struct udev_device *device; + + printf("looking up device: %u:%u\n", major(devnum), minor(devnum)); + device = udev_device_new_from_devnum(udev, 'c', devnum); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + return 0; } static int test_device_subsys_name(struct udev *udev) { - struct udev_device *device; - - printf("looking up device: 'block':'sda'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "block", "sda"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - - printf("looking up device: 'subsystem':'pci'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "subsystem", "pci"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - - printf("looking up device: 'drivers':'scsi:sd'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "drivers", "scsi:sd"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - - printf("looking up device: 'module':'printk'\n"); - device = udev_device_new_from_subsystem_sysname(udev, "module", "printk"); - if (device == NULL) - return -1; - print_device(device); - udev_device_unref(device); - return 0; + struct udev_device *device; + + printf("looking up device: 'block':'sda'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "block", "sda"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'subsystem':'pci'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "subsystem", "pci"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'drivers':'scsi:sd'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "drivers", "scsi:sd"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + + printf("looking up device: 'module':'printk'\n"); + device = udev_device_new_from_subsystem_sysname(udev, "module", "printk"); + if (device == NULL) + return -1; + print_device(device); + udev_device_unref(device); + return 0; } static int test_enumerate_print_list(struct udev_enumerate *enumerate) { - struct udev_list_entry *list_entry; - int count = 0; - - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), - udev_list_entry_get_name(list_entry)); - if (device != NULL) { - printf("device: '%s' (%s)\n", - udev_device_get_syspath(device), - udev_device_get_subsystem(device)); - udev_device_unref(device); - count++; - } - } - printf("found %i devices\n\n", count); - return count; + struct udev_list_entry *list_entry; + int count = 0; + + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device != NULL) { + printf("device: '%s' (%s)\n", + udev_device_get_syspath(device), + udev_device_get_subsystem(device)); + udev_device_unref(device); + count++; + } + } + printf("found %i devices\n\n", count); + return count; } static int test_monitor(struct udev *udev) { - struct udev_monitor *udev_monitor = NULL; - int fd_ep; - int fd_udev = -1; - struct epoll_event ep_udev, ep_stdin; - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - printf("error creating epoll fd: %m\n"); - goto out; - } - - udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); - if (udev_monitor == NULL) { - printf("no socket\n"); - goto out; - } - fd_udev = udev_monitor_get_fd(udev_monitor); - - if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "block", NULL) < 0 || - udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL) < 0 || - udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device") < 0) { - printf("filter failed\n"); - goto out; - } - - if (udev_monitor_enable_receiving(udev_monitor) < 0) { - printf("bind failed\n"); - goto out; - } - - memset(&ep_udev, 0, sizeof(struct epoll_event)); - ep_udev.events = EPOLLIN; - ep_udev.data.fd = fd_udev; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { - printf("fail to add fd to epoll: %m\n"); - goto out; - } - - memset(&ep_stdin, 0, sizeof(struct epoll_event)); - ep_stdin.events = EPOLLIN; - ep_stdin.data.fd = STDIN_FILENO; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, STDIN_FILENO, &ep_stdin) < 0) { - printf("fail to add fd to epoll: %m\n"); - goto out; - } - - for (;;) { - int fdcount; - struct epoll_event ev[4]; - struct udev_device *device; - int i; - - printf("waiting for events from udev, press ENTER to exit\n"); - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); - printf("epoll fd count: %i\n", fdcount); - - for (i = 0; i < fdcount; i++) { - if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { - device = udev_monitor_receive_device(udev_monitor); - if (device == NULL) { - printf("no device from socket\n"); - continue; - } - print_device(device); - udev_device_unref(device); - } else if (ev[i].data.fd == STDIN_FILENO && ev[i].events & EPOLLIN) { - printf("exiting loop\n"); - goto out; - } - } - } + struct udev_monitor *udev_monitor = NULL; + int fd_ep; + int fd_udev = -1; + struct epoll_event ep_udev, ep_stdin; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + printf("error creating epoll fd: %m\n"); + goto out; + } + + udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); + if (udev_monitor == NULL) { + printf("no socket\n"); + goto out; + } + fd_udev = udev_monitor_get_fd(udev_monitor); + + if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "block", NULL) < 0 || + udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "tty", NULL) < 0 || + udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, "usb", "usb_device") < 0) { + printf("filter failed\n"); + goto out; + } + + if (udev_monitor_enable_receiving(udev_monitor) < 0) { + printf("bind failed\n"); + goto out; + } + + memset(&ep_udev, 0, sizeof(struct epoll_event)); + ep_udev.events = EPOLLIN; + ep_udev.data.fd = fd_udev; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { + printf("fail to add fd to epoll: %m\n"); + goto out; + } + + memset(&ep_stdin, 0, sizeof(struct epoll_event)); + ep_stdin.events = EPOLLIN; + ep_stdin.data.fd = STDIN_FILENO; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, STDIN_FILENO, &ep_stdin) < 0) { + printf("fail to add fd to epoll: %m\n"); + goto out; + } + + for (;;) { + int fdcount; + struct epoll_event ev[4]; + struct udev_device *device; + int i; + + printf("waiting for events from udev, press ENTER to exit\n"); + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + printf("epoll fd count: %i\n", fdcount); + + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { + device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) { + printf("no device from socket\n"); + continue; + } + print_device(device); + udev_device_unref(device); + } else if (ev[i].data.fd == STDIN_FILENO && ev[i].events & EPOLLIN) { + printf("exiting loop\n"); + goto out; + } + } + } out: - if (fd_ep >= 0) - close(fd_ep); - udev_monitor_unref(udev_monitor); - return 0; + if (fd_ep >= 0) + close(fd_ep); + udev_monitor_unref(udev_monitor); + return 0; } static int test_queue(struct udev *udev) { - struct udev_queue *udev_queue; - unsigned long long int seqnum; - struct udev_list_entry *list_entry; - - udev_queue = udev_queue_new(udev); - if (udev_queue == NULL) - return -1; - seqnum = udev_queue_get_kernel_seqnum(udev_queue); - printf("seqnum kernel: %llu\n", seqnum); - seqnum = udev_queue_get_udev_seqnum(udev_queue); - printf("seqnum udev : %llu\n", seqnum); - - if (udev_queue_get_queue_is_empty(udev_queue)) - printf("queue is empty\n"); - printf("get queue list\n"); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - printf("\n"); - printf("get queue list again\n"); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - printf("\n"); - - list_entry = udev_queue_get_queued_list_entry(udev_queue); - if (list_entry != NULL) { - printf("event [%llu] is queued\n", seqnum); - seqnum = strtoull(udev_list_entry_get_value(list_entry), NULL, 10); - if (udev_queue_get_seqnum_is_finished(udev_queue, seqnum)) - printf("event [%llu] is not finished\n", seqnum); - else - printf("event [%llu] is finished\n", seqnum); - } - printf("\n"); - udev_queue_unref(udev_queue); - return 0; + struct udev_queue *udev_queue; + unsigned long long int seqnum; + struct udev_list_entry *list_entry; + + udev_queue = udev_queue_new(udev); + if (udev_queue == NULL) + return -1; + seqnum = udev_queue_get_kernel_seqnum(udev_queue); + printf("seqnum kernel: %llu\n", seqnum); + seqnum = udev_queue_get_udev_seqnum(udev_queue); + printf("seqnum udev : %llu\n", seqnum); + + if (udev_queue_get_queue_is_empty(udev_queue)) + printf("queue is empty\n"); + printf("get queue list\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + printf("\n"); + printf("get queue list again\n"); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf("queued: '%s' [%s]\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + printf("\n"); + + list_entry = udev_queue_get_queued_list_entry(udev_queue); + if (list_entry != NULL) { + printf("event [%llu] is queued\n", seqnum); + seqnum = strtoull(udev_list_entry_get_value(list_entry), NULL, 10); + if (udev_queue_get_seqnum_is_finished(udev_queue, seqnum)) + printf("event [%llu] is not finished\n", seqnum); + else + printf("event [%llu] is finished\n", seqnum); + } + printf("\n"); + udev_queue_unref(udev_queue); + return 0; } static int test_enumerate(struct udev *udev, const char *subsystem) { - struct udev_enumerate *udev_enumerate; - - printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'net' + duplicated scan + null + zero\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, "net"); - udev_enumerate_scan_devices(udev_enumerate); - udev_enumerate_scan_devices(udev_enumerate); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'block'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate,"block"); - udev_enumerate_add_match_is_initialized(udev_enumerate); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'not block'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'pci, mem, vc'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_subsystem(udev_enumerate, "pci"); - udev_enumerate_add_match_subsystem(udev_enumerate, "mem"); - udev_enumerate_add_match_subsystem(udev_enumerate, "vc"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'subsystem'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_subsystems(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - - printf("enumerate 'property IF_FS_*=filesystem'\n"); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_add_match_property(udev_enumerate, "ID_FS*", "filesystem"); - udev_enumerate_scan_devices(udev_enumerate); - test_enumerate_print_list(udev_enumerate); - udev_enumerate_unref(udev_enumerate); - return 0; + struct udev_enumerate *udev_enumerate; + + printf("enumerate '%s'\n", subsystem == NULL ? "" : subsystem); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, subsystem); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'net' + duplicated scan + null + zero\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, "net"); + udev_enumerate_scan_devices(udev_enumerate); + udev_enumerate_scan_devices(udev_enumerate); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'block'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate,"block"); + udev_enumerate_add_match_is_initialized(udev_enumerate); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'not block'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_nomatch_subsystem(udev_enumerate, "block"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'pci, mem, vc'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_subsystem(udev_enumerate, "pci"); + udev_enumerate_add_match_subsystem(udev_enumerate, "mem"); + udev_enumerate_add_match_subsystem(udev_enumerate, "vc"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'subsystem'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_subsystems(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + + printf("enumerate 'property IF_FS_*=filesystem'\n"); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_add_match_property(udev_enumerate, "ID_FS*", "filesystem"); + udev_enumerate_scan_devices(udev_enumerate); + test_enumerate_print_list(udev_enumerate); + udev_enumerate_unref(udev_enumerate); + return 0; } int main(int argc, char *argv[]) { - struct udev *udev = NULL; - static const struct option options[] = { - { "syspath", required_argument, NULL, 'p' }, - { "subsystem", required_argument, NULL, 's' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - {} - }; - const char *syspath = "/devices/virtual/mem/null"; - const char *subsystem = NULL; - char path[1024]; - const char *str; - - udev = udev_new(); - printf("context: %p\n", udev); - if (udev == NULL) { - printf("no context\n"); - return 1; - } - udev_set_log_fn(udev, log_fn); - printf("set log: %p\n", log_fn); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "+p:s:dhV", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'p': - syspath = optarg; - break; - case 's': - subsystem = optarg; - break; - case 'd': - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("--debug --syspath= --subsystem= --help\n"); - goto out; - case 'V': - printf("%s\n", VERSION); - goto out; - default: - goto out; - } - } - - str = udev_get_sys_path(udev); - printf("sys_path: '%s'\n", str); - str = udev_get_dev_path(udev); - printf("dev_path: '%s'\n", str); - - /* add sys path if needed */ - if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { - snprintf(path, sizeof(path), "%s%s", udev_get_sys_path(udev), syspath); - syspath = path; - } - - test_device(udev, syspath); - test_device_devnum(udev); - test_device_subsys_name(udev); - test_device_parents(udev, syspath); - - test_enumerate(udev, subsystem); - - test_queue(udev); - - test_monitor(udev); + struct udev *udev = NULL; + static const struct option options[] = { + { "syspath", required_argument, NULL, 'p' }, + { "subsystem", required_argument, NULL, 's' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + {} + }; + const char *syspath = "/devices/virtual/mem/null"; + const char *subsystem = NULL; + char path[1024]; + const char *str; + + udev = udev_new(); + printf("context: %p\n", udev); + if (udev == NULL) { + printf("no context\n"); + return 1; + } + udev_set_log_fn(udev, log_fn); + printf("set log: %p\n", log_fn); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "+p:s:dhV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'p': + syspath = optarg; + break; + case 's': + subsystem = optarg; + break; + case 'd': + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + printf("--debug --syspath= --subsystem= --help\n"); + goto out; + case 'V': + printf("%s\n", VERSION); + goto out; + default: + goto out; + } + } + + str = udev_get_sys_path(udev); + printf("sys_path: '%s'\n", str); + str = udev_get_dev_path(udev); + printf("dev_path: '%s'\n", str); + + /* add sys path if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) { + snprintf(path, sizeof(path), "%s%s", udev_get_sys_path(udev), syspath); + syspath = path; + } + + test_device(udev, syspath); + test_device_devnum(udev); + test_device_subsys_name(udev); + test_device_parents(udev, syspath); + + test_enumerate(udev, subsystem); + + test_queue(udev); + + test_monitor(udev); out: - udev_unref(udev); - return 0; + udev_unref(udev); + return 0; } diff --git a/src/test-udev.c b/src/test-udev.c index 8d5baf7f54..c9712e974d 100644 --- a/src/test-udev.c +++ b/src/test-udev.c @@ -31,91 +31,91 @@ #include "udev.h" void udev_main_log(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) {} + const char *file, int line, const char *fn, + const char *format, va_list args) {} int main(int argc, char *argv[]) { - struct udev *udev; - struct udev_event *event = NULL; - struct udev_device *dev = NULL; - struct udev_rules *rules = NULL; - char syspath[UTIL_PATH_SIZE]; - const char *devpath; - const char *action; - sigset_t mask, sigmask_orig; - int err = -EINVAL; - - udev = udev_new(); - if (udev == NULL) - exit(1); - info(udev, "version %s\n", VERSION); - udev_selinux_init(udev); - - sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); - - action = argv[1]; - if (action == NULL) { - err(udev, "action missing\n"); - goto out; - } - - devpath = argv[2]; - if (devpath == NULL) { - err(udev, "devpath missing\n"); - goto out; - } - - rules = udev_rules_new(udev, 1); - - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); - dev = udev_device_new_from_syspath(udev, syspath); - if (dev == NULL) { - info(udev, "unknown device '%s'\n", devpath); - goto out; - } - - udev_device_set_action(dev, action); - event = udev_event_new(dev); - - sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); - event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (event->fd_signal < 0) { - fprintf(stderr, "error creating signalfd\n"); - goto out; - } - - /* do what devtmpfs usually provides us */ - if (udev_device_get_devnode(dev) != NULL) { - mode_t mode; - - if (strcmp(udev_device_get_subsystem(dev), "block") == 0) - mode |= S_IFBLK; - else - mode |= S_IFCHR; - - if (strcmp(action, "remove") != 0) { - util_create_path(udev, udev_device_get_devnode(dev)); - mknod(udev_device_get_devnode(dev), mode, udev_device_get_devnum(dev)); - } else { - unlink(udev_device_get_devnode(dev)); - util_delete_path(udev, udev_device_get_devnode(dev)); - } - } - - err = udev_event_execute_rules(event, rules, &sigmask_orig); - if (err == 0) - udev_event_execute_run(event, NULL); + struct udev *udev; + struct udev_event *event = NULL; + struct udev_device *dev = NULL; + struct udev_rules *rules = NULL; + char syspath[UTIL_PATH_SIZE]; + const char *devpath; + const char *action; + sigset_t mask, sigmask_orig; + int err = -EINVAL; + + udev = udev_new(); + if (udev == NULL) + exit(1); + info(udev, "version %s\n", VERSION); + udev_selinux_init(udev); + + sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); + + action = argv[1]; + if (action == NULL) { + err(udev, "action missing\n"); + goto out; + } + + devpath = argv[2]; + if (devpath == NULL) { + err(udev, "devpath missing\n"); + goto out; + } + + rules = udev_rules_new(udev, 1); + + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), devpath, NULL); + dev = udev_device_new_from_syspath(udev, syspath); + if (dev == NULL) { + info(udev, "unknown device '%s'\n", devpath); + goto out; + } + + udev_device_set_action(dev, action); + event = udev_event_new(dev); + + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (event->fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + goto out; + } + + /* do what devtmpfs usually provides us */ + if (udev_device_get_devnode(dev) != NULL) { + mode_t mode; + + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + mode |= S_IFBLK; + else + mode |= S_IFCHR; + + if (strcmp(action, "remove") != 0) { + util_create_path(udev, udev_device_get_devnode(dev)); + mknod(udev_device_get_devnode(dev), mode, udev_device_get_devnum(dev)); + } else { + unlink(udev_device_get_devnode(dev)); + util_delete_path(udev, udev_device_get_devnode(dev)); + } + } + + err = udev_event_execute_rules(event, rules, &sigmask_orig); + if (err == 0) + udev_event_execute_run(event, NULL); out: - if (event != NULL && event->fd_signal >= 0) - close(event->fd_signal); - udev_event_unref(event); - udev_device_unref(dev); - udev_rules_unref(rules); - udev_selinux_exit(udev); - udev_unref(udev); - if (err != 0) - return 1; - return 0; + if (event != NULL && event->fd_signal >= 0) + close(event->fd_signal); + udev_event_unref(event); + udev_device_unref(dev); + udev_rules_unref(rules); + udev_selinux_exit(udev); + udev_unref(udev); + if (err != 0) + return 1; + return 0; } diff --git a/src/udev-builtin-blkid.c b/src/udev-builtin-blkid.c index 0260c440e2..2056617dbf 100644 --- a/src/udev-builtin-blkid.c +++ b/src/udev-builtin-blkid.c @@ -33,175 +33,175 @@ static void print_property(struct udev_device *dev, bool test, const char *name, const char *value) { - char s[265]; + char s[265]; - s[0] = '\0'; + s[0] = '\0'; - if (!strcmp(name, "TYPE")) { - udev_builtin_add_property(dev, test, "ID_FS_TYPE", value); + if (!strcmp(name, "TYPE")) { + udev_builtin_add_property(dev, test, "ID_FS_TYPE", value); - } else if (!strcmp(name, "USAGE")) { - udev_builtin_add_property(dev, test, "ID_FS_USAGE", value); + } else if (!strcmp(name, "USAGE")) { + udev_builtin_add_property(dev, test, "ID_FS_USAGE", value); - } else if (!strcmp(name, "VERSION")) { - udev_builtin_add_property(dev, test, "ID_FS_VERSION", value); + } else if (!strcmp(name, "VERSION")) { + udev_builtin_add_property(dev, test, "ID_FS_VERSION", value); - } else if (!strcmp(name, "UUID")) { - blkid_safe_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_UUID", s); - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_UUID_ENC", s); + } else if (!strcmp(name, "UUID")) { + blkid_safe_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID", s); + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID_ENC", s); - } else if (!strcmp(name, "UUID_SUB")) { - blkid_safe_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB", s); - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB_ENC", s); + } else if (!strcmp(name, "UUID_SUB")) { + blkid_safe_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB", s); + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB_ENC", s); - } else if (!strcmp(name, "LABEL")) { - blkid_safe_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_LABEL", s); - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "ID_FS_LABEL_ENC", s); + } else if (!strcmp(name, "LABEL")) { + blkid_safe_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_LABEL", s); + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "ID_FS_LABEL_ENC", s); - } else if (!strcmp(name, "PTTYPE")) { - udev_builtin_add_property(dev, test, "ID_PART_TABLE_TYPE", value); + } else if (!strcmp(name, "PTTYPE")) { + udev_builtin_add_property(dev, test, "ID_PART_TABLE_TYPE", value); - } else if (!strcmp(name, "PART_ENTRY_NAME")) { - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "PART_ENTRY_NAME", s); + } else if (!strcmp(name, "PART_ENTRY_NAME")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "PART_ENTRY_NAME", s); - } else if (!strcmp(name, "PART_ENTRY_TYPE")) { - blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "PART_ENTRY_TYPE", s); + } else if (!strcmp(name, "PART_ENTRY_TYPE")) { + blkid_encode_string(value, s, sizeof(s)); + udev_builtin_add_property(dev, test, "PART_ENTRY_TYPE", s); - } else if (!strncmp(name, "PART_ENTRY_", 11)) { - util_strscpyl(s, sizeof(s), "ID_", name, NULL); - udev_builtin_add_property(dev, test, name, value); - } + } else if (!strncmp(name, "PART_ENTRY_", 11)) { + util_strscpyl(s, sizeof(s), "ID_", name, NULL); + udev_builtin_add_property(dev, test, name, value); + } } static int probe_superblocks(blkid_probe pr) { - struct stat st; - int rc; + struct stat st; + int rc; - if (fstat(blkid_probe_get_fd(pr), &st)) - return -1; + if (fstat(blkid_probe_get_fd(pr), &st)) + return -1; - blkid_probe_enable_partitions(pr, 1); + blkid_probe_enable_partitions(pr, 1); - if (!S_ISCHR(st.st_mode) && blkid_probe_get_size(pr) <= 1024 * 1440 && - blkid_probe_is_wholedisk(pr)) { - /* - * check if the small disk is partitioned, if yes then - * don't probe for filesystems. - */ - blkid_probe_enable_superblocks(pr, 0); + if (!S_ISCHR(st.st_mode) && blkid_probe_get_size(pr) <= 1024 * 1440 && + blkid_probe_is_wholedisk(pr)) { + /* + * check if the small disk is partitioned, if yes then + * don't probe for filesystems. + */ + blkid_probe_enable_superblocks(pr, 0); - rc = blkid_do_fullprobe(pr); - if (rc < 0) - return rc; /* -1 = error, 1 = nothing, 0 = succes */ + rc = blkid_do_fullprobe(pr); + if (rc < 0) + return rc; /* -1 = error, 1 = nothing, 0 = succes */ - if (blkid_probe_lookup_value(pr, "PTTYPE", NULL, NULL) == 0) - return 0; /* partition table detected */ - } + if (blkid_probe_lookup_value(pr, "PTTYPE", NULL, NULL) == 0) + return 0; /* partition table detected */ + } - blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); - blkid_probe_enable_superblocks(pr, 1); + blkid_probe_set_partitions_flags(pr, BLKID_PARTS_ENTRY_DETAILS); + blkid_probe_enable_superblocks(pr, 1); - return blkid_do_safeprobe(pr); + return blkid_do_safeprobe(pr); } static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) { - struct udev *udev = udev_device_get_udev(dev); - int64_t offset = 0; - bool noraid = false; - int fd = -1; - blkid_probe pr; - const char *data; - const char *name; - int nvals; - int i; - size_t len; - int err = 0; - - static const struct option options[] = { - { "offset", optional_argument, NULL, 'o' }, - { "noraid", no_argument, NULL, 'R' }, - {} - }; - - for (;;) { - int option; - - option = getopt_long(argc, argv, "oR", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'o': - offset = strtoull(optarg, NULL, 0); - break; - case 'R': - noraid = true; - break; - } - } - - pr = blkid_new_probe(); - if (!pr) { - err = -ENOMEM; - return EXIT_FAILURE; - } - - blkid_probe_set_superblocks_flags(pr, - BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | - BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE | - BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION); - - if (noraid) - blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID); - - fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC); - if (fd < 0) { - fprintf(stderr, "error: %s: %m\n", udev_device_get_devnode(dev)); - goto out; - } - - err = blkid_probe_set_device(pr, fd, offset, 0); - if (err < 0) - goto out; - - info(udev, "probe %s %sraid offset=%llu\n", - udev_device_get_devnode(dev), - noraid ? "no" : "", (unsigned long long) offset); - - err = probe_superblocks(pr); - if (err < 0) - goto out; - - nvals = blkid_probe_numof_values(pr); - for (i = 0; i < nvals; i++) { - if (blkid_probe_get_value(pr, i, &name, &data, &len)) - continue; - len = strnlen((char *) data, len); - print_property(dev, test, name, (char *) data); - } - - blkid_free_probe(pr); + struct udev *udev = udev_device_get_udev(dev); + int64_t offset = 0; + bool noraid = false; + int fd = -1; + blkid_probe pr; + const char *data; + const char *name; + int nvals; + int i; + size_t len; + int err = 0; + + static const struct option options[] = { + { "offset", optional_argument, NULL, 'o' }, + { "noraid", no_argument, NULL, 'R' }, + {} + }; + + for (;;) { + int option; + + option = getopt_long(argc, argv, "oR", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'o': + offset = strtoull(optarg, NULL, 0); + break; + case 'R': + noraid = true; + break; + } + } + + pr = blkid_new_probe(); + if (!pr) { + err = -ENOMEM; + return EXIT_FAILURE; + } + + blkid_probe_set_superblocks_flags(pr, + BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | + BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE | + BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION); + + if (noraid) + blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID); + + fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC); + if (fd < 0) { + fprintf(stderr, "error: %s: %m\n", udev_device_get_devnode(dev)); + goto out; + } + + err = blkid_probe_set_device(pr, fd, offset, 0); + if (err < 0) + goto out; + + info(udev, "probe %s %sraid offset=%llu\n", + udev_device_get_devnode(dev), + noraid ? "no" : "", (unsigned long long) offset); + + err = probe_superblocks(pr); + if (err < 0) + goto out; + + nvals = blkid_probe_numof_values(pr); + for (i = 0; i < nvals; i++) { + if (blkid_probe_get_value(pr, i, &name, &data, &len)) + continue; + len = strnlen((char *) data, len); + print_property(dev, test, name, (char *) data); + } + + blkid_free_probe(pr); out: - if (fd > 0) - close(fd); - if (err < 0) - return EXIT_FAILURE; - return EXIT_SUCCESS; + if (fd > 0) + close(fd); + if (err < 0) + return EXIT_FAILURE; + return EXIT_SUCCESS; } const struct udev_builtin udev_builtin_blkid = { - .name = "blkid", - .cmd = builtin_blkid, - .help = "filesystem and partition probing", - .run_once = true, + .name = "blkid", + .cmd = builtin_blkid, + .help = "filesystem and partition probing", + .run_once = true, }; diff --git a/src/udev-builtin-firmware.c b/src/udev-builtin-firmware.c index 6d03085af7..d212c64b4d 100644 --- a/src/udev-builtin-firmware.c +++ b/src/udev-builtin-firmware.c @@ -29,140 +29,140 @@ static bool set_loading(struct udev *udev, char *loadpath, const char *state) { - FILE *ldfile; - - ldfile = fopen(loadpath, "we"); - if (ldfile == NULL) { - err(udev, "error: can not open '%s'\n", loadpath); - return false; - }; - fprintf(ldfile, "%s\n", state); - fclose(ldfile); - return true; + FILE *ldfile; + + ldfile = fopen(loadpath, "we"); + if (ldfile == NULL) { + err(udev, "error: can not open '%s'\n", loadpath); + return false; + }; + fprintf(ldfile, "%s\n", state); + fclose(ldfile); + return true; } static bool copy_firmware(struct udev *udev, const char *source, const char *target, size_t size) { - char *buf; - FILE *fsource = NULL, *ftarget = NULL; - bool ret = false; - - buf = malloc(size); - if (buf == NULL) { - err(udev,"No memory available to load firmware file"); - return false; - } - - info(udev, "writing '%s' (%zi) to '%s'\n", source, size, target); - - fsource = fopen(source, "re"); - if (fsource == NULL) - goto exit; - ftarget = fopen(target, "we"); - if (ftarget == NULL) - goto exit; - if (fread(buf, size, 1, fsource) != 1) - goto exit; - if (fwrite(buf, size, 1, ftarget) == 1) - ret = true; + char *buf; + FILE *fsource = NULL, *ftarget = NULL; + bool ret = false; + + buf = malloc(size); + if (buf == NULL) { + err(udev,"No memory available to load firmware file"); + return false; + } + + info(udev, "writing '%s' (%zi) to '%s'\n", source, size, target); + + fsource = fopen(source, "re"); + if (fsource == NULL) + goto exit; + ftarget = fopen(target, "we"); + if (ftarget == NULL) + goto exit; + if (fread(buf, size, 1, fsource) != 1) + goto exit; + if (fwrite(buf, size, 1, ftarget) == 1) + ret = true; exit: - if (ftarget != NULL) - fclose(ftarget); - if (fsource != NULL) - fclose(fsource); - free(buf); - return ret; + if (ftarget != NULL) + fclose(ftarget); + if (fsource != NULL) + fclose(fsource); + free(buf); + return ret; } static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], bool test) { - struct udev *udev = udev_device_get_udev(dev); - static const char *searchpath[] = { FIRMWARE_PATH }; - char fwencpath[UTIL_PATH_SIZE]; - char misspath[UTIL_PATH_SIZE]; - char loadpath[UTIL_PATH_SIZE]; - char datapath[UTIL_PATH_SIZE]; - char fwpath[UTIL_PATH_SIZE]; - const char *firmware; - FILE *fwfile; - struct utsname kernel; - struct stat statbuf; - unsigned int i; - int rc = EXIT_SUCCESS; - - firmware = udev_device_get_property_value(dev, "FIRMWARE"); - if (firmware == NULL) { - err(udev, "firmware parameter missing\n\n"); - rc = EXIT_FAILURE; - goto exit; - } - - /* lookup firmware file */ - uname(&kernel); - for (i = 0; i < ARRAY_SIZE(searchpath); i++) { - util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); - dbg(udev, "trying %s\n", fwpath); - fwfile = fopen(fwpath, "re"); - if (fwfile != NULL) - break; - - util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); - dbg(udev, "trying %s\n", fwpath); - fwfile = fopen(fwpath, "re"); - if (fwfile != NULL) - break; - } - - util_path_encode(firmware, fwencpath, sizeof(fwencpath)); - util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL); - util_strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); - - if (fwfile == NULL) { - int err; - - /* This link indicates the missing firmware file and the associated device */ - info(udev, "did not find firmware file '%s'\n", firmware); - do { - err = util_create_path(udev, misspath); - if (err != 0 && err != -ENOENT) - break; - err = symlink(udev_device_get_devpath(dev), misspath); - if (err != 0) - err = -errno; - } while (err == -ENOENT); - rc = EXIT_FAILURE; - set_loading(udev, loadpath, "-1"); - goto exit; - } - - if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { - rc = EXIT_FAILURE; - goto exit; - } - if (unlink(misspath) == 0) - util_delete_path(udev, misspath); - - if (!set_loading(udev, loadpath, "1")) - goto exit; - - util_strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); - if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { - err(udev, "error sending firmware '%s' to device\n", firmware); - set_loading(udev, loadpath, "-1"); - rc = EXIT_FAILURE; - goto exit; - }; - - set_loading(udev, loadpath, "0"); + struct udev *udev = udev_device_get_udev(dev); + static const char *searchpath[] = { FIRMWARE_PATH }; + char fwencpath[UTIL_PATH_SIZE]; + char misspath[UTIL_PATH_SIZE]; + char loadpath[UTIL_PATH_SIZE]; + char datapath[UTIL_PATH_SIZE]; + char fwpath[UTIL_PATH_SIZE]; + const char *firmware; + FILE *fwfile; + struct utsname kernel; + struct stat statbuf; + unsigned int i; + int rc = EXIT_SUCCESS; + + firmware = udev_device_get_property_value(dev, "FIRMWARE"); + if (firmware == NULL) { + err(udev, "firmware parameter missing\n\n"); + rc = EXIT_FAILURE; + goto exit; + } + + /* lookup firmware file */ + uname(&kernel); + for (i = 0; i < ARRAY_SIZE(searchpath); i++) { + util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); + dbg(udev, "trying %s\n", fwpath); + fwfile = fopen(fwpath, "re"); + if (fwfile != NULL) + break; + + util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); + dbg(udev, "trying %s\n", fwpath); + fwfile = fopen(fwpath, "re"); + if (fwfile != NULL) + break; + } + + util_path_encode(firmware, fwencpath, sizeof(fwencpath)); + util_strscpyl(misspath, sizeof(misspath), udev_get_run_path(udev), "/firmware-missing/", fwencpath, NULL); + util_strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); + + if (fwfile == NULL) { + int err; + + /* This link indicates the missing firmware file and the associated device */ + info(udev, "did not find firmware file '%s'\n", firmware); + do { + err = util_create_path(udev, misspath); + if (err != 0 && err != -ENOENT) + break; + err = symlink(udev_device_get_devpath(dev), misspath); + if (err != 0) + err = -errno; + } while (err == -ENOENT); + rc = EXIT_FAILURE; + set_loading(udev, loadpath, "-1"); + goto exit; + } + + if (stat(fwpath, &statbuf) < 0 || statbuf.st_size == 0) { + rc = EXIT_FAILURE; + goto exit; + } + if (unlink(misspath) == 0) + util_delete_path(udev, misspath); + + if (!set_loading(udev, loadpath, "1")) + goto exit; + + util_strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); + if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { + err(udev, "error sending firmware '%s' to device\n", firmware); + set_loading(udev, loadpath, "-1"); + rc = EXIT_FAILURE; + goto exit; + }; + + set_loading(udev, loadpath, "0"); exit: - if (fwfile) - fclose(fwfile); - return rc; + if (fwfile) + fclose(fwfile); + return rc; } const struct udev_builtin udev_builtin_firmware = { - .name = "firmware", - .cmd = builtin_firmware, - .help = "kernel firmware loader", - .run_once = true, + .name = "firmware", + .cmd = builtin_firmware, + .help = "kernel firmware loader", + .run_once = true, }; diff --git a/src/udev-builtin-hwdb.c b/src/udev-builtin-hwdb.c index b6af4b6fcf..aa996f375d 100644 --- a/src/udev-builtin-hwdb.c +++ b/src/udev-builtin-hwdb.c @@ -28,220 +28,220 @@ #include "udev.h" static int get_id_attr( - struct udev_device *parent, - const char *name, - uint16_t *value) { + struct udev_device *parent, + const char *name, + uint16_t *value) { - const char *t; - unsigned u; + const char *t; + unsigned u; - if (!(t = udev_device_get_sysattr_value(parent, name))) { - fprintf(stderr, "%s lacks %s.\n", udev_device_get_syspath(parent), name); - return -1; - } + if (!(t = udev_device_get_sysattr_value(parent, name))) { + fprintf(stderr, "%s lacks %s.\n", udev_device_get_syspath(parent), name); + return -1; + } - if (!strncmp(t, "0x", 2)) - t += 2; + if (!strncmp(t, "0x", 2)) + t += 2; - if (sscanf(t, "%04x", &u) != 1 || u > 0xFFFFU) { - fprintf(stderr, "Failed to parse %s on %s.\n", name, udev_device_get_syspath(parent)); - return -1; - } + if (sscanf(t, "%04x", &u) != 1 || u > 0xFFFFU) { + fprintf(stderr, "Failed to parse %s on %s.\n", name, udev_device_get_syspath(parent)); + return -1; + } - *value = (uint16_t) u; - return 0; + *value = (uint16_t) u; + return 0; } static int get_vid_pid( - struct udev_device *parent, - const char *vendor_attr, - const char *product_attr, - uint16_t *vid, - uint16_t *pid) { - - if (get_id_attr(parent, vendor_attr, vid) < 0) - return -1; - else if (*vid <= 0) { - fprintf(stderr, "Invalid vendor id.\n"); - return -1; - } - - if (get_id_attr(parent, product_attr, pid) < 0) - return -1; - - return 0; + struct udev_device *parent, + const char *vendor_attr, + const char *product_attr, + uint16_t *vid, + uint16_t *pid) { + + if (get_id_attr(parent, vendor_attr, vid) < 0) + return -1; + else if (*vid <= 0) { + fprintf(stderr, "Invalid vendor id.\n"); + return -1; + } + + if (get_id_attr(parent, product_attr, pid) < 0) + return -1; + + return 0; } static void rstrip(char *n) { - size_t i; + size_t i; - for (i = strlen(n); i > 0 && isspace(n[i-1]); i--) - n[i-1] = 0; + for (i = strlen(n); i > 0 && isspace(n[i-1]); i--) + n[i-1] = 0; } #define HEXCHARS "0123456789abcdefABCDEF" #define WHITESPACE " \t\n\r" static int lookup_vid_pid(const char *database, - uint16_t vid, uint16_t pid, - char **vendor, char **product) + uint16_t vid, uint16_t pid, + char **vendor, char **product) { - FILE *f; - int ret = -1; - int found_vendor = 0; - char *line = NULL; + FILE *f; + int ret = -1; + int found_vendor = 0; + char *line = NULL; - *vendor = *product = NULL; + *vendor = *product = NULL; - if (!(f = fopen(database, "rme"))) { - fprintf(stderr, "Failed to open database file '%s': %s\n", database, strerror(errno)); - return -1; - } + if (!(f = fopen(database, "rme"))) { + fprintf(stderr, "Failed to open database file '%s': %s\n", database, strerror(errno)); + return -1; + } - for (;;) { - size_t n; + for (;;) { + size_t n; - if (getline(&line, &n, f) < 0) - break; + if (getline(&line, &n, f) < 0) + break; - rstrip(line); + rstrip(line); - if (line[0] == '#' || line[0] == 0) - continue; + if (line[0] == '#' || line[0] == 0) + continue; - if (strspn(line, HEXCHARS) == 4) { - unsigned u; + if (strspn(line, HEXCHARS) == 4) { + unsigned u; - if (found_vendor) - break; + if (found_vendor) + break; - if (sscanf(line, "%04x", &u) == 1 && u == vid) { - char *t; + if (sscanf(line, "%04x", &u) == 1 && u == vid) { + char *t; - t = line+4; - t += strspn(t, WHITESPACE); + t = line+4; + t += strspn(t, WHITESPACE); - if (!(*vendor = strdup(t))) { - fprintf(stderr, "Out of memory.\n"); - goto finish; - } + if (!(*vendor = strdup(t))) { + fprintf(stderr, "Out of memory.\n"); + goto finish; + } - found_vendor = 1; - } + found_vendor = 1; + } - continue; - } + continue; + } - if (found_vendor && line[0] == '\t' && strspn(line+1, HEXCHARS) == 4) { - unsigned u; + if (found_vendor && line[0] == '\t' && strspn(line+1, HEXCHARS) == 4) { + unsigned u; - if (sscanf(line+1, "%04x", &u) == 1 && u == pid) { - char *t; + if (sscanf(line+1, "%04x", &u) == 1 && u == pid) { + char *t; - t = line+5; - t += strspn(t, WHITESPACE); + t = line+5; + t += strspn(t, WHITESPACE); - if (!(*product = strdup(t))) { - fprintf(stderr, "Out of memory.\n"); - goto finish; - } + if (!(*product = strdup(t))) { + fprintf(stderr, "Out of memory.\n"); + goto finish; + } - break; - } - } - } + break; + } + } + } - ret = 0; + ret = 0; finish: - free(line); - fclose(f); + free(line); + fclose(f); - if (ret < 0) { - free(*product); - free(*vendor); + if (ret < 0) { + free(*product); + free(*vendor); - *product = *vendor = NULL; - } + *product = *vendor = NULL; + } - return ret; + return ret; } static struct udev_device *find_device(struct udev_device *dev, const char *subsys, const char *devtype) { - const char *str; - - str = udev_device_get_subsystem(dev); - if (str == NULL) - goto try_parent; - if (strcmp(str, subsys) != 0) - goto try_parent; - - if (devtype != NULL) { - str = udev_device_get_devtype(dev); - if (str == NULL) - goto try_parent; - if (strcmp(str, devtype) != 0) - goto try_parent; - } - return dev; + const char *str; + + str = udev_device_get_subsystem(dev); + if (str == NULL) + goto try_parent; + if (strcmp(str, subsys) != 0) + goto try_parent; + + if (devtype != NULL) { + str = udev_device_get_devtype(dev); + if (str == NULL) + goto try_parent; + if (strcmp(str, devtype) != 0) + goto try_parent; + } + return dev; try_parent: - return udev_device_get_parent_with_subsystem_devtype(dev, subsys, devtype); + return udev_device_get_parent_with_subsystem_devtype(dev, subsys, devtype); } static int builtin_db(struct udev_device *dev, bool test, - const char *database, - const char *vendor_attr, const char *product_attr, - const char *subsys, const char *devtype) + const char *database, + const char *vendor_attr, const char *product_attr, + const char *subsys, const char *devtype) { - struct udev_device *parent; - uint16_t vid = 0, pid = 0; - char *vendor = NULL, *product = NULL; + struct udev_device *parent; + uint16_t vid = 0, pid = 0; + char *vendor = NULL, *product = NULL; - parent = find_device(dev, subsys, devtype); - if (!parent) { - fprintf(stderr, "Failed to find device.\n"); - goto finish; - } + parent = find_device(dev, subsys, devtype); + if (!parent) { + fprintf(stderr, "Failed to find device.\n"); + goto finish; + } - if (get_vid_pid(parent, vendor_attr, product_attr, &vid, &pid) < 0) - goto finish; + if (get_vid_pid(parent, vendor_attr, product_attr, &vid, &pid) < 0) + goto finish; - if (lookup_vid_pid(database, vid, pid, &vendor, &product) < 0) - goto finish; + if (lookup_vid_pid(database, vid, pid, &vendor, &product) < 0) + goto finish; - if (vendor) - udev_builtin_add_property(dev, test, "ID_VENDOR_FROM_DATABASE", vendor); - if (product) - udev_builtin_add_property(dev, test, "ID_MODEL_FROM_DATABASE", product); + if (vendor) + udev_builtin_add_property(dev, test, "ID_VENDOR_FROM_DATABASE", vendor); + if (product) + udev_builtin_add_property(dev, test, "ID_MODEL_FROM_DATABASE", product); finish: - free(vendor); - free(product); - return 0; + free(vendor); + free(product); + return 0; } static int builtin_usb_db(struct udev_device *dev, int argc, char *argv[], bool test) { - return builtin_db(dev, test, USB_DATABASE, "idVendor", "idProduct", "usb", "usb_device"); + return builtin_db(dev, test, USB_DATABASE, "idVendor", "idProduct", "usb", "usb_device"); } static int builtin_pci_db(struct udev_device *dev, int argc, char *argv[], bool test) { - return builtin_db(dev, test, PCI_DATABASE, "vendor", "device", "pci", NULL); + return builtin_db(dev, test, PCI_DATABASE, "vendor", "device", "pci", NULL); } const struct udev_builtin udev_builtin_usb_db = { - .name = "usb-db", - .cmd = builtin_usb_db, - .help = "USB vendor/product database", - .run_once = true, + .name = "usb-db", + .cmd = builtin_usb_db, + .help = "USB vendor/product database", + .run_once = true, }; const struct udev_builtin udev_builtin_pci_db = { - .name = "pci-db", - .cmd = builtin_pci_db, - .help = "PCI vendor/product database", - .run_once = true, + .name = "pci-db", + .cmd = builtin_pci_db, + .help = "PCI vendor/product database", + .run_once = true, }; diff --git a/src/udev-builtin-input_id.c b/src/udev-builtin-input_id.c index c0c4270256..a062ef7c7a 100644 --- a/src/udev-builtin-input_id.c +++ b/src/udev-builtin-input_id.c @@ -45,174 +45,174 @@ * @param bitmask: Output array which has a sizeof of bitmask_size */ static void get_cap_mask(struct udev_device *dev, - struct udev_device *pdev, const char* attr, - unsigned long *bitmask, size_t bitmask_size, - bool test) + struct udev_device *pdev, const char* attr, + unsigned long *bitmask, size_t bitmask_size, + bool test) { - struct udev *udev = udev_device_get_udev(dev); - char text[4096]; - unsigned i; - char* word; - unsigned long val; - - snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(pdev, attr)); - info(udev, "%s raw kernel attribute: %s\n", attr, text); - - memset (bitmask, 0, bitmask_size); - i = 0; - while ((word = strrchr(text, ' ')) != NULL) { - val = strtoul (word+1, NULL, 16); - if (i < bitmask_size/sizeof(unsigned long)) - bitmask[i] = val; - else - info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); - *word = '\0'; - ++i; - } - val = strtoul (text, NULL, 16); - if (i < bitmask_size / sizeof(unsigned long)) - bitmask[i] = val; - else - info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); - - if (test) { - /* printf pattern with the right unsigned long number of hex chars */ - snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long)); - info(udev, "%s decoded bit map:\n", attr); - val = bitmask_size / sizeof (unsigned long); - /* skip over leading zeros */ - while (bitmask[val-1] == 0 && val > 0) - --val; - for (i = 0; i < val; ++i) - info(udev, text, i * BITS_PER_LONG, bitmask[i]); - } + struct udev *udev = udev_device_get_udev(dev); + char text[4096]; + unsigned i; + char* word; + unsigned long val; + + snprintf(text, sizeof(text), "%s", udev_device_get_sysattr_value(pdev, attr)); + info(udev, "%s raw kernel attribute: %s\n", attr, text); + + memset (bitmask, 0, bitmask_size); + i = 0; + while ((word = strrchr(text, ' ')) != NULL) { + val = strtoul (word+1, NULL, 16); + if (i < bitmask_size/sizeof(unsigned long)) + bitmask[i] = val; + else + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); + *word = '\0'; + ++i; + } + val = strtoul (text, NULL, 16); + if (i < bitmask_size / sizeof(unsigned long)) + bitmask[i] = val; + else + info(udev, "ignoring %s block %lX which is larger than maximum size\n", attr, val); + + if (test) { + /* printf pattern with the right unsigned long number of hex chars */ + snprintf(text, sizeof(text), " bit %%4u: %%0%zilX\n", 2 * sizeof(unsigned long)); + info(udev, "%s decoded bit map:\n", attr); + val = bitmask_size / sizeof (unsigned long); + /* skip over leading zeros */ + while (bitmask[val-1] == 0 && val > 0) + --val; + for (i = 0; i < val; ++i) + info(udev, text, i * BITS_PER_LONG, bitmask[i]); + } } /* pointer devices */ static void test_pointers (struct udev_device *dev, - const unsigned long* bitmask_ev, - const unsigned long* bitmask_abs, - const unsigned long* bitmask_key, - const unsigned long* bitmask_rel, - bool test) + const unsigned long* bitmask_ev, + const unsigned long* bitmask_abs, + const unsigned long* bitmask_key, + const unsigned long* bitmask_rel, + bool test) { - int is_mouse = 0; - int is_touchpad = 0; - - if (!test_bit (EV_KEY, bitmask_ev)) { - if (test_bit (EV_ABS, bitmask_ev) && - test_bit (ABS_X, bitmask_abs) && - test_bit (ABS_Y, bitmask_abs) && - test_bit (ABS_Z, bitmask_abs)) - udev_builtin_add_property(dev, test, "ID_INPUT_ACCELEROMETER", "1"); - return; - } - - if (test_bit (EV_ABS, bitmask_ev) && - test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { - if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) - udev_builtin_add_property(dev, test, "ID_INPUT_TABLET", "1"); - else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) - is_touchpad = 1; - else if (test_bit (BTN_TRIGGER, bitmask_key) || - test_bit (BTN_A, bitmask_key) || - test_bit (BTN_1, bitmask_key)) - udev_builtin_add_property(dev, test, "ID_INPUT_JOYSTICK", "1"); - else if (test_bit (BTN_MOUSE, bitmask_key)) - /* This path is taken by VMware's USB mouse, which has - * absolute axes, but no touch/pressure button. */ - is_mouse = 1; - else if (test_bit (BTN_TOUCH, bitmask_key)) - udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHSCREEN", "1"); - } - - if (test_bit (EV_REL, bitmask_ev) && - test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && - test_bit (BTN_MOUSE, bitmask_key)) - is_mouse = 1; - - if (is_mouse) - udev_builtin_add_property(dev, test, "ID_INPUT_MOUSE", "1"); - if (is_touchpad) - udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHPAD", "1"); + int is_mouse = 0; + int is_touchpad = 0; + + if (!test_bit (EV_KEY, bitmask_ev)) { + if (test_bit (EV_ABS, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && + test_bit (ABS_Y, bitmask_abs) && + test_bit (ABS_Z, bitmask_abs)) + udev_builtin_add_property(dev, test, "ID_INPUT_ACCELEROMETER", "1"); + return; + } + + if (test_bit (EV_ABS, bitmask_ev) && + test_bit (ABS_X, bitmask_abs) && test_bit (ABS_Y, bitmask_abs)) { + if (test_bit (BTN_STYLUS, bitmask_key) || test_bit (BTN_TOOL_PEN, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_TABLET", "1"); + else if (test_bit (BTN_TOOL_FINGER, bitmask_key) && !test_bit (BTN_TOOL_PEN, bitmask_key)) + is_touchpad = 1; + else if (test_bit (BTN_TRIGGER, bitmask_key) || + test_bit (BTN_A, bitmask_key) || + test_bit (BTN_1, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_JOYSTICK", "1"); + else if (test_bit (BTN_MOUSE, bitmask_key)) + /* This path is taken by VMware's USB mouse, which has + * absolute axes, but no touch/pressure button. */ + is_mouse = 1; + else if (test_bit (BTN_TOUCH, bitmask_key)) + udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHSCREEN", "1"); + } + + if (test_bit (EV_REL, bitmask_ev) && + test_bit (REL_X, bitmask_rel) && test_bit (REL_Y, bitmask_rel) && + test_bit (BTN_MOUSE, bitmask_key)) + is_mouse = 1; + + if (is_mouse) + udev_builtin_add_property(dev, test, "ID_INPUT_MOUSE", "1"); + if (is_touchpad) + udev_builtin_add_property(dev, test, "ID_INPUT_TOUCHPAD", "1"); } /* key like devices */ static void test_key (struct udev_device *dev, - const unsigned long* bitmask_ev, - const unsigned long* bitmask_key, - bool test) + const unsigned long* bitmask_ev, + const unsigned long* bitmask_key, + bool test) { - struct udev *udev = udev_device_get_udev(dev); - unsigned i; - unsigned long found; - unsigned long mask; - - /* do we have any KEY_* capability? */ - if (!test_bit (EV_KEY, bitmask_ev)) { - info(udev, "test_key: no EV_KEY capability\n"); - return; - } - - /* only consider KEY_* here, not BTN_* */ - found = 0; - for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) { - found |= bitmask_key[i]; - info(udev, "test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); - } - /* If there are no keys in the lower block, check the higher block */ - if (!found) { - for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) { - if (test_bit (i, bitmask_key)) { - info(udev, "test_key: Found key %x in high block\n", i); - found = 1; - break; - } - } - } - - if (found > 0) - udev_builtin_add_property(dev, test, "ID_INPUT_KEY", "1"); - - /* the first 32 bits are ESC, numbers, and Q to D; if we have all of - * those, consider it a full keyboard; do not test KEY_RESERVED, though */ - mask = 0xFFFFFFFE; - if ((bitmask_key[0] & mask) == mask) - udev_builtin_add_property(dev, test, "ID_INPUT_KEYBOARD", "1"); + struct udev *udev = udev_device_get_udev(dev); + unsigned i; + unsigned long found; + unsigned long mask; + + /* do we have any KEY_* capability? */ + if (!test_bit (EV_KEY, bitmask_ev)) { + info(udev, "test_key: no EV_KEY capability\n"); + return; + } + + /* only consider KEY_* here, not BTN_* */ + found = 0; + for (i = 0; i < BTN_MISC/BITS_PER_LONG; ++i) { + found |= bitmask_key[i]; + info(udev, "test_key: checking bit block %lu for any keys; found=%i\n", i*BITS_PER_LONG, found > 0); + } + /* If there are no keys in the lower block, check the higher block */ + if (!found) { + for (i = KEY_OK; i < BTN_TRIGGER_HAPPY; ++i) { + if (test_bit (i, bitmask_key)) { + info(udev, "test_key: Found key %x in high block\n", i); + found = 1; + break; + } + } + } + + if (found > 0) + udev_builtin_add_property(dev, test, "ID_INPUT_KEY", "1"); + + /* the first 32 bits are ESC, numbers, and Q to D; if we have all of + * those, consider it a full keyboard; do not test KEY_RESERVED, though */ + mask = 0xFFFFFFFE; + if ((bitmask_key[0] & mask) == mask) + udev_builtin_add_property(dev, test, "ID_INPUT_KEYBOARD", "1"); } static int builtin_input_id(struct udev_device *dev, int argc, char *argv[], bool test) { - struct udev_device *pdev; - unsigned long bitmask_ev[NBITS(EV_MAX)]; - unsigned long bitmask_abs[NBITS(ABS_MAX)]; - unsigned long bitmask_key[NBITS(KEY_MAX)]; - unsigned long bitmask_rel[NBITS(REL_MAX)]; - - /* walk up the parental chain until we find the real input device; the - * argument is very likely a subdevice of this, like eventN */ - pdev = dev; - while (pdev != NULL && udev_device_get_sysattr_value(pdev, "capabilities/ev") == NULL) - pdev = udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); - - /* not an "input" class device */ - if (pdev == NULL) - return EXIT_SUCCESS; - - /* Use this as a flag that input devices were detected, so that this - * program doesn't need to be called more than once per device */ - udev_builtin_add_property(dev, test, "ID_INPUT", "1"); - get_cap_mask(dev, pdev, "capabilities/ev", bitmask_ev, sizeof(bitmask_ev), test); - get_cap_mask(dev, pdev, "capabilities/abs", bitmask_abs, sizeof(bitmask_abs), test); - get_cap_mask(dev, pdev, "capabilities/rel", bitmask_rel, sizeof(bitmask_rel), test); - get_cap_mask(dev, pdev, "capabilities/key", bitmask_key, sizeof(bitmask_key), test); - test_pointers(dev, bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel, test); - test_key(dev, bitmask_ev, bitmask_key, test); - return EXIT_SUCCESS; + struct udev_device *pdev; + unsigned long bitmask_ev[NBITS(EV_MAX)]; + unsigned long bitmask_abs[NBITS(ABS_MAX)]; + unsigned long bitmask_key[NBITS(KEY_MAX)]; + unsigned long bitmask_rel[NBITS(REL_MAX)]; + + /* walk up the parental chain until we find the real input device; the + * argument is very likely a subdevice of this, like eventN */ + pdev = dev; + while (pdev != NULL && udev_device_get_sysattr_value(pdev, "capabilities/ev") == NULL) + pdev = udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); + + /* not an "input" class device */ + if (pdev == NULL) + return EXIT_SUCCESS; + + /* Use this as a flag that input devices were detected, so that this + * program doesn't need to be called more than once per device */ + udev_builtin_add_property(dev, test, "ID_INPUT", "1"); + get_cap_mask(dev, pdev, "capabilities/ev", bitmask_ev, sizeof(bitmask_ev), test); + get_cap_mask(dev, pdev, "capabilities/abs", bitmask_abs, sizeof(bitmask_abs), test); + get_cap_mask(dev, pdev, "capabilities/rel", bitmask_rel, sizeof(bitmask_rel), test); + get_cap_mask(dev, pdev, "capabilities/key", bitmask_key, sizeof(bitmask_key), test); + test_pointers(dev, bitmask_ev, bitmask_abs, bitmask_key, bitmask_rel, test); + test_key(dev, bitmask_ev, bitmask_key, test); + return EXIT_SUCCESS; } const struct udev_builtin udev_builtin_input_id = { - .name = "input_id", - .cmd = builtin_input_id, - .help = "input device properties", + .name = "input_id", + .cmd = builtin_input_id, + .help = "input device properties", }; diff --git a/src/udev-builtin-kmod.c b/src/udev-builtin-kmod.c index 68536f17ff..d0a1f28e2f 100644 --- a/src/udev-builtin-kmod.c +++ b/src/udev-builtin-kmod.c @@ -35,114 +35,114 @@ static struct kmod_ctx *ctx; static int load_module(struct udev *udev, const char *alias) { - struct kmod_list *list = NULL; - struct kmod_list *listb = NULL; - struct kmod_list *l; - int err; - - err = kmod_module_new_from_lookup(ctx, alias, &list); - if (err < 0) - return err; - - err = kmod_module_get_filtered_blacklist(ctx, list, &listb); - if (err < 0) - return err; - - if (list == NULL) - info(udev, "no module matches '%s'\n", alias); - else if (listb == NULL) - info(udev, "modules matching '%s' are blacklisted\n", alias); - - kmod_list_foreach(l, listb) { - struct kmod_module *mod = kmod_module_get_module(l); - - err = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL); - if (err >=0 ) - info(udev, "inserted '%s'\n", kmod_module_get_name(mod)); - else - info(udev, "failed to insert '%s'\n", kmod_module_get_name(mod)); - - kmod_module_unref(mod); - } - - kmod_module_unref_list(list); - kmod_module_unref_list(listb); - return err; + struct kmod_list *list = NULL; + struct kmod_list *listb = NULL; + struct kmod_list *l; + int err; + + err = kmod_module_new_from_lookup(ctx, alias, &list); + if (err < 0) + return err; + + err = kmod_module_get_filtered_blacklist(ctx, list, &listb); + if (err < 0) + return err; + + if (list == NULL) + info(udev, "no module matches '%s'\n", alias); + else if (listb == NULL) + info(udev, "modules matching '%s' are blacklisted\n", alias); + + kmod_list_foreach(l, listb) { + struct kmod_module *mod = kmod_module_get_module(l); + + err = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL); + if (err >=0 ) + info(udev, "inserted '%s'\n", kmod_module_get_name(mod)); + else + info(udev, "failed to insert '%s'\n", kmod_module_get_name(mod)); + + kmod_module_unref(mod); + } + + kmod_module_unref_list(list); + kmod_module_unref_list(listb); + return err; } static void udev_kmod_log(void *data, int priority, const char *file, int line, - const char *fn, const char *format, va_list args) + const char *fn, const char *format, va_list args) { - udev_main_log(data, priority, file, line, fn, format, args); + udev_main_log(data, priority, file, line, fn, format, args); } /* needs to re-instantiate the context after a reload */ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool test) { - struct udev *udev = udev_device_get_udev(dev); - int i; - - if (!ctx) { - ctx = kmod_new(NULL, NULL); - if (!ctx) - return -ENOMEM; - - info(udev, "load module index\n"); - kmod_set_log_fn(ctx, udev_kmod_log, udev); - kmod_load_resources(ctx); - } - - if (argc < 3 || strcmp(argv[1], "load")) { - err(udev, "expect: %s load \n", argv[0]); - return EXIT_FAILURE; - } - - for (i = 2; argv[i]; i++) { - info(udev, "execute '%s' '%s'\n", argv[1], argv[i]); - load_module(udev, argv[i]); - } - - return EXIT_SUCCESS; + struct udev *udev = udev_device_get_udev(dev); + int i; + + if (!ctx) { + ctx = kmod_new(NULL, NULL); + if (!ctx) + return -ENOMEM; + + info(udev, "load module index\n"); + kmod_set_log_fn(ctx, udev_kmod_log, udev); + kmod_load_resources(ctx); + } + + if (argc < 3 || strcmp(argv[1], "load")) { + err(udev, "expect: %s load \n", argv[0]); + return EXIT_FAILURE; + } + + for (i = 2; argv[i]; i++) { + info(udev, "execute '%s' '%s'\n", argv[1], argv[i]); + load_module(udev, argv[i]); + } + + return EXIT_SUCCESS; } /* called at udev startup */ static int builtin_kmod_init(struct udev *udev) { - if (ctx) - return 0; + if (ctx) + return 0; - ctx = kmod_new(NULL, NULL); - if (!ctx) - return -ENOMEM; + ctx = kmod_new(NULL, NULL); + if (!ctx) + return -ENOMEM; - info(udev, "load module index\n"); - kmod_set_log_fn(ctx, udev_kmod_log, udev); - kmod_load_resources(ctx); - return 0; + info(udev, "load module index\n"); + kmod_set_log_fn(ctx, udev_kmod_log, udev); + kmod_load_resources(ctx); + return 0; } /* called on udev shutdown and reload request */ static void builtin_kmod_exit(struct udev *udev) { - info(udev, "unload module index\n"); - ctx = kmod_unref(ctx); + info(udev, "unload module index\n"); + ctx = kmod_unref(ctx); } /* called every couple of seconds during event activity; 'true' if config has changed */ static bool builtin_kmod_validate(struct udev *udev) { - info(udev, "validate module index\n"); - if (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK) - return true; - return false; + info(udev, "validate module index\n"); + if (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK) + return true; + return false; } const struct udev_builtin udev_builtin_kmod = { - .name = "kmod", - .cmd = builtin_kmod, - .init = builtin_kmod_init, - .exit = builtin_kmod_exit, - .validate = builtin_kmod_validate, - .help = "kernel module loader", - .run_once = false, + .name = "kmod", + .cmd = builtin_kmod, + .init = builtin_kmod_init, + .exit = builtin_kmod_exit, + .validate = builtin_kmod_validate, + .help = "kernel module loader", + .run_once = false, }; diff --git a/src/udev-builtin-path_id.c b/src/udev-builtin-path_id.c index 049e89b277..fa4d6fb5fd 100644 --- a/src/udev-builtin-path_id.c +++ b/src/udev-builtin-path_id.c @@ -34,30 +34,30 @@ static int path_prepend(char **path, const char *fmt, ...) { - va_list va; - char *pre; - int err = 0; - - va_start(va, fmt); - err = vasprintf(&pre, fmt, va); - va_end(va); - if (err < 0) - goto out; - - if (*path != NULL) { - char *new; - - err = asprintf(&new, "%s-%s", pre, *path); - free(pre); - if (err < 0) - goto out; - free(*path); - *path = new; - } else { - *path = pre; - } + va_list va; + char *pre; + int err = 0; + + va_start(va, fmt); + err = vasprintf(&pre, fmt, va); + va_end(va); + if (err < 0) + goto out; + + if (*path != NULL) { + char *new; + + err = asprintf(&new, "%s-%s", pre, *path); + free(pre); + if (err < 0) + goto out; + free(*path); + *path = new; + } else { + *path = pre; + } out: - return err; + return err; } /* @@ -66,422 +66,422 @@ out: */ static int format_lun_number(struct udev_device *dev, char **path) { - unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10); + unsigned long lun = strtoul(udev_device_get_sysnum(dev), NULL, 10); - /* address method 0, peripheral device addressing with bus id of zero */ - if (lun < 256) - return path_prepend(path, "lun-%d", lun); - /* handle all other lun addressing methods by using a variant of the original lun format */ - return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff); + /* address method 0, peripheral device addressing with bus id of zero */ + if (lun < 256) + return path_prepend(path, "lun-%d", lun); + /* handle all other lun addressing methods by using a variant of the original lun format */ + return path_prepend(path, "lun-0x%04x%04x00000000", (lun & 0xffff), (lun >> 16) & 0xffff); } static struct udev_device *skip_subsystem(struct udev_device *dev, const char *subsys) { - struct udev_device *parent = dev; - - while (parent != NULL) { - const char *subsystem; - - subsystem = udev_device_get_subsystem(parent); - if (subsystem == NULL || strcmp(subsystem, subsys) != 0) - break; - dev = parent; - parent = udev_device_get_parent(parent); - } - return dev; + struct udev_device *parent = dev; + + while (parent != NULL) { + const char *subsystem; + + subsystem = udev_device_get_subsystem(parent); + if (subsystem == NULL || strcmp(subsystem, subsys) != 0) + break; + dev = parent; + parent = udev_device_get_parent(parent); + } + return dev; } static struct udev_device *handle_scsi_fibre_channel(struct udev_device *parent, char **path) { - struct udev *udev = udev_device_get_udev(parent); - struct udev_device *targetdev; - struct udev_device *fcdev = NULL; - const char *port; - char *lun = NULL;; - - targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); - if (targetdev == NULL) - return NULL; - - fcdev = udev_device_new_from_subsystem_sysname(udev, "fc_transport", udev_device_get_sysname(targetdev)); - if (fcdev == NULL) - return NULL; - port = udev_device_get_sysattr_value(fcdev, "port_name"); - if (port == NULL) { - parent = NULL; - goto out; - } - - format_lun_number(parent, &lun); - path_prepend(path, "fc-%s-%s", port, lun); - if (lun) - free(lun); + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *targetdev; + struct udev_device *fcdev = NULL; + const char *port; + char *lun = NULL;; + + targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); + if (targetdev == NULL) + return NULL; + + fcdev = udev_device_new_from_subsystem_sysname(udev, "fc_transport", udev_device_get_sysname(targetdev)); + if (fcdev == NULL) + return NULL; + port = udev_device_get_sysattr_value(fcdev, "port_name"); + if (port == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "fc-%s-%s", port, lun); + if (lun) + free(lun); out: - udev_device_unref(fcdev); - return parent; + udev_device_unref(fcdev); + return parent; } static struct udev_device *handle_scsi_sas(struct udev_device *parent, char **path) { - struct udev *udev = udev_device_get_udev(parent); - struct udev_device *targetdev; - struct udev_device *target_parent; - struct udev_device *sasdev; - const char *sas_address; - char *lun = NULL; - - targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); - if (targetdev == NULL) - return NULL; - - target_parent = udev_device_get_parent(targetdev); - if (target_parent == NULL) - return NULL; - - sasdev = udev_device_new_from_subsystem_sysname(udev, "sas_device", - udev_device_get_sysname(target_parent)); - if (sasdev == NULL) - return NULL; - - sas_address = udev_device_get_sysattr_value(sasdev, "sas_address"); - if (sas_address == NULL) { - parent = NULL; - goto out; - } - - format_lun_number(parent, &lun); - path_prepend(path, "sas-%s-%s", sas_address, lun); - if (lun) - free(lun); + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *targetdev; + struct udev_device *target_parent; + struct udev_device *sasdev; + const char *sas_address; + char *lun = NULL; + + targetdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_target"); + if (targetdev == NULL) + return NULL; + + target_parent = udev_device_get_parent(targetdev); + if (target_parent == NULL) + return NULL; + + sasdev = udev_device_new_from_subsystem_sysname(udev, "sas_device", + udev_device_get_sysname(target_parent)); + if (sasdev == NULL) + return NULL; + + sas_address = udev_device_get_sysattr_value(sasdev, "sas_address"); + if (sas_address == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "sas-%s-%s", sas_address, lun); + if (lun) + free(lun); out: - udev_device_unref(sasdev); - return parent; + udev_device_unref(sasdev); + return parent; } static struct udev_device *handle_scsi_iscsi(struct udev_device *parent, char **path) { - struct udev *udev = udev_device_get_udev(parent); - struct udev_device *transportdev; - struct udev_device *sessiondev = NULL; - const char *target; - char *connname; - struct udev_device *conndev = NULL; - const char *addr; - const char *port; - char *lun = NULL; - - /* find iscsi session */ - transportdev = parent; - for (;;) { - transportdev = udev_device_get_parent(transportdev); - if (transportdev == NULL) - return NULL; - if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0) - break; - } - - /* find iscsi session device */ - sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev)); - if (sessiondev == NULL) - return NULL; - target = udev_device_get_sysattr_value(sessiondev, "targetname"); - if (target == NULL) { - parent = NULL; - goto out; - } - - if (asprintf(&connname, "connection%s:0", udev_device_get_sysnum(transportdev)) < 0) { - parent = NULL; - goto out; - } - conndev = udev_device_new_from_subsystem_sysname(udev, "iscsi_connection", connname); - free(connname); - if (conndev == NULL) { - parent = NULL; - goto out; - } - addr = udev_device_get_sysattr_value(conndev, "persistent_address"); - port = udev_device_get_sysattr_value(conndev, "persistent_port"); - if (addr == NULL || port == NULL) { - parent = NULL; - goto out; - } - - format_lun_number(parent, &lun); - path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun); - if (lun) - free(lun); + struct udev *udev = udev_device_get_udev(parent); + struct udev_device *transportdev; + struct udev_device *sessiondev = NULL; + const char *target; + char *connname; + struct udev_device *conndev = NULL; + const char *addr; + const char *port; + char *lun = NULL; + + /* find iscsi session */ + transportdev = parent; + for (;;) { + transportdev = udev_device_get_parent(transportdev); + if (transportdev == NULL) + return NULL; + if (strncmp(udev_device_get_sysname(transportdev), "session", 7) == 0) + break; + } + + /* find iscsi session device */ + sessiondev = udev_device_new_from_subsystem_sysname(udev, "iscsi_session", udev_device_get_sysname(transportdev)); + if (sessiondev == NULL) + return NULL; + target = udev_device_get_sysattr_value(sessiondev, "targetname"); + if (target == NULL) { + parent = NULL; + goto out; + } + + if (asprintf(&connname, "connection%s:0", udev_device_get_sysnum(transportdev)) < 0) { + parent = NULL; + goto out; + } + conndev = udev_device_new_from_subsystem_sysname(udev, "iscsi_connection", connname); + free(connname); + if (conndev == NULL) { + parent = NULL; + goto out; + } + addr = udev_device_get_sysattr_value(conndev, "persistent_address"); + port = udev_device_get_sysattr_value(conndev, "persistent_port"); + if (addr == NULL || port == NULL) { + parent = NULL; + goto out; + } + + format_lun_number(parent, &lun); + path_prepend(path, "ip-%s:%s-iscsi-%s-%s", addr, port, target, lun); + if (lun) + free(lun); out: - udev_device_unref(sessiondev); - udev_device_unref(conndev); - return parent; + udev_device_unref(sessiondev); + udev_device_unref(conndev); + return parent; } static struct udev_device *handle_scsi_default(struct udev_device *parent, char **path) { - struct udev_device *hostdev; - int host, bus, target, lun; - const char *name; - char *base; - char *pos; - DIR *dir; - struct dirent *dent; - int basenum; - - hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host"); - if (hostdev == NULL) - return NULL; - - name = udev_device_get_sysname(parent); - if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) - return NULL; - - /* rebase host offset to get the local relative number */ - basenum = -1; - base = strdup(udev_device_get_syspath(hostdev)); - if (base == NULL) - return NULL; - pos = strrchr(base, '/'); - if (pos == NULL) { - parent = NULL; - goto out; - } - pos[0] = '\0'; - dir = opendir(base); - if (dir == NULL) { - parent = NULL; - goto out; - } - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char *rest; - int i; - - if (dent->d_name[0] == '.') - continue; - if (dent->d_type != DT_DIR && dent->d_type != DT_LNK) - continue; - if (strncmp(dent->d_name, "host", 4) != 0) - continue; - i = strtoul(&dent->d_name[4], &rest, 10); - if (rest[0] != '\0') - continue; - if (basenum == -1 || i < basenum) - basenum = i; - } - closedir(dir); - if (basenum == -1) { - parent = NULL; - goto out; - } - host -= basenum; - - path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun); + struct udev_device *hostdev; + int host, bus, target, lun; + const char *name; + char *base; + char *pos; + DIR *dir; + struct dirent *dent; + int basenum; + + hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host"); + if (hostdev == NULL) + return NULL; + + name = udev_device_get_sysname(parent); + if (sscanf(name, "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) + return NULL; + + /* rebase host offset to get the local relative number */ + basenum = -1; + base = strdup(udev_device_get_syspath(hostdev)); + if (base == NULL) + return NULL; + pos = strrchr(base, '/'); + if (pos == NULL) { + parent = NULL; + goto out; + } + pos[0] = '\0'; + dir = opendir(base); + if (dir == NULL) { + parent = NULL; + goto out; + } + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char *rest; + int i; + + if (dent->d_name[0] == '.') + continue; + if (dent->d_type != DT_DIR && dent->d_type != DT_LNK) + continue; + if (strncmp(dent->d_name, "host", 4) != 0) + continue; + i = strtoul(&dent->d_name[4], &rest, 10); + if (rest[0] != '\0') + continue; + if (basenum == -1 || i < basenum) + basenum = i; + } + closedir(dir); + if (basenum == -1) { + parent = NULL; + goto out; + } + host -= basenum; + + path_prepend(path, "scsi-%u:%u:%u:%u", host, bus, target, lun); out: - free(base); - return hostdev; + free(base); + return hostdev; } static struct udev_device *handle_scsi(struct udev_device *parent, char **path) { - const char *devtype; - const char *name; - const char *id; - - devtype = udev_device_get_devtype(parent); - if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) - return parent; - - /* firewire */ - id = udev_device_get_sysattr_value(parent, "ieee1394_id"); - if (id != NULL) { - parent = skip_subsystem(parent, "scsi"); - path_prepend(path, "ieee1394-0x%s", id); - goto out; - } - - /* lousy scsi sysfs does not have a "subsystem" for the transport */ - name = udev_device_get_syspath(parent); - - if (strstr(name, "/rport-") != NULL) { - parent = handle_scsi_fibre_channel(parent, path); - goto out; - } - - if (strstr(name, "/end_device-") != NULL) { - parent = handle_scsi_sas(parent, path); - goto out; - } - - if (strstr(name, "/session") != NULL) { - parent = handle_scsi_iscsi(parent, path); - goto out; - } - - parent = handle_scsi_default(parent, path); + const char *devtype; + const char *name; + const char *id; + + devtype = udev_device_get_devtype(parent); + if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) + return parent; + + /* firewire */ + id = udev_device_get_sysattr_value(parent, "ieee1394_id"); + if (id != NULL) { + parent = skip_subsystem(parent, "scsi"); + path_prepend(path, "ieee1394-0x%s", id); + goto out; + } + + /* lousy scsi sysfs does not have a "subsystem" for the transport */ + name = udev_device_get_syspath(parent); + + if (strstr(name, "/rport-") != NULL) { + parent = handle_scsi_fibre_channel(parent, path); + goto out; + } + + if (strstr(name, "/end_device-") != NULL) { + parent = handle_scsi_sas(parent, path); + goto out; + } + + if (strstr(name, "/session") != NULL) { + parent = handle_scsi_iscsi(parent, path); + goto out; + } + + parent = handle_scsi_default(parent, path); out: - return parent; + return parent; } static void handle_scsi_tape(struct udev_device *dev, char **path) { - const char *name; + const char *name; - /* must be the last device in the syspath */ - if (*path != NULL) - return; + /* must be the last device in the syspath */ + if (*path != NULL) + return; - name = udev_device_get_sysname(dev); - if (strncmp(name, "nst", 3) == 0 && strchr("lma", name[3]) != NULL) - path_prepend(path, "nst%c", name[3]); - else if (strncmp(name, "st", 2) == 0 && strchr("lma", name[2]) != NULL) - path_prepend(path, "st%c", name[2]); + name = udev_device_get_sysname(dev); + if (strncmp(name, "nst", 3) == 0 && strchr("lma", name[3]) != NULL) + path_prepend(path, "nst%c", name[3]); + else if (strncmp(name, "st", 2) == 0 && strchr("lma", name[2]) != NULL) + path_prepend(path, "st%c", name[2]); } static struct udev_device *handle_usb(struct udev_device *parent, char **path) { - const char *devtype; - const char *str; - const char *port; - - devtype = udev_device_get_devtype(parent); - if (devtype == NULL) - return parent; - if (strcmp(devtype, "usb_interface") != 0 && strcmp(devtype, "usb_device") != 0) - return parent; - - str = udev_device_get_sysname(parent); - port = strchr(str, '-'); - if (port == NULL) - return parent; - port++; - - parent = skip_subsystem(parent, "usb"); - path_prepend(path, "usb-0:%s", port); - return parent; + const char *devtype; + const char *str; + const char *port; + + devtype = udev_device_get_devtype(parent); + if (devtype == NULL) + return parent; + if (strcmp(devtype, "usb_interface") != 0 && strcmp(devtype, "usb_device") != 0) + return parent; + + str = udev_device_get_sysname(parent); + port = strchr(str, '-'); + if (port == NULL) + return parent; + port++; + + parent = skip_subsystem(parent, "usb"); + path_prepend(path, "usb-0:%s", port); + return parent; } static struct udev_device *handle_cciss(struct udev_device *parent, char **path) { - return NULL; + return NULL; } static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) { - struct udev_device *scsi_dev; - - scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); - if (scsi_dev != NULL) { - const char *wwpn; - const char *lun; - const char *hba_id; - - hba_id = udev_device_get_sysattr_value(scsi_dev, "hba_id"); - wwpn = udev_device_get_sysattr_value(scsi_dev, "wwpn"); - lun = udev_device_get_sysattr_value(scsi_dev, "fcp_lun"); - if (hba_id != NULL && lun != NULL && wwpn != NULL) { - path_prepend(path, "ccw-%s-zfcp-%s:%s", hba_id, wwpn, lun); - goto out; - } - } - - path_prepend(path, "ccw-%s", udev_device_get_sysname(parent)); + struct udev_device *scsi_dev; + + scsi_dev = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); + if (scsi_dev != NULL) { + const char *wwpn; + const char *lun; + const char *hba_id; + + hba_id = udev_device_get_sysattr_value(scsi_dev, "hba_id"); + wwpn = udev_device_get_sysattr_value(scsi_dev, "wwpn"); + lun = udev_device_get_sysattr_value(scsi_dev, "fcp_lun"); + if (hba_id != NULL && lun != NULL && wwpn != NULL) { + path_prepend(path, "ccw-%s-zfcp-%s:%s", hba_id, wwpn, lun); + goto out; + } + } + + path_prepend(path, "ccw-%s", udev_device_get_sysname(parent)); out: - parent = skip_subsystem(parent, "ccw"); - return parent; + parent = skip_subsystem(parent, "ccw"); + return parent; } static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool test) { - struct udev_device *parent; - char *path = NULL; - - /* S390 ccw bus */ - parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); - if (parent != NULL) { - handle_ccw(parent, dev, &path); - goto out; - } - - /* walk up the chain of devices and compose path */ - parent = dev; - while (parent != NULL) { - const char *subsys; - - subsys = udev_device_get_subsystem(parent); - if (subsys == NULL) { - ; - } else if (strcmp(subsys, "scsi_tape") == 0) { - handle_scsi_tape(parent, &path); - } else if (strcmp(subsys, "scsi") == 0) { - parent = handle_scsi(parent, &path); - } else if (strcmp(subsys, "cciss") == 0) { - handle_cciss(parent, &path); - } else if (strcmp(subsys, "usb") == 0) { - parent = handle_usb(parent, &path); - } else if (strcmp(subsys, "serio") == 0) { - path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); - parent = skip_subsystem(parent, "serio"); - } else if (strcmp(subsys, "pci") == 0) { - path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "pci"); - } else if (strcmp(subsys, "platform") == 0) { - path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "platform"); - } else if (strcmp(subsys, "acpi") == 0) { - path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "acpi"); - } else if (strcmp(subsys, "xen") == 0) { - path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "xen"); - } else if (strcmp(subsys, "virtio") == 0) { - path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); - parent = skip_subsystem(parent, "virtio"); - } - - parent = udev_device_get_parent(parent); - } + struct udev_device *parent; + char *path = NULL; + + /* S390 ccw bus */ + parent = udev_device_get_parent_with_subsystem_devtype(dev, "ccw", NULL); + if (parent != NULL) { + handle_ccw(parent, dev, &path); + goto out; + } + + /* walk up the chain of devices and compose path */ + parent = dev; + while (parent != NULL) { + const char *subsys; + + subsys = udev_device_get_subsystem(parent); + if (subsys == NULL) { + ; + } else if (strcmp(subsys, "scsi_tape") == 0) { + handle_scsi_tape(parent, &path); + } else if (strcmp(subsys, "scsi") == 0) { + parent = handle_scsi(parent, &path); + } else if (strcmp(subsys, "cciss") == 0) { + handle_cciss(parent, &path); + } else if (strcmp(subsys, "usb") == 0) { + parent = handle_usb(parent, &path); + } else if (strcmp(subsys, "serio") == 0) { + path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); + parent = skip_subsystem(parent, "serio"); + } else if (strcmp(subsys, "pci") == 0) { + path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "pci"); + } else if (strcmp(subsys, "platform") == 0) { + path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "platform"); + } else if (strcmp(subsys, "acpi") == 0) { + path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "acpi"); + } else if (strcmp(subsys, "xen") == 0) { + path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "xen"); + } else if (strcmp(subsys, "virtio") == 0) { + path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); + parent = skip_subsystem(parent, "virtio"); + } + + parent = udev_device_get_parent(parent); + } out: - if (path != NULL) { - char tag[UTIL_NAME_SIZE]; - size_t i; - const char *p; - - /* compose valid udev tag name */ - for (p = path, i = 0; *p; p++) { - if ((*p >= '0' && *p <= '9') || - (*p >= 'A' && *p <= 'Z') || - (*p >= 'a' && *p <= 'z') || - *p == '-') { - tag[i++] = *p; - continue; - } - - /* skip all leading '_' */ - if (i == 0) - continue; - - /* avoid second '_' */ - if (tag[i-1] == '_') - continue; - - tag[i++] = '_'; - } - /* strip trailing '_' */ - while (i > 0 && tag[i-1] == '_') - i--; - tag[i] = '\0'; - - udev_builtin_add_property(dev, test, "ID_PATH", path); - udev_builtin_add_property(dev, test, "ID_PATH_TAG", tag); - free(path); - return EXIT_SUCCESS; - } - return EXIT_FAILURE; + if (path != NULL) { + char tag[UTIL_NAME_SIZE]; + size_t i; + const char *p; + + /* compose valid udev tag name */ + for (p = path, i = 0; *p; p++) { + if ((*p >= '0' && *p <= '9') || + (*p >= 'A' && *p <= 'Z') || + (*p >= 'a' && *p <= 'z') || + *p == '-') { + tag[i++] = *p; + continue; + } + + /* skip all leading '_' */ + if (i == 0) + continue; + + /* avoid second '_' */ + if (tag[i-1] == '_') + continue; + + tag[i++] = '_'; + } + /* strip trailing '_' */ + while (i > 0 && tag[i-1] == '_') + i--; + tag[i] = '\0'; + + udev_builtin_add_property(dev, test, "ID_PATH", path); + udev_builtin_add_property(dev, test, "ID_PATH_TAG", tag); + free(path); + return EXIT_SUCCESS; + } + return EXIT_FAILURE; } const struct udev_builtin udev_builtin_path_id = { - .name = "path_id", - .cmd = builtin_path_id, - .help = "compose persistent device path", - .run_once = true, + .name = "path_id", + .cmd = builtin_path_id, + .help = "compose persistent device path", + .run_once = true, }; diff --git a/src/udev-builtin-usb_id.c b/src/udev-builtin-usb_id.c index 21c3c03d8a..85828e32d7 100644 --- a/src/udev-builtin-usb_id.c +++ b/src/udev-builtin-usb_id.c @@ -33,193 +33,193 @@ static void set_usb_iftype(char *to, int if_class_num, size_t len) { - char *type = "generic"; - - switch (if_class_num) { - case 1: - type = "audio"; - break; - case 2: /* CDC-Control */ - break; - case 3: - type = "hid"; - break; - case 5: /* Physical */ - break; - case 6: - type = "media"; - break; - case 7: - type = "printer"; - break; - case 8: - type = "storage"; - break; - case 9: - type = "hub"; - break; - case 0x0a: /* CDC-Data */ - break; - case 0x0b: /* Chip/Smart Card */ - break; - case 0x0d: /* Content Security */ - break; - case 0x0e: - type = "video"; - break; - case 0xdc: /* Diagnostic Device */ - break; - case 0xe0: /* Wireless Controller */ - break; - case 0xfe: /* Application-specific */ - break; - case 0xff: /* Vendor-specific */ - break; - default: - break; - } - strncpy(to, type, len); - to[len-1] = '\0'; + char *type = "generic"; + + switch (if_class_num) { + case 1: + type = "audio"; + break; + case 2: /* CDC-Control */ + break; + case 3: + type = "hid"; + break; + case 5: /* Physical */ + break; + case 6: + type = "media"; + break; + case 7: + type = "printer"; + break; + case 8: + type = "storage"; + break; + case 9: + type = "hub"; + break; + case 0x0a: /* CDC-Data */ + break; + case 0x0b: /* Chip/Smart Card */ + break; + case 0x0d: /* Content Security */ + break; + case 0x0e: + type = "video"; + break; + case 0xdc: /* Diagnostic Device */ + break; + case 0xe0: /* Wireless Controller */ + break; + case 0xfe: /* Application-specific */ + break; + case 0xff: /* Vendor-specific */ + break; + default: + break; + } + strncpy(to, type, len); + to[len-1] = '\0'; } static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len) { - int type_num = 0; - char *eptr; - char *type = "generic"; - - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 2: - type = "atapi"; - break; - case 3: - type = "tape"; - break; - case 4: /* UFI */ - case 5: /* SFF-8070i */ - type = "floppy"; - break; - case 1: /* RBC devices */ - type = "rbc"; - break; - case 6: /* Transparent SPC-2 devices */ - type = "scsi"; - break; - default: - break; - } - } - util_strscpy(to, len, type); - return type_num; + int type_num = 0; + char *eptr; + char *type = "generic"; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 2: + type = "atapi"; + break; + case 3: + type = "tape"; + break; + case 4: /* UFI */ + case 5: /* SFF-8070i */ + type = "floppy"; + break; + case 1: /* RBC devices */ + type = "rbc"; + break; + case 6: /* Transparent SPC-2 devices */ + type = "scsi"; + break; + default: + break; + } + } + util_strscpy(to, len, type); + return type_num; } static void set_scsi_type(char *to, const char *from, size_t len) { - int type_num; - char *eptr; - char *type = "generic"; - - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 0: - case 0xe: - type = "disk"; - break; - case 1: - type = "tape"; - break; - case 4: - case 7: - case 0xf: - type = "optical"; - break; - case 5: - type = "cd"; - break; - default: - break; - } - } - util_strscpy(to, len, type); + int type_num; + char *eptr; + char *type = "generic"; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 0: + case 0xe: + type = "disk"; + break; + case 1: + type = "tape"; + break; + case 4: + case 7: + case 0xf: + type = "optical"; + break; + case 5: + type = "cd"; + break; + default: + break; + } + } + util_strscpy(to, len, type); } -#define USB_DT_DEVICE 0x01 -#define USB_DT_INTERFACE 0x04 +#define USB_DT_DEVICE 0x01 +#define USB_DT_INTERFACE 0x04 static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len) { - char *filename = NULL; - int fd; - ssize_t size; - unsigned char buf[18 + 65535]; - unsigned int pos, strpos; - struct usb_interface_descriptor { - u_int8_t bLength; - u_int8_t bDescriptorType; - u_int8_t bInterfaceNumber; - u_int8_t bAlternateSetting; - u_int8_t bNumEndpoints; - u_int8_t bInterfaceClass; - u_int8_t bInterfaceSubClass; - u_int8_t bInterfaceProtocol; - u_int8_t iInterface; - } __attribute__((packed)); - int err = 0; - - if (asprintf(&filename, "%s/descriptors", udev_device_get_syspath(dev)) < 0) { - err = -1; - goto out; - } - fd = open(filename, O_RDONLY|O_CLOEXEC); - if (fd < 0) { - fprintf(stderr, "error opening USB device 'descriptors' file\n"); - err = -1; - goto out; - } - size = read(fd, buf, sizeof(buf)); - close(fd); - if (size < 18 || size == sizeof(buf)) { - err = -1; - goto out; - } - - pos = 0; - strpos = 0; - ifs_str[0] = '\0'; - while (pos < sizeof(buf) && strpos+7 < len-2) { - struct usb_interface_descriptor *desc; - char if_str[8]; - - desc = (struct usb_interface_descriptor *) &buf[pos]; - if (desc->bLength < 3) - break; - pos += desc->bLength; - - if (desc->bDescriptorType != USB_DT_INTERFACE) - continue; - - if (snprintf(if_str, 8, ":%02x%02x%02x", - desc->bInterfaceClass, - desc->bInterfaceSubClass, - desc->bInterfaceProtocol) != 7) - continue; - - if (strstr(ifs_str, if_str) != NULL) - continue; - - memcpy(&ifs_str[strpos], if_str, 8), - strpos += 7; - } - if (strpos > 0) { - ifs_str[strpos++] = ':'; - ifs_str[strpos++] = '\0'; - } + char *filename = NULL; + int fd; + ssize_t size; + unsigned char buf[18 + 65535]; + unsigned int pos, strpos; + struct usb_interface_descriptor { + u_int8_t bLength; + u_int8_t bDescriptorType; + u_int8_t bInterfaceNumber; + u_int8_t bAlternateSetting; + u_int8_t bNumEndpoints; + u_int8_t bInterfaceClass; + u_int8_t bInterfaceSubClass; + u_int8_t bInterfaceProtocol; + u_int8_t iInterface; + } __attribute__((packed)); + int err = 0; + + if (asprintf(&filename, "%s/descriptors", udev_device_get_syspath(dev)) < 0) { + err = -1; + goto out; + } + fd = open(filename, O_RDONLY|O_CLOEXEC); + if (fd < 0) { + fprintf(stderr, "error opening USB device 'descriptors' file\n"); + err = -1; + goto out; + } + size = read(fd, buf, sizeof(buf)); + close(fd); + if (size < 18 || size == sizeof(buf)) { + err = -1; + goto out; + } + + pos = 0; + strpos = 0; + ifs_str[0] = '\0'; + while (pos < sizeof(buf) && strpos+7 < len-2) { + struct usb_interface_descriptor *desc; + char if_str[8]; + + desc = (struct usb_interface_descriptor *) &buf[pos]; + if (desc->bLength < 3) + break; + pos += desc->bLength; + + if (desc->bDescriptorType != USB_DT_INTERFACE) + continue; + + if (snprintf(if_str, 8, ":%02x%02x%02x", + desc->bInterfaceClass, + desc->bInterfaceSubClass, + desc->bInterfaceProtocol) != 7) + continue; + + if (strstr(ifs_str, if_str) != NULL) + continue; + + memcpy(&ifs_str[strpos], if_str, 8), + strpos += 7; + } + if (strpos > 0) { + ifs_str[strpos++] = ':'; + ifs_str[strpos++] = '\0'; + } out: - free(filename); - return err; + free(filename); + return err; } /* @@ -241,242 +241,242 @@ out: */ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool test) { - char vendor_str[64]; - char vendor_str_enc[256]; - const char *vendor_id; - char model_str[64]; - char model_str_enc[256]; - const char *product_id; - char serial_str[UTIL_NAME_SIZE]; - char packed_if_str[UTIL_NAME_SIZE]; - char revision_str[64]; - char type_str[64]; - char instance_str[64]; - const char *ifnum = NULL; - const char *driver = NULL; - char serial[256]; - - struct udev *udev = udev_device_get_udev(dev); - struct udev_device *dev_interface = NULL; - struct udev_device *dev_usb = NULL; - const char *if_class, *if_subclass; - int if_class_num; - int protocol = 0; - size_t l; - char *s; - - vendor_str[0] = '\0'; - model_str[0] = '\0'; - serial_str[0] = '\0'; - packed_if_str[0] = '\0'; - revision_str[0] = '\0'; - type_str[0] = '\0'; - instance_str[0] = '\0'; - - dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); - - /* shortcut, if we are called directly for a "usb_device" type */ - if (udev_device_get_devtype(dev) != NULL && strcmp(udev_device_get_devtype(dev), "usb_device") == 0) { - dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str)); - dev_usb = dev; - goto fallback; - } - - /* usb interface directory */ - dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface"); - if (dev_interface == NULL) { - info(udev, "unable to access usb_interface device of '%s'\n", - udev_device_get_syspath(dev)); - return EXIT_FAILURE; - } - - ifnum = udev_device_get_sysattr_value(dev_interface, "bInterfaceNumber"); - driver = udev_device_get_sysattr_value(dev_interface, "driver"); - - if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass"); - if (!if_class) { - info(udev, "%s: cannot get bInterfaceClass attribute\n", - udev_device_get_sysname(dev)); - return EXIT_FAILURE; - } - - if_class_num = strtoul(if_class, NULL, 16); - if (if_class_num == 8) { - /* mass storage */ - if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass"); - if (if_subclass != NULL) - protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); - } else { - set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1); - } - - info(udev, "%s: if_class %d protocol %d\n", - udev_device_get_syspath(dev_interface), if_class_num, protocol); - - /* usb device directory */ - dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", "usb_device"); - if (!dev_usb) { - info(udev, "unable to find parent 'usb' device of '%s'\n", - udev_device_get_syspath(dev)); - return EXIT_FAILURE; - } - - /* all interfaces of the device in a single string */ - dev_if_packed_info(dev_usb, packed_if_str, sizeof(packed_if_str)); - - /* mass storage : SCSI or ATAPI */ - if ((protocol == 6 || protocol == 2)) { - struct udev_device *dev_scsi; - const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; - int host, bus, target, lun; - - /* get scsi device */ - dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); - if (dev_scsi == NULL) { - info(udev, "unable to find parent 'scsi' device of '%s'\n", - udev_device_get_syspath(dev)); - goto fallback; - } - if (sscanf(udev_device_get_sysname(dev_scsi), "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { - info(udev, "invalid scsi device '%s'\n", udev_device_get_sysname(dev_scsi)); - goto fallback; - } - - /* Generic SPC-2 device */ - scsi_vendor = udev_device_get_sysattr_value(dev_scsi, "vendor"); - if (!scsi_vendor) { - info(udev, "%s: cannot get SCSI vendor attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); - util_replace_chars(vendor_str, NULL); - - scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); - if (!scsi_model) { - info(udev, "%s: cannot get SCSI model attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc)); - util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); - util_replace_chars(model_str, NULL); - - scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); - if (!scsi_type) { - info(udev, "%s: cannot get SCSI type attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); - - scsi_rev = udev_device_get_sysattr_value(dev_scsi, "rev"); - if (!scsi_rev) { - info(udev, "%s: cannot get SCSI revision attribute\n", - udev_device_get_sysname(dev_scsi)); - goto fallback; - } - util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); - util_replace_chars(revision_str, NULL); - - /* - * some broken devices have the same identifiers - * for all luns, export the target:lun number - */ - sprintf(instance_str, "%d:%d", target, lun); - } + char vendor_str[64]; + char vendor_str_enc[256]; + const char *vendor_id; + char model_str[64]; + char model_str_enc[256]; + const char *product_id; + char serial_str[UTIL_NAME_SIZE]; + char packed_if_str[UTIL_NAME_SIZE]; + char revision_str[64]; + char type_str[64]; + char instance_str[64]; + const char *ifnum = NULL; + const char *driver = NULL; + char serial[256]; + + struct udev *udev = udev_device_get_udev(dev); + struct udev_device *dev_interface = NULL; + struct udev_device *dev_usb = NULL; + const char *if_class, *if_subclass; + int if_class_num; + int protocol = 0; + size_t l; + char *s; + + vendor_str[0] = '\0'; + model_str[0] = '\0'; + serial_str[0] = '\0'; + packed_if_str[0] = '\0'; + revision_str[0] = '\0'; + type_str[0] = '\0'; + instance_str[0] = '\0'; + + dbg(udev, "syspath %s\n", udev_device_get_syspath(dev)); + + /* shortcut, if we are called directly for a "usb_device" type */ + if (udev_device_get_devtype(dev) != NULL && strcmp(udev_device_get_devtype(dev), "usb_device") == 0) { + dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str)); + dev_usb = dev; + goto fallback; + } + + /* usb interface directory */ + dev_interface = udev_device_get_parent_with_subsystem_devtype(dev, "usb", "usb_interface"); + if (dev_interface == NULL) { + info(udev, "unable to access usb_interface device of '%s'\n", + udev_device_get_syspath(dev)); + return EXIT_FAILURE; + } + + ifnum = udev_device_get_sysattr_value(dev_interface, "bInterfaceNumber"); + driver = udev_device_get_sysattr_value(dev_interface, "driver"); + + if_class = udev_device_get_sysattr_value(dev_interface, "bInterfaceClass"); + if (!if_class) { + info(udev, "%s: cannot get bInterfaceClass attribute\n", + udev_device_get_sysname(dev)); + return EXIT_FAILURE; + } + + if_class_num = strtoul(if_class, NULL, 16); + if (if_class_num == 8) { + /* mass storage */ + if_subclass = udev_device_get_sysattr_value(dev_interface, "bInterfaceSubClass"); + if (if_subclass != NULL) + protocol = set_usb_mass_storage_ifsubtype(type_str, if_subclass, sizeof(type_str)-1); + } else { + set_usb_iftype(type_str, if_class_num, sizeof(type_str)-1); + } + + info(udev, "%s: if_class %d protocol %d\n", + udev_device_get_syspath(dev_interface), if_class_num, protocol); + + /* usb device directory */ + dev_usb = udev_device_get_parent_with_subsystem_devtype(dev_interface, "usb", "usb_device"); + if (!dev_usb) { + info(udev, "unable to find parent 'usb' device of '%s'\n", + udev_device_get_syspath(dev)); + return EXIT_FAILURE; + } + + /* all interfaces of the device in a single string */ + dev_if_packed_info(dev_usb, packed_if_str, sizeof(packed_if_str)); + + /* mass storage : SCSI or ATAPI */ + if ((protocol == 6 || protocol == 2)) { + struct udev_device *dev_scsi; + const char *scsi_model, *scsi_vendor, *scsi_type, *scsi_rev; + int host, bus, target, lun; + + /* get scsi device */ + dev_scsi = udev_device_get_parent_with_subsystem_devtype(dev, "scsi", "scsi_device"); + if (dev_scsi == NULL) { + info(udev, "unable to find parent 'scsi' device of '%s'\n", + udev_device_get_syspath(dev)); + goto fallback; + } + if (sscanf(udev_device_get_sysname(dev_scsi), "%d:%d:%d:%d", &host, &bus, &target, &lun) != 4) { + info(udev, "invalid scsi device '%s'\n", udev_device_get_sysname(dev_scsi)); + goto fallback; + } + + /* Generic SPC-2 device */ + scsi_vendor = udev_device_get_sysattr_value(dev_scsi, "vendor"); + if (!scsi_vendor) { + info(udev, "%s: cannot get SCSI vendor attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + udev_util_encode_string(scsi_vendor, vendor_str_enc, sizeof(vendor_str_enc)); + util_replace_whitespace(scsi_vendor, vendor_str, sizeof(vendor_str)-1); + util_replace_chars(vendor_str, NULL); + + scsi_model = udev_device_get_sysattr_value(dev_scsi, "model"); + if (!scsi_model) { + info(udev, "%s: cannot get SCSI model attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + udev_util_encode_string(scsi_model, model_str_enc, sizeof(model_str_enc)); + util_replace_whitespace(scsi_model, model_str, sizeof(model_str)-1); + util_replace_chars(model_str, NULL); + + scsi_type = udev_device_get_sysattr_value(dev_scsi, "type"); + if (!scsi_type) { + info(udev, "%s: cannot get SCSI type attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + set_scsi_type(type_str, scsi_type, sizeof(type_str)-1); + + scsi_rev = udev_device_get_sysattr_value(dev_scsi, "rev"); + if (!scsi_rev) { + info(udev, "%s: cannot get SCSI revision attribute\n", + udev_device_get_sysname(dev_scsi)); + goto fallback; + } + util_replace_whitespace(scsi_rev, revision_str, sizeof(revision_str)-1); + util_replace_chars(revision_str, NULL); + + /* + * some broken devices have the same identifiers + * for all luns, export the target:lun number + */ + sprintf(instance_str, "%d:%d", target, lun); + } fallback: - vendor_id = udev_device_get_sysattr_value(dev_usb, "idVendor"); - product_id = udev_device_get_sysattr_value(dev_usb, "idProduct"); - - /* fallback to USB vendor & device */ - if (vendor_str[0] == '\0') { - const char *usb_vendor = NULL; - - usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); - if (!usb_vendor) - usb_vendor = vendor_id; - if (!usb_vendor) { - info(udev, "No USB vendor information available\n"); - return EXIT_FAILURE; - } - udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); - util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); - util_replace_chars(vendor_str, NULL); - } - - if (model_str[0] == '\0') { - const char *usb_model = NULL; - - usb_model = udev_device_get_sysattr_value(dev_usb, "product"); - if (!usb_model) - usb_model = product_id; - if (!usb_model) { - dbg(udev, "No USB model information available\n"); - return EXIT_FAILURE; - } - udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); - util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); - util_replace_chars(model_str, NULL); - } - - if (revision_str[0] == '\0') { - const char *usb_rev; - - usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); - if (usb_rev) { - util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); - util_replace_chars(revision_str, NULL); - } - } - - if (serial_str[0] == '\0') { - const char *usb_serial; - - usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); - if (usb_serial) { - util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); - util_replace_chars(serial_str, NULL); - } - } - - s = serial; - l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); - if (serial_str[0] != '\0') - l = util_strpcpyl(&s, l, "_", serial_str, NULL); - - if (instance_str[0] != '\0') - util_strpcpyl(&s, l, "-", instance_str, NULL); - - udev_builtin_add_property(dev, test, "ID_VENDOR", vendor_str); - udev_builtin_add_property(dev, test, "ID_VENDOR_ENC", vendor_str_enc); - udev_builtin_add_property(dev, test, "ID_VENDOR_ID", vendor_id); - udev_builtin_add_property(dev, test, "ID_MODEL", model_str); - udev_builtin_add_property(dev, test, "ID_MODEL_ENC", model_str_enc); - udev_builtin_add_property(dev, test, "ID_MODEL_ID", product_id); - udev_builtin_add_property(dev, test, "ID_REVISION", revision_str); - udev_builtin_add_property(dev, test, "ID_SERIAL", serial); - if (serial_str[0] != '\0') - udev_builtin_add_property(dev, test, "ID_SERIAL_SHORT", serial_str); - if (type_str[0] != '\0') - udev_builtin_add_property(dev, test, "ID_TYPE", type_str); - if (instance_str[0] != '\0') - udev_builtin_add_property(dev, test, "ID_INSTANCE", instance_str); - udev_builtin_add_property(dev, test, "ID_BUS", "usb"); - if (packed_if_str[0] != '\0') - udev_builtin_add_property(dev, test, "ID_USB_INTERFACES", packed_if_str); - if (ifnum != NULL) - udev_builtin_add_property(dev, test, "ID_USB_INTERFACE_NUM", ifnum); - if (driver != NULL) - udev_builtin_add_property(dev, test, "ID_USB_DRIVER", driver); - return EXIT_SUCCESS; + vendor_id = udev_device_get_sysattr_value(dev_usb, "idVendor"); + product_id = udev_device_get_sysattr_value(dev_usb, "idProduct"); + + /* fallback to USB vendor & device */ + if (vendor_str[0] == '\0') { + const char *usb_vendor = NULL; + + usb_vendor = udev_device_get_sysattr_value(dev_usb, "manufacturer"); + if (!usb_vendor) + usb_vendor = vendor_id; + if (!usb_vendor) { + info(udev, "No USB vendor information available\n"); + return EXIT_FAILURE; + } + udev_util_encode_string(usb_vendor, vendor_str_enc, sizeof(vendor_str_enc)); + util_replace_whitespace(usb_vendor, vendor_str, sizeof(vendor_str)-1); + util_replace_chars(vendor_str, NULL); + } + + if (model_str[0] == '\0') { + const char *usb_model = NULL; + + usb_model = udev_device_get_sysattr_value(dev_usb, "product"); + if (!usb_model) + usb_model = product_id; + if (!usb_model) { + dbg(udev, "No USB model information available\n"); + return EXIT_FAILURE; + } + udev_util_encode_string(usb_model, model_str_enc, sizeof(model_str_enc)); + util_replace_whitespace(usb_model, model_str, sizeof(model_str)-1); + util_replace_chars(model_str, NULL); + } + + if (revision_str[0] == '\0') { + const char *usb_rev; + + usb_rev = udev_device_get_sysattr_value(dev_usb, "bcdDevice"); + if (usb_rev) { + util_replace_whitespace(usb_rev, revision_str, sizeof(revision_str)-1); + util_replace_chars(revision_str, NULL); + } + } + + if (serial_str[0] == '\0') { + const char *usb_serial; + + usb_serial = udev_device_get_sysattr_value(dev_usb, "serial"); + if (usb_serial) { + util_replace_whitespace(usb_serial, serial_str, sizeof(serial_str)-1); + util_replace_chars(serial_str, NULL); + } + } + + s = serial; + l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); + if (serial_str[0] != '\0') + l = util_strpcpyl(&s, l, "_", serial_str, NULL); + + if (instance_str[0] != '\0') + util_strpcpyl(&s, l, "-", instance_str, NULL); + + udev_builtin_add_property(dev, test, "ID_VENDOR", vendor_str); + udev_builtin_add_property(dev, test, "ID_VENDOR_ENC", vendor_str_enc); + udev_builtin_add_property(dev, test, "ID_VENDOR_ID", vendor_id); + udev_builtin_add_property(dev, test, "ID_MODEL", model_str); + udev_builtin_add_property(dev, test, "ID_MODEL_ENC", model_str_enc); + udev_builtin_add_property(dev, test, "ID_MODEL_ID", product_id); + udev_builtin_add_property(dev, test, "ID_REVISION", revision_str); + udev_builtin_add_property(dev, test, "ID_SERIAL", serial); + if (serial_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_SERIAL_SHORT", serial_str); + if (type_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_TYPE", type_str); + if (instance_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_INSTANCE", instance_str); + udev_builtin_add_property(dev, test, "ID_BUS", "usb"); + if (packed_if_str[0] != '\0') + udev_builtin_add_property(dev, test, "ID_USB_INTERFACES", packed_if_str); + if (ifnum != NULL) + udev_builtin_add_property(dev, test, "ID_USB_INTERFACE_NUM", ifnum); + if (driver != NULL) + udev_builtin_add_property(dev, test, "ID_USB_DRIVER", driver); + return EXIT_SUCCESS; } const struct udev_builtin udev_builtin_usb_id = { - .name = "usb_id", - .cmd = builtin_usb_id, - .help = "usb device properties", - .run_once = true, + .name = "usb_id", + .cmd = builtin_usb_id, + .help = "usb device properties", + .run_once = true, }; diff --git a/src/udev-builtin.c b/src/udev-builtin.c index 8beac8a678..5bc5fa68f6 100644 --- a/src/udev-builtin.c +++ b/src/udev-builtin.c @@ -26,109 +26,109 @@ #include "udev.h" static const struct udev_builtin *builtins[] = { - [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, - [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, - [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, - [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, - [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, - [UDEV_BUILTIN_PCI_DB] = &udev_builtin_pci_db, - [UDEV_BUILTIN_USB_DB] = &udev_builtin_usb_db, - [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, + [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, + [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, + [UDEV_BUILTIN_INPUT_ID] = &udev_builtin_input_id, + [UDEV_BUILTIN_KMOD] = &udev_builtin_kmod, + [UDEV_BUILTIN_PATH_ID] = &udev_builtin_path_id, + [UDEV_BUILTIN_PCI_DB] = &udev_builtin_pci_db, + [UDEV_BUILTIN_USB_DB] = &udev_builtin_usb_db, + [UDEV_BUILTIN_USB_ID] = &udev_builtin_usb_id, }; int udev_builtin_init(struct udev *udev) { - unsigned int i; - int err; - - for (i = 0; i < ARRAY_SIZE(builtins); i++) { - if (builtins[i]->init) { - err = builtins[i]->init(udev); - if (err < 0) - break; - } - } - return err; + unsigned int i; + int err; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) { + if (builtins[i]->init) { + err = builtins[i]->init(udev); + if (err < 0) + break; + } + } + return err; } void udev_builtin_exit(struct udev *udev) { - unsigned int i; + unsigned int i; - for (i = 0; i < ARRAY_SIZE(builtins); i++) - if (builtins[i]->exit) - builtins[i]->exit(udev); + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (builtins[i]->exit) + builtins[i]->exit(udev); } bool udev_builtin_validate(struct udev *udev) { - unsigned int i; - bool change = false; - - for (i = 0; i < ARRAY_SIZE(builtins); i++) - if (builtins[i]->validate) - if (builtins[i]->validate(udev)) - change = true; - return change; + unsigned int i; + bool change = false; + + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (builtins[i]->validate) + if (builtins[i]->validate(udev)) + change = true; + return change; } void udev_builtin_list(struct udev *udev) { - unsigned int i; + unsigned int i; - for (i = 0; i < ARRAY_SIZE(builtins); i++) - fprintf(stderr, " %-12s %s\n", builtins[i]->name, builtins[i]->help); + for (i = 0; i < ARRAY_SIZE(builtins); i++) + fprintf(stderr, " %-12s %s\n", builtins[i]->name, builtins[i]->help); } const char *udev_builtin_name(enum udev_builtin_cmd cmd) { - return builtins[cmd]->name; + return builtins[cmd]->name; } bool udev_builtin_run_once(enum udev_builtin_cmd cmd) { - return builtins[cmd]->run_once; + return builtins[cmd]->run_once; } enum udev_builtin_cmd udev_builtin_lookup(const char *command) { - char name[UTIL_PATH_SIZE]; - enum udev_builtin_cmd i; - char *pos; - - util_strscpy(name, sizeof(name), command); - pos = strchr(name, ' '); - if (pos) - pos[0] = '\0'; - for (i = 0; i < ARRAY_SIZE(builtins); i++) - if (strcmp(builtins[i]->name, name) == 0) - return i; - return UDEV_BUILTIN_MAX; + char name[UTIL_PATH_SIZE]; + enum udev_builtin_cmd i; + char *pos; + + util_strscpy(name, sizeof(name), command); + pos = strchr(name, ' '); + if (pos) + pos[0] = '\0'; + for (i = 0; i < ARRAY_SIZE(builtins); i++) + if (strcmp(builtins[i]->name, name) == 0) + return i; + return UDEV_BUILTIN_MAX; } int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const char *command, bool test) { - char arg[UTIL_PATH_SIZE]; - int argc; - char *argv[128]; - - optind = 0; - util_strscpy(arg, sizeof(arg), command); - udev_build_argv(udev_device_get_udev(dev), arg, &argc, argv); - return builtins[cmd]->cmd(dev, argc, argv, test); + char arg[UTIL_PATH_SIZE]; + int argc; + char *argv[128]; + + optind = 0; + util_strscpy(arg, sizeof(arg), command); + udev_build_argv(udev_device_get_udev(dev), arg, &argc, argv); + return builtins[cmd]->cmd(dev, argc, argv, test); } int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val) { - struct udev_list_entry *entry; + struct udev_list_entry *entry; - entry = udev_device_add_property(dev, key, val); - /* store in db, skip private keys */ - if (key[0] != '.') - udev_list_entry_set_num(entry, true); + entry = udev_device_add_property(dev, key, val); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_num(entry, true); - info(udev_device_get_udev(dev), "%s=%s\n", key, val); - if (test) - printf("%s=%s\n", key, val); - return 0; + info(udev_device_get_udev(dev), "%s=%s\n", key, val); + if (test) + printf("%s=%s\n", key, val); + return 0; } diff --git a/src/udev-ctrl.c b/src/udev-ctrl.c index fab1108de0..5556f1a77c 100644 --- a/src/udev-ctrl.c +++ b/src/udev-ctrl.c @@ -23,472 +23,472 @@ #include "udev.h" /* wire protocol magic must match */ -#define UDEV_CTRL_MAGIC 0xdead1dea +#define UDEV_CTRL_MAGIC 0xdead1dea enum udev_ctrl_msg_type { - UDEV_CTRL_UNKNOWN, - UDEV_CTRL_SET_LOG_LEVEL, - UDEV_CTRL_STOP_EXEC_QUEUE, - UDEV_CTRL_START_EXEC_QUEUE, - UDEV_CTRL_RELOAD, - UDEV_CTRL_SET_ENV, - UDEV_CTRL_SET_CHILDREN_MAX, - UDEV_CTRL_PING, - UDEV_CTRL_EXIT, + UDEV_CTRL_UNKNOWN, + UDEV_CTRL_SET_LOG_LEVEL, + UDEV_CTRL_STOP_EXEC_QUEUE, + UDEV_CTRL_START_EXEC_QUEUE, + UDEV_CTRL_RELOAD, + UDEV_CTRL_SET_ENV, + UDEV_CTRL_SET_CHILDREN_MAX, + UDEV_CTRL_PING, + UDEV_CTRL_EXIT, }; struct udev_ctrl_msg_wire { - char version[16]; - unsigned int magic; - enum udev_ctrl_msg_type type; - union { - int intval; - char buf[256]; - }; + char version[16]; + unsigned int magic; + enum udev_ctrl_msg_type type; + union { + int intval; + char buf[256]; + }; }; struct udev_ctrl_msg { - int refcount; - struct udev_ctrl_connection *conn; - struct udev_ctrl_msg_wire ctrl_msg_wire; + int refcount; + struct udev_ctrl_connection *conn; + struct udev_ctrl_msg_wire ctrl_msg_wire; }; struct udev_ctrl { - int refcount; - struct udev *udev; - int sock; - struct sockaddr_un saddr; - socklen_t addrlen; - bool bound; - bool cleanup_socket; - bool connected; + int refcount; + struct udev *udev; + int sock; + struct sockaddr_un saddr; + socklen_t addrlen; + bool bound; + bool cleanup_socket; + bool connected; }; struct udev_ctrl_connection { - int refcount; - struct udev_ctrl *uctrl; - int sock; + int refcount; + struct udev_ctrl *uctrl; + int sock; }; struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) { - struct udev_ctrl *uctrl; - - uctrl = calloc(1, sizeof(struct udev_ctrl)); - if (uctrl == NULL) - return NULL; - uctrl->refcount = 1; - uctrl->udev = udev; - - if (fd < 0) { - uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); - if (uctrl->sock < 0) { - err(udev, "error getting socket: %m\n"); - udev_ctrl_unref(uctrl); - return NULL; - } - } else { - uctrl->bound = true; - uctrl->sock = fd; - } - - uctrl->saddr.sun_family = AF_LOCAL; - util_strscpyl(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), + struct udev_ctrl *uctrl; + + uctrl = calloc(1, sizeof(struct udev_ctrl)); + if (uctrl == NULL) + return NULL; + uctrl->refcount = 1; + uctrl->udev = udev; + + if (fd < 0) { + uctrl->sock = socket(AF_LOCAL, SOCK_SEQPACKET|SOCK_NONBLOCK|SOCK_CLOEXEC, 0); + if (uctrl->sock < 0) { + err(udev, "error getting socket: %m\n"); + udev_ctrl_unref(uctrl); + return NULL; + } + } else { + uctrl->bound = true; + uctrl->sock = fd; + } + + uctrl->saddr.sun_family = AF_LOCAL; + util_strscpyl(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), udev_get_run_path(udev), "/control", NULL); - uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); - return uctrl; + uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); + return uctrl; } struct udev_ctrl *udev_ctrl_new(struct udev *udev) { - return udev_ctrl_new_from_fd(udev, -1); + return udev_ctrl_new_from_fd(udev, -1); } int udev_ctrl_enable_receiving(struct udev_ctrl *uctrl) { - int err; - - if (!uctrl->bound) { - err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - if (err < 0 && errno == EADDRINUSE) { - unlink(uctrl->saddr.sun_path); - err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); - } - - if (err < 0) { - err = -errno; - err(uctrl->udev, "bind failed: %m\n"); - return err; - } - - err = listen(uctrl->sock, 0); - if (err < 0) { - err = -errno; - err(uctrl->udev, "listen failed: %m\n"); - return err; - } - - uctrl->bound = true; - uctrl->cleanup_socket = true; - } - return 0; + int err; + + if (!uctrl->bound) { + err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + if (err < 0 && errno == EADDRINUSE) { + unlink(uctrl->saddr.sun_path); + err = bind(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen); + } + + if (err < 0) { + err = -errno; + err(uctrl->udev, "bind failed: %m\n"); + return err; + } + + err = listen(uctrl->sock, 0); + if (err < 0) { + err = -errno; + err(uctrl->udev, "listen failed: %m\n"); + return err; + } + + uctrl->bound = true; + uctrl->cleanup_socket = true; + } + return 0; } struct udev *udev_ctrl_get_udev(struct udev_ctrl *uctrl) { - return uctrl->udev; + return uctrl->udev; } struct udev_ctrl *udev_ctrl_ref(struct udev_ctrl *uctrl) { - if (uctrl == NULL) - return NULL; - uctrl->refcount++; - return uctrl; + if (uctrl == NULL) + return NULL; + uctrl->refcount++; + return uctrl; } struct udev_ctrl *udev_ctrl_unref(struct udev_ctrl *uctrl) { - if (uctrl == NULL) - return NULL; - uctrl->refcount--; - if (uctrl->refcount > 0) - return uctrl; - if (uctrl->sock >= 0) - close(uctrl->sock); - free(uctrl); - return NULL; + if (uctrl == NULL) + return NULL; + uctrl->refcount--; + if (uctrl->refcount > 0) + return uctrl; + if (uctrl->sock >= 0) + close(uctrl->sock); + free(uctrl); + return NULL; } int udev_ctrl_cleanup(struct udev_ctrl *uctrl) { - if (uctrl == NULL) - return 0; - if (uctrl->cleanup_socket) - unlink(uctrl->saddr.sun_path); - return 0; + if (uctrl == NULL) + return 0; + if (uctrl->cleanup_socket) + unlink(uctrl->saddr.sun_path); + return 0; } int udev_ctrl_get_fd(struct udev_ctrl *uctrl) { - if (uctrl == NULL) - return -EINVAL; - return uctrl->sock; + if (uctrl == NULL) + return -EINVAL; + return uctrl->sock; } struct udev_ctrl_connection *udev_ctrl_get_connection(struct udev_ctrl *uctrl) { - struct udev_ctrl_connection *conn; - struct ucred ucred; - socklen_t slen; - const int on = 1; - - conn = calloc(1, sizeof(struct udev_ctrl_connection)); - if (conn == NULL) - return NULL; - conn->refcount = 1; - conn->uctrl = uctrl; - - conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); - if (conn->sock < 0) { - if (errno != EINTR) - err(uctrl->udev, "unable to receive ctrl connection: %m\n"); - goto err; - } - - /* check peer credential of connection */ - slen = sizeof(ucred); - if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) { - err(uctrl->udev, "unable to receive credentials of ctrl connection: %m\n"); - goto err; - } - if (ucred.uid > 0) { - err(uctrl->udev, "sender uid=%i, message ignored\n", ucred.uid); - goto err; - } - - /* enable receiving of the sender credentials in the messages */ - setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); - udev_ctrl_ref(uctrl); - return conn; + struct udev_ctrl_connection *conn; + struct ucred ucred; + socklen_t slen; + const int on = 1; + + conn = calloc(1, sizeof(struct udev_ctrl_connection)); + if (conn == NULL) + return NULL; + conn->refcount = 1; + conn->uctrl = uctrl; + + conn->sock = accept4(uctrl->sock, NULL, NULL, SOCK_CLOEXEC|SOCK_NONBLOCK); + if (conn->sock < 0) { + if (errno != EINTR) + err(uctrl->udev, "unable to receive ctrl connection: %m\n"); + goto err; + } + + /* check peer credential of connection */ + slen = sizeof(ucred); + if (getsockopt(conn->sock, SOL_SOCKET, SO_PEERCRED, &ucred, &slen) < 0) { + err(uctrl->udev, "unable to receive credentials of ctrl connection: %m\n"); + goto err; + } + if (ucred.uid > 0) { + err(uctrl->udev, "sender uid=%i, message ignored\n", ucred.uid); + goto err; + } + + /* enable receiving of the sender credentials in the messages */ + setsockopt(conn->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); + udev_ctrl_ref(uctrl); + return conn; err: - if (conn->sock >= 0) - close(conn->sock); - free(conn); - return NULL; + if (conn->sock >= 0) + close(conn->sock); + free(conn); + return NULL; } struct udev_ctrl_connection *udev_ctrl_connection_ref(struct udev_ctrl_connection *conn) { - if (conn == NULL) - return NULL; - conn->refcount++; - return conn; + if (conn == NULL) + return NULL; + conn->refcount++; + return conn; } struct udev_ctrl_connection *udev_ctrl_connection_unref(struct udev_ctrl_connection *conn) { - if (conn == NULL) - return NULL; - conn->refcount--; - if (conn->refcount > 0) - return conn; - if (conn->sock >= 0) - close(conn->sock); - udev_ctrl_unref(conn->uctrl); - free(conn); - return NULL; + if (conn == NULL) + return NULL; + conn->refcount--; + if (conn->refcount > 0) + return conn; + if (conn->sock >= 0) + close(conn->sock); + udev_ctrl_unref(conn->uctrl); + free(conn); + return NULL; } static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int intval, const char *buf, int timeout) { - struct udev_ctrl_msg_wire ctrl_msg_wire; - int err = 0; - - memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); - strcpy(ctrl_msg_wire.version, "udev-" VERSION); - ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; - ctrl_msg_wire.type = type; - - if (buf != NULL) - util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); - else - ctrl_msg_wire.intval = intval; - - if (!uctrl->connected) { - if (connect(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen) < 0) { - err = -errno; - goto out; - } - uctrl->connected = true; - } - if (send(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0) < 0) { - err = -errno; - goto out; - } - - /* wait for peer message handling or disconnect */ - for (;;) { - struct pollfd pfd[1]; - int r; - - pfd[0].fd = uctrl->sock; - pfd[0].events = POLLIN; - r = poll(pfd, 1, timeout * 1000); - if (r < 0) { - if (errno == EINTR) - continue; - err = -errno; - break; - } - - if (r > 0 && pfd[0].revents & POLLERR) { - err = -EIO; - break; - } - - if (r == 0) - err = -ETIMEDOUT; - break; - } + struct udev_ctrl_msg_wire ctrl_msg_wire; + int err = 0; + + memset(&ctrl_msg_wire, 0x00, sizeof(struct udev_ctrl_msg_wire)); + strcpy(ctrl_msg_wire.version, "udev-" VERSION); + ctrl_msg_wire.magic = UDEV_CTRL_MAGIC; + ctrl_msg_wire.type = type; + + if (buf != NULL) + util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); + else + ctrl_msg_wire.intval = intval; + + if (!uctrl->connected) { + if (connect(uctrl->sock, (struct sockaddr *)&uctrl->saddr, uctrl->addrlen) < 0) { + err = -errno; + goto out; + } + uctrl->connected = true; + } + if (send(uctrl->sock, &ctrl_msg_wire, sizeof(ctrl_msg_wire), 0) < 0) { + err = -errno; + goto out; + } + + /* wait for peer message handling or disconnect */ + for (;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = uctrl->sock; + pfd[0].events = POLLIN; + r = poll(pfd, 1, timeout * 1000); + if (r < 0) { + if (errno == EINTR) + continue; + err = -errno; + break; + } + + if (r > 0 && pfd[0].revents & POLLERR) { + err = -EIO; + break; + } + + if (r == 0) + err = -ETIMEDOUT; + break; + } out: - return err; + return err; } int udev_ctrl_send_set_log_level(struct udev_ctrl *uctrl, int priority, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); + return ctrl_send(uctrl, UDEV_CTRL_SET_LOG_LEVEL, priority, NULL, timeout); } int udev_ctrl_send_stop_exec_queue(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); + return ctrl_send(uctrl, UDEV_CTRL_STOP_EXEC_QUEUE, 0, NULL, timeout); } int udev_ctrl_send_start_exec_queue(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); + return ctrl_send(uctrl, UDEV_CTRL_START_EXEC_QUEUE, 0, NULL, timeout); } int udev_ctrl_send_reload(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_RELOAD, 0, NULL, timeout); + return ctrl_send(uctrl, UDEV_CTRL_RELOAD, 0, NULL, timeout); } int udev_ctrl_send_set_env(struct udev_ctrl *uctrl, const char *key, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); + return ctrl_send(uctrl, UDEV_CTRL_SET_ENV, 0, key, timeout); } int udev_ctrl_send_set_children_max(struct udev_ctrl *uctrl, int count, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); + return ctrl_send(uctrl, UDEV_CTRL_SET_CHILDREN_MAX, count, NULL, timeout); } int udev_ctrl_send_ping(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); + return ctrl_send(uctrl, UDEV_CTRL_PING, 0, NULL, timeout); } int udev_ctrl_send_exit(struct udev_ctrl *uctrl, int timeout) { - return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); + return ctrl_send(uctrl, UDEV_CTRL_EXIT, 0, NULL, timeout); } struct udev_ctrl_msg *udev_ctrl_receive_msg(struct udev_ctrl_connection *conn) { - struct udev *udev = conn->uctrl->udev; - struct udev_ctrl_msg *uctrl_msg; - ssize_t size; - struct msghdr smsg; - struct cmsghdr *cmsg; - struct iovec iov; - struct ucred *cred; - char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; - - uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); - if (uctrl_msg == NULL) - return NULL; - uctrl_msg->refcount = 1; - uctrl_msg->conn = conn; - udev_ctrl_connection_ref(conn); - - /* wait for the incoming message */ - for(;;) { - struct pollfd pfd[1]; - int r; - - pfd[0].fd = conn->sock; - pfd[0].events = POLLIN; - - r = poll(pfd, 1, 10000); - if (r < 0) { - if (errno == EINTR) - continue; - goto err; - } else if (r == 0) { - err(udev, "timeout waiting for ctrl message\n"); - goto err; - } else { - if (!(pfd[0].revents & POLLIN)) { - err(udev, "ctrl connection error: %m\n"); - goto err; - } - } - - break; - } - - iov.iov_base = &uctrl_msg->ctrl_msg_wire; - iov.iov_len = sizeof(struct udev_ctrl_msg_wire); - memset(&smsg, 0x00, sizeof(struct msghdr)); - smsg.msg_iov = &iov; - smsg.msg_iovlen = 1; - smsg.msg_control = cred_msg; - smsg.msg_controllen = sizeof(cred_msg); - size = recvmsg(conn->sock, &smsg, 0); - if (size < 0) { - err(udev, "unable to receive ctrl message: %m\n"); - goto err; - } - cmsg = CMSG_FIRSTHDR(&smsg); - cred = (struct ucred *) CMSG_DATA(cmsg); - - if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { - err(udev, "no sender credentials received, message ignored\n"); - goto err; - } - - if (cred->uid != 0) { - err(udev, "sender uid=%i, message ignored\n", cred->uid); - goto err; - } - - if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { - err(udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); - goto err; - } - - dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); - return uctrl_msg; + struct udev *udev = conn->uctrl->udev; + struct udev_ctrl_msg *uctrl_msg; + ssize_t size; + struct msghdr smsg; + struct cmsghdr *cmsg; + struct iovec iov; + struct ucred *cred; + char cred_msg[CMSG_SPACE(sizeof(struct ucred))]; + + uctrl_msg = calloc(1, sizeof(struct udev_ctrl_msg)); + if (uctrl_msg == NULL) + return NULL; + uctrl_msg->refcount = 1; + uctrl_msg->conn = conn; + udev_ctrl_connection_ref(conn); + + /* wait for the incoming message */ + for(;;) { + struct pollfd pfd[1]; + int r; + + pfd[0].fd = conn->sock; + pfd[0].events = POLLIN; + + r = poll(pfd, 1, 10000); + if (r < 0) { + if (errno == EINTR) + continue; + goto err; + } else if (r == 0) { + err(udev, "timeout waiting for ctrl message\n"); + goto err; + } else { + if (!(pfd[0].revents & POLLIN)) { + err(udev, "ctrl connection error: %m\n"); + goto err; + } + } + + break; + } + + iov.iov_base = &uctrl_msg->ctrl_msg_wire; + iov.iov_len = sizeof(struct udev_ctrl_msg_wire); + memset(&smsg, 0x00, sizeof(struct msghdr)); + smsg.msg_iov = &iov; + smsg.msg_iovlen = 1; + smsg.msg_control = cred_msg; + smsg.msg_controllen = sizeof(cred_msg); + size = recvmsg(conn->sock, &smsg, 0); + if (size < 0) { + err(udev, "unable to receive ctrl message: %m\n"); + goto err; + } + cmsg = CMSG_FIRSTHDR(&smsg); + cred = (struct ucred *) CMSG_DATA(cmsg); + + if (cmsg == NULL || cmsg->cmsg_type != SCM_CREDENTIALS) { + err(udev, "no sender credentials received, message ignored\n"); + goto err; + } + + if (cred->uid != 0) { + err(udev, "sender uid=%i, message ignored\n", cred->uid); + goto err; + } + + if (uctrl_msg->ctrl_msg_wire.magic != UDEV_CTRL_MAGIC) { + err(udev, "message magic 0x%08x doesn't match, ignore it\n", uctrl_msg->ctrl_msg_wire.magic); + goto err; + } + + dbg(udev, "created ctrl_msg %p (%i)\n", uctrl_msg, uctrl_msg->ctrl_msg_wire.type); + return uctrl_msg; err: - udev_ctrl_msg_unref(uctrl_msg); - return NULL; + udev_ctrl_msg_unref(uctrl_msg); + return NULL; } struct udev_ctrl_msg *udev_ctrl_msg_ref(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg == NULL) - return NULL; - ctrl_msg->refcount++; - return ctrl_msg; + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount++; + return ctrl_msg; } struct udev_ctrl_msg *udev_ctrl_msg_unref(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg == NULL) - return NULL; - ctrl_msg->refcount--; - if (ctrl_msg->refcount > 0) - return ctrl_msg; - dbg(ctrl_msg->conn->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); - udev_ctrl_connection_unref(ctrl_msg->conn); - free(ctrl_msg); - return NULL; + if (ctrl_msg == NULL) + return NULL; + ctrl_msg->refcount--; + if (ctrl_msg->refcount > 0) + return ctrl_msg; + dbg(ctrl_msg->conn->uctrl->udev, "release ctrl_msg %p\n", ctrl_msg); + udev_ctrl_connection_unref(ctrl_msg->conn); + free(ctrl_msg); + return NULL; } int udev_ctrl_get_set_log_level(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_LOG_LEVEL) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; } int udev_ctrl_get_stop_exec_queue(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) - return 1; - return -1; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_STOP_EXEC_QUEUE) + return 1; + return -1; } int udev_ctrl_get_start_exec_queue(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) - return 1; - return -1; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_START_EXEC_QUEUE) + return 1; + return -1; } int udev_ctrl_get_reload(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD) - return 1; - return -1; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_RELOAD) + return 1; + return -1; } const char *udev_ctrl_get_set_env(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) - return ctrl_msg->ctrl_msg_wire.buf; - return NULL; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_ENV) + return ctrl_msg->ctrl_msg_wire.buf; + return NULL; } int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) - return ctrl_msg->ctrl_msg_wire.intval; - return -1; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_SET_CHILDREN_MAX) + return ctrl_msg->ctrl_msg_wire.intval; + return -1; } int udev_ctrl_get_ping(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) - return 1; - return -1; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_PING) + return 1; + return -1; } int udev_ctrl_get_exit(struct udev_ctrl_msg *ctrl_msg) { - if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) - return 1; - return -1; + if (ctrl_msg->ctrl_msg_wire.type == UDEV_CTRL_EXIT) + return 1; + return -1; } diff --git a/src/udev-event.c b/src/udev-event.c index 859d811bff..9bdc5186df 100644 --- a/src/udev-event.c +++ b/src/udev-event.c @@ -38,968 +38,968 @@ struct udev_event *udev_event_new(struct udev_device *dev) { - struct udev *udev = udev_device_get_udev(dev); - struct udev_event *event; - - event = calloc(1, sizeof(struct udev_event)); - if (event == NULL) - return NULL; - event->dev = dev; - event->udev = udev; - udev_list_init(udev, &event->run_list, false); - event->fd_signal = -1; - event->birth_usec = now_usec(); - event->timeout_usec = 60 * 1000 * 1000; - dbg(event->udev, "allocated event %p\n", event); - return event; + struct udev *udev = udev_device_get_udev(dev); + struct udev_event *event; + + event = calloc(1, sizeof(struct udev_event)); + if (event == NULL) + return NULL; + event->dev = dev; + event->udev = udev; + udev_list_init(udev, &event->run_list, false); + event->fd_signal = -1; + event->birth_usec = now_usec(); + event->timeout_usec = 60 * 1000 * 1000; + dbg(event->udev, "allocated event %p\n", event); + return event; } void udev_event_unref(struct udev_event *event) { - if (event == NULL) - return; - udev_list_cleanup(&event->run_list); - free(event->program_result); - free(event->name); - dbg(event->udev, "free event %p\n", event); - free(event); + if (event == NULL) + return; + udev_list_cleanup(&event->run_list); + free(event->program_result); + free(event->name); + dbg(event->udev, "free event %p\n", event); + free(event); } size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size) { - struct udev_device *dev = event->dev; - enum subst_type { - SUBST_UNKNOWN, - SUBST_DEVNODE, - SUBST_ATTR, - SUBST_ENV, - SUBST_KERNEL, - SUBST_KERNEL_NUMBER, - SUBST_DRIVER, - SUBST_DEVPATH, - SUBST_ID, - SUBST_MAJOR, - SUBST_MINOR, - SUBST_RESULT, - SUBST_PARENT, - SUBST_NAME, - SUBST_LINKS, - SUBST_ROOT, - SUBST_SYS, - }; - static const struct subst_map { - char *name; - char fmt; - enum subst_type type; - } map[] = { - { .name = "devnode", .fmt = 'N', .type = SUBST_DEVNODE }, - { .name = "tempnode", .fmt = 'N', .type = SUBST_DEVNODE }, - { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, - { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, - { .name = "env", .fmt = 'E', .type = SUBST_ENV }, - { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, - { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, - { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, - { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, - { .name = "id", .fmt = 'b', .type = SUBST_ID }, - { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, - { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, - { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, - { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, - { .name = "name", .fmt = 'D', .type = SUBST_NAME }, - { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, - { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, - { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, - }; - const char *from; - char *s; - size_t l; - - from = src; - s = dest; - l = size; - - for (;;) { - enum subst_type type = SUBST_UNKNOWN; - char attrbuf[UTIL_PATH_SIZE]; - char *attr = NULL; - - while (from[0] != '\0') { - if (from[0] == '$') { - /* substitute named variable */ - unsigned int i; - - if (from[1] == '$') { - from++; - goto copy; - } - - for (i = 0; i < ARRAY_SIZE(map); i++) { - if (strncmp(&from[1], map[i].name, strlen(map[i].name)) == 0) { - type = map[i].type; - from += strlen(map[i].name)+1; - dbg(event->udev, "will substitute format name '%s'\n", map[i].name); - goto subst; - } - } - } else if (from[0] == '%') { - /* substitute format char */ - unsigned int i; - - if (from[1] == '%') { - from++; - goto copy; - } - - for (i = 0; i < ARRAY_SIZE(map); i++) { - if (from[1] == map[i].fmt) { - type = map[i].type; - from += 2; - dbg(event->udev, "will substitute format char '%c'\n", map[i].fmt); - goto subst; - } - } - } + struct udev_device *dev = event->dev; + enum subst_type { + SUBST_UNKNOWN, + SUBST_DEVNODE, + SUBST_ATTR, + SUBST_ENV, + SUBST_KERNEL, + SUBST_KERNEL_NUMBER, + SUBST_DRIVER, + SUBST_DEVPATH, + SUBST_ID, + SUBST_MAJOR, + SUBST_MINOR, + SUBST_RESULT, + SUBST_PARENT, + SUBST_NAME, + SUBST_LINKS, + SUBST_ROOT, + SUBST_SYS, + }; + static const struct subst_map { + char *name; + char fmt; + enum subst_type type; + } map[] = { + { .name = "devnode", .fmt = 'N', .type = SUBST_DEVNODE }, + { .name = "tempnode", .fmt = 'N', .type = SUBST_DEVNODE }, + { .name = "attr", .fmt = 's', .type = SUBST_ATTR }, + { .name = "sysfs", .fmt = 's', .type = SUBST_ATTR }, + { .name = "env", .fmt = 'E', .type = SUBST_ENV }, + { .name = "kernel", .fmt = 'k', .type = SUBST_KERNEL }, + { .name = "number", .fmt = 'n', .type = SUBST_KERNEL_NUMBER }, + { .name = "driver", .fmt = 'd', .type = SUBST_DRIVER }, + { .name = "devpath", .fmt = 'p', .type = SUBST_DEVPATH }, + { .name = "id", .fmt = 'b', .type = SUBST_ID }, + { .name = "major", .fmt = 'M', .type = SUBST_MAJOR }, + { .name = "minor", .fmt = 'm', .type = SUBST_MINOR }, + { .name = "result", .fmt = 'c', .type = SUBST_RESULT }, + { .name = "parent", .fmt = 'P', .type = SUBST_PARENT }, + { .name = "name", .fmt = 'D', .type = SUBST_NAME }, + { .name = "links", .fmt = 'L', .type = SUBST_LINKS }, + { .name = "root", .fmt = 'r', .type = SUBST_ROOT }, + { .name = "sys", .fmt = 'S', .type = SUBST_SYS }, + }; + const char *from; + char *s; + size_t l; + + from = src; + s = dest; + l = size; + + for (;;) { + enum subst_type type = SUBST_UNKNOWN; + char attrbuf[UTIL_PATH_SIZE]; + char *attr = NULL; + + while (from[0] != '\0') { + if (from[0] == '$') { + /* substitute named variable */ + unsigned int i; + + if (from[1] == '$') { + from++; + goto copy; + } + + for (i = 0; i < ARRAY_SIZE(map); i++) { + if (strncmp(&from[1], map[i].name, strlen(map[i].name)) == 0) { + type = map[i].type; + from += strlen(map[i].name)+1; + dbg(event->udev, "will substitute format name '%s'\n", map[i].name); + goto subst; + } + } + } else if (from[0] == '%') { + /* substitute format char */ + unsigned int i; + + if (from[1] == '%') { + from++; + goto copy; + } + + for (i = 0; i < ARRAY_SIZE(map); i++) { + if (from[1] == map[i].fmt) { + type = map[i].type; + from += 2; + dbg(event->udev, "will substitute format char '%c'\n", map[i].fmt); + goto subst; + } + } + } copy: - /* copy char */ - if (l == 0) - goto out; - s[0] = from[0]; - from++; - s++; - l--; - } - - goto out; + /* copy char */ + if (l == 0) + goto out; + s[0] = from[0]; + from++; + s++; + l--; + } + + goto out; subst: - /* extract possible $format{attr} */ - if (from[0] == '{') { - unsigned int i; - - from++; - for (i = 0; from[i] != '}'; i++) { - if (from[i] == '\0') { - err(event->udev, "missing closing brace for format '%s'\n", src); - goto out; - } - } - if (i >= sizeof(attrbuf)) - goto out; - memcpy(attrbuf, from, i); - attrbuf[i] = '\0'; - from += i+1; - attr = attrbuf; - } else { - attr = NULL; - } - - switch (type) { - case SUBST_DEVPATH: - l = util_strpcpy(&s, l, udev_device_get_devpath(dev)); - dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); - break; - case SUBST_KERNEL: - l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); - dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); - break; - case SUBST_KERNEL_NUMBER: - if (udev_device_get_sysnum(dev) == NULL) - break; - l = util_strpcpy(&s, l, udev_device_get_sysnum(dev)); - dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); - break; - case SUBST_ID: - if (event->dev_parent == NULL) - break; - l = util_strpcpy(&s, l, udev_device_get_sysname(event->dev_parent)); - dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); - break; - case SUBST_DRIVER: { - const char *driver; - - if (event->dev_parent == NULL) - break; - - driver = udev_device_get_driver(event->dev_parent); - if (driver == NULL) - break; - l = util_strpcpy(&s, l, driver); - dbg(event->udev, "substitute driver '%s'\n", driver); - break; - } - case SUBST_MAJOR: { - char num[UTIL_PATH_SIZE]; - - sprintf(num, "%d", major(udev_device_get_devnum(dev))); - l = util_strpcpy(&s, l, num); - dbg(event->udev, "substitute major number '%s'\n", num); - break; - } - case SUBST_MINOR: { - char num[UTIL_PATH_SIZE]; - - sprintf(num, "%d", minor(udev_device_get_devnum(dev))); - l = util_strpcpy(&s, l, num); - dbg(event->udev, "substitute minor number '%s'\n", num); - break; - } - case SUBST_RESULT: { - char *rest; - int i; - - if (event->program_result == NULL) - break; - /* get part part of the result string */ - i = 0; - if (attr != NULL) - i = strtoul(attr, &rest, 10); - if (i > 0) { - char result[UTIL_PATH_SIZE]; - char tmp[UTIL_PATH_SIZE]; - char *cpos; - - dbg(event->udev, "request part #%d of result string\n", i); - util_strscpy(result, sizeof(result), event->program_result); - cpos = result; - while (--i) { - while (cpos[0] != '\0' && !isspace(cpos[0])) - cpos++; - while (isspace(cpos[0])) - cpos++; - } - if (i > 0) { - err(event->udev, "requested part of result string not found\n"); - break; - } - util_strscpy(tmp, sizeof(tmp), cpos); - /* %{2+}c copies the whole string from the second part on */ - if (rest[0] != '+') { - cpos = strchr(tmp, ' '); - if (cpos) - cpos[0] = '\0'; - } - l = util_strpcpy(&s, l, tmp); - dbg(event->udev, "substitute part of result string '%s'\n", tmp); - } else { - l = util_strpcpy(&s, l, event->program_result); - dbg(event->udev, "substitute result string '%s'\n", event->program_result); - } - break; - } - case SUBST_ATTR: { - const char *value = NULL; - char vbuf[UTIL_NAME_SIZE]; - size_t len; - int count; - - if (attr == NULL) { - err(event->udev, "missing file parameter for attr\n"); - break; - } - - /* try to read the value specified by "[dmi/id]product_name" */ - if (util_resolve_subsys_kernel(event->udev, attr, vbuf, sizeof(vbuf), 1) == 0) - value = vbuf; - - /* try to read the attribute the device */ - if (value == NULL) - value = udev_device_get_sysattr_value(event->dev, attr); - - /* try to read the attribute of the parent device, other matches have selected */ - if (value == NULL && event->dev_parent != NULL && event->dev_parent != event->dev) - value = udev_device_get_sysattr_value(event->dev_parent, attr); - - if (value == NULL) - break; - - /* strip trailing whitespace, and replace unwanted characters */ - if (value != vbuf) - util_strscpy(vbuf, sizeof(vbuf), value); - len = strlen(vbuf); - while (len > 0 && isspace(vbuf[--len])) - vbuf[len] = '\0'; - count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - l = util_strpcpy(&s, l, vbuf); - dbg(event->udev, "substitute sysfs value '%s'\n", vbuf); - break; - } - case SUBST_PARENT: { - struct udev_device *dev_parent; - const char *devnode; - - dev_parent = udev_device_get_parent(event->dev); - if (dev_parent == NULL) - break; - devnode = udev_device_get_devnode(dev_parent); - if (devnode != NULL) { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - - l = util_strpcpy(&s, l, &devnode[devlen]); - dbg(event->udev, "found parent '%s', got node name '%s'\n", - udev_device_get_syspath(dev_parent), &devnode[devlen]); - } - break; - } - case SUBST_DEVNODE: - if (udev_device_get_devnode(dev) != NULL) - l = util_strpcpy(&s, l, udev_device_get_devnode(dev)); - break; - case SUBST_NAME: - if (event->name != NULL) { - l = util_strpcpy(&s, l, event->name); - dbg(event->udev, "substitute name '%s'\n", event->name); - } else { - l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); - dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); - } - break; - case SUBST_LINKS: { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - struct udev_list_entry *list_entry; - - list_entry = udev_device_get_devlinks_list_entry(dev); - if (list_entry == NULL) - break; - l = util_strpcpy(&s, l, &udev_list_entry_get_name(list_entry)[devlen]); - udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) - l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); - break; - } - case SUBST_ROOT: - l = util_strpcpy(&s, l, udev_get_dev_path(event->udev)); - dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); - break; - case SUBST_SYS: - l = util_strpcpy(&s, l, udev_get_sys_path(event->udev)); - dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); - break; - case SUBST_ENV: - if (attr == NULL) { - dbg(event->udev, "missing attribute\n"); - break; - } else { - const char *value; - - value = udev_device_get_property_value(event->dev, attr); - if (value == NULL) - break; - dbg(event->udev, "substitute env '%s=%s'\n", attr, value); - l = util_strpcpy(&s, l, value); - break; - } - default: - err(event->udev, "unknown substitution type=%i\n", type); - break; - } - } + /* extract possible $format{attr} */ + if (from[0] == '{') { + unsigned int i; + + from++; + for (i = 0; from[i] != '}'; i++) { + if (from[i] == '\0') { + err(event->udev, "missing closing brace for format '%s'\n", src); + goto out; + } + } + if (i >= sizeof(attrbuf)) + goto out; + memcpy(attrbuf, from, i); + attrbuf[i] = '\0'; + from += i+1; + attr = attrbuf; + } else { + attr = NULL; + } + + switch (type) { + case SUBST_DEVPATH: + l = util_strpcpy(&s, l, udev_device_get_devpath(dev)); + dbg(event->udev, "substitute devpath '%s'\n", udev_device_get_devpath(dev)); + break; + case SUBST_KERNEL: + l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); + dbg(event->udev, "substitute kernel name '%s'\n", udev_device_get_sysname(dev)); + break; + case SUBST_KERNEL_NUMBER: + if (udev_device_get_sysnum(dev) == NULL) + break; + l = util_strpcpy(&s, l, udev_device_get_sysnum(dev)); + dbg(event->udev, "substitute kernel number '%s'\n", udev_device_get_sysnum(dev)); + break; + case SUBST_ID: + if (event->dev_parent == NULL) + break; + l = util_strpcpy(&s, l, udev_device_get_sysname(event->dev_parent)); + dbg(event->udev, "substitute id '%s'\n", udev_device_get_sysname(event->dev_parent)); + break; + case SUBST_DRIVER: { + const char *driver; + + if (event->dev_parent == NULL) + break; + + driver = udev_device_get_driver(event->dev_parent); + if (driver == NULL) + break; + l = util_strpcpy(&s, l, driver); + dbg(event->udev, "substitute driver '%s'\n", driver); + break; + } + case SUBST_MAJOR: { + char num[UTIL_PATH_SIZE]; + + sprintf(num, "%d", major(udev_device_get_devnum(dev))); + l = util_strpcpy(&s, l, num); + dbg(event->udev, "substitute major number '%s'\n", num); + break; + } + case SUBST_MINOR: { + char num[UTIL_PATH_SIZE]; + + sprintf(num, "%d", minor(udev_device_get_devnum(dev))); + l = util_strpcpy(&s, l, num); + dbg(event->udev, "substitute minor number '%s'\n", num); + break; + } + case SUBST_RESULT: { + char *rest; + int i; + + if (event->program_result == NULL) + break; + /* get part part of the result string */ + i = 0; + if (attr != NULL) + i = strtoul(attr, &rest, 10); + if (i > 0) { + char result[UTIL_PATH_SIZE]; + char tmp[UTIL_PATH_SIZE]; + char *cpos; + + dbg(event->udev, "request part #%d of result string\n", i); + util_strscpy(result, sizeof(result), event->program_result); + cpos = result; + while (--i) { + while (cpos[0] != '\0' && !isspace(cpos[0])) + cpos++; + while (isspace(cpos[0])) + cpos++; + } + if (i > 0) { + err(event->udev, "requested part of result string not found\n"); + break; + } + util_strscpy(tmp, sizeof(tmp), cpos); + /* %{2+}c copies the whole string from the second part on */ + if (rest[0] != '+') { + cpos = strchr(tmp, ' '); + if (cpos) + cpos[0] = '\0'; + } + l = util_strpcpy(&s, l, tmp); + dbg(event->udev, "substitute part of result string '%s'\n", tmp); + } else { + l = util_strpcpy(&s, l, event->program_result); + dbg(event->udev, "substitute result string '%s'\n", event->program_result); + } + break; + } + case SUBST_ATTR: { + const char *value = NULL; + char vbuf[UTIL_NAME_SIZE]; + size_t len; + int count; + + if (attr == NULL) { + err(event->udev, "missing file parameter for attr\n"); + break; + } + + /* try to read the value specified by "[dmi/id]product_name" */ + if (util_resolve_subsys_kernel(event->udev, attr, vbuf, sizeof(vbuf), 1) == 0) + value = vbuf; + + /* try to read the attribute the device */ + if (value == NULL) + value = udev_device_get_sysattr_value(event->dev, attr); + + /* try to read the attribute of the parent device, other matches have selected */ + if (value == NULL && event->dev_parent != NULL && event->dev_parent != event->dev) + value = udev_device_get_sysattr_value(event->dev_parent, attr); + + if (value == NULL) + break; + + /* strip trailing whitespace, and replace unwanted characters */ + if (value != vbuf) + util_strscpy(vbuf, sizeof(vbuf), value); + len = strlen(vbuf); + while (len > 0 && isspace(vbuf[--len])) + vbuf[len] = '\0'; + count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + l = util_strpcpy(&s, l, vbuf); + dbg(event->udev, "substitute sysfs value '%s'\n", vbuf); + break; + } + case SUBST_PARENT: { + struct udev_device *dev_parent; + const char *devnode; + + dev_parent = udev_device_get_parent(event->dev); + if (dev_parent == NULL) + break; + devnode = udev_device_get_devnode(dev_parent); + if (devnode != NULL) { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + + l = util_strpcpy(&s, l, &devnode[devlen]); + dbg(event->udev, "found parent '%s', got node name '%s'\n", + udev_device_get_syspath(dev_parent), &devnode[devlen]); + } + break; + } + case SUBST_DEVNODE: + if (udev_device_get_devnode(dev) != NULL) + l = util_strpcpy(&s, l, udev_device_get_devnode(dev)); + break; + case SUBST_NAME: + if (event->name != NULL) { + l = util_strpcpy(&s, l, event->name); + dbg(event->udev, "substitute name '%s'\n", event->name); + } else { + l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); + dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); + } + break; + case SUBST_LINKS: { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; + + list_entry = udev_device_get_devlinks_list_entry(dev); + if (list_entry == NULL) + break; + l = util_strpcpy(&s, l, &udev_list_entry_get_name(list_entry)[devlen]); + udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) + l = util_strpcpyl(&s, l, " ", &udev_list_entry_get_name(list_entry)[devlen], NULL); + break; + } + case SUBST_ROOT: + l = util_strpcpy(&s, l, udev_get_dev_path(event->udev)); + dbg(event->udev, "substitute udev_root '%s'\n", udev_get_dev_path(event->udev)); + break; + case SUBST_SYS: + l = util_strpcpy(&s, l, udev_get_sys_path(event->udev)); + dbg(event->udev, "substitute sys_path '%s'\n", udev_get_sys_path(event->udev)); + break; + case SUBST_ENV: + if (attr == NULL) { + dbg(event->udev, "missing attribute\n"); + break; + } else { + const char *value; + + value = udev_device_get_property_value(event->dev, attr); + if (value == NULL) + break; + dbg(event->udev, "substitute env '%s=%s'\n", attr, value); + l = util_strpcpy(&s, l, value); + break; + } + default: + err(event->udev, "unknown substitution type=%i\n", type); + break; + } + } out: - s[0] = '\0'; - dbg(event->udev, "'%s' -> '%s' (%zu)\n", src, dest, l); - return l; + s[0] = '\0'; + dbg(event->udev, "'%s' -> '%s' (%zu)\n", src, dest, l); + return l; } static int spawn_exec(struct udev_event *event, - const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask, - int fd_stdout, int fd_stderr) + const char *cmd, char *const argv[], char **envp, const sigset_t *sigmask, + int fd_stdout, int fd_stderr) { - struct udev *udev = event->udev; - int err; - int fd; - - /* discard child output or connect to pipe */ - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDIN_FILENO); - if (fd_stdout < 0) - dup2(fd, STDOUT_FILENO); - if (fd_stderr < 0) - dup2(fd, STDERR_FILENO); - close(fd); - } else { - err(udev, "open /dev/null failed: %m\n"); - } - - /* connect pipes to std{out,err} */ - if (fd_stdout >= 0) { - dup2(fd_stdout, STDOUT_FILENO); - close(fd_stdout); - } - if (fd_stderr >= 0) { - dup2(fd_stderr, STDERR_FILENO); - close(fd_stderr); - } - - /* terminate child in case parent goes away */ - prctl(PR_SET_PDEATHSIG, SIGTERM); - - /* restore original udev sigmask before exec */ - if (sigmask) - sigprocmask(SIG_SETMASK, sigmask, NULL); - - execve(argv[0], argv, envp); - - /* exec failed */ - err = -errno; - err(udev, "failed to execute '%s' '%s': %m\n", argv[0], cmd); - return err; + struct udev *udev = event->udev; + int err; + int fd; + + /* discard child output or connect to pipe */ + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + if (fd_stdout < 0) + dup2(fd, STDOUT_FILENO); + if (fd_stderr < 0) + dup2(fd, STDERR_FILENO); + close(fd); + } else { + err(udev, "open /dev/null failed: %m\n"); + } + + /* connect pipes to std{out,err} */ + if (fd_stdout >= 0) { + dup2(fd_stdout, STDOUT_FILENO); + close(fd_stdout); + } + if (fd_stderr >= 0) { + dup2(fd_stderr, STDERR_FILENO); + close(fd_stderr); + } + + /* terminate child in case parent goes away */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + + /* restore original udev sigmask before exec */ + if (sigmask) + sigprocmask(SIG_SETMASK, sigmask, NULL); + + execve(argv[0], argv, envp); + + /* exec failed */ + err = -errno; + err(udev, "failed to execute '%s' '%s': %m\n", argv[0], cmd); + return err; } static void spawn_read(struct udev_event *event, - const char *cmd, - int fd_stdout, int fd_stderr, - char *result, size_t ressize) + const char *cmd, + int fd_stdout, int fd_stderr, + char *result, size_t ressize) { - struct udev *udev = event->udev; - size_t respos = 0; - int fd_ep = -1; - struct epoll_event ep_outpipe, ep_errpipe; - - /* read from child if requested */ - if (fd_stdout < 0 && fd_stderr < 0) - return; - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - err(udev, "error creating epoll fd: %m\n"); - goto out; - } - - if (fd_stdout >= 0) { - memset(&ep_outpipe, 0, sizeof(struct epoll_event)); - ep_outpipe.events = EPOLLIN; - ep_outpipe.data.ptr = &fd_stdout; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - } - - if (fd_stderr >= 0) { - memset(&ep_errpipe, 0, sizeof(struct epoll_event)); - ep_errpipe.events = EPOLLIN; - ep_errpipe.data.ptr = &fd_stderr; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - } - - /* read child output */ - while (fd_stdout >= 0 || fd_stderr >= 0) { - int timeout; - int fdcount; - struct epoll_event ev[4]; - int i; - - if (event->timeout_usec > 0) { - unsigned long long age_usec; - - age_usec = now_usec() - event->birth_usec; - if (age_usec >= event->timeout_usec) { - err(udev, "timeout '%s'\n", cmd); - goto out; - } - timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; - } else { - timeout = -1; - } - - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err(udev, "failed to poll: %m\n"); - goto out; - } - if (fdcount == 0) { - err(udev, "timeout '%s'\n", cmd); - goto out; - } - - for (i = 0; i < fdcount; i++) { - int *fd = (int *)ev[i].data.ptr; - - if (ev[i].events & EPOLLIN) { - ssize_t count; - char buf[4096]; - - count = read(*fd, buf, sizeof(buf)-1); - if (count <= 0) - continue; - buf[count] = '\0'; - - /* store stdout result */ - if (result != NULL && *fd == fd_stdout) { - if (respos + count < ressize) { - memcpy(&result[respos], buf, count); - respos += count; - } else { - err(udev, "'%s' ressize %zd too short\n", cmd, ressize); - } - } - - /* log debug output only if we watch stderr */ - if (fd_stderr >= 0) { - char *pos; - char *line; - - pos = buf; - while ((line = strsep(&pos, "\n"))) { - if (pos != NULL || line[0] != '\0') - info(udev, "'%s'(%s) '%s'\n", cmd, *fd == fd_stdout ? "out" : "err" , line); - } - } - } else if (ev[i].events & EPOLLHUP) { - if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) { - err(udev, "failed to remove fd from epoll: %m\n"); - goto out; - } - *fd = -1; - } - } - } - - /* return the child's stdout string */ - if (result != NULL) { - result[respos] = '\0'; - dbg(udev, "result='%s'\n", result); - } + struct udev *udev = event->udev; + size_t respos = 0; + int fd_ep = -1; + struct epoll_event ep_outpipe, ep_errpipe; + + /* read from child if requested */ + if (fd_stdout < 0 && fd_stderr < 0) + return; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto out; + } + + if (fd_stdout >= 0) { + memset(&ep_outpipe, 0, sizeof(struct epoll_event)); + ep_outpipe.events = EPOLLIN; + ep_outpipe.data.ptr = &fd_stdout; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stdout, &ep_outpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + if (fd_stderr >= 0) { + memset(&ep_errpipe, 0, sizeof(struct epoll_event)); + ep_errpipe.events = EPOLLIN; + ep_errpipe.data.ptr = &fd_stderr; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_stderr, &ep_errpipe) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + } + + /* read child output */ + while (fd_stdout >= 0 || fd_stderr >= 0) { + int timeout; + int fdcount; + struct epoll_event ev[4]; + int i; + + if (event->timeout_usec > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - event->birth_usec; + if (age_usec >= event->timeout_usec) { + err(udev, "timeout '%s'\n", cmd); + goto out; + } + timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + } else { + timeout = -1; + } + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err(udev, "failed to poll: %m\n"); + goto out; + } + if (fdcount == 0) { + err(udev, "timeout '%s'\n", cmd); + goto out; + } + + for (i = 0; i < fdcount; i++) { + int *fd = (int *)ev[i].data.ptr; + + if (ev[i].events & EPOLLIN) { + ssize_t count; + char buf[4096]; + + count = read(*fd, buf, sizeof(buf)-1); + if (count <= 0) + continue; + buf[count] = '\0'; + + /* store stdout result */ + if (result != NULL && *fd == fd_stdout) { + if (respos + count < ressize) { + memcpy(&result[respos], buf, count); + respos += count; + } else { + err(udev, "'%s' ressize %zd too short\n", cmd, ressize); + } + } + + /* log debug output only if we watch stderr */ + if (fd_stderr >= 0) { + char *pos; + char *line; + + pos = buf; + while ((line = strsep(&pos, "\n"))) { + if (pos != NULL || line[0] != '\0') + info(udev, "'%s'(%s) '%s'\n", cmd, *fd == fd_stdout ? "out" : "err" , line); + } + } + } else if (ev[i].events & EPOLLHUP) { + if (epoll_ctl(fd_ep, EPOLL_CTL_DEL, *fd, NULL) < 0) { + err(udev, "failed to remove fd from epoll: %m\n"); + goto out; + } + *fd = -1; + } + } + } + + /* return the child's stdout string */ + if (result != NULL) { + result[respos] = '\0'; + dbg(udev, "result='%s'\n", result); + } out: - if (fd_ep >= 0) - close(fd_ep); + if (fd_ep >= 0) + close(fd_ep); } static int spawn_wait(struct udev_event *event, const char *cmd, pid_t pid) { - struct udev *udev = event->udev; - struct pollfd pfd[1]; - int err = 0; - - pfd[0].events = POLLIN; - pfd[0].fd = event->fd_signal; - - while (pid > 0) { - int timeout; - int fdcount; - - if (event->timeout_usec > 0) { - unsigned long long age_usec; - - age_usec = now_usec() - event->birth_usec; - if (age_usec >= event->timeout_usec) - timeout = 1000; - else - timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; - } else { - timeout = -1; - } - - fdcount = poll(pfd, 1, timeout); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err = -errno; - err(udev, "failed to poll: %m\n"); - goto out; - } - if (fdcount == 0) { - err(udev, "timeout: killing '%s' [%u]\n", cmd, pid); - kill(pid, SIGKILL); - } - - if (pfd[0].revents & POLLIN) { - struct signalfd_siginfo fdsi; - int status; - ssize_t size; - - size = read(event->fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); - if (size != sizeof(struct signalfd_siginfo)) - continue; - - switch (fdsi.ssi_signo) { - case SIGTERM: - event->sigterm = true; - break; - case SIGCHLD: - if (waitpid(pid, &status, WNOHANG) < 0) - break; - if (WIFEXITED(status)) { - info(udev, "'%s' [%u] exit with return code %i\n", cmd, pid, WEXITSTATUS(status)); - if (WEXITSTATUS(status) != 0) - err = -1; - } else if (WIFSIGNALED(status)) { - err(udev, "'%s' [%u] terminated by signal %i (%s)\n", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status))); - err = -1; - } else if (WIFSTOPPED(status)) { - err(udev, "'%s' [%u] stopped\n", cmd, pid); - err = -1; - } else if (WIFCONTINUED(status)) { - err(udev, "'%s' [%u] continued\n", cmd, pid); - err = -1; - } else { - err(udev, "'%s' [%u] exit with status 0x%04x\n", cmd, pid, status); - err = -1; - } - pid = 0; - break; - } - } - } + struct udev *udev = event->udev; + struct pollfd pfd[1]; + int err = 0; + + pfd[0].events = POLLIN; + pfd[0].fd = event->fd_signal; + + while (pid > 0) { + int timeout; + int fdcount; + + if (event->timeout_usec > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - event->birth_usec; + if (age_usec >= event->timeout_usec) + timeout = 1000; + else + timeout = ((event->timeout_usec - age_usec) / 1000) + 1000; + } else { + timeout = -1; + } + + fdcount = poll(pfd, 1, timeout); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } + if (fdcount == 0) { + err(udev, "timeout: killing '%s' [%u]\n", cmd, pid); + kill(pid, SIGKILL); + } + + if (pfd[0].revents & POLLIN) { + struct signalfd_siginfo fdsi; + int status; + ssize_t size; + + size = read(event->fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size != sizeof(struct signalfd_siginfo)) + continue; + + switch (fdsi.ssi_signo) { + case SIGTERM: + event->sigterm = true; + break; + case SIGCHLD: + if (waitpid(pid, &status, WNOHANG) < 0) + break; + if (WIFEXITED(status)) { + info(udev, "'%s' [%u] exit with return code %i\n", cmd, pid, WEXITSTATUS(status)); + if (WEXITSTATUS(status) != 0) + err = -1; + } else if (WIFSIGNALED(status)) { + err(udev, "'%s' [%u] terminated by signal %i (%s)\n", cmd, pid, WTERMSIG(status), strsignal(WTERMSIG(status))); + err = -1; + } else if (WIFSTOPPED(status)) { + err(udev, "'%s' [%u] stopped\n", cmd, pid); + err = -1; + } else if (WIFCONTINUED(status)) { + err(udev, "'%s' [%u] continued\n", cmd, pid); + err = -1; + } else { + err(udev, "'%s' [%u] exit with status 0x%04x\n", cmd, pid, status); + err = -1; + } + pid = 0; + break; + } + } + } out: - return err; + return err; } int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]) { - int i = 0; - char *pos; - - if (strchr(cmd, ' ') == NULL) { - argv[i++] = cmd; - goto out; - } - - pos = cmd; - while (pos != NULL && pos[0] != '\0') { - if (pos[0] == '\'') { - /* do not separate quotes */ - pos++; - argv[i] = strsep(&pos, "\'"); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } else { - argv[i] = strsep(&pos, " "); - if (pos != NULL) - while (pos[0] == ' ') - pos++; - } - dbg(udev, "argv[%i] '%s'\n", i, argv[i]); - i++; - } + int i = 0; + char *pos; + + if (strchr(cmd, ' ') == NULL) { + argv[i++] = cmd; + goto out; + } + + pos = cmd; + while (pos != NULL && pos[0] != '\0') { + if (pos[0] == '\'') { + /* do not separate quotes */ + pos++; + argv[i] = strsep(&pos, "\'"); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } else { + argv[i] = strsep(&pos, " "); + if (pos != NULL) + while (pos[0] == ' ') + pos++; + } + dbg(udev, "argv[%i] '%s'\n", i, argv[i]); + i++; + } out: - argv[i] = NULL; - if (argc) - *argc = i; - return 0; + argv[i] = NULL; + if (argc) + *argc = i; + return 0; } int udev_event_spawn(struct udev_event *event, - const char *cmd, char **envp, const sigset_t *sigmask, - char *result, size_t ressize) + const char *cmd, char **envp, const sigset_t *sigmask, + char *result, size_t ressize) { - struct udev *udev = event->udev; - int outpipe[2] = {-1, -1}; - int errpipe[2] = {-1, -1}; - pid_t pid; - char arg[UTIL_PATH_SIZE]; - char *argv[128]; - char program[UTIL_PATH_SIZE]; - int err = 0; - - util_strscpy(arg, sizeof(arg), cmd); - udev_build_argv(event->udev, arg, NULL, argv); - - /* pipes from child to parent */ - if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe2(outpipe, O_NONBLOCK) != 0) { - err = -errno; - err(udev, "pipe failed: %m\n"); - goto out; - } - } - if (udev_get_log_priority(udev) >= LOG_INFO) { - if (pipe2(errpipe, O_NONBLOCK) != 0) { - err = -errno; - err(udev, "pipe failed: %m\n"); - goto out; - } - } - - /* allow programs in /usr/lib/udev/ to be called without the path */ - if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), PKGLIBEXECDIR "/", argv[0], NULL); - argv[0] = program; - } - - pid = fork(); - switch(pid) { - case 0: - /* child closes parent's ends of pipes */ - if (outpipe[READ_END] >= 0) { - close(outpipe[READ_END]); - outpipe[READ_END] = -1; - } - if (errpipe[READ_END] >= 0) { - close(errpipe[READ_END]); - errpipe[READ_END] = -1; - } - - info(udev, "starting '%s'\n", cmd); - - err = spawn_exec(event, cmd, argv, envp, sigmask, - outpipe[WRITE_END], errpipe[WRITE_END]); - - _exit(2 ); - case -1: - err(udev, "fork of '%s' failed: %m\n", cmd); - err = -1; - goto out; - default: - /* parent closed child's ends of pipes */ - if (outpipe[WRITE_END] >= 0) { - close(outpipe[WRITE_END]); - outpipe[WRITE_END] = -1; - } - if (errpipe[WRITE_END] >= 0) { - close(errpipe[WRITE_END]); - errpipe[WRITE_END] = -1; - } - - spawn_read(event, cmd, - outpipe[READ_END], errpipe[READ_END], - result, ressize); - - err = spawn_wait(event, cmd, pid); - } + struct udev *udev = event->udev; + int outpipe[2] = {-1, -1}; + int errpipe[2] = {-1, -1}; + pid_t pid; + char arg[UTIL_PATH_SIZE]; + char *argv[128]; + char program[UTIL_PATH_SIZE]; + int err = 0; + + util_strscpy(arg, sizeof(arg), cmd); + udev_build_argv(event->udev, arg, NULL, argv); + + /* pipes from child to parent */ + if (result != NULL || udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe2(outpipe, O_NONBLOCK) != 0) { + err = -errno; + err(udev, "pipe failed: %m\n"); + goto out; + } + } + if (udev_get_log_priority(udev) >= LOG_INFO) { + if (pipe2(errpipe, O_NONBLOCK) != 0) { + err = -errno; + err(udev, "pipe failed: %m\n"); + goto out; + } + } + + /* allow programs in /usr/lib/udev/ to be called without the path */ + if (argv[0][0] != '/') { + util_strscpyl(program, sizeof(program), PKGLIBEXECDIR "/", argv[0], NULL); + argv[0] = program; + } + + pid = fork(); + switch(pid) { + case 0: + /* child closes parent's ends of pipes */ + if (outpipe[READ_END] >= 0) { + close(outpipe[READ_END]); + outpipe[READ_END] = -1; + } + if (errpipe[READ_END] >= 0) { + close(errpipe[READ_END]); + errpipe[READ_END] = -1; + } + + info(udev, "starting '%s'\n", cmd); + + err = spawn_exec(event, cmd, argv, envp, sigmask, + outpipe[WRITE_END], errpipe[WRITE_END]); + + _exit(2 ); + case -1: + err(udev, "fork of '%s' failed: %m\n", cmd); + err = -1; + goto out; + default: + /* parent closed child's ends of pipes */ + if (outpipe[WRITE_END] >= 0) { + close(outpipe[WRITE_END]); + outpipe[WRITE_END] = -1; + } + if (errpipe[WRITE_END] >= 0) { + close(errpipe[WRITE_END]); + errpipe[WRITE_END] = -1; + } + + spawn_read(event, cmd, + outpipe[READ_END], errpipe[READ_END], + result, ressize); + + err = spawn_wait(event, cmd, pid); + } out: - if (outpipe[READ_END] >= 0) - close(outpipe[READ_END]); - if (outpipe[WRITE_END] >= 0) - close(outpipe[WRITE_END]); - if (errpipe[READ_END] >= 0) - close(errpipe[READ_END]); - if (errpipe[WRITE_END] >= 0) - close(errpipe[WRITE_END]); - return err; + if (outpipe[READ_END] >= 0) + close(outpipe[READ_END]); + if (outpipe[WRITE_END] >= 0) + close(outpipe[WRITE_END]); + if (errpipe[READ_END] >= 0) + close(errpipe[READ_END]); + if (errpipe[WRITE_END] >= 0) + close(errpipe[WRITE_END]); + return err; } static void rename_netif_kernel_log(struct ifreq ifr) { - int klog; - FILE *f; - - klog = open("/dev/kmsg", O_WRONLY); - if (klog < 0) - return; - - f = fdopen(klog, "w"); - if (f == NULL) { - close(klog); - return; - } - - fprintf(f, "<30>udevd[%u]: renamed network interface %s to %s\n", - getpid(), ifr.ifr_name, ifr.ifr_newname); - fclose(f); + int klog; + FILE *f; + + klog = open("/dev/kmsg", O_WRONLY); + if (klog < 0) + return; + + f = fdopen(klog, "w"); + if (f == NULL) { + close(klog); + return; + } + + fprintf(f, "<30>udevd[%u]: renamed network interface %s to %s\n", + getpid(), ifr.ifr_name, ifr.ifr_newname); + fclose(f); } static int rename_netif(struct udev_event *event) { - struct udev_device *dev = event->dev; - int sk; - struct ifreq ifr; - int loop; - int err; - - info(event->udev, "changing net interface name from '%s' to '%s'\n", - udev_device_get_sysname(dev), event->name); - - sk = socket(PF_INET, SOCK_DGRAM, 0); - if (sk < 0) { - err = -errno; - err(event->udev, "error opening socket: %m\n"); - return err; - } - - memset(&ifr, 0x00, sizeof(struct ifreq)); - util_strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev)); - util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err == 0) { - rename_netif_kernel_log(ifr); - goto out; - } - - /* keep trying if the destination interface name already exists */ - err = -errno; - if (err != -EEXIST) - goto out; - - /* free our own name, another process may wait for us */ - snprintf(ifr.ifr_newname, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev)); - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err < 0) { - err = -errno; - goto out; - } - - /* log temporary name */ - rename_netif_kernel_log(ifr); - - /* wait a maximum of 90 seconds for our target to become available */ - util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); - util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); - loop = 90 * 20; - while (loop--) { - const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; - - dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", - event->name, (90 * 20) - loop); - nanosleep(&duration, NULL); - - err = ioctl(sk, SIOCSIFNAME, &ifr); - if (err == 0) { - rename_netif_kernel_log(ifr); - break; - } - err = -errno; - if (err != -EEXIST) - break; - } + struct udev_device *dev = event->dev; + int sk; + struct ifreq ifr; + int loop; + int err; + + info(event->udev, "changing net interface name from '%s' to '%s'\n", + udev_device_get_sysname(dev), event->name); + + sk = socket(PF_INET, SOCK_DGRAM, 0); + if (sk < 0) { + err = -errno; + err(event->udev, "error opening socket: %m\n"); + return err; + } + + memset(&ifr, 0x00, sizeof(struct ifreq)); + util_strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev)); + util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err == 0) { + rename_netif_kernel_log(ifr); + goto out; + } + + /* keep trying if the destination interface name already exists */ + err = -errno; + if (err != -EEXIST) + goto out; + + /* free our own name, another process may wait for us */ + snprintf(ifr.ifr_newname, IFNAMSIZ, "rename%u", udev_device_get_ifindex(dev)); + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err < 0) { + err = -errno; + goto out; + } + + /* log temporary name */ + rename_netif_kernel_log(ifr); + + /* wait a maximum of 90 seconds for our target to become available */ + util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); + util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); + loop = 90 * 20; + while (loop--) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; + + dbg(event->udev, "wait for netif '%s' to become free, loop=%i\n", + event->name, (90 * 20) - loop); + nanosleep(&duration, NULL); + + err = ioctl(sk, SIOCSIFNAME, &ifr); + if (err == 0) { + rename_netif_kernel_log(ifr); + break; + } + err = -errno; + if (err != -EEXIST) + break; + } out: - if (err < 0) - err(event->udev, "error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); - close(sk); - return err; + if (err < 0) + err(event->udev, "error changing net interface name %s to %s: %m\n", ifr.ifr_name, ifr.ifr_newname); + close(sk); + return err; } int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigmask) { - struct udev_device *dev = event->dev; - int err = 0; - - if (udev_device_get_subsystem(dev) == NULL) - return -1; - - if (strcmp(udev_device_get_action(dev), "remove") == 0) { - udev_device_read_db(dev, NULL); - udev_device_delete_db(dev); - udev_device_tag_index(dev, NULL, false); - - if (major(udev_device_get_devnum(dev)) != 0) - udev_watch_end(event->udev, dev); - - udev_rules_apply_to_event(rules, event, sigmask); - - if (major(udev_device_get_devnum(dev)) != 0) - err = udev_node_remove(dev); - } else { - event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); - if (event->dev_db != NULL) { - udev_device_read_db(event->dev_db, NULL); - udev_device_set_info_loaded(event->dev_db); - - /* disable watch during event processing */ - if (major(udev_device_get_devnum(dev)) != 0) - udev_watch_end(event->udev, event->dev_db); - } - - udev_rules_apply_to_event(rules, event, sigmask); - - /* rename a new network interface, if needed */ - if (udev_device_get_ifindex(dev) > 0 && strcmp(udev_device_get_action(dev), "add") == 0 && - event->name != NULL && strcmp(event->name, udev_device_get_sysname(dev)) != 0) { - char syspath[UTIL_PATH_SIZE]; - char *pos; - - err = rename_netif(event); - if (err == 0) { - info(event->udev, "renamed netif to '%s'\n", event->name); - - /* remember old name */ - udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); - - /* now change the devpath, because the kernel device name has changed */ - util_strscpy(syspath, sizeof(syspath), udev_device_get_syspath(dev)); - pos = strrchr(syspath, '/'); - if (pos != NULL) { - pos++; - util_strscpy(pos, sizeof(syspath) - (pos - syspath), event->name); - udev_device_set_syspath(event->dev, syspath); - udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); - info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); - } - } - } - - if (major(udev_device_get_devnum(dev)) != 0) { - /* remove/update possible left-over symlinks from old database entry */ - if (event->dev_db != NULL) - udev_node_update_old_links(dev, event->dev_db); - - if (!event->mode_set) { - if (udev_device_get_devnode_mode(dev) > 0) { - /* kernel supplied value */ - event->mode = udev_device_get_devnode_mode(dev); - } else if (event->gid > 0) { - /* default 0660 if a group is assigned */ - event->mode = 0660; - } else { - /* default 0600 */ - event->mode = 0600; - } - } - - err = udev_node_add(dev, event->mode, event->uid, event->gid); - } - - /* preserve old, or get new initialization timestamp */ - if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0) - udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db)); - else if (udev_device_get_usec_initialized(event->dev) == 0) - udev_device_set_usec_initialized(event->dev, now_usec()); - - /* (re)write database file */ - udev_device_update_db(dev); - udev_device_tag_index(dev, event->dev_db, true); - udev_device_set_is_initialized(dev); - - udev_device_unref(event->dev_db); - event->dev_db = NULL; - } + struct udev_device *dev = event->dev; + int err = 0; + + if (udev_device_get_subsystem(dev) == NULL) + return -1; + + if (strcmp(udev_device_get_action(dev), "remove") == 0) { + udev_device_read_db(dev, NULL); + udev_device_delete_db(dev); + udev_device_tag_index(dev, NULL, false); + + if (major(udev_device_get_devnum(dev)) != 0) + udev_watch_end(event->udev, dev); + + udev_rules_apply_to_event(rules, event, sigmask); + + if (major(udev_device_get_devnum(dev)) != 0) + err = udev_node_remove(dev); + } else { + event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); + if (event->dev_db != NULL) { + udev_device_read_db(event->dev_db, NULL); + udev_device_set_info_loaded(event->dev_db); + + /* disable watch during event processing */ + if (major(udev_device_get_devnum(dev)) != 0) + udev_watch_end(event->udev, event->dev_db); + } + + udev_rules_apply_to_event(rules, event, sigmask); + + /* rename a new network interface, if needed */ + if (udev_device_get_ifindex(dev) > 0 && strcmp(udev_device_get_action(dev), "add") == 0 && + event->name != NULL && strcmp(event->name, udev_device_get_sysname(dev)) != 0) { + char syspath[UTIL_PATH_SIZE]; + char *pos; + + err = rename_netif(event); + if (err == 0) { + info(event->udev, "renamed netif to '%s'\n", event->name); + + /* remember old name */ + udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); + + /* now change the devpath, because the kernel device name has changed */ + util_strscpy(syspath, sizeof(syspath), udev_device_get_syspath(dev)); + pos = strrchr(syspath, '/'); + if (pos != NULL) { + pos++; + util_strscpy(pos, sizeof(syspath) - (pos - syspath), event->name); + udev_device_set_syspath(event->dev, syspath); + udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); + info(event->udev, "changed devpath to '%s'\n", udev_device_get_devpath(dev)); + } + } + } + + if (major(udev_device_get_devnum(dev)) != 0) { + /* remove/update possible left-over symlinks from old database entry */ + if (event->dev_db != NULL) + udev_node_update_old_links(dev, event->dev_db); + + if (!event->mode_set) { + if (udev_device_get_devnode_mode(dev) > 0) { + /* kernel supplied value */ + event->mode = udev_device_get_devnode_mode(dev); + } else if (event->gid > 0) { + /* default 0660 if a group is assigned */ + event->mode = 0660; + } else { + /* default 0600 */ + event->mode = 0600; + } + } + + err = udev_node_add(dev, event->mode, event->uid, event->gid); + } + + /* preserve old, or get new initialization timestamp */ + if (event->dev_db != NULL && udev_device_get_usec_initialized(event->dev_db) > 0) + udev_device_set_usec_initialized(event->dev, udev_device_get_usec_initialized(event->dev_db)); + else if (udev_device_get_usec_initialized(event->dev) == 0) + udev_device_set_usec_initialized(event->dev, now_usec()); + + /* (re)write database file */ + udev_device_update_db(dev); + udev_device_tag_index(dev, event->dev_db, true); + udev_device_set_is_initialized(dev); + + udev_device_unref(event->dev_db); + event->dev_db = NULL; + } out: - return err; + return err; } int udev_event_execute_run(struct udev_event *event, const sigset_t *sigmask) { - struct udev_list_entry *list_entry; - int err = 0; - - dbg(event->udev, "executing run list\n"); - udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { - const char *cmd = udev_list_entry_get_name(list_entry); - - if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { - struct udev_monitor *monitor; - - monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); - if (monitor == NULL) - continue; - udev_monitor_send_device(monitor, NULL, event->dev); - udev_monitor_unref(monitor); - } else { - char program[UTIL_PATH_SIZE]; - char **envp; - - if (event->exec_delay > 0) { - info(event->udev, "delay execution of '%s'\n", program); - sleep(event->exec_delay); - } - - udev_event_apply_format(event, cmd, program, sizeof(program)); - envp = udev_device_get_properties_envp(event->dev); - if (udev_event_spawn(event, program, envp, sigmask, NULL, 0) < 0) { - if (udev_list_entry_get_num(list_entry)) - err = -1; - } - } - } - return err; + struct udev_list_entry *list_entry; + int err = 0; + + dbg(event->udev, "executing run list\n"); + udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) { + const char *cmd = udev_list_entry_get_name(list_entry); + + if (strncmp(cmd, "socket:", strlen("socket:")) == 0) { + struct udev_monitor *monitor; + + monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]); + if (monitor == NULL) + continue; + udev_monitor_send_device(monitor, NULL, event->dev); + udev_monitor_unref(monitor); + } else { + char program[UTIL_PATH_SIZE]; + char **envp; + + if (event->exec_delay > 0) { + info(event->udev, "delay execution of '%s'\n", program); + sleep(event->exec_delay); + } + + udev_event_apply_format(event, cmd, program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + if (udev_event_spawn(event, program, envp, sigmask, NULL, 0) < 0) { + if (udev_list_entry_get_num(list_entry)) + err = -1; + } + } + } + return err; } diff --git a/src/udev-node.c b/src/udev-node.c index 31046bd713..8d7db7101b 100644 --- a/src/udev-node.c +++ b/src/udev-node.c @@ -31,355 +31,355 @@ #include "udev.h" -#define TMP_FILE_EXT ".udev-tmp" +#define TMP_FILE_EXT ".udev-tmp" static int node_symlink(struct udev *udev, const char *node, const char *slink) { - struct stat stats; - char target[UTIL_PATH_SIZE]; - char *s; - size_t l; - char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; - int i = 0; - int tail = 0; - int err = 0; - - /* use relative link */ - target[0] = '\0'; - while (node[i] && (node[i] == slink[i])) { - if (node[i] == '/') - tail = i+1; - i++; - } - s = target; - l = sizeof(target); - while (slink[i] != '\0') { - if (slink[i] == '/') - l = util_strpcpy(&s, l, "../"); - i++; - } - l = util_strscpy(s, l, &node[tail]); - if (l == 0) { - err = -EINVAL; - goto exit; - } - - /* preserve link with correct target, do not replace node of other device */ - if (lstat(slink, &stats) == 0) { - if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { - struct stat stats2; - - info(udev, "found existing node instead of symlink '%s'\n", slink); - if (lstat(node, &stats2) == 0) { - if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && - stats.st_rdev == stats2.st_rdev && stats.st_ino != stats2.st_ino) { - info(udev, "replace device node '%s' with symlink to our node '%s'\n", - slink, node); - } else { - err(udev, "device node '%s' already exists, " - "link to '%s' will not overwrite it\n", - slink, node); - goto exit; - } - } - } else if (S_ISLNK(stats.st_mode)) { - char buf[UTIL_PATH_SIZE]; - int len; - - dbg(udev, "found existing symlink '%s'\n", slink); - len = readlink(slink, buf, sizeof(buf)); - if (len > 0 && len < (int)sizeof(buf)) { - buf[len] = '\0'; - if (strcmp(target, buf) == 0) { - info(udev, "preserve already existing symlink '%s' to '%s'\n", - slink, target); - udev_selinux_lsetfilecon(udev, slink, S_IFLNK); - utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); - goto exit; - } - } - } - } else { - info(udev, "creating symlink '%s' to '%s'\n", slink, target); - do { - err = util_create_path_selinux(udev, slink); - if (err != 0 && err != -ENOENT) - break; - udev_selinux_setfscreatecon(udev, slink, S_IFLNK); - err = symlink(target, slink); - if (err != 0) - err = -errno; - udev_selinux_resetfscreatecon(udev); - } while (err == -ENOENT); - if (err == 0) - goto exit; - } - - info(udev, "atomically replace '%s'\n", slink); - util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); - unlink(slink_tmp); - do { - err = util_create_path_selinux(udev, slink_tmp); - if (err != 0 && err != -ENOENT) - break; - udev_selinux_setfscreatecon(udev, slink_tmp, S_IFLNK); - err = symlink(target, slink_tmp); - if (err != 0) - err = -errno; - udev_selinux_resetfscreatecon(udev); - } while (err == -ENOENT); - if (err != 0) { - err(udev, "symlink '%s' '%s' failed: %m\n", target, slink_tmp); - goto exit; - } - err = rename(slink_tmp, slink); - if (err != 0) { - err(udev, "rename '%s' '%s' failed: %m\n", slink_tmp, slink); - unlink(slink_tmp); - } + struct stat stats; + char target[UTIL_PATH_SIZE]; + char *s; + size_t l; + char slink_tmp[UTIL_PATH_SIZE + sizeof(TMP_FILE_EXT)]; + int i = 0; + int tail = 0; + int err = 0; + + /* use relative link */ + target[0] = '\0'; + while (node[i] && (node[i] == slink[i])) { + if (node[i] == '/') + tail = i+1; + i++; + } + s = target; + l = sizeof(target); + while (slink[i] != '\0') { + if (slink[i] == '/') + l = util_strpcpy(&s, l, "../"); + i++; + } + l = util_strscpy(s, l, &node[tail]); + if (l == 0) { + err = -EINVAL; + goto exit; + } + + /* preserve link with correct target, do not replace node of other device */ + if (lstat(slink, &stats) == 0) { + if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { + struct stat stats2; + + info(udev, "found existing node instead of symlink '%s'\n", slink); + if (lstat(node, &stats2) == 0) { + if ((stats.st_mode & S_IFMT) == (stats2.st_mode & S_IFMT) && + stats.st_rdev == stats2.st_rdev && stats.st_ino != stats2.st_ino) { + info(udev, "replace device node '%s' with symlink to our node '%s'\n", + slink, node); + } else { + err(udev, "device node '%s' already exists, " + "link to '%s' will not overwrite it\n", + slink, node); + goto exit; + } + } + } else if (S_ISLNK(stats.st_mode)) { + char buf[UTIL_PATH_SIZE]; + int len; + + dbg(udev, "found existing symlink '%s'\n", slink); + len = readlink(slink, buf, sizeof(buf)); + if (len > 0 && len < (int)sizeof(buf)) { + buf[len] = '\0'; + if (strcmp(target, buf) == 0) { + info(udev, "preserve already existing symlink '%s' to '%s'\n", + slink, target); + udev_selinux_lsetfilecon(udev, slink, S_IFLNK); + utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); + goto exit; + } + } + } + } else { + info(udev, "creating symlink '%s' to '%s'\n", slink, target); + do { + err = util_create_path_selinux(udev, slink); + if (err != 0 && err != -ENOENT) + break; + udev_selinux_setfscreatecon(udev, slink, S_IFLNK); + err = symlink(target, slink); + if (err != 0) + err = -errno; + udev_selinux_resetfscreatecon(udev); + } while (err == -ENOENT); + if (err == 0) + goto exit; + } + + info(udev, "atomically replace '%s'\n", slink); + util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); + unlink(slink_tmp); + do { + err = util_create_path_selinux(udev, slink_tmp); + if (err != 0 && err != -ENOENT) + break; + udev_selinux_setfscreatecon(udev, slink_tmp, S_IFLNK); + err = symlink(target, slink_tmp); + if (err != 0) + err = -errno; + udev_selinux_resetfscreatecon(udev); + } while (err == -ENOENT); + if (err != 0) { + err(udev, "symlink '%s' '%s' failed: %m\n", target, slink_tmp); + goto exit; + } + err = rename(slink_tmp, slink); + if (err != 0) { + err(udev, "rename '%s' '%s' failed: %m\n", slink_tmp, slink); + unlink(slink_tmp); + } exit: - return err; + return err; } /* find device node of device with highest priority */ static const char *link_find_prioritized(struct udev_device *dev, bool add, const char *stackdir, char *buf, size_t bufsize) { - struct udev *udev = udev_device_get_udev(dev); - DIR *dir; - int priority = 0; - const char *target = NULL; - - if (add) { - priority = udev_device_get_devlink_priority(dev); - util_strscpy(buf, bufsize, udev_device_get_devnode(dev)); - target = buf; - } - - dir = opendir(stackdir); - if (dir == NULL) - return target; - for (;;) { - struct udev_device *dev_db; - struct dirent *dent; - - dent = readdir(dir); - if (dent == NULL || dent->d_name[0] == '\0') - break; - if (dent->d_name[0] == '.') - continue; - - info(udev, "found '%s' claiming '%s'\n", dent->d_name, stackdir); - - /* did we find ourself? */ - if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0) - continue; - - dev_db = udev_device_new_from_id_filename(udev, dent->d_name); - if (dev_db != NULL) { - const char *devnode; - - devnode = udev_device_get_devnode(dev_db); - if (devnode != NULL) { - dbg(udev, "compare priority of '%s'(%i) > '%s'(%i)\n", target, priority, - udev_device_get_devnode(dev_db), udev_device_get_devlink_priority(dev_db)); - if (target == NULL || udev_device_get_devlink_priority(dev_db) > priority) { - info(udev, "'%s' claims priority %i for '%s'\n", - udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir); - priority = udev_device_get_devlink_priority(dev_db); - util_strscpy(buf, bufsize, devnode); - target = buf; - } - } - udev_device_unref(dev_db); - } - } - closedir(dir); - return target; + struct udev *udev = udev_device_get_udev(dev); + DIR *dir; + int priority = 0; + const char *target = NULL; + + if (add) { + priority = udev_device_get_devlink_priority(dev); + util_strscpy(buf, bufsize, udev_device_get_devnode(dev)); + target = buf; + } + + dir = opendir(stackdir); + if (dir == NULL) + return target; + for (;;) { + struct udev_device *dev_db; + struct dirent *dent; + + dent = readdir(dir); + if (dent == NULL || dent->d_name[0] == '\0') + break; + if (dent->d_name[0] == '.') + continue; + + info(udev, "found '%s' claiming '%s'\n", dent->d_name, stackdir); + + /* did we find ourself? */ + if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0) + continue; + + dev_db = udev_device_new_from_id_filename(udev, dent->d_name); + if (dev_db != NULL) { + const char *devnode; + + devnode = udev_device_get_devnode(dev_db); + if (devnode != NULL) { + dbg(udev, "compare priority of '%s'(%i) > '%s'(%i)\n", target, priority, + udev_device_get_devnode(dev_db), udev_device_get_devlink_priority(dev_db)); + if (target == NULL || udev_device_get_devlink_priority(dev_db) > priority) { + info(udev, "'%s' claims priority %i for '%s'\n", + udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir); + priority = udev_device_get_devlink_priority(dev_db); + util_strscpy(buf, bufsize, devnode); + target = buf; + } + } + udev_device_unref(dev_db); + } + } + closedir(dir); + return target; } /* manage "stack of names" with possibly specified device priorities */ static void link_update(struct udev_device *dev, const char *slink, bool add) { - struct udev *udev = udev_device_get_udev(dev); - char name_enc[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE * 2]; - char dirname[UTIL_PATH_SIZE]; - const char *target; - char buf[UTIL_PATH_SIZE]; - - dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); - - util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); - util_strscpyl(dirname, sizeof(dirname), udev_get_run_path(udev), "/links/", name_enc, NULL); - util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); - - if (!add) { - dbg(udev, "removing index: '%s'\n", filename); - if (unlink(filename) == 0) - rmdir(dirname); - } - - target = link_find_prioritized(dev, add, dirname, buf, sizeof(buf)); - if (target == NULL) { - info(udev, "no reference left, remove '%s'\n", slink); - if (unlink(slink) == 0) - util_delete_path(udev, slink); - } else { - info(udev, "creating link '%s' to '%s'\n", slink, target); - node_symlink(udev, target, slink); - } - - if (add) { - int err; - - dbg(udev, "creating index: '%s'\n", filename); - do { - int fd; - - err = util_create_path(udev, filename); - if (err != 0 && err != -ENOENT) - break; - fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); - if (fd >= 0) - close(fd); - else - err = -errno; - } while (err == -ENOENT); - } + struct udev *udev = udev_device_get_udev(dev); + char name_enc[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE * 2]; + char dirname[UTIL_PATH_SIZE]; + const char *target; + char buf[UTIL_PATH_SIZE]; + + dbg(udev, "update symlink '%s' of '%s'\n", slink, udev_device_get_syspath(dev)); + + util_path_encode(&slink[strlen(udev_get_dev_path(udev))+1], name_enc, sizeof(name_enc)); + util_strscpyl(dirname, sizeof(dirname), udev_get_run_path(udev), "/links/", name_enc, NULL); + util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); + + if (!add) { + dbg(udev, "removing index: '%s'\n", filename); + if (unlink(filename) == 0) + rmdir(dirname); + } + + target = link_find_prioritized(dev, add, dirname, buf, sizeof(buf)); + if (target == NULL) { + info(udev, "no reference left, remove '%s'\n", slink); + if (unlink(slink) == 0) + util_delete_path(udev, slink); + } else { + info(udev, "creating link '%s' to '%s'\n", slink, target); + node_symlink(udev, target, slink); + } + + if (add) { + int err; + + dbg(udev, "creating index: '%s'\n", filename); + do { + int fd; + + err = util_create_path(udev, filename); + if (err != 0 && err != -ENOENT) + break; + fd = open(filename, O_WRONLY|O_CREAT|O_CLOEXEC|O_TRUNC|O_NOFOLLOW, 0444); + if (fd >= 0) + close(fd); + else + err = -errno; + } while (err == -ENOENT); + } } void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old) { - struct udev *udev = udev_device_get_udev(dev); - struct udev_list_entry *list_entry; - - /* update possible left-over symlinks */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { - const char *name = udev_list_entry_get_name(list_entry); - struct udev_list_entry *list_entry_current; - int found; - - /* check if old link name still belongs to this device */ - found = 0; - udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { - const char *name_current = udev_list_entry_get_name(list_entry_current); - - if (strcmp(name, name_current) == 0) { - found = 1; - break; - } - } - if (found) - continue; - - info(udev, "update old name, '%s' no longer belonging to '%s'\n", - name, udev_device_get_devpath(dev)); - link_update(dev, name, 0); - } + struct udev *udev = udev_device_get_udev(dev); + struct udev_list_entry *list_entry; + + /* update possible left-over symlinks */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev_old)) { + const char *name = udev_list_entry_get_name(list_entry); + struct udev_list_entry *list_entry_current; + int found; + + /* check if old link name still belongs to this device */ + found = 0; + udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { + const char *name_current = udev_list_entry_get_name(list_entry_current); + + if (strcmp(name, name_current) == 0) { + found = 1; + break; + } + } + if (found) + continue; + + info(udev, "update old name, '%s' no longer belonging to '%s'\n", + name, udev_device_get_devpath(dev)); + link_update(dev, name, 0); + } } static int node_fixup(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { - struct udev *udev = udev_device_get_udev(dev); - const char *devnode = udev_device_get_devnode(dev); - dev_t devnum = udev_device_get_devnum(dev); - struct stat stats; - int err = 0; - - if (strcmp(udev_device_get_subsystem(dev), "block") == 0) - mode |= S_IFBLK; - else - mode |= S_IFCHR; - - if (lstat(devnode, &stats) != 0) { - err = -errno; - info(udev, "can not stat() node '%s' (%m)\n", devnode); - goto out; - } - - if (((stats.st_mode & S_IFMT) != (mode & S_IFMT)) || (stats.st_rdev != devnum)) { - err = -EEXIST; - info(udev, "found node '%s' with non-matching devnum %s, skip handling\n", - udev_device_get_devnode(dev), udev_device_get_id_filename(dev)); - goto out; - } - - if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { - info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); - chmod(devnode, mode); - chown(devnode, uid, gid); - } else { - info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); - } - - /* - * Set initial selinux file context only on add events. - * We set the proper context on bootup (triger) or for newly - * added devices, but we don't change it later, in case - * something else has set a custom context in the meantime. - */ - if (strcmp(udev_device_get_action(dev), "add") == 0) - udev_selinux_lsetfilecon(udev, devnode, mode); - - /* always update timestamp when we re-use the node, like on media change events */ - utimensat(AT_FDCWD, devnode, NULL, 0); + struct udev *udev = udev_device_get_udev(dev); + const char *devnode = udev_device_get_devnode(dev); + dev_t devnum = udev_device_get_devnum(dev); + struct stat stats; + int err = 0; + + if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + mode |= S_IFBLK; + else + mode |= S_IFCHR; + + if (lstat(devnode, &stats) != 0) { + err = -errno; + info(udev, "can not stat() node '%s' (%m)\n", devnode); + goto out; + } + + if (((stats.st_mode & S_IFMT) != (mode & S_IFMT)) || (stats.st_rdev != devnum)) { + err = -EEXIST; + info(udev, "found node '%s' with non-matching devnum %s, skip handling\n", + udev_device_get_devnode(dev), udev_device_get_id_filename(dev)); + goto out; + } + + if ((stats.st_mode & 0777) != (mode & 0777) || stats.st_uid != uid || stats.st_gid != gid) { + info(udev, "set permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); + chmod(devnode, mode); + chown(devnode, uid, gid); + } else { + info(udev, "preserve permissions %s, %#o, uid=%u, gid=%u\n", devnode, mode, uid, gid); + } + + /* + * Set initial selinux file context only on add events. + * We set the proper context on bootup (triger) or for newly + * added devices, but we don't change it later, in case + * something else has set a custom context in the meantime. + */ + if (strcmp(udev_device_get_action(dev), "add") == 0) + udev_selinux_lsetfilecon(udev, devnode, mode); + + /* always update timestamp when we re-use the node, like on media change events */ + utimensat(AT_FDCWD, devnode, NULL, 0); out: - return err; + return err; } int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { - struct udev *udev = udev_device_get_udev(dev); - char filename[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - int err = 0; - - info(udev, "handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d\n", - udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid); - - err = node_fixup(dev, mode, uid, gid); - if (err < 0) - goto exit; - - /* always add /dev/{block,char}/$major:$minor */ - snprintf(filename, sizeof(filename), "%s/%s/%u:%u", - udev_get_dev_path(udev), - strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); - node_symlink(udev, udev_device_get_devnode(dev), filename); - - /* create/update symlinks, add symlinks to name index */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { - if (udev_list_entry_get_num(list_entry)) - /* simple unmanaged link name */ - node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry)); - else - link_update(dev, udev_list_entry_get_name(list_entry), 1); - } + struct udev *udev = udev_device_get_udev(dev); + char filename[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + int err = 0; + + info(udev, "handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d\n", + udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid); + + err = node_fixup(dev, mode, uid, gid); + if (err < 0) + goto exit; + + /* always add /dev/{block,char}/$major:$minor */ + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(udev), + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + node_symlink(udev, udev_device_get_devnode(dev), filename); + + /* create/update symlinks, add symlinks to name index */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) { + if (udev_list_entry_get_num(list_entry)) + /* simple unmanaged link name */ + node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry)); + else + link_update(dev, udev_list_entry_get_name(list_entry), 1); + } exit: - return err; + return err; } int udev_node_remove(struct udev_device *dev) { - struct udev *udev = udev_device_get_udev(dev); - struct udev_list_entry *list_entry; - const char *devnode; - struct stat stats; - struct udev_device *dev_check; - char filename[UTIL_PATH_SIZE]; - int err = 0; - - /* remove/update symlinks, remove symlinks from name index */ - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) - link_update(dev, udev_list_entry_get_name(list_entry), 0); - - /* remove /dev/{block,char}/$major:$minor */ - snprintf(filename, sizeof(filename), "%s/%s/%u:%u", - udev_get_dev_path(udev), - strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", - major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); - unlink(filename); + struct udev *udev = udev_device_get_udev(dev); + struct udev_list_entry *list_entry; + const char *devnode; + struct stat stats; + struct udev_device *dev_check; + char filename[UTIL_PATH_SIZE]; + int err = 0; + + /* remove/update symlinks, remove symlinks from name index */ + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) + link_update(dev, udev_list_entry_get_name(list_entry), 0); + + /* remove /dev/{block,char}/$major:$minor */ + snprintf(filename, sizeof(filename), "%s/%s/%u:%u", + udev_get_dev_path(udev), + strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); + unlink(filename); out: - return err; + return err; } diff --git a/src/udev-rules.c b/src/udev-rules.c index 7e79545124..d14a57abc7 100644 --- a/src/udev-rules.c +++ b/src/udev-rules.c @@ -32,408 +32,408 @@ #include "udev.h" -#define PREALLOC_TOKEN 2048 -#define PREALLOC_STRBUF 32 * 1024 -#define PREALLOC_TRIE 256 +#define PREALLOC_TOKEN 2048 +#define PREALLOC_STRBUF 32 * 1024 +#define PREALLOC_TRIE 256 struct uid_gid { - unsigned int name_off; - union { - uid_t uid; - gid_t gid; - }; + unsigned int name_off; + union { + uid_t uid; + gid_t gid; + }; }; struct trie_node { - /* this node's first child */ - unsigned int child_idx; - /* the next child of our parent node's child list */ - unsigned int next_child_idx; - /* this node's last child (shortcut for append) */ - unsigned int last_child_idx; - unsigned int value_off; - unsigned short value_len; - unsigned char key; + /* this node's first child */ + unsigned int child_idx; + /* the next child of our parent node's child list */ + unsigned int next_child_idx; + /* this node's last child (shortcut for append) */ + unsigned int last_child_idx; + unsigned int value_off; + unsigned short value_len; + unsigned char key; }; struct udev_rules { - struct udev *udev; - int resolve_names; - - /* every key in the rules file becomes a token */ - struct token *tokens; - unsigned int token_cur; - unsigned int token_max; - - /* all key strings are copied to a single string buffer */ - char *buf; - size_t buf_cur; - size_t buf_max; - unsigned int buf_count; - - /* during rule parsing, strings are indexed to find duplicates */ - struct trie_node *trie_nodes; - unsigned int trie_nodes_cur; - unsigned int trie_nodes_max; - - /* during rule parsing, uid/gid lookup results are cached */ - struct uid_gid *uids; - unsigned int uids_cur; - unsigned int uids_max; - struct uid_gid *gids; - unsigned int gids_cur; - unsigned int gids_max; + struct udev *udev; + int resolve_names; + + /* every key in the rules file becomes a token */ + struct token *tokens; + unsigned int token_cur; + unsigned int token_max; + + /* all key strings are copied to a single string buffer */ + char *buf; + size_t buf_cur; + size_t buf_max; + unsigned int buf_count; + + /* during rule parsing, strings are indexed to find duplicates */ + struct trie_node *trie_nodes; + unsigned int trie_nodes_cur; + unsigned int trie_nodes_max; + + /* during rule parsing, uid/gid lookup results are cached */ + struct uid_gid *uids; + unsigned int uids_cur; + unsigned int uids_max; + struct uid_gid *gids; + unsigned int gids_cur; + unsigned int gids_max; }; /* KEY=="", KEY!="", KEY+="", KEY="", KEY:="" */ enum operation_type { - OP_UNSET, + OP_UNSET, - OP_MATCH, - OP_NOMATCH, - OP_MATCH_MAX, + OP_MATCH, + OP_NOMATCH, + OP_MATCH_MAX, - OP_ADD, - OP_ASSIGN, - OP_ASSIGN_FINAL, + OP_ADD, + OP_ASSIGN, + OP_ASSIGN_FINAL, }; enum string_glob_type { - GL_UNSET, - GL_PLAIN, /* no special chars */ - GL_GLOB, /* shell globs ?,*,[] */ - GL_SPLIT, /* multi-value A|B */ - GL_SPLIT_GLOB, /* multi-value with glob A*|B* */ - GL_SOMETHING, /* commonly used "?*" */ + GL_UNSET, + GL_PLAIN, /* no special chars */ + GL_GLOB, /* shell globs ?,*,[] */ + GL_SPLIT, /* multi-value A|B */ + GL_SPLIT_GLOB, /* multi-value with glob A*|B* */ + GL_SOMETHING, /* commonly used "?*" */ }; enum string_subst_type { - SB_UNSET, - SB_NONE, - SB_FORMAT, - SB_SUBSYS, + SB_UNSET, + SB_NONE, + SB_FORMAT, + SB_SUBSYS, }; /* tokens of a rule are sorted/handled in this order */ enum token_type { - TK_UNSET, - TK_RULE, - - TK_M_ACTION, /* val */ - TK_M_DEVPATH, /* val */ - TK_M_KERNEL, /* val */ - TK_M_DEVLINK, /* val */ - TK_M_NAME, /* val */ - TK_M_ENV, /* val, attr */ - TK_M_TAG, /* val */ - TK_M_SUBSYSTEM, /* val */ - TK_M_DRIVER, /* val */ - TK_M_WAITFOR, /* val */ - TK_M_ATTR, /* val, attr */ - - TK_M_PARENTS_MIN, - TK_M_KERNELS, /* val */ - TK_M_SUBSYSTEMS, /* val */ - TK_M_DRIVERS, /* val */ - TK_M_ATTRS, /* val, attr */ - TK_M_TAGS, /* val */ - TK_M_PARENTS_MAX, - - TK_M_TEST, /* val, mode_t */ - TK_M_EVENT_TIMEOUT, /* int */ - TK_M_PROGRAM, /* val */ - TK_M_IMPORT_FILE, /* val */ - TK_M_IMPORT_PROG, /* val */ - TK_M_IMPORT_BUILTIN, /* val */ - TK_M_IMPORT_DB, /* val */ - TK_M_IMPORT_CMDLINE, /* val */ - TK_M_IMPORT_PARENT, /* val */ - TK_M_RESULT, /* val */ - TK_M_MAX, - - TK_A_STRING_ESCAPE_NONE, - TK_A_STRING_ESCAPE_REPLACE, - TK_A_DB_PERSIST, - TK_A_INOTIFY_WATCH, /* int */ - TK_A_DEVLINK_PRIO, /* int */ - TK_A_OWNER, /* val */ - TK_A_GROUP, /* val */ - TK_A_MODE, /* val */ - TK_A_OWNER_ID, /* uid_t */ - TK_A_GROUP_ID, /* gid_t */ - TK_A_MODE_ID, /* mode_t */ - TK_A_STATIC_NODE, /* val */ - TK_A_ENV, /* val, attr */ - TK_A_TAG, /* val */ - TK_A_NAME, /* val */ - TK_A_DEVLINK, /* val */ - TK_A_ATTR, /* val, attr */ - TK_A_RUN, /* val, bool */ - TK_A_GOTO, /* size_t */ - - TK_END, + TK_UNSET, + TK_RULE, + + TK_M_ACTION, /* val */ + TK_M_DEVPATH, /* val */ + TK_M_KERNEL, /* val */ + TK_M_DEVLINK, /* val */ + TK_M_NAME, /* val */ + TK_M_ENV, /* val, attr */ + TK_M_TAG, /* val */ + TK_M_SUBSYSTEM, /* val */ + TK_M_DRIVER, /* val */ + TK_M_WAITFOR, /* val */ + TK_M_ATTR, /* val, attr */ + + TK_M_PARENTS_MIN, + TK_M_KERNELS, /* val */ + TK_M_SUBSYSTEMS, /* val */ + TK_M_DRIVERS, /* val */ + TK_M_ATTRS, /* val, attr */ + TK_M_TAGS, /* val */ + TK_M_PARENTS_MAX, + + TK_M_TEST, /* val, mode_t */ + TK_M_EVENT_TIMEOUT, /* int */ + TK_M_PROGRAM, /* val */ + TK_M_IMPORT_FILE, /* val */ + TK_M_IMPORT_PROG, /* val */ + TK_M_IMPORT_BUILTIN, /* val */ + TK_M_IMPORT_DB, /* val */ + TK_M_IMPORT_CMDLINE, /* val */ + TK_M_IMPORT_PARENT, /* val */ + TK_M_RESULT, /* val */ + TK_M_MAX, + + TK_A_STRING_ESCAPE_NONE, + TK_A_STRING_ESCAPE_REPLACE, + TK_A_DB_PERSIST, + TK_A_INOTIFY_WATCH, /* int */ + TK_A_DEVLINK_PRIO, /* int */ + TK_A_OWNER, /* val */ + TK_A_GROUP, /* val */ + TK_A_MODE, /* val */ + TK_A_OWNER_ID, /* uid_t */ + TK_A_GROUP_ID, /* gid_t */ + TK_A_MODE_ID, /* mode_t */ + TK_A_STATIC_NODE, /* val */ + TK_A_ENV, /* val, attr */ + TK_A_TAG, /* val */ + TK_A_NAME, /* val */ + TK_A_DEVLINK, /* val */ + TK_A_ATTR, /* val, attr */ + TK_A_RUN, /* val, bool */ + TK_A_GOTO, /* size_t */ + + TK_END, }; /* we try to pack stuff in a way that we take only 12 bytes per token */ struct token { - union { - unsigned char type; /* same in rule and key */ - struct { - enum token_type type:8; - bool can_set_name:1; - bool has_static_node:1; - unsigned int unused:6; - unsigned short token_count; - unsigned int label_off; - unsigned short filename_off; - unsigned short filename_line; - } rule; - struct { - enum token_type type:8; - enum operation_type op:8; - enum string_glob_type glob:8; - enum string_subst_type subst:4; - enum string_subst_type attrsubst:4; - unsigned int value_off; - union { - unsigned int attr_off; - int devlink_unique; - unsigned int rule_goto; - mode_t mode; - uid_t uid; - gid_t gid; - int devlink_prio; - int event_timeout; - int watch; - enum udev_builtin_cmd builtin_cmd; - }; - } key; - }; + union { + unsigned char type; /* same in rule and key */ + struct { + enum token_type type:8; + bool can_set_name:1; + bool has_static_node:1; + unsigned int unused:6; + unsigned short token_count; + unsigned int label_off; + unsigned short filename_off; + unsigned short filename_line; + } rule; + struct { + enum token_type type:8; + enum operation_type op:8; + enum string_glob_type glob:8; + enum string_subst_type subst:4; + enum string_subst_type attrsubst:4; + unsigned int value_off; + union { + unsigned int attr_off; + int devlink_unique; + unsigned int rule_goto; + mode_t mode; + uid_t uid; + gid_t gid; + int devlink_prio; + int event_timeout; + int watch; + enum udev_builtin_cmd builtin_cmd; + }; + } key; + }; }; -#define MAX_TK 64 +#define MAX_TK 64 struct rule_tmp { - struct udev_rules *rules; - struct token rule; - struct token token[MAX_TK]; - unsigned int token_cur; + struct udev_rules *rules; + struct token rule; + struct token token[MAX_TK]; + unsigned int token_cur; }; #ifdef ENABLE_DEBUG static const char *operation_str(enum operation_type type) { - static const char *operation_strs[] = { - [OP_UNSET] = "UNSET", - [OP_MATCH] = "match", - [OP_NOMATCH] = "nomatch", - [OP_MATCH_MAX] = "MATCH_MAX", - - [OP_ADD] = "add", - [OP_ASSIGN] = "assign", - [OP_ASSIGN_FINAL] = "assign-final", -} ; - - return operation_strs[type]; + static const char *operation_strs[] = { + [OP_UNSET] = "UNSET", + [OP_MATCH] = "match", + [OP_NOMATCH] = "nomatch", + [OP_MATCH_MAX] = "MATCH_MAX", + + [OP_ADD] = "add", + [OP_ASSIGN] = "assign", + [OP_ASSIGN_FINAL] = "assign-final", +} ; + + return operation_strs[type]; } static const char *string_glob_str(enum string_glob_type type) { - static const char *string_glob_strs[] = { - [GL_UNSET] = "UNSET", - [GL_PLAIN] = "plain", - [GL_GLOB] = "glob", - [GL_SPLIT] = "split", - [GL_SPLIT_GLOB] = "split-glob", - [GL_SOMETHING] = "split-glob", - }; - - return string_glob_strs[type]; + static const char *string_glob_strs[] = { + [GL_UNSET] = "UNSET", + [GL_PLAIN] = "plain", + [GL_GLOB] = "glob", + [GL_SPLIT] = "split", + [GL_SPLIT_GLOB] = "split-glob", + [GL_SOMETHING] = "split-glob", + }; + + return string_glob_strs[type]; } static const char *token_str(enum token_type type) { - static const char *token_strs[] = { - [TK_UNSET] = "UNSET", - [TK_RULE] = "RULE", - - [TK_M_ACTION] = "M ACTION", - [TK_M_DEVPATH] = "M DEVPATH", - [TK_M_KERNEL] = "M KERNEL", - [TK_M_DEVLINK] = "M DEVLINK", - [TK_M_NAME] = "M NAME", - [TK_M_ENV] = "M ENV", - [TK_M_TAG] = "M TAG", - [TK_M_SUBSYSTEM] = "M SUBSYSTEM", - [TK_M_DRIVER] = "M DRIVER", - [TK_M_WAITFOR] = "M WAITFOR", - [TK_M_ATTR] = "M ATTR", - - [TK_M_PARENTS_MIN] = "M PARENTS_MIN", - [TK_M_KERNELS] = "M KERNELS", - [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", - [TK_M_DRIVERS] = "M DRIVERS", - [TK_M_ATTRS] = "M ATTRS", - [TK_M_TAGS] = "M TAGS", - [TK_M_PARENTS_MAX] = "M PARENTS_MAX", - - [TK_M_TEST] = "M TEST", - [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", - [TK_M_PROGRAM] = "M PROGRAM", - [TK_M_IMPORT_FILE] = "M IMPORT_FILE", - [TK_M_IMPORT_PROG] = "M IMPORT_PROG", - [TK_M_IMPORT_BUILTIN] = "M IMPORT_BUILTIN", - [TK_M_IMPORT_DB] = "M IMPORT_DB", - [TK_M_IMPORT_CMDLINE] = "M IMPORT_CMDLINE", - [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", - [TK_M_RESULT] = "M RESULT", - [TK_M_MAX] = "M MAX", - - [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", - [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", - [TK_A_DB_PERSIST] = "A DB_PERSIST", - [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", - [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", - [TK_A_OWNER] = "A OWNER", - [TK_A_GROUP] = "A GROUP", - [TK_A_MODE] = "A MODE", - [TK_A_OWNER_ID] = "A OWNER_ID", - [TK_A_GROUP_ID] = "A GROUP_ID", - [TK_A_STATIC_NODE] = "A STATIC_NODE", - [TK_A_MODE_ID] = "A MODE_ID", - [TK_A_ENV] = "A ENV", - [TK_A_TAG] = "A ENV", - [TK_A_NAME] = "A NAME", - [TK_A_DEVLINK] = "A DEVLINK", - [TK_A_ATTR] = "A ATTR", - [TK_A_RUN] = "A RUN", - [TK_A_GOTO] = "A GOTO", - - [TK_END] = "END", - }; - - return token_strs[type]; + static const char *token_strs[] = { + [TK_UNSET] = "UNSET", + [TK_RULE] = "RULE", + + [TK_M_ACTION] = "M ACTION", + [TK_M_DEVPATH] = "M DEVPATH", + [TK_M_KERNEL] = "M KERNEL", + [TK_M_DEVLINK] = "M DEVLINK", + [TK_M_NAME] = "M NAME", + [TK_M_ENV] = "M ENV", + [TK_M_TAG] = "M TAG", + [TK_M_SUBSYSTEM] = "M SUBSYSTEM", + [TK_M_DRIVER] = "M DRIVER", + [TK_M_WAITFOR] = "M WAITFOR", + [TK_M_ATTR] = "M ATTR", + + [TK_M_PARENTS_MIN] = "M PARENTS_MIN", + [TK_M_KERNELS] = "M KERNELS", + [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", + [TK_M_DRIVERS] = "M DRIVERS", + [TK_M_ATTRS] = "M ATTRS", + [TK_M_TAGS] = "M TAGS", + [TK_M_PARENTS_MAX] = "M PARENTS_MAX", + + [TK_M_TEST] = "M TEST", + [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", + [TK_M_PROGRAM] = "M PROGRAM", + [TK_M_IMPORT_FILE] = "M IMPORT_FILE", + [TK_M_IMPORT_PROG] = "M IMPORT_PROG", + [TK_M_IMPORT_BUILTIN] = "M IMPORT_BUILTIN", + [TK_M_IMPORT_DB] = "M IMPORT_DB", + [TK_M_IMPORT_CMDLINE] = "M IMPORT_CMDLINE", + [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", + [TK_M_RESULT] = "M RESULT", + [TK_M_MAX] = "M MAX", + + [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", + [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", + [TK_A_DB_PERSIST] = "A DB_PERSIST", + [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", + [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", + [TK_A_OWNER] = "A OWNER", + [TK_A_GROUP] = "A GROUP", + [TK_A_MODE] = "A MODE", + [TK_A_OWNER_ID] = "A OWNER_ID", + [TK_A_GROUP_ID] = "A GROUP_ID", + [TK_A_STATIC_NODE] = "A STATIC_NODE", + [TK_A_MODE_ID] = "A MODE_ID", + [TK_A_ENV] = "A ENV", + [TK_A_TAG] = "A ENV", + [TK_A_NAME] = "A NAME", + [TK_A_DEVLINK] = "A DEVLINK", + [TK_A_ATTR] = "A ATTR", + [TK_A_RUN] = "A RUN", + [TK_A_GOTO] = "A GOTO", + + [TK_END] = "END", + }; + + return token_strs[type]; } static void dump_token(struct udev_rules *rules, struct token *token) { - enum token_type type = token->type; - enum operation_type op = token->key.op; - enum string_glob_type glob = token->key.glob; - const char *value = &rules->buf[token->key.value_off]; - const char *attr = &rules->buf[token->key.attr_off]; - - switch (type) { - case TK_RULE: - { - const char *tks_ptr = (char *)rules->tokens; - const char *tk_ptr = (char *)token; - unsigned int idx = (tk_ptr - tks_ptr) / sizeof(struct token); - - dbg(rules->udev, "* RULE %s:%u, token: %u, count: %u, label: '%s'\n", - &rules->buf[token->rule.filename_off], token->rule.filename_line, - idx, token->rule.token_count, - &rules->buf[token->rule.label_off]); - break; - } - case TK_M_ACTION: - case TK_M_DEVPATH: - case TK_M_KERNEL: - case TK_M_SUBSYSTEM: - case TK_M_DRIVER: - case TK_M_WAITFOR: - case TK_M_DEVLINK: - case TK_M_NAME: - case TK_M_KERNELS: - case TK_M_SUBSYSTEMS: - case TK_M_DRIVERS: - case TK_M_TAGS: - case TK_M_PROGRAM: - case TK_M_IMPORT_FILE: - case TK_M_IMPORT_PROG: - case TK_M_IMPORT_DB: - case TK_M_IMPORT_CMDLINE: - case TK_M_IMPORT_PARENT: - case TK_M_RESULT: - case TK_A_NAME: - case TK_A_DEVLINK: - case TK_A_OWNER: - case TK_A_GROUP: - case TK_A_MODE: - case TK_A_RUN: - dbg(rules->udev, "%s %s '%s'(%s)\n", - token_str(type), operation_str(op), value, string_glob_str(glob)); - break; - case TK_M_IMPORT_BUILTIN: - dbg(rules->udev, "%s %i '%s'\n", token_str(type), token->key.builtin_cmd, value); - break; - case TK_M_ATTR: - case TK_M_ATTRS: - case TK_M_ENV: - case TK_A_ATTR: - case TK_A_ENV: - dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", - token_str(type), operation_str(op), attr, value, string_glob_str(glob)); - break; - case TK_M_TAG: - case TK_A_TAG: - dbg(rules->udev, "%s %s '%s'\n", token_str(type), operation_str(op), value); - break; - case TK_A_STRING_ESCAPE_NONE: - case TK_A_STRING_ESCAPE_REPLACE: - case TK_A_DB_PERSIST: - dbg(rules->udev, "%s\n", token_str(type)); - break; - case TK_M_TEST: - dbg(rules->udev, "%s %s '%s'(%s) %#o\n", - token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode); - break; - case TK_A_INOTIFY_WATCH: - dbg(rules->udev, "%s %u\n", token_str(type), token->key.watch); - break; - case TK_A_DEVLINK_PRIO: - dbg(rules->udev, "%s %u\n", token_str(type), token->key.devlink_prio); - break; - case TK_A_OWNER_ID: - dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.uid); - break; - case TK_A_GROUP_ID: - dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.gid); - break; - case TK_A_MODE_ID: - dbg(rules->udev, "%s %s %#o\n", token_str(type), operation_str(op), token->key.mode); - break; - case TK_A_STATIC_NODE: - dbg(rules->udev, "%s '%s'\n", token_str(type), value); - break; - case TK_M_EVENT_TIMEOUT: - dbg(rules->udev, "%s %u\n", token_str(type), token->key.event_timeout); - break; - case TK_A_GOTO: - dbg(rules->udev, "%s '%s' %u\n", token_str(type), value, token->key.rule_goto); - break; - case TK_END: - dbg(rules->udev, "* %s\n", token_str(type)); - break; - case TK_M_PARENTS_MIN: - case TK_M_PARENTS_MAX: - case TK_M_MAX: - case TK_UNSET: - dbg(rules->udev, "unknown type %u\n", type); - break; - } + enum token_type type = token->type; + enum operation_type op = token->key.op; + enum string_glob_type glob = token->key.glob; + const char *value = &rules->buf[token->key.value_off]; + const char *attr = &rules->buf[token->key.attr_off]; + + switch (type) { + case TK_RULE: + { + const char *tks_ptr = (char *)rules->tokens; + const char *tk_ptr = (char *)token; + unsigned int idx = (tk_ptr - tks_ptr) / sizeof(struct token); + + dbg(rules->udev, "* RULE %s:%u, token: %u, count: %u, label: '%s'\n", + &rules->buf[token->rule.filename_off], token->rule.filename_line, + idx, token->rule.token_count, + &rules->buf[token->rule.label_off]); + break; + } + case TK_M_ACTION: + case TK_M_DEVPATH: + case TK_M_KERNEL: + case TK_M_SUBSYSTEM: + case TK_M_DRIVER: + case TK_M_WAITFOR: + case TK_M_DEVLINK: + case TK_M_NAME: + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_TAGS: + case TK_M_PROGRAM: + case TK_M_IMPORT_FILE: + case TK_M_IMPORT_PROG: + case TK_M_IMPORT_DB: + case TK_M_IMPORT_CMDLINE: + case TK_M_IMPORT_PARENT: + case TK_M_RESULT: + case TK_A_NAME: + case TK_A_DEVLINK: + case TK_A_OWNER: + case TK_A_GROUP: + case TK_A_MODE: + case TK_A_RUN: + dbg(rules->udev, "%s %s '%s'(%s)\n", + token_str(type), operation_str(op), value, string_glob_str(glob)); + break; + case TK_M_IMPORT_BUILTIN: + dbg(rules->udev, "%s %i '%s'\n", token_str(type), token->key.builtin_cmd, value); + break; + case TK_M_ATTR: + case TK_M_ATTRS: + case TK_M_ENV: + case TK_A_ATTR: + case TK_A_ENV: + dbg(rules->udev, "%s %s '%s' '%s'(%s)\n", + token_str(type), operation_str(op), attr, value, string_glob_str(glob)); + break; + case TK_M_TAG: + case TK_A_TAG: + dbg(rules->udev, "%s %s '%s'\n", token_str(type), operation_str(op), value); + break; + case TK_A_STRING_ESCAPE_NONE: + case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_DB_PERSIST: + dbg(rules->udev, "%s\n", token_str(type)); + break; + case TK_M_TEST: + dbg(rules->udev, "%s %s '%s'(%s) %#o\n", + token_str(type), operation_str(op), value, string_glob_str(glob), token->key.mode); + break; + case TK_A_INOTIFY_WATCH: + dbg(rules->udev, "%s %u\n", token_str(type), token->key.watch); + break; + case TK_A_DEVLINK_PRIO: + dbg(rules->udev, "%s %u\n", token_str(type), token->key.devlink_prio); + break; + case TK_A_OWNER_ID: + dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.uid); + break; + case TK_A_GROUP_ID: + dbg(rules->udev, "%s %s %u\n", token_str(type), operation_str(op), token->key.gid); + break; + case TK_A_MODE_ID: + dbg(rules->udev, "%s %s %#o\n", token_str(type), operation_str(op), token->key.mode); + break; + case TK_A_STATIC_NODE: + dbg(rules->udev, "%s '%s'\n", token_str(type), value); + break; + case TK_M_EVENT_TIMEOUT: + dbg(rules->udev, "%s %u\n", token_str(type), token->key.event_timeout); + break; + case TK_A_GOTO: + dbg(rules->udev, "%s '%s' %u\n", token_str(type), value, token->key.rule_goto); + break; + case TK_END: + dbg(rules->udev, "* %s\n", token_str(type)); + break; + case TK_M_PARENTS_MIN: + case TK_M_PARENTS_MAX: + case TK_M_MAX: + case TK_UNSET: + dbg(rules->udev, "unknown type %u\n", type); + break; + } } static void dump_rules(struct udev_rules *rules) { - unsigned int i; - - dbg(rules->udev, "dumping %u (%zu bytes) tokens, %u (%zu bytes) strings\n", - rules->token_cur, - rules->token_cur * sizeof(struct token), - rules->buf_count, - rules->buf_cur); - for(i = 0; i < rules->token_cur; i++) - dump_token(rules, &rules->tokens[i]); + unsigned int i; + + dbg(rules->udev, "dumping %u (%zu bytes) tokens, %u (%zu bytes) strings\n", + rules->token_cur, + rules->token_cur * sizeof(struct token), + rules->buf_count, + rules->buf_cur); + for(i = 0; i < rules->token_cur; i++) + dump_token(rules, &rules->tokens[i]); } #else static inline const char *operation_str(enum operation_type type) { return NULL; } @@ -444,2310 +444,2310 @@ static inline void dump_rules(struct udev_rules *rules) {} static int add_new_string(struct udev_rules *rules, const char *str, size_t bytes) { - int off; - - /* grow buffer if needed */ - if (rules->buf_cur + bytes+1 >= rules->buf_max) { - char *buf; - unsigned int add; - - /* double the buffer size */ - add = rules->buf_max; - if (add < bytes * 8) - add = bytes * 8; - - buf = realloc(rules->buf, rules->buf_max + add); - if (buf == NULL) - return -1; - dbg(rules->udev, "extend buffer from %zu to %zu\n", rules->buf_max, rules->buf_max + add); - rules->buf = buf; - rules->buf_max += add; - } - off = rules->buf_cur; - memcpy(&rules->buf[rules->buf_cur], str, bytes); - rules->buf_cur += bytes; - rules->buf_count++; - return off; + int off; + + /* grow buffer if needed */ + if (rules->buf_cur + bytes+1 >= rules->buf_max) { + char *buf; + unsigned int add; + + /* double the buffer size */ + add = rules->buf_max; + if (add < bytes * 8) + add = bytes * 8; + + buf = realloc(rules->buf, rules->buf_max + add); + if (buf == NULL) + return -1; + dbg(rules->udev, "extend buffer from %zu to %zu\n", rules->buf_max, rules->buf_max + add); + rules->buf = buf; + rules->buf_max += add; + } + off = rules->buf_cur; + memcpy(&rules->buf[rules->buf_cur], str, bytes); + rules->buf_cur += bytes; + rules->buf_count++; + return off; } static int add_string(struct udev_rules *rules, const char *str) { - unsigned int node_idx; - struct trie_node *new_node; - unsigned int new_node_idx; - unsigned char key; - unsigned short len; - unsigned int depth; - unsigned int off; - struct trie_node *parent; - - /* walk trie, start from last character of str to find matching tails */ - len = strlen(str); - key = str[len-1]; - node_idx = 0; - for (depth = 0; depth <= len; depth++) { - struct trie_node *node; - unsigned int child_idx; - - node = &rules->trie_nodes[node_idx]; - off = node->value_off + node->value_len - len; - - /* match against current node */ - if (depth == len || (node->value_len >= len && memcmp(&rules->buf[off], str, len) == 0)) - return off; - - /* lookup child node */ - key = str[len - 1 - depth]; - child_idx = node->child_idx; - while (child_idx > 0) { - struct trie_node *child; - - child = &rules->trie_nodes[child_idx]; - if (child->key == key) - break; - child_idx = child->next_child_idx; - } - if (child_idx == 0) - break; - node_idx = child_idx; - } - - /* string not found, add it */ - off = add_new_string(rules, str, len + 1); - - /* grow trie nodes if needed */ - if (rules->trie_nodes_cur >= rules->trie_nodes_max) { - struct trie_node *nodes; - unsigned int add; - - /* double the buffer size */ - add = rules->trie_nodes_max; - if (add < 8) - add = 8; - - nodes = realloc(rules->trie_nodes, (rules->trie_nodes_max + add) * sizeof(struct trie_node)); - if (nodes == NULL) - return -1; - dbg(rules->udev, "extend trie nodes from %u to %u\n", - rules->trie_nodes_max, rules->trie_nodes_max + add); - rules->trie_nodes = nodes; - rules->trie_nodes_max += add; - } - - /* get a new node */ - new_node_idx = rules->trie_nodes_cur; - rules->trie_nodes_cur++; - new_node = &rules->trie_nodes[new_node_idx]; - memset(new_node, 0x00, sizeof(struct trie_node)); - new_node->value_off = off; - new_node->value_len = len; - new_node->key = key; - - /* join the parent's child list */ - parent = &rules->trie_nodes[node_idx]; - if (parent->child_idx == 0) { - parent->child_idx = new_node_idx; - } else { - struct trie_node *last_child; - - last_child = &rules->trie_nodes[parent->last_child_idx]; - last_child->next_child_idx = new_node_idx; - } - parent->last_child_idx = new_node_idx; - return off; + unsigned int node_idx; + struct trie_node *new_node; + unsigned int new_node_idx; + unsigned char key; + unsigned short len; + unsigned int depth; + unsigned int off; + struct trie_node *parent; + + /* walk trie, start from last character of str to find matching tails */ + len = strlen(str); + key = str[len-1]; + node_idx = 0; + for (depth = 0; depth <= len; depth++) { + struct trie_node *node; + unsigned int child_idx; + + node = &rules->trie_nodes[node_idx]; + off = node->value_off + node->value_len - len; + + /* match against current node */ + if (depth == len || (node->value_len >= len && memcmp(&rules->buf[off], str, len) == 0)) + return off; + + /* lookup child node */ + key = str[len - 1 - depth]; + child_idx = node->child_idx; + while (child_idx > 0) { + struct trie_node *child; + + child = &rules->trie_nodes[child_idx]; + if (child->key == key) + break; + child_idx = child->next_child_idx; + } + if (child_idx == 0) + break; + node_idx = child_idx; + } + + /* string not found, add it */ + off = add_new_string(rules, str, len + 1); + + /* grow trie nodes if needed */ + if (rules->trie_nodes_cur >= rules->trie_nodes_max) { + struct trie_node *nodes; + unsigned int add; + + /* double the buffer size */ + add = rules->trie_nodes_max; + if (add < 8) + add = 8; + + nodes = realloc(rules->trie_nodes, (rules->trie_nodes_max + add) * sizeof(struct trie_node)); + if (nodes == NULL) + return -1; + dbg(rules->udev, "extend trie nodes from %u to %u\n", + rules->trie_nodes_max, rules->trie_nodes_max + add); + rules->trie_nodes = nodes; + rules->trie_nodes_max += add; + } + + /* get a new node */ + new_node_idx = rules->trie_nodes_cur; + rules->trie_nodes_cur++; + new_node = &rules->trie_nodes[new_node_idx]; + memset(new_node, 0x00, sizeof(struct trie_node)); + new_node->value_off = off; + new_node->value_len = len; + new_node->key = key; + + /* join the parent's child list */ + parent = &rules->trie_nodes[node_idx]; + if (parent->child_idx == 0) { + parent->child_idx = new_node_idx; + } else { + struct trie_node *last_child; + + last_child = &rules->trie_nodes[parent->last_child_idx]; + last_child->next_child_idx = new_node_idx; + } + parent->last_child_idx = new_node_idx; + return off; } static int add_token(struct udev_rules *rules, struct token *token) { - /* grow buffer if needed */ - if (rules->token_cur+1 >= rules->token_max) { - struct token *tokens; - unsigned int add; - - /* double the buffer size */ - add = rules->token_max; - if (add < 8) - add = 8; - - tokens = realloc(rules->tokens, (rules->token_max + add ) * sizeof(struct token)); - if (tokens == NULL) - return -1; - dbg(rules->udev, "extend tokens from %u to %u\n", rules->token_max, rules->token_max + add); - rules->tokens = tokens; - rules->token_max += add; - } - memcpy(&rules->tokens[rules->token_cur], token, sizeof(struct token)); - rules->token_cur++; - return 0; + /* grow buffer if needed */ + if (rules->token_cur+1 >= rules->token_max) { + struct token *tokens; + unsigned int add; + + /* double the buffer size */ + add = rules->token_max; + if (add < 8) + add = 8; + + tokens = realloc(rules->tokens, (rules->token_max + add ) * sizeof(struct token)); + if (tokens == NULL) + return -1; + dbg(rules->udev, "extend tokens from %u to %u\n", rules->token_max, rules->token_max + add); + rules->tokens = tokens; + rules->token_max += add; + } + memcpy(&rules->tokens[rules->token_cur], token, sizeof(struct token)); + rules->token_cur++; + return 0; } static uid_t add_uid(struct udev_rules *rules, const char *owner) { - unsigned int i; - uid_t uid; - unsigned int off; - - /* lookup, if we know it already */ - for (i = 0; i < rules->uids_cur; i++) { - off = rules->uids[i].name_off; - if (strcmp(&rules->buf[off], owner) == 0) { - uid = rules->uids[i].uid; - dbg(rules->udev, "return existing %u for '%s'\n", uid, owner); - return uid; - } - } - uid = util_lookup_user(rules->udev, owner); - - /* grow buffer if needed */ - if (rules->uids_cur+1 >= rules->uids_max) { - struct uid_gid *uids; - unsigned int add; - - /* double the buffer size */ - add = rules->uids_max; - if (add < 1) - add = 8; - - uids = realloc(rules->uids, (rules->uids_max + add ) * sizeof(struct uid_gid)); - if (uids == NULL) - return uid; - dbg(rules->udev, "extend uids from %u to %u\n", rules->uids_max, rules->uids_max + add); - rules->uids = uids; - rules->uids_max += add; - } - rules->uids[rules->uids_cur].uid = uid; - off = add_string(rules, owner); - if (off <= 0) - return uid; - rules->uids[rules->uids_cur].name_off = off; - rules->uids_cur++; - return uid; + unsigned int i; + uid_t uid; + unsigned int off; + + /* lookup, if we know it already */ + for (i = 0; i < rules->uids_cur; i++) { + off = rules->uids[i].name_off; + if (strcmp(&rules->buf[off], owner) == 0) { + uid = rules->uids[i].uid; + dbg(rules->udev, "return existing %u for '%s'\n", uid, owner); + return uid; + } + } + uid = util_lookup_user(rules->udev, owner); + + /* grow buffer if needed */ + if (rules->uids_cur+1 >= rules->uids_max) { + struct uid_gid *uids; + unsigned int add; + + /* double the buffer size */ + add = rules->uids_max; + if (add < 1) + add = 8; + + uids = realloc(rules->uids, (rules->uids_max + add ) * sizeof(struct uid_gid)); + if (uids == NULL) + return uid; + dbg(rules->udev, "extend uids from %u to %u\n", rules->uids_max, rules->uids_max + add); + rules->uids = uids; + rules->uids_max += add; + } + rules->uids[rules->uids_cur].uid = uid; + off = add_string(rules, owner); + if (off <= 0) + return uid; + rules->uids[rules->uids_cur].name_off = off; + rules->uids_cur++; + return uid; } static gid_t add_gid(struct udev_rules *rules, const char *group) { - unsigned int i; - gid_t gid; - unsigned int off; - - /* lookup, if we know it already */ - for (i = 0; i < rules->gids_cur; i++) { - off = rules->gids[i].name_off; - if (strcmp(&rules->buf[off], group) == 0) { - gid = rules->gids[i].gid; - dbg(rules->udev, "return existing %u for '%s'\n", gid, group); - return gid; - } - } - gid = util_lookup_group(rules->udev, group); - - /* grow buffer if needed */ - if (rules->gids_cur+1 >= rules->gids_max) { - struct uid_gid *gids; - unsigned int add; - - /* double the buffer size */ - add = rules->gids_max; - if (add < 1) - add = 8; - - gids = realloc(rules->gids, (rules->gids_max + add ) * sizeof(struct uid_gid)); - if (gids == NULL) - return gid; - dbg(rules->udev, "extend gids from %u to %u\n", rules->gids_max, rules->gids_max + add); - rules->gids = gids; - rules->gids_max += add; - } - rules->gids[rules->gids_cur].gid = gid; - off = add_string(rules, group); - if (off <= 0) - return gid; - rules->gids[rules->gids_cur].name_off = off; - rules->gids_cur++; - return gid; + unsigned int i; + gid_t gid; + unsigned int off; + + /* lookup, if we know it already */ + for (i = 0; i < rules->gids_cur; i++) { + off = rules->gids[i].name_off; + if (strcmp(&rules->buf[off], group) == 0) { + gid = rules->gids[i].gid; + dbg(rules->udev, "return existing %u for '%s'\n", gid, group); + return gid; + } + } + gid = util_lookup_group(rules->udev, group); + + /* grow buffer if needed */ + if (rules->gids_cur+1 >= rules->gids_max) { + struct uid_gid *gids; + unsigned int add; + + /* double the buffer size */ + add = rules->gids_max; + if (add < 1) + add = 8; + + gids = realloc(rules->gids, (rules->gids_max + add ) * sizeof(struct uid_gid)); + if (gids == NULL) + return gid; + dbg(rules->udev, "extend gids from %u to %u\n", rules->gids_max, rules->gids_max + add); + rules->gids = gids; + rules->gids_max += add; + } + rules->gids[rules->gids_cur].gid = gid; + off = add_string(rules, group); + if (off <= 0) + return gid; + rules->gids[rules->gids_cur].name_off = off; + rules->gids_cur++; + return gid; } static int import_property_from_string(struct udev_device *dev, char *line) { - struct udev *udev = udev_device_get_udev(dev); - char *key; - char *val; - size_t len; - - /* find key */ - key = line; - while (isspace(key[0])) - key++; - - /* comment or empty line */ - if (key[0] == '#' || key[0] == '\0') - return -1; - - /* split key/value */ - val = strchr(key, '='); - if (val == NULL) - return -1; - val[0] = '\0'; - val++; - - /* find value */ - while (isspace(val[0])) - val++; - - /* terminate key */ - len = strlen(key); - if (len == 0) - return -1; - while (isspace(key[len-1])) - len--; - key[len] = '\0'; - - /* terminate value */ - len = strlen(val); - if (len == 0) - return -1; - while (isspace(val[len-1])) - len--; - val[len] = '\0'; - - if (len == 0) - return -1; - - /* unquote */ - if (val[0] == '"' || val[0] == '\'') { - if (val[len-1] != val[0]) { - info(udev, "inconsistent quoting: '%s', skip\n", line); - return -1; - } - val[len-1] = '\0'; - val++; - } - - dbg(udev, "adding '%s'='%s'\n", key, val); - - /* handle device, renamed by external tool, returning new path */ - if (strcmp(key, "DEVPATH") == 0) { - char syspath[UTIL_PATH_SIZE]; - - info(udev, "updating devpath from '%s' to '%s'\n", - udev_device_get_devpath(dev), val); - util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), val, NULL); - udev_device_set_syspath(dev, syspath); - } else { - struct udev_list_entry *entry; - - entry = udev_device_add_property(dev, key, val); - /* store in db, skip private keys */ - if (key[0] != '.') - udev_list_entry_set_num(entry, true); - } - return 0; + struct udev *udev = udev_device_get_udev(dev); + char *key; + char *val; + size_t len; + + /* find key */ + key = line; + while (isspace(key[0])) + key++; + + /* comment or empty line */ + if (key[0] == '#' || key[0] == '\0') + return -1; + + /* split key/value */ + val = strchr(key, '='); + if (val == NULL) + return -1; + val[0] = '\0'; + val++; + + /* find value */ + while (isspace(val[0])) + val++; + + /* terminate key */ + len = strlen(key); + if (len == 0) + return -1; + while (isspace(key[len-1])) + len--; + key[len] = '\0'; + + /* terminate value */ + len = strlen(val); + if (len == 0) + return -1; + while (isspace(val[len-1])) + len--; + val[len] = '\0'; + + if (len == 0) + return -1; + + /* unquote */ + if (val[0] == '"' || val[0] == '\'') { + if (val[len-1] != val[0]) { + info(udev, "inconsistent quoting: '%s', skip\n", line); + return -1; + } + val[len-1] = '\0'; + val++; + } + + dbg(udev, "adding '%s'='%s'\n", key, val); + + /* handle device, renamed by external tool, returning new path */ + if (strcmp(key, "DEVPATH") == 0) { + char syspath[UTIL_PATH_SIZE]; + + info(udev, "updating devpath from '%s' to '%s'\n", + udev_device_get_devpath(dev), val); + util_strscpyl(syspath, sizeof(syspath), udev_get_sys_path(udev), val, NULL); + udev_device_set_syspath(dev, syspath); + } else { + struct udev_list_entry *entry; + + entry = udev_device_add_property(dev, key, val); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_num(entry, true); + } + return 0; } static int import_file_into_properties(struct udev_device *dev, const char *filename) { - FILE *f; - char line[UTIL_LINE_SIZE]; - - f = fopen(filename, "r"); - if (f == NULL) - return -1; - while (fgets(line, sizeof(line), f) != NULL) - import_property_from_string(dev, line); - fclose(f); - return 0; + FILE *f; + char line[UTIL_LINE_SIZE]; + + f = fopen(filename, "r"); + if (f == NULL) + return -1; + while (fgets(line, sizeof(line), f) != NULL) + import_property_from_string(dev, line); + fclose(f); + return 0; } static int import_program_into_properties(struct udev_event *event, const char *program, const sigset_t *sigmask) { - struct udev_device *dev = event->dev; - char **envp; - char result[UTIL_LINE_SIZE]; - char *line; - int err; - - envp = udev_device_get_properties_envp(dev); - err = udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)); - if (err < 0) - return err; - - line = result; - while (line != NULL) { - char *pos; - - pos = strchr(line, '\n'); - if (pos != NULL) { - pos[0] = '\0'; - pos = &pos[1]; - } - import_property_from_string(dev, line); - line = pos; - } - return 0; + struct udev_device *dev = event->dev; + char **envp; + char result[UTIL_LINE_SIZE]; + char *line; + int err; + + envp = udev_device_get_properties_envp(dev); + err = udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)); + if (err < 0) + return err; + + line = result; + while (line != NULL) { + char *pos; + + pos = strchr(line, '\n'); + if (pos != NULL) { + pos[0] = '\0'; + pos = &pos[1]; + } + import_property_from_string(dev, line); + line = pos; + } + return 0; } static int import_parent_into_properties(struct udev_device *dev, const char *filter) { - struct udev *udev = udev_device_get_udev(dev); - struct udev_device *dev_parent; - struct udev_list_entry *list_entry; - - dev_parent = udev_device_get_parent(dev); - if (dev_parent == NULL) - return -1; - - dbg(udev, "found parent '%s', get the node name\n", udev_device_get_syspath(dev_parent)); - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev_parent)) { - const char *key = udev_list_entry_get_name(list_entry); - const char *val = udev_list_entry_get_value(list_entry); - - if (fnmatch(filter, key, 0) == 0) { - struct udev_list_entry *entry; - - dbg(udev, "import key '%s=%s'\n", key, val); - entry = udev_device_add_property(dev, key, val); - /* store in db, skip private keys */ - if (key[0] != '.') - udev_list_entry_set_num(entry, true); - } - } - return 0; + struct udev *udev = udev_device_get_udev(dev); + struct udev_device *dev_parent; + struct udev_list_entry *list_entry; + + dev_parent = udev_device_get_parent(dev); + if (dev_parent == NULL) + return -1; + + dbg(udev, "found parent '%s', get the node name\n", udev_device_get_syspath(dev_parent)); + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(dev_parent)) { + const char *key = udev_list_entry_get_name(list_entry); + const char *val = udev_list_entry_get_value(list_entry); + + if (fnmatch(filter, key, 0) == 0) { + struct udev_list_entry *entry; + + dbg(udev, "import key '%s=%s'\n", key, val); + entry = udev_device_add_property(dev, key, val); + /* store in db, skip private keys */ + if (key[0] != '.') + udev_list_entry_set_num(entry, true); + } + } + return 0; } -#define WAIT_LOOP_PER_SECOND 50 +#define WAIT_LOOP_PER_SECOND 50 static int wait_for_file(struct udev_device *dev, const char *file, int timeout) { - struct udev *udev = udev_device_get_udev(dev); - char filepath[UTIL_PATH_SIZE]; - char devicepath[UTIL_PATH_SIZE]; - struct stat stats; - int loop = timeout * WAIT_LOOP_PER_SECOND; - - /* a relative path is a device attribute */ - devicepath[0] = '\0'; - if (file[0] != '/') { - util_strscpyl(devicepath, sizeof(devicepath), - udev_get_sys_path(udev), udev_device_get_devpath(dev), NULL); - util_strscpyl(filepath, sizeof(filepath), devicepath, "/", file, NULL); - file = filepath; - } - - dbg(udev, "will wait %i sec for '%s'\n", timeout, file); - while (--loop) { - const struct timespec duration = { 0, 1000 * 1000 * 1000 / WAIT_LOOP_PER_SECOND }; - - /* lookup file */ - if (stat(file, &stats) == 0) { - info(udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); - return 0; - } - /* make sure, the device did not disappear in the meantime */ - if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { - info(udev, "device disappeared while waiting for '%s'\n", file); - return -2; - } - info(udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); - nanosleep(&duration, NULL); - } - info(udev, "waiting for '%s' failed\n", file); - return -1; + struct udev *udev = udev_device_get_udev(dev); + char filepath[UTIL_PATH_SIZE]; + char devicepath[UTIL_PATH_SIZE]; + struct stat stats; + int loop = timeout * WAIT_LOOP_PER_SECOND; + + /* a relative path is a device attribute */ + devicepath[0] = '\0'; + if (file[0] != '/') { + util_strscpyl(devicepath, sizeof(devicepath), + udev_get_sys_path(udev), udev_device_get_devpath(dev), NULL); + util_strscpyl(filepath, sizeof(filepath), devicepath, "/", file, NULL); + file = filepath; + } + + dbg(udev, "will wait %i sec for '%s'\n", timeout, file); + while (--loop) { + const struct timespec duration = { 0, 1000 * 1000 * 1000 / WAIT_LOOP_PER_SECOND }; + + /* lookup file */ + if (stat(file, &stats) == 0) { + info(udev, "file '%s' appeared after %i loops\n", file, (timeout * WAIT_LOOP_PER_SECOND) - loop-1); + return 0; + } + /* make sure, the device did not disappear in the meantime */ + if (devicepath[0] != '\0' && stat(devicepath, &stats) != 0) { + info(udev, "device disappeared while waiting for '%s'\n", file); + return -2; + } + info(udev, "wait for '%s' for %i mseconds\n", file, 1000 / WAIT_LOOP_PER_SECOND); + nanosleep(&duration, NULL); + } + info(udev, "waiting for '%s' failed\n", file); + return -1; } static int attr_subst_subdir(char *attr, size_t len) { - bool found = false; - - if (strstr(attr, "/*/")) { - char *pos; - char dirname[UTIL_PATH_SIZE]; - const char *tail; - DIR *dir; - - util_strscpy(dirname, sizeof(dirname), attr); - pos = strstr(dirname, "/*/"); - if (pos == NULL) - return -1; - pos[0] = '\0'; - tail = &pos[2]; - dir = opendir(dirname); - if (dir != NULL) { - struct dirent *dent; - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat stats; - - if (dent->d_name[0] == '.') - continue; - util_strscpyl(attr, len, dirname, "/", dent->d_name, tail, NULL); - if (stat(attr, &stats) == 0) { - found = true; - break; - } - } - closedir(dir); - } - } - - return found; + bool found = false; + + if (strstr(attr, "/*/")) { + char *pos; + char dirname[UTIL_PATH_SIZE]; + const char *tail; + DIR *dir; + + util_strscpy(dirname, sizeof(dirname), attr); + pos = strstr(dirname, "/*/"); + if (pos == NULL) + return -1; + pos[0] = '\0'; + tail = &pos[2]; + dir = opendir(dirname); + if (dir != NULL) { + struct dirent *dent; + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + util_strscpyl(attr, len, dirname, "/", dent->d_name, tail, NULL); + if (stat(attr, &stats) == 0) { + found = true; + break; + } + } + closedir(dir); + } + } + + return found; } static int get_key(struct udev *udev, char **line, char **key, enum operation_type *op, char **value) { - char *linepos; - char *temp; - - linepos = *line; - if (linepos == NULL || linepos[0] == '\0') - return -1; - - /* skip whitespace */ - while (isspace(linepos[0]) || linepos[0] == ',') - linepos++; - - /* get the key */ - if (linepos[0] == '\0') - return -1; - *key = linepos; - - for (;;) { - linepos++; - if (linepos[0] == '\0') - return -1; - if (isspace(linepos[0])) - break; - if (linepos[0] == '=') - break; - if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) - if (linepos[1] == '=') - break; - } - - /* remember end of key */ - temp = linepos; - - /* skip whitespace after key */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get operation type */ - if (linepos[0] == '=' && linepos[1] == '=') { - *op = OP_MATCH; - linepos += 2; - } else if (linepos[0] == '!' && linepos[1] == '=') { - *op = OP_NOMATCH; - linepos += 2; - } else if (linepos[0] == '+' && linepos[1] == '=') { - *op = OP_ADD; - linepos += 2; - } else if (linepos[0] == '=') { - *op = OP_ASSIGN; - linepos++; - } else if (linepos[0] == ':' && linepos[1] == '=') { - *op = OP_ASSIGN_FINAL; - linepos += 2; - } else - return -1; - - /* terminate key */ - temp[0] = '\0'; - - /* skip whitespace after operator */ - while (isspace(linepos[0])) - linepos++; - if (linepos[0] == '\0') - return -1; - - /* get the value */ - if (linepos[0] == '"') - linepos++; - else - return -1; - *value = linepos; - - /* terminate */ - temp = strchr(linepos, '"'); - if (!temp) - return -1; - temp[0] = '\0'; - temp++; - dbg(udev, "%s '%s'-'%s'\n", operation_str(*op), *key, *value); - - /* move line to next key */ - *line = temp; - return 0; + char *linepos; + char *temp; + + linepos = *line; + if (linepos == NULL || linepos[0] == '\0') + return -1; + + /* skip whitespace */ + while (isspace(linepos[0]) || linepos[0] == ',') + linepos++; + + /* get the key */ + if (linepos[0] == '\0') + return -1; + *key = linepos; + + for (;;) { + linepos++; + if (linepos[0] == '\0') + return -1; + if (isspace(linepos[0])) + break; + if (linepos[0] == '=') + break; + if ((linepos[0] == '+') || (linepos[0] == '!') || (linepos[0] == ':')) + if (linepos[1] == '=') + break; + } + + /* remember end of key */ + temp = linepos; + + /* skip whitespace after key */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get operation type */ + if (linepos[0] == '=' && linepos[1] == '=') { + *op = OP_MATCH; + linepos += 2; + } else if (linepos[0] == '!' && linepos[1] == '=') { + *op = OP_NOMATCH; + linepos += 2; + } else if (linepos[0] == '+' && linepos[1] == '=') { + *op = OP_ADD; + linepos += 2; + } else if (linepos[0] == '=') { + *op = OP_ASSIGN; + linepos++; + } else if (linepos[0] == ':' && linepos[1] == '=') { + *op = OP_ASSIGN_FINAL; + linepos += 2; + } else + return -1; + + /* terminate key */ + temp[0] = '\0'; + + /* skip whitespace after operator */ + while (isspace(linepos[0])) + linepos++; + if (linepos[0] == '\0') + return -1; + + /* get the value */ + if (linepos[0] == '"') + linepos++; + else + return -1; + *value = linepos; + + /* terminate */ + temp = strchr(linepos, '"'); + if (!temp) + return -1; + temp[0] = '\0'; + temp++; + dbg(udev, "%s '%s'-'%s'\n", operation_str(*op), *key, *value); + + /* move line to next key */ + *line = temp; + return 0; } /* extract possible KEY{attr} */ static char *get_key_attribute(struct udev *udev, char *str) { - char *pos; - char *attr; - - attr = strchr(str, '{'); - if (attr != NULL) { - attr++; - pos = strchr(attr, '}'); - if (pos == NULL) { - err(udev, "missing closing brace for format\n"); - return NULL; - } - pos[0] = '\0'; - dbg(udev, "attribute='%s'\n", attr); - return attr; - } - return NULL; + char *pos; + char *attr; + + attr = strchr(str, '{'); + if (attr != NULL) { + attr++; + pos = strchr(attr, '}'); + if (pos == NULL) { + err(udev, "missing closing brace for format\n"); + return NULL; + } + pos[0] = '\0'; + dbg(udev, "attribute='%s'\n", attr); + return attr; + } + return NULL; } static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type, - enum operation_type op, - const char *value, const void *data) + enum operation_type op, + const char *value, const void *data) { - struct token *token = &rule_tmp->token[rule_tmp->token_cur]; - const char *attr = NULL; - - memset(token, 0x00, sizeof(struct token)); - - switch (type) { - case TK_M_ACTION: - case TK_M_DEVPATH: - case TK_M_KERNEL: - case TK_M_SUBSYSTEM: - case TK_M_DRIVER: - case TK_M_WAITFOR: - case TK_M_DEVLINK: - case TK_M_NAME: - case TK_M_KERNELS: - case TK_M_SUBSYSTEMS: - case TK_M_DRIVERS: - case TK_M_TAGS: - case TK_M_PROGRAM: - case TK_M_IMPORT_FILE: - case TK_M_IMPORT_PROG: - case TK_M_IMPORT_DB: - case TK_M_IMPORT_CMDLINE: - case TK_M_IMPORT_PARENT: - case TK_M_RESULT: - case TK_A_OWNER: - case TK_A_GROUP: - case TK_A_MODE: - case TK_A_NAME: - case TK_A_GOTO: - case TK_M_TAG: - case TK_A_TAG: - token->key.value_off = add_string(rule_tmp->rules, value); - break; - case TK_M_IMPORT_BUILTIN: - token->key.value_off = add_string(rule_tmp->rules, value); - token->key.builtin_cmd = *(enum udev_builtin_cmd *)data; - break; - case TK_M_ENV: - case TK_M_ATTR: - case TK_M_ATTRS: - case TK_A_ATTR: - case TK_A_ENV: - attr = data; - token->key.value_off = add_string(rule_tmp->rules, value); - token->key.attr_off = add_string(rule_tmp->rules, attr); - break; - case TK_A_DEVLINK: - token->key.value_off = add_string(rule_tmp->rules, value); - token->key.devlink_unique = *(int *)data; - break; - case TK_M_TEST: - token->key.value_off = add_string(rule_tmp->rules, value); - if (data != NULL) - token->key.mode = *(mode_t *)data; - break; - case TK_A_STRING_ESCAPE_NONE: - case TK_A_STRING_ESCAPE_REPLACE: - case TK_A_DB_PERSIST: - break; - case TK_A_RUN: - token->key.value_off = add_string(rule_tmp->rules, value); - break; - case TK_A_INOTIFY_WATCH: - case TK_A_DEVLINK_PRIO: - token->key.devlink_prio = *(int *)data; - break; - case TK_A_OWNER_ID: - token->key.uid = *(uid_t *)data; - break; - case TK_A_GROUP_ID: - token->key.gid = *(gid_t *)data; - break; - case TK_A_MODE_ID: - token->key.mode = *(mode_t *)data; - break; - case TK_A_STATIC_NODE: - token->key.value_off = add_string(rule_tmp->rules, value); - break; - case TK_M_EVENT_TIMEOUT: - token->key.event_timeout = *(int *)data; - break; - case TK_RULE: - case TK_M_PARENTS_MIN: - case TK_M_PARENTS_MAX: - case TK_M_MAX: - case TK_END: - case TK_UNSET: - err(rule_tmp->rules->udev, "wrong type %u\n", type); - return -1; - } - - if (value != NULL && type < TK_M_MAX) { - /* check if we need to split or call fnmatch() while matching rules */ - enum string_glob_type glob; - int has_split; - int has_glob; - - has_split = (strchr(value, '|') != NULL); - has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || strchr(value, '[') != NULL); - if (has_split && has_glob) { - glob = GL_SPLIT_GLOB; - } else if (has_split) { - glob = GL_SPLIT; - } else if (has_glob) { - if (strcmp(value, "?*") == 0) - glob = GL_SOMETHING; - else - glob = GL_GLOB; - } else { - glob = GL_PLAIN; - } - token->key.glob = glob; - } - - if (value != NULL && type > TK_M_MAX) { - /* check if assigned value has substitution chars */ - if (value[0] == '[') - token->key.subst = SB_SUBSYS; - else if (strchr(value, '%') != NULL || strchr(value, '$') != NULL) - token->key.subst = SB_FORMAT; - else - token->key.subst = SB_NONE; - } - - if (attr != NULL) { - /* check if property/attribut name has substitution chars */ - if (attr[0] == '[') - token->key.attrsubst = SB_SUBSYS; - else if (strchr(attr, '%') != NULL || strchr(attr, '$') != NULL) - token->key.attrsubst = SB_FORMAT; - else - token->key.attrsubst = SB_NONE; - } - - token->key.type = type; - token->key.op = op; - rule_tmp->token_cur++; - if (rule_tmp->token_cur >= ARRAY_SIZE(rule_tmp->token)) { - err(rule_tmp->rules->udev, "temporary rule array too small\n"); - return -1; - } - return 0; + struct token *token = &rule_tmp->token[rule_tmp->token_cur]; + const char *attr = NULL; + + memset(token, 0x00, sizeof(struct token)); + + switch (type) { + case TK_M_ACTION: + case TK_M_DEVPATH: + case TK_M_KERNEL: + case TK_M_SUBSYSTEM: + case TK_M_DRIVER: + case TK_M_WAITFOR: + case TK_M_DEVLINK: + case TK_M_NAME: + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_TAGS: + case TK_M_PROGRAM: + case TK_M_IMPORT_FILE: + case TK_M_IMPORT_PROG: + case TK_M_IMPORT_DB: + case TK_M_IMPORT_CMDLINE: + case TK_M_IMPORT_PARENT: + case TK_M_RESULT: + case TK_A_OWNER: + case TK_A_GROUP: + case TK_A_MODE: + case TK_A_NAME: + case TK_A_GOTO: + case TK_M_TAG: + case TK_A_TAG: + token->key.value_off = add_string(rule_tmp->rules, value); + break; + case TK_M_IMPORT_BUILTIN: + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.builtin_cmd = *(enum udev_builtin_cmd *)data; + break; + case TK_M_ENV: + case TK_M_ATTR: + case TK_M_ATTRS: + case TK_A_ATTR: + case TK_A_ENV: + attr = data; + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.attr_off = add_string(rule_tmp->rules, attr); + break; + case TK_A_DEVLINK: + token->key.value_off = add_string(rule_tmp->rules, value); + token->key.devlink_unique = *(int *)data; + break; + case TK_M_TEST: + token->key.value_off = add_string(rule_tmp->rules, value); + if (data != NULL) + token->key.mode = *(mode_t *)data; + break; + case TK_A_STRING_ESCAPE_NONE: + case TK_A_STRING_ESCAPE_REPLACE: + case TK_A_DB_PERSIST: + break; + case TK_A_RUN: + token->key.value_off = add_string(rule_tmp->rules, value); + break; + case TK_A_INOTIFY_WATCH: + case TK_A_DEVLINK_PRIO: + token->key.devlink_prio = *(int *)data; + break; + case TK_A_OWNER_ID: + token->key.uid = *(uid_t *)data; + break; + case TK_A_GROUP_ID: + token->key.gid = *(gid_t *)data; + break; + case TK_A_MODE_ID: + token->key.mode = *(mode_t *)data; + break; + case TK_A_STATIC_NODE: + token->key.value_off = add_string(rule_tmp->rules, value); + break; + case TK_M_EVENT_TIMEOUT: + token->key.event_timeout = *(int *)data; + break; + case TK_RULE: + case TK_M_PARENTS_MIN: + case TK_M_PARENTS_MAX: + case TK_M_MAX: + case TK_END: + case TK_UNSET: + err(rule_tmp->rules->udev, "wrong type %u\n", type); + return -1; + } + + if (value != NULL && type < TK_M_MAX) { + /* check if we need to split or call fnmatch() while matching rules */ + enum string_glob_type glob; + int has_split; + int has_glob; + + has_split = (strchr(value, '|') != NULL); + has_glob = (strchr(value, '*') != NULL || strchr(value, '?') != NULL || strchr(value, '[') != NULL); + if (has_split && has_glob) { + glob = GL_SPLIT_GLOB; + } else if (has_split) { + glob = GL_SPLIT; + } else if (has_glob) { + if (strcmp(value, "?*") == 0) + glob = GL_SOMETHING; + else + glob = GL_GLOB; + } else { + glob = GL_PLAIN; + } + token->key.glob = glob; + } + + if (value != NULL && type > TK_M_MAX) { + /* check if assigned value has substitution chars */ + if (value[0] == '[') + token->key.subst = SB_SUBSYS; + else if (strchr(value, '%') != NULL || strchr(value, '$') != NULL) + token->key.subst = SB_FORMAT; + else + token->key.subst = SB_NONE; + } + + if (attr != NULL) { + /* check if property/attribut name has substitution chars */ + if (attr[0] == '[') + token->key.attrsubst = SB_SUBSYS; + else if (strchr(attr, '%') != NULL || strchr(attr, '$') != NULL) + token->key.attrsubst = SB_FORMAT; + else + token->key.attrsubst = SB_NONE; + } + + token->key.type = type; + token->key.op = op; + rule_tmp->token_cur++; + if (rule_tmp->token_cur >= ARRAY_SIZE(rule_tmp->token)) { + err(rule_tmp->rules->udev, "temporary rule array too small\n"); + return -1; + } + return 0; } static int sort_token(struct udev_rules *rules, struct rule_tmp *rule_tmp) { - unsigned int i; - unsigned int start = 0; - unsigned int end = rule_tmp->token_cur; - - for (i = 0; i < rule_tmp->token_cur; i++) { - enum token_type next_val = TK_UNSET; - unsigned int next_idx = 0; - unsigned int j; - - /* find smallest value */ - for (j = start; j < end; j++) { - if (rule_tmp->token[j].type == TK_UNSET) - continue; - if (next_val == TK_UNSET || rule_tmp->token[j].type < next_val) { - next_val = rule_tmp->token[j].type; - next_idx = j; - } - } - - /* add token and mark done */ - if (add_token(rules, &rule_tmp->token[next_idx]) != 0) - return -1; - rule_tmp->token[next_idx].type = TK_UNSET; - - /* shrink range */ - if (next_idx == start) - start++; - if (next_idx+1 == end) - end--; - } - return 0; + unsigned int i; + unsigned int start = 0; + unsigned int end = rule_tmp->token_cur; + + for (i = 0; i < rule_tmp->token_cur; i++) { + enum token_type next_val = TK_UNSET; + unsigned int next_idx = 0; + unsigned int j; + + /* find smallest value */ + for (j = start; j < end; j++) { + if (rule_tmp->token[j].type == TK_UNSET) + continue; + if (next_val == TK_UNSET || rule_tmp->token[j].type < next_val) { + next_val = rule_tmp->token[j].type; + next_idx = j; + } + } + + /* add token and mark done */ + if (add_token(rules, &rule_tmp->token[next_idx]) != 0) + return -1; + rule_tmp->token[next_idx].type = TK_UNSET; + + /* shrink range */ + if (next_idx == start) + start++; + if (next_idx+1 == end) + end--; + } + return 0; } static int add_rule(struct udev_rules *rules, char *line, - const char *filename, unsigned int filename_off, unsigned int lineno) + const char *filename, unsigned int filename_off, unsigned int lineno) { - char *linepos; - char *attr; - struct rule_tmp rule_tmp; - - memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); - rule_tmp.rules = rules; - rule_tmp.rule.type = TK_RULE; - rule_tmp.rule.rule.filename_off = filename_off; - rule_tmp.rule.rule.filename_line = lineno; - - linepos = line; - for (;;) { - char *key; - char *value; - enum operation_type op; - - if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) - break; - - if (strcmp(key, "ACTION") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid ACTION operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_ACTION, op, value, NULL); - continue; - } - - if (strcmp(key, "DEVPATH") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid DEVPATH operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_DEVPATH, op, value, NULL); - continue; - } - - if (strcmp(key, "KERNEL") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid KERNEL operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_KERNEL, op, value, NULL); - continue; - } - - if (strcmp(key, "SUBSYSTEM") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid SUBSYSTEM operation\n"); - goto invalid; - } - /* bus, class, subsystem events should all be the same */ - if (strcmp(value, "subsystem") == 0 || - strcmp(value, "bus") == 0 || - strcmp(value, "class") == 0) { - if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) - err(rules->udev, "'%s' must be specified as 'subsystem' \n" - "please fix it in %s:%u", value, filename, lineno); - rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, "subsystem|class|bus", NULL); - } else - rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, value, NULL); - continue; - } - - if (strcmp(key, "DRIVER") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid DRIVER operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_DRIVER, op, value, NULL); - continue; - } - - if (strncmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { - attr = get_key_attribute(rules->udev, key + sizeof("ATTR")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTR attribute\n"); - goto invalid; - } - if (op < OP_MATCH_MAX) { - rule_add_key(&rule_tmp, TK_M_ATTR, op, value, attr); - } else { - rule_add_key(&rule_tmp, TK_A_ATTR, op, value, attr); - } - continue; - } - - if (strcmp(key, "KERNELS") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid KERNELS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL); - continue; - } - - if (strcmp(key, "SUBSYSTEMS") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid SUBSYSTEMS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); - continue; - } - - if (strcmp(key, "DRIVERS") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid DRIVERS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_DRIVERS, op, value, NULL); - continue; - } - - if (strncmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid ATTRS operation\n"); - goto invalid; - } - attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ATTRS attribute\n"); - goto invalid; - } - if (strncmp(attr, "device/", 7) == 0) - err(rules->udev, "the 'device' link may not be available in a future kernel, " - "please fix it in %s:%u", filename, lineno); - else if (strstr(attr, "../") != NULL) - err(rules->udev, "do not reference parent sysfs directories directly, " - "it may break with a future kernel, please fix it in %s:%u", filename, lineno); - rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr); - continue; - } - - if (strcmp(key, "TAGS") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid TAGS operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_TAGS, op, value, NULL); - continue; - } - - if (strncmp(key, "ENV{", sizeof("ENV{")-1) == 0) { - attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1); - if (attr == NULL) { - err(rules->udev, "error parsing ENV attribute\n"); - goto invalid; - } - if (op < OP_MATCH_MAX) { - if (rule_add_key(&rule_tmp, TK_M_ENV, op, value, attr) != 0) - goto invalid; - } else { - static const char *blacklist[] = { - "ACTION", - "SUBSYSTEM", - "DEVTYPE", - "MAJOR", - "MINOR", - "DRIVER", - "IFINDEX", - "DEVNAME", - "DEVLINKS", - "DEVPATH", - "TAGS", - }; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(blacklist); i++) - if (strcmp(attr, blacklist[i]) == 0) { - err(rules->udev, "invalid ENV attribute, '%s' can not be set %s:%u\n", attr, filename, lineno); - continue; - } - if (rule_add_key(&rule_tmp, TK_A_ENV, op, value, attr) != 0) - goto invalid; - } - continue; - } - - if (strcmp(key, "TAG") == 0) { - if (op < OP_MATCH_MAX) - rule_add_key(&rule_tmp, TK_M_TAG, op, value, NULL); - else - rule_add_key(&rule_tmp, TK_A_TAG, op, value, NULL); - continue; - } - - if (strcmp(key, "PROGRAM") == 0) { - rule_add_key(&rule_tmp, TK_M_PROGRAM, op, value, NULL); - continue; - } - - if (strcmp(key, "RESULT") == 0) { - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid RESULT operation\n"); - goto invalid; - } - rule_add_key(&rule_tmp, TK_M_RESULT, op, value, NULL); - continue; - } - - if (strncmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { - attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1); - if (attr == NULL) { - err(rules->udev, "IMPORT{} type missing, ignoring IMPORT %s:%u\n", filename, lineno); - continue; - } - if (strstr(attr, "program")) { - /* find known built-in command */ - if (value[0] != '/') { - enum udev_builtin_cmd cmd; - - cmd = udev_builtin_lookup(value); - if (cmd < UDEV_BUILTIN_MAX) { - info(rules->udev, "IMPORT found builtin '%s', replacing %s:%u\n", - value, filename, lineno); - rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); - continue; - } - } - dbg(rules->udev, "IMPORT will be executed\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); - } else if (strstr(attr, "builtin")) { - enum udev_builtin_cmd cmd = udev_builtin_lookup(value); - - dbg(rules->udev, "IMPORT execute builtin\n"); - if (cmd < UDEV_BUILTIN_MAX) - rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); - else - err(rules->udev, "IMPORT{builtin}: '%s' unknown %s:%u\n", value, filename, lineno); - } else if (strstr(attr, "file")) { - dbg(rules->udev, "IMPORT will be included as file\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); - } else if (strstr(attr, "db")) { - dbg(rules->udev, "IMPORT will include db values\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_DB, op, value, NULL); - } else if (strstr(attr, "cmdline")) { - dbg(rules->udev, "IMPORT will include db values\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_CMDLINE, op, value, NULL); - } else if (strstr(attr, "parent")) { - dbg(rules->udev, "IMPORT will include the parent values\n"); - rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); - } - continue; - } - - if (strncmp(key, "TEST", sizeof("TEST")-1) == 0) { - mode_t mode = 0; - - if (op > OP_MATCH_MAX) { - err(rules->udev, "invalid TEST operation\n"); - goto invalid; - } - attr = get_key_attribute(rules->udev, key + sizeof("TEST")-1); - if (attr != NULL) { - mode = strtol(attr, NULL, 8); - rule_add_key(&rule_tmp, TK_M_TEST, op, value, &mode); - } else { - rule_add_key(&rule_tmp, TK_M_TEST, op, value, NULL); - } - continue; - } - - if (strcmp(key, "RUN") == 0) { - rule_add_key(&rule_tmp, TK_A_RUN, op, value, NULL); - continue; - } - - if (strcmp(key, "WAIT_FOR") == 0 || strcmp(key, "WAIT_FOR_SYSFS") == 0) { - rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL); - continue; - } - - if (strcmp(key, "LABEL") == 0) { - rule_tmp.rule.rule.label_off = add_string(rules, value); - continue; - } - - if (strcmp(key, "GOTO") == 0) { - rule_add_key(&rule_tmp, TK_A_GOTO, 0, value, NULL); - continue; - } - - if (strncmp(key, "NAME", sizeof("NAME")-1) == 0) { - if (op < OP_MATCH_MAX) { - rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL); - } else { - if (strcmp(value, "%k") == 0) { - err(rules->udev, "NAME=\"%%k\" is ignored, because it breaks kernel supplied names, " - "please remove it from %s:%u\n", filename, lineno); - continue; - } - if (value[0] == '\0') { - info(rules->udev, "NAME=\"\" is ignored, because udev will not delete any device nodes, " - "please remove it from %s:%u\n", filename, lineno); - continue; - } - rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); - } - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strncmp(key, "SYMLINK", sizeof("SYMLINK")-1) == 0) { - if (op < OP_MATCH_MAX) { - rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL); - } else { - int flag = 0; - - attr = get_key_attribute(rules->udev, key + sizeof("SYMLINK")-1); - if (attr != NULL && strstr(attr, "unique") != NULL) - flag = 1; - rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, &flag); - } - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strcmp(key, "OWNER") == 0) { - uid_t uid; - char *endptr; - - uid = strtoul(value, &endptr, 10); - if (endptr[0] == '\0') { - rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); - } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { - uid = add_uid(rules, value); - rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); - } else if (rules->resolve_names >= 0) { - rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL); - } - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strcmp(key, "GROUP") == 0) { - gid_t gid; - char *endptr; - - gid = strtoul(value, &endptr, 10); - if (endptr[0] == '\0') { - rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); - } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { - gid = add_gid(rules, value); - rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); - } else if (rules->resolve_names >= 0) { - rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL); - } - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strcmp(key, "MODE") == 0) { - mode_t mode; - char *endptr; - - mode = strtol(value, &endptr, 8); - if (endptr[0] == '\0') - rule_add_key(&rule_tmp, TK_A_MODE_ID, op, NULL, &mode); - else - rule_add_key(&rule_tmp, TK_A_MODE, op, value, NULL); - rule_tmp.rule.rule.can_set_name = true; - continue; - } - - if (strcmp(key, "OPTIONS") == 0) { - const char *pos; - - pos = strstr(value, "link_priority="); - if (pos != NULL) { - int prio = atoi(&pos[strlen("link_priority=")]); - - rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); - dbg(rules->udev, "link priority=%i\n", prio); - } - - pos = strstr(value, "event_timeout="); - if (pos != NULL) { - int tout = atoi(&pos[strlen("event_timeout=")]); - - rule_add_key(&rule_tmp, TK_M_EVENT_TIMEOUT, op, NULL, &tout); - dbg(rules->udev, "event timeout=%i\n", tout); - } - - pos = strstr(value, "string_escape="); - if (pos != NULL) { - pos = &pos[strlen("string_escape=")]; - if (strncmp(pos, "none", strlen("none")) == 0) - rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_NONE, op, NULL, NULL); - else if (strncmp(pos, "replace", strlen("replace")) == 0) - rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, op, NULL, NULL); - } - - pos = strstr(value, "db_persist"); - if (pos != NULL) - rule_add_key(&rule_tmp, TK_A_DB_PERSIST, op, NULL, NULL); - - pos = strstr(value, "nowatch"); - if (pos != NULL) { - const int off = 0; - - rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &off); - dbg(rules->udev, "inotify watch of device disabled\n"); - } else { - pos = strstr(value, "watch"); - if (pos != NULL) { - const int on = 1; - - rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &on); - dbg(rules->udev, "inotify watch of device requested\n"); - } - } - - pos = strstr(value, "static_node="); - if (pos != NULL) { - rule_add_key(&rule_tmp, TK_A_STATIC_NODE, op, &pos[strlen("static_node=")], NULL); - rule_tmp.rule.rule.has_static_node = true; - } - - continue; - } - - err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); - goto invalid; - } - - /* add rule token */ - rule_tmp.rule.rule.token_count = 1 + rule_tmp.token_cur; - if (add_token(rules, &rule_tmp.rule) != 0) - goto invalid; - - /* add tokens to list, sorted by type */ - if (sort_token(rules, &rule_tmp) != 0) - goto invalid; - - return 0; + char *linepos; + char *attr; + struct rule_tmp rule_tmp; + + memset(&rule_tmp, 0x00, sizeof(struct rule_tmp)); + rule_tmp.rules = rules; + rule_tmp.rule.type = TK_RULE; + rule_tmp.rule.rule.filename_off = filename_off; + rule_tmp.rule.rule.filename_line = lineno; + + linepos = line; + for (;;) { + char *key; + char *value; + enum operation_type op; + + if (get_key(rules->udev, &linepos, &key, &op, &value) != 0) + break; + + if (strcmp(key, "ACTION") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid ACTION operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_ACTION, op, value, NULL); + continue; + } + + if (strcmp(key, "DEVPATH") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid DEVPATH operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_DEVPATH, op, value, NULL); + continue; + } + + if (strcmp(key, "KERNEL") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid KERNEL operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_KERNEL, op, value, NULL); + continue; + } + + if (strcmp(key, "SUBSYSTEM") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid SUBSYSTEM operation\n"); + goto invalid; + } + /* bus, class, subsystem events should all be the same */ + if (strcmp(value, "subsystem") == 0 || + strcmp(value, "bus") == 0 || + strcmp(value, "class") == 0) { + if (strcmp(value, "bus") == 0 || strcmp(value, "class") == 0) + err(rules->udev, "'%s' must be specified as 'subsystem' \n" + "please fix it in %s:%u", value, filename, lineno); + rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, "subsystem|class|bus", NULL); + } else + rule_add_key(&rule_tmp, TK_M_SUBSYSTEM, op, value, NULL); + continue; + } + + if (strcmp(key, "DRIVER") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid DRIVER operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_DRIVER, op, value, NULL); + continue; + } + + if (strncmp(key, "ATTR{", sizeof("ATTR{")-1) == 0) { + attr = get_key_attribute(rules->udev, key + sizeof("ATTR")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ATTR attribute\n"); + goto invalid; + } + if (op < OP_MATCH_MAX) { + rule_add_key(&rule_tmp, TK_M_ATTR, op, value, attr); + } else { + rule_add_key(&rule_tmp, TK_A_ATTR, op, value, attr); + } + continue; + } + + if (strcmp(key, "KERNELS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid KERNELS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_KERNELS, op, value, NULL); + continue; + } + + if (strcmp(key, "SUBSYSTEMS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid SUBSYSTEMS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_SUBSYSTEMS, op, value, NULL); + continue; + } + + if (strcmp(key, "DRIVERS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid DRIVERS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_DRIVERS, op, value, NULL); + continue; + } + + if (strncmp(key, "ATTRS{", sizeof("ATTRS{")-1) == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid ATTRS operation\n"); + goto invalid; + } + attr = get_key_attribute(rules->udev, key + sizeof("ATTRS")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ATTRS attribute\n"); + goto invalid; + } + if (strncmp(attr, "device/", 7) == 0) + err(rules->udev, "the 'device' link may not be available in a future kernel, " + "please fix it in %s:%u", filename, lineno); + else if (strstr(attr, "../") != NULL) + err(rules->udev, "do not reference parent sysfs directories directly, " + "it may break with a future kernel, please fix it in %s:%u", filename, lineno); + rule_add_key(&rule_tmp, TK_M_ATTRS, op, value, attr); + continue; + } + + if (strcmp(key, "TAGS") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid TAGS operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_TAGS, op, value, NULL); + continue; + } + + if (strncmp(key, "ENV{", sizeof("ENV{")-1) == 0) { + attr = get_key_attribute(rules->udev, key + sizeof("ENV")-1); + if (attr == NULL) { + err(rules->udev, "error parsing ENV attribute\n"); + goto invalid; + } + if (op < OP_MATCH_MAX) { + if (rule_add_key(&rule_tmp, TK_M_ENV, op, value, attr) != 0) + goto invalid; + } else { + static const char *blacklist[] = { + "ACTION", + "SUBSYSTEM", + "DEVTYPE", + "MAJOR", + "MINOR", + "DRIVER", + "IFINDEX", + "DEVNAME", + "DEVLINKS", + "DEVPATH", + "TAGS", + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(blacklist); i++) + if (strcmp(attr, blacklist[i]) == 0) { + err(rules->udev, "invalid ENV attribute, '%s' can not be set %s:%u\n", attr, filename, lineno); + continue; + } + if (rule_add_key(&rule_tmp, TK_A_ENV, op, value, attr) != 0) + goto invalid; + } + continue; + } + + if (strcmp(key, "TAG") == 0) { + if (op < OP_MATCH_MAX) + rule_add_key(&rule_tmp, TK_M_TAG, op, value, NULL); + else + rule_add_key(&rule_tmp, TK_A_TAG, op, value, NULL); + continue; + } + + if (strcmp(key, "PROGRAM") == 0) { + rule_add_key(&rule_tmp, TK_M_PROGRAM, op, value, NULL); + continue; + } + + if (strcmp(key, "RESULT") == 0) { + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid RESULT operation\n"); + goto invalid; + } + rule_add_key(&rule_tmp, TK_M_RESULT, op, value, NULL); + continue; + } + + if (strncmp(key, "IMPORT", sizeof("IMPORT")-1) == 0) { + attr = get_key_attribute(rules->udev, key + sizeof("IMPORT")-1); + if (attr == NULL) { + err(rules->udev, "IMPORT{} type missing, ignoring IMPORT %s:%u\n", filename, lineno); + continue; + } + if (strstr(attr, "program")) { + /* find known built-in command */ + if (value[0] != '/') { + enum udev_builtin_cmd cmd; + + cmd = udev_builtin_lookup(value); + if (cmd < UDEV_BUILTIN_MAX) { + info(rules->udev, "IMPORT found builtin '%s', replacing %s:%u\n", + value, filename, lineno); + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); + continue; + } + } + dbg(rules->udev, "IMPORT will be executed\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_PROG, op, value, NULL); + } else if (strstr(attr, "builtin")) { + enum udev_builtin_cmd cmd = udev_builtin_lookup(value); + + dbg(rules->udev, "IMPORT execute builtin\n"); + if (cmd < UDEV_BUILTIN_MAX) + rule_add_key(&rule_tmp, TK_M_IMPORT_BUILTIN, op, value, &cmd); + else + err(rules->udev, "IMPORT{builtin}: '%s' unknown %s:%u\n", value, filename, lineno); + } else if (strstr(attr, "file")) { + dbg(rules->udev, "IMPORT will be included as file\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_FILE, op, value, NULL); + } else if (strstr(attr, "db")) { + dbg(rules->udev, "IMPORT will include db values\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_DB, op, value, NULL); + } else if (strstr(attr, "cmdline")) { + dbg(rules->udev, "IMPORT will include db values\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_CMDLINE, op, value, NULL); + } else if (strstr(attr, "parent")) { + dbg(rules->udev, "IMPORT will include the parent values\n"); + rule_add_key(&rule_tmp, TK_M_IMPORT_PARENT, op, value, NULL); + } + continue; + } + + if (strncmp(key, "TEST", sizeof("TEST")-1) == 0) { + mode_t mode = 0; + + if (op > OP_MATCH_MAX) { + err(rules->udev, "invalid TEST operation\n"); + goto invalid; + } + attr = get_key_attribute(rules->udev, key + sizeof("TEST")-1); + if (attr != NULL) { + mode = strtol(attr, NULL, 8); + rule_add_key(&rule_tmp, TK_M_TEST, op, value, &mode); + } else { + rule_add_key(&rule_tmp, TK_M_TEST, op, value, NULL); + } + continue; + } + + if (strcmp(key, "RUN") == 0) { + rule_add_key(&rule_tmp, TK_A_RUN, op, value, NULL); + continue; + } + + if (strcmp(key, "WAIT_FOR") == 0 || strcmp(key, "WAIT_FOR_SYSFS") == 0) { + rule_add_key(&rule_tmp, TK_M_WAITFOR, 0, value, NULL); + continue; + } + + if (strcmp(key, "LABEL") == 0) { + rule_tmp.rule.rule.label_off = add_string(rules, value); + continue; + } + + if (strcmp(key, "GOTO") == 0) { + rule_add_key(&rule_tmp, TK_A_GOTO, 0, value, NULL); + continue; + } + + if (strncmp(key, "NAME", sizeof("NAME")-1) == 0) { + if (op < OP_MATCH_MAX) { + rule_add_key(&rule_tmp, TK_M_NAME, op, value, NULL); + } else { + if (strcmp(value, "%k") == 0) { + err(rules->udev, "NAME=\"%%k\" is ignored, because it breaks kernel supplied names, " + "please remove it from %s:%u\n", filename, lineno); + continue; + } + if (value[0] == '\0') { + info(rules->udev, "NAME=\"\" is ignored, because udev will not delete any device nodes, " + "please remove it from %s:%u\n", filename, lineno); + continue; + } + rule_add_key(&rule_tmp, TK_A_NAME, op, value, NULL); + } + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strncmp(key, "SYMLINK", sizeof("SYMLINK")-1) == 0) { + if (op < OP_MATCH_MAX) { + rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL); + } else { + int flag = 0; + + attr = get_key_attribute(rules->udev, key + sizeof("SYMLINK")-1); + if (attr != NULL && strstr(attr, "unique") != NULL) + flag = 1; + rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, &flag); + } + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strcmp(key, "OWNER") == 0) { + uid_t uid; + char *endptr; + + uid = strtoul(value, &endptr, 10); + if (endptr[0] == '\0') { + rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); + } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { + uid = add_uid(rules, value); + rule_add_key(&rule_tmp, TK_A_OWNER_ID, op, NULL, &uid); + } else if (rules->resolve_names >= 0) { + rule_add_key(&rule_tmp, TK_A_OWNER, op, value, NULL); + } + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strcmp(key, "GROUP") == 0) { + gid_t gid; + char *endptr; + + gid = strtoul(value, &endptr, 10); + if (endptr[0] == '\0') { + rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); + } else if ((rules->resolve_names > 0) && strchr("$%", value[0]) == NULL) { + gid = add_gid(rules, value); + rule_add_key(&rule_tmp, TK_A_GROUP_ID, op, NULL, &gid); + } else if (rules->resolve_names >= 0) { + rule_add_key(&rule_tmp, TK_A_GROUP, op, value, NULL); + } + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strcmp(key, "MODE") == 0) { + mode_t mode; + char *endptr; + + mode = strtol(value, &endptr, 8); + if (endptr[0] == '\0') + rule_add_key(&rule_tmp, TK_A_MODE_ID, op, NULL, &mode); + else + rule_add_key(&rule_tmp, TK_A_MODE, op, value, NULL); + rule_tmp.rule.rule.can_set_name = true; + continue; + } + + if (strcmp(key, "OPTIONS") == 0) { + const char *pos; + + pos = strstr(value, "link_priority="); + if (pos != NULL) { + int prio = atoi(&pos[strlen("link_priority=")]); + + rule_add_key(&rule_tmp, TK_A_DEVLINK_PRIO, op, NULL, &prio); + dbg(rules->udev, "link priority=%i\n", prio); + } + + pos = strstr(value, "event_timeout="); + if (pos != NULL) { + int tout = atoi(&pos[strlen("event_timeout=")]); + + rule_add_key(&rule_tmp, TK_M_EVENT_TIMEOUT, op, NULL, &tout); + dbg(rules->udev, "event timeout=%i\n", tout); + } + + pos = strstr(value, "string_escape="); + if (pos != NULL) { + pos = &pos[strlen("string_escape=")]; + if (strncmp(pos, "none", strlen("none")) == 0) + rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_NONE, op, NULL, NULL); + else if (strncmp(pos, "replace", strlen("replace")) == 0) + rule_add_key(&rule_tmp, TK_A_STRING_ESCAPE_REPLACE, op, NULL, NULL); + } + + pos = strstr(value, "db_persist"); + if (pos != NULL) + rule_add_key(&rule_tmp, TK_A_DB_PERSIST, op, NULL, NULL); + + pos = strstr(value, "nowatch"); + if (pos != NULL) { + const int off = 0; + + rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &off); + dbg(rules->udev, "inotify watch of device disabled\n"); + } else { + pos = strstr(value, "watch"); + if (pos != NULL) { + const int on = 1; + + rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &on); + dbg(rules->udev, "inotify watch of device requested\n"); + } + } + + pos = strstr(value, "static_node="); + if (pos != NULL) { + rule_add_key(&rule_tmp, TK_A_STATIC_NODE, op, &pos[strlen("static_node=")], NULL); + rule_tmp.rule.rule.has_static_node = true; + } + + continue; + } + + err(rules->udev, "unknown key '%s' in %s:%u\n", key, filename, lineno); + goto invalid; + } + + /* add rule token */ + rule_tmp.rule.rule.token_count = 1 + rule_tmp.token_cur; + if (add_token(rules, &rule_tmp.rule) != 0) + goto invalid; + + /* add tokens to list, sorted by type */ + if (sort_token(rules, &rule_tmp) != 0) + goto invalid; + + return 0; invalid: - err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); - return -1; + err(rules->udev, "invalid rule '%s:%u'\n", filename, lineno); + return -1; } static int parse_file(struct udev_rules *rules, const char *filename, unsigned short filename_off) { - FILE *f; - unsigned int first_token; - char line[UTIL_LINE_SIZE]; - int line_nr = 0; - unsigned int i; - - info(rules->udev, "reading '%s' as rules file\n", filename); - - f = fopen(filename, "r"); - if (f == NULL) - return -1; - - first_token = rules->token_cur; - - while (fgets(line, sizeof(line), f) != NULL) { - char *key; - size_t len; - - /* skip whitespace */ - line_nr++; - key = line; - while (isspace(key[0])) - key++; - - /* comment */ - if (key[0] == '#') - continue; - - len = strlen(line); - if (len < 3) - continue; - - /* continue reading if backslash+newline is found */ - while (line[len-2] == '\\') { - if (fgets(&line[len-2], (sizeof(line)-len)+2, f) == NULL) - break; - if (strlen(&line[len-2]) < 2) - break; - line_nr++; - len = strlen(line); - } - - if (len+1 >= sizeof(line)) { - err(rules->udev, "line too long '%s':%u, ignored\n", filename, line_nr); - continue; - } - add_rule(rules, key, filename, filename_off, line_nr); - } - fclose(f); - - /* link GOTOs to LABEL rules in this file to be able to fast-forward */ - for (i = first_token+1; i < rules->token_cur; i++) { - if (rules->tokens[i].type == TK_A_GOTO) { - char *label = &rules->buf[rules->tokens[i].key.value_off]; - unsigned int j; - - for (j = i+1; j < rules->token_cur; j++) { - if (rules->tokens[j].type != TK_RULE) - continue; - if (rules->tokens[j].rule.label_off == 0) - continue; - if (strcmp(label, &rules->buf[rules->tokens[j].rule.label_off]) != 0) - continue; - rules->tokens[i].key.rule_goto = j; - break; - } - if (rules->tokens[i].key.rule_goto == 0) - err(rules->udev, "GOTO '%s' has no matching label in: '%s'\n", label, filename); - } - } - return 0; + FILE *f; + unsigned int first_token; + char line[UTIL_LINE_SIZE]; + int line_nr = 0; + unsigned int i; + + info(rules->udev, "reading '%s' as rules file\n", filename); + + f = fopen(filename, "r"); + if (f == NULL) + return -1; + + first_token = rules->token_cur; + + while (fgets(line, sizeof(line), f) != NULL) { + char *key; + size_t len; + + /* skip whitespace */ + line_nr++; + key = line; + while (isspace(key[0])) + key++; + + /* comment */ + if (key[0] == '#') + continue; + + len = strlen(line); + if (len < 3) + continue; + + /* continue reading if backslash+newline is found */ + while (line[len-2] == '\\') { + if (fgets(&line[len-2], (sizeof(line)-len)+2, f) == NULL) + break; + if (strlen(&line[len-2]) < 2) + break; + line_nr++; + len = strlen(line); + } + + if (len+1 >= sizeof(line)) { + err(rules->udev, "line too long '%s':%u, ignored\n", filename, line_nr); + continue; + } + add_rule(rules, key, filename, filename_off, line_nr); + } + fclose(f); + + /* link GOTOs to LABEL rules in this file to be able to fast-forward */ + for (i = first_token+1; i < rules->token_cur; i++) { + if (rules->tokens[i].type == TK_A_GOTO) { + char *label = &rules->buf[rules->tokens[i].key.value_off]; + unsigned int j; + + for (j = i+1; j < rules->token_cur; j++) { + if (rules->tokens[j].type != TK_RULE) + continue; + if (rules->tokens[j].rule.label_off == 0) + continue; + if (strcmp(label, &rules->buf[rules->tokens[j].rule.label_off]) != 0) + continue; + rules->tokens[i].key.rule_goto = j; + break; + } + if (rules->tokens[i].key.rule_goto == 0) + err(rules->udev, "GOTO '%s' has no matching label in: '%s'\n", label, filename); + } + } + return 0; } static int add_matching_files(struct udev *udev, struct udev_list *file_list, const char *dirname, const char *suffix) { - DIR *dir; - struct dirent *dent; - char filename[UTIL_PATH_SIZE]; - - dbg(udev, "open directory '%s'\n", dirname); - dir = opendir(dirname); - if (dir == NULL) { - info(udev, "unable to open '%s': %m\n", dirname); - return -1; - } - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - if (dent->d_name[0] == '.') - continue; - - /* look for file matching with specified suffix */ - if (suffix != NULL) { - const char *ext; - - ext = strrchr(dent->d_name, '.'); - if (ext == NULL) - continue; - if (strcmp(ext, suffix) != 0) - continue; - } - util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL); - dbg(udev, "put file '%s' into list\n", filename); - /* - * the basename is the key, the filename the value - * identical basenames from different directories overwrite each other - * entries are sorted after basename - */ - udev_list_entry_add(file_list, dent->d_name, filename); - } - - closedir(dir); - return 0; + DIR *dir; + struct dirent *dent; + char filename[UTIL_PATH_SIZE]; + + dbg(udev, "open directory '%s'\n", dirname); + dir = opendir(dirname); + if (dir == NULL) { + info(udev, "unable to open '%s': %m\n", dirname); + return -1; + } + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + if (dent->d_name[0] == '.') + continue; + + /* look for file matching with specified suffix */ + if (suffix != NULL) { + const char *ext; + + ext = strrchr(dent->d_name, '.'); + if (ext == NULL) + continue; + if (strcmp(ext, suffix) != 0) + continue; + } + util_strscpyl(filename, sizeof(filename), dirname, "/", dent->d_name, NULL); + dbg(udev, "put file '%s' into list\n", filename); + /* + * the basename is the key, the filename the value + * identical basenames from different directories overwrite each other + * entries are sorted after basename + */ + udev_list_entry_add(file_list, dent->d_name, filename); + } + + closedir(dir); + return 0; } struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names) { - struct udev_rules *rules; - struct udev_list file_list; - struct udev_list_entry *file_loop; - struct token end_token; - char **s; - - rules = calloc(1, sizeof(struct udev_rules)); - if (rules == NULL) - return NULL; - rules->udev = udev; - rules->resolve_names = resolve_names; - udev_list_init(udev, &file_list, true); - - /* init token array and string buffer */ - rules->tokens = malloc(PREALLOC_TOKEN * sizeof(struct token)); - if (rules->tokens == NULL) { - free(rules); - return NULL; - } - rules->token_max = PREALLOC_TOKEN; - - rules->buf = malloc(PREALLOC_STRBUF); - if (rules->buf == NULL) { - free(rules->tokens); - free(rules); - return NULL; - } - rules->buf_max = PREALLOC_STRBUF; - /* offset 0 is always '\0' */ - rules->buf[0] = '\0'; - rules->buf_cur = 1; - dbg(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", - rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); - - rules->trie_nodes = malloc(PREALLOC_TRIE * sizeof(struct trie_node)); - if (rules->trie_nodes == NULL) { - free(rules->buf); - free(rules->tokens); - free(rules); - return NULL; - } - rules->trie_nodes_max = PREALLOC_TRIE; - /* offset 0 is the trie root, with an empty string */ - memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); - rules->trie_nodes_cur = 1; - - for (udev_get_rules_path(udev, &s, NULL); *s != NULL; s++) - add_matching_files(udev, &file_list, *s, ".rules"); - - /* add all filenames to the string buffer */ - udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { - const char *filename = udev_list_entry_get_value(file_loop); - unsigned int filename_off; - - filename_off = add_string(rules, filename); - /* the offset in the rule is limited to unsigned short */ - if (filename_off < USHRT_MAX) - udev_list_entry_set_num(file_loop, filename_off); - } - - /* parse all rules files */ - udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { - const char *filename = udev_list_entry_get_value(file_loop); - unsigned int filename_off = udev_list_entry_get_num(file_loop); - struct stat st; - - if (stat(filename, &st) != 0) { - err(udev, "can not find '%s': %m\n", filename); - continue; - } - if (S_ISREG(st.st_mode) && st.st_size <= 0) { - info(udev, "ignore empty '%s'\n", filename); - continue; - } - if (S_ISCHR(st.st_mode)) { - info(udev, "ignore masked '%s'\n", filename); - continue; - } - parse_file(rules, filename, filename_off); - } - udev_list_cleanup(&file_list); - - memset(&end_token, 0x00, sizeof(struct token)); - end_token.type = TK_END; - add_token(rules, &end_token); - - /* shrink allocated token and string buffer */ - if (rules->token_cur < rules->token_max) { - struct token *tokens; - - tokens = realloc(rules->tokens, rules->token_cur * sizeof(struct token)); - if (tokens != NULL || rules->token_cur == 0) { - rules->tokens = tokens; - rules->token_max = rules->token_cur; - } - } - if (rules->buf_cur < rules->buf_max) { - char *buf; - - buf = realloc(rules->buf, rules->buf_cur); - if (buf != NULL || rules->buf_cur == 0) { - rules->buf = buf; - rules->buf_max = rules->buf_cur; - } - } - info(udev, "rules use %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", - rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); - info(udev, "temporary index used %zu bytes (%u * %zu bytes)\n", - rules->trie_nodes_cur * sizeof(struct trie_node), - rules->trie_nodes_cur, sizeof(struct trie_node)); - - /* cleanup trie */ - free(rules->trie_nodes); - rules->trie_nodes = NULL; - rules->trie_nodes_cur = 0; - rules->trie_nodes_max = 0; - - /* cleanup uid/gid cache */ - free(rules->uids); - rules->uids = NULL; - rules->uids_cur = 0; - rules->uids_max = 0; - free(rules->gids); - rules->gids = NULL; - rules->gids_cur = 0; - rules->gids_max = 0; - - dump_rules(rules); - return rules; + struct udev_rules *rules; + struct udev_list file_list; + struct udev_list_entry *file_loop; + struct token end_token; + char **s; + + rules = calloc(1, sizeof(struct udev_rules)); + if (rules == NULL) + return NULL; + rules->udev = udev; + rules->resolve_names = resolve_names; + udev_list_init(udev, &file_list, true); + + /* init token array and string buffer */ + rules->tokens = malloc(PREALLOC_TOKEN * sizeof(struct token)); + if (rules->tokens == NULL) { + free(rules); + return NULL; + } + rules->token_max = PREALLOC_TOKEN; + + rules->buf = malloc(PREALLOC_STRBUF); + if (rules->buf == NULL) { + free(rules->tokens); + free(rules); + return NULL; + } + rules->buf_max = PREALLOC_STRBUF; + /* offset 0 is always '\0' */ + rules->buf[0] = '\0'; + rules->buf_cur = 1; + dbg(udev, "prealloc %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); + + rules->trie_nodes = malloc(PREALLOC_TRIE * sizeof(struct trie_node)); + if (rules->trie_nodes == NULL) { + free(rules->buf); + free(rules->tokens); + free(rules); + return NULL; + } + rules->trie_nodes_max = PREALLOC_TRIE; + /* offset 0 is the trie root, with an empty string */ + memset(rules->trie_nodes, 0x00, sizeof(struct trie_node)); + rules->trie_nodes_cur = 1; + + for (udev_get_rules_path(udev, &s, NULL); *s != NULL; s++) + add_matching_files(udev, &file_list, *s, ".rules"); + + /* add all filenames to the string buffer */ + udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { + const char *filename = udev_list_entry_get_value(file_loop); + unsigned int filename_off; + + filename_off = add_string(rules, filename); + /* the offset in the rule is limited to unsigned short */ + if (filename_off < USHRT_MAX) + udev_list_entry_set_num(file_loop, filename_off); + } + + /* parse all rules files */ + udev_list_entry_foreach(file_loop, udev_list_get_entry(&file_list)) { + const char *filename = udev_list_entry_get_value(file_loop); + unsigned int filename_off = udev_list_entry_get_num(file_loop); + struct stat st; + + if (stat(filename, &st) != 0) { + err(udev, "can not find '%s': %m\n", filename); + continue; + } + if (S_ISREG(st.st_mode) && st.st_size <= 0) { + info(udev, "ignore empty '%s'\n", filename); + continue; + } + if (S_ISCHR(st.st_mode)) { + info(udev, "ignore masked '%s'\n", filename); + continue; + } + parse_file(rules, filename, filename_off); + } + udev_list_cleanup(&file_list); + + memset(&end_token, 0x00, sizeof(struct token)); + end_token.type = TK_END; + add_token(rules, &end_token); + + /* shrink allocated token and string buffer */ + if (rules->token_cur < rules->token_max) { + struct token *tokens; + + tokens = realloc(rules->tokens, rules->token_cur * sizeof(struct token)); + if (tokens != NULL || rules->token_cur == 0) { + rules->tokens = tokens; + rules->token_max = rules->token_cur; + } + } + if (rules->buf_cur < rules->buf_max) { + char *buf; + + buf = realloc(rules->buf, rules->buf_cur); + if (buf != NULL || rules->buf_cur == 0) { + rules->buf = buf; + rules->buf_max = rules->buf_cur; + } + } + info(udev, "rules use %zu bytes tokens (%u * %zu bytes), %zu bytes buffer\n", + rules->token_max * sizeof(struct token), rules->token_max, sizeof(struct token), rules->buf_max); + info(udev, "temporary index used %zu bytes (%u * %zu bytes)\n", + rules->trie_nodes_cur * sizeof(struct trie_node), + rules->trie_nodes_cur, sizeof(struct trie_node)); + + /* cleanup trie */ + free(rules->trie_nodes); + rules->trie_nodes = NULL; + rules->trie_nodes_cur = 0; + rules->trie_nodes_max = 0; + + /* cleanup uid/gid cache */ + free(rules->uids); + rules->uids = NULL; + rules->uids_cur = 0; + rules->uids_max = 0; + free(rules->gids); + rules->gids = NULL; + rules->gids_cur = 0; + rules->gids_max = 0; + + dump_rules(rules); + return rules; } struct udev_rules *udev_rules_unref(struct udev_rules *rules) { - if (rules == NULL) - return NULL; - free(rules->tokens); - free(rules->buf); - free(rules->trie_nodes); - free(rules->uids); - free(rules->gids); - free(rules); - return NULL; + if (rules == NULL) + return NULL; + free(rules->tokens); + free(rules->buf); + free(rules->trie_nodes); + free(rules->uids); + free(rules->gids); + free(rules); + return NULL; } static int match_key(struct udev_rules *rules, struct token *token, const char *val) { - char *key_value = &rules->buf[token->key.value_off]; - char *pos; - bool match = false; - - if (val == NULL) - val = ""; - - switch (token->key.glob) { - case GL_PLAIN: - match = (strcmp(key_value, val) == 0); - break; - case GL_GLOB: - match = (fnmatch(key_value, val, 0) == 0); - break; - case GL_SPLIT: - { - const char *split; - size_t len; - - split = &rules->buf[token->key.value_off]; - len = strlen(val); - for (;;) { - const char *next; - - next = strchr(split, '|'); - if (next != NULL) { - size_t matchlen = (size_t)(next - split); - - match = (matchlen == len && strncmp(split, val, matchlen) == 0); - if (match) - break; - } else { - match = (strcmp(split, val) == 0); - break; - } - split = &next[1]; - } - break; - } - case GL_SPLIT_GLOB: - { - char value[UTIL_PATH_SIZE]; - - util_strscpy(value, sizeof(value), &rules->buf[token->key.value_off]); - key_value = value; - while (key_value != NULL) { - pos = strchr(key_value, '|'); - if (pos != NULL) { - pos[0] = '\0'; - pos = &pos[1]; - } - dbg(rules->udev, "match %s '%s' <-> '%s'\n", token_str(token->type), key_value, val); - match = (fnmatch(key_value, val, 0) == 0); - if (match) - break; - key_value = pos; - } - break; - } - case GL_SOMETHING: - match = (val[0] != '\0'); - break; - case GL_UNSET: - return -1; - } - - if (match && (token->key.op == OP_MATCH)) { - dbg(rules->udev, "%s is true (matching value)\n", token_str(token->type)); - return 0; - } - if (!match && (token->key.op == OP_NOMATCH)) { - dbg(rules->udev, "%s is true (non-matching value)\n", token_str(token->type)); - return 0; - } - dbg(rules->udev, "%s is not true\n", token_str(token->type)); - return -1; + char *key_value = &rules->buf[token->key.value_off]; + char *pos; + bool match = false; + + if (val == NULL) + val = ""; + + switch (token->key.glob) { + case GL_PLAIN: + match = (strcmp(key_value, val) == 0); + break; + case GL_GLOB: + match = (fnmatch(key_value, val, 0) == 0); + break; + case GL_SPLIT: + { + const char *split; + size_t len; + + split = &rules->buf[token->key.value_off]; + len = strlen(val); + for (;;) { + const char *next; + + next = strchr(split, '|'); + if (next != NULL) { + size_t matchlen = (size_t)(next - split); + + match = (matchlen == len && strncmp(split, val, matchlen) == 0); + if (match) + break; + } else { + match = (strcmp(split, val) == 0); + break; + } + split = &next[1]; + } + break; + } + case GL_SPLIT_GLOB: + { + char value[UTIL_PATH_SIZE]; + + util_strscpy(value, sizeof(value), &rules->buf[token->key.value_off]); + key_value = value; + while (key_value != NULL) { + pos = strchr(key_value, '|'); + if (pos != NULL) { + pos[0] = '\0'; + pos = &pos[1]; + } + dbg(rules->udev, "match %s '%s' <-> '%s'\n", token_str(token->type), key_value, val); + match = (fnmatch(key_value, val, 0) == 0); + if (match) + break; + key_value = pos; + } + break; + } + case GL_SOMETHING: + match = (val[0] != '\0'); + break; + case GL_UNSET: + return -1; + } + + if (match && (token->key.op == OP_MATCH)) { + dbg(rules->udev, "%s is true (matching value)\n", token_str(token->type)); + return 0; + } + if (!match && (token->key.op == OP_NOMATCH)) { + dbg(rules->udev, "%s is true (non-matching value)\n", token_str(token->type)); + return 0; + } + dbg(rules->udev, "%s is not true\n", token_str(token->type)); + return -1; } static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur) { - const char *name; - char nbuf[UTIL_NAME_SIZE]; - const char *value; - char vbuf[UTIL_NAME_SIZE]; - size_t len; - - name = &rules->buf[cur->key.attr_off]; - switch (cur->key.attrsubst) { - case SB_FORMAT: - udev_event_apply_format(event, name, nbuf, sizeof(nbuf)); - name = nbuf; - /* fall through */ - case SB_NONE: - value = udev_device_get_sysattr_value(dev, name); - if (value == NULL) - return -1; - break; - case SB_SUBSYS: - if (util_resolve_subsys_kernel(event->udev, name, vbuf, sizeof(vbuf), 1) != 0) - return -1; - value = vbuf; - break; - default: - return -1; - } - - /* remove trailing whitespace, if not asked to match for it */ - len = strlen(value); - if (len > 0 && isspace(value[len-1])) { - const char *key_value; - size_t klen; - - key_value = &rules->buf[cur->key.value_off]; - klen = strlen(key_value); - if (klen > 0 && !isspace(key_value[klen-1])) { - if (value != vbuf) { - util_strscpy(vbuf, sizeof(vbuf), value); - value = vbuf; - } - while (len > 0 && isspace(vbuf[--len])) - vbuf[len] = '\0'; - dbg(rules->udev, "removed trailing whitespace from '%s'\n", value); - } - } - - return match_key(rules, cur, value); + const char *name; + char nbuf[UTIL_NAME_SIZE]; + const char *value; + char vbuf[UTIL_NAME_SIZE]; + size_t len; + + name = &rules->buf[cur->key.attr_off]; + switch (cur->key.attrsubst) { + case SB_FORMAT: + udev_event_apply_format(event, name, nbuf, sizeof(nbuf)); + name = nbuf; + /* fall through */ + case SB_NONE: + value = udev_device_get_sysattr_value(dev, name); + if (value == NULL) + return -1; + break; + case SB_SUBSYS: + if (util_resolve_subsys_kernel(event->udev, name, vbuf, sizeof(vbuf), 1) != 0) + return -1; + value = vbuf; + break; + default: + return -1; + } + + /* remove trailing whitespace, if not asked to match for it */ + len = strlen(value); + if (len > 0 && isspace(value[len-1])) { + const char *key_value; + size_t klen; + + key_value = &rules->buf[cur->key.value_off]; + klen = strlen(key_value); + if (klen > 0 && !isspace(key_value[klen-1])) { + if (value != vbuf) { + util_strscpy(vbuf, sizeof(vbuf), value); + value = vbuf; + } + while (len > 0 && isspace(vbuf[--len])) + vbuf[len] = '\0'; + dbg(rules->udev, "removed trailing whitespace from '%s'\n", value); + } + } + + return match_key(rules, cur, value); } enum escape_type { - ESCAPE_UNSET, - ESCAPE_NONE, - ESCAPE_REPLACE, + ESCAPE_UNSET, + ESCAPE_NONE, + ESCAPE_REPLACE, }; int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event, const sigset_t *sigmask) { - struct token *cur; - struct token *rule; - enum escape_type esc = ESCAPE_UNSET; - bool can_set_name; - - if (rules->tokens == NULL) - return -1; - - can_set_name = ((strcmp(udev_device_get_action(event->dev), "remove") != 0) && - (major(udev_device_get_devnum(event->dev)) > 0 || - udev_device_get_ifindex(event->dev) > 0)); - - /* loop through token list, match, run actions or forward to next rule */ - cur = &rules->tokens[0]; - rule = cur; - for (;;) { - dump_token(rules, cur); - switch (cur->type) { - case TK_RULE: - /* current rule */ - rule = cur; - /* possibly skip rules which want to set NAME, SYMLINK, OWNER, GROUP, MODE */ - if (!can_set_name && rule->rule.can_set_name) - goto nomatch; - esc = ESCAPE_UNSET; - break; - case TK_M_ACTION: - if (match_key(rules, cur, udev_device_get_action(event->dev)) != 0) - goto nomatch; - break; - case TK_M_DEVPATH: - if (match_key(rules, cur, udev_device_get_devpath(event->dev)) != 0) - goto nomatch; - break; - case TK_M_KERNEL: - if (match_key(rules, cur, udev_device_get_sysname(event->dev)) != 0) - goto nomatch; - break; - case TK_M_DEVLINK: { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - struct udev_list_entry *list_entry; - bool match = false; - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { - const char *devlink; - - devlink = &udev_list_entry_get_name(list_entry)[devlen]; - if (match_key(rules, cur, devlink) == 0) { - match = true; - break; - } - } - if (!match) - goto nomatch; - break; - } - case TK_M_NAME: - if (match_key(rules, cur, event->name) != 0) - goto nomatch; - break; - case TK_M_ENV: { - const char *key_name = &rules->buf[cur->key.attr_off]; - const char *value; - - value = udev_device_get_property_value(event->dev, key_name); - if (value == NULL) { - dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); - value = ""; - } - if (match_key(rules, cur, value)) - goto nomatch; - break; - } - case TK_M_TAG: { - struct udev_list_entry *list_entry; - bool match = false; - - udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) { - if (strcmp(&rules->buf[cur->key.value_off], udev_list_entry_get_name(list_entry)) == 0) { - match = true; - break; - } - } - if (!match && (cur->key.op != OP_NOMATCH)) - goto nomatch; - break; - } - case TK_M_SUBSYSTEM: - if (match_key(rules, cur, udev_device_get_subsystem(event->dev)) != 0) - goto nomatch; - break; - case TK_M_DRIVER: - if (match_key(rules, cur, udev_device_get_driver(event->dev)) != 0) - goto nomatch; - break; - case TK_M_WAITFOR: { - char filename[UTIL_PATH_SIZE]; - int found; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); - found = (wait_for_file(event->dev, filename, 10) == 0); - if (!found && (cur->key.op != OP_NOMATCH)) - goto nomatch; - break; - } - case TK_M_ATTR: - if (match_attr(rules, event->dev, event, cur) != 0) - goto nomatch; - break; - case TK_M_KERNELS: - case TK_M_SUBSYSTEMS: - case TK_M_DRIVERS: - case TK_M_ATTRS: - case TK_M_TAGS: { - struct token *next; - - /* get whole sequence of parent matches */ - next = cur; - while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX) - next++; - - /* loop over parents */ - event->dev_parent = event->dev; - for (;;) { - struct token *key; - - dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); - /* loop over sequence of parent match keys */ - for (key = cur; key < next; key++ ) { - dump_token(rules, key); - switch(key->type) { - case TK_M_KERNELS: - if (match_key(rules, key, udev_device_get_sysname(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_SUBSYSTEMS: - if (match_key(rules, key, udev_device_get_subsystem(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_DRIVERS: - if (match_key(rules, key, udev_device_get_driver(event->dev_parent)) != 0) - goto try_parent; - break; - case TK_M_ATTRS: - if (match_attr(rules, event->dev_parent, event, key) != 0) - goto try_parent; - break; - case TK_M_TAGS: { - bool match = udev_device_has_tag(event->dev_parent, &rules->buf[cur->key.value_off]); - - if (match && key->key.op == OP_NOMATCH) - goto try_parent; - if (!match && key->key.op == OP_MATCH) - goto try_parent; - break; - } - default: - goto nomatch; - } - dbg(event->udev, "parent key matched\n"); - } - dbg(event->udev, "all parent keys matched\n"); - break; - - try_parent: - event->dev_parent = udev_device_get_parent(event->dev_parent); - if (event->dev_parent == NULL) - goto nomatch; - } - /* move behind our sequence of parent match keys */ - cur = next; - continue; - } - case TK_M_TEST: { - char filename[UTIL_PATH_SIZE]; - struct stat statbuf; - int match; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); - if (util_resolve_subsys_kernel(event->udev, filename, filename, sizeof(filename), 0) != 0) { - if (filename[0] != '/') { - char tmp[UTIL_PATH_SIZE]; - - util_strscpy(tmp, sizeof(tmp), filename); - util_strscpyl(filename, sizeof(filename), - udev_device_get_syspath(event->dev), "/", tmp, NULL); - } - } - attr_subst_subdir(filename, sizeof(filename)); - - match = (stat(filename, &statbuf) == 0); - dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); - if (match && cur->key.mode > 0) { - match = ((statbuf.st_mode & cur->key.mode) > 0); - dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, - match ? "matches" : "does not match", cur->key.mode); - } - if (match && cur->key.op == OP_NOMATCH) - goto nomatch; - if (!match && cur->key.op == OP_MATCH) - goto nomatch; - break; - } - case TK_M_EVENT_TIMEOUT: - info(event->udev, "OPTIONS event_timeout=%u\n", cur->key.event_timeout); - event->timeout_usec = cur->key.event_timeout * 1000 * 1000; - break; - case TK_M_PROGRAM: { - char program[UTIL_PATH_SIZE]; - char **envp; - char result[UTIL_PATH_SIZE]; - - free(event->program_result); - event->program_result = NULL; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], program, sizeof(program)); - envp = udev_device_get_properties_envp(event->dev); - info(event->udev, "PROGRAM '%s' %s:%u\n", - program, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - - if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } else { - int count; - - util_remove_trailing_chars(result, '\n'); - if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - } - event->program_result = strdup(result); - dbg(event->udev, "storing result '%s'\n", event->program_result); - if (cur->key.op == OP_NOMATCH) - goto nomatch; - } - break; - } - case TK_M_IMPORT_FILE: { - char import[UTIL_PATH_SIZE]; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - if (import_file_into_properties(event->dev, import) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_IMPORT_PROG: { - char import[UTIL_PATH_SIZE]; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - info(event->udev, "IMPORT '%s' %s:%u\n", - import, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - - if (import_program_into_properties(event, import, sigmask) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_IMPORT_BUILTIN: { - char command[UTIL_PATH_SIZE]; - - if (udev_builtin_run_once(cur->key.builtin_cmd)) { - /* check if we ran already */ - if (event->builtin_run & (1 << cur->key.builtin_cmd)) { - info(event->udev, "IMPORT builtin skip '%s' %s:%u\n", - udev_builtin_name(cur->key.builtin_cmd), - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - /* return the result from earlier run */ - if (event->builtin_ret & (1 << cur->key.builtin_cmd)) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - /* mark as ran */ - event->builtin_run |= (1 << cur->key.builtin_cmd); - } - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], command, sizeof(command)); - info(event->udev, "IMPORT builtin '%s' %s:%u\n", - udev_builtin_name(cur->key.builtin_cmd), - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - - if (udev_builtin_run(event->dev, cur->key.builtin_cmd, command, false) != 0) { - /* remember failure */ - info(rules->udev, "IMPORT builtin '%s' returned non-zero\n", - udev_builtin_name(cur->key.builtin_cmd)); - event->builtin_ret |= (1 << cur->key.builtin_cmd); - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } - break; - } - case TK_M_IMPORT_DB: { - const char *key = &rules->buf[cur->key.value_off]; - const char *value; - - value = udev_device_get_property_value(event->dev_db, key); - if (value != NULL) { - struct udev_list_entry *entry; - - entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_num(entry, true); - } else { - if (cur->key.op != OP_NOMATCH) - goto nomatch; - } - break; - } - case TK_M_IMPORT_CMDLINE: { - FILE *f; - bool imported = false; - - f = fopen("/proc/cmdline", "r"); - if (f != NULL) { - char cmdline[4096]; - - if (fgets(cmdline, sizeof(cmdline), f) != NULL) { - const char *key = &rules->buf[cur->key.value_off]; - char *pos; - - pos = strstr(cmdline, key); - if (pos != NULL) { - struct udev_list_entry *entry; - - pos += strlen(key); - if (pos[0] == '\0' || isspace(pos[0])) { - /* we import simple flags as 'FLAG=1' */ - entry = udev_device_add_property(event->dev, key, "1"); - udev_list_entry_set_num(entry, true); - imported = true; - } else if (pos[0] == '=') { - const char *value; - - pos++; - value = pos; - while (pos[0] != '\0' && !isspace(pos[0])) - pos++; - pos[0] = '\0'; - entry = udev_device_add_property(event->dev, key, value); - udev_list_entry_set_num(entry, true); - imported = true; - } - } - } - fclose(f); - } - if (!imported && cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_IMPORT_PARENT: { - char import[UTIL_PATH_SIZE]; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); - if (import_parent_into_properties(event->dev, import) != 0) - if (cur->key.op != OP_NOMATCH) - goto nomatch; - break; - } - case TK_M_RESULT: - if (match_key(rules, cur, event->program_result) != 0) - goto nomatch; - break; - case TK_A_STRING_ESCAPE_NONE: - esc = ESCAPE_NONE; - break; - case TK_A_STRING_ESCAPE_REPLACE: - esc = ESCAPE_REPLACE; - break; - case TK_A_DB_PERSIST: - udev_device_set_db_persist(event->dev); - break; - case TK_A_INOTIFY_WATCH: - if (event->inotify_watch_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->inotify_watch_final = true; - event->inotify_watch = cur->key.watch; - break; - case TK_A_DEVLINK_PRIO: - udev_device_set_devlink_priority(event->dev, cur->key.devlink_prio); - break; - case TK_A_OWNER: { - char owner[UTIL_NAME_SIZE]; - - if (event->owner_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->owner_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); - event->uid = util_lookup_user(event->udev, owner); - info(event->udev, "OWNER %u %s:%u\n", - event->uid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - } - case TK_A_GROUP: { - char group[UTIL_NAME_SIZE]; - - if (event->group_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->group_final = true; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); - event->gid = util_lookup_group(event->udev, group); - info(event->udev, "GROUP %u %s:%u\n", - event->gid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - } - case TK_A_MODE: { - char mode_str[UTIL_NAME_SIZE]; - mode_t mode; - char *endptr; - - if (event->mode_final) - break; - udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode_str, sizeof(mode_str)); - mode = strtol(mode_str, &endptr, 8); - if (endptr[0] != '\0') { - err(event->udev, "ignoring invalid mode '%s'\n", mode_str); - break; - } - if (cur->key.op == OP_ASSIGN_FINAL) - event->mode_final = true; - event->mode_set = true; - event->mode = mode; - info(event->udev, "MODE %#o %s:%u\n", - event->mode, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - } - case TK_A_OWNER_ID: - if (event->owner_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->owner_final = true; - event->uid = cur->key.uid; - info(event->udev, "OWNER %u %s:%u\n", - event->uid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - case TK_A_GROUP_ID: - if (event->group_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->group_final = true; - event->gid = cur->key.gid; - info(event->udev, "GROUP %u %s:%u\n", - event->gid, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - case TK_A_MODE_ID: - if (event->mode_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->mode_final = true; - event->mode_set = true; - event->mode = cur->key.mode; - info(event->udev, "MODE %#o %s:%u\n", - event->mode, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - case TK_A_ENV: { - const char *name = &rules->buf[cur->key.attr_off]; - char *value = &rules->buf[cur->key.value_off]; - - if (value[0] != '\0') { - char temp_value[UTIL_NAME_SIZE]; - struct udev_list_entry *entry; - - udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); - entry = udev_device_add_property(event->dev, name, temp_value); - /* store in db, skip private keys */ - if (name[0] != '.') - udev_list_entry_set_num(entry, true); - } else { - udev_device_add_property(event->dev, name, NULL); - } - break; - } - case TK_A_TAG: { - char tag[UTIL_PATH_SIZE]; - const char *p; - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], tag, sizeof(tag)); - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_device_cleanup_tags_list(event->dev); - for (p = tag; *p != '\0'; p++) { - if ((*p >= 'a' && *p <= 'z') || - (*p >= 'A' && *p <= 'Z') || - (*p >= '0' && *p <= '9') || - *p == '-' || *p == '_') - continue; - err(event->udev, "ignoring invalid tag name '%s'\n", tag); - break; - } - udev_device_add_tag(event->dev, tag); - break; - } - case TK_A_NAME: { - const char *name = &rules->buf[cur->key.value_off]; - char name_str[UTIL_PATH_SIZE]; - int count; - - if (event->name_final) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->name_final = true; - udev_event_apply_format(event, name, name_str, sizeof(name_str)); - if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { - count = util_replace_chars(name_str, "/"); - if (count > 0) - info(event->udev, "%i character(s) replaced\n", count); - } - free(event->name); - event->name = strdup(name_str); - info(event->udev, "NAME '%s' %s:%u\n", - event->name, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - break; - } - case TK_A_DEVLINK: { - char temp[UTIL_PATH_SIZE]; - char filename[UTIL_PATH_SIZE]; - char *pos, *next; - int count = 0; - - if (event->devlink_final) - break; - if (major(udev_device_get_devnum(event->dev)) == 0) - break; - if (cur->key.op == OP_ASSIGN_FINAL) - event->devlink_final = true; - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_device_cleanup_devlinks_list(event->dev); - - /* allow multiple symlinks separated by spaces */ - udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); - if (esc == ESCAPE_UNSET) - count = util_replace_chars(temp, "/ "); - else if (esc == ESCAPE_REPLACE) - count = util_replace_chars(temp, "/"); - if (count > 0) - info(event->udev, "%i character(s) replaced\n" , count); - dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); - pos = temp; - while (isspace(pos[0])) - pos++; - next = strchr(pos, ' '); - while (next != NULL) { - next[0] = '\0'; - info(event->udev, "LINK '%s' %s:%u\n", pos, - &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); - while (isspace(next[1])) - next++; - pos = &next[1]; - next = strchr(pos, ' '); - } - if (pos[0] != '\0') { - info(event->udev, "LINK '%s' %s:%u\n", pos, - &rules->buf[rule->rule.filename_off], rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); - udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); - } - break; - } - case TK_A_ATTR: { - const char *key_name = &rules->buf[cur->key.attr_off]; - char attr[UTIL_PATH_SIZE]; - char value[UTIL_NAME_SIZE]; - FILE *f; - - if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) - util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); - attr_subst_subdir(attr, sizeof(attr)); - - udev_event_apply_format(event, &rules->buf[cur->key.value_off], value, sizeof(value)); - info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - f = fopen(attr, "w"); - if (f != NULL) { - if (fprintf(f, "%s", value) <= 0) - err(event->udev, "error writing ATTR{%s}: %m\n", attr); - fclose(f); - } else { - err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); - } - break; - } - case TK_A_RUN: { - if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) - udev_list_cleanup(&event->run_list); - info(event->udev, "RUN '%s' %s:%u\n", - &rules->buf[cur->key.value_off], - &rules->buf[rule->rule.filename_off], - rule->rule.filename_line); - udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL); - break; - } - case TK_A_GOTO: - if (cur->key.rule_goto == 0) - break; - cur = &rules->tokens[cur->key.rule_goto]; - continue; - case TK_END: - return 0; - - case TK_M_PARENTS_MIN: - case TK_M_PARENTS_MAX: - case TK_M_MAX: - case TK_UNSET: - err(rules->udev, "wrong type %u\n", cur->type); - goto nomatch; - } - - cur++; - continue; - nomatch: - /* fast-forward to next rule */ - cur = rule + rule->rule.token_count; - dbg(rules->udev, "forward to rule: %u\n", - (unsigned int) (cur - rules->tokens)); - } + struct token *cur; + struct token *rule; + enum escape_type esc = ESCAPE_UNSET; + bool can_set_name; + + if (rules->tokens == NULL) + return -1; + + can_set_name = ((strcmp(udev_device_get_action(event->dev), "remove") != 0) && + (major(udev_device_get_devnum(event->dev)) > 0 || + udev_device_get_ifindex(event->dev) > 0)); + + /* loop through token list, match, run actions or forward to next rule */ + cur = &rules->tokens[0]; + rule = cur; + for (;;) { + dump_token(rules, cur); + switch (cur->type) { + case TK_RULE: + /* current rule */ + rule = cur; + /* possibly skip rules which want to set NAME, SYMLINK, OWNER, GROUP, MODE */ + if (!can_set_name && rule->rule.can_set_name) + goto nomatch; + esc = ESCAPE_UNSET; + break; + case TK_M_ACTION: + if (match_key(rules, cur, udev_device_get_action(event->dev)) != 0) + goto nomatch; + break; + case TK_M_DEVPATH: + if (match_key(rules, cur, udev_device_get_devpath(event->dev)) != 0) + goto nomatch; + break; + case TK_M_KERNEL: + if (match_key(rules, cur, udev_device_get_sysname(event->dev)) != 0) + goto nomatch; + break; + case TK_M_DEVLINK: { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + struct udev_list_entry *list_entry; + bool match = false; + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) { + const char *devlink; + + devlink = &udev_list_entry_get_name(list_entry)[devlen]; + if (match_key(rules, cur, devlink) == 0) { + match = true; + break; + } + } + if (!match) + goto nomatch; + break; + } + case TK_M_NAME: + if (match_key(rules, cur, event->name) != 0) + goto nomatch; + break; + case TK_M_ENV: { + const char *key_name = &rules->buf[cur->key.attr_off]; + const char *value; + + value = udev_device_get_property_value(event->dev, key_name); + if (value == NULL) { + dbg(event->udev, "ENV{%s} is not set, treat as empty\n", key_name); + value = ""; + } + if (match_key(rules, cur, value)) + goto nomatch; + break; + } + case TK_M_TAG: { + struct udev_list_entry *list_entry; + bool match = false; + + udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) { + if (strcmp(&rules->buf[cur->key.value_off], udev_list_entry_get_name(list_entry)) == 0) { + match = true; + break; + } + } + if (!match && (cur->key.op != OP_NOMATCH)) + goto nomatch; + break; + } + case TK_M_SUBSYSTEM: + if (match_key(rules, cur, udev_device_get_subsystem(event->dev)) != 0) + goto nomatch; + break; + case TK_M_DRIVER: + if (match_key(rules, cur, udev_device_get_driver(event->dev)) != 0) + goto nomatch; + break; + case TK_M_WAITFOR: { + char filename[UTIL_PATH_SIZE]; + int found; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); + found = (wait_for_file(event->dev, filename, 10) == 0); + if (!found && (cur->key.op != OP_NOMATCH)) + goto nomatch; + break; + } + case TK_M_ATTR: + if (match_attr(rules, event->dev, event, cur) != 0) + goto nomatch; + break; + case TK_M_KERNELS: + case TK_M_SUBSYSTEMS: + case TK_M_DRIVERS: + case TK_M_ATTRS: + case TK_M_TAGS: { + struct token *next; + + /* get whole sequence of parent matches */ + next = cur; + while (next->type > TK_M_PARENTS_MIN && next->type < TK_M_PARENTS_MAX) + next++; + + /* loop over parents */ + event->dev_parent = event->dev; + for (;;) { + struct token *key; + + dbg(event->udev, "parent: '%s'\n", udev_device_get_syspath(event->dev_parent)); + /* loop over sequence of parent match keys */ + for (key = cur; key < next; key++ ) { + dump_token(rules, key); + switch(key->type) { + case TK_M_KERNELS: + if (match_key(rules, key, udev_device_get_sysname(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_SUBSYSTEMS: + if (match_key(rules, key, udev_device_get_subsystem(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_DRIVERS: + if (match_key(rules, key, udev_device_get_driver(event->dev_parent)) != 0) + goto try_parent; + break; + case TK_M_ATTRS: + if (match_attr(rules, event->dev_parent, event, key) != 0) + goto try_parent; + break; + case TK_M_TAGS: { + bool match = udev_device_has_tag(event->dev_parent, &rules->buf[cur->key.value_off]); + + if (match && key->key.op == OP_NOMATCH) + goto try_parent; + if (!match && key->key.op == OP_MATCH) + goto try_parent; + break; + } + default: + goto nomatch; + } + dbg(event->udev, "parent key matched\n"); + } + dbg(event->udev, "all parent keys matched\n"); + break; + + try_parent: + event->dev_parent = udev_device_get_parent(event->dev_parent); + if (event->dev_parent == NULL) + goto nomatch; + } + /* move behind our sequence of parent match keys */ + cur = next; + continue; + } + case TK_M_TEST: { + char filename[UTIL_PATH_SIZE]; + struct stat statbuf; + int match; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], filename, sizeof(filename)); + if (util_resolve_subsys_kernel(event->udev, filename, filename, sizeof(filename), 0) != 0) { + if (filename[0] != '/') { + char tmp[UTIL_PATH_SIZE]; + + util_strscpy(tmp, sizeof(tmp), filename); + util_strscpyl(filename, sizeof(filename), + udev_device_get_syspath(event->dev), "/", tmp, NULL); + } + } + attr_subst_subdir(filename, sizeof(filename)); + + match = (stat(filename, &statbuf) == 0); + dbg(event->udev, "'%s' %s", filename, match ? "exists\n" : "does not exist\n"); + if (match && cur->key.mode > 0) { + match = ((statbuf.st_mode & cur->key.mode) > 0); + dbg(event->udev, "'%s' has mode=%#o and %s %#o\n", filename, statbuf.st_mode, + match ? "matches" : "does not match", cur->key.mode); + } + if (match && cur->key.op == OP_NOMATCH) + goto nomatch; + if (!match && cur->key.op == OP_MATCH) + goto nomatch; + break; + } + case TK_M_EVENT_TIMEOUT: + info(event->udev, "OPTIONS event_timeout=%u\n", cur->key.event_timeout); + event->timeout_usec = cur->key.event_timeout * 1000 * 1000; + break; + case TK_M_PROGRAM: { + char program[UTIL_PATH_SIZE]; + char **envp; + char result[UTIL_PATH_SIZE]; + + free(event->program_result); + event->program_result = NULL; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], program, sizeof(program)); + envp = udev_device_get_properties_envp(event->dev); + info(event->udev, "PROGRAM '%s' %s:%u\n", + program, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + + if (udev_event_spawn(event, program, envp, sigmask, result, sizeof(result)) < 0) { + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } else { + int count; + + util_remove_trailing_chars(result, '\n'); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = util_replace_chars(result, UDEV_ALLOWED_CHARS_INPUT); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + } + event->program_result = strdup(result); + dbg(event->udev, "storing result '%s'\n", event->program_result); + if (cur->key.op == OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_FILE: { + char import[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + if (import_file_into_properties(event->dev, import) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PROG: { + char import[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + info(event->udev, "IMPORT '%s' %s:%u\n", + import, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + + if (import_program_into_properties(event, import, sigmask) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_BUILTIN: { + char command[UTIL_PATH_SIZE]; + + if (udev_builtin_run_once(cur->key.builtin_cmd)) { + /* check if we ran already */ + if (event->builtin_run & (1 << cur->key.builtin_cmd)) { + info(event->udev, "IMPORT builtin skip '%s' %s:%u\n", + udev_builtin_name(cur->key.builtin_cmd), + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + /* return the result from earlier run */ + if (event->builtin_ret & (1 << cur->key.builtin_cmd)) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + /* mark as ran */ + event->builtin_run |= (1 << cur->key.builtin_cmd); + } + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], command, sizeof(command)); + info(event->udev, "IMPORT builtin '%s' %s:%u\n", + udev_builtin_name(cur->key.builtin_cmd), + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + + if (udev_builtin_run(event->dev, cur->key.builtin_cmd, command, false) != 0) { + /* remember failure */ + info(rules->udev, "IMPORT builtin '%s' returned non-zero\n", + udev_builtin_name(cur->key.builtin_cmd)); + event->builtin_ret |= (1 << cur->key.builtin_cmd); + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_DB: { + const char *key = &rules->buf[cur->key.value_off]; + const char *value; + + value = udev_device_get_property_value(event->dev_db, key); + if (value != NULL) { + struct udev_list_entry *entry; + + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_num(entry, true); + } else { + if (cur->key.op != OP_NOMATCH) + goto nomatch; + } + break; + } + case TK_M_IMPORT_CMDLINE: { + FILE *f; + bool imported = false; + + f = fopen("/proc/cmdline", "r"); + if (f != NULL) { + char cmdline[4096]; + + if (fgets(cmdline, sizeof(cmdline), f) != NULL) { + const char *key = &rules->buf[cur->key.value_off]; + char *pos; + + pos = strstr(cmdline, key); + if (pos != NULL) { + struct udev_list_entry *entry; + + pos += strlen(key); + if (pos[0] == '\0' || isspace(pos[0])) { + /* we import simple flags as 'FLAG=1' */ + entry = udev_device_add_property(event->dev, key, "1"); + udev_list_entry_set_num(entry, true); + imported = true; + } else if (pos[0] == '=') { + const char *value; + + pos++; + value = pos; + while (pos[0] != '\0' && !isspace(pos[0])) + pos++; + pos[0] = '\0'; + entry = udev_device_add_property(event->dev, key, value); + udev_list_entry_set_num(entry, true); + imported = true; + } + } + } + fclose(f); + } + if (!imported && cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_IMPORT_PARENT: { + char import[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], import, sizeof(import)); + if (import_parent_into_properties(event->dev, import) != 0) + if (cur->key.op != OP_NOMATCH) + goto nomatch; + break; + } + case TK_M_RESULT: + if (match_key(rules, cur, event->program_result) != 0) + goto nomatch; + break; + case TK_A_STRING_ESCAPE_NONE: + esc = ESCAPE_NONE; + break; + case TK_A_STRING_ESCAPE_REPLACE: + esc = ESCAPE_REPLACE; + break; + case TK_A_DB_PERSIST: + udev_device_set_db_persist(event->dev); + break; + case TK_A_INOTIFY_WATCH: + if (event->inotify_watch_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->inotify_watch_final = true; + event->inotify_watch = cur->key.watch; + break; + case TK_A_DEVLINK_PRIO: + udev_device_set_devlink_priority(event->dev, cur->key.devlink_prio); + break; + case TK_A_OWNER: { + char owner[UTIL_NAME_SIZE]; + + if (event->owner_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->owner_final = true; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], owner, sizeof(owner)); + event->uid = util_lookup_user(event->udev, owner); + info(event->udev, "OWNER %u %s:%u\n", + event->uid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_GROUP: { + char group[UTIL_NAME_SIZE]; + + if (event->group_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->group_final = true; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], group, sizeof(group)); + event->gid = util_lookup_group(event->udev, group); + info(event->udev, "GROUP %u %s:%u\n", + event->gid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_MODE: { + char mode_str[UTIL_NAME_SIZE]; + mode_t mode; + char *endptr; + + if (event->mode_final) + break; + udev_event_apply_format(event, &rules->buf[cur->key.value_off], mode_str, sizeof(mode_str)); + mode = strtol(mode_str, &endptr, 8); + if (endptr[0] != '\0') { + err(event->udev, "ignoring invalid mode '%s'\n", mode_str); + break; + } + if (cur->key.op == OP_ASSIGN_FINAL) + event->mode_final = true; + event->mode_set = true; + event->mode = mode; + info(event->udev, "MODE %#o %s:%u\n", + event->mode, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_OWNER_ID: + if (event->owner_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->owner_final = true; + event->uid = cur->key.uid; + info(event->udev, "OWNER %u %s:%u\n", + event->uid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + case TK_A_GROUP_ID: + if (event->group_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->group_final = true; + event->gid = cur->key.gid; + info(event->udev, "GROUP %u %s:%u\n", + event->gid, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + case TK_A_MODE_ID: + if (event->mode_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->mode_final = true; + event->mode_set = true; + event->mode = cur->key.mode; + info(event->udev, "MODE %#o %s:%u\n", + event->mode, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + case TK_A_ENV: { + const char *name = &rules->buf[cur->key.attr_off]; + char *value = &rules->buf[cur->key.value_off]; + + if (value[0] != '\0') { + char temp_value[UTIL_NAME_SIZE]; + struct udev_list_entry *entry; + + udev_event_apply_format(event, value, temp_value, sizeof(temp_value)); + entry = udev_device_add_property(event->dev, name, temp_value); + /* store in db, skip private keys */ + if (name[0] != '.') + udev_list_entry_set_num(entry, true); + } else { + udev_device_add_property(event->dev, name, NULL); + } + break; + } + case TK_A_TAG: { + char tag[UTIL_PATH_SIZE]; + const char *p; + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], tag, sizeof(tag)); + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_device_cleanup_tags_list(event->dev); + for (p = tag; *p != '\0'; p++) { + if ((*p >= 'a' && *p <= 'z') || + (*p >= 'A' && *p <= 'Z') || + (*p >= '0' && *p <= '9') || + *p == '-' || *p == '_') + continue; + err(event->udev, "ignoring invalid tag name '%s'\n", tag); + break; + } + udev_device_add_tag(event->dev, tag); + break; + } + case TK_A_NAME: { + const char *name = &rules->buf[cur->key.value_off]; + char name_str[UTIL_PATH_SIZE]; + int count; + + if (event->name_final) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->name_final = true; + udev_event_apply_format(event, name, name_str, sizeof(name_str)); + if (esc == ESCAPE_UNSET || esc == ESCAPE_REPLACE) { + count = util_replace_chars(name_str, "/"); + if (count > 0) + info(event->udev, "%i character(s) replaced\n", count); + } + free(event->name); + event->name = strdup(name_str); + info(event->udev, "NAME '%s' %s:%u\n", + event->name, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + break; + } + case TK_A_DEVLINK: { + char temp[UTIL_PATH_SIZE]; + char filename[UTIL_PATH_SIZE]; + char *pos, *next; + int count = 0; + + if (event->devlink_final) + break; + if (major(udev_device_get_devnum(event->dev)) == 0) + break; + if (cur->key.op == OP_ASSIGN_FINAL) + event->devlink_final = true; + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_device_cleanup_devlinks_list(event->dev); + + /* allow multiple symlinks separated by spaces */ + udev_event_apply_format(event, &rules->buf[cur->key.value_off], temp, sizeof(temp)); + if (esc == ESCAPE_UNSET) + count = util_replace_chars(temp, "/ "); + else if (esc == ESCAPE_REPLACE) + count = util_replace_chars(temp, "/"); + if (count > 0) + info(event->udev, "%i character(s) replaced\n" , count); + dbg(event->udev, "rule applied, added symlink(s) '%s'\n", temp); + pos = temp; + while (isspace(pos[0])) + pos++; + next = strchr(pos, ' '); + while (next != NULL) { + next[0] = '\0'; + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); + while (isspace(next[1])) + next++; + pos = &next[1]; + next = strchr(pos, ' '); + } + if (pos[0] != '\0') { + info(event->udev, "LINK '%s' %s:%u\n", pos, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(event->udev), "/", pos, NULL); + udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique); + } + break; + } + case TK_A_ATTR: { + const char *key_name = &rules->buf[cur->key.attr_off]; + char attr[UTIL_PATH_SIZE]; + char value[UTIL_NAME_SIZE]; + FILE *f; + + if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) + util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); + attr_subst_subdir(attr, sizeof(attr)); + + udev_event_apply_format(event, &rules->buf[cur->key.value_off], value, sizeof(value)); + info(event->udev, "ATTR '%s' writing '%s' %s:%u\n", attr, value, + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + f = fopen(attr, "w"); + if (f != NULL) { + if (fprintf(f, "%s", value) <= 0) + err(event->udev, "error writing ATTR{%s}: %m\n", attr); + fclose(f); + } else { + err(event->udev, "error opening ATTR{%s} for writing: %m\n", attr); + } + break; + } + case TK_A_RUN: { + if (cur->key.op == OP_ASSIGN || cur->key.op == OP_ASSIGN_FINAL) + udev_list_cleanup(&event->run_list); + info(event->udev, "RUN '%s' %s:%u\n", + &rules->buf[cur->key.value_off], + &rules->buf[rule->rule.filename_off], + rule->rule.filename_line); + udev_list_entry_add(&event->run_list, &rules->buf[cur->key.value_off], NULL); + break; + } + case TK_A_GOTO: + if (cur->key.rule_goto == 0) + break; + cur = &rules->tokens[cur->key.rule_goto]; + continue; + case TK_END: + return 0; + + case TK_M_PARENTS_MIN: + case TK_M_PARENTS_MAX: + case TK_M_MAX: + case TK_UNSET: + err(rules->udev, "wrong type %u\n", cur->type); + goto nomatch; + } + + cur++; + continue; + nomatch: + /* fast-forward to next rule */ + cur = rule + rule->rule.token_count; + dbg(rules->udev, "forward to rule: %u\n", + (unsigned int) (cur - rules->tokens)); + } } void udev_rules_apply_static_dev_perms(struct udev_rules *rules) { - struct token *cur; - struct token *rule; - uid_t uid = 0; - gid_t gid = 0; - mode_t mode = 0; - - if (rules->tokens == NULL) - return; - - cur = &rules->tokens[0]; - rule = cur; - for (;;) { - switch (cur->type) { - case TK_RULE: - /* current rule */ - rule = cur; - - /* skip rules without a static_node tag */ - if (!rule->rule.has_static_node) - goto next; - - uid = 0; - gid = 0; - mode = 0; - break; - case TK_A_OWNER_ID: - uid = cur->key.uid; - break; - case TK_A_GROUP_ID: - gid = cur->key.gid; - break; - case TK_A_MODE_ID: - mode = cur->key.mode; - break; - case TK_A_STATIC_NODE: { - char filename[UTIL_PATH_SIZE]; - struct stat stats; - - /* we assure, that the permissions tokens are sorted before the static token */ - if (mode == 0 && uid == 0 && gid == 0) - goto next; - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(rules->udev), "/", - &rules->buf[cur->key.value_off], NULL); - if (stat(filename, &stats) != 0) - goto next; - if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) - goto next; - if (mode == 0) { - if (gid > 0) - mode = 0660; - else - mode = 0600; - } - if (mode != (stats.st_mode & 01777)) { - chmod(filename, mode); - info(rules->udev, "chmod '%s' %#o\n", filename, mode); - } - - if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) { - chown(filename, uid, gid); - info(rules->udev, "chown '%s' %u %u\n", filename, uid, gid); - } - - utimensat(AT_FDCWD, filename, NULL, 0); - break; - } - case TK_END: - return; - } - - cur++; - continue; + struct token *cur; + struct token *rule; + uid_t uid = 0; + gid_t gid = 0; + mode_t mode = 0; + + if (rules->tokens == NULL) + return; + + cur = &rules->tokens[0]; + rule = cur; + for (;;) { + switch (cur->type) { + case TK_RULE: + /* current rule */ + rule = cur; + + /* skip rules without a static_node tag */ + if (!rule->rule.has_static_node) + goto next; + + uid = 0; + gid = 0; + mode = 0; + break; + case TK_A_OWNER_ID: + uid = cur->key.uid; + break; + case TK_A_GROUP_ID: + gid = cur->key.gid; + break; + case TK_A_MODE_ID: + mode = cur->key.mode; + break; + case TK_A_STATIC_NODE: { + char filename[UTIL_PATH_SIZE]; + struct stat stats; + + /* we assure, that the permissions tokens are sorted before the static token */ + if (mode == 0 && uid == 0 && gid == 0) + goto next; + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(rules->udev), "/", + &rules->buf[cur->key.value_off], NULL); + if (stat(filename, &stats) != 0) + goto next; + if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) + goto next; + if (mode == 0) { + if (gid > 0) + mode = 0660; + else + mode = 0600; + } + if (mode != (stats.st_mode & 01777)) { + chmod(filename, mode); + info(rules->udev, "chmod '%s' %#o\n", filename, mode); + } + + if ((uid != 0 && uid != stats.st_uid) || (gid != 0 && gid != stats.st_gid)) { + chown(filename, uid, gid); + info(rules->udev, "chown '%s' %u %u\n", filename, uid, gid); + } + + utimensat(AT_FDCWD, filename, NULL, 0); + break; + } + case TK_END: + return; + } + + cur++; + continue; next: - /* fast-forward to next rule */ - cur = rule + rule->rule.token_count; - continue; - } + /* fast-forward to next rule */ + cur = rule + rule->rule.token_count; + continue; + } } diff --git a/src/udev-watch.c b/src/udev-watch.c index 0ec8bfd627..228d18fedf 100644 --- a/src/udev-watch.c +++ b/src/udev-watch.c @@ -38,10 +38,10 @@ static int inotify_fd = -1; */ int udev_watch_init(struct udev *udev) { - inotify_fd = inotify_init1(IN_CLOEXEC); - if (inotify_fd < 0) - err(udev, "inotify_init failed: %m\n"); - return inotify_fd; + inotify_fd = inotify_init1(IN_CLOEXEC); + if (inotify_fd < 0) + err(udev, "inotify_init failed: %m\n"); + return inotify_fd; } /* move any old watches directory out of the way, and then restore @@ -49,122 +49,122 @@ int udev_watch_init(struct udev *udev) */ void udev_watch_restore(struct udev *udev) { - char filename[UTIL_PATH_SIZE], oldname[UTIL_PATH_SIZE]; - - if (inotify_fd < 0) - return; - - util_strscpyl(oldname, sizeof(oldname), udev_get_run_path(udev), "/watch.old", NULL); - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); - if (rename(filename, oldname) == 0) { - DIR *dir; - struct dirent *ent; - - dir = opendir(oldname); - if (dir == NULL) { - err(udev, "unable to open old watches dir '%s', old watches will not be restored: %m", oldname); - return; - } - - for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) { - char device[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - struct udev_device *dev; - - if (ent->d_name[0] == '.') - continue; - - s = device; - l = util_strpcpy(&s, sizeof(device), udev_get_sys_path(udev)); - len = readlinkat(dirfd(dir), ent->d_name, s, l); - if (len <= 0 || len == (ssize_t)l) - goto unlink; - s[len] = '\0'; - - dev = udev_device_new_from_id_filename(udev, s); - if (dev == NULL) - goto unlink; - - info(udev, "restoring old watch on '%s'\n", udev_device_get_devnode(dev)); - udev_watch_begin(udev, dev); - udev_device_unref(dev); + char filename[UTIL_PATH_SIZE], oldname[UTIL_PATH_SIZE]; + + if (inotify_fd < 0) + return; + + util_strscpyl(oldname, sizeof(oldname), udev_get_run_path(udev), "/watch.old", NULL); + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); + if (rename(filename, oldname) == 0) { + DIR *dir; + struct dirent *ent; + + dir = opendir(oldname); + if (dir == NULL) { + err(udev, "unable to open old watches dir '%s', old watches will not be restored: %m", oldname); + return; + } + + for (ent = readdir(dir); ent != NULL; ent = readdir(dir)) { + char device[UTIL_PATH_SIZE]; + char *s; + size_t l; + ssize_t len; + struct udev_device *dev; + + if (ent->d_name[0] == '.') + continue; + + s = device; + l = util_strpcpy(&s, sizeof(device), udev_get_sys_path(udev)); + len = readlinkat(dirfd(dir), ent->d_name, s, l); + if (len <= 0 || len == (ssize_t)l) + goto unlink; + s[len] = '\0'; + + dev = udev_device_new_from_id_filename(udev, s); + if (dev == NULL) + goto unlink; + + info(udev, "restoring old watch on '%s'\n", udev_device_get_devnode(dev)); + udev_watch_begin(udev, dev); + udev_device_unref(dev); unlink: - unlinkat(dirfd(dir), ent->d_name, 0); - } + unlinkat(dirfd(dir), ent->d_name, 0); + } - closedir(dir); - rmdir(oldname); + closedir(dir); + rmdir(oldname); - } else if (errno != ENOENT) { - err(udev, "unable to move watches dir '%s', old watches will not be restored: %m", filename); - } + } else if (errno != ENOENT) { + err(udev, "unable to move watches dir '%s', old watches will not be restored: %m", filename); + } } void udev_watch_begin(struct udev *udev, struct udev_device *dev) { - char filename[UTIL_PATH_SIZE]; - int wd; - - if (inotify_fd < 0) - return; - - info(udev, "adding watch on '%s'\n", udev_device_get_devnode(dev)); - wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); - if (wd < 0) { - err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n", - inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); - return; - } - - snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); - util_create_path(udev, filename); - unlink(filename); - symlink(udev_device_get_id_filename(dev), filename); - - udev_device_set_watch_handle(dev, wd); + char filename[UTIL_PATH_SIZE]; + int wd; + + if (inotify_fd < 0) + return; + + info(udev, "adding watch on '%s'\n", udev_device_get_devnode(dev)); + wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); + if (wd < 0) { + err(udev, "inotify_add_watch(%d, %s, %o) failed: %m\n", + inotify_fd, udev_device_get_devnode(dev), IN_CLOSE_WRITE); + return; + } + + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); + util_create_path(udev, filename); + unlink(filename); + symlink(udev_device_get_id_filename(dev), filename); + + udev_device_set_watch_handle(dev, wd); } void udev_watch_end(struct udev *udev, struct udev_device *dev) { - int wd; - char filename[UTIL_PATH_SIZE]; + int wd; + char filename[UTIL_PATH_SIZE]; - if (inotify_fd < 0) - return; + if (inotify_fd < 0) + return; - wd = udev_device_get_watch_handle(dev); - if (wd < 0) - return; + wd = udev_device_get_watch_handle(dev); + if (wd < 0) + return; - info(udev, "removing watch on '%s'\n", udev_device_get_devnode(dev)); - inotify_rm_watch(inotify_fd, wd); + info(udev, "removing watch on '%s'\n", udev_device_get_devnode(dev)); + inotify_rm_watch(inotify_fd, wd); - snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); - unlink(filename); + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); + unlink(filename); - udev_device_set_watch_handle(dev, -1); + udev_device_set_watch_handle(dev, -1); } struct udev_device *udev_watch_lookup(struct udev *udev, int wd) { - char filename[UTIL_PATH_SIZE]; - char majmin[UTIL_PATH_SIZE]; - char *s; - size_t l; - ssize_t len; - - if (inotify_fd < 0 || wd < 0) - return NULL; - - snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); - s = majmin; - l = util_strpcpy(&s, sizeof(majmin), udev_get_sys_path(udev)); - len = readlink(filename, s, l); - if (len <= 0 || (size_t)len == l) - return NULL; - s[len] = '\0'; - - return udev_device_new_from_id_filename(udev, s); + char filename[UTIL_PATH_SIZE]; + char majmin[UTIL_PATH_SIZE]; + char *s; + size_t l; + ssize_t len; + + if (inotify_fd < 0 || wd < 0) + return NULL; + + snprintf(filename, sizeof(filename), "%s/watch/%d", udev_get_run_path(udev), wd); + s = majmin; + l = util_strpcpy(&s, sizeof(majmin), udev_get_sys_path(udev)); + len = readlink(filename, s, l); + if (len <= 0 || (size_t)len == l) + return NULL; + s[len] = '\0'; + + return udev_device_new_from_id_filename(udev, s); } diff --git a/src/udev.h b/src/udev.h index 56b1652c74..9ed6804fe7 100644 --- a/src/udev.h +++ b/src/udev.h @@ -27,38 +27,38 @@ #include "libudev-private.h" struct udev_event { - struct udev *udev; - struct udev_device *dev; - struct udev_device *dev_parent; - struct udev_device *dev_db; - char *name; - char *program_result; - mode_t mode; - uid_t uid; - gid_t gid; - struct udev_list run_list; - int exec_delay; - unsigned long long birth_usec; - unsigned long long timeout_usec; - int fd_signal; - unsigned int builtin_run; - unsigned int builtin_ret; - bool sigterm; - bool inotify_watch; - bool inotify_watch_final; - bool group_final; - bool owner_final; - bool mode_set; - bool mode_final; - bool name_final; - bool devlink_final; - bool run_final; + struct udev *udev; + struct udev_device *dev; + struct udev_device *dev_parent; + struct udev_device *dev_db; + char *name; + char *program_result; + mode_t mode; + uid_t uid; + gid_t gid; + struct udev_list run_list; + int exec_delay; + unsigned long long birth_usec; + unsigned long long timeout_usec; + int fd_signal; + unsigned int builtin_run; + unsigned int builtin_ret; + bool sigterm; + bool inotify_watch; + bool inotify_watch_final; + bool group_final; + bool owner_final; + bool mode_set; + bool mode_final; + bool name_final; + bool devlink_final; + bool run_final; }; struct udev_watch { - struct udev_list_node node; - int handle; - char *name; + struct udev_list_node node; + int handle; + char *name; }; /* udev-rules.c */ @@ -73,10 +73,10 @@ struct udev_event *udev_event_new(struct udev_device *dev); void udev_event_unref(struct udev_event *event); size_t udev_event_apply_format(struct udev_event *event, const char *src, char *dest, size_t size); int udev_event_apply_subsys_kernel(struct udev_event *event, const char *string, - char *result, size_t maxsize, int read_value); + char *result, size_t maxsize, int read_value); int udev_event_spawn(struct udev_event *event, - const char *cmd, char **envp, const sigset_t *sigmask, - char *result, size_t ressize); + const char *cmd, char **envp, const sigset_t *sigmask, + char *result, size_t ressize); int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, const sigset_t *sigset); int udev_event_execute_run(struct udev_event *event, const sigset_t *sigset); int udev_build_argv(struct udev *udev, char *cmd, int *argc, char *argv[]); @@ -130,24 +130,24 @@ int udev_ctrl_get_set_children_max(struct udev_ctrl_msg *ctrl_msg); /* built-in commands */ enum udev_builtin_cmd { - UDEV_BUILTIN_BLKID, - UDEV_BUILTIN_FIRMWARE, - UDEV_BUILTIN_INPUT_ID, - UDEV_BUILTIN_KMOD, - UDEV_BUILTIN_PATH_ID, - UDEV_BUILTIN_PCI_DB, - UDEV_BUILTIN_USB_DB, - UDEV_BUILTIN_USB_ID, - UDEV_BUILTIN_MAX + UDEV_BUILTIN_BLKID, + UDEV_BUILTIN_FIRMWARE, + UDEV_BUILTIN_INPUT_ID, + UDEV_BUILTIN_KMOD, + UDEV_BUILTIN_PATH_ID, + UDEV_BUILTIN_PCI_DB, + UDEV_BUILTIN_USB_DB, + UDEV_BUILTIN_USB_ID, + UDEV_BUILTIN_MAX }; struct udev_builtin { - const char *name; - int (*cmd)(struct udev_device *dev, int argc, char *argv[], bool test); - const char *help; - int (*init)(struct udev *udev); - void (*exit)(struct udev *udev); - bool (*validate)(struct udev *udev); - bool run_once; + const char *name; + int (*cmd)(struct udev_device *dev, int argc, char *argv[], bool test); + const char *help; + int (*init)(struct udev *udev); + void (*exit)(struct udev *udev); + bool (*validate)(struct udev *udev); + bool run_once; }; extern const struct udev_builtin udev_builtin_blkid; extern const struct udev_builtin udev_builtin_firmware; @@ -168,15 +168,15 @@ int udev_builtin_add_property(struct udev_device *dev, bool test, const char *ke /* udev logging */ void udev_main_log(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args); + const char *file, int line, const char *fn, + const char *format, va_list args); /* udevadm commands */ struct udevadm_cmd { - const char *name; - int (*cmd)(struct udev *udev, int argc, char *argv[]); - const char *help; - int debug; + const char *name; + int (*cmd)(struct udev *udev, int argc, char *argv[]); + const char *help; + int debug; }; extern const struct udevadm_cmd udevadm_info; extern const struct udevadm_cmd udevadm_trigger; diff --git a/src/udevadm-control.c b/src/udevadm-control.c index dd1d5d783f..cafa214944 100644 --- a/src/udevadm-control.c +++ b/src/udevadm-control.c @@ -29,147 +29,147 @@ static void print_help(void) { - printf("Usage: udevadm control COMMAND\n" - " --exit instruct the daemon to cleanup and exit\n" - " --log-priority= set the udev log level for the daemon\n" - " --stop-exec-queue do not execute events, queue only\n" - " --start-exec-queue execute events, flush queue\n" - " --reload reload rules and databases\n" - " --property== set a global property for all events\n" - " --children-max= maximum number of children\n" - " --timeout= maximum time to block for a reply\n" - " --help print this help text\n\n"); + printf("Usage: udevadm control COMMAND\n" + " --exit instruct the daemon to cleanup and exit\n" + " --log-priority= set the udev log level for the daemon\n" + " --stop-exec-queue do not execute events, queue only\n" + " --start-exec-queue execute events, flush queue\n" + " --reload reload rules and databases\n" + " --property== set a global property for all events\n" + " --children-max= maximum number of children\n" + " --timeout= maximum time to block for a reply\n" + " --help print this help text\n\n"); } static int adm_control(struct udev *udev, int argc, char *argv[]) { - struct udev_ctrl *uctrl = NULL; - int timeout = 60; - int rc = 1; + struct udev_ctrl *uctrl = NULL; + int timeout = 60; + int rc = 1; - static const struct option options[] = { - { "exit", no_argument, NULL, 'e' }, - { "log-priority", required_argument, NULL, 'l' }, - { "stop-exec-queue", no_argument, NULL, 's' }, - { "start-exec-queue", no_argument, NULL, 'S' }, - { "reload", no_argument, NULL, 'R' }, - { "reload-rules", no_argument, NULL, 'R' }, - { "property", required_argument, NULL, 'p' }, - { "env", required_argument, NULL, 'p' }, - { "children-max", required_argument, NULL, 'm' }, - { "timeout", required_argument, NULL, 't' }, - { "help", no_argument, NULL, 'h' }, - {} - }; + static const struct option options[] = { + { "exit", no_argument, NULL, 'e' }, + { "log-priority", required_argument, NULL, 'l' }, + { "stop-exec-queue", no_argument, NULL, 's' }, + { "start-exec-queue", no_argument, NULL, 'S' }, + { "reload", no_argument, NULL, 'R' }, + { "reload-rules", no_argument, NULL, 'R' }, + { "property", required_argument, NULL, 'p' }, + { "env", required_argument, NULL, 'p' }, + { "children-max", required_argument, NULL, 'm' }, + { "timeout", required_argument, NULL, 't' }, + { "help", no_argument, NULL, 'h' }, + {} + }; - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - return 1; - } + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); + return 1; + } - uctrl = udev_ctrl_new(udev); - if (uctrl == NULL) - return 2; + uctrl = udev_ctrl_new(udev); + if (uctrl == NULL) + return 2; - for (;;) { - int option; + for (;;) { + int option; - option = getopt_long(argc, argv, "el:sSRp:m:h", options, NULL); - if (option == -1) - break; + option = getopt_long(argc, argv, "el:sSRp:m:h", options, NULL); + if (option == -1) + break; - switch (option) { - case 'e': - if (udev_ctrl_send_exit(uctrl, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'l': { - int i; + switch (option) { + case 'e': + if (udev_ctrl_send_exit(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'l': { + int i; - i = util_log_priority(optarg); - if (i < 0) { - fprintf(stderr, "invalid number '%s'\n", optarg); - goto out; - } - if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg), timeout) < 0) - rc = 2; - else - rc = 0; - break; - } - case 's': - if (udev_ctrl_send_stop_exec_queue(uctrl, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'S': - if (udev_ctrl_send_start_exec_queue(uctrl, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'R': - if (udev_ctrl_send_reload(uctrl, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'p': - if (strchr(optarg, '=') == NULL) { - fprintf(stderr, "expect = instead of '%s'\n", optarg); - goto out; - } - if (udev_ctrl_send_set_env(uctrl, optarg, timeout) < 0) - rc = 2; - else - rc = 0; - break; - case 'm': { - char *endp; - int i; + i = util_log_priority(optarg); + if (i < 0) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto out; + } + if (udev_ctrl_send_set_log_level(uctrl, util_log_priority(optarg), timeout) < 0) + rc = 2; + else + rc = 0; + break; + } + case 's': + if (udev_ctrl_send_stop_exec_queue(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'S': + if (udev_ctrl_send_start_exec_queue(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'R': + if (udev_ctrl_send_reload(uctrl, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'p': + if (strchr(optarg, '=') == NULL) { + fprintf(stderr, "expect = instead of '%s'\n", optarg); + goto out; + } + if (udev_ctrl_send_set_env(uctrl, optarg, timeout) < 0) + rc = 2; + else + rc = 0; + break; + case 'm': { + char *endp; + int i; - i = strtoul(optarg, &endp, 0); - if (endp[0] != '\0' || i < 1) { - fprintf(stderr, "invalid number '%s'\n", optarg); - goto out; - } - if (udev_ctrl_send_set_children_max(uctrl, i, timeout) < 0) - rc = 2; - else - rc = 0; - break; - } - case 't': { - int seconds; + i = strtoul(optarg, &endp, 0); + if (endp[0] != '\0' || i < 1) { + fprintf(stderr, "invalid number '%s'\n", optarg); + goto out; + } + if (udev_ctrl_send_set_children_max(uctrl, i, timeout) < 0) + rc = 2; + else + rc = 0; + break; + } + case 't': { + int seconds; - seconds = atoi(optarg); - if (seconds >= 0) - timeout = seconds; - else - fprintf(stderr, "invalid timeout value\n"); - break; - } - case 'h': - print_help(); - rc = 0; - break; - } - } + seconds = atoi(optarg); + if (seconds >= 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); + break; + } + case 'h': + print_help(); + rc = 0; + break; + } + } - if (argv[optind] != NULL) - fprintf(stderr, "unknown option\n"); - else if (optind == 1) - fprintf(stderr, "missing option\n"); + if (argv[optind] != NULL) + fprintf(stderr, "unknown option\n"); + else if (optind == 1) + fprintf(stderr, "missing option\n"); out: - udev_ctrl_unref(uctrl); - return rc; + udev_ctrl_unref(uctrl); + return rc; } const struct udevadm_cmd udevadm_control = { - .name = "control", - .cmd = adm_control, - .help = "control the udev daemon", + .name = "control", + .cmd = adm_control, + .help = "control the udev daemon", }; diff --git a/src/udevadm-info.c b/src/udevadm-info.c index f7e7e86b6a..ee9b59fea8 100644 --- a/src/udevadm-info.c +++ b/src/udevadm-info.c @@ -33,536 +33,536 @@ static bool skip_attribute(const char *name) { - static const char const *skip[] = { - "uevent", - "dev", - "modalias", - "resource", - "driver", - "subsystem", - "module", - }; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(skip); i++) - if (strcmp(name, skip[i]) == 0) - return true; - return false; + static const char const *skip[] = { + "uevent", + "dev", + "modalias", + "resource", + "driver", + "subsystem", + "module", + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(skip); i++) + if (strcmp(name, skip[i]) == 0) + return true; + return false; } static void print_all_attributes(struct udev_device *device, const char *key) { - struct udev *udev = udev_device_get_udev(device); - struct udev_list_entry *sysattr; - - udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { - const char *name; - const char *value; - size_t len; - - name = udev_list_entry_get_name(sysattr); - if (skip_attribute(name)) - continue; - - value = udev_device_get_sysattr_value(device, name); - if (value == NULL) - continue; - dbg(udev, "attr '%s'='%s'\n", name, value); - - /* skip any values that look like a path */ - if (value[0] == '/') - continue; - - /* skip nonprintable attributes */ - len = strlen(value); - while (len > 0 && isprint(value[len-1])) - len--; - if (len > 0) { - dbg(udev, "attribute value of '%s' non-printable, skip\n", name); - continue; - } - - printf(" %s{%s}==\"%s\"\n", key, name, value); - } - printf("\n"); + struct udev *udev = udev_device_get_udev(device); + struct udev_list_entry *sysattr; + + udev_list_entry_foreach(sysattr, udev_device_get_sysattr_list_entry(device)) { + const char *name; + const char *value; + size_t len; + + name = udev_list_entry_get_name(sysattr); + if (skip_attribute(name)) + continue; + + value = udev_device_get_sysattr_value(device, name); + if (value == NULL) + continue; + dbg(udev, "attr '%s'='%s'\n", name, value); + + /* skip any values that look like a path */ + if (value[0] == '/') + continue; + + /* skip nonprintable attributes */ + len = strlen(value); + while (len > 0 && isprint(value[len-1])) + len--; + if (len > 0) { + dbg(udev, "attribute value of '%s' non-printable, skip\n", name); + continue; + } + + printf(" %s{%s}==\"%s\"\n", key, name, value); + } + printf("\n"); } static int print_device_chain(struct udev_device *device) { - struct udev_device *device_parent; - const char *str; - - printf("\n" - "Udevadm info starts with the device specified by the devpath and then\n" - "walks up the chain of parent devices. It prints for every device\n" - "found, all possible attributes in the udev rules key format.\n" - "A rule to match, can be composed by the attributes of the device\n" - "and the attributes from one single parent device.\n" - "\n"); - - printf(" looking at device '%s':\n", udev_device_get_devpath(device)); - printf(" KERNEL==\"%s\"\n", udev_device_get_sysname(device)); - str = udev_device_get_subsystem(device); - if (str == NULL) - str = ""; - printf(" SUBSYSTEM==\"%s\"\n", str); - str = udev_device_get_driver(device); - if (str == NULL) - str = ""; - printf(" DRIVER==\"%s\"\n", str); - print_all_attributes(device, "ATTR"); - - device_parent = device; - do { - device_parent = udev_device_get_parent(device_parent); - if (device_parent == NULL) - break; - printf(" looking at parent device '%s':\n", udev_device_get_devpath(device_parent)); - printf(" KERNELS==\"%s\"\n", udev_device_get_sysname(device_parent)); - str = udev_device_get_subsystem(device_parent); - if (str == NULL) - str = ""; - printf(" SUBSYSTEMS==\"%s\"\n", str); - str = udev_device_get_driver(device_parent); - if (str == NULL) - str = ""; - printf(" DRIVERS==\"%s\"\n", str); - print_all_attributes(device_parent, "ATTRS"); - } while (device_parent != NULL); - - return 0; + struct udev_device *device_parent; + const char *str; + + printf("\n" + "Udevadm info starts with the device specified by the devpath and then\n" + "walks up the chain of parent devices. It prints for every device\n" + "found, all possible attributes in the udev rules key format.\n" + "A rule to match, can be composed by the attributes of the device\n" + "and the attributes from one single parent device.\n" + "\n"); + + printf(" looking at device '%s':\n", udev_device_get_devpath(device)); + printf(" KERNEL==\"%s\"\n", udev_device_get_sysname(device)); + str = udev_device_get_subsystem(device); + if (str == NULL) + str = ""; + printf(" SUBSYSTEM==\"%s\"\n", str); + str = udev_device_get_driver(device); + if (str == NULL) + str = ""; + printf(" DRIVER==\"%s\"\n", str); + print_all_attributes(device, "ATTR"); + + device_parent = device; + do { + device_parent = udev_device_get_parent(device_parent); + if (device_parent == NULL) + break; + printf(" looking at parent device '%s':\n", udev_device_get_devpath(device_parent)); + printf(" KERNELS==\"%s\"\n", udev_device_get_sysname(device_parent)); + str = udev_device_get_subsystem(device_parent); + if (str == NULL) + str = ""; + printf(" SUBSYSTEMS==\"%s\"\n", str); + str = udev_device_get_driver(device_parent); + if (str == NULL) + str = ""; + printf(" DRIVERS==\"%s\"\n", str); + print_all_attributes(device_parent, "ATTRS"); + } while (device_parent != NULL); + + return 0; } static void print_record(struct udev_device *device) { - size_t len; - const char *str; - int i; - struct udev_list_entry *list_entry; - - printf("P: %s\n", udev_device_get_devpath(device)); - - len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - str = udev_device_get_devnode(device); - if (str != NULL) - printf("N: %s\n", &str[len+1]); - - i = udev_device_get_devlink_priority(device); - if (i != 0) - printf("L: %i\n", i); - - udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { - len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("S: %s\n", &udev_list_entry_get_name(list_entry)[len+1]); - } - - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) - printf("E: %s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - printf("\n"); + size_t len; + const char *str; + int i; + struct udev_list_entry *list_entry; + + printf("P: %s\n", udev_device_get_devpath(device)); + + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + str = udev_device_get_devnode(device); + if (str != NULL) + printf("N: %s\n", &str[len+1]); + + i = udev_device_get_devlink_priority(device); + if (i != 0) + printf("L: %i\n", i); + + udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(device)) { + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + printf("S: %s\n", &udev_list_entry_get_name(list_entry)[len+1]); + } + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) + printf("E: %s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + printf("\n"); } static int stat_device(const char *name, bool export, const char *prefix) { - struct stat statbuf; - - if (stat(name, &statbuf) != 0) - return -1; - - if (export) { - if (prefix == NULL) - prefix = "INFO_"; - printf("%sMAJOR=%d\n" - "%sMINOR=%d\n", - prefix, major(statbuf.st_dev), - prefix, minor(statbuf.st_dev)); - } else - printf("%d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); - return 0; + struct stat statbuf; + + if (stat(name, &statbuf) != 0) + return -1; + + if (export) { + if (prefix == NULL) + prefix = "INFO_"; + printf("%sMAJOR=%d\n" + "%sMINOR=%d\n", + prefix, major(statbuf.st_dev), + prefix, minor(statbuf.st_dev)); + } else + printf("%d:%d\n", major(statbuf.st_dev), minor(statbuf.st_dev)); + return 0; } static int export_devices(struct udev *udev) { - struct udev_enumerate *udev_enumerate; - struct udev_list_entry *list_entry; - - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_devices(udev_enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device != NULL) { - print_record(device); - udev_device_unref(device); - } - } - udev_enumerate_unref(udev_enumerate); - return 0; + struct udev_enumerate *udev_enumerate; + struct udev_list_entry *list_entry; + + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_devices(udev_enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + if (device != NULL) { + print_record(device); + udev_device_unref(device); + } + } + udev_enumerate_unref(udev_enumerate); + return 0; } static void cleanup_dir(DIR *dir, mode_t mask, int depth) { - struct dirent *dent; - - if (depth <= 0) - return; - - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - struct stat stats; - - if (dent->d_name[0] == '.') - continue; - if (fstatat(dirfd(dir), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) - continue; - if ((stats.st_mode & mask) != 0) - continue; - if (S_ISDIR(stats.st_mode)) { - DIR *dir2; - - dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); - if (dir2 != NULL) { - cleanup_dir(dir2, mask, depth-1); - closedir(dir2); - } - unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR); - } else { - unlinkat(dirfd(dir), dent->d_name, 0); - } - } + struct dirent *dent; + + if (depth <= 0) + return; + + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + if (fstatat(dirfd(dir), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) + continue; + if ((stats.st_mode & mask) != 0) + continue; + if (S_ISDIR(stats.st_mode)) { + DIR *dir2; + + dir2 = fdopendir(openat(dirfd(dir), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2 != NULL) { + cleanup_dir(dir2, mask, depth-1); + closedir(dir2); + } + unlinkat(dirfd(dir), dent->d_name, AT_REMOVEDIR); + } else { + unlinkat(dirfd(dir), dent->d_name, 0); + } + } } static void cleanup_db(struct udev *udev) { - char filename[UTIL_PATH_SIZE]; - DIR *dir; - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/queue.bin", NULL); - unlink(filename); - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, S_ISVTX, 1); - closedir(dir); - } - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/links", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, 0, 2); - closedir(dir); - } - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, 0, 2); - closedir(dir); - } - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, 0, 1); - closedir(dir); - } - - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/firmware-missing", NULL); - dir = opendir(filename); - if (dir != NULL) { - cleanup_dir(dir, 0, 1); - closedir(dir); - } + char filename[UTIL_PATH_SIZE]; + DIR *dir; + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/queue.bin", NULL); + unlink(filename); + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, S_ISVTX, 1); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/links", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 2); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/tags", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 2); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/watch", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 1); + closedir(dir); + } + + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/firmware-missing", NULL); + dir = opendir(filename); + if (dir != NULL) { + cleanup_dir(dir, 0, 1); + closedir(dir); + } } static int uinfo(struct udev *udev, int argc, char *argv[]) { - struct udev_device *device = NULL; - bool root = 0; - bool export = 0; - const char *export_prefix = NULL; - char path[UTIL_PATH_SIZE]; - char name[UTIL_PATH_SIZE]; - struct udev_list_entry *list_entry; - int rc = 0; - - static const struct option options[] = { - { "name", required_argument, NULL, 'n' }, - { "path", required_argument, NULL, 'p' }, - { "query", required_argument, NULL, 'q' }, - { "attribute-walk", no_argument, NULL, 'a' }, - { "cleanup-db", no_argument, NULL, 'c' }, - { "export-db", no_argument, NULL, 'e' }, - { "root", no_argument, NULL, 'r' }, - { "run", no_argument, NULL, 'R' }, - { "device-id-of-file", required_argument, NULL, 'd' }, - { "export", no_argument, NULL, 'x' }, - { "export-prefix", required_argument, NULL, 'P' }, - { "version", no_argument, NULL, 'V' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - enum action_type { - ACTION_NONE, - ACTION_QUERY, - ACTION_ATTRIBUTE_WALK, - ACTION_ROOT, - ACTION_DEVICE_ID_FILE, - } action = ACTION_NONE; - - enum query_type { - QUERY_NONE, - QUERY_NAME, - QUERY_PATH, - QUERY_SYMLINK, - QUERY_PROPERTY, - QUERY_ALL, - } query = QUERY_NONE; - - for (;;) { - int option; - struct stat statbuf; - - option = getopt_long(argc, argv, "aced:n:p:q:rxP:RVh", options, NULL); - if (option == -1) - break; - - dbg(udev, "option '%c'\n", option); - switch (option) { - case 'n': - if (device != NULL) { - fprintf(stderr, "device already specified\n"); - rc = 2; - goto exit; - } - /* remove /dev if given */ - if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) - util_strscpyl(name, sizeof(name), udev_get_dev_path(udev), "/", optarg, NULL); - else - util_strscpy(name, sizeof(name), optarg); - util_remove_trailing_chars(name, '/'); - if (stat(name, &statbuf) < 0) { - fprintf(stderr, "device node not found\n"); - rc = 2; - goto exit; - } else { - char type; - - if (S_ISBLK(statbuf.st_mode)) { - type = 'b'; - } else if (S_ISCHR(statbuf.st_mode)) { - type = 'c'; - } else { - fprintf(stderr, "device node has wrong file type\n"); - rc = 2; - goto exit; - } - device = udev_device_new_from_devnum(udev, type, statbuf.st_rdev); - if (device == NULL) { - fprintf(stderr, "device node not found\n"); - rc = 2; - goto exit; - } - } - break; - case 'p': - if (device != NULL) { - fprintf(stderr, "device already specified\n"); - rc = 2; - goto exit; - } - /* add sys dir if needed */ - if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); - else - util_strscpy(path, sizeof(path), optarg); - util_remove_trailing_chars(path, '/'); - device = udev_device_new_from_syspath(udev, path); - if (device == NULL) { - fprintf(stderr, "device path not found\n"); - rc = 2; - goto exit; - } - break; - case 'q': - action = ACTION_QUERY; - if (strcmp(optarg, "property") == 0 || strcmp(optarg, "env") == 0) { - query = QUERY_PROPERTY; - } else if (strcmp(optarg, "name") == 0) { - query = QUERY_NAME; - } else if (strcmp(optarg, "symlink") == 0) { - query = QUERY_SYMLINK; - } else if (strcmp(optarg, "path") == 0) { - query = QUERY_PATH; - } else if (strcmp(optarg, "all") == 0) { - query = QUERY_ALL; - } else { - fprintf(stderr, "unknown query type\n"); - rc = 3; - goto exit; - } - break; - case 'r': - if (action == ACTION_NONE) - action = ACTION_ROOT; - root = true; - break; - case 'R': - printf("%s\n", udev_get_run_path(udev)); - goto exit; - case 'd': - action = ACTION_DEVICE_ID_FILE; - util_strscpy(name, sizeof(name), optarg); - break; - case 'a': - action = ACTION_ATTRIBUTE_WALK; - break; - case 'e': - export_devices(udev); - goto exit; - case 'c': - cleanup_db(udev); - goto exit; - case 'x': - export = true; - break; - case 'P': - export_prefix = optarg; - break; - case 'V': - printf("%s\n", VERSION); - goto exit; - case 'h': - printf("Usage: udevadm info OPTIONS\n" - " --query= query device information:\n" - " name name of device node\n" - " symlink pointing to node\n" - " path sys device path\n" - " property the device properties\n" - " all all values\n" - " --path= sys device path used for query or attribute walk\n" - " --name= node or symlink name used for query or attribute walk\n" - " --root prepend dev directory to path names\n" - " --attribute-walk print all key matches while walking along the chain\n" - " of parent devices\n" - " --device-id-of-file= print major:minor of device containing this file\n" - " --export export key/value pairs\n" - " --export-prefix export the key name with a prefix\n" - " --export-db export the content of the udev database\n" - " --cleanup-db cleanup the udev database\n" - " --help\n\n"); - goto exit; - default: - rc = 1; - goto exit; - } - } - - switch (action) { - case ACTION_QUERY: - if (device == NULL) { - fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); - rc = 4; - goto exit; - } - - switch(query) { - case QUERY_NAME: { - const char *node = udev_device_get_devnode(device); - - if (node == NULL) { - fprintf(stderr, "no device node found\n"); - rc = 5; - goto exit; - } - - if (root) { - printf("%s\n", udev_device_get_devnode(device)); - } else { - size_t len = strlen(udev_get_dev_path(udev)); - - printf("%s\n", &udev_device_get_devnode(device)[len+1]); - } - break; - } - case QUERY_SYMLINK: - list_entry = udev_device_get_devlinks_list_entry(device); - while (list_entry != NULL) { - if (root) { - printf("%s", udev_list_entry_get_name(list_entry)); - } else { - size_t len; - - len = strlen(udev_get_dev_path(udev_device_get_udev(device))); - printf("%s", &udev_list_entry_get_name(list_entry)[len+1]); - } - list_entry = udev_list_entry_get_next(list_entry); - if (list_entry != NULL) - printf(" "); - } - printf("\n"); - break; - case QUERY_PATH: - printf("%s\n", udev_device_get_devpath(device)); - goto exit; - case QUERY_PROPERTY: - list_entry = udev_device_get_properties_list_entry(device); - while (list_entry != NULL) { - if (export) { - const char *prefix = export_prefix; - - if (prefix == NULL) - prefix = ""; - printf("%s%s='%s'\n", prefix, - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - } else { - printf("%s=%s\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); - } - list_entry = udev_list_entry_get_next(list_entry); - } - break; - case QUERY_ALL: - print_record(device); - break; - default: - fprintf(stderr, "unknown query type\n"); - break; - } - break; - case ACTION_ATTRIBUTE_WALK: - if (device == NULL) { - fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); - rc = 4; - goto exit; - } - print_device_chain(device); - break; - case ACTION_DEVICE_ID_FILE: - if (stat_device(name, export, export_prefix) != 0) - rc = 1; - break; - case ACTION_ROOT: - printf("%s\n", udev_get_dev_path(udev)); - break; - default: - fprintf(stderr, "missing option\n"); - rc = 1; - break; - } + struct udev_device *device = NULL; + bool root = 0; + bool export = 0; + const char *export_prefix = NULL; + char path[UTIL_PATH_SIZE]; + char name[UTIL_PATH_SIZE]; + struct udev_list_entry *list_entry; + int rc = 0; + + static const struct option options[] = { + { "name", required_argument, NULL, 'n' }, + { "path", required_argument, NULL, 'p' }, + { "query", required_argument, NULL, 'q' }, + { "attribute-walk", no_argument, NULL, 'a' }, + { "cleanup-db", no_argument, NULL, 'c' }, + { "export-db", no_argument, NULL, 'e' }, + { "root", no_argument, NULL, 'r' }, + { "run", no_argument, NULL, 'R' }, + { "device-id-of-file", required_argument, NULL, 'd' }, + { "export", no_argument, NULL, 'x' }, + { "export-prefix", required_argument, NULL, 'P' }, + { "version", no_argument, NULL, 'V' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + enum action_type { + ACTION_NONE, + ACTION_QUERY, + ACTION_ATTRIBUTE_WALK, + ACTION_ROOT, + ACTION_DEVICE_ID_FILE, + } action = ACTION_NONE; + + enum query_type { + QUERY_NONE, + QUERY_NAME, + QUERY_PATH, + QUERY_SYMLINK, + QUERY_PROPERTY, + QUERY_ALL, + } query = QUERY_NONE; + + for (;;) { + int option; + struct stat statbuf; + + option = getopt_long(argc, argv, "aced:n:p:q:rxP:RVh", options, NULL); + if (option == -1) + break; + + dbg(udev, "option '%c'\n", option); + switch (option) { + case 'n': + if (device != NULL) { + fprintf(stderr, "device already specified\n"); + rc = 2; + goto exit; + } + /* remove /dev if given */ + if (strncmp(optarg, udev_get_dev_path(udev), strlen(udev_get_dev_path(udev))) != 0) + util_strscpyl(name, sizeof(name), udev_get_dev_path(udev), "/", optarg, NULL); + else + util_strscpy(name, sizeof(name), optarg); + util_remove_trailing_chars(name, '/'); + if (stat(name, &statbuf) < 0) { + fprintf(stderr, "device node not found\n"); + rc = 2; + goto exit; + } else { + char type; + + if (S_ISBLK(statbuf.st_mode)) { + type = 'b'; + } else if (S_ISCHR(statbuf.st_mode)) { + type = 'c'; + } else { + fprintf(stderr, "device node has wrong file type\n"); + rc = 2; + goto exit; + } + device = udev_device_new_from_devnum(udev, type, statbuf.st_rdev); + if (device == NULL) { + fprintf(stderr, "device node not found\n"); + rc = 2; + goto exit; + } + } + break; + case 'p': + if (device != NULL) { + fprintf(stderr, "device already specified\n"); + rc = 2; + goto exit; + } + /* add sys dir if needed */ + if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); + else + util_strscpy(path, sizeof(path), optarg); + util_remove_trailing_chars(path, '/'); + device = udev_device_new_from_syspath(udev, path); + if (device == NULL) { + fprintf(stderr, "device path not found\n"); + rc = 2; + goto exit; + } + break; + case 'q': + action = ACTION_QUERY; + if (strcmp(optarg, "property") == 0 || strcmp(optarg, "env") == 0) { + query = QUERY_PROPERTY; + } else if (strcmp(optarg, "name") == 0) { + query = QUERY_NAME; + } else if (strcmp(optarg, "symlink") == 0) { + query = QUERY_SYMLINK; + } else if (strcmp(optarg, "path") == 0) { + query = QUERY_PATH; + } else if (strcmp(optarg, "all") == 0) { + query = QUERY_ALL; + } else { + fprintf(stderr, "unknown query type\n"); + rc = 3; + goto exit; + } + break; + case 'r': + if (action == ACTION_NONE) + action = ACTION_ROOT; + root = true; + break; + case 'R': + printf("%s\n", udev_get_run_path(udev)); + goto exit; + case 'd': + action = ACTION_DEVICE_ID_FILE; + util_strscpy(name, sizeof(name), optarg); + break; + case 'a': + action = ACTION_ATTRIBUTE_WALK; + break; + case 'e': + export_devices(udev); + goto exit; + case 'c': + cleanup_db(udev); + goto exit; + case 'x': + export = true; + break; + case 'P': + export_prefix = optarg; + break; + case 'V': + printf("%s\n", VERSION); + goto exit; + case 'h': + printf("Usage: udevadm info OPTIONS\n" + " --query= query device information:\n" + " name name of device node\n" + " symlink pointing to node\n" + " path sys device path\n" + " property the device properties\n" + " all all values\n" + " --path= sys device path used for query or attribute walk\n" + " --name= node or symlink name used for query or attribute walk\n" + " --root prepend dev directory to path names\n" + " --attribute-walk print all key matches while walking along the chain\n" + " of parent devices\n" + " --device-id-of-file= print major:minor of device containing this file\n" + " --export export key/value pairs\n" + " --export-prefix export the key name with a prefix\n" + " --export-db export the content of the udev database\n" + " --cleanup-db cleanup the udev database\n" + " --help\n\n"); + goto exit; + default: + rc = 1; + goto exit; + } + } + + switch (action) { + case ACTION_QUERY: + if (device == NULL) { + fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); + rc = 4; + goto exit; + } + + switch(query) { + case QUERY_NAME: { + const char *node = udev_device_get_devnode(device); + + if (node == NULL) { + fprintf(stderr, "no device node found\n"); + rc = 5; + goto exit; + } + + if (root) { + printf("%s\n", udev_device_get_devnode(device)); + } else { + size_t len = strlen(udev_get_dev_path(udev)); + + printf("%s\n", &udev_device_get_devnode(device)[len+1]); + } + break; + } + case QUERY_SYMLINK: + list_entry = udev_device_get_devlinks_list_entry(device); + while (list_entry != NULL) { + if (root) { + printf("%s", udev_list_entry_get_name(list_entry)); + } else { + size_t len; + + len = strlen(udev_get_dev_path(udev_device_get_udev(device))); + printf("%s", &udev_list_entry_get_name(list_entry)[len+1]); + } + list_entry = udev_list_entry_get_next(list_entry); + if (list_entry != NULL) + printf(" "); + } + printf("\n"); + break; + case QUERY_PATH: + printf("%s\n", udev_device_get_devpath(device)); + goto exit; + case QUERY_PROPERTY: + list_entry = udev_device_get_properties_list_entry(device); + while (list_entry != NULL) { + if (export) { + const char *prefix = export_prefix; + + if (prefix == NULL) + prefix = ""; + printf("%s%s='%s'\n", prefix, + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } else { + printf("%s=%s\n", udev_list_entry_get_name(list_entry), udev_list_entry_get_value(list_entry)); + } + list_entry = udev_list_entry_get_next(list_entry); + } + break; + case QUERY_ALL: + print_record(device); + break; + default: + fprintf(stderr, "unknown query type\n"); + break; + } + break; + case ACTION_ATTRIBUTE_WALK: + if (device == NULL) { + fprintf(stderr, "query needs a valid device specified by --path= or --name=\n"); + rc = 4; + goto exit; + } + print_device_chain(device); + break; + case ACTION_DEVICE_ID_FILE: + if (stat_device(name, export, export_prefix) != 0) + rc = 1; + break; + case ACTION_ROOT: + printf("%s\n", udev_get_dev_path(udev)); + break; + default: + fprintf(stderr, "missing option\n"); + rc = 1; + break; + } exit: - udev_device_unref(device); - return rc; + udev_device_unref(device); + return rc; } const struct udevadm_cmd udevadm_info = { - .name = "info", - .cmd = uinfo, - .help = "query sysfs or the udev database", + .name = "info", + .cmd = uinfo, + .help = "query sysfs or the udev database", }; diff --git a/src/udevadm-monitor.c b/src/udevadm-monitor.c index 64913dbd55..5997dd8e18 100644 --- a/src/udevadm-monitor.c +++ b/src/udevadm-monitor.c @@ -38,260 +38,260 @@ static bool udev_exit; static void sig_handler(int signum) { - if (signum == SIGINT || signum == SIGTERM) - udev_exit = true; + if (signum == SIGINT || signum == SIGTERM) + udev_exit = true; } static void print_device(struct udev_device *device, const char *source, int prop) { - struct timespec ts; - - clock_gettime(CLOCK_MONOTONIC, &ts); - printf("%-6s[%llu.%06u] %-8s %s (%s)\n", - source, - (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, - udev_device_get_action(device), - udev_device_get_devpath(device), - udev_device_get_subsystem(device)); - if (prop) { - struct udev_list_entry *list_entry; - - udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) - printf("%s=%s\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - printf("\n"); - } + struct timespec ts; + + clock_gettime(CLOCK_MONOTONIC, &ts); + printf("%-6s[%llu.%06u] %-8s %s (%s)\n", + source, + (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, + udev_device_get_action(device), + udev_device_get_devpath(device), + udev_device_get_subsystem(device)); + if (prop) { + struct udev_list_entry *list_entry; + + udev_list_entry_foreach(list_entry, udev_device_get_properties_list_entry(device)) + printf("%s=%s\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + printf("\n"); + } } static int adm_monitor(struct udev *udev, int argc, char *argv[]) { - struct sigaction act; - sigset_t mask; - int option; - bool prop = false; - bool print_kernel = false; - bool print_udev = false; - struct udev_list subsystem_match_list; - struct udev_list tag_match_list; - struct udev_monitor *udev_monitor = NULL; - struct udev_monitor *kernel_monitor = NULL; - int fd_ep = -1; - int fd_kernel = -1, fd_udev = -1; - struct epoll_event ep_kernel, ep_udev; - int rc = 0; - - static const struct option options[] = { - { "property", no_argument, NULL, 'p' }, - { "environment", no_argument, NULL, 'e' }, - { "kernel", no_argument, NULL, 'k' }, - { "udev", no_argument, NULL, 'u' }, - { "subsystem-match", required_argument, NULL, 's' }, - { "tag-match", required_argument, NULL, 't' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - udev_list_init(udev, &subsystem_match_list, true); - udev_list_init(udev, &tag_match_list, true); - - for (;;) { - option = getopt_long(argc, argv, "pekus:t:h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'p': - case 'e': - prop = true; - break; - case 'k': - print_kernel = true; - break; - case 'u': - print_udev = true; - break; - case 's': - { - char subsys[UTIL_NAME_SIZE]; - char *devtype; - - util_strscpy(subsys, sizeof(subsys), optarg); - devtype = strchr(subsys, '/'); - if (devtype != NULL) { - devtype[0] = '\0'; - devtype++; - } - udev_list_entry_add(&subsystem_match_list, subsys, devtype); - break; - } - case 't': - udev_list_entry_add(&tag_match_list, optarg, NULL); - break; - case 'h': - printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" - " --property print the event properties\n" - " --kernel print kernel uevents\n" - " --udev print udev events\n" - " --subsystem-match= filter events by subsystem\n" - " --tag-match= filter events by tag\n" - " --help\n\n"); - goto out; - default: - rc = 1; - goto out; - } - } - - if (!print_kernel && !print_udev) { - print_kernel = true; - print_udev = true; - } - - /* set signal handlers */ - memset(&act, 0x00, sizeof(struct sigaction)); - act.sa_handler = sig_handler; - sigemptyset(&act.sa_mask); - act.sa_flags = SA_RESTART; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); - sigemptyset(&mask); - sigaddset(&mask, SIGINT); - sigaddset(&mask, SIGTERM); - sigprocmask(SIG_UNBLOCK, &mask, NULL); - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - err(udev, "error creating epoll fd: %m\n"); - goto out; - } - - printf("monitor will print the received events for:\n"); - if (print_udev) { - struct udev_list_entry *entry; - - udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); - if (udev_monitor == NULL) { - fprintf(stderr, "error: unable to create netlink socket\n"); - rc = 1; - goto out; - } - udev_monitor_set_receive_buffer_size(udev_monitor, 128*1024*1024); - fd_udev = udev_monitor_get_fd(udev_monitor); - - udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { - const char *subsys = udev_list_entry_get_name(entry); - const char *devtype = udev_list_entry_get_value(entry); - - if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, subsys, devtype) < 0) - fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys); - } - - udev_list_entry_foreach(entry, udev_list_get_entry(&tag_match_list)) { - const char *tag = udev_list_entry_get_name(entry); - - if (udev_monitor_filter_add_match_tag(udev_monitor, tag) < 0) - fprintf(stderr, "error: unable to apply tag filter '%s'\n", tag); - } - - if (udev_monitor_enable_receiving(udev_monitor) < 0) { - fprintf(stderr, "error: unable to subscribe to udev events\n"); - rc = 2; - goto out; - } - - memset(&ep_udev, 0, sizeof(struct epoll_event)); - ep_udev.events = EPOLLIN; - ep_udev.data.fd = fd_udev; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - - printf("UDEV - the event which udev sends out after rule processing\n"); - } - - if (print_kernel) { - struct udev_list_entry *entry; - - kernel_monitor = udev_monitor_new_from_netlink(udev, "kernel"); - if (kernel_monitor == NULL) { - fprintf(stderr, "error: unable to create netlink socket\n"); - rc = 3; - goto out; - } - udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); - fd_kernel = udev_monitor_get_fd(kernel_monitor); - - udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { - const char *subsys = udev_list_entry_get_name(entry); - - if (udev_monitor_filter_add_match_subsystem_devtype(kernel_monitor, subsys, NULL) < 0) - fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys); - } - - if (udev_monitor_enable_receiving(kernel_monitor) < 0) { - fprintf(stderr, "error: unable to subscribe to kernel events\n"); - rc = 4; - goto out; - } - - memset(&ep_kernel, 0, sizeof(struct epoll_event)); - ep_kernel.events = EPOLLIN; - ep_kernel.data.fd = fd_kernel; - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) { - err(udev, "fail to add fd to epoll: %m\n"); - goto out; - } - - printf("KERNEL - the kernel uevent\n"); - } - printf("\n"); - - while (!udev_exit) { - int fdcount; - struct epoll_event ev[4]; - int i; - - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); - if (fdcount < 0) { - if (errno != EINTR) - fprintf(stderr, "error receiving uevent message: %m\n"); - continue; - } - - for (i = 0; i < fdcount; i++) { - if (ev[i].data.fd == fd_kernel && ev[i].events & EPOLLIN) { - struct udev_device *device; - - device = udev_monitor_receive_device(kernel_monitor); - if (device == NULL) - continue; - print_device(device, "KERNEL", prop); - udev_device_unref(device); - } else if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { - struct udev_device *device; - - device = udev_monitor_receive_device(udev_monitor); - if (device == NULL) - continue; - print_device(device, "UDEV", prop); - udev_device_unref(device); - } - } - } + struct sigaction act; + sigset_t mask; + int option; + bool prop = false; + bool print_kernel = false; + bool print_udev = false; + struct udev_list subsystem_match_list; + struct udev_list tag_match_list; + struct udev_monitor *udev_monitor = NULL; + struct udev_monitor *kernel_monitor = NULL; + int fd_ep = -1; + int fd_kernel = -1, fd_udev = -1; + struct epoll_event ep_kernel, ep_udev; + int rc = 0; + + static const struct option options[] = { + { "property", no_argument, NULL, 'p' }, + { "environment", no_argument, NULL, 'e' }, + { "kernel", no_argument, NULL, 'k' }, + { "udev", no_argument, NULL, 'u' }, + { "subsystem-match", required_argument, NULL, 's' }, + { "tag-match", required_argument, NULL, 't' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + udev_list_init(udev, &subsystem_match_list, true); + udev_list_init(udev, &tag_match_list, true); + + for (;;) { + option = getopt_long(argc, argv, "pekus:t:h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'p': + case 'e': + prop = true; + break; + case 'k': + print_kernel = true; + break; + case 'u': + print_udev = true; + break; + case 's': + { + char subsys[UTIL_NAME_SIZE]; + char *devtype; + + util_strscpy(subsys, sizeof(subsys), optarg); + devtype = strchr(subsys, '/'); + if (devtype != NULL) { + devtype[0] = '\0'; + devtype++; + } + udev_list_entry_add(&subsystem_match_list, subsys, devtype); + break; + } + case 't': + udev_list_entry_add(&tag_match_list, optarg, NULL); + break; + case 'h': + printf("Usage: udevadm monitor [--property] [--kernel] [--udev] [--help]\n" + " --property print the event properties\n" + " --kernel print kernel uevents\n" + " --udev print udev events\n" + " --subsystem-match= filter events by subsystem\n" + " --tag-match= filter events by tag\n" + " --help\n\n"); + goto out; + default: + rc = 1; + goto out; + } + } + + if (!print_kernel && !print_udev) { + print_kernel = true; + print_udev = true; + } + + /* set signal handlers */ + memset(&act, 0x00, sizeof(struct sigaction)); + act.sa_handler = sig_handler; + sigemptyset(&act.sa_mask); + act.sa_flags = SA_RESTART; + sigaction(SIGINT, &act, NULL); + sigaction(SIGTERM, &act, NULL); + sigemptyset(&mask); + sigaddset(&mask, SIGINT); + sigaddset(&mask, SIGTERM); + sigprocmask(SIG_UNBLOCK, &mask, NULL); + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto out; + } + + printf("monitor will print the received events for:\n"); + if (print_udev) { + struct udev_list_entry *entry; + + udev_monitor = udev_monitor_new_from_netlink(udev, "udev"); + if (udev_monitor == NULL) { + fprintf(stderr, "error: unable to create netlink socket\n"); + rc = 1; + goto out; + } + udev_monitor_set_receive_buffer_size(udev_monitor, 128*1024*1024); + fd_udev = udev_monitor_get_fd(udev_monitor); + + udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { + const char *subsys = udev_list_entry_get_name(entry); + const char *devtype = udev_list_entry_get_value(entry); + + if (udev_monitor_filter_add_match_subsystem_devtype(udev_monitor, subsys, devtype) < 0) + fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys); + } + + udev_list_entry_foreach(entry, udev_list_get_entry(&tag_match_list)) { + const char *tag = udev_list_entry_get_name(entry); + + if (udev_monitor_filter_add_match_tag(udev_monitor, tag) < 0) + fprintf(stderr, "error: unable to apply tag filter '%s'\n", tag); + } + + if (udev_monitor_enable_receiving(udev_monitor) < 0) { + fprintf(stderr, "error: unable to subscribe to udev events\n"); + rc = 2; + goto out; + } + + memset(&ep_udev, 0, sizeof(struct epoll_event)); + ep_udev.events = EPOLLIN; + ep_udev.data.fd = fd_udev; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_udev, &ep_udev) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + + printf("UDEV - the event which udev sends out after rule processing\n"); + } + + if (print_kernel) { + struct udev_list_entry *entry; + + kernel_monitor = udev_monitor_new_from_netlink(udev, "kernel"); + if (kernel_monitor == NULL) { + fprintf(stderr, "error: unable to create netlink socket\n"); + rc = 3; + goto out; + } + udev_monitor_set_receive_buffer_size(kernel_monitor, 128*1024*1024); + fd_kernel = udev_monitor_get_fd(kernel_monitor); + + udev_list_entry_foreach(entry, udev_list_get_entry(&subsystem_match_list)) { + const char *subsys = udev_list_entry_get_name(entry); + + if (udev_monitor_filter_add_match_subsystem_devtype(kernel_monitor, subsys, NULL) < 0) + fprintf(stderr, "error: unable to apply subsystem filter '%s'\n", subsys); + } + + if (udev_monitor_enable_receiving(kernel_monitor) < 0) { + fprintf(stderr, "error: unable to subscribe to kernel events\n"); + rc = 4; + goto out; + } + + memset(&ep_kernel, 0, sizeof(struct epoll_event)); + ep_kernel.events = EPOLLIN; + ep_kernel.data.fd = fd_kernel; + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_kernel, &ep_kernel) < 0) { + err(udev, "fail to add fd to epoll: %m\n"); + goto out; + } + + printf("KERNEL - the kernel uevent\n"); + } + printf("\n"); + + while (!udev_exit) { + int fdcount; + struct epoll_event ev[4]; + int i; + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + if (fdcount < 0) { + if (errno != EINTR) + fprintf(stderr, "error receiving uevent message: %m\n"); + continue; + } + + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_kernel && ev[i].events & EPOLLIN) { + struct udev_device *device; + + device = udev_monitor_receive_device(kernel_monitor); + if (device == NULL) + continue; + print_device(device, "KERNEL", prop); + udev_device_unref(device); + } else if (ev[i].data.fd == fd_udev && ev[i].events & EPOLLIN) { + struct udev_device *device; + + device = udev_monitor_receive_device(udev_monitor); + if (device == NULL) + continue; + print_device(device, "UDEV", prop); + udev_device_unref(device); + } + } + } out: - if (fd_ep >= 0) - close(fd_ep); - udev_monitor_unref(udev_monitor); - udev_monitor_unref(kernel_monitor); - udev_list_cleanup(&subsystem_match_list); - udev_list_cleanup(&tag_match_list); - return rc; + if (fd_ep >= 0) + close(fd_ep); + udev_monitor_unref(udev_monitor); + udev_monitor_unref(kernel_monitor); + udev_list_cleanup(&subsystem_match_list); + udev_list_cleanup(&tag_match_list); + return rc; } const struct udevadm_cmd udevadm_monitor = { - .name = "monitor", - .cmd = adm_monitor, - .help = "listen to kernel and udev events", + .name = "monitor", + .cmd = adm_monitor, + .help = "listen to kernel and udev events", }; diff --git a/src/udevadm-settle.c b/src/udevadm-settle.c index a59d7c39e5..b168defd90 100644 --- a/src/udevadm-settle.c +++ b/src/udevadm-settle.c @@ -38,198 +38,198 @@ static int adm_settle(struct udev *udev, int argc, char *argv[]) { - static const struct option options[] = { - { "seq-start", required_argument, NULL, 's' }, - { "seq-end", required_argument, NULL, 'e' }, - { "timeout", required_argument, NULL, 't' }, - { "exit-if-exists", required_argument, NULL, 'E' }, - { "quiet", no_argument, NULL, 'q' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - unsigned long long start_usec = now_usec(); - unsigned long long start = 0; - unsigned long long end = 0; - int quiet = 0; - const char *exists = NULL; - unsigned int timeout = 120; - struct pollfd pfd[1]; - struct udev_queue *udev_queue = NULL; - int rc = EXIT_FAILURE; - - dbg(udev, "version %s\n", VERSION); - - for (;;) { - int option; - int seconds; - - option = getopt_long(argc, argv, "s:e:t:E:qh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 's': - start = strtoull(optarg, NULL, 0); - break; - case 'e': - end = strtoull(optarg, NULL, 0); - break; - case 't': - seconds = atoi(optarg); - if (seconds >= 0) - timeout = seconds; - else - fprintf(stderr, "invalid timeout value\n"); - dbg(udev, "timeout=%i\n", timeout); - break; - case 'q': - quiet = 1; - break; - case 'E': - exists = optarg; - break; - case 'h': - printf("Usage: udevadm settle OPTIONS\n" - " --timeout= maximum time to wait for events\n" - " --seq-start= first seqnum to wait for\n" - " --seq-end= last seqnum to wait for\n" - " --exit-if-exists= stop waiting if file exists\n" - " --quiet do not print list after timeout\n" - " --help\n\n"); - exit(EXIT_SUCCESS); - default: - exit(EXIT_FAILURE); - } - } - - udev_queue = udev_queue_new(udev); - if (udev_queue == NULL) - exit(2); - - if (start > 0) { - unsigned long long kernel_seq; - - kernel_seq = udev_queue_get_kernel_seqnum(udev_queue); - - /* unless specified, the last event is the current kernel seqnum */ - if (end == 0) - end = udev_queue_get_kernel_seqnum(udev_queue); - - if (start > end) { - err(udev, "seq-start larger than seq-end, ignoring\n"); - start = 0; - end = 0; - } - - if (start > kernel_seq || end > kernel_seq) { - err(udev, "seq-start or seq-end larger than current kernel value, ignoring\n"); - start = 0; - end = 0; - } - info(udev, "start=%llu end=%llu current=%llu\n", start, end, kernel_seq); - } else { - if (end > 0) { - err(udev, "seq-end needs seq-start parameter, ignoring\n"); - end = 0; - } - } - - /* guarantee that the udev daemon isn't pre-processing */ - if (getuid() == 0) { - struct udev_ctrl *uctrl; - - uctrl = udev_ctrl_new(udev); - if (uctrl != NULL) { - if (udev_ctrl_send_ping(uctrl, timeout) < 0) { - info(udev, "no connection to daemon\n"); - udev_ctrl_unref(uctrl); - rc = EXIT_SUCCESS; - goto out; - } - udev_ctrl_unref(uctrl); - } - } - - pfd[0].events = POLLIN; - pfd[0].fd = inotify_init1(IN_CLOEXEC); - if (pfd[0].fd < 0) { - err(udev, "inotify_init failed: %m\n"); - } else { - if (inotify_add_watch(pfd[0].fd, udev_get_run_path(udev), IN_MOVED_TO) < 0) { - err(udev, "watching '%s' failed\n", udev_get_run_path(udev)); - close(pfd[0].fd); - pfd[0].fd = -1; - } - } - - for (;;) { - struct stat statbuf; - - if (exists != NULL && stat(exists, &statbuf) == 0) { - rc = EXIT_SUCCESS; - break; - } - - if (start > 0) { - /* if asked for, wait for a specific sequence of events */ - if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) { - rc = EXIT_SUCCESS; - break; - } - } else { - /* exit if queue is empty */ - if (udev_queue_get_queue_is_empty(udev_queue)) { - rc = EXIT_SUCCESS; - break; - } - } - - if (pfd[0].fd >= 0) { - int delay; - - if (exists != NULL || start > 0) - delay = 100; - else - delay = 1000; - /* wake up after delay, or immediately after the queue is rebuilt */ - if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) { - char buf[sizeof(struct inotify_event) + PATH_MAX]; - - read(pfd[0].fd, buf, sizeof(buf)); - } - } else { - sleep(1); - } - - if (timeout > 0) { - unsigned long long age_usec; - - age_usec = now_usec() - start_usec; - if (age_usec / (1000 * 1000) >= timeout) { - struct udev_list_entry *list_entry; - - if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) { - info(udev, "timeout waiting for udev queue\n"); - printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); - udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) - printf(" %s (%s)\n", - udev_list_entry_get_name(list_entry), - udev_list_entry_get_value(list_entry)); - } - - break; - } - } - } + static const struct option options[] = { + { "seq-start", required_argument, NULL, 's' }, + { "seq-end", required_argument, NULL, 'e' }, + { "timeout", required_argument, NULL, 't' }, + { "exit-if-exists", required_argument, NULL, 'E' }, + { "quiet", no_argument, NULL, 'q' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + unsigned long long start_usec = now_usec(); + unsigned long long start = 0; + unsigned long long end = 0; + int quiet = 0; + const char *exists = NULL; + unsigned int timeout = 120; + struct pollfd pfd[1]; + struct udev_queue *udev_queue = NULL; + int rc = EXIT_FAILURE; + + dbg(udev, "version %s\n", VERSION); + + for (;;) { + int option; + int seconds; + + option = getopt_long(argc, argv, "s:e:t:E:qh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 's': + start = strtoull(optarg, NULL, 0); + break; + case 'e': + end = strtoull(optarg, NULL, 0); + break; + case 't': + seconds = atoi(optarg); + if (seconds >= 0) + timeout = seconds; + else + fprintf(stderr, "invalid timeout value\n"); + dbg(udev, "timeout=%i\n", timeout); + break; + case 'q': + quiet = 1; + break; + case 'E': + exists = optarg; + break; + case 'h': + printf("Usage: udevadm settle OPTIONS\n" + " --timeout= maximum time to wait for events\n" + " --seq-start= first seqnum to wait for\n" + " --seq-end= last seqnum to wait for\n" + " --exit-if-exists= stop waiting if file exists\n" + " --quiet do not print list after timeout\n" + " --help\n\n"); + exit(EXIT_SUCCESS); + default: + exit(EXIT_FAILURE); + } + } + + udev_queue = udev_queue_new(udev); + if (udev_queue == NULL) + exit(2); + + if (start > 0) { + unsigned long long kernel_seq; + + kernel_seq = udev_queue_get_kernel_seqnum(udev_queue); + + /* unless specified, the last event is the current kernel seqnum */ + if (end == 0) + end = udev_queue_get_kernel_seqnum(udev_queue); + + if (start > end) { + err(udev, "seq-start larger than seq-end, ignoring\n"); + start = 0; + end = 0; + } + + if (start > kernel_seq || end > kernel_seq) { + err(udev, "seq-start or seq-end larger than current kernel value, ignoring\n"); + start = 0; + end = 0; + } + info(udev, "start=%llu end=%llu current=%llu\n", start, end, kernel_seq); + } else { + if (end > 0) { + err(udev, "seq-end needs seq-start parameter, ignoring\n"); + end = 0; + } + } + + /* guarantee that the udev daemon isn't pre-processing */ + if (getuid() == 0) { + struct udev_ctrl *uctrl; + + uctrl = udev_ctrl_new(udev); + if (uctrl != NULL) { + if (udev_ctrl_send_ping(uctrl, timeout) < 0) { + info(udev, "no connection to daemon\n"); + udev_ctrl_unref(uctrl); + rc = EXIT_SUCCESS; + goto out; + } + udev_ctrl_unref(uctrl); + } + } + + pfd[0].events = POLLIN; + pfd[0].fd = inotify_init1(IN_CLOEXEC); + if (pfd[0].fd < 0) { + err(udev, "inotify_init failed: %m\n"); + } else { + if (inotify_add_watch(pfd[0].fd, udev_get_run_path(udev), IN_MOVED_TO) < 0) { + err(udev, "watching '%s' failed\n", udev_get_run_path(udev)); + close(pfd[0].fd); + pfd[0].fd = -1; + } + } + + for (;;) { + struct stat statbuf; + + if (exists != NULL && stat(exists, &statbuf) == 0) { + rc = EXIT_SUCCESS; + break; + } + + if (start > 0) { + /* if asked for, wait for a specific sequence of events */ + if (udev_queue_get_seqnum_sequence_is_finished(udev_queue, start, end) == 1) { + rc = EXIT_SUCCESS; + break; + } + } else { + /* exit if queue is empty */ + if (udev_queue_get_queue_is_empty(udev_queue)) { + rc = EXIT_SUCCESS; + break; + } + } + + if (pfd[0].fd >= 0) { + int delay; + + if (exists != NULL || start > 0) + delay = 100; + else + delay = 1000; + /* wake up after delay, or immediately after the queue is rebuilt */ + if (poll(pfd, 1, delay) > 0 && pfd[0].revents & POLLIN) { + char buf[sizeof(struct inotify_event) + PATH_MAX]; + + read(pfd[0].fd, buf, sizeof(buf)); + } + } else { + sleep(1); + } + + if (timeout > 0) { + unsigned long long age_usec; + + age_usec = now_usec() - start_usec; + if (age_usec / (1000 * 1000) >= timeout) { + struct udev_list_entry *list_entry; + + if (!quiet && udev_queue_get_queued_list_entry(udev_queue) != NULL) { + info(udev, "timeout waiting for udev queue\n"); + printf("\nudevadm settle - timeout of %i seconds reached, the event queue contains:\n", timeout); + udev_list_entry_foreach(list_entry, udev_queue_get_queued_list_entry(udev_queue)) + printf(" %s (%s)\n", + udev_list_entry_get_name(list_entry), + udev_list_entry_get_value(list_entry)); + } + + break; + } + } + } out: - if (pfd[0].fd >= 0) - close(pfd[0].fd); - udev_queue_unref(udev_queue); - return rc; + if (pfd[0].fd >= 0) + close(pfd[0].fd); + udev_queue_unref(udev_queue); + return rc; } const struct udevadm_cmd udevadm_settle = { - .name = "settle", - .cmd = adm_settle, - .help = "wait for the event queue to finish", + .name = "settle", + .cmd = adm_settle, + .help = "wait for the event queue to finish", }; diff --git a/src/udevadm-test-builtin.c b/src/udevadm-test-builtin.c index 253fcd0c8f..3a49f7ce9c 100644 --- a/src/udevadm-test-builtin.c +++ b/src/udevadm-test-builtin.c @@ -36,93 +36,93 @@ static void help(struct udev *udev) { - fprintf(stderr, "\n"); - fprintf(stderr, "Usage: udevadm builtin [--help] \n"); - udev_builtin_list(udev); - fprintf(stderr, "\n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Usage: udevadm builtin [--help] \n"); + udev_builtin_list(udev); + fprintf(stderr, "\n"); } static int adm_builtin(struct udev *udev, int argc, char *argv[]) { - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - {} - }; - char *command = NULL; - char *syspath = NULL; - char filename[UTIL_PATH_SIZE]; - struct udev_device *dev = NULL; - enum udev_builtin_cmd cmd; - int rc = EXIT_SUCCESS; - - dbg(udev, "version %s\n", VERSION); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'h': - help(udev); - goto out; - } - } - - command = argv[optind++]; - if (command == NULL) { - fprintf(stderr, "command missing\n"); - help(udev); - rc = 2; - goto out; - } - - syspath = argv[optind++]; - if (syspath == NULL) { - fprintf(stderr, "syspath missing\n\n"); - rc = 3; - goto out; - } - - udev_builtin_init(udev); - - cmd = udev_builtin_lookup(command); - if (cmd >= UDEV_BUILTIN_MAX) { - fprintf(stderr, "unknown command '%s'\n", command); - help(udev); - rc = 5; - goto out; - } - - /* add /sys if needed */ - if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); - else - util_strscpy(filename, sizeof(filename), syspath); - util_remove_trailing_chars(filename, '/'); - - dev = udev_device_new_from_syspath(udev, filename); - if (dev == NULL) { - fprintf(stderr, "unable to open device '%s'\n\n", filename); - rc = 4; - goto out; - } - - if (udev_builtin_run(dev, cmd, command, true) < 0) { - fprintf(stderr, "error executing '%s'\n\n", command); - rc = 6; - } + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + {} + }; + char *command = NULL; + char *syspath = NULL; + char filename[UTIL_PATH_SIZE]; + struct udev_device *dev = NULL; + enum udev_builtin_cmd cmd; + int rc = EXIT_SUCCESS; + + dbg(udev, "version %s\n", VERSION); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + help(udev); + goto out; + } + } + + command = argv[optind++]; + if (command == NULL) { + fprintf(stderr, "command missing\n"); + help(udev); + rc = 2; + goto out; + } + + syspath = argv[optind++]; + if (syspath == NULL) { + fprintf(stderr, "syspath missing\n\n"); + rc = 3; + goto out; + } + + udev_builtin_init(udev); + + cmd = udev_builtin_lookup(command); + if (cmd >= UDEV_BUILTIN_MAX) { + fprintf(stderr, "unknown command '%s'\n", command); + help(udev); + rc = 5; + goto out; + } + + /* add /sys if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); + else + util_strscpy(filename, sizeof(filename), syspath); + util_remove_trailing_chars(filename, '/'); + + dev = udev_device_new_from_syspath(udev, filename); + if (dev == NULL) { + fprintf(stderr, "unable to open device '%s'\n\n", filename); + rc = 4; + goto out; + } + + if (udev_builtin_run(dev, cmd, command, true) < 0) { + fprintf(stderr, "error executing '%s'\n\n", command); + rc = 6; + } out: - udev_device_unref(dev); - udev_builtin_exit(udev); - return rc; + udev_device_unref(dev); + udev_builtin_exit(udev); + return rc; } const struct udevadm_cmd udevadm_test_builtin = { - .name = "test-builtin", - .cmd = adm_builtin, - .help = "test a built-in command", - .debug = true, + .name = "test-builtin", + .cmd = adm_builtin, + .help = "test a built-in command", + .debug = true, }; diff --git a/src/udevadm-test.c b/src/udevadm-test.c index 851500527f..6275cff899 100644 --- a/src/udevadm-test.c +++ b/src/udevadm-test.c @@ -33,141 +33,141 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) { - int resolve_names = 1; - char filename[UTIL_PATH_SIZE]; - const char *action = "add"; - const char *syspath = NULL; - struct udev_event *event = NULL; - struct udev_device *dev = NULL; - struct udev_rules *rules = NULL; - struct udev_list_entry *entry; - sigset_t mask, sigmask_orig; - int err; - int rc = 0; - - static const struct option options[] = { - { "action", required_argument, NULL, 'a' }, - { "resolve-names", required_argument, NULL, 'N' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - info(udev, "version %s\n", VERSION); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "a:s:N:fh", options, NULL); - if (option == -1) - break; - - dbg(udev, "option '%c'\n", option); - switch (option) { - case 'a': - action = optarg; - break; - case 'N': - if (strcmp (optarg, "early") == 0) { - resolve_names = 1; - } else if (strcmp (optarg, "late") == 0) { - resolve_names = 0; - } else if (strcmp (optarg, "never") == 0) { - resolve_names = -1; - } else { - fprintf(stderr, "resolve-names must be early, late or never\n"); - err(udev, "resolve-names must be early, late or never\n"); - exit(EXIT_FAILURE); - } - break; - case 'h': - printf("Usage: udevadm test OPTIONS \n" - " --action= set action string\n" - " --help\n\n"); - exit(EXIT_SUCCESS); - default: - exit(EXIT_FAILURE); - } - } - syspath = argv[optind]; - - if (syspath == NULL) { - fprintf(stderr, "syspath parameter missing\n"); - rc = 2; - goto out; - } - - printf("This program is for debugging only, it does not run any program,\n" - "specified by a RUN key. It may show incorrect results, because\n" - "some values may be different, or not available at a simulation run.\n" - "\n"); - - sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); - - udev_builtin_init(udev); - - rules = udev_rules_new(udev, resolve_names); - if (rules == NULL) { - fprintf(stderr, "error reading rules\n"); - rc = 3; - goto out; - } - - /* add /sys if needed */ - if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); - else - util_strscpy(filename, sizeof(filename), syspath); - util_remove_trailing_chars(filename, '/'); - - dev = udev_device_new_from_syspath(udev, filename); - if (dev == NULL) { - fprintf(stderr, "unable to open device '%s'\n", filename); - rc = 4; - goto out; - } - - /* skip reading of db, but read kernel parameters */ - udev_device_set_info_loaded(dev); - udev_device_read_uevent_file(dev); - - udev_device_set_action(dev, action); - event = udev_event_new(dev); - - sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); - event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (event->fd_signal < 0) { - fprintf(stderr, "error creating signalfd\n"); - rc = 5; - goto out; - } - - err = udev_event_execute_rules(event, rules, &sigmask_orig); - - udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) - printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); - - if (err == 0) { - udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { - char program[UTIL_PATH_SIZE]; - - udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); - printf("run: '%s'\n", program); - } - } + int resolve_names = 1; + char filename[UTIL_PATH_SIZE]; + const char *action = "add"; + const char *syspath = NULL; + struct udev_event *event = NULL; + struct udev_device *dev = NULL; + struct udev_rules *rules = NULL; + struct udev_list_entry *entry; + sigset_t mask, sigmask_orig; + int err; + int rc = 0; + + static const struct option options[] = { + { "action", required_argument, NULL, 'a' }, + { "resolve-names", required_argument, NULL, 'N' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + info(udev, "version %s\n", VERSION); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "a:s:N:fh", options, NULL); + if (option == -1) + break; + + dbg(udev, "option '%c'\n", option); + switch (option) { + case 'a': + action = optarg; + break; + case 'N': + if (strcmp (optarg, "early") == 0) { + resolve_names = 1; + } else if (strcmp (optarg, "late") == 0) { + resolve_names = 0; + } else if (strcmp (optarg, "never") == 0) { + resolve_names = -1; + } else { + fprintf(stderr, "resolve-names must be early, late or never\n"); + err(udev, "resolve-names must be early, late or never\n"); + exit(EXIT_FAILURE); + } + break; + case 'h': + printf("Usage: udevadm test OPTIONS \n" + " --action= set action string\n" + " --help\n\n"); + exit(EXIT_SUCCESS); + default: + exit(EXIT_FAILURE); + } + } + syspath = argv[optind]; + + if (syspath == NULL) { + fprintf(stderr, "syspath parameter missing\n"); + rc = 2; + goto out; + } + + printf("This program is for debugging only, it does not run any program,\n" + "specified by a RUN key. It may show incorrect results, because\n" + "some values may be different, or not available at a simulation run.\n" + "\n"); + + sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); + + udev_builtin_init(udev); + + rules = udev_rules_new(udev, resolve_names); + if (rules == NULL) { + fprintf(stderr, "error reading rules\n"); + rc = 3; + goto out; + } + + /* add /sys if needed */ + if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL); + else + util_strscpy(filename, sizeof(filename), syspath); + util_remove_trailing_chars(filename, '/'); + + dev = udev_device_new_from_syspath(udev, filename); + if (dev == NULL) { + fprintf(stderr, "unable to open device '%s'\n", filename); + rc = 4; + goto out; + } + + /* skip reading of db, but read kernel parameters */ + udev_device_set_info_loaded(dev); + udev_device_read_uevent_file(dev); + + udev_device_set_action(dev, action); + event = udev_event_new(dev); + + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (event->fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + rc = 5; + goto out; + } + + err = udev_event_execute_rules(event, rules, &sigmask_orig); + + udev_list_entry_foreach(entry, udev_device_get_properties_list_entry(dev)) + printf("%s=%s\n", udev_list_entry_get_name(entry), udev_list_entry_get_value(entry)); + + if (err == 0) { + udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) { + char program[UTIL_PATH_SIZE]; + + udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program)); + printf("run: '%s'\n", program); + } + } out: - if (event != NULL && event->fd_signal >= 0) - close(event->fd_signal); - udev_event_unref(event); - udev_device_unref(dev); - udev_rules_unref(rules); - udev_builtin_exit(udev); - return rc; + if (event != NULL && event->fd_signal >= 0) + close(event->fd_signal); + udev_event_unref(event); + udev_device_unref(dev); + udev_rules_unref(rules); + udev_builtin_exit(udev); + return rc; } const struct udevadm_cmd udevadm_test = { - .name = "test", - .cmd = adm_test, - .help = "test an event run", - .debug = true, + .name = "test", + .cmd = adm_test, + .help = "test an event run", + .debug = true, }; diff --git a/src/udevadm-trigger.c b/src/udevadm-trigger.c index 2cee2297d4..3cce23dfb2 100644 --- a/src/udevadm-trigger.c +++ b/src/udevadm-trigger.c @@ -38,195 +38,195 @@ static int dry_run; static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) { - struct udev *udev = udev_enumerate_get_udev(udev_enumerate); - struct udev_list_entry *entry; - - udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(udev_enumerate)) { - char filename[UTIL_PATH_SIZE]; - int fd; - - if (verbose) - printf("%s\n", udev_list_entry_get_name(entry)); - if (dry_run) - continue; - util_strscpyl(filename, sizeof(filename), udev_list_entry_get_name(entry), "/uevent", NULL); - fd = open(filename, O_WRONLY); - if (fd < 0) { - dbg(udev, "error on opening %s: %m\n", filename); - continue; - } - if (write(fd, action, strlen(action)) < 0) - info(udev, "error writing '%s' to '%s': %m\n", action, filename); - close(fd); - } + struct udev *udev = udev_enumerate_get_udev(udev_enumerate); + struct udev_list_entry *entry; + + udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(udev_enumerate)) { + char filename[UTIL_PATH_SIZE]; + int fd; + + if (verbose) + printf("%s\n", udev_list_entry_get_name(entry)); + if (dry_run) + continue; + util_strscpyl(filename, sizeof(filename), udev_list_entry_get_name(entry), "/uevent", NULL); + fd = open(filename, O_WRONLY); + if (fd < 0) { + dbg(udev, "error on opening %s: %m\n", filename); + continue; + } + if (write(fd, action, strlen(action)) < 0) + info(udev, "error writing '%s' to '%s': %m\n", action, filename); + close(fd); + } } static const char *keyval(const char *str, const char **val, char *buf, size_t size) { - char *pos; - - util_strscpy(buf, size,str); - pos = strchr(buf, '='); - if (pos != NULL) { - pos[0] = 0; - pos++; - } - *val = pos; - return buf; + char *pos; + + util_strscpy(buf, size,str); + pos = strchr(buf, '='); + if (pos != NULL) { + pos[0] = 0; + pos++; + } + *val = pos; + return buf; } static int adm_trigger(struct udev *udev, int argc, char *argv[]) { - static const struct option options[] = { - { "verbose", no_argument, NULL, 'v' }, - { "dry-run", no_argument, NULL, 'n' }, - { "type", required_argument, NULL, 't' }, - { "action", required_argument, NULL, 'c' }, - { "subsystem-match", required_argument, NULL, 's' }, - { "subsystem-nomatch", required_argument, NULL, 'S' }, - { "attr-match", required_argument, NULL, 'a' }, - { "attr-nomatch", required_argument, NULL, 'A' }, - { "property-match", required_argument, NULL, 'p' }, - { "tag-match", required_argument, NULL, 'g' }, - { "sysname-match", required_argument, NULL, 'y' }, - { "parent-match", required_argument, NULL, 'b' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - enum { - TYPE_DEVICES, - TYPE_SUBSYSTEMS, - } device_type = TYPE_DEVICES; - const char *action = "change"; - struct udev_enumerate *udev_enumerate; - int rc = 0; - - dbg(udev, "version %s\n", VERSION); - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) { - rc = 1; - goto exit; - } - - for (;;) { - int option; - const char *key; - const char *val; - char buf[UTIL_PATH_SIZE]; - - option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:b:", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'v': - verbose = 1; - break; - case 'n': - dry_run = 1; - break; - case 't': - if (strcmp(optarg, "devices") == 0) { - device_type = TYPE_DEVICES; - } else if (strcmp(optarg, "subsystems") == 0) { - device_type = TYPE_SUBSYSTEMS; - } else { - err(udev, "unknown type --type=%s\n", optarg); - rc = 2; - goto exit; - } - break; - case 'c': - action = optarg; - break; - case 's': - udev_enumerate_add_match_subsystem(udev_enumerate, optarg); - break; - case 'S': - udev_enumerate_add_nomatch_subsystem(udev_enumerate, optarg); - break; - case 'a': - key = keyval(optarg, &val, buf, sizeof(buf)); - udev_enumerate_add_match_sysattr(udev_enumerate, key, val); - break; - case 'A': - key = keyval(optarg, &val, buf, sizeof(buf)); - udev_enumerate_add_nomatch_sysattr(udev_enumerate, key, val); - break; - case 'p': - key = keyval(optarg, &val, buf, sizeof(buf)); - udev_enumerate_add_match_property(udev_enumerate, key, val); - break; - case 'g': - udev_enumerate_add_match_tag(udev_enumerate, optarg); - break; - case 'y': - udev_enumerate_add_match_sysname(udev_enumerate, optarg); - break; - case 'b': { - char path[UTIL_PATH_SIZE]; - struct udev_device *dev; - - /* add sys dir if needed */ - if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) - util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); - else - util_strscpy(path, sizeof(path), optarg); - util_remove_trailing_chars(path, '/'); - dev = udev_device_new_from_syspath(udev, path); - if (dev == NULL) { - err(udev, "unable to open the device '%s'\n", optarg); - rc = 2; - goto exit; - } - udev_enumerate_add_match_parent(udev_enumerate, dev); - /* drop reference immediately, enumerate pins the device as long as needed */ - udev_device_unref(dev); - break; - } - case 'h': - printf("Usage: udevadm trigger OPTIONS\n" - " --verbose print the list of devices while running\n" - " --dry-run do not actually trigger the events\n" - " --type= type of events to trigger\n" - " devices sys devices (default)\n" - " subsystems sys subsystems and drivers\n" - " --action= event action value, default is \"change\"\n" - " --subsystem-match= trigger devices from a matching subsystem\n" - " --subsystem-nomatch= exclude devices from a matching subsystem\n" - " --attr-match=]> trigger devices with a matching attribute\n" - " --attr-nomatch=]> exclude devices with a matching attribute\n" - " --property-match== trigger devices with a matching property\n" - " --tag-match== trigger devices with a matching property\n" - " --sysname-match= trigger devices with a matching name\n" - " --parent-match= trigger devices with that parent device\n" - " --help\n\n"); - goto exit; - default: - rc = 1; - goto exit; - } - } - - switch (device_type) { - case TYPE_SUBSYSTEMS: - udev_enumerate_scan_subsystems(udev_enumerate); - exec_list(udev_enumerate, action); - goto exit; - case TYPE_DEVICES: - udev_enumerate_scan_devices(udev_enumerate); - exec_list(udev_enumerate, action); - goto exit; - default: - goto exit; - } + static const struct option options[] = { + { "verbose", no_argument, NULL, 'v' }, + { "dry-run", no_argument, NULL, 'n' }, + { "type", required_argument, NULL, 't' }, + { "action", required_argument, NULL, 'c' }, + { "subsystem-match", required_argument, NULL, 's' }, + { "subsystem-nomatch", required_argument, NULL, 'S' }, + { "attr-match", required_argument, NULL, 'a' }, + { "attr-nomatch", required_argument, NULL, 'A' }, + { "property-match", required_argument, NULL, 'p' }, + { "tag-match", required_argument, NULL, 'g' }, + { "sysname-match", required_argument, NULL, 'y' }, + { "parent-match", required_argument, NULL, 'b' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + enum { + TYPE_DEVICES, + TYPE_SUBSYSTEMS, + } device_type = TYPE_DEVICES; + const char *action = "change"; + struct udev_enumerate *udev_enumerate; + int rc = 0; + + dbg(udev, "version %s\n", VERSION); + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) { + rc = 1; + goto exit; + } + + for (;;) { + int option; + const char *key; + const char *val; + char buf[UTIL_PATH_SIZE]; + + option = getopt_long(argc, argv, "vng:o:t:hc:p:s:S:a:A:y:b:", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'v': + verbose = 1; + break; + case 'n': + dry_run = 1; + break; + case 't': + if (strcmp(optarg, "devices") == 0) { + device_type = TYPE_DEVICES; + } else if (strcmp(optarg, "subsystems") == 0) { + device_type = TYPE_SUBSYSTEMS; + } else { + err(udev, "unknown type --type=%s\n", optarg); + rc = 2; + goto exit; + } + break; + case 'c': + action = optarg; + break; + case 's': + udev_enumerate_add_match_subsystem(udev_enumerate, optarg); + break; + case 'S': + udev_enumerate_add_nomatch_subsystem(udev_enumerate, optarg); + break; + case 'a': + key = keyval(optarg, &val, buf, sizeof(buf)); + udev_enumerate_add_match_sysattr(udev_enumerate, key, val); + break; + case 'A': + key = keyval(optarg, &val, buf, sizeof(buf)); + udev_enumerate_add_nomatch_sysattr(udev_enumerate, key, val); + break; + case 'p': + key = keyval(optarg, &val, buf, sizeof(buf)); + udev_enumerate_add_match_property(udev_enumerate, key, val); + break; + case 'g': + udev_enumerate_add_match_tag(udev_enumerate, optarg); + break; + case 'y': + udev_enumerate_add_match_sysname(udev_enumerate, optarg); + break; + case 'b': { + char path[UTIL_PATH_SIZE]; + struct udev_device *dev; + + /* add sys dir if needed */ + if (strncmp(optarg, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) + util_strscpyl(path, sizeof(path), udev_get_sys_path(udev), optarg, NULL); + else + util_strscpy(path, sizeof(path), optarg); + util_remove_trailing_chars(path, '/'); + dev = udev_device_new_from_syspath(udev, path); + if (dev == NULL) { + err(udev, "unable to open the device '%s'\n", optarg); + rc = 2; + goto exit; + } + udev_enumerate_add_match_parent(udev_enumerate, dev); + /* drop reference immediately, enumerate pins the device as long as needed */ + udev_device_unref(dev); + break; + } + case 'h': + printf("Usage: udevadm trigger OPTIONS\n" + " --verbose print the list of devices while running\n" + " --dry-run do not actually trigger the events\n" + " --type= type of events to trigger\n" + " devices sys devices (default)\n" + " subsystems sys subsystems and drivers\n" + " --action= event action value, default is \"change\"\n" + " --subsystem-match= trigger devices from a matching subsystem\n" + " --subsystem-nomatch= exclude devices from a matching subsystem\n" + " --attr-match=]> trigger devices with a matching attribute\n" + " --attr-nomatch=]> exclude devices with a matching attribute\n" + " --property-match== trigger devices with a matching property\n" + " --tag-match== trigger devices with a matching property\n" + " --sysname-match= trigger devices with a matching name\n" + " --parent-match= trigger devices with that parent device\n" + " --help\n\n"); + goto exit; + default: + rc = 1; + goto exit; + } + } + + switch (device_type) { + case TYPE_SUBSYSTEMS: + udev_enumerate_scan_subsystems(udev_enumerate); + exec_list(udev_enumerate, action); + goto exit; + case TYPE_DEVICES: + udev_enumerate_scan_devices(udev_enumerate); + exec_list(udev_enumerate, action); + goto exit; + default: + goto exit; + } exit: - udev_enumerate_unref(udev_enumerate); - return rc; + udev_enumerate_unref(udev_enumerate); + return rc; } const struct udevadm_cmd udevadm_trigger = { - .name = "trigger", - .cmd = adm_trigger, - .help = "request events from the kernel", + .name = "trigger", + .cmd = adm_trigger, + .help = "request events from the kernel", }; diff --git a/src/udevadm.c b/src/udevadm.c index 5410f00c02..224ece0bb7 100644 --- a/src/udevadm.c +++ b/src/udevadm.c @@ -28,138 +28,138 @@ static bool debug; void udev_main_log(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) + const char *file, int line, const char *fn, + const char *format, va_list args) { - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - va_list args2; - - va_copy(args2, args); - vfprintf(stderr, format, args2); - va_end(args2); - vsyslog(priority, format, args); - } + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + va_list args2; + + va_copy(args2, args); + vfprintf(stderr, format, args2); + va_end(args2); + vsyslog(priority, format, args); + } } static int adm_version(struct udev *udev, int argc, char *argv[]) { - printf("%s\n", VERSION); - return 0; + printf("%s\n", VERSION); + return 0; } static const struct udevadm_cmd udevadm_version = { - .name = "version", - .cmd = adm_version, + .name = "version", + .cmd = adm_version, }; static int adm_help(struct udev *udev, int argc, char *argv[]); static const struct udevadm_cmd udevadm_help = { - .name = "help", - .cmd = adm_help, + .name = "help", + .cmd = adm_help, }; static const struct udevadm_cmd *udevadm_cmds[] = { - &udevadm_info, - &udevadm_trigger, - &udevadm_settle, - &udevadm_control, - &udevadm_monitor, - &udevadm_test, - &udevadm_test_builtin, - &udevadm_version, - &udevadm_help, + &udevadm_info, + &udevadm_trigger, + &udevadm_settle, + &udevadm_control, + &udevadm_monitor, + &udevadm_test, + &udevadm_test_builtin, + &udevadm_version, + &udevadm_help, }; static int adm_help(struct udev *udev, int argc, char *argv[]) { - unsigned int i; - - fprintf(stderr, "Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); - for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) - if (udevadm_cmds[i]->help != NULL) - printf(" %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help); - fprintf(stderr, "\n"); - return 0; + unsigned int i; + + fprintf(stderr, "Usage: udevadm [--help] [--version] [--debug] COMMAND [COMMAND OPTIONS]\n"); + for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) + if (udevadm_cmds[i]->help != NULL) + printf(" %-12s %s\n", udevadm_cmds[i]->name, udevadm_cmds[i]->help); + fprintf(stderr, "\n"); + return 0; } static int run_command(struct udev *udev, const struct udevadm_cmd *cmd, int argc, char *argv[]) { - if (cmd->debug) { - debug = true; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - } - info(udev, "calling: %s\n", cmd->name); - return cmd->cmd(udev, argc, argv); + if (cmd->debug) { + debug = true; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + } + info(udev, "calling: %s\n", cmd->name); + return cmd->cmd(udev, argc, argv); } int main(int argc, char *argv[]) { - struct udev *udev; - static const struct option options[] = { - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - {} - }; - const char *command; - unsigned int i; - int rc = 1; - - udev = udev_new(); - if (udev == NULL) - goto out; - - udev_log_init("udevadm"); - udev_set_log_fn(udev, udev_main_log); - udev_selinux_init(udev); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "+dhV", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = true; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - rc = adm_help(udev, argc, argv); - goto out; - case 'V': - rc = adm_version(udev, argc, argv); - goto out; - default: - goto out; - } - } - command = argv[optind]; - - info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); - - if (command != NULL) - for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) { - if (strcmp(udevadm_cmds[i]->name, command) == 0) { - argc -= optind; - argv += optind; - optind = 0; - rc = run_command(udev, udevadm_cmds[i], argc, argv); - goto out; - } - } - - fprintf(stderr, "missing or unknown command\n\n"); - adm_help(udev, argc, argv); - rc = 2; + struct udev *udev; + static const struct option options[] = { + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + {} + }; + const char *command; + unsigned int i; + int rc = 1; + + udev = udev_new(); + if (udev == NULL) + goto out; + + udev_log_init("udevadm"); + udev_set_log_fn(udev, udev_main_log); + udev_selinux_init(udev); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "+dhV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = true; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + rc = adm_help(udev, argc, argv); + goto out; + case 'V': + rc = adm_version(udev, argc, argv); + goto out; + default: + goto out; + } + } + command = argv[optind]; + + info(udev, "runtime dir '%s'\n", udev_get_run_path(udev)); + + if (command != NULL) + for (i = 0; i < ARRAY_SIZE(udevadm_cmds); i++) { + if (strcmp(udevadm_cmds[i]->name, command) == 0) { + argc -= optind; + argv += optind; + optind = 0; + rc = run_command(udev, udevadm_cmds[i], argc, argv); + goto out; + } + } + + fprintf(stderr, "missing or unknown command\n\n"); + adm_help(udev, argc, argv); + rc = 2; out: - udev_selinux_exit(udev); - udev_unref(udev); - udev_log_close(); - return rc; + udev_selinux_exit(udev); + udev_unref(udev); + udev_log_close(); + return rc; } diff --git a/src/udevd.c b/src/udevd.c index b88213e5b5..11ab19a311 100644 --- a/src/udevd.c +++ b/src/udevd.c @@ -50,21 +50,21 @@ static bool debug; void udev_main_log(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) + const char *file, int line, const char *fn, + const char *format, va_list args) { - if (debug) { - char buf[1024]; - struct timespec ts; - - vsnprintf(buf, sizeof(buf), format, args); - clock_gettime(CLOCK_MONOTONIC, &ts); - fprintf(stderr, "[%llu.%06u] [%u] %s: %s", - (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, - (int) getpid(), fn, buf); - } else { - vsyslog(priority, format, args); - } + if (debug) { + char buf[1024]; + struct timespec ts; + + vsnprintf(buf, sizeof(buf), format, args); + clock_gettime(CLOCK_MONOTONIC, &ts); + fprintf(stderr, "[%llu.%06u] [%u] %s: %s", + (unsigned long long) ts.tv_sec, (unsigned int) ts.tv_nsec/1000, + (int) getpid(), fn, buf); + } else { + vsyslog(priority, format, args); + } } static struct udev_rules *rules; @@ -86,1623 +86,1623 @@ static UDEV_LIST(worker_list); static bool udev_exit; enum event_state { - EVENT_UNDEF, - EVENT_QUEUED, - EVENT_RUNNING, + EVENT_UNDEF, + EVENT_QUEUED, + EVENT_RUNNING, }; struct event { - struct udev_list_node node; - struct udev *udev; - struct udev_device *dev; - enum event_state state; - int exitcode; - unsigned long long int delaying_seqnum; - unsigned long long int seqnum; - const char *devpath; - size_t devpath_len; - const char *devpath_old; - dev_t devnum; - bool is_block; - int ifindex; + struct udev_list_node node; + struct udev *udev; + struct udev_device *dev; + enum event_state state; + int exitcode; + unsigned long long int delaying_seqnum; + unsigned long long int seqnum; + const char *devpath; + size_t devpath_len; + const char *devpath_old; + dev_t devnum; + bool is_block; + int ifindex; }; static struct event *node_to_event(struct udev_list_node *node) { - char *event; + char *event; - event = (char *)node; - event -= offsetof(struct event, node); - return (struct event *)event; + event = (char *)node; + event -= offsetof(struct event, node); + return (struct event *)event; } static void event_queue_cleanup(struct udev *udev, enum event_state type); enum worker_state { - WORKER_UNDEF, - WORKER_RUNNING, - WORKER_IDLE, - WORKER_KILLED, + WORKER_UNDEF, + WORKER_RUNNING, + WORKER_IDLE, + WORKER_KILLED, }; struct worker { - struct udev_list_node node; - struct udev *udev; - int refcount; - pid_t pid; - struct udev_monitor *monitor; - enum worker_state state; - struct event *event; + struct udev_list_node node; + struct udev *udev; + int refcount; + pid_t pid; + struct udev_monitor *monitor; + enum worker_state state; + struct event *event; }; /* passed from worker to main process */ struct worker_message { - pid_t pid; - int exitcode; + pid_t pid; + int exitcode; }; static struct worker *node_to_worker(struct udev_list_node *node) { - char *worker; + char *worker; - worker = (char *)node; - worker -= offsetof(struct worker, node); - return (struct worker *)worker; + worker = (char *)node; + worker -= offsetof(struct worker, node); + return (struct worker *)worker; } static void event_queue_delete(struct event *event, bool export) { - udev_list_node_remove(&event->node); - - if (export) { - udev_queue_export_device_finished(udev_queue_export, event->dev); - info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); - } - udev_device_unref(event->dev); - free(event); + udev_list_node_remove(&event->node); + + if (export) { + udev_queue_export_device_finished(udev_queue_export, event->dev); + info(event->udev, "seq %llu done with %i\n", udev_device_get_seqnum(event->dev), event->exitcode); + } + udev_device_unref(event->dev); + free(event); } static struct worker *worker_ref(struct worker *worker) { - worker->refcount++; - return worker; + worker->refcount++; + return worker; } static void worker_cleanup(struct worker *worker) { - udev_list_node_remove(&worker->node); - udev_monitor_unref(worker->monitor); - children--; - free(worker); + udev_list_node_remove(&worker->node); + udev_monitor_unref(worker->monitor); + children--; + free(worker); } static void worker_unref(struct worker *worker) { - worker->refcount--; - if (worker->refcount > 0) - return; - info(worker->udev, "worker [%u] cleaned up\n", worker->pid); - worker_cleanup(worker); + worker->refcount--; + if (worker->refcount > 0) + return; + info(worker->udev, "worker [%u] cleaned up\n", worker->pid); + worker_cleanup(worker); } static void worker_list_cleanup(struct udev *udev) { - struct udev_list_node *loop, *tmp; + struct udev_list_node *loop, *tmp; - udev_list_node_foreach_safe(loop, tmp, &worker_list) { - struct worker *worker = node_to_worker(loop); + udev_list_node_foreach_safe(loop, tmp, &worker_list) { + struct worker *worker = node_to_worker(loop); - worker_cleanup(worker); - } + worker_cleanup(worker); + } } static void worker_new(struct event *event) { - struct udev *udev = event->udev; - struct worker *worker; - struct udev_monitor *worker_monitor; - pid_t pid; - - /* listen for new events */ - worker_monitor = udev_monitor_new_from_netlink(udev, NULL); - if (worker_monitor == NULL) - return; - /* allow the main daemon netlink address to send devices to the worker */ - udev_monitor_allow_unicast_sender(worker_monitor, monitor); - udev_monitor_enable_receiving(worker_monitor); - - worker = calloc(1, sizeof(struct worker)); - if (worker == NULL) { - udev_monitor_unref(worker_monitor); - return; - } - /* worker + event reference */ - worker->refcount = 2; - worker->udev = udev; - - pid = fork(); - switch (pid) { - case 0: { - struct udev_device *dev = NULL; - int fd_monitor; - struct epoll_event ep_signal, ep_monitor; - sigset_t mask; - int rc = EXIT_SUCCESS; - - /* move initial device from queue */ - dev = event->dev; - event->dev = NULL; - - free(worker); - worker_list_cleanup(udev); - event_queue_cleanup(udev, EVENT_UNDEF); - udev_queue_export_unref(udev_queue_export); - udev_monitor_unref(monitor); - udev_ctrl_unref(udev_ctrl); - close(fd_signal); - close(fd_ep); - close(worker_watch[READ_END]); - - sigfillset(&mask); - fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (fd_signal < 0) { - err(udev, "error creating signalfd %m\n"); - rc = 2; - goto out; - } - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - err(udev, "error creating epoll fd: %m\n"); - rc = 3; - goto out; - } - - memset(&ep_signal, 0, sizeof(struct epoll_event)); - ep_signal.events = EPOLLIN; - ep_signal.data.fd = fd_signal; - - fd_monitor = udev_monitor_get_fd(worker_monitor); - memset(&ep_monitor, 0, sizeof(struct epoll_event)); - ep_monitor.events = EPOLLIN; - ep_monitor.data.fd = fd_monitor; - - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_monitor, &ep_monitor) < 0) { - err(udev, "fail to add fds to epoll: %m\n"); - rc = 4; - goto out; - } - - /* request TERM signal if parent exits */ - prctl(PR_SET_PDEATHSIG, SIGTERM); - - for (;;) { - struct udev_event *udev_event; - struct worker_message msg; - int err; - - info(udev, "seq %llu running\n", udev_device_get_seqnum(dev)); - udev_event = udev_event_new(dev); - if (udev_event == NULL) { - rc = 5; - goto out; - } - - /* needed for SIGCHLD/SIGTERM in spawn() */ - udev_event->fd_signal = fd_signal; - - if (exec_delay > 0) - udev_event->exec_delay = exec_delay; - - /* apply rules, create node, symlinks */ - err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); - - if (err == 0) - udev_event_execute_run(udev_event, &sigmask_orig); - - /* apply/restore inotify watch */ - if (err == 0 && udev_event->inotify_watch) { - udev_watch_begin(udev, dev); - udev_device_update_db(dev); - } - - /* send processed event back to libudev listeners */ - udev_monitor_send_device(worker_monitor, NULL, dev); - - /* send udevd the result of the event execution */ - memset(&msg, 0, sizeof(struct worker_message)); - if (err != 0) - msg.exitcode = err; - msg.pid = getpid(); - send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); - - info(udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); - - udev_device_unref(dev); - dev = NULL; - - if (udev_event->sigterm) { - udev_event_unref(udev_event); - goto out; - } - - udev_event_unref(udev_event); - - /* wait for more device messages from main udevd, or term signal */ - while (dev == NULL) { - struct epoll_event ev[4]; - int fdcount; - int i; - - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); - if (fdcount < 0) { - if (errno == EINTR) - continue; - err = -errno; - err(udev, "failed to poll: %m\n"); - goto out; - } - - for (i = 0; i < fdcount; i++) { - if (ev[i].data.fd == fd_monitor && ev[i].events & EPOLLIN) { - dev = udev_monitor_receive_device(worker_monitor); - break; - } else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) { - struct signalfd_siginfo fdsi; - ssize_t size; - - size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); - if (size != sizeof(struct signalfd_siginfo)) - continue; - switch (fdsi.ssi_signo) { - case SIGTERM: - goto out; - } - } - } - } - } + struct udev *udev = event->udev; + struct worker *worker; + struct udev_monitor *worker_monitor; + pid_t pid; + + /* listen for new events */ + worker_monitor = udev_monitor_new_from_netlink(udev, NULL); + if (worker_monitor == NULL) + return; + /* allow the main daemon netlink address to send devices to the worker */ + udev_monitor_allow_unicast_sender(worker_monitor, monitor); + udev_monitor_enable_receiving(worker_monitor); + + worker = calloc(1, sizeof(struct worker)); + if (worker == NULL) { + udev_monitor_unref(worker_monitor); + return; + } + /* worker + event reference */ + worker->refcount = 2; + worker->udev = udev; + + pid = fork(); + switch (pid) { + case 0: { + struct udev_device *dev = NULL; + int fd_monitor; + struct epoll_event ep_signal, ep_monitor; + sigset_t mask; + int rc = EXIT_SUCCESS; + + /* move initial device from queue */ + dev = event->dev; + event->dev = NULL; + + free(worker); + worker_list_cleanup(udev); + event_queue_cleanup(udev, EVENT_UNDEF); + udev_queue_export_unref(udev_queue_export); + udev_monitor_unref(monitor); + udev_ctrl_unref(udev_ctrl); + close(fd_signal); + close(fd_ep); + close(worker_watch[READ_END]); + + sigfillset(&mask); + fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (fd_signal < 0) { + err(udev, "error creating signalfd %m\n"); + rc = 2; + goto out; + } + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + rc = 3; + goto out; + } + + memset(&ep_signal, 0, sizeof(struct epoll_event)); + ep_signal.events = EPOLLIN; + ep_signal.data.fd = fd_signal; + + fd_monitor = udev_monitor_get_fd(worker_monitor); + memset(&ep_monitor, 0, sizeof(struct epoll_event)); + ep_monitor.events = EPOLLIN; + ep_monitor.data.fd = fd_monitor; + + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_monitor, &ep_monitor) < 0) { + err(udev, "fail to add fds to epoll: %m\n"); + rc = 4; + goto out; + } + + /* request TERM signal if parent exits */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + + for (;;) { + struct udev_event *udev_event; + struct worker_message msg; + int err; + + info(udev, "seq %llu running\n", udev_device_get_seqnum(dev)); + udev_event = udev_event_new(dev); + if (udev_event == NULL) { + rc = 5; + goto out; + } + + /* needed for SIGCHLD/SIGTERM in spawn() */ + udev_event->fd_signal = fd_signal; + + if (exec_delay > 0) + udev_event->exec_delay = exec_delay; + + /* apply rules, create node, symlinks */ + err = udev_event_execute_rules(udev_event, rules, &sigmask_orig); + + if (err == 0) + udev_event_execute_run(udev_event, &sigmask_orig); + + /* apply/restore inotify watch */ + if (err == 0 && udev_event->inotify_watch) { + udev_watch_begin(udev, dev); + udev_device_update_db(dev); + } + + /* send processed event back to libudev listeners */ + udev_monitor_send_device(worker_monitor, NULL, dev); + + /* send udevd the result of the event execution */ + memset(&msg, 0, sizeof(struct worker_message)); + if (err != 0) + msg.exitcode = err; + msg.pid = getpid(); + send(worker_watch[WRITE_END], &msg, sizeof(struct worker_message), 0); + + info(udev, "seq %llu processed with %i\n", udev_device_get_seqnum(dev), err); + + udev_device_unref(dev); + dev = NULL; + + if (udev_event->sigterm) { + udev_event_unref(udev_event); + goto out; + } + + udev_event_unref(udev_event); + + /* wait for more device messages from main udevd, or term signal */ + while (dev == NULL) { + struct epoll_event ev[4]; + int fdcount; + int i; + + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), -1); + if (fdcount < 0) { + if (errno == EINTR) + continue; + err = -errno; + err(udev, "failed to poll: %m\n"); + goto out; + } + + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_monitor && ev[i].events & EPOLLIN) { + dev = udev_monitor_receive_device(worker_monitor); + break; + } else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) { + struct signalfd_siginfo fdsi; + ssize_t size; + + size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size != sizeof(struct signalfd_siginfo)) + continue; + switch (fdsi.ssi_signo) { + case SIGTERM: + goto out; + } + } + } + } + } out: - udev_device_unref(dev); - if (fd_signal >= 0) - close(fd_signal); - if (fd_ep >= 0) - close(fd_ep); - close(fd_inotify); - close(worker_watch[WRITE_END]); - udev_rules_unref(rules); - udev_monitor_unref(worker_monitor); - udev_unref(udev); - udev_log_close(); - exit(rc); - } - case -1: - udev_monitor_unref(worker_monitor); - event->state = EVENT_QUEUED; - free(worker); - err(udev, "fork of child failed: %m\n"); - break; - default: - /* close monitor, but keep address around */ - udev_monitor_disconnect(worker_monitor); - worker->monitor = worker_monitor; - worker->pid = pid; - worker->state = WORKER_RUNNING; - worker->event = event; - event->state = EVENT_RUNNING; - udev_list_node_append(&worker->node, &worker_list); - children++; - info(udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); - break; - } + udev_device_unref(dev); + if (fd_signal >= 0) + close(fd_signal); + if (fd_ep >= 0) + close(fd_ep); + close(fd_inotify); + close(worker_watch[WRITE_END]); + udev_rules_unref(rules); + udev_monitor_unref(worker_monitor); + udev_unref(udev); + udev_log_close(); + exit(rc); + } + case -1: + udev_monitor_unref(worker_monitor); + event->state = EVENT_QUEUED; + free(worker); + err(udev, "fork of child failed: %m\n"); + break; + default: + /* close monitor, but keep address around */ + udev_monitor_disconnect(worker_monitor); + worker->monitor = worker_monitor; + worker->pid = pid; + worker->state = WORKER_RUNNING; + worker->event = event; + event->state = EVENT_RUNNING; + udev_list_node_append(&worker->node, &worker_list); + children++; + info(udev, "seq %llu forked new worker [%u]\n", udev_device_get_seqnum(event->dev), pid); + break; + } } static void event_run(struct event *event) { - struct udev_list_node *loop; - - udev_list_node_foreach(loop, &worker_list) { - struct worker *worker = node_to_worker(loop); - ssize_t count; - - if (worker->state != WORKER_IDLE) - continue; - - count = udev_monitor_send_device(monitor, worker->monitor, event->dev); - if (count < 0) { - err(event->udev, "worker [%u] did not accept message %zi (%m), kill it\n", worker->pid, count); - kill(worker->pid, SIGKILL); - worker->state = WORKER_KILLED; - continue; - } - worker_ref(worker); - worker->event = event; - worker->state = WORKER_RUNNING; - event->state = EVENT_RUNNING; - return; - } - - if (children >= children_max) { - if (children_max > 1) - info(event->udev, "maximum number (%i) of children reached\n", children); - return; - } - - /* start new worker and pass initial device */ - worker_new(event); + struct udev_list_node *loop; + + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); + ssize_t count; + + if (worker->state != WORKER_IDLE) + continue; + + count = udev_monitor_send_device(monitor, worker->monitor, event->dev); + if (count < 0) { + err(event->udev, "worker [%u] did not accept message %zi (%m), kill it\n", worker->pid, count); + kill(worker->pid, SIGKILL); + worker->state = WORKER_KILLED; + continue; + } + worker_ref(worker); + worker->event = event; + worker->state = WORKER_RUNNING; + event->state = EVENT_RUNNING; + return; + } + + if (children >= children_max) { + if (children_max > 1) + info(event->udev, "maximum number (%i) of children reached\n", children); + return; + } + + /* start new worker and pass initial device */ + worker_new(event); } static int event_queue_insert(struct udev_device *dev) { - struct event *event; - - event = calloc(1, sizeof(struct event)); - if (event == NULL) - return -1; - - event->udev = udev_device_get_udev(dev); - event->dev = dev; - event->seqnum = udev_device_get_seqnum(dev); - event->devpath = udev_device_get_devpath(dev); - event->devpath_len = strlen(event->devpath); - event->devpath_old = udev_device_get_devpath_old(dev); - event->devnum = udev_device_get_devnum(dev); - event->is_block = (strcmp("block", udev_device_get_subsystem(dev)) == 0); - event->ifindex = udev_device_get_ifindex(dev); - - udev_queue_export_device_queued(udev_queue_export, dev); - info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev), - udev_device_get_action(dev), udev_device_get_subsystem(dev)); - - event->state = EVENT_QUEUED; - udev_list_node_append(&event->node, &event_list); - return 0; + struct event *event; + + event = calloc(1, sizeof(struct event)); + if (event == NULL) + return -1; + + event->udev = udev_device_get_udev(dev); + event->dev = dev; + event->seqnum = udev_device_get_seqnum(dev); + event->devpath = udev_device_get_devpath(dev); + event->devpath_len = strlen(event->devpath); + event->devpath_old = udev_device_get_devpath_old(dev); + event->devnum = udev_device_get_devnum(dev); + event->is_block = (strcmp("block", udev_device_get_subsystem(dev)) == 0); + event->ifindex = udev_device_get_ifindex(dev); + + udev_queue_export_device_queued(udev_queue_export, dev); + info(event->udev, "seq %llu queued, '%s' '%s'\n", udev_device_get_seqnum(dev), + udev_device_get_action(dev), udev_device_get_subsystem(dev)); + + event->state = EVENT_QUEUED; + udev_list_node_append(&event->node, &event_list); + return 0; } static void worker_kill(struct udev *udev, int retain) { - struct udev_list_node *loop; - int max; + struct udev_list_node *loop; + int max; - if (children <= retain) - return; + if (children <= retain) + return; - max = children - retain; + max = children - retain; - udev_list_node_foreach(loop, &worker_list) { - struct worker *worker = node_to_worker(loop); + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); - if (max-- <= 0) - break; + if (max-- <= 0) + break; - if (worker->state == WORKER_KILLED) - continue; + if (worker->state == WORKER_KILLED) + continue; - worker->state = WORKER_KILLED; - kill(worker->pid, SIGTERM); - } + worker->state = WORKER_KILLED; + kill(worker->pid, SIGTERM); + } } /* lookup event for identical, parent, child device */ static bool is_devpath_busy(struct event *event) { - struct udev_list_node *loop; - size_t common; - - /* check if queue contains events we depend on */ - udev_list_node_foreach(loop, &event_list) { - struct event *loop_event = node_to_event(loop); - - /* we already found a later event, earlier can not block us, no need to check again */ - if (loop_event->seqnum < event->delaying_seqnum) - continue; - - /* event we checked earlier still exists, no need to check again */ - if (loop_event->seqnum == event->delaying_seqnum) - return true; - - /* found ourself, no later event can block us */ - if (loop_event->seqnum >= event->seqnum) - break; - - /* check major/minor */ - if (major(event->devnum) != 0 && event->devnum == loop_event->devnum && event->is_block == loop_event->is_block) - return true; - - /* check network device ifindex */ - if (event->ifindex != 0 && event->ifindex == loop_event->ifindex) - return true; - - /* check our old name */ - if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) { - event->delaying_seqnum = loop_event->seqnum; - return true; - } - - /* compare devpath */ - common = MIN(loop_event->devpath_len, event->devpath_len); - - /* one devpath is contained in the other? */ - if (memcmp(loop_event->devpath, event->devpath, common) != 0) - continue; - - /* identical device event found */ - if (loop_event->devpath_len == event->devpath_len) { - /* devices names might have changed/swapped in the meantime */ - if (major(event->devnum) != 0 && (event->devnum != loop_event->devnum || event->is_block != loop_event->is_block)) - continue; - if (event->ifindex != 0 && event->ifindex != loop_event->ifindex) - continue; - event->delaying_seqnum = loop_event->seqnum; - return true; - } - - /* parent device event found */ - if (event->devpath[common] == '/') { - event->delaying_seqnum = loop_event->seqnum; - return true; - } - - /* child device event found */ - if (loop_event->devpath[common] == '/') { - event->delaying_seqnum = loop_event->seqnum; - return true; - } - - /* no matching device */ - continue; - } - - return false; + struct udev_list_node *loop; + size_t common; + + /* check if queue contains events we depend on */ + udev_list_node_foreach(loop, &event_list) { + struct event *loop_event = node_to_event(loop); + + /* we already found a later event, earlier can not block us, no need to check again */ + if (loop_event->seqnum < event->delaying_seqnum) + continue; + + /* event we checked earlier still exists, no need to check again */ + if (loop_event->seqnum == event->delaying_seqnum) + return true; + + /* found ourself, no later event can block us */ + if (loop_event->seqnum >= event->seqnum) + break; + + /* check major/minor */ + if (major(event->devnum) != 0 && event->devnum == loop_event->devnum && event->is_block == loop_event->is_block) + return true; + + /* check network device ifindex */ + if (event->ifindex != 0 && event->ifindex == loop_event->ifindex) + return true; + + /* check our old name */ + if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) { + event->delaying_seqnum = loop_event->seqnum; + return true; + } + + /* compare devpath */ + common = MIN(loop_event->devpath_len, event->devpath_len); + + /* one devpath is contained in the other? */ + if (memcmp(loop_event->devpath, event->devpath, common) != 0) + continue; + + /* identical device event found */ + if (loop_event->devpath_len == event->devpath_len) { + /* devices names might have changed/swapped in the meantime */ + if (major(event->devnum) != 0 && (event->devnum != loop_event->devnum || event->is_block != loop_event->is_block)) + continue; + if (event->ifindex != 0 && event->ifindex != loop_event->ifindex) + continue; + event->delaying_seqnum = loop_event->seqnum; + return true; + } + + /* parent device event found */ + if (event->devpath[common] == '/') { + event->delaying_seqnum = loop_event->seqnum; + return true; + } + + /* child device event found */ + if (loop_event->devpath[common] == '/') { + event->delaying_seqnum = loop_event->seqnum; + return true; + } + + /* no matching device */ + continue; + } + + return false; } static void event_queue_start(struct udev *udev) { - struct udev_list_node *loop; + struct udev_list_node *loop; - udev_list_node_foreach(loop, &event_list) { - struct event *event = node_to_event(loop); + udev_list_node_foreach(loop, &event_list) { + struct event *event = node_to_event(loop); - if (event->state != EVENT_QUEUED) - continue; + if (event->state != EVENT_QUEUED) + continue; - /* do not start event if parent or child event is still running */ - if (is_devpath_busy(event)) { - dbg(udev, "delay seq %llu (%s)\n", event->seqnum, event->devpath); - continue; - } + /* do not start event if parent or child event is still running */ + if (is_devpath_busy(event)) { + dbg(udev, "delay seq %llu (%s)\n", event->seqnum, event->devpath); + continue; + } - event_run(event); - } + event_run(event); + } } static void event_queue_cleanup(struct udev *udev, enum event_state match_type) { - struct udev_list_node *loop, *tmp; + struct udev_list_node *loop, *tmp; - udev_list_node_foreach_safe(loop, tmp, &event_list) { - struct event *event = node_to_event(loop); + udev_list_node_foreach_safe(loop, tmp, &event_list) { + struct event *event = node_to_event(loop); - if (match_type != EVENT_UNDEF && match_type != event->state) - continue; + if (match_type != EVENT_UNDEF && match_type != event->state) + continue; - event_queue_delete(event, false); - } + event_queue_delete(event, false); + } } static void worker_returned(int fd_worker) { - for (;;) { - struct worker_message msg; - ssize_t size; - struct udev_list_node *loop; - - size = recv(fd_worker, &msg, sizeof(struct worker_message), MSG_DONTWAIT); - if (size != sizeof(struct worker_message)) - break; - - /* lookup worker who sent the signal */ - udev_list_node_foreach(loop, &worker_list) { - struct worker *worker = node_to_worker(loop); - - if (worker->pid != msg.pid) - continue; - - /* worker returned */ - worker->event->exitcode = msg.exitcode; - event_queue_delete(worker->event, true); - worker->event = NULL; - if (worker->state != WORKER_KILLED) - worker->state = WORKER_IDLE; - worker_unref(worker); - break; - } - } + for (;;) { + struct worker_message msg; + ssize_t size; + struct udev_list_node *loop; + + size = recv(fd_worker, &msg, sizeof(struct worker_message), MSG_DONTWAIT); + if (size != sizeof(struct worker_message)) + break; + + /* lookup worker who sent the signal */ + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); + + if (worker->pid != msg.pid) + continue; + + /* worker returned */ + worker->event->exitcode = msg.exitcode; + event_queue_delete(worker->event, true); + worker->event = NULL; + if (worker->state != WORKER_KILLED) + worker->state = WORKER_IDLE; + worker_unref(worker); + break; + } + } } /* receive the udevd message from userspace */ static struct udev_ctrl_connection *handle_ctrl_msg(struct udev_ctrl *uctrl) { - struct udev *udev = udev_ctrl_get_udev(uctrl); - struct udev_ctrl_connection *ctrl_conn; - struct udev_ctrl_msg *ctrl_msg = NULL; - const char *str; - int i; - - ctrl_conn = udev_ctrl_get_connection(uctrl); - if (ctrl_conn == NULL) - goto out; - - ctrl_msg = udev_ctrl_receive_msg(ctrl_conn); - if (ctrl_msg == NULL) - goto out; - - i = udev_ctrl_get_set_log_level(ctrl_msg); - if (i >= 0) { - info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", i); - udev_set_log_priority(udev, i); - worker_kill(udev, 0); - } - - if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) { - info(udev, "udevd message (STOP_EXEC_QUEUE) received\n"); - stop_exec_queue = true; - } - - if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) { - info(udev, "udevd message (START_EXEC_QUEUE) received\n"); - stop_exec_queue = false; - } - - if (udev_ctrl_get_reload(ctrl_msg) > 0) { - info(udev, "udevd message (RELOAD) received\n"); - reload = true; - } - - str = udev_ctrl_get_set_env(ctrl_msg); - if (str != NULL) { - char *key; - - key = strdup(str); - if (key != NULL) { - char *val; - - val = strchr(key, '='); - if (val != NULL) { - val[0] = '\0'; - val = &val[1]; - if (val[0] == '\0') { - info(udev, "udevd message (ENV) received, unset '%s'\n", key); - udev_add_property(udev, key, NULL); - } else { - info(udev, "udevd message (ENV) received, set '%s=%s'\n", key, val); - udev_add_property(udev, key, val); - } - } else { - err(udev, "wrong key format '%s'\n", key); - } - free(key); - } - worker_kill(udev, 0); - } - - i = udev_ctrl_get_set_children_max(ctrl_msg); - if (i >= 0) { - info(udev, "udevd message (SET_MAX_CHILDREN) received, children_max=%i\n", i); - children_max = i; - } - - if (udev_ctrl_get_ping(ctrl_msg) > 0) - info(udev, "udevd message (SYNC) received\n"); - - if (udev_ctrl_get_exit(ctrl_msg) > 0) { - info(udev, "udevd message (EXIT) received\n"); - udev_exit = true; - /* keep reference to block the client until we exit */ - udev_ctrl_connection_ref(ctrl_conn); - } + struct udev *udev = udev_ctrl_get_udev(uctrl); + struct udev_ctrl_connection *ctrl_conn; + struct udev_ctrl_msg *ctrl_msg = NULL; + const char *str; + int i; + + ctrl_conn = udev_ctrl_get_connection(uctrl); + if (ctrl_conn == NULL) + goto out; + + ctrl_msg = udev_ctrl_receive_msg(ctrl_conn); + if (ctrl_msg == NULL) + goto out; + + i = udev_ctrl_get_set_log_level(ctrl_msg); + if (i >= 0) { + info(udev, "udevd message (SET_LOG_PRIORITY) received, log_priority=%i\n", i); + udev_set_log_priority(udev, i); + worker_kill(udev, 0); + } + + if (udev_ctrl_get_stop_exec_queue(ctrl_msg) > 0) { + info(udev, "udevd message (STOP_EXEC_QUEUE) received\n"); + stop_exec_queue = true; + } + + if (udev_ctrl_get_start_exec_queue(ctrl_msg) > 0) { + info(udev, "udevd message (START_EXEC_QUEUE) received\n"); + stop_exec_queue = false; + } + + if (udev_ctrl_get_reload(ctrl_msg) > 0) { + info(udev, "udevd message (RELOAD) received\n"); + reload = true; + } + + str = udev_ctrl_get_set_env(ctrl_msg); + if (str != NULL) { + char *key; + + key = strdup(str); + if (key != NULL) { + char *val; + + val = strchr(key, '='); + if (val != NULL) { + val[0] = '\0'; + val = &val[1]; + if (val[0] == '\0') { + info(udev, "udevd message (ENV) received, unset '%s'\n", key); + udev_add_property(udev, key, NULL); + } else { + info(udev, "udevd message (ENV) received, set '%s=%s'\n", key, val); + udev_add_property(udev, key, val); + } + } else { + err(udev, "wrong key format '%s'\n", key); + } + free(key); + } + worker_kill(udev, 0); + } + + i = udev_ctrl_get_set_children_max(ctrl_msg); + if (i >= 0) { + info(udev, "udevd message (SET_MAX_CHILDREN) received, children_max=%i\n", i); + children_max = i; + } + + if (udev_ctrl_get_ping(ctrl_msg) > 0) + info(udev, "udevd message (SYNC) received\n"); + + if (udev_ctrl_get_exit(ctrl_msg) > 0) { + info(udev, "udevd message (EXIT) received\n"); + udev_exit = true; + /* keep reference to block the client until we exit */ + udev_ctrl_connection_ref(ctrl_conn); + } out: - udev_ctrl_msg_unref(ctrl_msg); - return udev_ctrl_connection_unref(ctrl_conn); + udev_ctrl_msg_unref(ctrl_msg); + return udev_ctrl_connection_unref(ctrl_conn); } /* read inotify messages */ static int handle_inotify(struct udev *udev) { - int nbytes, pos; - char *buf; - struct inotify_event *ev; - - if ((ioctl(fd_inotify, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) - return 0; - - buf = malloc(nbytes); - if (buf == NULL) { - err(udev, "error getting buffer for inotify\n"); - return -1; - } - - nbytes = read(fd_inotify, buf, nbytes); - - for (pos = 0; pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) { - struct udev_device *dev; - - ev = (struct inotify_event *)(buf + pos); - dev = udev_watch_lookup(udev, ev->wd); - if (dev != NULL) { - info(udev, "inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev)); - if (ev->mask & IN_CLOSE_WRITE) { - char filename[UTIL_PATH_SIZE]; - int fd; - - info(udev, "device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev)); - util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); - fd = open(filename, O_WRONLY); - if (fd >= 0) { - if (write(fd, "change", 6) < 0) - info(udev, "error writing uevent: %m\n"); - close(fd); - } - } - if (ev->mask & IN_IGNORED) - udev_watch_end(udev, dev); - - udev_device_unref(dev); - } - - } - - free(buf); - return 0; + int nbytes, pos; + char *buf; + struct inotify_event *ev; + + if ((ioctl(fd_inotify, FIONREAD, &nbytes) < 0) || (nbytes <= 0)) + return 0; + + buf = malloc(nbytes); + if (buf == NULL) { + err(udev, "error getting buffer for inotify\n"); + return -1; + } + + nbytes = read(fd_inotify, buf, nbytes); + + for (pos = 0; pos < nbytes; pos += sizeof(struct inotify_event) + ev->len) { + struct udev_device *dev; + + ev = (struct inotify_event *)(buf + pos); + dev = udev_watch_lookup(udev, ev->wd); + if (dev != NULL) { + info(udev, "inotify event: %x for %s\n", ev->mask, udev_device_get_devnode(dev)); + if (ev->mask & IN_CLOSE_WRITE) { + char filename[UTIL_PATH_SIZE]; + int fd; + + info(udev, "device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev)); + util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); + fd = open(filename, O_WRONLY); + if (fd >= 0) { + if (write(fd, "change", 6) < 0) + info(udev, "error writing uevent: %m\n"); + close(fd); + } + } + if (ev->mask & IN_IGNORED) + udev_watch_end(udev, dev); + + udev_device_unref(dev); + } + + } + + free(buf); + return 0; } static void handle_signal(struct udev *udev, int signo) { - switch (signo) { - case SIGINT: - case SIGTERM: - udev_exit = true; - break; - case SIGCHLD: - for (;;) { - pid_t pid; - int status; - struct udev_list_node *loop, *tmp; - - pid = waitpid(-1, &status, WNOHANG); - if (pid <= 0) - break; - - udev_list_node_foreach_safe(loop, tmp, &worker_list) { - struct worker *worker = node_to_worker(loop); - - if (worker->pid != pid) - continue; - info(udev, "worker [%u] exit\n", pid); - - if (WIFEXITED(status)) { - if (WEXITSTATUS(status) != 0) - err(udev, "worker [%u] exit with return code %i\n", pid, WEXITSTATUS(status)); - } else if (WIFSIGNALED(status)) { - err(udev, "worker [%u] terminated by signal %i (%s)\n", - pid, WTERMSIG(status), strsignal(WTERMSIG(status))); - } else if (WIFSTOPPED(status)) { - err(udev, "worker [%u] stopped\n", pid); - } else if (WIFCONTINUED(status)) { - err(udev, "worker [%u] continued\n", pid); - } else { - err(udev, "worker [%u] exit with status 0x%04x\n", pid, status); - } - - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - if (worker->event != NULL) { - err(udev, "worker [%u] failed while handling '%s'\n", - pid, worker->event->devpath); - worker->event->exitcode = -32; - event_queue_delete(worker->event, true); - /* drop reference taken for state 'running' */ - worker_unref(worker); - } - } - worker_unref(worker); - break; - } - } - break; - case SIGHUP: - reload = true; - break; - } + switch (signo) { + case SIGINT: + case SIGTERM: + udev_exit = true; + break; + case SIGCHLD: + for (;;) { + pid_t pid; + int status; + struct udev_list_node *loop, *tmp; + + pid = waitpid(-1, &status, WNOHANG); + if (pid <= 0) + break; + + udev_list_node_foreach_safe(loop, tmp, &worker_list) { + struct worker *worker = node_to_worker(loop); + + if (worker->pid != pid) + continue; + info(udev, "worker [%u] exit\n", pid); + + if (WIFEXITED(status)) { + if (WEXITSTATUS(status) != 0) + err(udev, "worker [%u] exit with return code %i\n", pid, WEXITSTATUS(status)); + } else if (WIFSIGNALED(status)) { + err(udev, "worker [%u] terminated by signal %i (%s)\n", + pid, WTERMSIG(status), strsignal(WTERMSIG(status))); + } else if (WIFSTOPPED(status)) { + err(udev, "worker [%u] stopped\n", pid); + } else if (WIFCONTINUED(status)) { + err(udev, "worker [%u] continued\n", pid); + } else { + err(udev, "worker [%u] exit with status 0x%04x\n", pid, status); + } + + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { + if (worker->event != NULL) { + err(udev, "worker [%u] failed while handling '%s'\n", + pid, worker->event->devpath); + worker->event->exitcode = -32; + event_queue_delete(worker->event, true); + /* drop reference taken for state 'running' */ + worker_unref(worker); + } + } + worker_unref(worker); + break; + } + } + break; + case SIGHUP: + reload = true; + break; + } } static void static_dev_create_from_modules(struct udev *udev) { - struct utsname kernel; - char modules[UTIL_PATH_SIZE]; - char buf[4096]; - FILE *f; - - uname(&kernel); - util_strscpyl(modules, sizeof(modules), "/lib/modules/", kernel.release, "/modules.devname", NULL); - f = fopen(modules, "r"); - if (f == NULL) - return; - - while (fgets(buf, sizeof(buf), f) != NULL) { - char *s; - const char *modname; - const char *devname; - const char *devno; - int maj, min; - char type; - mode_t mode; - char filename[UTIL_PATH_SIZE]; - - if (buf[0] == '#') - continue; - - modname = buf; - s = strchr(modname, ' '); - if (s == NULL) - continue; - s[0] = '\0'; - - devname = &s[1]; - s = strchr(devname, ' '); - if (s == NULL) - continue; - s[0] = '\0'; - - devno = &s[1]; - s = strchr(devno, ' '); - if (s == NULL) - s = strchr(devno, '\n'); - if (s != NULL) - s[0] = '\0'; - if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3) - continue; - - if (type == 'c') - mode = S_IFCHR; - else if (type == 'b') - mode = S_IFBLK; - else - continue; - - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/", devname, NULL); - util_create_path_selinux(udev, filename); - udev_selinux_setfscreatecon(udev, filename, mode); - info(udev, "mknod '%s' %c%u:%u\n", filename, type, maj, min); - if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST) - utimensat(AT_FDCWD, filename, NULL, 0); - udev_selinux_resetfscreatecon(udev); - } - - fclose(f); + struct utsname kernel; + char modules[UTIL_PATH_SIZE]; + char buf[4096]; + FILE *f; + + uname(&kernel); + util_strscpyl(modules, sizeof(modules), "/lib/modules/", kernel.release, "/modules.devname", NULL); + f = fopen(modules, "r"); + if (f == NULL) + return; + + while (fgets(buf, sizeof(buf), f) != NULL) { + char *s; + const char *modname; + const char *devname; + const char *devno; + int maj, min; + char type; + mode_t mode; + char filename[UTIL_PATH_SIZE]; + + if (buf[0] == '#') + continue; + + modname = buf; + s = strchr(modname, ' '); + if (s == NULL) + continue; + s[0] = '\0'; + + devname = &s[1]; + s = strchr(devname, ' '); + if (s == NULL) + continue; + s[0] = '\0'; + + devno = &s[1]; + s = strchr(devno, ' '); + if (s == NULL) + s = strchr(devno, '\n'); + if (s != NULL) + s[0] = '\0'; + if (sscanf(devno, "%c%u:%u", &type, &maj, &min) != 3) + continue; + + if (type == 'c') + mode = S_IFCHR; + else if (type == 'b') + mode = S_IFBLK; + else + continue; + + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/", devname, NULL); + util_create_path_selinux(udev, filename); + udev_selinux_setfscreatecon(udev, filename, mode); + info(udev, "mknod '%s' %c%u:%u\n", filename, type, maj, min); + if (mknod(filename, mode, makedev(maj, min)) < 0 && errno == EEXIST) + utimensat(AT_FDCWD, filename, NULL, 0); + udev_selinux_resetfscreatecon(udev); + } + + fclose(f); } static int copy_dev_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth) { - struct dirent *dent; - - for (dent = readdir(dir_from); dent != NULL; dent = readdir(dir_from)) { - struct stat stats; - - if (dent->d_name[0] == '.') - continue; - if (fstatat(dirfd(dir_from), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) - continue; - - if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { - udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, stats.st_mode & 0777); - if (mknodat(dirfd(dir_to), dent->d_name, stats.st_mode, stats.st_rdev) == 0) { - fchmodat(dirfd(dir_to), dent->d_name, stats.st_mode & 0777, 0); - fchownat(dirfd(dir_to), dent->d_name, stats.st_uid, stats.st_gid, 0); - } else { - utimensat(dirfd(dir_to), dent->d_name, NULL, 0); - } - udev_selinux_resetfscreatecon(udev); - } else if (S_ISLNK(stats.st_mode)) { - char target[UTIL_PATH_SIZE]; - ssize_t len; - - len = readlinkat(dirfd(dir_from), dent->d_name, target, sizeof(target)); - if (len <= 0 || len == (ssize_t)sizeof(target)) - continue; - target[len] = '\0'; - udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFLNK); - if (symlinkat(target, dirfd(dir_to), dent->d_name) < 0 && errno == EEXIST) - utimensat(dirfd(dir_to), dent->d_name, NULL, AT_SYMLINK_NOFOLLOW); - udev_selinux_resetfscreatecon(udev); - } else if (S_ISDIR(stats.st_mode)) { - DIR *dir2_from, *dir2_to; - - if (maxdepth == 0) - continue; - - udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFDIR|0755); - mkdirat(dirfd(dir_to), dent->d_name, 0755); - udev_selinux_resetfscreatecon(udev); - - dir2_to = fdopendir(openat(dirfd(dir_to), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); - if (dir2_to == NULL) - continue; - - dir2_from = fdopendir(openat(dirfd(dir_from), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); - if (dir2_from == NULL) { - closedir(dir2_to); - continue; - } - - copy_dev_dir(udev, dir2_from, dir2_to, maxdepth-1); - - closedir(dir2_to); - closedir(dir2_from); - } - } - - return 0; + struct dirent *dent; + + for (dent = readdir(dir_from); dent != NULL; dent = readdir(dir_from)) { + struct stat stats; + + if (dent->d_name[0] == '.') + continue; + if (fstatat(dirfd(dir_from), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0) + continue; + + if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) { + udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, stats.st_mode & 0777); + if (mknodat(dirfd(dir_to), dent->d_name, stats.st_mode, stats.st_rdev) == 0) { + fchmodat(dirfd(dir_to), dent->d_name, stats.st_mode & 0777, 0); + fchownat(dirfd(dir_to), dent->d_name, stats.st_uid, stats.st_gid, 0); + } else { + utimensat(dirfd(dir_to), dent->d_name, NULL, 0); + } + udev_selinux_resetfscreatecon(udev); + } else if (S_ISLNK(stats.st_mode)) { + char target[UTIL_PATH_SIZE]; + ssize_t len; + + len = readlinkat(dirfd(dir_from), dent->d_name, target, sizeof(target)); + if (len <= 0 || len == (ssize_t)sizeof(target)) + continue; + target[len] = '\0'; + udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFLNK); + if (symlinkat(target, dirfd(dir_to), dent->d_name) < 0 && errno == EEXIST) + utimensat(dirfd(dir_to), dent->d_name, NULL, AT_SYMLINK_NOFOLLOW); + udev_selinux_resetfscreatecon(udev); + } else if (S_ISDIR(stats.st_mode)) { + DIR *dir2_from, *dir2_to; + + if (maxdepth == 0) + continue; + + udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFDIR|0755); + mkdirat(dirfd(dir_to), dent->d_name, 0755); + udev_selinux_resetfscreatecon(udev); + + dir2_to = fdopendir(openat(dirfd(dir_to), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2_to == NULL) + continue; + + dir2_from = fdopendir(openat(dirfd(dir_from), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC)); + if (dir2_from == NULL) { + closedir(dir2_to); + continue; + } + + copy_dev_dir(udev, dir2_from, dir2_to, maxdepth-1); + + closedir(dir2_to); + closedir(dir2_from); + } + } + + return 0; } static void static_dev_create_links(struct udev *udev, DIR *dir) { - struct stdlinks { - const char *link; - const char *target; - }; - static const struct stdlinks stdlinks[] = { - { "core", "/proc/kcore" }, - { "fd", "/proc/self/fd" }, - { "stdin", "/proc/self/fd/0" }, - { "stdout", "/proc/self/fd/1" }, - { "stderr", "/proc/self/fd/2" }, - }; - unsigned int i; - - for (i = 0; i < ARRAY_SIZE(stdlinks); i++) { - struct stat sb; - - if (stat(stdlinks[i].target, &sb) == 0) { - udev_selinux_setfscreateconat(udev, dirfd(dir), stdlinks[i].link, S_IFLNK); - if (symlinkat(stdlinks[i].target, dirfd(dir), stdlinks[i].link) < 0 && errno == EEXIST) - utimensat(dirfd(dir), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); - udev_selinux_resetfscreatecon(udev); - } - } + struct stdlinks { + const char *link; + const char *target; + }; + static const struct stdlinks stdlinks[] = { + { "core", "/proc/kcore" }, + { "fd", "/proc/self/fd" }, + { "stdin", "/proc/self/fd/0" }, + { "stdout", "/proc/self/fd/1" }, + { "stderr", "/proc/self/fd/2" }, + }; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(stdlinks); i++) { + struct stat sb; + + if (stat(stdlinks[i].target, &sb) == 0) { + udev_selinux_setfscreateconat(udev, dirfd(dir), stdlinks[i].link, S_IFLNK); + if (symlinkat(stdlinks[i].target, dirfd(dir), stdlinks[i].link) < 0 && errno == EEXIST) + utimensat(dirfd(dir), stdlinks[i].link, NULL, AT_SYMLINK_NOFOLLOW); + udev_selinux_resetfscreatecon(udev); + } + } } static void static_dev_create_from_devices(struct udev *udev, DIR *dir) { - DIR *dir_from; + DIR *dir_from; - dir_from = opendir(PKGLIBEXECDIR "/devices"); - if (dir_from == NULL) - return; - copy_dev_dir(udev, dir_from, dir, 8); - closedir(dir_from); + dir_from = opendir(PKGLIBEXECDIR "/devices"); + if (dir_from == NULL) + return; + copy_dev_dir(udev, dir_from, dir, 8); + closedir(dir_from); } static void static_dev_create(struct udev *udev) { - DIR *dir; + DIR *dir; - dir = opendir(udev_get_dev_path(udev)); - if (dir == NULL) - return; + dir = opendir(udev_get_dev_path(udev)); + if (dir == NULL) + return; - static_dev_create_links(udev, dir); - static_dev_create_from_devices(udev, dir); + static_dev_create_links(udev, dir); + static_dev_create_from_devices(udev, dir); - closedir(dir); + closedir(dir); } static int mem_size_mb(void) { - FILE *f; - char buf[4096]; - long int memsize = -1; + FILE *f; + char buf[4096]; + long int memsize = -1; - f = fopen("/proc/meminfo", "r"); - if (f == NULL) - return -1; + f = fopen("/proc/meminfo", "r"); + if (f == NULL) + return -1; - while (fgets(buf, sizeof(buf), f) != NULL) { - long int value; + while (fgets(buf, sizeof(buf), f) != NULL) { + long int value; - if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { - memsize = value / 1024; - break; - } - } + if (sscanf(buf, "MemTotal: %ld kB", &value) == 1) { + memsize = value / 1024; + break; + } + } - fclose(f); - return memsize; + fclose(f); + return memsize; } static int convert_db(struct udev *udev) { - char filename[UTIL_PATH_SIZE]; - FILE *f; - struct udev_enumerate *udev_enumerate; - struct udev_list_entry *list_entry; - - /* current database */ - util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); - if (access(filename, F_OK) >= 0) - return 0; - - /* make sure we do not get here again */ - util_create_path(udev, filename); - mkdir(filename, 0755); - - /* old database */ - util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db", NULL); - if (access(filename, F_OK) < 0) - return 0; - - f = fopen("/dev/kmsg", "w"); - if (f != NULL) { - fprintf(f, "<30>udevd[%u]: converting old udev database\n", getpid()); - fclose(f); - } - - udev_enumerate = udev_enumerate_new(udev); - if (udev_enumerate == NULL) - return -1; - udev_enumerate_scan_devices(udev_enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { - struct udev_device *device; - - device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - - /* try to find the old database for devices without a current one */ - if (udev_device_read_db(device, NULL) < 0) { - bool have_db; - const char *id; - struct stat stats; - char devpath[UTIL_PATH_SIZE]; - char from[UTIL_PATH_SIZE]; - - have_db = false; - - /* find database in old location */ - id = udev_device_get_id_filename(device); - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", id, NULL); - if (lstat(from, &stats) == 0) { - if (!have_db) { - udev_device_read_db(device, from); - have_db = true; - } - unlink(from); - } - - /* find old database with $subsys:$sysname name */ - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), - "/.udev/db/", udev_device_get_subsystem(device), ":", - udev_device_get_sysname(device), NULL); - if (lstat(from, &stats) == 0) { - if (!have_db) { - udev_device_read_db(device, from); - have_db = true; - } - unlink(from); - } - - /* find old database with the encoded devpath name */ - util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); - util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", devpath, NULL); - if (lstat(from, &stats) == 0) { - if (!have_db) { - udev_device_read_db(device, from); - have_db = true; - } - unlink(from); - } - - /* write out new database */ - if (have_db) - udev_device_update_db(device); - } - udev_device_unref(device); - } - udev_enumerate_unref(udev_enumerate); - return 0; + char filename[UTIL_PATH_SIZE]; + FILE *f; + struct udev_enumerate *udev_enumerate; + struct udev_list_entry *list_entry; + + /* current database */ + util_strscpyl(filename, sizeof(filename), udev_get_run_path(udev), "/data", NULL); + if (access(filename, F_OK) >= 0) + return 0; + + /* make sure we do not get here again */ + util_create_path(udev, filename); + mkdir(filename, 0755); + + /* old database */ + util_strscpyl(filename, sizeof(filename), udev_get_dev_path(udev), "/.udev/db", NULL); + if (access(filename, F_OK) < 0) + return 0; + + f = fopen("/dev/kmsg", "w"); + if (f != NULL) { + fprintf(f, "<30>udevd[%u]: converting old udev database\n", getpid()); + fclose(f); + } + + udev_enumerate = udev_enumerate_new(udev); + if (udev_enumerate == NULL) + return -1; + udev_enumerate_scan_devices(udev_enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(udev_enumerate)) { + struct udev_device *device; + + device = udev_device_new_from_syspath(udev, udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + + /* try to find the old database for devices without a current one */ + if (udev_device_read_db(device, NULL) < 0) { + bool have_db; + const char *id; + struct stat stats; + char devpath[UTIL_PATH_SIZE]; + char from[UTIL_PATH_SIZE]; + + have_db = false; + + /* find database in old location */ + id = udev_device_get_id_filename(device); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", id, NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* find old database with $subsys:$sysname name */ + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), + "/.udev/db/", udev_device_get_subsystem(device), ":", + udev_device_get_sysname(device), NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* find old database with the encoded devpath name */ + util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); + util_strscpyl(from, sizeof(from), udev_get_dev_path(udev), "/.udev/db/", devpath, NULL); + if (lstat(from, &stats) == 0) { + if (!have_db) { + udev_device_read_db(device, from); + have_db = true; + } + unlink(from); + } + + /* write out new database */ + if (have_db) + udev_device_update_db(device); + } + udev_device_unref(device); + } + udev_enumerate_unref(udev_enumerate); + return 0; } static int systemd_fds(struct udev *udev, int *rctrl, int *rnetlink) { - int ctrl = -1, netlink = -1; - int fd, n; - - n = sd_listen_fds(true); - if (n <= 0) - return -1; - - for (fd = SD_LISTEN_FDS_START; fd < n + SD_LISTEN_FDS_START; fd++) { - if (sd_is_socket(fd, AF_LOCAL, SOCK_SEQPACKET, -1)) { - if (ctrl >= 0) - return -1; - ctrl = fd; - continue; - } - - if (sd_is_socket(fd, AF_NETLINK, SOCK_RAW, -1)) { - if (netlink >= 0) - return -1; - netlink = fd; - continue; - } - - return -1; - } - - if (ctrl < 0 || netlink < 0) - return -1; - - info(udev, "ctrl=%i netlink=%i\n", ctrl, netlink); - *rctrl = ctrl; - *rnetlink = netlink; - return 0; + int ctrl = -1, netlink = -1; + int fd, n; + + n = sd_listen_fds(true); + if (n <= 0) + return -1; + + for (fd = SD_LISTEN_FDS_START; fd < n + SD_LISTEN_FDS_START; fd++) { + if (sd_is_socket(fd, AF_LOCAL, SOCK_SEQPACKET, -1)) { + if (ctrl >= 0) + return -1; + ctrl = fd; + continue; + } + + if (sd_is_socket(fd, AF_NETLINK, SOCK_RAW, -1)) { + if (netlink >= 0) + return -1; + netlink = fd; + continue; + } + + return -1; + } + + if (ctrl < 0 || netlink < 0) + return -1; + + info(udev, "ctrl=%i netlink=%i\n", ctrl, netlink); + *rctrl = ctrl; + *rnetlink = netlink; + return 0; } static bool check_rules_timestamp(struct udev *udev) { - char **p; - unsigned long long *stamp_usec; - int i, n; - bool changed = false; + char **p; + unsigned long long *stamp_usec; + int i, n; + bool changed = false; - n = udev_get_rules_path(udev, &p, &stamp_usec); - for (i = 0; i < n; i++) { - struct stat stats; + n = udev_get_rules_path(udev, &p, &stamp_usec); + for (i = 0; i < n; i++) { + struct stat stats; - if (stat(p[i], &stats) < 0) - continue; + if (stat(p[i], &stats) < 0) + continue; - if (stamp_usec[i] == ts_usec(&stats.st_mtim)) - continue; + if (stamp_usec[i] == ts_usec(&stats.st_mtim)) + continue; - /* first check */ - if (stamp_usec[i] != 0) { - info(udev, "reload - timestamp of '%s' changed\n", p[i]); - changed = true; - } + /* first check */ + if (stamp_usec[i] != 0) { + info(udev, "reload - timestamp of '%s' changed\n", p[i]); + changed = true; + } - /* update timestamp */ - stamp_usec[i] = ts_usec(&stats.st_mtim); - } + /* update timestamp */ + stamp_usec[i] = ts_usec(&stats.st_mtim); + } - return changed; + return changed; } int main(int argc, char *argv[]) { - struct udev *udev; - FILE *f; - sigset_t mask; - int daemonize = false; - int resolve_names = 1; - static const struct option options[] = { - { "daemon", no_argument, NULL, 'd' }, - { "debug", no_argument, NULL, 'D' }, - { "children-max", required_argument, NULL, 'c' }, - { "exec-delay", required_argument, NULL, 'e' }, - { "resolve-names", required_argument, NULL, 'N' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - {} - }; - int fd_ctrl = -1; - int fd_netlink = -1; - int fd_worker = -1; - struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker; - struct udev_ctrl_connection *ctrl_conn = NULL; - char **s; - int rc = 1; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("udevd"); - udev_set_log_fn(udev, udev_main_log); - info(udev, "version %s\n", VERSION); - udev_selinux_init(udev); - - for (;;) { - int option; - - option = getopt_long(argc, argv, "c:deDtN:hV", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - daemonize = true; - break; - case 'c': - children_max = strtoul(optarg, NULL, 0); - break; - case 'e': - exec_delay = strtoul(optarg, NULL, 0); - break; - case 'D': - debug = true; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'N': - if (strcmp (optarg, "early") == 0) { - resolve_names = 1; - } else if (strcmp (optarg, "late") == 0) { - resolve_names = 0; - } else if (strcmp (optarg, "never") == 0) { - resolve_names = -1; - } else { - fprintf(stderr, "resolve-names must be early, late or never\n"); - err(udev, "resolve-names must be early, late or never\n"); - goto exit; - } - break; - case 'h': - printf("Usage: udevd OPTIONS\n" - " --daemon\n" - " --debug\n" - " --children-max=\n" - " --exec-delay=\n" - " --resolve-names=early|late|never\n" - " --version\n" - " --help\n" - "\n"); - goto exit; - case 'V': - printf("%s\n", VERSION); - goto exit; - default: - goto exit; - } - } - - /* - * read the kernel commandline, in case we need to get into debug mode - * udev.log-priority= syslog priority - * udev.children-max= events are fully serialized if set to 1 - * - */ - f = fopen("/proc/cmdline", "r"); - if (f != NULL) { - char cmdline[4096]; - - if (fgets(cmdline, sizeof(cmdline), f) != NULL) { - char *pos; - - pos = strstr(cmdline, "udev.log-priority="); - if (pos != NULL) { - pos += strlen("udev.log-priority="); - udev_set_log_priority(udev, util_log_priority(pos)); - } - - pos = strstr(cmdline, "udev.children-max="); - if (pos != NULL) { - pos += strlen("udev.children-max="); - children_max = strtoul(pos, NULL, 0); - } - - pos = strstr(cmdline, "udev.exec-delay="); - if (pos != NULL) { - pos += strlen("udev.exec-delay="); - exec_delay = strtoul(pos, NULL, 0); - } - } - fclose(f); - } - - if (getuid() != 0) { - fprintf(stderr, "root privileges required\n"); - err(udev, "root privileges required\n"); - goto exit; - } - - /* set umask before creating any file/directory */ - chdir("/"); - umask(022); - - /* /run/udev */ - mkdir(udev_get_run_path(udev), 0755); - - /* create standard links, copy static nodes, create nodes from modules */ - static_dev_create(udev); - static_dev_create_from_modules(udev); - - /* before opening new files, make sure std{in,out,err} fds are in a sane state */ - if (daemonize) { - int fd; - - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - if (write(STDOUT_FILENO, 0, 0) < 0) - dup2(fd, STDOUT_FILENO); - if (write(STDERR_FILENO, 0, 0) < 0) - dup2(fd, STDERR_FILENO); - if (fd > STDERR_FILENO) - close(fd); - } else { - fprintf(stderr, "cannot open /dev/null\n"); - err(udev, "cannot open /dev/null\n"); - } - } - - if (systemd_fds(udev, &fd_ctrl, &fd_netlink) >= 0) { - /* get control and netlink socket from from systemd */ - udev_ctrl = udev_ctrl_new_from_fd(udev, fd_ctrl); - if (udev_ctrl == NULL) { - err(udev, "error taking over udev control socket"); - rc = 1; - goto exit; - } - - monitor = udev_monitor_new_from_netlink_fd(udev, "kernel", fd_netlink); - if (monitor == NULL) { - err(udev, "error taking over netlink socket\n"); - rc = 3; - goto exit; - } - } else { - /* open control and netlink socket */ - udev_ctrl = udev_ctrl_new(udev); - if (udev_ctrl == NULL) { - fprintf(stderr, "error initializing udev control socket"); - err(udev, "error initializing udev control socket"); - rc = 1; - goto exit; - } - fd_ctrl = udev_ctrl_get_fd(udev_ctrl); - - monitor = udev_monitor_new_from_netlink(udev, "kernel"); - if (monitor == NULL) { - fprintf(stderr, "error initializing netlink socket\n"); - err(udev, "error initializing netlink socket\n"); - rc = 3; - goto exit; - } - fd_netlink = udev_monitor_get_fd(monitor); - } - - if (udev_monitor_enable_receiving(monitor) < 0) { - fprintf(stderr, "error binding netlink socket\n"); - err(udev, "error binding netlink socket\n"); - rc = 3; - goto exit; - } - - if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { - fprintf(stderr, "error binding udev control socket\n"); - err(udev, "error binding udev control socket\n"); - rc = 1; - goto exit; - } - - udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); - - /* create queue file before signalling 'ready', to make sure we block 'settle' */ - udev_queue_export = udev_queue_export_new(udev); - if (udev_queue_export == NULL) { - err(udev, "error creating queue file\n"); - goto exit; - } - - if (daemonize) { - pid_t pid; - int fd; - - pid = fork(); - switch (pid) { - case 0: - break; - case -1: - err(udev, "fork of daemon failed: %m\n"); - rc = 4; - goto exit; - default: - rc = EXIT_SUCCESS; - goto exit_daemonize; - } - - setsid(); - - fd = open("/proc/self/oom_score_adj", O_RDWR); - if (fd < 0) { - /* Fallback to old interface */ - fd = open("/proc/self/oom_adj", O_RDWR); - if (fd < 0) { - err(udev, "error disabling OOM: %m\n"); - } else { - /* OOM_DISABLE == -17 */ - write(fd, "-17", 3); - close(fd); - } - } else { - write(fd, "-1000", 5); - close(fd); - } - } else { - sd_notify(1, "READY=1"); - } - - f = fopen("/dev/kmsg", "w"); - if (f != NULL) { - fprintf(f, "<30>udevd[%u]: starting version " VERSION "\n", getpid()); - fclose(f); - } - - if (!debug) { - int fd; - - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - close(fd); - } - } - - fd_inotify = udev_watch_init(udev); - if (fd_inotify < 0) { - fprintf(stderr, "error initializing inotify\n"); - err(udev, "error initializing inotify\n"); - rc = 4; - goto exit; - } - udev_watch_restore(udev); - - /* block and listen to all signals on signalfd */ - sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); - fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); - if (fd_signal < 0) { - fprintf(stderr, "error creating signalfd\n"); - err(udev, "error creating signalfd\n"); - rc = 5; - goto exit; - } - - /* unnamed socket from workers to the main daemon */ - if (socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, worker_watch) < 0) { - fprintf(stderr, "error creating socketpair\n"); - err(udev, "error creating socketpair\n"); - rc = 6; - goto exit; - } - fd_worker = worker_watch[READ_END]; - - udev_builtin_init(udev); - - rules = udev_rules_new(udev, resolve_names); - if (rules == NULL) { - err(udev, "error reading rules\n"); - goto exit; - } - - memset(&ep_ctrl, 0, sizeof(struct epoll_event)); - ep_ctrl.events = EPOLLIN; - ep_ctrl.data.fd = fd_ctrl; - - memset(&ep_inotify, 0, sizeof(struct epoll_event)); - ep_inotify.events = EPOLLIN; - ep_inotify.data.fd = fd_inotify; - - memset(&ep_signal, 0, sizeof(struct epoll_event)); - ep_signal.events = EPOLLIN; - ep_signal.data.fd = fd_signal; - - memset(&ep_netlink, 0, sizeof(struct epoll_event)); - ep_netlink.events = EPOLLIN; - ep_netlink.data.fd = fd_netlink; - - memset(&ep_worker, 0, sizeof(struct epoll_event)); - ep_worker.events = EPOLLIN; - ep_worker.data.fd = fd_worker; - - fd_ep = epoll_create1(EPOLL_CLOEXEC); - if (fd_ep < 0) { - err(udev, "error creating epoll fd: %m\n"); - goto exit; - } - if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_ctrl, &ep_ctrl) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_inotify, &ep_inotify) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_netlink, &ep_netlink) < 0 || - epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_worker, &ep_worker) < 0) { - err(udev, "fail to add fds to epoll: %m\n"); - goto exit; - } - - /* if needed, convert old database from earlier udev version */ - convert_db(udev); - - if (children_max <= 0) { - int memsize = mem_size_mb(); - - /* set value depending on the amount of RAM */ - if (memsize > 0) - children_max = 128 + (memsize / 8); - else - children_max = 128; - } - info(udev, "set children_max to %u\n", children_max); - - udev_rules_apply_static_dev_perms(rules); - - udev_list_node_init(&event_list); - udev_list_node_init(&worker_list); - - for (;;) { - static unsigned long long last_usec; - struct epoll_event ev[8]; - int fdcount; - int timeout; - bool is_worker, is_signal, is_inotify, is_netlink, is_ctrl; - int i; - - if (udev_exit) { - /* close sources of new events and discard buffered events */ - if (fd_ctrl >= 0) { - epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_ctrl, NULL); - fd_ctrl = -1; - } - if (monitor != NULL) { - epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_netlink, NULL); - udev_monitor_unref(monitor); - monitor = NULL; - } - if (fd_inotify >= 0) { - epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_inotify, NULL); - close(fd_inotify); - fd_inotify = -1; - } - - /* discard queued events and kill workers */ - event_queue_cleanup(udev, EVENT_QUEUED); - worker_kill(udev, 0); - - /* exit after all has cleaned up */ - if (udev_list_node_is_empty(&event_list) && udev_list_node_is_empty(&worker_list)) - break; - - /* timeout at exit for workers to finish */ - timeout = 60 * 1000; - } else if (udev_list_node_is_empty(&event_list) && children > 2) { - /* set timeout to kill idle workers */ - timeout = 3 * 1000; - } else { - timeout = -1; - } - fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); - if (fdcount < 0) - continue; - - if (fdcount == 0) { - if (udev_exit) { - info(udev, "timeout, giving up waiting for workers to finish\n"); - break; - } - - /* timeout - kill idle workers */ - worker_kill(udev, 2); - } - - is_worker = is_signal = is_inotify = is_netlink = is_ctrl = false; - for (i = 0; i < fdcount; i++) { - if (ev[i].data.fd == fd_worker && ev[i].events & EPOLLIN) - is_worker = true; - else if (ev[i].data.fd == fd_netlink && ev[i].events & EPOLLIN) - is_netlink = true; - else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) - is_signal = true; - else if (ev[i].data.fd == fd_inotify && ev[i].events & EPOLLIN) - is_inotify = true; - else if (ev[i].data.fd == fd_ctrl && ev[i].events & EPOLLIN) - is_ctrl = true; - } - - /* check for changed config, every 3 seconds at most */ - if ((now_usec() - last_usec) > 3 * 1000 * 1000) { - if (check_rules_timestamp(udev)) - reload = true; - if (udev_builtin_validate(udev)) - reload = true; - - last_usec = now_usec(); - } - - /* reload requested, HUP signal received, rules changed, builtin changed */ - if (reload) { - worker_kill(udev, 0); - rules = udev_rules_unref(rules); - udev_builtin_exit(udev); - reload = 0; - } - - /* event has finished */ - if (is_worker) - worker_returned(fd_worker); - - if (is_netlink) { - struct udev_device *dev; - - dev = udev_monitor_receive_device(monitor); - if (dev != NULL) { - udev_device_set_usec_initialized(dev, now_usec()); - if (event_queue_insert(dev) < 0) - udev_device_unref(dev); - } - } - - /* start new events */ - if (!udev_list_node_is_empty(&event_list) && !udev_exit && !stop_exec_queue) { - if (rules == NULL) - rules = udev_rules_new(udev, resolve_names); - if (rules != NULL) - event_queue_start(udev); - } - - if (is_signal) { - struct signalfd_siginfo fdsi; - ssize_t size; - - size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); - if (size == sizeof(struct signalfd_siginfo)) - handle_signal(udev, fdsi.ssi_signo); - } - - /* we are shutting down, the events below are not handled anymore */ - if (udev_exit) - continue; - - /* device node watch */ - if (is_inotify) - handle_inotify(udev); - - /* - * This needs to be after the inotify handling, to make sure, - * that the ping is send back after the possibly generated - * "change" events by the inotify device node watch. - * - * A single time we may receive a client connection which we need to - * keep open to block the client. It will be closed right before we - * exit. - */ - if (is_ctrl) - ctrl_conn = handle_ctrl_msg(udev_ctrl); - } - - rc = EXIT_SUCCESS; + struct udev *udev; + FILE *f; + sigset_t mask; + int daemonize = false; + int resolve_names = 1; + static const struct option options[] = { + { "daemon", no_argument, NULL, 'd' }, + { "debug", no_argument, NULL, 'D' }, + { "children-max", required_argument, NULL, 'c' }, + { "exec-delay", required_argument, NULL, 'e' }, + { "resolve-names", required_argument, NULL, 'N' }, + { "help", no_argument, NULL, 'h' }, + { "version", no_argument, NULL, 'V' }, + {} + }; + int fd_ctrl = -1; + int fd_netlink = -1; + int fd_worker = -1; + struct epoll_event ep_ctrl, ep_inotify, ep_signal, ep_netlink, ep_worker; + struct udev_ctrl_connection *ctrl_conn = NULL; + char **s; + int rc = 1; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("udevd"); + udev_set_log_fn(udev, udev_main_log); + info(udev, "version %s\n", VERSION); + udev_selinux_init(udev); + + for (;;) { + int option; + + option = getopt_long(argc, argv, "c:deDtN:hV", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + daemonize = true; + break; + case 'c': + children_max = strtoul(optarg, NULL, 0); + break; + case 'e': + exec_delay = strtoul(optarg, NULL, 0); + break; + case 'D': + debug = true; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'N': + if (strcmp (optarg, "early") == 0) { + resolve_names = 1; + } else if (strcmp (optarg, "late") == 0) { + resolve_names = 0; + } else if (strcmp (optarg, "never") == 0) { + resolve_names = -1; + } else { + fprintf(stderr, "resolve-names must be early, late or never\n"); + err(udev, "resolve-names must be early, late or never\n"); + goto exit; + } + break; + case 'h': + printf("Usage: udevd OPTIONS\n" + " --daemon\n" + " --debug\n" + " --children-max=\n" + " --exec-delay=\n" + " --resolve-names=early|late|never\n" + " --version\n" + " --help\n" + "\n"); + goto exit; + case 'V': + printf("%s\n", VERSION); + goto exit; + default: + goto exit; + } + } + + /* + * read the kernel commandline, in case we need to get into debug mode + * udev.log-priority= syslog priority + * udev.children-max= events are fully serialized if set to 1 + * + */ + f = fopen("/proc/cmdline", "r"); + if (f != NULL) { + char cmdline[4096]; + + if (fgets(cmdline, sizeof(cmdline), f) != NULL) { + char *pos; + + pos = strstr(cmdline, "udev.log-priority="); + if (pos != NULL) { + pos += strlen("udev.log-priority="); + udev_set_log_priority(udev, util_log_priority(pos)); + } + + pos = strstr(cmdline, "udev.children-max="); + if (pos != NULL) { + pos += strlen("udev.children-max="); + children_max = strtoul(pos, NULL, 0); + } + + pos = strstr(cmdline, "udev.exec-delay="); + if (pos != NULL) { + pos += strlen("udev.exec-delay="); + exec_delay = strtoul(pos, NULL, 0); + } + } + fclose(f); + } + + if (getuid() != 0) { + fprintf(stderr, "root privileges required\n"); + err(udev, "root privileges required\n"); + goto exit; + } + + /* set umask before creating any file/directory */ + chdir("/"); + umask(022); + + /* /run/udev */ + mkdir(udev_get_run_path(udev), 0755); + + /* create standard links, copy static nodes, create nodes from modules */ + static_dev_create(udev); + static_dev_create_from_modules(udev); + + /* before opening new files, make sure std{in,out,err} fds are in a sane state */ + if (daemonize) { + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + if (write(STDOUT_FILENO, 0, 0) < 0) + dup2(fd, STDOUT_FILENO); + if (write(STDERR_FILENO, 0, 0) < 0) + dup2(fd, STDERR_FILENO); + if (fd > STDERR_FILENO) + close(fd); + } else { + fprintf(stderr, "cannot open /dev/null\n"); + err(udev, "cannot open /dev/null\n"); + } + } + + if (systemd_fds(udev, &fd_ctrl, &fd_netlink) >= 0) { + /* get control and netlink socket from from systemd */ + udev_ctrl = udev_ctrl_new_from_fd(udev, fd_ctrl); + if (udev_ctrl == NULL) { + err(udev, "error taking over udev control socket"); + rc = 1; + goto exit; + } + + monitor = udev_monitor_new_from_netlink_fd(udev, "kernel", fd_netlink); + if (monitor == NULL) { + err(udev, "error taking over netlink socket\n"); + rc = 3; + goto exit; + } + } else { + /* open control and netlink socket */ + udev_ctrl = udev_ctrl_new(udev); + if (udev_ctrl == NULL) { + fprintf(stderr, "error initializing udev control socket"); + err(udev, "error initializing udev control socket"); + rc = 1; + goto exit; + } + fd_ctrl = udev_ctrl_get_fd(udev_ctrl); + + monitor = udev_monitor_new_from_netlink(udev, "kernel"); + if (monitor == NULL) { + fprintf(stderr, "error initializing netlink socket\n"); + err(udev, "error initializing netlink socket\n"); + rc = 3; + goto exit; + } + fd_netlink = udev_monitor_get_fd(monitor); + } + + if (udev_monitor_enable_receiving(monitor) < 0) { + fprintf(stderr, "error binding netlink socket\n"); + err(udev, "error binding netlink socket\n"); + rc = 3; + goto exit; + } + + if (udev_ctrl_enable_receiving(udev_ctrl) < 0) { + fprintf(stderr, "error binding udev control socket\n"); + err(udev, "error binding udev control socket\n"); + rc = 1; + goto exit; + } + + udev_monitor_set_receive_buffer_size(monitor, 128*1024*1024); + + /* create queue file before signalling 'ready', to make sure we block 'settle' */ + udev_queue_export = udev_queue_export_new(udev); + if (udev_queue_export == NULL) { + err(udev, "error creating queue file\n"); + goto exit; + } + + if (daemonize) { + pid_t pid; + int fd; + + pid = fork(); + switch (pid) { + case 0: + break; + case -1: + err(udev, "fork of daemon failed: %m\n"); + rc = 4; + goto exit; + default: + rc = EXIT_SUCCESS; + goto exit_daemonize; + } + + setsid(); + + fd = open("/proc/self/oom_score_adj", O_RDWR); + if (fd < 0) { + /* Fallback to old interface */ + fd = open("/proc/self/oom_adj", O_RDWR); + if (fd < 0) { + err(udev, "error disabling OOM: %m\n"); + } else { + /* OOM_DISABLE == -17 */ + write(fd, "-17", 3); + close(fd); + } + } else { + write(fd, "-1000", 5); + close(fd); + } + } else { + sd_notify(1, "READY=1"); + } + + f = fopen("/dev/kmsg", "w"); + if (f != NULL) { + fprintf(f, "<30>udevd[%u]: starting version " VERSION "\n", getpid()); + fclose(f); + } + + if (!debug) { + int fd; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + dup2(fd, STDERR_FILENO); + close(fd); + } + } + + fd_inotify = udev_watch_init(udev); + if (fd_inotify < 0) { + fprintf(stderr, "error initializing inotify\n"); + err(udev, "error initializing inotify\n"); + rc = 4; + goto exit; + } + udev_watch_restore(udev); + + /* block and listen to all signals on signalfd */ + sigfillset(&mask); + sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); + fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); + if (fd_signal < 0) { + fprintf(stderr, "error creating signalfd\n"); + err(udev, "error creating signalfd\n"); + rc = 5; + goto exit; + } + + /* unnamed socket from workers to the main daemon */ + if (socketpair(AF_LOCAL, SOCK_DGRAM|SOCK_CLOEXEC, 0, worker_watch) < 0) { + fprintf(stderr, "error creating socketpair\n"); + err(udev, "error creating socketpair\n"); + rc = 6; + goto exit; + } + fd_worker = worker_watch[READ_END]; + + udev_builtin_init(udev); + + rules = udev_rules_new(udev, resolve_names); + if (rules == NULL) { + err(udev, "error reading rules\n"); + goto exit; + } + + memset(&ep_ctrl, 0, sizeof(struct epoll_event)); + ep_ctrl.events = EPOLLIN; + ep_ctrl.data.fd = fd_ctrl; + + memset(&ep_inotify, 0, sizeof(struct epoll_event)); + ep_inotify.events = EPOLLIN; + ep_inotify.data.fd = fd_inotify; + + memset(&ep_signal, 0, sizeof(struct epoll_event)); + ep_signal.events = EPOLLIN; + ep_signal.data.fd = fd_signal; + + memset(&ep_netlink, 0, sizeof(struct epoll_event)); + ep_netlink.events = EPOLLIN; + ep_netlink.data.fd = fd_netlink; + + memset(&ep_worker, 0, sizeof(struct epoll_event)); + ep_worker.events = EPOLLIN; + ep_worker.data.fd = fd_worker; + + fd_ep = epoll_create1(EPOLL_CLOEXEC); + if (fd_ep < 0) { + err(udev, "error creating epoll fd: %m\n"); + goto exit; + } + if (epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_ctrl, &ep_ctrl) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_inotify, &ep_inotify) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_signal, &ep_signal) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_netlink, &ep_netlink) < 0 || + epoll_ctl(fd_ep, EPOLL_CTL_ADD, fd_worker, &ep_worker) < 0) { + err(udev, "fail to add fds to epoll: %m\n"); + goto exit; + } + + /* if needed, convert old database from earlier udev version */ + convert_db(udev); + + if (children_max <= 0) { + int memsize = mem_size_mb(); + + /* set value depending on the amount of RAM */ + if (memsize > 0) + children_max = 128 + (memsize / 8); + else + children_max = 128; + } + info(udev, "set children_max to %u\n", children_max); + + udev_rules_apply_static_dev_perms(rules); + + udev_list_node_init(&event_list); + udev_list_node_init(&worker_list); + + for (;;) { + static unsigned long long last_usec; + struct epoll_event ev[8]; + int fdcount; + int timeout; + bool is_worker, is_signal, is_inotify, is_netlink, is_ctrl; + int i; + + if (udev_exit) { + /* close sources of new events and discard buffered events */ + if (fd_ctrl >= 0) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_ctrl, NULL); + fd_ctrl = -1; + } + if (monitor != NULL) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_netlink, NULL); + udev_monitor_unref(monitor); + monitor = NULL; + } + if (fd_inotify >= 0) { + epoll_ctl(fd_ep, EPOLL_CTL_DEL, fd_inotify, NULL); + close(fd_inotify); + fd_inotify = -1; + } + + /* discard queued events and kill workers */ + event_queue_cleanup(udev, EVENT_QUEUED); + worker_kill(udev, 0); + + /* exit after all has cleaned up */ + if (udev_list_node_is_empty(&event_list) && udev_list_node_is_empty(&worker_list)) + break; + + /* timeout at exit for workers to finish */ + timeout = 60 * 1000; + } else if (udev_list_node_is_empty(&event_list) && children > 2) { + /* set timeout to kill idle workers */ + timeout = 3 * 1000; + } else { + timeout = -1; + } + fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); + if (fdcount < 0) + continue; + + if (fdcount == 0) { + if (udev_exit) { + info(udev, "timeout, giving up waiting for workers to finish\n"); + break; + } + + /* timeout - kill idle workers */ + worker_kill(udev, 2); + } + + is_worker = is_signal = is_inotify = is_netlink = is_ctrl = false; + for (i = 0; i < fdcount; i++) { + if (ev[i].data.fd == fd_worker && ev[i].events & EPOLLIN) + is_worker = true; + else if (ev[i].data.fd == fd_netlink && ev[i].events & EPOLLIN) + is_netlink = true; + else if (ev[i].data.fd == fd_signal && ev[i].events & EPOLLIN) + is_signal = true; + else if (ev[i].data.fd == fd_inotify && ev[i].events & EPOLLIN) + is_inotify = true; + else if (ev[i].data.fd == fd_ctrl && ev[i].events & EPOLLIN) + is_ctrl = true; + } + + /* check for changed config, every 3 seconds at most */ + if ((now_usec() - last_usec) > 3 * 1000 * 1000) { + if (check_rules_timestamp(udev)) + reload = true; + if (udev_builtin_validate(udev)) + reload = true; + + last_usec = now_usec(); + } + + /* reload requested, HUP signal received, rules changed, builtin changed */ + if (reload) { + worker_kill(udev, 0); + rules = udev_rules_unref(rules); + udev_builtin_exit(udev); + reload = 0; + } + + /* event has finished */ + if (is_worker) + worker_returned(fd_worker); + + if (is_netlink) { + struct udev_device *dev; + + dev = udev_monitor_receive_device(monitor); + if (dev != NULL) { + udev_device_set_usec_initialized(dev, now_usec()); + if (event_queue_insert(dev) < 0) + udev_device_unref(dev); + } + } + + /* start new events */ + if (!udev_list_node_is_empty(&event_list) && !udev_exit && !stop_exec_queue) { + if (rules == NULL) + rules = udev_rules_new(udev, resolve_names); + if (rules != NULL) + event_queue_start(udev); + } + + if (is_signal) { + struct signalfd_siginfo fdsi; + ssize_t size; + + size = read(fd_signal, &fdsi, sizeof(struct signalfd_siginfo)); + if (size == sizeof(struct signalfd_siginfo)) + handle_signal(udev, fdsi.ssi_signo); + } + + /* we are shutting down, the events below are not handled anymore */ + if (udev_exit) + continue; + + /* device node watch */ + if (is_inotify) + handle_inotify(udev); + + /* + * This needs to be after the inotify handling, to make sure, + * that the ping is send back after the possibly generated + * "change" events by the inotify device node watch. + * + * A single time we may receive a client connection which we need to + * keep open to block the client. It will be closed right before we + * exit. + */ + if (is_ctrl) + ctrl_conn = handle_ctrl_msg(udev_ctrl); + } + + rc = EXIT_SUCCESS; exit: - udev_queue_export_cleanup(udev_queue_export); - udev_ctrl_cleanup(udev_ctrl); + udev_queue_export_cleanup(udev_queue_export); + udev_ctrl_cleanup(udev_ctrl); exit_daemonize: - if (fd_ep >= 0) - close(fd_ep); - worker_list_cleanup(udev); - event_queue_cleanup(udev, EVENT_UNDEF); - udev_rules_unref(rules); - udev_builtin_exit(udev); - if (fd_signal >= 0) - close(fd_signal); - if (worker_watch[READ_END] >= 0) - close(worker_watch[READ_END]); - if (worker_watch[WRITE_END] >= 0) - close(worker_watch[WRITE_END]); - udev_monitor_unref(monitor); - udev_queue_export_unref(udev_queue_export); - udev_ctrl_connection_unref(ctrl_conn); - udev_ctrl_unref(udev_ctrl); - udev_selinux_exit(udev); - udev_unref(udev); - udev_log_close(); - return rc; + if (fd_ep >= 0) + close(fd_ep); + worker_list_cleanup(udev); + event_queue_cleanup(udev, EVENT_UNDEF); + udev_rules_unref(rules); + udev_builtin_exit(udev); + if (fd_signal >= 0) + close(fd_signal); + if (worker_watch[READ_END] >= 0) + close(worker_watch[READ_END]); + if (worker_watch[WRITE_END] >= 0) + close(worker_watch[WRITE_END]); + udev_monitor_unref(monitor); + udev_queue_export_unref(udev_queue_export); + udev_ctrl_connection_unref(ctrl_conn); + udev_ctrl_unref(udev_ctrl); + udev_selinux_exit(udev); + udev_unref(udev); + udev_log_close(); + return rc; } diff --git a/test/rules-test.sh b/test/rules-test.sh index 511f05d9ee..1e224ff8b5 100755 --- a/test/rules-test.sh +++ b/test/rules-test.sh @@ -1,17 +1,15 @@ -#!/usr/bin/env sh +#!/bin/sh # Call the udev rule syntax checker on all rules that we ship # # (C) 2010 Canonical Ltd. # Author: Martin Pitt -set -e - [ -n "$srcdir" ] || srcdir=`dirname $0`/.. # skip if we don't have python type python >/dev/null 2>&1 || { - echo "$0: No python installed, skipping udev rule syntax check" - exit 0 + echo "$0: No python installed, skipping udev rule syntax check" + exit 0 } $srcdir/test/rule-syntax-check.py `find $srcdir/rules -name '*.rules'` diff --git a/test/udev-test.pl b/test/udev-test.pl index 999c1f76e3..0d30a2c47c 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -20,159 +20,159 @@ use warnings; use strict; -my $PWD = $ENV{PWD}; -my $sysfs = "test/sys"; -my $udev_bin = "src/test-udev"; -my $valgrind = 0; -my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; -my $udev_root = "udev-root"; -my $udev_conf = "udev-test.conf"; -my $udev_rules = "udev-test.rules"; +my $PWD = $ENV{PWD}; +my $sysfs = "test/sys"; +my $udev_bin = "src/test-udev"; +my $valgrind = 0; +my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; +my $udev_root = "udev-root"; +my $udev_conf = "udev-test.conf"; +my $udev_rules = "udev-test.rules"; my @tests = ( - { - desc => "no rules", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda" , - exp_rem_error => "yes", - rules => < "no rules", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda" , + exp_rem_error => "yes", + rules => < "label test of scsi disc", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , - rules => < "label test of scsi disc", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi disc", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , - rules => < "label test of scsi disc", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi disc", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "boot_disk" , - rules => < "label test of scsi disc", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "boot_disk" , + rules => < "label test of scsi partition", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of scsi partition", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "label test of pattern match", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of pattern match", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "label test of multiple sysfs files", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of multiple sysfs files", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "label test of max sysfs files (skip invalid rule)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "boot_disk1" , - rules => < "label test of max sysfs files (skip invalid rule)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "boot_disk1" , + rules => < "catch device by *", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by *", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "catch device by * - take 2", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by * - take 2", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "catch device by ?", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by ?", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "catch device by character class", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem/0" , - rules => < "catch device by character class", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem/0" , + rules => < "replace kernel name", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "replace kernel name", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle comment lines in config file (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle comment lines in config file (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle comment lines in config file with whitespace (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle comment lines in config file with whitespace (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle whitespace only lines (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "whitespace" , - rules => < "Handle whitespace only lines (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "whitespace" , + rules => < "Handle empty lines in config file (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle empty lines in config file (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "Handle backslashed multi lines in config file (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle backslashed multi lines in config file (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "preserve backslashes, if they are not for a newline", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "aaa", - rules => < "preserve backslashes, if they are not for a newline", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "aaa", + rules => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "Handle stupid backslashed multi lines in config file (and replace kernel name)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "subdirectory handling", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "sub/direct/ory/modem" , - rules => < "subdirectory handling", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "sub/direct/ory/modem" , + rules => < "parent device name match of scsi partition", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "first_disk5" , - rules => < "parent device name match of scsi partition", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "first_disk5" , + rules => < "test substitution chars", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , - rules => < "test substitution chars", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" , + rules => < "import of shell-value file", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "subdir/err/node" , - rules => < "import of shell-value file", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "subdir/err/node" , + rules => < "import of shell-value returned from program", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node12345678", - rules => < "import of shell-value returned from program", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node12345678", + rules => < "sustitution of sysfs value (%s{file})", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "disk-ATA-sda" , - rules => < "sustitution of sysfs value (%s{file})", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "disk-ATA-sda" , + rules => < "program result substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "special-device-5" , - not_exp_name => "not" , - rules => < "program result substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "special-device-5" , + not_exp_name => "not" , + rules => < "program result substitution (newline removal)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "newline_removed" , - rules => < "program result substitution (newline removal)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "newline_removed" , + rules => < "program result substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "test-0:0:0:0" , - rules => < "program result substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "test-0:0:0:0" , + rules => < "program with lots of arguments", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo9" , - rules => < "program with lots of arguments", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "foo9" , + rules => < "program with subshell", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "bar9" , - rules => < "program with subshell", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "bar9" , + rules => < "program arguments combined with apostrophes", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "foo7" , - rules => < "program arguments combined with apostrophes", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "foo7" , + rules => < "characters before the %c{N} substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "my-foo9" , - rules => < "characters before the %c{N} substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "my-foo9" , + rules => < "substitute the second to last argument", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "my-foo8" , - rules => < "substitute the second to last argument", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "my-foo8" , + rules => < "test substitution by variable name", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", - rules => < "test substitution by variable name", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", + rules => < "test substitution by variable name 2", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", - rules => < "test substitution by variable name 2", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0", + rules => < "test substitution by variable name 3", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "850:0:0:05" , - rules => < "test substitution by variable name 3", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "850:0:0:05" , + rules => < "test substitution by variable name 4", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "855" , - rules => < "test substitution by variable name 4", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "855" , + rules => < "test substitution by variable name 5", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "8550:0:0:0" , - rules => < "test substitution by variable name 5", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "8550:0:0:0" , + rules => < "non matching SUBSYSTEMS for device with no parent", - devpath => "/devices/virtual/tty/console", - exp_name => "TTY", - rules => < "non matching SUBSYSTEMS for device with no parent", + devpath => "/devices/virtual/tty/console", + exp_name => "TTY", + rules => < "non matching SUBSYSTEMS", - devpath => "/devices/virtual/tty/console", - exp_name => "TTY" , - rules => < "non matching SUBSYSTEMS", + devpath => "/devices/virtual/tty/console", + exp_name => "TTY" , + rules => < "ATTRS match", - devpath => "/devices/virtual/tty/console", - exp_name => "foo" , - rules => < "ATTRS match", + devpath => "/devices/virtual/tty/console", + exp_name => "foo" , + rules => < "ATTR (empty file)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "empty" , - rules => < "ATTR (empty file)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "empty" , + rules => < "ATTR (non-existent file)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "non-existent" , - rules => < "ATTR (non-existent file)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "non-existent" , + rules => < "program and bus type match", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0" , - rules => < "program and bus type match", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0" , + rules => < "sysfs parent hierarchy", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem" , - rules => < "sysfs parent hierarchy", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem" , + rules => < "name test with ! in the name", - devpath => "/devices/virtual/block/fake!blockdev0", - exp_name => "is/a/fake/blockdev0" , - rules => < "name test with ! in the name", + devpath => "/devices/virtual/block/fake!blockdev0", + exp_name => "is/a/fake/blockdev0" , + rules => < "name test with ! in the name, but no matching rule", - devpath => "/devices/virtual/block/fake!blockdev0", - exp_name => "fake/blockdev0" , - exp_rem_error => "yes", - rules => < "name test with ! in the name, but no matching rule", + devpath => "/devices/virtual/block/fake!blockdev0", + exp_name => "fake/blockdev0" , + exp_rem_error => "yes", + rules => < "KERNELS rule", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS rule", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "KERNELS wildcard all", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS wildcard all", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "KERNELS wildcard partial", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS wildcard partial", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "KERNELS wildcard partial 2", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "scsi-0:0:0:0", - rules => < "KERNELS wildcard partial 2", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "scsi-0:0:0:0", + rules => < "substitute attr with link target value (first match)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "driver-is-sd", - rules => < "substitute attr with link target value (first match)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "driver-is-sd", + rules => < "substitute attr with link target value (currently selected device)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "driver-is-ahci", - rules => < "substitute attr with link target value (currently selected device)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "driver-is-ahci", + rules => < "ignore ATTRS attribute whitespace", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ignored", - rules => < "ignore ATTRS attribute whitespace", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ignored", + rules => < "do not ignore ATTRS attribute whitespace", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "matched-with-space", - rules => < "do not ignore ATTRS attribute whitespace", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "matched-with-space", + rules => < "permissions USER=bad GROUP=name", - devpath => "/devices/virtual/tty/tty33", - exp_name => "tty33", - exp_perms => "0:0:0600", - rules => < "permissions USER=bad GROUP=name", + devpath => "/devices/virtual/tty/tty33", + exp_name => "tty33", + exp_perms => "0:0:0600", + rules => < "permissions OWNER=5000", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "5000::0600", - rules => < "permissions OWNER=5000", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "5000::0600", + rules => < "permissions GROUP=100", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => ":100:0660", - rules => < "permissions GROUP=100", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => ":100:0660", + rules => < "textual user id", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "nobody::0600", - rules => < "textual user id", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "nobody::0600", + rules => < "textual group id", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => ":daemon:0660", - rules => < "textual group id", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => ":daemon:0660", + rules => < "textual user/group id", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "root:mail:0660", - rules => < "textual user/group id", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "root:mail:0660", + rules => < "permissions MODE=0777", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "::0777", - rules => < "permissions MODE=0777", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "::0777", + rules => < "permissions OWNER=5000 GROUP=100 MODE=0777", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_perms => "5000:100:0777", - rules => < "permissions OWNER=5000 GROUP=100 MODE=0777", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_perms => "5000:100:0777", + rules => < "permissions OWNER to 5000", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "5000::", - rules => < "permissions OWNER to 5000", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "5000::", + rules => < "permissions GROUP to 100", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => ":100:0660", - rules => < "permissions GROUP to 100", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => ":100:0660", + rules => < "permissions MODE to 0060", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "::0060", - rules => < "permissions MODE to 0060", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "::0060", + rules => < "permissions OWNER, GROUP, MODE", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "5000:100:0777", - rules => < "permissions OWNER, GROUP, MODE", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "5000:100:0777", + rules => < "permissions only rule", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "5000:100:0777", - rules => < "permissions only rule", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "5000:100:0777", + rules => < "multiple permissions only rule", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "3000:4000:0777", - rules => < "multiple permissions only rule", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "3000:4000:0777", + rules => < "permissions only rule with override at SYMLINK+ rule", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "ttyACM0", - exp_perms => "3000:8000:0777", - rules => < "permissions only rule with override at SYMLINK+ rule", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "ttyACM0", + exp_perms => "3000:8000:0777", + rules => < "major/minor number test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - exp_majorminor => "8:0", - rules => < "major/minor number test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + exp_majorminor => "8:0", + rules => < "big major number test", - devpath => "/devices/virtual/misc/misc-fake1", - exp_name => "node", - exp_majorminor => "4095:1", - rules => < "big major number test", + devpath => "/devices/virtual/misc/misc-fake1", + exp_name => "node", + exp_majorminor => "4095:1", + rules => < "big major and big minor number test", - devpath => "/devices/virtual/misc/misc-fake89999", - exp_name => "node", - exp_majorminor => "4095:89999", - rules => < "big major and big minor number test", + devpath => "/devices/virtual/misc/misc-fake89999", + exp_name => "node", + exp_majorminor => "4095:89999", + rules => < "multiple symlinks with format char", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "symlink2-ttyACM0", - rules => < "multiple symlinks with format char", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "symlink2-ttyACM0", + rules => < "multiple symlinks with a lot of s p a c e s", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "one", - not_exp_name => " ", - rules => < "multiple symlinks with a lot of s p a c e s", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "one", + not_exp_name => " ", + rules => < "symlink creation (same directory)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "modem0", - rules => < "symlink creation (same directory)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "modem0", + rules => < "multiple symlinks", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "second-0" , - rules => < "multiple symlinks", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "second-0" , + rules => < "symlink name '.'", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => ".", - exp_add_error => "yes", - exp_rem_error => "yes", - rules => < "symlink name '.'", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => ".", + exp_add_error => "yes", + exp_rem_error => "yes", + rules => < "symlink node to itself", - devpath => "/devices/virtual/tty/tty0", - exp_name => "link", - exp_add_error => "yes", - exp_rem_error => "yes", - option => "clean", - rules => < "symlink node to itself", + devpath => "/devices/virtual/tty/tty0", + exp_name => "link", + exp_add_error => "yes", + exp_rem_error => "yes", + option => "clean", + rules => < "symlink %n substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "symlink0", - rules => < "symlink %n substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "symlink0", + rules => < "symlink %k substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "symlink-ttyACM0", - rules => < "symlink %k substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "symlink-ttyACM0", + rules => < "symlink %M:%m substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "major-166:0", - rules => < "symlink %M:%m substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "major-166:0", + rules => < "symlink %b substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "symlink-0:0:0:0", - rules => < "symlink %b substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "symlink-0:0:0:0", + rules => < "symlink %c substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "test", - rules => < "symlink %c substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "test", + rules => < "symlink %c{N} substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "test", - rules => < "symlink %c{N} substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "test", + rules => < "symlink %c{N+} substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "this", - rules => < "symlink %c{N+} substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "this", + rules => < "symlink only rule with %c{N+}", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "test", - rules => < "symlink only rule with %c{N+}", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "test", + rules => < "symlink %s{filename} substitution", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "166:0", - rules => < "symlink %s{filename} substitution", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "166:0", + rules => < "program result substitution (numbered part of)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "link1", - rules => < "program result substitution (numbered part of)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "link1", + rules => < "program result substitution (numbered part of+)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", - exp_name => "link4", - rules => < "program result substitution (numbered part of+)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5", + exp_name => "link4", + rules => < "SUBSYSTEM match test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - rules => < "SUBSYSTEM match test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + rules => < "DRIVERS match test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - rules => < "DRIVERS match test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + rules => < "devnode substitution test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node", - rules => < "devnode substitution test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node", + rules => < "parent node name substitution test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "sda-part-1", - rules => < "parent node name substitution test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "sda-part-1", + rules => < "udev_root substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "start-udev-root-end", - rules => < "udev_root substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "start-udev-root-end", + rules => < "last_rule option", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "last", - rules => < "last_rule option", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "last", + rules => < "negation KERNEL!=", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "match", - rules => < "negation KERNEL!=", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "match", + rules => < "negation SUBSYSTEM!=", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "not-anything", - rules => < "negation SUBSYSTEM!=", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "not-anything", + rules => < "negation PROGRAM!= exit code", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "nonzero-program", - rules => < "negation PROGRAM!= exit code", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "nonzero-program", + rules => < "test for whitespace between the operator", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "test for whitespace between the operator", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test (assign)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign 2 times)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "true", - rules => < "ENV{} test (assign 2 times)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "true", + rules => < "ENV{} test (assign2)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "part", - rules => < "ENV{} test (assign2)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "part", + rules => < "untrusted string sanitize", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "sane", - rules => < "untrusted string sanitize", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "sane", + rules => < "untrusted string sanitize (don't replace utf8)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "uber", - rules => < "untrusted string sanitize (don't replace utf8)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "uber", + rules => < "untrusted string sanitize (replace invalid utf8)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "replaced", - rules => < "untrusted string sanitize (replace invalid utf8)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "replaced", + rules => < "read sysfs value from parent device", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "serial-354172020305000", - rules => < "read sysfs value from parent device", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "serial-354172020305000", + rules => < "match against empty key string", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - rules => < "match against empty key string", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + rules => < "check ACTION value", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - rules => < "check ACTION value", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + rules => < "final assignment", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - exp_perms => "root:tty:0640", - rules => < "final assignment", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + exp_perms => "root:tty:0640", + rules => < "final assignment 2", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "ok", - exp_perms => "root:tty:0640", - rules => < "final assignment 2", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "ok", + exp_perms => "root:tty:0640", + rules => < "env substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "node-add-me", - rules => < "env substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "node-add-me", + rules => < "reset list to current value", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "three", - not_exp_name => "two", - rules => < "reset list to current value", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "three", + not_exp_name => "two", + rules => < "test empty SYMLINK+ (empty override)", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - not_exp_name => "wrong", - rules => < "test empty SYMLINK+ (empty override)", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + not_exp_name => "wrong", + rules => < "test multi matches", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 2", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches 2", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 3", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches 3", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "test multi matches 4", - devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", - exp_name => "right", - rules => < "test multi matches 4", + devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0", + exp_name => "right", + rules => < "IMPORT parent test sequence 1/2 (keep)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "parent", - option => "keep", - rules => < "IMPORT parent test sequence 1/2 (keep)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "parent", + option => "keep", + rules => < "IMPORT parent test sequence 2/2 (keep)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "parentenv-parent_right", - option => "clean", - rules => < "IMPORT parent test sequence 2/2 (keep)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "parentenv-parent_right", + option => "clean", + rules => < "GOTO test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "right", - rules => < "GOTO test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + rules => < "GOTO label does not exist", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "right", - rules => < "GOTO label does not exist", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + rules => < "SYMLINK+ compare test", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "right", - not_exp_name => "wrong", - rules => < "SYMLINK+ compare test", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "right", + not_exp_name => "wrong", + rules => < "invalid key operation", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "yes", - rules => < "invalid key operation", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "yes", + rules => < "operator chars in attribute", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "yes", - rules => < "operator chars in attribute", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "yes", + rules => < "overlong comment line", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", - exp_name => "yes", - rules => < "overlong comment line", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1", + exp_name => "yes", + rules => < "magic subsys/kernel lookup", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "00:16:41:e2:8d:ff", - rules => < "magic subsys/kernel lookup", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "00:16:41:e2:8d:ff", + rules => < "TEST absolute path", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "there", - rules => < "TEST absolute path", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "there", + rules => < "TEST subsys/kernel lookup", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "yes", - rules => < "TEST subsys/kernel lookup", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "yes", + rules => < "TEST relative path", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "relative", - rules => < "TEST relative path", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "relative", + rules => < "TEST wildcard substitution (find queue/nr_requests)", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "found-subdir", - rules => < "TEST wildcard substitution (find queue/nr_requests)", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "found-subdir", + rules => < "TEST MODE=0000", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - exp_perms => "0:0:0000", - exp_rem_error => "yes", - rules => < "TEST MODE=0000", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda", + exp_perms => "0:0:0000", + exp_rem_error => "yes", + rules => < "TEST PROGRAM feeds OWNER, GROUP, MODE", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - exp_perms => "5000:100:0400", - exp_rem_error => "yes", - rules => < "TEST PROGRAM feeds OWNER, GROUP, MODE", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda", + exp_perms => "5000:100:0400", + exp_rem_error => "yes", + rules => < "TEST PROGRAM feeds MODE with overflow", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda", - exp_perms => "0:0:0440", - exp_rem_error => "yes", - rules => < "TEST PROGRAM feeds MODE with overflow", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda", + exp_perms => "0:0:0440", + exp_rem_error => "yes", + rules => < "magic [subsys/sysname] attribute substitution", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "sda-8741C4G-end", - exp_perms => "0:0:0600", - rules => < "magic [subsys/sysname] attribute substitution", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "sda-8741C4G-end", + exp_perms => "0:0:0600", + rules => < "builtin path_id", - devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", - exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0", - rules => < "builtin path_id", + devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", + exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0", + rules => <$udev_rules" || die "unable to create rules file: $udev_rules"; - print CONF $$rules; - close CONF; + # create temporary rules + open CONF, ">$udev_rules" || die "unable to create rules file: $udev_rules"; + print CONF $$rules; + close CONF; - if ($valgrind > 0) { - system("$udev_bin_valgrind $action $devpath"); - } else { - system("$udev_bin $action $devpath"); - } + if ($valgrind > 0) { + system("$udev_bin_valgrind $action $devpath"); + } else { + system("$udev_bin $action $devpath"); + } } my $error = 0; sub permissions_test { - my($rules, $uid, $gid, $mode) = @_; + my($rules, $uid, $gid, $mode) = @_; - my $wrong = 0; - my $userid; - my $groupid; + my $wrong = 0; + my $userid; + my $groupid; - $rules->{exp_perms} =~ m/^(.*):(.*):(.*)$/; - if ($1 ne "") { - if (defined(getpwnam($1))) { - $userid = int(getpwnam($1)); - } else { - $userid = $1; - } - if ($uid != $userid) { $wrong = 1; } - } - if ($2 ne "") { - if (defined(getgrnam($2))) { - $groupid = int(getgrnam($2)); - } else { - $groupid = $2; - } - if ($gid != $groupid) { $wrong = 1; } - } - if ($3 ne "") { - if (($mode & 07777) != oct($3)) { $wrong = 1; }; - } - if ($wrong == 0) { - print "permissions: ok\n"; - } else { - printf " expected permissions are: %s:%s:%#o\n", $1, $2, oct($3); - printf " created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; - print "permissions: error\n"; - $error++; - sleep(1); - } + $rules->{exp_perms} =~ m/^(.*):(.*):(.*)$/; + if ($1 ne "") { + if (defined(getpwnam($1))) { + $userid = int(getpwnam($1)); + } else { + $userid = $1; + } + if ($uid != $userid) { $wrong = 1; } + } + if ($2 ne "") { + if (defined(getgrnam($2))) { + $groupid = int(getgrnam($2)); + } else { + $groupid = $2; + } + if ($gid != $groupid) { $wrong = 1; } + } + if ($3 ne "") { + if (($mode & 07777) != oct($3)) { $wrong = 1; }; + } + if ($wrong == 0) { + print "permissions: ok\n"; + } else { + printf " expected permissions are: %s:%s:%#o\n", $1, $2, oct($3); + printf " created permissions are : %i:%i:%#o\n", $uid, $gid, $mode & 07777; + print "permissions: error\n"; + $error++; + sleep(1); + } } sub major_minor_test { - my($rules, $rdev) = @_; + my($rules, $rdev) = @_; - my $major = ($rdev >> 8) & 0xfff; - my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); - my $wrong = 0; + my $major = ($rdev >> 8) & 0xfff; + my $minor = ($rdev & 0xff) | (($rdev >> 12) & 0xfff00); + my $wrong = 0; - $rules->{exp_majorminor} =~ m/^(.*):(.*)$/; - if ($1 ne "") { - if ($major != $1) { $wrong = 1; }; - } - if ($2 ne "") { - if ($minor != $2) { $wrong = 1; }; - } - if ($wrong == 0) { - print "major:minor: ok\n"; - } else { - printf " expected major:minor is: %i:%i\n", $1, $2; - printf " created major:minor is : %i:%i\n", $major, $minor; - print "major:minor: error\n"; - $error++; - sleep(1); - } + $rules->{exp_majorminor} =~ m/^(.*):(.*)$/; + if ($1 ne "") { + if ($major != $1) { $wrong = 1; }; + } + if ($2 ne "") { + if ($minor != $2) { $wrong = 1; }; + } + if ($wrong == 0) { + print "major:minor: ok\n"; + } else { + printf " expected major:minor is: %i:%i\n", $1, $2; + printf " created major:minor is : %i:%i\n", $major, $minor; + print "major:minor: error\n"; + $error++; + sleep(1); + } } sub make_udev_root { - system("rm -rf $udev_root"); - mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; - # setting group and mode of udev_root ensures the tests work - # even if the parent directory has setgid bit enabled. - chown (0, 0, $udev_root) || die "unable to chown $udev_root\n"; - chmod (0755, $udev_root) || die "unable to chmod $udev_root\n"; + system("rm -rf $udev_root"); + mkdir($udev_root) || die "unable to create udev_root: $udev_root\n"; + # setting group and mode of udev_root ensures the tests work + # even if the parent directory has setgid bit enabled. + chown (0, 0, $udev_root) || die "unable to chown $udev_root\n"; + chmod (0755, $udev_root) || die "unable to chmod $udev_root\n"; } sub run_test { - my ($rules, $number) = @_; + my ($rules, $number) = @_; - print "TEST $number: $rules->{desc}\n"; - print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; + print "TEST $number: $rules->{desc}\n"; + print "device \'$rules->{devpath}\' expecting node/link \'$rules->{exp_name}\'\n"; - udev("add", $rules->{devpath}, \$rules->{rules}); - if (defined($rules->{not_exp_name})) { - if ((-e "$PWD/$udev_root/$rules->{not_exp_name}") || - (-l "$PWD/$udev_root/$rules->{not_exp_name}")) { - print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; - $error++; - sleep(1); - } - } + udev("add", $rules->{devpath}, \$rules->{rules}); + if (defined($rules->{not_exp_name})) { + if ((-e "$PWD/$udev_root/$rules->{not_exp_name}") || + (-l "$PWD/$udev_root/$rules->{not_exp_name}")) { + print "nonexistent: error \'$rules->{not_exp_name}\' not expected to be there\n"; + $error++; + sleep(1); + } + } - if ((-e "$PWD/$udev_root/$rules->{exp_name}") || - (-l "$PWD/$udev_root/$rules->{exp_name}")) { + if ((-e "$PWD/$udev_root/$rules->{exp_name}") || + (-l "$PWD/$udev_root/$rules->{exp_name}")) { - my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, - $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root/$rules->{exp_name}"); + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, + $atime, $mtime, $ctime, $blksize, $blocks) = stat("$PWD/$udev_root/$rules->{exp_name}"); - if (defined($rules->{exp_perms})) { - permissions_test($rules, $uid, $gid, $mode); - } - if (defined($rules->{exp_majorminor})) { - major_minor_test($rules, $rdev); - } - print "add: ok\n"; - } else { - print "add: error"; - if ($rules->{exp_add_error}) { - print " as expected\n"; - } else { - print "\n"; - system("tree $udev_root"); - print "\n"; - $error++; - sleep(1); - } - } + if (defined($rules->{exp_perms})) { + permissions_test($rules, $uid, $gid, $mode); + } + if (defined($rules->{exp_majorminor})) { + major_minor_test($rules, $rdev); + } + print "add: ok\n"; + } else { + print "add: error"; + if ($rules->{exp_add_error}) { + print " as expected\n"; + } else { + print "\n"; + system("tree $udev_root"); + print "\n"; + $error++; + sleep(1); + } + } - if (defined($rules->{option}) && $rules->{option} eq "keep") { - print "\n\n"; - return; - } + if (defined($rules->{option}) && $rules->{option} eq "keep") { + print "\n\n"; + return; + } - udev("remove", $rules->{devpath}, \$rules->{rules}); - if ((-e "$PWD/$udev_root/$rules->{exp_name}") || - (-l "$PWD/$udev_root/$rules->{exp_name}")) { - print "remove: error"; - if ($rules->{exp_rem_error}) { - print " as expected\n"; - } else { - print "\n"; - system("tree $udev_root"); - print "\n"; - $error++; - sleep(1); - } - } else { - print "remove: ok\n"; - } + udev("remove", $rules->{devpath}, \$rules->{rules}); + if ((-e "$PWD/$udev_root/$rules->{exp_name}") || + (-l "$PWD/$udev_root/$rules->{exp_name}")) { + print "remove: error"; + if ($rules->{exp_rem_error}) { + print " as expected\n"; + } else { + print "\n"; + system("tree $udev_root"); + print "\n"; + $error++; + sleep(1); + } + } else { + print "remove: ok\n"; + } - print "\n"; + print "\n"; - if (defined($rules->{option}) && $rules->{option} eq "clean") { - make_udev_root (); - } + if (defined($rules->{option}) && $rules->{option} eq "clean") { + make_udev_root (); + } } # only run if we have root permissions # due to mknod restrictions if (!($<==0)) { - print "Must have root permissions to run properly.\n"; - exit; + print "Must have root permissions to run properly.\n"; + exit; } # prepare @@ -1520,31 +1520,31 @@ my $test_num = 1; my @list; foreach my $arg (@ARGV) { - if ($arg =~ m/--valgrind/) { - $valgrind = 1; - printf("using valgrind\n"); - } else { - push(@list, $arg); - } + if ($arg =~ m/--valgrind/) { + $valgrind = 1; + printf("using valgrind\n"); + } else { + push(@list, $arg); + } } if ($list[0]) { - foreach my $arg (@list) { - if (defined($tests[$arg-1]->{desc})) { - print "udev-test will run test number $arg:\n\n"; - run_test($tests[$arg-1], $arg); - } else { - print "test does not exist.\n"; - } - } + foreach my $arg (@list) { + if (defined($tests[$arg-1]->{desc})) { + print "udev-test will run test number $arg:\n\n"; + run_test($tests[$arg-1], $arg); + } else { + print "test does not exist.\n"; + } + } } else { - # test all - print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; + # test all + print "\nudev-test will run ".($#tests + 1)." tests:\n\n"; - foreach my $rules (@tests) { - run_test($rules, $test_num); - $test_num++; - } + foreach my $rules (@tests) { + run_test($rules, $test_num); + $test_num++; + } } print "$error errors occured\n\n"; -- cgit v1.2.3-54-g00ecf From dc401e018940ccd94b9648eeab25f5ae204e5b30 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Jan 2012 02:05:08 +0100 Subject: autogen.sh: makedev() misteriously breaks with -O0 here, use -O1 for now -O0 [pid 693] mknod("udev-root/sda", 034101566300) = -1 EINVAL (Invalid argument) -O1 [pid 8087] mknod("udev-root/sda", S_IFBLK, makedev(8, 0)) = 0 --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index 697ed919d2..180e423c4d 100755 --- a/autogen.sh +++ b/autogen.sh @@ -30,5 +30,5 @@ echo "----------------------------------------------------------------" echo "Initialized build system. For a common configuration please run:" echo "----------------------------------------------------------------" echo -echo "./configure CFLAGS='-g -O0' $args" +echo "./configure CFLAGS='-g -O1' $args" echo -- cgit v1.2.3-54-g00ecf From 22dde8d712310506e1166372d3f39a56d138387b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Jan 2012 02:06:36 +0100 Subject: fix debug message --- src/libudev-enumerate.c | 2 +- test/udev-test.pl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libudev-enumerate.c b/src/libudev-enumerate.c index 9a572ef050..034d96feba 100644 --- a/src/libudev-enumerate.c +++ b/src/libudev-enumerate.c @@ -922,7 +922,7 @@ UDEV_EXPORT int udev_enumerate_scan_subsystems(struct udev_enumerate *udev_enume /* all kernel modules */ if (match_subsystem(udev_enumerate, "module")) { - dbg(udev, "searching '%s/modules/*' dir\n", subsysdir); + dbg(udev, "searching 'modules/*' dir\n"); scan_dir_and_add_devices(udev_enumerate, "module", NULL, NULL); } diff --git a/test/udev-test.pl b/test/udev-test.pl index 0d30a2c47c..8afd3e4f77 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -1492,7 +1492,7 @@ sub run_test { print "\n"; if (defined($rules->{option}) && $rules->{option} eq "clean") { - make_udev_root (); + make_udev_root(); } } -- cgit v1.2.3-54-g00ecf From 04daa3407a4018f854ab14bf852dba2b11369993 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Jan 2012 05:51:47 +0100 Subject: add .vimrc --- .vimrc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .vimrc diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000000..366fbdca4b --- /dev/null +++ b/.vimrc @@ -0,0 +1,4 @@ +" 'set exrc' in ~/.vimrc will read .vimrc from the current directory +set tabstop=8 +set shiftwidth=8 +set expandtab -- cgit v1.2.3-54-g00ecf From db8f32f6ed7cbf641311280585094e69110c4e6e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Jan 2012 16:37:41 +0100 Subject: cdrom_id: int -> bool --- src/extras/cdrom_id/cdrom_id.c | 104 ++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/extras/cdrom_id/cdrom_id.c b/src/extras/cdrom_id/cdrom_id.c index daaebee14e..f90d52ec9c 100644 --- a/src/extras/cdrom_id/cdrom_id.c +++ b/src/extras/cdrom_id/cdrom_id.c @@ -56,71 +56,71 @@ static void log_fn(struct udev *udev, int priority, } /* device info */ -static unsigned int cd_cd_rom = 0; -static unsigned int cd_cd_r = 0; -static unsigned int cd_cd_rw = 0; -static unsigned int cd_dvd_rom = 0; -static unsigned int cd_dvd_r = 0; -static unsigned int cd_dvd_rw = 0; -static unsigned int cd_dvd_ram = 0; -static unsigned int cd_dvd_plus_r = 0; -static unsigned int cd_dvd_plus_rw = 0; -static unsigned int cd_dvd_plus_r_dl = 0; -static unsigned int cd_dvd_plus_rw_dl = 0; -static unsigned int cd_bd = 0; -static unsigned int cd_bd_r = 0; -static unsigned int cd_bd_re = 0; -static unsigned int cd_hddvd = 0; -static unsigned int cd_hddvd_r = 0; -static unsigned int cd_hddvd_rw = 0; -static unsigned int cd_mo = 0; -static unsigned int cd_mrw = 0; -static unsigned int cd_mrw_w = 0; +static unsigned int cd_cd_rom; +static unsigned int cd_cd_r; +static unsigned int cd_cd_rw; +static unsigned int cd_dvd_rom; +static unsigned int cd_dvd_r; +static unsigned int cd_dvd_rw; +static unsigned int cd_dvd_ram; +static unsigned int cd_dvd_plus_r; +static unsigned int cd_dvd_plus_rw; +static unsigned int cd_dvd_plus_r_dl; +static unsigned int cd_dvd_plus_rw_dl; +static unsigned int cd_bd; +static unsigned int cd_bd_r; +static unsigned int cd_bd_re; +static unsigned int cd_hddvd; +static unsigned int cd_hddvd_r; +static unsigned int cd_hddvd_rw; +static unsigned int cd_mo; +static unsigned int cd_mrw; +static unsigned int cd_mrw_w; /* media info */ -static unsigned int cd_media = 0; -static unsigned int cd_media_cd_rom = 0; -static unsigned int cd_media_cd_r = 0; -static unsigned int cd_media_cd_rw = 0; -static unsigned int cd_media_dvd_rom = 0; -static unsigned int cd_media_dvd_r = 0; -static unsigned int cd_media_dvd_rw = 0; -static unsigned int cd_media_dvd_rw_ro = 0; /* restricted overwrite mode */ -static unsigned int cd_media_dvd_rw_seq = 0; /* sequential mode */ -static unsigned int cd_media_dvd_ram = 0; -static unsigned int cd_media_dvd_plus_r = 0; -static unsigned int cd_media_dvd_plus_rw = 0; -static unsigned int cd_media_dvd_plus_r_dl = 0; -static unsigned int cd_media_dvd_plus_rw_dl = 0; -static unsigned int cd_media_bd = 0; -static unsigned int cd_media_bd_r = 0; -static unsigned int cd_media_bd_re = 0; -static unsigned int cd_media_hddvd = 0; -static unsigned int cd_media_hddvd_r = 0; -static unsigned int cd_media_hddvd_rw = 0; -static unsigned int cd_media_mo = 0; -static unsigned int cd_media_mrw = 0; -static unsigned int cd_media_mrw_w = 0; +static unsigned int cd_media; +static unsigned int cd_media_cd_rom; +static unsigned int cd_media_cd_r; +static unsigned int cd_media_cd_rw; +static unsigned int cd_media_dvd_rom; +static unsigned int cd_media_dvd_r; +static unsigned int cd_media_dvd_rw; +static unsigned int cd_media_dvd_rw_ro; /* restricted overwrite mode */ +static unsigned int cd_media_dvd_rw_seq; /* sequential mode */ +static unsigned int cd_media_dvd_ram; +static unsigned int cd_media_dvd_plus_r; +static unsigned int cd_media_dvd_plus_rw; +static unsigned int cd_media_dvd_plus_r_dl; +static unsigned int cd_media_dvd_plus_rw_dl; +static unsigned int cd_media_bd; +static unsigned int cd_media_bd_r; +static unsigned int cd_media_bd_re; +static unsigned int cd_media_hddvd; +static unsigned int cd_media_hddvd_r; +static unsigned int cd_media_hddvd_rw; +static unsigned int cd_media_mo; +static unsigned int cd_media_mrw; +static unsigned int cd_media_mrw_w; static const char *cd_media_state = NULL; -static unsigned int cd_media_session_next = 0; -static unsigned int cd_media_session_count = 0; -static unsigned int cd_media_track_count = 0; -static unsigned int cd_media_track_count_data = 0; -static unsigned int cd_media_track_count_audio = 0; -static unsigned long long int cd_media_session_last_offset = 0; +static unsigned int cd_media_session_next; +static unsigned int cd_media_session_count; +static unsigned int cd_media_track_count; +static unsigned int cd_media_track_count_data; +static unsigned int cd_media_track_count_audio; +static unsigned long long int cd_media_session_last_offset; #define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) #define SK(errcode) (((errcode) >> 16) & 0xF) #define ASC(errcode) (((errcode) >> 8) & 0xFF) #define ASCQ(errcode) ((errcode) & 0xFF) -static int is_mounted(const char *device) +static bool is_mounted(const char *device) { struct stat statbuf; FILE *fp; int maj, min; - int mounted = 0; + bool mounted = false; if (stat(device, &statbuf) < 0) return -ENODEV; @@ -130,7 +130,7 @@ static int is_mounted(const char *device) return -ENOSYS; while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { if (makedev(maj, min) == statbuf.st_rdev) { - mounted = 1; + mounted = true; break; } } -- cgit v1.2.3-54-g00ecf From bd59d82322503b796ed6e80425df4bd24b5059ee Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 10 Jan 2012 19:37:41 +0100 Subject: fix compiler warning --- src/libudev-util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libudev-util.c b/src/libudev-util.c index a795329f7c..7e345f0fb6 100644 --- a/src/libudev-util.c +++ b/src/libudev-util.c @@ -56,7 +56,7 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) ssize_t len; int i; int back; - char *base; + char *base = NULL; len = readlink(syspath, link_target, sizeof(link_target)); if (len <= 0 || len == (ssize_t)sizeof(link_target)) @@ -70,9 +70,11 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size) for (i = 0; i <= back; i++) { base = strrchr(syspath, '/'); if (base == NULL) - return -1; + return -EINVAL; base[0] = '\0'; } + if (base == NULL) + return -EINVAL; dbg(udev, "after moving back '%s'\n", syspath); util_strscpyl(base, size - (base - syspath), "/", &link_target[back * 3], NULL); return 0; -- cgit v1.2.3-54-g00ecf From 2b76eb68aca6b2f8c181f5f6ffec165c16017180 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 11 Jan 2012 21:49:25 +0100 Subject: man: mention that no daemons should be started by udev --- src/udev.xml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/udev.xml b/src/udev.xml index 88e19f30d1..4de434ee51 100644 --- a/src/udev.xml +++ b/src/udev.xml @@ -382,14 +382,15 @@ Add a program to the list of programs to be executed for a specific - device. This can only be used for very short running tasks. Running an - event process for a long period of time may block all further events for - this or a dependent device. Long running tasks need to be immediately - detached from the event process itself. + device. If no absolute path is given, the program is expected to live in /usr/lib/udev, otherwise the absolute path must be specified. The program name and following arguments are separated by spaces. Single quotes can be used to specify arguments with spaces. + This can only be used for very short running tasks. Running an + event process for a long period of time may block all further events for + this or a dependent device. Starting daemons or other long running processes + is not appropriate for udev. -- cgit v1.2.3-54-g00ecf From d8d2af0635507623971ce59e058847a700978cd8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 11 Jan 2012 21:50:29 +0100 Subject: release 176 --- ChangeLog | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 24 +++++++++-------- configure.ac | 2 +- 3 files changed, 102 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0110f3e939..e788d2edb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,91 @@ +Summary of changes from v175 to v176 +============================================ + +Alan Stern (1): + [PATCH[ udev: ata_id: Fix length of INQUIRY command + +Kay Sievers (61): + libudev: print log_fn address instead of ctx when setting logging function + do not ship autogen.sh in the tarball + man: clarify 'config file stack' + rename 'init' directory to 'systemd' + systemd: use PassCred=yes + use libexecdir, bindir, sbindir, switch to /usr/lib/udev in documentation + configure: fix typo + make: do not (mis-)use the config file generator, create .xz tarball + prepare builtins for blkid and kmod + add builtin load/unload initializers + build argv[] for builtin commands + update blkid builtin + rules: switch to built-in blkid + rules: do not preprocess 60-persistent-storage.rules + buildsys: disable tar.gz + builtin: blkid - add missing newline + builtin: blkid - add missing ID_FS_USAGE + builtin: kmod - switch modprobe to builtin + rules: do not preprocess 80-drivers.rules + 75-probe_mtd.rules + builtin: apply format string + remove last sbindir use + update NEWS + autogen.sh: moce CFLAGS from to configure.ac; print common ./configure options + builtin: kmod - link against libkmod + add copyright + builtin: kmod - reload index when rules are reloaded + builtin: rename load()/unload() to init()/exit() + invalidate rules and kmod index with 'udevadm control --reload' + update NEWS + builtin: firmware - move 'firmware' tool to builtins + builtin: firmware - add missing file + builtin: kmod - hook up udev main logging to libkmod + make: introduce --with-rootprefix= + update NEWS + move rules dirs to udev context; replace inotify with time-controlled stat() + udevd: always create runtime dir + builtin: move usb-db, pci-db to builtins + builtin: kmod - switch to kmod_module_probe_insert_module() + udevd: remove TIMEOUT= handling + update README + systemd: rename PassCred= to PsssCredentials= + remove mknod() logic and rely on 'devtmpfs' + builtin: kmod - hook up kmod_validate_resources() + build-sys: use use ${ac_default_prefix} + require kmod >= 3 + build-sys: use --libexecdir=/usr/lib instead of /usr/lib/udev + autogen.sh: enable git pre-commit + merge udev/, libudev/, systemd/ files in src/; move extras/ to src/ + replace unpacked sysfs test tree 'test/sys/' with packed tarball + rules: delete arch specific rules + doc: fix out of tree build (copy from libkmod) + autogen.sh: add CFLAGS and print entire line, so that mouse copy/paste works + build-sys: try to build without installed xsltproc + add test/src to .gitignore + tabs are as useful as a hole in the head + autogen.sh: makedev() misteriously breaks with -O0 here, use -O1 for now + fix debug message + add .vimrc + cdrom_id: int -> bool + fix compiler warning + man: mention that no daemons should be started by udev + +Lucas De Marchi (1): + builtin: kmod - log if modules are blacklisted + +Luis Felipe Strano Moraes (1): + Switch spawn_read to void and remove useless stores there. + +Martin Pitt (1): + 75-persistent-net-generator.rules: Add Xen + +Mike Frysinger (1): + hwdb: drop useless line freeing + +Sjoerd Simons (1): + keymap: Add Lenovo Thinkpad X220 Tablet + +Ville Skyttä (1): + man: spelling fix + + Summary of changes from v174 to v175 ============================================ diff --git a/NEWS b/NEWS index 1210ed5a73..85e206c81d 100644 --- a/NEWS +++ b/NEWS @@ -1,22 +1,22 @@ -udev 175 +udev 176 ======== The 'devtmpfs' filesystem is required now, udev will not create or delete device nodes anymore, it only adjusts permissions and ownership of device nodes and maintains additional symlinks. -A writable /run directory (tmpfs) is required now for a fully functional -udev. +A writable /run directory (ususally tmpfs) is required now for a fully +functional udev, there is no longer a fallback to /dev/.udev. The default 'configure' install locations have changed. Packages for systems with the historic / vs. /usr split need to be adapted, otherwise udev will -be installed in /usr and not work properly. Example configuration options are -in INSTALL. +be installed in /usr and not work properly. Example configuration options +to install things the traditional way are in INSTALL. The default install location of the 'udevadm' tool moved from 'sbin' -to /usr/bin. Some tools expect udevadm in 'sbin'. A symlink to udevadm -needs to be manually created if needed. +to /usr/bin. Some tools expect udevadm in 'sbin', a symlink to udevadm +needs to be manually created if needed, or --bindir=/sbin be specified. -The expected value of '--libexecdir' has changed and must no longer contain +The expected value of '--libexecdir=' has changed and must no longer contain the 'udev' directory. Kernel modules are now loaded directly by linking udev to 'libkmod'. The @@ -31,13 +31,15 @@ is no longer used. All built-in tools can be listed and tested with 'udevadm test-builtin'. The 'udevadm control --reload-rules' option has been renamed to '--reload'. -It reloads the kernel module configuration. +It now also reloads the kernel module configuration. -The systemd socket files use PassCredentials=yes, which requires systemd -version 38. +The systemd socket files use PassCredentials=yes, which is available in +systemd version 38. The udev build system only creates a .xz tarball now. +All tabs in the source code used for indentation are replaced by spaces now. :) + udev 175 ======== Bugfixes. diff --git a/configure.ac b/configure.ac index 035e5fa443..79d0cd7a88 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [175], + [176], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From afa462dc182c0176a0c9f0afb5db1e0080c499f5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Jan 2012 00:18:41 +0100 Subject: Makefile: update kernel.org sign and upload hook --- INSTALL | 2 +- Makefile.am | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/INSTALL b/INSTALL index 59abf7c92f..0a34e77df2 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -The options used used usually look like: +The options used usually look like: %configure \ --prefix=/usr \ --sysconfdir=/etc \ diff --git a/Makefile.am b/Makefile.am index 46f923ea90..d034baf565 100644 --- a/Makefile.am +++ b/Makefile.am @@ -755,16 +755,16 @@ git-release: git tag -m "udev $(VERSION)" -s $(VERSION) git gc --prune=0 -tar: - make distcheck - gpg --armor --detach-sign udev-$(VERSION).tar.xz - git-sync: git push git push --tags $(VERSION) +tar: + make distcheck + xz -d -c udev-$(VERSION).tar.xz | gpg --armor --detach-sign --output udev-$(VERSION).tar.asc + tar-sync: - scp udev-$(VERSION).tar.xz master.kernel.org:/pub/linux/utils/kernel/hotplug/ + kup put udev-$(VERSION).tar.xz udev-$(VERSION).tar.asc /pub/linux/utils/kernel/hotplug/udev-$(VERSION).tar.gz doc-sync: rsync -av src/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ -- cgit v1.2.3-54-g00ecf From 00e35730af835d9fe951fc4c7265a0f8959e0d97 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Jan 2012 05:10:34 +0100 Subject: rule_generator: fix to install rules in rules.d/ --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index d034baf565..230c4daade 100644 --- a/Makefile.am +++ b/Makefile.am @@ -659,7 +659,7 @@ dist_udevhome_SCRIPTS += \ src/extras/rule_generator/write_net_rules udevhome_DATA = src/extras/rule_generator/rule_generator.functions -dist_udevhome_DATA += \ +dist_udevrules_DATA += \ src/extras/rule_generator/75-cd-aliases-generator.rules \ src/extras/rule_generator/75-persistent-net-generator.rules endif -- cgit v1.2.3-54-g00ecf From ccf4fd45f62645bbb7e94b7428bc5d9c78846e97 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Jan 2012 05:28:43 +0100 Subject: rule_generator: use += for dist_udevhome_DATA --- Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 230c4daade..83e5fa31d5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -658,7 +658,9 @@ dist_udevhome_SCRIPTS += \ src/extras/rule_generator/write_cd_rules \ src/extras/rule_generator/write_net_rules -udevhome_DATA = src/extras/rule_generator/rule_generator.functions +dist_udevhome_DATA += \ + src/extras/rule_generator/rule_generator.functions + dist_udevrules_DATA += \ src/extras/rule_generator/75-cd-aliases-generator.rules \ src/extras/rule_generator/75-persistent-net-generator.rules -- cgit v1.2.3-54-g00ecf From 1305ffe0456cc016a78c1fc7ca17645cfef39778 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Jan 2012 05:31:45 +0100 Subject: release 177 --- ChangeLog | 9 +++++++++ NEWS | 4 ++++ configure.ac | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e788d2edb9..51e031c0c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Summary of changes from v176 to v177 +============================================ + +Kay Sievers (3): + Makefile: update kernel.org sign and upload hook + rule_generator: fix to install rules in rules.d/ + rule_generator: use += for dist_udevhome_DATA + + Summary of changes from v175 to v176 ============================================ diff --git a/NEWS b/NEWS index 85e206c81d..0973d80668 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 177 +======== +Bugfix for rule_generator instalation. + udev 176 ======== The 'devtmpfs' filesystem is required now, udev will not create or delete diff --git a/configure.ac b/configure.ac index 79d0cd7a88..ada06d7862 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [176], + [177], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From a5f834204f375519b178f98770f8cfd9668a4603 Mon Sep 17 00:00:00 2001 From: Evan Nemerson Date: Wed, 11 Jan 2012 23:42:22 -0800 Subject: gudev: several minor introspection fixes - Include exported package information - Include C include information - g_udev_device_get_parent & g_udev_device_get_parent_with_subsystem transfer ownership of their return values Signed-off-by: Martin Pitt --- Makefile.am | 2 ++ src/extras/gudev/gudevdevice.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 83e5fa31d5..d3d9570e6a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -479,6 +479,8 @@ src/extras/gudev/GUdev-1.0.gir: src/extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) --output $@ \ --pkg=glib-2.0 \ --pkg=gobject-2.0 \ + --pkg-export=gudev-1.0 \ + --c-include=gudev/gudev.h \ -I$(top_srcdir)/src/extras \ -I$(top_builddir)/src/extras \ -D_GUDEV_COMPILATION \ diff --git a/src/extras/gudev/gudevdevice.c b/src/extras/gudev/gudevdevice.c index 0c3340ffeb..62a26f99b7 100644 --- a/src/extras/gudev/gudevdevice.c +++ b/src/extras/gudev/gudevdevice.c @@ -373,7 +373,7 @@ g_udev_device_get_device_file_symlinks (GUdevDevice *device) * * Gets the immediate parent of @device, if any. * - * Returns: A #GUdevDevice or %NULL if @device has no parent. Free with g_object_unref(). + * Returns: (transfer full): A #GUdevDevice or %NULL if @device has no parent. Free with g_object_unref(). */ GUdevDevice * g_udev_device_get_parent (GUdevDevice *device) @@ -404,7 +404,7 @@ g_udev_device_get_parent (GUdevDevice *device) * Walks up the chain of parents of @device and returns the first * device encountered where @subsystem and @devtype matches, if any. * - * Returns: A #GUdevDevice or %NULL if @device has no parent with @subsystem and @devtype. Free with g_object_unref(). + * Returns: (transfer full): A #GUdevDevice or %NULL if @device has no parent with @subsystem and @devtype. Free with g_object_unref(). */ GUdevDevice * g_udev_device_get_parent_with_subsystem (GUdevDevice *device, -- cgit v1.2.3-54-g00ecf From 338dc67a005fd0ed9a8a3524d2b317e33ab33c9f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 12 Jan 2012 16:30:12 +0100 Subject: Makefile: update kernel.org doc hooks for kup --- Makefile.am | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index d3d9570e6a..04db95fce6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -771,6 +771,9 @@ tar-sync: kup put udev-$(VERSION).tar.xz udev-$(VERSION).tar.asc /pub/linux/utils/kernel/hotplug/udev-$(VERSION).tar.gz doc-sync: - rsync -av src/*.html master.kernel.org:/pub/linux/utils/kernel/hotplug/udev/ - rsync -av --delete src/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/src/ - rsync -av --delete src/extras/gudev/docs/html/ master.kernel.org:/pub/linux/utils/kernel/hotplug/gudev/ + for i in src/*.html; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done + for i in src/*.html; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/udev/; done + for i in src/docs/html/*.{html,css,png}; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done + for i in src/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/libudev/; done + for i in src/extras/gudev/docs/html/*.{html,css,png}; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done + for i in src/extras/gudev/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/gudev/; done -- cgit v1.2.3-54-g00ecf From 1b9e13e2e2c4755752e1e9fd8ff4399af7329ab8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 16 Jan 2012 15:38:41 +0100 Subject: builtin: blkid - add missing ID_ prefix 60-persistent-storage.rules gpt by-partlabel/by-partuuid symlinks not created in udev-177 util-linux-2.20.1 kmod-3 in Archlinux x86_64. ridikulus_rat: fix the rule, or fix the blkid builtin ;) oh, i missed the ID_ stuff? :) --- src/udev-builtin-blkid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/udev-builtin-blkid.c b/src/udev-builtin-blkid.c index 2056617dbf..ea526a425e 100644 --- a/src/udev-builtin-blkid.c +++ b/src/udev-builtin-blkid.c @@ -69,11 +69,11 @@ static void print_property(struct udev_device *dev, bool test, const char *name, } else if (!strcmp(name, "PART_ENTRY_NAME")) { blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "PART_ENTRY_NAME", s); + udev_builtin_add_property(dev, test, "ID_PART_ENTRY_NAME", s); } else if (!strcmp(name, "PART_ENTRY_TYPE")) { blkid_encode_string(value, s, sizeof(s)); - udev_builtin_add_property(dev, test, "PART_ENTRY_TYPE", s); + udev_builtin_add_property(dev, test, "ID_PART_ENTRY_TYPE", s); } else if (!strncmp(name, "PART_ENTRY_", 11)) { util_strscpyl(s, sizeof(s), "ID_", name, NULL); -- cgit v1.2.3-54-g00ecf From e64fae5573e566ce4fd9b23c68ac8f3096603314 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 18 Jan 2012 05:06:18 +0100 Subject: udevd: kill hanging event processes after 30 seconds Some broken kernel drivers load firmware synchronously in the module init path and block modprobe until the firmware request is fulfilled. The modprobe-generated firmware request is a direct child device of the device which caused modprobe to run. Child device event are blocked until the parent device is handled. This dead-locks until the kernel firmware loading timeout of 60 seconds is reached. The hanging modprobe event should now time-out and allow the firmware event to run before the 60 second kernel timeout. --- src/udev-event.c | 2 +- src/udevd.c | 62 +++++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/udev-event.c b/src/udev-event.c index 9bdc5186df..f0b9548f3d 100644 --- a/src/udev-event.c +++ b/src/udev-event.c @@ -49,7 +49,7 @@ struct udev_event *udev_event_new(struct udev_device *dev) udev_list_init(udev, &event->run_list, false); event->fd_signal = -1; event->birth_usec = now_usec(); - event->timeout_usec = 60 * 1000 * 1000; + event->timeout_usec = 30 * 1000 * 1000; dbg(event->udev, "allocated event %p\n", event); return event; } diff --git a/src/udevd.c b/src/udevd.c index 11ab19a311..77a1e7909d 100644 --- a/src/udevd.c +++ b/src/udevd.c @@ -133,6 +133,7 @@ struct worker { struct udev_monitor *monitor; enum worker_state state; struct event *event; + unsigned long long event_start_usec; }; /* passed from worker to main process */ @@ -372,6 +373,7 @@ out: close(fd_inotify); close(worker_watch[WRITE_END]); udev_rules_unref(rules); + udev_builtin_exit(udev); udev_monitor_unref(worker_monitor); udev_unref(udev); udev_log_close(); @@ -389,6 +391,7 @@ out: worker->monitor = worker_monitor; worker->pid = pid; worker->state = WORKER_RUNNING; + worker->event_start_usec = now_usec(); worker->event = event; event->state = EVENT_RUNNING; udev_list_node_append(&worker->node, &worker_list); @@ -419,6 +422,7 @@ static void event_run(struct event *event) worker_ref(worker); worker->event = event; worker->state = WORKER_RUNNING; + worker->event_start_usec = now_usec(); event->state = EVENT_RUNNING; return; } @@ -610,9 +614,11 @@ static void worker_returned(int fd_worker) continue; /* worker returned */ - worker->event->exitcode = msg.exitcode; - event_queue_delete(worker->event, true); - worker->event = NULL; + if (worker->event) { + worker->event->exitcode = msg.exitcode; + event_queue_delete(worker->event, true); + worker->event = NULL; + } if (worker->state != WORKER_KILLED) worker->state = WORKER_IDLE; worker_unref(worker); @@ -796,7 +802,7 @@ static void handle_signal(struct udev *udev, int signo) } if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - if (worker->event != NULL) { + if (worker->event) { err(udev, "worker [%u] failed while handling '%s'\n", pid, worker->event->devpath); worker->event->exitcode = -32; @@ -1574,25 +1580,57 @@ int main(int argc, char *argv[]) break; /* timeout at exit for workers to finish */ - timeout = 60 * 1000; - } else if (udev_list_node_is_empty(&event_list) && children > 2) { - /* set timeout to kill idle workers */ - timeout = 3 * 1000; - } else { + timeout = 30 * 1000; + } else if (udev_list_node_is_empty(&event_list) && children <= 2) { + /* we are idle */ timeout = -1; + } else { + /* kill idle or hanging workers */ + timeout = 3 * 1000; } fdcount = epoll_wait(fd_ep, ev, ARRAY_SIZE(ev), timeout); if (fdcount < 0) continue; if (fdcount == 0) { + struct udev_list_node *loop; + + /* timeout */ if (udev_exit) { - info(udev, "timeout, giving up waiting for workers to finish\n"); + err(udev, "timeout, giving up waiting for workers to finish\n"); break; } - /* timeout - kill idle workers */ - worker_kill(udev, 2); + /* kill idle workers */ + if (udev_list_node_is_empty(&event_list)) { + info(udev, "cleanup idle workers\n"); + worker_kill(udev, 2); + } + + /* check for hanging events */ + udev_list_node_foreach(loop, &worker_list) { + struct worker *worker = node_to_worker(loop); + + if (worker->state != WORKER_RUNNING) + continue; + + if ((now_usec() - worker->event_start_usec) > 30 * 1000 * 1000) { + err(udev, "worker [%u] timeout, kill it\n", worker->pid, + worker->event ? worker->event->devpath : ""); + kill(worker->pid, SIGKILL); + worker->state = WORKER_KILLED; + /* drop reference taken for state 'running' */ + worker_unref(worker); + if (worker->event) { + err(udev, "seq %llu '%s' killed\n", + udev_device_get_seqnum(worker->event->dev), worker->event->devpath); + worker->event->exitcode = -64; + event_queue_delete(worker->event, true); + worker->event = NULL; + } + } + } + } is_worker = is_signal = is_inotify = is_netlink = is_ctrl = false; -- cgit v1.2.3-54-g00ecf From 4bebab99981df8b3ee221810bc4b78025c9f8ac9 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 18 Jan 2012 11:34:44 +0100 Subject: keymap: Fix rfkill button on Hewlett-Packard HP ProBook https://bugs.launchpad.net/bugs/914838 --- src/extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/src/extras/keymap/95-keymap.rules b/src/extras/keymap/95-keymap.rules index 1ec18b7f55..4b652f05c3 100644 --- a/src/extras/keymap/95-keymap.rules +++ b/src/extras/keymap/95-keymap.rules @@ -92,6 +92,7 @@ ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill" # HP Pavillion dv6315ea has empty DMI_VENDOR ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play -- cgit v1.2.3-54-g00ecf From 1cb6889100362f55552ce3ad2517be9bed184135 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 18 Jan 2012 12:05:01 +0100 Subject: keymap: Fix eject button on Samsung 700Z series https://launchpad.net/bugs/902798 --- src/extras/keymap/95-keymap.rules | 1 + 1 file changed, 1 insertion(+) diff --git a/src/extras/keymap/95-keymap.rules b/src/extras/keymap/95-keymap.rules index 4b652f05c3..55168993df 100644 --- a/src/extras/keymap/95-keymap.rules +++ b/src/extras/keymap/95-keymap.rules @@ -141,6 +141,7 @@ ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keyma ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-other" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700Z*", RUN+="keymap $name 0xBA ejectcd" ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" -- cgit v1.2.3-54-g00ecf From c861d52fd6f3f08b9988dbeb6b4db5f27963cade Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 18 Jan 2012 12:06:58 +0100 Subject: keymap: Fix keyboard brightness keys on Samsung 700Z series https://launchpad.net/bugs/902332 --- src/extras/keymap/95-keymap.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extras/keymap/95-keymap.rules b/src/extras/keymap/95-keymap.rules index 55168993df..0ad465fde3 100644 --- a/src/extras/keymap/95-keymap.rules +++ b/src/extras/keymap/95-keymap.rules @@ -141,7 +141,7 @@ ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keyma ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-other" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700Z*", RUN+="keymap $name 0xBA ejectcd" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700Z*", RUN+="keymap $name 0xBA ejectcd 0x96 keyboardbrightnessup 0x97 keyboardbrightnessdown" ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" -- cgit v1.2.3-54-g00ecf From 46505c52a61cbc9c9465eb676d3693bb32e65615 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 18 Jan 2012 12:14:54 +0100 Subject: keymap: Add Alienware M14xR1 https://launchpad.net/bugs/901513 --- src/extras/keymap/95-keymap.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/extras/keymap/95-keymap.rules b/src/extras/keymap/95-keymap.rules index 0ad465fde3..69a776ebd9 100644 --- a/src/extras/keymap/95-keymap.rules +++ b/src/extras/keymap/95-keymap.rules @@ -163,4 +163,6 @@ ENV{DMI_VENDOR}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $n ENV{DMI_VENDOR}=="OLPC", ATTR{[dmi/id]product_name}=="XO", RUN+="keymap $name olpc-xo" +ENV{DMI_VENDOR}=="Alienware*", ATTR{[dmi/id]product_name}=="M14xR1", RUN+="keymap $name 0x8A ejectcd" + LABEL="keyboard_end" -- cgit v1.2.3-54-g00ecf From c23d8fb18f018d737fdc22abe3c7ef599561d37f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 18 Jan 2012 14:47:07 +0100 Subject: Makefile: switch from .asc to .sign --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 04db95fce6..3271bdb54c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -765,10 +765,10 @@ git-sync: tar: make distcheck - xz -d -c udev-$(VERSION).tar.xz | gpg --armor --detach-sign --output udev-$(VERSION).tar.asc + xz -d -c udev-$(VERSION).tar.xz | gpg --armor --detach-sign --output udev-$(VERSION).tar.sign tar-sync: - kup put udev-$(VERSION).tar.xz udev-$(VERSION).tar.asc /pub/linux/utils/kernel/hotplug/udev-$(VERSION).tar.gz + kup put udev-$(VERSION).tar.xz udev-$(VERSION).tar.sign /pub/linux/utils/kernel/hotplug/ doc-sync: for i in src/*.html; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done -- cgit v1.2.3-54-g00ecf From 6102188c93e55eba1b5dad54d27ea1ac2e8c7e73 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 21 Jan 2012 02:56:32 +0100 Subject: rules: rtc - point /dev/rtc symlink to 'hctosys' device --- rules/rules.d/50-udev-default.rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules index 3744707909..5ad787fc76 100644 --- a/rules/rules.d/50-udev-default.rules +++ b/rules/rules.d/50-udev-default.rules @@ -99,7 +99,7 @@ KERNEL=="cpu[0-9]*", MODE="0444" KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse" -SUBSYSTEM=="rtc", DRIVERS=="rtc_cmos", SYMLINK+="rtc" +SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc" KERNEL=="mmtimer", MODE="0644" KERNEL=="rflash[0-9]*", MODE="0400" KERNEL=="rrom[0-9]*", MODE="0400" -- cgit v1.2.3-54-g00ecf From 430959910f1b9b67c2553f5f46c0487b0f8a3a00 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 21 Jan 2012 03:07:32 +0100 Subject: warn about deprecated RUN+="socket:" use --- src/udev-rules.c | 3 +++ src/udevd.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/udev-rules.c b/src/udev-rules.c index d14a57abc7..c163712868 100644 --- a/src/udev-rules.c +++ b/src/udev-rules.c @@ -1451,6 +1451,9 @@ static int add_rule(struct udev_rules *rules, char *line, } if (strcmp(key, "RUN") == 0) { + if (strncmp(value, "socket:", 7) == 0) + err(rules->udev, "RUN+=\"socket:...\" support will be removed from a future udev release. " + "Please remove it from: %s:%u and use libudev to subscribe to events.\n", filename, lineno); rule_add_key(&rule_tmp, TK_A_RUN, op, value, NULL); continue; } diff --git a/src/udevd.c b/src/udevd.c index 77a1e7909d..170221790a 100644 --- a/src/udevd.c +++ b/src/udevd.c @@ -230,7 +230,7 @@ static void worker_new(struct event *event) sigset_t mask; int rc = EXIT_SUCCESS; - /* move initial device from queue */ + /* take initial device from queue */ dev = event->dev; event->dev = NULL; -- cgit v1.2.3-54-g00ecf From d2b795f2b942a2532c396c7e55d6cd8369cae7fc Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 21 Jan 2012 06:00:17 +0100 Subject: libudev: do not set DEVNAME= twice When we read the 'uevent' file we need to make sure, that we do not read the relative DEVNAME= path provided by the kernel and overwrite the absolute path udev expects here. --- Makefile.am | 2 +- NEWS | 16 ++++++++++++++++ src/libudev-device.c | 19 +++++++++++++------ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Makefile.am b/Makefile.am index 3271bdb54c..e292600565 100644 --- a/Makefile.am +++ b/Makefile.am @@ -77,7 +77,7 @@ SED_PROCESS = \ # libudev # ------------------------------------------------------------------------------ LIBUDEV_CURRENT=13 -LIBUDEV_REVISION=0 +LIBUDEV_REVISION=1 LIBUDEV_AGE=13 SUBDIRS += src/docs diff --git a/NEWS b/NEWS index 0973d80668..a0ed539454 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,19 @@ +udev 178 +======== +Bugfix for the firmware loading behavior with kernel modules which +try to load firmware in the module_init() path. The blocked event +runs into a timout now, which should allow the firmware to be loaded. + +Bugfix for a wrong DEVNAME= export, which breaks at least the udev-acl +tool. + +Bugfix for missing ID_ properties for GPT partitions. + +The RUN+="socket:.." option is deprecated and should not be used. A warning +during rules parsing is printed now. Services which listen to udev events, +need to subscribe to the netlink messages with libudev and not let udev block +in the rules execution until the message is delivered. + udev 177 ======== Bugfix for rule_generator instalation. diff --git a/src/libudev-device.c b/src/libudev-device.c index a3356cfd18..10f28b8cd5 100644 --- a/src/libudev-device.c +++ b/src/libudev-device.c @@ -548,16 +548,23 @@ int udev_device_read_uevent_file(struct udev_device *udev_device) continue; pos[0] = '\0'; - if (strncmp(line, "DEVTYPE=", 8) == 0) + if (strncmp(line, "DEVTYPE=", 8) == 0) { udev_device_set_devtype(udev_device, &line[8]); - else if (strncmp(line, "MAJOR=", 6) == 0) + continue; + } + if (strncmp(line, "IFINDEX=", 8) == 0) { + udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); + continue; + } + if (strncmp(line, "DEVNAME=", 8) == 0) { + udev_device_set_devnode(udev_device, &line[8]); + continue; + } + + if (strncmp(line, "MAJOR=", 6) == 0) maj = strtoull(&line[6], NULL, 10); else if (strncmp(line, "MINOR=", 6) == 0) min = strtoull(&line[6], NULL, 10); - else if (strncmp(line, "IFINDEX=", 8) == 0) - udev_device_set_ifindex(udev_device, strtoull(&line[8], NULL, 10)); - else if (strncmp(line, "DEVNAME=", 8) == 0) - udev_device_set_devnode(udev_device, &line[8]); else if (strncmp(line, "DEVMODE=", 8) == 0) udev_device->devnode_mode = strtoul(&line[8], NULL, 8); -- cgit v1.2.3-54-g00ecf From 579734fca598363cf15ab565aa09669c4112447e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 21 Jan 2012 06:35:06 +0100 Subject: release 178 --- ChangeLog | 22 ++++++++++++++++++++++ configure.ac | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 51e031c0c9..b561b7a5e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +Summary of changes from v177 to v178 +============================================ + +Evan Nemerson (1): + gudev: several minor introspection fixes + +Kay Sievers (7): + Makefile: update kernel.org doc hooks for kup + builtin: blkid - add missing ID_ prefix + udevd: kill hanging event processes after 30 seconds + Makefile: switch from .asc to .sign + rules: rtc - point /dev/rtc symlink to 'hctosys' device + warn about deprecated RUN+="socket:" use + libudev: do not set DEVNAME= twice + +Martin Pitt (4): + keymap: Fix rfkill button on Hewlett-Packard HP ProBook + keymap: Fix eject button on Samsung 700Z series + keymap: Fix keyboard brightness keys on Samsung 700Z series + keymap: Add Alienware M14xR1 + + Summary of changes from v176 to v177 ============================================ diff --git a/configure.ac b/configure.ac index ada06d7862..ceaeeb8f8f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [177], + [178], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From a1525d172014e66f97d82fc1e9096444597abcc7 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 22 Jan 2012 22:44:13 +0100 Subject: fix some fallout from tab removal --- Makefile.am | 2 +- src/udev-rules.c | 212 +++++++++++++++++++++++++++---------------------------- 2 files changed, 107 insertions(+), 107 deletions(-) diff --git a/Makefile.am b/Makefile.am index e292600565..a5cc2e147f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -761,7 +761,7 @@ git-release: git-sync: git push - git push --tags $(VERSION) + git push --tags tar: make distcheck diff --git a/src/udev-rules.c b/src/udev-rules.c index c163712868..8efc498f75 100644 --- a/src/udev-rules.c +++ b/src/udev-rules.c @@ -32,15 +32,15 @@ #include "udev.h" -#define PREALLOC_TOKEN 2048 -#define PREALLOC_STRBUF 32 * 1024 -#define PREALLOC_TRIE 256 +#define PREALLOC_TOKEN 2048 +#define PREALLOC_STRBUF 32 * 1024 +#define PREALLOC_TRIE 256 struct uid_gid { unsigned int name_off; union { - uid_t uid; - gid_t gid; + uid_t uid; + gid_t gid; }; }; @@ -100,11 +100,11 @@ enum operation_type { enum string_glob_type { GL_UNSET, - GL_PLAIN, /* no special chars */ + GL_PLAIN, /* no special chars */ GL_GLOB, /* shell globs ?,*,[] */ - GL_SPLIT, /* multi-value A|B */ - GL_SPLIT_GLOB, /* multi-value with glob A*|B* */ - GL_SOMETHING, /* commonly used "?*" */ + GL_SPLIT, /* multi-value A|B */ + GL_SPLIT_GLOB, /* multi-value with glob A*|B* */ + GL_SOMETHING, /* commonly used "?*" */ }; enum string_subst_type { @@ -119,57 +119,57 @@ enum token_type { TK_UNSET, TK_RULE, - TK_M_ACTION, /* val */ - TK_M_DEVPATH, /* val */ - TK_M_KERNEL, /* val */ - TK_M_DEVLINK, /* val */ - TK_M_NAME, /* val */ - TK_M_ENV, /* val, attr */ - TK_M_TAG, /* val */ - TK_M_SUBSYSTEM, /* val */ - TK_M_DRIVER, /* val */ - TK_M_WAITFOR, /* val */ - TK_M_ATTR, /* val, attr */ + TK_M_ACTION, /* val */ + TK_M_DEVPATH, /* val */ + TK_M_KERNEL, /* val */ + TK_M_DEVLINK, /* val */ + TK_M_NAME, /* val */ + TK_M_ENV, /* val, attr */ + TK_M_TAG, /* val */ + TK_M_SUBSYSTEM, /* val */ + TK_M_DRIVER, /* val */ + TK_M_WAITFOR, /* val */ + TK_M_ATTR, /* val, attr */ TK_M_PARENTS_MIN, - TK_M_KERNELS, /* val */ + TK_M_KERNELS, /* val */ TK_M_SUBSYSTEMS, /* val */ - TK_M_DRIVERS, /* val */ - TK_M_ATTRS, /* val, attr */ - TK_M_TAGS, /* val */ + TK_M_DRIVERS, /* val */ + TK_M_ATTRS, /* val, attr */ + TK_M_TAGS, /* val */ TK_M_PARENTS_MAX, - TK_M_TEST, /* val, mode_t */ - TK_M_EVENT_TIMEOUT, /* int */ - TK_M_PROGRAM, /* val */ - TK_M_IMPORT_FILE, /* val */ - TK_M_IMPORT_PROG, /* val */ - TK_M_IMPORT_BUILTIN, /* val */ - TK_M_IMPORT_DB, /* val */ - TK_M_IMPORT_CMDLINE, /* val */ - TK_M_IMPORT_PARENT, /* val */ - TK_M_RESULT, /* val */ + TK_M_TEST, /* val, mode_t */ + TK_M_EVENT_TIMEOUT, /* int */ + TK_M_PROGRAM, /* val */ + TK_M_IMPORT_FILE, /* val */ + TK_M_IMPORT_PROG, /* val */ + TK_M_IMPORT_BUILTIN, /* val */ + TK_M_IMPORT_DB, /* val */ + TK_M_IMPORT_CMDLINE, /* val */ + TK_M_IMPORT_PARENT, /* val */ + TK_M_RESULT, /* val */ TK_M_MAX, TK_A_STRING_ESCAPE_NONE, TK_A_STRING_ESCAPE_REPLACE, TK_A_DB_PERSIST, - TK_A_INOTIFY_WATCH, /* int */ - TK_A_DEVLINK_PRIO, /* int */ - TK_A_OWNER, /* val */ - TK_A_GROUP, /* val */ - TK_A_MODE, /* val */ - TK_A_OWNER_ID, /* uid_t */ - TK_A_GROUP_ID, /* gid_t */ - TK_A_MODE_ID, /* mode_t */ - TK_A_STATIC_NODE, /* val */ - TK_A_ENV, /* val, attr */ - TK_A_TAG, /* val */ - TK_A_NAME, /* val */ - TK_A_DEVLINK, /* val */ - TK_A_ATTR, /* val, attr */ - TK_A_RUN, /* val, bool */ - TK_A_GOTO, /* size_t */ + TK_A_INOTIFY_WATCH, /* int */ + TK_A_DEVLINK_PRIO, /* int */ + TK_A_OWNER, /* val */ + TK_A_GROUP, /* val */ + TK_A_MODE, /* val */ + TK_A_OWNER_ID, /* uid_t */ + TK_A_GROUP_ID, /* gid_t */ + TK_A_MODE_ID, /* mode_t */ + TK_A_STATIC_NODE, /* val */ + TK_A_ENV, /* val, attr */ + TK_A_TAG, /* val */ + TK_A_NAME, /* val */ + TK_A_DEVLINK, /* val */ + TK_A_ATTR, /* val, attr */ + TK_A_RUN, /* val, bool */ + TK_A_GOTO, /* size_t */ TK_END, }; @@ -223,14 +223,14 @@ struct rule_tmp { static const char *operation_str(enum operation_type type) { static const char *operation_strs[] = { - [OP_UNSET] = "UNSET", - [OP_MATCH] = "match", - [OP_NOMATCH] = "nomatch", + [OP_UNSET] = "UNSET", + [OP_MATCH] = "match", + [OP_NOMATCH] = "nomatch", [OP_MATCH_MAX] = "MATCH_MAX", - [OP_ADD] = "add", - [OP_ASSIGN] = "assign", - [OP_ASSIGN_FINAL] = "assign-final", + [OP_ADD] = "add", + [OP_ASSIGN] = "assign", + [OP_ASSIGN_FINAL] = "assign-final", } ; return operation_strs[type]; @@ -239,12 +239,12 @@ static const char *operation_str(enum operation_type type) static const char *string_glob_str(enum string_glob_type type) { static const char *string_glob_strs[] = { - [GL_UNSET] = "UNSET", - [GL_PLAIN] = "plain", - [GL_GLOB] = "glob", - [GL_SPLIT] = "split", - [GL_SPLIT_GLOB] = "split-glob", - [GL_SOMETHING] = "split-glob", + [GL_UNSET] = "UNSET", + [GL_PLAIN] = "plain", + [GL_GLOB] = "glob", + [GL_SPLIT] = "split", + [GL_SPLIT_GLOB] = "split-glob", + [GL_SOMETHING] = "split-glob", }; return string_glob_strs[type]; @@ -253,62 +253,62 @@ static const char *string_glob_str(enum string_glob_type type) static const char *token_str(enum token_type type) { static const char *token_strs[] = { - [TK_UNSET] = "UNSET", - [TK_RULE] = "RULE", + [TK_UNSET] = "UNSET", + [TK_RULE] = "RULE", - [TK_M_ACTION] = "M ACTION", + [TK_M_ACTION] = "M ACTION", [TK_M_DEVPATH] = "M DEVPATH", - [TK_M_KERNEL] = "M KERNEL", + [TK_M_KERNEL] = "M KERNEL", [TK_M_DEVLINK] = "M DEVLINK", - [TK_M_NAME] = "M NAME", - [TK_M_ENV] = "M ENV", - [TK_M_TAG] = "M TAG", - [TK_M_SUBSYSTEM] = "M SUBSYSTEM", - [TK_M_DRIVER] = "M DRIVER", + [TK_M_NAME] = "M NAME", + [TK_M_ENV] = "M ENV", + [TK_M_TAG] = "M TAG", + [TK_M_SUBSYSTEM] = "M SUBSYSTEM", + [TK_M_DRIVER] = "M DRIVER", [TK_M_WAITFOR] = "M WAITFOR", - [TK_M_ATTR] = "M ATTR", + [TK_M_ATTR] = "M ATTR", - [TK_M_PARENTS_MIN] = "M PARENTS_MIN", + [TK_M_PARENTS_MIN] = "M PARENTS_MIN", [TK_M_KERNELS] = "M KERNELS", - [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", + [TK_M_SUBSYSTEMS] = "M SUBSYSTEMS", [TK_M_DRIVERS] = "M DRIVERS", - [TK_M_ATTRS] = "M ATTRS", - [TK_M_TAGS] = "M TAGS", - [TK_M_PARENTS_MAX] = "M PARENTS_MAX", + [TK_M_ATTRS] = "M ATTRS", + [TK_M_TAGS] = "M TAGS", + [TK_M_PARENTS_MAX] = "M PARENTS_MAX", - [TK_M_TEST] = "M TEST", - [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", + [TK_M_TEST] = "M TEST", + [TK_M_EVENT_TIMEOUT] = "M EVENT_TIMEOUT", [TK_M_PROGRAM] = "M PROGRAM", - [TK_M_IMPORT_FILE] = "M IMPORT_FILE", - [TK_M_IMPORT_PROG] = "M IMPORT_PROG", - [TK_M_IMPORT_BUILTIN] = "M IMPORT_BUILTIN", - [TK_M_IMPORT_DB] = "M IMPORT_DB", - [TK_M_IMPORT_CMDLINE] = "M IMPORT_CMDLINE", - [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", - [TK_M_RESULT] = "M RESULT", - [TK_M_MAX] = "M MAX", - - [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", - [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", - [TK_A_DB_PERSIST] = "A DB_PERSIST", - [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", - [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", - [TK_A_OWNER] = "A OWNER", - [TK_A_GROUP] = "A GROUP", - [TK_A_MODE] = "A MODE", - [TK_A_OWNER_ID] = "A OWNER_ID", - [TK_A_GROUP_ID] = "A GROUP_ID", - [TK_A_STATIC_NODE] = "A STATIC_NODE", + [TK_M_IMPORT_FILE] = "M IMPORT_FILE", + [TK_M_IMPORT_PROG] = "M IMPORT_PROG", + [TK_M_IMPORT_BUILTIN] = "M IMPORT_BUILTIN", + [TK_M_IMPORT_DB] = "M IMPORT_DB", + [TK_M_IMPORT_CMDLINE] = "M IMPORT_CMDLINE", + [TK_M_IMPORT_PARENT] = "M IMPORT_PARENT", + [TK_M_RESULT] = "M RESULT", + [TK_M_MAX] = "M MAX", + + [TK_A_STRING_ESCAPE_NONE] = "A STRING_ESCAPE_NONE", + [TK_A_STRING_ESCAPE_REPLACE] = "A STRING_ESCAPE_REPLACE", + [TK_A_DB_PERSIST] = "A DB_PERSIST", + [TK_A_INOTIFY_WATCH] = "A INOTIFY_WATCH", + [TK_A_DEVLINK_PRIO] = "A DEVLINK_PRIO", + [TK_A_OWNER] = "A OWNER", + [TK_A_GROUP] = "A GROUP", + [TK_A_MODE] = "A MODE", + [TK_A_OWNER_ID] = "A OWNER_ID", + [TK_A_GROUP_ID] = "A GROUP_ID", + [TK_A_STATIC_NODE] = "A STATIC_NODE", [TK_A_MODE_ID] = "A MODE_ID", - [TK_A_ENV] = "A ENV", - [TK_A_TAG] = "A ENV", - [TK_A_NAME] = "A NAME", + [TK_A_ENV] = "A ENV", + [TK_A_TAG] = "A ENV", + [TK_A_NAME] = "A NAME", [TK_A_DEVLINK] = "A DEVLINK", - [TK_A_ATTR] = "A ATTR", - [TK_A_RUN] = "A RUN", - [TK_A_GOTO] = "A GOTO", + [TK_A_ATTR] = "A ATTR", + [TK_A_RUN] = "A RUN", + [TK_A_GOTO] = "A GOTO", - [TK_END] = "END", + [TK_END] = "END", }; return token_strs[type]; -- cgit v1.2.3-54-g00ecf From b0a00806770a7443d1710d58190a65b4f9f4f60e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Jan 2012 04:44:35 +0100 Subject: use devnode() for $name not sysname(), device nodes might be in a subdirectory --- src/udev-event.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/udev-event.c b/src/udev-event.c index f0b9548f3d..227c186236 100644 --- a/src/udev-event.c +++ b/src/udev-event.c @@ -346,15 +346,18 @@ subst: if (udev_device_get_devnode(dev) != NULL) l = util_strpcpy(&s, l, udev_device_get_devnode(dev)); break; - case SUBST_NAME: + case SUBST_NAME: { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + if (event->name != NULL) { l = util_strpcpy(&s, l, event->name); - dbg(event->udev, "substitute name '%s'\n", event->name); + dbg(event->udev, "substitute custom name '%s'\n", event->name); } else { - l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); - dbg(event->udev, "substitute sysname '%s'\n", udev_device_get_sysname(dev)); + l = util_strpcpy(&s, l, &udev_device_get_devnode(dev)[devlen]); + dbg(event->udev, "substitute name'%s'\n", &udev_device_get_devnode(dev)[devlen]); } break; + } case SUBST_LINKS: { size_t devlen = strlen(udev_get_dev_path(event->udev))+1; struct udev_list_entry *list_entry; @@ -928,7 +931,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, } } - if (major(udev_device_get_devnum(dev)) != 0) { + if (major(udev_device_get_devnum(dev)) > 0) { /* remove/update possible left-over symlinks from old database entry */ if (event->dev_db != NULL) udev_node_update_old_links(dev, event->dev_db); -- cgit v1.2.3-54-g00ecf From 0ecfcbd4f758f9ff10926156eb8c7a7542650627 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Jan 2012 05:00:59 +0100 Subject: print warning when rules try to rename kernel device nodes --- src/udev-rules.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/udev-rules.c b/src/udev-rules.c index 8efc498f75..a5b4b7306a 100644 --- a/src/udev-rules.c +++ b/src/udev-rules.c @@ -2546,6 +2546,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event } case TK_A_NAME: { const char *name = &rules->buf[cur->key.value_off]; + char name_str[UTIL_PATH_SIZE]; int count; @@ -2559,6 +2560,16 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (count > 0) info(event->udev, "%i character(s) replaced\n", count); } + if (major(udev_device_get_devnum(event->dev))) { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + + if (strcmp(name_str, &udev_device_get_devnode(event->dev)[devlen]) != 0) { + err(event->udev, "NAME=\"%s\" ignored, kernel device nodes " + "can not be renamed; please fix it in %s:%u\n", name, + &rules->buf[rule->rule.filename_off], rule->rule.filename_line); + break; + } + } free(event->name); event->name = strdup(name_str); info(event->udev, "NAME '%s' %s:%u\n", -- cgit v1.2.3-54-g00ecf From a7ef118174332ae98cb80763b0dfb97823e6a395 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Jan 2012 05:21:13 +0100 Subject: move variable inside condition --- src/udev-event.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/udev-event.c b/src/udev-event.c index 227c186236..0b6db30eda 100644 --- a/src/udev-event.c +++ b/src/udev-event.c @@ -347,12 +347,12 @@ subst: l = util_strpcpy(&s, l, udev_device_get_devnode(dev)); break; case SUBST_NAME: { - size_t devlen = strlen(udev_get_dev_path(event->udev))+1; - if (event->name != NULL) { l = util_strpcpy(&s, l, event->name); dbg(event->udev, "substitute custom name '%s'\n", event->name); } else { + size_t devlen = strlen(udev_get_dev_path(event->udev))+1; + l = util_strpcpy(&s, l, &udev_device_get_devnode(dev)[devlen]); dbg(event->udev, "substitute name'%s'\n", &udev_device_get_devnode(dev)[devlen]); } -- cgit v1.2.3-54-g00ecf From 385ff54383a97189b396c7ffb9fc91403e6f21c8 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 23 Jan 2012 16:15:20 +0100 Subject: update TODO --- TODO | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index 22a067a4e9..36e8440e8b 100644 --- a/TODO +++ b/TODO @@ -1,16 +1,15 @@ + - find a way to tell udev to not cancel firmware + requests in initramfs + - move /lib/udev/devices/ to tmpfiles - trigger --subsystem-match=usb/usb_device - - test (now fixed) /dev/tape/ links - - kill rules_generator - - kill tabs? - - have a $attrs{} ? - - deprecate and warn about RUN+="socket:" + - remove RUN+="socket:" - libudev.so.1 - symbol versioning -- cgit v1.2.3-54-g00ecf From e483478115bce95af6feb2a6174f8308f3f02b7d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Jan 2012 03:20:46 +0100 Subject: build-sys: enable everything for 'make distcheck' --- Makefile.am | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile.am b/Makefile.am index a5cc2e147f..0048f2b63d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,6 +26,12 @@ AM_LDFLAGS = \ -Wl,--as-needed DISTCHECK_CONFIGURE_FLAGS = \ + --enable-debug \ + --enable-rule_generator \ + --enable-udev_acl \ + --enable-floppy \ + --enable-edd \ + --with-selinux \ --enable-gtk-doc \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) -- cgit v1.2.3-54-g00ecf From e605cf7782fdf1dc2e13b95e906e731d61e6cf12 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Jan 2012 04:29:59 +0100 Subject: use sysname() for devices without a device node --- src/udev-event.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/udev-event.c b/src/udev-event.c index 0b6db30eda..7ecaf85536 100644 --- a/src/udev-event.c +++ b/src/udev-event.c @@ -349,12 +349,15 @@ subst: case SUBST_NAME: { if (event->name != NULL) { l = util_strpcpy(&s, l, event->name); - dbg(event->udev, "substitute custom name '%s'\n", event->name); - } else { + dbg(event->udev, "substitute custom node name '%s'\n", event->name); + } else if (udev_device_get_devnode(dev) != NULL) { size_t devlen = strlen(udev_get_dev_path(event->udev))+1; l = util_strpcpy(&s, l, &udev_device_get_devnode(dev)[devlen]); - dbg(event->udev, "substitute name'%s'\n", &udev_device_get_devnode(dev)[devlen]); + dbg(event->udev, "substitute node name'%s'\n", &udev_device_get_devnode(dev)[devlen]); + } else { + l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); + dbg(event->udev, "substitute device name'%s'\n", udev_device_get_sysname(dev)); } break; } -- cgit v1.2.3-54-g00ecf From 9c4eda12605c5e562002a63e83ddf06bfbf48988 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 24 Jan 2012 15:12:46 +0100 Subject: fix path to extras --- rules/misc/30-kernel-compat.rules | 2 +- src/extras/keymap/check-keymaps.sh | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rules/misc/30-kernel-compat.rules b/rules/misc/30-kernel-compat.rules index 7240f9b234..cddf371d3b 100644 --- a/rules/misc/30-kernel-compat.rules +++ b/rules/misc/30-kernel-compat.rules @@ -7,7 +7,7 @@ ACTION!="add", GOTO="kernel_compat_end" -# see extras/qemu/42-qemu-usb.rules, version for 2.6.32 + older. +# see src/extras/qemu/42-qemu-usb.rules, version for 2.6.32 + older. ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" diff --git a/src/extras/keymap/check-keymaps.sh b/src/extras/keymap/check-keymaps.sh index f81b6aac36..423699b5a8 100755 --- a/src/extras/keymap/check-keymaps.sh +++ b/src/extras/keymap/check-keymaps.sh @@ -1,11 +1,11 @@ -#!/usr/bin/env bash +#!/bin/bash # check that all key names in keymaps/* are known in # and that all key maps listed in the rules are valid and present in # Makefile.am SRCDIR=${1:-.} KEYLIST=${2:-src/extras/keymap/keys.txt} -KEYMAPS_DIR=$SRCDIR/src/extras/keymap/keymaps #extras/keymap/keymaps +KEYMAPS_DIR=$SRCDIR/src/extras/keymap/keymaps RULES=$SRCDIR/src/extras/keymap/95-keymap.rules [ -e "$KEYLIST" ] || { @@ -16,7 +16,7 @@ RULES=$SRCDIR/src/extras/keymap/95-keymap.rules missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) \ <(grep -hv '^#' ${KEYMAPS_DIR}/*| awk '{print $2}' | sort -u)) [ -z "$missing" ] || { - echo "ERROR: unknown key names in extras/keymap/keymaps/*:" >&2 + echo "ERROR: unknown key names in src/extras/keymap/keymaps/*:" >&2 echo "$missing" >&2 exit 1 } @@ -31,7 +31,7 @@ for m in $maps; do echo "ERROR: unknown map name in $RULES: $m" >&2 exit 1 } - grep -q "extras/keymap/keymaps/$m\>" $SRCDIR/Makefile.am || { + grep -q "src/extras/keymap/keymaps/$m\>" $SRCDIR/Makefile.am || { echo "ERROR: map file $m is not added to Makefile.am" >&2 exit 1 } -- cgit v1.2.3-54-g00ecf From 9c158222917e90363aa5d89084161b392941dc88 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jan 2012 00:01:24 +0100 Subject: release 179 --- ChangeLog | 14 ++++++++++++++ NEWS | 4 ++++ configure.ac | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index b561b7a5e4..da2eae6a48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +Summary of changes from v178 to v179 +============================================ + +Kay Sievers (8): + fix some fallout from tab removal + use devnode() for $name not sysname(), device nodes might be in a subdirectory + print warning when rules try to rename kernel device nodes + move variable inside condition + update TODO + build-sys: enable everything for 'make distcheck' + use sysname() for devices without a device node + fix path to extras + + Summary of changes from v177 to v178 ============================================ diff --git a/NEWS b/NEWS index a0ed539454..fa1edff696 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +udev 179 +======== +Bugfix for $name resolution, which broke at least some keymap handling. + udev 178 ======== Bugfix for the firmware loading behavior with kernel modules which diff --git a/configure.ac b/configure.ac index ceaeeb8f8f..3f33c14da0 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [178], + [179], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From 3163ddd40d81cf29a114d73c585b65635256ae65 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jan 2012 00:11:21 +0100 Subject: Makefile: update kernel.org hooks --- Makefile.am | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0048f2b63d..f94eb58e96 100644 --- a/Makefile.am +++ b/Makefile.am @@ -769,11 +769,9 @@ git-sync: git push git push --tags -tar: - make distcheck - xz -d -c udev-$(VERSION).tar.xz | gpg --armor --detach-sign --output udev-$(VERSION).tar.sign - tar-sync: + rm -f udev-$(VERSION).tar.sign + xz -d -c udev-$(VERSION).tar.xz | gpg --armor --detach-sign --output udev-$(VERSION).tar.sign kup put udev-$(VERSION).tar.xz udev-$(VERSION).tar.sign /pub/linux/utils/kernel/hotplug/ doc-sync: -- cgit v1.2.3-54-g00ecf From 6528a3938fe8727b99b210cf504a335d07c94c37 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 25 Jan 2012 16:54:24 +0100 Subject: build-sys: we need to install shipped man pages without xsltproc installed --- Makefile.am | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index f94eb58e96..1de4b27af0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -266,7 +266,6 @@ src_udevadm_CFLAGS = $(udev_common_CFLAGS) src_udevadm_LDADD = $(udev_common_LDADD) src_udevadm_CPPFLAGS = $(udev_common_CPPFLAGS) -if HAVE_XSLTPROC # ------------------------------------------------------------------------------ # udev man pages # ------------------------------------------------------------------------------ @@ -275,16 +274,17 @@ dist_man_MANS += \ src/udevadm.8 \ src/udevd.8 -dist_noinst_DATA = \ - src/udev.html \ - src/udevadm.html \ - src/udevd.html - EXTRA_DIST += \ src/udev.xml \ src/udevadm.xml \ src/udevd.xml +if HAVE_XSLTPROC +dist_noinst_DATA = \ + src/udev.html \ + src/udevadm.html \ + src/udevd.html + src/%.7 src/%.8 : src/%.xml $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< -- cgit v1.2.3-54-g00ecf From a3642381eba4697b567cf4f21145532866c2e369 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 26 Jan 2012 17:56:18 +0100 Subject: builtin: blkid - add missing ID_ prefix for PART_ENTRY_* keys --- src/udev-builtin-blkid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/udev-builtin-blkid.c b/src/udev-builtin-blkid.c index ea526a425e..e57f03e5a1 100644 --- a/src/udev-builtin-blkid.c +++ b/src/udev-builtin-blkid.c @@ -77,7 +77,7 @@ static void print_property(struct udev_device *dev, bool test, const char *name, } else if (!strncmp(name, "PART_ENTRY_", 11)) { util_strscpyl(s, sizeof(s), "ID_", name, NULL); - udev_builtin_add_property(dev, test, name, value); + udev_builtin_add_property(dev, test, s, value); } } -- cgit v1.2.3-54-g00ecf From e7f32890335886cfa0f2f835413aed5af8ac2b53 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 29 Jan 2012 05:37:39 +0100 Subject: do not stop rule processing when device node is no longer around Device nodes might have been deleted again by the kernel before an 'add' or 'change' event is even started. We need to run all rules, regardless of the state in /dev. --- NEWS | 12 ++++++++++++ src/udev-event.c | 4 ++-- src/udev-node.c | 14 ++++---------- src/udev.h | 4 ++-- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/NEWS b/NEWS index fa1edff696..281ed40569 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,15 @@ +udev 180 +======== +Fix for ID_PART_ENTRY_* property names, added by the blkid built-in. The +fix is needed for udisk2 to operate properly. + +Fix for skipped rule execution when the kernel has removed the device +node in /dev again, before the event was even started. The fix is needed +to run device-mapper/LVM events properly. + +Fix for the man page installation, which was skipped when xsltproc was not +installed. + udev 179 ======== Bugfix for $name resolution, which broke at least some keymap handling. diff --git a/src/udev-event.c b/src/udev-event.c index 7ecaf85536..45dd77ba2e 100644 --- a/src/udev-event.c +++ b/src/udev-event.c @@ -894,7 +894,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, udev_rules_apply_to_event(rules, event, sigmask); if (major(udev_device_get_devnum(dev)) != 0) - err = udev_node_remove(dev); + udev_node_remove(dev); } else { event->dev_db = udev_device_new_from_syspath(event->udev, udev_device_get_syspath(dev)); if (event->dev_db != NULL) { @@ -952,7 +952,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, } } - err = udev_node_add(dev, event->mode, event->uid, event->gid); + udev_node_add(dev, event->mode, event->uid, event->gid); } /* preserve old, or get new initialization timestamp */ diff --git a/src/udev-node.c b/src/udev-node.c index 8d7db7101b..7a01a479ee 100644 --- a/src/udev-node.c +++ b/src/udev-node.c @@ -327,7 +327,7 @@ out: return err; } -int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) +void udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) { struct udev *udev = udev_device_get_udev(dev); char filename[UTIL_PATH_SIZE]; @@ -337,9 +337,8 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) info(udev, "handling device node '%s', devnum=%s, mode=%#o, uid=%d, gid=%d\n", udev_device_get_devnode(dev), udev_device_get_id_filename(dev), mode, uid, gid); - err = node_fixup(dev, mode, uid, gid); - if (err < 0) - goto exit; + if (node_fixup(dev, mode, uid, gid) < 0) + return; /* always add /dev/{block,char}/$major:$minor */ snprintf(filename, sizeof(filename), "%s/%s/%u:%u", @@ -356,11 +355,9 @@ int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid) else link_update(dev, udev_list_entry_get_name(list_entry), 1); } -exit: - return err; } -int udev_node_remove(struct udev_device *dev) +void udev_node_remove(struct udev_device *dev) { struct udev *udev = udev_device_get_udev(dev); struct udev_list_entry *list_entry; @@ -368,7 +365,6 @@ int udev_node_remove(struct udev_device *dev) struct stat stats; struct udev_device *dev_check; char filename[UTIL_PATH_SIZE]; - int err = 0; /* remove/update symlinks, remove symlinks from name index */ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) @@ -380,6 +376,4 @@ int udev_node_remove(struct udev_device *dev) strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); unlink(filename); -out: - return err; } diff --git a/src/udev.h b/src/udev.h index 9ed6804fe7..bc051c9b65 100644 --- a/src/udev.h +++ b/src/udev.h @@ -89,8 +89,8 @@ void udev_watch_end(struct udev *udev, struct udev_device *dev); struct udev_device *udev_watch_lookup(struct udev *udev, int wd); /* udev-node.c */ -int udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); -int udev_node_remove(struct udev_device *dev); +void udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid); +void udev_node_remove(struct udev_device *dev); void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev_old); /* udev-ctrl.c */ -- cgit v1.2.3-54-g00ecf From f13289ffdf077f75c8710e977ffe538b66885762 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 29 Jan 2012 05:53:06 +0100 Subject: release 180 --- ChangeLog | 10 ++++++++++ configure.ac | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index da2eae6a48..15bab064b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Summary of changes from v179 to v180 +============================================ + +Kay Sievers (4): + Makefile: update kernel.org hooks + build-sys: we need to install shipped man pages without xsltproc installed + builtin: blkid - add missing ID_ prefix for PART_ENTRY_* keys + do not stop rule processing when device node is no longer around + + Summary of changes from v178 to v179 ============================================ diff --git a/configure.ac b/configure.ac index 3f33c14da0..9772d82c30 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [179], + [180], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From 46d4274bb09a94e1be18e50aac701135d9a1eb6d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 30 Jan 2012 14:53:28 +0100 Subject: configure: show ROOTPREFIX in firmware path option help text --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 9772d82c30..6038f26ce1 100644 --- a/configure.ac +++ b/configure.ac @@ -95,7 +95,7 @@ AS_IF([test "x$enable_logging" = "xyes"], [ AC_DEFINE(ENABLE_LOGGING, [1], [Syst AC_ARG_WITH(firmware-path, AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], - [Firmware search path (default=/lib/firmware/updates:/lib/firmware)]), + [Firmware search path (default=ROOTPREFIX/lib/firmware/updates:ROOTPREFIX/lib/firmware)]), [], [with_firmware_path="$rootprefix/lib/firmware/updates:$rootprefix/lib/firmware"]) OLD_IFS=$IFS IFS=: -- cgit v1.2.3-54-g00ecf From 19b66dc57cce27175ff421c4c3a37e4a491b9c01 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 30 Jan 2012 15:08:45 +0100 Subject: extras: cdrom_id - create /dev/cdrom and conditionally /dev/dvd for sr0 Udev does no longer automatically create udev rules in /etc from the device hotplug path. No device name reservation will happen anymore; this model creates too many problems for setups with many device changes or media which is booted on different hardware. Enumerated device names which are based on device discovery order or on persistent on-disk name reservation will in general not be supported by udev in the future. It is a problem that can not be solved properly, and it always creates new problems at the same time it tries to solve the original one. Udev will no longer pretend it can solve these issues, and people should switch to available alternatives which provide the far better compromise. From now on, udev will only create /dev/cdrom for the first optical drive, and if the drive is capable /dev/dvd. No other devices will get any compatibility symlinks or enumerated device names like cdrom1, cdrom2, and so on. The /dev/cdrom and /dev/dvd links have by default a negative link priority, which will cause them to be overwritten by any other device which clains the same names with already existing udev rules. If stable device names are needed, the /dev/disk/by-id/ links, which uniquely identify a specific piece of hardware should be used. The links usually contain a device serial number and the link names will not depend on device discovery order. If completely identical devices with identical or no serial number need to be handled at the same time, the /dev/disk/by-path/ links can be used. These links depend on the physical port which is used to connect the device. It will change when the same device is moved to a different port or host adapter. If custom names are needed, custom udev rules which match on specific device properties need to be added by the administrator. --- src/extras/cdrom_id/60-cdrom_id.rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/extras/cdrom_id/60-cdrom_id.rules b/src/extras/cdrom_id/60-cdrom_id.rules index 353f522b0b..25e049a2f5 100644 --- a/src/extras/cdrom_id/60-cdrom_id.rules +++ b/src/extras/cdrom_id/60-cdrom_id.rules @@ -15,4 +15,7 @@ ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdr # enable the receiving of media eject button events IMPORT{program}="cdrom_id --lock-media $devnode" +KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100" +KERNEL=="sr0", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd", OPTIONS+="link_priority=-100" + LABEL="cdrom_end" -- cgit v1.2.3-54-g00ecf From 927f3bc4689d06f22843d2635377c3c1cfca1ba0 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 30 Jan 2012 19:03:05 +0100 Subject: extras: cdrom_id - create only /dev/cdrom --- src/extras/cdrom_id/60-cdrom_id.rules | 1 - 1 file changed, 1 deletion(-) diff --git a/src/extras/cdrom_id/60-cdrom_id.rules b/src/extras/cdrom_id/60-cdrom_id.rules index 25e049a2f5..6eaf76a72c 100644 --- a/src/extras/cdrom_id/60-cdrom_id.rules +++ b/src/extras/cdrom_id/60-cdrom_id.rules @@ -16,6 +16,5 @@ ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdr IMPORT{program}="cdrom_id --lock-media $devnode" KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100" -KERNEL=="sr0", ENV{ID_CDROM_DVD}=="1", SYMLINK+="dvd", OPTIONS+="link_priority=-100" LABEL="cdrom_end" -- cgit v1.2.3-54-g00ecf From 705b2a87ccbe2a1b0a89d7d5947a5ce270531342 Mon Sep 17 00:00:00 2001 From: "James M. Leddy" Date: Wed, 1 Feb 2012 05:48:58 +0100 Subject: keymap: Fix touchpad toggle button on Lenovo Ideapad https://launchpad.net/bugs/922405 Signed-off-by: Martin Pitt --- src/extras/keymap/keymaps/lenovo-ideapad | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/extras/keymap/keymaps/lenovo-ideapad b/src/extras/keymap/keymaps/lenovo-ideapad index 9ab02ba332..fc339839f2 100644 --- a/src/extras/keymap/keymaps/lenovo-ideapad +++ b/src/extras/keymap/keymaps/lenovo-ideapad @@ -4,4 +4,5 @@ 0xB9 brightnessup # does nothing in BIOS 0xBA brightnessdown # does nothing in BIOS 0xF1 camera # BIOS toggles camera power -0xf2 unknown # trackpad enable/disable (does nothing in BIOS) +0xf2 f21 # touchpad toggle (key alternately emits f2 and f3) +0xf3 f21 -- cgit v1.2.3-54-g00ecf From 09db3f5b66266cb808acfa26d082528ca6e50e4e Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 1 Feb 2012 12:45:50 +0100 Subject: ata_id: whitespace fixes --- src/extras/ata_id/ata_id.c | 68 +++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/src/extras/ata_id/ata_id.c b/src/extras/ata_id/ata_id.c index 924d479c1d..7c3be71a30 100644 --- a/src/extras/ata_id/ata_id.c +++ b/src/extras/ata_id/ata_id.c @@ -294,17 +294,17 @@ static int disk_identify_packet_device_command(int fd, * * Copies the ATA string from @identify located at @offset_words into @dest. */ -static void disk_identify_get_string (uint8_t identify[512], - unsigned int offset_words, - char *dest, - size_t dest_len) +static void disk_identify_get_string(uint8_t identify[512], + unsigned int offset_words, + char *dest, + size_t dest_len) { unsigned int c1; unsigned int c2; - assert (identify != NULL); - assert (dest != NULL); - assert ((dest_len & 1) == 0); + assert(identify != NULL); + assert(dest != NULL); + assert((dest_len & 1) == 0); while (dest_len > 0) { c1 = ((uint16_t *) identify)[offset_words] >> 8; @@ -318,9 +318,9 @@ static void disk_identify_get_string (uint8_t identify[512], } } -static void disk_identify_fixup_string (uint8_t identify[512], - unsigned int offset_words, - size_t len) +static void disk_identify_fixup_string(uint8_t identify[512], + unsigned int offset_words, + size_t len) { disk_identify_get_string(identify, offset_words, (char *) identify + offset_words * 2, len); @@ -351,10 +351,10 @@ static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offs * Returns: 0 if the data was successfully obtained, otherwise * non-zero with errno set. */ -static int disk_identify (struct udev *udev, - int fd, - uint8_t out_identify[512], - int *out_is_packet_device) +static int disk_identify(struct udev *udev, + int fd, + uint8_t out_identify[512], + int *out_is_packet_device) { int ret; uint8_t inquiry_buf[36]; @@ -363,11 +363,11 @@ static int disk_identify (struct udev *udev, int n; int is_packet_device; - assert (out_identify != NULL); + assert(out_identify != NULL); /* init results */ ret = -1; - memset (out_identify, '\0', 512); + memset(out_identify, '\0', 512); is_packet_device = 0; /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device @@ -510,24 +510,24 @@ int main(int argc, char *argv[]) * fix up only the fields from the IDENTIFY data that we are going to * use and copy it into the hd_driveid struct for convenience */ - disk_identify_fixup_string (identify, 10, 20); /* serial */ - disk_identify_fixup_string (identify, 23, 6); /* fwrev */ - disk_identify_fixup_string (identify, 27, 40); /* model */ - disk_identify_fixup_uint16 (identify, 0); /* configuration */ - disk_identify_fixup_uint16 (identify, 75); /* queue depth */ - disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ - disk_identify_fixup_uint16 (identify, 82); /* command set supported */ - disk_identify_fixup_uint16 (identify, 83); /* command set supported */ - disk_identify_fixup_uint16 (identify, 84); /* command set supported */ - disk_identify_fixup_uint16 (identify, 85); /* command set supported */ - disk_identify_fixup_uint16 (identify, 86); /* command set supported */ - disk_identify_fixup_uint16 (identify, 87); /* command set supported */ - disk_identify_fixup_uint16 (identify, 89); /* time required for SECURITY ERASE UNIT */ - disk_identify_fixup_uint16 (identify, 90); /* time required for enhanced SECURITY ERASE UNIT */ - disk_identify_fixup_uint16 (identify, 91); /* current APM values */ - disk_identify_fixup_uint16 (identify, 94); /* current AAM value */ - disk_identify_fixup_uint16 (identify, 128); /* device lock function */ - disk_identify_fixup_uint16 (identify, 217); /* nominal media rotation rate */ + disk_identify_fixup_string (identify, 10, 20); /* serial */ + disk_identify_fixup_string (identify, 23, 6); /* fwrev */ + disk_identify_fixup_string (identify, 27, 40); /* model */ + disk_identify_fixup_uint16 (identify, 0); /* configuration */ + disk_identify_fixup_uint16 (identify, 75); /* queue depth */ + disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ + disk_identify_fixup_uint16 (identify, 82); /* command set supported */ + disk_identify_fixup_uint16 (identify, 83); /* command set supported */ + disk_identify_fixup_uint16 (identify, 84); /* command set supported */ + disk_identify_fixup_uint16 (identify, 85); /* command set supported */ + disk_identify_fixup_uint16 (identify, 86); /* command set supported */ + disk_identify_fixup_uint16 (identify, 87); /* command set supported */ + disk_identify_fixup_uint16 (identify, 89); /* time required for SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 90); /* time required for enhanced SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 91); /* current APM values */ + disk_identify_fixup_uint16 (identify, 94); /* current AAM value */ + disk_identify_fixup_uint16 (identify, 128); /* device lock function */ + disk_identify_fixup_uint16 (identify, 217); /* nominal media rotation rate */ memcpy(&id, identify, sizeof id); } else { /* If this fails, then try HDIO_GET_IDENTITY */ -- cgit v1.2.3-54-g00ecf From 2b2823b4b5c41ec629e346cc6dc8407f1d519eb4 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Wed, 1 Feb 2012 12:50:48 +0100 Subject: ata_id: fix identify string fixup --- src/extras/ata_id/ata_id.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extras/ata_id/ata_id.c b/src/extras/ata_id/ata_id.c index 7c3be71a30..257f494496 100644 --- a/src/extras/ata_id/ata_id.c +++ b/src/extras/ata_id/ata_id.c @@ -307,8 +307,8 @@ static void disk_identify_get_string(uint8_t identify[512], assert((dest_len & 1) == 0); while (dest_len > 0) { - c1 = ((uint16_t *) identify)[offset_words] >> 8; - c2 = ((uint16_t *) identify)[offset_words] & 0xff; + c1 = identify[offset_words * 2 + 1]; + c2 = identify[offset_words * 2]; *dest = c1; dest++; *dest = c2; -- cgit v1.2.3-54-g00ecf From 6118dab105dcc91ae7efc038e8c3cb391e702468 Mon Sep 17 00:00:00 2001 From: Bruno Redondi Date: Mon, 6 Feb 2012 09:00:59 +0100 Subject: keymap: Add Fujitsu Siemens Amilo Li 2732 Signed-off-by: Martin Pitt --- Makefile.am | 1 + src/extras/keymap/95-keymap.rules | 1 + src/extras/keymap/keymaps/fujitsu-amilo_li_2732 | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_li_2732 diff --git a/Makefile.am b/Makefile.am index 1de4b27af0..08431f362a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -574,6 +574,7 @@ dist_udevkeymap_DATA = \ src/extras/keymap/keymaps/dell \ src/extras/keymap/keymaps/dell-latitude-xt2 \ src/extras/keymap/keymaps/everex-xt5000 \ + src/extras/keymap/keymaps/fujitsu-amilo_li_2732 \ src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 \ diff --git a/src/extras/keymap/95-keymap.rules b/src/extras/keymap/95-keymap.rules index 69a776ebd9..26de03dcc7 100644 --- a/src/extras/keymap/95-keymap.rules +++ b/src/extras/keymap/95-keymap.rules @@ -121,6 +121,7 @@ ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro Edition V35 ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+="keymap $name fujitsu-amilo_si_1520" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="Amilo Li 1718", RUN+="keymap $name 0xD6 wlan" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO Li 2732", RUN+="keymap $name fujitsu-amilo_li_2732" ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name lg-x110" diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_li_2732 b/src/extras/keymap/keymaps/fujitsu-amilo_li_2732 new file mode 100644 index 0000000000..9b8b36a170 --- /dev/null +++ b/src/extras/keymap/keymaps/fujitsu-amilo_li_2732 @@ -0,0 +1,3 @@ +0xD9 brightnessdown # Fn+F8 brightness down +0xEF brightnessup # Fn+F9 brightness up +0xA9 switchvideomode # Fn+F10 Cycle between available video outputs -- cgit v1.2.3-54-g00ecf From 96b2eef25bb43c62f8d6b914a04fd72d8a968d65 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Mon, 6 Feb 2012 21:47:00 -0200 Subject: builtin: kmod - depend on libkmod >= 5 --- configure.ac | 2 +- src/udev-builtin-kmod.c | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index 6038f26ce1..d9e3f67bbe 100644 --- a/configure.ac +++ b/configure.ac @@ -25,7 +25,7 @@ AC_SEARCH_LIBS([clock_gettime], [rt], [], [AC_MSG_ERROR([POSIX RT library not fo PKG_CHECK_MODULES(BLKID, blkid >= 2.20) -PKG_CHECK_MODULES(KMOD, libkmod >= 3) +PKG_CHECK_MODULES(KMOD, libkmod >= 5) if test "x$cross_compiling" = "xno" ; then AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) diff --git a/src/udev-builtin-kmod.c b/src/udev-builtin-kmod.c index d0a1f28e2f..57e813f863 100644 --- a/src/udev-builtin-kmod.c +++ b/src/udev-builtin-kmod.c @@ -36,7 +36,6 @@ static struct kmod_ctx *ctx; static int load_module(struct udev *udev, const char *alias) { struct kmod_list *list = NULL; - struct kmod_list *listb = NULL; struct kmod_list *l; int err; @@ -44,20 +43,16 @@ static int load_module(struct udev *udev, const char *alias) if (err < 0) return err; - err = kmod_module_get_filtered_blacklist(ctx, list, &listb); - if (err < 0) - return err; - if (list == NULL) info(udev, "no module matches '%s'\n", alias); - else if (listb == NULL) - info(udev, "modules matching '%s' are blacklisted\n", alias); - kmod_list_foreach(l, listb) { + kmod_list_foreach(l, list) { struct kmod_module *mod = kmod_module_get_module(l); - err = kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL); - if (err >=0 ) + err = kmod_module_probe_insert_module(mod, KMOD_PROBE_APPLY_BLACKLIST, NULL, NULL, NULL, NULL); + if (err == KMOD_PROBE_APPLY_BLACKLIST) + info(udev, "module '%s' is blacklisted\n", kmod_module_get_name(mod)); + else if (err == 0) info(udev, "inserted '%s'\n", kmod_module_get_name(mod)); else info(udev, "failed to insert '%s'\n", kmod_module_get_name(mod)); @@ -66,7 +61,6 @@ static int load_module(struct udev *udev, const char *alias) } kmod_module_unref_list(list); - kmod_module_unref_list(listb); return err; } -- cgit v1.2.3-54-g00ecf From 3b2e525a5621784287601573dbf8b55d76cbe407 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 7 Feb 2012 01:58:59 +0100 Subject: release 181 --- ChangeLog | 22 ++++++++++++++++++++++ NEWS | 6 ++++++ autogen.sh | 22 ++++++++++++++++------ configure.ac | 2 +- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 15bab064b2..34a7cfb16f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +Summary of changes from v180 to v181 +============================================ + +Andreas Schwab (1): + ata_id: fix identify string fixup + +Bruno Redondi (1): + keymap: Add Fujitsu Siemens Amilo Li 2732 + +James M. Leddy (1): + keymap: Fix touchpad toggle button on Lenovo Ideapad + +Kay Sievers (4): + configure: show ROOTPREFIX in firmware path option help text + extras: cdrom_id - create /dev/cdrom and conditionally /dev/dvd for sr0 + extras: cdrom_id - create only /dev/cdrom + ata_id: whitespace fixes + +Lucas De Marchi (1): + builtin: kmod - depend on libkmod >= 5 + + Summary of changes from v179 to v180 ============================================ diff --git a/NEWS b/NEWS index 281ed40569..3f0cf80af0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +udev 181 +======== +Require kmod version 5. + +Provide /dev/cdrom symlink for /dev/sr0. + udev 180 ======== Fix for ID_PART_ENTRY_* property names, added by the blkid built-in. The diff --git a/autogen.sh b/autogen.sh index 180e423c4d..55ee03afd1 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,18 +13,28 @@ libdir() { echo $(cd $1/$(gcc -print-multi-os-directory); pwd) } -args="\ +args="$args \ --prefix=/usr \ ---with-rootprefix= \ --sysconfdir=/etc \ ---bindir=/sbin \ --libdir=$(libdir /usr/lib) \ ---with-rootlibdir=$(libdir /lib) \ ---libexecdir=/lib \ ---with-systemdsystemunitdir=/lib/systemd/system \ --with-selinux \ --enable-gtk-doc" +if [ -L /bin ]; then +args="$args \ +--libexecdir=/usr/lib \ +--with-systemdsystemunitdir=/usr/lib/systemd/system \ +" +else +args="$args \ +--with-rootprefix= \ +---with-rootlibdir=$(libdir /lib) \ +--bindir=/sbin \ +--libexecdir=/lib \ +--with-systemdsystemunitdir=/lib/systemd/system \ +" +fi + echo echo "----------------------------------------------------------------" echo "Initialized build system. For a common configuration please run:" diff --git a/configure.ac b/configure.ac index d9e3f67bbe..e7c10d5c6f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [180], + [181], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From c03fcc27b42fa8b9f2504e53e5f49f802c9a634c Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 12 Feb 2012 22:21:08 +0100 Subject: build-sys: unpack test sysfs only for 'make check' --- Makefile.am | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 08431f362a..97ee02f2b8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -312,13 +312,12 @@ src_test_udev_SOURCES = \ src_test_udev_CFLAGS = $(udev_common_CFLAGS) src_test_udev_LDADD = $(udev_common_LDADD) src_test_udev_CPPFLAGS = $(udev_common_CPPFLAGS) +src_test_udev_DEPENDENCIES = test/sys # packed sysfs test tree -test/sys/kernel/uevent_seqnum: +test/sys: $(AM_V_GEN)mkdir -p test && tar -C test/ -xJf $(top_srcdir)/test/sys.tar.xz -BUILT_SOURCES += test/sys/kernel/uevent_seqnum - test-sys-distclean: -rm -rf test/sys DISTCLEAN_LOCAL_HOOKS += test-sys-distclean -- cgit v1.2.3-54-g00ecf From 3840d318011a20960119ff8dff1f67825b2ca0f1 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 12 Feb 2012 23:23:12 +0100 Subject: build-sys: add --disable-manpages --- Makefile.am | 2 + configure.ac | 142 +++++++++++++++++++++++++++++++---------------------------- 2 files changed, 76 insertions(+), 68 deletions(-) diff --git a/Makefile.am b/Makefile.am index 97ee02f2b8..1faa6fe411 100644 --- a/Makefile.am +++ b/Makefile.am @@ -269,10 +269,12 @@ src_udevadm_CPPFLAGS = $(udev_common_CPPFLAGS) # ------------------------------------------------------------------------------ # udev man pages # ------------------------------------------------------------------------------ +if ENABLE_MANPAGES dist_man_MANS += \ src/udev.7 \ src/udevadm.8 \ src/udevd.8 +endif EXTRA_DIST += \ src/udev.xml \ diff --git a/configure.ac b/configure.ac index e7c10d5c6f..a88a34c07d 100644 --- a/configure.ac +++ b/configure.ac @@ -27,37 +27,6 @@ PKG_CHECK_MODULES(BLKID, blkid >= 2.20) PKG_CHECK_MODULES(KMOD, libkmod >= 5) -if test "x$cross_compiling" = "xno" ; then - AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) - AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) - AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) -fi - -AC_ARG_WITH(usb-ids-path, - [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])], - [USB_DATABASE=${withval}], - [if test -n "$usbids" ; then - USB_DATABASE="$usbids" - else - PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) - AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) - fi]) -AC_MSG_CHECKING([for USB database location]) -AC_MSG_RESULT([$USB_DATABASE]) -AC_SUBST(USB_DATABASE) - -AC_ARG_WITH(pci-ids-path, - [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], - [PCI_DATABASE=${withval}], - [if test -n "$pciids" ; then - PCI_DATABASE="$pciids" - else - AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) - fi]) -AC_MSG_CHECKING([for PCI database location]) -AC_MSG_RESULT([$PCI_DATABASE]) -AC_SUBST(PCI_DATABASE) - AC_ARG_WITH([rootprefix], AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and kernel modules]), [], [with_rootprefix=${ac_default_prefix}]) @@ -93,6 +62,42 @@ AC_ARG_ENABLE([logging], [], enable_logging=yes) AS_IF([test "x$enable_logging" = "xyes"], [ AC_DEFINE(ENABLE_LOGGING, [1], [System logging.]) ]) +AC_ARG_ENABLE([manpages], + AS_HELP_STRING([--disable-manpages], [disable man pages @<:@default=enabled@:>@]), + [], enable_manpages=yes) +AM_CONDITIONAL([ENABLE_MANPAGES], [test "x$enable_manpages" = "xyes"]) + +if test "x$cross_compiling" = "xno" ; then + AC_CHECK_FILES([/usr/share/pci.ids], [pciids=/usr/share/pci.ids]) + AC_CHECK_FILES([/usr/share/hwdata/pci.ids], [pciids=/usr/share/hwdata/pci.ids]) + AC_CHECK_FILES([/usr/share/misc/pci.ids], [pciids=/usr/share/misc/pci.ids]) +fi + +AC_ARG_WITH(usb-ids-path, + [AS_HELP_STRING([--with-usb-ids-path=DIR], [Path to usb.ids file])], + [USB_DATABASE=${withval}], + [if test -n "$usbids" ; then + USB_DATABASE="$usbids" + else + PKG_CHECK_MODULES(USBUTILS, usbutils >= 0.82) + AC_SUBST([USB_DATABASE], [$($PKG_CONFIG --variable=usbids usbutils)]) + fi]) +AC_MSG_CHECKING([for USB database location]) +AC_MSG_RESULT([$USB_DATABASE]) +AC_SUBST(USB_DATABASE) + +AC_ARG_WITH(pci-ids-path, + [AS_HELP_STRING([--with-pci-ids-path=DIR], [Path to pci.ids file])], + [PCI_DATABASE=${withval}], + [if test -n "$pciids" ; then + PCI_DATABASE="$pciids" + else + AC_MSG_ERROR([pci.ids not found, try --with-pci-ids-path=]) + fi]) +AC_MSG_CHECKING([for PCI database location]) +AC_MSG_RESULT([$PCI_DATABASE]) +AC_SUBST(PCI_DATABASE) + AC_ARG_WITH(firmware-path, AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]], [Firmware search path (default=ROOTPREFIX/lib/firmware/updates:ROOTPREFIX/lib/firmware)]), @@ -220,41 +225,42 @@ AC_CONFIG_FILES([ AC_OUTPUT AC_MSG_RESULT([ - $PACKAGE $VERSION - ======== - - prefix: ${prefix} - rootprefix: ${rootprefix} - sysconfdir: ${sysconfdir} - bindir: ${bindir} - libdir: ${libdir} - rootlibdir: ${rootlib_execdir} - libexecdir: ${libexecdir} - datarootdir: ${datarootdir} - mandir: ${mandir} - includedir: ${includedir} - include_prefix: ${INCLUDE_PREFIX} - systemdsystemunitdir: ${systemdsystemunitdir} - firmware path: ${FIRMWARE_PATH} - usb.ids: ${USB_DATABASE} - pci.ids: ${PCI_DATABASE} - - compiler: ${CC} - cflags: ${CFLAGS} - ldflags: ${LDFLAGS} - xsltproc: ${XSLTPROC} - gperf: ${GPERF} - - logging: ${enable_logging} - debug: ${enable_debug} - selinux: ${with_selinux} - - gudev: ${enable_gudev} - gintrospection: ${enable_introspection} - keymap: ${enable_keymap} - mtd_probe: ${enable_mtd_probe} - rule_generator: ${enable_rule_generator} - udev_acl: ${enable_udev_acl} - floppy: ${enable_floppy} - edd: ${enable_edd} + $PACKAGE $VERSION + ======== + + prefix: ${prefix} + rootprefix: ${rootprefix} + sysconfdir: ${sysconfdir} + bindir: ${bindir} + libdir: ${libdir} + rootlibdir: ${rootlib_execdir} + libexecdir: ${libexecdir} + datarootdir: ${datarootdir} + mandir: ${mandir} + includedir: ${includedir} + include_prefix: ${INCLUDE_PREFIX} + systemdsystemunitdir: ${systemdsystemunitdir} + firmware path: ${FIRMWARE_PATH} + usb.ids: ${USB_DATABASE} + pci.ids: ${PCI_DATABASE} + + compiler: ${CC} + cflags: ${CFLAGS} + ldflags: ${LDFLAGS} + xsltproc: ${XSLTPROC} + gperf: ${GPERF} + + logging: ${enable_logging} + debug: ${enable_debug} + selinux: ${with_selinux} + + man pages ${enable_manpages} + gudev: ${enable_gudev} + gintrospection: ${enable_introspection} + keymap: ${enable_keymap} + mtd_probe: ${enable_mtd_probe} + rule_generator: ${enable_rule_generator} + udev_acl: ${enable_udev_acl} + floppy: ${enable_floppy} + edd: ${enable_edd} ]) -- cgit v1.2.3-54-g00ecf From a82034ba58f0bce6289fd6e550f1433f97aa74ab Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 14 Feb 2012 14:44:34 +0100 Subject: update sd-daemon files --- src/sd-daemon.c | 4 ++++ src/sd-daemon.h | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/sd-daemon.c b/src/sd-daemon.c index e68b70875c..763e079b4e 100644 --- a/src/sd-daemon.c +++ b/src/sd-daemon.c @@ -32,7 +32,11 @@ #include #include #include +#ifdef __BIONIC__ +#include +#else #include +#endif #include #include #include diff --git a/src/sd-daemon.h b/src/sd-daemon.h index 46dc7fd7e5..fe51159ee6 100644 --- a/src/sd-daemon.h +++ b/src/sd-daemon.h @@ -58,8 +58,8 @@ extern "C" { You may find an up-to-date version of these source files online: - http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.h - http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c + http://cgit.freedesktop.org/systemd/systemd/plain/src/systemd/sd-daemon.h + http://cgit.freedesktop.org/systemd/systemd/plain/src/sd-daemon.c This should compile on non-Linux systems, too, but with the exception of the sd_is_xxx() calls all functions will become NOPs. @@ -217,6 +217,11 @@ int sd_is_mq(int fd, const char *path); MAINPID=... The main pid of a daemon, in case systemd did not fork off the process itself. Example: "MAINPID=4711" + WATCHDOG=1 Tells systemd to update the watchdog timestamp. + Services using this feature should do this in + regular intervals. A watchdog framework can use the + timestamps to detect failed services. + Daemons can choose to send additional variables. However, it is recommended to prefix variable names not listed above with X_. -- cgit v1.2.3-54-g00ecf From 0f52fdee378796df26021208dc684f77be1f877f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 20 Feb 2012 00:41:58 +0100 Subject: test: remove outdated key attributes --- test/rule-syntax-check.py | 2 +- test/udev-test.pl | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py index a94a965a48..ff1b63d075 100755 --- a/test/rule-syntax-check.py +++ b/test/rule-syntax-check.py @@ -27,7 +27,7 @@ if len(sys.argv) < 2: no_args_tests = re.compile('(ACTION|DEVPATH|KERNELS?|NAME|SYMLINK|SUBSYSTEMS?|DRIVERS?|TAG|RESULT|TEST)\s*(?:=|!)=\s*"([^"]*)"$') args_tests = re.compile('(ATTRS?|ENV|TEST){([a-zA-Z0-9/_.*%-]+)}\s*(?:=|!)=\s*"([^"]*)"$') -no_args_assign = re.compile('(NAME|SYMLINK|SYMLINK{unique}|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|RUN{ignore_error}|LABEL|GOTO|WAIT_FOR|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$') +no_args_assign = re.compile('(NAME|SYMLINK|OWNER|GROUP|MODE|TAG|PROGRAM|RUN|LABEL|GOTO|WAIT_FOR|OPTIONS|IMPORT)\s*(?:\+=|:=|=)\s*"([^"]*)"$') args_assign = re.compile('(ATTR|ENV|IMPORT){([a-zA-Z0-9/_.*%-]+)}\s*=\s*"([^"]*)"$') result = 0 diff --git a/test/udev-test.pl b/test/udev-test.pl index 8afd3e4f77..0706c7ad5f 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -44,7 +44,7 @@ EOF devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda", exp_name => "boot_disk" , rules => < < Date: Mon, 20 Feb 2012 01:08:55 +0100 Subject: update TOO --- TODO | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/TODO b/TODO index 36e8440e8b..9133da531d 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,14 @@ - find a way to tell udev to not cancel firmware requests in initramfs + - scsi_id -> sg3_utils? + + - move 'collect' and /dev/z90crypt to s390-utils + + - split-off keymaps? + + - make gtk-doc optional like kmod + - move /lib/udev/devices/ to tmpfiles - trigger --subsystem-match=usb/usb_device -- cgit v1.2.3-54-g00ecf From e000d7c079636428cbd25ca15fc003fb5892642d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Feb 2012 16:22:05 +0100 Subject: builtin: path_id - remove dead cciss code --- TODO | 2 ++ src/udev-builtin-path_id.c | 7 ------- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 9133da531d..00d20145d8 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ + - make "-/usr/bin/foo" non-fail + - find a way to tell udev to not cancel firmware requests in initramfs diff --git a/src/udev-builtin-path_id.c b/src/udev-builtin-path_id.c index fa4d6fb5fd..b18b162755 100644 --- a/src/udev-builtin-path_id.c +++ b/src/udev-builtin-path_id.c @@ -360,11 +360,6 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path) return parent; } -static struct udev_device *handle_cciss(struct udev_device *parent, char **path) -{ - return NULL; -} - static struct udev_device *handle_ccw(struct udev_device *parent, struct udev_device *dev, char **path) { struct udev_device *scsi_dev; @@ -414,8 +409,6 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool handle_scsi_tape(parent, &path); } else if (strcmp(subsys, "scsi") == 0) { parent = handle_scsi(parent, &path); - } else if (strcmp(subsys, "cciss") == 0) { - handle_cciss(parent, &path); } else if (strcmp(subsys, "usb") == 0) { parent = handle_usb(parent, &path); } else if (strcmp(subsys, "serio") == 0) { -- cgit v1.2.3-54-g00ecf From f6ba1a468cea5f7d4a0eee864f400cc23a927eaa Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 23 Feb 2012 16:32:42 +0100 Subject: rules: do not create by-id/scsi-* links for ATA devices --- rules/rules.d/60-persistent-storage.rules | 4 ---- 1 file changed, 4 deletions(-) diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules index b7da8b8bc2..b74821edd4 100644 --- a/rules/rules.d/60-persistent-storage.rules +++ b/rules/rules.d/60-persistent-storage.rules @@ -48,10 +48,6 @@ KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+= KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" -# scsi compat links for ATA devices -KERNEL=="sd*[!0-9]", ENV{ID_BUS}=="ata", PROGRAM="scsi_id --whitelisted --replace-whitespace -p0x80 -d $devnode", RESULT=="?*", ENV{ID_SCSI_COMPAT}="$result", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}" -KERNEL=="sd*[0-9]", ENV{ID_SCSI_COMPAT}=="?*", SYMLINK+="disk/by-id/scsi-$env{ID_SCSI_COMPAT}-part%n" - KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" -- cgit v1.2.3-54-g00ecf From b618e9957b2bd8a4484368620b71ca16fef0c9e6 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 16:34:56 +0100 Subject: remove udev-acl Udev-acl will be part of a future ConsoleKit release. On systemd systems, advanced ConsoleKit and udev-acl functionality are natively provided by systemd. --- Makefile.am | 18 -- NEWS | 7 + configure.ac | 15 -- src/extras/udev-acl/.gitignore | 1 - src/extras/udev-acl/70-udev-acl.rules | 76 ------ src/extras/udev-acl/udev-acl.c | 430 ---------------------------------- 6 files changed, 7 insertions(+), 540 deletions(-) delete mode 100644 src/extras/udev-acl/.gitignore delete mode 100644 src/extras/udev-acl/70-udev-acl.rules delete mode 100644 src/extras/udev-acl/udev-acl.c diff --git a/Makefile.am b/Makefile.am index 1faa6fe411..95cb52cdda 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,6 @@ AM_LDFLAGS = \ DISTCHECK_CONFIGURE_FLAGS = \ --enable-debug \ --enable-rule_generator \ - --enable-udev_acl \ --enable-floppy \ --enable-edd \ --with-selinux \ @@ -676,23 +675,6 @@ dist_udevrules_DATA += \ src/extras/rule_generator/75-persistent-net-generator.rules endif -if ENABLE_UDEV_ACL -# ------------------------------------------------------------------------------ -# udev_acl - apply ACLs for users with local forground sessions -# ------------------------------------------------------------------------------ -src_udev_acl_SOURCES = src/extras/udev-acl/udev-acl.c -src_udev_acl_CPPFLAGS = $(AM_CPPFLAGS) $(GLIB_CFLAGS) -src_udev_acl_LDADD = src/libudev-private.la -lacl $(GLIB_LIBS) -dist_udevrules_DATA += src/extras/udev-acl/70-udev-acl.rules -pkglibexec_PROGRAMS += src/udev-acl - -udevacl-install-hook: - mkdir -p $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d - ln -sf $(libexecdir)/udev/udev-acl $(DESTDIR)$(prefix)/lib/ConsoleKit/run-seat.d/udev-acl.ck - -INSTALL_EXEC_HOOKS += udevacl-install-hook -endif - if ENABLE_FLOPPY # ------------------------------------------------------------------------------ # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) diff --git a/NEWS b/NEWS index 3f0cf80af0..00ee648ca3 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +udev 181 +======== +The udev-acl tool is no longer provided, it will be part of a future +ConsoleKit release. On systemd systems, advanced ConsoleKit and udev-acl +functionality are provided by systemd. + + udev 181 ======== Require kmod version 5. diff --git a/configure.ac b/configure.ac index a88a34c07d..2e750babe8 100644 --- a/configure.ac +++ b/configure.ac @@ -176,20 +176,6 @@ AC_ARG_ENABLE([rule_generator], [], [enable_rule_generator=no]) AM_CONDITIONAL([ENABLE_RULE_GENERATOR], [test "x$enable_rule_generator" = "xyes"]) -# ------------------------------------------------------------------------------ -# udev_acl - apply ACLs for users with local forground sessions -# ------------------------------------------------------------------------------ -AC_ARG_ENABLE([udev_acl], - AS_HELP_STRING([--enable-udev_acl], [enable local user acl permissions support @<:@default=disabled@:>@]), - [], [enable_udev_acl=no]) -AS_IF([test "x$enable_udev_acl" = "xyes"], [ - AC_CHECK_LIB([acl], [acl_init], [:], AC_MSG_ERROR([libacl not found])) - AC_CHECK_HEADER([acl/libacl.h], [:], AC_MSG_ERROR([libacl header not found])) - - PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.22.0 gobject-2.0 >= 2.22.0]) -]) -AM_CONDITIONAL([ENABLE_UDEV_ACL], [test "x$enable_udev_acl" = "xyes"]) - # ------------------------------------------------------------------------------ # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) # ------------------------------------------------------------------------------ @@ -260,7 +246,6 @@ AC_MSG_RESULT([ keymap: ${enable_keymap} mtd_probe: ${enable_mtd_probe} rule_generator: ${enable_rule_generator} - udev_acl: ${enable_udev_acl} floppy: ${enable_floppy} edd: ${enable_edd} ]) diff --git a/src/extras/udev-acl/.gitignore b/src/extras/udev-acl/.gitignore deleted file mode 100644 index 08891fed02..0000000000 --- a/src/extras/udev-acl/.gitignore +++ /dev/null @@ -1 +0,0 @@ -udev-acl diff --git a/src/extras/udev-acl/70-udev-acl.rules b/src/extras/udev-acl/70-udev-acl.rules deleted file mode 100644 index 2dac283101..0000000000 --- a/src/extras/udev-acl/70-udev-acl.rules +++ /dev/null @@ -1,76 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# Do not use TAG+="udev-acl" outside of this file. This variable is private to -# udev-acl of this udev release and may be replaced at any time. - -ENV{MAJOR}=="", GOTO="acl_end" -ACTION=="remove", GOTO="acl_apply" - -# systemd replaces udev-acl entirely, skip if active -TEST=="/sys/fs/cgroup/systemd", TAG=="uaccess", GOTO="acl_end" - -# PTP/MTP protocol devices, cameras, portable media players -SUBSYSTEM=="usb", ENV{ID_USB_INTERFACES}=="*:060101:*", TAG+="udev-acl" - -# digicams with proprietary protocol -ENV{ID_GPHOTO2}=="*?", TAG+="udev-acl" - -# SCSI and USB scanners -ENV{libsane_matched}=="yes", TAG+="udev-acl" - -# HPLIP devices (necessary for ink level check and HP tool maintenance) -ENV{ID_HPLIP}=="1", TAG+="udev-acl" - -# optical drives -SUBSYSTEM=="block", ENV{ID_CDROM}=="1", TAG+="udev-acl" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", TAG+="udev-acl" - -# sound devices -SUBSYSTEM=="sound", TAG+="udev-acl" - -# ffado is an userspace driver for firewire sound cards -SUBSYSTEM=="firewire", ENV{ID_FFADO}=="1", TAG+="udev-acl" - -# webcams, frame grabber, TV cards -SUBSYSTEM=="video4linux", TAG+="udev-acl" -SUBSYSTEM=="dvb", TAG+="udev-acl" - -# IIDC devices: industrial cameras and some webcams -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", TAG+="udev-acl" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", TAG+="udev-acl" -# AV/C devices: camcorders, set-top boxes, TV sets, audio devices, and more -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", TAG+="udev-acl" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", TAG+="udev-acl" - -# DRI video devices -SUBSYSTEM=="drm", KERNEL=="card*", TAG+="udev-acl" - -# KVM -SUBSYSTEM=="misc", KERNEL=="kvm", TAG+="udev-acl" - -# smart-card readers -ENV{ID_SMARTCARD_READER}=="*?", TAG+="udev-acl" - -# PDA devices -ENV{ID_PDA}=="*?", TAG+="udev-acl" - -# Programmable remote control -ENV{ID_REMOTE_CONTROL}=="1", TAG+="udev-acl" - -# joysticks -SUBSYSTEM=="input", ENV{ID_INPUT_JOYSTICK}=="?*", TAG+="udev-acl" - -# color measurement devices -ENV{COLOR_MEASUREMENT_DEVICE}=="*?", TAG+="udev-acl" - -# DDC/CI device, usually high-end monitors such as the DreamColor -ENV{DDC_DEVICE}=="*?", TAG+="udev-acl" - -# media player raw devices (for user-mode drivers, Android SDK, etc.) -SUBSYSTEM=="usb", ENV{ID_MEDIA_PLAYER}=="?*", TAG+="udev-acl" - -# apply ACL for all locally logged in users -LABEL="acl_apply", TAG=="udev-acl", TEST=="/var/run/ConsoleKit/database", \ - RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}" - -LABEL="acl_end" diff --git a/src/extras/udev-acl/udev-acl.c b/src/extras/udev-acl/udev-acl.c deleted file mode 100644 index 628cfbed4e..0000000000 --- a/src/extras/udev-acl/udev-acl.c +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright (C) 2009 Kay Sievers - * - * 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; either version 2 of the - * License, or (at your option) any later version. - * - * 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: - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int debug; - -enum{ - ACTION_NONE = 0, - ACTION_REMOVE, - ACTION_ADD, - ACTION_CHANGE -}; - -static int set_facl(const char* filename, uid_t uid, int add) -{ - int get; - acl_t acl; - acl_entry_t entry = NULL; - acl_entry_t e; - acl_permset_t permset; - int ret; - - /* don't touch ACLs for root */ - if (uid == 0) - return 0; - - /* read current record */ - acl = acl_get_file(filename, ACL_TYPE_ACCESS); - if (!acl) - return -1; - - /* locate ACL_USER entry for uid */ - get = acl_get_entry(acl, ACL_FIRST_ENTRY, &e); - while (get == 1) { - acl_tag_t t; - - acl_get_tag_type(e, &t); - if (t == ACL_USER) { - uid_t *u; - - u = (uid_t*)acl_get_qualifier(e); - if (u == NULL) { - ret = -1; - goto out; - } - if (*u == uid) { - entry = e; - acl_free(u); - break; - } - acl_free(u); - } - - get = acl_get_entry(acl, ACL_NEXT_ENTRY, &e); - } - - /* remove ACL_USER entry for uid */ - if (!add) { - if (entry == NULL) { - ret = 0; - goto out; - } - acl_delete_entry(acl, entry); - goto update; - } - - /* create ACL_USER entry for uid */ - if (entry == NULL) { - ret = acl_create_entry(&acl, &entry); - if (ret != 0) - goto out; - acl_set_tag_type(entry, ACL_USER); - acl_set_qualifier(entry, &uid); - } - - /* add permissions for uid */ - acl_get_permset(entry, &permset); - acl_add_perm(permset, ACL_READ|ACL_WRITE); -update: - /* update record */ - if (debug) - printf("%c%u %s\n", add ? '+' : '-', uid, filename); - acl_calc_mask(&acl); - ret = acl_set_file(filename, ACL_TYPE_ACCESS, acl); - if (ret != 0) - goto out; -out: - acl_free(acl); - return ret; -} - -/* check if a given uid is listed */ -static int uid_in_list(GSList *list, uid_t uid) -{ - GSList *l; - - for (l = list; l != NULL; l = g_slist_next(l)) - if (uid == GPOINTER_TO_UINT(l->data)) - return 1; - return 0; -} - -/* return list of current uids of local active sessions */ -static GSList *uids_with_local_active_session(const char *own_id) -{ - GSList *list = NULL; - GKeyFile *keyfile; - - keyfile = g_key_file_new(); - if (g_key_file_load_from_file(keyfile, "/var/run/ConsoleKit/database", 0, NULL)) { - gchar **groups; - - groups = g_key_file_get_groups(keyfile, NULL); - if (groups != NULL) { - int i; - - for (i = 0; groups[i] != NULL; i++) { - uid_t u; - - if (!g_str_has_prefix(groups[i], "Session ")) - continue; - if (own_id != NULL &&g_str_has_suffix(groups[i], own_id)) - continue; - if (!g_key_file_get_boolean(keyfile, groups[i], "is_local", NULL)) - continue; - if (!g_key_file_get_boolean(keyfile, groups[i], "is_active", NULL)) - continue; - u = g_key_file_get_integer(keyfile, groups[i], "uid", NULL); - if (u > 0 && !uid_in_list(list, u)) - list = g_slist_prepend(list, GUINT_TO_POINTER(u)); - } - g_strfreev(groups); - } - } - g_key_file_free(keyfile); - - return list; -} - -/* ConsoleKit calls us with special variables */ -static int consolekit_called(const char *ck_action, uid_t *uid, uid_t *uid2, const char **remove_session_id, int *action) -{ - int a = ACTION_NONE; - uid_t u = 0; - uid_t u2 = 0; - const char *s; - const char *s2; - const char *old_session = NULL; - - if (ck_action == NULL || strcmp(ck_action, "seat_active_session_changed") != 0) - return -1; - - /* We can have one of: remove, add, change, no-change */ - s = getenv("CK_SEAT_OLD_SESSION_ID"); - s2 = getenv("CK_SEAT_SESSION_ID"); - if (s == NULL && s2 == NULL) { - return -1; - } else if (s2 == NULL) { - a = ACTION_REMOVE; - } else if (s == NULL) { - a = ACTION_ADD; - } else { - a = ACTION_CHANGE; - } - - switch (a) { - case ACTION_ADD: - s = getenv("CK_SEAT_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - - s = getenv("CK_SEAT_SESSION_IS_LOCAL"); - if (s == NULL) - return -1; - if (strcmp(s, "true") != 0) - return 0; - - break; - case ACTION_REMOVE: - s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - - s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); - if (s == NULL) - return -1; - if (strcmp(s, "true") != 0) - return 0; - - old_session = getenv("CK_SEAT_OLD_SESSION_ID"); - if (old_session == NULL) - return -1; - - break; - case ACTION_CHANGE: - s = getenv("CK_SEAT_OLD_SESSION_USER_UID"); - if (s == NULL) - return -1; - u = strtoul(s, NULL, 10); - s = getenv("CK_SEAT_SESSION_USER_UID"); - if (s == NULL) - return -1; - u2 = strtoul(s, NULL, 10); - - s = getenv("CK_SEAT_OLD_SESSION_IS_LOCAL"); - s2 = getenv("CK_SEAT_SESSION_IS_LOCAL"); - if (s == NULL || s2 == NULL) - return -1; - /* don't process non-local session changes */ - if (strcmp(s, "true") != 0 && strcmp(s2, "true") != 0) - return 0; - - if (strcmp(s, "true") == 0 && strcmp(s, "true") == 0) { - /* process the change */ - if (u == u2) { - /* special case: we noop if we are - * changing between local sessions for - * the same uid */ - a = ACTION_NONE; - } - old_session = getenv("CK_SEAT_OLD_SESSION_ID"); - if (old_session == NULL) - return -1; - } else if (strcmp(s, "true") == 0) { - /* only process the removal */ - a = ACTION_REMOVE; - old_session = getenv("CK_SEAT_OLD_SESSION_ID"); - if (old_session == NULL) - return -1; - } else if (strcmp(s2, "true") == 0) { - /* only process the addition */ - a = ACTION_ADD; - u = u2; - } - break; - } - - *remove_session_id = old_session; - *uid = u; - *uid2 = u2; - *action = a; - return 0; -} - -/* add or remove a ACL for a given uid from all matching devices */ -static void apply_acl_to_devices(uid_t uid, int add) -{ - struct udev *udev; - struct udev_enumerate *enumerate; - struct udev_list_entry *list_entry; - - /* iterate over all devices tagged with ACL_SET */ - udev = udev_new(); - enumerate = udev_enumerate_new(udev); - udev_enumerate_add_match_tag(enumerate, "udev-acl"); - udev_enumerate_scan_devices(enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; - const char *node; - - device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), - udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - node = udev_device_get_devnode(device); - if (node == NULL) { - udev_device_unref(device); - continue; - } - set_facl(node, uid, add); - udev_device_unref(device); - } - udev_enumerate_unref(enumerate); - udev_unref(udev); -} - -static void -remove_uid (uid_t uid, const char *remove_session_id) -{ - /* - * Remove ACL for given uid from all matching devices - * when there is currently no local active session. - */ - GSList *list; - - list = uids_with_local_active_session(remove_session_id); - if (!uid_in_list(list, uid)) - apply_acl_to_devices(uid, 0); - g_slist_free(list); -} - -int main (int argc, char* argv[]) -{ - static const struct option options[] = { - { "action", required_argument, NULL, 'a' }, - { "device", required_argument, NULL, 'D' }, - { "user", required_argument, NULL, 'u' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - int action = -1; - const char *device = NULL; - bool uid_given = false; - uid_t uid = 0; - uid_t uid2 = 0; - const char* remove_session_id = NULL; - int rc = 0; - - /* valgrind is more important to us than a slice allocator */ - g_slice_set_config (G_SLICE_CONFIG_ALWAYS_MALLOC, 1); - - while (1) { - int option; - - option = getopt_long(argc, argv, "+a:D:u:dh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'a': - if (strcmp(optarg, "remove") == 0) - action = ACTION_REMOVE; - else - action = ACTION_ADD; - break; - case 'D': - device = optarg; - break; - case 'u': - uid_given = true; - uid = strtoul(optarg, NULL, 10); - break; - case 'd': - debug = 1; - break; - case 'h': - printf("Usage: udev-acl --action=ACTION [--device=DEVICEFILE] [--user=UID]\n\n"); - goto out; - } - } - - if (action < 0 && device == NULL && !uid_given) - if (!consolekit_called(argv[optind], &uid, &uid2, &remove_session_id, &action)) - uid_given = true; - - if (action < 0) { - fprintf(stderr, "missing action\n\n"); - rc = 2; - goto out; - } - - if (device != NULL && uid_given) { - fprintf(stderr, "only one option, --device=DEVICEFILE or --user=UID expected\n\n"); - rc = 3; - goto out; - } - - if (uid_given) { - switch (action) { - case ACTION_ADD: - /* Add ACL for given uid to all matching devices. */ - apply_acl_to_devices(uid, 1); - break; - case ACTION_REMOVE: - remove_uid(uid, remove_session_id); - break; - case ACTION_CHANGE: - remove_uid(uid, remove_session_id); - apply_acl_to_devices(uid2, 1); - break; - case ACTION_NONE: - goto out; - break; - default: - g_assert_not_reached(); - break; - } - } else if (device != NULL) { - /* - * Add ACLs for all current session uids to a given device. - * - * Or remove ACLs for uids which do not have any current local - * active session. Remove is not really interesting, because in - * most cases the device node is removed anyway. - */ - GSList *list; - GSList *l; - - list = uids_with_local_active_session(NULL); - for (l = list; l != NULL; l = g_slist_next(l)) { - uid_t u; - - u = GPOINTER_TO_UINT(l->data); - if (action == ACTION_ADD || !uid_in_list(list, u)) - set_facl(device, u, action == ACTION_ADD); - } - g_slist_free(list); - } else { - fprintf(stderr, "--device=DEVICEFILE or --user=UID expected\n\n"); - rc = 3; - } -out: - return rc; -} -- cgit v1.2.3-54-g00ecf From 4683a5fa066d49b5d8f78639a22eddf6b226f443 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 16:38:02 +0100 Subject: udev.conf - do not set any value by default --- src/udev.conf | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/udev.conf b/src/udev.conf index 31bb6620ee..f39253eb67 100644 --- a/src/udev.conf +++ b/src/udev.conf @@ -1,4 +1,3 @@ -# The initial syslog(3) priority: "err", "info", "debug" or its -# numerical equivalent. For runtime debugging, the daemons internal -# state can be changed with: "udevadm control --log-priority=". -udev_log="err" +# see udev(7) for details + +#udev_log="info" -- cgit v1.2.3-54-g00ecf From 6997e3b2dc0095985071e2f7496342a850cdb5ad Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 16:46:55 +0100 Subject: move src/extras subdirectories to src/ --- Makefile.am | 418 ++++---- configure.ac | 4 +- rules/misc/30-kernel-compat.rules | 2 +- src/accelerometer/.gitignore | 1 + src/accelerometer/61-accelerometer.rules | 3 + src/accelerometer/accelerometer.c | 357 +++++++ src/ata_id/.gitignore | 1 + src/ata_id/ata_id.c | 726 +++++++++++++ src/cdrom_id/.gitignore | 1 + src/cdrom_id/60-cdrom_id.rules | 20 + src/cdrom_id/cdrom_id.c | 1099 ++++++++++++++++++++ src/collect/.gitignore | 1 + src/collect/collect.c | 473 +++++++++ src/edd_id/.gitignore | 1 + src/edd_id/61-persistent-storage-edd.rules | 12 + src/edd_id/edd_id.c | 196 ++++ src/extras/accelerometer/.gitignore | 1 - src/extras/accelerometer/61-accelerometer.rules | 3 - src/extras/accelerometer/accelerometer.c | 357 ------- src/extras/ata_id/.gitignore | 1 - src/extras/ata_id/ata_id.c | 726 ------------- src/extras/cdrom_id/.gitignore | 1 - src/extras/cdrom_id/60-cdrom_id.rules | 20 - src/extras/cdrom_id/cdrom_id.c | 1099 -------------------- src/extras/collect/.gitignore | 1 - src/extras/collect/collect.c | 473 --------- src/extras/edd_id/.gitignore | 1 - src/extras/edd_id/61-persistent-storage-edd.rules | 12 - src/extras/edd_id/edd_id.c | 196 ---- src/extras/floppy/.gitignore | 1 - src/extras/floppy/60-floppy.rules | 4 - src/extras/floppy/create_floppy_devices.c | 177 ---- src/extras/gudev/.gitignore | 9 - src/extras/gudev/COPYING | 502 --------- src/extras/gudev/docs/.gitignore | 16 - src/extras/gudev/docs/Makefile.am | 106 -- src/extras/gudev/docs/gudev-docs.xml | 93 -- src/extras/gudev/docs/gudev-sections.txt | 113 -- src/extras/gudev/docs/gudev.types | 4 - src/extras/gudev/docs/version.xml.in | 1 - src/extras/gudev/gjs-example.js | 75 -- src/extras/gudev/gudev-1.0.pc.in | 11 - src/extras/gudev/gudev.h | 33 - src/extras/gudev/gudevclient.c | 527 ---------- src/extras/gudev/gudevclient.h | 100 -- src/extras/gudev/gudevdevice.c | 963 ----------------- src/extras/gudev/gudevdevice.h | 128 --- src/extras/gudev/gudevenumerator.c | 431 -------- src/extras/gudev/gudevenumerator.h | 107 -- src/extras/gudev/gudevenums.h | 49 - src/extras/gudev/gudevenumtypes.c.template | 39 - src/extras/gudev/gudevenumtypes.h.template | 24 - src/extras/gudev/gudevmarshal.list | 1 - src/extras/gudev/gudevprivate.h | 41 - src/extras/gudev/gudevtypes.h | 51 - src/extras/gudev/seed-example-enum.js | 38 - src/extras/gudev/seed-example.js | 72 -- src/extras/keymap/.gitignore | 6 - src/extras/keymap/95-keyboard-force-release.rules | 53 - src/extras/keymap/95-keymap.rules | 169 --- src/extras/keymap/README.keymap.txt | 101 -- src/extras/keymap/check-keymaps.sh | 38 - src/extras/keymap/findkeyboards | 68 -- .../keymap/force-release-maps/common-volume-keys | 3 - src/extras/keymap/force-release-maps/dell-touchpad | 1 - src/extras/keymap/force-release-maps/hp-other | 3 - src/extras/keymap/force-release-maps/samsung-other | 10 - src/extras/keymap/keyboard-force-release.sh.in | 22 - src/extras/keymap/keymap.c | 447 -------- src/extras/keymap/keymaps/acer | 22 - src/extras/keymap/keymaps/acer-aspire_5720 | 4 - src/extras/keymap/keymaps/acer-aspire_5920g | 5 - src/extras/keymap/keymaps/acer-aspire_6920 | 5 - src/extras/keymap/keymaps/acer-aspire_8930 | 5 - src/extras/keymap/keymaps/acer-travelmate_c300 | 5 - src/extras/keymap/keymaps/asus | 3 - src/extras/keymap/keymaps/compaq-e_evo | 4 - src/extras/keymap/keymaps/dell | 29 - src/extras/keymap/keymaps/dell-latitude-xt2 | 4 - src/extras/keymap/keymaps/everex-xt5000 | 7 - src/extras/keymap/keymaps/fujitsu-amilo_li_2732 | 3 - src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 | 3 - .../keymap/keymaps/fujitsu-amilo_pro_edition_v3505 | 4 - src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 | 2 - src/extras/keymap/keymaps/fujitsu-amilo_si_1520 | 6 - .../keymap/keymaps/fujitsu-esprimo_mobile_v5 | 4 - .../keymap/keymaps/fujitsu-esprimo_mobile_v6 | 2 - src/extras/keymap/keymaps/genius-slimstar-320 | 35 - src/extras/keymap/keymaps/hewlett-packard | 12 - .../keymap/keymaps/hewlett-packard-2510p_2530p | 2 - .../keymaps/hewlett-packard-compaq_elitebook | 2 - src/extras/keymap/keymaps/hewlett-packard-pavilion | 3 - .../keymap/keymaps/hewlett-packard-presario-2100 | 3 - src/extras/keymap/keymaps/hewlett-packard-tablet | 6 - src/extras/keymap/keymaps/hewlett-packard-tx2 | 3 - .../keymaps/ibm-thinkpad-usb-keyboard-trackpoint | 7 - .../keymap/keymaps/inventec-symphony_6.0_7.0 | 2 - src/extras/keymap/keymaps/lenovo-3000 | 5 - src/extras/keymap/keymaps/lenovo-ideapad | 8 - .../lenovo-thinkpad-usb-keyboard-trackpoint | 13 - .../keymap/keymaps/lenovo-thinkpad_x200_tablet | 6 - .../keymap/keymaps/lenovo-thinkpad_x6_tablet | 8 - src/extras/keymap/keymaps/lg-x110 | 12 - src/extras/keymap/keymaps/logitech-wave | 16 - src/extras/keymap/keymaps/logitech-wave-cordless | 15 - .../keymap/keymaps/logitech-wave-pro-cordless | 12 - src/extras/keymap/keymaps/maxdata-pro_7000 | 9 - src/extras/keymap/keymaps/medion-fid2060 | 2 - src/extras/keymap/keymaps/medionnb-a555 | 4 - src/extras/keymap/keymaps/micro-star | 13 - src/extras/keymap/keymaps/module-asus-w3j | 11 - src/extras/keymap/keymaps/module-ibm | 16 - src/extras/keymap/keymaps/module-lenovo | 17 - src/extras/keymap/keymaps/module-sony | 8 - src/extras/keymap/keymaps/module-sony-old | 2 - src/extras/keymap/keymaps/module-sony-vgn | 8 - src/extras/keymap/keymaps/olpc-xo | 74 -- src/extras/keymap/keymaps/onkyo | 14 - src/extras/keymap/keymaps/oqo-model2 | 5 - src/extras/keymap/keymaps/samsung-other | 14 - src/extras/keymap/keymaps/samsung-sq1us | 7 - src/extras/keymap/keymaps/samsung-sx20s | 4 - src/extras/keymap/keymaps/toshiba-satellite_a100 | 2 - src/extras/keymap/keymaps/toshiba-satellite_a110 | 10 - src/extras/keymap/keymaps/toshiba-satellite_m30x | 6 - src/extras/keymap/keymaps/zepto-znote | 11 - src/extras/mtd_probe/.gitignore | 1 - src/extras/mtd_probe/75-probe_mtd.rules | 8 - src/extras/mtd_probe/mtd_probe.c | 51 - src/extras/mtd_probe/mtd_probe.h | 49 - src/extras/mtd_probe/probe_smartmedia.c | 97 -- src/extras/qemu/42-qemu-usb.rules | 13 - .../rule_generator/75-cd-aliases-generator.rules | 9 - .../75-persistent-net-generator.rules | 102 -- src/extras/rule_generator/rule_generator.functions | 113 -- src/extras/rule_generator/write_cd_rules | 126 --- src/extras/rule_generator/write_net_rules | 141 --- src/extras/scsi_id/.gitignore | 3 - src/extras/scsi_id/README | 4 - src/extras/scsi_id/scsi.h | 97 -- src/extras/scsi_id/scsi_id.8 | 119 --- src/extras/scsi_id/scsi_id.c | 657 ------------ src/extras/scsi_id/scsi_id.h | 73 -- src/extras/scsi_id/scsi_serial.c | 990 ------------------ src/extras/v4l_id/.gitignore | 1 - src/extras/v4l_id/60-persistent-v4l.rules | 20 - src/extras/v4l_id/v4l_id.c | 87 -- src/floppy/.gitignore | 1 + src/floppy/60-floppy.rules | 4 + src/floppy/create_floppy_devices.c | 177 ++++ src/gudev/.gitignore | 9 + src/gudev/COPYING | 502 +++++++++ src/gudev/docs/.gitignore | 16 + src/gudev/docs/Makefile.am | 106 ++ src/gudev/docs/gudev-docs.xml | 93 ++ src/gudev/docs/gudev-sections.txt | 113 ++ src/gudev/docs/gudev.types | 4 + src/gudev/docs/version.xml.in | 1 + src/gudev/gjs-example.js | 75 ++ src/gudev/gudev-1.0.pc.in | 11 + src/gudev/gudev.h | 33 + src/gudev/gudevclient.c | 527 ++++++++++ src/gudev/gudevclient.h | 100 ++ src/gudev/gudevdevice.c | 963 +++++++++++++++++ src/gudev/gudevdevice.h | 128 +++ src/gudev/gudevenumerator.c | 431 ++++++++ src/gudev/gudevenumerator.h | 107 ++ src/gudev/gudevenums.h | 49 + src/gudev/gudevenumtypes.c.template | 39 + src/gudev/gudevenumtypes.h.template | 24 + src/gudev/gudevmarshal.list | 1 + src/gudev/gudevprivate.h | 41 + src/gudev/gudevtypes.h | 51 + src/gudev/seed-example-enum.js | 38 + src/gudev/seed-example.js | 72 ++ src/keymap/.gitignore | 6 + src/keymap/95-keyboard-force-release.rules | 53 + src/keymap/95-keymap.rules | 169 +++ src/keymap/README.keymap.txt | 101 ++ src/keymap/check-keymaps.sh | 38 + src/keymap/findkeyboards | 68 ++ src/keymap/force-release-maps/common-volume-keys | 3 + src/keymap/force-release-maps/dell-touchpad | 1 + src/keymap/force-release-maps/hp-other | 3 + src/keymap/force-release-maps/samsung-other | 10 + src/keymap/keyboard-force-release.sh.in | 22 + src/keymap/keymap.c | 447 ++++++++ src/keymap/keymaps/acer | 22 + src/keymap/keymaps/acer-aspire_5720 | 4 + src/keymap/keymaps/acer-aspire_5920g | 5 + src/keymap/keymaps/acer-aspire_6920 | 5 + src/keymap/keymaps/acer-aspire_8930 | 5 + src/keymap/keymaps/acer-travelmate_c300 | 5 + src/keymap/keymaps/asus | 3 + src/keymap/keymaps/compaq-e_evo | 4 + src/keymap/keymaps/dell | 29 + src/keymap/keymaps/dell-latitude-xt2 | 4 + src/keymap/keymaps/everex-xt5000 | 7 + src/keymap/keymaps/fujitsu-amilo_li_2732 | 3 + src/keymap/keymaps/fujitsu-amilo_pa_2548 | 3 + src/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 | 4 + src/keymap/keymaps/fujitsu-amilo_pro_v3205 | 2 + src/keymap/keymaps/fujitsu-amilo_si_1520 | 6 + src/keymap/keymaps/fujitsu-esprimo_mobile_v5 | 4 + src/keymap/keymaps/fujitsu-esprimo_mobile_v6 | 2 + src/keymap/keymaps/genius-slimstar-320 | 35 + src/keymap/keymaps/hewlett-packard | 12 + src/keymap/keymaps/hewlett-packard-2510p_2530p | 2 + .../keymaps/hewlett-packard-compaq_elitebook | 2 + src/keymap/keymaps/hewlett-packard-pavilion | 3 + src/keymap/keymaps/hewlett-packard-presario-2100 | 3 + src/keymap/keymaps/hewlett-packard-tablet | 6 + src/keymap/keymaps/hewlett-packard-tx2 | 3 + .../keymaps/ibm-thinkpad-usb-keyboard-trackpoint | 7 + src/keymap/keymaps/inventec-symphony_6.0_7.0 | 2 + src/keymap/keymaps/lenovo-3000 | 5 + src/keymap/keymaps/lenovo-ideapad | 8 + .../lenovo-thinkpad-usb-keyboard-trackpoint | 13 + src/keymap/keymaps/lenovo-thinkpad_x200_tablet | 6 + src/keymap/keymaps/lenovo-thinkpad_x6_tablet | 8 + src/keymap/keymaps/lg-x110 | 12 + src/keymap/keymaps/logitech-wave | 16 + src/keymap/keymaps/logitech-wave-cordless | 15 + src/keymap/keymaps/logitech-wave-pro-cordless | 12 + src/keymap/keymaps/maxdata-pro_7000 | 9 + src/keymap/keymaps/medion-fid2060 | 2 + src/keymap/keymaps/medionnb-a555 | 4 + src/keymap/keymaps/micro-star | 13 + src/keymap/keymaps/module-asus-w3j | 11 + src/keymap/keymaps/module-ibm | 16 + src/keymap/keymaps/module-lenovo | 17 + src/keymap/keymaps/module-sony | 8 + src/keymap/keymaps/module-sony-old | 2 + src/keymap/keymaps/module-sony-vgn | 8 + src/keymap/keymaps/olpc-xo | 74 ++ src/keymap/keymaps/onkyo | 14 + src/keymap/keymaps/oqo-model2 | 5 + src/keymap/keymaps/samsung-other | 14 + src/keymap/keymaps/samsung-sq1us | 7 + src/keymap/keymaps/samsung-sx20s | 4 + src/keymap/keymaps/toshiba-satellite_a100 | 2 + src/keymap/keymaps/toshiba-satellite_a110 | 10 + src/keymap/keymaps/toshiba-satellite_m30x | 6 + src/keymap/keymaps/zepto-znote | 11 + src/libudev-queue.c | 2 +- src/mtd_probe/.gitignore | 1 + src/mtd_probe/75-probe_mtd.rules | 8 + src/mtd_probe/mtd_probe.c | 51 + src/mtd_probe/mtd_probe.h | 49 + src/mtd_probe/probe_smartmedia.c | 97 ++ src/qemu/42-qemu-usb.rules | 13 + src/rule_generator/75-cd-aliases-generator.rules | 9 + .../75-persistent-net-generator.rules | 102 ++ src/rule_generator/rule_generator.functions | 113 ++ src/rule_generator/write_cd_rules | 126 +++ src/rule_generator/write_net_rules | 141 +++ src/scsi_id/.gitignore | 3 + src/scsi_id/README | 4 + src/scsi_id/scsi.h | 97 ++ src/scsi_id/scsi_id.8 | 119 +++ src/scsi_id/scsi_id.c | 657 ++++++++++++ src/scsi_id/scsi_id.h | 73 ++ src/scsi_id/scsi_serial.c | 990 ++++++++++++++++++ src/v4l_id/.gitignore | 1 + src/v4l_id/60-persistent-v4l.rules | 20 + src/v4l_id/v4l_id.c | 87 ++ 266 files changed, 11026 insertions(+), 11026 deletions(-) create mode 100644 src/accelerometer/.gitignore create mode 100644 src/accelerometer/61-accelerometer.rules create mode 100644 src/accelerometer/accelerometer.c create mode 100644 src/ata_id/.gitignore create mode 100644 src/ata_id/ata_id.c create mode 100644 src/cdrom_id/.gitignore create mode 100644 src/cdrom_id/60-cdrom_id.rules create mode 100644 src/cdrom_id/cdrom_id.c create mode 100644 src/collect/.gitignore create mode 100644 src/collect/collect.c create mode 100644 src/edd_id/.gitignore create mode 100644 src/edd_id/61-persistent-storage-edd.rules create mode 100644 src/edd_id/edd_id.c delete mode 100644 src/extras/accelerometer/.gitignore delete mode 100644 src/extras/accelerometer/61-accelerometer.rules delete mode 100644 src/extras/accelerometer/accelerometer.c delete mode 100644 src/extras/ata_id/.gitignore delete mode 100644 src/extras/ata_id/ata_id.c delete mode 100644 src/extras/cdrom_id/.gitignore delete mode 100644 src/extras/cdrom_id/60-cdrom_id.rules delete mode 100644 src/extras/cdrom_id/cdrom_id.c delete mode 100644 src/extras/collect/.gitignore delete mode 100644 src/extras/collect/collect.c delete mode 100644 src/extras/edd_id/.gitignore delete mode 100644 src/extras/edd_id/61-persistent-storage-edd.rules delete mode 100644 src/extras/edd_id/edd_id.c delete mode 100644 src/extras/floppy/.gitignore delete mode 100644 src/extras/floppy/60-floppy.rules delete mode 100644 src/extras/floppy/create_floppy_devices.c delete mode 100644 src/extras/gudev/.gitignore delete mode 100644 src/extras/gudev/COPYING delete mode 100644 src/extras/gudev/docs/.gitignore delete mode 100644 src/extras/gudev/docs/Makefile.am delete mode 100644 src/extras/gudev/docs/gudev-docs.xml delete mode 100644 src/extras/gudev/docs/gudev-sections.txt delete mode 100644 src/extras/gudev/docs/gudev.types delete mode 100644 src/extras/gudev/docs/version.xml.in delete mode 100755 src/extras/gudev/gjs-example.js delete mode 100644 src/extras/gudev/gudev-1.0.pc.in delete mode 100644 src/extras/gudev/gudev.h delete mode 100644 src/extras/gudev/gudevclient.c delete mode 100644 src/extras/gudev/gudevclient.h delete mode 100644 src/extras/gudev/gudevdevice.c delete mode 100644 src/extras/gudev/gudevdevice.h delete mode 100644 src/extras/gudev/gudevenumerator.c delete mode 100644 src/extras/gudev/gudevenumerator.h delete mode 100644 src/extras/gudev/gudevenums.h delete mode 100644 src/extras/gudev/gudevenumtypes.c.template delete mode 100644 src/extras/gudev/gudevenumtypes.h.template delete mode 100644 src/extras/gudev/gudevmarshal.list delete mode 100644 src/extras/gudev/gudevprivate.h delete mode 100644 src/extras/gudev/gudevtypes.h delete mode 100755 src/extras/gudev/seed-example-enum.js delete mode 100755 src/extras/gudev/seed-example.js delete mode 100644 src/extras/keymap/.gitignore delete mode 100644 src/extras/keymap/95-keyboard-force-release.rules delete mode 100644 src/extras/keymap/95-keymap.rules delete mode 100644 src/extras/keymap/README.keymap.txt delete mode 100755 src/extras/keymap/check-keymaps.sh delete mode 100755 src/extras/keymap/findkeyboards delete mode 100644 src/extras/keymap/force-release-maps/common-volume-keys delete mode 100644 src/extras/keymap/force-release-maps/dell-touchpad delete mode 100644 src/extras/keymap/force-release-maps/hp-other delete mode 100644 src/extras/keymap/force-release-maps/samsung-other delete mode 100755 src/extras/keymap/keyboard-force-release.sh.in delete mode 100644 src/extras/keymap/keymap.c delete mode 100644 src/extras/keymap/keymaps/acer delete mode 100644 src/extras/keymap/keymaps/acer-aspire_5720 delete mode 100644 src/extras/keymap/keymaps/acer-aspire_5920g delete mode 100644 src/extras/keymap/keymaps/acer-aspire_6920 delete mode 100644 src/extras/keymap/keymaps/acer-aspire_8930 delete mode 100644 src/extras/keymap/keymaps/acer-travelmate_c300 delete mode 100644 src/extras/keymap/keymaps/asus delete mode 100644 src/extras/keymap/keymaps/compaq-e_evo delete mode 100644 src/extras/keymap/keymaps/dell delete mode 100644 src/extras/keymap/keymaps/dell-latitude-xt2 delete mode 100644 src/extras/keymap/keymaps/everex-xt5000 delete mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_li_2732 delete mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 delete mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 delete mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 delete mode 100644 src/extras/keymap/keymaps/fujitsu-amilo_si_1520 delete mode 100644 src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 delete mode 100644 src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 delete mode 100644 src/extras/keymap/keymaps/genius-slimstar-320 delete mode 100644 src/extras/keymap/keymaps/hewlett-packard delete mode 100644 src/extras/keymap/keymaps/hewlett-packard-2510p_2530p delete mode 100644 src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook delete mode 100644 src/extras/keymap/keymaps/hewlett-packard-pavilion delete mode 100644 src/extras/keymap/keymaps/hewlett-packard-presario-2100 delete mode 100644 src/extras/keymap/keymaps/hewlett-packard-tablet delete mode 100644 src/extras/keymap/keymaps/hewlett-packard-tx2 delete mode 100644 src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint delete mode 100644 src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 delete mode 100644 src/extras/keymap/keymaps/lenovo-3000 delete mode 100644 src/extras/keymap/keymaps/lenovo-ideapad delete mode 100644 src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint delete mode 100644 src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet delete mode 100644 src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet delete mode 100644 src/extras/keymap/keymaps/lg-x110 delete mode 100644 src/extras/keymap/keymaps/logitech-wave delete mode 100644 src/extras/keymap/keymaps/logitech-wave-cordless delete mode 100644 src/extras/keymap/keymaps/logitech-wave-pro-cordless delete mode 100644 src/extras/keymap/keymaps/maxdata-pro_7000 delete mode 100644 src/extras/keymap/keymaps/medion-fid2060 delete mode 100644 src/extras/keymap/keymaps/medionnb-a555 delete mode 100644 src/extras/keymap/keymaps/micro-star delete mode 100644 src/extras/keymap/keymaps/module-asus-w3j delete mode 100644 src/extras/keymap/keymaps/module-ibm delete mode 100644 src/extras/keymap/keymaps/module-lenovo delete mode 100644 src/extras/keymap/keymaps/module-sony delete mode 100644 src/extras/keymap/keymaps/module-sony-old delete mode 100644 src/extras/keymap/keymaps/module-sony-vgn delete mode 100644 src/extras/keymap/keymaps/olpc-xo delete mode 100644 src/extras/keymap/keymaps/onkyo delete mode 100644 src/extras/keymap/keymaps/oqo-model2 delete mode 100644 src/extras/keymap/keymaps/samsung-other delete mode 100644 src/extras/keymap/keymaps/samsung-sq1us delete mode 100644 src/extras/keymap/keymaps/samsung-sx20s delete mode 100644 src/extras/keymap/keymaps/toshiba-satellite_a100 delete mode 100644 src/extras/keymap/keymaps/toshiba-satellite_a110 delete mode 100644 src/extras/keymap/keymaps/toshiba-satellite_m30x delete mode 100644 src/extras/keymap/keymaps/zepto-znote delete mode 100644 src/extras/mtd_probe/.gitignore delete mode 100644 src/extras/mtd_probe/75-probe_mtd.rules delete mode 100644 src/extras/mtd_probe/mtd_probe.c delete mode 100644 src/extras/mtd_probe/mtd_probe.h delete mode 100644 src/extras/mtd_probe/probe_smartmedia.c delete mode 100644 src/extras/qemu/42-qemu-usb.rules delete mode 100644 src/extras/rule_generator/75-cd-aliases-generator.rules delete mode 100644 src/extras/rule_generator/75-persistent-net-generator.rules delete mode 100644 src/extras/rule_generator/rule_generator.functions delete mode 100644 src/extras/rule_generator/write_cd_rules delete mode 100644 src/extras/rule_generator/write_net_rules delete mode 100644 src/extras/scsi_id/.gitignore delete mode 100644 src/extras/scsi_id/README delete mode 100644 src/extras/scsi_id/scsi.h delete mode 100644 src/extras/scsi_id/scsi_id.8 delete mode 100644 src/extras/scsi_id/scsi_id.c delete mode 100644 src/extras/scsi_id/scsi_id.h delete mode 100644 src/extras/scsi_id/scsi_serial.c delete mode 100644 src/extras/v4l_id/.gitignore delete mode 100644 src/extras/v4l_id/60-persistent-v4l.rules delete mode 100644 src/extras/v4l_id/v4l_id.c create mode 100644 src/floppy/.gitignore create mode 100644 src/floppy/60-floppy.rules create mode 100644 src/floppy/create_floppy_devices.c create mode 100644 src/gudev/.gitignore create mode 100644 src/gudev/COPYING create mode 100644 src/gudev/docs/.gitignore create mode 100644 src/gudev/docs/Makefile.am create mode 100644 src/gudev/docs/gudev-docs.xml create mode 100644 src/gudev/docs/gudev-sections.txt create mode 100644 src/gudev/docs/gudev.types create mode 100644 src/gudev/docs/version.xml.in create mode 100755 src/gudev/gjs-example.js create mode 100644 src/gudev/gudev-1.0.pc.in create mode 100644 src/gudev/gudev.h create mode 100644 src/gudev/gudevclient.c create mode 100644 src/gudev/gudevclient.h create mode 100644 src/gudev/gudevdevice.c create mode 100644 src/gudev/gudevdevice.h create mode 100644 src/gudev/gudevenumerator.c create mode 100644 src/gudev/gudevenumerator.h create mode 100644 src/gudev/gudevenums.h create mode 100644 src/gudev/gudevenumtypes.c.template create mode 100644 src/gudev/gudevenumtypes.h.template create mode 100644 src/gudev/gudevmarshal.list create mode 100644 src/gudev/gudevprivate.h create mode 100644 src/gudev/gudevtypes.h create mode 100755 src/gudev/seed-example-enum.js create mode 100755 src/gudev/seed-example.js create mode 100644 src/keymap/.gitignore create mode 100644 src/keymap/95-keyboard-force-release.rules create mode 100644 src/keymap/95-keymap.rules create mode 100644 src/keymap/README.keymap.txt create mode 100755 src/keymap/check-keymaps.sh create mode 100755 src/keymap/findkeyboards create mode 100644 src/keymap/force-release-maps/common-volume-keys create mode 100644 src/keymap/force-release-maps/dell-touchpad create mode 100644 src/keymap/force-release-maps/hp-other create mode 100644 src/keymap/force-release-maps/samsung-other create mode 100755 src/keymap/keyboard-force-release.sh.in create mode 100644 src/keymap/keymap.c create mode 100644 src/keymap/keymaps/acer create mode 100644 src/keymap/keymaps/acer-aspire_5720 create mode 100644 src/keymap/keymaps/acer-aspire_5920g create mode 100644 src/keymap/keymaps/acer-aspire_6920 create mode 100644 src/keymap/keymaps/acer-aspire_8930 create mode 100644 src/keymap/keymaps/acer-travelmate_c300 create mode 100644 src/keymap/keymaps/asus create mode 100644 src/keymap/keymaps/compaq-e_evo create mode 100644 src/keymap/keymaps/dell create mode 100644 src/keymap/keymaps/dell-latitude-xt2 create mode 100644 src/keymap/keymaps/everex-xt5000 create mode 100644 src/keymap/keymaps/fujitsu-amilo_li_2732 create mode 100644 src/keymap/keymaps/fujitsu-amilo_pa_2548 create mode 100644 src/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 create mode 100644 src/keymap/keymaps/fujitsu-amilo_pro_v3205 create mode 100644 src/keymap/keymaps/fujitsu-amilo_si_1520 create mode 100644 src/keymap/keymaps/fujitsu-esprimo_mobile_v5 create mode 100644 src/keymap/keymaps/fujitsu-esprimo_mobile_v6 create mode 100644 src/keymap/keymaps/genius-slimstar-320 create mode 100644 src/keymap/keymaps/hewlett-packard create mode 100644 src/keymap/keymaps/hewlett-packard-2510p_2530p create mode 100644 src/keymap/keymaps/hewlett-packard-compaq_elitebook create mode 100644 src/keymap/keymaps/hewlett-packard-pavilion create mode 100644 src/keymap/keymaps/hewlett-packard-presario-2100 create mode 100644 src/keymap/keymaps/hewlett-packard-tablet create mode 100644 src/keymap/keymaps/hewlett-packard-tx2 create mode 100644 src/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint create mode 100644 src/keymap/keymaps/inventec-symphony_6.0_7.0 create mode 100644 src/keymap/keymaps/lenovo-3000 create mode 100644 src/keymap/keymaps/lenovo-ideapad create mode 100644 src/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint create mode 100644 src/keymap/keymaps/lenovo-thinkpad_x200_tablet create mode 100644 src/keymap/keymaps/lenovo-thinkpad_x6_tablet create mode 100644 src/keymap/keymaps/lg-x110 create mode 100644 src/keymap/keymaps/logitech-wave create mode 100644 src/keymap/keymaps/logitech-wave-cordless create mode 100644 src/keymap/keymaps/logitech-wave-pro-cordless create mode 100644 src/keymap/keymaps/maxdata-pro_7000 create mode 100644 src/keymap/keymaps/medion-fid2060 create mode 100644 src/keymap/keymaps/medionnb-a555 create mode 100644 src/keymap/keymaps/micro-star create mode 100644 src/keymap/keymaps/module-asus-w3j create mode 100644 src/keymap/keymaps/module-ibm create mode 100644 src/keymap/keymaps/module-lenovo create mode 100644 src/keymap/keymaps/module-sony create mode 100644 src/keymap/keymaps/module-sony-old create mode 100644 src/keymap/keymaps/module-sony-vgn create mode 100644 src/keymap/keymaps/olpc-xo create mode 100644 src/keymap/keymaps/onkyo create mode 100644 src/keymap/keymaps/oqo-model2 create mode 100644 src/keymap/keymaps/samsung-other create mode 100644 src/keymap/keymaps/samsung-sq1us create mode 100644 src/keymap/keymaps/samsung-sx20s create mode 100644 src/keymap/keymaps/toshiba-satellite_a100 create mode 100644 src/keymap/keymaps/toshiba-satellite_a110 create mode 100644 src/keymap/keymaps/toshiba-satellite_m30x create mode 100644 src/keymap/keymaps/zepto-znote create mode 100644 src/mtd_probe/.gitignore create mode 100644 src/mtd_probe/75-probe_mtd.rules create mode 100644 src/mtd_probe/mtd_probe.c create mode 100644 src/mtd_probe/mtd_probe.h create mode 100644 src/mtd_probe/probe_smartmedia.c create mode 100644 src/qemu/42-qemu-usb.rules create mode 100644 src/rule_generator/75-cd-aliases-generator.rules create mode 100644 src/rule_generator/75-persistent-net-generator.rules create mode 100644 src/rule_generator/rule_generator.functions create mode 100644 src/rule_generator/write_cd_rules create mode 100644 src/rule_generator/write_net_rules create mode 100644 src/scsi_id/.gitignore create mode 100644 src/scsi_id/README create mode 100644 src/scsi_id/scsi.h create mode 100644 src/scsi_id/scsi_id.8 create mode 100644 src/scsi_id/scsi_id.c create mode 100644 src/scsi_id/scsi_id.h create mode 100644 src/scsi_id/scsi_serial.c create mode 100644 src/v4l_id/.gitignore create mode 100644 src/v4l_id/60-persistent-v4l.rules create mode 100644 src/v4l_id/v4l_id.c diff --git a/Makefile.am b/Makefile.am index 95cb52cdda..11b4c8477d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -328,58 +328,58 @@ EXTRA_DIST += test/sys.tar.xz # ------------------------------------------------------------------------------ # ata_id - ATA identify # ------------------------------------------------------------------------------ -src_extras_ata_id_ata_id_SOURCES = src/extras/ata_id/ata_id.c -src_extras_ata_id_ata_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/extras/ata_id/ata_id +src_ata_id_ata_id_SOURCES = src/ata_id/ata_id.c +src_ata_id_ata_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/ata_id/ata_id # ------------------------------------------------------------------------------ # cdrom_id - optical drive/media capability # ------------------------------------------------------------------------------ -src_extras_cdrom_id_cdrom_id_SOURCES = src/extras/cdrom_id/cdrom_id.c -src_extras_cdrom_id_cdrom_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/extras/cdrom_id/cdrom_id -dist_udevrules_DATA += src/extras/cdrom_id/60-cdrom_id.rules +src_cdrom_id_cdrom_id_SOURCES = src/cdrom_id/cdrom_id.c +src_cdrom_id_cdrom_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/cdrom_id/cdrom_id +dist_udevrules_DATA += src/cdrom_id/60-cdrom_id.rules # ------------------------------------------------------------------------------ # collect - trigger action when a collection of devices appeared # ------------------------------------------------------------------------------ -src_extras_collect_collect_SOURCES = src/extras/collect/collect.c -src_extras_collect_collect_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/extras/collect/collect +src_collect_collect_SOURCES = src/collect/collect.c +src_collect_collect_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/collect/collect # ------------------------------------------------------------------------------ # scsi_id - SCSI inquiry to get various serial numbers # ------------------------------------------------------------------------------ -src_extras_scsi_id_scsi_id_SOURCES =\ - src/extras/scsi_id/scsi_id.c \ - src/extras/scsi_id/scsi_serial.c \ - src/extras/scsi_id/scsi.h \ - src/extras/scsi_id/scsi_id.h -src_extras_scsi_id_scsi_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/extras/scsi_id/scsi_id -dist_man_MANS += src/extras/scsi_id/scsi_id.8 -EXTRA_DIST += src/extras/scsi_id/README +src_scsi_id_scsi_id_SOURCES =\ + src/scsi_id/scsi_id.c \ + src/scsi_id/scsi_serial.c \ + src/scsi_id/scsi.h \ + src/scsi_id/scsi_id.h +src_scsi_id_scsi_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/scsi_id/scsi_id +dist_man_MANS += src/scsi_id/scsi_id.8 +EXTRA_DIST += src/scsi_id/README # ------------------------------------------------------------------------------ # v4l_id - video4linux capabilities # ------------------------------------------------------------------------------ -src_extras_v4l_id_v4l_id_SOURCES = src/extras/v4l_id/v4l_id.c -src_extras_v4l_id_v4l_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/extras/v4l_id/v4l_id -dist_udevrules_DATA += src/extras/v4l_id/60-persistent-v4l.rules +src_v4l_id_v4l_id_SOURCES = src/v4l_id/v4l_id.c +src_v4l_id_v4l_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/v4l_id/v4l_id +dist_udevrules_DATA += src/v4l_id/60-persistent-v4l.rules # ------------------------------------------------------------------------------ # accelerometer - updates device orientation # ------------------------------------------------------------------------------ -src_extras_accelerometer_accelerometer_SOURCES = src/extras/accelerometer/accelerometer.c -src_extras_accelerometer_accelerometer_LDADD = src/libudev-private.la -lm -pkglibexec_PROGRAMS += src/extras/accelerometer/accelerometer -dist_udevrules_DATA += src/extras/accelerometer/61-accelerometer.rules +src_accelerometer_accelerometer_SOURCES = src/accelerometer/accelerometer.c +src_accelerometer_accelerometer_LDADD = src/libudev-private.la -lm +pkglibexec_PROGRAMS += src/accelerometer/accelerometer +dist_udevrules_DATA += src/accelerometer/61-accelerometer.rules # ------------------------------------------------------------------------------ # qemu -- qemu/kvm guest tweaks # ------------------------------------------------------------------------------ -dist_udevrules_DATA += src/extras/qemu/42-qemu-usb.rules +dist_udevrules_DATA += src/qemu/42-qemu-usb.rules if ENABLE_GUDEV # ------------------------------------------------------------------------------ @@ -389,91 +389,91 @@ LIBGUDEV_CURRENT=1 LIBGUDEV_REVISION=1 LIBGUDEV_AGE=1 -SUBDIRS += src/extras/gudev/docs - -src_extras_gudev_libgudev_includedir=$(includedir)/gudev-1.0/gudev -src_extras_gudev_libgudev_include_HEADERS = \ - src/extras/gudev/gudev.h \ - src/extras/gudev/gudevenums.h \ - src/extras/gudev/gudevenumtypes.h \ - src/extras/gudev/gudevtypes.h \ - src/extras/gudev/gudevclient.h \ - src/extras/gudev/gudevdevice.h \ - src/extras/gudev/gudevenumerator.h - -lib_LTLIBRARIES += src/extras/gudev/libgudev-1.0.la - -pkgconfig_DATA += src/extras/gudev/gudev-1.0.pc -EXTRA_DIST += src/extras/gudev/gudev-1.0.pc.in -CLEANFILES += src/extras/gudev/gudev-1.0.pc - -src_extras_gudev_libgudev_1_0_la_SOURCES = \ - src/extras/gudev/gudevenums.h \ - src/extras/gudev/gudevenumtypes.h \ - src/extras/gudev/gudevenumtypes.h\ - src/extras/gudev/gudevtypes.h \ - src/extras/gudev/gudevclient.h \ - src/extras/gudev/gudevclient.c \ - src/extras/gudev/gudevdevice.h \ - src/extras/gudev/gudevdevice.c \ - src/extras/gudev/gudevenumerator.h \ - src/extras/gudev/gudevenumerator.c \ - src/extras/gudev/gudevprivate.h - -nodist_src_extras_gudev_libgudev_1_0_la_SOURCES = \ - src/extras/gudev/gudevmarshal.h \ - src/extras/gudev/gudevmarshal.c \ - src/extras/gudev/gudevenumtypes.h \ - src/extras/gudev/gudevenumtypes.c -BUILT_SOURCES += $(nodist_src_extras_gudev_libgudev_1_0_la_SOURCES) - -src_extras_gudev_libgudev_1_0_la_CPPFLAGS = \ +SUBDIRS += src/gudev/docs + +src_gudev_libgudev_includedir=$(includedir)/gudev-1.0/gudev +src_gudev_libgudev_include_HEADERS = \ + src/gudev/gudev.h \ + src/gudev/gudevenums.h \ + src/gudev/gudevenumtypes.h \ + src/gudev/gudevtypes.h \ + src/gudev/gudevclient.h \ + src/gudev/gudevdevice.h \ + src/gudev/gudevenumerator.h + +lib_LTLIBRARIES += src/gudev/libgudev-1.0.la + +pkgconfig_DATA += src/gudev/gudev-1.0.pc +EXTRA_DIST += src/gudev/gudev-1.0.pc.in +CLEANFILES += src/gudev/gudev-1.0.pc + +src_gudev_libgudev_1_0_la_SOURCES = \ + src/gudev/gudevenums.h \ + src/gudev/gudevenumtypes.h \ + src/gudev/gudevenumtypes.h\ + src/gudev/gudevtypes.h \ + src/gudev/gudevclient.h \ + src/gudev/gudevclient.c \ + src/gudev/gudevdevice.h \ + src/gudev/gudevdevice.c \ + src/gudev/gudevenumerator.h \ + src/gudev/gudevenumerator.c \ + src/gudev/gudevprivate.h + +nodist_src_gudev_libgudev_1_0_la_SOURCES = \ + src/gudev/gudevmarshal.h \ + src/gudev/gudevmarshal.c \ + src/gudev/gudevenumtypes.h \ + src/gudev/gudevenumtypes.c +BUILT_SOURCES += $(nodist_src_gudev_libgudev_1_0_la_SOURCES) + +src_gudev_libgudev_1_0_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ - -I$(top_builddir)/src/extras \ - -I$(top_srcdir)/src/extras \ - -I$(top_builddir)/src/extras/gudev \ - -I$(top_srcdir)/src/extras/gudev \ + -I$(top_builddir)/src\ + -I$(top_srcdir)/src\ + -I$(top_builddir)/src/gudev \ + -I$(top_srcdir)/src/gudev \ -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT \ -D_GUDEV_COMPILATION \ -DG_LOG_DOMAIN=\"GUdev\" -src_extras_gudev_libgudev_1_0_la_CFLAGS = \ +src_gudev_libgudev_1_0_la_CFLAGS = \ -fvisibility=default \ $(GLIB_CFLAGS) -src_extras_gudev_libgudev_1_0_la_LIBADD = src/libudev.la $(GLIB_LIBS) +src_gudev_libgudev_1_0_la_LIBADD = src/libudev.la $(GLIB_LIBS) -src_extras_gudev_libgudev_1_0_la_LDFLAGS = \ +src_gudev_libgudev_1_0_la_LDFLAGS = \ -version-info $(LIBGUDEV_CURRENT):$(LIBGUDEV_REVISION):$(LIBGUDEV_AGE) \ -export-dynamic -no-undefined \ -export-symbols-regex '^g_udev_.*' EXTRA_DIST += \ - src/extras/gudev/COPYING \ - src/extras/gudev/gudevmarshal.list \ - src/extras/gudev/gudevenumtypes.h.template \ - src/extras/gudev/gudevenumtypes.c.template \ - src/extras/gudev/gjs-example.js \ - src/extras/gudev/seed-example-enum.js \ - src/extras/gudev/seed-example.js - -src/extras/gudev/gudevmarshal.h: src/extras/gudev/gudevmarshal.list + src/gudev/COPYING \ + src/gudev/gudevmarshal.list \ + src/gudev/gudevenumtypes.h.template \ + src/gudev/gudevenumtypes.c.template \ + src/gudev/gjs-example.js \ + src/gudev/seed-example-enum.js \ + src/gudev/seed-example.js + +src/gudev/gudevmarshal.h: src/gudev/gudevmarshal.list $(AM_V_GEN)glib-genmarshal $< --prefix=g_udev_marshal --header > $@ -src/extras/gudev/gudevmarshal.c: src/extras/gudev/gudevmarshal.list +src/gudev/gudevmarshal.c: src/gudev/gudevmarshal.list $(AM_V_GEN)echo "#include \"gudevmarshal.h\"" > $@ && \ glib-genmarshal $< --prefix=g_udev_marshal --body >> $@ -src/extras/gudev/gudevenumtypes.h: src/extras/gudev/gudevenumtypes.h.template src/extras/gudev/gudevenums.h +src/gudev/gudevenumtypes.h: src/gudev/gudevenumtypes.h.template src/gudev/gudevenums.h $(AM_V_GEN)glib-mkenums --template $^ > \ $@.tmp && mv $@.tmp $@ -src/extras/gudev/gudevenumtypes.c: src/extras/gudev/gudevenumtypes.c.template src/extras/gudev/gudevenums.h +src/gudev/gudevenumtypes.c: src/gudev/gudevenumtypes.c.template src/gudev/gudevenums.h $(AM_V_GEN)glib-mkenums --template $^ > \ $@.tmp && mv $@.tmp $@ if ENABLE_INTROSPECTION -src/extras/gudev/GUdev-1.0.gir: src/extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) +src/gudev/GUdev-1.0.gir: src/gudev/libgudev-1.0.la $(G_IR_SCANNER) $(AM_V_GEN)$(G_IR_SCANNER) -v \ --warn-all \ --namespace GUdev \ @@ -481,35 +481,35 @@ src/extras/gudev/GUdev-1.0.gir: src/extras/gudev/libgudev-1.0.la $(G_IR_SCANNER) --include=GObject-2.0 \ --library=gudev-1.0 \ --library-path=$(top_builddir)/src \ - --library-path=$(top_builddir)/src/extras/gudev \ + --library-path=$(top_builddir)/src/gudev \ --output $@ \ --pkg=glib-2.0 \ --pkg=gobject-2.0 \ --pkg-export=gudev-1.0 \ --c-include=gudev/gudev.h \ - -I$(top_srcdir)/src/extras \ - -I$(top_builddir)/src/extras \ + -I$(top_srcdir)/src/\ + -I$(top_builddir)/src/\ -D_GUDEV_COMPILATION \ -D_GUDEV_WORK_AROUND_DEV_T_BUG \ - $(top_srcdir)/src/extras/gudev/gudev.h \ - $(top_srcdir)/src/extras/gudev/gudevtypes.h \ - $(top_srcdir)/src/extras/gudev/gudevenums.h \ - $(or $(wildcard $(top_builddir)/src/extras/gudev/gudevenumtypes.h),$(top_srcdir)/src/extras/gudev/gudevenumtypes.h) \ - $(top_srcdir)/src/extras/gudev/gudevclient.h \ - $(top_srcdir)/src/extras/gudev/gudevdevice.h \ - $(top_srcdir)/src/extras/gudev/gudevenumerator.h \ - $(top_srcdir)/src/extras/gudev/gudevclient.c \ - $(top_srcdir)/src/extras/gudev/gudevdevice.c \ - $(top_srcdir)/src/extras/gudev/gudevenumerator.c - -src/extras/gudev/GUdev-1.0.typelib: src/extras/gudev/GUdev-1.0.gir $(G_IR_COMPILER) + $(top_srcdir)/src/gudev/gudev.h \ + $(top_srcdir)/src/gudev/gudevtypes.h \ + $(top_srcdir)/src/gudev/gudevenums.h \ + $(or $(wildcard $(top_builddir)/src/gudev/gudevenumtypes.h),$(top_srcdir)/src/gudev/gudevenumtypes.h) \ + $(top_srcdir)/src/gudev/gudevclient.h \ + $(top_srcdir)/src/gudev/gudevdevice.h \ + $(top_srcdir)/src/gudev/gudevenumerator.h \ + $(top_srcdir)/src/gudev/gudevclient.c \ + $(top_srcdir)/src/gudev/gudevdevice.c \ + $(top_srcdir)/src/gudev/gudevenumerator.c + +src/gudev/GUdev-1.0.typelib: src/gudev/GUdev-1.0.gir $(G_IR_COMPILER) $(AM_V_GEN)g-ir-compiler $< -o $@ girdir = $(GIRDIR) -gir_DATA = src/extras/gudev/GUdev-1.0.gir +gir_DATA = src/gudev/GUdev-1.0.gir typelibsdir = $(GIRTYPELIBDIR) -typelibs_DATA = src/extras/gudev/GUdev-1.0.typelib +typelibs_DATA = src/gudev/GUdev-1.0.typelib CLEANFILES += $(gir_DATA) $(typelibs_DATA) endif # ENABLE_INTROSPECTION @@ -535,114 +535,114 @@ if ENABLE_KEYMAP # ------------------------------------------------------------------------------ # keymap - map custom hardware's multimedia keys # ------------------------------------------------------------------------------ -src_extras_keymap_keymap_SOURCES = src/extras/keymap/keymap.c -src_extras_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I src/extras/keymap -nodist_src_extras_keymap_keymap_SOURCES = \ - src/extras/keymap/keys-from-name.h \ - src/extras/keymap/keys-to-name.h -BUILT_SOURCES += $(nodist_src_extras_keymap_keymap_SOURCES) +src_keymap_keymap_SOURCES = src/keymap/keymap.c +src_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I src/keymap +nodist_src_keymap_keymap_SOURCES = \ + src/keymap/keys-from-name.h \ + src/keymap/keys-to-name.h +BUILT_SOURCES += $(nodist_src_keymap_keymap_SOURCES) -pkglibexec_PROGRAMS += src/extras/keymap/keymap -dist_doc_DATA = src/extras/keymap/README.keymap.txt +pkglibexec_PROGRAMS += src/keymap/keymap +dist_doc_DATA = src/keymap/README.keymap.txt dist_udevrules_DATA += \ - src/extras/keymap/95-keymap.rules \ - src/extras/keymap/95-keyboard-force-release.rules + src/keymap/95-keymap.rules \ + src/keymap/95-keyboard-force-release.rules -dist_udevhome_SCRIPTS += src/extras/keymap/findkeyboards -udevhome_SCRIPTS += src/extras/keymap/keyboard-force-release.sh +dist_udevhome_SCRIPTS += src/keymap/findkeyboards +udevhome_SCRIPTS += src/keymap/keyboard-force-release.sh EXTRA_DIST += \ - src/extras/keymap/check-keymaps.sh \ - src/extras/keymap/keyboard-force-release.sh.in + src/keymap/check-keymaps.sh \ + src/keymap/keyboard-force-release.sh.in CLEANFILES += \ - src/extras/keymap/keys.txt \ - src/extras/keymap/keys-from-name.gperf \ - src/extras/keymap/keyboard-force-release.sh + src/keymap/keys.txt \ + src/keymap/keys-from-name.gperf \ + src/keymap/keyboard-force-release.sh udevkeymapdir = $(libexecdir)/udev/keymaps dist_udevkeymap_DATA = \ - src/extras/keymap/keymaps/acer \ - src/extras/keymap/keymaps/acer-aspire_5720 \ - src/extras/keymap/keymaps/acer-aspire_8930 \ - src/extras/keymap/keymaps/acer-aspire_5920g \ - src/extras/keymap/keymaps/acer-aspire_6920 \ - src/extras/keymap/keymaps/acer-travelmate_c300 \ - src/extras/keymap/keymaps/asus \ - src/extras/keymap/keymaps/compaq-e_evo \ - src/extras/keymap/keymaps/dell \ - src/extras/keymap/keymaps/dell-latitude-xt2 \ - src/extras/keymap/keymaps/everex-xt5000 \ - src/extras/keymap/keymaps/fujitsu-amilo_li_2732 \ - src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 \ - src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ - src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 \ - src/extras/keymap/keymaps/fujitsu-amilo_si_1520 \ - src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ - src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ - src/extras/keymap/keymaps/genius-slimstar-320 \ - src/extras/keymap/keymaps/hewlett-packard \ - src/extras/keymap/keymaps/hewlett-packard-2510p_2530p \ - src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook \ - src/extras/keymap/keymaps/hewlett-packard-pavilion \ - src/extras/keymap/keymaps/hewlett-packard-presario-2100 \ - src/extras/keymap/keymaps/hewlett-packard-tablet \ - src/extras/keymap/keymaps/hewlett-packard-tx2 \ - src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint \ - src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 \ - src/extras/keymap/keymaps/lenovo-3000 \ - src/extras/keymap/keymaps/lenovo-ideapad \ - src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ - src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet \ - src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet \ - src/extras/keymap/keymaps/lg-x110 \ - src/extras/keymap/keymaps/logitech-wave \ - src/extras/keymap/keymaps/logitech-wave-cordless \ - src/extras/keymap/keymaps/logitech-wave-pro-cordless \ - src/extras/keymap/keymaps/maxdata-pro_7000 \ - src/extras/keymap/keymaps/medion-fid2060 \ - src/extras/keymap/keymaps/medionnb-a555 \ - src/extras/keymap/keymaps/micro-star \ - src/extras/keymap/keymaps/module-asus-w3j \ - src/extras/keymap/keymaps/module-ibm \ - src/extras/keymap/keymaps/module-lenovo \ - src/extras/keymap/keymaps/module-sony \ - src/extras/keymap/keymaps/module-sony-old \ - src/extras/keymap/keymaps/module-sony-vgn \ - src/extras/keymap/keymaps/olpc-xo \ - src/extras/keymap/keymaps/onkyo \ - src/extras/keymap/keymaps/oqo-model2 \ - src/extras/keymap/keymaps/samsung-other \ - src/extras/keymap/keymaps/samsung-sq1us \ - src/extras/keymap/keymaps/samsung-sx20s \ - src/extras/keymap/keymaps/toshiba-satellite_a100 \ - src/extras/keymap/keymaps/toshiba-satellite_a110 \ - src/extras/keymap/keymaps/toshiba-satellite_m30x \ - src/extras/keymap/keymaps/zepto-znote + src/keymap/keymaps/acer \ + src/keymap/keymaps/acer-aspire_5720 \ + src/keymap/keymaps/acer-aspire_8930 \ + src/keymap/keymaps/acer-aspire_5920g \ + src/keymap/keymaps/acer-aspire_6920 \ + src/keymap/keymaps/acer-travelmate_c300 \ + src/keymap/keymaps/asus \ + src/keymap/keymaps/compaq-e_evo \ + src/keymap/keymaps/dell \ + src/keymap/keymaps/dell-latitude-xt2 \ + src/keymap/keymaps/everex-xt5000 \ + src/keymap/keymaps/fujitsu-amilo_li_2732 \ + src/keymap/keymaps/fujitsu-amilo_pa_2548 \ + src/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 \ + src/keymap/keymaps/fujitsu-amilo_pro_v3205 \ + src/keymap/keymaps/fujitsu-amilo_si_1520 \ + src/keymap/keymaps/fujitsu-esprimo_mobile_v5 \ + src/keymap/keymaps/fujitsu-esprimo_mobile_v6 \ + src/keymap/keymaps/genius-slimstar-320 \ + src/keymap/keymaps/hewlett-packard \ + src/keymap/keymaps/hewlett-packard-2510p_2530p \ + src/keymap/keymaps/hewlett-packard-compaq_elitebook \ + src/keymap/keymaps/hewlett-packard-pavilion \ + src/keymap/keymaps/hewlett-packard-presario-2100 \ + src/keymap/keymaps/hewlett-packard-tablet \ + src/keymap/keymaps/hewlett-packard-tx2 \ + src/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint \ + src/keymap/keymaps/inventec-symphony_6.0_7.0 \ + src/keymap/keymaps/lenovo-3000 \ + src/keymap/keymaps/lenovo-ideapad \ + src/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint \ + src/keymap/keymaps/lenovo-thinkpad_x6_tablet \ + src/keymap/keymaps/lenovo-thinkpad_x200_tablet \ + src/keymap/keymaps/lg-x110 \ + src/keymap/keymaps/logitech-wave \ + src/keymap/keymaps/logitech-wave-cordless \ + src/keymap/keymaps/logitech-wave-pro-cordless \ + src/keymap/keymaps/maxdata-pro_7000 \ + src/keymap/keymaps/medion-fid2060 \ + src/keymap/keymaps/medionnb-a555 \ + src/keymap/keymaps/micro-star \ + src/keymap/keymaps/module-asus-w3j \ + src/keymap/keymaps/module-ibm \ + src/keymap/keymaps/module-lenovo \ + src/keymap/keymaps/module-sony \ + src/keymap/keymaps/module-sony-old \ + src/keymap/keymaps/module-sony-vgn \ + src/keymap/keymaps/olpc-xo \ + src/keymap/keymaps/onkyo \ + src/keymap/keymaps/oqo-model2 \ + src/keymap/keymaps/samsung-other \ + src/keymap/keymaps/samsung-sq1us \ + src/keymap/keymaps/samsung-sx20s \ + src/keymap/keymaps/toshiba-satellite_a100 \ + src/keymap/keymaps/toshiba-satellite_a110 \ + src/keymap/keymaps/toshiba-satellite_m30x \ + src/keymap/keymaps/zepto-znote udevkeymapforcereldir = $(libexecdir)/udev/keymaps/force-release dist_udevkeymapforcerel_DATA = \ - src/extras/keymap/force-release-maps/dell-touchpad \ - src/extras/keymap/force-release-maps/hp-other \ - src/extras/keymap/force-release-maps/samsung-other \ - src/extras/keymap/force-release-maps/common-volume-keys + src/keymap/force-release-maps/dell-touchpad \ + src/keymap/force-release-maps/hp-other \ + src/keymap/force-release-maps/samsung-other \ + src/keymap/force-release-maps/common-volume-keys -src/extras/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h - $(AM_V_at)mkdir -p src/extras/keymap +src/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h + $(AM_V_at)mkdir -p src/keymap $(AM_V_GEN)$(AWK) '/^#define.*KEY_[^ ]+[ \t]+[0-9]/ { if ($$2 != "KEY_MAX") { print $$2 } }' < $< | sed 's/^KEY_COFFEE$$/KEY_SCREENLOCK/' > $@ -src/extras/keymap/keys-from-name.gperf: src/extras/keymap/keys.txt +src/keymap/keys-from-name.gperf: src/keymap/keys.txt $(AM_V_GEN)$(AWK) 'BEGIN{ print "struct key { const char* name; unsigned short id; };"; print "%null-strings"; print "%%";} { print $$1 ", " $$1 }' < $< > $@ -src/extras/keymap/keys-from-name.h: src/extras/keymap/keys-from-name.gperf Makefile +src/keymap/keys-from-name.h: src/keymap/keys-from-name.gperf Makefile $(AM_V_GEN)$(GPERF) -L ANSI-C -t --ignore-case -N lookup_key -H hash_key_name -p -C < $< > $@ -src/extras/keymap/keys-to-name.h: src/extras/keymap/keys.txt Makefile +src/keymap/keys-to-name.h: src/keymap/keys.txt Makefile $(AM_V_GEN)$(AWK) 'BEGIN{ print "const char* const key_names[KEY_CNT] = { "} { print "[" $$1 "] = \"" $$1 "\"," } END{print "};"}' < $< > $@ -keymaps-distcheck-hook: src/extras/keymap/keys.txt - $(top_srcdir)/src/extras/keymap/check-keymaps.sh $(top_srcdir) $^ +keymaps-distcheck-hook: src/keymap/keys.txt + $(top_srcdir)/src/keymap/check-keymaps.sh $(top_srcdir) $^ DISTCHECK_HOOKS += keymaps-distcheck-hook endif @@ -650,13 +650,13 @@ if ENABLE_MTD_PROBE # ------------------------------------------------------------------------------ # mtd_probe - autoloads FTL module for mtd devices # ------------------------------------------------------------------------------ -src_extras_mtd_probe_mtd_probe_SOURCES = \ - src/extras/mtd_probe/mtd_probe.c \ - src/extras/mtd_probe/mtd_probe.h \ - src/extras/mtd_probe/probe_smartmedia.c -src_extras_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) -dist_udevrules_DATA += src/extras/mtd_probe/75-probe_mtd.rules -pkglibexec_PROGRAMS += src/extras/mtd_probe/mtd_probe +src_mtd_probe_mtd_probe_SOURCES = \ + src/mtd_probe/mtd_probe.c \ + src/mtd_probe/mtd_probe.h \ + src/mtd_probe/probe_smartmedia.c +src_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +dist_udevrules_DATA += src/mtd_probe/75-probe_mtd.rules +pkglibexec_PROGRAMS += src/mtd_probe/mtd_probe endif if ENABLE_RULE_GENERATOR @@ -664,35 +664,35 @@ if ENABLE_RULE_GENERATOR # rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ dist_udevhome_SCRIPTS += \ - src/extras/rule_generator/write_cd_rules \ - src/extras/rule_generator/write_net_rules + src/rule_generator/write_cd_rules \ + src/rule_generator/write_net_rules dist_udevhome_DATA += \ - src/extras/rule_generator/rule_generator.functions + src/rule_generator/rule_generator.functions dist_udevrules_DATA += \ - src/extras/rule_generator/75-cd-aliases-generator.rules \ - src/extras/rule_generator/75-persistent-net-generator.rules + src/rule_generator/75-cd-aliases-generator.rules \ + src/rule_generator/75-persistent-net-generator.rules endif if ENABLE_FLOPPY # ------------------------------------------------------------------------------ # create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) # ------------------------------------------------------------------------------ -src_create_floppy_devices_SOURCES = src/extras/floppy/create_floppy_devices.c +src_create_floppy_devices_SOURCES = src/floppy/create_floppy_devices.c src_create_floppy_devices_LDADD = src/libudev-private.la pkglibexec_PROGRAMS += src/create_floppy_devices -dist_udevrules_DATA += src/extras/floppy/60-floppy.rules +dist_udevrules_DATA += src/floppy/60-floppy.rules endif if ENABLE_EDD # ------------------------------------------------------------------------------ # edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data # ------------------------------------------------------------------------------ -src_edd_id_SOURCES = src/extras/edd_id/edd_id.c -src_edd_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/edd_id -dist_udevrules_DATA += src/extras/edd_id/61-persistent-storage-edd.rules +src__edd_id_edd_id_SOURCES = src/edd_id/edd_id.c +src_edd_id_edd_id_LDADD = src/libudev-private.la +pkglibexec_PROGRAMS += src/edd_id/edd_id +dist_udevrules_DATA += src/edd_id/61-persistent-storage-edd.rules endif # ------------------------------------------------------------------------------ @@ -763,5 +763,5 @@ doc-sync: for i in src/*.html; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/udev/; done for i in src/docs/html/*.{html,css,png}; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done for i in src/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/libudev/; done - for i in src/extras/gudev/docs/html/*.{html,css,png}; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done - for i in src/extras/gudev/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/gudev/; done + for i in src/gudev/docs/html/*.{html,css,png}; do rm -f $$i.sign; gpg --armor --detach-sign --output=$$i.sign $$i; done + for i in src/gudev/docs/html/*.{html,css,png}; do echo $$i; kup put $$i $$i.sign /pub/linux/utils/kernel/hotplug/gudev/; done diff --git a/configure.ac b/configure.ac index 2e750babe8..8f6e004392 100644 --- a/configure.ac +++ b/configure.ac @@ -205,8 +205,8 @@ AC_CONFIG_FILES([ Makefile src/docs/Makefile src/docs/version.xml - src/extras/gudev/docs/Makefile - src/extras/gudev/docs/version.xml + src/gudev/docs/Makefile + src/gudev/docs/version.xml ]) AC_OUTPUT diff --git a/rules/misc/30-kernel-compat.rules b/rules/misc/30-kernel-compat.rules index cddf371d3b..2596095506 100644 --- a/rules/misc/30-kernel-compat.rules +++ b/rules/misc/30-kernel-compat.rules @@ -7,7 +7,7 @@ ACTION!="add", GOTO="kernel_compat_end" -# see src/extras/qemu/42-qemu-usb.rules, version for 2.6.32 + older. +# see src/qemu/42-qemu-usb.rules, version for 2.6.32 + older. ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" diff --git a/src/accelerometer/.gitignore b/src/accelerometer/.gitignore new file mode 100644 index 0000000000..dddc2204d4 --- /dev/null +++ b/src/accelerometer/.gitignore @@ -0,0 +1 @@ +accelerometer diff --git a/src/accelerometer/61-accelerometer.rules b/src/accelerometer/61-accelerometer.rules new file mode 100644 index 0000000000..a6a2bfd088 --- /dev/null +++ b/src/accelerometer/61-accelerometer.rules @@ -0,0 +1,3 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="input", ACTION!="remove", ENV{ID_INPUT_ACCELEROMETER}=="1", IMPORT{program}="accelerometer %p" diff --git a/src/accelerometer/accelerometer.c b/src/accelerometer/accelerometer.c new file mode 100644 index 0000000000..bc9715b264 --- /dev/null +++ b/src/accelerometer/accelerometer.c @@ -0,0 +1,357 @@ +/* + * accelerometer - exports device orientation through property + * + * When an "change" event is received on an accelerometer, + * open its device node, and from the value, as well as the previous + * value of the property, calculate the device's new orientation, + * and export it as ID_INPUT_ACCELEROMETER_ORIENTATION. + * + * Possible values are: + * undefined + * * normal + * * bottom-up + * * left-up + * * right-up + * + * The property will be persistent across sessions, and the new + * orientations can be deducted from the previous one (it allows + * for a threshold for switching between opposite ends of the + * orientation). + * + * Copyright (C) 2011 Red Hat, Inc. + * Author: + * Bastien Nocera + * + * orientation_calc() from the sensorfw package + * Copyright (C) 2009-2010 Nokia Corporation + * Authors: + * Üstün Ergenoglu + * Timo Rongas + * Lihan Guo + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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 keymap; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +/* we must use this kernel-compatible implementation */ +#define BITS_PER_LONG (sizeof(unsigned long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<> OFF(bit)) & 1) + +static int debug = 0; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } +} + +typedef enum { + ORIENTATION_UNDEFINED, + ORIENTATION_NORMAL, + ORIENTATION_BOTTOM_UP, + ORIENTATION_LEFT_UP, + ORIENTATION_RIGHT_UP +} OrientationUp; + +static const char *orientations[] = { + "undefined", + "normal", + "bottom-up", + "left-up", + "right-up", + NULL +}; + +#define ORIENTATION_UP_UP ORIENTATION_NORMAL + +#define DEFAULT_THRESHOLD 250 +#define RADIANS_TO_DEGREES 180.0/M_PI +#define SAME_AXIS_LIMIT 5 + +#define THRESHOLD_LANDSCAPE 25 +#define THRESHOLD_PORTRAIT 20 + +static const char * +orientation_to_string (OrientationUp o) +{ + return orientations[o]; +} + +static OrientationUp +string_to_orientation (const char *orientation) +{ + int i; + + if (orientation == NULL) + return ORIENTATION_UNDEFINED; + for (i = 0; orientations[i] != NULL; i++) { + if (strcmp (orientation, orientations[i]) == 0) + return i; + } + return ORIENTATION_UNDEFINED; +} + +static OrientationUp +orientation_calc (OrientationUp prev, + int x, int y, int z) +{ + int rotation; + OrientationUp ret = prev; + + /* Portrait check */ + rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_PORTRAIT) { + ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP; + + /* Some threshold to switching between portrait modes */ + if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + + } else { + /* Landscape check */ + rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES); + + if (abs(rotation) > THRESHOLD_LANDSCAPE) { + ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL; + + /* Some threshold to switching between landscape modes */ + if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) { + if (abs(rotation) < SAME_AXIS_LIMIT) { + ret = prev; + } + } + } + } + + return ret; +} + +static OrientationUp +get_prev_orientation(struct udev_device *dev) +{ + const char *value; + + value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); + if (value == NULL) + return ORIENTATION_UNDEFINED; + return string_to_orientation(value); +} + +#define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = 1; } } + +/* accelerometers */ +static void test_orientation(struct udev *udev, + struct udev_device *dev, + const char *devpath) +{ + OrientationUp old, new; + int fd, r; + struct input_event ev[64]; + int got_syn = 0; + int got_x, got_y, got_z; + int x = 0, y = 0, z = 0; + char text[64]; + + old = get_prev_orientation(dev); + + if ((fd = open(devpath, O_RDONLY)) < 0) + return; + + got_x = got_y = got_z = 0; + + while (1) { + int i; + + r = read(fd, ev, sizeof(struct input_event) * 64); + + if (r < (int) sizeof(struct input_event)) + return; + + for (i = 0; i < r / (int) sizeof(struct input_event); i++) { + if (got_syn == 1) { + if (ev[i].type == EV_ABS) { + SET_AXIS(x, ABS_X); + SET_AXIS(y, ABS_Y); + SET_AXIS(z, ABS_Z); + } + } + if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) { + got_syn = 1; + } + if (got_x && got_y && got_z) + goto read_dev; + } + } + +read_dev: + close(fd); + + if (!got_x || !got_y || !got_z) + return; + + new = orientation_calc(old, x, y, z); + snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new)); + puts(text); +} + +static void help(void) +{ + printf("Usage: accelerometer [options] \n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); +} + +int main (int argc, char** argv) +{ + struct udev *udev; + struct udev_device *dev; + + static const struct option options[] = { + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + char devpath[PATH_MAX]; + char *devnode; + const char *id_path; + struct udev_enumerate *enumerate; + struct udev_list_entry *list_entry; + + udev = udev_new(); + if (udev == NULL) + return 1; + + udev_log_init("input_id"); + udev_set_log_fn(udev, log_fn); + + /* CLI argument parsing */ + while (1) { + int option; + + option = getopt_long(argc, argv, "dxh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'd': + debug = 1; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + help(); + exit(0); + default: + exit(1); + } + } + + if (argv[optind] == NULL) { + help(); + exit(1); + } + + /* get the device */ + snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); + dev = udev_device_new_from_syspath(udev, devpath); + if (dev == NULL) { + fprintf(stderr, "unable to access '%s'\n", devpath); + return 1; + } + + id_path = udev_device_get_property_value(dev, "ID_PATH"); + if (id_path == NULL) { + fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath); + return 0; + } + + /* Get the children devices and find the devnode + * FIXME: use udev_enumerate_add_match_children() instead + * when it's available */ + devnode = NULL; + enumerate = udev_enumerate_new(udev); + udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path); + udev_enumerate_add_match_subsystem(enumerate, "input"); + udev_enumerate_scan_devices(enumerate); + udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { + struct udev_device *device; + const char *node; + + device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), + udev_list_entry_get_name(list_entry)); + if (device == NULL) + continue; + /* Already found it */ + if (devnode != NULL) { + udev_device_unref(device); + continue; + } + + node = udev_device_get_devnode(device); + if (node == NULL) { + udev_device_unref(device); + continue; + } + /* Use the event sub-device */ + if (strstr(node, "/event") == NULL) { + udev_device_unref(device); + continue; + } + + devnode = strdup(node); + udev_device_unref(device); + } + + if (devnode == NULL) { + fprintf(stderr, "unable to get device node for '%s'\n", devpath); + return 0; + } + + info(udev, "Opening accelerometer device %s\n", devnode); + test_orientation(udev, dev, devnode); + free(devnode); + + return 0; +} diff --git a/src/ata_id/.gitignore b/src/ata_id/.gitignore new file mode 100644 index 0000000000..77837266e6 --- /dev/null +++ b/src/ata_id/.gitignore @@ -0,0 +1 @@ +ata_id diff --git a/src/ata_id/ata_id.c b/src/ata_id/ata_id.c new file mode 100644 index 0000000000..257f494496 --- /dev/null +++ b/src/ata_id/ata_id.c @@ -0,0 +1,726 @@ +/* + * ata_id - reads product/serial number from ATA drives + * + * Copyright (C) 2005-2008 Kay Sievers + * Copyright (C) 2009 Lennart Poettering + * Copyright (C) 2009-2010 David Zeuthen + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +#define COMMAND_TIMEOUT_MSEC (30 * 1000) + +static int disk_scsi_inquiry_command(int fd, + void *buf, + size_t buf_len) +{ + struct sg_io_v4 io_v4; + uint8_t cdb[6]; + uint8_t sense[32]; + int ret; + + /* + * INQUIRY, see SPC-4 section 6.4 + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0x12; /* OPERATION CODE: INQUIRY */ + cdb[3] = (buf_len >> 8); /* ALLOCATION LENGTH */ + cdb[4] = (buf_len & 0xff); + + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + + /* even if the ioctl succeeds, we need to check the return value */ + if (!(io_hdr.status == 0 && + io_hdr.host_status == 0 && + io_hdr.driver_status == 0)) { + errno = EIO; + ret = -1; + goto out; + } + } else { + goto out; + } + } + + /* even if the ioctl succeeds, we need to check the return value */ + if (!(io_v4.device_status == 0 && + io_v4.transport_status == 0 && + io_v4.driver_status == 0)) { + errno = EIO; + ret = -1; + goto out; + } + + out: + return ret; +} + +static int disk_identify_command(int fd, + void *buf, + size_t buf_len) +{ + struct sg_io_v4 io_v4; + uint8_t cdb[12]; + uint8_t sense[32]; + uint8_t *desc = sense+8; + int ret; + + /* + * ATA Pass-Through 12 byte command, as described in + * + * T10 04-262r8 ATA Command Pass-Through + * + * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0xa1; /* OPERATION CODE: 12 byte pass through */ + cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ + cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ + cdb[3] = 0; /* FEATURES */ + cdb[4] = 1; /* SECTORS */ + cdb[5] = 0; /* LBA LOW */ + cdb[6] = 0; /* LBA MID */ + cdb[7] = 0; /* LBA HIGH */ + cdb[8] = 0 & 0x4F; /* SELECT */ + cdb[9] = 0xEC; /* Command: ATA IDENTIFY DEVICE */; + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + } else { + goto out; + } + } + + if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { + errno = EIO; + ret = -1; + goto out; + } + + out: + return ret; +} + +static int disk_identify_packet_device_command(int fd, + void *buf, + size_t buf_len) +{ + struct sg_io_v4 io_v4; + uint8_t cdb[16]; + uint8_t sense[32]; + uint8_t *desc = sense+8; + int ret; + + /* + * ATA Pass-Through 16 byte command, as described in + * + * T10 04-262r8 ATA Command Pass-Through + * + * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf + */ + memset(cdb, 0, sizeof(cdb)); + cdb[0] = 0x85; /* OPERATION CODE: 16 byte pass through */ + cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ + cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ + cdb[3] = 0; /* FEATURES */ + cdb[4] = 0; /* FEATURES */ + cdb[5] = 0; /* SECTORS */ + cdb[6] = 1; /* SECTORS */ + cdb[7] = 0; /* LBA LOW */ + cdb[8] = 0; /* LBA LOW */ + cdb[9] = 0; /* LBA MID */ + cdb[10] = 0; /* LBA MID */ + cdb[11] = 0; /* LBA HIGH */ + cdb[12] = 0; /* LBA HIGH */ + cdb[13] = 0; /* DEVICE */ + cdb[14] = 0xA1; /* Command: ATA IDENTIFY PACKET DEVICE */; + cdb[15] = 0; /* CONTROL */ + memset(sense, 0, sizeof(sense)); + + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof (cdb); + io_v4.request = (uintptr_t) cdb; + io_v4.max_response_len = sizeof (sense); + io_v4.response = (uintptr_t) sense; + io_v4.din_xfer_len = buf_len; + io_v4.din_xferp = (uintptr_t) buf; + io_v4.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_v4); + if (ret != 0) { + /* could be that the driver doesn't do version 4, try version 3 */ + if (errno == EINVAL) { + struct sg_io_hdr io_hdr; + + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmdp = (unsigned char*) cdb; + io_hdr.cmd_len = sizeof (cdb); + io_hdr.dxferp = buf; + io_hdr.dxfer_len = buf_len; + io_hdr.sbp = sense; + io_hdr.mx_sb_len = sizeof (sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.timeout = COMMAND_TIMEOUT_MSEC; + + ret = ioctl(fd, SG_IO, &io_hdr); + if (ret != 0) + goto out; + } else { + goto out; + } + } + + if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { + errno = EIO; + ret = -1; + goto out; + } + + out: + return ret; +} + +/** + * disk_identify_get_string: + * @identify: A block of IDENTIFY data + * @offset_words: Offset of the string to get, in words. + * @dest: Destination buffer for the string. + * @dest_len: Length of destination buffer, in bytes. + * + * Copies the ATA string from @identify located at @offset_words into @dest. + */ +static void disk_identify_get_string(uint8_t identify[512], + unsigned int offset_words, + char *dest, + size_t dest_len) +{ + unsigned int c1; + unsigned int c2; + + assert(identify != NULL); + assert(dest != NULL); + assert((dest_len & 1) == 0); + + while (dest_len > 0) { + c1 = identify[offset_words * 2 + 1]; + c2 = identify[offset_words * 2]; + *dest = c1; + dest++; + *dest = c2; + dest++; + offset_words++; + dest_len -= 2; + } +} + +static void disk_identify_fixup_string(uint8_t identify[512], + unsigned int offset_words, + size_t len) +{ + disk_identify_get_string(identify, offset_words, + (char *) identify + offset_words * 2, len); +} + +static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offset_words) +{ + uint16_t *p; + + p = (uint16_t *) identify; + p[offset_words] = le16toh (p[offset_words]); +} + +/** + * disk_identify: + * @udev: The libudev context. + * @fd: File descriptor for the block device. + * @out_identify: Return location for IDENTIFY data. + * @out_is_packet_device: Return location for whether returned data is from a IDENTIFY PACKET DEVICE. + * + * Sends the IDENTIFY DEVICE or IDENTIFY PACKET DEVICE command to the + * device represented by @fd. If successful, then the result will be + * copied into @out_identify and @out_is_packet_device. + * + * This routine is based on code from libatasmart, Copyright 2008 + * Lennart Poettering, LGPL v2.1. + * + * Returns: 0 if the data was successfully obtained, otherwise + * non-zero with errno set. + */ +static int disk_identify(struct udev *udev, + int fd, + uint8_t out_identify[512], + int *out_is_packet_device) +{ + int ret; + uint8_t inquiry_buf[36]; + int peripheral_device_type; + int all_nul_bytes; + int n; + int is_packet_device; + + assert(out_identify != NULL); + + /* init results */ + ret = -1; + memset(out_identify, '\0', 512); + is_packet_device = 0; + + /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device + * we could accidentally blank media. This is because MMC's BLANK + * command has the same op-code (0x61). + * + * To prevent this from happening we bail out if the device + * isn't a Direct Access Block Device, e.g. SCSI type 0x00 + * (CD/DVD devices are type 0x05). So we send a SCSI INQUIRY + * command first... libata is handling this via its SCSI + * emulation layer. + * + * This also ensures that we're actually dealing with a device + * that understands SCSI commands. + * + * (Yes, it is a bit perverse that we're tunneling the ATA + * command through SCSI and relying on the ATA driver + * emulating SCSI well-enough...) + * + * (See commit 160b069c25690bfb0c785994c7c3710289179107 for + * the original bug-fix and see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635 + * for the original bug-report.) + */ + ret = disk_scsi_inquiry_command (fd, inquiry_buf, sizeof (inquiry_buf)); + if (ret != 0) + goto out; + + /* SPC-4, section 6.4.2: Standard INQUIRY data */ + peripheral_device_type = inquiry_buf[0] & 0x1f; + if (peripheral_device_type == 0x05) + { + is_packet_device = 1; + ret = disk_identify_packet_device_command(fd, out_identify, 512); + goto check_nul_bytes; + } + if (peripheral_device_type != 0x00) { + ret = -1; + errno = EIO; + goto out; + } + + /* OK, now issue the IDENTIFY DEVICE command */ + ret = disk_identify_command(fd, out_identify, 512); + if (ret != 0) + goto out; + + check_nul_bytes: + /* Check if IDENTIFY data is all NUL bytes - if so, bail */ + all_nul_bytes = 1; + for (n = 0; n < 512; n++) { + if (out_identify[n] != '\0') { + all_nul_bytes = 0; + break; + } + } + + if (all_nul_bytes) { + ret = -1; + errno = EIO; + goto out; + } + +out: + if (out_is_packet_device != NULL) + *out_is_packet_device = is_packet_device; + return ret; +} + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + vsyslog(priority, format, args); +} + +int main(int argc, char *argv[]) +{ + struct udev *udev; + struct hd_driveid id; + uint8_t identify[512]; + uint16_t *identify_words; + char model[41]; + char model_enc[256]; + char serial[21]; + char revision[9]; + const char *node = NULL; + int export = 0; + int fd; + uint16_t word; + int rc = 0; + int is_packet_device = 0; + static const struct option options[] = { + { "export", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("ata_id"); + udev_set_log_fn(udev, log_fn); + + while (1) { + int option; + + option = getopt_long(argc, argv, "xh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'x': + export = 1; + break; + case 'h': + printf("Usage: ata_id [--export] [--help] \n" + " --export print values as environment keys\n" + " --help print this help text\n\n"); + goto exit; + } + } + + node = argv[optind]; + if (node == NULL) { + err(udev, "no node specified\n"); + rc = 1; + goto exit; + } + + fd = open(node, O_RDONLY|O_NONBLOCK); + if (fd < 0) { + err(udev, "unable to open '%s'\n", node); + rc = 1; + goto exit; + } + + if (disk_identify(udev, fd, identify, &is_packet_device) == 0) { + /* + * fix up only the fields from the IDENTIFY data that we are going to + * use and copy it into the hd_driveid struct for convenience + */ + disk_identify_fixup_string (identify, 10, 20); /* serial */ + disk_identify_fixup_string (identify, 23, 6); /* fwrev */ + disk_identify_fixup_string (identify, 27, 40); /* model */ + disk_identify_fixup_uint16 (identify, 0); /* configuration */ + disk_identify_fixup_uint16 (identify, 75); /* queue depth */ + disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ + disk_identify_fixup_uint16 (identify, 82); /* command set supported */ + disk_identify_fixup_uint16 (identify, 83); /* command set supported */ + disk_identify_fixup_uint16 (identify, 84); /* command set supported */ + disk_identify_fixup_uint16 (identify, 85); /* command set supported */ + disk_identify_fixup_uint16 (identify, 86); /* command set supported */ + disk_identify_fixup_uint16 (identify, 87); /* command set supported */ + disk_identify_fixup_uint16 (identify, 89); /* time required for SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 90); /* time required for enhanced SECURITY ERASE UNIT */ + disk_identify_fixup_uint16 (identify, 91); /* current APM values */ + disk_identify_fixup_uint16 (identify, 94); /* current AAM value */ + disk_identify_fixup_uint16 (identify, 128); /* device lock function */ + disk_identify_fixup_uint16 (identify, 217); /* nominal media rotation rate */ + memcpy(&id, identify, sizeof id); + } else { + /* If this fails, then try HDIO_GET_IDENTITY */ + if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) { + if (errno == ENOTTY) { + info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); + rc = 2; + } else { + err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); + rc = 3; + } + goto close; + } + } + identify_words = (uint16_t *) identify; + + memcpy (model, id.model, 40); + model[40] = '\0'; + udev_util_encode_string(model, model_enc, sizeof(model_enc)); + util_replace_whitespace((char *) id.model, model, 40); + util_replace_chars(model, NULL); + util_replace_whitespace((char *) id.serial_no, serial, 20); + util_replace_chars(serial, NULL); + util_replace_whitespace((char *) id.fw_rev, revision, 8); + util_replace_chars(revision, NULL); + + if (export) { + /* Set this to convey the disk speaks the ATA protocol */ + printf("ID_ATA=1\n"); + + if ((id.config >> 8) & 0x80) { + /* This is an ATAPI device */ + switch ((id.config >> 8) & 0x1f) { + case 0: + printf("ID_TYPE=cd\n"); + break; + case 1: + printf("ID_TYPE=tape\n"); + break; + case 5: + printf("ID_TYPE=cd\n"); + break; + case 7: + printf("ID_TYPE=optical\n"); + break; + default: + printf("ID_TYPE=generic\n"); + break; + } + } else { + printf("ID_TYPE=disk\n"); + } + printf("ID_BUS=ata\n"); + printf("ID_MODEL=%s\n", model); + printf("ID_MODEL_ENC=%s\n", model_enc); + printf("ID_REVISION=%s\n", revision); + if (serial[0] != '\0') { + printf("ID_SERIAL=%s_%s\n", model, serial); + printf("ID_SERIAL_SHORT=%s\n", serial); + } else { + printf("ID_SERIAL=%s\n", model); + } + + if (id.command_set_1 & (1<<5)) { + printf ("ID_ATA_WRITE_CACHE=1\n"); + printf ("ID_ATA_WRITE_CACHE_ENABLED=%d\n", (id.cfs_enable_1 & (1<<5)) ? 1 : 0); + } + if (id.command_set_1 & (1<<10)) { + printf("ID_ATA_FEATURE_SET_HPA=1\n"); + printf("ID_ATA_FEATURE_SET_HPA_ENABLED=%d\n", (id.cfs_enable_1 & (1<<10)) ? 1 : 0); + + /* + * TODO: use the READ NATIVE MAX ADDRESS command to get the native max address + * so it is easy to check whether the protected area is in use. + */ + } + if (id.command_set_1 & (1<<3)) { + printf("ID_ATA_FEATURE_SET_PM=1\n"); + printf("ID_ATA_FEATURE_SET_PM_ENABLED=%d\n", (id.cfs_enable_1 & (1<<3)) ? 1 : 0); + } + if (id.command_set_1 & (1<<1)) { + printf("ID_ATA_FEATURE_SET_SECURITY=1\n"); + printf("ID_ATA_FEATURE_SET_SECURITY_ENABLED=%d\n", (id.cfs_enable_1 & (1<<1)) ? 1 : 0); + printf("ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=%d\n", id.trseuc * 2); + if ((id.cfs_enable_1 & (1<<1))) /* enabled */ { + if (id.dlf & (1<<8)) + printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=maximum\n"); + else + printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=high\n"); + } + if (id.dlf & (1<<5)) + printf("ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=%d\n", id.trsEuc * 2); + if (id.dlf & (1<<4)) + printf("ID_ATA_FEATURE_SET_SECURITY_EXPIRE=1\n"); + if (id.dlf & (1<<3)) + printf("ID_ATA_FEATURE_SET_SECURITY_FROZEN=1\n"); + if (id.dlf & (1<<2)) + printf("ID_ATA_FEATURE_SET_SECURITY_LOCKED=1\n"); + } + if (id.command_set_1 & (1<<0)) { + printf("ID_ATA_FEATURE_SET_SMART=1\n"); + printf("ID_ATA_FEATURE_SET_SMART_ENABLED=%d\n", (id.cfs_enable_1 & (1<<0)) ? 1 : 0); + } + if (id.command_set_2 & (1<<9)) { + printf("ID_ATA_FEATURE_SET_AAM=1\n"); + printf("ID_ATA_FEATURE_SET_AAM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<9)) ? 1 : 0); + printf("ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=%d\n", id.acoustic >> 8); + printf("ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=%d\n", id.acoustic & 0xff); + } + if (id.command_set_2 & (1<<5)) { + printf("ID_ATA_FEATURE_SET_PUIS=1\n"); + printf("ID_ATA_FEATURE_SET_PUIS_ENABLED=%d\n", (id.cfs_enable_2 & (1<<5)) ? 1 : 0); + } + if (id.command_set_2 & (1<<3)) { + printf("ID_ATA_FEATURE_SET_APM=1\n"); + printf("ID_ATA_FEATURE_SET_APM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<3)) ? 1 : 0); + if ((id.cfs_enable_2 & (1<<3))) + printf("ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=%d\n", id.CurAPMvalues & 0xff); + } + if (id.command_set_2 & (1<<0)) + printf("ID_ATA_DOWNLOAD_MICROCODE=1\n"); + + /* + * Word 76 indicates the capabilities of a SATA device. A PATA device shall set + * word 76 to 0000h or FFFFh. If word 76 is set to 0000h or FFFFh, then + * the device does not claim compliance with the Serial ATA specification and words + * 76 through 79 are not valid and shall be ignored. + */ + word = *((uint16_t *) identify + 76); + if (word != 0x0000 && word != 0xffff) { + printf("ID_ATA_SATA=1\n"); + /* + * If bit 2 of word 76 is set to one, then the device supports the Gen2 + * signaling rate of 3.0 Gb/s (see SATA 2.6). + * + * If bit 1 of word 76 is set to one, then the device supports the Gen1 + * signaling rate of 1.5 Gb/s (see SATA 2.6). + */ + if (word & (1<<2)) + printf("ID_ATA_SATA_SIGNAL_RATE_GEN2=1\n"); + if (word & (1<<1)) + printf("ID_ATA_SATA_SIGNAL_RATE_GEN1=1\n"); + } + + /* Word 217 indicates the nominal media rotation rate of the device */ + word = *((uint16_t *) identify + 217); + if (word != 0x0000) { + if (word == 0x0001) { + printf ("ID_ATA_ROTATION_RATE_RPM=0\n"); /* non-rotating e.g. SSD */ + } else if (word >= 0x0401 && word <= 0xfffe) { + printf ("ID_ATA_ROTATION_RATE_RPM=%d\n", word); + } + } + + /* + * Words 108-111 contain a mandatory World Wide Name (WWN) in the NAA IEEE Registered identifier + * format. Word 108 bits (15:12) shall contain 5h, indicating that the naming authority is IEEE. + * All other values are reserved. + */ + word = *((uint16_t *) identify + 108); + if ((word & 0xf000) == 0x5000) { + uint64_t wwwn; + + wwwn = *((uint16_t *) identify + 108); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 109); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 110); + wwwn <<= 16; + wwwn |= *((uint16_t *) identify + 111); + printf("ID_WWN=0x%llx\n", (unsigned long long int) wwwn); + /* ATA devices have no vendor extension */ + printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn); + } + + /* from Linux's include/linux/ata.h */ + if (identify_words[0] == 0x848a || identify_words[0] == 0x844a) { + printf("ID_ATA_CFA=1\n"); + } else { + if ((identify_words[83] & 0xc004) == 0x4004) { + printf("ID_ATA_CFA=1\n"); + } + } + } else { + if (serial[0] != '\0') + printf("%s_%s\n", model, serial); + else + printf("%s\n", model); + } +close: + close(fd); +exit: + udev_unref(udev); + udev_log_close(); + return rc; +} diff --git a/src/cdrom_id/.gitignore b/src/cdrom_id/.gitignore new file mode 100644 index 0000000000..7d817ea74e --- /dev/null +++ b/src/cdrom_id/.gitignore @@ -0,0 +1 @@ +cdrom_id diff --git a/src/cdrom_id/60-cdrom_id.rules b/src/cdrom_id/60-cdrom_id.rules new file mode 100644 index 0000000000..6eaf76a72c --- /dev/null +++ b/src/cdrom_id/60-cdrom_id.rules @@ -0,0 +1,20 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="cdrom_end" +SUBSYSTEM!="block", GOTO="cdrom_end" +KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" +ENV{DEVTYPE}!="disk", GOTO="cdrom_end" + +# unconditionally tag device as CDROM +KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" + +# media eject button pressed +ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end" + +# import device and media properties and lock tray to +# enable the receiving of media eject button events +IMPORT{program}="cdrom_id --lock-media $devnode" + +KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100" + +LABEL="cdrom_end" diff --git a/src/cdrom_id/cdrom_id.c b/src/cdrom_id/cdrom_id.c new file mode 100644 index 0000000000..f90d52ec9c --- /dev/null +++ b/src/cdrom_id/cdrom_id.c @@ -0,0 +1,1099 @@ +/* + * cdrom_id - optical drive and media information prober + * + * Copyright (C) 2008-2010 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static bool debug; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + if (debug) { + fprintf(stderr, "%s: ", fn); + vfprintf(stderr, format, args); + } else { + vsyslog(priority, format, args); + } +} + +/* device info */ +static unsigned int cd_cd_rom; +static unsigned int cd_cd_r; +static unsigned int cd_cd_rw; +static unsigned int cd_dvd_rom; +static unsigned int cd_dvd_r; +static unsigned int cd_dvd_rw; +static unsigned int cd_dvd_ram; +static unsigned int cd_dvd_plus_r; +static unsigned int cd_dvd_plus_rw; +static unsigned int cd_dvd_plus_r_dl; +static unsigned int cd_dvd_plus_rw_dl; +static unsigned int cd_bd; +static unsigned int cd_bd_r; +static unsigned int cd_bd_re; +static unsigned int cd_hddvd; +static unsigned int cd_hddvd_r; +static unsigned int cd_hddvd_rw; +static unsigned int cd_mo; +static unsigned int cd_mrw; +static unsigned int cd_mrw_w; + +/* media info */ +static unsigned int cd_media; +static unsigned int cd_media_cd_rom; +static unsigned int cd_media_cd_r; +static unsigned int cd_media_cd_rw; +static unsigned int cd_media_dvd_rom; +static unsigned int cd_media_dvd_r; +static unsigned int cd_media_dvd_rw; +static unsigned int cd_media_dvd_rw_ro; /* restricted overwrite mode */ +static unsigned int cd_media_dvd_rw_seq; /* sequential mode */ +static unsigned int cd_media_dvd_ram; +static unsigned int cd_media_dvd_plus_r; +static unsigned int cd_media_dvd_plus_rw; +static unsigned int cd_media_dvd_plus_r_dl; +static unsigned int cd_media_dvd_plus_rw_dl; +static unsigned int cd_media_bd; +static unsigned int cd_media_bd_r; +static unsigned int cd_media_bd_re; +static unsigned int cd_media_hddvd; +static unsigned int cd_media_hddvd_r; +static unsigned int cd_media_hddvd_rw; +static unsigned int cd_media_mo; +static unsigned int cd_media_mrw; +static unsigned int cd_media_mrw_w; + +static const char *cd_media_state = NULL; +static unsigned int cd_media_session_next; +static unsigned int cd_media_session_count; +static unsigned int cd_media_track_count; +static unsigned int cd_media_track_count_data; +static unsigned int cd_media_track_count_audio; +static unsigned long long int cd_media_session_last_offset; + +#define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) +#define SK(errcode) (((errcode) >> 16) & 0xF) +#define ASC(errcode) (((errcode) >> 8) & 0xFF) +#define ASCQ(errcode) ((errcode) & 0xFF) + +static bool is_mounted(const char *device) +{ + struct stat statbuf; + FILE *fp; + int maj, min; + bool mounted = false; + + if (stat(device, &statbuf) < 0) + return -ENODEV; + + fp = fopen("/proc/self/mountinfo", "r"); + if (fp == NULL) + return -ENOSYS; + while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { + if (makedev(maj, min) == statbuf.st_rdev) { + mounted = true; + break; + } + } + fclose(fp); + return mounted; +} + +static void info_scsi_cmd_err(struct udev *udev, char *cmd, int err) +{ + if (err == -1) { + info(udev, "%s failed\n", cmd); + return; + } + info(udev, "%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); +} + +struct scsi_cmd { + struct cdrom_generic_command cgc; + union { + struct request_sense s; + unsigned char u[18]; + } _sense; + struct sg_io_hdr sg_io; +}; + +static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd) +{ + memset(cmd, 0x00, sizeof(struct scsi_cmd)); + cmd->cgc.quiet = 1; + cmd->cgc.sense = &cmd->_sense.s; + cmd->sg_io.interface_id = 'S'; + cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); + cmd->sg_io.cmdp = cmd->cgc.cmd; + cmd->sg_io.sbp = cmd->_sense.u; + cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; +} + +static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg) +{ + cmd->sg_io.cmd_len = i + 1; + cmd->cgc.cmd[i] = arg; +} + +#define CHECK_CONDITION 0x01 + +static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize) +{ + int ret = 0; + + if (bufsize > 0) { + cmd->sg_io.dxferp = buf; + cmd->sg_io.dxfer_len = bufsize; + cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + } else { + cmd->sg_io.dxfer_direction = SG_DXFER_NONE; + } + if (ioctl(fd, SG_IO, &cmd->sg_io)) + return -1; + + if ((cmd->sg_io.info & SG_INFO_OK_MASK) != SG_INFO_OK) { + errno = EIO; + ret = -1; + if (cmd->sg_io.masked_status & CHECK_CONDITION) { + ret = ERRCODE(cmd->_sense.u); + if (ret == 0) + ret = -1; + } + } + return ret; +} + +static int media_lock(struct udev *udev, int fd, bool lock) +{ + int err; + + /* disable the kernel's lock logic */ + err = ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK); + if (err < 0) + info(udev, "CDROM_CLEAR_OPTIONS, CDO_LOCK failed\n"); + + err = ioctl(fd, CDROM_LOCKDOOR, lock ? 1 : 0); + if (err < 0) + info(udev, "CDROM_LOCKDOOR failed\n"); + + return err; +} + +static int media_eject(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x1b); + scsi_cmd_set(udev, &sc, 4, 0x02); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, NULL, 0); + if ((err != 0)) { + info_scsi_cmd_err(udev, "START_STOP_UNIT", err); + return -1; + } + return 0; +} + +static int cd_capability_compat(struct udev *udev, int fd) +{ + int capability; + + capability = ioctl(fd, CDROM_GET_CAPABILITY, NULL); + if (capability < 0) { + info(udev, "CDROM_GET_CAPABILITY failed\n"); + return -1; + } + + if (capability & CDC_CD_R) + cd_cd_r = 1; + if (capability & CDC_CD_RW) + cd_cd_rw = 1; + if (capability & CDC_DVD) + cd_dvd_rom = 1; + if (capability & CDC_DVD_R) + cd_dvd_r = 1; + if (capability & CDC_DVD_RAM) + cd_dvd_ram = 1; + if (capability & CDC_MRW) + cd_mrw = 1; + if (capability & CDC_MRW_W) + cd_mrw_w = 1; + return 0; +} + +static int cd_media_compat(struct udev *udev, int fd) +{ + if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) { + info(udev, "CDROM_DRIVE_STATUS != CDS_DISC_OK\n"); + return -1; + } + cd_media = 1; + return 0; +} + +static int cd_inquiry(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char inq[128]; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x12); + scsi_cmd_set(udev, &sc, 4, 36); + scsi_cmd_set(udev, &sc, 5, 0); + err = scsi_cmd_run(udev, &sc, fd, inq, 36); + if ((err != 0)) { + info_scsi_cmd_err(udev, "INQUIRY", err); + return -1; + } + + if ((inq[0] & 0x1F) != 5) { + info(udev, "not an MMC unit\n"); + return -1; + } + + info(udev, "INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); + return 0; +} + +static void feature_profile_media(struct udev *udev, int cur_profile) +{ + switch (cur_profile) { + case 0x03: + case 0x04: + case 0x05: + info(udev, "profile 0x%02x \n", cur_profile); + cd_media = 1; + cd_media_mo = 1; + break; + case 0x08: + info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); + cd_media = 1; + cd_media_cd_rom = 1; + break; + case 0x09: + info(udev, "profile 0x%02x media_cd_r\n", cur_profile); + cd_media = 1; + cd_media_cd_r = 1; + break; + case 0x0a: + info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); + cd_media = 1; + cd_media_cd_rw = 1; + break; + case 0x10: + info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rom = 1; + break; + case 0x11: + info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_r = 1; + break; + case 0x12: + info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); + cd_media = 1; + cd_media_dvd_ram = 1; + break; + case 0x13: + info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_ro = 1; + break; + case 0x14: + info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); + cd_media = 1; + cd_media_dvd_rw = 1; + cd_media_dvd_rw_seq = 1; + break; + case 0x1B: + info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r = 1; + break; + case 0x1A: + info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw = 1; + break; + case 0x2A: + info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_rw_dl = 1; + break; + case 0x2B: + info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); + cd_media = 1; + cd_media_dvd_plus_r_dl = 1; + break; + case 0x40: + info(udev, "profile 0x%02x media_bd\n", cur_profile); + cd_media = 1; + cd_media_bd = 1; + break; + case 0x41: + case 0x42: + info(udev, "profile 0x%02x media_bd_r\n", cur_profile); + cd_media = 1; + cd_media_bd_r = 1; + break; + case 0x43: + info(udev, "profile 0x%02x media_bd_re\n", cur_profile); + cd_media = 1; + cd_media_bd_re = 1; + break; + case 0x50: + info(udev, "profile 0x%02x media_hddvd\n", cur_profile); + cd_media = 1; + cd_media_hddvd = 1; + break; + case 0x51: + info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); + cd_media = 1; + cd_media_hddvd_r = 1; + break; + case 0x52: + info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); + cd_media = 1; + cd_media_hddvd_rw = 1; + break; + default: + info(udev, "profile 0x%02x \n", cur_profile); + break; + } +} + +static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) +{ + unsigned int i; + + for (i = 0; i+4 <= size; i += 4) { + int profile; + + profile = profiles[i] << 8 | profiles[i+1]; + switch (profile) { + case 0x03: + case 0x04: + case 0x05: + info(udev, "profile 0x%02x mo\n", profile); + cd_mo = 1; + break; + case 0x08: + info(udev, "profile 0x%02x cd_rom\n", profile); + cd_cd_rom = 1; + break; + case 0x09: + info(udev, "profile 0x%02x cd_r\n", profile); + cd_cd_r = 1; + break; + case 0x0A: + info(udev, "profile 0x%02x cd_rw\n", profile); + cd_cd_rw = 1; + break; + case 0x10: + info(udev, "profile 0x%02x dvd_rom\n", profile); + cd_dvd_rom = 1; + break; + case 0x12: + info(udev, "profile 0x%02x dvd_ram\n", profile); + cd_dvd_ram = 1; + break; + case 0x13: + case 0x14: + info(udev, "profile 0x%02x dvd_rw\n", profile); + cd_dvd_rw = 1; + break; + case 0x1B: + info(udev, "profile 0x%02x dvd_plus_r\n", profile); + cd_dvd_plus_r = 1; + break; + case 0x1A: + info(udev, "profile 0x%02x dvd_plus_rw\n", profile); + cd_dvd_plus_rw = 1; + break; + case 0x2A: + info(udev, "profile 0x%02x dvd_plus_rw_dl\n", profile); + cd_dvd_plus_rw_dl = 1; + break; + case 0x2B: + info(udev, "profile 0x%02x dvd_plus_r_dl\n", profile); + cd_dvd_plus_r_dl = 1; + break; + case 0x40: + cd_bd = 1; + info(udev, "profile 0x%02x bd\n", profile); + break; + case 0x41: + case 0x42: + cd_bd_r = 1; + info(udev, "profile 0x%02x bd_r\n", profile); + break; + case 0x43: + cd_bd_re = 1; + info(udev, "profile 0x%02x bd_re\n", profile); + break; + case 0x50: + cd_hddvd = 1; + info(udev, "profile 0x%02x hddvd\n", profile); + break; + case 0x51: + cd_hddvd_r = 1; + info(udev, "profile 0x%02x hddvd_r\n", profile); + break; + case 0x52: + cd_hddvd_rw = 1; + info(udev, "profile 0x%02x hddvd_rw\n", profile); + break; + default: + info(udev, "profile 0x%02x \n", profile); + break; + } + } + return 0; +} + +/* returns 0 if media was detected */ +static int cd_profiles_old_mmc(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + int err; + + unsigned char header[32]; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); + if (cd_media == 1) { + info(udev, "no current profile, but disc is present; assuming CD-ROM\n"); + cd_media_cd_rom = 1; + return 0; + } else { + info(udev, "no current profile, assuming no media\n"); + return -1; + } + }; + + cd_media = 1; + + if (header[2] & 16) { + cd_media_cd_rw = 1; + info(udev, "profile 0x0a media_cd_rw\n"); + } else if ((header[2] & 3) < 2 && cd_cd_r) { + cd_media_cd_r = 1; + info(udev, "profile 0x09 media_cd_r\n"); + } else { + cd_media_cd_rom = 1; + info(udev, "profile 0x08 media_cd_rom\n"); + } + return 0; +} + +/* returns 0 if media was detected */ +static int cd_profiles(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char features[65530]; + unsigned int cur_profile = 0; + unsigned int len; + unsigned int i; + int err; + int ret; + + ret = -1; + + /* First query the current profile */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 8, 8); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, features, 8); + if ((err != 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ + if (SK(err) == 0x5 && ASC(err) == 0x20) { + info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n"); + info(udev, "trying to work around the problem\n"); + ret = cd_profiles_old_mmc(udev, fd); + } + goto out; + } + + cur_profile = features[6] << 8 | features[7]; + if (cur_profile > 0) { + info(udev, "current profile 0x%02x\n", cur_profile); + feature_profile_media (udev, cur_profile); + ret = 0; /* we have media */ + } else { + info(udev, "no current profile, assuming no media\n"); + } + + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; + info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); + len = sizeof(features); + } else if (len <= 8) { + len = sizeof(features); + } + + /* Now get the full feature buffer */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x46); + scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff); + scsi_cmd_set(udev, &sc, 8, len & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, features, len); + if ((err != 0)) { + info_scsi_cmd_err(udev, "GET CONFIGURATION", err); + return -1; + } + + /* parse the length once more, in case the drive decided to have other features suddenly :) */ + len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; + info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); + + if (len > sizeof(features)) { + info(udev, "can not get features in a single query, truncating\n"); + len = sizeof(features); + } + + /* device features */ + for (i = 8; i+4 < len; i += (4 + features[i+3])) { + unsigned int feature; + + feature = features[i] << 8 | features[i+1]; + + switch (feature) { + case 0x00: + info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); + feature_profiles(udev, &features[i]+4, features[i+3]); + break; + default: + info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); + break; + } + } +out: + return ret; +} + +static int cd_media_info(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char header[32]; + static const char *media_status[] = { + "blank", + "appendable", + "complete", + "other" + }; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x51); + scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); + return -1; + }; + + cd_media = 1; + info(udev, "disk type %02x\n", header[8]); + info(udev, "hardware reported media status: %s\n", media_status[header[2] & 3]); + + /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ + if (!cd_media_cd_rom) + cd_media_state = media_status[header[2] & 3]; + + /* fresh DVD-RW in restricted overwite mode reports itself as + * "appendable"; change it to "blank" to make it consistent with what + * gets reported after blanking, and what userspace expects */ + if (cd_media_dvd_rw_ro && (header[2] & 3) == 1) + cd_media_state = media_status[0]; + + /* DVD+RW discs (and DVD-RW in restricted mode) once formatted are + * always "complete", DVD-RAM are "other" or "complete" if the disc is + * write protected; we need to check the contents if it is blank */ + if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { + unsigned char buffer[32 * 2048]; + unsigned char result, len; + int block, offset; + + if (cd_media_dvd_ram) { + /* a write protected dvd-ram may report "complete" status */ + + unsigned char dvdstruct[8]; + unsigned char format[12]; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0xAD); + scsi_cmd_set(udev, &sc, 7, 0xC0); + scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); + scsi_cmd_set(udev, &sc, 11, 0); + err = scsi_cmd_run(udev, &sc, fd, dvdstruct, sizeof(dvdstruct)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DVD STRUCTURE", err); + return -1; + } + if (dvdstruct[4] & 0x02) { + cd_media_state = media_status[2]; + info(udev, "write-protected DVD-RAM media inserted\n"); + goto determined; + } + + /* let's make sure we don't try to read unformatted media */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x23); + scsi_cmd_set(udev, &sc, 8, sizeof(format)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, format, sizeof(format)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ DVD FORMAT CAPACITIES", err); + return -1; + } + + len = format[3]; + if (len & 7 || len < 16) { + info(udev, "invalid format capacities length\n"); + return -1; + } + + switch(format[8] & 3) { + case 1: + info(udev, "unformatted DVD-RAM media inserted\n"); + /* This means that last format was interrupted + * or failed, blank dvd-ram discs are factory + * formatted. Take no action here as it takes + * quite a while to reformat a dvd-ram and it's + * not automatically started */ + goto determined; + + case 2: + info(udev, "formatted DVD-RAM media inserted\n"); + break; + + case 3: + cd_media = 0; //return no media + info(udev, "format capacities returned no media\n"); + return -1; + } + } + + /* Take a closer look at formatted media (unformatted DVD+RW + * has "blank" status", DVD-RAM was examined earlier) and check + * for ISO and UDF PVDs or a fs superblock presence and do it + * in one ioctl (we need just sectors 0 and 16) */ + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x28); + scsi_cmd_set(udev, &sc, 5, 0); + scsi_cmd_set(udev, &sc, 8, 32); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); + if ((err != 0)) { + cd_media = 0; + info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err); + return -1; + } + + /* if any non-zero data is found in sector 16 (iso and udf) or + * eventually 0 (fat32 boot sector, ext2 superblock, etc), disc + * is assumed non-blank */ + result = 0; + + for (block = 32768; block >= 0 && !result; block -= 32768) { + offset = block; + while (offset < (block + 2048) && !result) { + result = buffer [offset]; + offset++; + } + } + + if (!result) { + cd_media_state = media_status[0]; + info(udev, "no data in blocks 0 or 16, assuming blank\n"); + } else { + info(udev, "data in blocks 0 or 16, assuming complete\n"); + } + } + +determined: + /* "other" is e. g. DVD-RAM, can't append sessions there; DVDs in + * restricted overwrite mode can never append, only in sequential mode */ + if ((header[2] & 3) < 2 && !cd_media_dvd_rw_ro) + cd_media_session_next = header[10] << 8 | header[5]; + cd_media_session_count = header[9] << 8 | header[4]; + cd_media_track_count = header[11] << 8 | header[6]; + + return 0; +} + +static int cd_media_toc(struct udev *udev, int fd) +{ + struct scsi_cmd sc; + unsigned char header[12]; + unsigned char toc[65536]; + unsigned int len, i, num_tracks; + unsigned char *p; + int err; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, 1); + scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC", err); + return -1; + } + + len = (header[0] << 8 | header[1]) + 2; + info(udev, "READ TOC: len: %d, start track: %d, end track: %d\n", len, header[2], header[3]); + if (len > sizeof(toc)) + return -1; + if (len < 2) + return -1; + /* 2: first track, 3: last track */ + num_tracks = header[3] - header[2] + 1; + + /* empty media has no tracks */ + if (len < 8) + return 0; + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ + scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); + scsi_cmd_set(udev, &sc, 8, len & 0xff); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, toc, len); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC (tracks)", err); + return -1; + } + + /* Take care to not iterate beyond the last valid track as specified in + * the TOC, but also avoid going beyond the TOC length, just in case + * the last track number is invalidly large */ + for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) { + unsigned int block; + unsigned int is_data_track; + + is_data_track = (p[1] & 0x04) != 0; + + block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; + info(udev, "track=%u info=0x%x(%s) start_block=%u\n", + p[2], p[1] & 0x0f, is_data_track ? "data":"audio", block); + + if (is_data_track) + cd_media_track_count_data++; + else + cd_media_track_count_audio++; + } + + scsi_cmd_init(udev, &sc); + scsi_cmd_set(udev, &sc, 0, 0x43); + scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ + scsi_cmd_set(udev, &sc, 8, sizeof(header)); + scsi_cmd_set(udev, &sc, 9, 0); + err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); + if ((err != 0)) { + info_scsi_cmd_err(udev, "READ TOC (multi session)", err); + return -1; + } + len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; + info(udev, "last track %u starts at block %u\n", header[4+2], len); + cd_media_session_last_offset = (unsigned long long int)len * 2048; + return 0; +} + +int main(int argc, char *argv[]) +{ + struct udev *udev; + static const struct option options[] = { + { "lock-media", no_argument, NULL, 'l' }, + { "unlock-media", no_argument, NULL, 'u' }, + { "eject-media", no_argument, NULL, 'e' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + bool eject = false; + bool lock = false; + bool unlock = false; + const char *node = NULL; + int fd = -1; + int cnt; + int rc = 0; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("cdrom_id"); + udev_set_log_fn(udev, log_fn); + + while (1) { + int option; + + option = getopt_long(argc, argv, "deluh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'l': + lock = true; + break; + case 'u': + unlock = true; + break; + case 'e': + eject = true; + break; + case 'd': + debug = true; + if (udev_get_log_priority(udev) < LOG_INFO) + udev_set_log_priority(udev, LOG_INFO); + break; + case 'h': + printf("Usage: cdrom_id [options] \n" + " --lock-media lock the media (to enable eject request events)\n" + " --unlock-media unlock the media\n" + " --eject-media eject the media\n" + " --debug debug to stderr\n" + " --help print this help text\n\n"); + goto exit; + default: + rc = 1; + goto exit; + } + } + + node = argv[optind]; + if (!node) { + err(udev, "no device\n"); + fprintf(stderr, "no device\n"); + rc = 1; + goto exit; + } + + srand((unsigned int)getpid()); + for (cnt = 20; cnt > 0; cnt--) { + struct timespec duration; + + fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); + if (fd >= 0 || errno != EBUSY) + break; + duration.tv_sec = 0; + duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); + nanosleep(&duration, NULL); + } + if (fd < 0) { + info(udev, "unable to open '%s'\n", node); + fprintf(stderr, "unable to open '%s'\n", node); + rc = 1; + goto exit; + } + info(udev, "probing: '%s'\n", node); + + /* same data as original cdrom_id */ + if (cd_capability_compat(udev, fd) < 0) { + rc = 1; + goto exit; + } + + /* check for media - don't bail if there's no media as we still need to + * to read profiles */ + cd_media_compat(udev, fd); + + /* check if drive talks MMC */ + if (cd_inquiry(udev, fd) < 0) + goto work; + + /* read drive and possibly current profile */ + if (cd_profiles(udev, fd) != 0) + goto work; + + /* at this point we are guaranteed to have media in the drive - find out more about it */ + + /* get session/track info */ + cd_media_toc(udev, fd); + + /* get writable media state */ + cd_media_info(udev, fd); + +work: + /* lock the media, so we enable eject button events */ + if (lock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (lock)\n"); + media_lock(udev, fd, true); + } + + if (unlock && cd_media) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + } + + if (eject) { + info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); + media_lock(udev, fd, false); + info(udev, "START_STOP_UNIT (eject)\n"); + media_eject(udev, fd); + } + + printf("ID_CDROM=1\n"); + if (cd_cd_rom) + printf("ID_CDROM_CD=1\n"); + if (cd_cd_r) + printf("ID_CDROM_CD_R=1\n"); + if (cd_cd_rw) + printf("ID_CDROM_CD_RW=1\n"); + if (cd_dvd_rom) + printf("ID_CDROM_DVD=1\n"); + if (cd_dvd_r) + printf("ID_CDROM_DVD_R=1\n"); + if (cd_dvd_rw) + printf("ID_CDROM_DVD_RW=1\n"); + if (cd_dvd_ram) + printf("ID_CDROM_DVD_RAM=1\n"); + if (cd_dvd_plus_r) + printf("ID_CDROM_DVD_PLUS_R=1\n"); + if (cd_dvd_plus_rw) + printf("ID_CDROM_DVD_PLUS_RW=1\n"); + if (cd_dvd_plus_r_dl) + printf("ID_CDROM_DVD_PLUS_R_DL=1\n"); + if (cd_dvd_plus_rw_dl) + printf("ID_CDROM_DVD_PLUS_RW_DL=1\n"); + if (cd_bd) + printf("ID_CDROM_BD=1\n"); + if (cd_bd_r) + printf("ID_CDROM_BD_R=1\n"); + if (cd_bd_re) + printf("ID_CDROM_BD_RE=1\n"); + if (cd_hddvd) + printf("ID_CDROM_HDDVD=1\n"); + if (cd_hddvd_r) + printf("ID_CDROM_HDDVD_R=1\n"); + if (cd_hddvd_rw) + printf("ID_CDROM_HDDVD_RW=1\n"); + if (cd_mo) + printf("ID_CDROM_MO=1\n"); + if (cd_mrw) + printf("ID_CDROM_MRW=1\n"); + if (cd_mrw_w) + printf("ID_CDROM_MRW_W=1\n"); + + if (cd_media) + printf("ID_CDROM_MEDIA=1\n"); + if (cd_media_mo) + printf("ID_CDROM_MEDIA_MO=1\n"); + if (cd_media_mrw) + printf("ID_CDROM_MEDIA_MRW=1\n"); + if (cd_media_mrw_w) + printf("ID_CDROM_MEDIA_MRW_W=1\n"); + if (cd_media_cd_rom) + printf("ID_CDROM_MEDIA_CD=1\n"); + if (cd_media_cd_r) + printf("ID_CDROM_MEDIA_CD_R=1\n"); + if (cd_media_cd_rw) + printf("ID_CDROM_MEDIA_CD_RW=1\n"); + if (cd_media_dvd_rom) + printf("ID_CDROM_MEDIA_DVD=1\n"); + if (cd_media_dvd_r) + printf("ID_CDROM_MEDIA_DVD_R=1\n"); + if (cd_media_dvd_ram) + printf("ID_CDROM_MEDIA_DVD_RAM=1\n"); + if (cd_media_dvd_rw) + printf("ID_CDROM_MEDIA_DVD_RW=1\n"); + if (cd_media_dvd_plus_r) + printf("ID_CDROM_MEDIA_DVD_PLUS_R=1\n"); + if (cd_media_dvd_plus_rw) + printf("ID_CDROM_MEDIA_DVD_PLUS_RW=1\n"); + if (cd_media_dvd_plus_rw_dl) + printf("ID_CDROM_MEDIA_DVD_PLUS_RW_DL=1\n"); + if (cd_media_dvd_plus_r_dl) + printf("ID_CDROM_MEDIA_DVD_PLUS_R_DL=1\n"); + if (cd_media_bd) + printf("ID_CDROM_MEDIA_BD=1\n"); + if (cd_media_bd_r) + printf("ID_CDROM_MEDIA_BD_R=1\n"); + if (cd_media_bd_re) + printf("ID_CDROM_MEDIA_BD_RE=1\n"); + if (cd_media_hddvd) + printf("ID_CDROM_MEDIA_HDDVD=1\n"); + if (cd_media_hddvd_r) + printf("ID_CDROM_MEDIA_HDDVD_R=1\n"); + if (cd_media_hddvd_rw) + printf("ID_CDROM_MEDIA_HDDVD_RW=1\n"); + + if (cd_media_state != NULL) + printf("ID_CDROM_MEDIA_STATE=%s\n", cd_media_state); + if (cd_media_session_next > 0) + printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); + if (cd_media_session_count > 0) + printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); + if (cd_media_session_count > 1 && cd_media_session_last_offset > 0) + printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); + if (cd_media_track_count > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); + if (cd_media_track_count_audio > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); + if (cd_media_track_count_data > 0) + printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); +exit: + if (fd >= 0) + close(fd); + udev_unref(udev); + udev_log_close(); + return rc; +} diff --git a/src/collect/.gitignore b/src/collect/.gitignore new file mode 100644 index 0000000000..c30ad6527c --- /dev/null +++ b/src/collect/.gitignore @@ -0,0 +1 @@ +collect diff --git a/src/collect/collect.c b/src/collect/collect.c new file mode 100644 index 0000000000..076fe479e2 --- /dev/null +++ b/src/collect/collect.c @@ -0,0 +1,473 @@ +/* + * Collect variables across events. + * + * usage: collect [--add|--remove] + * + * Adds ID to the list governed by . + * must be part of the ID list . + * If all IDs given by are listed (ie collect has been + * invoked for each ID in ) collect returns 0, the + * number of missing IDs otherwise. + * A negative number is returned on error. + * + * Copyright(C) 2007, Hannes Reinecke + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +#define BUFSIZE 16 +#define UDEV_ALARM_TIMEOUT 180 + +enum collect_state { + STATE_NONE, + STATE_OLD, + STATE_CONFIRMED, +}; + +struct _mate { + struct udev_list_node node; + char *name; + enum collect_state state; +}; + +static struct udev_list_node bunch; +static int debug; + +/* This can increase dynamically */ +static size_t bufsize = BUFSIZE; + +static struct _mate *node_to_mate(struct udev_list_node *node) +{ + char *mate; + + mate = (char *)node; + mate -= offsetof(struct _mate, node); + return (struct _mate *)mate; +} + +static void sig_alrm(int signo) +{ + exit(4); +} + +static void usage(void) +{ + printf("usage: collect [--add|--remove] [--debug] \n" + "\n" + " Adds ID to the list governed by .\n" + " must be part of the list .\n" + " If all IDs given by are listed (ie collect has been\n" + " invoked for each ID in ) collect returns 0, the\n" + " number of missing IDs otherwise.\n" + " On error a negative number is returned.\n" + "\n"); +} + +/* + * prepare + * + * Prepares the database file + */ +static int prepare(char *dir, char *filename) +{ + struct stat statbuf; + char buf[512]; + int fd; + + if (stat(dir, &statbuf) < 0) + mkdir(dir, 0700); + + sprintf(buf, "%s/%s", dir, filename); + + fd = open(buf,O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); + if (fd < 0) + fprintf(stderr, "Cannot open %s: %s\n", buf, strerror(errno)); + + if (lockf(fd,F_TLOCK,0) < 0) { + if (debug) + fprintf(stderr, "Lock taken, wait for %d seconds\n", UDEV_ALARM_TIMEOUT); + if (errno == EAGAIN || errno == EACCES) { + alarm(UDEV_ALARM_TIMEOUT); + lockf(fd, F_LOCK, 0); + if (debug) + fprintf(stderr, "Acquired lock on %s\n", buf); + } else { + if (debug) + fprintf(stderr, "Could not get lock on %s: %s\n", buf, strerror(errno)); + } + } + + return fd; +} + +/* + * Read checkpoint file + * + * Tricky reading this. We allocate a buffer twice as large + * as we're going to read. Then we read into the upper half + * of that buffer and start parsing. + * Once we do _not_ find end-of-work terminator (whitespace + * character) we move the upper half to the lower half, + * adjust the read pointer and read the next bit. + * Quite clever methinks :-) + * I should become a programmer ... + * + * Yes, one could have used fgets() for this. But then we'd + * have to use freopen etc which I found quite tedious. + */ +static int checkout(int fd) +{ + int len; + char *buf, *ptr, *word = NULL; + struct _mate *him; + + restart: + len = bufsize >> 1; + buf = calloc(1,bufsize + 1); + if (!buf) { + fprintf(stderr, "Out of memory\n"); + return -1; + } + memset(buf, ' ', bufsize); + ptr = buf + len; + while ((read(fd, buf + len, len)) > 0) { + while (ptr && *ptr) { + word = ptr; + ptr = strpbrk(word," \n\t\r"); + if (!ptr && word < (buf + len)) { + bufsize = bufsize << 1; + if (debug) + fprintf(stderr, "ID overflow, restarting with size %zi\n", bufsize); + free(buf); + lseek(fd, 0, SEEK_SET); + goto restart; + } + if (ptr) { + *ptr = '\0'; + ptr++; + if (!strlen(word)) + continue; + + if (debug) + fprintf(stderr, "Found word %s\n", word); + him = malloc(sizeof (struct _mate)); + him->name = strdup(word); + him->state = STATE_OLD; + udev_list_node_append(&him->node, &bunch); + word = NULL; + } + } + memcpy(buf, buf + len, len); + memset(buf + len, ' ', len); + + if (!ptr) + ptr = word; + if (!ptr) + break; + ptr -= len; + } + + free(buf); + return 0; +} + +/* + * invite + * + * Adds a new ID 'us' to the internal list, + * marks it as confirmed. + */ +static void invite(char *us) +{ + struct udev_list_node *him_node; + struct _mate *who = NULL; + + if (debug) + fprintf(stderr, "Adding ID '%s'\n", us); + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (!strcmp(him->name, us)) { + him->state = STATE_CONFIRMED; + who = him; + } + } + if (debug && !who) + fprintf(stderr, "ID '%s' not in database\n", us); + +} + +/* + * reject + * + * Marks the ID 'us' as invalid, + * causing it to be removed when the + * list is written out. + */ +static void reject(char *us) +{ + struct udev_list_node *him_node; + struct _mate *who = NULL; + + if (debug) + fprintf(stderr, "Removing ID '%s'\n", us); + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (!strcmp(him->name, us)) { + him->state = STATE_NONE; + who = him; + } + } + if (debug && !who) + fprintf(stderr, "ID '%s' not in database\n", us); +} + +/* + * kickout + * + * Remove all IDs in the internal list which are not part + * of the list passed via the commandline. + */ +static void kickout(void) +{ + struct udev_list_node *him_node; + struct udev_list_node *tmp; + + udev_list_node_foreach_safe(him_node, tmp, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (him->state == STATE_OLD) { + udev_list_node_remove(&him->node); + free(him->name); + free(him); + } + } +} + +/* + * missing + * + * Counts all missing IDs in the internal list. + */ +static int missing(int fd) +{ + char *buf; + int ret = 0; + struct udev_list_node *him_node; + + buf = malloc(bufsize); + if (!buf) + return -1; + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (him->state == STATE_NONE) { + ret++; + } else { + while (strlen(him->name)+1 >= bufsize) { + char *tmpbuf; + + bufsize = bufsize << 1; + tmpbuf = realloc(buf, bufsize); + if (!tmpbuf) { + free(buf); + return -1; + } + buf = tmpbuf; + } + snprintf(buf, strlen(him->name)+2, "%s ", him->name); + write(fd, buf, strlen(buf)); + } + } + + free(buf); + return ret; +} + +/* + * everybody + * + * Prints out the status of the internal list. + */ +static void everybody(void) +{ + struct udev_list_node *him_node; + const char *state = ""; + + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + switch (him->state) { + case STATE_NONE: + state = "none"; + break; + case STATE_OLD: + state = "old"; + break; + case STATE_CONFIRMED: + state = "confirmed"; + break; + } + fprintf(stderr, "ID: %s=%s\n", him->name, state); + } +} + +int main(int argc, char **argv) +{ + struct udev *udev; + static const struct option options[] = { + { "add", no_argument, NULL, 'a' }, + { "remove", no_argument, NULL, 'r' }, + { "debug", no_argument, NULL, 'd' }, + { "help", no_argument, NULL, 'h' }, + {} + }; + int argi; + char *checkpoint, *us; + int fd; + int i; + int ret = EXIT_SUCCESS; + int prune = 0; + char tmpdir[UTIL_PATH_SIZE]; + + udev = udev_new(); + if (udev == NULL) { + ret = EXIT_FAILURE; + goto exit; + } + + while (1) { + int option; + + option = getopt_long(argc, argv, "ardh", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'a': + prune = 0; + break; + case 'r': + prune = 1; + break; + case 'd': + debug = 1; + break; + case 'h': + usage(); + goto exit; + default: + ret = 1; + goto exit; + } + } + + argi = optind; + if (argi + 2 > argc) { + printf("Missing parameter(s)\n"); + ret = 1; + goto exit; + } + checkpoint = argv[argi++]; + us = argv[argi++]; + + if (signal(SIGALRM, sig_alrm) == SIG_ERR) { + fprintf(stderr, "Cannot set SIGALRM: %s\n", strerror(errno)); + ret = 2; + goto exit; + } + + udev_list_node_init(&bunch); + + if (debug) + fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); + + util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL); + fd = prepare(tmpdir, checkpoint); + if (fd < 0) { + ret = 3; + goto out; + } + + if (checkout(fd) < 0) { + ret = 2; + goto out; + } + + for (i = argi; i < argc; i++) { + struct udev_list_node *him_node; + struct _mate *who; + + who = NULL; + udev_list_node_foreach(him_node, &bunch) { + struct _mate *him = node_to_mate(him_node); + + if (!strcmp(him->name, argv[i])) + who = him; + } + if (!who) { + struct _mate *him; + + if (debug) + fprintf(stderr, "ID %s: not in database\n", argv[i]); + him = malloc(sizeof (struct _mate)); + him->name = malloc(strlen(argv[i]) + 1); + strcpy(him->name, argv[i]); + him->state = STATE_NONE; + udev_list_node_append(&him->node, &bunch); + } else { + if (debug) + fprintf(stderr, "ID %s: found in database\n", argv[i]); + who->state = STATE_CONFIRMED; + } + } + + if (prune) + reject(us); + else + invite(us); + + if (debug) { + everybody(); + fprintf(stderr, "Prune lists\n"); + } + kickout(); + + lseek(fd, 0, SEEK_SET); + ftruncate(fd, 0); + ret = missing(fd); + + lockf(fd, F_ULOCK, 0); + close(fd); +out: + if (debug) + everybody(); + if (ret >= 0) + printf("COLLECT_%s=%d\n", checkpoint, ret); +exit: + udev_unref(udev); + return ret; +} diff --git a/src/edd_id/.gitignore b/src/edd_id/.gitignore new file mode 100644 index 0000000000..14fb67c634 --- /dev/null +++ b/src/edd_id/.gitignore @@ -0,0 +1 @@ +edd_id diff --git a/src/edd_id/61-persistent-storage-edd.rules b/src/edd_id/61-persistent-storage-edd.rules new file mode 100644 index 0000000000..6b4fb8ecfe --- /dev/null +++ b/src/edd_id/61-persistent-storage-edd.rules @@ -0,0 +1,12 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="persistent_storage_edd_end" +SUBSYSTEM!="block", GOTO="persistent_storage_edd_end" +KERNEL!="sd*|hd*|cciss*", GOTO="persistent_storage_edd_end" + +# BIOS Enhanced Disk Device +ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $devnode" +ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" +ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" + +LABEL="persistent_storage_edd_end" diff --git a/src/edd_id/edd_id.c b/src/edd_id/edd_id.c new file mode 100644 index 0000000000..471ea60533 --- /dev/null +++ b/src/edd_id/edd_id.c @@ -0,0 +1,196 @@ +/* + * edd_id - naming of BIOS disk devices via EDD + * + * Copyright (C) 2005 John Hull + * Copyright (C) 2005 Kay Sievers + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + vsyslog(priority, format, args); +} + +int main(int argc, char *argv[]) +{ + struct udev *udev; + const char *node = NULL; + int i; + int export = 0; + uint32_t disk_id; + uint16_t mbr_valid; + struct dirent *dent; + int disk_fd; + int sysfs_fd; + DIR *dir = NULL; + int rc = 1; + char filename[UTIL_PATH_SIZE]; + char match[UTIL_PATH_SIZE]; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("edd_id"); + udev_set_log_fn(udev, log_fn); + + for (i = 1 ; i < argc; i++) { + char *arg = argv[i]; + + if (strcmp(arg, "--export") == 0) { + export = 1; + } else + node = arg; + } + if (node == NULL) { + err(udev, "no node specified\n"); + fprintf(stderr, "no node specified\n"); + goto exit; + } + + /* check for kernel support */ + util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/firmware/edd", NULL); + dir = opendir(filename); + if (dir == NULL) { + info(udev, "no kernel EDD support\n"); + fprintf(stderr, "no kernel EDD support\n"); + rc = 2; + goto exit; + } + + disk_fd = open(node, O_RDONLY); + if (disk_fd < 0) { + info(udev, "unable to open '%s'\n", node); + fprintf(stderr, "unable to open '%s'\n", node); + rc = 3; + goto closedir; + } + + /* check for valid MBR signature */ + if (lseek(disk_fd, 510, SEEK_SET) < 0) { + info(udev, "seek to MBR validity failed '%s'\n", node); + rc = 4; + goto close; + } + if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { + info(udev, "read MBR validity failed '%s'\n", node); + rc = 5; + goto close; + } + if (mbr_valid != 0xAA55) { + fprintf(stderr, "no valid MBR signature '%s'\n", node); + info(udev, "no valid MBR signature '%s'\n", node); + rc=6; + goto close; + } + + /* read EDD signature */ + if (lseek(disk_fd, 440, SEEK_SET) < 0) { + info(udev, "seek to signature failed '%s'\n", node); + rc = 7; + goto close; + } + if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { + info(udev, "read signature failed '%s'\n", node); + rc = 8; + goto close; + } + /* all zero is invalid */ + info(udev, "read id 0x%08x from '%s'\n", disk_id, node); + if (disk_id == 0) { + fprintf(stderr, "no EDD signature '%s'\n", node); + info(udev, "'%s' signature is zero\n", node); + rc = 9; + goto close; + } + + /* lookup signature in sysfs to determine the name */ + match[0] = '\0'; + for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { + char sysfs_id_buf[256]; + uint32_t sysfs_id; + ssize_t size; + + if (dent->d_name[0] == '.') + continue; + + util_strscpyl(filename, sizeof(filename), dent->d_name, "/mbr_signature", NULL); + sysfs_fd = openat(dirfd(dir), filename, O_RDONLY); + if (sysfs_fd < 0) { + info(udev, "unable to open sysfs '%s'\n", filename); + continue; + } + + size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); + close(sysfs_fd); + if (size <= 0) { + info(udev, "read sysfs '%s' failed\n", filename); + continue; + } + sysfs_id_buf[size] = '\0'; + info(udev, "read '%s' from '%s'\n", sysfs_id_buf, filename); + sysfs_id = strtoul(sysfs_id_buf, NULL, 16); + + /* look for matching value, that appears only once */ + if (disk_id == sysfs_id) { + if (match[0] == '\0') { + /* store id */ + util_strscpy(match, sizeof(match), dent->d_name); + } else { + /* error, same signature for another device */ + info(udev, "'%s' does not have a unique signature\n", node); + fprintf(stderr, "'%s' does not have a unique signature\n", node); + rc = 10; + goto exit; + } + } + } + + if (match[0] != '\0') { + if (export) + printf("ID_EDD=%s\n", match); + else + printf("%s\n", match); + rc = 0; + } + +close: + close(disk_fd); +closedir: + closedir(dir); +exit: + udev_unref(udev); + udev_log_close(); + return rc; +} diff --git a/src/extras/accelerometer/.gitignore b/src/extras/accelerometer/.gitignore deleted file mode 100644 index dddc2204d4..0000000000 --- a/src/extras/accelerometer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -accelerometer diff --git a/src/extras/accelerometer/61-accelerometer.rules b/src/extras/accelerometer/61-accelerometer.rules deleted file mode 100644 index a6a2bfd088..0000000000 --- a/src/extras/accelerometer/61-accelerometer.rules +++ /dev/null @@ -1,3 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM=="input", ACTION!="remove", ENV{ID_INPUT_ACCELEROMETER}=="1", IMPORT{program}="accelerometer %p" diff --git a/src/extras/accelerometer/accelerometer.c b/src/extras/accelerometer/accelerometer.c deleted file mode 100644 index bc9715b264..0000000000 --- a/src/extras/accelerometer/accelerometer.c +++ /dev/null @@ -1,357 +0,0 @@ -/* - * accelerometer - exports device orientation through property - * - * When an "change" event is received on an accelerometer, - * open its device node, and from the value, as well as the previous - * value of the property, calculate the device's new orientation, - * and export it as ID_INPUT_ACCELEROMETER_ORIENTATION. - * - * Possible values are: - * undefined - * * normal - * * bottom-up - * * left-up - * * right-up - * - * The property will be persistent across sessions, and the new - * orientations can be deducted from the previous one (it allows - * for a threshold for switching between opposite ends of the - * orientation). - * - * Copyright (C) 2011 Red Hat, Inc. - * Author: - * Bastien Nocera - * - * orientation_calc() from the sensorfw package - * Copyright (C) 2009-2010 Nokia Corporation - * Authors: - * Üstün Ergenoglu - * Timo Rongas - * Lihan Guo - * - * 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 keymap; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -/* we must use this kernel-compatible implementation */ -#define BITS_PER_LONG (sizeof(unsigned long) * 8) -#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) -#define OFF(x) ((x)%BITS_PER_LONG) -#define BIT(x) (1UL<> OFF(bit)) & 1) - -static int debug = 0; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -typedef enum { - ORIENTATION_UNDEFINED, - ORIENTATION_NORMAL, - ORIENTATION_BOTTOM_UP, - ORIENTATION_LEFT_UP, - ORIENTATION_RIGHT_UP -} OrientationUp; - -static const char *orientations[] = { - "undefined", - "normal", - "bottom-up", - "left-up", - "right-up", - NULL -}; - -#define ORIENTATION_UP_UP ORIENTATION_NORMAL - -#define DEFAULT_THRESHOLD 250 -#define RADIANS_TO_DEGREES 180.0/M_PI -#define SAME_AXIS_LIMIT 5 - -#define THRESHOLD_LANDSCAPE 25 -#define THRESHOLD_PORTRAIT 20 - -static const char * -orientation_to_string (OrientationUp o) -{ - return orientations[o]; -} - -static OrientationUp -string_to_orientation (const char *orientation) -{ - int i; - - if (orientation == NULL) - return ORIENTATION_UNDEFINED; - for (i = 0; orientations[i] != NULL; i++) { - if (strcmp (orientation, orientations[i]) == 0) - return i; - } - return ORIENTATION_UNDEFINED; -} - -static OrientationUp -orientation_calc (OrientationUp prev, - int x, int y, int z) -{ - int rotation; - OrientationUp ret = prev; - - /* Portrait check */ - rotation = round(atan((double) x / sqrt(y * y + z * z)) * RADIANS_TO_DEGREES); - - if (abs(rotation) > THRESHOLD_PORTRAIT) { - ret = (rotation < 0) ? ORIENTATION_LEFT_UP : ORIENTATION_RIGHT_UP; - - /* Some threshold to switching between portrait modes */ - if (prev == ORIENTATION_LEFT_UP || prev == ORIENTATION_RIGHT_UP) { - if (abs(rotation) < SAME_AXIS_LIMIT) { - ret = prev; - } - } - - } else { - /* Landscape check */ - rotation = round(atan((double) y / sqrt(x * x + z * z)) * RADIANS_TO_DEGREES); - - if (abs(rotation) > THRESHOLD_LANDSCAPE) { - ret = (rotation < 0) ? ORIENTATION_BOTTOM_UP : ORIENTATION_NORMAL; - - /* Some threshold to switching between landscape modes */ - if (prev == ORIENTATION_BOTTOM_UP || prev == ORIENTATION_NORMAL) { - if (abs(rotation) < SAME_AXIS_LIMIT) { - ret = prev; - } - } - } - } - - return ret; -} - -static OrientationUp -get_prev_orientation(struct udev_device *dev) -{ - const char *value; - - value = udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER_ORIENTATION"); - if (value == NULL) - return ORIENTATION_UNDEFINED; - return string_to_orientation(value); -} - -#define SET_AXIS(axis, code_) if (ev[i].code == code_) { if (got_##axis == 0) { axis = ev[i].value; got_##axis = 1; } } - -/* accelerometers */ -static void test_orientation(struct udev *udev, - struct udev_device *dev, - const char *devpath) -{ - OrientationUp old, new; - int fd, r; - struct input_event ev[64]; - int got_syn = 0; - int got_x, got_y, got_z; - int x = 0, y = 0, z = 0; - char text[64]; - - old = get_prev_orientation(dev); - - if ((fd = open(devpath, O_RDONLY)) < 0) - return; - - got_x = got_y = got_z = 0; - - while (1) { - int i; - - r = read(fd, ev, sizeof(struct input_event) * 64); - - if (r < (int) sizeof(struct input_event)) - return; - - for (i = 0; i < r / (int) sizeof(struct input_event); i++) { - if (got_syn == 1) { - if (ev[i].type == EV_ABS) { - SET_AXIS(x, ABS_X); - SET_AXIS(y, ABS_Y); - SET_AXIS(z, ABS_Z); - } - } - if (ev[i].type == EV_SYN && ev[i].code == SYN_REPORT) { - got_syn = 1; - } - if (got_x && got_y && got_z) - goto read_dev; - } - } - -read_dev: - close(fd); - - if (!got_x || !got_y || !got_z) - return; - - new = orientation_calc(old, x, y, z); - snprintf(text, sizeof(text), "ID_INPUT_ACCELEROMETER_ORIENTATION=%s", orientation_to_string(new)); - puts(text); -} - -static void help(void) -{ - printf("Usage: accelerometer [options] \n" - " --debug debug to stderr\n" - " --help print this help text\n\n"); -} - -int main (int argc, char** argv) -{ - struct udev *udev; - struct udev_device *dev; - - static const struct option options[] = { - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - char devpath[PATH_MAX]; - char *devnode; - const char *id_path; - struct udev_enumerate *enumerate; - struct udev_list_entry *list_entry; - - udev = udev_new(); - if (udev == NULL) - return 1; - - udev_log_init("input_id"); - udev_set_log_fn(udev, log_fn); - - /* CLI argument parsing */ - while (1) { - int option; - - option = getopt_long(argc, argv, "dxh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'd': - debug = 1; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - help(); - exit(0); - default: - exit(1); - } - } - - if (argv[optind] == NULL) { - help(); - exit(1); - } - - /* get the device */ - snprintf(devpath, sizeof(devpath), "%s/%s", udev_get_sys_path(udev), argv[optind]); - dev = udev_device_new_from_syspath(udev, devpath); - if (dev == NULL) { - fprintf(stderr, "unable to access '%s'\n", devpath); - return 1; - } - - id_path = udev_device_get_property_value(dev, "ID_PATH"); - if (id_path == NULL) { - fprintf (stderr, "unable to get property ID_PATH for '%s'", devpath); - return 0; - } - - /* Get the children devices and find the devnode - * FIXME: use udev_enumerate_add_match_children() instead - * when it's available */ - devnode = NULL; - enumerate = udev_enumerate_new(udev); - udev_enumerate_add_match_property(enumerate, "ID_PATH", id_path); - udev_enumerate_add_match_subsystem(enumerate, "input"); - udev_enumerate_scan_devices(enumerate); - udev_list_entry_foreach(list_entry, udev_enumerate_get_list_entry(enumerate)) { - struct udev_device *device; - const char *node; - - device = udev_device_new_from_syspath(udev_enumerate_get_udev(enumerate), - udev_list_entry_get_name(list_entry)); - if (device == NULL) - continue; - /* Already found it */ - if (devnode != NULL) { - udev_device_unref(device); - continue; - } - - node = udev_device_get_devnode(device); - if (node == NULL) { - udev_device_unref(device); - continue; - } - /* Use the event sub-device */ - if (strstr(node, "/event") == NULL) { - udev_device_unref(device); - continue; - } - - devnode = strdup(node); - udev_device_unref(device); - } - - if (devnode == NULL) { - fprintf(stderr, "unable to get device node for '%s'\n", devpath); - return 0; - } - - info(udev, "Opening accelerometer device %s\n", devnode); - test_orientation(udev, dev, devnode); - free(devnode); - - return 0; -} diff --git a/src/extras/ata_id/.gitignore b/src/extras/ata_id/.gitignore deleted file mode 100644 index 77837266e6..0000000000 --- a/src/extras/ata_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ata_id diff --git a/src/extras/ata_id/ata_id.c b/src/extras/ata_id/ata_id.c deleted file mode 100644 index 257f494496..0000000000 --- a/src/extras/ata_id/ata_id.c +++ /dev/null @@ -1,726 +0,0 @@ -/* - * ata_id - reads product/serial number from ATA drives - * - * Copyright (C) 2005-2008 Kay Sievers - * Copyright (C) 2009 Lennart Poettering - * Copyright (C) 2009-2010 David Zeuthen - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -#define COMMAND_TIMEOUT_MSEC (30 * 1000) - -static int disk_scsi_inquiry_command(int fd, - void *buf, - size_t buf_len) -{ - struct sg_io_v4 io_v4; - uint8_t cdb[6]; - uint8_t sense[32]; - int ret; - - /* - * INQUIRY, see SPC-4 section 6.4 - */ - memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0x12; /* OPERATION CODE: INQUIRY */ - cdb[3] = (buf_len >> 8); /* ALLOCATION LENGTH */ - cdb[4] = (buf_len & 0xff); - - memset(sense, 0, sizeof(sense)); - - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof (cdb); - io_v4.request = (uintptr_t) cdb; - io_v4.max_response_len = sizeof (sense); - io_v4.response = (uintptr_t) sense; - io_v4.din_xfer_len = buf_len; - io_v4.din_xferp = (uintptr_t) buf; - io_v4.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_v4); - if (ret != 0) { - /* could be that the driver doesn't do version 4, try version 3 */ - if (errno == EINVAL) { - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = sizeof (cdb); - io_hdr.dxferp = buf; - io_hdr.dxfer_len = buf_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sizeof (sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_hdr); - if (ret != 0) - goto out; - - /* even if the ioctl succeeds, we need to check the return value */ - if (!(io_hdr.status == 0 && - io_hdr.host_status == 0 && - io_hdr.driver_status == 0)) { - errno = EIO; - ret = -1; - goto out; - } - } else { - goto out; - } - } - - /* even if the ioctl succeeds, we need to check the return value */ - if (!(io_v4.device_status == 0 && - io_v4.transport_status == 0 && - io_v4.driver_status == 0)) { - errno = EIO; - ret = -1; - goto out; - } - - out: - return ret; -} - -static int disk_identify_command(int fd, - void *buf, - size_t buf_len) -{ - struct sg_io_v4 io_v4; - uint8_t cdb[12]; - uint8_t sense[32]; - uint8_t *desc = sense+8; - int ret; - - /* - * ATA Pass-Through 12 byte command, as described in - * - * T10 04-262r8 ATA Command Pass-Through - * - * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf - */ - memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0xa1; /* OPERATION CODE: 12 byte pass through */ - cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ - cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ - cdb[3] = 0; /* FEATURES */ - cdb[4] = 1; /* SECTORS */ - cdb[5] = 0; /* LBA LOW */ - cdb[6] = 0; /* LBA MID */ - cdb[7] = 0; /* LBA HIGH */ - cdb[8] = 0 & 0x4F; /* SELECT */ - cdb[9] = 0xEC; /* Command: ATA IDENTIFY DEVICE */; - memset(sense, 0, sizeof(sense)); - - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof (cdb); - io_v4.request = (uintptr_t) cdb; - io_v4.max_response_len = sizeof (sense); - io_v4.response = (uintptr_t) sense; - io_v4.din_xfer_len = buf_len; - io_v4.din_xferp = (uintptr_t) buf; - io_v4.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_v4); - if (ret != 0) { - /* could be that the driver doesn't do version 4, try version 3 */ - if (errno == EINVAL) { - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = sizeof (cdb); - io_hdr.dxferp = buf; - io_hdr.dxfer_len = buf_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sizeof (sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_hdr); - if (ret != 0) - goto out; - } else { - goto out; - } - } - - if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { - errno = EIO; - ret = -1; - goto out; - } - - out: - return ret; -} - -static int disk_identify_packet_device_command(int fd, - void *buf, - size_t buf_len) -{ - struct sg_io_v4 io_v4; - uint8_t cdb[16]; - uint8_t sense[32]; - uint8_t *desc = sense+8; - int ret; - - /* - * ATA Pass-Through 16 byte command, as described in - * - * T10 04-262r8 ATA Command Pass-Through - * - * from http://www.t10.org/ftp/t10/document.04/04-262r8.pdf - */ - memset(cdb, 0, sizeof(cdb)); - cdb[0] = 0x85; /* OPERATION CODE: 16 byte pass through */ - cdb[1] = 4 << 1; /* PROTOCOL: PIO Data-in */ - cdb[2] = 0x2e; /* OFF_LINE=0, CK_COND=1, T_DIR=1, BYT_BLOK=1, T_LENGTH=2 */ - cdb[3] = 0; /* FEATURES */ - cdb[4] = 0; /* FEATURES */ - cdb[5] = 0; /* SECTORS */ - cdb[6] = 1; /* SECTORS */ - cdb[7] = 0; /* LBA LOW */ - cdb[8] = 0; /* LBA LOW */ - cdb[9] = 0; /* LBA MID */ - cdb[10] = 0; /* LBA MID */ - cdb[11] = 0; /* LBA HIGH */ - cdb[12] = 0; /* LBA HIGH */ - cdb[13] = 0; /* DEVICE */ - cdb[14] = 0xA1; /* Command: ATA IDENTIFY PACKET DEVICE */; - cdb[15] = 0; /* CONTROL */ - memset(sense, 0, sizeof(sense)); - - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof (cdb); - io_v4.request = (uintptr_t) cdb; - io_v4.max_response_len = sizeof (sense); - io_v4.response = (uintptr_t) sense; - io_v4.din_xfer_len = buf_len; - io_v4.din_xferp = (uintptr_t) buf; - io_v4.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_v4); - if (ret != 0) { - /* could be that the driver doesn't do version 4, try version 3 */ - if (errno == EINVAL) { - struct sg_io_hdr io_hdr; - - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmdp = (unsigned char*) cdb; - io_hdr.cmd_len = sizeof (cdb); - io_hdr.dxferp = buf; - io_hdr.dxfer_len = buf_len; - io_hdr.sbp = sense; - io_hdr.mx_sb_len = sizeof (sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.timeout = COMMAND_TIMEOUT_MSEC; - - ret = ioctl(fd, SG_IO, &io_hdr); - if (ret != 0) - goto out; - } else { - goto out; - } - } - - if (!(sense[0] == 0x72 && desc[0] == 0x9 && desc[1] == 0x0c)) { - errno = EIO; - ret = -1; - goto out; - } - - out: - return ret; -} - -/** - * disk_identify_get_string: - * @identify: A block of IDENTIFY data - * @offset_words: Offset of the string to get, in words. - * @dest: Destination buffer for the string. - * @dest_len: Length of destination buffer, in bytes. - * - * Copies the ATA string from @identify located at @offset_words into @dest. - */ -static void disk_identify_get_string(uint8_t identify[512], - unsigned int offset_words, - char *dest, - size_t dest_len) -{ - unsigned int c1; - unsigned int c2; - - assert(identify != NULL); - assert(dest != NULL); - assert((dest_len & 1) == 0); - - while (dest_len > 0) { - c1 = identify[offset_words * 2 + 1]; - c2 = identify[offset_words * 2]; - *dest = c1; - dest++; - *dest = c2; - dest++; - offset_words++; - dest_len -= 2; - } -} - -static void disk_identify_fixup_string(uint8_t identify[512], - unsigned int offset_words, - size_t len) -{ - disk_identify_get_string(identify, offset_words, - (char *) identify + offset_words * 2, len); -} - -static void disk_identify_fixup_uint16 (uint8_t identify[512], unsigned int offset_words) -{ - uint16_t *p; - - p = (uint16_t *) identify; - p[offset_words] = le16toh (p[offset_words]); -} - -/** - * disk_identify: - * @udev: The libudev context. - * @fd: File descriptor for the block device. - * @out_identify: Return location for IDENTIFY data. - * @out_is_packet_device: Return location for whether returned data is from a IDENTIFY PACKET DEVICE. - * - * Sends the IDENTIFY DEVICE or IDENTIFY PACKET DEVICE command to the - * device represented by @fd. If successful, then the result will be - * copied into @out_identify and @out_is_packet_device. - * - * This routine is based on code from libatasmart, Copyright 2008 - * Lennart Poettering, LGPL v2.1. - * - * Returns: 0 if the data was successfully obtained, otherwise - * non-zero with errno set. - */ -static int disk_identify(struct udev *udev, - int fd, - uint8_t out_identify[512], - int *out_is_packet_device) -{ - int ret; - uint8_t inquiry_buf[36]; - int peripheral_device_type; - int all_nul_bytes; - int n; - int is_packet_device; - - assert(out_identify != NULL); - - /* init results */ - ret = -1; - memset(out_identify, '\0', 512); - is_packet_device = 0; - - /* If we were to use ATA PASS_THROUGH (12) on an ATAPI device - * we could accidentally blank media. This is because MMC's BLANK - * command has the same op-code (0x61). - * - * To prevent this from happening we bail out if the device - * isn't a Direct Access Block Device, e.g. SCSI type 0x00 - * (CD/DVD devices are type 0x05). So we send a SCSI INQUIRY - * command first... libata is handling this via its SCSI - * emulation layer. - * - * This also ensures that we're actually dealing with a device - * that understands SCSI commands. - * - * (Yes, it is a bit perverse that we're tunneling the ATA - * command through SCSI and relying on the ATA driver - * emulating SCSI well-enough...) - * - * (See commit 160b069c25690bfb0c785994c7c3710289179107 for - * the original bug-fix and see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=556635 - * for the original bug-report.) - */ - ret = disk_scsi_inquiry_command (fd, inquiry_buf, sizeof (inquiry_buf)); - if (ret != 0) - goto out; - - /* SPC-4, section 6.4.2: Standard INQUIRY data */ - peripheral_device_type = inquiry_buf[0] & 0x1f; - if (peripheral_device_type == 0x05) - { - is_packet_device = 1; - ret = disk_identify_packet_device_command(fd, out_identify, 512); - goto check_nul_bytes; - } - if (peripheral_device_type != 0x00) { - ret = -1; - errno = EIO; - goto out; - } - - /* OK, now issue the IDENTIFY DEVICE command */ - ret = disk_identify_command(fd, out_identify, 512); - if (ret != 0) - goto out; - - check_nul_bytes: - /* Check if IDENTIFY data is all NUL bytes - if so, bail */ - all_nul_bytes = 1; - for (n = 0; n < 512; n++) { - if (out_identify[n] != '\0') { - all_nul_bytes = 0; - break; - } - } - - if (all_nul_bytes) { - ret = -1; - errno = EIO; - goto out; - } - -out: - if (out_is_packet_device != NULL) - *out_is_packet_device = is_packet_device; - return ret; -} - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - struct hd_driveid id; - uint8_t identify[512]; - uint16_t *identify_words; - char model[41]; - char model_enc[256]; - char serial[21]; - char revision[9]; - const char *node = NULL; - int export = 0; - int fd; - uint16_t word; - int rc = 0; - int is_packet_device = 0; - static const struct option options[] = { - { "export", no_argument, NULL, 'x' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("ata_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "xh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'x': - export = 1; - break; - case 'h': - printf("Usage: ata_id [--export] [--help] \n" - " --export print values as environment keys\n" - " --help print this help text\n\n"); - goto exit; - } - } - - node = argv[optind]; - if (node == NULL) { - err(udev, "no node specified\n"); - rc = 1; - goto exit; - } - - fd = open(node, O_RDONLY|O_NONBLOCK); - if (fd < 0) { - err(udev, "unable to open '%s'\n", node); - rc = 1; - goto exit; - } - - if (disk_identify(udev, fd, identify, &is_packet_device) == 0) { - /* - * fix up only the fields from the IDENTIFY data that we are going to - * use and copy it into the hd_driveid struct for convenience - */ - disk_identify_fixup_string (identify, 10, 20); /* serial */ - disk_identify_fixup_string (identify, 23, 6); /* fwrev */ - disk_identify_fixup_string (identify, 27, 40); /* model */ - disk_identify_fixup_uint16 (identify, 0); /* configuration */ - disk_identify_fixup_uint16 (identify, 75); /* queue depth */ - disk_identify_fixup_uint16 (identify, 75); /* SATA capabilities */ - disk_identify_fixup_uint16 (identify, 82); /* command set supported */ - disk_identify_fixup_uint16 (identify, 83); /* command set supported */ - disk_identify_fixup_uint16 (identify, 84); /* command set supported */ - disk_identify_fixup_uint16 (identify, 85); /* command set supported */ - disk_identify_fixup_uint16 (identify, 86); /* command set supported */ - disk_identify_fixup_uint16 (identify, 87); /* command set supported */ - disk_identify_fixup_uint16 (identify, 89); /* time required for SECURITY ERASE UNIT */ - disk_identify_fixup_uint16 (identify, 90); /* time required for enhanced SECURITY ERASE UNIT */ - disk_identify_fixup_uint16 (identify, 91); /* current APM values */ - disk_identify_fixup_uint16 (identify, 94); /* current AAM value */ - disk_identify_fixup_uint16 (identify, 128); /* device lock function */ - disk_identify_fixup_uint16 (identify, 217); /* nominal media rotation rate */ - memcpy(&id, identify, sizeof id); - } else { - /* If this fails, then try HDIO_GET_IDENTITY */ - if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) { - if (errno == ENOTTY) { - info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); - rc = 2; - } else { - err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); - rc = 3; - } - goto close; - } - } - identify_words = (uint16_t *) identify; - - memcpy (model, id.model, 40); - model[40] = '\0'; - udev_util_encode_string(model, model_enc, sizeof(model_enc)); - util_replace_whitespace((char *) id.model, model, 40); - util_replace_chars(model, NULL); - util_replace_whitespace((char *) id.serial_no, serial, 20); - util_replace_chars(serial, NULL); - util_replace_whitespace((char *) id.fw_rev, revision, 8); - util_replace_chars(revision, NULL); - - if (export) { - /* Set this to convey the disk speaks the ATA protocol */ - printf("ID_ATA=1\n"); - - if ((id.config >> 8) & 0x80) { - /* This is an ATAPI device */ - switch ((id.config >> 8) & 0x1f) { - case 0: - printf("ID_TYPE=cd\n"); - break; - case 1: - printf("ID_TYPE=tape\n"); - break; - case 5: - printf("ID_TYPE=cd\n"); - break; - case 7: - printf("ID_TYPE=optical\n"); - break; - default: - printf("ID_TYPE=generic\n"); - break; - } - } else { - printf("ID_TYPE=disk\n"); - } - printf("ID_BUS=ata\n"); - printf("ID_MODEL=%s\n", model); - printf("ID_MODEL_ENC=%s\n", model_enc); - printf("ID_REVISION=%s\n", revision); - if (serial[0] != '\0') { - printf("ID_SERIAL=%s_%s\n", model, serial); - printf("ID_SERIAL_SHORT=%s\n", serial); - } else { - printf("ID_SERIAL=%s\n", model); - } - - if (id.command_set_1 & (1<<5)) { - printf ("ID_ATA_WRITE_CACHE=1\n"); - printf ("ID_ATA_WRITE_CACHE_ENABLED=%d\n", (id.cfs_enable_1 & (1<<5)) ? 1 : 0); - } - if (id.command_set_1 & (1<<10)) { - printf("ID_ATA_FEATURE_SET_HPA=1\n"); - printf("ID_ATA_FEATURE_SET_HPA_ENABLED=%d\n", (id.cfs_enable_1 & (1<<10)) ? 1 : 0); - - /* - * TODO: use the READ NATIVE MAX ADDRESS command to get the native max address - * so it is easy to check whether the protected area is in use. - */ - } - if (id.command_set_1 & (1<<3)) { - printf("ID_ATA_FEATURE_SET_PM=1\n"); - printf("ID_ATA_FEATURE_SET_PM_ENABLED=%d\n", (id.cfs_enable_1 & (1<<3)) ? 1 : 0); - } - if (id.command_set_1 & (1<<1)) { - printf("ID_ATA_FEATURE_SET_SECURITY=1\n"); - printf("ID_ATA_FEATURE_SET_SECURITY_ENABLED=%d\n", (id.cfs_enable_1 & (1<<1)) ? 1 : 0); - printf("ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=%d\n", id.trseuc * 2); - if ((id.cfs_enable_1 & (1<<1))) /* enabled */ { - if (id.dlf & (1<<8)) - printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=maximum\n"); - else - printf("ID_ATA_FEATURE_SET_SECURITY_LEVEL=high\n"); - } - if (id.dlf & (1<<5)) - printf("ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=%d\n", id.trsEuc * 2); - if (id.dlf & (1<<4)) - printf("ID_ATA_FEATURE_SET_SECURITY_EXPIRE=1\n"); - if (id.dlf & (1<<3)) - printf("ID_ATA_FEATURE_SET_SECURITY_FROZEN=1\n"); - if (id.dlf & (1<<2)) - printf("ID_ATA_FEATURE_SET_SECURITY_LOCKED=1\n"); - } - if (id.command_set_1 & (1<<0)) { - printf("ID_ATA_FEATURE_SET_SMART=1\n"); - printf("ID_ATA_FEATURE_SET_SMART_ENABLED=%d\n", (id.cfs_enable_1 & (1<<0)) ? 1 : 0); - } - if (id.command_set_2 & (1<<9)) { - printf("ID_ATA_FEATURE_SET_AAM=1\n"); - printf("ID_ATA_FEATURE_SET_AAM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<9)) ? 1 : 0); - printf("ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=%d\n", id.acoustic >> 8); - printf("ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=%d\n", id.acoustic & 0xff); - } - if (id.command_set_2 & (1<<5)) { - printf("ID_ATA_FEATURE_SET_PUIS=1\n"); - printf("ID_ATA_FEATURE_SET_PUIS_ENABLED=%d\n", (id.cfs_enable_2 & (1<<5)) ? 1 : 0); - } - if (id.command_set_2 & (1<<3)) { - printf("ID_ATA_FEATURE_SET_APM=1\n"); - printf("ID_ATA_FEATURE_SET_APM_ENABLED=%d\n", (id.cfs_enable_2 & (1<<3)) ? 1 : 0); - if ((id.cfs_enable_2 & (1<<3))) - printf("ID_ATA_FEATURE_SET_APM_CURRENT_VALUE=%d\n", id.CurAPMvalues & 0xff); - } - if (id.command_set_2 & (1<<0)) - printf("ID_ATA_DOWNLOAD_MICROCODE=1\n"); - - /* - * Word 76 indicates the capabilities of a SATA device. A PATA device shall set - * word 76 to 0000h or FFFFh. If word 76 is set to 0000h or FFFFh, then - * the device does not claim compliance with the Serial ATA specification and words - * 76 through 79 are not valid and shall be ignored. - */ - word = *((uint16_t *) identify + 76); - if (word != 0x0000 && word != 0xffff) { - printf("ID_ATA_SATA=1\n"); - /* - * If bit 2 of word 76 is set to one, then the device supports the Gen2 - * signaling rate of 3.0 Gb/s (see SATA 2.6). - * - * If bit 1 of word 76 is set to one, then the device supports the Gen1 - * signaling rate of 1.5 Gb/s (see SATA 2.6). - */ - if (word & (1<<2)) - printf("ID_ATA_SATA_SIGNAL_RATE_GEN2=1\n"); - if (word & (1<<1)) - printf("ID_ATA_SATA_SIGNAL_RATE_GEN1=1\n"); - } - - /* Word 217 indicates the nominal media rotation rate of the device */ - word = *((uint16_t *) identify + 217); - if (word != 0x0000) { - if (word == 0x0001) { - printf ("ID_ATA_ROTATION_RATE_RPM=0\n"); /* non-rotating e.g. SSD */ - } else if (word >= 0x0401 && word <= 0xfffe) { - printf ("ID_ATA_ROTATION_RATE_RPM=%d\n", word); - } - } - - /* - * Words 108-111 contain a mandatory World Wide Name (WWN) in the NAA IEEE Registered identifier - * format. Word 108 bits (15:12) shall contain 5h, indicating that the naming authority is IEEE. - * All other values are reserved. - */ - word = *((uint16_t *) identify + 108); - if ((word & 0xf000) == 0x5000) { - uint64_t wwwn; - - wwwn = *((uint16_t *) identify + 108); - wwwn <<= 16; - wwwn |= *((uint16_t *) identify + 109); - wwwn <<= 16; - wwwn |= *((uint16_t *) identify + 110); - wwwn <<= 16; - wwwn |= *((uint16_t *) identify + 111); - printf("ID_WWN=0x%llx\n", (unsigned long long int) wwwn); - /* ATA devices have no vendor extension */ - printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn); - } - - /* from Linux's include/linux/ata.h */ - if (identify_words[0] == 0x848a || identify_words[0] == 0x844a) { - printf("ID_ATA_CFA=1\n"); - } else { - if ((identify_words[83] & 0xc004) == 0x4004) { - printf("ID_ATA_CFA=1\n"); - } - } - } else { - if (serial[0] != '\0') - printf("%s_%s\n", model, serial); - else - printf("%s\n", model); - } -close: - close(fd); -exit: - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/src/extras/cdrom_id/.gitignore b/src/extras/cdrom_id/.gitignore deleted file mode 100644 index 7d817ea74e..0000000000 --- a/src/extras/cdrom_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cdrom_id diff --git a/src/extras/cdrom_id/60-cdrom_id.rules b/src/extras/cdrom_id/60-cdrom_id.rules deleted file mode 100644 index 6eaf76a72c..0000000000 --- a/src/extras/cdrom_id/60-cdrom_id.rules +++ /dev/null @@ -1,20 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="cdrom_end" -SUBSYSTEM!="block", GOTO="cdrom_end" -KERNEL!="sr[0-9]*|xvd*", GOTO="cdrom_end" -ENV{DEVTYPE}!="disk", GOTO="cdrom_end" - -# unconditionally tag device as CDROM -KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1" - -# media eject button pressed -ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end" - -# import device and media properties and lock tray to -# enable the receiving of media eject button events -IMPORT{program}="cdrom_id --lock-media $devnode" - -KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100" - -LABEL="cdrom_end" diff --git a/src/extras/cdrom_id/cdrom_id.c b/src/extras/cdrom_id/cdrom_id.c deleted file mode 100644 index f90d52ec9c..0000000000 --- a/src/extras/cdrom_id/cdrom_id.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* - * cdrom_id - optical drive and media information prober - * - * Copyright (C) 2008-2010 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static bool debug; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - if (debug) { - fprintf(stderr, "%s: ", fn); - vfprintf(stderr, format, args); - } else { - vsyslog(priority, format, args); - } -} - -/* device info */ -static unsigned int cd_cd_rom; -static unsigned int cd_cd_r; -static unsigned int cd_cd_rw; -static unsigned int cd_dvd_rom; -static unsigned int cd_dvd_r; -static unsigned int cd_dvd_rw; -static unsigned int cd_dvd_ram; -static unsigned int cd_dvd_plus_r; -static unsigned int cd_dvd_plus_rw; -static unsigned int cd_dvd_plus_r_dl; -static unsigned int cd_dvd_plus_rw_dl; -static unsigned int cd_bd; -static unsigned int cd_bd_r; -static unsigned int cd_bd_re; -static unsigned int cd_hddvd; -static unsigned int cd_hddvd_r; -static unsigned int cd_hddvd_rw; -static unsigned int cd_mo; -static unsigned int cd_mrw; -static unsigned int cd_mrw_w; - -/* media info */ -static unsigned int cd_media; -static unsigned int cd_media_cd_rom; -static unsigned int cd_media_cd_r; -static unsigned int cd_media_cd_rw; -static unsigned int cd_media_dvd_rom; -static unsigned int cd_media_dvd_r; -static unsigned int cd_media_dvd_rw; -static unsigned int cd_media_dvd_rw_ro; /* restricted overwrite mode */ -static unsigned int cd_media_dvd_rw_seq; /* sequential mode */ -static unsigned int cd_media_dvd_ram; -static unsigned int cd_media_dvd_plus_r; -static unsigned int cd_media_dvd_plus_rw; -static unsigned int cd_media_dvd_plus_r_dl; -static unsigned int cd_media_dvd_plus_rw_dl; -static unsigned int cd_media_bd; -static unsigned int cd_media_bd_r; -static unsigned int cd_media_bd_re; -static unsigned int cd_media_hddvd; -static unsigned int cd_media_hddvd_r; -static unsigned int cd_media_hddvd_rw; -static unsigned int cd_media_mo; -static unsigned int cd_media_mrw; -static unsigned int cd_media_mrw_w; - -static const char *cd_media_state = NULL; -static unsigned int cd_media_session_next; -static unsigned int cd_media_session_count; -static unsigned int cd_media_track_count; -static unsigned int cd_media_track_count_data; -static unsigned int cd_media_track_count_audio; -static unsigned long long int cd_media_session_last_offset; - -#define ERRCODE(s) ((((s)[2] & 0x0F) << 16) | ((s)[12] << 8) | ((s)[13])) -#define SK(errcode) (((errcode) >> 16) & 0xF) -#define ASC(errcode) (((errcode) >> 8) & 0xFF) -#define ASCQ(errcode) ((errcode) & 0xFF) - -static bool is_mounted(const char *device) -{ - struct stat statbuf; - FILE *fp; - int maj, min; - bool mounted = false; - - if (stat(device, &statbuf) < 0) - return -ENODEV; - - fp = fopen("/proc/self/mountinfo", "r"); - if (fp == NULL) - return -ENOSYS; - while (fscanf(fp, "%*s %*s %i:%i %*[^\n]", &maj, &min) == 2) { - if (makedev(maj, min) == statbuf.st_rdev) { - mounted = true; - break; - } - } - fclose(fp); - return mounted; -} - -static void info_scsi_cmd_err(struct udev *udev, char *cmd, int err) -{ - if (err == -1) { - info(udev, "%s failed\n", cmd); - return; - } - info(udev, "%s failed with SK=%Xh/ASC=%02Xh/ACQ=%02Xh\n", cmd, SK(err), ASC(err), ASCQ(err)); -} - -struct scsi_cmd { - struct cdrom_generic_command cgc; - union { - struct request_sense s; - unsigned char u[18]; - } _sense; - struct sg_io_hdr sg_io; -}; - -static void scsi_cmd_init(struct udev *udev, struct scsi_cmd *cmd) -{ - memset(cmd, 0x00, sizeof(struct scsi_cmd)); - cmd->cgc.quiet = 1; - cmd->cgc.sense = &cmd->_sense.s; - cmd->sg_io.interface_id = 'S'; - cmd->sg_io.mx_sb_len = sizeof(cmd->_sense); - cmd->sg_io.cmdp = cmd->cgc.cmd; - cmd->sg_io.sbp = cmd->_sense.u; - cmd->sg_io.flags = SG_FLAG_LUN_INHIBIT | SG_FLAG_DIRECT_IO; -} - -static void scsi_cmd_set(struct udev *udev, struct scsi_cmd *cmd, size_t i, unsigned char arg) -{ - cmd->sg_io.cmd_len = i + 1; - cmd->cgc.cmd[i] = arg; -} - -#define CHECK_CONDITION 0x01 - -static int scsi_cmd_run(struct udev *udev, struct scsi_cmd *cmd, int fd, unsigned char *buf, size_t bufsize) -{ - int ret = 0; - - if (bufsize > 0) { - cmd->sg_io.dxferp = buf; - cmd->sg_io.dxfer_len = bufsize; - cmd->sg_io.dxfer_direction = SG_DXFER_FROM_DEV; - } else { - cmd->sg_io.dxfer_direction = SG_DXFER_NONE; - } - if (ioctl(fd, SG_IO, &cmd->sg_io)) - return -1; - - if ((cmd->sg_io.info & SG_INFO_OK_MASK) != SG_INFO_OK) { - errno = EIO; - ret = -1; - if (cmd->sg_io.masked_status & CHECK_CONDITION) { - ret = ERRCODE(cmd->_sense.u); - if (ret == 0) - ret = -1; - } - } - return ret; -} - -static int media_lock(struct udev *udev, int fd, bool lock) -{ - int err; - - /* disable the kernel's lock logic */ - err = ioctl(fd, CDROM_CLEAR_OPTIONS, CDO_LOCK); - if (err < 0) - info(udev, "CDROM_CLEAR_OPTIONS, CDO_LOCK failed\n"); - - err = ioctl(fd, CDROM_LOCKDOOR, lock ? 1 : 0); - if (err < 0) - info(udev, "CDROM_LOCKDOOR failed\n"); - - return err; -} - -static int media_eject(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x1b); - scsi_cmd_set(udev, &sc, 4, 0x02); - scsi_cmd_set(udev, &sc, 5, 0); - err = scsi_cmd_run(udev, &sc, fd, NULL, 0); - if ((err != 0)) { - info_scsi_cmd_err(udev, "START_STOP_UNIT", err); - return -1; - } - return 0; -} - -static int cd_capability_compat(struct udev *udev, int fd) -{ - int capability; - - capability = ioctl(fd, CDROM_GET_CAPABILITY, NULL); - if (capability < 0) { - info(udev, "CDROM_GET_CAPABILITY failed\n"); - return -1; - } - - if (capability & CDC_CD_R) - cd_cd_r = 1; - if (capability & CDC_CD_RW) - cd_cd_rw = 1; - if (capability & CDC_DVD) - cd_dvd_rom = 1; - if (capability & CDC_DVD_R) - cd_dvd_r = 1; - if (capability & CDC_DVD_RAM) - cd_dvd_ram = 1; - if (capability & CDC_MRW) - cd_mrw = 1; - if (capability & CDC_MRW_W) - cd_mrw_w = 1; - return 0; -} - -static int cd_media_compat(struct udev *udev, int fd) -{ - if (ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) != CDS_DISC_OK) { - info(udev, "CDROM_DRIVE_STATUS != CDS_DISC_OK\n"); - return -1; - } - cd_media = 1; - return 0; -} - -static int cd_inquiry(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - unsigned char inq[128]; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x12); - scsi_cmd_set(udev, &sc, 4, 36); - scsi_cmd_set(udev, &sc, 5, 0); - err = scsi_cmd_run(udev, &sc, fd, inq, 36); - if ((err != 0)) { - info_scsi_cmd_err(udev, "INQUIRY", err); - return -1; - } - - if ((inq[0] & 0x1F) != 5) { - info(udev, "not an MMC unit\n"); - return -1; - } - - info(udev, "INQUIRY: [%.8s][%.16s][%.4s]\n", inq + 8, inq + 16, inq + 32); - return 0; -} - -static void feature_profile_media(struct udev *udev, int cur_profile) -{ - switch (cur_profile) { - case 0x03: - case 0x04: - case 0x05: - info(udev, "profile 0x%02x \n", cur_profile); - cd_media = 1; - cd_media_mo = 1; - break; - case 0x08: - info(udev, "profile 0x%02x media_cd_rom\n", cur_profile); - cd_media = 1; - cd_media_cd_rom = 1; - break; - case 0x09: - info(udev, "profile 0x%02x media_cd_r\n", cur_profile); - cd_media = 1; - cd_media_cd_r = 1; - break; - case 0x0a: - info(udev, "profile 0x%02x media_cd_rw\n", cur_profile); - cd_media = 1; - cd_media_cd_rw = 1; - break; - case 0x10: - info(udev, "profile 0x%02x media_dvd_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rom = 1; - break; - case 0x11: - info(udev, "profile 0x%02x media_dvd_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_r = 1; - break; - case 0x12: - info(udev, "profile 0x%02x media_dvd_ram\n", cur_profile); - cd_media = 1; - cd_media_dvd_ram = 1; - break; - case 0x13: - info(udev, "profile 0x%02x media_dvd_rw_ro\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_ro = 1; - break; - case 0x14: - info(udev, "profile 0x%02x media_dvd_rw_seq\n", cur_profile); - cd_media = 1; - cd_media_dvd_rw = 1; - cd_media_dvd_rw_seq = 1; - break; - case 0x1B: - info(udev, "profile 0x%02x media_dvd_plus_r\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r = 1; - break; - case 0x1A: - info(udev, "profile 0x%02x media_dvd_plus_rw\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw = 1; - break; - case 0x2A: - info(udev, "profile 0x%02x media_dvd_plus_rw_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_rw_dl = 1; - break; - case 0x2B: - info(udev, "profile 0x%02x media_dvd_plus_r_dl\n", cur_profile); - cd_media = 1; - cd_media_dvd_plus_r_dl = 1; - break; - case 0x40: - info(udev, "profile 0x%02x media_bd\n", cur_profile); - cd_media = 1; - cd_media_bd = 1; - break; - case 0x41: - case 0x42: - info(udev, "profile 0x%02x media_bd_r\n", cur_profile); - cd_media = 1; - cd_media_bd_r = 1; - break; - case 0x43: - info(udev, "profile 0x%02x media_bd_re\n", cur_profile); - cd_media = 1; - cd_media_bd_re = 1; - break; - case 0x50: - info(udev, "profile 0x%02x media_hddvd\n", cur_profile); - cd_media = 1; - cd_media_hddvd = 1; - break; - case 0x51: - info(udev, "profile 0x%02x media_hddvd_r\n", cur_profile); - cd_media = 1; - cd_media_hddvd_r = 1; - break; - case 0x52: - info(udev, "profile 0x%02x media_hddvd_rw\n", cur_profile); - cd_media = 1; - cd_media_hddvd_rw = 1; - break; - default: - info(udev, "profile 0x%02x \n", cur_profile); - break; - } -} - -static int feature_profiles(struct udev *udev, const unsigned char *profiles, size_t size) -{ - unsigned int i; - - for (i = 0; i+4 <= size; i += 4) { - int profile; - - profile = profiles[i] << 8 | profiles[i+1]; - switch (profile) { - case 0x03: - case 0x04: - case 0x05: - info(udev, "profile 0x%02x mo\n", profile); - cd_mo = 1; - break; - case 0x08: - info(udev, "profile 0x%02x cd_rom\n", profile); - cd_cd_rom = 1; - break; - case 0x09: - info(udev, "profile 0x%02x cd_r\n", profile); - cd_cd_r = 1; - break; - case 0x0A: - info(udev, "profile 0x%02x cd_rw\n", profile); - cd_cd_rw = 1; - break; - case 0x10: - info(udev, "profile 0x%02x dvd_rom\n", profile); - cd_dvd_rom = 1; - break; - case 0x12: - info(udev, "profile 0x%02x dvd_ram\n", profile); - cd_dvd_ram = 1; - break; - case 0x13: - case 0x14: - info(udev, "profile 0x%02x dvd_rw\n", profile); - cd_dvd_rw = 1; - break; - case 0x1B: - info(udev, "profile 0x%02x dvd_plus_r\n", profile); - cd_dvd_plus_r = 1; - break; - case 0x1A: - info(udev, "profile 0x%02x dvd_plus_rw\n", profile); - cd_dvd_plus_rw = 1; - break; - case 0x2A: - info(udev, "profile 0x%02x dvd_plus_rw_dl\n", profile); - cd_dvd_plus_rw_dl = 1; - break; - case 0x2B: - info(udev, "profile 0x%02x dvd_plus_r_dl\n", profile); - cd_dvd_plus_r_dl = 1; - break; - case 0x40: - cd_bd = 1; - info(udev, "profile 0x%02x bd\n", profile); - break; - case 0x41: - case 0x42: - cd_bd_r = 1; - info(udev, "profile 0x%02x bd_r\n", profile); - break; - case 0x43: - cd_bd_re = 1; - info(udev, "profile 0x%02x bd_re\n", profile); - break; - case 0x50: - cd_hddvd = 1; - info(udev, "profile 0x%02x hddvd\n", profile); - break; - case 0x51: - cd_hddvd_r = 1; - info(udev, "profile 0x%02x hddvd_r\n", profile); - break; - case 0x52: - cd_hddvd_rw = 1; - info(udev, "profile 0x%02x hddvd_rw\n", profile); - break; - default: - info(udev, "profile 0x%02x \n", profile); - break; - } - } - return 0; -} - -/* returns 0 if media was detected */ -static int cd_profiles_old_mmc(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - int err; - - unsigned char header[32]; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - if (cd_media == 1) { - info(udev, "no current profile, but disc is present; assuming CD-ROM\n"); - cd_media_cd_rom = 1; - return 0; - } else { - info(udev, "no current profile, assuming no media\n"); - return -1; - } - }; - - cd_media = 1; - - if (header[2] & 16) { - cd_media_cd_rw = 1; - info(udev, "profile 0x0a media_cd_rw\n"); - } else if ((header[2] & 3) < 2 && cd_cd_r) { - cd_media_cd_r = 1; - info(udev, "profile 0x09 media_cd_r\n"); - } else { - cd_media_cd_rom = 1; - info(udev, "profile 0x08 media_cd_rom\n"); - } - return 0; -} - -/* returns 0 if media was detected */ -static int cd_profiles(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - unsigned char features[65530]; - unsigned int cur_profile = 0; - unsigned int len; - unsigned int i; - int err; - int ret; - - ret = -1; - - /* First query the current profile */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 8, 8); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, features, 8); - if ((err != 0)) { - info_scsi_cmd_err(udev, "GET CONFIGURATION", err); - /* handle pre-MMC2 drives which do not support GET CONFIGURATION */ - if (SK(err) == 0x5 && ASC(err) == 0x20) { - info(udev, "drive is pre-MMC2 and does not support 46h get configuration command\n"); - info(udev, "trying to work around the problem\n"); - ret = cd_profiles_old_mmc(udev, fd); - } - goto out; - } - - cur_profile = features[6] << 8 | features[7]; - if (cur_profile > 0) { - info(udev, "current profile 0x%02x\n", cur_profile); - feature_profile_media (udev, cur_profile); - ret = 0; /* we have media */ - } else { - info(udev, "no current profile, assuming no media\n"); - } - - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; - info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); - - if (len > sizeof(features)) { - info(udev, "can not get features in a single query, truncating\n"); - len = sizeof(features); - } else if (len <= 8) { - len = sizeof(features); - } - - /* Now get the full feature buffer */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x46); - scsi_cmd_set(udev, &sc, 7, ( len >> 8 ) & 0xff); - scsi_cmd_set(udev, &sc, 8, len & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, features, len); - if ((err != 0)) { - info_scsi_cmd_err(udev, "GET CONFIGURATION", err); - return -1; - } - - /* parse the length once more, in case the drive decided to have other features suddenly :) */ - len = features[0] << 24 | features[1] << 16 | features[2] << 8 | features[3]; - info(udev, "GET CONFIGURATION: size of features buffer 0x%04x\n", len); - - if (len > sizeof(features)) { - info(udev, "can not get features in a single query, truncating\n"); - len = sizeof(features); - } - - /* device features */ - for (i = 8; i+4 < len; i += (4 + features[i+3])) { - unsigned int feature; - - feature = features[i] << 8 | features[i+1]; - - switch (feature) { - case 0x00: - info(udev, "GET CONFIGURATION: feature 'profiles', with %i entries\n", features[i+3] / 4); - feature_profiles(udev, &features[i]+4, features[i+3]); - break; - default: - info(udev, "GET CONFIGURATION: feature 0x%04x , with 0x%02x bytes\n", feature, features[i+3]); - break; - } - } -out: - return ret; -} - -static int cd_media_info(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - unsigned char header[32]; - static const char *media_status[] = { - "blank", - "appendable", - "complete", - "other" - }; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x51); - scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DISC INFORMATION", err); - return -1; - }; - - cd_media = 1; - info(udev, "disk type %02x\n", header[8]); - info(udev, "hardware reported media status: %s\n", media_status[header[2] & 3]); - - /* exclude plain CDROM, some fake cdroms return 0 for "blank" media here */ - if (!cd_media_cd_rom) - cd_media_state = media_status[header[2] & 3]; - - /* fresh DVD-RW in restricted overwite mode reports itself as - * "appendable"; change it to "blank" to make it consistent with what - * gets reported after blanking, and what userspace expects */ - if (cd_media_dvd_rw_ro && (header[2] & 3) == 1) - cd_media_state = media_status[0]; - - /* DVD+RW discs (and DVD-RW in restricted mode) once formatted are - * always "complete", DVD-RAM are "other" or "complete" if the disc is - * write protected; we need to check the contents if it is blank */ - if ((cd_media_dvd_rw_ro || cd_media_dvd_plus_rw || cd_media_dvd_plus_rw_dl || cd_media_dvd_ram) && (header[2] & 3) > 1) { - unsigned char buffer[32 * 2048]; - unsigned char result, len; - int block, offset; - - if (cd_media_dvd_ram) { - /* a write protected dvd-ram may report "complete" status */ - - unsigned char dvdstruct[8]; - unsigned char format[12]; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0xAD); - scsi_cmd_set(udev, &sc, 7, 0xC0); - scsi_cmd_set(udev, &sc, 9, sizeof(dvdstruct)); - scsi_cmd_set(udev, &sc, 11, 0); - err = scsi_cmd_run(udev, &sc, fd, dvdstruct, sizeof(dvdstruct)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DVD STRUCTURE", err); - return -1; - } - if (dvdstruct[4] & 0x02) { - cd_media_state = media_status[2]; - info(udev, "write-protected DVD-RAM media inserted\n"); - goto determined; - } - - /* let's make sure we don't try to read unformatted media */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x23); - scsi_cmd_set(udev, &sc, 8, sizeof(format)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, format, sizeof(format)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ DVD FORMAT CAPACITIES", err); - return -1; - } - - len = format[3]; - if (len & 7 || len < 16) { - info(udev, "invalid format capacities length\n"); - return -1; - } - - switch(format[8] & 3) { - case 1: - info(udev, "unformatted DVD-RAM media inserted\n"); - /* This means that last format was interrupted - * or failed, blank dvd-ram discs are factory - * formatted. Take no action here as it takes - * quite a while to reformat a dvd-ram and it's - * not automatically started */ - goto determined; - - case 2: - info(udev, "formatted DVD-RAM media inserted\n"); - break; - - case 3: - cd_media = 0; //return no media - info(udev, "format capacities returned no media\n"); - return -1; - } - } - - /* Take a closer look at formatted media (unformatted DVD+RW - * has "blank" status", DVD-RAM was examined earlier) and check - * for ISO and UDF PVDs or a fs superblock presence and do it - * in one ioctl (we need just sectors 0 and 16) */ - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x28); - scsi_cmd_set(udev, &sc, 5, 0); - scsi_cmd_set(udev, &sc, 8, 32); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, buffer, sizeof(buffer)); - if ((err != 0)) { - cd_media = 0; - info_scsi_cmd_err(udev, "READ FIRST 32 BLOCKS", err); - return -1; - } - - /* if any non-zero data is found in sector 16 (iso and udf) or - * eventually 0 (fat32 boot sector, ext2 superblock, etc), disc - * is assumed non-blank */ - result = 0; - - for (block = 32768; block >= 0 && !result; block -= 32768) { - offset = block; - while (offset < (block + 2048) && !result) { - result = buffer [offset]; - offset++; - } - } - - if (!result) { - cd_media_state = media_status[0]; - info(udev, "no data in blocks 0 or 16, assuming blank\n"); - } else { - info(udev, "data in blocks 0 or 16, assuming complete\n"); - } - } - -determined: - /* "other" is e. g. DVD-RAM, can't append sessions there; DVDs in - * restricted overwrite mode can never append, only in sequential mode */ - if ((header[2] & 3) < 2 && !cd_media_dvd_rw_ro) - cd_media_session_next = header[10] << 8 | header[5]; - cd_media_session_count = header[9] << 8 | header[4]; - cd_media_track_count = header[11] << 8 | header[6]; - - return 0; -} - -static int cd_media_toc(struct udev *udev, int fd) -{ - struct scsi_cmd sc; - unsigned char header[12]; - unsigned char toc[65536]; - unsigned int len, i, num_tracks; - unsigned char *p; - int err; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, 1); - scsi_cmd_set(udev, &sc, 8, sizeof(header) & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC", err); - return -1; - } - - len = (header[0] << 8 | header[1]) + 2; - info(udev, "READ TOC: len: %d, start track: %d, end track: %d\n", len, header[2], header[3]); - if (len > sizeof(toc)) - return -1; - if (len < 2) - return -1; - /* 2: first track, 3: last track */ - num_tracks = header[3] - header[2] + 1; - - /* empty media has no tracks */ - if (len < 8) - return 0; - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 6, header[2]); /* First Track/Session Number */ - scsi_cmd_set(udev, &sc, 7, (len >> 8) & 0xff); - scsi_cmd_set(udev, &sc, 8, len & 0xff); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, toc, len); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC (tracks)", err); - return -1; - } - - /* Take care to not iterate beyond the last valid track as specified in - * the TOC, but also avoid going beyond the TOC length, just in case - * the last track number is invalidly large */ - for (p = toc+4, i = 4; i < len-8 && num_tracks > 0; i += 8, p += 8, --num_tracks) { - unsigned int block; - unsigned int is_data_track; - - is_data_track = (p[1] & 0x04) != 0; - - block = p[4] << 24 | p[5] << 16 | p[6] << 8 | p[7]; - info(udev, "track=%u info=0x%x(%s) start_block=%u\n", - p[2], p[1] & 0x0f, is_data_track ? "data":"audio", block); - - if (is_data_track) - cd_media_track_count_data++; - else - cd_media_track_count_audio++; - } - - scsi_cmd_init(udev, &sc); - scsi_cmd_set(udev, &sc, 0, 0x43); - scsi_cmd_set(udev, &sc, 2, 1); /* Session Info */ - scsi_cmd_set(udev, &sc, 8, sizeof(header)); - scsi_cmd_set(udev, &sc, 9, 0); - err = scsi_cmd_run(udev, &sc, fd, header, sizeof(header)); - if ((err != 0)) { - info_scsi_cmd_err(udev, "READ TOC (multi session)", err); - return -1; - } - len = header[4+4] << 24 | header[4+5] << 16 | header[4+6] << 8 | header[4+7]; - info(udev, "last track %u starts at block %u\n", header[4+2], len); - cd_media_session_last_offset = (unsigned long long int)len * 2048; - return 0; -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - static const struct option options[] = { - { "lock-media", no_argument, NULL, 'l' }, - { "unlock-media", no_argument, NULL, 'u' }, - { "eject-media", no_argument, NULL, 'e' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - bool eject = false; - bool lock = false; - bool unlock = false; - const char *node = NULL; - int fd = -1; - int cnt; - int rc = 0; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("cdrom_id"); - udev_set_log_fn(udev, log_fn); - - while (1) { - int option; - - option = getopt_long(argc, argv, "deluh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'l': - lock = true; - break; - case 'u': - unlock = true; - break; - case 'e': - eject = true; - break; - case 'd': - debug = true; - if (udev_get_log_priority(udev) < LOG_INFO) - udev_set_log_priority(udev, LOG_INFO); - break; - case 'h': - printf("Usage: cdrom_id [options] \n" - " --lock-media lock the media (to enable eject request events)\n" - " --unlock-media unlock the media\n" - " --eject-media eject the media\n" - " --debug debug to stderr\n" - " --help print this help text\n\n"); - goto exit; - default: - rc = 1; - goto exit; - } - } - - node = argv[optind]; - if (!node) { - err(udev, "no device\n"); - fprintf(stderr, "no device\n"); - rc = 1; - goto exit; - } - - srand((unsigned int)getpid()); - for (cnt = 20; cnt > 0; cnt--) { - struct timespec duration; - - fd = open(node, O_RDONLY|O_NONBLOCK|(is_mounted(node) ? 0 : O_EXCL)); - if (fd >= 0 || errno != EBUSY) - break; - duration.tv_sec = 0; - duration.tv_nsec = (100 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); - nanosleep(&duration, NULL); - } - if (fd < 0) { - info(udev, "unable to open '%s'\n", node); - fprintf(stderr, "unable to open '%s'\n", node); - rc = 1; - goto exit; - } - info(udev, "probing: '%s'\n", node); - - /* same data as original cdrom_id */ - if (cd_capability_compat(udev, fd) < 0) { - rc = 1; - goto exit; - } - - /* check for media - don't bail if there's no media as we still need to - * to read profiles */ - cd_media_compat(udev, fd); - - /* check if drive talks MMC */ - if (cd_inquiry(udev, fd) < 0) - goto work; - - /* read drive and possibly current profile */ - if (cd_profiles(udev, fd) != 0) - goto work; - - /* at this point we are guaranteed to have media in the drive - find out more about it */ - - /* get session/track info */ - cd_media_toc(udev, fd); - - /* get writable media state */ - cd_media_info(udev, fd); - -work: - /* lock the media, so we enable eject button events */ - if (lock && cd_media) { - info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (lock)\n"); - media_lock(udev, fd, true); - } - - if (unlock && cd_media) { - info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); - media_lock(udev, fd, false); - } - - if (eject) { - info(udev, "PREVENT_ALLOW_MEDIUM_REMOVAL (unlock)\n"); - media_lock(udev, fd, false); - info(udev, "START_STOP_UNIT (eject)\n"); - media_eject(udev, fd); - } - - printf("ID_CDROM=1\n"); - if (cd_cd_rom) - printf("ID_CDROM_CD=1\n"); - if (cd_cd_r) - printf("ID_CDROM_CD_R=1\n"); - if (cd_cd_rw) - printf("ID_CDROM_CD_RW=1\n"); - if (cd_dvd_rom) - printf("ID_CDROM_DVD=1\n"); - if (cd_dvd_r) - printf("ID_CDROM_DVD_R=1\n"); - if (cd_dvd_rw) - printf("ID_CDROM_DVD_RW=1\n"); - if (cd_dvd_ram) - printf("ID_CDROM_DVD_RAM=1\n"); - if (cd_dvd_plus_r) - printf("ID_CDROM_DVD_PLUS_R=1\n"); - if (cd_dvd_plus_rw) - printf("ID_CDROM_DVD_PLUS_RW=1\n"); - if (cd_dvd_plus_r_dl) - printf("ID_CDROM_DVD_PLUS_R_DL=1\n"); - if (cd_dvd_plus_rw_dl) - printf("ID_CDROM_DVD_PLUS_RW_DL=1\n"); - if (cd_bd) - printf("ID_CDROM_BD=1\n"); - if (cd_bd_r) - printf("ID_CDROM_BD_R=1\n"); - if (cd_bd_re) - printf("ID_CDROM_BD_RE=1\n"); - if (cd_hddvd) - printf("ID_CDROM_HDDVD=1\n"); - if (cd_hddvd_r) - printf("ID_CDROM_HDDVD_R=1\n"); - if (cd_hddvd_rw) - printf("ID_CDROM_HDDVD_RW=1\n"); - if (cd_mo) - printf("ID_CDROM_MO=1\n"); - if (cd_mrw) - printf("ID_CDROM_MRW=1\n"); - if (cd_mrw_w) - printf("ID_CDROM_MRW_W=1\n"); - - if (cd_media) - printf("ID_CDROM_MEDIA=1\n"); - if (cd_media_mo) - printf("ID_CDROM_MEDIA_MO=1\n"); - if (cd_media_mrw) - printf("ID_CDROM_MEDIA_MRW=1\n"); - if (cd_media_mrw_w) - printf("ID_CDROM_MEDIA_MRW_W=1\n"); - if (cd_media_cd_rom) - printf("ID_CDROM_MEDIA_CD=1\n"); - if (cd_media_cd_r) - printf("ID_CDROM_MEDIA_CD_R=1\n"); - if (cd_media_cd_rw) - printf("ID_CDROM_MEDIA_CD_RW=1\n"); - if (cd_media_dvd_rom) - printf("ID_CDROM_MEDIA_DVD=1\n"); - if (cd_media_dvd_r) - printf("ID_CDROM_MEDIA_DVD_R=1\n"); - if (cd_media_dvd_ram) - printf("ID_CDROM_MEDIA_DVD_RAM=1\n"); - if (cd_media_dvd_rw) - printf("ID_CDROM_MEDIA_DVD_RW=1\n"); - if (cd_media_dvd_plus_r) - printf("ID_CDROM_MEDIA_DVD_PLUS_R=1\n"); - if (cd_media_dvd_plus_rw) - printf("ID_CDROM_MEDIA_DVD_PLUS_RW=1\n"); - if (cd_media_dvd_plus_rw_dl) - printf("ID_CDROM_MEDIA_DVD_PLUS_RW_DL=1\n"); - if (cd_media_dvd_plus_r_dl) - printf("ID_CDROM_MEDIA_DVD_PLUS_R_DL=1\n"); - if (cd_media_bd) - printf("ID_CDROM_MEDIA_BD=1\n"); - if (cd_media_bd_r) - printf("ID_CDROM_MEDIA_BD_R=1\n"); - if (cd_media_bd_re) - printf("ID_CDROM_MEDIA_BD_RE=1\n"); - if (cd_media_hddvd) - printf("ID_CDROM_MEDIA_HDDVD=1\n"); - if (cd_media_hddvd_r) - printf("ID_CDROM_MEDIA_HDDVD_R=1\n"); - if (cd_media_hddvd_rw) - printf("ID_CDROM_MEDIA_HDDVD_RW=1\n"); - - if (cd_media_state != NULL) - printf("ID_CDROM_MEDIA_STATE=%s\n", cd_media_state); - if (cd_media_session_next > 0) - printf("ID_CDROM_MEDIA_SESSION_NEXT=%d\n", cd_media_session_next); - if (cd_media_session_count > 0) - printf("ID_CDROM_MEDIA_SESSION_COUNT=%d\n", cd_media_session_count); - if (cd_media_session_count > 1 && cd_media_session_last_offset > 0) - printf("ID_CDROM_MEDIA_SESSION_LAST_OFFSET=%llu\n", cd_media_session_last_offset); - if (cd_media_track_count > 0) - printf("ID_CDROM_MEDIA_TRACK_COUNT=%d\n", cd_media_track_count); - if (cd_media_track_count_audio > 0) - printf("ID_CDROM_MEDIA_TRACK_COUNT_AUDIO=%d\n", cd_media_track_count_audio); - if (cd_media_track_count_data > 0) - printf("ID_CDROM_MEDIA_TRACK_COUNT_DATA=%d\n", cd_media_track_count_data); -exit: - if (fd >= 0) - close(fd); - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/src/extras/collect/.gitignore b/src/extras/collect/.gitignore deleted file mode 100644 index c30ad6527c..0000000000 --- a/src/extras/collect/.gitignore +++ /dev/null @@ -1 +0,0 @@ -collect diff --git a/src/extras/collect/collect.c b/src/extras/collect/collect.c deleted file mode 100644 index 076fe479e2..0000000000 --- a/src/extras/collect/collect.c +++ /dev/null @@ -1,473 +0,0 @@ -/* - * Collect variables across events. - * - * usage: collect [--add|--remove] - * - * Adds ID to the list governed by . - * must be part of the ID list . - * If all IDs given by are listed (ie collect has been - * invoked for each ID in ) collect returns 0, the - * number of missing IDs otherwise. - * A negative number is returned on error. - * - * Copyright(C) 2007, Hannes Reinecke - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -#define BUFSIZE 16 -#define UDEV_ALARM_TIMEOUT 180 - -enum collect_state { - STATE_NONE, - STATE_OLD, - STATE_CONFIRMED, -}; - -struct _mate { - struct udev_list_node node; - char *name; - enum collect_state state; -}; - -static struct udev_list_node bunch; -static int debug; - -/* This can increase dynamically */ -static size_t bufsize = BUFSIZE; - -static struct _mate *node_to_mate(struct udev_list_node *node) -{ - char *mate; - - mate = (char *)node; - mate -= offsetof(struct _mate, node); - return (struct _mate *)mate; -} - -static void sig_alrm(int signo) -{ - exit(4); -} - -static void usage(void) -{ - printf("usage: collect [--add|--remove] [--debug] \n" - "\n" - " Adds ID to the list governed by .\n" - " must be part of the list .\n" - " If all IDs given by are listed (ie collect has been\n" - " invoked for each ID in ) collect returns 0, the\n" - " number of missing IDs otherwise.\n" - " On error a negative number is returned.\n" - "\n"); -} - -/* - * prepare - * - * Prepares the database file - */ -static int prepare(char *dir, char *filename) -{ - struct stat statbuf; - char buf[512]; - int fd; - - if (stat(dir, &statbuf) < 0) - mkdir(dir, 0700); - - sprintf(buf, "%s/%s", dir, filename); - - fd = open(buf,O_RDWR|O_CREAT, S_IRUSR|S_IWUSR); - if (fd < 0) - fprintf(stderr, "Cannot open %s: %s\n", buf, strerror(errno)); - - if (lockf(fd,F_TLOCK,0) < 0) { - if (debug) - fprintf(stderr, "Lock taken, wait for %d seconds\n", UDEV_ALARM_TIMEOUT); - if (errno == EAGAIN || errno == EACCES) { - alarm(UDEV_ALARM_TIMEOUT); - lockf(fd, F_LOCK, 0); - if (debug) - fprintf(stderr, "Acquired lock on %s\n", buf); - } else { - if (debug) - fprintf(stderr, "Could not get lock on %s: %s\n", buf, strerror(errno)); - } - } - - return fd; -} - -/* - * Read checkpoint file - * - * Tricky reading this. We allocate a buffer twice as large - * as we're going to read. Then we read into the upper half - * of that buffer and start parsing. - * Once we do _not_ find end-of-work terminator (whitespace - * character) we move the upper half to the lower half, - * adjust the read pointer and read the next bit. - * Quite clever methinks :-) - * I should become a programmer ... - * - * Yes, one could have used fgets() for this. But then we'd - * have to use freopen etc which I found quite tedious. - */ -static int checkout(int fd) -{ - int len; - char *buf, *ptr, *word = NULL; - struct _mate *him; - - restart: - len = bufsize >> 1; - buf = calloc(1,bufsize + 1); - if (!buf) { - fprintf(stderr, "Out of memory\n"); - return -1; - } - memset(buf, ' ', bufsize); - ptr = buf + len; - while ((read(fd, buf + len, len)) > 0) { - while (ptr && *ptr) { - word = ptr; - ptr = strpbrk(word," \n\t\r"); - if (!ptr && word < (buf + len)) { - bufsize = bufsize << 1; - if (debug) - fprintf(stderr, "ID overflow, restarting with size %zi\n", bufsize); - free(buf); - lseek(fd, 0, SEEK_SET); - goto restart; - } - if (ptr) { - *ptr = '\0'; - ptr++; - if (!strlen(word)) - continue; - - if (debug) - fprintf(stderr, "Found word %s\n", word); - him = malloc(sizeof (struct _mate)); - him->name = strdup(word); - him->state = STATE_OLD; - udev_list_node_append(&him->node, &bunch); - word = NULL; - } - } - memcpy(buf, buf + len, len); - memset(buf + len, ' ', len); - - if (!ptr) - ptr = word; - if (!ptr) - break; - ptr -= len; - } - - free(buf); - return 0; -} - -/* - * invite - * - * Adds a new ID 'us' to the internal list, - * marks it as confirmed. - */ -static void invite(char *us) -{ - struct udev_list_node *him_node; - struct _mate *who = NULL; - - if (debug) - fprintf(stderr, "Adding ID '%s'\n", us); - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (!strcmp(him->name, us)) { - him->state = STATE_CONFIRMED; - who = him; - } - } - if (debug && !who) - fprintf(stderr, "ID '%s' not in database\n", us); - -} - -/* - * reject - * - * Marks the ID 'us' as invalid, - * causing it to be removed when the - * list is written out. - */ -static void reject(char *us) -{ - struct udev_list_node *him_node; - struct _mate *who = NULL; - - if (debug) - fprintf(stderr, "Removing ID '%s'\n", us); - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (!strcmp(him->name, us)) { - him->state = STATE_NONE; - who = him; - } - } - if (debug && !who) - fprintf(stderr, "ID '%s' not in database\n", us); -} - -/* - * kickout - * - * Remove all IDs in the internal list which are not part - * of the list passed via the commandline. - */ -static void kickout(void) -{ - struct udev_list_node *him_node; - struct udev_list_node *tmp; - - udev_list_node_foreach_safe(him_node, tmp, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (him->state == STATE_OLD) { - udev_list_node_remove(&him->node); - free(him->name); - free(him); - } - } -} - -/* - * missing - * - * Counts all missing IDs in the internal list. - */ -static int missing(int fd) -{ - char *buf; - int ret = 0; - struct udev_list_node *him_node; - - buf = malloc(bufsize); - if (!buf) - return -1; - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (him->state == STATE_NONE) { - ret++; - } else { - while (strlen(him->name)+1 >= bufsize) { - char *tmpbuf; - - bufsize = bufsize << 1; - tmpbuf = realloc(buf, bufsize); - if (!tmpbuf) { - free(buf); - return -1; - } - buf = tmpbuf; - } - snprintf(buf, strlen(him->name)+2, "%s ", him->name); - write(fd, buf, strlen(buf)); - } - } - - free(buf); - return ret; -} - -/* - * everybody - * - * Prints out the status of the internal list. - */ -static void everybody(void) -{ - struct udev_list_node *him_node; - const char *state = ""; - - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - switch (him->state) { - case STATE_NONE: - state = "none"; - break; - case STATE_OLD: - state = "old"; - break; - case STATE_CONFIRMED: - state = "confirmed"; - break; - } - fprintf(stderr, "ID: %s=%s\n", him->name, state); - } -} - -int main(int argc, char **argv) -{ - struct udev *udev; - static const struct option options[] = { - { "add", no_argument, NULL, 'a' }, - { "remove", no_argument, NULL, 'r' }, - { "debug", no_argument, NULL, 'd' }, - { "help", no_argument, NULL, 'h' }, - {} - }; - int argi; - char *checkpoint, *us; - int fd; - int i; - int ret = EXIT_SUCCESS; - int prune = 0; - char tmpdir[UTIL_PATH_SIZE]; - - udev = udev_new(); - if (udev == NULL) { - ret = EXIT_FAILURE; - goto exit; - } - - while (1) { - int option; - - option = getopt_long(argc, argv, "ardh", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'a': - prune = 0; - break; - case 'r': - prune = 1; - break; - case 'd': - debug = 1; - break; - case 'h': - usage(); - goto exit; - default: - ret = 1; - goto exit; - } - } - - argi = optind; - if (argi + 2 > argc) { - printf("Missing parameter(s)\n"); - ret = 1; - goto exit; - } - checkpoint = argv[argi++]; - us = argv[argi++]; - - if (signal(SIGALRM, sig_alrm) == SIG_ERR) { - fprintf(stderr, "Cannot set SIGALRM: %s\n", strerror(errno)); - ret = 2; - goto exit; - } - - udev_list_node_init(&bunch); - - if (debug) - fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); - - util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL); - fd = prepare(tmpdir, checkpoint); - if (fd < 0) { - ret = 3; - goto out; - } - - if (checkout(fd) < 0) { - ret = 2; - goto out; - } - - for (i = argi; i < argc; i++) { - struct udev_list_node *him_node; - struct _mate *who; - - who = NULL; - udev_list_node_foreach(him_node, &bunch) { - struct _mate *him = node_to_mate(him_node); - - if (!strcmp(him->name, argv[i])) - who = him; - } - if (!who) { - struct _mate *him; - - if (debug) - fprintf(stderr, "ID %s: not in database\n", argv[i]); - him = malloc(sizeof (struct _mate)); - him->name = malloc(strlen(argv[i]) + 1); - strcpy(him->name, argv[i]); - him->state = STATE_NONE; - udev_list_node_append(&him->node, &bunch); - } else { - if (debug) - fprintf(stderr, "ID %s: found in database\n", argv[i]); - who->state = STATE_CONFIRMED; - } - } - - if (prune) - reject(us); - else - invite(us); - - if (debug) { - everybody(); - fprintf(stderr, "Prune lists\n"); - } - kickout(); - - lseek(fd, 0, SEEK_SET); - ftruncate(fd, 0); - ret = missing(fd); - - lockf(fd, F_ULOCK, 0); - close(fd); -out: - if (debug) - everybody(); - if (ret >= 0) - printf("COLLECT_%s=%d\n", checkpoint, ret); -exit: - udev_unref(udev); - return ret; -} diff --git a/src/extras/edd_id/.gitignore b/src/extras/edd_id/.gitignore deleted file mode 100644 index 14fb67c634..0000000000 --- a/src/extras/edd_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -edd_id diff --git a/src/extras/edd_id/61-persistent-storage-edd.rules b/src/extras/edd_id/61-persistent-storage-edd.rules deleted file mode 100644 index 6b4fb8ecfe..0000000000 --- a/src/extras/edd_id/61-persistent-storage-edd.rules +++ /dev/null @@ -1,12 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="persistent_storage_edd_end" -SUBSYSTEM!="block", GOTO="persistent_storage_edd_end" -KERNEL!="sd*|hd*|cciss*", GOTO="persistent_storage_edd_end" - -# BIOS Enhanced Disk Device -ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $devnode" -ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -LABEL="persistent_storage_edd_end" diff --git a/src/extras/edd_id/edd_id.c b/src/extras/edd_id/edd_id.c deleted file mode 100644 index 471ea60533..0000000000 --- a/src/extras/edd_id/edd_id.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * edd_id - naming of BIOS disk devices via EDD - * - * Copyright (C) 2005 John Hull - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - const char *node = NULL; - int i; - int export = 0; - uint32_t disk_id; - uint16_t mbr_valid; - struct dirent *dent; - int disk_fd; - int sysfs_fd; - DIR *dir = NULL; - int rc = 1; - char filename[UTIL_PATH_SIZE]; - char match[UTIL_PATH_SIZE]; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("edd_id"); - udev_set_log_fn(udev, log_fn); - - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; - - if (strcmp(arg, "--export") == 0) { - export = 1; - } else - node = arg; - } - if (node == NULL) { - err(udev, "no node specified\n"); - fprintf(stderr, "no node specified\n"); - goto exit; - } - - /* check for kernel support */ - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/firmware/edd", NULL); - dir = opendir(filename); - if (dir == NULL) { - info(udev, "no kernel EDD support\n"); - fprintf(stderr, "no kernel EDD support\n"); - rc = 2; - goto exit; - } - - disk_fd = open(node, O_RDONLY); - if (disk_fd < 0) { - info(udev, "unable to open '%s'\n", node); - fprintf(stderr, "unable to open '%s'\n", node); - rc = 3; - goto closedir; - } - - /* check for valid MBR signature */ - if (lseek(disk_fd, 510, SEEK_SET) < 0) { - info(udev, "seek to MBR validity failed '%s'\n", node); - rc = 4; - goto close; - } - if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { - info(udev, "read MBR validity failed '%s'\n", node); - rc = 5; - goto close; - } - if (mbr_valid != 0xAA55) { - fprintf(stderr, "no valid MBR signature '%s'\n", node); - info(udev, "no valid MBR signature '%s'\n", node); - rc=6; - goto close; - } - - /* read EDD signature */ - if (lseek(disk_fd, 440, SEEK_SET) < 0) { - info(udev, "seek to signature failed '%s'\n", node); - rc = 7; - goto close; - } - if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { - info(udev, "read signature failed '%s'\n", node); - rc = 8; - goto close; - } - /* all zero is invalid */ - info(udev, "read id 0x%08x from '%s'\n", disk_id, node); - if (disk_id == 0) { - fprintf(stderr, "no EDD signature '%s'\n", node); - info(udev, "'%s' signature is zero\n", node); - rc = 9; - goto close; - } - - /* lookup signature in sysfs to determine the name */ - match[0] = '\0'; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char sysfs_id_buf[256]; - uint32_t sysfs_id; - ssize_t size; - - if (dent->d_name[0] == '.') - continue; - - util_strscpyl(filename, sizeof(filename), dent->d_name, "/mbr_signature", NULL); - sysfs_fd = openat(dirfd(dir), filename, O_RDONLY); - if (sysfs_fd < 0) { - info(udev, "unable to open sysfs '%s'\n", filename); - continue; - } - - size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); - close(sysfs_fd); - if (size <= 0) { - info(udev, "read sysfs '%s' failed\n", filename); - continue; - } - sysfs_id_buf[size] = '\0'; - info(udev, "read '%s' from '%s'\n", sysfs_id_buf, filename); - sysfs_id = strtoul(sysfs_id_buf, NULL, 16); - - /* look for matching value, that appears only once */ - if (disk_id == sysfs_id) { - if (match[0] == '\0') { - /* store id */ - util_strscpy(match, sizeof(match), dent->d_name); - } else { - /* error, same signature for another device */ - info(udev, "'%s' does not have a unique signature\n", node); - fprintf(stderr, "'%s' does not have a unique signature\n", node); - rc = 10; - goto exit; - } - } - } - - if (match[0] != '\0') { - if (export) - printf("ID_EDD=%s\n", match); - else - printf("%s\n", match); - rc = 0; - } - -close: - close(disk_fd); -closedir: - closedir(dir); -exit: - udev_unref(udev); - udev_log_close(); - return rc; -} diff --git a/src/extras/floppy/.gitignore b/src/extras/floppy/.gitignore deleted file mode 100644 index 939f625a4a..0000000000 --- a/src/extras/floppy/.gitignore +++ /dev/null @@ -1 +0,0 @@ -create_floppy_devices diff --git a/src/extras/floppy/60-floppy.rules b/src/extras/floppy/60-floppy.rules deleted file mode 100644 index 53e4a9e59a..0000000000 --- a/src/extras/floppy/60-floppy.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM=="block", KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", ENV{CMOS_TYPE}="$attr{cmos}", \ - RUN+="create_floppy_devices -c -t $env{CMOS_TYPE} -m %M -M 0660 -G floppy $root/%k" diff --git a/src/extras/floppy/create_floppy_devices.c b/src/extras/floppy/create_floppy_devices.c deleted file mode 100644 index f71ef0d809..0000000000 --- a/src/extras/floppy/create_floppy_devices.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Create all possible floppy device based on the CMOS type. - * Based upon code from drivers/block/floppy.c - * - * Copyright(C) 2005, SUSE Linux Products GmbH - * - * Author: Hannes Reinecke - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static char *table[] = { - "", "d360", "h1200", "u360", "u720", "h360", "h720", - "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410", - "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743", - "h880", "u1040", "u1120", "h1600", "u1760", "u1920", - "u3200", "u3520", "u3840", "u1840", "u800", "u1600", - NULL -}; - -static int t360[] = { 1, 0 }; -static int t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 }; -static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, 17, 21, 22, 30, 0 }; -static int *table_sup[] = { NULL, t360, t1200, t3in+5+8, t3in+5, t3in, t3in }; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -int main(int argc, char **argv) -{ - struct udev *udev; - char *dev; - char *devname; - char node[64]; - int type = 0, i, fdnum, c; - int major = 2, minor; - uid_t uid = 0; - gid_t gid = 0; - mode_t mode = 0660; - int create_nodes = 0; - int print_nodes = 0; - int is_err = 0; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("create_floppy_devices"); - udev_set_log_fn(udev, log_fn); - udev_selinux_init(udev); - - while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { - switch (c) { - case 'c': - create_nodes = 1; - break; - case 'd': - print_nodes = 1; - break; - case 'U': - uid = util_lookup_user(udev, optarg); - break; - case 'G': - gid = util_lookup_group(udev, optarg); - break; - case 'M': - mode = strtol(optarg, NULL, 0); - mode = mode & 0666; - break; - case 'm': - major = strtol(optarg, NULL, 0); - break; - case 't': - type = strtol(optarg, NULL, 0); - break; - default: - is_err++; - break; - } - } - - if (is_err || optind >= argc) { - printf("Usage: %s [OPTION] device\n" - " -c create\n" - " -d debug\n" - " -m Major number\n" - " -t floppy type number\n" - " -U device node user ownership\n" - " -G device node group owner\n" - " -M device node mode\n" - "\n", argv[0]); - return 1; - } - - dev = argv[optind]; - devname = strrchr(dev, '/'); - if (devname != NULL) - devname = &devname[1]; - else - devname = dev; - if (strncmp(devname, "fd", 2) != 0) { - fprintf(stderr,"Device '%s' is not a floppy device\n", dev); - return 1; - } - - fdnum = strtol(&devname[2], NULL, 10); - if (fdnum < 0 || fdnum > 7) { - fprintf(stderr,"Floppy device number %d out of range (0-7)\n", fdnum); - return 1; - } - if (fdnum > 3) - fdnum += 124; - - if (major < 1) { - fprintf(stderr,"Invalid major number %d\n", major); - return 1; - } - - if (type < 0 || type >= (int) ARRAY_SIZE(table_sup)) { - fprintf(stderr,"Invalid CMOS type %d\n", type); - return 1; - } - - if (type == 0) - return 0; - - i = 0; - while (table_sup[type][i]) { - sprintf(node, "%s%s", dev, table[table_sup[type][i]]); - minor = (table_sup[type][i] << 2) + fdnum; - if (print_nodes) - printf("%s b %.4o %d %d\n", node, mode, major, minor); - if (create_nodes) { - unlink(node); - udev_selinux_setfscreatecon(udev, node, S_IFBLK | mode); - mknod(node, S_IFBLK | mode, makedev(major,minor)); - udev_selinux_resetfscreatecon(udev); - chown(node, uid, gid); - chmod(node, S_IFBLK | mode); - } - i++; - } - - udev_selinux_exit(udev); - udev_unref(udev); - udev_log_close(); -exit: - return 0; -} diff --git a/src/extras/gudev/.gitignore b/src/extras/gudev/.gitignore deleted file mode 100644 index d20fa523e4..0000000000 --- a/src/extras/gudev/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -gtk-doc.make -docs/version.xml -gudev-1.0.pc -gudevenumtypes.c -gudevenumtypes.h -gudevmarshal.c -gudevmarshal.h -GUdev-1.0.gir -GUdev-1.0.typelib diff --git a/src/extras/gudev/COPYING b/src/extras/gudev/COPYING deleted file mode 100644 index da97db2bd0..0000000000 --- a/src/extras/gudev/COPYING +++ /dev/null @@ -1,502 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! diff --git a/src/extras/gudev/docs/.gitignore b/src/extras/gudev/docs/.gitignore deleted file mode 100644 index 8eada6d409..0000000000 --- a/src/extras/gudev/docs/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -gudev-overrides.txt -gudev-decl-list.txt -gudev-decl.txt -gudev-undeclared.txt -gudev-undocumented.txt -gudev-unused.txt -gudev.args -gudev.hierarchy -gudev.interfaces -gudev.prerequisites -gudev.signals -html.stamp -html/* -xml/* -tmpl/* -*.stamp diff --git a/src/extras/gudev/docs/Makefile.am b/src/extras/gudev/docs/Makefile.am deleted file mode 100644 index 3512197660..0000000000 --- a/src/extras/gudev/docs/Makefile.am +++ /dev/null @@ -1,106 +0,0 @@ -## Process this file with automake to produce Makefile.in - -# We require automake 1.10 at least. -AUTOMAKE_OPTIONS = 1.10 - -# This is a blank Makefile.am for using gtk-doc. -# Copy this to your project's API docs directory and modify the variables to -# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples -# of using the various options. - -# The name of the module, e.g. 'glib'. -DOC_MODULE=gudev - -# Uncomment for versioned docs and specify the version of the module, e.g. '2'. -#DOC_MODULE_VERSION=2 - -# The top-level SGML file. You can change this if you want to. -DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml - -# The directory containing the source code. Relative to $(srcdir). -# gtk-doc will search all .c & .h files beneath here for inline comments -# documenting the functions and macros. -# e.g. DOC_SOURCE_DIR=../../../gtk -DOC_SOURCE_DIR=$(top_srcdir)/src - -# Extra options to pass to gtkdoc-scangobj. Not normally needed. -SCANGOBJ_OPTIONS= - -# Extra options to supply to gtkdoc-scan. -# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" -SCAN_OPTIONS= - -# Extra options to supply to gtkdoc-mkdb. -# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml -MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=g_udev - -# Extra options to supply to gtkdoc-mktmpl -# e.g. MKTMPL_OPTIONS=--only-section-tmpl -MKTMPL_OPTIONS= - -# Extra options to supply to gtkdoc-mkhtml -MKHTML_OPTIONS=--path=$(abs_srcdir) --path=$(abs_builddir) - -# Extra options to supply to gtkdoc-fixref. Not normally needed. -# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html -FIXXREF_OPTIONS= - -# Used for dependencies. The docs will be rebuilt if any of these change. -# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h -# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c -HFILE_GLOB=$(top_srcdir)/src/extras/gudev/*.h -CFILE_GLOB=$(top_srcdir)/src/extras/gudev/*.c - -# Extra header to include when scanning, which are not under DOC_SOURCE_DIR -# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h -EXTRA_HFILES= - -# Header files to ignore when scanning. Use base file name, no paths -# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h -IGNORE_HFILES= - -# Images to copy into HTML directory. -# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png -HTML_IMAGES= - -# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). -# e.g. content_files=running.sgml building.sgml changes-2.0.sgml -content_files = version.xml - -# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded -# These files must be listed here *and* in content_files -# e.g. expand_content_files=running.sgml -expand_content_files= - -# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. -# Only needed if you are using gtkdoc-scangobj to dynamically query widget -# signals and properties. -# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) -# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -GTKDOC_CFLAGS = \ - $(DBUS_GLIB_CFLAGS) \ - $(GLIB_CFLAGS) \ - -I$(top_srcdir)/src/extras/gudev \ - -I$(top_builddir)/src/extras/gudev - -GTKDOC_LIBS = \ - $(GLIB_LIBS) \ - $(top_builddir)/src/extras/gudev/libgudev-1.0.la - -# This includes the standard gtk-doc make rules, copied by gtkdocize. -include $(top_srcdir)/gtk-doc.make - -# Other files to distribute -# e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST += version.xml.in - -# Files not to distribute -# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types -# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt -#DISTCLEANFILES += - -# Comment this out if you want your docs-status tested during 'make check' -if ENABLE_GTK_DOC -#TESTS_ENVIRONMENT = cd $(srcsrc) -#TESTS = $(GTKDOC_CHECK) -endif diff --git a/src/extras/gudev/docs/gudev-docs.xml b/src/extras/gudev/docs/gudev-docs.xml deleted file mode 100644 index f876c3bc05..0000000000 --- a/src/extras/gudev/docs/gudev-docs.xml +++ /dev/null @@ -1,93 +0,0 @@ - - -]> - - - GUDev Reference Manual - For GUdev version &version; - - - David - Zeuthen - -
            - davidz@redhat.com -
            -
            -
            - - Bastien - Nocera - -
            - hadess@hadess.net -
            -
            -
            -
            - - - 2011 - The GUDev Authors - - - - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free - Documentation License, Version 1.1 or any later - version published by the Free Software Foundation with no - Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. You may obtain a copy of the GNU Free - Documentation License from the Free Software - Foundation by visiting their Web site or by writing - to: - -
            - The Free Software Foundation, Inc., - 59 Temple Place - Suite 330, - Boston, MA 02111-1307, - USA -
            -
            - - - Many of the names used by companies to distinguish their - products and services are claimed as trademarks. Where those - names appear in any freedesktop.org documentation, and those - trademarks are made aware to the members of the - freedesktop.org Project, the names have been printed in caps - or initial caps. - -
            -
            - - - API Reference - - - This part presents the class and function reference for the - libgudev library. - - - - - - - - - Object Hierarchy - - - - Index - - - Index of new symbols in 165 - - - -
            diff --git a/src/extras/gudev/docs/gudev-sections.txt b/src/extras/gudev/docs/gudev-sections.txt deleted file mode 100644 index 213e1a7465..0000000000 --- a/src/extras/gudev/docs/gudev-sections.txt +++ /dev/null @@ -1,113 +0,0 @@ -
            -gudevclient -GUdevClient -GUdevClient -GUdevClientClass -GUdevDeviceType -GUdevDeviceNumber -g_udev_client_new -g_udev_client_query_by_subsystem -g_udev_client_query_by_device_number -g_udev_client_query_by_device_file -g_udev_client_query_by_sysfs_path -g_udev_client_query_by_subsystem_and_name - -G_UDEV_CLIENT -G_UDEV_IS_CLIENT -G_UDEV_TYPE_CLIENT -g_udev_client_get_type -G_UDEV_CLIENT_CLASS -G_UDEV_IS_CLIENT_CLASS -G_UDEV_CLIENT_GET_CLASS - -GUdevClientPrivate -
            - -
            -gudevdevice -GUdevDevice -GUdevDevice -GUdevDeviceClass -g_udev_device_get_subsystem -g_udev_device_get_devtype -g_udev_device_get_name -g_udev_device_get_number -g_udev_device_get_sysfs_path -g_udev_device_get_driver -g_udev_device_get_action -g_udev_device_get_seqnum -g_udev_device_get_device_type -g_udev_device_get_device_number -g_udev_device_get_device_file -g_udev_device_get_device_file_symlinks -g_udev_device_get_parent -g_udev_device_get_parent_with_subsystem -g_udev_device_get_tags -g_udev_device_get_is_initialized -g_udev_device_get_usec_since_initialized -g_udev_device_get_property_keys -g_udev_device_has_property -g_udev_device_get_property -g_udev_device_get_property_as_int -g_udev_device_get_property_as_uint64 -g_udev_device_get_property_as_double -g_udev_device_get_property_as_boolean -g_udev_device_get_property_as_strv -g_udev_device_get_sysfs_attr -g_udev_device_get_sysfs_attr_as_int -g_udev_device_get_sysfs_attr_as_uint64 -g_udev_device_get_sysfs_attr_as_double -g_udev_device_get_sysfs_attr_as_boolean -g_udev_device_get_sysfs_attr_as_strv - -G_UDEV_DEVICE -G_UDEV_IS_DEVICE -G_UDEV_TYPE_DEVICE -g_udev_device_get_type -G_UDEV_DEVICE_CLASS -G_UDEV_IS_DEVICE_CLASS -G_UDEV_DEVICE_GET_CLASS - -GUdevDevicePrivate -
            - -
            -gudevenumerator -GUdevEnumerator -GUdevEnumerator -GUdevEnumeratorClass -g_udev_enumerator_new -g_udev_enumerator_add_match_subsystem -g_udev_enumerator_add_nomatch_subsystem -g_udev_enumerator_add_match_sysfs_attr -g_udev_enumerator_add_nomatch_sysfs_attr -g_udev_enumerator_add_match_property -g_udev_enumerator_add_match_name -g_udev_enumerator_add_match_tag -g_udev_enumerator_add_match_is_initialized -g_udev_enumerator_add_sysfs_path -g_udev_enumerator_execute - -G_UDEV_ENUMERATOR -G_UDEV_IS_ENUMERATOR -G_UDEV_TYPE_ENUMERATOR -g_udev_enumerator_get_type -G_UDEV_ENUMERATOR_CLASS -G_UDEV_IS_ENUMERATOR_CLASS -G_UDEV_ENUMERATOR_GET_CLASS - -GUdevEnumeratorPrivate -
            - -
            -gudevmarshal - -g_udev_marshal_VOID__STRING_OBJECT -
            - -
            -gudevenumtypes - -G_TYPE_UDEV_DEVICE_TYPE -g_udev_device_type_get_type -
            diff --git a/src/extras/gudev/docs/gudev.types b/src/extras/gudev/docs/gudev.types deleted file mode 100644 index a89857a04d..0000000000 --- a/src/extras/gudev/docs/gudev.types +++ /dev/null @@ -1,4 +0,0 @@ -g_udev_device_type_get_type -g_udev_device_get_type -g_udev_client_get_type -g_udev_enumerator_get_type diff --git a/src/extras/gudev/docs/version.xml.in b/src/extras/gudev/docs/version.xml.in deleted file mode 100644 index d78bda9342..0000000000 --- a/src/extras/gudev/docs/version.xml.in +++ /dev/null @@ -1 +0,0 @@ -@VERSION@ diff --git a/src/extras/gudev/gjs-example.js b/src/extras/gudev/gjs-example.js deleted file mode 100755 index 5586fd6a61..0000000000 --- a/src/extras/gudev/gjs-example.js +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env gjs-console - -// This currently depends on the following patches to gjs -// -// http://bugzilla.gnome.org/show_bug.cgi?id=584558 -// http://bugzilla.gnome.org/show_bug.cgi?id=584560 -// http://bugzilla.gnome.org/show_bug.cgi?id=584568 - -const GUdev = imports.gi.GUdev; -const Mainloop = imports.mainloop; - -function print_device (device) { - print (" subsystem: " + device.get_subsystem ()); - print (" devtype: " + device.get_devtype ()); - print (" name: " + device.get_name ()); - print (" number: " + device.get_number ()); - print (" sysfs_path: " + device.get_sysfs_path ()); - print (" driver: " + device.get_driver ()); - print (" action: " + device.get_action ()); - print (" seqnum: " + device.get_seqnum ()); - print (" device type: " + device.get_device_type ()); - print (" device number: " + device.get_device_number ()); - print (" device file: " + device.get_device_file ()); - print (" device file symlinks: " + device.get_device_file_symlinks ()); - print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); - var keys = device.get_property_keys (); - for (var n = 0; n < keys.length; n++) { - print (" " + keys[n] + "=" + device.get_property (keys[n])); - } -} - -function on_uevent (client, action, device) { - print ("action " + action + " on device " + device.get_sysfs_path()); - print_device (device); - print (""); -} - -var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); -client.connect ("uevent", on_uevent); - -var block_devices = client.query_by_subsystem ("block"); -for (var n = 0; n < block_devices.length; n++) { - print ("block device: " + block_devices[n].get_device_file ()); -} - -var d; - -d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); -if (d == null) { - print ("query_by_device_number 0x810 -> null"); -} else { - print ("query_by_device_number 0x810 -> " + d.get_device_file ()); - var dd = d.get_parent_with_subsystem ("usb", null); - print_device (dd); - print ("--------------------------------------------------------------------------"); - while (d != null) { - print_device (d); - print (""); - d = d.get_parent (); - } -} - -d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); -print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); - -d = client.query_by_subsystem_and_name ("block", "sda2"); -print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); - -d = client.query_by_device_file ("/dev/sda"); -print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); - -d = client.query_by_device_file ("/dev/block/8:0"); -print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); - -Mainloop.run('udev-example'); diff --git a/src/extras/gudev/gudev-1.0.pc.in b/src/extras/gudev/gudev-1.0.pc.in deleted file mode 100644 index 058262d767..0000000000 --- a/src/extras/gudev/gudev-1.0.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: gudev-1.0 -Description: GObject bindings for libudev -Version: @VERSION@ -Requires: glib-2.0, gobject-2.0 -Libs: -L${libdir} -lgudev-1.0 -Cflags: -I${includedir}/gudev-1.0 diff --git a/src/extras/gudev/gudev.h b/src/extras/gudev/gudev.h deleted file mode 100644 index a313460817..0000000000 --- a/src/extras/gudev/gudev.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#ifndef __G_UDEV_H__ -#define __G_UDEV_H__ - -#define _GUDEV_INSIDE_GUDEV_H 1 -#include -#include -#include -#include -#include -#include -#undef _GUDEV_INSIDE_GUDEV_H - -#endif /* __G_UDEV_H__ */ diff --git a/src/extras/gudev/gudevclient.c b/src/extras/gudev/gudevclient.c deleted file mode 100644 index 2b94102ac5..0000000000 --- a/src/extras/gudev/gudevclient.c +++ /dev/null @@ -1,527 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008-2010 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "gudevclient.h" -#include "gudevdevice.h" -#include "gudevmarshal.h" -#include "gudevprivate.h" - -/** - * SECTION:gudevclient - * @short_description: Query devices and listen to uevents - * - * #GUdevClient is used to query information about devices on a Linux - * system from the Linux kernel and the udev device - * manager. - * - * Device information is retrieved from the kernel (through the - * sysfs filesystem) and the udev daemon (through a - * tmpfs filesystem) and presented through - * #GUdevDevice objects. This means that no blocking IO ever happens - * (in both cases, we are essentially just reading data from kernel - * memory) and as such there are no asynchronous versions of the - * provided methods. - * - * To get #GUdevDevice objects, use - * g_udev_client_query_by_subsystem(), - * g_udev_client_query_by_device_number(), - * g_udev_client_query_by_device_file(), - * g_udev_client_query_by_sysfs_path(), - * g_udev_client_query_by_subsystem_and_name() - * or the #GUdevEnumerator type. - * - * To listen to uevents, connect to the #GUdevClient::uevent signal. - */ - -struct _GUdevClientPrivate -{ - GSource *watch_source; - struct udev *udev; - struct udev_monitor *monitor; - - gchar **subsystems; -}; - -enum -{ - PROP_0, - PROP_SUBSYSTEMS, -}; - -enum -{ - UEVENT_SIGNAL, - LAST_SIGNAL, -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -G_DEFINE_TYPE (GUdevClient, g_udev_client, G_TYPE_OBJECT) - -/* ---------------------------------------------------------------------------------------------------- */ - -static gboolean -monitor_event (GIOChannel *source, - GIOCondition condition, - gpointer data) -{ - GUdevClient *client = (GUdevClient *) data; - GUdevDevice *device; - struct udev_device *udevice; - - if (client->priv->monitor == NULL) - goto out; - udevice = udev_monitor_receive_device (client->priv->monitor); - if (udevice == NULL) - goto out; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - g_signal_emit (client, - signals[UEVENT_SIGNAL], - 0, - g_udev_device_get_action (device), - device); - g_object_unref (device); - - out: - return TRUE; -} - -static void -g_udev_client_finalize (GObject *object) -{ - GUdevClient *client = G_UDEV_CLIENT (object); - - if (client->priv->watch_source != NULL) - { - g_source_destroy (client->priv->watch_source); - client->priv->watch_source = NULL; - } - - if (client->priv->monitor != NULL) - { - udev_monitor_unref (client->priv->monitor); - client->priv->monitor = NULL; - } - - if (client->priv->udev != NULL) - { - udev_unref (client->priv->udev); - client->priv->udev = NULL; - } - - g_strfreev (client->priv->subsystems); - - if (G_OBJECT_CLASS (g_udev_client_parent_class)->finalize != NULL) - G_OBJECT_CLASS (g_udev_client_parent_class)->finalize (object); -} - -static void -g_udev_client_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GUdevClient *client = G_UDEV_CLIENT (object); - - switch (prop_id) - { - case PROP_SUBSYSTEMS: - if (client->priv->subsystems != NULL) - g_strfreev (client->priv->subsystems); - client->priv->subsystems = g_strdupv (g_value_get_boxed (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -g_udev_client_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GUdevClient *client = G_UDEV_CLIENT (object); - - switch (prop_id) - { - case PROP_SUBSYSTEMS: - g_value_set_boxed (value, client->priv->subsystems); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -g_udev_client_constructed (GObject *object) -{ - GUdevClient *client = G_UDEV_CLIENT (object); - GIOChannel *channel; - guint n; - - client->priv->udev = udev_new (); - - /* connect to event source */ - client->priv->monitor = udev_monitor_new_from_netlink (client->priv->udev, "udev"); - - //g_debug ("ss = %p", client->priv->subsystems); - - if (client->priv->subsystems != NULL) - { - /* install subsystem filters to only wake up for certain events */ - for (n = 0; client->priv->subsystems[n] != NULL; n++) - { - gchar *subsystem; - gchar *devtype; - gchar *s; - - subsystem = g_strdup (client->priv->subsystems[n]); - devtype = NULL; - - //g_debug ("s = '%s'", subsystem); - - s = strstr (subsystem, "/"); - if (s != NULL) - { - devtype = s + 1; - *s = '\0'; - } - - if (client->priv->monitor != NULL) - udev_monitor_filter_add_match_subsystem_devtype (client->priv->monitor, subsystem, devtype); - - g_free (subsystem); - } - - /* listen to events, and buffer them */ - if (client->priv->monitor != NULL) - { - udev_monitor_enable_receiving (client->priv->monitor); - channel = g_io_channel_unix_new (udev_monitor_get_fd (client->priv->monitor)); - client->priv->watch_source = g_io_create_watch (channel, G_IO_IN); - g_io_channel_unref (channel); - g_source_set_callback (client->priv->watch_source, (GSourceFunc) monitor_event, client, NULL); - g_source_attach (client->priv->watch_source, g_main_context_get_thread_default ()); - g_source_unref (client->priv->watch_source); - } - else - { - client->priv->watch_source = NULL; - } - } - - if (G_OBJECT_CLASS (g_udev_client_parent_class)->constructed != NULL) - G_OBJECT_CLASS (g_udev_client_parent_class)->constructed (object); -} - - -static void -g_udev_client_class_init (GUdevClientClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - - gobject_class->constructed = g_udev_client_constructed; - gobject_class->set_property = g_udev_client_set_property; - gobject_class->get_property = g_udev_client_get_property; - gobject_class->finalize = g_udev_client_finalize; - - /** - * GUdevClient:subsystems: - * - * The subsystems to listen for uevents on. - * - * To listen for only a specific DEVTYPE for a given SUBSYSTEM, use - * "subsystem/devtype". For example, to only listen for uevents - * where SUBSYSTEM is usb and DEVTYPE is usb_interface, use - * "usb/usb_interface". - * - * If this property is %NULL, then no events will be reported. If - * it's the empty array, events from all subsystems will be - * reported. - */ - g_object_class_install_property (gobject_class, - PROP_SUBSYSTEMS, - g_param_spec_boxed ("subsystems", - "The subsystems to listen for changes on", - "The subsystems to listen for changes on", - G_TYPE_STRV, - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_READWRITE)); - - /** - * GUdevClient::uevent: - * @client: The #GUdevClient receiving the event. - * @action: The action for the uevent e.g. "add", "remove", "change", "move", etc. - * @device: Details about the #GUdevDevice the event is for. - * - * Emitted when @client receives an uevent. - * - * This signal is emitted in the - * thread-default main loop - * of the thread that @client was created in. - */ - signals[UEVENT_SIGNAL] = g_signal_new ("uevent", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GUdevClientClass, uevent), - NULL, - NULL, - g_udev_marshal_VOID__STRING_OBJECT, - G_TYPE_NONE, - 2, - G_TYPE_STRING, - G_UDEV_TYPE_DEVICE); - - g_type_class_add_private (klass, sizeof (GUdevClientPrivate)); -} - -static void -g_udev_client_init (GUdevClient *client) -{ - client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, - G_UDEV_TYPE_CLIENT, - GUdevClientPrivate); -} - -/** - * g_udev_client_new: - * @subsystems: (array zero-terminated=1) (element-type utf8) (transfer none) (allow-none): A %NULL terminated string array of subsystems to listen for uevents on, %NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the #GUdevClient:subsystems property for details on this parameter. - * - * Constructs a #GUdevClient object that can be used to query - * information about devices. Connect to the #GUdevClient::uevent - * signal to listen for uevents. Note that signals are emitted in the - * thread-default main loop - * of the thread that you call this constructor from. - * - * Returns: A new #GUdevClient object. Free with g_object_unref(). - */ -GUdevClient * -g_udev_client_new (const gchar * const *subsystems) -{ - return G_UDEV_CLIENT (g_object_new (G_UDEV_TYPE_CLIENT, "subsystems", subsystems, NULL)); -} - -/** - * g_udev_client_query_by_subsystem: - * @client: A #GUdevClient. - * @subsystem: (allow-none): The subsystem to get devices for or %NULL to get all devices. - * - * Gets all devices belonging to @subsystem. - * - * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. - */ -GList * -g_udev_client_query_by_subsystem (GUdevClient *client, - const gchar *subsystem) -{ - struct udev_enumerate *enumerate; - struct udev_list_entry *l, *devices; - GList *ret; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - - ret = NULL; - - /* prepare a device scan */ - enumerate = udev_enumerate_new (client->priv->udev); - - /* filter for subsystem */ - if (subsystem != NULL) - udev_enumerate_add_match_subsystem (enumerate, subsystem); - /* retrieve the list */ - udev_enumerate_scan_devices (enumerate); - - /* add devices to the list */ - devices = udev_enumerate_get_list_entry (enumerate); - for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) - { - struct udev_device *udevice; - GUdevDevice *device; - - udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerate), - udev_list_entry_get_name (l)); - if (udevice == NULL) - continue; - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - ret = g_list_prepend (ret, device); - } - udev_enumerate_unref (enumerate); - - ret = g_list_reverse (ret); - - return ret; -} - -/** - * g_udev_client_query_by_device_number: - * @client: A #GUdevClient. - * @type: A value from the #GUdevDeviceType enumeration. - * @number: A device number. - * - * Looks up a device for a type and device number. - * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_client_query_by_device_number (GUdevClient *client, - GUdevDeviceType type, - GUdevDeviceNumber number) -{ - struct udev_device *udevice; - GUdevDevice *device; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - - device = NULL; - udevice = udev_device_new_from_devnum (client->priv->udev, type, number); - - if (udevice == NULL) - goto out; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - - out: - return device; -} - -/** - * g_udev_client_query_by_device_file: - * @client: A #GUdevClient. - * @device_file: A device file. - * - * Looks up a device for a device file. - * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_client_query_by_device_file (GUdevClient *client, - const gchar *device_file) -{ - struct stat stat_buf; - GUdevDevice *device; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - g_return_val_if_fail (device_file != NULL, NULL); - - device = NULL; - - if (stat (device_file, &stat_buf) != 0) - goto out; - - if (stat_buf.st_rdev == 0) - goto out; - - if (S_ISBLK (stat_buf.st_mode)) - device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_BLOCK, stat_buf.st_rdev); - else if (S_ISCHR (stat_buf.st_mode)) - device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_CHAR, stat_buf.st_rdev); - - out: - return device; -} - -/** - * g_udev_client_query_by_sysfs_path: - * @client: A #GUdevClient. - * @sysfs_path: A sysfs path. - * - * Looks up a device for a sysfs path. - * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_client_query_by_sysfs_path (GUdevClient *client, - const gchar *sysfs_path) -{ - struct udev_device *udevice; - GUdevDevice *device; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - g_return_val_if_fail (sysfs_path != NULL, NULL); - - device = NULL; - udevice = udev_device_new_from_syspath (client->priv->udev, sysfs_path); - if (udevice == NULL) - goto out; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - - out: - return device; -} - -/** - * g_udev_client_query_by_subsystem_and_name: - * @client: A #GUdevClient. - * @subsystem: A subsystem name. - * @name: The name of the device. - * - * Looks up a device for a subsystem and name. - * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_client_query_by_subsystem_and_name (GUdevClient *client, - const gchar *subsystem, - const gchar *name) -{ - struct udev_device *udevice; - GUdevDevice *device; - - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - g_return_val_if_fail (subsystem != NULL, NULL); - g_return_val_if_fail (name != NULL, NULL); - - device = NULL; - udevice = udev_device_new_from_subsystem_sysname (client->priv->udev, subsystem, name); - if (udevice == NULL) - goto out; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - - out: - return device; -} - -struct udev * -_g_udev_client_get_udev (GUdevClient *client) -{ - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - return client->priv->udev; -} diff --git a/src/extras/gudev/gudevclient.h b/src/extras/gudev/gudevclient.h deleted file mode 100644 index b425d03d48..0000000000 --- a/src/extras/gudev/gudevclient.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_CLIENT_H__ -#define __G_UDEV_CLIENT_H__ - -#include - -G_BEGIN_DECLS - -#define G_UDEV_TYPE_CLIENT (g_udev_client_get_type ()) -#define G_UDEV_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_CLIENT, GUdevClient)) -#define G_UDEV_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_CLIENT, GUdevClientClass)) -#define G_UDEV_IS_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_CLIENT)) -#define G_UDEV_IS_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_CLIENT)) -#define G_UDEV_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_CLIENT, GUdevClientClass)) - -typedef struct _GUdevClientClass GUdevClientClass; -typedef struct _GUdevClientPrivate GUdevClientPrivate; - -/** - * GUdevClient: - * - * The #GUdevClient struct is opaque and should not be accessed directly. - */ -struct _GUdevClient -{ - GObject parent; - - /*< private >*/ - GUdevClientPrivate *priv; -}; - -/** - * GUdevClientClass: - * @parent_class: Parent class. - * @uevent: Signal class handler for the #GUdevClient::uevent signal. - * - * Class structure for #GUdevClient. - */ -struct _GUdevClientClass -{ - GObjectClass parent_class; - - /* signals */ - void (*uevent) (GUdevClient *client, - const gchar *action, - GUdevDevice *device); - - /*< private >*/ - /* Padding for future expansion */ - void (*reserved1) (void); - void (*reserved2) (void); - void (*reserved3) (void); - void (*reserved4) (void); - void (*reserved5) (void); - void (*reserved6) (void); - void (*reserved7) (void); - void (*reserved8) (void); -}; - -GType g_udev_client_get_type (void) G_GNUC_CONST; -GUdevClient *g_udev_client_new (const gchar* const *subsystems); -GList *g_udev_client_query_by_subsystem (GUdevClient *client, - const gchar *subsystem); -GUdevDevice *g_udev_client_query_by_device_number (GUdevClient *client, - GUdevDeviceType type, - GUdevDeviceNumber number); -GUdevDevice *g_udev_client_query_by_device_file (GUdevClient *client, - const gchar *device_file); -GUdevDevice *g_udev_client_query_by_sysfs_path (GUdevClient *client, - const gchar *sysfs_path); -GUdevDevice *g_udev_client_query_by_subsystem_and_name (GUdevClient *client, - const gchar *subsystem, - const gchar *name); - -G_END_DECLS - -#endif /* __G_UDEV_CLIENT_H__ */ diff --git a/src/extras/gudev/gudevdevice.c b/src/extras/gudev/gudevdevice.c deleted file mode 100644 index 62a26f99b7..0000000000 --- a/src/extras/gudev/gudevdevice.c +++ /dev/null @@ -1,963 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "gudevdevice.h" -#include "gudevprivate.h" - -/** - * SECTION:gudevdevice - * @short_description: Get information about a device - * - * The #GUdevDevice class is used to get information about a specific - * device. Note that you cannot instantiate a #GUdevDevice object - * yourself. Instead you must use #GUdevClient to obtain #GUdevDevice - * objects. - * - * To get basic information about a device, use - * g_udev_device_get_subsystem(), g_udev_device_get_devtype(), - * g_udev_device_get_name(), g_udev_device_get_number(), - * g_udev_device_get_sysfs_path(), g_udev_device_get_driver(), - * g_udev_device_get_action(), g_udev_device_get_seqnum(), - * g_udev_device_get_device_type(), g_udev_device_get_device_number(), - * g_udev_device_get_device_file(), - * g_udev_device_get_device_file_symlinks(). - * - * To navigate the device tree, use g_udev_device_get_parent() and - * g_udev_device_get_parent_with_subsystem(). - * - * To access udev properties for the device, use - * g_udev_device_get_property_keys(), - * g_udev_device_has_property(), - * g_udev_device_get_property(), - * g_udev_device_get_property_as_int(), - * g_udev_device_get_property_as_uint64(), - * g_udev_device_get_property_as_double(), - * g_udev_device_get_property_as_boolean() and - * g_udev_device_get_property_as_strv(). - * - * To access sysfs attributes for the device, use - * g_udev_device_get_sysfs_attr(), - * g_udev_device_get_sysfs_attr_as_int(), - * g_udev_device_get_sysfs_attr_as_uint64(), - * g_udev_device_get_sysfs_attr_as_double(), - * g_udev_device_get_sysfs_attr_as_boolean() and - * g_udev_device_get_sysfs_attr_as_strv(). - * - * Note that all getters on #GUdevDevice are non-reffing – returned - * values are owned by the object, should not be freed and are only - * valid as long as the object is alive. - * - * By design, #GUdevDevice will not react to changes for a device – it - * only contains a snapshot of information when the #GUdevDevice - * object was created. To work with changes, you typically connect to - * the #GUdevClient::uevent signal on a #GUdevClient and get a new - * #GUdevDevice whenever an event happens. - */ - -struct _GUdevDevicePrivate -{ - struct udev_device *udevice; - - /* computed ondemand and cached */ - gchar **device_file_symlinks; - gchar **property_keys; - gchar **tags; - GHashTable *prop_strvs; - GHashTable *sysfs_attr_strvs; -}; - -G_DEFINE_TYPE (GUdevDevice, g_udev_device, G_TYPE_OBJECT) - -static void -g_udev_device_finalize (GObject *object) -{ - GUdevDevice *device = G_UDEV_DEVICE (object); - - g_strfreev (device->priv->device_file_symlinks); - g_strfreev (device->priv->property_keys); - g_strfreev (device->priv->tags); - - if (device->priv->udevice != NULL) - udev_device_unref (device->priv->udevice); - - if (device->priv->prop_strvs != NULL) - g_hash_table_unref (device->priv->prop_strvs); - - if (device->priv->sysfs_attr_strvs != NULL) - g_hash_table_unref (device->priv->sysfs_attr_strvs); - - if (G_OBJECT_CLASS (g_udev_device_parent_class)->finalize != NULL) - (* G_OBJECT_CLASS (g_udev_device_parent_class)->finalize) (object); -} - -static void -g_udev_device_class_init (GUdevDeviceClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - - gobject_class->finalize = g_udev_device_finalize; - - g_type_class_add_private (klass, sizeof (GUdevDevicePrivate)); -} - -static void -g_udev_device_init (GUdevDevice *device) -{ - device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device, - G_UDEV_TYPE_DEVICE, - GUdevDevicePrivate); -} - - -GUdevDevice * -_g_udev_device_new (struct udev_device *udevice) -{ - GUdevDevice *device; - - device = G_UDEV_DEVICE (g_object_new (G_UDEV_TYPE_DEVICE, NULL)); - device->priv->udevice = udev_device_ref (udevice); - - return device; -} - -/** - * g_udev_device_get_subsystem: - * @device: A #GUdevDevice. - * - * Gets the subsystem for @device. - * - * Returns: The subsystem for @device. - */ -const gchar * -g_udev_device_get_subsystem (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_subsystem (device->priv->udevice); -} - -/** - * g_udev_device_get_devtype: - * @device: A #GUdevDevice. - * - * Gets the device type for @device. - * - * Returns: The devtype for @device. - */ -const gchar * -g_udev_device_get_devtype (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_devtype (device->priv->udevice); -} - -/** - * g_udev_device_get_name: - * @device: A #GUdevDevice. - * - * Gets the name of @device, e.g. "sda3". - * - * Returns: The name of @device. - */ -const gchar * -g_udev_device_get_name (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_sysname (device->priv->udevice); -} - -/** - * g_udev_device_get_number: - * @device: A #GUdevDevice. - * - * Gets the number of @device, e.g. "3" if g_udev_device_get_name() returns "sda3". - * - * Returns: The number of @device. - */ -const gchar * -g_udev_device_get_number (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_sysnum (device->priv->udevice); -} - -/** - * g_udev_device_get_sysfs_path: - * @device: A #GUdevDevice. - * - * Gets the sysfs path for @device. - * - * Returns: The sysfs path for @device. - */ -const gchar * -g_udev_device_get_sysfs_path (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_syspath (device->priv->udevice); -} - -/** - * g_udev_device_get_driver: - * @device: A #GUdevDevice. - * - * Gets the name of the driver used for @device. - * - * Returns: The name of the driver for @device or %NULL if unknown. - */ -const gchar * -g_udev_device_get_driver (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_driver (device->priv->udevice); -} - -/** - * g_udev_device_get_action: - * @device: A #GUdevDevice. - * - * Gets the most recent action (e.g. "add", "remove", "change", etc.) for @device. - * - * Returns: An action string. - */ -const gchar * -g_udev_device_get_action (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_action (device->priv->udevice); -} - -/** - * g_udev_device_get_seqnum: - * @device: A #GUdevDevice. - * - * Gets the most recent sequence number for @device. - * - * Returns: A sequence number. - */ -guint64 -g_udev_device_get_seqnum (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - return udev_device_get_seqnum (device->priv->udevice); -} - -/** - * g_udev_device_get_device_type: - * @device: A #GUdevDevice. - * - * Gets the type of the device file, if any, for @device. - * - * Returns: The device number for @device or #G_UDEV_DEVICE_TYPE_NONE if the device does not have a device file. - */ -GUdevDeviceType -g_udev_device_get_device_type (GUdevDevice *device) -{ - struct stat stat_buf; - const gchar *device_file; - GUdevDeviceType type; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), G_UDEV_DEVICE_TYPE_NONE); - - type = G_UDEV_DEVICE_TYPE_NONE; - - /* TODO: would be better to have support for this in libudev... */ - - device_file = g_udev_device_get_device_file (device); - if (device_file == NULL) - goto out; - - if (stat (device_file, &stat_buf) != 0) - goto out; - - if (S_ISBLK (stat_buf.st_mode)) - type = G_UDEV_DEVICE_TYPE_BLOCK; - else if (S_ISCHR (stat_buf.st_mode)) - type = G_UDEV_DEVICE_TYPE_CHAR; - - out: - return type; -} - -/** - * g_udev_device_get_device_number: - * @device: A #GUdevDevice. - * - * Gets the device number, if any, for @device. - * - * Returns: The device number for @device or 0 if unknown. - */ -GUdevDeviceNumber -g_udev_device_get_device_number (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - return udev_device_get_devnum (device->priv->udevice); -} - -/** - * g_udev_device_get_device_file: - * @device: A #GUdevDevice. - * - * Gets the device file for @device. - * - * Returns: The device file for @device or %NULL if no device file - * exists. - */ -const gchar * -g_udev_device_get_device_file (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - return udev_device_get_devnode (device->priv->udevice); -} - -/** - * g_udev_device_get_device_file_symlinks: - * @device: A #GUdevDevice. - * - * Gets a list of symlinks (in /dev) that points to - * the device file for @device. - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of symlinks. This array is owned by @device and should not be freed by the caller. - */ -const gchar * const * -g_udev_device_get_device_file_symlinks (GUdevDevice *device) -{ - struct udev_list_entry *l; - GPtrArray *p; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - - if (device->priv->device_file_symlinks != NULL) - goto out; - - p = g_ptr_array_new (); - for (l = udev_device_get_devlinks_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) - { - g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); - } - g_ptr_array_add (p, NULL); - device->priv->device_file_symlinks = (gchar **) g_ptr_array_free (p, FALSE); - - out: - return (const gchar * const *) device->priv->device_file_symlinks; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -/** - * g_udev_device_get_parent: - * @device: A #GUdevDevice. - * - * Gets the immediate parent of @device, if any. - * - * Returns: (transfer full): A #GUdevDevice or %NULL if @device has no parent. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_device_get_parent (GUdevDevice *device) -{ - GUdevDevice *ret; - struct udev_device *udevice; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - - ret = NULL; - - udevice = udev_device_get_parent (device->priv->udevice); - if (udevice == NULL) - goto out; - - ret = _g_udev_device_new (udevice); - - out: - return ret; -} - -/** - * g_udev_device_get_parent_with_subsystem: - * @device: A #GUdevDevice. - * @subsystem: The subsystem of the parent to get. - * @devtype: (allow-none): The devtype of the parent to get or %NULL. - * - * Walks up the chain of parents of @device and returns the first - * device encountered where @subsystem and @devtype matches, if any. - * - * Returns: (transfer full): A #GUdevDevice or %NULL if @device has no parent with @subsystem and @devtype. Free with g_object_unref(). - */ -GUdevDevice * -g_udev_device_get_parent_with_subsystem (GUdevDevice *device, - const gchar *subsystem, - const gchar *devtype) -{ - GUdevDevice *ret; - struct udev_device *udevice; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (subsystem != NULL, NULL); - - ret = NULL; - - udevice = udev_device_get_parent_with_subsystem_devtype (device->priv->udevice, - subsystem, - devtype); - if (udevice == NULL) - goto out; - - ret = _g_udev_device_new (udevice); - - out: - return ret; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -/** - * g_udev_device_get_property_keys: - * @device: A #GUdevDevice. - * - * Gets all keys for properties on @device. - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of property keys. This array is owned by @device and should not be freed by the caller. - */ -const gchar* const * -g_udev_device_get_property_keys (GUdevDevice *device) -{ - struct udev_list_entry *l; - GPtrArray *p; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - - if (device->priv->property_keys != NULL) - goto out; - - p = g_ptr_array_new (); - for (l = udev_device_get_properties_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) - { - g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); - } - g_ptr_array_add (p, NULL); - device->priv->property_keys = (gchar **) g_ptr_array_free (p, FALSE); - - out: - return (const gchar * const *) device->priv->property_keys; -} - - -/** - * g_udev_device_has_property: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Check if a the property with the given key exists. - * - * Returns: %TRUE only if the value for @key exist. - */ -gboolean -g_udev_device_has_property (GUdevDevice *device, - const gchar *key) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); - g_return_val_if_fail (key != NULL, FALSE); - return udev_device_get_property_value (device->priv->udevice, key) != NULL; -} - -/** - * g_udev_device_get_property: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device. - * - * Returns: The value for @key or %NULL if @key doesn't exist on @device. Do not free this string, it is owned by @device. - */ -const gchar * -g_udev_device_get_property (GUdevDevice *device, - const gchar *key) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (key != NULL, NULL); - return udev_device_get_property_value (device->priv->udevice, key); -} - -/** - * g_udev_device_get_property_as_int: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and convert it to an integer - * using strtol(). - * - * Returns: The value for @key or 0 if @key doesn't exist or - * isn't an integer. - */ -gint -g_udev_device_get_property_as_int (GUdevDevice *device, - const gchar *key) -{ - gint result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - g_return_val_if_fail (key != NULL, 0); - - result = 0; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - result = strtol (s, NULL, 0); -out: - return result; -} - -/** - * g_udev_device_get_property_as_uint64: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and convert it to an unsigned - * 64-bit integer using g_ascii_strtoull(). - * - * Returns: The value for @key or 0 if @key doesn't exist or isn't a - * #guint64. - */ -guint64 -g_udev_device_get_property_as_uint64 (GUdevDevice *device, - const gchar *key) -{ - guint64 result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - g_return_val_if_fail (key != NULL, 0); - - result = 0; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - result = g_ascii_strtoull (s, NULL, 0); -out: - return result; -} - -/** - * g_udev_device_get_property_as_double: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and convert it to a double - * precision floating point number using strtod(). - * - * Returns: The value for @key or 0.0 if @key doesn't exist or isn't a - * #gdouble. - */ -gdouble -g_udev_device_get_property_as_double (GUdevDevice *device, - const gchar *key) -{ - gdouble result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); - g_return_val_if_fail (key != NULL, 0.0); - - result = 0.0; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - result = strtod (s, NULL); -out: - return result; -} - -/** - * g_udev_device_get_property_as_boolean: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and convert it to an - * boolean. This is done by doing a case-insensitive string comparison - * on the string value against "1" and "true". - * - * Returns: The value for @key or %FALSE if @key doesn't exist or - * isn't a #gboolean. - */ -gboolean -g_udev_device_get_property_as_boolean (GUdevDevice *device, - const gchar *key) -{ - gboolean result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); - g_return_val_if_fail (key != NULL, FALSE); - - result = FALSE; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) - result = TRUE; - out: - return result; -} - -static gchar ** -split_at_whitespace (const gchar *s) -{ - gchar **result; - guint n; - guint m; - - result = g_strsplit_set (s, " \v\t\r\n", 0); - - /* remove empty strings, thanks GLib */ - for (n = 0; result[n] != NULL; n++) - { - if (strlen (result[n]) == 0) - { - g_free (result[n]); - for (m = n; result[m] != NULL; m++) - result[m] = result[m + 1]; - n--; - } - } - - return result; -} - -/** - * g_udev_device_get_property_as_strv: - * @device: A #GUdevDevice. - * @key: Name of property. - * - * Look up the value for @key on @device and return the result of - * splitting it into non-empty tokens split at white space (only space - * (' '), form-feed ('\f'), newline ('\n'), carriage return ('\r'), - * horizontal tab ('\t'), and vertical tab ('\v') are considered; the - * locale is not taken into account). - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of @key on @device split into tokens or %NULL if @key doesn't exist. This array is owned by @device and should not be freed by the caller. - */ -const gchar* const * -g_udev_device_get_property_as_strv (GUdevDevice *device, - const gchar *key) -{ - gchar **result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (key != NULL, NULL); - - if (device->priv->prop_strvs != NULL) - { - result = g_hash_table_lookup (device->priv->prop_strvs, key); - if (result != NULL) - goto out; - } - - result = NULL; - s = g_udev_device_get_property (device, key); - if (s == NULL) - goto out; - - result = split_at_whitespace (s); - if (result == NULL) - goto out; - - if (device->priv->prop_strvs == NULL) - device->priv->prop_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); - g_hash_table_insert (device->priv->prop_strvs, g_strdup (key), result); - -out: - return (const gchar* const *) result; -} - -/* ---------------------------------------------------------------------------------------------------- */ - -/** - * g_udev_device_get_sysfs_attr: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device. - * - * Returns: The value of the sysfs attribute or %NULL if there is no - * such attribute. Do not free this string, it is owned by @device. - */ -const gchar * -g_udev_device_get_sysfs_attr (GUdevDevice *device, - const gchar *name) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (name != NULL, NULL); - return udev_device_get_sysattr_value (device->priv->udevice, name); -} - -/** - * g_udev_device_get_sysfs_attr_as_int: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and convert it to an integer - * using strtol(). - * - * Returns: The value of the sysfs attribute or 0 if there is no such - * attribute. - */ -gint -g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, - const gchar *name) -{ - gint result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - g_return_val_if_fail (name != NULL, 0); - - result = 0; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - result = strtol (s, NULL, 0); -out: - return result; -} - -/** - * g_udev_device_get_sysfs_attr_as_uint64: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and convert it to an unsigned - * 64-bit integer using g_ascii_strtoull(). - * - * Returns: The value of the sysfs attribute or 0 if there is no such - * attribute. - */ -guint64 -g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, - const gchar *name) -{ - guint64 result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - g_return_val_if_fail (name != NULL, 0); - - result = 0; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - result = g_ascii_strtoull (s, NULL, 0); -out: - return result; -} - -/** - * g_udev_device_get_sysfs_attr_as_double: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and convert it to a double - * precision floating point number using strtod(). - * - * Returns: The value of the sysfs attribute or 0.0 if there is no such - * attribute. - */ -gdouble -g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, - const gchar *name) -{ - gdouble result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); - g_return_val_if_fail (name != NULL, 0.0); - - result = 0.0; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - result = strtod (s, NULL); -out: - return result; -} - -/** - * g_udev_device_get_sysfs_attr_as_boolean: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and convert it to an - * boolean. This is done by doing a case-insensitive string comparison - * on the string value against "1" and "true". - * - * Returns: The value of the sysfs attribute or %FALSE if there is no such - * attribute. - */ -gboolean -g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, - const gchar *name) -{ - gboolean result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); - g_return_val_if_fail (name != NULL, FALSE); - - result = FALSE; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) - result = TRUE; - out: - return result; -} - -/** - * g_udev_device_get_sysfs_attr_as_strv: - * @device: A #GUdevDevice. - * @name: Name of the sysfs attribute. - * - * Look up the sysfs attribute with @name on @device and return the result of - * splitting it into non-empty tokens split at white space (only space (' '), - * form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal - * tab ('\t'), and vertical tab ('\v') are considered; the locale is - * not taken into account). - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of the sysfs attribute split into tokens or %NULL if there is no such attribute. This array is owned by @device and should not be freed by the caller. - */ -const gchar * const * -g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, - const gchar *name) -{ - gchar **result; - const gchar *s; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - g_return_val_if_fail (name != NULL, NULL); - - if (device->priv->sysfs_attr_strvs != NULL) - { - result = g_hash_table_lookup (device->priv->sysfs_attr_strvs, name); - if (result != NULL) - goto out; - } - - result = NULL; - s = g_udev_device_get_sysfs_attr (device, name); - if (s == NULL) - goto out; - - result = split_at_whitespace (s); - if (result == NULL) - goto out; - - if (device->priv->sysfs_attr_strvs == NULL) - device->priv->sysfs_attr_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); - g_hash_table_insert (device->priv->sysfs_attr_strvs, g_strdup (name), result); - -out: - return (const gchar* const *) result; -} - -/** - * g_udev_device_get_tags: - * @device: A #GUdevDevice. - * - * Gets all tags for @device. - * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of tags. This array is owned by @device and should not be freed by the caller. - * - * Since: 165 - */ -const gchar* const * -g_udev_device_get_tags (GUdevDevice *device) -{ - struct udev_list_entry *l; - GPtrArray *p; - - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); - - if (device->priv->tags != NULL) - goto out; - - p = g_ptr_array_new (); - for (l = udev_device_get_tags_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) - { - g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); - } - g_ptr_array_add (p, NULL); - device->priv->tags = (gchar **) g_ptr_array_free (p, FALSE); - - out: - return (const gchar * const *) device->priv->tags; -} - -/** - * g_udev_device_get_is_initialized: - * @device: A #GUdevDevice. - * - * Gets whether @device has been initalized. - * - * Returns: Whether @device has been initialized. - * - * Since: 165 - */ -gboolean -g_udev_device_get_is_initialized (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); - return udev_device_get_is_initialized (device->priv->udevice); -} - -/** - * g_udev_device_get_usec_since_initialized: - * @device: A #GUdevDevice. - * - * Gets number of micro-seconds since @device was initialized. - * - * This only works for devices with properties in the udev - * database. All other devices return 0. - * - * Returns: Number of micro-seconds since @device was initialized or 0 if unknown. - * - * Since: 165 - */ -guint64 -g_udev_device_get_usec_since_initialized (GUdevDevice *device) -{ - g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); - return udev_device_get_usec_since_initialized (device->priv->udevice); -} diff --git a/src/extras/gudev/gudevdevice.h b/src/extras/gudev/gudevdevice.h deleted file mode 100644 index d4873bad0f..0000000000 --- a/src/extras/gudev/gudevdevice.h +++ /dev/null @@ -1,128 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_DEVICE_H__ -#define __G_UDEV_DEVICE_H__ - -#include - -G_BEGIN_DECLS - -#define G_UDEV_TYPE_DEVICE (g_udev_device_get_type ()) -#define G_UDEV_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_DEVICE, GUdevDevice)) -#define G_UDEV_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) -#define G_UDEV_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_DEVICE)) -#define G_UDEV_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_DEVICE)) -#define G_UDEV_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) - -typedef struct _GUdevDeviceClass GUdevDeviceClass; -typedef struct _GUdevDevicePrivate GUdevDevicePrivate; - -/** - * GUdevDevice: - * - * The #GUdevDevice struct is opaque and should not be accessed directly. - */ -struct _GUdevDevice -{ - GObject parent; - - /*< private >*/ - GUdevDevicePrivate *priv; -}; - -/** - * GUdevDeviceClass: - * @parent_class: Parent class. - * - * Class structure for #GUdevDevice. - */ -struct _GUdevDeviceClass -{ - GObjectClass parent_class; - - /*< private >*/ - /* Padding for future expansion */ - void (*reserved1) (void); - void (*reserved2) (void); - void (*reserved3) (void); - void (*reserved4) (void); - void (*reserved5) (void); - void (*reserved6) (void); - void (*reserved7) (void); - void (*reserved8) (void); -}; - -GType g_udev_device_get_type (void) G_GNUC_CONST; -gboolean g_udev_device_get_is_initialized (GUdevDevice *device); -guint64 g_udev_device_get_usec_since_initialized (GUdevDevice *device); -const gchar *g_udev_device_get_subsystem (GUdevDevice *device); -const gchar *g_udev_device_get_devtype (GUdevDevice *device); -const gchar *g_udev_device_get_name (GUdevDevice *device); -const gchar *g_udev_device_get_number (GUdevDevice *device); -const gchar *g_udev_device_get_sysfs_path (GUdevDevice *device); -const gchar *g_udev_device_get_driver (GUdevDevice *device); -const gchar *g_udev_device_get_action (GUdevDevice *device); -guint64 g_udev_device_get_seqnum (GUdevDevice *device); -GUdevDeviceType g_udev_device_get_device_type (GUdevDevice *device); -GUdevDeviceNumber g_udev_device_get_device_number (GUdevDevice *device); -const gchar *g_udev_device_get_device_file (GUdevDevice *device); -const gchar* const *g_udev_device_get_device_file_symlinks (GUdevDevice *device); -GUdevDevice *g_udev_device_get_parent (GUdevDevice *device); -GUdevDevice *g_udev_device_get_parent_with_subsystem (GUdevDevice *device, - const gchar *subsystem, - const gchar *devtype); -const gchar* const *g_udev_device_get_property_keys (GUdevDevice *device); -gboolean g_udev_device_has_property (GUdevDevice *device, - const gchar *key); -const gchar *g_udev_device_get_property (GUdevDevice *device, - const gchar *key); -gint g_udev_device_get_property_as_int (GUdevDevice *device, - const gchar *key); -guint64 g_udev_device_get_property_as_uint64 (GUdevDevice *device, - const gchar *key); -gdouble g_udev_device_get_property_as_double (GUdevDevice *device, - const gchar *key); -gboolean g_udev_device_get_property_as_boolean (GUdevDevice *device, - const gchar *key); -const gchar* const *g_udev_device_get_property_as_strv (GUdevDevice *device, - const gchar *key); - -const gchar *g_udev_device_get_sysfs_attr (GUdevDevice *device, - const gchar *name); -gint g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, - const gchar *name); -guint64 g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, - const gchar *name); -gdouble g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, - const gchar *name); -gboolean g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, - const gchar *name); -const gchar* const *g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, - const gchar *name); -const gchar* const *g_udev_device_get_tags (GUdevDevice *device); - -G_END_DECLS - -#endif /* __G_UDEV_DEVICE_H__ */ diff --git a/src/extras/gudev/gudevenumerator.c b/src/extras/gudev/gudevenumerator.c deleted file mode 100644 index db09074625..0000000000 --- a/src/extras/gudev/gudevenumerator.c +++ /dev/null @@ -1,431 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008-2010 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include - -#include "gudevclient.h" -#include "gudevenumerator.h" -#include "gudevdevice.h" -#include "gudevmarshal.h" -#include "gudevprivate.h" - -/** - * SECTION:gudevenumerator - * @short_description: Lookup and sort devices - * - * #GUdevEnumerator is used to lookup and sort devices. - * - * Since: 165 - */ - -struct _GUdevEnumeratorPrivate -{ - GUdevClient *client; - struct udev_enumerate *e; -}; - -enum -{ - PROP_0, - PROP_CLIENT, -}; - -G_DEFINE_TYPE (GUdevEnumerator, g_udev_enumerator, G_TYPE_OBJECT) - -/* ---------------------------------------------------------------------------------------------------- */ - -static void -g_udev_enumerator_finalize (GObject *object) -{ - GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); - - if (enumerator->priv->client != NULL) - { - g_object_unref (enumerator->priv->client); - enumerator->priv->client = NULL; - } - - if (enumerator->priv->e != NULL) - { - udev_enumerate_unref (enumerator->priv->e); - enumerator->priv->e = NULL; - } - - if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize != NULL) - G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize (object); -} - -static void -g_udev_enumerator_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); - - switch (prop_id) - { - case PROP_CLIENT: - if (enumerator->priv->client != NULL) - g_object_unref (enumerator->priv->client); - enumerator->priv->client = g_value_dup_object (value); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -g_udev_enumerator_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); - - switch (prop_id) - { - case PROP_CLIENT: - g_value_set_object (value, enumerator->priv->client); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - break; - } -} - -static void -g_udev_enumerator_constructed (GObject *object) -{ - GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); - - g_assert (G_UDEV_IS_CLIENT (enumerator->priv->client)); - - enumerator->priv->e = udev_enumerate_new (_g_udev_client_get_udev (enumerator->priv->client)); - - if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed != NULL) - G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed (object); -} - -static void -g_udev_enumerator_class_init (GUdevEnumeratorClass *klass) -{ - GObjectClass *gobject_class = (GObjectClass *) klass; - - gobject_class->finalize = g_udev_enumerator_finalize; - gobject_class->set_property = g_udev_enumerator_set_property; - gobject_class->get_property = g_udev_enumerator_get_property; - gobject_class->constructed = g_udev_enumerator_constructed; - - /** - * GUdevEnumerator:client: - * - * The #GUdevClient to enumerate devices from. - * - * Since: 165 - */ - g_object_class_install_property (gobject_class, - PROP_CLIENT, - g_param_spec_object ("client", - "The client to enumerate devices from", - "The client to enumerate devices from", - G_UDEV_TYPE_CLIENT, - G_PARAM_CONSTRUCT_ONLY | - G_PARAM_READWRITE)); - - g_type_class_add_private (klass, sizeof (GUdevEnumeratorPrivate)); -} - -static void -g_udev_enumerator_init (GUdevEnumerator *enumerator) -{ - enumerator->priv = G_TYPE_INSTANCE_GET_PRIVATE (enumerator, - G_UDEV_TYPE_ENUMERATOR, - GUdevEnumeratorPrivate); -} - -/** - * g_udev_enumerator_new: - * @client: A #GUdevClient to enumerate devices from. - * - * Constructs a #GUdevEnumerator object that can be used to enumerate - * and sort devices. Use the add_match_*() and add_nomatch_*() methods - * and execute the query to get a list of devices with - * g_udev_enumerator_execute(). - * - * Returns: A new #GUdevEnumerator object. Free with g_object_unref(). - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_new (GUdevClient *client) -{ - g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); - return G_UDEV_ENUMERATOR (g_object_new (G_UDEV_TYPE_ENUMERATOR, "client", client, NULL)); -} - - -/** - * g_udev_enumerator_add_match_subsystem: - * @enumerator: A #GUdevEnumerator. - * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. - * - * All returned devices will match the given @subsystem. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, - const gchar *subsystem) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (subsystem != NULL, NULL); - udev_enumerate_add_match_subsystem (enumerator->priv->e, subsystem); - return enumerator; -} - -/** - * g_udev_enumerator_add_nomatch_subsystem: - * @enumerator: A #GUdevEnumerator. - * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. - * - * All returned devices will not match the given @subsystem. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, - const gchar *subsystem) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (subsystem != NULL, NULL); - udev_enumerate_add_nomatch_subsystem (enumerator->priv->e, subsystem); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_sysfs_attr: - * @enumerator: A #GUdevEnumerator. - * @name: Wildcard filter for sysfs attribute key. - * @value: Wildcard filter for sysfs attribute value. - * - * All returned devices will have a sysfs attribute matching the given @name and @value. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (value != NULL, NULL); - udev_enumerate_add_match_sysattr (enumerator->priv->e, name, value); - return enumerator; -} - -/** - * g_udev_enumerator_add_nomatch_sysfs_attr: - * @enumerator: A #GUdevEnumerator. - * @name: Wildcard filter for sysfs attribute key. - * @value: Wildcard filter for sysfs attribute value. - * - * All returned devices will not have a sysfs attribute matching the given @name and @value. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (value != NULL, NULL); - udev_enumerate_add_nomatch_sysattr (enumerator->priv->e, name, value); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_property: - * @enumerator: A #GUdevEnumerator. - * @name: Wildcard filter for property name. - * @value: Wildcard filter for property value. - * - * All returned devices will have a property matching the given @name and @value. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (name != NULL, NULL); - g_return_val_if_fail (value != NULL, NULL); - udev_enumerate_add_match_property (enumerator->priv->e, name, value); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_name: - * @enumerator: A #GUdevEnumerator. - * @name: Wildcard filter for kernel name e.g. "sda*". - * - * All returned devices will match the given @name. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, - const gchar *name) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (name != NULL, NULL); - udev_enumerate_add_match_sysname (enumerator->priv->e, name); - return enumerator; -} - -/** - * g_udev_enumerator_add_sysfs_path: - * @enumerator: A #GUdevEnumerator. - * @sysfs_path: A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda" - * - * Add a device to the list of devices, to retrieve it back sorted in dependency order. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, - const gchar *sysfs_path) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (sysfs_path != NULL, NULL); - udev_enumerate_add_syspath (enumerator->priv->e, sysfs_path); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_tag: - * @enumerator: A #GUdevEnumerator. - * @tag: A udev tag e.g. "udev-acl". - * - * All returned devices will match the given @tag. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, - const gchar *tag) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - g_return_val_if_fail (tag != NULL, NULL); - udev_enumerate_add_match_tag (enumerator->priv->e, tag); - return enumerator; -} - -/** - * g_udev_enumerator_add_match_is_initialized: - * @enumerator: A #GUdevEnumerator. - * - * All returned devices will be initialized. - * - * Returns: (transfer none): The passed in @enumerator. - * - * Since: 165 - */ -GUdevEnumerator * -g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator) -{ - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - udev_enumerate_add_match_is_initialized (enumerator->priv->e); - return enumerator; -} - -/** - * g_udev_enumerator_execute: - * @enumerator: A #GUdevEnumerator. - * - * Executes the query in @enumerator. - * - * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. - * - * Since: 165 - */ -GList * -g_udev_enumerator_execute (GUdevEnumerator *enumerator) -{ - GList *ret; - struct udev_list_entry *l, *devices; - - g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); - - ret = NULL; - - /* retrieve the list */ - udev_enumerate_scan_devices (enumerator->priv->e); - - devices = udev_enumerate_get_list_entry (enumerator->priv->e); - for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) - { - struct udev_device *udevice; - GUdevDevice *device; - - udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerator->priv->e), - udev_list_entry_get_name (l)); - if (udevice == NULL) - continue; - - device = _g_udev_device_new (udevice); - udev_device_unref (udevice); - ret = g_list_prepend (ret, device); - } - - ret = g_list_reverse (ret); - - return ret; -} diff --git a/src/extras/gudev/gudevenumerator.h b/src/extras/gudev/gudevenumerator.h deleted file mode 100644 index 3fddccf573..0000000000 --- a/src/extras/gudev/gudevenumerator.h +++ /dev/null @@ -1,107 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008-2010 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_ENUMERATOR_H__ -#define __G_UDEV_ENUMERATOR_H__ - -#include - -G_BEGIN_DECLS - -#define G_UDEV_TYPE_ENUMERATOR (g_udev_enumerator_get_type ()) -#define G_UDEV_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumerator)) -#define G_UDEV_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) -#define G_UDEV_IS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_ENUMERATOR)) -#define G_UDEV_IS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_ENUMERATOR)) -#define G_UDEV_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) - -typedef struct _GUdevEnumeratorClass GUdevEnumeratorClass; -typedef struct _GUdevEnumeratorPrivate GUdevEnumeratorPrivate; - -/** - * GUdevEnumerator: - * - * The #GUdevEnumerator struct is opaque and should not be accessed directly. - * - * Since: 165 - */ -struct _GUdevEnumerator -{ - GObject parent; - - /*< private >*/ - GUdevEnumeratorPrivate *priv; -}; - -/** - * GUdevEnumeratorClass: - * @parent_class: Parent class. - * - * Class structure for #GUdevEnumerator. - * - * Since: 165 - */ -struct _GUdevEnumeratorClass -{ - GObjectClass parent_class; - - /*< private >*/ - /* Padding for future expansion */ - void (*reserved1) (void); - void (*reserved2) (void); - void (*reserved3) (void); - void (*reserved4) (void); - void (*reserved5) (void); - void (*reserved6) (void); - void (*reserved7) (void); - void (*reserved8) (void); -}; - -GType g_udev_enumerator_get_type (void) G_GNUC_CONST; -GUdevEnumerator *g_udev_enumerator_new (GUdevClient *client); -GUdevEnumerator *g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, - const gchar *subsystem); -GUdevEnumerator *g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, - const gchar *subsystem); -GUdevEnumerator *g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value); -GUdevEnumerator *g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value); -GUdevEnumerator *g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, - const gchar *name, - const gchar *value); -GUdevEnumerator *g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, - const gchar *name); -GUdevEnumerator *g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, - const gchar *tag); -GUdevEnumerator *g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator); -GUdevEnumerator *g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, - const gchar *sysfs_path); -GList *g_udev_enumerator_execute (GUdevEnumerator *enumerator); - -G_END_DECLS - -#endif /* __G_UDEV_ENUMERATOR_H__ */ diff --git a/src/extras/gudev/gudevenums.h b/src/extras/gudev/gudevenums.h deleted file mode 100644 index c3a0aa8747..0000000000 --- a/src/extras/gudev/gudevenums.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_ENUMS_H__ -#define __G_UDEV_ENUMS_H__ - -#include - -G_BEGIN_DECLS - -/** - * GUdevDeviceType: - * @G_UDEV_DEVICE_TYPE_NONE: Device does not have a device file. - * @G_UDEV_DEVICE_TYPE_BLOCK: Device is a block device. - * @G_UDEV_DEVICE_TYPE_CHAR: Device is a character device. - * - * Enumeration used to specify a the type of a device. - */ -typedef enum -{ - G_UDEV_DEVICE_TYPE_NONE = 0, - G_UDEV_DEVICE_TYPE_BLOCK = 'b', - G_UDEV_DEVICE_TYPE_CHAR = 'c', -} GUdevDeviceType; - -G_END_DECLS - -#endif /* __G_UDEV_ENUMS_H__ */ diff --git a/src/extras/gudev/gudevenumtypes.c.template b/src/extras/gudev/gudevenumtypes.c.template deleted file mode 100644 index fc30b39e2e..0000000000 --- a/src/extras/gudev/gudevenumtypes.c.template +++ /dev/null @@ -1,39 +0,0 @@ -/*** BEGIN file-header ***/ -#include - -/*** END file-header ***/ - -/*** BEGIN file-production ***/ -/* enumerations from "@filename@" */ -/*** END file-production ***/ - -/*** BEGIN value-header ***/ -GType -@enum_name@_get_type (void) -{ - static volatile gsize g_define_type_id__volatile = 0; - - if (g_once_init_enter (&g_define_type_id__volatile)) - { - static const G@Type@Value values[] = { -/*** END value-header ***/ - -/*** BEGIN value-production ***/ - { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, -/*** END value-production ***/ - -/*** BEGIN value-tail ***/ - { 0, NULL, NULL } - }; - GType g_define_type_id = - g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); - } - - return g_define_type_id__volatile; -} - -/*** END value-tail ***/ - -/*** BEGIN file-tail ***/ -/*** END file-tail ***/ diff --git a/src/extras/gudev/gudevenumtypes.h.template b/src/extras/gudev/gudevenumtypes.h.template deleted file mode 100644 index d0ab3393e6..0000000000 --- a/src/extras/gudev/gudevenumtypes.h.template +++ /dev/null @@ -1,24 +0,0 @@ -/*** BEGIN file-header ***/ -#ifndef __GUDEV_ENUM_TYPES_H__ -#define __GUDEV_ENUM_TYPES_H__ - -#include - -G_BEGIN_DECLS -/*** END file-header ***/ - -/*** BEGIN file-production ***/ - -/* enumerations from "@filename@" */ -/*** END file-production ***/ - -/*** BEGIN value-header ***/ -GType @enum_name@_get_type (void) G_GNUC_CONST; -#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) -/*** END value-header ***/ - -/*** BEGIN file-tail ***/ -G_END_DECLS - -#endif /* __GUDEV_ENUM_TYPES_H__ */ -/*** END file-tail ***/ diff --git a/src/extras/gudev/gudevmarshal.list b/src/extras/gudev/gudevmarshal.list deleted file mode 100644 index 7e665999e8..0000000000 --- a/src/extras/gudev/gudevmarshal.list +++ /dev/null @@ -1 +0,0 @@ -VOID:STRING,OBJECT diff --git a/src/extras/gudev/gudevprivate.h b/src/extras/gudev/gudevprivate.h deleted file mode 100644 index 8866f52b88..0000000000 --- a/src/extras/gudev/gudevprivate.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_PRIVATE_H__ -#define __G_UDEV_PRIVATE_H__ - -#include - -#include - -G_BEGIN_DECLS - -GUdevDevice * -_g_udev_device_new (struct udev_device *udevice); - -struct udev *_g_udev_client_get_udev (GUdevClient *client); - -G_END_DECLS - -#endif /* __G_UDEV_PRIVATE_H__ */ diff --git a/src/extras/gudev/gudevtypes.h b/src/extras/gudev/gudevtypes.h deleted file mode 100644 index 888482783d..0000000000 --- a/src/extras/gudev/gudevtypes.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- - * - * Copyright (C) 2008 David Zeuthen - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - */ - -#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) -#error "Only can be included directly, this file may disappear or change contents." -#endif - -#ifndef __G_UDEV_TYPES_H__ -#define __G_UDEV_TYPES_H__ - -#include -#include - -G_BEGIN_DECLS - -typedef struct _GUdevClient GUdevClient; -typedef struct _GUdevDevice GUdevDevice; -typedef struct _GUdevEnumerator GUdevEnumerator; - -/** - * GUdevDeviceNumber: - * - * Corresponds to the standard #dev_t type as defined by POSIX (Until - * bug 584517 is resolved this work-around is needed). - */ -#ifdef _GUDEV_WORK_AROUND_DEV_T_BUG -typedef guint64 GUdevDeviceNumber; /* __UQUAD_TYPE */ -#else -typedef dev_t GUdevDeviceNumber; -#endif - -G_END_DECLS - -#endif /* __G_UDEV_TYPES_H__ */ diff --git a/src/extras/gudev/seed-example-enum.js b/src/extras/gudev/seed-example-enum.js deleted file mode 100755 index 66206ad806..0000000000 --- a/src/extras/gudev/seed-example-enum.js +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env seed - -const GLib = imports.gi.GLib; -const GUdev = imports.gi.GUdev; - -function print_device(device) { - print(" initialized: " + device.get_is_initialized()); - print(" usec since initialized: " + device.get_usec_since_initialized()); - print(" subsystem: " + device.get_subsystem()); - print(" devtype: " + device.get_devtype()); - print(" name: " + device.get_name()); - print(" number: " + device.get_number()); - print(" sysfs_path: " + device.get_sysfs_path()); - print(" driver: " + device.get_driver()); - print(" action: " + device.get_action()); - print(" seqnum: " + device.get_seqnum()); - print(" device type: " + device.get_device_type()); - print(" device number: " + device.get_device_number()); - print(" device file: " + device.get_device_file()); - print(" device file symlinks: " + device.get_device_file_symlinks()); - print(" tags: " + device.get_tags()); - var keys = device.get_property_keys(); - for (var n = 0; n < keys.length; n++) { - print(" " + keys[n] + "=" + device.get_property(keys[n])); - } -} - -var client = new GUdev.Client({subsystems: []}); -var enumerator = new GUdev.Enumerator({client: client}); -enumerator.add_match_subsystem('b*') - -var devices = enumerator.execute(); - -for (var n=0; n < devices.length; n++) { - var device = devices[n]; - print_device(device); - print(""); -} diff --git a/src/extras/gudev/seed-example.js b/src/extras/gudev/seed-example.js deleted file mode 100755 index e2ac324d23..0000000000 --- a/src/extras/gudev/seed-example.js +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env seed - -// seed example - -const GLib = imports.gi.GLib; -const GUdev = imports.gi.GUdev; - -function print_device (device) { - print (" subsystem: " + device.get_subsystem ()); - print (" devtype: " + device.get_devtype ()); - print (" name: " + device.get_name ()); - print (" number: " + device.get_number ()); - print (" sysfs_path: " + device.get_sysfs_path ()); - print (" driver: " + device.get_driver ()); - print (" action: " + device.get_action ()); - print (" seqnum: " + device.get_seqnum ()); - print (" device type: " + device.get_device_type ()); - print (" device number: " + device.get_device_number ()); - print (" device file: " + device.get_device_file ()); - print (" device file symlinks: " + device.get_device_file_symlinks ()); - print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); - var keys = device.get_property_keys (); - for (var n = 0; n < keys.length; n++) { - print (" " + keys[n] + "=" + device.get_property (keys[n])); - } -} - -function on_uevent (client, action, device) { - print ("action " + action + " on device " + device.get_sysfs_path()); - print_device (device); - print (""); -} - -var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); -client.signal.connect ("uevent", on_uevent); - -var block_devices = client.query_by_subsystem ("block"); -for (var n = 0; n < block_devices.length; n++) { - print ("block device: " + block_devices[n].get_device_file ()); -} - -var d; - -d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); -if (d == null) { - print ("query_by_device_number 0x810 -> null"); -} else { - print ("query_by_device_number 0x810 -> " + d.get_device_file ()); - dd = d.get_parent_with_subsystem ("usb", null); - print_device (dd); - print ("--------------------------------------------------------------------------"); - while (d != null) { - print_device (d); - print (""); - d = d.get_parent (); - } -} - -d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); -print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); - -d = client.query_by_subsystem_and_name ("block", "sda2"); -print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); - -d = client.query_by_device_file ("/dev/sda"); -print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); - -d = client.query_by_device_file ("/dev/block/8:0"); -print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); - -var mainloop = GLib.main_loop_new (); -GLib.main_loop_run (mainloop); diff --git a/src/extras/keymap/.gitignore b/src/extras/keymap/.gitignore deleted file mode 100644 index 01d62e2b6e..0000000000 --- a/src/extras/keymap/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -keyboard-force-release.sh -keymap -keys-from-name.gperf -keys-from-name.h -keys-to-name.h -keys.txt diff --git a/src/extras/keymap/95-keyboard-force-release.rules b/src/extras/keymap/95-keyboard-force-release.rules deleted file mode 100644 index 79a1bc1cc4..0000000000 --- a/src/extras/keymap/95-keyboard-force-release.rules +++ /dev/null @@ -1,53 +0,0 @@ -# Set model specific atkbd force_release quirk -# -# Several laptops have hotkeys which don't generate release events, -# which can cause problems with software key repeat. -# The atkbd driver has a quirk handler for generating synthetic -# release events, which can be configured via sysfs since 2.6.32. -# Simply add a file with a list of scancodes for your laptop model -# in /usr/lib/udev/keymaps, and add a rule here. -# If the hotkeys also need a keymap assignment you can copy the -# scancodes from the keymap file, otherwise you can run -# /usr/lib/udev/keymap -i /dev/input/eventX -# on a Linux vt to find out. - -ACTION=="remove", GOTO="force_release_end" -SUBSYSTEM!="serio", GOTO="force_release_end" -KERNEL!="serio*", GOTO="force_release_end" -DRIVER!="atkbd", GOTO="force_release_end" - -ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" - -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.sh $devpath samsung-other" - -ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" -ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*|Precision M*", RUN+="keyboard-force-release.sh $devpath dell-touchpad" - -ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u|AMILO Xi 2428", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="FOXCONN", ATTR{[dmi/id]product_name}=="QBOOK", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite [uU]300*|Satellite Pro [uU]300*|Satellite [uU]305*|SATELLITE [uU]500*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -# These are all the HP laptops that setup a touchpad toggle key -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keyboard-force-release.sh $devpath hp-other" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keyboard-force-release.sh $devpath hp-other" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keyboard-force-release.sh $devpath hp-other" - -ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote 6615WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="6625WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="HANNspree", ATTR{[dmi/id]product_name}=="SN10E100", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="GIGABYTE", ATTR{[dmi/id]product_name}=="i1520M", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -ENV{DMI_VENDOR}=="BenQ", ATTR{[dmi/id]product_name}=="*nScreen*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" - -LABEL="force_release_end" diff --git a/src/extras/keymap/95-keymap.rules b/src/extras/keymap/95-keymap.rules deleted file mode 100644 index 26de03dcc7..0000000000 --- a/src/extras/keymap/95-keymap.rules +++ /dev/null @@ -1,169 +0,0 @@ -# Set model specific hotkey keycodes. -# -# Key map overrides can be specified by either giving scancode/keyname pairs -# directly as keymap arguments (if there are just one or two to change), or as -# a file name (in /usr/lib/udev/keymaps), which has to contain scancode/keyname -# pairs. - -ACTION=="remove", GOTO="keyboard_end" -KERNEL!="event*", GOTO="keyboard_end" -ENV{ID_INPUT_KEY}=="", GOTO="keyboard_end" -SUBSYSTEMS=="bluetooth", GOTO="keyboard_end" - -SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" -SUBSYSTEMS=="usb", GOTO="keyboard_usbcheck" -GOTO="keyboard_modulecheck" - -# -# The following are external USB keyboards -# - -LABEL="keyboard_usbcheck" - -ENV{ID_VENDOR}=="Genius", ENV{ID_MODEL_ID}=="0708", ENV{ID_USB_INTERFACE_NUM}=="01", RUN+="keymap $name genius-slimstar-320" -ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" -ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" -# Logitech Cordless Wave Pro looks slightly weird; some hotkeys are coming through the mouse interface -ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c52[9b]", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" - -ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" -ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" - -ENV{ID_VENDOR}=="Microsoft", ENV{ID_MODEL_ID}=="00db", RUN+="keymap $name 0xc022d zoomin 0xc022e zoomout" - -GOTO="keyboard_end" - -# -# The following are exposed as separate input devices with low key codes, thus -# we need to check their input device product name -# - -LABEL="keyboard_modulecheck" - -ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" -ENV{DMI_VENDOR}=="", GOTO="keyboard_end" - -ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-lenovo" -ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="Lenovo ThinkPad SL Series extra buttons", RUN+="keymap $name 0x0E bluetooth" - -ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" -ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys|Asus Laptop Support|Asus*WMI*", RUN+="keymap $name 0x6B f21" -ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC Hotkey Driver", RUN+="keymap $name 0x37 f21" - -ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" -ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" -ENV{DMI_VENDOR}=="Acer*", KERNELS=="input*", ATTRS{name}=="Acer WMI hotkeys", RUN+="keymap $name 0x82 f21" -ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", KERNELS=="input*", ATTRS{name}=="MSI Laptop hotkeys", RUN+="keymap $name 0x213 f22 0x214 f23" - -# Older Vaios have some different keys -ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" - -# Some Sony VGN models have yet another one -ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="VGN-AR71*|VGN-FW*|VGN-Z21*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-vgn" - - -# -# The following rules belong to standard i8042 AT keyboard with high key codes. -# - -DRIVERS=="atkbd", GOTO="keyboard_vendorcheck" -GOTO="keyboard_end" - -LABEL="keyboard_vendorcheck" - -ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" -ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1010|Inspiron 1011|Inspiron 1012|Inspiron 1110|Inspiron 1210", RUN+="keymap $name 0x84 wlan" -ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Latitude XT2", RUN+="keymap $name dell-latitude-xt2" - -ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" - -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x6_tablet" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X2[02]* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x200_tablet" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" -ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" -ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" - -ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keymap $name hewlett-packard-pavilion" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*|*2230s*", RUN+="keymap $name hewlett-packard-compaq_elitebook" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keymap $name hewlett-packard-2510p_2530p" -ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" -ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" -ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www" -ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill" -# HP Pavillion dv6315ea has empty DMI_VENDOR -ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play - -# Gateway clone of Acer Aspire One AOA110/AOA150 -ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer" - -ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C3[01]0*", RUN+="keymap $name acer-travelmate_c300" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|TravelMate*7720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*4720*", RUN+="keymap $name 0xB2 www 0xEE screenlock" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 8930", RUN+="keymap $name acer-aspire_8930" -ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_serial}=="ZG8*", RUN+="keymap $name acer-aspire_5720" - -ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" - -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro V3205*", RUN+="keymap $name fujitsu-amilo_pro_v3205" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pa 2548*", RUN+="keymap $name fujitsu-amilo_pa_2548" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V5*", RUN+="keymap $name fujitsu-esprimo_mobile_v5" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V6*", RUN+="keymap $name fujitsu-esprimo_mobile_v6" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro Edition V3505*", RUN+="keymap $name fujitsu-amilo_pro_edition_v3505" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+="keymap $name fujitsu-amilo_si_1520" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="Amilo Li 1718", RUN+="keymap $name 0xD6 wlan" -ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO Li 2732", RUN+="keymap $name fujitsu-amilo_li_2732" - -ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name lg-x110" - -ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" -ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" - -ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", RUN+="keymap $name micro-star" - -# some MSI models generate ACPI/input events on the LNXVIDEO input devices, -# plus some extra synthesized ones on atkbd as an echo of actually changing the -# brightness; so ignore those atkbd ones, to avoid loops -ENV{DMI_VENDOR}=="MICRO-STAR*", ATTR{[dmi/id]product_name}=="*U-100*|*U100*|*N033", RUN+="keymap $name 0xF7 reserved 0xF8 reserved" - -ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" - -ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" - -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-other" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" -ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700Z*", RUN+="keymap $name 0xBA ejectcd 0x96 keyboardbrightnessup 0x97 keyboardbrightnessdown" - -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" -ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite M30X", RUN+="keymap $name toshiba-satellite_m30x" - -ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" - -ENV{DMI_VENDOR}=="ONKYO CORPORATION", ATTR{[dmi/id]product_name}=="ONKYOPC", RUN+="keymap $name onkyo" - -ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" - -ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name 0x81 prog1" - -ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="62*|63*", RUN+="keymap $name zepto-znote" - -ENV{DMI_VENDOR}=="Everex", ATTR{[dmi/id]product_name}=="XT5000*", RUN+="keymap $name everex-xt5000" - -ENV{DMI_VENDOR}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name 0x84 wlan" - -ENV{DMI_VENDOR}=="OLPC", ATTR{[dmi/id]product_name}=="XO", RUN+="keymap $name olpc-xo" - -ENV{DMI_VENDOR}=="Alienware*", ATTR{[dmi/id]product_name}=="M14xR1", RUN+="keymap $name 0x8A ejectcd" - -LABEL="keyboard_end" diff --git a/src/extras/keymap/README.keymap.txt b/src/extras/keymap/README.keymap.txt deleted file mode 100644 index 52d50ed2de..0000000000 --- a/src/extras/keymap/README.keymap.txt +++ /dev/null @@ -1,101 +0,0 @@ -= The udev keymap tool = - -== Introduction == - -This udev extension configures computer model specific key mappings. This is -particularly necessary for the non-standard extra keys found on many laptops, -such as "brightness up", "next song", "www browser", or "suspend". Often these -are accessed with the Fn key. - -Every key produces a "scan code", which is highly vendor/model specific for the -nonstandard keys. This tool maintains mappings for these scan codes to standard -"key codes", which denote the "meaning" of the key. The key codes are defined -in /usr/include/linux/input.h. - -If some of your keys on your keyboard are not working at all, or produce the -wrong effect, then a very likely cause of this is that the scan code -> key -code mapping is incorrect on your computer. - -== Structure == - -udev-keymap consists of the following parts: - - keymaps/*:: mappings of scan codes to key code names - - 95-keymap.rules:: udev rules for mapping system vendor/product names and - input module names to one of the keymaps above - - keymap:: manipulate an evdev input device: - * write a key map file into a device (used by udev rules) - * dump current scan → key code mapping - * interactively display scan and key codes of pressed keys - - findkeyboards:: display evdev input devices which belong to actual keyboards, - i. e. those suitable for the keymap program - - fdi2rules.py:: convert hal keymap FDIs into udev rules and key map files - (Please note that this is far from perfect, since the mapping between fdi and - udev rules is not straightforward, and impossible in some cases.) - -== Fixing broken keys == - -In order to make a broken key work on your system and send it back to upstream -for inclusion you need to do the following steps: - - 1. Find the keyboard device. - - Run /usr/lib/udev/findkeyboards. This should always give you an "AT - keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and - Acers) have multimedia/function keys on a separate input device instead of the - primary keyboard. The keyboard device should have a name like "input/event3". - In the following commands, the name will be written as "input/eventX" (replace - X with the appropriate number). - - 2. Find broken scan codes: - - sudo /usr/lib/udev/keymap -i input/eventX - - Press all multimedia/function keys and check if the key name that gets printed - out is plausible. If it is unknown or wrong, write down the scan code (looks - like "0x1E") and the intended functionality of this key. Look in - /usr/include/linux/input.h for an available KEY_XXXXX constant which most - closely approximates this functionality and write it down as the new key code. - - For example, you might press a key labeled "web browser" which currently - produces "unknown". Note down this: - - 0x1E www # Fn+F2 web browser - - Repeat that for all other keys. Write the resulting list into a file. Look at - /usr/lib/udev/keymaps/ for existing key map files and make sure that you use the - same structure. - - If the key only ever works once and then your keyboard (or the entire desktop) - gets stuck for a long time, then it is likely that the BIOS fails to send a - corresponding "key release" event after the key press event. Please note down - this case as well, as it can be worked around in - /usr/lib/udev/keymaps/95-keyboard-force-release.rules . - - 3. Find out your system vendor and product: - - cat /sys/class/dmi/id/sys_vendor - cat /sys/class/dmi/id/product_name - - 4. Generate a device dump with "udevadm info --export-db > /tmp/udev-db.txt". - - 6. Send the system vendor/product names, the key mapping from step 2, - and /tmp/udev-db.txt from step 4 to the linux-hotplug@vger.kernel.org mailing - list, so that they can be included in the next release. - -For local testing, copy your map file to /usr/lib/udev/keymaps/ with an appropriate -name, and add an appropriate udev rule to /usr/lib/udev/rules.d/95-keymap.rules: - - * If you selected an "AT keyboard", add the rule to the section after - 'LABEL="keyboard_vendorcheck"'. - - * If you selected a "module", add the rule to the top section where the - "ThinkPad Extra Buttons" are. - -== Author == - -keymap is written and maintained by Martin Pitt . diff --git a/src/extras/keymap/check-keymaps.sh b/src/extras/keymap/check-keymaps.sh deleted file mode 100755 index 423699b5a8..0000000000 --- a/src/extras/keymap/check-keymaps.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -# check that all key names in keymaps/* are known in -# and that all key maps listed in the rules are valid and present in -# Makefile.am -SRCDIR=${1:-.} -KEYLIST=${2:-src/extras/keymap/keys.txt} -KEYMAPS_DIR=$SRCDIR/src/extras/keymap/keymaps -RULES=$SRCDIR/src/extras/keymap/95-keymap.rules - -[ -e "$KEYLIST" ] || { - echo "need $KEYLIST please build first" >&2 - exit 1 -} - -missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) \ - <(grep -hv '^#' ${KEYMAPS_DIR}/*| awk '{print $2}' | sort -u)) -[ -z "$missing" ] || { - echo "ERROR: unknown key names in src/extras/keymap/keymaps/*:" >&2 - echo "$missing" >&2 - exit 1 -} - -# check that all maps referred to in $RULES exist -maps=$(sed -rn '/keymap \$name/ { s/^.*\$name ([^"[:space:]]+).*$/\1/; p }' $RULES) -for m in $maps; do - # ignore inline mappings - [ "$m" = "${m#0x}" ] || continue - - [ -e ${KEYMAPS_DIR}/$m ] || { - echo "ERROR: unknown map name in $RULES: $m" >&2 - exit 1 - } - grep -q "src/extras/keymap/keymaps/$m\>" $SRCDIR/Makefile.am || { - echo "ERROR: map file $m is not added to Makefile.am" >&2 - exit 1 - } -done diff --git a/src/extras/keymap/findkeyboards b/src/extras/keymap/findkeyboards deleted file mode 100755 index 9ce27429b2..0000000000 --- a/src/extras/keymap/findkeyboards +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -e -# Find "real" keyboard devices and print their device path. -# Author: Martin Pitt -# -# Copyright (C) 2009, Canonical Ltd. -# -# 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; either version 2 of the License, or -# (at your option) any later version. -# -# 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. - -# returns OK if $1 contains $2 -strstr() { - [ "${1#*$2*}" != "$1" ] -} - -# returns OK if $1 contains $2 at the beginning -str_starts() { - [ "${1#$2*}" != "$1" ] -} - -str_line_starts() { - while read a; do str_starts "$a" "$1" && return 0;done - return 1; -} - -# print a list of input devices which are keyboard-like -keyboard_devices() { - # standard AT keyboard - for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do - walk=`udevadm info --attribute-walk --path=$dev` - env=`udevadm info --query=env --path=$dev` - # filter out non-event devices, such as the parent input devices which have no devnode - if ! echo "$env" | str_line_starts 'DEVNAME='; then - continue - fi - if strstr "$walk" 'DRIVERS=="atkbd"'; then - echo -n 'AT keyboard: ' - elif echo "$env" | str_line_starts 'ID_USB_DRIVER=usbhid'; then - echo -n 'USB keyboard: ' - else - echo -n 'Unknown type: ' - fi - udevadm info --query=name --path=$dev - done - - # modules - module=$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons') - module="$module - $(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons')" - module="$module - $(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys')" - for m in $module; do - for evdev in $m/event*/dev; do - if [ -e "$evdev" ]; then - echo -n 'module: ' - udevadm info --query=name --path=${evdev%%/dev} - fi - done - done -} - -keyboard_devices diff --git a/src/extras/keymap/force-release-maps/common-volume-keys b/src/extras/keymap/force-release-maps/common-volume-keys deleted file mode 100644 index 3a7654d735..0000000000 --- a/src/extras/keymap/force-release-maps/common-volume-keys +++ /dev/null @@ -1,3 +0,0 @@ -0xa0 #mute -0xae #volume down -0xb0 #volume up diff --git a/src/extras/keymap/force-release-maps/dell-touchpad b/src/extras/keymap/force-release-maps/dell-touchpad deleted file mode 100644 index 18e9bdee66..0000000000 --- a/src/extras/keymap/force-release-maps/dell-touchpad +++ /dev/null @@ -1 +0,0 @@ -0x9E diff --git a/src/extras/keymap/force-release-maps/hp-other b/src/extras/keymap/force-release-maps/hp-other deleted file mode 100644 index 6621370095..0000000000 --- a/src/extras/keymap/force-release-maps/hp-other +++ /dev/null @@ -1,3 +0,0 @@ -# list of scancodes (hex or decimal), optional comment -0xd8 # Touchpad off -0xd9 # Touchpad on diff --git a/src/extras/keymap/force-release-maps/samsung-other b/src/extras/keymap/force-release-maps/samsung-other deleted file mode 100644 index c51123a0b6..0000000000 --- a/src/extras/keymap/force-release-maps/samsung-other +++ /dev/null @@ -1,10 +0,0 @@ -# list of scancodes (hex or decimal), optional comment -0x82 # Fn+F4 CRT/LCD -0x83 # Fn+F2 battery -0x84 # Fn+F5 backlight on/off -0x86 # Fn+F9 WLAN -0x88 # Fn-Up brightness up -0x89 # Fn-Down brightness down -0xB3 # Fn+F8 switch power mode (battery/dynamic/performance) -0xF7 # Fn+F10 Touchpad on -0xF9 # Fn+F10 Touchpad off diff --git a/src/extras/keymap/keyboard-force-release.sh.in b/src/extras/keymap/keyboard-force-release.sh.in deleted file mode 100755 index dd040cebc3..0000000000 --- a/src/extras/keymap/keyboard-force-release.sh.in +++ /dev/null @@ -1,22 +0,0 @@ -#!@rootprefix@/bin/sh -e -# read list of scancodes, convert hex to decimal and -# append to the atkbd force_release sysfs attribute -# $1 sysfs devpath for serioX -# $2 file with scancode list (hex or dec) - -case "$2" in - /*) scf="$2" ;; - *) scf="@pkglibexecdir@/keymaps/force-release/$2" ;; -esac - -read attr <"/sys/$1/force_release" -while read scancode dummy; do - case "$scancode" in - \#*) ;; - *) - scancode=$(($scancode)) - attr="$attr${attr:+,}$scancode" - ;; - esac -done <"$scf" -echo "$attr" >"/sys/$1/force_release" diff --git a/src/extras/keymap/keymap.c b/src/extras/keymap/keymap.c deleted file mode 100644 index 92ec67b3a6..0000000000 --- a/src/extras/keymap/keymap.c +++ /dev/null @@ -1,447 +0,0 @@ -/* - * keymap - dump keymap of an evdev device or set a new keymap from a file - * - * Based on keyfuzz by Lennart Poettering - * Adapted for udev-extras by Martin Pitt - * - * Copyright (C) 2006, Lennart Poettering - * Copyright (C) 2009, Canonical Ltd. - * - * keymap 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; either version 2 of the License, or - * (at your option) any later version. - * - * keymap 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 keymap; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -const struct key* lookup_key (const char *str, unsigned int len); - -#include "keys-from-name.h" -#include "keys-to-name.h" - -#define MAX_SCANCODES 1024 - -static int evdev_open(const char *dev) -{ - int fd; - char fn[PATH_MAX]; - - if (strncmp(dev, "/dev", 4) != 0) { - snprintf(fn, sizeof(fn), "/dev/%s", dev); - dev = fn; - } - - if ((fd = open(dev, O_RDWR)) < 0) { - fprintf(stderr, "error open('%s'): %m\n", dev); - return -1; - } - return fd; -} - -static int evdev_get_keycode(int fd, int scancode, int e) -{ - int codes[2]; - - codes[0] = scancode; - if (ioctl(fd, EVIOCGKEYCODE, codes) < 0) { - if (e && errno == EINVAL) { - return -2; - } else { - fprintf(stderr, "EVIOCGKEYCODE: %m\n"); - return -1; - } - } - return codes[1]; -} - -static int evdev_set_keycode(int fd, int scancode, int keycode) -{ - int codes[2]; - - codes[0] = scancode; - codes[1] = keycode; - - if (ioctl(fd, EVIOCSKEYCODE, codes) < 0) { - fprintf(stderr, "EVIOCSKEYCODE: %m\n"); - return -1; - } - return 0; -} - -static int evdev_driver_version(int fd, char *v, size_t l) -{ - int version; - - if (ioctl(fd, EVIOCGVERSION, &version)) { - fprintf(stderr, "EVIOCGVERSION: %m\n"); - return -1; - } - - snprintf(v, l, "%i.%i.%i.", version >> 16, (version >> 8) & 0xff, version & 0xff); - return 0; -} - -static int evdev_device_name(int fd, char *n, size_t l) -{ - if (ioctl(fd, EVIOCGNAME(l), n) < 0) { - fprintf(stderr, "EVIOCGNAME: %m\n"); - return -1; - } - return 0; -} - -/* Return a lower-case string with KEY_ prefix removed */ -static const char* format_keyname(const char* key) { - static char result[101]; - const char* s; - int len; - - for (s = key+4, len = 0; *s && len < 100; ++len, ++s) - result[len] = tolower(*s); - result[len] = '\0'; - return result; -} - -static int dump_table(int fd) { - char version[256], name[256]; - int scancode, r = -1; - - if (evdev_driver_version(fd, version, sizeof(version)) < 0) - goto fail; - - if (evdev_device_name(fd, name, sizeof(name)) < 0) - goto fail; - - printf("### evdev %s, driver '%s'\n", version, name); - - r = 0; - for (scancode = 0; scancode < MAX_SCANCODES; scancode++) { - int keycode; - - if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { - if (keycode == -2) - continue; - r = -1; - break; - } - - if (keycode < KEY_MAX && key_names[keycode]) - printf("0x%03x %s\n", scancode, format_keyname(key_names[keycode])); - else - printf("0x%03x 0x%03x\n", scancode, keycode); - } -fail: - return r; -} - -static void set_key(int fd, const char* scancode_str, const char* keyname) -{ - unsigned scancode; - char *endptr; - char t[105] = "KEY_UNKNOWN"; - const struct key *k; - - scancode = (unsigned) strtol(scancode_str, &endptr, 0); - if (*endptr != '\0') { - fprintf(stderr, "ERROR: Invalid scancode\n"); - exit(1); - } - - snprintf(t, sizeof(t), "KEY_%s", keyname); - - if (!(k = lookup_key(t, strlen(t)))) { - fprintf(stderr, "ERROR: Unknown key name '%s'\n", keyname); - exit(1); - } - - if (evdev_set_keycode(fd, scancode, k->id) < 0) - fprintf(stderr, "setting scancode 0x%2X to key code %i failed\n", - scancode, k->id); - else - printf("setting scancode 0x%2X to key code %i\n", - scancode, k->id); -} - -static int merge_table(int fd, FILE *f) { - int r = 0; - int line = 0; - - while (!feof(f)) { - char s[256], *p; - int scancode, new_keycode, old_keycode; - - if (!fgets(s, sizeof(s), f)) - break; - - line++; - p = s+strspn(s, "\t "); - if (*p == '#' || *p == '\n') - continue; - - if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) { - char t[105] = "KEY_UNKNOWN"; - const struct key *k; - - if (sscanf(p, "%i %100s", &scancode, t+4) != 2) { - fprintf(stderr, "WARNING: Parse failure at line %i, ignoring.\n", line); - r = -1; - continue; - } - - if (!(k = lookup_key(t, strlen(t)))) { - fprintf(stderr, "WARNING: Unknown key '%s' at line %i, ignoring.\n", t, line); - r = -1; - continue; - } - - new_keycode = k->id; - } - - - if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0) { - r = -1; - goto fail; - } - - if (evdev_set_keycode(fd, scancode, new_keycode) < 0) { - r = -1; - goto fail; - } - - if (new_keycode != old_keycode) - fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x (prior: 0x%02x)\n", - scancode, new_keycode, old_keycode); - } -fail: - fclose(f); - return r; -} - - -/* read one event; return 1 if valid */ -static int read_event(int fd, struct input_event* ev) -{ - int ret; - ret = read(fd, ev, sizeof(struct input_event)); - - if (ret < 0) { - perror("read"); - return 0; - } - if (ret != sizeof(struct input_event)) { - fprintf(stderr, "did not get enough data for event struct, aborting\n"); - return 0; - } - - return 1; -} - -static void print_key(uint32_t scancode, uint16_t keycode, int has_scan, int has_key) -{ - const char *keyname; - - /* ignore key release events */ - if (has_key == 1) - return; - - if (has_key == 0 && has_scan != 0) { - fprintf(stderr, "got scan code event 0x%02X without a key code event\n", - scancode); - return; - } - - if (has_scan != 0) - printf("scan code: 0x%02X ", scancode); - else - printf("(no scan code received) "); - - keyname = key_names[keycode]; - if (keyname != NULL) - printf("key code: %s\n", format_keyname(keyname)); - else - printf("key code: %03X\n", keycode); -} - -static void interactive(int fd) -{ - struct input_event ev; - uint32_t last_scan = 0; - uint16_t last_key = 0; - int has_scan; /* boolean */ - int has_key; /* 0: none, 1: release, 2: press */ - - /* grab input device */ - ioctl(fd, EVIOCGRAB, 1); - puts("Press ESC to finish, or Control-C if this device is not your primary keyboard"); - - has_scan = has_key = 0; - while (read_event(fd, &ev)) { - /* Drivers usually send the scan code first, then the key code, - * then a SYN. Some drivers (like thinkpad_acpi) send the key - * code first, and some drivers might not send SYN events, so - * keep a robust state machine which can deal with any of those - */ - - if (ev.type == EV_MSC && ev.code == MSC_SCAN) { - if (has_scan) { - fputs("driver did not send SYN event in between key events; previous event:\n", - stderr); - print_key(last_scan, last_key, has_scan, has_key); - has_key = 0; - } - - last_scan = ev.value; - has_scan = 1; - /*printf("--- got scan %u; has scan %i key %i\n", last_scan, has_scan, has_key); */ - } - else if (ev.type == EV_KEY) { - if (has_key) { - fputs("driver did not send SYN event in between key events; previous event:\n", - stderr); - print_key(last_scan, last_key, has_scan, has_key); - has_scan = 0; - } - - last_key = ev.code; - has_key = 1 + ev.value; - /*printf("--- got key %hu; has scan %i key %i\n", last_key, has_scan, has_key);*/ - - /* Stop on ESC */ - if (ev.code == KEY_ESC && ev.value == 0) - break; - } - else if (ev.type == EV_SYN) { - /*printf("--- got SYN; has scan %i key %i\n", has_scan, has_key);*/ - print_key(last_scan, last_key, has_scan, has_key); - - has_scan = has_key = 0; - } - - } - - /* release input device */ - ioctl(fd, EVIOCGRAB, 0); -} - -static void help(int error) -{ - const char* h = "Usage: keymap []\n" - " keymap scancode keyname [...]\n" - " keymap -i \n"; - if (error) { - fputs(h, stderr); - exit(2); - } else { - fputs(h, stdout); - exit(0); - } -} - -int main(int argc, char **argv) -{ - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - { "interactive", no_argument, NULL, 'i' }, - {} - }; - int fd = -1; - int opt_interactive = 0; - int i; - - while (1) { - int option; - - option = getopt_long(argc, argv, "hi", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'h': - help(0); - - case 'i': - opt_interactive = 1; - break; - default: - return 1; - } - } - - if (argc < optind+1) - help (1); - - if ((fd = evdev_open(argv[optind])) < 0) - return 3; - - /* one argument (device): dump or interactive */ - if (argc == optind+1) { - if (opt_interactive) - interactive(fd); - else - dump_table(fd); - return 0; - } - - /* two arguments (device, mapfile): set map file */ - if (argc == optind+2) { - const char *filearg = argv[optind+1]; - if (strchr(filearg, '/')) { - /* Keymap file argument is a path */ - FILE *f = fopen(filearg, "r"); - if (f) - merge_table(fd, f); - else - perror(filearg); - } else { - /* Keymap file argument is a filename */ - /* Open override file if present, otherwise default file */ - char keymap_path[PATH_MAX]; - snprintf(keymap_path, sizeof(keymap_path), "%s%s", SYSCONFDIR "/udev/keymaps/", filearg); - FILE *f = fopen(keymap_path, "r"); - if (f) { - merge_table(fd, f); - } else { - snprintf(keymap_path, sizeof(keymap_path), "%s%s", PKGLIBEXECDIR "/keymaps/", filearg); - f = fopen(keymap_path, "r"); - if (f) - merge_table(fd, f); - else - perror(keymap_path); - } - } - return 0; - } - - /* more arguments (device, scancode/keyname pairs): set keys directly */ - if ((argc - optind - 1) % 2 == 0) { - for (i = optind+1; i < argc; i += 2) - set_key(fd, argv[i], argv[i+1]); - return 0; - } - - /* invalid number of arguments */ - help(1); - return 1; /* not reached */ -} diff --git a/src/extras/keymap/keymaps/acer b/src/extras/keymap/keymaps/acer deleted file mode 100644 index 4e7c297dea..0000000000 --- a/src/extras/keymap/keymaps/acer +++ /dev/null @@ -1,22 +0,0 @@ -0xA5 help # Fn+F1 -0xA6 setup # Fn+F2 Acer eSettings -0xA7 battery # Fn+F3 Power Management -0xA9 switchvideomode # Fn+F5 -0xB3 euro -0xB4 dollar -0xCE brightnessup # Fn+Right -0xD4 bluetooth # (toggle) off-to-on -0xD5 wlan # (toggle) on-to-off -0xD6 wlan # (toggle) off-to-on -0xD7 bluetooth # (toggle) on-to-off -0xD8 bluetooth # (toggle) off-to-on -0xD9 brightnessup # Fn+Right -0xEE brightnessup # Fn+Right -0xEF brightnessdown # Fn+Left -0xF1 f22 # Fn+F7 Touchpad toggle (off-to-on) -0xF2 f23 # Fn+F7 Touchpad toggle (on-to-off) -0xF3 prog2 # "P2" programmable button -0xF4 prog1 # "P1" programmable button -0xF5 presentation -0xF8 fn -0xF9 f23 # Launch NTI shadow diff --git a/src/extras/keymap/keymaps/acer-aspire_5720 b/src/extras/keymap/keymaps/acer-aspire_5720 deleted file mode 100644 index 1496d63a52..0000000000 --- a/src/extras/keymap/keymaps/acer-aspire_5720 +++ /dev/null @@ -1,4 +0,0 @@ -0x84 bluetooth # sent when bluetooth module missing, and key pressed -0x92 media # acer arcade -0xD4 bluetooth # bluetooth on -0xD9 bluetooth # bluetooth off diff --git a/src/extras/keymap/keymaps/acer-aspire_5920g b/src/extras/keymap/keymaps/acer-aspire_5920g deleted file mode 100644 index 633c4e854c..0000000000 --- a/src/extras/keymap/keymaps/acer-aspire_5920g +++ /dev/null @@ -1,5 +0,0 @@ -0x8A media -0x92 media -0xA6 setup -0xB2 www -0xD9 bluetooth # (toggle) on-to-off diff --git a/src/extras/keymap/keymaps/acer-aspire_6920 b/src/extras/keymap/keymaps/acer-aspire_6920 deleted file mode 100644 index 699c954b4e..0000000000 --- a/src/extras/keymap/keymaps/acer-aspire_6920 +++ /dev/null @@ -1,5 +0,0 @@ -0xD9 bluetooth # (toggle) on-to-off -0x92 media -0x9E back -0x83 rewind -0x89 fastforward diff --git a/src/extras/keymap/keymaps/acer-aspire_8930 b/src/extras/keymap/keymaps/acer-aspire_8930 deleted file mode 100644 index fb27bfb4f5..0000000000 --- a/src/extras/keymap/keymaps/acer-aspire_8930 +++ /dev/null @@ -1,5 +0,0 @@ -0xCA prog3 # key 'HOLD' on cine dash media console -0x83 rewind -0x89 fastforward -0x92 media # key 'ARCADE' on cine dash media console -0x9E back diff --git a/src/extras/keymap/keymaps/acer-travelmate_c300 b/src/extras/keymap/keymaps/acer-travelmate_c300 deleted file mode 100644 index bfef4cf868..0000000000 --- a/src/extras/keymap/keymaps/acer-travelmate_c300 +++ /dev/null @@ -1,5 +0,0 @@ -0x67 f24 # FIXME: rotate screen -0x68 up -0x69 down -0x6B fn -0x6C screenlock # FIXME: lock tablet device/buttons diff --git a/src/extras/keymap/keymaps/asus b/src/extras/keymap/keymaps/asus deleted file mode 100644 index 2a5995f982..0000000000 --- a/src/extras/keymap/keymaps/asus +++ /dev/null @@ -1,3 +0,0 @@ -0xED volumeup -0xEE volumedown -0xEF mute diff --git a/src/extras/keymap/keymaps/compaq-e_evo b/src/extras/keymap/keymaps/compaq-e_evo deleted file mode 100644 index 5fbc573aa4..0000000000 --- a/src/extras/keymap/keymaps/compaq-e_evo +++ /dev/null @@ -1,4 +0,0 @@ -0xA3 www # I key -0x9A search -0x9E email -0x9F homepage diff --git a/src/extras/keymap/keymaps/dell b/src/extras/keymap/keymaps/dell deleted file mode 100644 index 4f907b3eef..0000000000 --- a/src/extras/keymap/keymaps/dell +++ /dev/null @@ -1,29 +0,0 @@ -0x81 playpause # Play/Pause -0x82 stopcd # Stop -0x83 previoussong # Previous song -0x84 nextsong # Next song -0x85 brightnessdown # Fn+Down arrow Brightness Down -0x86 brightnessup # Fn+Up arrow Brightness Up -0x87 battery # Fn+F3 battery icon -0x88 unknown # Fn+F2 Turn On/Off Wireless - handled in hardware -0x89 ejectclosecd # Fn+F10 Eject CD -0x8A suspend # Fn+F1 hibernate -0x8B switchvideomode # Fn+F8 CRT/LCD (high keycode: "displaytoggle") -0x8C f23 # Fn+Right arrow Auto Brightness -0x8F switchvideomode # Fn+F7 aspect ratio -0x90 previoussong # Front panel previous song -0x91 prog1 # Wifi Catcher (DELL Specific) -0x92 media # MediaDirect button (house icon) -0x93 f23 # FIXME Fn+Left arrow Auto Brightness -0x95 camera # Shutter button Takes a picture if optional camera available -0x97 email # Tablet email button -0x98 f21 # FIXME: Tablet screen rotatation -0x99 nextsong # Front panel next song -0x9A setup # Tablet tools button -0x9B switchvideomode # Display Toggle button -0x9E f21 #touchpad toggle -0xA2 playpause # Front panel play/pause -0xA4 stopcd # Front panel stop -0xED media # MediaDirect button -0xD8 screenlock # FIXME: Tablet lock button -0xD9 f21 # touchpad toggle diff --git a/src/extras/keymap/keymaps/dell-latitude-xt2 b/src/extras/keymap/keymaps/dell-latitude-xt2 deleted file mode 100644 index 39872f559d..0000000000 --- a/src/extras/keymap/keymaps/dell-latitude-xt2 +++ /dev/null @@ -1,4 +0,0 @@ -0x9B up # tablet rocker up -0x9E enter # tablet rocker press -0x9F back # tablet back -0xA3 down # tablet rocker down diff --git a/src/extras/keymap/keymaps/everex-xt5000 b/src/extras/keymap/keymaps/everex-xt5000 deleted file mode 100644 index 4823a832f5..0000000000 --- a/src/extras/keymap/keymaps/everex-xt5000 +++ /dev/null @@ -1,7 +0,0 @@ -0x5C media -0x65 f21 # Fn+F5 Touchpad toggle -0x67 prog3 # Fan Speed Control button -0x6F brightnessup -0x7F brightnessdown -0xB2 www -0xEC mail diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_li_2732 b/src/extras/keymap/keymaps/fujitsu-amilo_li_2732 deleted file mode 100644 index 9b8b36a170..0000000000 --- a/src/extras/keymap/keymaps/fujitsu-amilo_li_2732 +++ /dev/null @@ -1,3 +0,0 @@ -0xD9 brightnessdown # Fn+F8 brightness down -0xEF brightnessup # Fn+F9 brightness up -0xA9 switchvideomode # Fn+F10 Cycle between available video outputs diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 b/src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 deleted file mode 100644 index f7b0c52444..0000000000 --- a/src/extras/keymap/keymaps/fujitsu-amilo_pa_2548 +++ /dev/null @@ -1,3 +0,0 @@ -0xE0 volumedown -0xE1 volumeup -0xE5 prog1 diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 b/src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 deleted file mode 100644 index d2e38cbb23..0000000000 --- a/src/extras/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 +++ /dev/null @@ -1,4 +0,0 @@ -0xA5 help # Fn-F1 -0xA9 switchvideomode # Fn-F3 -0xD9 brightnessdown # Fn-F8 -0xE0 brightnessup # Fn-F9 diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 b/src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 deleted file mode 100644 index 43e3199d59..0000000000 --- a/src/extras/keymap/keymaps/fujitsu-amilo_pro_v3205 +++ /dev/null @@ -1,2 +0,0 @@ -0xF4 f21 # FIXME: silent-mode decrease CPU/GPU clock -0xF7 switchvideomode # Fn+F3 diff --git a/src/extras/keymap/keymaps/fujitsu-amilo_si_1520 b/src/extras/keymap/keymaps/fujitsu-amilo_si_1520 deleted file mode 100644 index 1419bd9b5e..0000000000 --- a/src/extras/keymap/keymaps/fujitsu-amilo_si_1520 +++ /dev/null @@ -1,6 +0,0 @@ -0xE1 wlan -0xF3 wlan -0xEE brightnessdown -0xE0 brightnessup -0xE2 bluetooth -0xF7 video diff --git a/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 b/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 deleted file mode 100644 index d3d056b366..0000000000 --- a/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v5 +++ /dev/null @@ -1,4 +0,0 @@ -0xA9 switchvideomode -0xD9 brightnessdown -0xDF sleep -0xEF brightnessup diff --git a/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 b/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 deleted file mode 100644 index 52c70c50cb..0000000000 --- a/src/extras/keymap/keymaps/fujitsu-esprimo_mobile_v6 +++ /dev/null @@ -1,2 +0,0 @@ -0xCE brightnessup -0xEF brightnessdown diff --git a/src/extras/keymap/keymaps/genius-slimstar-320 b/src/extras/keymap/keymaps/genius-slimstar-320 deleted file mode 100644 index d0a3656dd8..0000000000 --- a/src/extras/keymap/keymaps/genius-slimstar-320 +++ /dev/null @@ -1,35 +0,0 @@ -# Genius SlimStar 320 -# -# Only buttons which are not properly mapped yet are configured below - -# "Scroll wheel", a circular up/down/left/right button. Aimed for scolling, -# but since there are no scrollleft/scrollright, let's map to back/forward. -0x900f0 scrollup -0x900f1 scrolldown -0x900f3 back -0x900f2 forward - -# Multimedia buttons, left side (from left to right) -# [W] -0x900f5 wordprocessor -# [Ex] -0x900f6 spreadsheet -# [P] -0x900f4 presentation -# Other five (calculator, playpause, stop, mute and eject) are OK - -# Right side, from left to right -# [e] -0xc0223 www -# "man" -0x900f7 chat -# "Y" -0x900fb prog1 -# [X] -0x900f8 close -# "picture" -0x900f9 graphicseditor -# "two windows" -0x900fd scale -# "lock" -0x900fc screenlock diff --git a/src/extras/keymap/keymaps/hewlett-packard b/src/extras/keymap/keymaps/hewlett-packard deleted file mode 100644 index 4461fa2ce5..0000000000 --- a/src/extras/keymap/keymaps/hewlett-packard +++ /dev/null @@ -1,12 +0,0 @@ -0x81 fn_esc -0x89 battery # FnF8 -0x8A screenlock # FnF6 -0x8B camera -0x8C media # music -0x8E dvd -0xB1 help -0xB3 f23 # FIXME: Auto brightness -0xD7 wlan -0x92 brightnessdown # FnF7 (FnF9 on 6730b) -0x97 brightnessup # FnF8 (FnF10 on 6730b) -0xEE switchvideomode # FnF4 diff --git a/src/extras/keymap/keymaps/hewlett-packard-2510p_2530p b/src/extras/keymap/keymaps/hewlett-packard-2510p_2530p deleted file mode 100644 index 41ad2e9b5a..0000000000 --- a/src/extras/keymap/keymaps/hewlett-packard-2510p_2530p +++ /dev/null @@ -1,2 +0,0 @@ -0xD8 f23 # touchpad off -0xD9 f22 # touchpad on diff --git a/src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook b/src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook deleted file mode 100644 index 42007c5483..0000000000 --- a/src/extras/keymap/keymaps/hewlett-packard-compaq_elitebook +++ /dev/null @@ -1,2 +0,0 @@ -0x88 presentation -0xD9 help # I key (high keycode: "info") diff --git a/src/extras/keymap/keymaps/hewlett-packard-pavilion b/src/extras/keymap/keymaps/hewlett-packard-pavilion deleted file mode 100644 index 3d3cefc8e6..0000000000 --- a/src/extras/keymap/keymaps/hewlett-packard-pavilion +++ /dev/null @@ -1,3 +0,0 @@ -0x88 media # FIXME: quick play -0xD8 f23 # touchpad off -0xD9 f22 # touchpad on diff --git a/src/extras/keymap/keymaps/hewlett-packard-presario-2100 b/src/extras/keymap/keymaps/hewlett-packard-presario-2100 deleted file mode 100644 index 1df39dcbd2..0000000000 --- a/src/extras/keymap/keymaps/hewlett-packard-presario-2100 +++ /dev/null @@ -1,3 +0,0 @@ -0xF0 help -0xF1 screenlock -0xF3 search diff --git a/src/extras/keymap/keymaps/hewlett-packard-tablet b/src/extras/keymap/keymaps/hewlett-packard-tablet deleted file mode 100644 index d19005ab90..0000000000 --- a/src/extras/keymap/keymaps/hewlett-packard-tablet +++ /dev/null @@ -1,6 +0,0 @@ -0x82 prog2 # Funny Key -0x83 prog1 # Q -0x84 tab -0x85 esc -0x86 pageup -0x87 pagedown diff --git a/src/extras/keymap/keymaps/hewlett-packard-tx2 b/src/extras/keymap/keymaps/hewlett-packard-tx2 deleted file mode 100644 index 36a690fcf6..0000000000 --- a/src/extras/keymap/keymaps/hewlett-packard-tx2 +++ /dev/null @@ -1,3 +0,0 @@ -0xC2 media -0xD8 f23 # Toggle touchpad button on tx2 (OFF) -0xD9 f22 # Toggle touchpad button on tx2 (ON) diff --git a/src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint b/src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint deleted file mode 100644 index 027e50bf88..0000000000 --- a/src/extras/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint +++ /dev/null @@ -1,7 +0,0 @@ -0x900f0 screenlock -0x900f1 wlan -0x900f2 switchvideomode -0x900f3 suspend -0x900f4 brightnessup -0x900f5 brightnessdown -0x900f8 zoom diff --git a/src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 b/src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 deleted file mode 100644 index 4a8b4ba5a7..0000000000 --- a/src/extras/keymap/keymaps/inventec-symphony_6.0_7.0 +++ /dev/null @@ -1,2 +0,0 @@ -0xF3 prog2 -0xF4 prog1 diff --git a/src/extras/keymap/keymaps/lenovo-3000 b/src/extras/keymap/keymaps/lenovo-3000 deleted file mode 100644 index 5bd165654a..0000000000 --- a/src/extras/keymap/keymaps/lenovo-3000 +++ /dev/null @@ -1,5 +0,0 @@ -0x8B switchvideomode # Fn+F7 video -0x96 wlan # Fn+F5 wireless -0x97 sleep # Fn+F4 suspend -0x98 suspend # Fn+F12 hibernate -0xB4 prog1 # Lenovo Care diff --git a/src/extras/keymap/keymaps/lenovo-ideapad b/src/extras/keymap/keymaps/lenovo-ideapad deleted file mode 100644 index fc339839f2..0000000000 --- a/src/extras/keymap/keymaps/lenovo-ideapad +++ /dev/null @@ -1,8 +0,0 @@ -# Key codes observed on S10-3, assumed valid on other IdeaPad models -0x81 rfkill # does nothing in BIOS -0x83 display_off # BIOS toggles screen state -0xB9 brightnessup # does nothing in BIOS -0xBA brightnessdown # does nothing in BIOS -0xF1 camera # BIOS toggles camera power -0xf2 f21 # touchpad toggle (key alternately emits f2 and f3) -0xf3 f21 diff --git a/src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint b/src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint deleted file mode 100644 index 47e8846a68..0000000000 --- a/src/extras/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint +++ /dev/null @@ -1,13 +0,0 @@ -0x90012 screenlock # Fn+F2 -0x90013 battery # Fn+F3 -0x90014 wlan # Fn+F5 -0x90016 switchvideomode # Fn+F7 -0x90017 f21 # Fn+F8 touchpadtoggle -0x90019 suspend # Fn+F12 -0x9001A brightnessup # Fn+Home -0x9001B brightnessdown # Fn+End -0x9001D zoom # Fn+Space -0x90011 prog1 # Thinkvantage button - -0x90015 camera # Fn+F6 headset/camera VoIP key ?? -0x90010 micmute # Microphone mute button diff --git a/src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet b/src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet deleted file mode 100644 index 31ea3b2c70..0000000000 --- a/src/extras/keymap/keymaps/lenovo-thinkpad_x200_tablet +++ /dev/null @@ -1,6 +0,0 @@ -0x5D menu -0x63 fn -0x66 screenlock -0x67 cyclewindows # bezel circular arrow -0x68 setup # bezel setup / menu -0x6c direction # rotate screen diff --git a/src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet b/src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet deleted file mode 100644 index 6fd16b5662..0000000000 --- a/src/extras/keymap/keymaps/lenovo-thinkpad_x6_tablet +++ /dev/null @@ -1,8 +0,0 @@ -0x6C f21 # rotate -0x68 screenlock # screenlock -0x6B esc # escape -0x6D right # right on d-pad -0x6E left # left on d-pad -0x71 up # up on d-pad -0x6F down # down on d-pad -0x69 enter # enter on d-pad diff --git a/src/extras/keymap/keymaps/lg-x110 b/src/extras/keymap/keymaps/lg-x110 deleted file mode 100644 index ba08cba3fe..0000000000 --- a/src/extras/keymap/keymaps/lg-x110 +++ /dev/null @@ -1,12 +0,0 @@ -0xA0 mute # Fn-F9 -0xAE volumedown # Fn-Left -0xAF search # Fn-F3 -0xB0 volumeup # Fn-Right -0xB1 battery # Fn-F10 Info -0xB3 suspend # Fn-F12 -0xDF sleep # Fn-F4 -# 0xE2 bluetooth # satellite dish2 -0xE4 f21 # Fn-F5 Touchpad disable -0xF6 wlan # Fn-F6 -0xF7 reserved # brightnessdown # Fn-Down -0xF8 reserved # brightnessup # Fn-Up diff --git a/src/extras/keymap/keymaps/logitech-wave b/src/extras/keymap/keymaps/logitech-wave deleted file mode 100644 index caa5d5d310..0000000000 --- a/src/extras/keymap/keymaps/logitech-wave +++ /dev/null @@ -1,16 +0,0 @@ -0x9001C scale #expo -0x9001F zoomout #zoom out -0x90020 zoomin #zoom in -0x9003D prog1 #gadget -0x90005 camera #camera -0x90018 media #media center -0x90041 wordprocessor #fn+f1 (word) -0x90042 spreadsheet #fn+f2 (excel) -0x90043 calendar #fn+f3 (calendar) -0x90044 prog2 #fn+f4 (program a) -0x90045 prog3 #fn+f5 (program b) -0x90046 prog4 #fn+f6 (program c) -0x90048 messenger #fn+f8 (msn messenger) -0x9002D find #fn+f10 (search www) -0x9004B search #fn+f11 (search pc) -0x9004C ejectclosecd #fn+f12 (eject) diff --git a/src/extras/keymap/keymaps/logitech-wave-cordless b/src/extras/keymap/keymaps/logitech-wave-cordless deleted file mode 100644 index a10dad5e4d..0000000000 --- a/src/extras/keymap/keymaps/logitech-wave-cordless +++ /dev/null @@ -1,15 +0,0 @@ -0xD4 zoomin -0xCC zoomout -0xC0183 media -0xC1005 camera -0xC101F zoomout -0xC1020 zoomin -0xC1041 wordprocessor -0xC1042 spreadsheet -0xC1043 calendar -0xC1044 prog2 #fn+f4 (program a) -0xC1045 prog3 #fn+f5 (program b) -0xC1046 prog4 #fn+f6 (program c) -0xC1048 messenger -0xC104A find #fn+f10 (search www) -0xC104C ejectclosecd diff --git a/src/extras/keymap/keymaps/logitech-wave-pro-cordless b/src/extras/keymap/keymaps/logitech-wave-pro-cordless deleted file mode 100644 index e7aa02206c..0000000000 --- a/src/extras/keymap/keymaps/logitech-wave-pro-cordless +++ /dev/null @@ -1,12 +0,0 @@ -0xC01B6 camera -0xC0183 media -0xC0184 wordprocessor -0xC0186 spreadsheet -0xC018E calendar -0xC0223 homepage -0xC01BC messenger -0xC018A mail -0xC0221 search -0xC00B8 ejectcd -0xC022D zoomin -0xC022E zoomout diff --git a/src/extras/keymap/keymaps/maxdata-pro_7000 b/src/extras/keymap/keymaps/maxdata-pro_7000 deleted file mode 100644 index c0e4f77af4..0000000000 --- a/src/extras/keymap/keymaps/maxdata-pro_7000 +++ /dev/null @@ -1,9 +0,0 @@ -0x97 prog2 -0x9F prog1 -0xA0 mute # Fn-F5 -0x82 www -0xEC email -0xAE volumedown # Fn-Down -0xB0 volumeup # Fn-Up -0xDF suspend # Fn+F2 -0xF5 help diff --git a/src/extras/keymap/keymaps/medion-fid2060 b/src/extras/keymap/keymaps/medion-fid2060 deleted file mode 100644 index 5a76c76799..0000000000 --- a/src/extras/keymap/keymaps/medion-fid2060 +++ /dev/null @@ -1,2 +0,0 @@ -0x6B channeldown # Thottle Down -0x6D channelup # Thottle Up diff --git a/src/extras/keymap/keymaps/medionnb-a555 b/src/extras/keymap/keymaps/medionnb-a555 deleted file mode 100644 index c3b5dfa60b..0000000000 --- a/src/extras/keymap/keymaps/medionnb-a555 +++ /dev/null @@ -1,4 +0,0 @@ -0x63 www # N button -0x66 prog1 # link 1 button -0x67 email # envelope button -0x69 prog2 # link 2 button diff --git a/src/extras/keymap/keymaps/micro-star b/src/extras/keymap/keymaps/micro-star deleted file mode 100644 index 4a438698ed..0000000000 --- a/src/extras/keymap/keymaps/micro-star +++ /dev/null @@ -1,13 +0,0 @@ -0xA0 mute # Fn-F9 -0xAE volumedown # Fn-F7 -0xB0 volumeup # Fn-F8 -0xB2 www # e button -0xDF sleep # Fn-F12 -0xE2 bluetooth # satellite dish2 -0xE4 f21 # Fn-F3 Touchpad disable -0xEC email # envelope button -0xEE camera # Fn-F6 camera disable -0xF6 wlan # satellite dish1 -0xF7 brightnessdown # Fn-F4 -0xF8 brightnessup # Fn-F5 -0xF9 search diff --git a/src/extras/keymap/keymaps/module-asus-w3j b/src/extras/keymap/keymaps/module-asus-w3j deleted file mode 100644 index 773e0b3e82..0000000000 --- a/src/extras/keymap/keymaps/module-asus-w3j +++ /dev/null @@ -1,11 +0,0 @@ -0x41 nextsong -0x45 playpause -0x43 stopcd -0x40 previoussong -0x4C ejectclosecd -0x32 mute -0x31 volumedown -0x30 volumeup -0x5D wlan -0x7E bluetooth -0x8A media # high keycode: "tv" diff --git a/src/extras/keymap/keymaps/module-ibm b/src/extras/keymap/keymaps/module-ibm deleted file mode 100644 index a92dfa2506..0000000000 --- a/src/extras/keymap/keymaps/module-ibm +++ /dev/null @@ -1,16 +0,0 @@ -0x01 battery # Fn+F2 -0x02 screenlock # Fn+F3 -0x03 sleep # Fn+F4 -0x04 wlan # Fn+F5 -0x06 switchvideomode # Fn+F7 -0x07 zoom # Fn+F8 screen expand -0x08 f24 # Fn+F9 undock -0x0B suspend # Fn+F12 -0x0F brightnessup # Fn+Home -0x10 brightnessdown # Fn+End -0x11 kbdillumtoggle # Fn+PgUp - ThinkLight -0x13 zoom # Fn+Space -0x14 volumeup -0x15 volumedown -0x16 mute -0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") diff --git a/src/extras/keymap/keymaps/module-lenovo b/src/extras/keymap/keymaps/module-lenovo deleted file mode 100644 index 8e38883091..0000000000 --- a/src/extras/keymap/keymaps/module-lenovo +++ /dev/null @@ -1,17 +0,0 @@ -0x1 screenlock # Fn+F2 -0x2 battery # Fn+F3 -0x3 sleep # Fn+F4 -0x4 wlan # Fn+F5 -0x6 switchvideomode # Fn+F7 -0x7 f21 # Fn+F8 touchpadtoggle -0x8 f24 # Fn+F9 undock -0xB suspend # Fn+F12 -0xF brightnessup # Fn+Home -0x10 brightnessdown # Fn+End -0x11 kbdillumtoggle # Fn+PgUp - ThinkLight -0x13 zoom # Fn+Space -0x14 volumeup -0x15 volumedown -0x16 mute -0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") -0x1A micmute # Microphone mute diff --git a/src/extras/keymap/keymaps/module-sony b/src/extras/keymap/keymaps/module-sony deleted file mode 100644 index 7c000131d1..0000000000 --- a/src/extras/keymap/keymaps/module-sony +++ /dev/null @@ -1,8 +0,0 @@ -0x06 mute # Fn+F2 -0x07 volumedown # Fn+F3 -0x08 volumeup # Fn+F4 -0x09 brightnessdown # Fn+F5 -0x0A brightnessup # Fn+F6 -0x0B switchvideomode # Fn+F7 -0x0E zoom # Fn+F10 -0x10 suspend # Fn+F12 diff --git a/src/extras/keymap/keymaps/module-sony-old b/src/extras/keymap/keymaps/module-sony-old deleted file mode 100644 index 596a34258a..0000000000 --- a/src/extras/keymap/keymaps/module-sony-old +++ /dev/null @@ -1,2 +0,0 @@ -0x06 battery -0x07 mute diff --git a/src/extras/keymap/keymaps/module-sony-vgn b/src/extras/keymap/keymaps/module-sony-vgn deleted file mode 100644 index c8ba001516..0000000000 --- a/src/extras/keymap/keymaps/module-sony-vgn +++ /dev/null @@ -1,8 +0,0 @@ -0x00 brightnessdown # Fn+F5 -0x10 brightnessup # Fn+F6 -0x11 switchvideomode # Fn+F7 -0x12 zoomout -0x14 zoomin -0x15 suspend # Fn+F12 -0x17 prog1 -0x20 media diff --git a/src/extras/keymap/keymaps/olpc-xo b/src/extras/keymap/keymaps/olpc-xo deleted file mode 100644 index 34434a121d..0000000000 --- a/src/extras/keymap/keymaps/olpc-xo +++ /dev/null @@ -1,74 +0,0 @@ -0x59 fn -0x81 fn_esc -0xF9 camera -0xF8 sound # Fn-CAMERA = Mic - - -# Function key mappings, as per -# http://dev.laptop.org/ticket/10213#comment:20 -# -# Unmodified F1-F8 produce F1-F8, so no remap necessary. -# Unmodified F9-F12 control brightness and volume. -0x43 brightnessdown -0x44 brightnessup -0x57 volumedown -0x58 volumeup - -# fn-modified fkeys all produce the unmodified version of the key. -0xBB f1 -0xBC f2 -0xBD f3 -0xBE f4 -0xBF f5 -0xC0 f6 -0xC1 f7 -0xC2 f8 -0xC3 f9 -0xC4 f10 -0xD7 f11 -0xD8 f12 - - -# Using F13-F21 for the .5 F keys right now. -0xF7 f13 -0xF6 f14 -0xF5 f15 -0xF4 f16 -0xF3 f17 -0xF2 f18 -0xF1 f19 -0xF0 f20 -0xEF f21 - -0xEE chat -0xE4 chat # Just mapping Fn-Chat to Chat for now -0xDD menu # Frame -0xDA prog1 # Fn-Frame - -# The FN of some keys is other keys -0xD3 delete -0xD2 insert -0xC9 pageup -0xD1 pagedown -0xC7 home -0xCF end - -# Language key - don't ask what they are doing as KEY_HP -0x73 hp -0x7E hp - -0xDB leftmeta # left grab -0xDC rightmeta # right grab -0x85 rightmeta # Right grab releases on a different scancode -0xD6 kbdillumtoggle # Fn-space -0x69 switchvideomode # Brightness key - -# Game keys -0x65 kp8 # up -0x66 kp2 # down -0x67 kp4 # left -0x68 kp6 # right -0xE5 kp9 # pgup -0xE6 kp3 # pgdn -0xE7 kp7 # home -0xE8 kp1 # end diff --git a/src/extras/keymap/keymaps/onkyo b/src/extras/keymap/keymaps/onkyo deleted file mode 100644 index ee864ade4d..0000000000 --- a/src/extras/keymap/keymaps/onkyo +++ /dev/null @@ -1,14 +0,0 @@ -0xA0 mute # Fn+D -0xAE volumedown # Fn+F -0xB0 volumeup # Fn+G -0xDF sleep # Fn+W -0xE0 bluetooth # Fn+H -0xE2 cyclewindows # Fn+Esc -0xEE battery # Fn+Q -0xF0 media # Fn+R -0xF5 switchvideomode # Fn+E -0xF6 camera # Fn+T -0xF7 f21 # Fn+Y (touchpad toggle) -0xF8 brightnessup # Fn+S -0xF9 brightnessdown # Fn+A -0xFB wlan # Fn+J diff --git a/src/extras/keymap/keymaps/oqo-model2 b/src/extras/keymap/keymaps/oqo-model2 deleted file mode 100644 index b7f4851abe..0000000000 --- a/src/extras/keymap/keymaps/oqo-model2 +++ /dev/null @@ -1,5 +0,0 @@ -0x8E wlan -0xF0 switchvideomode -0xF1 mute -0xF2 volumedown -0xF3 volumeup diff --git a/src/extras/keymap/keymaps/samsung-other b/src/extras/keymap/keymaps/samsung-other deleted file mode 100644 index 3ac0c2f10c..0000000000 --- a/src/extras/keymap/keymaps/samsung-other +++ /dev/null @@ -1,14 +0,0 @@ -0x74 prog1 # User key -0x75 www -0x78 mail -0x82 switchvideomode # Fn+F4 CRT/LCD (high keycode: "displaytoggle") -0x83 battery # Fn+F2 -0x84 prog1 # Fn+F5 backlight on/off -0x86 wlan # Fn+F9 -0x88 brightnessup # Fn-Up -0x89 brightnessdown # Fn-Down -0xB1 prog2 # Fn+F7 run Samsung Magic Doctor (keypressed event is generated twice) -0xB3 prog3 # Fn+F8 switch power mode (battery/dynamic/performance) -0xB4 wlan # Fn+F9 (X60P) -0xF7 f22 # Fn+F10 Touchpad on -0xF9 f23 # Fn+F10 Touchpad off diff --git a/src/extras/keymap/keymaps/samsung-sq1us b/src/extras/keymap/keymaps/samsung-sq1us deleted file mode 100644 index ea2141ef84..0000000000 --- a/src/extras/keymap/keymaps/samsung-sq1us +++ /dev/null @@ -1,7 +0,0 @@ -0xD4 menu -0xD8 f1 -0xD9 f10 -0xD6 f3 -0xD7 f9 -0xE4 f5 -0xEE f11 diff --git a/src/extras/keymap/keymaps/samsung-sx20s b/src/extras/keymap/keymaps/samsung-sx20s deleted file mode 100644 index 9d954ee415..0000000000 --- a/src/extras/keymap/keymaps/samsung-sx20s +++ /dev/null @@ -1,4 +0,0 @@ -0x74 mute -0x75 mute -0x77 f22 # Touchpad on -0x79 f23 # Touchpad off diff --git a/src/extras/keymap/keymaps/toshiba-satellite_a100 b/src/extras/keymap/keymaps/toshiba-satellite_a100 deleted file mode 100644 index 22007be71b..0000000000 --- a/src/extras/keymap/keymaps/toshiba-satellite_a100 +++ /dev/null @@ -1,2 +0,0 @@ -0xA4 stopcd -0xB2 www diff --git a/src/extras/keymap/keymaps/toshiba-satellite_a110 b/src/extras/keymap/keymaps/toshiba-satellite_a110 deleted file mode 100644 index 1429409351..0000000000 --- a/src/extras/keymap/keymaps/toshiba-satellite_a110 +++ /dev/null @@ -1,10 +0,0 @@ -0x92 stop -0x93 www -0x94 media -0x9E f22 # Touchpad on -0x9F f23 # Touchpad off -0xB9 nextsong -0xD9 brightnessup -0xEE screenlock -0xF4 previoussong -0xF7 playpause diff --git a/src/extras/keymap/keymaps/toshiba-satellite_m30x b/src/extras/keymap/keymaps/toshiba-satellite_m30x deleted file mode 100644 index ae8e34941b..0000000000 --- a/src/extras/keymap/keymaps/toshiba-satellite_m30x +++ /dev/null @@ -1,6 +0,0 @@ -0xef brightnessdown -0xd9 brightnessup -0xee screenlock -0x93 media -0x9e f22 #touchpad_enable -0x9f f23 #touchpad_disable diff --git a/src/extras/keymap/keymaps/zepto-znote b/src/extras/keymap/keymaps/zepto-znote deleted file mode 100644 index cf72fda47b..0000000000 --- a/src/extras/keymap/keymaps/zepto-znote +++ /dev/null @@ -1,11 +0,0 @@ -0x93 switchvideomode # Fn+F3 Toggle Video Output -0x95 brightnessdown # Fn+F4 Brightness Down -0x91 brightnessup # Fn+F5 Brightness Up -0xA5 f23 # Fn+F6 Disable Touchpad -0xA6 f22 # Fn+F6 Enable Touchpad -0xA7 bluetooth # Fn+F10 Enable Bluetooth -0XA9 bluetooth # Fn+F10 Disable Bluetooth -0xF1 wlan # RF Switch Off -0xF2 wlan # RF Switch On -0xF4 prog1 # P1 Button -0xF3 prog2 # P2 Button diff --git a/src/extras/mtd_probe/.gitignore b/src/extras/mtd_probe/.gitignore deleted file mode 100644 index 82b8ab501f..0000000000 --- a/src/extras/mtd_probe/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mtd_probe diff --git a/src/extras/mtd_probe/75-probe_mtd.rules b/src/extras/mtd_probe/75-probe_mtd.rules deleted file mode 100644 index c0e0839785..0000000000 --- a/src/extras/mtd_probe/75-probe_mtd.rules +++ /dev/null @@ -1,8 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION!="add", GOTO="mtd_probe_end" - -KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $devnode" -KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl" - -LABEL="mtd_probe_end" diff --git a/src/extras/mtd_probe/mtd_probe.c b/src/extras/mtd_probe/mtd_probe.c deleted file mode 100644 index 1aa08d3851..0000000000 --- a/src/extras/mtd_probe/mtd_probe.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2010 - Maxim Levitsky - * - * mtd_probe 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; either version 2 of the License, or - * (at your option) any later version. - * - * mtd_probe 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 mtd_probe; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ -#include "mtd_probe.h" -#include -#include -#include -#include -#include -#include -#include -#include - -int main(int argc, char** argv) -{ - if (argc != 2) { - printf("usage: mtd_probe /dev/mtd[n]\n"); - return 1; - } - - int mtd_fd = open(argv[1], O_RDONLY); - if (mtd_fd == -1) { - perror("open"); - exit(-1); - } - - mtd_info_t mtd_info; - int error = ioctl(mtd_fd, MEMGETINFO, &mtd_info); - if (error == -1) { - perror("ioctl"); - exit(-1); - } - - probe_smart_media(mtd_fd, &mtd_info); - return -1; -} diff --git a/src/extras/mtd_probe/mtd_probe.h b/src/extras/mtd_probe/mtd_probe.h deleted file mode 100644 index 2a37ede578..0000000000 --- a/src/extras/mtd_probe/mtd_probe.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2010 - Maxim Levitsky - * - * mtd_probe 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; either version 2 of the License, or - * (at your option) any later version. - * - * mtd_probe 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 mtd_probe; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -#include - -/* Full oob structure as written on the flash */ -struct sm_oob { - uint32_t reserved; - uint8_t data_status; - uint8_t block_status; - uint8_t lba_copy1[2]; - uint8_t ecc2[3]; - uint8_t lba_copy2[2]; - uint8_t ecc1[3]; -} __attribute__((packed)); - - -/* one sector is always 512 bytes, but it can consist of two nand pages */ -#define SM_SECTOR_SIZE 512 - -/* oob area is also 16 bytes, but might be from two pages */ -#define SM_OOB_SIZE 16 - -/* This is maximum zone size, and all devices that have more that one zone - have this size */ -#define SM_MAX_ZONE_SIZE 1024 - -/* support for small page nand */ -#define SM_SMALL_PAGE 256 -#define SM_SMALL_OOB_SIZE 8 - - -void probe_smart_media(int mtd_fd, mtd_info_t *info); diff --git a/src/extras/mtd_probe/probe_smartmedia.c b/src/extras/mtd_probe/probe_smartmedia.c deleted file mode 100644 index b3cdefc633..0000000000 --- a/src/extras/mtd_probe/probe_smartmedia.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2010 - Maxim Levitsky - * - * mtd_probe 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; either version 2 of the License, or - * (at your option) any later version. - * - * mtd_probe 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 mtd_probe; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, - * Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "mtd_probe.h" - -static const uint8_t cis_signature[] = { - 0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20 -}; - - -void probe_smart_media(int mtd_fd, mtd_info_t* info) -{ - char* cis_buffer = malloc(SM_SECTOR_SIZE); - - if (!cis_buffer) - return; - - if (info->type != MTD_NANDFLASH) - goto exit; - - int sector_size = info->writesize; - int block_size = info->erasesize; - int size_in_megs = info->size / (1024 * 1024); - int spare_count; - - - if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE) - goto exit; - - switch(size_in_megs) { - case 1: - case 2: - spare_count = 6; - break; - case 4: - spare_count = 12; - break; - default: - spare_count = 24; - break; - } - - - int offset; - int cis_found = 0; - - for (offset = 0 ; offset < block_size * spare_count ; - offset += sector_size) { - - lseek(mtd_fd, SEEK_SET, offset); - if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){ - cis_found = 1; - break; - } - } - - if (!cis_found) - goto exit; - - if (memcmp(cis_buffer, cis_signature, sizeof(cis_signature)) != 0 && - (memcmp(cis_buffer + SM_SMALL_PAGE, cis_signature, - sizeof(cis_signature)) != 0)) - goto exit; - - printf("MTD_FTL=smartmedia\n"); - free(cis_buffer); - exit(0); -exit: - free(cis_buffer); - return; -} diff --git a/src/extras/qemu/42-qemu-usb.rules b/src/extras/qemu/42-qemu-usb.rules deleted file mode 100644 index a4e3864714..0000000000 --- a/src/extras/qemu/42-qemu-usb.rules +++ /dev/null @@ -1,13 +0,0 @@ -# -# Enable autosuspend for qemu emulated usb hid devices. -# -# Note that there are buggy qemu versions which advertise remote -# wakeup support but don't actually implement it correctly. This -# is the reason why we need a match for the serial number here. -# The serial number "42" is used to tag the implementations where -# remote wakeup is working. -# - -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" diff --git a/src/extras/rule_generator/75-cd-aliases-generator.rules b/src/extras/rule_generator/75-cd-aliases-generator.rules deleted file mode 100644 index e6da0101d6..0000000000 --- a/src/extras/rule_generator/75-cd-aliases-generator.rules +++ /dev/null @@ -1,9 +0,0 @@ -# these rules generate rules for the /dev/{cdrom,dvd,...} symlinks - -# the "path" of usb/ieee1394 devices changes frequently, use "id" -ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", \ - PROGRAM="write_cd_rules by-id", SYMLINK+="%c", GOTO="persistent_cd_end" - -ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules", SYMLINK+="%c" - -LABEL="persistent_cd_end" diff --git a/src/extras/rule_generator/75-persistent-net-generator.rules b/src/extras/rule_generator/75-persistent-net-generator.rules deleted file mode 100644 index 4f80573478..0000000000 --- a/src/extras/rule_generator/75-persistent-net-generator.rules +++ /dev/null @@ -1,102 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# these rules generate rules for persistent network device naming -# -# variables used to communicate: -# MATCHADDR MAC address used for the match -# MATCHID bus_id used for the match -# MATCHDRV driver name used for the match -# MATCHIFTYPE interface type match -# COMMENT comment to add to the generated rule -# INTERFACE_NAME requested name supplied by external tool -# INTERFACE_NEW new interface name returned by rule writer - -ACTION!="add", GOTO="persistent_net_generator_end" -SUBSYSTEM!="net", GOTO="persistent_net_generator_end" - -# ignore the interface if a name has already been set -NAME=="?*", GOTO="persistent_net_generator_end" - -# device name whitelist -KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" - -# ignore Xen virtual interfaces -SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" - -# read MAC address -ENV{MATCHADDR}="$attr{address}" - -# match interface type -ENV{MATCHIFTYPE}="$attr{type}" - -# ignore KVM virtual interfaces -ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" -# ignore VMWare virtual interfaces -ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" -# ignore Hyper-V virtual interfaces -ENV{MATCHADDR}=="00:15:5d:*", GOTO="persistent_net_generator_end" - -# These vendors are known to violate the local MAC address assignment scheme -# Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom -ENV{MATCHADDR}=="02:07:01:*", GOTO="globally_administered_whitelist" -# 3Com -ENV{MATCHADDR}=="02:60:60:*", GOTO="globally_administered_whitelist" -# 3Com IBM PC; Imagen; Valid; Cisco; Apple -ENV{MATCHADDR}=="02:60:8c:*", GOTO="globally_administered_whitelist" -# Intel -ENV{MATCHADDR}=="02:a0:c9:*", GOTO="globally_administered_whitelist" -# Olivetti -ENV{MATCHADDR}=="02:aa:3c:*", GOTO="globally_administered_whitelist" -# CMC Masscomp; Silicon Graphics; Prime EXL -ENV{MATCHADDR}=="02:cf:1f:*", GOTO="globally_administered_whitelist" -# Prominet Corporation Gigabit Ethernet Switch -ENV{MATCHADDR}=="02:e0:3b:*", GOTO="globally_administered_whitelist" -# BTI (Bus-Tech, Inc.) IBM Mainframes -ENV{MATCHADDR}=="02:e6:d3:*", GOTO="globally_administered_whitelist" -# Realtek -ENV{MATCHADDR}=="52:54:00:*", GOTO="globally_administered_whitelist" -# Novell 2000 -ENV{MATCHADDR}=="52:54:4c:*", GOTO="globally_administered_whitelist" -# Realtec -ENV{MATCHADDR}=="52:54:ab:*", GOTO="globally_administered_whitelist" -# Kingston Technologies -ENV{MATCHADDR}=="e2:0c:0f:*", GOTO="globally_administered_whitelist" -# Xensource -ENV{MATCHADDR}=="00:16:3e:*", GOTO="globally_administered_whitelist" - -# match interface dev_id -ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}" - -# do not use "locally administered" MAC address -ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" - -# do not use empty address -ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" - -LABEL="globally_administered_whitelist" - -# build comment line for generated rule: -SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)" -SUBSYSTEMS=="usb", ATTRS{idVendor}=="?*", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)" -SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)" -SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" - -# ibmveth likes to use "locally administered" MAC addresses -DRIVERS=="ibmveth", ENV{MATCHADDR}="$attr{address}", ENV{COMMENT}="ibmveth ($id)" - -# S/390 uses id matches only, do not use MAC address match -SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID}="$id", ENV{MATCHDRV}="$driver", ENV{MATCHADDR}="" - -# see if we got enough data to create a rule -ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", GOTO="persistent_net_generator_end" - -# default comment -ENV{COMMENT}=="", ENV{COMMENT}="net device ($attr{driver})" - -# write rule -DRIVERS=="?*", IMPORT{program}="write_net_rules" - -# rename interface if needed -ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" - -LABEL="persistent_net_generator_end" diff --git a/src/extras/rule_generator/rule_generator.functions b/src/extras/rule_generator/rule_generator.functions deleted file mode 100644 index 2eec1b6abf..0000000000 --- a/src/extras/rule_generator/rule_generator.functions +++ /dev/null @@ -1,113 +0,0 @@ -# functions used by the udev rule generator - -# Copyright (C) 2006 Marco d'Itri - -# 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, either version 2 of the License, or -# (at your option) any later version. - -# 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, see . - -PATH='/usr/bin:/bin:/usr/sbin:/sbin' - -# Read a single line from file $1 in the $DEVPATH directory. -# The function must not return an error even if the file does not exist. -sysread() { - local file="$1" - [ -e "/sys$DEVPATH/$file" ] || return 0 - local value - read value < "/sys$DEVPATH/$file" || return 0 - echo "$value" -} - -sysreadlink() { - local file="$1" - [ -e "/sys$DEVPATH/$file" ] || return 0 - readlink -f /sys$DEVPATH/$file 2> /dev/null || true -} - -# Return true if a directory is writeable. -writeable() { - if ln -s test-link $1/.is-writeable 2> /dev/null; then - rm -f $1/.is-writeable - return 0 - else - return 1 - fi -} - -# Create a lock file for the current rules file. -lock_rules_file() { - RUNDIR=$(udevadm info --run) - [ -e "$RUNDIR" ] || return 0 - - RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}" - - retry=30 - while ! mkdir $RULES_LOCK 2> /dev/null; do - if [ $retry -eq 0 ]; then - echo "Cannot lock $RULES_FILE!" >&2 - exit 2 - fi - sleep 1 - retry=$(($retry - 1)) - done -} - -unlock_rules_file() { - [ "$RULES_LOCK" ] || return 0 - rmdir $RULES_LOCK || true -} - -# Choose the real rules file if it is writeable or a temporary file if not. -# Both files should be checked later when looking for existing rules. -choose_rules_file() { - RUNDIR=$(udevadm info --run) - local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}" - [ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1 - - if writeable ${RULES_FILE%/*}; then - RO_RULES_FILE='/dev/null' - else - RO_RULES_FILE=$RULES_FILE - RULES_FILE=$tmp_rules_file - fi -} - -# Return the name of the first free device. -raw_find_next_available() { - local links="$1" - - local basename=${links%%[ 0-9]*} - local max=-1 - for name in $links; do - local num=${name#$basename} - [ "$num" ] || num=0 - [ $num -gt $max ] && max=$num - done - - local max=$(($max + 1)) - # "name0" actually is just "name" - [ $max -eq 0 ] && return - echo "$max" -} - -# Find all rules matching a key (with action) and a pattern. -find_all_rules() { - local key="$1" - local linkre="$2" - local match="$3" - - local search='.*[[:space:],]'"$key"'"('"$linkre"')".*' - echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \ - $RO_RULES_FILE \ - $([ -e $RULES_FILE ] && echo $RULES_FILE) \ - 2>/dev/null) -} diff --git a/src/extras/rule_generator/write_cd_rules b/src/extras/rule_generator/write_cd_rules deleted file mode 100644 index 645b9cd521..0000000000 --- a/src/extras/rule_generator/write_cd_rules +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/sh -e - -# This script is run if an optical drive lacks a rule for persistent naming. -# -# It adds symlinks for optical drives based on the device class determined -# by cdrom_id and used ID_PATH to identify the device. - -# (C) 2006 Marco d'Itri -# -# 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, either version 2 of the License, or -# (at your option) any later version. - -# 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, see . - -# debug, if UDEV_LOG= -if [ -n "$UDEV_LOG" ]; then - if [ "$UDEV_LOG" -ge 7 ]; then - set -x - fi -fi - -RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" - -. /lib/udev/rule_generator.functions - -find_next_available() { - raw_find_next_available "$(find_all_rules 'SYMLINK\+=' "$1")" -} - -write_rule() { - local match="$1" - local link="$2" - local comment="$3" - - { - if [ "$PRINT_HEADER" ]; then - PRINT_HEADER= - echo "# This file was automatically generated by the $0" - echo "# program, run by the cd-aliases-generator.rules rules file." - echo "#" - echo "# You can modify it, as long as you keep each rule on a single" - echo "# line, and set the \$GENERATED variable." - echo "" - fi - - [ "$comment" ] && echo "# $comment" - echo "$match, SYMLINK+=\"$link\", ENV{GENERATED}=\"1\"" - } >> $RULES_FILE - SYMLINKS="$SYMLINKS $link" -} - -if [ -z "$DEVPATH" ]; then - echo "Missing \$DEVPATH." >&2 - exit 1 -fi -if [ -z "$ID_CDROM" ]; then - echo "$DEVPATH is not a CD reader." >&2 - exit 1 -fi - -if [ "$1" ]; then - METHOD="$1" -else - METHOD='by-path' -fi - -case "$METHOD" in - by-path) - if [ -z "$ID_PATH" ]; then - echo "$DEVPATH not supported by path_id. by-id may work." >&2 - exit 1 - fi - RULE="ENV{ID_PATH}==\"$ID_PATH\"" - ;; - - by-id) - if [ "$ID_SERIAL" ]; then - RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\"" - elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then - RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\"" - else - echo "$DEVPATH not supported by ata_id. by-path may work." >&2 - exit 1 - fi - ;; - - *) - echo "Invalid argument (must be either by-path or by-id)." >&2 - exit 1 - ;; -esac - -# Prevent concurrent processes from modifying the file at the same time. -lock_rules_file - -# Check if the rules file is writeable. -choose_rules_file - -link_num=$(find_next_available 'cdrom[0-9]*') - -match="SUBSYSTEM==\"block\", ENV{ID_CDROM}==\"?*\", $RULE" - -comment="$ID_MODEL ($ID_PATH)" - - write_rule "$match" "cdrom$link_num" "$comment" -[ "$ID_CDROM_CD_R" -o "$ID_CDROM_CD_RW" ] && \ - write_rule "$match" "cdrw$link_num" -[ "$ID_CDROM_DVD" ] && \ - write_rule "$match" "dvd$link_num" -[ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ] && \ - write_rule "$match" "dvdrw$link_num" -echo >> $RULES_FILE - -unlock_rules_file - -echo $SYMLINKS - -exit 0 diff --git a/src/extras/rule_generator/write_net_rules b/src/extras/rule_generator/write_net_rules deleted file mode 100644 index bcea4b09dc..0000000000 --- a/src/extras/rule_generator/write_net_rules +++ /dev/null @@ -1,141 +0,0 @@ -#!/bin/sh -e - -# This script is run to create persistent network device naming rules -# based on properties of the device. -# If the interface needs to be renamed, INTERFACE_NEW= will be printed -# on stdout to allow udev to IMPORT it. - -# variables used to communicate: -# MATCHADDR MAC address used for the match -# MATCHID bus_id used for the match -# MATCHDEVID dev_id used for the match -# MATCHDRV driver name used for the match -# MATCHIFTYPE interface type match -# COMMENT comment to add to the generated rule -# INTERFACE_NAME requested name supplied by external tool -# INTERFACE_NEW new interface name returned by rule writer - -# Copyright (C) 2006 Marco d'Itri -# Copyright (C) 2007 Kay Sievers -# -# 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, either version 2 of the License, or -# (at your option) any later version. -# -# 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, see . - -# debug, if UDEV_LOG= -if [ -n "$UDEV_LOG" ]; then - if [ "$UDEV_LOG" -ge 7 ]; then - set -x - fi -fi - -RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' - -. /lib/udev/rule_generator.functions - -interface_name_taken() { - local value="$(find_all_rules 'NAME=' $INTERFACE)" - if [ "$value" ]; then - return 0 - else - return 1 - fi -} - -find_next_available() { - raw_find_next_available "$(find_all_rules 'NAME=' "$1")" -} - -write_rule() { - local match="$1" - local name="$2" - local comment="$3" - - { - if [ "$PRINT_HEADER" ]; then - PRINT_HEADER= - echo "# This file was automatically generated by the $0" - echo "# program, run by the persistent-net-generator.rules rules file." - echo "#" - echo "# You can modify it, as long as you keep each rule on a single" - echo "# line, and change only the value of the NAME= key." - fi - - echo "" - [ "$comment" ] && echo "# $comment" - echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\"" - } >> $RULES_FILE -} - -if [ -z "$INTERFACE" ]; then - echo "missing \$INTERFACE" >&2 - exit 1 -fi - -# Prevent concurrent processes from modifying the file at the same time. -lock_rules_file - -# Check if the rules file is writeable. -choose_rules_file - -# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces -if [ "$MATCHADDR" ]; then - match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\"" -fi - -if [ "$MATCHDRV" ]; then - match="$match, DRIVERS==\"$MATCHDRV\"" -fi - -if [ "$MATCHDEVID" ]; then - match="$match, ATTR{dev_id}==\"$MATCHDEVID\"" -fi - -if [ "$MATCHID" ]; then - match="$match, KERNELS==\"$MATCHID\"" -fi - -if [ "$MATCHIFTYPE" ]; then - match="$match, ATTR{type}==\"$MATCHIFTYPE\"" -fi - -if [ -z "$match" ]; then - echo "missing valid match" >&2 - unlock_rules_file - exit 1 -fi - -basename=${INTERFACE%%[0-9]*} -match="$match, KERNEL==\"$basename*\"" - -if [ "$INTERFACE_NAME" ]; then - # external tools may request a custom name - COMMENT="$COMMENT (custom name provided by external tool)" - if [ "$INTERFACE_NAME" != "$INTERFACE" ]; then - INTERFACE=$INTERFACE_NAME; - echo "INTERFACE_NEW=$INTERFACE" - fi -else - # if a rule using the current name already exists, find a new name - if interface_name_taken; then - INTERFACE="$basename$(find_next_available "$basename[0-9]*")" - # prevent INTERFACE from being "eth" instead of "eth0" - [ "$INTERFACE" = "${INTERFACE%%[ \[\]0-9]*}" ] && INTERFACE=${INTERFACE}0 - echo "INTERFACE_NEW=$INTERFACE" - fi -fi - -write_rule "$match" "$INTERFACE" "$COMMENT" - -unlock_rules_file - -exit 0 diff --git a/src/extras/scsi_id/.gitignore b/src/extras/scsi_id/.gitignore deleted file mode 100644 index 10e9ae743c..0000000000 --- a/src/extras/scsi_id/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -scsi_id -scsi_id.8 -scsi_id_version.h diff --git a/src/extras/scsi_id/README b/src/extras/scsi_id/README deleted file mode 100644 index 9cfe73991c..0000000000 --- a/src/extras/scsi_id/README +++ /dev/null @@ -1,4 +0,0 @@ -scsi_id - generate a SCSI unique identifier for a given SCSI device - -Please send questions, comments or patches to or -. diff --git a/src/extras/scsi_id/scsi.h b/src/extras/scsi_id/scsi.h deleted file mode 100644 index c423cac574..0000000000 --- a/src/extras/scsi_id/scsi.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * scsi.h - * - * General scsi and linux scsi specific defines and structs. - * - * Copyright (C) IBM Corp. 2003 - * - * 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. - */ - -#include - -struct scsi_ioctl_command { - unsigned int inlen; /* excluding scsi command length */ - unsigned int outlen; - unsigned char data[1]; - /* on input, scsi command starts here then opt. data */ -}; - -/* - * Default 5 second timeout - */ -#define DEF_TIMEOUT 5000 - -#define SENSE_BUFF_LEN 32 - -/* - * The request buffer size passed to the SCSI INQUIRY commands, use 254, - * as this is a nice value for some devices, especially some of the usb - * mass storage devices. - */ -#define SCSI_INQ_BUFF_LEN 254 - -/* - * SCSI INQUIRY vendor and model (really product) lengths. - */ -#define VENDOR_LENGTH 8 -#define MODEL_LENGTH 16 - -#define INQUIRY_CMD 0x12 -#define INQUIRY_CMDLEN 6 - -/* - * INQUIRY VPD page 0x83 identifier descriptor related values. Reference the - * SCSI Primary Commands specification for details. - */ - -/* - * id type values of id descriptors. These are assumed to fit in 4 bits. - */ -#define SCSI_ID_VENDOR_SPECIFIC 0 -#define SCSI_ID_T10_VENDOR 1 -#define SCSI_ID_EUI_64 2 -#define SCSI_ID_NAA 3 -#define SCSI_ID_RELPORT 4 -#define SCSI_ID_TGTGROUP 5 -#define SCSI_ID_LUNGROUP 6 -#define SCSI_ID_MD5 7 -#define SCSI_ID_NAME 8 - -/* - * Supported NAA values. These fit in 4 bits, so the "don't care" value - * cannot conflict with real values. - */ -#define SCSI_ID_NAA_DONT_CARE 0xff -#define SCSI_ID_NAA_IEEE_REG 5 -#define SCSI_ID_NAA_IEEE_REG_EXTENDED 6 - -/* - * Supported Code Set values. - */ -#define SCSI_ID_BINARY 1 -#define SCSI_ID_ASCII 2 - -struct scsi_id_search_values { - u_char id_type; - u_char naa_type; - u_char code_set; -}; - -/* - * Following are the "true" SCSI status codes. Linux has traditionally - * used a 1 bit right and masked version of these. So now CHECK_CONDITION - * and friends (in ) are deprecated. - */ -#define SCSI_CHECK_CONDITION 0x2 -#define SCSI_CONDITION_MET 0x4 -#define SCSI_BUSY 0x8 -#define SCSI_IMMEDIATE 0x10 -#define SCSI_IMMEDIATE_CONDITION_MET 0x14 -#define SCSI_RESERVATION_CONFLICT 0x18 -#define SCSI_COMMAND_TERMINATED 0x22 -#define SCSI_TASK_SET_FULL 0x28 -#define SCSI_ACA_ACTIVE 0x30 -#define SCSI_TASK_ABORTED 0x40 diff --git a/src/extras/scsi_id/scsi_id.8 b/src/extras/scsi_id/scsi_id.8 deleted file mode 100644 index 0d4dba9149..0000000000 --- a/src/extras/scsi_id/scsi_id.8 +++ /dev/null @@ -1,119 +0,0 @@ -.TH SCSI_ID 8 "December 2003" "" "Linux Administrator's Manual" -.SH NAME -scsi_id \- retrieve and generate a unique SCSI identifier -.SH SYNOPSIS -.BI scsi_id -[\fIoptions\fP] -.SH "DESCRIPTION" -.B scsi_id -queries a SCSI device via the SCSI INQUIRY vital product data (VPD) page 0x80 or -0x83 and uses the resulting data to generate a value that is unique across -all SCSI devices that properly support page 0x80 or page 0x83. - -If a result is generated it is sent to standard output, and the program -exits with a zero value. If no identifier is output, the program exits -with a non\-zero value. - -\fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP -that require a unique SCSI identifier. - -By default all devices are assumed black listed, the \fB\-\-whitelisted\fP option must -be specified on the command line or in the config file for any useful -behaviour. - -SCSI commands are sent directly to the device via the SG_IO ioctl -interface. - -In order to generate unique values for either page 0x80 or page 0x83, the -serial numbers or world wide names are prefixed as follows. - -Identifiers based on page 0x80 are prefixed by the character 'S', the SCSI -vendor, the SCSI product (model) and then the the serial number returned -by page 0x80. For example: - -.sp -.nf -# /usr/lib/udev/scsi_id \-\-page=0x80 \-\-whitelisted \-\-device=/dev/sda -SIBM 3542 1T05078453 -.fi -.P - -Identifiers based on page 0x83 are prefixed by the identifier type -followed by the page 0x83 identifier. For example, a device with a NAA -(Name Address Authority) type of 3 (also in this case the page 0x83 -identifier starts with the NAA value of 6): - -.sp -.nf -# /usr/lib/udev/scsi_id \-\-page=0x83 \-\-whitelisted \-\-device=/dev/sda -3600a0b80000b174b000000d63efc5c8c -.fi -.P - -.SH OPTIONS -.TP -.BI \-\-blacklisted -The default behaviour \- treat the device as black listed, and do nothing -unless a white listed device is found in the scsi_id config\-file. -.TP -.BI \-\-device=\| device\^ -Send SG_IO commands to \fBdevice\fP, such as \fB/dev/sdc\fP. -.TP -.BI \-\-config=\| config\-file -Read configuration and black/white list entries from -.B config\-file -rather than the default -.B /etc/scsi_id.config -file. -.TP -.BI \-\-whitelisted -Treat the device as white listed. The \fB\-\-whitelisted\fP option must be specified -on the command line or in the scsi_id configuration file for -.B scsi_id -to generate any output. -.TP -.BI \-\-page=\| 0x80 | 0x83 | pre-spc3-83 -Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83. -.sp -The default -behaviour is to query the available VPD pages, and use page 0x83 if found, -else page 0x80 if found, else nothing. -.sp -Page pre-spc3-83 should only be utilized for those scsi devices which -are not compliant with the SPC-2 or SPC-3 format for page 83. While this -option is used for older model 4, 5, and 6 EMC Symmetrix devices, its -use with SPC-2 or SPC-3 compliant devices will fallback to the page 83 -format supported by these devices. -.TP -.BI \-\-replace-whitespace -Reformat the output : replace all whitespaces by underscores. -.TP -.BI \-\-export -Export all data in KEY= format used to import in other programs. -.TP -.BI \-\-verbose -Generate verbose debugging output. -.TP -.BI \-\-version -Display version number and exit. -.RE - -.SH "FILES" -.nf -.ft B -.ft -.TP -\fI/etc/scsi_id.config\fP -Configuration of black/white list entries and per device options: -# one config per line, short match strings match longer strings -# vendor=string[,model=string],options= -vendor="ATA",options=-p 0x80 -.RE -.fi -.LP -.SH "SEE ALSO" -.BR udev (7) -.SH AUTHORS -Developed by Patrick Mansfield based on SCSI ID -source included in earlier linux 2.5 kernels, sg_utils source, and SCSI -specifications. diff --git a/src/extras/scsi_id/scsi_id.c b/src/extras/scsi_id/scsi_id.c deleted file mode 100644 index 9bb0d7f538..0000000000 --- a/src/extras/scsi_id/scsi_id.c +++ /dev/null @@ -1,657 +0,0 @@ -/* - * Copyright (C) IBM Corp. 2003 - * Copyright (C) SUSE Linux Products GmbH, 2006 - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" -#include "scsi_id.h" - -static const struct option options[] = { - { "device", required_argument, NULL, 'd' }, - { "config", required_argument, NULL, 'f' }, - { "page", required_argument, NULL, 'p' }, - { "blacklisted", no_argument, NULL, 'b' }, - { "whitelisted", no_argument, NULL, 'g' }, - { "replace-whitespace", no_argument, NULL, 'u' }, - { "sg-version", required_argument, NULL, 's' }, - { "verbose", no_argument, NULL, 'v' }, - { "version", no_argument, NULL, 'V' }, - { "export", no_argument, NULL, 'x' }, - { "help", no_argument, NULL, 'h' }, - {} -}; - -static const char short_options[] = "d:f:ghip:uvVx"; -static const char dev_short_options[] = "bgp:"; - -static int all_good; -static int dev_specified; -static char config_file[MAX_PATH_LEN] = SYSCONFDIR "/scsi_id.config"; -static enum page_code default_page_code; -static int sg_version = 4; -static int use_stderr; -static int debug; -static int reformat_serial; -static int export; -static char vendor_str[64]; -static char model_str[64]; -static char vendor_enc_str[256]; -static char model_enc_str[256]; -static char revision_str[16]; -static char type_str[16]; - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -static void set_type(const char *from, char *to, size_t len) -{ - int type_num; - char *eptr; - char *type = "generic"; - - type_num = strtoul(from, &eptr, 0); - if (eptr != from) { - switch (type_num) { - case 0: - type = "disk"; - break; - case 1: - type = "tape"; - break; - case 4: - type = "optical"; - break; - case 5: - type = "cd"; - break; - case 7: - type = "optical"; - break; - case 0xe: - type = "disk"; - break; - case 0xf: - type = "optical"; - break; - default: - break; - } - } - util_strscpy(to, len, type); -} - -/* - * get_value: - * - * buf points to an '=' followed by a quoted string ("foo") or a string ending - * with a space or ','. - * - * Return a pointer to the NUL terminated string, returns NULL if no - * matches. - */ -static char *get_value(char **buffer) -{ - static char *quote_string = "\"\n"; - static char *comma_string = ",\n"; - char *val; - char *end; - - if (**buffer == '"') { - /* - * skip leading quote, terminate when quote seen - */ - (*buffer)++; - end = quote_string; - } else { - end = comma_string; - } - val = strsep(buffer, end); - if (val && end == quote_string) - /* - * skip trailing quote - */ - (*buffer)++; - - while (isspace(**buffer)) - (*buffer)++; - - return val; -} - -static int argc_count(char *opts) -{ - int i = 0; - while (*opts != '\0') - if (*opts++ == ' ') - i++; - return i; -} - -/* - * get_file_options: - * - * If vendor == NULL, find a line in the config file with only "OPTIONS="; - * if vendor and model are set find the first OPTIONS line in the config - * file that matches. Set argc and argv to match the OPTIONS string. - * - * vendor and model can end in '\n'. - */ -static int get_file_options(struct udev *udev, - const char *vendor, const char *model, - int *argc, char ***newargv) -{ - char *buffer; - FILE *fd; - char *buf; - char *str1; - char *vendor_in, *model_in, *options_in; /* read in from file */ - int lineno; - int c; - int retval = 0; - - dbg(udev, "vendor='%s'; model='%s'\n", vendor, model); - fd = fopen(config_file, "r"); - if (fd == NULL) { - dbg(udev, "can't open %s\n", config_file); - if (errno == ENOENT) { - return 1; - } else { - err(udev, "can't open %s: %s\n", config_file, strerror(errno)); - return -1; - } - } - - /* - * Allocate a buffer rather than put it on the stack so we can - * keep it around to parse any options (any allocated newargv - * points into this buffer for its strings). - */ - buffer = malloc(MAX_BUFFER_LEN); - if (!buffer) { - fclose(fd); - err(udev, "can't allocate memory\n"); - return -1; - } - - *newargv = NULL; - lineno = 0; - while (1) { - vendor_in = model_in = options_in = NULL; - - buf = fgets(buffer, MAX_BUFFER_LEN, fd); - if (buf == NULL) - break; - lineno++; - if (buf[strlen(buffer) - 1] != '\n') { - err(udev, "Config file line %d too long\n", lineno); - break; - } - - while (isspace(*buf)) - buf++; - - /* blank or all whitespace line */ - if (*buf == '\0') - continue; - - /* comment line */ - if (*buf == '#') - continue; - - dbg(udev, "lineno %d: '%s'\n", lineno, buf); - str1 = strsep(&buf, "="); - if (str1 && strcasecmp(str1, "VENDOR") == 0) { - str1 = get_value(&buf); - if (!str1) { - retval = -1; - break; - } - vendor_in = str1; - - str1 = strsep(&buf, "="); - if (str1 && strcasecmp(str1, "MODEL") == 0) { - str1 = get_value(&buf); - if (!str1) { - retval = -1; - break; - } - model_in = str1; - str1 = strsep(&buf, "="); - } - } - - if (str1 && strcasecmp(str1, "OPTIONS") == 0) { - str1 = get_value(&buf); - if (!str1) { - retval = -1; - break; - } - options_in = str1; - } - dbg(udev, "config file line %d:\n" - " vendor '%s'; model '%s'; options '%s'\n", - lineno, vendor_in, model_in, options_in); - /* - * Only allow: [vendor=foo[,model=bar]]options=stuff - */ - if (!options_in || (!vendor_in && model_in)) { - err(udev, "Error parsing config file line %d '%s'\n", lineno, buffer); - retval = -1; - break; - } - if (vendor == NULL) { - if (vendor_in == NULL) { - dbg(udev, "matched global option\n"); - break; - } - } else if ((vendor_in && strncmp(vendor, vendor_in, - strlen(vendor_in)) == 0) && - (!model_in || (strncmp(model, model_in, - strlen(model_in)) == 0))) { - /* - * Matched vendor and optionally model. - * - * Note: a short vendor_in or model_in can - * give a partial match (that is FOO - * matches FOOBAR). - */ - dbg(udev, "matched vendor/model\n"); - break; - } else { - dbg(udev, "no match\n"); - } - } - - if (retval == 0) { - if (vendor_in != NULL || model_in != NULL || - options_in != NULL) { - /* - * Something matched. Allocate newargv, and store - * values found in options_in. - */ - strcpy(buffer, options_in); - c = argc_count(buffer) + 2; - *newargv = calloc(c, sizeof(**newargv)); - if (!*newargv) { - err(udev, "can't allocate memory\n"); - retval = -1; - } else { - *argc = c; - c = 0; - /* - * argv[0] at 0 is skipped by getopt, but - * store the buffer address there for - * later freeing - */ - (*newargv)[c] = buffer; - for (c = 1; c < *argc; c++) - (*newargv)[c] = strsep(&buffer, " \t"); - } - } else { - /* No matches */ - retval = 1; - } - } - if (retval != 0) - free(buffer); - fclose(fd); - return retval; -} - -static int set_options(struct udev *udev, - int argc, char **argv, const char *short_opts, - char *maj_min_dev) -{ - int option; - - /* - * optind is a global extern used by getopt. Since we can call - * set_options twice (once for command line, and once for config - * file) we have to reset this back to 1. - */ - optind = 1; - while (1) { - option = getopt_long(argc, argv, short_opts, options, NULL); - if (option == -1) - break; - - if (optarg) - dbg(udev, "option '%c' arg '%s'\n", option, optarg); - else - dbg(udev, "option '%c'\n", option); - - switch (option) { - case 'b': - all_good = 0; - break; - - case 'd': - dev_specified = 1; - util_strscpy(maj_min_dev, MAX_PATH_LEN, optarg); - break; - - case 'e': - use_stderr = 1; - break; - - case 'f': - util_strscpy(config_file, MAX_PATH_LEN, optarg); - break; - - case 'g': - all_good = 1; - break; - - case 'h': - printf("Usage: scsi_id OPTIONS \n" - " --device= device node for SG_IO commands\n" - " --config= location of config file\n" - " --page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\n" - " --sg-version=3|4 use SGv3 or SGv4\n" - " --blacklisted threat device as blacklisted\n" - " --whitelisted threat device as whitelisted\n" - " --replace-whitespace replace all whitespaces by underscores\n" - " --verbose verbose logging\n" - " --version print version\n" - " --export print values as environment keys\n" - " --help print this help text\n\n"); - exit(0); - - case 'p': - if (strcmp(optarg, "0x80") == 0) { - default_page_code = PAGE_80; - } else if (strcmp(optarg, "0x83") == 0) { - default_page_code = PAGE_83; - } else if (strcmp(optarg, "pre-spc3-83") == 0) { - default_page_code = PAGE_83_PRE_SPC3; - } else { - err(udev, "Unknown page code '%s'\n", optarg); - return -1; - } - break; - - case 's': - sg_version = atoi(optarg); - if (sg_version < 3 || sg_version > 4) { - err(udev, "Unknown SG version '%s'\n", optarg); - return -1; - } - break; - - case 'u': - reformat_serial = 1; - break; - - case 'x': - export = 1; - break; - - case 'v': - debug++; - break; - - case 'V': - printf("%s\n", VERSION); - exit(0); - break; - - default: - exit(1); - } - } - if (optind < argc && !dev_specified) { - dev_specified = 1; - util_strscpy(maj_min_dev, MAX_PATH_LEN, argv[optind]); - } - return 0; -} - -static int per_dev_options(struct udev *udev, - struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) -{ - int retval; - int newargc; - char **newargv = NULL; - int option; - - *good_bad = all_good; - *page_code = default_page_code; - - retval = get_file_options(udev, vendor_str, model_str, &newargc, &newargv); - - optind = 1; /* reset this global extern */ - while (retval == 0) { - option = getopt_long(newargc, newargv, dev_short_options, options, NULL); - if (option == -1) - break; - - if (optarg) - dbg(udev, "option '%c' arg '%s'\n", option, optarg); - else - dbg(udev, "option '%c'\n", option); - - switch (option) { - case 'b': - *good_bad = 0; - break; - - case 'g': - *good_bad = 1; - break; - - case 'p': - if (strcmp(optarg, "0x80") == 0) { - *page_code = PAGE_80; - } else if (strcmp(optarg, "0x83") == 0) { - *page_code = PAGE_83; - } else if (strcmp(optarg, "pre-spc3-83") == 0) { - *page_code = PAGE_83_PRE_SPC3; - } else { - err(udev, "Unknown page code '%s'\n", optarg); - retval = -1; - } - break; - - default: - err(udev, "Unknown or bad option '%c' (0x%x)\n", option, option); - retval = -1; - break; - } - } - - if (newargv) { - free(newargv[0]); - free(newargv); - } - return retval; -} - -static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, const char *path) -{ - int retval; - - dev_scsi->use_sg = sg_version; - - retval = scsi_std_inquiry(udev, dev_scsi, path); - if (retval) - return retval; - - udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); - udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); - - util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); - util_replace_chars(vendor_str, NULL); - util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); - util_replace_chars(model_str, NULL); - set_type(dev_scsi->type, type_str, sizeof(type_str)); - util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); - util_replace_chars(revision_str, NULL); - return 0; -} - -/* - * scsi_id: try to get an id, if one is found, printf it to stdout. - * returns a value passed to exit() - 0 if printed an id, else 1. - */ -static int scsi_id(struct udev *udev, char *maj_min_dev) -{ - struct scsi_id_device dev_scsi; - int good_dev; - int page_code; - int retval = 0; - - memset(&dev_scsi, 0x00, sizeof(struct scsi_id_device)); - - if (set_inq_values(udev, &dev_scsi, maj_min_dev) < 0) { - retval = 1; - goto out; - } - - /* get per device (vendor + model) options from the config file */ - per_dev_options(udev, &dev_scsi, &good_dev, &page_code); - dbg(udev, "per dev options: good %d; page code 0x%x\n", good_dev, page_code); - if (!good_dev) { - retval = 1; - goto out; - } - - /* read serial number from mode pages (no values for optical drives) */ - scsi_get_serial(udev, &dev_scsi, maj_min_dev, page_code, MAX_SERIAL_LEN); - - if (export) { - char serial_str[MAX_SERIAL_LEN]; - - printf("ID_SCSI=1\n"); - printf("ID_VENDOR=%s\n", vendor_str); - printf("ID_VENDOR_ENC=%s\n", vendor_enc_str); - printf("ID_MODEL=%s\n", model_str); - printf("ID_MODEL_ENC=%s\n", model_enc_str); - printf("ID_REVISION=%s\n", revision_str); - printf("ID_TYPE=%s\n", type_str); - if (dev_scsi.serial[0] != '\0') { - util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - util_replace_chars(serial_str, NULL); - printf("ID_SERIAL=%s\n", serial_str); - util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); - util_replace_chars(serial_str, NULL); - printf("ID_SERIAL_SHORT=%s\n", serial_str); - } - if (dev_scsi.wwn[0] != '\0') { - printf("ID_WWN=0x%s\n", dev_scsi.wwn); - if (dev_scsi.wwn_vendor_extension[0] != '\0') { - printf("ID_WWN_VENDOR_EXTENSION=0x%s\n", dev_scsi.wwn_vendor_extension); - printf("ID_WWN_WITH_EXTENSION=0x%s%s\n", dev_scsi.wwn, dev_scsi.wwn_vendor_extension); - } else { - printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn); - } - } - if (dev_scsi.tgpt_group[0] != '\0') { - printf("ID_TARGET_PORT=%s\n", dev_scsi.tgpt_group); - } - if (dev_scsi.unit_serial_number[0] != '\0') { - printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); - } - goto out; - } - - if (dev_scsi.serial[0] == '\0') { - retval = 1; - goto out; - } - - if (reformat_serial) { - char serial_str[MAX_SERIAL_LEN]; - - util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); - util_replace_chars(serial_str, NULL); - printf("%s\n", serial_str); - goto out; - } - - printf("%s\n", dev_scsi.serial); -out: - return retval; -} - -int main(int argc, char **argv) -{ - struct udev *udev; - int retval = 0; - char maj_min_dev[MAX_PATH_LEN]; - int newargc; - char **newargv; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("scsi_id"); - udev_set_log_fn(udev, log_fn); - - /* - * Get config file options. - */ - newargv = NULL; - retval = get_file_options(udev, NULL, NULL, &newargc, &newargv); - if (retval < 0) { - retval = 1; - goto exit; - } - if (newargv && (retval == 0)) { - if (set_options(udev, newargc, newargv, short_options, maj_min_dev) < 0) { - retval = 2; - goto exit; - } - free(newargv); - } - - /* - * Get command line options (overriding any config file settings). - */ - if (set_options(udev, argc, argv, short_options, maj_min_dev) < 0) - exit(1); - - if (!dev_specified) { - err(udev, "no device specified\n"); - retval = 1; - goto exit; - } - - retval = scsi_id(udev, maj_min_dev); - -exit: - udev_unref(udev); - udev_log_close(); - return retval; -} diff --git a/src/extras/scsi_id/scsi_id.h b/src/extras/scsi_id/scsi_id.h deleted file mode 100644 index 828a98305f..0000000000 --- a/src/extras/scsi_id/scsi_id.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) IBM Corp. 2003 - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#define MAX_PATH_LEN 512 - -/* - * MAX_ATTR_LEN: maximum length of the result of reading a sysfs - * attribute. - */ -#define MAX_ATTR_LEN 256 - -/* - * MAX_SERIAL_LEN: the maximum length of the serial number, including - * added prefixes such as vendor and product (model) strings. - */ -#define MAX_SERIAL_LEN 256 - -/* - * MAX_BUFFER_LEN: maximum buffer size and line length used while reading - * the config file. - */ -#define MAX_BUFFER_LEN 256 - -struct scsi_id_device { - char vendor[9]; - char model[17]; - char revision[5]; - char type[33]; - char kernel[64]; - char serial[MAX_SERIAL_LEN]; - char serial_short[MAX_SERIAL_LEN]; - int use_sg; - - /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */ - char unit_serial_number[MAX_SERIAL_LEN]; - - /* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */ - char wwn[17]; - - /* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */ - char wwn_vendor_extension[17]; - - /* NULs if not set - otherwise decimal number */ - char tgpt_group[8]; -}; - -extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); -extern int scsi_get_serial (struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname, - int page_code, int len); - -/* - * Page code values. - */ -enum page_code { - PAGE_83_PRE_SPC3 = -0x83, - PAGE_UNSPECIFIED = 0x00, - PAGE_80 = 0x80, - PAGE_83 = 0x83, -}; diff --git a/src/extras/scsi_id/scsi_serial.c b/src/extras/scsi_id/scsi_serial.c deleted file mode 100644 index f1d63f40cc..0000000000 --- a/src/extras/scsi_id/scsi_serial.c +++ /dev/null @@ -1,990 +0,0 @@ -/* - * Copyright (C) IBM Corp. 2003 - * - * Author: Patrick Mansfield - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" -#include "scsi.h" -#include "scsi_id.h" - -/* - * A priority based list of id, naa, and binary/ascii for the identifier - * descriptor in VPD page 0x83. - * - * Brute force search for a match starting with the first value in the - * following id_search_list. This is not a performance issue, since there - * is normally one or some small number of descriptors. - */ -static const struct scsi_id_search_values id_search_list[] = { - { SCSI_ID_TGTGROUP, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_ASCII }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_ASCII }, - /* - * Devices already exist using NAA values that are now marked - * reserved. These should not conflict with other values, or it is - * a bug in the device. As long as we find the IEEE extended one - * first, we really don't care what other ones are used. Using - * don't care here means that a device that returns multiple - * non-IEEE descriptors in a random order will get different - * names. - */ - { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, - { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, - { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, - { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, - { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, -}; - -static const char hex_str[]="0123456789abcdef"; - -/* - * Values returned in the result/status, only the ones used by the code - * are used here. - */ - -#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ -#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ -#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ -#define DRIVER_TIMEOUT 0x06 -#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ - -/* The following "category" function returns one of the following */ -#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ -#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ -#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ -#define SG_ERR_CAT_TIMEOUT 3 -#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ -#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ -#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ -#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ - -static int do_scsi_page80_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int max_len); - -static int sg_err_category_new(struct udev *udev, - int scsi_status, int msg_status, int - host_status, int driver_status, const - unsigned char *sense_buffer, int sb_len) -{ - scsi_status &= 0x7e; - - /* - * XXX change to return only two values - failed or OK. - */ - - if (!scsi_status && !host_status && !driver_status) - return SG_ERR_CAT_CLEAN; - - if ((scsi_status == SCSI_CHECK_CONDITION) || - (scsi_status == SCSI_COMMAND_TERMINATED) || - ((driver_status & 0xf) == DRIVER_SENSE)) { - if (sense_buffer && (sb_len > 2)) { - int sense_key; - unsigned char asc; - - if (sense_buffer[0] & 0x2) { - sense_key = sense_buffer[1] & 0xf; - asc = sense_buffer[2]; - } else { - sense_key = sense_buffer[2] & 0xf; - asc = (sb_len > 12) ? sense_buffer[12] : 0; - } - - if (sense_key == RECOVERED_ERROR) - return SG_ERR_CAT_RECOVERED; - else if (sense_key == UNIT_ATTENTION) { - if (0x28 == asc) - return SG_ERR_CAT_MEDIA_CHANGED; - if (0x29 == asc) - return SG_ERR_CAT_RESET; - } else if (sense_key == ILLEGAL_REQUEST) { - return SG_ERR_CAT_NOTSUPPORTED; - } - } - return SG_ERR_CAT_SENSE; - } - if (host_status) { - if ((host_status == DID_NO_CONNECT) || - (host_status == DID_BUS_BUSY) || - (host_status == DID_TIME_OUT)) - return SG_ERR_CAT_TIMEOUT; - } - if (driver_status) { - if (driver_status == DRIVER_TIMEOUT) - return SG_ERR_CAT_TIMEOUT; - } - return SG_ERR_CAT_OTHER; -} - -static int sg_err_category3(struct udev *udev, struct sg_io_hdr *hp) -{ - return sg_err_category_new(udev, - hp->status, hp->msg_status, - hp->host_status, hp->driver_status, - hp->sbp, hp->sb_len_wr); -} - -static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) -{ - return sg_err_category_new(udev, hp->device_status, 0, - hp->transport_status, hp->driver_status, - (unsigned char *)(uintptr_t)hp->response, - hp->response_len); -} - -static int scsi_dump_sense(struct udev *udev, - struct scsi_id_device *dev_scsi, - unsigned char *sense_buffer, int sb_len) -{ - int s; - int code; - int sense_class; - int sense_key; - int asc, ascq; -#ifdef DUMP_SENSE - char out_buffer[256]; - int i, j; -#endif - - /* - * Figure out and print the sense key, asc and ascq. - * - * If you want to suppress these for a particular drive model, add - * a black list entry in the scsi_id config file. - * - * XXX We probably need to: lookup the sense/asc/ascq in a retry - * table, and if found return 1 (after dumping the sense, asc, and - * ascq). So, if/when we get something like a power on/reset, - * we'll retry the command. - */ - - dbg(udev, "got check condition\n"); - - if (sb_len < 1) { - info(udev, "%s: sense buffer empty\n", dev_scsi->kernel); - return -1; - } - - sense_class = (sense_buffer[0] >> 4) & 0x07; - code = sense_buffer[0] & 0xf; - - if (sense_class == 7) { - /* - * extended sense data. - */ - s = sense_buffer[7] + 8; - if (sb_len < s) { - info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", - dev_scsi->kernel, sb_len, s - sb_len); - return -1; - } - if ((code == 0x0) || (code == 0x1)) { - sense_key = sense_buffer[2] & 0xf; - if (s < 14) { - /* - * Possible? - */ - info(udev, "%s: sense result too" " small %d bytes\n", - dev_scsi->kernel, s); - return -1; - } - asc = sense_buffer[12]; - ascq = sense_buffer[13]; - } else if ((code == 0x2) || (code == 0x3)) { - sense_key = sense_buffer[1] & 0xf; - asc = sense_buffer[2]; - ascq = sense_buffer[3]; - } else { - info(udev, "%s: invalid sense code 0x%x\n", - dev_scsi->kernel, code); - return -1; - } - info(udev, "%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", - dev_scsi->kernel, sense_key, asc, ascq); - } else { - if (sb_len < 4) { - info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", - dev_scsi->kernel, sb_len, 4 - sb_len); - return -1; - } - - if (sense_buffer[0] < 15) - info(udev, "%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); - else - info(udev, "%s: sense = %2x %2x\n", - dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); - info(udev, "%s: non-extended sense class %d code 0x%0x\n", - dev_scsi->kernel, sense_class, code); - - } - -#ifdef DUMP_SENSE - for (i = 0, j = 0; (i < s) && (j < 254); i++) { - dbg(udev, "i %d, j %d\n", i, j); - out_buffer[j++] = hex_str[(sense_buffer[i] & 0xf0) >> 4]; - out_buffer[j++] = hex_str[sense_buffer[i] & 0x0f]; - out_buffer[j++] = ' '; - } - out_buffer[j] = '\0'; - info(udev, "%s: sense dump:\n", dev_scsi->kernel); - info(udev, "%s: %s\n", dev_scsi->kernel, out_buffer); - -#endif - return -1; -} - -static int scsi_dump(struct udev *udev, - struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) -{ - if (!io->status && !io->host_status && !io->msg_status && - !io->driver_status) { - /* - * Impossible, should not be called. - */ - info(udev, "%s: called with no error\n", __FUNCTION__); - return -1; - } - - info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", - dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); - if (io->status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(udev, dev_scsi, io->sbp, io->sb_len_wr); - else - return -1; -} - -static int scsi_dump_v4(struct udev *udev, - struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) -{ - if (!io->device_status && !io->transport_status && - !io->driver_status) { - /* - * Impossible, should not be called. - */ - info(udev, "%s: called with no error\n", __FUNCTION__); - return -1; - } - - info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x\n", - dev_scsi->kernel, io->driver_status, io->transport_status, - io->device_status); - if (io->device_status == SCSI_CHECK_CONDITION) - return scsi_dump_sense(udev, dev_scsi, (unsigned char *)(uintptr_t)io->response, - io->response_len); - else - return -1; -} - -static int scsi_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - unsigned char evpd, unsigned char page, - unsigned char *buf, unsigned int buflen) -{ - unsigned char inq_cmd[INQUIRY_CMDLEN] = - { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; - unsigned char sense[SENSE_BUFF_LEN]; - void *io_buf; - struct sg_io_v4 io_v4; - struct sg_io_hdr io_hdr; - int retry = 3; /* rather random */ - int retval; - - if (buflen > SCSI_INQ_BUFF_LEN) { - info(udev, "buflen %d too long\n", buflen); - return -1; - } - -resend: - dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); - - if (dev_scsi->use_sg == 4) { - memset(&io_v4, 0, sizeof(struct sg_io_v4)); - io_v4.guard = 'Q'; - io_v4.protocol = BSG_PROTOCOL_SCSI; - io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; - io_v4.request_len = sizeof(inq_cmd); - io_v4.request = (uintptr_t)inq_cmd; - io_v4.max_response_len = sizeof(sense); - io_v4.response = (uintptr_t)sense; - io_v4.din_xfer_len = buflen; - io_v4.din_xferp = (uintptr_t)buf; - io_buf = (void *)&io_v4; - } else { - memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); - io_hdr.interface_id = 'S'; - io_hdr.cmd_len = sizeof(inq_cmd); - io_hdr.mx_sb_len = sizeof(sense); - io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; - io_hdr.dxfer_len = buflen; - io_hdr.dxferp = buf; - io_hdr.cmdp = inq_cmd; - io_hdr.sbp = sense; - io_hdr.timeout = DEF_TIMEOUT; - io_buf = (void *)&io_hdr; - } - - retval = ioctl(fd, SG_IO, io_buf); - if (retval < 0) { - if ((errno == EINVAL || errno == ENOSYS) && dev_scsi->use_sg == 4) { - dev_scsi->use_sg = 3; - goto resend; - } - info(udev, "%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); - goto error; - } - - if (dev_scsi->use_sg == 4) - retval = sg_err_category4(udev, io_buf); - else - retval = sg_err_category3(udev, io_buf); - - switch (retval) { - case SG_ERR_CAT_NOTSUPPORTED: - buf[1] = 0; - /* Fallthrough */ - case SG_ERR_CAT_CLEAN: - case SG_ERR_CAT_RECOVERED: - retval = 0; - break; - - default: - if (dev_scsi->use_sg == 4) - retval = scsi_dump_v4(udev, dev_scsi, io_buf); - else - retval = scsi_dump(udev, dev_scsi, io_buf); - } - - if (!retval) { - retval = buflen; - } else if (retval > 0) { - if (--retry > 0) { - dbg(udev, "%s: Retrying ...\n", dev_scsi->kernel); - goto resend; - } - retval = -1; - } - -error: - if (retval < 0) - info(udev, "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", - dev_scsi->kernel, evpd, page); - - return retval; -} - -/* Get list of supported EVPD pages */ -static int do_scsi_page0_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - unsigned char *buffer, unsigned int len) -{ - int retval; - - memset(buffer, 0, len); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, 0x0, buffer, len); - if (retval < 0) - return 1; - - if (buffer[1] != 0) { - info(udev, "%s: page 0 not available.\n", dev_scsi->kernel); - return 1; - } - if (buffer[3] > len) { - info(udev, "%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); - return 1; - } - - /* - * Following check is based on code once included in the 2.5.x - * kernel. - * - * Some ill behaved devices return the standard inquiry here - * rather than the evpd data, snoop the data to verify. - */ - if (buffer[3] > MODEL_LENGTH) { - /* - * If the vendor id appears in the page assume the page is - * invalid. - */ - if (!strncmp((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) { - info(udev, "%s: invalid page0 data\n", dev_scsi->kernel); - return 1; - } - } - return 0; -} - -/* - * The caller checks that serial is long enough to include the vendor + - * model. - */ -static int prepend_vendor_model(struct udev *udev, - struct scsi_id_device *dev_scsi, char *serial) -{ - int ind; - - strncpy(serial, dev_scsi->vendor, VENDOR_LENGTH); - strncat(serial, dev_scsi->model, MODEL_LENGTH); - ind = strlen(serial); - - /* - * This is not a complete check, since we are using strncat/cpy - * above, ind will never be too large. - */ - if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { - info(udev, "%s: expected length %d, got length %d\n", - dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); - return -1; - } - return ind; -} - -/** - * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill - * serial number. - **/ -static int check_fill_0x83_id(struct udev *udev, - struct scsi_id_device *dev_scsi, - unsigned char *page_83, - const struct scsi_id_search_values - *id_search, char *serial, char *serial_short, - int max_len, char *wwn, - char *wwn_vendor_extension, char *tgpt_group) -{ - int i, j, s, len; - - /* - * ASSOCIATION must be with the device (value 0) - * or with the target port for SCSI_ID_TGTPORT - */ - if ((page_83[1] & 0x30) == 0x10) { - if (id_search->id_type != SCSI_ID_TGTGROUP) - return 1; - } else if ((page_83[1] & 0x30) != 0) { - return 1; - } - - if ((page_83[1] & 0x0f) != id_search->id_type) - return 1; - - /* - * Possibly check NAA sub-type. - */ - if ((id_search->naa_type != SCSI_ID_NAA_DONT_CARE) && - (id_search->naa_type != (page_83[4] & 0xf0) >> 4)) - return 1; - - /* - * Check for matching code set - ASCII or BINARY. - */ - if ((page_83[0] & 0x0f) != id_search->code_set) - return 1; - - /* - * page_83[3]: identifier length - */ - len = page_83[3]; - if ((page_83[0] & 0x0f) != SCSI_ID_ASCII) - /* - * If not ASCII, use two bytes for each binary value. - */ - len *= 2; - - /* - * Add one byte for the NUL termination, and one for the id_type. - */ - len += 2; - if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) - len += VENDOR_LENGTH + MODEL_LENGTH; - - if (max_len < len) { - info(udev, "%s: length %d too short - need %d\n", - dev_scsi->kernel, max_len, len); - return 1; - } - - if (id_search->id_type == SCSI_ID_TGTGROUP && tgpt_group != NULL) { - unsigned int group; - - group = ((unsigned int)page_83[6] << 8) | page_83[7]; - sprintf(tgpt_group,"%x", group); - return 1; - } - - serial[0] = hex_str[id_search->id_type]; - - /* - * For SCSI_ID_VENDOR_SPECIFIC prepend the vendor and model before - * the id since it is not unique across all vendors and models, - * this differs from SCSI_ID_T10_VENDOR, where the vendor is - * included in the identifier. - */ - if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) - if (prepend_vendor_model(udev, dev_scsi, &serial[1]) < 0) { - dbg(udev, "prepend failed\n"); - return 1; - } - - i = 4; /* offset to the start of the identifier */ - s = j = strlen(serial); - if ((page_83[0] & 0x0f) == SCSI_ID_ASCII) { - /* - * ASCII descriptor. - */ - while (i < (4 + page_83[3])) - serial[j++] = page_83[i++]; - } else { - /* - * Binary descriptor, convert to ASCII, using two bytes of - * ASCII for each byte in the page_83. - */ - while (i < (4 + page_83[3])) { - serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; - serial[j++] = hex_str[page_83[i] & 0x0f]; - i++; - } - } - - strcpy(serial_short, &serial[s]); - - if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { - strncpy(wwn, &serial[s], 16); - if (wwn_vendor_extension != NULL) { - strncpy(wwn_vendor_extension, &serial[s + 16], 16); - } - } - - return 0; -} - -/* Extract the raw binary from VPD 0x83 pre-SPC devices */ -static int check_fill_0x83_prespc3(struct udev *udev, - struct scsi_id_device *dev_scsi, - unsigned char *page_83, - const struct scsi_id_search_values - *id_search, char *serial, char *serial_short, int max_len) -{ - int i, j; - - dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); - serial[0] = hex_str[id_search->id_type]; - /* serial has been memset to zero before */ - j = strlen(serial); /* j = 1; */ - - for (i = 0; (i < page_83[3]) && (j < max_len-3); ++i) { - serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; - serial[j++] = hex_str[ page_83[4+i] & 0x0f]; - } - serial[max_len-1] = 0; - strncpy(serial_short, serial, max_len-1); - return 0; -} - - -/* Get device identification VPD page */ -static int do_scsi_page83_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int len, - char *unit_serial_number, char *wwn, - char *wwn_vendor_extension, char *tgpt_group) -{ - int retval; - unsigned int id_ind, j; - unsigned char page_83[SCSI_INQ_BUFF_LEN]; - - /* also pick up the page 80 serial number */ - do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN); - - memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, - SCSI_INQ_BUFF_LEN); - if (retval < 0) - return 1; - - if (page_83[1] != PAGE_83) { - info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); - return 1; - } - - /* - * XXX Some devices (IBM 3542) return all spaces for an identifier if - * the LUN is not actually configured. This leads to identifiers of - * the form: "1 ". - */ - - /* - * Model 4, 5, and (some) model 6 EMC Symmetrix devices return - * a page 83 reply according to SCSI-2 format instead of SPC-2/3. - * - * The SCSI-2 page 83 format returns an IEEE WWN in binary - * encoded hexi-decimal in the 16 bytes following the initial - * 4-byte page 83 reply header. - * - * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part - * of an Identification descriptor. The 3rd byte of the first - * Identification descriptor is a reserved (BSZ) byte field. - * - * Reference the 7th byte of the page 83 reply to determine - * whether the reply is compliant with SCSI-2 or SPC-2/3 - * specifications. A zero value in the 7th byte indicates - * an SPC-2/3 conformant reply, (i.e., the reserved field of the - * first Identification descriptor). This byte will be non-zero - * for a SCSI-2 conformant page 83 reply from these EMC - * Symmetrix models since the 7th byte of the reply corresponds - * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, - * 0x006048. - */ - - if (page_83[6] != 0) - return check_fill_0x83_prespc3(udev, - dev_scsi, page_83, id_search_list, - serial, serial_short, len); - - /* - * Search for a match in the prioritized id_search_list - since WWN ids - * come first we can pick up the WWN in check_fill_0x83_id(). - */ - for (id_ind = 0; - id_ind < sizeof(id_search_list)/sizeof(id_search_list[0]); - id_ind++) { - /* - * Examine each descriptor returned. There is normally only - * one or a small number of descriptors. - */ - for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { - retval = check_fill_0x83_id(udev, - dev_scsi, &page_83[j], - &id_search_list[id_ind], - serial, serial_short, len, - wwn, wwn_vendor_extension, - tgpt_group); - dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, - id_search_list[id_ind].id_type, - id_search_list[id_ind].naa_type, - id_search_list[id_ind].code_set); - if (!retval) { - dbg(udev, " used\n"); - return retval; - } else if (retval < 0) { - dbg(udev, " failed\n"); - return retval; - } else { - dbg(udev, " not used\n"); - } - } - } - return 1; -} - -/* - * Get device identification VPD page for older SCSI-2 device which is not - * compliant with either SPC-2 or SPC-3 format. - * - * Return the hard coded error code value 2 if the page 83 reply is not - * conformant to the SCSI-2 format. - */ -static int do_scsi_page83_prespc3_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int len) -{ - int retval; - int i, j; - unsigned char page_83[SCSI_INQ_BUFF_LEN]; - - memset(page_83, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); - if (retval < 0) - return 1; - - if (page_83[1] != PAGE_83) { - info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); - return 1; - } - /* - * Model 4, 5, and (some) model 6 EMC Symmetrix devices return - * a page 83 reply according to SCSI-2 format instead of SPC-2/3. - * - * The SCSI-2 page 83 format returns an IEEE WWN in binary - * encoded hexi-decimal in the 16 bytes following the initial - * 4-byte page 83 reply header. - * - * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part - * of an Identification descriptor. The 3rd byte of the first - * Identification descriptor is a reserved (BSZ) byte field. - * - * Reference the 7th byte of the page 83 reply to determine - * whether the reply is compliant with SCSI-2 or SPC-2/3 - * specifications. A zero value in the 7th byte indicates - * an SPC-2/3 conformant reply, (i.e., the reserved field of the - * first Identification descriptor). This byte will be non-zero - * for a SCSI-2 conformant page 83 reply from these EMC - * Symmetrix models since the 7th byte of the reply corresponds - * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, - * 0x006048. - */ - if (page_83[6] == 0) - return 2; - - serial[0] = hex_str[id_search_list[0].id_type]; - /* - * The first four bytes contain data, not a descriptor. - */ - i = 4; - j = strlen(serial); - /* - * Binary descriptor, convert to ASCII, - * using two bytes of ASCII for each byte - * in the page_83. - */ - while (i < (page_83[3]+4)) { - serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; - serial[j++] = hex_str[page_83[i] & 0x0f]; - i++; - } - dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); - return 0; -} - -/* Get unit serial number VPD page */ -static int do_scsi_page80_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, int fd, - char *serial, char *serial_short, int max_len) -{ - int retval; - int ser_ind; - int i; - int len; - unsigned char buf[SCSI_INQ_BUFF_LEN]; - - memset(buf, 0, SCSI_INQ_BUFF_LEN); - retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); - if (retval < 0) - return retval; - - if (buf[1] != PAGE_80) { - info(udev, "%s: Invalid page 0x80\n", dev_scsi->kernel); - return 1; - } - - len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; - if (max_len < len) { - info(udev, "%s: length %d too short - need %d\n", - dev_scsi->kernel, max_len, len); - return 1; - } - /* - * Prepend 'S' to avoid unlikely collision with page 0x83 vendor - * specific type where we prepend '0' + vendor + model. - */ - len = buf[3]; - if (serial != NULL) { - serial[0] = 'S'; - ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]); - if (ser_ind < 0) - return 1; - for (i = 4; i < len + 4; i++, ser_ind++) - serial[ser_ind] = buf[i]; - } - if (serial_short != NULL) { - memcpy(serial_short, &buf[4], len); - serial_short[len] = '\0'; - } - return 0; -} - -int scsi_std_inquiry(struct udev *udev, - struct scsi_id_device *dev_scsi, const char *devname) -{ - int fd; - unsigned char buf[SCSI_INQ_BUFF_LEN]; - struct stat statbuf; - int err = 0; - - dbg(udev, "opening %s\n", devname); - fd = open(devname, O_RDONLY | O_NONBLOCK); - if (fd < 0) { - info(udev, "scsi_id: cannot open %s: %s\n", - devname, strerror(errno)); - return 1; - } - - if (fstat(fd, &statbuf) < 0) { - info(udev, "scsi_id: cannot stat %s: %s\n", - devname, strerror(errno)); - err = 2; - goto out; - } - sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev), - minor(statbuf.st_rdev)); - - memset(buf, 0, SCSI_INQ_BUFF_LEN); - err = scsi_inquiry(udev, dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); - if (err < 0) - goto out; - - err = 0; - memcpy(dev_scsi->vendor, buf + 8, 8); - dev_scsi->vendor[8] = '\0'; - memcpy(dev_scsi->model, buf + 16, 16); - dev_scsi->model[16] = '\0'; - memcpy(dev_scsi->revision, buf + 32, 4); - dev_scsi->revision[4] = '\0'; - sprintf(dev_scsi->type,"%x", buf[0] & 0x1f); - -out: - close(fd); - return err; -} - -int scsi_get_serial(struct udev *udev, - struct scsi_id_device *dev_scsi, const char *devname, - int page_code, int len) -{ - unsigned char page0[SCSI_INQ_BUFF_LEN]; - int fd = -1; - int cnt; - int ind; - int retval; - - memset(dev_scsi->serial, 0, len); - dbg(udev, "opening %s\n", devname); - srand((unsigned int)getpid()); - for (cnt = 20; cnt > 0; cnt--) { - struct timespec duration; - - fd = open(devname, O_RDONLY | O_NONBLOCK); - if (fd >= 0 || errno != EBUSY) - break; - duration.tv_sec = 0; - duration.tv_nsec = (200 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); - nanosleep(&duration, NULL); - } - if (fd < 0) - return 1; - - if (page_code == PAGE_80) { - if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { - retval = 1; - goto completed; - } else { - retval = 0; - goto completed; - } - } else if (page_code == PAGE_83) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { - retval = 1; - goto completed; - } else { - retval = 0; - goto completed; - } - } else if (page_code == PAGE_83_PRE_SPC3) { - retval = do_scsi_page83_prespc3_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len); - if (retval) { - /* - * Fallback to servicing a SPC-2/3 compliant page 83 - * inquiry if the page 83 reply format does not - * conform to pre-SPC3 expectations. - */ - if (retval == 2) { - if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { - retval = 1; - goto completed; - } else { - retval = 0; - goto completed; - } - } - else { - retval = 1; - goto completed; - } - } else { - retval = 0; - goto completed; - } - } else if (page_code != 0x00) { - info(udev, "%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); - return 1; - } - - /* - * Get page 0, the page of the pages. By default, try from best to - * worst of supported pages: 0x83 then 0x80. - */ - if (do_scsi_page0_inquiry(udev, dev_scsi, fd, page0, SCSI_INQ_BUFF_LEN)) { - /* - * Don't try anything else. Black list if a specific page - * should be used for this vendor+model, or maybe have an - * optional fall-back to page 0x80 or page 0x83. - */ - retval = 1; - goto completed; - } - - dbg(udev, "%s: Checking page0\n", dev_scsi->kernel); - - for (ind = 4; ind <= page0[3] + 3; ind++) - if (page0[ind] == PAGE_83) - if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { - /* - * Success - */ - retval = 0; - goto completed; - } - - for (ind = 4; ind <= page0[3] + 3; ind++) - if (page0[ind] == PAGE_80) - if (!do_scsi_page80_inquiry(udev, dev_scsi, fd, - dev_scsi->serial, dev_scsi->serial_short, len)) { - /* - * Success - */ - retval = 0; - goto completed; - } - retval = 1; - -completed: - close(fd); - return retval; -} diff --git a/src/extras/v4l_id/.gitignore b/src/extras/v4l_id/.gitignore deleted file mode 100644 index dffced9f08..0000000000 --- a/src/extras/v4l_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -v4l_id diff --git a/src/extras/v4l_id/60-persistent-v4l.rules b/src/extras/v4l_id/60-persistent-v4l.rules deleted file mode 100644 index 93c5ee8c27..0000000000 --- a/src/extras/v4l_id/60-persistent-v4l.rules +++ /dev/null @@ -1,20 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="persistent_v4l_end" -SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" -ENV{MAJOR}=="", GOTO="persistent_v4l_end" - -IMPORT{program}="v4l_id $devnode" - -SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" -KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" - -# check for valid "index" number -TEST!="index", GOTO="persistent_v4l_end" -ATTR{index}!="?*", GOTO="persistent_v4l_end" - -IMPORT{builtin}="path_id" -ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" -ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" - -LABEL="persistent_v4l_end" diff --git a/src/extras/v4l_id/v4l_id.c b/src/extras/v4l_id/v4l_id.c deleted file mode 100644 index a2a80b5f43..0000000000 --- a/src/extras/v4l_id/v4l_id.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2009 Kay Sievers - * Copyright (c) 2009 Filippo Argiolas - * - * 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; either version 2 of the - * License, or (at your option) any later version. - * - * 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: - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int main (int argc, char *argv[]) -{ - static const struct option options[] = { - { "help", no_argument, NULL, 'h' }, - {} - }; - int fd; - char *device; - struct v4l2_capability v2cap; - - while (1) { - int option; - - option = getopt_long(argc, argv, "h", options, NULL); - if (option == -1) - break; - - switch (option) { - case 'h': - printf("Usage: v4l_id [--help] \n\n"); - return 0; - default: - return 1; - } - } - device = argv[optind]; - - if (device == NULL) - return 2; - fd = open (device, O_RDONLY); - if (fd < 0) - return 3; - - if (ioctl (fd, VIDIOC_QUERYCAP, &v2cap) == 0) { - printf("ID_V4L_VERSION=2\n"); - printf("ID_V4L_PRODUCT=%s\n", v2cap.card); - printf("ID_V4L_CAPABILITIES=:"); - if ((v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0) - printf("capture:"); - if ((v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) > 0) - printf("video_output:"); - if ((v2cap.capabilities & V4L2_CAP_VIDEO_OVERLAY) > 0) - printf("video_overlay:"); - if ((v2cap.capabilities & V4L2_CAP_AUDIO) > 0) - printf("audio:"); - if ((v2cap.capabilities & V4L2_CAP_TUNER) > 0) - printf("tuner:"); - if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0) - printf("radio:"); - printf("\n"); - } - - close (fd); - return 0; -} diff --git a/src/floppy/.gitignore b/src/floppy/.gitignore new file mode 100644 index 0000000000..939f625a4a --- /dev/null +++ b/src/floppy/.gitignore @@ -0,0 +1 @@ +create_floppy_devices diff --git a/src/floppy/60-floppy.rules b/src/floppy/60-floppy.rules new file mode 100644 index 0000000000..53e4a9e59a --- /dev/null +++ b/src/floppy/60-floppy.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM=="block", KERNEL=="fd[0-9]", ACTION=="add", ATTRS{cmos}=="?*", ENV{CMOS_TYPE}="$attr{cmos}", \ + RUN+="create_floppy_devices -c -t $env{CMOS_TYPE} -m %M -M 0660 -G floppy $root/%k" diff --git a/src/floppy/create_floppy_devices.c b/src/floppy/create_floppy_devices.c new file mode 100644 index 0000000000..f71ef0d809 --- /dev/null +++ b/src/floppy/create_floppy_devices.c @@ -0,0 +1,177 @@ +/* + * Create all possible floppy device based on the CMOS type. + * Based upon code from drivers/block/floppy.c + * + * Copyright(C) 2005, SUSE Linux Products GmbH + * + * Author: Hannes Reinecke + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" + +static char *table[] = { + "", "d360", "h1200", "u360", "u720", "h360", "h720", + "u1440", "u2880", "CompaQ", "h1440", "u1680", "h410", + "u820", "h1476", "u1722", "h420", "u830", "h1494", "u1743", + "h880", "u1040", "u1120", "h1600", "u1760", "u1920", + "u3200", "u3520", "u3840", "u1840", "u800", "u1600", + NULL +}; + +static int t360[] = { 1, 0 }; +static int t1200[] = { 2, 5, 6, 10, 12, 14, 16, 18, 20, 23, 0 }; +static int t3in[] = { 8, 9, 26, 27, 28, 7, 11, 15, 19, 24, 25, 29, 31, 3, 4, 13, 17, 21, 22, 30, 0 }; +static int *table_sup[] = { NULL, t360, t1200, t3in+5+8, t3in+5, t3in, t3in }; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + vsyslog(priority, format, args); +} + +int main(int argc, char **argv) +{ + struct udev *udev; + char *dev; + char *devname; + char node[64]; + int type = 0, i, fdnum, c; + int major = 2, minor; + uid_t uid = 0; + gid_t gid = 0; + mode_t mode = 0660; + int create_nodes = 0; + int print_nodes = 0; + int is_err = 0; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("create_floppy_devices"); + udev_set_log_fn(udev, log_fn); + udev_selinux_init(udev); + + while ((c = getopt(argc, argv, "cudm:U:G:M:t:")) != -1) { + switch (c) { + case 'c': + create_nodes = 1; + break; + case 'd': + print_nodes = 1; + break; + case 'U': + uid = util_lookup_user(udev, optarg); + break; + case 'G': + gid = util_lookup_group(udev, optarg); + break; + case 'M': + mode = strtol(optarg, NULL, 0); + mode = mode & 0666; + break; + case 'm': + major = strtol(optarg, NULL, 0); + break; + case 't': + type = strtol(optarg, NULL, 0); + break; + default: + is_err++; + break; + } + } + + if (is_err || optind >= argc) { + printf("Usage: %s [OPTION] device\n" + " -c create\n" + " -d debug\n" + " -m Major number\n" + " -t floppy type number\n" + " -U device node user ownership\n" + " -G device node group owner\n" + " -M device node mode\n" + "\n", argv[0]); + return 1; + } + + dev = argv[optind]; + devname = strrchr(dev, '/'); + if (devname != NULL) + devname = &devname[1]; + else + devname = dev; + if (strncmp(devname, "fd", 2) != 0) { + fprintf(stderr,"Device '%s' is not a floppy device\n", dev); + return 1; + } + + fdnum = strtol(&devname[2], NULL, 10); + if (fdnum < 0 || fdnum > 7) { + fprintf(stderr,"Floppy device number %d out of range (0-7)\n", fdnum); + return 1; + } + if (fdnum > 3) + fdnum += 124; + + if (major < 1) { + fprintf(stderr,"Invalid major number %d\n", major); + return 1; + } + + if (type < 0 || type >= (int) ARRAY_SIZE(table_sup)) { + fprintf(stderr,"Invalid CMOS type %d\n", type); + return 1; + } + + if (type == 0) + return 0; + + i = 0; + while (table_sup[type][i]) { + sprintf(node, "%s%s", dev, table[table_sup[type][i]]); + minor = (table_sup[type][i] << 2) + fdnum; + if (print_nodes) + printf("%s b %.4o %d %d\n", node, mode, major, minor); + if (create_nodes) { + unlink(node); + udev_selinux_setfscreatecon(udev, node, S_IFBLK | mode); + mknod(node, S_IFBLK | mode, makedev(major,minor)); + udev_selinux_resetfscreatecon(udev); + chown(node, uid, gid); + chmod(node, S_IFBLK | mode); + } + i++; + } + + udev_selinux_exit(udev); + udev_unref(udev); + udev_log_close(); +exit: + return 0; +} diff --git a/src/gudev/.gitignore b/src/gudev/.gitignore new file mode 100644 index 0000000000..d20fa523e4 --- /dev/null +++ b/src/gudev/.gitignore @@ -0,0 +1,9 @@ +gtk-doc.make +docs/version.xml +gudev-1.0.pc +gudevenumtypes.c +gudevenumtypes.h +gudevmarshal.c +gudevmarshal.h +GUdev-1.0.gir +GUdev-1.0.typelib diff --git a/src/gudev/COPYING b/src/gudev/COPYING new file mode 100644 index 0000000000..da97db2bd0 --- /dev/null +++ b/src/gudev/COPYING @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/src/gudev/docs/.gitignore b/src/gudev/docs/.gitignore new file mode 100644 index 0000000000..8eada6d409 --- /dev/null +++ b/src/gudev/docs/.gitignore @@ -0,0 +1,16 @@ +gudev-overrides.txt +gudev-decl-list.txt +gudev-decl.txt +gudev-undeclared.txt +gudev-undocumented.txt +gudev-unused.txt +gudev.args +gudev.hierarchy +gudev.interfaces +gudev.prerequisites +gudev.signals +html.stamp +html/* +xml/* +tmpl/* +*.stamp diff --git a/src/gudev/docs/Makefile.am b/src/gudev/docs/Makefile.am new file mode 100644 index 0000000000..2f0a8cb3eb --- /dev/null +++ b/src/gudev/docs/Makefile.am @@ -0,0 +1,106 @@ +## Process this file with automake to produce Makefile.in + +# We require automake 1.10 at least. +AUTOMAKE_OPTIONS = 1.10 + +# This is a blank Makefile.am for using gtk-doc. +# Copy this to your project's API docs directory and modify the variables to +# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples +# of using the various options. + +# The name of the module, e.g. 'glib'. +DOC_MODULE=gudev + +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=2 + +# The top-level SGML file. You can change this if you want to. +DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml + +# The directory containing the source code. Relative to $(srcdir). +# gtk-doc will search all .c & .h files beneath here for inline comments +# documenting the functions and macros. +# e.g. DOC_SOURCE_DIR=../../../gtk +DOC_SOURCE_DIR=$(top_srcdir)/src + +# Extra options to pass to gtkdoc-scangobj. Not normally needed. +SCANGOBJ_OPTIONS= + +# Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" +SCAN_OPTIONS= + +# Extra options to supply to gtkdoc-mkdb. +# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml +MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=g_udev + +# Extra options to supply to gtkdoc-mktmpl +# e.g. MKTMPL_OPTIONS=--only-section-tmpl +MKTMPL_OPTIONS= + +# Extra options to supply to gtkdoc-mkhtml +MKHTML_OPTIONS=--path=$(abs_srcdir) --path=$(abs_builddir) + +# Extra options to supply to gtkdoc-fixref. Not normally needed. +# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html +FIXXREF_OPTIONS= + +# Used for dependencies. The docs will be rebuilt if any of these change. +# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h +# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c +HFILE_GLOB=$(top_srcdir)/src/gudev/*.h +CFILE_GLOB=$(top_srcdir)/src/gudev/*.c + +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h +EXTRA_HFILES= + +# Header files to ignore when scanning. Use base file name, no paths +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +IGNORE_HFILES= + +# Images to copy into HTML directory. +# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png +HTML_IMAGES= + +# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE). +# e.g. content_files=running.sgml building.sgml changes-2.0.sgml +content_files = version.xml + +# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded +# These files must be listed here *and* in content_files +# e.g. expand_content_files=running.sgml +expand_content_files= + +# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. +# Only needed if you are using gtkdoc-scangobj to dynamically query widget +# signals and properties. +# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) +GTKDOC_CFLAGS = \ + $(DBUS_GLIB_CFLAGS) \ + $(GLIB_CFLAGS) \ + -I$(top_srcdir)/src/gudev \ + -I$(top_builddir)/src/gudev + +GTKDOC_LIBS = \ + $(GLIB_LIBS) \ + $(top_builddir)/src/gudev/libgudev-1.0.la + +# This includes the standard gtk-doc make rules, copied by gtkdocize. +include $(top_srcdir)/gtk-doc.make + +# Other files to distribute +# e.g. EXTRA_DIST += version.xml.in +EXTRA_DIST += version.xml.in + +# Files not to distribute +# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types +# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt +#DISTCLEANFILES += + +# Comment this out if you want your docs-status tested during 'make check' +if ENABLE_GTK_DOC +#TESTS_ENVIRONMENT = cd $(srcsrc) +#TESTS = $(GTKDOC_CHECK) +endif diff --git a/src/gudev/docs/gudev-docs.xml b/src/gudev/docs/gudev-docs.xml new file mode 100644 index 0000000000..f876c3bc05 --- /dev/null +++ b/src/gudev/docs/gudev-docs.xml @@ -0,0 +1,93 @@ + + +]> + + + GUDev Reference Manual + For GUdev version &version; + + + David + Zeuthen + +
            + davidz@redhat.com +
            +
            +
            + + Bastien + Nocera + +
            + hadess@hadess.net +
            +
            +
            +
            + + + 2011 + The GUDev Authors + + + + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free + Documentation License, Version 1.1 or any later + version published by the Free Software Foundation with no + Invariant Sections, no Front-Cover Texts, and no Back-Cover + Texts. You may obtain a copy of the GNU Free + Documentation License from the Free Software + Foundation by visiting their Web site or by writing + to: + +
            + The Free Software Foundation, Inc., + 59 Temple Place - Suite 330, + Boston, MA 02111-1307, + USA +
            +
            + + + Many of the names used by companies to distinguish their + products and services are claimed as trademarks. Where those + names appear in any freedesktop.org documentation, and those + trademarks are made aware to the members of the + freedesktop.org Project, the names have been printed in caps + or initial caps. + +
            +
            + + + API Reference + + + This part presents the class and function reference for the + libgudev library. + + + + + + + + + Object Hierarchy + + + + Index + + + Index of new symbols in 165 + + + +
            diff --git a/src/gudev/docs/gudev-sections.txt b/src/gudev/docs/gudev-sections.txt new file mode 100644 index 0000000000..213e1a7465 --- /dev/null +++ b/src/gudev/docs/gudev-sections.txt @@ -0,0 +1,113 @@ +
            +gudevclient +GUdevClient +GUdevClient +GUdevClientClass +GUdevDeviceType +GUdevDeviceNumber +g_udev_client_new +g_udev_client_query_by_subsystem +g_udev_client_query_by_device_number +g_udev_client_query_by_device_file +g_udev_client_query_by_sysfs_path +g_udev_client_query_by_subsystem_and_name + +G_UDEV_CLIENT +G_UDEV_IS_CLIENT +G_UDEV_TYPE_CLIENT +g_udev_client_get_type +G_UDEV_CLIENT_CLASS +G_UDEV_IS_CLIENT_CLASS +G_UDEV_CLIENT_GET_CLASS + +GUdevClientPrivate +
            + +
            +gudevdevice +GUdevDevice +GUdevDevice +GUdevDeviceClass +g_udev_device_get_subsystem +g_udev_device_get_devtype +g_udev_device_get_name +g_udev_device_get_number +g_udev_device_get_sysfs_path +g_udev_device_get_driver +g_udev_device_get_action +g_udev_device_get_seqnum +g_udev_device_get_device_type +g_udev_device_get_device_number +g_udev_device_get_device_file +g_udev_device_get_device_file_symlinks +g_udev_device_get_parent +g_udev_device_get_parent_with_subsystem +g_udev_device_get_tags +g_udev_device_get_is_initialized +g_udev_device_get_usec_since_initialized +g_udev_device_get_property_keys +g_udev_device_has_property +g_udev_device_get_property +g_udev_device_get_property_as_int +g_udev_device_get_property_as_uint64 +g_udev_device_get_property_as_double +g_udev_device_get_property_as_boolean +g_udev_device_get_property_as_strv +g_udev_device_get_sysfs_attr +g_udev_device_get_sysfs_attr_as_int +g_udev_device_get_sysfs_attr_as_uint64 +g_udev_device_get_sysfs_attr_as_double +g_udev_device_get_sysfs_attr_as_boolean +g_udev_device_get_sysfs_attr_as_strv + +G_UDEV_DEVICE +G_UDEV_IS_DEVICE +G_UDEV_TYPE_DEVICE +g_udev_device_get_type +G_UDEV_DEVICE_CLASS +G_UDEV_IS_DEVICE_CLASS +G_UDEV_DEVICE_GET_CLASS + +GUdevDevicePrivate +
            + +
            +gudevenumerator +GUdevEnumerator +GUdevEnumerator +GUdevEnumeratorClass +g_udev_enumerator_new +g_udev_enumerator_add_match_subsystem +g_udev_enumerator_add_nomatch_subsystem +g_udev_enumerator_add_match_sysfs_attr +g_udev_enumerator_add_nomatch_sysfs_attr +g_udev_enumerator_add_match_property +g_udev_enumerator_add_match_name +g_udev_enumerator_add_match_tag +g_udev_enumerator_add_match_is_initialized +g_udev_enumerator_add_sysfs_path +g_udev_enumerator_execute + +G_UDEV_ENUMERATOR +G_UDEV_IS_ENUMERATOR +G_UDEV_TYPE_ENUMERATOR +g_udev_enumerator_get_type +G_UDEV_ENUMERATOR_CLASS +G_UDEV_IS_ENUMERATOR_CLASS +G_UDEV_ENUMERATOR_GET_CLASS + +GUdevEnumeratorPrivate +
            + +
            +gudevmarshal + +g_udev_marshal_VOID__STRING_OBJECT +
            + +
            +gudevenumtypes + +G_TYPE_UDEV_DEVICE_TYPE +g_udev_device_type_get_type +
            diff --git a/src/gudev/docs/gudev.types b/src/gudev/docs/gudev.types new file mode 100644 index 0000000000..a89857a04d --- /dev/null +++ b/src/gudev/docs/gudev.types @@ -0,0 +1,4 @@ +g_udev_device_type_get_type +g_udev_device_get_type +g_udev_client_get_type +g_udev_enumerator_get_type diff --git a/src/gudev/docs/version.xml.in b/src/gudev/docs/version.xml.in new file mode 100644 index 0000000000..d78bda9342 --- /dev/null +++ b/src/gudev/docs/version.xml.in @@ -0,0 +1 @@ +@VERSION@ diff --git a/src/gudev/gjs-example.js b/src/gudev/gjs-example.js new file mode 100755 index 0000000000..5586fd6a61 --- /dev/null +++ b/src/gudev/gjs-example.js @@ -0,0 +1,75 @@ +#!/usr/bin/env gjs-console + +// This currently depends on the following patches to gjs +// +// http://bugzilla.gnome.org/show_bug.cgi?id=584558 +// http://bugzilla.gnome.org/show_bug.cgi?id=584560 +// http://bugzilla.gnome.org/show_bug.cgi?id=584568 + +const GUdev = imports.gi.GUdev; +const Mainloop = imports.mainloop; + +function print_device (device) { + print (" subsystem: " + device.get_subsystem ()); + print (" devtype: " + device.get_devtype ()); + print (" name: " + device.get_name ()); + print (" number: " + device.get_number ()); + print (" sysfs_path: " + device.get_sysfs_path ()); + print (" driver: " + device.get_driver ()); + print (" action: " + device.get_action ()); + print (" seqnum: " + device.get_seqnum ()); + print (" device type: " + device.get_device_type ()); + print (" device number: " + device.get_device_number ()); + print (" device file: " + device.get_device_file ()); + print (" device file symlinks: " + device.get_device_file_symlinks ()); + print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); + var keys = device.get_property_keys (); + for (var n = 0; n < keys.length; n++) { + print (" " + keys[n] + "=" + device.get_property (keys[n])); + } +} + +function on_uevent (client, action, device) { + print ("action " + action + " on device " + device.get_sysfs_path()); + print_device (device); + print (""); +} + +var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); +client.connect ("uevent", on_uevent); + +var block_devices = client.query_by_subsystem ("block"); +for (var n = 0; n < block_devices.length; n++) { + print ("block device: " + block_devices[n].get_device_file ()); +} + +var d; + +d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); +if (d == null) { + print ("query_by_device_number 0x810 -> null"); +} else { + print ("query_by_device_number 0x810 -> " + d.get_device_file ()); + var dd = d.get_parent_with_subsystem ("usb", null); + print_device (dd); + print ("--------------------------------------------------------------------------"); + while (d != null) { + print_device (d); + print (""); + d = d.get_parent (); + } +} + +d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); +print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); + +d = client.query_by_subsystem_and_name ("block", "sda2"); +print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/sda"); +print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/block/8:0"); +print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); + +Mainloop.run('udev-example'); diff --git a/src/gudev/gudev-1.0.pc.in b/src/gudev/gudev-1.0.pc.in new file mode 100644 index 0000000000..058262d767 --- /dev/null +++ b/src/gudev/gudev-1.0.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: gudev-1.0 +Description: GObject bindings for libudev +Version: @VERSION@ +Requires: glib-2.0, gobject-2.0 +Libs: -L${libdir} -lgudev-1.0 +Cflags: -I${includedir}/gudev-1.0 diff --git a/src/gudev/gudev.h b/src/gudev/gudev.h new file mode 100644 index 0000000000..a313460817 --- /dev/null +++ b/src/gudev/gudev.h @@ -0,0 +1,33 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __G_UDEV_H__ +#define __G_UDEV_H__ + +#define _GUDEV_INSIDE_GUDEV_H 1 +#include +#include +#include +#include +#include +#include +#undef _GUDEV_INSIDE_GUDEV_H + +#endif /* __G_UDEV_H__ */ diff --git a/src/gudev/gudevclient.c b/src/gudev/gudevclient.c new file mode 100644 index 0000000000..2b94102ac5 --- /dev/null +++ b/src/gudev/gudevclient.c @@ -0,0 +1,527 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008-2010 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "gudevclient.h" +#include "gudevdevice.h" +#include "gudevmarshal.h" +#include "gudevprivate.h" + +/** + * SECTION:gudevclient + * @short_description: Query devices and listen to uevents + * + * #GUdevClient is used to query information about devices on a Linux + * system from the Linux kernel and the udev device + * manager. + * + * Device information is retrieved from the kernel (through the + * sysfs filesystem) and the udev daemon (through a + * tmpfs filesystem) and presented through + * #GUdevDevice objects. This means that no blocking IO ever happens + * (in both cases, we are essentially just reading data from kernel + * memory) and as such there are no asynchronous versions of the + * provided methods. + * + * To get #GUdevDevice objects, use + * g_udev_client_query_by_subsystem(), + * g_udev_client_query_by_device_number(), + * g_udev_client_query_by_device_file(), + * g_udev_client_query_by_sysfs_path(), + * g_udev_client_query_by_subsystem_and_name() + * or the #GUdevEnumerator type. + * + * To listen to uevents, connect to the #GUdevClient::uevent signal. + */ + +struct _GUdevClientPrivate +{ + GSource *watch_source; + struct udev *udev; + struct udev_monitor *monitor; + + gchar **subsystems; +}; + +enum +{ + PROP_0, + PROP_SUBSYSTEMS, +}; + +enum +{ + UEVENT_SIGNAL, + LAST_SIGNAL, +}; + +static guint signals[LAST_SIGNAL] = { 0 }; + +G_DEFINE_TYPE (GUdevClient, g_udev_client, G_TYPE_OBJECT) + +/* ---------------------------------------------------------------------------------------------------- */ + +static gboolean +monitor_event (GIOChannel *source, + GIOCondition condition, + gpointer data) +{ + GUdevClient *client = (GUdevClient *) data; + GUdevDevice *device; + struct udev_device *udevice; + + if (client->priv->monitor == NULL) + goto out; + udevice = udev_monitor_receive_device (client->priv->monitor); + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + g_signal_emit (client, + signals[UEVENT_SIGNAL], + 0, + g_udev_device_get_action (device), + device); + g_object_unref (device); + + out: + return TRUE; +} + +static void +g_udev_client_finalize (GObject *object) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + + if (client->priv->watch_source != NULL) + { + g_source_destroy (client->priv->watch_source); + client->priv->watch_source = NULL; + } + + if (client->priv->monitor != NULL) + { + udev_monitor_unref (client->priv->monitor); + client->priv->monitor = NULL; + } + + if (client->priv->udev != NULL) + { + udev_unref (client->priv->udev); + client->priv->udev = NULL; + } + + g_strfreev (client->priv->subsystems); + + if (G_OBJECT_CLASS (g_udev_client_parent_class)->finalize != NULL) + G_OBJECT_CLASS (g_udev_client_parent_class)->finalize (object); +} + +static void +g_udev_client_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + + switch (prop_id) + { + case PROP_SUBSYSTEMS: + if (client->priv->subsystems != NULL) + g_strfreev (client->priv->subsystems); + client->priv->subsystems = g_strdupv (g_value_get_boxed (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_client_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + + switch (prop_id) + { + case PROP_SUBSYSTEMS: + g_value_set_boxed (value, client->priv->subsystems); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_client_constructed (GObject *object) +{ + GUdevClient *client = G_UDEV_CLIENT (object); + GIOChannel *channel; + guint n; + + client->priv->udev = udev_new (); + + /* connect to event source */ + client->priv->monitor = udev_monitor_new_from_netlink (client->priv->udev, "udev"); + + //g_debug ("ss = %p", client->priv->subsystems); + + if (client->priv->subsystems != NULL) + { + /* install subsystem filters to only wake up for certain events */ + for (n = 0; client->priv->subsystems[n] != NULL; n++) + { + gchar *subsystem; + gchar *devtype; + gchar *s; + + subsystem = g_strdup (client->priv->subsystems[n]); + devtype = NULL; + + //g_debug ("s = '%s'", subsystem); + + s = strstr (subsystem, "/"); + if (s != NULL) + { + devtype = s + 1; + *s = '\0'; + } + + if (client->priv->monitor != NULL) + udev_monitor_filter_add_match_subsystem_devtype (client->priv->monitor, subsystem, devtype); + + g_free (subsystem); + } + + /* listen to events, and buffer them */ + if (client->priv->monitor != NULL) + { + udev_monitor_enable_receiving (client->priv->monitor); + channel = g_io_channel_unix_new (udev_monitor_get_fd (client->priv->monitor)); + client->priv->watch_source = g_io_create_watch (channel, G_IO_IN); + g_io_channel_unref (channel); + g_source_set_callback (client->priv->watch_source, (GSourceFunc) monitor_event, client, NULL); + g_source_attach (client->priv->watch_source, g_main_context_get_thread_default ()); + g_source_unref (client->priv->watch_source); + } + else + { + client->priv->watch_source = NULL; + } + } + + if (G_OBJECT_CLASS (g_udev_client_parent_class)->constructed != NULL) + G_OBJECT_CLASS (g_udev_client_parent_class)->constructed (object); +} + + +static void +g_udev_client_class_init (GUdevClientClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->constructed = g_udev_client_constructed; + gobject_class->set_property = g_udev_client_set_property; + gobject_class->get_property = g_udev_client_get_property; + gobject_class->finalize = g_udev_client_finalize; + + /** + * GUdevClient:subsystems: + * + * The subsystems to listen for uevents on. + * + * To listen for only a specific DEVTYPE for a given SUBSYSTEM, use + * "subsystem/devtype". For example, to only listen for uevents + * where SUBSYSTEM is usb and DEVTYPE is usb_interface, use + * "usb/usb_interface". + * + * If this property is %NULL, then no events will be reported. If + * it's the empty array, events from all subsystems will be + * reported. + */ + g_object_class_install_property (gobject_class, + PROP_SUBSYSTEMS, + g_param_spec_boxed ("subsystems", + "The subsystems to listen for changes on", + "The subsystems to listen for changes on", + G_TYPE_STRV, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE)); + + /** + * GUdevClient::uevent: + * @client: The #GUdevClient receiving the event. + * @action: The action for the uevent e.g. "add", "remove", "change", "move", etc. + * @device: Details about the #GUdevDevice the event is for. + * + * Emitted when @client receives an uevent. + * + * This signal is emitted in the + * thread-default main loop + * of the thread that @client was created in. + */ + signals[UEVENT_SIGNAL] = g_signal_new ("uevent", + G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (GUdevClientClass, uevent), + NULL, + NULL, + g_udev_marshal_VOID__STRING_OBJECT, + G_TYPE_NONE, + 2, + G_TYPE_STRING, + G_UDEV_TYPE_DEVICE); + + g_type_class_add_private (klass, sizeof (GUdevClientPrivate)); +} + +static void +g_udev_client_init (GUdevClient *client) +{ + client->priv = G_TYPE_INSTANCE_GET_PRIVATE (client, + G_UDEV_TYPE_CLIENT, + GUdevClientPrivate); +} + +/** + * g_udev_client_new: + * @subsystems: (array zero-terminated=1) (element-type utf8) (transfer none) (allow-none): A %NULL terminated string array of subsystems to listen for uevents on, %NULL to not listen on uevents at all, or an empty array to listen to uevents on all subsystems. See the documentation for the #GUdevClient:subsystems property for details on this parameter. + * + * Constructs a #GUdevClient object that can be used to query + * information about devices. Connect to the #GUdevClient::uevent + * signal to listen for uevents. Note that signals are emitted in the + * thread-default main loop + * of the thread that you call this constructor from. + * + * Returns: A new #GUdevClient object. Free with g_object_unref(). + */ +GUdevClient * +g_udev_client_new (const gchar * const *subsystems) +{ + return G_UDEV_CLIENT (g_object_new (G_UDEV_TYPE_CLIENT, "subsystems", subsystems, NULL)); +} + +/** + * g_udev_client_query_by_subsystem: + * @client: A #GUdevClient. + * @subsystem: (allow-none): The subsystem to get devices for or %NULL to get all devices. + * + * Gets all devices belonging to @subsystem. + * + * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. + */ +GList * +g_udev_client_query_by_subsystem (GUdevClient *client, + const gchar *subsystem) +{ + struct udev_enumerate *enumerate; + struct udev_list_entry *l, *devices; + GList *ret; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + + ret = NULL; + + /* prepare a device scan */ + enumerate = udev_enumerate_new (client->priv->udev); + + /* filter for subsystem */ + if (subsystem != NULL) + udev_enumerate_add_match_subsystem (enumerate, subsystem); + /* retrieve the list */ + udev_enumerate_scan_devices (enumerate); + + /* add devices to the list */ + devices = udev_enumerate_get_list_entry (enumerate); + for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) + { + struct udev_device *udevice; + GUdevDevice *device; + + udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerate), + udev_list_entry_get_name (l)); + if (udevice == NULL) + continue; + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + ret = g_list_prepend (ret, device); + } + udev_enumerate_unref (enumerate); + + ret = g_list_reverse (ret); + + return ret; +} + +/** + * g_udev_client_query_by_device_number: + * @client: A #GUdevClient. + * @type: A value from the #GUdevDeviceType enumeration. + * @number: A device number. + * + * Looks up a device for a type and device number. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_device_number (GUdevClient *client, + GUdevDeviceType type, + GUdevDeviceNumber number) +{ + struct udev_device *udevice; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + + device = NULL; + udevice = udev_device_new_from_devnum (client->priv->udev, type, number); + + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + + out: + return device; +} + +/** + * g_udev_client_query_by_device_file: + * @client: A #GUdevClient. + * @device_file: A device file. + * + * Looks up a device for a device file. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_device_file (GUdevClient *client, + const gchar *device_file) +{ + struct stat stat_buf; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + g_return_val_if_fail (device_file != NULL, NULL); + + device = NULL; + + if (stat (device_file, &stat_buf) != 0) + goto out; + + if (stat_buf.st_rdev == 0) + goto out; + + if (S_ISBLK (stat_buf.st_mode)) + device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_BLOCK, stat_buf.st_rdev); + else if (S_ISCHR (stat_buf.st_mode)) + device = g_udev_client_query_by_device_number (client, G_UDEV_DEVICE_TYPE_CHAR, stat_buf.st_rdev); + + out: + return device; +} + +/** + * g_udev_client_query_by_sysfs_path: + * @client: A #GUdevClient. + * @sysfs_path: A sysfs path. + * + * Looks up a device for a sysfs path. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_sysfs_path (GUdevClient *client, + const gchar *sysfs_path) +{ + struct udev_device *udevice; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + g_return_val_if_fail (sysfs_path != NULL, NULL); + + device = NULL; + udevice = udev_device_new_from_syspath (client->priv->udev, sysfs_path); + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + + out: + return device; +} + +/** + * g_udev_client_query_by_subsystem_and_name: + * @client: A #GUdevClient. + * @subsystem: A subsystem name. + * @name: The name of the device. + * + * Looks up a device for a subsystem and name. + * + * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_client_query_by_subsystem_and_name (GUdevClient *client, + const gchar *subsystem, + const gchar *name) +{ + struct udev_device *udevice; + GUdevDevice *device; + + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + g_return_val_if_fail (name != NULL, NULL); + + device = NULL; + udevice = udev_device_new_from_subsystem_sysname (client->priv->udev, subsystem, name); + if (udevice == NULL) + goto out; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + + out: + return device; +} + +struct udev * +_g_udev_client_get_udev (GUdevClient *client) +{ + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + return client->priv->udev; +} diff --git a/src/gudev/gudevclient.h b/src/gudev/gudevclient.h new file mode 100644 index 0000000000..b425d03d48 --- /dev/null +++ b/src/gudev/gudevclient.h @@ -0,0 +1,100 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_CLIENT_H__ +#define __G_UDEV_CLIENT_H__ + +#include + +G_BEGIN_DECLS + +#define G_UDEV_TYPE_CLIENT (g_udev_client_get_type ()) +#define G_UDEV_CLIENT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_CLIENT, GUdevClient)) +#define G_UDEV_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_CLIENT, GUdevClientClass)) +#define G_UDEV_IS_CLIENT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_CLIENT)) +#define G_UDEV_IS_CLIENT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_CLIENT)) +#define G_UDEV_CLIENT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_CLIENT, GUdevClientClass)) + +typedef struct _GUdevClientClass GUdevClientClass; +typedef struct _GUdevClientPrivate GUdevClientPrivate; + +/** + * GUdevClient: + * + * The #GUdevClient struct is opaque and should not be accessed directly. + */ +struct _GUdevClient +{ + GObject parent; + + /*< private >*/ + GUdevClientPrivate *priv; +}; + +/** + * GUdevClientClass: + * @parent_class: Parent class. + * @uevent: Signal class handler for the #GUdevClient::uevent signal. + * + * Class structure for #GUdevClient. + */ +struct _GUdevClientClass +{ + GObjectClass parent_class; + + /* signals */ + void (*uevent) (GUdevClient *client, + const gchar *action, + GUdevDevice *device); + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); + void (*reserved7) (void); + void (*reserved8) (void); +}; + +GType g_udev_client_get_type (void) G_GNUC_CONST; +GUdevClient *g_udev_client_new (const gchar* const *subsystems); +GList *g_udev_client_query_by_subsystem (GUdevClient *client, + const gchar *subsystem); +GUdevDevice *g_udev_client_query_by_device_number (GUdevClient *client, + GUdevDeviceType type, + GUdevDeviceNumber number); +GUdevDevice *g_udev_client_query_by_device_file (GUdevClient *client, + const gchar *device_file); +GUdevDevice *g_udev_client_query_by_sysfs_path (GUdevClient *client, + const gchar *sysfs_path); +GUdevDevice *g_udev_client_query_by_subsystem_and_name (GUdevClient *client, + const gchar *subsystem, + const gchar *name); + +G_END_DECLS + +#endif /* __G_UDEV_CLIENT_H__ */ diff --git a/src/gudev/gudevdevice.c b/src/gudev/gudevdevice.c new file mode 100644 index 0000000000..62a26f99b7 --- /dev/null +++ b/src/gudev/gudevdevice.c @@ -0,0 +1,963 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "gudevdevice.h" +#include "gudevprivate.h" + +/** + * SECTION:gudevdevice + * @short_description: Get information about a device + * + * The #GUdevDevice class is used to get information about a specific + * device. Note that you cannot instantiate a #GUdevDevice object + * yourself. Instead you must use #GUdevClient to obtain #GUdevDevice + * objects. + * + * To get basic information about a device, use + * g_udev_device_get_subsystem(), g_udev_device_get_devtype(), + * g_udev_device_get_name(), g_udev_device_get_number(), + * g_udev_device_get_sysfs_path(), g_udev_device_get_driver(), + * g_udev_device_get_action(), g_udev_device_get_seqnum(), + * g_udev_device_get_device_type(), g_udev_device_get_device_number(), + * g_udev_device_get_device_file(), + * g_udev_device_get_device_file_symlinks(). + * + * To navigate the device tree, use g_udev_device_get_parent() and + * g_udev_device_get_parent_with_subsystem(). + * + * To access udev properties for the device, use + * g_udev_device_get_property_keys(), + * g_udev_device_has_property(), + * g_udev_device_get_property(), + * g_udev_device_get_property_as_int(), + * g_udev_device_get_property_as_uint64(), + * g_udev_device_get_property_as_double(), + * g_udev_device_get_property_as_boolean() and + * g_udev_device_get_property_as_strv(). + * + * To access sysfs attributes for the device, use + * g_udev_device_get_sysfs_attr(), + * g_udev_device_get_sysfs_attr_as_int(), + * g_udev_device_get_sysfs_attr_as_uint64(), + * g_udev_device_get_sysfs_attr_as_double(), + * g_udev_device_get_sysfs_attr_as_boolean() and + * g_udev_device_get_sysfs_attr_as_strv(). + * + * Note that all getters on #GUdevDevice are non-reffing – returned + * values are owned by the object, should not be freed and are only + * valid as long as the object is alive. + * + * By design, #GUdevDevice will not react to changes for a device – it + * only contains a snapshot of information when the #GUdevDevice + * object was created. To work with changes, you typically connect to + * the #GUdevClient::uevent signal on a #GUdevClient and get a new + * #GUdevDevice whenever an event happens. + */ + +struct _GUdevDevicePrivate +{ + struct udev_device *udevice; + + /* computed ondemand and cached */ + gchar **device_file_symlinks; + gchar **property_keys; + gchar **tags; + GHashTable *prop_strvs; + GHashTable *sysfs_attr_strvs; +}; + +G_DEFINE_TYPE (GUdevDevice, g_udev_device, G_TYPE_OBJECT) + +static void +g_udev_device_finalize (GObject *object) +{ + GUdevDevice *device = G_UDEV_DEVICE (object); + + g_strfreev (device->priv->device_file_symlinks); + g_strfreev (device->priv->property_keys); + g_strfreev (device->priv->tags); + + if (device->priv->udevice != NULL) + udev_device_unref (device->priv->udevice); + + if (device->priv->prop_strvs != NULL) + g_hash_table_unref (device->priv->prop_strvs); + + if (device->priv->sysfs_attr_strvs != NULL) + g_hash_table_unref (device->priv->sysfs_attr_strvs); + + if (G_OBJECT_CLASS (g_udev_device_parent_class)->finalize != NULL) + (* G_OBJECT_CLASS (g_udev_device_parent_class)->finalize) (object); +} + +static void +g_udev_device_class_init (GUdevDeviceClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->finalize = g_udev_device_finalize; + + g_type_class_add_private (klass, sizeof (GUdevDevicePrivate)); +} + +static void +g_udev_device_init (GUdevDevice *device) +{ + device->priv = G_TYPE_INSTANCE_GET_PRIVATE (device, + G_UDEV_TYPE_DEVICE, + GUdevDevicePrivate); +} + + +GUdevDevice * +_g_udev_device_new (struct udev_device *udevice) +{ + GUdevDevice *device; + + device = G_UDEV_DEVICE (g_object_new (G_UDEV_TYPE_DEVICE, NULL)); + device->priv->udevice = udev_device_ref (udevice); + + return device; +} + +/** + * g_udev_device_get_subsystem: + * @device: A #GUdevDevice. + * + * Gets the subsystem for @device. + * + * Returns: The subsystem for @device. + */ +const gchar * +g_udev_device_get_subsystem (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_subsystem (device->priv->udevice); +} + +/** + * g_udev_device_get_devtype: + * @device: A #GUdevDevice. + * + * Gets the device type for @device. + * + * Returns: The devtype for @device. + */ +const gchar * +g_udev_device_get_devtype (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_devtype (device->priv->udevice); +} + +/** + * g_udev_device_get_name: + * @device: A #GUdevDevice. + * + * Gets the name of @device, e.g. "sda3". + * + * Returns: The name of @device. + */ +const gchar * +g_udev_device_get_name (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_sysname (device->priv->udevice); +} + +/** + * g_udev_device_get_number: + * @device: A #GUdevDevice. + * + * Gets the number of @device, e.g. "3" if g_udev_device_get_name() returns "sda3". + * + * Returns: The number of @device. + */ +const gchar * +g_udev_device_get_number (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_sysnum (device->priv->udevice); +} + +/** + * g_udev_device_get_sysfs_path: + * @device: A #GUdevDevice. + * + * Gets the sysfs path for @device. + * + * Returns: The sysfs path for @device. + */ +const gchar * +g_udev_device_get_sysfs_path (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_syspath (device->priv->udevice); +} + +/** + * g_udev_device_get_driver: + * @device: A #GUdevDevice. + * + * Gets the name of the driver used for @device. + * + * Returns: The name of the driver for @device or %NULL if unknown. + */ +const gchar * +g_udev_device_get_driver (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_driver (device->priv->udevice); +} + +/** + * g_udev_device_get_action: + * @device: A #GUdevDevice. + * + * Gets the most recent action (e.g. "add", "remove", "change", etc.) for @device. + * + * Returns: An action string. + */ +const gchar * +g_udev_device_get_action (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_action (device->priv->udevice); +} + +/** + * g_udev_device_get_seqnum: + * @device: A #GUdevDevice. + * + * Gets the most recent sequence number for @device. + * + * Returns: A sequence number. + */ +guint64 +g_udev_device_get_seqnum (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_seqnum (device->priv->udevice); +} + +/** + * g_udev_device_get_device_type: + * @device: A #GUdevDevice. + * + * Gets the type of the device file, if any, for @device. + * + * Returns: The device number for @device or #G_UDEV_DEVICE_TYPE_NONE if the device does not have a device file. + */ +GUdevDeviceType +g_udev_device_get_device_type (GUdevDevice *device) +{ + struct stat stat_buf; + const gchar *device_file; + GUdevDeviceType type; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), G_UDEV_DEVICE_TYPE_NONE); + + type = G_UDEV_DEVICE_TYPE_NONE; + + /* TODO: would be better to have support for this in libudev... */ + + device_file = g_udev_device_get_device_file (device); + if (device_file == NULL) + goto out; + + if (stat (device_file, &stat_buf) != 0) + goto out; + + if (S_ISBLK (stat_buf.st_mode)) + type = G_UDEV_DEVICE_TYPE_BLOCK; + else if (S_ISCHR (stat_buf.st_mode)) + type = G_UDEV_DEVICE_TYPE_CHAR; + + out: + return type; +} + +/** + * g_udev_device_get_device_number: + * @device: A #GUdevDevice. + * + * Gets the device number, if any, for @device. + * + * Returns: The device number for @device or 0 if unknown. + */ +GUdevDeviceNumber +g_udev_device_get_device_number (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_devnum (device->priv->udevice); +} + +/** + * g_udev_device_get_device_file: + * @device: A #GUdevDevice. + * + * Gets the device file for @device. + * + * Returns: The device file for @device or %NULL if no device file + * exists. + */ +const gchar * +g_udev_device_get_device_file (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + return udev_device_get_devnode (device->priv->udevice); +} + +/** + * g_udev_device_get_device_file_symlinks: + * @device: A #GUdevDevice. + * + * Gets a list of symlinks (in /dev) that points to + * the device file for @device. + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of symlinks. This array is owned by @device and should not be freed by the caller. + */ +const gchar * const * +g_udev_device_get_device_file_symlinks (GUdevDevice *device) +{ + struct udev_list_entry *l; + GPtrArray *p; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + if (device->priv->device_file_symlinks != NULL) + goto out; + + p = g_ptr_array_new (); + for (l = udev_device_get_devlinks_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) + { + g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); + } + g_ptr_array_add (p, NULL); + device->priv->device_file_symlinks = (gchar **) g_ptr_array_free (p, FALSE); + + out: + return (const gchar * const *) device->priv->device_file_symlinks; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * g_udev_device_get_parent: + * @device: A #GUdevDevice. + * + * Gets the immediate parent of @device, if any. + * + * Returns: (transfer full): A #GUdevDevice or %NULL if @device has no parent. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_device_get_parent (GUdevDevice *device) +{ + GUdevDevice *ret; + struct udev_device *udevice; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + ret = NULL; + + udevice = udev_device_get_parent (device->priv->udevice); + if (udevice == NULL) + goto out; + + ret = _g_udev_device_new (udevice); + + out: + return ret; +} + +/** + * g_udev_device_get_parent_with_subsystem: + * @device: A #GUdevDevice. + * @subsystem: The subsystem of the parent to get. + * @devtype: (allow-none): The devtype of the parent to get or %NULL. + * + * Walks up the chain of parents of @device and returns the first + * device encountered where @subsystem and @devtype matches, if any. + * + * Returns: (transfer full): A #GUdevDevice or %NULL if @device has no parent with @subsystem and @devtype. Free with g_object_unref(). + */ +GUdevDevice * +g_udev_device_get_parent_with_subsystem (GUdevDevice *device, + const gchar *subsystem, + const gchar *devtype) +{ + GUdevDevice *ret; + struct udev_device *udevice; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + + ret = NULL; + + udevice = udev_device_get_parent_with_subsystem_devtype (device->priv->udevice, + subsystem, + devtype); + if (udevice == NULL) + goto out; + + ret = _g_udev_device_new (udevice); + + out: + return ret; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * g_udev_device_get_property_keys: + * @device: A #GUdevDevice. + * + * Gets all keys for properties on @device. + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of property keys. This array is owned by @device and should not be freed by the caller. + */ +const gchar* const * +g_udev_device_get_property_keys (GUdevDevice *device) +{ + struct udev_list_entry *l; + GPtrArray *p; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + if (device->priv->property_keys != NULL) + goto out; + + p = g_ptr_array_new (); + for (l = udev_device_get_properties_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) + { + g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); + } + g_ptr_array_add (p, NULL); + device->priv->property_keys = (gchar **) g_ptr_array_free (p, FALSE); + + out: + return (const gchar * const *) device->priv->property_keys; +} + + +/** + * g_udev_device_has_property: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Check if a the property with the given key exists. + * + * Returns: %TRUE only if the value for @key exist. + */ +gboolean +g_udev_device_has_property (GUdevDevice *device, + const gchar *key) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + g_return_val_if_fail (key != NULL, FALSE); + return udev_device_get_property_value (device->priv->udevice, key) != NULL; +} + +/** + * g_udev_device_get_property: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device. + * + * Returns: The value for @key or %NULL if @key doesn't exist on @device. Do not free this string, it is owned by @device. + */ +const gchar * +g_udev_device_get_property (GUdevDevice *device, + const gchar *key) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (key != NULL, NULL); + return udev_device_get_property_value (device->priv->udevice, key); +} + +/** + * g_udev_device_get_property_as_int: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to an integer + * using strtol(). + * + * Returns: The value for @key or 0 if @key doesn't exist or + * isn't an integer. + */ +gint +g_udev_device_get_property_as_int (GUdevDevice *device, + const gchar *key) +{ + gint result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (key != NULL, 0); + + result = 0; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = strtol (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_property_as_uint64: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to an unsigned + * 64-bit integer using g_ascii_strtoull(). + * + * Returns: The value for @key or 0 if @key doesn't exist or isn't a + * #guint64. + */ +guint64 +g_udev_device_get_property_as_uint64 (GUdevDevice *device, + const gchar *key) +{ + guint64 result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (key != NULL, 0); + + result = 0; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = g_ascii_strtoull (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_property_as_double: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to a double + * precision floating point number using strtod(). + * + * Returns: The value for @key or 0.0 if @key doesn't exist or isn't a + * #gdouble. + */ +gdouble +g_udev_device_get_property_as_double (GUdevDevice *device, + const gchar *key) +{ + gdouble result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); + g_return_val_if_fail (key != NULL, 0.0); + + result = 0.0; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = strtod (s, NULL); +out: + return result; +} + +/** + * g_udev_device_get_property_as_boolean: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and convert it to an + * boolean. This is done by doing a case-insensitive string comparison + * on the string value against "1" and "true". + * + * Returns: The value for @key or %FALSE if @key doesn't exist or + * isn't a #gboolean. + */ +gboolean +g_udev_device_get_property_as_boolean (GUdevDevice *device, + const gchar *key) +{ + gboolean result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + g_return_val_if_fail (key != NULL, FALSE); + + result = FALSE; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) + result = TRUE; + out: + return result; +} + +static gchar ** +split_at_whitespace (const gchar *s) +{ + gchar **result; + guint n; + guint m; + + result = g_strsplit_set (s, " \v\t\r\n", 0); + + /* remove empty strings, thanks GLib */ + for (n = 0; result[n] != NULL; n++) + { + if (strlen (result[n]) == 0) + { + g_free (result[n]); + for (m = n; result[m] != NULL; m++) + result[m] = result[m + 1]; + n--; + } + } + + return result; +} + +/** + * g_udev_device_get_property_as_strv: + * @device: A #GUdevDevice. + * @key: Name of property. + * + * Look up the value for @key on @device and return the result of + * splitting it into non-empty tokens split at white space (only space + * (' '), form-feed ('\f'), newline ('\n'), carriage return ('\r'), + * horizontal tab ('\t'), and vertical tab ('\v') are considered; the + * locale is not taken into account). + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of @key on @device split into tokens or %NULL if @key doesn't exist. This array is owned by @device and should not be freed by the caller. + */ +const gchar* const * +g_udev_device_get_property_as_strv (GUdevDevice *device, + const gchar *key) +{ + gchar **result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (key != NULL, NULL); + + if (device->priv->prop_strvs != NULL) + { + result = g_hash_table_lookup (device->priv->prop_strvs, key); + if (result != NULL) + goto out; + } + + result = NULL; + s = g_udev_device_get_property (device, key); + if (s == NULL) + goto out; + + result = split_at_whitespace (s); + if (result == NULL) + goto out; + + if (device->priv->prop_strvs == NULL) + device->priv->prop_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); + g_hash_table_insert (device->priv->prop_strvs, g_strdup (key), result); + +out: + return (const gchar* const *) result; +} + +/* ---------------------------------------------------------------------------------------------------- */ + +/** + * g_udev_device_get_sysfs_attr: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device. + * + * Returns: The value of the sysfs attribute or %NULL if there is no + * such attribute. Do not free this string, it is owned by @device. + */ +const gchar * +g_udev_device_get_sysfs_attr (GUdevDevice *device, + const gchar *name) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (name != NULL, NULL); + return udev_device_get_sysattr_value (device->priv->udevice, name); +} + +/** + * g_udev_device_get_sysfs_attr_as_int: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to an integer + * using strtol(). + * + * Returns: The value of the sysfs attribute or 0 if there is no such + * attribute. + */ +gint +g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, + const gchar *name) +{ + gint result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (name != NULL, 0); + + result = 0; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = strtol (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_uint64: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to an unsigned + * 64-bit integer using g_ascii_strtoull(). + * + * Returns: The value of the sysfs attribute or 0 if there is no such + * attribute. + */ +guint64 +g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, + const gchar *name) +{ + guint64 result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + g_return_val_if_fail (name != NULL, 0); + + result = 0; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = g_ascii_strtoull (s, NULL, 0); +out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_double: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to a double + * precision floating point number using strtod(). + * + * Returns: The value of the sysfs attribute or 0.0 if there is no such + * attribute. + */ +gdouble +g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, + const gchar *name) +{ + gdouble result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0.0); + g_return_val_if_fail (name != NULL, 0.0); + + result = 0.0; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = strtod (s, NULL); +out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_boolean: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and convert it to an + * boolean. This is done by doing a case-insensitive string comparison + * on the string value against "1" and "true". + * + * Returns: The value of the sysfs attribute or %FALSE if there is no such + * attribute. + */ +gboolean +g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, + const gchar *name) +{ + gboolean result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + g_return_val_if_fail (name != NULL, FALSE); + + result = FALSE; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + if (strcmp (s, "1") == 0 || g_ascii_strcasecmp (s, "true") == 0) + result = TRUE; + out: + return result; +} + +/** + * g_udev_device_get_sysfs_attr_as_strv: + * @device: A #GUdevDevice. + * @name: Name of the sysfs attribute. + * + * Look up the sysfs attribute with @name on @device and return the result of + * splitting it into non-empty tokens split at white space (only space (' '), + * form-feed ('\f'), newline ('\n'), carriage return ('\r'), horizontal + * tab ('\t'), and vertical tab ('\v') are considered; the locale is + * not taken into account). + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of the sysfs attribute split into tokens or %NULL if there is no such attribute. This array is owned by @device and should not be freed by the caller. + */ +const gchar * const * +g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, + const gchar *name) +{ + gchar **result; + const gchar *s; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + g_return_val_if_fail (name != NULL, NULL); + + if (device->priv->sysfs_attr_strvs != NULL) + { + result = g_hash_table_lookup (device->priv->sysfs_attr_strvs, name); + if (result != NULL) + goto out; + } + + result = NULL; + s = g_udev_device_get_sysfs_attr (device, name); + if (s == NULL) + goto out; + + result = split_at_whitespace (s); + if (result == NULL) + goto out; + + if (device->priv->sysfs_attr_strvs == NULL) + device->priv->sysfs_attr_strvs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_strfreev); + g_hash_table_insert (device->priv->sysfs_attr_strvs, g_strdup (name), result); + +out: + return (const gchar* const *) result; +} + +/** + * g_udev_device_get_tags: + * @device: A #GUdevDevice. + * + * Gets all tags for @device. + * + * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): A %NULL terminated string array of tags. This array is owned by @device and should not be freed by the caller. + * + * Since: 165 + */ +const gchar* const * +g_udev_device_get_tags (GUdevDevice *device) +{ + struct udev_list_entry *l; + GPtrArray *p; + + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), NULL); + + if (device->priv->tags != NULL) + goto out; + + p = g_ptr_array_new (); + for (l = udev_device_get_tags_list_entry (device->priv->udevice); l != NULL; l = udev_list_entry_get_next (l)) + { + g_ptr_array_add (p, g_strdup (udev_list_entry_get_name (l))); + } + g_ptr_array_add (p, NULL); + device->priv->tags = (gchar **) g_ptr_array_free (p, FALSE); + + out: + return (const gchar * const *) device->priv->tags; +} + +/** + * g_udev_device_get_is_initialized: + * @device: A #GUdevDevice. + * + * Gets whether @device has been initalized. + * + * Returns: Whether @device has been initialized. + * + * Since: 165 + */ +gboolean +g_udev_device_get_is_initialized (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); + return udev_device_get_is_initialized (device->priv->udevice); +} + +/** + * g_udev_device_get_usec_since_initialized: + * @device: A #GUdevDevice. + * + * Gets number of micro-seconds since @device was initialized. + * + * This only works for devices with properties in the udev + * database. All other devices return 0. + * + * Returns: Number of micro-seconds since @device was initialized or 0 if unknown. + * + * Since: 165 + */ +guint64 +g_udev_device_get_usec_since_initialized (GUdevDevice *device) +{ + g_return_val_if_fail (G_UDEV_IS_DEVICE (device), 0); + return udev_device_get_usec_since_initialized (device->priv->udevice); +} diff --git a/src/gudev/gudevdevice.h b/src/gudev/gudevdevice.h new file mode 100644 index 0000000000..d4873bad0f --- /dev/null +++ b/src/gudev/gudevdevice.h @@ -0,0 +1,128 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_DEVICE_H__ +#define __G_UDEV_DEVICE_H__ + +#include + +G_BEGIN_DECLS + +#define G_UDEV_TYPE_DEVICE (g_udev_device_get_type ()) +#define G_UDEV_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_DEVICE, GUdevDevice)) +#define G_UDEV_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) +#define G_UDEV_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_DEVICE)) +#define G_UDEV_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_DEVICE)) +#define G_UDEV_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_DEVICE, GUdevDeviceClass)) + +typedef struct _GUdevDeviceClass GUdevDeviceClass; +typedef struct _GUdevDevicePrivate GUdevDevicePrivate; + +/** + * GUdevDevice: + * + * The #GUdevDevice struct is opaque and should not be accessed directly. + */ +struct _GUdevDevice +{ + GObject parent; + + /*< private >*/ + GUdevDevicePrivate *priv; +}; + +/** + * GUdevDeviceClass: + * @parent_class: Parent class. + * + * Class structure for #GUdevDevice. + */ +struct _GUdevDeviceClass +{ + GObjectClass parent_class; + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); + void (*reserved7) (void); + void (*reserved8) (void); +}; + +GType g_udev_device_get_type (void) G_GNUC_CONST; +gboolean g_udev_device_get_is_initialized (GUdevDevice *device); +guint64 g_udev_device_get_usec_since_initialized (GUdevDevice *device); +const gchar *g_udev_device_get_subsystem (GUdevDevice *device); +const gchar *g_udev_device_get_devtype (GUdevDevice *device); +const gchar *g_udev_device_get_name (GUdevDevice *device); +const gchar *g_udev_device_get_number (GUdevDevice *device); +const gchar *g_udev_device_get_sysfs_path (GUdevDevice *device); +const gchar *g_udev_device_get_driver (GUdevDevice *device); +const gchar *g_udev_device_get_action (GUdevDevice *device); +guint64 g_udev_device_get_seqnum (GUdevDevice *device); +GUdevDeviceType g_udev_device_get_device_type (GUdevDevice *device); +GUdevDeviceNumber g_udev_device_get_device_number (GUdevDevice *device); +const gchar *g_udev_device_get_device_file (GUdevDevice *device); +const gchar* const *g_udev_device_get_device_file_symlinks (GUdevDevice *device); +GUdevDevice *g_udev_device_get_parent (GUdevDevice *device); +GUdevDevice *g_udev_device_get_parent_with_subsystem (GUdevDevice *device, + const gchar *subsystem, + const gchar *devtype); +const gchar* const *g_udev_device_get_property_keys (GUdevDevice *device); +gboolean g_udev_device_has_property (GUdevDevice *device, + const gchar *key); +const gchar *g_udev_device_get_property (GUdevDevice *device, + const gchar *key); +gint g_udev_device_get_property_as_int (GUdevDevice *device, + const gchar *key); +guint64 g_udev_device_get_property_as_uint64 (GUdevDevice *device, + const gchar *key); +gdouble g_udev_device_get_property_as_double (GUdevDevice *device, + const gchar *key); +gboolean g_udev_device_get_property_as_boolean (GUdevDevice *device, + const gchar *key); +const gchar* const *g_udev_device_get_property_as_strv (GUdevDevice *device, + const gchar *key); + +const gchar *g_udev_device_get_sysfs_attr (GUdevDevice *device, + const gchar *name); +gint g_udev_device_get_sysfs_attr_as_int (GUdevDevice *device, + const gchar *name); +guint64 g_udev_device_get_sysfs_attr_as_uint64 (GUdevDevice *device, + const gchar *name); +gdouble g_udev_device_get_sysfs_attr_as_double (GUdevDevice *device, + const gchar *name); +gboolean g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, + const gchar *name); +const gchar* const *g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, + const gchar *name); +const gchar* const *g_udev_device_get_tags (GUdevDevice *device); + +G_END_DECLS + +#endif /* __G_UDEV_DEVICE_H__ */ diff --git a/src/gudev/gudevenumerator.c b/src/gudev/gudevenumerator.c new file mode 100644 index 0000000000..db09074625 --- /dev/null +++ b/src/gudev/gudevenumerator.c @@ -0,0 +1,431 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008-2010 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include +#include + +#include "gudevclient.h" +#include "gudevenumerator.h" +#include "gudevdevice.h" +#include "gudevmarshal.h" +#include "gudevprivate.h" + +/** + * SECTION:gudevenumerator + * @short_description: Lookup and sort devices + * + * #GUdevEnumerator is used to lookup and sort devices. + * + * Since: 165 + */ + +struct _GUdevEnumeratorPrivate +{ + GUdevClient *client; + struct udev_enumerate *e; +}; + +enum +{ + PROP_0, + PROP_CLIENT, +}; + +G_DEFINE_TYPE (GUdevEnumerator, g_udev_enumerator, G_TYPE_OBJECT) + +/* ---------------------------------------------------------------------------------------------------- */ + +static void +g_udev_enumerator_finalize (GObject *object) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + if (enumerator->priv->client != NULL) + { + g_object_unref (enumerator->priv->client); + enumerator->priv->client = NULL; + } + + if (enumerator->priv->e != NULL) + { + udev_enumerate_unref (enumerator->priv->e); + enumerator->priv->e = NULL; + } + + if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize != NULL) + G_OBJECT_CLASS (g_udev_enumerator_parent_class)->finalize (object); +} + +static void +g_udev_enumerator_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + switch (prop_id) + { + case PROP_CLIENT: + if (enumerator->priv->client != NULL) + g_object_unref (enumerator->priv->client); + enumerator->priv->client = g_value_dup_object (value); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_enumerator_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + switch (prop_id) + { + case PROP_CLIENT: + g_value_set_object (value, enumerator->priv->client); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +g_udev_enumerator_constructed (GObject *object) +{ + GUdevEnumerator *enumerator = G_UDEV_ENUMERATOR (object); + + g_assert (G_UDEV_IS_CLIENT (enumerator->priv->client)); + + enumerator->priv->e = udev_enumerate_new (_g_udev_client_get_udev (enumerator->priv->client)); + + if (G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed != NULL) + G_OBJECT_CLASS (g_udev_enumerator_parent_class)->constructed (object); +} + +static void +g_udev_enumerator_class_init (GUdevEnumeratorClass *klass) +{ + GObjectClass *gobject_class = (GObjectClass *) klass; + + gobject_class->finalize = g_udev_enumerator_finalize; + gobject_class->set_property = g_udev_enumerator_set_property; + gobject_class->get_property = g_udev_enumerator_get_property; + gobject_class->constructed = g_udev_enumerator_constructed; + + /** + * GUdevEnumerator:client: + * + * The #GUdevClient to enumerate devices from. + * + * Since: 165 + */ + g_object_class_install_property (gobject_class, + PROP_CLIENT, + g_param_spec_object ("client", + "The client to enumerate devices from", + "The client to enumerate devices from", + G_UDEV_TYPE_CLIENT, + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE)); + + g_type_class_add_private (klass, sizeof (GUdevEnumeratorPrivate)); +} + +static void +g_udev_enumerator_init (GUdevEnumerator *enumerator) +{ + enumerator->priv = G_TYPE_INSTANCE_GET_PRIVATE (enumerator, + G_UDEV_TYPE_ENUMERATOR, + GUdevEnumeratorPrivate); +} + +/** + * g_udev_enumerator_new: + * @client: A #GUdevClient to enumerate devices from. + * + * Constructs a #GUdevEnumerator object that can be used to enumerate + * and sort devices. Use the add_match_*() and add_nomatch_*() methods + * and execute the query to get a list of devices with + * g_udev_enumerator_execute(). + * + * Returns: A new #GUdevEnumerator object. Free with g_object_unref(). + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_new (GUdevClient *client) +{ + g_return_val_if_fail (G_UDEV_IS_CLIENT (client), NULL); + return G_UDEV_ENUMERATOR (g_object_new (G_UDEV_TYPE_ENUMERATOR, "client", client, NULL)); +} + + +/** + * g_udev_enumerator_add_match_subsystem: + * @enumerator: A #GUdevEnumerator. + * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. + * + * All returned devices will match the given @subsystem. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + udev_enumerate_add_match_subsystem (enumerator->priv->e, subsystem); + return enumerator; +} + +/** + * g_udev_enumerator_add_nomatch_subsystem: + * @enumerator: A #GUdevEnumerator. + * @subsystem: Wildcard for subsystem name e.g. 'scsi' or 'a*'. + * + * All returned devices will not match the given @subsystem. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (subsystem != NULL, NULL); + udev_enumerate_add_nomatch_subsystem (enumerator->priv->e, subsystem); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_sysfs_attr: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for sysfs attribute key. + * @value: Wildcard filter for sysfs attribute value. + * + * All returned devices will have a sysfs attribute matching the given @name and @value. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (value != NULL, NULL); + udev_enumerate_add_match_sysattr (enumerator->priv->e, name, value); + return enumerator; +} + +/** + * g_udev_enumerator_add_nomatch_sysfs_attr: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for sysfs attribute key. + * @value: Wildcard filter for sysfs attribute value. + * + * All returned devices will not have a sysfs attribute matching the given @name and @value. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (value != NULL, NULL); + udev_enumerate_add_nomatch_sysattr (enumerator->priv->e, name, value); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_property: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for property name. + * @value: Wildcard filter for property value. + * + * All returned devices will have a property matching the given @name and @value. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + g_return_val_if_fail (value != NULL, NULL); + udev_enumerate_add_match_property (enumerator->priv->e, name, value); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_name: + * @enumerator: A #GUdevEnumerator. + * @name: Wildcard filter for kernel name e.g. "sda*". + * + * All returned devices will match the given @name. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, + const gchar *name) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (name != NULL, NULL); + udev_enumerate_add_match_sysname (enumerator->priv->e, name); + return enumerator; +} + +/** + * g_udev_enumerator_add_sysfs_path: + * @enumerator: A #GUdevEnumerator. + * @sysfs_path: A sysfs path, e.g. "/sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda" + * + * Add a device to the list of devices, to retrieve it back sorted in dependency order. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, + const gchar *sysfs_path) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (sysfs_path != NULL, NULL); + udev_enumerate_add_syspath (enumerator->priv->e, sysfs_path); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_tag: + * @enumerator: A #GUdevEnumerator. + * @tag: A udev tag e.g. "udev-acl". + * + * All returned devices will match the given @tag. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, + const gchar *tag) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + g_return_val_if_fail (tag != NULL, NULL); + udev_enumerate_add_match_tag (enumerator->priv->e, tag); + return enumerator; +} + +/** + * g_udev_enumerator_add_match_is_initialized: + * @enumerator: A #GUdevEnumerator. + * + * All returned devices will be initialized. + * + * Returns: (transfer none): The passed in @enumerator. + * + * Since: 165 + */ +GUdevEnumerator * +g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator) +{ + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + udev_enumerate_add_match_is_initialized (enumerator->priv->e); + return enumerator; +} + +/** + * g_udev_enumerator_execute: + * @enumerator: A #GUdevEnumerator. + * + * Executes the query in @enumerator. + * + * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. + * + * Since: 165 + */ +GList * +g_udev_enumerator_execute (GUdevEnumerator *enumerator) +{ + GList *ret; + struct udev_list_entry *l, *devices; + + g_return_val_if_fail (G_UDEV_IS_ENUMERATOR (enumerator), NULL); + + ret = NULL; + + /* retrieve the list */ + udev_enumerate_scan_devices (enumerator->priv->e); + + devices = udev_enumerate_get_list_entry (enumerator->priv->e); + for (l = devices; l != NULL; l = udev_list_entry_get_next (l)) + { + struct udev_device *udevice; + GUdevDevice *device; + + udevice = udev_device_new_from_syspath (udev_enumerate_get_udev (enumerator->priv->e), + udev_list_entry_get_name (l)); + if (udevice == NULL) + continue; + + device = _g_udev_device_new (udevice); + udev_device_unref (udevice); + ret = g_list_prepend (ret, device); + } + + ret = g_list_reverse (ret); + + return ret; +} diff --git a/src/gudev/gudevenumerator.h b/src/gudev/gudevenumerator.h new file mode 100644 index 0000000000..3fddccf573 --- /dev/null +++ b/src/gudev/gudevenumerator.h @@ -0,0 +1,107 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008-2010 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_ENUMERATOR_H__ +#define __G_UDEV_ENUMERATOR_H__ + +#include + +G_BEGIN_DECLS + +#define G_UDEV_TYPE_ENUMERATOR (g_udev_enumerator_get_type ()) +#define G_UDEV_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumerator)) +#define G_UDEV_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) +#define G_UDEV_IS_ENUMERATOR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_UDEV_TYPE_ENUMERATOR)) +#define G_UDEV_IS_ENUMERATOR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_UDEV_TYPE_ENUMERATOR)) +#define G_UDEV_ENUMERATOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_UDEV_TYPE_ENUMERATOR, GUdevEnumeratorClass)) + +typedef struct _GUdevEnumeratorClass GUdevEnumeratorClass; +typedef struct _GUdevEnumeratorPrivate GUdevEnumeratorPrivate; + +/** + * GUdevEnumerator: + * + * The #GUdevEnumerator struct is opaque and should not be accessed directly. + * + * Since: 165 + */ +struct _GUdevEnumerator +{ + GObject parent; + + /*< private >*/ + GUdevEnumeratorPrivate *priv; +}; + +/** + * GUdevEnumeratorClass: + * @parent_class: Parent class. + * + * Class structure for #GUdevEnumerator. + * + * Since: 165 + */ +struct _GUdevEnumeratorClass +{ + GObjectClass parent_class; + + /*< private >*/ + /* Padding for future expansion */ + void (*reserved1) (void); + void (*reserved2) (void); + void (*reserved3) (void); + void (*reserved4) (void); + void (*reserved5) (void); + void (*reserved6) (void); + void (*reserved7) (void); + void (*reserved8) (void); +}; + +GType g_udev_enumerator_get_type (void) G_GNUC_CONST; +GUdevEnumerator *g_udev_enumerator_new (GUdevClient *client); +GUdevEnumerator *g_udev_enumerator_add_match_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem); +GUdevEnumerator *g_udev_enumerator_add_nomatch_subsystem (GUdevEnumerator *enumerator, + const gchar *subsystem); +GUdevEnumerator *g_udev_enumerator_add_match_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value); +GUdevEnumerator *g_udev_enumerator_add_nomatch_sysfs_attr (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value); +GUdevEnumerator *g_udev_enumerator_add_match_property (GUdevEnumerator *enumerator, + const gchar *name, + const gchar *value); +GUdevEnumerator *g_udev_enumerator_add_match_name (GUdevEnumerator *enumerator, + const gchar *name); +GUdevEnumerator *g_udev_enumerator_add_match_tag (GUdevEnumerator *enumerator, + const gchar *tag); +GUdevEnumerator *g_udev_enumerator_add_match_is_initialized (GUdevEnumerator *enumerator); +GUdevEnumerator *g_udev_enumerator_add_sysfs_path (GUdevEnumerator *enumerator, + const gchar *sysfs_path); +GList *g_udev_enumerator_execute (GUdevEnumerator *enumerator); + +G_END_DECLS + +#endif /* __G_UDEV_ENUMERATOR_H__ */ diff --git a/src/gudev/gudevenums.h b/src/gudev/gudevenums.h new file mode 100644 index 0000000000..c3a0aa8747 --- /dev/null +++ b/src/gudev/gudevenums.h @@ -0,0 +1,49 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_ENUMS_H__ +#define __G_UDEV_ENUMS_H__ + +#include + +G_BEGIN_DECLS + +/** + * GUdevDeviceType: + * @G_UDEV_DEVICE_TYPE_NONE: Device does not have a device file. + * @G_UDEV_DEVICE_TYPE_BLOCK: Device is a block device. + * @G_UDEV_DEVICE_TYPE_CHAR: Device is a character device. + * + * Enumeration used to specify a the type of a device. + */ +typedef enum +{ + G_UDEV_DEVICE_TYPE_NONE = 0, + G_UDEV_DEVICE_TYPE_BLOCK = 'b', + G_UDEV_DEVICE_TYPE_CHAR = 'c', +} GUdevDeviceType; + +G_END_DECLS + +#endif /* __G_UDEV_ENUMS_H__ */ diff --git a/src/gudev/gudevenumtypes.c.template b/src/gudev/gudevenumtypes.c.template new file mode 100644 index 0000000000..fc30b39e2e --- /dev/null +++ b/src/gudev/gudevenumtypes.c.template @@ -0,0 +1,39 @@ +/*** BEGIN file-header ***/ +#include + +/*** END file-header ***/ + +/*** BEGIN file-production ***/ +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType +@enum_name@_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const G@Type@Value values[] = { +/*** END value-header ***/ + +/*** BEGIN value-production ***/ + { @VALUENAME@, "@VALUENAME@", "@valuenick@" }, +/*** END value-production ***/ + +/*** BEGIN value-tail ***/ + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_@type@_register_static (g_intern_static_string ("@EnumName@"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} + +/*** END value-tail ***/ + +/*** BEGIN file-tail ***/ +/*** END file-tail ***/ diff --git a/src/gudev/gudevenumtypes.h.template b/src/gudev/gudevenumtypes.h.template new file mode 100644 index 0000000000..d0ab3393e6 --- /dev/null +++ b/src/gudev/gudevenumtypes.h.template @@ -0,0 +1,24 @@ +/*** BEGIN file-header ***/ +#ifndef __GUDEV_ENUM_TYPES_H__ +#define __GUDEV_ENUM_TYPES_H__ + +#include + +G_BEGIN_DECLS +/*** END file-header ***/ + +/*** BEGIN file-production ***/ + +/* enumerations from "@filename@" */ +/*** END file-production ***/ + +/*** BEGIN value-header ***/ +GType @enum_name@_get_type (void) G_GNUC_CONST; +#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ()) +/*** END value-header ***/ + +/*** BEGIN file-tail ***/ +G_END_DECLS + +#endif /* __GUDEV_ENUM_TYPES_H__ */ +/*** END file-tail ***/ diff --git a/src/gudev/gudevmarshal.list b/src/gudev/gudevmarshal.list new file mode 100644 index 0000000000..7e665999e8 --- /dev/null +++ b/src/gudev/gudevmarshal.list @@ -0,0 +1 @@ +VOID:STRING,OBJECT diff --git a/src/gudev/gudevprivate.h b/src/gudev/gudevprivate.h new file mode 100644 index 0000000000..8866f52b88 --- /dev/null +++ b/src/gudev/gudevprivate.h @@ -0,0 +1,41 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_PRIVATE_H__ +#define __G_UDEV_PRIVATE_H__ + +#include + +#include + +G_BEGIN_DECLS + +GUdevDevice * +_g_udev_device_new (struct udev_device *udevice); + +struct udev *_g_udev_client_get_udev (GUdevClient *client); + +G_END_DECLS + +#endif /* __G_UDEV_PRIVATE_H__ */ diff --git a/src/gudev/gudevtypes.h b/src/gudev/gudevtypes.h new file mode 100644 index 0000000000..888482783d --- /dev/null +++ b/src/gudev/gudevtypes.h @@ -0,0 +1,51 @@ +/* -*- Mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- + * + * Copyright (C) 2008 David Zeuthen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#if !defined (_GUDEV_COMPILATION) && !defined(_GUDEV_INSIDE_GUDEV_H) +#error "Only can be included directly, this file may disappear or change contents." +#endif + +#ifndef __G_UDEV_TYPES_H__ +#define __G_UDEV_TYPES_H__ + +#include +#include + +G_BEGIN_DECLS + +typedef struct _GUdevClient GUdevClient; +typedef struct _GUdevDevice GUdevDevice; +typedef struct _GUdevEnumerator GUdevEnumerator; + +/** + * GUdevDeviceNumber: + * + * Corresponds to the standard #dev_t type as defined by POSIX (Until + * bug 584517 is resolved this work-around is needed). + */ +#ifdef _GUDEV_WORK_AROUND_DEV_T_BUG +typedef guint64 GUdevDeviceNumber; /* __UQUAD_TYPE */ +#else +typedef dev_t GUdevDeviceNumber; +#endif + +G_END_DECLS + +#endif /* __G_UDEV_TYPES_H__ */ diff --git a/src/gudev/seed-example-enum.js b/src/gudev/seed-example-enum.js new file mode 100755 index 0000000000..66206ad806 --- /dev/null +++ b/src/gudev/seed-example-enum.js @@ -0,0 +1,38 @@ +#!/usr/bin/env seed + +const GLib = imports.gi.GLib; +const GUdev = imports.gi.GUdev; + +function print_device(device) { + print(" initialized: " + device.get_is_initialized()); + print(" usec since initialized: " + device.get_usec_since_initialized()); + print(" subsystem: " + device.get_subsystem()); + print(" devtype: " + device.get_devtype()); + print(" name: " + device.get_name()); + print(" number: " + device.get_number()); + print(" sysfs_path: " + device.get_sysfs_path()); + print(" driver: " + device.get_driver()); + print(" action: " + device.get_action()); + print(" seqnum: " + device.get_seqnum()); + print(" device type: " + device.get_device_type()); + print(" device number: " + device.get_device_number()); + print(" device file: " + device.get_device_file()); + print(" device file symlinks: " + device.get_device_file_symlinks()); + print(" tags: " + device.get_tags()); + var keys = device.get_property_keys(); + for (var n = 0; n < keys.length; n++) { + print(" " + keys[n] + "=" + device.get_property(keys[n])); + } +} + +var client = new GUdev.Client({subsystems: []}); +var enumerator = new GUdev.Enumerator({client: client}); +enumerator.add_match_subsystem('b*') + +var devices = enumerator.execute(); + +for (var n=0; n < devices.length; n++) { + var device = devices[n]; + print_device(device); + print(""); +} diff --git a/src/gudev/seed-example.js b/src/gudev/seed-example.js new file mode 100755 index 0000000000..e2ac324d23 --- /dev/null +++ b/src/gudev/seed-example.js @@ -0,0 +1,72 @@ +#!/usr/bin/env seed + +// seed example + +const GLib = imports.gi.GLib; +const GUdev = imports.gi.GUdev; + +function print_device (device) { + print (" subsystem: " + device.get_subsystem ()); + print (" devtype: " + device.get_devtype ()); + print (" name: " + device.get_name ()); + print (" number: " + device.get_number ()); + print (" sysfs_path: " + device.get_sysfs_path ()); + print (" driver: " + device.get_driver ()); + print (" action: " + device.get_action ()); + print (" seqnum: " + device.get_seqnum ()); + print (" device type: " + device.get_device_type ()); + print (" device number: " + device.get_device_number ()); + print (" device file: " + device.get_device_file ()); + print (" device file symlinks: " + device.get_device_file_symlinks ()); + print (" foo: " + device.get_sysfs_attr_as_strv ("stat")); + var keys = device.get_property_keys (); + for (var n = 0; n < keys.length; n++) { + print (" " + keys[n] + "=" + device.get_property (keys[n])); + } +} + +function on_uevent (client, action, device) { + print ("action " + action + " on device " + device.get_sysfs_path()); + print_device (device); + print (""); +} + +var client = new GUdev.Client ({subsystems: ["block", "usb/usb_interface"]}); +client.signal.connect ("uevent", on_uevent); + +var block_devices = client.query_by_subsystem ("block"); +for (var n = 0; n < block_devices.length; n++) { + print ("block device: " + block_devices[n].get_device_file ()); +} + +var d; + +d = client.query_by_device_number (GUdev.DeviceType.BLOCK, 0x0810); +if (d == null) { + print ("query_by_device_number 0x810 -> null"); +} else { + print ("query_by_device_number 0x810 -> " + d.get_device_file ()); + dd = d.get_parent_with_subsystem ("usb", null); + print_device (dd); + print ("--------------------------------------------------------------------------"); + while (d != null) { + print_device (d); + print (""); + d = d.get_parent (); + } +} + +d = client.query_by_sysfs_path ("/sys/block/sda/sda1"); +print ("query_by_sysfs_path (\"/sys/block/sda1\") -> " + d.get_device_file ()); + +d = client.query_by_subsystem_and_name ("block", "sda2"); +print ("query_by_subsystem_and_name (\"block\", \"sda2\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/sda"); +print ("query_by_device_file (\"/dev/sda\") -> " + d.get_device_file ()); + +d = client.query_by_device_file ("/dev/block/8:0"); +print ("query_by_device_file (\"/dev/block/8:0\") -> " + d.get_device_file ()); + +var mainloop = GLib.main_loop_new (); +GLib.main_loop_run (mainloop); diff --git a/src/keymap/.gitignore b/src/keymap/.gitignore new file mode 100644 index 0000000000..01d62e2b6e --- /dev/null +++ b/src/keymap/.gitignore @@ -0,0 +1,6 @@ +keyboard-force-release.sh +keymap +keys-from-name.gperf +keys-from-name.h +keys-to-name.h +keys.txt diff --git a/src/keymap/95-keyboard-force-release.rules b/src/keymap/95-keyboard-force-release.rules new file mode 100644 index 0000000000..79a1bc1cc4 --- /dev/null +++ b/src/keymap/95-keyboard-force-release.rules @@ -0,0 +1,53 @@ +# Set model specific atkbd force_release quirk +# +# Several laptops have hotkeys which don't generate release events, +# which can cause problems with software key repeat. +# The atkbd driver has a quirk handler for generating synthetic +# release events, which can be configured via sysfs since 2.6.32. +# Simply add a file with a list of scancodes for your laptop model +# in /usr/lib/udev/keymaps, and add a rule here. +# If the hotkeys also need a keymap assignment you can copy the +# scancodes from the keymap file, otherwise you can run +# /usr/lib/udev/keymap -i /dev/input/eventX +# on a Linux vt to find out. + +ACTION=="remove", GOTO="force_release_end" +SUBSYSTEM!="serio", GOTO="force_release_end" +KERNEL!="serio*", GOTO="force_release_end" +DRIVER!="atkbd", GOTO="force_release_end" + +ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" + +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.sh $devpath samsung-other" + +ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" +ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*|Precision M*", RUN+="keyboard-force-release.sh $devpath dell-touchpad" + +ENV{DMI_VENDOR}=="FUJITSU SIEMENS", ATTR{[dmi/id]product_name}=="AMILO Si 1848+u|AMILO Xi 2428", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="FOXCONN", ATTR{[dmi/id]product_name}=="QBOOK", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="MTC", ATTR{[dmi/id]product_version}=="A0", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="PEGATRON CORP.", ATTR{[dmi/id]product_name}=="Spring Peak", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite [uU]300*|Satellite Pro [uU]300*|Satellite [uU]305*|SATELLITE [uU]500*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="Viooo Corporation", ATTR{[dmi/id]product_name}=="PT17", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +# These are all the HP laptops that setup a touchpad toggle key +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keyboard-force-release.sh $devpath hp-other" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keyboard-force-release.sh $devpath hp-other" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keyboard-force-release.sh $devpath hp-other" + +ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote 6615WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="6625WD", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="HANNspree", ATTR{[dmi/id]product_name}=="SN10E100", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="GIGABYTE", ATTR{[dmi/id]product_name}=="i1520M", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +ENV{DMI_VENDOR}=="BenQ", ATTR{[dmi/id]product_name}=="*nScreen*", RUN+="keyboard-force-release.sh $devpath common-volume-keys" + +LABEL="force_release_end" diff --git a/src/keymap/95-keymap.rules b/src/keymap/95-keymap.rules new file mode 100644 index 0000000000..26de03dcc7 --- /dev/null +++ b/src/keymap/95-keymap.rules @@ -0,0 +1,169 @@ +# Set model specific hotkey keycodes. +# +# Key map overrides can be specified by either giving scancode/keyname pairs +# directly as keymap arguments (if there are just one or two to change), or as +# a file name (in /usr/lib/udev/keymaps), which has to contain scancode/keyname +# pairs. + +ACTION=="remove", GOTO="keyboard_end" +KERNEL!="event*", GOTO="keyboard_end" +ENV{ID_INPUT_KEY}=="", GOTO="keyboard_end" +SUBSYSTEMS=="bluetooth", GOTO="keyboard_end" + +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" +SUBSYSTEMS=="usb", GOTO="keyboard_usbcheck" +GOTO="keyboard_modulecheck" + +# +# The following are external USB keyboards +# + +LABEL="keyboard_usbcheck" + +ENV{ID_VENDOR}=="Genius", ENV{ID_MODEL_ID}=="0708", ENV{ID_USB_INTERFACE_NUM}=="01", RUN+="keymap $name genius-slimstar-320" +ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Multimedia Keyboard", RUN+="keymap $name logitech-wave" +ENV{ID_VENDOR}=="Logitech*", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-cordless" +# Logitech Cordless Wave Pro looks slightly weird; some hotkeys are coming through the mouse interface +ENV{ID_VENDOR_ID}=="046d", ENV{ID_MODEL_ID}=="c52[9b]", ATTRS{name}=="Logitech USB Receiver", RUN+="keymap $name logitech-wave-pro-cordless" + +ENV{ID_VENDOR}=="Lite-On_Technology_Corp*", ATTRS{name}=="Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint", RUN+="keymap $name lenovo-thinkpad-usb-keyboard-trackpoint" +ENV{ID_VENDOR_ID}=="04b3", ENV{ID_MODEL_ID}=="301[89]", RUN+="keymap $name ibm-thinkpad-usb-keyboard-trackpoint" + +ENV{ID_VENDOR}=="Microsoft", ENV{ID_MODEL_ID}=="00db", RUN+="keymap $name 0xc022d zoomin 0xc022e zoomout" + +GOTO="keyboard_end" + +# +# The following are exposed as separate input devices with low key codes, thus +# we need to check their input device product name +# + +LABEL="keyboard_modulecheck" + +ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" +ENV{DMI_VENDOR}=="", GOTO="keyboard_end" + +ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-lenovo" +ENV{DMI_VENDOR}=="LENOVO*", KERNELS=="input*", ATTRS{name}=="Lenovo ThinkPad SL Series extra buttons", RUN+="keymap $name 0x0E bluetooth" + +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Asus Extra Buttons", ATTR{[dmi/id]product_name}=="W3J", RUN+="keymap $name module-asus-w3j" +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC WMI hotkeys|Asus Laptop Support|Asus*WMI*", RUN+="keymap $name 0x6B f21" +ENV{DMI_VENDOR}=="ASUS*", KERNELS=="input*", ATTRS{name}=="Eee PC Hotkey Driver", RUN+="keymap $name 0x37 f21" + +ENV{DMI_VENDOR}=="IBM*", KERNELS=="input*", ATTRS{name}=="ThinkPad Extra Buttons", RUN+="keymap $name module-ibm" +ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony" +ENV{DMI_VENDOR}=="Acer*", KERNELS=="input*", ATTRS{name}=="Acer WMI hotkeys", RUN+="keymap $name 0x82 f21" +ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", KERNELS=="input*", ATTRS{name}=="MSI Laptop hotkeys", RUN+="keymap $name 0x213 f22 0x214 f23" + +# Older Vaios have some different keys +ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old" + +# Some Sony VGN models have yet another one +ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="VGN-AR71*|VGN-FW*|VGN-Z21*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-vgn" + + +# +# The following rules belong to standard i8042 AT keyboard with high key codes. +# + +DRIVERS=="atkbd", GOTO="keyboard_vendorcheck" +GOTO="keyboard_end" + +LABEL="keyboard_vendorcheck" + +ENV{DMI_VENDOR}=="Dell*", RUN+="keymap $name dell" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Inspiron 910|Inspiron 1010|Inspiron 1011|Inspiron 1012|Inspiron 1110|Inspiron 1210", RUN+="keymap $name 0x84 wlan" +ENV{DMI_VENDOR}=="Dell*", ATTR{[dmi/id]product_name}=="Latitude XT2", RUN+="keymap $name dell-latitude-xt2" + +ENV{DMI_VENDOR}=="Compaq*", ATTR{[dmi/id]product_name}=="*E500*|*Evo N*", RUN+="keymap $name compaq-e_evo" + +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*3000*", RUN+="keymap $name lenovo-3000" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X6*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x6_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="ThinkPad X2[02]* Tablet*", ATTR{[dmi/id]product_version}=="* Tablet", RUN+="keymap $name lenovo-thinkpad_x200_tablet" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_version}=="*IdeaPad*", RUN+="keymap $name lenovo-ideapad" +ENV{DMI_VENDOR}=="LENOVO*", ATTR{[dmi/id]product_name}=="S10-*", RUN+="keymap $name lenovo-ideapad" +ENV{DMI_VENDOR}=="LENOVO", ATTR{[dmi/id]product_version}=="*IdeaPad Y550*", RUN+="keymap $name 0x95 media 0xA3 play" + +ENV{DMI_VENDOR}=="Hewlett-Packard*", RUN+="keymap $name hewlett-packard" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][aA][bB][lL][eE][tT]*", RUN+="keymap $name hewlett-packard-tablet" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[pP][aA][vV][iI][lL][iI][oO][nN]*", RUN+="keymap $name hewlett-packard-pavilion" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*Compaq*|*EliteBook*|*2230s*", RUN+="keymap $name hewlett-packard-compaq_elitebook" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*2510p*|*2530p*|HP G60 Notebook PC", RUN+="keymap $name hewlett-packard-2510p_2530p" +ENV{DMI_VENDOR}=="Hewlett-Packard*", ATTR{[dmi/id]product_name}=="*[tT][xX]2*", RUN+="keymap $name hewlett-packard-tx2" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="Presario 2100*", RUN+="keymap $name hewlett-packard-presario-2100" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP G62 Notebook PC", RUN+="keymap $name 0xB2 www" +ENV{DMI_VENDOR}=="Hewlett-Packard", ATTR{[dmi/id]product_name}=="HP ProBook*", RUN+="keymap $name 0xF8 rfkill" +# HP Pavillion dv6315ea has empty DMI_VENDOR +ATTR{[dmi/id]board_vendor}=="Quanta", ATTR{[dmi/id]board_name}=="30B7", ATTR{[dmi/id]board_version}=="65.2B", RUN+="keymap $name 0x88 media" # "quick play + +# Gateway clone of Acer Aspire One AOA110/AOA150 +ENV{DMI_VENDOR}=="Gateway*", ATTR{[dmi/id]product_name}=="*AOA1*", RUN+="keymap $name acer" + +ENV{DMI_VENDOR}=="Acer*", RUN+="keymap $name acer" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Extensa*", ATTR{[dmi/id]product_name}=="*5210*|*5220*|*5610*|*5620*|*5720*", RUN+="keymap $name 0xEE screenlock" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*C3[01]0*", RUN+="keymap $name acer-travelmate_c300" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*6292*|TravelMate*8471*|TravelMate*4720*|TravelMate*7720*|Aspire 1810T*|AO751h|AO531h", RUN+="keymap $name 0xD9 bluetooth" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate*4720*", RUN+="keymap $name 0xB2 www 0xEE screenlock" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="TravelMate 6593|Aspire 1640", RUN+="keymap $name 0xB2 www 0xEE screenlock" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 6920", RUN+="keymap $name acer-aspire_6920" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5920G", RUN+="keymap $name acer-aspire_5920g" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 5720*", RUN+="keymap $name acer-aspire_5720" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_name}=="Aspire 8930", RUN+="keymap $name acer-aspire_8930" +ENV{DMI_VENDOR}=="Acer*", ATTR{[dmi/id]product_serial}=="ZG8*", RUN+="keymap $name acer-aspire_5720" + +ENV{DMI_VENDOR}=="*BenQ*", ATTR{[dmi/id]product_name}=="*Joybook R22*", RUN+="keymap $name 0x6E wlan" + +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro V3205*", RUN+="keymap $name fujitsu-amilo_pro_v3205" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pa 2548*", RUN+="keymap $name fujitsu-amilo_pa_2548" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V5*", RUN+="keymap $name fujitsu-esprimo_mobile_v5" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*ESPRIMO Mobile V6*", RUN+="keymap $name fujitsu-esprimo_mobile_v6" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*AMILO Pro Edition V3505*", RUN+="keymap $name fujitsu-amilo_pro_edition_v3505" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="*Amilo Si 1520*", RUN+="keymap $name fujitsu-amilo_si_1520" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO*M*", RUN+="keymap $name 0x97 prog2 0x9F prog1" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="Amilo Li 1718", RUN+="keymap $name 0xD6 wlan" +ENV{DMI_VENDOR}=="FUJITSU*", ATTR{[dmi/id]product_name}=="AMILO Li 2732", RUN+="keymap $name fujitsu-amilo_li_2732" + +ENV{DMI_VENDOR}=="LG*", ATTR{[dmi/id]product_name}=="*X110*", RUN+="keymap $name lg-x110" + +ENV{DMI_VENDOR}=="MEDION*", ATTR{[dmi/id]product_name}=="*FID2060*", RUN+="keymap $name medion-fid2060" +ENV{DMI_VENDOR}=="MEDIONNB", ATTR{[dmi/id]product_name}=="A555*", RUN+="keymap $name medionnb-a555" + +ENV{DMI_VENDOR}=="MICRO-STAR*|Micro-Star*", RUN+="keymap $name micro-star" + +# some MSI models generate ACPI/input events on the LNXVIDEO input devices, +# plus some extra synthesized ones on atkbd as an echo of actually changing the +# brightness; so ignore those atkbd ones, to avoid loops +ENV{DMI_VENDOR}=="MICRO-STAR*", ATTR{[dmi/id]product_name}=="*U-100*|*U100*|*N033", RUN+="keymap $name 0xF7 reserved 0xF8 reserved" + +ENV{DMI_VENDOR}=="INVENTEC", ATTR{[dmi/id]product_name}=="SYMPHONY 6.0/7.0", RUN+="keymap $name inventec-symphony_6.0_7.0" + +ENV{DMI_VENDOR}=="MAXDATA", ATTR{[dmi/id]product_name}=="Pro 7000*", RUN+="keymap $name maxdata-pro_7000" + +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700Z*", RUN+="keymap $name 0xBA ejectcd 0x96 keyboardbrightnessup 0x97 keyboardbrightnessdown" + +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" +ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite M30X", RUN+="keymap $name toshiba-satellite_m30x" + +ENV{DMI_VENDOR}=="OQO Inc.*", ATTR{[dmi/id]product_name}=="OQO Model 2*", RUN+="keymap $name oqo-model2" + +ENV{DMI_VENDOR}=="ONKYO CORPORATION", ATTR{[dmi/id]product_name}=="ONKYOPC", RUN+="keymap $name onkyo" + +ENV{DMI_VENDOR}=="ASUS", RUN+="keymap $name asus" + +ENV{DMI_VENDOR}=="VIA", ATTR{[dmi/id]product_name}=="K8N800", ATTR{[dmi/id]product_version}=="VT8204B", RUN+="keymap $name 0x81 prog1" + +ENV{DMI_VENDOR}=="Zepto", ATTR{[dmi/id]product_name}=="Znote", ATTR{[dmi/id]product_version}=="62*|63*", RUN+="keymap $name zepto-znote" + +ENV{DMI_VENDOR}=="Everex", ATTR{[dmi/id]product_name}=="XT5000*", RUN+="keymap $name everex-xt5000" + +ENV{DMI_VENDOR}=="COMPAL", ATTR{[dmi/id]product_name}=="HEL80I", RUN+="keymap $name 0x84 wlan" + +ENV{DMI_VENDOR}=="OLPC", ATTR{[dmi/id]product_name}=="XO", RUN+="keymap $name olpc-xo" + +ENV{DMI_VENDOR}=="Alienware*", ATTR{[dmi/id]product_name}=="M14xR1", RUN+="keymap $name 0x8A ejectcd" + +LABEL="keyboard_end" diff --git a/src/keymap/README.keymap.txt b/src/keymap/README.keymap.txt new file mode 100644 index 0000000000..52d50ed2de --- /dev/null +++ b/src/keymap/README.keymap.txt @@ -0,0 +1,101 @@ += The udev keymap tool = + +== Introduction == + +This udev extension configures computer model specific key mappings. This is +particularly necessary for the non-standard extra keys found on many laptops, +such as "brightness up", "next song", "www browser", or "suspend". Often these +are accessed with the Fn key. + +Every key produces a "scan code", which is highly vendor/model specific for the +nonstandard keys. This tool maintains mappings for these scan codes to standard +"key codes", which denote the "meaning" of the key. The key codes are defined +in /usr/include/linux/input.h. + +If some of your keys on your keyboard are not working at all, or produce the +wrong effect, then a very likely cause of this is that the scan code -> key +code mapping is incorrect on your computer. + +== Structure == + +udev-keymap consists of the following parts: + + keymaps/*:: mappings of scan codes to key code names + + 95-keymap.rules:: udev rules for mapping system vendor/product names and + input module names to one of the keymaps above + + keymap:: manipulate an evdev input device: + * write a key map file into a device (used by udev rules) + * dump current scan → key code mapping + * interactively display scan and key codes of pressed keys + + findkeyboards:: display evdev input devices which belong to actual keyboards, + i. e. those suitable for the keymap program + + fdi2rules.py:: convert hal keymap FDIs into udev rules and key map files + (Please note that this is far from perfect, since the mapping between fdi and + udev rules is not straightforward, and impossible in some cases.) + +== Fixing broken keys == + +In order to make a broken key work on your system and send it back to upstream +for inclusion you need to do the following steps: + + 1. Find the keyboard device. + + Run /usr/lib/udev/findkeyboards. This should always give you an "AT + keyboard" and possibly a "module". Some laptops (notably Thinkpads, Sonys, and + Acers) have multimedia/function keys on a separate input device instead of the + primary keyboard. The keyboard device should have a name like "input/event3". + In the following commands, the name will be written as "input/eventX" (replace + X with the appropriate number). + + 2. Find broken scan codes: + + sudo /usr/lib/udev/keymap -i input/eventX + + Press all multimedia/function keys and check if the key name that gets printed + out is plausible. If it is unknown or wrong, write down the scan code (looks + like "0x1E") and the intended functionality of this key. Look in + /usr/include/linux/input.h for an available KEY_XXXXX constant which most + closely approximates this functionality and write it down as the new key code. + + For example, you might press a key labeled "web browser" which currently + produces "unknown". Note down this: + + 0x1E www # Fn+F2 web browser + + Repeat that for all other keys. Write the resulting list into a file. Look at + /usr/lib/udev/keymaps/ for existing key map files and make sure that you use the + same structure. + + If the key only ever works once and then your keyboard (or the entire desktop) + gets stuck for a long time, then it is likely that the BIOS fails to send a + corresponding "key release" event after the key press event. Please note down + this case as well, as it can be worked around in + /usr/lib/udev/keymaps/95-keyboard-force-release.rules . + + 3. Find out your system vendor and product: + + cat /sys/class/dmi/id/sys_vendor + cat /sys/class/dmi/id/product_name + + 4. Generate a device dump with "udevadm info --export-db > /tmp/udev-db.txt". + + 6. Send the system vendor/product names, the key mapping from step 2, + and /tmp/udev-db.txt from step 4 to the linux-hotplug@vger.kernel.org mailing + list, so that they can be included in the next release. + +For local testing, copy your map file to /usr/lib/udev/keymaps/ with an appropriate +name, and add an appropriate udev rule to /usr/lib/udev/rules.d/95-keymap.rules: + + * If you selected an "AT keyboard", add the rule to the section after + 'LABEL="keyboard_vendorcheck"'. + + * If you selected a "module", add the rule to the top section where the + "ThinkPad Extra Buttons" are. + +== Author == + +keymap is written and maintained by Martin Pitt . diff --git a/src/keymap/check-keymaps.sh b/src/keymap/check-keymaps.sh new file mode 100755 index 0000000000..405168c667 --- /dev/null +++ b/src/keymap/check-keymaps.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# check that all key names in keymaps/* are known in +# and that all key maps listed in the rules are valid and present in +# Makefile.am +SRCDIR=${1:-.} +KEYLIST=${2:-src/keymap/keys.txt} +KEYMAPS_DIR=$SRCDIR/src/keymap/keymaps +RULES=$SRCDIR/src/keymap/95-keymap.rules + +[ -e "$KEYLIST" ] || { + echo "need $KEYLIST please build first" >&2 + exit 1 +} + +missing=$(join -v 2 <(awk '{print tolower(substr($1,5))}' $KEYLIST | sort -u) \ + <(grep -hv '^#' ${KEYMAPS_DIR}/*| awk '{print $2}' | sort -u)) +[ -z "$missing" ] || { + echo "ERROR: unknown key names in src/keymap/keymaps/*:" >&2 + echo "$missing" >&2 + exit 1 +} + +# check that all maps referred to in $RULES exist +maps=$(sed -rn '/keymap \$name/ { s/^.*\$name ([^"[:space:]]+).*$/\1/; p }' $RULES) +for m in $maps; do + # ignore inline mappings + [ "$m" = "${m#0x}" ] || continue + + [ -e ${KEYMAPS_DIR}/$m ] || { + echo "ERROR: unknown map name in $RULES: $m" >&2 + exit 1 + } + grep -q "src/keymap/keymaps/$m\>" $SRCDIR/Makefile.am || { + echo "ERROR: map file $m is not added to Makefile.am" >&2 + exit 1 + } +done diff --git a/src/keymap/findkeyboards b/src/keymap/findkeyboards new file mode 100755 index 0000000000..9ce27429b2 --- /dev/null +++ b/src/keymap/findkeyboards @@ -0,0 +1,68 @@ +#!/bin/sh -e +# Find "real" keyboard devices and print their device path. +# Author: Martin Pitt +# +# Copyright (C) 2009, Canonical Ltd. +# +# 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; either version 2 of the License, or +# (at your option) any later version. +# +# 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. + +# returns OK if $1 contains $2 +strstr() { + [ "${1#*$2*}" != "$1" ] +} + +# returns OK if $1 contains $2 at the beginning +str_starts() { + [ "${1#$2*}" != "$1" ] +} + +str_line_starts() { + while read a; do str_starts "$a" "$1" && return 0;done + return 1; +} + +# print a list of input devices which are keyboard-like +keyboard_devices() { + # standard AT keyboard + for dev in `udevadm trigger --dry-run --verbose --property-match=ID_INPUT_KEYBOARD=1`; do + walk=`udevadm info --attribute-walk --path=$dev` + env=`udevadm info --query=env --path=$dev` + # filter out non-event devices, such as the parent input devices which have no devnode + if ! echo "$env" | str_line_starts 'DEVNAME='; then + continue + fi + if strstr "$walk" 'DRIVERS=="atkbd"'; then + echo -n 'AT keyboard: ' + elif echo "$env" | str_line_starts 'ID_USB_DRIVER=usbhid'; then + echo -n 'USB keyboard: ' + else + echo -n 'Unknown type: ' + fi + udevadm info --query=name --path=$dev + done + + # modules + module=$(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*Extra Buttons') + module="$module + $(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='*extra buttons')" + module="$module + $(udevadm trigger --verbose --dry-run --subsystem-match=input --attr-match=name='Sony Vaio Keys')" + for m in $module; do + for evdev in $m/event*/dev; do + if [ -e "$evdev" ]; then + echo -n 'module: ' + udevadm info --query=name --path=${evdev%%/dev} + fi + done + done +} + +keyboard_devices diff --git a/src/keymap/force-release-maps/common-volume-keys b/src/keymap/force-release-maps/common-volume-keys new file mode 100644 index 0000000000..3a7654d735 --- /dev/null +++ b/src/keymap/force-release-maps/common-volume-keys @@ -0,0 +1,3 @@ +0xa0 #mute +0xae #volume down +0xb0 #volume up diff --git a/src/keymap/force-release-maps/dell-touchpad b/src/keymap/force-release-maps/dell-touchpad new file mode 100644 index 0000000000..18e9bdee66 --- /dev/null +++ b/src/keymap/force-release-maps/dell-touchpad @@ -0,0 +1 @@ +0x9E diff --git a/src/keymap/force-release-maps/hp-other b/src/keymap/force-release-maps/hp-other new file mode 100644 index 0000000000..6621370095 --- /dev/null +++ b/src/keymap/force-release-maps/hp-other @@ -0,0 +1,3 @@ +# list of scancodes (hex or decimal), optional comment +0xd8 # Touchpad off +0xd9 # Touchpad on diff --git a/src/keymap/force-release-maps/samsung-other b/src/keymap/force-release-maps/samsung-other new file mode 100644 index 0000000000..c51123a0b6 --- /dev/null +++ b/src/keymap/force-release-maps/samsung-other @@ -0,0 +1,10 @@ +# list of scancodes (hex or decimal), optional comment +0x82 # Fn+F4 CRT/LCD +0x83 # Fn+F2 battery +0x84 # Fn+F5 backlight on/off +0x86 # Fn+F9 WLAN +0x88 # Fn-Up brightness up +0x89 # Fn-Down brightness down +0xB3 # Fn+F8 switch power mode (battery/dynamic/performance) +0xF7 # Fn+F10 Touchpad on +0xF9 # Fn+F10 Touchpad off diff --git a/src/keymap/keyboard-force-release.sh.in b/src/keymap/keyboard-force-release.sh.in new file mode 100755 index 0000000000..dd040cebc3 --- /dev/null +++ b/src/keymap/keyboard-force-release.sh.in @@ -0,0 +1,22 @@ +#!@rootprefix@/bin/sh -e +# read list of scancodes, convert hex to decimal and +# append to the atkbd force_release sysfs attribute +# $1 sysfs devpath for serioX +# $2 file with scancode list (hex or dec) + +case "$2" in + /*) scf="$2" ;; + *) scf="@pkglibexecdir@/keymaps/force-release/$2" ;; +esac + +read attr <"/sys/$1/force_release" +while read scancode dummy; do + case "$scancode" in + \#*) ;; + *) + scancode=$(($scancode)) + attr="$attr${attr:+,}$scancode" + ;; + esac +done <"$scf" +echo "$attr" >"/sys/$1/force_release" diff --git a/src/keymap/keymap.c b/src/keymap/keymap.c new file mode 100644 index 0000000000..92ec67b3a6 --- /dev/null +++ b/src/keymap/keymap.c @@ -0,0 +1,447 @@ +/* + * keymap - dump keymap of an evdev device or set a new keymap from a file + * + * Based on keyfuzz by Lennart Poettering + * Adapted for udev-extras by Martin Pitt + * + * Copyright (C) 2006, Lennart Poettering + * Copyright (C) 2009, Canonical Ltd. + * + * keymap 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; either version 2 of the License, or + * (at your option) any later version. + * + * keymap 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 keymap; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +const struct key* lookup_key (const char *str, unsigned int len); + +#include "keys-from-name.h" +#include "keys-to-name.h" + +#define MAX_SCANCODES 1024 + +static int evdev_open(const char *dev) +{ + int fd; + char fn[PATH_MAX]; + + if (strncmp(dev, "/dev", 4) != 0) { + snprintf(fn, sizeof(fn), "/dev/%s", dev); + dev = fn; + } + + if ((fd = open(dev, O_RDWR)) < 0) { + fprintf(stderr, "error open('%s'): %m\n", dev); + return -1; + } + return fd; +} + +static int evdev_get_keycode(int fd, int scancode, int e) +{ + int codes[2]; + + codes[0] = scancode; + if (ioctl(fd, EVIOCGKEYCODE, codes) < 0) { + if (e && errno == EINVAL) { + return -2; + } else { + fprintf(stderr, "EVIOCGKEYCODE: %m\n"); + return -1; + } + } + return codes[1]; +} + +static int evdev_set_keycode(int fd, int scancode, int keycode) +{ + int codes[2]; + + codes[0] = scancode; + codes[1] = keycode; + + if (ioctl(fd, EVIOCSKEYCODE, codes) < 0) { + fprintf(stderr, "EVIOCSKEYCODE: %m\n"); + return -1; + } + return 0; +} + +static int evdev_driver_version(int fd, char *v, size_t l) +{ + int version; + + if (ioctl(fd, EVIOCGVERSION, &version)) { + fprintf(stderr, "EVIOCGVERSION: %m\n"); + return -1; + } + + snprintf(v, l, "%i.%i.%i.", version >> 16, (version >> 8) & 0xff, version & 0xff); + return 0; +} + +static int evdev_device_name(int fd, char *n, size_t l) +{ + if (ioctl(fd, EVIOCGNAME(l), n) < 0) { + fprintf(stderr, "EVIOCGNAME: %m\n"); + return -1; + } + return 0; +} + +/* Return a lower-case string with KEY_ prefix removed */ +static const char* format_keyname(const char* key) { + static char result[101]; + const char* s; + int len; + + for (s = key+4, len = 0; *s && len < 100; ++len, ++s) + result[len] = tolower(*s); + result[len] = '\0'; + return result; +} + +static int dump_table(int fd) { + char version[256], name[256]; + int scancode, r = -1; + + if (evdev_driver_version(fd, version, sizeof(version)) < 0) + goto fail; + + if (evdev_device_name(fd, name, sizeof(name)) < 0) + goto fail; + + printf("### evdev %s, driver '%s'\n", version, name); + + r = 0; + for (scancode = 0; scancode < MAX_SCANCODES; scancode++) { + int keycode; + + if ((keycode = evdev_get_keycode(fd, scancode, 1)) < 0) { + if (keycode == -2) + continue; + r = -1; + break; + } + + if (keycode < KEY_MAX && key_names[keycode]) + printf("0x%03x %s\n", scancode, format_keyname(key_names[keycode])); + else + printf("0x%03x 0x%03x\n", scancode, keycode); + } +fail: + return r; +} + +static void set_key(int fd, const char* scancode_str, const char* keyname) +{ + unsigned scancode; + char *endptr; + char t[105] = "KEY_UNKNOWN"; + const struct key *k; + + scancode = (unsigned) strtol(scancode_str, &endptr, 0); + if (*endptr != '\0') { + fprintf(stderr, "ERROR: Invalid scancode\n"); + exit(1); + } + + snprintf(t, sizeof(t), "KEY_%s", keyname); + + if (!(k = lookup_key(t, strlen(t)))) { + fprintf(stderr, "ERROR: Unknown key name '%s'\n", keyname); + exit(1); + } + + if (evdev_set_keycode(fd, scancode, k->id) < 0) + fprintf(stderr, "setting scancode 0x%2X to key code %i failed\n", + scancode, k->id); + else + printf("setting scancode 0x%2X to key code %i\n", + scancode, k->id); +} + +static int merge_table(int fd, FILE *f) { + int r = 0; + int line = 0; + + while (!feof(f)) { + char s[256], *p; + int scancode, new_keycode, old_keycode; + + if (!fgets(s, sizeof(s), f)) + break; + + line++; + p = s+strspn(s, "\t "); + if (*p == '#' || *p == '\n') + continue; + + if (sscanf(p, "%i %i", &scancode, &new_keycode) != 2) { + char t[105] = "KEY_UNKNOWN"; + const struct key *k; + + if (sscanf(p, "%i %100s", &scancode, t+4) != 2) { + fprintf(stderr, "WARNING: Parse failure at line %i, ignoring.\n", line); + r = -1; + continue; + } + + if (!(k = lookup_key(t, strlen(t)))) { + fprintf(stderr, "WARNING: Unknown key '%s' at line %i, ignoring.\n", t, line); + r = -1; + continue; + } + + new_keycode = k->id; + } + + + if ((old_keycode = evdev_get_keycode(fd, scancode, 0)) < 0) { + r = -1; + goto fail; + } + + if (evdev_set_keycode(fd, scancode, new_keycode) < 0) { + r = -1; + goto fail; + } + + if (new_keycode != old_keycode) + fprintf(stderr, "Remapped scancode 0x%02x to 0x%02x (prior: 0x%02x)\n", + scancode, new_keycode, old_keycode); + } +fail: + fclose(f); + return r; +} + + +/* read one event; return 1 if valid */ +static int read_event(int fd, struct input_event* ev) +{ + int ret; + ret = read(fd, ev, sizeof(struct input_event)); + + if (ret < 0) { + perror("read"); + return 0; + } + if (ret != sizeof(struct input_event)) { + fprintf(stderr, "did not get enough data for event struct, aborting\n"); + return 0; + } + + return 1; +} + +static void print_key(uint32_t scancode, uint16_t keycode, int has_scan, int has_key) +{ + const char *keyname; + + /* ignore key release events */ + if (has_key == 1) + return; + + if (has_key == 0 && has_scan != 0) { + fprintf(stderr, "got scan code event 0x%02X without a key code event\n", + scancode); + return; + } + + if (has_scan != 0) + printf("scan code: 0x%02X ", scancode); + else + printf("(no scan code received) "); + + keyname = key_names[keycode]; + if (keyname != NULL) + printf("key code: %s\n", format_keyname(keyname)); + else + printf("key code: %03X\n", keycode); +} + +static void interactive(int fd) +{ + struct input_event ev; + uint32_t last_scan = 0; + uint16_t last_key = 0; + int has_scan; /* boolean */ + int has_key; /* 0: none, 1: release, 2: press */ + + /* grab input device */ + ioctl(fd, EVIOCGRAB, 1); + puts("Press ESC to finish, or Control-C if this device is not your primary keyboard"); + + has_scan = has_key = 0; + while (read_event(fd, &ev)) { + /* Drivers usually send the scan code first, then the key code, + * then a SYN. Some drivers (like thinkpad_acpi) send the key + * code first, and some drivers might not send SYN events, so + * keep a robust state machine which can deal with any of those + */ + + if (ev.type == EV_MSC && ev.code == MSC_SCAN) { + if (has_scan) { + fputs("driver did not send SYN event in between key events; previous event:\n", + stderr); + print_key(last_scan, last_key, has_scan, has_key); + has_key = 0; + } + + last_scan = ev.value; + has_scan = 1; + /*printf("--- got scan %u; has scan %i key %i\n", last_scan, has_scan, has_key); */ + } + else if (ev.type == EV_KEY) { + if (has_key) { + fputs("driver did not send SYN event in between key events; previous event:\n", + stderr); + print_key(last_scan, last_key, has_scan, has_key); + has_scan = 0; + } + + last_key = ev.code; + has_key = 1 + ev.value; + /*printf("--- got key %hu; has scan %i key %i\n", last_key, has_scan, has_key);*/ + + /* Stop on ESC */ + if (ev.code == KEY_ESC && ev.value == 0) + break; + } + else if (ev.type == EV_SYN) { + /*printf("--- got SYN; has scan %i key %i\n", has_scan, has_key);*/ + print_key(last_scan, last_key, has_scan, has_key); + + has_scan = has_key = 0; + } + + } + + /* release input device */ + ioctl(fd, EVIOCGRAB, 0); +} + +static void help(int error) +{ + const char* h = "Usage: keymap []\n" + " keymap scancode keyname [...]\n" + " keymap -i \n"; + if (error) { + fputs(h, stderr); + exit(2); + } else { + fputs(h, stdout); + exit(0); + } +} + +int main(int argc, char **argv) +{ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + { "interactive", no_argument, NULL, 'i' }, + {} + }; + int fd = -1; + int opt_interactive = 0; + int i; + + while (1) { + int option; + + option = getopt_long(argc, argv, "hi", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + help(0); + + case 'i': + opt_interactive = 1; + break; + default: + return 1; + } + } + + if (argc < optind+1) + help (1); + + if ((fd = evdev_open(argv[optind])) < 0) + return 3; + + /* one argument (device): dump or interactive */ + if (argc == optind+1) { + if (opt_interactive) + interactive(fd); + else + dump_table(fd); + return 0; + } + + /* two arguments (device, mapfile): set map file */ + if (argc == optind+2) { + const char *filearg = argv[optind+1]; + if (strchr(filearg, '/')) { + /* Keymap file argument is a path */ + FILE *f = fopen(filearg, "r"); + if (f) + merge_table(fd, f); + else + perror(filearg); + } else { + /* Keymap file argument is a filename */ + /* Open override file if present, otherwise default file */ + char keymap_path[PATH_MAX]; + snprintf(keymap_path, sizeof(keymap_path), "%s%s", SYSCONFDIR "/udev/keymaps/", filearg); + FILE *f = fopen(keymap_path, "r"); + if (f) { + merge_table(fd, f); + } else { + snprintf(keymap_path, sizeof(keymap_path), "%s%s", PKGLIBEXECDIR "/keymaps/", filearg); + f = fopen(keymap_path, "r"); + if (f) + merge_table(fd, f); + else + perror(keymap_path); + } + } + return 0; + } + + /* more arguments (device, scancode/keyname pairs): set keys directly */ + if ((argc - optind - 1) % 2 == 0) { + for (i = optind+1; i < argc; i += 2) + set_key(fd, argv[i], argv[i+1]); + return 0; + } + + /* invalid number of arguments */ + help(1); + return 1; /* not reached */ +} diff --git a/src/keymap/keymaps/acer b/src/keymap/keymaps/acer new file mode 100644 index 0000000000..4e7c297dea --- /dev/null +++ b/src/keymap/keymaps/acer @@ -0,0 +1,22 @@ +0xA5 help # Fn+F1 +0xA6 setup # Fn+F2 Acer eSettings +0xA7 battery # Fn+F3 Power Management +0xA9 switchvideomode # Fn+F5 +0xB3 euro +0xB4 dollar +0xCE brightnessup # Fn+Right +0xD4 bluetooth # (toggle) off-to-on +0xD5 wlan # (toggle) on-to-off +0xD6 wlan # (toggle) off-to-on +0xD7 bluetooth # (toggle) on-to-off +0xD8 bluetooth # (toggle) off-to-on +0xD9 brightnessup # Fn+Right +0xEE brightnessup # Fn+Right +0xEF brightnessdown # Fn+Left +0xF1 f22 # Fn+F7 Touchpad toggle (off-to-on) +0xF2 f23 # Fn+F7 Touchpad toggle (on-to-off) +0xF3 prog2 # "P2" programmable button +0xF4 prog1 # "P1" programmable button +0xF5 presentation +0xF8 fn +0xF9 f23 # Launch NTI shadow diff --git a/src/keymap/keymaps/acer-aspire_5720 b/src/keymap/keymaps/acer-aspire_5720 new file mode 100644 index 0000000000..1496d63a52 --- /dev/null +++ b/src/keymap/keymaps/acer-aspire_5720 @@ -0,0 +1,4 @@ +0x84 bluetooth # sent when bluetooth module missing, and key pressed +0x92 media # acer arcade +0xD4 bluetooth # bluetooth on +0xD9 bluetooth # bluetooth off diff --git a/src/keymap/keymaps/acer-aspire_5920g b/src/keymap/keymaps/acer-aspire_5920g new file mode 100644 index 0000000000..633c4e854c --- /dev/null +++ b/src/keymap/keymaps/acer-aspire_5920g @@ -0,0 +1,5 @@ +0x8A media +0x92 media +0xA6 setup +0xB2 www +0xD9 bluetooth # (toggle) on-to-off diff --git a/src/keymap/keymaps/acer-aspire_6920 b/src/keymap/keymaps/acer-aspire_6920 new file mode 100644 index 0000000000..699c954b4e --- /dev/null +++ b/src/keymap/keymaps/acer-aspire_6920 @@ -0,0 +1,5 @@ +0xD9 bluetooth # (toggle) on-to-off +0x92 media +0x9E back +0x83 rewind +0x89 fastforward diff --git a/src/keymap/keymaps/acer-aspire_8930 b/src/keymap/keymaps/acer-aspire_8930 new file mode 100644 index 0000000000..fb27bfb4f5 --- /dev/null +++ b/src/keymap/keymaps/acer-aspire_8930 @@ -0,0 +1,5 @@ +0xCA prog3 # key 'HOLD' on cine dash media console +0x83 rewind +0x89 fastforward +0x92 media # key 'ARCADE' on cine dash media console +0x9E back diff --git a/src/keymap/keymaps/acer-travelmate_c300 b/src/keymap/keymaps/acer-travelmate_c300 new file mode 100644 index 0000000000..bfef4cf868 --- /dev/null +++ b/src/keymap/keymaps/acer-travelmate_c300 @@ -0,0 +1,5 @@ +0x67 f24 # FIXME: rotate screen +0x68 up +0x69 down +0x6B fn +0x6C screenlock # FIXME: lock tablet device/buttons diff --git a/src/keymap/keymaps/asus b/src/keymap/keymaps/asus new file mode 100644 index 0000000000..2a5995f982 --- /dev/null +++ b/src/keymap/keymaps/asus @@ -0,0 +1,3 @@ +0xED volumeup +0xEE volumedown +0xEF mute diff --git a/src/keymap/keymaps/compaq-e_evo b/src/keymap/keymaps/compaq-e_evo new file mode 100644 index 0000000000..5fbc573aa4 --- /dev/null +++ b/src/keymap/keymaps/compaq-e_evo @@ -0,0 +1,4 @@ +0xA3 www # I key +0x9A search +0x9E email +0x9F homepage diff --git a/src/keymap/keymaps/dell b/src/keymap/keymaps/dell new file mode 100644 index 0000000000..4f907b3eef --- /dev/null +++ b/src/keymap/keymaps/dell @@ -0,0 +1,29 @@ +0x81 playpause # Play/Pause +0x82 stopcd # Stop +0x83 previoussong # Previous song +0x84 nextsong # Next song +0x85 brightnessdown # Fn+Down arrow Brightness Down +0x86 brightnessup # Fn+Up arrow Brightness Up +0x87 battery # Fn+F3 battery icon +0x88 unknown # Fn+F2 Turn On/Off Wireless - handled in hardware +0x89 ejectclosecd # Fn+F10 Eject CD +0x8A suspend # Fn+F1 hibernate +0x8B switchvideomode # Fn+F8 CRT/LCD (high keycode: "displaytoggle") +0x8C f23 # Fn+Right arrow Auto Brightness +0x8F switchvideomode # Fn+F7 aspect ratio +0x90 previoussong # Front panel previous song +0x91 prog1 # Wifi Catcher (DELL Specific) +0x92 media # MediaDirect button (house icon) +0x93 f23 # FIXME Fn+Left arrow Auto Brightness +0x95 camera # Shutter button Takes a picture if optional camera available +0x97 email # Tablet email button +0x98 f21 # FIXME: Tablet screen rotatation +0x99 nextsong # Front panel next song +0x9A setup # Tablet tools button +0x9B switchvideomode # Display Toggle button +0x9E f21 #touchpad toggle +0xA2 playpause # Front panel play/pause +0xA4 stopcd # Front panel stop +0xED media # MediaDirect button +0xD8 screenlock # FIXME: Tablet lock button +0xD9 f21 # touchpad toggle diff --git a/src/keymap/keymaps/dell-latitude-xt2 b/src/keymap/keymaps/dell-latitude-xt2 new file mode 100644 index 0000000000..39872f559d --- /dev/null +++ b/src/keymap/keymaps/dell-latitude-xt2 @@ -0,0 +1,4 @@ +0x9B up # tablet rocker up +0x9E enter # tablet rocker press +0x9F back # tablet back +0xA3 down # tablet rocker down diff --git a/src/keymap/keymaps/everex-xt5000 b/src/keymap/keymaps/everex-xt5000 new file mode 100644 index 0000000000..4823a832f5 --- /dev/null +++ b/src/keymap/keymaps/everex-xt5000 @@ -0,0 +1,7 @@ +0x5C media +0x65 f21 # Fn+F5 Touchpad toggle +0x67 prog3 # Fan Speed Control button +0x6F brightnessup +0x7F brightnessdown +0xB2 www +0xEC mail diff --git a/src/keymap/keymaps/fujitsu-amilo_li_2732 b/src/keymap/keymaps/fujitsu-amilo_li_2732 new file mode 100644 index 0000000000..9b8b36a170 --- /dev/null +++ b/src/keymap/keymaps/fujitsu-amilo_li_2732 @@ -0,0 +1,3 @@ +0xD9 brightnessdown # Fn+F8 brightness down +0xEF brightnessup # Fn+F9 brightness up +0xA9 switchvideomode # Fn+F10 Cycle between available video outputs diff --git a/src/keymap/keymaps/fujitsu-amilo_pa_2548 b/src/keymap/keymaps/fujitsu-amilo_pa_2548 new file mode 100644 index 0000000000..f7b0c52444 --- /dev/null +++ b/src/keymap/keymaps/fujitsu-amilo_pa_2548 @@ -0,0 +1,3 @@ +0xE0 volumedown +0xE1 volumeup +0xE5 prog1 diff --git a/src/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 b/src/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 new file mode 100644 index 0000000000..d2e38cbb23 --- /dev/null +++ b/src/keymap/keymaps/fujitsu-amilo_pro_edition_v3505 @@ -0,0 +1,4 @@ +0xA5 help # Fn-F1 +0xA9 switchvideomode # Fn-F3 +0xD9 brightnessdown # Fn-F8 +0xE0 brightnessup # Fn-F9 diff --git a/src/keymap/keymaps/fujitsu-amilo_pro_v3205 b/src/keymap/keymaps/fujitsu-amilo_pro_v3205 new file mode 100644 index 0000000000..43e3199d59 --- /dev/null +++ b/src/keymap/keymaps/fujitsu-amilo_pro_v3205 @@ -0,0 +1,2 @@ +0xF4 f21 # FIXME: silent-mode decrease CPU/GPU clock +0xF7 switchvideomode # Fn+F3 diff --git a/src/keymap/keymaps/fujitsu-amilo_si_1520 b/src/keymap/keymaps/fujitsu-amilo_si_1520 new file mode 100644 index 0000000000..1419bd9b5e --- /dev/null +++ b/src/keymap/keymaps/fujitsu-amilo_si_1520 @@ -0,0 +1,6 @@ +0xE1 wlan +0xF3 wlan +0xEE brightnessdown +0xE0 brightnessup +0xE2 bluetooth +0xF7 video diff --git a/src/keymap/keymaps/fujitsu-esprimo_mobile_v5 b/src/keymap/keymaps/fujitsu-esprimo_mobile_v5 new file mode 100644 index 0000000000..d3d056b366 --- /dev/null +++ b/src/keymap/keymaps/fujitsu-esprimo_mobile_v5 @@ -0,0 +1,4 @@ +0xA9 switchvideomode +0xD9 brightnessdown +0xDF sleep +0xEF brightnessup diff --git a/src/keymap/keymaps/fujitsu-esprimo_mobile_v6 b/src/keymap/keymaps/fujitsu-esprimo_mobile_v6 new file mode 100644 index 0000000000..52c70c50cb --- /dev/null +++ b/src/keymap/keymaps/fujitsu-esprimo_mobile_v6 @@ -0,0 +1,2 @@ +0xCE brightnessup +0xEF brightnessdown diff --git a/src/keymap/keymaps/genius-slimstar-320 b/src/keymap/keymaps/genius-slimstar-320 new file mode 100644 index 0000000000..d0a3656dd8 --- /dev/null +++ b/src/keymap/keymaps/genius-slimstar-320 @@ -0,0 +1,35 @@ +# Genius SlimStar 320 +# +# Only buttons which are not properly mapped yet are configured below + +# "Scroll wheel", a circular up/down/left/right button. Aimed for scolling, +# but since there are no scrollleft/scrollright, let's map to back/forward. +0x900f0 scrollup +0x900f1 scrolldown +0x900f3 back +0x900f2 forward + +# Multimedia buttons, left side (from left to right) +# [W] +0x900f5 wordprocessor +# [Ex] +0x900f6 spreadsheet +# [P] +0x900f4 presentation +# Other five (calculator, playpause, stop, mute and eject) are OK + +# Right side, from left to right +# [e] +0xc0223 www +# "man" +0x900f7 chat +# "Y" +0x900fb prog1 +# [X] +0x900f8 close +# "picture" +0x900f9 graphicseditor +# "two windows" +0x900fd scale +# "lock" +0x900fc screenlock diff --git a/src/keymap/keymaps/hewlett-packard b/src/keymap/keymaps/hewlett-packard new file mode 100644 index 0000000000..4461fa2ce5 --- /dev/null +++ b/src/keymap/keymaps/hewlett-packard @@ -0,0 +1,12 @@ +0x81 fn_esc +0x89 battery # FnF8 +0x8A screenlock # FnF6 +0x8B camera +0x8C media # music +0x8E dvd +0xB1 help +0xB3 f23 # FIXME: Auto brightness +0xD7 wlan +0x92 brightnessdown # FnF7 (FnF9 on 6730b) +0x97 brightnessup # FnF8 (FnF10 on 6730b) +0xEE switchvideomode # FnF4 diff --git a/src/keymap/keymaps/hewlett-packard-2510p_2530p b/src/keymap/keymaps/hewlett-packard-2510p_2530p new file mode 100644 index 0000000000..41ad2e9b5a --- /dev/null +++ b/src/keymap/keymaps/hewlett-packard-2510p_2530p @@ -0,0 +1,2 @@ +0xD8 f23 # touchpad off +0xD9 f22 # touchpad on diff --git a/src/keymap/keymaps/hewlett-packard-compaq_elitebook b/src/keymap/keymaps/hewlett-packard-compaq_elitebook new file mode 100644 index 0000000000..42007c5483 --- /dev/null +++ b/src/keymap/keymaps/hewlett-packard-compaq_elitebook @@ -0,0 +1,2 @@ +0x88 presentation +0xD9 help # I key (high keycode: "info") diff --git a/src/keymap/keymaps/hewlett-packard-pavilion b/src/keymap/keymaps/hewlett-packard-pavilion new file mode 100644 index 0000000000..3d3cefc8e6 --- /dev/null +++ b/src/keymap/keymaps/hewlett-packard-pavilion @@ -0,0 +1,3 @@ +0x88 media # FIXME: quick play +0xD8 f23 # touchpad off +0xD9 f22 # touchpad on diff --git a/src/keymap/keymaps/hewlett-packard-presario-2100 b/src/keymap/keymaps/hewlett-packard-presario-2100 new file mode 100644 index 0000000000..1df39dcbd2 --- /dev/null +++ b/src/keymap/keymaps/hewlett-packard-presario-2100 @@ -0,0 +1,3 @@ +0xF0 help +0xF1 screenlock +0xF3 search diff --git a/src/keymap/keymaps/hewlett-packard-tablet b/src/keymap/keymaps/hewlett-packard-tablet new file mode 100644 index 0000000000..d19005ab90 --- /dev/null +++ b/src/keymap/keymaps/hewlett-packard-tablet @@ -0,0 +1,6 @@ +0x82 prog2 # Funny Key +0x83 prog1 # Q +0x84 tab +0x85 esc +0x86 pageup +0x87 pagedown diff --git a/src/keymap/keymaps/hewlett-packard-tx2 b/src/keymap/keymaps/hewlett-packard-tx2 new file mode 100644 index 0000000000..36a690fcf6 --- /dev/null +++ b/src/keymap/keymaps/hewlett-packard-tx2 @@ -0,0 +1,3 @@ +0xC2 media +0xD8 f23 # Toggle touchpad button on tx2 (OFF) +0xD9 f22 # Toggle touchpad button on tx2 (ON) diff --git a/src/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint b/src/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint new file mode 100644 index 0000000000..027e50bf88 --- /dev/null +++ b/src/keymap/keymaps/ibm-thinkpad-usb-keyboard-trackpoint @@ -0,0 +1,7 @@ +0x900f0 screenlock +0x900f1 wlan +0x900f2 switchvideomode +0x900f3 suspend +0x900f4 brightnessup +0x900f5 brightnessdown +0x900f8 zoom diff --git a/src/keymap/keymaps/inventec-symphony_6.0_7.0 b/src/keymap/keymaps/inventec-symphony_6.0_7.0 new file mode 100644 index 0000000000..4a8b4ba5a7 --- /dev/null +++ b/src/keymap/keymaps/inventec-symphony_6.0_7.0 @@ -0,0 +1,2 @@ +0xF3 prog2 +0xF4 prog1 diff --git a/src/keymap/keymaps/lenovo-3000 b/src/keymap/keymaps/lenovo-3000 new file mode 100644 index 0000000000..5bd165654a --- /dev/null +++ b/src/keymap/keymaps/lenovo-3000 @@ -0,0 +1,5 @@ +0x8B switchvideomode # Fn+F7 video +0x96 wlan # Fn+F5 wireless +0x97 sleep # Fn+F4 suspend +0x98 suspend # Fn+F12 hibernate +0xB4 prog1 # Lenovo Care diff --git a/src/keymap/keymaps/lenovo-ideapad b/src/keymap/keymaps/lenovo-ideapad new file mode 100644 index 0000000000..fc339839f2 --- /dev/null +++ b/src/keymap/keymaps/lenovo-ideapad @@ -0,0 +1,8 @@ +# Key codes observed on S10-3, assumed valid on other IdeaPad models +0x81 rfkill # does nothing in BIOS +0x83 display_off # BIOS toggles screen state +0xB9 brightnessup # does nothing in BIOS +0xBA brightnessdown # does nothing in BIOS +0xF1 camera # BIOS toggles camera power +0xf2 f21 # touchpad toggle (key alternately emits f2 and f3) +0xf3 f21 diff --git a/src/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint b/src/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint new file mode 100644 index 0000000000..47e8846a68 --- /dev/null +++ b/src/keymap/keymaps/lenovo-thinkpad-usb-keyboard-trackpoint @@ -0,0 +1,13 @@ +0x90012 screenlock # Fn+F2 +0x90013 battery # Fn+F3 +0x90014 wlan # Fn+F5 +0x90016 switchvideomode # Fn+F7 +0x90017 f21 # Fn+F8 touchpadtoggle +0x90019 suspend # Fn+F12 +0x9001A brightnessup # Fn+Home +0x9001B brightnessdown # Fn+End +0x9001D zoom # Fn+Space +0x90011 prog1 # Thinkvantage button + +0x90015 camera # Fn+F6 headset/camera VoIP key ?? +0x90010 micmute # Microphone mute button diff --git a/src/keymap/keymaps/lenovo-thinkpad_x200_tablet b/src/keymap/keymaps/lenovo-thinkpad_x200_tablet new file mode 100644 index 0000000000..31ea3b2c70 --- /dev/null +++ b/src/keymap/keymaps/lenovo-thinkpad_x200_tablet @@ -0,0 +1,6 @@ +0x5D menu +0x63 fn +0x66 screenlock +0x67 cyclewindows # bezel circular arrow +0x68 setup # bezel setup / menu +0x6c direction # rotate screen diff --git a/src/keymap/keymaps/lenovo-thinkpad_x6_tablet b/src/keymap/keymaps/lenovo-thinkpad_x6_tablet new file mode 100644 index 0000000000..6fd16b5662 --- /dev/null +++ b/src/keymap/keymaps/lenovo-thinkpad_x6_tablet @@ -0,0 +1,8 @@ +0x6C f21 # rotate +0x68 screenlock # screenlock +0x6B esc # escape +0x6D right # right on d-pad +0x6E left # left on d-pad +0x71 up # up on d-pad +0x6F down # down on d-pad +0x69 enter # enter on d-pad diff --git a/src/keymap/keymaps/lg-x110 b/src/keymap/keymaps/lg-x110 new file mode 100644 index 0000000000..ba08cba3fe --- /dev/null +++ b/src/keymap/keymaps/lg-x110 @@ -0,0 +1,12 @@ +0xA0 mute # Fn-F9 +0xAE volumedown # Fn-Left +0xAF search # Fn-F3 +0xB0 volumeup # Fn-Right +0xB1 battery # Fn-F10 Info +0xB3 suspend # Fn-F12 +0xDF sleep # Fn-F4 +# 0xE2 bluetooth # satellite dish2 +0xE4 f21 # Fn-F5 Touchpad disable +0xF6 wlan # Fn-F6 +0xF7 reserved # brightnessdown # Fn-Down +0xF8 reserved # brightnessup # Fn-Up diff --git a/src/keymap/keymaps/logitech-wave b/src/keymap/keymaps/logitech-wave new file mode 100644 index 0000000000..caa5d5d310 --- /dev/null +++ b/src/keymap/keymaps/logitech-wave @@ -0,0 +1,16 @@ +0x9001C scale #expo +0x9001F zoomout #zoom out +0x90020 zoomin #zoom in +0x9003D prog1 #gadget +0x90005 camera #camera +0x90018 media #media center +0x90041 wordprocessor #fn+f1 (word) +0x90042 spreadsheet #fn+f2 (excel) +0x90043 calendar #fn+f3 (calendar) +0x90044 prog2 #fn+f4 (program a) +0x90045 prog3 #fn+f5 (program b) +0x90046 prog4 #fn+f6 (program c) +0x90048 messenger #fn+f8 (msn messenger) +0x9002D find #fn+f10 (search www) +0x9004B search #fn+f11 (search pc) +0x9004C ejectclosecd #fn+f12 (eject) diff --git a/src/keymap/keymaps/logitech-wave-cordless b/src/keymap/keymaps/logitech-wave-cordless new file mode 100644 index 0000000000..a10dad5e4d --- /dev/null +++ b/src/keymap/keymaps/logitech-wave-cordless @@ -0,0 +1,15 @@ +0xD4 zoomin +0xCC zoomout +0xC0183 media +0xC1005 camera +0xC101F zoomout +0xC1020 zoomin +0xC1041 wordprocessor +0xC1042 spreadsheet +0xC1043 calendar +0xC1044 prog2 #fn+f4 (program a) +0xC1045 prog3 #fn+f5 (program b) +0xC1046 prog4 #fn+f6 (program c) +0xC1048 messenger +0xC104A find #fn+f10 (search www) +0xC104C ejectclosecd diff --git a/src/keymap/keymaps/logitech-wave-pro-cordless b/src/keymap/keymaps/logitech-wave-pro-cordless new file mode 100644 index 0000000000..e7aa02206c --- /dev/null +++ b/src/keymap/keymaps/logitech-wave-pro-cordless @@ -0,0 +1,12 @@ +0xC01B6 camera +0xC0183 media +0xC0184 wordprocessor +0xC0186 spreadsheet +0xC018E calendar +0xC0223 homepage +0xC01BC messenger +0xC018A mail +0xC0221 search +0xC00B8 ejectcd +0xC022D zoomin +0xC022E zoomout diff --git a/src/keymap/keymaps/maxdata-pro_7000 b/src/keymap/keymaps/maxdata-pro_7000 new file mode 100644 index 0000000000..c0e4f77af4 --- /dev/null +++ b/src/keymap/keymaps/maxdata-pro_7000 @@ -0,0 +1,9 @@ +0x97 prog2 +0x9F prog1 +0xA0 mute # Fn-F5 +0x82 www +0xEC email +0xAE volumedown # Fn-Down +0xB0 volumeup # Fn-Up +0xDF suspend # Fn+F2 +0xF5 help diff --git a/src/keymap/keymaps/medion-fid2060 b/src/keymap/keymaps/medion-fid2060 new file mode 100644 index 0000000000..5a76c76799 --- /dev/null +++ b/src/keymap/keymaps/medion-fid2060 @@ -0,0 +1,2 @@ +0x6B channeldown # Thottle Down +0x6D channelup # Thottle Up diff --git a/src/keymap/keymaps/medionnb-a555 b/src/keymap/keymaps/medionnb-a555 new file mode 100644 index 0000000000..c3b5dfa60b --- /dev/null +++ b/src/keymap/keymaps/medionnb-a555 @@ -0,0 +1,4 @@ +0x63 www # N button +0x66 prog1 # link 1 button +0x67 email # envelope button +0x69 prog2 # link 2 button diff --git a/src/keymap/keymaps/micro-star b/src/keymap/keymaps/micro-star new file mode 100644 index 0000000000..4a438698ed --- /dev/null +++ b/src/keymap/keymaps/micro-star @@ -0,0 +1,13 @@ +0xA0 mute # Fn-F9 +0xAE volumedown # Fn-F7 +0xB0 volumeup # Fn-F8 +0xB2 www # e button +0xDF sleep # Fn-F12 +0xE2 bluetooth # satellite dish2 +0xE4 f21 # Fn-F3 Touchpad disable +0xEC email # envelope button +0xEE camera # Fn-F6 camera disable +0xF6 wlan # satellite dish1 +0xF7 brightnessdown # Fn-F4 +0xF8 brightnessup # Fn-F5 +0xF9 search diff --git a/src/keymap/keymaps/module-asus-w3j b/src/keymap/keymaps/module-asus-w3j new file mode 100644 index 0000000000..773e0b3e82 --- /dev/null +++ b/src/keymap/keymaps/module-asus-w3j @@ -0,0 +1,11 @@ +0x41 nextsong +0x45 playpause +0x43 stopcd +0x40 previoussong +0x4C ejectclosecd +0x32 mute +0x31 volumedown +0x30 volumeup +0x5D wlan +0x7E bluetooth +0x8A media # high keycode: "tv" diff --git a/src/keymap/keymaps/module-ibm b/src/keymap/keymaps/module-ibm new file mode 100644 index 0000000000..a92dfa2506 --- /dev/null +++ b/src/keymap/keymaps/module-ibm @@ -0,0 +1,16 @@ +0x01 battery # Fn+F2 +0x02 screenlock # Fn+F3 +0x03 sleep # Fn+F4 +0x04 wlan # Fn+F5 +0x06 switchvideomode # Fn+F7 +0x07 zoom # Fn+F8 screen expand +0x08 f24 # Fn+F9 undock +0x0B suspend # Fn+F12 +0x0F brightnessup # Fn+Home +0x10 brightnessdown # Fn+End +0x11 kbdillumtoggle # Fn+PgUp - ThinkLight +0x13 zoom # Fn+Space +0x14 volumeup +0x15 volumedown +0x16 mute +0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") diff --git a/src/keymap/keymaps/module-lenovo b/src/keymap/keymaps/module-lenovo new file mode 100644 index 0000000000..8e38883091 --- /dev/null +++ b/src/keymap/keymaps/module-lenovo @@ -0,0 +1,17 @@ +0x1 screenlock # Fn+F2 +0x2 battery # Fn+F3 +0x3 sleep # Fn+F4 +0x4 wlan # Fn+F5 +0x6 switchvideomode # Fn+F7 +0x7 f21 # Fn+F8 touchpadtoggle +0x8 f24 # Fn+F9 undock +0xB suspend # Fn+F12 +0xF brightnessup # Fn+Home +0x10 brightnessdown # Fn+End +0x11 kbdillumtoggle # Fn+PgUp - ThinkLight +0x13 zoom # Fn+Space +0x14 volumeup +0x15 volumedown +0x16 mute +0x17 prog1 # ThinkPad/ThinkVantage button (high keycode: "vendor") +0x1A micmute # Microphone mute diff --git a/src/keymap/keymaps/module-sony b/src/keymap/keymaps/module-sony new file mode 100644 index 0000000000..7c000131d1 --- /dev/null +++ b/src/keymap/keymaps/module-sony @@ -0,0 +1,8 @@ +0x06 mute # Fn+F2 +0x07 volumedown # Fn+F3 +0x08 volumeup # Fn+F4 +0x09 brightnessdown # Fn+F5 +0x0A brightnessup # Fn+F6 +0x0B switchvideomode # Fn+F7 +0x0E zoom # Fn+F10 +0x10 suspend # Fn+F12 diff --git a/src/keymap/keymaps/module-sony-old b/src/keymap/keymaps/module-sony-old new file mode 100644 index 0000000000..596a34258a --- /dev/null +++ b/src/keymap/keymaps/module-sony-old @@ -0,0 +1,2 @@ +0x06 battery +0x07 mute diff --git a/src/keymap/keymaps/module-sony-vgn b/src/keymap/keymaps/module-sony-vgn new file mode 100644 index 0000000000..c8ba001516 --- /dev/null +++ b/src/keymap/keymaps/module-sony-vgn @@ -0,0 +1,8 @@ +0x00 brightnessdown # Fn+F5 +0x10 brightnessup # Fn+F6 +0x11 switchvideomode # Fn+F7 +0x12 zoomout +0x14 zoomin +0x15 suspend # Fn+F12 +0x17 prog1 +0x20 media diff --git a/src/keymap/keymaps/olpc-xo b/src/keymap/keymaps/olpc-xo new file mode 100644 index 0000000000..34434a121d --- /dev/null +++ b/src/keymap/keymaps/olpc-xo @@ -0,0 +1,74 @@ +0x59 fn +0x81 fn_esc +0xF9 camera +0xF8 sound # Fn-CAMERA = Mic + + +# Function key mappings, as per +# http://dev.laptop.org/ticket/10213#comment:20 +# +# Unmodified F1-F8 produce F1-F8, so no remap necessary. +# Unmodified F9-F12 control brightness and volume. +0x43 brightnessdown +0x44 brightnessup +0x57 volumedown +0x58 volumeup + +# fn-modified fkeys all produce the unmodified version of the key. +0xBB f1 +0xBC f2 +0xBD f3 +0xBE f4 +0xBF f5 +0xC0 f6 +0xC1 f7 +0xC2 f8 +0xC3 f9 +0xC4 f10 +0xD7 f11 +0xD8 f12 + + +# Using F13-F21 for the .5 F keys right now. +0xF7 f13 +0xF6 f14 +0xF5 f15 +0xF4 f16 +0xF3 f17 +0xF2 f18 +0xF1 f19 +0xF0 f20 +0xEF f21 + +0xEE chat +0xE4 chat # Just mapping Fn-Chat to Chat for now +0xDD menu # Frame +0xDA prog1 # Fn-Frame + +# The FN of some keys is other keys +0xD3 delete +0xD2 insert +0xC9 pageup +0xD1 pagedown +0xC7 home +0xCF end + +# Language key - don't ask what they are doing as KEY_HP +0x73 hp +0x7E hp + +0xDB leftmeta # left grab +0xDC rightmeta # right grab +0x85 rightmeta # Right grab releases on a different scancode +0xD6 kbdillumtoggle # Fn-space +0x69 switchvideomode # Brightness key + +# Game keys +0x65 kp8 # up +0x66 kp2 # down +0x67 kp4 # left +0x68 kp6 # right +0xE5 kp9 # pgup +0xE6 kp3 # pgdn +0xE7 kp7 # home +0xE8 kp1 # end diff --git a/src/keymap/keymaps/onkyo b/src/keymap/keymaps/onkyo new file mode 100644 index 0000000000..ee864ade4d --- /dev/null +++ b/src/keymap/keymaps/onkyo @@ -0,0 +1,14 @@ +0xA0 mute # Fn+D +0xAE volumedown # Fn+F +0xB0 volumeup # Fn+G +0xDF sleep # Fn+W +0xE0 bluetooth # Fn+H +0xE2 cyclewindows # Fn+Esc +0xEE battery # Fn+Q +0xF0 media # Fn+R +0xF5 switchvideomode # Fn+E +0xF6 camera # Fn+T +0xF7 f21 # Fn+Y (touchpad toggle) +0xF8 brightnessup # Fn+S +0xF9 brightnessdown # Fn+A +0xFB wlan # Fn+J diff --git a/src/keymap/keymaps/oqo-model2 b/src/keymap/keymaps/oqo-model2 new file mode 100644 index 0000000000..b7f4851abe --- /dev/null +++ b/src/keymap/keymaps/oqo-model2 @@ -0,0 +1,5 @@ +0x8E wlan +0xF0 switchvideomode +0xF1 mute +0xF2 volumedown +0xF3 volumeup diff --git a/src/keymap/keymaps/samsung-other b/src/keymap/keymaps/samsung-other new file mode 100644 index 0000000000..3ac0c2f10c --- /dev/null +++ b/src/keymap/keymaps/samsung-other @@ -0,0 +1,14 @@ +0x74 prog1 # User key +0x75 www +0x78 mail +0x82 switchvideomode # Fn+F4 CRT/LCD (high keycode: "displaytoggle") +0x83 battery # Fn+F2 +0x84 prog1 # Fn+F5 backlight on/off +0x86 wlan # Fn+F9 +0x88 brightnessup # Fn-Up +0x89 brightnessdown # Fn-Down +0xB1 prog2 # Fn+F7 run Samsung Magic Doctor (keypressed event is generated twice) +0xB3 prog3 # Fn+F8 switch power mode (battery/dynamic/performance) +0xB4 wlan # Fn+F9 (X60P) +0xF7 f22 # Fn+F10 Touchpad on +0xF9 f23 # Fn+F10 Touchpad off diff --git a/src/keymap/keymaps/samsung-sq1us b/src/keymap/keymaps/samsung-sq1us new file mode 100644 index 0000000000..ea2141ef84 --- /dev/null +++ b/src/keymap/keymaps/samsung-sq1us @@ -0,0 +1,7 @@ +0xD4 menu +0xD8 f1 +0xD9 f10 +0xD6 f3 +0xD7 f9 +0xE4 f5 +0xEE f11 diff --git a/src/keymap/keymaps/samsung-sx20s b/src/keymap/keymaps/samsung-sx20s new file mode 100644 index 0000000000..9d954ee415 --- /dev/null +++ b/src/keymap/keymaps/samsung-sx20s @@ -0,0 +1,4 @@ +0x74 mute +0x75 mute +0x77 f22 # Touchpad on +0x79 f23 # Touchpad off diff --git a/src/keymap/keymaps/toshiba-satellite_a100 b/src/keymap/keymaps/toshiba-satellite_a100 new file mode 100644 index 0000000000..22007be71b --- /dev/null +++ b/src/keymap/keymaps/toshiba-satellite_a100 @@ -0,0 +1,2 @@ +0xA4 stopcd +0xB2 www diff --git a/src/keymap/keymaps/toshiba-satellite_a110 b/src/keymap/keymaps/toshiba-satellite_a110 new file mode 100644 index 0000000000..1429409351 --- /dev/null +++ b/src/keymap/keymaps/toshiba-satellite_a110 @@ -0,0 +1,10 @@ +0x92 stop +0x93 www +0x94 media +0x9E f22 # Touchpad on +0x9F f23 # Touchpad off +0xB9 nextsong +0xD9 brightnessup +0xEE screenlock +0xF4 previoussong +0xF7 playpause diff --git a/src/keymap/keymaps/toshiba-satellite_m30x b/src/keymap/keymaps/toshiba-satellite_m30x new file mode 100644 index 0000000000..ae8e34941b --- /dev/null +++ b/src/keymap/keymaps/toshiba-satellite_m30x @@ -0,0 +1,6 @@ +0xef brightnessdown +0xd9 brightnessup +0xee screenlock +0x93 media +0x9e f22 #touchpad_enable +0x9f f23 #touchpad_disable diff --git a/src/keymap/keymaps/zepto-znote b/src/keymap/keymaps/zepto-znote new file mode 100644 index 0000000000..cf72fda47b --- /dev/null +++ b/src/keymap/keymaps/zepto-znote @@ -0,0 +1,11 @@ +0x93 switchvideomode # Fn+F3 Toggle Video Output +0x95 brightnessdown # Fn+F4 Brightness Down +0x91 brightnessup # Fn+F5 Brightness Up +0xA5 f23 # Fn+F6 Disable Touchpad +0xA6 f22 # Fn+F6 Enable Touchpad +0xA7 bluetooth # Fn+F10 Enable Bluetooth +0XA9 bluetooth # Fn+F10 Disable Bluetooth +0xF1 wlan # RF Switch Off +0xF2 wlan # RF Switch On +0xF4 prog1 # P1 Button +0xF3 prog2 # P2 Button diff --git a/src/libudev-queue.c b/src/libudev-queue.c index 7a4b563cfa..0e82cb6ae8 100644 --- a/src/libudev-queue.c +++ b/src/libudev-queue.c @@ -322,7 +322,7 @@ UDEV_EXPORT int udev_queue_get_queue_is_empty(struct udev_queue *udev_queue) seqnum_kernel = udev_queue_get_kernel_seqnum(udev_queue); if (seqnum_udev < seqnum_kernel) { dbg(udev_queue->udev, "queue is empty but kernel events still pending [%llu]<->[%llu]\n", - seqnum_kernel, seqnum_udev); + seqnum_kernel, seqnum_udev); goto out; } diff --git a/src/mtd_probe/.gitignore b/src/mtd_probe/.gitignore new file mode 100644 index 0000000000..82b8ab501f --- /dev/null +++ b/src/mtd_probe/.gitignore @@ -0,0 +1 @@ +mtd_probe diff --git a/src/mtd_probe/75-probe_mtd.rules b/src/mtd_probe/75-probe_mtd.rules new file mode 100644 index 0000000000..c0e0839785 --- /dev/null +++ b/src/mtd_probe/75-probe_mtd.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update + +ACTION!="add", GOTO="mtd_probe_end" + +KERNEL=="mtd*ro", IMPORT{program}="mtd_probe $devnode" +KERNEL=="mtd*ro", ENV{MTD_FTL}=="smartmedia", IMPORT{builtin}="kmod load sm_ftl" + +LABEL="mtd_probe_end" diff --git a/src/mtd_probe/mtd_probe.c b/src/mtd_probe/mtd_probe.c new file mode 100644 index 0000000000..1aa08d3851 --- /dev/null +++ b/src/mtd_probe/mtd_probe.c @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 - Maxim Levitsky + * + * mtd_probe 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; either version 2 of the License, or + * (at your option) any later version. + * + * mtd_probe 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 mtd_probe; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ +#include "mtd_probe.h" +#include +#include +#include +#include +#include +#include +#include +#include + +int main(int argc, char** argv) +{ + if (argc != 2) { + printf("usage: mtd_probe /dev/mtd[n]\n"); + return 1; + } + + int mtd_fd = open(argv[1], O_RDONLY); + if (mtd_fd == -1) { + perror("open"); + exit(-1); + } + + mtd_info_t mtd_info; + int error = ioctl(mtd_fd, MEMGETINFO, &mtd_info); + if (error == -1) { + perror("ioctl"); + exit(-1); + } + + probe_smart_media(mtd_fd, &mtd_info); + return -1; +} diff --git a/src/mtd_probe/mtd_probe.h b/src/mtd_probe/mtd_probe.h new file mode 100644 index 0000000000..2a37ede578 --- /dev/null +++ b/src/mtd_probe/mtd_probe.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2010 - Maxim Levitsky + * + * mtd_probe 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; either version 2 of the License, or + * (at your option) any later version. + * + * mtd_probe 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 mtd_probe; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include + +/* Full oob structure as written on the flash */ +struct sm_oob { + uint32_t reserved; + uint8_t data_status; + uint8_t block_status; + uint8_t lba_copy1[2]; + uint8_t ecc2[3]; + uint8_t lba_copy2[2]; + uint8_t ecc1[3]; +} __attribute__((packed)); + + +/* one sector is always 512 bytes, but it can consist of two nand pages */ +#define SM_SECTOR_SIZE 512 + +/* oob area is also 16 bytes, but might be from two pages */ +#define SM_OOB_SIZE 16 + +/* This is maximum zone size, and all devices that have more that one zone + have this size */ +#define SM_MAX_ZONE_SIZE 1024 + +/* support for small page nand */ +#define SM_SMALL_PAGE 256 +#define SM_SMALL_OOB_SIZE 8 + + +void probe_smart_media(int mtd_fd, mtd_info_t *info); diff --git a/src/mtd_probe/probe_smartmedia.c b/src/mtd_probe/probe_smartmedia.c new file mode 100644 index 0000000000..b3cdefc633 --- /dev/null +++ b/src/mtd_probe/probe_smartmedia.c @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2010 - Maxim Levitsky + * + * mtd_probe 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; either version 2 of the License, or + * (at your option) any later version. + * + * mtd_probe 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 mtd_probe; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mtd_probe.h" + +static const uint8_t cis_signature[] = { + 0x01, 0x03, 0xD9, 0x01, 0xFF, 0x18, 0x02, 0xDF, 0x01, 0x20 +}; + + +void probe_smart_media(int mtd_fd, mtd_info_t* info) +{ + char* cis_buffer = malloc(SM_SECTOR_SIZE); + + if (!cis_buffer) + return; + + if (info->type != MTD_NANDFLASH) + goto exit; + + int sector_size = info->writesize; + int block_size = info->erasesize; + int size_in_megs = info->size / (1024 * 1024); + int spare_count; + + + if (sector_size != SM_SECTOR_SIZE && sector_size != SM_SMALL_PAGE) + goto exit; + + switch(size_in_megs) { + case 1: + case 2: + spare_count = 6; + break; + case 4: + spare_count = 12; + break; + default: + spare_count = 24; + break; + } + + + int offset; + int cis_found = 0; + + for (offset = 0 ; offset < block_size * spare_count ; + offset += sector_size) { + + lseek(mtd_fd, SEEK_SET, offset); + if (read(mtd_fd, cis_buffer, SM_SECTOR_SIZE) == SM_SECTOR_SIZE){ + cis_found = 1; + break; + } + } + + if (!cis_found) + goto exit; + + if (memcmp(cis_buffer, cis_signature, sizeof(cis_signature)) != 0 && + (memcmp(cis_buffer + SM_SMALL_PAGE, cis_signature, + sizeof(cis_signature)) != 0)) + goto exit; + + printf("MTD_FTL=smartmedia\n"); + free(cis_buffer); + exit(0); +exit: + free(cis_buffer); + return; +} diff --git a/src/qemu/42-qemu-usb.rules b/src/qemu/42-qemu-usb.rules new file mode 100644 index 0000000000..a4e3864714 --- /dev/null +++ b/src/qemu/42-qemu-usb.rules @@ -0,0 +1,13 @@ +# +# Enable autosuspend for qemu emulated usb hid devices. +# +# Note that there are buggy qemu versions which advertise remote +# wakeup support but don't actually implement it correctly. This +# is the reason why we need a match for the serial number here. +# The serial number "42" is used to tag the implementations where +# remote wakeup is working. +# + +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" diff --git a/src/rule_generator/75-cd-aliases-generator.rules b/src/rule_generator/75-cd-aliases-generator.rules new file mode 100644 index 0000000000..e6da0101d6 --- /dev/null +++ b/src/rule_generator/75-cd-aliases-generator.rules @@ -0,0 +1,9 @@ +# these rules generate rules for the /dev/{cdrom,dvd,...} symlinks + +# the "path" of usb/ieee1394 devices changes frequently, use "id" +ACTION=="add", SUBSYSTEM=="block", SUBSYSTEMS=="usb|ieee1394", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", \ + PROGRAM="write_cd_rules by-id", SYMLINK+="%c", GOTO="persistent_cd_end" + +ACTION=="add", SUBSYSTEM=="block", ENV{ID_CDROM}=="?*", ENV{GENERATED}!="?*", PROGRAM="write_cd_rules", SYMLINK+="%c" + +LABEL="persistent_cd_end" diff --git a/src/rule_generator/75-persistent-net-generator.rules b/src/rule_generator/75-persistent-net-generator.rules new file mode 100644 index 0000000000..4f80573478 --- /dev/null +++ b/src/rule_generator/75-persistent-net-generator.rules @@ -0,0 +1,102 @@ +# do not edit this file, it will be overwritten on update + +# these rules generate rules for persistent network device naming +# +# variables used to communicate: +# MATCHADDR MAC address used for the match +# MATCHID bus_id used for the match +# MATCHDRV driver name used for the match +# MATCHIFTYPE interface type match +# COMMENT comment to add to the generated rule +# INTERFACE_NAME requested name supplied by external tool +# INTERFACE_NEW new interface name returned by rule writer + +ACTION!="add", GOTO="persistent_net_generator_end" +SUBSYSTEM!="net", GOTO="persistent_net_generator_end" + +# ignore the interface if a name has already been set +NAME=="?*", GOTO="persistent_net_generator_end" + +# device name whitelist +KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", GOTO="persistent_net_generator_end" + +# ignore Xen virtual interfaces +SUBSYSTEMS=="xen", GOTO="persistent_net_generator_end" + +# read MAC address +ENV{MATCHADDR}="$attr{address}" + +# match interface type +ENV{MATCHIFTYPE}="$attr{type}" + +# ignore KVM virtual interfaces +ENV{MATCHADDR}=="52:54:00:*", GOTO="persistent_net_generator_end" +# ignore VMWare virtual interfaces +ENV{MATCHADDR}=="00:0c:29:*|00:50:56:*", GOTO="persistent_net_generator_end" +# ignore Hyper-V virtual interfaces +ENV{MATCHADDR}=="00:15:5d:*", GOTO="persistent_net_generator_end" + +# These vendors are known to violate the local MAC address assignment scheme +# Interlan, DEC (UNIBUS or QBUS), Apollo, Cisco, Racal-Datacom +ENV{MATCHADDR}=="02:07:01:*", GOTO="globally_administered_whitelist" +# 3Com +ENV{MATCHADDR}=="02:60:60:*", GOTO="globally_administered_whitelist" +# 3Com IBM PC; Imagen; Valid; Cisco; Apple +ENV{MATCHADDR}=="02:60:8c:*", GOTO="globally_administered_whitelist" +# Intel +ENV{MATCHADDR}=="02:a0:c9:*", GOTO="globally_administered_whitelist" +# Olivetti +ENV{MATCHADDR}=="02:aa:3c:*", GOTO="globally_administered_whitelist" +# CMC Masscomp; Silicon Graphics; Prime EXL +ENV{MATCHADDR}=="02:cf:1f:*", GOTO="globally_administered_whitelist" +# Prominet Corporation Gigabit Ethernet Switch +ENV{MATCHADDR}=="02:e0:3b:*", GOTO="globally_administered_whitelist" +# BTI (Bus-Tech, Inc.) IBM Mainframes +ENV{MATCHADDR}=="02:e6:d3:*", GOTO="globally_administered_whitelist" +# Realtek +ENV{MATCHADDR}=="52:54:00:*", GOTO="globally_administered_whitelist" +# Novell 2000 +ENV{MATCHADDR}=="52:54:4c:*", GOTO="globally_administered_whitelist" +# Realtec +ENV{MATCHADDR}=="52:54:ab:*", GOTO="globally_administered_whitelist" +# Kingston Technologies +ENV{MATCHADDR}=="e2:0c:0f:*", GOTO="globally_administered_whitelist" +# Xensource +ENV{MATCHADDR}=="00:16:3e:*", GOTO="globally_administered_whitelist" + +# match interface dev_id +ATTR{dev_id}=="?*", ENV{MATCHDEVID}="$attr{dev_id}" + +# do not use "locally administered" MAC address +ENV{MATCHADDR}=="?[2367abef]:*", ENV{MATCHADDR}="" + +# do not use empty address +ENV{MATCHADDR}=="00:00:00:00:00:00", ENV{MATCHADDR}="" + +LABEL="globally_administered_whitelist" + +# build comment line for generated rule: +SUBSYSTEMS=="pci", ENV{COMMENT}="PCI device $attr{vendor}:$attr{device} ($driver)" +SUBSYSTEMS=="usb", ATTRS{idVendor}=="?*", ENV{COMMENT}="USB device 0x$attr{idVendor}:0x$attr{idProduct} ($driver)" +SUBSYSTEMS=="pcmcia", ENV{COMMENT}="PCMCIA device $attr{card_id}:$attr{manf_id} ($driver)" +SUBSYSTEMS=="ieee1394", ENV{COMMENT}="Firewire device $attr{host_id})" + +# ibmveth likes to use "locally administered" MAC addresses +DRIVERS=="ibmveth", ENV{MATCHADDR}="$attr{address}", ENV{COMMENT}="ibmveth ($id)" + +# S/390 uses id matches only, do not use MAC address match +SUBSYSTEMS=="ccwgroup", ENV{COMMENT}="S/390 $driver device at $id", ENV{MATCHID}="$id", ENV{MATCHDRV}="$driver", ENV{MATCHADDR}="" + +# see if we got enough data to create a rule +ENV{MATCHADDR}=="", ENV{MATCHID}=="", ENV{INTERFACE_NAME}=="", GOTO="persistent_net_generator_end" + +# default comment +ENV{COMMENT}=="", ENV{COMMENT}="net device ($attr{driver})" + +# write rule +DRIVERS=="?*", IMPORT{program}="write_net_rules" + +# rename interface if needed +ENV{INTERFACE_NEW}=="?*", NAME="$env{INTERFACE_NEW}" + +LABEL="persistent_net_generator_end" diff --git a/src/rule_generator/rule_generator.functions b/src/rule_generator/rule_generator.functions new file mode 100644 index 0000000000..2eec1b6abf --- /dev/null +++ b/src/rule_generator/rule_generator.functions @@ -0,0 +1,113 @@ +# functions used by the udev rule generator + +# Copyright (C) 2006 Marco d'Itri + +# 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, either version 2 of the License, or +# (at your option) any later version. + +# 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, see . + +PATH='/usr/bin:/bin:/usr/sbin:/sbin' + +# Read a single line from file $1 in the $DEVPATH directory. +# The function must not return an error even if the file does not exist. +sysread() { + local file="$1" + [ -e "/sys$DEVPATH/$file" ] || return 0 + local value + read value < "/sys$DEVPATH/$file" || return 0 + echo "$value" +} + +sysreadlink() { + local file="$1" + [ -e "/sys$DEVPATH/$file" ] || return 0 + readlink -f /sys$DEVPATH/$file 2> /dev/null || true +} + +# Return true if a directory is writeable. +writeable() { + if ln -s test-link $1/.is-writeable 2> /dev/null; then + rm -f $1/.is-writeable + return 0 + else + return 1 + fi +} + +# Create a lock file for the current rules file. +lock_rules_file() { + RUNDIR=$(udevadm info --run) + [ -e "$RUNDIR" ] || return 0 + + RULES_LOCK="$RUNDIR/.lock-${RULES_FILE##*/}" + + retry=30 + while ! mkdir $RULES_LOCK 2> /dev/null; do + if [ $retry -eq 0 ]; then + echo "Cannot lock $RULES_FILE!" >&2 + exit 2 + fi + sleep 1 + retry=$(($retry - 1)) + done +} + +unlock_rules_file() { + [ "$RULES_LOCK" ] || return 0 + rmdir $RULES_LOCK || true +} + +# Choose the real rules file if it is writeable or a temporary file if not. +# Both files should be checked later when looking for existing rules. +choose_rules_file() { + RUNDIR=$(udevadm info --run) + local tmp_rules_file="$RUNDIR/tmp-rules--${RULES_FILE##*/}" + [ -e "$RULES_FILE" -o -e "$tmp_rules_file" ] || PRINT_HEADER=1 + + if writeable ${RULES_FILE%/*}; then + RO_RULES_FILE='/dev/null' + else + RO_RULES_FILE=$RULES_FILE + RULES_FILE=$tmp_rules_file + fi +} + +# Return the name of the first free device. +raw_find_next_available() { + local links="$1" + + local basename=${links%%[ 0-9]*} + local max=-1 + for name in $links; do + local num=${name#$basename} + [ "$num" ] || num=0 + [ $num -gt $max ] && max=$num + done + + local max=$(($max + 1)) + # "name0" actually is just "name" + [ $max -eq 0 ] && return + echo "$max" +} + +# Find all rules matching a key (with action) and a pattern. +find_all_rules() { + local key="$1" + local linkre="$2" + local match="$3" + + local search='.*[[:space:],]'"$key"'"('"$linkre"')".*' + echo $(sed -n -r -e 's/^#.*//' -e "${match}s/${search}/\1/p" \ + $RO_RULES_FILE \ + $([ -e $RULES_FILE ] && echo $RULES_FILE) \ + 2>/dev/null) +} diff --git a/src/rule_generator/write_cd_rules b/src/rule_generator/write_cd_rules new file mode 100644 index 0000000000..645b9cd521 --- /dev/null +++ b/src/rule_generator/write_cd_rules @@ -0,0 +1,126 @@ +#!/bin/sh -e + +# This script is run if an optical drive lacks a rule for persistent naming. +# +# It adds symlinks for optical drives based on the device class determined +# by cdrom_id and used ID_PATH to identify the device. + +# (C) 2006 Marco d'Itri +# +# 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, either version 2 of the License, or +# (at your option) any later version. + +# 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, see . + +# debug, if UDEV_LOG= +if [ -n "$UDEV_LOG" ]; then + if [ "$UDEV_LOG" -ge 7 ]; then + set -x + fi +fi + +RULES_FILE="/etc/udev/rules.d/70-persistent-cd.rules" + +. /lib/udev/rule_generator.functions + +find_next_available() { + raw_find_next_available "$(find_all_rules 'SYMLINK\+=' "$1")" +} + +write_rule() { + local match="$1" + local link="$2" + local comment="$3" + + { + if [ "$PRINT_HEADER" ]; then + PRINT_HEADER= + echo "# This file was automatically generated by the $0" + echo "# program, run by the cd-aliases-generator.rules rules file." + echo "#" + echo "# You can modify it, as long as you keep each rule on a single" + echo "# line, and set the \$GENERATED variable." + echo "" + fi + + [ "$comment" ] && echo "# $comment" + echo "$match, SYMLINK+=\"$link\", ENV{GENERATED}=\"1\"" + } >> $RULES_FILE + SYMLINKS="$SYMLINKS $link" +} + +if [ -z "$DEVPATH" ]; then + echo "Missing \$DEVPATH." >&2 + exit 1 +fi +if [ -z "$ID_CDROM" ]; then + echo "$DEVPATH is not a CD reader." >&2 + exit 1 +fi + +if [ "$1" ]; then + METHOD="$1" +else + METHOD='by-path' +fi + +case "$METHOD" in + by-path) + if [ -z "$ID_PATH" ]; then + echo "$DEVPATH not supported by path_id. by-id may work." >&2 + exit 1 + fi + RULE="ENV{ID_PATH}==\"$ID_PATH\"" + ;; + + by-id) + if [ "$ID_SERIAL" ]; then + RULE="ENV{ID_SERIAL}==\"$ID_SERIAL\"" + elif [ "$ID_MODEL" -a "$ID_REVISION" ]; then + RULE="ENV{ID_MODEL}==\"$ID_MODEL\", ENV{ID_REVISION}==\"$ID_REVISION\"" + else + echo "$DEVPATH not supported by ata_id. by-path may work." >&2 + exit 1 + fi + ;; + + *) + echo "Invalid argument (must be either by-path or by-id)." >&2 + exit 1 + ;; +esac + +# Prevent concurrent processes from modifying the file at the same time. +lock_rules_file + +# Check if the rules file is writeable. +choose_rules_file + +link_num=$(find_next_available 'cdrom[0-9]*') + +match="SUBSYSTEM==\"block\", ENV{ID_CDROM}==\"?*\", $RULE" + +comment="$ID_MODEL ($ID_PATH)" + + write_rule "$match" "cdrom$link_num" "$comment" +[ "$ID_CDROM_CD_R" -o "$ID_CDROM_CD_RW" ] && \ + write_rule "$match" "cdrw$link_num" +[ "$ID_CDROM_DVD" ] && \ + write_rule "$match" "dvd$link_num" +[ "$ID_CDROM_DVD_R" -o "$ID_CDROM_DVD_RW" -o "$ID_CDROM_DVD_RAM" ] && \ + write_rule "$match" "dvdrw$link_num" +echo >> $RULES_FILE + +unlock_rules_file + +echo $SYMLINKS + +exit 0 diff --git a/src/rule_generator/write_net_rules b/src/rule_generator/write_net_rules new file mode 100644 index 0000000000..bcea4b09dc --- /dev/null +++ b/src/rule_generator/write_net_rules @@ -0,0 +1,141 @@ +#!/bin/sh -e + +# This script is run to create persistent network device naming rules +# based on properties of the device. +# If the interface needs to be renamed, INTERFACE_NEW= will be printed +# on stdout to allow udev to IMPORT it. + +# variables used to communicate: +# MATCHADDR MAC address used for the match +# MATCHID bus_id used for the match +# MATCHDEVID dev_id used for the match +# MATCHDRV driver name used for the match +# MATCHIFTYPE interface type match +# COMMENT comment to add to the generated rule +# INTERFACE_NAME requested name supplied by external tool +# INTERFACE_NEW new interface name returned by rule writer + +# Copyright (C) 2006 Marco d'Itri +# Copyright (C) 2007 Kay Sievers +# +# 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, either version 2 of the License, or +# (at your option) any later version. +# +# 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, see . + +# debug, if UDEV_LOG= +if [ -n "$UDEV_LOG" ]; then + if [ "$UDEV_LOG" -ge 7 ]; then + set -x + fi +fi + +RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules' + +. /lib/udev/rule_generator.functions + +interface_name_taken() { + local value="$(find_all_rules 'NAME=' $INTERFACE)" + if [ "$value" ]; then + return 0 + else + return 1 + fi +} + +find_next_available() { + raw_find_next_available "$(find_all_rules 'NAME=' "$1")" +} + +write_rule() { + local match="$1" + local name="$2" + local comment="$3" + + { + if [ "$PRINT_HEADER" ]; then + PRINT_HEADER= + echo "# This file was automatically generated by the $0" + echo "# program, run by the persistent-net-generator.rules rules file." + echo "#" + echo "# You can modify it, as long as you keep each rule on a single" + echo "# line, and change only the value of the NAME= key." + fi + + echo "" + [ "$comment" ] && echo "# $comment" + echo "SUBSYSTEM==\"net\", ACTION==\"add\"$match, NAME=\"$name\"" + } >> $RULES_FILE +} + +if [ -z "$INTERFACE" ]; then + echo "missing \$INTERFACE" >&2 + exit 1 +fi + +# Prevent concurrent processes from modifying the file at the same time. +lock_rules_file + +# Check if the rules file is writeable. +choose_rules_file + +# the DRIVERS key is needed to not match bridges and VLAN sub-interfaces +if [ "$MATCHADDR" ]; then + match="$match, DRIVERS==\"?*\", ATTR{address}==\"$MATCHADDR\"" +fi + +if [ "$MATCHDRV" ]; then + match="$match, DRIVERS==\"$MATCHDRV\"" +fi + +if [ "$MATCHDEVID" ]; then + match="$match, ATTR{dev_id}==\"$MATCHDEVID\"" +fi + +if [ "$MATCHID" ]; then + match="$match, KERNELS==\"$MATCHID\"" +fi + +if [ "$MATCHIFTYPE" ]; then + match="$match, ATTR{type}==\"$MATCHIFTYPE\"" +fi + +if [ -z "$match" ]; then + echo "missing valid match" >&2 + unlock_rules_file + exit 1 +fi + +basename=${INTERFACE%%[0-9]*} +match="$match, KERNEL==\"$basename*\"" + +if [ "$INTERFACE_NAME" ]; then + # external tools may request a custom name + COMMENT="$COMMENT (custom name provided by external tool)" + if [ "$INTERFACE_NAME" != "$INTERFACE" ]; then + INTERFACE=$INTERFACE_NAME; + echo "INTERFACE_NEW=$INTERFACE" + fi +else + # if a rule using the current name already exists, find a new name + if interface_name_taken; then + INTERFACE="$basename$(find_next_available "$basename[0-9]*")" + # prevent INTERFACE from being "eth" instead of "eth0" + [ "$INTERFACE" = "${INTERFACE%%[ \[\]0-9]*}" ] && INTERFACE=${INTERFACE}0 + echo "INTERFACE_NEW=$INTERFACE" + fi +fi + +write_rule "$match" "$INTERFACE" "$COMMENT" + +unlock_rules_file + +exit 0 diff --git a/src/scsi_id/.gitignore b/src/scsi_id/.gitignore new file mode 100644 index 0000000000..10e9ae743c --- /dev/null +++ b/src/scsi_id/.gitignore @@ -0,0 +1,3 @@ +scsi_id +scsi_id.8 +scsi_id_version.h diff --git a/src/scsi_id/README b/src/scsi_id/README new file mode 100644 index 0000000000..9cfe73991c --- /dev/null +++ b/src/scsi_id/README @@ -0,0 +1,4 @@ +scsi_id - generate a SCSI unique identifier for a given SCSI device + +Please send questions, comments or patches to or +. diff --git a/src/scsi_id/scsi.h b/src/scsi_id/scsi.h new file mode 100644 index 0000000000..c423cac574 --- /dev/null +++ b/src/scsi_id/scsi.h @@ -0,0 +1,97 @@ +/* + * scsi.h + * + * General scsi and linux scsi specific defines and structs. + * + * Copyright (C) IBM Corp. 2003 + * + * 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. + */ + +#include + +struct scsi_ioctl_command { + unsigned int inlen; /* excluding scsi command length */ + unsigned int outlen; + unsigned char data[1]; + /* on input, scsi command starts here then opt. data */ +}; + +/* + * Default 5 second timeout + */ +#define DEF_TIMEOUT 5000 + +#define SENSE_BUFF_LEN 32 + +/* + * The request buffer size passed to the SCSI INQUIRY commands, use 254, + * as this is a nice value for some devices, especially some of the usb + * mass storage devices. + */ +#define SCSI_INQ_BUFF_LEN 254 + +/* + * SCSI INQUIRY vendor and model (really product) lengths. + */ +#define VENDOR_LENGTH 8 +#define MODEL_LENGTH 16 + +#define INQUIRY_CMD 0x12 +#define INQUIRY_CMDLEN 6 + +/* + * INQUIRY VPD page 0x83 identifier descriptor related values. Reference the + * SCSI Primary Commands specification for details. + */ + +/* + * id type values of id descriptors. These are assumed to fit in 4 bits. + */ +#define SCSI_ID_VENDOR_SPECIFIC 0 +#define SCSI_ID_T10_VENDOR 1 +#define SCSI_ID_EUI_64 2 +#define SCSI_ID_NAA 3 +#define SCSI_ID_RELPORT 4 +#define SCSI_ID_TGTGROUP 5 +#define SCSI_ID_LUNGROUP 6 +#define SCSI_ID_MD5 7 +#define SCSI_ID_NAME 8 + +/* + * Supported NAA values. These fit in 4 bits, so the "don't care" value + * cannot conflict with real values. + */ +#define SCSI_ID_NAA_DONT_CARE 0xff +#define SCSI_ID_NAA_IEEE_REG 5 +#define SCSI_ID_NAA_IEEE_REG_EXTENDED 6 + +/* + * Supported Code Set values. + */ +#define SCSI_ID_BINARY 1 +#define SCSI_ID_ASCII 2 + +struct scsi_id_search_values { + u_char id_type; + u_char naa_type; + u_char code_set; +}; + +/* + * Following are the "true" SCSI status codes. Linux has traditionally + * used a 1 bit right and masked version of these. So now CHECK_CONDITION + * and friends (in ) are deprecated. + */ +#define SCSI_CHECK_CONDITION 0x2 +#define SCSI_CONDITION_MET 0x4 +#define SCSI_BUSY 0x8 +#define SCSI_IMMEDIATE 0x10 +#define SCSI_IMMEDIATE_CONDITION_MET 0x14 +#define SCSI_RESERVATION_CONFLICT 0x18 +#define SCSI_COMMAND_TERMINATED 0x22 +#define SCSI_TASK_SET_FULL 0x28 +#define SCSI_ACA_ACTIVE 0x30 +#define SCSI_TASK_ABORTED 0x40 diff --git a/src/scsi_id/scsi_id.8 b/src/scsi_id/scsi_id.8 new file mode 100644 index 0000000000..0d4dba9149 --- /dev/null +++ b/src/scsi_id/scsi_id.8 @@ -0,0 +1,119 @@ +.TH SCSI_ID 8 "December 2003" "" "Linux Administrator's Manual" +.SH NAME +scsi_id \- retrieve and generate a unique SCSI identifier +.SH SYNOPSIS +.BI scsi_id +[\fIoptions\fP] +.SH "DESCRIPTION" +.B scsi_id +queries a SCSI device via the SCSI INQUIRY vital product data (VPD) page 0x80 or +0x83 and uses the resulting data to generate a value that is unique across +all SCSI devices that properly support page 0x80 or page 0x83. + +If a result is generated it is sent to standard output, and the program +exits with a zero value. If no identifier is output, the program exits +with a non\-zero value. + +\fBscsi_id\fP is primarily for use by other utilities such as \fBudev\fP +that require a unique SCSI identifier. + +By default all devices are assumed black listed, the \fB\-\-whitelisted\fP option must +be specified on the command line or in the config file for any useful +behaviour. + +SCSI commands are sent directly to the device via the SG_IO ioctl +interface. + +In order to generate unique values for either page 0x80 or page 0x83, the +serial numbers or world wide names are prefixed as follows. + +Identifiers based on page 0x80 are prefixed by the character 'S', the SCSI +vendor, the SCSI product (model) and then the the serial number returned +by page 0x80. For example: + +.sp +.nf +# /usr/lib/udev/scsi_id \-\-page=0x80 \-\-whitelisted \-\-device=/dev/sda +SIBM 3542 1T05078453 +.fi +.P + +Identifiers based on page 0x83 are prefixed by the identifier type +followed by the page 0x83 identifier. For example, a device with a NAA +(Name Address Authority) type of 3 (also in this case the page 0x83 +identifier starts with the NAA value of 6): + +.sp +.nf +# /usr/lib/udev/scsi_id \-\-page=0x83 \-\-whitelisted \-\-device=/dev/sda +3600a0b80000b174b000000d63efc5c8c +.fi +.P + +.SH OPTIONS +.TP +.BI \-\-blacklisted +The default behaviour \- treat the device as black listed, and do nothing +unless a white listed device is found in the scsi_id config\-file. +.TP +.BI \-\-device=\| device\^ +Send SG_IO commands to \fBdevice\fP, such as \fB/dev/sdc\fP. +.TP +.BI \-\-config=\| config\-file +Read configuration and black/white list entries from +.B config\-file +rather than the default +.B /etc/scsi_id.config +file. +.TP +.BI \-\-whitelisted +Treat the device as white listed. The \fB\-\-whitelisted\fP option must be specified +on the command line or in the scsi_id configuration file for +.B scsi_id +to generate any output. +.TP +.BI \-\-page=\| 0x80 | 0x83 | pre-spc3-83 +Use SCSI INQUIRY VPD page code 0x80, 0x83, or pre-spc3-83. +.sp +The default +behaviour is to query the available VPD pages, and use page 0x83 if found, +else page 0x80 if found, else nothing. +.sp +Page pre-spc3-83 should only be utilized for those scsi devices which +are not compliant with the SPC-2 or SPC-3 format for page 83. While this +option is used for older model 4, 5, and 6 EMC Symmetrix devices, its +use with SPC-2 or SPC-3 compliant devices will fallback to the page 83 +format supported by these devices. +.TP +.BI \-\-replace-whitespace +Reformat the output : replace all whitespaces by underscores. +.TP +.BI \-\-export +Export all data in KEY= format used to import in other programs. +.TP +.BI \-\-verbose +Generate verbose debugging output. +.TP +.BI \-\-version +Display version number and exit. +.RE + +.SH "FILES" +.nf +.ft B +.ft +.TP +\fI/etc/scsi_id.config\fP +Configuration of black/white list entries and per device options: +# one config per line, short match strings match longer strings +# vendor=string[,model=string],options= +vendor="ATA",options=-p 0x80 +.RE +.fi +.LP +.SH "SEE ALSO" +.BR udev (7) +.SH AUTHORS +Developed by Patrick Mansfield based on SCSI ID +source included in earlier linux 2.5 kernels, sg_utils source, and SCSI +specifications. diff --git a/src/scsi_id/scsi_id.c b/src/scsi_id/scsi_id.c new file mode 100644 index 0000000000..9bb0d7f538 --- /dev/null +++ b/src/scsi_id/scsi_id.c @@ -0,0 +1,657 @@ +/* + * Copyright (C) IBM Corp. 2003 + * Copyright (C) SUSE Linux Products GmbH, 2006 + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "scsi_id.h" + +static const struct option options[] = { + { "device", required_argument, NULL, 'd' }, + { "config", required_argument, NULL, 'f' }, + { "page", required_argument, NULL, 'p' }, + { "blacklisted", no_argument, NULL, 'b' }, + { "whitelisted", no_argument, NULL, 'g' }, + { "replace-whitespace", no_argument, NULL, 'u' }, + { "sg-version", required_argument, NULL, 's' }, + { "verbose", no_argument, NULL, 'v' }, + { "version", no_argument, NULL, 'V' }, + { "export", no_argument, NULL, 'x' }, + { "help", no_argument, NULL, 'h' }, + {} +}; + +static const char short_options[] = "d:f:ghip:uvVx"; +static const char dev_short_options[] = "bgp:"; + +static int all_good; +static int dev_specified; +static char config_file[MAX_PATH_LEN] = SYSCONFDIR "/scsi_id.config"; +static enum page_code default_page_code; +static int sg_version = 4; +static int use_stderr; +static int debug; +static int reformat_serial; +static int export; +static char vendor_str[64]; +static char model_str[64]; +static char vendor_enc_str[256]; +static char model_enc_str[256]; +static char revision_str[16]; +static char type_str[16]; + +static void log_fn(struct udev *udev, int priority, + const char *file, int line, const char *fn, + const char *format, va_list args) +{ + vsyslog(priority, format, args); +} + +static void set_type(const char *from, char *to, size_t len) +{ + int type_num; + char *eptr; + char *type = "generic"; + + type_num = strtoul(from, &eptr, 0); + if (eptr != from) { + switch (type_num) { + case 0: + type = "disk"; + break; + case 1: + type = "tape"; + break; + case 4: + type = "optical"; + break; + case 5: + type = "cd"; + break; + case 7: + type = "optical"; + break; + case 0xe: + type = "disk"; + break; + case 0xf: + type = "optical"; + break; + default: + break; + } + } + util_strscpy(to, len, type); +} + +/* + * get_value: + * + * buf points to an '=' followed by a quoted string ("foo") or a string ending + * with a space or ','. + * + * Return a pointer to the NUL terminated string, returns NULL if no + * matches. + */ +static char *get_value(char **buffer) +{ + static char *quote_string = "\"\n"; + static char *comma_string = ",\n"; + char *val; + char *end; + + if (**buffer == '"') { + /* + * skip leading quote, terminate when quote seen + */ + (*buffer)++; + end = quote_string; + } else { + end = comma_string; + } + val = strsep(buffer, end); + if (val && end == quote_string) + /* + * skip trailing quote + */ + (*buffer)++; + + while (isspace(**buffer)) + (*buffer)++; + + return val; +} + +static int argc_count(char *opts) +{ + int i = 0; + while (*opts != '\0') + if (*opts++ == ' ') + i++; + return i; +} + +/* + * get_file_options: + * + * If vendor == NULL, find a line in the config file with only "OPTIONS="; + * if vendor and model are set find the first OPTIONS line in the config + * file that matches. Set argc and argv to match the OPTIONS string. + * + * vendor and model can end in '\n'. + */ +static int get_file_options(struct udev *udev, + const char *vendor, const char *model, + int *argc, char ***newargv) +{ + char *buffer; + FILE *fd; + char *buf; + char *str1; + char *vendor_in, *model_in, *options_in; /* read in from file */ + int lineno; + int c; + int retval = 0; + + dbg(udev, "vendor='%s'; model='%s'\n", vendor, model); + fd = fopen(config_file, "r"); + if (fd == NULL) { + dbg(udev, "can't open %s\n", config_file); + if (errno == ENOENT) { + return 1; + } else { + err(udev, "can't open %s: %s\n", config_file, strerror(errno)); + return -1; + } + } + + /* + * Allocate a buffer rather than put it on the stack so we can + * keep it around to parse any options (any allocated newargv + * points into this buffer for its strings). + */ + buffer = malloc(MAX_BUFFER_LEN); + if (!buffer) { + fclose(fd); + err(udev, "can't allocate memory\n"); + return -1; + } + + *newargv = NULL; + lineno = 0; + while (1) { + vendor_in = model_in = options_in = NULL; + + buf = fgets(buffer, MAX_BUFFER_LEN, fd); + if (buf == NULL) + break; + lineno++; + if (buf[strlen(buffer) - 1] != '\n') { + err(udev, "Config file line %d too long\n", lineno); + break; + } + + while (isspace(*buf)) + buf++; + + /* blank or all whitespace line */ + if (*buf == '\0') + continue; + + /* comment line */ + if (*buf == '#') + continue; + + dbg(udev, "lineno %d: '%s'\n", lineno, buf); + str1 = strsep(&buf, "="); + if (str1 && strcasecmp(str1, "VENDOR") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + vendor_in = str1; + + str1 = strsep(&buf, "="); + if (str1 && strcasecmp(str1, "MODEL") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + model_in = str1; + str1 = strsep(&buf, "="); + } + } + + if (str1 && strcasecmp(str1, "OPTIONS") == 0) { + str1 = get_value(&buf); + if (!str1) { + retval = -1; + break; + } + options_in = str1; + } + dbg(udev, "config file line %d:\n" + " vendor '%s'; model '%s'; options '%s'\n", + lineno, vendor_in, model_in, options_in); + /* + * Only allow: [vendor=foo[,model=bar]]options=stuff + */ + if (!options_in || (!vendor_in && model_in)) { + err(udev, "Error parsing config file line %d '%s'\n", lineno, buffer); + retval = -1; + break; + } + if (vendor == NULL) { + if (vendor_in == NULL) { + dbg(udev, "matched global option\n"); + break; + } + } else if ((vendor_in && strncmp(vendor, vendor_in, + strlen(vendor_in)) == 0) && + (!model_in || (strncmp(model, model_in, + strlen(model_in)) == 0))) { + /* + * Matched vendor and optionally model. + * + * Note: a short vendor_in or model_in can + * give a partial match (that is FOO + * matches FOOBAR). + */ + dbg(udev, "matched vendor/model\n"); + break; + } else { + dbg(udev, "no match\n"); + } + } + + if (retval == 0) { + if (vendor_in != NULL || model_in != NULL || + options_in != NULL) { + /* + * Something matched. Allocate newargv, and store + * values found in options_in. + */ + strcpy(buffer, options_in); + c = argc_count(buffer) + 2; + *newargv = calloc(c, sizeof(**newargv)); + if (!*newargv) { + err(udev, "can't allocate memory\n"); + retval = -1; + } else { + *argc = c; + c = 0; + /* + * argv[0] at 0 is skipped by getopt, but + * store the buffer address there for + * later freeing + */ + (*newargv)[c] = buffer; + for (c = 1; c < *argc; c++) + (*newargv)[c] = strsep(&buffer, " \t"); + } + } else { + /* No matches */ + retval = 1; + } + } + if (retval != 0) + free(buffer); + fclose(fd); + return retval; +} + +static int set_options(struct udev *udev, + int argc, char **argv, const char *short_opts, + char *maj_min_dev) +{ + int option; + + /* + * optind is a global extern used by getopt. Since we can call + * set_options twice (once for command line, and once for config + * file) we have to reset this back to 1. + */ + optind = 1; + while (1) { + option = getopt_long(argc, argv, short_opts, options, NULL); + if (option == -1) + break; + + if (optarg) + dbg(udev, "option '%c' arg '%s'\n", option, optarg); + else + dbg(udev, "option '%c'\n", option); + + switch (option) { + case 'b': + all_good = 0; + break; + + case 'd': + dev_specified = 1; + util_strscpy(maj_min_dev, MAX_PATH_LEN, optarg); + break; + + case 'e': + use_stderr = 1; + break; + + case 'f': + util_strscpy(config_file, MAX_PATH_LEN, optarg); + break; + + case 'g': + all_good = 1; + break; + + case 'h': + printf("Usage: scsi_id OPTIONS \n" + " --device= device node for SG_IO commands\n" + " --config= location of config file\n" + " --page=0x80|0x83|pre-spc3-83 SCSI page (0x80, 0x83, pre-spc3-83)\n" + " --sg-version=3|4 use SGv3 or SGv4\n" + " --blacklisted threat device as blacklisted\n" + " --whitelisted threat device as whitelisted\n" + " --replace-whitespace replace all whitespaces by underscores\n" + " --verbose verbose logging\n" + " --version print version\n" + " --export print values as environment keys\n" + " --help print this help text\n\n"); + exit(0); + + case 'p': + if (strcmp(optarg, "0x80") == 0) { + default_page_code = PAGE_80; + } else if (strcmp(optarg, "0x83") == 0) { + default_page_code = PAGE_83; + } else if (strcmp(optarg, "pre-spc3-83") == 0) { + default_page_code = PAGE_83_PRE_SPC3; + } else { + err(udev, "Unknown page code '%s'\n", optarg); + return -1; + } + break; + + case 's': + sg_version = atoi(optarg); + if (sg_version < 3 || sg_version > 4) { + err(udev, "Unknown SG version '%s'\n", optarg); + return -1; + } + break; + + case 'u': + reformat_serial = 1; + break; + + case 'x': + export = 1; + break; + + case 'v': + debug++; + break; + + case 'V': + printf("%s\n", VERSION); + exit(0); + break; + + default: + exit(1); + } + } + if (optind < argc && !dev_specified) { + dev_specified = 1; + util_strscpy(maj_min_dev, MAX_PATH_LEN, argv[optind]); + } + return 0; +} + +static int per_dev_options(struct udev *udev, + struct scsi_id_device *dev_scsi, int *good_bad, int *page_code) +{ + int retval; + int newargc; + char **newargv = NULL; + int option; + + *good_bad = all_good; + *page_code = default_page_code; + + retval = get_file_options(udev, vendor_str, model_str, &newargc, &newargv); + + optind = 1; /* reset this global extern */ + while (retval == 0) { + option = getopt_long(newargc, newargv, dev_short_options, options, NULL); + if (option == -1) + break; + + if (optarg) + dbg(udev, "option '%c' arg '%s'\n", option, optarg); + else + dbg(udev, "option '%c'\n", option); + + switch (option) { + case 'b': + *good_bad = 0; + break; + + case 'g': + *good_bad = 1; + break; + + case 'p': + if (strcmp(optarg, "0x80") == 0) { + *page_code = PAGE_80; + } else if (strcmp(optarg, "0x83") == 0) { + *page_code = PAGE_83; + } else if (strcmp(optarg, "pre-spc3-83") == 0) { + *page_code = PAGE_83_PRE_SPC3; + } else { + err(udev, "Unknown page code '%s'\n", optarg); + retval = -1; + } + break; + + default: + err(udev, "Unknown or bad option '%c' (0x%x)\n", option, option); + retval = -1; + break; + } + } + + if (newargv) { + free(newargv[0]); + free(newargv); + } + return retval; +} + +static int set_inq_values(struct udev *udev, struct scsi_id_device *dev_scsi, const char *path) +{ + int retval; + + dev_scsi->use_sg = sg_version; + + retval = scsi_std_inquiry(udev, dev_scsi, path); + if (retval) + return retval; + + udev_util_encode_string(dev_scsi->vendor, vendor_enc_str, sizeof(vendor_enc_str)); + udev_util_encode_string(dev_scsi->model, model_enc_str, sizeof(model_enc_str)); + + util_replace_whitespace(dev_scsi->vendor, vendor_str, sizeof(vendor_str)); + util_replace_chars(vendor_str, NULL); + util_replace_whitespace(dev_scsi->model, model_str, sizeof(model_str)); + util_replace_chars(model_str, NULL); + set_type(dev_scsi->type, type_str, sizeof(type_str)); + util_replace_whitespace(dev_scsi->revision, revision_str, sizeof(revision_str)); + util_replace_chars(revision_str, NULL); + return 0; +} + +/* + * scsi_id: try to get an id, if one is found, printf it to stdout. + * returns a value passed to exit() - 0 if printed an id, else 1. + */ +static int scsi_id(struct udev *udev, char *maj_min_dev) +{ + struct scsi_id_device dev_scsi; + int good_dev; + int page_code; + int retval = 0; + + memset(&dev_scsi, 0x00, sizeof(struct scsi_id_device)); + + if (set_inq_values(udev, &dev_scsi, maj_min_dev) < 0) { + retval = 1; + goto out; + } + + /* get per device (vendor + model) options from the config file */ + per_dev_options(udev, &dev_scsi, &good_dev, &page_code); + dbg(udev, "per dev options: good %d; page code 0x%x\n", good_dev, page_code); + if (!good_dev) { + retval = 1; + goto out; + } + + /* read serial number from mode pages (no values for optical drives) */ + scsi_get_serial(udev, &dev_scsi, maj_min_dev, page_code, MAX_SERIAL_LEN); + + if (export) { + char serial_str[MAX_SERIAL_LEN]; + + printf("ID_SCSI=1\n"); + printf("ID_VENDOR=%s\n", vendor_str); + printf("ID_VENDOR_ENC=%s\n", vendor_enc_str); + printf("ID_MODEL=%s\n", model_str); + printf("ID_MODEL_ENC=%s\n", model_enc_str); + printf("ID_REVISION=%s\n", revision_str); + printf("ID_TYPE=%s\n", type_str); + if (dev_scsi.serial[0] != '\0') { + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("ID_SERIAL=%s\n", serial_str); + util_replace_whitespace(dev_scsi.serial_short, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("ID_SERIAL_SHORT=%s\n", serial_str); + } + if (dev_scsi.wwn[0] != '\0') { + printf("ID_WWN=0x%s\n", dev_scsi.wwn); + if (dev_scsi.wwn_vendor_extension[0] != '\0') { + printf("ID_WWN_VENDOR_EXTENSION=0x%s\n", dev_scsi.wwn_vendor_extension); + printf("ID_WWN_WITH_EXTENSION=0x%s%s\n", dev_scsi.wwn, dev_scsi.wwn_vendor_extension); + } else { + printf("ID_WWN_WITH_EXTENSION=0x%s\n", dev_scsi.wwn); + } + } + if (dev_scsi.tgpt_group[0] != '\0') { + printf("ID_TARGET_PORT=%s\n", dev_scsi.tgpt_group); + } + if (dev_scsi.unit_serial_number[0] != '\0') { + printf("ID_SCSI_SERIAL=%s\n", dev_scsi.unit_serial_number); + } + goto out; + } + + if (dev_scsi.serial[0] == '\0') { + retval = 1; + goto out; + } + + if (reformat_serial) { + char serial_str[MAX_SERIAL_LEN]; + + util_replace_whitespace(dev_scsi.serial, serial_str, sizeof(serial_str)); + util_replace_chars(serial_str, NULL); + printf("%s\n", serial_str); + goto out; + } + + printf("%s\n", dev_scsi.serial); +out: + return retval; +} + +int main(int argc, char **argv) +{ + struct udev *udev; + int retval = 0; + char maj_min_dev[MAX_PATH_LEN]; + int newargc; + char **newargv; + + udev = udev_new(); + if (udev == NULL) + goto exit; + + udev_log_init("scsi_id"); + udev_set_log_fn(udev, log_fn); + + /* + * Get config file options. + */ + newargv = NULL; + retval = get_file_options(udev, NULL, NULL, &newargc, &newargv); + if (retval < 0) { + retval = 1; + goto exit; + } + if (newargv && (retval == 0)) { + if (set_options(udev, newargc, newargv, short_options, maj_min_dev) < 0) { + retval = 2; + goto exit; + } + free(newargv); + } + + /* + * Get command line options (overriding any config file settings). + */ + if (set_options(udev, argc, argv, short_options, maj_min_dev) < 0) + exit(1); + + if (!dev_specified) { + err(udev, "no device specified\n"); + retval = 1; + goto exit; + } + + retval = scsi_id(udev, maj_min_dev); + +exit: + udev_unref(udev); + udev_log_close(); + return retval; +} diff --git a/src/scsi_id/scsi_id.h b/src/scsi_id/scsi_id.h new file mode 100644 index 0000000000..828a98305f --- /dev/null +++ b/src/scsi_id/scsi_id.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) IBM Corp. 2003 + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#define MAX_PATH_LEN 512 + +/* + * MAX_ATTR_LEN: maximum length of the result of reading a sysfs + * attribute. + */ +#define MAX_ATTR_LEN 256 + +/* + * MAX_SERIAL_LEN: the maximum length of the serial number, including + * added prefixes such as vendor and product (model) strings. + */ +#define MAX_SERIAL_LEN 256 + +/* + * MAX_BUFFER_LEN: maximum buffer size and line length used while reading + * the config file. + */ +#define MAX_BUFFER_LEN 256 + +struct scsi_id_device { + char vendor[9]; + char model[17]; + char revision[5]; + char type[33]; + char kernel[64]; + char serial[MAX_SERIAL_LEN]; + char serial_short[MAX_SERIAL_LEN]; + int use_sg; + + /* Always from page 0x80 e.g. 'B3G1P8500RWT' - may not be unique */ + char unit_serial_number[MAX_SERIAL_LEN]; + + /* NULs if not set - otherwise hex encoding using lower-case e.g. '50014ee0016eb572' */ + char wwn[17]; + + /* NULs if not set - otherwise hex encoding using lower-case e.g. '0xe00000d80000' */ + char wwn_vendor_extension[17]; + + /* NULs if not set - otherwise decimal number */ + char tgpt_group[8]; +}; + +extern int scsi_std_inquiry(struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname); +extern int scsi_get_serial (struct udev *udev, struct scsi_id_device *dev_scsi, const char *devname, + int page_code, int len); + +/* + * Page code values. + */ +enum page_code { + PAGE_83_PRE_SPC3 = -0x83, + PAGE_UNSPECIFIED = 0x00, + PAGE_80 = 0x80, + PAGE_83 = 0x83, +}; diff --git a/src/scsi_id/scsi_serial.c b/src/scsi_id/scsi_serial.c new file mode 100644 index 0000000000..f1d63f40cc --- /dev/null +++ b/src/scsi_id/scsi_serial.c @@ -0,0 +1,990 @@ +/* + * Copyright (C) IBM Corp. 2003 + * + * Author: Patrick Mansfield + * + * 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, either version 2 of the License, or + * (at your option) any later version. + * + * 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, see . + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libudev.h" +#include "libudev-private.h" +#include "scsi.h" +#include "scsi_id.h" + +/* + * A priority based list of id, naa, and binary/ascii for the identifier + * descriptor in VPD page 0x83. + * + * Brute force search for a match starting with the first value in the + * following id_search_list. This is not a performance issue, since there + * is normally one or some small number of descriptors. + */ +static const struct scsi_id_search_values id_search_list[] = { + { SCSI_ID_TGTGROUP, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG_EXTENDED, SCSI_ID_ASCII }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_IEEE_REG, SCSI_ID_ASCII }, + /* + * Devices already exist using NAA values that are now marked + * reserved. These should not conflict with other values, or it is + * a bug in the device. As long as we find the IEEE extended one + * first, we really don't care what other ones are used. Using + * don't care here means that a device that returns multiple + * non-IEEE descriptors in a random order will get different + * names. + */ + { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_NAA, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_EUI_64, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_T10_VENDOR, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, + { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_BINARY }, + { SCSI_ID_VENDOR_SPECIFIC, SCSI_ID_NAA_DONT_CARE, SCSI_ID_ASCII }, +}; + +static const char hex_str[]="0123456789abcdef"; + +/* + * Values returned in the result/status, only the ones used by the code + * are used here. + */ + +#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ +#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ +#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ + +/* The following "category" function returns one of the following */ +#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ +#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ +#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ +#define SG_ERR_CAT_TIMEOUT 3 +#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_NOTSUPPORTED 5 /* Illegal / unsupported command */ +#define SG_ERR_CAT_SENSE 98 /* Something else in the sense buffer */ +#define SG_ERR_CAT_OTHER 99 /* Some other error/warning */ + +static int do_scsi_page80_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int max_len); + +static int sg_err_category_new(struct udev *udev, + int scsi_status, int msg_status, int + host_status, int driver_status, const + unsigned char *sense_buffer, int sb_len) +{ + scsi_status &= 0x7e; + + /* + * XXX change to return only two values - failed or OK. + */ + + if (!scsi_status && !host_status && !driver_status) + return SG_ERR_CAT_CLEAN; + + if ((scsi_status == SCSI_CHECK_CONDITION) || + (scsi_status == SCSI_COMMAND_TERMINATED) || + ((driver_status & 0xf) == DRIVER_SENSE)) { + if (sense_buffer && (sb_len > 2)) { + int sense_key; + unsigned char asc; + + if (sense_buffer[0] & 0x2) { + sense_key = sense_buffer[1] & 0xf; + asc = sense_buffer[2]; + } else { + sense_key = sense_buffer[2] & 0xf; + asc = (sb_len > 12) ? sense_buffer[12] : 0; + } + + if (sense_key == RECOVERED_ERROR) + return SG_ERR_CAT_RECOVERED; + else if (sense_key == UNIT_ATTENTION) { + if (0x28 == asc) + return SG_ERR_CAT_MEDIA_CHANGED; + if (0x29 == asc) + return SG_ERR_CAT_RESET; + } else if (sense_key == ILLEGAL_REQUEST) { + return SG_ERR_CAT_NOTSUPPORTED; + } + } + return SG_ERR_CAT_SENSE; + } + if (host_status) { + if ((host_status == DID_NO_CONNECT) || + (host_status == DID_BUS_BUSY) || + (host_status == DID_TIME_OUT)) + return SG_ERR_CAT_TIMEOUT; + } + if (driver_status) { + if (driver_status == DRIVER_TIMEOUT) + return SG_ERR_CAT_TIMEOUT; + } + return SG_ERR_CAT_OTHER; +} + +static int sg_err_category3(struct udev *udev, struct sg_io_hdr *hp) +{ + return sg_err_category_new(udev, + hp->status, hp->msg_status, + hp->host_status, hp->driver_status, + hp->sbp, hp->sb_len_wr); +} + +static int sg_err_category4(struct udev *udev, struct sg_io_v4 *hp) +{ + return sg_err_category_new(udev, hp->device_status, 0, + hp->transport_status, hp->driver_status, + (unsigned char *)(uintptr_t)hp->response, + hp->response_len); +} + +static int scsi_dump_sense(struct udev *udev, + struct scsi_id_device *dev_scsi, + unsigned char *sense_buffer, int sb_len) +{ + int s; + int code; + int sense_class; + int sense_key; + int asc, ascq; +#ifdef DUMP_SENSE + char out_buffer[256]; + int i, j; +#endif + + /* + * Figure out and print the sense key, asc and ascq. + * + * If you want to suppress these for a particular drive model, add + * a black list entry in the scsi_id config file. + * + * XXX We probably need to: lookup the sense/asc/ascq in a retry + * table, and if found return 1 (after dumping the sense, asc, and + * ascq). So, if/when we get something like a power on/reset, + * we'll retry the command. + */ + + dbg(udev, "got check condition\n"); + + if (sb_len < 1) { + info(udev, "%s: sense buffer empty\n", dev_scsi->kernel); + return -1; + } + + sense_class = (sense_buffer[0] >> 4) & 0x07; + code = sense_buffer[0] & 0xf; + + if (sense_class == 7) { + /* + * extended sense data. + */ + s = sense_buffer[7] + 8; + if (sb_len < s) { + info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", + dev_scsi->kernel, sb_len, s - sb_len); + return -1; + } + if ((code == 0x0) || (code == 0x1)) { + sense_key = sense_buffer[2] & 0xf; + if (s < 14) { + /* + * Possible? + */ + info(udev, "%s: sense result too" " small %d bytes\n", + dev_scsi->kernel, s); + return -1; + } + asc = sense_buffer[12]; + ascq = sense_buffer[13]; + } else if ((code == 0x2) || (code == 0x3)) { + sense_key = sense_buffer[1] & 0xf; + asc = sense_buffer[2]; + ascq = sense_buffer[3]; + } else { + info(udev, "%s: invalid sense code 0x%x\n", + dev_scsi->kernel, code); + return -1; + } + info(udev, "%s: sense key 0x%x ASC 0x%x ASCQ 0x%x\n", + dev_scsi->kernel, sense_key, asc, ascq); + } else { + if (sb_len < 4) { + info(udev, "%s: sense buffer too small %d bytes, %d bytes too short\n", + dev_scsi->kernel, sb_len, 4 - sb_len); + return -1; + } + + if (sense_buffer[0] < 15) + info(udev, "%s: old sense key: 0x%x\n", dev_scsi->kernel, sense_buffer[0] & 0x0f); + else + info(udev, "%s: sense = %2x %2x\n", + dev_scsi->kernel, sense_buffer[0], sense_buffer[2]); + info(udev, "%s: non-extended sense class %d code 0x%0x\n", + dev_scsi->kernel, sense_class, code); + + } + +#ifdef DUMP_SENSE + for (i = 0, j = 0; (i < s) && (j < 254); i++) { + dbg(udev, "i %d, j %d\n", i, j); + out_buffer[j++] = hex_str[(sense_buffer[i] & 0xf0) >> 4]; + out_buffer[j++] = hex_str[sense_buffer[i] & 0x0f]; + out_buffer[j++] = ' '; + } + out_buffer[j] = '\0'; + info(udev, "%s: sense dump:\n", dev_scsi->kernel); + info(udev, "%s: %s\n", dev_scsi->kernel, out_buffer); + +#endif + return -1; +} + +static int scsi_dump(struct udev *udev, + struct scsi_id_device *dev_scsi, struct sg_io_hdr *io) +{ + if (!io->status && !io->host_status && !io->msg_status && + !io->driver_status) { + /* + * Impossible, should not be called. + */ + info(udev, "%s: called with no error\n", __FUNCTION__); + return -1; + } + + info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x 0x%x\n", + dev_scsi->kernel, io->driver_status, io->host_status, io->msg_status, io->status); + if (io->status == SCSI_CHECK_CONDITION) + return scsi_dump_sense(udev, dev_scsi, io->sbp, io->sb_len_wr); + else + return -1; +} + +static int scsi_dump_v4(struct udev *udev, + struct scsi_id_device *dev_scsi, struct sg_io_v4 *io) +{ + if (!io->device_status && !io->transport_status && + !io->driver_status) { + /* + * Impossible, should not be called. + */ + info(udev, "%s: called with no error\n", __FUNCTION__); + return -1; + } + + info(udev, "%s: sg_io failed status 0x%x 0x%x 0x%x\n", + dev_scsi->kernel, io->driver_status, io->transport_status, + io->device_status); + if (io->device_status == SCSI_CHECK_CONDITION) + return scsi_dump_sense(udev, dev_scsi, (unsigned char *)(uintptr_t)io->response, + io->response_len); + else + return -1; +} + +static int scsi_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + unsigned char evpd, unsigned char page, + unsigned char *buf, unsigned int buflen) +{ + unsigned char inq_cmd[INQUIRY_CMDLEN] = + { INQUIRY_CMD, evpd, page, 0, buflen, 0 }; + unsigned char sense[SENSE_BUFF_LEN]; + void *io_buf; + struct sg_io_v4 io_v4; + struct sg_io_hdr io_hdr; + int retry = 3; /* rather random */ + int retval; + + if (buflen > SCSI_INQ_BUFF_LEN) { + info(udev, "buflen %d too long\n", buflen); + return -1; + } + +resend: + dbg(udev, "%s evpd %d, page 0x%x\n", dev_scsi->kernel, evpd, page); + + if (dev_scsi->use_sg == 4) { + memset(&io_v4, 0, sizeof(struct sg_io_v4)); + io_v4.guard = 'Q'; + io_v4.protocol = BSG_PROTOCOL_SCSI; + io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD; + io_v4.request_len = sizeof(inq_cmd); + io_v4.request = (uintptr_t)inq_cmd; + io_v4.max_response_len = sizeof(sense); + io_v4.response = (uintptr_t)sense; + io_v4.din_xfer_len = buflen; + io_v4.din_xferp = (uintptr_t)buf; + io_buf = (void *)&io_v4; + } else { + memset(&io_hdr, 0, sizeof(struct sg_io_hdr)); + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = sizeof(inq_cmd); + io_hdr.mx_sb_len = sizeof(sense); + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + io_hdr.dxfer_len = buflen; + io_hdr.dxferp = buf; + io_hdr.cmdp = inq_cmd; + io_hdr.sbp = sense; + io_hdr.timeout = DEF_TIMEOUT; + io_buf = (void *)&io_hdr; + } + + retval = ioctl(fd, SG_IO, io_buf); + if (retval < 0) { + if ((errno == EINVAL || errno == ENOSYS) && dev_scsi->use_sg == 4) { + dev_scsi->use_sg = 3; + goto resend; + } + info(udev, "%s: ioctl failed: %s\n", dev_scsi->kernel, strerror(errno)); + goto error; + } + + if (dev_scsi->use_sg == 4) + retval = sg_err_category4(udev, io_buf); + else + retval = sg_err_category3(udev, io_buf); + + switch (retval) { + case SG_ERR_CAT_NOTSUPPORTED: + buf[1] = 0; + /* Fallthrough */ + case SG_ERR_CAT_CLEAN: + case SG_ERR_CAT_RECOVERED: + retval = 0; + break; + + default: + if (dev_scsi->use_sg == 4) + retval = scsi_dump_v4(udev, dev_scsi, io_buf); + else + retval = scsi_dump(udev, dev_scsi, io_buf); + } + + if (!retval) { + retval = buflen; + } else if (retval > 0) { + if (--retry > 0) { + dbg(udev, "%s: Retrying ...\n", dev_scsi->kernel); + goto resend; + } + retval = -1; + } + +error: + if (retval < 0) + info(udev, "%s: Unable to get INQUIRY vpd %d page 0x%x.\n", + dev_scsi->kernel, evpd, page); + + return retval; +} + +/* Get list of supported EVPD pages */ +static int do_scsi_page0_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + unsigned char *buffer, unsigned int len) +{ + int retval; + + memset(buffer, 0, len); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, 0x0, buffer, len); + if (retval < 0) + return 1; + + if (buffer[1] != 0) { + info(udev, "%s: page 0 not available.\n", dev_scsi->kernel); + return 1; + } + if (buffer[3] > len) { + info(udev, "%s: page 0 buffer too long %d\n", dev_scsi->kernel, buffer[3]); + return 1; + } + + /* + * Following check is based on code once included in the 2.5.x + * kernel. + * + * Some ill behaved devices return the standard inquiry here + * rather than the evpd data, snoop the data to verify. + */ + if (buffer[3] > MODEL_LENGTH) { + /* + * If the vendor id appears in the page assume the page is + * invalid. + */ + if (!strncmp((char *)&buffer[VENDOR_LENGTH], dev_scsi->vendor, VENDOR_LENGTH)) { + info(udev, "%s: invalid page0 data\n", dev_scsi->kernel); + return 1; + } + } + return 0; +} + +/* + * The caller checks that serial is long enough to include the vendor + + * model. + */ +static int prepend_vendor_model(struct udev *udev, + struct scsi_id_device *dev_scsi, char *serial) +{ + int ind; + + strncpy(serial, dev_scsi->vendor, VENDOR_LENGTH); + strncat(serial, dev_scsi->model, MODEL_LENGTH); + ind = strlen(serial); + + /* + * This is not a complete check, since we are using strncat/cpy + * above, ind will never be too large. + */ + if (ind != (VENDOR_LENGTH + MODEL_LENGTH)) { + info(udev, "%s: expected length %d, got length %d\n", + dev_scsi->kernel, (VENDOR_LENGTH + MODEL_LENGTH), ind); + return -1; + } + return ind; +} + +/** + * check_fill_0x83_id - check the page 0x83 id, if OK allocate and fill + * serial number. + **/ +static int check_fill_0x83_id(struct udev *udev, + struct scsi_id_device *dev_scsi, + unsigned char *page_83, + const struct scsi_id_search_values + *id_search, char *serial, char *serial_short, + int max_len, char *wwn, + char *wwn_vendor_extension, char *tgpt_group) +{ + int i, j, s, len; + + /* + * ASSOCIATION must be with the device (value 0) + * or with the target port for SCSI_ID_TGTPORT + */ + if ((page_83[1] & 0x30) == 0x10) { + if (id_search->id_type != SCSI_ID_TGTGROUP) + return 1; + } else if ((page_83[1] & 0x30) != 0) { + return 1; + } + + if ((page_83[1] & 0x0f) != id_search->id_type) + return 1; + + /* + * Possibly check NAA sub-type. + */ + if ((id_search->naa_type != SCSI_ID_NAA_DONT_CARE) && + (id_search->naa_type != (page_83[4] & 0xf0) >> 4)) + return 1; + + /* + * Check for matching code set - ASCII or BINARY. + */ + if ((page_83[0] & 0x0f) != id_search->code_set) + return 1; + + /* + * page_83[3]: identifier length + */ + len = page_83[3]; + if ((page_83[0] & 0x0f) != SCSI_ID_ASCII) + /* + * If not ASCII, use two bytes for each binary value. + */ + len *= 2; + + /* + * Add one byte for the NUL termination, and one for the id_type. + */ + len += 2; + if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) + len += VENDOR_LENGTH + MODEL_LENGTH; + + if (max_len < len) { + info(udev, "%s: length %d too short - need %d\n", + dev_scsi->kernel, max_len, len); + return 1; + } + + if (id_search->id_type == SCSI_ID_TGTGROUP && tgpt_group != NULL) { + unsigned int group; + + group = ((unsigned int)page_83[6] << 8) | page_83[7]; + sprintf(tgpt_group,"%x", group); + return 1; + } + + serial[0] = hex_str[id_search->id_type]; + + /* + * For SCSI_ID_VENDOR_SPECIFIC prepend the vendor and model before + * the id since it is not unique across all vendors and models, + * this differs from SCSI_ID_T10_VENDOR, where the vendor is + * included in the identifier. + */ + if (id_search->id_type == SCSI_ID_VENDOR_SPECIFIC) + if (prepend_vendor_model(udev, dev_scsi, &serial[1]) < 0) { + dbg(udev, "prepend failed\n"); + return 1; + } + + i = 4; /* offset to the start of the identifier */ + s = j = strlen(serial); + if ((page_83[0] & 0x0f) == SCSI_ID_ASCII) { + /* + * ASCII descriptor. + */ + while (i < (4 + page_83[3])) + serial[j++] = page_83[i++]; + } else { + /* + * Binary descriptor, convert to ASCII, using two bytes of + * ASCII for each byte in the page_83. + */ + while (i < (4 + page_83[3])) { + serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; + serial[j++] = hex_str[page_83[i] & 0x0f]; + i++; + } + } + + strcpy(serial_short, &serial[s]); + + if (id_search->id_type == SCSI_ID_NAA && wwn != NULL) { + strncpy(wwn, &serial[s], 16); + if (wwn_vendor_extension != NULL) { + strncpy(wwn_vendor_extension, &serial[s + 16], 16); + } + } + + return 0; +} + +/* Extract the raw binary from VPD 0x83 pre-SPC devices */ +static int check_fill_0x83_prespc3(struct udev *udev, + struct scsi_id_device *dev_scsi, + unsigned char *page_83, + const struct scsi_id_search_values + *id_search, char *serial, char *serial_short, int max_len) +{ + int i, j; + + dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); + serial[0] = hex_str[id_search->id_type]; + /* serial has been memset to zero before */ + j = strlen(serial); /* j = 1; */ + + for (i = 0; (i < page_83[3]) && (j < max_len-3); ++i) { + serial[j++] = hex_str[(page_83[4+i] & 0xf0) >> 4]; + serial[j++] = hex_str[ page_83[4+i] & 0x0f]; + } + serial[max_len-1] = 0; + strncpy(serial_short, serial, max_len-1); + return 0; +} + + +/* Get device identification VPD page */ +static int do_scsi_page83_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int len, + char *unit_serial_number, char *wwn, + char *wwn_vendor_extension, char *tgpt_group) +{ + int retval; + unsigned int id_ind, j; + unsigned char page_83[SCSI_INQ_BUFF_LEN]; + + /* also pick up the page 80 serial number */ + do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN); + + memset(page_83, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, + SCSI_INQ_BUFF_LEN); + if (retval < 0) + return 1; + + if (page_83[1] != PAGE_83) { + info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); + return 1; + } + + /* + * XXX Some devices (IBM 3542) return all spaces for an identifier if + * the LUN is not actually configured. This leads to identifiers of + * the form: "1 ". + */ + + /* + * Model 4, 5, and (some) model 6 EMC Symmetrix devices return + * a page 83 reply according to SCSI-2 format instead of SPC-2/3. + * + * The SCSI-2 page 83 format returns an IEEE WWN in binary + * encoded hexi-decimal in the 16 bytes following the initial + * 4-byte page 83 reply header. + * + * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part + * of an Identification descriptor. The 3rd byte of the first + * Identification descriptor is a reserved (BSZ) byte field. + * + * Reference the 7th byte of the page 83 reply to determine + * whether the reply is compliant with SCSI-2 or SPC-2/3 + * specifications. A zero value in the 7th byte indicates + * an SPC-2/3 conformant reply, (i.e., the reserved field of the + * first Identification descriptor). This byte will be non-zero + * for a SCSI-2 conformant page 83 reply from these EMC + * Symmetrix models since the 7th byte of the reply corresponds + * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, + * 0x006048. + */ + + if (page_83[6] != 0) + return check_fill_0x83_prespc3(udev, + dev_scsi, page_83, id_search_list, + serial, serial_short, len); + + /* + * Search for a match in the prioritized id_search_list - since WWN ids + * come first we can pick up the WWN in check_fill_0x83_id(). + */ + for (id_ind = 0; + id_ind < sizeof(id_search_list)/sizeof(id_search_list[0]); + id_ind++) { + /* + * Examine each descriptor returned. There is normally only + * one or a small number of descriptors. + */ + for (j = 4; j <= (unsigned int)page_83[3] + 3; j += page_83[j + 3] + 4) { + retval = check_fill_0x83_id(udev, + dev_scsi, &page_83[j], + &id_search_list[id_ind], + serial, serial_short, len, + wwn, wwn_vendor_extension, + tgpt_group); + dbg(udev, "%s id desc %d/%d/%d\n", dev_scsi->kernel, + id_search_list[id_ind].id_type, + id_search_list[id_ind].naa_type, + id_search_list[id_ind].code_set); + if (!retval) { + dbg(udev, " used\n"); + return retval; + } else if (retval < 0) { + dbg(udev, " failed\n"); + return retval; + } else { + dbg(udev, " not used\n"); + } + } + } + return 1; +} + +/* + * Get device identification VPD page for older SCSI-2 device which is not + * compliant with either SPC-2 or SPC-3 format. + * + * Return the hard coded error code value 2 if the page 83 reply is not + * conformant to the SCSI-2 format. + */ +static int do_scsi_page83_prespc3_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int len) +{ + int retval; + int i, j; + unsigned char page_83[SCSI_INQ_BUFF_LEN]; + + memset(page_83, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN); + if (retval < 0) + return 1; + + if (page_83[1] != PAGE_83) { + info(udev, "%s: Invalid page 0x83\n", dev_scsi->kernel); + return 1; + } + /* + * Model 4, 5, and (some) model 6 EMC Symmetrix devices return + * a page 83 reply according to SCSI-2 format instead of SPC-2/3. + * + * The SCSI-2 page 83 format returns an IEEE WWN in binary + * encoded hexi-decimal in the 16 bytes following the initial + * 4-byte page 83 reply header. + * + * Both the SPC-2 and SPC-3 formats return an IEEE WWN as part + * of an Identification descriptor. The 3rd byte of the first + * Identification descriptor is a reserved (BSZ) byte field. + * + * Reference the 7th byte of the page 83 reply to determine + * whether the reply is compliant with SCSI-2 or SPC-2/3 + * specifications. A zero value in the 7th byte indicates + * an SPC-2/3 conformant reply, (i.e., the reserved field of the + * first Identification descriptor). This byte will be non-zero + * for a SCSI-2 conformant page 83 reply from these EMC + * Symmetrix models since the 7th byte of the reply corresponds + * to the 4th and 5th nibbles of the 6-byte OUI for EMC, that is, + * 0x006048. + */ + if (page_83[6] == 0) + return 2; + + serial[0] = hex_str[id_search_list[0].id_type]; + /* + * The first four bytes contain data, not a descriptor. + */ + i = 4; + j = strlen(serial); + /* + * Binary descriptor, convert to ASCII, + * using two bytes of ASCII for each byte + * in the page_83. + */ + while (i < (page_83[3]+4)) { + serial[j++] = hex_str[(page_83[i] & 0xf0) >> 4]; + serial[j++] = hex_str[page_83[i] & 0x0f]; + i++; + } + dbg(udev, "using pre-spc3-83 for %s\n", dev_scsi->kernel); + return 0; +} + +/* Get unit serial number VPD page */ +static int do_scsi_page80_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, int fd, + char *serial, char *serial_short, int max_len) +{ + int retval; + int ser_ind; + int i; + int len; + unsigned char buf[SCSI_INQ_BUFF_LEN]; + + memset(buf, 0, SCSI_INQ_BUFF_LEN); + retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN); + if (retval < 0) + return retval; + + if (buf[1] != PAGE_80) { + info(udev, "%s: Invalid page 0x80\n", dev_scsi->kernel); + return 1; + } + + len = 1 + VENDOR_LENGTH + MODEL_LENGTH + buf[3]; + if (max_len < len) { + info(udev, "%s: length %d too short - need %d\n", + dev_scsi->kernel, max_len, len); + return 1; + } + /* + * Prepend 'S' to avoid unlikely collision with page 0x83 vendor + * specific type where we prepend '0' + vendor + model. + */ + len = buf[3]; + if (serial != NULL) { + serial[0] = 'S'; + ser_ind = prepend_vendor_model(udev, dev_scsi, &serial[1]); + if (ser_ind < 0) + return 1; + for (i = 4; i < len + 4; i++, ser_ind++) + serial[ser_ind] = buf[i]; + } + if (serial_short != NULL) { + memcpy(serial_short, &buf[4], len); + serial_short[len] = '\0'; + } + return 0; +} + +int scsi_std_inquiry(struct udev *udev, + struct scsi_id_device *dev_scsi, const char *devname) +{ + int fd; + unsigned char buf[SCSI_INQ_BUFF_LEN]; + struct stat statbuf; + int err = 0; + + dbg(udev, "opening %s\n", devname); + fd = open(devname, O_RDONLY | O_NONBLOCK); + if (fd < 0) { + info(udev, "scsi_id: cannot open %s: %s\n", + devname, strerror(errno)); + return 1; + } + + if (fstat(fd, &statbuf) < 0) { + info(udev, "scsi_id: cannot stat %s: %s\n", + devname, strerror(errno)); + err = 2; + goto out; + } + sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev), + minor(statbuf.st_rdev)); + + memset(buf, 0, SCSI_INQ_BUFF_LEN); + err = scsi_inquiry(udev, dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN); + if (err < 0) + goto out; + + err = 0; + memcpy(dev_scsi->vendor, buf + 8, 8); + dev_scsi->vendor[8] = '\0'; + memcpy(dev_scsi->model, buf + 16, 16); + dev_scsi->model[16] = '\0'; + memcpy(dev_scsi->revision, buf + 32, 4); + dev_scsi->revision[4] = '\0'; + sprintf(dev_scsi->type,"%x", buf[0] & 0x1f); + +out: + close(fd); + return err; +} + +int scsi_get_serial(struct udev *udev, + struct scsi_id_device *dev_scsi, const char *devname, + int page_code, int len) +{ + unsigned char page0[SCSI_INQ_BUFF_LEN]; + int fd = -1; + int cnt; + int ind; + int retval; + + memset(dev_scsi->serial, 0, len); + dbg(udev, "opening %s\n", devname); + srand((unsigned int)getpid()); + for (cnt = 20; cnt > 0; cnt--) { + struct timespec duration; + + fd = open(devname, O_RDONLY | O_NONBLOCK); + if (fd >= 0 || errno != EBUSY) + break; + duration.tv_sec = 0; + duration.tv_nsec = (200 * 1000 * 1000) + (rand() % 100 * 1000 * 1000); + nanosleep(&duration, NULL); + } + if (fd < 0) + return 1; + + if (page_code == PAGE_80) { + if (do_scsi_page80_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } else if (page_code == PAGE_83) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } else if (page_code == PAGE_83_PRE_SPC3) { + retval = do_scsi_page83_prespc3_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len); + if (retval) { + /* + * Fallback to servicing a SPC-2/3 compliant page 83 + * inquiry if the page 83 reply format does not + * conform to pre-SPC3 expectations. + */ + if (retval == 2) { + if (do_scsi_page83_inquiry(udev, dev_scsi, fd, dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { + retval = 1; + goto completed; + } else { + retval = 0; + goto completed; + } + } + else { + retval = 1; + goto completed; + } + } else { + retval = 0; + goto completed; + } + } else if (page_code != 0x00) { + info(udev, "%s: unsupported page code 0x%d\n", dev_scsi->kernel, page_code); + return 1; + } + + /* + * Get page 0, the page of the pages. By default, try from best to + * worst of supported pages: 0x83 then 0x80. + */ + if (do_scsi_page0_inquiry(udev, dev_scsi, fd, page0, SCSI_INQ_BUFF_LEN)) { + /* + * Don't try anything else. Black list if a specific page + * should be used for this vendor+model, or maybe have an + * optional fall-back to page 0x80 or page 0x83. + */ + retval = 1; + goto completed; + } + + dbg(udev, "%s: Checking page0\n", dev_scsi->kernel); + + for (ind = 4; ind <= page0[3] + 3; ind++) + if (page0[ind] == PAGE_83) + if (!do_scsi_page83_inquiry(udev, dev_scsi, fd, + dev_scsi->serial, dev_scsi->serial_short, len, dev_scsi->unit_serial_number, dev_scsi->wwn, dev_scsi->wwn_vendor_extension, dev_scsi->tgpt_group)) { + /* + * Success + */ + retval = 0; + goto completed; + } + + for (ind = 4; ind <= page0[3] + 3; ind++) + if (page0[ind] == PAGE_80) + if (!do_scsi_page80_inquiry(udev, dev_scsi, fd, + dev_scsi->serial, dev_scsi->serial_short, len)) { + /* + * Success + */ + retval = 0; + goto completed; + } + retval = 1; + +completed: + close(fd); + return retval; +} diff --git a/src/v4l_id/.gitignore b/src/v4l_id/.gitignore new file mode 100644 index 0000000000..dffced9f08 --- /dev/null +++ b/src/v4l_id/.gitignore @@ -0,0 +1 @@ +v4l_id diff --git a/src/v4l_id/60-persistent-v4l.rules b/src/v4l_id/60-persistent-v4l.rules new file mode 100644 index 0000000000..93c5ee8c27 --- /dev/null +++ b/src/v4l_id/60-persistent-v4l.rules @@ -0,0 +1,20 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="persistent_v4l_end" +SUBSYSTEM!="video4linux", GOTO="persistent_v4l_end" +ENV{MAJOR}=="", GOTO="persistent_v4l_end" + +IMPORT{program}="v4l_id $devnode" + +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" +KERNEL=="video*", ENV{ID_SERIAL}=="?*", SYMLINK+="v4l/by-id/$env{ID_BUS}-$env{ID_SERIAL}-video-index$attr{index}" + +# check for valid "index" number +TEST!="index", GOTO="persistent_v4l_end" +ATTR{index}!="?*", GOTO="persistent_v4l_end" + +IMPORT{builtin}="path_id" +ENV{ID_PATH}=="?*", KERNEL=="video*|vbi*", SYMLINK+="v4l/by-path/$env{ID_PATH}-video-index$attr{index}" +ENV{ID_PATH}=="?*", KERNEL=="audio*", SYMLINK+="v4l/by-path/$env{ID_PATH}-audio-index$attr{index}" + +LABEL="persistent_v4l_end" diff --git a/src/v4l_id/v4l_id.c b/src/v4l_id/v4l_id.c new file mode 100644 index 0000000000..a2a80b5f43 --- /dev/null +++ b/src/v4l_id/v4l_id.c @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2009 Kay Sievers + * Copyright (c) 2009 Filippo Argiolas + * + * 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; either version 2 of the + * License, or (at your option) any later version. + * + * 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: + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + static const struct option options[] = { + { "help", no_argument, NULL, 'h' }, + {} + }; + int fd; + char *device; + struct v4l2_capability v2cap; + + while (1) { + int option; + + option = getopt_long(argc, argv, "h", options, NULL); + if (option == -1) + break; + + switch (option) { + case 'h': + printf("Usage: v4l_id [--help] \n\n"); + return 0; + default: + return 1; + } + } + device = argv[optind]; + + if (device == NULL) + return 2; + fd = open (device, O_RDONLY); + if (fd < 0) + return 3; + + if (ioctl (fd, VIDIOC_QUERYCAP, &v2cap) == 0) { + printf("ID_V4L_VERSION=2\n"); + printf("ID_V4L_PRODUCT=%s\n", v2cap.card); + printf("ID_V4L_CAPABILITIES=:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) > 0) + printf("capture:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) > 0) + printf("video_output:"); + if ((v2cap.capabilities & V4L2_CAP_VIDEO_OVERLAY) > 0) + printf("video_overlay:"); + if ((v2cap.capabilities & V4L2_CAP_AUDIO) > 0) + printf("audio:"); + if ((v2cap.capabilities & V4L2_CAP_TUNER) > 0) + printf("tuner:"); + if ((v2cap.capabilities & V4L2_CAP_RADIO) > 0) + printf("radio:"); + printf("\n"); + } + + close (fd); + return 0; +} -- cgit v1.2.3-54-g00ecf From 96ca3736288300bf013bd075e08736ec66f6a2ec Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 17:10:26 +0100 Subject: rules: delete outdated 30-kernel-compat.rules --- rules/misc/30-kernel-compat.rules | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 rules/misc/30-kernel-compat.rules diff --git a/rules/misc/30-kernel-compat.rules b/rules/misc/30-kernel-compat.rules deleted file mode 100644 index 2596095506..0000000000 --- a/rules/misc/30-kernel-compat.rules +++ /dev/null @@ -1,15 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# Rules to support older kernels, which migth miss functionality needed -# for the recent udev rules. -# -# This file is used and maintained by Gentoo. - -ACTION!="add", GOTO="kernel_compat_end" - -# see src/qemu/42-qemu-usb.rules, version for 2.6.32 + older. -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/level", ATTR{power/level}="auto" - -LABEL="kernel_compat_end" -- cgit v1.2.3-54-g00ecf From df4554c333aec1a4bc2c3335aef6e92f2c13bfcd Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 17:12:15 +0100 Subject: rules: move 42-qemu-usb.rules to rules/ dir --- Makefile.am | 6 +----- rules/rules.d/42-qemu-usb.rules | 13 +++++++++++++ src/qemu/42-qemu-usb.rules | 13 ------------- 3 files changed, 14 insertions(+), 18 deletions(-) create mode 100644 rules/rules.d/42-qemu-usb.rules delete mode 100644 src/qemu/42-qemu-usb.rules diff --git a/Makefile.am b/Makefile.am index 11b4c8477d..c494a0574e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -155,6 +155,7 @@ EXTRA_DIST += \ udevrulesdir = $(libexecdir)/udev/rules.d dist_udevrules_DATA = \ + rules/rules.d/42-qemu-usb.rules \ rules/rules.d/50-udev-default.rules \ rules/rules.d/60-persistent-storage-tape.rules \ rules/rules.d/60-persistent-serial.rules \ @@ -376,11 +377,6 @@ src_accelerometer_accelerometer_LDADD = src/libudev-private.la -lm pkglibexec_PROGRAMS += src/accelerometer/accelerometer dist_udevrules_DATA += src/accelerometer/61-accelerometer.rules -# ------------------------------------------------------------------------------ -# qemu -- qemu/kvm guest tweaks -# ------------------------------------------------------------------------------ -dist_udevrules_DATA += src/qemu/42-qemu-usb.rules - if ENABLE_GUDEV # ------------------------------------------------------------------------------ # GUdev - libudev gobject interface diff --git a/rules/rules.d/42-qemu-usb.rules b/rules/rules.d/42-qemu-usb.rules new file mode 100644 index 0000000000..a4e3864714 --- /dev/null +++ b/rules/rules.d/42-qemu-usb.rules @@ -0,0 +1,13 @@ +# +# Enable autosuspend for qemu emulated usb hid devices. +# +# Note that there are buggy qemu versions which advertise remote +# wakeup support but don't actually implement it correctly. This +# is the reason why we need a match for the serial number here. +# The serial number "42" is used to tag the implementations where +# remote wakeup is working. +# + +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" diff --git a/src/qemu/42-qemu-usb.rules b/src/qemu/42-qemu-usb.rules deleted file mode 100644 index a4e3864714..0000000000 --- a/src/qemu/42-qemu-usb.rules +++ /dev/null @@ -1,13 +0,0 @@ -# -# Enable autosuspend for qemu emulated usb hid devices. -# -# Note that there are buggy qemu versions which advertise remote -# wakeup support but don't actually implement it correctly. This -# is the reason why we need a match for the serial number here. -# The serial number "42" is used to tag the implementations where -# remote wakeup is working. -# - -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -- cgit v1.2.3-54-g00ecf From 4774868ccabd76c3d208343026f1c6e57094642b Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 17:15:46 +0100 Subject: remove edd_id extra The use of identifying disks by magic byte sequences outside of the filesystem or partion table is fragile and usually creates more problems than it solves. --- Makefile.am | 11 -- configure.ac | 9 -- src/edd_id/.gitignore | 1 - src/edd_id/61-persistent-storage-edd.rules | 12 -- src/edd_id/edd_id.c | 196 ----------------------------- 5 files changed, 229 deletions(-) delete mode 100644 src/edd_id/.gitignore delete mode 100644 src/edd_id/61-persistent-storage-edd.rules delete mode 100644 src/edd_id/edd_id.c diff --git a/Makefile.am b/Makefile.am index c494a0574e..f6f13427dd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,6 @@ DISTCHECK_CONFIGURE_FLAGS = \ --enable-debug \ --enable-rule_generator \ --enable-floppy \ - --enable-edd \ --with-selinux \ --enable-gtk-doc \ --with-systemdsystemunitdir=$$dc_install_base/$(systemdsystemunitdir) @@ -681,16 +680,6 @@ pkglibexec_PROGRAMS += src/create_floppy_devices dist_udevrules_DATA += src/floppy/60-floppy.rules endif -if ENABLE_EDD -# ------------------------------------------------------------------------------ -# edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data -# ------------------------------------------------------------------------------ -src__edd_id_edd_id_SOURCES = src/edd_id/edd_id.c -src_edd_id_edd_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/edd_id/edd_id -dist_udevrules_DATA += src/edd_id/61-persistent-storage-edd.rules -endif - # ------------------------------------------------------------------------------ # install, uninstall, clean hooks # ------------------------------------------------------------------------------ diff --git a/configure.ac b/configure.ac index 8f6e004392..6e41550abe 100644 --- a/configure.ac +++ b/configure.ac @@ -184,14 +184,6 @@ AC_ARG_ENABLE([floppy], [], [enable_floppy=no]) AM_CONDITIONAL([ENABLE_FLOPPY], [test "x$enable_floppy" = "xyes"]) -# ------------------------------------------------------------------------------ -# edd_id - create /dev/disk/by-id/edd-* links for BIOS EDD data -# ------------------------------------------------------------------------------ -AC_ARG_ENABLE([edd], - AS_HELP_STRING([--enable-edd], [enable disk edd support @<:@default=disabled@:>@]), - [], [enable_edd=no]) -AM_CONDITIONAL([ENABLE_EDD], [test "x$enable_edd" = "xyes"]) - my_CFLAGS="-Wall \ -Wmissing-declarations -Wmissing-prototypes \ -Wnested-externs -Wpointer-arith \ @@ -247,5 +239,4 @@ AC_MSG_RESULT([ mtd_probe: ${enable_mtd_probe} rule_generator: ${enable_rule_generator} floppy: ${enable_floppy} - edd: ${enable_edd} ]) diff --git a/src/edd_id/.gitignore b/src/edd_id/.gitignore deleted file mode 100644 index 14fb67c634..0000000000 --- a/src/edd_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -edd_id diff --git a/src/edd_id/61-persistent-storage-edd.rules b/src/edd_id/61-persistent-storage-edd.rules deleted file mode 100644 index 6b4fb8ecfe..0000000000 --- a/src/edd_id/61-persistent-storage-edd.rules +++ /dev/null @@ -1,12 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="persistent_storage_edd_end" -SUBSYSTEM!="block", GOTO="persistent_storage_edd_end" -KERNEL!="sd*|hd*|cciss*", GOTO="persistent_storage_edd_end" - -# BIOS Enhanced Disk Device -ENV{DEVTYPE}=="disk", IMPORT{program}="edd_id --export $devnode" -ENV{DEVTYPE}=="disk", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}" -ENV{DEVTYPE}=="partition", ENV{ID_EDD}=="?*", SYMLINK+="disk/by-id/edd-$env{ID_EDD}-part%n" - -LABEL="persistent_storage_edd_end" diff --git a/src/edd_id/edd_id.c b/src/edd_id/edd_id.c deleted file mode 100644 index 471ea60533..0000000000 --- a/src/edd_id/edd_id.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * edd_id - naming of BIOS disk devices via EDD - * - * Copyright (C) 2005 John Hull - * Copyright (C) 2005 Kay Sievers - * - * 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, either version 2 of the License, or - * (at your option) any later version. - * - * 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, see . - */ - -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "libudev.h" -#include "libudev-private.h" - -static void log_fn(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) -{ - vsyslog(priority, format, args); -} - -int main(int argc, char *argv[]) -{ - struct udev *udev; - const char *node = NULL; - int i; - int export = 0; - uint32_t disk_id; - uint16_t mbr_valid; - struct dirent *dent; - int disk_fd; - int sysfs_fd; - DIR *dir = NULL; - int rc = 1; - char filename[UTIL_PATH_SIZE]; - char match[UTIL_PATH_SIZE]; - - udev = udev_new(); - if (udev == NULL) - goto exit; - - udev_log_init("edd_id"); - udev_set_log_fn(udev, log_fn); - - for (i = 1 ; i < argc; i++) { - char *arg = argv[i]; - - if (strcmp(arg, "--export") == 0) { - export = 1; - } else - node = arg; - } - if (node == NULL) { - err(udev, "no node specified\n"); - fprintf(stderr, "no node specified\n"); - goto exit; - } - - /* check for kernel support */ - util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), "/firmware/edd", NULL); - dir = opendir(filename); - if (dir == NULL) { - info(udev, "no kernel EDD support\n"); - fprintf(stderr, "no kernel EDD support\n"); - rc = 2; - goto exit; - } - - disk_fd = open(node, O_RDONLY); - if (disk_fd < 0) { - info(udev, "unable to open '%s'\n", node); - fprintf(stderr, "unable to open '%s'\n", node); - rc = 3; - goto closedir; - } - - /* check for valid MBR signature */ - if (lseek(disk_fd, 510, SEEK_SET) < 0) { - info(udev, "seek to MBR validity failed '%s'\n", node); - rc = 4; - goto close; - } - if (read(disk_fd, &mbr_valid, sizeof(mbr_valid)) != sizeof(mbr_valid)) { - info(udev, "read MBR validity failed '%s'\n", node); - rc = 5; - goto close; - } - if (mbr_valid != 0xAA55) { - fprintf(stderr, "no valid MBR signature '%s'\n", node); - info(udev, "no valid MBR signature '%s'\n", node); - rc=6; - goto close; - } - - /* read EDD signature */ - if (lseek(disk_fd, 440, SEEK_SET) < 0) { - info(udev, "seek to signature failed '%s'\n", node); - rc = 7; - goto close; - } - if (read(disk_fd, &disk_id, sizeof(disk_id)) != sizeof(disk_id)) { - info(udev, "read signature failed '%s'\n", node); - rc = 8; - goto close; - } - /* all zero is invalid */ - info(udev, "read id 0x%08x from '%s'\n", disk_id, node); - if (disk_id == 0) { - fprintf(stderr, "no EDD signature '%s'\n", node); - info(udev, "'%s' signature is zero\n", node); - rc = 9; - goto close; - } - - /* lookup signature in sysfs to determine the name */ - match[0] = '\0'; - for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) { - char sysfs_id_buf[256]; - uint32_t sysfs_id; - ssize_t size; - - if (dent->d_name[0] == '.') - continue; - - util_strscpyl(filename, sizeof(filename), dent->d_name, "/mbr_signature", NULL); - sysfs_fd = openat(dirfd(dir), filename, O_RDONLY); - if (sysfs_fd < 0) { - info(udev, "unable to open sysfs '%s'\n", filename); - continue; - } - - size = read(sysfs_fd, sysfs_id_buf, sizeof(sysfs_id_buf)-1); - close(sysfs_fd); - if (size <= 0) { - info(udev, "read sysfs '%s' failed\n", filename); - continue; - } - sysfs_id_buf[size] = '\0'; - info(udev, "read '%s' from '%s'\n", sysfs_id_buf, filename); - sysfs_id = strtoul(sysfs_id_buf, NULL, 16); - - /* look for matching value, that appears only once */ - if (disk_id == sysfs_id) { - if (match[0] == '\0') { - /* store id */ - util_strscpy(match, sizeof(match), dent->d_name); - } else { - /* error, same signature for another device */ - info(udev, "'%s' does not have a unique signature\n", node); - fprintf(stderr, "'%s' does not have a unique signature\n", node); - rc = 10; - goto exit; - } - } - } - - if (match[0] != '\0') { - if (export) - printf("ID_EDD=%s\n", match); - else - printf("%s\n", match); - rc = 0; - } - -close: - close(disk_fd); -closedir: - closedir(dir); -exit: - udev_unref(udev); - udev_log_close(); - return rc; -} -- cgit v1.2.3-54-g00ecf From 1bb8c5351a860154144702674cd738aea9201d8f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 17:22:29 +0100 Subject: build-sys: remove empty directory --- Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index f6f13427dd..eeabd0b633 100644 --- a/Makefile.am +++ b/Makefile.am @@ -149,8 +149,7 @@ udev-confdirs: INSTALL_DATA_HOOKS += udev-confdirs EXTRA_DIST += \ - rules/arch \ - rules/misc + rules/arch udevrulesdir = $(libexecdir)/udev/rules.d dist_udevrules_DATA = \ -- cgit v1.2.3-54-g00ecf From 64f7fb8b1ebdd9b2fdcf0363e08641b1a61f76ea Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 17:54:53 +0100 Subject: rules: delete s390 rules, they will move to s390utils --- Makefile.am | 3 --- rules/arch/40-s390.rules | 4 ---- 2 files changed, 7 deletions(-) delete mode 100644 rules/arch/40-s390.rules diff --git a/Makefile.am b/Makefile.am index eeabd0b633..d8d7ff6bc4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -148,9 +148,6 @@ udev-confdirs: INSTALL_DATA_HOOKS += udev-confdirs -EXTRA_DIST += \ - rules/arch - udevrulesdir = $(libexecdir)/udev/rules.d dist_udevrules_DATA = \ rules/rules.d/42-qemu-usb.rules \ diff --git a/rules/arch/40-s390.rules b/rules/arch/40-s390.rules deleted file mode 100644 index 6ff6b65a57..0000000000 --- a/rules/arch/40-s390.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="z90crypt", MODE="0666" - -- cgit v1.2.3-54-g00ecf From d0066c7416dbdc1fa837a6418ee6d4609486ec31 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 17:55:30 +0100 Subject: update TODO --- TODO | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/TODO b/TODO index 00d20145d8..8b8b9c8f8c 100644 --- a/TODO +++ b/TODO @@ -1,17 +1,11 @@ - - make "-/usr/bin/foo" non-fail - - find a way to tell udev to not cancel firmware requests in initramfs - scsi_id -> sg3_utils? - - move 'collect' and /dev/z90crypt to s390-utils - - - split-off keymaps? - - make gtk-doc optional like kmod - - move /lib/udev/devices/ to tmpfiles + - move /usr/lib/udev/devices/ to tmpfiles - trigger --subsystem-match=usb/usb_device -- cgit v1.2.3-54-g00ecf From 8e90942c7af2508f88c7284a0b116caf7ec854a9 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 7 Mar 2012 18:01:27 +0100 Subject: rules: move all rules to top level rules/ dir --- Makefile.am | 24 +++--- rules/42-qemu-usb.rules | 13 +++ rules/50-udev-default.rules | 107 +++++++++++++++++++++++++ rules/60-persistent-alsa.rules | 14 ++++ rules/60-persistent-input.rules | 38 +++++++++ rules/60-persistent-serial.rules | 20 +++++ rules/60-persistent-storage-tape.rules | 25 ++++++ rules/60-persistent-storage.rules | 89 ++++++++++++++++++++ rules/75-net-description.rules | 14 ++++ rules/75-tty-description.rules | 14 ++++ rules/78-sound-card.rules | 83 +++++++++++++++++++ rules/80-drivers.rules | 12 +++ rules/95-udev-late.rules | 4 + rules/rules.d/42-qemu-usb.rules | 13 --- rules/rules.d/50-udev-default.rules | 107 ------------------------- rules/rules.d/60-persistent-alsa.rules | 14 ---- rules/rules.d/60-persistent-input.rules | 38 --------- rules/rules.d/60-persistent-serial.rules | 20 ----- rules/rules.d/60-persistent-storage-tape.rules | 25 ------ rules/rules.d/60-persistent-storage.rules | 89 -------------------- rules/rules.d/75-net-description.rules | 14 ---- rules/rules.d/75-tty-description.rules | 14 ---- rules/rules.d/78-sound-card.rules | 83 ------------------- rules/rules.d/80-drivers.rules | 12 --- rules/rules.d/95-udev-late.rules | 4 - 25 files changed, 445 insertions(+), 445 deletions(-) create mode 100644 rules/42-qemu-usb.rules create mode 100644 rules/50-udev-default.rules create mode 100644 rules/60-persistent-alsa.rules create mode 100644 rules/60-persistent-input.rules create mode 100644 rules/60-persistent-serial.rules create mode 100644 rules/60-persistent-storage-tape.rules create mode 100644 rules/60-persistent-storage.rules create mode 100644 rules/75-net-description.rules create mode 100644 rules/75-tty-description.rules create mode 100644 rules/78-sound-card.rules create mode 100644 rules/80-drivers.rules create mode 100644 rules/95-udev-late.rules delete mode 100644 rules/rules.d/42-qemu-usb.rules delete mode 100644 rules/rules.d/50-udev-default.rules delete mode 100644 rules/rules.d/60-persistent-alsa.rules delete mode 100644 rules/rules.d/60-persistent-input.rules delete mode 100644 rules/rules.d/60-persistent-serial.rules delete mode 100644 rules/rules.d/60-persistent-storage-tape.rules delete mode 100644 rules/rules.d/60-persistent-storage.rules delete mode 100644 rules/rules.d/75-net-description.rules delete mode 100644 rules/rules.d/75-tty-description.rules delete mode 100644 rules/rules.d/78-sound-card.rules delete mode 100644 rules/rules.d/80-drivers.rules delete mode 100644 rules/rules.d/95-udev-late.rules diff --git a/Makefile.am b/Makefile.am index d8d7ff6bc4..7b84c1c790 100644 --- a/Makefile.am +++ b/Makefile.am @@ -150,18 +150,18 @@ INSTALL_DATA_HOOKS += udev-confdirs udevrulesdir = $(libexecdir)/udev/rules.d dist_udevrules_DATA = \ - rules/rules.d/42-qemu-usb.rules \ - rules/rules.d/50-udev-default.rules \ - rules/rules.d/60-persistent-storage-tape.rules \ - rules/rules.d/60-persistent-serial.rules \ - rules/rules.d/60-persistent-input.rules \ - rules/rules.d/60-persistent-alsa.rules \ - rules/rules.d/60-persistent-storage.rules \ - rules/rules.d/75-net-description.rules \ - rules/rules.d/75-tty-description.rules \ - rules/rules.d/78-sound-card.rules \ - rules/rules.d/80-drivers.rules \ - rules/rules.d/95-udev-late.rules + rules/42-qemu-usb.rules \ + rules/50-udev-default.rules \ + rules/60-persistent-storage-tape.rules \ + rules/60-persistent-serial.rules \ + rules/60-persistent-input.rules \ + rules/60-persistent-alsa.rules \ + rules/60-persistent-storage.rules \ + rules/75-net-description.rules \ + rules/75-tty-description.rules \ + rules/78-sound-card.rules \ + rules/80-drivers.rules \ + rules/95-udev-late.rules udevconfdir = $(sysconfdir)/udev dist_udevconf_DATA = src/udev.conf diff --git a/rules/42-qemu-usb.rules b/rules/42-qemu-usb.rules new file mode 100644 index 0000000000..a4e3864714 --- /dev/null +++ b/rules/42-qemu-usb.rules @@ -0,0 +1,13 @@ +# +# Enable autosuspend for qemu emulated usb hid devices. +# +# Note that there are buggy qemu versions which advertise remote +# wakeup support but don't actually implement it correctly. This +# is the reason why we need a match for the serial number here. +# The serial number "42" is used to tag the implementations where +# remote wakeup is working. +# + +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" diff --git a/rules/50-udev-default.rules b/rules/50-udev-default.rules new file mode 100644 index 0000000000..5ad787fc76 --- /dev/null +++ b/rules/50-udev-default.rules @@ -0,0 +1,107 @@ +# do not edit this file, it will be overwritten on update + +KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" +KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" +KERNEL=="ptmx", GROUP="tty", MODE="0666" +KERNEL=="tty", GROUP="tty", MODE="0666" +KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" +KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty" + +# serial +KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout" +KERNEL=="mwave", GROUP="dialout" +KERNEL=="hvc*|hvsi*", GROUP="dialout" + +# virtio serial / console ports +KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" + +# mem +KERNEL=="null|zero|full|random|urandom", MODE="0666" +KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" + +# input +SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id" +KERNEL=="mouse*|mice|event*", MODE="0640" +KERNEL=="ts[0-9]*|uinput", MODE="0640" +KERNEL=="js[0-9]*", MODE="0644" + +# video4linux +SUBSYSTEM=="video4linux", GROUP="video" +KERNEL=="vttuner*", GROUP="video" +KERNEL=="vtx*|vbi*", GROUP="video" +KERNEL=="winradio*", GROUP="video" + +# graphics +KERNEL=="agpgart", GROUP="video" +KERNEL=="pmu", GROUP="video" +KERNEL=="nvidia*|nvidiactl*", GROUP="video" +SUBSYSTEM=="graphics", GROUP="video" +SUBSYSTEM=="drm", GROUP="video" + +# sound +SUBSYSTEM=="sound", GROUP="audio", \ + OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer" + +# DVB (video) +SUBSYSTEM=="dvb", GROUP="video" + +# FireWire (firewire-core driver: IIDC devices, AV/C devices) +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="video" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" +SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" + +# 'libusb' device nodes +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id" + +# printer +KERNEL=="parport[0-9]*", GROUP="lp" +SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" +SUBSYSTEM=="ppdev", GROUP="lp" +KERNEL=="lp[0-9]*", GROUP="lp" +KERNEL=="irlpt[0-9]*", GROUP="lp" +SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="lp" + +# block +SUBSYSTEM=="block", GROUP="disk" + +# floppy +SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy" + +# cdrom +SUBSYSTEM=="block", KERNEL=="sr[0-9]*", GROUP="cdrom" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" +KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" +KERNEL=="pktcdvd", GROUP="cdrom" + +# tape +KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="tape" +KERNEL=="pt[0-9]*|npt[0-9]*|pht[0-9]*", GROUP="tape" +SUBSYSTEM=="scsi_generic|scsi_tape", SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape" + +# block-related +KERNEL=="sch[0-9]*", GROUP="disk" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk" +KERNEL=="pg[0-9]*", GROUP="disk" +KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" +KERNEL=="rawctl", GROUP="disk" +SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", GROUP="disk" +SUBSYSTEM=="aoe", GROUP="disk", MODE="0220" +SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" + +# network +KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" +KERNEL=="rfkill", MODE="0644" + +# CPU +KERNEL=="cpu[0-9]*", MODE="0444" + +KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse" + +SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc" +KERNEL=="mmtimer", MODE="0644" +KERNEL=="rflash[0-9]*", MODE="0400" +KERNEL=="rrom[0-9]*", MODE="0400" + +SUBSYSTEM=="firmware", ACTION=="add", IMPORT{builtin}="firmware" diff --git a/rules/60-persistent-alsa.rules b/rules/60-persistent-alsa.rules new file mode 100644 index 0000000000..8154e2dbb5 --- /dev/null +++ b/rules/60-persistent-alsa.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="persistent_alsa_end" +SUBSYSTEM!="sound", GOTO="persistent_alsa_end" +KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end" + +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" + +IMPORT{builtin}="path_id" +ENV{ID_PATH}=="?*", SYMLINK+="snd/by-path/$env{ID_PATH}" + +LABEL="persistent_alsa_end" diff --git a/rules/60-persistent-input.rules b/rules/60-persistent-input.rules new file mode 100644 index 0000000000..fb798ddb05 --- /dev/null +++ b/rules/60-persistent-input.rules @@ -0,0 +1,38 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="persistent_input_end" +SUBSYSTEM!="input", GOTO="persistent_input_end" +SUBSYSTEMS=="bluetooth", GOTO="persistent_input_end" + +SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{builtin}="usb_id" + +# determine class name for persistent symlinks +ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd" +ENV{ID_INPUT_MOUSE}=="?*", ENV{.INPUT_CLASS}="mouse" +ENV{ID_INPUT_TOUCHPAD}=="?*", ENV{.INPUT_CLASS}="mouse" +ENV{ID_INPUT_TABLET}=="?*", ENV{.INPUT_CLASS}="mouse" +ENV{ID_INPUT_JOYSTICK}=="?*", ENV{.INPUT_CLASS}="joystick" +DRIVERS=="pcspkr", ENV{.INPUT_CLASS}="spkr" +ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{.INPUT_CLASS}="ir" + +# fill empty serial number +ENV{.INPUT_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" + +# by-id links +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{.INPUT_CLASS}" +KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", ATTRS{bInterfaceNumber}!="00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-$env{.INPUT_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{.INPUT_CLASS}" +KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", ATTRS{bInterfaceNumber}!="00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-event-$env{.INPUT_CLASS}" +# allow empty class for USB devices, by appending the interface number +SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \ + SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" + +# by-path +SUBSYSTEMS=="pci|usb|platform|acpi", IMPORT{builtin}="path_id" +ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{.INPUT_CLASS}" +ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{.INPUT_CLASS}" +# allow empty class for platform and usb devices; platform supports only a single interface that way +SUBSYSTEMS=="usb|platform", ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", \ + SYMLINK+="input/by-path/$env{ID_PATH}-event" + +LABEL="persistent_input_end" diff --git a/rules/60-persistent-serial.rules b/rules/60-persistent-serial.rules new file mode 100644 index 0000000000..2948200c53 --- /dev/null +++ b/rules/60-persistent-serial.rules @@ -0,0 +1,20 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="persistent_serial_end" +SUBSYSTEM!="tty", GOTO="persistent_serial_end" +KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="persistent_serial_end" + +SUBSYSTEMS=="usb-serial", ENV{.ID_PORT}="$attr{port_number}" + +IMPORT{builtin}="path_id" +ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}" +ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{.ID_PORT}" + +IMPORT{builtin}="usb_id" +ENV{ID_SERIAL}=="", GOTO="persistent_serial_end" +SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACE_NUM}="$attr{bInterfaceNumber}" +ENV{ID_USB_INTERFACE_NUM}=="", GOTO="persistent_serial_end" +ENV{.ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}" +ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}-port$env{.ID_PORT}" + +LABEL="persistent_serial_end" diff --git a/rules/60-persistent-storage-tape.rules b/rules/60-persistent-storage-tape.rules new file mode 100644 index 0000000000..f2eabd92a8 --- /dev/null +++ b/rules/60-persistent-storage-tape.rules @@ -0,0 +1,25 @@ +# do not edit this file, it will be overwritten on update + +# persistent storage links: /dev/tape/{by-id,by-path} + +ACTION=="remove", GOTO="persistent_storage_tape_end" + +# type 8 devices are "Medium Changers" +SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $devnode", \ + SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" + +SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" + +KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{.BSG_DEV}="$root/bsg/$id" +KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export --device=$env{.BSG_DEV}", ENV{ID_BUS}="scsi" +KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" + +# by-path (parent device path) +KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{builtin}="path_id" +KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" +KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst" + +LABEL="persistent_storage_tape_end" diff --git a/rules/60-persistent-storage.rules b/rules/60-persistent-storage.rules new file mode 100644 index 0000000000..b74821edd4 --- /dev/null +++ b/rules/60-persistent-storage.rules @@ -0,0 +1,89 @@ +# do not edit this file, it will be overwritten on update + +# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} +# scheme based on "Linux persistent device names", 2004, Hannes Reinecke + +# forward scsi device event to corresponding block device +ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" + +ACTION=="remove", GOTO="persistent_storage_end" + +# enable in-kernel media-presence polling +ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000" + +SUBSYSTEM!="block", GOTO="persistent_storage_end" + +# skip rules for inappropriate block devices +KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end" + +# ignore partitions that span the entire disk +TEST=="whole_disk", GOTO="persistent_storage_end" + +# for partitions import parent information +ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" + +# virtio-blk +KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" +KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" + +# ATA devices with their own "ata" kernel subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $devnode" +# ATA devices using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode" +# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $devnode" + +# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $devnode" +# Otherwise fall back to using usb_id for USB devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" + +# scsi devices +KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="scsi" +KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="cciss" +KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" +KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" + +# firewire +KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" +KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" + +KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" +KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" +KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" + +# by-path (parent device path) +ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" +ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" +ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" + +# skip unpartitioned removable media devices from drivers which do not send "change" events +ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" + +# probe filesystem metadata of optical drives which have a media inserted +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \ + IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}" +# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET +KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \ + IMPORT{builtin}="blkid --noraid" + +# probe filesystem metadata of disks +KERNEL!="sr*", IMPORT{builtin}="blkid" + +# watch metadata changes by tools closing the device after writing +KERNEL!="sr*", OPTIONS+="watch" + +# by-label/by-uuid links (filesystem metadata) +ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" +ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" + +# by-id (World Wide Name) +ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" +ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" + +# by-partlabel/by-partuuid links (partition metadata) +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}" +ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" + +LABEL="persistent_storage_end" diff --git a/rules/75-net-description.rules b/rules/75-net-description.rules new file mode 100644 index 0000000000..ce57d48e86 --- /dev/null +++ b/rules/75-net-description.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="net_end" +SUBSYSTEM!="net", GOTO="net_end" + +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" +SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" +SUBSYSTEMS=="usb", GOTO="net_end" + +SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" +SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" + +LABEL="net_end" diff --git a/rules/75-tty-description.rules b/rules/75-tty-description.rules new file mode 100644 index 0000000000..2e63e140cb --- /dev/null +++ b/rules/75-tty-description.rules @@ -0,0 +1,14 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="tty_end" +SUBSYSTEM!="tty", GOTO="tty_end" + +SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" +SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" +SUBSYSTEMS=="usb", GOTO="tty_end" + +SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" +SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" + +LABEL="tty_end" diff --git a/rules/78-sound-card.rules b/rules/78-sound-card.rules new file mode 100644 index 0000000000..cca88f1ec3 --- /dev/null +++ b/rules/78-sound-card.rules @@ -0,0 +1,83 @@ +# do not edit this file, it will be overwritten on update + +SUBSYSTEM!="sound", GOTO="sound_end" + +ACTION=="add|change", KERNEL=="controlC*", ATTR{../uevent}="change" +ACTION!="change", GOTO="sound_end" + +# Ok, we probably need a little explanation here for what the two lines above +# are good for. +# +# The story goes like this: when ALSA registers a new sound card it emits a +# series of 'add' events to userspace, for the main card device and for all the +# child device nodes that belong to it. udev relays those to applications, +# however only maintains the order between father and child, but not between +# the siblings. The control device node creation can be used as synchronization +# point. All other devices that belong to a card are created in the kernel +# before it. However unfortunately due to the fact that siblings are forwarded +# out of order by udev this fact is lost to applications. +# +# OTOH before an application can open a device it needs to make sure that all +# its device nodes are completely created and set up. +# +# As a workaround for this issue we have added the udev rule above which will +# generate a 'change' event on the main card device from the 'add' event of the +# card's control device. Due to the ordering semantics of udev this event will +# only be relayed after all child devices have finished processing properly. +# When an application needs to listen for appearing devices it can hence look +# for 'change' events only, and ignore the actual 'add' events. +# +# When the application is initialized at the same time as a device is plugged +# in it may need to figure out if the 'change' event has already been triggered +# or not for a card. To find that out we store the flag environment variable +# SOUND_INITIALIZED on the device which simply tells us if the card 'change' +# event has already been processed. + +KERNEL!="card*", GOTO="sound_end" + +ENV{SOUND_INITIALIZED}="1" + +SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" +SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" +SUBSYSTEMS=="usb", GOTO="skip_pci" + +SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" +SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" + +LABEL="skip_pci" + +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}-$attr{id}" +ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$attr{id}" + +IMPORT{builtin}="path_id" + +# The values used here for $SOUND_FORM_FACTOR and $SOUND_CLASS should be kept +# in sync with those defined for PulseAudio's src/pulse/proplist.h +# PA_PROP_DEVICE_FORM_FACTOR, PA_PROP_DEVICE_CLASS properties. + +# If the first PCM device of this card has the pcm class 'modem', then the card is a modem +ATTR{pcmC%nD0p/pcm_class}=="modem", ENV{SOUND_CLASS}="modem", GOTO="sound_end" + +# Identify cards on the internal PCI bus as internal +SUBSYSTEMS=="pci", DEVPATH=="*/0000:00:??.?/sound/*", ENV{SOUND_FORM_FACTOR}="internal", GOTO="sound_end" + +# Devices that also support Image/Video interfaces are most likely webcams +SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACES}=="*:0e????:*", ENV{SOUND_FORM_FACTOR}="webcam", GOTO="sound_end" + +# Matching on the model strings is a bit ugly, I admit +ENV{ID_MODEL}=="*[Ss]peaker*", ENV{SOUND_FORM_FACTOR}="speaker", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Ss]peaker*", ENV{SOUND_FORM_FACTOR}="speaker", GOTO="sound_end" + +ENV{ID_MODEL}=="*[Hh]eadphone*", ENV{SOUND_FORM_FACTOR}="headphone", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Hh]eadphone*", ENV{SOUND_FORM_FACTOR}="headphone", GOTO="sound_end" + +ENV{ID_MODEL}=="*[Hh]eadset*", ENV{SOUND_FORM_FACTOR}="headset", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Hh]eadset*", ENV{SOUND_FORM_FACTOR}="headset", GOTO="sound_end" + +ENV{ID_MODEL}=="*[Hh]andset*", ENV{SOUND_FORM_FACTOR}="handset", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Hh]andset*", ENV{SOUND_FORM_FACTOR}="handset", GOTO="sound_end" + +ENV{ID_MODEL}=="*[Mm]icrophone*", ENV{SOUND_FORM_FACTOR}="microphone", GOTO="sound_end" +ENV{ID_MODEL_FROM_DATABASE}=="*[Mm]icrophone*", ENV{SOUND_FORM_FACTOR}="microphone", GOTO="sound_end" + +LABEL="sound_end" diff --git a/rules/80-drivers.rules b/rules/80-drivers.rules new file mode 100644 index 0000000000..38ebfeb0e6 --- /dev/null +++ b/rules/80-drivers.rules @@ -0,0 +1,12 @@ +# do not edit this file, it will be overwritten on update + +ACTION=="remove", GOTO="drivers_end" + +DRIVER!="?*", ENV{MODALIAS}=="?*", IMPORT{builtin}="kmod load $env{MODALIAS}" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", IMPORT{builtin}="kmod load tifm_sd" +SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", IMPORT{builtin}="kmod load tifm_ms" +SUBSYSTEM=="memstick", IMPORT{builtin}="kmod load ms_block mspro_block" +SUBSYSTEM=="i2o", IMPORT{builtin}="kmod load i2o_block" +SUBSYSTEM=="module", KERNEL=="parport_pc", IMPORT{builtin}="kmod load ppdev" + +LABEL="drivers_end" diff --git a/rules/95-udev-late.rules b/rules/95-udev-late.rules new file mode 100644 index 0000000000..eca0faa5c5 --- /dev/null +++ b/rules/95-udev-late.rules @@ -0,0 +1,4 @@ +# do not edit this file, it will be overwritten on update + +# run a command on remove events +ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" diff --git a/rules/rules.d/42-qemu-usb.rules b/rules/rules.d/42-qemu-usb.rules deleted file mode 100644 index a4e3864714..0000000000 --- a/rules/rules.d/42-qemu-usb.rules +++ /dev/null @@ -1,13 +0,0 @@ -# -# Enable autosuspend for qemu emulated usb hid devices. -# -# Note that there are buggy qemu versions which advertise remote -# wakeup support but don't actually implement it correctly. This -# is the reason why we need a match for the serial number here. -# The serial number "42" is used to tag the implementations where -# remote wakeup is working. -# - -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" diff --git a/rules/rules.d/50-udev-default.rules b/rules/rules.d/50-udev-default.rules deleted file mode 100644 index 5ad787fc76..0000000000 --- a/rules/rules.d/50-udev-default.rules +++ /dev/null @@ -1,107 +0,0 @@ -# do not edit this file, it will be overwritten on update - -KERNEL=="pty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" -KERNEL=="tty[pqrstuvwxyzabcdef][0123456789abcdef]", GROUP="tty", MODE="0660" -KERNEL=="ptmx", GROUP="tty", MODE="0666" -KERNEL=="tty", GROUP="tty", MODE="0666" -KERNEL=="tty[0-9]*", GROUP="tty", MODE="0620" -KERNEL=="vcs|vcs[0-9]*|vcsa|vcsa[0-9]*", GROUP="tty" - -# serial -KERNEL=="tty[A-Z]*[0-9]|pppox[0-9]*|ircomm[0-9]*|noz[0-9]*|rfcomm[0-9]*", GROUP="dialout" -KERNEL=="mwave", GROUP="dialout" -KERNEL=="hvc*|hvsi*", GROUP="dialout" - -# virtio serial / console ports -KERNEL=="vport*", ATTR{name}=="?*", SYMLINK+="virtio-ports/$attr{name}" - -# mem -KERNEL=="null|zero|full|random|urandom", MODE="0666" -KERNEL=="mem|kmem|port|nvram", GROUP="kmem", MODE="0640" - -# input -SUBSYSTEM=="input", ENV{ID_INPUT}=="", IMPORT{builtin}="input_id" -KERNEL=="mouse*|mice|event*", MODE="0640" -KERNEL=="ts[0-9]*|uinput", MODE="0640" -KERNEL=="js[0-9]*", MODE="0644" - -# video4linux -SUBSYSTEM=="video4linux", GROUP="video" -KERNEL=="vttuner*", GROUP="video" -KERNEL=="vtx*|vbi*", GROUP="video" -KERNEL=="winradio*", GROUP="video" - -# graphics -KERNEL=="agpgart", GROUP="video" -KERNEL=="pmu", GROUP="video" -KERNEL=="nvidia*|nvidiactl*", GROUP="video" -SUBSYSTEM=="graphics", GROUP="video" -SUBSYSTEM=="drm", GROUP="video" - -# sound -SUBSYSTEM=="sound", GROUP="audio", \ - OPTIONS+="static_node=snd/seq", OPTIONS+="static_node=snd/timer" - -# DVB (video) -SUBSYSTEM=="dvb", GROUP="video" - -# FireWire (firewire-core driver: IIDC devices, AV/C devices) -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010*", GROUP="video" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00b09d:0x00010*", GROUP="video" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" -SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x014001*", GROUP="video" - -# 'libusb' device nodes -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", MODE="0664" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", IMPORT{builtin}="usb_id" - -# printer -KERNEL=="parport[0-9]*", GROUP="lp" -SUBSYSTEM=="printer", KERNEL=="lp*", GROUP="lp" -SUBSYSTEM=="ppdev", GROUP="lp" -KERNEL=="lp[0-9]*", GROUP="lp" -KERNEL=="irlpt[0-9]*", GROUP="lp" -SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ENV{ID_USB_INTERFACES}=="*:0701??:*", GROUP="lp" - -# block -SUBSYSTEM=="block", GROUP="disk" - -# floppy -SUBSYSTEM=="block", KERNEL=="fd[0-9]", GROUP="floppy" - -# cdrom -SUBSYSTEM=="block", KERNEL=="sr[0-9]*", GROUP="cdrom" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="4|5", GROUP="cdrom" -KERNEL=="pktcdvd[0-9]*", GROUP="cdrom" -KERNEL=="pktcdvd", GROUP="cdrom" - -# tape -KERNEL=="ht[0-9]*|nht[0-9]*", GROUP="tape" -KERNEL=="pt[0-9]*|npt[0-9]*|pht[0-9]*", GROUP="tape" -SUBSYSTEM=="scsi_generic|scsi_tape", SUBSYSTEMS=="scsi", ATTRS{type}=="1|8", GROUP="tape" - -# block-related -KERNEL=="sch[0-9]*", GROUP="disk" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="0", GROUP="disk" -KERNEL=="pg[0-9]*", GROUP="disk" -KERNEL=="qft[0-9]*|nqft[0-9]*|zqft[0-9]*|nzqft[0-9]*|rawqft[0-9]*|nrawqft[0-9]*", GROUP="disk" -KERNEL=="rawctl", GROUP="disk" -SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", GROUP="disk" -SUBSYSTEM=="aoe", GROUP="disk", MODE="0220" -SUBSYSTEM=="aoe", KERNEL=="err", MODE="0440" - -# network -KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun" -KERNEL=="rfkill", MODE="0644" - -# CPU -KERNEL=="cpu[0-9]*", MODE="0444" - -KERNEL=="fuse", ACTION=="add", MODE="0666", OPTIONS+="static_node=fuse" - -SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc" -KERNEL=="mmtimer", MODE="0644" -KERNEL=="rflash[0-9]*", MODE="0400" -KERNEL=="rrom[0-9]*", MODE="0400" - -SUBSYSTEM=="firmware", ACTION=="add", IMPORT{builtin}="firmware" diff --git a/rules/rules.d/60-persistent-alsa.rules b/rules/rules.d/60-persistent-alsa.rules deleted file mode 100644 index 8154e2dbb5..0000000000 --- a/rules/rules.d/60-persistent-alsa.rules +++ /dev/null @@ -1,14 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="persistent_alsa_end" -SUBSYSTEM!="sound", GOTO="persistent_alsa_end" -KERNEL!="controlC[0-9]*", GOTO="persistent_alsa_end" - -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" -ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}" -ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", SYMLINK+="snd/by-id/$env{ID_BUS}-$env{ID_SERIAL}" - -IMPORT{builtin}="path_id" -ENV{ID_PATH}=="?*", SYMLINK+="snd/by-path/$env{ID_PATH}" - -LABEL="persistent_alsa_end" diff --git a/rules/rules.d/60-persistent-input.rules b/rules/rules.d/60-persistent-input.rules deleted file mode 100644 index fb798ddb05..0000000000 --- a/rules/rules.d/60-persistent-input.rules +++ /dev/null @@ -1,38 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="persistent_input_end" -SUBSYSTEM!="input", GOTO="persistent_input_end" -SUBSYSTEMS=="bluetooth", GOTO="persistent_input_end" - -SUBSYSTEMS=="usb", ENV{ID_BUS}=="", IMPORT{builtin}="usb_id" - -# determine class name for persistent symlinks -ENV{ID_INPUT_KEYBOARD}=="?*", ENV{.INPUT_CLASS}="kbd" -ENV{ID_INPUT_MOUSE}=="?*", ENV{.INPUT_CLASS}="mouse" -ENV{ID_INPUT_TOUCHPAD}=="?*", ENV{.INPUT_CLASS}="mouse" -ENV{ID_INPUT_TABLET}=="?*", ENV{.INPUT_CLASS}="mouse" -ENV{ID_INPUT_JOYSTICK}=="?*", ENV{.INPUT_CLASS}="joystick" -DRIVERS=="pcspkr", ENV{.INPUT_CLASS}="spkr" -ATTRS{name}=="*dvb*|*DVB*|* IR *", ENV{.INPUT_CLASS}="ir" - -# fill empty serial number -ENV{.INPUT_CLASS}=="?*", ENV{ID_SERIAL}=="", ENV{ID_SERIAL}="noserial" - -# by-id links -KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-$env{.INPUT_CLASS}" -KERNEL=="mouse*|js*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", ATTRS{bInterfaceNumber}!="00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-$env{.INPUT_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-$env{.INPUT_CLASS}" -KERNEL=="event*", ENV{ID_BUS}=="?*", ENV{.INPUT_CLASS}=="?*", ATTRS{bInterfaceNumber}=="?*", ATTRS{bInterfaceNumber}!="00", SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$attr{bInterfaceNumber}-event-$env{.INPUT_CLASS}" -# allow empty class for USB devices, by appending the interface number -SUBSYSTEMS=="usb", ENV{ID_BUS}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", ATTRS{bInterfaceNumber}=="?*", \ - SYMLINK+="input/by-id/$env{ID_BUS}-$env{ID_SERIAL}-event-if$attr{bInterfaceNumber}" - -# by-path -SUBSYSTEMS=="pci|usb|platform|acpi", IMPORT{builtin}="path_id" -ENV{ID_PATH}=="?*", KERNEL=="mouse*|js*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-$env{.INPUT_CLASS}" -ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="?*", SYMLINK+="input/by-path/$env{ID_PATH}-event-$env{.INPUT_CLASS}" -# allow empty class for platform and usb devices; platform supports only a single interface that way -SUBSYSTEMS=="usb|platform", ENV{ID_PATH}=="?*", KERNEL=="event*", ENV{.INPUT_CLASS}=="", \ - SYMLINK+="input/by-path/$env{ID_PATH}-event" - -LABEL="persistent_input_end" diff --git a/rules/rules.d/60-persistent-serial.rules b/rules/rules.d/60-persistent-serial.rules deleted file mode 100644 index 2948200c53..0000000000 --- a/rules/rules.d/60-persistent-serial.rules +++ /dev/null @@ -1,20 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="persistent_serial_end" -SUBSYSTEM!="tty", GOTO="persistent_serial_end" -KERNEL!="ttyUSB[0-9]*|ttyACM[0-9]*", GOTO="persistent_serial_end" - -SUBSYSTEMS=="usb-serial", ENV{.ID_PORT}="$attr{port_number}" - -IMPORT{builtin}="path_id" -ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="", SYMLINK+="serial/by-path/$env{ID_PATH}" -ENV{ID_PATH}=="?*", ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-path/$env{ID_PATH}-port$env{.ID_PORT}" - -IMPORT{builtin}="usb_id" -ENV{ID_SERIAL}=="", GOTO="persistent_serial_end" -SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACE_NUM}="$attr{bInterfaceNumber}" -ENV{ID_USB_INTERFACE_NUM}=="", GOTO="persistent_serial_end" -ENV{.ID_PORT}=="", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}" -ENV{.ID_PORT}=="?*", SYMLINK+="serial/by-id/$env{ID_BUS}-$env{ID_SERIAL}-if$env{ID_USB_INTERFACE_NUM}-port$env{.ID_PORT}" - -LABEL="persistent_serial_end" diff --git a/rules/rules.d/60-persistent-storage-tape.rules b/rules/rules.d/60-persistent-storage-tape.rules deleted file mode 100644 index f2eabd92a8..0000000000 --- a/rules/rules.d/60-persistent-storage-tape.rules +++ /dev/null @@ -1,25 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# persistent storage links: /dev/tape/{by-id,by-path} - -ACTION=="remove", GOTO="persistent_storage_tape_end" - -# type 8 devices are "Medium Changers" -SUBSYSTEM=="scsi_generic", SUBSYSTEMS=="scsi", ATTRS{type}=="8", IMPORT{program}="scsi_id --sg-version=3 --export --whitelisted -d $devnode", \ - SYMLINK+="tape/by-id/scsi-$env{ID_SERIAL}" - -SUBSYSTEM!="scsi_tape", GOTO="persistent_storage_tape_end" - -KERNEL=="st*[0-9]|nst*[0-9]", ATTRS{ieee1394_id}=="?*", ENV{ID_SERIAL}="$attr{ieee1394_id}", ENV{ID_BUS}="ieee1394" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", KERNELS=="[0-9]*:*[0-9]", ENV{.BSG_DEV}="$root/bsg/$id" -KERNEL=="st*[0-9]|nst*[0-9]", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --whitelisted --export --device=$env{.BSG_DEV}", ENV{ID_BUS}="scsi" -KERNEL=="st*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="nst*[0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="tape/by-id/$env{ID_BUS}-$env{ID_SERIAL}-nst" - -# by-path (parent device path) -KERNEL=="st*[0-9]|nst*[0-9]", IMPORT{builtin}="path_id" -KERNEL=="st*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}" -KERNEL=="nst*[0-9]", ENV{ID_PATH}=="?*", SYMLINK+="tape/by-path/$env{ID_PATH}-nst" - -LABEL="persistent_storage_tape_end" diff --git a/rules/rules.d/60-persistent-storage.rules b/rules/rules.d/60-persistent-storage.rules deleted file mode 100644 index b74821edd4..0000000000 --- a/rules/rules.d/60-persistent-storage.rules +++ /dev/null @@ -1,89 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# persistent storage links: /dev/disk/{by-id,by-uuid,by-label,by-path} -# scheme based on "Linux persistent device names", 2004, Hannes Reinecke - -# forward scsi device event to corresponding block device -ACTION=="change", SUBSYSTEM=="scsi", ENV{DEVTYPE}=="scsi_device", TEST=="block", ATTR{block/*/uevent}="change" - -ACTION=="remove", GOTO="persistent_storage_end" - -# enable in-kernel media-presence polling -ACTION=="add", SUBSYSTEM=="module", KERNEL=="block", ATTR{parameters/events_dfl_poll_msecs}=="0", ATTR{parameters/events_dfl_poll_msecs}="2000" - -SUBSYSTEM!="block", GOTO="persistent_storage_end" - -# skip rules for inappropriate block devices -KERNEL=="fd*|mtd*|nbd*|gnbd*|btibm*|dm-*|md*", GOTO="persistent_storage_end" - -# ignore partitions that span the entire disk -TEST=="whole_disk", GOTO="persistent_storage_end" - -# for partitions import parent information -ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*" - -# virtio-blk -KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}" -KERNEL=="vd*[0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}-part%n" - -# ATA devices with their own "ata" kernel subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="ata", IMPORT{program}="ata_id --export $devnode" -# ATA devices using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode" -# ATA/ATAPI devices (SPC-3 or later) using the "scsi" subsystem -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $devnode" - -# Run ata_id on non-removable USB Mass Storage (SATA/PATA disks in enclosures) -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", ATTR{removable}=="0", SUBSYSTEMS=="usb", IMPORT{program}="ata_id --export $devnode" -# Otherwise fall back to using usb_id for USB devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" - -# scsi devices -KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="scsi" -KERNEL=="cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}!="?*", IMPORT{program}="scsi_id --export --whitelisted -d $devnode", ENV{ID_BUS}="cciss" -KERNEL=="sd*|sr*|cciss*", ENV{DEVTYPE}=="disk", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}" -KERNEL=="sd*|cciss*", ENV{DEVTYPE}=="partition", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}-part%n" - -# firewire -KERNEL=="sd*[!0-9]|sr*", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}" -KERNEL=="sd*[0-9]", ATTRS{ieee1394_id}=="?*", SYMLINK+="disk/by-id/ieee1394-$attr{ieee1394_id}-part%n" - -KERNEL=="mmcblk[0-9]", SUBSYSTEMS=="mmc", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mmcblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/mmc-$env{ID_NAME}_$env{ID_SERIAL}-part%n" -KERNEL=="mspblk[0-9]", SUBSYSTEMS=="memstick", ATTRS{name}=="?*", ATTRS{serial}=="?*", ENV{ID_NAME}="$attr{name}", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}" -KERNEL=="mspblk[0-9]p[0-9]", ENV{ID_NAME}=="?*", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/memstick-$env{ID_NAME}_$env{ID_SERIAL}-part%n" - -# by-path (parent device path) -ENV{DEVTYPE}=="disk", DEVPATH!="*/virtual/*", IMPORT{builtin}="path_id" -ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}" -ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n" - -# skip unpartitioned removable media devices from drivers which do not send "change" events -ENV{DEVTYPE}=="disk", KERNEL!="sd*|sr*", ATTR{removable}=="1", GOTO="persistent_storage_end" - -# probe filesystem metadata of optical drives which have a media inserted -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="?*", \ - IMPORT{builtin}="blkid --offset=$env{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}" -# single-session CDs do not have ID_CDROM_MEDIA_SESSION_LAST_OFFSET -KERNEL=="sr*", ENV{DISK_EJECT_REQUEST}!="?*", ENV{ID_CDROM_MEDIA_TRACK_COUNT_DATA}=="?*", ENV{ID_CDROM_MEDIA_SESSION_LAST_OFFSET}=="", \ - IMPORT{builtin}="blkid --noraid" - -# probe filesystem metadata of disks -KERNEL!="sr*", IMPORT{builtin}="blkid" - -# watch metadata changes by tools closing the device after writing -KERNEL!="sr*", OPTIONS+="watch" - -# by-label/by-uuid links (filesystem metadata) -ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}" -ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}" - -# by-id (World Wide Name) -ENV{DEVTYPE}=="disk", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}" -ENV{DEVTYPE}=="partition", ENV{ID_WWN_WITH_EXTENSION}=="?*", SYMLINK+="disk/by-id/wwn-$env{ID_WWN_WITH_EXTENSION}-part%n" - -# by-partlabel/by-partuuid links (partition metadata) -ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_UUID}=="?*", SYMLINK+="disk/by-partuuid/$env{ID_PART_ENTRY_UUID}" -ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", SYMLINK+="disk/by-partlabel/$env{ID_PART_ENTRY_NAME}" - -LABEL="persistent_storage_end" diff --git a/rules/rules.d/75-net-description.rules b/rules/rules.d/75-net-description.rules deleted file mode 100644 index ce57d48e86..0000000000 --- a/rules/rules.d/75-net-description.rules +++ /dev/null @@ -1,14 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="net_end" -SUBSYSTEM!="net", GOTO="net_end" - -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" -SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" -SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" -SUBSYSTEMS=="usb", GOTO="net_end" - -SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" -SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" - -LABEL="net_end" diff --git a/rules/rules.d/75-tty-description.rules b/rules/rules.d/75-tty-description.rules deleted file mode 100644 index 2e63e140cb..0000000000 --- a/rules/rules.d/75-tty-description.rules +++ /dev/null @@ -1,14 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="tty_end" -SUBSYSTEM!="tty", GOTO="tty_end" - -SUBSYSTEMS=="usb", ENV{ID_MODEL}=="", IMPORT{builtin}="usb_id" -SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" -SUBSYSTEMS=="usb", ATTRS{idVendor}!="", ATTRS{idProduct}!="", ENV{ID_VENDOR_ID}="$attr{idVendor}", ENV{ID_MODEL_ID}="$attr{idProduct}" -SUBSYSTEMS=="usb", GOTO="tty_end" - -SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" -SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" - -LABEL="tty_end" diff --git a/rules/rules.d/78-sound-card.rules b/rules/rules.d/78-sound-card.rules deleted file mode 100644 index cca88f1ec3..0000000000 --- a/rules/rules.d/78-sound-card.rules +++ /dev/null @@ -1,83 +0,0 @@ -# do not edit this file, it will be overwritten on update - -SUBSYSTEM!="sound", GOTO="sound_end" - -ACTION=="add|change", KERNEL=="controlC*", ATTR{../uevent}="change" -ACTION!="change", GOTO="sound_end" - -# Ok, we probably need a little explanation here for what the two lines above -# are good for. -# -# The story goes like this: when ALSA registers a new sound card it emits a -# series of 'add' events to userspace, for the main card device and for all the -# child device nodes that belong to it. udev relays those to applications, -# however only maintains the order between father and child, but not between -# the siblings. The control device node creation can be used as synchronization -# point. All other devices that belong to a card are created in the kernel -# before it. However unfortunately due to the fact that siblings are forwarded -# out of order by udev this fact is lost to applications. -# -# OTOH before an application can open a device it needs to make sure that all -# its device nodes are completely created and set up. -# -# As a workaround for this issue we have added the udev rule above which will -# generate a 'change' event on the main card device from the 'add' event of the -# card's control device. Due to the ordering semantics of udev this event will -# only be relayed after all child devices have finished processing properly. -# When an application needs to listen for appearing devices it can hence look -# for 'change' events only, and ignore the actual 'add' events. -# -# When the application is initialized at the same time as a device is plugged -# in it may need to figure out if the 'change' event has already been triggered -# or not for a card. To find that out we store the flag environment variable -# SOUND_INITIALIZED on the device which simply tells us if the card 'change' -# event has already been processed. - -KERNEL!="card*", GOTO="sound_end" - -ENV{SOUND_INITIALIZED}="1" - -SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" -SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" -SUBSYSTEMS=="usb", GOTO="skip_pci" - -SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" -SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" - -LABEL="skip_pci" - -ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="?*", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$env{ID_USB_INTERFACE_NUM}-$attr{id}" -ENV{ID_SERIAL}=="?*", ENV{ID_USB_INTERFACE_NUM}=="", ENV{ID_ID}="$env{ID_BUS}-$env{ID_SERIAL}-$attr{id}" - -IMPORT{builtin}="path_id" - -# The values used here for $SOUND_FORM_FACTOR and $SOUND_CLASS should be kept -# in sync with those defined for PulseAudio's src/pulse/proplist.h -# PA_PROP_DEVICE_FORM_FACTOR, PA_PROP_DEVICE_CLASS properties. - -# If the first PCM device of this card has the pcm class 'modem', then the card is a modem -ATTR{pcmC%nD0p/pcm_class}=="modem", ENV{SOUND_CLASS}="modem", GOTO="sound_end" - -# Identify cards on the internal PCI bus as internal -SUBSYSTEMS=="pci", DEVPATH=="*/0000:00:??.?/sound/*", ENV{SOUND_FORM_FACTOR}="internal", GOTO="sound_end" - -# Devices that also support Image/Video interfaces are most likely webcams -SUBSYSTEMS=="usb", ENV{ID_USB_INTERFACES}=="*:0e????:*", ENV{SOUND_FORM_FACTOR}="webcam", GOTO="sound_end" - -# Matching on the model strings is a bit ugly, I admit -ENV{ID_MODEL}=="*[Ss]peaker*", ENV{SOUND_FORM_FACTOR}="speaker", GOTO="sound_end" -ENV{ID_MODEL_FROM_DATABASE}=="*[Ss]peaker*", ENV{SOUND_FORM_FACTOR}="speaker", GOTO="sound_end" - -ENV{ID_MODEL}=="*[Hh]eadphone*", ENV{SOUND_FORM_FACTOR}="headphone", GOTO="sound_end" -ENV{ID_MODEL_FROM_DATABASE}=="*[Hh]eadphone*", ENV{SOUND_FORM_FACTOR}="headphone", GOTO="sound_end" - -ENV{ID_MODEL}=="*[Hh]eadset*", ENV{SOUND_FORM_FACTOR}="headset", GOTO="sound_end" -ENV{ID_MODEL_FROM_DATABASE}=="*[Hh]eadset*", ENV{SOUND_FORM_FACTOR}="headset", GOTO="sound_end" - -ENV{ID_MODEL}=="*[Hh]andset*", ENV{SOUND_FORM_FACTOR}="handset", GOTO="sound_end" -ENV{ID_MODEL_FROM_DATABASE}=="*[Hh]andset*", ENV{SOUND_FORM_FACTOR}="handset", GOTO="sound_end" - -ENV{ID_MODEL}=="*[Mm]icrophone*", ENV{SOUND_FORM_FACTOR}="microphone", GOTO="sound_end" -ENV{ID_MODEL_FROM_DATABASE}=="*[Mm]icrophone*", ENV{SOUND_FORM_FACTOR}="microphone", GOTO="sound_end" - -LABEL="sound_end" diff --git a/rules/rules.d/80-drivers.rules b/rules/rules.d/80-drivers.rules deleted file mode 100644 index 38ebfeb0e6..0000000000 --- a/rules/rules.d/80-drivers.rules +++ /dev/null @@ -1,12 +0,0 @@ -# do not edit this file, it will be overwritten on update - -ACTION=="remove", GOTO="drivers_end" - -DRIVER!="?*", ENV{MODALIAS}=="?*", IMPORT{builtin}="kmod load $env{MODALIAS}" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="SD", IMPORT{builtin}="kmod load tifm_sd" -SUBSYSTEM=="tifm", ENV{TIFM_CARD_TYPE}=="MS", IMPORT{builtin}="kmod load tifm_ms" -SUBSYSTEM=="memstick", IMPORT{builtin}="kmod load ms_block mspro_block" -SUBSYSTEM=="i2o", IMPORT{builtin}="kmod load i2o_block" -SUBSYSTEM=="module", KERNEL=="parport_pc", IMPORT{builtin}="kmod load ppdev" - -LABEL="drivers_end" diff --git a/rules/rules.d/95-udev-late.rules b/rules/rules.d/95-udev-late.rules deleted file mode 100644 index eca0faa5c5..0000000000 --- a/rules/rules.d/95-udev-late.rules +++ /dev/null @@ -1,4 +0,0 @@ -# do not edit this file, it will be overwritten on update - -# run a command on remove events -ACTION=="remove", ENV{REMOVE_CMD}!="", RUN+="$env{REMOVE_CMD}" -- cgit v1.2.3-54-g00ecf From 481dcf7c8fa8fd9fd181b59443b7e30e9b42add4 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 12 Mar 2012 18:40:23 +0100 Subject: extras: path_id - skip ATA transport class devices --- src/udev-builtin-path_id.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/udev-builtin-path_id.c b/src/udev-builtin-path_id.c index b18b162755..5de72194a2 100644 --- a/src/udev-builtin-path_id.c +++ b/src/udev-builtin-path_id.c @@ -317,6 +317,19 @@ static struct udev_device *handle_scsi(struct udev_device *parent, char **path) goto out; } + /* + * We do not support the ATA transport class, it creates duplicated link + * names as the fake SCSI host adapters are all separated, they are all + * re-based as host == 0. ATA should just stop faking two duplicated + * hierarchies for a single topology and leave the SCSI stuff alone; + * until that happens, there are no by-path/ links for ATA devices behind + * an ATA transport class. + */ + if (strstr(name, "/ata") != NULL) { + parent = NULL; + goto out; + } + parent = handle_scsi_default(parent, path); out: return parent; -- cgit v1.2.3-54-g00ecf From 3bfc7a97b1824fcdfb738617d9a5450a20a22a0f Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Mon, 12 Mar 2012 15:45:26 -0400 Subject: rules: Enable USB autosuspend on more USB HID devices Many servers will be connected to KVMs or include iLO support, and this is often presented as a set of USB input devices. Enabling autosuspend on these allows the USB hardware to be powered down, avoiding unnecessary wakeups and power consumption. The input devices will be self powered, so there's no risk of losing input events as there would be for real input devices. The same is true of USB input devices that are built into the system. --- Makefile.am | 2 +- rules/42-qemu-usb.rules | 13 ------------- rules/42-usb-hid-pm.rules | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 14 deletions(-) delete mode 100644 rules/42-qemu-usb.rules create mode 100644 rules/42-usb-hid-pm.rules diff --git a/Makefile.am b/Makefile.am index 7b84c1c790..5fb2c13a46 100644 --- a/Makefile.am +++ b/Makefile.am @@ -150,7 +150,7 @@ INSTALL_DATA_HOOKS += udev-confdirs udevrulesdir = $(libexecdir)/udev/rules.d dist_udevrules_DATA = \ - rules/42-qemu-usb.rules \ + rules/42-usb-hid-pm.rules \ rules/50-udev-default.rules \ rules/60-persistent-storage-tape.rules \ rules/60-persistent-serial.rules \ diff --git a/rules/42-qemu-usb.rules b/rules/42-qemu-usb.rules deleted file mode 100644 index a4e3864714..0000000000 --- a/rules/42-qemu-usb.rules +++ /dev/null @@ -1,13 +0,0 @@ -# -# Enable autosuspend for qemu emulated usb hid devices. -# -# Note that there are buggy qemu versions which advertise remote -# wakeup support but don't actually implement it correctly. This -# is the reason why we need a match for the serial number here. -# The serial number "42" is used to tag the implementations where -# remote wakeup is working. -# - -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" -ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" diff --git a/rules/42-usb-hid-pm.rules b/rules/42-usb-hid-pm.rules new file mode 100644 index 0000000000..d5d5897c31 --- /dev/null +++ b/rules/42-usb-hid-pm.rules @@ -0,0 +1,49 @@ +# +# Enable autosuspend for qemu emulated usb hid devices. +# +# Note that there are buggy qemu versions which advertise remote +# wakeup support but don't actually implement it correctly. This +# is the reason why we need a match for the serial number here. +# The serial number "42" is used to tag the implementations where +# remote wakeup is working. +# + +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Mouse", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{product}=="QEMU USB Keyboard", ATTR{serial}=="42", TEST=="power/control", ATTR{power/control}="auto" + +# +# Enable autosuspend for KVM and iLO usb hid devices. These are +# effectively self-powered (despite what some claim in their USB +# profiles) and so it's safe to do so. +# + +# AMI 046b:ff10 +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="046b", ATTR{idProduct}=="ff10", TEST=="power/control", ATTR{power/control}="auto" + +# +# Catch-all for Avocent HID devices. Keyed off interface in order to only +# trigger on HID class devices. +# +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="0624", ATTR{bInterfaceClass}=="03", TEST=="../power/control", ATTR{../power/control}="auto" + +# Dell DRAC 4 +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="2500", TEST=="power/control", ATTR{power/control}="auto" + +# Dell DRAC 5 +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="413c", ATTR{idProduct}=="0000", TEST=="power/control", ATTR{power/control}="auto" + +# Hewlett Packard iLO +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="03f0", ATTR{idProduct}=="7029", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="03f0", ATTR{idProduct}=="1027", TEST=="power/control", ATTR{power/control}="auto" + +# IBM remote access +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b3", ATTR{idProduct}=="4001", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="04b3", ATTR{idProduct}=="4002", TEST=="power/control", ATTR{power/control}="auto" +ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="04b3", ATTR{idProduct}=="4012", TEST=="power/control", ATTR{power/control}="auto" + +# Raritan Computer, Inc KVM. +ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="14dd", ATTR{idProduct}="0002", TEST=="power/control", ATTR{power/control}="auto" + +# USB HID devices that are internal to the machine should also be safe to autosuspend +ACTION=="add", SUBSYSTEM=="usb", ATTR{bInterfaceClass}=="03", ATTRS{removable}=="fixed", TEST=="../power/control", ATTR{../power/control}="auto" -- cgit v1.2.3-54-g00ecf From 746b5152cc15eb8c67bdfb5e17f8fc836cde9759 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Tue, 13 Mar 2012 12:55:53 +0100 Subject: extras: path_id - add comment about readdir() rebase logic --- src/udev-builtin-path_id.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/udev-builtin-path_id.c b/src/udev-builtin-path_id.c index 5de72194a2..a8559d2dd4 100644 --- a/src/udev-builtin-path_id.c +++ b/src/udev-builtin-path_id.c @@ -265,6 +265,11 @@ static struct udev_device *handle_scsi_default(struct udev_device *parent, char i = strtoul(&dent->d_name[4], &rest, 10); if (rest[0] != '\0') continue; + /* + * find the smallest number; the host really needs to export its + * own instance number per parent device; relying on the global host + * enumeration and plainly rebasing the numbers sounds unreliable + */ if (basenum == -1 || i < basenum) basenum = i; } -- cgit v1.2.3-54-g00ecf From 4b50a3d0048d13f6e37126f20f96e8bef262cbe2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Mar 2012 01:01:16 +0100 Subject: extras: ata_id - do not log error if HDIO_GET_IDENTITY fails kay: is this a valid issue: https://bugs.archlinux.org/task/27060 ? tomegun: udev does not really care if that fails kay: the suggestion there is to treat EINVAL the same way we treat ENOTTY (i.e. as an info only) if it really does not matter it might make sense to avoid bogus bug reports tomegun: done --- src/ata_id/ata_id.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/ata_id/ata_id.c b/src/ata_id/ata_id.c index 257f494496..846a73b547 100644 --- a/src/ata_id/ata_id.c +++ b/src/ata_id/ata_id.c @@ -532,13 +532,8 @@ int main(int argc, char *argv[]) } else { /* If this fails, then try HDIO_GET_IDENTITY */ if (ioctl(fd, HDIO_GET_IDENTITY, &id) != 0) { - if (errno == ENOTTY) { - info(udev, "HDIO_GET_IDENTITY unsupported for '%s'\n", node); - rc = 2; - } else { - err(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); - rc = 3; - } + info(udev, "HDIO_GET_IDENTITY failed for '%s': %m\n", node); + rc = 2; goto close; } } -- cgit v1.2.3-54-g00ecf From 91418155ae9034f466d436c314cd136309bc557d Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 14 Mar 2012 14:52:45 +0100 Subject: rules sort order: /lib, /run, /etc After long consideration we came to the conclusion that user configuration in /etc should always override the (generally computer generated) configuration in /run. User configuration should always be what matters over anything else. Hence rearrange the search orders accordingly. In general this should change very little as overriding like this is seldomn done so far, and the order between /etc and /usr stays the same. --- NEWS | 6 ++++++ src/libudev.c | 10 +++++----- src/udev-rules.c | 2 +- src/udev.xml | 14 +++++++------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/NEWS b/NEWS index 00ee648ca3..b19cf7b508 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,12 @@ The udev-acl tool is no longer provided, it will be part of a future ConsoleKit release. On systemd systems, advanced ConsoleKit and udev-acl functionality are provided by systemd. +Rules files in /etc/udev/rules.s/ with the same name as rules files in +/run/udev/rules.d/ now always have precedence. The stack of files is now: +/usr/lib (package), /run (runtime, auto-generated), /etc (admin), while +the later ones override the earlier ones. In other words: the admin has +always the last say. + udev 181 ======== diff --git a/src/libudev.c b/src/libudev.c index be24329adc..d954daef68 100644 --- a/src/libudev.c +++ b/src/libudev.c @@ -236,7 +236,7 @@ UDEV_EXPORT struct udev *udev_new(void) fclose(f); } - /* environment overwrites config */ + /* environment overrides config */ env = getenv("UDEV_LOG"); if (env != NULL) udev_set_log_priority(udev, util_log_priority(env)); @@ -260,15 +260,15 @@ UDEV_EXPORT struct udev *udev_new(void) if (!udev->rules_path[0]) goto err; + /* /run/udev -- runtime rules */ + if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0) + goto err; + /* /etc/udev -- local administration rules */ udev->rules_path[1] = strdup(SYSCONFDIR "/udev/rules.d"); if (!udev->rules_path[1]) goto err; - /* /run/udev -- runtime rules */ - if (asprintf(&udev->rules_path[2], "%s/rules.d", udev->run_path) < 0) - goto err; - udev->rules_path_count = 3; } diff --git a/src/udev-rules.c b/src/udev-rules.c index a5b4b7306a..8a85eae717 100644 --- a/src/udev-rules.c +++ b/src/udev-rules.c @@ -1737,7 +1737,7 @@ static int add_matching_files(struct udev *udev, struct udev_list *file_list, co dbg(udev, "put file '%s' into list\n", filename); /* * the basename is the key, the filename the value - * identical basenames from different directories overwrite each other + * identical basenames from different directories override each other * entries are sorted after basename */ udev_list_entry_add(file_list, dent->d_name, filename); diff --git a/src/udev.xml b/src/udev.xml index 4de434ee51..8eb583a823 100644 --- a/src/udev.xml +++ b/src/udev.xml @@ -72,15 +72,15 @@ Rules files The udev rules are read from the files located in the system rules directory /usr/lib/udev/rules.d, - the local administration directory /etc/udev/rules.d - and the volatile runtime directory /run/udev/rules.d. + the volatile runtime directory /run/udev/rules.d + and the local administration directory /etc/udev/rules.d. All rules files are collectively sorted and processed in lexical order, regardless of the directories in which they live. However, files with - identical file names replace each other. Files in /run - have the highest priority, files in /etc take precedence + identical file names replace each other. Files in /etc + have the highest priority, files in /run take precedence over files with the same name in /lib. This can be - used to overwrite a system rules file if needed; a symlink in - /etc with the same name as a rules file in + used to override a system-supplied rules file with a local file if needed; + a symlink in /etc with the same name as a rules file in /lib, pointing to /dev/null, disables the rules file entirely. @@ -343,7 +343,7 @@ - The permissions for the device node. Every specified value overwrites + The permissions for the device node. Every specified value overrides the compiled-in default value. -- cgit v1.2.3-54-g00ecf From 183215e7cd72474e7a077a1bd8a4db6f9cac60b5 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Mar 2012 17:04:47 +0100 Subject: build-sys: place build binaries in the root --- .gitignore | 51 ++++++----- Makefile.am | 198 +++++++++++++++++-------------------------- src/.gitignore | 1 - src/accelerometer/.gitignore | 1 - src/ata_id/.gitignore | 1 - src/cdrom_id/.gitignore | 1 - src/collect/.gitignore | 1 - src/floppy/.gitignore | 1 - src/gudev/docs/Makefile.am | 2 +- src/keymap/.gitignore | 1 - src/mtd_probe/.gitignore | 1 - src/scsi_id/.gitignore | 2 - src/v4l_id/.gitignore | 1 - test/udev-test.pl | 2 +- 14 files changed, 112 insertions(+), 152 deletions(-) delete mode 100644 src/accelerometer/.gitignore delete mode 100644 src/ata_id/.gitignore delete mode 100644 src/cdrom_id/.gitignore delete mode 100644 src/collect/.gitignore delete mode 100644 src/floppy/.gitignore delete mode 100644 src/mtd_probe/.gitignore delete mode 100644 src/v4l_id/.gitignore diff --git a/.gitignore b/.gitignore index e80fd08c68..fa3500ba96 100644 --- a/.gitignore +++ b/.gitignore @@ -8,24 +8,33 @@ .dirstamp Makefile Makefile.in -aclocal.m4 -autom4te.cache -config.h -config.h.in -config.log -config.status -config.guess -config.sub -libtool -ltmain.sh -install-sh -missing -configure -stamp-h1 -depcomp -udev-test-install -gtk-doc.make -udevd -udevadm -test-udev -test-libudev +/aclocal.m4 +/autom4te.cache +/config.h +/config.h.in +/config.log +/config.status +/config.guess +/config.sub +/libtool +/ltmain.sh +/install-sh +/missing +/configure +/stamp-h1 +/depcomp +/gtk-doc.make +/build-aux +/udev-test-install +/udevd +/udevadm +/test-udev +/test-libudev +/accelerometer +/ata_id +/cdrom_id +/collect +/mtd_probe +/v4l_id +/keymap +/scsi_id diff --git a/Makefile.am b/Makefile.am index 5fb2c13a46..3a5f3b5f76 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,5 @@ -# ------------------------------------------------------------------------------ # Copyright (C) 2008-2012 Kay Sievers # Copyright (C) 2009 Diego Elio 'Flameeyes' Pettenò -# ------------------------------------------------------------------------------ SUBDIRS = . @@ -9,6 +7,14 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} AM_MAKEFLAGS = --no-print-directory +LIBUDEV_CURRENT=13 +LIBUDEV_REVISION=1 +LIBUDEV_AGE=13 + +LIBGUDEV_CURRENT=1 +LIBGUDEV_REVISION=1 +LIBGUDEV_AGE=1 + AM_CPPFLAGS = \ -include $(top_builddir)/config.h \ -I$(top_srcdir)/src \ @@ -78,18 +84,13 @@ SED_PROCESS = \ $(AM_V_GEN)chmod +x $@ # ------------------------------------------------------------------------------ -# libudev -# ------------------------------------------------------------------------------ -LIBUDEV_CURRENT=13 -LIBUDEV_REVISION=1 -LIBUDEV_AGE=13 - SUBDIRS += src/docs include_HEADERS = src/libudev.h -lib_LTLIBRARIES = src/libudev.la +lib_LTLIBRARIES = libudev.la +noinst_LTLIBRARIES = libudev-private.la -src_libudev_la_SOURCES =\ +libudev_la_SOURCES =\ src/libudev-private.h \ src/libudev.c \ src/libudev-list.c \ @@ -99,22 +100,19 @@ src_libudev_la_SOURCES =\ src/libudev-monitor.c \ src/libudev-queue.c -src_libudev_la_LDFLAGS = \ +libudev_la_LDFLAGS = \ $(AM_LDFLAGS) \ -version-info $(LIBUDEV_CURRENT):$(LIBUDEV_REVISION):$(LIBUDEV_AGE) -noinst_LTLIBRARIES = \ - src/libudev-private.la - -src_libudev_private_la_SOURCES =\ - $(src_libudev_la_SOURCES) \ +libudev_private_la_SOURCES =\ + $(libudev_la_SOURCES) \ src/libudev-util-private.c \ src/libudev-device-private.c \ src/libudev-queue-private.c if WITH_SELINUX -src_libudev_private_la_SOURCES += src/libudev-selinux-private.c -src_libudev_private_la_LIBADD = $(SELINUX_LIBS) +libudev_private_la_SOURCES += src/libudev-selinux-private.c +libudev_private_la_LIBADD = $(SELINUX_LIBS) endif pkgconfigdir = $(libdir)/pkgconfig @@ -139,8 +137,6 @@ libudev-uninstall-move-hook: INSTALL_EXEC_HOOKS += libudev-install-move-hook UNINSTALL_EXEC_HOOKS += libudev-uninstall-move-hook -# ------------------------------------------------------------------------------ -# main udev # ------------------------------------------------------------------------------ udev-confdirs: -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d @@ -203,10 +199,10 @@ INSTALL_DATA_HOOKS += systemd-install-hook endif bin_PROGRAMS = \ - src/udevadm + udevadm pkglibexec_PROGRAMS = \ - src/udevd + udevd udev_common_sources = \ src/udev.h \ @@ -229,7 +225,7 @@ udev_common_CFLAGS = \ $(KMOD_CFLAGS) udev_common_LDADD = \ - src/libudev-private.la \ + libudev-private.la \ $(BLKID_LIBS) \ $(KMOD_LIBS) @@ -238,16 +234,16 @@ udev_common_CPPFLAGS = \ -DFIRMWARE_PATH="$(FIRMWARE_PATH)" \ -DUSB_DATABASE=\"$(USB_DATABASE)\" -DPCI_DATABASE=\"$(PCI_DATABASE)\" -src_udevd_SOURCES = \ +udevd_SOURCES = \ $(udev_common_sources) \ src/udevd.c \ src/sd-daemon.h \ src/sd-daemon.c -src_udevd_CFLAGS = $(udev_common_CFLAGS) -src_udevd_LDADD = $(udev_common_LDADD) -src_udevd_CPPFLAGS = $(udev_common_CPPFLAGS) +udevd_CFLAGS = $(udev_common_CFLAGS) +udevd_LDADD = $(udev_common_LDADD) +udevd_CPPFLAGS = $(udev_common_CPPFLAGS) -src_udevadm_SOURCES = \ +udevadm_SOURCES = \ $(udev_common_sources) \ src/udevadm.c \ src/udevadm-info.c \ @@ -257,12 +253,10 @@ src_udevadm_SOURCES = \ src/udevadm-trigger.c \ src/udevadm-test.c \ src/udevadm-test-builtin.c -src_udevadm_CFLAGS = $(udev_common_CFLAGS) -src_udevadm_LDADD = $(udev_common_LDADD) -src_udevadm_CPPFLAGS = $(udev_common_CPPFLAGS) +udevadm_CFLAGS = $(udev_common_CFLAGS) +udevadm_LDADD = $(udev_common_LDADD) +udevadm_CPPFLAGS = $(udev_common_CPPFLAGS) -# ------------------------------------------------------------------------------ -# udev man pages # ------------------------------------------------------------------------------ if ENABLE_MANPAGES dist_man_MANS += \ @@ -289,27 +283,25 @@ src/%.html : src/%.xml $(AM_V_GEN)$(XSLTPROC) -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/xhtml-1_1/docbook.xsl $< endif -# ------------------------------------------------------------------------------ -# udev tests # ------------------------------------------------------------------------------ TESTS = \ test/udev-test.pl \ test/rules-test.sh check_PROGRAMS = \ - src/test-libudev \ - src/test-udev + test-libudev \ + test-udev -src_test_libudev_SOURCES = src/test-libudev.c -src_test_libudev_LDADD = src/libudev.la +test_libudev_SOURCES = src/test-libudev.c +test_libudev_LDADD = libudev.la -src_test_udev_SOURCES = \ +test_udev_SOURCES = \ $(udev_common_sources) \ src/test-udev.c -src_test_udev_CFLAGS = $(udev_common_CFLAGS) -src_test_udev_LDADD = $(udev_common_LDADD) -src_test_udev_CPPFLAGS = $(udev_common_CPPFLAGS) -src_test_udev_DEPENDENCIES = test/sys +test_udev_CFLAGS = $(udev_common_CFLAGS) +test_udev_LDADD = $(udev_common_LDADD) +test_udev_CPPFLAGS = $(udev_common_CPPFLAGS) +test_udev_DEPENDENCIES = test/sys # packed sysfs test tree test/sys: @@ -322,68 +314,50 @@ DISTCLEAN_LOCAL_HOOKS += test-sys-distclean EXTRA_DIST += test/sys.tar.xz # ------------------------------------------------------------------------------ -# ata_id - ATA identify -# ------------------------------------------------------------------------------ -src_ata_id_ata_id_SOURCES = src/ata_id/ata_id.c -src_ata_id_ata_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/ata_id/ata_id +ata_id_SOURCES = src/ata_id/ata_id.c +ata_id_LDADD = libudev-private.la +pkglibexec_PROGRAMS += ata_id # ------------------------------------------------------------------------------ -# cdrom_id - optical drive/media capability -# ------------------------------------------------------------------------------ -src_cdrom_id_cdrom_id_SOURCES = src/cdrom_id/cdrom_id.c -src_cdrom_id_cdrom_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/cdrom_id/cdrom_id +cdrom_id_SOURCES = src/cdrom_id/cdrom_id.c +cdrom_id_LDADD = libudev-private.la +pkglibexec_PROGRAMS += cdrom_id dist_udevrules_DATA += src/cdrom_id/60-cdrom_id.rules # ------------------------------------------------------------------------------ -# collect - trigger action when a collection of devices appeared -# ------------------------------------------------------------------------------ -src_collect_collect_SOURCES = src/collect/collect.c -src_collect_collect_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/collect/collect +collect_SOURCES = src/collect/collect.c +collect_LDADD = libudev-private.la +pkglibexec_PROGRAMS += collect # ------------------------------------------------------------------------------ -# scsi_id - SCSI inquiry to get various serial numbers -# ------------------------------------------------------------------------------ -src_scsi_id_scsi_id_SOURCES =\ +scsi_id_SOURCES =\ src/scsi_id/scsi_id.c \ src/scsi_id/scsi_serial.c \ src/scsi_id/scsi.h \ src/scsi_id/scsi_id.h -src_scsi_id_scsi_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/scsi_id/scsi_id +scsi_id_LDADD = libudev-private.la +pkglibexec_PROGRAMS += scsi_id dist_man_MANS += src/scsi_id/scsi_id.8 EXTRA_DIST += src/scsi_id/README # ------------------------------------------------------------------------------ -# v4l_id - video4linux capabilities -# ------------------------------------------------------------------------------ -src_v4l_id_v4l_id_SOURCES = src/v4l_id/v4l_id.c -src_v4l_id_v4l_id_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/v4l_id/v4l_id +v4l_id_SOURCES = src/v4l_id/v4l_id.c +v4l_id_LDADD = libudev-private.la +pkglibexec_PROGRAMS += v4l_id dist_udevrules_DATA += src/v4l_id/60-persistent-v4l.rules # ------------------------------------------------------------------------------ -# accelerometer - updates device orientation -# ------------------------------------------------------------------------------ -src_accelerometer_accelerometer_SOURCES = src/accelerometer/accelerometer.c -src_accelerometer_accelerometer_LDADD = src/libudev-private.la -lm -pkglibexec_PROGRAMS += src/accelerometer/accelerometer +accelerometer_SOURCES = src/accelerometer/accelerometer.c +accelerometer_LDADD = libudev-private.la -lm +pkglibexec_PROGRAMS += accelerometer dist_udevrules_DATA += src/accelerometer/61-accelerometer.rules -if ENABLE_GUDEV -# ------------------------------------------------------------------------------ -# GUdev - libudev gobject interface # ------------------------------------------------------------------------------ -LIBGUDEV_CURRENT=1 -LIBGUDEV_REVISION=1 -LIBGUDEV_AGE=1 - +if ENABLE_GUDEV SUBDIRS += src/gudev/docs -src_gudev_libgudev_includedir=$(includedir)/gudev-1.0/gudev -src_gudev_libgudev_include_HEADERS = \ +libgudev_includedir=$(includedir)/gudev-1.0/gudev +libgudev_include_HEADERS = \ src/gudev/gudev.h \ src/gudev/gudevenums.h \ src/gudev/gudevenumtypes.h \ @@ -392,13 +366,13 @@ src_gudev_libgudev_include_HEADERS = \ src/gudev/gudevdevice.h \ src/gudev/gudevenumerator.h -lib_LTLIBRARIES += src/gudev/libgudev-1.0.la +lib_LTLIBRARIES += libgudev-1.0.la pkgconfig_DATA += src/gudev/gudev-1.0.pc EXTRA_DIST += src/gudev/gudev-1.0.pc.in CLEANFILES += src/gudev/gudev-1.0.pc -src_gudev_libgudev_1_0_la_SOURCES = \ +libgudev_1_0_la_SOURCES = \ src/gudev/gudevenums.h \ src/gudev/gudevenumtypes.h \ src/gudev/gudevenumtypes.h\ @@ -411,14 +385,14 @@ src_gudev_libgudev_1_0_la_SOURCES = \ src/gudev/gudevenumerator.c \ src/gudev/gudevprivate.h -nodist_src_gudev_libgudev_1_0_la_SOURCES = \ +nodist_libgudev_1_0_la_SOURCES = \ src/gudev/gudevmarshal.h \ src/gudev/gudevmarshal.c \ src/gudev/gudevenumtypes.h \ src/gudev/gudevenumtypes.c -BUILT_SOURCES += $(nodist_src_gudev_libgudev_1_0_la_SOURCES) +BUILT_SOURCES += $(nodist_libgudev_1_0_la_SOURCES) -src_gudev_libgudev_1_0_la_CPPFLAGS = \ +libgudev_1_0_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ -I$(top_builddir)/src\ -I$(top_srcdir)/src\ @@ -428,13 +402,13 @@ src_gudev_libgudev_1_0_la_CPPFLAGS = \ -D_GUDEV_COMPILATION \ -DG_LOG_DOMAIN=\"GUdev\" -src_gudev_libgudev_1_0_la_CFLAGS = \ +libgudev_1_0_la_CFLAGS = \ -fvisibility=default \ $(GLIB_CFLAGS) -src_gudev_libgudev_1_0_la_LIBADD = src/libudev.la $(GLIB_LIBS) +libgudev_1_0_la_LIBADD = libudev.la $(GLIB_LIBS) -src_gudev_libgudev_1_0_la_LDFLAGS = \ +libgudev_1_0_la_LDFLAGS = \ -version-info $(LIBGUDEV_CURRENT):$(LIBGUDEV_REVISION):$(LIBGUDEV_AGE) \ -export-dynamic -no-undefined \ -export-symbols-regex '^g_udev_.*' @@ -464,7 +438,7 @@ src/gudev/gudevenumtypes.c: src/gudev/gudevenumtypes.c.template src/gudev/gudeve $@.tmp && mv $@.tmp $@ if ENABLE_INTROSPECTION -src/gudev/GUdev-1.0.gir: src/gudev/libgudev-1.0.la $(G_IR_SCANNER) +src/gudev/GUdev-1.0.gir: libgudev-1.0.la $(G_IR_SCANNER) $(AM_V_GEN)$(G_IR_SCANNER) -v \ --warn-all \ --namespace GUdev \ @@ -522,18 +496,16 @@ INSTALL_EXEC_HOOKS += libgudev-install-move-hook UNINSTALL_EXEC_HOOKS += libgudev-uninstall-move-hook endif -if ENABLE_KEYMAP # ------------------------------------------------------------------------------ -# keymap - map custom hardware's multimedia keys -# ------------------------------------------------------------------------------ -src_keymap_keymap_SOURCES = src/keymap/keymap.c -src_keymap_keymap_CPPFLAGS = $(AM_CPPFLAGS) -I src/keymap -nodist_src_keymap_keymap_SOURCES = \ +if ENABLE_KEYMAP +keymap_SOURCES = src/keymap/keymap.c +keymap_CPPFLAGS = $(AM_CPPFLAGS) -I src/keymap +nodist_keymap_SOURCES = \ src/keymap/keys-from-name.h \ src/keymap/keys-to-name.h -BUILT_SOURCES += $(nodist_src_keymap_keymap_SOURCES) +BUILT_SOURCES += $(nodist_keymap_SOURCES) -pkglibexec_PROGRAMS += src/keymap/keymap +pkglibexec_PROGRAMS += keymap dist_doc_DATA = src/keymap/README.keymap.txt dist_udevrules_DATA += \ @@ -639,21 +611,17 @@ endif if ENABLE_MTD_PROBE # ------------------------------------------------------------------------------ -# mtd_probe - autoloads FTL module for mtd devices -# ------------------------------------------------------------------------------ -src_mtd_probe_mtd_probe_SOURCES = \ +mtd_probe_SOURCES = \ src/mtd_probe/mtd_probe.c \ src/mtd_probe/mtd_probe.h \ src/mtd_probe/probe_smartmedia.c -src_mtd_probe_mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) +mtd_probe_CPPFLAGS = $(AM_CPPFLAGS) dist_udevrules_DATA += src/mtd_probe/75-probe_mtd.rules -pkglibexec_PROGRAMS += src/mtd_probe/mtd_probe +pkglibexec_PROGRAMS += mtd_probe endif -if ENABLE_RULE_GENERATOR -# ------------------------------------------------------------------------------ -# rule_generator - persistent network and optical device rule generator # ------------------------------------------------------------------------------ +if ENABLE_RULE_GENERATOR dist_udevhome_SCRIPTS += \ src/rule_generator/write_cd_rules \ src/rule_generator/write_net_rules @@ -666,18 +634,14 @@ dist_udevrules_DATA += \ src/rule_generator/75-persistent-net-generator.rules endif -if ENABLE_FLOPPY -# ------------------------------------------------------------------------------ -# create_floppy_devices - historical floppy kernel device nodes (/dev/fd0h1440, ...) # ------------------------------------------------------------------------------ -src_create_floppy_devices_SOURCES = src/floppy/create_floppy_devices.c -src_create_floppy_devices_LDADD = src/libudev-private.la -pkglibexec_PROGRAMS += src/create_floppy_devices +if ENABLE_FLOPPY +create_floppy_devices_SOURCES = src/floppy/create_floppy_devices.c +create_floppy_devices_LDADD = libudev-private.la +pkglibexec_PROGRAMS += create_floppy_devices dist_udevrules_DATA += src/floppy/60-floppy.rules endif -# ------------------------------------------------------------------------------ -# install, uninstall, clean hooks # ------------------------------------------------------------------------------ clean-local: rm -rf udev-test-install @@ -702,8 +666,6 @@ distcheck-hook: $(DISTCHECK_HOOKS) distclean-local: $(DISTCLEAN_LOCAL_HOOKS) -# ------------------------------------------------------------------------------ -# custom release helpers # ------------------------------------------------------------------------------ PREVIOUS_VERSION = `expr $(VERSION) - 1` changelog: diff --git a/src/.gitignore b/src/.gitignore index 5da27a94dc..beb8604bc6 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -2,5 +2,4 @@ *.html udev.pc libudev.pc -libudev.so* udev*.service diff --git a/src/accelerometer/.gitignore b/src/accelerometer/.gitignore deleted file mode 100644 index dddc2204d4..0000000000 --- a/src/accelerometer/.gitignore +++ /dev/null @@ -1 +0,0 @@ -accelerometer diff --git a/src/ata_id/.gitignore b/src/ata_id/.gitignore deleted file mode 100644 index 77837266e6..0000000000 --- a/src/ata_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ata_id diff --git a/src/cdrom_id/.gitignore b/src/cdrom_id/.gitignore deleted file mode 100644 index 7d817ea74e..0000000000 --- a/src/cdrom_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cdrom_id diff --git a/src/collect/.gitignore b/src/collect/.gitignore deleted file mode 100644 index c30ad6527c..0000000000 --- a/src/collect/.gitignore +++ /dev/null @@ -1 +0,0 @@ -collect diff --git a/src/floppy/.gitignore b/src/floppy/.gitignore deleted file mode 100644 index 939f625a4a..0000000000 --- a/src/floppy/.gitignore +++ /dev/null @@ -1 +0,0 @@ -create_floppy_devices diff --git a/src/gudev/docs/Makefile.am b/src/gudev/docs/Makefile.am index 2f0a8cb3eb..cfe696c503 100644 --- a/src/gudev/docs/Makefile.am +++ b/src/gudev/docs/Makefile.am @@ -85,7 +85,7 @@ GTKDOC_CFLAGS = \ GTKDOC_LIBS = \ $(GLIB_LIBS) \ - $(top_builddir)/src/gudev/libgudev-1.0.la + $(top_builddir)/libgudev-1.0.la # This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.make diff --git a/src/keymap/.gitignore b/src/keymap/.gitignore index 01d62e2b6e..4567584f4e 100644 --- a/src/keymap/.gitignore +++ b/src/keymap/.gitignore @@ -1,5 +1,4 @@ keyboard-force-release.sh -keymap keys-from-name.gperf keys-from-name.h keys-to-name.h diff --git a/src/mtd_probe/.gitignore b/src/mtd_probe/.gitignore deleted file mode 100644 index 82b8ab501f..0000000000 --- a/src/mtd_probe/.gitignore +++ /dev/null @@ -1 +0,0 @@ -mtd_probe diff --git a/src/scsi_id/.gitignore b/src/scsi_id/.gitignore index 10e9ae743c..6aebddd809 100644 --- a/src/scsi_id/.gitignore +++ b/src/scsi_id/.gitignore @@ -1,3 +1 @@ -scsi_id -scsi_id.8 scsi_id_version.h diff --git a/src/v4l_id/.gitignore b/src/v4l_id/.gitignore deleted file mode 100644 index dffced9f08..0000000000 --- a/src/v4l_id/.gitignore +++ /dev/null @@ -1 +0,0 @@ -v4l_id diff --git a/test/udev-test.pl b/test/udev-test.pl index 0706c7ad5f..0b379b0d9a 100755 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -22,7 +22,7 @@ use strict; my $PWD = $ENV{PWD}; my $sysfs = "test/sys"; -my $udev_bin = "src/test-udev"; +my $udev_bin = "./test-udev"; my $valgrind = 0; my $udev_bin_valgrind = "valgrind --tool=memcheck --leak-check=yes --quiet $udev_bin"; my $udev_root = "udev-root"; -- cgit v1.2.3-54-g00ecf From a3a304ddc090db59cb3be0dcbf1c0d83fe84c33a Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sun, 18 Mar 2012 19:59:41 +0100 Subject: release 182 --- ChangeLog | 31 +++++++++++++++++++++++++++++++ NEWS | 23 ++++++++++++++++++----- configure.ac | 2 +- 3 files changed, 50 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 34a7cfb16f..dd58138263 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,34 @@ +Summary of changes from v181 to v182 +============================================ + +Kay Sievers (22): + build-sys: unpack test sysfs only for 'make check' + build-sys: add --disable-manpages + update sd-daemon files + test: remove outdated key attributes + update TOO + builtin: path_id - remove dead cciss code + rules: do not create by-id/scsi-* links for ATA devices + remove udev-acl + udev.conf - do not set any value by default + move src/extras subdirectories to src/ + rules: delete outdated 30-kernel-compat.rules + rules: move 42-qemu-usb.rules to rules/ dir + remove edd_id extra + build-sys: remove empty directory + rules: delete s390 rules, they will move to s390utils + update TODO + rules: move all rules to top level rules/ dir + extras: path_id - skip ATA transport class devices + extras: path_id - add comment about readdir() rebase logic + extras: ata_id - do not log error if HDIO_GET_IDENTITY fails + rules sort order: /lib, /run, /etc + build-sys: place build binaries in the root + +Matthew Garrett (1): + rules: Enable USB autosuspend on more USB HID devices + + Summary of changes from v180 to v181 ============================================ diff --git a/NEWS b/NEWS index b19cf7b508..f4f6f4e327 100644 --- a/NEWS +++ b/NEWS @@ -1,15 +1,28 @@ -udev 181 +udev 182 ======== -The udev-acl tool is no longer provided, it will be part of a future -ConsoleKit release. On systemd systems, advanced ConsoleKit and udev-acl -functionality are provided by systemd. - Rules files in /etc/udev/rules.s/ with the same name as rules files in /run/udev/rules.d/ now always have precedence. The stack of files is now: /usr/lib (package), /run (runtime, auto-generated), /etc (admin), while the later ones override the earlier ones. In other words: the admin has always the last say. +USB auto-suspend is now enabled by default for some built-in USB HID +devices. + +/dev/disk/by-path/ links are no longer created for ATA devices behind +an 'ATA transport class', the logic to extract predictable numbers does +not exist in the kernel at this moment. + +/dev/disk/by-id/scsi-* compatibility links are no longer created for +ATA devices, they have their own ata-* prefix. + +The s390 rule to set mode == 0666 for /dev/z90crypt is is removed from +the udev tree and will be part of s390utils (or alternatively could be +done by the kernel driver itself). + +The udev-acl tool is no longer provided, it will be part of a future +ConsoleKit release. On systemd systems, advanced ConsoleKit and udev-acl +functionality are provided by systemd. udev 181 ======== diff --git a/configure.ac b/configure.ac index 6e41550abe..b31b62f289 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.60) AC_INIT([udev], - [181], + [182], [linux-hotplug@vger.kernel.org], [udev], [http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html]) -- cgit v1.2.3-54-g00ecf From 427c9ba24a8138ea3a9c17ebc661df9290dfbcf2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Mar 2012 02:09:42 +0100 Subject: rules: sound - add vendor/model strings for firewire devices --- rules/78-sound-card.rules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rules/78-sound-card.rules b/rules/78-sound-card.rules index cca88f1ec3..cc6485c28b 100644 --- a/rules/78-sound-card.rules +++ b/rules/78-sound-card.rules @@ -41,6 +41,10 @@ SUBSYSTEMS=="usb", IMPORT{builtin}="usb_id" SUBSYSTEMS=="usb", IMPORT{builtin}="usb-db" SUBSYSTEMS=="usb", GOTO="skip_pci" +SUBSYSTEMS=="firewire", ATTRS{vendor_name}=="?*", ATTRS{model_name}=="?*", \ + ENV{ID_BUS}="firewire", ENV{ID_VENDOR}="$attr{vendor_name}", ENV{ID_MODEL}="$attr{model_name}" +SUBSYSTEMS=="firewire", GOTO="skip_pci" + SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" -- cgit v1.2.3-54-g00ecf From abac5c7976c019be41f187bf97d6acffbe6caa8d Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Wed, 21 Mar 2012 14:51:39 +0100 Subject: keymap: Add Samsung 90X3A Signed-off-by: Martin Pitt --- Makefile.am | 2 ++ src/keymap/95-keyboard-force-release.rules | 1 + src/keymap/95-keymap.rules | 1 + src/keymap/force-release-maps/samsung-90x3a | 6 ++++++ src/keymap/keymaps/samsung-90x3a | 5 +++++ 5 files changed, 15 insertions(+) create mode 100644 src/keymap/force-release-maps/samsung-90x3a create mode 100644 src/keymap/keymaps/samsung-90x3a diff --git a/Makefile.am b/Makefile.am index 3a5f3b5f76..fa8060b55d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -577,6 +577,7 @@ dist_udevkeymap_DATA = \ src/keymap/keymaps/onkyo \ src/keymap/keymaps/oqo-model2 \ src/keymap/keymaps/samsung-other \ + src/keymap/keymaps/samsung-90x3a \ src/keymap/keymaps/samsung-sq1us \ src/keymap/keymaps/samsung-sx20s \ src/keymap/keymaps/toshiba-satellite_a100 \ @@ -589,6 +590,7 @@ dist_udevkeymapforcerel_DATA = \ src/keymap/force-release-maps/dell-touchpad \ src/keymap/force-release-maps/hp-other \ src/keymap/force-release-maps/samsung-other \ + src/keymap/force-release-maps/samsung-90x3a \ src/keymap/force-release-maps/common-volume-keys src/keymap/keys.txt: $(INCLUDE_PREFIX)/linux/input.h diff --git a/src/keymap/95-keyboard-force-release.rules b/src/keymap/95-keyboard-force-release.rules index 79a1bc1cc4..03d56e8aa4 100644 --- a/src/keymap/95-keyboard-force-release.rules +++ b/src/keymap/95-keyboard-force-release.rules @@ -19,6 +19,7 @@ DRIVER!="atkbd", GOTO="force_release_end" ENV{DMI_VENDOR}="$attr{[dmi/id]sys_vendor}" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keyboard-force-release.sh $devpath samsung-other" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*", RUN+="keyboard-force-release.sh $devpath samsung-90x3a" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Studio 1557|Studio 1558", RUN+="keyboard-force-release.sh $devpath common-volume-keys" ENV{DMI_VENDOR}=="Dell Inc.", ATTR{[dmi/id]product_name}=="Latitude E*|Precision M*", RUN+="keyboard-force-release.sh $devpath dell-touchpad" diff --git a/src/keymap/95-keymap.rules b/src/keymap/95-keymap.rules index 26de03dcc7..bbf311a17a 100644 --- a/src/keymap/95-keymap.rules +++ b/src/keymap/95-keymap.rules @@ -143,6 +143,7 @@ ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", RUN+="keymap $name samsung-oth ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*SX20S*", RUN+="keymap $name samsung-sx20s" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="SQ1US", RUN+="keymap $name samsung-sq1us" ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*700Z*", RUN+="keymap $name 0xBA ejectcd 0x96 keyboardbrightnessup 0x97 keyboardbrightnessdown" +ENV{DMI_VENDOR}=="[sS][aA][mM][sS][uU][nN][gG]*", ATTR{[dmi/id]product_name}=="*90X3A*", RUN+="keymap $name samsung-90x3a" ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="SATELLITE A100", RUN+="keymap $name toshiba-satellite_a100" ENV{DMI_VENDOR}=="TOSHIBA", ATTR{[dmi/id]product_name}=="Satellite A110", RUN+="keymap $name toshiba-satellite_a110" diff --git a/src/keymap/force-release-maps/samsung-90x3a b/src/keymap/force-release-maps/samsung-90x3a new file mode 100644 index 0000000000..65707effb7 --- /dev/null +++ b/src/keymap/force-release-maps/samsung-90x3a @@ -0,0 +1,6 @@ +# list of scancodes (hex or decimal), optional comment +0xCE # Fn+F8 keyboard backlit up +0x8D # Fn+F7 keyboard backlit down +0x97 # Fn+F12 wifi on/off +0x96 # Fn+F1 performance mode (?) +0xD5 # Fn+F6 battery life extender diff --git a/src/keymap/keymaps/samsung-90x3a b/src/keymap/keymaps/samsung-90x3a new file mode 100644 index 0000000000..8b65eb6d03 --- /dev/null +++ b/src/keymap/keymaps/samsung-90x3a @@ -0,0 +1,5 @@ +0x96 kbdillumup         # Fn+F8 keyboard backlit up +0x97 kbdillumdown       # Fn+F7 keyboard backlit down +0xD5 wlan               # Fn+F12 wifi on/off +0xCE prog1              # Fn+F1 performance mode +0x8D prog2              # Fn+F6 battery life extender -- cgit v1.2.3-54-g00ecf From 8482018afc5d11f45badf4952a6134a5cc4b1ee2 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 21 Mar 2012 18:58:51 +0100 Subject: libudev: monitor - do not memset() receive buffer --- Makefile.am | 2 +- src/libudev-monitor.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index fa8060b55d..1c7f86b081 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,7 +8,7 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS} AM_MAKEFLAGS = --no-print-directory LIBUDEV_CURRENT=13 -LIBUDEV_REVISION=1 +LIBUDEV_REVISION=2 LIBUDEV_AGE=13 LIBGUDEV_CURRENT=1 diff --git a/src/libudev-monitor.c b/src/libudev-monitor.c index 0b57072158..77dc55572f 100644 --- a/src/libudev-monitor.c +++ b/src/libudev-monitor.c @@ -588,7 +588,6 @@ UDEV_EXPORT struct udev_device *udev_monitor_receive_device(struct udev_monitor retry: if (udev_monitor == NULL) return NULL; - memset(buf, 0x00, sizeof(buf)); iov.iov_base = &buf; iov.iov_len = sizeof(buf); memset (&smsg, 0x00, sizeof(struct msghdr)); -- cgit v1.2.3-54-g00ecf From 4db539b27021dcaa716828cbb689f591adb5af23 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Thu, 22 Mar 2012 03:44:57 +0100 Subject: rules: sound - set ID_ID for firewire devices --- rules/78-sound-card.rules | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rules/78-sound-card.rules b/rules/78-sound-card.rules index cc6485c28b..e564441893 100644 --- a/rules/78-sound-card.rules +++ b/rules/78-sound-card.rules @@ -43,8 +43,10 @@ SUBSYSTEMS=="usb", GOTO="skip_pci" SUBSYSTEMS=="firewire", ATTRS{vendor_name}=="?*", ATTRS{model_name}=="?*", \ ENV{ID_BUS}="firewire", ENV{ID_VENDOR}="$attr{vendor_name}", ENV{ID_MODEL}="$attr{model_name}" +SUBSYSTEMS=="firewire", ATTRS{guid}=="?*", ENV{ID_ID}="firewire-$attr{guid}" SUBSYSTEMS=="firewire", GOTO="skip_pci" + SUBSYSTEMS=="pci", IMPORT{builtin}="pci-db" SUBSYSTEMS=="pci", ENV{ID_BUS}="pci", ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{device}" -- cgit v1.2.3-54-g00ecf